diff --git a/.gitattributes b/.gitattributes index b223c8ac5fb..f0b1c67bd0f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,3 +9,7 @@ src/etc/installer/gfx/* binary *.woff binary src/vendor/** -text Cargo.lock -merge linguist-generated=false + +# Older git versions try to fix line endings on images, this prevents it. +*.png binary +*.ico binary diff --git a/.gitignore b/.gitignore index e18acfd98e2..67e0dd8e795 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ __pycache__/ .settings/ .valgrindrc .vscode/ +.favorites.json /*-*-*-*/ /*-*-*/ /Makefile diff --git a/.gitmodules b/.gitmodules index bf9bdd9a5b4..4e368c3ebaf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,13 +1,6 @@ -[submodule "src/llvm"] - path = src/llvm - url = https://github.com/rust-lang/llvm.git - branch = master [submodule "src/rust-installer"] path = src/tools/rust-installer url = https://github.com/rust-lang/rust-installer.git -[submodule "src/liblibc"] - path = src/liblibc - url = https://github.com/rust-lang/libc.git [submodule "src/doc/nomicon"] path = src/doc/nomicon url = https://github.com/rust-lang-nursery/nomicon.git @@ -23,9 +16,6 @@ [submodule "src/tools/rls"] path = src/tools/rls url = https://github.com/rust-lang-nursery/rls.git -[submodule "src/libcompiler_builtins"] - path = src/libcompiler_builtins - url = https://github.com/rust-lang-nursery/compiler-builtins.git [submodule "src/tools/clippy"] path = src/tools/clippy url = https://github.com/rust-lang-nursery/rust-clippy.git @@ -35,9 +25,6 @@ [submodule "src/tools/miri"] path = src/tools/miri url = https://github.com/solson/miri.git -[submodule "src/dlmalloc"] - path = src/dlmalloc - url = https://github.com/alexcrichton/dlmalloc-rs.git [submodule "src/doc/rust-by-example"] path = src/doc/rust-by-example url = https://github.com/rust-lang/rust-by-example.git @@ -47,18 +34,13 @@ [submodule "src/stdsimd"] path = src/stdsimd url = https://github.com/rust-lang-nursery/stdsimd.git -[submodule "src/tools/lld"] - path = src/tools/lld - url = https://github.com/rust-lang/lld.git -[submodule "src/libbacktrace"] - path = src/libbacktrace - url = https://github.com/rust-lang-nursery/libbacktrace.git -[submodule "src/tools/lldb"] - path = src/tools/lldb - url = https://github.com/rust-lang-nursery/lldb.git - branch = rust-release-80-v1 -[submodule "src/tools/clang"] - path = src/tools/clang - url = https://github.com/rust-lang-nursery/clang.git - branch = rust-release-80-v1 - +[submodule "src/doc/rustc-guide"] + path = src/doc/rustc-guide + url = https://github.com/rust-lang/rustc-guide.git +[submodule "src/doc/edition-guide"] + path = src/doc/edition-guide + url = https://github.com/rust-lang-nursery/edition-guide.git +[submodule "src/llvm-project"] + path = src/llvm-project + url = https://github.com/rust-lang/llvm-project.git + branch = rustc/8.0-2019-01-16 diff --git a/.travis.yml b/.travis.yml index 14fb17aeedd..c4efa884603 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: shell sudo: required -dist: trusty +dist: xenial services: - docker addons: @@ -16,7 +16,7 @@ matrix: fast_finish: true include: # Images used in testing PR and try-build should be run first. - - env: IMAGE=x86_64-gnu-llvm-5.0 RUST_BACKTRACE=1 + - env: IMAGE=x86_64-gnu-llvm-6.0 RUST_BACKTRACE=1 if: type = pull_request OR branch = auto - env: IMAGE=dist-x86_64-linux DEPLOY=1 @@ -177,7 +177,7 @@ matrix: - env: IMAGE=x86_64-gnu-aux if: branch = auto - env: IMAGE=x86_64-gnu-tools - if: branch = auto OR (type = pull_request AND commit_message =~ /(?i:^update.*\b(rls|rustfmt|clippy|miri)\b)/) + if: branch = auto OR (type = pull_request AND commit_message =~ /(?i:^update.*\b(rls|rustfmt|clippy|miri|cargo)\b)/) - env: IMAGE=x86_64-gnu-debug if: branch = auto - env: IMAGE=x86_64-gnu-nopt @@ -248,6 +248,15 @@ before_script: # Enable core dump on Linux. sudo sh -c 'echo "/checkout/obj/cores/core.%p.%E" > /proc/sys/kernel/core_pattern'; fi + - > + if [ "$IMAGE" = mingw-check ]; then + # verify the publish_toolstate script works. + git clone --depth=1 https://github.com/rust-lang-nursery/rust-toolstate.git; + cd rust-toolstate; + python2.7 "$TRAVIS_BUILD_DIR/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "" ""; + cd ..; + rm -rf rust-toolstate; + fi # Log time information from this machine and an external machine for insight into possible # clock drift. Timezones don't matter since relative deltas give all the necessary info. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index d70b2b52aca..ece8dedb0ae 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -35,6 +35,6 @@ And if someone takes issue with something you said or did, resist the urge to be The enforcement policies listed above apply to all official Rust venues; including official IRC channels (#rust, #rust-internals, #rust-tools, #rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang, and #cargo); GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org (users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion. -*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).* +*Adapted from the [Node.js Policy on Trolling](https://blog.izs.me/2012/08/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).* [mod_team]: https://www.rust-lang.org/team.html#Moderation-team diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fe6bea9d8dc..9924055ca45 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,9 +19,16 @@ hop on [#rust-internals][pound-rust-internals]. As a reminder, all contributors are expected to follow our [Code of Conduct][coc]. +The [rustc-guide] is your friend! It describes how the compiler works and how +to contribute to it in more detail than this document. + +If this is your first time contributing, the [walkthrough] chapter of the guide +can give you a good example of how a typical contribution would go. + [pound-rust-internals]: https://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals [internals]: https://internals.rust-lang.org [coc]: https://www.rust-lang.org/conduct.html +[walkthrough]: https://rust-lang.github.io/rustc-guide/walkthrough.html ## Feature Requests [feature-requests]: #feature-requests @@ -39,7 +46,7 @@ don't know about, so please report liberally. If you're not sure if something is a bug or not, feel free to file a bug anyway. **If you believe reporting your bug publicly represents a security risk to Rust users, -please follow our [instructions for reporting security vulnerabilities](https://www.rust-lang.org/security.html)**. +please follow our [instructions for reporting security vulnerabilities](https://www.rust-lang.org/policies/security)**. If you have the chance, before reporting a bug, please [search existing issues](https://github.com/rust-lang/rust/search?q=&type=Issues&utf8=%E2%9C%93), @@ -89,222 +96,14 @@ $ RUST_BACKTRACE=1 rustc ... ``` ## The Build System -[the-build-system]: #the-build-system - -Rust's build system allows you to bootstrap the compiler, run tests & -benchmarks, generate documentation, install a fresh build of Rust, and more. -It's your best friend when working on Rust, allowing you to compile & test -your contributions before submission. - -The build system lives in [the `src/bootstrap` directory][bootstrap] in the -project root. Our build system is itself written in Rust and is based on Cargo -to actually build all the compiler's crates. If you have questions on the build -system internals, try asking in [`#rust-internals`][pound-rust-internals]. - -[bootstrap]: https://github.com/rust-lang/rust/tree/master/src/bootstrap/ - -### Configuration -[configuration]: #configuration - -Before you can start building the compiler you need to configure the build for -your system. In most cases, that will just mean using the defaults provided -for Rust. - -To change configuration, you must copy the file `config.toml.example` -to `config.toml` in the directory from which you will be running the build, and -change the settings provided. - -There are large number of options provided in this config file that will alter the -configuration used in the build process. Some options to note: - -#### `[llvm]`: -- `assertions = true` = This enables LLVM assertions, which makes LLVM misuse cause an assertion failure instead of weird misbehavior. This also slows down the compiler's runtime by ~20%. -- `ccache = true` - Use ccache when building llvm - -#### `[build]`: -- `compiler-docs = true` - Build compiler documentation - -#### `[rust]`: -- `debuginfo = true` - Build a compiler with debuginfo. Makes building rustc slower, but then you can use a debugger to debug `rustc`. -- `debuginfo-lines = true` - An alternative to `debuginfo = true` that doesn't let you use a debugger, but doesn't make building rustc slower and still gives you line numbers in backtraces. -- `debuginfo-tools = true` - Build the extended tools with debuginfo. -- `debug-assertions = true` - Makes the log output of `debug!` work. -- `optimize = false` - Disable optimizations to speed up compilation of stage1 rust, but makes the stage1 compiler x100 slower. - -For more options, the `config.toml` file contains commented out defaults, with -descriptions of what each option will do. - -Note: Previously the `./configure` script was used to configure this -project. It can still be used, but it's recommended to use a `config.toml` -file. If you still have a `config.mk` file in your directory - from -`./configure` - you may need to delete it for `config.toml` to work. - -### Building -[building]: #building - -A default configuration requires around 3.5 GB of disk space, whereas building a debug configuration may require more than 30 GB. - -Dependencies -- [build dependencies](README.md#building-from-source) -- `gdb` 6.2.0 minimum, 7.1 or later recommended for test builds - -The build system uses the `x.py` script to control the build process. This script -is used to build, test, and document various parts of the compiler. You can -execute it as: - -```sh -python x.py build -``` - -On some systems you can also use the shorter version: - -```sh -./x.py build -``` - -To learn more about the driver and top-level targets, you can execute: - -```sh -python x.py --help -``` - -The general format for the driver script is: - -```sh -python x.py [] -``` - -Some example commands are `build`, `test`, and `doc`. These will build, test, -and document the specified directory. The second argument, ``, is -optional and defaults to working over the entire compiler. If specified, -however, only that specific directory will be built. For example: - -```sh -# build the entire compiler -python x.py build - -# build all documentation -python x.py doc - -# run all test suites -python x.py test - -# build only the standard library -python x.py build src/libstd -# test only one particular test suite -python x.py test src/test/rustdoc +For info on how to configure and build the compiler, please see [this +chapter][rustcguidebuild] of the rustc-guide. This chapter contains info for +contributions to the compiler and the standard library. It also lists some +really useful commands to the build system (`./x.py`), which could save you a +lot of time. -# build only the stage0 libcore library -python x.py build src/libcore --stage 0 -``` - -You can explore the build system through the various `--help` pages for each -subcommand. For example to learn more about a command you can run: - -``` -python x.py build --help -``` - -To learn about all possible rules you can execute, run: - -``` -python x.py build --help --verbose -``` - -Note: Previously `./configure` and `make` were used to build this project. -They are still available, but `x.py` is the recommended build system. - -### Useful commands -[useful-commands]: #useful-commands - -Some common invocations of `x.py` are: - -- `x.py build --help` - show the help message and explain the subcommand -- `x.py build src/libtest --stage 1` - build up to (and including) the first - stage. For most cases we don't need to build the stage2 compiler, so we can - save time by not building it. The stage1 compiler is a fully functioning - compiler and (probably) will be enough to determine if your change works as - expected. -- `x.py build src/rustc --stage 1` - This will build just rustc, without libstd. - This is the fastest way to recompile after you changed only rustc source code. - Note however that the resulting rustc binary won't have a stdlib to link - against by default. You can build libstd once with `x.py build src/libstd`, - but it is only guaranteed to work if recompiled, so if there are any issues - recompile it. -- `x.py test` - build the full compiler & run all tests (takes a while). This - is what gets run by the continuous integration system against your pull - request. You should run this before submitting to make sure your tests pass - & everything builds in the correct manner. -- `x.py test src/libstd --stage 1` - test the standard library without - recompiling stage 2. -- `x.py test src/test/run-pass --test-args TESTNAME` - Run a matching set of - tests. - - `TESTNAME` should be a substring of the tests to match against e.g. it could - be the fully qualified test name, or just a part of it. - `TESTNAME=collections::hash::map::test_map::test_capacity_not_less_than_len` - or `TESTNAME=test_capacity_not_less_than_len`. -- `x.py test src/test/run-pass --stage 1 --test-args ` - - Run a single rpass test with the stage1 compiler (this will be quicker than - running the command above as we only build the stage1 compiler, not the entire - thing). You can also leave off the directory argument to run all stage1 test - types. -- `x.py test src/libcore --stage 1` - Run stage1 tests in `libcore`. -- `x.py test src/tools/tidy` - Check that the source code is in compliance with - Rust's style guidelines. There is no official document describing Rust's full - guidelines as of yet, but basic rules like 4 spaces for indentation and no - more than 99 characters in a single line should be kept in mind when writing - code. - -### Using your local build -[using-local-build]: #using-local-build - -If you use Rustup to manage your rust install, it has a feature called ["custom -toolchains"][toolchain-link] that you can use to access your newly-built compiler -without having to install it to your system or user PATH. If you've run `python -x.py build`, then you can add your custom rustc to a new toolchain like this: - -[toolchain-link]: https://github.com/rust-lang-nursery/rustup.rs#working-with-custom-toolchains-and-local-builds - -``` -rustup toolchain link build//stage2 -``` - -Where `` is the build triple for the host (the triple of your -computer, by default), and `` is the name for your custom toolchain. (If you -added `--stage 1` to your build command, the compiler will be in the `stage1` -folder instead.) You'll only need to do this once - it will automatically point -to the latest build you've done. - -Once this is set up, you can use your custom toolchain just like any other. For -example, if you've named your toolchain `local`, running `cargo +local build` will -compile a project with your custom rustc, setting `rustup override set local` will -override the toolchain for your current directory, and `cargo +local doc` will use -your custom rustc and rustdoc to generate docs. (If you do this with a `--stage 1` -build, you'll need to build rustdoc specially, since it's not normally built in -stage 1. `python x.py build --stage 1 src/libstd src/tools/rustdoc` will build -rustdoc and libstd, which will allow rustdoc to be run with that toolchain.) - -### Out-of-tree builds -[out-of-tree-builds]: #out-of-tree-builds - -Rust's `x.py` script fully supports out-of-tree builds - it looks for -the Rust source code from the directory `x.py` was found in, but it -reads the `config.toml` configuration file from the directory it's -run in, and places all build artifacts within a subdirectory named `build`. - -This means that if you want to do an out-of-tree build, you can just do it: -``` -$ cd my/build/dir -$ cp ~/my-config.toml config.toml # Or fill in config.toml otherwise -$ path/to/rust/x.py build -... -$ # This will use the Rust source code in `path/to/rust`, but build -$ # artifacts will now be in ./build -``` - -It's absolutely fine to have multiple build directories with different -`config.toml` configurations using the same code. +[rustcguidebuild]: https://rust-lang.github.io/rustc-guide/how-to-build-and-run.html ## Pull Requests [pull-requests]: #pull-requests @@ -320,26 +119,13 @@ bring those changes into the source repository. Please make pull requests against the `master` branch. -Compiling all of `./x.py test` can take a while. When testing your pull request, -consider using one of the more specialized `./x.py` targets to cut down on the -amount of time you have to wait. You need to have built the compiler at least -once before running these will work, but that’s only one full build rather than -one each time. - - $ python x.py test --stage 1 - -is one such example, which builds just `rustc`, and then runs the tests. If -you’re adding something to the standard library, try - - $ python x.py test src/libstd --stage 1 - Please make sure your pull request is in compliance with Rust's style guidelines by running $ python x.py test src/tools/tidy Make this check before every pull request (and every new commit in a pull -request) ; you can add [git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) +request); you can add [git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) before every push to make sure you never forget to make this check. All pull requests are reviewed by another person. We have a bot, @@ -494,16 +280,11 @@ the version in `Cargo.lock`, so the build can no longer continue. To resolve this, we need to update `Cargo.lock`. Luckily, cargo provides a command to do this easily. -First, go into the `src/` directory since that is where `Cargo.toml` is in -the rust repository. Then run, `cargo update -p rustfmt-nightly` to solve -the problem. - ``` -$ cd src $ cargo update -p rustfmt-nightly ``` -This should change the version listed in `src/Cargo.lock` to the new version you updated +This should change the version listed in `Cargo.lock` to the new version you updated the submodule to. Running `./x.py build` should work now. ## Writing Documentation @@ -537,6 +318,12 @@ to check small fixes. For example, `rustdoc src/doc/reference.md` will render reference to `doc/reference.html`. The CSS might be messed up, but you can verify that the HTML is right. +Additionally, contributions to the [rustc-guide] are always welcome. Contributions +can be made directly at [the +rust-lang/rustc-guide](https://github.com/rust-lang/rustc-guide) repo. The issue +tracker in that repo is also a great way to find things that need doing. There +are issues for beginners and advanced compiler devs alike! + ## Issue Triage [issue-triage]: #issue-triage @@ -632,7 +419,7 @@ For people new to Rust, and just starting to contribute, or even for more seasoned developers, some useful places to look for information are: -* The [rustc guide] contains information about how various parts of the compiler work +* The [rustc guide] contains information about how various parts of the compiler work and how to contribute to the compiler * [Rust Forge][rustforge] contains additional documentation, including write-ups of how to achieve common tasks * The [Rust Internals forum][rif], a place to ask questions and discuss Rust's internals @@ -645,7 +432,7 @@ are: * **Google!** ([search only in Rust Documentation][gsearchdocs] to find types, traits, etc. quickly) * Don't be afraid to ask! The Rust community is friendly and helpful. -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/about-this-guide.html +[rustc guide]: https://rust-lang.github.io/rustc-guide/about-this-guide.html [gdfrustc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ [gsearchdocs]: https://www.google.com/search?q=site:doc.rust-lang.org+your+query+here [rif]: http://internals.rust-lang.org @@ -653,5 +440,5 @@ are: [rustforge]: https://forge.rust-lang.org/ [tlgba]: http://tomlee.co/2014/04/a-more-detailed-tour-of-the-rust-compiler/ [ro]: http://www.rustaceans.org/ -[rctd]: https://rust-lang-nursery.github.io/rustc-guide/tests/intro.html +[rctd]: https://rust-lang.github.io/rustc-guide/tests/intro.html [cheatsheet]: https://buildbot2.rust-lang.org/homu/ diff --git a/COPYRIGHT b/COPYRIGHT index e2d0ed77224..dc9abf84b8e 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -23,7 +23,7 @@ The Rust Project includes packages written by third parties. The following third party packages are included, and carry their own copyright notices and license terms: -* LLVM. Code for this package is found in src/llvm. +* LLVM. Code for this package is found in src/llvm-project. Copyright (c) 2003-2013 University of Illinois at Urbana-Champaign. All rights reserved. @@ -73,8 +73,8 @@ their own copyright notices and license terms: OTHER DEALINGS WITH THE SOFTWARE. * Additional libraries included in LLVM carry separate - BSD-compatible licenses. See src/llvm/LICENSE.txt for - details. + BSD-compatible licenses. See src/llvm-project/llvm/LICENSE.TXT + for details. * compiler-rt, in src/compiler-rt is dual licensed under LLVM's license and MIT: @@ -229,35 +229,3 @@ their own copyright notices and license terms: NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -* jemalloc, under src/jemalloc: - - Copyright (C) 2002-2014 Jason Evans - . All rights reserved. - Copyright (C) 2007-2012 Mozilla Foundation. - All rights reserved. - Copyright (C) 2009-2014 Facebook, Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice(s), - this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright notice(s), - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - OF SUCH DAMAGE. diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000000..804a093ba73 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,4275 @@ +[[package]] +name = "adler32" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "aho-corasick" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "alloc" +version = "0.0.0" +dependencies = [ + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ammonia" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "html5ever 0.22.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arc-swap" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "arena" +version = "0.0.0" +dependencies = [ + "rustc_data_structures 0.0.0", +] + +[[package]] +name = "arrayref" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "arrayvec" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "assert_cli" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atty" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace-sys 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-std-workspace-core 1.0.0", +] + +[[package]] +name = "bit-set" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bit-vec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "block-buffer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bootstrap" +version = "0.0.0" +dependencies = [ + "build_helper 0.1.0", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bufstream" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "build-manifest" +version = "0.1.0" +dependencies = [ + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "build_const" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "build_helper" +version = "0.1.0" + +[[package]] +name = "byte-tools" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bytecount" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "packed_simd 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "byteorder" +version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bytes" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bytesize" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cargo" +version = "0.35.0" +dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crates-io 0.23.0", + "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fwdansi 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "git2-curl 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ignore 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "im-rc 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jobserver 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "opener 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", + "pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-workspace-hack 1.0.0", + "rustfix 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "shell-escape 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cargo_metadata" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cargo_metadata" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cargotest2" +version = "0.1.0" + +[[package]] +name = "cc" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "chalk-engine" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "chalk-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "chrono" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clap" +version = "2.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clippy" +version = "0.0.212" +dependencies = [ + "cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy-mini-macro-test 0.2.0", + "clippy_dev 0.0.1", + "clippy_lints 0.0.212", + "compiletest_rs 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-workspace-hack 1.0.0", + "rustc_tools_util 0.1.1", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clippy-mini-macro-test" +version = "0.2.0" + +[[package]] +name = "clippy_dev" +version = "0.0.1" +dependencies = [ + "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clippy_lints" +version = "0.0.212" +dependencies = [ + "cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cmake" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "colored" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "commoncrypto" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "commoncrypto-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "compiler_builtins" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-std-workspace-core 1.0.0", +] + +[[package]] +name = "compiletest" +version = "0.0.0" +dependencies = [ + "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustfix 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "compiletest_rs" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustfix 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core" +version = "0.0.0" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "crates-io" +version = "0.23.0" +dependencies = [ + "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crc" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crc32fast" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-channel" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-channel" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-deque" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-deque" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-utils" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-utils" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "crossbeam-utils" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crypto-hash" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "curl" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "curl-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libnghttp2-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "datafrog" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "derive-new" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "derive_more" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "diff" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "difference" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "digest" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "directories" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dlmalloc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-std-workspace-core 1.0.0", +] + +[[package]] +name = "either" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "elasticlunr-rs" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "strum 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "strum_macros 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ena" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "env_logger" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "env_logger" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "environment" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "error-chain" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "error-chain" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "error_index_generator" +version = "0.0.0" +dependencies = [ + "rustdoc 0.0.0", +] + +[[package]] +name = "failure" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "filetime" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fixedbitset" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "flate2" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fmt_macros" +version = "0.0.0" + +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fortanix-sgx-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-std-workspace-core 1.0.0", +] + +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fs_extra" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fst" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fwdansi" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "generic-array" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "getopts" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "git2" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "git2-curl" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", + "git2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glob" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "globset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "graphviz" +version = "0.0.0" + +[[package]] +name = "handlebars" +version = "0.32.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pest_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "handlebars" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "heck" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "hex" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "home" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "html5ever" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "markup5ever 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "humantime" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "if_chain" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ignore" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "im-rc" +version = "12.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "installer" +version = "0.0.0" +dependencies = [ + "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "xz2 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "iovec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "is-match" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "itertools" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itertools" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itoa" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "jemalloc-sys" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "jobserver" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "json" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "jsonrpc-core" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lazy_static" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazycell" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-std-workspace-core 1.0.0", +] + +[[package]] +name = "libgit2-sys" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libssh2-sys 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libnghttp2-sys" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libssh2-sys" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libz-sys" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "linkchecker" +version = "0.1.0" + +[[package]] +name = "lock_api" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log_settings" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lsp-codec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lsp-types" +version = "0.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lzma-sys" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "macro-utils" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "maplit" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "markup5ever" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_codegen 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "mdbook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ammonia 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "elasticlunr-rs 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "handlebars 0.32.4 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "toml-query 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mdbook" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ammonia 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "elasticlunr-rs 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "handlebars 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "toml-query 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memmap" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memoffset" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "minifier" +version = "0.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "macro-utils 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz-sys" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide_c_api" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio" +version = "0.6.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio-named-pipes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio-uds" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miri" +version = "0.1.0" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "compiletest_rs 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-workspace-hack 1.0.0", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "net2" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nodrop" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "num-derive" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-integer" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "num_cpus" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "open" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "opener" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "openssl" +version = "0.10.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "openssl-probe" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "openssl-src" +version = "111.1.0+1.1.1a" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "openssl-sys" +version = "0.9.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-src 111.1.0+1.1.1a (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ordermap" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ordslice" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "owning_ref" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "packed_simd" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "panic_abort" +version = "0.0.0" +dependencies = [ + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "panic_unwind" +version = "0.0.0" +dependencies = [ + "alloc 0.0.0", + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "unwind 0.0.0", +] + +[[package]] +name = "parking_lot" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pest" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pest" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-trie 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pest_derive" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pest_derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pest_generator 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pest_generator" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pest_meta 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pest_meta" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha-1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "petgraph" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf" +version = "0.7.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_codegen" +version = "0.7.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_generator" +version = "0.7.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_shared" +version = "0.7.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pkg-config" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "polonius-engine" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "datafrog 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pretty_assertions" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pretty_env_logger" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proc-macro2" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proc-macro2" +version = "0.4.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proc_macro" +version = "0.0.0" + +[[package]] +name = "profiler_builtins" +version = "0.0.0" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", +] + +[[package]] +name = "proptest" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rusty-fork 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pulldown-cmark" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pulldown-cmark" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quine-mc_cluskey" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quote" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quote" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "racer" +version = "2.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_pcg" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rayon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rayon-core" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_termios" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "remote-test-client" +version = "0.1.0" + +[[package]] +name = "remote-test-server" +version = "0.1.0" + +[[package]] +name = "remove_dir_all" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rls" +version = "1.31.6" +dependencies = [ + "cargo 0.35.0", + "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clippy_lints 0.0.212", + "crossbeam-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "jsonrpc-core 9.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lsp-codec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lsp-types 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "racer 2.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-analysis 0.16.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-vfs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-workspace-hack 1.0.0", + "rustc_tools_util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustfmt-nightly 1.0.1", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-process 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rls-analysis" +version = "0.16.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "fst 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "json 0.11.13 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rls-blacklist" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rls-data" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rls-rustc" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rls-span" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rls-vfs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustbook" +version = "0.1.0" +dependencies = [ + "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "mdbook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "mdbook 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc" +version = "0.0.0" +dependencies = [ + "arena 0.0.0", + "backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "chalk-engine 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "fmt_macros 0.0.0", + "graphviz 0.0.0", + "jobserver 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "polonius-engine 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_apfloat 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_fs_util 0.0.0", + "rustc_target 0.0.0", + "rustc_yk_link 0.0.0", + "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serialize 0.0.0", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syntax 0.0.0", + "syntax_pos 0.0.0", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-arena" +version = "306.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc-ap-rustc_data_structures 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-graphviz" +version = "306.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc-ap-rustc_cratesio_shim" +version = "306.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-rustc_data_structures" +version = "306.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-graphviz 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_cratesio_shim 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-rustc_errors" +version = "306.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_cratesio_shim 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-rustc_target" +version = "306.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_cratesio_shim 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-serialize" +version = "306.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-syntax" +version = "306.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_errors 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_target 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-ap-syntax_pos" +version = "306.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-arena 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-std-workspace-core 1.0.0", +] + +[[package]] +name = "rustc-hash" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-main" +version = "0.0.0" +dependencies = [ + "jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_codegen_ssa 0.0.0", + "rustc_driver 0.0.0", + "rustc_target 0.0.0", +] + +[[package]] +name = "rustc-rayon" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-rayon-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-serialize" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc-std-workspace-core" +version = "1.0.0" +dependencies = [ + "core 0.0.0", +] + +[[package]] +name = "rustc-workspace-hack" +version = "1.0.0" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc_allocator" +version = "0.0.0" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_target 0.0.0", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_apfloat" +version = "0.0.0" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_cratesio_shim 0.0.0", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc_asan" +version = "0.0.0" +dependencies = [ + "alloc 0.0.0", + "build_helper 0.1.0", + "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", +] + +[[package]] +name = "rustc_borrowck" +version = "0.0.0" +dependencies = [ + "graphviz 0.0.0", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_mir 0.0.0", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_codegen_llvm" +version = "0.0.0" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_llvm 0.0.0", + "rustc_yk_sections 0.0.0", +] + +[[package]] +name = "rustc_codegen_ssa" +version = "0.0.0" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "jobserver 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_allocator 0.0.0", + "rustc_apfloat 0.0.0", + "rustc_codegen_utils 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_fs_util 0.0.0", + "rustc_incremental 0.0.0", + "rustc_mir 0.0.0", + "rustc_target 0.0.0", + "serialize 0.0.0", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_codegen_utils" +version = "0.0.0" +dependencies = [ + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_incremental 0.0.0", + "rustc_metadata 0.0.0", + "rustc_mir 0.0.0", + "rustc_target 0.0.0", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_cratesio_shim" +version = "0.0.0" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc_data_structures" +version = "0.0.0" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "graphviz 0.0.0", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_cratesio_shim 0.0.0", + "serialize 0.0.0", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc_driver" +version = "0.0.0" +dependencies = [ + "arena 0.0.0", + "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "graphviz 0.0.0", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_allocator 0.0.0", + "rustc_borrowck 0.0.0", + "rustc_codegen_utils 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_incremental 0.0.0", + "rustc_lint 0.0.0", + "rustc_metadata 0.0.0", + "rustc_mir 0.0.0", + "rustc_passes 0.0.0", + "rustc_plugin 0.0.0", + "rustc_privacy 0.0.0", + "rustc_resolve 0.0.0", + "rustc_save_analysis 0.0.0", + "rustc_target 0.0.0", + "rustc_traits 0.0.0", + "rustc_typeck 0.0.0", + "rustc_yk_link 0.0.0", + "rustc_yk_sections 0.0.0", + "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serialize 0.0.0", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syntax 0.0.0", + "syntax_ext 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_errors" +version = "0.0.0" +dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_cratesio_shim 0.0.0", + "rustc_data_structures 0.0.0", + "serialize 0.0.0", + "syntax_pos 0.0.0", + "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc_fs_util" +version = "0.0.0" + +[[package]] +name = "rustc_incremental" +version = "0.0.0" +dependencies = [ + "graphviz 0.0.0", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_fs_util 0.0.0", + "serialize 0.0.0", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_lint" +version = "0.0.0" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_target 0.0.0", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_llvm" +version = "0.0.0" +dependencies = [ + "build_helper 0.1.0", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc_lsan" +version = "0.0.0" +dependencies = [ + "alloc 0.0.0", + "build_helper 0.1.0", + "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", +] + +[[package]] +name = "rustc_metadata" +version = "0.0.0" +dependencies = [ + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_target 0.0.0", + "serialize 0.0.0", + "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syntax 0.0.0", + "syntax_ext 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_mir" +version = "0.0.0" +dependencies = [ + "arena 0.0.0", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "graphviz 0.0.0", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log_settings 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "polonius-engine 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_apfloat 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_target 0.0.0", + "serialize 0.0.0", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_msan" +version = "0.0.0" +dependencies = [ + "alloc 0.0.0", + "build_helper 0.1.0", + "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", +] + +[[package]] +name = "rustc_passes" +version = "0.0.0" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_mir 0.0.0", + "syntax 0.0.0", + "syntax_ext 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_plugin" +version = "0.0.0" +dependencies = [ + "rustc 0.0.0", + "rustc_errors 0.0.0", + "rustc_metadata 0.0.0", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_privacy" +version = "0.0.0" +dependencies = [ + "rustc 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_typeck 0.0.0", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_resolve" +version = "0.0.0" +dependencies = [ + "arena 0.0.0", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_metadata 0.0.0", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_save_analysis" +version = "0.0.0" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_codegen_utils 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_target 0.0.0", + "rustc_typeck 0.0.0", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_target" +version = "0.0.0" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_cratesio_shim 0.0.0", + "rustc_data_structures 0.0.0", + "serialize 0.0.0", +] + +[[package]] +name = "rustc_tools_util" +version = "0.1.1" + +[[package]] +name = "rustc_tools_util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc_traits" +version = "0.0.0" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "chalk-engine 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "graphviz 0.0.0", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_target 0.0.0", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_tsan" +version = "0.0.0" +dependencies = [ + "alloc 0.0.0", + "build_helper 0.1.0", + "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", +] + +[[package]] +name = "rustc_typeck" +version = "0.0.0" +dependencies = [ + "arena 0.0.0", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_target 0.0.0", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc_yk_link" +version = "0.0.0" + +[[package]] +name = "rustc_yk_sections" +version = "0.0.0" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc_codegen_utils 0.0.0", + "rustc_yk_link 0.0.0", +] + +[[package]] +name = "rustdoc" +version = "0.0.0" +dependencies = [ + "minifier 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustdoc-themes" +version = "0.1.0" + +[[package]] +name = "rustdoc-tool" +version = "0.0.0" +dependencies = [ + "rustdoc 0.0.0", +] + +[[package]] +name = "rustfix" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustfmt-nightly" +version = "1.0.1" +dependencies = [ + "assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_target 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-workspace-hack 1.0.0", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rusty-fork" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "wait-timeout 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ryu" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "same-file" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "schannel" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "scoped-tls" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "scopeguard" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_derive" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_ignored" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serialize" +version = "0.0.0" +dependencies = [ + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sha-1" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "shell-escape" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "shlex" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "signal-hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "siphasher" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "smallvec" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "socket2" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stable_deref_trait" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "std" +version = "0.0.0" +dependencies = [ + "alloc 0.0.0", + "backtrace-sys 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", + "dlmalloc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "panic_abort 0.0.0", + "panic_unwind 0.0.0", + "profiler_builtins 0.0.0", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_asan 0.0.0", + "rustc_lsan 0.0.0", + "rustc_msan 0.0.0", + "rustc_tsan 0.0.0", + "unwind 0.0.0", +] + +[[package]] +name = "string_cache" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", + "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "string_cache_codegen" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "string_cache_shared" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strsim" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strum" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strum_macros" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syn" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syn" +version = "0.15.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synom" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "synstructure" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syntax" +version = "0.0.0" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_target 0.0.0", + "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serialize 0.0.0", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syntax_pos 0.0.0", +] + +[[package]] +name = "syntax_ext" +version = "0.0.0" +dependencies = [ + "fmt_macros 0.0.0", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_target 0.0.0", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syntax 0.0.0", + "syntax_pos 0.0.0", +] + +[[package]] +name = "syntax_pos" +version = "0.0.0" +dependencies = [ + "arena 0.0.0", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_data_structures 0.0.0", + "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serialize 0.0.0", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tar" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tempfile" +version = "3.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tendril" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futf 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "utf-8 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "term" +version = "0.0.0" + +[[package]] +name = "term" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termcolor" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termion" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "test" +version = "0.0.0" +dependencies = [ + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "proc_macro 0.0.0", + "term 0.0.0", +] + +[[package]] +name = "textwrap" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread_local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tidy" +version = "0.1.0" +dependencies = [ + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-fs 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-codec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-executor" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-fs" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-io" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-process" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-signal 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-reactor" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-signal" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-tcp" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-threadpool" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-timer" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-udp" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-uds" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "toml" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "toml-query" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "toml-query" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "typenum" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ucd-trie" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ucd-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-segmentation" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-width" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unstable-book-gen" +version = "0.1.0" +dependencies = [ + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tidy 0.1.0", +] + +[[package]] +name = "unwind" +version = "0.0.0" +dependencies = [ + "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core 0.0.0", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "url_serde" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "utf-8" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "utf8-ranges" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "vcpkg" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "vec_map" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "vergen" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wait-timeout" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "walkdir" +version = "2.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wincolor" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "xattr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "xz2" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lzma-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "yaml-rust" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" +"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" +"checksum ammonia 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd4c682378117e4186a492b2252b9537990e1617f44aed9788b9a1149de45477" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1025aeae2b664ca0ea726a89d574fe8f4e77dd712d443236ad1de00379450cf6" +"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" +"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" +"checksum assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98589b0e465a6c510d95fceebd365bb79bedece7f6e18a480897f2015f85ec51" +"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" +"checksum backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "18b65ea1161bfb2dd6da6fade5edd4dbd08fba85012123dd333d2fd1b90b2782" +"checksum backtrace-sys 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)" = "6ea90dd7b012b3d1a2cb6bec16670a0db2c95d4e931e84f4047e0460c1b34c8d" +"checksum bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f1efcc46c18245a69c38fcc5cc650f16d3a59d034f3106e9ed63748f695730a" +"checksum bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4440d5cb623bb7390ae27fec0bb6c61111969860f8e3ae198bfa0663645e67cf" +"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" +"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" +"checksum bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8" +"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" +"checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" +"checksum bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b92204551573580e078dc80017f36a213eb77a0450e4ddd8cfa0f3f2d1f0178f" +"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" +"checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" +"checksum bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010" +"checksum cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d8dfe3adeb30f7938e6c1dd5327f29235d8ada3e898aeb08c343005ec2915a2" +"checksum cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "585784cac9b05c93a53b17a0b24a5cdd1dfdda5256f030e089b549d2390cc720" +"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" +"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" +"checksum chalk-engine 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17ec698a6f053a23bfbe646d9f2fde4b02abc19125595270a99e6f44ae0bdd1a" +"checksum chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "295635afd6853aa9f20baeb7f0204862440c0fe994c5a253d5f479dac41d047e" +"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" +"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "704fbf3bb5149daab0afb255dbea24a1f08d2f4099cedb9baab6d470d4c5eefb" +"checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc" +"checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007" +"checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2" +"checksum compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6711d51cb46744dd8305293cc3fbc392aaff7a8f5095a7c4fae1e5113ef07c96" +"checksum compiletest_rs 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0d76d4322a40f6b0db7259d4f2c8a65ed8b0d84fce0bbc61b98cf47f8ec6eec3" +"checksum core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887" +"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" +"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" +"checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192" +"checksum crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b85741761b7f160bc5e7e0c14986ef685b7f8bf9b7ad081c60c604bb4649827" +"checksum crossbeam-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5b2a9ea8f77c7f9efd317a8a5645f515d903a2d86ee14d2337a5facd1bd52c12" +"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" +"checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" +"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" +"checksum crossbeam-epoch 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c90f1474584f38e270b5b613e898c8c328aa4f3dea85e0a27ac2e642f009416" +"checksum crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f10a4f8f409aaac4b16a5474fb233624238fcdeefb9ba50d5ea059aab63ba31c" +"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" +"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" +"checksum crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e07fc155212827475223f0bcfae57e945e694fc90950ddf3f6695bbfd5555c72" +"checksum crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "09de9ee0fc255ace04c7fa0763c9395a945c37c8292bb554f8d48361d1dcf1b4" +"checksum curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "c7c9d851c825e0c033979d4516c9173bc19a78a96eb4d6ae51d4045440eafa16" +"checksum curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "721c204978be2143fab0a84b708c49d79d1f6100b8785610f456043a90708870" +"checksum datafrog 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69" +"checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c" +"checksum derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f57d78cf3bd45270dad4e70c21ec77a960b36c7a841ff9db76aaa775a8fb871" +"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" +"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" +"checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" +"checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f" +"checksum dlmalloc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d56ad71b31043818d0ee10a7fb9664882f8e45849c81647585e6a3124f185517" +"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" +"checksum elasticlunr-rs 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a99a310cd1f9770e7bf8e48810c7bcbb0e078c8fb23a8c7bcf0da4c2bf61a455" +"checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" +"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" +"checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e" +"checksum environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4b14e20978669064c33b4c1e0fb4083412e40fe56cbea2eae80fd7591503ee" +"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" +"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" +"checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" +"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" +"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum filetime 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a2df5c1a8c4be27e7707789dc42ae65976e60b394afd293d1419ab915833e646" +"checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" +"checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +"checksum fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3f8cbee5e872cf7db61a999a041f9bc4706ca7bf7df4cb914f53fabb1c1bc550" +"checksum fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" +"checksum fst 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d94485a00b1827b861dd9d1a2cc9764f9044d4c535514c0760a5a2012ef3399f" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum futf 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b" +"checksum futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "1a70b146671de62ec8c8ed572219ca5d594d9b06c0b364d5e67b722fc559b48c" +"checksum fwdansi 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "34dd4c507af68d37ffef962063dfa1944ce0dd4d5b82043dbab1dabe088610c3" +"checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" +"checksum getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05" +"checksum git2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7339329bfa14a00223244311560d11f8f489b453fb90092af97f267a6090ab0" +"checksum git2-curl 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d58551e903ed7e2d6fe3a2f3c7efa3a784ec29b19d0fbb035aaf0497c183fbdd" +"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" +"checksum globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4743617a7464bbda3c8aec8558ff2f9429047e025771037df561d383337ff865" +"checksum handlebars 0.32.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d89ec99d1594f285d4590fc32bac5f75cdab383f1123d504d27862c644a807dd" +"checksum handlebars 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d82e5750d8027a97b9640e3fefa66bbaf852a35228e1c90790efd13c4b09c166" +"checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82" +"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" +"checksum home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "80dff82fb58cfbbc617fb9a9184b010be0529201553cda50ad04372bc2333aff" +"checksum html5ever 0.22.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c213fa6a618dc1da552f54f85cba74b05d8e883c92ec4e89067736938084c26e" +"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" +"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +"checksum if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4bac95d9aa0624e7b78187d6fb8ab012b41d9f6f54b1bcb61e61c4845f8357ec" +"checksum ignore 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36ecfc5ad80f0b1226df948c562e2cddd446096be3f644c95106400eae8a5e01" +"checksum im-rc 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4591152fd573cf453a890b5f9fdc5c328a751a0785539316739d5f85e5c468c" +"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" +"checksum is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7e5b386aef33a1c677be65237cb9d32c3f3ef56bd035949710c4bb13083eb053" +"checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450" +"checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" +"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" +"checksum jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "bfc62c8e50e381768ce8ee0428ee53741929f7ebd73e4d83f669bcf7693e00ae" +"checksum jobserver 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "dd80e58f77e0cdea53ba96acc5e04479e5ffc5d869626a6beafe50fed867eace" +"checksum json 0.11.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad0485404155f45cce53a40d4b2d6ac356418300daed05273d9e26f91c390be" +"checksum jsonrpc-core 9.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4e9cbeda300803d381390fb65e8158437728c39e6987ed23bee82728b73511a7" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" +"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" +"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" +"checksum libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)" = "023a4cd09b2ff695f9734c1934145a315594b7986398496841c7031a5a1bbdbd" +"checksum libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "48441cb35dc255da8ae72825689a95368bf510659ae1ad55dc4aa88cb1789bf1" +"checksum libnghttp2-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d75d7966bda4730b722d1eab8e668df445368a24394bae9fc1e8dc0ab3dbe4f4" +"checksum libssh2-sys 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "126a1f4078368b163bfdee65fbab072af08a1b374a5551b21e87ade27b1fbf9d" +"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" +"checksum lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "949826a5ccf18c1b3a7c3d57692778d21768b79e46eb9dd07bfc4c2160036c54" +"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum log_settings 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19af41f0565d7c19b2058153ad0b42d4d5ce89ec4dbf06ed6741114a8b63e7cd" +"checksum lsp-codec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b29e3d1632fef13c1286b0b2f8545a7d894ae565a7fac013b90a17ee5bfbc91" +"checksum lsp-types 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a252cc2be87d9329dd91c505a951996b3263582ba304870960faaae77b642183" +"checksum lzma-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d1eaa027402541975218bb0eec67d6b0412f6233af96e0d096d31dbdfd22e614" +"checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" +"checksum macro-utils 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2c4deaccc2ead6a28c16c0ba82f07d52b6475397415ce40876e559b0b0ea510" +"checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43" +"checksum markup5ever 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfedc97d5a503e96816d10fedcd5b42f760b2e525ce2f7ec71f6a41780548475" +"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +"checksum mdbook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "90b5a8d7e341ceee5db3882a06078d42661ddcfa2b3687319cc5da76ec4e782f" +"checksum mdbook 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ba0d44cb4089c741b9a91f3e5218298a40699c2f3a070a85014eed290c60819" +"checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16" +"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff" +"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" +"checksum minifier 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f299df45afd73332044ea9f717c816a84fc90c8b631409abf339ba93642a7985" +"checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" +"checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" +"checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" +"checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" +"checksum mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" +"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" +"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +"checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" +"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" +"checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4" +"checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" +"checksum num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8af1847c907c2f04d7bfd572fb25bbb4385c637fe5be163cf2f8c5d778fe1e7d" +"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" +"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" +"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" +"checksum open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c281318d992e4432cfa799969467003d05921582a7489a8325e37f8a450d5113" +"checksum opener 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "04b1d6b086d9b3009550f9b6f81b10ad9428cf14f404b8e1a3a06f6f012c8ec9" +"checksum openssl 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ec7bd7ca4cce6dbdc77e7c1230682740d307d1218a87fb0349a571272be749f9" +"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +"checksum openssl-src 111.1.0+1.1.1a (registry+https://github.com/rust-lang/crates.io-index)" = "26bb632127731bf4ac49bf86a5dde12d2ca0918c2234fc39d79d4da2ccbc6da7" +"checksum openssl-sys 0.9.40 (registry+https://github.com/rust-lang/crates.io-index)" = "1bb974e77de925ef426b6bc82fce15fd45bdcbeb5728bffcfc7cdeeb7ce1c2d6" +"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" +"checksum ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd20eec3dbe4376829cb7d80ae6ac45e0a766831dca50202ff2d40db46a8a024" +"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +"checksum packed_simd 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25d36de864f7218ec5633572a800109bbe5a1cc8d9d95a967f3daf93ea7e6ddc" +"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" +"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" +"checksum parking_lot_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06a2b6aae052309c2fd2161ef58f5067bc17bb758377a0de9d4b279d603fdd8a" +"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" +"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +"checksum pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc" +"checksum pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "54f0c72a98d8ab3c99560bfd16df8059cc10e1f9a8e83e6e3b97718dd766e9c3" +"checksum pest_derive 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3294f437119209b084c797604295f40227cffa35c57220b1e99a6ff3bf8ee4" +"checksum pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +"checksum pest_generator 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63120576c4efd69615b5537d3d052257328a4ca82876771d6944424ccfd9f646" +"checksum pest_meta 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5a3492a4ed208ffc247adcdcc7ba2a95be3104f58877d0d02f0df39bf3efb5e" +"checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" +"checksum phf 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "7d37a244c75a9748e049225155f56dbcb98fe71b192fd25fd23cb914b5ad62f2" +"checksum phf_codegen 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "4e4048fe7dd7a06b8127ecd6d3803149126e9b33c7558879846da3a63f734f2b" +"checksum phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "05a079dd052e7b674d21cb31cbb6c05efd56a2cd2827db7692e2f1a507ebd998" +"checksum phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "c2261d544c2bb6aa3b10022b0be371b9c7c64f762ef28c6f5d4f1ef6d97b5930" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum polonius-engine 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2490c396085801abf88df91758bad806b0890354f0875d624e62ecf0579a8145" +"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6" +"checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61" +"checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" +"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" +"checksum proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "926d0604475349f463fe44130aae73f2294b5309ab2ca0310b998bd334ef191f" +"checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32" +"checksum pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eef52fac62d0ea7b9b4dc7da092aa64ea7ec3d90af6679422d3d7e0e14b6ee15" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" +"checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45" +"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" +"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" +"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" +"checksum racer 2.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fbfcf2686b50f75a279cb42d9c6d253a1e68a475b415ea4baf7fb177ce94839a" +"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" +"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" +"checksum rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9d223d52ae411a33cf7e54ec6034ec165df296ccd23533d671a28252b6f66a" +"checksum rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "771b009e3a508cb67e8823dda454aaa5368c7bc1c16829fb77d3e980440dd34a" +"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" +"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" +"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" +"checksum rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effa3fcaa47e18db002bdde6060944b6d2f9cfd8db471c30e873448ad9187be3" +"checksum rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80e811e76f1dbf68abf87a759083d34600017fc4e10b6bd5ad84a700f9dba4b1" +"checksum rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d24ad214285a7729b174ed6d3bcfcb80177807f959d95fafd5bfc5c4f201ac8" +"checksum redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "679da7508e9a6390aeaf7fbd02a800fdc64b73fe2204dd2c8ae66d22d9d5ad5d" +"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" +"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" +"checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" +"checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" +"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" +"checksum rls-analysis 0.16.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2de1187cceaf16d7642cc78835a2890b55b35ed9e8a8e3c6348a6297d8dd0fb1" +"checksum rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ce1fdac03e138c4617ff87b194e1ff57a39bb985a044ccbd8673d30701e411" +"checksum rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a209ce46bb52813cbe0786a7baadc0c1a3f5543ef93f179eda3b841ed72cf2e" +"checksum rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9dba7390427aefa953608429701e3665192ca810ba8ae09301e001b7c7bed0" +"checksum rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d7c7046dc6a92f2ae02ed302746db4382e75131b9ce20ce967259f6b5867a6a" +"checksum rls-vfs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "72d56425bd5aa86d9d4372b76f0381d3b4bda9c0220e71956c9fcc929f45c1f1" +"checksum rustc-ap-arena 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbfb540c1347a3993060896b18e0d64084203fa37aaffdc5e5c31264f275d476" +"checksum rustc-ap-graphviz 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "790ac657d5bf69be9ef56f6810e8a0238b07e8460a88526e11d41f8214eb6c4e" +"checksum rustc-ap-rustc_cratesio_shim 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b721cf32b543f3ee90240d7b757ca4a45930fe9981458a50678b4ccd75c472e2" +"checksum rustc-ap-rustc_data_structures 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4fa11df199d45ce948b07792ca593f59c1d19d2cb05d35c6b0a02271e772a416" +"checksum rustc-ap-rustc_errors 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7ead3163ef995bbba520b88739e1d60f9ccf74fdacdda985067644c8134e827" +"checksum rustc-ap-rustc_target 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "688fef9cc27837755019b72b4f13e7a3d3e5012473475f377b75dbb1f07beb5f" +"checksum rustc-ap-serialize 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b2c0e8161e956647592a737074736e6ce05ea36b70c770ea8cca3eb9cb33737" +"checksum rustc-ap-syntax 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1adc189e5e4500a4167b9afa04e67067f40d0039e0e05870c977bebb561f065a" +"checksum rustc-ap-syntax_pos 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4d42c430dbb0be4377bfe6aa5099074c63ac8796b24098562c2e2154aecc5652" +"checksum rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "82ae957aa1b3055d8e086486723c0ccd3d7b8fa190ae8fa2e35543b6171c810e" +"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" +"checksum rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c6d5a683c6ba4ed37959097e88d71c9e8e26659a3cb5be8b389078e7ad45306" +"checksum rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40f06724db71e18d68b3b946fdf890ca8c921d9edccc1404fdfdb537b0d12649" +"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" +"checksum rustc_tools_util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c5a95edfa0c893236ae4778bb7c4752760e4c0d245e19b5eff33c5aa5eb9dc" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum rustfix 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "af7c21531a91512a4a51b490be6ba1c8eff34fdda0dc5bf87dc28d86748aac56" +"checksum rusty-fork 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9591f190d2852720b679c21f66ad929f9f1d7bb09d1193c26167586029d8489c" +"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" +"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" +"checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" +"checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" +"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)" = "6fa52f19aee12441d5ad11c9a00459122bd8f98707cadf9778c540674f1935b6" +"checksum serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)" = "477b13b646f5b5b56fc95bedfc3b550d12141ce84f466f6c44b9a17589923885" +"checksum serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "190e9765dcedb56be63b6e0993a006c7e3b071a016a304736e4a315dc01fb142" +"checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811" +"checksum sha-1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9d1f3b5de8a167ab06834a7c883bd197f2191e1dda1a22d9ccfeedbf9aded" +"checksum shell-escape 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "170a13e64f2a51b77a45702ba77287f5c6829375b04a69cf2222acd17d0cfab9" +"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" +"checksum signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1f272d1b7586bec132ed427f532dd418d8beca1ca7f2caf7df35569b1415a4b4" +"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537" +"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +"checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" +"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" +"checksum stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbc596e092fe5f598b12ef46cc03754085ac2f4d8c739ad61c4ae266cc3b3fa" +"checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" +"checksum string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "35293b05cf1494e8ddd042a7df6756bf18d07f42d234f32e71dce8a7aabb0191" +"checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" +"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" +"checksum strum 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f6c3a2071519ab6a48f465808c4c1ffdd00dfc8e93111d02b4fc5abab177676e" +"checksum strum_macros 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8baacebd7b7c9b864d83a6ba7a246232983e277b86fa5cdec77f565715a4b136" +"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" +"checksum syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)" = "ae8b29eb5210bc5cf63ed6149cbf9adfc82ac0be023d8735c176ee74a2db4da7" +"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" +"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" +"checksum tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "a303ba60a099fcd2aaa646b14d2724591a96a75283e4b7ed3d1a1658909d9ae2" +"checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2" +"checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508" +"checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" +"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" +"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" +"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +"checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" +"checksum tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4790d0be6f4ba6ae4f48190efa2ed7780c9e3567796abdb285003cf39840d9c5" +"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" +"checksum tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "331c8acc267855ec06eb0c94618dcbbfea45bed2d20b77252940095273fb58f6" +"checksum tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30c6dbf2d1ad1de300b393910e8a3aa272b724a400b6531da03eed99e329fbf0" +"checksum tokio-fs 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0e9cbbc8a3698b7ab652340f46633364f9eaa928ddaaee79d8b8f356dd79a09d" +"checksum tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b53aeb9d3f5ccf2ebb29e19788f96987fa1355f8fe45ea193928eaaaf3ae820f" +"checksum tokio-process 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "88e1281e412013f1ff5787def044a9577a0bed059f451e835f1643201f8b777d" +"checksum tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "afbcdb0f0d2a1e4c440af82d7bbf0bf91a8a8c0575bcd20c05d15be7e9d3a02f" +"checksum tokio-signal 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd6dc5276ea05ce379a16de90083ec80836440d5ef8a6a39545a3207373b8296" +"checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" +"checksum tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "17465013014410310f9f61fa10bf4724803c149ea1d51efece131c38efca93aa" +"checksum tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f37f0111d76cc5da132fe9bc0590b9b9cfd079bc7e75ac3846278430a299ff8" +"checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" +"checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" +"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" +"checksum toml-query 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6854664bfc6df0360c695480836ee90e2d0c965f06db291d10be9344792d43e8" +"checksum toml-query 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab234a943a2363ad774020e2f9474a38a85bc4396bace01a96380144aef17db3" +"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" +"checksum ucd-trie 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "71a9c5b1fe77426cf144cc30e49e955270f5086e31a6441dfa8b32efc09b9d77" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" +"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" +"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" +"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" +"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74e7d099f1ee52f823d4bdd60c93c3602043c728f5db3b97bdb548467f7bddea" +"checksum utf-8 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1262dfab4c30d5cb7c07026be00ee343a6cf5027fdc0104a9160f354e5db75c" +"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" +"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" +"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +"checksum vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6aba5e34f93dc7051dfad05b98a18e9156f27e7b431fe1d2398cb6061c0a1dba" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum wait-timeout 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b9f3bf741a801531993db6478b95682117471f76916f5e690dd8d45395b09349" +"checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" +"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" +"checksum xz2 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "df8bf41d3030c3577c9458fd6640a05afbf43b150d0b531b16bd77d3f794f27a" +"checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000000..cb3c0ee194f --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,72 @@ +[workspace] +members = [ + "src/bootstrap", + "src/rustc", + "src/libstd", + "src/libtest", + "src/librustc_codegen_llvm", + "src/tools/cargotest", + "src/tools/clippy", + "src/tools/compiletest", + "src/tools/error_index_generator", + "src/tools/linkchecker", + "src/tools/rustbook", + "src/tools/unstable-book-gen", + "src/tools/tidy", + "src/tools/build-manifest", + "src/tools/remote-test-client", + "src/tools/remote-test-server", + "src/tools/rust-installer", + "src/tools/cargo", + "src/tools/rustdoc", + "src/tools/rls", + "src/tools/rustfmt", + "src/tools/miri", + "src/tools/rustdoc-themes", +] +exclude = [ + "build", + # HACK(eddyb) This hardcodes the fact that our CI uses `/checkout/obj`. + "obj", +] + +# Curiously, LLVM 7.0 will segfault if compiled with opt-level=3 +# See issue https://github.com/rust-lang/rust/issues/52378 +[profile.release] +opt-level = 2 +[profile.bench] +opt-level = 2 + +# These options are controlled from our rustc wrapper script, so turn them off +# here and have them controlled elsewhere. +[profile.dev] +debug = false +debug-assertions = false +[profile.test] +debug = false +debug-assertions = false + +# We want the RLS to use the version of Cargo that we've got vendored in this +# repository to ensure that the same exact version of Cargo is used by both the +# RLS and the Cargo binary itself. The RLS depends on Cargo as a git repository +# so we use a `[patch]` here to override the github repository with our local +# vendored copy. +[patch."https://github.com/rust-lang/cargo"] +cargo = { path = "src/tools/cargo" } + +[patch.crates-io] +# Similar to Cargo above we want the RLS to use a vendored version of `rustfmt` +# that we're shipping as well (to ensure that the rustfmt in RLS and the +# `rustfmt` executable are the same exact version). +rustfmt-nightly = { path = "src/tools/rustfmt" } + +# See comments in `src/tools/rustc-workspace-hack/README.md` for what's going on +# here +rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' } + +# See comments in `tools/rustc-std-workspace-core/README.md` for what's going on +# here +rustc-std-workspace-core = { path = 'src/tools/rustc-std-workspace-core' } + +[patch."https://github.com/rust-lang/rust-clippy"] +clippy_lints = { path = "src/tools/clippy/clippy_lints" } diff --git a/README.md b/README.md index c5d2ae1953d..0f085775d85 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,16 @@ For Yorick-specific notes, see `README_YORICK.md`. Read ["Installation"] from [The Book]. -["Installation"]: https://doc.rust-lang.org/book/second-edition/ch01-01-installation.html +["Installation"]: https://doc.rust-lang.org/book/ch01-01-installation.html [The Book]: https://doc.rust-lang.org/book/index.html -## Building from Source +## Installing from Source [building-from-source]: #building-from-source +_Note: If you wish to contribute to the compiler, you should read +[this chapter](https://rust-lang.github.io/rustc-guide/how-to-build-and-run.html) +of the rustc-guide instead._ + ### Building on *nix 1. Make sure you have installed the dependencies: @@ -37,7 +41,6 @@ Read ["Installation"] from [The Book]. 3. Build and install: ```sh - $ git submodule update --init --recursive --progress $ ./x.py build && sudo ./x.py install ``` @@ -185,18 +188,15 @@ fetch snapshots, and an OS that can execute the available snapshot binaries. Snapshot binaries are currently built and tested on several platforms: -| Platform / Architecture | x86 | x86_64 | -|--------------------------------|-----|--------| -| Windows (7, 8, Server 2008 R2) | ✓ | ✓ | -| Linux (2.6.18 or later) | ✓ | ✓ | -| OSX (10.7 Lion or later) | ✓ | ✓ | +| Platform / Architecture | x86 | x86_64 | +|--------------------------|-----|--------| +| Windows (7, 8, 10, ...) | ✓ | ✓ | +| Linux (2.6.18 or later) | ✓ | ✓ | +| OSX (10.7 Lion or later) | ✓ | ✓ | You may find that other platforms work, but these are our officially supported build environments that are most likely to work. -Rust currently needs between 600MiB and 1.5GiB of RAM to build, depending on platform. -If it hits swap, it will take a very long time to build. - There is more advice about hacking on Rust in [CONTRIBUTING.md]. [CONTRIBUTING.md]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md @@ -232,7 +232,7 @@ Also, you may find the [rustdocs for the compiler itself][rustdocs] useful. [IRC]: https://en.wikipedia.org/wiki/Internet_Relay_Chat [#rust]: irc://irc.mozilla.org/rust [#rust-beginners]: irc://irc.mozilla.org/rust-beginners -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/about-this-guide.html +[rustc guide]: https://rust-lang.github.io/rustc-guide/about-this-guide.html [rustdocs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ ## License diff --git a/RELEASES.md b/RELEASES.md index a455186859f..83c44774da2 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,312 @@ +Version 1.32.0 (2019-01-17) +========================== + +Language +-------- +#### 2018 edition +- [You can now use the `?` operator in macro definitions.][56245] The `?` + operator allows you to specify zero or one repetitions similar to the `*` and + `+` operators. +- [Module paths with no leading keyword like `super`, `self`, or `crate`, will + now always resolve to the item (`enum`, `struct`, etc.) available in the + module if present, before resolving to a external crate or an item the prelude.][56759] + E.g. + ```rust + enum Color { Red, Green, Blue } + + use Color::*; + ``` + +#### All editions +- [You can now match against `PhantomData` types.][55837] +- [You can now match against literals in macros with the `literal` + specifier.][56072] This will match against a literal of any type. + E.g. `1`, `'A'`, `"Hello World"` +- [Self can now be used as a constructor and pattern for unit and tuple structs.][56365] E.g. + ```rust + struct Point(i32, i32); + + impl Point { + pub fn new(x: i32, y: i32) -> Self { + Self(x, y) + } + + pub fn is_origin(&self) -> bool { + match self { + Self(0, 0) => true, + _ => false, + } + } + } + ``` +- [Self can also now be used in type definitions.][56366] E.g. + ```rust + enum List + where + Self: PartialOrd // can write `Self` instead of `List` + { + Nil, + Cons(T, Box) // likewise here + } + ``` +- [You can now mark traits with `#[must_use]`.][55663] This provides a warning if + a `impl Trait` or `dyn Trait` is returned and unused in the program. + +Compiler +-------- +- [The default allocator has changed from jemalloc to the default allocator on + your system.][55238] The compiler itself on Linux & macOS will still use + jemalloc, but programs compiled with it will use the system allocator. +- [Added the `aarch64-pc-windows-msvc` target.][55702] + +Libraries +--------- +- [`PathBuf` now implements `FromStr`.][55148] +- [`Box<[T]>` now implements `FromIterator`.][55843] +- [The `dbg!` macro has been stabilized.][56395] This macro enables you to + easily debug expressions in your rust program. E.g. + ```rust + let a = 2; + let b = dbg!(a * 2) + 1; + // ^-- prints: [src/main.rs:4] a * 2 = 4 + assert_eq!(b, 5); + ``` + +The following APIs are now `const` functions and can be used in a +`const` context. + +- [`Cell::as_ptr`] +- [`UnsafeCell::get`] +- [`char::is_ascii`] +- [`iter::empty`] +- [`ManuallyDrop::new`] +- [`ManuallyDrop::into_inner`] +- [`RangeInclusive::start`] +- [`RangeInclusive::end`] +- [`NonNull::as_ptr`] +- [`slice::as_ptr`] +- [`str::as_ptr`] +- [`Duration::as_secs`] +- [`Duration::subsec_millis`] +- [`Duration::subsec_micros`] +- [`Duration::subsec_nanos`] +- [`CStr::as_ptr`] +- [`Ipv4Addr::is_unspecified`] +- [`Ipv6Addr::new`] +- [`Ipv6Addr::octets`] + +Stabilized APIs +--------------- +- [`i8::to_be_bytes`] +- [`i8::to_le_bytes`] +- [`i8::to_ne_bytes`] +- [`i8::from_be_bytes`] +- [`i8::from_le_bytes`] +- [`i8::from_ne_bytes`] +- [`i16::to_be_bytes`] +- [`i16::to_le_bytes`] +- [`i16::to_ne_bytes`] +- [`i16::from_be_bytes`] +- [`i16::from_le_bytes`] +- [`i16::from_ne_bytes`] +- [`i32::to_be_bytes`] +- [`i32::to_le_bytes`] +- [`i32::to_ne_bytes`] +- [`i32::from_be_bytes`] +- [`i32::from_le_bytes`] +- [`i32::from_ne_bytes`] +- [`i64::to_be_bytes`] +- [`i64::to_le_bytes`] +- [`i64::to_ne_bytes`] +- [`i64::from_be_bytes`] +- [`i64::from_le_bytes`] +- [`i64::from_ne_bytes`] +- [`i128::to_be_bytes`] +- [`i128::to_le_bytes`] +- [`i128::to_ne_bytes`] +- [`i128::from_be_bytes`] +- [`i128::from_le_bytes`] +- [`i128::from_ne_bytes`] +- [`isize::to_be_bytes`] +- [`isize::to_le_bytes`] +- [`isize::to_ne_bytes`] +- [`isize::from_be_bytes`] +- [`isize::from_le_bytes`] +- [`isize::from_ne_bytes`] +- [`u8::to_be_bytes`] +- [`u8::to_le_bytes`] +- [`u8::to_ne_bytes`] +- [`u8::from_be_bytes`] +- [`u8::from_le_bytes`] +- [`u8::from_ne_bytes`] +- [`u16::to_be_bytes`] +- [`u16::to_le_bytes`] +- [`u16::to_ne_bytes`] +- [`u16::from_be_bytes`] +- [`u16::from_le_bytes`] +- [`u16::from_ne_bytes`] +- [`u32::to_be_bytes`] +- [`u32::to_le_bytes`] +- [`u32::to_ne_bytes`] +- [`u32::from_be_bytes`] +- [`u32::from_le_bytes`] +- [`u32::from_ne_bytes`] +- [`u64::to_be_bytes`] +- [`u64::to_le_bytes`] +- [`u64::to_ne_bytes`] +- [`u64::from_be_bytes`] +- [`u64::from_le_bytes`] +- [`u64::from_ne_bytes`] +- [`u128::to_be_bytes`] +- [`u128::to_le_bytes`] +- [`u128::to_ne_bytes`] +- [`u128::from_be_bytes`] +- [`u128::from_le_bytes`] +- [`u128::from_ne_bytes`] +- [`usize::to_be_bytes`] +- [`usize::to_le_bytes`] +- [`usize::to_ne_bytes`] +- [`usize::from_be_bytes`] +- [`usize::from_le_bytes`] +- [`usize::from_ne_bytes`] + +Cargo +----- +- [You can now run `cargo c` as an alias for `cargo check`.][cargo/6218] +- [Usernames are now allowed in alt registry URLs.][cargo/6242] + +Misc +---- +- [`libproc_macro` has been added to the `rust-src` distribution.][55280] + +Compatibility Notes +------------------- +- [The argument types for AVX's + `_mm256_stream_si256`, `_mm256_stream_pd`, `_mm256_stream_ps`][55610] have + been changed from `*const` to `*mut` as the previous implementation + was unsound. + + +[55148]: https://github.com/rust-lang/rust/pull/55148/ +[55238]: https://github.com/rust-lang/rust/pull/55238/ +[55280]: https://github.com/rust-lang/rust/pull/55280/ +[55610]: https://github.com/rust-lang/rust/pull/55610/ +[55663]: https://github.com/rust-lang/rust/pull/55663/ +[55702]: https://github.com/rust-lang/rust/pull/55702/ +[55837]: https://github.com/rust-lang/rust/pull/55837/ +[55843]: https://github.com/rust-lang/rust/pull/55843/ +[56072]: https://github.com/rust-lang/rust/pull/56072/ +[56245]: https://github.com/rust-lang/rust/pull/56245/ +[56365]: https://github.com/rust-lang/rust/pull/56365/ +[56366]: https://github.com/rust-lang/rust/pull/56366/ +[56395]: https://github.com/rust-lang/rust/pull/56395/ +[56759]: https://github.com/rust-lang/rust/pull/56759/ +[cargo/6218]: https://github.com/rust-lang/cargo/pull/6218/ +[cargo/6242]: https://github.com/rust-lang/cargo/pull/6242/ +[`CStr::as_ptr`]: https://doc.rust-lang.org/std/ffi/struct.CStr.html#method.as_ptr +[`Cell::as_ptr`]: https://doc.rust-lang.org/std/cell/struct.Cell.html#method.as_ptr +[`Duration::as_secs`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_secs +[`Duration::subsec_micros`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.subsec_micros +[`Duration::subsec_millis`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.subsec_millis +[`Duration::subsec_nanos`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.subsec_nanos +[`Ipv4Addr::is_unspecified`]: https://doc.rust-lang.org/std/net/struct.Ipv4Addr.html#method.is_unspecified +[`Ipv6Addr::new`]: https://doc.rust-lang.org/std/net/struct.Ipv6Addr.html#method.new +[`Ipv6Addr::octets`]: https://doc.rust-lang.org/std/net/struct.Ipv6Addr.html#method.octets +[`ManuallyDrop::into_inner`]: https://doc.rust-lang.org/std/mem/struct.ManuallyDrop.html#method.into_inner +[`ManuallyDrop::new`]: https://doc.rust-lang.org/std/mem/struct.ManuallyDrop.html#method.new +[`NonNull::as_ptr`]: https://doc.rust-lang.org/std/ptr/struct.NonNull.html#method.as_ptr +[`RangeInclusive::end`]: https://doc.rust-lang.org/std/ops/struct.RangeInclusive.html#method.end +[`RangeInclusive::start`]: https://doc.rust-lang.org/std/ops/struct.RangeInclusive.html#method.start +[`UnsafeCell::get`]: https://doc.rust-lang.org/std/cell/struct.UnsafeCell.html#method.get +[`slice::as_ptr`]: https://doc.rust-lang.org/std/primitive.slice.html#method.as_ptr +[`char::is_ascii`]: https://doc.rust-lang.org/std/primitive.char.html#method.is_ascii +[`i128::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.from_be_bytes +[`i128::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.from_le_bytes +[`i128::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.from_ne_bytes +[`i128::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.to_be_bytes +[`i128::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.to_le_bytes +[`i128::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.to_ne_bytes +[`i16::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.from_be_bytes +[`i16::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.from_le_bytes +[`i16::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.from_ne_bytes +[`i16::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.to_be_bytes +[`i16::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.to_le_bytes +[`i16::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.to_ne_bytes +[`i32::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.from_be_bytes +[`i32::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.from_le_bytes +[`i32::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.from_ne_bytes +[`i32::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.to_be_bytes +[`i32::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.to_le_bytes +[`i32::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.to_ne_bytes +[`i64::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.from_be_bytes +[`i64::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.from_le_bytes +[`i64::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.from_ne_bytes +[`i64::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.to_be_bytes +[`i64::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.to_le_bytes +[`i64::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.to_ne_bytes +[`i8::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.from_be_bytes +[`i8::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.from_le_bytes +[`i8::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.from_ne_bytes +[`i8::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.to_be_bytes +[`i8::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.to_le_bytes +[`i8::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.to_ne_bytes +[`isize::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.from_be_bytes +[`isize::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.from_le_bytes +[`isize::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.from_ne_bytes +[`isize::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.to_be_bytes +[`isize::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.to_le_bytes +[`isize::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.to_ne_bytes +[`iter::empty`]: https://doc.rust-lang.org/std/iter/fn.empty.html +[`str::as_ptr`]: https://doc.rust-lang.org/std/primitive.str.html#method.as_ptr +[`u128::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.from_be_bytes +[`u128::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.from_le_bytes +[`u128::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.from_ne_bytes +[`u128::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.to_be_bytes +[`u128::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.to_le_bytes +[`u128::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.to_ne_bytes +[`u16::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.from_be_bytes +[`u16::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.from_le_bytes +[`u16::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.from_ne_bytes +[`u16::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.to_be_bytes +[`u16::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.to_le_bytes +[`u16::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.to_ne_bytes +[`u32::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.from_be_bytes +[`u32::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.from_le_bytes +[`u32::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.from_ne_bytes +[`u32::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.to_be_bytes +[`u32::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.to_le_bytes +[`u32::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.to_ne_bytes +[`u64::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.from_be_bytes +[`u64::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.from_le_bytes +[`u64::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.from_ne_bytes +[`u64::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.to_be_bytes +[`u64::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.to_le_bytes +[`u64::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.to_ne_bytes +[`u8::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.from_be_bytes +[`u8::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.from_le_bytes +[`u8::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.from_ne_bytes +[`u8::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_be_bytes +[`u8::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_le_bytes +[`u8::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.to_ne_bytes +[`usize::from_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.from_be_bytes +[`usize::from_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.from_le_bytes +[`usize::from_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.from_ne_bytes +[`usize::to_be_bytes`]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.to_be_bytes +[`usize::to_le_bytes`]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.to_le_bytes +[`usize::to_ne_bytes`]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.to_ne_bytes + + +Version 1.31.1 (2018-12-20) +=========================== + +- [Fix Rust failing to build on `powerpc-unknown-netbsd`][56562] +- [Fix broken go-to-definition in RLS][rls/1171] +- [Fix infinite loop on hover in RLS][rls/1170] + +[56562]: https://github.com/rust-lang/rust/pull/56562 +[rls/1171]: https://github.com/rust-lang/rls/issues/1171 +[rls/1170]: https://github.com/rust-lang/rls/pull/1170 + Version 1.31.0 (2018-12-06) ========================== @@ -74,6 +383,14 @@ Cargo [cargo-rename-reference]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml [const-reference]: https://doc.rust-lang.org/reference/items/functions.html#const-functions +Version 1.30.1 (2018-11-08) +=========================== + +- [Fixed overflow ICE in rustdoc][54199] +- [Cap Cargo progress bar width at 60 in MSYS terminals][cargo/6122] + +[54199]: https://github.com/rust-lang/rust/pull/54199 +[cargo/6122]: https://github.com/rust-lang/cargo/pull/6122 Version 1.30.0 (2018-10-25) ========================== diff --git a/appveyor.yml b/appveyor.yml index 372b53b05f2..d70ad54b1c8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,17 +1,10 @@ environment: - SCCACHE_DIGEST: f808afabb4a4eb1d7112bcb3fa6be03b61e93412890c88e177c667eb37f46353d7ec294e559b16f9f4b5e894f2185fe7670a0df15fd064889ecbd80f0c34166c # By default schannel checks revocation of certificates unlike some other SSL # backends, but we've historically had problems on CI where a revocation # server goes down presumably. See #43333 for more info CARGO_HTTP_CHECK_REVOKE: false - # Recommended by AppVeyor this moves our builds to GCE which incurs a 3-4 - # minute startup overhead, but that's paltry compared to our overall build - # times so we're will to eat the cost. This is intended to give us better - # performance I believe! - appveyor_build_worker_cloud: gce - matrix: # 32/64 bit MSVC tests - MSYS_BITS: 64 diff --git a/config.toml.example b/config.toml.example index 8b11014edae..f45db37c33b 100644 --- a/config.toml.example +++ b/config.toml.example @@ -90,6 +90,21 @@ # with clang-cl, so this is special in that it only compiles LLVM with clang-cl #clang-cl = '/path/to/clang-cl.exe' +# Pass extra compiler and linker flags to the LLVM CMake build. +#cflags = "-fextra-flag" +#cxxflags = "-fextra-flag" +#ldflags = "-Wl,extra-flag" + +# Use libc++ when building LLVM instead of libstdc++. This is the default on +# platforms already use libc++ as the default C++ library, but this option +# allows you to use libc++ even on platforms when it's not. You need to ensure +# that your host compiler ships with libc++. +#use-libcxx = true + +# The value specified here will be passed as `-DLLVM_USE_LINKER` to CMake. +#use-linker = "lld" + + # ============================================================================= # General build configuration options # ============================================================================= @@ -171,7 +186,7 @@ # Installs chosen set of extended tools if enables. By default builds all. # If chosen tool failed to build the installation fails. -#tools = ["cargo", "rls", "rustfmt", "analysis", "src"] +#tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src"] # Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose #verbose = 0 @@ -282,7 +297,7 @@ #codegen-units-std = 1 # Whether or not debug assertions are enabled for the compiler and standard -# library. Also enables compilation of debug! and trace! logging macros. +# library. #debug-assertions = false # Whether or not debuginfo is emitted @@ -306,8 +321,8 @@ # Whether to always use incremental compilation when building rustc #incremental = false -# Build rustc with experimental parallelization -#experimental-parallel-queries = false +# Build a multi-threaded rustc +#parallel-compiler = false # The default linker that will be hard-coded into the generated compiler for # targets that don't specify linker explicitly in their target specifications. @@ -400,6 +415,11 @@ # override the default allocator for rustc and LLVM. #jemalloc = false +# Run tests in various test suites with the "nll compare mode" in addition to +# running the tests in normal mode. Largely only used on CI and during local +# development of NLL +#test-compare-mode = false + # ============================================================================= # Options for specific targets # diff --git a/src/Cargo.lock b/src/Cargo.lock deleted file mode 100644 index db896b59ba4..00000000000 --- a/src/Cargo.lock +++ /dev/null @@ -1,3505 +0,0 @@ -[[package]] -name = "aho-corasick" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "alloc" -version = "0.0.0" -dependencies = [ - "compiler_builtins 0.0.0", - "core 0.0.0", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ammonia" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "html5ever 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "arena" -version = "0.0.0" -dependencies = [ - "rustc_data_structures 0.0.0", -] - -[[package]] -name = "arrayvec" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "assert_cli" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "atty" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace-sys" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bit-set" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bit-vec" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bitflags" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bitflags" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bootstrap" -version = "0.0.0" -dependencies = [ - "build_helper 0.1.0", - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", - "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "bufstream" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "build-manifest" -version = "0.1.0" -dependencies = [ - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "build_helper" -version = "0.1.0" - -[[package]] -name = "bytecount" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "simd 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "byteorder" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bytesize" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cargo" -version = "0.33.0" -dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crates-io 0.21.0", - "crossbeam-utils 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", - "curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fwdansi 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", - "git2-curl 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ignore 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "opener 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)", - "proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-workspace-hack 1.0.0", - "rustfix 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "shell-escape 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cargo_metadata" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cargotest2" -version = "0.1.0" - -[[package]] -name = "cc" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cfg-if" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "chalk-engine" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "chalk-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "chrono" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "clap" -version = "2.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "clippy" -version = "0.0.212" -dependencies = [ - "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "clippy-mini-macro-test 0.2.0", - "clippy_dev 0.0.1", - "clippy_lints 0.0.212", - "compiletest_rs 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", - "derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-workspace-hack 1.0.0", - "rustc_tools_util 0.1.0", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "clippy-mini-macro-test" -version = "0.2.0" - -[[package]] -name = "clippy_dev" -version = "0.0.1" -dependencies = [ - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "clippy_lints" -version = "0.0.212" -dependencies = [ - "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cmake" -version = "0.1.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "colored" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "commoncrypto" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "commoncrypto-sys" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "compiler_builtins" -version = "0.0.0" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "core 0.0.0", -] - -[[package]] -name = "compiletest" -version = "0.0.0" -dependencies = [ - "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustfix 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "compiletest_rs" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "core" -version = "0.0.0" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "core-foundation" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "core-foundation-sys 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "core-foundation-sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "crates-io" -version = "0.21.0" -dependencies = [ - "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "crossbeam-channel" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-deque" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-utils" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crossbeam-utils" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "crossbeam-utils" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "crypto-hash" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "curl" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.38 (registry+https://github.com/rust-lang/crates.io-index)", - "schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "curl-sys" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "libnghttp2-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.38 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "datafrog" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "derive-new" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "derive_more" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.21 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "diff" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "difference" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "dlmalloc" -version = "0.0.0" -dependencies = [ - "compiler_builtins 0.0.0", - "core 0.0.0", -] - -[[package]] -name = "either" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "elasticlunr-rs" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "strum 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "strum_macros 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ena" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ena" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "env_logger" -version = "0.5.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "env_logger" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "environment" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "error-chain" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "error-chain" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "error_index_generator" -version = "0.0.0" -dependencies = [ - "rustdoc 0.0.0", -] - -[[package]] -name = "failure" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure_derive" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "filetime" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fixedbitset" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "flate2" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fmt_macros" -version = "0.0.0" - -[[package]] -name = "fnv" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fs_extra" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "fst" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "futf" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "fwdansi" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "getopts" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "git2" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "libgit2-sys 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.38 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "git2-curl" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", - "git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "glob" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "globset" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "graphviz" -version = "0.0.0" - -[[package]] -name = "handlebars" -version = "0.32.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "pest_derive 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "hex" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "home" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "html5ever" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "markup5ever 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "humantime" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "if_chain" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "ignore" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "globset 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "installer" -version = "0.0.0" -dependencies = [ - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "xz2 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "is-match" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "itertools" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "itoa" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "jemalloc-sys" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "jobserver" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "json" -version = "0.11.13" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "jsonrpc-core" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "languageserver-types" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "num-derive 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lazy_static" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "lazy_static" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lazycell" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.0.0" -dependencies = [ - "compiler_builtins 0.0.0", - "core 0.0.0", -] - -[[package]] -name = "libc" -version = "0.2.43" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libgit2-sys" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "libssh2-sys 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.38 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "libnghttp2-sys" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "libssh2-sys" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.38 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "libz-sys" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "linkchecker" -version = "0.1.0" - -[[package]] -name = "lock_api" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "log" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "log_settings" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lzma-sys" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "mac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "macro-utils" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "maplit" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "markup5ever" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "phf 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_codegen 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "matches" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "mdbook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ammonia 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "elasticlunr-rs 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "handlebars 0.32.4 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "toml-query 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memchr" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memmap" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "memoffset" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "minifier" -version = "0.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "macro-utils 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "miniz-sys" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "miow" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "miri" -version = "0.1.0" -dependencies = [ - "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "compiletest_rs 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "vergen 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "new_debug_unreachable" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "nodrop" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "num-derive" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-integer" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "num_cpus" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "open" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "opener" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "openssl" -version = "0.10.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.38 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "openssl-probe" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "openssl-src" -version = "111.0.1+1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "openssl-sys" -version = "0.9.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-src 111.0.1+1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ordermap" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "ordslice" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "owning_ref" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "panic_abort" -version = "0.0.0" -dependencies = [ - "compiler_builtins 0.0.0", - "core 0.0.0", - "libc 0.0.0", -] - -[[package]] -name = "panic_unwind" -version = "0.0.0" -dependencies = [ - "alloc 0.0.0", - "compiler_builtins 0.0.0", - "core 0.0.0", - "libc 0.0.0", - "unwind 0.0.0", -] - -[[package]] -name = "parking_lot" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parking_lot_core" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "parking_lot_core" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "pest" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "pest_derive" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "petgraph" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "phf" -version = "0.7.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "phf_codegen" -version = "0.7.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "phf_generator" -version = "0.7.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "phf_shared" -version = "0.7.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pkg-config" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "polonius-engine" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "datafrog 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "pretty_assertions" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc-macro2" -version = "0.4.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "proc_macro" -version = "0.0.0" -dependencies = [ - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "profiler_builtins" -version = "0.0.0" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "compiler_builtins 0.0.0", - "core 0.0.0", -] - -[[package]] -name = "proptest" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rusty-fork 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pulldown-cmark" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quick-error" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "quine-mc_cluskey" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "quote" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "quote" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "racer" -version = "2.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rayon" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rayon-core" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "redox_syscall" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "redox_termios" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex-syntax" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex-syntax" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "remote-test-client" -version = "0.1.0" - -[[package]] -name = "remote-test-server" -version = "0.1.0" - -[[package]] -name = "remove_dir_all" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rls" -version = "1.31.6" -dependencies = [ - "cargo 0.33.0", - "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "clippy_lints 0.0.212", - "crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "languageserver-types 0.45.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "racer 2.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-analysis 0.16.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-vfs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-workspace-hack 1.0.0", - "rustc_tools_util 0.1.0", - "rustfmt-nightly 1.0.0", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rls-analysis" -version = "0.16.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "fst 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "json 0.11.13 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rls-blacklist" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rls-data" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rls-rustc" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rls-span" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rls-vfs" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustbook" -version = "0.1.0" -dependencies = [ - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", - "mdbook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc" -version = "0.0.0" -dependencies = [ - "arena 0.0.0", - "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fmt_macros 0.0.0", - "graphviz 0.0.0", - "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "proc_macro 0.0.0", - "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_apfloat 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_fs_util 0.0.0", - "rustc_target 0.0.0", - "rustc_yk_link 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serialize 0.0.0", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "syntax 0.0.0", - "syntax_pos 0.0.0", - "tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-arena" -version = "297.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc-ap-rustc_data_structures 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-graphviz" -version = "297.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-ap-rustc_cratesio_shim" -version = "297.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-rustc_data_structures" -version = "297.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-graphviz 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_cratesio_shim 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-rustc_errors" -version = "297.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_cratesio_shim 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-rustc_target" -version = "297.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_cratesio_shim 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-serialize" -version = "297.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-syntax" -version = "297.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_errors 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_target 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-syntax_pos" -version = "297.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-arena 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-hash" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-main" -version = "0.0.0" -dependencies = [ - "rustc_driver 0.0.0", - "rustc_target 0.0.0", -] - -[[package]] -name = "rustc-rayon" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-rayon-core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-workspace-hack" -version = "1.0.0" -dependencies = [ - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc_allocator" -version = "0.0.0" -dependencies = [ - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_target 0.0.0", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_apfloat" -version = "0.0.0" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_cratesio_shim 0.0.0", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc_asan" -version = "0.0.0" -dependencies = [ - "alloc 0.0.0", - "build_helper 0.1.0", - "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", - "compiler_builtins 0.0.0", - "core 0.0.0", -] - -[[package]] -name = "rustc_borrowck" -version = "0.0.0" -dependencies = [ - "graphviz 0.0.0", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_mir 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_codegen_llvm" -version = "0.0.0" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_codegen_ssa 0.0.0", - "rustc_llvm 0.0.0", - "rustc_yk_sections 0.0.0", -] - -[[package]] -name = "rustc_codegen_ssa" -version = "0.0.0" -dependencies = [ - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc_codegen_utils" -version = "0.0.0" -dependencies = [ - "flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_incremental 0.0.0", - "rustc_metadata 0.0.0", - "rustc_mir 0.0.0", - "rustc_target 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_cratesio_shim" -version = "0.0.0" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc_data_structures" -version = "0.0.0" -dependencies = [ - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "ena 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "graphviz 0.0.0", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_cratesio_shim 0.0.0", - "serialize 0.0.0", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc_driver" -version = "0.0.0" -dependencies = [ - "arena 0.0.0", - "env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)", - "graphviz 0.0.0", - "jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_allocator 0.0.0", - "rustc_borrowck 0.0.0", - "rustc_codegen_utils 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_incremental 0.0.0", - "rustc_lint 0.0.0", - "rustc_metadata 0.0.0", - "rustc_mir 0.0.0", - "rustc_passes 0.0.0", - "rustc_plugin 0.0.0", - "rustc_privacy 0.0.0", - "rustc_resolve 0.0.0", - "rustc_save_analysis 0.0.0", - "rustc_target 0.0.0", - "rustc_traits 0.0.0", - "rustc_typeck 0.0.0", - "rustc_yk_link 0.0.0", - "rustc_yk_sections 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serialize 0.0.0", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "syntax 0.0.0", - "syntax_ext 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_errors" -version = "0.0.0" -dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_cratesio_shim 0.0.0", - "rustc_data_structures 0.0.0", - "serialize 0.0.0", - "syntax_pos 0.0.0", - "termcolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc_fs_util" -version = "0.0.0" - -[[package]] -name = "rustc_incremental" -version = "0.0.0" -dependencies = [ - "graphviz 0.0.0", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_fs_util 0.0.0", - "serialize 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_lint" -version = "0.0.0" -dependencies = [ - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_mir 0.0.0", - "rustc_target 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_llvm" -version = "0.0.0" -dependencies = [ - "build_helper 0.1.0", - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc_lsan" -version = "0.0.0" -dependencies = [ - "alloc 0.0.0", - "build_helper 0.1.0", - "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", - "compiler_builtins 0.0.0", - "core 0.0.0", -] - -[[package]] -name = "rustc_metadata" -version = "0.0.0" -dependencies = [ - "flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "proc_macro 0.0.0", - "rustc 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_target 0.0.0", - "serialize 0.0.0", - "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syntax 0.0.0", - "syntax_ext 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_mir" -version = "0.0.0" -dependencies = [ - "arena 0.0.0", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "graphviz 0.0.0", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "log_settings 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_apfloat 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_target 0.0.0", - "serialize 0.0.0", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_msan" -version = "0.0.0" -dependencies = [ - "alloc 0.0.0", - "build_helper 0.1.0", - "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", - "compiler_builtins 0.0.0", - "core 0.0.0", -] - -[[package]] -name = "rustc_passes" -version = "0.0.0" -dependencies = [ - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_mir 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_platform_intrinsics" -version = "0.0.0" - -[[package]] -name = "rustc_plugin" -version = "0.0.0" -dependencies = [ - "rustc 0.0.0", - "rustc_errors 0.0.0", - "rustc_metadata 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_privacy" -version = "0.0.0" -dependencies = [ - "rustc 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_typeck 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_resolve" -version = "0.0.0" -dependencies = [ - "arena 0.0.0", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_metadata 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_save_analysis" -version = "0.0.0" -dependencies = [ - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_codegen_utils 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_target 0.0.0", - "rustc_typeck 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_target" -version = "0.0.0" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_cratesio_shim 0.0.0", - "rustc_data_structures 0.0.0", - "serialize 0.0.0", -] - -[[package]] -name = "rustc_tools_util" -version = "0.1.0" - -[[package]] -name = "rustc_traits" -version = "0.0.0" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "graphviz 0.0.0", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_target 0.0.0", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_tsan" -version = "0.0.0" -dependencies = [ - "alloc 0.0.0", - "build_helper 0.1.0", - "cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)", - "compiler_builtins 0.0.0", - "core 0.0.0", -] - -[[package]] -name = "rustc_typeck" -version = "0.0.0" -dependencies = [ - "arena 0.0.0", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_platform_intrinsics 0.0.0", - "rustc_target 0.0.0", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "rustc_version" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc_yk_link" -version = "0.0.0" - -[[package]] -name = "rustc_yk_sections" -version = "0.0.0" -dependencies = [ - "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_codegen_utils 0.0.0", - "rustc_yk_link 0.0.0", -] - -[[package]] -name = "rustdoc" -version = "0.0.0" -dependencies = [ - "minifier 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustdoc-themes" -version = "0.1.0" - -[[package]] -name = "rustdoc-tool" -version = "0.0.0" -dependencies = [ - "rustdoc 0.0.0", -] - -[[package]] -name = "rustfix" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustfmt-nightly" -version = "1.0.0" -dependencies = [ - "assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", - "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_target 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-workspace-hack 1.0.0", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rusty-fork" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "wait-timeout 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ryu" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "same-file" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "schannel" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "scoped-tls" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "scopeguard" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "1.0.75" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde_derive" -version = "1.0.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_ignored" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_json" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serialize" -version = "0.0.0" -dependencies = [ - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "shell-escape" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "shlex" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "simd" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "siphasher" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "smallvec" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "socket2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "stable_deref_trait" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "std" -version = "0.0.0" -dependencies = [ - "alloc 0.0.0", - "build_helper 0.1.0", - "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", - "compiler_builtins 0.0.0", - "core 0.0.0", - "dlmalloc 0.0.0", - "libc 0.0.0", - "panic_abort 0.0.0", - "panic_unwind 0.0.0", - "profiler_builtins 0.0.0", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_asan 0.0.0", - "rustc_lsan 0.0.0", - "rustc_msan 0.0.0", - "rustc_tsan 0.0.0", - "unwind 0.0.0", -] - -[[package]] -name = "string_cache" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", - "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "string_cache_codegen" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "string_cache_shared" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "strsim" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "strum" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "strum_macros" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "0.11.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "0.13.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "0.14.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "0.15.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "synom" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "synstructure" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntax" -version = "0.0.0" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_target 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serialize 0.0.0", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "syntax_pos 0.0.0", -] - -[[package]] -name = "syntax_ext" -version = "0.0.0" -dependencies = [ - "fmt_macros 0.0.0", - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "proc_macro 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_target 0.0.0", - "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - -[[package]] -name = "syntax_pos" -version = "0.0.0" -dependencies = [ - "arena 0.0.0", - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_data_structures 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serialize 0.0.0", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tar" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tempfile" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tendril" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futf 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "utf-8 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "term" -version = "0.0.0" - -[[package]] -name = "term" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "termcolor" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "termion" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "test" -version = "0.0.0" -dependencies = [ - "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.0.0", -] - -[[package]] -name = "textwrap" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tidy" -version = "0.1.0" -dependencies = [ - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "time" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "toml" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "toml-query" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ucd-util" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-bidi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unicode-normalization" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-segmentation" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-width" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unstable-book-gen" -version = "0.1.0" -dependencies = [ - "num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tidy 0.1.0", -] - -[[package]] -name = "unwind" -version = "0.0.0" -dependencies = [ - "compiler_builtins 0.0.0", - "core 0.0.0", - "libc 0.0.0", -] - -[[package]] -name = "url" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "url_serde" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "utf-8" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "utf8-ranges" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "vcpkg" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "vec_map" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "vergen" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wait-timeout" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "walkdir" -version = "2.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-util" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "wincolor" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "xattr" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "xz2" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lzma-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "yaml-rust" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum aho-corasick 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "7ee94e9463ccb9d681e7b708082687b2c56d2bd420ca8a3d3157d27d59508ec0" -"checksum ammonia 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd4c682378117e4186a492b2252b9537990e1617f44aed9788b9a1149de45477" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" -"checksum assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98589b0e465a6c510d95fceebd365bb79bedece7f6e18a480897f2015f85ec51" -"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" -"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" -"checksum bit-set 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f1efcc46c18245a69c38fcc5cc650f16d3a59d034f3106e9ed63748f695730a" -"checksum bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4440d5cb623bb7390ae27fec0bb6c61111969860f8e3ae198bfa0663645e67cf" -"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" -"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32" -"checksum bytecount 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f861d9ce359f56dbcb6e0c2a1cb84e52ad732cadb57b806adeb3c7668caccbd8" -"checksum byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "74c0b906e9446b0a2e4f760cdb3fa4b2c48cdc6db8766a845c54b6ff063fd2e9" -"checksum bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010" -"checksum cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d8dfe3adeb30f7938e6c1dd5327f29235d8ada3e898aeb08c343005ec2915a2" -"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" -"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" -"checksum chalk-engine 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6749eb72e7d4355d944a99f15fbaea701b978c18c5e184a025fcde942b0c9779" -"checksum chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "295635afd6853aa9f20baeb7f0204862440c0fe994c5a253d5f479dac41d047e" -"checksum chrono 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6962c635d530328acc53ac6a955e83093fedc91c5809dfac1fa60fa470830a37" -"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" -"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "704fbf3bb5149daab0afb255dbea24a1f08d2f4099cedb9baab6d470d4c5eefb" -"checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc" -"checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007" -"checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2" -"checksum compiletest_rs 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "75e809f56d6aa9575b67924b0af686c4f4c1380314f47947e235e9ff7fa94bed" -"checksum core-foundation 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cc3532ec724375c7cb7ff0a097b714fde180bb1f6ed2ab27cfcd99ffca873cd2" -"checksum core-foundation-sys 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a3fb15cdbdd9cf8b82d97d0296bb5cd3631bba58d6e31650a002a8e7fb5721f9" -"checksum crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "24ce9782d4d5c53674646a6a4c1863a21a8fc0cb649b3c94dfc16e45071dea19" -"checksum crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b85741761b7f160bc5e7e0c14986ef685b7f8bf9b7ad081c60c604bb4649827" -"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" -"checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" -"checksum crossbeam-epoch 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c90f1474584f38e270b5b613e898c8c328aa4f3dea85e0a27ac2e642f009416" -"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" -"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" -"checksum crossbeam-utils 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c55913cc2799171a550e307918c0a360e8c16004820291bf3b638969b4a01816" -"checksum crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "09de9ee0fc255ace04c7fa0763c9395a945c37c8292bb554f8d48361d1dcf1b4" -"checksum curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "c7c9d851c825e0c033979d4516c9173bc19a78a96eb4d6ae51d4045440eafa16" -"checksum curl-sys 0.4.15 (registry+https://github.com/rust-lang/crates.io-index)" = "721c204978be2143fab0a84b708c49d79d1f6100b8785610f456043a90708870" -"checksum datafrog 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16d724bf4ffe77cdceeecd461009b5f8d9e23c5d645d68bedb4586bf43e7e142" -"checksum derive-new 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ceed73957c449214f8440eec8ad7fa282b67dc9eacbb24a3085b15d60397a17a" -"checksum derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f57d78cf3bd45270dad4e70c21ec77a960b36c7a841ff9db76aaa775a8fb871" -"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a" -"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" -"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" -"checksum elasticlunr-rs 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4837d77a1e157489a3933b743fd774ae75074e0e390b2b7f071530048a0d87ee" -"checksum ena 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "25b4e5febb25f08c49f1b07dc33a182729a6b21edfb562b5aef95f78e0dbe5bb" -"checksum ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "88dc8393b3c7352f94092497f6b52019643e493b6b890eb417cdb7c46117e621" -"checksum env_logger 0.5.12 (registry+https://github.com/rust-lang/crates.io-index)" = "f4d7e69c283751083d53d01eac767407343b8b69c4bd70058e08adc2637cb257" -"checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e" -"checksum environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4b14e20978669064c33b4c1e0fb4083412e40fe56cbea2eae80fd7591503ee" -"checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" -"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" -"checksum failure 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7efb22686e4a466b1ec1a15c2898f91fa9cb340452496dca654032de20ff95b9" -"checksum failure_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "946d0e98a50d9831f5d589038d2ca7f8f455b1c21028c0db0e84116a12696426" -"checksum filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "da4b9849e77b13195302c174324b5ba73eec9b236b24c221a61000daefb95c5f" -"checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" -"checksum flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4af030962d89d62aa52cd9492083b1cd9b2d1a77764878102a6c0f86b4d5444d" -"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" -"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -"checksum fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" -"checksum fst 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d94485a00b1827b861dd9d1a2cc9764f9044d4c535514c0760a5a2012ef3399f" -"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum futf 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b" -"checksum futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "1a70b146671de62ec8c8ed572219ca5d594d9b06c0b364d5e67b722fc559b48c" -"checksum fwdansi 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "34dd4c507af68d37ffef962063dfa1944ce0dd4d5b82043dbab1dabe088610c3" -"checksum getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05" -"checksum git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "591f8be1674b421644b6c030969520bc3fa12114d2eb467471982ed3e9584e71" -"checksum git2-curl 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0173e317f8ba21f3fff0f71549fead5e42e67961dbd402bf69f42775f3cc78b4" -"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum globset 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8e49edbcc9c7fc5beb8c0a54e7319ff8bed353a2b55e85811c6281188c2a6c84" -"checksum handlebars 0.32.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d89ec99d1594f285d4590fc32bac5f75cdab383f1123d504d27862c644a807dd" -"checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" -"checksum home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "80dff82fb58cfbbc617fb9a9184b010be0529201553cda50ad04372bc2333aff" -"checksum html5ever 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b04478cf718862650a0bf66acaf8f2f8c906fbc703f35c916c1f4211b069a364" -"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" -"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -"checksum if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4bac95d9aa0624e7b78187d6fb8ab012b41d9f6f54b1bcb61e61c4845f8357ec" -"checksum ignore 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3e9faa7c84064f07b40da27044af629f578bc7994b650d3e458d0c29183c1d91" -"checksum is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7e5b386aef33a1c677be65237cb9d32c3f3ef56bd035949710c4bb13083eb053" -"checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450" -"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" -"checksum jemalloc-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "bfc62c8e50e381768ce8ee0428ee53741929f7ebd73e4d83f669bcf7693e00ae" -"checksum jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "60af5f849e1981434e4a31d3d782c4774ae9b434ce55b101a96ecfd09147e8be" -"checksum json 0.11.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad0485404155f45cce53a40d4b2d6ac356418300daed05273d9e26f91c390be" -"checksum jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ddf83704f4e79979a424d1082dd2c1e52683058056c9280efa19ac5f6bc9033c" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum languageserver-types 0.45.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d91d91d1c23db74187096d191967cb49f49bb175ad6d855fa9229d16ef2c982" -"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" -"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" -"checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0" -"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" -"checksum libgit2-sys 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4916b5addc78ec36cc309acfcdf0b9f9d97ab7b84083118b248709c5b7029356" -"checksum libnghttp2-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ffbfb81475cc9f625e44f3a8f8b9cf7173815ae1c7cc2fa91853ec009e38198" -"checksum libssh2-sys 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "126a1f4078368b163bfdee65fbab072af08a1b374a5551b21e87ade27b1fbf9d" -"checksum libz-sys 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)" = "4401fe74560a0d46fce3464625ac8aa7a79d291dd28cee021d18852d5191c280" -"checksum lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "949826a5ccf18c1b3a7c3d57692778d21768b79e46eb9dd07bfc4c2160036c54" -"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -"checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f" -"checksum log_settings 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19af41f0565d7c19b2058153ad0b42d4d5ce89ec4dbf06ed6741114a8b63e7cd" -"checksum lzma-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d1eaa027402541975218bb0eec67d6b0412f6233af96e0d096d31dbdfd22e614" -"checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" -"checksum macro-utils 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2c4deaccc2ead6a28c16c0ba82f07d52b6475397415ce40876e559b0b0ea510" -"checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43" -"checksum markup5ever 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfedc97d5a503e96816d10fedcd5b42f760b2e525ce2f7ec71f6a41780548475" -"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" -"checksum mdbook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "90b5a8d7e341ceee5db3882a06078d42661ddcfa2b3687319cc5da76ec4e782f" -"checksum memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a3b4142ab8738a78c51896f704f83c11df047ff1bda9a92a661aa6361552d93d" -"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff" -"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" -"checksum minifier 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "96c269bb45c39b333392b2b18ad71760b34ac65666591386b0e959ed58b3f474" -"checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4" -"checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" -"checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4" -"checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" -"checksum num-derive 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d2c31b75c36a993d30c7a13d70513cb93f02acafdd5b7ba250f9b0e18615de7" -"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" -"checksum num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "630de1ef5cc79d0cdd78b7e33b81f083cbfe90de0f4b2b2f07f905867c70e9fe" -"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" -"checksum open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c281318d992e4432cfa799969467003d05921582a7489a8325e37f8a450d5113" -"checksum opener 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "176cd8eadff5ef9fa5c6d19452535662c02c6bf29b3d594a3fc01f749bb24c94" -"checksum openssl 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5af9e83eb3c51ee806387d26a43056f3246d865844caa6dd704d2ba7e831c264" -"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" -"checksum openssl-src 111.0.1+1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d1edaed888fd85a54a2646bf02992931ddefdda3b1a748fc79f088a8db27fcbe" -"checksum openssl-sys 0.9.38 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3d1b390ab1b9700f682ad95a30dc9c0f40dd212ca57266012cfc678b0e365a" -"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" -"checksum ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd20eec3dbe4376829cb7d80ae6ac45e0a766831dca50202ff2d40db46a8a024" -"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" -"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" -"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa" -"checksum parking_lot_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06a2b6aae052309c2fd2161ef58f5067bc17bb758377a0de9d4b279d603fdd8a" -"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" -"checksum pest 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0fce5d8b5cc33983fc74f78ad552b5522ab41442c4ca91606e4236eb4b5ceefc" -"checksum pest_derive 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ab94faafeb93f4c5e3ce81ca0e5a779529a602ad5d09ae6d21996bfb8b6a52bf" -"checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" -"checksum phf 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "7d37a244c75a9748e049225155f56dbcb98fe71b192fd25fd23cb914b5ad62f2" -"checksum phf_codegen 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "4e4048fe7dd7a06b8127ecd6d3803149126e9b33c7558879846da3a63f734f2b" -"checksum phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "05a079dd052e7b674d21cb31cbb6c05efd56a2cd2827db7692e2f1a507ebd998" -"checksum phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "c2261d544c2bb6aa3b10022b0be371b9c7c64f762ef28c6f5d4f1ef6d97b5930" -"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" -"checksum polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b6b0a7f5f4278b991ffd14abce1d01b013121ad297460237ef0a2f08d43201" -"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6" -"checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" -"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" -"checksum proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "926d0604475349f463fe44130aae73f2294b5309ab2ca0310b998bd334ef191f" -"checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32" -"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" -"checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45" -"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" -"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" -"checksum racer 2.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "344a53b68d889ab5f44d0617f2bbe1f696abe6a730bd41fa619cfc6fa83a6078" -"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" -"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" -"checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2" -"checksum rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80e811e76f1dbf68abf87a759083d34600017fc4e10b6bd5ad84a700f9dba4b1" -"checksum rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d24ad214285a7729b174ed6d3bcfcb80177807f959d95fafd5bfc5c4f201ac8" -"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" -"checksum regex 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "67d0301b0c6804eca7e3c275119d0b01ff3b7ab9258a65709e608a66312a1025" -"checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" -"checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d" -"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" -"checksum rls-analysis 0.16.8 (registry+https://github.com/rust-lang/crates.io-index)" = "2a1d3a2a8c03e380331aefb8b5e3e06f3065602fbaa6657ba0ac649dc99d8537" -"checksum rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ce1fdac03e138c4617ff87b194e1ff57a39bb985a044ccbd8673d30701e411" -"checksum rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a209ce46bb52813cbe0786a7baadc0c1a3f5543ef93f179eda3b841ed72cf2e" -"checksum rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9dba7390427aefa953608429701e3665192ca810ba8ae09301e001b7c7bed0" -"checksum rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d7c7046dc6a92f2ae02ed302746db4382e75131b9ce20ce967259f6b5867a6a" -"checksum rls-vfs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "72d56425bd5aa86d9d4372b76f0381d3b4bda9c0220e71956c9fcc929f45c1f1" -"checksum rustc-ap-arena 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b69fd4a0e8a3ecd99b497965d05f6f04dd2e4601a6146a841dbe4c8e77c2b30c" -"checksum rustc-ap-graphviz 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8136418dbc491bab74aa0565eaa2086754a7a81a5e74a1d84d6168d18e889e7" -"checksum rustc-ap-rustc_cratesio_shim 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a972feda82332d1d05b1ba5a097e915cd9c9c8f1af2bd7b08af09fb88c753d5f" -"checksum rustc-ap-rustc_data_structures 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "582584c6c48b0ece4b8aef3f9bb59d94d17c5665612bc87a71f509e45a3113b5" -"checksum rustc-ap-rustc_errors 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cd852096944d0ac6af1aefa9639a2ae6dede217606ce97f88ff0dcc8c86d6ff6" -"checksum rustc-ap-rustc_target 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "98301a272ecfeec29d2d4e97b07238707c2b89d86fc3a4a5f31a00728f14e288" -"checksum rustc-ap-serialize 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f13510e617e2e322e3297038fd6a7346f2297124af9e10e33a627c5d544e9d" -"checksum rustc-ap-syntax 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0792f5a9ccfc5ec13bb5b0472fa49e145481029c39f6bf5b1a36decc99c3328f" -"checksum rustc-ap-syntax_pos 297.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0df9f97f41650d23b14f92f7267f8c61089655efb4533d82bf8991f99245198d" -"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" -"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" -"checksum rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c6d5a683c6ba4ed37959097e88d71c9e8e26659a3cb5be8b389078e7ad45306" -"checksum rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40f06724db71e18d68b3b946fdf890ca8c921d9edccc1404fdfdb537b0d12649" -"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" -"checksum rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a54aa04a10c68c1c4eacb4337fd883b435997ede17a9385784b990777686b09a" -"checksum rustfix 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "756567f00f7d89c9f89a5c401b8b1caaa122e27240b9eaadd0bb52ee0b680b1b" -"checksum rusty-fork 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9591f190d2852720b679c21f66ad929f9f1d7bb09d1193c26167586029d8489c" -"checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7" -"checksum same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f7794e2fda7f594866840e95f5c5962e886e228e68b6505885811a94dd728c" -"checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" -"checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" -"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)" = "22d340507cea0b7e6632900a176101fea959c7065d93ba555072da90aaaafc87" -"checksum serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)" = "234fc8b737737b148ccd625175fc6390f5e4dacfdaa543cb93a3430d984a9119" -"checksum serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "190e9765dcedb56be63b6e0993a006c7e3b071a016a304736e4a315dc01fb142" -"checksum serde_json 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "bb47a3d5c84320222f66d7db21157c4a7407755de41798f9b4c1c40593397b1a" -"checksum shell-escape 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "170a13e64f2a51b77a45702ba77287f5c6829375b04a69cf2222acd17d0cfab9" -"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" -"checksum simd 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0048b17eb9577ac545c61d85c3559b41dfb4cbea41c9bd9ca6a4f73ff05fda84" -"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537" -"checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d" -"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" -"checksum stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbc596e092fe5f598b12ef46cc03754085ac2f4d8c739ad61c4ae266cc3b3fa" -"checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" -"checksum string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "35293b05cf1494e8ddd042a7df6756bf18d07f42d234f32e71dce8a7aabb0191" -"checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" -"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" -"checksum strum 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "099e21b5dd6dd07b5adcf8c4b723a7c0b7efd7a9359bf963d58c0caae8532545" -"checksum strum_macros 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1292d85e688e4696ecb69b2db2648994fb8af266974e89be53cefdf003861a5d" -"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b" -"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" -"checksum syn 0.15.21 (registry+https://github.com/rust-lang/crates.io-index)" = "816b7af21405b011a23554ea2dc3f6576dc86ca557047c34098c1d741f10f823" -"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -"checksum synstructure 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "85bb9b7550d063ea184027c9b8c20ac167cd36d3e06b3a40bceb9d746dc1a7b7" -"checksum tar 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)" = "69e16840a1e0a1f1a880b739ef1cc6a4b85496c99b8aa786ccffce6e0c15624c" -"checksum tempfile 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c4b103c6d08d323b92ff42c8ce62abcd83ca8efa7fd5bf7927efefec75f58c76" -"checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508" -"checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" -"checksum termcolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3390f44f1f706d8870297b6a2c4f92d9ab65a37c265fbbc6ac4ee72bcc2f3698" -"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" -"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" -"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" -"checksum toml 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a0263c6c02c4db6c8f7681f9fd35e90de799ebd4cfdeab77a38f4ff6b3d8c0d9" -"checksum toml-query 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6854664bfc6df0360c695480836ee90e2d0c965f06db291d10be9344792d43e8" -"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" -"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" -"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a321979c09843d272956e73700d12c4e7d3d92b2ee112b31548aef0d4efc5a6" -"checksum url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74e7d099f1ee52f823d4bdd60c93c3602043c728f5db3b97bdb548467f7bddea" -"checksum utf-8 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1262dfab4c30d5cb7c07026be00ee343a6cf5027fdc0104a9160f354e5db75c" -"checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4" -"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" -"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum vergen 3.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1b9696d96ec5d68984d060af80d7ba0ed4eb533978a0efb05ed4b8465f20d04f" -"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum wait-timeout 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b9f3bf741a801531993db6478b95682117471f76916f5e690dd8d45395b09349" -"checksum walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "af464bc7be7b785c7ac72e266a6b67c4c9070155606f51655a650a6686204e35" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" -"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" -"checksum xz2 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "df8bf41d3030c3577c9458fd6640a05afbf43b150d0b531b16bd77d3f794f27a" -"checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992" diff --git a/src/Cargo.toml b/src/Cargo.toml deleted file mode 100644 index e8c44ea57c2..00000000000 --- a/src/Cargo.toml +++ /dev/null @@ -1,67 +0,0 @@ -[workspace] -members = [ - "bootstrap", - "rustc", - "libstd", - "libtest", - "librustc_codegen_llvm", - "tools/cargotest", - "tools/clippy", - "tools/compiletest", - "tools/error_index_generator", - "tools/linkchecker", - "tools/rustbook", - "tools/unstable-book-gen", - "tools/tidy", - "tools/build-manifest", - "tools/remote-test-client", - "tools/remote-test-server", - "tools/rust-installer", - "tools/cargo", - "tools/rustdoc", - "tools/rls", - "tools/rustfmt", - "tools/miri", - "tools/rustdoc-themes", -] -exclude = [ - "tools/rls/test_data", -] - -# Curiously, LLVM 7.0 will segfault if compiled with opt-level=3 -# See issue https://github.com/rust-lang/rust/issues/52378 -[profile.release] -opt-level = 2 -[profile.bench] -opt-level = 2 - -# These options are controlled from our rustc wrapper script, so turn them off -# here and have them controlled elsewhere. -[profile.dev] -debug = false -debug-assertions = false -[profile.test] -debug = false -debug-assertions = false - -# We want the RLS to use the version of Cargo that we've got vendored in this -# repository to ensure that the same exact version of Cargo is used by both the -# RLS and the Cargo binary itself. The RLS depends on Cargo as a git repository -# so we use a `[patch]` here to override the github repository with our local -# vendored copy. -[patch."https://github.com/rust-lang/cargo"] -cargo = { path = "tools/cargo" } - -[patch.crates-io] -# Similar to Cargo above we want the RLS to use a vendored version of `rustfmt` -# that we're shipping as well (to ensure that the rustfmt in RLS and the -# `rustfmt` executable are the same exact version). -rustfmt-nightly = { path = "tools/rustfmt" } - -# See comments in `tools/rustc-workspace-hack/README.md` for what's going on -# here -rustc-workspace-hack = { path = 'tools/rustc-workspace-hack' } - -[patch."https://github.com/rust-lang-nursery/rust-clippy"] -clippy_lints = { path = "tools/clippy/clippy_lints" } -rustc_tools_util = { path = "tools/clippy/rustc_tools_util" } diff --git a/src/README.md b/src/README.md index a4f89960a0b..14e773286bc 100644 --- a/src/README.md +++ b/src/README.md @@ -8,8 +8,7 @@ For more information on how various parts of the compiler work, see the [rustc g There is also useful content in the following READMEs, which are gradually being moved over to the guide: - https://github.com/rust-lang/rust/tree/master/src/librustc/ty/query - https://github.com/rust-lang/rust/tree/master/src/librustc/dep_graph -- https://github.com/rust-lang/rust/blob/master/src/librustc/infer/region_constraints - https://github.com/rust-lang/rust/tree/master/src/librustc/infer/higher_ranked - https://github.com/rust-lang/rust/tree/master/src/librustc/infer/lexical_region_resolve -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/about-this-guide.html +[rustc guide]: https://rust-lang.github.io/rustc-guide/about-this-guide.html diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index 3e91c2b3e86..0f7b6c22e1c 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -2,6 +2,7 @@ authors = ["The Rust Project Developers"] name = "bootstrap" version = "0.0.0" +edition = "2018" [lib] name = "bootstrap" diff --git a/src/bootstrap/bin/llvm-config-wrapper.rs b/src/bootstrap/bin/llvm-config-wrapper.rs index b1703f8c728..5e3625eb22e 100644 --- a/src/bootstrap/bin/llvm-config-wrapper.rs +++ b/src/bootstrap/bin/llvm-config-wrapper.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The sheer existence of this file is an awful hack. See the comments in // `src/bootstrap/native.rs` for why this is needed when compiling LLD. diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs index d02bc7972ae..8ddce5c247d 100644 --- a/src/bootstrap/bin/main.rs +++ b/src/bootstrap/bin/main.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! rustbuild, the Rust build system //! //! This is the entry point for the build system used to compile the `rustc` diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index afe1b4c42ea..7a765973e20 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Shim which is passed to Cargo as "rustc" when running the bootstrap. //! //! This shim will take care of some various tasks that our build process @@ -129,10 +119,12 @@ fn main() { // Help the libc crate compile by assisting it in finding the MUSL // native libraries. if let Some(s) = env::var_os("MUSL_ROOT") { - let mut root = OsString::from("native="); - root.push(&s); - root.push("/lib"); - cmd.arg("-L").arg(&root); + if target.contains("musl") { + let mut root = OsString::from("native="); + root.push(&s); + root.push("/lib"); + cmd.arg("-L").arg(&root); + } } // Override linker if necessary. @@ -292,8 +284,8 @@ fn main() { } } - if env::var_os("RUSTC_PARALLEL_QUERIES").is_some() { - cmd.arg("--cfg").arg("parallel_queries"); + if env::var_os("RUSTC_PARALLEL_COMPILER").is_some() { + cmd.arg("--cfg").arg("parallel_compiler"); } if env::var_os("RUSTC_DENY_WARNINGS").is_some() && env::var_os("RUSTC_EXTERNAL_TOOL").is_none() diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index bb5a21e3e40..dec74e60c71 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Shim which is passed to Cargo as "rustdoc" when running the bootstrap. //! //! See comments in `src/bootstrap/rustc.rs` for more information. diff --git a/src/bootstrap/bin/sccache-plus-cl.rs b/src/bootstrap/bin/sccache-plus-cl.rs index 0a20ac7e492..f9e14d1ff6d 100644 --- a/src/bootstrap/bin/sccache-plus-cl.rs +++ b/src/bootstrap/bin/sccache-plus-cl.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate cc; use std::env; diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index cd48e6aa4c4..119b38bcc99 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -1,13 +1,3 @@ -# Copyright 2015-2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - from __future__ import absolute_import, division, print_function import argparse import contextlib @@ -240,6 +230,9 @@ def default_build_triple(): err = "unknown OS type: {}".format(ostype) sys.exit(err) + if cputype == 'powerpc' and ostype == 'unknown-freebsd': + cputype = subprocess.check_output( + ['uname', '-p']).strip().decode(default_encoding) cputype_mapper = { 'BePC': 'i686', 'aarch64': 'aarch64', @@ -681,7 +674,7 @@ def update_submodule(self, module, checked_out, recorded_submodules): run(["git", "submodule", "-q", "sync", module], cwd=self.rust_root, verbose=self.verbose) run(["git", "submodule", "update", - "--init", "--recursive", module], + "--init", "--recursive", "--progress", module], cwd=self.rust_root, verbose=self.verbose) run(["git", "reset", "-q", "--hard"], cwd=module_path, verbose=self.verbose) @@ -708,21 +701,13 @@ def update_submodules(self): filtered_submodules = [] submodules_names = [] for module in submodules: - if module.endswith("llvm"): - if self.get_toml('llvm-config'): + if module.endswith("llvm-project"): + if self.get_toml('llvm-config') and self.get_toml('lld') != 'true': continue if module.endswith("llvm-emscripten"): backends = self.get_toml('codegen-backends') if backends is None or not 'emscripten' in backends: continue - if module.endswith("lld"): - config = self.get_toml('lld') - if config is None or config == 'false': - continue - if module.endswith("lldb") or module.endswith("clang"): - config = self.get_toml('lldb') - if config is None or config == 'false': - continue check = self.check_submodule(module, slow_submodules) filtered_submodules.append((module, check)) submodules_names.append(module) @@ -801,7 +786,7 @@ def bootstrap(help_triggered): registry = 'https://example.com' [source.vendored-sources] - directory = '{}/src/vendor' + directory = '{}/vendor' """.format(build.rust_root)) else: if os.path.exists('.cargo'): diff --git a/src/bootstrap/bootstrap_test.py b/src/bootstrap/bootstrap_test.py index 4db7e2ec016..689298f32d0 100644 --- a/src/bootstrap/bootstrap_test.py +++ b/src/bootstrap/bootstrap_test.py @@ -1,13 +1,3 @@ -# Copyright 2015-2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - """Bootstrap tests""" from __future__ import absolute_import, division, print_function diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 900f336ef8c..716774632a0 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::any::Any; use std::cell::{Cell, RefCell}; use std::collections::BTreeSet; @@ -21,20 +11,20 @@ use std::path::{Path, PathBuf}; use std::process::Command; use std::time::{Duration, Instant}; -use cache::{Cache, Interned, INTERNER}; -use check; -use compile; -use dist; -use doc; -use flags::Subcommand; -use install; -use native; -use test; -use tool; -use util::{add_lib_path, exe, libdir}; -use {Build, DocTests, Mode, GitRepo}; - -pub use Compiler; +use crate::cache::{Cache, Interned, INTERNER}; +use crate::check; +use crate::compile; +use crate::dist; +use crate::doc; +use crate::flags::Subcommand; +use crate::install; +use crate::native; +use crate::test; +use crate::tool; +use crate::util::{self, add_lib_path, exe, libdir}; +use crate::{Build, DocTests, Mode, GitRepo}; + +pub use crate::Compiler; use petgraph::graph::NodeIndex; use petgraph::Graph; @@ -388,16 +378,11 @@ impl<'a> Builder<'a> { test::Debuginfo, test::UiFullDeps, test::RunPassFullDeps, - test::RunFailFullDeps, - test::CompileFailFullDeps, - test::IncrementalFullDeps, test::Rustdoc, test::Pretty, test::RunPassPretty, test::RunFailPretty, test::RunPassValgrindPretty, - test::RunPassFullDepsPretty, - test::RunFailFullDepsPretty, test::Crate, test::CrateLibrustc, test::CrateRustdoc, @@ -418,6 +403,7 @@ impl<'a> Builder<'a> { test::Rustfmt, test::Miri, test::Clippy, + test::CompiletestTest, test::RustdocJS, test::RustdocTheme, // Run bootstrap close to the end as it's unlikely to fail @@ -443,7 +429,8 @@ impl<'a> Builder<'a> { doc::RustdocBook, doc::RustByExample, doc::RustcBook, - doc::CargoBook + doc::CargoBook, + doc::EditionGuide, ), Kind::Dist => describe!( dist::Docs, @@ -459,6 +446,7 @@ impl<'a> Builder<'a> { dist::Rls, dist::Rustfmt, dist::Clippy, + dist::Miri, dist::LlvmTools, dist::Lldb, dist::Extended, @@ -471,6 +459,7 @@ impl<'a> Builder<'a> { install::Rls, install::Rustfmt, install::Clippy, + install::Miri, install::Analysis, install::Src, install::Rustc @@ -668,6 +657,15 @@ impl<'a> Builder<'a> { } } + /// Get the paths to all of the compiler's codegen backends. + fn codegen_backends(&self, compiler: Compiler) -> impl Iterator { + fs::read_dir(self.sysroot_codegen_backends(compiler)) + .into_iter() + .flatten() + .filter_map(Result::ok) + .map(|entry| entry.path()) + } + pub fn rustdoc(&self, host: Interned) -> PathBuf { self.ensure(tool::Rustdoc { host }) } @@ -685,6 +683,11 @@ impl<'a> Builder<'a> { .env("RUSTDOC_REAL", self.rustdoc(host)) .env("RUSTDOC_CRATE_VERSION", self.rust_version()) .env("RUSTC_BOOTSTRAP", "1"); + + // Remove make-related flags that can cause jobserver problems. + cmd.env_remove("MAKEFLAGS"); + cmd.env_remove("MFLAGS"); + if let Some(linker) = self.linker(host) { cmd.env("RUSTC_TARGET_LINKER", linker); } @@ -753,6 +756,9 @@ impl<'a> Builder<'a> { match mode { Mode::Std => { self.clear_if_dirty(&my_out, &self.rustc(compiler)); + for backend in self.codegen_backends(compiler) { + self.clear_if_dirty(&my_out, &backend); + } }, Mode::Test => { self.clear_if_dirty(&my_out, &libstd_stamp); @@ -785,6 +791,13 @@ impl<'a> Builder<'a> { .env("CARGO_TARGET_DIR", out_dir) .arg(cmd); + // See comment in librustc_llvm/build.rs for why this is necessary, largely llvm-config + // needs to not accidentally link to libLLVM in stage0/lib. + cargo.env("REAL_LIBRARY_PATH_VAR", &util::dylib_path_var()); + if let Some(e) = env::var_os(util::dylib_path_var()) { + cargo.env("REAL_LIBRARY_PATH", e); + } + if cmd != "install" { cargo.arg("--target") .arg(target); @@ -793,7 +806,7 @@ impl<'a> Builder<'a> { } // Set a flag for `check` so that certain build scripts can do less work - // (e.g. not building/requiring LLVM). + // (e.g., not building/requiring LLVM). if cmd == "check" { cargo.env("RUST_CHECK", "1"); } @@ -923,12 +936,12 @@ impl<'a> Builder<'a> { cargo.env("RUSTC_FORCE_UNSTABLE", "1"); // Currently the compiler depends on crates from crates.io, and - // then other crates can depend on the compiler (e.g. proc-macro + // then other crates can depend on the compiler (e.g., proc-macro // crates). Let's say, for example that rustc itself depends on the // bitflags crate. If an external crate then depends on the // bitflags crate as well, we need to make sure they don't // conflict, even if they pick the same version of bitflags. We'll - // want to make sure that e.g. a plugin and rustc each get their + // want to make sure that e.g., a plugin and rustc each get their // own copy of bitflags. // Cargo ensures that this works in general through the -C metadata @@ -985,6 +998,9 @@ impl<'a> Builder<'a> { if self.config.incremental { cargo.env("CARGO_INCREMENTAL", "1"); + } else { + // Don't rely on any default setting for incr. comp. in Cargo + cargo.env("CARGO_INCREMENTAL", "0"); } if let Some(ref on_fail) = self.config.on_fail { @@ -1035,29 +1051,24 @@ impl<'a> Builder<'a> { } }; let cc = ccacheify(&self.cc(target)); - cargo.env(format!("CC_{}", target), &cc).env("CC", &cc); + cargo.env(format!("CC_{}", target), &cc); let cflags = self.cflags(target, GitRepo::Rustc).join(" "); cargo - .env(format!("CFLAGS_{}", target), cflags.clone()) - .env("CFLAGS", cflags.clone()); + .env(format!("CFLAGS_{}", target), cflags.clone()); if let Some(ar) = self.ar(target) { let ranlib = format!("{} s", ar.display()); cargo .env(format!("AR_{}", target), ar) - .env("AR", ar) - .env(format!("RANLIB_{}", target), ranlib.clone()) - .env("RANLIB", ranlib); + .env(format!("RANLIB_{}", target), ranlib); } if let Ok(cxx) = self.cxx(target) { let cxx = ccacheify(&cxx); cargo .env(format!("CXX_{}", target), &cxx) - .env("CXX", &cxx) - .env(format!("CXXFLAGS_{}", target), cflags.clone()) - .env("CXXFLAGS", cflags); + .env(format!("CXXFLAGS_{}", target), cflags); } } @@ -1247,7 +1258,7 @@ impl<'a> Builder<'a> { #[cfg(test)] mod __test { use super::*; - use config::Config; + use crate::config::Config; use std::thread; fn configure(host: &[&str], target: &[&str]) -> Config { diff --git a/src/bootstrap/cache.rs b/src/bootstrap/cache.rs index 0b561a3523f..ea8bc657a57 100644 --- a/src/bootstrap/cache.rs +++ b/src/bootstrap/cache.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::any::{Any, TypeId}; use std::borrow::Borrow; use std::cell::RefCell; @@ -23,7 +13,7 @@ use std::path::{Path, PathBuf}; use std::sync::Mutex; use std::cmp::{PartialOrd, Ord, Ordering}; -use builder::Step; +use crate::builder::Step; pub struct Interned(usize, PhantomData<*const T>); diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs index d5da0cabec8..37844759c7b 100644 --- a/src/bootstrap/cc_detect.rs +++ b/src/bootstrap/cc_detect.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! C-compiler probing and detection. //! //! This module will fill out the `cc` and `cxx` maps of `Build` by looking for @@ -39,9 +29,9 @@ use std::process::Command; use build_helper::output; use cc; -use {Build, GitRepo}; -use config::Target; -use cache::Interned; +use crate::{Build, GitRepo}; +use crate::config::Target; +use crate::cache::Interned; // The `cc` crate doesn't provide a way to obtain a path to the detected archiver, // so use some simplified logic here. First we respect the environment variable `AR`, then @@ -143,7 +133,10 @@ fn set_compiler(cfg: &mut cc::Build, // compiler already takes into account the triple in question. t if t.contains("android") => { if let Some(ndk) = config.and_then(|c| c.ndk.as_ref()) { - let target = target.replace("armv7", "arm"); + let target = target.replace("armv7neon", "arm") + .replace("armv7", "arm") + .replace("thumbv7neon", "arm") + .replace("thumbv7", "arm"); let compiler = format!("{}-{}", target, compiler.clang()); cfg.compiler(ndk.join("bin").join(compiler)); } diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs index 88b6925b2b1..0b2f62485c9 100644 --- a/src/bootstrap/channel.rs +++ b/src/bootstrap/channel.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Build configuration for Rust's release channels. //! //! Implements the stable/beta/nightly channel distinctions by setting various @@ -20,11 +10,11 @@ use std::process::Command; use build_helper::output; -use Build; -use config::Config; +use crate::Build; +use crate::config::Config; // The version number -pub const CFG_RELEASE_NUM: &str = "1.32.0"; +pub const CFG_RELEASE_NUM: &str = "1.34.0"; pub struct GitInfo { inner: Option, diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 0c6dbb06bb8..cc539d4c895 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -1,20 +1,11 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of compiling the compiler and standard library, in "check" mode. -use compile::{run_cargo, std_cargo, test_cargo, rustc_cargo, rustc_cargo_env, add_to_sysroot}; -use builder::{RunConfig, Builder, ShouldRun, Step}; -use tool::{prepare_tool_cargo, SourceType}; -use {Compiler, Mode}; -use cache::{INTERNER, Interned}; +use crate::compile::{run_cargo, std_cargo, test_cargo, rustc_cargo, rustc_cargo_env, + add_to_sysroot}; +use crate::builder::{RunConfig, Builder, ShouldRun, Step}; +use crate::tool::{prepare_tool_cargo, SourceType}; +use crate::{Compiler, Mode}; +use crate::cache::{INTERNER, Interned}; use std::path::PathBuf; #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -47,7 +38,6 @@ impl Step for Std { builder.info(&format!("Checking std artifacts ({} -> {})", &compiler.host, target)); run_cargo(builder, &mut cargo, - vec![], &libstd_stamp(builder, compiler, target), true); @@ -94,7 +84,6 @@ impl Step for Rustc { builder.info(&format!("Checking compiler artifacts ({} -> {})", &compiler.host, target)); run_cargo(builder, &mut cargo, - vec![], &librustc_stamp(builder, compiler, target), true); @@ -145,7 +134,6 @@ impl Step for CodegenBackend { let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage)); run_cargo(builder, &mut cargo, - vec![], &codegen_backend_stamp(builder, compiler, target, backend), true); } @@ -183,7 +171,6 @@ impl Step for Test { builder.info(&format!("Checking test artifacts ({} -> {})", &compiler.host, target)); run_cargo(builder, &mut cargo, - vec![], &libtest_stamp(builder, compiler, target), true); @@ -231,7 +218,6 @@ impl Step for Rustdoc { println!("Checking rustdoc artifacts ({} -> {})", &compiler.host, target); run_cargo(builder, &mut cargo, - vec![], &rustdoc_stamp(builder, compiler, target), true); diff --git a/src/bootstrap/clean.rs b/src/bootstrap/clean.rs index 87f194fb7d2..74a2b7e4aa9 100644 --- a/src/bootstrap/clean.rs +++ b/src/bootstrap/clean.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of `make clean` in rustbuild. //! //! Responsible for cleaning out a build directory of all old and stale @@ -19,7 +9,7 @@ use std::fs; use std::io::{self, ErrorKind}; use std::path::Path; -use Build; +use crate::Build; pub fn clean(build: &Build, all: bool) { rm_rf("tmp".as_ref()); diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index b6bb11d07ef..ddae3cb0d60 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of compiling various phases of the compiler and standard //! library. //! @@ -18,7 +8,7 @@ use std::borrow::Cow; use std::env; -use std::fs::{self, File}; +use std::fs; use std::io::BufReader; use std::io::prelude::*; use std::path::{Path, PathBuf}; @@ -29,12 +19,13 @@ use build_helper::{output, mtime, up_to_date}; use filetime::FileTime; use serde_json; -use util::{exe, libdir, is_dylib}; -use {Compiler, Mode, GitRepo}; -use native; +use crate::dist; +use crate::util::{exe, libdir, is_dylib}; +use crate::{Compiler, Mode, GitRepo}; +use crate::native; -use cache::{INTERNER, Interned}; -use builder::{Step, RunConfig, ShouldRun, Builder}; +use crate::cache::{INTERNER, Interned}; +use crate::builder::{Step, RunConfig, ShouldRun, Builder}; #[derive(Debug, PartialOrd, Ord, Copy, Clone, PartialEq, Eq, Hash)] pub struct Std { @@ -87,11 +78,8 @@ impl Step for Std { builder.info(&format!("Uplifting stage1 std ({} -> {})", from.host, target)); // Even if we're not building std this stage, the new sysroot must - // still contain the musl startup objects. - if target.contains("musl") { - let libdir = builder.sysroot_libdir(compiler, target); - copy_musl_third_party_objects(builder, target, &libdir); - } + // still contain the third party objects needed by various targets. + copy_third_party_objects(builder, &compiler, target); builder.ensure(StdLink { compiler: from, @@ -101,10 +89,7 @@ impl Step for Std { return; } - if target.contains("musl") { - let libdir = builder.sysroot_libdir(compiler, target); - copy_musl_third_party_objects(builder, target, &libdir); - } + copy_third_party_objects(builder, &compiler, target); let mut cargo = builder.cargo(compiler, Mode::Std, target, "build"); std_cargo(builder, &compiler, target, &mut cargo); @@ -114,7 +99,6 @@ impl Step for Std { &compiler.host, target)); run_cargo(builder, &mut cargo, - vec![], &libstd_stamp(builder, compiler, target), false); @@ -126,17 +110,36 @@ impl Step for Std { } } -/// Copies the crt(1,i,n).o startup objects -/// -/// Since musl supports fully static linking, we can cross link for it even -/// with a glibc-targeting toolchain, given we have the appropriate startup -/// files. As those shipped with glibc won't work, copy the ones provided by -/// musl so we have them on linux-gnu hosts. -fn copy_musl_third_party_objects(builder: &Builder, - target: Interned, - into: &Path) { - for &obj in &["crt1.o", "crti.o", "crtn.o"] { - builder.copy(&builder.musl_root(target).unwrap().join("lib").join(obj), &into.join(obj)); +/// Copies third pary objects needed by various targets. +fn copy_third_party_objects(builder: &Builder, compiler: &Compiler, target: Interned) { + let libdir = builder.sysroot_libdir(*compiler, target); + + // Copies the crt(1,i,n).o startup objects + // + // Since musl supports fully static linking, we can cross link for it even + // with a glibc-targeting toolchain, given we have the appropriate startup + // files. As those shipped with glibc won't work, copy the ones provided by + // musl so we have them on linux-gnu hosts. + if target.contains("musl") { + for &obj in &["crt1.o", "crti.o", "crtn.o"] { + builder.copy( + &builder.musl_root(target).unwrap().join("lib").join(obj), + &libdir.join(obj), + ); + } + } + + // Copies libunwind.a compiled to be linked wit x86_64-fortanix-unknown-sgx. + // + // This target needs to be linked to Fortanix's port of llvm's libunwind. + // libunwind requires support for rwlock and printing to stderr, + // which is provided by std for this target. + if target == "x86_64-fortanix-unknown-sgx" { + let src_path_env = "X86_FORTANIX_SGX_LIBS"; + let obj = "libunwind.a"; + let src = env::var(src_path_env).expect(&format!("{} not found in env", src_path_env)); + let src = Path::new(&src).join(obj); + builder.copy(&src, &libdir.join(obj)); } } @@ -152,11 +155,12 @@ pub fn std_cargo(builder: &Builder, if builder.no_std(target) == Some(true) { // for no-std targets we only compile a few no_std crates - cargo.arg("--features").arg("c mem") + cargo .args(&["-p", "alloc"]) - .args(&["-p", "compiler_builtins"]) .arg("--manifest-path") - .arg(builder.src.join("src/rustc/compiler_builtins_shim/Cargo.toml")); + .arg(builder.src.join("src/liballoc/Cargo.toml")) + .arg("--features") + .arg("compiler-builtins-mem"); } else { let features = builder.std_features(); @@ -374,7 +378,6 @@ impl Step for Test { &compiler.host, target)); run_cargo(builder, &mut cargo, - vec![], &libtest_stamp(builder, compiler, target), false); @@ -502,7 +505,6 @@ impl Step for Rustc { compiler.stage, &compiler.host, target)); run_cargo(builder, &mut cargo, - vec![], &librustc_stamp(builder, compiler, target), false); @@ -552,8 +554,8 @@ pub fn rustc_cargo_env(builder: &Builder, cargo: &mut Command) { if let Some(ref s) = builder.config.rustc_default_linker { cargo.env("CFG_DEFAULT_LINKER", s); } - if builder.config.rustc_parallel_queries { - cargo.env("RUSTC_PARALLEL_QUERIES", "1"); + if builder.config.rustc_parallel { + cargo.env("RUSTC_PARALLEL_COMPILER", "1"); } if builder.config.rust_verify_llvm_ir { cargo.env("RUSTC_VERIFY_LLVM_IR", "1"); @@ -645,47 +647,18 @@ impl Step for CodegenBackend { let out_dir = builder.cargo_out(compiler, Mode::Codegen, target); - let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "rustc"); + let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "build"); cargo.arg("--manifest-path") .arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml")); rustc_cargo_env(builder, &mut cargo); let features = build_codegen_backend(&builder, &mut cargo, &compiler, target, backend); - let mut cargo_tails_args = vec![]; - - if builder.config.llvm_thin_lto { - cargo_tails_args.push("--".to_string()); - - let num_jobs = builder.jobs(); - - if !target.contains("msvc") { - // Here we assume that the linker is clang. If it's not, there'll - // be linker errors. - cargo_tails_args.push("-Clink-arg=-fuse-ld=lld".to_string()); - cargo_tails_args.push("-Clink-arg=-flto=thin".to_string()); - - if builder.config.llvm_optimize { - cargo_tails_args.push("-Clink-arg=-O2".to_string()); - } - - // Let's make LLD respect the `-j` option. - let num_jobs_arg = format!("-Clink-arg=-Wl,--thinlto-jobs={}", num_jobs); - cargo_tails_args.push(num_jobs_arg); - } else { - // Here we assume that the linker is lld-link.exe. lld-link.exe - // does not need the extra arguments except for num_jobs - let num_jobs_arg = format!("-Clink-arg=/opt:lldltojobs={}", num_jobs); - cargo_tails_args.push(num_jobs_arg); - } - } - let tmp_stamp = out_dir.join(".tmp.stamp"); let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage)); let files = run_cargo(builder, cargo.arg("--features").arg(features), - cargo_tails_args, &tmp_stamp, false); if builder.config.dry_run { @@ -707,7 +680,7 @@ impl Step for CodegenBackend { } let stamp = codegen_backend_stamp(builder, compiler, target, backend); let codegen_backend = codegen_backend.to_str().unwrap(); - t!(t!(File::create(&stamp)).write_all(codegen_backend.as_bytes())); + t!(fs::write(&stamp, &codegen_backend)); } } @@ -739,6 +712,7 @@ pub fn build_codegen_backend(builder: &Builder, if builder.is_rust_llvm(target) && backend != "emscripten" { cargo.env("LLVM_RUSTLLVM", "1"); } + cargo.env("LLVM_CONFIG", &llvm_config); if backend != "emscripten" { let target_config = builder.config.target_config.get(&target); @@ -758,9 +732,14 @@ pub fn build_codegen_backend(builder: &Builder, "libstdc++.a"); cargo.env("LLVM_STATIC_STDCPP", file); } - if builder.config.llvm_link_shared { + if builder.config.llvm_link_shared || + (builder.config.llvm_thin_lto && backend != "emscripten") + { cargo.env("LLVM_LINK_SHARED", "1"); } + if builder.config.llvm_use_libcxx { + cargo.env("LLVM_USE_LIBCXX", "1"); + } } _ => panic!("unknown backend: {}", backend), } @@ -796,8 +775,7 @@ fn copy_codegen_backends_to_sysroot(builder: &Builder, for backend in builder.config.rust_codegen_backends.iter() { let stamp = codegen_backend_stamp(builder, compiler, target, *backend); - let mut dylib = String::new(); - t!(t!(File::open(&stamp)).read_to_string(&mut dylib)); + let dylib = t!(fs::read_to_string(&stamp)); let file = Path::new(&dylib); let filename = file.file_name().unwrap().to_str().unwrap(); // change `librustc_codegen_llvm-xxxxxx.so` to `librustc_codegen_llvm-llvm.so` @@ -999,6 +977,8 @@ impl Step for Assemble { copy_lld_to_sysroot(builder, target_compiler, &lld_install); } + dist::maybe_install_llvm_dylib(builder, target_compiler.host, &sysroot); + // Link the compiler binary itself into place let out_dir = builder.cargo_out(build_compiler, Mode::Rustc, host); let rustc = out_dir.join(exe("rustc_binary", &*host)); @@ -1025,7 +1005,6 @@ pub fn add_to_sysroot(builder: &Builder, sysroot_dst: &Path, stamp: &Path) { pub fn run_cargo(builder: &Builder, cargo: &mut Command, - tail_args: Vec, stamp: &Path, is_check: bool) -> Vec @@ -1048,7 +1027,7 @@ pub fn run_cargo(builder: &Builder, // files we need to probe for later. let mut deps = Vec::new(); let mut toplevel = Vec::new(); - let ok = stream_cargo(builder, cargo, tail_args, &mut |msg| { + let ok = stream_cargo(builder, cargo, &mut |msg| { let filenames = match msg { CargoMessage::CompilerArtifact { filenames, .. } => filenames, _ => return, @@ -1137,10 +1116,7 @@ pub fn run_cargo(builder: &Builder, // contents (the list of files to copy) is different or if any dep's mtime // is newer then we rewrite the stamp file. deps.sort(); - let mut stamp_contents = Vec::new(); - if let Ok(mut f) = File::open(stamp) { - t!(f.read_to_end(&mut stamp_contents)); - } + let stamp_contents = fs::read(stamp); let stamp_mtime = mtime(&stamp); let mut new_contents = Vec::new(); let mut max = None; @@ -1156,7 +1132,10 @@ pub fn run_cargo(builder: &Builder, } let max = max.unwrap(); let max_path = max_path.unwrap(); - if stamp_contents == new_contents && max <= stamp_mtime { + let contents_equal = stamp_contents + .map(|contents| contents == new_contents) + .unwrap_or_default(); + if contents_equal && max <= stamp_mtime { builder.verbose(&format!("not updating {:?}; contents equal and {:?} <= {:?}", stamp, max, stamp_mtime)); return deps @@ -1166,14 +1145,13 @@ pub fn run_cargo(builder: &Builder, } else { builder.verbose(&format!("updating {:?} as deps changed", stamp)); } - t!(t!(File::create(stamp)).write_all(&new_contents)); + t!(fs::write(&stamp, &new_contents)); deps } pub fn stream_cargo( builder: &Builder, cargo: &mut Command, - tail_args: Vec, cb: &mut dyn FnMut(CargoMessage), ) -> bool { if builder.config.dry_run { @@ -1184,10 +1162,6 @@ pub fn stream_cargo( cargo.arg("--message-format").arg("json") .stdout(Stdio::piped()); - for arg in tail_args { - cargo.arg(arg); - } - builder.verbose(&format!("running: {:?}", cargo)); let mut child = match cargo.spawn() { Ok(child) => child, diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 0f249eee000..7d3e584f1a6 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Serialized configuration of a build. //! //! This module implements parsing `config.toml` configuration files to tweak @@ -15,17 +5,16 @@ use std::collections::{HashMap, HashSet}; use std::env; -use std::fs::{self, File}; -use std::io::prelude::*; +use std::fs; use std::path::{Path, PathBuf}; use std::process; use std::cmp; use num_cpus; use toml; -use cache::{INTERNER, Interned}; -use flags::Flags; -pub use flags::Subcommand; +use crate::cache::{INTERNER, Interned}; +use crate::flags::Flags; +pub use crate::flags::Subcommand; /// Global configuration for the entire build and/or bootstrap. /// @@ -58,6 +47,7 @@ pub struct Config { pub ignore_git: bool, pub exclude: Vec, pub rustc_error_format: Option, + pub test_compare_mode: bool, pub run_host_only: bool, @@ -87,11 +77,17 @@ pub struct Config { pub llvm_experimental_targets: String, pub llvm_link_jobs: Option, pub llvm_version_suffix: Option, + pub llvm_use_linker: Option, pub lld_enabled: bool, pub lldb_enabled: bool, pub llvm_tools_enabled: bool, + pub llvm_cflags: Option, + pub llvm_cxxflags: Option, + pub llvm_ldflags: Option, + pub llvm_use_libcxx: bool, + // rust codegen options pub rust_optimize: bool, pub rust_codegen_units: Option, @@ -102,7 +98,7 @@ pub struct Config { pub rust_debuginfo_only_std: bool, pub rust_debuginfo_tools: bool, pub rust_rpath: bool, - pub rustc_parallel_queries: bool, + pub rustc_parallel: bool, pub rustc_default_linker: Option, pub rust_optimize_tests: bool, pub rust_debuginfo_tests: bool, @@ -262,6 +258,11 @@ struct Llvm { link_shared: Option, version_suffix: Option, clang_cl: Option, + cflags: Option, + cxxflags: Option, + ldflags: Option, + use_libcxx: Option, + use_linker: Option, } #[derive(Deserialize, Default, Clone)] @@ -299,7 +300,7 @@ struct Rust { debuginfo_lines: Option, debuginfo_only_std: Option, debuginfo_tools: Option, - experimental_parallel_queries: Option, + parallel_compiler: Option, backtrace: Option, default_linker: Option, channel: Option, @@ -326,6 +327,7 @@ struct Rust { verify_llvm_ir: Option, remap_debuginfo: Option, jemalloc: Option, + test_compare_mode: Option, } /// TOML representation of how each build target is configured. @@ -414,9 +416,7 @@ impl Config { config.run_host_only = !(flags.host.is_empty() && !flags.target.is_empty()); let toml = file.map(|file| { - let mut f = t!(File::open(&file)); - let mut contents = String::new(); - t!(f.read_to_string(&mut contents)); + let contents = t!(fs::read_to_string(&file)); match toml::from_str(&contents) { Ok(table) => table, Err(err) => { @@ -524,6 +524,12 @@ impl Config { config.llvm_link_jobs = llvm.link_jobs; config.llvm_version_suffix = llvm.version_suffix.clone(); config.llvm_clang_cl = llvm.clang_cl.clone(); + + config.llvm_cflags = llvm.cflags.clone(); + config.llvm_cxxflags = llvm.cxxflags.clone(); + config.llvm_ldflags = llvm.ldflags.clone(); + set(&mut config.llvm_use_libcxx, llvm.use_libcxx); + config.llvm_use_linker = llvm.use_linker.clone(); } if let Some(ref rust) = toml.rust { @@ -540,6 +546,7 @@ impl Config { set(&mut config.codegen_tests, rust.codegen_tests); set(&mut config.rust_rpath, rust.rpath); set(&mut config.jemalloc, rust.jemalloc); + set(&mut config.test_compare_mode, rust.test_compare_mode); set(&mut config.backtrace, rust.backtrace); set(&mut config.channel, rust.channel.clone()); set(&mut config.rust_dist_src, rust.dist_src); @@ -553,7 +560,7 @@ impl Config { set(&mut config.lld_enabled, rust.lld); set(&mut config.lldb_enabled, rust.lldb); set(&mut config.llvm_tools_enabled, rust.llvm_tools); - config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false); + config.rustc_parallel = rust.parallel_compiler.unwrap_or(false); config.rustc_default_linker = rust.default_linker.clone(); config.musl_root = rust.musl_root.clone().map(PathBuf::from); config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from); diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 5467c9f9d5b..b2d8f2d8ebf 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -1,13 +1,4 @@ #!/usr/bin/env python -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. # ignore-tidy-linelength @@ -44,7 +35,7 @@ def v(*args): o("docs", "build.docs", "build standard library documentation") o("compiler-docs", "build.compiler-docs", "build compiler documentation") o("optimize-tests", "rust.optimize-tests", "build tests with optimizations") -o("experimental-parallel-queries", "rust.experimental-parallel-queries", "build rustc with experimental parallelization") +o("parallel-compiler", "rust.parallel-compiler", "build a multi-threaded rustc") o("test-miri", "rust.test-miri", "run miri's test suite") o("debuginfo-tests", "rust.debuginfo-tests", "build tests with debugger metadata") o("verbose-tests", "rust.verbose-tests", "enable verbose output when running tests") @@ -71,6 +62,11 @@ def v(*args): o("lld", "rust.lld", "build lld") o("lldb", "rust.lldb", "build lldb") o("missing-tools", "dist.missing-tools", "allow failures when building tools") +o("use-libcxx", "llvm.use_libcxx", "build LLVM with libc++") + +o("cflags", "llvm.cflags", "build LLVM with these extra compiler flags") +o("cxxflags", "llvm.cxxflags", "build LLVM with these extra compiler flags") +o("ldflags", "llvm.ldflags", "build LLVM with these extra linker flags") # Optimization and debugging options. These may be overridden by the release # channel, etc. @@ -107,6 +103,8 @@ def v(*args): "arm-linux-androideabi NDK standalone path") v("armv7-linux-androideabi-ndk", "target.armv7-linux-androideabi.android-ndk", "armv7-linux-androideabi NDK standalone path") +v("thumbv7neon-linux-androideabi-ndk", "target.thumbv7neon-linux-androideabi.android-ndk", + "thumbv7neon-linux-androideabi NDK standalone path") v("aarch64-linux-android-ndk", "target.aarch64-linux-android.android-ndk", "aarch64-linux-android NDK standalone path") v("x86_64-linux-android-ndk", "target.x86_64-linux-android.android-ndk", diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 0aab64465fd..d9bf95d13ac 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of the various distribution aspects of the compiler. //! //! This module is responsible for creating tarballs of the standard library, @@ -19,21 +9,21 @@ //! pieces of `rustup.rs`! use std::env; -use std::fs::{self, File}; -use std::io::{Read, Write}; +use std::fs; +use std::io::Write; use std::path::{PathBuf, Path}; use std::process::{Command, Stdio}; use build_helper::output; -use {Compiler, Mode, LLVM_TOOLS}; -use channel; -use util::{libdir, is_dylib, exe}; -use builder::{Builder, RunConfig, ShouldRun, Step}; -use compile; -use tool::{self, Tool}; -use cache::{INTERNER, Interned}; -use time; +use crate::{Compiler, Mode, LLVM_TOOLS}; +use crate::channel; +use crate::util::{libdir, is_dylib, exe}; +use crate::builder::{Builder, RunConfig, ShouldRun, Step}; +use crate::compile; +use crate::tool::{self, Tool}; +use crate::cache::{INTERNER, Interned}; +use time::{self, Timespec}; pub fn pkgname(builder: &Builder, component: &str) -> String { if component == "cargo" { @@ -42,6 +32,8 @@ pub fn pkgname(builder: &Builder, component: &str) -> String { format!("{}-{}", component, builder.rls_package_vers()) } else if component == "clippy" { format!("{}-{}", component, builder.clippy_package_vers()) + } else if component == "miri" { + format!("{}-{}", component, builder.miri_package_vers()) } else if component == "rustfmt" { format!("{}-{}", component, builder.rustfmt_package_vers()) } else if component == "llvm-tools" { @@ -234,7 +226,7 @@ fn make_win_dist( let trim_chars: &[_] = &[' ', '=']; let value = line[(idx + 1)..] - .trim_left_matches(trim_chars) + .trim_start_matches(trim_chars) .split(';') .map(PathBuf::from); @@ -353,7 +345,7 @@ impl Step for Mingw { /// Build the `rust-mingw` installer component. /// /// This contains all the bits and pieces to run the MinGW Windows targets - /// without any extra installed software (e.g. we bundle gcc, libraries, etc). + /// without any extra installed software (e.g., we bundle gcc, libraries, etc). fn run(self, builder: &Builder) -> Option { let host = self.host; @@ -536,7 +528,19 @@ impl Step for Rustc { t!(fs::create_dir_all(image.join("share/man/man1"))); let man_src = builder.src.join("src/doc/man"); let man_dst = image.join("share/man/man1"); - let month_year = t!(time::strftime("%B %Y", &time::now())); + + // Reproducible builds: If SOURCE_DATE_EPOCH is set, use that as the time. + let time = env::var("SOURCE_DATE_EPOCH") + .map(|timestamp| { + let epoch = timestamp.parse().map_err(|err| { + format!("could not parse SOURCE_DATE_EPOCH: {}", err) + }).unwrap(); + + time::at(Timespec::new(epoch, 0)) + }) + .unwrap_or_else(|_| time::now()); + + let month_year = t!(time::strftime("%B %Y", &time)); // don't use our `bootstrap::util::{copy, cp_r}`, because those try // to hardlink, and we don't want to edit the source templates for file_entry in builder.read_dir(&man_src) { @@ -610,6 +614,8 @@ impl Step for DebuggerScripts { // gdb debugger scripts builder.install(&builder.src.join("src/etc/rust-gdb"), &sysroot.join("bin"), 0o755); + builder.install(&builder.src.join("src/etc/rust-gdbgui"), &sysroot.join("bin"), + 0o755); cp_debugger_script("gdb_load_rust_pretty_printers.py"); cp_debugger_script("gdb_rust_pretty_printing.py"); @@ -681,10 +687,18 @@ impl Step for Std { let mut src = builder.sysroot_libdir(compiler, target).to_path_buf(); src.pop(); // Remove the trailing /lib folder from the sysroot_libdir builder.cp_filtered(&src, &dst, &|path| { - let name = path.file_name().and_then(|s| s.to_str()); - name != Some(builder.config.rust_codegen_backends_dir.as_str()) && - name != Some("bin") - + if let Some(name) = path.file_name().and_then(|s| s.to_str()) { + if name == builder.config.rust_codegen_backends_dir.as_str() { + return false + } + if name == "bin" { + return false + } + if name.contains("LLVM") { + return false + } + } + true }); let mut cmd = rust_installer(builder); @@ -786,7 +800,24 @@ fn copy_src_dirs(builder: &Builder, src_dirs: &[&str], exclude_dirs: &[&str], ds if spath.ends_with("~") || spath.ends_with(".pyc") { return false } - if (spath.contains("llvm/test") || spath.contains("llvm\\test")) && + + const LLVM_PROJECTS: &[&str] = &[ + "llvm-project/clang", "llvm-project\\clang", + "llvm-project/lld", "llvm-project\\lld", + "llvm-project/lldb", "llvm-project\\lldb", + "llvm-project/llvm", "llvm-project\\llvm", + ]; + if spath.contains("llvm-project") && !spath.ends_with("llvm-project") + && !LLVM_PROJECTS.iter().any(|path| spath.contains(path)) + { + return false; + } + + const LLVM_TEST: &[&str] = &[ + "llvm-project/llvm/test", "llvm-project\\llvm\\test", + "llvm-emscripten/test", "llvm-emscripten\\test", + ]; + if LLVM_TEST.iter().any(|path| spath.contains(path)) && (spath.ends_with(".ll") || spath.ends_with(".td") || spath.ends_with(".s")) { @@ -851,18 +882,14 @@ impl Step for Src { t!(fs::create_dir_all(&dst_src)); let src_files = [ - "src/Cargo.lock", + "Cargo.lock", ]; // This is the reduced set of paths which will become the rust-src component // (essentially libstd and all of its path dependencies) let std_src_dirs = [ "src/build_helper", - "src/dlmalloc", "src/liballoc", - "src/libbacktrace", - "src/libcompiler_builtins", "src/libcore", - "src/liblibc", "src/libpanic_abort", "src/libpanic_unwind", "src/librustc_asan", @@ -871,20 +898,15 @@ impl Step for Src { "src/librustc_tsan", "src/libstd", "src/libunwind", - "src/rustc/compiler_builtins_shim", - "src/rustc/libc_shim", - "src/rustc/dlmalloc_shim", "src/libtest", "src/libterm", "src/libprofiler_builtins", "src/stdsimd", "src/libproc_macro", - ]; - let std_src_dirs_exclude = [ - "src/libcompiler_builtins/compiler-rt/test", + "src/tools/rustc-std-workspace-core", ]; - copy_src_dirs(builder, &std_src_dirs[..], &std_src_dirs_exclude[..], &dst_src); + copy_src_dirs(builder, &std_src_dirs[..], &[], &dst_src); for file in src_files.iter() { builder.copy(&builder.src.join(file), &dst_src.join(file)); } @@ -908,7 +930,7 @@ impl Step for Src { } } -const CARGO_VENDOR_VERSION: &str = "0.1.19"; +const CARGO_VENDOR_VERSION: &str = "0.1.22"; #[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)] pub struct PlainSourceTarball; @@ -949,6 +971,8 @@ impl Step for PlainSourceTarball { "configure", "x.py", "config.toml.example", + "Cargo.toml", + "Cargo.lock", ]; let src_dirs = [ "src", @@ -992,7 +1016,7 @@ impl Step for PlainSourceTarball { // Vendor all Cargo dependencies let mut cmd = Command::new(&builder.initial_cargo); cmd.arg("vendor") - .current_dir(&plain_dst_src.join("src")); + .current_dir(&plain_dst_src); builder.run(&mut cmd); } @@ -1284,6 +1308,90 @@ impl Step for Clippy { } } +#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)] +pub struct Miri { + pub stage: u32, + pub target: Interned, +} + +impl Step for Miri { + type Output = Option; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun) -> ShouldRun { + run.path("miri") + } + + fn make_run(run: RunConfig) { + run.builder.ensure(Miri { + stage: run.builder.top_stage, + target: run.target, + }); + } + + fn run(self, builder: &Builder) -> Option { + let stage = self.stage; + let target = self.target; + assert!(builder.config.extended); + + builder.info(&format!("Dist miri stage{} ({})", stage, target)); + let src = builder.src.join("src/tools/miri"); + let release_num = builder.release_num("miri"); + let name = pkgname(builder, "miri"); + let version = builder.miri_info.version(builder, &release_num); + + let tmp = tmpdir(builder); + let image = tmp.join("miri-image"); + drop(fs::remove_dir_all(&image)); + builder.create_dir(&image); + + // Prepare the image directory + // We expect miri to build, because we've exited this step above if tool + // state for miri isn't testing. + let miri = builder.ensure(tool::Miri { + compiler: builder.compiler(stage, builder.config.build), + target, extra_features: Vec::new() + }).or_else(|| { missing_tool("miri", builder.build.config.missing_tools); None })?; + let cargomiri = builder.ensure(tool::CargoMiri { + compiler: builder.compiler(stage, builder.config.build), + target, extra_features: Vec::new() + }).or_else(|| { missing_tool("cargo miri", builder.build.config.missing_tools); None })?; + + builder.install(&miri, &image.join("bin"), 0o755); + builder.install(&cargomiri, &image.join("bin"), 0o755); + let doc = image.join("share/doc/miri"); + builder.install(&src.join("README.md"), &doc, 0o644); + builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644); + builder.install(&src.join("LICENSE-MIT"), &doc, 0o644); + + // Prepare the overlay + let overlay = tmp.join("miri-overlay"); + drop(fs::remove_dir_all(&overlay)); + t!(fs::create_dir_all(&overlay)); + builder.install(&src.join("README.md"), &overlay, 0o644); + builder.install(&src.join("LICENSE-APACHE"), &doc, 0o644); + builder.install(&src.join("LICENSE-MIT"), &doc, 0o644); + builder.create(&overlay.join("version"), &version); + + // Generate the installer tarball + let mut cmd = rust_installer(builder); + cmd.arg("generate") + .arg("--product-name=Rust") + .arg("--rel-manifest-dir=rustlib") + .arg("--success-message=miri-ready-to-serve.") + .arg("--image-dir").arg(&image) + .arg("--work-dir").arg(&tmpdir(builder)) + .arg("--output-dir").arg(&distdir(builder)) + .arg("--non-installed-overlay").arg(&overlay) + .arg(format!("--package-name={}-{}", name, target)) + .arg("--legacy-manifest-dirs=rustlib,cargo") + .arg("--component-name=miri-preview"); + + builder.run(&mut cmd); + Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target))) + } +} + #[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)] pub struct Rustfmt { pub stage: u32, @@ -1405,6 +1513,7 @@ impl Step for Extended { let rls_installer = builder.ensure(Rls { stage, target }); let llvm_tools_installer = builder.ensure(LlvmTools { stage, target }); let clippy_installer = builder.ensure(Clippy { stage, target }); + let miri_installer = builder.ensure(Miri { stage, target }); let lldb_installer = builder.ensure(Lldb { target }); let mingw_installer = builder.ensure(Mingw { host: target }); let analysis_installer = builder.ensure(Analysis { @@ -1443,6 +1552,7 @@ impl Step for Extended { tarballs.push(cargo_installer); tarballs.extend(rls_installer.clone()); tarballs.extend(clippy_installer.clone()); + tarballs.extend(miri_installer.clone()); tarballs.extend(rustfmt_installer.clone()); tarballs.extend(llvm_tools_installer); tarballs.extend(lldb_installer); @@ -1508,20 +1618,22 @@ impl Step for Extended { } let xform = |p: &Path| { - let mut contents = String::new(); - t!(t!(File::open(p)).read_to_string(&mut contents)); + let mut contents = t!(fs::read_to_string(p)); if rls_installer.is_none() { contents = filter(&contents, "rls"); } if clippy_installer.is_none() { contents = filter(&contents, "clippy"); } + if miri_installer.is_none() { + contents = filter(&contents, "miri"); + } if rustfmt_installer.is_none() { contents = filter(&contents, "rustfmt"); } let ret = tmp.join(p.file_name().unwrap()); - t!(t!(File::create(&ret)).write_all(contents.as_bytes())); - return ret + t!(fs::write(&ret, &contents)); + ret }; if target.contains("apple-darwin") { @@ -1556,6 +1668,9 @@ impl Step for Extended { if clippy_installer.is_some() { prepare("clippy"); } + if miri_installer.is_some() { + prepare("miri"); + } // create an 'uninstall' package builder.install(&etc.join("pkg/postinstall"), &pkg.join("uninstall"), 0o755); @@ -1586,6 +1701,8 @@ impl Step for Extended { "rls-preview".to_string() } else if name == "clippy" { "clippy-preview".to_string() + } else if name == "miri" { + "miri-preview".to_string() } else { name.to_string() }; @@ -1605,6 +1722,9 @@ impl Step for Extended { if clippy_installer.is_some() { prepare("clippy"); } + if miri_installer.is_some() { + prepare("miri"); + } if target.contains("windows-gnu") { prepare("rust-mingw"); } @@ -1697,6 +1817,18 @@ impl Step for Extended { .arg("-out").arg(exe.join("ClippyGroup.wxs")) .arg("-t").arg(etc.join("msi/remove-duplicates.xsl"))); } + if miri_installer.is_some() { + builder.run(Command::new(&heat) + .current_dir(&exe) + .arg("dir") + .arg("miri") + .args(&heat_flags) + .arg("-cg").arg("MiriGroup") + .arg("-dr").arg("Miri") + .arg("-var").arg("var.MiriDir") + .arg("-out").arg(exe.join("MiriGroup.wxs")) + .arg("-t").arg(etc.join("msi/remove-duplicates.xsl"))); + } builder.run(Command::new(&heat) .current_dir(&exe) .arg("dir") @@ -1742,6 +1874,9 @@ impl Step for Extended { if clippy_installer.is_some() { cmd.arg("-dClippyDir=clippy"); } + if miri_installer.is_some() { + cmd.arg("-dMiriDir=miri"); + } if target.contains("windows-gnu") { cmd.arg("-dGccDir=rust-mingw"); } @@ -1760,6 +1895,9 @@ impl Step for Extended { if clippy_installer.is_some() { candle("ClippyGroup.wxs".as_ref()); } + if miri_installer.is_some() { + candle("MiriGroup.wxs".as_ref()); + } candle("AnalysisGroup.wxs".as_ref()); if target.contains("windows-gnu") { @@ -1792,6 +1930,9 @@ impl Step for Extended { if clippy_installer.is_some() { cmd.arg("ClippyGroup.wixobj"); } + if miri_installer.is_some() { + cmd.arg("MiriGroup.wixobj"); + } if target.contains("windows-gnu") { cmd.arg("GccGroup.wixobj"); @@ -1866,8 +2007,7 @@ impl Step for HashSign { let file = builder.config.dist_gpg_password_file.as_ref().unwrap_or_else(|| { panic!("\n\nfailed to specify `dist.gpg-password-file` in `config.toml`\n\n") }); - let mut pass = String::new(); - t!(t!(File::open(&file)).read_to_string(&mut pass)); + let pass = t!(fs::read_to_string(&file)); let today = output(Command::new("date").arg("+%Y-%m-%d")); @@ -1875,13 +2015,14 @@ impl Step for HashSign { cmd.arg(distdir(builder)); cmd.arg(today.trim()); cmd.arg(builder.rust_package_vers()); + cmd.arg(addr); cmd.arg(builder.package_vers(&builder.release_num("cargo"))); cmd.arg(builder.package_vers(&builder.release_num("rls"))); cmd.arg(builder.package_vers(&builder.release_num("clippy"))); + cmd.arg(builder.package_vers(&builder.release_num("miri"))); cmd.arg(builder.package_vers(&builder.release_num("rustfmt"))); cmd.arg(builder.llvm_tools_package_vers()); cmd.arg(builder.lldb_package_vers()); - cmd.arg(addr); builder.create_dir(&distdir(builder)); @@ -1896,13 +2037,13 @@ impl Step for HashSign { // LLVM tools are linked dynamically. // Note: This function does no yet support Windows but we also don't support // linking LLVM tools dynamically on Windows yet. -fn maybe_install_llvm_dylib(builder: &Builder, - target: Interned, - image: &Path) { +pub fn maybe_install_llvm_dylib(builder: &Builder, + target: Interned, + sysroot: &Path) { let src_libdir = builder .llvm_out(target) .join("lib"); - let dst_libdir = image.join("lib/rustlib").join(&*target).join("lib"); + let dst_libdir = sysroot.join("lib/rustlib").join(&*target).join("lib"); t!(fs::create_dir_all(&dst_libdir)); if target.contains("apple-darwin") { @@ -1964,7 +2105,7 @@ impl Step for LlvmTools { } builder.info(&format!("Dist LlvmTools stage{} ({})", stage, target)); - let src = builder.src.join("src/llvm"); + let src = builder.src.join("src/llvm-project/llvm"); let name = pkgname(builder, "llvm-tools"); let tmp = tmpdir(builder); @@ -2023,7 +2164,7 @@ impl Step for Lldb { const DEFAULT: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { - run.path("src/tools/lldb") + run.path("src/llvm-project/lldb").path("src/tools/lldb") } fn make_run(run: RunConfig) { @@ -2048,7 +2189,7 @@ impl Step for Lldb { } builder.info(&format!("Dist Lldb ({})", target)); - let src = builder.src.join("src/tools/lldb"); + let src = builder.src.join("src/llvm-project/lldb"); let name = pkgname(builder, "lldb"); let tmp = tmpdir(builder); diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 7623ca1e27e..08e97396fd6 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Documentation generation for rustbuilder. //! //! This module implements generation for all bits and pieces of documentation @@ -18,23 +8,22 @@ //! `rustdoc`. use std::collections::HashSet; -use std::fs::{self, File}; -use std::io::prelude::*; +use std::fs; use std::io; use std::path::{PathBuf, Path}; -use Mode; +use crate::Mode; use build_helper::up_to_date; -use util::symlink_dir; -use builder::{Builder, Compiler, RunConfig, ShouldRun, Step}; -use tool::{self, prepare_tool_cargo, Tool, SourceType}; -use compile; -use cache::{INTERNER, Interned}; -use config::Config; +use crate::util::symlink_dir; +use crate::builder::{Builder, Compiler, RunConfig, ShouldRun, Step}; +use crate::tool::{self, prepare_tool_cargo, Tool, SourceType}; +use crate::compile; +use crate::cache::{INTERNER, Interned}; +use crate::config::Config; macro_rules! book { - ($($name:ident, $path:expr, $book_name:expr;)+) => { + ($($name:ident, $path:expr, $book_name:expr, $book_ver:expr;)+) => { $( #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct $name { @@ -60,6 +49,7 @@ macro_rules! book { builder.ensure(Rustbook { target: self.target, name: INTERNER.intern_str($book_name), + version: $book_ver, }) } } @@ -67,18 +57,32 @@ macro_rules! book { } } +// NOTE: When adding a book here, make sure to ALSO build the book by +// adding a build step in `src/bootstrap/builder.rs`! book!( - Nomicon, "src/doc/nomicon", "nomicon"; - Reference, "src/doc/reference", "reference"; - RustdocBook, "src/doc/rustdoc", "rustdoc"; - RustcBook, "src/doc/rustc", "rustc"; - RustByExample, "src/doc/rust-by-example", "rust-by-example"; + EditionGuide, "src/doc/edition-guide", "edition-guide", RustbookVersion::MdBook1; + Nomicon, "src/doc/nomicon", "nomicon", RustbookVersion::MdBook1; + Reference, "src/doc/reference", "reference", RustbookVersion::MdBook1; + RustByExample, "src/doc/rust-by-example", "rust-by-example", RustbookVersion::MdBook1; + RustcBook, "src/doc/rustc", "rustc", RustbookVersion::MdBook1; + RustdocBook, "src/doc/rustdoc", "rustdoc", RustbookVersion::MdBook1; ); +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +enum RustbookVersion { + MdBook1, + + /// Note: Currently no books use mdBook v2, but we want the option + /// to be available + #[allow(dead_code)] + MdBook2, +} + #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] struct Rustbook { target: Interned, name: Interned, + version: RustbookVersion, } impl Step for Rustbook { @@ -100,6 +104,7 @@ impl Step for Rustbook { target: self.target, name: self.name, src: INTERNER.intern_path(src), + version: self.version, }); } } @@ -132,6 +137,7 @@ impl Step for UnstableBook { target: self.target, name: INTERNER.intern_str("unstable-book"), src: builder.md_doc_out(self.target), + version: RustbookVersion::MdBook1, }) } } @@ -185,6 +191,7 @@ struct RustbookSrc { target: Interned, name: Interned, src: Interned, + version: RustbookVersion, } impl Step for RustbookSrc { @@ -215,11 +222,19 @@ impl Step for RustbookSrc { } builder.info(&format!("Rustbook ({}) - {}", target, name)); let _ = fs::remove_dir_all(&out); + + let vers = match self.version { + RustbookVersion::MdBook1 => "1", + RustbookVersion::MdBook2 => "2", + }; + builder.run(rustbook_cmd .arg("build") .arg(&src) .arg("-d") - .arg(out)); + .arg(out) + .arg("-m") + .arg(vers)); } } @@ -260,22 +275,35 @@ impl Step for TheBook { let compiler = self.compiler; let target = self.target; let name = self.name; - // build book first edition + + // build book builder.ensure(Rustbook { target, - name: INTERNER.intern_string(format!("{}/first-edition", name)), + name: INTERNER.intern_string(name.to_string()), + version: RustbookVersion::MdBook1, }); - // build book second edition + // building older edition redirects + + let source_name = format!("{}/first-edition", name); builder.ensure(Rustbook { target, - name: INTERNER.intern_string(format!("{}/second-edition", name)), + name: INTERNER.intern_string(source_name), + version: RustbookVersion::MdBook1, }); - // build book 2018 edition + let source_name = format!("{}/second-edition", name); builder.ensure(Rustbook { target, - name: INTERNER.intern_string(format!("{}/2018-edition", name)), + name: INTERNER.intern_string(source_name), + version: RustbookVersion::MdBook1, + }); + + let source_name = format!("{}/2018-edition", name); + builder.ensure(Rustbook { + target, + name: INTERNER.intern_string(source_name), + version: RustbookVersion::MdBook1, }); // build the version info page and CSS @@ -284,11 +312,6 @@ impl Step for TheBook { target, }); - // build the index page - let index = format!("{}/index.md", name); - builder.info(&format!("Documenting book index ({})", target)); - invoke_rustdoc(builder, compiler, target, &index); - // build the redirect pages builder.info(&format!("Documenting book redirect pages ({})", target)); for file in t!(fs::read_dir(builder.src.join("src/doc/book/redirects"))) { @@ -374,12 +397,11 @@ impl Step for Standalone { let version_info = out.join("version_info.html"); if !builder.config.dry_run && !up_to_date(&version_input, &version_info) { - let mut info = String::new(); - t!(t!(File::open(&version_input)).read_to_string(&mut info)); - let info = info.replace("VERSION", &builder.rust_release()) - .replace("SHORT_HASH", builder.rust_info.sha_short().unwrap_or("")) - .replace("STAMP", builder.rust_info.sha().unwrap_or("")); - t!(t!(File::create(&version_info)).write_all(info.as_bytes())); + let info = t!(fs::read_to_string(&version_input)) + .replace("VERSION", &builder.rust_release()) + .replace("SHORT_HASH", builder.rust_info.sha_short().unwrap_or("")) + .replace("STAMP", builder.rust_info.sha().unwrap_or("")); + t!(fs::write(&version_info, &info)); } for file in t!(fs::read_dir(builder.src.join("src/doc"))) { @@ -692,9 +714,6 @@ impl Step for Rustc { return; } - // Build libstd docs so that we generate relative links. - builder.ensure(Std { stage, target }); - // Build rustc. builder.ensure(compile::Rustc { compiler, target }); @@ -713,12 +732,16 @@ impl Step for Rustc { // Find dependencies for top level crates. let mut compiler_crates = HashSet::new(); - for root_crate in &["rustc", "rustc_driver", "rustc_codegen_llvm"] { + for root_crate in &["rustc_driver", "rustc_codegen_llvm", "rustc_codegen_ssa"] { let interned_root_crate = INTERNER.intern_str(root_crate); find_compiler_crates(builder, &interned_root_crate, &mut compiler_crates); } for krate in &compiler_crates { + // Create all crate output directories first to make sure rustdoc uses + // relative links. + // FIXME: Cargo should probably do this itself. + t!(fs::create_dir_all(out_dir.join(krate))); cargo.arg("-p").arg(krate); } @@ -792,8 +815,8 @@ impl Step for Rustdoc { return; } - // Build libstd docs so that we generate relative links. - builder.ensure(Std { stage, target }); + // Build rustc docs so that we generate relative links. + builder.ensure(Rustc { stage, target }); // Build rustdoc. builder.ensure(tool::Rustdoc { host: compiler.host }); @@ -817,6 +840,10 @@ impl Step for Rustdoc { &[] ); + // Only include compiler crates, no dependencies of those, such as `libc`. + cargo.arg("--no-deps"); + cargo.arg("-p").arg("rustdoc"); + cargo.env("RUSTDOCFLAGS", "--document-private-items"); builder.run(&mut cargo); } @@ -910,13 +937,13 @@ fn symlink_dir_force(config: &Config, src: &Path, dst: &Path) -> io::Result<()> } if let Ok(m) = fs::symlink_metadata(dst) { if m.file_type().is_dir() { - try!(fs::remove_dir_all(dst)); + fs::remove_dir_all(dst)?; } else { // handle directory junctions on windows by falling back to // `remove_dir`. - try!(fs::remove_file(dst).or_else(|_| { + fs::remove_file(dst).or_else(|_| { fs::remove_dir(dst) - })); + })?; } } diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 1211d485d1c..0f9a4271ac0 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Command-line interface of the rustbuild build system. //! //! This module implements the command-line parsing of the build system which @@ -19,12 +9,12 @@ use std::process; use getopts::Options; -use builder::Builder; -use config::Config; -use metadata; -use {Build, DocTests}; +use crate::builder::Builder; +use crate::config::Config; +use crate::metadata; +use crate::{Build, DocTests}; -use cache::{Interned, INTERNER}; +use crate::cache::{Interned, INTERNER}; /// Deserialized version of all flags for this compile. pub struct Flags { @@ -121,11 +111,11 @@ To learn more about a subcommand, run `./x.py -h`" opts.optopt("", "on-fail", "command to run on failure", "CMD"); opts.optflag("", "dry-run", "dry run; don't build anything"); opts.optopt("", "stage", - "stage to build (indicates compiler to use/test, e.g. stage 0 uses the \ + "stage to build (indicates compiler to use/test, e.g., stage 0 uses the \ bootstrap compiler, stage 1 the stage 0 rustc artifacts, etc.)", "N"); opts.optmulti("", "keep-stage", "stage(s) to keep without recompiling \ - (pass multiple times to keep e.g. both stages 0 and 1)", "N"); + (pass multiple times to keep e.g., both stages 0 and 1)", "N"); opts.optopt("", "src", "path to the root of the rust checkout", "DIR"); opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS"); opts.optflag("h", "help", "print this help message"); diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index cb28698aa3d..1265fa9eff4 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of the install aspects of the compiler. //! //! This module is responsible for installing the standard library, @@ -18,11 +8,11 @@ use std::fs; use std::path::{Path, PathBuf, Component}; use std::process::Command; -use dist::{self, pkgname, sanitize_sh, tmpdir}; +use crate::dist::{self, pkgname, sanitize_sh, tmpdir}; -use builder::{Builder, RunConfig, ShouldRun, Step}; -use cache::Interned; -use config::Config; +use crate::builder::{Builder, RunConfig, ShouldRun, Step}; +use crate::cache::Interned; +use crate::config::Config; pub fn install_docs(builder: &Builder, stage: u32, host: Interned) { install_sh(builder, "docs", "rust-docs", stage, Some(host)); @@ -42,6 +32,9 @@ pub fn install_rls(builder: &Builder, stage: u32, host: Interned) { pub fn install_clippy(builder: &Builder, stage: u32, host: Interned) { install_sh(builder, "clippy", "clippy", stage, Some(host)); } +pub fn install_miri(builder: &Builder, stage: u32, host: Interned) { + install_sh(builder, "miri", "miri", stage, Some(host)); +} pub fn install_rustfmt(builder: &Builder, stage: u32, host: Interned) { install_sh(builder, "rustfmt", "rustfmt", stage, Some(host)); @@ -227,6 +220,14 @@ install!((self, builder, _config), builder.info(&format!("skipping Install clippy stage{} ({})", self.stage, self.target)); } }; + Miri, "miri", Self::should_build(_config), only_hosts: true, { + if builder.ensure(dist::Miri { stage: self.stage, target: self.target }).is_some() || + Self::should_install(builder) { + install_miri(builder, self.stage, self.target); + } else { + builder.info(&format!("skipping Install miri stage{} ({})", self.stage, self.target)); + } + }; Rustfmt, "rustfmt", Self::should_build(_config), only_hosts: true, { if builder.ensure(dist::Rustfmt { stage: self.stage, target: self.target }).is_some() || Self::should_install(builder) { diff --git a/src/bootstrap/job.rs b/src/bootstrap/job.rs index e6ee525ca2e..df492e0fdfd 100644 --- a/src/bootstrap/job.rs +++ b/src/bootstrap/job.rs @@ -1,16 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Job management on Windows for bootstrapping //! -//! Most of the time when you're running a build system (e.g. make) you expect +//! Most of the time when you're running a build system (e.g., make) you expect //! Ctrl-C or abnormal termination to actually terminate the entire tree of //! process in play, not just the one at the top. This currently works "by //! default" on Unix platforms because Ctrl-C actually sends a signal to the @@ -42,7 +32,7 @@ use std::env; use std::io; use std::mem; -use Build; +use crate::Build; type HANDLE = *mut u8; type BOOL = i32; @@ -162,11 +152,11 @@ pub unsafe fn setup(build: &mut Build) { return } - // If we've got a parent process (e.g. the python script that called us) + // If we've got a parent process (e.g., the python script that called us) // then move ownership of this job object up to them. That way if the python - // script is killed (e.g. via ctrl-c) then we'll all be torn down. + // script is killed (e.g., via ctrl-c) then we'll all be torn down. // - // If we don't have a parent (e.g. this was run directly) then we + // If we don't have a parent (e.g., this was run directly) then we // intentionally leak the job object handle. When our process exits // (normally or abnormally) it will close the handle implicitly, causing all // processes in the job to be cleaned up. @@ -184,7 +174,7 @@ pub unsafe fn setup(build: &mut Build) { // If this failed, well at least we tried! An example of DuplicateHandle // failing in the past has been when the wrong python2 package spawned this - // build system (e.g. the `python2` package in MSYS instead of + // build system (e.g., the `python2` package in MSYS instead of // `mingw-w64-x86_64-python2`. Not sure why it failed, but the "failure // mode" here is that we only clean everything up when the build system // dies, not when the python parent does, so not too bad. diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 76697e482d3..32b03c5fb1b 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of rustbuild, the Rust build system. //! //! This module, and its descendants, are the implementation of the Rust build @@ -38,7 +28,7 @@ //! However, compiletest itself tries to avoid running tests when the artifacts //! that are involved (mainly the compiler) haven't changed. //! -//! When you execute `x.py build`, the steps which are executed are: +//! When you execute `x.py build`, the steps executed are: //! //! * First, the python script is run. This will automatically download the //! stage0 rustc and cargo according to `src/stage0.txt`, or use the cached @@ -145,7 +135,7 @@ use std::cell::{RefCell, Cell}; use std::collections::{HashSet, HashMap}; use std::env; use std::fs::{self, OpenOptions, File}; -use std::io::{self, Seek, SeekFrom, Write, Read}; +use std::io::{Seek, SeekFrom, Write, Read}; use std::path::{PathBuf, Path}; use std::process::{self, Command}; use std::slice; @@ -159,7 +149,7 @@ use std::os::windows::fs::symlink_file; use build_helper::{run_silent, run_suppressed, try_run_silent, try_run_suppressed, output, mtime}; use filetime::FileTime; -use util::{exe, libdir, OutputFolder, CiEnv}; +use crate::util::{exe, libdir, OutputFolder, CiEnv}; mod cc_detect; mod channel; @@ -188,7 +178,7 @@ mod job; mod job { use libc; - pub unsafe fn setup(build: &mut ::Build) { + pub unsafe fn setup(build: &mut crate::Build) { if build.config.low_priority { libc::setpriority(libc::PRIO_PGRP as _, 0, 10); } @@ -197,14 +187,14 @@ mod job { #[cfg(any(target_os = "haiku", not(any(unix, windows))))] mod job { - pub unsafe fn setup(_build: &mut ::Build) { + pub unsafe fn setup(_build: &mut crate::Build) { } } -pub use config::Config; -use flags::Subcommand; -use cache::{Interned, INTERNER}; -use toolstate::ToolState; +pub use crate::config::Config; +use crate::flags::Subcommand; +use crate::cache::{Interned, INTERNER}; +use crate::toolstate::ToolState; const LLVM_TOOLS: &[&str] = &[ "llvm-nm", // used to inspect binaries; it shows symbol names, their sizes and visibility @@ -263,6 +253,7 @@ pub struct Build { cargo_info: channel::GitInfo, rls_info: channel::GitInfo, clippy_info: channel::GitInfo, + miri_info: channel::GitInfo, rustfmt_info: channel::GitInfo, local_rebuild: bool, fail_fast: bool, @@ -384,6 +375,7 @@ impl Build { let cargo_info = channel::GitInfo::new(&config, &src.join("src/tools/cargo")); let rls_info = channel::GitInfo::new(&config, &src.join("src/tools/rls")); let clippy_info = channel::GitInfo::new(&config, &src.join("src/tools/clippy")); + let miri_info = channel::GitInfo::new(&config, &src.join("src/tools/miri")); let rustfmt_info = channel::GitInfo::new(&config, &src.join("src/tools/rustfmt")); let mut build = Build { @@ -406,6 +398,7 @@ impl Build { cargo_info, rls_info, clippy_info, + miri_info, rustfmt_info, cc: HashMap::new(), cxx: HashMap::new(), @@ -430,7 +423,7 @@ impl Build { Command::new(&build.initial_rustc).arg("--version").arg("--verbose")); let local_release = local_version_verbose .lines().filter(|x| x.starts_with("release:")) - .next().unwrap().trim_left_matches("release:").trim(); + .next().unwrap().trim_start_matches("release:").trim(); let my_version = channel::CFG_RELEASE_NUM; if local_release.split('.').take(2).eq(my_version.split('.').take(2)) { build.verbose(&format!("auto-detected local-rebuild {}", local_release)); @@ -777,10 +770,10 @@ impl Build { fn cflags(&self, target: Interned, which: GitRepo) -> Vec { // Filter out -O and /O (the optimization flags) that we picked up from // cc-rs because the build scripts will determine that for themselves. - let mut base: Vec = self.cc[&target].args().iter() + let mut base = self.cc[&target].args().iter() .map(|s| s.to_string_lossy().into_owned()) .filter(|s| !s.starts_with("-O") && !s.starts_with("/O")) - .collect::>(); + .collect::>(); // If we're compiling on macOS then we add a few unconditional flags // indicating that we want libc++ (more filled out than libstdc++) and @@ -1026,6 +1019,11 @@ impl Build { self.package_vers(&self.release_num("clippy")) } + /// Returns the value of `package_vers` above for miri + fn miri_package_vers(&self) -> String { + self.package_vers(&self.release_num("miri")) + } + /// Returns the value of `package_vers` above for rustfmt fn rustfmt_package_vers(&self) -> String { self.package_vers(&self.release_num("rustfmt")) @@ -1067,9 +1065,8 @@ impl Build { /// Returns the `a.b.c` version that the given package is at. fn release_num(&self, package: &str) -> String { - let mut toml = String::new(); let toml_file_name = self.src.join(&format!("src/tools/{}/Cargo.toml", package)); - t!(t!(File::open(toml_file_name)).read_to_string(&mut toml)); + let toml = t!(fs::read_to_string(&toml_file_name)); for line in toml.lines() { let prefix = "version = \""; let suffix = "\""; @@ -1135,10 +1132,10 @@ impl Build { let krate = &self.crates[&krate]; if krate.is_local(self) { ret.push(krate); - for dep in &krate.deps { - if visited.insert(dep) && dep != "build_helper" { - list.push(*dep); - } + } + for dep in &krate.deps { + if visited.insert(dep) && dep != "build_helper" { + list.push(*dep); } } } @@ -1151,8 +1148,7 @@ impl Build { } let mut paths = Vec::new(); - let mut contents = Vec::new(); - t!(t!(File::open(stamp)).read_to_end(&mut contents)); + let contents = t!(fs::read(stamp)); // This is the method we use for extracting paths from the stamp file passed to us. See // run_cargo for more information (in compile.rs). for part in contents.split(|b| *b == 0) { @@ -1267,9 +1263,15 @@ impl Build { if !src.exists() { panic!("Error: File \"{}\" not found!", src.display()); } - let mut s = t!(fs::File::open(&src)); - let mut d = t!(fs::File::create(&dst)); - io::copy(&mut s, &mut d).expect("failed to copy"); + let metadata = t!(src.symlink_metadata()); + if let Err(e) = fs::copy(&src, &dst) { + panic!("failed to copy `{}` to `{}`: {}", src.display(), + dst.display(), e) + } + t!(fs::set_permissions(&dst, metadata.permissions())); + let atime = FileTime::from_last_access_time(&metadata); + let mtime = FileTime::from_last_modification_time(&metadata); + t!(filetime::set_file_times(&dst, atime, mtime)); } chmod(&dst, perms); } diff --git a/src/bootstrap/metadata.rs b/src/bootstrap/metadata.rs index fa0b1983510..7fa377f310b 100644 --- a/src/bootstrap/metadata.rs +++ b/src/bootstrap/metadata.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::HashMap; use std::process::Command; use std::path::PathBuf; @@ -16,8 +6,8 @@ use std::collections::HashSet; use build_helper::output; use serde_json; -use {Build, Crate}; -use cache::INTERNER; +use crate::{Build, Crate}; +use crate::cache::INTERNER; #[derive(Deserialize)] struct Output { diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in index 862fbbf1f28..1c27cf3909b 100644 --- a/src/bootstrap/mk/Makefile.in +++ b/src/bootstrap/mk/Makefile.in @@ -1,13 +1,3 @@ -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - ifdef VERBOSE Q := BOOTSTRAP_ARGS := -v @@ -63,7 +53,6 @@ check-aux: src/test/run-fail/pretty \ src/test/run-pass-valgrind/pretty \ src/test/run-pass-fulldeps/pretty \ - src/test/run-fail-fulldeps/pretty \ $(AUX_ARGS) \ $(BOOTSTRAP_ARGS) check-bootstrap: diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 448967ef0c2..f48f9ee752e 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Compilation of native dependencies like LLVM. //! //! Native projects like LLVM unfortunately aren't suited just yet for @@ -21,7 +11,6 @@ use std::env; use std::ffi::OsString; use std::fs::{self, File}; -use std::io::{Read, Write}; use std::path::{Path, PathBuf}; use std::process::Command; @@ -29,11 +18,11 @@ use build_helper::output; use cmake; use cc; -use util::{self, exe}; +use crate::util::{self, exe}; use build_helper::up_to_date; -use builder::{Builder, RunConfig, ShouldRun, Step}; -use cache::Interned; -use GitRepo; +use crate::builder::{Builder, RunConfig, ShouldRun, Step}; +use crate::cache::Interned; +use crate::GitRepo; #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct Llvm { @@ -47,7 +36,10 @@ impl Step for Llvm { const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { - run.path("src/llvm").path("src/llvm-emscripten") + run.path("src/llvm-project") + .path("src/llvm-project/llvm") + .path("src/llvm") + .path("src/llvm-emscripten") } fn make_run(run: RunConfig) { @@ -75,8 +67,7 @@ impl Step for Llvm { } let rebuild_trigger = builder.src.join("src/rustllvm/llvm-rebuild-trigger"); - let mut rebuild_trigger_contents = String::new(); - t!(t!(File::open(&rebuild_trigger)).read_to_string(&mut rebuild_trigger_contents)); + let rebuild_trigger_contents = t!(fs::read_to_string(&rebuild_trigger)); let (out_dir, llvm_config_ret_dir) = if emscripten { let dir = builder.emscripten_llvm_out(target); @@ -93,8 +84,7 @@ impl Step for Llvm { let build_llvm_config = llvm_config_ret_dir .join(exe("llvm-config", &*builder.config.build)); if done_stamp.exists() { - let mut done_contents = String::new(); - t!(t!(File::open(&done_stamp)).read_to_string(&mut done_contents)); + let done_contents = t!(fs::read_to_string(&done_stamp)); // If LLVM was already built previously and contents of the rebuild-trigger file // didn't change from the previous build, then no action is required. @@ -110,7 +100,7 @@ impl Step for Llvm { t!(fs::create_dir_all(&out_dir)); // http://llvm.org/docs/CMake.html - let root = if self.emscripten { "src/llvm-emscripten" } else { "src/llvm" }; + let root = if self.emscripten { "src/llvm-emscripten" } else { "src/llvm-project/llvm" }; let mut cfg = cmake::Config::new(builder.src.join(root)); let profile = match (builder.config.llvm_optimize, builder.config.llvm_release_debuginfo) { @@ -202,10 +192,10 @@ impl Step for Llvm { } if want_lldb { - cfg.define("LLVM_EXTERNAL_CLANG_SOURCE_DIR", builder.src.join("src/tools/clang")); - cfg.define("LLVM_EXTERNAL_LLDB_SOURCE_DIR", builder.src.join("src/tools/lldb")); + cfg.define("LLVM_ENABLE_PROJECTS", "clang;lldb"); // For the time being, disable code signing. cfg.define("LLDB_CODESIGN_IDENTITY", ""); + cfg.define("LLDB_NO_DEBUGSERVER", "ON"); } else { // LLDB requires libxml2; but otherwise we want it to be disabled. // See https://github.com/rust-lang/rust/pull/50104 @@ -244,14 +234,18 @@ impl Step for Llvm { cfg.define("LLVM_VERSION_SUFFIX", suffix); } + if let Some(ref linker) = builder.config.llvm_use_linker { + cfg.define("LLVM_USE_LINKER", linker); + } + if let Some(ref python) = builder.config.python { cfg.define("PYTHON_EXECUTABLE", python); } - configure_cmake(builder, target, &mut cfg, false); + configure_cmake(builder, target, &mut cfg); // FIXME: we don't actually need to build all LLVM tools and all LLVM - // libraries here, e.g. we just want a few components and a few + // libraries here, e.g., we just want a few components and a few // tools. Figure out how to filter them down and only build the right // tools and libs on all platforms. @@ -261,7 +255,7 @@ impl Step for Llvm { cfg.build(); - t!(t!(File::create(&done_stamp)).write_all(rebuild_trigger_contents.as_bytes())); + t!(fs::write(&done_stamp, &rebuild_trigger_contents)); build_llvm_config } @@ -281,17 +275,16 @@ fn check_llvm_version(builder: &Builder, llvm_config: &Path) { let mut parts = version.split('.').take(2) .filter_map(|s| s.parse::().ok()); if let (Some(major), Some(_minor)) = (parts.next(), parts.next()) { - if major >= 5 { + if major >= 6 { return } } - panic!("\n\nbad LLVM version: {}, need >=5.0\n\n", version) + panic!("\n\nbad LLVM version: {}, need >=6.0\n\n", version) } fn configure_cmake(builder: &Builder, target: Interned, - cfg: &mut cmake::Config, - building_dist_binaries: bool) { + cfg: &mut cmake::Config) { if builder.config.ninja { cfg.generator("Ninja"); } @@ -360,26 +353,32 @@ fn configure_cmake(builder: &Builder, if builder.config.llvm_clang_cl.is_some() && target.contains("i686") { cfg.env("SCCACHE_EXTRA_ARGS", "-m32"); } - - // If ccache is configured we inform the build a little differently how - // to invoke ccache while also invoking our compilers. - } else if let Some(ref ccache) = builder.config.ccache { - cfg.define("CMAKE_C_COMPILER", ccache) - .define("CMAKE_C_COMPILER_ARG1", sanitize_cc(cc)) - .define("CMAKE_CXX_COMPILER", ccache) - .define("CMAKE_CXX_COMPILER_ARG1", sanitize_cc(cxx)); } else { + // If ccache is configured we inform the build a little differently how + // to invoke ccache while also invoking our compilers. + if let Some(ref ccache) = builder.config.ccache { + cfg.define("CMAKE_C_COMPILER_LAUNCHER", ccache) + .define("CMAKE_CXX_COMPILER_LAUNCHER", ccache); + } cfg.define("CMAKE_C_COMPILER", sanitize_cc(cc)) .define("CMAKE_CXX_COMPILER", sanitize_cc(cxx)); } cfg.build_arg("-j").build_arg(builder.jobs().to_string()); - cfg.define("CMAKE_C_FLAGS", builder.cflags(target, GitRepo::Llvm).join(" ")); + let mut cflags = builder.cflags(target, GitRepo::Llvm).join(" "); + if let Some(ref s) = builder.config.llvm_cxxflags { + cflags.push_str(&format!(" {}", s)); + } + cfg.define("CMAKE_C_FLAGS", cflags); let mut cxxflags = builder.cflags(target, GitRepo::Llvm).join(" "); - if building_dist_binaries { - if builder.config.llvm_static_stdcpp && !target.contains("windows") { - cxxflags.push_str(" -static-libstdc++"); - } + if builder.config.llvm_static_stdcpp && + !target.contains("windows") && + !target.contains("netbsd") + { + cxxflags.push_str(" -static-libstdc++"); + } + if let Some(ref s) = builder.config.llvm_cxxflags { + cxxflags.push_str(&format!(" {}", s)); } cfg.define("CMAKE_CXX_FLAGS", cxxflags); if let Some(ar) = builder.ar(target) { @@ -398,6 +397,12 @@ fn configure_cmake(builder: &Builder, } } + if let Some(ref s) = builder.config.llvm_ldflags { + cfg.define("CMAKE_SHARED_LINKER_FLAGS", s); + cfg.define("CMAKE_MODULE_LINKER_FLAGS", s); + cfg.define("CMAKE_EXE_LINKER_FLAGS", s); + } + if env::var_os("SCCACHE_ERROR_LOG").is_some() { cfg.env("RUST_LOG", "sccache=warn"); } @@ -413,7 +418,7 @@ impl Step for Lld { const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { - run.path("src/tools/lld") + run.path("src/llvm-project/lld").path("src/tools/lld") } fn make_run(run: RunConfig) { @@ -443,8 +448,8 @@ impl Step for Lld { let _time = util::timeit(&builder); t!(fs::create_dir_all(&out_dir)); - let mut cfg = cmake::Config::new(builder.src.join("src/tools/lld")); - configure_cmake(builder, target, &mut cfg, true); + let mut cfg = cmake::Config::new(builder.src.join("src/llvm-project/lld")); + configure_cmake(builder, target, &mut cfg); // This is an awful, awful hack. Discovered when we migrated to using // clang-cl to compile LLVM/LLD it turns out that LLD, when built out of diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index 15d3bccba09..fe547a6b151 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Sanity checking performed by rustbuild before actually executing anything. //! //! This module contains the implementation of ensuring that the build @@ -21,14 +11,13 @@ use std::collections::HashMap; use std::env; use std::ffi::{OsString, OsStr}; -use std::fs::{self, File}; -use std::io::Read; +use std::fs; use std::path::PathBuf; use std::process::Command; use build_helper::output; -use Build; +use crate::Build; struct Finder { cache: HashMap>, @@ -235,9 +224,7 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake } if build.config.channel == "stable" { - let mut stage0 = String::new(); - t!(t!(File::open(build.src.join("src/stage0.txt"))) - .read_to_string(&mut stage0)); + let stage0 = t!(fs::read_to_string(build.src.join("src/stage0.txt"))); if stage0.contains("\ndev:") { panic!("bootstrapping from a dev compiler in a stable release, but \ should only be bootstrapping from a released compiler!"); diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index e55773011df..1a46ebfcabb 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of the test-related targets of the build system. //! //! This file implements the various regression test suites that we execute on @@ -16,25 +6,24 @@ use std::env; use std::ffi::OsString; use std::fmt; -use std::fs::{self, File}; -use std::io::Read; +use std::fs; use std::iter; use std::path::{Path, PathBuf}; use std::process::Command; use build_helper::{self, output}; -use builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step}; -use cache::{Interned, INTERNER}; -use compile; -use dist; -use flags::Subcommand; -use native; -use tool::{self, Tool, SourceType}; -use toolstate::ToolState; -use util::{self, dylib_path, dylib_path_var}; -use Crate as CargoCrate; -use {DocTests, Mode, GitRepo}; +use crate::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step}; +use crate::cache::{Interned, INTERNER}; +use crate::compile; +use crate::dist; +use crate::flags::Subcommand; +use crate::native; +use crate::tool::{self, Tool, SourceType}; +use crate::toolstate::ToolState; +use crate::util::{self, dylib_path, dylib_path_var}; +use crate::Crate as CargoCrate; +use crate::{DocTests, Mode, GitRepo}; const ADB_TEST_DIR: &str = "/data/tmp/work"; @@ -294,13 +283,6 @@ impl Step for Rls { SourceType::Submodule, &[]); - // Copy `src/tools/rls/test_data` to a writable drive. - let test_workspace_path = builder.out.join("rls-test-data"); - let test_data_path = test_workspace_path.join("test_data"); - builder.create_dir(&test_data_path); - builder.cp_r(&builder.src.join("src/tools/rls/test_data"), &test_data_path); - cargo.env("RLS_TEST_WORKSPACE_DIR", test_workspace_path); - builder.add_rustc_lib_path(compiler, &mut cargo); cargo.arg("--") .args(builder.config.cmd.test_args()); @@ -430,6 +412,45 @@ impl Step for Miri { } } +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub struct CompiletestTest { + stage: u32, + host: Interned, +} + +impl Step for CompiletestTest { + type Output = (); + + fn should_run(run: ShouldRun) -> ShouldRun { + run.path("src/tools/compiletest") + } + + fn make_run(run: RunConfig) { + run.builder.ensure(CompiletestTest { + stage: run.builder.top_stage, + host: run.target, + }); + } + + /// Runs `cargo test` for compiletest. + fn run(self, builder: &Builder) { + let stage = self.stage; + let host = self.host; + let compiler = builder.compiler(stage, host); + + let mut cargo = tool::prepare_tool_cargo(builder, + compiler, + Mode::ToolBootstrap, + host, + "test", + "src/tools/compiletest", + SourceType::InTree, + &[]); + + try_run(builder, &mut cargo); + } +} + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct Clippy { stage: u32, @@ -578,7 +599,7 @@ impl Step for RustdocJS { if let Some(ref nodejs) = builder.config.nodejs { let mut command = Command::new(nodejs); command.args(&["src/tools/rustdoc-js/tester.js", &*self.host]); - builder.ensure(::doc::Std { + builder.ensure(crate::doc::Std { target: self.target, stage: builder.top_stage, }); @@ -827,24 +848,6 @@ host_test!(RunPassFullDeps { suite: "run-pass-fulldeps" }); -host_test!(RunFailFullDeps { - path: "src/test/run-fail-fulldeps", - mode: "run-fail", - suite: "run-fail-fulldeps" -}); - -host_test!(CompileFailFullDeps { - path: "src/test/compile-fail-fulldeps", - mode: "compile-fail", - suite: "compile-fail-fulldeps" -}); - -host_test!(IncrementalFullDeps { - path: "src/test/incremental-fulldeps", - mode: "incremental", - suite: "incremental-fulldeps" -}); - host_test!(Rustdoc { path: "src/test/rustdoc", mode: "rustdoc", @@ -879,20 +882,6 @@ test!(RunPassValgrindPretty { default: false, host: true }); -test!(RunPassFullDepsPretty { - path: "src/test/run-pass-fulldeps/pretty", - mode: "pretty", - suite: "run-pass-fulldeps", - default: false, - host: true -}); -test!(RunFailFullDepsPretty { - path: "src/test/run-fail-fulldeps/pretty", - mode: "pretty", - suite: "run-fail-fulldeps", - default: false, - host: true -}); default_test!(RunMake { path: "src/test/run-make", @@ -977,11 +966,16 @@ impl Step for Compiletest { } if builder.no_std(target) == Some(true) { - // for no_std run-make (e.g. thumb*), + // for no_std run-make (e.g., thumb*), // we need a host compiler which is called by cargo. builder.ensure(compile::Std { compiler, target: compiler.host }); } + // HACK(eddyb) ensure that `libproc_macro` is available on the host. + builder.ensure(compile::Test { compiler, target: compiler.host }); + // Also provide `rust_test_helpers` for the host. + builder.ensure(native::TestHelpers { target: compiler.host }); + builder.ensure(native::TestHelpers { target }); builder.ensure(RemoteCopyLibs { compiler, target }); @@ -1023,7 +1017,13 @@ impl Step for Compiletest { cmd.arg("--bless"); } - let compare_mode = builder.config.cmd.compare_mode().or(self.compare_mode); + let compare_mode = builder.config.cmd.compare_mode().or_else(|| { + if builder.config.test_compare_mode { + self.compare_mode + } else { + None + } + }); if let Some(ref nodejs) = builder.config.nodejs { cmd.arg("--nodejs").arg(nodejs); @@ -1049,7 +1049,11 @@ impl Step for Compiletest { cmd.arg("--linker").arg(linker); } - let hostflags = flags.clone(); + let mut hostflags = flags.clone(); + hostflags.push(format!( + "-Lnative={}", + builder.test_helpers_out(compiler.host).display() + )); cmd.arg("--host-rustcflags").arg(hostflags.join(" ")); let mut targetflags = flags; @@ -1084,9 +1088,7 @@ impl Step for Compiletest { }; let lldb_exe = if builder.config.lldb_enabled && !target.contains("emscripten") { // Test against the lldb that was just built. - builder.llvm_out(target) - .join("bin") - .join("lldb") + builder.llvm_out(target).join("bin").join("lldb") } else { PathBuf::from("lldb") }; @@ -1103,6 +1105,26 @@ impl Step for Compiletest { } } + if let Some(var) = env::var_os("RUSTBUILD_FORCE_CLANG_BASED_TESTS") { + match &var.to_string_lossy().to_lowercase()[..] { + "1" | "yes" | "on" => { + assert!(builder.config.lldb_enabled, + "RUSTBUILD_FORCE_CLANG_BASED_TESTS needs Clang/LLDB to \ + be built."); + let clang_exe = builder.llvm_out(target).join("bin").join("clang"); + cmd.arg("--run-clang-based-tests-with").arg(clang_exe); + } + "0" | "no" | "off" => { + // Nothing to do. + } + other => { + // Let's make sure typos don't get unnoticed + panic!("Unrecognized option '{}' set in \ + RUSTBUILD_FORCE_CLANG_BASED_TESTS", other); + } + } + } + // Get paths from cmd args let paths = match &builder.config.cmd { Subcommand::Test { ref paths, .. } => &paths[..], @@ -1268,7 +1290,7 @@ impl Step for DocTest { /// Run `rustdoc --test` for all documentation in `src/doc`. /// - /// This will run all tests in our markdown documentation (e.g. the book) + /// This will run all tests in our markdown documentation (e.g., the book) /// located in `src/doc`. The `rustdoc` that's run is the one that sits next to /// `compiler`. fn run(self, builder: &Builder) { @@ -1418,10 +1440,8 @@ impl Step for ErrorIndex { } fn markdown_test(builder: &Builder, compiler: Compiler, markdown: &Path) -> bool { - match File::open(markdown) { - Ok(mut file) => { - let mut contents = String::new(); - t!(file.read_to_string(&mut contents)); + match fs::read_to_string(markdown) { + Ok(contents) => { if !contents.contains("```") { return true; } @@ -1558,10 +1578,7 @@ impl Step for Crate { let builder = run.builder; run = run.krate("test"); for krate in run.builder.in_tree_crates("std") { - if krate.is_local(&run.builder) - && !(krate.name.starts_with("rustc_") && krate.name.ends_with("san")) - && krate.name != "dlmalloc" - { + if !(krate.name.starts_with("rustc_") && krate.name.ends_with("san")) { run = run.path(krate.local_path(&builder).to_str().unwrap()); } } diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 978e3602e7d..cd3afc59e56 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -1,29 +1,19 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fs; use std::env; -use std::iter; use std::path::PathBuf; use std::process::{Command, exit}; use std::collections::HashSet; -use Mode; -use Compiler; -use builder::{Step, RunConfig, ShouldRun, Builder}; -use util::{exe, add_lib_path}; -use compile; -use native; -use channel::GitInfo; -use cache::Interned; -use toolstate::ToolState; +use crate::Mode; +use crate::Compiler; +use crate::builder::{Step, RunConfig, ShouldRun, Builder}; +use crate::util::{exe, add_lib_path}; +use crate::compile; +use crate::native; +use crate::channel::GitInfo; +use crate::channel; +use crate::cache::Interned; +use crate::toolstate::ToolState; #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub enum SourceType { @@ -86,12 +76,13 @@ impl Step for ToolBuild { let _folder = builder.fold_output(|| format!("stage{}-{}", compiler.stage, tool)); builder.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target)); let mut duplicates = Vec::new(); - let is_expected = compile::stream_cargo(builder, &mut cargo, vec![], &mut |msg| { + let is_expected = compile::stream_cargo(builder, &mut cargo, &mut |msg| { // Only care about big things like the RLS/Cargo for now match tool { | "rls" | "cargo" | "clippy-driver" + | "miri" => {} _ => return, @@ -149,7 +140,7 @@ impl Step for ToolBuild { }); if is_expected && !duplicates.is_empty() { - println!("duplicate artfacts found when compiling a tool, this \ + println!("duplicate artifacts found when compiling a tool, this \ typically means that something was recompiled because \ a transitive dependency has different features activated \ than in a previous build:\n"); @@ -227,6 +218,7 @@ pub fn prepare_tool_cargo( if path.ends_with("cargo") || path.ends_with("rls") || path.ends_with("clippy") || + path.ends_with("miri") || path.ends_with("rustfmt") { cargo.env("LIBZ_SYS_STATIC", "1"); @@ -240,6 +232,7 @@ pub fn prepare_tool_cargo( cargo.env("CFG_RELEASE_CHANNEL", &builder.config.channel); cargo.env("CFG_VERSION", builder.rust_version()); + cargo.env("CFG_RELEASE_NUM", channel::CFG_RELEASE_NUM); let info = GitInfo::new(&builder.config, &dir); if let Some(sha) = info.sha() { @@ -258,8 +251,12 @@ pub fn prepare_tool_cargo( } macro_rules! tool { - ($($name:ident, $path:expr, $tool_name:expr, $mode:expr - $(,llvm_tools = $llvm:expr)* $(,is_external_tool = $external:expr)*;)+) => { + ($( + $name:ident, $path:expr, $tool_name:expr, $mode:expr + $(,llvm_tools = $llvm:expr)* + $(,is_external_tool = $external:expr)* + ; + )+) => { #[derive(Copy, PartialEq, Eq, Clone)] pub enum Tool { $( @@ -596,6 +593,14 @@ tool_extended!((self, builder), }); }; Miri, miri, "src/tools/miri", "miri", {}; + CargoMiri, miri, "src/tools/miri", "cargo-miri", { + // Miri depends on procedural macros (serde), which requires a full host + // compiler to be available, so we need to depend on that. + builder.ensure(compile::Rustc { + compiler: self.compiler, + target: builder.config.build, + }); + }; Rls, rls, "src/tools/rls", "rls", { let clippy = builder.ensure(Clippy { compiler: self.compiler, @@ -640,7 +645,7 @@ impl<'a> Builder<'a> { self.cargo_out(compiler, tool.get_mode(), *host).join("deps"), ]; - // On MSVC a tool may invoke a C compiler (e.g. compiletest in run-make + // On MSVC a tool may invoke a C compiler (e.g., compiletest in run-make // mode) and that C compiler may need some extra PATH modification. Do // so here. if compiler.host.contains("msvc") { @@ -660,19 +665,33 @@ impl<'a> Builder<'a> { // Add the llvm/bin directory to PATH since it contains lots of // useful, platform-independent tools - if tool.uses_llvm_tools() { + if tool.uses_llvm_tools() && !self.config.dry_run { + let mut additional_paths = vec![]; + if let Some(llvm_bin_path) = self.llvm_bin_path() { - if host.contains("windows") { - // On Windows, PATH and the dynamic library path are the same, - // so we just add the LLVM bin path to lib_path - lib_paths.push(llvm_bin_path); - } else { - let old_path = env::var_os("PATH").unwrap_or_default(); - let new_path = env::join_paths(iter::once(llvm_bin_path) - .chain(env::split_paths(&old_path))) - .expect("Could not add LLVM bin path to PATH"); - cmd.env("PATH", new_path); - } + additional_paths.push(llvm_bin_path); + } + + // If LLD is available, add that too. + if self.config.lld_enabled { + let lld_install_root = self.ensure(native::Lld { + target: self.config.build, + }); + + let lld_bin_path = lld_install_root.join("bin"); + additional_paths.push(lld_bin_path); + } + + if host.contains("windows") { + // On Windows, PATH and the dynamic library path are the same, + // so we just add the LLVM bin path to lib_path + lib_paths.extend(additional_paths); + } else { + let old_path = env::var_os("PATH").unwrap_or_default(); + let new_path = env::join_paths(additional_paths.into_iter() + .chain(env::split_paths(&old_path))) + .expect("Could not add LLVM bin path to PATH"); + cmd.env("PATH", new_path); } } @@ -680,7 +699,7 @@ impl<'a> Builder<'a> { } fn llvm_bin_path(&self) -> Option { - if self.config.llvm_enabled && !self.config.dry_run { + if self.config.llvm_enabled { let llvm_config = self.ensure(native::Llvm { target: self.config.build, emscripten: false, diff --git a/src/bootstrap/toolstate.rs b/src/bootstrap/toolstate.rs index f63c1988906..8ff7c09fc29 100644 --- a/src/bootstrap/toolstate.rs +++ b/src/bootstrap/toolstate.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] #[serde(rename_all = "kebab-case")] /// Whether a tool can be compiled, tested or neither diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs index 8ce8f20add3..37c6c040da8 100644 --- a/src/bootstrap/util.rs +++ b/src/bootstrap/util.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Various utility functions used throughout rustbuild. //! //! Simple things like testing the various filesystem operations here and there, @@ -21,8 +11,8 @@ use std::path::{Path, PathBuf}; use std::process::Command; use std::time::{SystemTime, Instant}; -use config::Config; -use builder::Builder; +use crate::config::Config; +use crate::builder::Builder; /// Returns the `name` as the filename of a static library for `target`. pub fn staticlib(name: &str, target: &str) -> String { @@ -80,7 +70,11 @@ pub fn dylib_path_var() -> &'static str { /// Parses the `dylib_path_var()` environment variable, returning a list of /// paths that are members of this lookup path. pub fn dylib_path() -> Vec { - env::split_paths(&env::var_os(dylib_path_var()).unwrap_or_default()).collect() + let var = match env::var_os(dylib_path_var()) { + Some(v) => v, + None => return vec![], + }; + env::split_paths(&var).collect() } /// `push` all components to `buf`. On windows, append `.exe` to the last component. @@ -203,11 +197,11 @@ pub fn symlink_dir(config: &Config, src: &Path, dest: &Path) -> io::Result<()> { // We're using low-level APIs to create the junction, and these are more // picky about paths. For example, forward slashes cannot be used as a // path separator, so we should try to canonicalize the path first. - let target = try!(fs::canonicalize(target)); + let target = fs::canonicalize(target)?; - try!(fs::create_dir(junction)); + fs::create_dir(junction)?; - let path = try!(to_u16s(junction)); + let path = to_u16s(junction)?; unsafe { let h = CreateFileW(path.as_ptr(), diff --git a/src/build_helper/lib.rs b/src/build_helper/lib.rs index 0cbb0802361..c66c5c92490 100644 --- a/src/build_helper/lib.rs +++ b/src/build_helper/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fs::File; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; @@ -33,6 +23,25 @@ macro_rules! t { }; } +// Because Cargo adds the compiler's dylib path to our library search path, llvm-config may +// break: the dylib path for the compiler, as of this writing, contains a copy of the LLVM +// shared library, which means that when our freshly built llvm-config goes to load it's +// associated LLVM, it actually loads the compiler's LLVM. In particular when building the first +// compiler (i.e., in stage 0) that's a problem, as the compiler's LLVM is likely different from +// the one we want to use. As such, we restore the environment to what bootstrap saw. This isn't +// perfect -- we might actually want to see something from Cargo's added library paths -- but +// for now it works. +pub fn restore_library_path() { + println!("cargo:rerun-if-env-changed=REAL_LIBRARY_PATH_VAR"); + println!("cargo:rerun-if-env-changed=REAL_LIBRARY_PATH"); + let key = env::var_os("REAL_LIBRARY_PATH_VAR").expect("REAL_LIBRARY_PATH_VAR"); + if let Some(env) = env::var_os("REAL_LIBRARY_PATH") { + env::set_var(&key, &env); + } else { + env::remove_var(&key); + } +} + pub fn run(cmd: &mut Command) { println!("running: {:?}", cmd); run_silent(cmd); @@ -224,14 +233,12 @@ impl Drop for NativeLibBoilerplate { // Timestamps are created automatically when the result of `native_lib_boilerplate` goes out // of scope, so all the build actions should be completed until then. pub fn native_lib_boilerplate( - src_name: &str, + src_dir: &Path, out_name: &str, link_name: &str, search_subdir: &str, ) -> Result { - let current_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); - let src_dir = current_dir.join("..").join(src_name); - rerun_if_changed_anything_in_dir(&src_dir); + rerun_if_changed_anything_in_dir(src_dir); let out_dir = env::var_os("RUSTBUILD_NATIVE_DIR").unwrap_or_else(|| env::var_os("OUT_DIR").unwrap()); @@ -248,9 +255,9 @@ pub fn native_lib_boilerplate( ); let timestamp = out_dir.join("rustbuild.timestamp"); - if !up_to_date(Path::new("build.rs"), ×tamp) || !up_to_date(&src_dir, ×tamp) { + if !up_to_date(Path::new("build.rs"), ×tamp) || !up_to_date(src_dir, ×tamp) { Ok(NativeLibBoilerplate { - src_dir: src_dir, + src_dir: src_dir.to_path_buf(), out_dir: out_dir, }) } else { @@ -279,8 +286,11 @@ pub fn sanitizer_lib_boilerplate(sanitizer_name: &str) } else { format!("static={}", link_name) }; + // The source for `compiler-rt` comes from the `compiler-builtins` crate, so + // load our env var set by cargo to find the source code. + let dir = env::var_os("DEP_COMPILER_RT_COMPILER_RT").unwrap(); let lib = native_lib_boilerplate( - "libcompiler_builtins/compiler-rt", + dir.as_ref(), sanitizer_name, &to_link, search_path, diff --git a/src/ci/docker/disabled/dist-x86_64-dragonfly/build-toolchain.sh b/src/ci/docker/disabled/dist-x86_64-dragonfly/build-toolchain.sh index 2ebbe0cdee9..112d747fe4e 100755 --- a/src/ci/docker/disabled/dist-x86_64-dragonfly/build-toolchain.sh +++ b/src/ci/docker/disabled/dist-x86_64-dragonfly/build-toolchain.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex diff --git a/src/ci/docker/disabled/dist-x86_64-haiku/build-toolchain.sh b/src/ci/docker/disabled/dist-x86_64-haiku/build-toolchain.sh index a1115e254b5..faf30f36a20 100755 --- a/src/ci/docker/disabled/dist-x86_64-haiku/build-toolchain.sh +++ b/src/ci/docker/disabled/dist-x86_64-haiku/build-toolchain.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex diff --git a/src/ci/docker/disabled/dist-x86_64-haiku/fetch-packages.sh b/src/ci/docker/disabled/dist-x86_64-haiku/fetch-packages.sh index a37532e203a..e4c9f86d268 100755 --- a/src/ci/docker/disabled/dist-x86_64-haiku/fetch-packages.sh +++ b/src/ci/docker/disabled/dist-x86_64-haiku/fetch-packages.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. wget http://packages.haiku-os.org/haikuports/master/hpkg/llvm-4.0.1-2-x86_64.hpkg wget http://packages.haiku-os.org/haikuports/master/hpkg/llvm_libs-4.0.1-2-x86_64.hpkg diff --git a/src/ci/docker/disabled/dist-x86_64-haiku/llvm-config.sh b/src/ci/docker/disabled/dist-x86_64-haiku/llvm-config.sh index fb5206bed22..83f3a6e5f12 100755 --- a/src/ci/docker/disabled/dist-x86_64-haiku/llvm-config.sh +++ b/src/ci/docker/disabled/dist-x86_64-haiku/llvm-config.sh @@ -1,13 +1,4 @@ #!/bin/sh -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. case $1 in --version) echo 4.0.1;; diff --git a/src/ci/docker/disabled/wasm32-exp/node.sh b/src/ci/docker/disabled/wasm32-exp/node.sh index 2bfddb0de99..aa938971c70 100755 --- a/src/ci/docker/disabled/wasm32-exp/node.sh +++ b/src/ci/docker/disabled/wasm32-exp/node.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. path="$(dirname $1)" file="$(basename $1)" diff --git a/src/ci/docker/dist-aarch64-linux/build-toolchains.sh b/src/ci/docker/dist-aarch64-linux/build-toolchains.sh index 22b719bb307..390ba1a1ddf 100755 --- a/src/ci/docker/dist-aarch64-linux/build-toolchains.sh +++ b/src/ci/docker/dist-aarch64-linux/build-toolchains.sh @@ -1,14 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex hide_output() { diff --git a/src/ci/docker/dist-android/Dockerfile b/src/ci/docker/dist-android/Dockerfile index e00c23dac89..a54a2d003b6 100644 --- a/src/ci/docker/dist-android/Dockerfile +++ b/src/ci/docker/dist-android/Dockerfile @@ -16,6 +16,7 @@ RUN . /scripts/android-ndk.sh && \ # env ENV TARGETS=arm-linux-androideabi ENV TARGETS=$TARGETS,armv7-linux-androideabi +ENV TARGETS=$TARGETS,thumbv7neon-linux-androideabi ENV TARGETS=$TARGETS,i686-linux-android ENV TARGETS=$TARGETS,aarch64-linux-android ENV TARGETS=$TARGETS,x86_64-linux-android @@ -24,6 +25,7 @@ ENV RUST_CONFIGURE_ARGS \ --enable-extended \ --arm-linux-androideabi-ndk=/android/ndk/arm-14 \ --armv7-linux-androideabi-ndk=/android/ndk/arm-14 \ + --thumbv7neon-linux-androideabi-ndk=/android/ndk/arm-14 \ --i686-linux-android-ndk=/android/ndk/x86-14 \ --aarch64-linux-android-ndk=/android/ndk/arm64-21 \ --x86_64-linux-android-ndk=/android/ndk/x86_64-21 \ diff --git a/src/ci/docker/dist-arm-linux/build-toolchains.sh b/src/ci/docker/dist-arm-linux/build-toolchains.sh index c53cca0bb98..2e790b77a96 100755 --- a/src/ci/docker/dist-arm-linux/build-toolchains.sh +++ b/src/ci/docker/dist-arm-linux/build-toolchains.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex diff --git a/src/ci/docker/dist-armhf-linux/build-toolchains.sh b/src/ci/docker/dist-armhf-linux/build-toolchains.sh index 964182a5ad5..a01c2e0eb0a 100755 --- a/src/ci/docker/dist-armhf-linux/build-toolchains.sh +++ b/src/ci/docker/dist-armhf-linux/build-toolchains.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex diff --git a/src/ci/docker/dist-armv7-linux/build-toolchains.sh b/src/ci/docker/dist-armv7-linux/build-toolchains.sh index 40adfe5d53e..28f8ba2437b 100755 --- a/src/ci/docker/dist-armv7-linux/build-toolchains.sh +++ b/src/ci/docker/dist-armv7-linux/build-toolchains.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex diff --git a/src/ci/docker/dist-powerpc-linux/build-powerpc-toolchain.sh b/src/ci/docker/dist-powerpc-linux/build-powerpc-toolchain.sh index 15211acb445..d2e39834d6e 100755 --- a/src/ci/docker/dist-powerpc-linux/build-powerpc-toolchain.sh +++ b/src/ci/docker/dist-powerpc-linux/build-powerpc-toolchain.sh @@ -1,14 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex hide_output() { diff --git a/src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh b/src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh index ac6460a4729..f7aa2cd3268 100755 --- a/src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh +++ b/src/ci/docker/dist-powerpc64-linux/build-powerpc64-toolchain.sh @@ -1,14 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex source shared.sh diff --git a/src/ci/docker/dist-powerpc64-linux/shared.sh b/src/ci/docker/dist-powerpc64-linux/shared.sh index 97e6d2908cf..b8735692789 100644 --- a/src/ci/docker/dist-powerpc64-linux/shared.sh +++ b/src/ci/docker/dist-powerpc64-linux/shared.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - hide_output() { set +x on_err=" diff --git a/src/ci/docker/dist-powerpc64le-linux/build-powerpc64le-toolchain.sh b/src/ci/docker/dist-powerpc64le-linux/build-powerpc64le-toolchain.sh index 2f6937afff0..a01803d9c8f 100755 --- a/src/ci/docker/dist-powerpc64le-linux/build-powerpc64le-toolchain.sh +++ b/src/ci/docker/dist-powerpc64le-linux/build-powerpc64le-toolchain.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex diff --git a/src/ci/docker/dist-powerpc64le-linux/shared.sh b/src/ci/docker/dist-powerpc64le-linux/shared.sh index 97e6d2908cf..b8735692789 100644 --- a/src/ci/docker/dist-powerpc64le-linux/shared.sh +++ b/src/ci/docker/dist-powerpc64le-linux/shared.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - hide_output() { set +x on_err=" diff --git a/src/ci/docker/dist-s390x-linux/build-s390x-toolchain.sh b/src/ci/docker/dist-s390x-linux/build-s390x-toolchain.sh index 306204dd0e1..df9529da8a1 100755 --- a/src/ci/docker/dist-s390x-linux/build-s390x-toolchain.sh +++ b/src/ci/docker/dist-s390x-linux/build-s390x-toolchain.sh @@ -1,14 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex hide_output() { diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile index c7e6af28f9d..ab2dd5a3992 100644 --- a/src/ci/docker/dist-various-1/Dockerfile +++ b/src/ci/docker/dist-various-1/Dockerfile @@ -21,12 +21,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ patch \ libssl-dev \ pkg-config \ - gcc-arm-none-eabi \ libnewlib-arm-none-eabi \ - qemu-system-arm + qemu-system-arm \ +# software-properties-common for the add-apt-repository command + software-properties-common WORKDIR /build +# Use the team-gcc-arm-embedded PPA for a newer version of Arm GCC +RUN add-apt-repository ppa:team-gcc-arm-embedded/ppa && \ + apt-get update && \ + apt-get install -y --no-install-recommends gcc-arm-embedded + COPY dist-various-1/build-rumprun.sh /build RUN ./build-rumprun.sh @@ -52,8 +58,8 @@ RUN env \ CXX=arm-linux-gnueabi-g++ CXXFLAGS="-march=armv6 -marm" \ bash musl.sh arm && \ env \ - CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv6 -marm" \ - CXX=arm-linux-gnueabihf-g++ CXXFLAGS="-march=armv6 -marm" \ + CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv6 -marm -mfpu=vfp" \ + CXX=arm-linux-gnueabihf-g++ CXXFLAGS="-march=armv6 -marm -mfpu=vfp" \ bash musl.sh armhf && \ env \ CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv7-a" \ @@ -103,19 +109,24 @@ ENV TARGETS=$TARGETS,thumbv6m-none-eabi ENV TARGETS=$TARGETS,thumbv7m-none-eabi ENV TARGETS=$TARGETS,thumbv7em-none-eabi ENV TARGETS=$TARGETS,thumbv7em-none-eabihf +ENV TARGETS=$TARGETS,thumbv8m.main-none-eabi ENV TARGETS=$TARGETS,riscv32imc-unknown-none-elf ENV TARGETS=$TARGETS,riscv32imac-unknown-none-elf ENV TARGETS=$TARGETS,armebv7r-none-eabi ENV TARGETS=$TARGETS,armebv7r-none-eabihf ENV TARGETS=$TARGETS,armv7r-none-eabi ENV TARGETS=$TARGETS,armv7r-none-eabihf +ENV TARGETS=$TARGETS,thumbv7neon-unknown-linux-gnueabihf ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \ CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc \ CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc \ - CC_armebv7r_none_eabi=arm-none-eabi-gcc - + CC_armebv7r_none_eabi=arm-none-eabi-gcc \ + CC_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \ + AR_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar \ + CXX_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++ + ENV RUST_CONFIGURE_ARGS \ --musl-root-armv5te=/musl-armv5te \ --musl-root-arm=/musl-arm \ diff --git a/src/ci/docker/dist-various-1/build-rumprun.sh b/src/ci/docker/dist-various-1/build-rumprun.sh index ad38cf872ad..9c7aaef4f43 100755 --- a/src/ci/docker/dist-various-1/build-rumprun.sh +++ b/src/ci/docker/dist-various-1/build-rumprun.sh @@ -1,14 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex hide_output() { diff --git a/src/ci/docker/dist-various-1/install-mips-musl.sh b/src/ci/docker/dist-various-1/install-mips-musl.sh index eeb4aacbbb7..8d05a046959 100755 --- a/src/ci/docker/dist-various-1/install-mips-musl.sh +++ b/src/ci/docker/dist-various-1/install-mips-musl.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex mkdir /usr/local/mips-linux-musl diff --git a/src/ci/docker/dist-various-1/install-mipsel-musl.sh b/src/ci/docker/dist-various-1/install-mipsel-musl.sh index 74b6a10e77a..2c414744bf4 100755 --- a/src/ci/docker/dist-various-1/install-mipsel-musl.sh +++ b/src/ci/docker/dist-various-1/install-mipsel-musl.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex mkdir /usr/local/mipsel-linux-musl diff --git a/src/ci/docker/dist-various-1/install-x86_64-redox.sh b/src/ci/docker/dist-various-1/install-x86_64-redox.sh index 9bfb57f5741..c39be14941c 100755 --- a/src/ci/docker/dist-various-1/install-x86_64-redox.sh +++ b/src/ci/docker/dist-various-1/install-x86_64-redox.sh @@ -1,14 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - # ignore-tidy-linelength set -ex @@ -16,7 +6,7 @@ set -ex apt-get update apt-get install -y --no-install-recommends software-properties-common apt-transport-https -apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys AA12E97F0881517F +apt-key adv --batch --yes --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys AA12E97F0881517F add-apt-repository -y 'deb https://static.redox-os.org/toolchain/apt /' apt-get update diff --git a/src/ci/docker/dist-various-2/Dockerfile b/src/ci/docker/dist-various-2/Dockerfile index 944c2a51b8d..97892405b8e 100644 --- a/src/ci/docker/dist-various-2/Dockerfile +++ b/src/ci/docker/dist-various-2/Dockerfile @@ -29,6 +29,10 @@ RUN /tmp/build-fuchsia-toolchain.sh COPY dist-various-2/build-solaris-toolchain.sh /tmp/ RUN /tmp/build-solaris-toolchain.sh x86_64 amd64 solaris-i386 RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc +COPY dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/ +# We pass the commit id of the port of LLVM's libunwind to the build script. +# Any update to the commit id here, should cause the container image to be re-built from this point on. +RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh "53b586346f2c7870e20b170decdc30729d97c42b" COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh @@ -65,6 +69,9 @@ ENV TARGETS=$TARGETS,wasm32-unknown-unknown ENV TARGETS=$TARGETS,x86_64-sun-solaris ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32 ENV TARGETS=$TARGETS,x86_64-unknown-cloudabi +ENV TARGETS=$TARGETS,x86_64-fortanix-unknown-sgx + +ENV X86_FORTANIX_SGX_LIBS="/x86_64-fortanix-unknown-sgx/lib/" ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --disable-docs ENV SCRIPT python2.7 ../x.py dist --target $TARGETS diff --git a/src/ci/docker/dist-various-2/build-cloudabi-toolchain.sh b/src/ci/docker/dist-various-2/build-cloudabi-toolchain.sh index 8c04d849e8d..391f9b2fff8 100755 --- a/src/ci/docker/dist-various-2/build-cloudabi-toolchain.sh +++ b/src/ci/docker/dist-various-2/build-cloudabi-toolchain.sh @@ -1,13 +1,4 @@ #!/bin/bash -# Copyright 2018 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -eux diff --git a/src/ci/docker/dist-various-2/build-fuchsia-toolchain.sh b/src/ci/docker/dist-various-2/build-fuchsia-toolchain.sh index ec19f7c4f45..ef486075ff9 100755 --- a/src/ci/docker/dist-various-2/build-fuchsia-toolchain.sh +++ b/src/ci/docker/dist-various-2/build-fuchsia-toolchain.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. # ignore-tidy-linelength diff --git a/src/ci/docker/dist-various-2/build-solaris-toolchain.sh b/src/ci/docker/dist-various-2/build-solaris-toolchain.sh index c04c8b7194c..4b3f284450e 100755 --- a/src/ci/docker/dist-various-2/build-solaris-toolchain.sh +++ b/src/ci/docker/dist-various-2/build-solaris-toolchain.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex source shared.sh diff --git a/src/ci/docker/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh b/src/ci/docker/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh new file mode 100755 index 00000000000..725ec341b94 --- /dev/null +++ b/src/ci/docker/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +set -eu +source shared.sh + +if [ -z "$1" ]; then + echo "Usage: ${0} " + exit -1 +fi + +target="x86_64-fortanix-unknown-sgx" +url="https://github.com/fortanix/llvm-project/archive/${1}.tar.gz" +repo_name="llvm-project" + +install_prereq() { + apt-get update + apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + cmake \ + git +} + +build_unwind() { + set -x + dir_name="${target}_temp" + rm -rf ${dir_name} + mkdir -p ${dir_name} + pushd ${dir_name} + + # Clone Fortanix's fork of llvm-project which has a port of libunwind + fetch_github_commit_archive "$repo_name" "$url" + cd "${repo_name}/libunwind" + + # Build libunwind + mkdir -p build + cd build + cmake -DCMAKE_BUILD_TYPE="RELEASE" -DRUST_SGX=1 -G "Unix Makefiles" \ + -DLLVM_ENABLE_WARNINGS=1 -DLIBUNWIND_ENABLE_WERROR=1 -DLIBUNWIND_ENABLE_PEDANTIC=0 \ + -DLLVM_PATH=../../llvm/ ../ + make unwind_static + install -D "lib/libunwind.a" "/${target}/lib/libunwind.a" + + popd + rm -rf ${dir_name} + + { set +x; } 2>/dev/null +} + +set -x +hide_output install_prereq +build_unwind diff --git a/src/ci/docker/dist-various-2/shared.sh b/src/ci/docker/dist-various-2/shared.sh index e26c6eb6645..7abace65b9c 100644 --- a/src/ci/docker/dist-various-2/shared.sh +++ b/src/ci/docker/dist-various-2/shared.sh @@ -1,15 +1,5 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - hide_output() { - set +x + { set +x; } 2>/dev/null on_err=" echo ERROR: An error was encountered with the build. cat /tmp/build.log @@ -23,3 +13,34 @@ exit 1 kill $PING_LOOP_PID set -x } + +# Copied from ../../shared.sh +function retry { + echo "Attempting with retry:" "$@" + local n=1 + local max=5 + while true; do + "$@" && break || { + if [[ $n -lt $max ]]; then + sleep $n # don't retry immediately + ((n++)) + echo "Command failed. Attempt $n/$max:" + else + echo "The command has failed after $n attempts." + return 1 + fi + } + done +} + +# Copied from ../../init_repo.sh +function fetch_github_commit_archive { + local module=$1 + local cached="download-${module//\//-}.tar.gz" + retry sh -c "rm -f $cached && \ + curl -f -sSL -o $cached $2" + mkdir $module + touch "$module/.git" + tar -C $module --strip-components=1 -xf $cached + rm $cached +} diff --git a/src/ci/docker/dist-x86_64-linux/build-binutils.sh b/src/ci/docker/dist-x86_64-linux/build-binutils.sh index f4bdbd80d0e..ed0b5c85f7c 100755 --- a/src/ci/docker/dist-x86_64-linux/build-binutils.sh +++ b/src/ci/docker/dist-x86_64-linux/build-binutils.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex diff --git a/src/ci/docker/dist-x86_64-linux/build-clang.sh b/src/ci/docker/dist-x86_64-linux/build-clang.sh index 2762f0bf7ec..ff5b50123fd 100755 --- a/src/ci/docker/dist-x86_64-linux/build-clang.sh +++ b/src/ci/docker/dist-x86_64-linux/build-clang.sh @@ -1,43 +1,31 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex source shared.sh -LLVM=7.0.0 +# Currently these commits are all tip-of-tree as of 2018-12-16, used to pick up +# a fix for rust-lang/rust#56849 +LLVM=032b00a5404865765cda7db3039f39d54964d8b0 +LLD=3e4aa4e8671523321af51449e0569f455ef3ad43 +CLANG=a6b9739069763243020f4ea6fe586bc135fde1f9 mkdir clang cd clang -curl https://releases.llvm.org/$LLVM/llvm-$LLVM.src.tar.xz | \ - xz -d | \ - tar xf - - -cd llvm-$LLVM.src +curl -L https://github.com/llvm-mirror/llvm/archive/$LLVM.tar.gz | \ + tar xzf - --strip-components=1 mkdir -p tools/clang - -curl https://releases.llvm.org/$LLVM/cfe-$LLVM.src.tar.xz | \ - xz -d | \ - tar xf - -C tools/clang --strip-components=1 +curl -L https://github.com/llvm-mirror/clang/archive/$CLANG.tar.gz | \ + tar xzf - --strip-components=1 -C tools/clang mkdir -p tools/lld +curl -L https://github.com/llvm-mirror/lld/archive/$LLD.tar.gz | \ + tar zxf - --strip-components=1 -C tools/lld -curl https://releases.llvm.org/$LLVM/lld-$LLVM.src.tar.xz | \ - xz -d | \ - tar xf - -C tools/lld --strip-components=1 - -mkdir ../clang-build -cd ../clang-build +mkdir clang-build +cd clang-build # For whatever reason the default set of include paths for clang is different # than that of gcc. As a result we need to manually include our sysroot's @@ -55,7 +43,7 @@ INC="$INC:/rustroot/lib/gcc/x86_64-unknown-linux-gnu/4.8.5/include-fixed" INC="$INC:/usr/include" hide_output \ - cmake ../llvm-$LLVM.src \ + cmake .. \ -DCMAKE_C_COMPILER=/rustroot/bin/gcc \ -DCMAKE_CXX_COMPILER=/rustroot/bin/g++ \ -DCMAKE_BUILD_TYPE=Release \ diff --git a/src/ci/docker/dist-x86_64-linux/build-cmake.sh b/src/ci/docker/dist-x86_64-linux/build-cmake.sh index 9a3763d421a..84522a7b87a 100755 --- a/src/ci/docker/dist-x86_64-linux/build-cmake.sh +++ b/src/ci/docker/dist-x86_64-linux/build-cmake.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex source shared.sh diff --git a/src/ci/docker/dist-x86_64-linux/build-curl.sh b/src/ci/docker/dist-x86_64-linux/build-curl.sh index edf3175b81c..fb8b63d7920 100755 --- a/src/ci/docker/dist-x86_64-linux/build-curl.sh +++ b/src/ci/docker/dist-x86_64-linux/build-curl.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex source shared.sh diff --git a/src/ci/docker/dist-x86_64-linux/build-gcc.sh b/src/ci/docker/dist-x86_64-linux/build-gcc.sh index 62ea2506f4e..9f3ae55cb3f 100755 --- a/src/ci/docker/dist-x86_64-linux/build-gcc.sh +++ b/src/ci/docker/dist-x86_64-linux/build-gcc.sh @@ -1,14 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex source shared.sh diff --git a/src/ci/docker/dist-x86_64-linux/build-git.sh b/src/ci/docker/dist-x86_64-linux/build-git.sh index aa31f50ba03..38fea2a8094 100755 --- a/src/ci/docker/dist-x86_64-linux/build-git.sh +++ b/src/ci/docker/dist-x86_64-linux/build-git.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex source shared.sh diff --git a/src/ci/docker/dist-x86_64-linux/build-headers.sh b/src/ci/docker/dist-x86_64-linux/build-headers.sh index 2f15114d6f9..b623e53583b 100755 --- a/src/ci/docker/dist-x86_64-linux/build-headers.sh +++ b/src/ci/docker/dist-x86_64-linux/build-headers.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex source shared.sh diff --git a/src/ci/docker/dist-x86_64-linux/build-openssl.sh b/src/ci/docker/dist-x86_64-linux/build-openssl.sh index e7226ace020..7e391e21d13 100755 --- a/src/ci/docker/dist-x86_64-linux/build-openssl.sh +++ b/src/ci/docker/dist-x86_64-linux/build-openssl.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex source shared.sh diff --git a/src/ci/docker/dist-x86_64-linux/build-perl.sh b/src/ci/docker/dist-x86_64-linux/build-perl.sh index 4715fb55348..a6c3d5cb683 100755 --- a/src/ci/docker/dist-x86_64-linux/build-perl.sh +++ b/src/ci/docker/dist-x86_64-linux/build-perl.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2018 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex source shared.sh diff --git a/src/ci/docker/dist-x86_64-linux/build-python.sh b/src/ci/docker/dist-x86_64-linux/build-python.sh index c6b8cdde4b9..c172b978112 100755 --- a/src/ci/docker/dist-x86_64-linux/build-python.sh +++ b/src/ci/docker/dist-x86_64-linux/build-python.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex source shared.sh diff --git a/src/ci/docker/dist-x86_64-linux/shared.sh b/src/ci/docker/dist-x86_64-linux/shared.sh index 97e6d2908cf..b8735692789 100644 --- a/src/ci/docker/dist-x86_64-linux/shared.sh +++ b/src/ci/docker/dist-x86_64-linux/shared.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - hide_output() { set +x on_err=" diff --git a/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh b/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh index e730dd86087..ac92d68a1f5 100755 --- a/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh +++ b/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh @@ -1,14 +1,4 @@ #!/usr/bin/env bash -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - # ignore-tidy-linelength set -ex diff --git a/src/ci/docker/mingw-check/Dockerfile b/src/ci/docker/mingw-check/Dockerfile index aab339f399c..24e2dea4ca7 100644 --- a/src/ci/docker/mingw-check/Dockerfile +++ b/src/ci/docker/mingw-check/Dockerfile @@ -20,4 +20,6 @@ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1 -ENV SCRIPT python2.7 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu +ENV SCRIPT python2.7 ../x.py check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu && \ + python2.7 ../x.py build --stage 0 src/tools/build-manifest && \ + python2.7 ../x.py test --stage 0 src/tools/compiletest diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh index 3a7714d32fa..ad6188568cf 100755 --- a/src/ci/docker/run.sh +++ b/src/ci/docker/run.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -e @@ -28,10 +19,12 @@ travis_time_start if [ -f "$docker_dir/$image/Dockerfile" ]; then if [ "$CI" != "" ]; then - cksum=$(find $docker_dir/$image $docker_dir/scripts -type f | \ + hash_key=/tmp/.docker-hash-key.txt + find $docker_dir/$image $docker_dir/scripts -type f | \ sort | \ - xargs cat | \ - sha512sum | \ + xargs cat >> $hash_key + docker --version >> $hash_key + cksum=$(sha512sum $hash_key | \ awk '{print $1}') s3url="s3://$SCCACHE_BUCKET/docker/$cksum" url="https://s3-us-west-1.amazonaws.com/$SCCACHE_BUCKET/docker/$cksum" diff --git a/src/ci/docker/scripts/android-base-apt-get.sh b/src/ci/docker/scripts/android-base-apt-get.sh index 7ae3bf39a38..738410c58fc 100644 --- a/src/ci/docker/scripts/android-base-apt-get.sh +++ b/src/ci/docker/scripts/android-base-apt-get.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex apt-get update diff --git a/src/ci/docker/scripts/android-ndk.sh b/src/ci/docker/scripts/android-ndk.sh index ec030496d39..0db30e420e3 100644 --- a/src/ci/docker/scripts/android-ndk.sh +++ b/src/ci/docker/scripts/android-ndk.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex URL=https://dl.google.com/android/repository diff --git a/src/ci/docker/scripts/android-sdk.sh b/src/ci/docker/scripts/android-sdk.sh index 99c5776c2e8..179f63fc830 100644 --- a/src/ci/docker/scripts/android-sdk.sh +++ b/src/ci/docker/scripts/android-sdk.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex export ANDROID_HOME=/android/sdk @@ -30,7 +20,7 @@ download_sysimage() { # The output from sdkmanager is so noisy that it will occupy all of the 4 MB # log extremely quickly. Thus we must silence all output. yes | sdkmanager --licenses > /dev/null - sdkmanager platform-tools emulator \ + yes | sdkmanager platform-tools emulator \ "platforms;android-$api" \ "system-images;android-$api;default;$abi" > /dev/null } diff --git a/src/ci/docker/scripts/android-start-emulator.sh b/src/ci/docker/scripts/android-start-emulator.sh index cd3369d5ead..09f0d13759c 100755 --- a/src/ci/docker/scripts/android-start-emulator.sh +++ b/src/ci/docker/scripts/android-start-emulator.sh @@ -1,13 +1,4 @@ #!/bin/sh -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -ex diff --git a/src/ci/docker/scripts/cross-apt-packages.sh b/src/ci/docker/scripts/cross-apt-packages.sh index f6c9cc960c5..51945fd72ad 100644 --- a/src/ci/docker/scripts/cross-apt-packages.sh +++ b/src/ci/docker/scripts/cross-apt-packages.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - apt-get update && apt-get install -y --no-install-recommends \ automake \ bison \ diff --git a/src/ci/docker/scripts/crosstool-ng.sh b/src/ci/docker/scripts/crosstool-ng.sh index 4cd25ffa277..2773e687ebe 100644 --- a/src/ci/docker/scripts/crosstool-ng.sh +++ b/src/ci/docker/scripts/crosstool-ng.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex url="https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-1.22.0.tar.gz" diff --git a/src/ci/docker/scripts/emscripten-wasm.sh b/src/ci/docker/scripts/emscripten-wasm.sh index 18499060a20..e4a93d7a100 100644 --- a/src/ci/docker/scripts/emscripten-wasm.sh +++ b/src/ci/docker/scripts/emscripten-wasm.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex hide_output() { diff --git a/src/ci/docker/scripts/emscripten.sh b/src/ci/docker/scripts/emscripten.sh index 1d7b33db9ed..d3b1cded6f5 100644 --- a/src/ci/docker/scripts/emscripten.sh +++ b/src/ci/docker/scripts/emscripten.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex hide_output() { diff --git a/src/ci/docker/scripts/freebsd-toolchain.sh b/src/ci/docker/scripts/freebsd-toolchain.sh index 15ed318f8ce..04483e24925 100755 --- a/src/ci/docker/scripts/freebsd-toolchain.sh +++ b/src/ci/docker/scripts/freebsd-toolchain.sh @@ -1,14 +1,4 @@ #!/bin/bash -# Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -eux arch=$1 diff --git a/src/ci/docker/scripts/make3.sh b/src/ci/docker/scripts/make3.sh index ec6e046c964..47cb4158229 100644 --- a/src/ci/docker/scripts/make3.sh +++ b/src/ci/docker/scripts/make3.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex curl -f https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - diff --git a/src/ci/docker/scripts/musl.sh b/src/ci/docker/scripts/musl.sh index 11d85471b7c..116c16b2f35 100644 --- a/src/ci/docker/scripts/musl.sh +++ b/src/ci/docker/scripts/musl.sh @@ -1,13 +1,3 @@ -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex hide_output() { diff --git a/src/ci/docker/scripts/qemu-bare-bones-addentropy.c b/src/ci/docker/scripts/qemu-bare-bones-addentropy.c index 8975739e3c0..815b5b04f09 100644 --- a/src/ci/docker/scripts/qemu-bare-bones-addentropy.c +++ b/src/ci/docker/scripts/qemu-bare-bones-addentropy.c @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #include #include #include diff --git a/src/ci/docker/scripts/rustbuild-setup.sh b/src/ci/docker/scripts/rustbuild-setup.sh index 96efccfdff3..94d7e600eac 100644 --- a/src/ci/docker/scripts/rustbuild-setup.sh +++ b/src/ci/docker/scripts/rustbuild-setup.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -ex groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild diff --git a/src/ci/docker/scripts/sccache.sh b/src/ci/docker/scripts/sccache.sh index da52d083181..e05246201dd 100644 --- a/src/ci/docker/scripts/sccache.sh +++ b/src/ci/docker/scripts/sccache.sh @@ -1,13 +1,3 @@ -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - # ignore-tidy-linelength set -ex diff --git a/src/ci/docker/x86_64-gnu-debug/Dockerfile b/src/ci/docker/x86_64-gnu-debug/Dockerfile index bdde7ad7fe8..1c7eff68adc 100644 --- a/src/ci/docker/x86_64-gnu-debug/Dockerfile +++ b/src/ci/docker/x86_64-gnu-debug/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:18.10 RUN apt-get update && apt-get install -y --no-install-recommends \ g++ \ @@ -7,18 +7,37 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ python2.7 \ + python2.7-dev \ + libxml2-dev \ + libncurses-dev \ + libedit-dev \ + swig \ + doxygen \ git \ cmake \ sudo \ gdb \ - xz-utils + xz-utils \ + lld \ + clang COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +ENV RUSTBUILD_FORCE_CLANG_BASED_TESTS 1 ENV RUN_CHECK_WITH_PARALLEL_QUERIES 1 + ENV RUST_CONFIGURE_ARGS \ --build=x86_64-unknown-linux-gnu \ --enable-debug \ - --enable-optimize -ENV SCRIPT python2.7 ../x.py build + --enable-lld \ + --enable-lldb \ + --enable-optimize \ + --set llvm.use-linker=lld \ + --set target.x86_64-unknown-linux-gnu.linker=clang \ + --set target.x86_64-unknown-linux-gnu.cc=clang \ + --set target.x86_64-unknown-linux-gnu.cxx=clang++ + +ENV SCRIPT \ + python2.7 ../x.py build && \ + python2.7 ../x.py test src/test/run-make-fulldeps --test-args clang diff --git a/src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile b/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile similarity index 89% rename from src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile rename to src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile index 4f90c509726..160b23e0b00 100644 --- a/src/ci/docker/x86_64-gnu-llvm-5.0/Dockerfile +++ b/src/ci/docker/x86_64-gnu-llvm-6.0/Dockerfile @@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ sudo \ gdb \ - llvm-5.0-tools \ + llvm-6.0-tools \ libedit-dev \ zlib1g-dev \ xz-utils @@ -22,6 +22,6 @@ RUN sh /scripts/sccache.sh # using llvm-link-shared due to libffi issues -- see #34486 ENV RUST_CONFIGURE_ARGS \ --build=x86_64-unknown-linux-gnu \ - --llvm-root=/usr/lib/llvm-5.0 \ + --llvm-root=/usr/lib/llvm-6.0 \ --enable-llvm-link-shared ENV RUST_CHECK_TARGET check diff --git a/src/ci/docker/x86_64-gnu-nopt/Dockerfile b/src/ci/docker/x86_64-gnu-nopt/Dockerfile index d2b0dd13dc2..b0780fdf32a 100644 --- a/src/ci/docker/x86_64-gnu-nopt/Dockerfile +++ b/src/ci/docker/x86_64-gnu-nopt/Dockerfile @@ -16,5 +16,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --disable-optimize-tests +ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu \ + --disable-optimize-tests \ + --set rust.test-compare-mode ENV RUST_CHECK_TARGET check diff --git a/src/ci/docker/x86_64-gnu-tools/checkregression.py b/src/ci/docker/x86_64-gnu-tools/checkregression.py index 208aab434ce..0cc0a6329e5 100755 --- a/src/ci/docker/x86_64-gnu-tools/checkregression.py +++ b/src/ci/docker/x86_64-gnu-tools/checkregression.py @@ -1,16 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright 2018 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - import sys import json diff --git a/src/ci/docker/x86_64-gnu-tools/checktools.sh b/src/ci/docker/x86_64-gnu-tools/checktools.sh index d876cb7f37a..2e5b3359501 100755 --- a/src/ci/docker/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/x86_64-gnu-tools/checktools.sh @@ -1,15 +1,5 @@ #!/bin/sh -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - set -eu X_PY="$1" diff --git a/src/ci/docker/x86_64-gnu-tools/repo.sh b/src/ci/docker/x86_64-gnu-tools/repo.sh index 807e6fb7b64..6364bc2aabf 100644 --- a/src/ci/docker/x86_64-gnu-tools/repo.sh +++ b/src/ci/docker/x86_64-gnu-tools/repo.sh @@ -1,15 +1,5 @@ #!/bin/sh -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - # This file provides the function `commit_toolstate_change` for pushing a change # to the `rust-toolstate` repository. # diff --git a/src/ci/init_repo.sh b/src/ci/init_repo.sh index f2664e6d196..3dfd3381576 100755 --- a/src/ci/init_repo.sh +++ b/src/ci/init_repo.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -o errexit set -o pipefail @@ -43,18 +34,19 @@ if grep -q RUST_RELEASE_CHANNEL=beta src/ci/run.sh; then git fetch origin --unshallow beta master fi -function fetch_submodule { +# Duplicated in docker/dist-various-2/shared.sh +function fetch_github_commit_archive { local module=$1 local cached="download-${module//\//-}.tar.gz" retry sh -c "rm -f $cached && \ - curl -sSL -o $cached $2" + curl -f -sSL -o $cached $2" mkdir $module touch "$module/.git" tar -C $module --strip-components=1 -xf $cached rm $cached } -included="src/llvm src/llvm-emscripten src/doc/book src/doc/rust-by-example" +included="src/llvm-project src/llvm-emscripten src/doc/book src/doc/rust-by-example" modules="$(git config --file .gitmodules --get-regexp '\.path$' | cut -d' ' -f2)" modules=($modules) use_git="" @@ -67,7 +59,7 @@ for i in ${!modules[@]}; do git rm $module url=${urls[$i]} url=${url/\.git/} - fetch_submodule $module "$url/archive/$commit.tar.gz" & + fetch_github_commit_archive $module "$url/archive/$commit.tar.gz" & continue else use_git="$use_git $module" diff --git a/src/ci/run.sh b/src/ci/run.sh index 8e0eb8fec43..0f2517c7d1f 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -1,13 +1,4 @@ #!/usr/bin/env bash -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. set -e @@ -91,7 +82,7 @@ fi SCCACHE_IDLE_TIMEOUT=10800 sccache --start-server || true if [ "$RUN_CHECK_WITH_PARALLEL_QUERIES" != "" ]; then - $SRC/configure --enable-experimental-parallel-queries + $SRC/configure --enable-parallel-compiler CARGO_INCREMENTAL=0 python2.7 ../x.py check rm -f config.toml rm -rf build @@ -130,7 +121,14 @@ fi travis_fold end log-system-info if [ ! -z "$SCRIPT" ]; then + # This `set +e` followed by capturing the return value is a temporary measure + # to help debug "error with exit 259" on AppVeyor temporarily, otherwise all + # that's needed here is the `sh` + set +e sh -x -c "$SCRIPT" + ret=$? + echo "script exited with $ret" + exit $ret else do_make() { travis_fold start "make-$1" diff --git a/src/ci/shared.sh b/src/ci/shared.sh index bb6945f0fd6..3ba64ad4120 100644 --- a/src/ci/shared.sh +++ b/src/ci/shared.sh @@ -1,19 +1,11 @@ #!/bin/false -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. # This file is intended to be sourced with `. shared.sh` or # `source shared.sh`, hence the invalid shebang and not being # marked as an executable file in git. # See http://unix.stackexchange.com/questions/82598 +# Duplicated in docker/dist-various-2/shared.sh function retry { echo "Attempting with retry:" "$@" local n=1 diff --git a/src/dlmalloc b/src/dlmalloc deleted file mode 160000 index c99638dc2ec..00000000000 --- a/src/dlmalloc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c99638dc2ecfc750cc1656f6edb2bd062c1e0981 diff --git a/src/doc/book b/src/doc/book index e871c459892..0e9061cbaf9 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit e871c4598925594421d63e929fee292e6e071f97 +Subproject commit 0e9061cbaf95adfb9f3ed36c6cef4c046f282e86 diff --git a/src/doc/edition-guide b/src/doc/edition-guide new file mode 160000 index 00000000000..419edb885ec --- /dev/null +++ b/src/doc/edition-guide @@ -0,0 +1 @@ +Subproject commit 419edb885ec1a98c0747b3907003d79e3e6b93a9 diff --git a/src/doc/index.md b/src/doc/index.md index 33ee76739c5..7bd1854d86f 100644 --- a/src/doc/index.md +++ b/src/doc/index.md @@ -21,6 +21,9 @@ nav { #search-but:hover, #search-input:focus { border-color: #55a9ff; } +h2 { + font-size: 18px; +} Welcome to an overview of the documentation provided by the Rust project. @@ -68,6 +71,10 @@ accomplishing various tasks. +## The Edition Guide + +[The Edition Guide](edition-guide/index.html) describes the Rust editions. + ## The Rustc Book [The Rustc Book](rustc/index.html) describes the Rust compiler, `rustc`. @@ -104,3 +111,9 @@ Rust. It's also sometimes called "the 'nomicon." ## The Unstable Book [The Unstable Book](unstable-book/index.html) has documentation for unstable features. + +## The `rustc` Contribution Guide + +[The `rustc` Guide](https://rust-lang.github.io/rustc-guide/) documents how +the compiler works and how to contribute to it. This is useful if you want to build +or modify the Rust compiler from source (e.g. to target something non-standard). diff --git a/src/doc/nomicon b/src/doc/nomicon index 7f7a597b47e..b7eb4a08720 160000 --- a/src/doc/nomicon +++ b/src/doc/nomicon @@ -1 +1 @@ -Subproject commit 7f7a597b47ed6c35c2a0f0ee6a69050fe2d5e013 +Subproject commit b7eb4a087207af2405c0669fa577f8545b894c66 diff --git a/src/doc/reference b/src/doc/reference index b9fb838054b..1c775a1dc5e 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit b9fb838054b8441223c22eeae5b6d8e498071cd0 +Subproject commit 1c775a1dc5e29bc44b36604b510d6196d98077fa diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index bc342a475c0..2ce92beabb9 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit bc342a475c09b6df8004d518382e6d5b6bcb49f7 +Subproject commit 2ce92beabb912d417a7314d6da83ac9b50dc2afb diff --git a/src/doc/rust.css b/src/doc/rust.css index 5f216169efe..631f64a11db 100644 --- a/src/doc/rust.css +++ b/src/doc/rust.css @@ -1,15 +1,3 @@ -/** - * Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT - * file at the top-level directory of this distribution and at - * http://rust-lang.org/COPYRIGHT. - * With elements taken from Bootstrap v3.0.2 (MIT licensed). - * - * Licensed under the Apache License, Version 2.0 or the MIT license - * , at your - * option. This file may not be copied, modified, or distributed - * except according to those terms. - */ @font-face { font-family: 'Fira Sans'; font-style: normal; diff --git a/src/doc/rustc-guide b/src/doc/rustc-guide new file mode 160000 index 00000000000..344c4e437ba --- /dev/null +++ b/src/doc/rustc-guide @@ -0,0 +1 @@ +Subproject commit 344c4e437ba4cfa5c14db643ec4d6b68dcd164c5 diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md index 4fc5f42dd55..a616409d9a4 100644 --- a/src/doc/rustc/src/codegen-options/index.md +++ b/src/doc/rustc/src/codegen-options/index.md @@ -22,6 +22,13 @@ This flag lets you append a single extra argument to the linker invocation. This flag lets you append multiple extra arguments to the linker invocation. The options should be separated by spaces. +## linker-flavor + +This flag lets you control the linker flavor used by `rustc`. If a linker is given with the +`-C linker` flag described above then the linker flavor is inferred from the value provided. If no +linker is given then the linker flavor is used to determine the linker to use. Every `rustc` target +defaults to some linker flavor. + ## link-dead-code Normally, the linker will remove dead code. This flag disables this behavior. @@ -180,7 +187,7 @@ This flag lets you control debug information: This flag lets you control the optimization level. -* `0`: no optimizations +* `0`: no optimizations, also turn on `cfg(debug_assertions)`. * `1`: basic optimizations * `2`: some optimizations * `3`: all optimizations diff --git a/src/doc/rustc/src/contributing.md b/src/doc/rustc/src/contributing.md index fcb8e6b27db..25a5c97b0a1 100644 --- a/src/doc/rustc/src/contributing.md +++ b/src/doc/rustc/src/contributing.md @@ -1,6 +1,12 @@ # Contributing to rustc We'd love to have your help improving `rustc`! To that end, we've written [a -whole book](https://rust-lang-nursery.github.io/rustc-guide/) on its +whole book][rustc_guide] on its internals, how it works, and how to get started working on it. To learn -more, you'll want to check that out. \ No newline at end of file +more, you'll want to check that out. + +If you would like to contribute to _this_ book, you can find its source in the +rustc source at [src/doc/rustc][rustc_book]. + +[rustc_guide]: https://rust-lang.github.io/rustc-guide/ +[rustc_book]: https://github.com/rust-lang/rust/tree/master/src/doc/rustc diff --git a/src/doc/rustc/src/lints/listing/warn-by-default.md b/src/doc/rustc/src/lints/listing/warn-by-default.md index b01aed0915d..7fbbe686b5b 100644 --- a/src/doc/rustc/src/lints/listing/warn-by-default.md +++ b/src/doc/rustc/src/lints/listing/warn-by-default.md @@ -24,7 +24,7 @@ warning: attempt to add with overflow ## dead-code -This lint detects detect unused, unexported items. Some +This lint detects unused, unexported items. Some example code that triggers this lint: ```rust @@ -44,7 +44,7 @@ warning: function is never used: `foo` ## deprecated -This lint detects detects use of deprecated items. Some +This lint detects use of deprecated items. Some example code that triggers this lint: ```rust @@ -119,7 +119,7 @@ warning: found struct without foreign-function-safe representation annotation in ## late-bound-lifetime-arguments -This lint detects detects generic lifetime arguments in path segments with +This lint detects generic lifetime arguments in path segments with late bound lifetime parameters. Some example code that triggers this lint: ```rust @@ -381,7 +381,7 @@ extern crate macro_crate_test; ## private-in-public -This lint detects detect private items in public interfaces not caught by the old implementation. Some +This lint detects private items in public interfaces not caught by the old implementation. Some example code that triggers this lint: ```rust,ignore @@ -659,7 +659,7 @@ warning: unknown lint: `not_a_real_lint` ## unreachable-code -This lint detects detects unreachable code paths. Some example code that +This lint detects unreachable code paths. Some example code that triggers this lint: ```rust,no_run @@ -681,7 +681,7 @@ warning: unreachable statement ## unreachable-patterns -This lint detects detects unreachable patterns. Some +This lint detects unreachable patterns. Some example code that triggers this lint: ```rust @@ -716,11 +716,11 @@ annotations now. ## unused-allocation -This lint detects detects unnecessary allocations that can be eliminated. +This lint detects unnecessary allocations that can be eliminated. ## unused-assignments -This lint detects detect assignments that will never be read. Some +This lint detects assignments that will never be read. Some example code that triggers this lint: ```rust @@ -741,7 +741,7 @@ warning: value assigned to `x` is never read ## unused-attributes -This lint detects detects attributes that were not used by the compiler. Some +This lint detects attributes that were not used by the compiler. Some example code that triggers this lint: ```rust @@ -785,7 +785,7 @@ warning: comparison is useless due to type limits ## unused-doc-comment -This lint detects detects doc comments that aren't used by rustdoc. Some +This lint detects doc comments that aren't used by rustdoc. Some example code that triggers this lint: ```rust @@ -831,7 +831,7 @@ warning: unused import: `std::collections::HashMap` ## unused-macros -This lint detects detects macros that were not used. Some example code that +This lint detects macros that were not used. Some example code that triggers this lint: ```rust @@ -884,7 +884,7 @@ warning: unused `std::result::Result` that must be used ## unused-mut -This lint detects detect mut variables which don't need to be mutable. Some +This lint detects mut variables which don't need to be mutable. Some example code that triggers this lint: ```rust @@ -946,7 +946,7 @@ warning: unnecessary `unsafe` block ## unused-variables -This lint detects detect variables which are not used in any way. Some +This lint detects variables which are not used in any way. Some example code that triggers this lint: ```rust diff --git a/src/doc/rustc/src/targets/built-in.md b/src/doc/rustc/src/targets/built-in.md index 8620346e5b7..2e94ebe345a 100644 --- a/src/doc/rustc/src/targets/built-in.md +++ b/src/doc/rustc/src/targets/built-in.md @@ -6,5 +6,5 @@ the team is supporting directly. To see the list of built-in targets, you can run `rustc --print target-list`, or look at [the API -docs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_back/target/#modules). +docs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/index.html#modules). Each module there defines a builder for a particular target. \ No newline at end of file diff --git a/src/doc/rustc/src/targets/index.md b/src/doc/rustc/src/targets/index.md index 07e3a79471f..3d63d072bef 100644 --- a/src/doc/rustc/src/targets/index.md +++ b/src/doc/rustc/src/targets/index.md @@ -4,7 +4,7 @@ architecture. The list of *targets* are the possible architectures that you can build for. To see all the options that you can set with a target, see the docs -[here](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_back/target/struct.Target.html). +[here](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/struct.Target.html). To compile to a particular target, use the `--target` flag: diff --git a/src/doc/rustc/src/what-is-rustc.md b/src/doc/rustc/src/what-is-rustc.md index bed1b71c24e..9dcc9f7daa9 100644 --- a/src/doc/rustc/src/what-is-rustc.md +++ b/src/doc/rustc/src/what-is-rustc.md @@ -50,7 +50,7 @@ fn main() { And a `foo.rs` that had this: ```rust,ignore -fn hello() { +pub fn hello() { println!("Hello, world!"); } ``` @@ -65,4 +65,4 @@ No need to tell `rustc` about `foo.rs`; the `mod` statements give it everything that it needs. This is different than how you would use a C compiler, where you invoke the compiler on each file, and then link everything together. In other words, the *crate* is a translation unit, not a -particular module. \ No newline at end of file +particular module. diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index dd8dcb7ff9b..dcc13f53493 100644 --- a/src/doc/rustdoc/src/documentation-tests.md +++ b/src/doc/rustdoc/src/documentation-tests.md @@ -171,7 +171,7 @@ compiles, while only showing the parts that are relevant to that part of your explanation. The `#`-hiding of lines can be prevented by using two consecutive hashes -`##`. This only needs to be done with with the first `#` which would've +`##`. This only needs to be done with the first `#` which would've otherwise caused hiding. If we have a string literal like the following, which has a line that starts with a `#`: diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index 43cdab27e9d..d3eb8cb3d3b 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -402,3 +402,30 @@ Using `index-page` option enables `enable-index-page` option as well. ### `--enable-index-page`: generate a default index page for docs This feature allows the generation of a default index-page which lists the generated crates. + +### `--static-root-path`: control how static files are loaded in HTML output + +Using this flag looks like this: + +```bash +$ rustdoc src/lib.rs -Z unstable-options --static-root-path '/cache/' +``` + +This flag controls how rustdoc links to its static files on HTML pages. If you're hosting a lot of +crates' docs generated by the same version of rustdoc, you can use this flag to cache rustdoc's CSS, +JavaScript, and font files in a single location, rather than duplicating it once per "doc root" +(grouping of crate docs generated into the same output directory, like with `cargo doc`). Per-crate +files like the search index will still load from the documentation root, but anything that gets +renamed with `--resource-suffix` will load from the given path. + +### `--persist-doctests`: persist doctest executables after running + +Using this flag looks like this: + +```bash +$ rustdoc src/lib.rs --test -Z unstable-options --persist-doctests target/rustdoctest +``` + +This flag allows you to keep doctest executables around after they're compiled or run. +Usually, rustdoc will immediately discard a compiled doctest after it's been tested, but +with this option, you can keep those binaries around for farther testing. \ No newline at end of file diff --git a/src/doc/unstable-book/src/compiler-flags/linker-flavor.md b/src/doc/unstable-book/src/compiler-flags/linker-flavor.md deleted file mode 100644 index 39659602e01..00000000000 --- a/src/doc/unstable-book/src/compiler-flags/linker-flavor.md +++ /dev/null @@ -1,61 +0,0 @@ -# `linker-flavor` - -The tracking issue for this feature is: None - ------------------------- - -Every `rustc` target defaults to some linker. For example, Linux targets default -to gcc. In some cases, you may want to override the default; you can do that -with the unstable CLI argument: `-Z linker-flavor`. - -Here how you would use this flag to link a Rust binary for the -`thumbv7m-none-eabi` using LLD instead of GCC. - -``` text -$ xargo rustc --target thumbv7m-none-eabi -- \ - -C linker=ld.lld \ - -Z linker-flavor=ld \ - -Z print-link-args | tr ' ' '\n' -"ld.lld" -"-L" -"$SYSROOT/lib/rustlib/thumbv7m-none-eabi/lib" -"$PWD/target/thumbv7m-none-eabi/debug/deps/app-512e9dbf385f233c.0.o" -"-o" -"$PWD/target/thumbv7m-none-eabi/debug/deps/app-512e9dbf385f233c" -"--gc-sections" -"-L" -"$PWD/target/thumbv7m-none-eabi/debug/deps" -"-L" -"$PWD/target/debug/deps" -"-L" -"$SYSROOT/lib/rustlib/thumbv7m-none-eabi/lib" -"-Bstatic" -"$SYSROOT/lib/rustlib/thumbv7m-none-eabi/lib/libcore-e1ccb7dfb1cb9ebb.rlib" -"-Bdynamic" -``` - -Whereas the default is: - -``` text -$ xargo rustc --target thumbv7m-none-eabi -- \ - -C link-arg=-nostartfiles \ - -Z print-link-args | tr ' ' '\n' -"arm-none-eabi-gcc" -"-L" -"$SYSROOT/lib/rustlib/thumbv7m-none-eabi/lib" -"$PWD/target/thumbv7m-none-eabi/debug/deps/app-961e39416baa38d9.0.o" -"-o" -"$PWD/target/thumbv7m-none-eabi/debug/deps/app-961e39416baa38d9" -"-Wl,--gc-sections" -"-nodefaultlibs" -"-L" -"$PWD/target/thumbv7m-none-eabi/debug/deps" -"-L" -"$PWD/target/debug/deps" -"-L" -"$SYSROOT/lib/rustlib/thumbv7m-none-eabi/lib" -"-Wl,-Bstatic" -"$SYSROOT/lib/rustlib/thumbv7m-none-eabi/lib/libcore-e1ccb7dfb1cb9ebb.rlib" -"-nostartfiles" -"-Wl,-Bdynamic" -``` diff --git a/src/doc/unstable-book/src/language-features/cfg-attr-multi.md b/src/doc/unstable-book/src/language-features/cfg-attr-multi.md deleted file mode 100644 index 6365d3e71c6..00000000000 --- a/src/doc/unstable-book/src/language-features/cfg-attr-multi.md +++ /dev/null @@ -1,20 +0,0 @@ -# `cfg_attr_multi` - -The tracking issue for this feature is: [#54881] -The RFC for this feature is: [#2539] - -[#54881]: https://github.com/rust-lang/rust/issues/54881 -[#2539]: https://github.com/rust-lang/rfcs/pull/2539 - ------------------------- - -This feature flag lets you put multiple attributes into a `cfg_attr` attribute. - -Example: - -```rust,ignore -#[cfg_attr(all(), must_use, optimize)] -``` - -Because `cfg_attr` resolves before procedural macros, this does not affect -macro resolution at all. \ No newline at end of file diff --git a/src/doc/unstable-book/src/language-features/const-fn.md b/src/doc/unstable-book/src/language-features/const-fn.md index d5a22436838..50dbbaf5674 100644 --- a/src/doc/unstable-book/src/language-features/const-fn.md +++ b/src/doc/unstable-book/src/language-features/const-fn.md @@ -1,8 +1,8 @@ # `const_fn` -The tracking issue for this feature is: [#24111] +The tracking issue for this feature is: [#57563] -[#24111]: https://github.com/rust-lang/rust/issues/24111 +[#57563]: https://github.com/rust-lang/rust/issues/57563 ------------------------ diff --git a/src/doc/unstable-book/src/language-features/crate-visibility-modifier.md b/src/doc/unstable-book/src/language-features/crate-visibility-modifier.md index 11b3ee8edf0..b59859dd348 100644 --- a/src/doc/unstable-book/src/language-features/crate-visibility-modifier.md +++ b/src/doc/unstable-book/src/language-features/crate-visibility-modifier.md @@ -1,8 +1,8 @@ # `crate_visibility_modifier` -The tracking issue for this feature is: [#45388] +The tracking issue for this feature is: [#53120] -[#45388]: https://github.com/rust-lang/rust/issues/45388 +[#53120]: https://github.com/rust-lang/rust/issues/53120 ----- diff --git a/src/doc/unstable-book/src/language-features/extern-in-paths.md b/src/doc/unstable-book/src/language-features/extern-in-paths.md deleted file mode 100644 index 9979d774229..00000000000 --- a/src/doc/unstable-book/src/language-features/extern-in-paths.md +++ /dev/null @@ -1,40 +0,0 @@ -# `extern_in_paths` - -The tracking issue for this feature is: [#44660] - -[#44660]: https://github.com/rust-lang/rust/issues/44660 - ------------------------- - -The `extern_in_paths` feature allows to refer to names from other crates "inline", without -introducing `extern crate` items, using keyword `extern`. - -For example, `extern::my_crat::a::b` will resolve to path `a::b` in crate `my_crate`. - -Absolute paths on 2018 edition (e.g. `::my_crate::a::b`) provide the same effect -and resolve to extern crates (built-in or passed with `--extern`). - -```rust,ignore -#![feature(extern_in_paths)] - -// Suppose we have a dependency crate `xcrate` available through `Cargo.toml`, or `--extern` -// options, or standard Rust distribution, or some other means. - -use extern::xcrate::Z; - -fn f() { - use extern::xcrate; - use extern::xcrate as ycrate; - let s = xcrate::S; - assert_eq!(format!("{:?}", s), "S"); - let z = ycrate::Z; - assert_eq!(format!("{:?}", z), "Z"); -} - -fn main() { - let s = extern::xcrate::S; - assert_eq!(format!("{:?}", s), "S"); - let z = Z; - assert_eq!(format!("{:?}", z), "Z"); -} -``` diff --git a/src/doc/unstable-book/src/language-features/generators.md b/src/doc/unstable-book/src/language-features/generators.md index 8e888de90a9..426fc01a6b0 100644 --- a/src/doc/unstable-book/src/language-features/generators.md +++ b/src/doc/unstable-book/src/language-features/generators.md @@ -29,6 +29,7 @@ A syntactical example of a generator is: #![feature(generators, generator_trait)] use std::ops::{Generator, GeneratorState}; +use std::pin::Pin; fn main() { let mut generator = || { @@ -36,11 +37,11 @@ fn main() { return "foo" }; - match unsafe { generator.resume() } { + match Pin::new(&mut generator).resume() { GeneratorState::Yielded(1) => {} _ => panic!("unexpected value from resume"), } - match unsafe { generator.resume() } { + match Pin::new(&mut generator).resume() { GeneratorState::Complete("foo") => {} _ => panic!("unexpected value from resume"), } @@ -60,6 +61,7 @@ prints all numbers in order: #![feature(generators, generator_trait)] use std::ops::Generator; +use std::pin::Pin; fn main() { let mut generator = || { @@ -69,9 +71,9 @@ fn main() { }; println!("1"); - unsafe { generator.resume() }; + Pin::new(&mut generator).resume(); println!("3"); - unsafe { generator.resume() }; + Pin::new(&mut generator).resume(); println!("5"); } ``` @@ -86,13 +88,14 @@ Feedback on the design and usage is always appreciated! The `Generator` trait in `std::ops` currently looks like: ``` -# #![feature(generator_trait)] +# #![feature(arbitrary_self_types, generator_trait)] # use std::ops::GeneratorState; +# use std::pin::Pin; pub trait Generator { type Yield; type Return; - unsafe fn resume(&mut self) -> GeneratorState; + fn resume(self: Pin<&mut Self>) -> GeneratorState; } ``` @@ -149,7 +152,7 @@ closure-like semantics. Namely: * Whenever a generator is dropped it will drop all captured environment variables. -Note that unlike closures generators at this time cannot take any arguments. +Note that unlike closures, generators at this time cannot take any arguments. That is, generators must always look like `|| { ... }`. This restriction may be lifted at a future date, the design is ongoing! @@ -167,6 +170,7 @@ Let's take a look at an example to see what's going on here: #![feature(generators, generator_trait)] use std::ops::Generator; +use std::pin::Pin; fn main() { let ret = "foo"; @@ -175,17 +179,18 @@ fn main() { return ret }; - unsafe { generator.resume() }; - unsafe { generator.resume() }; + Pin::new(&mut generator).resume(); + Pin::new(&mut generator).resume(); } ``` This generator literal will compile down to something similar to: ```rust -#![feature(generators, generator_trait)] +#![feature(arbitrary_self_types, generators, generator_trait)] use std::ops::{Generator, GeneratorState}; +use std::pin::Pin; fn main() { let ret = "foo"; @@ -200,9 +205,9 @@ fn main() { type Yield = i32; type Return = &'static str; - unsafe fn resume(&mut self) -> GeneratorState { + fn resume(mut self: Pin<&mut Self>) -> GeneratorState { use std::mem; - match mem::replace(self, __Generator::Done) { + match mem::replace(&mut *self, __Generator::Done) { __Generator::Start(s) => { *self = __Generator::Yield1(s); GeneratorState::Yielded(1) @@ -223,8 +228,8 @@ fn main() { __Generator::Start(ret) }; - unsafe { generator.resume() }; - unsafe { generator.resume() }; + Pin::new(&mut generator).resume(); + Pin::new(&mut generator).resume(); } ``` diff --git a/src/doc/unstable-book/src/language-features/irrefutable-let-patterns.md b/src/doc/unstable-book/src/language-features/irrefutable-let-patterns.md deleted file mode 100644 index 46b843778e8..00000000000 --- a/src/doc/unstable-book/src/language-features/irrefutable-let-patterns.md +++ /dev/null @@ -1,28 +0,0 @@ -# `irrefutable_let_patterns` - -The tracking issue for this feature is: [#44495] - -[#44495]: https://github.com/rust-lang/rust/issues/44495 - ------------------------- - -This feature changes the way that "irrefutable patterns" are handled -in the `if let` and `while let` forms. An *irrefutable pattern* is one -that cannot fail to match -- for example, the `_` pattern matches any -value, and hence it is "irrefutable". Without this feature, using an -irrefutable pattern in an `if let` gives a hard error (since often -this indicates programmer error). But when the feature is enabled, the -error becomes a lint (since in some cases irrefutable patterns are -expected). This means you can use `#[allow]` to silence the lint: - -```rust -#![feature(irrefutable_let_patterns)] - -#[allow(irrefutable_let_patterns)] -fn main() { - // These two examples used to be errors, but now they - // trigger a lint (that is allowed): - if let _ = 5 {} - while let _ = 5 { break; } -} -``` diff --git a/src/doc/unstable-book/src/language-features/macro-at-most-once-rep.md b/src/doc/unstable-book/src/language-features/macro-at-most-once-rep.md deleted file mode 100644 index 251fc720912..00000000000 --- a/src/doc/unstable-book/src/language-features/macro-at-most-once-rep.md +++ /dev/null @@ -1,22 +0,0 @@ -# `macro_at_most_once_rep` - -NOTE: This feature is only available in the 2018 Edition. - -The tracking issue for this feature is: #48075 - -With this feature gate enabled, one can use `?` as a Kleene operator meaning "0 -or 1 repetitions" in a macro definition. Previously only `+` and `*` were allowed. - -For example: - -```rust,ignore -#![feature(macro_at_most_once_rep)] - -macro_rules! foo { - (something $(,)?) // `?` indicates `,` is "optional"... - => {} -} -``` - ------------------------- - diff --git a/src/doc/unstable-book/src/language-features/macro-literal-matcher.md b/src/doc/unstable-book/src/language-features/macro-literal-matcher.md deleted file mode 100644 index 7e3638fd1cf..00000000000 --- a/src/doc/unstable-book/src/language-features/macro-literal-matcher.md +++ /dev/null @@ -1,17 +0,0 @@ -# `macro_literal_matcher` - -The tracking issue for this feature is: [#35625] - -The RFC is: [rfc#1576]. - -With this feature gate enabled, the [list of fragment specifiers][frags] gains one more entry: - -* `literal`: a literal. Examples: 2, "string", 'c' - -A `literal` may be followed by anything, similarly to the `ident` specifier. - -[rfc#1576]: http://rust-lang.github.io/rfcs/1576-macros-literal-matcher.html -[#35625]: https://github.com/rust-lang/rust/issues/35625 -[frags]: ../book/first-edition/macros.html#syntactic-requirements - ------------------------- diff --git a/src/doc/unstable-book/src/language-features/marker-trait-attr.md b/src/doc/unstable-book/src/language-features/marker-trait-attr.md index 9dd7b6fae9b..dedc7d3015d 100644 --- a/src/doc/unstable-book/src/language-features/marker-trait-attr.md +++ b/src/doc/unstable-book/src/language-features/marker-trait-attr.md @@ -17,15 +17,17 @@ when they'd need to do the same thing for every type anyway). ```rust #![feature(marker_trait_attr)] -use std::fmt::{Debug, Display}; +#[marker] trait CheapToClone: Clone {} -#[marker] trait MyMarker {} +impl CheapToClone for T {} -impl MyMarker for T {} -impl MyMarker for T {} +// These could potentally overlap with the blanket implementation above, +// so are only allowed because CheapToClone is a marker trait. +impl CheapToClone for (T, U) {} +impl CheapToClone for std::ops::Range {} -fn foo(t: T) -> T { - t +fn cheap_clone(t: T) -> T { + t.clone() } ``` diff --git a/src/doc/unstable-book/src/language-features/non-ascii-idents.md b/src/doc/unstable-book/src/language-features/non-ascii-idents.md index efb5495fe26..46957c00bf9 100644 --- a/src/doc/unstable-book/src/language-features/non-ascii-idents.md +++ b/src/doc/unstable-book/src/language-features/non-ascii-idents.md @@ -1,8 +1,8 @@ # `non_ascii_idents` -The tracking issue for this feature is: [#28979] +The tracking issue for this feature is: [#55467] -[#28979]: https://github.com/rust-lang/rust/issues/28979 +[#55467]: https://github.com/rust-lang/rust/issues/55467 ------------------------ diff --git a/src/doc/unstable-book/src/language-features/plugin.md b/src/doc/unstable-book/src/language-features/plugin.md index b408d5d0805..cab350381d2 100644 --- a/src/doc/unstable-book/src/language-features/plugin.md +++ b/src/doc/unstable-book/src/language-features/plugin.md @@ -52,6 +52,7 @@ that implements Roman numeral integer literals. #![feature(plugin_registrar, rustc_private)] extern crate syntax; +extern crate syntax_pos; extern crate rustc; extern crate rustc_plugin; @@ -59,7 +60,7 @@ use syntax::parse::token; use syntax::tokenstream::TokenTree; use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager}; use syntax::ext::build::AstBuilder; // A trait for expr_usize. -use syntax::ext::quote::rt::Span; +use syntax_pos::Span; use rustc_plugin::Registry; fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree]) @@ -137,8 +138,6 @@ of extensions. See `Registry::register_syntax_extension` and the ## Tips and tricks -Some of the [macro debugging tips](../book/first-edition/macros.html#debugging-macro-code) are applicable. - You can use `syntax::parse` to turn token trees into higher-level syntax elements like expressions: @@ -183,7 +182,6 @@ that warns about any item named `lintme`. ```rust,ignore #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -#![feature(macro_at_most_once_rep)] extern crate syntax; diff --git a/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md b/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md new file mode 100644 index 00000000000..1e74652a890 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/re-rebalance-coherence.md @@ -0,0 +1,23 @@ +# `re_rebalance_coherence` + +The tracking issue for this feature is: [#55437] + +[#55437]: https://github.com/rust-lang/rust/issues/55437 + +------------------------ + +The `re_rebalance_coherence` feature tweaks the rules regarding which trait +impls are allowed in crates. +The following rule is used: + +Given `impl Trait for T0`, an impl is valid only if at +least one of the following is true: +- `Trait` is a local trait +- All of + - At least one of the types `T0..=Tn` must be a local type. Let `Ti` be the + first such type. + - No uncovered type parameters `P1..=Pn` may appear in `T0..Ti` (excluding + `Ti`) + + +See the [RFC](https://github.com/rust-lang/rfcs/blob/master/text/2451-re-rebalancing-coherence.md) for details. diff --git a/src/doc/unstable-book/src/language-features/repr-packed.md b/src/doc/unstable-book/src/language-features/repr-packed.md deleted file mode 100644 index 2dd763d04b0..00000000000 --- a/src/doc/unstable-book/src/language-features/repr-packed.md +++ /dev/null @@ -1,8 +0,0 @@ -# `repr_packed` - -The tracking issue for this feature is [#33158] - -[#33158]: https://github.com/rust-lang/rust/issues/33158 - ------------------------- - diff --git a/src/doc/unstable-book/src/language-features/self-in-typedefs.md b/src/doc/unstable-book/src/language-features/self-in-typedefs.md deleted file mode 100644 index 2416e85c17d..00000000000 --- a/src/doc/unstable-book/src/language-features/self-in-typedefs.md +++ /dev/null @@ -1,24 +0,0 @@ -# `self_in_typedefs` - -The tracking issue for this feature is: [#49303] - -[#49303]: https://github.com/rust-lang/rust/issues/49303 - ------------------------- - -The `self_in_typedefs` feature gate lets you use the special `Self` identifier -in `struct`, `enum`, and `union` type definitions. - -A simple example is: - -```rust -#![feature(self_in_typedefs)] - -enum List -where - Self: PartialOrd // can write `Self` instead of `List` -{ - Nil, - Cons(T, Box) // likewise here -} -``` diff --git a/src/doc/unstable-book/src/language-features/self-struct-ctor.md b/src/doc/unstable-book/src/language-features/self-struct-ctor.md deleted file mode 100644 index b4742c48a32..00000000000 --- a/src/doc/unstable-book/src/language-features/self-struct-ctor.md +++ /dev/null @@ -1,33 +0,0 @@ -# `self_struct_ctor` - -The tracking issue for this feature is: [#51994] -[#51994]: https://github.com/rust-lang/rust/issues/51994 - ------------------------- - -The `self_struct_ctor` feature gate lets you use the special `Self` -identifier as a constructor and a pattern. - -A simple example is: - -```rust -#![feature(self_struct_ctor)] - -struct ST(i32, i32); - -impl ST { - fn new() -> Self { - ST(0, 1) - } - - fn ctor() -> Self { - Self(1,2) // constructed by `Self`, it is the same as `ST(1, 2)` - } - - fn pattern(self) { - match self { - Self(x, y) => println!("{} {}", x, y), // used as a pattern - } - } -} -``` diff --git a/src/doc/unstable-book/src/language-features/type-alias-enum-variants.md b/src/doc/unstable-book/src/language-features/type-alias-enum-variants.md new file mode 100644 index 00000000000..bcdeafc4b11 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/type-alias-enum-variants.md @@ -0,0 +1,36 @@ +# `type_alias_enum_variants` + +The tracking issue for this feature is: [#49683] + +[#49683]: https://github.com/rust-lang/rust/issues/49683 + +------------------------ + +The `type_alias_enum_variants` feature enables the use of variants on type +aliases that refer to enums, as both a constructor and a pattern. That is, +it allows for the syntax `EnumAlias::Variant`, which behaves exactly the same +as `Enum::Variant` (assuming that `EnumAlias` is an alias for some enum type +`Enum`). + +Note that since `Self` exists as a type alias, this feature also enables the +use of the syntax `Self::Variant` within an impl block for an enum type. + +```rust +#![feature(type_alias_enum_variants)] + +enum Foo { + Bar(i32), + Baz { i: i32 }, +} + +type Alias = Foo; + +fn main() { + let t = Alias::Bar(0); + let t = Alias::Baz { i: 0 }; + match t { + Alias::Bar(_i) => {} + Alias::Baz { i: _i } => {} + } +} +``` diff --git a/src/doc/unstable-book/src/language-features/unsized-locals.md b/src/doc/unstable-book/src/language-features/unsized-locals.md index 6f7cf754ae0..edc039f896b 100644 --- a/src/doc/unstable-book/src/language-features/unsized-locals.md +++ b/src/doc/unstable-book/src/language-features/unsized-locals.md @@ -8,7 +8,7 @@ The tracking issue for this feature is: [#48055] This implements [RFC1909]. When turned on, you can have unsized arguments and locals: -[RFC1909]: https://github.com/rust-lang/rfcs/blob/master/text/1909-coercions.md +[RFC1909]: https://github.com/rust-lang/rfcs/blob/master/text/1909-unsized-rvalues.md ```rust #![feature(unsized_locals)] @@ -80,8 +80,6 @@ fn main() { } ``` -However, the current implementation allows `MyTupleStruct(..)` to be unsized. This will be fixed in the future. - ## By-value trait objects With this feature, you can have by-value `self` arguments without `Self: Sized` bounds. diff --git a/src/doc/unstable-book/src/library-features/is-sorted.md b/src/doc/unstable-book/src/library-features/is-sorted.md new file mode 100644 index 00000000000..e3b7dc3b28e --- /dev/null +++ b/src/doc/unstable-book/src/library-features/is-sorted.md @@ -0,0 +1,11 @@ +# `is_sorted` + +The tracking issue for this feature is: [#53485] + +[#53485]: https://github.com/rust-lang/rust/issues/53485 + +------------------------ + +Add the methods `is_sorted`, `is_sorted_by` and `is_sorted_by_key` to `[T]`; +add the methods `is_sorted`, `is_sorted_by` and `is_sorted_by_key` to +`Iterator`. diff --git a/src/etc/cat-and-grep.sh b/src/etc/cat-and-grep.sh index 361e8d8e60e..77dc52a9350 100755 --- a/src/etc/cat-and-grep.sh +++ b/src/etc/cat-and-grep.sh @@ -1,16 +1,6 @@ #!/bin/sh set -eu -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - # Performs `cat` and `grep` simultaneously for `run-make` tests in the Rust CI. # # This program will read lines from stdin and print them to stdout immediately. diff --git a/src/etc/debugger_pretty_printers_common.py b/src/etc/debugger_pretty_printers_common.py index 1797f6708ac..385ce8efab8 100644 --- a/src/etc/debugger_pretty_printers_common.py +++ b/src/etc/debugger_pretty_printers_common.py @@ -1,13 +1,3 @@ -# Copyright 2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - """ This module provides an abstraction layer over common Rust pretty printing functionality needed by both GDB and LLDB. @@ -352,8 +342,7 @@ def extract_length_ptr_and_cap_from_std_vec(vec_val): vec_ptr_val = buf.get_child_at_index(0) capacity = buf.get_child_at_index(1).as_integer() - unique_ptr_val = vec_ptr_val.get_child_at_index(0) - data_ptr = unique_ptr_val.get_child_at_index(0) + data_ptr = vec_ptr_val.get_child_at_index(0) assert data_ptr.type.get_dwarf_type_kind() == DWARF_TYPE_CODE_PTR return (length, data_ptr, capacity) @@ -370,37 +359,10 @@ def extract_tail_head_ptr_and_cap_from_std_vecdeque(vec_val): vec_ptr_val = buf.get_child_at_index(0) capacity = buf.get_child_at_index(1).as_integer() - unique_ptr_val = vec_ptr_val.get_child_at_index(0) - data_ptr = unique_ptr_val.get_child_at_index(0) + data_ptr = vec_ptr_val.get_child_at_index(0) assert data_ptr.type.get_dwarf_type_kind() == DWARF_TYPE_CODE_PTR return (tail, head, data_ptr, capacity) - -def extract_length_and_ptr_from_std_btreeset(vec_val): - assert vec_val.type.get_type_kind() == TYPE_KIND_STD_BTREESET - map = vec_val.get_child_at_index(0) - root = map.get_child_at_index(0) - length = map.get_child_at_index(1).as_integer() - node = root.get_child_at_index(0) - ptr = node.get_child_at_index(0) - unique_ptr_val = ptr.get_child_at_index(0) - data_ptr = unique_ptr_val.get_child_at_index(0) - assert data_ptr.type.get_dwarf_type_kind() == DWARF_TYPE_CODE_PTR - return (length, data_ptr) - - -def extract_length_and_ptr_from_std_btreemap(vec_val): - assert vec_val.type.get_type_kind() == TYPE_KIND_STD_BTREEMAP - root = vec_val.get_child_at_index(0) - length = vec_val.get_child_at_index(1).as_integer() - node = root.get_child_at_index(0) - ptr = node.get_child_at_index(0) - unique_ptr_val = ptr.get_child_at_index(0) - data_ptr = unique_ptr_val.get_child_at_index(0) - assert data_ptr.type.get_dwarf_type_kind() == DWARF_TYPE_CODE_PTR - return (length, data_ptr) - - def extract_length_and_ptr_from_slice(slice_val): assert (slice_val.type.get_type_kind() == TYPE_KIND_SLICE or slice_val.type.get_type_kind() == TYPE_KIND_STR_SLICE) diff --git a/src/etc/dec2flt_table.py b/src/etc/dec2flt_table.py index 9fdab1fcfca..2ffaf13dc8f 100644 --- a/src/etc/dec2flt_table.py +++ b/src/etc/dec2flt_table.py @@ -1,14 +1,4 @@ #!/usr/bin/env python2.7 -# -# Copyright 2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. """ Generate powers of ten using William Clinger's ``AlgorithmM`` for use in @@ -93,16 +83,6 @@ def error(f, e, z): return float(ulp_err) HEADER = """ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Tables of approximations of powers of ten. //! DO NOT MODIFY: Generated by `src/etc/dec2flt_table.py` """ diff --git a/src/etc/gdb_load_rust_pretty_printers.py b/src/etc/gdb_load_rust_pretty_printers.py index 755cac153d1..c551346bb00 100644 --- a/src/etc/gdb_load_rust_pretty_printers.py +++ b/src/etc/gdb_load_rust_pretty_printers.py @@ -1,12 +1,2 @@ -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - import gdb_rust_pretty_printing gdb_rust_pretty_printing.register_printers(gdb.current_objfile()) diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py index e6d5ef1a23f..a6b09722e1c 100755 --- a/src/etc/gdb_rust_pretty_printing.py +++ b/src/etc/gdb_rust_pretty_printing.py @@ -1,14 +1,5 @@ -# Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - import gdb +import re import sys import debugger_pretty_printers_common as rustpp @@ -18,6 +9,18 @@ if sys.version_info[0] >= 3: xrange = range +rust_enabled = 'set language rust' in gdb.execute('complete set language ru', to_string = True) + +# The btree pretty-printers fail in a confusing way unless +# https://sourceware.org/bugzilla/show_bug.cgi?id=21763 is fixed. +# This fix went in 8.1, so check for that. +# See https://github.com/rust-lang/rust/issues/56730 +gdb_81 = False +_match = re.search('([0-9]+)\\.([0-9]+)', gdb.VERSION) +if _match: + if int(_match.group(1)) > 8 or (int(_match.group(1)) == 8 and int(_match.group(2)) >= 1): + gdb_81 = True + #=============================================================================== # GDB Pretty Printing Module for Rust #=============================================================================== @@ -99,37 +102,19 @@ def rust_pretty_printer_lookup_function(gdb_val): val = GdbValue(gdb_val) type_kind = val.type.get_type_kind() - if type_kind == rustpp.TYPE_KIND_EMPTY: - return RustEmptyPrinter(val) - - if type_kind == rustpp.TYPE_KIND_REGULAR_STRUCT: - return RustStructPrinter(val, - omit_first_field = False, - omit_type_name = False, - is_tuple_like = False) - - if type_kind == rustpp.TYPE_KIND_STRUCT_VARIANT: - return RustStructPrinter(val, - omit_first_field = True, - omit_type_name = False, - is_tuple_like = False) - if type_kind == rustpp.TYPE_KIND_SLICE: return RustSlicePrinter(val) - if type_kind == rustpp.TYPE_KIND_STR_SLICE: - return RustStringSlicePrinter(val) - if type_kind == rustpp.TYPE_KIND_STD_VEC: return RustStdVecPrinter(val) if type_kind == rustpp.TYPE_KIND_STD_VECDEQUE: return RustStdVecDequePrinter(val) - if type_kind == rustpp.TYPE_KIND_STD_BTREESET: + if type_kind == rustpp.TYPE_KIND_STD_BTREESET and gdb_81: return RustStdBTreeSetPrinter(val) - if type_kind == rustpp.TYPE_KIND_STD_BTREEMAP: + if type_kind == rustpp.TYPE_KIND_STD_BTREEMAP and gdb_81: return RustStdBTreeMapPrinter(val) if type_kind == rustpp.TYPE_KIND_STD_STRING: @@ -138,6 +123,29 @@ def rust_pretty_printer_lookup_function(gdb_val): if type_kind == rustpp.TYPE_KIND_OS_STRING: return RustOsStringPrinter(val) + # Checks after this point should only be for "compiler" types -- + # things that gdb's Rust language support knows about. + if rust_enabled: + return None + + if type_kind == rustpp.TYPE_KIND_EMPTY: + return RustEmptyPrinter(val) + + if type_kind == rustpp.TYPE_KIND_REGULAR_STRUCT: + return RustStructPrinter(val, + omit_first_field = False, + omit_type_name = False, + is_tuple_like = False) + + if type_kind == rustpp.TYPE_KIND_STRUCT_VARIANT: + return RustStructPrinter(val, + omit_first_field = True, + omit_type_name = False, + is_tuple_like = False) + + if type_kind == rustpp.TYPE_KIND_STR_SLICE: + return RustStringSlicePrinter(val) + if type_kind == rustpp.TYPE_KIND_TUPLE: return RustStructPrinter(val, omit_first_field = False, @@ -293,16 +301,49 @@ def display_hint(): def to_string(self): (tail, head, data_ptr, cap) = \ rustpp.extract_tail_head_ptr_and_cap_from_std_vecdeque(self.__val) + if head >= tail: + size = head - tail + else: + size = cap + head - tail return (self.__val.type.get_unqualified_type_name() + - ("(len: %i, cap: %i)" % (head - tail, cap))) + ("(len: %i, cap: %i)" % (size, cap))) def children(self): (tail, head, data_ptr, cap) = \ rustpp.extract_tail_head_ptr_and_cap_from_std_vecdeque(self.__val) gdb_ptr = data_ptr.get_wrapped_value() - for index in xrange(tail, head): - yield (str(index), (gdb_ptr + index).dereference()) - + if head >= tail: + size = head - tail + else: + size = cap + head - tail + for index in xrange(0, size): + yield (str(index), (gdb_ptr + ((tail + index) % cap)).dereference()) + + +# Yield each key (and optionally value) from a BoxedNode. +def children_of_node(boxed_node, height, want_values): + node_ptr = boxed_node['ptr']['pointer'] + if height > 0: + type_name = str(node_ptr.type.target()).replace('LeafNode', 'InternalNode') + node_type = gdb.lookup_type(type_name) + node_ptr = node_ptr.cast(node_type.pointer()) + leaf = node_ptr['data'] + else: + leaf = node_ptr.dereference() + keys = leaf['keys'] + if want_values: + values = leaf['vals'] + length = int(leaf['len']) + for i in xrange(0, length + 1): + if height > 0: + child_ptr = node_ptr['edges'][i]['value']['value'] + for child in children_of_node(child_ptr, height - 1, want_values): + yield child + if i < length: + if want_values: + yield (keys[i]['value']['value'], values[i]['value']['value']) + else: + yield keys[i]['value']['value'] class RustStdBTreeSetPrinter(object): def __init__(self, val): @@ -313,21 +354,16 @@ def display_hint(): return "array" def to_string(self): - (length, data_ptr) = \ - rustpp.extract_length_and_ptr_from_std_btreeset(self.__val) return (self.__val.type.get_unqualified_type_name() + - ("(len: %i)" % length)) + ("(len: %i)" % self.__val.get_wrapped_value()['map']['length'])) def children(self): - (length, data_ptr) = \ - rustpp.extract_length_and_ptr_from_std_btreeset(self.__val) - leaf_node = GdbValue(data_ptr.get_wrapped_value().dereference()) - maybe_uninit_keys = leaf_node.get_child_at_index(3) - manually_drop_keys = maybe_uninit_keys.get_child_at_index(1) - keys = manually_drop_keys.get_child_at_index(0) - gdb_ptr = keys.get_wrapped_value() - for index in xrange(length): - yield (str(index), gdb_ptr[index]) + root = self.__val.get_wrapped_value()['map']['root'] + node_ptr = root['node'] + i = 0 + for child in children_of_node(node_ptr, root['height'], False): + yield (str(i), child) + i = i + 1 class RustStdBTreeMapPrinter(object): @@ -339,26 +375,17 @@ def display_hint(): return "map" def to_string(self): - (length, data_ptr) = \ - rustpp.extract_length_and_ptr_from_std_btreemap(self.__val) return (self.__val.type.get_unqualified_type_name() + - ("(len: %i)" % length)) + ("(len: %i)" % self.__val.get_wrapped_value()['length'])) def children(self): - (length, data_ptr) = \ - rustpp.extract_length_and_ptr_from_std_btreemap(self.__val) - leaf_node = GdbValue(data_ptr.get_wrapped_value().dereference()) - maybe_uninit_keys = leaf_node.get_child_at_index(3) - manually_drop_keys = maybe_uninit_keys.get_child_at_index(1) - keys = manually_drop_keys.get_child_at_index(0) - keys_ptr = keys.get_wrapped_value() - maybe_uninit_vals = leaf_node.get_child_at_index(4) - manually_drop_vals = maybe_uninit_vals.get_child_at_index(1) - vals = manually_drop_vals.get_child_at_index(0) - vals_ptr = vals.get_wrapped_value() - for index in xrange(length): - yield (str(index), keys_ptr[index]) - yield (str(index), vals_ptr[index]) + root = self.__val.get_wrapped_value()['root'] + node_ptr = root['node'] + i = 0 + for child in children_of_node(node_ptr, root['height'], True): + yield (str(i), child[0]) + yield (str(i), child[1]) + i = i + 1 class RustStdStringPrinter(object): diff --git a/src/etc/generate-deriving-span-tests.py b/src/etc/generate-deriving-span-tests.py index 31a438958e9..3d35ae07fbd 100755 --- a/src/etc/generate-deriving-span-tests.py +++ b/src/etc/generate-deriving-span-tests.py @@ -1,14 +1,4 @@ #!/usr/bin/env python -# -# Copyright 2013 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. """ This script creates a pile of compile-fail tests check that all the @@ -25,16 +15,7 @@ YEAR = datetime.datetime.now().year -TEMPLATE = """// Copyright {year} The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +TEMPLATE = """ // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' {error_deriving} diff --git a/src/etc/generate-keyword-tests.py b/src/etc/generate-keyword-tests.py index 1d79f95a4d2..9936ce71b76 100755 --- a/src/etc/generate-keyword-tests.py +++ b/src/etc/generate-keyword-tests.py @@ -1,14 +1,5 @@ #!/usr/bin/env python -# -# Copyright 2013 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. + """ This script takes a list of keywords and generates a testcase, that checks if using the keyword as identifier fails, for every keyword. The generate @@ -24,18 +15,7 @@ import stat -template = """// Copyright %d The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - +template = """ // This file was auto-generated using 'src/etc/generate-keyword-tests.py %s' fn main() { diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index 91010262981..e8be2b9b537 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -1,12 +1,5 @@ -# Copyright 2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. +#!/usr/bin/env python +# -*- coding: utf-8 -*- r""" htmldocck.py is a custom checker script for Rustdoc HTML outputs. @@ -108,7 +101,10 @@ """ -from __future__ import print_function +from __future__ import absolute_import, print_function, unicode_literals + +import codecs +import io import sys import os.path import re @@ -120,14 +116,10 @@ from HTMLParser import HTMLParser from xml.etree import cElementTree as ET -# ⇤/⇥ are not in HTML 4 but are in HTML 5 try: - from html.entities import entitydefs + from html.entities import name2codepoint except ImportError: - from htmlentitydefs import entitydefs -entitydefs['larrb'] = u'\u21e4' -entitydefs['rarrb'] = u'\u21e5' -entitydefs['nbsp'] = ' ' + from htmlentitydefs import name2codepoint # "void elements" (no closing tag) from the HTML Standard section 12.1.2 VOID_ELEMENTS = set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', @@ -167,11 +159,11 @@ def handle_data(self, data): self.__builder.data(data) def handle_entityref(self, name): - self.__builder.data(entitydefs[name]) + self.__builder.data(unichr(name2codepoint[name])) def handle_charref(self, name): code = int(name[1:], 16) if name.startswith(('x', 'X')) else int(name, 10) - self.__builder.data(unichr(code).encode('utf-8')) + self.__builder.data(unichr(code)) def close(self): HTMLParser.close(self) @@ -220,11 +212,11 @@ def concat_multi_lines(f): (?<=(?!?) (?P[A-Za-z]+(?:-[A-Za-z]+)*) (?P.*)$ -''', re.X) +''', re.X | re.UNICODE) def get_commands(template): - with open(template, 'rU') as f: + with io.open(template, encoding='utf-8') as f: for lineno, line in concat_multi_lines(f): m = LINE_PATTERN.search(line) if not m: @@ -236,7 +228,10 @@ def get_commands(template): if args and not args[:1].isspace(): print_err(lineno, line, 'Invalid template syntax') continue - args = shlex.split(args) + try: + args = shlex.split(args) + except UnicodeEncodeError: + args = [arg.decode('utf-8') for arg in shlex.split(args.encode('utf-8'))] yield Command(negated=negated, cmd=cmd, args=args, lineno=lineno+1, context=line) @@ -290,7 +285,7 @@ def get_file(self, path): if not(os.path.exists(abspath) and os.path.isfile(abspath)): raise FailedCheck('File does not exist {!r}'.format(path)) - with open(abspath) as f: + with io.open(abspath, encoding='utf-8') as f: data = f.read() self.files[path] = data return data @@ -304,9 +299,9 @@ def get_tree(self, path): if not(os.path.exists(abspath) and os.path.isfile(abspath)): raise FailedCheck('File does not exist {!r}'.format(path)) - with open(abspath) as f: + with io.open(abspath, encoding='utf-8') as f: try: - tree = ET.parse(f, CustomHTMLParser()) + tree = ET.fromstringlist(f.readlines(), CustomHTMLParser()) except Exception as e: raise RuntimeError('Cannot parse an HTML file {!r}: {}'.format(path, e)) self.trees[path] = tree @@ -323,7 +318,7 @@ def check_string(data, pat, regexp): if not pat: return True # special case a presence testing elif regexp: - return re.search(pat, data) is not None + return re.search(pat, data, flags=re.UNICODE) is not None else: data = ' '.join(data.split()) pat = ' '.join(pat.split()) @@ -360,7 +355,7 @@ def check_tree_text(tree, path, pat, regexp): break except Exception as e: print('Failed to get path "{}"'.format(path)) - raise e + raise return ret @@ -369,7 +364,12 @@ def get_tree_count(tree, path): return len(tree.findall(path)) def stderr(*args): - print(*args, file=sys.stderr) + if sys.version_info.major < 3: + file = codecs.getwriter('utf-8')(sys.stderr) + else: + file = sys.stderr + + print(*args, file=file) def print_err(lineno, context, err, message=None): global ERR_COUNT diff --git a/src/etc/lldb_batchmode.py b/src/etc/lldb_batchmode.py index b0220c84ef2..537b419b327 100644 --- a/src/etc/lldb_batchmode.py +++ b/src/etc/lldb_batchmode.py @@ -1,13 +1,3 @@ -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - # This script allows to use LLDB in a way similar to GDB's batch mode. That is, given a text file # containing LLDB commands (one command per line), this script will execute the commands one after # the other. @@ -28,10 +18,15 @@ import os import sys import threading -import thread import re import time +try: + import thread +except ModuleNotFoundError: + # The `thread` module was renamed to `_thread` in Python 3. + import _thread as thread + # Set this to True for additional output DEBUG_OUTPUT = False diff --git a/src/etc/lldb_rust_formatters.py b/src/etc/lldb_rust_formatters.py index 2bbd4372721..2c651c90f82 100644 --- a/src/etc/lldb_rust_formatters.py +++ b/src/etc/lldb_rust_formatters.py @@ -1,13 +1,3 @@ -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - import lldb import re import debugger_pretty_printers_common as rustpp diff --git a/src/etc/platform-intrinsics/aarch64.json b/src/etc/platform-intrinsics/aarch64.json deleted file mode 100644 index c8cda4077b7..00000000000 --- a/src/etc/platform-intrinsics/aarch64.json +++ /dev/null @@ -1,592 +0,0 @@ -{ - "platform": "aarch64_v", - "intrinsic_prefix": "", - "llvm_prefix": "llvm.aarch64.neon.", - "number_info": { - "signed": { - "kind": "s", - "data_type": { "pattern": "s{bitwidth}" } - }, - "unsigned": { - "kind": "u", - "data_type": { "pattern": "u{bitwidth}" } - }, - "float": { - "kind": "f", - "data_type": { "pattern": "f{bitwidth}" } - } - }, - "width_info": { - "64": { "width": "" }, - "128": { "width": "q" } - }, - "intrinsics": [ - { - "intrinsic": "hadd{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}hadd.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "rhadd{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}rhadd.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "qadd{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}qadd.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "uqadd_{0.data_type}", - "width": [128], - "llvm": "suqadd.{0.llvm_name}", - "ret": "s(8-64)", - "args": ["0", "0u"] - }, - { - "intrinsic": "sqadd_{0.data_type}", - "width": [128], - "llvm": "usqadd.{0.llvm_name}", - "ret": "u(8-64)", - "args": ["0", "0s"] - }, - { - "intrinsic": "raddhn_{1.data_type}", - "width": [64], - "llvm": "raddhn.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0w", "0w"] - }, - { - "intrinsic": "fmulx{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "fmulx.{0.llvm_name}", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "fma{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "!llvm.fma.{0.llvm_name}", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "qdmulh{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "sqdmulh.{0.llvm_name}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "qrdmulh{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "sqrdmulh.{0.llvm_name}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "mull_{1.data_type}", - "width": [128], - "llvm": "{0.kind}mull.{0.llvm_name}", - "ret": "i(16-64)", - "args": ["0n", "0n"] - }, - { - "intrinsic": "qdmull{0.width}_{1.data_type}", - "width": [128], - "llvm": "sqdmull.{0.llvm_name}", - "ret": "s(16-32)", - "args": ["0n", "0n"] - }, - { - "intrinsic": "hsub{0.width}_{1.data_type}", - "width": [64, 128], - "llvm": "{0.kind}hsub.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "qsub{0.width}_{1.data_type}", - "width": [64, 128], - "llvm": "{0.kind}qsub.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "rsubhn_{1.data_type}", - "width": [64], - "llvm": "rsubhn.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0w", "0w"] - }, - { - "intrinsic": "abd{0.width}_{1.data_type}", - "width": [64, 128], - "llvm": "{0.kind}abd.{0.llvm_name}", - "ret": ["i(8-32)","f(32-64)"], - "args": ["0", "0"] - }, - { - "intrinsic": "max{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}max.{0.llvm_name}", - "ret": ["i(8-32)","f(32-64)"], - "args": ["0", "0"] - }, - { - "intrinsic": "min{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}min.{0.llvm_name}", - "ret": ["i(8-32)","f(32-64)"], - "args": ["0", "0"] - }, - { - "intrinsic": "maxnm{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}maxnm.{0.llvm_name}", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "minnm{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}minnm.{0.llvm_name}", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "shl{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}shl.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0s"] - }, - { - "intrinsic": "qshl{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}qshl.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0s"] - }, - { - "intrinsic": "rshl{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}rshl.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0s"] - }, - { - "intrinsic": "qrshl{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}qrshl.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0s"] - }, - { - "intrinsic": "qshrun_n_{1.data_type}", - "width": [64], - "llvm": "sqshrun.{0.llvm_name}", - "ret": "s(8-32)", - "args": ["0w", "U32"] - }, - { - "intrinsic": "qrshrun_n_{1.data_type}", - "width": [64], - "llvm": "sqrshrun.{0.llvm_name}", - "ret": "s(8-32)", - "args": ["0w", "U32"] - }, - { - "intrinsic": "qshrn_n_{1.data_type}", - "width": [64], - "llvm": "{0.kind}qshrn.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0w", "U32"] - }, - { - "intrinsic": "rshrn_n_{1.data_type}", - "width": [64], - "llvm": "rshrn.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0w", "U32"] - }, - { - "intrinsic": "qrshrn_n_{1.data_type}", - "width": [64], - "llvm": "{0.kind}qrshrn.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0w", "U32"] - }, - { - "intrinsic": "sri{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "vsri.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "sli{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "vsli.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "vqmovn_{1.data_type}", - "width": [64], - "llvm": "{0.kind}qxtn.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0w"] - }, - { - "intrinsic": "abs{0.width}_{0.data_type}", - "width": [64,128], - "llvm": "abs.{0.llvm_name}", - "ret": "s(8-64)", - "args": ["0"] - }, - { - "intrinsic": "abs{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "!llvm.fabs.{0.llvm_name}", - "ret": "f(32-64)", - "args": ["0"] - }, - { - "intrinsic": "qabs{0.width}_{0.data_type}", - "width": [64,128], - "llvm": "sqabs.{0.llvm_name}", - "ret": "s(8-64)", - "args": ["0"] - }, - { - "intrinsic": "qneg{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "sqneg.{0.llvm_name}", - "ret": "s(8-64)", - "args": ["0"] - }, - { - "intrinsic": "clz{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "!llvm.ctlz.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0"] - }, - { - "intrinsic": "cls{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "cls.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0"] - }, - { - "intrinsic": "cnt{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "!llvm.ctpop.{0.llvm_name}", - "ret": "i8", - "args": ["0"] - }, - { - "intrinsic": "recpe{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}recpe.{0.llvm_name}", - "ret": ["u32","f(32-64)"], - "args": ["0"] - }, - { - "intrinsic": "recps{0.width}_{0.data_type}", - "width": [64,128], - "llvm": "frecps.{0.llvm_name}", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "sqrt{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "!llvm.sqrt.{0.llvm_name}", - "ret": "f(32-64)", - "args": ["0"] - }, - { - "intrinsic": "rsqrte{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}rsqrte.{0.llvm_name}", - "ret": ["u32","f(32-64)"], - "args": ["0"] - }, - { - "intrinsic": "rsqrts{0.width}_{0.data_type}", - "width": [64,128], - "llvm": "frsqrts.{0.llvm_name}", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "rbit{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "rbit.{0.llvm_name}", - "ret": "i8", - "args": ["0"] - }, - { - "intrinsic": "ld2{0[0].width}_{0[0].data_type}", - "width": [64, 128], - "llvm": "ld2.{0[0].llvm_name}.{1.llvm_name}", - "ret": ["[i(8-64);2]","[f(32-64);2]"], - "args": ["0.0SPc/0.0"] - }, - { - "intrinsic": "ld3{0[0].width}_{0[0].data_type}", - "width": [64, 128], - "llvm": "ld3.{0[0].llvm_name}.{1.llvm_name}", - "ret": ["[i(8-64);3]","[f(32-64);3]"], - "args": ["0.0SPc/0.0"] - }, - { - "intrinsic": "ld4{0[0].width}_{0[0].data_type}", - "width": [64, 128], - "llvm": "ld4.{0[0].llvm_name}.{1.llvm_name}", - "ret": ["[i(8-64);4]","[f(32-64);4]"], - "args": ["0.0SPc/0.0"] - }, - { - "intrinsic": "ld2{0[0].width}_dup_{0[0].data_type}", - "width": [64, 128], - "llvm": "ld2.{0[0].llvm_name}.{1.llvm_name}", - "ret": ["[i(8-64);2]","[f(32-64);2]"], - "args": ["0.0SPc"] - }, - { - "intrinsic": "ld3{0[0].width}_dup_{0[0].data_type}", - "width": [64, 128], - "llvm": "ld3.{0[0].llvm_name}.{1.llvm_name}", - "ret": ["[i(8-64);3]","[f(32-64);3]"], - "args": ["0.0SPc"] - }, - { - "intrinsic": "ld4{0[0].width}_dup_{0[0].data_type}", - "width": [64, 128], - "llvm": "ld4.{0[0].llvm_name}.{1.llvm_name}", - "ret": ["[i(8-64);4]","[f(32-64);4]"], - "args": ["0.0SPc"] - }, - { - "intrinsic": "padd{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "addp.{0.llvm_name}", - "ret": ["i(8-32)","f32"], - "args": ["0", "0"] - }, - { - "intrinsic": "padd{0.width}_{0.data_type}", - "width": [128], - "llvm": "addp.{0.llvm_name}", - "ret": ["i64","f64"], - "args": ["0", "0"] - }, - { - "intrinsic": "paddl{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}addlp.{0.llvm_name}.{1.llvm_name}", - "ret": "i(16-64)", - "args": ["0dn"] - }, - { - "intrinsic": "pmax{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}maxp.{0.llvm_name}", - "ret": ["i(8-32)","f32"], - "args": ["0", "0"] - }, - { - "intrinsic": "pmax{0.width}_{0.data_type}", - "width": [128], - "llvm": "{0.kind}maxp.{0.llvm_name}", - "ret": ["i64","f64"], - "args": ["0", "0"] - }, - { - "intrinsic": "pmin{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}minp.{0.llvm_name}", - "ret": ["i(8-32)","f32"], - "args": ["0", "0"] - }, - { - "intrinsic": "pmin{0.width}_{0.data_type}", - "width": [128], - "llvm": "{0.kind}minp.{0.llvm_name}", - "ret": ["i64","f64"], - "args": ["0", "0"] - }, - { - "intrinsic": "pmaxnm{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}maxnmp.{0.llvm_name}", - "ret": ["i(8-32)","f32"], - "args": ["0", "0"] - }, - { - "intrinsic": "pmaxnm{0.width}_{0.data_type}", - "width": [128], - "llvm": "{0.kind}maxnmp.{0.llvm_name}", - "ret": ["i64","f64"], - "args": ["0", "0"] - }, - { - "intrinsic": "pminnm{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}minnmp.{0.llvm_name}", - "ret": "f32", - "args": ["0", "0"] - }, - { - "intrinsic": "pminnm{0.width}_{0.data_type}", - "width": [128], - "llvm": "{0.kind}minnmp.{0.llvm_name}", - "ret": "f64", - "args": ["0", "0"] - }, - { - "intrinsic": "addv{1.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}addv.{0.llvm_name}.{1.llvm_name}", - "ret": ["I(8-32)","F32"], - "args": ["0v"] - }, - { - "intrinsic": "addv{1.width}_{0.data_type}", - "width": [128], - "llvm": "{0.kind}addv.{0.llvm_name}.{1.llvm_name}", - "ret": ["I64","F64"], - "args": ["0v"] - }, - { - "intrinsic": "addlv{1.width}_{1.data_type}", - "width": [64, 128], - "llvm": "{0.kind}addlv.{0.llvm_name}.{1.llvm_name}", - "ret": "I(16-64)", - "args": ["0vdn"] - }, - { - "intrinsic": "maxv{1.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}maxv.{0.llvm_name}.{1.llvm_name}", - "ret": ["I(8-32)","F32"], - "args": ["0v"] - }, - { - "intrinsic": "maxv{1.width}_{0.data_type}", - "width": [128], - "llvm": "{0.kind}maxv.{0.llvm_name}.{1.llvm_name}", - "ret": "F64", - "args": ["0v"] - }, - { - "intrinsic": "minv{1.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}minv.{0.llvm_name}.{1.llvm_name}", - "ret": ["I(8-32)","F32"], - "args": ["0v"] - }, - { - "intrinsic": "minv{1.width}_{0.data_type}", - "width": [128], - "llvm": "{0.kind}minv.{0.llvm_name}.{1.llvm_name}", - "ret": "F64", - "args": ["0v"] - }, - { - "intrinsic": "maxnmv{1.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}maxnmv.{0.llvm_name}.{1.llvm_name}", - "ret": "F32", - "args": ["0v"] - }, - { - "intrinsic": "maxnmv{1.width}_{0.data_type}", - "width": [128], - "llvm": "{0.kind}maxnmv.{0.llvm_name}.{1.llvm_name}", - "ret": "F64", - "args": ["0v"] - }, - { - "intrinsic": "minnmv{1.width}_{0.data_type}", - "width": [64, 128], - "llvm": "{0.kind}minnmv.{0.llvm_name}.{1.llvm_name}", - "ret": "F32", - "args": ["0v"] - }, - { - "intrinsic": "minnmv{1.width}_{0.data_type}", - "width": [128], - "llvm": "{0.kind}minnmv.{0.llvm_name}.{1.llvm_name}", - "ret": "F64", - "args": ["0v"] - }, - { - "intrinsic": "qtbl1{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "tbl1.{0.llvm_name}", - "ret": "i8", - "args": ["0x128", "0u"] - }, - { - "intrinsic": "qtbx1{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "tbx1.{0.llvm_name}", - "ret": "i8", - "args": ["0", "0x128", "0u"] - }, - { - "intrinsic": "qtbl2{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "tbl2.{0.llvm_name}", - "ret": "i8", - "args": ["(0x128,0x128)f", "0u"] - }, - { - "intrinsic": "qtbx2{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "tbx2.{0.llvm_name}", - "ret": "i8", - "args": ["(0x128,0x128)f", "0u"] - }, - { - "intrinsic": "qtbl3{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "tbl3.{0.llvm_name}", - "ret": "i8", - "args": ["(0x128,0x128,0x128)f", "0u"] - }, - { - "intrinsic": "qtbx3{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "tbx3.{0.llvm_name}", - "ret": "i8", - "args": ["0", "(0x128,0x128,0x128)f", "0u"] - }, - { - "intrinsic": "qtbl4{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "tbl4.{0.llvm_name}", - "ret": "i8", - "args": ["(0x128,0x128,0x128,0x128)f", "0u"] - }, - { - "intrinsic": "qtbx4{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "tbx4.{0.llvm_name}", - "ret": "i8", - "args": ["0", "(0x128,0x128,0x128,0x128)f", "0u"] - } - ] -} diff --git a/src/etc/platform-intrinsics/arm.json b/src/etc/platform-intrinsics/arm.json deleted file mode 100644 index d008320713c..00000000000 --- a/src/etc/platform-intrinsics/arm.json +++ /dev/null @@ -1,396 +0,0 @@ -{ - "platform": "arm_v", - "intrinsic_prefix": "", - "llvm_prefix": "llvm.arm.neon.v", - "number_info": { - "signed": { - "kind": "s", - "data_type": { "pattern": "s{bitwidth}" } - }, - "unsigned": { - "kind": "u", - "data_type": { "pattern": "u{bitwidth}" } - }, - "float": { - "kind": "f", - "data_type": { "pattern": "f{bitwidth}" } - } - }, - "width_info": { - "64": { "width": "" }, - "128": { "width": "q" } - }, - "intrinsics": [ - { - "intrinsic": "hadd{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "hadd{0.kind}.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "rhadd{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "rhadd{0.kind}.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "qadd{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "qadd{0.kind}.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "raddhn_{1.data_type}", - "width": [64], - "llvm": "raddhn.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0w", "0w"] - }, - { - "intrinsic": "fma{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "!llvm.fma.{0.llvm_name}", - "ret": "f32", - "args": ["0", "0"] - }, - { - "intrinsic": "qdmulh{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "sqdmulh.{0.llvm_name}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "qrdmulh{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "sqrdmulh.{0.llvm_name}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "mull_{1.data_type}", - "width": [128], - "llvm": "mull{0.kind}.{0.llvm_name}", - "ret": "i(16-64)", - "args": ["0n", "0n"] - }, - { - "intrinsic": "qdmull{0.width}_{1.data_type}", - "width": [128], - "llvm": "sqdmull.{0.llvm_name}", - "ret": "s(16-32)", - "args": ["0n", "0n"] - }, - { - "intrinsic": "hsub{0.width}_{1.data_type}", - "width": [64, 128], - "llvm": "hsub{0.kind}.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "qsub{0.width}_{1.data_type}", - "width": [64, 128], - "llvm": "qsub{0.kind}.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "rsubhn_{1.data_type}", - "width": [64], - "llvm": "rsubhn.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0w", "0w"] - }, - { - "intrinsic": "abd{0.width}_{1.data_type}", - "width": [64, 128], - "llvm": "abd{0.kind}.{0.llvm_name}", - "ret": ["i(8-32)","f32"], - "args": ["0", "0"] - }, - { - "intrinsic": "max{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "max{0.kind}.{0.llvm_name}", - "ret": ["i(8-32)","f32"], - "args": ["0", "0"] - }, - { - "intrinsic": "min{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "min{0.kind}.{0.llvm_name}", - "ret": ["i(8-32)","f32"], - "args": ["0", "0"] - }, - { - "intrinsic": "shl{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "shl{0.kind}.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0s"] - }, - { - "intrinsic": "qshl{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "qshl{0.kind}.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0s"] - }, - { - "intrinsic": "rshl{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "rshl{0.kind}.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0s"] - }, - { - "intrinsic": "qrshl{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "qrshl{0.kind}.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0s"] - }, - { - "intrinsic": "qshrun_n_{1.data_type}", - "width": [64], - "llvm": "sqshrun.{0.llvm_name}", - "ret": "s(8-32)", - "args": ["0w", "U32"] - }, - { - "intrinsic": "qrshrun_n_{1.data_type}", - "width": [64], - "llvm": "sqrshrun.{0.llvm_name}", - "ret": "s(8-32)", - "args": ["0w", "U32"] - }, - { - "intrinsic": "qshrn_n_{1.data_type}", - "width": [64], - "llvm": "qshrn{0.kind}.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0w", "U32"] - }, - { - "intrinsic": "rshrn_n_{1.data_type}", - "width": [64], - "llvm": "rshrn.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0w", "U32"] - }, - { - "intrinsic": "qrshrn_n_{1.data_type}", - "width": [64], - "llvm": "qrshrn{0.kind}.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0w", "U32"] - }, - { - "intrinsic": "sri{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "vsri.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "sli{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "vsli.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "vqmovn_{1.data_type}", - "width": [64], - "llvm": "qxtn{0.kind}.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0w"] - }, - { - "intrinsic": "abs{0.width}_{0.data_type}", - "width": [64,128], - "llvm": "abs.{0.llvm_name}", - "ret": "s(8-32)", - "args": ["0"] - }, - { - "intrinsic": "abs{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "!llvm.fabs.{0.llvm_name}", - "ret": "f32", - "args": ["0"] - }, - { - "intrinsic": "qabs{0.width}_{0.data_type}", - "width": [64,128], - "llvm": "sqabs.{0.llvm_name}", - "ret": "s(8-32)", - "args": ["0"] - }, - { - "intrinsic": "qneg{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "sqneg.{0.llvm_name}", - "ret": "s(8-32)", - "args": ["0"] - }, - { - "intrinsic": "clz{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "!llvm.ctlz.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0"] - }, - { - "intrinsic": "cls{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "cls.{0.llvm_name}", - "ret": "i(8-32)", - "args": ["0"] - }, - { - "intrinsic": "cnt{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "!llvm.ctpop.{0.llvm_name}", - "ret": "i8", - "args": ["0"] - }, - { - "intrinsic": "recpe{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "recpe.{0.llvm_name}", - "ret": ["u32","f32"], - "args": ["0"] - }, - { - "intrinsic": "recps{0.width}_{0.data_type}", - "width": [64,128], - "llvm": "frecps.{0.llvm_name}", - "ret": "f32", - "args": ["0", "0"] - }, - { - "intrinsic": "sqrt{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "!llvm.sqrt.{0.llvm_name}", - "ret": "f32", - "args": ["0"] - }, - { - "intrinsic": "rsqrte{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "rsqrte.{0.llvm_name}", - "ret": ["u32","f32"], - "args": ["0"] - }, - { - "intrinsic": "rsqrts{0.width}_{0.data_type}", - "width": [64,128], - "llvm": "rsqrts.{0.llvm_name}", - "ret": "f32", - "args": ["0", "0"] - }, - { - "intrinsic": "bsl{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "bsl.{0.llvm_name}", - "ret": "i(8-64)", - "args": ["0u", "0"] - }, - { - "intrinsic": "padd{0.width}_{0.data_type}", - "width": [64], - "llvm": "padd.{0.llvm_name}", - "ret": ["i(8-32)","f32"], - "args": ["0", "0"] - }, - { - "intrinsic": "paddl{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "paddl{0.kind}.{0.llvm_name}.{1.llvm_name}", - "ret": "i(16-64)", - "args": ["0dn"] - }, - { - "intrinsic": "padal{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "padal{0.kind}.{0.llvm_name}.{1.llvm_name}", - "ret": "i(16-64)", - "args": ["0", "0dn"] - }, - { - "intrinsic": "pmax{0.width}_{0.data_type}", - "width": [64], - "llvm": "pmax{0.kind}.{0.llvm_name}", - "ret": ["i(8-32)","f32"], - "args": ["0", "0"] - }, - { - "intrinsic": "pmin{0.width}_{0.data_type}", - "width": [64, 128], - "llvm": "pmin{0.kind}.{0.llvm_name}", - "ret": ["i(8-32)","f32"], - "args": ["0", "0"] - }, - { - "intrinsic": "tbl1_{0.data_type}", - "width": [64], - "llvm": "tbl1", - "ret": "i8", - "args": ["0", "0u"] - }, - { - "intrinsic": "tbx1_{0.data_type}", - "width": [64], - "llvm": "tbx1", - "ret": "i8", - "args": ["0", "0", "0u"] - }, - { - "intrinsic": "tbl2_{0.data_type}", - "width": [64], - "llvm": "tbl2", - "ret": "i8", - "args": ["(0,0)f", "0u"] - }, - { - "intrinsic": "tbx2_{0.data_type}", - "width": [64], - "llvm": "tbx2", - "ret": "i8", - "args": ["(0,0)f", "0u"] - }, - { - "intrinsic": "tbl3_{0.data_type}", - "width": [64], - "llvm": "tbl3", - "ret": "i8", - "args": ["(0,0,0)f", "0u"] - }, - { - "intrinsic": "tbx3_{0.data_type}", - "width": [64], - "llvm": "tbx3", - "ret": "i8", - "args": ["0", "(0,0,0)f", "0u"] - }, - { - "intrinsic": "tbl4_{0.data_type}", - "width": [64], - "llvm": "tbl4", - "ret": "i8", - "args": ["(0,0,0,0)f", "0u"] - }, - { - "intrinsic": "tbx4_{0.data_type}", - "width": [64], - "llvm": "tbx4", - "ret": "i8", - "args": ["0", "(0,0,0,0)f", "0u"] - } - ] -} diff --git a/src/etc/platform-intrinsics/generator.py b/src/etc/platform-intrinsics/generator.py deleted file mode 100644 index 046ea48638b..00000000000 --- a/src/etc/platform-intrinsics/generator.py +++ /dev/null @@ -1,874 +0,0 @@ -# Copyright 2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -from __future__ import division, print_function -import json -import argparse -import sys -import re -import textwrap -import itertools - -SPEC = re.compile( - r'^(?:(?PV)|(?P[iusfIUSF])(?:\((?P\d+)-(?P\d+)\)|' - r'(?P\d+)(:?/(?P\d+))?)' - r'|(?P\d+))(?P\.\d+)?(?P[vShdnwusfDMCNW]*)(?Px\d+)?' - r'(?:(?PPm|Pc)(?P/.*)?|(?P->.*))?$' -) - -class PlatformInfo(object): - def __init__(self, json): - self._platform = json['platform'] - - def platform_prefix(self): - return self._platform - -class IntrinsicSet(object): - def __init__(self, platform, json): - self._llvm_prefix = json['llvm_prefix'] - self._type_info = json['number_info'] - self._intrinsics = json['intrinsics'] - self._widths = json['width_info'] - self._platform = platform - self._intrinsic_prefix = json['intrinsic_prefix'] - - def intrinsics(self): - for raw in self._intrinsics: - yield GenericIntrinsic(self, - raw['intrinsic'], raw['width'], raw['llvm'], - raw['ret'], raw['args']) - - def platform(self): - return self._platform - - def intrinsic_prefix(self): - return self._intrinsic_prefix - - def llvm_prefix(self): - return self._llvm_prefix - - def width_info(self, bitwidth): - return self._widths[str(bitwidth)] - - def number_type_info(self, value): - data = self._type_info[value.__class__.__name__.lower()] - bitwidth = value.bitwidth() - def lookup(raw): - if not isinstance(raw, dict): - return raw - - try: - return raw[str(bitwidth)] - except KeyError: - return raw['pattern'].format(bitwidth = bitwidth) - - return PlatformTypeInfo(value.llvm_name(), - {k: lookup(v) for k, v in data.items()}) - -class PlatformTypeInfo(object): - def __init__(self, llvm_name, properties, elems = None): - if elems is None: - self.properties = properties - self.llvm_name = llvm_name - else: - assert properties is None and llvm_name is None - self.properties = {} - self.elems = elems - - def __repr__(self): - return ''.format(self.llvm_name, self.properties) - - def __getattr__(self, name): - return self.properties[name] - - def __getitem__(self, idx): - return self.elems[idx] - - def vectorize(self, length, width_info): - props = self.properties.copy() - props.update(width_info) - return PlatformTypeInfo('v{}{}'.format(length, self.llvm_name), props) - - def pointer(self, llvm_elem): - name = self.llvm_name if llvm_elem is None else llvm_elem.llvm_name - return PlatformTypeInfo('p0{}'.format(name), self.properties) - -BITWIDTH_POINTER = '' - -class Type(object): - def __init__(self, bitwidth): - self._bitwidth = bitwidth - - def bitwidth(self): - return self._bitwidth - - def modify(self, spec, width, previous): - raise NotImplementedError() - - def __ne__(self, other): - return not (self == other) - -class Void(Type): - def __init__(self): - Type.__init__(self, 0) - - @staticmethod - def compiler_ctor(): - return '::VOID' - - def compiler_ctor_ref(self): - return '&' + self.compiler_ctor() - - @staticmethod - def rust_name(): - return '()' - - @staticmethod - def type_info(platform_info): - return None - - def __eq__(self, other): - return isinstance(other, Void) - -class Number(Type): - def __init__(self, bitwidth): - Type.__init__(self, bitwidth) - - def modify(self, spec, width, previous): - if spec == 'u': - return Unsigned(self.bitwidth()) - elif spec == 's': - return Signed(self.bitwidth()) - elif spec == 'f': - return Float(self.bitwidth()) - elif spec == 'w': - return self.__class__(self.bitwidth() * 2) - elif spec == 'n': - return self.__class__(self.bitwidth() // 2) - elif spec == 'v': - return Vector(self, width // self.bitwidth()) - else: - raise ValueError('unknown modification spec {}', spec) - - def type_info(self, platform_info): - return platform_info.number_type_info(self) - - def __eq__(self, other): - # print(self, other) - return self.__class__ == other.__class__ and self.bitwidth() == other.bitwidth() - -class Signed(Number): - def __init__(self, bitwidth, llvm_bitwidth = None): - Number.__init__(self, bitwidth) - self._llvm_bitwidth = llvm_bitwidth - - - def compiler_ctor(self): - if self._llvm_bitwidth is None: - return '::I{}'.format(self.bitwidth()) - else: - return '::I{}_{}'.format(self.bitwidth(), self._llvm_bitwidth) - - def compiler_ctor_ref(self): - return '&' + self.compiler_ctor() - - def llvm_name(self): - bw = self._llvm_bitwidth or self.bitwidth() - return 'i{}'.format(bw) - - def rust_name(self): - return 'i{}'.format(self.bitwidth()) - -class Unsigned(Number): - def __init__(self, bitwidth, llvm_bitwidth = None): - Number.__init__(self, bitwidth) - self._llvm_bitwidth = llvm_bitwidth - - def compiler_ctor(self): - if self._llvm_bitwidth is None: - return '::U{}'.format(self.bitwidth()) - else: - return '::U{}_{}'.format(self.bitwidth(), self._llvm_bitwidth) - - def compiler_ctor_ref(self): - return '&' + self.compiler_ctor() - - def llvm_name(self): - bw = self._llvm_bitwidth or self.bitwidth() - return 'i{}'.format(bw) - - def rust_name(self): - return 'u{}'.format(self.bitwidth()) - -class Float(Number): - def __init__(self, bitwidth): - assert bitwidth in (32, 64) - Number.__init__(self, bitwidth) - - def compiler_ctor(self): - return '::F{}'.format(self.bitwidth()) - - def compiler_ctor_ref(self): - return '&' + self.compiler_ctor() - - def llvm_name(self): - return 'f{}'.format(self.bitwidth()) - - def rust_name(self): - return 'f{}'.format(self.bitwidth()) - -class Vector(Type): - def __init__(self, elem, length, bitcast = None): - assert isinstance(elem, Type) and not isinstance(elem, Vector) - Type.__init__(self, - elem.bitwidth() * length) - self._length = length - self._elem = elem - assert bitcast is None or (isinstance(bitcast, Vector) and - bitcast._bitcast is None and - bitcast._elem.bitwidth() == elem.bitwidth()) - if bitcast is not None and bitcast._elem != elem: - self._bitcast = bitcast._elem - else: - self._bitcast = None - - def modify(self, spec, width, previous): - if spec == 'S': - return self._elem - elif spec == 'h': - return Vector(self._elem, self._length // 2) - elif spec == 'd': - return Vector(self._elem, self._length * 2) - elif spec == 'N': - elem = self._elem.__class__(self._elem.bitwidth() // 2) - return Vector(elem, self._length * 2) - elif spec == 'W': - elem = self._elem.__class__(self._elem.bitwidth() * 2) - return Vector(elem, self._length // 2) - elif spec.startswith('x'): - new_bitwidth = int(spec[1:]) - return Vector(self._elem, new_bitwidth // self._elem.bitwidth()) - elif spec.startswith('->'): - bitcast_to = TypeSpec(spec[2:]) - choices = list(bitcast_to.enumerate(width, previous)) - assert len(choices) == 1 - bitcast_to = choices[0] - return Vector(self._elem, self._length, bitcast_to) - else: - return Vector(self._elem.modify(spec, width, previous), self._length) - - def compiler_ctor(self): - if self._bitcast is None: - return '{}x{}'.format(self._elem.compiler_ctor(), - self._length) - else: - return '{}x{}_{}'.format(self._elem.compiler_ctor(), - self._length, - self._bitcast.compiler_ctor() - .replace('::', '')) - - def compiler_ctor_ref(self): - return '&' + self.compiler_ctor() - - def rust_name(self): - return '{}x{}'.format(self._elem.rust_name(), self._length) - - def type_info(self, platform_info): - elem_info = self._elem.type_info(platform_info) - return elem_info.vectorize(self._length, - platform_info.width_info(self.bitwidth())) - - def __eq__(self, other): - return isinstance(other, Vector) and self._length == other._length and \ - self._elem == other._elem and self._bitcast == other._bitcast - -class Pointer(Type): - def __init__(self, elem, llvm_elem, const): - self._elem = elem - self._llvm_elem = llvm_elem - self._const = const - Type.__init__(self, BITWIDTH_POINTER) - - def modify(self, spec, width, previous): - if spec == 'D': - return self._elem - elif spec == 'M': - return Pointer(self._elem, self._llvm_elem, False) - elif spec == 'C': - return Pointer(self._elem, self._llvm_elem, True) - else: - return Pointer(self._elem.modify(spec, width, previous), self._llvm_elem, self._const) - - def compiler_ctor(self): - if self._llvm_elem is None: - llvm_elem = 'None' - else: - llvm_elem = 'Some({})'.format(self._llvm_elem.compiler_ctor_ref()) - return 'Type::Pointer({}, {}, {})'.format(self._elem.compiler_ctor_ref(), - llvm_elem, - 'true' if self._const else 'false') - - def compiler_ctor_ref(self): - return "{{ static PTR: Type = {}; &PTR }}".format(self.compiler_ctor()) - - - def rust_name(self): - return '*{} {}'.format('const' if self._const else 'mut', - self._elem.rust_name()) - - def type_info(self, platform_info): - if self._llvm_elem is None: - llvm_elem = None - else: - llvm_elem = self._llvm_elem.type_info(platform_info) - return self._elem.type_info(platform_info).pointer(llvm_elem) - - def __eq__(self, other): - return isinstance(other, Pointer) and self._const == other._const \ - and self._elem == other._elem and self._llvm_elem == other._llvm_elem - -class Aggregate(Type): - def __init__(self, flatten, elems): - self._flatten = flatten - self._elems = elems - Type.__init__(self, sum(elem.bitwidth() for elem in elems)) - - def __repr__(self): - return ''.format(self._elems) - - def modify(self, spec, width, previous): - if spec.startswith('.'): - num = int(spec[1:]) - return self._elems[num] - else: - print(spec) - raise NotImplementedError() - - def compiler_ctor(self): - parts = "{{ static PARTS: [&'static Type; {}] = [{}]; &PARTS }}" - elems = ', '.join(elem.compiler_ctor_ref() for elem in self._elems) - parts = parts.format(len(self._elems), elems) - return 'Type::Aggregate({}, {})'.format('true' if self._flatten else 'false', - parts) - - def compiler_ctor_ref(self): - return "{{ static AGG: Type = {}; &AGG }}".format(self.compiler_ctor()) - - def rust_name(self): - return '({})'.format(', '.join(elem.rust_name() for elem in self._elems)) - - def type_info(self, platform_info): - return PlatformTypeInfo(None, None, [elem.type_info(platform_info) for elem in self._elems]) - - def __eq__(self, other): - return isinstance(other, Aggregate) and self._flatten == other._flatten and \ - self._elems == other._elems - - -TYPE_ID_LOOKUP = {'i': [Signed, Unsigned], - 's': [Signed], - 'u': [Unsigned], - 'f': [Float]} - -def ptrify(match, elem, width, previous): - ptr = match.group('pointer') - if ptr is None: - return elem - else: - llvm_ptr = match.group('llvm_pointer') - if llvm_ptr is None: - llvm_elem = None - else: - assert llvm_ptr.startswith('/') - options = list(TypeSpec(llvm_ptr[1:]).enumerate(width, previous)) - assert len(options) == 1 - llvm_elem = options[0] - assert ptr in ('Pc', 'Pm') - return Pointer(elem, llvm_elem, ptr == 'Pc') - -class TypeSpec(object): - def __init__(self, spec): - if not isinstance(spec, list): - spec = [spec] - - self.spec = spec - - def enumerate(self, width, previous): - for spec in self.spec: - match = SPEC.match(spec) - if match is not None: - id = match.group('id') - reference = match.group('reference') - - modifiers = [] - index = match.group('index') - if index is not None: - modifiers.append(index) - modifiers += list(match.group('modifiers') or '') - force = match.group('force_width') - if force is not None: - modifiers.append(force) - bitcast = match.group('bitcast') - if bitcast is not None: - modifiers.append(bitcast) - - if match.group('void') is not None: - assert spec == 'V' - yield Void() - elif id is not None: - is_vector = id.islower() - type_ctors = TYPE_ID_LOOKUP[id.lower()] - - start = match.group('start') - if start is not None: - end = match.group('end') - llvm_width = None - else: - start = end = match.group('width') - llvm_width = match.group('llvm_width') - start = int(start) - end = int(end) - - bitwidth = start - while bitwidth <= end: - for ctor in type_ctors: - if llvm_width is not None: - assert not is_vector - llvm_width = int(llvm_width) - assert llvm_width < bitwidth - scalar = ctor(bitwidth, llvm_width) - else: - scalar = ctor(bitwidth) - - if is_vector: - elem = Vector(scalar, width // bitwidth) - else: - assert bitcast is None - elem = scalar - - for x in modifiers: - elem = elem.modify(x, width, previous) - yield ptrify(match, elem, width, previous) - bitwidth *= 2 - elif reference is not None: - reference = int(reference) - assert reference < len(previous), \ - 'referring to argument {}, but only {} are known'.format(reference, - len(previous)) - ret = previous[reference] - for x in modifiers: - ret = ret.modify(x, width, previous) - yield ptrify(match, ret, width, previous) - else: - assert False, 'matched `{}`, but didn\'t understand it?'.format(spec) - elif spec.startswith('('): - if spec.endswith(')'): - true_spec = spec[1:-1] - flatten = False - elif spec.endswith(')f'): - true_spec = spec[1:-2] - flatten = True - else: - assert False, 'found unclosed aggregate `{}`'.format(spec) - - for elems in itertools.product(*(TypeSpec(subspec).enumerate(width, previous) - for subspec in true_spec.split(','))): - yield Aggregate(flatten, elems) - elif spec.startswith('['): - if spec.endswith(']'): - true_spec = spec[1:-1] - flatten = False - elif spec.endswith(']f'): - true_spec = spec[1:-2] - flatten = True - else: - assert False, 'found unclosed aggregate `{}`'.format(spec) - elem_spec, count = true_spec.split(';') - - count = int(count) - for elem in TypeSpec(elem_spec).enumerate(width, previous): - yield Aggregate(flatten, [elem] * count) - else: - assert False, 'Failed to parse `{}`'.format(spec) - -class GenericIntrinsic(object): - def __init__(self, platform, intrinsic, widths, llvm_name, ret, args): - self._platform = platform - self.intrinsic = intrinsic - self.widths = map(int, widths) - self.llvm_name = llvm_name - self.ret = TypeSpec(ret) - self.args = list(map(TypeSpec, args)) - - def monomorphise(self): - for width in self.widths: - # must be a power of two - assert width & (width - 1) == 0 - def recur(processed, untouched): - if not untouched: - ret = processed[0] - args = processed[1:] - yield MonomorphicIntrinsic(self._platform, self.intrinsic, width, - self.llvm_name, - ret, args) - else: - raw_arg = untouched[0] - rest = untouched[1:] - for arg in raw_arg.enumerate(width, processed): - for intr in recur(processed + [arg], rest): - yield intr - - for x in recur([], [self.ret] + self.args): - yield x - -class MonomorphicIntrinsic(object): - def __init__(self, platform, intrinsic, width, llvm_name, ret, args): - self._platform = platform - self._intrinsic = intrinsic - self._width = '' if width == 64 else 'q' - self._llvm_name = llvm_name - self._ret_raw = ret - self._ret = ret.type_info(platform) - self._args_raw = args - self._args = [arg.type_info(platform) for arg in args] - - def llvm_name(self): - if self._llvm_name.startswith('!'): - return self._llvm_name[1:].format(self._ret, *self._args) - else: - return self._platform.llvm_prefix() + self._llvm_name.format(self._ret, *self._args) - - def intrinsic_suffix(self): - return self._intrinsic.format(self._ret, - *self._args, - width = self._width) - - def platform_prefix(self): - return self._platform.platform().platform_prefix() - - def intrinsic_set_name(self): - return self._platform.intrinsic_prefix() - - def intrinsic_name(self): - return self._platform.intrinsic_prefix() + self.intrinsic_suffix() - - def compiler_args(self): - return ', '.join(arg.compiler_ctor_ref() for arg in self._args_raw) - - def compiler_ret(self): - return self._ret_raw.compiler_ctor_ref() - - def compiler_signature(self): - return '({}) -> {}'.format(self.compiler_args(), self.compiler_ret()) - - def intrinsic_signature(self): - names = 'xyzwabcdef' - return '({}) -> {}'.format(', '.join('{}: {}'.format(name, arg.rust_name()) - for name, arg in zip(names, self._args_raw)), - self._ret_raw.rust_name()) - -def parse_args(): - parser = argparse.ArgumentParser( - formatter_class = argparse.RawDescriptionHelpFormatter, - description = 'Render an intrinsic definition JSON to various formats.', - epilog = textwrap.dedent('''\ - Quick How-To: - - There are two operating modes: single file and multiple files. - - For example, ARM is specified as a single file. To generate the - compiler-definitions for ARM just pass the script the "arm.json" file: - - python generator.py --format compiler-defs arm.json - - The X86 architecture is specified as multiple files (for the different - instruction sets that x86 supports). To generate the compiler - definitions one needs to pass the script a "platform information file" - (with the -i flag) next to the files of the different instruction sets. - For example, to generate the X86 compiler-definitions for SSE4.2, just: - - python generator.py --format compiler-defs -i x86/info.json sse42.json - - And to generate the compiler-definitions for SSE4.1 and SSE4.2, just: - - python generator.py --format compiler-defs -i x86/info.json sse41.json sse42.json - - An intrinsic definition consists of a map with fields: - - intrinsic: pattern for the name(s) of the vendor's C intrinsic(s) - - llvm: pattern for the name(s) of the internal llvm intrinsic(s) - - width: a vector of vector bit-widths the pattern works with - - ret: type specifier for the return value - - arguments: vector of type specifiers for arguments - - The width and types describe a range of possible intrinsics, - and these are fed back into the intrinsic and llvm patterns to - create the appropriate definitions. - - ## Type specifier grammar - - ``` - type := core_type modifier* suffix? - - core_type := void | vector | scalar | aggregate | reference - - modifier := 'v' | 'h' | 'd' | 'n' | 'w' | 'u' | 's' | - 'x' number | '.' number - suffix := pointer | bitcast - pointer := 'Pm' llvm_pointer? | 'Pc' llvm_pointer? - llvm_pointer := '/' type - bitcast := '->' type - - void := 'V' - - vector := vector_elem width | - vector_elem := 'i' | 'u' | 's' | 'f' - - scalar := scalar_type number llvm_width? - scalar_type := 'U' | 'S' | 'F' - llvm_width := '/' number - - aggregate := '(' (type),* ')' 'f'? | '[' type ';' number ']' 'f'? - - reference := number - - width = number | '(' number '-' number ')' - - number = [0-9]+ - ``` - - ## Void - - The `V` type corresponds to `void` in LLVM (`()` in - Rust). It's likely to only work in return position. - - ## Vectors - - The vector grammar is a pattern describing many possibilities - for arguments/return value. The `vector_elem` describes the - types of elements to use, and the `width` describes the (range - of) widths for those elements, which are then placed into a - vector with the `width` bitwidth. E.g. if an intrinsic has a - `width` that includes 128, and the return value is `i(8-32)`, - then some instantiation of that intrinsic will be `u8x16`, - `u32x4`, `i32x4`, etc. - - ### Elements - - - i: integer, both signed and unsigned - - u: unsigned integer - - s: signed integer - - f: float - - ## Scalars - - Similar to vectors, but these describe a single concrete type, - not a range. The number is the bitwidth. The optional - `llvm_width` is the bitwidth of the integer that should be - passed to LLVM (by truncating the Rust argument): this only - works with scalar integers and the LLVM width must be smaller - than the Rust width. - - ### Types - - - U: unsigned integer - - S: signed integer - - F: float - - ## Aggregates - - An aggregate is a collection of multiple types; a tuple in - Rust terms, or an unnamed struct in LLVM. The `f` modifiers - forces the tuple to be flattened in the LLVM - intrinsic. E.g. if `llvm.foo` takes `(F32,S32)`: - - - no `f` corresponds to `declare ... @llvm.foo({float, i32})`. - - having an `f` corresponds to `declare ... @llvm.foo(float, i32)`. - - The `[type;number]` form is a just shorter way to write - `(...)`, except avoids doing a cartesian product of generic - types, e.g. `[S32;2]` is the same as `(S32, S32)`, while - `[I32;2]` is describing just the two types `(S32,S32)` and - `(U32,U32)` (i.e. doesn't include `(S32,U32)`, `(U32,S32)` as - `(I32,I32)` would). - - (Currently aggregates can not contain other aggregates.) - - ## References - - A reference uses the type of another argument, with possible - modifications. The number refers to the type to use, starting - with 0 == return value, 1 == first argument, 2 == second - argument, etc. - - ## Affixes - - The `modifier` and `suffix` adaptors change the precise - representation. - - ### Modifiers - - - 'v': put a scalar into a vector of the current width (u32 -> u32x4, when width == 128) - - 'S': get the scalar element of a vector (u32x4 -> u32) - - 'h': half the length of the vector (u32x4 -> u32x2) - - 'd': double the length of the vector (u32x2 -> u32x4) - - 'n': narrow the element of the vector (u32x4 -> u16x4) - - 'w': widen the element of the vector (u16x4 -> u32x4) - - 'N': half the length of the vector element (u32x4 -> u16x8) - - 'W': double the length of the vector element (u16x8 -> u32x4) - - 'u': force a number (vector or scalar) to be unsigned int (f32x4 -> u32x4) - - 's': force a number (vector or scalar) to be signed int (u32x4 -> i32x4) - - 'f': force a number (vector or scalar) to be float (u32x4 -> f32x4) - - 'x' number: force the type to be a vector of bitwidth `number`. - - '.' number: get the `number`th element of an aggregate - - 'D': dereference a pointer (*mut u32 -> u32) - - 'C': make a pointer const (*mut u32 -> *const u32) - - 'M': make a pointer mut (*const u32 -> *mut u32) - - ### Pointers - - Pointers can be created of any type by appending a `P*` - suffix. The `m` vs. `c` chooses mut vs. const. e.g. `S32Pm` - corresponds to `*mut i32`, and `i32Pc` corresponds (with width - 128) to `*const i8x16`, `*const u32x4`, etc. - - The type after the `/` (optional) represents the type used - internally to LLVM, e.g. `S32pm/S8` is exposed as `*mut i32` - in Rust, but is `i8*` in LLVM. (This defaults to the main - type). - - ### Bitcast - - The `'->' type` bitcast suffix will cause the value to be - bitcast to the right-hand type when calling the intrinsic, - e.g. `s32->f32` will expose the intrinsic as `i32x4` at the - Rust level, but will cast that vector to `f32x4` when calling - the LLVM intrinsic. - ''')) - parser.add_argument('--format', choices=FORMATS, required=True, - help = 'Output format.') - parser.add_argument('-o', '--out', type=argparse.FileType('w'), default=sys.stdout, - help = 'File to output to (default stdout).') - parser.add_argument('-i', '--info', type=argparse.FileType('r'), - help = 'File containing platform specific information to merge into ' - 'the input files\' header.') - parser.add_argument('in_', metavar="FILE", type=argparse.FileType('r'), nargs='+', - help = 'JSON files to load') - return parser.parse_args() - - -class ExternBlock(object): - def __init__(self): - pass - - @staticmethod - def open(platform): - return 'extern "platform-intrinsic" {' - - @staticmethod - def render(mono): - return ' fn {}{}{};'.format(mono.platform_prefix(), - mono.intrinsic_name(), - mono.intrinsic_signature()) - - @staticmethod - def close(): - return '}' - -class CompilerDefs(object): - def __init__(self): - pass - - @staticmethod - def open(platform): - return '''\ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// DO NOT EDIT: autogenerated by etc/platform-intrinsics/generator.py -// ignore-tidy-linelength - -#![allow(unused_imports)] - -use {{Intrinsic, Type}}; -use IntrinsicDef::Named; - -pub fn find(name: &str) -> Option {{ - if !name.starts_with("{0}") {{ return None }} - Some(match &name["{0}".len()..] {{'''.format(platform.platform_prefix()) - - @staticmethod - def render(mono): - return '''\ - "{}" => Intrinsic {{ - inputs: {{ static INPUTS: [&'static Type; {}] = [{}]; &INPUTS }}, - output: {}, - definition: Named("{}") - }},'''.format(mono.intrinsic_set_name() + mono.intrinsic_suffix(), - len(mono._args_raw), - mono.compiler_args(), - mono.compiler_ret(), - mono.llvm_name()) - - @staticmethod - def close(): - return '''\ - _ => return None, - }) -}''' - -FORMATS = { - 'extern-block': ExternBlock(), - 'compiler-defs': CompilerDefs(), -} - - -def main(): - args = parse_args() - ins = args.in_ - out = args.out - out_format = FORMATS[args.format] - info = args.info - one_file_no_info = False - if len(ins) > 1 and info is None: - print('error: cannot have multiple inputs without an info header.', file=sys.stderr) - sys.exit(1) - - elif info is None: - info = ins[0] - one_file_no_info = True - info_json = json.load(info) - platform = PlatformInfo(info_json) - - print(out_format.open(platform), file=out) - - for in_ in ins: - - if one_file_no_info: - data = info_json - else: - data = json.load(in_) - data.update(info_json) - - intrinsics = IntrinsicSet(platform, data) - for intr in intrinsics.intrinsics(): - for mono in intr.monomorphise(): - print(out_format.render(mono), file=out) - - print(out_format.close(), file=out) - -if __name__ == '__main__': - main() diff --git a/src/etc/platform-intrinsics/hexagon/hvx_v60.json b/src/etc/platform-intrinsics/hexagon/hvx_v60.json deleted file mode 100644 index a1897e6bf61..00000000000 --- a/src/etc/platform-intrinsics/hexagon/hvx_v60.json +++ /dev/null @@ -1,1326 +0,0 @@ -{ - "platform": "Q6_", - "intrinsic_prefix": "", - "llvm_prefix": "llvm.hexagon.V6.", - "number_info": { - "signed": { - "kind": "s", - "data_type": { "8": "b", "16": "h", "32": "w" }, - "data_type_plain": { "8": "b", "16": "h", "32": "w" } - }, - "unsigned": { - "kind": "u", - "data_type": { "8": "ub", "16": "uh", "32": "uw" }, - "data_type_plain": { "8": "b", "16": "h", "32": "w" } - }, - "float": { - "kind": "f", - "data_type": { "8": "b", "16": "h", "32": "w" }, - "data_type_plain": { "8": "b", "16": "h", "32": "w" } - } - }, - "width_info": { - "64": { "width_b": "64", "width_suffix": "" }, - "128": { "width_b": "128", "width_suffix": ".128B" }, - "512": { "width_b": "64", "width_suffix": "" }, - "1024": { "widthd_b": "64", "width_b": "128", "width_suffix": ".128B", "widthd_suffix": "" }, - "2048": { "widthd_b": "128", "widthd_suffix": ".128B" } - }, - "intrinsics": [ - { - "intrinsic": "R_vextract{1.width_b}", - "width": [512, 1024], - "llvm": "extractw{1.width_suffix}", - "ret": "U32", - "args": ["u32", "U32"] - }, - { - "intrinsic": "V_lo{0.width_b}", - "width": [512, 1024], - "llvm": "lo{0.width_suffix}", - "ret": "u32", - "args": ["0d"] - }, - { - "intrinsic": "V_hi{0.width_b}", - "width": [512, 1024], - "llvm": "hi{0.width_suffix}", - "ret": "u32", - "args": ["0d"] - }, - { - "intrinsic": "V_vsplat_R{0.width_b}", - "width": [512, 1024], - "llvm": "lvsplat{1.data_type}{0.width_suffix}", - "ret": "u32", - "args": ["0S"] - }, - { - "intrinsic": "Q_and_QQ{0.width_b}", - "width": [64, 128], - "llvm": "pred.and{0.width_suffix}", - "ret": "u32", - "args": ["0", "0"] - }, - { - "intrinsic": "Q_not_Q{0.width_b}", - "width": [64, 128], - "llvm": "pred.not{0.width_suffix}", - "ret": "u32", - "args": ["0"] - }, - { - "intrinsic": "Q_or_QQ{0.width_b}", - "width": [64, 128], - "llvm": "pred.or{0.width_suffix}", - "ret": "u32", - "args": ["0", "0"] - }, - { - "intrinsic": "Q_xor_QQ{0.width_b}", - "width": [64, 128], - "llvm": "pred.xor{0.width_suffix}", - "ret": "u32", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vabsdiff_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vabsdiff{1.data_type}{0.width_suffix}", - "ret": "u(8-16)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vabsdiff_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vabsdiff{1.data_type}{0.width_suffix}", - "ret": "u(16-32)", - "args": ["0s", "0s"] - }, - { - "intrinsic": "V{0.data_type}_vabs_V{1.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vabs{1.data_type}{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0"] - }, - { - "intrinsic": "V{0.data_type}_vabs_V{1.data_type}_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vabs{1.data_type}.sat{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0"] - }, - { - "intrinsic": "V{0.data_type}_vadd_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vadd{0.data_type}{0.width_suffix}", - "ret": "s(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vadd_V{1.data_type}V{2.data_type}_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vadd{0.data_type}sat{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vadd_V{1.data_type}V{2.data_type}_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vadd{0.data_type}sat{0.width_suffix}", - "ret": "u(8-16)", - "args": ["0", "0"] - }, - { - "intrinsic": "W{0.data_type}_vadd_W{1.data_type}W{2.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vadd{0.data_type}.dv{0.widthd_suffix}", - "ret": "s(8-32)d", - "args": ["0", "0"] - }, - { - "intrinsic": "W{0.data_type}_vadd_W{1.data_type}W{2.data_type}_sat{0.widthd_b}", - "width": [512, 1024], - "llvm": "vadd{0.data_type}sat.dv{0.widthd_suffix}", - "ret": "s(16-32)d", - "args": ["0", "0"] - }, - { - "intrinsic": "W{0.data_type}_vadd_W{1.data_type}W{2.data_type}_sat{0.widthd_b}", - "width": [512, 1024], - "llvm": "vadd{0.data_type}sat.dv{0.widthd_suffix}", - "ret": "u(8-16)d", - "args": ["0", "0"] - }, - { - "intrinsic": "V_valign_VVR{0.width_b}", - "width": [512, 1024], - "llvm": "valignb{0.width_suffix}", - "ret": "u8", - "args": ["0", "0", "U32"] - }, - { - "intrinsic": "V_valign_VVI{0.width_b}", - "width": [512, 1024], - "llvm": "valignbi{0.width_suffix}", - "ret": "u8", - "args": ["0", "0", "U32"] - }, - { - "intrinsic": "V_vlalign_VVR{0.width_b}", - "width": [512, 1024], - "llvm": "vlalignb{0.width_suffix}", - "ret": "u8", - "args": ["0", "0", "U32"] - }, - { - "intrinsic": "V_vlalign_VVI{0.width_b}", - "width": [512, 1024], - "llvm": "vlalignbi{0.width_suffix}", - "ret": "u8", - "args": ["0", "0", "U32"] - }, - { - "intrinsic": "V_vand_VV{0.width_b}", - "width": [512, 1024], - "llvm": "vand{0.width_suffix}", - "ret": "u16", - "args": ["0", "0"] - }, - { - "intrinsic": "V_vand_QR{0.width_b}", - "width": [512, 1024], - "llvm": "vandqrt{0.width_suffix}", - "ret": "u8", - "args": ["u32hhh", "U32"] - }, - { - "intrinsic": "V_vandor_VQR{0.width_b}", - "width": [512, 1024], - "llvm": "vandqrt.acc{0.width_suffix}", - "ret": "u8", - "args": ["0", "u32hhh", "U32"] - }, - { - "intrinsic": "Q_vand_VR{0.width_b}", - "width": [512, 1024], - "llvm": "vandvrt{0.width_suffix}", - "ret": "u32hhh", - "args": ["u8", "U32"] - }, - { - "intrinsic": "Q_vandor_QVR{0.width_b}", - "width": [512, 1024], - "llvm": "vandvrt{0.width_suffix}", - "ret": "u32hhh", - "args": ["0", "u8", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vasl_V{1.data_type}R{0.width_b}", - "width": [512, 1024], - "llvm": "vasl{0.data_type}{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vasl_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vasl{0.data_type}v{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vaslacc_V{1.data_type}V{2.data_type}R{0.width_b}", - "width": [512, 1024], - "llvm": "vasl{0.data_type}.acc{0.width_suffix}", - "ret": "s32", - "args": ["0", "0", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vasr_V{1.data_type}R{0.width_b}", - "width": [512, 1024], - "llvm": "vasr{0.data_type}{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vasr_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vasr{0.data_type}v{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vasracc_V{1.data_type}V{2.data_type}R{0.width_b}", - "width": [512, 1024], - "llvm": "vasr{0.data_type}.acc{0.width_suffix}", - "ret": "s32", - "args": ["0", "0", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vasr_V{1.data_type}V{2.data_type}R{0.width_b}", - "width": [512, 1024], - "llvm": "vasr{0.data_type}{1.data_type}{0.width_suffix}", - "ret": "s16", - "args": ["0hw", "0hw", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vasr_V{1.data_type}V{2.data_type}R_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vasr{1.data_type}{0.data_type_plain}sat{0.width_suffix}", - "ret": "i(8-16)", - "args": ["0hws", "0hws", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vasr_V{1.data_type}V{2.data_type}R_rnd_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vasr{1.data_type}{0.data_type_plain}rndsat{0.width_suffix}", - "ret": "i(8-16)", - "args": ["0hws", "0hws", "U32"] - }, - { - "intrinsic": "V_equals_V{0.width_b}", - "width": [512, 1024], - "llvm": "vassign{0.width_suffix}", - "ret": "u32", - "args": ["0"] - }, - { - "intrinsic": "W_equals_W{0.widthd_b}", - "width": [512, 1024], - "llvm": "vassignp{0.widthd_suffix}", - "ret": "u32d", - "args": ["0"] - }, - { - "intrinsic": "V{0.data_type}_vavg_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vavg{0.data_type}{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vavg_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vavg{0.data_type}{0.width_suffix}", - "ret": "u(8-16)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vavg_V{1.data_type}V{2.data_type}_rnd{0.width_b}", - "width": [512, 1024], - "llvm": "vavgrnd{0.data_type}{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vavg_V{1.data_type}V{2.data_type}_rnd{0.width_b}", - "width": [512, 1024], - "llvm": "vavgrnd{0.data_type}{0.width_suffix}", - "ret": "u(8-16)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vcl0_V{1.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vcl0{0.data_type_plain}{0.width_suffix}", - "ret": "u(16-32)", - "args": ["0"] - }, - { - "intrinsic": "W_vcombine_VV{0.widthd_b}", - "width": [512, 1024], - "llvm": "vcombine{0.widthd_suffix}", - "ret": "u8d", - "args": ["0h", "0h"] - }, - { - "intrinsic": "V_vzero{0.width_b}", - "width": [512, 1024], - "llvm": "vd0{0.width_suffix}", - "ret": "u32", - "args": [] - }, - { - "intrinsic": "V{0.data_type}_vdeal_V{1.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vdeal{1.data_type}{0.width_suffix}", - "ret": "s(8-16)", - "args": ["0"] - }, - { - "intrinsic": "V{0.data_type}_vdeale_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vdeal{1.data_type}4w{0.width_suffix}", - "ret": "s8", - "args": ["0", "0"] - }, - { - "intrinsic": "W_vdeal_VVR{0.widthd_b}", - "width": [512, 1024], - "llvm": "vdealvdd{0.widthd_suffix}", - "ret": "u8d", - "args": ["0h", "0h", "U32"] - }, - { - "intrinsic": "V_vdelta_VV{0.width_b}", - "width": [512, 1024], - "llvm": "vdelta{0.width_suffix}", - "ret": "u8", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vdmpy_V{1.data_type}Rb{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpybus{0.width_suffix}", - "ret": "s16", - "args": ["u8", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}V{2.data_type}Rb{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpybus.acc{0.width_suffix}", - "ret": "s16", - "args": ["s16", "u8", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vdmpy_W{1.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vdmpybus.dv{0.widthd_suffix}", - "ret": "s16d", - "args": ["u8d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vdmpyacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vdmpybus.dv.acc{0.widthd_suffix}", - "ret": "s16d", - "args": ["s16d", "u8d", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vdmpy_V{1.data_type}Rb{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpyhb{0.width_suffix}", - "ret": "s32", - "args": ["s16", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}V{2.data_type}Rb{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpyhb.acc{0.width_suffix}", - "ret": "s32", - "args": ["s32", "s16", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vdmpy_W{1.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vdmpyhb.dv{0.widthd_suffix}", - "ret": "s32d", - "args": ["s16d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vdmpyacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vdmpyhb.dv.acc{0.widthd_suffix}", - "ret": "s32d", - "args": ["s32d", "s16d", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vdmpy_W{1.data_type}Rh_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpyhisat{0.width_suffix}", - "ret": "s32", - "args": ["0d", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vdmpy_V{1.data_type}Rh_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpyhsat{0.width_suffix}", - "ret": "s32", - "args": ["s16", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vdmpy_W{1.data_type}Ruh_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpyhsuisat{0.width_suffix}", - "ret": "s32", - "args": ["s16d", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vdmpy_V{1.data_type}Ruh_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpyhsusat{0.width_suffix}", - "ret": "s32", - "args": ["s16", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vdmpy_V{1.data_type}V{2.data_type}_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpyhvsat{0.width_suffix}", - "ret": "s32", - "args": ["s16", "s16"] - }, - { - "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}W{2.data_type}Rh_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpyhisat_acc{0.width_suffix}", - "ret": "s32", - "args": ["0", "0d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vdsad_W{1.data_type}Ruh{0.widthd_b}", - "width": [512, 1024], - "llvm": "vdsaduh{0.widthd_suffix}", - "ret": "u32d", - "args": ["u16d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vdsadacc_W{1.data_type}W{2.data_type}Ruh{0.widthd_b}", - "width": [512, 1024], - "llvm": "vdsaduh.acc{0.widthd_suffix}", - "ret": "u32d", - "args": ["0", "u16d", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}V{2.data_type}Rh_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpyhsat_acc{0.width_suffix}", - "ret": "s32", - "args": ["0", "s16", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}W{2.data_type}Ruh_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpyhsuisat_acc{0.width_suffix}", - "ret": "s32", - "args": ["0", "s16d", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}V{2.data_type}Ruh_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpyhsusat_acc{0.width_suffix}", - "ret": "s32", - "args": ["0", "s16", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vdmpyacc_V{1.data_type}V{2.data_type}V{3.data_type}_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vdmpyhvsat_acc{0.width_suffix}", - "ret": "s32", - "args": ["0", "s16", "s16"] - }, - { - "intrinsic": "Q_vcmp_eq_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "veq{1.data_type}{0.width_suffix}", - "ret": "u32hhh", - "args": ["s(8-32)", "1"] - }, - { - "intrinsic": "Q_vcmp_eqand_QV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "veq{2.data_type}.and{0.width_suffix}", - "ret": "u32hhh", - "args": ["0", "s(8-32)", "2"] - }, - { - "intrinsic": "Q_vcmp_eqor_QV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "veq{2.data_type}.or{0.width_suffix}", - "ret": "u32hhh", - "args": ["0", "s(8-32)", "2"] - }, - { - "intrinsic": "Q_vcmp_eqxacc_QV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "veq{2.data_type}.xor{0.width_suffix}", - "ret": "u32hhh", - "args": ["0", "s(8-32)", "2"] - }, - { - "intrinsic": "Q_vcmp_gt_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vgt{1.data_type}{0.width_suffix}", - "ret": "u32hhh", - "args": ["s(8-32)", "1"] - }, - { - "intrinsic": "Q_vcmp_gt_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vgt{1.data_type}{0.width_suffix}", - "ret": "u32hhh", - "args": ["u(8-16)", "1"] - }, - { - "intrinsic": "Q_vcmp_gtand_QV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vgt{2.data_type}.and{0.width_suffix}", - "ret": "u32hhh", - "args": ["0", "s(8-32)", "2"] - }, - { - "intrinsic": "Q_vcmp_gtand_QV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vgt{2.data_type}.and{0.width_suffix}", - "ret": "u32hhh", - "args": ["0", "u(8-16)", "2"] - }, - { - "intrinsic": "Q_vcmp_gtor_QV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vgt{2.data_type}.or{0.width_suffix}", - "ret": "u32hhh", - "args": ["0", "s(8-32)", "2"] - }, - { - "intrinsic": "Q_vcmp_gtor_QV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vgt{2.data_type}.or{0.width_suffix}", - "ret": "u32hhh", - "args": ["0", "u(8-16)", "2"] - }, - { - "intrinsic": "Q_vcmp_gtxacc_QV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vgt{2.data_type}.xor{0.width_suffix}", - "ret": "u32hhh", - "args": ["0", "s(8-32)", "2"] - }, - { - "intrinsic": "Q_vcmp_gtxacc_QV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vgt{2.data_type}.xor{0.width_suffix}", - "ret": "u32hhh", - "args": ["0", "u(8-16)", "2"] - }, - { - "intrinsic": "V{0.data_type}_vinsert_V{1.data_type}R{0.width_b}", - "width": [512, 1024], - "llvm": "vinsertwr{0.width_suffix}", - "ret": "s32", - "args": ["S32"] - }, - { - "intrinsic": "V{0.data_type}_vlsr_V{1.data_type}R{0.width_b}", - "width": [512, 1024], - "llvm": "vlsr{0.data_type_plain}{0.width_suffix}", - "ret": "u(16-32)", - "args": ["0", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vlsr_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vlsr{0.data_type}v{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vlut32_V{1.data_type}V{2.data_type}R{0.width_b}", - "width": [512, 1024], - "llvm": "vlutvv{0.data_type}{0.width_suffix}", - "ret": "s8", - "args": ["0", "0", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vlut16_V{1.data_type}V{2.data_type}R{0.widthd_b}", - "width": [512, 1024], - "llvm": "vlutvw{0.data_type}{0.widthd_suffix}", - "ret": "s16d", - "args": ["s8", "s16", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vlut32or_V{1.data_type}V{2.data_type}V{3.data_type}R{0.width_b}", - "width": [512, 1024], - "llvm": "vlutvv{0.data_type}.oracc{0.width_suffix}", - "ret": "s8", - "args": ["0", "0", "0", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vlut16or_W{1.data_type}V{2.data_type}V{3.data_type}R{0.widthd_b}", - "width": [512, 1024], - "llvm": "vlutvw{0.data_type}.oracc{0.widthd_suffix}", - "ret": "s16d", - "args": ["0", "s8", "s16", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vmax_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vmax{0.data_type}{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vmax_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vmax{0.data_type}{0.width_suffix}", - "ret": "u(8-16)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vmin_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vmin{0.data_type}{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vmin_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vmin{0.data_type}{0.width_suffix}", - "ret": "u(8-16)", - "args": ["0", "0"] - }, - { - "intrinsic": "W{0.data_type}_vmpa_W{1.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpabus{0.widthd_suffix}", - "ret": "s16d", - "args": ["u8d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vmpaacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpabus.acc{0.widthd_suffix}", - "ret": "s16d", - "args": ["0", "u8d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vmpa_W{1.data_type}W{2.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpab{1.kind}{2.kind}v{0.widthd_suffix}", - "ret": "s16d", - "args": ["u8d", "i8d"] - }, - { - "intrinsic": "W{0.data_type}_vmpa_W{1.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpahb{0.widthd_suffix}", - "ret": "s32d", - "args": ["s16d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vmpaacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpahb.acc{0.widthd_suffix}", - "ret": "s32d", - "args": ["0", "s16d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vmpy_V{1.data_type}V{2.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpy{1.data_type}us{0.widthd_suffix}", - "ret": "s(16-32)d", - "args": ["0n", "0nu"] - }, - { - "intrinsic": "W{0.data_type}_vmpyacc_W{1.data_type}V{2.data_type}V{3.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpy{2.data_type}us.acc{0.widthd_suffix}", - "ret": "s(16-32)d", - "args": ["0", "0n", "0nu"] - }, - { - "intrinsic": "W{0.data_type}_vmpy_V{1.data_type}V{2.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpybusv{0.widthd_suffix}", - "ret": "s16d", - "args": ["u8", "s8"] - }, - { - "intrinsic": "W{0.data_type}_vmpyacc_W{1.data_type}V{2.data_type}V{3.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpybusv.acc{0.widthd_suffix}", - "ret": "s16d", - "args": ["0", "0nu", "0n"] - }, - { - "intrinsic": "W{0.data_type}_vmpy_V{1.data_type}V{2.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpy{1.data_type}v{0.widthd_suffix}", - "ret": "i(16-32)d", - "args": ["0n", "0n"] - }, - { - "intrinsic": "W{0.data_type}_vmpyacc_W{1.data_type}V{2.data_type}V{3.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpy{2.data_type}v.acc{0.widthd_suffix}", - "ret": "i(16-32)d", - "args": ["0", "0n", "0n"] - }, - { - "intrinsic": "V{0.data_type}_vmpye_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyewuh{0.width_suffix}", - "ret": "s32", - "args": ["s32", "u16"] - }, - { - "intrinsic": "W{0.data_type}_vmpy_V{1.data_type}R{1.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpy{1.data_type}{0.widthd_suffix}", - "ret": "i32d", - "args": ["0n", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vmpyacc_W{1.data_type}V{2.data_type}R{2.data_type}_sat{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpy{2.data_type}sat.acc{0.widthd_suffix}", - "ret": "s32d", - "args": ["0", "0n", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vmpy_V{1.data_type}R{1.data_type}_s1_rnd_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vmpy{1.data_type}srs{0.width_suffix}", - "ret": "s32", - "args": ["0nd", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vmpy_V{1.data_type}R{1.data_type}_s1_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vmpy{1.data_type}ss{0.width_suffix}", - "ret": "s32", - "args": ["0nd", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vmpy_V{1.data_type}V{2.data_type}_s1_rnd_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vmpy{1.data_type}vsrs{0.width_suffix}", - "ret": "s16", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vmpyieo_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyieo{1.data_type}{0.width_suffix}", - "ret": "s32", - "args": ["0nd", "0nd"] - }, - { - "intrinsic": "V{0.data_type}_vmpyieacc_V{1.data_type}V{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyie{2.data_type}{3.data_type}.acc{0.width_suffix}", - "ret": "s32", - "args": ["0", "0", "i16"] - }, - { - "intrinsic": "V{0.data_type}_vmpyie_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyie{1.data_type}{2.data_type}{0.width_suffix}", - "ret": "s32", - "args": ["0", "u16"] - }, - { - "intrinsic": "V{0.data_type}_vmpyi_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyi{1.data_type}{0.width_suffix}", - "ret": "s16", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vmpyiacc_V{1.data_type}V{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyi{1.data_type}.acc{0.width_suffix}", - "ret": "s16", - "args": ["0", "0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vmpyi_V{1.data_type}Rb{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyi{1.data_type}b{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vmpyiacc_V{1.data_type}V{2.data_type}Rb{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyi{1.data_type}b.acc{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "0", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vmpyi_V{1.data_type}Rh{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyi{1.data_type}h{0.width_suffix}", - "ret": "s32", - "args": ["0", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vmpyiacc_V{1.data_type}V{2.data_type}Rh{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyi{1.data_type}h.acc{0.width_suffix}", - "ret": "s32", - "args": ["0", "0", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vmpyi_V{1.data_type}Rub{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyi{1.data_type}ub{0.width_suffix}", - "ret": "s32", - "args": ["0", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vmpyiacc_V{1.data_type}V{2.data_type}Rub{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyi{1.data_type}ub.acc{0.width_suffix}", - "ret": "s32", - "args": ["0", "0", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vmpyo_V{1.data_type}V{2.data_type}_s1_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyo{1.data_type}{2.data_type}{0.width_suffix}", - "ret": "s32", - "args": ["0", "0nd"] - }, - { - "intrinsic": "V{0.data_type}_vmpyo_V{1.data_type}V{2.data_type}_s1_rnd_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyo{1.data_type}{2.data_type}.rnd{0.width_suffix}", - "ret": "s32", - "args": ["0", "0nd"] - }, - { - "intrinsic": "V{0.data_type}_vmpyo_V{1.data_type}V{2.data_type}_s1_rnd_sat_shift{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyo{1.data_type}{2.data_type}.rnd.sacc{0.width_suffix}", - "ret": "s32", - "args": ["0", "0nd"] - }, - { - "intrinsic": "V{0.data_type}_vmpyo_V{1.data_type}V{2.data_type}_s1_sat_shift{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyo{1.data_type}{2.data_type}.sacc{0.width_suffix}", - "ret": "s32", - "args": ["0", "0nd"] - }, - { - "intrinsic": "V{0.data_type}_vmpyio_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vmpyio{1.data_type}{2.data_type}{0.width_suffix}", - "ret": "s32", - "args": ["0", "0nd"] - }, - { - "intrinsic": "W{0.data_type}_vmpy_V{1.data_type}R{1.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpy{1.data_type}{0.widthd_suffix}", - "ret": "u16d", - "args": ["0n", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vmpyacc_W{1.data_type}V{2.data_type}R{2.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vmpy{2.data_type}.acc{0.widthd_suffix}", - "ret": "u(16-32)d", - "args": ["0", "0n", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vmux_QVV{0.width_b}", - "width": [512, 1024], - "llvm": "vmux{0.width_suffix}", - "ret": "u32", - "args": ["0hhh", "0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vnavg_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vnavg{0.data_type}{0.width_suffix}", - "ret": "i(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vnavg_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vnavg{0.data_type}{0.width_suffix}", - "ret": "u8", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vnormamt_V{1.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vnormamt{0.data_type}{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0"] - }, - { - "intrinsic": "V_vnot_VV{0.width_b}", - "width": [512, 1024], - "llvm": "vnot{0.width_suffix}", - "ret": "u16", - "args": ["0"] - }, - { - "intrinsic": "V_vor_VV{0.width_b}", - "width": [512, 1024], - "llvm": "vor{0.width_suffix}", - "ret": "u16", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vpacke_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vpack{1.data_type}e{0.width_suffix}", - "ret": "s(8-16)", - "args": ["0hw", "0hw"] - }, - { - "intrinsic": "V{0.data_type}_vpacko_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vpack{1.data_type}o{0.width_suffix}", - "ret": "s(8-16)", - "args": ["0hw", "0hw"] - }, - { - "intrinsic": "V{0.data_type}_vpack_V{1.data_type}V{2.data_type}_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vpack{1.data_type}{0.data_type}.sat{0.width_suffix}", - "ret": "i(8-16)", - "args": ["0hws", "0hws"] - }, - { - "intrinsic": "V{0.data_type}_vpopcount_V{1.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vpopcount{0.data_type}{0.width_suffix}", - "ret": "s16", - "args": ["0"] - }, - { - "intrinsic": "V_vrdelta_VV{0.width_b}", - "width": [512, 1024], - "llvm": "vrdelta{0.width_suffix}", - "ret": "u8", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vrmpy_V{1.data_type}Rb{0.width_b}", - "width": [512, 1024], - "llvm": "vrmpybus{0.width_suffix}", - "ret": "s32", - "args": ["u8", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vrmpyacc_V{1.data_type}V{2.data_type}Rb{0.width_b}", - "width": [512, 1024], - "llvm": "vrmpybus.acc{0.width_suffix}", - "ret": "s32", - "args": ["0", "u8", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vrmpy_W{1.data_type}RbI{0.widthd_b}", - "width": [512, 1024], - "llvm": "vrmpybusi{0.widthd_suffix}", - "ret": "s32d", - "args": ["u8d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vrmpyacc_W{1.data_type}W{2.data_type}RbI{0.widthd_b}", - "width": [512, 1024], - "llvm": "vrmpybusi.acc{0.widthd_suffix}", - "ret": "s32d", - "args": ["0", "u8d", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vrmpy_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vrmpybusv{0.width_suffix}", - "ret": "s32", - "args": ["u8", "s8"] - }, - { - "intrinsic": "V{0.data_type}_vrmpyacc_V{1.data_type}V{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vrmpybusv.acc{0.width_suffix}", - "ret": "s32", - "args": ["0", "u8", "s8"] - }, - { - "intrinsic": "V{0.data_type}_vrmpy_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vrmpy{1.data_type}v{0.width_suffix}", - "ret": "i32", - "args": ["0nndd", "0nndd"] - }, - { - "intrinsic": "V{0.data_type}_vrmpyacc_V{1.data_type}V{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vrmpy{1.data_type}v.acc{0.width_suffix}", - "ret": "i32", - "args": ["0", "0nndd", "0nndd"] - }, - { - "intrinsic": "V{0.data_type}_vrmpy_V{1.data_type}Rub{0.width_b}", - "width": [512, 1024], - "llvm": "vrmpyub{0.width_suffix}", - "ret": "u32", - "args": ["u8", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vrmpyacc_V{1.data_type}V{2.data_type}Rub{0.width_b}", - "width": [512, 1024], - "llvm": "vrmpyub.acc{0.width_suffix}", - "ret": "u32", - "args": ["0", "u8", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vrmpy_W{1.data_type}RubI{0.widthd_b}", - "width": [512, 1024], - "llvm": "vrmpyubi{0.widthd_suffix}", - "ret": "u32d", - "args": ["u8d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vrmpyacc_W{1.data_type}W{2.data_type}RubI{0.widthd_b}", - "width": [512, 1024], - "llvm": "vrmpyubi.acc{0.widthd_suffix}", - "ret": "u32d", - "args": ["0", "u8d", "U32"] - }, - { - "intrinsic": "V_vror_VR{0.width_b}", - "width": [512, 1024], - "llvm": "vror{0.width_suffix}", - "ret": "u8", - "args": ["0", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vround_V{1.data_type}V{2.data_type}_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vround{1.data_type}{0.data_type}{0.width_suffix}", - "ret": "i(8-16)", - "args": ["0hws", "0hws"] - }, - { - "intrinsic": "W{0.data_type}_vrsad_W{1.data_type}RubI{0.widthd_b}", - "width": [512, 1024], - "llvm": "vrsadubi{0.widthd_suffix}", - "ret": "u32d", - "args": ["u8d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vrsadacc_W{1.data_type}W{2.data_type}RubI{0.widthd_b}", - "width": [512, 1024], - "llvm": "vrsadubi.acc{0.widthd_suffix}", - "ret": "u32d", - "args": ["0", "u8d", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vsat_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vsat{1.data_type}{0.data_type}{0.width_suffix}", - "ret": "u8", - "args": ["0hws", "0hws"] - }, - { - "intrinsic": "V{0.data_type}_vsat_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vsat{1.data_type}{0.data_type}{0.width_suffix}", - "ret": "s16", - "args": ["0hw", "0hw"] - }, - { - "intrinsic": "W{0.data_type}_vsxt_V{1.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vs{1.data_type}{0.widthd_suffix}", - "ret": "s(16-32)d", - "args": ["0n"] - }, - { - "intrinsic": "W{0.data_type}_vzxt_V{1.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vz{1.data_type_plain}{0.widthd_suffix}", - "ret": "u(16-32)d", - "args": ["0n"] - }, - { - "intrinsic": "V{0.data_type}_condacc_QV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vadd{0.data_type}q{0.width_suffix}", - "ret": "s(8-32)", - "args": ["u32hhh", "0", "0"] - }, - { - "intrinsic": "V{0.data_type}_condacc_QnV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vadd{0.data_type}nq{0.width_suffix}", - "ret": "s(8-32)", - "args": ["u32hhh", "0", "0"] - }, - { - "intrinsic": "V{0.data_type}_condnac_QV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vsub{0.data_type}q{0.width_suffix}", - "ret": "s(8-32)", - "args": ["u32hhh", "0", "0"] - }, - { - "intrinsic": "V{0.data_type}_condnac_QnV{2.data_type}V{3.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vsub{0.data_type}nq{0.width_suffix}", - "ret": "s(8-32)", - "args": ["u32hhh", "0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vshuffe_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vshufe{1.data_type}{0.width_suffix}", - "ret": "s16", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vshuffo_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vshufo{1.data_type}{0.width_suffix}", - "ret": "s16", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vshuff_V{1.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vshuff{1.data_type}{0.width_suffix}", - "ret": "s(8-16)", - "args": ["0"] - }, - { - "intrinsic": "V{0.data_type}_vshuffe_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vshuffe{1.data_type}{0.width_suffix}", - "ret": "s8", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vshuffo_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vshuffo{1.data_type}{0.width_suffix}", - "ret": "s8", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vshuffoe_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vshuffoe{1.data_type}{0.width_suffix}", - "ret": "s(8-16)", - "args": ["0", "0"] - }, - { - "intrinsic": "W_vshuff_VVR{0.widthd_b}", - "width": [512, 1024], - "llvm": "vshufvvd{0.widthd_suffix}", - "ret": "u8d", - "args": ["0h", "0h", "U32"] - }, - { - "intrinsic": "V{0.data_type}_vsub_V{1.data_type}V{2.data_type}{0.width_b}", - "width": [512, 1024], - "llvm": "vsub{0.data_type}{0.width_suffix}", - "ret": "s(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vsub_V{1.data_type}V{2.data_type}_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vsub{0.data_type}sat{0.width_suffix}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "V{0.data_type}_vsub_V{1.data_type}V{2.data_type}_sat{0.width_b}", - "width": [512, 1024], - "llvm": "vsub{0.data_type}sat{0.width_suffix}", - "ret": "u(8-16)", - "args": ["0", "0"] - }, - { - "intrinsic": "W{0.data_type}_vsub_W{1.data_type}W{2.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vsub{0.data_type}.dv{0.widthd_suffix}", - "ret": "s(8-32)d", - "args": ["0", "0"] - }, - { - "intrinsic": "W{0.data_type}_vsub_W{1.data_type}W{2.data_type}_sat{0.widthd_b}", - "width": [512, 1024], - "llvm": "vsub{0.data_type}sat.dv{0.widthd_suffix}", - "ret": "s(16-32)d", - "args": ["0", "0"] - }, - { - "intrinsic": "W{0.data_type}_vsub_W{1.data_type}W{2.data_type}_sat{0.widthd_b}", - "width": [512, 1024], - "llvm": "vsub{0.data_type}sat.dv{0.widthd_suffix}", - "ret": "u(8-16)d", - "args": ["0", "0"] - }, - { - "intrinsic": "W_vswap_QVV{0.widthd_b}", - "width": [512, 1024], - "llvm": "vswap{0.widthd_suffix}", - "ret": "u8d", - "args": ["u32hhh", "0h", "0h"] - }, - { - "intrinsic": "W{0.data_type}_vtmpy_W{1.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vtmpyb{0.widthd_suffix}", - "ret": "s16d", - "args": ["0nd", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vtmpyacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vtmpyb.acc{0.widthd_suffix}", - "ret": "s16d", - "args": ["0", "0nd", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vtmpy_W{1.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vtmpybus{0.widthd_suffix}", - "ret": "s16d", - "args": ["u8d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vtmpyacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vtmpybus.acc{0.widthd_suffix}", - "ret": "s16d", - "args": ["0", "u8d", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vtmpy_W{1.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vtmpyhb{0.widthd_suffix}", - "ret": "s32d", - "args": ["0nd", "U32"] - }, - { - "intrinsic": "W{0.data_type}_vunpack_V{1.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vunpack{1.data_type}{0.widthd_suffix}", - "ret": "i(16-32)d", - "args": ["0n"] - }, - { - "intrinsic": "W{0.data_type}_vunpackoor_W{1.data_type}V{2.data_type}{0.widthd_b}", - "width": [512, 1024], - "llvm": "vunpacko{2.data_type}{0.widthd_suffix}", - "ret": "s(16-32)d", - "args": ["0", "0n"] - }, - { - "intrinsic": "W{0.data_type}_vtmpyacc_W{1.data_type}W{2.data_type}Rb{0.widthd_b}", - "width": [512, 1024], - "llvm": "vtmpyhb.acc{0.widthd_suffix}", - "ret": "s32d", - "args": ["0", "0nd", "U32"] - }, - { - "intrinsic": "V_vxor_VV{0.width_b}", - "width": [512, 1024], - "llvm": "vxor{0.width_suffix}", - "ret": "u16", - "args": ["0", "0"] - } - ] -} diff --git a/src/etc/platform-intrinsics/nvptx/cuda.json b/src/etc/platform-intrinsics/nvptx/cuda.json deleted file mode 100644 index 1beaaeb5d87..00000000000 --- a/src/etc/platform-intrinsics/nvptx/cuda.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "intrinsic_prefix": "_", - "llvm_prefix": "llvm.cuda.", - "intrinsics": [ - { - "intrinsic": "syncthreads", - "width": ["0"], - "llvm": "syncthreads", - "ret": "V", - "args": [] - } - ] -} diff --git a/src/etc/platform-intrinsics/nvptx/info.json b/src/etc/platform-intrinsics/nvptx/info.json deleted file mode 100644 index 80332c54e04..00000000000 --- a/src/etc/platform-intrinsics/nvptx/info.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "platform": "nvptx", - "number_info": { - "signed": {} - }, - "width_info": {} -} diff --git a/src/etc/platform-intrinsics/nvptx/sreg.json b/src/etc/platform-intrinsics/nvptx/sreg.json deleted file mode 100644 index 33d97f26946..00000000000 --- a/src/etc/platform-intrinsics/nvptx/sreg.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "intrinsic_prefix": "_", - "llvm_prefix": "llvm.nvvm.read.ptx.sreg.", - "intrinsics": [ - { - "intrinsic": "block_dim_x", - "width": ["0"], - "llvm": "ntid.x", - "ret": "S32", - "args": [] - }, - { - "intrinsic": "block_dim_y", - "width": ["0"], - "llvm": "ntid.y", - "ret": "S32", - "args": [] - }, - { - "intrinsic": "block_dim_z", - "width": ["0"], - "llvm": "ntid.z", - "ret": "S32", - "args": [] - }, - { - "intrinsic": "block_idx_x", - "width": ["0"], - "llvm": "ctaid.x", - "ret": "S32", - "args": [] - }, - { - "intrinsic": "block_idx_y", - "width": ["0"], - "llvm": "ctaid.y", - "ret": "S32", - "args": [] - }, - { - "intrinsic": "block_idx_z", - "width": ["0"], - "llvm": "ctaid.z", - "ret": "S32", - "args": [] - }, - { - "intrinsic": "grid_dim_x", - "width": ["0"], - "llvm": "nctaid.x", - "ret": "S32", - "args": [] - }, - { - "intrinsic": "grid_dim_y", - "width": ["0"], - "llvm": "nctaid.y", - "ret": "S32", - "args": [] - }, - { - "intrinsic": "grid_dim_z", - "width": ["0"], - "llvm": "nctaid.z", - "ret": "S32", - "args": [] - }, - { - "intrinsic": "thread_idx_x", - "width": ["0"], - "llvm": "tid.x", - "ret": "S32", - "args": [] - }, - { - "intrinsic": "thread_idx_y", - "width": ["0"], - "llvm": "tid.y", - "ret": "S32", - "args": [] - }, - { - "intrinsic": "thread_idx_z", - "width": ["0"], - "llvm": "tid.z", - "ret": "S32", - "args": [] - } - ] -} diff --git a/src/etc/platform-intrinsics/powerpc.json b/src/etc/platform-intrinsics/powerpc.json deleted file mode 100644 index acb6813887c..00000000000 --- a/src/etc/platform-intrinsics/powerpc.json +++ /dev/null @@ -1,294 +0,0 @@ -{ - "platform": "powerpc", - "intrinsic_prefix": "_vec_", - "llvm_prefix": "llvm.ppc.altivec.", - "number_info": { - "unsigned": { - "kind" : "u", - "data_type_short": { "8": "b", "16": "h", "32": "w", "64": "d" } - }, - "signed": { - "kind" : "s", - "data_type_short": { "8": "b", "16": "h", "32": "w", "64": "d" } - }, - "float": {} - }, - "width_info": { - "128": { "width": "" } - }, - "intrinsics": [ - { - "intrinsic": "perm", - "width": [128], - "llvm": "vperm", - "ret": "s32", - "args": ["0", "0", "s8"] - }, - { - "intrinsic": "mradds", - "width": [128], - "llvm": "vmhraddshs", - "ret": "s16", - "args": ["0", "0", "0"] - }, - { - "intrinsic": "cmpb", - "width": [128], - "llvm": "vcmpbfp", - "ret": "s32", - "args": ["f32", "f32"] - }, - { - "intrinsic": "cmpeq{0.data_type_short}", - "width": [128], - "llvm": "vcmpequ{0.data_type_short}", - "ret": "s(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "cmpgt{1.kind}{1.data_type_short}", - "width": [128], - "llvm": "vcmpgt{1.kind}{1.data_type_short}", - "ret": "s(8-32)", - "args": ["0u", "1"] - }, - { - "intrinsic": "cmpgt{1.kind}{1.data_type_short}", - "width": [128], - "llvm": "vcmpgt{1.kind}{1.data_type_short}", - "ret": "s(8-32)", - "args": ["0", "1"] - }, - { - "intrinsic": "max{0.kind}{0.data_type_short}", - "width": [128], - "llvm": "vmax{0.kind}{0.data_type_short}", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "min{0.kind}{0.data_type_short}", - "width": [128], - "llvm": "vmin{0.kind}{0.data_type_short}", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "sub{0.kind}{0.data_type_short}s", - "width": [128], - "llvm": "vsub{0.kind}{0.data_type_short}s", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "subc", - "width": [128], - "llvm": "vsubcuw", - "ret": "u32", - "args": ["0", "0"] - }, - { - "intrinsic": "add{0.kind}{0.data_type_short}s", - "width": [128], - "llvm": "vadd{0.kind}{0.data_type_short}s", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "addc", - "width": [128], - "llvm": "vaddcuw", - "ret": "u32", - "args": ["0", "0"] - }, - { - "intrinsic": "mule{1.kind}{1.data_type_short}", - "width": [128], - "llvm": "vmule{0.kind}{1.data_type_short}", - "ret": "i(16-32)", - "args": ["0N", "1"] - }, - { - "intrinsic": "mulo{1.kind}{1.data_type_short}", - "width": [128], - "llvm": "vmulo{0.kind}{1.data_type_short}", - "ret": "i(16-32)", - "args": ["0N", "1"] - }, - { - "intrinsic": "avg{0.kind}{0.data_type_short}", - "width": [128], - "llvm": "vavg{0.kind}{0.data_type_short}", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "packs{0.kind}{1.data_type_short}", - "width": [128], - "llvm": "vpk{0.kind}{1.data_type_short}{0.kind}s", - "ret": "i(8-16)", - "args": ["0W", "1"] - }, - { - "intrinsic": "packsu{1.kind}{1.data_type_short}", - "width": [128], - "llvm": "vpk{1.kind}{1.data_type_short}{0.kind}s", - "ret": "u(8-16)", - "args": ["0Ws", "1"] - }, - { - "intrinsic": "packpx", - "width": [128], - "llvm": "vpkpx", - "ret": "s16", - "args": ["s32", "s32"] - }, - { - "intrinsic": "unpackl{1.kind}{1.data_type_short}", - "width": [128], - "llvm": "vupkl{1.kind}{1.data_type_short}", - "ret": "s(16-32)", - "args": ["0N"] - }, - { - "intrinsic": "unpackh{1.kind}{1.data_type_short}", - "width": [128], - "llvm": "vupkh{1.kind}{1.data_type_short}", - "ret": "s(16-32)", - "args": ["0N"] - }, - { - "intrinsic": "madds", - "width": [128], - "llvm": "vmhaddshs", - "ret": "s16", - "args": ["0", "0", "0"] - }, - { - "intrinsic": "msumu{1.data_type_short}m", - "width": [128], - "llvm": "vmsumu{1.data_type_short}m", - "ret": "u32", - "args": ["u(8-16)", "1", "u32"] - }, - { - "intrinsic": "msummbm", - "width": [128], - "llvm": "vmsummbm", - "ret": "s32", - "args": ["s8", "u8", "s32"] - }, - { - "intrinsic": "msumshm", - "width": [128], - "llvm": "vmsumshm", - "ret": "s32", - "args": ["s16", "s16", "s32"] - }, - { - "intrinsic": "msum{0.kind}hs", - "width": [128], - "llvm": "vmsum{0.kind}hs", - "ret": "i32", - "args": ["0N", "0N", "0"] - }, - { - "intrinsic": "sum2s", - "width": [128], - "llvm": "vsum2sws", - "ret": "s32", - "args": ["0", "0"] - }, - { - "intrinsic": "sum4{0.kind}bs", - "width": [128], - "llvm": "vsum4{0.kind}bs", - "ret": "i32", - "args": ["0NN", "0"] - }, - { - "intrinsic": "sum4shs", - "width": [128], - "llvm": "vsum4shs", - "ret": "s32", - "args": ["0N", "0"] - }, - { - "intrinsic": "sums", - "width": [128], - "llvm": "vsumsws", - "ret": "s32", - "args": ["0", "0"] - }, - { - "intrinsic": "madd", - "width": [128], - "llvm": "vmaddfp", - "ret": "f32", - "args": ["0", "0", "0"] - }, - { - "intrinsic": "nmsub", - "width": [128], - "llvm": "vnmsubfp", - "ret": "f32", - "args": ["0", "0", "0"] - }, - { - "intrinsic": "expte", - "width": [128], - "llvm": "vexptefp", - "ret": "f32", - "args": ["0"] - }, - { - "intrinsic": "floor", - "width": [128], - "llvm": "vrfim", - "ret": "f32", - "args": ["0"] - }, - { - "intrinsic": "ceil", - "width": [128], - "llvm": "vrfip", - "ret": "f32", - "args": ["0"] - }, - { - "intrinsic": "round", - "width": [128], - "llvm": "vrfin", - "ret": "f32", - "args": ["0"] - }, - { - "intrinsic": "trunc", - "width": [128], - "llvm": "vrfiz", - "ret": "f32", - "args": ["0"] - }, - { - "intrinsic": "loge", - "width": [128], - "llvm": "vlogefp", - "ret": "f32", - "args": ["0"] - }, - { - "intrinsic": "re", - "width": [128], - "llvm": "vrefp", - "ret": "f32", - "args": ["0"] - }, - { - "intrinsic": "rsqrte", - "width": [128], - "llvm": "vrsqrtefp", - "ret": "f32", - "args": ["0"] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/avx.json b/src/etc/platform-intrinsics/x86/avx.json deleted file mode 100644 index 1f41e2ecf3e..00000000000 --- a/src/etc/platform-intrinsics/x86/avx.json +++ /dev/null @@ -1,272 +0,0 @@ -{ - "intrinsic_prefix": "_mm", - "llvm_prefix": "llvm.x86.avx.", - "intrinsics": [ - { - "intrinsic": "256_addsub_{0.data_type}", - "width": [256], - "llvm": "addsub.{0.data_type}.256", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "256_blendv_{0.data_type}", - "width": [256], - "llvm": "blendv.{0.data_type}.256", - "ret": "f(32-64)", - "args": ["0", "0", "0"] - }, - { - "intrinsic": "256_broadcast_{0.data_type}", - "width": [256], - "llvm": "vbroadcastf128.{0.data_type}.256", - "ret": "f(32-64)", - "args": ["s8SPc"] - }, - { - "intrinsic": "256_cmp_{0.data_type}", - "width": [256], - "llvm": "cmp.{1.data_type}.256", - "ret": "f(32-64)", - "args": ["0", "0", "s8S"] - }, - { - "intrinsic": "256_cvtepi32_pd", - "width": [256], - "llvm": "cvtdq2.pd.256", - "ret": "f64", - "args": ["s32h"] - }, - { - "intrinsic": "256_cvtepi32_ps", - "width": [256], - "llvm": "cvtdq2.ps.256", - "ret": "f32", - "args": ["s32"] - }, - { - "intrinsic": "256_cvtpd_epi32", - "width": [256], - "llvm": "cvt.pd2dq.256", - "ret": "s32h", - "args": ["f64"] - }, - { - "intrinsic": "256_cvtpd_ps", - "width": [256], - "llvm": "cvt.pd2.ps.256", - "ret": "f32h", - "args": ["f64"] - }, - { - "intrinsic": "256_cvtps_epi32", - "width": [256], - "llvm": "cvt.ps2dq.256", - "ret": "s32", - "args": ["f32"] - }, - { - "intrinsic": "256_cvtps_pd", - "width": [256], - "llvm": "cvt.ps2.pd.256", - "ret": "f64", - "args": ["f32h"] - }, - { - "intrinsic": "256_cvttpd_epi32", - "width": [256], - "llvm": "cvtt.pd2dq.256", - "ret": "s32h", - "args": ["f64"] - }, - { - "intrinsic": "256_cvttps_epi32", - "width": [256], - "llvm": "cvtt.ps2dq.256", - "ret": "s32", - "args": ["f32"] - }, - { - "intrinsic": "256_dp_ps", - "width": [256], - "llvm": "dp.ps.256", - "ret": "f32", - "args": ["0", "0", "S32/8"] - }, - { - "intrinsic": "256_hadd_{0.data_type}", - "width": [256], - "llvm": "hadd.{0.data_type}.256", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "256_hsub_{0.data_type}", - "width": [256], - "llvm": "hsub.{0.data_type}.256", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "256_max_{0.data_type}", - "width": [256], - "llvm": "max.{0.data_type}.256", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "{0.width_mm}_maskload_{0.data_type}", - "width": [128, 256], - "llvm": "maskload.{0.data_type_short}{0.width_suffix}", - "ret": ["f(32-64)"], - "args": ["0SPc/S8", "0s->0"] - }, - { - "intrinsic": "{3.width_mm}_maskstore_{3.data_type}", - "width": [128, 256], - "llvm": "maskstore.{3.data_type_short}{3.width_suffix}", - "ret": "V", - "args": ["F(32-64)Pm/S8", "1Dsv->1Dv", "1Dv"] - }, - { - "intrinsic": "256_min_{0.data_type}", - "width": [256], - "llvm": "min.{0.data_type}.256", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "256_movemask_ps", - "width": [256], - "llvm": "movmsk.ps.256", - "ret": "S32", - "args": ["f32"] - }, - { - "intrinsic": "256_movemask_pd", - "width": [256], - "llvm": "movmsk.pd.256", - "ret": "S32", - "args": ["f64"] - }, - { - "intrinsic": "{0.width_mm}_permutevar_{0.data_type}", - "width": [128, 256], - "llvm": "vpermilvar.{0.data_type}{0.width_suffix}", - "ret": "f(32-64)", - "args": ["0", "0s"] - }, - { - "intrinsic": "256_rcp_ps", - "width": [256], - "llvm": "rcp.ps.256", - "ret": "f32", - "args": ["f32"] - }, - { - "intrinsic": "256_rsqrt_ps", - "width": [256], - "llvm": "rsqrt.ps.256", - "ret": "f32", - "args": ["f32"] - }, - { - "intrinsic": "256_storeu_{2.data_type}", - "width": [256], - "llvm": "storeu.ps.256", - "ret": "V", - "args": ["f(32-64)Pm/U8", "1D"] - }, - { - "intrinsic": "256_storeu_si256", - "width": [256], - "llvm": "storeu.dq.256", - "ret": "V", - "args": ["u8Pm/U8", "1D"] - }, - { - "intrinsic": "256_sqrt_{0.data_type}", - "width": [256], - "llvm": "!llvm.sqrt.{0.llvm_name}", - "ret": "f(32-64)", - "args": ["0"] - }, - { - "intrinsic": "{1.width_mm}_testc_ps", - "width": [128, 256], - "llvm": "vtestc.ps{1.width_suffix}", - "ret": "S32", - "args": ["f32", "f32"] - }, - { - "intrinsic": "{1.width_mm}_testc_pd", - "width": [128, 256], - "llvm": "vtestc.pd{1.width_suffix}", - "ret": "S32", - "args": ["f64", "f64"] - }, - { - "intrinsic": "256_testc_si256", - "width": [256], - "llvm": "ptestc.256", - "ret": "S32", - "args": ["u64", "u64"] - }, - { - "intrinsic": "{1.width_mm}_testnzc_ps", - "width": [128, 256], - "llvm": "vtestnzc.ps{1.width_suffix}", - "ret": "S32", - "args": ["f32", "f32"] - }, - { - "intrinsic": "{1.width_mm}_testnzc_pd", - "width": [128, 256], - "llvm": "vtestnzc.pd{1.width_suffix}", - "ret": "S32", - "args": ["f64", "f64"] - }, - { - "intrinsic": "256_testnzc_si256", - "width": [256], - "llvm": "ptestnzc.256", - "ret": "S32", - "args": ["u64", "u64"] - }, - { - "intrinsic": "{1.width_mm}_testz_ps", - "width": [128, 256], - "llvm": "vtestz.ps{1.width_suffix}", - "ret": "S32", - "args": ["f32", "f32"] - }, - { - "intrinsic": "{1.width_mm}_testz_pd", - "width": [128, 256], - "llvm": "vtestz.pd{1.width_suffix}", - "ret": "S32", - "args": ["f64", "f64"] - }, - { - "intrinsic": "256_testz_si256", - "width": [256], - "llvm": "ptestz.256", - "ret": "S32", - "args": ["u64", "u64"] - }, - { - "intrinsic": "256_zeroall", - "width": [256], - "llvm": "vzeroall", - "ret": "V", - "args": [] - }, - { - "intrinsic": "256_zeroupper", - "width": [256], - "llvm": "vzeroupper", - "ret": "V", - "args": [] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/avx2.json b/src/etc/platform-intrinsics/x86/avx2.json deleted file mode 100644 index dc055b583c5..00000000000 --- a/src/etc/platform-intrinsics/x86/avx2.json +++ /dev/null @@ -1,202 +0,0 @@ -{ - "intrinsic_prefix": "_mm", - "llvm_prefix": "llvm.x86.avx2.", - "intrinsics": [ - { - "intrinsic": "256_abs_{0.data_type}", - "width": [256], - "llvm": "pabs.{0.data_type_short}", - "ret": "s(8-32)", - "args": ["0"] - }, - { - "intrinsic": "256_adds_{0.data_type}", - "width": [256], - "llvm": "padd{0.kind_short}s.{0.data_type_short}", - "ret": "i(8-16)", - "args": ["0", "0"] - }, - { - "intrinsic": "256_avg_{0.data_type}", - "width": [256], - "llvm": "pavg.{0.data_type_short}", - "ret": "u(8-16)", - "args": ["0", "0"] - }, - { - "intrinsic": "256_hadd_{0.data_type}", - "width": [256], - "llvm": "phadd.{0.data_type_short}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "256_hadds_epi16", - "width": [256], - "llvm": "phadd.sw", - "ret": "s16", - "args": ["0", "0"] - }, - { - "intrinsic": "256_hsub_{0.data_type}", - "width": [256], - "llvm": "phsub.{0.data_type_short}", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "256_hsubs_epi16", - "width": [256], - "llvm": "phsub.sw", - "ret": "s16", - "args": ["0", "0"] - }, - { - "intrinsic": "256_madd_epi16", - "width": [256], - "llvm": "pmadd.wd", - "ret": "s32", - "args": ["s16", "s16"] - }, - { - "intrinsic": "256_maddubs_epi16", - "width": [256], - "llvm": "pmadd.ub.sw", - "ret": "s16", - "args": ["s8", "s8"] - }, - { - "intrinsic": "{0.width_mm}_mask_i32gather_{0.data_type}", - "width": [128, 256], - "llvm": "gather.d.{0.data_type_short}{0.width_suffix}", - "ret": ["s32", "f32"], - "args": ["0", "0SPc/S8", "s32", "0s->0", "S32/8"] - }, - { - "intrinsic": "{0.width_mm}_mask_i32gather_{0.data_type}", - "width": [128, 256], - "llvm": "gather.d.{0.data_type_short}{0.width_suffix}", - "ret": ["s64", "f64"], - "args": ["0", "0SPc/S8", "s32x128", "0s->0", "S32/8"] - }, - { - "intrinsic": "{3.width_mm}_mask_i64gather_{0.data_type}", - "width": [128, 256], - "llvm": "gather.q.{0.data_type_short}{0.width_suffix}", - "ret": ["s32x128", "f32x128"], - "args": ["0", "0SPc/S8", "s64", "0s->0", "S32/8"] - }, - { - "intrinsic": "{0.width_mm}_mask_i64gather_{0.data_type}", - "width": [128, 256], - "llvm": "gather.q.{0.data_type_short}{0.width_suffix}", - "ret": ["s64", "f64"], - "args": ["0", "0SPc/S8", "s64", "0s->0", "S32/8"] - }, - { - "intrinsic": "{0.width_mm}_maskload_{0.data_type}", - "width": [128, 256], - "llvm": "maskload.{0.data_type_short}{0.width_suffix}", - "ret": ["s(32-64)"], - "args": ["0Pc/S8", "0"] - }, - { - "intrinsic": "{2.width_mm}_maskstore_{2.data_type}", - "width": [128, 256], - "llvm": "maskstore.{2.data_type_short}{2.width_suffix}", - "ret": "V", - "args": ["S(32-64)Pm/S8", "1Dv", "2"] - }, - { - "intrinsic": "256_max_{0.data_type}", - "width": [256], - "llvm": "pmax{0.kind}.{0.data_type_short}", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "256_min_{0.data_type}", - "width": [256], - "llvm": "pmin{0.kind}.{0.data_type_short}", - "ret": "i(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "256_movemask_epi8", - "width": [256], - "llvm": "pmovmskb", - "ret": "S32", - "args": ["s8"] - }, - { - "intrinsic": "256_mpsadbw_epu8", - "width": [256], - "llvm": "mpsadbw", - "ret": "u16", - "args": ["u8", "u8", "S32/8"] - }, - { - "intrinsic": "256_mul_{0.data_type}", - "width": [256], - "llvm": "pmul{0.data_type_short}.dq", - "ret": "i64", - "args": ["0dn", "0dn"] - }, - { - "intrinsic": "256_mulhi_{0.data_type}", - "width": [256], - "llvm": "pmulh{0.data_type_short}.w", - "ret": "i16", - "args": ["0", "0"] - }, - { - "intrinsic": "256_mulhrs_epi16", - "width": [256], - "llvm": "pmul.hr.sw", - "ret": "s16", - "args": ["0", "0"] - }, - { - "intrinsic": "256_pack{0.kind_short}s_{1.data_type}", - "width": [256], - "llvm": "pack{0.kind}s{1.data_type_short}{0.data_type_short}", - "ret": "i(8-16)", - "args": ["0hws", "0hws"] - }, - { - "intrinsic": "256_permutevar8x32_{0.data_type}", - "width": [256], - "llvm": "perm{0.data_type_short}", - "ret": ["s32", "f32"], - "args": ["0", "0s"] - }, - { - "intrinsic": "256_sad_epu8", - "width": [256], - "llvm": "psad.bw", - "ret": "u64", - "args": ["0", "0"] - }, - { - "intrinsic": "256_shuffle_epi8", - "width": [256], - "llvm": "pshuf.b", - "ret": "s8", - "args": ["0", "0"] - }, - { - "intrinsic": "256_sign_{0.data_type}", - "width": [256], - "llvm": "psign.{0.data_type_short}", - "ret": "s(8-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "256_subs_{0.data_type}", - "width": [256], - "llvm": "psub{0.kind_short}s.{0.data_type_short}", - "ret": "i(8-16)", - "args": ["0", "0"] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/bmi.json b/src/etc/platform-intrinsics/x86/bmi.json deleted file mode 100644 index 24e2cbcf8aa..00000000000 --- a/src/etc/platform-intrinsics/x86/bmi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "intrinsic_prefix": "_bmi", - "llvm_prefix": "llvm.x86.bmi.", - "intrinsics": [ - { - "intrinsic": "_bextr_{0.bitwidth}", - "width": ["0"], - "llvm": "bextr.{0.bitwidth}", - "ret": "S(32-64)u", - "args": ["0", "0"] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/bmi2.json b/src/etc/platform-intrinsics/x86/bmi2.json deleted file mode 100644 index f5a0db5ef51..00000000000 --- a/src/etc/platform-intrinsics/x86/bmi2.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "intrinsic_prefix": "_bmi2", - "llvm_prefix": "llvm.x86.bmi.", - "intrinsics": [ - { - "intrinsic": "_bzhi_{0.bitwidth}", - "width": ["0"], - "llvm": "bzhi.{0.bitwidth}", - "ret": "S(32-64)u", - "args": ["0", "0"] - }, - { - "intrinsic": "_pdep_{0.bitwidth}", - "width": ["0"], - "llvm": "pdep.{0.bitwidth}", - "ret": "S(32-64)u", - "args": ["0", "0"] - }, - { - "intrinsic": "_pext_{0.bitwidth}", - "width": ["0"], - "llvm": "pext.{0.bitwidth}", - "ret": "S(32-64)u", - "args": ["0", "0"] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/fma.json b/src/etc/platform-intrinsics/x86/fma.json deleted file mode 100644 index dcc26cd501c..00000000000 --- a/src/etc/platform-intrinsics/x86/fma.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "intrinsic_prefix": "_mm", - "llvm_prefix": "llvm.x86.fma.", - "intrinsics": [ - { - "intrinsic": "{0.width_mm}_fmadd_{0.data_type}", - "width": [128, 256], - "llvm": "vfmadd.{0.data_type_short}{0.width_suffix}", - "ret": "f(32-64)", - "args": ["0", "0", "0"] - }, - { - "intrinsic": "{0.width_mm}_fmaddsub_{0.data_type}", - "width": [128, 256], - "llvm": "vfmaddsub.{0.data_type_short}{0.width_suffix}", - "ret": "f(32-64)", - "args": ["0", "0", "0"] - }, - { - "intrinsic": "{0.width_mm}_fmsub_{0.data_type}", - "width": [128, 256], - "llvm": "vfmsub.{0.data_type_short}{0.width_suffix}", - "ret": "f(32-64)", - "args": ["0", "0", "0"] - }, - { - "intrinsic": "{0.width_mm}_fmsubadd_{0.data_type}", - "width": [128, 256], - "llvm": "vfmsubadd.{0.data_type_short}{0.width_suffix}", - "ret": "f(32-64)", - "args": ["0", "0", "0"] - }, - { - "intrinsic": "{0.width_mm}_fnmadd_{0.data_type}", - "width": [128, 256], - "llvm": "vfnmadd.{0.data_type_short}{0.width_suffix}", - "ret": "f(32-64)", - "args": ["0", "0", "0"] - }, - { - "intrinsic": "{0.width_mm}_fnmsub_{0.data_type}", - "width": [128, 256], - "llvm": "vfnmsub.{0.data_type_short}{0.width_suffix}", - "ret": "f(32-64)", - "args": ["0", "0", "0"] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/info.json b/src/etc/platform-intrinsics/x86/info.json deleted file mode 100644 index 8e90b8579c4..00000000000 --- a/src/etc/platform-intrinsics/x86/info.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "platform": "x86", - "number_info": { - "signed": { - "kind": "s", - "kind_short": "", - "data_type": { "pattern": "epi{bitwidth}" }, - "bitwidth": { "pattern": "{bitwidth}" }, - "data_type_short": { "8": "b", "16": "w", "32": "d", "64": "q" } - }, - "unsigned": { - "kind": "u", - "kind_short": "u", - "data_type": { "pattern": "epu{bitwidth}" }, - "bitwidth": { "pattern": "{bitwidth}" }, - "data_type_short": { "8": "b", "16": "w", "32": "d", "64": "q" } - }, - "float": { - "kind": "f", - "data_type": { "32": "ps", "64": "pd" }, - "bitwidth": { "pattern": "{bitwidth}" }, - "data_type_short": { "32": "ps", "64": "pd" } - } - }, - "width_info": { - "32": { "width_mm": "32", "width_suffix": "" }, - "64": { "width_mm": "64", "width_suffix": "" }, - "128": { "width_mm": "", "width_suffix": "" }, - "256": { "width_mm": "256", "width_suffix": ".256" }, - "512": { "width_mm": "512", "width_suffix": ".512" } - } -} diff --git a/src/etc/platform-intrinsics/x86/rdrand.json b/src/etc/platform-intrinsics/x86/rdrand.json deleted file mode 100644 index fa2feb4224b..00000000000 --- a/src/etc/platform-intrinsics/x86/rdrand.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "intrinsic_prefix": "_rdrand", - "llvm_prefix": "llvm.x86.rdrand.", - "intrinsics": [ - { - "intrinsic": "16_step", - "width": ["0"], - "llvm": "16", - "ret": "(U16,S32)", - "args": [] - }, - { - "intrinsic": "32_step", - "width": ["0"], - "llvm": "32", - "ret": "(U32,S32)", - "args": [] - }, - { - "intrinsic": "64_step", - "width": ["0"], - "llvm": "64", - "ret": "(U64,S32)", - "args": [] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/rdseed.json b/src/etc/platform-intrinsics/x86/rdseed.json deleted file mode 100644 index 7be64b583e0..00000000000 --- a/src/etc/platform-intrinsics/x86/rdseed.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "intrinsic_prefix": "_rdseed", - "llvm_prefix": "llvm.x86.rdseed.", - "intrinsics": [ - { - "intrinsic": "16_step", - "width": ["0"], - "llvm": "16", - "ret": "(U16,S32)", - "args": [] - }, - { - "intrinsic": "32_step", - "width": ["0"], - "llvm": "32", - "ret": "(U32,S32)", - "args": [] - }, - { - "intrinsic": "64_step", - "width": ["0"], - "llvm": "64", - "ret": "(U64,S32)", - "args": [] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/sse.json b/src/etc/platform-intrinsics/x86/sse.json deleted file mode 100644 index d8eef8a3514..00000000000 --- a/src/etc/platform-intrinsics/x86/sse.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "intrinsic_prefix": "_mm", - "llvm_prefix": "llvm.x86.sse.", - "intrinsics": [ - { - "intrinsic": "_movemask_ps", - "width": [128], - "llvm": "movmsk.ps", - "ret": "S32", - "args": ["f32"] - }, - { - "intrinsic": "_max_ps", - "width": [128], - "llvm": "max.ps", - "ret": "f32", - "args": ["0", "0"] - }, - { - "intrinsic": "_min_ps", - "width": [128], - "llvm": "min.ps", - "ret": "f32", - "args": ["0", "0"] - }, - { - "intrinsic": "_rsqrt_ps", - "width": [128], - "llvm": "rsqrt.ps", - "ret": "f32", - "args": ["0"] - }, - { - "intrinsic": "_rcp_ps", - "width": [128], - "llvm": "rcp.ps", - "ret": "f32", - "args": ["0"] - }, - { - "intrinsic": "_sqrt_ps", - "width": [128], - "llvm": "!llvm.sqrt.v4f32", - "ret": "f32", - "args": ["0"] - }, - { - "intrinsic": "_storeu_ps", - "width": [128], - "llvm": "storeu.ps", - "ret": "V", - "args": ["F32Pm/S8", "f32"] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/sse2.json b/src/etc/platform-intrinsics/x86/sse2.json deleted file mode 100644 index 4d6317d80a5..00000000000 --- a/src/etc/platform-intrinsics/x86/sse2.json +++ /dev/null @@ -1,160 +0,0 @@ -{ - "intrinsic_prefix": "_mm", - "llvm_prefix": "llvm.x86.sse2.", - "intrinsics": [ - { - "intrinsic": "_adds_{0.data_type}", - "width": [128], - "llvm": "padd{0.kind_short}s.{0.data_type_short}", - "ret": "i(8-16)", - "args": ["0", "0"] - }, - { - "intrinsic": "_avg_{0.data_type}", - "width": [128], - "llvm": "pavg.{0.data_type_short}", - "ret": "u(8-16)", - "args": ["0", "0"] - }, - { - "intrinsic": "_lfence", - "width": [128], - "llvm": "lfence", - "ret": "V", - "args": [] - }, - { - "intrinsic": "_madd_epi16", - "width": [128], - "llvm": "pmadd.wd", - "ret": "s32", - "args": ["s16", "s16"] - }, - { - "intrinsic": "_maskmoveu_si128", - "width": [128], - "llvm": "maskmov.dqu", - "ret": "V", - "args": ["u8", "u8", "U8Pm"] - }, - { - "intrinsic": "_max_{0.data_type}", - "width": [128], - "llvm": "pmax{0.kind}.{0.data_type_short}", - "ret": ["s16", "u8"], - "args": ["0", "0"] - }, - { - "intrinsic": "_max_pd", - "width": [128], - "llvm": "max.pd", - "ret": "f64", - "args": ["0", "0"] - }, - { - "intrinsic": "_mfence", - "width": [128], - "llvm": "fence", - "ret": "V", - "args": [] - }, - { - "intrinsic": "_min_{0.data_type}", - "width": [128], - "llvm": "pmin{0.kind}.{0.data_type_short}", - "ret": ["s16", "u8"], - "args": ["0", "0"] - }, - { - "intrinsic": "_min_pd", - "width": [128], - "llvm": "min.pd", - "ret": "f64", - "args": ["0", "0"] - }, - { - "intrinsic": "_movemask_pd", - "width": [128], - "llvm": "movmsk.pd", - "ret": "S32", - "args": ["f64"] - }, - { - "intrinsic": "_movemask_epi8", - "width": [128], - "llvm": "pmovmskb.128", - "ret": "S32", - "args": ["s8"] - }, - { - "intrinsic": "_mul_epu32", - "width": [128], - "llvm": "pmulu.dq", - "ret": "u64", - "args": ["0dn", "0dn"] - }, - { - "intrinsic": "_mulhi_{0.data_type}", - "width": [128], - "llvm": "pmulh{0.kind_short}.w", - "ret": "i16", - "args": ["0", "0"] - }, - { - "intrinsic": "_packs_{1.data_type}", - "width": [128], - "llvm": "packss{1.data_type_short}{0.data_type_short}.128", - "ret": "s(8-16)", - "args": ["0hw", "0hw"] - }, - { - "intrinsic": "_packus_epi16", - "width": [128], - "llvm": "packuswb.128", - "ret": "u8", - "args": ["s16", "s16"] - }, - { - "intrinsic": "_sad_epu8", - "width": [128], - "llvm": "psad.bw", - "ret": "u64", - "args": ["u8", "u8"] - }, - { - "intrinsic": "_sfence", - "width": [128], - "llvm": "sfence", - "ret": "V", - "args": [] - }, - { - "intrinsic": "_sqrt_pd", - "width": [128], - "llvm": "!llvm.sqrt.v2f64", - "ret": "f64", - "args": ["0"] - }, - { - "intrinsic": "_storeu_pd", - "width": [128], - "llvm": "storeu.pd", - "ret": "V", - "args": ["F64Pm/U8", "f64"] - }, - { - "intrinsic": "_storeu_si128", - "width": [128], - "llvm": "storeu.dq", - "ret": "V", - "args": ["u8Pm/U8", "u8"] - }, - { - "intrinsic": "_subs_{0.data_type}", - "width": [128], - "llvm": "psub{0.kind_short}s.{0.data_type_short}", - "ret": "i(8-16)", - "args": ["0", "0"] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/sse3.json b/src/etc/platform-intrinsics/x86/sse3.json deleted file mode 100644 index 119bf208f7e..00000000000 --- a/src/etc/platform-intrinsics/x86/sse3.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "intrinsic_prefix": "_mm", - "llvm_prefix": "llvm.x86.sse3.", - "intrinsics": [ - { - "intrinsic": "_addsub_{0.data_type}", - "width": [128], - "llvm": "addsub.{0.data_type}", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "_hadd_{0.data_type}", - "width": [128], - "llvm": "hadd.{0.data_type}", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "_hsub_{0.data_type}", - "width": [128], - "llvm": "hsub.{0.data_type}", - "ret": "f(32-64)", - "args": ["0", "0"] - }, - { - "intrinsic": "_lddqu_si128", - "width": [128], - "llvm": "ldu.dq", - "ret": "u8", - "args": ["0Pc/S8"] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/sse41.json b/src/etc/platform-intrinsics/x86/sse41.json deleted file mode 100644 index b499637e0d3..00000000000 --- a/src/etc/platform-intrinsics/x86/sse41.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "intrinsic_prefix": "_mm", - "llvm_prefix": "llvm.x86.sse41.", - "intrinsics": [ - { - "intrinsic": "_dp_{0.data_type}", - "width": [128], - "llvm": "dp{0.data_type}", - "ret": "f(32-64)", - "args": ["0", "0", "S32/8"] - }, - { - "intrinsic": "_max_{0.data_type}", - "width": [128], - "llvm": "pmax{0.kind}{0.data_type_short}", - "ret": ["s8", "u16", "i32"], - "args": ["0", "0"] - }, - { - "intrinsic": "_min_{0.data_type}", - "width": [128], - "llvm": "pmin{0.kind}{0.data_type_short}", - "ret": ["s8", "u16", "i32"], - "args": ["0", "0"] - }, - { - "intrinsic": "_minpos_epu16", - "width": [128], - "llvm": "phminposuw", - "ret": "u16", - "args": ["0"] - }, - { - "intrinsic": "_mpsadbw_epu8", - "width": [128], - "llvm": "mpsadbw", - "ret": "u16", - "args": ["u8", "u8", "S32/8"] - }, - { - "intrinsic": "_mul_epi32", - "width": [128], - "llvm": "pmuldq", - "ret": "s64", - "args": ["s32", "s32"] - }, - { - "intrinsic": "_packus_epi32", - "width": [128], - "llvm": "packusdw", - "ret": "u16", - "args": ["s32", "s32"] - }, - { - "intrinsic": "_testc_si128", - "width": [128], - "llvm": "ptestc", - "ret": "S32", - "args": ["u64", "u64"] - }, - { - "intrinsic": "_testnzc_si128", - "width": [128], - "llvm": "ptestnzc", - "ret": "S32", - "args": ["u64", "u64"] - }, - { - "intrinsic": "_testz_si128", - "width": [128], - "llvm": "ptestz", - "ret": "S32", - "args": ["u64", "u64"] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/sse42.json b/src/etc/platform-intrinsics/x86/sse42.json deleted file mode 100644 index fdee9c8a667..00000000000 --- a/src/etc/platform-intrinsics/x86/sse42.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "intrinsic_prefix": "_mm", - "llvm_prefix": "llvm.x86.sse42.", - "intrinsics": [ - { - "intrinsic": "_cmpestra", - "width": [128], - "llvm": "pcmpestria128", - "ret": "S32", - "args": ["s8", "S32", "s8", "S32", "S32/8"] - }, - { - "intrinsic": "_cmpestrc", - "width": [128], - "llvm": "pcmpestric128", - "ret": "S32", - "args": ["s8", "S32", "s8", "S32", "S32/8"] - }, - { - "intrinsic": "_cmpestri", - "width": [128], - "llvm": "pcmpestri128", - "ret": "S32", - "args": ["s8", "S32", "s8", "S32", "S32/8"] - }, - { - "intrinsic": "_cmpestrm", - "width": [128], - "llvm": "pcmpestrm128", - "ret": "s8", - "args": ["s8", "S32", "s8", "S32", "S32/8"] - }, - { - "intrinsic": "_cmpestro", - "width": [128], - "llvm": "pcmpestrio128", - "ret": "S32", - "args": ["s8", "S32", "s8", "S32", "S32/8"] - }, - { - "intrinsic": "_cmpestrs", - "width": [128], - "llvm": "pcmpestris128", - "ret": "S32", - "args": ["s8", "S32", "s8", "S32", "S32/8"] - }, - { - "intrinsic": "_cmpestrz", - "width": [128], - "llvm": "pcmpestriz128", - "ret": "S32", - "args": ["s8", "S32", "s8", "S32", "S32/8"] - }, - { - "intrinsic": "_cmpistra", - "width": [128], - "llvm": "pcmpistria128", - "ret": "S32", - "args": ["s8", "s8", "S32/8"] - }, - { - "intrinsic": "_cmpistrc", - "width": [128], - "llvm": "pcmpistric128", - "ret": "S32", - "args": ["s8", "s8", "S32/8"] - }, - { - "intrinsic": "_cmpistri", - "width": [128], - "llvm": "pcmpistri128", - "ret": "S32", - "args": ["s8", "s8", "S32/8"] - }, - { - "intrinsic": "_cmpistrm", - "width": [128], - "llvm": "pcmpistrm128", - "ret": "s8", - "args": ["s8", "s8", "S32/8"] - }, - { - "intrinsic": "_cmpistro", - "width": [128], - "llvm": "pcmpistrio128", - "ret": "S32", - "args": ["s8", "s8", "S32/8"] - }, - { - "intrinsic": "_cmpistrs", - "width": [128], - "llvm": "pcmpistris128", - "ret": "S32", - "args": ["s8", "s8", "S32/8"] - }, - { - "intrinsic": "_cmpistrz", - "width": [128], - "llvm": "pcmpistriz128", - "ret": "S32", - "args": ["s8", "s8", "S32/8"] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/ssse3.json b/src/etc/platform-intrinsics/x86/ssse3.json deleted file mode 100644 index 5a5617957b3..00000000000 --- a/src/etc/platform-intrinsics/x86/ssse3.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "intrinsic_prefix": "_mm", - "llvm_prefix": "llvm.x86.ssse3.", - "intrinsics": [ - { - "intrinsic": "_abs_{0.data_type}", - "width": [128], - "llvm": "pabs.{0.data_type_short}.128", - "ret": "s(8-32)", - "args": ["0"] - }, - { - "intrinsic": "_hadd_{0.data_type}", - "width": [128], - "llvm": "phadd.{0.data_type_short}.128", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "_hadds_epi16", - "width": [128], - "llvm": "phadd.sw.128", - "ret": "s16", - "args": ["0", "0"] - }, - { - "intrinsic": "_hsub_{0.data_type}", - "width": [128], - "llvm": "phsub.{0.data_type_short}.128", - "ret": "s(16-32)", - "args": ["0", "0"] - }, - { - "intrinsic": "_hsubs_epi16", - "width": [128], - "llvm": "phsub.sw.128", - "ret": "s16", - "args": ["0", "0"] - }, - { - "intrinsic": "_maddubs_epi16", - "width": [128], - "llvm": "pmadd.ub.sw.128", - "ret": "s16", - "args": ["u8", "s8"] - }, - { - "intrinsic": "_mulhrs_epi16", - "width": [128], - "llvm": "pmul.hr.sw.128", - "ret": "s16", - "args": ["s16", "s16"] - }, - { - "intrinsic": "_shuffle_epi8", - "width": [128], - "llvm": "pshuf.b.128", - "ret": "s8", - "args": ["s8", "s8"] - }, - { - "intrinsic": "_sign_{0.data_type}", - "width": [128], - "llvm": "psign.{0.data_type_short}.128", - "ret": "s(8-32)", - "args": ["0", "0"] - } - ] -} diff --git a/src/etc/platform-intrinsics/x86/tbm.json b/src/etc/platform-intrinsics/x86/tbm.json deleted file mode 100644 index d1322cd60c4..00000000000 --- a/src/etc/platform-intrinsics/x86/tbm.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "intrinsic_prefix": "_tbm", - "llvm_prefix": "llvm.x86.tbm.", - "intrinsics": [ - { - "intrinsic": "_bextri_u{0.bitwidth}", - "width": ["0"], - "llvm": "bextri.u{0.bitwidth}", - "ret": "S(32-64)u", - "args": ["0", "0"] - } - ] -} diff --git a/src/etc/rust-gdb b/src/etc/rust-gdb index 743952a5bef..23ba93da8e5 100755 --- a/src/etc/rust-gdb +++ b/src/etc/rust-gdb @@ -1,14 +1,4 @@ #!/bin/sh -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - # Exit if anything fails set -e diff --git a/src/etc/rust-gdbgui b/src/etc/rust-gdbgui index 7e179ba927d..08d598cde1c 100755 --- a/src/etc/rust-gdbgui +++ b/src/etc/rust-gdbgui @@ -1,13 +1,4 @@ #!/bin/sh -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. # Exit if anything fails set -e diff --git a/src/etc/rust-lldb b/src/etc/rust-lldb index 6ed8210349e..424302d495f 100755 --- a/src/etc/rust-lldb +++ b/src/etc/rust-lldb @@ -1,13 +1,4 @@ #!/bin/sh -# Copyright 2014 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. # Exit if anything fails set -e diff --git a/src/etc/rust-windbg.cmd b/src/etc/rust-windbg.cmd index 8da4efb5803..2deb2a03a39 100644 --- a/src/etc/rust-windbg.cmd +++ b/src/etc/rust-windbg.cmd @@ -1,16 +1,6 @@ @echo off setlocal -REM Copyright 2014 The Rust Project Developers. See the COPYRIGHT -REM file at the top-level directory of this distribution and at -REM http://rust-lang.org/COPYRIGHT. -REM -REM Licensed under the Apache License, Version 2.0 or the MIT license -REM , at your -REM option. This file may not be copied, modified, or distributed -REM except according to those terms. - for /f "delims=" %%i in ('rustc --print=sysroot') do set rustc_sysroot=%%i set rust_etc=%rustc_sysroot%\lib\rustlib\etc diff --git a/src/etc/test-float-parse/_common.rs b/src/etc/test-float-parse/_common.rs index 725a715f7cf..9cbad5486b4 100644 --- a/src/etc/test-float-parse/_common.rs +++ b/src/etc/test-float-parse/_common.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::io; use std::io::prelude::*; use std::mem::transmute; diff --git a/src/etc/test-float-parse/few-ones.rs b/src/etc/test-float-parse/few-ones.rs index 2486df44466..2d82918aabb 100644 --- a/src/etc/test-float-parse/few-ones.rs +++ b/src/etc/test-float-parse/few-ones.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod _common; use _common::validate; diff --git a/src/etc/test-float-parse/huge-pow10.rs b/src/etc/test-float-parse/huge-pow10.rs index 9d12a03dae2..9a16d9c6028 100644 --- a/src/etc/test-float-parse/huge-pow10.rs +++ b/src/etc/test-float-parse/huge-pow10.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod _common; use _common::validate; diff --git a/src/etc/test-float-parse/long-fractions.rs b/src/etc/test-float-parse/long-fractions.rs index 9598bd12a0d..55e4f07cd0c 100644 --- a/src/etc/test-float-parse/long-fractions.rs +++ b/src/etc/test-float-parse/long-fractions.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod _common; use std::char; diff --git a/src/etc/test-float-parse/many-digits.rs b/src/etc/test-float-parse/many-digits.rs index 469a38da2b8..76da818c709 100644 --- a/src/etc/test-float-parse/many-digits.rs +++ b/src/etc/test-float-parse/many-digits.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate rand; mod _common; diff --git a/src/etc/test-float-parse/rand-f64.rs b/src/etc/test-float-parse/rand-f64.rs index 2994dd9d5e6..39ad63945cd 100644 --- a/src/etc/test-float-parse/rand-f64.rs +++ b/src/etc/test-float-parse/rand-f64.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate rand; mod _common; diff --git a/src/etc/test-float-parse/runtests.py b/src/etc/test-float-parse/runtests.py index e9f5bba2312..852bc775896 100644 --- a/src/etc/test-float-parse/runtests.py +++ b/src/etc/test-float-parse/runtests.py @@ -1,14 +1,4 @@ #!/usr/bin/env python2.7 -# -# Copyright 2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. """ Testing dec2flt diff --git a/src/etc/test-float-parse/short-decimals.rs b/src/etc/test-float-parse/short-decimals.rs index 4909f7c58f8..8b9b6f78ae3 100644 --- a/src/etc/test-float-parse/short-decimals.rs +++ b/src/etc/test-float-parse/short-decimals.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod _common; use _common::validate; diff --git a/src/etc/test-float-parse/subnorm.rs b/src/etc/test-float-parse/subnorm.rs index 04a7cc27466..448482c6eb8 100644 --- a/src/etc/test-float-parse/subnorm.rs +++ b/src/etc/test-float-parse/subnorm.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod _common; use std::mem::transmute; diff --git a/src/etc/test-float-parse/tiny-pow10.rs b/src/etc/test-float-parse/tiny-pow10.rs index 50ca5e32609..43fad5b49ee 100644 --- a/src/etc/test-float-parse/tiny-pow10.rs +++ b/src/etc/test-float-parse/tiny-pow10.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod _common; use _common::validate; diff --git a/src/etc/test-float-parse/u32-small.rs b/src/etc/test-float-parse/u32-small.rs index 571ac80e5b0..3ae62425adf 100644 --- a/src/etc/test-float-parse/u32-small.rs +++ b/src/etc/test-float-parse/u32-small.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod _common; use _common::validate; diff --git a/src/etc/test-float-parse/u64-pow2.rs b/src/etc/test-float-parse/u64-pow2.rs index 5b25c839931..1c9bda948ff 100644 --- a/src/etc/test-float-parse/u64-pow2.rs +++ b/src/etc/test-float-parse/u64-pow2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod _common; use _common::validate; diff --git a/src/etc/wasm32-shim.js b/src/etc/wasm32-shim.js index 378aae59733..2a89c0d321d 100644 --- a/src/etc/wasm32-shim.js +++ b/src/etc/wasm32-shim.js @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is a small "shim" program which is used when wasm32 unit tests are run // in this repository. This program is intended to be run in node.js and will // load a wasm module into memory, instantiate it with a set of imports, and diff --git a/src/grammar/lexer.l b/src/grammar/lexer.l index 2f282c8281d..1feb781b2b3 100644 --- a/src/grammar/lexer.l +++ b/src/grammar/lexer.l @@ -1,14 +1,4 @@ %{ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #include #include diff --git a/src/grammar/parser-lalr-main.c b/src/grammar/parser-lalr-main.c index db88a1f2999..6348190cc14 100644 --- a/src/grammar/parser-lalr-main.c +++ b/src/grammar/parser-lalr-main.c @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #include #include #include diff --git a/src/grammar/parser-lalr.y b/src/grammar/parser-lalr.y index a7da69f65fa..5585c95a5a6 100644 --- a/src/grammar/parser-lalr.y +++ b/src/grammar/parser-lalr.y @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - %{ #define YYERROR_VERBOSE #define YYSTYPE struct node * @@ -741,14 +731,14 @@ fn_anon_params ; fn_params_with_self -: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfValue", 3, $2, $4, $5); } +: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfLower", 3, $2, $4, $5); } | '(' '&' maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfRegion", 3, $3, $5, $6); } | '(' '&' lifetime maybe_mut SELF maybe_ty_ascription maybe_comma_params ')' { $$ = mk_node("SelfRegion", 4, $3, $4, $6, $7); } | '(' maybe_params ')' { $$ = mk_node("SelfStatic", 1, $2); } ; fn_anon_params_with_self -: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfValue", 3, $2, $4, $5); } +: '(' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfLower", 3, $2, $4, $5); } | '(' '&' maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfRegion", 3, $3, $5, $6); } | '(' '&' lifetime maybe_mut SELF maybe_ty_ascription maybe_comma_anon_params ')' { $$ = mk_node("SelfRegion", 4, $3, $4, $6, $7); } | '(' maybe_anon_params ')' { $$ = mk_node("SelfStatic", 1, $2); } diff --git a/src/grammar/testparser.py b/src/grammar/testparser.py index 37be41b935f..4b5a7fb9e10 100755 --- a/src/grammar/testparser.py +++ b/src/grammar/testparser.py @@ -1,14 +1,4 @@ #!/usr/bin/env python -# -# Copyright 2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. # ignore-tidy-linelength diff --git a/src/grammar/tokens.h b/src/grammar/tokens.h index 15ea738ed00..297e3dc841e 100644 --- a/src/grammar/tokens.h +++ b/src/grammar/tokens.h @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Token { SHL = 257, // Parser generators reserve 0-256 for char literals SHR, diff --git a/src/liballoc/Cargo.toml b/src/liballoc/Cargo.toml index 642a43d4d9c..861c7cecb88 100644 --- a/src/liballoc/Cargo.toml +++ b/src/liballoc/Cargo.toml @@ -11,10 +11,11 @@ path = "lib.rs" [dependencies] core = { path = "../libcore" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = { version = "0.1.0", features = ['rustc-dep-of-std'] } [dev-dependencies] -rand = "0.5" +rand = "0.6" +rand_xorshift = "0.1" [[test]] name = "collectionstests" @@ -28,3 +29,6 @@ path = "../liballoc/benches/lib.rs" name = "vec_deque_append_bench" path = "../liballoc/benches/vec_deque_append.rs" harness = false + +[features] +compiler-builtins-mem = ['compiler_builtins/mem'] diff --git a/src/liballoc/alloc.rs b/src/liballoc/alloc.rs index 1a8a081e16f..096cb51e0d3 100644 --- a/src/liballoc/alloc.rs +++ b/src/liballoc/alloc.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Memory allocation APIs #![stable(feature = "alloc_module", since = "1.28.0")] diff --git a/src/liballoc/benches/btree/map.rs b/src/liballoc/benches/btree/map.rs index 20b9091a07b..a6f584534d1 100644 --- a/src/liballoc/benches/btree/map.rs +++ b/src/liballoc/benches/btree/map.rs @@ -1,18 +1,7 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::iter::Iterator; use std::vec::Vec; use std::collections::BTreeMap; -use rand::{Rng, thread_rng}; +use rand::{Rng, seq::SliceRandom, thread_rng}; use test::{Bencher, black_box}; macro_rules! map_insert_rand_bench { @@ -78,7 +67,7 @@ macro_rules! map_find_rand_bench { map.insert(k, k); } - rng.shuffle(&mut keys); + keys.shuffle(&mut rng); // measure let mut i = 0; diff --git a/src/liballoc/benches/btree/mod.rs b/src/liballoc/benches/btree/mod.rs index f436b0ac0c0..4dc2dfd9153 100644 --- a/src/liballoc/benches/btree/mod.rs +++ b/src/liballoc/benches/btree/mod.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod map; diff --git a/src/liballoc/benches/lib.rs b/src/liballoc/benches/lib.rs index b4f4fd74f3a..08c69ee6e85 100644 --- a/src/liballoc/benches/lib.rs +++ b/src/liballoc/benches/lib.rs @@ -1,18 +1,9 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd)] #![feature(slice_sort_by_cached_key)] #![feature(test)] extern crate rand; +extern crate rand_xorshift; extern crate test; mod btree; diff --git a/src/liballoc/benches/linked_list.rs b/src/liballoc/benches/linked_list.rs index bbac44553f1..29c5ad2bc6e 100644 --- a/src/liballoc/benches/linked_list.rs +++ b/src/liballoc/benches/linked_list.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::LinkedList; use test::Bencher; diff --git a/src/liballoc/benches/slice.rs b/src/liballoc/benches/slice.rs index 490320f57cb..b9ebd74f799 100644 --- a/src/liballoc/benches/slice.rs +++ b/src/liballoc/benches/slice.rs @@ -1,19 +1,10 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rand::{thread_rng}; use std::mem; use std::ptr; -use rand::{Rng, SeedableRng, XorShiftRng}; +use rand::{Rng, SeedableRng}; use rand::distributions::{Standard, Alphanumeric}; +use rand_xorshift::XorShiftRng; use test::{Bencher, black_box}; #[bench] diff --git a/src/liballoc/benches/str.rs b/src/liballoc/benches/str.rs index 38c94d4d8b5..7f8661bd968 100644 --- a/src/liballoc/benches/str.rs +++ b/src/liballoc/benches/str.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use test::{Bencher, black_box}; #[bench] @@ -274,11 +264,11 @@ make_test!(split_a_str, s, s.split("a").count()); make_test!(trim_ascii_char, s, { s.trim_matches(|c: char| c.is_ascii()) }); -make_test!(trim_left_ascii_char, s, { - s.trim_left_matches(|c: char| c.is_ascii()) +make_test!(trim_start_ascii_char, s, { + s.trim_start_matches(|c: char| c.is_ascii()) }); -make_test!(trim_right_ascii_char, s, { - s.trim_right_matches(|c: char| c.is_ascii()) +make_test!(trim_end_ascii_char, s, { + s.trim_end_matches(|c: char| c.is_ascii()) }); make_test!(find_underscore_char, s, s.find('_')); diff --git a/src/liballoc/benches/string.rs b/src/liballoc/benches/string.rs index 36be21d978e..2933014cb58 100644 --- a/src/liballoc/benches/string.rs +++ b/src/liballoc/benches/string.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::iter::repeat; use test::Bencher; diff --git a/src/liballoc/benches/vec.rs b/src/liballoc/benches/vec.rs index 41490117068..590c49f4ef5 100644 --- a/src/liballoc/benches/vec.rs +++ b/src/liballoc/benches/vec.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use test::Bencher; use std::iter::{FromIterator, repeat}; diff --git a/src/liballoc/benches/vec_deque.rs b/src/liballoc/benches/vec_deque.rs index 380645e7cd0..f7aadbdbd82 100644 --- a/src/liballoc/benches/vec_deque.rs +++ b/src/liballoc/benches/vec_deque.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::VecDeque; use test::{Bencher, black_box}; diff --git a/src/liballoc/benches/vec_deque_append.rs b/src/liballoc/benches/vec_deque_append.rs index bd335651137..78ec91d9e3e 100644 --- a/src/liballoc/benches/vec_deque_append.rs +++ b/src/liballoc/benches/vec_deque_append.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(duration_as_u128)] use std::{collections::VecDeque, time::Instant}; const VECDEQUE_LEN: i32 = 100000; diff --git a/src/liballoc/borrow.rs b/src/liballoc/borrow.rs index 5ae5339138f..b47337e44b2 100644 --- a/src/liballoc/borrow.rs +++ b/src/liballoc/borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A module for working with borrowed data. #![stable(feature = "rust1", since = "1.0.0")] @@ -390,7 +380,6 @@ impl<'a, B: ?Sized> Hash for Cow<'a, B> } #[stable(feature = "rust1", since = "1.0.0")] -#[allow(deprecated)] impl<'a, T: ?Sized + ToOwned> AsRef for Cow<'a, T> { fn as_ref(&self) -> &T { self diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 63b262d1f3d..14a1242e3e5 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A pointer type for heap allocation. //! //! `Box`, casually referred to as a 'box', provides the simplest form of @@ -77,7 +67,9 @@ use core::iter::{Iterator, FromIterator, FusedIterator}; use core::marker::{Unpin, Unsize}; use core::mem; use core::pin::Pin; -use core::ops::{CoerceUnsized, DispatchFromDyn, Deref, DerefMut, Generator, GeneratorState}; +use core::ops::{ + CoerceUnsized, DispatchFromDyn, Deref, DerefMut, Receiver, Generator, GeneratorState +}; use core::ptr::{self, NonNull, Unique}; use core::task::{LocalWaker, Poll}; @@ -109,9 +101,11 @@ impl Box { box x } - #[unstable(feature = "pin", issue = "49150")] + /// Constructs a new `Pin>`. If `T` does not implement `Unpin`, then + /// `x` will be pinned in memory and unable to be moved. + #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] - pub fn pinned(x: T) -> Pin> { + pub fn pin(x: T) -> Pin> { (box x).into() } } @@ -263,6 +257,19 @@ impl Box { { unsafe { &mut *Box::into_raw(b) } } + + /// Converts a `Box` into a `Pin>` + /// + /// This conversion does not allocate on the heap and happens in place. + /// + /// This is also available via [`From`]. + #[unstable(feature = "box_into_pin", issue = "0")] + pub fn into_pin(boxed: Box) -> Pin> { + // It's not possible to move or replace the insides of a `Pin>` + // when `T: !Unpin`, so it's safe to pin it directly without any + // additional requirements. + unsafe { Pin::new_unchecked(boxed) } + } } #[stable(feature = "rust1", since = "1.0.0")] @@ -439,23 +446,48 @@ impl Hasher for Box { #[stable(feature = "from_for_ptrs", since = "1.6.0")] impl From for Box { + /// Converts a generic type `T` into a `Box` + /// + /// The conversion allocates on the heap and moves `t` + /// from the stack into it. + /// + /// # Examples + /// ```rust + /// let x = 5; + /// let boxed = Box::new(5); + /// + /// assert_eq!(Box::from(x), boxed); + /// ``` fn from(t: T) -> Self { Box::new(t) } } -#[unstable(feature = "pin", issue = "49150")] -impl From> for Pin> { +#[stable(feature = "pin", since = "1.33.0")] +impl From> for Pin> { + /// Converts a `Box` into a `Pin>` + /// + /// This conversion does not allocate on the heap and happens in place. fn from(boxed: Box) -> Self { - // It's not possible to move or replace the insides of a `Pin>` - // when `T: !Unpin`, so it's safe to pin it directly without any - // additional requirements. - unsafe { Pin::new_unchecked(boxed) } + Box::into_pin(boxed) } } #[stable(feature = "box_from_slice", since = "1.17.0")] impl<'a, T: Copy> From<&'a [T]> for Box<[T]> { + /// Converts a `&[T]` into a `Box<[T]>` + /// + /// This conversion allocates on the heap + /// and performs a copy of `slice`. + /// + /// # Examples + /// ```rust + /// // create a &[u8] which will be used to create a Box<[u8]> + /// let slice: &[u8] = &[104, 101, 108, 108, 111]; + /// let boxed_slice: Box<[u8]> = Box::from(slice); + /// + /// println!("{:?}", boxed_slice); + /// ``` fn from(slice: &'a [T]) -> Box<[T]> { let mut boxed = unsafe { RawVec::with_capacity(slice.len()).into_box() }; boxed.copy_from_slice(slice); @@ -465,6 +497,16 @@ impl<'a, T: Copy> From<&'a [T]> for Box<[T]> { #[stable(feature = "box_from_slice", since = "1.17.0")] impl<'a> From<&'a str> for Box { + /// Converts a `&str` into a `Box` + /// + /// This conversion allocates on the heap + /// and performs a copy of `s`. + /// + /// # Examples + /// ```rust + /// let boxed: Box = Box::from("hello"); + /// println!("{}", boxed); + /// ``` #[inline] fn from(s: &'a str) -> Box { unsafe { from_boxed_utf8_unchecked(Box::from(s.as_bytes())) } @@ -473,6 +515,22 @@ impl<'a> From<&'a str> for Box { #[stable(feature = "boxed_str_conv", since = "1.19.0")] impl From> for Box<[u8]> { + /// Converts a `Box>` into a `Box<[u8]>` + /// + /// This conversion does not allocate on the heap and happens in place. + /// + /// # Examples + /// ```rust + /// // create a Box which will be used to create a Box<[u8]> + /// let boxed: Box = Box::from("hello"); + /// let boxed_str: Box<[u8]> = Box::from(boxed); + /// + /// // create a &[u8] which will be used to create a Box<[u8]> + /// let slice: &[u8] = &[104, 101, 108, 108, 111]; + /// let boxed_slice = Box::from(slice); + /// + /// assert_eq!(boxed_slice, boxed_str); + /// ``` #[inline] fn from(s: Box) -> Self { unsafe { Box::from_raw(Box::into_raw(s) as *mut [u8]) } @@ -489,7 +547,7 @@ impl Box { /// ``` /// use std::any::Any; /// - /// fn print_if_string(value: Box) { + /// fn print_if_string(value: Box) { /// if let Ok(string) = value.downcast::() { /// println!("String ({}): {}", string.len(), string); /// } @@ -523,7 +581,7 @@ impl Box { /// ``` /// use std::any::Any; /// - /// fn print_if_string(value: Box) { + /// fn print_if_string(value: Box) { /// if let Ok(string) = value.downcast::() { /// println!("String ({}): {}", string.len(), string); /// } @@ -583,6 +641,9 @@ impl DerefMut for Box { } } +#[unstable(feature = "receiver_trait", issue = "0")] +impl Receiver for Box {} + #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for Box { type Item = I::Item; @@ -618,10 +679,10 @@ impl FusedIterator for Box {} /// `FnBox` is a version of the `FnOnce` intended for use with boxed /// closure objects. The idea is that where one would normally store a -/// `Box` in a data structure, you should use -/// `Box`. The two traits behave essentially the same, except +/// `Box` in a data structure, you should use +/// `Box`. The two traits behave essentially the same, except /// that a `FnBox` closure can only be called if it is boxed. (Note -/// that `FnBox` may be deprecated in the future if `Box` +/// that `FnBox` may be deprecated in the future if `Box` /// closures become directly usable.) /// /// # Examples @@ -629,7 +690,7 @@ impl FusedIterator for Box {} /// Here is a snippet of code which creates a hashmap full of boxed /// once closures and then removes them one by one, calling each /// closure as it is removed. Note that the type of the closures -/// stored in the map is `Box i32>` and not `Box i32>` and not `Box i32>`. /// /// ``` @@ -638,8 +699,8 @@ impl FusedIterator for Box {} /// use std::boxed::FnBox; /// use std::collections::HashMap; /// -/// fn make_map() -> HashMap i32>> { -/// let mut map: HashMap i32>> = HashMap::new(); +/// fn make_map() -> HashMap i32>> { +/// let mut map: HashMap i32>> = HashMap::new(); /// map.insert(1, Box::new(|| 22)); /// map.insert(2, Box::new(|| 44)); /// map @@ -801,24 +862,33 @@ impl AsMut for Box { * safe.) * - It is in practice very useful to have Box be unconditionally * Unpin because of trait objects, for which the structural auto - * trait functionality does not apply (e.g. Box would + * trait functionality does not apply (e.g., Box would * otherwise not be Unpin). * * Another type with the same semantics as Box but only a conditional * implementation of `Unpin` (where `T: Unpin`) would be valid/safe, and * could have a method to project a Pin from it. */ -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl Unpin for Box { } #[unstable(feature = "generator_trait", issue = "43122")] -impl Generator for Box - where T: Generator + ?Sized -{ - type Yield = T::Yield; - type Return = T::Return; - unsafe fn resume(&mut self) -> GeneratorState { - (**self).resume() +impl Generator for Box { + type Yield = G::Yield; + type Return = G::Return; + + fn resume(mut self: Pin<&mut Self>) -> GeneratorState { + G::resume(Pin::new(&mut *self)) + } +} + +#[unstable(feature = "generator_trait", issue = "43122")] +impl Generator for Pin> { + type Yield = G::Yield; + type Return = G::Return; + + fn resume(mut self: Pin<&mut Self>) -> GeneratorState { + G::resume((*self).as_mut()) } } diff --git a/src/liballoc/boxed_test.rs b/src/liballoc/boxed_test.rs index f340ea01c5f..654eabd0703 100644 --- a/src/liballoc/boxed_test.rs +++ b/src/liballoc/boxed_test.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Test for `boxed` mod. use core::any::Any; diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index fcadcb544c4..ad544e6015e 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A priority queue implemented with a binary heap. //! //! Insertion and popping the largest element have `O(log n)` time complexity. @@ -529,7 +519,7 @@ impl BinaryHeap { /// assert!(heap.capacity() >= 10); /// ``` #[inline] - #[unstable(feature = "shrink_to", reason = "new API", issue="0")] + #[unstable(feature = "shrink_to", reason = "new API", issue="56431")] pub fn shrink_to(&mut self, min_capacity: usize) { self.data.shrink_to(min_capacity) } @@ -858,7 +848,7 @@ impl BinaryHeap { } } -/// Hole represents a hole in a slice i.e. an index without valid value +/// Hole represents a hole in a slice i.e., an index without valid value /// (because it was moved from or duplicated). /// In drop, `Hole` will restore the slice by filling the hole /// position with the value that was originally removed. diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index 49e488702b4..717650aca96 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::cmp::Ordering; use core::fmt::Debug; use core::hash::{Hash, Hasher}; @@ -97,6 +87,9 @@ use self::Entry::*; /// } /// } /// +/// // Look up the value for a key (will panic if the key is not found). +/// println!("Movie review: {}", movie_reviews["Office Space"]); +/// /// // iterate over everything. /// for (movie, review) in &movie_reviews { /// println!("{}: \"{}\"", movie, review); diff --git a/src/liballoc/collections/btree/mod.rs b/src/liballoc/collections/btree/mod.rs index 087c9f228d4..8b7dc07063b 100644 --- a/src/liballoc/collections/btree/mod.rs +++ b/src/liballoc/collections/btree/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod node; mod search; pub mod map; diff --git a/src/liballoc/collections/btree/node.rs b/src/liballoc/collections/btree/node.rs index f9b455fe796..e969e119dbe 100644 --- a/src/liballoc/collections/btree/node.rs +++ b/src/liballoc/collections/btree/node.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is an attempt at an implementation following the ideal // // ``` @@ -58,9 +48,34 @@ pub const CAPACITY: usize = 2 * B - 1; /// these should always be put behind pointers, and specifically behind `BoxedNode` in the owned /// case. /// -/// We put the metadata first so that its position is the same for every `K` and `V`, in order -/// to statically allocate a single dummy node to avoid allocations. This struct is `repr(C)` to -/// prevent them from being reordered. +/// We have a separate type for the header and rely on it matching the prefix of `LeafNode`, in +/// order to statically allocate a single dummy node to avoid allocations. This struct is +/// `repr(C)` to prevent them from being reordered. `LeafNode` does not just contain a +/// `NodeHeader` because we do not want unnecessary padding between `len` and the keys. +/// Crucially, `NodeHeader` can be safely transmuted to different K and V. (This is exploited +/// by `as_header`.) +/// See `into_key_slice` for an explanation of K2. K2 cannot be safely transmuted around +/// because the size of `NodeHeader` depends on its alignment! +#[repr(C)] +struct NodeHeader { + /// We use `*const` as opposed to `*mut` so as to be covariant in `K` and `V`. + /// This either points to an actual node or is null. + parent: *const InternalNode, + + /// This node's index into the parent node's `edges` array. + /// `*node.parent.edges[node.parent_idx]` should be the same thing as `node`. + /// This is only guaranteed to be initialized when `parent` is non-null. + parent_idx: MaybeUninit, + + /// The number of keys and values this node stores. + /// + /// This next to `parent_idx` to encourage the compiler to join `len` and + /// `parent_idx` into the same 32-bit word, reducing space overhead. + len: u16, + + /// See `into_key_slice`. + keys_start: [K2; 0], +} #[repr(C)] struct LeafNode { /// We use `*const` as opposed to `*mut` so as to be covariant in `K` and `V`. @@ -80,8 +95,8 @@ struct LeafNode { /// The arrays storing the actual data of the node. Only the first `len` elements of each /// array are initialized and valid. - keys: MaybeUninit<[K; CAPACITY]>, - vals: MaybeUninit<[V; CAPACITY]>, + keys: [MaybeUninit; CAPACITY], + vals: [MaybeUninit; CAPACITY], } impl LeafNode { @@ -91,31 +106,32 @@ impl LeafNode { LeafNode { // As a general policy, we leave fields uninitialized if they can be, as this should // be both slightly faster and easier to track in Valgrind. - keys: MaybeUninit::uninitialized(), - vals: MaybeUninit::uninitialized(), + keys: uninitialized_array![_; CAPACITY], + vals: uninitialized_array![_; CAPACITY], parent: ptr::null(), parent_idx: MaybeUninit::uninitialized(), len: 0 } } +} +impl NodeHeader { fn is_shared_root(&self) -> bool { ptr::eq(self, &EMPTY_ROOT_NODE as *const _ as *const _) } } // We need to implement Sync here in order to make a static instance. -unsafe impl Sync for LeafNode<(), ()> {} +unsafe impl Sync for NodeHeader<(), ()> {} // An empty node used as a placeholder for the root node, to avoid allocations. -// We use () in order to save space, since no operation on an empty tree will +// We use just a header in order to save space, since no operation on an empty tree will // ever take a pointer past the first key. -static EMPTY_ROOT_NODE: LeafNode<(), ()> = LeafNode { +static EMPTY_ROOT_NODE: NodeHeader<(), ()> = NodeHeader { parent: ptr::null(), parent_idx: MaybeUninit::uninitialized(), len: 0, - keys: MaybeUninit::uninitialized(), - vals: MaybeUninit::uninitialized(), + keys_start: [], }; /// The underlying representation of internal nodes. As with `LeafNode`s, these should be hidden @@ -129,7 +145,7 @@ struct InternalNode { /// The pointers to the children of this node. `len + 1` of these are considered /// initialized and valid. - edges: [BoxedNode; 2 * B], + edges: [MaybeUninit>; 2 * B], } impl InternalNode { @@ -143,7 +159,7 @@ impl InternalNode { unsafe fn new() -> Self { InternalNode { data: LeafNode::new(), - edges: mem::uninitialized() + edges: uninitialized_array![_; 2*B], } } } @@ -245,7 +261,7 @@ impl Root { -> NodeRef { debug_assert!(!self.is_shared_root()); let mut new_node = Box::new(unsafe { InternalNode::new() }); - new_node.edges[0] = unsafe { BoxedNode::from_ptr(self.node.as_ptr()) }; + new_node.edges[0].set(unsafe { BoxedNode::from_ptr(self.node.as_ptr()) }); self.node = BoxedNode::from_internal(new_node); self.height += 1; @@ -281,7 +297,7 @@ impl Root { .node) }; self.height -= 1; - self.as_mut().as_leaf_mut().parent = ptr::null(); + unsafe { (*self.as_mut().as_leaf_mut()).parent = ptr::null(); } unsafe { Global.dealloc(NonNull::from(top).cast(), Layout::new::>()); @@ -306,6 +322,11 @@ impl Root { /// `Leaf`, the `NodeRef` points to a leaf node, when this is `Internal` the /// `NodeRef` points to an internal node, and when this is `LeafOrInternal` the /// `NodeRef` could be pointing to either type of node. +/// Note that in case of a leaf node, this might still be the shared root! Only turn +/// this into a `LeafNode` reference if you know it is not a root! Shared references +/// must be dereferencable *for the entire size of their pointee*, so `&InternalNode` +/// pointing to the shared root is UB. +/// Turning this into a `NodeHeader` is always safe. pub struct NodeRef { height: usize, node: NonNull>, @@ -352,7 +373,7 @@ impl NodeRef { /// Finds the length of the node. This is the number of keys or values. In an /// internal node, the number of edges is `len() + 1`. pub fn len(&self) -> usize { - self.as_leaf().len as usize + self.as_header().len as usize } /// Returns the height of this node in the whole tree. Zero height denotes the @@ -382,14 +403,19 @@ impl NodeRef { } } - fn as_leaf(&self) -> &LeafNode { + /// Assert that this is indeed a proper leaf node, and not the shared root. + unsafe fn as_leaf(&self) -> &LeafNode { + self.node.as_ref() + } + + fn as_header(&self) -> &NodeHeader { unsafe { - self.node.as_ref() + &*(self.node.as_ptr() as *const NodeHeader) } } pub fn is_shared_root(&self) -> bool { - self.as_leaf().is_shared_root() + self.as_header().is_shared_root() } pub fn keys(&self) -> &[K] { @@ -418,7 +444,7 @@ impl NodeRef { >, Self > { - let parent_as_leaf = self.as_leaf().parent as *const LeafNode; + let parent_as_leaf = self.as_header().parent as *const LeafNode; if let Some(non_zero) = NonNull::new(parent_as_leaf as *mut _) { Ok(Handle { node: NodeRef { @@ -427,7 +453,7 @@ impl NodeRef { root: self.root, _marker: PhantomData }, - idx: unsafe { usize::from(*self.as_leaf().parent_idx.get_ref()) }, + idx: unsafe { usize::from(*self.as_header().parent_idx.get_ref()) }, _marker: PhantomData }) } else { @@ -534,10 +560,10 @@ impl<'a, K, V, Type> NodeRef, K, V, Type> { } } - fn as_leaf_mut(&mut self) -> &mut LeafNode { - unsafe { - self.node.as_mut() - } + /// Returns a raw ptr to avoid asserting exclusive access to the entire node. + fn as_leaf_mut(&mut self) -> *mut LeafNode { + // We are mutable, so we cannot be the root, so accessing this as a leaf is okay. + self.node.as_ptr() } fn keys_mut(&mut self) -> &mut [K] { @@ -551,31 +577,53 @@ impl<'a, K, V, Type> NodeRef, K, V, Type> { impl<'a, K: 'a, V: 'a, Type> NodeRef, K, V, Type> { fn into_key_slice(self) -> &'a [K] { - // When taking a pointer to the keys, if our key has a stricter - // alignment requirement than the shared root does, then the pointer - // would be out of bounds, which LLVM assumes will not happen. If the - // alignment is more strict, we need to make an empty slice that doesn't - // use an out of bounds pointer. + // We have to be careful here because we might be pointing to the shared root. + // In that case, we must not create an `&LeafNode`. We could just return + // an empty slice whenever the length is 0 (this includes the shared root), + // but we want to avoid that run-time check. + // Instead, we create a slice pointing into the node whenever possible. + // We can sometimes do this even for the shared root, as the slice will be + // empty. We cannot *always* do this because if the type is too highly + // aligned, the offset of `keys` in a "full node" might be outside the bounds + // of the header! So we do an alignment check first, that will be + // evaluated at compile-time, and only do any run-time check in the rare case + // that the alignment is very big. if mem::align_of::() > mem::align_of::>() && self.is_shared_root() { &[] } else { - // Here either it's not the root, or the alignment is less strict, - // in which case the keys pointer will point "one-past-the-end" of - // the node, which is allowed by LLVM. + // Thanks to the alignment check above, we know that `keys` will be + // in-bounds of some allocation even if this is the shared root! + // (We might be one-past-the-end, but that is allowed by LLVM.) + // Getting the pointer is tricky though. `NodeHeader` does not have a `keys` + // field because we want its size to not depend on the alignment of `K` + // (needed becuase `as_header` should be safe). We cannot call `as_leaf` + // because we might be the shared root. + // For this reason, `NodeHeader` has this `K2` parameter (that's usually `()` + // and hence just adds a size-0-align-1 field, not affecting layout). + // We know that we can transmute `NodeHeader` to `NodeHeader` + // because we did the alignment check above, and hence `NodeHeader` + // is not bigger than `NodeHeader`! Then we can use `NodeHeader` + // to compute the pointer where the keys start. + // This entire hack will become unnecessary once + // lands, then we can just take a raw + // pointer to the `keys` field of `*const InternalNode`. + + // This is a non-debug-assert because it can be completely compile-time evaluated. + assert!(mem::size_of::>() == mem::size_of::>()); + let header = self.as_header() as *const _ as *const NodeHeader; + let keys = unsafe { &(*header).keys_start as *const _ as *const K }; unsafe { - slice::from_raw_parts( - self.as_leaf().keys.as_ptr() as *const K, - self.len() - ) + slice::from_raw_parts(keys, self.len()) } } } fn into_val_slice(self) -> &'a [V] { debug_assert!(!self.is_shared_root()); + // We cannot be the root, so `as_leaf` is okay unsafe { slice::from_raw_parts( - self.as_leaf().vals.as_ptr() as *const V, + MaybeUninit::first_ptr(&self.as_leaf().vals), self.len() ) } @@ -602,7 +650,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef, K, V, Type> { } else { unsafe { slice::from_raw_parts_mut( - self.as_leaf_mut().keys.get_mut() as *mut [K] as *mut K, + MaybeUninit::first_ptr_mut(&mut (*self.as_leaf_mut()).keys), self.len() ) } @@ -613,7 +661,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef, K, V, Type> { debug_assert!(!self.is_shared_root()); unsafe { slice::from_raw_parts_mut( - self.as_leaf_mut().vals.get_mut() as *mut [V] as *mut V, + MaybeUninit::first_ptr_mut(&mut (*self.as_leaf_mut()).vals), self.len() ) } @@ -637,9 +685,9 @@ impl<'a, K, V> NodeRef, K, V, marker::Leaf> { unsafe { ptr::write(self.keys_mut().get_unchecked_mut(idx), key); ptr::write(self.vals_mut().get_unchecked_mut(idx), val); - } - self.as_leaf_mut().len += 1; + (*self.as_leaf_mut()).len += 1; + } } /// Adds a key/value pair to the beginning of the node. @@ -651,9 +699,9 @@ impl<'a, K, V> NodeRef, K, V, marker::Leaf> { unsafe { slice_insert(self.keys_mut(), 0, key); slice_insert(self.vals_mut(), 0, val); - } - self.as_leaf_mut().len += 1; + (*self.as_leaf_mut()).len += 1; + } } } @@ -670,9 +718,9 @@ impl<'a, K, V> NodeRef, K, V, marker::Internal> { unsafe { ptr::write(self.keys_mut().get_unchecked_mut(idx), key); ptr::write(self.vals_mut().get_unchecked_mut(idx), val); - ptr::write(self.as_internal_mut().edges.get_unchecked_mut(idx + 1), edge.node); + self.as_internal_mut().edges.get_unchecked_mut(idx + 1).set(edge.node); - self.as_leaf_mut().len += 1; + (*self.as_leaf_mut()).len += 1; Handle::new_edge(self.reborrow_mut(), idx + 1).correct_parent_link(); } @@ -701,14 +749,14 @@ impl<'a, K, V> NodeRef, K, V, marker::Internal> { slice_insert(self.vals_mut(), 0, val); slice_insert( slice::from_raw_parts_mut( - self.as_internal_mut().edges.as_mut_ptr(), + MaybeUninit::first_ptr_mut(&mut self.as_internal_mut().edges), self.len()+1 ), 0, edge.node ); - self.as_leaf_mut().len += 1; + (*self.as_leaf_mut()).len += 1; self.correct_all_childrens_parent_links(); } @@ -730,14 +778,16 @@ impl<'a, K, V> NodeRef, K, V, marker::LeafOrInternal> { let edge = match self.reborrow_mut().force() { ForceResult::Leaf(_) => None, ForceResult::Internal(internal) => { - let edge = ptr::read(internal.as_internal().edges.get_unchecked(idx + 1)); + let edge = ptr::read( + internal.as_internal().edges.get_unchecked(idx + 1).as_ptr() + ); let mut new_root = Root { node: edge, height: internal.height - 1 }; - new_root.as_mut().as_leaf_mut().parent = ptr::null(); + (*new_root.as_mut().as_leaf_mut()).parent = ptr::null(); Some(new_root) } }; - self.as_leaf_mut().len -= 1; + (*self.as_leaf_mut()).len -= 1; (key, val, edge) } } @@ -758,14 +808,14 @@ impl<'a, K, V> NodeRef, K, V, marker::LeafOrInternal> { ForceResult::Internal(mut internal) => { let edge = slice_remove( slice::from_raw_parts_mut( - internal.as_internal_mut().edges.as_mut_ptr(), + MaybeUninit::first_ptr_mut(&mut internal.as_internal_mut().edges), old_len+1 ), 0 ); let mut new_root = Root { node: edge, height: internal.height - 1 }; - new_root.as_mut().as_leaf_mut().parent = ptr::null(); + (*new_root.as_mut().as_leaf_mut()).parent = ptr::null(); for i in 0..old_len { Handle::new_edge(internal.reborrow_mut(), i).correct_parent_link(); @@ -775,7 +825,7 @@ impl<'a, K, V> NodeRef, K, V, marker::LeafOrInternal> { } }; - self.as_leaf_mut().len -= 1; + (*self.as_leaf_mut()).len -= 1; (key, val, edge) } @@ -966,7 +1016,7 @@ impl<'a, K, V> Handle, K, V, marker::Leaf>, marker::Edge slice_insert(self.node.keys_mut(), self.idx, key); slice_insert(self.node.vals_mut(), self.idx, val); - self.node.as_leaf_mut().len += 1; + (*self.node.as_leaf_mut()).len += 1; self.node.vals_mut().get_unchecked_mut(self.idx) } @@ -1009,8 +1059,10 @@ impl<'a, K, V> Handle, K, V, marker::Internal>, marker:: let idx = self.idx as u16; let ptr = self.node.as_internal_mut() as *mut _; let mut child = self.descend(); - child.as_leaf_mut().parent = ptr; - child.as_leaf_mut().parent_idx.set(idx); + unsafe { + (*child.as_leaf_mut()).parent = ptr; + (*child.as_leaf_mut()).parent_idx.set(idx); + } } /// Unsafely asserts to the compiler some static information about whether the underlying @@ -1035,7 +1087,7 @@ impl<'a, K, V> Handle, K, V, marker::Internal>, marker:: slice_insert( slice::from_raw_parts_mut( - self.node.as_internal_mut().edges.as_mut_ptr(), + MaybeUninit::first_ptr_mut(&mut self.node.as_internal_mut().edges), self.node.len() ), self.idx + 1, @@ -1090,7 +1142,9 @@ impl pub fn descend(self) -> NodeRef { NodeRef { height: self.node.height - 1, - node: unsafe { self.node.as_internal().edges.get_unchecked(self.idx).as_ptr() }, + node: unsafe { + self.node.as_internal().edges.get_unchecked(self.idx).get_ref().as_ptr() + }, root: self.node.root, _marker: PhantomData } @@ -1158,7 +1212,7 @@ impl<'a, K, V> Handle, K, V, marker::Leaf>, marker::KV> new_len ); - self.node.as_leaf_mut().len = self.idx as u16; + (*self.node.as_leaf_mut()).len = self.idx as u16; new_node.len = new_len as u16; ( @@ -1180,7 +1234,7 @@ impl<'a, K, V> Handle, K, V, marker::Leaf>, marker::KV> unsafe { let k = slice_remove(self.node.keys_mut(), self.idx); let v = slice_remove(self.node.vals_mut(), self.idx); - self.node.as_leaf_mut().len -= 1; + (*self.node.as_leaf_mut()).len -= 1; (self.left_edge(), k, v) } } @@ -1221,7 +1275,7 @@ impl<'a, K, V> Handle, K, V, marker::Internal>, marker:: new_len + 1 ); - self.node.as_leaf_mut().len = self.idx as u16; + (*self.node.as_leaf_mut()).len = self.idx as u16; new_node.data.len = new_len as u16; let mut new_root = Root { @@ -1295,9 +1349,9 @@ impl<'a, K, V> Handle, K, V, marker::Internal>, marker:: for i in self.idx+1..self.node.len() { Handle::new_edge(self.node.reborrow_mut(), i).correct_parent_link(); } - self.node.as_leaf_mut().len -= 1; + (*self.node.as_leaf_mut()).len -= 1; - left_node.as_leaf_mut().len += right_len as u16 + 1; + (*left_node.as_leaf_mut()).len += right_len as u16 + 1; if self.node.height > 1 { ptr::copy_nonoverlapping( @@ -1407,8 +1461,8 @@ impl<'a, K, V> Handle, K, V, marker::Internal>, marker:: move_kv(left_kv, new_left_len, parent_kv, 0, 1); } - left_node.reborrow_mut().as_leaf_mut().len -= count as u16; - right_node.reborrow_mut().as_leaf_mut().len += count as u16; + (*left_node.reborrow_mut().as_leaf_mut()).len -= count as u16; + (*right_node.reborrow_mut().as_leaf_mut()).len += count as u16; match (left_node.force(), right_node.force()) { (ForceResult::Internal(left), ForceResult::Internal(mut right)) => { @@ -1468,8 +1522,8 @@ impl<'a, K, V> Handle, K, V, marker::Internal>, marker:: new_right_len); } - left_node.reborrow_mut().as_leaf_mut().len += count as u16; - right_node.reborrow_mut().as_leaf_mut().len -= count as u16; + (*left_node.reborrow_mut().as_leaf_mut()).len += count as u16; + (*right_node.reborrow_mut().as_leaf_mut()).len -= count as u16; match (left_node.force(), right_node.force()) { (ForceResult::Internal(left), ForceResult::Internal(mut right)) => { @@ -1560,8 +1614,8 @@ impl<'a, K, V> Handle, K, V, marker::LeafOrInternal>, ma move_kv(left_kv, left_new_len, right_kv, 0, right_new_len); - left_node.reborrow_mut().as_leaf_mut().len = left_new_len as u16; - right_node.reborrow_mut().as_leaf_mut().len = right_new_len as u16; + (*left_node.reborrow_mut().as_leaf_mut()).len = left_new_len as u16; + (*right_node.reborrow_mut().as_leaf_mut()).len = right_new_len as u16; match (left_node.force(), right_node.force()) { (ForceResult::Internal(left), ForceResult::Internal(right)) => { diff --git a/src/liballoc/collections/btree/search.rs b/src/liballoc/collections/btree/search.rs index bc1272fbc78..9010de7c16a 100644 --- a/src/liballoc/collections/btree/search.rs +++ b/src/liballoc/collections/btree/search.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::cmp::Ordering; use borrow::Borrow; diff --git a/src/liballoc/collections/btree/set.rs b/src/liballoc/collections/btree/set.rs index af9a7074e4a..71fec7da9a5 100644 --- a/src/liballoc/collections/btree/set.rs +++ b/src/liballoc/collections/btree/set.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is pretty much entirely stolen from TreeSet, since BTreeMap has an identical interface // to TreeMap @@ -258,7 +248,7 @@ impl BTreeSet { } /// Visits the values representing the difference, - /// i.e. the values that are in `self` but not in `other`, + /// i.e., the values that are in `self` but not in `other`, /// in ascending order. /// /// # Examples @@ -286,7 +276,7 @@ impl BTreeSet { } /// Visits the values representing the symmetric difference, - /// i.e. the values that are in `self` or in `other` but not in both, + /// i.e., the values that are in `self` or in `other` but not in both, /// in ascending order. /// /// # Examples @@ -316,7 +306,7 @@ impl BTreeSet { } /// Visits the values representing the intersection, - /// i.e. the values that are both in `self` and `other`, + /// i.e., the values that are both in `self` and `other`, /// in ascending order. /// /// # Examples @@ -344,7 +334,7 @@ impl BTreeSet { } /// Visits the values representing the union, - /// i.e. all the values in `self` or `other`, without duplicates, + /// i.e., all the values in `self` or `other`, without duplicates, /// in ascending order. /// /// # Examples @@ -455,7 +445,7 @@ impl BTreeSet { } /// Returns `true` if the set is a subset of another, - /// i.e. `other` contains at least all the values in `self`. + /// i.e., `other` contains at least all the values in `self`. /// /// # Examples /// @@ -498,7 +488,7 @@ impl BTreeSet { } /// Returns `true` if the set is a superset of another, - /// i.e. `self` contains at least all the values in `other`. + /// i.e., `self` contains at least all the values in `other`. /// /// # Examples /// diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs index 2ef84dbade0..804a2e9c887 100644 --- a/src/liballoc/collections/linked_list.rs +++ b/src/liballoc/collections/linked_list.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A doubly-linked list with owned nodes. //! //! The `LinkedList` allows pushing and popping elements at either end @@ -627,7 +617,9 @@ impl LinkedList { self.pop_front_node().map(Node::into_element) } - /// Appends an element to the back of a list + /// Appends an element to the back of a list. + /// + /// This operation should compute in O(1) time. /// /// # Examples /// @@ -647,6 +639,8 @@ impl LinkedList { /// Removes the last element from a list and returns it, or `None` if /// it is empty. /// + /// This operation should compute in O(1) time. + /// /// # Examples /// /// ``` diff --git a/src/liballoc/collections/mod.rs b/src/liballoc/collections/mod.rs index 96e0eb633b2..138f5d79bb0 100644 --- a/src/liballoc/collections/mod.rs +++ b/src/liballoc/collections/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Collection types. #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs index cbf104a8fcd..579d7de96e6 100644 --- a/src/liballoc/collections/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A double-ended queue implemented with a growable ring buffer. //! //! This queue has `O(1)` amortized inserts and removals from both ends of the @@ -19,10 +9,10 @@ use core::cmp::Ordering; use core::fmt; -use core::iter::{repeat, repeat_with, FromIterator, FusedIterator}; +use core::iter::{repeat_with, FromIterator, FusedIterator}; use core::mem; use core::ops::Bound::{Excluded, Included, Unbounded}; -use core::ops::{Index, IndexMut, RangeBounds}; +use core::ops::{Index, IndexMut, RangeBounds, Try}; use core::ptr; use core::ptr::NonNull; use core::slice; @@ -701,7 +691,7 @@ impl VecDeque { /// buf.shrink_to(0); /// assert!(buf.capacity() >= 4); /// ``` - #[unstable(feature = "shrink_to", reason = "new API", issue="0")] + #[unstable(feature = "shrink_to", reason = "new API", issue="56431")] pub fn shrink_to(&mut self, min_capacity: usize) { assert!(self.capacity() >= min_capacity, "Tried to shrink to a larger capacity"); @@ -1026,7 +1016,10 @@ impl VecDeque { iter: Iter { tail: drain_tail, head: drain_head, - ring: unsafe { self.buffer_as_mut_slice() }, + // Crucially, we only create shared references from `self` here and read from + // it. We do not write to `self` nor reborrow to a mutable reference. + // Hence the raw pointer we created above, for `deque`, remains valid. + ring: unsafe { self.buffer_as_slice() }, }, } } @@ -1886,12 +1879,10 @@ impl VecDeque { debug_assert!(!self.is_full()); } } -} -impl VecDeque { - /// Modifies the `VecDeque` in-place so that `len()` is equal to new_len, - /// either by removing excess elements from the back or by appending clones of `value` - /// to the back. + /// Modifies the `VecDeque` in-place so that `len()` is equal to `new_len`, + /// either by removing excess elements from the back or by appending + /// elements generated by calling `generator` to the back. /// /// # Examples /// @@ -1904,59 +1895,165 @@ impl VecDeque { /// buf.push_back(15); /// assert_eq!(buf, [5, 10, 15]); /// - /// buf.resize(2, 0); + /// buf.resize_with(5, Default::default); + /// assert_eq!(buf, [5, 10, 15, 0, 0]); + /// + /// buf.resize_with(2, || unreachable!()); /// assert_eq!(buf, [5, 10]); /// - /// buf.resize(5, 20); - /// assert_eq!(buf, [5, 10, 20, 20, 20]); + /// let mut state = 100; + /// buf.resize_with(5, || { state += 1; state }); + /// assert_eq!(buf, [5, 10, 101, 102, 103]); /// ``` - #[stable(feature = "deque_extras", since = "1.16.0")] - pub fn resize(&mut self, new_len: usize, value: T) { + #[stable(feature = "vec_resize_with", since = "1.33.0")] + pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut()->T) { let len = self.len(); if new_len > len { - self.extend(repeat(value).take(new_len - len)) + self.extend(repeat_with(generator).take(new_len - len)) } else { self.truncate(new_len); } } - /// Modifies the `VecDeque` in-place so that `len()` is equal to `new_len`, - /// either by removing excess elements from the back or by appending - /// elements generated by calling `generator` to the back. + /// Rotates the double-ended queue `mid` places to the left. + /// + /// Equivalently, + /// - Rotates item `mid` into the first position. + /// - Pops the first `mid` items and pushes them to the end. + /// - Rotates `len() - mid` places to the right. + /// + /// # Panics + /// + /// If `mid` is greater than `len()`. Note that `mid == len()` + /// does _not_ panic and is a no-op rotation. + /// + /// # Complexity + /// + /// Takes `O(min(mid, len() - mid))` time and no extra space. /// /// # Examples /// /// ``` - /// #![feature(vec_resize_with)] + /// #![feature(vecdeque_rotate)] /// /// use std::collections::VecDeque; /// + /// let mut buf: VecDeque<_> = (0..10).collect(); + /// + /// buf.rotate_left(3); + /// assert_eq!(buf, [3, 4, 5, 6, 7, 8, 9, 0, 1, 2]); + /// + /// for i in 1..10 { + /// assert_eq!(i * 3 % 10, buf[0]); + /// buf.rotate_left(3); + /// } + /// assert_eq!(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); + /// ``` + #[unstable(feature = "vecdeque_rotate", issue = "56686")] + pub fn rotate_left(&mut self, mid: usize) { + assert!(mid <= self.len()); + let k = self.len() - mid; + if mid <= k { + unsafe { self.rotate_left_inner(mid) } + } else { + unsafe { self.rotate_right_inner(k) } + } + } + + /// Rotates the double-ended queue `k` places to the right. + /// + /// Equivalently, + /// - Rotates the first item into position `k`. + /// - Pops the last `k` items and pushes them to the front. + /// - Rotates `len() - k` places to the left. + /// + /// # Panics + /// + /// If `k` is greater than `len()`. Note that `k == len()` + /// does _not_ panic and is a no-op rotation. + /// + /// # Complexity + /// + /// Takes `O(min(k, len() - k))` time and no extra space. + /// + /// # Examples + /// + /// ``` + /// #![feature(vecdeque_rotate)] + /// + /// use std::collections::VecDeque; + /// + /// let mut buf: VecDeque<_> = (0..10).collect(); + /// + /// buf.rotate_right(3); + /// assert_eq!(buf, [7, 8, 9, 0, 1, 2, 3, 4, 5, 6]); + /// + /// for i in 1..10 { + /// assert_eq!(0, buf[i * 3 % 10]); + /// buf.rotate_right(3); + /// } + /// assert_eq!(buf, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); + /// ``` + #[unstable(feature = "vecdeque_rotate", issue = "56686")] + pub fn rotate_right(&mut self, k: usize) { + assert!(k <= self.len()); + let mid = self.len() - k; + if k <= mid { + unsafe { self.rotate_right_inner(k) } + } else { + unsafe { self.rotate_left_inner(mid) } + } + } + + // Safety: the following two methods require that the rotation amount + // be less than half the length of the deque. + // + // `wrap_copy` requres that `min(x, cap() - x) + copy_len <= cap()`, + // but than `min` is never more than half the capacity, regardless of x, + // so it's sound to call here because we're calling with something + // less than half the length, which is never above half the capacity. + + unsafe fn rotate_left_inner(&mut self, mid: usize) { + debug_assert!(mid * 2 <= self.len()); + self.wrap_copy(self.head, self.tail, mid); + self.head = self.wrap_add(self.head, mid); + self.tail = self.wrap_add(self.tail, mid); + } + + unsafe fn rotate_right_inner(&mut self, k: usize) { + debug_assert!(k * 2 <= self.len()); + self.head = self.wrap_sub(self.head, k); + self.tail = self.wrap_sub(self.tail, k); + self.wrap_copy(self.tail, self.head, k); + } +} + +impl VecDeque { + /// Modifies the `VecDeque` in-place so that `len()` is equal to new_len, + /// either by removing excess elements from the back or by appending clones of `value` + /// to the back. + /// + /// # Examples + /// + /// ``` + /// use std::collections::VecDeque; + /// /// let mut buf = VecDeque::new(); /// buf.push_back(5); /// buf.push_back(10); /// buf.push_back(15); /// assert_eq!(buf, [5, 10, 15]); /// - /// buf.resize_with(5, Default::default); - /// assert_eq!(buf, [5, 10, 15, 0, 0]); - /// - /// buf.resize_with(2, || unreachable!()); + /// buf.resize(2, 0); /// assert_eq!(buf, [5, 10]); /// - /// let mut state = 100; - /// buf.resize_with(5, || { state += 1; state }); - /// assert_eq!(buf, [5, 10, 101, 102, 103]); + /// buf.resize(5, 20); + /// assert_eq!(buf, [5, 10, 20, 20, 20]); /// ``` - #[unstable(feature = "vec_resize_with", issue = "41758")] - pub fn resize_with(&mut self, new_len: usize, generator: impl FnMut()->T) { - let len = self.len(); - - if new_len > len { - self.extend(repeat_with(generator).take(new_len - len)) - } else { - self.truncate(new_len); - } + #[stable(feature = "deque_extras", since = "1.16.0")] + pub fn resize(&mut self, new_len: usize, value: T) { + self.resize_with(new_len, || value.clone()); } } @@ -2075,6 +2172,14 @@ impl<'a, T> Iterator for Iter<'a, T> { accum = front.iter().fold(accum, &mut f); back.iter().fold(accum, &mut f) } + + fn try_fold(&mut self, init: B, mut f: F) -> R where + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + { + let (front, back) = RingSlices::ring_slices(self.ring, self.head, self.tail); + let accum = front.iter().try_fold(init, &mut f)?; + back.iter().try_fold(accum, &mut f) + } } #[stable(feature = "rust1", since = "1.0.0")] @@ -2801,7 +2906,7 @@ mod tests { // 0, 1, 2, .., len - 1 let expected = (0..).take(len).collect::>(); for tail_pos in 0..cap { - for to_remove in 0..len + 1 { + for to_remove in 0..=len { tester.tail = tail_pos; tester.head = tail_pos; for i in 0..len { @@ -2827,10 +2932,10 @@ mod tests { let mut tester: VecDeque = VecDeque::with_capacity(7); let cap = tester.capacity(); - for len in 0..cap + 1 { - for tail in 0..cap + 1 { - for drain_start in 0..len + 1 { - for drain_end in drain_start..len + 1 { + for len in 0..=cap { + for tail in 0..=cap { + for drain_start in 0..=len { + for drain_end in drain_start..=len { tester.tail = tail; tester.head = tail; for i in 0..len { @@ -2872,10 +2977,10 @@ mod tests { tester.reserve(63); let max_cap = tester.capacity(); - for len in 0..cap + 1 { + for len in 0..=cap { // 0, 1, 2, .., len - 1 let expected = (0..).take(len).collect::>(); - for tail_pos in 0..max_cap + 1 { + for tail_pos in 0..=max_cap { tester.tail = tail_pos; tester.head = tail_pos; tester.reserve(63); @@ -2905,7 +3010,7 @@ mod tests { // len is the length *before* splitting for len in 0..cap { // index to split at - for at in 0..len + 1 { + for at in 0..=len { // 0, 1, 2, .., at - 1 (may be empty) let expected_self = (0..).take(at).collect::>(); // at, at + 1, .., len - 1 (may be empty) @@ -2933,7 +3038,7 @@ mod tests { fn test_from_vec() { use vec::Vec; for cap in 0..35 { - for len in 0..cap + 1 { + for len in 0..=cap { let mut vec = Vec::with_capacity(cap); vec.extend(0..len); diff --git a/src/liballoc/fmt.rs b/src/liballoc/fmt.rs index b857964ccb3..a1e7533449c 100644 --- a/src/liballoc/fmt.rs +++ b/src/liballoc/fmt.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Utilities for formatting and printing `String`s. //! //! This module contains the runtime support for the [`format!`] syntax extension. @@ -37,6 +27,9 @@ //! will then parse the format string and determine if the list of arguments //! provided is suitable to pass to this format string. //! +//! To convert a single value to a string, use the [`to_string`] method. This +//! will use the [`Display`] formatting trait. +//! //! ## Positional parameters //! //! Each formatting argument is allowed to specify which value argument it's @@ -497,6 +490,7 @@ //! [`write!`]: ../../std/macro.write.html //! [`Debug`]: trait.Debug.html //! [`format!`]: ../../std/macro.format.html +//! [`to_string`]: ../../std/string/trait.ToString.html //! [`writeln!`]: ../../std/macro.writeln.html //! [`write_fmt`]: ../../std/io/trait.Write.html#method.write_fmt //! [`std::io::Write`]: ../../std/io/trait.Write.html diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index abacc62c856..5165a7ca5a8 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! # The Rust core allocation and collections library //! //! This library provides smart pointers and collections for managing @@ -72,7 +62,10 @@ test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))] #![no_std] #![needs_allocator] -#![deny(missing_debug_implementations)] + +#![warn(deprecated_in_future)] +#![warn(intra_doc_link_resolution_failure)] +#![warn(missing_debug_implementations)] #![cfg_attr(not(test), feature(fn_traits))] #![cfg_attr(not(test), feature(generator_trait))] @@ -100,10 +93,10 @@ #![feature(nll)] #![feature(optin_builtin_traits)] #![feature(pattern)] -#![feature(pin)] #![feature(ptr_internals)] #![feature(ptr_offset_from)] #![feature(rustc_attrs)] +#![feature(receiver_trait)] #![feature(specialization)] #![feature(split_ascii_whitespace)] #![feature(staged_api)] @@ -120,6 +113,7 @@ #![feature(slice_partition_dedup)] #![feature(maybe_uninit)] #![feature(alloc_layout_extra)] +#![feature(try_trait)] // Allow testing this library diff --git a/src/liballoc/macros.rs b/src/liballoc/macros.rs index 472eef77d79..db91b07fa71 100644 --- a/src/liballoc/macros.rs +++ b/src/liballoc/macros.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Creates a [`Vec`] containing the arguments. /// /// `vec!` allows `Vec`s to be defined with the same syntax as array expressions. @@ -83,9 +73,14 @@ macro_rules! vec { /// The same convention is used with [`print!`] and [`write!`] macros, /// depending on the intended destination of the string. /// +/// To convert a single value to a string, use the [`to_string`] method. This +/// will use the [`Display`] formatting trait. +/// /// [fmt]: ../std/fmt/index.html /// [`print!`]: ../std/macro.print.html /// [`write!`]: ../std/macro.write.html +/// [`to_string`]: ../std/string/trait.ToString.html +/// [`Display`]: ../std/fmt/trait.Display.html /// /// # Panics /// diff --git a/src/liballoc/prelude.rs b/src/liballoc/prelude.rs index 53b5e93a66e..7cd22095de4 100644 --- a/src/liballoc/prelude.rs +++ b/src/liballoc/prelude.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The alloc Prelude //! //! The purpose of this module is to alleviate imports of commonly-used diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index e87bf78561c..5e4aac9ce78 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(feature = "raw_vec_internals", reason = "implementation detail", issue = "0")] #![doc(hidden)] @@ -32,7 +22,7 @@ use boxed::Box; /// * Catches all overflows in capacity computations (promotes them to "capacity overflow" panics) /// * Guards against 32-bit systems allocating more than isize::MAX bytes /// * Guards against overflowing your length -/// * Aborts on OOM +/// * Aborts on OOM or calls handle_alloc_error as applicable /// * Avoids freeing Unique::empty() /// * Contains a ptr::Unique and thus endows the user with all related benefits /// @@ -739,7 +729,7 @@ unsafe impl<#[may_dangle] T, A: Alloc> Drop for RawVec { // On 64-bit we just need to check for overflow since trying to allocate // `> isize::MAX` bytes will surely fail. On 32-bit and 16-bit we need to add // an extra guard for this in case we're running on a platform which can use -// all 4GB in user-space. e.g. PAE or x32 +// all 4GB in user-space. e.g., PAE or x32 #[inline] fn alloc_guard(alloc_size: usize) -> Result<(), CollectionAllocErr> { diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index bb52d7990ff..c1f428658bd 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -1,15 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(deprecated)] - //! Single-threaded reference-counting pointers. 'Rc' stands for 'Reference //! Counted'. //! @@ -43,8 +31,8 @@ //! //! `Rc` automatically dereferences to `T` (via the [`Deref`] trait), //! so you can call `T`'s methods on a value of type [`Rc`][`Rc`]. To avoid name -//! clashes with `T`'s methods, the methods of [`Rc`][`Rc`] itself are [associated -//! functions][assoc], called using function-like syntax: +//! clashes with `T`'s methods, the methods of [`Rc`][`Rc`] itself are associated +//! functions, called using function-like syntax: //! //! ``` //! use std::rc::Rc; @@ -234,7 +222,6 @@ //! [downgrade]: struct.Rc.html#method.downgrade //! [upgrade]: struct.Weak.html#method.upgrade //! [`None`]: ../../std/option/enum.Option.html#variant.None -//! [assoc]: ../../book/first-edition/method-syntax.html#associated-functions //! [mutability]: ../../std/cell/index.html#introducing-mutability-inside-of-something-immutable #![stable(feature = "rust1", since = "1.0.0")] @@ -254,7 +241,7 @@ use core::intrinsics::abort; use core::marker; use core::marker::{Unpin, Unsize, PhantomData}; use core::mem::{self, align_of_val, forget, size_of_val}; -use core::ops::Deref; +use core::ops::{Deref, Receiver}; use core::ops::{CoerceUnsized, DispatchFromDyn}; use core::pin::Pin; use core::ptr::{self, NonNull}; @@ -277,7 +264,7 @@ struct RcBox { /// See the [module-level documentation](./index.html) for more details. /// /// The inherent methods of `Rc` are all associated functions, which means -/// that you have to call them as e.g. [`Rc::get_mut(&mut value)`][get_mut] instead of +/// that you have to call them as e.g., [`Rc::get_mut(&mut value)`][get_mut] instead of /// `value.get_mut()`. This avoids conflicts with methods of the inner /// type `T`. /// @@ -326,8 +313,10 @@ impl Rc { } } - #[unstable(feature = "pin", issue = "49150")] - pub fn pinned(value: T) -> Pin> { + /// Constructs a new `Pin>`. If `T` does not implement `Unpin`, then + /// `value` will be pinned in memory and unable to be moved. + #[stable(feature = "pin", since = "1.33.0")] + pub fn pin(value: T) -> Pin> { unsafe { Pin::new_unchecked(Rc::new(value)) } } @@ -444,6 +433,27 @@ impl Rc { } } + /// Consumes the `Rc`, returning the wrapped pointer as `NonNull`. + /// + /// # Examples + /// + /// ``` + /// #![feature(rc_into_raw_non_null)] + /// + /// use std::rc::Rc; + /// + /// let x = Rc::new(10); + /// let ptr = Rc::into_raw_non_null(x); + /// let deref = unsafe { *ptr.as_ref() }; + /// assert_eq!(deref, 10); + /// ``` + #[unstable(feature = "rc_into_raw_non_null", issue = "47336")] + #[inline] + pub fn into_raw_non_null(this: Self) -> NonNull { + // safe because Rc guarantees its pointer is non-null + unsafe { NonNull::new_unchecked(Rc::into_raw(this) as *mut _) } + } + /// Creates a new [`Weak`][weak] pointer to this value. /// /// [weak]: struct.Weak.html @@ -634,7 +644,7 @@ impl Rc { impl Rc { #[inline] #[stable(feature = "rc_downcast", since = "1.29.0")] - /// Attempt to downcast the `Rc` to a concrete type. + /// Attempt to downcast the `Rc` to a concrete type. /// /// # Examples /// @@ -642,7 +652,7 @@ impl Rc { /// use std::any::Any; /// use std::rc::Rc; /// - /// fn print_if_string(value: Rc) { + /// fn print_if_string(value: Rc) { /// if let Ok(string) = value.downcast::() { /// println!("String ({}): {}", string.len(), string); /// } @@ -814,6 +824,9 @@ impl Deref for Rc { } } +#[unstable(feature = "receiver_trait", issue = "0")] +impl Receiver for Rc {} + #[stable(feature = "rust1", since = "1.0.0")] unsafe impl<#[may_dangle] T: ?Sized> Drop for Rc { /// Drops the `Rc`. @@ -841,6 +854,8 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Rc { /// drop(foo); // Doesn't print anything /// drop(foo2); // Prints "dropped!" /// ``` + /// + /// [`Weak`]: ../../std/rc/struct.Weak.html fn drop(&mut self) { unsafe { self.dec_strong(); @@ -901,12 +916,47 @@ impl Default for Rc { } } +#[stable(feature = "rust1", since = "1.0.0")] +trait RcEqIdent { + fn eq(&self, other: &Rc) -> bool; + fn ne(&self, other: &Rc) -> bool; +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl RcEqIdent for Rc { + #[inline] + default fn eq(&self, other: &Rc) -> bool { + **self == **other + } + + #[inline] + default fn ne(&self, other: &Rc) -> bool { + **self != **other + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl RcEqIdent for Rc { + #[inline] + fn eq(&self, other: &Rc) -> bool { + Rc::ptr_eq(self, other) || **self == **other + } + + #[inline] + fn ne(&self, other: &Rc) -> bool { + !Rc::ptr_eq(self, other) && **self != **other + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl PartialEq for Rc { /// Equality for two `Rc`s. /// /// Two `Rc`s are equal if their inner values are equal. /// + /// If `T` also implements `Eq`, two `Rc`s that point to the same value are + /// always equal. + /// /// # Examples /// /// ``` @@ -916,15 +966,18 @@ impl PartialEq for Rc { /// /// assert!(five == Rc::new(5)); /// ``` - #[inline(always)] + #[inline] fn eq(&self, other: &Rc) -> bool { - **self == **other + RcEqIdent::eq(self, other) } /// Inequality for two `Rc`s. /// /// Two `Rc`s are unequal if their inner values are unequal. /// + /// If `T` also implements `Eq`, two `Rc`s that point to the same value are + /// never unequal. + /// /// # Examples /// /// ``` @@ -934,9 +987,9 @@ impl PartialEq for Rc { /// /// assert!(five != Rc::new(6)); /// ``` - #[inline(always)] + #[inline] fn ne(&self, other: &Rc) -> bool { - **self != **other + RcEqIdent::ne(self, other) } } @@ -1188,8 +1241,9 @@ impl, U: ?Sized> DispatchFromDyn> for Weak {} impl Weak { /// Constructs a new `Weak`, without allocating any memory. - /// Calling [`upgrade`][Weak::upgrade] on the return value always gives [`None`]. + /// Calling [`upgrade`] on the return value always gives [`None`]. /// + /// [`upgrade`]: #method.upgrade /// [`None`]: ../../std/option/enum.Option.html /// /// # Examples @@ -1251,8 +1305,40 @@ impl Weak { } } + /// Gets the number of strong (`Rc`) pointers pointing to this value. + /// + /// If `self` was created using [`Weak::new`], this will return 0. + /// + /// [`Weak::new`]: #method.new + #[unstable(feature = "weak_counts", issue = "57977")] + pub fn strong_count(&self) -> usize { + if let Some(inner) = self.inner() { + inner.strong() + } else { + 0 + } + } + + /// Gets the number of `Weak` pointers pointing to this value. + /// + /// If `self` was created using [`Weak::new`], this will return `None`. If + /// not, the returned value is at least 1, since `self` still points to the + /// value. + /// + /// [`Weak::new`]: #method.new + #[unstable(feature = "weak_counts", issue = "57977")] + pub fn weak_count(&self) -> Option { + self.inner().map(|inner| { + if inner.strong() > 0 { + inner.weak() - 1 // subtract the implicit weak ptr + } else { + inner.weak() + } + }) + } + /// Return `None` when the pointer is dangling and there is no allocated `RcBox`, - /// i.e. this `Weak` was created by `Weak::new` + /// i.e., this `Weak` was created by `Weak::new` #[inline] fn inner(&self) -> Option<&RcBox> { if is_dangling(self.ptr) { @@ -1261,6 +1347,52 @@ impl Weak { Some(unsafe { self.ptr.as_ref() }) } } + + /// Returns true if the two `Weak`s point to the same value (not just values + /// that compare as equal). + /// + /// # Notes + /// + /// Since this compares pointers it means that `Weak::new()` will equal each + /// other, even though they don't point to any value. + /// + /// # Examples + /// + /// ``` + /// #![feature(weak_ptr_eq)] + /// use std::rc::{Rc, Weak}; + /// + /// let first_rc = Rc::new(5); + /// let first = Rc::downgrade(&first_rc); + /// let second = Rc::downgrade(&first_rc); + /// + /// assert!(Weak::ptr_eq(&first, &second)); + /// + /// let third_rc = Rc::new(5); + /// let third = Rc::downgrade(&third_rc); + /// + /// assert!(!Weak::ptr_eq(&first, &third)); + /// ``` + /// + /// Comparing `Weak::new`. + /// + /// ``` + /// #![feature(weak_ptr_eq)] + /// use std::rc::{Rc, Weak}; + /// + /// let first = Weak::new(); + /// let second = Weak::new(); + /// assert!(Weak::ptr_eq(&first, &second)); + /// + /// let third_rc = Rc::new(()); + /// let third = Rc::downgrade(&third_rc); + /// assert!(!Weak::ptr_eq(&first, &third)); + /// ``` + #[inline] + #[unstable(feature = "weak_ptr_eq", issue = "55981")] + pub fn ptr_eq(this: &Self, other: &Self) -> bool { + this.ptr.as_ptr() == other.ptr.as_ptr() + } } #[stable(feature = "rc_weak", since = "1.4.0")] @@ -1335,9 +1467,10 @@ impl fmt::Debug for Weak { #[stable(feature = "downgraded_weak", since = "1.10.0")] impl Default for Weak { /// Constructs a new `Weak`, allocating memory for `T` without initializing - /// it. Calling [`upgrade`][Weak::upgrade] on the return value always gives [`None`]. + /// it. Calling [`upgrade`] on the return value always gives [`None`]. /// /// [`None`]: ../../std/option/enum.Option.html + /// [`upgrade`]: ../../std/rc/struct.Weak.html#method.upgrade /// /// # Examples /// @@ -1542,6 +1675,33 @@ mod tests { drop(c); } + #[test] + fn weak_counts() { + assert_eq!(Weak::weak_count(&Weak::::new()), None); + assert_eq!(Weak::strong_count(&Weak::::new()), 0); + + let a = Rc::new(0); + let w = Rc::downgrade(&a); + assert_eq!(Weak::strong_count(&w), 1); + assert_eq!(Weak::weak_count(&w), Some(1)); + let w2 = w.clone(); + assert_eq!(Weak::strong_count(&w), 1); + assert_eq!(Weak::weak_count(&w), Some(2)); + assert_eq!(Weak::strong_count(&w2), 1); + assert_eq!(Weak::weak_count(&w2), Some(2)); + drop(w); + assert_eq!(Weak::strong_count(&w2), 1); + assert_eq!(Weak::weak_count(&w2), Some(1)); + let a2 = a.clone(); + assert_eq!(Weak::strong_count(&w2), 2); + assert_eq!(Weak::weak_count(&w2), Some(1)); + drop(a2); + drop(a); + assert_eq!(Weak::strong_count(&w2), 0); + assert_eq!(Weak::weak_count(&w2), Some(1)); + drop(w2); + } + #[test] fn try_unwrap() { let x = Rc::new(3); @@ -1844,5 +2004,5 @@ impl AsRef for Rc { } } -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl Unpin for Rc { } diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index 1eaff7410ea..db19f778617 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A dynamically-sized view into a contiguous sequence, `[T]`. //! //! *[See also the slice primitive type](../../std/primitive.slice.html).* @@ -177,7 +167,7 @@ mod hack { impl [T] { /// Sorts the slice. /// - /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case. + /// This sort is stable (i.e., does not reorder equal elements) and `O(n log n)` worst-case. /// /// When applicable, unstable sorting is preferred because it is generally faster than stable /// sorting and it doesn't allocate auxiliary memory. @@ -211,7 +201,23 @@ impl [T] { /// Sorts the slice with a comparator function. /// - /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case. + /// This sort is stable (i.e., does not reorder equal elements) and `O(n log n)` worst-case. + /// + /// The comparator function must define a total ordering for the elements in the slice. If + /// the ordering is not total, the order of the elements is unspecified. An order is a + /// total order if it is (for all a, b and c): + /// + /// * total and antisymmetric: exactly one of a < b, a == b or a > b is true; and + /// * transitive, a < b and b < c implies a < c. The same must hold for both == and >. + /// + /// For example, while [`f64`] doesn't implement [`Ord`] because `NaN != NaN`, we can use + /// `partial_cmp` as our sort function when we know the slice doesn't contain a `NaN`. + /// + /// ``` + /// let mut floats = [5f64, 4.0, 1.0, 3.0, 2.0]; + /// floats.sort_by(|a, b| a.partial_cmp(b).unwrap()); + /// assert_eq!(floats, [1.0, 2.0, 3.0, 4.0, 5.0]); + /// ``` /// /// When applicable, unstable sorting is preferred because it is generally faster than stable /// sorting and it doesn't allocate auxiliary memory. @@ -248,7 +254,7 @@ impl [T] { /// Sorts the slice with a key extraction function. /// - /// This sort is stable (i.e. does not reorder equal elements) and `O(m n log(m n))` + /// This sort is stable (i.e., does not reorder equal elements) and `O(m n log(m n))` /// worst-case, where the key function is `O(m)`. /// /// When applicable, unstable sorting is preferred because it is generally faster than stable @@ -285,10 +291,10 @@ impl [T] { /// /// During sorting, the key function is called only once per element. /// - /// This sort is stable (i.e. does not reorder equal elements) and `O(m n + n log n)` + /// This sort is stable (i.e., does not reorder equal elements) and `O(m n + n log n)` /// worst-case, where the key function is `O(m)`. /// - /// For simple key functions (e.g. functions that are property accesses or + /// For simple key functions (e.g., functions that are property accesses or /// basic operations), [`sort_by_key`](#method.sort_by_key) is likely to be /// faster. /// @@ -573,7 +579,7 @@ impl> SliceConcatExt for [V] { type Output = Vec; fn concat(&self) -> Vec { - let size = self.iter().fold(0, |acc, v| acc + v.borrow().len()); + let size = self.iter().map(|slice| slice.borrow().len()).sum(); let mut result = Vec::with_capacity(size); for v in self { result.extend_from_slice(v.borrow()) @@ -587,8 +593,8 @@ impl> SliceConcatExt for [V] { Some(first) => first, None => return vec![], }; - let size = self.iter().fold(0, |acc, v| acc + v.borrow().len()); - let mut result = Vec::with_capacity(size + self.len()); + let size = self.iter().map(|slice| slice.borrow().len()).sum::() + self.len() - 1; + let mut result = Vec::with_capacity(size); result.extend_from_slice(first.borrow()); for v in iter { diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index 9916fa639e1..60d9f162613 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Unicode string slices. //! //! *[See also the `str` primitive type](../../std/primitive.str.html).* diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 8d009101ce7..fa15e9ad901 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A UTF-8 encoded, growable string. //! //! This module contains the [`String`] type, a trait for converting @@ -577,7 +567,7 @@ impl String { return Cow::Borrowed(""); }; - const REPLACEMENT: &'static str = "\u{FFFD}"; + const REPLACEMENT: &str = "\u{FFFD}"; let mut res = String::with_capacity(v.len()); res.push_str(first_valid); @@ -618,6 +608,8 @@ impl String { /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn from_utf16(v: &[u16]) -> Result { + // This isn't done via collect::>() for performance reasons. + // FIXME: the function can be simplified again when #48994 is closed. let mut ret = String::with_capacity(v.len()); for c in decode_utf16(v.iter().cloned()) { if let Ok(c) = c { @@ -1048,7 +1040,7 @@ impl String { /// assert!(s.capacity() >= 3); /// ``` #[inline] - #[unstable(feature = "shrink_to", reason = "new API", issue="0")] + #[unstable(feature = "shrink_to", reason = "new API", issue="56431")] pub fn shrink_to(&mut self, min_capacity: usize) { self.vec.shrink_to(min_capacity) } @@ -1730,18 +1722,37 @@ impl<'a> FromIterator<&'a str> for String { #[stable(feature = "extend_string", since = "1.4.0")] impl FromIterator for String { fn from_iter>(iter: I) -> String { - let mut buf = String::new(); - buf.extend(iter); - buf + let mut iterator = iter.into_iter(); + + // Because we're iterating over `String`s, we can avoid at least + // one allocation by getting the first string from the iterator + // and appending to it all the subsequent strings. + match iterator.next() { + None => String::new(), + Some(mut buf) => { + buf.extend(iterator); + buf + } + } } } #[stable(feature = "herd_cows", since = "1.19.0")] impl<'a> FromIterator> for String { fn from_iter>>(iter: I) -> String { - let mut buf = String::new(); - buf.extend(iter); - buf + let mut iterator = iter.into_iter(); + + // Because we're iterating over CoWs, we can (potentially) avoid at least + // one allocation by getting the first item and appending to it all the + // subsequent items. + match iterator.next() { + None => String::new(), + Some(cow) => { + let mut buf = cow.into_owned(); + buf.extend(iterator); + buf + } + } } } @@ -1751,9 +1762,7 @@ impl Extend for String { let iterator = iter.into_iter(); let (lower_bound, _) = iterator.size_hint(); self.reserve(lower_bound); - for ch in iterator { - self.push(ch) - } + iterator.for_each(move |c| self.push(c)); } } @@ -1767,27 +1776,21 @@ impl<'a> Extend<&'a char> for String { #[stable(feature = "rust1", since = "1.0.0")] impl<'a> Extend<&'a str> for String { fn extend>(&mut self, iter: I) { - for s in iter { - self.push_str(s) - } + iter.into_iter().for_each(move |s| self.push_str(s)); } } #[stable(feature = "extend_string", since = "1.4.0")] impl Extend for String { fn extend>(&mut self, iter: I) { - for s in iter { - self.push_str(&s) - } + iter.into_iter().for_each(move |s| self.push_str(&s)); } } #[stable(feature = "herd_cows", since = "1.19.0")] impl<'a> Extend> for String { fn extend>>(&mut self, iter: I) { - for s in iter { - self.push_str(&s) - } + iter.into_iter().for_each(move |s| self.push_str(&s)); } } @@ -2156,7 +2159,7 @@ impl ToString for T { use core::fmt::Write; let mut buf = String::new(); buf.write_fmt(format_args!("{}", self)) - .expect("a Display implementation return an error unexpectedly"); + .expect("a Display implementation returned an error unexpectedly"); buf.shrink_to_fit(); buf } diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index b63b3684964..f6cafd50dc8 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![stable(feature = "rust1", since = "1.0.0")] //! Thread-safe reference-counting pointers. @@ -21,10 +11,10 @@ use core::sync::atomic; use core::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst}; use core::borrow; use core::fmt; -use core::cmp::Ordering; +use core::cmp::{self, Ordering}; use core::intrinsics::abort; use core::mem::{self, align_of_val, size_of_val}; -use core::ops::Deref; +use core::ops::{Deref, Receiver}; use core::ops::{CoerceUnsized, DispatchFromDyn}; use core::pin::Pin; use core::ptr::{self, NonNull}; @@ -120,8 +110,8 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize; /// /// `Arc` automatically dereferences to `T` (via the [`Deref`][deref] trait), /// so you can call `T`'s methods on a value of type `Arc`. To avoid name -/// clashes with `T`'s methods, the methods of `Arc` itself are [associated -/// functions][assoc], called using function-like syntax: +/// clashes with `T`'s methods, the methods of `Arc` itself are associated +/// functions, called using function-like syntax: /// /// ``` /// use std::sync::Arc; @@ -146,7 +136,6 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize; /// [downgrade]: struct.Arc.html#method.downgrade /// [upgrade]: struct.Weak.html#method.upgrade /// [`None`]: ../../std/option/enum.Option.html#variant.None -/// [assoc]: ../../book/first-edition/method-syntax.html#associated-functions /// [`RefCell`]: ../../std/cell/struct.RefCell.html /// [`std::sync`]: ../../std/sync/index.html /// [`Arc::clone(&from)`]: #method.clone @@ -304,8 +293,10 @@ impl Arc { Arc { ptr: Box::into_raw_non_null(x), phantom: PhantomData } } - #[unstable(feature = "pin", issue = "49150")] - pub fn pinned(data: T) -> Pin> { + /// Constructs a new `Pin>`. If `T` does not implement `Unpin`, then + /// `data` will be pinned in memory and unable to be moved. + #[stable(feature = "pin", since = "1.33.0")] + pub fn pin(data: T) -> Pin> { unsafe { Pin::new_unchecked(Arc::new(data)) } } @@ -422,6 +413,27 @@ impl Arc { } } + /// Consumes the `Arc`, returning the wrapped pointer as `NonNull`. + /// + /// # Examples + /// + /// ``` + /// #![feature(rc_into_raw_non_null)] + /// + /// use std::sync::Arc; + /// + /// let x = Arc::new(10); + /// let ptr = Arc::into_raw_non_null(x); + /// let deref = unsafe { *ptr.as_ref() }; + /// assert_eq!(deref, 10); + /// ``` + #[unstable(feature = "rc_into_raw_non_null", issue = "47336")] + #[inline] + pub fn into_raw_non_null(this: Self) -> NonNull { + // safe because Arc guarantees its pointer is non-null + unsafe { NonNull::new_unchecked(Arc::into_raw(this) as *mut _) } + } + /// Creates a new [`Weak`][weak] pointer to this value. /// /// [weak]: struct.Weak.html @@ -768,6 +780,9 @@ impl Deref for Arc { } } +#[unstable(feature = "receiver_trait", issue = "0")] +impl Receiver for Arc {} + impl Arc { /// Makes a mutable reference into the given `Arc`. /// @@ -953,6 +968,8 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Arc { /// drop(foo); // Doesn't print anything /// drop(foo2); // Prints "dropped!" /// ``` + /// + /// [`Weak`]: ../../std/sync/struct.Weak.html #[inline] fn drop(&mut self) { // Because `fetch_sub` is already atomic, we do not need to synchronize @@ -1121,8 +1138,63 @@ impl Weak { } } + /// Gets the number of strong (`Arc`) pointers pointing to this value. + /// + /// If `self` was created using [`Weak::new`], this will return 0. + /// + /// [`Weak::new`]: #method.new + #[unstable(feature = "weak_counts", issue = "57977")] + pub fn strong_count(&self) -> usize { + if let Some(inner) = self.inner() { + inner.strong.load(SeqCst) + } else { + 0 + } + } + + /// Gets an approximation of the number of `Weak` pointers pointing to this + /// value. + /// + /// If `self` was created using [`Weak::new`], this will return 0. If not, + /// the returned value is at least 1, since `self` still points to the + /// value. + /// + /// # Accuracy + /// + /// Due to implementation details, the returned value can be off by 1 in + /// either direction when other threads are manipulating any `Arc`s or + /// `Weak`s pointing to the same value. + /// + /// [`Weak::new`]: #method.new + #[unstable(feature = "weak_counts", issue = "57977")] + pub fn weak_count(&self) -> Option { + // Due to the implicit weak pointer added when any strong pointers are + // around, we cannot implement `weak_count` correctly since it + // necessarily requires accessing the strong count and weak count in an + // unsynchronized fashion. So this version is a bit racy. + self.inner().map(|inner| { + let strong = inner.strong.load(SeqCst); + let weak = inner.weak.load(SeqCst); + if strong == 0 { + // If the last `Arc` has *just* been dropped, it might not yet + // have removed the implicit weak count, so the value we get + // here might be 1 too high. + weak + } else { + // As long as there's still at least 1 `Arc` around, subtract + // the implicit weak pointer. + // Note that the last `Arc` might get dropped between the 2 + // loads we do above, removing the implicit weak pointer. This + // means that the value might be 1 too low here. In order to not + // return 0 here (which would happen if we're the only weak + // pointer), we guard against that specifically. + cmp::max(1, weak - 1) + } + }) + } + /// Return `None` when the pointer is dangling and there is no allocated `ArcInner`, - /// i.e. this `Weak` was created by `Weak::new` + /// i.e., this `Weak` was created by `Weak::new` #[inline] fn inner(&self) -> Option<&ArcInner> { if is_dangling(self.ptr) { @@ -1131,6 +1203,53 @@ impl Weak { Some(unsafe { self.ptr.as_ref() }) } } + + /// Returns true if the two `Weak`s point to the same value (not just values + /// that compare as equal). + /// + /// # Notes + /// + /// Since this compares pointers it means that `Weak::new()` will equal each + /// other, even though they don't point to any value. + /// + /// + /// # Examples + /// + /// ``` + /// #![feature(weak_ptr_eq)] + /// use std::sync::{Arc, Weak}; + /// + /// let first_rc = Arc::new(5); + /// let first = Arc::downgrade(&first_rc); + /// let second = Arc::downgrade(&first_rc); + /// + /// assert!(Weak::ptr_eq(&first, &second)); + /// + /// let third_rc = Arc::new(5); + /// let third = Arc::downgrade(&third_rc); + /// + /// assert!(!Weak::ptr_eq(&first, &third)); + /// ``` + /// + /// Comparing `Weak::new`. + /// + /// ``` + /// #![feature(weak_ptr_eq)] + /// use std::sync::{Arc, Weak}; + /// + /// let first = Weak::new(); + /// let second = Weak::new(); + /// assert!(Weak::ptr_eq(&first, &second)); + /// + /// let third_rc = Arc::new(()); + /// let third = Arc::downgrade(&third_rc); + /// assert!(!Weak::ptr_eq(&first, &third)); + /// ``` + #[inline] + #[unstable(feature = "weak_ptr_eq", issue = "55981")] + pub fn ptr_eq(this: &Self, other: &Self) -> bool { + this.ptr.as_ptr() == other.ptr.as_ptr() + } } #[stable(feature = "arc_weak", since = "1.4.0")] @@ -1173,10 +1292,11 @@ impl Clone for Weak { #[stable(feature = "downgraded_weak", since = "1.10.0")] impl Default for Weak { /// Constructs a new `Weak`, without allocating memory. - /// Calling [`upgrade`][Weak::upgrade] on the return value always + /// Calling [`upgrade`] on the return value always /// gives [`None`]. /// /// [`None`]: ../../std/option/enum.Option.html#variant.None + /// [`upgrade`]: ../../std/sync/struct.Weak.html#method.upgrade /// /// # Examples /// @@ -1241,12 +1361,46 @@ impl Drop for Weak { } } +#[stable(feature = "rust1", since = "1.0.0")] +trait ArcEqIdent { + fn eq(&self, other: &Arc) -> bool; + fn ne(&self, other: &Arc) -> bool; +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl ArcEqIdent for Arc { + #[inline] + default fn eq(&self, other: &Arc) -> bool { + **self == **other + } + #[inline] + default fn ne(&self, other: &Arc) -> bool { + **self != **other + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl ArcEqIdent for Arc { + #[inline] + fn eq(&self, other: &Arc) -> bool { + Arc::ptr_eq(self, other) || **self == **other + } + + #[inline] + fn ne(&self, other: &Arc) -> bool { + !Arc::ptr_eq(self, other) && **self != **other + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl PartialEq for Arc { /// Equality for two `Arc`s. /// /// Two `Arc`s are equal if their inner values are equal. /// + /// If `T` also implements `Eq`, two `Arc`s that point to the same value are + /// always equal. + /// /// # Examples /// /// ``` @@ -1256,14 +1410,18 @@ impl PartialEq for Arc { /// /// assert!(five == Arc::new(5)); /// ``` + #[inline] fn eq(&self, other: &Arc) -> bool { - *(*self) == *(*other) + ArcEqIdent::eq(self, other) } /// Inequality for two `Arc`s. /// /// Two `Arc`s are unequal if their inner values are unequal. /// + /// If `T` also implements `Eq`, two `Arc`s that point to the same value are + /// never unequal. + /// /// # Examples /// /// ``` @@ -1273,10 +1431,12 @@ impl PartialEq for Arc { /// /// assert!(five != Arc::new(6)); /// ``` + #[inline] fn ne(&self, other: &Arc) -> bool { - *(*self) != *(*other) + ArcEqIdent::ne(self, other) } } + #[stable(feature = "rust1", since = "1.0.0")] impl PartialOrd for Arc { /// Partial comparison for two `Arc`s. @@ -1552,6 +1712,33 @@ mod tests { assert!(Arc::get_mut(&mut x).is_none()); } + #[test] + fn weak_counts() { + assert_eq!(Weak::weak_count(&Weak::::new()), None); + assert_eq!(Weak::strong_count(&Weak::::new()), 0); + + let a = Arc::new(0); + let w = Arc::downgrade(&a); + assert_eq!(Weak::strong_count(&w), 1); + assert_eq!(Weak::weak_count(&w), Some(1)); + let w2 = w.clone(); + assert_eq!(Weak::strong_count(&w), 1); + assert_eq!(Weak::weak_count(&w), Some(2)); + assert_eq!(Weak::strong_count(&w2), 1); + assert_eq!(Weak::weak_count(&w2), Some(2)); + drop(w); + assert_eq!(Weak::strong_count(&w2), 1); + assert_eq!(Weak::weak_count(&w2), Some(1)); + let a2 = a.clone(); + assert_eq!(Weak::strong_count(&w2), 2); + assert_eq!(Weak::weak_count(&w2), Some(1)); + drop(a2); + drop(a); + assert_eq!(Weak::strong_count(&w2), 0); + assert_eq!(Weak::weak_count(&w2), Some(1)); + drop(w2); + } + #[test] fn try_unwrap() { let x = Arc::new(3); @@ -1958,5 +2145,5 @@ impl AsRef for Arc { } } -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl Unpin for Arc { } diff --git a/src/liballoc/task.rs b/src/liballoc/task.rs index 7a4eda21a60..604c56dd017 100644 --- a/src/liballoc/task.rs +++ b/src/liballoc/task.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Types and Traits for working with asynchronous tasks. pub use core::task::*; diff --git a/src/liballoc/tests/arc.rs b/src/liballoc/tests/arc.rs index d90c22a3b18..2759b1b1cac 100644 --- a/src/liballoc/tests/arc.rs +++ b/src/liballoc/tests/arc.rs @@ -1,15 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::any::Any; use std::sync::{Arc, Weak}; +use std::cell::RefCell; +use std::cmp::PartialEq; #[test] fn uninhabited() { @@ -53,3 +45,43 @@ fn trait_object() { b = b.clone(); assert!(b.upgrade().is_none()); } + +#[test] +fn float_nan_ne() { + let x = Arc::new(std::f32::NAN); + assert!(x != x); + assert!(!(x == x)); +} + +#[test] +fn partial_eq() { + struct TestPEq (RefCell); + impl PartialEq for TestPEq { + fn eq(&self, other: &TestPEq) -> bool { + *self.0.borrow_mut() += 1; + *other.0.borrow_mut() += 1; + true + } + } + let x = Arc::new(TestPEq(RefCell::new(0))); + assert!(x == x); + assert!(!(x != x)); + assert_eq!(*x.0.borrow(), 4); +} + +#[test] +fn eq() { + #[derive(Eq)] + struct TestEq (RefCell); + impl PartialEq for TestEq { + fn eq(&self, other: &TestEq) -> bool { + *self.0.borrow_mut() += 1; + *other.0.borrow_mut() += 1; + true + } + } + let x = Arc::new(TestEq(RefCell::new(0))); + assert!(x == x); + assert!(!(x != x)); + assert_eq!(*x.0.borrow(), 0); +} diff --git a/src/liballoc/tests/binary_heap.rs b/src/liballoc/tests/binary_heap.rs index 8494463463c..94ae43237d1 100644 --- a/src/liballoc/tests/binary_heap.rs +++ b/src/liballoc/tests/binary_heap.rs @@ -1,20 +1,10 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cmp; use std::collections::BinaryHeap; use std::collections::binary_heap::{Drain, PeekMut}; use std::panic::{self, AssertUnwindSafe}; -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +use std::sync::atomic::{AtomicUsize, Ordering}; -use rand::{thread_rng, Rng}; +use rand::{thread_rng, seq::SliceRandom}; #[test] fn test_iterator() { @@ -293,7 +283,7 @@ fn assert_covariance() { // Destructors must be called exactly once per element. #[test] fn panic_safe() { - static DROP_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; + static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0); #[derive(Eq, PartialEq, Ord, Clone, Debug)] struct PanicOrd(T, bool); @@ -318,11 +308,11 @@ fn panic_safe() { const NTEST: usize = 10; // don't use 0 in the data -- we want to catch the zeroed-out case. - let data = (1..DATASZ + 1).collect::>(); + let data = (1..=DATASZ).collect::>(); // since it's a fuzzy test, run several tries. for _ in 0..NTEST { - for i in 1..DATASZ + 1 { + for i in 1..=DATASZ { DROP_COUNTER.store(0, Ordering::SeqCst); let mut panic_ords: Vec<_> = data.iter() @@ -332,7 +322,7 @@ fn panic_safe() { let panic_item = PanicOrd(i, true); // heapify the sane items - rng.shuffle(&mut panic_ords); + panic_ords.shuffle(&mut rng); let mut heap = BinaryHeap::from(panic_ords); let inner_data; diff --git a/src/liballoc/tests/btree/map.rs b/src/liballoc/tests/btree/map.rs index 6ebdb86cc4a..05e0bdffaa8 100644 --- a/src/liballoc/tests/btree/map.rs +++ b/src/liballoc/tests/btree/map.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::BTreeMap; use std::collections::btree_map::Entry::{Occupied, Vacant}; use std::ops::Bound::{self, Excluded, Included, Unbounded}; @@ -302,7 +292,7 @@ fn test_range() { for i in 0..size { for j in i..size { let mut kvs = map.range((Included(&i), Included(&j))).map(|(&k, &v)| (k, v)); - let mut pairs = (i..j + 1).map(|i| (i, i)); + let mut pairs = (i..=j).map(|i| (i, i)); for (kv, pair) in kvs.by_ref().zip(pairs.by_ref()) { assert_eq!(kv, pair); @@ -321,7 +311,7 @@ fn test_range_mut() { for i in 0..size { for j in i..size { let mut kvs = map.range_mut((Included(&i), Included(&j))).map(|(&k, &mut v)| (k, v)); - let mut pairs = (i..j + 1).map(|i| (i, i)); + let mut pairs = (i..=j).map(|i| (i, i)); for (kv, pair) in kvs.by_ref().zip(pairs.by_ref()) { assert_eq!(kv, pair); diff --git a/src/liballoc/tests/btree/mod.rs b/src/liballoc/tests/btree/mod.rs index ae8b18d0c9f..4c704d0f8c2 100644 --- a/src/liballoc/tests/btree/mod.rs +++ b/src/liballoc/tests/btree/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod map; mod set; diff --git a/src/liballoc/tests/btree/set.rs b/src/liballoc/tests/btree/set.rs index 0330bda5e32..e24c04fd8ac 100644 --- a/src/liballoc/tests/btree/set.rs +++ b/src/liballoc/tests/btree/set.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::BTreeSet; use std::iter::FromIterator; diff --git a/src/liballoc/tests/cow_str.rs b/src/liballoc/tests/cow_str.rs index 63939686ab7..eb6adb159b0 100644 --- a/src/liballoc/tests/cow_str.rs +++ b/src/liballoc/tests/cow_str.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::borrow::Cow; // check that Cow<'a, str> implements addition diff --git a/src/liballoc/tests/fmt.rs b/src/liballoc/tests/fmt.rs index 70e21c65a18..0ad092b4997 100644 --- a/src/liballoc/tests/fmt.rs +++ b/src/liballoc/tests/fmt.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; #[test] diff --git a/src/liballoc/tests/heap.rs b/src/liballoc/tests/heap.rs index bf256b23f9a..24eea1d2949 100644 --- a/src/liballoc/tests/heap.rs +++ b/src/liballoc/tests/heap.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::alloc::{Global, Alloc, Layout, System}; /// https://github.com/rust-lang/rust/issues/45955 diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs index e514a8a69c0..a76fd87a1a9 100644 --- a/src/liballoc/tests/lib.rs +++ b/src/liballoc/tests/lib.rs @@ -1,23 +1,14 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(allocator_api)] #![feature(box_syntax)] #![feature(drain_filter)] #![feature(exact_size_is_empty)] #![feature(pattern)] +#![feature(repeat_generic_slice)] #![feature(slice_sort_by_cached_key)] #![feature(str_escape)] #![feature(try_reserve)] #![feature(unboxed_closures)] -#![feature(repeat_generic_slice)] +#![feature(vecdeque_rotate)] extern crate core; extern crate rand; diff --git a/src/liballoc/tests/linked_list.rs b/src/liballoc/tests/linked_list.rs index 4e3e855105e..6e775f9650d 100644 --- a/src/liballoc/tests/linked_list.rs +++ b/src/liballoc/tests/linked_list.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::LinkedList; #[test] diff --git a/src/liballoc/tests/rc.rs b/src/liballoc/tests/rc.rs index 9ec7c831444..18f82e80410 100644 --- a/src/liballoc/tests/rc.rs +++ b/src/liballoc/tests/rc.rs @@ -1,15 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::any::Any; use std::rc::{Rc, Weak}; +use std::cell::RefCell; +use std::cmp::PartialEq; #[test] fn uninhabited() { @@ -53,3 +45,43 @@ fn trait_object() { b = b.clone(); assert!(b.upgrade().is_none()); } + +#[test] +fn float_nan_ne() { + let x = Rc::new(std::f32::NAN); + assert!(x != x); + assert!(!(x == x)); +} + +#[test] +fn partial_eq() { + struct TestPEq (RefCell); + impl PartialEq for TestPEq { + fn eq(&self, other: &TestPEq) -> bool { + *self.0.borrow_mut() += 1; + *other.0.borrow_mut() += 1; + true + } + } + let x = Rc::new(TestPEq(RefCell::new(0))); + assert!(x == x); + assert!(!(x != x)); + assert_eq!(*x.0.borrow(), 4); +} + +#[test] +fn eq() { + #[derive(Eq)] + struct TestEq (RefCell); + impl PartialEq for TestEq { + fn eq(&self, other: &TestEq) -> bool { + *self.0.borrow_mut() += 1; + *other.0.borrow_mut() += 1; + true + } + } + let x = Rc::new(TestEq(RefCell::new(0))); + assert!(x == x); + assert!(!(x != x)); + assert_eq!(*x.0.borrow(), 0); +} diff --git a/src/liballoc/tests/slice.rs b/src/liballoc/tests/slice.rs index a50f99b0022..0300bd7f3f6 100644 --- a/src/liballoc/tests/slice.rs +++ b/src/liballoc/tests/slice.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cell::Cell; use std::cmp::Ordering::{Equal, Greater, Less}; use std::cmp::Ordering; @@ -15,10 +5,10 @@ use std::mem; use std::panic; use std::rc::Rc; use std::sync::atomic::Ordering::Relaxed; -use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize}; +use std::sync::atomic::AtomicUsize; use std::thread; -use rand::{Rng, RngCore, thread_rng}; +use rand::{Rng, RngCore, thread_rng, seq::SliceRandom}; use rand::distributions::Standard; fn square(n: usize) -> usize { @@ -459,7 +449,7 @@ fn test_sort() { for i in 0..v.len() { v[i] = i as i32; } - v.sort_by(|_, _| *rng.choose(&[Less, Equal, Greater]).unwrap()); + v.sort_by(|_, _| *[Less, Equal, Greater].choose(&mut rng).unwrap()); v.sort(); for i in 0..v.len() { assert_eq!(v[i], i as i32); @@ -484,7 +474,7 @@ fn test_sort_stability() { // create a vector like [(6, 1), (5, 1), (6, 2), ...], // where the first item of each tuple is random, but // the second item represents which occurrence of that - // number this element is, i.e. the second elements + // number this element is, i.e., the second elements // will occur in sorted order. let mut orig: Vec<_> = (0..len) .map(|_| { @@ -502,7 +492,7 @@ fn test_sort_stability() { // This comparison includes the count (the second item // of the tuple), so elements with equal first items // will need to be ordered with increasing - // counts... i.e. exactly asserting that this sort is + // counts... i.e., exactly asserting that this sort is // stable. assert!(v.windows(2).all(|w| w[0] <= w[1])); @@ -1510,7 +1500,7 @@ static DROP_COUNTS: [AtomicUsize; MAX_LEN] = [ AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), AtomicUsize::new(0), ]; -static VERSIONS: AtomicUsize = ATOMIC_USIZE_INIT; +static VERSIONS: AtomicUsize = AtomicUsize::new(0); #[derive(Clone, Eq)] struct DropCounter { @@ -1579,7 +1569,7 @@ macro_rules! test { }).join(); // Check that the number of things dropped is exactly - // what we expect (i.e. the contents of `v`). + // what we expect (i.e., the contents of `v`). for (i, c) in DROP_COUNTS.iter().enumerate().take(len) { let count = c.load(Relaxed); assert!(count == 1, diff --git a/src/liballoc/tests/str.rs b/src/liballoc/tests/str.rs index a5fa7f0c4d9..66a1b947a7d 100644 --- a/src/liballoc/tests/str.rs +++ b/src/liballoc/tests/str.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::borrow::Cow; use std::cmp::Ordering::{Equal, Greater, Less}; use std::str::from_utf8; @@ -1005,7 +995,7 @@ fn test_escape_debug() { // Note that there are subtleties with the number of backslashes // on the left- and right-hand sides. In particular, Unicode code points // are usually escaped with two backslashes on the right-hand side, as - // they are escaped. However, when the character is unescaped (e.g. for + // they are escaped. However, when the character is unescaped (e.g., for // printable characters), only a single backslash appears (as the character // itself appears in the debug string). assert_eq!("abc".escape_debug(), "abc"); @@ -1378,7 +1368,7 @@ fn test_bool_from_str() { fn check_contains_all_substrings(s: &str) { assert!(s.contains("")); for i in 0..s.len() { - for j in i+1..s.len() + 1 { + for j in i+1..=s.len() { assert!(s.contains(&s[i..j])); } } @@ -1514,9 +1504,9 @@ fn contains_weird_cases() { #[test] fn trim_ws() { - assert_eq!(" \t a \t ".trim_left_matches(|c: char| c.is_whitespace()), + assert_eq!(" \t a \t ".trim_start_matches(|c: char| c.is_whitespace()), "a \t "); - assert_eq!(" \t a \t ".trim_right_matches(|c: char| c.is_whitespace()), + assert_eq!(" \t a \t ".trim_end_matches(|c: char| c.is_whitespace()), " \t a"); assert_eq!(" \t a \t ".trim_start_matches(|c: char| c.is_whitespace()), "a \t "); @@ -1524,9 +1514,9 @@ fn trim_ws() { " \t a"); assert_eq!(" \t a \t ".trim_matches(|c: char| c.is_whitespace()), "a"); - assert_eq!(" \t \t ".trim_left_matches(|c: char| c.is_whitespace()), + assert_eq!(" \t \t ".trim_start_matches(|c: char| c.is_whitespace()), ""); - assert_eq!(" \t \t ".trim_right_matches(|c: char| c.is_whitespace()), + assert_eq!(" \t \t ".trim_end_matches(|c: char| c.is_whitespace()), ""); assert_eq!(" \t \t ".trim_start_matches(|c: char| c.is_whitespace()), ""); diff --git a/src/liballoc/tests/string.rs b/src/liballoc/tests/string.rs index befb36baeef..8a5bfca8b7d 100644 --- a/src/liballoc/tests/string.rs +++ b/src/liballoc/tests/string.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::borrow::Cow; use std::collections::CollectionAllocErr::*; use std::mem::size_of; diff --git a/src/liballoc/tests/vec.rs b/src/liballoc/tests/vec.rs index e329b45a617..0fdcf34c783 100644 --- a/src/liballoc/tests/vec.rs +++ b/src/liballoc/tests/vec.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::borrow::Cow; use std::mem::size_of; use std::{usize, isize}; @@ -79,6 +69,11 @@ fn test_reserve() { assert!(v.capacity() >= 33) } +#[test] +fn test_zst_capacity() { + assert_eq!(Vec::<()>::new().capacity(), usize::max_value()); +} + #[test] fn test_extend() { let mut v = Vec::new(); diff --git a/src/liballoc/tests/vec_deque.rs b/src/liballoc/tests/vec_deque.rs index 3ea6c87a651..c9d16a06b47 100644 --- a/src/liballoc/tests/vec_deque.rs +++ b/src/liballoc/tests/vec_deque.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::VecDeque; use std::fmt::Debug; use std::collections::vec_deque::{Drain}; @@ -861,7 +851,7 @@ fn test_as_slices() { ring.push_back(i); let (left, right) = ring.as_slices(); - let expected: Vec<_> = (0..i + 1).collect(); + let expected: Vec<_> = (0..=i).collect(); assert_eq!(left, &expected[..]); assert_eq!(right, []); } @@ -869,7 +859,7 @@ fn test_as_slices() { for j in -last..0 { ring.push_front(j); let (left, right) = ring.as_slices(); - let expected_left: Vec<_> = (-last..j + 1).rev().collect(); + let expected_left: Vec<_> = (-last..=j).rev().collect(); let expected_right: Vec<_> = (0..first).collect(); assert_eq!(left, &expected_left[..]); assert_eq!(right, &expected_right[..]); @@ -889,7 +879,7 @@ fn test_as_mut_slices() { ring.push_back(i); let (left, right) = ring.as_mut_slices(); - let expected: Vec<_> = (0..i + 1).collect(); + let expected: Vec<_> = (0..=i).collect(); assert_eq!(left, &expected[..]); assert_eq!(right, []); } @@ -897,7 +887,7 @@ fn test_as_mut_slices() { for j in -last..0 { ring.push_front(j); let (left, right) = ring.as_mut_slices(); - let expected_left: Vec<_> = (-last..j + 1).rev().collect(); + let expected_left: Vec<_> = (-last..=j).rev().collect(); let expected_right: Vec<_> = (0..first).collect(); assert_eq!(left, &expected_left[..]); assert_eq!(right, &expected_right[..]); @@ -1309,3 +1299,174 @@ fn test_try_reserve_exact() { } } + +#[test] +fn test_rotate_nop() { + let mut v: VecDeque<_> = (0..10).collect(); + assert_unchanged(&v); + + v.rotate_left(0); + assert_unchanged(&v); + + v.rotate_left(10); + assert_unchanged(&v); + + v.rotate_right(0); + assert_unchanged(&v); + + v.rotate_right(10); + assert_unchanged(&v); + + v.rotate_left(3); + v.rotate_right(3); + assert_unchanged(&v); + + v.rotate_right(3); + v.rotate_left(3); + assert_unchanged(&v); + + v.rotate_left(6); + v.rotate_right(6); + assert_unchanged(&v); + + v.rotate_right(6); + v.rotate_left(6); + assert_unchanged(&v); + + v.rotate_left(3); + v.rotate_left(7); + assert_unchanged(&v); + + v.rotate_right(4); + v.rotate_right(6); + assert_unchanged(&v); + + v.rotate_left(1); + v.rotate_left(2); + v.rotate_left(3); + v.rotate_left(4); + assert_unchanged(&v); + + v.rotate_right(1); + v.rotate_right(2); + v.rotate_right(3); + v.rotate_right(4); + assert_unchanged(&v); + + fn assert_unchanged(v: &VecDeque) { + assert_eq!(v, &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); + } +} + +#[test] +fn test_rotate_left_parts() { + let mut v: VecDeque<_> = (1..=7).collect(); + v.rotate_left(2); + assert_eq!(v.as_slices(), (&[3, 4, 5, 6, 7, 1][..], &[2][..])); + v.rotate_left(2); + assert_eq!(v.as_slices(), (&[5, 6, 7, 1][..], &[2, 3, 4][..])); + v.rotate_left(2); + assert_eq!(v.as_slices(), (&[7, 1][..], &[2, 3, 4, 5, 6][..])); + v.rotate_left(2); + assert_eq!(v.as_slices(), (&[2, 3, 4, 5, 6, 7, 1][..], &[][..])); + v.rotate_left(2); + assert_eq!(v.as_slices(), (&[4, 5, 6, 7, 1, 2][..], &[3][..])); + v.rotate_left(2); + assert_eq!(v.as_slices(), (&[6, 7, 1, 2][..], &[3, 4, 5][..])); + v.rotate_left(2); + assert_eq!(v.as_slices(), (&[1, 2][..], &[3, 4, 5, 6, 7][..])); +} + +#[test] +fn test_rotate_right_parts() { + let mut v: VecDeque<_> = (1..=7).collect(); + v.rotate_right(2); + assert_eq!(v.as_slices(), (&[6, 7][..], &[1, 2, 3, 4, 5][..])); + v.rotate_right(2); + assert_eq!(v.as_slices(), (&[4, 5, 6, 7][..], &[1, 2, 3][..])); + v.rotate_right(2); + assert_eq!(v.as_slices(), (&[2, 3, 4, 5, 6, 7][..], &[1][..])); + v.rotate_right(2); + assert_eq!(v.as_slices(), (&[7, 1, 2, 3, 4, 5, 6][..], &[][..])); + v.rotate_right(2); + assert_eq!(v.as_slices(), (&[5, 6][..], &[7, 1, 2, 3, 4][..])); + v.rotate_right(2); + assert_eq!(v.as_slices(), (&[3, 4, 5, 6][..], &[7, 1, 2][..])); + v.rotate_right(2); + assert_eq!(v.as_slices(), (&[1, 2, 3, 4, 5, 6][..], &[7][..])); +} + +#[test] +fn test_rotate_left_random() { + let shifts = [ + 6, 1, 0, 11, 12, 1, 11, 7, 9, 3, 6, 1, + 4, 0, 5, 1, 3, 1, 12, 8, 3, 1, 11, 11, + 9, 4, 12, 3, 12, 9, 11, 1, 7, 9, 7, 2, + ]; + let n = 12; + let mut v: VecDeque<_> = (0..n).collect(); + let mut total_shift = 0; + for shift in shifts.iter().cloned() { + v.rotate_left(shift); + total_shift += shift; + for i in 0..n { + assert_eq!(v[i], (i + total_shift) % n); + } + } +} + +#[test] +fn test_rotate_right_random() { + let shifts = [ + 6, 1, 0, 11, 12, 1, 11, 7, 9, 3, 6, 1, + 4, 0, 5, 1, 3, 1, 12, 8, 3, 1, 11, 11, + 9, 4, 12, 3, 12, 9, 11, 1, 7, 9, 7, 2, + ]; + let n = 12; + let mut v: VecDeque<_> = (0..n).collect(); + let mut total_shift = 0; + for shift in shifts.iter().cloned() { + v.rotate_right(shift); + total_shift += shift; + for i in 0..n { + assert_eq!(v[(i + total_shift) % n], i); + } + } +} + +#[test] +fn test_try_fold_empty() { + assert_eq!(Some(0), VecDeque::::new().iter().try_fold(0, |_, _| None)); +} + +#[test] +fn test_try_fold_none() { + let v: VecDeque = (0..12).collect(); + assert_eq!(None, v.into_iter().try_fold(0, |a, b| + if b < 11 { Some(a + b) } else { None })); +} + +#[test] +fn test_try_fold_ok() { + let v: VecDeque = (0..12).collect(); + assert_eq!(Ok::<_, ()>(66), v.into_iter().try_fold(0, |a, b| Ok(a + b))); +} + +#[test] +fn test_try_fold_unit() { + let v: VecDeque<()> = std::iter::repeat(()).take(42).collect(); + assert_eq!(Some(()), v.into_iter().try_fold((), |(), ()| Some(()))); +} + +#[test] +fn test_try_fold_rotated() { + let mut v: VecDeque<_> = (0..12).collect(); + for n in 0..10 { + if n & 1 == 0 { + v.rotate_left(n); + } else { + v.rotate_right(n); + } + assert_eq!(Ok::<_, ()>(66), v.iter().try_fold(0, |a, b| Ok(a + b))); + } +} diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index f7a0bbdceaf..ba3b3dfbfc2 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A contiguous growable array type with heap-allocated contents, written //! `Vec`. //! @@ -213,7 +203,7 @@ use raw_vec::RawVec; /// about its design. This ensures that it's as low-overhead as possible in /// the general case, and can be correctly manipulated in primitive ways /// by unsafe code. Note that these guarantees refer to an unqualified `Vec`. -/// If additional type parameters are added (e.g. to support custom allocators), +/// If additional type parameters are added (e.g., to support custom allocators), /// overriding their defaults may change the behavior. /// /// Most fundamentally, `Vec` is and always will be a (pointer, capacity, length) @@ -613,7 +603,7 @@ impl Vec { /// vec.shrink_to(0); /// assert!(vec.capacity() >= 3); /// ``` - #[unstable(feature = "shrink_to", reason = "new API", issue="0")] + #[unstable(feature = "shrink_to", reason = "new API", issue="56431")] pub fn shrink_to(&mut self, min_capacity: usize) { self.buf.shrink_to_fit(cmp::max(self.len, min_capacity)); } @@ -748,53 +738,90 @@ impl Vec { self } - /// Sets the length of a vector. + /// Forces the length of the vector to `new_len`. /// - /// This will explicitly set the size of the vector, without actually - /// modifying its buffers, so it is up to the caller to ensure that the - /// vector is actually the specified size. + /// This is a low-level operation that maintains none of the normal + /// invariants of the type. Normally changing the length of a vector + /// is done using one of the safe operations instead, such as + /// [`truncate`], [`resize`], [`extend`], or [`clear`]. /// - /// # Examples + /// [`truncate`]: #method.truncate + /// [`resize`]: #method.resize + /// [`extend`]: #method.extend-1 + /// [`clear`]: #method.clear /// - /// ``` - /// use std::ptr; + /// # Safety /// - /// let mut vec = vec!['r', 'u', 's', 't']; + /// - `new_len` must be less than or equal to [`capacity()`]. + /// - The elements at `old_len..new_len` must be initialized. /// - /// unsafe { - /// ptr::drop_in_place(&mut vec[3]); - /// vec.set_len(3); + /// [`capacity()`]: #method.capacity + /// + /// # Examples + /// + /// This method can be useful for situations in which the vector + /// is serving as a buffer for other code, particularly over FFI: + /// + /// ```no_run + /// # #![allow(dead_code)] + /// # // This is just a minimal skeleton for the doc example; + /// # // don't use this as a starting point for a real library. + /// # pub struct StreamWrapper { strm: *mut std::ffi::c_void } + /// # const Z_OK: i32 = 0; + /// # extern "C" { + /// # fn deflateGetDictionary( + /// # strm: *mut std::ffi::c_void, + /// # dictionary: *mut u8, + /// # dictLength: *mut usize, + /// # ) -> i32; + /// # } + /// # impl StreamWrapper { + /// pub fn get_dictionary(&self) -> Option> { + /// // Per the FFI method's docs, "32768 bytes is always enough". + /// let mut dict = Vec::with_capacity(32_768); + /// let mut dict_length = 0; + /// // SAFETY: When `deflateGetDictionary` returns `Z_OK`, it holds that: + /// // 1. `dict_length` elements were initialized. + /// // 2. `dict_length` <= the capacity (32_768) + /// // which makes `set_len` safe to call. + /// unsafe { + /// // Make the FFI call... + /// let r = deflateGetDictionary(self.strm, dict.as_mut_ptr(), &mut dict_length); + /// if r == Z_OK { + /// // ...and update the length to what was initialized. + /// dict.set_len(dict_length); + /// Some(dict) + /// } else { + /// None + /// } + /// } /// } - /// assert_eq!(vec, ['r', 'u', 's']); + /// # } /// ``` /// - /// In this example, there is a memory leak since the memory locations - /// owned by the inner vectors were not freed prior to the `set_len` call: + /// While the following example is sound, there is a memory leak since + /// the inner vectors were not freed prior to the `set_len` call: /// /// ``` /// let mut vec = vec![vec![1, 0, 0], /// vec![0, 1, 0], /// vec![0, 0, 1]]; + /// // SAFETY: + /// // 1. `old_len..0` is empty so no elements need to be initialized. + /// // 2. `0 <= capacity` always holds whatever `capacity` is. /// unsafe { /// vec.set_len(0); /// } /// ``` /// - /// In this example, the vector gets expanded from zero to four items - /// without any memory allocations occurring, resulting in vector - /// values of unallocated memory: - /// - /// ``` - /// let mut vec: Vec = Vec::new(); - /// - /// unsafe { - /// vec.set_len(4); - /// } - /// ``` + /// Normally, here, one would use [`clear`] instead to correctly drop + /// the contents and thus not leak memory. #[inline] #[stable(feature = "rust1", since = "1.0.0")] - pub unsafe fn set_len(&mut self, len: usize) { - self.len = len; + pub unsafe fn set_len(&mut self, new_len: usize) { + debug_assert!(new_len <= self.capacity()); + + self.len = new_len; } /// Removes an element from the vector and returns it. @@ -1241,8 +1268,6 @@ impl Vec { /// # Examples /// /// ``` - /// #![feature(vec_resize_with)] - /// /// let mut vec = vec![1, 2, 3]; /// vec.resize_with(5, Default::default); /// assert_eq!(vec, [1, 2, 3, 0, 0]); @@ -1255,7 +1280,7 @@ impl Vec { /// /// [`resize`]: #method.resize /// [`Clone`]: ../../std/clone/trait.Clone.html - #[unstable(feature = "vec_resize_with", issue = "41758")] + #[stable(feature = "vec_resize_with", since = "1.33.0")] pub fn resize_with(&mut self, new_len: usize, f: F) where F: FnMut() -> T { diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index dae05a368fa..9f9ded51e37 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The arena, a fast but limited type of allocator. //! //! Arenas are a type of allocator that destroy the objects within, all at @@ -129,6 +119,11 @@ impl Default for TypedArena { } impl TypedArena { + pub fn in_arena(&self, ptr: *const T) -> bool { + let ptr = ptr as *const T as *mut T; + + self.chunks.borrow().iter().any(|chunk| chunk.start() <= ptr && ptr < chunk.end()) + } /// Allocates an object in the `TypedArena`, returning a reference to it. #[inline] pub fn alloc(&self, object: T) -> &mut T { @@ -224,14 +219,14 @@ impl TypedArena { unsafe { // Clear the last chunk, which is partially filled. let mut chunks_borrow = self.chunks.borrow_mut(); - if let Some(mut last_chunk) = chunks_borrow.pop() { + if let Some(mut last_chunk) = chunks_borrow.last_mut() { self.clear_last_chunk(&mut last_chunk); + let len = chunks_borrow.len(); // If `T` is ZST, code below has no effect. - for mut chunk in chunks_borrow.drain(..) { + for mut chunk in chunks_borrow.drain(..len-1) { let cap = chunk.storage.cap(); chunk.destroy(cap); } - chunks_borrow.push(last_chunk); } } } @@ -298,6 +293,7 @@ pub struct DroplessArena { unsafe impl Send for DroplessArena {} impl Default for DroplessArena { + #[inline] fn default() -> DroplessArena { DroplessArena { ptr: Cell::new(0 as *mut u8), @@ -310,15 +306,11 @@ impl Default for DroplessArena { impl DroplessArena { pub fn in_arena(&self, ptr: *const T) -> bool { let ptr = ptr as *const u8 as *mut u8; - for chunk in &*self.chunks.borrow() { - if chunk.start() <= ptr && ptr < chunk.end() { - return true; - } - } - false + self.chunks.borrow().iter().any(|chunk| chunk.start() <= ptr && ptr < chunk.end()) } + #[inline] fn align(&self, align: usize) { let final_address = ((self.ptr.get() as usize) + align - 1) & !(align - 1); self.ptr.set(final_address as *mut u8); @@ -408,7 +400,7 @@ impl DroplessArena { { assert!(!mem::needs_drop::()); assert!(mem::size_of::() != 0); - assert!(slice.len() != 0); + assert!(!slice.is_empty()); let mem = self.alloc_raw( slice.len() * mem::size_of::(), @@ -604,6 +596,15 @@ mod tests { } } + #[bench] + pub fn bench_typed_arena_clear(b: &mut Bencher) { + let mut arena = TypedArena::default(); + b.iter(|| { + arena.alloc(Point { x: 1, y: 2, z: 3 }); + arena.clear(); + }) + } + // Drop tests struct DropCounter<'a> { diff --git a/src/libbacktrace b/src/libbacktrace deleted file mode 160000 index f4d02bbdbf8..00000000000 --- a/src/libbacktrace +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f4d02bbdbf8a2c5a31f0801dfef597a86caad9e3 diff --git a/src/libcompiler_builtins b/src/libcompiler_builtins deleted file mode 160000 index 939cbca6e9d..00000000000 --- a/src/libcompiler_builtins +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 939cbca6e9d829265d6cf006d3532142a4061cd3 diff --git a/src/libcore/Cargo.toml b/src/libcore/Cargo.toml index 2de1fa521e8..0dea4745d86 100644 --- a/src/libcore/Cargo.toml +++ b/src/libcore/Cargo.toml @@ -20,7 +20,11 @@ name = "corebenches" path = "../libcore/benches/lib.rs" [dev-dependencies] -rand = "0.5" +rand = "0.6" + +[features] +# Make panics and failed asserts immediately abort without formatting any message +panic_immediate_abort = [] [build-dependencies] cc = "1.0" diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs index 58639808fae..66a3094d77d 100644 --- a/src/libcore/alloc.rs +++ b/src/libcore/alloc.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Memory allocation APIs #![stable(feature = "alloc_module", since = "1.28.0")] @@ -69,7 +59,7 @@ impl Layout { /// * `align` must be a power of two, /// /// * `size`, when rounded up to the nearest multiple of `align`, - /// must not overflow (i.e. the rounded value must be less than + /// must not overflow (i.e., the rounded value must be less than /// `usize::MAX`). #[stable(feature = "alloc_layout", since = "1.28.0")] #[inline] @@ -177,7 +167,7 @@ impl Layout { /// to ensure that the following address will satisfy `align` /// (measured in bytes). /// - /// E.g. if `self.size()` is 9, then `self.padding_needed_for(4)` + /// e.g., if `self.size()` is 9, then `self.padding_needed_for(4)` /// returns 3, because that is the minimum number of bytes of /// padding required to get a 4-aligned address (assuming that the /// corresponding memory block starts at a 4-aligned address). @@ -455,7 +445,7 @@ pub unsafe trait GlobalAlloc { /// if the caller does not ensure that `layout` has non-zero size. /// /// (Extension subtraits might provide more specific bounds on - /// behavior, e.g. guarantee a sentinel address or a null pointer + /// behavior, e.g., guarantee a sentinel address or a null pointer /// in response to a zero-size allocation request.) /// /// The allocated block of memory may or may not be initialized. @@ -550,10 +540,10 @@ pub unsafe trait GlobalAlloc { /// * `new_size` must be greater than zero. /// /// * `new_size`, when rounded up to the nearest multiple of `layout.align()`, - /// must not overflow (i.e. the rounded value must be less than `usize::MAX`). + /// must not overflow (i.e., the rounded value must be less than `usize::MAX`). /// /// (Extension subtraits might provide more specific bounds on - /// behavior, e.g. guarantee a sentinel address or a null pointer + /// behavior, e.g., guarantee a sentinel address or a null pointer /// in response to a zero-size allocation request.) /// /// # Errors @@ -616,7 +606,7 @@ pub unsafe trait GlobalAlloc { /// whether to return `Err`, or to return `Ok` with some pointer. /// /// * If an `Alloc` implementation chooses to return `Ok` in this -/// case (i.e. the pointer denotes a zero-sized inaccessible block) +/// case (i.e., the pointer denotes a zero-sized inaccessible block) /// then that returned pointer must be considered "currently /// allocated". On such an allocator, *all* methods that take /// currently-allocated pointers as inputs must accept these @@ -651,7 +641,7 @@ pub unsafe trait GlobalAlloc { /// /// * if a layout `k` fits a memory block (denoted by `ptr`) /// currently allocated via an allocator `a`, then it is legal to -/// use that layout to deallocate it, i.e. `a.dealloc(ptr, k);`. +/// use that layout to deallocate it, i.e., `a.dealloc(ptr, k);`. /// /// # Unsafety /// @@ -673,7 +663,7 @@ pub unsafe trait Alloc { // (Note: some existing allocators have unspecified but well-defined // behavior in response to a zero size allocation request ; - // e.g. in C, `malloc` of 0 will either return a null pointer or a + // e.g., in C, `malloc` of 0 will either return a null pointer or a // unique pointer, but will not have arbitrary undefined // behavior. // However in jemalloc for example, @@ -688,7 +678,7 @@ pub unsafe trait Alloc { /// /// The returned block of storage may or may not have its contents /// initialized. (Extension subtraits might restrict this - /// behavior, e.g. to ensure initialization to particular sets of + /// behavior, e.g., to ensure initialization to particular sets of /// bit patterns.) /// /// # Safety @@ -697,7 +687,7 @@ pub unsafe trait Alloc { /// if the caller does not ensure that `layout` has non-zero size. /// /// (Extension subtraits might provide more specific bounds on - /// behavior, e.g. guarantee a sentinel address or a null pointer + /// behavior, e.g., guarantee a sentinel address or a null pointer /// in response to a zero-size allocation request.) /// /// # Errors @@ -803,10 +793,10 @@ pub unsafe trait Alloc { /// * `new_size` must be greater than zero. /// /// * `new_size`, when rounded up to the nearest multiple of `layout.align()`, - /// must not overflow (i.e. the rounded value must be less than `usize::MAX`). + /// must not overflow (i.e., the rounded value must be less than `usize::MAX`). /// /// (Extension subtraits might provide more specific bounds on - /// behavior, e.g. guarantee a sentinel address or a null pointer + /// behavior, e.g., guarantee a sentinel address or a null pointer /// in response to a zero-size allocation request.) /// /// # Errors diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 6b26093439e..2afd9e0c072 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module implements the `Any` trait, which enables dynamic typing //! of any `'static` type through runtime reflection. //! @@ -39,7 +29,7 @@ //! //! // Logger function for any type that implements Debug. //! fn log(value: &T) { -//! let value_any = value as &Any; +//! let value_any = value as &dyn Any; //! //! // try to convert our value to a String. If successful, we want to //! // output the String's length as well as its value. If not, it's a @@ -91,12 +81,10 @@ pub trait Any: 'static { /// # Examples /// /// ``` - /// #![feature(get_type_id)] - /// /// use std::any::{Any, TypeId}; /// - /// fn is_string(s: &Any) -> bool { - /// TypeId::of::() == s.get_type_id() + /// fn is_string(s: &dyn Any) -> bool { + /// TypeId::of::() == s.type_id() /// } /// /// fn main() { @@ -104,15 +92,13 @@ pub trait Any: 'static { /// assert_eq!(is_string(&"cookie monster".to_string()), true); /// } /// ``` - #[unstable(feature = "get_type_id", - reason = "this method will likely be replaced by an associated static", - issue = "27745")] - fn get_type_id(&self) -> TypeId; + #[stable(feature = "get_type_id", since = "1.34.0")] + fn type_id(&self) -> TypeId; } #[stable(feature = "rust1", since = "1.0.0")] impl Any for T { - fn get_type_id(&self) -> TypeId { TypeId::of::() } + fn type_id(&self) -> TypeId { TypeId::of::() } } /////////////////////////////////////////////////////////////////////////////// @@ -126,7 +112,7 @@ impl fmt::Debug for dyn Any { } } -// Ensure that the result of e.g. joining a thread can be printed and +// Ensure that the result of e.g., joining a thread can be printed and // hence used with `unwrap`. May eventually no longer be needed if // dispatch works with upcasting. #[stable(feature = "rust1", since = "1.0.0")] @@ -151,7 +137,7 @@ impl dyn Any { /// ``` /// use std::any::Any; /// - /// fn is_string(s: &Any) { + /// fn is_string(s: &dyn Any) { /// if s.is::() { /// println!("It's a string!"); /// } else { @@ -171,10 +157,10 @@ impl dyn Any { let t = TypeId::of::(); // Get TypeId of the type in the trait object - let boxed = self.get_type_id(); + let concrete = self.type_id(); // Compare both TypeIds on equality - t == boxed + t == concrete } /// Returns some reference to the boxed value if it is of type `T`, or @@ -185,7 +171,7 @@ impl dyn Any { /// ``` /// use std::any::Any; /// - /// fn print_if_string(s: &Any) { + /// fn print_if_string(s: &dyn Any) { /// if let Some(string) = s.downcast_ref::() { /// println!("It's a string({}): '{}'", string.len(), string); /// } else { @@ -218,7 +204,7 @@ impl dyn Any { /// ``` /// use std::any::Any; /// - /// fn modify_if_u32(s: &mut Any) { + /// fn modify_if_u32(s: &mut dyn Any) { /// if let Some(num) = s.downcast_mut::() { /// *num = 42; /// } @@ -256,7 +242,7 @@ impl dyn Any+Send { /// ``` /// use std::any::Any; /// - /// fn is_string(s: &(Any + Send)) { + /// fn is_string(s: &(dyn Any + Send)) { /// if s.is::() { /// println!("It's a string!"); /// } else { @@ -282,7 +268,7 @@ impl dyn Any+Send { /// ``` /// use std::any::Any; /// - /// fn print_if_string(s: &(Any + Send)) { + /// fn print_if_string(s: &(dyn Any + Send)) { /// if let Some(string) = s.downcast_ref::() { /// println!("It's a string({}): '{}'", string.len(), string); /// } else { @@ -308,7 +294,7 @@ impl dyn Any+Send { /// ``` /// use std::any::Any; /// - /// fn modify_if_u32(s: &mut (Any + Send)) { + /// fn modify_if_u32(s: &mut (dyn Any + Send)) { /// if let Some(num) = s.downcast_mut::() { /// *num = 42; /// } @@ -340,7 +326,7 @@ impl dyn Any+Send+Sync { /// ``` /// use std::any::Any; /// - /// fn is_string(s: &(Any + Send + Sync)) { + /// fn is_string(s: &(dyn Any + Send + Sync)) { /// if s.is::() { /// println!("It's a string!"); /// } else { @@ -366,7 +352,7 @@ impl dyn Any+Send+Sync { /// ``` /// use std::any::Any; /// - /// fn print_if_string(s: &(Any + Send + Sync)) { + /// fn print_if_string(s: &(dyn Any + Send + Sync)) { /// if let Some(string) = s.downcast_ref::() { /// println!("It's a string({}): '{}'", string.len(), string); /// } else { @@ -392,7 +378,7 @@ impl dyn Any+Send+Sync { /// ``` /// use std::any::Any; /// - /// fn modify_if_u32(s: &mut (Any + Send + Sync)) { + /// fn modify_if_u32(s: &mut (dyn Any + Send + Sync)) { /// if let Some(num) = s.downcast_mut::() { /// *num = 42; /// } diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 3d24f8902bd..3a27a39af4a 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementations of things like `Eq` for fixed-length arrays //! up to a certain length. Eventually we should able to generalize //! to all lengths. @@ -148,6 +138,15 @@ macro_rules! array_impls { } } + #[unstable(feature = "try_from", issue = "33417")] + impl<'a, T> TryFrom<&'a [T]> for [T; $N] where T: Copy { + type Error = TryFromSliceError; + + fn try_from(slice: &[T]) -> Result<[T; $N], TryFromSliceError> { + <&Self>::try_from(slice).map(|r| *r) + } + } + #[unstable(feature = "try_from", issue = "33417")] impl<'a, T> TryFrom<&'a [T]> for &'a [T; $N] { type Error = TryFromSliceError; diff --git a/src/libcore/ascii.rs b/src/libcore/ascii.rs index 6ee91e0b22f..7a06aa2b0d3 100644 --- a/src/libcore/ascii.rs +++ b/src/libcore/ascii.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Operations on ASCII strings and characters. //! //! Most string operations in Rust act on UTF-8 strings. However, at times it diff --git a/src/libcore/benches/any.rs b/src/libcore/benches/any.rs index f4f01eb1cf5..ceb507aad38 100644 --- a/src/libcore/benches/any.rs +++ b/src/libcore/benches/any.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::any::*; use test::{Bencher, black_box}; diff --git a/src/libcore/benches/char/methods.rs b/src/libcore/benches/char/methods.rs index faf820d871c..af934c11715 100644 --- a/src/libcore/benches/char/methods.rs +++ b/src/libcore/benches/char/methods.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use test::Bencher; const CHARS: [char; 9] = ['0', 'x', '2', '5', 'A', 'f', '7', '8', '9']; diff --git a/src/libcore/benches/char/mod.rs b/src/libcore/benches/char/mod.rs index a656e82cb61..9ca51a76847 100644 --- a/src/libcore/benches/char/mod.rs +++ b/src/libcore/benches/char/mod.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod methods; diff --git a/src/libcore/benches/fmt.rs b/src/libcore/benches/fmt.rs new file mode 100644 index 00000000000..92f10c760c6 --- /dev/null +++ b/src/libcore/benches/fmt.rs @@ -0,0 +1,110 @@ +use std::io::{self, Write as IoWrite}; +use std::fmt::{self, Write as FmtWrite}; +use test::Bencher; + +#[bench] +fn write_vec_value(bh: &mut Bencher) { + bh.iter(|| { + let mut mem = Vec::new(); + for _ in 0..1000 { + mem.write_all("abc".as_bytes()).unwrap(); + } + }); +} + +#[bench] +fn write_vec_ref(bh: &mut Bencher) { + bh.iter(|| { + let mut mem = Vec::new(); + let wr = &mut mem as &mut dyn io::Write; + for _ in 0..1000 { + wr.write_all("abc".as_bytes()).unwrap(); + } + }); +} + +#[bench] +fn write_vec_macro1(bh: &mut Bencher) { + bh.iter(|| { + let mut mem = Vec::new(); + let wr = &mut mem as &mut dyn io::Write; + for _ in 0..1000 { + write!(wr, "abc").unwrap(); + } + }); +} + +#[bench] +fn write_vec_macro2(bh: &mut Bencher) { + bh.iter(|| { + let mut mem = Vec::new(); + let wr = &mut mem as &mut dyn io::Write; + for _ in 0..1000 { + write!(wr, "{}", "abc").unwrap(); + } + }); +} + +#[bench] +fn write_vec_macro_debug(bh: &mut Bencher) { + bh.iter(|| { + let mut mem = Vec::new(); + let wr = &mut mem as &mut dyn io::Write; + for _ in 0..1000 { + write!(wr, "{:?}", "☃").unwrap(); + } + }); +} + +#[bench] +fn write_str_value(bh: &mut Bencher) { + bh.iter(|| { + let mut mem = String::new(); + for _ in 0..1000 { + mem.write_str("abc").unwrap(); + } + }); +} + +#[bench] +fn write_str_ref(bh: &mut Bencher) { + bh.iter(|| { + let mut mem = String::new(); + let wr = &mut mem as &mut dyn fmt::Write; + for _ in 0..1000 { + wr.write_str("abc").unwrap(); + } + }); +} + +#[bench] +fn write_str_macro1(bh: &mut Bencher) { + bh.iter(|| { + let mut mem = String::new(); + for _ in 0..1000 { + write!(mem, "abc").unwrap(); + } + }); +} + +#[bench] +fn write_str_macro2(bh: &mut Bencher) { + bh.iter(|| { + let mut mem = String::new(); + let wr = &mut mem as &mut dyn fmt::Write; + for _ in 0..1000 { + write!(wr, "{}", "abc").unwrap(); + } + }); +} + +#[bench] +fn write_str_macro_debug(bh: &mut Bencher) { + bh.iter(|| { + let mut mem = String::new(); + let wr = &mut mem as &mut dyn fmt::Write; + for _ in 0..1000 { + write!(wr, "{:?}", "☃").unwrap(); + } + }); +} diff --git a/src/libcore/benches/hash/mod.rs b/src/libcore/benches/hash/mod.rs index 55d9e3e0913..4f2e152b695 100644 --- a/src/libcore/benches/hash/mod.rs +++ b/src/libcore/benches/hash/mod.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod sip; diff --git a/src/libcore/benches/hash/sip.rs b/src/libcore/benches/hash/sip.rs index 3379c85bbec..5baba42763e 100644 --- a/src/libcore/benches/hash/sip.rs +++ b/src/libcore/benches/hash/sip.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(deprecated)] use core::hash::*; diff --git a/src/libcore/benches/iter.rs b/src/libcore/benches/iter.rs index 6c597301ac2..fe852e42b5c 100644 --- a/src/libcore/benches/iter.rs +++ b/src/libcore/benches/iter.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::iter::*; use test::{Bencher, black_box}; @@ -282,6 +272,12 @@ bench_sums! { (0i64..1000000).chain(1000000..).take_while(|&x| x < 1111111) } +bench_sums! { + bench_cycle_take_sum, + bench_cycle_take_ref_sum, + (0i64..10000).cycle().take(1000000) +} + // Checks whether Skip> is as fast as Zip, Skip>, from // https://users.rust-lang.org/t/performance-difference-between-iterator-zip-and-skip-order/15743 #[bench] diff --git a/src/libcore/benches/lib.rs b/src/libcore/benches/lib.rs index d44f1577d56..48572af611a 100644 --- a/src/libcore/benches/lib.rs +++ b/src/libcore/benches/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(flt2dec)] #![feature(test)] @@ -21,3 +11,4 @@ mod iter; mod num; mod ops; mod slice; +mod fmt; diff --git a/src/libcore/benches/num/dec2flt/mod.rs b/src/libcore/benches/num/dec2flt/mod.rs index 562866e1177..561a4bee87a 100644 --- a/src/libcore/benches/num/dec2flt/mod.rs +++ b/src/libcore/benches/num/dec2flt/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::f64; use test::Bencher; diff --git a/src/libcore/benches/num/flt2dec/mod.rs b/src/libcore/benches/num/flt2dec/mod.rs index 7f3b98a1c76..4153745d042 100644 --- a/src/libcore/benches/num/flt2dec/mod.rs +++ b/src/libcore/benches/num/flt2dec/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod strategy { mod dragon; mod grisu; diff --git a/src/libcore/benches/num/flt2dec/strategy/dragon.rs b/src/libcore/benches/num/flt2dec/strategy/dragon.rs index 6824cf40ed2..60660b1da11 100644 --- a/src/libcore/benches/num/flt2dec/strategy/dragon.rs +++ b/src/libcore/benches/num/flt2dec/strategy/dragon.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::{i16, f64}; use super::super::*; use core::num::flt2dec::strategy::dragon::*; diff --git a/src/libcore/benches/num/flt2dec/strategy/grisu.rs b/src/libcore/benches/num/flt2dec/strategy/grisu.rs index 82e1a858fca..841feba50dd 100644 --- a/src/libcore/benches/num/flt2dec/strategy/grisu.rs +++ b/src/libcore/benches/num/flt2dec/strategy/grisu.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::{i16, f64}; use super::super::*; use core::num::flt2dec::strategy::grisu::*; diff --git a/src/libcore/benches/num/mod.rs b/src/libcore/benches/num/mod.rs index 55f0bdb57ec..f5c49ea5bf0 100644 --- a/src/libcore/benches/num/mod.rs +++ b/src/libcore/benches/num/mod.rs @@ -1,12 +1,107 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod flt2dec; mod dec2flt; + +use test::Bencher; +use std::str::FromStr; + +const ASCII_NUMBERS: [&str; 19] = [ + "0", + "1", + "2", + "43", + "765", + "76567", + "987245987", + "-4aa32", + "1786235", + "8723095", + "f##5s", + "83638730", + "-2345", + "562aa43", + "-1", + "-0", + "abc", + "xyz", + "c0ffee", +]; + +macro_rules! from_str_bench { + ($mac:ident, $t:ty) => ( + #[bench] + fn $mac(b: &mut Bencher) { + b.iter(|| { + ASCII_NUMBERS + .iter() + .cycle() + .take(5_000) + .filter_map(|s| <($t)>::from_str(s).ok()) + .max() + }) + } + ) +} + +macro_rules! from_str_radix_bench { + ($mac:ident, $t:ty, $radix:expr) => ( + #[bench] + fn $mac(b: &mut Bencher) { + b.iter(|| { + ASCII_NUMBERS + .iter() + .cycle() + .take(5_000) + .filter_map(|s| <($t)>::from_str_radix(s, $radix).ok()) + .max() + }) + } + ) +} + +from_str_bench!(bench_u8_from_str, u8); +from_str_radix_bench!(bench_u8_from_str_radix_2, u8, 2); +from_str_radix_bench!(bench_u8_from_str_radix_10, u8, 10); +from_str_radix_bench!(bench_u8_from_str_radix_16, u8, 16); +from_str_radix_bench!(bench_u8_from_str_radix_36, u8, 36); + +from_str_bench!(bench_u16_from_str, u16); +from_str_radix_bench!(bench_u16_from_str_radix_2, u16, 2); +from_str_radix_bench!(bench_u16_from_str_radix_10, u16, 10); +from_str_radix_bench!(bench_u16_from_str_radix_16, u16, 16); +from_str_radix_bench!(bench_u16_from_str_radix_36, u16, 36); + +from_str_bench!(bench_u32_from_str, u32); +from_str_radix_bench!(bench_u32_from_str_radix_2, u32, 2); +from_str_radix_bench!(bench_u32_from_str_radix_10, u32, 10); +from_str_radix_bench!(bench_u32_from_str_radix_16, u32, 16); +from_str_radix_bench!(bench_u32_from_str_radix_36, u32, 36); + +from_str_bench!(bench_u64_from_str, u64); +from_str_radix_bench!(bench_u64_from_str_radix_2, u64, 2); +from_str_radix_bench!(bench_u64_from_str_radix_10, u64, 10); +from_str_radix_bench!(bench_u64_from_str_radix_16, u64, 16); +from_str_radix_bench!(bench_u64_from_str_radix_36, u64, 36); + +from_str_bench!(bench_i8_from_str, i8); +from_str_radix_bench!(bench_i8_from_str_radix_2, i8, 2); +from_str_radix_bench!(bench_i8_from_str_radix_10, i8, 10); +from_str_radix_bench!(bench_i8_from_str_radix_16, i8, 16); +from_str_radix_bench!(bench_i8_from_str_radix_36, i8, 36); + +from_str_bench!(bench_i16_from_str, i16); +from_str_radix_bench!(bench_i16_from_str_radix_2, i16, 2); +from_str_radix_bench!(bench_i16_from_str_radix_10, i16, 10); +from_str_radix_bench!(bench_i16_from_str_radix_16, i16, 16); +from_str_radix_bench!(bench_i16_from_str_radix_36, i16, 36); + +from_str_bench!(bench_i32_from_str, i32); +from_str_radix_bench!(bench_i32_from_str_radix_2, i32, 2); +from_str_radix_bench!(bench_i32_from_str_radix_10, i32, 10); +from_str_radix_bench!(bench_i32_from_str_radix_16, i32, 16); +from_str_radix_bench!(bench_i32_from_str_radix_36, i32, 36); + +from_str_bench!(bench_i64_from_str, i64); +from_str_radix_bench!(bench_i64_from_str_radix_2, i64, 2); +from_str_radix_bench!(bench_i64_from_str_radix_10, i64, 10); +from_str_radix_bench!(bench_i64_from_str_radix_16, i64, 16); +from_str_radix_bench!(bench_i64_from_str_radix_36, i64, 36); diff --git a/src/libcore/benches/ops.rs b/src/libcore/benches/ops.rs index 7f36a4b0771..80649f33562 100644 --- a/src/libcore/benches/ops.rs +++ b/src/libcore/benches/ops.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::ops::*; use test::Bencher; diff --git a/src/libcore/benches/slice.rs b/src/libcore/benches/slice.rs index b2fc74544f1..484753c1a04 100644 --- a/src/libcore/benches/slice.rs +++ b/src/libcore/benches/slice.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use test::black_box; use test::Bencher; diff --git a/src/libcore/borrow.rs b/src/libcore/borrow.rs index 84d4b217841..89668dc0650 100644 --- a/src/libcore/borrow.rs +++ b/src/libcore/borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A module for working with borrowed data. #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index d8d51f53377..d57ca13a334 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Shareable mutable containers. //! //! Rust memory safety is based on this rule: Given an object `T`, it is only possible to @@ -97,7 +87,7 @@ //! ## Implementation details of logically-immutable methods //! //! Occasionally it may be desirable not to expose in an API that there is mutation happening -//! "under the hood". This may be because logically the operation is immutable, but e.g. caching +//! "under the hood". This may be because logically the operation is immutable, but e.g., caching //! forces the implementation to perform mutation; or because you must employ mutation to implement //! a trait method that was originally defined to take `&self`. //! @@ -1227,7 +1217,7 @@ impl fmt::Display for Ref<'_, T> { } impl<'b, T: ?Sized> RefMut<'b, T> { - /// Make a new `RefMut` for a component of the borrowed data, e.g. an enum + /// Make a new `RefMut` for a component of the borrowed data, e.g., an enum /// variant. /// /// The `RefCell` is already mutably borrowed, so this cannot fail. diff --git a/src/libcore/char/convert.rs b/src/libcore/char/convert.rs index e9ccdd0ea3c..4a1a236b669 100644 --- a/src/libcore/char/convert.rs +++ b/src/libcore/char/convert.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Character conversions. use convert::TryFrom; @@ -19,7 +9,7 @@ use super::MAX; /// Converts a `u32` to a `char`. /// /// Note that all [`char`]s are valid [`u32`]s, and can be cast to one with -/// [`as`]: +/// `as`: /// /// ``` /// let c = '💯'; @@ -34,7 +24,6 @@ use super::MAX; /// /// [`char`]: ../../std/primitive.char.html /// [`u32`]: ../../std/primitive.u32.html -/// [`as`]: ../../book/first-edition/casting-between-types.html#as /// /// For an unsafe version of this function which ignores these checks, see /// [`from_u32_unchecked`]. @@ -71,7 +60,7 @@ pub fn from_u32(i: u32) -> Option { /// Converts a `u32` to a `char`, ignoring validity. /// /// Note that all [`char`]s are valid [`u32`]s, and can be cast to one with -/// [`as`]: +/// `as`: /// /// ``` /// let c = '💯'; @@ -86,7 +75,6 @@ pub fn from_u32(i: u32) -> Option { /// /// [`char`]: ../../std/primitive.char.html /// [`u32`]: ../../std/primitive.u32.html -/// [`as`]: ../../book/first-edition/casting-between-types.html#as /// /// # Safety /// diff --git a/src/libcore/char/decode.rs b/src/libcore/char/decode.rs index cc52f048b89..510c46cdca0 100644 --- a/src/libcore/char/decode.rs +++ b/src/libcore/char/decode.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! UTF-8 and UTF-16 decoding iterators use fmt; diff --git a/src/libcore/char/methods.rs b/src/libcore/char/methods.rs index d6fcff644ac..fbc9a4a6b8e 100644 --- a/src/libcore/char/methods.rs +++ b/src/libcore/char/methods.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! impl char {} use slice; diff --git a/src/libcore/char/mod.rs b/src/libcore/char/mod.rs index 7e1313747ee..15e153bdfad 100644 --- a/src/libcore/char/mod.rs +++ b/src/libcore/char/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A character type. //! //! The `char` type represents a single character. More specifically, since @@ -131,7 +121,7 @@ pub struct EscapeUnicode { state: EscapeUnicodeState, // The index of the next hex digit to be printed (0 if none), - // i.e. the number of remaining hex digits to be printed; + // i.e., the number of remaining hex digits to be printed; // increasing from the least significant digit: 0x543210 hex_digit_idx: usize, } diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index 46bb580dcdd..ed90b7de264 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -1,19 +1,9 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The `Clone` trait for types that cannot be 'implicitly copied'. //! //! In Rust, some simple types are "implicitly copyable" and when you //! assign them or pass them as arguments, the receiver will get a copy, //! leaving the original value in place. These types do not require -//! allocation to copy and do not have finalizers (i.e. they do not +//! allocation to copy and do not have finalizers (i.e., they do not //! contain owned boxes or implement [`Drop`]), so the compiler considers //! them cheap and safe to copy. For other types copies must be made //! explicitly, by convention implementing the [`Clone`] trait and calling @@ -63,6 +53,17 @@ /// This trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d /// implementation of [`clone`] calls [`clone`] on each field. /// +/// For a generic struct, `#[derive]` implements `Clone` conditionally by adding bound `Clone` on +/// generic parameters. +/// +/// ``` +/// // `derive` implements Clone for Reading when T is Clone. +/// #[derive(Clone)] +/// struct Reading { +/// frequency: T, +/// } +/// ``` +/// /// ## How can I implement `Clone`? /// /// Types that are [`Copy`] should have a trivial implementation of `Clone`. More formally: @@ -70,21 +71,21 @@ /// Manual implementations should be careful to uphold this invariant; however, unsafe code /// must not rely on it to ensure memory safety. /// -/// An example is an array holding more than 32 elements of a type that is `Clone`; the standard -/// library only implements `Clone` up until arrays of size 32. In this case, the implementation of -/// `Clone` cannot be `derive`d, but can be implemented as: +/// An example is a generic struct holding a function pointer. In this case, the +/// implementation of `Clone` cannot be `derive`d, but can be implemented as: /// /// [`Copy`]: ../../std/marker/trait.Copy.html /// [`clone`]: trait.Clone.html#tymethod.clone /// /// ``` -/// #[derive(Copy)] -/// struct Stats { -/// frequencies: [i32; 100], -/// } +/// struct Generate(fn() -> T); +/// +/// impl Copy for Generate {} /// -/// impl Clone for Stats { -/// fn clone(&self) -> Stats { *self } +/// impl Clone for Generate { +/// fn clone(&self) -> Self { +/// *self +/// } /// } /// ``` /// @@ -93,10 +94,10 @@ /// In addition to the [implementors listed below][impls], /// the following types also implement `Clone`: /// -/// * Function item types (i.e. the distinct types defined for each function) -/// * Function pointer types (e.g. `fn() -> i32`) -/// * Array types, for all sizes, if the item type also implements `Clone` (e.g. `[i32; 123456]`) -/// * Tuple types, if each component also implements `Clone` (e.g. `()`, `(i32, bool)`) +/// * Function item types (i.e., the distinct types defined for each function) +/// * Function pointer types (e.g., `fn() -> i32`) +/// * Array types, for all sizes, if the item type also implements `Clone` (e.g., `[i32; 123456]`) +/// * Tuple types, if each component also implements `Clone` (e.g., `()`, `(i32, bool)`) /// * Closure types, if they capture no value from the environment /// or if all such captured values implement `Clone` themselves. /// Note that variables captured by shared reference always implement `Clone` diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 33881de3052..d43a5c1032c 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -1,37 +1,22 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Functionality for ordering and comparison. //! -//! This module defines both [`PartialOrd`] and [`PartialEq`] traits which are used -//! by the compiler to implement comparison operators. Rust programs may -//! implement [`PartialOrd`] to overload the `<`, `<=`, `>`, and `>=` operators, -//! and may implement [`PartialEq`] to overload the `==` and `!=` operators. -//! -//! [`PartialOrd`]: trait.PartialOrd.html -//! [`PartialEq`]: trait.PartialEq.html -//! -//! # Examples +//! This module contains various tools for ordering and comparing values. In +//! summary: //! -//! ``` -//! let x: u32 = 0; -//! let y: u32 = 1; +//! * [`Eq`] and [`PartialEq`] are traits that allow you to define total and +//! partial equality between values, respectively. Implementing them overloads +//! the `==` and `!=` operators. +//! * [`Ord`] and [`PartialOrd`] are traits that allow you to define total and +//! partial orderings between values, respectively. Implementing them overloads +//! the `<`, `<=`, `>`, and `>=` operators. +//! * [`Ordering`][cmp::Ordering] is an enum returned by the +//! main functions of [`Ord`] and [`PartialOrd`], and describes an ordering. +//! * [`Reverse`][cmp::Reverse] is a struct that allows you to easily reverse +//! an ordering. +//! * [`max`][cmp::max] and [`min`][cmp::min] are functions that build off of +//! [`Ord`] and allow you to find the maximum or minimum of two values. //! -//! // these two lines are equivalent -//! assert_eq!(x < y, true); -//! assert_eq!(x.lt(&y), true); -//! -//! // these two lines are also equivalent -//! assert_eq!(x == y, false); -//! assert_eq!(x.eq(&y), false); -//! ``` +//! For more details, see the respective documentation of each item in the list. #![stable(feature = "rust1", since = "1.0.0")] @@ -106,6 +91,8 @@ use self::Ordering::*; /// For example, let's tweak our previous code a bit: /// /// ``` +/// // The derive implements == comparisons +/// #[derive(PartialEq)] /// enum BookFormat { /// Paperback, /// Hardback, @@ -117,31 +104,34 @@ use self::Ordering::*; /// format: BookFormat, /// } /// +/// // Implement == comparisons /// impl PartialEq for Book { /// fn eq(&self, other: &BookFormat) -> bool { -/// match (&self.format, other) { -/// (BookFormat::Paperback, BookFormat::Paperback) => true, -/// (BookFormat::Hardback, BookFormat::Hardback) => true, -/// (BookFormat::Ebook, BookFormat::Ebook) => true, -/// (_, _) => false, -/// } +/// self.format == *other +/// } +/// } +/// +/// // Implement == comparisons +/// impl PartialEq for BookFormat { +/// fn eq(&self, other: &Book) -> bool { +/// *self == other.format /// } /// } /// /// let b1 = Book { isbn: 3, format: BookFormat::Paperback }; /// /// assert!(b1 == BookFormat::Paperback); -/// assert!(b1 != BookFormat::Ebook); +/// assert!(BookFormat::Ebook != b1); /// ``` /// /// By changing `impl PartialEq for Book` to `impl PartialEq for Book`, -/// we've changed what type we can use on the right side of the `==` operator. -/// This lets us use it in the `assert!` statements at the bottom. +/// we allow `BookFormat`s to be compared with `Book`s. /// /// You can also combine these implementations to let the `==` operator work with /// two different types: /// /// ``` +/// #[derive(PartialEq)] /// enum BookFormat { /// Paperback, /// Hardback, @@ -155,12 +145,13 @@ use self::Ordering::*; /// /// impl PartialEq for Book { /// fn eq(&self, other: &BookFormat) -> bool { -/// match (&self.format, other) { -/// (&BookFormat::Paperback, &BookFormat::Paperback) => true, -/// (&BookFormat::Hardback, &BookFormat::Hardback) => true, -/// (&BookFormat::Ebook, &BookFormat::Ebook) => true, -/// (_, _) => false, -/// } +/// self.format == *other +/// } +/// } +/// +/// impl PartialEq for BookFormat { +/// fn eq(&self, other: &Book) -> bool { +/// *self == other.format /// } /// } /// @@ -174,7 +165,7 @@ use self::Ordering::*; /// let b2 = Book { isbn: 3, format: BookFormat::Ebook }; /// /// assert!(b1 == BookFormat::Paperback); -/// assert!(b1 != BookFormat::Ebook); +/// assert!(BookFormat::Ebook != b1); /// assert!(b1 == b2); /// ``` /// @@ -482,9 +473,11 @@ impl Ord for Reverse { /// Then you must define an implementation for `cmp()`. You may find it useful to use /// `cmp()` on your type's fields. /// -/// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must* agree with each other. It's -/// easy to accidentally make them disagree by deriving some of the traits and manually -/// implementing others. +/// Implementations of `PartialEq`, `PartialOrd`, and `Ord` *must* +/// agree with each other. That is, `a.cmp(b) == Ordering::Equal` if +/// and only if `a == b` and `Some(a.cmp(b)) == a.partial_cmp(b)` for +/// all `a` and `b`. It's easy to accidentally make them disagree by +/// deriving some of the traits and manually implementing others. /// /// Here's an example where you want to sort people by height only, disregarding `id` /// and `name`: diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index dbc28ef7cf6..203be541e49 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Traits for conversions between types. //! //! The traits in this module provide a general way to talk about conversions @@ -65,7 +55,6 @@ /// Using `identity` to do nothing among other interesting functions: /// /// ```rust -/// #![feature(convert_id)] /// use std::convert::identity; /// /// fn manipulation(x: u32) -> u32 { @@ -79,7 +68,6 @@ /// Using `identity` to get a function that changes nothing in a conditional: /// /// ```rust -/// #![feature(convert_id)] /// use std::convert::identity; /// /// # let condition = true; @@ -96,14 +84,13 @@ /// Using `identity` to keep the `Some` variants of an iterator of `Option`: /// /// ```rust -/// #![feature(convert_id)] /// use std::convert::identity; /// /// let iter = vec![Some(1), None, Some(3)].into_iter(); /// let filtered = iter.filter_map(identity).collect::>(); /// assert_eq!(vec![1, 3], filtered); /// ``` -#[unstable(feature = "convert_id", issue = "53500")] +#[stable(feature = "convert_id", since = "1.33.0")] #[inline] pub const fn identity(x: T) -> T { x } @@ -327,7 +314,8 @@ pub trait Into: Sized { /// An example usage for error handling: /// /// ``` -/// use std::io::{self, Read}; +/// use std::fs; +/// use std::io; /// use std::num; /// /// enum CliError { @@ -348,9 +336,7 @@ pub trait Into: Sized { /// } /// /// fn open_and_parse_file(file_name: &str) -> Result { -/// let mut file = std::fs::File::open("test")?; -/// let mut contents = String::new(); -/// file.read_to_string(&mut contents)?; +/// let mut contents = fs::read_to_string(&file_name)?; /// let num: i32 = contents.trim().parse()?; /// Ok(num) /// } @@ -477,11 +463,11 @@ impl TryInto for T where U: TryFrom // Infallible conversions are semantically equivalent to fallible conversions // with an uninhabited error type. #[unstable(feature = "try_from", issue = "33417")] -impl TryFrom for T where T: From { +impl TryFrom for T where U: Into { type Error = !; fn try_from(value: U) -> Result { - Ok(T::from(value)) + Ok(U::into(value)) } } diff --git a/src/libcore/default.rs b/src/libcore/default.rs index 638acebd617..0e47c2fd0b5 100644 --- a/src/libcore/default.rs +++ b/src/libcore/default.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The `Default` trait for types which may have meaningful default values. #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/ffi.rs b/src/libcore/ffi.rs index a03756f9c22..644380c69f2 100644 --- a/src/libcore/ffi.rs +++ b/src/libcore/ffi.rs @@ -12,24 +12,27 @@ use ::fmt; /// and `*mut c_void` is equivalent to C's `void*`. That said, this is /// *not* the same as C's `void` return type, which is Rust's `()` type. /// -/// Ideally, this type would be equivalent to [`!`], but currently it may -/// be more ideal to use `c_void` for FFI purposes. +/// To model pointers to opaque types in FFI, until `extern type` is +/// stabilized, it is recommended to use a newtype wrapper around an empty +/// byte array. See the [Nomicon] for details. /// -/// [`!`]: ../../std/primitive.never.html /// [pointer]: ../../std/primitive.pointer.html -// NB: For LLVM to recognize the void pointer type and by extension +/// [Nomicon]: https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs +// N.B., for LLVM to recognize the void pointer type and by extension // functions like malloc(), we need to have it represented as i8* in // LLVM bitcode. The enum used here ensures this and prevents misuse -// of the "raw" type by only having private variants.. We need two +// of the "raw" type by only having private variants. We need two // variants, because the compiler complains about the repr attribute -// otherwise. +// otherwise and we need at least one variant as otherwise the enum +// would be uninhabited and at least dereferencing such pointers would +// be UB. #[repr(u8)] #[stable(feature = "raw_os", since = "1.1.0")] pub enum c_void { - #[unstable(feature = "c_void_variant", reason = "should not have to exist", + #[unstable(feature = "c_void_variant", reason = "temporary implementation detail", issue = "0")] #[doc(hidden)] __variant1, - #[unstable(feature = "c_void_variant", reason = "should not have to exist", + #[unstable(feature = "c_void_variant", reason = "temporary implementation detail", issue = "0")] #[doc(hidden)] __variant2, } @@ -40,3 +43,186 @@ impl fmt::Debug for c_void { f.pad("c_void") } } + +/// Basic implementation of a `va_list`. +#[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), + not(target_arch = "x86_64")), + all(target_arch = "aarch4", target_os = "ios"), + windows))] +#[unstable(feature = "c_variadic", + reason = "the `c_variadic` feature has not been properly tested on \ + all supported platforms", + issue = "44930")] +extern { + type VaListImpl; +} + +#[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), + not(target_arch = "x86_64")), + windows))] +impl fmt::Debug for VaListImpl { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "va_list* {:p}", self) + } +} + +/// AArch64 ABI implementation of a `va_list`. See the +/// [Aarch64 Procedure Call Standard] for more details. +/// +/// [AArch64 Procedure Call Standard]: +/// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf +#[cfg(all(target_arch = "aarch64", not(windows)))] +#[repr(C)] +#[derive(Debug)] +#[unstable(feature = "c_variadic", + reason = "the `c_variadic` feature has not been properly tested on \ + all supported platforms", + issue = "44930")] +struct VaListImpl { + stack: *mut (), + gr_top: *mut (), + vr_top: *mut (), + gr_offs: i32, + vr_offs: i32, +} + +/// PowerPC ABI implementation of a `va_list`. +#[cfg(all(target_arch = "powerpc", not(windows)))] +#[repr(C)] +#[derive(Debug)] +#[unstable(feature = "c_variadic", + reason = "the `c_variadic` feature has not been properly tested on \ + all supported platforms", + issue = "44930")] +struct VaListImpl { + gpr: u8, + fpr: u8, + reserved: u16, + overflow_arg_area: *mut (), + reg_save_area: *mut (), +} + +/// x86_64 ABI implementation of a `va_list`. +#[cfg(all(target_arch = "x86_64", not(windows)))] +#[repr(C)] +#[derive(Debug)] +#[unstable(feature = "c_variadic", + reason = "the `c_variadic` feature has not been properly tested on \ + all supported platforms", + issue = "44930")] +struct VaListImpl { + gp_offset: i32, + fp_offset: i32, + overflow_arg_area: *mut (), + reg_save_area: *mut (), +} + +/// A wrapper for a `va_list` +#[lang = "va_list"] +#[derive(Debug)] +#[unstable(feature = "c_variadic", + reason = "the `c_variadic` feature has not been properly tested on \ + all supported platforms", + issue = "44930")] +#[repr(transparent)] +pub struct VaList<'a>(&'a mut VaListImpl); + +// The VaArgSafe trait needs to be used in public interfaces, however, the trait +// itself must not be allowed to be used outside this module. Allowing users to +// implement the trait for a new type (thereby allowing the va_arg intrinsic to +// be used on a new type) is likely to cause undefined behavior. +// +// FIXME(dlrobertson): In order to use the VaArgSafe trait in a public interface +// but also ensure it cannot be used elsewhere, the trait needs to be public +// within a private module. Once RFC 2145 has been implemented look into +// improving this. +mod sealed_trait { + /// Trait which whitelists the allowed types to be used with [VaList::arg] + /// + /// [VaList::va_arg]: struct.VaList.html#method.arg + #[unstable(feature = "c_variadic", + reason = "the `c_variadic` feature has not been properly tested on \ + all supported platforms", + issue = "44930")] + pub trait VaArgSafe {} +} + +macro_rules! impl_va_arg_safe { + ($($t:ty),+) => { + $( + #[unstable(feature = "c_variadic", + reason = "the `c_variadic` feature has not been properly tested on \ + all supported platforms", + issue = "44930")] + impl sealed_trait::VaArgSafe for $t {} + )+ + } +} + +impl_va_arg_safe!{i8, i16, i32, i64, usize} +impl_va_arg_safe!{u8, u16, u32, u64, isize} +impl_va_arg_safe!{f64} + +#[unstable(feature = "c_variadic", + reason = "the `c_variadic` feature has not been properly tested on \ + all supported platforms", + issue = "44930")] +impl sealed_trait::VaArgSafe for *mut T {} +#[unstable(feature = "c_variadic", + reason = "the `c_variadic` feature has not been properly tested on \ + all supported platforms", + issue = "44930")] +impl sealed_trait::VaArgSafe for *const T {} + +impl<'a> VaList<'a> { + /// Advance to the next arg. + #[unstable(feature = "c_variadic", + reason = "the `c_variadic` feature has not been properly tested on \ + all supported platforms", + issue = "44930")] + pub unsafe fn arg(&mut self) -> T { + va_arg(self) + } + + /// Copy the `va_list` at the current location. + #[unstable(feature = "c_variadic", + reason = "the `c_variadic` feature has not been properly tested on \ + all supported platforms", + issue = "44930")] + pub unsafe fn copy(&self, f: F) -> R + where F: for<'copy> FnOnce(VaList<'copy>) -> R { + #[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), + not(target_arch = "x86_64")), + all(target_arch = "aarch4", target_os = "ios"), + windows))] + let mut ap = va_copy(self); + #[cfg(all(any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"), + not(windows)))] + let mut ap_inner = va_copy(self); + #[cfg(all(any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"), + not(windows)))] + let mut ap = VaList(&mut ap_inner); + let ret = f(VaList(ap.0)); + va_end(&mut ap); + ret + } +} + +extern "rust-intrinsic" { + /// Destroy the arglist `ap` after initialization with `va_start` or + /// `va_copy`. + fn va_end(ap: &mut VaList); + + /// Copy the current location of arglist `src` to the arglist `dst`. + #[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"), + not(target_arch = "x86_64")), + windows))] + fn va_copy<'a>(src: &VaList<'a>) -> VaList<'a>; + #[cfg(all(any(target_arch = "aarch64", target_arch = "powerpc", target_arch = "x86_64"), + not(windows)))] + fn va_copy(src: &VaList) -> VaListImpl; + + /// Loads an argument of type `T` from the `va_list` `ap` and increment the + /// argument `ap` points to. + fn va_arg(ap: &mut VaList) -> T; +} diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index 4bc5b36d82b..2525b47f2bd 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use fmt; struct PadAdapter<'a> { diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 03e7a9a49d8..20c626cef1b 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -1,15 +1,5 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use fmt::{Formatter, Result, LowerExp, UpperExp, Display, Debug}; -use mem; +use mem::MaybeUninit; use num::flt2dec; // Don't inline this so callers don't use the stack space this function @@ -20,11 +10,14 @@ fn float_to_decimal_common_exact(fmt: &mut Formatter, num: &T, where T: flt2dec::DecodableFloat { unsafe { - let mut buf: [u8; 1024] = mem::uninitialized(); // enough for f32 and f64 - let mut parts: [flt2dec::Part; 4] = mem::uninitialized(); + let mut buf = MaybeUninit::<[u8; 1024]>::uninitialized(); // enough for f32 and f64 + let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninitialized(); + // FIXME(#53491): Technically, this is calling `get_mut` on an uninitialized + // `MaybeUninit` (here and elsewhere in this file). Revisit this once + // we decided whether that is valid or not. let formatted = flt2dec::to_exact_fixed_str(flt2dec::strategy::grisu::format_exact, *num, sign, precision, - false, &mut buf, &mut parts); + false, buf.get_mut(), parts.get_mut()); fmt.pad_formatted_parts(&formatted) } } @@ -38,10 +31,11 @@ fn float_to_decimal_common_shortest(fmt: &mut Formatter, num: &T, { unsafe { // enough for f32 and f64 - let mut buf: [u8; flt2dec::MAX_SIG_DIGITS] = mem::uninitialized(); - let mut parts: [flt2dec::Part; 4] = mem::uninitialized(); + let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninitialized(); + let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninitialized(); let formatted = flt2dec::to_shortest_str(flt2dec::strategy::grisu::format_shortest, *num, - sign, precision, false, &mut buf, &mut parts); + sign, precision, false, buf.get_mut(), + parts.get_mut()); fmt.pad_formatted_parts(&formatted) } } @@ -75,11 +69,11 @@ fn float_to_exponential_common_exact(fmt: &mut Formatter, num: &T, where T: flt2dec::DecodableFloat { unsafe { - let mut buf: [u8; 1024] = mem::uninitialized(); // enough for f32 and f64 - let mut parts: [flt2dec::Part; 6] = mem::uninitialized(); + let mut buf = MaybeUninit::<[u8; 1024]>::uninitialized(); // enough for f32 and f64 + let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninitialized(); let formatted = flt2dec::to_exact_exp_str(flt2dec::strategy::grisu::format_exact, *num, sign, precision, - upper, &mut buf, &mut parts); + upper, buf.get_mut(), parts.get_mut()); fmt.pad_formatted_parts(&formatted) } } @@ -94,11 +88,11 @@ fn float_to_exponential_common_shortest(fmt: &mut Formatter, { unsafe { // enough for f32 and f64 - let mut buf: [u8; flt2dec::MAX_SIG_DIGITS] = mem::uninitialized(); - let mut parts: [flt2dec::Part; 6] = mem::uninitialized(); + let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninitialized(); + let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninitialized(); let formatted = flt2dec::to_shortest_exp_str(flt2dec::strategy::grisu::format_shortest, *num, sign, (0, 0), upper, - &mut buf, &mut parts); + buf.get_mut(), parts.get_mut()); fmt.pad_formatted_parts(&formatted) } } diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 75ec0d7d50b..530b2f52c0d 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Utilities for formatting and printing strings. #![stable(feature = "rust1", since = "1.0.0")] @@ -201,29 +191,8 @@ pub trait Write { /// assert_eq!(&buf, "world"); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - fn write_fmt(&mut self, args: Arguments) -> Result { - // This Adapter is needed to allow `self` (of type `&mut - // Self`) to be cast to a Write (below) without - // requiring a `Sized` bound. - struct Adapter<'a,T: ?Sized +'a>(&'a mut T); - - impl Write for Adapter<'_, T> - where T: Write - { - fn write_str(&mut self, s: &str) -> Result { - self.0.write_str(s) - } - - fn write_char(&mut self, c: char) -> Result { - self.0.write_char(c) - } - - fn write_fmt(&mut self, args: Arguments) -> Result { - self.0.write_fmt(args) - } - } - - write(&mut Adapter(self), args) + fn write_fmt(mut self: &mut Self, args: Arguments) -> Result { + write(&mut self, args) } } @@ -242,9 +211,18 @@ impl Write for &mut W { } } -/// A struct to represent both where to emit formatting strings to and how they -/// should be formatted. A mutable version of this is passed to all formatting -/// traits. +/// Configuration for formatting. +/// +/// A `Formatter` represents various options related to formatting. Users do not +/// construct `Formatter`s directly; a mutable reference to one is passed to +/// the `fmt` method of all formatting traits, like [`Debug`] and [`Display`]. +/// +/// To interact with a `Formatter`, you'll call various methods to change the +/// various options related to formatting. For examples, please see the +/// documentation of the methods defined on `Formatter` below. +/// +/// [`Debug`]: trait.Debug.html +/// [`Display`]: trait.Display.html #[allow(missing_debug_implementations)] #[stable(feature = "rust1", since = "1.0.0")] pub struct Formatter<'a> { @@ -278,7 +256,7 @@ struct Void { /// family of functions. It contains a function to format the given value. At /// compile time it is ensured that the function and the value have the correct /// types, and then this struct is used to canonicalize arguments to one type. -#[derive(Copy)] +#[derive(Copy, Clone)] #[allow(missing_debug_implementations)] #[unstable(feature = "fmt_internals", reason = "internal to format_args!", issue = "0")] @@ -288,14 +266,6 @@ pub struct ArgumentV1<'a> { formatter: fn(&Void, &mut Formatter) -> Result, } -#[unstable(feature = "fmt_internals", reason = "internal to format_args!", - issue = "0")] -impl Clone for ArgumentV1<'_> { - fn clone(&self) -> Self { - *self - } -} - impl<'a> ArgumentV1<'a> { #[inline(never)] fn show_usize(x: &usize, f: &mut Formatter) -> Result { @@ -609,10 +579,15 @@ pub trait Debug { /// println!("The origin is: {}", origin); /// ``` #[rustc_on_unimplemented( + on( + _Self="std::path::Path", + label="`{Self}` cannot be formatted with the default formatter; call `.display()` on it", + note="call `.display()` or `.to_string_lossy()` to safely print paths, \ + as they may contain non-Unicode data" + ), message="`{Self}` doesn't implement `{Display}`", label="`{Self}` cannot be formatted with the default formatter", - note="in format strings you may be able to use `{{:?}}` \ - (or {{:#?}} for pretty-print) instead", + note="in format strings you may be able to use `{{:?}}` (or {{:#?}} for pretty-print) instead", )] #[doc(alias = "{}")] #[stable(feature = "rust1", since = "1.0.0")] @@ -1031,28 +1006,30 @@ pub fn write(output: &mut dyn Write, args: Arguments) -> Result { curarg: args.args.iter(), }; - let mut pieces = args.pieces.iter(); + let mut idx = 0; match args.fmt { None => { // We can use default formatting parameters for all arguments. - for (arg, piece) in args.args.iter().zip(pieces.by_ref()) { + for (arg, piece) in args.args.iter().zip(args.pieces.iter()) { formatter.buf.write_str(*piece)?; (arg.formatter)(arg.value, &mut formatter)?; + idx += 1; } } Some(fmt) => { // Every spec has a corresponding argument that is preceded by // a string piece. - for (arg, piece) in fmt.iter().zip(pieces.by_ref()) { + for (arg, piece) in fmt.iter().zip(args.pieces.iter()) { formatter.buf.write_str(*piece)?; formatter.run(arg)?; + idx += 1; } } } // There can be only one trailing string piece left. - if let Some(piece) = pieces.next() { + if let Some(piece) = args.pieces.get(idx) { formatter.buf.write_str(*piece)?; } @@ -1110,7 +1087,7 @@ impl<'a> Formatter<'a> { self.args[i].as_usize() } rt::v1::Count::NextParam => { - self.curarg.next().and_then(|arg| arg.as_usize()) + self.curarg.next()?.as_usize() } } } @@ -1176,15 +1153,15 @@ impl<'a> Formatter<'a> { sign = Some('+'); width += 1; } - let mut prefixed = false; - if self.alternate() { - prefixed = true; width += prefix.chars().count(); + let prefixed = self.alternate(); + if prefixed { + width += prefix.chars().count(); } // Writes the sign if it exists, and then the prefix if it was requested let write_prefix = |f: &mut Formatter| { if let Some(c) = sign { - f.buf.write_str(c.encode_utf8(&mut [0; 4]))?; + f.buf.write_char(c)?; } if prefixed { f.buf.write_str(prefix) } else { Ok(()) } @@ -1346,7 +1323,7 @@ impl<'a> Formatter<'a> { // remove the sign from the formatted parts formatted.sign = b""; - width = if width < sign.len() { 0 } else { width - sign.len() }; + width = width.saturating_sub(sign.len()); align = rt::v1::Alignment::Right; self.fill = '0'; self.align = rt::v1::Alignment::Right; @@ -1381,7 +1358,7 @@ impl<'a> Formatter<'a> { for part in formatted.parts { match *part { flt2dec::Part::Zero(mut nzeroes) => { - const ZEROES: &'static str = // 64 zeroes + const ZEROES: &str = // 64 zeroes "0000000000000000000000000000000000000000000000000000000000000000"; while nzeroes > ZEROES.len() { self.buf.write_str(ZEROES)?; @@ -2071,7 +2048,7 @@ macro_rules! tuple { ( $($name:ident,)+ ) => ( #[stable(feature = "rust1", since = "1.0.0")] impl<$($name:Debug),*> Debug for ($($name,)*) where last_type!($($name,)+): ?Sized { - #[allow(non_snake_case, unused_assignments, deprecated)] + #[allow(non_snake_case, unused_assignments)] fn fmt(&self, f: &mut Formatter) -> Result { let mut builder = f.debug_tuple(""); let ($(ref $name,)*) = *self; diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index 51391fa50d5..3a812337bb1 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -1,24 +1,12 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Integer and floating-point number formatting -#![allow(deprecated)] - use fmt; use ops::{Div, Rem, Sub}; use str; use slice; use ptr; -use mem; +use mem::MaybeUninit; #[doc(hidden)] trait Int: PartialEq + PartialOrd + Div + Rem + @@ -63,7 +51,7 @@ trait GenericRadix { // characters for a base 2 number. let zero = T::zero(); let is_nonnegative = x >= zero; - let mut buf: [u8; 128] = unsafe { mem::uninitialized() }; + let mut buf = uninitialized_array![u8; 128]; let mut curr = buf.len(); let base = T::from_u8(Self::BASE); if is_nonnegative { @@ -72,7 +60,7 @@ trait GenericRadix { for byte in buf.iter_mut().rev() { let n = x % base; // Get the current place value. x = x / base; // Deaccumulate the number. - *byte = Self::digit(n.to_u8()); // Store the digit in the buffer. + byte.set(Self::digit(n.to_u8())); // Store the digit in the buffer. curr -= 1; if x == zero { // No more digits left to accumulate. @@ -84,7 +72,7 @@ trait GenericRadix { for byte in buf.iter_mut().rev() { let n = zero - (x % base); // Get the current place value. x = x / base; // Deaccumulate the number. - *byte = Self::digit(n.to_u8()); // Store the digit in the buffer. + byte.set(Self::digit(n.to_u8())); // Store the digit in the buffer. curr -= 1; if x == zero { // No more digits left to accumulate. @@ -92,7 +80,11 @@ trait GenericRadix { }; } } - let buf = unsafe { str::from_utf8_unchecked(&buf[curr..]) }; + let buf = &buf[curr..]; + let buf = unsafe { str::from_utf8_unchecked(slice::from_raw_parts( + MaybeUninit::first_ptr(buf), + buf.len() + )) }; f.pad_integral(is_nonnegative, Self::PREFIX, buf) } } @@ -206,9 +198,9 @@ macro_rules! impl_Display { // convert the negative num to positive by summing 1 to it's 2 complement (!self.$conv_fn()).wrapping_add(1) }; - let mut buf: [u8; 39] = unsafe { mem::uninitialized() }; + let mut buf = uninitialized_array![u8; 39]; let mut curr = buf.len() as isize; - let buf_ptr = buf.as_mut_ptr(); + let buf_ptr = MaybeUninit::first_ptr_mut(&mut buf); let lut_ptr = DEC_DIGITS_LUT.as_ptr(); unsafe { diff --git a/src/libcore/fmt/rt/v1.rs b/src/libcore/fmt/rt/v1.rs index ec7add9c375..826ae36d2d1 100644 --- a/src/libcore/fmt/rt/v1.rs +++ b/src/libcore/fmt/rt/v1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This is an internal module used by the ifmt! runtime. These structures are //! emitted to static arrays to precompile format strings ahead of time. //! diff --git a/src/libcore/future/future.rs b/src/libcore/future/future.rs index 0c870f9e404..539b07fc21e 100644 --- a/src/libcore/future/future.rs +++ b/src/libcore/future/future.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(feature = "futures_api", reason = "futures in libcore are unstable", issue = "50547")] @@ -33,6 +23,7 @@ use task::{Poll, LocalWaker}; /// /// When using a future, you generally won't call `poll` directly, but instead /// `await!` the value. +#[must_use = "futures do nothing unless polled"] pub trait Future { /// The result of the `Future`. type Output; @@ -119,7 +110,7 @@ impl<'a, F: ?Sized + Future + Unpin> Future for &'a mut F { impl

Future for Pin

where - P: ops::DerefMut, + P: Unpin + ops::DerefMut, P::Target: Future, { type Output = <

::Target as Future>::Output; diff --git a/src/libcore/future/mod.rs b/src/libcore/future/mod.rs index 1dc4f361f3a..6693ecbac41 100644 --- a/src/libcore/future/mod.rs +++ b/src/libcore/future/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(feature = "futures_api", reason = "futures in libcore are unstable", issue = "50547")] diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index bbebadd452a..d5d29c91e03 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Generic hashing support. //! //! This module provides a generic way to compute the hash of a value. The @@ -408,7 +398,7 @@ impl Hasher for &mut H { /// A trait for creating instances of [`Hasher`]. /// -/// A `BuildHasher` is typically used (e.g. by [`HashMap`]) to create +/// A `BuildHasher` is typically used (e.g., by [`HashMap`]) to create /// [`Hasher`]s for each key such that they are hashed independently of one /// another, since [`Hasher`]s contain state. /// diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index e3bdecdc4b1..18f09f4c5dd 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -1,16 +1,6 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! An implementation of SipHash. -#![allow(deprecated)] +#![allow(deprecated)] // the types in this module are deprecated use marker::PhantomData; use ptr; diff --git a/src/libcore/hint.rs b/src/libcore/hint.rs index f4e96e67b2c..ad5a2071a73 100644 --- a/src/libcore/hint.rs +++ b/src/libcore/hint.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![stable(feature = "core_hint", since = "1.27.0")] //! Hints to compiler that affects how code should be emitted or optimized. @@ -24,7 +14,7 @@ use intrinsics; /// therefore will eliminate all branches that reach to a call to /// `unreachable_unchecked()`. /// -/// Like all instances of UB, if this assumption turns out to be wrong, i.e. the +/// Like all instances of UB, if this assumption turns out to be wrong, i.e., the /// `unreachable_unchecked()` call is actually reachable among all possible /// control flow, the compiler will apply the wrong optimization strategy, and /// may sometimes even corrupt seemingly unrelated code, causing @@ -59,3 +49,26 @@ use intrinsics; pub unsafe fn unreachable_unchecked() -> ! { intrinsics::unreachable() } + +/// Save power or switch hyperthreads in a busy-wait spin-loop. +/// +/// This function is deliberately more primitive than +/// [`std::thread::yield_now`](../../std/thread/fn.yield_now.html) and +/// does not directly yield to the system's scheduler. +/// In some cases it might be useful to use a combination of both functions. +/// Careful benchmarking is advised. +/// +/// On some platforms this function may not do anything at all. +#[inline] +#[unstable(feature = "renamed_spin_loop", issue = "55002")] +pub fn spin_loop() { + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + unsafe { + asm!("pause" ::: "memory" : "volatile"); + } + + #[cfg(target_arch = "aarch64")] + unsafe { + asm!("yield" ::: "memory" : "volatile"); + } +} diff --git a/src/libcore/internal_macros.rs b/src/libcore/internal_macros.rs index db75f9bf210..d12800f7124 100644 --- a/src/libcore/internal_macros.rs +++ b/src/libcore/internal_macros.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // implements the unary operator "op &T" // based on "op T" where T is expected to be `Copy`able macro_rules! forward_ref_unop { diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 16f0299c18b..e927ed40d7f 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! rustc compiler intrinsics. //! //! The corresponding definitions are in librustc_codegen_llvm/intrinsic.rs. @@ -52,7 +42,7 @@ pub use ptr::drop_in_place; extern "rust-intrinsic" { - // NB: These intrinsics take raw pointers because they mutate aliased + // N.B., these intrinsics take raw pointers because they mutate aliased // memory, which is not valid for either `&` or `&mut`. /// Stores a value if the current value is the same as the `old` value. @@ -635,7 +625,7 @@ extern "rust-intrinsic" { /// Tells LLVM that this point in the code is not reachable, enabling /// further optimizations. /// - /// NB: This is very different from the `unreachable!()` macro: Unlike the + /// N.B., this is very different from the `unreachable!()` macro: Unlike the /// macro, which panics when it is executed, it is *undefined behavior* to /// reach code marked with this function. /// @@ -700,6 +690,10 @@ extern "rust-intrinsic" { /// crate it is invoked in. pub fn type_id() -> u64; + /// A guard for unsafe functions that cannot ever be executed if `T` is uninhabited: + /// This will statically either panic, or do nothing. + pub fn panic_if_uninhabited(); + /// Creates a value initialized to zero. /// /// `init` is unsafe because it returns a zeroed-out datum, @@ -718,7 +712,6 @@ extern "rust-intrinsic" { pub fn uninit() -> T; /// Moves a value out of scope without running drop glue. - #[cfg(not(stage0))] pub fn forget(_: T); /// Reinterprets the bits of a value of one type as another type. @@ -1354,7 +1347,7 @@ extern "rust-intrinsic" { /// use std::intrinsics::ctlz; /// /// let x = 0b0001_1100_u8; - /// let num_leading = unsafe { ctlz(x) }; + /// let num_leading = ctlz(x); /// assert_eq!(num_leading, 3); /// ``` /// @@ -1366,7 +1359,7 @@ extern "rust-intrinsic" { /// use std::intrinsics::ctlz; /// /// let x = 0u16; - /// let num_leading = unsafe { ctlz(x) }; + /// let num_leading = ctlz(x); /// assert_eq!(num_leading, 16); /// ``` pub fn ctlz(x: T) -> T; @@ -1397,7 +1390,7 @@ extern "rust-intrinsic" { /// use std::intrinsics::cttz; /// /// let x = 0b0011_1000_u8; - /// let num_trailing = unsafe { cttz(x) }; + /// let num_trailing = cttz(x); /// assert_eq!(num_trailing, 3); /// ``` /// @@ -1409,7 +1402,7 @@ extern "rust-intrinsic" { /// use std::intrinsics::cttz; /// /// let x = 0u16; - /// let num_trailing = unsafe { cttz(x) }; + /// let num_trailing = cttz(x); /// assert_eq!(num_trailing, 16); /// ``` pub fn cttz(x: T) -> T; @@ -1476,14 +1469,12 @@ extern "rust-intrinsic" { /// The stabilized versions of this intrinsic are available on the integer /// primitives via the `rotate_left` method. For example, /// [`std::u32::rotate_left`](../../std/primitive.u32.html#method.rotate_left) - #[cfg(not(stage0))] pub fn rotate_left(x: T, y: T) -> T; /// Performs rotate right. /// The stabilized versions of this intrinsic are available on the integer /// primitives via the `rotate_right` method. For example, /// [`std::u32::rotate_right`](../../std/primitive.u32.html#method.rotate_right) - #[cfg(not(stage0))] pub fn rotate_right(x: T, y: T) -> T; /// Returns (a + b) mod 2N, where N is the width of T in bits. @@ -1502,6 +1493,19 @@ extern "rust-intrinsic" { /// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul) pub fn overflowing_mul(a: T, b: T) -> T; + /// Computes `a + b`, while saturating at numeric bounds. + /// The stabilized versions of this intrinsic are available on the integer + /// primitives via the `saturating_add` method. For example, + /// [`std::u32::saturating_add`](../../std/primitive.u32.html#method.saturating_add) + #[cfg(not(stage0))] + pub fn saturating_add(a: T, b: T) -> T; + /// Computes `a - b`, while saturating at numeric bounds. + /// The stabilized versions of this intrinsic are available on the integer + /// primitives via the `saturating_sub` method. For example, + /// [`std::u32::saturating_sub`](../../std/primitive.u32.html#method.saturating_sub) + #[cfg(not(stage0))] + pub fn saturating_sub(a: T, b: T) -> T; + /// Returns the value of the discriminant for the variant in 'v', /// cast to a `u64`; if `T` has no discriminant, returns 0. pub fn discriminant_value(v: &T) -> u64; diff --git a/src/libcore/iter/adapters/chain.rs b/src/libcore/iter/adapters/chain.rs new file mode 100644 index 00000000000..573b096fb46 --- /dev/null +++ b/src/libcore/iter/adapters/chain.rs @@ -0,0 +1,260 @@ +use ops::Try; +use usize; +use super::super::{Iterator, DoubleEndedIterator, FusedIterator, TrustedLen}; + +/// An iterator that strings two iterators together. +/// +/// This `struct` is created by the [`chain`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`chain`]: trait.Iterator.html#method.chain +/// [`Iterator`]: trait.Iterator.html +#[derive(Clone, Debug)] +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Chain { + a: A, + b: B, + state: ChainState, +} +impl Chain { + pub(in super::super) fn new(a: A, b: B) -> Chain { + Chain { a, b, state: ChainState::Both } + } +} + +// The iterator protocol specifies that iteration ends with the return value +// `None` from `.next()` (or `.next_back()`) and it is unspecified what +// further calls return. The chain adaptor must account for this since it uses +// two subiterators. +// +// It uses three states: +// +// - Both: `a` and `b` are remaining +// - Front: `a` remaining +// - Back: `b` remaining +// +// The fourth state (neither iterator is remaining) only occurs after Chain has +// returned None once, so we don't need to store this state. +#[derive(Clone, Debug)] +enum ChainState { + // both front and back iterator are remaining + Both, + // only front is remaining + Front, + // only back is remaining + Back, +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Chain where + A: Iterator, + B: Iterator +{ + type Item = A::Item; + + #[inline] + fn next(&mut self) -> Option { + match self.state { + ChainState::Both => match self.a.next() { + elt @ Some(..) => elt, + None => { + self.state = ChainState::Back; + self.b.next() + } + }, + ChainState::Front => self.a.next(), + ChainState::Back => self.b.next(), + } + } + + #[inline] + #[rustc_inherit_overflow_checks] + fn count(self) -> usize { + match self.state { + ChainState::Both => self.a.count() + self.b.count(), + ChainState::Front => self.a.count(), + ChainState::Back => self.b.count(), + } + } + + fn try_fold(&mut self, init: Acc, mut f: F) -> R where + Self: Sized, F: FnMut(Acc, Self::Item) -> R, R: Try + { + let mut accum = init; + match self.state { + ChainState::Both | ChainState::Front => { + accum = self.a.try_fold(accum, &mut f)?; + if let ChainState::Both = self.state { + self.state = ChainState::Back; + } + } + _ => { } + } + if let ChainState::Back = self.state { + accum = self.b.try_fold(accum, &mut f)?; + } + Try::from_ok(accum) + } + + fn fold(self, init: Acc, mut f: F) -> Acc + where F: FnMut(Acc, Self::Item) -> Acc, + { + let mut accum = init; + match self.state { + ChainState::Both | ChainState::Front => { + accum = self.a.fold(accum, &mut f); + } + _ => { } + } + match self.state { + ChainState::Both | ChainState::Back => { + accum = self.b.fold(accum, &mut f); + } + _ => { } + } + accum + } + + #[inline] + fn nth(&mut self, mut n: usize) -> Option { + match self.state { + ChainState::Both | ChainState::Front => { + for x in self.a.by_ref() { + if n == 0 { + return Some(x) + } + n -= 1; + } + if let ChainState::Both = self.state { + self.state = ChainState::Back; + } + } + ChainState::Back => {} + } + if let ChainState::Back = self.state { + self.b.nth(n) + } else { + None + } + } + + #[inline] + fn find

(&mut self, mut predicate: P) -> Option where + P: FnMut(&Self::Item) -> bool, + { + match self.state { + ChainState::Both => match self.a.find(&mut predicate) { + None => { + self.state = ChainState::Back; + self.b.find(predicate) + } + v => v + }, + ChainState::Front => self.a.find(predicate), + ChainState::Back => self.b.find(predicate), + } + } + + #[inline] + fn last(self) -> Option { + match self.state { + ChainState::Both => { + // Must exhaust a before b. + let a_last = self.a.last(); + let b_last = self.b.last(); + b_last.or(a_last) + }, + ChainState::Front => self.a.last(), + ChainState::Back => self.b.last() + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + let (a_lower, a_upper) = self.a.size_hint(); + let (b_lower, b_upper) = self.b.size_hint(); + + let lower = a_lower.saturating_add(b_lower); + + let upper = match (a_upper, b_upper) { + (Some(x), Some(y)) => x.checked_add(y), + _ => None + }; + + (lower, upper) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl DoubleEndedIterator for Chain where + A: DoubleEndedIterator, + B: DoubleEndedIterator, +{ + #[inline] + fn next_back(&mut self) -> Option { + match self.state { + ChainState::Both => match self.b.next_back() { + elt @ Some(..) => elt, + None => { + self.state = ChainState::Front; + self.a.next_back() + } + }, + ChainState::Front => self.a.next_back(), + ChainState::Back => self.b.next_back(), + } + } + + fn try_rfold(&mut self, init: Acc, mut f: F) -> R where + Self: Sized, F: FnMut(Acc, Self::Item) -> R, R: Try + { + let mut accum = init; + match self.state { + ChainState::Both | ChainState::Back => { + accum = self.b.try_rfold(accum, &mut f)?; + if let ChainState::Both = self.state { + self.state = ChainState::Front; + } + } + _ => { } + } + if let ChainState::Front = self.state { + accum = self.a.try_rfold(accum, &mut f)?; + } + Try::from_ok(accum) + } + + fn rfold(self, init: Acc, mut f: F) -> Acc + where F: FnMut(Acc, Self::Item) -> Acc, + { + let mut accum = init; + match self.state { + ChainState::Both | ChainState::Back => { + accum = self.b.rfold(accum, &mut f); + } + _ => { } + } + match self.state { + ChainState::Both | ChainState::Front => { + accum = self.a.rfold(accum, &mut f); + } + _ => { } + } + accum + } + +} + +// Note: *both* must be fused to handle double-ended iterators. +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for Chain + where A: FusedIterator, + B: FusedIterator, +{} + +#[unstable(feature = "trusted_len", issue = "37572")] +unsafe impl TrustedLen for Chain + where A: TrustedLen, B: TrustedLen, +{} + diff --git a/src/libcore/iter/adapters/flatten.rs b/src/libcore/iter/adapters/flatten.rs new file mode 100644 index 00000000000..40f6865d38b --- /dev/null +++ b/src/libcore/iter/adapters/flatten.rs @@ -0,0 +1,330 @@ +use fmt; +use ops::Try; +use super::super::{Iterator, DoubleEndedIterator, FusedIterator}; +use super::Map; + +/// An iterator that maps each element to an iterator, and yields the elements +/// of the produced iterators. +/// +/// This `struct` is created by the [`flat_map`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`flat_map`]: trait.Iterator.html#method.flat_map +/// [`Iterator`]: trait.Iterator.html +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct FlatMap { + inner: FlattenCompat, ::IntoIter> +} +impl U> FlatMap { + pub(in super::super) fn new(iter: I, f: F) -> FlatMap { + FlatMap { inner: FlattenCompat::new(iter.map(f)) } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Clone for FlatMap + where ::IntoIter: Clone +{ + fn clone(&self) -> Self { FlatMap { inner: self.inner.clone() } } +} + +#[stable(feature = "core_impl_debug", since = "1.9.0")] +impl fmt::Debug for FlatMap + where U::IntoIter: fmt::Debug +{ + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("FlatMap").field("inner", &self.inner).finish() + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for FlatMap + where F: FnMut(I::Item) -> U, +{ + type Item = U::Item; + + #[inline] + fn next(&mut self) -> Option { self.inner.next() } + + #[inline] + fn size_hint(&self) -> (usize, Option) { self.inner.size_hint() } + + #[inline] + fn try_fold(&mut self, init: Acc, fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + self.inner.try_fold(init, fold) + } + + #[inline] + fn fold(self, init: Acc, fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + self.inner.fold(init, fold) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl DoubleEndedIterator for FlatMap + where F: FnMut(I::Item) -> U, + U: IntoIterator, + U::IntoIter: DoubleEndedIterator +{ + #[inline] + fn next_back(&mut self) -> Option { self.inner.next_back() } + + #[inline] + fn try_rfold(&mut self, init: Acc, fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + self.inner.try_rfold(init, fold) + } + + #[inline] + fn rfold(self, init: Acc, fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + self.inner.rfold(init, fold) + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for FlatMap + where I: FusedIterator, U: IntoIterator, F: FnMut(I::Item) -> U {} + +/// An iterator that flattens one level of nesting in an iterator of things +/// that can be turned into iterators. +/// +/// This `struct` is created by the [`flatten`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`flatten`]: trait.Iterator.html#method.flatten +/// [`Iterator`]: trait.Iterator.html +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "iterator_flatten", since = "1.29.0")] +pub struct Flatten +where I::Item: IntoIterator { + inner: FlattenCompat::IntoIter>, +} +impl Flatten +where I::Item: IntoIterator { + pub(in super::super) fn new(iter: I) -> Flatten { + Flatten { inner: FlattenCompat::new(iter) } + } +} + +#[stable(feature = "iterator_flatten", since = "1.29.0")] +impl fmt::Debug for Flatten + where I: Iterator + fmt::Debug, U: Iterator + fmt::Debug, + I::Item: IntoIterator, +{ + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Flatten").field("inner", &self.inner).finish() + } +} + +#[stable(feature = "iterator_flatten", since = "1.29.0")] +impl Clone for Flatten + where I: Iterator + Clone, U: Iterator + Clone, + I::Item: IntoIterator, +{ + fn clone(&self) -> Self { Flatten { inner: self.inner.clone() } } +} + +#[stable(feature = "iterator_flatten", since = "1.29.0")] +impl Iterator for Flatten + where I: Iterator, U: Iterator, + I::Item: IntoIterator +{ + type Item = U::Item; + + #[inline] + fn next(&mut self) -> Option { self.inner.next() } + + #[inline] + fn size_hint(&self) -> (usize, Option) { self.inner.size_hint() } + + #[inline] + fn try_fold(&mut self, init: Acc, fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + self.inner.try_fold(init, fold) + } + + #[inline] + fn fold(self, init: Acc, fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + self.inner.fold(init, fold) + } +} + +#[stable(feature = "iterator_flatten", since = "1.29.0")] +impl DoubleEndedIterator for Flatten + where I: DoubleEndedIterator, U: DoubleEndedIterator, + I::Item: IntoIterator +{ + #[inline] + fn next_back(&mut self) -> Option { self.inner.next_back() } + + #[inline] + fn try_rfold(&mut self, init: Acc, fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + self.inner.try_rfold(init, fold) + } + + #[inline] + fn rfold(self, init: Acc, fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + self.inner.rfold(init, fold) + } +} + +#[stable(feature = "iterator_flatten", since = "1.29.0")] +impl FusedIterator for Flatten + where I: FusedIterator, U: Iterator, + I::Item: IntoIterator {} + +/// Real logic of both `Flatten` and `FlatMap` which simply delegate to +/// this type. +#[derive(Clone, Debug)] +struct FlattenCompat { + iter: I, + frontiter: Option, + backiter: Option, +} +impl FlattenCompat { + /// Adapts an iterator by flattening it, for use in `flatten()` and `flat_map()`. + fn new(iter: I) -> FlattenCompat { + FlattenCompat { iter, frontiter: None, backiter: None } + } +} + +impl Iterator for FlattenCompat + where I: Iterator, U: Iterator, + I::Item: IntoIterator +{ + type Item = U::Item; + + #[inline] + fn next(&mut self) -> Option { + loop { + if let Some(ref mut inner) = self.frontiter { + if let elt@Some(_) = inner.next() { return elt } + } + match self.iter.next() { + None => return self.backiter.as_mut().and_then(|it| it.next()), + Some(inner) => self.frontiter = Some(inner.into_iter()), + } + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + let (flo, fhi) = self.frontiter.as_ref().map_or((0, Some(0)), |it| it.size_hint()); + let (blo, bhi) = self.backiter.as_ref().map_or((0, Some(0)), |it| it.size_hint()); + let lo = flo.saturating_add(blo); + match (self.iter.size_hint(), fhi, bhi) { + ((0, Some(0)), Some(a), Some(b)) => (lo, a.checked_add(b)), + _ => (lo, None) + } + } + + #[inline] + fn try_fold(&mut self, mut init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + if let Some(ref mut front) = self.frontiter { + init = front.try_fold(init, &mut fold)?; + } + self.frontiter = None; + + { + let frontiter = &mut self.frontiter; + init = self.iter.try_fold(init, |acc, x| { + let mut mid = x.into_iter(); + let r = mid.try_fold(acc, &mut fold); + *frontiter = Some(mid); + r + })?; + } + self.frontiter = None; + + if let Some(ref mut back) = self.backiter { + init = back.try_fold(init, &mut fold)?; + } + self.backiter = None; + + Try::from_ok(init) + } + + #[inline] + fn fold(self, init: Acc, mut fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + self.frontiter.into_iter() + .chain(self.iter.map(IntoIterator::into_iter)) + .chain(self.backiter) + .fold(init, |acc, iter| iter.fold(acc, &mut fold)) + } +} + +impl DoubleEndedIterator for FlattenCompat + where I: DoubleEndedIterator, U: DoubleEndedIterator, + I::Item: IntoIterator +{ + #[inline] + fn next_back(&mut self) -> Option { + loop { + if let Some(ref mut inner) = self.backiter { + if let elt@Some(_) = inner.next_back() { return elt } + } + match self.iter.next_back() { + None => return self.frontiter.as_mut().and_then(|it| it.next_back()), + next => self.backiter = next.map(IntoIterator::into_iter), + } + } + } + + #[inline] + fn try_rfold(&mut self, mut init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + if let Some(ref mut back) = self.backiter { + init = back.try_rfold(init, &mut fold)?; + } + self.backiter = None; + + { + let backiter = &mut self.backiter; + init = self.iter.try_rfold(init, |acc, x| { + let mut mid = x.into_iter(); + let r = mid.try_rfold(acc, &mut fold); + *backiter = Some(mid); + r + })?; + } + self.backiter = None; + + if let Some(ref mut front) = self.frontiter { + init = front.try_rfold(init, &mut fold)?; + } + self.frontiter = None; + + Try::from_ok(init) + } + + #[inline] + fn rfold(self, init: Acc, mut fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + self.frontiter.into_iter() + .chain(self.iter.map(IntoIterator::into_iter)) + .chain(self.backiter) + .rfold(init, |acc, iter| iter.rfold(acc, &mut fold)) + } +} + diff --git a/src/libcore/iter/adapters/mod.rs b/src/libcore/iter/adapters/mod.rs new file mode 100644 index 00000000000..f8d6bedeace --- /dev/null +++ b/src/libcore/iter/adapters/mod.rs @@ -0,0 +1,2044 @@ +use cmp; +use fmt; +use ops::Try; +use usize; +use intrinsics; +use super::{Iterator, DoubleEndedIterator, ExactSizeIterator, FusedIterator, TrustedLen}; +use super::LoopState; + +mod chain; +mod flatten; +mod zip; + +pub use self::chain::Chain; +pub use self::flatten::{FlatMap, Flatten}; +pub use self::zip::Zip; +pub(crate) use self::zip::TrustedRandomAccess; + +/// A double-ended iterator with the direction inverted. +/// +/// This `struct` is created by the [`rev`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`rev`]: trait.Iterator.html#method.rev +/// [`Iterator`]: trait.Iterator.html +#[derive(Clone, Debug)] +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Rev { + iter: T +} +impl Rev { + pub(super) fn new(iter: T) -> Rev { + Rev { iter } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Rev where I: DoubleEndedIterator { + type Item = ::Item; + + #[inline] + fn next(&mut self) -> Option<::Item> { self.iter.next_back() } + #[inline] + fn size_hint(&self) -> (usize, Option) { self.iter.size_hint() } + + #[inline] + fn nth(&mut self, n: usize) -> Option<::Item> { self.iter.nth_back(n) } + + fn try_fold(&mut self, init: B, f: F) -> R where + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + { + self.iter.try_rfold(init, f) + } + + fn fold(self, init: Acc, f: F) -> Acc + where F: FnMut(Acc, Self::Item) -> Acc, + { + self.iter.rfold(init, f) + } + + #[inline] + fn find

(&mut self, predicate: P) -> Option + where P: FnMut(&Self::Item) -> bool + { + self.iter.rfind(predicate) + } + + #[inline] + fn rposition

(&mut self, predicate: P) -> Option where + P: FnMut(Self::Item) -> bool + { + self.iter.position(predicate) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl DoubleEndedIterator for Rev where I: DoubleEndedIterator { + #[inline] + fn next_back(&mut self) -> Option<::Item> { self.iter.next() } + + #[inline] + fn nth_back(&mut self, n: usize) -> Option<::Item> { self.iter.nth(n) } + + fn try_rfold(&mut self, init: B, f: F) -> R where + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + { + self.iter.try_fold(init, f) + } + + fn rfold(self, init: Acc, f: F) -> Acc + where F: FnMut(Acc, Self::Item) -> Acc, + { + self.iter.fold(init, f) + } + + fn rfind

(&mut self, predicate: P) -> Option + where P: FnMut(&Self::Item) -> bool + { + self.iter.find(predicate) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl ExactSizeIterator for Rev + where I: ExactSizeIterator + DoubleEndedIterator +{ + fn len(&self) -> usize { + self.iter.len() + } + + fn is_empty(&self) -> bool { + self.iter.is_empty() + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for Rev + where I: FusedIterator + DoubleEndedIterator {} + +#[unstable(feature = "trusted_len", issue = "37572")] +unsafe impl TrustedLen for Rev + where I: TrustedLen + DoubleEndedIterator {} + +/// An iterator that copies the elements of an underlying iterator. +/// +/// This `struct` is created by the [`copied`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`copied`]: trait.Iterator.html#method.copied +/// [`Iterator`]: trait.Iterator.html +#[unstable(feature = "iter_copied", issue = "57127")] +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[derive(Clone, Debug)] +pub struct Copied { + it: I, +} +impl Copied { + pub(super) fn new(it: I) -> Copied { + Copied { it } + } +} + +#[unstable(feature = "iter_copied", issue = "57127")] +impl<'a, I, T: 'a> Iterator for Copied + where I: Iterator, T: Copy +{ + type Item = T; + + fn next(&mut self) -> Option { + self.it.next().copied() + } + + fn size_hint(&self) -> (usize, Option) { + self.it.size_hint() + } + + fn try_fold(&mut self, init: B, mut f: F) -> R where + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + { + self.it.try_fold(init, move |acc, &elt| f(acc, elt)) + } + + fn fold(self, init: Acc, mut f: F) -> Acc + where F: FnMut(Acc, Self::Item) -> Acc, + { + self.it.fold(init, move |acc, &elt| f(acc, elt)) + } +} + +#[unstable(feature = "iter_copied", issue = "57127")] +impl<'a, I, T: 'a> DoubleEndedIterator for Copied + where I: DoubleEndedIterator, T: Copy +{ + fn next_back(&mut self) -> Option { + self.it.next_back().copied() + } + + fn try_rfold(&mut self, init: B, mut f: F) -> R where + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + { + self.it.try_rfold(init, move |acc, &elt| f(acc, elt)) + } + + fn rfold(self, init: Acc, mut f: F) -> Acc + where F: FnMut(Acc, Self::Item) -> Acc, + { + self.it.rfold(init, move |acc, &elt| f(acc, elt)) + } +} + +#[unstable(feature = "iter_copied", issue = "57127")] +impl<'a, I, T: 'a> ExactSizeIterator for Copied + where I: ExactSizeIterator, T: Copy +{ + fn len(&self) -> usize { + self.it.len() + } + + fn is_empty(&self) -> bool { + self.it.is_empty() + } +} + +#[unstable(feature = "iter_copied", issue = "57127")] +impl<'a, I, T: 'a> FusedIterator for Copied + where I: FusedIterator, T: Copy +{} + +#[doc(hidden)] +unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Copied + where I: TrustedRandomAccess, T: Copy +{ + unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item { + *self.it.get_unchecked(i) + } + + #[inline] + fn may_have_side_effect() -> bool { + I::may_have_side_effect() + } +} + +#[unstable(feature = "iter_copied", issue = "57127")] +unsafe impl<'a, I, T: 'a> TrustedLen for Copied + where I: TrustedLen, + T: Copy +{} + +/// An iterator that clones the elements of an underlying iterator. +/// +/// This `struct` is created by the [`cloned`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`cloned`]: trait.Iterator.html#method.cloned +/// [`Iterator`]: trait.Iterator.html +#[stable(feature = "iter_cloned", since = "1.1.0")] +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[derive(Clone, Debug)] +pub struct Cloned { + it: I, +} +impl Cloned { + pub(super) fn new(it: I) -> Cloned { + Cloned { it } + } +} + +#[stable(feature = "iter_cloned", since = "1.1.0")] +impl<'a, I, T: 'a> Iterator for Cloned + where I: Iterator, T: Clone +{ + type Item = T; + + fn next(&mut self) -> Option { + self.it.next().cloned() + } + + fn size_hint(&self) -> (usize, Option) { + self.it.size_hint() + } + + fn try_fold(&mut self, init: B, mut f: F) -> R where + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + { + self.it.try_fold(init, move |acc, elt| f(acc, elt.clone())) + } + + fn fold(self, init: Acc, mut f: F) -> Acc + where F: FnMut(Acc, Self::Item) -> Acc, + { + self.it.fold(init, move |acc, elt| f(acc, elt.clone())) + } +} + +#[stable(feature = "iter_cloned", since = "1.1.0")] +impl<'a, I, T: 'a> DoubleEndedIterator for Cloned + where I: DoubleEndedIterator, T: Clone +{ + fn next_back(&mut self) -> Option { + self.it.next_back().cloned() + } + + fn try_rfold(&mut self, init: B, mut f: F) -> R where + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + { + self.it.try_rfold(init, move |acc, elt| f(acc, elt.clone())) + } + + fn rfold(self, init: Acc, mut f: F) -> Acc + where F: FnMut(Acc, Self::Item) -> Acc, + { + self.it.rfold(init, move |acc, elt| f(acc, elt.clone())) + } +} + +#[stable(feature = "iter_cloned", since = "1.1.0")] +impl<'a, I, T: 'a> ExactSizeIterator for Cloned + where I: ExactSizeIterator, T: Clone +{ + fn len(&self) -> usize { + self.it.len() + } + + fn is_empty(&self) -> bool { + self.it.is_empty() + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl<'a, I, T: 'a> FusedIterator for Cloned + where I: FusedIterator, T: Clone +{} + +#[doc(hidden)] +unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned + where I: TrustedRandomAccess, T: Clone +{ + default unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item { + self.it.get_unchecked(i).clone() + } + + #[inline] + default fn may_have_side_effect() -> bool { true } +} + +#[doc(hidden)] +unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned + where I: TrustedRandomAccess, T: Copy +{ + unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item { + *self.it.get_unchecked(i) + } + + #[inline] + fn may_have_side_effect() -> bool { + I::may_have_side_effect() + } +} + +#[unstable(feature = "trusted_len", issue = "37572")] +unsafe impl<'a, I, T: 'a> TrustedLen for Cloned + where I: TrustedLen, + T: Clone +{} + +/// An iterator that repeats endlessly. +/// +/// This `struct` is created by the [`cycle`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`cycle`]: trait.Iterator.html#method.cycle +/// [`Iterator`]: trait.Iterator.html +#[derive(Clone, Debug)] +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Cycle { + orig: I, + iter: I, +} +impl Cycle { + pub(super) fn new(iter: I) -> Cycle { + Cycle { orig: iter.clone(), iter } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Cycle where I: Clone + Iterator { + type Item = ::Item; + + #[inline] + fn next(&mut self) -> Option<::Item> { + match self.iter.next() { + None => { self.iter = self.orig.clone(); self.iter.next() } + y => y + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + // the cycle iterator is either empty or infinite + match self.orig.size_hint() { + sz @ (0, Some(0)) => sz, + (0, _) => (0, None), + _ => (usize::MAX, None) + } + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for Cycle where I: Clone + Iterator {} + +/// An iterator for stepping iterators by a custom amount. +/// +/// This `struct` is created by the [`step_by`] method on [`Iterator`]. See +/// its documentation for more. +/// +/// [`step_by`]: trait.Iterator.html#method.step_by +/// [`Iterator`]: trait.Iterator.html +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "iterator_step_by", since = "1.28.0")] +#[derive(Clone, Debug)] +pub struct StepBy { + iter: I, + step: usize, + first_take: bool, +} +impl StepBy { + pub(super) fn new(iter: I, step: usize) -> StepBy { + assert!(step != 0); + StepBy { iter, step: step - 1, first_take: true } + } +} + +#[stable(feature = "iterator_step_by", since = "1.28.0")] +impl Iterator for StepBy where I: Iterator { + type Item = I::Item; + + #[inline] + fn next(&mut self) -> Option { + if self.first_take { + self.first_take = false; + self.iter.next() + } else { + self.iter.nth(self.step) + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + let inner_hint = self.iter.size_hint(); + + if self.first_take { + let f = |n| if n == 0 { 0 } else { 1 + (n-1)/(self.step+1) }; + (f(inner_hint.0), inner_hint.1.map(f)) + } else { + let f = |n| n / (self.step+1); + (f(inner_hint.0), inner_hint.1.map(f)) + } + } + + #[inline] + fn nth(&mut self, mut n: usize) -> Option { + if self.first_take { + self.first_take = false; + let first = self.iter.next(); + if n == 0 { + return first; + } + n -= 1; + } + // n and self.step are indices, we need to add 1 to get the amount of elements + // When calling `.nth`, we need to subtract 1 again to convert back to an index + // step + 1 can't overflow because `.step_by` sets `self.step` to `step - 1` + let mut step = self.step + 1; + // n + 1 could overflow + // thus, if n is usize::MAX, instead of adding one, we call .nth(step) + if n == usize::MAX { + self.iter.nth(step - 1); + } else { + n += 1; + } + + // overflow handling + loop { + let mul = n.checked_mul(step); + if unsafe { intrinsics::likely(mul.is_some()) } { + return self.iter.nth(mul.unwrap() - 1); + } + let div_n = usize::MAX / n; + let div_step = usize::MAX / step; + let nth_n = div_n * n; + let nth_step = div_step * step; + let nth = if nth_n > nth_step { + step -= div_n; + nth_n + } else { + n -= div_step; + nth_step + }; + self.iter.nth(nth - 1); + } + } +} + +// StepBy can only make the iterator shorter, so the len will still fit. +#[stable(feature = "iterator_step_by", since = "1.28.0")] +impl ExactSizeIterator for StepBy where I: ExactSizeIterator {} + +/// An iterator that maps the values of `iter` with `f`. +/// +/// This `struct` is created by the [`map`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`map`]: trait.Iterator.html#method.map +/// [`Iterator`]: trait.Iterator.html +/// +/// # Notes about side effects +/// +/// The [`map`] iterator implements [`DoubleEndedIterator`], meaning that +/// you can also [`map`] backwards: +/// +/// ```rust +/// let v: Vec = vec![1, 2, 3].into_iter().map(|x| x + 1).rev().collect(); +/// +/// assert_eq!(v, [4, 3, 2]); +/// ``` +/// +/// [`DoubleEndedIterator`]: trait.DoubleEndedIterator.html +/// +/// But if your closure has state, iterating backwards may act in a way you do +/// not expect. Let's go through an example. First, in the forward direction: +/// +/// ```rust +/// let mut c = 0; +/// +/// for pair in vec!['a', 'b', 'c'].into_iter() +/// .map(|letter| { c += 1; (letter, c) }) { +/// println!("{:?}", pair); +/// } +/// ``` +/// +/// This will print "('a', 1), ('b', 2), ('c', 3)". +/// +/// Now consider this twist where we add a call to `rev`. This version will +/// print `('c', 1), ('b', 2), ('a', 3)`. Note that the letters are reversed, +/// but the values of the counter still go in order. This is because `map()` is +/// still being called lazily on each item, but we are popping items off the +/// back of the vector now, instead of shifting them from the front. +/// +/// ```rust +/// let mut c = 0; +/// +/// for pair in vec!['a', 'b', 'c'].into_iter() +/// .map(|letter| { c += 1; (letter, c) }) +/// .rev() { +/// println!("{:?}", pair); +/// } +/// ``` +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +#[derive(Clone)] +pub struct Map { + iter: I, + f: F, +} +impl Map { + pub(super) fn new(iter: I, f: F) -> Map { + Map { iter, f } + } +} + +#[stable(feature = "core_impl_debug", since = "1.9.0")] +impl fmt::Debug for Map { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Map") + .field("iter", &self.iter) + .finish() + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Map where F: FnMut(I::Item) -> B { + type Item = B; + + #[inline] + fn next(&mut self) -> Option { + self.iter.next().map(&mut self.f) + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + self.iter.size_hint() + } + + fn try_fold(&mut self, init: Acc, mut g: G) -> R where + Self: Sized, G: FnMut(Acc, Self::Item) -> R, R: Try + { + let f = &mut self.f; + self.iter.try_fold(init, move |acc, elt| g(acc, f(elt))) + } + + fn fold(self, init: Acc, mut g: G) -> Acc + where G: FnMut(Acc, Self::Item) -> Acc, + { + let mut f = self.f; + self.iter.fold(init, move |acc, elt| g(acc, f(elt))) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl DoubleEndedIterator for Map where + F: FnMut(I::Item) -> B, +{ + #[inline] + fn next_back(&mut self) -> Option { + self.iter.next_back().map(&mut self.f) + } + + fn try_rfold(&mut self, init: Acc, mut g: G) -> R where + Self: Sized, G: FnMut(Acc, Self::Item) -> R, R: Try + { + let f = &mut self.f; + self.iter.try_rfold(init, move |acc, elt| g(acc, f(elt))) + } + + fn rfold(self, init: Acc, mut g: G) -> Acc + where G: FnMut(Acc, Self::Item) -> Acc, + { + let mut f = self.f; + self.iter.rfold(init, move |acc, elt| g(acc, f(elt))) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl ExactSizeIterator for Map + where F: FnMut(I::Item) -> B +{ + fn len(&self) -> usize { + self.iter.len() + } + + fn is_empty(&self) -> bool { + self.iter.is_empty() + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for Map + where F: FnMut(I::Item) -> B {} + +#[unstable(feature = "trusted_len", issue = "37572")] +unsafe impl TrustedLen for Map + where I: TrustedLen, + F: FnMut(I::Item) -> B {} + +#[doc(hidden)] +unsafe impl TrustedRandomAccess for Map + where I: TrustedRandomAccess, + F: FnMut(I::Item) -> B, +{ + unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item { + (self.f)(self.iter.get_unchecked(i)) + } + #[inline] + fn may_have_side_effect() -> bool { true } +} + +/// An iterator that filters the elements of `iter` with `predicate`. +/// +/// This `struct` is created by the [`filter`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`filter`]: trait.Iterator.html#method.filter +/// [`Iterator`]: trait.Iterator.html +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +#[derive(Clone)] +pub struct Filter { + iter: I, + predicate: P, +} +impl Filter { + pub(super) fn new(iter: I, predicate: P) -> Filter { + Filter { iter, predicate } + } +} + +#[stable(feature = "core_impl_debug", since = "1.9.0")] +impl fmt::Debug for Filter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Filter") + .field("iter", &self.iter) + .finish() + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Filter where P: FnMut(&I::Item) -> bool { + type Item = I::Item; + + #[inline] + fn next(&mut self) -> Option { + for x in &mut self.iter { + if (self.predicate)(&x) { + return Some(x); + } + } + None + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + let (_, upper) = self.iter.size_hint(); + (0, upper) // can't know a lower bound, due to the predicate + } + + // this special case allows the compiler to make `.filter(_).count()` + // branchless. Barring perfect branch prediction (which is unattainable in + // the general case), this will be much faster in >90% of cases (containing + // virtually all real workloads) and only a tiny bit slower in the rest. + // + // Having this specialization thus allows us to write `.filter(p).count()` + // where we would otherwise write `.map(|x| p(x) as usize).sum()`, which is + // less readable and also less backwards-compatible to Rust before 1.10. + // + // Using the branchless version will also simplify the LLVM byte code, thus + // leaving more budget for LLVM optimizations. + #[inline] + fn count(mut self) -> usize { + let mut count = 0; + for x in &mut self.iter { + count += (self.predicate)(&x) as usize; + } + count + } + + #[inline] + fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + let predicate = &mut self.predicate; + self.iter.try_fold(init, move |acc, item| if predicate(&item) { + fold(acc, item) + } else { + Try::from_ok(acc) + }) + } + + #[inline] + fn fold(self, init: Acc, mut fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + let mut predicate = self.predicate; + self.iter.fold(init, move |acc, item| if predicate(&item) { + fold(acc, item) + } else { + acc + }) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl DoubleEndedIterator for Filter + where P: FnMut(&I::Item) -> bool, +{ + #[inline] + fn next_back(&mut self) -> Option { + for x in self.iter.by_ref().rev() { + if (self.predicate)(&x) { + return Some(x); + } + } + None + } + + #[inline] + fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + let predicate = &mut self.predicate; + self.iter.try_rfold(init, move |acc, item| if predicate(&item) { + fold(acc, item) + } else { + Try::from_ok(acc) + }) + } + + #[inline] + fn rfold(self, init: Acc, mut fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + let mut predicate = self.predicate; + self.iter.rfold(init, move |acc, item| if predicate(&item) { + fold(acc, item) + } else { + acc + }) + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for Filter + where P: FnMut(&I::Item) -> bool {} + +/// An iterator that uses `f` to both filter and map elements from `iter`. +/// +/// This `struct` is created by the [`filter_map`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`filter_map`]: trait.Iterator.html#method.filter_map +/// [`Iterator`]: trait.Iterator.html +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +#[derive(Clone)] +pub struct FilterMap { + iter: I, + f: F, +} +impl FilterMap { + pub(super) fn new(iter: I, f: F) -> FilterMap { + FilterMap { iter, f } + } +} + +#[stable(feature = "core_impl_debug", since = "1.9.0")] +impl fmt::Debug for FilterMap { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("FilterMap") + .field("iter", &self.iter) + .finish() + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for FilterMap + where F: FnMut(I::Item) -> Option, +{ + type Item = B; + + #[inline] + fn next(&mut self) -> Option { + for x in self.iter.by_ref() { + if let Some(y) = (self.f)(x) { + return Some(y); + } + } + None + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + let (_, upper) = self.iter.size_hint(); + (0, upper) // can't know a lower bound, due to the predicate + } + + #[inline] + fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + let f = &mut self.f; + self.iter.try_fold(init, move |acc, item| match f(item) { + Some(x) => fold(acc, x), + None => Try::from_ok(acc), + }) + } + + #[inline] + fn fold(self, init: Acc, mut fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + let mut f = self.f; + self.iter.fold(init, move |acc, item| match f(item) { + Some(x) => fold(acc, x), + None => acc, + }) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl DoubleEndedIterator for FilterMap + where F: FnMut(I::Item) -> Option, +{ + #[inline] + fn next_back(&mut self) -> Option { + for x in self.iter.by_ref().rev() { + if let Some(y) = (self.f)(x) { + return Some(y); + } + } + None + } + + #[inline] + fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + let f = &mut self.f; + self.iter.try_rfold(init, move |acc, item| match f(item) { + Some(x) => fold(acc, x), + None => Try::from_ok(acc), + }) + } + + #[inline] + fn rfold(self, init: Acc, mut fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + let mut f = self.f; + self.iter.rfold(init, move |acc, item| match f(item) { + Some(x) => fold(acc, x), + None => acc, + }) + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for FilterMap + where F: FnMut(I::Item) -> Option {} + +/// An iterator that yields the current count and the element during iteration. +/// +/// This `struct` is created by the [`enumerate`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`enumerate`]: trait.Iterator.html#method.enumerate +/// [`Iterator`]: trait.Iterator.html +#[derive(Clone, Debug)] +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Enumerate { + iter: I, + count: usize, +} +impl Enumerate { + pub(super) fn new(iter: I) -> Enumerate { + Enumerate { iter, count: 0 } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Enumerate where I: Iterator { + type Item = (usize, ::Item); + + /// # Overflow Behavior + /// + /// The method does no guarding against overflows, so enumerating more than + /// `usize::MAX` elements either produces the wrong result or panics. If + /// debug assertions are enabled, a panic is guaranteed. + /// + /// # Panics + /// + /// Might panic if the index of the element overflows a `usize`. + #[inline] + #[rustc_inherit_overflow_checks] + fn next(&mut self) -> Option<(usize, ::Item)> { + self.iter.next().map(|a| { + let ret = (self.count, a); + // Possible undefined overflow. + self.count += 1; + ret + }) + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + self.iter.size_hint() + } + + #[inline] + #[rustc_inherit_overflow_checks] + fn nth(&mut self, n: usize) -> Option<(usize, I::Item)> { + self.iter.nth(n).map(|a| { + let i = self.count + n; + self.count = i + 1; + (i, a) + }) + } + + #[inline] + fn count(self) -> usize { + self.iter.count() + } + + #[inline] + #[rustc_inherit_overflow_checks] + fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + let count = &mut self.count; + self.iter.try_fold(init, move |acc, item| { + let acc = fold(acc, (*count, item)); + *count += 1; + acc + }) + } + + #[inline] + #[rustc_inherit_overflow_checks] + fn fold(self, init: Acc, mut fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + let mut count = self.count; + self.iter.fold(init, move |acc, item| { + let acc = fold(acc, (count, item)); + count += 1; + acc + }) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl DoubleEndedIterator for Enumerate where + I: ExactSizeIterator + DoubleEndedIterator +{ + #[inline] + fn next_back(&mut self) -> Option<(usize, ::Item)> { + self.iter.next_back().map(|a| { + let len = self.iter.len(); + // Can safely add, `ExactSizeIterator` promises that the number of + // elements fits into a `usize`. + (self.count + len, a) + }) + } + + #[inline] + fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + // Can safely add and subtract the count, as `ExactSizeIterator` promises + // that the number of elements fits into a `usize`. + let mut count = self.count + self.iter.len(); + self.iter.try_rfold(init, move |acc, item| { + count -= 1; + fold(acc, (count, item)) + }) + } + + #[inline] + fn rfold(self, init: Acc, mut fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + // Can safely add and subtract the count, as `ExactSizeIterator` promises + // that the number of elements fits into a `usize`. + let mut count = self.count + self.iter.len(); + self.iter.rfold(init, move |acc, item| { + count -= 1; + fold(acc, (count, item)) + }) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl ExactSizeIterator for Enumerate where I: ExactSizeIterator { + fn len(&self) -> usize { + self.iter.len() + } + + fn is_empty(&self) -> bool { + self.iter.is_empty() + } +} + +#[doc(hidden)] +unsafe impl TrustedRandomAccess for Enumerate + where I: TrustedRandomAccess +{ + unsafe fn get_unchecked(&mut self, i: usize) -> (usize, I::Item) { + (self.count + i, self.iter.get_unchecked(i)) + } + + fn may_have_side_effect() -> bool { + I::may_have_side_effect() + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for Enumerate where I: FusedIterator {} + +#[unstable(feature = "trusted_len", issue = "37572")] +unsafe impl TrustedLen for Enumerate + where I: TrustedLen, +{} + + +/// An iterator with a `peek()` that returns an optional reference to the next +/// element. +/// +/// This `struct` is created by the [`peekable`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`peekable`]: trait.Iterator.html#method.peekable +/// [`Iterator`]: trait.Iterator.html +#[derive(Clone, Debug)] +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Peekable { + iter: I, + /// Remember a peeked value, even if it was None. + peeked: Option>, +} +impl Peekable { + pub(super) fn new(iter: I) -> Peekable { + Peekable { iter, peeked: None } + } +} + +// Peekable must remember if a None has been seen in the `.peek()` method. +// It ensures that `.peek(); .peek();` or `.peek(); .next();` only advances the +// underlying iterator at most once. This does not by itself make the iterator +// fused. +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Peekable { + type Item = I::Item; + + #[inline] + fn next(&mut self) -> Option { + match self.peeked.take() { + Some(v) => v, + None => self.iter.next(), + } + } + + #[inline] + #[rustc_inherit_overflow_checks] + fn count(mut self) -> usize { + match self.peeked.take() { + Some(None) => 0, + Some(Some(_)) => 1 + self.iter.count(), + None => self.iter.count(), + } + } + + #[inline] + fn nth(&mut self, n: usize) -> Option { + match self.peeked.take() { + Some(None) => None, + Some(v @ Some(_)) if n == 0 => v, + Some(Some(_)) => self.iter.nth(n - 1), + None => self.iter.nth(n), + } + } + + #[inline] + fn last(mut self) -> Option { + let peek_opt = match self.peeked.take() { + Some(None) => return None, + Some(v) => v, + None => None, + }; + self.iter.last().or(peek_opt) + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + let peek_len = match self.peeked { + Some(None) => return (0, Some(0)), + Some(Some(_)) => 1, + None => 0, + }; + let (lo, hi) = self.iter.size_hint(); + let lo = lo.saturating_add(peek_len); + let hi = hi.and_then(|x| x.checked_add(peek_len)); + (lo, hi) + } + + #[inline] + fn try_fold(&mut self, init: B, mut f: F) -> R where + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + { + let acc = match self.peeked.take() { + Some(None) => return Try::from_ok(init), + Some(Some(v)) => f(init, v)?, + None => init, + }; + self.iter.try_fold(acc, f) + } + + #[inline] + fn fold(self, init: Acc, mut fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + let acc = match self.peeked { + Some(None) => return init, + Some(Some(v)) => fold(init, v), + None => init, + }; + self.iter.fold(acc, fold) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl ExactSizeIterator for Peekable {} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for Peekable {} + +impl Peekable { + /// Returns a reference to the next() value without advancing the iterator. + /// + /// Like [`next`], if there is a value, it is wrapped in a `Some(T)`. + /// But if the iteration is over, `None` is returned. + /// + /// [`next`]: trait.Iterator.html#tymethod.next + /// + /// Because `peek()` returns a reference, and many iterators iterate over + /// references, there can be a possibly confusing situation where the + /// return value is a double reference. You can see this effect in the + /// examples below. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// let xs = [1, 2, 3]; + /// + /// let mut iter = xs.iter().peekable(); + /// + /// // peek() lets us see into the future + /// assert_eq!(iter.peek(), Some(&&1)); + /// assert_eq!(iter.next(), Some(&1)); + /// + /// assert_eq!(iter.next(), Some(&2)); + /// + /// // The iterator does not advance even if we `peek` multiple times + /// assert_eq!(iter.peek(), Some(&&3)); + /// assert_eq!(iter.peek(), Some(&&3)); + /// + /// assert_eq!(iter.next(), Some(&3)); + /// + /// // After the iterator is finished, so is `peek()` + /// assert_eq!(iter.peek(), None); + /// assert_eq!(iter.next(), None); + /// ``` + #[inline] + #[stable(feature = "rust1", since = "1.0.0")] + pub fn peek(&mut self) -> Option<&I::Item> { + let iter = &mut self.iter; + self.peeked.get_or_insert_with(|| iter.next()).as_ref() + } +} + +/// An iterator that rejects elements while `predicate` is true. +/// +/// This `struct` is created by the [`skip_while`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`skip_while`]: trait.Iterator.html#method.skip_while +/// [`Iterator`]: trait.Iterator.html +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +#[derive(Clone)] +pub struct SkipWhile { + iter: I, + flag: bool, + predicate: P, +} +impl SkipWhile { + pub(super) fn new(iter: I, predicate: P) -> SkipWhile { + SkipWhile { iter, flag: false, predicate } + } +} + +#[stable(feature = "core_impl_debug", since = "1.9.0")] +impl fmt::Debug for SkipWhile { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("SkipWhile") + .field("iter", &self.iter) + .field("flag", &self.flag) + .finish() + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for SkipWhile + where P: FnMut(&I::Item) -> bool +{ + type Item = I::Item; + + #[inline] + fn next(&mut self) -> Option { + let flag = &mut self.flag; + let pred = &mut self.predicate; + self.iter.find(move |x| { + if *flag || !pred(x) { + *flag = true; + true + } else { + false + } + }) + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + let (_, upper) = self.iter.size_hint(); + (0, upper) // can't know a lower bound, due to the predicate + } + + #[inline] + fn try_fold(&mut self, mut init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + if !self.flag { + match self.next() { + Some(v) => init = fold(init, v)?, + None => return Try::from_ok(init), + } + } + self.iter.try_fold(init, fold) + } + + #[inline] + fn fold(mut self, mut init: Acc, mut fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + if !self.flag { + match self.next() { + Some(v) => init = fold(init, v), + None => return init, + } + } + self.iter.fold(init, fold) + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for SkipWhile + where I: FusedIterator, P: FnMut(&I::Item) -> bool {} + +/// An iterator that only accepts elements while `predicate` is true. +/// +/// This `struct` is created by the [`take_while`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`take_while`]: trait.Iterator.html#method.take_while +/// [`Iterator`]: trait.Iterator.html +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +#[derive(Clone)] +pub struct TakeWhile { + iter: I, + flag: bool, + predicate: P, +} +impl TakeWhile { + pub(super) fn new(iter: I, predicate: P) -> TakeWhile { + TakeWhile { iter, flag: false, predicate } + } +} + +#[stable(feature = "core_impl_debug", since = "1.9.0")] +impl fmt::Debug for TakeWhile { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("TakeWhile") + .field("iter", &self.iter) + .field("flag", &self.flag) + .finish() + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for TakeWhile + where P: FnMut(&I::Item) -> bool +{ + type Item = I::Item; + + #[inline] + fn next(&mut self) -> Option { + if self.flag { + None + } else { + self.iter.next().and_then(|x| { + if (self.predicate)(&x) { + Some(x) + } else { + self.flag = true; + None + } + }) + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + if self.flag { + (0, Some(0)) + } else { + let (_, upper) = self.iter.size_hint(); + (0, upper) // can't know a lower bound, due to the predicate + } + } + + #[inline] + fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + if self.flag { + Try::from_ok(init) + } else { + let flag = &mut self.flag; + let p = &mut self.predicate; + self.iter.try_fold(init, move |acc, x|{ + if p(&x) { + LoopState::from_try(fold(acc, x)) + } else { + *flag = true; + LoopState::Break(Try::from_ok(acc)) + } + }).into_try() + } + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for TakeWhile + where I: FusedIterator, P: FnMut(&I::Item) -> bool {} + +/// An iterator that skips over `n` elements of `iter`. +/// +/// This `struct` is created by the [`skip`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`skip`]: trait.Iterator.html#method.skip +/// [`Iterator`]: trait.Iterator.html +#[derive(Clone, Debug)] +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Skip { + iter: I, + n: usize +} +impl Skip { + pub(super) fn new(iter: I, n: usize) -> Skip { + Skip { iter, n } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Skip where I: Iterator { + type Item = ::Item; + + #[inline] + fn next(&mut self) -> Option { + if self.n == 0 { + self.iter.next() + } else { + let old_n = self.n; + self.n = 0; + self.iter.nth(old_n) + } + } + + #[inline] + fn nth(&mut self, n: usize) -> Option { + // Can't just add n + self.n due to overflow. + if self.n == 0 { + self.iter.nth(n) + } else { + let to_skip = self.n; + self.n = 0; + // nth(n) skips n+1 + if self.iter.nth(to_skip-1).is_none() { + return None; + } + self.iter.nth(n) + } + } + + #[inline] + fn count(self) -> usize { + self.iter.count().saturating_sub(self.n) + } + + #[inline] + fn last(mut self) -> Option { + if self.n == 0 { + self.iter.last() + } else { + let next = self.next(); + if next.is_some() { + // recurse. n should be 0. + self.last().or(next) + } else { + None + } + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + let (lower, upper) = self.iter.size_hint(); + + let lower = lower.saturating_sub(self.n); + let upper = upper.map(|x| x.saturating_sub(self.n)); + + (lower, upper) + } + + #[inline] + fn try_fold(&mut self, init: Acc, fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + let n = self.n; + self.n = 0; + if n > 0 { + // nth(n) skips n+1 + if self.iter.nth(n - 1).is_none() { + return Try::from_ok(init); + } + } + self.iter.try_fold(init, fold) + } + + #[inline] + fn fold(mut self, init: Acc, fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + if self.n > 0 { + // nth(n) skips n+1 + if self.iter.nth(self.n - 1).is_none() { + return init; + } + } + self.iter.fold(init, fold) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl ExactSizeIterator for Skip where I: ExactSizeIterator {} + +#[stable(feature = "double_ended_skip_iterator", since = "1.9.0")] +impl DoubleEndedIterator for Skip where I: DoubleEndedIterator + ExactSizeIterator { + fn next_back(&mut self) -> Option { + if self.len() > 0 { + self.iter.next_back() + } else { + None + } + } + + fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + let mut n = self.len(); + if n == 0 { + Try::from_ok(init) + } else { + self.iter.try_rfold(init, move |acc, x| { + n -= 1; + let r = fold(acc, x); + if n == 0 { LoopState::Break(r) } + else { LoopState::from_try(r) } + }).into_try() + } + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for Skip where I: FusedIterator {} + +/// An iterator that only iterates over the first `n` iterations of `iter`. +/// +/// This `struct` is created by the [`take`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`take`]: trait.Iterator.html#method.take +/// [`Iterator`]: trait.Iterator.html +#[derive(Clone, Debug)] +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Take { + pub(super) iter: I, + pub(super) n: usize +} +impl Take { + pub(super) fn new(iter: I, n: usize) -> Take { + Take { iter, n } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Take where I: Iterator{ + type Item = ::Item; + + #[inline] + fn next(&mut self) -> Option<::Item> { + if self.n != 0 { + self.n -= 1; + self.iter.next() + } else { + None + } + } + + #[inline] + fn nth(&mut self, n: usize) -> Option { + if self.n > n { + self.n -= n + 1; + self.iter.nth(n) + } else { + if self.n > 0 { + self.iter.nth(self.n - 1); + self.n = 0; + } + None + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + if self.n == 0 { + return (0, Some(0)); + } + + let (lower, upper) = self.iter.size_hint(); + + let lower = cmp::min(lower, self.n); + + let upper = match upper { + Some(x) if x < self.n => Some(x), + _ => Some(self.n) + }; + + (lower, upper) + } + + #[inline] + fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + if self.n == 0 { + Try::from_ok(init) + } else { + let n = &mut self.n; + self.iter.try_fold(init, move |acc, x| { + *n -= 1; + let r = fold(acc, x); + if *n == 0 { LoopState::Break(r) } + else { LoopState::from_try(r) } + }).into_try() + } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl ExactSizeIterator for Take where I: ExactSizeIterator {} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for Take where I: FusedIterator {} + +#[unstable(feature = "trusted_len", issue = "37572")] +unsafe impl TrustedLen for Take {} + +/// An iterator to maintain state while iterating another iterator. +/// +/// This `struct` is created by the [`scan`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`scan`]: trait.Iterator.html#method.scan +/// [`Iterator`]: trait.Iterator.html +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +#[derive(Clone)] +pub struct Scan { + iter: I, + f: F, + state: St, +} +impl Scan { + pub(super) fn new(iter: I, state: St, f: F) -> Scan { + Scan { iter, state, f } + } +} + +#[stable(feature = "core_impl_debug", since = "1.9.0")] +impl fmt::Debug for Scan { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Scan") + .field("iter", &self.iter) + .field("state", &self.state) + .finish() + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Scan where + I: Iterator, + F: FnMut(&mut St, I::Item) -> Option, +{ + type Item = B; + + #[inline] + fn next(&mut self) -> Option { + self.iter.next().and_then(|a| (self.f)(&mut self.state, a)) + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + let (_, upper) = self.iter.size_hint(); + (0, upper) // can't know a lower bound, due to the scan function + } + + #[inline] + fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + let state = &mut self.state; + let f = &mut self.f; + self.iter.try_fold(init, move |acc, x| { + match f(state, x) { + None => LoopState::Break(Try::from_ok(acc)), + Some(x) => LoopState::from_try(fold(acc, x)), + } + }).into_try() + } +} + +/// An iterator that yields `None` forever after the underlying iterator +/// yields `None` once. +/// +/// This `struct` is created by the [`fuse`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`fuse`]: trait.Iterator.html#method.fuse +/// [`Iterator`]: trait.Iterator.html +#[derive(Clone, Debug)] +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Fuse { + iter: I, + done: bool +} +impl Fuse { + pub(super) fn new(iter: I) -> Fuse { + Fuse { iter, done: false } + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for Fuse where I: Iterator {} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Fuse where I: Iterator { + type Item = ::Item; + + #[inline] + default fn next(&mut self) -> Option<::Item> { + if self.done { + None + } else { + let next = self.iter.next(); + self.done = next.is_none(); + next + } + } + + #[inline] + default fn nth(&mut self, n: usize) -> Option { + if self.done { + None + } else { + let nth = self.iter.nth(n); + self.done = nth.is_none(); + nth + } + } + + #[inline] + default fn last(self) -> Option { + if self.done { + None + } else { + self.iter.last() + } + } + + #[inline] + default fn count(self) -> usize { + if self.done { + 0 + } else { + self.iter.count() + } + } + + #[inline] + default fn size_hint(&self) -> (usize, Option) { + if self.done { + (0, Some(0)) + } else { + self.iter.size_hint() + } + } + + #[inline] + default fn try_fold(&mut self, init: Acc, fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + if self.done { + Try::from_ok(init) + } else { + let acc = self.iter.try_fold(init, fold)?; + self.done = true; + Try::from_ok(acc) + } + } + + #[inline] + default fn fold(self, init: Acc, fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + if self.done { + init + } else { + self.iter.fold(init, fold) + } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl DoubleEndedIterator for Fuse where I: DoubleEndedIterator { + #[inline] + default fn next_back(&mut self) -> Option<::Item> { + if self.done { + None + } else { + let next = self.iter.next_back(); + self.done = next.is_none(); + next + } + } + + #[inline] + default fn try_rfold(&mut self, init: Acc, fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + if self.done { + Try::from_ok(init) + } else { + let acc = self.iter.try_rfold(init, fold)?; + self.done = true; + Try::from_ok(acc) + } + } + + #[inline] + default fn rfold(self, init: Acc, fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + if self.done { + init + } else { + self.iter.rfold(init, fold) + } + } +} + +unsafe impl TrustedRandomAccess for Fuse + where I: TrustedRandomAccess, +{ + unsafe fn get_unchecked(&mut self, i: usize) -> I::Item { + self.iter.get_unchecked(i) + } + + fn may_have_side_effect() -> bool { + I::may_have_side_effect() + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl Iterator for Fuse where I: FusedIterator { + #[inline] + fn next(&mut self) -> Option<::Item> { + self.iter.next() + } + + #[inline] + fn nth(&mut self, n: usize) -> Option { + self.iter.nth(n) + } + + #[inline] + fn last(self) -> Option { + self.iter.last() + } + + #[inline] + fn count(self) -> usize { + self.iter.count() + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + self.iter.size_hint() + } + + #[inline] + fn try_fold(&mut self, init: Acc, fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + self.iter.try_fold(init, fold) + } + + #[inline] + fn fold(self, init: Acc, fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + self.iter.fold(init, fold) + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl DoubleEndedIterator for Fuse + where I: DoubleEndedIterator + FusedIterator +{ + #[inline] + fn next_back(&mut self) -> Option<::Item> { + self.iter.next_back() + } + + #[inline] + fn try_rfold(&mut self, init: Acc, fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + self.iter.try_rfold(init, fold) + } + + #[inline] + fn rfold(self, init: Acc, fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + self.iter.rfold(init, fold) + } +} + + +#[stable(feature = "rust1", since = "1.0.0")] +impl ExactSizeIterator for Fuse where I: ExactSizeIterator { + fn len(&self) -> usize { + self.iter.len() + } + + fn is_empty(&self) -> bool { + self.iter.is_empty() + } +} + +/// An iterator that calls a function with a reference to each element before +/// yielding it. +/// +/// This `struct` is created by the [`inspect`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`inspect`]: trait.Iterator.html#method.inspect +/// [`Iterator`]: trait.Iterator.html +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +#[derive(Clone)] +pub struct Inspect { + iter: I, + f: F, +} +impl Inspect { + pub(super) fn new(iter: I, f: F) -> Inspect { + Inspect { iter, f } + } +} + +#[stable(feature = "core_impl_debug", since = "1.9.0")] +impl fmt::Debug for Inspect { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Inspect") + .field("iter", &self.iter) + .finish() + } +} + +impl Inspect where F: FnMut(&I::Item) { + #[inline] + fn do_inspect(&mut self, elt: Option) -> Option { + if let Some(ref a) = elt { + (self.f)(a); + } + + elt + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Inspect where F: FnMut(&I::Item) { + type Item = I::Item; + + #[inline] + fn next(&mut self) -> Option { + let next = self.iter.next(); + self.do_inspect(next) + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + self.iter.size_hint() + } + + #[inline] + fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + let f = &mut self.f; + self.iter.try_fold(init, move |acc, item| { f(&item); fold(acc, item) }) + } + + #[inline] + fn fold(self, init: Acc, mut fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + let mut f = self.f; + self.iter.fold(init, move |acc, item| { f(&item); fold(acc, item) }) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl DoubleEndedIterator for Inspect + where F: FnMut(&I::Item), +{ + #[inline] + fn next_back(&mut self) -> Option { + let next = self.iter.next_back(); + self.do_inspect(next) + } + + #[inline] + fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + { + let f = &mut self.f; + self.iter.try_rfold(init, move |acc, item| { f(&item); fold(acc, item) }) + } + + #[inline] + fn rfold(self, init: Acc, mut fold: Fold) -> Acc + where Fold: FnMut(Acc, Self::Item) -> Acc, + { + let mut f = self.f; + self.iter.rfold(init, move |acc, item| { f(&item); fold(acc, item) }) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl ExactSizeIterator for Inspect + where F: FnMut(&I::Item) +{ + fn len(&self) -> usize { + self.iter.len() + } + + fn is_empty(&self) -> bool { + self.iter.is_empty() + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for Inspect + where F: FnMut(&I::Item) {} diff --git a/src/libcore/iter/adapters/zip.rs b/src/libcore/iter/adapters/zip.rs new file mode 100644 index 00000000000..3548d0e2826 --- /dev/null +++ b/src/libcore/iter/adapters/zip.rs @@ -0,0 +1,282 @@ +use cmp; +use super::super::{Iterator, DoubleEndedIterator, ExactSizeIterator, FusedIterator, TrustedLen}; + +/// An iterator that iterates two other iterators simultaneously. +/// +/// This `struct` is created by the [`zip`] method on [`Iterator`]. See its +/// documentation for more. +/// +/// [`zip`]: trait.Iterator.html#method.zip +/// [`Iterator`]: trait.Iterator.html +#[derive(Clone, Debug)] +#[must_use = "iterators are lazy and do nothing unless consumed"] +#[stable(feature = "rust1", since = "1.0.0")] +pub struct Zip { + a: A, + b: B, + // index and len are only used by the specialized version of zip + index: usize, + len: usize, +} +impl Zip { + pub(in super::super) fn new(a: A, b: B) -> Zip { + ZipImpl::new(a, b) + } + fn super_nth(&mut self, mut n: usize) -> Option<(A::Item, B::Item)> { + while let Some(x) = Iterator::next(self) { + if n == 0 { return Some(x) } + n -= 1; + } + None + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl Iterator for Zip where A: Iterator, B: Iterator +{ + type Item = (A::Item, B::Item); + + #[inline] + fn next(&mut self) -> Option { + ZipImpl::next(self) + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + ZipImpl::size_hint(self) + } + + #[inline] + fn nth(&mut self, n: usize) -> Option { + ZipImpl::nth(self, n) + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl DoubleEndedIterator for Zip where + A: DoubleEndedIterator + ExactSizeIterator, + B: DoubleEndedIterator + ExactSizeIterator, +{ + #[inline] + fn next_back(&mut self) -> Option<(A::Item, B::Item)> { + ZipImpl::next_back(self) + } +} + +// Zip specialization trait +#[doc(hidden)] +trait ZipImpl { + type Item; + fn new(a: A, b: B) -> Self; + fn next(&mut self) -> Option; + fn size_hint(&self) -> (usize, Option); + fn nth(&mut self, n: usize) -> Option; + fn next_back(&mut self) -> Option + where A: DoubleEndedIterator + ExactSizeIterator, + B: DoubleEndedIterator + ExactSizeIterator; +} + +// General Zip impl +#[doc(hidden)] +impl ZipImpl for Zip + where A: Iterator, B: Iterator +{ + type Item = (A::Item, B::Item); + default fn new(a: A, b: B) -> Self { + Zip { + a, + b, + index: 0, // unused + len: 0, // unused + } + } + + #[inline] + default fn next(&mut self) -> Option<(A::Item, B::Item)> { + self.a.next().and_then(|x| { + self.b.next().and_then(|y| { + Some((x, y)) + }) + }) + } + + #[inline] + default fn nth(&mut self, n: usize) -> Option { + self.super_nth(n) + } + + #[inline] + default fn next_back(&mut self) -> Option<(A::Item, B::Item)> + where A: DoubleEndedIterator + ExactSizeIterator, + B: DoubleEndedIterator + ExactSizeIterator + { + let a_sz = self.a.len(); + let b_sz = self.b.len(); + if a_sz != b_sz { + // Adjust a, b to equal length + if a_sz > b_sz { + for _ in 0..a_sz - b_sz { self.a.next_back(); } + } else { + for _ in 0..b_sz - a_sz { self.b.next_back(); } + } + } + match (self.a.next_back(), self.b.next_back()) { + (Some(x), Some(y)) => Some((x, y)), + (None, None) => None, + _ => unreachable!(), + } + } + + #[inline] + default fn size_hint(&self) -> (usize, Option) { + let (a_lower, a_upper) = self.a.size_hint(); + let (b_lower, b_upper) = self.b.size_hint(); + + let lower = cmp::min(a_lower, b_lower); + + let upper = match (a_upper, b_upper) { + (Some(x), Some(y)) => Some(cmp::min(x,y)), + (Some(x), None) => Some(x), + (None, Some(y)) => Some(y), + (None, None) => None + }; + + (lower, upper) + } +} + +#[doc(hidden)] +impl ZipImpl for Zip + where A: TrustedRandomAccess, B: TrustedRandomAccess +{ + fn new(a: A, b: B) -> Self { + let len = cmp::min(a.len(), b.len()); + Zip { + a, + b, + index: 0, + len, + } + } + + #[inline] + fn next(&mut self) -> Option<(A::Item, B::Item)> { + if self.index < self.len { + let i = self.index; + self.index += 1; + unsafe { + Some((self.a.get_unchecked(i), self.b.get_unchecked(i))) + } + } else if A::may_have_side_effect() && self.index < self.a.len() { + // match the base implementation's potential side effects + unsafe { + self.a.get_unchecked(self.index); + } + self.index += 1; + None + } else { + None + } + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + let len = self.len - self.index; + (len, Some(len)) + } + + #[inline] + fn nth(&mut self, n: usize) -> Option { + let delta = cmp::min(n, self.len - self.index); + let end = self.index + delta; + while self.index < end { + let i = self.index; + self.index += 1; + if A::may_have_side_effect() { + unsafe { self.a.get_unchecked(i); } + } + if B::may_have_side_effect() { + unsafe { self.b.get_unchecked(i); } + } + } + + self.super_nth(n - delta) + } + + #[inline] + fn next_back(&mut self) -> Option<(A::Item, B::Item)> + where A: DoubleEndedIterator + ExactSizeIterator, + B: DoubleEndedIterator + ExactSizeIterator + { + // Adjust a, b to equal length + if A::may_have_side_effect() { + let sz = self.a.len(); + if sz > self.len { + for _ in 0..sz - cmp::max(self.len, self.index) { + self.a.next_back(); + } + } + } + if B::may_have_side_effect() { + let sz = self.b.len(); + if sz > self.len { + for _ in 0..sz - self.len { + self.b.next_back(); + } + } + } + if self.index < self.len { + self.len -= 1; + let i = self.len; + unsafe { + Some((self.a.get_unchecked(i), self.b.get_unchecked(i))) + } + } else { + None + } + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl ExactSizeIterator for Zip + where A: ExactSizeIterator, B: ExactSizeIterator {} + +#[doc(hidden)] +unsafe impl TrustedRandomAccess for Zip + where A: TrustedRandomAccess, + B: TrustedRandomAccess, +{ + unsafe fn get_unchecked(&mut self, i: usize) -> (A::Item, B::Item) { + (self.a.get_unchecked(i), self.b.get_unchecked(i)) + } + + fn may_have_side_effect() -> bool { + A::may_have_side_effect() || B::may_have_side_effect() + } +} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for Zip + where A: FusedIterator, B: FusedIterator, {} + +#[unstable(feature = "trusted_len", issue = "37572")] +unsafe impl TrustedLen for Zip + where A: TrustedLen, B: TrustedLen, +{} + +/// An iterator whose items are random-accessible efficiently +/// +/// # Safety +/// +/// The iterator's .len() and size_hint() must be exact. +/// `.len()` must be cheap to call. +/// +/// .get_unchecked() must return distinct mutable references for distinct +/// indices (if applicable), and must return a valid reference if index is in +/// 0..self.len(). +pub(crate) unsafe trait TrustedRandomAccess : ExactSizeIterator { + unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item; + /// Returns `true` if getting an iterator element may have + /// side effects. Remember to take inner iterators into account. + fn may_have_side_effect() -> bool; +} diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index 509068843d1..b6bb5f01b2d 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Composable external iteration. //! //! If you've found yourself with a collection of some kind, and needed to @@ -112,10 +102,10 @@ //! //! // next() is the only required method //! fn next(&mut self) -> Option { -//! // increment our count. This is why we started at zero. +//! // Increment our count. This is why we started at zero. //! self.count += 1; //! -//! // check to see if we've finished counting or not. +//! // Check to see if we've finished counting or not. //! if self.count < 6 { //! Some(self.count) //! } else { @@ -253,7 +243,7 @@ //! using it. The compiler will warn us about this kind of behavior: //! //! ```text -//! warning: unused result that must be used: iterator adaptors are lazy and +//! warning: unused result that must be used: iterators are lazy and //! do nothing unless consumed //! ``` //! @@ -316,15 +306,10 @@ #![stable(feature = "rust1", since = "1.0.0")] -use cmp; -use fmt; -use iter_private::TrustedRandomAccess; use ops::Try; -use usize; -use intrinsics; #[stable(feature = "rust1", since = "1.0.0")] -pub use self::iterator::Iterator; +pub use self::traits::Iterator; #[unstable(feature = "step_trait", reason = "likely to be replaced by finer-grained traits", @@ -339,6 +324,10 @@ pub use self::sources::{RepeatWith, repeat_with}; pub use self::sources::{Empty, empty}; #[stable(feature = "iter_once", since = "1.2.0")] pub use self::sources::{Once, once}; +#[unstable(feature = "iter_once_with", issue = "57581")] +pub use self::sources::{OnceWith, once_with}; +#[unstable(feature = "iter_unfold", issue = "55977")] +pub use self::sources::{Unfold, unfold, Successors, successors}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::traits::{FromIterator, IntoIterator, DoubleEndedIterator, Extend}; @@ -349,10 +338,27 @@ pub use self::traits::FusedIterator; #[unstable(feature = "trusted_len", issue = "37572")] pub use self::traits::TrustedLen; -mod iterator; +#[stable(feature = "rust1", since = "1.0.0")] +pub use self::adapters::{Rev, Cycle, Chain, Zip, Map, Filter, FilterMap, Enumerate}; +#[stable(feature = "rust1", since = "1.0.0")] +pub use self::adapters::{Peekable, SkipWhile, TakeWhile, Skip, Take, Scan, FlatMap}; +#[stable(feature = "rust1", since = "1.0.0")] +pub use self::adapters::{Fuse, Inspect}; +#[stable(feature = "iter_cloned", since = "1.1.0")] +pub use self::adapters::Cloned; +#[stable(feature = "iterator_step_by", since = "1.28.0")] +pub use self::adapters::StepBy; +#[stable(feature = "iterator_flatten", since = "1.29.0")] +pub use self::adapters::Flatten; +#[unstable(feature = "iter_copied", issue = "57127")] +pub use self::adapters::Copied; + +pub(crate) use self::adapters::TrustedRandomAccess; + mod range; mod sources; mod traits; +mod adapters; /// Used to make try_fold closures more like normal loops #[derive(PartialEq)] @@ -403,2664 +409,3 @@ impl LoopState { } } } - -/// A double-ended iterator with the direction inverted. -/// -/// This `struct` is created by the [`rev`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`rev`]: trait.Iterator.html#method.rev -/// [`Iterator`]: trait.Iterator.html -#[derive(Clone, Debug)] -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -pub struct Rev { - iter: T -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Rev where I: DoubleEndedIterator { - type Item = ::Item; - - #[inline] - fn next(&mut self) -> Option<::Item> { self.iter.next_back() } - #[inline] - fn size_hint(&self) -> (usize, Option) { self.iter.size_hint() } - - fn try_fold(&mut self, init: B, f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try - { - self.iter.try_rfold(init, f) - } - - fn fold(self, init: Acc, f: F) -> Acc - where F: FnMut(Acc, Self::Item) -> Acc, - { - self.iter.rfold(init, f) - } - - #[inline] - fn find

(&mut self, predicate: P) -> Option - where P: FnMut(&Self::Item) -> bool - { - self.iter.rfind(predicate) - } - - #[inline] - fn rposition

(&mut self, predicate: P) -> Option where - P: FnMut(Self::Item) -> bool - { - self.iter.position(predicate) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl DoubleEndedIterator for Rev where I: DoubleEndedIterator { - #[inline] - fn next_back(&mut self) -> Option<::Item> { self.iter.next() } - - fn try_rfold(&mut self, init: B, f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try - { - self.iter.try_fold(init, f) - } - - fn rfold(self, init: Acc, f: F) -> Acc - where F: FnMut(Acc, Self::Item) -> Acc, - { - self.iter.fold(init, f) - } - - fn rfind

(&mut self, predicate: P) -> Option - where P: FnMut(&Self::Item) -> bool - { - self.iter.find(predicate) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl ExactSizeIterator for Rev - where I: ExactSizeIterator + DoubleEndedIterator -{ - fn len(&self) -> usize { - self.iter.len() - } - - fn is_empty(&self) -> bool { - self.iter.is_empty() - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for Rev - where I: FusedIterator + DoubleEndedIterator {} - -#[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl TrustedLen for Rev - where I: TrustedLen + DoubleEndedIterator {} - -/// An iterator that clones the elements of an underlying iterator. -/// -/// This `struct` is created by the [`cloned`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`cloned`]: trait.Iterator.html#method.cloned -/// [`Iterator`]: trait.Iterator.html -#[stable(feature = "iter_cloned", since = "1.1.0")] -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[derive(Clone, Debug)] -pub struct Cloned { - it: I, -} - -#[stable(feature = "iter_cloned", since = "1.1.0")] -impl<'a, I, T: 'a> Iterator for Cloned - where I: Iterator, T: Clone -{ - type Item = T; - - fn next(&mut self) -> Option { - self.it.next().cloned() - } - - fn size_hint(&self) -> (usize, Option) { - self.it.size_hint() - } - - fn try_fold(&mut self, init: B, mut f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try - { - self.it.try_fold(init, move |acc, elt| f(acc, elt.clone())) - } - - fn fold(self, init: Acc, mut f: F) -> Acc - where F: FnMut(Acc, Self::Item) -> Acc, - { - self.it.fold(init, move |acc, elt| f(acc, elt.clone())) - } -} - -#[stable(feature = "iter_cloned", since = "1.1.0")] -impl<'a, I, T: 'a> DoubleEndedIterator for Cloned - where I: DoubleEndedIterator, T: Clone -{ - fn next_back(&mut self) -> Option { - self.it.next_back().cloned() - } - - fn try_rfold(&mut self, init: B, mut f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try - { - self.it.try_rfold(init, move |acc, elt| f(acc, elt.clone())) - } - - fn rfold(self, init: Acc, mut f: F) -> Acc - where F: FnMut(Acc, Self::Item) -> Acc, - { - self.it.rfold(init, move |acc, elt| f(acc, elt.clone())) - } -} - -#[stable(feature = "iter_cloned", since = "1.1.0")] -impl<'a, I, T: 'a> ExactSizeIterator for Cloned - where I: ExactSizeIterator, T: Clone -{ - fn len(&self) -> usize { - self.it.len() - } - - fn is_empty(&self) -> bool { - self.it.is_empty() - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl<'a, I, T: 'a> FusedIterator for Cloned - where I: FusedIterator, T: Clone -{} - -#[doc(hidden)] -unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned - where I: TrustedRandomAccess, T: Clone -{ - default unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item { - self.it.get_unchecked(i).clone() - } - - #[inline] - default fn may_have_side_effect() -> bool { true } -} - -#[doc(hidden)] -unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned - where I: TrustedRandomAccess, T: Copy -{ - unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item { - *self.it.get_unchecked(i) - } - - #[inline] - fn may_have_side_effect() -> bool { false } -} - -#[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, I, T: 'a> TrustedLen for Cloned - where I: TrustedLen, - T: Clone -{} - -/// An iterator that repeats endlessly. -/// -/// This `struct` is created by the [`cycle`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`cycle`]: trait.Iterator.html#method.cycle -/// [`Iterator`]: trait.Iterator.html -#[derive(Clone, Debug)] -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -pub struct Cycle { - orig: I, - iter: I, -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Cycle where I: Clone + Iterator { - type Item = ::Item; - - #[inline] - fn next(&mut self) -> Option<::Item> { - match self.iter.next() { - None => { self.iter = self.orig.clone(); self.iter.next() } - y => y - } - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - // the cycle iterator is either empty or infinite - match self.orig.size_hint() { - sz @ (0, Some(0)) => sz, - (0, _) => (0, None), - _ => (usize::MAX, None) - } - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for Cycle where I: Clone + Iterator {} - -/// An iterator for stepping iterators by a custom amount. -/// -/// This `struct` is created by the [`step_by`] method on [`Iterator`]. See -/// its documentation for more. -/// -/// [`step_by`]: trait.Iterator.html#method.step_by -/// [`Iterator`]: trait.Iterator.html -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "iterator_step_by", since = "1.28.0")] -#[derive(Clone, Debug)] -pub struct StepBy { - iter: I, - step: usize, - first_take: bool, -} - -#[stable(feature = "iterator_step_by", since = "1.28.0")] -impl Iterator for StepBy where I: Iterator { - type Item = I::Item; - - #[inline] - fn next(&mut self) -> Option { - if self.first_take { - self.first_take = false; - self.iter.next() - } else { - self.iter.nth(self.step) - } - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let inner_hint = self.iter.size_hint(); - - if self.first_take { - let f = |n| if n == 0 { 0 } else { 1 + (n-1)/(self.step+1) }; - (f(inner_hint.0), inner_hint.1.map(f)) - } else { - let f = |n| n / (self.step+1); - (f(inner_hint.0), inner_hint.1.map(f)) - } - } - - #[inline] - fn nth(&mut self, mut n: usize) -> Option { - if self.first_take { - self.first_take = false; - let first = self.iter.next(); - if n == 0 { - return first; - } - n -= 1; - } - // n and self.step are indices, we need to add 1 to get the amount of elements - // When calling `.nth`, we need to subtract 1 again to convert back to an index - // step + 1 can't overflow because `.step_by` sets `self.step` to `step - 1` - let mut step = self.step + 1; - // n + 1 could overflow - // thus, if n is usize::MAX, instead of adding one, we call .nth(step) - if n == usize::MAX { - self.iter.nth(step - 1); - } else { - n += 1; - } - - // overflow handling - loop { - let mul = n.checked_mul(step); - if unsafe { intrinsics::likely(mul.is_some()) } { - return self.iter.nth(mul.unwrap() - 1); - } - let div_n = usize::MAX / n; - let div_step = usize::MAX / step; - let nth_n = div_n * n; - let nth_step = div_step * step; - let nth = if nth_n > nth_step { - step -= div_n; - nth_n - } else { - n -= div_step; - nth_step - }; - self.iter.nth(nth - 1); - } - } -} - -// StepBy can only make the iterator shorter, so the len will still fit. -#[stable(feature = "iterator_step_by", since = "1.28.0")] -impl ExactSizeIterator for StepBy where I: ExactSizeIterator {} - -/// An iterator that strings two iterators together. -/// -/// This `struct` is created by the [`chain`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`chain`]: trait.Iterator.html#method.chain -/// [`Iterator`]: trait.Iterator.html -#[derive(Clone, Debug)] -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -pub struct Chain { - a: A, - b: B, - state: ChainState, -} - -// The iterator protocol specifies that iteration ends with the return value -// `None` from `.next()` (or `.next_back()`) and it is unspecified what -// further calls return. The chain adaptor must account for this since it uses -// two subiterators. -// -// It uses three states: -// -// - Both: `a` and `b` are remaining -// - Front: `a` remaining -// - Back: `b` remaining -// -// The fourth state (neither iterator is remaining) only occurs after Chain has -// returned None once, so we don't need to store this state. -#[derive(Clone, Debug)] -enum ChainState { - // both front and back iterator are remaining - Both, - // only front is remaining - Front, - // only back is remaining - Back, -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Chain where - A: Iterator, - B: Iterator -{ - type Item = A::Item; - - #[inline] - fn next(&mut self) -> Option { - match self.state { - ChainState::Both => match self.a.next() { - elt @ Some(..) => elt, - None => { - self.state = ChainState::Back; - self.b.next() - } - }, - ChainState::Front => self.a.next(), - ChainState::Back => self.b.next(), - } - } - - #[inline] - #[rustc_inherit_overflow_checks] - fn count(self) -> usize { - match self.state { - ChainState::Both => self.a.count() + self.b.count(), - ChainState::Front => self.a.count(), - ChainState::Back => self.b.count(), - } - } - - fn try_fold(&mut self, init: Acc, mut f: F) -> R where - Self: Sized, F: FnMut(Acc, Self::Item) -> R, R: Try - { - let mut accum = init; - match self.state { - ChainState::Both | ChainState::Front => { - accum = self.a.try_fold(accum, &mut f)?; - if let ChainState::Both = self.state { - self.state = ChainState::Back; - } - } - _ => { } - } - if let ChainState::Back = self.state { - accum = self.b.try_fold(accum, &mut f)?; - } - Try::from_ok(accum) - } - - fn fold(self, init: Acc, mut f: F) -> Acc - where F: FnMut(Acc, Self::Item) -> Acc, - { - let mut accum = init; - match self.state { - ChainState::Both | ChainState::Front => { - accum = self.a.fold(accum, &mut f); - } - _ => { } - } - match self.state { - ChainState::Both | ChainState::Back => { - accum = self.b.fold(accum, &mut f); - } - _ => { } - } - accum - } - - #[inline] - fn nth(&mut self, mut n: usize) -> Option { - match self.state { - ChainState::Both | ChainState::Front => { - for x in self.a.by_ref() { - if n == 0 { - return Some(x) - } - n -= 1; - } - if let ChainState::Both = self.state { - self.state = ChainState::Back; - } - } - ChainState::Back => {} - } - if let ChainState::Back = self.state { - self.b.nth(n) - } else { - None - } - } - - #[inline] - fn find

(&mut self, mut predicate: P) -> Option where - P: FnMut(&Self::Item) -> bool, - { - match self.state { - ChainState::Both => match self.a.find(&mut predicate) { - None => { - self.state = ChainState::Back; - self.b.find(predicate) - } - v => v - }, - ChainState::Front => self.a.find(predicate), - ChainState::Back => self.b.find(predicate), - } - } - - #[inline] - fn last(self) -> Option { - match self.state { - ChainState::Both => { - // Must exhaust a before b. - let a_last = self.a.last(); - let b_last = self.b.last(); - b_last.or(a_last) - }, - ChainState::Front => self.a.last(), - ChainState::Back => self.b.last() - } - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let (a_lower, a_upper) = self.a.size_hint(); - let (b_lower, b_upper) = self.b.size_hint(); - - let lower = a_lower.saturating_add(b_lower); - - let upper = match (a_upper, b_upper) { - (Some(x), Some(y)) => x.checked_add(y), - _ => None - }; - - (lower, upper) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl DoubleEndedIterator for Chain where - A: DoubleEndedIterator, - B: DoubleEndedIterator, -{ - #[inline] - fn next_back(&mut self) -> Option { - match self.state { - ChainState::Both => match self.b.next_back() { - elt @ Some(..) => elt, - None => { - self.state = ChainState::Front; - self.a.next_back() - } - }, - ChainState::Front => self.a.next_back(), - ChainState::Back => self.b.next_back(), - } - } - - fn try_rfold(&mut self, init: Acc, mut f: F) -> R where - Self: Sized, F: FnMut(Acc, Self::Item) -> R, R: Try - { - let mut accum = init; - match self.state { - ChainState::Both | ChainState::Back => { - accum = self.b.try_rfold(accum, &mut f)?; - if let ChainState::Both = self.state { - self.state = ChainState::Front; - } - } - _ => { } - } - if let ChainState::Front = self.state { - accum = self.a.try_rfold(accum, &mut f)?; - } - Try::from_ok(accum) - } - - fn rfold(self, init: Acc, mut f: F) -> Acc - where F: FnMut(Acc, Self::Item) -> Acc, - { - let mut accum = init; - match self.state { - ChainState::Both | ChainState::Back => { - accum = self.b.rfold(accum, &mut f); - } - _ => { } - } - match self.state { - ChainState::Both | ChainState::Front => { - accum = self.a.rfold(accum, &mut f); - } - _ => { } - } - accum - } - -} - -// Note: *both* must be fused to handle double-ended iterators. -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for Chain - where A: FusedIterator, - B: FusedIterator, -{} - -#[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl TrustedLen for Chain - where A: TrustedLen, B: TrustedLen, -{} - -/// An iterator that iterates two other iterators simultaneously. -/// -/// This `struct` is created by the [`zip`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`zip`]: trait.Iterator.html#method.zip -/// [`Iterator`]: trait.Iterator.html -#[derive(Clone, Debug)] -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -pub struct Zip { - a: A, - b: B, - // index and len are only used by the specialized version of zip - index: usize, - len: usize, -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Zip where A: Iterator, B: Iterator -{ - type Item = (A::Item, B::Item); - - #[inline] - fn next(&mut self) -> Option { - ZipImpl::next(self) - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - ZipImpl::size_hint(self) - } - - #[inline] - fn nth(&mut self, n: usize) -> Option { - ZipImpl::nth(self, n) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl DoubleEndedIterator for Zip where - A: DoubleEndedIterator + ExactSizeIterator, - B: DoubleEndedIterator + ExactSizeIterator, -{ - #[inline] - fn next_back(&mut self) -> Option<(A::Item, B::Item)> { - ZipImpl::next_back(self) - } -} - -// Zip specialization trait -#[doc(hidden)] -trait ZipImpl { - type Item; - fn new(a: A, b: B) -> Self; - fn next(&mut self) -> Option; - fn size_hint(&self) -> (usize, Option); - fn nth(&mut self, n: usize) -> Option; - fn super_nth(&mut self, mut n: usize) -> Option { - while let Some(x) = self.next() { - if n == 0 { return Some(x) } - n -= 1; - } - None - } - fn next_back(&mut self) -> Option - where A: DoubleEndedIterator + ExactSizeIterator, - B: DoubleEndedIterator + ExactSizeIterator; -} - -// General Zip impl -#[doc(hidden)] -impl ZipImpl for Zip - where A: Iterator, B: Iterator -{ - type Item = (A::Item, B::Item); - default fn new(a: A, b: B) -> Self { - Zip { - a, - b, - index: 0, // unused - len: 0, // unused - } - } - - #[inline] - default fn next(&mut self) -> Option<(A::Item, B::Item)> { - self.a.next().and_then(|x| { - self.b.next().and_then(|y| { - Some((x, y)) - }) - }) - } - - #[inline] - default fn nth(&mut self, n: usize) -> Option { - self.super_nth(n) - } - - #[inline] - default fn next_back(&mut self) -> Option<(A::Item, B::Item)> - where A: DoubleEndedIterator + ExactSizeIterator, - B: DoubleEndedIterator + ExactSizeIterator - { - let a_sz = self.a.len(); - let b_sz = self.b.len(); - if a_sz != b_sz { - // Adjust a, b to equal length - if a_sz > b_sz { - for _ in 0..a_sz - b_sz { self.a.next_back(); } - } else { - for _ in 0..b_sz - a_sz { self.b.next_back(); } - } - } - match (self.a.next_back(), self.b.next_back()) { - (Some(x), Some(y)) => Some((x, y)), - (None, None) => None, - _ => unreachable!(), - } - } - - #[inline] - default fn size_hint(&self) -> (usize, Option) { - let (a_lower, a_upper) = self.a.size_hint(); - let (b_lower, b_upper) = self.b.size_hint(); - - let lower = cmp::min(a_lower, b_lower); - - let upper = match (a_upper, b_upper) { - (Some(x), Some(y)) => Some(cmp::min(x,y)), - (Some(x), None) => Some(x), - (None, Some(y)) => Some(y), - (None, None) => None - }; - - (lower, upper) - } -} - -#[doc(hidden)] -impl ZipImpl for Zip - where A: TrustedRandomAccess, B: TrustedRandomAccess -{ - fn new(a: A, b: B) -> Self { - let len = cmp::min(a.len(), b.len()); - Zip { - a, - b, - index: 0, - len, - } - } - - #[inline] - fn next(&mut self) -> Option<(A::Item, B::Item)> { - if self.index < self.len { - let i = self.index; - self.index += 1; - unsafe { - Some((self.a.get_unchecked(i), self.b.get_unchecked(i))) - } - } else if A::may_have_side_effect() && self.index < self.a.len() { - // match the base implementation's potential side effects - unsafe { - self.a.get_unchecked(self.index); - } - self.index += 1; - None - } else { - None - } - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let len = self.len - self.index; - (len, Some(len)) - } - - #[inline] - fn nth(&mut self, n: usize) -> Option { - let delta = cmp::min(n, self.len - self.index); - let end = self.index + delta; - while self.index < end { - let i = self.index; - self.index += 1; - if A::may_have_side_effect() { - unsafe { self.a.get_unchecked(i); } - } - if B::may_have_side_effect() { - unsafe { self.b.get_unchecked(i); } - } - } - - self.super_nth(n - delta) - } - - #[inline] - fn next_back(&mut self) -> Option<(A::Item, B::Item)> - where A: DoubleEndedIterator + ExactSizeIterator, - B: DoubleEndedIterator + ExactSizeIterator - { - // Adjust a, b to equal length - if A::may_have_side_effect() { - let sz = self.a.len(); - if sz > self.len { - for _ in 0..sz - cmp::max(self.len, self.index) { - self.a.next_back(); - } - } - } - if B::may_have_side_effect() { - let sz = self.b.len(); - if sz > self.len { - for _ in 0..sz - self.len { - self.b.next_back(); - } - } - } - if self.index < self.len { - self.len -= 1; - let i = self.len; - unsafe { - Some((self.a.get_unchecked(i), self.b.get_unchecked(i))) - } - } else { - None - } - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl ExactSizeIterator for Zip - where A: ExactSizeIterator, B: ExactSizeIterator {} - -#[doc(hidden)] -unsafe impl TrustedRandomAccess for Zip - where A: TrustedRandomAccess, - B: TrustedRandomAccess, -{ - unsafe fn get_unchecked(&mut self, i: usize) -> (A::Item, B::Item) { - (self.a.get_unchecked(i), self.b.get_unchecked(i)) - } - - fn may_have_side_effect() -> bool { - A::may_have_side_effect() || B::may_have_side_effect() - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for Zip - where A: FusedIterator, B: FusedIterator, {} - -#[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl TrustedLen for Zip - where A: TrustedLen, B: TrustedLen, -{} - -/// An iterator that maps the values of `iter` with `f`. -/// -/// This `struct` is created by the [`map`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`map`]: trait.Iterator.html#method.map -/// [`Iterator`]: trait.Iterator.html -/// -/// # Notes about side effects -/// -/// The [`map`] iterator implements [`DoubleEndedIterator`], meaning that -/// you can also [`map`] backwards: -/// -/// ```rust -/// let v: Vec = vec![1, 2, 3].into_iter().map(|x| x + 1).rev().collect(); -/// -/// assert_eq!(v, [4, 3, 2]); -/// ``` -/// -/// [`DoubleEndedIterator`]: trait.DoubleEndedIterator.html -/// -/// But if your closure has state, iterating backwards may act in a way you do -/// not expect. Let's go through an example. First, in the forward direction: -/// -/// ```rust -/// let mut c = 0; -/// -/// for pair in vec!['a', 'b', 'c'].into_iter() -/// .map(|letter| { c += 1; (letter, c) }) { -/// println!("{:?}", pair); -/// } -/// ``` -/// -/// This will print "('a', 1), ('b', 2), ('c', 3)". -/// -/// Now consider this twist where we add a call to `rev`. This version will -/// print `('c', 1), ('b', 2), ('a', 3)`. Note that the letters are reversed, -/// but the values of the counter still go in order. This is because `map()` is -/// still being called lazily on each item, but we are popping items off the -/// back of the vector now, instead of shifting them from the front. -/// -/// ```rust -/// let mut c = 0; -/// -/// for pair in vec!['a', 'b', 'c'].into_iter() -/// .map(|letter| { c += 1; (letter, c) }) -/// .rev() { -/// println!("{:?}", pair); -/// } -/// ``` -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -#[derive(Clone)] -pub struct Map { - iter: I, - f: F, -} - -#[stable(feature = "core_impl_debug", since = "1.9.0")] -impl fmt::Debug for Map { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Map") - .field("iter", &self.iter) - .finish() - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Map where F: FnMut(I::Item) -> B { - type Item = B; - - #[inline] - fn next(&mut self) -> Option { - self.iter.next().map(&mut self.f) - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - self.iter.size_hint() - } - - fn try_fold(&mut self, init: Acc, mut g: G) -> R where - Self: Sized, G: FnMut(Acc, Self::Item) -> R, R: Try - { - let f = &mut self.f; - self.iter.try_fold(init, move |acc, elt| g(acc, f(elt))) - } - - fn fold(self, init: Acc, mut g: G) -> Acc - where G: FnMut(Acc, Self::Item) -> Acc, - { - let mut f = self.f; - self.iter.fold(init, move |acc, elt| g(acc, f(elt))) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl DoubleEndedIterator for Map where - F: FnMut(I::Item) -> B, -{ - #[inline] - fn next_back(&mut self) -> Option { - self.iter.next_back().map(&mut self.f) - } - - fn try_rfold(&mut self, init: Acc, mut g: G) -> R where - Self: Sized, G: FnMut(Acc, Self::Item) -> R, R: Try - { - let f = &mut self.f; - self.iter.try_rfold(init, move |acc, elt| g(acc, f(elt))) - } - - fn rfold(self, init: Acc, mut g: G) -> Acc - where G: FnMut(Acc, Self::Item) -> Acc, - { - let mut f = self.f; - self.iter.rfold(init, move |acc, elt| g(acc, f(elt))) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl ExactSizeIterator for Map - where F: FnMut(I::Item) -> B -{ - fn len(&self) -> usize { - self.iter.len() - } - - fn is_empty(&self) -> bool { - self.iter.is_empty() - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for Map - where F: FnMut(I::Item) -> B {} - -#[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl TrustedLen for Map - where I: TrustedLen, - F: FnMut(I::Item) -> B {} - -#[doc(hidden)] -unsafe impl TrustedRandomAccess for Map - where I: TrustedRandomAccess, - F: FnMut(I::Item) -> B, -{ - unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item { - (self.f)(self.iter.get_unchecked(i)) - } - #[inline] - fn may_have_side_effect() -> bool { true } -} - -/// An iterator that filters the elements of `iter` with `predicate`. -/// -/// This `struct` is created by the [`filter`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`filter`]: trait.Iterator.html#method.filter -/// [`Iterator`]: trait.Iterator.html -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -#[derive(Clone)] -pub struct Filter { - iter: I, - predicate: P, -} - -#[stable(feature = "core_impl_debug", since = "1.9.0")] -impl fmt::Debug for Filter { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Filter") - .field("iter", &self.iter) - .finish() - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Filter where P: FnMut(&I::Item) -> bool { - type Item = I::Item; - - #[inline] - fn next(&mut self) -> Option { - for x in &mut self.iter { - if (self.predicate)(&x) { - return Some(x); - } - } - None - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let (_, upper) = self.iter.size_hint(); - (0, upper) // can't know a lower bound, due to the predicate - } - - // this special case allows the compiler to make `.filter(_).count()` - // branchless. Barring perfect branch prediction (which is unattainable in - // the general case), this will be much faster in >90% of cases (containing - // virtually all real workloads) and only a tiny bit slower in the rest. - // - // Having this specialization thus allows us to write `.filter(p).count()` - // where we would otherwise write `.map(|x| p(x) as usize).sum()`, which is - // less readable and also less backwards-compatible to Rust before 1.10. - // - // Using the branchless version will also simplify the LLVM byte code, thus - // leaving more budget for LLVM optimizations. - #[inline] - fn count(mut self) -> usize { - let mut count = 0; - for x in &mut self.iter { - count += (self.predicate)(&x) as usize; - } - count - } - - #[inline] - fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - let predicate = &mut self.predicate; - self.iter.try_fold(init, move |acc, item| if predicate(&item) { - fold(acc, item) - } else { - Try::from_ok(acc) - }) - } - - #[inline] - fn fold(self, init: Acc, mut fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - let mut predicate = self.predicate; - self.iter.fold(init, move |acc, item| if predicate(&item) { - fold(acc, item) - } else { - acc - }) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl DoubleEndedIterator for Filter - where P: FnMut(&I::Item) -> bool, -{ - #[inline] - fn next_back(&mut self) -> Option { - for x in self.iter.by_ref().rev() { - if (self.predicate)(&x) { - return Some(x); - } - } - None - } - - #[inline] - fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - let predicate = &mut self.predicate; - self.iter.try_rfold(init, move |acc, item| if predicate(&item) { - fold(acc, item) - } else { - Try::from_ok(acc) - }) - } - - #[inline] - fn rfold(self, init: Acc, mut fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - let mut predicate = self.predicate; - self.iter.rfold(init, move |acc, item| if predicate(&item) { - fold(acc, item) - } else { - acc - }) - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for Filter - where P: FnMut(&I::Item) -> bool {} - -/// An iterator that uses `f` to both filter and map elements from `iter`. -/// -/// This `struct` is created by the [`filter_map`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`filter_map`]: trait.Iterator.html#method.filter_map -/// [`Iterator`]: trait.Iterator.html -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -#[derive(Clone)] -pub struct FilterMap { - iter: I, - f: F, -} - -#[stable(feature = "core_impl_debug", since = "1.9.0")] -impl fmt::Debug for FilterMap { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("FilterMap") - .field("iter", &self.iter) - .finish() - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for FilterMap - where F: FnMut(I::Item) -> Option, -{ - type Item = B; - - #[inline] - fn next(&mut self) -> Option { - for x in self.iter.by_ref() { - if let Some(y) = (self.f)(x) { - return Some(y); - } - } - None - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let (_, upper) = self.iter.size_hint(); - (0, upper) // can't know a lower bound, due to the predicate - } - - #[inline] - fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - let f = &mut self.f; - self.iter.try_fold(init, move |acc, item| match f(item) { - Some(x) => fold(acc, x), - None => Try::from_ok(acc), - }) - } - - #[inline] - fn fold(self, init: Acc, mut fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - let mut f = self.f; - self.iter.fold(init, move |acc, item| match f(item) { - Some(x) => fold(acc, x), - None => acc, - }) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl DoubleEndedIterator for FilterMap - where F: FnMut(I::Item) -> Option, -{ - #[inline] - fn next_back(&mut self) -> Option { - for x in self.iter.by_ref().rev() { - if let Some(y) = (self.f)(x) { - return Some(y); - } - } - None - } - - #[inline] - fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - let f = &mut self.f; - self.iter.try_rfold(init, move |acc, item| match f(item) { - Some(x) => fold(acc, x), - None => Try::from_ok(acc), - }) - } - - #[inline] - fn rfold(self, init: Acc, mut fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - let mut f = self.f; - self.iter.rfold(init, move |acc, item| match f(item) { - Some(x) => fold(acc, x), - None => acc, - }) - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for FilterMap - where F: FnMut(I::Item) -> Option {} - -/// An iterator that yields the current count and the element during iteration. -/// -/// This `struct` is created by the [`enumerate`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`enumerate`]: trait.Iterator.html#method.enumerate -/// [`Iterator`]: trait.Iterator.html -#[derive(Clone, Debug)] -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -pub struct Enumerate { - iter: I, - count: usize, -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Enumerate where I: Iterator { - type Item = (usize, ::Item); - - /// # Overflow Behavior - /// - /// The method does no guarding against overflows, so enumerating more than - /// `usize::MAX` elements either produces the wrong result or panics. If - /// debug assertions are enabled, a panic is guaranteed. - /// - /// # Panics - /// - /// Might panic if the index of the element overflows a `usize`. - #[inline] - #[rustc_inherit_overflow_checks] - fn next(&mut self) -> Option<(usize, ::Item)> { - self.iter.next().map(|a| { - let ret = (self.count, a); - // Possible undefined overflow. - self.count += 1; - ret - }) - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - self.iter.size_hint() - } - - #[inline] - #[rustc_inherit_overflow_checks] - fn nth(&mut self, n: usize) -> Option<(usize, I::Item)> { - self.iter.nth(n).map(|a| { - let i = self.count + n; - self.count = i + 1; - (i, a) - }) - } - - #[inline] - fn count(self) -> usize { - self.iter.count() - } - - #[inline] - #[rustc_inherit_overflow_checks] - fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - let count = &mut self.count; - self.iter.try_fold(init, move |acc, item| { - let acc = fold(acc, (*count, item)); - *count += 1; - acc - }) - } - - #[inline] - #[rustc_inherit_overflow_checks] - fn fold(self, init: Acc, mut fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - let mut count = self.count; - self.iter.fold(init, move |acc, item| { - let acc = fold(acc, (count, item)); - count += 1; - acc - }) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl DoubleEndedIterator for Enumerate where - I: ExactSizeIterator + DoubleEndedIterator -{ - #[inline] - fn next_back(&mut self) -> Option<(usize, ::Item)> { - self.iter.next_back().map(|a| { - let len = self.iter.len(); - // Can safely add, `ExactSizeIterator` promises that the number of - // elements fits into a `usize`. - (self.count + len, a) - }) - } - - #[inline] - fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - // Can safely add and subtract the count, as `ExactSizeIterator` promises - // that the number of elements fits into a `usize`. - let mut count = self.count + self.iter.len(); - self.iter.try_rfold(init, move |acc, item| { - count -= 1; - fold(acc, (count, item)) - }) - } - - #[inline] - fn rfold(self, init: Acc, mut fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - // Can safely add and subtract the count, as `ExactSizeIterator` promises - // that the number of elements fits into a `usize`. - let mut count = self.count + self.iter.len(); - self.iter.rfold(init, move |acc, item| { - count -= 1; - fold(acc, (count, item)) - }) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl ExactSizeIterator for Enumerate where I: ExactSizeIterator { - fn len(&self) -> usize { - self.iter.len() - } - - fn is_empty(&self) -> bool { - self.iter.is_empty() - } -} - -#[doc(hidden)] -unsafe impl TrustedRandomAccess for Enumerate - where I: TrustedRandomAccess -{ - unsafe fn get_unchecked(&mut self, i: usize) -> (usize, I::Item) { - (self.count + i, self.iter.get_unchecked(i)) - } - - fn may_have_side_effect() -> bool { - I::may_have_side_effect() - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for Enumerate where I: FusedIterator {} - -#[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl TrustedLen for Enumerate - where I: TrustedLen, -{} - - -/// An iterator with a `peek()` that returns an optional reference to the next -/// element. -/// -/// This `struct` is created by the [`peekable`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`peekable`]: trait.Iterator.html#method.peekable -/// [`Iterator`]: trait.Iterator.html -#[derive(Clone, Debug)] -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -pub struct Peekable { - iter: I, - /// Remember a peeked value, even if it was None. - peeked: Option>, -} - -// Peekable must remember if a None has been seen in the `.peek()` method. -// It ensures that `.peek(); .peek();` or `.peek(); .next();` only advances the -// underlying iterator at most once. This does not by itself make the iterator -// fused. -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Peekable { - type Item = I::Item; - - #[inline] - fn next(&mut self) -> Option { - match self.peeked.take() { - Some(v) => v, - None => self.iter.next(), - } - } - - #[inline] - #[rustc_inherit_overflow_checks] - fn count(mut self) -> usize { - match self.peeked.take() { - Some(None) => 0, - Some(Some(_)) => 1 + self.iter.count(), - None => self.iter.count(), - } - } - - #[inline] - fn nth(&mut self, n: usize) -> Option { - // FIXME(#43234): merge these when borrow-checking gets better. - if n == 0 { - match self.peeked.take() { - Some(v) => v, - None => self.iter.nth(n), - } - } else { - match self.peeked.take() { - Some(None) => None, - Some(Some(_)) => self.iter.nth(n - 1), - None => self.iter.nth(n), - } - } - } - - #[inline] - fn last(mut self) -> Option { - let peek_opt = match self.peeked.take() { - Some(None) => return None, - Some(v) => v, - None => None, - }; - self.iter.last().or(peek_opt) - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let peek_len = match self.peeked { - Some(None) => return (0, Some(0)), - Some(Some(_)) => 1, - None => 0, - }; - let (lo, hi) = self.iter.size_hint(); - let lo = lo.saturating_add(peek_len); - let hi = hi.and_then(|x| x.checked_add(peek_len)); - (lo, hi) - } - - #[inline] - fn try_fold(&mut self, init: B, mut f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try - { - let acc = match self.peeked.take() { - Some(None) => return Try::from_ok(init), - Some(Some(v)) => f(init, v)?, - None => init, - }; - self.iter.try_fold(acc, f) - } - - #[inline] - fn fold(self, init: Acc, mut fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - let acc = match self.peeked { - Some(None) => return init, - Some(Some(v)) => fold(init, v), - None => init, - }; - self.iter.fold(acc, fold) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl ExactSizeIterator for Peekable {} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for Peekable {} - -impl Peekable { - /// Returns a reference to the next() value without advancing the iterator. - /// - /// Like [`next`], if there is a value, it is wrapped in a `Some(T)`. - /// But if the iteration is over, `None` is returned. - /// - /// [`next`]: trait.Iterator.html#tymethod.next - /// - /// Because `peek()` returns a reference, and many iterators iterate over - /// references, there can be a possibly confusing situation where the - /// return value is a double reference. You can see this effect in the - /// examples below. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// let xs = [1, 2, 3]; - /// - /// let mut iter = xs.iter().peekable(); - /// - /// // peek() lets us see into the future - /// assert_eq!(iter.peek(), Some(&&1)); - /// assert_eq!(iter.next(), Some(&1)); - /// - /// assert_eq!(iter.next(), Some(&2)); - /// - /// // The iterator does not advance even if we `peek` multiple times - /// assert_eq!(iter.peek(), Some(&&3)); - /// assert_eq!(iter.peek(), Some(&&3)); - /// - /// assert_eq!(iter.next(), Some(&3)); - /// - /// // After the iterator is finished, so is `peek()` - /// assert_eq!(iter.peek(), None); - /// assert_eq!(iter.next(), None); - /// ``` - #[inline] - #[stable(feature = "rust1", since = "1.0.0")] - pub fn peek(&mut self) -> Option<&I::Item> { - if self.peeked.is_none() { - self.peeked = Some(self.iter.next()); - } - match self.peeked { - Some(Some(ref value)) => Some(value), - Some(None) => None, - _ => unreachable!(), - } - } -} - -/// An iterator that rejects elements while `predicate` is true. -/// -/// This `struct` is created by the [`skip_while`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`skip_while`]: trait.Iterator.html#method.skip_while -/// [`Iterator`]: trait.Iterator.html -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -#[derive(Clone)] -pub struct SkipWhile { - iter: I, - flag: bool, - predicate: P, -} - -#[stable(feature = "core_impl_debug", since = "1.9.0")] -impl fmt::Debug for SkipWhile { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("SkipWhile") - .field("iter", &self.iter) - .field("flag", &self.flag) - .finish() - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for SkipWhile - where P: FnMut(&I::Item) -> bool -{ - type Item = I::Item; - - #[inline] - fn next(&mut self) -> Option { - let flag = &mut self.flag; - let pred = &mut self.predicate; - self.iter.find(move |x| { - if *flag || !pred(x) { - *flag = true; - true - } else { - false - } - }) - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let (_, upper) = self.iter.size_hint(); - (0, upper) // can't know a lower bound, due to the predicate - } - - #[inline] - fn try_fold(&mut self, mut init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - if !self.flag { - match self.next() { - Some(v) => init = fold(init, v)?, - None => return Try::from_ok(init), - } - } - self.iter.try_fold(init, fold) - } - - #[inline] - fn fold(mut self, mut init: Acc, mut fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - if !self.flag { - match self.next() { - Some(v) => init = fold(init, v), - None => return init, - } - } - self.iter.fold(init, fold) - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for SkipWhile - where I: FusedIterator, P: FnMut(&I::Item) -> bool {} - -/// An iterator that only accepts elements while `predicate` is true. -/// -/// This `struct` is created by the [`take_while`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`take_while`]: trait.Iterator.html#method.take_while -/// [`Iterator`]: trait.Iterator.html -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -#[derive(Clone)] -pub struct TakeWhile { - iter: I, - flag: bool, - predicate: P, -} - -#[stable(feature = "core_impl_debug", since = "1.9.0")] -impl fmt::Debug for TakeWhile { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("TakeWhile") - .field("iter", &self.iter) - .field("flag", &self.flag) - .finish() - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for TakeWhile - where P: FnMut(&I::Item) -> bool -{ - type Item = I::Item; - - #[inline] - fn next(&mut self) -> Option { - if self.flag { - None - } else { - self.iter.next().and_then(|x| { - if (self.predicate)(&x) { - Some(x) - } else { - self.flag = true; - None - } - }) - } - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let (_, upper) = self.iter.size_hint(); - (0, upper) // can't know a lower bound, due to the predicate - } - - #[inline] - fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - if self.flag { - Try::from_ok(init) - } else { - let flag = &mut self.flag; - let p = &mut self.predicate; - self.iter.try_fold(init, move |acc, x|{ - if p(&x) { - LoopState::from_try(fold(acc, x)) - } else { - *flag = true; - LoopState::Break(Try::from_ok(acc)) - } - }).into_try() - } - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for TakeWhile - where I: FusedIterator, P: FnMut(&I::Item) -> bool {} - -/// An iterator that skips over `n` elements of `iter`. -/// -/// This `struct` is created by the [`skip`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`skip`]: trait.Iterator.html#method.skip -/// [`Iterator`]: trait.Iterator.html -#[derive(Clone, Debug)] -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -pub struct Skip { - iter: I, - n: usize -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Skip where I: Iterator { - type Item = ::Item; - - #[inline] - fn next(&mut self) -> Option { - if self.n == 0 { - self.iter.next() - } else { - let old_n = self.n; - self.n = 0; - self.iter.nth(old_n) - } - } - - #[inline] - fn nth(&mut self, n: usize) -> Option { - // Can't just add n + self.n due to overflow. - if self.n == 0 { - self.iter.nth(n) - } else { - let to_skip = self.n; - self.n = 0; - // nth(n) skips n+1 - if self.iter.nth(to_skip-1).is_none() { - return None; - } - self.iter.nth(n) - } - } - - #[inline] - fn count(self) -> usize { - self.iter.count().saturating_sub(self.n) - } - - #[inline] - fn last(mut self) -> Option { - if self.n == 0 { - self.iter.last() - } else { - let next = self.next(); - if next.is_some() { - // recurse. n should be 0. - self.last().or(next) - } else { - None - } - } - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let (lower, upper) = self.iter.size_hint(); - - let lower = lower.saturating_sub(self.n); - let upper = upper.map(|x| x.saturating_sub(self.n)); - - (lower, upper) - } - - #[inline] - fn try_fold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - let n = self.n; - self.n = 0; - if n > 0 { - // nth(n) skips n+1 - if self.iter.nth(n - 1).is_none() { - return Try::from_ok(init); - } - } - self.iter.try_fold(init, fold) - } - - #[inline] - fn fold(mut self, init: Acc, fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - if self.n > 0 { - // nth(n) skips n+1 - if self.iter.nth(self.n - 1).is_none() { - return init; - } - } - self.iter.fold(init, fold) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl ExactSizeIterator for Skip where I: ExactSizeIterator {} - -#[stable(feature = "double_ended_skip_iterator", since = "1.9.0")] -impl DoubleEndedIterator for Skip where I: DoubleEndedIterator + ExactSizeIterator { - fn next_back(&mut self) -> Option { - if self.len() > 0 { - self.iter.next_back() - } else { - None - } - } - - fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - let mut n = self.len(); - if n == 0 { - Try::from_ok(init) - } else { - self.iter.try_rfold(init, move |acc, x| { - n -= 1; - let r = fold(acc, x); - if n == 0 { LoopState::Break(r) } - else { LoopState::from_try(r) } - }).into_try() - } - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for Skip where I: FusedIterator {} - -/// An iterator that only iterates over the first `n` iterations of `iter`. -/// -/// This `struct` is created by the [`take`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`take`]: trait.Iterator.html#method.take -/// [`Iterator`]: trait.Iterator.html -#[derive(Clone, Debug)] -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -pub struct Take { - iter: I, - n: usize -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Take where I: Iterator{ - type Item = ::Item; - - #[inline] - fn next(&mut self) -> Option<::Item> { - if self.n != 0 { - self.n -= 1; - self.iter.next() - } else { - None - } - } - - #[inline] - fn nth(&mut self, n: usize) -> Option { - if self.n > n { - self.n -= n + 1; - self.iter.nth(n) - } else { - if self.n > 0 { - self.iter.nth(self.n - 1); - self.n = 0; - } - None - } - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let (lower, upper) = self.iter.size_hint(); - - let lower = cmp::min(lower, self.n); - - let upper = match upper { - Some(x) if x < self.n => Some(x), - _ => Some(self.n) - }; - - (lower, upper) - } - - #[inline] - fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - if self.n == 0 { - Try::from_ok(init) - } else { - let n = &mut self.n; - self.iter.try_fold(init, move |acc, x| { - *n -= 1; - let r = fold(acc, x); - if *n == 0 { LoopState::Break(r) } - else { LoopState::from_try(r) } - }).into_try() - } - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl ExactSizeIterator for Take where I: ExactSizeIterator {} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for Take where I: FusedIterator {} - -#[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl TrustedLen for Take {} - -/// An iterator to maintain state while iterating another iterator. -/// -/// This `struct` is created by the [`scan`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`scan`]: trait.Iterator.html#method.scan -/// [`Iterator`]: trait.Iterator.html -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -#[derive(Clone)] -pub struct Scan { - iter: I, - f: F, - state: St, -} - -#[stable(feature = "core_impl_debug", since = "1.9.0")] -impl fmt::Debug for Scan { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Scan") - .field("iter", &self.iter) - .field("state", &self.state) - .finish() - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Scan where - I: Iterator, - F: FnMut(&mut St, I::Item) -> Option, -{ - type Item = B; - - #[inline] - fn next(&mut self) -> Option { - self.iter.next().and_then(|a| (self.f)(&mut self.state, a)) - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let (_, upper) = self.iter.size_hint(); - (0, upper) // can't know a lower bound, due to the scan function - } - - #[inline] - fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - let state = &mut self.state; - let f = &mut self.f; - self.iter.try_fold(init, move |acc, x| { - match f(state, x) { - None => LoopState::Break(Try::from_ok(acc)), - Some(x) => LoopState::from_try(fold(acc, x)), - } - }).into_try() - } -} - -/// An iterator that maps each element to an iterator, and yields the elements -/// of the produced iterators. -/// -/// This `struct` is created by the [`flat_map`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`flat_map`]: trait.Iterator.html#method.flat_map -/// [`Iterator`]: trait.Iterator.html -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -pub struct FlatMap { - inner: FlattenCompat, ::IntoIter> -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Clone for FlatMap - where ::IntoIter: Clone -{ - fn clone(&self) -> Self { FlatMap { inner: self.inner.clone() } } -} - -#[stable(feature = "core_impl_debug", since = "1.9.0")] -impl fmt::Debug for FlatMap - where U::IntoIter: fmt::Debug -{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("FlatMap").field("inner", &self.inner).finish() - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for FlatMap - where F: FnMut(I::Item) -> U, -{ - type Item = U::Item; - - #[inline] - fn next(&mut self) -> Option { self.inner.next() } - - #[inline] - fn size_hint(&self) -> (usize, Option) { self.inner.size_hint() } - - #[inline] - fn try_fold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - self.inner.try_fold(init, fold) - } - - #[inline] - fn fold(self, init: Acc, fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - self.inner.fold(init, fold) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl DoubleEndedIterator for FlatMap - where F: FnMut(I::Item) -> U, - U: IntoIterator, - U::IntoIter: DoubleEndedIterator -{ - #[inline] - fn next_back(&mut self) -> Option { self.inner.next_back() } - - #[inline] - fn try_rfold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - self.inner.try_rfold(init, fold) - } - - #[inline] - fn rfold(self, init: Acc, fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - self.inner.rfold(init, fold) - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for FlatMap - where I: FusedIterator, U: IntoIterator, F: FnMut(I::Item) -> U {} - -/// An iterator that flattens one level of nesting in an iterator of things -/// that can be turned into iterators. -/// -/// This `struct` is created by the [`flatten`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`flatten`]: trait.Iterator.html#method.flatten -/// [`Iterator`]: trait.Iterator.html -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "iterator_flatten", since = "1.29.0")] -pub struct Flatten -where I::Item: IntoIterator { - inner: FlattenCompat::IntoIter>, -} - -#[stable(feature = "iterator_flatten", since = "1.29.0")] -impl fmt::Debug for Flatten - where I: Iterator + fmt::Debug, U: Iterator + fmt::Debug, - I::Item: IntoIterator, -{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Flatten").field("inner", &self.inner).finish() - } -} - -#[stable(feature = "iterator_flatten", since = "1.29.0")] -impl Clone for Flatten - where I: Iterator + Clone, U: Iterator + Clone, - I::Item: IntoIterator, -{ - fn clone(&self) -> Self { Flatten { inner: self.inner.clone() } } -} - -#[stable(feature = "iterator_flatten", since = "1.29.0")] -impl Iterator for Flatten - where I: Iterator, U: Iterator, - I::Item: IntoIterator -{ - type Item = U::Item; - - #[inline] - fn next(&mut self) -> Option { self.inner.next() } - - #[inline] - fn size_hint(&self) -> (usize, Option) { self.inner.size_hint() } - - #[inline] - fn try_fold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - self.inner.try_fold(init, fold) - } - - #[inline] - fn fold(self, init: Acc, fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - self.inner.fold(init, fold) - } -} - -#[stable(feature = "iterator_flatten", since = "1.29.0")] -impl DoubleEndedIterator for Flatten - where I: DoubleEndedIterator, U: DoubleEndedIterator, - I::Item: IntoIterator -{ - #[inline] - fn next_back(&mut self) -> Option { self.inner.next_back() } - - #[inline] - fn try_rfold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - self.inner.try_rfold(init, fold) - } - - #[inline] - fn rfold(self, init: Acc, fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - self.inner.rfold(init, fold) - } -} - -#[stable(feature = "iterator_flatten", since = "1.29.0")] -impl FusedIterator for Flatten - where I: FusedIterator, U: Iterator, - I::Item: IntoIterator {} - -/// Adapts an iterator by flattening it, for use in `flatten()` and `flat_map()`. -fn flatten_compat(iter: I) -> FlattenCompat { - FlattenCompat { iter, frontiter: None, backiter: None } -} - -/// Real logic of both `Flatten` and `FlatMap` which simply delegate to -/// this type. -#[derive(Clone, Debug)] -struct FlattenCompat { - iter: I, - frontiter: Option, - backiter: Option, -} - -impl Iterator for FlattenCompat - where I: Iterator, U: Iterator, - I::Item: IntoIterator -{ - type Item = U::Item; - - #[inline] - fn next(&mut self) -> Option { - loop { - if let Some(ref mut inner) = self.frontiter { - if let elt@Some(_) = inner.next() { return elt } - } - match self.iter.next() { - None => return self.backiter.as_mut().and_then(|it| it.next()), - Some(inner) => self.frontiter = Some(inner.into_iter()), - } - } - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - let (flo, fhi) = self.frontiter.as_ref().map_or((0, Some(0)), |it| it.size_hint()); - let (blo, bhi) = self.backiter.as_ref().map_or((0, Some(0)), |it| it.size_hint()); - let lo = flo.saturating_add(blo); - match (self.iter.size_hint(), fhi, bhi) { - ((0, Some(0)), Some(a), Some(b)) => (lo, a.checked_add(b)), - _ => (lo, None) - } - } - - #[inline] - fn try_fold(&mut self, mut init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - if let Some(ref mut front) = self.frontiter { - init = front.try_fold(init, &mut fold)?; - } - self.frontiter = None; - - { - let frontiter = &mut self.frontiter; - init = self.iter.try_fold(init, |acc, x| { - let mut mid = x.into_iter(); - let r = mid.try_fold(acc, &mut fold); - *frontiter = Some(mid); - r - })?; - } - self.frontiter = None; - - if let Some(ref mut back) = self.backiter { - init = back.try_fold(init, &mut fold)?; - } - self.backiter = None; - - Try::from_ok(init) - } - - #[inline] - fn fold(self, init: Acc, mut fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - self.frontiter.into_iter() - .chain(self.iter.map(IntoIterator::into_iter)) - .chain(self.backiter) - .fold(init, |acc, iter| iter.fold(acc, &mut fold)) - } -} - -impl DoubleEndedIterator for FlattenCompat - where I: DoubleEndedIterator, U: DoubleEndedIterator, - I::Item: IntoIterator -{ - #[inline] - fn next_back(&mut self) -> Option { - loop { - if let Some(ref mut inner) = self.backiter { - if let elt@Some(_) = inner.next_back() { return elt } - } - match self.iter.next_back() { - None => return self.frontiter.as_mut().and_then(|it| it.next_back()), - next => self.backiter = next.map(IntoIterator::into_iter), - } - } - } - - #[inline] - fn try_rfold(&mut self, mut init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - if let Some(ref mut back) = self.backiter { - init = back.try_rfold(init, &mut fold)?; - } - self.backiter = None; - - { - let backiter = &mut self.backiter; - init = self.iter.try_rfold(init, |acc, x| { - let mut mid = x.into_iter(); - let r = mid.try_rfold(acc, &mut fold); - *backiter = Some(mid); - r - })?; - } - self.backiter = None; - - if let Some(ref mut front) = self.frontiter { - init = front.try_rfold(init, &mut fold)?; - } - self.frontiter = None; - - Try::from_ok(init) - } - - #[inline] - fn rfold(self, init: Acc, mut fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - self.frontiter.into_iter() - .chain(self.iter.map(IntoIterator::into_iter)) - .chain(self.backiter) - .rfold(init, |acc, iter| iter.rfold(acc, &mut fold)) - } -} - -/// An iterator that yields `None` forever after the underlying iterator -/// yields `None` once. -/// -/// This `struct` is created by the [`fuse`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`fuse`]: trait.Iterator.html#method.fuse -/// [`Iterator`]: trait.Iterator.html -#[derive(Clone, Debug)] -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -pub struct Fuse { - iter: I, - done: bool -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for Fuse where I: Iterator {} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Fuse where I: Iterator { - type Item = ::Item; - - #[inline] - default fn next(&mut self) -> Option<::Item> { - if self.done { - None - } else { - let next = self.iter.next(); - self.done = next.is_none(); - next - } - } - - #[inline] - default fn nth(&mut self, n: usize) -> Option { - if self.done { - None - } else { - let nth = self.iter.nth(n); - self.done = nth.is_none(); - nth - } - } - - #[inline] - default fn last(self) -> Option { - if self.done { - None - } else { - self.iter.last() - } - } - - #[inline] - default fn count(self) -> usize { - if self.done { - 0 - } else { - self.iter.count() - } - } - - #[inline] - default fn size_hint(&self) -> (usize, Option) { - if self.done { - (0, Some(0)) - } else { - self.iter.size_hint() - } - } - - #[inline] - default fn try_fold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - if self.done { - Try::from_ok(init) - } else { - let acc = self.iter.try_fold(init, fold)?; - self.done = true; - Try::from_ok(acc) - } - } - - #[inline] - default fn fold(self, init: Acc, fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - if self.done { - init - } else { - self.iter.fold(init, fold) - } - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl DoubleEndedIterator for Fuse where I: DoubleEndedIterator { - #[inline] - default fn next_back(&mut self) -> Option<::Item> { - if self.done { - None - } else { - let next = self.iter.next_back(); - self.done = next.is_none(); - next - } - } - - #[inline] - default fn try_rfold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - if self.done { - Try::from_ok(init) - } else { - let acc = self.iter.try_rfold(init, fold)?; - self.done = true; - Try::from_ok(acc) - } - } - - #[inline] - default fn rfold(self, init: Acc, fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - if self.done { - init - } else { - self.iter.rfold(init, fold) - } - } -} - -unsafe impl TrustedRandomAccess for Fuse - where I: TrustedRandomAccess, -{ - unsafe fn get_unchecked(&mut self, i: usize) -> I::Item { - self.iter.get_unchecked(i) - } - - fn may_have_side_effect() -> bool { - I::may_have_side_effect() - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl Iterator for Fuse where I: FusedIterator { - #[inline] - fn next(&mut self) -> Option<::Item> { - self.iter.next() - } - - #[inline] - fn nth(&mut self, n: usize) -> Option { - self.iter.nth(n) - } - - #[inline] - fn last(self) -> Option { - self.iter.last() - } - - #[inline] - fn count(self) -> usize { - self.iter.count() - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - self.iter.size_hint() - } - - #[inline] - fn try_fold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - self.iter.try_fold(init, fold) - } - - #[inline] - fn fold(self, init: Acc, fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - self.iter.fold(init, fold) - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl DoubleEndedIterator for Fuse - where I: DoubleEndedIterator + FusedIterator -{ - #[inline] - fn next_back(&mut self) -> Option<::Item> { - self.iter.next_back() - } - - #[inline] - fn try_rfold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - self.iter.try_rfold(init, fold) - } - - #[inline] - fn rfold(self, init: Acc, fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - self.iter.rfold(init, fold) - } -} - - -#[stable(feature = "rust1", since = "1.0.0")] -impl ExactSizeIterator for Fuse where I: ExactSizeIterator { - fn len(&self) -> usize { - self.iter.len() - } - - fn is_empty(&self) -> bool { - self.iter.is_empty() - } -} - -/// An iterator that calls a function with a reference to each element before -/// yielding it. -/// -/// This `struct` is created by the [`inspect`] method on [`Iterator`]. See its -/// documentation for more. -/// -/// [`inspect`]: trait.Iterator.html#method.inspect -/// [`Iterator`]: trait.Iterator.html -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -#[stable(feature = "rust1", since = "1.0.0")] -#[derive(Clone)] -pub struct Inspect { - iter: I, - f: F, -} - -#[stable(feature = "core_impl_debug", since = "1.9.0")] -impl fmt::Debug for Inspect { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("Inspect") - .field("iter", &self.iter) - .finish() - } -} - -impl Inspect where F: FnMut(&I::Item) { - #[inline] - fn do_inspect(&mut self, elt: Option) -> Option { - if let Some(ref a) = elt { - (self.f)(a); - } - - elt - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl Iterator for Inspect where F: FnMut(&I::Item) { - type Item = I::Item; - - #[inline] - fn next(&mut self) -> Option { - let next = self.iter.next(); - self.do_inspect(next) - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - self.iter.size_hint() - } - - #[inline] - fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - let f = &mut self.f; - self.iter.try_fold(init, move |acc, item| { f(&item); fold(acc, item) }) - } - - #[inline] - fn fold(self, init: Acc, mut fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - let mut f = self.f; - self.iter.fold(init, move |acc, item| { f(&item); fold(acc, item) }) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl DoubleEndedIterator for Inspect - where F: FnMut(&I::Item), -{ - #[inline] - fn next_back(&mut self) -> Option { - let next = self.iter.next_back(); - self.do_inspect(next) - } - - #[inline] - fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try - { - let f = &mut self.f; - self.iter.try_rfold(init, move |acc, item| { f(&item); fold(acc, item) }) - } - - #[inline] - fn rfold(self, init: Acc, mut fold: Fold) -> Acc - where Fold: FnMut(Acc, Self::Item) -> Acc, - { - let mut f = self.f; - self.iter.rfold(init, move |acc, item| { f(&item); fold(acc, item) }) - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl ExactSizeIterator for Inspect - where F: FnMut(&I::Item) -{ - fn len(&self) -> usize { - self.iter.len() - } - - fn is_empty(&self) -> bool { - self.iter.is_empty() - } -} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for Inspect - where F: FnMut(&I::Item) {} diff --git a/src/libcore/iter/range.rs b/src/libcore/iter/range.rs index 55addd86bc1..66c09a0ddd0 100644 --- a/src/libcore/iter/range.rs +++ b/src/libcore/iter/range.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use convert::TryFrom; use mem; use ops::{self, Add, Sub}; @@ -166,14 +156,14 @@ macro_rules! step_impl_no_between { } step_impl_unsigned!(usize u8 u16); -#[cfg(not(target_pointer_witdth = "16"))] +#[cfg(not(target_pointer_width = "16"))] step_impl_unsigned!(u32); -#[cfg(target_pointer_witdth = "16")] +#[cfg(target_pointer_width = "16")] step_impl_no_between!(u32); step_impl_signed!([isize: usize] [i8: u8] [i16: u16]); -#[cfg(not(target_pointer_witdth = "16"))] +#[cfg(not(target_pointer_width = "16"))] step_impl_signed!([i32: u32]); -#[cfg(target_pointer_witdth = "16")] +#[cfg(target_pointer_width = "16")] step_impl_no_between!(i32); #[cfg(target_pointer_width = "64")] step_impl_unsigned!(u64); diff --git a/src/libcore/iter/sources.rs b/src/libcore/iter/sources.rs index 7fa3a4bcce7..2590fa6023a 100644 --- a/src/libcore/iter/sources.rs +++ b/src/libcore/iter/sources.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use fmt; use marker; use usize; @@ -386,3 +376,277 @@ impl FusedIterator for Once {} pub fn once(value: T) -> Once { Once { inner: Some(value).into_iter() } } + +/// An iterator that repeats elements of type `A` endlessly by +/// applying the provided closure `F: FnMut() -> A`. +/// +/// This `struct` is created by the [`once_with`] function. +/// See its documentation for more. +/// +/// [`once_with`]: fn.once_with.html +#[derive(Copy, Clone, Debug)] +#[unstable(feature = "iter_once_with", issue = "57581")] +pub struct OnceWith { + gen: Option, +} + +#[unstable(feature = "iter_once_with", issue = "57581")] +impl A> Iterator for OnceWith { + type Item = A; + + #[inline] + fn next(&mut self) -> Option { + self.gen.take().map(|f| f()) + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + self.gen.iter().size_hint() + } +} + +#[unstable(feature = "iter_once_with", issue = "57581")] +impl A> DoubleEndedIterator for OnceWith { + fn next_back(&mut self) -> Option { + self.next() + } +} + +#[unstable(feature = "iter_once_with", issue = "57581")] +impl A> ExactSizeIterator for OnceWith { + fn len(&self) -> usize { + self.gen.iter().len() + } +} + +#[unstable(feature = "iter_once_with", issue = "57581")] +impl A> FusedIterator for OnceWith {} + +#[unstable(feature = "iter_once_with", issue = "57581")] +unsafe impl A> TrustedLen for OnceWith {} + +/// Creates an iterator that lazily generates a value exactly once by invoking +/// the provided closure. +/// +/// This is commonly used to adapt a single value generator into a [`chain`] of +/// other kinds of iteration. Maybe you have an iterator that covers almost +/// everything, but you need an extra special case. Maybe you have a function +/// which works on iterators, but you only need to process one value. +/// +/// Unlike [`once`], this function will lazily generate the value on request. +/// +/// [`once`]: fn.once.html +/// [`chain`]: trait.Iterator.html#method.chain +/// +/// # Examples +/// +/// Basic usage: +/// +/// ``` +/// #![feature(iter_once_with)] +/// +/// use std::iter; +/// +/// // one is the loneliest number +/// let mut one = iter::once_with(|| 1); +/// +/// assert_eq!(Some(1), one.next()); +/// +/// // just one, that's all we get +/// assert_eq!(None, one.next()); +/// ``` +/// +/// Chaining together with another iterator. Let's say that we want to iterate +/// over each file of the `.foo` directory, but also a configuration file, +/// `.foorc`: +/// +/// ```no_run +/// #![feature(iter_once_with)] +/// +/// use std::iter; +/// use std::fs; +/// use std::path::PathBuf; +/// +/// let dirs = fs::read_dir(".foo").unwrap(); +/// +/// // we need to convert from an iterator of DirEntry-s to an iterator of +/// // PathBufs, so we use map +/// let dirs = dirs.map(|file| file.unwrap().path()); +/// +/// // now, our iterator just for our config file +/// let config = iter::once_with(|| PathBuf::from(".foorc")); +/// +/// // chain the two iterators together into one big iterator +/// let files = dirs.chain(config); +/// +/// // this will give us all of the files in .foo as well as .foorc +/// for f in files { +/// println!("{:?}", f); +/// } +/// ``` +#[inline] +#[unstable(feature = "iter_once_with", issue = "57581")] +pub fn once_with A>(gen: F) -> OnceWith { + OnceWith { gen: Some(gen) } +} + +/// Creates a new iterator where each iteration calls the provided closure +/// `F: FnMut(&mut St) -> Option`. +/// +/// This allows creating a custom iterator with any behavior +/// without using the more verbose syntax of creating a dedicated type +/// and implementing the `Iterator` trait for it. +/// +/// In addition to its captures and environment, +/// the closure is given a mutable reference to some state +/// that is preserved across iterations. +/// That state starts as the given `initial_state` value. +/// +/// Note that the `Unfold` iterator doesn’t make assumptions about the behavior of the closure, +/// and therefore conservatively does not implement [`FusedIterator`], +/// or override [`Iterator::size_hint`] from its default `(0, None)`. +/// +/// [`FusedIterator`]: trait.FusedIterator.html +/// [`Iterator::size_hint`]: trait.Iterator.html#method.size_hint +/// +/// # Examples +/// +/// Let’s re-implement the counter iterator from [module-level documentation]: +/// +/// [module-level documentation]: index.html +/// +/// ``` +/// #![feature(iter_unfold)] +/// let counter = std::iter::unfold(0, |count| { +/// // Increment our count. This is why we started at zero. +/// *count += 1; +/// +/// // Check to see if we've finished counting or not. +/// if *count < 6 { +/// Some(*count) +/// } else { +/// None +/// } +/// }); +/// assert_eq!(counter.collect::>(), &[1, 2, 3, 4, 5]); +/// ``` +#[inline] +#[unstable(feature = "iter_unfold", issue = "55977")] +pub fn unfold(initial_state: St, f: F) -> Unfold + where F: FnMut(&mut St) -> Option +{ + Unfold { + state: initial_state, + f, + } +} + +/// An iterator where each iteration calls the provided closure `F: FnMut(&mut St) -> Option`. +/// +/// This `struct` is created by the [`unfold`] function. +/// See its documentation for more. +/// +/// [`unfold`]: fn.unfold.html +#[derive(Clone)] +#[unstable(feature = "iter_unfold", issue = "55977")] +pub struct Unfold { + state: St, + f: F, +} + +#[unstable(feature = "iter_unfold", issue = "55977")] +impl Iterator for Unfold + where F: FnMut(&mut St) -> Option +{ + type Item = T; + + #[inline] + fn next(&mut self) -> Option { + (self.f)(&mut self.state) + } +} + +#[unstable(feature = "iter_unfold", issue = "55977")] +impl fmt::Debug for Unfold { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Unfold") + .field("state", &self.state) + .finish() + } +} + +/// Creates a new iterator where each successive item is computed based on the preceding one. +/// +/// The iterator starts with the given first item (if any) +/// and calls the given `FnMut(&T) -> Option` closure to compute each item’s successor. +/// +/// ``` +/// #![feature(iter_unfold)] +/// use std::iter::successors; +/// +/// let powers_of_10 = successors(Some(1_u16), |n| n.checked_mul(10)); +/// assert_eq!(powers_of_10.collect::>(), &[1, 10, 100, 1_000, 10_000]); +/// ``` +#[unstable(feature = "iter_unfold", issue = "55977")] +pub fn successors(first: Option, succ: F) -> Successors + where F: FnMut(&T) -> Option +{ + // If this function returned `impl Iterator` + // it could be based on `unfold` and not need a dedicated type. + // However having a named `Successors` type allows it to be `Clone` when `T` and `F` are. + Successors { + next: first, + succ, + } +} + +/// An new iterator where each successive item is computed based on the preceding one. +/// +/// This `struct` is created by the [`successors`] function. +/// See its documentation for more. +/// +/// [`successors`]: fn.successors.html +#[derive(Clone)] +#[unstable(feature = "iter_unfold", issue = "55977")] +pub struct Successors { + next: Option, + succ: F, +} + +#[unstable(feature = "iter_unfold", issue = "55977")] +impl Iterator for Successors + where F: FnMut(&T) -> Option +{ + type Item = T; + + #[inline] + fn next(&mut self) -> Option { + self.next.take().map(|item| { + self.next = (self.succ)(&item); + item + }) + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + if self.next.is_some() { + (1, None) + } else { + (0, Some(0)) + } + } +} + +#[unstable(feature = "iter_unfold", issue = "55977")] +impl FusedIterator for Successors + where F: FnMut(&T) -> Option +{} + +#[unstable(feature = "iter_unfold", issue = "55977")] +impl fmt::Debug for Successors { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Successors") + .field("next", &self.next) + .finish() + } +} diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs deleted file mode 100644 index d2c5a3bed28..00000000000 --- a/src/libcore/iter/traits.rs +++ /dev/null @@ -1,1002 +0,0 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -use ops::{Mul, Add, Try}; -use num::Wrapping; - -use super::LoopState; - -/// Conversion from an `Iterator`. -/// -/// By implementing `FromIterator` for a type, you define how it will be -/// created from an iterator. This is common for types which describe a -/// collection of some kind. -/// -/// `FromIterator`'s [`from_iter`] is rarely called explicitly, and is instead -/// used through [`Iterator`]'s [`collect`] method. See [`collect`]'s -/// documentation for more examples. -/// -/// [`from_iter`]: #tymethod.from_iter -/// [`Iterator`]: trait.Iterator.html -/// [`collect`]: trait.Iterator.html#method.collect -/// -/// See also: [`IntoIterator`]. -/// -/// [`IntoIterator`]: trait.IntoIterator.html -/// -/// # Examples -/// -/// Basic usage: -/// -/// ``` -/// use std::iter::FromIterator; -/// -/// let five_fives = std::iter::repeat(5).take(5); -/// -/// let v = Vec::from_iter(five_fives); -/// -/// assert_eq!(v, vec![5, 5, 5, 5, 5]); -/// ``` -/// -/// Using [`collect`] to implicitly use `FromIterator`: -/// -/// ``` -/// let five_fives = std::iter::repeat(5).take(5); -/// -/// let v: Vec = five_fives.collect(); -/// -/// assert_eq!(v, vec![5, 5, 5, 5, 5]); -/// ``` -/// -/// Implementing `FromIterator` for your type: -/// -/// ``` -/// use std::iter::FromIterator; -/// -/// // A sample collection, that's just a wrapper over Vec -/// #[derive(Debug)] -/// struct MyCollection(Vec); -/// -/// // Let's give it some methods so we can create one and add things -/// // to it. -/// impl MyCollection { -/// fn new() -> MyCollection { -/// MyCollection(Vec::new()) -/// } -/// -/// fn add(&mut self, elem: i32) { -/// self.0.push(elem); -/// } -/// } -/// -/// // and we'll implement FromIterator -/// impl FromIterator for MyCollection { -/// fn from_iter>(iter: I) -> Self { -/// let mut c = MyCollection::new(); -/// -/// for i in iter { -/// c.add(i); -/// } -/// -/// c -/// } -/// } -/// -/// // Now we can make a new iterator... -/// let iter = (0..5).into_iter(); -/// -/// // ... and make a MyCollection out of it -/// let c = MyCollection::from_iter(iter); -/// -/// assert_eq!(c.0, vec![0, 1, 2, 3, 4]); -/// -/// // collect works too! -/// -/// let iter = (0..5).into_iter(); -/// let c: MyCollection = iter.collect(); -/// -/// assert_eq!(c.0, vec![0, 1, 2, 3, 4]); -/// ``` -#[stable(feature = "rust1", since = "1.0.0")] -#[rustc_on_unimplemented( - message="a collection of type `{Self}` cannot be built from an iterator \ - over elements of type `{A}`", - label="a collection of type `{Self}` cannot be built from `std::iter::Iterator`", -)] -pub trait FromIterator: Sized { - /// Creates a value from an iterator. - /// - /// See the [module-level documentation] for more. - /// - /// [module-level documentation]: index.html - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// use std::iter::FromIterator; - /// - /// let five_fives = std::iter::repeat(5).take(5); - /// - /// let v = Vec::from_iter(five_fives); - /// - /// assert_eq!(v, vec![5, 5, 5, 5, 5]); - /// ``` - #[stable(feature = "rust1", since = "1.0.0")] - fn from_iter>(iter: T) -> Self; -} - -/// Conversion into an `Iterator`. -/// -/// By implementing `IntoIterator` for a type, you define how it will be -/// converted to an iterator. This is common for types which describe a -/// collection of some kind. -/// -/// One benefit of implementing `IntoIterator` is that your type will [work -/// with Rust's `for` loop syntax](index.html#for-loops-and-intoiterator). -/// -/// See also: [`FromIterator`]. -/// -/// [`FromIterator`]: trait.FromIterator.html -/// -/// # Examples -/// -/// Basic usage: -/// -/// ``` -/// let v = vec![1, 2, 3]; -/// let mut iter = v.into_iter(); -/// -/// assert_eq!(Some(1), iter.next()); -/// assert_eq!(Some(2), iter.next()); -/// assert_eq!(Some(3), iter.next()); -/// assert_eq!(None, iter.next()); -/// ``` -/// Implementing `IntoIterator` for your type: -/// -/// ``` -/// // A sample collection, that's just a wrapper over Vec -/// #[derive(Debug)] -/// struct MyCollection(Vec); -/// -/// // Let's give it some methods so we can create one and add things -/// // to it. -/// impl MyCollection { -/// fn new() -> MyCollection { -/// MyCollection(Vec::new()) -/// } -/// -/// fn add(&mut self, elem: i32) { -/// self.0.push(elem); -/// } -/// } -/// -/// // and we'll implement IntoIterator -/// impl IntoIterator for MyCollection { -/// type Item = i32; -/// type IntoIter = ::std::vec::IntoIter; -/// -/// fn into_iter(self) -> Self::IntoIter { -/// self.0.into_iter() -/// } -/// } -/// -/// // Now we can make a new collection... -/// let mut c = MyCollection::new(); -/// -/// // ... add some stuff to it ... -/// c.add(0); -/// c.add(1); -/// c.add(2); -/// -/// // ... and then turn it into an Iterator: -/// for (i, n) in c.into_iter().enumerate() { -/// assert_eq!(i as i32, n); -/// } -/// ``` -/// -/// It is common to use `IntoIterator` as a trait bound. This allows -/// the input collection type to change, so long as it is still an -/// iterator. Additional bounds can be specified by restricting on -/// `Item`: -/// -/// ```rust -/// fn collect_as_strings(collection: T) -> Vec -/// where T: IntoIterator, -/// T::Item : std::fmt::Debug, -/// { -/// collection -/// .into_iter() -/// .map(|item| format!("{:?}", item)) -/// .collect() -/// } -/// ``` -#[stable(feature = "rust1", since = "1.0.0")] -pub trait IntoIterator { - /// The type of the elements being iterated over. - #[stable(feature = "rust1", since = "1.0.0")] - type Item; - - /// Which kind of iterator are we turning this into? - #[stable(feature = "rust1", since = "1.0.0")] - type IntoIter: Iterator; - - /// Creates an iterator from a value. - /// - /// See the [module-level documentation] for more. - /// - /// [module-level documentation]: index.html - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// let v = vec![1, 2, 3]; - /// let mut iter = v.into_iter(); - /// - /// assert_eq!(Some(1), iter.next()); - /// assert_eq!(Some(2), iter.next()); - /// assert_eq!(Some(3), iter.next()); - /// assert_eq!(None, iter.next()); - /// ``` - #[stable(feature = "rust1", since = "1.0.0")] - fn into_iter(self) -> Self::IntoIter; -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl IntoIterator for I { - type Item = I::Item; - type IntoIter = I; - - fn into_iter(self) -> I { - self - } -} - -/// Extend a collection with the contents of an iterator. -/// -/// Iterators produce a series of values, and collections can also be thought -/// of as a series of values. The `Extend` trait bridges this gap, allowing you -/// to extend a collection by including the contents of that iterator. When -/// extending a collection with an already existing key, that entry is updated -/// or, in the case of collections that permit multiple entries with equal -/// keys, that entry is inserted. -/// -/// # Examples -/// -/// Basic usage: -/// -/// ``` -/// // You can extend a String with some chars: -/// let mut message = String::from("The first three letters are: "); -/// -/// message.extend(&['a', 'b', 'c']); -/// -/// assert_eq!("abc", &message[29..32]); -/// ``` -/// -/// Implementing `Extend`: -/// -/// ``` -/// // A sample collection, that's just a wrapper over Vec -/// #[derive(Debug)] -/// struct MyCollection(Vec); -/// -/// // Let's give it some methods so we can create one and add things -/// // to it. -/// impl MyCollection { -/// fn new() -> MyCollection { -/// MyCollection(Vec::new()) -/// } -/// -/// fn add(&mut self, elem: i32) { -/// self.0.push(elem); -/// } -/// } -/// -/// // since MyCollection has a list of i32s, we implement Extend for i32 -/// impl Extend for MyCollection { -/// -/// // This is a bit simpler with the concrete type signature: we can call -/// // extend on anything which can be turned into an Iterator which gives -/// // us i32s. Because we need i32s to put into MyCollection. -/// fn extend>(&mut self, iter: T) { -/// -/// // The implementation is very straightforward: loop through the -/// // iterator, and add() each element to ourselves. -/// for elem in iter { -/// self.add(elem); -/// } -/// } -/// } -/// -/// let mut c = MyCollection::new(); -/// -/// c.add(5); -/// c.add(6); -/// c.add(7); -/// -/// // let's extend our collection with three more numbers -/// c.extend(vec![1, 2, 3]); -/// -/// // we've added these elements onto the end -/// assert_eq!("MyCollection([5, 6, 7, 1, 2, 3])", format!("{:?}", c)); -/// ``` -#[stable(feature = "rust1", since = "1.0.0")] -pub trait Extend { - /// Extends a collection with the contents of an iterator. - /// - /// As this is the only method for this trait, the [trait-level] docs - /// contain more details. - /// - /// [trait-level]: trait.Extend.html - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// // You can extend a String with some chars: - /// let mut message = String::from("abc"); - /// - /// message.extend(['d', 'e', 'f'].iter()); - /// - /// assert_eq!("abcdef", &message); - /// ``` - #[stable(feature = "rust1", since = "1.0.0")] - fn extend>(&mut self, iter: T); -} - -#[stable(feature = "extend_for_unit", since = "1.28.0")] -impl Extend<()> for () { - fn extend>(&mut self, iter: T) { - iter.into_iter().for_each(drop) - } -} - -/// An iterator able to yield elements from both ends. -/// -/// Something that implements `DoubleEndedIterator` has one extra capability -/// over something that implements [`Iterator`]: the ability to also take -/// `Item`s from the back, as well as the front. -/// -/// It is important to note that both back and forth work on the same range, -/// and do not cross: iteration is over when they meet in the middle. -/// -/// In a similar fashion to the [`Iterator`] protocol, once a -/// `DoubleEndedIterator` returns `None` from a `next_back()`, calling it again -/// may or may not ever return `Some` again. `next()` and `next_back()` are -/// interchangeable for this purpose. -/// -/// [`Iterator`]: trait.Iterator.html -/// -/// # Examples -/// -/// Basic usage: -/// -/// ``` -/// let numbers = vec![1, 2, 3, 4, 5, 6]; -/// -/// let mut iter = numbers.iter(); -/// -/// assert_eq!(Some(&1), iter.next()); -/// assert_eq!(Some(&6), iter.next_back()); -/// assert_eq!(Some(&5), iter.next_back()); -/// assert_eq!(Some(&2), iter.next()); -/// assert_eq!(Some(&3), iter.next()); -/// assert_eq!(Some(&4), iter.next()); -/// assert_eq!(None, iter.next()); -/// assert_eq!(None, iter.next_back()); -/// ``` -#[stable(feature = "rust1", since = "1.0.0")] -pub trait DoubleEndedIterator: Iterator { - /// Removes and returns an element from the end of the iterator. - /// - /// Returns `None` when there are no more elements. - /// - /// The [trait-level] docs contain more details. - /// - /// [trait-level]: trait.DoubleEndedIterator.html - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// let numbers = vec![1, 2, 3, 4, 5, 6]; - /// - /// let mut iter = numbers.iter(); - /// - /// assert_eq!(Some(&1), iter.next()); - /// assert_eq!(Some(&6), iter.next_back()); - /// assert_eq!(Some(&5), iter.next_back()); - /// assert_eq!(Some(&2), iter.next()); - /// assert_eq!(Some(&3), iter.next()); - /// assert_eq!(Some(&4), iter.next()); - /// assert_eq!(None, iter.next()); - /// assert_eq!(None, iter.next_back()); - /// ``` - #[stable(feature = "rust1", since = "1.0.0")] - fn next_back(&mut self) -> Option; - - /// This is the reverse version of [`try_fold()`]: it takes elements - /// starting from the back of the iterator. - /// - /// [`try_fold()`]: trait.Iterator.html#method.try_fold - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// let a = ["1", "2", "3"]; - /// let sum = a.iter() - /// .map(|&s| s.parse::()) - /// .try_rfold(0, |acc, x| x.and_then(|y| Ok(acc + y))); - /// assert_eq!(sum, Ok(6)); - /// ``` - /// - /// Short-circuiting: - /// - /// ``` - /// let a = ["1", "rust", "3"]; - /// let mut it = a.iter(); - /// let sum = it - /// .by_ref() - /// .map(|&s| s.parse::()) - /// .try_rfold(0, |acc, x| x.and_then(|y| Ok(acc + y))); - /// assert!(sum.is_err()); - /// - /// // Because it short-circuited, the remaining elements are still - /// // available through the iterator. - /// assert_eq!(it.next_back(), Some(&"1")); - /// ``` - #[inline] - #[stable(feature = "iterator_try_fold", since = "1.27.0")] - fn try_rfold(&mut self, init: B, mut f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try - { - let mut accum = init; - while let Some(x) = self.next_back() { - accum = f(accum, x)?; - } - Try::from_ok(accum) - } - - /// An iterator method that reduces the iterator's elements to a single, - /// final value, starting from the back. - /// - /// This is the reverse version of [`fold()`]: it takes elements starting from - /// the back of the iterator. - /// - /// `rfold()` takes two arguments: an initial value, and a closure with two - /// arguments: an 'accumulator', and an element. The closure returns the value that - /// the accumulator should have for the next iteration. - /// - /// The initial value is the value the accumulator will have on the first - /// call. - /// - /// After applying this closure to every element of the iterator, `rfold()` - /// returns the accumulator. - /// - /// This operation is sometimes called 'reduce' or 'inject'. - /// - /// Folding is useful whenever you have a collection of something, and want - /// to produce a single value from it. - /// - /// [`fold()`]: trait.Iterator.html#method.fold - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// let a = [1, 2, 3]; - /// - /// // the sum of all of the elements of a - /// let sum = a.iter() - /// .rfold(0, |acc, &x| acc + x); - /// - /// assert_eq!(sum, 6); - /// ``` - /// - /// This example builds a string, starting with an initial value - /// and continuing with each element from the back until the front: - /// - /// ``` - /// let numbers = [1, 2, 3, 4, 5]; - /// - /// let zero = "0".to_string(); - /// - /// let result = numbers.iter().rfold(zero, |acc, &x| { - /// format!("({} + {})", x, acc) - /// }); - /// - /// assert_eq!(result, "(1 + (2 + (3 + (4 + (5 + 0)))))"); - /// ``` - #[inline] - #[stable(feature = "iter_rfold", since = "1.27.0")] - fn rfold(mut self, accum: B, mut f: F) -> B where - Self: Sized, F: FnMut(B, Self::Item) -> B, - { - self.try_rfold(accum, move |acc, x| Ok::(f(acc, x))).unwrap() - } - - /// Searches for an element of an iterator from the back that satisfies a predicate. - /// - /// `rfind()` takes a closure that returns `true` or `false`. It applies - /// this closure to each element of the iterator, starting at the end, and if any - /// of them return `true`, then `rfind()` returns [`Some(element)`]. If they all return - /// `false`, it returns [`None`]. - /// - /// `rfind()` is short-circuiting; in other words, it will stop processing - /// as soon as the closure returns `true`. - /// - /// Because `rfind()` takes a reference, and many iterators iterate over - /// references, this leads to a possibly confusing situation where the - /// argument is a double reference. You can see this effect in the - /// examples below, with `&&x`. - /// - /// [`Some(element)`]: ../../std/option/enum.Option.html#variant.Some - /// [`None`]: ../../std/option/enum.Option.html#variant.None - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// let a = [1, 2, 3]; - /// - /// assert_eq!(a.iter().rfind(|&&x| x == 2), Some(&2)); - /// - /// assert_eq!(a.iter().rfind(|&&x| x == 5), None); - /// ``` - /// - /// Stopping at the first `true`: - /// - /// ``` - /// let a = [1, 2, 3]; - /// - /// let mut iter = a.iter(); - /// - /// assert_eq!(iter.rfind(|&&x| x == 2), Some(&2)); - /// - /// // we can still use `iter`, as there are more elements. - /// assert_eq!(iter.next_back(), Some(&1)); - /// ``` - #[inline] - #[stable(feature = "iter_rfind", since = "1.27.0")] - fn rfind

(&mut self, mut predicate: P) -> Option where - Self: Sized, - P: FnMut(&Self::Item) -> bool - { - self.try_rfold((), move |(), x| { - if predicate(&x) { LoopState::Break(x) } - else { LoopState::Continue(()) } - }).break_value() - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I { - fn next_back(&mut self) -> Option { (**self).next_back() } -} - -/// An iterator that knows its exact length. -/// -/// Many [`Iterator`]s don't know how many times they will iterate, but some do. -/// If an iterator knows how many times it can iterate, providing access to -/// that information can be useful. For example, if you want to iterate -/// backwards, a good start is to know where the end is. -/// -/// When implementing an `ExactSizeIterator`, you must also implement -/// [`Iterator`]. When doing so, the implementation of [`size_hint`] *must* -/// return the exact size of the iterator. -/// -/// [`Iterator`]: trait.Iterator.html -/// [`size_hint`]: trait.Iterator.html#method.size_hint -/// -/// The [`len`] method has a default implementation, so you usually shouldn't -/// implement it. However, you may be able to provide a more performant -/// implementation than the default, so overriding it in this case makes sense. -/// -/// [`len`]: #method.len -/// -/// # Examples -/// -/// Basic usage: -/// -/// ``` -/// // a finite range knows exactly how many times it will iterate -/// let five = 0..5; -/// -/// assert_eq!(5, five.len()); -/// ``` -/// -/// In the [module level docs][moddocs], we implemented an [`Iterator`], -/// `Counter`. Let's implement `ExactSizeIterator` for it as well: -/// -/// [moddocs]: index.html -/// -/// ``` -/// # struct Counter { -/// # count: usize, -/// # } -/// # impl Counter { -/// # fn new() -> Counter { -/// # Counter { count: 0 } -/// # } -/// # } -/// # impl Iterator for Counter { -/// # type Item = usize; -/// # fn next(&mut self) -> Option { -/// # self.count += 1; -/// # if self.count < 6 { -/// # Some(self.count) -/// # } else { -/// # None -/// # } -/// # } -/// # } -/// impl ExactSizeIterator for Counter { -/// // We can easily calculate the remaining number of iterations. -/// fn len(&self) -> usize { -/// 5 - self.count -/// } -/// } -/// -/// // And now we can use it! -/// -/// let counter = Counter::new(); -/// -/// assert_eq!(5, counter.len()); -/// ``` -#[stable(feature = "rust1", since = "1.0.0")] -pub trait ExactSizeIterator: Iterator { - /// Returns the exact number of times the iterator will iterate. - /// - /// This method has a default implementation, so you usually should not - /// implement it directly. However, if you can provide a more efficient - /// implementation, you can do so. See the [trait-level] docs for an - /// example. - /// - /// This function has the same safety guarantees as the [`size_hint`] - /// function. - /// - /// [trait-level]: trait.ExactSizeIterator.html - /// [`size_hint`]: trait.Iterator.html#method.size_hint - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// // a finite range knows exactly how many times it will iterate - /// let five = 0..5; - /// - /// assert_eq!(5, five.len()); - /// ``` - #[inline] - #[stable(feature = "rust1", since = "1.0.0")] - fn len(&self) -> usize { - let (lower, upper) = self.size_hint(); - // Note: This assertion is overly defensive, but it checks the invariant - // guaranteed by the trait. If this trait were rust-internal, - // we could use debug_assert!; assert_eq! will check all Rust user - // implementations too. - assert_eq!(upper, Some(lower)); - lower - } - - /// Returns whether the iterator is empty. - /// - /// This method has a default implementation using `self.len()`, so you - /// don't need to implement it yourself. - /// - /// # Examples - /// - /// Basic usage: - /// - /// ``` - /// #![feature(exact_size_is_empty)] - /// - /// let mut one_element = std::iter::once(0); - /// assert!(!one_element.is_empty()); - /// - /// assert_eq!(one_element.next(), Some(0)); - /// assert!(one_element.is_empty()); - /// - /// assert_eq!(one_element.next(), None); - /// ``` - #[inline] - #[unstable(feature = "exact_size_is_empty", issue = "35428")] - fn is_empty(&self) -> bool { - self.len() == 0 - } -} - -#[stable(feature = "rust1", since = "1.0.0")] -impl ExactSizeIterator for &mut I { - fn len(&self) -> usize { - (**self).len() - } - fn is_empty(&self) -> bool { - (**self).is_empty() - } -} - -/// Trait to represent types that can be created by summing up an iterator. -/// -/// This trait is used to implement the [`sum`] method on iterators. Types which -/// implement the trait can be generated by the [`sum`] method. Like -/// [`FromIterator`] this trait should rarely be called directly and instead -/// interacted with through [`Iterator::sum`]. -/// -/// [`sum`]: ../../std/iter/trait.Sum.html#tymethod.sum -/// [`FromIterator`]: ../../std/iter/trait.FromIterator.html -/// [`Iterator::sum`]: ../../std/iter/trait.Iterator.html#method.sum -#[stable(feature = "iter_arith_traits", since = "1.12.0")] -pub trait Sum: Sized { - /// Method which takes an iterator and generates `Self` from the elements by - /// "summing up" the items. - #[stable(feature = "iter_arith_traits", since = "1.12.0")] - fn sum>(iter: I) -> Self; -} - -/// Trait to represent types that can be created by multiplying elements of an -/// iterator. -/// -/// This trait is used to implement the [`product`] method on iterators. Types -/// which implement the trait can be generated by the [`product`] method. Like -/// [`FromIterator`] this trait should rarely be called directly and instead -/// interacted with through [`Iterator::product`]. -/// -/// [`product`]: ../../std/iter/trait.Product.html#tymethod.product -/// [`FromIterator`]: ../../std/iter/trait.FromIterator.html -/// [`Iterator::product`]: ../../std/iter/trait.Iterator.html#method.product -#[stable(feature = "iter_arith_traits", since = "1.12.0")] -pub trait Product: Sized { - /// Method which takes an iterator and generates `Self` from the elements by - /// multiplying the items. - #[stable(feature = "iter_arith_traits", since = "1.12.0")] - fn product>(iter: I) -> Self; -} - -// NB: explicitly use Add and Mul here to inherit overflow checks -macro_rules! integer_sum_product { - (@impls $zero:expr, $one:expr, #[$attr:meta], $($a:ty)*) => ($( - #[$attr] - impl Sum for $a { - fn sum>(iter: I) -> $a { - iter.fold($zero, Add::add) - } - } - - #[$attr] - impl Product for $a { - fn product>(iter: I) -> $a { - iter.fold($one, Mul::mul) - } - } - - #[$attr] - impl<'a> Sum<&'a $a> for $a { - fn sum>(iter: I) -> $a { - iter.fold($zero, Add::add) - } - } - - #[$attr] - impl<'a> Product<&'a $a> for $a { - fn product>(iter: I) -> $a { - iter.fold($one, Mul::mul) - } - } - )*); - ($($a:ty)*) => ( - integer_sum_product!(@impls 0, 1, - #[stable(feature = "iter_arith_traits", since = "1.12.0")], - $($a)+); - integer_sum_product!(@impls Wrapping(0), Wrapping(1), - #[stable(feature = "wrapping_iter_arith", since = "1.14.0")], - $(Wrapping<$a>)+); - ); -} - -macro_rules! float_sum_product { - ($($a:ident)*) => ($( - #[stable(feature = "iter_arith_traits", since = "1.12.0")] - impl Sum for $a { - fn sum>(iter: I) -> $a { - iter.fold(0.0, |a, b| a + b) - } - } - - #[stable(feature = "iter_arith_traits", since = "1.12.0")] - impl Product for $a { - fn product>(iter: I) -> $a { - iter.fold(1.0, |a, b| a * b) - } - } - - #[stable(feature = "iter_arith_traits", since = "1.12.0")] - impl<'a> Sum<&'a $a> for $a { - fn sum>(iter: I) -> $a { - iter.fold(0.0, |a, b| a + *b) - } - } - - #[stable(feature = "iter_arith_traits", since = "1.12.0")] - impl<'a> Product<&'a $a> for $a { - fn product>(iter: I) -> $a { - iter.fold(1.0, |a, b| a * *b) - } - } - )*) -} - -integer_sum_product! { i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize } -float_sum_product! { f32 f64 } - -/// An iterator adapter that produces output as long as the underlying -/// iterator produces `Result::Ok` values. -/// -/// If an error is encountered, the iterator stops and the error is -/// stored. The error may be recovered later via `reconstruct`. -struct ResultShunt { - iter: I, - error: Option, -} - -impl ResultShunt - where I: Iterator> -{ - /// Process the given iterator as if it yielded a `T` instead of a - /// `Result`. Any errors will stop the inner iterator and - /// the overall result will be an error. - pub fn process(iter: I, mut f: F) -> Result - where F: FnMut(&mut Self) -> U - { - let mut shunt = ResultShunt::new(iter); - let value = f(shunt.by_ref()); - shunt.reconstruct(value) - } - - fn new(iter: I) -> Self { - ResultShunt { - iter, - error: None, - } - } - - /// Consume the adapter and rebuild a `Result` value. This should - /// *always* be called, otherwise any potential error would be - /// lost. - fn reconstruct(self, val: U) -> Result { - match self.error { - None => Ok(val), - Some(e) => Err(e), - } - } -} - -impl Iterator for ResultShunt - where I: Iterator> -{ - type Item = T; - - fn next(&mut self) -> Option { - match self.iter.next() { - Some(Ok(v)) => Some(v), - Some(Err(e)) => { - self.error = Some(e); - None - } - None => None, - } - } - - fn size_hint(&self) -> (usize, Option) { - if self.error.is_some() { - (0, Some(0)) - } else { - let (_, upper) = self.iter.size_hint(); - (0, upper) - } - } -} - -#[stable(feature = "iter_arith_traits_result", since="1.16.0")] -impl Sum> for Result - where T: Sum, -{ - /// Takes each element in the `Iterator`: if it is an `Err`, no further - /// elements are taken, and the `Err` is returned. Should no `Err` occur, - /// the sum of all elements is returned. - /// - /// # Examples - /// - /// This sums up every integer in a vector, rejecting the sum if a negative - /// element is encountered: - /// - /// ``` - /// let v = vec![1, 2]; - /// let res: Result = v.iter().map(|&x: &i32| - /// if x < 0 { Err("Negative element found") } - /// else { Ok(x) } - /// ).sum(); - /// assert_eq!(res, Ok(3)); - /// ``` - fn sum(iter: I) -> Result - where I: Iterator>, - { - ResultShunt::process(iter, |i| i.sum()) - } -} - -#[stable(feature = "iter_arith_traits_result", since="1.16.0")] -impl Product> for Result - where T: Product, -{ - /// Takes each element in the `Iterator`: if it is an `Err`, no further - /// elements are taken, and the `Err` is returned. Should no `Err` occur, - /// the product of all elements is returned. - fn product(iter: I) -> Result - where I: Iterator>, - { - ResultShunt::process(iter, |i| i.product()) - } -} - -/// An iterator that always continues to yield `None` when exhausted. -/// -/// Calling next on a fused iterator that has returned `None` once is guaranteed -/// to return [`None`] again. This trait should be implemented by all iterators -/// that behave this way because it allows optimizing [`Iterator::fuse`]. -/// -/// Note: In general, you should not use `FusedIterator` in generic bounds if -/// you need a fused iterator. Instead, you should just call [`Iterator::fuse`] -/// on the iterator. If the iterator is already fused, the additional [`Fuse`] -/// wrapper will be a no-op with no performance penalty. -/// -/// [`None`]: ../../std/option/enum.Option.html#variant.None -/// [`Iterator::fuse`]: ../../std/iter/trait.Iterator.html#method.fuse -/// [`Fuse`]: ../../std/iter/struct.Fuse.html -#[stable(feature = "fused", since = "1.26.0")] -pub trait FusedIterator: Iterator {} - -#[stable(feature = "fused", since = "1.26.0")] -impl FusedIterator for &mut I {} - -/// An iterator that reports an accurate length using size_hint. -/// -/// The iterator reports a size hint where it is either exact -/// (lower bound is equal to upper bound), or the upper bound is [`None`]. -/// The upper bound must only be [`None`] if the actual iterator length is -/// larger than [`usize::MAX`]. In that case, the lower bound must be -/// [`usize::MAX`], resulting in a [`.size_hint`] of `(usize::MAX, None)`. -/// -/// The iterator must produce exactly the number of elements it reported -/// or diverge before reaching the end. -/// -/// # Safety -/// -/// This trait must only be implemented when the contract is upheld. -/// Consumers of this trait must inspect [`.size_hint`]’s upper bound. -/// -/// [`None`]: ../../std/option/enum.Option.html#variant.None -/// [`usize::MAX`]: ../../std/usize/constant.MAX.html -/// [`.size_hint`]: ../../std/iter/trait.Iterator.html#method.size_hint -#[unstable(feature = "trusted_len", issue = "37572")] -pub unsafe trait TrustedLen : Iterator {} - -#[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl TrustedLen for &mut I {} diff --git a/src/libcore/iter/traits/accum.rs b/src/libcore/iter/traits/accum.rs new file mode 100644 index 00000000000..dfe1d2a1006 --- /dev/null +++ b/src/libcore/iter/traits/accum.rs @@ -0,0 +1,225 @@ +use ops::{Mul, Add}; +use num::Wrapping; + +/// Trait to represent types that can be created by summing up an iterator. +/// +/// This trait is used to implement the [`sum`] method on iterators. Types which +/// implement the trait can be generated by the [`sum`] method. Like +/// [`FromIterator`] this trait should rarely be called directly and instead +/// interacted with through [`Iterator::sum`]. +/// +/// [`sum`]: ../../std/iter/trait.Sum.html#tymethod.sum +/// [`FromIterator`]: ../../std/iter/trait.FromIterator.html +/// [`Iterator::sum`]: ../../std/iter/trait.Iterator.html#method.sum +#[stable(feature = "iter_arith_traits", since = "1.12.0")] +pub trait Sum: Sized { + /// Method which takes an iterator and generates `Self` from the elements by + /// "summing up" the items. + #[stable(feature = "iter_arith_traits", since = "1.12.0")] + fn sum>(iter: I) -> Self; +} + +/// Trait to represent types that can be created by multiplying elements of an +/// iterator. +/// +/// This trait is used to implement the [`product`] method on iterators. Types +/// which implement the trait can be generated by the [`product`] method. Like +/// [`FromIterator`] this trait should rarely be called directly and instead +/// interacted with through [`Iterator::product`]. +/// +/// [`product`]: ../../std/iter/trait.Product.html#tymethod.product +/// [`FromIterator`]: ../../std/iter/trait.FromIterator.html +/// [`Iterator::product`]: ../../std/iter/trait.Iterator.html#method.product +#[stable(feature = "iter_arith_traits", since = "1.12.0")] +pub trait Product: Sized { + /// Method which takes an iterator and generates `Self` from the elements by + /// multiplying the items. + #[stable(feature = "iter_arith_traits", since = "1.12.0")] + fn product>(iter: I) -> Self; +} + +// N.B., explicitly use Add and Mul here to inherit overflow checks +macro_rules! integer_sum_product { + (@impls $zero:expr, $one:expr, #[$attr:meta], $($a:ty)*) => ($( + #[$attr] + impl Sum for $a { + fn sum>(iter: I) -> $a { + iter.fold($zero, Add::add) + } + } + + #[$attr] + impl Product for $a { + fn product>(iter: I) -> $a { + iter.fold($one, Mul::mul) + } + } + + #[$attr] + impl<'a> Sum<&'a $a> for $a { + fn sum>(iter: I) -> $a { + iter.fold($zero, Add::add) + } + } + + #[$attr] + impl<'a> Product<&'a $a> for $a { + fn product>(iter: I) -> $a { + iter.fold($one, Mul::mul) + } + } + )*); + ($($a:ty)*) => ( + integer_sum_product!(@impls 0, 1, + #[stable(feature = "iter_arith_traits", since = "1.12.0")], + $($a)+); + integer_sum_product!(@impls Wrapping(0), Wrapping(1), + #[stable(feature = "wrapping_iter_arith", since = "1.14.0")], + $(Wrapping<$a>)+); + ); +} + +macro_rules! float_sum_product { + ($($a:ident)*) => ($( + #[stable(feature = "iter_arith_traits", since = "1.12.0")] + impl Sum for $a { + fn sum>(iter: I) -> $a { + iter.fold(0.0, |a, b| a + b) + } + } + + #[stable(feature = "iter_arith_traits", since = "1.12.0")] + impl Product for $a { + fn product>(iter: I) -> $a { + iter.fold(1.0, |a, b| a * b) + } + } + + #[stable(feature = "iter_arith_traits", since = "1.12.0")] + impl<'a> Sum<&'a $a> for $a { + fn sum>(iter: I) -> $a { + iter.fold(0.0, |a, b| a + *b) + } + } + + #[stable(feature = "iter_arith_traits", since = "1.12.0")] + impl<'a> Product<&'a $a> for $a { + fn product>(iter: I) -> $a { + iter.fold(1.0, |a, b| a * *b) + } + } + )*) +} + +integer_sum_product! { i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize } +float_sum_product! { f32 f64 } + +/// An iterator adapter that produces output as long as the underlying +/// iterator produces `Result::Ok` values. +/// +/// If an error is encountered, the iterator stops and the error is +/// stored. The error may be recovered later via `reconstruct`. +struct ResultShunt { + iter: I, + error: Option, +} + +impl ResultShunt + where I: Iterator> +{ + /// Process the given iterator as if it yielded a `T` instead of a + /// `Result`. Any errors will stop the inner iterator and + /// the overall result will be an error. + pub fn process(iter: I, mut f: F) -> Result + where F: FnMut(&mut Self) -> U + { + let mut shunt = ResultShunt::new(iter); + let value = f(shunt.by_ref()); + shunt.reconstruct(value) + } + + fn new(iter: I) -> Self { + ResultShunt { + iter, + error: None, + } + } + + /// Consume the adapter and rebuild a `Result` value. This should + /// *always* be called, otherwise any potential error would be + /// lost. + fn reconstruct(self, val: U) -> Result { + match self.error { + None => Ok(val), + Some(e) => Err(e), + } + } +} + +impl Iterator for ResultShunt + where I: Iterator> +{ + type Item = T; + + fn next(&mut self) -> Option { + match self.iter.next() { + Some(Ok(v)) => Some(v), + Some(Err(e)) => { + self.error = Some(e); + None + } + None => None, + } + } + + fn size_hint(&self) -> (usize, Option) { + if self.error.is_some() { + (0, Some(0)) + } else { + let (_, upper) = self.iter.size_hint(); + (0, upper) + } + } +} + +#[stable(feature = "iter_arith_traits_result", since="1.16.0")] +impl Sum> for Result + where T: Sum, +{ + /// Takes each element in the `Iterator`: if it is an `Err`, no further + /// elements are taken, and the `Err` is returned. Should no `Err` occur, + /// the sum of all elements is returned. + /// + /// # Examples + /// + /// This sums up every integer in a vector, rejecting the sum if a negative + /// element is encountered: + /// + /// ``` + /// let v = vec![1, 2]; + /// let res: Result = v.iter().map(|&x: &i32| + /// if x < 0 { Err("Negative element found") } + /// else { Ok(x) } + /// ).sum(); + /// assert_eq!(res, Ok(3)); + /// ``` + fn sum(iter: I) -> Result + where I: Iterator>, + { + ResultShunt::process(iter, |i| i.sum()) + } +} + +#[stable(feature = "iter_arith_traits_result", since="1.16.0")] +impl Product> for Result + where T: Product, +{ + /// Takes each element in the `Iterator`: if it is an `Err`, no further + /// elements are taken, and the `Err` is returned. Should no `Err` occur, + /// the product of all elements is returned. + fn product(iter: I) -> Result + where I: Iterator>, + { + ResultShunt::process(iter, |i| i.product()) + } +} diff --git a/src/libcore/iter/traits/collect.rs b/src/libcore/iter/traits/collect.rs new file mode 100644 index 00000000000..5204f6a6425 --- /dev/null +++ b/src/libcore/iter/traits/collect.rs @@ -0,0 +1,349 @@ +/// Conversion from an `Iterator`. +/// +/// By implementing `FromIterator` for a type, you define how it will be +/// created from an iterator. This is common for types which describe a +/// collection of some kind. +/// +/// `FromIterator`'s [`from_iter`] is rarely called explicitly, and is instead +/// used through [`Iterator`]'s [`collect`] method. See [`collect`]'s +/// documentation for more examples. +/// +/// [`from_iter`]: #tymethod.from_iter +/// [`Iterator`]: trait.Iterator.html +/// [`collect`]: trait.Iterator.html#method.collect +/// +/// See also: [`IntoIterator`]. +/// +/// [`IntoIterator`]: trait.IntoIterator.html +/// +/// # Examples +/// +/// Basic usage: +/// +/// ``` +/// use std::iter::FromIterator; +/// +/// let five_fives = std::iter::repeat(5).take(5); +/// +/// let v = Vec::from_iter(five_fives); +/// +/// assert_eq!(v, vec![5, 5, 5, 5, 5]); +/// ``` +/// +/// Using [`collect`] to implicitly use `FromIterator`: +/// +/// ``` +/// let five_fives = std::iter::repeat(5).take(5); +/// +/// let v: Vec = five_fives.collect(); +/// +/// assert_eq!(v, vec![5, 5, 5, 5, 5]); +/// ``` +/// +/// Implementing `FromIterator` for your type: +/// +/// ``` +/// use std::iter::FromIterator; +/// +/// // A sample collection, that's just a wrapper over Vec +/// #[derive(Debug)] +/// struct MyCollection(Vec); +/// +/// // Let's give it some methods so we can create one and add things +/// // to it. +/// impl MyCollection { +/// fn new() -> MyCollection { +/// MyCollection(Vec::new()) +/// } +/// +/// fn add(&mut self, elem: i32) { +/// self.0.push(elem); +/// } +/// } +/// +/// // and we'll implement FromIterator +/// impl FromIterator for MyCollection { +/// fn from_iter>(iter: I) -> Self { +/// let mut c = MyCollection::new(); +/// +/// for i in iter { +/// c.add(i); +/// } +/// +/// c +/// } +/// } +/// +/// // Now we can make a new iterator... +/// let iter = (0..5).into_iter(); +/// +/// // ... and make a MyCollection out of it +/// let c = MyCollection::from_iter(iter); +/// +/// assert_eq!(c.0, vec![0, 1, 2, 3, 4]); +/// +/// // collect works too! +/// +/// let iter = (0..5).into_iter(); +/// let c: MyCollection = iter.collect(); +/// +/// assert_eq!(c.0, vec![0, 1, 2, 3, 4]); +/// ``` +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_on_unimplemented( + message="a collection of type `{Self}` cannot be built from an iterator \ + over elements of type `{A}`", + label="a collection of type `{Self}` cannot be built from `std::iter::Iterator`", +)] +pub trait FromIterator: Sized { + /// Creates a value from an iterator. + /// + /// See the [module-level documentation] for more. + /// + /// [module-level documentation]: index.html + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// use std::iter::FromIterator; + /// + /// let five_fives = std::iter::repeat(5).take(5); + /// + /// let v = Vec::from_iter(five_fives); + /// + /// assert_eq!(v, vec![5, 5, 5, 5, 5]); + /// ``` + #[stable(feature = "rust1", since = "1.0.0")] + fn from_iter>(iter: T) -> Self; +} + +/// Conversion into an `Iterator`. +/// +/// By implementing `IntoIterator` for a type, you define how it will be +/// converted to an iterator. This is common for types which describe a +/// collection of some kind. +/// +/// One benefit of implementing `IntoIterator` is that your type will [work +/// with Rust's `for` loop syntax](index.html#for-loops-and-intoiterator). +/// +/// See also: [`FromIterator`]. +/// +/// [`FromIterator`]: trait.FromIterator.html +/// +/// # Examples +/// +/// Basic usage: +/// +/// ``` +/// let v = vec![1, 2, 3]; +/// let mut iter = v.into_iter(); +/// +/// assert_eq!(Some(1), iter.next()); +/// assert_eq!(Some(2), iter.next()); +/// assert_eq!(Some(3), iter.next()); +/// assert_eq!(None, iter.next()); +/// ``` +/// Implementing `IntoIterator` for your type: +/// +/// ``` +/// // A sample collection, that's just a wrapper over Vec +/// #[derive(Debug)] +/// struct MyCollection(Vec); +/// +/// // Let's give it some methods so we can create one and add things +/// // to it. +/// impl MyCollection { +/// fn new() -> MyCollection { +/// MyCollection(Vec::new()) +/// } +/// +/// fn add(&mut self, elem: i32) { +/// self.0.push(elem); +/// } +/// } +/// +/// // and we'll implement IntoIterator +/// impl IntoIterator for MyCollection { +/// type Item = i32; +/// type IntoIter = ::std::vec::IntoIter; +/// +/// fn into_iter(self) -> Self::IntoIter { +/// self.0.into_iter() +/// } +/// } +/// +/// // Now we can make a new collection... +/// let mut c = MyCollection::new(); +/// +/// // ... add some stuff to it ... +/// c.add(0); +/// c.add(1); +/// c.add(2); +/// +/// // ... and then turn it into an Iterator: +/// for (i, n) in c.into_iter().enumerate() { +/// assert_eq!(i as i32, n); +/// } +/// ``` +/// +/// It is common to use `IntoIterator` as a trait bound. This allows +/// the input collection type to change, so long as it is still an +/// iterator. Additional bounds can be specified by restricting on +/// `Item`: +/// +/// ```rust +/// fn collect_as_strings(collection: T) -> Vec +/// where T: IntoIterator, +/// T::Item : std::fmt::Debug, +/// { +/// collection +/// .into_iter() +/// .map(|item| format!("{:?}", item)) +/// .collect() +/// } +/// ``` +#[stable(feature = "rust1", since = "1.0.0")] +pub trait IntoIterator { + /// The type of the elements being iterated over. + #[stable(feature = "rust1", since = "1.0.0")] + type Item; + + /// Which kind of iterator are we turning this into? + #[stable(feature = "rust1", since = "1.0.0")] + type IntoIter: Iterator; + + /// Creates an iterator from a value. + /// + /// See the [module-level documentation] for more. + /// + /// [module-level documentation]: index.html + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// let v = vec![1, 2, 3]; + /// let mut iter = v.into_iter(); + /// + /// assert_eq!(Some(1), iter.next()); + /// assert_eq!(Some(2), iter.next()); + /// assert_eq!(Some(3), iter.next()); + /// assert_eq!(None, iter.next()); + /// ``` + #[stable(feature = "rust1", since = "1.0.0")] + fn into_iter(self) -> Self::IntoIter; +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl IntoIterator for I { + type Item = I::Item; + type IntoIter = I; + + fn into_iter(self) -> I { + self + } +} + +/// Extend a collection with the contents of an iterator. +/// +/// Iterators produce a series of values, and collections can also be thought +/// of as a series of values. The `Extend` trait bridges this gap, allowing you +/// to extend a collection by including the contents of that iterator. When +/// extending a collection with an already existing key, that entry is updated +/// or, in the case of collections that permit multiple entries with equal +/// keys, that entry is inserted. +/// +/// # Examples +/// +/// Basic usage: +/// +/// ``` +/// // You can extend a String with some chars: +/// let mut message = String::from("The first three letters are: "); +/// +/// message.extend(&['a', 'b', 'c']); +/// +/// assert_eq!("abc", &message[29..32]); +/// ``` +/// +/// Implementing `Extend`: +/// +/// ``` +/// // A sample collection, that's just a wrapper over Vec +/// #[derive(Debug)] +/// struct MyCollection(Vec); +/// +/// // Let's give it some methods so we can create one and add things +/// // to it. +/// impl MyCollection { +/// fn new() -> MyCollection { +/// MyCollection(Vec::new()) +/// } +/// +/// fn add(&mut self, elem: i32) { +/// self.0.push(elem); +/// } +/// } +/// +/// // since MyCollection has a list of i32s, we implement Extend for i32 +/// impl Extend for MyCollection { +/// +/// // This is a bit simpler with the concrete type signature: we can call +/// // extend on anything which can be turned into an Iterator which gives +/// // us i32s. Because we need i32s to put into MyCollection. +/// fn extend>(&mut self, iter: T) { +/// +/// // The implementation is very straightforward: loop through the +/// // iterator, and add() each element to ourselves. +/// for elem in iter { +/// self.add(elem); +/// } +/// } +/// } +/// +/// let mut c = MyCollection::new(); +/// +/// c.add(5); +/// c.add(6); +/// c.add(7); +/// +/// // let's extend our collection with three more numbers +/// c.extend(vec![1, 2, 3]); +/// +/// // we've added these elements onto the end +/// assert_eq!("MyCollection([5, 6, 7, 1, 2, 3])", format!("{:?}", c)); +/// ``` +#[stable(feature = "rust1", since = "1.0.0")] +pub trait Extend { + /// Extends a collection with the contents of an iterator. + /// + /// As this is the only method for this trait, the [trait-level] docs + /// contain more details. + /// + /// [trait-level]: trait.Extend.html + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// // You can extend a String with some chars: + /// let mut message = String::from("abc"); + /// + /// message.extend(['d', 'e', 'f'].iter()); + /// + /// assert_eq!("abcdef", &message); + /// ``` + #[stable(feature = "rust1", since = "1.0.0")] + fn extend>(&mut self, iter: T); +} + +#[stable(feature = "extend_for_unit", since = "1.28.0")] +impl Extend<()> for () { + fn extend>(&mut self, iter: T) { + iter.into_iter().for_each(drop) + } +} diff --git a/src/libcore/iter/traits/double_ended.rs b/src/libcore/iter/traits/double_ended.rs new file mode 100644 index 00000000000..2976afc0b4f --- /dev/null +++ b/src/libcore/iter/traits/double_ended.rs @@ -0,0 +1,297 @@ +use ops::Try; +use iter::LoopState; + +/// An iterator able to yield elements from both ends. +/// +/// Something that implements `DoubleEndedIterator` has one extra capability +/// over something that implements [`Iterator`]: the ability to also take +/// `Item`s from the back, as well as the front. +/// +/// It is important to note that both back and forth work on the same range, +/// and do not cross: iteration is over when they meet in the middle. +/// +/// In a similar fashion to the [`Iterator`] protocol, once a +/// `DoubleEndedIterator` returns `None` from a `next_back()`, calling it again +/// may or may not ever return `Some` again. `next()` and `next_back()` are +/// interchangeable for this purpose. +/// +/// [`Iterator`]: trait.Iterator.html +/// +/// # Examples +/// +/// Basic usage: +/// +/// ``` +/// let numbers = vec![1, 2, 3, 4, 5, 6]; +/// +/// let mut iter = numbers.iter(); +/// +/// assert_eq!(Some(&1), iter.next()); +/// assert_eq!(Some(&6), iter.next_back()); +/// assert_eq!(Some(&5), iter.next_back()); +/// assert_eq!(Some(&2), iter.next()); +/// assert_eq!(Some(&3), iter.next()); +/// assert_eq!(Some(&4), iter.next()); +/// assert_eq!(None, iter.next()); +/// assert_eq!(None, iter.next_back()); +/// ``` +#[stable(feature = "rust1", since = "1.0.0")] +pub trait DoubleEndedIterator: Iterator { + /// Removes and returns an element from the end of the iterator. + /// + /// Returns `None` when there are no more elements. + /// + /// The [trait-level] docs contain more details. + /// + /// [trait-level]: trait.DoubleEndedIterator.html + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// let numbers = vec![1, 2, 3, 4, 5, 6]; + /// + /// let mut iter = numbers.iter(); + /// + /// assert_eq!(Some(&1), iter.next()); + /// assert_eq!(Some(&6), iter.next_back()); + /// assert_eq!(Some(&5), iter.next_back()); + /// assert_eq!(Some(&2), iter.next()); + /// assert_eq!(Some(&3), iter.next()); + /// assert_eq!(Some(&4), iter.next()); + /// assert_eq!(None, iter.next()); + /// assert_eq!(None, iter.next_back()); + /// ``` + #[stable(feature = "rust1", since = "1.0.0")] + fn next_back(&mut self) -> Option; + + /// Returns the `n`th element from the end of the iterator. + /// + /// This is essentially the reversed version of [`nth`]. Although like most indexing + /// operations, the count starts from zero, so `nth_back(0)` returns the first value fro + /// the end, `nth_back(1)` the second, and so on. + /// + /// Note that all elements between the end and the returned element will be + /// consumed, including the returned element. This also means that calling + /// `nth_back(0)` multiple times on the same iterator will return different + /// elements. + /// + /// `nth_back()` will return [`None`] if `n` is greater than or equal to the length of the + /// iterator. + /// + /// [`None`]: ../../std/option/enum.Option.html#variant.None + /// [`nth`]: ../../std/iter/trait.Iterator.html#method.nth + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(iter_nth_back)] + /// let a = [1, 2, 3]; + /// assert_eq!(a.iter().nth_back(2), Some(&1)); + /// ``` + /// + /// Calling `nth_back()` multiple times doesn't rewind the iterator: + /// + /// ``` + /// #![feature(iter_nth_back)] + /// let a = [1, 2, 3]; + /// + /// let mut iter = a.iter(); + /// + /// assert_eq!(iter.nth_back(1), Some(&2)); + /// assert_eq!(iter.nth_back(1), None); + /// ``` + /// + /// Returning `None` if there are less than `n + 1` elements: + /// + /// ``` + /// #![feature(iter_nth_back)] + /// let a = [1, 2, 3]; + /// assert_eq!(a.iter().nth_back(10), None); + /// ``` + #[inline] + #[unstable(feature = "iter_nth_back", issue = "56995")] + fn nth_back(&mut self, mut n: usize) -> Option { + for x in self.rev() { + if n == 0 { return Some(x) } + n -= 1; + } + None + } + + /// This is the reverse version of [`try_fold()`]: it takes elements + /// starting from the back of the iterator. + /// + /// [`try_fold()`]: trait.Iterator.html#method.try_fold + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// let a = ["1", "2", "3"]; + /// let sum = a.iter() + /// .map(|&s| s.parse::()) + /// .try_rfold(0, |acc, x| x.and_then(|y| Ok(acc + y))); + /// assert_eq!(sum, Ok(6)); + /// ``` + /// + /// Short-circuiting: + /// + /// ``` + /// let a = ["1", "rust", "3"]; + /// let mut it = a.iter(); + /// let sum = it + /// .by_ref() + /// .map(|&s| s.parse::()) + /// .try_rfold(0, |acc, x| x.and_then(|y| Ok(acc + y))); + /// assert!(sum.is_err()); + /// + /// // Because it short-circuited, the remaining elements are still + /// // available through the iterator. + /// assert_eq!(it.next_back(), Some(&"1")); + /// ``` + #[inline] + #[stable(feature = "iterator_try_fold", since = "1.27.0")] + fn try_rfold(&mut self, init: B, mut f: F) -> R + where + Self: Sized, + F: FnMut(B, Self::Item) -> R, + R: Try + { + let mut accum = init; + while let Some(x) = self.next_back() { + accum = f(accum, x)?; + } + Try::from_ok(accum) + } + + /// An iterator method that reduces the iterator's elements to a single, + /// final value, starting from the back. + /// + /// This is the reverse version of [`fold()`]: it takes elements starting from + /// the back of the iterator. + /// + /// `rfold()` takes two arguments: an initial value, and a closure with two + /// arguments: an 'accumulator', and an element. The closure returns the value that + /// the accumulator should have for the next iteration. + /// + /// The initial value is the value the accumulator will have on the first + /// call. + /// + /// After applying this closure to every element of the iterator, `rfold()` + /// returns the accumulator. + /// + /// This operation is sometimes called 'reduce' or 'inject'. + /// + /// Folding is useful whenever you have a collection of something, and want + /// to produce a single value from it. + /// + /// [`fold()`]: trait.Iterator.html#method.fold + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// let a = [1, 2, 3]; + /// + /// // the sum of all of the elements of a + /// let sum = a.iter() + /// .rfold(0, |acc, &x| acc + x); + /// + /// assert_eq!(sum, 6); + /// ``` + /// + /// This example builds a string, starting with an initial value + /// and continuing with each element from the back until the front: + /// + /// ``` + /// let numbers = [1, 2, 3, 4, 5]; + /// + /// let zero = "0".to_string(); + /// + /// let result = numbers.iter().rfold(zero, |acc, &x| { + /// format!("({} + {})", x, acc) + /// }); + /// + /// assert_eq!(result, "(1 + (2 + (3 + (4 + (5 + 0)))))"); + /// ``` + #[inline] + #[stable(feature = "iter_rfold", since = "1.27.0")] + fn rfold(mut self, accum: B, mut f: F) -> B + where + Self: Sized, + F: FnMut(B, Self::Item) -> B, + { + self.try_rfold(accum, move |acc, x| Ok::(f(acc, x))).unwrap() + } + + /// Searches for an element of an iterator from the back that satisfies a predicate. + /// + /// `rfind()` takes a closure that returns `true` or `false`. It applies + /// this closure to each element of the iterator, starting at the end, and if any + /// of them return `true`, then `rfind()` returns [`Some(element)`]. If they all return + /// `false`, it returns [`None`]. + /// + /// `rfind()` is short-circuiting; in other words, it will stop processing + /// as soon as the closure returns `true`. + /// + /// Because `rfind()` takes a reference, and many iterators iterate over + /// references, this leads to a possibly confusing situation where the + /// argument is a double reference. You can see this effect in the + /// examples below, with `&&x`. + /// + /// [`Some(element)`]: ../../std/option/enum.Option.html#variant.Some + /// [`None`]: ../../std/option/enum.Option.html#variant.None + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// let a = [1, 2, 3]; + /// + /// assert_eq!(a.iter().rfind(|&&x| x == 2), Some(&2)); + /// + /// assert_eq!(a.iter().rfind(|&&x| x == 5), None); + /// ``` + /// + /// Stopping at the first `true`: + /// + /// ``` + /// let a = [1, 2, 3]; + /// + /// let mut iter = a.iter(); + /// + /// assert_eq!(iter.rfind(|&&x| x == 2), Some(&2)); + /// + /// // we can still use `iter`, as there are more elements. + /// assert_eq!(iter.next_back(), Some(&1)); + /// ``` + #[inline] + #[stable(feature = "iter_rfind", since = "1.27.0")] + fn rfind

(&mut self, mut predicate: P) -> Option + where + Self: Sized, + P: FnMut(&Self::Item) -> bool + { + self.try_rfold((), move |(), x| { + if predicate(&x) { LoopState::Break(x) } + else { LoopState::Continue(()) } + }).break_value() + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I { + fn next_back(&mut self) -> Option { + (**self).next_back() + } + fn nth_back(&mut self, n: usize) -> Option { + (**self).nth_back(n) + } +} diff --git a/src/libcore/iter/traits/exact_size.rs b/src/libcore/iter/traits/exact_size.rs new file mode 100644 index 00000000000..3bfba29e219 --- /dev/null +++ b/src/libcore/iter/traits/exact_size.rs @@ -0,0 +1,143 @@ +/// An iterator that knows its exact length. +/// +/// Many [`Iterator`]s don't know how many times they will iterate, but some do. +/// If an iterator knows how many times it can iterate, providing access to +/// that information can be useful. For example, if you want to iterate +/// backwards, a good start is to know where the end is. +/// +/// When implementing an `ExactSizeIterator`, you must also implement +/// [`Iterator`]. When doing so, the implementation of [`size_hint`] *must* +/// return the exact size of the iterator. +/// +/// [`Iterator`]: trait.Iterator.html +/// [`size_hint`]: trait.Iterator.html#method.size_hint +/// +/// The [`len`] method has a default implementation, so you usually shouldn't +/// implement it. However, you may be able to provide a more performant +/// implementation than the default, so overriding it in this case makes sense. +/// +/// [`len`]: #method.len +/// +/// # Examples +/// +/// Basic usage: +/// +/// ``` +/// // a finite range knows exactly how many times it will iterate +/// let five = 0..5; +/// +/// assert_eq!(5, five.len()); +/// ``` +/// +/// In the [module level docs][moddocs], we implemented an [`Iterator`], +/// `Counter`. Let's implement `ExactSizeIterator` for it as well: +/// +/// [moddocs]: index.html +/// +/// ``` +/// # struct Counter { +/// # count: usize, +/// # } +/// # impl Counter { +/// # fn new() -> Counter { +/// # Counter { count: 0 } +/// # } +/// # } +/// # impl Iterator for Counter { +/// # type Item = usize; +/// # fn next(&mut self) -> Option { +/// # self.count += 1; +/// # if self.count < 6 { +/// # Some(self.count) +/// # } else { +/// # None +/// # } +/// # } +/// # } +/// impl ExactSizeIterator for Counter { +/// // We can easily calculate the remaining number of iterations. +/// fn len(&self) -> usize { +/// 5 - self.count +/// } +/// } +/// +/// // And now we can use it! +/// +/// let counter = Counter::new(); +/// +/// assert_eq!(5, counter.len()); +/// ``` +#[stable(feature = "rust1", since = "1.0.0")] +pub trait ExactSizeIterator: Iterator { + /// Returns the exact number of times the iterator will iterate. + /// + /// This method has a default implementation, so you usually should not + /// implement it directly. However, if you can provide a more efficient + /// implementation, you can do so. See the [trait-level] docs for an + /// example. + /// + /// This function has the same safety guarantees as the [`size_hint`] + /// function. + /// + /// [trait-level]: trait.ExactSizeIterator.html + /// [`size_hint`]: trait.Iterator.html#method.size_hint + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// // a finite range knows exactly how many times it will iterate + /// let five = 0..5; + /// + /// assert_eq!(5, five.len()); + /// ``` + #[inline] + #[stable(feature = "rust1", since = "1.0.0")] + fn len(&self) -> usize { + let (lower, upper) = self.size_hint(); + // Note: This assertion is overly defensive, but it checks the invariant + // guaranteed by the trait. If this trait were rust-internal, + // we could use debug_assert!; assert_eq! will check all Rust user + // implementations too. + assert_eq!(upper, Some(lower)); + lower + } + + /// Returns whether the iterator is empty. + /// + /// This method has a default implementation using `self.len()`, so you + /// don't need to implement it yourself. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(exact_size_is_empty)] + /// + /// let mut one_element = std::iter::once(0); + /// assert!(!one_element.is_empty()); + /// + /// assert_eq!(one_element.next(), Some(0)); + /// assert!(one_element.is_empty()); + /// + /// assert_eq!(one_element.next(), None); + /// ``` + #[inline] + #[unstable(feature = "exact_size_is_empty", issue = "35428")] + fn is_empty(&self) -> bool { + self.len() == 0 + } +} + +#[stable(feature = "rust1", since = "1.0.0")] +impl ExactSizeIterator for &mut I { + fn len(&self) -> usize { + (**self).len() + } + fn is_empty(&self) -> bool { + (**self).is_empty() + } +} + diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/traits/iterator.rs similarity index 93% rename from src/libcore/iter/iterator.rs rename to src/libcore/iter/traits/iterator.rs index 2903c370df8..9dfa83f473b 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -1,22 +1,11 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cmp::Ordering; use ops::Try; -use super::LoopState; -use super::{Chain, Cycle, Cloned, Enumerate, Filter, FilterMap, Fuse}; -use super::{Flatten, FlatMap, flatten_compat}; -use super::{Inspect, Map, Peekable, Scan, Skip, SkipWhile, StepBy, Take, TakeWhile, Rev}; -use super::{Zip, Sum, Product}; -use super::{ChainState, FromIterator, ZipImpl}; +use super::super::LoopState; +use super::super::{Chain, Cycle, Copied, Cloned, Enumerate, Filter, FilterMap, Fuse}; +use super::super::{Flatten, FlatMap}; +use super::super::{Inspect, Map, Peekable, Scan, Skip, SkipWhile, StepBy, Take, TakeWhile, Rev}; +use super::super::{Zip, Sum, Product, FromIterator}; fn _assert_is_object_safe(_: &dyn Iterator) {} @@ -87,7 +76,7 @@ fn _assert_is_object_safe(_: &dyn Iterator) {} on( _Self="[]", label="borrow the array with `&` or call `.iter()` on it to iterate over it", - note="arrays are not an iterators, but slices like the following are: `&[1, 2, 3]`" + note="arrays are not iterators, but slices like the following are: `&[1, 2, 3]`" ), on( _Self="{integral}", @@ -98,6 +87,7 @@ fn _assert_is_object_safe(_: &dyn Iterator) {} message="`{Self}` is not an iterator" )] #[doc(spotlight)] +#[must_use = "iterators are lazy and do nothing unless consumed"] pub trait Iterator { /// The type of the elements being iterated over. #[stable(feature = "rust1", since = "1.0.0")] @@ -154,14 +144,14 @@ pub trait Iterator { /// /// `size_hint()` is primarily intended to be used for optimizations such as /// reserving space for the elements of the iterator, but must not be - /// trusted to e.g. omit bounds checks in unsafe code. An incorrect + /// trusted to e.g., omit bounds checks in unsafe code. An incorrect /// implementation of `size_hint()` should not lead to memory safety /// violations. /// /// That said, the implementation should provide a correct estimation, /// because otherwise it would be a violation of the trait's protocol. /// - /// The default implementation returns `(0, None)` which is correct for any + /// The default implementation returns `(0, `[`None`]`)` which is correct for any /// iterator. /// /// [`usize`]: ../../std/primitive.usize.html @@ -376,8 +366,7 @@ pub trait Iterator { #[inline] #[stable(feature = "iterator_step_by", since = "1.28.0")] fn step_by(self, step: usize) -> StepBy where Self: Sized { - assert!(step != 0); - StepBy{iter: self, step: step - 1, first_take: true} + StepBy::new(self, step) } /// Takes two iterators and creates a new iterator over both in sequence. @@ -434,7 +423,7 @@ pub trait Iterator { fn chain(self, other: U) -> Chain where Self: Sized, U: IntoIterator, { - Chain{a: self, b: other.into_iter(), state: ChainState::Both} + Chain::new(self, other.into_iter()) } /// 'Zips up' two iterators into a single iterator of pairs. @@ -519,7 +508,7 @@ pub trait Iterator { /// element. /// /// `map()` transforms one iterator into another, by means of its argument: - /// something that implements `FnMut`. It produces a new iterator which + /// something that implements [`FnMut`]. It produces a new iterator which /// calls this closure on each element of the original iterator. /// /// If you are good at thinking in types, you can think of `map()` like this: @@ -532,7 +521,8 @@ pub trait Iterator { /// If you're doing some sort of looping for a side effect, it's considered /// more idiomatic to use [`for`] than `map()`. /// - /// [`for`]: ../../book/first-edition/loops.html#for + /// [`for`]: ../../book/ch03-05-control-flow.html#looping-through-a-collection-with-for + /// [`FnMut`]: ../../std/ops/trait.FnMut.html /// /// # Examples /// @@ -568,7 +558,7 @@ pub trait Iterator { fn map(self, f: F) -> Map where Self: Sized, F: FnMut(Self::Item) -> B, { - Map { iter: self, f } + Map::new(self, f) } /// Calls a closure on each element of an iterator. @@ -580,7 +570,7 @@ pub trait Iterator { /// cases `for_each` may also be faster than a loop, because it will use /// internal iteration on adaptors like `Chain`. /// - /// [`for`]: ../../book/first-edition/loops.html#for + /// [`for`]: ../../book/ch03-05-control-flow.html#looping-through-a-collection-with-for /// /// # Examples /// @@ -679,7 +669,7 @@ pub trait Iterator { fn filter

(self, predicate: P) -> Filter where Self: Sized, P: FnMut(&Self::Item) -> bool, { - Filter {iter: self, predicate } + Filter::new(self, predicate) } /// Creates an iterator that both filters and maps. @@ -736,7 +726,7 @@ pub trait Iterator { fn filter_map(self, f: F) -> FilterMap where Self: Sized, F: FnMut(Self::Item) -> Option, { - FilterMap { iter: self, f } + FilterMap::new(self, f) } /// Creates an iterator which gives the current iteration count as well as @@ -780,7 +770,7 @@ pub trait Iterator { #[inline] #[stable(feature = "rust1", since = "1.0.0")] fn enumerate(self) -> Enumerate where Self: Sized { - Enumerate { iter: self, count: 0 } + Enumerate::new(self) } /// Creates an iterator which can use `peek` to look at the next element of @@ -826,7 +816,7 @@ pub trait Iterator { #[inline] #[stable(feature = "rust1", since = "1.0.0")] fn peekable(self) -> Peekable where Self: Sized { - Peekable{iter: self, peeked: None} + Peekable::new(self) } /// Creates an iterator that [`skip`]s elements based on a predicate. @@ -889,7 +879,7 @@ pub trait Iterator { fn skip_while

(self, predicate: P) -> SkipWhile where Self: Sized, P: FnMut(&Self::Item) -> bool, { - SkipWhile { iter: self, flag: false, predicate } + SkipWhile::new(self, predicate) } /// Creates an iterator that yields elements based on a predicate. @@ -969,7 +959,7 @@ pub trait Iterator { fn take_while

(self, predicate: P) -> TakeWhile where Self: Sized, P: FnMut(&Self::Item) -> bool, { - TakeWhile { iter: self, flag: false, predicate } + TakeWhile::new(self, predicate) } /// Creates an iterator that skips the first `n` elements. @@ -991,7 +981,7 @@ pub trait Iterator { #[inline] #[stable(feature = "rust1", since = "1.0.0")] fn skip(self, n: usize) -> Skip where Self: Sized { - Skip { iter: self, n } + Skip::new(self, n) } /// Creates an iterator that yields its first `n` elements. @@ -1023,7 +1013,7 @@ pub trait Iterator { #[inline] #[stable(feature = "rust1", since = "1.0.0")] fn take(self, n: usize) -> Take where Self: Sized, { - Take { iter: self, n } + Take::new(self, n) } /// An iterator adaptor similar to [`fold`] that holds internal state and @@ -1068,7 +1058,7 @@ pub trait Iterator { fn scan(self, initial_state: St, f: F) -> Scan where Self: Sized, F: FnMut(&mut St, Self::Item) -> Option, { - Scan { iter: self, f, state: initial_state } + Scan::new(self, initial_state, f) } /// Creates an iterator that works like map, but flattens nested structure. @@ -1106,7 +1096,7 @@ pub trait Iterator { fn flat_map(self, f: F) -> FlatMap where Self: Sized, U: IntoIterator, F: FnMut(Self::Item) -> U, { - FlatMap { inner: flatten_compat(self.map(f)) } + FlatMap::new(self, f) } /// Creates an iterator that flattens nested structure. @@ -1174,7 +1164,7 @@ pub trait Iterator { #[stable(feature = "iterator_flatten", since = "1.29.0")] fn flatten(self) -> Flatten where Self: Sized, Self::Item: IntoIterator { - Flatten { inner: flatten_compat(self) } + Flatten::new(self) } /// Creates an iterator which ends after the first [`None`]. @@ -1234,7 +1224,7 @@ pub trait Iterator { #[inline] #[stable(feature = "rust1", since = "1.0.0")] fn fuse(self) -> Fuse where Self: Sized { - Fuse{iter: self, done: false} + Fuse::new(self) } /// Do something with each element of an iterator, passing the value on. @@ -1317,7 +1307,7 @@ pub trait Iterator { fn inspect(self, f: F) -> Inspect where Self: Sized, F: FnMut(&Self::Item), { - Inspect { iter: self, f } + Inspect::new(self, f) } /// Borrows an iterator, rather than consuming it. @@ -1669,7 +1659,7 @@ pub trait Iterator { /// use a `for` loop with a list of things to build up a result. Those /// can be turned into `fold()`s: /// - /// [`for`]: ../../book/first-edition/loops.html#for + /// [`for`]: ../../book/ch03-05-control-flow.html#looping-through-a-collection-with-for /// /// ``` /// let numbers = [1, 2, 3, 4, 5]; @@ -2191,7 +2181,7 @@ pub trait Iterator { #[inline] #[stable(feature = "rust1", since = "1.0.0")] fn rev(self) -> Rev where Self: Sized + DoubleEndedIterator { - Rev{iter: self} + Rev::new(self) } /// Converts an iterator of pairs into a pair of containers. @@ -2233,6 +2223,35 @@ pub trait Iterator { (ts, us) } + /// Creates an iterator which copies all of its elements. + /// + /// This is useful when you have an iterator over `&T`, but you need an + /// iterator over `T`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(iter_copied)] + /// + /// let a = [1, 2, 3]; + /// + /// let v_cloned: Vec<_> = a.iter().copied().collect(); + /// + /// // copied is the same as .map(|&x| x) + /// let v_map: Vec<_> = a.iter().map(|&x| x).collect(); + /// + /// assert_eq!(v_cloned, vec![1, 2, 3]); + /// assert_eq!(v_map, vec![1, 2, 3]); + /// ``` + #[unstable(feature = "iter_copied", issue = "57127")] + fn copied<'a, T: 'a>(self) -> Copied + where Self: Sized + Iterator, T: Copy + { + Copied::new(self) + } + /// Creates an iterator which [`clone`]s all of its elements. /// /// This is useful when you have an iterator over `&T`, but you need an @@ -2259,7 +2278,7 @@ pub trait Iterator { fn cloned<'a, T: 'a>(self) -> Cloned where Self: Sized + Iterator, T: Clone { - Cloned { it: self } + Cloned::new(self) } /// Repeats an iterator endlessly. @@ -2290,7 +2309,7 @@ pub trait Iterator { #[stable(feature = "rust1", since = "1.0.0")] #[inline] fn cycle(self) -> Cycle where Self: Sized + Clone { - Cycle{orig: self.clone(), iter: self} + Cycle::new(self) } /// Sums the elements of an iterator. @@ -2337,7 +2356,7 @@ pub trait Iterator { /// /// ``` /// fn factorial(n: u32) -> u32 { - /// (1..).take_while(|&i| i <= n).product() + /// (1..=n).product() /// } /// assert_eq!(factorial(0), 1); /// assert_eq!(factorial(1), 1); @@ -2584,6 +2603,95 @@ pub trait Iterator { } } } + + /// Checks if the elements of this iterator are sorted. + /// + /// That is, for each element `a` and its following element `b`, `a <= b` must hold. If the + /// iterator yields exactly zero or one element, `true` is returned. + /// + /// Note that if `Self::Item` is only `PartialOrd`, but not `Ord`, the above definition + /// implies that this function returns `false` if any two consecutive items are not + /// comparable. + /// + /// # Examples + /// + /// ``` + /// #![feature(is_sorted)] + /// + /// assert!([1, 2, 2, 9].iter().is_sorted()); + /// assert!(![1, 3, 2, 4].iter().is_sorted()); + /// assert!([0].iter().is_sorted()); + /// assert!(std::iter::empty::().is_sorted()); + /// assert!(![0.0, 1.0, std::f32::NAN].iter().is_sorted()); + /// ``` + #[inline] + #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")] + fn is_sorted(self) -> bool + where + Self: Sized, + Self::Item: PartialOrd, + { + self.is_sorted_by(|a, b| a.partial_cmp(b)) + } + + /// Checks if the elements of this iterator are sorted using the given comparator function. + /// + /// Instead of using `PartialOrd::partial_cmp`, this function uses the given `compare` + /// function to determine the ordering of two elements. Apart from that, it's equivalent to + /// [`is_sorted`]; see its documentation for more information. + /// + /// [`is_sorted`]: trait.Iterator.html#method.is_sorted + #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")] + fn is_sorted_by(mut self, mut compare: F) -> bool + where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Option + { + let mut last = match self.next() { + Some(e) => e, + None => return true, + }; + + while let Some(curr) = self.next() { + if compare(&last, &curr) + .map(|o| o == Ordering::Greater) + .unwrap_or(true) + { + return false; + } + last = curr; + } + + true + } + + /// Checks if the elements of this iterator are sorted using the given key extraction + /// function. + /// + /// Instead of comparing the iterator's elements directly, this function compares the keys of + /// the elements, as determined by `f`. Apart from that, it's equivalent to [`is_sorted`]; see + /// its documentation for more information. + /// + /// [`is_sorted`]: trait.Iterator.html#method.is_sorted + /// + /// # Examples + /// + /// ``` + /// #![feature(is_sorted)] + /// + /// assert!(["c", "bb", "aaa"].iter().is_sorted_by_key(|s| s.len())); + /// assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs())); + /// ``` + #[inline] + #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")] + fn is_sorted_by_key(self, mut f: F) -> bool + where + Self: Sized, + F: FnMut(&Self::Item) -> K, + K: PartialOrd + { + self.is_sorted_by(|a, b| f(a).partial_cmp(&f(b))) + } } /// Select an element from an iterator based on the given "projection" diff --git a/src/libcore/iter/traits/marker.rs b/src/libcore/iter/traits/marker.rs new file mode 100644 index 00000000000..602619bce5a --- /dev/null +++ b/src/libcore/iter/traits/marker.rs @@ -0,0 +1,44 @@ +/// An iterator that always continues to yield `None` when exhausted. +/// +/// Calling next on a fused iterator that has returned `None` once is guaranteed +/// to return [`None`] again. This trait should be implemented by all iterators +/// that behave this way because it allows optimizing [`Iterator::fuse`]. +/// +/// Note: In general, you should not use `FusedIterator` in generic bounds if +/// you need a fused iterator. Instead, you should just call [`Iterator::fuse`] +/// on the iterator. If the iterator is already fused, the additional [`Fuse`] +/// wrapper will be a no-op with no performance penalty. +/// +/// [`None`]: ../../std/option/enum.Option.html#variant.None +/// [`Iterator::fuse`]: ../../std/iter/trait.Iterator.html#method.fuse +/// [`Fuse`]: ../../std/iter/struct.Fuse.html +#[stable(feature = "fused", since = "1.26.0")] +pub trait FusedIterator: Iterator {} + +#[stable(feature = "fused", since = "1.26.0")] +impl FusedIterator for &mut I {} + +/// An iterator that reports an accurate length using size_hint. +/// +/// The iterator reports a size hint where it is either exact +/// (lower bound is equal to upper bound), or the upper bound is [`None`]. +/// The upper bound must only be [`None`] if the actual iterator length is +/// larger than [`usize::MAX`]. In that case, the lower bound must be +/// [`usize::MAX`], resulting in a [`.size_hint`] of `(usize::MAX, None)`. +/// +/// The iterator must produce exactly the number of elements it reported +/// or diverge before reaching the end. +/// +/// # Safety +/// +/// This trait must only be implemented when the contract is upheld. +/// Consumers of this trait must inspect [`.size_hint`]’s upper bound. +/// +/// [`None`]: ../../std/option/enum.Option.html#variant.None +/// [`usize::MAX`]: ../../std/usize/constant.MAX.html +/// [`.size_hint`]: ../../std/iter/trait.Iterator.html#method.size_hint +#[unstable(feature = "trusted_len", issue = "37572")] +pub unsafe trait TrustedLen : Iterator {} + +#[unstable(feature = "trusted_len", issue = "37572")] +unsafe impl TrustedLen for &mut I {} diff --git a/src/libcore/iter/traits/mod.rs b/src/libcore/iter/traits/mod.rs new file mode 100644 index 00000000000..000b9fad70b --- /dev/null +++ b/src/libcore/iter/traits/mod.rs @@ -0,0 +1,13 @@ +mod iterator; +mod double_ended; +mod exact_size; +mod collect; +mod accum; +mod marker; + +pub use self::iterator::Iterator; +pub use self::double_ended::DoubleEndedIterator; +pub use self::exact_size::ExactSizeIterator; +pub use self::collect::{FromIterator, IntoIterator, Extend}; +pub use self::accum::{Sum, Product}; +pub use self::marker::{FusedIterator, TrustedLen}; diff --git a/src/libcore/iter_private.rs b/src/libcore/iter_private.rs index c4d54d2c7b8..890db47b197 100644 --- a/src/libcore/iter_private.rs +++ b/src/libcore/iter_private.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - /// An iterator whose items are random accessible efficiently /// /// # Safety diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 1fa82178705..e9785ba52e4 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! # The Rust Core Library //! //! The Rust Core Library is the dependency-free[^free] foundation of [The @@ -68,10 +58,12 @@ issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/", test(no_crate_inject, attr(deny(warnings))), test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))] - #![no_core] -#![deny(missing_docs)] -#![deny(missing_debug_implementations)] + +#![warn(deprecated_in_future)] +#![warn(missing_docs)] +#![warn(intra_doc_link_resolution_failure)] +#![warn(missing_debug_implementations)] #![feature(allow_internal_unstable)] #![feature(arbitrary_self_types)] @@ -80,7 +72,6 @@ #![feature(cfg_target_has_atomic)] #![feature(concat_idents)] #![feature(const_fn)] -#![feature(const_int_ops)] #![feature(const_fn_union)] #![feature(custom_attribute)] #![feature(doc_cfg)] @@ -88,12 +79,14 @@ #![feature(extern_types)] #![feature(fundamental)] #![feature(intrinsics)] +#![feature(is_sorted)] +#![feature(iter_once_with)] #![feature(lang_items)] #![feature(link_llvm_intrinsics)] #![feature(never_type)] #![feature(nll)] +#![feature(bind_by_move_pattern_guards)] #![feature(exhaustive_patterns)] -#![feature(macro_at_most_once_rep)] #![feature(no_core)] #![feature(on_unimplemented)] #![feature(optin_builtin_traits)] @@ -118,18 +111,20 @@ #![feature(mips_target_feature)] #![feature(aarch64_target_feature)] #![feature(wasm_target_feature)] +#![feature(avx512_target_feature)] +#![feature(cmpxchg16b_target_feature)] #![feature(const_slice_len)] #![feature(const_str_as_bytes)] #![feature(const_str_len)] -#![feature(const_let)] -#![feature(const_int_rotate)] -#![feature(const_int_wrapping)] -#![feature(const_int_sign)] #![feature(const_int_conversion)] #![feature(const_transmute)] #![feature(reverse_bits)] #![feature(non_exhaustive)] #![feature(structural_match)] +#![feature(abi_unadjusted)] +#![feature(adx_target_feature)] +#![feature(maybe_uninit)] +#![feature(unrestricted_attribute_tokens)] #[prelude_import] #[allow(unused)] @@ -224,8 +219,6 @@ pub mod task; pub mod alloc; // note: does not need to be public -mod iter_private; -mod nonzero; mod tuple; mod unit; @@ -233,11 +226,12 @@ mod unit; #[unstable(feature = "yk_swt", issue = "0")] pub mod yk_swt; -// Pull in the `coresimd` crate directly into libcore. This is where all the -// architecture-specific (and vendor-specific) intrinsics are defined. AKA -// things like SIMD and such. Note that the actual source for all this lies in a -// different repository, rust-lang-nursery/stdsimd. That's why the setup here is -// a bit wonky. +// Pull in the `core_arch` crate directly into libcore. The contents of +// `core_arch` are in a different repository: rust-lang-nursery/stdsimd. +// +// `core_arch` depends on libcore, but the contents of this module are +// set up in such a way that directly pulling it here works such that the +// crate uses the this crate as its libcore. #[allow(unused_macros)] macro_rules! test_v16 { ($item:item) => {}; } #[allow(unused_macros)] @@ -252,12 +246,10 @@ macro_rules! test_v256 { ($item:item) => {}; } macro_rules! test_v512 { ($item:item) => {}; } #[allow(unused_macros)] macro_rules! vector_impl { ($([$f:ident, $($args:tt)*]),*) => { $($f!($($args)*);)* } } -#[path = "../stdsimd/coresimd/mod.rs"] +#[path = "../stdsimd/crates/core_arch/src/mod.rs"] #[allow(missing_docs, missing_debug_implementations, dead_code, unused_imports)] #[unstable(feature = "stdsimd", issue = "48556")] -#[cfg(not(stage0))] // allow changes to how stdsimd works in stage0 -mod coresimd; +mod core_arch; #[stable(feature = "simd_arch", since = "1.27.0")] -#[cfg(not(stage0))] -pub use coresimd::arch; +pub use core_arch::arch; diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index c008b78e450..12b7adb8a9d 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Entry point of thread panic, for details, see std::macros #[macro_export] #[allow_internal_unstable] @@ -238,6 +228,10 @@ macro_rules! debug_assert_ne { /// with converting downstream errors. /// /// The `?` operator was added to replace `try!` and should be used instead. +/// Furthermore, `try` is a reserved word in Rust 2018, so if you must use +/// it, you will need to use the [raw-identifier syntax][ris]: `r#try`. +/// +/// [ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html /// /// `try!` matches the given [`Result`]. In case of the `Ok` variant, the /// expression has the value of the wrapped value. @@ -278,14 +272,14 @@ macro_rules! debug_assert_ne { /// /// // The previous method of quick returning Errors /// fn write_to_file_using_try() -> Result<(), MyError> { -/// let mut file = try!(File::create("my_best_friends.txt")); -/// try!(file.write_all(b"This is a list of my best friends.")); +/// let mut file = r#try!(File::create("my_best_friends.txt")); +/// r#try!(file.write_all(b"This is a list of my best friends.")); /// Ok(()) /// } /// /// // This is equivalent to: /// fn write_to_file_using_match() -> Result<(), MyError> { -/// let mut file = try!(File::create("my_best_friends.txt")); +/// let mut file = r#try!(File::create("my_best_friends.txt")); /// match file.write_all(b"This is a list of my best friends.") { /// Ok(v) => v, /// Err(e) => return Err(From::from(e)), @@ -296,14 +290,14 @@ macro_rules! debug_assert_ne { #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] #[doc(alias = "?")] -macro_rules! try { +macro_rules! r#try { ($expr:expr) => (match $expr { $crate::result::Result::Ok(val) => val, $crate::result::Result::Err(err) => { return $crate::result::Result::Err($crate::convert::From::from(err)) } }); - ($expr:expr,) => (try!($expr)); + ($expr:expr,) => (r#try!($expr)); } /// Write formatted data into a buffer. @@ -553,6 +547,23 @@ macro_rules! unimplemented { ($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)*))); } +/// A macro to create an array of [`MaybeUninit`] +/// +/// This macro constructs and uninitialized array of the type `[MaybeUninit; N]`. +/// +/// [`MaybeUninit`]: mem/union.MaybeUninit.html +#[macro_export] +#[unstable(feature = "maybe_uninit", issue = "53491")] +macro_rules! uninitialized_array { + // This `into_inner` is safe because an array of `MaybeUninit` does not + // require initialization. + // FIXME(#49147): Could be replaced by an array initializer, once those can + // be any const expression. + ($t:ty; $size:expr) => (unsafe { + MaybeUninit::<[MaybeUninit<$t>; $size]>::uninitialized().into_inner() + }); +} + /// Built-in macros to the compiler itself. /// /// These macros do not have any corresponding definition with a `macro_rules!` diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 3bcdfabbb24..457d556e4fa 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Primitive traits and types representing basic properties of types. //! //! Rust types can be classified in various useful ways according to @@ -95,7 +85,7 @@ impl !Send for *mut T { } on(parent_trait="std::path::Path", label="borrow the `Path` instead"), message="the size for values of type `{Self}` cannot be known at compilation time", label="doesn't have a size known at compile-time", - note="to learn more, visit { /// In addition to the [implementors listed below][impls], /// the following types also implement `Copy`: /// -/// * Function item types (i.e. the distinct types defined for each function) -/// * Function pointer types (e.g. `fn() -> i32`) -/// * Array types, for all sizes, if the item type also implements `Copy` (e.g. `[i32; 123456]`) -/// * Tuple types, if each component also implements `Copy` (e.g. `()`, `(i32, bool)`) +/// * Function item types (i.e., the distinct types defined for each function) +/// * Function pointer types (e.g., `fn() -> i32`) +/// * Array types, for all sizes, if the item type also implements `Copy` (e.g., `[i32; 123456]`) +/// * Tuple types, if each component also implements `Copy` (e.g., `()`, `(i32, bool)`) /// * Closure types, if they capture no value from the environment /// or if all such captured values implement `Copy` themselves. /// Note that variables captured by shared reference always implement `Copy` @@ -596,7 +586,7 @@ mod impls { /// This affects, for example, whether a `static` of that type is /// placed in read-only static memory or writable static memory. #[lang = "freeze"] -unsafe auto trait Freeze {} +pub(crate) unsafe auto trait Freeze {} impl !Freeze for UnsafeCell {} unsafe impl Freeze for PhantomData {} @@ -621,7 +611,6 @@ unsafe impl Freeze for &mut T {} /// So this, for example, can only be done on types implementing `Unpin`: /// /// ```rust -/// #![feature(pin)] /// use std::mem::replace; /// use std::pin::Pin; /// @@ -637,23 +626,24 @@ unsafe impl Freeze for &mut T {} /// [`replace`]: ../../std/mem/fn.replace.html /// [`Pin`]: ../pin/struct.Pin.html /// [`pin module`]: ../../std/pin/index.html -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] +#[cfg_attr(not(stage0), lang = "unpin")] pub auto trait Unpin {} -/// A type which does not implement `Unpin`. +/// A marker type which does not implement `Unpin`. /// -/// If a type contains a `Pinned`, it will not implement `Unpin` by default. -#[unstable(feature = "pin", issue = "49150")] +/// If a type contains a `PhantomPinned`, it will not implement `Unpin` by default. +#[stable(feature = "pin", since = "1.33.0")] #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -pub struct Pinned; +pub struct PhantomPinned; -#[unstable(feature = "pin", issue = "49150")] -impl !Unpin for Pinned {} +#[stable(feature = "pin", since = "1.33.0")] +impl !Unpin for PhantomPinned {} -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl<'a, T: ?Sized + 'a> Unpin for &'a T {} -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl<'a, T: ?Sized + 'a> Unpin for &'a mut T {} /// Implementations of `Copy` for primitive types. diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index d8eec2bd9a6..8b6d9d882b5 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Basic functions for dealing with memory. //! //! This module contains functions for querying the size and alignment of @@ -132,7 +122,6 @@ pub use intrinsics::transmute; /// [uninit]: fn.uninitialized.html /// [clone]: ../clone/trait.Clone.html /// [swap]: fn.swap.html -/// [FFI]: ../../book/first-edition/ffi.html /// [box]: ../../std/boxed/struct.Box.html /// [leak]: ../../std/boxed/struct.Box.html#method.leak /// [into_raw]: ../../std/boxed/struct.Box.html#method.into_raw @@ -150,7 +139,6 @@ pub fn forget(t: T) { /// /// [`forget`]: fn.forget.html #[inline] -#[cfg(not(stage0))] #[unstable(feature = "forget_unsized", issue = "0")] pub fn forget_unsized(t: T) { unsafe { intrinsics::forget(t) } @@ -306,7 +294,7 @@ pub const fn size_of() -> usize { /// Returns the size of the pointed-to value in bytes. /// /// This is usually the same as `size_of::()`. However, when `T` *has* no -/// statically known size, e.g. a slice [`[T]`][slice] or a [trait object], +/// statically known size, e.g., a slice [`[T]`][slice] or a [trait object], /// then `size_of_val` can be used to get the dynamically-known size. /// /// [slice]: ../../std/primitive.slice.html @@ -479,7 +467,7 @@ pub const fn needs_drop() -> bool { /// /// This has the same effect as allocating space with /// [`mem::uninitialized`][uninit] and then zeroing it out. It is useful for -/// [FFI] sometimes, but should generally be avoided. +/// FFI sometimes, but should generally be avoided. /// /// There is no guarantee that an all-zero byte-pattern represents a valid value of /// some type `T`. If `T` has a destructor and the value is destroyed (due to @@ -490,7 +478,6 @@ pub const fn needs_drop() -> bool { /// many of the same caveats. /// /// [uninit]: fn.uninitialized.html -/// [FFI]: ../../book/first-edition/ffi.html /// [ub]: ../../reference/behavior-considered-undefined.html /// /// # Examples @@ -502,9 +489,9 @@ pub const fn needs_drop() -> bool { /// assert_eq!(0, x); /// ``` #[inline] -#[rustc_deprecated(since = "2.0.0", reason = "use `mem::MaybeUninit::zeroed` instead")] #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn zeroed() -> T { + intrinsics::panic_if_uninhabited::(); intrinsics::init() } @@ -514,11 +501,9 @@ pub unsafe fn zeroed() -> T { /// **This is incredibly dangerous and should not be done lightly. Deeply /// consider initializing your memory with a default value instead.** /// -/// This is useful for [FFI] functions and initializing arrays sometimes, +/// This is useful for FFI functions and initializing arrays sometimes, /// but should generally be avoided. /// -/// [FFI]: ../../book/first-edition/ffi.html -/// /// # Undefined behavior /// /// It is [undefined behavior][ub] to read uninitialized memory, even just an @@ -535,6 +520,12 @@ pub unsafe fn zeroed() -> T { /// it goes out of scope (and therefore would be dropped). Note that this /// includes a `panic` occurring and unwinding the stack suddenly. /// +/// If you partially initialize an array, you may need to use +/// [`ptr::drop_in_place`][drop_in_place] to remove the elements you have fully +/// initialized followed by [`mem::forget`][mem_forget] to prevent drop running +/// on the array. If a partially allocated array is dropped this will lead to +/// undefined behaviour. +/// /// # Examples /// /// Here's how to safely initialize an array of [`Vec`]s. @@ -588,11 +579,44 @@ pub unsafe fn zeroed() -> T { /// println!("{:?}", &data[0]); /// ``` /// +/// This example shows how to handle partially initialized arrays, which could +/// be found in low-level datastructures. +/// +/// ``` +/// use std::mem; +/// use std::ptr; +/// +/// // Count the number of elements we have assigned. +/// let mut data_len: usize = 0; +/// let mut data: [String; 1000]; +/// +/// unsafe { +/// data = mem::uninitialized(); +/// +/// for elem in &mut data[0..500] { +/// ptr::write(elem, String::from("hello")); +/// data_len += 1; +/// } +/// +/// // For each item in the array, drop if we allocated it. +/// for i in &mut data[0..data_len] { +/// ptr::drop_in_place(i); +/// } +/// } +/// // Forget the data. If this is allowed to drop, you may see a crash such as: +/// // 'mem_uninit_test(2457,0x7fffb55dd380) malloc: *** error for object +/// // 0x7ff3b8402920: pointer being freed was not allocated' +/// mem::forget(data); +/// ``` +/// /// [`Vec`]: ../../std/vec/struct.Vec.html /// [`vec!`]: ../../std/macro.vec.html /// [`Clone`]: ../../std/clone/trait.Clone.html /// [ub]: ../../reference/behavior-considered-undefined.html /// [write]: ../ptr/fn.write.html +/// [drop_in_place]: ../ptr/fn.drop_in_place.html +/// [mem_zeroed]: fn.zeroed.html +/// [mem_forget]: fn.forget.html /// [copy]: ../intrinsics/fn.copy.html /// [copy_no]: ../intrinsics/fn.copy_nonoverlapping.html /// [`Drop`]: ../ops/trait.Drop.html @@ -600,6 +624,7 @@ pub unsafe fn zeroed() -> T { #[rustc_deprecated(since = "2.0.0", reason = "use `mem::MaybeUninit::uninitialized` instead")] #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn uninitialized() -> T { + intrinsics::panic_if_uninhabited::(); intrinsics::uninit() } @@ -686,13 +711,11 @@ pub fn replace(dest: &mut T, mut src: T) -> T { /// Disposes of a value. /// -/// While this does call the argument's implementation of [`Drop`][drop], -/// it will not release any borrows, as borrows are based on lexical scope. +/// This does call the argument's implementation of [`Drop`][drop]. /// -/// This effectively does nothing for -/// [types which implement `Copy`](../../book/first-edition/ownership.html#copy-types), -/// e.g. integers. Such values are copied and _then_ moved into the function, -/// so the value persists after this function call. +/// This effectively does nothing for types which implement `Copy`, e.g. +/// integers. Such values are copied and _then_ moved into the function, so the +/// value persists after this function call. /// /// This function is not magic; it is literally defined as /// @@ -715,32 +738,6 @@ pub fn replace(dest: &mut T, mut src: T) -> T { /// drop(v); // explicitly drop the vector /// ``` /// -/// Borrows are based on lexical scope, so this produces an error: -/// -/// ```compile_fail,E0502 -/// let mut v = vec![1, 2, 3]; -/// let x = &v[0]; -/// -/// drop(x); // explicitly drop the reference, but the borrow still exists -/// -/// v.push(4); // error: cannot borrow `v` as mutable because it is also -/// // borrowed as immutable -/// ``` -/// -/// An inner scope is needed to fix this: -/// -/// ``` -/// let mut v = vec![1, 2, 3]; -/// -/// { -/// let x = &v[0]; -/// -/// drop(x); // this is now redundant, as `x` is going out of scope anyway -/// } -/// -/// v.push(4); // no problems -/// ``` -/// /// Since [`RefCell`] enforces the borrow rules at runtime, `drop` can /// release a [`RefCell`] borrow: /// @@ -955,7 +952,7 @@ impl ManuallyDrop { /// ManuallyDrop::new(Box::new(())); /// ``` #[stable(feature = "manually_drop", since = "1.20.0")] - #[inline] + #[inline(always)] pub const fn new(value: T) -> ManuallyDrop { ManuallyDrop { value } } @@ -972,7 +969,7 @@ impl ManuallyDrop { /// let _: Box<()> = ManuallyDrop::into_inner(x); // This drops the `Box`. /// ``` #[stable(feature = "manually_drop", since = "1.20.0")] - #[inline] + #[inline(always)] pub const fn into_inner(slot: ManuallyDrop) -> T { slot.value } @@ -990,6 +987,9 @@ impl ManuallyDrop { /// /// This function semantically moves out the contained value without preventing further usage. /// It is up to the user of this method to ensure that this container is not used again. + /// + /// [`ManuallyDrop::drop`]: #method.drop + /// [`ManuallyDrop::into_inner`]: #method.into_inner #[must_use = "if you don't need the value, you can use `ManuallyDrop::drop` instead"] #[unstable(feature = "manually_drop_take", issue = "55422")] #[inline] @@ -1020,16 +1020,16 @@ impl ManuallyDrop { #[stable(feature = "manually_drop", since = "1.20.0")] impl Deref for ManuallyDrop { type Target = T; - #[inline] - fn deref(&self) -> &Self::Target { + #[inline(always)] + fn deref(&self) -> &T { &self.value } } #[stable(feature = "manually_drop", since = "1.20.0")] impl DerefMut for ManuallyDrop { - #[inline] - fn deref_mut(&mut self) -> &mut Self::Target { + #[inline(always)] + fn deref_mut(&mut self) -> &mut T { &mut self.value } } @@ -1049,6 +1049,7 @@ impl MaybeUninit { /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. /// It is your responsibility to make sure `T` gets dropped if it got initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline(always)] pub const fn new(val: T) -> MaybeUninit { MaybeUninit { value: ManuallyDrop::new(val) } } @@ -1058,6 +1059,7 @@ impl MaybeUninit { /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. /// It is your responsibility to make sure `T` gets dropped if it got initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline(always)] pub const fn uninitialized() -> MaybeUninit { MaybeUninit { uninit: () } } @@ -1071,6 +1073,7 @@ impl MaybeUninit { /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. /// It is your responsibility to make sure `T` gets dropped if it got initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline] pub fn zeroed() -> MaybeUninit { let mut u = MaybeUninit::::uninitialized(); unsafe { @@ -1081,6 +1084,7 @@ impl MaybeUninit { /// Set the value of the `MaybeUninit`. This overwrites any previous value without dropping it. #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline(always)] pub fn set(&mut self, val: T) { unsafe { self.value = ManuallyDrop::new(val); @@ -1096,7 +1100,9 @@ impl MaybeUninit { /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized /// state, otherwise this will immediately cause undefined behavior. #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline(always)] pub unsafe fn into_inner(self) -> T { + intrinsics::panic_if_uninhabited::(); ManuallyDrop::into_inner(self.value) } @@ -1107,6 +1113,7 @@ impl MaybeUninit { /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized /// state, otherwise this will immediately cause undefined behavior. #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline(always)] pub unsafe fn get_ref(&self) -> &T { &*self.value } @@ -1117,7 +1124,11 @@ impl MaybeUninit { /// /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized /// state, otherwise this will immediately cause undefined behavior. + // FIXME(#53491): We currently rely on the above being incorrect, i.e., we have references + // to uninitialized data (e.g., in `libcore/fmt/float.rs`). We should make + // a final decision about the rules before stabilization. #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline(always)] pub unsafe fn get_mut(&mut self) -> &mut T { &mut *self.value } @@ -1125,6 +1136,7 @@ impl MaybeUninit { /// Get a pointer to the contained value. Reading from this pointer will be undefined /// behavior unless the `MaybeUninit` is initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline(always)] pub fn as_ptr(&self) -> *const T { unsafe { &*self.value as *const T } } @@ -1132,7 +1144,22 @@ impl MaybeUninit { /// Get a mutable pointer to the contained value. Reading from this pointer will be undefined /// behavior unless the `MaybeUninit` is initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline(always)] pub fn as_mut_ptr(&mut self) -> *mut T { unsafe { &mut *self.value as *mut T } } + + /// Get a pointer to the first element of the array. + #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline(always)] + pub fn first_ptr(this: &[MaybeUninit]) -> *const T { + this as *const [MaybeUninit] as *const T + } + + /// Get a mutable pointer to the first element of the array. + #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline(always)] + pub fn first_ptr_mut(this: &mut [MaybeUninit]) -> *mut T { + this as *mut [MaybeUninit] as *mut T + } } diff --git a/src/libcore/nonzero.rs b/src/libcore/nonzero.rs deleted file mode 100644 index 436cd1fc057..00000000000 --- a/src/libcore/nonzero.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Exposes the NonZero lang item which provides optimization hints. - -use ops::{CoerceUnsized, DispatchFromDyn}; - -/// A wrapper type for raw pointers and integers that will never be -/// NULL or 0 that might allow certain optimizations. -#[rustc_layout_scalar_valid_range_start(1)] -#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[repr(transparent)] -pub(crate) struct NonZero(pub(crate) T); - -impl, U> CoerceUnsized> for NonZero {} - -impl, U> DispatchFromDyn> for NonZero {} diff --git a/src/libcore/num/bignum.rs b/src/libcore/num/bignum.rs index 732a02e8c42..c3a42a0fc04 100644 --- a/src/libcore/num/bignum.rs +++ b/src/libcore/num/bignum.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Custom arbitrary-precision number (bignum) implementation. //! //! This is designed to avoid the heap allocation at expense of stack memory. @@ -57,24 +47,25 @@ macro_rules! impl_full_ops { $( impl FullOps for $ty { fn full_add(self, other: $ty, carry: bool) -> (bool, $ty) { - // this cannot overflow, the output is between 0 and 2*2^nbits - 1 - // FIXME will LLVM optimize this into ADC or similar??? - let (v, carry1) = unsafe { intrinsics::add_with_overflow(self, other) }; - let (v, carry2) = unsafe { - intrinsics::add_with_overflow(v, if carry {1} else {0}) - }; + // This cannot overflow; the output is between `0` and `2 * 2^nbits - 1`. + // FIXME: will LLVM optimize this into ADC or similar? + let (v, carry1) = intrinsics::add_with_overflow(self, other); + let (v, carry2) = intrinsics::add_with_overflow(v, if carry {1} else {0}); (carry1 || carry2, v) } fn full_mul(self, other: $ty, carry: $ty) -> ($ty, $ty) { - // this cannot overflow, the output is between 0 and 2^nbits * (2^nbits - 1) + // This cannot overflow; + // the output is between `0` and `2^nbits * (2^nbits - 1)`. + // FIXME: will LLVM optimize this into ADC or similar? let nbits = mem::size_of::<$ty>() * 8; let v = (self as $bigty) * (other as $bigty) + (carry as $bigty); ((v >> nbits) as $ty, v as $ty) } fn full_mul_add(self, other: $ty, other2: $ty, carry: $ty) -> ($ty, $ty) { - // this cannot overflow, the output is between 0 and 2^(2*nbits) - 1 + // This cannot overflow; + // the output is between `0` and `2^nbits * (2^nbits - 1)`. let nbits = mem::size_of::<$ty>() * 8; let v = (self as $bigty) * (other as $bigty) + (other2 as $bigty) + (carry as $bigty); @@ -83,7 +74,7 @@ macro_rules! impl_full_ops { fn full_div_rem(self, other: $ty, borrow: $ty) -> ($ty, $ty) { debug_assert!(borrow < other); - // this cannot overflow, the dividend is between 0 and other * 2^nbits - 1 + // This cannot overflow; the output is between `0` and `other * (2^nbits - 1)`. let nbits = mem::size_of::<$ty>() * 8; let lhs = ((borrow as $bigty) << nbits) | (self as $bigty); let rhs = other as $bigty; @@ -98,7 +89,8 @@ impl_full_ops! { u8: add(intrinsics::u8_add_with_overflow), mul/div(u16); u16: add(intrinsics::u16_add_with_overflow), mul/div(u32); u32: add(intrinsics::u32_add_with_overflow), mul/div(u64); -// u64: add(intrinsics::u64_add_with_overflow), mul/div(u128); // see RFC #521 for enabling this. + // See RFC #521 for enabling this. + // u64: add(intrinsics::u64_add_with_overflow), mul/div(u128); } /// Table of powers of 5 representable in digits. Specifically, the largest {u8, u16, u32} value @@ -183,7 +175,7 @@ macro_rules! define_bignum { let nonzero = &digits[..end]; if nonzero.is_empty() { - // There are no non-zero digits, i.e. the number is zero. + // There are no non-zero digits, i.e., the number is zero. return 0; } // This could be optimized with leading_zeros() and bit shifts, but that's diff --git a/src/libcore/num/dec2flt/algorithm.rs b/src/libcore/num/dec2flt/algorithm.rs index ccf3950c2ba..d56fa9662a9 100644 --- a/src/libcore/num/dec2flt/algorithm.rs +++ b/src/libcore/num/dec2flt/algorithm.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The various algorithms from the paper. use cmp::min; @@ -61,9 +51,9 @@ mod fpu_precision { /// /// The only field which is relevant for the following code is PC, Precision Control. This /// field determines the precision of the operations performed by the FPU. It can be set to: - /// - 0b00, single precision i.e. 32-bits - /// - 0b10, double precision i.e. 64-bits - /// - 0b11, double extended precision i.e. 80-bits (default state) + /// - 0b00, single precision i.e., 32-bits + /// - 0b10, double precision i.e., 64-bits + /// - 0b11, double extended precision i.e., 80-bits (default state) /// The 0b01 value is reserved and should not be used. pub struct FPUControlWord(u16); diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs index f93564c2849..14a912872be 100644 --- a/src/libcore/num/dec2flt/mod.rs +++ b/src/libcore/num/dec2flt/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Converting decimal strings into IEEE 754 binary floating point numbers. //! //! # Problem statement @@ -122,11 +112,35 @@ macro_rules! from_str_float_impl { /// * '2.5E10', or equivalently, '2.5e10' /// * '2.5E-10' /// * '5.' - /// * '.5', or, equivalently, '0.5' + /// * '.5', or, equivalently, '0.5' /// * 'inf', '-inf', 'NaN' /// /// Leading and trailing whitespace represent an error. /// + /// # Grammar + /// + /// All strings that adhere to the following [EBNF] grammar + /// will result in an [`Ok`] being returned: + /// + /// ```txt + /// Float ::= Sign? ( 'inf' | 'NaN' | Number ) + /// Number ::= ( Digit+ | + /// Digit+ '.' Digit* | + /// Digit* '.' Digit+ ) Exp? + /// Exp ::= [eE] Sign? Digit+ + /// Sign ::= [+-] + /// Digit ::= [0-9] + /// ``` + /// + /// [EBNF]: https://www.w3.org/TR/REC-xml/#sec-notation + /// + /// # Known bugs + /// + /// In some situations, some strings that should create a valid float + /// instead return an error. See [issue #31407] for details. + /// + /// [issue #31407]: https://github.com/rust-lang/rust/issues/31407 + /// /// # Arguments /// /// * src - A string diff --git a/src/libcore/num/dec2flt/num.rs b/src/libcore/num/dec2flt/num.rs index 34b41fa9dec..b76c58cc66e 100644 --- a/src/libcore/num/dec2flt/num.rs +++ b/src/libcore/num/dec2flt/num.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Utility functions for bignums that don't make too much sense to turn into methods. // FIXME This module's name is a bit unfortunate, since other modules also import `core::num`. diff --git a/src/libcore/num/dec2flt/parse.rs b/src/libcore/num/dec2flt/parse.rs index e7ed94d4d91..9e075e43303 100644 --- a/src/libcore/num/dec2flt/parse.rs +++ b/src/libcore/num/dec2flt/parse.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Validating and decomposing a decimal string of the form: //! //! `(digits | digits? '.'? digits?) (('e' | 'E') ('+' | '-')? digits)?` diff --git a/src/libcore/num/dec2flt/rawfp.rs b/src/libcore/num/dec2flt/rawfp.rs index 38f4e4687a9..6976bd1a0ee 100644 --- a/src/libcore/num/dec2flt/rawfp.rs +++ b/src/libcore/num/dec2flt/rawfp.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Bit fiddling on positive IEEE 754 floats. Negative numbers aren't and needn't be handled. //! Normal floating point numbers have a canonical representation as (frac, exp) such that the //! value is 2exp * (1 + sum(frac[N-i] / 2i)) where N is the number of bits. @@ -349,7 +339,7 @@ pub fn prev_float(x: T) -> T { } // Find the smallest floating point number strictly larger than the argument. -// This operation is saturating, i.e. next_float(inf) == inf. +// This operation is saturating, i.e., next_float(inf) == inf. // Unlike most code in this module, this function does handle zero, subnormals, and infinities. // However, like all other code here, it does not deal with NaN and negative numbers. pub fn next_float(x: T) -> T { diff --git a/src/libcore/num/dec2flt/table.rs b/src/libcore/num/dec2flt/table.rs index cb8c94313d0..345ac830aaa 100644 --- a/src/libcore/num/dec2flt/table.rs +++ b/src/libcore/num/dec2flt/table.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Tables of approximations of powers of ten. //! DO NOT MODIFY: Generated by `src/etc/dec2flt_table.py` diff --git a/src/libcore/num/diy_float.rs b/src/libcore/num/diy_float.rs index b0561da5934..cdf33298949 100644 --- a/src/libcore/num/diy_float.rs +++ b/src/libcore/num/diy_float.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Extended precision "soft float", for internal use only. // This module is only for dec2flt and flt2dec, and only public because of coretests. diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index d6c3996971a..68da79135d3 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module provides constants which are specific to the implementation //! of the `f32` floating point data type. //! @@ -171,6 +161,14 @@ impl f32 { self != self } + // FIXME(#50145): `abs` is publicly unavailable in libcore due to + // concerns about portability, so this implementation is for + // private use internally. + #[inline] + fn abs_private(self) -> f32 { + f32::from_bits(self.to_bits() & 0x7fff_ffff) + } + /// Returns `true` if this value is positive infinity or negative infinity and /// false otherwise. /// @@ -191,7 +189,7 @@ impl f32 { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn is_infinite(self) -> bool { - self == INFINITY || self == NEG_INFINITY + self.abs_private() == INFINITY } /// Returns `true` if this number is neither infinite nor `NaN`. @@ -213,7 +211,9 @@ impl f32 { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn is_finite(self) -> bool { - !(self.is_nan() || self.is_infinite()) + // There's no need to handle NaN separately: if self is NaN, + // the comparison is not true, exactly as desired. + self.abs_private() < INFINITY } /// Returns `true` if the number is neither zero, infinite, diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index b8e3dd6ed64..b6773915481 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module provides constants which are specific to the implementation //! of the `f64` floating point data type. //! @@ -171,6 +161,14 @@ impl f64 { self != self } + // FIXME(#50145): `abs` is publicly unavailable in libcore due to + // concerns about portability, so this implementation is for + // private use internally. + #[inline] + fn abs_private(self) -> f64 { + f64::from_bits(self.to_bits() & 0x7fff_ffff_ffff_ffff) + } + /// Returns `true` if this value is positive infinity or negative infinity and /// false otherwise. /// @@ -191,7 +189,7 @@ impl f64 { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn is_infinite(self) -> bool { - self == INFINITY || self == NEG_INFINITY + self.abs_private() == INFINITY } /// Returns `true` if this number is neither infinite nor `NaN`. @@ -213,7 +211,9 @@ impl f64 { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn is_finite(self) -> bool { - !(self.is_nan() || self.is_infinite()) + // There's no need to handle NaN separately: if self is NaN, + // the comparison is not true, exactly as desired. + self.abs_private() < INFINITY } /// Returns `true` if the number is neither zero, infinite, diff --git a/src/libcore/num/flt2dec/decoder.rs b/src/libcore/num/flt2dec/decoder.rs index c34a56f288f..a3bf783976b 100644 --- a/src/libcore/num/flt2dec/decoder.rs +++ b/src/libcore/num/flt2dec/decoder.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Decodes a floating-point value into individual parts and error ranges. use {f32, f64}; diff --git a/src/libcore/num/flt2dec/estimator.rs b/src/libcore/num/flt2dec/estimator.rs index 4e33fcfd76e..50e2f705283 100644 --- a/src/libcore/num/flt2dec/estimator.rs +++ b/src/libcore/num/flt2dec/estimator.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The exponent estimator. /// Finds `k_0` such that `10^(k_0-1) < mant * 2^exp <= 10^(k_0+1)`. diff --git a/src/libcore/num/flt2dec/mod.rs b/src/libcore/num/flt2dec/mod.rs index d58015beecb..f9b46a12f7f 100644 --- a/src/libcore/num/flt2dec/mod.rs +++ b/src/libcore/num/flt2dec/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /*! Floating-point number to decimal conversion routines. @@ -23,7 +13,7 @@ representation `V = 0.d[0..n-1] * 10^k` such that: - `d[0]` is non-zero. - It's correctly rounded when parsed back: `v - minus < V < v + plus`. - Furthermore it is shortest such one, i.e. there is no representation + Furthermore it is shortest such one, i.e., there is no representation with less than `n` digits that is correctly rounded. - It's closest to the original value: `abs(V - v) <= 10^(k-n) / 2`. Note that @@ -398,7 +388,7 @@ fn determine_sign(sign: Sign, decoded: &FullDecoded, negative: bool) -> &'static /// given number of fractional digits. The result is stored to the supplied parts /// array while utilizing given byte buffer as a scratch. `upper` is currently /// unused but left for the future decision to change the case of non-finite values, -/// i.e. `inf` and `nan`. The first part to be rendered is always a `Part::Sign` +/// i.e., `inf` and `nan`. The first part to be rendered is always a `Part::Sign` /// (which can be an empty string if no sign is rendered). /// /// `format_shortest` should be the underlying digit-generation function. @@ -591,7 +581,7 @@ pub fn to_exact_exp_str<'a, T, F>(mut format_exact: F, v: T, /// given number of fractional digits. The result is stored to the supplied parts /// array while utilizing given byte buffer as a scratch. `upper` is currently /// unused but left for the future decision to change the case of non-finite values, -/// i.e. `inf` and `nan`. The first part to be rendered is always a `Part::Sign` +/// i.e., `inf` and `nan`. The first part to be rendered is always a `Part::Sign` /// (which can be an empty string if no sign is rendered). /// /// `format_exact` should be the underlying digit-generation function. diff --git a/src/libcore/num/flt2dec/strategy/dragon.rs b/src/libcore/num/flt2dec/strategy/dragon.rs index aa6a08cb205..582fe22f854 100644 --- a/src/libcore/num/flt2dec/strategy/dragon.rs +++ b/src/libcore/num/flt2dec/strategy/dragon.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Almost direct (but slightly optimized) Rust translation of Figure 3 of "Printing //! Floating-Point Numbers Quickly and Accurately"[^1]. //! @@ -81,11 +71,11 @@ pub fn format_shortest(d: &Decoded, buf: &mut [u8]) -> (/*#digits*/ usize, /*exp // - followed by `(mant + 2 * plus) * 2^exp` in the original type. // // obviously, `minus` and `plus` cannot be zero. (for infinities, we use out-of-range values.) - // also we assume that at least one digit is generated, i.e. `mant` cannot be zero too. + // also we assume that at least one digit is generated, i.e., `mant` cannot be zero too. // // this also means that any number between `low = (mant - minus) * 2^exp` and // `high = (mant + plus) * 2^exp` will map to this exact floating point number, - // with bounds included when the original mantissa was even (i.e. `!mant_was_odd`). + // with bounds included when the original mantissa was even (i.e., `!mant_was_odd`). assert!(d.mant > 0); assert!(d.minus > 0); @@ -172,7 +162,7 @@ pub fn format_shortest(d: &Decoded, buf: &mut [u8]) -> (/*#digits*/ usize, /*exp // - `high - v = plus / scale * 10^(k-n)` // // assume that `d[0..n-1]` is the shortest representation between `low` and `high`, - // i.e. `d[0..n-1]` satisfies both of the following but `d[0..n-2]` doesn't: + // i.e., `d[0..n-1]` satisfies both of the following but `d[0..n-2]` doesn't: // - `low < d[0..n-1] * 10^(k-n) < high` (bijectivity: digits round to `v`); and // - `abs(v / 10^(k-n) - d[0..n-1]) <= 1/2` (the last digit is correct). // @@ -304,7 +294,7 @@ pub fn format_exact(d: &Decoded, buf: &mut [u8], limit: i16) -> (/*#digits*/ usi // rounding up if we stop in the middle of digits // if the following digits are exactly 5000..., check the prior digit and try to - // round to even (i.e. avoid rounding up when the prior digit is even). + // round to even (i.e., avoid rounding up when the prior digit is even). let order = mant.cmp(scale.mul_small(5)); if order == Ordering::Greater || (order == Ordering::Equal && (len == 0 || buf[len-1] & 1 == 1)) { diff --git a/src/libcore/num/flt2dec/strategy/grisu.rs b/src/libcore/num/flt2dec/strategy/grisu.rs index effe073c381..aa21fcffa5c 100644 --- a/src/libcore/num/flt2dec/strategy/grisu.rs +++ b/src/libcore/num/flt2dec/strategy/grisu.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Rust adaptation of the Grisu3 algorithm described in "Printing Floating-Point Numbers Quickly //! and Accurately with Integers"[^1]. It uses about 1KB of precomputed table, and in turn, it's //! very quick for most inputs. @@ -242,7 +232,7 @@ pub fn format_shortest_opt(d: &Decoded, // // find the digit length `kappa` between `(minus1, plus1)` as per Theorem 6.2. // Theorem 6.2 can be adopted to exclude `x` by requiring `y mod 10^k < y - x` instead. - // (e.g. `x` = 32000, `y` = 32777; `kappa` = 2 since `y mod 10^3 = 777 < y - x = 777`.) + // (e.g., `x` = 32000, `y` = 32777; `kappa` = 2 since `y mod 10^3 = 777 < y - x = 777`.) // the algorithm relies on the later verification phase to exclude `y`. let delta1 = plus1 - minus1; // let delta1int = (delta1 >> e) as usize; // only for explanation @@ -362,19 +352,19 @@ pub fn format_shortest_opt(d: &Decoded, // proceed, but we then have at least one valid representation known to be closest to // `v + 1 ulp` anyway. we will denote them as TC1 through TC3 for brevity. // - // TC1: `w(n) <= v + 1 ulp`, i.e. this is the last repr that can be the closest one. + // TC1: `w(n) <= v + 1 ulp`, i.e., this is the last repr that can be the closest one. // this is equivalent to `plus1 - w(n) = plus1w(n) >= plus1 - (v + 1 ulp) = plus1v_up`. // combined with TC2 (which checks if `w(n+1)` is valid), this prevents the possible // overflow on the calculation of `plus1w(n)`. // - // TC2: `w(n+1) < minus1`, i.e. the next repr definitely does not round to `v`. + // TC2: `w(n+1) < minus1`, i.e., the next repr definitely does not round to `v`. // this is equivalent to `plus1 - w(n) + 10^kappa = plus1w(n) + 10^kappa > // plus1 - minus1 = threshold`. the left hand side can overflow, but we know // `threshold > plus1v`, so if TC1 is false, `threshold - plus1w(n) > // threshold - (plus1v - 1 ulp) > 1 ulp` and we can safely test if // `threshold - plus1w(n) < 10^kappa` instead. // - // TC3: `abs(w(n) - (v + 1 ulp)) <= abs(w(n+1) - (v + 1 ulp))`, i.e. the next repr is + // TC3: `abs(w(n) - (v + 1 ulp)) <= abs(w(n+1) - (v + 1 ulp))`, i.e., the next repr is // no closer to `v + 1 ulp` than the current repr. given `z(n) = plus1v_up - plus1w(n)`, // this becomes `abs(z(n)) <= abs(z(n+1))`. again assuming that TC1 is false, we have // `z(n) > 0`. we have two cases to consider: @@ -384,7 +374,7 @@ pub fn format_shortest_opt(d: &Decoded, // - when `z(n+1) < 0`: // - TC3a: the precondition is `plus1v_up < plus1w(n) + 10^kappa`. assuming TC2 is // false, `threshold >= plus1w(n) + 10^kappa` so it cannot overflow. - // - TC3b: TC3 becomes `z(n) <= -z(n+1)`, i.e. `plus1v_up - plus1w(n) >= + // - TC3b: TC3 becomes `z(n) <= -z(n+1)`, i.e., `plus1v_up - plus1w(n) >= // plus1w(n+1) - plus1v_up = plus1w(n) + 10^kappa - plus1v_up`. the negated TC1 // gives `plus1v_up > plus1w(n)`, so it cannot overflow or underflow when // combined with TC3a. @@ -414,7 +404,7 @@ pub fn format_shortest_opt(d: &Decoded, // now we have the closest representation to `v` between `plus1` and `minus1`. // this is too liberal, though, so we reject any `w(n)` not between `plus0` and `minus0`, - // i.e. `plus1 - plus1w(n) <= minus0` or `plus1 - plus1w(n) >= plus0`. we utilize the facts + // i.e., `plus1 - plus1w(n) <= minus0` or `plus1 - plus1w(n) >= plus0`. we utilize the facts // that `threshold = plus1 - minus1` and `plus1 - plus0 = minus0 - minus1 = 2 ulp`. if 2 * ulp <= plus1w && plus1w <= threshold - 4 * ulp { Some((buf.len(), exp)) @@ -675,7 +665,7 @@ pub fn format_exact_opt(d: &Decoded, buf: &mut [u8], limit: i16) return Some((len, exp)); } - // otherwise we are doomed (i.e. some values between `v - 1 ulp` and `v + 1 ulp` are + // otherwise we are doomed (i.e., some values between `v - 1 ulp` and `v + 1 ulp` are // rounding down and others are rounding up) and give up. None } diff --git a/src/libcore/num/i128.rs b/src/libcore/num/i128.rs index 989376d1ac2..564ed598a88 100644 --- a/src/libcore/num/i128.rs +++ b/src/libcore/num/i128.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The 128-bit signed integer type. //! //! *[See also the `i128` primitive type](../../std/primitive.i128.html).* diff --git a/src/libcore/num/i16.rs b/src/libcore/num/i16.rs index 0f3a5baa2dd..44d6aaef25b 100644 --- a/src/libcore/num/i16.rs +++ b/src/libcore/num/i16.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The 16-bit signed integer type. //! //! *[See also the `i16` primitive type](../../std/primitive.i16.html).* diff --git a/src/libcore/num/i32.rs b/src/libcore/num/i32.rs index ea8b3a9145c..90a5f89195e 100644 --- a/src/libcore/num/i32.rs +++ b/src/libcore/num/i32.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The 32-bit signed integer type. //! //! *[See also the `i32` primitive type](../../std/primitive.i32.html).* diff --git a/src/libcore/num/i64.rs b/src/libcore/num/i64.rs index aa21b1190ae..04a8a9d7579 100644 --- a/src/libcore/num/i64.rs +++ b/src/libcore/num/i64.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The 64-bit signed integer type. //! //! *[See also the `i64` primitive type](../../std/primitive.i64.html).* diff --git a/src/libcore/num/i8.rs b/src/libcore/num/i8.rs index 1bed4861594..5a52a967cf9 100644 --- a/src/libcore/num/i8.rs +++ b/src/libcore/num/i8.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The 8-bit signed integer type. //! //! *[See also the `i8` primitive type](../../std/primitive.i8.html).* diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs index 3b1612a4ee2..5c59fe25f64 100644 --- a/src/libcore/num/int_macros.rs +++ b/src/libcore/num/int_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![doc(hidden)] macro_rules! int_module { diff --git a/src/libcore/num/isize.rs b/src/libcore/num/isize.rs index e0917f79c43..143f8b3b272 100644 --- a/src/libcore/num/isize.rs +++ b/src/libcore/num/isize.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The pointer-sized signed integer type. //! //! *[See also the `isize` primitive type](../../std/primitive.isize.html).* diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 30b7b454684..f80f8392827 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Numeric traits and functions for the built-in numeric types. #![stable(feature = "rust1", since = "1.0.0")] @@ -16,14 +6,13 @@ use convert::TryFrom; use fmt; use intrinsics; use mem; -use nonzero::NonZero; use ops; use str::FromStr; macro_rules! impl_nonzero_fmt { - ( ( $( $Trait: ident ),+ ) for $Ty: ident ) => { + ( #[$stability: meta] ( $( $Trait: ident ),+ ) for $Ty: ident ) => { $( - #[stable(feature = "nonzero", since = "1.28.0")] + #[$stability] impl fmt::$Trait for $Ty { #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -42,7 +31,7 @@ macro_rules! doc_comment { } macro_rules! nonzero_integers { - ( $( $Ty: ident($Int: ty); )+ ) => { + ( $( #[$stability: meta] $Ty: ident($Int: ty); )+ ) => { $( doc_comment! { concat!("An integer that is known not to equal zero. @@ -52,13 +41,14 @@ For example, `Option<", stringify!($Ty), ">` is the same size as `", stringify!( ```rust use std::mem::size_of; -assert_eq!(size_of::>(), size_of::<", stringify!($Int), +assert_eq!(size_of::>(), size_of::<", stringify!($Int), ">()); ```"), - #[stable(feature = "nonzero", since = "1.28.0")] + #[$stability] #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] #[repr(transparent)] - pub struct $Ty(NonZero<$Int>); + #[rustc_layout_scalar_valid_range_start(1)] + pub struct $Ty($Int); } impl $Ty { @@ -67,28 +57,28 @@ assert_eq!(size_of::>(), size_of::<", st /// # Safety /// /// The value must not be zero. - #[stable(feature = "nonzero", since = "1.28.0")] + #[$stability] #[inline] pub const unsafe fn new_unchecked(n: $Int) -> Self { - $Ty(NonZero(n)) + $Ty(n) } /// Create a non-zero if the given value is not zero. - #[stable(feature = "nonzero", since = "1.28.0")] + #[$stability] #[inline] pub fn new(n: $Int) -> Option { if n != 0 { - Some($Ty(NonZero(n))) + Some(unsafe { $Ty(n) }) } else { None } } /// Returns the value as a primitive type. - #[stable(feature = "nonzero", since = "1.28.0")] + #[$stability] #[inline] - pub fn get(self) -> $Int { - self.0 .0 + pub const fn get(self) -> $Int { + self.0 } } @@ -96,24 +86,30 @@ assert_eq!(size_of::>(), size_of::<", st #[stable(feature = "from_nonzero", since = "1.31.0")] impl From<$Ty> for $Int { fn from(nonzero: $Ty) -> Self { - nonzero.0 .0 + nonzero.0 } } impl_nonzero_fmt! { - (Debug, Display, Binary, Octal, LowerHex, UpperHex) for $Ty + #[$stability] (Debug, Display, Binary, Octal, LowerHex, UpperHex) for $Ty } )+ } } nonzero_integers! { - NonZeroU8(u8); - NonZeroU16(u16); - NonZeroU32(u32); - NonZeroU64(u64); - NonZeroU128(u128); - NonZeroUsize(usize); + #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU8(u8); + #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU16(u16); + #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU32(u32); + #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU64(u64); + #[stable(feature = "nonzero", since = "1.28.0")] NonZeroU128(u128); + #[stable(feature = "nonzero", since = "1.28.0")] NonZeroUsize(usize); + #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI8(i8); + #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI16(i16); + #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI32(i32); + #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI64(i64); + #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroI128(i128); + #[stable(feature = "signed_nonzero", since = "1.34.0")] NonZeroIsize(isize); } /// Provides intentionally-wrapped arithmetic on `T`. @@ -285,7 +281,6 @@ $EndFeature, " ``` "), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn count_ones(self) -> u32 { (self as $UnsignedT).count_ones() } } @@ -301,7 +296,6 @@ Basic usage: ", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 1);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn count_zeros(self) -> u32 { (!self).count_ones() @@ -322,7 +316,6 @@ assert_eq!(n.leading_zeros(), 0);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn leading_zeros(self) -> u32 { (self as $UnsignedT).leading_zeros() @@ -343,7 +336,6 @@ assert_eq!(n.trailing_zeros(), 2);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn trailing_zeros(self) -> u32 { (self as $UnsignedT).trailing_zeros() @@ -367,7 +359,6 @@ let m = ", $rot_result, "; assert_eq!(n.rotate_left(", $rot, "), m); ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_rotate")] #[inline] pub const fn rotate_left(self, n: u32) -> Self { (self as $UnsignedT).rotate_left(n) as Self @@ -392,7 +383,6 @@ let m = ", $rot_op, "; assert_eq!(n.rotate_right(", $rot, "), m); ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_rotate")] #[inline] pub const fn rotate_right(self, n: u32) -> Self { (self as $UnsignedT).rotate_right(n) as Self @@ -414,7 +404,6 @@ let m = n.swap_bytes(); assert_eq!(m, ", $swapped, "); ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn swap_bytes(self) -> Self { (self as $UnsignedT).swap_bytes() as Self @@ -464,7 +453,6 @@ if cfg!(target_endian = \"big\") { $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn from_be(x: Self) -> Self { #[cfg(target_endian = "big")] @@ -498,7 +486,6 @@ if cfg!(target_endian = \"little\") { $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn from_le(x: Self) -> Self { #[cfg(target_endian = "little")] @@ -532,7 +519,6 @@ if cfg!(target_endian = \"big\") { $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn to_be(self) -> Self { // or not to be? #[cfg(target_endian = "big")] @@ -566,7 +552,6 @@ if cfg!(target_endian = \"little\") { $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn to_le(self) -> Self { #[cfg(target_endian = "little")] @@ -673,7 +658,7 @@ $EndFeature, " } doc_comment! { - concat!("Checked Euclidean division. Computes `self.div_euc(rhs)`, + concat!("Checked Euclidean division. Computes `self.div_euclid(rhs)`, returning `None` if `rhs == 0` or the division results in overflow. # Examples @@ -683,17 +668,17 @@ Basic usage: ``` #![feature(euclidean_division)] assert_eq!((", stringify!($SelfT), -"::min_value() + 1).checked_div_euc(-1), Some(", stringify!($Max), ")); -assert_eq!(", stringify!($SelfT), "::min_value().checked_div_euc(-1), None); -assert_eq!((1", stringify!($SelfT), ").checked_div_euc(0), None); +"::min_value() + 1).checked_div_euclid(-1), Some(", stringify!($Max), ")); +assert_eq!(", stringify!($SelfT), "::min_value().checked_div_euclid(-1), None); +assert_eq!((1", stringify!($SelfT), ").checked_div_euclid(0), None); ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] - pub fn checked_div_euc(self, rhs: Self) -> Option { + pub fn checked_div_euclid(self, rhs: Self) -> Option { if rhs == 0 || (self == Self::min_value() && rhs == -1) { None } else { - Some(self.div_euc(rhs)) + Some(self.div_euclid(rhs)) } } } @@ -726,8 +711,8 @@ $EndFeature, " } doc_comment! { - concat!("Checked Euclidean modulo. Computes `self.mod_euc(rhs)`, returning `None` if -`rhs == 0` or the division results in overflow. + concat!("Checked Euclidean remainder. Computes `self.rem_euclid(rhs)`, returning `None` +if `rhs == 0` or the division results in overflow. # Examples @@ -737,17 +722,17 @@ Basic usage: #![feature(euclidean_division)] use std::", stringify!($SelfT), "; -assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(2), Some(1)); -assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(0), None); -assert_eq!(", stringify!($SelfT), "::MIN.checked_mod_euc(-1), None); +assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(2), Some(1)); +assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(0), None); +assert_eq!(", stringify!($SelfT), "::MIN.checked_rem_euclid(-1), None); ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] - pub fn checked_mod_euc(self, rhs: Self) -> Option { + pub fn checked_rem_euclid(self, rhs: Self) -> Option { if rhs == 0 || (self == Self::min_value() && rhs == -1) { None } else { - Some(self.mod_euc(rhs)) + Some(self.rem_euclid(rhs)) } } } @@ -851,13 +836,12 @@ overflow occurred. Basic usage: ``` -#![feature(no_panic_pow)] ", $Feature, "assert_eq!(8", stringify!($SelfT), ".checked_pow(2), Some(64)); assert_eq!(", stringify!($SelfT), "::max_value().checked_pow(2), None);", $EndFeature, " ```"), - #[unstable(feature = "no_panic_pow", issue = "48320")] + #[stable(feature = "no_panic_pow", since = "1.34.0")] #[inline] pub fn checked_pow(self, mut exp: u32) -> Option { let mut base = self; @@ -899,11 +883,16 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn saturating_add(self, rhs: Self) -> Self { + #[cfg(stage0)] match self.checked_add(rhs) { Some(x) => x, None if rhs >= 0 => Self::max_value(), None => Self::min_value(), } + #[cfg(not(stage0))] + { + intrinsics::saturating_add(self, rhs) + } } } @@ -924,11 +913,16 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn saturating_sub(self, rhs: Self) -> Self { + #[cfg(stage0)] match self.checked_sub(rhs) { Some(x) => x, None if rhs >= 0 => Self::min_value(), None => Self::max_value(), } + #[cfg(not(stage0))] + { + intrinsics::saturating_sub(self, rhs) + } } } @@ -970,7 +964,6 @@ saturating at the numeric bounds instead of overflowing. Basic usage: ``` -#![feature(no_panic_pow)] ", $Feature, "use std::", stringify!($SelfT), "; assert_eq!((-4", stringify!($SelfT), ").saturating_pow(3), -64); @@ -978,7 +971,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(2), ", stringify!($SelfT assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(3), ", stringify!($SelfT), "::MIN);", $EndFeature, " ```"), - #[unstable(feature = "no_panic_pow", issue = "48320")] + #[stable(feature = "no_panic_pow", since = "1.34.0")] #[inline] pub fn saturating_pow(self, exp: u32) -> Self { match self.checked_pow(exp) { @@ -1004,12 +997,9 @@ assert_eq!(", stringify!($SelfT), "::max_value().wrapping_add(2), ", stringify!( $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] pub const fn wrapping_add(self, rhs: Self) -> Self { - unsafe { - intrinsics::overflowing_add(self, rhs) - } + intrinsics::overflowing_add(self, rhs) } } @@ -1028,12 +1018,9 @@ stringify!($SelfT), "::max_value());", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] pub const fn wrapping_sub(self, rhs: Self) -> Self { - unsafe { - intrinsics::overflowing_sub(self, rhs) - } + intrinsics::overflowing_sub(self, rhs) } } @@ -1051,12 +1038,9 @@ assert_eq!(11i8.wrapping_mul(12), -124);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] pub const fn wrapping_mul(self, rhs: Self) -> Self { - unsafe { - intrinsics::overflowing_mul(self, rhs) - } + intrinsics::overflowing_mul(self, rhs) } } @@ -1089,7 +1073,7 @@ $EndFeature, " } doc_comment! { - concat!("Wrapping Euclidean division. Computes `self.div_euc(rhs)`, + concat!("Wrapping Euclidean division. Computes `self.div_euclid(rhs)`, wrapping around at the boundary of the type. Wrapping will only occur in `MIN / -1` on a signed type (where `MIN` is the negative minimal value @@ -1106,13 +1090,13 @@ Basic usage: ``` #![feature(euclidean_division)] -assert_eq!(100", stringify!($SelfT), ".wrapping_div_euc(10), 10); -assert_eq!((-128i8).wrapping_div_euc(-1), -128); +assert_eq!(100", stringify!($SelfT), ".wrapping_div_euclid(10), 10); +assert_eq!((-128i8).wrapping_div_euclid(-1), -128); ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] - pub fn wrapping_div_euc(self, rhs: Self) -> Self { - self.overflowing_div_euc(rhs).0 + pub fn wrapping_div_euclid(self, rhs: Self) -> Self { + self.overflowing_div_euclid(rhs).0 } } @@ -1145,8 +1129,8 @@ $EndFeature, " } doc_comment! { - concat!("Wrapping Euclidean modulo. Computes `self.mod_euc(rhs)`, wrapping around at the -boundary of the type. + concat!("Wrapping Euclidean remainder. Computes `self.rem_euclid(rhs)`, wrapping around +at the boundary of the type. Wrapping will only occur in `MIN % -1` on a signed type (where `MIN` is the negative minimal value for the type). In this case, this method returns 0. @@ -1161,13 +1145,13 @@ Basic usage: ``` #![feature(euclidean_division)] -assert_eq!(100", stringify!($SelfT), ".wrapping_mod_euc(10), 0); -assert_eq!((-128i8).wrapping_mod_euc(-1), 0); +assert_eq!(100", stringify!($SelfT), ".wrapping_rem_euclid(10), 0); +assert_eq!((-128i8).wrapping_rem_euclid(-1), 0); ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] - pub fn wrapping_mod_euc(self, rhs: Self) -> Self { - self.overflowing_mod_euc(rhs).0 + pub fn wrapping_rem_euclid(self, rhs: Self) -> Self { + self.overflowing_rem_euclid(rhs).0 } } @@ -1215,7 +1199,6 @@ assert_eq!((-1", stringify!($SelfT), ").wrapping_shl(128), -1);", $EndFeature, " ```"), #[stable(feature = "num_wrapping", since = "1.2.0")] - #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] pub const fn wrapping_shl(self, rhs: u32) -> Self { unsafe { @@ -1243,7 +1226,6 @@ assert_eq!((-128i16).wrapping_shr(64), -128);", $EndFeature, " ```"), #[stable(feature = "num_wrapping", since = "1.2.0")] - #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] pub const fn wrapping_shr(self, rhs: u32) -> Self { unsafe { @@ -1292,13 +1274,12 @@ wrapping around at the boundary of the type. Basic usage: ``` -#![feature(no_panic_pow)] ", $Feature, "assert_eq!(3", stringify!($SelfT), ".wrapping_pow(4), 81); assert_eq!(3i8.wrapping_pow(5), -13); assert_eq!(3i8.wrapping_pow(6), -39);", $EndFeature, " ```"), - #[unstable(feature = "no_panic_pow", issue = "48320")] + #[stable(feature = "no_panic_pow", since = "1.34.0")] #[inline] pub fn wrapping_pow(self, mut exp: u32) -> Self { let mut base = self; @@ -1341,13 +1322,9 @@ assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (", stringify!($Sel "::MIN, true));", $EndFeature, " ```"), #[stable(feature = "wrapping", since = "1.7.0")] - #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] pub const fn overflowing_add(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { - intrinsics::add_with_overflow(self as $ActualT, - rhs as $ActualT) - }; + let (a, b) = intrinsics::add_with_overflow(self as $ActualT, rhs as $ActualT); (a as Self, b) } } @@ -1370,13 +1347,9 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_sub(1), (", stringify!($Sel "::MAX, true));", $EndFeature, " ```"), #[stable(feature = "wrapping", since = "1.7.0")] - #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { - intrinsics::sub_with_overflow(self as $ActualT, - rhs as $ActualT) - }; + let (a, b) = intrinsics::sub_with_overflow(self as $ActualT, rhs as $ActualT); (a as Self, b) } } @@ -1397,13 +1370,9 @@ assert_eq!(1_000_000_000i32.overflowing_mul(10), (1410065408, true));", $EndFeature, " ```"), #[stable(feature = "wrapping", since = "1.7.0")] - #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { - intrinsics::mul_with_overflow(self as $ActualT, - rhs as $ActualT) - }; + let (a, b) = intrinsics::mul_with_overflow(self as $ActualT, rhs as $ActualT); (a as Self, b) } } @@ -1442,7 +1411,7 @@ $EndFeature, " } doc_comment! { - concat!("Calculates the quotient of Euclidean division `self.div_euc(rhs)`. + concat!("Calculates the quotient of Euclidean division `self.div_euclid(rhs)`. Returns a tuple of the divisor along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would occur then `self` is returned. @@ -1459,17 +1428,17 @@ Basic usage: #![feature(euclidean_division)] use std::", stringify!($SelfT), "; -assert_eq!(5", stringify!($SelfT), ".overflowing_div_euc(2), (2, false)); -assert_eq!(", stringify!($SelfT), "::MIN.overflowing_div_euc(-1), (", stringify!($SelfT), +assert_eq!(5", stringify!($SelfT), ".overflowing_div_euclid(2), (2, false)); +assert_eq!(", stringify!($SelfT), "::MIN.overflowing_div_euclid(-1), (", stringify!($SelfT), "::MIN, true)); ```"), #[inline] #[unstable(feature = "euclidean_division", issue = "49048")] - pub fn overflowing_div_euc(self, rhs: Self) -> (Self, bool) { + pub fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) { if self == Self::min_value() && rhs == -1 { (self, true) } else { - (self.div_euc(rhs), false) + (self.div_euclid(rhs), false) } } } @@ -1508,7 +1477,7 @@ $EndFeature, " doc_comment! { - concat!("Calculates the remainder `self.mod_euc(rhs)` by Euclidean division. + concat!("Overflowing Euclidean remainder. Calculates `self.rem_euclid(rhs)`. Returns a tuple of the remainder after dividing along with a boolean indicating whether an arithmetic overflow would occur. If an overflow would occur then 0 is returned. @@ -1525,16 +1494,16 @@ Basic usage: #![feature(euclidean_division)] use std::", stringify!($SelfT), "; -assert_eq!(5", stringify!($SelfT), ".overflowing_mod_euc(2), (1, false)); -assert_eq!(", stringify!($SelfT), "::MIN.overflowing_mod_euc(-1), (0, true)); +assert_eq!(5", stringify!($SelfT), ".overflowing_rem_euclid(2), (1, false)); +assert_eq!(", stringify!($SelfT), "::MIN.overflowing_rem_euclid(-1), (0, true)); ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] - pub fn overflowing_mod_euc(self, rhs: Self) -> (Self, bool) { + pub fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) { if self == Self::min_value() && rhs == -1 { (0, true) } else { - (self.mod_euc(rhs), false) + (self.rem_euclid(rhs), false) } } } @@ -1544,7 +1513,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_mod_euc(-1), (0, true)); concat!("Negates self, overflowing if this is equal to the minimum value. Returns a tuple of the negated version of self along with a boolean indicating whether an overflow -happened. If `self` is the minimum value (e.g. `i32::MIN` for values of type `i32`), then the +happened. If `self` is the minimum value (e.g., `i32::MIN` for values of type `i32`), then the minimum value will be returned again and `true` will be returned for an overflow happening. # Examples @@ -1586,7 +1555,6 @@ assert_eq!(0x1i32.overflowing_shl(36), (0x10, true));", $EndFeature, " ```"), #[stable(feature = "wrapping", since = "1.7.0")] - #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool) { (self.wrapping_shl(rhs), (rhs > ($BITS - 1))) @@ -1610,7 +1578,6 @@ assert_eq!(0x10i32.overflowing_shr(36), (0x1, true));", $EndFeature, " ```"), #[stable(feature = "wrapping", since = "1.7.0")] - #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool) { (self.wrapping_shr(rhs), (rhs > ($BITS - 1))) @@ -1621,7 +1588,7 @@ $EndFeature, " concat!("Computes the absolute value of `self`. Returns a tuple of the absolute version of self along with a boolean indicating whether an overflow -happened. If self is the minimum value (e.g. ", stringify!($SelfT), "::MIN for values of type +happened. If self is the minimum value (e.g., ", stringify!($SelfT), "::MIN for values of type ", stringify!($SelfT), "), then the minimum value will be returned again and true will be returned for an overflow happening. @@ -1658,12 +1625,11 @@ whether an overflow happened. Basic usage: ``` -#![feature(no_panic_pow)] ", $Feature, "assert_eq!(3", stringify!($SelfT), ".overflowing_pow(4), (81, false)); assert_eq!(3i8.overflowing_pow(5), (-13, true));", $EndFeature, " ```"), - #[unstable(feature = "no_panic_pow", issue = "48320")] + #[stable(feature = "no_panic_pow", since = "1.34.0")] #[inline] pub fn overflowing_pow(self, mut exp: u32) -> (Self, bool) { let mut base = self; @@ -1739,9 +1705,13 @@ $EndFeature, " doc_comment! { concat!("Calculates the quotient of Euclidean division of `self` by `rhs`. -This computes the integer `n` such that `self = n * rhs + self.mod_euc(rhs)`. +This computes the integer `n` such that `self = n * rhs + self.rem_euclid(rhs)`, +with `0 <= self.rem_euclid(rhs) < rhs`. + In other words, the result is `self / rhs` rounded to the integer `n` such that `self >= n * rhs`. +If `self > 0`, this is equal to round towards zero (the default in Rust); +if `self < 0`, this is equal to round towards +/- infinity. # Panics @@ -1756,15 +1726,15 @@ Basic usage: let a: ", stringify!($SelfT), " = 7; // or any other integer type let b = 4; -assert_eq!(a.div_euc(b), 1); // 7 >= 4 * 1 -assert_eq!(a.div_euc(-b), -1); // 7 >= -4 * -1 -assert_eq!((-a).div_euc(b), -2); // -7 >= 4 * -2 -assert_eq!((-a).div_euc(-b), 2); // -7 >= -4 * 2 +assert_eq!(a.div_euclid(b), 1); // 7 >= 4 * 1 +assert_eq!(a.div_euclid(-b), -1); // 7 >= -4 * -1 +assert_eq!((-a).div_euclid(b), -2); // -7 >= 4 * -2 +assert_eq!((-a).div_euclid(-b), 2); // -7 >= -4 * 2 ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] #[rustc_inherit_overflow_checks] - pub fn div_euc(self, rhs: Self) -> Self { + pub fn div_euclid(self, rhs: Self) -> Self { let q = self / rhs; if self % rhs < 0 { return if rhs > 0 { q - 1 } else { q + 1 } @@ -1775,9 +1745,11 @@ assert_eq!((-a).div_euc(-b), 2); // -7 >= -4 * 2 doc_comment! { - concat!("Calculates the remainder `self mod rhs` by Euclidean division. + concat!("Calculates the least nonnegative remainder of `self (mod rhs)`. -In particular, the result `n` satisfies `0 <= n < rhs.abs()`. +This is done as if by the Euclidean division algorithm -- given +`r = self.rem_euclid(rhs)`, `self = rhs * self.div_euclid(rhs) + r`, and +`0 <= r < abs(rhs)`. # Panics @@ -1792,15 +1764,15 @@ Basic usage: let a: ", stringify!($SelfT), " = 7; // or any other integer type let b = 4; -assert_eq!(a.mod_euc(b), 3); -assert_eq!((-a).mod_euc(b), 1); -assert_eq!(a.mod_euc(-b), 3); -assert_eq!((-a).mod_euc(-b), 1); +assert_eq!(a.rem_euclid(b), 3); +assert_eq!((-a).rem_euclid(b), 1); +assert_eq!(a.rem_euclid(-b), 3); +assert_eq!((-a).rem_euclid(-b), 1); ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] #[rustc_inherit_overflow_checks] - pub fn mod_euc(self, rhs: Self) -> Self { + pub fn rem_euclid(self, rhs: Self) -> Self { let r = self % rhs; if r < 0 { if rhs < 0 { @@ -1890,7 +1862,6 @@ assert!(!(-10", stringify!($SelfT), ").is_positive());", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_sign")] #[inline] pub const fn is_positive(self) -> bool { self > 0 } } @@ -1909,7 +1880,6 @@ assert!(!10", stringify!($SelfT), ".is_negative());", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_sign")] #[inline] pub const fn is_negative(self) -> bool { self < 0 } } @@ -1921,12 +1891,10 @@ big-endian (network) byte order. # Examples ``` -#![feature(int_to_from_bytes)] - let bytes = ", $swap_op, stringify!($SelfT), ".to_be_bytes(); assert_eq!(bytes, ", $be_bytes, "); ```"), - #[unstable(feature = "int_to_from_bytes", issue = "52963")] + #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn to_be_bytes(self) -> [u8; mem::size_of::()] { @@ -1941,12 +1909,10 @@ little-endian byte order. # Examples ``` -#![feature(int_to_from_bytes)] - let bytes = ", $swap_op, stringify!($SelfT), ".to_le_bytes(); assert_eq!(bytes, ", $le_bytes, "); ```"), - #[unstable(feature = "int_to_from_bytes", issue = "52963")] + #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn to_le_bytes(self) -> [u8; mem::size_of::()] { @@ -1969,8 +1935,6 @@ instead. # Examples ``` -#![feature(int_to_from_bytes)] - let bytes = ", $swap_op, stringify!($SelfT), ".to_ne_bytes(); assert_eq!(bytes, if cfg!(target_endian = \"big\") { ", $be_bytes, " @@ -1978,7 +1942,7 @@ assert_eq!(bytes, if cfg!(target_endian = \"big\") { ", $le_bytes, " }); ```"), - #[unstable(feature = "int_to_from_bytes", issue = "52963")] + #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn to_ne_bytes(self) -> [u8; mem::size_of::()] { @@ -1993,12 +1957,23 @@ big endian. # Examples ``` -#![feature(int_to_from_bytes)] - let value = ", stringify!($SelfT), "::from_be_bytes(", $be_bytes, "); assert_eq!(value, ", $swap_op, "); +``` + +When starting from a slice rather than an array, fallible conversion APIs can be used: + +``` +#![feature(try_from)] +use std::convert::TryInto; + +fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { + let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); + *input = rest; + ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) +} ```"), - #[unstable(feature = "int_to_from_bytes", issue = "52963")] + #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn from_be_bytes(bytes: [u8; mem::size_of::()]) -> Self { @@ -2014,12 +1989,23 @@ little endian. # Examples ``` -#![feature(int_to_from_bytes)] - let value = ", stringify!($SelfT), "::from_le_bytes(", $le_bytes, "); assert_eq!(value, ", $swap_op, "); +``` + +When starting from a slice rather than an array, fallible conversion APIs can be used: + +``` +#![feature(try_from)] +use std::convert::TryInto; + +fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { + let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); + *input = rest; + ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) +} ```"), - #[unstable(feature = "int_to_from_bytes", issue = "52963")] + #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn from_le_bytes(bytes: [u8; mem::size_of::()]) -> Self { @@ -2041,16 +2027,27 @@ appropriate instead. # Examples ``` -#![feature(int_to_from_bytes)] - let value = ", stringify!($SelfT), "::from_ne_bytes(if cfg!(target_endian = \"big\") { ", $be_bytes, " } else { ", $le_bytes, " }); assert_eq!(value, ", $swap_op, "); +``` + +When starting from a slice rather than an array, fallible conversion APIs can be used: + +``` +#![feature(try_from)] +use std::convert::TryInto; + +fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { + let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); + *input = rest; + ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) +} ```"), - #[unstable(feature = "int_to_from_bytes", issue = "52963")] + #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn from_ne_bytes(bytes: [u8; mem::size_of::()]) -> Self { @@ -2123,19 +2120,6 @@ impl isize { "[0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56]" } } -// Emits the correct `cttz` call, depending on the size of the type. -macro_rules! uint_cttz_call { - // As of LLVM 3.6 the codegen for the zero-safe cttz8 intrinsic - // emits two conditional moves on x86_64. By promoting the value to - // u16 and setting bit 8, we get better code without any conditional - // operations. - // FIXME: There's a LLVM patch (http://reviews.llvm.org/D9284) - // pending, remove this workaround once LLVM generates better code - // for cttz8. - ($value:expr, 8) => { intrinsics::cttz($value as u16 | 0x100) }; - ($value:expr, $_BITS:expr) => { intrinsics::cttz($value) } -} - // `Int` + `UnsignedInt` implemented for unsigned integers macro_rules! uint_impl { ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr, $Feature:expr, $EndFeature:expr, @@ -2217,10 +2201,9 @@ Basic usage: assert_eq!(n.count_ones(), 3);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn count_ones(self) -> u32 { - unsafe { intrinsics::ctpop(self as $ActualT) as u32 } + intrinsics::ctpop(self as $ActualT) as u32 } } @@ -2235,7 +2218,6 @@ Basic usage: ", $Feature, "assert_eq!(", stringify!($SelfT), "::max_value().count_zeros(), 0);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn count_zeros(self) -> u32 { (!self).count_ones() @@ -2255,10 +2237,9 @@ Basic usage: assert_eq!(n.leading_zeros(), 2);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn leading_zeros(self) -> u32 { - unsafe { intrinsics::ctlz(self as $ActualT) as u32 } + intrinsics::ctlz(self as $ActualT) as u32 } } @@ -2276,10 +2257,9 @@ Basic usage: assert_eq!(n.trailing_zeros(), 3);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn trailing_zeros(self) -> u32 { - unsafe { uint_cttz_call!(self, $BITS) as u32 } + intrinsics::cttz(self) as u32 } } @@ -2300,15 +2280,9 @@ let m = ", $rot_result, "; assert_eq!(n.rotate_left(", $rot, "), m); ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_rotate")] #[inline] pub const fn rotate_left(self, n: u32) -> Self { - #[cfg(not(stage0))] { - unsafe { intrinsics::rotate_left(self, n as $SelfT) } - } - #[cfg(stage0)] { - (self << (n % $BITS)) | (self >> (($BITS - (n % $BITS)) % $BITS)) - } + intrinsics::rotate_left(self, n as $SelfT) } } @@ -2330,15 +2304,9 @@ let m = ", $rot_op, "; assert_eq!(n.rotate_right(", $rot, "), m); ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_rotate")] #[inline] pub const fn rotate_right(self, n: u32) -> Self { - #[cfg(not(stage0))] { - unsafe { intrinsics::rotate_right(self, n as $SelfT) } - } - #[cfg(stage0)] { - (self >> (n % $BITS)) | (self << (($BITS - (n % $BITS)) % $BITS)) - } + intrinsics::rotate_right(self, n as $SelfT) } } @@ -2357,10 +2325,9 @@ let m = n.swap_bytes(); assert_eq!(m, ", $swapped, "); ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn swap_bytes(self) -> Self { - unsafe { intrinsics::bswap(self as $ActualT) as Self } + intrinsics::bswap(self as $ActualT) as Self } } @@ -2380,10 +2347,9 @@ let m = n.reverse_bits(); assert_eq!(m, ", $reversed, "); ```"), #[unstable(feature = "reverse_bits", issue = "48763")] - #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn reverse_bits(self) -> Self { - unsafe { intrinsics::bitreverse(self as $ActualT) as Self } + intrinsics::bitreverse(self as $ActualT) as Self } } @@ -2407,7 +2373,6 @@ if cfg!(target_endian = \"big\") { }", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn from_be(x: Self) -> Self { #[cfg(target_endian = "big")] @@ -2441,7 +2406,6 @@ if cfg!(target_endian = \"little\") { }", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn from_le(x: Self) -> Self { #[cfg(target_endian = "little")] @@ -2475,7 +2439,6 @@ if cfg!(target_endian = \"big\") { }", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn to_be(self) -> Self { // or not to be? #[cfg(target_endian = "big")] @@ -2509,7 +2472,6 @@ if cfg!(target_endian = \"little\") { }", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_ops")] #[inline] pub const fn to_le(self) -> Self { #[cfg(target_endian = "little")] @@ -2607,7 +2569,7 @@ assert_eq!(1", stringify!($SelfT), ".checked_div(0), None);", $EndFeature, " } doc_comment! { - concat!("Checked Euclidean division. Computes `self.div_euc(rhs)`, returning `None` + concat!("Checked Euclidean division. Computes `self.div_euclid(rhs)`, returning `None` if `rhs == 0`. # Examples @@ -2616,16 +2578,16 @@ Basic usage: ``` #![feature(euclidean_division)] -assert_eq!(128", stringify!($SelfT), ".checked_div(2), Some(64)); -assert_eq!(1", stringify!($SelfT), ".checked_div_euc(0), None); +assert_eq!(128", stringify!($SelfT), ".checked_div_euclid(2), Some(64)); +assert_eq!(1", stringify!($SelfT), ".checked_div_euclid(0), None); ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] - pub fn checked_div_euc(self, rhs: Self) -> Option { + pub fn checked_div_euclid(self, rhs: Self) -> Option { if rhs == 0 { None } else { - Some(self.div_euc(rhs)) + Some(self.div_euclid(rhs)) } } } @@ -2655,7 +2617,7 @@ assert_eq!(5", stringify!($SelfT), ".checked_rem(0), None);", $EndFeature, " } doc_comment! { - concat!("Checked Euclidean modulo. Computes `self.mod_euc(rhs)`, returning `None` + concat!("Checked Euclidean modulo. Computes `self.rem_euclid(rhs)`, returning `None` if `rhs == 0`. # Examples @@ -2664,16 +2626,16 @@ Basic usage: ``` #![feature(euclidean_division)] -assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(2), Some(1)); -assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(0), None); +assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(2), Some(1)); +assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(0), None); ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] - pub fn checked_mod_euc(self, rhs: Self) -> Option { + pub fn checked_rem_euclid(self, rhs: Self) -> Option { if rhs == 0 { None } else { - Some(self.mod_euc(rhs)) + Some(self.rem_euclid(rhs)) } } } @@ -2749,11 +2711,10 @@ overflow occurred. Basic usage: ``` -#![feature(no_panic_pow)] ", $Feature, "assert_eq!(2", stringify!($SelfT), ".checked_pow(5), Some(32)); assert_eq!(", stringify!($SelfT), "::max_value().checked_pow(2), None);", $EndFeature, " ```"), - #[unstable(feature = "no_panic_pow", issue = "48320")] + #[stable(feature = "no_panic_pow", since = "1.34.0")] #[inline] pub fn checked_pow(self, mut exp: u32) -> Option { let mut base = self; @@ -2793,10 +2754,15 @@ assert_eq!(200u8.saturating_add(127), 255);", $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn saturating_add(self, rhs: Self) -> Self { + #[cfg(stage0)] match self.checked_add(rhs) { Some(x) => x, None => Self::max_value(), } + #[cfg(not(stage0))] + { + intrinsics::saturating_add(self, rhs) + } } } @@ -2815,10 +2781,15 @@ assert_eq!(13", stringify!($SelfT), ".saturating_sub(127), 0);", $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn saturating_sub(self, rhs: Self) -> Self { + #[cfg(stage0)] match self.checked_sub(rhs) { Some(x) => x, None => Self::min_value(), } + #[cfg(not(stage0))] + { + intrinsics::saturating_sub(self, rhs) + } } } @@ -2853,14 +2824,13 @@ saturating at the numeric bounds instead of overflowing. Basic usage: ``` -#![feature(no_panic_pow)] ", $Feature, "use std::", stringify!($SelfT), "; assert_eq!(4", stringify!($SelfT), ".saturating_pow(3), 64); assert_eq!(", stringify!($SelfT), "::MAX.saturating_pow(2), ", stringify!($SelfT), "::MAX);", $EndFeature, " ```"), - #[unstable(feature = "no_panic_pow", issue = "48320")] + #[stable(feature = "no_panic_pow", since = "1.34.0")] #[inline] pub fn saturating_pow(self, exp: u32) -> Self { match self.checked_pow(exp) { @@ -2884,12 +2854,9 @@ assert_eq!(200", stringify!($SelfT), ".wrapping_add(", stringify!($SelfT), "::ma $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] pub const fn wrapping_add(self, rhs: Self) -> Self { - unsafe { - intrinsics::overflowing_add(self, rhs) - } + intrinsics::overflowing_add(self, rhs) } } @@ -2907,12 +2874,9 @@ assert_eq!(100", stringify!($SelfT), ".wrapping_sub(", stringify!($SelfT), "::ma $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] pub const fn wrapping_sub(self, rhs: Self) -> Self { - unsafe { - intrinsics::overflowing_sub(self, rhs) - } + intrinsics::overflowing_sub(self, rhs) } } @@ -2931,12 +2895,9 @@ $EndFeature, " /// assert_eq!(25u8.wrapping_mul(12), 44); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] pub const fn wrapping_mul(self, rhs: Self) -> Self { - unsafe { - intrinsics::overflowing_mul(self, rhs) - } + intrinsics::overflowing_mul(self, rhs) } doc_comment! { @@ -2961,11 +2922,14 @@ Basic usage: } doc_comment! { - concat!("Wrapping Euclidean division. Computes `self.div_euc(rhs)`. + concat!("Wrapping Euclidean division. Computes `self.div_euclid(rhs)`. Wrapped division on unsigned types is just normal division. There's no way wrapping could ever happen. This function exists, so that all operations are accounted for in the wrapping operations. +Since, for the positive integers, all common +definitions of division are equal, this +is exactly equal to `self.wrapping_div(rhs)`. # Examples @@ -2973,11 +2937,11 @@ Basic usage: ``` #![feature(euclidean_division)] -assert_eq!(100", stringify!($SelfT), ".wrapping_div_euc(10), 10); +assert_eq!(100", stringify!($SelfT), ".wrapping_div_euclid(10), 10); ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] - pub fn wrapping_div_euc(self, rhs: Self) -> Self { + pub fn wrapping_div_euclid(self, rhs: Self) -> Self { self / rhs } } @@ -3005,12 +2969,15 @@ Basic usage: } doc_comment! { - concat!("Wrapping Euclidean modulo. Computes `self.mod_euc(rhs)`. + concat!("Wrapping Euclidean modulo. Computes `self.rem_euclid(rhs)`. Wrapped modulo calculation on unsigned types is just the regular remainder calculation. There's no way wrapping could ever happen. This function exists, so that all operations are accounted for in the wrapping operations. +Since, for the positive integers, all common +definitions of division are equal, this +is exactly equal to `self.wrapping_rem(rhs)`. # Examples @@ -3018,11 +2985,11 @@ Basic usage: ``` #![feature(euclidean_division)] -assert_eq!(100", stringify!($SelfT), ".wrapping_mod_euc(10), 0); +assert_eq!(100", stringify!($SelfT), ".wrapping_rem_euclid(10), 0); ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] - pub fn wrapping_mod_euc(self, rhs: Self) -> Self { + pub fn wrapping_rem_euclid(self, rhs: Self) -> Self { self % rhs } } @@ -3075,7 +3042,6 @@ Basic usage: assert_eq!(1", stringify!($SelfT), ".wrapping_shl(128), 1);", $EndFeature, " ```"), #[stable(feature = "num_wrapping", since = "1.2.0")] - #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] pub const fn wrapping_shl(self, rhs: u32) -> Self { unsafe { @@ -3105,7 +3071,6 @@ Basic usage: assert_eq!(128", stringify!($SelfT), ".wrapping_shr(128), 128);", $EndFeature, " ```"), #[stable(feature = "num_wrapping", since = "1.2.0")] - #[rustc_const_unstable(feature = "const_int_wrapping")] #[inline] pub const fn wrapping_shr(self, rhs: u32) -> Self { unsafe { @@ -3123,11 +3088,10 @@ wrapping around at the boundary of the type. Basic usage: ``` -#![feature(no_panic_pow)] ", $Feature, "assert_eq!(3", stringify!($SelfT), ".wrapping_pow(5), 243); assert_eq!(3u8.wrapping_pow(6), 217);", $EndFeature, " ```"), - #[unstable(feature = "no_panic_pow", issue = "48320")] + #[stable(feature = "no_panic_pow", since = "1.34.0")] #[inline] pub fn wrapping_pow(self, mut exp: u32) -> Self { let mut base = self; @@ -3170,13 +3134,9 @@ assert_eq!(5", stringify!($SelfT), ".overflowing_add(2), (7, false)); assert_eq!(", stringify!($SelfT), "::MAX.overflowing_add(1), (0, true));", $EndFeature, " ```"), #[stable(feature = "wrapping", since = "1.7.0")] - #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] pub const fn overflowing_add(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { - intrinsics::add_with_overflow(self as $ActualT, - rhs as $ActualT) - }; + let (a, b) = intrinsics::add_with_overflow(self as $ActualT, rhs as $ActualT); (a as Self, b) } } @@ -3200,13 +3160,9 @@ assert_eq!(0", stringify!($SelfT), ".overflowing_sub(1), (", stringify!($SelfT), $EndFeature, " ```"), #[stable(feature = "wrapping", since = "1.7.0")] - #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] pub const fn overflowing_sub(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { - intrinsics::sub_with_overflow(self as $ActualT, - rhs as $ActualT) - }; + let (a, b) = intrinsics::sub_with_overflow(self as $ActualT, rhs as $ActualT); (a as Self, b) } } @@ -3229,13 +3185,9 @@ $EndFeature, " /// assert_eq!(1_000_000_000u32.overflowing_mul(10), (1410065408, true)); /// ``` #[stable(feature = "wrapping", since = "1.7.0")] - #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] pub const fn overflowing_mul(self, rhs: Self) -> (Self, bool) { - let (a, b) = unsafe { - intrinsics::mul_with_overflow(self as $ActualT, - rhs as $ActualT) - }; + let (a, b) = intrinsics::mul_with_overflow(self as $ActualT, rhs as $ActualT); (a as Self, b) } @@ -3266,12 +3218,15 @@ Basic usage } doc_comment! { - concat!("Calculates the quotient of Euclidean division `self.div_euc(rhs)`. + concat!("Calculates the quotient of Euclidean division `self.div_euclid(rhs)`. Returns a tuple of the divisor along with a boolean indicating whether an arithmetic overflow would occur. Note that for unsigned integers overflow never occurs, so the second value is always `false`. +Since, for the positive integers, all common +definitions of division are equal, this +is exactly equal to `self.overflowing_div(rhs)`. # Panics @@ -3283,11 +3238,11 @@ Basic usage ``` #![feature(euclidean_division)] -assert_eq!(5", stringify!($SelfT), ".overflowing_div_euc(2), (2, false)); +assert_eq!(5", stringify!($SelfT), ".overflowing_div_euclid(2), (2, false)); ```"), #[inline] #[unstable(feature = "euclidean_division", issue = "49048")] - pub fn overflowing_div_euc(self, rhs: Self) -> (Self, bool) { + pub fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) { (self / rhs, false) } } @@ -3319,12 +3274,15 @@ Basic usage } doc_comment! { - concat!("Calculates the remainder `self.mod_euc(rhs)` by Euclidean division. + concat!("Calculates the remainder `self.rem_euclid(rhs)` as if by Euclidean division. Returns a tuple of the modulo after dividing along with a boolean indicating whether an arithmetic overflow would occur. Note that for unsigned integers overflow never occurs, so the second value is always `false`. +Since, for the positive integers, all common +definitions of division are equal, this operation +is exactly equal to `self.overflowing_rem(rhs)`. # Panics @@ -3336,11 +3294,11 @@ Basic usage ``` #![feature(euclidean_division)] -assert_eq!(5", stringify!($SelfT), ".overflowing_mod_euc(2), (1, false)); +assert_eq!(5", stringify!($SelfT), ".overflowing_rem_euclid(2), (1, false)); ```"), #[inline] #[unstable(feature = "euclidean_division", issue = "49048")] - pub fn overflowing_mod_euc(self, rhs: Self) -> (Self, bool) { + pub fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) { (self % rhs, false) } } @@ -3387,7 +3345,6 @@ Basic usage assert_eq!(0x1", stringify!($SelfT), ".overflowing_shl(132), (0x10, true));", $EndFeature, " ```"), #[stable(feature = "wrapping", since = "1.7.0")] - #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] pub const fn overflowing_shl(self, rhs: u32) -> (Self, bool) { (self.wrapping_shl(rhs), (rhs > ($BITS - 1))) @@ -3412,7 +3369,6 @@ Basic usage assert_eq!(0x10", stringify!($SelfT), ".overflowing_shr(132), (0x1, true));", $EndFeature, " ```"), #[stable(feature = "wrapping", since = "1.7.0")] - #[rustc_const_unstable(feature = "const_int_overflowing")] #[inline] pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool) { (self.wrapping_shr(rhs), (rhs > ($BITS - 1))) @@ -3430,11 +3386,10 @@ whether an overflow happened. Basic usage: ``` -#![feature(no_panic_pow)] ", $Feature, "assert_eq!(3", stringify!($SelfT), ".overflowing_pow(5), (243, false)); assert_eq!(3u8.overflowing_pow(6), (217, true));", $EndFeature, " ```"), - #[unstable(feature = "no_panic_pow", issue = "48320")] + #[stable(feature = "no_panic_pow", since = "1.34.0")] #[inline] pub fn overflowing_pow(self, mut exp: u32) -> (Self, bool) { let mut base = self; @@ -3507,7 +3462,9 @@ Basic usage: doc_comment! { concat!("Performs Euclidean division. -For unsigned types, this is just the same as `self / rhs`. +Since, for the positive integers, all common +definitions of division are equal, this +is exactly equal to `self / rhs`. # Examples @@ -3515,21 +3472,23 @@ Basic usage: ``` #![feature(euclidean_division)] -assert_eq!(7", stringify!($SelfT), ".div_euc(4), 1); // or any other integer type +assert_eq!(7", stringify!($SelfT), ".div_euclid(4), 1); // or any other integer type ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] #[rustc_inherit_overflow_checks] - pub fn div_euc(self, rhs: Self) -> Self { + pub fn div_euclid(self, rhs: Self) -> Self { self / rhs } } doc_comment! { - concat!("Calculates the remainder `self mod rhs` by Euclidean division. + concat!("Calculates the least remainder of `self (mod rhs)`. -For unsigned types, this is just the same as `self % rhs`. +Since, for the positive integers, all common +definitions of division are equal, this +is exactly equal to `self % rhs`. # Examples @@ -3537,12 +3496,12 @@ Basic usage: ``` #![feature(euclidean_division)] -assert_eq!(7", stringify!($SelfT), ".mod_euc(4), 3); // or any other integer type +assert_eq!(7", stringify!($SelfT), ".rem_euclid(4), 3); // or any other integer type ```"), #[unstable(feature = "euclidean_division", issue = "49048")] #[inline] #[rustc_inherit_overflow_checks] - pub fn mod_euc(self, rhs: Self) -> Self { + pub fn rem_euclid(self, rhs: Self) -> Self { self % rhs } } @@ -3590,7 +3549,7 @@ assert!(!10", stringify!($SelfT), ".is_power_of_two());", $EndFeature, " doc_comment! { concat!("Returns the smallest power of two greater than or equal to `self`. -When return value overflows (i.e. `self > (1 << (N-1))` for type +When return value overflows (i.e., `self > (1 << (N-1))` for type `uN`), it panics in debug mode and return value is wrapped to 0 in release mode (the only situation in which method can return 0). @@ -3626,6 +3585,7 @@ assert_eq!(3", stringify!($SelfT), ".checked_next_power_of_two(), Some(4)); assert_eq!(", stringify!($SelfT), "::max_value().checked_next_power_of_two(), None);", $EndFeature, " ```"), + #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn checked_next_power_of_two(self) -> Option { self.one_less_than_next_power_of_two().checked_add(1) @@ -3663,12 +3623,10 @@ big-endian (network) byte order. # Examples ``` -#![feature(int_to_from_bytes)] - let bytes = ", $swap_op, stringify!($SelfT), ".to_be_bytes(); assert_eq!(bytes, ", $be_bytes, "); ```"), - #[unstable(feature = "int_to_from_bytes", issue = "52963")] + #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn to_be_bytes(self) -> [u8; mem::size_of::()] { @@ -3683,12 +3641,10 @@ little-endian byte order. # Examples ``` -#![feature(int_to_from_bytes)] - let bytes = ", $swap_op, stringify!($SelfT), ".to_le_bytes(); assert_eq!(bytes, ", $le_bytes, "); ```"), - #[unstable(feature = "int_to_from_bytes", issue = "52963")] + #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn to_le_bytes(self) -> [u8; mem::size_of::()] { @@ -3711,8 +3667,6 @@ instead. # Examples ``` -#![feature(int_to_from_bytes)] - let bytes = ", $swap_op, stringify!($SelfT), ".to_ne_bytes(); assert_eq!(bytes, if cfg!(target_endian = \"big\") { ", $be_bytes, " @@ -3720,7 +3674,7 @@ assert_eq!(bytes, if cfg!(target_endian = \"big\") { ", $le_bytes, " }); ```"), - #[unstable(feature = "int_to_from_bytes", issue = "52963")] + #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn to_ne_bytes(self) -> [u8; mem::size_of::()] { @@ -3735,12 +3689,23 @@ big endian. # Examples ``` -#![feature(int_to_from_bytes)] - let value = ", stringify!($SelfT), "::from_be_bytes(", $be_bytes, "); assert_eq!(value, ", $swap_op, "); +``` + +When starting from a slice rather than an array, fallible conversion APIs can be used: + +``` +#![feature(try_from)] +use std::convert::TryInto; + +fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { + let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); + *input = rest; + ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) +} ```"), - #[unstable(feature = "int_to_from_bytes", issue = "52963")] + #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn from_be_bytes(bytes: [u8; mem::size_of::()]) -> Self { @@ -3756,12 +3721,23 @@ little endian. # Examples ``` -#![feature(int_to_from_bytes)] - let value = ", stringify!($SelfT), "::from_le_bytes(", $le_bytes, "); assert_eq!(value, ", $swap_op, "); +``` + +When starting from a slice rather than an array, fallible conversion APIs can be used: + +``` +#![feature(try_from)] +use std::convert::TryInto; + +fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { + let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); + *input = rest; + ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) +} ```"), - #[unstable(feature = "int_to_from_bytes", issue = "52963")] + #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn from_le_bytes(bytes: [u8; mem::size_of::()]) -> Self { @@ -3783,16 +3759,27 @@ appropriate instead. # Examples ``` -#![feature(int_to_from_bytes)] - let value = ", stringify!($SelfT), "::from_ne_bytes(if cfg!(target_endian = \"big\") { ", $be_bytes, " } else { ", $le_bytes, " }); assert_eq!(value, ", $swap_op, "); +``` + +When starting from a slice rather than an array, fallible conversion APIs can be used: + +``` +#![feature(try_from)] +use std::convert::TryInto; + +fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { + let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); + *input = rest; + ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) +} ```"), - #[unstable(feature = "int_to_from_bytes", issue = "52963")] + #[stable(feature = "int_to_from_bytes", since = "1.32.0")] #[rustc_const_unstable(feature = "const_int_conversion")] #[inline] pub const fn from_ne_bytes(bytes: [u8; mem::size_of::()]) -> Self { @@ -4772,7 +4759,7 @@ fn from_str_radix(src: &str, radix: u32) -> Result &IntErrorKind { + &self.kind + } #[unstable(feature = "int_error_internals", reason = "available through Error trait and this method should \ not be exposed publicly", diff --git a/src/libcore/num/u128.rs b/src/libcore/num/u128.rs index e8c783a1bb5..7d1aa664de3 100644 --- a/src/libcore/num/u128.rs +++ b/src/libcore/num/u128.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The 128-bit unsigned integer type. //! //! *[See also the `u128` primitive type](../../std/primitive.u128.html).* diff --git a/src/libcore/num/u16.rs b/src/libcore/num/u16.rs index 9c318216f1f..34f80abaecc 100644 --- a/src/libcore/num/u16.rs +++ b/src/libcore/num/u16.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The 16-bit unsigned integer type. //! //! *[See also the `u16` primitive type](../../std/primitive.u16.html).* diff --git a/src/libcore/num/u32.rs b/src/libcore/num/u32.rs index 84367c20738..5fd486f5466 100644 --- a/src/libcore/num/u32.rs +++ b/src/libcore/num/u32.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The 32-bit unsigned integer type. //! //! *[See also the `u32` primitive type](../../std/primitive.u32.html).* diff --git a/src/libcore/num/u64.rs b/src/libcore/num/u64.rs index cc48a28b22f..044d238aea9 100644 --- a/src/libcore/num/u64.rs +++ b/src/libcore/num/u64.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The 64-bit unsigned integer type. //! //! *[See also the `u64` primitive type](../../std/primitive.u64.html).* diff --git a/src/libcore/num/u8.rs b/src/libcore/num/u8.rs index 6c0daa7763a..6747e6a0f6c 100644 --- a/src/libcore/num/u8.rs +++ b/src/libcore/num/u8.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The 8-bit unsigned integer type. //! //! *[See also the `u8` primitive type](../../std/primitive.u8.html).* diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs index f7e1f78d69e..a94b541ddb9 100644 --- a/src/libcore/num/uint_macros.rs +++ b/src/libcore/num/uint_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![doc(hidden)] macro_rules! uint_module { diff --git a/src/libcore/num/usize.rs b/src/libcore/num/usize.rs index 0b6f1c73c58..e3a5239d908 100644 --- a/src/libcore/num/usize.rs +++ b/src/libcore/num/usize.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The pointer-sized unsigned integer type. //! //! *[See also the `usize` primitive type](../../std/primitive.usize.html).* diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 00134a58d30..50e189c9e36 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::Wrapping; use ops::*; @@ -865,7 +855,7 @@ assert!(!Wrapping(10", stringify!($t), ").is_power_of_two()); doc_comment! { concat!("Returns the smallest power of two greater than or equal to `self`. -When return value overflows (i.e. `self > (1 << (N-1))` for type +When return value overflows (i.e., `self > (1 << (N-1))` for type `uN`), overflows to `2^N = 0`. # Examples diff --git a/src/libcore/ops/arith.rs b/src/libcore/ops/arith.rs index a1bc5463f73..7d8bf18d33a 100644 --- a/src/libcore/ops/arith.rs +++ b/src/libcore/ops/arith.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// The addition operator `+`. /// /// Note that `RHS` is `Self` by default, but this is not mandatory. For diff --git a/src/libcore/ops/bit.rs b/src/libcore/ops/bit.rs index 3900f365b0a..2c9bf248633 100644 --- a/src/libcore/ops/bit.rs +++ b/src/libcore/ops/bit.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// The unary logical negation operator `!`. /// /// # Examples diff --git a/src/libcore/ops/deref.rs b/src/libcore/ops/deref.rs index 91a3d77e8b2..eb76c2de11b 100644 --- a/src/libcore/ops/deref.rs +++ b/src/libcore/ops/deref.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Used for immutable dereferencing operations, like `*v`. /// /// In addition to being used for explicit dereferencing operations with the @@ -37,7 +27,7 @@ /// [book] as well as the reference sections on [the dereference operator] /// [ref-deref-op], [method resolution] and [type coercions]. /// -/// [book]: ../../book/second-edition/ch15-02-deref.html +/// [book]: ../../book/ch15-02-deref.html /// [`DerefMut`]: trait.DerefMut.html /// [more]: #more-on-deref-coercion /// [ref-deref-op]: ../../reference/expressions/operator-expr.html#the-dereference-operator @@ -119,7 +109,7 @@ impl Deref for &mut T { /// then: /// /// * In mutable contexts, `*x` on non-pointer types is equivalent to -/// `*Deref::deref(&x)`. +/// `*DerefMut::deref_mut(&mut x)`. /// * Values of type `&mut T` are coerced to values of type `&mut U` /// * `T` implicitly implements all the (mutable) methods of the type `U`. /// @@ -127,7 +117,7 @@ impl Deref for &mut T { /// [book] as well as the reference sections on [the dereference operator] /// [ref-deref-op], [method resolution] and [type coercions]. /// -/// [book]: ../../book/second-edition/ch15-02-deref.html +/// [book]: ../../book/ch15-02-deref.html /// [`Deref`]: trait.Deref.html /// [more]: #more-on-deref-coercion /// [ref-deref-op]: ../../reference/expressions/operator-expr.html#the-dereference-operator @@ -177,3 +167,19 @@ pub trait DerefMut: Deref { impl DerefMut for &mut T { fn deref_mut(&mut self) -> &mut T { *self } } + +/// Indicates that a struct can be used as a method receiver, without the +/// `arbitrary_self_types` feature. This is implemented by stdlib pointer types like `Box`, +/// `Rc`, `&T`, and `Pin

`. +#[lang = "receiver"] +#[unstable(feature = "receiver_trait", issue = "0")] +#[doc(hidden)] +pub trait Receiver { + // Empty. +} + +#[unstable(feature = "receiver_trait", issue = "0")] +impl Receiver for &T {} + +#[unstable(feature = "receiver_trait", issue = "0")] +impl Receiver for &mut T {} diff --git a/src/libcore/ops/drop.rs b/src/libcore/ops/drop.rs index 474f7e34c34..eae63ea2390 100644 --- a/src/libcore/ops/drop.rs +++ b/src/libcore/ops/drop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Used to run some code when a value goes out of scope. /// This is sometimes called a 'destructor'. /// @@ -21,7 +11,7 @@ /// Refer to [the chapter on `Drop` in *The Rust Programming Language*][book] /// for some more elaboration. /// -/// [book]: ../../book/second-edition/ch15-03-drop.html +/// [book]: ../../book/ch15-03-drop.html /// /// # Examples /// diff --git a/src/libcore/ops/function.rs b/src/libcore/ops/function.rs index c9591c3f57b..3a1d765f7b8 100644 --- a/src/libcore/ops/function.rs +++ b/src/libcore/ops/function.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// The version of the call operator that takes an immutable receiver. /// /// Instances of `Fn` can be called repeatedly without mutating state. @@ -26,7 +16,7 @@ /// is expected. /// /// Use `Fn` as a bound when you want to accept a parameter of function-like -/// type and need to call it repeatedly and without mutating state (e.g. when +/// type and need to call it repeatedly and without mutating state (e.g., when /// calling it concurrently). If you do not need such strict requirements, use /// [`FnMut`] or [`FnOnce`] as bounds. /// @@ -37,7 +27,7 @@ /// `Fn(usize, bool) -> usize`). Those interested in the technical details of /// this can refer to [the relevant section in the *Rustonomicon*][nomicon]. /// -/// [book]: ../../book/second-edition/ch13-01-closures.html +/// [book]: ../../book/ch13-01-closures.html /// [`FnMut`]: trait.FnMut.html /// [`FnOnce`]: trait.FnOnce.html /// [function pointers]: ../../std/primitive.fn.html @@ -72,6 +62,7 @@ label="expected an `Fn<{Args}>` closure, found `{Self}`", )] #[fundamental] // so that regex can rely that `&str: !FnMut` +#[must_use] pub trait Fn : FnMut { /// Performs the call operation. #[unstable(feature = "fn_traits", issue = "29625")] @@ -84,7 +75,7 @@ pub trait Fn : FnMut { /// /// `FnMut` is implemented automatically by closures which take mutable /// references to captured variables, as well as all types that implement -/// [`Fn`], e.g. (safe) [function pointers][] (since `FnMut` is a supertrait of +/// [`Fn`], e.g., (safe) [function pointers][] (since `FnMut` is a supertrait of /// [`Fn`]). Additionally, for any type `F` that implements `FnMut`, `&mut F` /// implements `FnMut`, too. /// @@ -104,7 +95,7 @@ pub trait Fn : FnMut { /// `Fn(usize, bool) -> usize`). Those interested in the technical details of /// this can refer to [the relevant section in the *Rustonomicon*][nomicon]. /// -/// [book]: ../../book/second-edition/ch13-01-closures.html +/// [book]: ../../book/ch13-01-closures.html /// [`Fn`]: trait.Fn.html /// [`FnOnce`]: trait.FnOnce.html /// [function pointers]: ../../std/primitive.fn.html @@ -150,6 +141,7 @@ pub trait Fn : FnMut { label="expected an `FnMut<{Args}>` closure, found `{Self}`", )] #[fundamental] // so that regex can rely that `&str: !FnMut` +#[must_use] pub trait FnMut : FnOnce { /// Performs the call operation. #[unstable(feature = "fn_traits", issue = "29625")] @@ -163,7 +155,7 @@ pub trait FnMut : FnOnce { /// implements `FnOnce`, it can only be called once. /// /// `FnOnce` is implemented automatically by closure that might consume captured -/// variables, as well as all types that implement [`FnMut`], e.g. (safe) +/// variables, as well as all types that implement [`FnMut`], e.g., (safe) /// [function pointers][] (since `FnOnce` is a supertrait of [`FnMut`]). /// /// Since both [`Fn`] and [`FnMut`] are subtraits of `FnOnce`, any instance of @@ -181,7 +173,7 @@ pub trait FnMut : FnOnce { /// `Fn(usize, bool) -> usize`). Those interested in the technical details of /// this can refer to [the relevant section in the *Rustonomicon*][nomicon]. /// -/// [book]: ../../book/second-edition/ch13-01-closures.html +/// [book]: ../../book/ch13-01-closures.html /// [`Fn`]: trait.Fn.html /// [`FnMut`]: trait.FnMut.html /// [function pointers]: ../../std/primitive.fn.html @@ -228,6 +220,7 @@ pub trait FnMut : FnOnce { label="expected an `FnOnce<{Args}>` closure, found `{Self}`", )] #[fundamental] // so that regex can rely that `&str: !FnMut` +#[must_use] pub trait FnOnce { /// The returned type after the call operator is used. #[stable(feature = "fn_once_output", since = "1.12.0")] diff --git a/src/libcore/ops/generator.rs b/src/libcore/ops/generator.rs index 297089926b5..5401fff860e 100644 --- a/src/libcore/ops/generator.rs +++ b/src/libcore/ops/generator.rs @@ -1,12 +1,5 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +use crate::marker::Unpin; +use crate::pin::Pin; /// The result of a generator resumption. /// @@ -49,6 +42,7 @@ pub enum GeneratorState { /// #![feature(generators, generator_trait)] /// /// use std::ops::{Generator, GeneratorState}; +/// use std::pin::Pin; /// /// fn main() { /// let mut generator = || { @@ -56,11 +50,11 @@ pub enum GeneratorState { /// return "foo" /// }; /// -/// match unsafe { generator.resume() } { +/// match Pin::new(&mut generator).resume() { /// GeneratorState::Yielded(1) => {} /// _ => panic!("unexpected return from resume"), /// } -/// match unsafe { generator.resume() } { +/// match Pin::new(&mut generator).resume() { /// GeneratorState::Complete("foo") => {} /// _ => panic!("unexpected return from resume"), /// } @@ -98,10 +92,6 @@ pub trait Generator { /// generator will continue executing until it either yields or returns, at /// which point this function will return. /// - /// The function is unsafe because it can be used on an immovable generator. - /// After such a call, the immovable generator must not move again, but - /// this is not enforced by the compiler. - /// /// # Return value /// /// The `GeneratorState` enum returned from this function indicates what @@ -120,16 +110,25 @@ pub trait Generator { /// been returned previously. While generator literals in the language are /// guaranteed to panic on resuming after `Complete`, this is not guaranteed /// for all implementations of the `Generator` trait. - unsafe fn resume(&mut self) -> GeneratorState; + fn resume(self: Pin<&mut Self>) -> GeneratorState; } #[unstable(feature = "generator_trait", issue = "43122")] -impl Generator for &mut T - where T: Generator + ?Sized -{ - type Yield = T::Yield; - type Return = T::Return; - unsafe fn resume(&mut self) -> GeneratorState { - (**self).resume() +impl Generator for Pin<&mut G> { + type Yield = G::Yield; + type Return = G::Return; + + fn resume(mut self: Pin<&mut Self>) -> GeneratorState { + G::resume((*self).as_mut()) + } +} + +#[unstable(feature = "generator_trait", issue = "43122")] +impl Generator for &mut G { + type Yield = G::Yield; + type Return = G::Return; + + fn resume(mut self: Pin<&mut Self>) -> GeneratorState { + G::resume(Pin::new(&mut *self)) } } diff --git a/src/libcore/ops/index.rs b/src/libcore/ops/index.rs index 1ac80ecc96f..d4ed8614276 100644 --- a/src/libcore/ops/index.rs +++ b/src/libcore/ops/index.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Used for indexing operations (`container[index]`) in immutable contexts. /// /// `container[index]` is actually syntactic sugar for `*container.index(index)`, @@ -151,6 +141,21 @@ pub trait Index { /// ``` #[lang = "index_mut"] #[rustc_on_unimplemented( + on( + _Self="&str", + note="you can use `.chars().nth()` or `.bytes().nth()` +see chapter in The Book " + ), + on( + _Self="str", + note="you can use `.chars().nth()` or `.bytes().nth()` +see chapter in The Book " + ), + on( + _Self="std::string::String", + note="you can use `.chars().nth()` or `.bytes().nth()` +see chapter in The Book " + ), message="the type `{Self}` cannot be mutably indexed by `{Idx}`", label="`{Self}` cannot be mutably indexed by `{Idx}`", )] diff --git a/src/libcore/ops/mod.rs b/src/libcore/ops/mod.rs index edfa6df11ac..0ca64f28ff3 100644 --- a/src/libcore/ops/mod.rs +++ b/src/libcore/ops/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Overloadable operators. //! //! Implementing these traits allows you to overload certain operators. @@ -27,7 +17,7 @@ //! should have some resemblance to multiplication (and share expected //! properties like associativity). //! -//! Note that the `&&` and `||` operators short-circuit, i.e. they only +//! Note that the `&&` and `||` operators short-circuit, i.e., they only //! evaluate their second operand if it contributes to the result. Since this //! behavior is not enforceable by traits, `&&` and `||` are not supported as //! overloadable operators. @@ -178,6 +168,9 @@ pub use self::bit::{BitAndAssign, BitOrAssign, BitXorAssign, ShlAssign, ShrAssig #[stable(feature = "rust1", since = "1.0.0")] pub use self::deref::{Deref, DerefMut}; +#[unstable(feature = "receiver_trait", issue = "0")] +pub use self::deref::Receiver; + #[stable(feature = "rust1", since = "1.0.0")] pub use self::drop::Drop; diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 908490e1c83..815a4cfeed8 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use fmt; use hash::{Hash, Hasher}; diff --git a/src/libcore/ops/try.rs b/src/libcore/ops/try.rs index 4f2d30aa6a8..380bd12131c 100644 --- a/src/libcore/ops/try.rs +++ b/src/libcore/ops/try.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// A trait for customizing the behavior of the `?` operator. /// /// A type implementing `Try` is one that has a canonical way to view it diff --git a/src/libcore/ops/unsize.rs b/src/libcore/ops/unsize.rs index 4d9a40a1b90..bd95ddf060e 100644 --- a/src/libcore/ops/unsize.rs +++ b/src/libcore/ops/unsize.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use marker::Unsize; /// Trait that indicates that this is a pointer or a wrapper for one, @@ -93,7 +83,7 @@ impl, U: ?Sized> CoerceUnsized<*const U> for *const T {} /// {} /// ``` #[unstable(feature = "dispatch_from_dyn", issue = "0")] -#[cfg_attr(not(stage0), lang = "dispatch_from_dyn")] +#[lang = "dispatch_from_dyn"] pub trait DispatchFromDyn { // Empty. } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index cf1c77041b9..0e54397db02 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Optional values. //! //! Type [`Option`] represents an optional value: every [`Option`] @@ -62,7 +52,7 @@ //! The following example uses [`Option`] to create an optional box of //! [`i32`]. Notice that in order to use the inner [`i32`] value first, the //! `check_optional` function needs to use pattern matching to -//! determine whether the box has a value (i.e. it is [`Some(...)`][`Some`]) or +//! determine whether the box has a value (i.e., it is [`Some(...)`][`Some`]) or //! not ([`None`]). //! //! ``` @@ -273,7 +263,7 @@ impl Option { /// Converts from `Pin<&Option>` to `Option>` #[inline] - #[unstable(feature = "pin", issue = "49150")] + #[stable(feature = "pin", since = "1.33.0")] pub fn as_pin_ref<'a>(self: Pin<&'a Option>) -> Option> { unsafe { Pin::get_ref(self).as_ref().map(|x| Pin::new_unchecked(x)) @@ -282,10 +272,10 @@ impl Option { /// Converts from `Pin<&mut Option>` to `Option>` #[inline] - #[unstable(feature = "pin", issue = "49150")] + #[stable(feature = "pin", since = "1.33.0")] pub fn as_pin_mut<'a>(self: Pin<&'a mut Option>) -> Option> { unsafe { - Pin::get_mut_unchecked(self).as_mut().map(|x| Pin::new_unchecked(x)) + Pin::get_unchecked_mut(self).as_mut().map(|x| Pin::new_unchecked(x)) } } @@ -884,6 +874,48 @@ impl Option { } } +impl<'a, T: Copy> Option<&'a T> { + /// Maps an `Option<&T>` to an `Option` by copying the contents of the + /// option. + /// + /// # Examples + /// + /// ``` + /// #![feature(copied)] + /// + /// let x = 12; + /// let opt_x = Some(&x); + /// assert_eq!(opt_x, Some(&12)); + /// let copied = opt_x.copied(); + /// assert_eq!(copied, Some(12)); + /// ``` + #[unstable(feature = "copied", issue = "57126")] + pub fn copied(self) -> Option { + self.map(|&t| t) + } +} + +impl<'a, T: Copy> Option<&'a mut T> { + /// Maps an `Option<&mut T>` to an `Option` by copying the contents of the + /// option. + /// + /// # Examples + /// + /// ``` + /// #![feature(copied)] + /// + /// let mut x = 12; + /// let opt_x = Some(&mut x); + /// assert_eq!(opt_x, Some(&mut 12)); + /// let copied = opt_x.copied(); + /// assert_eq!(copied, Some(12)); + /// ``` + #[unstable(feature = "copied", issue = "57126")] + pub fn copied(self) -> Option { + self.map(|&mut t| t) + } +} + impl<'a, T: Clone> Option<&'a T> { /// Maps an `Option<&T>` to an `Option` by cloning the contents of the /// option. @@ -981,8 +1013,6 @@ impl Option> { /// # Examples /// /// ``` - /// #![feature(transpose_result)] - /// /// #[derive(Debug, Eq, PartialEq)] /// struct SomeErr; /// @@ -991,7 +1021,7 @@ impl Option> { /// assert_eq!(x, y.transpose()); /// ``` #[inline] - #[unstable(feature = "transpose_result", issue = "47338")] + #[stable(feature = "transpose_result", since = "1.33.0")] pub fn transpose(self) -> Result, E> { match self { Some(Ok(x)) => Ok(Some(x)), @@ -1253,20 +1283,42 @@ impl> FromIterator> for Option { /// returned. Should no [`None`][Option::None] occur, a container with the /// values of each [`Option`] is returned. /// - /// Here is an example which increments every integer in a vector, - /// checking for overflow: + /// # Examples + /// + /// Here is an example which increments every integer in a vector. + /// `We use the checked variant of `add` that returns `None` when the + /// calculation would result in an overflow. + /// + /// ``` + /// let items = vec![0_u16, 1, 2]; + /// + /// let res: Option> = items + /// .iter() + /// .map(|x| x.checked_add(1)) + /// .collect(); + /// + /// assert_eq!(res, Some(vec![1, 2, 3])); + /// ``` + /// + /// As you can see, this will return the expected, valid items. + /// + /// Here is another example that tries to subtract one from another list + /// of integers, this time checking for underflow: /// /// ``` - /// use std::u16; + /// let items = vec![2_u16, 1, 0]; /// - /// let v = vec![1, 2]; - /// let res: Option> = v.iter().map(|&x: &u16| - /// if x == u16::MAX { None } - /// else { Some(x + 1) } - /// ).collect(); - /// assert!(res == Some(vec![2, 3])); + /// let res: Option> = items + /// .iter() + /// .map(|x| x.checked_sub(1)) + /// .collect(); + /// + /// assert_eq!(res, None); /// ``` /// + /// Since the last element is zero, it would underflow. Thus, the resulting + /// value is `None`. + /// /// [`Iterator`]: ../iter/trait.Iterator.html #[inline] fn from_iter>>(iter: I) -> Option { diff --git a/src/libcore/panic.rs b/src/libcore/panic.rs index f0efeb59e8d..1abc0a18a9c 100644 --- a/src/libcore/panic.rs +++ b/src/libcore/panic.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Panic support in the standard library. #![unstable(feature = "core_panic_info", diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs index 58407de9566..d9cdb2a2b8a 100644 --- a/src/libcore/panicking.rs +++ b/src/libcore/panicking.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Panic support for libcore //! //! The core library cannot define panicking, but it does *declare* panicking. This @@ -39,9 +29,16 @@ use fmt; use panic::{Location, PanicInfo}; -#[cold] #[inline(never)] // this is the slow path, always +#[cold] +// never inline unless panic_immediate_abort to avoid code +// bloat at the call sites as much as possible +#[cfg_attr(not(feature="panic_immediate_abort"),inline(never))] #[lang = "panic"] pub fn panic(expr_file_line_col: &(&'static str, &'static str, u32, u32)) -> ! { + if cfg!(feature = "panic_immediate_abort") { + unsafe { super::intrinsics::abort() } + } + // Use Arguments::new_v1 instead of format_args!("{}", expr) to potentially // reduce size overhead. The format_args! macro uses str's Display trait to // write expr, which calls Formatter::pad, which must accommodate string @@ -52,16 +49,27 @@ pub fn panic(expr_file_line_col: &(&'static str, &'static str, u32, u32)) -> ! { panic_fmt(fmt::Arguments::new_v1(&[expr], &[]), &(file, line, col)) } -#[cold] #[inline(never)] +#[cold] +#[cfg_attr(not(feature="panic_immediate_abort"),inline(never))] #[lang = "panic_bounds_check"] fn panic_bounds_check(file_line_col: &(&'static str, u32, u32), index: usize, len: usize) -> ! { + if cfg!(feature = "panic_immediate_abort") { + unsafe { super::intrinsics::abort() } + } + panic_fmt(format_args!("index out of bounds: the len is {} but the index is {}", len, index), file_line_col) } -#[cold] #[inline(never)] +#[cold] +#[cfg_attr(not(feature="panic_immediate_abort"),inline(never))] +#[cfg_attr( feature="panic_immediate_abort" ,inline)] pub fn panic_fmt(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32)) -> ! { + if cfg!(feature = "panic_immediate_abort") { + unsafe { super::intrinsics::abort() } + } + // NOTE This function never crosses the FFI boundary; it's a Rust-to-Rust call #[allow(improper_ctypes)] // PanicInfo contains a trait object which is not FFI safe extern "Rust" { diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index 308dd9c79fa..56a32c928fb 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -7,36 +7,44 @@ //! since moving an object with pointers to itself will invalidate them, //! which could cause undefined behavior. //! -//! In order to prevent objects from moving, they must be pinned -//! by wrapping a pointer to the data in the [`Pin`] type. A pointer wrapped -//! in a `Pin` is otherwise equivalent to its normal version, e.g. `Pin>` -//! and `Box` work the same way except that the first is pinning the value -//! of `T` in place. +//! By default, all types in Rust are movable. Rust allows passing all types by-value, +//! and common smart-pointer types such as `Box`, `Rc`, and `&mut` allow replacing and +//! moving the values they contain. In order to prevent objects from moving, they must +//! be pinned by wrapping a pointer to the data in the [`Pin`] type. +//! Doing this prohibits moving the value behind the pointer. +//! For example, `Pin>` functions much like a regular `Box`, +//! but doesn't allow moving `T`. The pointer value itself (the `Box`) can still be moved, +//! but the value behind it cannot. //! -//! First of all, these are pointer types because pinned data mustn't be passed around by value -//! (that would change its location in memory). -//! Secondly, since data can be moved out of `&mut` and `Box` with functions such as [`swap`], -//! which causes their contents to swap places in memory, -//! we need dedicated types that prohibit such operations. +//! Since data can be moved out of `&mut` and `Box` with functions such as [`swap`], +//! changing the location of the underlying data, [`Pin`] prohibits accessing the +//! underlying pointer type (the `&mut` or `Box`) directly, and provides its own set of +//! APIs for accessing and using the value. [`Pin`] also guarantees that no other +//! functions will move the pointed-to value. This allows for the creation of +//! self-references and other special behaviors that are only possible for unmovable +//! values. //! -//! However, these restrictions are usually not necessary, -//! so most types implement the [`Unpin`] auto-trait, -//! which indicates that the type can be moved out safely. -//! Doing so removes the limitations of pinning types, -//! making them the same as their non-pinning counterparts. +//! However, these restrictions are usually not necessary. Many types are always freely +//! movable. These types implement the [`Unpin`] auto-trait, which nullifies the effect +//! of [`Pin`]. For `T: Unpin`, `Pin>` and `Box` function identically, as do +//! `Pin<&mut T>` and `&mut T`. +//! +//! Note that pinning and `Unpin` only affect the pointed-to type. For example, whether +//! or not `Box` is `Unpin` has no affect on the behavior of `Pin>`. Similarly, +//! `Pin>` and `Pin<&mut T>` are always `Unpin` themselves, even though the +//! `T` underneath them isn't, because the pointers in `Pin>` and `Pin<&mut _>` +//! are always freely movable, even if the data they point to isn't. //! //! [`Pin`]: struct.Pin.html -//! [`Unpin`]: trait.Unpin.html +//! [`Unpin`]: ../../std/marker/trait.Unpin.html //! [`swap`]: ../../std/mem/fn.swap.html //! [`Box`]: ../../std/boxed/struct.Box.html //! //! # Examples //! //! ```rust -//! #![feature(pin)] -//! //! use std::pin::Pin; -//! use std::marker::Pinned; +//! use std::marker::PhantomPinned; //! use std::ptr::NonNull; //! //! // This is a self-referential struct since the slice field points to the data field. @@ -47,7 +55,7 @@ //! struct Unmovable { //! data: String, //! slice: NonNull, -//! _pin: Pinned, +//! _pin: PhantomPinned, //! } //! //! impl Unmovable { @@ -60,15 +68,15 @@ //! // we only create the pointer once the data is in place //! // otherwise it will have already moved before we even started //! slice: NonNull::dangling(), -//! _pin: Pinned, +//! _pin: PhantomPinned, //! }; -//! let mut boxed = Box::pinned(res); +//! let mut boxed = Box::pin(res); //! //! let slice = NonNull::from(&boxed.data); //! // we know this is safe because modifying a field doesn't move the whole struct //! unsafe { //! let mut_ref: Pin<&mut Self> = Pin::as_mut(&mut boxed); -//! Pin::get_mut_unchecked(mut_ref).slice = slice; +//! Pin::get_unchecked_mut(mut_ref).slice = slice; //! } //! boxed //! } @@ -87,14 +95,12 @@ //! // std::mem::swap(&mut *still_unmoved, &mut *new_unmoved); //! ``` -#![unstable(feature = "pin", issue = "49150")] +#![stable(feature = "pin", since = "1.33.0")] use fmt; -use marker::Sized; -use ops::{Deref, DerefMut, CoerceUnsized, DispatchFromDyn}; - -#[doc(inline)] -pub use marker::Unpin; +use marker::{Sized, Unpin}; +use cmp::{self, PartialEq, PartialOrd}; +use ops::{Deref, DerefMut, Receiver, CoerceUnsized, DispatchFromDyn}; /// A pinned pointer. /// @@ -107,22 +113,65 @@ pub use marker::Unpin; /// [`Unpin`]: ../../std/marker/trait.Unpin.html /// [`pin` module]: ../../std/pin/index.html // -// Note: the derives below are allowed because they all only use `&P`, so they -// cannot move the value behind `pointer`. -#[unstable(feature = "pin", issue = "49150")] +// Note: the derives below, and the explicit `PartialEq` and `PartialOrd` +// implementations, are allowed because they all only use `&P`, so they cannot move +// the value behind `pointer`. +#[stable(feature = "pin", since = "1.33.0")] +#[cfg_attr(not(stage0), lang = "pin")] #[fundamental] -#[derive(Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)] +#[repr(transparent)] +#[derive(Copy, Clone, Hash, Eq, Ord)] pub struct Pin

{ pointer: P, } +#[stable(feature = "pin_partialeq_partialord_impl_applicability", since = "1.34.0")] +impl PartialEq> for Pin

+where + P: PartialEq, +{ + fn eq(&self, other: &Pin) -> bool { + self.pointer == other.pointer + } + + fn ne(&self, other: &Pin) -> bool { + self.pointer != other.pointer + } +} + +#[stable(feature = "pin_partialeq_partialord_impl_applicability", since = "1.34.0")] +impl PartialOrd> for Pin

+where + P: PartialOrd, +{ + fn partial_cmp(&self, other: &Pin) -> Option { + self.pointer.partial_cmp(&other.pointer) + } + + fn lt(&self, other: &Pin) -> bool { + self.pointer < other.pointer + } + + fn le(&self, other: &Pin) -> bool { + self.pointer <= other.pointer + } + + fn gt(&self, other: &Pin) -> bool { + self.pointer > other.pointer + } + + fn ge(&self, other: &Pin) -> bool { + self.pointer >= other.pointer + } +} + impl Pin

where P::Target: Unpin, { /// Construct a new `Pin` around a pointer to some data of a type that /// implements `Unpin`. - #[unstable(feature = "pin", issue = "49150")] + #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] pub fn new(pointer: P) -> Pin

{ // Safety: the value pointed to is `Unpin`, and so has no requirements @@ -144,14 +193,14 @@ impl Pin

{ /// /// If `pointer` dereferences to an `Unpin` type, `Pin::new` should be used /// instead. - #[unstable(feature = "pin", issue = "49150")] + #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] pub unsafe fn new_unchecked(pointer: P) -> Pin

{ Pin { pointer } } /// Get a pinned shared reference from this pinned pointer. - #[unstable(feature = "pin", issue = "49150")] + #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] pub fn as_ref(self: &Pin

) -> Pin<&P::Target> { unsafe { Pin::new_unchecked(&*self.pointer) } @@ -160,20 +209,20 @@ impl Pin

{ impl Pin

{ /// Get a pinned mutable reference from this pinned pointer. - #[unstable(feature = "pin", issue = "49150")] + #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] pub fn as_mut(self: &mut Pin

) -> Pin<&mut P::Target> { unsafe { Pin::new_unchecked(&mut *self.pointer) } } /// Assign a new value to the memory behind the pinned reference. - #[unstable(feature = "pin", issue = "49150")] + #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] - pub fn set(mut self: Pin

, value: P::Target) + pub fn set(self: &mut Pin

, value: P::Target) where P::Target: Sized, { - *self.pointer = value; + *(self.pointer) = value; } } @@ -189,11 +238,11 @@ impl<'a, T: ?Sized> Pin<&'a T> { /// will not move so long as the argument value does not move (for example, /// because it is one of the fields of that value), and also that you do /// not move out of the argument you receive to the interior function. - #[unstable(feature = "pin", issue = "49150")] - pub unsafe fn map_unchecked(this: Pin<&'a T>, func: F) -> Pin<&'a U> where + #[stable(feature = "pin", since = "1.33.0")] + pub unsafe fn map_unchecked(self: Pin<&'a T>, func: F) -> Pin<&'a U> where F: FnOnce(&T) -> &U, { - let pointer = &*this.pointer; + let pointer = &*self.pointer; let new_pointer = func(pointer); Pin::new_unchecked(new_pointer) } @@ -205,19 +254,19 @@ impl<'a, T: ?Sized> Pin<&'a T> { /// that lives for as long as the borrow of the `Pin`, not the lifetime of /// the `Pin` itself. This method allows turning the `Pin` into a reference /// with the same lifetime as the original `Pin`. - #[unstable(feature = "pin", issue = "49150")] + #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] - pub fn get_ref(this: Pin<&'a T>) -> &'a T { - this.pointer + pub fn get_ref(self: Pin<&'a T>) -> &'a T { + self.pointer } } impl<'a, T: ?Sized> Pin<&'a mut T> { /// Convert this `Pin<&mut T>` into a `Pin<&T>` with the same lifetime. - #[unstable(feature = "pin", issue = "49150")] + #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] - pub fn into_ref(this: Pin<&'a mut T>) -> Pin<&'a T> { - Pin { pointer: this.pointer } + pub fn into_ref(self: Pin<&'a mut T>) -> Pin<&'a T> { + Pin { pointer: self.pointer } } /// Get a mutable reference to the data inside of this `Pin`. @@ -229,12 +278,12 @@ impl<'a, T: ?Sized> Pin<&'a mut T> { /// that lives for as long as the borrow of the `Pin`, not the lifetime of /// the `Pin` itself. This method allows turning the `Pin` into a reference /// with the same lifetime as the original `Pin`. - #[unstable(feature = "pin", issue = "49150")] + #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] - pub fn get_mut(this: Pin<&'a mut T>) -> &'a mut T + pub fn get_mut(self: Pin<&'a mut T>) -> &'a mut T where T: Unpin, { - this.pointer + self.pointer } /// Get a mutable reference to the data inside of this `Pin`. @@ -247,10 +296,10 @@ impl<'a, T: ?Sized> Pin<&'a mut T> { /// /// If the underlying data is `Unpin`, `Pin::get_mut` should be used /// instead. - #[unstable(feature = "pin", issue = "49150")] + #[stable(feature = "pin", since = "1.33.0")] #[inline(always)] - pub unsafe fn get_mut_unchecked(this: Pin<&'a mut T>) -> &'a mut T { - this.pointer + pub unsafe fn get_unchecked_mut(self: Pin<&'a mut T>) -> &'a mut T { + self.pointer } /// Construct a new pin by mapping the interior value. @@ -264,17 +313,17 @@ impl<'a, T: ?Sized> Pin<&'a mut T> { /// will not move so long as the argument value does not move (for example, /// because it is one of the fields of that value), and also that you do /// not move out of the argument you receive to the interior function. - #[unstable(feature = "pin", issue = "49150")] - pub unsafe fn map_unchecked_mut(this: Pin<&'a mut T>, func: F) -> Pin<&'a mut U> where + #[stable(feature = "pin", since = "1.33.0")] + pub unsafe fn map_unchecked_mut(self: Pin<&'a mut T>, func: F) -> Pin<&'a mut U> where F: FnOnce(&mut T) -> &mut U, { - let pointer = Pin::get_mut_unchecked(this); + let pointer = Pin::get_unchecked_mut(self); let new_pointer = func(pointer); Pin::new_unchecked(new_pointer) } } -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl Deref for Pin

{ type Target = P::Target; fn deref(&self) -> &P::Target { @@ -282,7 +331,7 @@ impl Deref for Pin

{ } } -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl DerefMut for Pin

where P::Target: Unpin @@ -292,21 +341,24 @@ where } } -#[unstable(feature = "pin", issue = "49150")] +#[unstable(feature = "receiver_trait", issue = "0")] +impl Receiver for Pin

{} + +#[stable(feature = "pin", since = "1.33.0")] impl fmt::Debug for Pin

{ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Debug::fmt(&self.pointer, f) } } -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl fmt::Display for Pin

{ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.pointer, f) } } -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl fmt::Pointer for Pin

{ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Pointer::fmt(&self.pointer, f) @@ -318,17 +370,14 @@ impl fmt::Pointer for Pin

{ // `Deref` is unsound. Any such impl would probably be unsound // for other reasons, though, so we just need to take care not to allow such // impls to land in std. -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl CoerceUnsized> for Pin

where P: CoerceUnsized, {} -#[unstable(feature = "pin", issue = "49150")] +#[stable(feature = "pin", since = "1.33.0")] impl<'a, P, U> DispatchFromDyn> for Pin

where P: DispatchFromDyn, {} - -#[unstable(feature = "pin", issue = "49150")] -impl

Unpin for Pin

{} diff --git a/src/libcore/prelude/mod.rs b/src/libcore/prelude/mod.rs index 99b1947c84e..51f4acf0685 100644 --- a/src/libcore/prelude/mod.rs +++ b/src/libcore/prelude/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The libcore prelude #![stable(feature = "core_prelude", since = "1.4.0")] diff --git a/src/libcore/prelude/v1.rs b/src/libcore/prelude/v1.rs index 45f629a6442..b53494edbf4 100644 --- a/src/libcore/prelude/v1.rs +++ b/src/libcore/prelude/v1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The core prelude //! //! This module is intended for users of libcore which do not link to libstd as @@ -19,7 +9,7 @@ // Re-exported core operators #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] -pub use marker::{Copy, Send, Sized, Sync}; +pub use marker::{Copy, Send, Sized, Sync, Unpin}; #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce}; diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index a7bfc3f5124..02eef07afd7 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Manually manage memory through raw pointers. //! //! *[See also the pointer primitive types](../../std/primitive.pointer.html).* @@ -58,7 +48,7 @@ //! [`NonNull::dangling`] in such cases. //! //! [aliasing]: ../../nomicon/aliasing.html -//! [book]: ../../book/second-edition/ch19-01-unsafe-rust.html#dereferencing-a-raw-pointer +//! [book]: ../../book/ch19-01-unsafe-rust.html#dereferencing-a-raw-pointer //! [ub]: ../../reference/behavior-considered-undefined.html //! [null]: ./fn.null.html //! [zst]: ../../nomicon/exotic-sizes.html#zero-sized-types-zsts @@ -79,8 +69,7 @@ use ops::{CoerceUnsized, DispatchFromDyn}; use fmt; use hash; use marker::{PhantomData, Unsize}; -use mem; -use nonzero::NonZero; +use mem::{self, MaybeUninit}; use cmp::Ordering::{self, Less, Equal, Greater}; @@ -103,7 +92,7 @@ pub use intrinsics::write_bytes; /// dropped normally. /// /// * It is friendlier to the optimizer to do this over [`ptr::read`] when -/// dropping manually allocated memory (e.g. when writing Box/Rc/Vec), +/// dropping manually allocated memory (e.g., when writing Box/Rc/Vec), /// as the compiler doesn't need to prove that it's sound to elide the /// copy. /// @@ -189,12 +178,22 @@ pub use intrinsics::write_bytes; /// i.e., you do not usually have to worry about such issues unless you call `drop_in_place` /// manually. #[stable(feature = "drop_in_place", since = "1.8.0")] +#[inline(always)] +pub unsafe fn drop_in_place(to_drop: *mut T) { + real_drop_in_place(&mut *to_drop) +} + +// The real `drop_in_place` -- the one that gets called implicitly when variables go +// out of scope -- should have a safe reference and not a raw pointer as argument +// type. When we drop a local variable, we access it with a pointer that behaves +// like a safe reference; transmuting that to a raw pointer does not mean we can +// actually access it with raw pointers. #[lang = "drop_in_place"] #[allow(unconditional_recursion)] -pub unsafe fn drop_in_place(to_drop: *mut T) { +unsafe fn real_drop_in_place(to_drop: &mut T) { // Code here does not matter - this is replaced by the // real drop glue by the compiler. - drop_in_place(to_drop); + real_drop_in_place(to_drop) } /// Creates a null raw pointer. @@ -295,17 +294,14 @@ pub const fn null_mut() -> *mut T { 0 as *mut T } #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn swap(x: *mut T, y: *mut T) { - // Give ourselves some scratch space to work with - let mut tmp: T = mem::uninitialized(); + // Give ourselves some scratch space to work with. + // We do not have to worry about drops: `MaybeUninit` does nothing when dropped. + let mut tmp = MaybeUninit::::uninitialized(); // Perform the swap - copy_nonoverlapping(x, &mut tmp, 1); + copy_nonoverlapping(x, tmp.as_mut_ptr(), 1); copy(y, x, 1); // `x` and `y` may overlap - copy_nonoverlapping(&tmp, y, 1); - - // y and t now point to the same thing, but we need to completely forget `tmp` - // because it's no longer relevant. - mem::forget(tmp); + copy_nonoverlapping(tmp.get_ref(), y, 1); } /// Swaps `count * size_of::()` bytes between the two regions of memory @@ -392,8 +388,8 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) { while i + block_size <= len { // Create some uninitialized memory as scratch space // Declaring `t` here avoids aligning the stack when this loop is unused - let mut t: Block = mem::uninitialized(); - let t = &mut t as *mut _ as *mut u8; + let mut t = mem::MaybeUninit::::uninitialized(); + let t = t.as_mut_ptr() as *mut u8; let x = x.add(i); let y = y.add(i); @@ -407,10 +403,10 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) { if i < len { // Swap any remaining bytes - let mut t: UnalignedBlock = mem::uninitialized(); + let mut t = mem::MaybeUninit::::uninitialized(); let rem = len - i; - let t = &mut t as *mut _ as *mut u8; + let t = t.as_mut_ptr() as *mut u8; let x = x.add(i); let y = y.add(i); @@ -575,9 +571,9 @@ pub unsafe fn replace(dst: *mut T, mut src: T) -> T { #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub unsafe fn read(src: *const T) -> T { - let mut tmp: T = mem::uninitialized(); - copy_nonoverlapping(src, &mut tmp, 1); - tmp + let mut tmp = MaybeUninit::::uninitialized(); + copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); + tmp.into_inner() } /// Reads the value from `src` without moving it. This leaves the @@ -595,7 +591,7 @@ pub unsafe fn read(src: *const T) -> T { /// whether `T` is [`Copy`]. If `T` is not [`Copy`], using both the returned /// value and the value at `*src` can [violate memory safety][read-ownership]. /// -/// Note that even if `T` has size `0`, the pointer must be non-NULL and properly aligned. +/// Note that even if `T` has size `0`, the pointer must be non-NULL. /// /// [`Copy`]: ../marker/trait.Copy.html /// [`read`]: ./fn.read.html @@ -642,11 +638,11 @@ pub unsafe fn read(src: *const T) -> T { #[inline] #[stable(feature = "ptr_unaligned", since = "1.17.0")] pub unsafe fn read_unaligned(src: *const T) -> T { - let mut tmp: T = mem::uninitialized(); + let mut tmp = MaybeUninit::::uninitialized(); copy_nonoverlapping(src as *const u8, - &mut tmp as *mut T as *mut u8, + tmp.as_mut_ptr() as *mut u8, mem::size_of::()); - tmp + tmp.into_inner() } /// Overwrites a memory location with the given value without reading or @@ -763,7 +759,7 @@ pub unsafe fn write(dst: *mut T, src: T) { /// /// * `dst` must be [valid] for writes. /// -/// Note that even if `T` has size `0`, the pointer must be non-NULL and properly aligned. +/// Note that even if `T` has size `0`, the pointer must be non-NULL. /// /// [valid]: ../ptr/index.html#safety /// @@ -829,7 +825,7 @@ pub unsafe fn write_unaligned(dst: *mut T, src: T) { /// /// The compiler shouldn't change the relative order or number of volatile /// memory operations. However, volatile memory operations on zero-sized types -/// (e.g. if a zero-sized type is passed to `read_volatile`) are no-ops +/// (e.g., if a zero-sized type is passed to `read_volatile`) are no-ops /// and may be ignored. /// /// [c11]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf @@ -853,6 +849,7 @@ pub unsafe fn write_unaligned(dst: *mut T, src: T) { /// [valid]: ../ptr/index.html#safety /// [`Copy`]: ../marker/trait.Copy.html /// [`read`]: ./fn.read.html +/// [read-ownership]: ./fn.read.html#ownership-of-the-returned-value /// /// Just like in C, whether an operation is volatile has no bearing whatsoever /// on questions involving concurrent access from multiple threads. Volatile @@ -906,7 +903,7 @@ pub unsafe fn read_volatile(src: *const T) -> T { /// /// The compiler shouldn't change the relative order or number of volatile /// memory operations. However, volatile memory operations on zero-sized types -/// (e.g. if a zero-sized type is passed to `write_volatile`) are no-ops +/// (e.g., if a zero-sized type is passed to `write_volatile`) are no-ops /// and may be ignored. /// /// [c11]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf @@ -1028,7 +1025,7 @@ impl *const T { /// Calculates the offset from a pointer. /// - /// `count` is in units of T; e.g. a `count` of 3 represents a pointer + /// `count` is in units of T; e.g., a `count` of 3 represents a pointer /// offset of `3 * size_of::()` bytes. /// /// # Safety @@ -1082,7 +1079,7 @@ impl *const T { /// Calculates the offset from a pointer using wrapping arithmetic. /// - /// `count` is in units of T; e.g. a `count` of 3 represents a pointer + /// `count` is in units of T; e.g., a `count` of 3 represents a pointer /// offset of `3 * size_of::()` bytes. /// /// # Safety @@ -1246,7 +1243,7 @@ impl *const T { /// Calculates the offset from a pointer (convenience for `.offset(count as isize)`). /// - /// `count` is in units of T; e.g. a `count` of 3 represents a pointer + /// `count` is in units of T; e.g., a `count` of 3 represents a pointer /// offset of `3 * size_of::()` bytes. /// /// # Safety @@ -1303,7 +1300,7 @@ impl *const T { /// Calculates the offset from a pointer (convenience for /// `.offset((count as isize).wrapping_neg())`). /// - /// `count` is in units of T; e.g. a `count` of 3 represents a pointer + /// `count` is in units of T; e.g., a `count` of 3 represents a pointer /// offset of `3 * size_of::()` bytes. /// /// # Safety @@ -1360,7 +1357,7 @@ impl *const T { /// Calculates the offset from a pointer using wrapping arithmetic. /// (convenience for `.wrapping_offset(count as isize)`) /// - /// `count` is in units of T; e.g. a `count` of 3 represents a pointer + /// `count` is in units of T; e.g., a `count` of 3 represents a pointer /// offset of `3 * size_of::()` bytes. /// /// # Safety @@ -1401,7 +1398,7 @@ impl *const T { /// Calculates the offset from a pointer using wrapping arithmetic. /// (convenience for `.wrapping_offset((count as isize).wrapping_sub())`) /// - /// `count` is in units of T; e.g. a `count` of 3 represents a pointer + /// `count` is in units of T; e.g., a `count` of 3 represents a pointer /// offset of `3 * size_of::()` bytes. /// /// # Safety @@ -1648,7 +1645,7 @@ impl *mut T { /// Calculates the offset from a pointer. /// - /// `count` is in units of T; e.g. a `count` of 3 represents a pointer + /// `count` is in units of T; e.g., a `count` of 3 represents a pointer /// offset of `3 * size_of::()` bytes. /// /// # Safety @@ -1701,7 +1698,7 @@ impl *mut T { } /// Calculates the offset from a pointer using wrapping arithmetic. - /// `count` is in units of T; e.g. a `count` of 3 represents a pointer + /// `count` is in units of T; e.g., a `count` of 3 represents a pointer /// offset of `3 * size_of::()` bytes. /// /// # Safety @@ -1884,7 +1881,7 @@ impl *mut T { /// Calculates the offset from a pointer (convenience for `.offset(count as isize)`). /// - /// `count` is in units of T; e.g. a `count` of 3 represents a pointer + /// `count` is in units of T; e.g., a `count` of 3 represents a pointer /// offset of `3 * size_of::()` bytes. /// /// # Safety @@ -1941,7 +1938,7 @@ impl *mut T { /// Calculates the offset from a pointer (convenience for /// `.offset((count as isize).wrapping_neg())`). /// - /// `count` is in units of T; e.g. a `count` of 3 represents a pointer + /// `count` is in units of T; e.g., a `count` of 3 represents a pointer /// offset of `3 * size_of::()` bytes. /// /// # Safety @@ -1998,7 +1995,7 @@ impl *mut T { /// Calculates the offset from a pointer using wrapping arithmetic. /// (convenience for `.wrapping_offset(count as isize)`) /// - /// `count` is in units of T; e.g. a `count` of 3 represents a pointer + /// `count` is in units of T; e.g., a `count` of 3 represents a pointer /// offset of `3 * size_of::()` bytes. /// /// # Safety @@ -2039,7 +2036,7 @@ impl *mut T { /// Calculates the offset from a pointer using wrapping arithmetic. /// (convenience for `.wrapping_offset((count as isize).wrapping_sub())`) /// - /// `count` is in units of T; e.g. a `count` of 3 represents a pointer + /// `count` is in units of T; e.g., a `count` of 3 represents a pointer /// offset of `3 * size_of::()` bytes. /// /// # Safety @@ -2368,7 +2365,7 @@ pub(crate) unsafe fn align_offset(p: *const T, a: usize) -> usize { fn mod_inv(x: usize, m: usize) -> usize { /// Multiplicative modular inverse table modulo 2⁴ = 16. /// - /// Note, that this table does not contain values where inverse does not exist (i.e. for + /// Note, that this table does not contain values where inverse does not exist (i.e., for /// `0⁻¹ mod 16`, `2⁻¹ mod 16`, etc.) const INV_TABLE_MOD_16: [u8; 8] = [1, 11, 13, 7, 9, 3, 5, 15]; /// Modulo for which the `INV_TABLE_MOD_16` is intended. @@ -2391,7 +2388,7 @@ pub(crate) unsafe fn align_offset(p: *const T, a: usize) -> usize { // y = y * (2 - xy) mod n // // Note, that we use wrapping operations here intentionally – the original formula - // uses e.g. subtraction `mod n`. It is entirely fine to do them `mod + // uses e.g., subtraction `mod n`. It is entirely fine to do them `mod // usize::max_value()` instead, because we take the result `mod n` at the end // anyway. inverse = inverse.wrapping_mul( @@ -2509,6 +2506,39 @@ pub fn eq(a: *const T, b: *const T) -> bool { a == b } +/// Hash a raw pointer. +/// +/// This can be used to hash a `&T` reference (which coerces to `*const T` implicitly) +/// by its address rather than the value it points to +/// (which is what the `Hash for &T` implementation does). +/// +/// # Examples +/// +/// ``` +/// #![feature(ptr_hash)] +/// use std::collections::hash_map::DefaultHasher; +/// use std::hash::{Hash, Hasher}; +/// use std::ptr; +/// +/// let five = 5; +/// let five_ref = &five; +/// +/// let mut hasher = DefaultHasher::new(); +/// ptr::hash(five_ref, &mut hasher); +/// let actual = hasher.finish(); +/// +/// let mut hasher = DefaultHasher::new(); +/// (five_ref as *const i32).hash(&mut hasher); +/// let expected = hasher.finish(); +/// +/// assert_eq!(actual, expected); +/// ``` +#[unstable(feature = "ptr_hash", reason = "newly added", issue = "56286")] +pub fn hash(hashee: *const T, into: &mut S) { + use hash::Hash; + hashee.hash(into); +} + // Impls for function pointers macro_rules! fnptr_impls_safety_abi { ($FnTy: ty, $($Arg: ident),*) => { @@ -2688,8 +2718,9 @@ impl PartialOrd for *mut T { (if you also use #[may_dangle]), Send, and/or Sync")] #[doc(hidden)] #[repr(transparent)] +#[rustc_layout_scalar_valid_range_start(1)] pub struct Unique { - pointer: NonZero<*const T>, + pointer: *const T, // NOTE: this marker has no consequences for variance, but is necessary // for dropck to understand that we logically own a `T`. // @@ -2746,13 +2777,13 @@ impl Unique { /// /// `ptr` must be non-null. pub const unsafe fn new_unchecked(ptr: *mut T) -> Self { - Unique { pointer: NonZero(ptr as _), _marker: PhantomData } + Unique { pointer: ptr as _, _marker: PhantomData } } /// Creates a new `Unique` if `ptr` is non-null. pub fn new(ptr: *mut T) -> Option { if !ptr.is_null() { - Some(Unique { pointer: NonZero(ptr as _), _marker: PhantomData }) + Some(unsafe { Unique { pointer: ptr as _, _marker: PhantomData } }) } else { None } @@ -2760,7 +2791,7 @@ impl Unique { /// Acquires the underlying `*mut` pointer. pub fn as_ptr(self) -> *mut T { - self.pointer.0 as *mut T + self.pointer as *mut T } /// Dereferences the content. @@ -2808,21 +2839,21 @@ impl fmt::Pointer for Unique { #[unstable(feature = "ptr_internals", issue = "0")] impl<'a, T: ?Sized> From<&'a mut T> for Unique { fn from(reference: &'a mut T) -> Self { - Unique { pointer: NonZero(reference as _), _marker: PhantomData } + unsafe { Unique { pointer: reference as *mut T, _marker: PhantomData } } } } #[unstable(feature = "ptr_internals", issue = "0")] impl<'a, T: ?Sized> From<&'a T> for Unique { fn from(reference: &'a T) -> Self { - Unique { pointer: NonZero(reference as _), _marker: PhantomData } + unsafe { Unique { pointer: reference as *const T, _marker: PhantomData } } } } #[unstable(feature = "ptr_internals", issue = "0")] impl<'a, T: ?Sized> From> for Unique { fn from(p: NonNull) -> Self { - Unique { pointer: p.pointer, _marker: PhantomData } + unsafe { Unique { pointer: p.pointer, _marker: PhantomData } } } } @@ -2845,17 +2876,18 @@ impl<'a, T: ?Sized> From> for Unique { /// provide a public API that follows the normal shared XOR mutable rules of Rust. #[stable(feature = "nonnull", since = "1.25.0")] #[repr(transparent)] +#[rustc_layout_scalar_valid_range_start(1)] pub struct NonNull { - pointer: NonZero<*const T>, + pointer: *const T, } /// `NonNull` pointers are not `Send` because the data they reference may be aliased. -// NB: This impl is unnecessary, but should provide better error messages. +// N.B., this impl is unnecessary, but should provide better error messages. #[stable(feature = "nonnull", since = "1.25.0")] impl !Send for NonNull { } /// `NonNull` pointers are not `Sync` because the data they reference may be aliased. -// NB: This impl is unnecessary, but should provide better error messages. +// N.B., this impl is unnecessary, but should provide better error messages. #[stable(feature = "nonnull", since = "1.25.0")] impl !Sync for NonNull { } @@ -2888,7 +2920,7 @@ impl NonNull { #[stable(feature = "nonnull", since = "1.25.0")] #[inline] pub const unsafe fn new_unchecked(ptr: *mut T) -> Self { - NonNull { pointer: NonZero(ptr as _) } + NonNull { pointer: ptr as _ } } /// Creates a new `NonNull` if `ptr` is non-null. @@ -2896,7 +2928,7 @@ impl NonNull { #[inline] pub fn new(ptr: *mut T) -> Option { if !ptr.is_null() { - Some(NonNull { pointer: NonZero(ptr as _) }) + Some(unsafe { Self::new_unchecked(ptr) }) } else { None } @@ -2906,7 +2938,7 @@ impl NonNull { #[stable(feature = "nonnull", since = "1.25.0")] #[inline] pub const fn as_ptr(self) -> *mut T { - self.pointer.0 as *mut T + self.pointer as *mut T } /// Dereferences the content. @@ -3010,7 +3042,7 @@ impl hash::Hash for NonNull { impl From> for NonNull { #[inline] fn from(unique: Unique) -> Self { - NonNull { pointer: unique.pointer } + unsafe { NonNull { pointer: unique.pointer } } } } @@ -3018,7 +3050,7 @@ impl From> for NonNull { impl<'a, T: ?Sized> From<&'a mut T> for NonNull { #[inline] fn from(reference: &'a mut T) -> Self { - NonNull { pointer: NonZero(reference as _) } + unsafe { NonNull { pointer: reference as *mut T } } } } @@ -3026,6 +3058,6 @@ impl<'a, T: ?Sized> From<&'a mut T> for NonNull { impl<'a, T: ?Sized> From<&'a T> for NonNull { #[inline] fn from(reference: &'a T) -> Self { - NonNull { pointer: NonZero(reference as _) } + unsafe { NonNull { pointer: reference as *const T } } } } diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs index a95f05227fb..155429b0e4f 100644 --- a/src/libcore/raw.rs +++ b/src/libcore/raw.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(missing_docs)] #![unstable(feature = "raw", issue = "27751")] @@ -21,14 +11,10 @@ /// The representation of a trait object like `&SomeTrait`. /// /// This struct has the same layout as types like `&SomeTrait` and -/// `Box`. The [Trait Objects chapter of the -/// Book][moreinfo] contains more details about the precise nature of -/// these internals. -/// -/// [moreinfo]: ../../book/first-edition/trait-objects.html#representation +/// `Box`. /// /// `TraitObject` is guaranteed to match layouts, but it is not the -/// type of trait objects (e.g. the fields are not directly accessible +/// type of trait objects (e.g., the fields are not directly accessible /// on a `&SomeTrait`) nor does it control that layout (changing the /// definition will not change the layout of a `&SomeTrait`). It is /// only designed to be used by unsafe code that needs to manipulate diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 3484664c242..1ebf0714e23 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Error handling with the `Result` type. //! //! [`Result`][`Result`] is the type used for returning and propagating @@ -982,8 +972,6 @@ impl Result, E> { /// # Examples /// /// ``` - /// #![feature(transpose_result)] - /// /// #[derive(Debug, Eq, PartialEq)] /// struct SomeErr; /// @@ -992,7 +980,7 @@ impl Result, E> { /// assert_eq!(x.transpose(), y); /// ``` #[inline] - #[unstable(feature = "transpose_result", issue = "47338")] + #[stable(feature = "transpose_result", since = "1.33.0")] pub fn transpose(self) -> Option> { match self { Ok(Some(x)) => Some(Ok(x)), diff --git a/src/libcore/slice/memchr.rs b/src/libcore/slice/memchr.rs index cf95333af9c..312838a170c 100644 --- a/src/libcore/slice/memchr.rs +++ b/src/libcore/slice/memchr.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -// Original implementation taken from rust-memchr +// Original implementation taken from rust-memchr. // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch use cmp; @@ -17,13 +7,13 @@ use mem; const LO_U64: u64 = 0x0101010101010101; const HI_U64: u64 = 0x8080808080808080; -// use truncation +// Use truncation. const LO_USIZE: usize = LO_U64 as usize; const HI_USIZE: usize = HI_U64 as usize; -/// Return `true` if `x` contains any zero byte. +/// Returns whether `x` contains any zero byte. /// -/// From *Matters Computational*, J. Arndt +/// From *Matters Computational*, J. Arndt: /// /// "The idea is to subtract one from each of the bytes and then look for /// bytes where the borrow propagated all the way to the most significant @@ -45,7 +35,7 @@ fn repeat_byte(b: u8) -> usize { (b as usize) * (::usize::MAX / 255) } -/// Return the first index matching the byte `x` in `text`. +/// Returns the first index matching the byte `x` in `text`. pub fn memchr(x: u8, text: &[u8]) -> Option { // Scan for a single byte value by reading two `usize` words at a time. // @@ -86,18 +76,18 @@ pub fn memchr(x: u8, text: &[u8]) -> Option { } } - // find the byte after the point the body loop stopped + // Find the byte after the point the body loop stopped. text[offset..].iter().position(|elt| *elt == x).map(|i| offset + i) } -/// Return the last index matching the byte `x` in `text`. +/// Returns the last index matching the byte `x` in `text`. pub fn memrchr(x: u8, text: &[u8]) -> Option { // Scan for a single byte value by reading two `usize` words at a time. // - // Split `text` in three parts - // - unaligned tail, after the last word aligned address in text - // - body, scan by 2 words at a time - // - the first remaining bytes, < 2 word size + // Split `text` in three parts: + // - unaligned tail, after the last word aligned address in text, + // - body, scanned by 2 words at a time, + // - the first remaining bytes, < 2 word size. let len = text.len(); let ptr = text.as_ptr(); type Chunk = usize; @@ -114,7 +104,7 @@ pub fn memrchr(x: u8, text: &[u8]) -> Option { return Some(offset + index); } - // search the body of the text, make sure we don't cross min_aligned_offset. + // Search the body of the text, make sure we don't cross min_aligned_offset. // offset is always aligned, so just testing `>` is sufficient and avoids possible // overflow. let repeated_x = repeat_byte(x); @@ -125,7 +115,7 @@ pub fn memrchr(x: u8, text: &[u8]) -> Option { let u = *(ptr.offset(offset as isize - 2 * chunk_bytes as isize) as *const Chunk); let v = *(ptr.offset(offset as isize - chunk_bytes as isize) as *const Chunk); - // break if there is a matching byte + // Break if there is a matching byte. let zu = contains_zero_byte(u ^ repeated_x); let zv = contains_zero_byte(v ^ repeated_x); if zu || zv { @@ -135,6 +125,6 @@ pub fn memrchr(x: u8, text: &[u8]) -> Option { offset -= 2 * chunk_bytes; } - // find the byte before the point the body loop stopped + // Find the byte before the point the body loop stopped. text[..offset].iter().rposition(|elt| *elt == x) } diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index fece328f51f..d062da0c247 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -1,14 +1,4 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Slice management and manipulation +//! Slice management and manipulation. //! //! For more details see [`std::slice`]. //! @@ -44,7 +34,6 @@ use result::Result::{Ok, Err}; use ptr; use mem; use marker::{Copy, Send, Sync, Sized, self}; -use iter_private::TrustedRandomAccess; #[unstable(feature = "slice_internals", issue = "0", reason = "exposed from core to be reused in std; use the memchr crate")] @@ -702,8 +691,7 @@ impl [T] { /// resulting code better than in the case of [`chunks`]. /// /// See [`chunks`] for a variant of this iterator that also returns the remainder as a smaller - /// chunk, and [`rchunks_exact`] for the same iterator but starting at the end of the slice of - /// the slice. + /// chunk, and [`rchunks_exact`] for the same iterator but starting at the end of the slice. /// /// # Panics /// @@ -878,6 +866,7 @@ impl [T] { /// assert_eq!(iter.remainder(), &['l']); /// ``` /// + /// [`chunks`]: #method.chunks /// [`rchunks`]: #method.rchunks /// [`chunks_exact`]: #method.chunks_exact #[stable(feature = "rchunks", since = "1.31.0")] @@ -922,6 +911,7 @@ impl [T] { /// assert_eq!(v, &[0, 2, 2, 1, 1]); /// ``` /// + /// [`chunks_mut`]: #method.chunks_mut /// [`rchunks_mut`]: #method.rchunks_mut /// [`chunks_exact_mut`]: #method.chunks_exact_mut #[stable(feature = "rchunks", since = "1.31.0")] @@ -1152,7 +1142,7 @@ impl [T] { /// /// # Examples /// - /// Print the slice split once by numbers divisible by 3 (i.e. `[10, 40]`, + /// Print the slice split once by numbers divisible by 3 (i.e., `[10, 40]`, /// `[20, 60, 50]`): /// /// ``` @@ -1216,7 +1206,7 @@ impl [T] { /// # Examples /// /// Print the slice split once, starting from the end, by numbers divisible - /// by 3 (i.e. `[50]`, `[10, 40, 30, 20]`): + /// by 3 (i.e., `[50]`, `[10, 40, 30, 20]`): /// /// ``` /// let v = [10, 40, 30, 20, 60, 50]; @@ -1472,8 +1462,8 @@ impl [T] { /// Sorts the slice, but may not preserve the order of equal elements. /// - /// This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate), - /// and `O(n log n)` worst-case. + /// This sort is unstable (i.e., may reorder equal elements), in-place + /// (i.e., does not allocate), and `O(n log n)` worst-case. /// /// # Current implementation /// @@ -1483,7 +1473,7 @@ impl [T] { /// randomization to avoid degenerate cases, but with a fixed seed to always provide /// deterministic behavior. /// - /// It is typically faster than stable sorting, except in a few special cases, e.g. when the + /// It is typically faster than stable sorting, except in a few special cases, e.g., when the /// slice consists of several concatenated sorted sequences. /// /// # Examples @@ -1507,8 +1497,24 @@ impl [T] { /// Sorts the slice with a comparator function, but may not preserve the order of equal /// elements. /// - /// This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate), - /// and `O(n log n)` worst-case. + /// This sort is unstable (i.e., may reorder equal elements), in-place + /// (i.e., does not allocate), and `O(n log n)` worst-case. + /// + /// The comparator function must define a total ordering for the elements in the slice. If + /// the ordering is not total, the order of the elements is unspecified. An order is a + /// total order if it is (for all a, b and c): + /// + /// * total and antisymmetric: exactly one of a < b, a == b or a > b is true; and + /// * transitive, a < b and b < c implies a < c. The same must hold for both == and >. + /// + /// For example, while [`f64`] doesn't implement [`Ord`] because `NaN != NaN`, we can use + /// `partial_cmp` as our sort function when we know the slice doesn't contain a `NaN`. + /// + /// ``` + /// let mut floats = [5f64, 4.0, 1.0, 3.0, 2.0]; + /// floats.sort_by(|a, b| a.partial_cmp(b).unwrap()); + /// assert_eq!(floats, [1.0, 2.0, 3.0, 4.0, 5.0]); + /// ``` /// /// # Current implementation /// @@ -1518,7 +1524,7 @@ impl [T] { /// randomization to avoid degenerate cases, but with a fixed seed to always provide /// deterministic behavior. /// - /// It is typically faster than stable sorting, except in a few special cases, e.g. when the + /// It is typically faster than stable sorting, except in a few special cases, e.g., when the /// slice consists of several concatenated sorted sequences. /// /// # Examples @@ -1545,8 +1551,9 @@ impl [T] { /// Sorts the slice with a key extraction function, but may not preserve the order of equal /// elements. /// - /// This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate), - /// and `O(m n log(m n))` worst-case, where the key function is `O(m)`. + /// This sort is unstable (i.e., may reorder equal elements), in-place + /// (i.e., does not allocate), and `O(m n log(m n))` worst-case, where the key function is + /// `O(m)`. /// /// # Current implementation /// @@ -1775,7 +1782,7 @@ impl [T] { /// let mut a = ['a', 'b', 'c', 'd', 'e', 'f']; /// a[1..5].rotate_left(1); /// assert_eq!(a, ['a', 'c', 'd', 'e', 'b', 'f']); - /// ``` + /// ``` #[stable(feature = "slice_rotate", since = "1.26.0")] pub fn rotate_left(&mut self, mid: usize) { assert!(mid <= self.len()); @@ -2242,6 +2249,77 @@ impl [T] { from_raw_parts_mut(mut_ptr.add(rest.len() - ts_len), ts_len)) } } + + /// Checks if the elements of this slice are sorted. + /// + /// That is, for each element `a` and its following element `b`, `a <= b` must hold. If the + /// slice yields exactly zero or one element, `true` is returned. + /// + /// Note that if `Self::Item` is only `PartialOrd`, but not `Ord`, the above definition + /// implies that this function returns `false` if any two consecutive items are not + /// comparable. + /// + /// # Examples + /// + /// ``` + /// #![feature(is_sorted)] + /// let empty: [i32; 0] = []; + /// + /// assert!([1, 2, 2, 9].is_sorted()); + /// assert!(![1, 3, 2, 4].is_sorted()); + /// assert!([0].is_sorted()); + /// assert!(empty.is_sorted()); + /// assert!(![0.0, 1.0, std::f32::NAN].is_sorted()); + /// ``` + #[inline] + #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")] + pub fn is_sorted(&self) -> bool + where + T: PartialOrd, + { + self.is_sorted_by(|a, b| a.partial_cmp(b)) + } + + /// Checks if the elements of this slice are sorted using the given comparator function. + /// + /// Instead of using `PartialOrd::partial_cmp`, this function uses the given `compare` + /// function to determine the ordering of two elements. Apart from that, it's equivalent to + /// [`is_sorted`]; see its documentation for more information. + /// + /// [`is_sorted`]: #method.is_sorted + #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")] + pub fn is_sorted_by(&self, mut compare: F) -> bool + where + F: FnMut(&T, &T) -> Option + { + self.iter().is_sorted_by(|a, b| compare(*a, *b)) + } + + /// Checks if the elements of this slice are sorted using the given key extraction function. + /// + /// Instead of comparing the slice's elements directly, this function compares the keys of the + /// elements, as determined by `f`. Apart from that, it's equivalent to [`is_sorted`]; see its + /// documentation for more information. + /// + /// [`is_sorted`]: #method.is_sorted + /// + /// # Examples + /// + /// ``` + /// #![feature(is_sorted)] + /// + /// assert!(["c", "bb", "aaa"].is_sorted_by_key(|s| s.len())); + /// assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs())); + /// ``` + #[inline] + #[unstable(feature = "is_sorted", reason = "new API", issue = "53485")] + pub fn is_sorted_by_key(&self, mut f: F) -> bool + where + F: FnMut(&T) -> K, + K: PartialOrd + { + self.is_sorted_by(|a, b| f(a).partial_cmp(&f(b))) + } } #[lang = "slice_u8"] @@ -2304,7 +2382,6 @@ impl [u8] { } #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_on_unimplemented = "slice indices are of type `usize` or ranges of `usize`"] impl ops::Index for [T] where I: SliceIndex<[T]> { @@ -2317,7 +2394,6 @@ impl ops::Index for [T] } #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_on_unimplemented = "slice indices are of type `usize` or ranges of `usize`"] impl ops::IndexMut for [T] where I: SliceIndex<[T]> { @@ -2368,7 +2444,19 @@ mod private_slice_index { /// A helper trait used for indexing operations. #[stable(feature = "slice_get_slice", since = "1.28.0")] -#[rustc_on_unimplemented = "slice indices are of type `usize` or ranges of `usize`"] +#[rustc_on_unimplemented( + on( + T = "str", + label = "string indices are ranges of `usize`", + ), + on( + all(any(T = "str", T = "&str", T = "std::string::String"), _Self="{integer}"), + note="you can use `.chars().nth()` or `.bytes().nth()` +see chapter in The Book " + ), + message = "the type `{T}` cannot be indexed by `{Self}`", + label = "slice indices are of type `usize` or ranges of `usize`", +)] pub trait SliceIndex: private_slice_index::Sealed { /// The output type returned by methods. #[stable(feature = "slice_get_slice", since = "1.28.0")] @@ -2443,13 +2531,13 @@ impl SliceIndex<[T]> for usize { #[inline] fn index(self, slice: &[T]) -> &T { - // NB: use intrinsic indexing + // N.B., use intrinsic indexing &(*slice)[self] } #[inline] fn index_mut(self, slice: &mut [T]) -> &mut T { - // NB: use intrinsic indexing + // N.B., use intrinsic indexing &mut (*slice)[self] } } @@ -2765,7 +2853,13 @@ macro_rules! len { // The shared definition of the `Iter` and `IterMut` iterators macro_rules! iterator { - (struct $name:ident -> $ptr:ty, $elem:ty, $raw_mut:tt, $( $mut_:tt )*) => { + ( + struct $name:ident -> $ptr:ty, + $elem:ty, + $raw_mut:tt, + {$( $mut_:tt )*}, + {$($extra:tt)*} + ) => { impl<'a, T> $name<'a, T> { // Helper function for creating a slice from the iterator. #[inline(always)] @@ -2942,6 +3036,8 @@ macro_rules! iterator { i }) } + + $($extra)* } #[stable(feature = "rust1", since = "1.0.0")] @@ -3079,7 +3175,17 @@ impl<'a, T> Iter<'a, T> { } } -iterator!{struct Iter -> *const T, &'a T, const, /* no mut */} +iterator!{struct Iter -> *const T, &'a T, const, {/* no mut */}, { + fn is_sorted_by(self, mut compare: F) -> bool + where + Self: Sized, + F: FnMut(&Self::Item, &Self::Item) -> Option, + { + self.as_slice().windows(2).all(|w| { + compare(&&w[0], &&w[1]).map(|o| o != Ordering::Greater).unwrap_or(false) + }) + } +}} #[stable(feature = "rust1", since = "1.0.0")] impl Clone for Iter<'_, T> { @@ -3180,7 +3286,7 @@ impl<'a, T> IterMut<'a, T> { } } -iterator!{struct IterMut -> *mut T, &'a mut T, mut, mut} +iterator!{struct IterMut -> *mut T, &'a mut T, mut, {mut}, {}} /// An internal abstraction over the splitting iterators, so that /// splitn, splitn_mut etc can be implemented once. diff --git a/src/libcore/slice/rotate.rs b/src/libcore/slice/rotate.rs index 0d182b84974..52677713f5a 100644 --- a/src/libcore/slice/rotate.rs +++ b/src/libcore/slice/rotate.rs @@ -1,15 +1,5 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cmp; -use mem; +use mem::{self, MaybeUninit}; use ptr; /// Rotation is much faster if it has access to a little bit of memory. This @@ -26,12 +16,6 @@ union RawArray { } impl RawArray { - fn new() -> Self { - unsafe { mem::uninitialized() } - } - fn ptr(&self) -> *mut T { - unsafe { &self.typed as *const T as *mut T } - } fn cap() -> usize { if mem::size_of::() == 0 { usize::max_value() @@ -88,8 +72,8 @@ pub unsafe fn ptr_rotate(mut left: usize, mid: *mut T, mut right: usize) { } } - let rawarray = RawArray::new(); - let buf = rawarray.ptr(); + let mut rawarray = MaybeUninit::>::uninitialized(); + let buf = &mut (*rawarray.as_mut_ptr()).typed as *mut [T; 2] as *mut T; let dim = mid.sub(left).add(right); if left <= right { diff --git a/src/libcore/slice/sort.rs b/src/libcore/slice/sort.rs index e4c1fd03f9e..3f84faa0499 100644 --- a/src/libcore/slice/sort.rs +++ b/src/libcore/slice/sort.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Slice sorting //! //! This module contains an sort algorithm based on Orson Peters' pattern-defeating quicksort, @@ -17,7 +7,7 @@ //! stable sorting implementation. use cmp; -use mem; +use mem::{self, MaybeUninit}; use ptr; /// When dropped, copies from `src` into `dest`. @@ -226,14 +216,14 @@ fn partition_in_blocks(v: &mut [T], pivot: &T, is_less: &mut F) -> usize let mut block_l = BLOCK; let mut start_l = ptr::null_mut(); let mut end_l = ptr::null_mut(); - let mut offsets_l: [u8; BLOCK] = unsafe { mem::uninitialized() }; + let mut offsets_l: [MaybeUninit; BLOCK] = uninitialized_array![u8; BLOCK]; // The current block on the right side (from `r.sub(block_r)` to `r`). let mut r = unsafe { l.add(v.len()) }; let mut block_r = BLOCK; let mut start_r = ptr::null_mut(); let mut end_r = ptr::null_mut(); - let mut offsets_r: [u8; BLOCK] = unsafe { mem::uninitialized() }; + let mut offsets_r: [MaybeUninit; BLOCK] = uninitialized_array![u8; BLOCK]; // FIXME: When we get VLAs, try creating one array of length `min(v.len(), 2 * BLOCK)` rather // than two fixed-size arrays of length `BLOCK`. VLAs might be more cache-efficient. @@ -272,8 +262,8 @@ fn partition_in_blocks(v: &mut [T], pivot: &T, is_less: &mut F) -> usize if start_l == end_l { // Trace `block_l` elements from the left side. - start_l = offsets_l.as_mut_ptr(); - end_l = offsets_l.as_mut_ptr(); + start_l = MaybeUninit::first_ptr_mut(&mut offsets_l); + end_l = MaybeUninit::first_ptr_mut(&mut offsets_l); let mut elem = l; for i in 0..block_l { @@ -288,8 +278,8 @@ fn partition_in_blocks(v: &mut [T], pivot: &T, is_less: &mut F) -> usize if start_r == end_r { // Trace `block_r` elements from the right side. - start_r = offsets_r.as_mut_ptr(); - end_r = offsets_r.as_mut_ptr(); + start_r = MaybeUninit::first_ptr_mut(&mut offsets_r); + end_r = MaybeUninit::first_ptr_mut(&mut offsets_r); let mut elem = r; for i in 0..block_r { diff --git a/src/libcore/str/lossy.rs b/src/libcore/str/lossy.rs index 186d6adbc91..b3e8527c4ae 100644 --- a/src/libcore/str/lossy.rs +++ b/src/libcore/str/lossy.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use char; use str as core_str; use fmt; @@ -62,18 +52,15 @@ impl<'a> Iterator for Utf8LossyChunksIter<'a> { } const TAG_CONT_U8: u8 = 128; - fn unsafe_get(xs: &[u8], i: usize) -> u8 { - unsafe { *xs.get_unchecked(i) } - } fn safe_get(xs: &[u8], i: usize) -> u8 { - if i >= xs.len() { 0 } else { unsafe_get(xs, i) } + *xs.get(i).unwrap_or(&0) } let mut i = 0; while i < self.source.len() { let i_ = i; - let byte = unsafe_get(self.source, i); + let byte = unsafe { *self.source.get_unchecked(i) }; i += 1; if byte < 128 { diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index a316093825a..3cb39360380 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! String manipulation //! //! For more details, see std::str @@ -19,8 +9,7 @@ use self::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher}; use char; use fmt; -use iter::{Map, Cloned, FusedIterator, TrustedLen, Filter}; -use iter_private::TrustedRandomAccess; +use iter::{Map, Cloned, FusedIterator, TrustedLen, TrustedRandomAccess, Filter}; use slice::{self, SliceIndex, Split as SliceSplit}; use mem; @@ -30,8 +19,7 @@ pub mod pattern; #[allow(missing_docs)] pub mod lossy; -/// A trait to abstract the idea of creating a new instance of a type from a -/// string. +/// Parse a value from a string /// /// `FromStr`'s [`from_str`] method is often used implicitly, through /// [`str`]'s [`parse`] method. See [`parse`]'s documentation for examples. @@ -40,6 +28,11 @@ pub mod lossy; /// [`str`]: ../../std/primitive.str.html /// [`parse`]: ../../std/primitive.str.html#method.parse /// +/// `FromStr` does not have a lifetime parameter, and so you can only parse types +/// that do not contain a lifetime parameter themselves. In other words, you can +/// parse an `i32` with `FromStr`, but not a `&i32`. You can parse a struct that +/// contains an `i32`, but not one that contains an `&i32`. +/// /// # Examples /// /// Basic implementation of `FromStr` on an example `Point` type: @@ -482,7 +475,7 @@ fn utf8_first_byte(byte: u8, width: u32) -> u32 { (byte & (0x7F >> width)) as u3 #[inline] fn utf8_acc_cont_byte(ch: u32, byte: u8) -> u32 { (ch << 6) | (byte & CONT_MASK) as u32 } -/// Checks whether the byte is a UTF-8 continuation byte (i.e. starts with the +/// Checks whether the byte is a UTF-8 continuation byte (i.e., starts with the /// bits `10`). #[inline] fn utf8_is_cont_byte(byte: u8) -> bool { (byte & !CONT_MASK) == TAG_CONT_U8 } @@ -536,10 +529,9 @@ fn next_code_point_reverse<'a, I>(bytes: &mut I) -> Option where I: DoubleEndedIterator, { // Decode UTF-8 - let w = match bytes.next_back() { - None => return None, - Some(&next_byte) if next_byte < 128 => return Some(next_byte as u32), - Some(&back_byte) => back_byte, + let w = match *bytes.next_back()? { + next_byte if next_byte < 128 => return Some(next_byte as u32), + back_byte => back_byte, }; // Multibyte case follows @@ -1424,10 +1416,8 @@ fn contains_nonascii(x: usize) -> bool { (x & NONASCII_MASK) != 0 } -/// Walks through `iter` checking that it's a valid UTF-8 sequence, -/// returning `true` in that case, or, if it is invalid, `false` with -/// `iter` reset such that it is pointing at the first byte in the -/// invalid sequence. +/// Walks through `v` checking that it's a valid UTF-8 sequence, +/// returning `Ok(())` in that case, or, if it is invalid, `Err(err)`. #[inline] fn run_utf8_validation(v: &[u8]) -> Result<(), Utf8Error> { let mut index = 0; @@ -1630,190 +1620,26 @@ mod traits { } } - /// Implements substring slicing with syntax `&self[begin .. end]`. - /// - /// Returns a slice of the given string from the byte range - /// [`begin`..`end`). - /// - /// This operation is `O(1)`. - /// - /// # Panics - /// - /// Panics if `begin` or `end` does not point to the starting - /// byte offset of a character (as defined by `is_char_boundary`). - /// Requires that `begin <= end` and `end <= len` where `len` is the - /// length of the string. - /// - /// # Examples - /// - /// ``` - /// let s = "Löwe 老虎 Léopard"; - /// assert_eq!(&s[0 .. 1], "L"); - /// - /// assert_eq!(&s[1 .. 9], "öwe 老"); - /// - /// // these will panic: - /// // byte 2 lies within `ö`: - /// // &s[2 ..3]; - /// - /// // byte 8 lies within `老` - /// // &s[1 .. 8]; - /// - /// // byte 100 is outside the string - /// // &s[3 .. 100]; - /// ``` - #[stable(feature = "rust1", since = "1.0.0")] - impl ops::Index> for str { - type Output = str; - #[inline] - fn index(&self, index: ops::Range) -> &str { - index.index(self) - } - } - - /// Implements mutable substring slicing with syntax - /// `&mut self[begin .. end]`. - /// - /// Returns a mutable slice of the given string from the byte range - /// [`begin`..`end`). - /// - /// This operation is `O(1)`. - /// - /// # Panics - /// - /// Panics if `begin` or `end` does not point to the starting - /// byte offset of a character (as defined by `is_char_boundary`). - /// Requires that `begin <= end` and `end <= len` where `len` is the - /// length of the string. - #[stable(feature = "derefmut_for_string", since = "1.3.0")] - impl ops::IndexMut> for str { - #[inline] - fn index_mut(&mut self, index: ops::Range) -> &mut str { - index.index_mut(self) - } - } - - /// Implements substring slicing with syntax `&self[.. end]`. - /// - /// Returns a slice of the string from the beginning to byte offset - /// `end`. - /// - /// Equivalent to `&self[0 .. end]`. - #[stable(feature = "rust1", since = "1.0.0")] - impl ops::Index> for str { - type Output = str; - - #[inline] - fn index(&self, index: ops::RangeTo) -> &str { - index.index(self) - } - } - - /// Implements mutable substring slicing with syntax `&mut self[.. end]`. - /// - /// Returns a mutable slice of the string from the beginning to byte offset - /// `end`. - /// - /// Equivalent to `&mut self[0 .. end]`. - #[stable(feature = "derefmut_for_string", since = "1.3.0")] - impl ops::IndexMut> for str { - #[inline] - fn index_mut(&mut self, index: ops::RangeTo) -> &mut str { - index.index_mut(self) - } - } - - /// Implements substring slicing with syntax `&self[begin ..]`. - /// - /// Returns a slice of the string from byte offset `begin` - /// to the end of the string. - /// - /// Equivalent to `&self[begin .. len]`. #[stable(feature = "rust1", since = "1.0.0")] - impl ops::Index> for str { - type Output = str; + impl ops::Index for str + where + I: SliceIndex, + { + type Output = I::Output; #[inline] - fn index(&self, index: ops::RangeFrom) -> &str { + fn index(&self, index: I) -> &I::Output { index.index(self) } } - /// Implements mutable substring slicing with syntax `&mut self[begin ..]`. - /// - /// Returns a mutable slice of the string from byte offset `begin` - /// to the end of the string. - /// - /// Equivalent to `&mut self[begin .. len]`. - #[stable(feature = "derefmut_for_string", since = "1.3.0")] - impl ops::IndexMut> for str { - #[inline] - fn index_mut(&mut self, index: ops::RangeFrom) -> &mut str { - index.index_mut(self) - } - } - - /// Implements substring slicing with syntax `&self[..]`. - /// - /// Returns a slice of the whole string. This operation can - /// never panic. - /// - /// Equivalent to `&self[0 .. len]`. #[stable(feature = "rust1", since = "1.0.0")] - impl ops::Index for str { - type Output = str; - - #[inline] - fn index(&self, _index: ops::RangeFull) -> &str { - self - } - } - - /// Implements mutable substring slicing with syntax `&mut self[..]`. - /// - /// Returns a mutable slice of the whole string. This operation can - /// never panic. - /// - /// Equivalent to `&mut self[0 .. len]`. - #[stable(feature = "derefmut_for_string", since = "1.3.0")] - impl ops::IndexMut for str { - #[inline] - fn index_mut(&mut self, _index: ops::RangeFull) -> &mut str { - self - } - } - - #[stable(feature = "inclusive_range", since = "1.26.0")] - impl ops::Index> for str { - type Output = str; - - #[inline] - fn index(&self, index: ops::RangeInclusive) -> &str { - index.index(self) - } - } - - #[stable(feature = "inclusive_range", since = "1.26.0")] - impl ops::Index> for str { - type Output = str; - - #[inline] - fn index(&self, index: ops::RangeToInclusive) -> &str { - index.index(self) - } - } - - #[stable(feature = "inclusive_range", since = "1.26.0")] - impl ops::IndexMut> for str { - #[inline] - fn index_mut(&mut self, index: ops::RangeInclusive) -> &mut str { - index.index_mut(self) - } - } - #[stable(feature = "inclusive_range", since = "1.26.0")] - impl ops::IndexMut> for str { + impl ops::IndexMut for str + where + I: SliceIndex, + { #[inline] - fn index_mut(&mut self, index: ops::RangeToInclusive) -> &mut str { + fn index_mut(&mut self, index: I) -> &mut I::Output { index.index_mut(self) } } @@ -1824,6 +1650,18 @@ mod traits { panic!("attempted to index str up to maximum usize"); } + /// Implements substring slicing with syntax `&self[..]` or `&mut self[..]`. + /// + /// Returns a slice of the whole string, i.e., returns `&self` or `&mut + /// self`. Equivalent to `&self[0 .. len]` or `&mut self[0 .. len]`. Unlike + /// other indexing operations, this can never panic. + /// + /// This operation is `O(1)`. + /// + /// Prior to 1.20.0, these indexing operations were still supported by + /// direct implementation of `Index` and `IndexMut`. + /// + /// Equivalent to `&self[0 .. len]` or `&mut self[0 .. len]`. #[stable(feature = "str_checked_slicing", since = "1.20.0")] impl SliceIndex for ops::RangeFull { type Output = str; @@ -1853,6 +1691,41 @@ mod traits { } } + /// Implements substring slicing with syntax `&self[begin .. end]` or `&mut + /// self[begin .. end]`. + /// + /// Returns a slice of the given string from the byte range + /// [`begin`, `end`). + /// + /// This operation is `O(1)`. + /// + /// Prior to 1.20.0, these indexing operations were still supported by + /// direct implementation of `Index` and `IndexMut`. + /// + /// # Panics + /// + /// Panics if `begin` or `end` does not point to the starting byte offset of + /// a character (as defined by `is_char_boundary`), if `begin > end`, or if + /// `end > len`. + /// + /// # Examples + /// + /// ``` + /// let s = "Löwe 老虎 Léopard"; + /// assert_eq!(&s[0 .. 1], "L"); + /// + /// assert_eq!(&s[1 .. 9], "öwe 老"); + /// + /// // these will panic: + /// // byte 2 lies within `ö`: + /// // &s[2 ..3]; + /// + /// // byte 8 lies within `老` + /// // &s[1 .. 8]; + /// + /// // byte 100 is outside the string + /// // &s[3 .. 100]; + /// ``` #[stable(feature = "str_checked_slicing", since = "1.20.0")] impl SliceIndex for ops::Range { type Output = str; @@ -1907,6 +1780,21 @@ mod traits { } } + /// Implements substring slicing with syntax `&self[.. end]` or `&mut + /// self[.. end]`. + /// + /// Returns a slice of the given string from the byte range [`0`, `end`). + /// Equivalent to `&self[0 .. end]` or `&mut self[0 .. end]`. + /// + /// This operation is `O(1)`. + /// + /// Prior to 1.20.0, these indexing operations were still supported by + /// direct implementation of `Index` and `IndexMut`. + /// + /// # Panics + /// + /// Panics if `end` does not point to the starting byte offset of a + /// character (as defined by `is_char_boundary`), or if `end > len`. #[stable(feature = "str_checked_slicing", since = "1.20.0")] impl SliceIndex for ops::RangeTo { type Output = str; @@ -1952,6 +1840,22 @@ mod traits { } } + /// Implements substring slicing with syntax `&self[begin ..]` or `&mut + /// self[begin ..]`. + /// + /// Returns a slice of the given string from the byte range [`begin`, + /// `len`). Equivalent to `&self[begin .. len]` or `&mut self[begin .. + /// len]`. + /// + /// This operation is `O(1)`. + /// + /// Prior to 1.20.0, these indexing operations were still supported by + /// direct implementation of `Index` and `IndexMut`. + /// + /// # Panics + /// + /// Panics if `begin` does not point to the starting byte offset of + /// a character (as defined by `is_char_boundary`), or if `begin >= len`. #[stable(feature = "str_checked_slicing", since = "1.20.0")] impl SliceIndex for ops::RangeFrom { type Output = str; @@ -1999,6 +1903,22 @@ mod traits { } } + /// Implements substring slicing with syntax `&self[begin ..= end]` or `&mut + /// self[begin ..= end]`. + /// + /// Returns a slice of the given string from the byte range + /// [`begin`, `end`]. Equivalent to `&self [begin .. end + 1]` or `&mut + /// self[begin .. end + 1]`, except if `end` has the maximum value for + /// `usize`. + /// + /// This operation is `O(1)`. + /// + /// # Panics + /// + /// Panics if `begin` does not point to the starting byte offset of + /// a character (as defined by `is_char_boundary`), if `end` does not point + /// to the ending byte offset of a character (`end + 1` is either a starting + /// byte offset or equal to `len`), if `begin > end`, or if `end >= len`. #[stable(feature = "inclusive_range", since = "1.26.0")] impl SliceIndex for ops::RangeInclusive { type Output = str; @@ -2032,8 +1952,20 @@ mod traits { } } - - + /// Implements substring slicing with syntax `&self[..= end]` or `&mut + /// self[..= end]`. + /// + /// Returns a slice of the given string from the byte range [0, `end`]. + /// Equivalent to `&self [0 .. end + 1]`, except if `end` has the maximum + /// value for `usize`. + /// + /// This operation is `O(1)`. + /// + /// # Panics + /// + /// Panics if `end` does not point to the ending byte offset of a character + /// (`end + 1` is either a starting byte offset as defined by + /// `is_char_boundary`, or equal to `len`), or if `end >= len`. #[stable(feature = "inclusive_range", since = "1.26.0")] impl SliceIndex for ops::RangeToInclusive { type Output = str; @@ -3557,6 +3489,8 @@ impl str { /// /// assert_eq!("Hello\tworld", s.trim()); /// ``` + #[must_use = "this returns the trimmed string as a slice, \ + without modifying the original"] #[stable(feature = "rust1", since = "1.0.0")] pub fn trim(&self) -> &str { self.trim_matches(|c: char| c.is_whitespace()) @@ -3592,6 +3526,8 @@ impl str { /// let s = " עברית "; /// assert!(Some('ע') == s.trim_start().chars().next()); /// ``` + #[must_use = "this returns the trimmed string as a new slice, \ + without modifying the original"] #[stable(feature = "trim_direction", since = "1.30.0")] pub fn trim_start(&self) -> &str { self.trim_start_matches(|c: char| c.is_whitespace()) @@ -3627,6 +3563,8 @@ impl str { /// let s = " עברית "; /// assert!(Some('ת') == s.trim_end().chars().rev().next()); /// ``` + #[must_use = "this returns the trimmed string as a new slice, \ + without modifying the original"] #[stable(feature = "trim_direction", since = "1.30.0")] pub fn trim_end(&self) -> &str { self.trim_end_matches(|c: char| c.is_whitespace()) @@ -3729,6 +3667,8 @@ impl str { /// ``` /// assert_eq!("1foo1barXX".trim_matches(|c| c == '1' || c == 'X'), "foo1bar"); /// ``` + #[must_use = "this returns the trimmed string as a new slice, \ + without modifying the original"] #[stable(feature = "rust1", since = "1.0.0")] pub fn trim_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str where P::Searcher: DoubleEndedSearcher<'a> @@ -3774,6 +3714,8 @@ impl str { /// let x: &[_] = &['1', '2']; /// assert_eq!("12foo1bar12".trim_start_matches(x), "foo1bar12"); /// ``` + #[must_use = "this returns the trimmed string as a new slice, \ + without modifying the original"] #[stable(feature = "trim_direction", since = "1.30.0")] pub fn trim_start_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str { let mut i = self.len(); @@ -3817,6 +3759,8 @@ impl str { /// ``` /// assert_eq!("1fooX".trim_end_matches(|c| c == '1' || c == 'X'), "1foo"); /// ``` + #[must_use = "this returns the trimmed string as a new slice, \ + without modifying the original"] #[stable(feature = "trim_direction", since = "1.30.0")] pub fn trim_end_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str where P::Searcher: ReverseSearcher<'a> @@ -3842,10 +3786,10 @@ impl str { /// /// # Text directionality /// - /// A string is a sequence of bytes. 'Left' in this context means the first - /// position of that byte string; for a language like Arabic or Hebrew - /// which are 'right to left' rather than 'left to right', this will be - /// the _right_ side, not the left. + /// A string is a sequence of bytes. `start` in this context means the first + /// position of that byte string; for a left-to-right language like English or + /// Russian, this will be left side; and for right-to-left languages like + /// like Arabic or Hebrew, this will be the right side. /// /// # Examples /// @@ -3874,10 +3818,10 @@ impl str { /// /// # Text directionality /// - /// A string is a sequence of bytes. 'Right' in this context means the last - /// position of that byte string; for a language like Arabic or Hebrew - /// which are 'right to left' rather than 'left to right', this will be - /// the _left_ side, not the right. + /// A string is a sequence of bytes. `end` in this context means the last + /// position of that byte string; for a left-to-right language like English or + /// Russian, this will be right side; and for right-to-left languages like + /// like Arabic or Hebrew, this will be the left side. /// /// # Examples /// diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index 1c974533e10..55a7ba181e5 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The string Pattern API. //! //! For more details, see the traits `Pattern`, `Searcher`, @@ -397,7 +387,7 @@ unsafe impl<'a> ReverseSearcher<'a> for CharSearcher<'a> { let found_char = index - shift; if let Some(slice) = haystack.get(found_char..(found_char + self.utf8_size)) { if slice == &self.utf8_encoded[0..self.utf8_size] { - // move finger to before the character found (i.e. at its start index) + // move finger to before the character found (i.e., at its start index) self.finger_back = found_char; return Some((self.finger_back, self.finger_back + self.utf8_size)); } @@ -435,8 +425,7 @@ impl<'a> Pattern<'a> for char { #[inline] fn into_searcher(self, haystack: &'a str) -> Self::Searcher { let mut utf8_encoded = [0; 4]; - self.encode_utf8(&mut utf8_encoded); - let utf8_size = self.len_utf8(); + let utf8_size = self.encode_utf8(&mut utf8_encoded).len(); CharSearcher { haystack, finger: 0, @@ -1016,7 +1005,7 @@ struct TwoWaySearcher { It can be proven that the following is an equivalent definition of a local period for a factorization (u, v): any positive integer r such that x[i] == x[i+r] for all i such that |u| - r <= i <= |u| - 1 and such that both x[i] and x[i+r] are - defined. (i.e. i > 0 and i + r < |x|). + defined. (i.e., i > 0 and i + r < |x|). Using the above reformulation, it is easy to prove that diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 56d3b429fdb..8c5dde7dc27 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Atomic types //! //! Atomic types provide primitive shared-memory communication between @@ -15,13 +5,16 @@ //! types. //! //! This module defines atomic versions of a select number of primitive -//! types, including [`AtomicBool`], [`AtomicIsize`], and [`AtomicUsize`]. +//! types, including [`AtomicBool`], [`AtomicIsize`], [`AtomicUsize`], +//! [`AtomicI8`], [`AtomicU16`], etc. //! Atomic types present operations that, when used correctly, synchronize //! updates between threads. //! //! [`AtomicBool`]: struct.AtomicBool.html //! [`AtomicIsize`]: struct.AtomicIsize.html //! [`AtomicUsize`]: struct.AtomicUsize.html +//! [`AtomicI8`]: struct.AtomicI8.html +//! [`AtomicU16`]: struct.AtomicU16.html //! //! Each method takes an [`Ordering`] which represents the strength of //! the memory barrier for that operation. These orderings are the @@ -41,11 +34,46 @@ //! [`Sync`]: ../../marker/trait.Sync.html //! [arc]: ../../../std/sync/struct.Arc.html //! -//! Most atomic types may be stored in static variables, initialized using -//! the provided static initializers like [`ATOMIC_BOOL_INIT`]. Atomic statics +//! Atomic types may be stored in static variables, initialized using +//! the constant initializers like [`AtomicBool::new`]. Atomic statics //! are often used for lazy global initialization. //! -//! [`ATOMIC_BOOL_INIT`]: constant.ATOMIC_BOOL_INIT.html +//! [`AtomicBool::new`]: struct.AtomicBool.html#method.new +//! +//! # Portability +//! +//! All atomic types in this module are guaranteed to be [lock-free] if they're +//! available. This means they don't internally acquire a global mutex. Atomic +//! types and operations are not guaranteed to be wait-free. This means that +//! operations like `fetch_or` may be implemented with a compare-and-swap loop. +//! +//! Atomic operations may be implemented at the instruction layer with +//! larger-size atomics. For example some platforms use 4-byte atomic +//! instructions to implement `AtomicI8`. Note that this emulation should not +//! have an impact on correctness of code, it's just something to be aware of. +//! +//! The atomic types in this module may not be available on all platforms. The +//! atomic types here are all widely available, however, and can generally be +//! relied upon existing. Some notable exceptions are: +//! +//! * PowerPC and MIPS platforms with 32-bit pointers do not have `AtomicU64` or +//! `AtomicI64` types. +//! * ARM platforms like `armv5te` that aren't for Linux do not have any atomics +//! at all. +//! * ARM targets with `thumbv6m` do not have atomic operations at all. +//! +//! Note that future platforms may be added that also do not have support for +//! some atomic operations. Maximally portable code will want to be careful +//! about which atomic types are used. `AtomicUsize` and `AtomicIsize` are +//! generally the most portable, but even then they're not available everywhere. +//! For reference, the `std` library requires pointer-sized atomics, although +//! `core` does not. +//! +//! Currently you'll need to use `#[cfg(target_arch)]` primarily to +//! conditionally compile in code with atomics. There is an unstable +//! `#[cfg(target_has_atomic)]` as well which may be stabilized in the future. +//! +//! [lock-free]: https://en.wikipedia.org/wiki/Non-blocking_algorithm //! //! # Examples //! @@ -76,9 +104,9 @@ //! Keep a global count of live threads: //! //! ``` -//! use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +//! use std::sync::atomic::{AtomicUsize, Ordering}; //! -//! static GLOBAL_THREAD_COUNT: AtomicUsize = ATOMIC_USIZE_INIT; +//! static GLOBAL_THREAD_COUNT: AtomicUsize = AtomicUsize::new(0); //! //! let old_thread_count = GLOBAL_THREAD_COUNT.fetch_add(1, Ordering::SeqCst); //! println!("live threads: {}", old_thread_count + 1); @@ -94,6 +122,8 @@ use intrinsics; use cell::UnsafeCell; use fmt; +use hint::spin_loop; + /// Save power or switch hyperthreads in a busy-wait spin-loop. /// /// This function is deliberately more primitive than @@ -106,15 +136,7 @@ use fmt; #[inline] #[stable(feature = "spin_loop_hint", since = "1.24.0")] pub fn spin_loop_hint() { - #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] - unsafe { - asm!("pause" ::: "memory" : "volatile"); - } - - #[cfg(target_arch = "aarch64")] - unsafe { - asm!("yield" ::: "memory" : "volatile"); - } + spin_loop() } /// A boolean type which can be safely shared between threads. @@ -173,11 +195,11 @@ unsafe impl Sync for AtomicPtr {} /// Atomic memory orderings /// -/// Memory orderings limit the ways that both the compiler and CPU may reorder -/// instructions around atomic operations. At its most restrictive, -/// "sequentially consistent" atomics allow neither reads nor writes -/// to be moved either before or after the atomic operation; on the other end -/// "relaxed" atomics allow all reorderings. +/// Memory orderings specify the way atomic operations synchronize memory. +/// In its weakest [`Relaxed`][Ordering::Relaxed], only the memory directly touched by the +/// operation is synchronized. On the other hand, a store-load pair of [`SeqCst`][Ordering::SeqCst] +/// operations synchronize other memory while additionally preserving a total order of such +/// operations across all threads. /// /// Rust's memory orderings are [the same as /// LLVM's](https://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations). @@ -185,8 +207,10 @@ unsafe impl Sync for AtomicPtr {} /// For more information see the [nomicon]. /// /// [nomicon]: ../../../nomicon/atomics.html +/// [Ordering::Relaxed]: #variant.Relaxed +/// [Ordering::SeqCst]: #variant.SeqCst #[stable(feature = "rust1", since = "1.0.0")] -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] #[non_exhaustive] pub enum Ordering { /// No ordering constraints, only atomic operations. @@ -234,8 +258,8 @@ pub enum Ordering { /// For loads it uses [`Acquire`] ordering. For stores it uses the [`Release`] ordering. /// /// Notice that in the case of `compare_and_swap`, it is possible that the operation ends up - /// not performing any store and hence it has just `Acquire` ordering. However, - /// `AcqRel` will never perform [`Relaxed`] accesses. + /// not performing any store and hence it has just [`Acquire`] ordering. However, + /// [`AcqRel`][`AcquireRelease`] will never perform [`Relaxed`] accesses. /// /// This ordering is only applicable for operations that combine both loads and stores. /// @@ -266,6 +290,15 @@ pub enum Ordering { /// [`AtomicBool`]: struct.AtomicBool.html #[cfg(target_has_atomic = "8")] #[stable(feature = "rust1", since = "1.0.0")] +#[cfg_attr(not(stage0), rustc_deprecated( + since = "1.34.0", + reason = "the `new` function is now preferred", + suggestion = "AtomicBool::new(false)", +))] +#[cfg_attr(stage0, rustc_deprecated( + since = "1.34.0", + reason = "the `new` function is now preferred", +))] pub const ATOMIC_BOOL_INIT: AtomicBool = AtomicBool::new(false); #[cfg(target_has_atomic = "8")] @@ -1070,6 +1103,15 @@ impl AtomicPtr { #[cfg(target_has_atomic = "8")] #[stable(feature = "atomic_bool_from", since = "1.24.0")] impl From for AtomicBool { + /// Converts a `bool` into an `AtomicBool`. + /// + /// # Examples + /// + /// ``` + /// use std::sync::atomic::AtomicBool; + /// let atomic_bool = AtomicBool::from(true); + /// assert_eq!(format!("{:?}", atomic_bool), "true") + /// ``` #[inline] fn from(b: bool) -> Self { Self::new(b) } } @@ -1093,6 +1135,7 @@ macro_rules! atomic_int { $extra_feature:expr, $min_fn:ident, $max_fn:ident, $align:expr, + $atomic_new:expr, $int_type:ident $atomic_type:ident $atomic_init:ident) => { /// An integer type which can be safely shared between threads. /// @@ -1102,7 +1145,8 @@ macro_rules! atomic_int { /// `]( #[doc = $int_ref] /// ). For more about the differences between atomic types and - /// non-atomic types, please see the [module-level documentation]. + /// non-atomic types as well as information about the portability of + /// this type, please see the [module-level documentation]. /// /// [module-level documentation]: index.html #[$stable] @@ -1113,6 +1157,15 @@ macro_rules! atomic_int { /// An atomic integer initialized to `0`. #[$stable] + #[cfg_attr(stage0, rustc_deprecated( + since = "1.34.0", + reason = "the `new` function is now preferred", + ))] + #[cfg_attr(not(stage0), rustc_deprecated( + since = "1.34.0", + reason = "the `new` function is now preferred", + suggestion = $atomic_new, + ))] pub const $atomic_init: $atomic_type = $atomic_type::new(0); #[$stable] @@ -1124,8 +1177,12 @@ macro_rules! atomic_int { #[$stable_from] impl From<$int_type> for $atomic_type { - #[inline] - fn from(v: $int_type) -> Self { Self::new(v) } + doc_comment! { + concat!( +"Converts an `", stringify!($int_type), "` into an `", stringify!($atomic_type), "`."), + #[inline] + fn from(v: $int_type) -> Self { Self::new(v) } + } } #[$stable_debug] @@ -1828,117 +1885,125 @@ assert_eq!(min_foo, 12); #[cfg(target_has_atomic = "8")] atomic_int! { - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), "i8", "../../../std/primitive.i8.html", "#![feature(integer_atomics)]\n\n", atomic_min, atomic_max, 1, + "AtomicI8::new(0)", i8 AtomicI8 ATOMIC_I8_INIT } #[cfg(target_has_atomic = "8")] atomic_int! { - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), "u8", "../../../std/primitive.u8.html", "#![feature(integer_atomics)]\n\n", atomic_umin, atomic_umax, 1, + "AtomicU8::new(0)", u8 AtomicU8 ATOMIC_U8_INIT } #[cfg(target_has_atomic = "16")] atomic_int! { - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), "i16", "../../../std/primitive.i16.html", "#![feature(integer_atomics)]\n\n", atomic_min, atomic_max, 2, + "AtomicI16::new(0)", i16 AtomicI16 ATOMIC_I16_INIT } #[cfg(target_has_atomic = "16")] atomic_int! { - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), "u16", "../../../std/primitive.u16.html", "#![feature(integer_atomics)]\n\n", atomic_umin, atomic_umax, 2, + "AtomicU16::new(0)", u16 AtomicU16 ATOMIC_U16_INIT } #[cfg(target_has_atomic = "32")] atomic_int! { - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), "i32", "../../../std/primitive.i32.html", "#![feature(integer_atomics)]\n\n", atomic_min, atomic_max, 4, + "AtomicI32::new(0)", i32 AtomicI32 ATOMIC_I32_INIT } #[cfg(target_has_atomic = "32")] atomic_int! { - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), "u32", "../../../std/primitive.u32.html", "#![feature(integer_atomics)]\n\n", atomic_umin, atomic_umax, 4, + "AtomicU32::new(0)", u32 AtomicU32 ATOMIC_U32_INIT } #[cfg(target_has_atomic = "64")] atomic_int! { - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), "i64", "../../../std/primitive.i64.html", "#![feature(integer_atomics)]\n\n", atomic_min, atomic_max, 8, + "AtomicI64::new(0)", i64 AtomicI64 ATOMIC_I64_INIT } #[cfg(target_has_atomic = "64")] atomic_int! { - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), - unstable(feature = "integer_atomics", issue = "32976"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), + stable(feature = "integer_atomics_stable", since = "1.34.0"), "u64", "../../../std/primitive.u64.html", "#![feature(integer_atomics)]\n\n", atomic_umin, atomic_umax, 8, + "AtomicU64::new(0)", u64 AtomicU64 ATOMIC_U64_INIT } -#[cfg(all(not(stage0), target_has_atomic = "128"))] +#[cfg(target_has_atomic = "128")] atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), @@ -1950,9 +2015,10 @@ atomic_int! { "#![feature(integer_atomics)]\n\n", atomic_min, atomic_max, 16, + "AtomicI128::new(0)", i128 AtomicI128 ATOMIC_I128_INIT } -#[cfg(all(not(stage0), target_has_atomic = "128"))] +#[cfg(target_has_atomic = "128")] atomic_int! { unstable(feature = "integer_atomics", issue = "32976"), unstable(feature = "integer_atomics", issue = "32976"), @@ -1964,6 +2030,7 @@ atomic_int! { "#![feature(integer_atomics)]\n\n", atomic_umin, atomic_umax, 16, + "AtomicU128::new(0)", u128 AtomicU128 ATOMIC_U128_INIT } #[cfg(target_pointer_width = "16")] @@ -1990,6 +2057,7 @@ atomic_int!{ "", atomic_min, atomic_max, ptr_width!(), + "AtomicIsize::new(0)", isize AtomicIsize ATOMIC_ISIZE_INIT } #[cfg(target_has_atomic = "ptr")] @@ -2004,6 +2072,7 @@ atomic_int!{ "", atomic_umin, atomic_umax, ptr_width!(), + "AtomicUsize::new(0)", usize AtomicUsize ATOMIC_USIZE_INIT } @@ -2373,12 +2442,11 @@ pub fn fence(order: Ordering) { /// /// ``` /// use std::sync::atomic::{AtomicBool, AtomicUsize}; -/// use std::sync::atomic::{ATOMIC_BOOL_INIT, ATOMIC_USIZE_INIT}; /// use std::sync::atomic::Ordering; /// use std::sync::atomic::compiler_fence; /// -/// static IMPORTANT_VARIABLE: AtomicUsize = ATOMIC_USIZE_INIT; -/// static IS_READY: AtomicBool = ATOMIC_BOOL_INIT; +/// static IMPORTANT_VARIABLE: AtomicUsize = AtomicUsize::new(0); +/// static IS_READY: AtomicBool = AtomicBool::new(false); /// /// fn main() { /// IMPORTANT_VARIABLE.store(42, Ordering::Relaxed); diff --git a/src/libcore/sync/mod.rs b/src/libcore/sync/mod.rs index 0080e0b5e43..b635bae0a47 100644 --- a/src/libcore/sync/mod.rs +++ b/src/libcore/sync/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Synchronization primitives #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index 95c9cca292f..9552e53ebf8 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(feature = "futures_api", reason = "futures in libcore are unstable", issue = "50547")] diff --git a/src/libcore/task/poll.rs b/src/libcore/task/poll.rs index fb027efc6dc..27b1139e15c 100644 --- a/src/libcore/task/poll.rs +++ b/src/libcore/task/poll.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(feature = "futures_api", reason = "futures in libcore are unstable", issue = "50547")] diff --git a/src/libcore/task/wake.rs b/src/libcore/task/wake.rs index c0ce7255d62..3f7098f1ef9 100644 --- a/src/libcore/task/wake.rs +++ b/src/libcore/task/wake.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(feature = "futures_api", reason = "futures in libcore are unstable", issue = "50547")] @@ -227,7 +217,7 @@ pub unsafe trait UnsafeWake: Send + Sync { /// # Unsafety /// /// This function is unsafe to call because it's asserting the `UnsafeWake` - /// value is in a consistent state, i.e. hasn't been dropped. + /// value is in a consistent state, i.e., hasn't been dropped. unsafe fn clone_raw(&self) -> Waker; /// Drops this instance of `UnsafeWake`, deallocating resources @@ -249,7 +239,7 @@ pub unsafe trait UnsafeWake: Send + Sync { /// # Unsafety /// /// This function is unsafe to call because it's asserting the `UnsafeWake` - /// value is in a consistent state, i.e. hasn't been dropped. + /// value is in a consistent state, i.e., hasn't been dropped. unsafe fn drop_raw(&self); /// Indicates that the associated task is ready to make progress and should @@ -266,7 +256,7 @@ pub unsafe trait UnsafeWake: Send + Sync { /// # Unsafety /// /// This function is unsafe to call because it's asserting the `UnsafeWake` - /// value is in a consistent state, i.e. hasn't been dropped. + /// value is in a consistent state, i.e., hasn't been dropped. unsafe fn wake(&self); /// Indicates that the associated task is ready to make progress and should @@ -286,7 +276,7 @@ pub unsafe trait UnsafeWake: Send + Sync { /// # Unsafety /// /// This function is unsafe to call because it's asserting the `UnsafeWake` - /// value is in a consistent state, i.e. hasn't been dropped, and that the + /// value is in a consistent state, i.e., hasn't been dropped, and that the /// `UnsafeWake` hasn't moved from the thread on which it was created. unsafe fn wake_local(&self) { self.wake() diff --git a/src/libcore/tests/any.rs b/src/libcore/tests/any.rs index a80bf939530..62bebcb03c9 100644 --- a/src/libcore/tests/any.rs +++ b/src/libcore/tests/any.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::any::*; #[derive(PartialEq, Debug)] diff --git a/src/libcore/tests/array.rs b/src/libcore/tests/array.rs index 6278d5e23e0..9e133ac5688 100644 --- a/src/libcore/tests/array.rs +++ b/src/libcore/tests/array.rs @@ -1,12 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. use core::array::FixedSizeArray; use core::convert::TryFrom; diff --git a/src/libcore/tests/ascii.rs b/src/libcore/tests/ascii.rs index 950222dbcfa..ec98e0464c9 100644 --- a/src/libcore/tests/ascii.rs +++ b/src/libcore/tests/ascii.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::char::from_u32; #[test] diff --git a/src/libcore/tests/atomic.rs b/src/libcore/tests/atomic.rs index a3667b3f3fe..05fe8460f32 100644 --- a/src/libcore/tests/atomic.rs +++ b/src/libcore/tests/atomic.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::sync::atomic::*; use core::sync::atomic::Ordering::SeqCst; diff --git a/src/libcore/tests/cell.rs b/src/libcore/tests/cell.rs index 4b7243b9cfc..56f295dff8e 100644 --- a/src/libcore/tests/cell.rs +++ b/src/libcore/tests/cell.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::cell::*; use core::default::Default; use std::mem::drop; diff --git a/src/libcore/tests/char.rs b/src/libcore/tests/char.rs index 3d99c8ea9e2..61856242c57 100644 --- a/src/libcore/tests/char.rs +++ b/src/libcore/tests/char.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::{char,str}; use std::convert::TryFrom; use std::str::FromStr; diff --git a/src/libcore/tests/clone.rs b/src/libcore/tests/clone.rs index 91d68ba3344..c97a87aebce 100644 --- a/src/libcore/tests/clone.rs +++ b/src/libcore/tests/clone.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[test] fn test_borrowed_clone() { let x = 5; diff --git a/src/libcore/tests/cmp.rs b/src/libcore/tests/cmp.rs index 8c5179f5993..4e624e5eb12 100644 --- a/src/libcore/tests/cmp.rs +++ b/src/libcore/tests/cmp.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::cmp::Ordering::{Less, Greater, Equal}; #[test] diff --git a/src/libcore/tests/fmt/builders.rs b/src/libcore/tests/fmt/builders.rs index b7233658e93..fd7192cc151 100644 --- a/src/libcore/tests/fmt/builders.rs +++ b/src/libcore/tests/fmt/builders.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod debug_struct { use std::fmt; diff --git a/src/libcore/tests/fmt/float.rs b/src/libcore/tests/fmt/float.rs index 138c3970e90..bd0daf7a8eb 100644 --- a/src/libcore/tests/fmt/float.rs +++ b/src/libcore/tests/fmt/float.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[test] fn test_format_f64() { assert_eq!("1", format!("{:.0}", 1.0f64)); diff --git a/src/libcore/tests/fmt/mod.rs b/src/libcore/tests/fmt/mod.rs index 5d204c7d523..d86e21cf40b 100644 --- a/src/libcore/tests/fmt/mod.rs +++ b/src/libcore/tests/fmt/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod builders; mod float; mod num; diff --git a/src/libcore/tests/fmt/num.rs b/src/libcore/tests/fmt/num.rs index bc205ec0582..6d9494ec289 100644 --- a/src/libcore/tests/fmt/num.rs +++ b/src/libcore/tests/fmt/num.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[test] fn test_format_int() { // Formatting integers should select the right implementation based off diff --git a/src/libcore/tests/hash/mod.rs b/src/libcore/tests/hash/mod.rs index 85c9d41b65b..135f4dfcac7 100644 --- a/src/libcore/tests/hash/mod.rs +++ b/src/libcore/tests/hash/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod sip; use std::hash::{Hash, Hasher}; diff --git a/src/libcore/tests/hash/sip.rs b/src/libcore/tests/hash/sip.rs index bad858011e9..b615cfd77ef 100644 --- a/src/libcore/tests/hash/sip.rs +++ b/src/libcore/tests/hash/sip.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(deprecated)] use core::hash::{Hash, Hasher}; diff --git a/src/libcore/tests/intrinsics.rs b/src/libcore/tests/intrinsics.rs index 9f3cba26a62..7544c13dee4 100644 --- a/src/libcore/tests/intrinsics.rs +++ b/src/libcore/tests/intrinsics.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::any::TypeId; #[test] diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs index ec09071b3d0..0fa99745d90 100644 --- a/src/libcore/tests/iter.rs +++ b/src/libcore/tests/iter.rs @@ -1,13 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +use core::cell::Cell; use core::iter::*; use core::{i8, i16, isize}; use core::usize; @@ -1001,6 +992,10 @@ fn test_cycle() { let mut it = (0..).step_by(1).take(0).cycle(); assert_eq!(it.size_hint(), (0, Some(0))); assert_eq!(it.next(), None); + + assert_eq!(empty::().cycle().fold(0, |acc, x| acc + x), 0); + + assert_eq!(once(1).cycle().skip(1).take(4).fold(0, |acc, x| acc + x), 4); } #[test] @@ -1012,6 +1007,33 @@ fn test_iterator_nth() { assert_eq!(v.iter().nth(v.len()), None); } +#[test] +fn test_iterator_nth_back() { + let v: &[_] = &[0, 1, 2, 3, 4]; + for i in 0..v.len() { + assert_eq!(v.iter().nth_back(i).unwrap(), &v[v.len() - 1 - i]); + } + assert_eq!(v.iter().nth_back(v.len()), None); +} + +#[test] +fn test_iterator_rev_nth_back() { + let v: &[_] = &[0, 1, 2, 3, 4]; + for i in 0..v.len() { + assert_eq!(v.iter().rev().nth_back(i).unwrap(), &v[i]); + } + assert_eq!(v.iter().rev().nth_back(v.len()), None); +} + +#[test] +fn test_iterator_rev_nth() { + let v: &[_] = &[0, 1, 2, 3, 4]; + for i in 0..v.len() { + assert_eq!(v.iter().rev().nth(i).unwrap(), &v[v.len() - 1 - i]); + } + assert_eq!(v.iter().rev().nth(v.len()), None); +} + #[test] fn test_iterator_last() { let v: &[_] = &[0, 1, 2, 3, 4]; @@ -1232,6 +1254,23 @@ fn test_rev() { vec![16, 14, 12, 10, 8, 6]); } +#[test] +fn test_copied() { + let xs = [2, 4, 6, 8]; + + let mut it = xs.iter().copied(); + assert_eq!(it.len(), 4); + assert_eq!(it.next(), Some(2)); + assert_eq!(it.len(), 3); + assert_eq!(it.next(), Some(4)); + assert_eq!(it.len(), 2); + assert_eq!(it.next_back(), Some(8)); + assert_eq!(it.len(), 1); + assert_eq!(it.next_back(), Some(6)); + assert_eq!(it.len(), 0); + assert_eq!(it.next_back(), None); +} + #[test] fn test_cloned() { let xs = [2, 4, 6, 8]; @@ -1249,6 +1288,23 @@ fn test_cloned() { assert_eq!(it.next_back(), None); } +#[test] +fn test_cloned_side_effects() { + let mut count = 0; + { + let iter = [1, 2, 3] + .iter() + .map(|x| { + count += 1; + x + }) + .cloned() + .zip(&[1]); + for _ in iter {} + } + assert_eq!(count, 2); +} + #[test] fn test_double_ended_map() { let xs = [1, 2, 3, 4, 5, 6]; @@ -1759,6 +1815,17 @@ fn test_repeat_with_take_collect() { assert_eq!(v, vec![1, 2, 4, 8, 16]); } +#[test] +fn test_successors() { + let mut powers_of_10 = successors(Some(1_u16), |n| n.checked_mul(10)); + assert_eq!(powers_of_10.by_ref().collect::>(), &[1, 10, 100, 1_000, 10_000]); + assert_eq!(powers_of_10.next(), None); + + let mut empty = successors(None::, |_| unimplemented!()); + assert_eq!(empty.next(), None); + assert_eq!(empty.next(), None); +} + #[test] fn test_fuse() { let mut it = 0..3; @@ -1840,6 +1907,23 @@ fn test_once() { assert_eq!(it.next(), None); } +#[test] +fn test_once_with() { + let count = Cell::new(0); + let mut it = once_with(|| { + count.set(count.get() + 1); + 42 + }); + + assert_eq!(count.get(), 0); + assert_eq!(it.next(), Some(42)); + assert_eq!(count.get(), 1); + assert_eq!(it.next(), None); + assert_eq!(count.get(), 1); + assert_eq!(it.next(), None); + assert_eq!(count.get(), 1); +} + #[test] fn test_empty() { let mut it = empty::(); @@ -2151,3 +2235,16 @@ fn test_monad_laws_associativity() { assert_eq!((0..10).flat_map(f).flat_map(g).sum::(), (0..10).flat_map(|x| f(x).flat_map(g)).sum::()); } + +#[test] +fn test_is_sorted() { + assert!([1, 2, 2, 9].iter().is_sorted()); + assert!(![1, 3, 2].iter().is_sorted()); + assert!([0].iter().is_sorted()); + assert!(std::iter::empty::().is_sorted()); + assert!(![0.0, 1.0, std::f32::NAN].iter().is_sorted()); + assert!([-2, -1, 0, 3].iter().is_sorted()); + assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs())); + assert!(!["c", "bb", "aaa"].iter().is_sorted()); + assert!(["c", "bb", "aaa"].iter().is_sorted_by_key(|s| s.len())); +} diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 5ac89912268..3e8549f8ae3 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -1,15 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] #![feature(cell_update)] +#![feature(copied)] #![feature(core_private_bignum)] #![feature(core_private_diy_float)] #![feature(dec2flt)] @@ -19,6 +10,11 @@ #![feature(flt2dec)] #![feature(fmt_internals)] #![feature(hashmap_internals)] +#![feature(is_sorted)] +#![feature(iter_copied)] +#![feature(iter_nth_back)] +#![feature(iter_once_with)] +#![feature(iter_unfold)] #![feature(pattern)] #![feature(range_is_empty)] #![feature(raw)] diff --git a/src/libcore/tests/manually_drop.rs b/src/libcore/tests/manually_drop.rs index 82dfb8d4c0b..49a1c187ea6 100644 --- a/src/libcore/tests/manually_drop.rs +++ b/src/libcore/tests/manually_drop.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::mem::ManuallyDrop; #[test] diff --git a/src/libcore/tests/mem.rs b/src/libcore/tests/mem.rs index 714f2babbdf..f5b241959fd 100644 --- a/src/libcore/tests/mem.rs +++ b/src/libcore/tests/mem.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::mem::*; #[test] diff --git a/src/libcore/tests/nonzero.rs b/src/libcore/tests/nonzero.rs index bbb1ef76bcc..4532568ee0c 100644 --- a/src/libcore/tests/nonzero.rs +++ b/src/libcore/tests/nonzero.rs @@ -1,14 +1,4 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use core::num::NonZeroU32; +use core::num::{NonZeroU32, NonZeroI32}; use core::option::Option; use core::option::Option::{Some, None}; use std::mem::size_of; @@ -23,6 +13,7 @@ fn test_create_nonzero_instance() { #[test] fn test_size_nonzero_in_option() { assert_eq!(size_of::(), size_of::>()); + assert_eq!(size_of::(), size_of::>()); } #[test] @@ -128,3 +119,10 @@ fn test_from_nonzero() { let num: u32 = nz.into(); assert_eq!(num, 1u32); } + +#[test] +fn test_from_signed_nonzero() { + let nz = NonZeroI32::new(1).unwrap(); + let num: i32 = nz.into(); + assert_eq!(num, 1i32); +} diff --git a/src/libcore/tests/num/bignum.rs b/src/libcore/tests/num/bignum.rs index 58a9dd1b128..b873f1dd065 100644 --- a/src/libcore/tests/num/bignum.rs +++ b/src/libcore/tests/num/bignum.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::prelude::v1::*; use core::num::bignum::tests::Big8x3 as Big; diff --git a/src/libcore/tests/num/dec2flt/mod.rs b/src/libcore/tests/num/dec2flt/mod.rs index 17b2f59cd4d..8f1cd32c356 100644 --- a/src/libcore/tests/num/dec2flt/mod.rs +++ b/src/libcore/tests/num/dec2flt/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(overflowing_literals)] use std::{i64, f32, f64}; @@ -17,7 +7,7 @@ mod rawfp; // Take a float literal, turn it into a string in various ways (that are all trusted // to be correct) and see if those strings are parsed back to the value of the literal. -// Requires a *polymorphic literal*, i.e. one that can serve as f64 as well as f32. +// Requires a *polymorphic literal*, i.e., one that can serve as f64 as well as f32. macro_rules! test_literal { ($x: expr) => ({ let x32: f32 = $x; diff --git a/src/libcore/tests/num/dec2flt/parse.rs b/src/libcore/tests/num/dec2flt/parse.rs index 3ad694e38ad..1eac4841191 100644 --- a/src/libcore/tests/num/dec2flt/parse.rs +++ b/src/libcore/tests/num/dec2flt/parse.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::num::dec2flt::parse::{Decimal, parse_decimal}; use core::num::dec2flt::parse::ParseResult::{Valid, Invalid}; diff --git a/src/libcore/tests/num/dec2flt/rawfp.rs b/src/libcore/tests/num/dec2flt/rawfp.rs index c9cd2bf5a9a..747c1bfa3f9 100644 --- a/src/libcore/tests/num/dec2flt/rawfp.rs +++ b/src/libcore/tests/num/dec2flt/rawfp.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::f32; use std::f64; use core::num::diy_float::Fp; diff --git a/src/libcore/tests/num/flt2dec/estimator.rs b/src/libcore/tests/num/flt2dec/estimator.rs index 857aae72c8a..fb0888e2720 100644 --- a/src/libcore/tests/num/flt2dec/estimator.rs +++ b/src/libcore/tests/num/flt2dec/estimator.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::num::flt2dec::estimator::*; #[test] diff --git a/src/libcore/tests/num/flt2dec/mod.rs b/src/libcore/tests/num/flt2dec/mod.rs index 04567e25e25..fed9ce73b2a 100644 --- a/src/libcore/tests/num/flt2dec/mod.rs +++ b/src/libcore/tests/num/flt2dec/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::prelude::v1::*; use std::{str, i16, f32, f64, fmt}; diff --git a/src/libcore/tests/num/flt2dec/random.rs b/src/libcore/tests/num/flt2dec/random.rs index ab619093d9d..1c36af6af0e 100644 --- a/src/libcore/tests/num/flt2dec/random.rs +++ b/src/libcore/tests/num/flt2dec/random.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![cfg(not(target_arch = "wasm32"))] use std::i16; @@ -18,7 +8,8 @@ use core::num::flt2dec::strategy::grisu::format_exact_opt; use core::num::flt2dec::strategy::grisu::format_shortest_opt; use core::num::flt2dec::{decode, DecodableFloat, FullDecoded, Decoded}; -use rand::{FromEntropy, XorShiftRng}; +use rand::FromEntropy; +use rand::rngs::SmallRng; use rand::distributions::{Distribution, Uniform}; pub fn decode_finite(v: T) -> Decoded { @@ -71,7 +62,10 @@ fn iterate(func: &str, k: usize, n: usize, mut f: F, mut g: G, mut v: V pub fn f32_random_equivalence_test(f: F, g: G, k: usize, n: usize) where F: FnMut(&Decoded, &mut [u8]) -> Option<(usize, i16)>, G: FnMut(&Decoded, &mut [u8]) -> (usize, i16) { - let mut rng = XorShiftRng::from_entropy(); + if cfg!(target_os = "emscripten") { + return // using rng pulls in i128 support, which doesn't work + } + let mut rng = SmallRng::from_entropy(); let f32_range = Uniform::new(0x0000_0001u32, 0x7f80_0000); iterate("f32_random_equivalence_test", k, n, f, g, |_| { let x = f32::from_bits(f32_range.sample(&mut rng)); @@ -82,7 +76,10 @@ pub fn f32_random_equivalence_test(f: F, g: G, k: usize, n: usize) pub fn f64_random_equivalence_test(f: F, g: G, k: usize, n: usize) where F: FnMut(&Decoded, &mut [u8]) -> Option<(usize, i16)>, G: FnMut(&Decoded, &mut [u8]) -> (usize, i16) { - let mut rng = XorShiftRng::from_entropy(); + if cfg!(target_os = "emscripten") { + return // using rng pulls in i128 support, which doesn't work + } + let mut rng = SmallRng::from_entropy(); let f64_range = Uniform::new(0x0000_0000_0000_0001u64, 0x7ff0_0000_0000_0000); iterate("f64_random_equivalence_test", k, n, f, g, |_| { let x = f64::from_bits(f64_range.sample(&mut rng)); @@ -99,7 +96,7 @@ pub fn f32_exhaustive_equivalence_test(f: F, g: G, k: usize) // this is of course very stressful (and thus should be behind an `#[ignore]` attribute), // but with `-C opt-level=3 -C lto` this only takes about an hour or so. - // iterate from 0x0000_0001 to 0x7f7f_ffff, i.e. all finite ranges + // iterate from 0x0000_0001 to 0x7f7f_ffff, i.e., all finite ranges let (npassed, nignored) = iterate("f32_exhaustive_equivalence_test", k, 0x7f7f_ffff, f, g, |i: usize| { diff --git a/src/libcore/tests/num/flt2dec/strategy/dragon.rs b/src/libcore/tests/num/flt2dec/strategy/dragon.rs index 03772a765cc..1803e39b46d 100644 --- a/src/libcore/tests/num/flt2dec/strategy/dragon.rs +++ b/src/libcore/tests/num/flt2dec/strategy/dragon.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::prelude::v1::*; use super::super::*; use core::num::bignum::Big32x40 as Big; diff --git a/src/libcore/tests/num/flt2dec/strategy/grisu.rs b/src/libcore/tests/num/flt2dec/strategy/grisu.rs index 286b39d8cf3..53e9f12ae0f 100644 --- a/src/libcore/tests/num/flt2dec/strategy/grisu.rs +++ b/src/libcore/tests/num/flt2dec/strategy/grisu.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::super::*; use core::num::flt2dec::strategy::grisu::*; diff --git a/src/libcore/tests/num/i16.rs b/src/libcore/tests/num/i16.rs index 7435831ac6d..f5544b914b7 100644 --- a/src/libcore/tests/num/i16.rs +++ b/src/libcore/tests/num/i16.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - int_module!(i16, i16); diff --git a/src/libcore/tests/num/i32.rs b/src/libcore/tests/num/i32.rs index 3b3407e1ada..39250ee84bc 100644 --- a/src/libcore/tests/num/i32.rs +++ b/src/libcore/tests/num/i32.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - int_module!(i32, i32); diff --git a/src/libcore/tests/num/i64.rs b/src/libcore/tests/num/i64.rs index 9e1aec256ee..fa4d2ab6638 100644 --- a/src/libcore/tests/num/i64.rs +++ b/src/libcore/tests/num/i64.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - int_module!(i64, i64); diff --git a/src/libcore/tests/num/i8.rs b/src/libcore/tests/num/i8.rs index f72244239b2..ccec6915fe0 100644 --- a/src/libcore/tests/num/i8.rs +++ b/src/libcore/tests/num/i8.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - int_module!(i8, i8); diff --git a/src/libcore/tests/num/int_macros.rs b/src/libcore/tests/num/int_macros.rs index 71d2e794538..5c6ee8f8ba0 100644 --- a/src/libcore/tests/num/int_macros.rs +++ b/src/libcore/tests/num/int_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! int_module { ($T:ident, $T_i:ident) => ( #[cfg(test)] mod tests { @@ -31,8 +21,8 @@ mod tests { } #[test] - fn test_mod_euc() { - assert!((-1 as $T).mod_euc(MIN) == MAX); + fn test_rem_euclid() { + assert!((-1 as $T).rem_euclid(MIN) == MAX); } #[test] diff --git a/src/libcore/tests/num/mod.rs b/src/libcore/tests/num/mod.rs index 0928f7560e1..a17c094679e 100644 --- a/src/libcore/tests/num/mod.rs +++ b/src/libcore/tests/num/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::convert::{TryFrom, TryInto}; use core::cmp::PartialEq; use core::fmt::Debug; @@ -694,23 +684,23 @@ macro_rules! test_float { assert!(($nan as $fty).max($nan).is_nan()); } #[test] - fn mod_euc() { + fn rem_euclid() { let a: $fty = 42.0; - assert!($inf.mod_euc(a).is_nan()); - assert_eq!(a.mod_euc($inf), a); - assert!(a.mod_euc($nan).is_nan()); - assert!($inf.mod_euc($inf).is_nan()); - assert!($inf.mod_euc($nan).is_nan()); - assert!($nan.mod_euc($inf).is_nan()); + assert!($inf.rem_euclid(a).is_nan()); + assert_eq!(a.rem_euclid($inf), a); + assert!(a.rem_euclid($nan).is_nan()); + assert!($inf.rem_euclid($inf).is_nan()); + assert!($inf.rem_euclid($nan).is_nan()); + assert!($nan.rem_euclid($inf).is_nan()); } #[test] - fn div_euc() { + fn div_euclid() { let a: $fty = 42.0; - assert_eq!(a.div_euc($inf), 0.0); - assert!(a.div_euc($nan).is_nan()); - assert!($inf.div_euc($inf).is_nan()); - assert!($inf.div_euc($nan).is_nan()); - assert!($nan.div_euc($inf).is_nan()); + assert_eq!(a.div_euclid($inf), 0.0); + assert!(a.div_euclid($nan).is_nan()); + assert!($inf.div_euclid($inf).is_nan()); + assert!($inf.div_euclid($nan).is_nan()); + assert!($nan.div_euclid($inf).is_nan()); } } } } diff --git a/src/libcore/tests/num/u16.rs b/src/libcore/tests/num/u16.rs index 8455207583c..435b914224c 100644 --- a/src/libcore/tests/num/u16.rs +++ b/src/libcore/tests/num/u16.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - uint_module!(u16, u16); diff --git a/src/libcore/tests/num/u32.rs b/src/libcore/tests/num/u32.rs index b44e60f6529..71dc005dea3 100644 --- a/src/libcore/tests/num/u32.rs +++ b/src/libcore/tests/num/u32.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - uint_module!(u32, u32); diff --git a/src/libcore/tests/num/u64.rs b/src/libcore/tests/num/u64.rs index ffcd1015d58..b498ebc5204 100644 --- a/src/libcore/tests/num/u64.rs +++ b/src/libcore/tests/num/u64.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - uint_module!(u64, u64); diff --git a/src/libcore/tests/num/u8.rs b/src/libcore/tests/num/u8.rs index 4ee14e22f2d..68e938be704 100644 --- a/src/libcore/tests/num/u8.rs +++ b/src/libcore/tests/num/u8.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - uint_module!(u8, u8); diff --git a/src/libcore/tests/num/uint_macros.rs b/src/libcore/tests/num/uint_macros.rs index ca6906f7310..6e81542b6ec 100644 --- a/src/libcore/tests/num/uint_macros.rs +++ b/src/libcore/tests/num/uint_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! uint_module { ($T:ident, $T_i:ident) => ( #[cfg(test)] mod tests { diff --git a/src/libcore/tests/ops.rs b/src/libcore/tests/ops.rs index d66193b1687..401644e120d 100644 --- a/src/libcore/tests/ops.rs +++ b/src/libcore/tests/ops.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::ops::{Range, RangeFull, RangeFrom, RangeTo, RangeInclusive}; // Test the Range structs without the syntactic sugar. diff --git a/src/libcore/tests/option.rs b/src/libcore/tests/option.rs index 1324ba2d9a9..b059b134868 100644 --- a/src/libcore/tests/option.rs +++ b/src/libcore/tests/option.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::option::*; use core::mem; use core::clone::Clone; @@ -248,6 +238,27 @@ fn test_collect() { assert!(v == None); } +#[test] +fn test_copied() { + let val = 1; + let val_ref = &val; + let opt_none: Option<&'static u32> = None; + let opt_ref = Some(&val); + let opt_ref_ref = Some(&val_ref); + + // None works + assert_eq!(opt_none.clone(), None); + assert_eq!(opt_none.copied(), None); + + // Immutable ref works + assert_eq!(opt_ref.clone(), Some(&val)); + assert_eq!(opt_ref.copied(), Some(1)); + + // Double Immutable ref works + assert_eq!(opt_ref_ref.clone(), Some(&val_ref)); + assert_eq!(opt_ref_ref.clone().copied(), Some(&val)); + assert_eq!(opt_ref_ref.copied().copied(), Some(1)); +} #[test] fn test_cloned() { diff --git a/src/libcore/tests/pattern.rs b/src/libcore/tests/pattern.rs index cfa3b7ee664..b78ed021077 100644 --- a/src/libcore/tests/pattern.rs +++ b/src/libcore/tests/pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::str::pattern::*; // This macro makes it easier to write diff --git a/src/libcore/tests/ptr.rs b/src/libcore/tests/ptr.rs index 92160910d8f..65c1a3e0254 100644 --- a/src/libcore/tests/ptr.rs +++ b/src/libcore/tests/ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::ptr::*; use core::cell::RefCell; diff --git a/src/libcore/tests/result.rs b/src/libcore/tests/result.rs index 0c00992ffd8..1fab07526a0 100644 --- a/src/libcore/tests/result.rs +++ b/src/libcore/tests/result.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::option::*; fn op1() -> Result { Ok(666) } diff --git a/src/libcore/tests/slice.rs b/src/libcore/tests/slice.rs index dba5a43eb21..e210e83122c 100644 --- a/src/libcore/tests/slice.rs +++ b/src/libcore/tests/slice.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::result::Result::{Ok, Err}; #[test] @@ -1024,11 +1014,11 @@ fn test_rotate_right() { fn sort_unstable() { use core::cmp::Ordering::{Equal, Greater, Less}; use core::slice::heapsort; - use rand::{FromEntropy, Rng, XorShiftRng}; + use rand::{FromEntropy, Rng, rngs::SmallRng, seq::SliceRandom}; let mut v = [0; 600]; let mut tmp = [0; 600]; - let mut rng = XorShiftRng::from_entropy(); + let mut rng = SmallRng::from_entropy(); for len in (2..25).chain(500..510) { let v = &mut v[0..len]; @@ -1073,7 +1063,7 @@ fn sort_unstable() { for i in 0..v.len() { v[i] = i as i32; } - v.sort_unstable_by(|_, _| *rng.choose(&[Less, Equal, Greater]).unwrap()); + v.sort_unstable_by(|_, _| *[Less, Equal, Greater].choose(&mut rng).unwrap()); v.sort_unstable(); for i in 0..v.len() { assert_eq!(v[i], i as i32); @@ -1327,3 +1317,18 @@ fn test_copy_within_panics_src_inverted() { // 2 is greater than 1, so this range is invalid. bytes.copy_within(2..1, 0); } + +#[test] +fn test_is_sorted() { + let empty: [i32; 0] = []; + + assert!([1, 2, 2, 9].is_sorted()); + assert!(![1, 3, 2].is_sorted()); + assert!([0].is_sorted()); + assert!(empty.is_sorted()); + assert!(![0.0, 1.0, std::f32::NAN].is_sorted()); + assert!([-2, -1, 0, 3].is_sorted()); + assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs())); + assert!(!["c", "bb", "aaa"].is_sorted()); + assert!(["c", "bb", "aaa"].is_sorted_by_key(|s| s.len())); +} diff --git a/src/libcore/tests/str.rs b/src/libcore/tests/str.rs index 343c9596c53..ed939ca7139 100644 --- a/src/libcore/tests/str.rs +++ b/src/libcore/tests/str.rs @@ -1,11 +1 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // All `str` tests live in liballoc/tests diff --git a/src/libcore/tests/str_lossy.rs b/src/libcore/tests/str_lossy.rs index 56ef3f070c1..f9fd333cca7 100644 --- a/src/libcore/tests/str_lossy.rs +++ b/src/libcore/tests/str_lossy.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::str::lossy::*; #[test] diff --git a/src/libcore/tests/time.rs b/src/libcore/tests/time.rs index 466f28f0ef0..6efd22572dc 100644 --- a/src/libcore/tests/time.rs +++ b/src/libcore/tests/time.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::time::Duration; #[test] diff --git a/src/libcore/tests/tuple.rs b/src/libcore/tests/tuple.rs index 4fe5e0a740b..a4c171eb424 100644 --- a/src/libcore/tests/tuple.rs +++ b/src/libcore/tests/tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cmp::Ordering::{Equal, Less, Greater}; #[test] diff --git a/src/libcore/time.rs b/src/libcore/time.rs index 938e97503de..a751965dffa 100644 --- a/src/libcore/time.rs +++ b/src/libcore/time.rs @@ -1,12 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![stable(feature = "duration_core", since = "1.25.0")] //! Temporal quantification. @@ -32,6 +23,22 @@ const MILLIS_PER_SEC: u64 = 1_000; const MICROS_PER_SEC: u64 = 1_000_000; const MAX_NANOS_F64: f64 = ((u64::MAX as u128 + 1)*(NANOS_PER_SEC as u128)) as f64; +/// The duration of one second. +#[unstable(feature = "duration_constants", issue = "57391")] +pub const SECOND: Duration = Duration::from_secs(1); + +/// The duration of one millisecond. +#[unstable(feature = "duration_constants", issue = "57391")] +pub const MILLISECOND: Duration = Duration::from_millis(1); + +/// The duration of one microsecond. +#[unstable(feature = "duration_constants", issue = "57391")] +pub const MICROSECOND: Duration = Duration::from_micros(1); + +/// The duration of one nanosecond. +#[unstable(feature = "duration_constants", issue = "57391")] +pub const NANOSECOND: Duration = Duration::from_nanos(1); + /// A `Duration` type to represent a span of time, typically used for system /// timeouts. /// @@ -216,7 +223,7 @@ impl Duration { /// /// This method does **not** return the length of the duration when /// represented by milliseconds. The returned number always represents a - /// fractional portion of a second (i.e. it is less than one thousand). + /// fractional portion of a second (i.e., it is less than one thousand). /// /// # Examples /// @@ -235,7 +242,7 @@ impl Duration { /// /// This method does **not** return the length of the duration when /// represented by microseconds. The returned number always represents a - /// fractional portion of a second (i.e. it is less than one million). + /// fractional portion of a second (i.e., it is less than one million). /// /// # Examples /// @@ -254,7 +261,7 @@ impl Duration { /// /// This method does **not** return the length of the duration when /// represented by nanoseconds. The returned number always represents a - /// fractional portion of a second (i.e. it is less than one billion). + /// fractional portion of a second (i.e., it is less than one billion). /// /// # Examples /// @@ -274,13 +281,12 @@ impl Duration { /// # Examples /// /// ``` - /// # #![feature(duration_as_u128)] /// use std::time::Duration; /// /// let duration = Duration::new(5, 730023852); /// assert_eq!(duration.as_millis(), 5730); /// ``` - #[unstable(feature = "duration_as_u128", issue = "50202")] + #[stable(feature = "duration_as_u128", since = "1.33.0")] #[inline] pub const fn as_millis(&self) -> u128 { self.secs as u128 * MILLIS_PER_SEC as u128 + (self.nanos / NANOS_PER_MILLI) as u128 @@ -291,13 +297,12 @@ impl Duration { /// # Examples /// /// ``` - /// # #![feature(duration_as_u128)] /// use std::time::Duration; /// /// let duration = Duration::new(5, 730023852); /// assert_eq!(duration.as_micros(), 5730023); /// ``` - #[unstable(feature = "duration_as_u128", issue = "50202")] + #[stable(feature = "duration_as_u128", since = "1.33.0")] #[inline] pub const fn as_micros(&self) -> u128 { self.secs as u128 * MICROS_PER_SEC as u128 + (self.nanos / NANOS_PER_MICRO) as u128 @@ -308,13 +313,12 @@ impl Duration { /// # Examples /// /// ``` - /// # #![feature(duration_as_u128)] /// use std::time::Duration; /// /// let duration = Duration::new(5, 730023852); /// assert_eq!(duration.as_nanos(), 5730023852); /// ``` - #[unstable(feature = "duration_as_u128", issue = "50202")] + #[stable(feature = "duration_as_u128", since = "1.33.0")] #[inline] pub const fn as_nanos(&self) -> u128 { self.secs as u128 * NANOS_PER_SEC as u128 + self.nanos as u128 diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index 4c5370194fe..a82666d8f70 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // See src/libstd/primitive_docs.rs for documentation. use cmp::*; diff --git a/src/libcore/unicode/bool_trie.rs b/src/libcore/unicode/bool_trie.rs index 0e6437fded5..39584d346e4 100644 --- a/src/libcore/unicode/bool_trie.rs +++ b/src/libcore/unicode/bool_trie.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// BoolTrie is a trie for representing a set of Unicode codepoints. It is /// implemented with postfix compression (sharing of identical child nodes), /// which gives both compact size and fast lookup. diff --git a/src/libcore/unicode/mod.rs b/src/libcore/unicode/mod.rs index e5cda880f88..3b86246269f 100644 --- a/src/libcore/unicode/mod.rs +++ b/src/libcore/unicode/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(feature = "unicode_internals", issue = "0")] #![allow(missing_docs)] diff --git a/src/libcore/unicode/printable.py b/src/libcore/unicode/printable.py index 9410dafbbc3..1288a784123 100644 --- a/src/libcore/unicode/printable.py +++ b/src/libcore/unicode/printable.py @@ -1,14 +1,4 @@ #!/usr/bin/env python -# -# Copyright 2011-2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. # This script uses the following Unicode tables: # - UnicodeData.txt @@ -177,16 +167,6 @@ def main(): normal1 = compress_normal(normal1) print("""\ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // NOTE: The following code was generated by "src/libcore/unicode/printable.py", // do not edit directly! diff --git a/src/libcore/unicode/printable.rs b/src/libcore/unicode/printable.rs index 519dd17bb9b..a950e82cba2 100644 --- a/src/libcore/unicode/printable.rs +++ b/src/libcore/unicode/printable.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // NOTE: The following code was generated by "src/libcore/unicode/printable.py", // do not edit directly! @@ -80,7 +70,7 @@ pub(crate) fn is_printable(x: char) -> bool { } } -const SINGLETONS0U: &'static [(u8, u8)] = &[ +const SINGLETONS0U: &[(u8, u8)] = &[ (0x00, 1), (0x03, 5), (0x05, 6), @@ -122,7 +112,7 @@ const SINGLETONS0U: &'static [(u8, u8)] = &[ (0xfe, 3), (0xff, 9), ]; -const SINGLETONS0L: &'static [u8] = &[ +const SINGLETONS0L: &[u8] = &[ 0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57, 0x58, 0x8b, 0x8c, 0x90, 0x1c, 0x1d, 0xdd, 0x0e, 0x0f, 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f, @@ -162,7 +152,7 @@ const SINGLETONS0L: &'static [u8] = &[ 0x91, 0xfe, 0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9, 0xd0, 0xd1, 0xd8, 0xd9, 0xe7, 0xfe, 0xff, ]; -const SINGLETONS1U: &'static [(u8, u8)] = &[ +const SINGLETONS1U: &[(u8, u8)] = &[ (0x00, 6), (0x01, 1), (0x03, 1), @@ -197,7 +187,7 @@ const SINGLETONS1U: &'static [(u8, u8)] = &[ (0xf0, 4), (0xf9, 4), ]; -const SINGLETONS1L: &'static [u8] = &[ +const SINGLETONS1L: &[u8] = &[ 0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e, 0x9e, 0x9f, 0x06, 0x07, 0x09, 0x36, 0x3d, 0x3e, 0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, 0x36, @@ -219,7 +209,7 @@ const SINGLETONS1L: &'static [u8] = &[ 0x78, 0x7d, 0x7f, 0x8a, 0xa4, 0xaa, 0xaf, 0xb0, 0xc0, 0xd0, 0x3f, 0x71, 0x72, 0x7b, ]; -const NORMAL0: &'static [u8] = &[ +const NORMAL0: &[u8] = &[ 0x00, 0x20, 0x5f, 0x22, 0x82, 0xdf, 0x04, @@ -363,7 +353,7 @@ const NORMAL0: &'static [u8] = &[ 0x1b, 0x03, 0x0f, 0x0d, ]; -const NORMAL1: &'static [u8] = &[ +const NORMAL1: &[u8] = &[ 0x5e, 0x22, 0x7b, 0x05, 0x03, 0x04, diff --git a/src/libcore/unicode/tables.rs b/src/libcore/unicode/tables.rs index e525c057400..edef4ca361e 100644 --- a/src/libcore/unicode/tables.rs +++ b/src/libcore/unicode/tables.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // NOTE: The following code was generated by "./unicode.py", do not edit directly #![allow(missing_docs, non_upper_case_globals, non_snake_case)] diff --git a/src/libcore/unicode/unicode.py b/src/libcore/unicode/unicode.py index 28a1e01805e..ae356c3ff44 100755 --- a/src/libcore/unicode/unicode.py +++ b/src/libcore/unicode/unicode.py @@ -1,14 +1,4 @@ #!/usr/bin/env python -# -# Copyright 2011-2013 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. # This script uses the following Unicode tables: # - DerivedCoreProperties.txt @@ -28,16 +18,7 @@ # The directory in which this file resides. fdir = os.path.dirname(os.path.realpath(__file__)) + "/" -preamble = '''// Copyright 2012-{year} The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +preamble = ''' // NOTE: The following code was generated by "./unicode.py", do not edit directly #![allow(missing_docs, non_upper_case_globals, non_snake_case)] diff --git a/src/libcore/unicode/version.rs b/src/libcore/unicode/version.rs index 59ebf5f5012..4d68d2e8c2e 100644 --- a/src/libcore/unicode/version.rs +++ b/src/libcore/unicode/version.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Represents a Unicode Version. /// /// See also: diff --git a/src/libcore/unit.rs b/src/libcore/unit.rs index 087ddf9688a..540025d77bb 100644 --- a/src/libcore/unit.rs +++ b/src/libcore/unit.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use iter::FromIterator; /// Collapses all unit items from an iterator into one. diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 7d87c1839d7..4f516f18bbf 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Macro support for format strings //! //! These structures are used when parsing format strings for the compiler. @@ -21,6 +11,7 @@ test(attr(deny(warnings))))] #![feature(nll)] +#![feature(rustc_private)] pub use self::Piece::*; pub use self::Position::*; @@ -82,6 +73,15 @@ pub enum Position<'a> { ArgumentNamed(&'a str), } +impl Position<'_> { + pub fn index(&self) -> Option { + match self { + ArgumentIs(i) | ArgumentImplicitlyIs(i) => Some(*i), + _ => None, + } + } +} + /// Enum of alignments which are supported. #[derive(Copy, Clone, PartialEq)] pub enum Alignment { @@ -133,8 +133,9 @@ pub struct ParseError { pub description: string::String, pub note: Option, pub label: string::String, - pub start: usize, - pub end: usize, + pub start: SpanIndex, + pub end: SpanIndex, + pub secondary_label: Option<(string::String, SpanIndex, SpanIndex)>, } /// The parser structure for interpreting the input format string. This is @@ -152,27 +153,43 @@ pub struct Parser<'a> { curarg: usize, /// `Some(raw count)` when the string is "raw", used to position spans correctly style: Option, - /// How many newlines have been seen in the string so far, to adjust the error spans - seen_newlines: usize, /// Start and end byte offset of every successfully parsed argument - pub arg_places: Vec<(usize, usize)>, + pub arg_places: Vec<(SpanIndex, SpanIndex)>, + /// Characters that need to be shifted + skips: Vec, + /// Span offset of the last opening brace seen, used for error reporting + last_opening_brace_pos: Option, + /// Wether the source string is comes from `println!` as opposed to `format!` or `print!` + append_newline: bool, +} + +#[derive(Clone, Copy, Debug)] +pub struct SpanIndex(pub usize); + +impl SpanIndex { + pub fn unwrap(self) -> usize { + self.0 + } } impl<'a> Iterator for Parser<'a> { type Item = Piece<'a>; fn next(&mut self) -> Option> { - let raw = self.style.map(|raw| raw + self.seen_newlines).unwrap_or(0); if let Some(&(pos, c)) = self.cur.peek() { match c { '{' => { + let curr_last_brace = self.last_opening_brace_pos; + self.last_opening_brace_pos = Some(self.to_span_index(pos)); self.cur.next(); if self.consume('{') { + self.last_opening_brace_pos = curr_last_brace; + Some(String(self.string(pos + 1))) } else { let arg = self.argument(); if let Some(arg_pos) = self.must_consume('}').map(|end| { - (pos + raw + 1, end + raw + 2) + (self.to_span_index(pos), self.to_span_index(end + 1)) }) { self.arg_places.push(arg_pos); } @@ -184,7 +201,7 @@ impl<'a> Iterator for Parser<'a> { if self.consume('}') { Some(String(self.string(pos + 1))) } else { - let err_pos = pos + raw + 1; + let err_pos = self.to_span_index(pos); self.err_with_note( "unmatched `}` found", "unmatched `}`", @@ -196,7 +213,6 @@ impl<'a> Iterator for Parser<'a> { } } '\n' => { - self.seen_newlines += 1; Some(String(self.string(pos))) } _ => Some(String(self.string(pos))), @@ -209,15 +225,22 @@ impl<'a> Iterator for Parser<'a> { impl<'a> Parser<'a> { /// Creates a new parser for the given format string - pub fn new(s: &'a str, style: Option) -> Parser<'a> { + pub fn new( + s: &'a str, + style: Option, + skips: Vec, + append_newline: bool, + ) -> Parser<'a> { Parser { input: s, cur: s.char_indices().peekable(), errors: vec![], curarg: 0, style, - seen_newlines: 0, arg_places: vec![], + skips, + last_opening_brace_pos: None, + append_newline, } } @@ -228,8 +251,8 @@ impl<'a> Parser<'a> { &mut self, description: S1, label: S2, - start: usize, - end: usize, + start: SpanIndex, + end: SpanIndex, ) { self.errors.push(ParseError { description: description.into(), @@ -237,6 +260,7 @@ impl<'a> Parser<'a> { label: label.into(), start, end, + secondary_label: None, }); } @@ -248,8 +272,8 @@ impl<'a> Parser<'a> { description: S1, label: S2, note: S3, - start: usize, - end: usize, + start: SpanIndex, + end: SpanIndex, ) { self.errors.push(ParseError { description: description.into(), @@ -257,6 +281,7 @@ impl<'a> Parser<'a> { label: label.into(), start, end, + secondary_label: None, }); } @@ -276,47 +301,86 @@ impl<'a> Parser<'a> { } } + fn raw(&self) -> usize { + self.style.map(|raw| raw + 1).unwrap_or(0) + } + + fn to_span_index(&self, pos: usize) -> SpanIndex { + let mut pos = pos; + for skip in &self.skips { + if pos > *skip { + pos += 1; + } else if pos == *skip && self.raw() == 0 { + pos += 1; + } else { + break; + } + } + SpanIndex(self.raw() + pos + 1) + } + /// Forces consumption of the specified character. If the character is not /// found, an error is emitted. fn must_consume(&mut self, c: char) -> Option { self.ws(); - let raw = self.style.unwrap_or(0); - let padding = raw + self.seen_newlines; if let Some(&(pos, maybe)) = self.cur.peek() { if c == maybe { self.cur.next(); Some(pos) } else { - let pos = pos + raw + 1; - self.err(format!("expected `{:?}`, found `{:?}`", c, maybe), - format!("expected `{}`", c), - pos, - pos); + let pos = self.to_span_index(pos); + let description = format!("expected `'}}'`, found `{:?}`", maybe); + let label = "expected `}`".to_owned(); + let (note, secondary_label) = if c == '}' { + (Some("if you intended to print `{`, you can escape it using `{{`".to_owned()), + self.last_opening_brace_pos.map(|pos| { + ("because of this opening brace".to_owned(), pos, pos) + })) + } else { + (None, None) + }; + self.errors.push(ParseError { + description, + note, + label, + start: pos, + end: pos, + secondary_label, + }); None } } else { - let msg = format!("expected `{:?}` but string was terminated", c); - // point at closing `"`, unless the last char is `\n` to account for `println` - let pos = match self.input.chars().last() { - Some('\n') => self.input.len(), - _ => self.input.len() + 1, - }; + let description = format!("expected `{:?}` but string was terminated", c); + // point at closing `"` + let pos = self.input.len() - if self.append_newline { 1 } else { 0 }; + let pos = self.to_span_index(pos); if c == '}' { - self.err_with_note(msg, - format!("expected `{:?}`", c), - "if you intended to print `{`, you can escape it using `{{`", - pos + padding, - pos + padding); + let label = format!("expected `{:?}`", c); + let (note, secondary_label) = if c == '}' { + (Some("if you intended to print `{`, you can escape it using `{{`".to_owned()), + self.last_opening_brace_pos.map(|pos| { + ("because of this opening brace".to_owned(), pos, pos) + })) + } else { + (None, None) + }; + self.errors.push(ParseError { + description, + note, + label, + start: pos, + end: pos, + secondary_label, + }); } else { - self.err(msg, format!("expected `{:?}`", c), pos, pos); + self.err(description, format!("expected `{:?}`", c), pos, pos); } None } } - /// Consumes all whitespace characters until the first non-whitespace - /// character + /// Consumes all whitespace characters until the first non-whitespace character fn ws(&mut self) { while let Some(&(_, c)) = self.cur.peek() { if c.is_whitespace() { @@ -344,8 +408,7 @@ impl<'a> Parser<'a> { &self.input[start..self.input.len()] } - /// Parses an Argument structure, or what's contained within braces inside - /// the format string + /// Parses an Argument structure, or what's contained within braces inside the format string fn argument(&mut self) -> Argument<'a> { let pos = self.position(); let format = self.format(); @@ -381,8 +444,8 @@ impl<'a> Parser<'a> { self.err_with_note(format!("invalid argument name `{}`", invalid_name), "invalid argument name", "argument names cannot start with an underscore", - pos + 1, // add 1 to account for leading `{` - pos + 1 + invalid_name.len()); + self.to_span_index(pos), + self.to_span_index(pos + invalid_name.len())); Some(ArgumentNamed(invalid_name)) }, @@ -563,7 +626,7 @@ mod tests { use super::*; fn same(fmt: &'static str, p: &[Piece<'static>]) { - let parser = Parser::new(fmt, None); + let parser = Parser::new(fmt, None, vec![], false); assert!(parser.collect::>>() == p); } @@ -579,7 +642,7 @@ mod tests { } fn musterr(s: &str) { - let mut p = Parser::new(s, None); + let mut p = Parser::new(s, None, vec![], false); p.next(); assert!(!p.errors.is_empty()); } diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 396b0366074..164dec97b8f 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -1,16 +1,6 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Generate files suitable for use with [Graphviz](http://www.graphviz.org/) //! -//! The `render` function generates output (e.g. an `output.dot` file) for +//! The `render` function generates output (e.g., an `output.dot` file) for //! use with [Graphviz](http://www.graphviz.org/) by walking a labeled //! graph. (Graphviz can then automatically lay out the nodes and edges //! of the graph, and also optionally render the graph as an image or @@ -25,7 +15,7 @@ //! expressiveness of the [DOT language]( //! http://www.graphviz.org/doc/info/lang.html). For example, there are //! many [attributes](http://www.graphviz.org/content/attrs) related to -//! providing layout hints (e.g. left-to-right versus top-down, which +//! providing layout hints (e.g., left-to-right versus top-down, which //! algorithm to use, etc). The current intention of this library is to //! emit a human-readable .dot file with very regular structure suitable //! for easy post-processing. @@ -373,7 +363,7 @@ impl Style { // implement a Labelling service) that I have encountered is that it // makes it impossible to use types outside of the current crate // directly as Nodes/Edges; you need to wrap them in newtype'd -// structs. See e.g. the `No` and `Ed` structs in the examples. (In +// structs. See e.g., the `No` and `Ed` structs in the examples. (In // practice clients using a graph in some other crate would need to // provide some sort of adapter shim over the graph anyway to // interface with this library). @@ -400,7 +390,7 @@ impl<'a> Id<'a> { /// The caller must ensure that the input conforms to an /// identifier format: it must be a non-empty string made up of /// alphanumeric or underscore characters, not beginning with a - /// digit (i.e. the regular expression `[a-zA-Z_][a-zA-Z_0-9]*`). + /// digit (i.e., the regular expression `[a-zA-Z_][a-zA-Z_0-9]*`). /// /// (Note: this format is a strict subset of the `ID` format /// defined by the DOT language. This function may change in the diff --git a/src/liblibc b/src/liblibc deleted file mode 160000 index c75ca6465a1..00000000000 --- a/src/liblibc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c75ca6465a139704e00295be355b1f067af2f535 diff --git a/src/libpanic_abort/Cargo.toml b/src/libpanic_abort/Cargo.toml index 633d273b3b9..e304e61c329 100644 --- a/src/libpanic_abort/Cargo.toml +++ b/src/libpanic_abort/Cargo.toml @@ -11,5 +11,5 @@ doc = false [dependencies] core = { path = "../libcore" } -libc = { path = "../rustc/libc_shim" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +libc = { version = "0.2", default-features = false } +compiler_builtins = "0.1.0" diff --git a/src/libpanic_abort/lib.rs b/src/libpanic_abort/lib.rs index 9235f8e7660..f6306d23c30 100644 --- a/src/libpanic_abort/lib.rs +++ b/src/libpanic_abort/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of Rust panics via process aborts //! //! When compared to the implementation via unwinding, this crate is *much* @@ -66,6 +56,12 @@ pub unsafe extern fn __rust_start_panic(_payload: usize) -> u32 { unsafe fn abort() -> ! { core::intrinsics::abort(); } + + #[cfg(all(target_vendor="fortanix", target_env="sgx"))] + unsafe fn abort() -> ! { + extern "C" { pub fn panic_exit() -> !; } + panic_exit(); + } } // This... is a bit of an oddity. The tl;dr; is that this is required to link diff --git a/src/libpanic_unwind/Cargo.toml b/src/libpanic_unwind/Cargo.toml index 74aaa4d5ae3..c9fce621608 100644 --- a/src/libpanic_unwind/Cargo.toml +++ b/src/libpanic_unwind/Cargo.toml @@ -12,6 +12,6 @@ doc = false [dependencies] alloc = { path = "../liballoc" } core = { path = "../libcore" } -libc = { path = "../rustc/libc_shim" } +libc = { version = "0.2", default-features = false } unwind = { path = "../libunwind" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = "0.1.0" diff --git a/src/libpanic_unwind/dummy.rs b/src/libpanic_unwind/dummy.rs index 7150560b4a1..b052f76e2a3 100644 --- a/src/libpanic_unwind/dummy.rs +++ b/src/libpanic_unwind/dummy.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Unwinding for wasm32 //! //! Right now we don't support this, so this is just stubs diff --git a/src/libpanic_unwind/dwarf/eh.rs b/src/libpanic_unwind/dwarf/eh.rs index a24c6596891..ce7fab8584a 100644 --- a/src/libpanic_unwind/dwarf/eh.rs +++ b/src/libpanic_unwind/dwarf/eh.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Parsing of GCC-style Language-Specific Data Area (LSDA) //! For details see: //! http://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA/ehframechpt.html diff --git a/src/libpanic_unwind/dwarf/mod.rs b/src/libpanic_unwind/dwarf/mod.rs index 3ff250ff659..eb5fb81f61b 100644 --- a/src/libpanic_unwind/dwarf/mod.rs +++ b/src/libpanic_unwind/dwarf/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Utilities for parsing DWARF-encoded data streams. //! See http://www.dwarfstd.org, //! DWARF-4 standard, Section 7 - "Data Representation" @@ -32,7 +22,7 @@ impl DwarfReader { DwarfReader { ptr } } - // DWARF streams are packed, so e.g. a u32 would not necessarily be aligned + // DWARF streams are packed, so e.g., a u32 would not necessarily be aligned // on a 4-byte boundary. This may cause problems on platforms with strict // alignment requirements. By wrapping data in a "packed" struct, we are // telling the backend to generate "misalignment-safe" code. diff --git a/src/libpanic_unwind/emcc.rs b/src/libpanic_unwind/emcc.rs index 87efc23abc8..45c9244a46f 100644 --- a/src/libpanic_unwind/emcc.rs +++ b/src/libpanic_unwind/emcc.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Unwinding for emscripten //! //! Whereas Rust's usual unwinding implementation for Unix platforms diff --git a/src/libpanic_unwind/gcc.rs b/src/libpanic_unwind/gcc.rs index 11ebcf5c01e..065403aba1b 100644 --- a/src/libpanic_unwind/gcc.rs +++ b/src/libpanic_unwind/gcc.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of panics backed by libgcc/libunwind (in some form) //! //! For background on exception handling and stack unwinding please see @@ -25,7 +15,7 @@ //! //! In both phases the unwinder walks stack frames from top to bottom using //! information from the stack frame unwind sections of the current process's -//! modules ("module" here refers to an OS module, i.e. an executable or a +//! modules ("module" here refers to an OS module, i.e., an executable or a //! dynamic library). //! //! For each stack frame, it invokes the associated "personality routine", whose @@ -296,7 +286,7 @@ unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! { // Each module's image contains a frame unwind info section (usually // ".eh_frame"). When a module is loaded/unloaded into the process, the // unwinder must be informed about the location of this section in memory. The -// methods of achieving that vary by the platform. On some (e.g. Linux), the +// methods of achieving that vary by the platform. On some (e.g., Linux), the // unwinder can discover unwind info sections on its own (by dynamically // enumerating currently loaded modules via the dl_iterate_phdr() API and // finding their ".eh_frame" sections); Others, like Windows, require modules diff --git a/src/libpanic_unwind/lib.rs b/src/libpanic_unwind/lib.rs index cfe671c626b..98f174710d2 100644 --- a/src/libpanic_unwind/lib.rs +++ b/src/libpanic_unwind/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of panics via stack unwinding //! //! This crate is an implementation of panics in Rust using "most native" stack diff --git a/src/libpanic_unwind/macros.rs b/src/libpanic_unwind/macros.rs index 6ea79dc862b..659e977285e 100644 --- a/src/libpanic_unwind/macros.rs +++ b/src/libpanic_unwind/macros.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// A macro for defining `#[cfg]` if-else statements. /// /// This is similar to the `if/elif` C preprocessor macro by allowing definition diff --git a/src/libpanic_unwind/seh.rs b/src/libpanic_unwind/seh.rs index 832a0aff71b..f52d010815c 100644 --- a/src/libpanic_unwind/seh.rs +++ b/src/libpanic_unwind/seh.rs @@ -1,18 +1,8 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Windows SEH //! //! On Windows (currently only on MSVC), the default exception handling //! mechanism is Structured Exception Handling (SEH). This is quite different -//! than Dwarf-based exception handling (e.g. what other unix platforms use) in +//! than Dwarf-based exception handling (e.g., what other unix platforms use) in //! terms of compiler internals, so LLVM is required to have a good deal of //! extra support for SEH. //! @@ -304,7 +294,7 @@ pub unsafe fn cleanup(payload: [u64; 2]) -> Box { }) } -// This is required by the compiler to exist (e.g. it's a lang item), but +// This is required by the compiler to exist (e.g., it's a lang item), but // it's never actually called by the compiler because __C_specific_handler // or _except_handler3 is the personality function that is always used. // Hence this is just an aborting stub. diff --git a/src/libpanic_unwind/seh64_gnu.rs b/src/libpanic_unwind/seh64_gnu.rs index 60e9829ef9e..56ff6082190 100644 --- a/src/libpanic_unwind/seh64_gnu.rs +++ b/src/libpanic_unwind/seh64_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Unwinding implementation of top of native Win64 SEH, //! however the unwind handler data (aka LSDA) uses GCC-compatible encoding. diff --git a/src/libpanic_unwind/windows.rs b/src/libpanic_unwind/windows.rs index 0a1c9b3adf1..3257a9d25a5 100644 --- a/src/libpanic_unwind/windows.rs +++ b/src/libpanic_unwind/windows.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(nonstandard_style)] #![allow(dead_code)] #![cfg(windows)] diff --git a/src/libproc_macro/Cargo.toml b/src/libproc_macro/Cargo.toml index c1b2622520b..f903f79f9af 100644 --- a/src/libproc_macro/Cargo.toml +++ b/src/libproc_macro/Cargo.toml @@ -5,10 +5,3 @@ version = "0.0.0" [lib] path = "lib.rs" -crate-type = ["dylib"] - -[dependencies] -syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } -rustc_errors = { path = "../librustc_errors" } -rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/libproc_macro/bridge/buffer.rs b/src/libproc_macro/bridge/buffer.rs new file mode 100644 index 00000000000..8bc4f0fec85 --- /dev/null +++ b/src/libproc_macro/bridge/buffer.rs @@ -0,0 +1,160 @@ +//! Buffer management for same-process client<->server communication. + +use std::io::{self, Write}; +use std::mem; +use std::ops::{Deref, DerefMut}; +use std::slice; + +#[repr(C)] +struct Slice<'a, T: 'a> { + data: &'a [T; 0], + len: usize, +} + +unsafe impl<'a, T: Sync> Sync for Slice<'a, T> {} +unsafe impl<'a, T: Sync> Send for Slice<'a, T> {} + +impl Copy for Slice<'a, T> {} +impl Clone for Slice<'a, T> { + fn clone(&self) -> Self { + *self + } +} + +impl From<&'a [T]> for Slice<'a, T> { + fn from(xs: &'a [T]) -> Self { + Slice { + data: unsafe { &*(xs.as_ptr() as *const [T; 0]) }, + len: xs.len(), + } + } +} + +impl Deref for Slice<'a, T> { + type Target = [T]; + fn deref(&self) -> &[T] { + unsafe { slice::from_raw_parts(self.data.as_ptr(), self.len) } + } +} + +#[repr(C)] +pub struct Buffer { + data: *mut T, + len: usize, + capacity: usize, + extend_from_slice: extern "C" fn(Buffer, Slice) -> Buffer, + drop: extern "C" fn(Buffer), +} + +unsafe impl Sync for Buffer {} +unsafe impl Send for Buffer {} + +impl Default for Buffer { + fn default() -> Self { + Self::from(vec![]) + } +} + +impl Deref for Buffer { + type Target = [T]; + fn deref(&self) -> &[T] { + unsafe { slice::from_raw_parts(self.data as *const T, self.len) } + } +} + +impl DerefMut for Buffer { + fn deref_mut(&mut self) -> &mut [T] { + unsafe { slice::from_raw_parts_mut(self.data, self.len) } + } +} + +impl Buffer { + pub(super) fn new() -> Self { + Self::default() + } + + pub(super) fn clear(&mut self) { + self.len = 0; + } + + pub(super) fn take(&mut self) -> Self { + mem::replace(self, Self::default()) + } + + pub(super) fn extend_from_slice(&mut self, xs: &[T]) { + // Fast path to avoid going through an FFI call. + if let Some(final_len) = self.len.checked_add(xs.len()) { + if final_len <= self.capacity { + let dst = unsafe { slice::from_raw_parts_mut(self.data, self.capacity) }; + dst[self.len..][..xs.len()].copy_from_slice(xs); + self.len = final_len; + return; + } + } + let b = self.take(); + *self = (b.extend_from_slice)(b, Slice::from(xs)); + } +} + +impl Write for Buffer { + fn write(&mut self, xs: &[u8]) -> io::Result { + self.extend_from_slice(xs); + Ok(xs.len()) + } + + fn write_all(&mut self, xs: &[u8]) -> io::Result<()> { + self.extend_from_slice(xs); + Ok(()) + } + + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + +impl Drop for Buffer { + fn drop(&mut self) { + let b = self.take(); + (b.drop)(b); + } +} + +impl From> for Buffer { + fn from(mut v: Vec) -> Self { + let (data, len, capacity) = (v.as_mut_ptr(), v.len(), v.capacity()); + mem::forget(v); + + // This utility function is nested in here because it can *only* + // be safely called on `Buffer`s created by *this* `proc_macro`. + fn to_vec(b: Buffer) -> Vec { + unsafe { + let Buffer { + data, + len, + capacity, + .. + } = b; + mem::forget(b); + Vec::from_raw_parts(data, len, capacity) + } + } + + extern "C" fn extend_from_slice(b: Buffer, xs: Slice) -> Buffer { + let mut v = to_vec(b); + v.extend_from_slice(&xs); + Buffer::from(v) + } + + extern "C" fn drop(b: Buffer) { + mem::drop(to_vec(b)); + } + + Buffer { + data, + len, + capacity, + extend_from_slice, + drop, + } + } +} diff --git a/src/libproc_macro/bridge/client.rs b/src/libproc_macro/bridge/client.rs new file mode 100644 index 00000000000..3095c8041f2 --- /dev/null +++ b/src/libproc_macro/bridge/client.rs @@ -0,0 +1,494 @@ +//! Client-side types. + +use super::*; + +macro_rules! define_handles { + ( + 'owned: $($oty:ident,)* + 'interned: $($ity:ident,)* + ) => { + #[repr(C)] + #[allow(non_snake_case)] + pub struct HandleCounters { + $($oty: AtomicUsize,)* + $($ity: AtomicUsize,)* + } + + impl HandleCounters { + // FIXME(#53451) public to work around `Cannot create local mono-item` ICE. + pub extern "C" fn get() -> &'static Self { + static COUNTERS: HandleCounters = HandleCounters { + $($oty: AtomicUsize::new(1),)* + $($ity: AtomicUsize::new(1),)* + }; + &COUNTERS + } + } + + // FIXME(eddyb) generate the definition of `HandleStore` in `server.rs`. + #[repr(C)] + #[allow(non_snake_case)] + pub(super) struct HandleStore { + $($oty: handle::OwnedStore,)* + $($ity: handle::InternedStore,)* + } + + impl HandleStore { + pub(super) fn new(handle_counters: &'static HandleCounters) -> Self { + HandleStore { + $($oty: handle::OwnedStore::new(&handle_counters.$oty),)* + $($ity: handle::InternedStore::new(&handle_counters.$ity),)* + } + } + } + + $( + #[repr(C)] + pub(crate) struct $oty(handle::Handle); + impl !Send for $oty {} + impl !Sync for $oty {} + + // Forward `Drop::drop` to the inherent `drop` method. + impl Drop for $oty { + fn drop(&mut self) { + $oty(self.0).drop(); + } + } + + impl Encode for $oty { + fn encode(self, w: &mut Writer, s: &mut S) { + let handle = self.0; + mem::forget(self); + handle.encode(w, s); + } + } + + impl DecodeMut<'_, '_, HandleStore>> + for Marked + { + fn decode(r: &mut Reader, s: &mut HandleStore>) -> Self { + s.$oty.take(handle::Handle::decode(r, &mut ())) + } + } + + impl Encode for &$oty { + fn encode(self, w: &mut Writer, s: &mut S) { + self.0.encode(w, s); + } + } + + impl Decode<'_, 's, HandleStore>> + for &'s Marked + { + fn decode(r: &mut Reader, s: &'s HandleStore>) -> Self { + &s.$oty[handle::Handle::decode(r, &mut ())] + } + } + + impl Encode for &mut $oty { + fn encode(self, w: &mut Writer, s: &mut S) { + self.0.encode(w, s); + } + } + + impl DecodeMut<'_, 's, HandleStore>> + for &'s mut Marked + { + fn decode(r: &mut Reader, s: &'s mut HandleStore>) -> Self { + &mut s.$oty[handle::Handle::decode(r, &mut ())] + } + } + + impl Encode>> + for Marked + { + fn encode(self, w: &mut Writer, s: &mut HandleStore>) { + s.$oty.alloc(self).encode(w, s); + } + } + + impl DecodeMut<'_, '_, S> for $oty { + fn decode(r: &mut Reader, s: &mut S) -> Self { + $oty(handle::Handle::decode(r, s)) + } + } + )* + + $( + #[repr(C)] + #[derive(Copy, Clone, PartialEq, Eq, Hash)] + pub(crate) struct $ity(handle::Handle); + impl !Send for $ity {} + impl !Sync for $ity {} + + impl Encode for $ity { + fn encode(self, w: &mut Writer, s: &mut S) { + self.0.encode(w, s); + } + } + + impl DecodeMut<'_, '_, HandleStore>> + for Marked + { + fn decode(r: &mut Reader, s: &mut HandleStore>) -> Self { + s.$ity.copy(handle::Handle::decode(r, &mut ())) + } + } + + impl Encode>> + for Marked + { + fn encode(self, w: &mut Writer, s: &mut HandleStore>) { + s.$ity.alloc(self).encode(w, s); + } + } + + impl DecodeMut<'_, '_, S> for $ity { + fn decode(r: &mut Reader, s: &mut S) -> Self { + $ity(handle::Handle::decode(r, s)) + } + } + )* + } +} +define_handles! { + 'owned: + TokenStream, + TokenStreamBuilder, + TokenStreamIter, + Group, + Literal, + SourceFile, + MultiSpan, + Diagnostic, + + 'interned: + Punct, + Ident, + Span, +} + +// FIXME(eddyb) generate these impls by pattern-matching on the +// names of methods - also could use the presence of `fn drop` +// to distinguish between 'owned and 'interned, above. +// Alternatively, special 'modes" could be listed of types in with_api +// instead of pattern matching on methods, here and in server decl. + +impl Clone for TokenStream { + fn clone(&self) -> Self { + self.clone() + } +} + +impl Clone for TokenStreamIter { + fn clone(&self) -> Self { + self.clone() + } +} + +impl Clone for Group { + fn clone(&self) -> Self { + self.clone() + } +} + +impl Clone for Literal { + fn clone(&self) -> Self { + self.clone() + } +} + +// FIXME(eddyb) `Literal` should not expose internal `Debug` impls. +impl fmt::Debug for Literal { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str(&self.debug()) + } +} + +impl Clone for SourceFile { + fn clone(&self) -> Self { + self.clone() + } +} + +impl fmt::Debug for Span { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str(&self.debug()) + } +} + +macro_rules! define_client_side { + ($($name:ident { + $(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)* + }),* $(,)*) => { + $(impl $name { + $(pub(crate) fn $method($($arg: $arg_ty),*) $(-> $ret_ty)* { + Bridge::with(|bridge| { + let mut b = bridge.cached_buffer.take(); + + b.clear(); + api_tags::Method::$name(api_tags::$name::$method).encode(&mut b, &mut ()); + reverse_encode!(b; $($arg),*); + + b = bridge.dispatch.call(b); + + let r = Result::<_, PanicMessage>::decode(&mut &b[..], &mut ()); + + bridge.cached_buffer = b; + + r.unwrap_or_else(|e| panic::resume_unwind(e.into())) + }) + })* + })* + } +} +with_api!(self, self, define_client_side); + +enum BridgeState<'a> { + /// No server is currently connected to this client. + NotConnected, + + /// A server is connected and available for requests. + Connected(Bridge<'a>), + + /// Access to the bridge is being exclusively acquired + /// (e.g., during `BridgeState::with`). + InUse, +} + +enum BridgeStateL {} + +impl<'a> scoped_cell::ApplyL<'a> for BridgeStateL { + type Out = BridgeState<'a>; +} + +thread_local! { + static BRIDGE_STATE: scoped_cell::ScopedCell = + scoped_cell::ScopedCell::new(BridgeState::NotConnected); +} + +impl BridgeState<'_> { + /// Take exclusive control of the thread-local + /// `BridgeState`, and pass it to `f`, mutably. + /// The state will be restored after `f` exits, even + /// by panic, including modifications made to it by `f`. + /// + /// N.B., while `f` is running, the thread-local state + /// is `BridgeState::InUse`. + fn with(f: impl FnOnce(&mut BridgeState) -> R) -> R { + BRIDGE_STATE.with(|state| { + state.replace(BridgeState::InUse, |mut state| { + // FIXME(#52812) pass `f` directly to `replace` when `RefMutL` is gone + f(&mut *state) + }) + }) + } +} + +impl Bridge<'_> { + fn enter(self, f: impl FnOnce() -> R) -> R { + // Hide the default panic output within `proc_macro` expansions. + // NB. the server can't do this because it may use a different libstd. + static HIDE_PANICS_DURING_EXPANSION: Once = Once::new(); + HIDE_PANICS_DURING_EXPANSION.call_once(|| { + let prev = panic::take_hook(); + panic::set_hook(Box::new(move |info| { + let hide = BridgeState::with(|state| match state { + BridgeState::NotConnected => false, + BridgeState::Connected(_) | BridgeState::InUse => true, + }); + if !hide { + prev(info) + } + })); + }); + + BRIDGE_STATE.with(|state| state.set(BridgeState::Connected(self), f)) + } + + fn with(f: impl FnOnce(&mut Bridge) -> R) -> R { + BridgeState::with(|state| match state { + BridgeState::NotConnected => { + panic!("procedural macro API is used outside of a procedural macro"); + } + BridgeState::InUse => { + panic!("procedural macro API is used while it's already in use"); + } + BridgeState::Connected(bridge) => f(bridge), + }) + } +} + +/// A client-side "global object" (usually a function pointer), +/// which may be using a different `proc_macro` from the one +/// used by the server, but can be interacted with compatibly. +/// +/// N.B., `F` must have FFI-friendly memory layout (e.g., a pointer). +/// The call ABI of function pointers used for `F` doesn't +/// need to match between server and client, since it's only +/// passed between them and (eventually) called by the client. +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Client { + pub(super) get_handle_counters: extern "C" fn() -> &'static HandleCounters, + pub(super) run: extern "C" fn(Bridge, F) -> Buffer, + pub(super) f: F, +} + +// FIXME(#53451) public to work around `Cannot create local mono-item` ICE, +// affecting not only the function itself, but also the `BridgeState` `thread_local!`. +pub extern "C" fn __run_expand1( + mut bridge: Bridge, + f: fn(::TokenStream) -> ::TokenStream, +) -> Buffer { + // The initial `cached_buffer` contains the input. + let mut b = bridge.cached_buffer.take(); + + panic::catch_unwind(panic::AssertUnwindSafe(|| { + bridge.enter(|| { + let reader = &mut &b[..]; + let input = TokenStream::decode(reader, &mut ()); + + // Put the `cached_buffer` back in the `Bridge`, for requests. + Bridge::with(|bridge| bridge.cached_buffer = b.take()); + + let output = f(::TokenStream(input)).0; + + // Take the `cached_buffer` back out, for the output value. + b = Bridge::with(|bridge| bridge.cached_buffer.take()); + + // HACK(eddyb) Separate encoding a success value (`Ok(output)`) + // from encoding a panic (`Err(e: PanicMessage)`) to avoid + // having handles outside the `bridge.enter(|| ...)` scope, and + // to catch panics that could happen while encoding the success. + // + // Note that panics should be impossible beyond this point, but + // this is defensively trying to avoid any accidental panicking + // reaching the `extern "C"` (which should `abort` but may not + // at the moment, so this is also potentially preventing UB). + b.clear(); + Ok::<_, ()>(output).encode(&mut b, &mut ()); + }) + })) + .map_err(PanicMessage::from) + .unwrap_or_else(|e| { + b.clear(); + Err::<(), _>(e).encode(&mut b, &mut ()); + }); + b +} + +impl Client ::TokenStream> { + pub const fn expand1(f: fn(::TokenStream) -> ::TokenStream) -> Self { + Client { + get_handle_counters: HandleCounters::get, + run: __run_expand1, + f, + } + } +} + +// FIXME(#53451) public to work around `Cannot create local mono-item` ICE, +// affecting not only the function itself, but also the `BridgeState` `thread_local!`. +pub extern "C" fn __run_expand2( + mut bridge: Bridge, + f: fn(::TokenStream, ::TokenStream) -> ::TokenStream, +) -> Buffer { + // The initial `cached_buffer` contains the input. + let mut b = bridge.cached_buffer.take(); + + panic::catch_unwind(panic::AssertUnwindSafe(|| { + bridge.enter(|| { + let reader = &mut &b[..]; + let input = TokenStream::decode(reader, &mut ()); + let input2 = TokenStream::decode(reader, &mut ()); + + // Put the `cached_buffer` back in the `Bridge`, for requests. + Bridge::with(|bridge| bridge.cached_buffer = b.take()); + + let output = f(::TokenStream(input), ::TokenStream(input2)).0; + + // Take the `cached_buffer` back out, for the output value. + b = Bridge::with(|bridge| bridge.cached_buffer.take()); + + // HACK(eddyb) Separate encoding a success value (`Ok(output)`) + // from encoding a panic (`Err(e: PanicMessage)`) to avoid + // having handles outside the `bridge.enter(|| ...)` scope, and + // to catch panics that could happen while encoding the success. + // + // Note that panics should be impossible beyond this point, but + // this is defensively trying to avoid any accidental panicking + // reaching the `extern "C"` (which should `abort` but may not + // at the moment, so this is also potentially preventing UB). + b.clear(); + Ok::<_, ()>(output).encode(&mut b, &mut ()); + }) + })) + .map_err(PanicMessage::from) + .unwrap_or_else(|e| { + b.clear(); + Err::<(), _>(e).encode(&mut b, &mut ()); + }); + b +} + +impl Client ::TokenStream> { + pub const fn expand2(f: fn(::TokenStream, ::TokenStream) -> ::TokenStream) -> Self { + Client { + get_handle_counters: HandleCounters::get, + run: __run_expand2, + f, + } + } +} + +#[repr(C)] +#[derive(Copy, Clone)] +pub enum ProcMacro { + CustomDerive { + trait_name: &'static str, + attributes: &'static [&'static str], + client: Client ::TokenStream>, + }, + + Attr { + name: &'static str, + client: Client ::TokenStream>, + }, + + Bang { + name: &'static str, + client: Client ::TokenStream>, + }, +} + +impl ProcMacro { + pub const fn custom_derive( + trait_name: &'static str, + attributes: &'static [&'static str], + expand: fn(::TokenStream) -> ::TokenStream, + ) -> Self { + ProcMacro::CustomDerive { + trait_name, + attributes, + client: Client::expand1(expand), + } + } + + pub const fn attr( + name: &'static str, + expand: fn(::TokenStream, ::TokenStream) -> ::TokenStream, + ) -> Self { + ProcMacro::Attr { + name, + client: Client::expand2(expand), + } + } + + pub const fn bang(name: &'static str, expand: fn(::TokenStream) -> ::TokenStream) -> Self { + ProcMacro::Bang { + name, + client: Client::expand1(expand), + } + } +} diff --git a/src/libproc_macro/bridge/closure.rs b/src/libproc_macro/bridge/closure.rs new file mode 100644 index 00000000000..8d8adfa1caa --- /dev/null +++ b/src/libproc_macro/bridge/closure.rs @@ -0,0 +1,32 @@ +//! Closure type (equivalent to `&mut dyn FnMut(A) -> R`) that's `repr(C)`. + +#[repr(C)] +pub struct Closure<'a, A, R> { + call: unsafe extern "C" fn(&mut Env, A) -> R, + env: &'a mut Env, +} + +extern "C" { + type Env; +} + +impl<'a, A, R> !Sync for Closure<'a, A, R> {} +impl<'a, A, R> !Send for Closure<'a, A, R> {} + +impl<'a, A, R, F: FnMut(A) -> R> From<&'a mut F> for Closure<'a, A, R> { + fn from(f: &'a mut F) -> Self { + unsafe extern "C" fn call R>(env: &mut Env, arg: A) -> R { + (*(env as *mut _ as *mut F))(arg) + } + Closure { + call: call::, + env: unsafe { &mut *(f as *mut _ as *mut Env) }, + } + } +} + +impl<'a, A, R> Closure<'a, A, R> { + pub fn call(&mut self, arg: A) -> R { + unsafe { (self.call)(self.env, arg) } + } +} diff --git a/src/libproc_macro/bridge/handle.rs b/src/libproc_macro/bridge/handle.rs new file mode 100644 index 00000000000..66496ff3f1a --- /dev/null +++ b/src/libproc_macro/bridge/handle.rs @@ -0,0 +1,82 @@ +//! Server-side handles and storage for per-handle data. + +use std::collections::{BTreeMap, HashMap}; +use std::hash::Hash; +use std::num::NonZeroU32; +use std::ops::{Index, IndexMut}; +use std::sync::atomic::{AtomicUsize, Ordering}; + +pub(super) type Handle = NonZeroU32; + +pub(super) struct OwnedStore { + counter: &'static AtomicUsize, + data: BTreeMap, +} + +impl OwnedStore { + pub(super) fn new(counter: &'static AtomicUsize) -> Self { + // Ensure the handle counter isn't 0, which would panic later, + // when `NonZeroU32::new` (aka `Handle::new`) is called in `alloc`. + assert_ne!(counter.load(Ordering::SeqCst), 0); + + OwnedStore { + counter, + data: BTreeMap::new(), + } + } +} + +impl OwnedStore { + pub(super) fn alloc(&mut self, x: T) -> Handle { + let counter = self.counter.fetch_add(1, Ordering::SeqCst); + let handle = Handle::new(counter as u32).expect("`proc_macro` handle counter overflowed"); + assert!(self.data.insert(handle, x).is_none()); + handle + } + + pub(super) fn take(&mut self, h: Handle) -> T { + self.data + .remove(&h) + .expect("use-after-free in `proc_macro` handle") + } +} + +impl Index for OwnedStore { + type Output = T; + fn index(&self, h: Handle) -> &T { + self.data + .get(&h) + .expect("use-after-free in `proc_macro` handle") + } +} + +impl IndexMut for OwnedStore { + fn index_mut(&mut self, h: Handle) -> &mut T { + self.data + .get_mut(&h) + .expect("use-after-free in `proc_macro` handle") + } +} + +pub(super) struct InternedStore { + owned: OwnedStore, + interner: HashMap, +} + +impl InternedStore { + pub(super) fn new(counter: &'static AtomicUsize) -> Self { + InternedStore { + owned: OwnedStore::new(counter), + interner: HashMap::new(), + } + } + + pub(super) fn alloc(&mut self, x: T) -> Handle { + let owned = &mut self.owned; + *self.interner.entry(x).or_insert_with(|| owned.alloc(x)) + } + + pub(super) fn copy(&mut self, h: Handle) -> T { + self.owned[h] + } +} diff --git a/src/libproc_macro/bridge/mod.rs b/src/libproc_macro/bridge/mod.rs new file mode 100644 index 00000000000..6c3e534bf91 --- /dev/null +++ b/src/libproc_macro/bridge/mod.rs @@ -0,0 +1,403 @@ +//! Internal interface for communicating between a `proc_macro` client +//! (a proc macro crate) and a `proc_macro` server (a compiler front-end). +//! +//! Serialization (with C ABI buffers) and unique integer handles are employed +//! to allow safely interfacing between two copies of `proc_macro` built +//! (from the same source) by different compilers with potentially mismatching +//! Rust ABIs (e.g., stage0/bin/rustc vs stage1/bin/rustc during bootstrap). + +#![deny(unsafe_code)] + +use std::fmt; +use std::hash::Hash; +use std::marker; +use std::mem; +use std::ops::Bound; +use std::panic; +use std::sync::atomic::AtomicUsize; +use std::sync::Once; +use std::thread; +use {Delimiter, Level, LineColumn, Spacing}; + +/// Higher-order macro describing the server RPC API, allowing automatic +/// generation of type-safe Rust APIs, both client-side and server-side. +/// +/// `with_api!(MySelf, my_self, my_macro)` expands to: +/// ```rust,ignore (pseudo-code) +/// my_macro! { +/// // ... +/// Literal { +/// // ... +/// fn character(ch: char) -> MySelf::Literal; +/// // ... +/// fn span(my_self: &MySelf::Literal) -> MySelf::Span; +/// fn set_span(my_self: &mut MySelf::Literal, span: MySelf::Span); +/// }, +/// // ... +/// } +/// ``` +/// +/// The first two arguments serve to customize the arguments names +/// and argument/return types, to enable several different usecases: +/// +/// If `my_self` is just `self`, then each `fn` signature can be used +/// as-is for a method. If it's anything else (`self_` in practice), +/// then the signatures don't have a special `self` argument, and +/// can, therefore, have a different one introduced. +/// +/// If `MySelf` is just `Self`, then the types are only valid inside +/// a trait or a trait impl, where the trait has associated types +/// for each of the API types. If non-associated types are desired, +/// a module name (`self` in practice) can be used instead of `Self`. +macro_rules! with_api { + ($S:ident, $self:ident, $m:ident) => { + $m! { + TokenStream { + fn drop($self: $S::TokenStream); + fn clone($self: &$S::TokenStream) -> $S::TokenStream; + fn new() -> $S::TokenStream; + fn is_empty($self: &$S::TokenStream) -> bool; + fn from_str(src: &str) -> $S::TokenStream; + fn to_string($self: &$S::TokenStream) -> String; + fn from_token_tree( + tree: TokenTree<$S::Group, $S::Punct, $S::Ident, $S::Literal>, + ) -> $S::TokenStream; + fn into_iter($self: $S::TokenStream) -> $S::TokenStreamIter; + }, + TokenStreamBuilder { + fn drop($self: $S::TokenStreamBuilder); + fn new() -> $S::TokenStreamBuilder; + fn push($self: &mut $S::TokenStreamBuilder, stream: $S::TokenStream); + fn build($self: $S::TokenStreamBuilder) -> $S::TokenStream; + }, + TokenStreamIter { + fn drop($self: $S::TokenStreamIter); + fn clone($self: &$S::TokenStreamIter) -> $S::TokenStreamIter; + fn next( + $self: &mut $S::TokenStreamIter, + ) -> Option>; + }, + Group { + fn drop($self: $S::Group); + fn clone($self: &$S::Group) -> $S::Group; + fn new(delimiter: Delimiter, stream: $S::TokenStream) -> $S::Group; + fn delimiter($self: &$S::Group) -> Delimiter; + fn stream($self: &$S::Group) -> $S::TokenStream; + fn span($self: &$S::Group) -> $S::Span; + fn span_open($self: &$S::Group) -> $S::Span; + fn span_close($self: &$S::Group) -> $S::Span; + fn set_span($self: &mut $S::Group, span: $S::Span); + }, + Punct { + fn new(ch: char, spacing: Spacing) -> $S::Punct; + fn as_char($self: $S::Punct) -> char; + fn spacing($self: $S::Punct) -> Spacing; + fn span($self: $S::Punct) -> $S::Span; + fn with_span($self: $S::Punct, span: $S::Span) -> $S::Punct; + }, + Ident { + fn new(string: &str, span: $S::Span, is_raw: bool) -> $S::Ident; + fn span($self: $S::Ident) -> $S::Span; + fn with_span($self: $S::Ident, span: $S::Span) -> $S::Ident; + }, + Literal { + fn drop($self: $S::Literal); + fn clone($self: &$S::Literal) -> $S::Literal; + // FIXME(eddyb) `Literal` should not expose internal `Debug` impls. + fn debug($self: &$S::Literal) -> String; + fn integer(n: &str) -> $S::Literal; + fn typed_integer(n: &str, kind: &str) -> $S::Literal; + fn float(n: &str) -> $S::Literal; + fn f32(n: &str) -> $S::Literal; + fn f64(n: &str) -> $S::Literal; + fn string(string: &str) -> $S::Literal; + fn character(ch: char) -> $S::Literal; + fn byte_string(bytes: &[u8]) -> $S::Literal; + fn span($self: &$S::Literal) -> $S::Span; + fn set_span($self: &mut $S::Literal, span: $S::Span); + fn subspan( + $self: &$S::Literal, + start: Bound, + end: Bound, + ) -> Option<$S::Span>; + }, + SourceFile { + fn drop($self: $S::SourceFile); + fn clone($self: &$S::SourceFile) -> $S::SourceFile; + fn eq($self: &$S::SourceFile, other: &$S::SourceFile) -> bool; + fn path($self: &$S::SourceFile) -> String; + fn is_real($self: &$S::SourceFile) -> bool; + }, + MultiSpan { + fn drop($self: $S::MultiSpan); + fn new() -> $S::MultiSpan; + fn push($self: &mut $S::MultiSpan, span: $S::Span); + }, + Diagnostic { + fn drop($self: $S::Diagnostic); + fn new(level: Level, msg: &str, span: $S::MultiSpan) -> $S::Diagnostic; + fn sub( + $self: &mut $S::Diagnostic, + level: Level, + msg: &str, + span: $S::MultiSpan, + ); + fn emit($self: $S::Diagnostic); + }, + Span { + fn debug($self: $S::Span) -> String; + fn def_site() -> $S::Span; + fn call_site() -> $S::Span; + fn source_file($self: $S::Span) -> $S::SourceFile; + fn parent($self: $S::Span) -> Option<$S::Span>; + fn source($self: $S::Span) -> $S::Span; + fn start($self: $S::Span) -> LineColumn; + fn end($self: $S::Span) -> LineColumn; + fn join($self: $S::Span, other: $S::Span) -> Option<$S::Span>; + fn resolved_at($self: $S::Span, at: $S::Span) -> $S::Span; + }, + } + }; +} + +// FIXME(eddyb) this calls `encode` for each argument, but in reverse, +// to avoid borrow conflicts from borrows started by `&mut` arguments. +macro_rules! reverse_encode { + ($writer:ident;) => {}; + ($writer:ident; $first:ident $(, $rest:ident)*) => { + reverse_encode!($writer; $($rest),*); + $first.encode(&mut $writer, &mut ()); + } +} + +// FIXME(eddyb) this calls `decode` for each argument, but in reverse, +// to avoid borrow conflicts from borrows started by `&mut` arguments. +macro_rules! reverse_decode { + ($reader:ident, $s:ident;) => {}; + ($reader:ident, $s:ident; $first:ident: $first_ty:ty $(, $rest:ident: $rest_ty:ty)*) => { + reverse_decode!($reader, $s; $($rest: $rest_ty),*); + let $first = <$first_ty>::decode(&mut $reader, $s); + } +} + +#[allow(unsafe_code)] +mod buffer; +#[forbid(unsafe_code)] +pub mod client; +#[allow(unsafe_code)] +mod closure; +#[forbid(unsafe_code)] +mod handle; +#[macro_use] +#[forbid(unsafe_code)] +mod rpc; +#[allow(unsafe_code)] +mod scoped_cell; +#[forbid(unsafe_code)] +pub mod server; + +use self::buffer::Buffer; +pub use self::rpc::PanicMessage; +use self::rpc::{Decode, DecodeMut, Encode, Reader, Writer}; + +/// An active connection between a server and a client. +/// The server creates the bridge (`Bridge::run_server` in `server.rs`), +/// then passes it to the client through the function pointer in the `run` +/// field of `client::Client`. The client holds its copy of the `Bridge` +/// in TLS during its execution (`Bridge::{enter, with}` in `client.rs`). +#[repr(C)] +pub struct Bridge<'a> { + /// Reusable buffer (only `clear`-ed, never shrunk), primarily + /// used for making requests, but also for passing input to client. + cached_buffer: Buffer, + + /// Server-side function that the client uses to make requests. + dispatch: closure::Closure<'a, Buffer, Buffer>, +} + +impl<'a> !Sync for Bridge<'a> {} +impl<'a> !Send for Bridge<'a> {} + +#[forbid(unsafe_code)] +#[allow(non_camel_case_types)] +mod api_tags { + use super::rpc::{DecodeMut, Encode, Reader, Writer}; + + macro_rules! declare_tags { + ($($name:ident { + $(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)* + }),* $(,)*) => { + $( + pub(super) enum $name { + $($method),* + } + rpc_encode_decode!(enum $name { $($method),* }); + )* + + + pub(super) enum Method { + $($name($name)),* + } + rpc_encode_decode!(enum Method { $($name(m)),* }); + } + } + with_api!(self, self, declare_tags); +} + +/// Helper to wrap associated types to allow trait impl dispatch. +/// That is, normally a pair of impls for `T::Foo` and `T::Bar` +/// can overlap, but if the impls are, instead, on types like +/// `Marked` and `Marked`, they can't. +trait Mark { + type Unmarked; + fn mark(unmarked: Self::Unmarked) -> Self; +} + +/// Unwrap types wrapped by `Mark::mark` (see `Mark` for details). +trait Unmark { + type Unmarked; + fn unmark(self) -> Self::Unmarked; +} + +#[derive(Copy, Clone, PartialEq, Eq, Hash)] +struct Marked { + value: T, + _marker: marker::PhantomData, +} + +impl Mark for Marked { + type Unmarked = T; + fn mark(unmarked: Self::Unmarked) -> Self { + Marked { + value: unmarked, + _marker: marker::PhantomData, + } + } +} +impl Unmark for Marked { + type Unmarked = T; + fn unmark(self) -> Self::Unmarked { + self.value + } +} +impl Unmark for &'a Marked { + type Unmarked = &'a T; + fn unmark(self) -> Self::Unmarked { + &self.value + } +} +impl Unmark for &'a mut Marked { + type Unmarked = &'a mut T; + fn unmark(self) -> Self::Unmarked { + &mut self.value + } +} + +impl Mark for Option { + type Unmarked = Option; + fn mark(unmarked: Self::Unmarked) -> Self { + unmarked.map(T::mark) + } +} +impl Unmark for Option { + type Unmarked = Option; + fn unmark(self) -> Self::Unmarked { + self.map(T::unmark) + } +} + +macro_rules! mark_noop { + ($($ty:ty),* $(,)*) => { + $( + impl Mark for $ty { + type Unmarked = Self; + fn mark(unmarked: Self::Unmarked) -> Self { + unmarked + } + } + impl Unmark for $ty { + type Unmarked = Self; + fn unmark(self) -> Self::Unmarked { + self + } + } + )* + } +} +mark_noop! { + (), + bool, + char, + &'a [u8], + &'a str, + String, + Delimiter, + Level, + LineColumn, + Spacing, + Bound, +} + +rpc_encode_decode!( + enum Delimiter { + Parenthesis, + Brace, + Bracket, + None, + } +); +rpc_encode_decode!( + enum Level { + Error, + Warning, + Note, + Help, + } +); +rpc_encode_decode!(struct LineColumn { line, column }); +rpc_encode_decode!( + enum Spacing { + Alone, + Joint, + } +); + +#[derive(Clone)] +pub enum TokenTree { + Group(G), + Punct(P), + Ident(I), + Literal(L), +} + +impl Mark for TokenTree { + type Unmarked = TokenTree; + fn mark(unmarked: Self::Unmarked) -> Self { + match unmarked { + TokenTree::Group(tt) => TokenTree::Group(G::mark(tt)), + TokenTree::Punct(tt) => TokenTree::Punct(P::mark(tt)), + TokenTree::Ident(tt) => TokenTree::Ident(I::mark(tt)), + TokenTree::Literal(tt) => TokenTree::Literal(L::mark(tt)), + } + } +} +impl Unmark for TokenTree { + type Unmarked = TokenTree; + fn unmark(self) -> Self::Unmarked { + match self { + TokenTree::Group(tt) => TokenTree::Group(tt.unmark()), + TokenTree::Punct(tt) => TokenTree::Punct(tt.unmark()), + TokenTree::Ident(tt) => TokenTree::Ident(tt.unmark()), + TokenTree::Literal(tt) => TokenTree::Literal(tt.unmark()), + } + } +} + +rpc_encode_decode!( + enum TokenTree { + Group(tt), + Punct(tt), + Ident(tt), + Literal(tt), + } +); diff --git a/src/libproc_macro/bridge/rpc.rs b/src/libproc_macro/bridge/rpc.rs new file mode 100644 index 00000000000..74ae711a473 --- /dev/null +++ b/src/libproc_macro/bridge/rpc.rs @@ -0,0 +1,315 @@ +//! Serialization for client-server communication. + +use std::any::Any; +use std::char; +use std::io::Write; +use std::num::NonZeroU32; +use std::ops::Bound; +use std::str; + +pub(super) type Writer = super::buffer::Buffer; + +pub(super) trait Encode: Sized { + fn encode(self, w: &mut Writer, s: &mut S); +} + +pub(super) type Reader<'a> = &'a [u8]; + +pub(super) trait Decode<'a, 's, S>: Sized { + fn decode(r: &mut Reader<'a>, s: &'s S) -> Self; +} + +pub(super) trait DecodeMut<'a, 's, S>: Sized { + fn decode(r: &mut Reader<'a>, s: &'s mut S) -> Self; +} + +macro_rules! rpc_encode_decode { + (uleb128 $ty:ty) => { + impl Encode for $ty { + fn encode(mut self, w: &mut Writer, s: &mut S) { + let mut byte = 0x80; + while byte & 0x80 != 0 { + byte = (self & 0x7f) as u8; + self >>= 7; + if self != 0 { + byte |= 0x80; + } + byte.encode(w, s); + } + } + } + + impl DecodeMut<'_, '_, S> for $ty { + fn decode(r: &mut Reader, s: &mut S) -> Self { + let mut byte = 0x80; + let mut v = 0; + let mut shift = 0; + while byte & 0x80 != 0 { + byte = u8::decode(r, s); + v |= ((byte & 0x7f) as Self) << shift; + shift += 7; + } + v + } + } + }; + (struct $name:ident { $($field:ident),* $(,)* }) => { + impl Encode for $name { + fn encode(self, w: &mut Writer, s: &mut S) { + $(self.$field.encode(w, s);)* + } + } + + impl DecodeMut<'_, '_, S> for $name { + fn decode(r: &mut Reader, s: &mut S) -> Self { + $name { + $($field: DecodeMut::decode(r, s)),* + } + } + } + }; + (enum $name:ident $(<$($T:ident),+>)* { $($variant:ident $(($field:ident))*),* $(,)* }) => { + impl),+)*> Encode for $name $(<$($T),+>)* { + fn encode(self, w: &mut Writer, s: &mut S) { + // HACK(eddyb): `Tag` enum duplicated between the + // two impls as there's no other place to stash it. + #[allow(non_upper_case_globals)] + mod tag { + #[repr(u8)] enum Tag { $($variant),* } + + $(pub const $variant: u8 = Tag::$variant as u8;)* + } + + match self { + $($name::$variant $(($field))* => { + tag::$variant.encode(w, s); + $($field.encode(w, s);)* + })* + } + } + } + + impl DecodeMut<'a, 's, S>),+)*> DecodeMut<'a, '_, S> + for $name $(<$($T),+>)* + { + fn decode(r: &mut Reader<'a>, s: &mut S) -> Self { + // HACK(eddyb): `Tag` enum duplicated between the + // two impls as there's no other place to stash it. + #[allow(non_upper_case_globals)] + mod tag { + #[repr(u8)] enum Tag { $($variant),* } + + $(pub const $variant: u8 = Tag::$variant as u8;)* + } + + match u8::decode(r, s) { + $(tag::$variant => { + $(let $field = DecodeMut::decode(r, s);)* + $name::$variant $(($field))* + })* + _ => unreachable!(), + } + } + } + } +} + +impl Encode for () { + fn encode(self, _: &mut Writer, _: &mut S) {} +} + +impl DecodeMut<'_, '_, S> for () { + fn decode(_: &mut Reader, _: &mut S) -> Self {} +} + +impl Encode for u8 { + fn encode(self, w: &mut Writer, _: &mut S) { + w.write_all(&[self]).unwrap(); + } +} + +impl DecodeMut<'_, '_, S> for u8 { + fn decode(r: &mut Reader, _: &mut S) -> Self { + let x = r[0]; + *r = &r[1..]; + x + } +} + +rpc_encode_decode!(uleb128 u32); +rpc_encode_decode!(uleb128 usize); + +impl Encode for bool { + fn encode(self, w: &mut Writer, s: &mut S) { + (self as u8).encode(w, s); + } +} + +impl DecodeMut<'_, '_, S> for bool { + fn decode(r: &mut Reader, s: &mut S) -> Self { + match u8::decode(r, s) { + 0 => false, + 1 => true, + _ => unreachable!(), + } + } +} + +impl Encode for char { + fn encode(self, w: &mut Writer, s: &mut S) { + (self as u32).encode(w, s); + } +} + +impl DecodeMut<'_, '_, S> for char { + fn decode(r: &mut Reader, s: &mut S) -> Self { + char::from_u32(u32::decode(r, s)).unwrap() + } +} + +impl Encode for NonZeroU32 { + fn encode(self, w: &mut Writer, s: &mut S) { + self.get().encode(w, s); + } +} + +impl DecodeMut<'_, '_, S> for NonZeroU32 { + fn decode(r: &mut Reader, s: &mut S) -> Self { + Self::new(u32::decode(r, s)).unwrap() + } +} + +impl, B: Encode> Encode for (A, B) { + fn encode(self, w: &mut Writer, s: &mut S) { + self.0.encode(w, s); + self.1.encode(w, s); + } +} + +impl DecodeMut<'a, 's, S>, B: for<'s> DecodeMut<'a, 's, S>> DecodeMut<'a, '_, S> + for (A, B) +{ + fn decode(r: &mut Reader<'a>, s: &mut S) -> Self { + (DecodeMut::decode(r, s), DecodeMut::decode(r, s)) + } +} + +rpc_encode_decode!( + enum Bound { + Included(x), + Excluded(x), + Unbounded, + } +); + +rpc_encode_decode!( + enum Option { + None, + Some(x), + } +); + +rpc_encode_decode!( + enum Result { + Ok(x), + Err(e), + } +); + +impl Encode for &[u8] { + fn encode(self, w: &mut Writer, s: &mut S) { + self.len().encode(w, s); + w.write_all(self).unwrap(); + } +} + +impl DecodeMut<'a, '_, S> for &'a [u8] { + fn decode(r: &mut Reader<'a>, s: &mut S) -> Self { + let len = usize::decode(r, s); + let xs = &r[..len]; + *r = &r[len..]; + xs + } +} + +impl Encode for &str { + fn encode(self, w: &mut Writer, s: &mut S) { + self.as_bytes().encode(w, s); + } +} + +impl DecodeMut<'a, '_, S> for &'a str { + fn decode(r: &mut Reader<'a>, s: &mut S) -> Self { + str::from_utf8(<&[u8]>::decode(r, s)).unwrap() + } +} + +impl Encode for String { + fn encode(self, w: &mut Writer, s: &mut S) { + self[..].encode(w, s); + } +} + +impl DecodeMut<'_, '_, S> for String { + fn decode(r: &mut Reader, s: &mut S) -> Self { + <&str>::decode(r, s).to_string() + } +} + +/// Simplied version of panic payloads, ignoring +/// types other than `&'static str` and `String`. +pub enum PanicMessage { + StaticStr(&'static str), + String(String), + Unknown, +} + +impl From> for PanicMessage { + fn from(payload: Box) -> Self { + if let Some(s) = payload.downcast_ref::<&'static str>() { + return PanicMessage::StaticStr(s); + } + if let Ok(s) = payload.downcast::() { + return PanicMessage::String(*s); + } + PanicMessage::Unknown + } +} + +impl Into> for PanicMessage { + fn into(self) -> Box { + match self { + PanicMessage::StaticStr(s) => Box::new(s), + PanicMessage::String(s) => Box::new(s), + PanicMessage::Unknown => { + struct UnknownPanicMessage; + Box::new(UnknownPanicMessage) + } + } + } +} + +impl PanicMessage { + pub fn as_str(&self) -> Option<&str> { + match self { + PanicMessage::StaticStr(s) => Some(s), + PanicMessage::String(s) => Some(s), + PanicMessage::Unknown => None, + } + } +} + +impl Encode for PanicMessage { + fn encode(self, w: &mut Writer, s: &mut S) { + self.as_str().encode(w, s); + } +} + +impl DecodeMut<'_, '_, S> for PanicMessage { + fn decode(r: &mut Reader, s: &mut S) -> Self { + match Option::::decode(r, s) { + Some(s) => PanicMessage::String(s), + None => PanicMessage::Unknown, + } + } +} diff --git a/src/libproc_macro/bridge/scoped_cell.rs b/src/libproc_macro/bridge/scoped_cell.rs new file mode 100644 index 00000000000..b1ab27c153e --- /dev/null +++ b/src/libproc_macro/bridge/scoped_cell.rs @@ -0,0 +1,80 @@ +//! `Cell` variant for (scoped) existential lifetimes. + +use std::cell::Cell; +use std::mem; +use std::ops::{Deref, DerefMut}; + +/// Type lambda application, with a lifetime. +pub trait ApplyL<'a> { + type Out; +} + +/// Type lambda taking a lifetime, i.e., `Lifetime -> Type`. +pub trait LambdaL: for<'a> ApplyL<'a> {} + +impl ApplyL<'a>> LambdaL for T {} + +// HACK(eddyb) work around projection limitations with a newtype +// FIXME(#52812) replace with `&'a mut >::Out` +pub struct RefMutL<'a, 'b, T: LambdaL>(&'a mut >::Out); + +impl<'a, 'b, T: LambdaL> Deref for RefMutL<'a, 'b, T> { + type Target = >::Out; + fn deref(&self) -> &Self::Target { + self.0 + } +} + +impl<'a, 'b, T: LambdaL> DerefMut for RefMutL<'a, 'b, T> { + fn deref_mut(&mut self) -> &mut Self::Target { + self.0 + } +} + +pub struct ScopedCell(Cell<>::Out>); + +impl ScopedCell { + pub const fn new(value: >::Out) -> Self { + ScopedCell(Cell::new(value)) + } + + /// Set the value in `self` to `replacement` while + /// running `f`, which gets the old value, mutably. + /// The old value will be restored after `f` exits, even + /// by panic, including modifications made to it by `f`. + pub fn replace<'a, R>( + &self, + replacement: >::Out, + f: impl for<'b, 'c> FnOnce(RefMutL<'b, 'c, T>) -> R, + ) -> R { + /// Wrapper that ensures that the cell always gets filled + /// (with the original state, optionally changed by `f`), + /// even if `f` had panicked. + struct PutBackOnDrop<'a, T: LambdaL> { + cell: &'a ScopedCell, + value: Option<>::Out>, + } + + impl<'a, T: LambdaL> Drop for PutBackOnDrop<'a, T> { + fn drop(&mut self) { + self.cell.0.set(self.value.take().unwrap()); + } + } + + let mut put_back_on_drop = PutBackOnDrop { + cell: self, + value: Some(self.0.replace(unsafe { + let erased = mem::transmute_copy(&replacement); + mem::forget(replacement); + erased + })), + }; + + f(RefMutL(put_back_on_drop.value.as_mut().unwrap())) + } + + /// Set the value in `self` to `value` while running `f`. + pub fn set<'a, R>(&self, value: >::Out, f: impl FnOnce() -> R) -> R { + self.replace(value, |_| f()) + } +} diff --git a/src/libproc_macro/bridge/server.rs b/src/libproc_macro/bridge/server.rs new file mode 100644 index 00000000000..9a7cb1318db --- /dev/null +++ b/src/libproc_macro/bridge/server.rs @@ -0,0 +1,342 @@ +//! Server-side traits. + +use super::*; + +// FIXME(eddyb) generate the definition of `HandleStore` in `server.rs`. +use super::client::HandleStore; + +/// Declare an associated item of one of the traits below, optionally +/// adjusting it (i.e., adding bounds to types and default bodies to methods). +macro_rules! associated_item { + (type TokenStream) => + (type TokenStream: 'static + Clone;); + (type TokenStreamBuilder) => + (type TokenStreamBuilder: 'static;); + (type TokenStreamIter) => + (type TokenStreamIter: 'static + Clone;); + (type Group) => + (type Group: 'static + Clone;); + (type Punct) => + (type Punct: 'static + Copy + Eq + Hash;); + (type Ident) => + (type Ident: 'static + Copy + Eq + Hash;); + (type Literal) => + (type Literal: 'static + Clone;); + (type SourceFile) => + (type SourceFile: 'static + Clone;); + (type MultiSpan) => + (type MultiSpan: 'static;); + (type Diagnostic) => + (type Diagnostic: 'static;); + (type Span) => + (type Span: 'static + Copy + Eq + Hash;); + (fn drop(&mut self, $arg:ident: $arg_ty:ty)) => + (fn drop(&mut self, $arg: $arg_ty) { mem::drop($arg) }); + (fn clone(&mut self, $arg:ident: $arg_ty:ty) -> $ret_ty:ty) => + (fn clone(&mut self, $arg: $arg_ty) -> $ret_ty { $arg.clone() }); + ($($item:tt)*) => ($($item)*;) +} + +macro_rules! declare_server_traits { + ($($name:ident { + $(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)* + }),* $(,)*) => { + pub trait Types { + $(associated_item!(type $name);)* + } + + $(pub trait $name: Types { + $(associated_item!(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)*);)* + })* + + pub trait Server: Types $(+ $name)* {} + impl Server for S {} + } +} +with_api!(Self, self_, declare_server_traits); + +pub(super) struct MarkedTypes(S); + +macro_rules! define_mark_types_impls { + ($($name:ident { + $(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)* + }),* $(,)*) => { + impl Types for MarkedTypes { + $(type $name = Marked;)* + } + + $(impl $name for MarkedTypes { + $(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)* { + <_>::mark($name::$method(&mut self.0, $($arg.unmark()),*)) + })* + })* + } +} +with_api!(Self, self_, define_mark_types_impls); + +struct Dispatcher { + handle_store: HandleStore, + server: S, +} + +macro_rules! define_dispatcher_impl { + ($($name:ident { + $(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)* + }),* $(,)*) => { + // FIXME(eddyb) `pub` only for `ExecutionStrategy` below. + pub trait DispatcherTrait { + // HACK(eddyb) these are here to allow `Self::$name` to work below. + $(type $name;)* + fn dispatch(&mut self, b: Buffer) -> Buffer; + } + + impl DispatcherTrait for Dispatcher> { + $(type $name = as Types>::$name;)* + fn dispatch(&mut self, mut b: Buffer) -> Buffer { + let Dispatcher { handle_store, server } = self; + + let mut reader = &b[..]; + match api_tags::Method::decode(&mut reader, &mut ()) { + $(api_tags::Method::$name(m) => match m { + $(api_tags::$name::$method => { + let mut call_method = || { + reverse_decode!(reader, handle_store; $($arg: $arg_ty),*); + $name::$method(server, $($arg),*) + }; + // HACK(eddyb) don't use `panic::catch_unwind` in a panic. + // If client and server happen to use the same `libstd`, + // `catch_unwind` asserts that the panic counter was 0, + // even when the closure passed to it didn't panic. + let r = if thread::panicking() { + Ok(call_method()) + } else { + panic::catch_unwind(panic::AssertUnwindSafe(call_method)) + .map_err(PanicMessage::from) + }; + + b.clear(); + r.encode(&mut b, handle_store); + })* + }),* + } + b + } + } + } +} +with_api!(Self, self_, define_dispatcher_impl); + +pub trait ExecutionStrategy { + fn run_bridge_and_client( + &self, + dispatcher: &mut impl DispatcherTrait, + input: Buffer, + run_client: extern "C" fn(Bridge, D) -> Buffer, + client_data: D, + ) -> Buffer; +} + +pub struct SameThread; + +impl ExecutionStrategy for SameThread { + fn run_bridge_and_client( + &self, + dispatcher: &mut impl DispatcherTrait, + input: Buffer, + run_client: extern "C" fn(Bridge, D) -> Buffer, + client_data: D, + ) -> Buffer { + let mut dispatch = |b| dispatcher.dispatch(b); + + run_client( + Bridge { + cached_buffer: input, + dispatch: (&mut dispatch).into(), + }, + client_data, + ) + } +} + +// NOTE(eddyb) Two implementations are provided, the second one is a bit +// faster but neither is anywhere near as fast as same-thread execution. + +pub struct CrossThread1; + +impl ExecutionStrategy for CrossThread1 { + fn run_bridge_and_client( + &self, + dispatcher: &mut impl DispatcherTrait, + input: Buffer, + run_client: extern "C" fn(Bridge, D) -> Buffer, + client_data: D, + ) -> Buffer { + use std::sync::mpsc::channel; + + let (req_tx, req_rx) = channel(); + let (res_tx, res_rx) = channel(); + + let join_handle = thread::spawn(move || { + let mut dispatch = |b| { + req_tx.send(b).unwrap(); + res_rx.recv().unwrap() + }; + + run_client( + Bridge { + cached_buffer: input, + dispatch: (&mut dispatch).into(), + }, + client_data, + ) + }); + + for b in req_rx { + res_tx.send(dispatcher.dispatch(b)).unwrap(); + } + + join_handle.join().unwrap() + } +} + +pub struct CrossThread2; + +impl ExecutionStrategy for CrossThread2 { + fn run_bridge_and_client( + &self, + dispatcher: &mut impl DispatcherTrait, + input: Buffer, + run_client: extern "C" fn(Bridge, D) -> Buffer, + client_data: D, + ) -> Buffer { + use std::sync::{Arc, Mutex}; + + enum State { + Req(T), + Res(T), + } + + let mut state = Arc::new(Mutex::new(State::Res(Buffer::new()))); + + let server_thread = thread::current(); + let state2 = state.clone(); + let join_handle = thread::spawn(move || { + let mut dispatch = |b| { + *state2.lock().unwrap() = State::Req(b); + server_thread.unpark(); + loop { + thread::park(); + if let State::Res(b) = &mut *state2.lock().unwrap() { + break b.take(); + } + } + }; + + let r = run_client( + Bridge { + cached_buffer: input, + dispatch: (&mut dispatch).into(), + }, + client_data, + ); + + // Wake up the server so it can exit the dispatch loop. + drop(state2); + server_thread.unpark(); + + r + }); + + // Check whether `state2` was dropped, to know when to stop. + while Arc::get_mut(&mut state).is_none() { + thread::park(); + let mut b = match &mut *state.lock().unwrap() { + State::Req(b) => b.take(), + _ => continue, + }; + b = dispatcher.dispatch(b.take()); + *state.lock().unwrap() = State::Res(b); + join_handle.thread().unpark(); + } + + join_handle.join().unwrap() + } +} + +fn run_server< + S: Server, + I: Encode>>, + O: for<'a, 's> DecodeMut<'a, 's, HandleStore>>, + D: Copy + Send + 'static, +>( + strategy: &impl ExecutionStrategy, + handle_counters: &'static client::HandleCounters, + server: S, + input: I, + run_client: extern "C" fn(Bridge, D) -> Buffer, + client_data: D, +) -> Result { + let mut dispatcher = Dispatcher { + handle_store: HandleStore::new(handle_counters), + server: MarkedTypes(server), + }; + + let mut b = Buffer::new(); + input.encode(&mut b, &mut dispatcher.handle_store); + + b = strategy.run_bridge_and_client(&mut dispatcher, b, run_client, client_data); + + Result::decode(&mut &b[..], &mut dispatcher.handle_store) +} + +impl client::Client ::TokenStream> { + pub fn run( + &self, + strategy: &impl ExecutionStrategy, + server: S, + input: S::TokenStream, + ) -> Result { + let client::Client { + get_handle_counters, + run, + f, + } = *self; + run_server( + strategy, + get_handle_counters(), + server, + as Types>::TokenStream::mark(input), + run, + f, + ) + .map( as Types>::TokenStream::unmark) + } +} + +impl client::Client ::TokenStream> { + pub fn run( + &self, + strategy: &impl ExecutionStrategy, + server: S, + input: S::TokenStream, + input2: S::TokenStream, + ) -> Result { + let client::Client { + get_handle_counters, + run, + f, + } = *self; + run_server( + strategy, + get_handle_counters(), + server, + ( + as Types>::TokenStream::mark(input), + as Types>::TokenStream::mark(input2), + ), + run, + f, + ) + .map( as Types>::TokenStream::unmark) + } +} diff --git a/src/libproc_macro/diagnostic.rs b/src/libproc_macro/diagnostic.rs index bf23de39437..64d0c3893c7 100644 --- a/src/libproc_macro/diagnostic.rs +++ b/src/libproc_macro/diagnostic.rs @@ -1,17 +1,5 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use Span; -use rustc_errors as errors; - /// An enum representing a diagnostic level. #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] #[derive(Copy, Clone, Debug)] @@ -180,22 +168,22 @@ impl Diagnostic { /// Emit the diagnostic. #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] pub fn emit(self) { - fn to_internal(spans: Vec) -> ::syntax_pos::MultiSpan { - let spans: Vec<_> = spans.into_iter().map(|s| s.0).collect(); - ::syntax_pos::MultiSpan::from_spans(spans) + fn to_internal(spans: Vec) -> ::bridge::client::MultiSpan { + let mut multi_span = ::bridge::client::MultiSpan::new(); + for span in spans { + multi_span.push(span.0); + } + multi_span } - let level = self.level.to_internal(); - let mut diag = errors::Diagnostic::new(level, &*self.message); - diag.set_span(to_internal(self.spans)); - - for child in self.children { - let level = child.level.to_internal(); - diag.sub(level, &*child.message, to_internal(child.spans), None); + let mut diag = ::bridge::client::Diagnostic::new( + self.level, + &self.message[..], + to_internal(self.spans), + ); + for c in self.children { + diag.sub(c.level, &c.message[..], to_internal(c.spans)); } - - ::__internal::with_sess(move |sess, _| { - errors::DiagnosticBuilder::new_diagnostic(&sess.span_diagnostic, diag).emit(); - }); + diag.emit(); } } diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index 60b6a8bac41..868190d0105 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A support library for macro authors when defining new macros. //! //! This library, provided by the standard distribution, provides the types @@ -28,39 +18,30 @@ test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))] #![feature(nll)] -#![feature(rustc_private)] #![feature(staged_api)] -#![feature(lang_items)] +#![feature(const_fn)] +#![feature(extern_types)] +#![feature(in_band_lifetimes)] #![feature(optin_builtin_traits)] #![feature(non_exhaustive)] +#![feature(specialization)] #![recursion_limit="256"] -extern crate syntax; -extern crate syntax_pos; -extern crate rustc_errors; -extern crate rustc_data_structures; - #[unstable(feature = "proc_macro_internals", issue = "27812")] #[doc(hidden)] -pub mod rustc; +pub mod bridge; mod diagnostic; #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] pub use diagnostic::{Diagnostic, Level, MultiSpan}; -use std::{ascii, fmt, iter}; +use std::{fmt, iter, mem}; +use std::ops::{Bound, RangeBounds}; use std::path::PathBuf; -use rustc_data_structures::sync::Lrc; use std::str::FromStr; -use syntax::errors::DiagnosticBuilder; -use syntax::parse::{self, token}; -use syntax::symbol::Symbol; -use syntax::tokenstream::{self, DelimSpan}; -use syntax_pos::{Pos, FileName}; - /// The main type provided by this crate, representing an abstract stream of /// tokens, or, more specifically, a sequence of token trees. /// The type provide interfaces for iterating over those token trees and, conversely, @@ -70,7 +51,7 @@ use syntax_pos::{Pos, FileName}; /// and `#[proc_macro_derive]` definitions. #[stable(feature = "proc_macro_lib", since = "1.15.0")] #[derive(Clone)] -pub struct TokenStream(tokenstream::TokenStream); +pub struct TokenStream(bridge::client::TokenStream); #[stable(feature = "proc_macro_lib", since = "1.15.0")] impl !Send for TokenStream {} @@ -93,7 +74,7 @@ impl TokenStream { /// Returns an empty `TokenStream` containing no token trees. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn new() -> TokenStream { - TokenStream(tokenstream::TokenStream::empty()) + TokenStream(bridge::client::TokenStream::new()) } /// Checks if this `TokenStream` is empty. @@ -115,11 +96,16 @@ impl FromStr for TokenStream { type Err = LexError; fn from_str(src: &str) -> Result { - __internal::with_sess(|sess, data| { - Ok(__internal::token_stream_wrap(parse::parse_stream_from_source_str( - FileName::ProcMacroSourceCode, src.to_string(), sess, Some(data.call_site.0) - ))) - }) + Ok(TokenStream(bridge::client::TokenStream::from_str(src))) + } +} + +// N.B., the bridge only provides `to_string`, implement `fmt::Display` +// based on it (the reverse of the usual relationship between the two). +#[stable(feature = "proc_macro_lib", since = "1.15.0")] +impl ToString for TokenStream { + fn to_string(&self) -> String { + self.0.to_string() } } @@ -129,7 +115,7 @@ impl FromStr for TokenStream { #[stable(feature = "proc_macro_lib", since = "1.15.0")] impl fmt::Display for TokenStream { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.0.fmt(f) + f.write_str(&self.to_string()) } } @@ -149,7 +135,12 @@ pub use quote::{quote, quote_span}; #[stable(feature = "proc_macro_lib2", since = "1.29.0")] impl From for TokenStream { fn from(tree: TokenTree) -> TokenStream { - TokenStream(tree.to_internal()) + TokenStream(bridge::client::TokenStream::from_token_tree(match tree { + TokenTree::Group(tt) => bridge::TokenTree::Group(tt.0), + TokenTree::Punct(tt) => bridge::TokenTree::Punct(tt.0), + TokenTree::Ident(tt) => bridge::TokenTree::Ident(tt.0), + TokenTree::Literal(tt) => bridge::TokenTree::Literal(tt.0) + })) } } @@ -166,7 +157,7 @@ impl iter::FromIterator for TokenStream { #[stable(feature = "proc_macro_lib", since = "1.15.0")] impl iter::FromIterator for TokenStream { fn from_iter>(streams: I) -> Self { - let mut builder = tokenstream::TokenStreamBuilder::new(); + let mut builder = bridge::client::TokenStreamBuilder::new(); for stream in streams { builder.push(stream.0); } @@ -184,52 +175,34 @@ impl Extend for TokenStream { #[stable(feature = "token_stream_extend", since = "1.30.0")] impl Extend for TokenStream { fn extend>(&mut self, streams: I) { - self.0.extend(streams.into_iter().map(|stream| stream.0)); + // FIXME(eddyb) Use an optimized implementation if/when possible. + *self = iter::once(mem::replace(self, Self::new())).chain(streams).collect(); } } /// Public implementation details for the `TokenStream` type, such as iterators. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub mod token_stream { - use syntax::tokenstream; - use {TokenTree, TokenStream, Delimiter}; + use {bridge, Group, Ident, Literal, Punct, TokenTree, TokenStream}; /// An iterator over `TokenStream`'s `TokenTree`s. - /// The iteration is "shallow", e.g. the iterator doesn't recurse into delimited groups, + /// The iteration is "shallow", e.g., the iterator doesn't recurse into delimited groups, /// and returns whole groups as token trees. #[derive(Clone)] #[stable(feature = "proc_macro_lib2", since = "1.29.0")] - pub struct IntoIter { - cursor: tokenstream::Cursor, - stack: Vec, - } + pub struct IntoIter(bridge::client::TokenStreamIter); #[stable(feature = "proc_macro_lib2", since = "1.29.0")] impl Iterator for IntoIter { type Item = TokenTree; fn next(&mut self) -> Option { - loop { - let tree = self.stack.pop().or_else(|| { - let next = self.cursor.next_as_stream()?; - Some(TokenTree::from_internal(next, &mut self.stack)) - })?; - // HACK: The condition "dummy span + group with empty delimiter" represents an AST - // fragment approximately converted into a token stream. This may happen, for - // example, with inputs to proc macro attributes, including derives. Such "groups" - // need to flattened during iteration over stream's token trees. - // Eventually this needs to be removed in favor of keeping original token trees - // and not doing the roundtrip through AST. - if tree.span().0.is_dummy() { - if let TokenTree::Group(ref group) = tree { - if group.delimiter() == Delimiter::None { - self.cursor.insert(group.stream.clone().0); - continue - } - } - } - return Some(tree); - } + self.0.next().map(|tree| match tree { + bridge::TokenTree::Group(tt) => TokenTree::Group(Group(tt)), + bridge::TokenTree::Punct(tt) => TokenTree::Punct(Punct(tt)), + bridge::TokenTree::Ident(tt) => TokenTree::Ident(Ident(tt)), + bridge::TokenTree::Literal(tt) => TokenTree::Literal(Literal(tt)), + }) } } @@ -239,7 +212,7 @@ pub mod token_stream { type IntoIter = IntoIter; fn into_iter(self) -> IntoIter { - IntoIter { cursor: self.0.trees(), stack: Vec::new() } + IntoIter(self.0.into_iter()) } } } @@ -263,7 +236,7 @@ mod quote; /// A region of source code, along with macro expansion information. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] #[derive(Copy, Clone)] -pub struct Span(syntax_pos::Span); +pub struct Span(bridge::client::Span); #[stable(feature = "proc_macro_lib2", since = "1.29.0")] impl !Send for Span {} @@ -285,7 +258,7 @@ impl Span { /// A span that resolves at the macro definition site. #[unstable(feature = "proc_macro_def_site", issue = "54724")] pub fn def_site() -> Span { - ::__internal::with_sess(|_, data| data.def_site) + Span(bridge::client::Span::def_site()) } /// The span of the invocation of the current procedural macro. @@ -294,15 +267,13 @@ impl Span { /// at the macro call site will be able to refer to them as well. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn call_site() -> Span { - ::__internal::with_sess(|_, data| data.call_site) + Span(bridge::client::Span::call_site()) } /// The original source file into which this span points. #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn source_file(&self) -> SourceFile { - SourceFile { - source_file: __internal::lookup_char_pos(self.0.lo()).file, - } + SourceFile(self.0.source_file()) } /// The `Span` for the tokens in the previous macro expansion from which @@ -317,27 +288,19 @@ impl Span { /// value is the same as `*self`. #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn source(&self) -> Span { - Span(self.0.source_callsite()) + Span(self.0.source()) } /// Get the starting line/column in the source file for this span. #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn start(&self) -> LineColumn { - let loc = __internal::lookup_char_pos(self.0.lo()); - LineColumn { - line: loc.line, - column: loc.col.to_usize() - } + self.0.start() } /// Get the ending line/column in the source file for this span. #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn end(&self) -> LineColumn { - let loc = __internal::lookup_char_pos(self.0.hi()); - LineColumn { - line: loc.line, - column: loc.col.to_usize() - } + self.0.end() } /// Create a new span encompassing `self` and `other`. @@ -345,19 +308,14 @@ impl Span { /// Returns `None` if `self` and `other` are from different files. #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn join(&self, other: Span) -> Option { - let self_loc = __internal::lookup_char_pos(self.0.lo()); - let other_loc = __internal::lookup_char_pos(other.0.lo()); - - if self_loc.file.name != other_loc.file.name { return None } - - Some(Span(self.0.to(other.0))) + self.0.join(other.0).map(Span) } /// Creates a new span with the same line/column information as `self` but /// that resolves symbols as though it were at `other`. #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn resolved_at(&self, other: Span) -> Span { - Span(self.0.with_ctxt(other.0.ctxt())) + Span(self.0.resolved_at(other.0)) } /// Creates a new span with the same name resolution behavior as `self` but @@ -383,10 +341,7 @@ impl Span { #[stable(feature = "proc_macro_lib2", since = "1.29.0")] impl fmt::Debug for Span { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{:?} bytes({}..{})", - self.0.ctxt(), - self.0.lo().0, - self.0.hi().0) + self.0.fmt(f) } } @@ -411,14 +366,7 @@ impl !Sync for LineColumn {} /// The source file of a given `Span`. #[unstable(feature = "proc_macro_span", issue = "54725")] #[derive(Clone)] -pub struct SourceFile { - source_file: Lrc, -} - -#[unstable(feature = "proc_macro_span", issue = "54725")] -impl !Send for SourceFile {} -#[unstable(feature = "proc_macro_span", issue = "54725")] -impl !Sync for SourceFile {} +pub struct SourceFile(bridge::client::SourceFile); impl SourceFile { /// Get the path to this source file. @@ -433,10 +381,7 @@ impl SourceFile { /// [`is_real`]: #method.is_real #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn path(&self) -> PathBuf { - match self.source_file.name { - FileName::Real(ref path) => path.clone(), - _ => PathBuf::from(self.source_file.name.to_string()) - } + PathBuf::from(self.0.path()) } /// Returns `true` if this source file is a real source file, and not generated by an external @@ -446,7 +391,7 @@ impl SourceFile { // This is a hack until intercrate spans are implemented and we can have real source files // for spans generated in external macros. // https://github.com/rust-lang/rust/pull/43604#issuecomment-333334368 - self.source_file.is_real_file() + self.0.is_real() } } @@ -464,14 +409,14 @@ impl fmt::Debug for SourceFile { #[unstable(feature = "proc_macro_span", issue = "54725")] impl PartialEq for SourceFile { fn eq(&self, other: &Self) -> bool { - Lrc::ptr_eq(&self.source_file, &other.source_file) + self.0.eq(&other.0) } } #[unstable(feature = "proc_macro_span", issue = "54725")] impl Eq for SourceFile {} -/// A single token or a delimited sequence of token trees (e.g. `[1, (), ..]`). +/// A single token or a delimited sequence of token trees (e.g., `[1, (), ..]`). #[stable(feature = "proc_macro_lib2", since = "1.29.0")] #[derive(Clone)] pub enum TokenTree { @@ -578,18 +523,27 @@ impl From for TokenTree { } } +// N.B., the bridge only provides `to_string`, implement `fmt::Display` +// based on it (the reverse of the usual relationship between the two). +#[stable(feature = "proc_macro_lib", since = "1.15.0")] +impl ToString for TokenTree { + fn to_string(&self) -> String { + match *self { + TokenTree::Group(ref t) => t.to_string(), + TokenTree::Ident(ref t) => t.to_string(), + TokenTree::Punct(ref t) => t.to_string(), + TokenTree::Literal(ref t) => t.to_string(), + } + } +} + /// Prints the token tree as a string that is supposed to be losslessly convertible back /// into the same token tree (modulo spans), except for possibly `TokenTree::Group`s /// with `Delimiter::None` delimiters and negative numeric literals. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] impl fmt::Display for TokenTree { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - TokenTree::Group(ref t) => t.fmt(f), - TokenTree::Ident(ref t) => t.fmt(f), - TokenTree::Punct(ref t) => t.fmt(f), - TokenTree::Literal(ref t) => t.fmt(f), - } + f.write_str(&self.to_string()) } } @@ -598,11 +552,7 @@ impl fmt::Display for TokenTree { /// A `Group` internally contains a `TokenStream` which is surrounded by `Delimiter`s. #[derive(Clone)] #[stable(feature = "proc_macro_lib2", since = "1.29.0")] -pub struct Group { - delimiter: Delimiter, - stream: TokenStream, - span: DelimSpan, -} +pub struct Group(bridge::client::Group); #[stable(feature = "proc_macro_lib2", since = "1.29.0")] impl !Send for Group {} @@ -639,17 +589,13 @@ impl Group { /// method below. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn new(delimiter: Delimiter, stream: TokenStream) -> Group { - Group { - delimiter: delimiter, - stream: stream, - span: DelimSpan::from_single(Span::call_site().0), - } + Group(bridge::client::Group::new(delimiter, stream.0)) } /// Returns the delimiter of this `Group` #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn delimiter(&self) -> Delimiter { - self.delimiter + self.0.delimiter() } /// Returns the `TokenStream` of tokens that are delimited in this `Group`. @@ -658,7 +604,7 @@ impl Group { /// returned above. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn stream(&self) -> TokenStream { - self.stream.clone() + TokenStream(self.0.stream()) } /// Returns the span for the delimiters of this token stream, spanning the @@ -670,7 +616,7 @@ impl Group { /// ``` #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn span(&self) -> Span { - Span(self.span.entire()) + Span(self.0.span()) } /// Returns the span pointing to the opening delimiter of this group. @@ -681,7 +627,7 @@ impl Group { /// ``` #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn span_open(&self) -> Span { - Span(self.span.open) + Span(self.0.span_open()) } /// Returns the span pointing to the closing delimiter of this group. @@ -692,7 +638,7 @@ impl Group { /// ``` #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn span_close(&self) -> Span { - Span(self.span.close) + Span(self.0.span_close()) } /// Configures the span for this `Group`'s delimiters, but not its internal @@ -703,7 +649,16 @@ impl Group { /// tokens at the level of the `Group`. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn set_span(&mut self, span: Span) { - self.span = DelimSpan::from_single(span.0); + self.0.set_span(span.0); + } +} + +// N.B., the bridge only provides `to_string`, implement `fmt::Display` +// based on it (the reverse of the usual relationship between the two). +#[stable(feature = "proc_macro_lib", since = "1.15.0")] +impl ToString for Group { + fn to_string(&self) -> String { + TokenStream::from(TokenTree::from(self.clone())).to_string() } } @@ -713,7 +668,7 @@ impl Group { #[stable(feature = "proc_macro_lib2", since = "1.29.0")] impl fmt::Display for Group { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - TokenStream::from(TokenTree::from(self.clone())).fmt(f) + f.write_str(&self.to_string()) } } @@ -734,11 +689,7 @@ impl fmt::Debug for Group { /// forms of `Spacing` returned. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] #[derive(Clone)] -pub struct Punct { - ch: char, - spacing: Spacing, - span: Span, -} +pub struct Punct(bridge::client::Punct); #[stable(feature = "proc_macro_lib2", since = "1.29.0")] impl !Send for Punct {} @@ -750,10 +701,10 @@ impl !Sync for Punct {} #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub enum Spacing { - /// E.g. `+` is `Alone` in `+ =`, `+ident` or `+()`. + /// e.g., `+` is `Alone` in `+ =`, `+ident` or `+()`. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] Alone, - /// E.g. `+` is `Joint` in `+=` or `'#`. + /// e.g., `+` is `Joint` in `+=` or `'#`. /// Additionally, single quote `'` can join with identifiers to form lifetimes `'ident`. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] Joint, @@ -768,22 +719,13 @@ impl Punct { /// which can be further configured with the `set_span` method below. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn new(ch: char, spacing: Spacing) -> Punct { - const LEGAL_CHARS: &[char] = &['=', '<', '>', '!', '~', '+', '-', '*', '/', '%', '^', - '&', '|', '@', '.', ',', ';', ':', '#', '$', '?', '\'']; - if !LEGAL_CHARS.contains(&ch) { - panic!("unsupported character `{:?}`", ch) - } - Punct { - ch: ch, - spacing: spacing, - span: Span::call_site(), - } + Punct(bridge::client::Punct::new(ch, spacing)) } /// Returns the value of this punctuation character as `char`. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn as_char(&self) -> char { - self.ch + self.0.as_char() } /// Returns the spacing of this punctuation character, indicating whether it's immediately @@ -792,19 +734,28 @@ impl Punct { /// (`Alone`) so the operator has certainly ended. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn spacing(&self) -> Spacing { - self.spacing + self.0.spacing() } /// Returns the span for this punctuation character. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn span(&self) -> Span { - self.span + Span(self.0.span()) } /// Configure the span for this punctuation character. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn set_span(&mut self, span: Span) { - self.span = span; + self.0 = self.0.with_span(span.0); + } +} + +// N.B., the bridge only provides `to_string`, implement `fmt::Display` +// based on it (the reverse of the usual relationship between the two). +#[stable(feature = "proc_macro_lib", since = "1.15.0")] +impl ToString for Punct { + fn to_string(&self) -> String { + TokenStream::from(TokenTree::from(self.clone())).to_string() } } @@ -813,7 +764,7 @@ impl Punct { #[stable(feature = "proc_macro_lib2", since = "1.29.0")] impl fmt::Display for Punct { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - TokenStream::from(TokenTree::from(self.clone())).fmt(f) + f.write_str(&self.to_string()) } } @@ -831,28 +782,9 @@ impl fmt::Debug for Punct { /// An identifier (`ident`). #[derive(Clone)] #[stable(feature = "proc_macro_lib2", since = "1.29.0")] -pub struct Ident { - sym: Symbol, - span: Span, - is_raw: bool, -} - -#[stable(feature = "proc_macro_lib2", since = "1.29.0")] -impl !Send for Ident {} -#[stable(feature = "proc_macro_lib2", since = "1.29.0")] -impl !Sync for Ident {} +pub struct Ident(bridge::client::Ident); impl Ident { - fn is_valid(string: &str) -> bool { - let mut chars = string.chars(); - if let Some(start) = chars.next() { - (start == '_' || start.is_xid_start()) - && chars.all(|cont| cont == '_' || cont.is_xid_continue()) - } else { - false - } - } - /// Creates a new `Ident` with the given `string` as well as the specified /// `span`. /// The `string` argument must be a valid identifier permitted by the @@ -874,32 +806,35 @@ impl Ident { /// tokens, requires a `Span` to be specified at construction. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn new(string: &str, span: Span) -> Ident { - if !Ident::is_valid(string) { - panic!("`{:?}` is not a valid identifier", string) - } - Ident::new_maybe_raw(string, span, false) + Ident(bridge::client::Ident::new(string, span.0, false)) } /// Same as `Ident::new`, but creates a raw identifier (`r#ident`). #[unstable(feature = "proc_macro_raw_ident", issue = "54723")] pub fn new_raw(string: &str, span: Span) -> Ident { - if !Ident::is_valid(string) { - panic!("`{:?}` is not a valid identifier", string) - } - Ident::new_maybe_raw(string, span, true) + Ident(bridge::client::Ident::new(string, span.0, true)) } /// Returns the span of this `Ident`, encompassing the entire string returned /// by `as_str`. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn span(&self) -> Span { - self.span + Span(self.0.span()) } /// Configures the span of this `Ident`, possibly changing its hygiene context. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn set_span(&mut self, span: Span) { - self.span = span; + self.0 = self.0.with_span(span.0); + } +} + +// N.B., the bridge only provides `to_string`, implement `fmt::Display` +// based on it (the reverse of the usual relationship between the two). +#[stable(feature = "proc_macro_lib", since = "1.15.0")] +impl ToString for Ident { + fn to_string(&self) -> String { + TokenStream::from(TokenTree::from(self.clone())).to_string() } } @@ -908,7 +843,7 @@ impl Ident { #[stable(feature = "proc_macro_lib2", since = "1.29.0")] impl fmt::Display for Ident { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - TokenStream::from(TokenTree::from(self.clone())).fmt(f) + f.write_str(&self.to_string()) } } @@ -926,19 +861,9 @@ impl fmt::Debug for Ident { /// character (`'a'`), byte character (`b'a'`), an integer or floating point number /// with or without a suffix (`1`, `1u8`, `2.3`, `2.3f32`). /// Boolean literals like `true` and `false` do not belong here, they are `Ident`s. -// FIXME(eddyb) `Literal` should not expose internal `Debug` impls. -#[derive(Clone, Debug)] -#[stable(feature = "proc_macro_lib2", since = "1.29.0")] -pub struct Literal { - lit: token::Lit, - suffix: Option, - span: Span, -} - -#[stable(feature = "proc_macro_lib2", since = "1.29.0")] -impl !Send for Literal {} +#[derive(Clone)] #[stable(feature = "proc_macro_lib2", since = "1.29.0")] -impl !Sync for Literal {} +pub struct Literal(bridge::client::Literal); macro_rules! suffixed_int_literals { ($($name:ident => $kind:ident,)*) => ($( @@ -955,11 +880,7 @@ macro_rules! suffixed_int_literals { /// below. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn $name(n: $kind) -> Literal { - Literal { - lit: token::Lit::Integer(Symbol::intern(&n.to_string())), - suffix: Some(Symbol::intern(stringify!($kind))), - span: Span::call_site(), - } + Literal(bridge::client::Literal::typed_integer(&n.to_string(), stringify!($kind))) } )*) } @@ -981,11 +902,7 @@ macro_rules! unsuffixed_int_literals { /// below. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn $name(n: $kind) -> Literal { - Literal { - lit: token::Lit::Integer(Symbol::intern(&n.to_string())), - suffix: None, - span: Span::call_site(), - } + Literal(bridge::client::Literal::integer(&n.to_string())) } )*) } @@ -1038,11 +955,7 @@ impl Literal { if !n.is_finite() { panic!("Invalid float literal {}", n); } - Literal { - lit: token::Lit::Float(Symbol::intern(&n.to_string())), - suffix: None, - span: Span::call_site(), - } + Literal(bridge::client::Literal::float(&n.to_string())) } /// Creates a new suffixed floating-point literal. @@ -1063,11 +976,7 @@ impl Literal { if !n.is_finite() { panic!("Invalid float literal {}", n); } - Literal { - lit: token::Lit::Float(Symbol::intern(&n.to_string())), - suffix: Some(Symbol::intern("f32")), - span: Span::call_site(), - } + Literal(bridge::client::Literal::f32(&n.to_string())) } /// Creates a new unsuffixed floating-point literal. @@ -1087,11 +996,7 @@ impl Literal { if !n.is_finite() { panic!("Invalid float literal {}", n); } - Literal { - lit: token::Lit::Float(Symbol::intern(&n.to_string())), - suffix: None, - span: Span::call_site(), - } + Literal(bridge::client::Literal::float(&n.to_string())) } /// Creates a new suffixed floating-point literal. @@ -1112,61 +1017,74 @@ impl Literal { if !n.is_finite() { panic!("Invalid float literal {}", n); } - Literal { - lit: token::Lit::Float(Symbol::intern(&n.to_string())), - suffix: Some(Symbol::intern("f64")), - span: Span::call_site(), - } + Literal(bridge::client::Literal::f64(&n.to_string())) } /// String literal. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn string(string: &str) -> Literal { - let mut escaped = String::new(); - for ch in string.chars() { - escaped.extend(ch.escape_debug()); - } - Literal { - lit: token::Lit::Str_(Symbol::intern(&escaped)), - suffix: None, - span: Span::call_site(), - } + Literal(bridge::client::Literal::string(string)) } /// Character literal. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn character(ch: char) -> Literal { - let mut escaped = String::new(); - escaped.extend(ch.escape_unicode()); - Literal { - lit: token::Lit::Char(Symbol::intern(&escaped)), - suffix: None, - span: Span::call_site(), - } + Literal(bridge::client::Literal::character(ch)) } /// Byte string literal. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn byte_string(bytes: &[u8]) -> Literal { - let string = bytes.iter().cloned().flat_map(ascii::escape_default) - .map(Into::::into).collect::(); - Literal { - lit: token::Lit::ByteStr(Symbol::intern(&string)), - suffix: None, - span: Span::call_site(), - } + Literal(bridge::client::Literal::byte_string(bytes)) } /// Returns the span encompassing this literal. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn span(&self) -> Span { - self.span + Span(self.0.span()) } /// Configures the span associated for this literal. #[stable(feature = "proc_macro_lib2", since = "1.29.0")] pub fn set_span(&mut self, span: Span) { - self.span = span; + self.0.set_span(span.0); + } + + /// Returns a `Span` that is a subset of `self.span()` containing only the + /// source bytes in range `range`. Returns `None` if the would-be trimmed + /// span is outside the bounds of `self`. + // FIXME(SergioBenitez): check that the byte range starts and ends at a + // UTF-8 boundary of the source. otherwise, it's likely that a panic will + // occur elsewhere when the source text is printed. + // FIXME(SergioBenitez): there is no way for the user to know what + // `self.span()` actually maps to, so this method can currently only be + // called blindly. For example, `to_string()` for the character 'c' returns + // "'\u{63}'"; there is no way for the user to know whether the source text + // was 'c' or whether it was '\u{63}'. + #[unstable(feature = "proc_macro_span", issue = "54725")] + pub fn subspan>(&self, range: R) -> Option { + // HACK(eddyb) something akin to `Option::cloned`, but for `Bound<&T>`. + fn cloned_bound(bound: Bound<&T>) -> Bound { + match bound { + Bound::Included(x) => Bound::Included(x.clone()), + Bound::Excluded(x) => Bound::Excluded(x.clone()), + Bound::Unbounded => Bound::Unbounded, + } + } + + self.0.subspan( + cloned_bound(range.start_bound()), + cloned_bound(range.end_bound()), + ).map(Span) + } +} + +// N.B., the bridge only provides `to_string`, implement `fmt::Display` +// based on it (the reverse of the usual relationship between the two). +#[stable(feature = "proc_macro_lib", since = "1.15.0")] +impl ToString for Literal { + fn to_string(&self) -> String { + TokenStream::from(TokenTree::from(self.clone())).to_string() } } @@ -1175,149 +1093,14 @@ impl Literal { #[stable(feature = "proc_macro_lib2", since = "1.29.0")] impl fmt::Display for Literal { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - TokenStream::from(TokenTree::from(self.clone())).fmt(f) + f.write_str(&self.to_string()) } } -/// Permanently unstable internal implementation details of this crate. This -/// should not be used. -/// -/// These methods are used by the rest of the compiler to generate instances of -/// `TokenStream` to hand to macro definitions, as well as consume the output. -/// -/// Note that this module is also intentionally separate from the rest of the -/// crate. This allows the `#[unstable]` directive below to naturally apply to -/// all of the contents. -#[unstable(feature = "proc_macro_internals", issue = "27812")] -#[doc(hidden)] -pub mod __internal { - use std::cell::Cell; - use std::ptr; - - use syntax::ast; - use syntax::ext::base::ExtCtxt; - use syntax::ptr::P; - use syntax::parse::{self, ParseSess}; - use syntax::parse::token::{self, Token}; - use syntax::tokenstream; - use syntax_pos::{BytePos, Loc, DUMMY_SP}; - use syntax_pos::hygiene::{SyntaxContext, Transparency}; - - use super::{TokenStream, LexError, Span}; - - pub fn lookup_char_pos(pos: BytePos) -> Loc { - with_sess(|sess, _| sess.source_map().lookup_char_pos(pos)) - } - - pub fn new_token_stream(item: P) -> TokenStream { - let token = Token::interpolated(token::NtItem(item)); - TokenStream(tokenstream::TokenTree::Token(DUMMY_SP, token).into()) - } - - pub fn token_stream_wrap(inner: tokenstream::TokenStream) -> TokenStream { - TokenStream(inner) - } - - pub fn token_stream_parse_items(stream: TokenStream) -> Result>, LexError> { - with_sess(move |sess, _| { - let mut parser = parse::stream_to_parser(sess, stream.0); - let mut items = Vec::new(); - - while let Some(item) = try!(parser.parse_item().map_err(super::parse_to_lex_err)) { - items.push(item) - } - - Ok(items) - }) - } - - pub fn token_stream_inner(stream: TokenStream) -> tokenstream::TokenStream { - stream.0 - } - - pub trait Registry { - fn register_custom_derive(&mut self, - trait_name: &str, - expand: fn(TokenStream) -> TokenStream, - attributes: &[&'static str]); - - fn register_attr_proc_macro(&mut self, - name: &str, - expand: fn(TokenStream, TokenStream) -> TokenStream); - - fn register_bang_proc_macro(&mut self, - name: &str, - expand: fn(TokenStream) -> TokenStream); - } - - #[derive(Clone, Copy)] - pub struct ProcMacroData { - pub def_site: Span, - pub call_site: Span, - } - - #[derive(Clone, Copy)] - struct ProcMacroSess { - parse_sess: *const ParseSess, - data: ProcMacroData, - } - - // Emulate scoped_thread_local!() here essentially - thread_local! { - static CURRENT_SESS: Cell = Cell::new(ProcMacroSess { - parse_sess: ptr::null(), - data: ProcMacroData { def_site: Span(DUMMY_SP), call_site: Span(DUMMY_SP) }, - }); - } - - pub fn set_sess(cx: &ExtCtxt, f: F) -> R - where F: FnOnce() -> R - { - struct Reset { prev: ProcMacroSess } - - impl Drop for Reset { - fn drop(&mut self) { - CURRENT_SESS.with(|p| p.set(self.prev)); - } - } - - CURRENT_SESS.with(|p| { - let _reset = Reset { prev: p.get() }; - - // No way to determine def location for a proc macro right now, so use call location. - let location = cx.current_expansion.mark.expn_info().unwrap().call_site; - let to_span = |transparency| Span(location.with_ctxt( - SyntaxContext::empty().apply_mark_with_transparency(cx.current_expansion.mark, - transparency)) - ); - p.set(ProcMacroSess { - parse_sess: cx.parse_sess, - data: ProcMacroData { - def_site: to_span(Transparency::Opaque), - call_site: to_span(Transparency::Transparent), - }, - }); - f() - }) - } - - pub fn in_sess() -> bool - { - !CURRENT_SESS.with(|sess| sess.get()).parse_sess.is_null() - } - - pub fn with_sess(f: F) -> R - where F: FnOnce(&ParseSess, &ProcMacroData) -> R - { - let sess = CURRENT_SESS.with(|sess| sess.get()); - if sess.parse_sess.is_null() { - panic!("procedural macro API is used outside of a procedural macro"); - } - f(unsafe { &*sess.parse_sess }, &sess.data) +#[stable(feature = "proc_macro_lib2", since = "1.29.0")] +impl fmt::Debug for Literal { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + // FIXME(eddyb) `Literal` should not expose internal `Debug` impls. + self.0.fmt(f) } } - -fn parse_to_lex_err(mut err: DiagnosticBuilder) -> LexError { - err.cancel(); - LexError { _inner: () } -} diff --git a/src/libproc_macro/quote.rs b/src/libproc_macro/quote.rs index 0f454a79055..bd7e96210a9 100644 --- a/src/libproc_macro/quote.rs +++ b/src/libproc_macro/quote.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! # Quasiquoter //! This file contains the implementation internals of the quasiquoter provided by `quote!`. diff --git a/src/libproc_macro/rustc.rs b/src/libproc_macro/rustc.rs deleted file mode 100644 index 3ce02d1afb1..00000000000 --- a/src/libproc_macro/rustc.rs +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use {Delimiter, Level, Spacing, Span, __internal}; -use {Group, Ident, Literal, Punct, TokenTree}; - -use rustc_errors as errors; -use syntax::ast; -use syntax::parse::lexer::comments; -use syntax::parse::token; -use syntax::tokenstream; -use syntax_pos::symbol::{keywords, Symbol}; - -impl Ident { - pub(crate) fn new_maybe_raw(string: &str, span: Span, is_raw: bool) -> Ident { - let sym = Symbol::intern(string); - if is_raw - && (sym == keywords::Underscore.name() - || ast::Ident::with_empty_ctxt(sym).is_path_segment_keyword()) - { - panic!("`{:?}` is not a valid raw identifier", string) - } - Ident { sym, span, is_raw } - } -} - -impl Delimiter { - pub(crate) fn from_internal(delim: token::DelimToken) -> Delimiter { - match delim { - token::Paren => Delimiter::Parenthesis, - token::Brace => Delimiter::Brace, - token::Bracket => Delimiter::Bracket, - token::NoDelim => Delimiter::None, - } - } - - pub(crate) fn to_internal(self) -> token::DelimToken { - match self { - Delimiter::Parenthesis => token::Paren, - Delimiter::Brace => token::Brace, - Delimiter::Bracket => token::Bracket, - Delimiter::None => token::NoDelim, - } - } -} - -impl TokenTree { - pub(crate) fn from_internal( - stream: tokenstream::TokenStream, - stack: &mut Vec, - ) -> TokenTree { - use syntax::parse::token::*; - - let (tree, is_joint) = stream.as_tree(); - let (span, token) = match tree { - tokenstream::TokenTree::Token(span, token) => (span, token), - tokenstream::TokenTree::Delimited(span, delimed) => { - let delimiter = Delimiter::from_internal(delimed.delim); - let mut g = Group::new(delimiter, ::TokenStream(delimed.tts.into())); - g.span = span; - return g.into(); - } - }; - - let op_kind = if is_joint { - Spacing::Joint - } else { - Spacing::Alone - }; - macro_rules! tt { - ($e:expr) => {{ - let mut x = TokenTree::from($e); - x.set_span(Span(span)); - x - }}; - } - macro_rules! op { - ($a:expr) => { - tt!(Punct::new($a, op_kind)) - }; - ($a:expr, $b:expr) => {{ - stack.push(tt!(Punct::new($b, op_kind))); - tt!(Punct::new($a, Spacing::Joint)) - }}; - ($a:expr, $b:expr, $c:expr) => {{ - stack.push(tt!(Punct::new($c, op_kind))); - stack.push(tt!(Punct::new($b, Spacing::Joint))); - tt!(Punct::new($a, Spacing::Joint)) - }}; - } - - match token { - Eq => op!('='), - Lt => op!('<'), - Le => op!('<', '='), - EqEq => op!('=', '='), - Ne => op!('!', '='), - Ge => op!('>', '='), - Gt => op!('>'), - AndAnd => op!('&', '&'), - OrOr => op!('|', '|'), - Not => op!('!'), - Tilde => op!('~'), - BinOp(Plus) => op!('+'), - BinOp(Minus) => op!('-'), - BinOp(Star) => op!('*'), - BinOp(Slash) => op!('/'), - BinOp(Percent) => op!('%'), - BinOp(Caret) => op!('^'), - BinOp(And) => op!('&'), - BinOp(Or) => op!('|'), - BinOp(Shl) => op!('<', '<'), - BinOp(Shr) => op!('>', '>'), - BinOpEq(Plus) => op!('+', '='), - BinOpEq(Minus) => op!('-', '='), - BinOpEq(Star) => op!('*', '='), - BinOpEq(Slash) => op!('/', '='), - BinOpEq(Percent) => op!('%', '='), - BinOpEq(Caret) => op!('^', '='), - BinOpEq(And) => op!('&', '='), - BinOpEq(Or) => op!('|', '='), - BinOpEq(Shl) => op!('<', '<', '='), - BinOpEq(Shr) => op!('>', '>', '='), - At => op!('@'), - Dot => op!('.'), - DotDot => op!('.', '.'), - DotDotDot => op!('.', '.', '.'), - DotDotEq => op!('.', '.', '='), - Comma => op!(','), - Semi => op!(';'), - Colon => op!(':'), - ModSep => op!(':', ':'), - RArrow => op!('-', '>'), - LArrow => op!('<', '-'), - FatArrow => op!('=', '>'), - Pound => op!('#'), - Dollar => op!('$'), - Question => op!('?'), - SingleQuote => op!('\''), - - Ident(ident, false) => tt!(self::Ident::new(&ident.as_str(), Span(span))), - Ident(ident, true) => tt!(self::Ident::new_raw(&ident.as_str(), Span(span))), - Lifetime(ident) => { - let ident = ident.without_first_quote(); - stack.push(tt!(self::Ident::new(&ident.as_str(), Span(span)))); - tt!(Punct::new('\'', Spacing::Joint)) - } - Literal(lit, suffix) => tt!(self::Literal { - lit, - suffix, - span: Span(span) - }), - DocComment(c) => { - let style = comments::doc_comment_style(&c.as_str()); - let stripped = comments::strip_doc_comment_decoration(&c.as_str()); - let stream = vec![ - tt!(self::Ident::new("doc", Span(span))), - tt!(Punct::new('=', Spacing::Alone)), - tt!(self::Literal::string(&stripped)), - ].into_iter() - .collect(); - stack.push(tt!(Group::new(Delimiter::Bracket, stream))); - if style == ast::AttrStyle::Inner { - stack.push(tt!(Punct::new('!', Spacing::Alone))); - } - tt!(Punct::new('#', Spacing::Alone)) - } - - Interpolated(_) => __internal::with_sess(|sess, _| { - let tts = token.interpolated_to_tokenstream(sess, span); - tt!(Group::new(Delimiter::None, ::TokenStream(tts))) - }), - - DotEq => op!('.', '='), - OpenDelim(..) | CloseDelim(..) => unreachable!(), - Whitespace | Comment | Shebang(..) | Eof => unreachable!(), - } - } - - pub(crate) fn to_internal(self) -> tokenstream::TokenStream { - use syntax::parse::token::*; - use syntax::tokenstream::{Delimited, TokenTree}; - - let (ch, kind, span) = match self { - self::TokenTree::Punct(tt) => (tt.as_char(), tt.spacing(), tt.span()), - self::TokenTree::Group(tt) => { - return TokenTree::Delimited( - tt.span, - Delimited { - delim: tt.delimiter.to_internal(), - tts: tt.stream.0.into(), - }, - ).into(); - } - self::TokenTree::Ident(tt) => { - let token = Ident(ast::Ident::new(tt.sym, tt.span.0), tt.is_raw); - return TokenTree::Token(tt.span.0, token).into(); - } - self::TokenTree::Literal(self::Literal { - lit: Lit::Integer(ref a), - suffix, - span, - }) - if a.as_str().starts_with("-") => - { - let minus = BinOp(BinOpToken::Minus); - let integer = Symbol::intern(&a.as_str()[1..]); - let integer = Literal(Lit::Integer(integer), suffix); - let a = TokenTree::Token(span.0, minus); - let b = TokenTree::Token(span.0, integer); - return vec![a, b].into_iter().collect(); - } - self::TokenTree::Literal(self::Literal { - lit: Lit::Float(ref a), - suffix, - span, - }) - if a.as_str().starts_with("-") => - { - let minus = BinOp(BinOpToken::Minus); - let float = Symbol::intern(&a.as_str()[1..]); - let float = Literal(Lit::Float(float), suffix); - let a = TokenTree::Token(span.0, minus); - let b = TokenTree::Token(span.0, float); - return vec![a, b].into_iter().collect(); - } - self::TokenTree::Literal(tt) => { - let token = Literal(tt.lit, tt.suffix); - return TokenTree::Token(tt.span.0, token).into(); - } - }; - - let token = match ch { - '=' => Eq, - '<' => Lt, - '>' => Gt, - '!' => Not, - '~' => Tilde, - '+' => BinOp(Plus), - '-' => BinOp(Minus), - '*' => BinOp(Star), - '/' => BinOp(Slash), - '%' => BinOp(Percent), - '^' => BinOp(Caret), - '&' => BinOp(And), - '|' => BinOp(Or), - '@' => At, - '.' => Dot, - ',' => Comma, - ';' => Semi, - ':' => Colon, - '#' => Pound, - '$' => Dollar, - '?' => Question, - '\'' => SingleQuote, - _ => unreachable!(), - }; - - let tree = TokenTree::Token(span.0, token); - match kind { - Spacing::Alone => tree.into(), - Spacing::Joint => tree.joint(), - } - } -} - -impl Level { - pub(crate) fn to_internal(self) -> errors::Level { - match self { - Level::Error => errors::Level::Error, - Level::Warning => errors::Level::Warning, - Level::Note => errors::Level::Note, - Level::Help => errors::Level::Help, - } - } -} diff --git a/src/libprofiler_builtins/Cargo.toml b/src/libprofiler_builtins/Cargo.toml index 79192fbb681..7c95cf0a054 100644 --- a/src/libprofiler_builtins/Cargo.toml +++ b/src/libprofiler_builtins/Cargo.toml @@ -13,7 +13,7 @@ doc = false [dependencies] core = { path = "../libcore" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = { version = "0.1.0", features = ['rustc-dep-of-std'] } [build-dependencies] cc = "1.0.1" diff --git a/src/libprofiler_builtins/build.rs b/src/libprofiler_builtins/build.rs index 8d6c7d68dfe..b66cd664487 100644 --- a/src/libprofiler_builtins/build.rs +++ b/src/libprofiler_builtins/build.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Compiles the profiler part of the `compiler-rt` library. //! //! See the build.rs for libcompiler_builtins crate for details. @@ -56,9 +46,15 @@ fn main() { cfg.define("COMPILER_RT_HAS_UNAME", Some("1")); } + // The source for `compiler-rt` comes from the `compiler-builtins` crate, so + // load our env var set by cargo to find the source code. + let root = env::var_os("DEP_COMPILER_RT_COMPILER_RT").unwrap(); + let root = Path::new(&root); + for src in profile_sources { - cfg.file(Path::new("../libcompiler_builtins/compiler-rt/lib/profile").join(src)); + cfg.file(root.join("lib").join("profile").join(src)); } + cfg.warnings(false); cfg.compile("profiler-rt"); } diff --git a/src/libprofiler_builtins/lib.rs b/src/libprofiler_builtins/lib.rs index 8678330a5a0..0d12ba01c87 100644 --- a/src/libprofiler_builtins/lib.rs +++ b/src/libprofiler_builtins/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] #![feature(profiler_runtime)] #![profiler_runtime] diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index 2d03a3b1ca1..2fec3c2716c 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -15,10 +15,10 @@ fmt_macros = { path = "../libfmt_macros" } graphviz = { path = "../libgraphviz" } jobserver = "0.1" lazy_static = "1.0.0" +num_cpus = "1.0" scoped-tls = { version = "0.1.1", features = ["nightly"] } log = { version = "0.4", features = ["release_max_level_info", "std"] } -polonius-engine = "0.5.0" -proc_macro = { path = "../libproc_macro" } +polonius-engine = "0.6.2" rustc-rayon = "0.1.1" rustc-rayon-core = "0.1.1" rustc_apfloat = { path = "../librustc_apfloat" } @@ -32,9 +32,9 @@ syntax_pos = { path = "../libsyntax_pos" } backtrace = "0.3.3" parking_lot = "0.6" byteorder = { version = "1.1", features = ["i128"]} -chalk-engine = { version = "0.8.0", default-features=false } +chalk-engine = { version = "0.9.0", default-features=false } rustc_fs_util = { path = "../librustc_fs_util" } -smallvec = { version = "0.6.5", features = ["union"] } +smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } # Note that these dependencies are a lie, they're just here to get linkage to # work. diff --git a/src/librustc/README.md b/src/librustc/README.md index 9909ff91a18..c0e5c542bdc 100644 --- a/src/librustc/README.md +++ b/src/librustc/README.md @@ -1,3 +1,3 @@ For more information about how rustc works, see the [rustc guide]. -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/ +[rustc guide]: https://rust-lang.github.io/rustc-guide/ diff --git a/src/librustc/benches/dispatch.rs b/src/librustc/benches/dispatch.rs index 63e74778fb9..e3b36be5696 100644 --- a/src/librustc/benches/dispatch.rs +++ b/src/librustc/benches/dispatch.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use test::Bencher; // Static/dynamic method dispatch diff --git a/src/librustc/benches/lib.rs b/src/librustc/benches/lib.rs index 5496df1342f..0f81586d3bd 100644 --- a/src/librustc/benches/lib.rs +++ b/src/librustc/benches/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(test)] extern crate test; diff --git a/src/librustc/benches/pattern.rs b/src/librustc/benches/pattern.rs index 638b1ce3f75..fd8cc5b83fd 100644 --- a/src/librustc/benches/pattern.rs +++ b/src/librustc/benches/pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use test::Bencher; // Overhead of various match forms diff --git a/src/librustc/build.rs b/src/librustc/build.rs index bde503d86de..af7723aea34 100644 --- a/src/librustc/build.rs +++ b/src/librustc/build.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::env; fn main() { diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index 6b9c0aac52e..6122fe63709 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cfg::*; use middle::region; use rustc_data_structures::graph::implementation as graph; @@ -53,7 +43,7 @@ pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let body_exit; // Find the tables for this body. - let owner_def_id = tcx.hir.local_def_id(tcx.hir.body_owner(body.id())); + let owner_def_id = tcx.hir().local_def_id(tcx.hir().body_owner(body.id())); let tables = tcx.typeck_tables_of(owner_def_id); let mut cfg_builder = CFGBuilder { @@ -109,30 +99,21 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } fn stmt(&mut self, stmt: &hir::Stmt, pred: CFGIndex) -> CFGIndex { - let hir_id = self.tcx.hir.node_to_hir_id(stmt.node.id()); - match stmt.node { - hir::StmtKind::Decl(ref decl, _) => { - let exit = self.decl(&decl, pred); - self.add_ast_node(hir_id.local_id, &[exit]) - } - - hir::StmtKind::Expr(ref expr, _) | - hir::StmtKind::Semi(ref expr, _) => { - let exit = self.expr(&expr, pred); - self.add_ast_node(hir_id.local_id, &[exit]) - } - } - } - - fn decl(&mut self, decl: &hir::Decl, pred: CFGIndex) -> CFGIndex { - match decl.node { - hir::DeclKind::Local(ref local) => { + let hir_id = self.tcx.hir().node_to_hir_id(stmt.id); + let exit = match stmt.node { + hir::StmtKind::Local(ref local) => { let init_exit = self.opt_expr(&local.init, pred); self.pat(&local.pat, init_exit) } - - hir::DeclKind::Item(_) => pred, - } + hir::StmtKind::Item(_) => { + pred + } + hir::StmtKind::Expr(ref expr) | + hir::StmtKind::Semi(ref expr) => { + self.expr(&expr, pred) + } + }; + self.add_ast_node(hir_id.local_id, &[exit]) } fn pat(&mut self, pat: &hir::Pat, pred: CFGIndex) -> CFGIndex { @@ -379,7 +360,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } hir::ExprKind::Index(ref l, ref r) | - hir::ExprKind::Binary(_, ref l, ref r) => { // NB: && and || handled earlier + hir::ExprKind::Binary(_, ref l, ref r) => { // N.B., && and || handled earlier self.straightline(expr, pred, [l, r].iter().map(|&e| &**e)) } @@ -402,7 +383,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { hir::ExprKind::Closure(..) | hir::ExprKind::Lit(..) | - hir::ExprKind::Path(_) => { + hir::ExprKind::Path(_) | + hir::ExprKind::Err => { self.straightline(expr, pred, None::.iter()) } } @@ -415,8 +397,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { args: I) -> CFGIndex { let func_or_rcvr_exit = self.expr(func_or_rcvr, pred); let ret = self.straightline(call_expr, func_or_rcvr_exit, args); - // FIXME(canndrew): This is_never should probably be an is_uninhabited. - if self.tables.expr_ty(call_expr).is_never() { + let m = self.tcx.hir().get_module_parent(call_expr.id); + if self.tcx.is_ty_uninhabited_from(m, self.tables.expr_ty(call_expr)) { self.add_unreachable_node() } else { ret @@ -588,9 +570,9 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { match destination.target_id { Ok(loop_id) => { for b in &self.breakable_block_scopes { - if b.block_expr_id == self.tcx.hir.node_to_hir_id(loop_id).local_id { + if b.block_expr_id == self.tcx.hir().node_to_hir_id(loop_id).local_id { let scope = region::Scope { - id: self.tcx.hir.node_to_hir_id(loop_id).local_id, + id: self.tcx.hir().node_to_hir_id(loop_id).local_id, data: region::ScopeData::Node }; return (scope, match scope_cf_kind { @@ -600,9 +582,9 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } } for l in &self.loop_scopes { - if l.loop_id == self.tcx.hir.node_to_hir_id(loop_id).local_id { + if l.loop_id == self.tcx.hir().node_to_hir_id(loop_id).local_id { let scope = region::Scope { - id: self.tcx.hir.node_to_hir_id(loop_id).local_id, + id: self.tcx.hir().node_to_hir_id(loop_id).local_id, data: region::ScopeData::Node }; return (scope, match scope_cf_kind { diff --git a/src/librustc/cfg/graphviz.rs b/src/librustc/cfg/graphviz.rs index 650aa39114f..6dec4217608 100644 --- a/src/librustc/cfg/graphviz.rs +++ b/src/librustc/cfg/graphviz.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// This module provides linkage between rustc::middle::graph and /// libgraphviz traits. @@ -32,11 +22,11 @@ pub struct LabelledCFG<'a, 'tcx: 'a> { impl<'a, 'tcx> LabelledCFG<'a, 'tcx> { fn local_id_to_string(&self, local_id: hir::ItemLocalId) -> String { assert!(self.cfg.owner_def_id.is_local()); - let node_id = self.tcx.hir.hir_to_node_id(hir::HirId { - owner: self.tcx.hir.def_index_to_hir_id(self.cfg.owner_def_id.index).owner, + let node_id = self.tcx.hir().hir_to_node_id(hir::HirId { + owner: self.tcx.hir().def_index_to_hir_id(self.cfg.owner_def_id.index).owner, local_id }); - let s = self.tcx.hir.node_to_string(node_id); + let s = self.tcx.hir().node_to_string(node_id); // Replacing newlines with \\l causes each line to be left-aligned, // improving presentation of (long) pretty-printed expressions. diff --git a/src/librustc/cfg/mod.rs b/src/librustc/cfg/mod.rs index cf9c24cc58a..e58557839f9 100644 --- a/src/librustc/cfg/mod.rs +++ b/src/librustc/cfg/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Module that constructs a control-flow graph representing an item. //! Uses `Graph` as the underlying representation. diff --git a/src/librustc/dep_graph/README.md b/src/librustc/dep_graph/README.md index f1f383d7ad1..91a06e452e5 100644 --- a/src/librustc/dep_graph/README.md +++ b/src/librustc/dep_graph/README.md @@ -1,4 +1,4 @@ To learn more about how dependency tracking works in rustc, see the [rustc guide]. -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/query.html +[rustc guide]: https://rust-lang.github.io/rustc-guide/query.html diff --git a/src/librustc/dep_graph/cgu_reuse_tracker.rs b/src/librustc/dep_graph/cgu_reuse_tracker.rs index 0392d329896..e8d1b710487 100644 --- a/src/librustc/dep_graph/cgu_reuse_tracker.rs +++ b/src/librustc/dep_graph/cgu_reuse_tracker.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Some facilities for tracking how codegen-units are reused during incremental //! compilation. This is used for incremental compilation tests and debug //! output. diff --git a/src/librustc/dep_graph/debug.rs b/src/librustc/dep_graph/debug.rs index f0e43e78a50..a9ad22c5e91 100644 --- a/src/librustc/dep_graph/debug.rs +++ b/src/librustc/dep_graph/debug.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Code for debugging the dep-graph. use super::dep_node::DepNode; diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 3ff2545f78d..05f331145af 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - //! This module defines the `DepNode` type which the compiler uses to represent //! nodes in the dependency graph. A `DepNode` consists of a `DepKind` (which //! specifies the kind of thing it represents, like a piece of HIR, MIR, etc) @@ -17,7 +6,7 @@ //! fully identify a dependency node, even across multiple compilation sessions. //! In other words, the value of the fingerprint does not depend on anything //! that is specific to a given compilation session, like an unpredictable -//! interning key (e.g. NodeId, DefId, Symbol) or the numeric value of a +//! interning key (e.g., NodeId, DefId, Symbol) or the numeric value of a //! pointer. The concept behind this could be compared to how git commit hashes //! uniquely identify a given commit and has a few advantages: //! @@ -28,7 +17,7 @@ //! * A `Fingerprint` is just a bunch of bits, which allows `DepNode` to //! implement `Copy`, `Sync`, `Send`, `Freeze`, etc. //! * Since we just have a bit pattern, `DepNode` can be mapped from disk into -//! memory without any post-processing (e.g. "abomination-style" pointer +//! memory without any post-processing (e.g., "abomination-style" pointer //! reconstruction). //! * Because a `DepNode` is self-contained, we can instantiate `DepNodes` that //! refer to things that do not exist anymore. In previous implementations @@ -81,7 +70,7 @@ use ty::{TyCtxt, FnSig, Instance, InstanceDef, use ty::subst::Substs; // erase!() just makes tokens go away. It's used to specify which macro argument -// is repeated (i.e. which sub-expression of the macro we are in) but don't need +// is repeated (i.e., which sub-expression of the macro we are in) but don't need // to actually use any of the arguments. macro_rules! erase { ($x:tt) => ({}) @@ -162,7 +151,9 @@ macro_rules! define_dep_nodes { } } - #[inline] + // FIXME: Make `is_anon`, `is_input`, `is_eval_always` and `has_params` properties + // of queries + #[inline(always)] pub fn is_anon(&self) -> bool { match *self { $( @@ -171,7 +162,7 @@ macro_rules! define_dep_nodes { } } - #[inline] + #[inline(always)] pub fn is_input(&self) -> bool { match *self { $( @@ -180,7 +171,7 @@ macro_rules! define_dep_nodes { } } - #[inline] + #[inline(always)] pub fn is_eval_always(&self) -> bool { match *self { $( @@ -190,7 +181,7 @@ macro_rules! define_dep_nodes { } #[allow(unreachable_code)] - #[inline] + #[inline(always)] pub fn has_params(&self) -> bool { match *self { $( @@ -230,6 +221,7 @@ macro_rules! define_dep_nodes { impl DepNode { #[allow(unreachable_code, non_snake_case)] + #[inline(always)] pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, dep: DepConstructor<'gcx>) -> DepNode @@ -299,11 +291,11 @@ macro_rules! define_dep_nodes { /// Construct a DepNode from the given DepKind and DefPathHash. This /// method will assert that the given DepKind actually requires a /// single DefId/DefPathHash parameter. - #[inline] + #[inline(always)] pub fn from_def_path_hash(kind: DepKind, def_path_hash: DefPathHash) -> DepNode { - assert!(kind.can_reconstruct_query_key() && kind.has_params()); + debug_assert!(kind.can_reconstruct_query_key() && kind.has_params()); DepNode { kind, hash: def_path_hash.0, @@ -313,9 +305,9 @@ macro_rules! define_dep_nodes { /// Create a new, parameterless DepNode. This method will assert /// that the DepNode corresponding to the given DepKind actually /// does not require any parameters. - #[inline] + #[inline(always)] pub fn new_no_params(kind: DepKind) -> DepNode { - assert!(!kind.has_params()); + debug_assert!(!kind.has_params()); DepNode { kind, hash: Fingerprint::ZERO, @@ -381,7 +373,7 @@ macro_rules! define_dep_nodes { #[allow(dead_code, non_upper_case_globals)] pub mod label_strs { $( - pub const $variant: &'static str = stringify!($variant); + pub const $variant: &str = stringify!($variant); )* } ); @@ -418,30 +410,19 @@ impl fmt::Debug for DepNode { impl DefPathHash { - #[inline] + #[inline(always)] pub fn to_dep_node(self, kind: DepKind) -> DepNode { DepNode::from_def_path_hash(kind, self) } } impl DefId { - #[inline] + #[inline(always)] pub fn to_dep_node(self, tcx: TyCtxt<'_, '_, '_>, kind: DepKind) -> DepNode { DepNode::from_def_path_hash(kind, tcx.def_path_hash(self)) } } -impl DepKind { - #[inline] - pub fn fingerprint_needed_for_crate_hash(self) -> bool { - match self { - DepKind::HirBody | - DepKind::Krate => true, - _ => false, - } - } -} - define_dep_nodes!( <'tcx> // We use this for most things when incr. comp. is turned off. [] Null, @@ -449,10 +430,10 @@ define_dep_nodes!( <'tcx> // Represents the `Krate` as a whole (the `hir::Krate` value) (as // distinct from the krate module). This is basically a hash of // the entire krate, so if you read from `Krate` (e.g., by calling - // `tcx.hir.krate()`), we will have to assume that any change + // `tcx.hir().krate()`), we will have to assume that any change // means that you need to be recompiled. This is because the // `Krate` value gives you access to all other items. To avoid - // this fate, do not call `tcx.hir.krate()`; instead, prefer + // this fate, do not call `tcx.hir().krate()`; instead, prefer // wrappers like `tcx.visit_all_items_in_krate()`. If there is no // suitable wrapper, you can use `tcx.dep_graph.ignore()` to gain // access to the krate, but you must remember to add suitable @@ -491,6 +472,15 @@ define_dep_nodes!( <'tcx> [] UnsafetyCheckResult(DefId), [] UnsafeDeriveOnReprPacked(DefId), + [] CheckModAttrs(DefId), + [] CheckModLoops(DefId), + [] CheckModUnstableApiUsage(DefId), + [] CheckModItemTypes(DefId), + [] CheckModPrivacy(DefId), + [] CheckModIntrinsics(DefId), + [] CheckModLiveness(DefId), + [] CollectModItemTypes(DefId), + [] Reachability, [] MirKeys, [eval_always] CrateVariances, @@ -511,6 +501,7 @@ define_dep_nodes!( <'tcx> [] AdtDefOfItem(DefId), [] ImplTraitRef(DefId), [] ImplPolarity(DefId), + [] Issue33140SelfTy(DefId), [] FnSignature(DefId), [] CoerceUnsizedInfo(DefId), @@ -595,8 +586,9 @@ define_dep_nodes!( <'tcx> [] CheckImplItemWellFormed(DefId), [] ReachableNonGenerics(CrateNum), [] NativeLibraries(CrateNum), + [] EntryFn(CrateNum), [] PluginRegistrarFn(CrateNum), - [] DeriveRegistrarFn(CrateNum), + [] ProcMacroDeclsStatic(CrateNum), [input] CrateDisambiguator(CrateNum), [input] CrateHash(CrateNum), [input] OriginalCrateName(CrateNum), @@ -642,6 +634,7 @@ define_dep_nodes!( <'tcx> [input] Freevars(DefId), [input] MaybeUnusedTraitImport(DefId), [input] MaybeUnusedExternCrates, + [input] NamesImportedByGlobUse(DefId), [eval_always] StabilityIndex, [eval_always] AllTraits, [input] AllCrateNums, @@ -649,6 +642,7 @@ define_dep_nodes!( <'tcx> [eval_always] CollectAndPartitionMonoItems, [] IsCodegenedItem(DefId), [] CodegenUnit(InternedString), + [] BackendOptimizationLevel(CrateNum), [] CompileCodegenUnit(InternedString), [input] OutputFilenames, [] NormalizeProjectionTy(CanonicalProjectionGoal<'tcx>), @@ -656,6 +650,7 @@ define_dep_nodes!( <'tcx> [] ImpliedOutlivesBounds(CanonicalTyGoal<'tcx>), [] DropckOutlives(CanonicalTyGoal<'tcx>), [] EvaluateObligation(CanonicalPredicateGoal<'tcx>), + [] EvaluateGoal(traits::ChalkCanonicalGoal<'tcx>), [] TypeOpAscribeUserType(CanonicalTypeOpAscribeUserTypeGoal<'tcx>), [] TypeOpEq(CanonicalTypeOpEqGoal<'tcx>), [] TypeOpSubtype(CanonicalTypeOpSubtypeGoal<'tcx>), @@ -666,6 +661,7 @@ define_dep_nodes!( <'tcx> [] TypeOpNormalizeFnSig(CanonicalTypeOpNormalizeGoal<'tcx, FnSig<'tcx>>), [] SubstituteNormalizeAndTestPredicates { key: (DefId, &'tcx Substs<'tcx>) }, + [] MethodAutoderefSteps(CanonicalTyGoal<'tcx>), [input] TargetFeaturesWhitelist, @@ -733,7 +729,7 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for DefIndex { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { - tcx.hir.definitions().def_path_hash(*self).0 + tcx.hir().definitions().def_path_hash(*self).0 } fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String { diff --git a/src/librustc/dep_graph/dep_tracking_map.rs b/src/librustc/dep_graph/dep_tracking_map.rs index a674b5df639..331a9c6109c 100644 --- a/src/librustc/dep_graph/dep_tracking_map.rs +++ b/src/librustc/dep_graph/dep_tracking_map.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::fx::FxHashMap; use std::cell::RefCell; use std::hash::Hash; @@ -65,7 +55,7 @@ impl MemoizationMap for RefCell> { /// /// ``` /// fn type_of_item(..., item: &hir::Item) -> Ty<'tcx> { - /// let item_def_id = ccx.tcx.hir.local_def_id(it.id); + /// let item_def_id = ccx.tcx.hir().local_def_id(it.id); /// ccx.tcx.item_types.memoized(item_def_id, || { /// ccx.tcx.dep_graph.read(DepNode::Hir(item_def_id)); // (*) /// compute_type_of_item(ccx, item) diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index 63b749c548e..c9353a451e2 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -1,23 +1,15 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use errors::DiagnosticBuilder; +use errors::{Diagnostic, DiagnosticBuilder}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; use smallvec::SmallVec; -use rustc_data_structures::sync::{Lrc, Lock}; +use rustc_data_structures::sync::{Lrc, Lock, AtomicU32, Ordering}; use std::env; use std::hash::Hash; +use std::collections::hash_map::Entry; use ty::{self, TyCtxt}; use util::common::{ProfileQueriesMsg, profq_msg}; +use parking_lot::{Mutex, Condvar}; use ich::{StableHashingContext, StableHashingContextProvider, Fingerprint}; @@ -31,12 +23,6 @@ use super::prev::PreviousDepGraph; #[derive(Clone)] pub struct DepGraph { data: Option>, - - // A vector mapping depnodes from the current graph to their associated - // result value fingerprints. Do not rely on the length of this vector - // being the same as the number of nodes in the graph. The vector can - // contain an arbitrary number of zero-entries at the end. - fingerprints: Lrc>> } newtype_index! { @@ -73,7 +59,13 @@ struct DepGraphData { /// nodes and edges as well as all fingerprints of nodes that have them. previous: PreviousDepGraph, - colors: Lock, + colors: DepNodeColorMap, + + /// A set of loaded diagnostics which has been emitted. + emitted_diagnostics: Mutex>, + + /// Used to wait for diagnostics to be emitted. + emitted_diagnostics_cond_var: Condvar, /// When we load, there may be `.o` files, cached mir, or other such /// things available to us. If we find that they are not dirty, we @@ -91,30 +83,25 @@ impl DepGraph { pub fn new(prev_graph: PreviousDepGraph, prev_work_products: FxHashMap) -> DepGraph { - // Pre-allocate the fingerprints array. We over-allocate a little so - // that we hopefully don't have to re-allocate during this compilation - // session. let prev_graph_node_count = prev_graph.node_count(); - let fingerprints = IndexVec::from_elem_n(Fingerprint::ZERO, - (prev_graph_node_count * 115) / 100); DepGraph { data: Some(Lrc::new(DepGraphData { previous_work_products: prev_work_products, dep_node_debug: Default::default(), - current: Lock::new(CurrentDepGraph::new()), + current: Lock::new(CurrentDepGraph::new(prev_graph_node_count)), + emitted_diagnostics: Default::default(), + emitted_diagnostics_cond_var: Condvar::new(), previous: prev_graph, - colors: Lock::new(DepNodeColorMap::new(prev_graph_node_count)), + colors: DepNodeColorMap::new(prev_graph_node_count), loaded_from_cache: Default::default(), })), - fingerprints: Lrc::new(Lock::new(fingerprints)), } } pub fn new_disabled() -> DepGraph { DepGraph { data: None, - fingerprints: Lrc::new(Lock::new(IndexVec::new())), } } @@ -126,12 +113,12 @@ impl DepGraph { pub fn query(&self) -> DepGraphQuery { let current_dep_graph = self.data.as_ref().unwrap().current.borrow(); - let nodes: Vec<_> = current_dep_graph.nodes.iter().cloned().collect(); + let nodes: Vec<_> = current_dep_graph.data.iter().map(|n| n.node).collect(); let mut edges = Vec::new(); - for (index, edge_targets) in current_dep_graph.edges.iter_enumerated() { - let from = current_dep_graph.nodes[index]; + for (from, edge_targets) in current_dep_graph.data.iter() + .map(|d| (d.node, &d.edges)) { for &edge_target in edge_targets.iter() { - let to = current_dep_graph.nodes[edge_target]; + let to = current_dep_graph.data[edge_target].node; edges.push((from, to)); } } @@ -144,12 +131,7 @@ impl DepGraph { if let Some(..) = self.data { ty::tls::with_context_opt(|icx| { let icx = if let Some(icx) = icx { icx } else { return }; - match *icx.task { - OpenTask::Ignore => { - // ignored - } - _ => panic!("expected an ignore context") - } + assert!(icx.task_deps.is_none(), "expected no task dependency tracking"); }) } } @@ -159,7 +141,7 @@ impl DepGraph { { ty::tls::with_context(|icx| { let icx = ty::tls::ImplicitCtxt { - task: &OpenTask::Ignore, + task_deps: None, ..icx.clone() }; @@ -195,7 +177,7 @@ impl DepGraph { /// - If you need 3+ arguments, use a tuple for the /// `arg` parameter. /// - /// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/incremental-compilation.html + /// [rustc guide]: https://rust-lang.github.io/rustc-guide/incremental-compilation.html pub fn with_task<'gcx, C, A, R>(&self, key: DepNode, cx: C, @@ -206,12 +188,15 @@ impl DepGraph { R: HashStable>, { self.with_task_impl(key, cx, arg, false, task, - |key| OpenTask::Regular(Lock::new(RegularOpenTask { - node: key, + |_key| Some(TaskDeps { + #[cfg(debug_assertions)] + node: Some(_key), reads: SmallVec::new(), read_set: Default::default(), - })), - |data, key, task| data.borrow_mut().complete_task(key, task)) + }), + |data, key, fingerprint, task| { + data.borrow_mut().complete_task(key, task.unwrap(), fingerprint) + }) } /// Creates a new dep-graph input with value `input` @@ -228,8 +213,10 @@ impl DepGraph { } self.with_task_impl(key, cx, input, true, identity_fn, - |_| OpenTask::Ignore, - |data, key, _| data.borrow_mut().alloc_node(key, SmallVec::new())) + |_| None, + |data, key, fingerprint, _| { + data.borrow_mut().alloc_node(key, SmallVec::new(), fingerprint) + }) } fn with_task_impl<'gcx, C, A, R>( @@ -239,17 +226,18 @@ impl DepGraph { arg: A, no_tcx: bool, task: fn(C, A) -> R, - create_task: fn(DepNode) -> OpenTask, + create_task: fn(DepNode) -> Option, finish_task_and_alloc_depnode: fn(&Lock, DepNode, - OpenTask) -> DepNodeIndex + Fingerprint, + Option) -> DepNodeIndex ) -> (R, DepNodeIndex) where C: DepGraphSafe + StableHashingContextProvider<'gcx>, R: HashStable>, { if let Some(ref data) = self.data { - let open_task = create_task(key); + let task_deps = create_task(key).map(|deps| Lock::new(deps)); // In incremental mode, hash the result of the task. We don't // do anything with the hash yet, but we are computing it @@ -267,7 +255,7 @@ impl DepGraph { } else { ty::tls::with_context(|icx| { let icx = ty::tls::ImplicitCtxt { - task: &open_task, + task_deps: task_deps.as_ref(), ..icx.clone() }; @@ -281,26 +269,17 @@ impl DepGraph { profq_msg(hcx.sess(), ProfileQueriesMsg::TaskEnd) }; - let dep_node_index = finish_task_and_alloc_depnode(&data.current, key, open_task); - let mut stable_hasher = StableHasher::new(); result.hash_stable(&mut hcx, &mut stable_hasher); let current_fingerprint = stable_hasher.finish(); - // Store the current fingerprint - { - let mut fingerprints = self.fingerprints.borrow_mut(); - - if dep_node_index.index() >= fingerprints.len() { - fingerprints.resize(dep_node_index.index() + 1, Fingerprint::ZERO); - } - - debug_assert!(fingerprints[dep_node_index] == Fingerprint::ZERO, - "DepGraph::with_task() - Duplicate fingerprint \ - insertion for {:?}", key); - fingerprints[dep_node_index] = current_fingerprint; - } + let dep_node_index = finish_task_and_alloc_depnode( + &data.current, + key, + current_fingerprint, + task_deps.map(|lock| lock.into_inner()), + ); // Determine the color of the new DepNode. if let Some(prev_index) = data.previous.node_to_index_opt(&key) { @@ -312,35 +291,16 @@ impl DepGraph { DepNodeColor::Red }; - let mut colors = data.colors.borrow_mut(); - debug_assert!(colors.get(prev_index).is_none(), + debug_assert!(data.colors.get(prev_index).is_none(), "DepGraph::with_task() - Duplicate DepNodeColor \ insertion for {:?}", key); - colors.insert(prev_index, color); + data.colors.insert(prev_index, color); } (result, dep_node_index) } else { - if key.kind.fingerprint_needed_for_crate_hash() { - let mut hcx = cx.get_stable_hashing_context(); - let result = task(cx, arg); - let mut stable_hasher = StableHasher::new(); - result.hash_stable(&mut hcx, &mut stable_hasher); - let fingerprint = stable_hasher.finish(); - - let mut fingerprints = self.fingerprints.borrow_mut(); - let dep_node_index = DepNodeIndex::new(fingerprints.len()); - fingerprints.push(fingerprint); - - debug_assert!(fingerprints[dep_node_index] == fingerprint, - "DepGraph::with_task() - Assigned fingerprint to \ - unexpected index for {:?}", key); - - (result, dep_node_index) - } else { - (task(cx, arg), DepNodeIndex::INVALID) - } + (task(cx, arg), DepNodeIndex::INVALID) } } @@ -350,15 +310,17 @@ impl DepGraph { where OP: FnOnce() -> R { if let Some(ref data) = self.data { - let (result, open_task) = ty::tls::with_context(|icx| { - let task = OpenTask::Anon(Lock::new(AnonOpenTask { + let (result, task_deps) = ty::tls::with_context(|icx| { + let task_deps = Lock::new(TaskDeps { + #[cfg(debug_assertions)] + node: None, reads: SmallVec::new(), read_set: Default::default(), - })); + }); let r = { let icx = ty::tls::ImplicitCtxt { - task: &task, + task_deps: Some(&task_deps), ..icx.clone() }; @@ -367,11 +329,11 @@ impl DepGraph { }) }; - (r, task) + (r, task_deps.into_inner()) }); let dep_node_index = data.current .borrow_mut() - .pop_anon_task(dep_kind, open_task); + .complete_anon_task(dep_kind, task_deps); (result, dep_node_index) } else { (op(), DepNodeIndex::INVALID) @@ -390,16 +352,23 @@ impl DepGraph { R: HashStable>, { self.with_task_impl(key, cx, arg, false, task, - |key| OpenTask::EvalAlways { node: key }, - |data, key, task| data.borrow_mut().complete_eval_always_task(key, task)) + |_| None, + |data, key, fingerprint, _| { + let mut current = data.borrow_mut(); + let krate_idx = current.node_to_node_index[ + &DepNode::new_no_params(DepKind::Krate) + ]; + current.alloc_node(key, smallvec![krate_idx], fingerprint) + }) } #[inline] pub fn read(&self, v: DepNode) { if let Some(ref data) = self.data { - let mut current = data.current.borrow_mut(); + let current = data.current.borrow_mut(); if let Some(&dep_node_index) = current.node_to_node_index.get(&v) { - current.read_index(dep_node_index); + std::mem::drop(current); + data.read_index(dep_node_index); } else { bug!("DepKind {:?} should be pre-allocated but isn't.", v.kind) } @@ -409,7 +378,7 @@ impl DepGraph { #[inline] pub fn read_index(&self, dep_node_index: DepNodeIndex) { if let Some(ref data) = self.data { - data.current.borrow_mut().read_index(dep_node_index); + data.read_index(dep_node_index); } } @@ -437,17 +406,8 @@ impl DepGraph { #[inline] pub fn fingerprint_of(&self, dep_node_index: DepNodeIndex) -> Fingerprint { - match self.fingerprints.borrow().get(dep_node_index) { - Some(&fingerprint) => fingerprint, - None => { - if let Some(ref data) = self.data { - let dep_node = data.current.borrow().nodes[dep_node_index]; - bug!("Could not find current fingerprint for {:?}", dep_node) - } else { - bug!("Could not find current fingerprint for {:?}", dep_node_index) - } - } - } + let current = self.data.as_ref().expect("dep graph enabled").current.borrow_mut(); + current.data[dep_node_index].fingerprint } pub fn prev_fingerprint_of(&self, dep_node: &DepNode) -> Option { @@ -499,26 +459,34 @@ impl DepGraph { .cloned() } - pub fn edge_deduplication_data(&self) -> (u64, u64) { - let current_dep_graph = self.data.as_ref().unwrap().current.borrow(); + pub fn edge_deduplication_data(&self) -> Option<(u64, u64)> { + if cfg!(debug_assertions) { + let current_dep_graph = self.data.as_ref().unwrap().current.borrow(); - (current_dep_graph.total_read_count, current_dep_graph.total_duplicate_read_count) + Some((current_dep_graph.total_read_count, + current_dep_graph.total_duplicate_read_count)) + } else { + None + } } pub fn serialize(&self) -> SerializedDepGraph { let current_dep_graph = self.data.as_ref().unwrap().current.borrow(); - let fingerprints = self.fingerprints.borrow().clone().convert_index_type(); - let nodes = current_dep_graph.nodes.clone().convert_index_type(); + let fingerprints: IndexVec = + current_dep_graph.data.iter().map(|d| d.fingerprint).collect(); + let nodes: IndexVec = + current_dep_graph.data.iter().map(|d| d.node).collect(); - let total_edge_count: usize = current_dep_graph.edges.iter() - .map(|v| v.len()) - .sum(); + let total_edge_count: usize = current_dep_graph.data.iter() + .map(|d| d.edges.len()) + .sum(); let mut edge_list_indices = IndexVec::with_capacity(nodes.len()); let mut edge_list_data = Vec::with_capacity(total_edge_count); - for (current_dep_node_index, edges) in current_dep_graph.edges.iter_enumerated() { + for (current_dep_node_index, edges) in current_dep_graph.data.iter_enumerated() + .map(|(i, d)| (i, &d.edges)) { let start = edge_list_data.len() as u32; // This should really just be a memcpy :/ edge_list_data.extend(edges.iter().map(|i| SerializedDepNodeIndex::new(i.index()))); @@ -542,7 +510,7 @@ impl DepGraph { pub fn node_color(&self, dep_node: &DepNode) -> Option { if let Some(ref data) = self.data { if let Some(prev_index) = data.previous.node_to_index_opt(dep_node) { - return data.colors.borrow().get(prev_index) + return data.colors.get(prev_index) } else { // This is a node that did not exist in the previous compilation // session, so we consider it to be red. @@ -553,56 +521,89 @@ impl DepGraph { None } - pub fn try_mark_green<'tcx>(&self, - tcx: TyCtxt<'_, 'tcx, 'tcx>, - dep_node: &DepNode) - -> Option { - debug!("try_mark_green({:?}) - BEGIN", dep_node); - let data = self.data.as_ref().unwrap(); + /// Try to read a node index for the node dep_node. + /// A node will have an index, when it's already been marked green, or when we can mark it + /// green. This function will mark the current task as a reader of the specified node, when + /// a node index can be found for that node. + pub fn try_mark_green_and_read( + &self, + tcx: TyCtxt<'_, '_, '_>, + dep_node: &DepNode + ) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> { + self.try_mark_green(tcx, dep_node).map(|(prev_index, dep_node_index)| { + debug_assert!(self.is_green(&dep_node)); + self.read_index(dep_node_index); + (prev_index, dep_node_index) + }) + } - #[cfg(not(parallel_queries))] - debug_assert!(!data.current.borrow().node_to_node_index.contains_key(dep_node)); - - if dep_node.kind.is_input() { - // We should only hit try_mark_green() for inputs that do not exist - // anymore in the current compilation session. Existing inputs are - // eagerly marked as either red/green before any queries are - // executed. - debug_assert!(dep_node.extract_def_id(tcx).is_none()); - debug!("try_mark_green({:?}) - END - DepNode is deleted input", dep_node); - return None; - } + pub fn try_mark_green( + &self, + tcx: TyCtxt<'_, '_, '_>, + dep_node: &DepNode + ) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> { + debug_assert!(!dep_node.kind.is_input()); - let (prev_deps, prev_dep_node_index) = match data.previous.edges_from(dep_node) { - Some(prev) => { + // Return None if the dep graph is disabled + let data = self.data.as_ref()?; + + // Return None if the dep node didn't exist in the previous session + let prev_index = data.previous.node_to_index_opt(dep_node)?; + + match data.colors.get(prev_index) { + Some(DepNodeColor::Green(dep_node_index)) => Some((prev_index, dep_node_index)), + Some(DepNodeColor::Red) => None, + None => { // This DepNode and the corresponding query invocation existed // in the previous compilation session too, so we can try to // mark it as green by recursively marking all of its // dependencies green. - prev - } - None => { - // This DepNode did not exist in the previous compilation session, - // so we cannot mark it as green. - debug!("try_mark_green({:?}) - END - DepNode does not exist in \ - current compilation session anymore", dep_node); - return None + self.try_mark_previous_green( + tcx.global_tcx(), + data, + prev_index, + &dep_node + ).map(|dep_node_index| { + (prev_index, dep_node_index) + }) } - }; + } + } + + /// Try to mark a dep-node which existed in the previous compilation session as green + fn try_mark_previous_green<'tcx>( + &self, + tcx: TyCtxt<'_, 'tcx, 'tcx>, + data: &DepGraphData, + prev_dep_node_index: SerializedDepNodeIndex, + dep_node: &DepNode + ) -> Option { + debug!("try_mark_previous_green({:?}) - BEGIN", dep_node); + + #[cfg(not(parallel_compiler))] + { + debug_assert!(!data.current.borrow().node_to_node_index.contains_key(dep_node)); + debug_assert!(data.colors.get(prev_dep_node_index).is_none()); + } + + // We never try to mark inputs as green + debug_assert!(!dep_node.kind.is_input()); - debug_assert!(data.colors.borrow().get(prev_dep_node_index).is_none()); + debug_assert_eq!(data.previous.index_to_node(prev_dep_node_index), *dep_node); + + let prev_deps = data.previous.edge_targets_from(prev_dep_node_index); let mut current_deps = SmallVec::new(); for &dep_dep_node_index in prev_deps { - let dep_dep_node_color = data.colors.borrow().get(dep_dep_node_index); + let dep_dep_node_color = data.colors.get(dep_dep_node_index); match dep_dep_node_color { Some(DepNodeColor::Green(node_index)) => { // This dependency has been marked as green before, we are // still fine and can continue with checking the other // dependencies. - debug!("try_mark_green({:?}) --- found dependency {:?} to \ + debug!("try_mark_previous_green({:?}) --- found dependency {:?} to \ be immediately green", dep_node, data.previous.index_to_node(dep_dep_node_index)); @@ -613,7 +614,7 @@ impl DepGraph { // compared to the previous compilation session. We cannot // mark the DepNode as green and also don't need to bother // with checking any of the other dependencies. - debug!("try_mark_green({:?}) - END - dependency {:?} was \ + debug!("try_mark_previous_green({:?}) - END - dependency {:?} was \ immediately red", dep_node, data.previous.index_to_node(dep_dep_node_index)); @@ -625,12 +626,18 @@ impl DepGraph { // We don't know the state of this dependency. If it isn't // an input node, let's try to mark it green recursively. if !dep_dep_node.kind.is_input() { - debug!("try_mark_green({:?}) --- state of dependency {:?} \ + debug!("try_mark_previous_green({:?}) --- state of dependency {:?} \ is unknown, trying to mark it green", dep_node, dep_dep_node); - if let Some(node_index) = self.try_mark_green(tcx, dep_dep_node) { - debug!("try_mark_green({:?}) --- managed to MARK \ + let node_index = self.try_mark_previous_green( + tcx, + data, + dep_dep_node_index, + dep_dep_node + ); + if let Some(node_index) = node_index { + debug!("try_mark_previous_green({:?}) --- managed to MARK \ dependency {:?} as green", dep_node, dep_dep_node); current_deps.push(node_index); continue; @@ -640,7 +647,7 @@ impl DepGraph { DepKind::Hir | DepKind::HirBody | DepKind::CrateMetadata => { - if dep_node.extract_def_id(tcx).is_none() { + if dep_dep_node.extract_def_id(tcx).is_none() { // If the node does not exist anymore, we // just fail to mark green. return None @@ -660,20 +667,20 @@ impl DepGraph { } // We failed to mark it green, so we try to force the query. - debug!("try_mark_green({:?}) --- trying to force \ + debug!("try_mark_previous_green({:?}) --- trying to force \ dependency {:?}", dep_node, dep_dep_node); if ::ty::query::force_from_dep_node(tcx, dep_dep_node) { - let dep_dep_node_color = data.colors.borrow().get(dep_dep_node_index); + let dep_dep_node_color = data.colors.get(dep_dep_node_index); match dep_dep_node_color { Some(DepNodeColor::Green(node_index)) => { - debug!("try_mark_green({:?}) --- managed to \ + debug!("try_mark_previous_green({:?}) --- managed to \ FORCE dependency {:?} to green", dep_node, dep_dep_node); current_deps.push(node_index); } Some(DepNodeColor::Red) => { - debug!("try_mark_green({:?}) - END - \ + debug!("try_mark_previous_green({:?}) - END - \ dependency {:?} was red after forcing", dep_node, dep_dep_node); @@ -681,7 +688,7 @@ impl DepGraph { } None => { if !tcx.sess.has_errors() { - bug!("try_mark_green() - Forcing the DepNode \ + bug!("try_mark_previous_green() - Forcing the DepNode \ should have set its color") } else { // If the query we just forced has resulted @@ -693,7 +700,7 @@ impl DepGraph { } } else { // The DepNode could not be forced. - debug!("try_mark_green({:?}) - END - dependency {:?} \ + debug!("try_mark_previous_green({:?}) - END - dependency {:?} \ could not be forced", dep_node, dep_dep_node); return None } @@ -710,72 +717,84 @@ impl DepGraph { let (dep_node_index, did_allocation) = { let mut current = data.current.borrow_mut(); - if let Some(&dep_node_index) = current.node_to_node_index.get(&dep_node) { - // Someone else allocated it before us - (dep_node_index, false) - } else { - // We allocating an entry for the node in the current dependency graph and - // adding all the appropriate edges imported from the previous graph - (current.alloc_node(*dep_node, current_deps), true) - } - }; - - // ... copying the fingerprint from the previous graph too, so we don't - // have to recompute it ... - { + // Copy the fingerprint from the previous graph, + // so we don't have to recompute it let fingerprint = data.previous.fingerprint_by_index(prev_dep_node_index); - let mut fingerprints = self.fingerprints.borrow_mut(); - if dep_node_index.index() >= fingerprints.len() { - fingerprints.resize(dep_node_index.index() + 1, Fingerprint::ZERO); - } + // We allocating an entry for the node in the current dependency graph and + // adding all the appropriate edges imported from the previous graph + current.intern_node(*dep_node, current_deps, fingerprint) + }; - // Multiple threads can all write the same fingerprint here - #[cfg(not(parallel_queries))] - debug_assert!(fingerprints[dep_node_index] == Fingerprint::ZERO, - "DepGraph::try_mark_green() - Duplicate fingerprint \ - insertion for {:?}", dep_node); + // ... emitting any stored diagnostic ... - fingerprints[dep_node_index] = fingerprint; + let diagnostics = tcx.queries.on_disk_cache + .load_diagnostics(tcx, prev_dep_node_index); + + if unlikely!(diagnostics.len() > 0) { + self.emit_diagnostics( + tcx, + data, + dep_node_index, + did_allocation, + diagnostics + ); } - // ... emitting any stored diagnostic ... - if did_allocation { + // ... and finally storing a "Green" entry in the color map. + // Multiple threads can all write the same color here + #[cfg(not(parallel_compiler))] + debug_assert!(data.colors.get(prev_dep_node_index).is_none(), + "DepGraph::try_mark_previous_green() - Duplicate DepNodeColor \ + insertion for {:?}", dep_node); + + data.colors.insert(prev_dep_node_index, DepNodeColor::Green(dep_node_index)); + + debug!("try_mark_previous_green({:?}) - END - successfully marked as green", dep_node); + Some(dep_node_index) + } + + /// Atomically emits some loaded diagnotics assuming that this only gets called with + /// did_allocation set to true on one thread + #[cold] + #[inline(never)] + fn emit_diagnostics<'tcx>( + &self, + tcx: TyCtxt<'_, 'tcx, 'tcx>, + data: &DepGraphData, + dep_node_index: DepNodeIndex, + did_allocation: bool, + diagnostics: Vec, + ) { + if did_allocation || !cfg!(parallel_compiler) { // Only the thread which did the allocation emits the error messages + let handle = tcx.sess.diagnostic(); - // FIXME: Ensure that these are printed before returning for all threads. - // Currently threads where did_allocation = false can continue on - // and emit other diagnostics before these diagnostics are emitted. - // Such diagnostics should be emitted after these. - // See https://github.com/rust-lang/rust/issues/48685 - let diagnostics = tcx.queries.on_disk_cache - .load_diagnostics(tcx, prev_dep_node_index); + // Promote the previous diagnostics to the current session. + tcx.queries.on_disk_cache + .store_diagnostics(dep_node_index, diagnostics.clone().into()); - if diagnostics.len() > 0 { - let handle = tcx.sess.diagnostic(); + for diagnostic in diagnostics { + DiagnosticBuilder::new_diagnostic(handle, diagnostic).emit(); + } - // Promote the previous diagnostics to the current session. - tcx.queries.on_disk_cache - .store_diagnostics(dep_node_index, diagnostics.clone()); + #[cfg(parallel_compiler)] + { + // Mark the diagnostics and emitted and wake up waiters + data.emitted_diagnostics.lock().insert(dep_node_index); + data.emitted_diagnostics_cond_var.notify_all(); + } + } else { + // The other threads will wait for the diagnostics to be emitted - for diagnostic in diagnostics { - DiagnosticBuilder::new_diagnostic(handle, diagnostic).emit(); + let mut emitted_diagnostics = data.emitted_diagnostics.lock(); + loop { + if emitted_diagnostics.contains(&dep_node_index) { + break; } + data.emitted_diagnostics_cond_var.wait(&mut emitted_diagnostics); } } - - // ... and finally storing a "Green" entry in the color map. - let mut colors = data.colors.borrow_mut(); - // Multiple threads can all write the same color here - #[cfg(not(parallel_queries))] - debug_assert!(colors.get(prev_dep_node_index).is_none(), - "DepGraph::try_mark_green() - Duplicate DepNodeColor \ - insertion for {:?}", dep_node); - - colors.insert(prev_dep_node_index, DepNodeColor::Green(dep_node_index)); - - debug!("try_mark_green({:?}) - END - successfully marked as green", dep_node); - Some(dep_node_index) } // Returns true if the given node has been marked as green during the @@ -795,9 +814,8 @@ impl DepGraph { pub fn exec_cache_promotions<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) { let green_nodes: Vec = { let data = self.data.as_ref().unwrap(); - let colors = data.colors.borrow(); - colors.values.indices().filter_map(|prev_index| { - match colors.get(prev_index) { + data.colors.values.indices().filter_map(|prev_index| { + match data.colors.get(prev_index) { Some(DepNodeColor::Green(_)) => { let dep_node = data.previous.index_to_node(prev_index); if dep_node.cache_on_disk(tcx) { @@ -824,7 +842,7 @@ impl DepGraph { pub fn mark_loaded_from_cache(&self, dep_node_index: DepNodeIndex, state: bool) { debug!("mark_loaded_from_cache({:?}, {})", - self.data.as_ref().unwrap().current.borrow().nodes[dep_node_index], + self.data.as_ref().unwrap().current.borrow().data[dep_node_index].node, state); self.data @@ -887,10 +905,17 @@ pub enum WorkProductFileKind { BytecodeCompressed, } +#[derive(Clone)] +struct DepNodeData { + node: DepNode, + edges: SmallVec<[DepNodeIndex; 8]>, + fingerprint: Fingerprint, +} + pub(super) struct CurrentDepGraph { - nodes: IndexVec, - edges: IndexVec>, + data: IndexVec, node_to_node_index: FxHashMap, + #[allow(dead_code)] forbidden_edge: Option, // Anonymous DepNodes are nodes the ID of which we compute from the list of @@ -911,7 +936,7 @@ pub(super) struct CurrentDepGraph { } impl CurrentDepGraph { - fn new() -> CurrentDepGraph { + fn new(prev_graph_node_count: usize) -> CurrentDepGraph { use std::time::{SystemTime, UNIX_EPOCH}; let duration = SystemTime::now().duration_since(UNIX_EPOCH).unwrap(); @@ -934,10 +959,17 @@ impl CurrentDepGraph { None }; + // Pre-allocate the dep node structures. We over-allocate a little so + // that we hopefully don't have to re-allocate during this compilation + // session. + let new_node_count_estimate = (prev_graph_node_count * 115) / 100; + CurrentDepGraph { - nodes: IndexVec::new(), - edges: IndexVec::new(), - node_to_node_index: Default::default(), + data: IndexVec::with_capacity(new_node_count_estimate), + node_to_node_index: FxHashMap::with_capacity_and_hasher( + new_node_count_estimate, + Default::default(), + ), anon_id_seed: stable_hasher.finish(), forbidden_edge, total_read_count: 0, @@ -945,108 +977,116 @@ impl CurrentDepGraph { } } - fn complete_task(&mut self, key: DepNode, task: OpenTask) -> DepNodeIndex { - if let OpenTask::Regular(task) = task { - let RegularOpenTask { - node, - read_set: _, - reads - } = task.into_inner(); - assert_eq!(node, key); - - // If this is an input node, we expect that it either has no - // dependencies, or that it just depends on DepKind::CrateMetadata - // or DepKind::Krate. This happens for some "thin wrapper queries" - // like `crate_disambiguator` which sometimes have zero deps (for - // when called for LOCAL_CRATE) or they depend on a CrateMetadata - // node. - if cfg!(debug_assertions) { - if node.kind.is_input() && reads.len() > 0 && - // FIXME(mw): Special case for DefSpan until Spans are handled - // better in general. - node.kind != DepKind::DefSpan && - reads.iter().any(|&i| { - !(self.nodes[i].kind == DepKind::CrateMetadata || - self.nodes[i].kind == DepKind::Krate) - }) - { - bug!("Input node {:?} with unexpected reads: {:?}", - node, - reads.iter().map(|&i| self.nodes[i]).collect::>()) - } + fn complete_task( + &mut self, + node: DepNode, + task_deps: TaskDeps, + fingerprint: Fingerprint + ) -> DepNodeIndex { + // If this is an input node, we expect that it either has no + // dependencies, or that it just depends on DepKind::CrateMetadata + // or DepKind::Krate. This happens for some "thin wrapper queries" + // like `crate_disambiguator` which sometimes have zero deps (for + // when called for LOCAL_CRATE) or they depend on a CrateMetadata + // node. + if cfg!(debug_assertions) { + if node.kind.is_input() && task_deps.reads.len() > 0 && + // FIXME(mw): Special case for DefSpan until Spans are handled + // better in general. + node.kind != DepKind::DefSpan && + task_deps.reads.iter().any(|&i| { + !(self.data[i].node.kind == DepKind::CrateMetadata || + self.data[i].node.kind == DepKind::Krate) + }) + { + bug!("Input node {:?} with unexpected reads: {:?}", + node, + task_deps.reads.iter().map(|&i| self.data[i].node).collect::>()) } - - self.alloc_node(node, reads) - } else { - bug!("complete_task() - Expected regular task to be popped") } + + self.alloc_node(node, task_deps.reads, fingerprint) } - fn pop_anon_task(&mut self, kind: DepKind, task: OpenTask) -> DepNodeIndex { - if let OpenTask::Anon(task) = task { - let AnonOpenTask { - read_set: _, - reads - } = task.into_inner(); - debug_assert!(!kind.is_input()); + fn complete_anon_task(&mut self, kind: DepKind, task_deps: TaskDeps) -> DepNodeIndex { + debug_assert!(!kind.is_input()); - let mut fingerprint = self.anon_id_seed; - let mut hasher = StableHasher::new(); + let mut fingerprint = self.anon_id_seed; + let mut hasher = StableHasher::new(); - for &read in reads.iter() { - let read_dep_node = self.nodes[read]; + for &read in task_deps.reads.iter() { + let read_dep_node = self.data[read].node; - ::std::mem::discriminant(&read_dep_node.kind).hash(&mut hasher); + ::std::mem::discriminant(&read_dep_node.kind).hash(&mut hasher); - // Fingerprint::combine() is faster than sending Fingerprint - // through the StableHasher (at least as long as StableHasher - // is so slow). - fingerprint = fingerprint.combine(read_dep_node.hash); - } + // Fingerprint::combine() is faster than sending Fingerprint + // through the StableHasher (at least as long as StableHasher + // is so slow). + fingerprint = fingerprint.combine(read_dep_node.hash); + } - fingerprint = fingerprint.combine(hasher.finish()); + fingerprint = fingerprint.combine(hasher.finish()); - let target_dep_node = DepNode { - kind, - hash: fingerprint, - }; + let target_dep_node = DepNode { + kind, + hash: fingerprint, + }; - if let Some(&index) = self.node_to_node_index.get(&target_dep_node) { - index - } else { - self.alloc_node(target_dep_node, reads) - } - } else { - bug!("pop_anon_task() - Expected anonymous task to be popped") - } + self.intern_node(target_dep_node, task_deps.reads, Fingerprint::ZERO).0 } - fn complete_eval_always_task(&mut self, key: DepNode, task: OpenTask) -> DepNodeIndex { - if let OpenTask::EvalAlways { - node, - } = task { - debug_assert_eq!(node, key); - let krate_idx = self.node_to_node_index[&DepNode::new_no_params(DepKind::Krate)]; - self.alloc_node(node, smallvec![krate_idx]) - } else { - bug!("complete_eval_always_task() - Expected eval always task to be popped"); + fn alloc_node( + &mut self, + dep_node: DepNode, + edges: SmallVec<[DepNodeIndex; 8]>, + fingerprint: Fingerprint + ) -> DepNodeIndex { + debug_assert!(!self.node_to_node_index.contains_key(&dep_node)); + self.intern_node(dep_node, edges, fingerprint).0 + } + + fn intern_node( + &mut self, + dep_node: DepNode, + edges: SmallVec<[DepNodeIndex; 8]>, + fingerprint: Fingerprint + ) -> (DepNodeIndex, bool) { + debug_assert_eq!(self.node_to_node_index.len(), self.data.len()); + + match self.node_to_node_index.entry(dep_node) { + Entry::Occupied(entry) => (*entry.get(), false), + Entry::Vacant(entry) => { + let dep_node_index = DepNodeIndex::new(self.data.len()); + self.data.push(DepNodeData { + node: dep_node, + edges, + fingerprint + }); + entry.insert(dep_node_index); + (dep_node_index, true) + } } } +} - fn read_index(&mut self, source: DepNodeIndex) { +impl DepGraphData { + fn read_index(&self, source: DepNodeIndex) { ty::tls::with_context_opt(|icx| { - let icx = if let Some(icx) = icx { icx } else { return }; - match *icx.task { - OpenTask::Regular(ref task) => { - let mut task = task.lock(); - self.total_read_count += 1; - if task.read_set.insert(source) { - task.reads.push(source); - - if cfg!(debug_assertions) { - if let Some(ref forbidden_edge) = self.forbidden_edge { - let target = &task.node; - let source = self.nodes[source]; + let icx = if let Some(icx) = icx { icx } else { return }; + if let Some(task_deps) = icx.task_deps { + let mut task_deps = task_deps.lock(); + if cfg!(debug_assertions) { + self.current.lock().total_read_count += 1; + } + if task_deps.read_set.insert(source) { + task_deps.reads.push(source); + + #[cfg(debug_assertions)] + { + if let Some(target) = task_deps.node { + let graph = self.current.lock(); + if let Some(ref forbidden_edge) = graph.forbidden_edge { + let source = graph.data[source].node; if forbidden_edge.test(&source, &target) { bug!("forbidden edge {:?} -> {:?} created", source, @@ -1054,62 +1094,26 @@ impl CurrentDepGraph { } } } - } else { - self.total_duplicate_read_count += 1; } - } - OpenTask::Anon(ref task) => { - let mut task = task.lock(); - if task.read_set.insert(source) { - task.reads.push(source); - } - } - OpenTask::Ignore | OpenTask::EvalAlways { .. } => { - // ignore + } else if cfg!(debug_assertions) { + self.current.lock().total_duplicate_read_count += 1; } } }) } - - fn alloc_node(&mut self, - dep_node: DepNode, - edges: SmallVec<[DepNodeIndex; 8]>) - -> DepNodeIndex { - debug_assert_eq!(self.edges.len(), self.nodes.len()); - debug_assert_eq!(self.node_to_node_index.len(), self.nodes.len()); - debug_assert!(!self.node_to_node_index.contains_key(&dep_node)); - let dep_node_index = DepNodeIndex::new(self.nodes.len()); - self.nodes.push(dep_node); - self.node_to_node_index.insert(dep_node, dep_node_index); - self.edges.push(edges); - dep_node_index - } } -pub struct RegularOpenTask { - node: DepNode, +pub struct TaskDeps { + #[cfg(debug_assertions)] + node: Option, reads: SmallVec<[DepNodeIndex; 8]>, read_set: FxHashSet, } -pub struct AnonOpenTask { - reads: SmallVec<[DepNodeIndex; 8]>, - read_set: FxHashSet, -} - -pub enum OpenTask { - Regular(Lock), - Anon(Lock), - Ignore, - EvalAlways { - node: DepNode, - }, -} - // A data structure that stores Option values as a contiguous // array, using one u32 per entry. struct DepNodeColorMap { - values: IndexVec, + values: IndexVec, } const COMPRESSED_NONE: u32 = 0; @@ -1119,12 +1123,12 @@ const COMPRESSED_FIRST_GREEN: u32 = 2; impl DepNodeColorMap { fn new(size: usize) -> DepNodeColorMap { DepNodeColorMap { - values: IndexVec::from_elem_n(COMPRESSED_NONE, size) + values: (0..size).map(|_| AtomicU32::new(COMPRESSED_NONE)).collect(), } } fn get(&self, index: SerializedDepNodeIndex) -> Option { - match self.values[index] { + match self.values[index].load(Ordering::Acquire) { COMPRESSED_NONE => None, COMPRESSED_RED => Some(DepNodeColor::Red), value => Some(DepNodeColor::Green(DepNodeIndex::from_u32( @@ -1133,10 +1137,10 @@ impl DepNodeColorMap { } } - fn insert(&mut self, index: SerializedDepNodeIndex, color: DepNodeColor) { - self.values[index] = match color { + fn insert(&self, index: SerializedDepNodeIndex, color: DepNodeColor) { + self.values[index].store(match color { DepNodeColor::Red => COMPRESSED_RED, DepNodeColor::Green(index) => index.as_u32() + COMPRESSED_FIRST_GREEN, - } + }, Ordering::Release) } } diff --git a/src/librustc/dep_graph/mod.rs b/src/librustc/dep_graph/mod.rs index 158edc6c59e..022caabcbf3 100644 --- a/src/librustc/dep_graph/mod.rs +++ b/src/librustc/dep_graph/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod debug; mod dep_node; mod dep_tracking_map; @@ -20,7 +10,7 @@ pub mod cgu_reuse_tracker; pub use self::dep_tracking_map::{DepTrackingMap, DepTrackingMapConfig}; pub use self::dep_node::{DepNode, DepKind, DepConstructor, WorkProductId, label_strs}; -pub use self::graph::{DepGraph, WorkProduct, DepNodeIndex, DepNodeColor, OpenTask}; +pub use self::graph::{DepGraph, WorkProduct, DepNodeIndex, DepNodeColor, TaskDeps}; pub use self::graph::WorkProductFileKind; pub use self::prev::PreviousDepGraph; pub use self::query::DepGraphQuery; diff --git a/src/librustc/dep_graph/prev.rs b/src/librustc/dep_graph/prev.rs index ebc50f4afb8..ea5350ac97f 100644 --- a/src/librustc/dep_graph/prev.rs +++ b/src/librustc/dep_graph/prev.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ich::Fingerprint; use rustc_data_structures::fx::FxHashMap; use super::dep_node::DepNode; @@ -29,14 +19,11 @@ impl PreviousDepGraph { } #[inline] - pub fn edges_from(&self, - dep_node: &DepNode) - -> Option<(&[SerializedDepNodeIndex], SerializedDepNodeIndex)> { - self.index - .get(dep_node) - .map(|&node_index| { - (self.data.edge_targets_from(node_index), node_index) - }) + pub fn edge_targets_from( + &self, + dep_node_index: SerializedDepNodeIndex + ) -> &[SerializedDepNodeIndex] { + self.data.edge_targets_from(dep_node_index) } #[inline] diff --git a/src/librustc/dep_graph/query.rs b/src/librustc/dep_graph/query.rs index 4aec2af887c..cd4ced238d3 100644 --- a/src/librustc/dep_graph/query.rs +++ b/src/librustc/dep_graph/query.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::graph::implementation::{ Direction, INCOMING, Graph, NodeIndex, OUTGOING diff --git a/src/librustc/dep_graph/safe.rs b/src/librustc/dep_graph/safe.rs index f82bf9be033..f1e8224a70d 100644 --- a/src/librustc/dep_graph/safe.rs +++ b/src/librustc/dep_graph/safe.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The `DepGraphSafe` trait use hir::BodyId; diff --git a/src/librustc/dep_graph/serialized.rs b/src/librustc/dep_graph/serialized.rs index 0c6c224fa91..3c04f01a5e1 100644 --- a/src/librustc/dep_graph/serialized.rs +++ b/src/librustc/dep_graph/serialized.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The data that we will serialize and deserialize. use dep_graph::DepNode; diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 96590c1fc72..6644175bbd8 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] // Error messages for EXXXX errors. @@ -47,7 +37,7 @@ trait Foo where Self: Sized { We cannot create an object of type `Box` or `&Foo` since in this case `Self` would not be `Sized`. -Generally, `Self : Sized` is used to indicate that the trait should not be used +Generally, `Self: Sized` is used to indicate that the trait should not be used as a trait object. If the trait comes from your own crate, consider removing this restriction. @@ -217,9 +207,9 @@ trait Trait { ``` If this is not an option, consider replacing the type parameter with another -trait object (e.g. if `T: OtherTrait`, use `on: Box`). If the number -of types you intend to feed to this method is limited, consider manually listing -out the methods of different types. +trait object (e.g., if `T: OtherTrait`, use `on: Box`). If the +number of types you intend to feed to this method is limited, consider manually +listing out the methods of different types. ### Method has no receiver @@ -372,6 +362,10 @@ struct Foo1 { x: &bool } // ^ expected lifetime parameter struct Foo2<'a> { x: &'a bool } // correct +impl Foo2 {} + // ^^^^ expected lifetime parameter +impl<'a> Foo2<'a> {} // correct + struct Bar1 { x: Foo2 } // ^^^^ expected lifetime parameter struct Bar2<'a> { x: Foo2<'a> } // correct @@ -642,7 +636,7 @@ struct Foo; // error: duplicate lang item found: `arc` ``` Lang items are already implemented in the standard library. Unless you are -writing a free-standing application (e.g. a kernel), you do not need to provide +writing a free-standing application (e.g., a kernel), you do not need to provide them yourself. You can build a free-standing crate by adding `#![no_std]` to the crate @@ -699,7 +693,7 @@ This error appears when the curly braces contain an identifier which doesn't match with any of the type parameters or the string `Self`. This might happen if you misspelled a type parameter, or if you intended to use literal curly braces. If it is the latter, escape the curly braces with a second curly brace -of the same type; e.g. a literal `{` is `{{`. +of the same type; e.g., a literal `{` is `{{`. "##, E0231: r##" @@ -776,11 +770,40 @@ struct Foo { These can be fixed by declaring lifetime parameters: ``` +struct Foo<'a> { + x: &'a str, +} + fn foo<'a>(x: &'a str) {} +``` + +Impl blocks declare lifetime parameters separately. You need to add lifetime +parameters to an impl block if you're implementing a type that has a lifetime +parameter of its own. +For example: + +```compile_fail,E0261 +struct Foo<'a> { + x: &'a str, +} + +// error, use of undeclared lifetime name `'a` +impl Foo<'a> { + fn foo<'a>(x: &'a str) {} +} +``` +This is fixed by declaring the impl block like this: + +``` struct Foo<'a> { x: &'a str, } + +// correct +impl<'a> Foo<'a> { + fn foo(x: &'a str) {} +} ``` "##, @@ -832,7 +855,7 @@ extern "C" { E0271: r##" This is because of a type mismatch between the associated type of some -trait (e.g. `T::Bar`, where `T` implements `trait Quux { type Bar; }`) +trait (e.g., `T::Bar`, where `T` implements `trait Quux { type Bar; }`) and another type `U` that is required to be equal to `T::Bar`, but is not. Examples follow. @@ -1164,7 +1187,7 @@ impl Generator for AnotherImpl { fn main() { let cont: u32 = Generator::create(); // error, impossible to choose one of Generator trait implementation - // Impl or AnotherImpl? Maybe anything else? + // Should it be Impl or AnotherImpl, maybe something else? } ``` @@ -1190,27 +1213,6 @@ fn main() { ``` "##, -E0296: r##" -This error indicates that the given recursion limit could not be parsed. Ensure -that the value provided is a positive integer between quotes. - -Erroneous code example: - -```compile_fail,E0296 -#![recursion_limit] - -fn main() {} -``` - -And a working example: - -``` -#![recursion_limit="1000"] - -fn main() {} -``` -"##, - E0308: r##" This error occurs when the compiler was unable to infer the concrete type of a variable. It can occur for several cases, the most common of which is a @@ -1562,7 +1564,8 @@ fn takes_u8(_: u8) {} fn main() { unsafe { takes_u8(::std::mem::transmute(0u16)); } - // error: transmute called with types of different sizes + // error: cannot transmute between types of different sizes, + // or dependently-sized types } ``` @@ -1622,7 +1625,7 @@ representation of enums isn't strictly defined in Rust, and this attribute won't work on enums. `#[repr(simd)]` will give a struct consisting of a homogeneous series of machine -types (i.e. `u8`, `i32`, etc) a representation that permits vectorization via +types (i.e., `u8`, `i32`, etc) a representation that permits vectorization via SIMD. This doesn't make much sense for enums since they don't consist of a single list of data. "##, @@ -2102,20 +2105,6 @@ trait Foo { } ``` "##, -E0702: r##" -This error indicates that a `#[non_exhaustive]` attribute had a value. The -`#[non_exhaustive]` should be empty. - -Examples of erroneous code: - -```compile_fail,E0702 -# #![feature(non_exhaustive)] - -#[non_exhaustive(anything)] -struct Foo; -``` -"##, - E0718: r##" This error indicates that a `#[lang = ".."]` attribute was placed on the wrong type of item. @@ -2147,6 +2136,7 @@ register_diagnostics! { E0280, // requirement is not satisfied E0284, // cannot resolve type // E0285, // overflow evaluation builtin bounds +// E0296, // replaced with a generic attribute input check // E0300, // unexpanded macro // E0304, // expected signed integer constant // E0305, // expected constant @@ -2189,4 +2179,5 @@ register_diagnostics! { E0709, // multiple different lifetimes used in arguments of `async fn` E0710, // an unknown tool name found in scoped lint E0711, // a feature has been declared with conflicting stability attributes +// E0702, // replaced with a generic attribute input check } diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 020012d756a..df111b2be31 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -1,22 +1,17 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module implements some validity checks for attributes. //! In particular it verifies that `#[inline]` and `#[repr]` attributes are //! attached to items that actually support them and if there are //! conflicts between multiple such attributes attached to the same //! item. + +use ty::TyCtxt; +use ty::query::Providers; +use ty::query::queries; + use hir; +use hir::def_id::DefId; use hir::intravisit::{self, Visitor, NestedVisitorMap}; -use ty::TyCtxt; use std::fmt::{self, Display}; use syntax_pos::Span; @@ -100,7 +95,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { /// Check any attribute. fn check_attributes(&self, item: &hir::Item, target: Target) { if target == Target::Fn || target == Target::Const { - self.tcx.codegen_fn_attrs(self.tcx.hir.local_def_id(item.id)); + self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(item.id)); } else if let Some(a) = item.attrs.iter().find(|a| a.check_name("target_feature")) { self.tcx.sess.struct_span_err(a.span, "attribute should be applied to a function") .span_label(item.span, "not a function") @@ -147,15 +142,6 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { return; } } - - if attr.meta_item_list().is_some() || attr.value_str().is_some() { - struct_span_err!(self.tcx.sess, - attr.span, - E0702, - "attribute should be empty") - .span_label(item.span, "not empty") - .emit(); - } } /// Check if the `#[marker]` attribute on an `item` is valid. @@ -170,12 +156,6 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { return; } } - - if !attr.is_word() { - self.tcx.sess - .struct_span_err(attr.span, "attribute should be empty") - .emit(); - } } /// Check if the `#[repr]` attributes on `item` are valid. @@ -303,8 +283,8 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { fn check_stmt_attributes(&self, stmt: &hir::Stmt) { // When checking statements ignore expressions, they will be checked later - if let hir::StmtKind::Decl(_, _) = stmt.node { - for attr in stmt.node.attrs() { + if let hir::StmtKind::Local(ref l) = stmt.node { + for attr in l.attrs.iter() { if attr.check_name("inline") { self.check_inline(attr, &stmt.span, Target::Statement); } @@ -352,7 +332,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { impl<'a, 'tcx> Visitor<'tcx> for CheckAttrVisitor<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::OnlyBodies(&self.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } fn visit_item(&mut self, item: &'tcx hir::Item) { @@ -374,8 +354,9 @@ impl<'a, 'tcx> Visitor<'tcx> for CheckAttrVisitor<'a, 'tcx> { } pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - let mut checker = CheckAttrVisitor { tcx }; - tcx.hir.krate().visit_all_item_likes(&mut checker.as_deep_visitor()); + for &module in tcx.hir().krate().modules.keys() { + queries::check_mod_attrs::ensure(tcx, tcx.hir().local_def_id(module)); + } } fn is_c_like_enum(item: &hir::Item) -> bool { @@ -391,3 +372,17 @@ fn is_c_like_enum(item: &hir::Item) -> bool { false } } + +fn check_mod_attrs<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { + tcx.hir().visit_item_likes_in_module( + module_def_id, + &mut CheckAttrVisitor { tcx }.as_deep_visitor() + ); +} + +pub(crate) fn provide(providers: &mut Providers<'_>) { + *providers = Providers { + check_mod_attrs, + ..*providers + }; +} diff --git a/src/librustc/hir/def.rs b/src/librustc/hir/def.rs index 50922ee601d..8a74c51d3f7 100644 --- a/src/librustc/hir/def.rs +++ b/src/librustc/hir/def.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def_id::DefId; use util::nodemap::{NodeMap, DefIdMap}; use syntax::ast; @@ -46,7 +36,7 @@ pub enum NonMacroAttrKind { pub enum Def { // Type namespace Mod(DefId), - Struct(DefId), // DefId refers to NodeId of the struct itself + Struct(DefId), // `DefId` refers to `NodeId` of the struct itself Union(DefId), Enum(DefId), Variant(DefId), @@ -63,27 +53,27 @@ pub enum Def { PrimTy(hir::PrimTy), TyParam(DefId), SelfTy(Option /* trait */, Option /* impl */), - ToolMod, // e.g. `rustfmt` in `#[rustfmt::skip]` + ToolMod, // e.g., `rustfmt` in `#[rustfmt::skip]` // Value namespace Fn(DefId), Const(DefId), Static(DefId, bool /* is_mutbl */), - StructCtor(DefId, CtorKind), // DefId refers to NodeId of the struct's constructor - VariantCtor(DefId, CtorKind), // DefId refers to the enum variant - SelfCtor(DefId /* impl */), // DefId refers to the impl + StructCtor(DefId, CtorKind), // `DefId` refers to `NodeId` of the struct's constructor + VariantCtor(DefId, CtorKind), // `DefId` refers to the enum variant + SelfCtor(DefId /* impl */), // `DefId` refers to the impl Method(DefId), AssociatedConst(DefId), Local(ast::NodeId), - Upvar(ast::NodeId, // node id of closed over local - usize, // index in the freevars list of the closure + Upvar(ast::NodeId, // `NodeId` of closed over local + usize, // index in the `freevars` list of the closure ast::NodeId), // expr node that creates the closure Label(ast::NodeId), // Macro namespace Macro(DefId, MacroKind), - NonMacroAttr(NonMacroAttrKind), // e.g. `#[inline]` or `#[rustfmt::skip]` + NonMacroAttr(NonMacroAttrKind), // e.g., `#[inline]` or `#[rustfmt::skip]` // Both namespaces Err, @@ -170,6 +160,7 @@ impl PerNS { impl ::std::ops::Index for PerNS { type Output = T; + fn index(&self, ns: Namespace) -> &T { match ns { ValueNS => &self.value_ns, @@ -238,6 +229,7 @@ impl CtorKind { ast::VariantData::Struct(..) => CtorKind::Fictive, } } + pub fn from_hir(vdata: &hir::VariantData) -> CtorKind { match *vdata { hir::VariantData::Tuple(..) => CtorKind::Fn, @@ -248,7 +240,7 @@ impl CtorKind { } impl NonMacroAttrKind { - fn descr(self) -> &'static str { + pub fn descr(self) -> &'static str { match self { NonMacroAttrKind::Builtin => "built-in attribute", NonMacroAttrKind::Tool => "tool attribute", @@ -292,7 +284,7 @@ impl Def { } } - /// A human readable kind name + /// A human readable name for the def kind ("function", "module", etc.). pub fn kind_name(&self) -> &'static str { match *self { Def::Fn(..) => "function", @@ -332,6 +324,7 @@ impl Def { } } + /// An English article for the def. pub fn article(&self) -> &'static str { match *self { Def::AssociatedTy(..) | Def::AssociatedConst(..) | Def::AssociatedExistential(..) | diff --git a/src/librustc/hir/def_id.rs b/src/librustc/hir/def_id.rs index 319d63f66c4..9181076740b 100644 --- a/src/librustc/hir/def_id.rs +++ b/src/librustc/hir/def_id.rs @@ -1,14 +1,5 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ty; +use ty::TyCtxt; use hir::map::definitions::FIRST_FREE_HIGH_DEF_INDEX; use rustc_data_structures::indexed_vec::Idx; use serialize; @@ -27,8 +18,6 @@ pub enum CrateNum { // FIXME(jseyfried): this is also used for custom derives until proc-macro crates get // `CrateNum`s. BuiltinMacros, - /// A CrateNum value that indicates that something is wrong. - Invalid, /// A special CrateNum that we use for the tcx.rcache when decoding from /// the incr. comp. cache. ReservedForIncrCompCache, @@ -39,7 +28,6 @@ impl ::std::fmt::Debug for CrateNum { fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { match self { CrateNum::Index(id) => write!(fmt, "crate{}", id.private), - CrateNum::Invalid => write!(fmt, "invalid crate"), CrateNum::BuiltinMacros => write!(fmt, "builtin macros crate"), CrateNum::ReservedForIncrCompCache => write!(fmt, "crate for decoding incr comp cache"), } @@ -100,7 +88,6 @@ impl fmt::Display for CrateNum { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { CrateNum::Index(id) => fmt::Display::fmt(&id.private, f), - CrateNum::Invalid => write!(f, "invalid crate"), CrateNum::BuiltinMacros => write!(f, "builtin macros crate"), CrateNum::ReservedForIncrCompCache => write!(f, "crate for decoding incr comp cache"), } @@ -257,6 +244,14 @@ impl DefId { pub fn to_local(self) -> LocalDefId { LocalDefId::from_def_id(self) } + + pub fn describe_as_module(&self, tcx: TyCtxt<'_, '_, '_>) -> String { + if self.is_local() && self.index == CRATE_DEF_INDEX { + format!("top-level module") + } else { + format!("module `{}`", tcx.item_path_str(*self)) + } + } } impl serialize::UseSpecializedEncodable for DefId {} diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index d9963f23a15..592fb7898f3 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! HIR walker for walking the contents of nodes. //! //! **For an overview of the visitor strategy, see the docs on the @@ -45,20 +35,18 @@ use syntax::ast::{NodeId, CRATE_NODE_ID, Ident, Name, Attribute}; use syntax_pos::Span; use hir::*; use hir::def::Def; -use hir::map::{self, Map}; +use hir::map::Map; use super::itemlikevisit::DeepVisitor; -use std::cmp; - #[derive(Copy, Clone)] pub enum FnKind<'a> { - /// #[xxx] pub async/const/extern "Abi" fn foo() - ItemFn(Name, &'a Generics, FnHeader, &'a Visibility, &'a [Attribute]), + /// `#[xxx] pub async/const/extern "Abi" fn foo()` + ItemFn(Ident, &'a Generics, FnHeader, &'a Visibility, &'a [Attribute]), - /// fn foo(&self) + /// `fn foo(&self)` Method(Ident, &'a MethodSig, Option<&'a Visibility>, &'a [Attribute]), - /// |x, y| {} + /// `|x, y| {}` Closure(&'a [Attribute]), } @@ -131,7 +119,7 @@ impl<'this, 'tcx> NestedVisitorMap<'this, 'tcx> { /// Each method of the Visitor trait is a hook to be potentially /// overridden. Each method's default implementation recursively visits /// the substructure of the input via the corresponding `walk` method; -/// e.g. the `visit_mod` method by default calls `intravisit::walk_mod`. +/// e.g., the `visit_mod` method by default calls `intravisit::walk_mod`. /// /// Note that this visitor does NOT visit nested items by default /// (this is why the module is called `intravisit`, to distinguish it @@ -270,9 +258,6 @@ pub trait Visitor<'v> : Sized { fn visit_pat(&mut self, p: &'v Pat) { walk_pat(self, p) } - fn visit_decl(&mut self, d: &'v Decl) { - walk_decl(self, d) - } fn visit_anon_const(&mut self, c: &'v AnonConst) { walk_anon_const(self, c) } @@ -464,7 +449,7 @@ pub fn walk_trait_ref<'v, V>(visitor: &mut V, trait_ref: &'v TraitRef) pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) { visitor.visit_vis(&item.vis); - visitor.visit_name(item.span, item.name); + visitor.visit_ident(item.ident); match item.node { ItemKind::ExternCrate(orig_name) => { visitor.visit_id(item.id); @@ -482,7 +467,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) { visitor.visit_nested_body(body); } ItemKind::Fn(ref declaration, header, ref generics, body_id) => { - visitor.visit_fn(FnKind::ItemFn(item.name, + visitor.visit_fn(FnKind::ItemFn(item.ident, generics, header, &item.vis, @@ -493,7 +478,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) { item.id) } ItemKind::Mod(ref module) => { - // visit_mod() takes care of visiting the Item's NodeId + // `visit_mod()` takes care of visiting the `Item`'s `NodeId`. visitor.visit_mod(module, item.span, item.id) } ItemKind::ForeignMod(ref foreign_module) => { @@ -518,7 +503,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) { } ItemKind::Enum(ref enum_definition, ref type_parameters) => { visitor.visit_generics(type_parameters); - // visit_enum_def() takes care of visiting the Item's NodeId + // `visit_enum_def()` takes care of visiting the `Item`'s `NodeId`. visitor.visit_enum_def(enum_definition, type_parameters, item.id, item.span) } ItemKind::Impl( @@ -538,7 +523,8 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) { ItemKind::Union(ref struct_definition, ref generics) => { visitor.visit_generics(generics); visitor.visit_id(item.id); - visitor.visit_variant_data(struct_definition, item.name, generics, item.id, item.span); + visitor.visit_variant_data(struct_definition, item.ident.name, generics, item.id, + item.span); } ItemKind::Trait(.., ref generics, ref bounds, ref trait_item_refs) => { visitor.visit_id(item.id); @@ -579,9 +565,9 @@ pub fn walk_variant<'v, V: Visitor<'v>>(visitor: &mut V, variant: &'v Variant, generics: &'v Generics, parent_item_id: NodeId) { - visitor.visit_name(variant.span, variant.node.name); + visitor.visit_ident(variant.node.ident); visitor.visit_variant_data(&variant.node.data, - variant.node.name, + variant.node.ident.name, generics, parent_item_id, variant.span); @@ -730,7 +716,7 @@ pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat) { pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, foreign_item: &'v ForeignItem) { visitor.visit_id(foreign_item.id); visitor.visit_vis(&foreign_item.vis); - visitor.visit_name(foreign_item.span, foreign_item.name); + visitor.visit_ident(foreign_item.ident); match foreign_item.node { ForeignItemKind::Fn(ref function_declaration, ref param_names, ref generics) => { @@ -877,7 +863,7 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v Trai } pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_item_ref: &'v TraitItemRef) { - // NB: Deliberately force a compilation error if/when new fields are added. + // N.B., deliberately force a compilation error if/when new fields are added. let TraitItemRef { id, ident, ref kind, span: _, ref defaultness } = *trait_item_ref; visitor.visit_nested_trait_item(id); visitor.visit_ident(ident); @@ -886,7 +872,7 @@ pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_item_ref: } pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplItem) { - // NB: Deliberately force a compilation error if/when new fields are added. + // N.B., deliberately force a compilation error if/when new fields are added. let ImplItem { id: _, hir_id: _, @@ -932,7 +918,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt } pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, impl_item_ref: &'v ImplItemRef) { - // NB: Deliberately force a compilation error if/when new fields are added. + // N.B., deliberately force a compilation error if/when new fields are added. let ImplItemRef { id, ident, ref kind, span: _, ref vis, ref defaultness } = *impl_item_ref; visitor.visit_nested_impl_item(id); visitor.visit_ident(ident); @@ -962,26 +948,17 @@ pub fn walk_block<'v, V: Visitor<'v>>(visitor: &mut V, block: &'v Block) { } pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt) { + visitor.visit_id(statement.id); match statement.node { - StmtKind::Decl(ref declaration, id) => { - visitor.visit_id(id); - visitor.visit_decl(declaration) - } - StmtKind::Expr(ref expression, id) | - StmtKind::Semi(ref expression, id) => { - visitor.visit_id(id); + StmtKind::Local(ref local) => visitor.visit_local(local), + StmtKind::Item(ref item) => visitor.visit_nested_item(**item), + StmtKind::Expr(ref expression) | + StmtKind::Semi(ref expression) => { visitor.visit_expr(expression) } } } -pub fn walk_decl<'v, V: Visitor<'v>>(visitor: &mut V, declaration: &'v Decl) { - match declaration.node { - DeclKind::Local(ref local) => visitor.visit_local(local), - DeclKind::Item(item) => visitor.visit_nested_item(item), - } -} - pub fn walk_anon_const<'v, V: Visitor<'v>>(visitor: &mut V, constant: &'v AnonConst) { visitor.visit_id(constant.id); visitor.visit_nested_body(constant.body); @@ -1109,6 +1086,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) { ExprKind::Yield(ref subexpression) => { visitor.visit_expr(subexpression); } + ExprKind::Err => {} } } @@ -1141,57 +1119,3 @@ pub fn walk_defaultness<'v, V: Visitor<'v>>(_: &mut V, _: &'v Defaultness) { // the right thing to do, should content be added in the future, // would be to walk it. } - -#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)] -pub struct IdRange { - pub min: NodeId, - pub max: NodeId, -} - -impl IdRange { - pub fn max() -> IdRange { - IdRange { - min: NodeId::MAX, - max: NodeId::from_u32(0), - } - } - - pub fn empty(&self) -> bool { - self.min >= self.max - } - - pub fn contains(&self, id: NodeId) -> bool { - id >= self.min && id < self.max - } - - pub fn add(&mut self, id: NodeId) { - self.min = cmp::min(self.min, id); - self.max = cmp::max(self.max, NodeId::from_u32(id.as_u32() + 1)); - } -} - - -pub struct IdRangeComputingVisitor<'a, 'hir: 'a> { - result: IdRange, - map: &'a map::Map<'hir>, -} - -impl<'a, 'hir> IdRangeComputingVisitor<'a, 'hir> { - pub fn new(map: &'a map::Map<'hir>) -> IdRangeComputingVisitor<'a, 'hir> { - IdRangeComputingVisitor { result: IdRange::max(), map: map } - } - - pub fn result(&self) -> IdRange { - self.result - } -} - -impl<'a, 'hir> Visitor<'hir> for IdRangeComputingVisitor<'a, 'hir> { - fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'hir> { - NestedVisitorMap::OnlyBodies(&self.map) - } - - fn visit_id(&mut self, id: NodeId) { - self.result.add(id); - } -} diff --git a/src/librustc/hir/itemlikevisit.rs b/src/librustc/hir/itemlikevisit.rs index a62000e10c7..bfc9e8f06e2 100644 --- a/src/librustc/hir/itemlikevisit.rs +++ b/src/librustc/hir/itemlikevisit.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::{Item, ImplItem, TraitItem}; use super::intravisit::Visitor; @@ -19,7 +9,7 @@ use super::intravisit::Visitor; /// /// 1. **Shallow visit**: Get a simple callback for every item (or item-like thing) in the HIR. /// - Example: find all items with a `#[foo]` attribute on them. -/// - How: Implement `ItemLikeVisitor` and call `tcx.hir.krate().visit_all_item_likes()`. +/// - How: Implement `ItemLikeVisitor` and call `tcx.hir().krate().visit_all_item_likes()`. /// - Pro: Efficient; just walks the lists of item-like things, not the nodes themselves. /// - Con: Don't get information about nesting /// - Con: Don't have methods for specific bits of HIR, like "on @@ -29,7 +19,7 @@ use super::intravisit::Visitor; /// within one another. /// - Example: Examine each expression to look for its type and do some check or other. /// - How: Implement `intravisit::Visitor` and use -/// `tcx.hir.krate().visit_all_item_likes(visitor.as_deep_visitor())`. Within +/// `tcx.hir().krate().visit_all_item_likes(visitor.as_deep_visitor())`. Within /// your `intravisit::Visitor` impl, implement methods like /// `visit_expr()`; don't forget to invoke /// `intravisit::walk_visit_expr()` to keep walking the subparts. @@ -43,7 +33,7 @@ use super::intravisit::Visitor; /// - How: Implement `intravisit::Visitor` and override the /// `nested_visit_map()` methods to return /// `NestedVisitorMap::All`. Walk your crate with -/// `intravisit::walk_crate()` invoked on `tcx.hir.krate()`. +/// `intravisit::walk_crate()` invoked on `tcx.hir().krate()`. /// - Pro: Visitor methods for any kind of HIR node, not just item-like things. /// - Pro: Preserves nesting information /// - Con: Does not integrate well into dependency tracking. diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 7ac3b033437..51dbad92225 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Lowers the AST to the HIR. //! //! Since the AST and HIR are fairly similar, this is mostly a simple procedure, @@ -41,6 +31,7 @@ //! in the HIR, especially for multiple identifiers. use dep_graph::DepGraph; +use errors::Applicability; use hir::{self, ParamName}; use hir::HirVec; use hir::map::{DefKey, DefPathData, Definitions}; @@ -58,7 +49,7 @@ use session::config::nightly_options; use util::common::FN_OUTPUT_NAME; use util::nodemap::{DefIdMap, NodeMap}; -use std::collections::BTreeMap; +use std::collections::{BTreeSet, BTreeMap}; use std::fmt::Debug; use std::mem; use smallvec::SmallVec; @@ -67,13 +58,12 @@ use syntax::ast; use syntax::ast::*; use syntax::errors; use syntax::ext::hygiene::{Mark, SyntaxContext}; -use syntax::feature_gate::{emit_feature_err, GateIssue}; use syntax::print::pprust; use syntax::ptr::P; use syntax::source_map::{self, respan, CompilerDesugaringKind, Spanned}; use syntax::std_inject; use syntax::symbol::{keywords, Symbol}; -use syntax::tokenstream::{Delimited, TokenStream, TokenTree}; +use syntax::tokenstream::{TokenStream, TokenTree}; use syntax::parse::token::Token; use syntax::visit::{self, Visitor}; use syntax_pos::{Span, MultiSpan}; @@ -83,7 +73,7 @@ const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF; pub struct LoweringContext<'a> { crate_root: Option<&'static str>, - // Use to assign ids to hir nodes that do not directly correspond to an ast node + // Used to assign ids to HIR nodes that do not directly correspond to an AST node. sess: &'a Session, cstore: &'a dyn CrateStore, @@ -101,6 +91,8 @@ pub struct LoweringContext<'a> { trait_impls: BTreeMap>, trait_auto_impl: BTreeMap, + modules: BTreeMap, + is_generator: bool, catch_scopes: Vec, @@ -115,10 +107,10 @@ pub struct LoweringContext<'a> { anonymous_lifetime_mode: AnonymousLifetimeMode, // Used to create lifetime definitions from in-band lifetime usages. - // e.g. `fn foo(x: &'x u8) -> &'x u8` to `fn foo<'x>(x: &'x u8) -> &'x u8` + // e.g., `fn foo(x: &'x u8) -> &'x u8` to `fn foo<'x>(x: &'x u8) -> &'x u8` // When a named lifetime is encountered in a function or impl header and // has not been defined - // (i.e. it doesn't appear in the in_scope_lifetimes list), it is added + // (i.e., it doesn't appear in the in_scope_lifetimes list), it is added // to this list. The results of this list are then added to the list of // lifetime definitions in the corresponding impl or function generics. lifetimes_to_define: Vec<(Span, ParamName)>, @@ -135,6 +127,8 @@ pub struct LoweringContext<'a> { // needs to be created for it. in_scope_lifetimes: Vec, + current_module: NodeId, + type_def_lifetime_params: DefIdMap, current_hir_id_owner: Vec<(DefIndex, u32)>, @@ -150,7 +144,7 @@ pub trait Resolver { is_value: bool, ) -> hir::Path; - /// Obtain the resolution for a node id + /// Obtain the resolution for a node-id. fn get_resolution(&mut self, id: NodeId) -> Option; /// Obtain the possible resolutions for the given `use` statement. @@ -160,8 +154,8 @@ pub trait Resolver { /// This should only return `None` during testing. fn definitions(&mut self) -> &mut Definitions; - /// Given suffix ["b","c","d"], creates a HIR path for `[::crate_root]::b::c::d` and resolves - /// it based on `is_value`. + /// Given suffix `["b", "c", "d"]`, creates a HIR path for `[::crate_root]::b::c::d` and + /// resolves it based on `is_value`. fn resolve_str_path( &mut self, span: Span, @@ -186,7 +180,7 @@ enum ImplTraitContext<'a> { /// /// We optionally store a `DefId` for the parent item here so we can look up necessary /// information later. It is `None` when no information about the context should be stored, - /// e.g. for consts and statics. + /// e.g., for consts and statics. Existential(Option), /// `impl Trait` is not accepted in this position. @@ -239,12 +233,14 @@ pub fn lower_crate( bodies: BTreeMap::new(), trait_impls: BTreeMap::new(), trait_auto_impl: BTreeMap::new(), + modules: BTreeMap::new(), exported_macros: Vec::new(), catch_scopes: Vec::new(), loop_scopes: Vec::new(), is_in_loop_condition: false, anonymous_lifetime_mode: AnonymousLifetimeMode::PassThrough, type_def_lifetime_params: Default::default(), + current_module: CRATE_NODE_ID, current_hir_id_owner: vec![(CRATE_DEF_INDEX, 0)], item_local_id_counters: Default::default(), node_id_to_hir_id: IndexVec::new(), @@ -359,8 +355,8 @@ impl<'a> LoweringContext<'a> { fn lower_crate(mut self, c: &Crate) -> hir::Crate { /// Full-crate AST visitor that inserts into a fresh /// `LoweringContext` any information that may be - /// needed from arbitrary locations in the crate. - /// E.g. The number of lifetime generic parameters + /// needed from arbitrary locations in the crate, + /// e.g., the number of lifetime generic parameters /// declared for every type and trait definition. struct MiscCollector<'lcx, 'interner: 'lcx> { lctx: &'lcx mut LoweringContext<'interner>, @@ -425,11 +421,24 @@ impl<'a> LoweringContext<'a> { } impl<'lcx, 'interner> Visitor<'lcx> for ItemLowerer<'lcx, 'interner> { + fn visit_mod(&mut self, m: &'lcx Mod, _s: Span, _attrs: &[Attribute], n: NodeId) { + self.lctx.modules.insert(n, hir::ModuleItems { + items: BTreeSet::new(), + trait_items: BTreeSet::new(), + impl_items: BTreeSet::new(), + }); + + let old = self.lctx.current_module; + self.lctx.current_module = n; + visit::walk_mod(self, m); + self.lctx.current_module = old; + } + fn visit_item(&mut self, item: &'lcx Item) { let mut item_lowered = true; self.lctx.with_hir_id_owner(item.id, |lctx| { if let Some(hir_item) = lctx.lower_item(item) { - lctx.items.insert(item.id, hir_item); + lctx.insert_item(item.id, hir_item); } else { item_lowered = false; } @@ -462,6 +471,7 @@ impl<'a> LoweringContext<'a> { let id = hir::TraitItemId { node_id: item.id }; let hir_item = lctx.lower_trait_item(item); lctx.trait_items.insert(id, hir_item); + lctx.modules.get_mut(&lctx.current_module).unwrap().trait_items.insert(id); }); visit::walk_trait_item(self, item); @@ -472,6 +482,7 @@ impl<'a> LoweringContext<'a> { let id = hir::ImplItemId { node_id: item.id }; let hir_item = lctx.lower_impl_item(item); lctx.impl_items.insert(id, hir_item); + lctx.modules.get_mut(&lctx.current_module).unwrap().impl_items.insert(id); }); visit::walk_impl_item(self, item); } @@ -503,9 +514,15 @@ impl<'a> LoweringContext<'a> { body_ids, trait_impls: self.trait_impls, trait_auto_impl: self.trait_auto_impl, + modules: self.modules, } } + fn insert_item(&mut self, id: NodeId, item: hir::Item) { + self.items.insert(id, item); + self.modules.get_mut(&self.current_module).unwrap().items.insert(id); + } + fn allocate_hir_id_counter(&mut self, owner: NodeId, debug: &T) -> LoweredNodeId { if self.item_local_id_counters.insert(owner, 0).is_some() { bug!( @@ -513,7 +530,7 @@ impl<'a> LoweringContext<'a> { debug ); } - // Always allocate the first HirId for the owner itself + // Always allocate the first `HirId` for the owner itself. self.lower_node_id_with_owner(owner, owner) } @@ -537,7 +554,7 @@ impl<'a> LoweringContext<'a> { let existing_hir_id = self.node_id_to_hir_id[ast_node_id]; if existing_hir_id == hir::DUMMY_HIR_ID { - // Generate a new HirId + // Generate a new `HirId`. let hir_id = alloc_hir_id(self); self.node_id_to_hir_id[ast_node_id] = hir_id; LoweredNodeId { @@ -574,12 +591,12 @@ impl<'a> LoweringContext<'a> { ret } - /// This method allocates a new HirId for the given NodeId and stores it in - /// the LoweringContext's NodeId => HirId map. - /// Take care not to call this method if the resulting HirId is then not + /// This method allocates a new `HirId` for the given `NodeId` and stores it in + /// the `LoweringContext`'s `NodeId => HirId` map. + /// Take care not to call this method if the resulting `HirId` is then not /// actually used in the HIR, as that would trigger an assertion in the - /// HirIdValidator later on, which makes sure that all NodeIds got mapped - /// properly. Calling the method twice with the same NodeId is fine though. + /// `HirIdValidator` later on, which makes sure that all `NodeId`s got mapped + /// properly. Calling the method twice with the same `NodeId` is fine though. fn lower_node_id(&mut self, ast_node_id: NodeId) -> LoweredNodeId { self.lower_node_id_generic(ast_node_id, |this| { let &mut (def_index, ref mut local_id_counter) = @@ -744,7 +761,7 @@ impl<'a> LoweringContext<'a> { ), }; - // Add a definition for the in-band lifetime def + // Add a definition for the in-band lifetime def. self.resolver.definitions().create_def_with_parent( parent_id.index, def_node_id, @@ -1068,7 +1085,7 @@ impl<'a> LoweringContext<'a> { fn lower_attr(&mut self, attr: &Attribute) -> Attribute { // Note that we explicitly do not walk the path. Since we don't really // lower attributes (we use the AST version) there is nowhere to keep - // the HirIds. We don't actually need HIR version of attributes anyway. + // the `HirId`s. We don't actually need HIR version of attributes anyway. Attribute { id: attr.id, style: attr.style, @@ -1089,12 +1106,10 @@ impl<'a> LoweringContext<'a> { fn lower_token_tree(&mut self, tree: TokenTree) -> TokenStream { match tree { TokenTree::Token(span, token) => self.lower_token(token, span), - TokenTree::Delimited(span, delimited) => TokenTree::Delimited( + TokenTree::Delimited(span, delim, tts) => TokenTree::Delimited( span, - Delimited { - delim: delimited.delim, - tts: self.lower_token_stream(delimited.tts.into()).into(), - }, + delim, + self.lower_token_stream(tts.into()).into(), ).into(), } } @@ -1202,7 +1217,7 @@ impl<'a> LoweringContext<'a> { None, P(hir::Path { def: self.expect_full_def(t.id), - segments: hir_vec![hir::PathSegment::from_ident(keywords::SelfType.ident())], + segments: hir_vec![hir::PathSegment::from_ident(keywords::SelfUpper.ident())], span: t.span, }), )), @@ -1247,7 +1262,7 @@ impl<'a> LoweringContext<'a> { } ImplTraitContext::Universal(in_band_ty_params) => { self.lower_node_id(def_node_id); - // Add a definition for the in-band Param + // Add a definition for the in-band `Param`. let def_index = self .resolver .definitions() @@ -1258,7 +1273,7 @@ impl<'a> LoweringContext<'a> { bounds, ImplTraitContext::Universal(in_band_ty_params), ); - // Set the name to `impl Bound1 + Bound2` + // Set the name to `impl Bound1 + Bound2`. let ident = Ident::from_str(&pprust::ty_to_string(t)).with_span_pos(span); in_band_ty_params.push(hir::GenericParam { id: def_node_id, @@ -1366,14 +1381,14 @@ impl<'a> LoweringContext<'a> { impl_trait_fn: fn_def_id, }); let exist_ty_id = lctx.lower_node_id(exist_ty_node_id); - // Generate an `existential type Foo: Trait;` declaration + // Generate an `existential type Foo: Trait;` declaration. trace!("creating existential type with id {:#?}", exist_ty_id); trace!("exist ty def index: {:#?}", exist_ty_def_index); let exist_ty_item = hir::Item { id: exist_ty_id.node_id, hir_id: exist_ty_id.hir_id, - name: keywords::Invalid.name(), + ident: keywords::Invalid.ident(), attrs: Default::default(), node: exist_ty_item_kind, vis: respan(span.shrink_to_lo(), hir::VisibilityKind::Inherited), @@ -1383,9 +1398,9 @@ impl<'a> LoweringContext<'a> { // Insert the item into the global list. This usually happens // automatically for all AST items. But this existential type item // does not actually exist in the AST. - lctx.items.insert(exist_ty_id.node_id, exist_ty_item); + lctx.insert_item(exist_ty_id.node_id, exist_ty_item); - // `impl Trait` now just becomes `Foo<'a, 'b, ..>` + // `impl Trait` now just becomes `Foo<'a, 'b, ..>`. hir::TyKind::Def(hir::ItemId { id: exist_ty_id.node_id }, lifetimes) }) } @@ -1398,7 +1413,7 @@ impl<'a> LoweringContext<'a> { ) -> (HirVec, HirVec) { // This visitor walks over impl trait bounds and creates defs for all lifetimes which // appear in the bounds, excluding lifetimes that are created within the bounds. - // e.g. 'a, 'b, but not 'c in `impl for<'c> SomeTrait<'a, 'b, 'c>` + // E.g., `'a`, `'b`, but not `'c` in `impl for<'c> SomeTrait<'a, 'b, 'c>`. struct ImplTraitLifetimeCollector<'r, 'a: 'r> { context: &'r mut LoweringContext<'a>, parent: DefIndex, @@ -1430,7 +1445,7 @@ impl<'a> LoweringContext<'a> { } fn visit_ty(&mut self, t: &'v hir::Ty) { - // Don't collect elided lifetimes used inside of `fn()` syntax + // Don't collect elided lifetimes used inside of `fn()` syntax. if let hir::TyKind::BareFn(_) = t.node { let old_collect_elided_lifetimes = self.collect_elided_lifetimes; self.collect_elided_lifetimes = false; @@ -1460,10 +1475,10 @@ impl<'a> LoweringContext<'a> { } fn visit_generic_param(&mut self, param: &'v hir::GenericParam) { - // Record the introduction of 'a in `for<'a> ...` + // Record the introduction of 'a in `for<'a> ...`. if let hir::GenericParamKind::Lifetime { .. } = param.kind { // Introduce lifetimes one at a time so that we can handle - // cases like `fn foo<'d>() -> impl for<'a, 'b: 'a, 'c: 'b + 'd>` + // cases like `fn foo<'d>() -> impl for<'a, 'b: 'a, 'c: 'b + 'd>`. let lt_name = hir::LifetimeName::Param(param.name); self.currently_bound_lifetimes.push(lt_name); } @@ -1476,7 +1491,7 @@ impl<'a> LoweringContext<'a> { hir::LifetimeName::Implicit | hir::LifetimeName::Underscore => { if self.collect_elided_lifetimes { // Use `'_` for both implicit and underscore lifetimes in - // `abstract type Foo<'_>: SomeTrait<'_>;` + // `abstract type Foo<'_>: SomeTrait<'_>;`. hir::LifetimeName::Underscore } else { return; @@ -1576,7 +1591,7 @@ impl<'a> LoweringContext<'a> { fn lower_variant(&mut self, v: &Variant) -> hir::Variant { Spanned { node: hir::VariantKind { - name: v.node.ident.name, + ident: v.node.ident, attrs: self.lower_attrs(&v.node.attrs), data: self.lower_variant_data(&v.node.data), disr_expr: v.node.disr_expr.as_ref().map(|e| self.lower_anon_const(e)), @@ -1649,7 +1664,7 @@ impl<'a> LoweringContext<'a> { { ParenthesizedGenericArgs::Ok } - // Avoid duplicated errors + // Avoid duplicated errors. Def::Err => ParenthesizedGenericArgs::Ok, // An error Def::Struct(..) @@ -1690,7 +1705,7 @@ impl<'a> LoweringContext<'a> { }); // Simple case, either no projections, or only fully-qualified. - // E.g. `std::mem::size_of` or `::Item`. + // E.g., `std::mem::size_of` or `::Item`. if resolution.unresolved_segments() == 0 { return hir::QPath::Resolved(qself, path); } @@ -1698,11 +1713,11 @@ impl<'a> LoweringContext<'a> { // Create the innermost type that we're projecting from. let mut ty = if path.segments.is_empty() { // If the base path is empty that means there exists a - // syntactical `Self`, e.g. `&i32` in `<&i32>::clone`. + // syntactical `Self`, e.g., `&i32` in `<&i32>::clone`. qself.expect("missing QSelf for ::...") } else { // Otherwise, the base path is an implicit `Self` type path, - // e.g. `Vec` in `Vec::new` or `::Item` in + // e.g., `Vec` in `Vec::new` or `::Item` in // `::Item::default`. let new_id = self.next_id(); P(self.ty_path(new_id, p.span, hir::QPath::Resolved(qself, path))) @@ -1710,7 +1725,7 @@ impl<'a> LoweringContext<'a> { // Anything after the base path are associated "extensions", // out of which all but the last one are associated types, - // e.g. for `std::vec::Vec::::IntoIter::Item::clone`: + // e.g., for `std::vec::Vec::::IntoIter::Item::clone`: // * base path is `std::vec::Vec` // * "extensions" are `IntoIter`, `Item` and `clone` // * type nodes are: @@ -1740,7 +1755,7 @@ impl<'a> LoweringContext<'a> { ty = P(self.ty_path(new_id, p.span, qpath)); } - // Should've returned in the for loop above. + // We should've returned in the for loop above. span_bug!( p.span, "lower_qpath: no final extension segment in {}..{}", @@ -1792,7 +1807,7 @@ impl<'a> LoweringContext<'a> { explicit_owner: Option, ) -> hir::PathSegment { let (mut generic_args, infer_types) = if let Some(ref generic_args) = segment.args { - let msg = "parenthesized parameters may only be used with a trait"; + let msg = "parenthesized type parameters may only be used with a `Fn` trait"; match **generic_args { GenericArgs::AngleBracketed(ref data) => { self.lower_angle_bracketed_parameter_data(data, param_mode, itctx) @@ -1809,10 +1824,25 @@ impl<'a> LoweringContext<'a> { (hir::GenericArgs::none(), true) } ParenthesizedGenericArgs::Err => { - struct_span_err!(self.sess, data.span, E0214, "{}", msg) - .span_label(data.span, "only traits may use parentheses") - .emit(); - (hir::GenericArgs::none(), true) + let mut err = struct_span_err!(self.sess, data.span, E0214, "{}", msg); + err.span_label(data.span, "only `Fn` traits may use parentheses"); + if let Ok(snippet) = self.sess.source_map().span_to_snippet(data.span) { + // Do not suggest going from `Trait()` to `Trait<>` + if data.inputs.len() > 0 { + err.span_suggestion( + data.span, + "use angle brackets instead", + format!("<{}>", &snippet[1..snippet.len() - 1]), + Applicability::MaybeIncorrect, + ); + } + }; + err.emit(); + (self.lower_angle_bracketed_parameter_data( + &data.as_angle_bracketed_args(), + param_mode, + itctx).0, + false) } }, } @@ -1839,11 +1869,11 @@ impl<'a> LoweringContext<'a> { let no_bindings = generic_args.bindings.is_empty(); let (incl_angl_brckt, insertion_span, suggestion) = if no_ty_args && no_bindings { // If there are no (non-implicit) generic args or associated-type - // bindings, our suggestion includes the angle brackets + // bindings, our suggestion includes the angle brackets. (true, path_span.shrink_to_hi(), format!("<{}>", anon_lt_suggestion)) } else { // Otherwise—sorry, this is kind of gross—we need to infer the - // place to splice in the `'_, ` from the generics that do exist + // place to splice in the `'_, ` from the generics that do exist. let first_generic_span = first_generic_span .expect("already checked that type args or bindings exist"); (false, first_generic_span.shrink_to_lo(), format!("{}, ", anon_lt_suggestion)) @@ -1866,6 +1896,10 @@ impl<'a> LoweringContext<'a> { } else { self.lower_node_id(segment.id) }; + debug!( + "lower_path_segment: ident={:?} original-id={:?} new-id={:?}", + segment.ident, segment.id, id, + ); hir::PathSegment::new( segment.ident, @@ -1897,7 +1931,7 @@ impl<'a> LoweringContext<'a> { fn lower_parenthesized_parameter_data( &mut self, - data: &ParenthesisedArgs, + data: &ParenthesizedArgs, ) -> (hir::GenericArgs, bool) { // Switch to `PassThrough` mode for anonymous lifetimes: this // means that we permit things like `&Ref`, where `Ref` has @@ -1907,7 +1941,7 @@ impl<'a> LoweringContext<'a> { self.with_anonymous_lifetime_mode( AnonymousLifetimeMode::PassThrough, |this| { - let &ParenthesisedArgs { ref inputs, ref output, span } = data; + let &ParenthesizedArgs { ref inputs, ref output, span } = data; let inputs = inputs .iter() .map(|ty| this.lower_ty_direct(ty, ImplTraitContext::disallowed())) @@ -1939,7 +1973,7 @@ impl<'a> LoweringContext<'a> { ) } - fn lower_local(&mut self, l: &Local) -> (P, SmallVec<[hir::ItemId; 1]>) { + fn lower_local(&mut self, l: &Local) -> (hir::Local, SmallVec<[hir::ItemId; 1]>) { let LoweredNodeId { node_id, hir_id } = self.lower_node_id(l.id); let mut ids = SmallVec::<[hir::ItemId; 1]>::new(); if self.sess.features_untracked().impl_trait_in_bindings { @@ -1949,7 +1983,7 @@ impl<'a> LoweringContext<'a> { } } let parent_def_id = DefId::local(self.current_hir_id_owner.last().unwrap().0); - (P(hir::Local { + (hir::Local { id: node_id, hir_id, ty: l.ty @@ -1966,7 +2000,7 @@ impl<'a> LoweringContext<'a> { span: l.span, attrs: l.attrs.clone(), source: hir::LocalSource::Normal, - }), ids) + }, ids) } fn lower_mutability(&mut self, m: Mutability) -> hir::Mutability { @@ -2093,14 +2127,15 @@ impl<'a> LoweringContext<'a> { return_impl_trait_id: NodeId, ) -> hir::FunctionRetTy { // Get lifetimes used in the input arguments to the function. Our output type must also - // have the same lifetime. FIXME(cramertj) multiple different lifetimes are not allowed - // because `impl Trait + 'a + 'b` doesn't allow for capture `'a` and `'b` where neither - // is a subset of the other. We really want some new lifetime that is a subset of all input - // lifetimes, but that doesn't exist at the moment. + // have the same lifetime. + // FIXME(cramertj): multiple different lifetimes are not allowed because + // `impl Trait + 'a + 'b` doesn't allow for capture `'a` and `'b` where neither is a subset + // of the other. We really want some new lifetime that is a subset of all input lifetimes, + // but that doesn't exist at the moment. struct AsyncFnLifetimeCollector<'r, 'a: 'r> { context: &'r mut LoweringContext<'a>, - // Lifetimes bound by HRTB + // Lifetimes bound by HRTB. currently_bound_lifetimes: Vec, // Whether to count elided lifetimes. // Disabled inside of `Fn` or `fn` syntax. @@ -2130,7 +2165,7 @@ impl<'a> LoweringContext<'a> { } fn visit_ty(&mut self, t: &'v hir::Ty) { - // Don't collect elided lifetimes used inside of `fn()` syntax + // Don't collect elided lifetimes used inside of `fn()` syntax. if let &hir::TyKind::BareFn(_) = &t.node { let old_collect_elided_lifetimes = self.collect_elided_lifetimes; self.collect_elided_lifetimes = false; @@ -2421,8 +2456,8 @@ impl<'a> LoweringContext<'a> { GenericParamKind::Type { ref default, .. } => { // Don't expose `Self` (recovered "keyword used as ident" parse error). // `rustc::ty` expects `Self` to be only used for a trait's `Self`. - // Instead, use gensym("Self") to create a distinct name that looks the same. - let ident = if param.ident.name == keywords::SelfType.name() { + // Instead, use `gensym("Self")` to create a distinct name that looks the same. + let ident = if param.ident.name == keywords::SelfUpper.name() { param.ident.gensym() } else { param.ident @@ -2464,7 +2499,7 @@ impl<'a> LoweringContext<'a> { -> hir::Generics { // Collect `?Trait` bounds in where clause and move them to parameter definitions. - // FIXME: This could probably be done with less rightward drift. Also looks like two control + // FIXME: this could probably be done with less rightward drift. Also looks like two control // paths where report_error is called are also the only paths that advance to after // the match statement, so the error reporting could probably just be moved there. let mut add_bounds: NodeMap> = Default::default(); @@ -2560,7 +2595,7 @@ impl<'a> LoweringContext<'a> { .iter() .filter_map(|bound| match *bound { // Ignore `?Trait` bounds. - // Tthey were copied into type parameters already. + // They were copied into type parameters already. GenericBound::Trait(_, TraitBoundModifier::Maybe) => None, _ => Some(this.lower_param_bound( bound, @@ -2659,7 +2694,7 @@ impl<'a> LoweringContext<'a> { id: self.lower_node_id(f.id).node_id, ident: match f.ident { Some(ident) => ident, - // FIXME(jseyfried) positional field hygiene + // FIXME(jseyfried): positional field hygiene None => Ident::new(Symbol::intern(&index.to_string()), f.span), }, vis: self.lower_visibility(&f.vis, None), @@ -2717,7 +2752,6 @@ impl<'a> LoweringContext<'a> { rules: self.lower_block_check_mode(&b.rules), span: b.span, targeted_by_break, - recovered: b.recovered, }) } @@ -2746,7 +2780,7 @@ impl<'a> LoweringContext<'a> { fn lower_item_kind( &mut self, id: NodeId, - name: &mut Name, + ident: &mut Ident, attrs: &hir::HirVec, vis: &mut hir::Visibility, i: &ItemKind, @@ -2760,7 +2794,7 @@ impl<'a> LoweringContext<'a> { span: use_tree.span, }; - self.lower_use_tree(use_tree, &prefix, id, vis, name, attrs) + self.lower_use_tree(use_tree, &prefix, id, vis, ident, attrs) } ItemKind::Static(ref t, m, ref e) => { let value = self.lower_body(None, |this| this.lower_expr(e)); @@ -2943,7 +2977,7 @@ impl<'a> LoweringContext<'a> { } // [1] `defaultness.has_value()` is never called for an `impl`, always `true` in order to - // not cause an assertion failure inside the `lower_defaultness` function + // not cause an assertion failure inside the `lower_defaultness` function. } fn lower_use_tree( @@ -2952,9 +2986,12 @@ impl<'a> LoweringContext<'a> { prefix: &Path, id: NodeId, vis: &mut hir::Visibility, - name: &mut Name, + ident: &mut Ident, attrs: &hir::HirVec, ) -> hir::ItemKind { + debug!("lower_use_tree(tree={:?})", tree); + debug!("lower_use_tree: vis = {:?}", vis); + let path = &tree.prefix; let segments = prefix .segments @@ -2965,28 +3002,28 @@ impl<'a> LoweringContext<'a> { match tree.kind { UseTreeKind::Simple(rename, id1, id2) => { - *name = tree.ident().name; + *ident = tree.ident(); - // First apply the prefix to the path + // First, apply the prefix to the path. let mut path = Path { segments, span: path.span, }; - // Correctly resolve `self` imports + // Correctly resolve `self` imports. if path.segments.len() > 1 - && path.segments.last().unwrap().ident.name == keywords::SelfValue.name() + && path.segments.last().unwrap().ident.name == keywords::SelfLower.name() { let _ = path.segments.pop(); if rename.is_none() { - *name = path.segments.last().unwrap().ident.name; + *ident = path.segments.last().unwrap().ident; } } let parent_def_index = self.current_hir_id_owner.last().unwrap().0; let mut defs = self.expect_full_def_from_use(id); - // we want to return *something* from this function, so hang onto the first item - // for later + // We want to return *something* from this function, so hold onto the first item + // for later. let ret_def = defs.next().unwrap_or(Def::Err); // Here, we are looping over namespaces, if they exist for the definition @@ -2996,7 +3033,7 @@ impl<'a> LoweringContext<'a> { // two imports. for (def, &new_node_id) in defs.zip([id1, id2].iter()) { let vis = vis.clone(); - let name = name.clone(); + let ident = ident.clone(); let mut path = path.clone(); for seg in &mut path.segments { seg.id = self.sess.next_node_id(); @@ -3022,12 +3059,7 @@ impl<'a> LoweringContext<'a> { hir::VisibilityKind::Inherited => hir::VisibilityKind::Inherited, hir::VisibilityKind::Restricted { ref path, id: _, hir_id: _ } => { let id = this.next_id(); - let mut path = path.clone(); - for seg in path.segments.iter_mut() { - if seg.id.is_some() { - seg.id = Some(this.next_id().node_id); - } - } + let path = this.renumber_segment_ids(path); hir::VisibilityKind::Restricted { path, id: id.node_id, @@ -3037,12 +3069,12 @@ impl<'a> LoweringContext<'a> { }; let vis = respan(vis.span, vis_kind); - this.items.insert( + this.insert_item( new_id.node_id, hir::Item { id: new_id.node_id, hir_id: new_id.hir_id, - name: name, + ident, attrs: attrs.clone(), node: item, vis, @@ -3069,13 +3101,35 @@ impl<'a> LoweringContext<'a> { } UseTreeKind::Nested(ref trees) => { // Nested imports are desugared into simple imports. + // So, if we start with + // + // ``` + // pub(x) use foo::{a, b}; + // ``` + // + // we will create three items: + // + // ``` + // pub(x) use foo::a; + // pub(x) use foo::b; + // pub(x) use foo::{}; // <-- this is called the `ListStem` + // ``` + // + // The first two are produced by recursively invoking + // `lower_use_tree` (and indeed there may be things + // like `use foo::{a::{b, c}}` and so forth). They + // wind up being directly added to + // `self.items`. However, the structure of this + // function also requires us to return one item, and + // for that we return the `{}` import (called the + // `ListStem`). let prefix = Path { segments, span: prefix.span.to(path.span), }; - // Add all the nested PathListItems to the HIR. + // Add all the nested `PathListItem`s to the HIR. for &(ref use_tree, id) in trees { self.allocate_hir_id_counter(id, &use_tree); @@ -3085,10 +3139,10 @@ impl<'a> LoweringContext<'a> { } = self.lower_node_id(id); let mut vis = vis.clone(); - let mut name = name.clone(); + let mut ident = ident.clone(); let mut prefix = prefix.clone(); - // Give the segments new ids since they are being cloned. + // Give the segments new node-ids since they are being cloned. for seg in &mut prefix.segments { seg.id = self.sess.next_node_id(); } @@ -3103,7 +3157,7 @@ impl<'a> LoweringContext<'a> { &prefix, new_id, &mut vis, - &mut name, + &mut ident, attrs); let vis_kind = match vis.node { @@ -3112,8 +3166,9 @@ impl<'a> LoweringContext<'a> { hir::VisibilityKind::Inherited => hir::VisibilityKind::Inherited, hir::VisibilityKind::Restricted { ref path, id: _, hir_id: _ } => { let id = this.next_id(); + let path = this.renumber_segment_ids(path); hir::VisibilityKind::Restricted { - path: path.clone(), + path: path, id: id.node_id, hir_id: id.hir_id, } @@ -3121,12 +3176,12 @@ impl<'a> LoweringContext<'a> { }; let vis = respan(vis.span, vis_kind); - this.items.insert( + this.insert_item( new_id, hir::Item { id: new_id, hir_id: new_hir_id, - name, + ident, attrs: attrs.clone(), node: item, vis, @@ -3136,17 +3191,48 @@ impl<'a> LoweringContext<'a> { }); } - // Privatize the degenerate import base, used only to check - // the stability of `use a::{};`, to avoid it showing up as - // a re-export by accident when `pub`, e.g. in documentation. + // Subtle and a bit hacky: we lower the privacy level + // of the list stem to "private" most of the time, but + // not for "restricted" paths. The key thing is that + // we don't want it to stay as `pub` (with no caveats) + // because that affects rustdoc and also the lints + // about `pub` items. But we can't *always* make it + // private -- particularly not for restricted paths -- + // because it contains node-ids that would then be + // unused, failing the check that HirIds are "densely + // assigned". + match vis.node { + hir::VisibilityKind::Public | + hir::VisibilityKind::Crate(_) | + hir::VisibilityKind::Inherited => { + *vis = respan(prefix.span.shrink_to_lo(), hir::VisibilityKind::Inherited); + } + hir::VisibilityKind::Restricted { .. } => { + // Do nothing here, as described in the comment on the match. + } + } + let def = self.expect_full_def_from_use(id).next().unwrap_or(Def::Err); let path = P(self.lower_path_extra(def, &prefix, ParamMode::Explicit, None)); - *vis = respan(prefix.span.shrink_to_lo(), hir::VisibilityKind::Inherited); hir::ItemKind::Use(path, hir::UseKind::ListStem) } } } + /// Paths like the visibility path in `pub(super) use foo::{bar, baz}` are repeated + /// many times in the HIR tree; for each occurrence, we need to assign distinct + /// node-ids. (See e.g., #56128.) + fn renumber_segment_ids(&mut self, path: &P) -> P { + debug!("renumber_segment_ids(path = {:?})", path); + let mut path = path.clone(); + for seg in path.segments.iter_mut() { + if seg.id.is_some() { + seg.id = Some(self.next_id().node_id); + } + } + path + } + fn lower_trait_item(&mut self, i: &TraitItem) -> hir::TraitItem { let LoweredNodeId { node_id, hir_id } = self.lower_node_id(i.id); let trait_item_def_id = self.resolver.definitions().local_def_id(node_id); @@ -3370,7 +3456,7 @@ impl<'a> LoweringContext<'a> { } pub fn lower_item(&mut self, i: &Item) -> Option { - let mut name = i.ident.name; + let mut ident = i.ident; let mut vis = self.lower_visibility(&i.vis, None); let attrs = self.lower_attrs(&i.attrs); if let ItemKind::MacroDef(ref def) = i.node { @@ -3378,7 +3464,7 @@ impl<'a> LoweringContext<'a> { attr::contains_name(&i.attrs, "rustc_doc_only_macro") { let body = self.lower_token_stream(def.stream()); self.exported_macros.push(hir::MacroDef { - name, + name: ident.name, vis, attrs, id: i.id, @@ -3390,14 +3476,14 @@ impl<'a> LoweringContext<'a> { return None; } - let node = self.lower_item_kind(i.id, &mut name, &attrs, &mut vis, &i.node); + let node = self.lower_item_kind(i.id, &mut ident, &attrs, &mut vis, &i.node); let LoweredNodeId { node_id, hir_id } = self.lower_node_id(i.id); Some(hir::Item { id: node_id, hir_id, - name, + ident, attrs, node, vis, @@ -3410,7 +3496,7 @@ impl<'a> LoweringContext<'a> { let def_id = self.resolver.definitions().local_def_id(node_id); hir::ForeignItem { id: node_id, - name: i.ident.name, + ident: i.ident, attrs: self.lower_attrs(&i.attrs), node: match i.node { ForeignItemKind::Fn(ref fdec, ref generics) => { @@ -3572,7 +3658,6 @@ impl<'a> LoweringContext<'a> { ParamMode::Optional, ImplTraitContext::disallowed(), ); - self.check_self_struct_ctor_feature(&qpath); hir::PatKind::TupleStruct( qpath, pats.iter().map(|x| self.lower_pat(x)).collect(), @@ -3587,7 +3672,6 @@ impl<'a> LoweringContext<'a> { ParamMode::Optional, ImplTraitContext::disallowed(), ); - self.check_self_struct_ctor_feature(&qpath); hir::PatKind::Path(qpath) } PatKind::Struct(ref path, ref fields, etc) => { @@ -3707,7 +3791,7 @@ impl<'a> LoweringContext<'a> { let ohs = P(self.lower_expr(ohs)); hir::ExprKind::Unary(op, ohs) } - ExprKind::Lit(ref l) => hir::ExprKind::Lit(P((*l).clone())), + ExprKind::Lit(ref l) => hir::ExprKind::Lit((*l).clone()), ExprKind::Cast(ref expr, ref ty) => { let expr = P(self.lower_expr(expr)); hir::ExprKind::Cast(expr, self.lower_ty(ty, ImplTraitContext::disallowed())) @@ -3727,7 +3811,7 @@ impl<'a> LoweringContext<'a> { let else_opt = else_opt.as_ref().map(|els| { match els.node { ExprKind::IfLet(..) => { - // wrap the if-let expr in a block + // Wrap the `if let` expr in a block. let span = els.span; let els = P(self.lower_expr(els)); let LoweredNodeId { node_id, hir_id } = self.next_id(); @@ -3739,7 +3823,6 @@ impl<'a> LoweringContext<'a> { rules: hir::DefaultBlock, span, targeted_by_break: false, - recovered: blk.recovered, }); P(self.expr_block(blk, ThinVec::new())) } @@ -3818,7 +3901,7 @@ impl<'a> LoweringContext<'a> { let fn_decl = self.lower_fn_decl(&outer_decl, None, false, None); self.with_new_scopes(|this| { - // FIXME(cramertj) allow `async` non-`move` closures with + // FIXME(cramertj): allow `async` non-`move` closures with arguments. if capture_clause == CaptureBy::Ref && !decl.inputs.is_empty() { @@ -3830,13 +3913,13 @@ impl<'a> LoweringContext<'a> { are not currently supported", ) .help("consider using `let` statements to manually capture \ - variables by reference before entering an \ - `async move` closure") + variables by reference before entering an \ + `async move` closure") .emit(); } // Transform `async |x: u8| -> X { ... }` into - // `|x: u8| future_from_generator(|| -> X { ... })` + // `|x: u8| future_from_generator(|| -> X { ... })`. let body_id = this.lower_body(Some(&outer_decl), |this| { let async_ret_ty = if let FunctionRetTy::Ty(ty) = &decl.output { Some(&**ty) @@ -3919,7 +4002,7 @@ impl<'a> LoweringContext<'a> { ExprKind::Index(ref el, ref er) => { hir::ExprKind::Index(P(self.lower_expr(el)), P(self.lower_expr(er))) } - // Desugar `..=` to `std::ops::RangeInclusive::new(, )` + // Desugar `..=` into `std::ops::RangeInclusive::new(, )`. ExprKind::Range(Some(ref e1), Some(ref e2), RangeLimits::Closed) => { let id = self.next_id(); let e1 = self.lower_expr(e1); @@ -3983,7 +4066,6 @@ impl<'a> LoweringContext<'a> { ParamMode::Optional, ImplTraitContext::disallowed(), ); - self.check_self_struct_ctor_feature(&qpath); hir::ExprKind::Path(qpath) } ExprKind::Break(opt_label, ref opt_expr) => { @@ -4054,11 +4136,11 @@ impl<'a> LoweringContext<'a> { ), ExprKind::Paren(ref ex) => { let mut ex = self.lower_expr(ex); - // include parens in span, but only if it is a super-span. + // Include parens in span, but only if it is a super-span. if e.span.contains(ex.span) { ex.span = e.span; } - // merge attributes into the inner expression. + // Merge attributes into the inner expression. let mut attrs = e.attrs.clone(); attrs.extend::>(ex.attrs.into()); ex.attrs = attrs; @@ -4076,8 +4158,10 @@ impl<'a> LoweringContext<'a> { hir::ExprKind::Yield(P(expr)) } - // Desugar ExprIfLet - // From: `if let = []` + ExprKind::Err => hir::ExprKind::Err, + + // Desugar `ExprIfLet` + // from: `if let = []` ExprKind::IfLet(ref pats, ref sub_expr, ref body, ref else_opt) => { // to: // @@ -4121,8 +4205,8 @@ impl<'a> LoweringContext<'a> { ) } - // Desugar ExprWhileLet - // From: `[opt_ident]: while let = ` + // Desugar `ExprWhileLet` + // from: `[opt_ident]: while let = ` ExprKind::WhileLet(ref pats, ref sub_expr, ref body, opt_label) => { // to: // @@ -4171,12 +4255,12 @@ impl<'a> LoweringContext<'a> { self.lower_label(opt_label), hir::LoopSource::WhileLet, ); - // add attributes to the outer returned expr node + // Add attributes to the outer returned expr node. loop_expr } - // Desugar ExprForLoop - // From: `[opt_ident]: for in ` + // Desugar `ExprForLoop` + // from: `[opt_ident]: for in ` ExprKind::ForLoop(ref pat, ref head, ref body, opt_label) => { // to: // @@ -4263,10 +4347,11 @@ impl<'a> LoweringContext<'a> { ThinVec::new(), )) }; - let match_stmt = respan( - head_sp, - hir::StmtKind::Expr(match_expr, self.next_id().node_id) - ); + let match_stmt = hir::Stmt { + id: self.next_id().node_id, + node: hir::StmtKind::Expr(match_expr), + span: head_sp, + }; let next_expr = P(self.expr_ident(head_sp, next_ident, next_pat.id)); @@ -4289,10 +4374,11 @@ impl<'a> LoweringContext<'a> { let body_block = self.with_loop_scope(e.id, |this| this.lower_block(body, false)); let body_expr = P(self.expr_block(body_block, ThinVec::new())); - let body_stmt = respan( - body.span, - hir::StmtKind::Expr(body_expr, self.next_id().node_id) - ); + let body_stmt = hir::Stmt { + id: self.next_id().node_id, + node: hir::StmtKind::Expr(body_expr), + span: body.span, + }; let loop_block = P(self.block_all( e.span, @@ -4334,21 +4420,21 @@ impl<'a> LoweringContext<'a> { )); // `{ let _result = ...; _result }` - // underscore prevents an unused_variables lint if the head diverges + // Underscore prevents an `unused_variables` lint if the head diverges. let result_ident = self.str_to_ident("_result"); let (let_stmt, let_stmt_binding) = self.stmt_let(e.span, false, result_ident, match_expr); let result = P(self.expr_ident(e.span, result_ident, let_stmt_binding)); let block = P(self.block_all(e.span, hir_vec![let_stmt], Some(result))); - // add the attributes to the outer returned expr node + // Add the attributes to the outer returned expr node. return self.expr_block(block, e.attrs.clone()); } - // Desugar ExprKind::Try - // From: `?` + // Desugar `ExprKind::Try` + // from: `?` ExprKind::Try(ref sub_expr) => { - // to: + // into: // // match Try::into_result() { // Ok(val) => #[allow(unreachable_code)] val, @@ -4362,7 +4448,7 @@ impl<'a> LoweringContext<'a> { let unstable_span = self.allow_internal_unstable(CompilerDesugaringKind::QuestionMark, e.span); - // Try::into_result() + // `Try::into_result()` let discr = { // expand let sub_expr = self.lower_expr(sub_expr); @@ -4373,9 +4459,9 @@ impl<'a> LoweringContext<'a> { P(self.expr_call(e.span, path, hir_vec![sub_expr])) }; - // #[allow(unreachable_code)] + // `#[allow(unreachable_code)]` let attr = { - // allow(unreachable_code) + // `allow(unreachable_code)` let allow = { let allow_ident = Ident::from_str("allow").with_span_pos(e.span); let uc_ident = Ident::from_str("unreachable_code").with_span_pos(e.span); @@ -4386,7 +4472,7 @@ impl<'a> LoweringContext<'a> { }; let attrs = vec![attr]; - // Ok(val) => #[allow(unreachable_code)] val, + // `Ok(val) => #[allow(unreachable_code)] val,` let ok_arm = { let val_ident = self.str_to_ident("val"); let val_pat = self.pat_ident(e.span, val_ident); @@ -4401,8 +4487,8 @@ impl<'a> LoweringContext<'a> { self.arm(hir_vec![ok_pat], val_expr) }; - // Err(err) => #[allow(unreachable_code)] - // return Try::from_error(From::from(err)), + // `Err(err) => #[allow(unreachable_code)] + // return Try::from_error(From::from(err)),` let err_arm = { let err_ident = self.str_to_ident("err"); let err_local = self.pat_ident(e.span, err_ident); @@ -4465,25 +4551,15 @@ impl<'a> LoweringContext<'a> { let (l, item_ids) = self.lower_local(l); let mut ids: SmallVec<[hir::Stmt; 1]> = item_ids .into_iter() - .map(|item_id| Spanned { - node: hir::StmtKind::Decl( - P(Spanned { - node: hir::DeclKind::Item(item_id), - span: s.span, - }), - self.next_id().node_id, - ), + .map(|item_id| hir::Stmt { + id: self.next_id().node_id, + node: hir::StmtKind::Item(P(item_id)), span: s.span, }) .collect(); - ids.push(Spanned { - node: hir::StmtKind::Decl( - P(Spanned { - node: hir::DeclKind::Local(l), - span: s.span, - }), - self.lower_node_id(s.id).node_id, - ), + ids.push(hir::Stmt { + id: self.lower_node_id(s.id).node_id, + node: hir::StmtKind::Local(P(l)), span: s.span, }); return ids; @@ -4493,26 +4569,23 @@ impl<'a> LoweringContext<'a> { let mut id = Some(s.id); return self.lower_item_id(it) .into_iter() - .map(|item_id| Spanned { - node: hir::StmtKind::Decl( - P(Spanned { - node: hir::DeclKind::Item(item_id), - span: s.span, - }), - id.take() + .map(|item_id| hir::Stmt { + id: id.take() .map(|id| self.lower_node_id(id).node_id) .unwrap_or_else(|| self.next_id().node_id), - ), + node: hir::StmtKind::Item(P(item_id)), span: s.span, }) .collect(); } - StmtKind::Expr(ref e) => Spanned { - node: hir::StmtKind::Expr(P(self.lower_expr(e)), self.lower_node_id(s.id).node_id), + StmtKind::Expr(ref e) => hir::Stmt { + id: self.lower_node_id(s.id).node_id, + node: hir::StmtKind::Expr(P(self.lower_expr(e))), span: s.span, }, - StmtKind::Semi(ref e) => Spanned { - node: hir::StmtKind::Semi(P(self.lower_expr(e)), self.lower_node_id(s.id).node_id), + StmtKind::Semi(ref e) => hir::Stmt { + id: self.lower_node_id(s.id).node_id, + node: hir::StmtKind::Semi(P(self.lower_expr(e))), span: s.span, }, StmtKind::Mac(..) => panic!("Shouldn't exist here"), @@ -4540,6 +4613,7 @@ impl<'a> LoweringContext<'a> { VisibilityKind::Public => hir::VisibilityKind::Public, VisibilityKind::Crate(sugar) => hir::VisibilityKind::Crate(sugar), VisibilityKind::Restricted { ref path, id } => { + debug!("lower_visibility: restricted path id = {:?}", id); let lowered_id = if let Some(owner) = explicit_owner { self.lower_node_id_with_owner(id, owner) } else { @@ -4726,7 +4800,7 @@ impl<'a> LoweringContext<'a> { ) -> hir::Stmt { let LoweredNodeId { node_id, hir_id } = self.next_id(); - let local = P(hir::Local { + let local = hir::Local { pat, ty: None, init: ex, @@ -4735,9 +4809,12 @@ impl<'a> LoweringContext<'a> { span: sp, attrs: ThinVec::new(), source, - }); - let decl = respan(sp, hir::DeclKind::Local(local)); - respan(sp, hir::StmtKind::Decl(P(decl), self.next_id().node_id)) + }; + hir::Stmt { + id: self.next_id().node_id, + node: hir::StmtKind::Local(P(local)), + span: sp + } } fn stmt_let( @@ -4779,7 +4856,6 @@ impl<'a> LoweringContext<'a> { rules: hir::DefaultBlock, span, targeted_by_break: false, - recovered: false, } } @@ -4961,7 +5037,7 @@ impl<'a> LoweringContext<'a> { /// error, depending on the mode. fn elided_path_lifetimes(&mut self, span: Span, count: usize) -> P<[hir::Lifetime]> { match self.anonymous_lifetime_mode { - // NB. We intentionally ignore the create-parameter mode here + // N.B., We intentionally ignore the create-parameter mode here // and instead "pass through" to resolve-lifetimes, which will then // report an error. This is because we don't want to support // impl elision for deprecated forms like @@ -5045,18 +5121,6 @@ impl<'a> LoweringContext<'a> { ThinVec::new())); P(self.expr_call(e.span, from_err, hir_vec![e])) } - - fn check_self_struct_ctor_feature(&self, qp: &hir::QPath) { - if let hir::QPath::Resolved(_, ref p) = qp { - if p.segments.len() == 1 && - p.segments[0].ident.name == keywords::SelfType.name() && - !self.sess.features_untracked().self_struct_ctor { - emit_feature_err(&self.sess.parse_sess, "self_struct_ctor", - p.span, GateIssue::Language, - "`Self` struct constructors are unstable"); - } - } - } } fn body_ids(bodies: &BTreeMap) -> Vec { diff --git a/src/librustc/hir/map/blocks.rs b/src/librustc/hir/map/blocks.rs index 1ab1c7d3fc5..f61b8551927 100644 --- a/src/librustc/hir/map/blocks.rs +++ b/src/librustc/hir/map/blocks.rs @@ -1,19 +1,9 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module provides a simplified abstraction for working with //! code blocks identified by their integer node-id. In particular, //! it captures a common set of attributes that all "function-like //! things" (represented by `FnLike` instances) share. For example, //! all `FnLike` instances have a type signature (be it explicit or -//! inferred). And all `FnLike` instances have a body, i.e. the code +//! inferred). And all `FnLike` instances have a body, i.e., the code //! that is run when the function-like thing it represents is invoked. //! //! With the above abstraction in place, one can treat the program @@ -25,7 +15,7 @@ use hir as ast; use hir::map; use hir::{Expr, FnDecl, Node}; use hir::intravisit::FnKind; -use syntax::ast::{Attribute, Ident, Name, NodeId}; +use syntax::ast::{Attribute, Ident, NodeId}; use syntax_pos::Span; /// An FnLikeNode is a Node that is like a fn, in that it has a decl @@ -34,7 +24,7 @@ use syntax_pos::Span; /// More specifically, it is one of either: /// /// - A function item, -/// - A closure expr (i.e. an ExprKind::Closure), or +/// - A closure expr (i.e., an ExprKind::Closure), or /// - The default implementation for a trait method. /// /// To construct one, use the `Code::from_node` function. @@ -108,7 +98,7 @@ impl<'a> Code<'a> { /// These are all the components one can extract from a fn item for /// use when implementing FnLikeNode operations. struct ItemFnParts<'a> { - name: Name, + ident: Ident, decl: &'a ast::FnDecl, header: ast::FnHeader, vis: &'a ast::Visibility, @@ -210,7 +200,7 @@ impl<'a> FnLikeNode<'a> { pub fn kind(self) -> FnKind<'a> { let item = |p: ItemFnParts<'a>| -> FnKind<'a> { - FnKind::ItemFn(p.name, p.generics, p.header, p.vis, p.attrs) + FnKind::ItemFn(p.ident, p.generics, p.header, p.vis, p.attrs) }; let closure = |c: ClosureParts<'a>| { FnKind::Closure(c.attrs) @@ -238,7 +228,7 @@ impl<'a> FnLikeNode<'a> { ast::ItemKind::Fn(ref decl, header, ref generics, block) => item_fn(ItemFnParts { id: i.id, - name: i.name, + ident: i.ident, decl: &decl, body: block, vis: &i.vis, diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 4fbcd83adb5..7cc5d756ff3 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -1,13 +1,3 @@ -// Copyright 2015-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::*; use dep_graph::{DepGraph, DepKind, DepNodeIndex}; use hir::def_id::{LOCAL_CRATE, CrateNum}; @@ -16,6 +6,7 @@ use rustc_data_structures::svh::Svh; use ich::Fingerprint; use middle::cstore::CrateStore; use session::CrateDisambiguator; +use session::Session; use std::iter::repeat; use syntax::ast::{NodeId, CRATE_NODE_ID}; use syntax::source_map::SourceMap; @@ -28,6 +19,10 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHashe pub(super) struct NodeCollector<'a, 'hir> { /// The crate krate: &'hir Crate, + + /// Source map + source_map: &'a SourceMap, + /// The node map map: Vec>>, /// The parent of this node @@ -47,20 +42,69 @@ pub(super) struct NodeCollector<'a, 'hir> { // We are collecting DepNode::HirBody hashes here so we can compute the // crate hash from then later on. - hir_body_nodes: Vec<(DefPathHash, DepNodeIndex)>, + hir_body_nodes: Vec<(DefPathHash, Fingerprint)>, +} + +fn input_dep_node_and_hash<'a, I>( + dep_graph: &DepGraph, + hcx: &mut StableHashingContext<'a>, + dep_node: DepNode, + input: I, +) -> (DepNodeIndex, Fingerprint) +where + I: HashStable>, +{ + let dep_node_index = dep_graph.input_task(dep_node, &mut *hcx, &input).1; + + let hash = if dep_graph.is_fully_enabled() { + dep_graph.fingerprint_of(dep_node_index) + } else { + let mut stable_hasher = StableHasher::new(); + input.hash_stable(hcx, &mut stable_hasher); + stable_hasher.finish() + }; + + (dep_node_index, hash) +} + +fn alloc_hir_dep_nodes<'a, I>( + dep_graph: &DepGraph, + hcx: &mut StableHashingContext<'a>, + def_path_hash: DefPathHash, + item_like: I, + hir_body_nodes: &mut Vec<(DefPathHash, Fingerprint)>, +) -> (DepNodeIndex, DepNodeIndex) +where + I: HashStable>, +{ + let sig = dep_graph.input_task( + def_path_hash.to_dep_node(DepKind::Hir), + &mut *hcx, + HirItemLike { item_like: &item_like, hash_bodies: false }, + ).1; + let (full, hash) = input_dep_node_and_hash( + dep_graph, + hcx, + def_path_hash.to_dep_node(DepKind::HirBody), + HirItemLike { item_like: &item_like, hash_bodies: true }, + ); + hir_body_nodes.push((def_path_hash, hash)); + (sig, full) } impl<'a, 'hir> NodeCollector<'a, 'hir> { - pub(super) fn root(krate: &'hir Crate, + pub(super) fn root(sess: &'a Session, + krate: &'hir Crate, dep_graph: &'a DepGraph, definitions: &'a definitions::Definitions, - hcx: StableHashingContext<'a>) + mut hcx: StableHashingContext<'a>) -> NodeCollector<'a, 'hir> { let root_mod_def_path_hash = definitions.def_path_hash(CRATE_DEF_INDEX); + let mut hir_body_nodes = Vec::new(); + // Allocate DepNodes for the root module - let (root_mod_sig_dep_index, root_mod_full_dep_index); - { + let (root_mod_sig_dep_index, root_mod_full_dep_index) = { let Crate { ref module, // Crate attributes are not copied over to the root `Mod`, so hash @@ -76,33 +120,30 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { trait_impls: _, trait_auto_impl: _, body_ids: _, + modules: _, } = *krate; - root_mod_sig_dep_index = dep_graph.input_task( - root_mod_def_path_hash.to_dep_node(DepKind::Hir), - &hcx, - HirItemLike { item_like: (module, attrs, span), hash_bodies: false }, - ).1; - root_mod_full_dep_index = dep_graph.input_task( - root_mod_def_path_hash.to_dep_node(DepKind::HirBody), - &hcx, - HirItemLike { item_like: (module, attrs, span), hash_bodies: true }, - ).1; - } + alloc_hir_dep_nodes( + dep_graph, + &mut hcx, + root_mod_def_path_hash, + (module, attrs, span), + &mut hir_body_nodes, + ) + }; { dep_graph.input_task( DepNode::new_no_params(DepKind::AllLocalTraitImpls), - &hcx, + &mut hcx, &krate.trait_impls, ); } - let hir_body_nodes = vec![(root_mod_def_path_hash, root_mod_full_dep_index)]; - let mut collector = NodeCollector { krate, - map: vec![], + source_map: sess.source_map(), + map: repeat(None).take(sess.current_node_id_count()).collect(), parent_node: CRATE_NODE_ID, current_signature_dep_index: root_mod_sig_dep_index, current_full_dep_index: root_mod_full_dep_index, @@ -125,7 +166,6 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { pub(super) fn finalize_and_compute_crate_hash(mut self, crate_disambiguator: CrateDisambiguator, cstore: &dyn CrateStore, - source_map: &SourceMap, commandline_args_hash: u64) -> (Vec>>, Svh) { @@ -134,10 +174,8 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { let node_hashes = self .hir_body_nodes .iter() - .fold(Fingerprint::ZERO, |fingerprint, &(def_path_hash, dep_node_index)| { - fingerprint.combine( - def_path_hash.0.combine(self.dep_graph.fingerprint_of(dep_node_index)) - ) + .fold(Fingerprint::ZERO, |combined_fingerprint, &(def_path_hash, fingerprint)| { + combined_fingerprint.combine(def_path_hash.0.combine(fingerprint)) }); let mut upstream_crates: Vec<_> = cstore.crates_untracked().iter().map(|&cnum| { @@ -154,7 +192,8 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { // If we included the full mapping in the SVH, we could only have // reproducible builds by compiling from the same directory. So we just // hash the result of the mapping instead of the mapping itself. - let mut source_file_names: Vec<_> = source_map + let mut source_file_names: Vec<_> = self + .source_map .files() .iter() .filter(|source_file| CrateNum::from_u32(source_file.crate_of_origin) == LOCAL_CRATE) @@ -163,30 +202,28 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { source_file_names.sort_unstable(); - let (_, crate_dep_node_index) = self - .dep_graph - .input_task(DepNode::new_no_params(DepKind::Krate), - &self.hcx, - (((node_hashes, upstream_crates), source_file_names), - (commandline_args_hash, - crate_disambiguator.to_fingerprint()))); - - let svh = Svh::new(self.dep_graph - .fingerprint_of(crate_dep_node_index) - .to_smaller_hash()); + let crate_hash_input = ( + ((node_hashes, upstream_crates), source_file_names), + (commandline_args_hash, crate_disambiguator.to_fingerprint()) + ); + + let (_, crate_hash) = input_dep_node_and_hash( + self.dep_graph, + &mut self.hcx, + DepNode::new_no_params(DepKind::Krate), + crate_hash_input, + ); + + let svh = Svh::new(crate_hash.to_smaller_hash()); (self.map, svh) } fn insert_entry(&mut self, id: NodeId, entry: Entry<'hir>) { debug!("hir_map: {:?} => {:?}", id, entry); - let len = self.map.len(); - if id.as_usize() >= len { - self.map.extend(repeat(None).take(id.as_usize() - len + 1)); - } self.map[id.as_usize()] = Some(entry); } - fn insert(&mut self, id: NodeId, node: Node<'hir>) { + fn insert(&mut self, span: Span, id: NodeId, node: Node<'hir>) { let entry = Entry { parent: self.parent_node, dep_node: if self.currently_in_body { @@ -216,8 +253,11 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { String::new() }; - bug!("inconsistent DepNode for `{}`: \ - current_dep_node_owner={} ({:?}), hir_id.owner={} ({:?}){}", + span_bug!( + span, + "inconsistent DepNode at `{:?}` for `{}`: \ + current_dep_node_owner={} ({:?}), hir_id.owner={} ({:?}){}", + self.source_map.span_to_string(span), node_str, self.definitions .def_path(self.current_dep_node_owner) @@ -225,7 +265,8 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { self.current_dep_node_owner, self.definitions.def_path(hir_id.owner).to_string_no_crate(), hir_id.owner, - forgot_str) + forgot_str, + ) } } @@ -251,19 +292,15 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { let def_path_hash = self.definitions.def_path_hash(dep_node_owner); - self.current_signature_dep_index = self.dep_graph.input_task( - def_path_hash.to_dep_node(DepKind::Hir), - &self.hcx, - HirItemLike { item_like, hash_bodies: false }, - ).1; - - self.current_full_dep_index = self.dep_graph.input_task( - def_path_hash.to_dep_node(DepKind::HirBody), - &self.hcx, - HirItemLike { item_like, hash_bodies: true }, - ).1; - - self.hir_body_nodes.push((def_path_hash, self.current_full_dep_index)); + let (signature_dep_index, full_dep_index) = alloc_hir_dep_nodes( + self.dep_graph, + &mut self.hcx, + def_path_hash, + item_like, + &mut self.hir_body_nodes, + ); + self.current_signature_dep_index = signature_dep_index; + self.current_full_dep_index = full_dep_index; self.current_dep_node_owner = dep_node_owner; self.currently_in_body = false; @@ -309,12 +346,12 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { debug_assert_eq!(i.hir_id.owner, self.definitions.opt_def_index(i.id).unwrap()); self.with_dep_node_owner(i.hir_id.owner, i, |this| { - this.insert(i.id, Node::Item(i)); + this.insert(i.span, i.id, Node::Item(i)); this.with_parent(i.id, |this| { if let ItemKind::Struct(ref struct_def, _) = i.node { // If this is a tuple-like struct, register the constructor. if !struct_def.is_struct() { - this.insert(struct_def.id(), Node::StructCtor(struct_def)); + this.insert(i.span, struct_def.id(), Node::StructCtor(struct_def)); } } intravisit::walk_item(this, i); @@ -323,7 +360,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { } fn visit_foreign_item(&mut self, foreign_item: &'hir ForeignItem) { - self.insert(foreign_item.id, Node::ForeignItem(foreign_item)); + self.insert(foreign_item.span, foreign_item.id, Node::ForeignItem(foreign_item)); self.with_parent(foreign_item.id, |this| { intravisit::walk_foreign_item(this, foreign_item); @@ -331,7 +368,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { } fn visit_generic_param(&mut self, param: &'hir GenericParam) { - self.insert(param.id, Node::GenericParam(param)); + self.insert(param.span, param.id, Node::GenericParam(param)); intravisit::walk_generic_param(self, param); } @@ -339,7 +376,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { debug_assert_eq!(ti.hir_id.owner, self.definitions.opt_def_index(ti.id).unwrap()); self.with_dep_node_owner(ti.hir_id.owner, ti, |this| { - this.insert(ti.id, Node::TraitItem(ti)); + this.insert(ti.span, ti.id, Node::TraitItem(ti)); this.with_parent(ti.id, |this| { intravisit::walk_trait_item(this, ti); @@ -351,7 +388,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { debug_assert_eq!(ii.hir_id.owner, self.definitions.opt_def_index(ii.id).unwrap()); self.with_dep_node_owner(ii.hir_id.owner, ii, |this| { - this.insert(ii.id, Node::ImplItem(ii)); + this.insert(ii.span, ii.id, Node::ImplItem(ii)); this.with_parent(ii.id, |this| { intravisit::walk_impl_item(this, ii); @@ -365,7 +402,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { } else { Node::Pat(pat) }; - self.insert(pat.id, node); + self.insert(pat.span, pat.id, node); self.with_parent(pat.id, |this| { intravisit::walk_pat(this, pat); @@ -373,7 +410,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { } fn visit_anon_const(&mut self, constant: &'hir AnonConst) { - self.insert(constant.id, Node::AnonConst(constant)); + self.insert(DUMMY_SP, constant.id, Node::AnonConst(constant)); self.with_parent(constant.id, |this| { intravisit::walk_anon_const(this, constant); @@ -381,7 +418,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { } fn visit_expr(&mut self, expr: &'hir Expr) { - self.insert(expr.id, Node::Expr(expr)); + self.insert(expr.span, expr.id, Node::Expr(expr)); self.with_parent(expr.id, |this| { intravisit::walk_expr(this, expr); @@ -389,8 +426,8 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { } fn visit_stmt(&mut self, stmt: &'hir Stmt) { - let id = stmt.node.id(); - self.insert(id, Node::Stmt(stmt)); + let id = stmt.id; + self.insert(stmt.span, id, Node::Stmt(stmt)); self.with_parent(id, |this| { intravisit::walk_stmt(this, stmt); @@ -399,13 +436,13 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { fn visit_path_segment(&mut self, path_span: Span, path_segment: &'hir PathSegment) { if let Some(id) = path_segment.id { - self.insert(id, Node::PathSegment(path_segment)); + self.insert(path_span, id, Node::PathSegment(path_segment)); } intravisit::walk_path_segment(self, path_span, path_segment); } fn visit_ty(&mut self, ty: &'hir Ty) { - self.insert(ty.id, Node::Ty(ty)); + self.insert(ty.span, ty.id, Node::Ty(ty)); self.with_parent(ty.id, |this| { intravisit::walk_ty(this, ty); @@ -413,7 +450,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { } fn visit_trait_ref(&mut self, tr: &'hir TraitRef) { - self.insert(tr.ref_id, Node::TraitRef(tr)); + self.insert(tr.path.span, tr.ref_id, Node::TraitRef(tr)); self.with_parent(tr.ref_id, |this| { intravisit::walk_trait_ref(this, tr); @@ -427,21 +464,21 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { } fn visit_block(&mut self, block: &'hir Block) { - self.insert(block.id, Node::Block(block)); + self.insert(block.span, block.id, Node::Block(block)); self.with_parent(block.id, |this| { intravisit::walk_block(this, block); }); } fn visit_local(&mut self, l: &'hir Local) { - self.insert(l.id, Node::Local(l)); + self.insert(l.span, l.id, Node::Local(l)); self.with_parent(l.id, |this| { intravisit::walk_local(this, l) }) } fn visit_lifetime(&mut self, lifetime: &'hir Lifetime) { - self.insert(lifetime.id, Node::Lifetime(lifetime)); + self.insert(lifetime.span, lifetime.id, Node::Lifetime(lifetime)); } fn visit_vis(&mut self, visibility: &'hir Visibility) { @@ -450,7 +487,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { VisibilityKind::Crate(_) | VisibilityKind::Inherited => {} VisibilityKind::Restricted { id, .. } => { - self.insert(id, Node::Visibility(visibility)); + self.insert(visibility.span, id, Node::Visibility(visibility)); self.with_parent(id, |this| { intravisit::walk_vis(this, visibility); }); @@ -462,20 +499,20 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { let def_index = self.definitions.opt_def_index(macro_def.id).unwrap(); self.with_dep_node_owner(def_index, macro_def, |this| { - this.insert(macro_def.id, Node::MacroDef(macro_def)); + this.insert(macro_def.span, macro_def.id, Node::MacroDef(macro_def)); }); } fn visit_variant(&mut self, v: &'hir Variant, g: &'hir Generics, item_id: NodeId) { let id = v.node.data.id(); - self.insert(id, Node::Variant(v)); + self.insert(v.span, id, Node::Variant(v)); self.with_parent(id, |this| { intravisit::walk_variant(this, v, g, item_id); }); } fn visit_struct_field(&mut self, field: &'hir StructField) { - self.insert(field.id, Node::Field(field)); + self.insert(field.span, field.id, Node::Field(field)); self.with_parent(field.id, |this| { intravisit::walk_struct_field(this, field); }); diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc/hir/map/def_collector.rs index 26cf8f5d2ae..c9b4b2bb997 100644 --- a/src/librustc/hir/map/def_collector.rs +++ b/src/librustc/hir/map/def_collector.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::map::definitions::*; use hir::def_id::{CRATE_DEF_INDEX, DefIndex, DefIndexAddressSpace}; use session::CrateDisambiguator; @@ -130,10 +120,10 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { let def_data = match i.node { ItemKind::Impl(..) => DefPathData::Impl, ItemKind::Trait(..) => DefPathData::Trait(i.ident.as_interned_str()), + ItemKind::TraitAlias(..) => DefPathData::TraitAlias(i.ident.as_interned_str()), ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..) | - ItemKind::TraitAlias(..) | ItemKind::Existential(..) | - ItemKind::ExternCrate(..) | ItemKind::ForeignMod(..) | ItemKind::Ty(..) => - DefPathData::TypeNs(i.ident.as_interned_str()), + ItemKind::Existential(..) | ItemKind::ExternCrate(..) | ItemKind::ForeignMod(..) | + ItemKind::Ty(..) => DefPathData::TypeNs(i.ident.as_interned_str()), ItemKind::Mod(..) if i.ident == keywords::Invalid.ident() => { return visit::walk_item(self, i); } diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index eb9bd183fd9..1b744519947 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! For each definition, we track the following data. A definition //! here is defined somewhat circularly as "something with a def-id", //! but it generally corresponds to things like structs, enums, etc. @@ -150,10 +140,9 @@ impl Decodable for DefPathTable { } } - /// The definition table containing node definitions. -/// It holds the DefPathTable for local DefIds/DefPaths and it also stores a -/// mapping from NodeIds to local DefIds. +/// It holds the `DefPathTable` for local `DefId`s/`DefPath`s and it also stores a +/// mapping from `NodeId`s to local `DefId`s. #[derive(Clone, Default)] pub struct Definitions { table: DefPathTable, @@ -384,7 +373,9 @@ pub enum DefPathData { /// GlobalMetaData identifies a piece of crate metadata that is global to /// a whole crate (as opposed to just one item). GlobalMetaData components /// are only supposed to show up right below the crate root. - GlobalMetaData(InternedString) + GlobalMetaData(InternedString), + /// A trait alias. + TraitAlias(InternedString), } #[derive(Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Debug, @@ -626,6 +617,7 @@ impl DefPathData { match *self { TypeNs(name) | Trait(name) | + TraitAlias(name) | AssocTypeInTrait(name) | AssocTypeInImpl(name) | AssocExistentialInImpl(name) | @@ -653,6 +645,7 @@ impl DefPathData { let s = match *self { TypeNs(name) | Trait(name) | + TraitAlias(name) | AssocTypeInTrait(name) | AssocTypeInImpl(name) | AssocExistentialInImpl(name) | diff --git a/src/librustc/hir/map/hir_id_validator.rs b/src/librustc/hir/map/hir_id_validator.rs index ac4119dc372..91c8c291444 100644 --- a/src/librustc/hir/map/hir_id_validator.rs +++ b/src/librustc/hir/map/hir_id_validator.rs @@ -1,31 +1,26 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def_id::{DefId, DefIndex, CRATE_DEF_INDEX}; use hir::{self, intravisit, HirId, ItemLocalId}; use syntax::ast::NodeId; use hir::itemlikevisit::ItemLikeVisitor; use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::sync::{Lock, ParallelIterator, par_iter}; pub fn check_crate<'hir>(hir_map: &hir::map::Map<'hir>) { - let mut outer_visitor = OuterVisitor { - hir_map, - errors: vec![], - }; - hir_map.dep_graph.assert_ignored(); - hir_map.krate().visit_all_item_likes(&mut outer_visitor); - if !outer_visitor.errors.is_empty() { - let message = outer_visitor - .errors + let errors = Lock::new(Vec::new()); + + par_iter(&hir_map.krate().modules).for_each(|(module_id, _)| { + hir_map.visit_item_likes_in_module(hir_map.local_def_id(*module_id), &mut OuterVisitor { + hir_map, + errors: &errors, + }); + }); + + let errors = errors.into_inner(); + + if !errors.is_empty() { + let message = errors .iter() .fold(String::new(), |s1, s2| s1 + "\n" + s2); bug!("{}", message); @@ -36,12 +31,12 @@ struct HirIdValidator<'a, 'hir: 'a> { hir_map: &'a hir::map::Map<'hir>, owner_def_index: Option, hir_ids_seen: FxHashMap, - errors: Vec, + errors: &'a Lock>, } struct OuterVisitor<'a, 'hir: 'a> { hir_map: &'a hir::map::Map<'hir>, - errors: Vec, + errors: &'a Lock>, } impl<'a, 'hir: 'a> OuterVisitor<'a, 'hir> { @@ -52,7 +47,7 @@ impl<'a, 'hir: 'a> OuterVisitor<'a, 'hir> { hir_map, owner_def_index: None, hir_ids_seen: Default::default(), - errors: Vec::new(), + errors: self.errors, } } } @@ -61,23 +56,25 @@ impl<'a, 'hir: 'a> ItemLikeVisitor<'hir> for OuterVisitor<'a, 'hir> { fn visit_item(&mut self, i: &'hir hir::Item) { let mut inner_visitor = self.new_inner_visitor(self.hir_map); inner_visitor.check(i.id, |this| intravisit::walk_item(this, i)); - self.errors.extend(inner_visitor.errors.drain(..)); } fn visit_trait_item(&mut self, i: &'hir hir::TraitItem) { let mut inner_visitor = self.new_inner_visitor(self.hir_map); inner_visitor.check(i.id, |this| intravisit::walk_trait_item(this, i)); - self.errors.extend(inner_visitor.errors.drain(..)); } fn visit_impl_item(&mut self, i: &'hir hir::ImplItem) { let mut inner_visitor = self.new_inner_visitor(self.hir_map); inner_visitor.check(i.id, |this| intravisit::walk_impl_item(this, i)); - self.errors.extend(inner_visitor.errors.drain(..)); } } impl<'a, 'hir: 'a> HirIdValidator<'a, 'hir> { + #[cold] + #[inline(never)] + fn error(&self, f: impl FnOnce() -> String) { + self.errors.lock().push(f()); + } fn check)>(&mut self, node_id: NodeId, @@ -100,7 +97,7 @@ impl<'a, 'hir: 'a> HirIdValidator<'a, 'hir> { if max != self.hir_ids_seen.len() - 1 { // Collect the missing ItemLocalIds - let missing: Vec<_> = (0 .. max as u32 + 1) + let missing: Vec<_> = (0 ..= max as u32) .filter(|&i| !self.hir_ids_seen.contains_key(&ItemLocalId::from_u32(i))) .collect(); @@ -129,7 +126,7 @@ impl<'a, 'hir: 'a> HirIdValidator<'a, 'hir> { local_id, self.hir_map.node_to_string(node_id))); } - self.errors.push(format!( + self.error(|| format!( "ItemLocalIds not assigned densely in {}. \ Max ItemLocalId = {}, missing IDs = {:?}; seens IDs = {:?}", self.hir_map.def_path(DefId::local(owner_def_index)).to_string_no_crate(), @@ -155,14 +152,14 @@ impl<'a, 'hir: 'a> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> { let stable_id = self.hir_map.definitions().node_to_hir_id[node_id]; if stable_id == hir::DUMMY_HIR_ID { - self.errors.push(format!("HirIdValidator: No HirId assigned for NodeId {}: {:?}", + self.error(|| format!("HirIdValidator: No HirId assigned for NodeId {}: {:?}", node_id, self.hir_map.node_to_string(node_id))); return; } if owner != stable_id.owner { - self.errors.push(format!( + self.error(|| format!( "HirIdValidator: The recorded owner of {} is {} instead of {}", self.hir_map.node_to_string(node_id), self.hir_map.def_path(DefId::local(stable_id.owner)).to_string_no_crate(), @@ -171,7 +168,7 @@ impl<'a, 'hir: 'a> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> { if let Some(prev) = self.hir_ids_seen.insert(stable_id.local_id, node_id) { if prev != node_id { - self.errors.push(format!( + self.error(|| format!( "HirIdValidator: Same HirId {}/{} assigned for nodes {} and {}", self.hir_map.def_path(DefId::local(stable_id.owner)).to_string_no_crate(), stable_id.local_id.as_usize(), diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index cf7a7abf95a..c3e4f0c0501 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use self::collector::NodeCollector; pub use self::def_collector::{DefCollector, MacroInvocationData}; pub use self::definitions::{Definitions, DefKey, DefPath, DefPathData, @@ -17,18 +7,21 @@ use dep_graph::{DepGraph, DepNode, DepKind, DepNodeIndex}; use hir::def_id::{CRATE_DEF_INDEX, DefId, LocalDefId, DefIndexAddressSpace}; -use middle::cstore::CrateStore; +use middle::cstore::CrateStoreDyn; use rustc_target::spec::abi::Abi; use rustc_data_structures::svh::Svh; +use rustc_data_structures::sync::join; use syntax::ast::{self, Name, NodeId, CRATE_NODE_ID}; use syntax::source_map::Spanned; use syntax::ext::base::MacroKind; use syntax_pos::{Span, DUMMY_SP}; use hir::*; +use hir::itemlikevisit::ItemLikeVisitor; use hir::print::Nested; use util::nodemap::FxHashMap; +use util::common::time; use std::io; use std::result::Result::Err; @@ -159,6 +152,13 @@ impl Forest { self.dep_graph.read(DepNode::new_no_params(DepKind::Krate)); &self.krate } + + /// This is internally in the depedency tracking system. + /// Use the `krate` method to ensure your dependency on the + /// crate is tracked. + pub fn untracked_krate<'hir>(&'hir self) -> &'hir Crate { + &self.krate + } } /// Represents a mapping from Node IDs to AST elements and their parent @@ -286,9 +286,7 @@ impl<'hir> Map<'hir> { match node { Node::Item(item) => { - let def_id = || { - self.local_def_id(item.id) - }; + let def_id = || self.local_def_id(item.id); match item.node { ItemKind::Static(_, m, _) => Some(Def::Static(def_id(), m == MutMutable)), @@ -383,7 +381,7 @@ impl<'hir> Map<'hir> { pub fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem { self.read(id.node_id); - // NB: intentionally bypass `self.forest.krate()` so that we + // N.B., intentionally bypass `self.forest.krate()` so that we // do not trigger a read of the whole krate here self.forest.krate.trait_item(id) } @@ -391,7 +389,7 @@ impl<'hir> Map<'hir> { pub fn impl_item(&self, id: ImplItemId) -> &'hir ImplItem { self.read(id.node_id); - // NB: intentionally bypass `self.forest.krate()` so that we + // N.B., intentionally bypass `self.forest.krate()` so that we // do not trigger a read of the whole krate here self.forest.krate.impl_item(id) } @@ -399,7 +397,7 @@ impl<'hir> Map<'hir> { pub fn body(&self, id: BodyId) -> &'hir Body { self.read(id.node_id); - // NB: intentionally bypass `self.forest.krate()` so that we + // N.B., intentionally bypass `self.forest.krate()` so that we // do not trigger a read of the whole krate here self.forest.krate.body(id) } @@ -413,7 +411,7 @@ impl<'hir> Map<'hir> { } /// Returns the `NodeId` that corresponds to the definition of - /// which this is the body of, i.e. a `fn`, `const` or `static` + /// which this is the body of, i.e., a `fn`, `const` or `static` /// item (possibly associated), a closure, or a `hir::AnonConst`. pub fn body_owner(&self, BodyId { node_id }: BodyId) -> NodeId { let parent = self.get_parent_node(node_id); @@ -457,11 +455,20 @@ impl<'hir> Map<'hir> { Node::AnonConst(_) => { BodyOwnerKind::Const } + Node::Variant(&Spanned { node: VariantKind { data: VariantData::Tuple(..), .. }, .. }) | + Node::StructCtor(..) | + Node::Item(&Item { node: ItemKind::Fn(..), .. }) | + Node::TraitItem(&TraitItem { node: TraitItemKind::Method(..), .. }) | + Node::ImplItem(&ImplItem { node: ImplItemKind::Method(..), .. }) => { + BodyOwnerKind::Fn + } Node::Item(&Item { node: ItemKind::Static(_, m, _), .. }) => { BodyOwnerKind::Static(m) } - // Default to function if it's not a constant or static. - _ => BodyOwnerKind::Fn + Node::Expr(&Expr { node: ExprKind::Closure(..), .. }) => { + BodyOwnerKind::Closure + } + node => bug!("{:#?} is not a body node", node), } } @@ -475,7 +482,7 @@ impl<'hir> Map<'hir> { pub fn ty_param_name(&self, id: NodeId) -> Name { match self.get(id) { - Node::Item(&Item { node: ItemKind::Trait(..), .. }) => keywords::SelfType.name(), + Node::Item(&Item { node: ItemKind::Trait(..), .. }) => keywords::SelfUpper.name(), Node::GenericParam(param) => param.name.ident().name, _ => bug!("ty_param_name: {} not a type parameter", self.node_to_string(id)), } @@ -484,7 +491,7 @@ impl<'hir> Map<'hir> { pub fn trait_impls(&self, trait_did: DefId) -> &'hir [NodeId] { self.dep_graph.read(DepNode::new_no_params(DepKind::AllLocalTraitImpls)); - // NB: intentionally bypass `self.forest.krate()` so that we + // N.B., intentionally bypass `self.forest.krate()` so that we // do not trigger a read of the whole krate here self.forest.krate.trait_impls.get(&trait_did).map_or(&[], |xs| &xs[..]) } @@ -492,7 +499,7 @@ impl<'hir> Map<'hir> { pub fn trait_auto_impl(&self, trait_did: DefId) -> Option { self.dep_graph.read(DepNode::new_no_params(DepKind::AllLocalTraitImpls)); - // NB: intentionally bypass `self.forest.krate()` so that we + // N.B., intentionally bypass `self.forest.krate()` so that we // do not trigger a read of the whole krate here self.forest.krate.trait_auto_impl.get(&trait_did).cloned() } @@ -511,6 +518,47 @@ impl<'hir> Map<'hir> { &self.forest.krate.attrs } + pub fn get_module(&self, module: DefId) -> (&'hir Mod, Span, NodeId) + { + let node_id = self.as_local_node_id(module).unwrap(); + self.read(node_id); + match self.find_entry(node_id).unwrap().node { + Node::Item(&Item { + span, + node: ItemKind::Mod(ref m), + .. + }) => (m, span, node_id), + Node::Crate => (&self.forest.krate.module, self.forest.krate.span, node_id), + _ => panic!("not a module") + } + } + + pub fn visit_item_likes_in_module(&self, module: DefId, visitor: &mut V) + where V: ItemLikeVisitor<'hir> + { + let node_id = self.as_local_node_id(module).unwrap(); + + // Read the module so we'll be re-executed if new items + // appear immediately under in the module. If some new item appears + // in some nested item in the module, we'll be re-executed due to reads + // in the expect_* calls the loops below + self.read(node_id); + + let module = &self.forest.krate.modules[&node_id]; + + for id in &module.items { + visitor.visit_item(self.expect_item(*id)); + } + + for id in &module.trait_items { + visitor.visit_trait_item(self.expect_trait_item(id.node_id)); + } + + for id in &module.impl_items { + visitor.visit_impl_item(self.expect_impl_item(id.node_id)); + } + } + /// Retrieve the Node corresponding to `id`, panicking if it cannot /// be found. pub fn get(&self, id: NodeId) -> Node<'hir> { @@ -565,14 +613,14 @@ impl<'hir> Map<'hir> { result } - /// Similar to get_parent, returns the parent node id or id if there is no - /// parent. Note that the parent may be CRATE_NODE_ID, which is not itself + /// Similar to `get_parent`; returns the parent node-id, or own `id` if there is + /// no parent. Note that the parent may be `CRATE_NODE_ID`, which is not itself /// present in the map -- so passing the return value of get_parent_node to /// get may actually panic. /// This function returns the immediate parent in the AST, whereas get_parent /// returns the enclosing item. Note that this might not be the actual parent /// node in the AST - some kinds of nodes are not in the map and these will - /// never appear as the parent_node. So you can always walk the parent_nodes + /// never appear as the parent_node. So you can always walk the `parent_nodes` /// from a node to the root of the ast (unless you get the same id back here /// that can happen if the id is not in the map itself or is just weird). pub fn get_parent_node(&self, id: NodeId) -> NodeId { @@ -608,7 +656,7 @@ impl<'hir> Map<'hir> { /// If there is some error when walking the parents (e.g., a node does not /// have a parent in the map or a node can't be found), then we return the - /// last good node id we found. Note that reaching the crate root (id == 0), + /// last good node id we found. Note that reaching the crate root (`id == 0`), /// is not an error, since items in the crate module have the crate root as /// parent. fn walk_parent_nodes(&self, @@ -644,7 +692,7 @@ impl<'hir> Map<'hir> { } } - /// Retrieve the NodeId for `id`'s enclosing method, unless there's a + /// Retrieve the `NodeId` for `id`'s enclosing method, unless there's a /// `while` or `loop` before reaching it, as block tail returns are not /// available in them. /// @@ -672,6 +720,7 @@ impl<'hir> Map<'hir> { Node::Item(_) | Node::ForeignItem(_) | Node::TraitItem(_) | + Node::Expr(Expr { node: ExprKind::Closure(..), ..}) | Node::ImplItem(_) => true, _ => false, } @@ -680,7 +729,7 @@ impl<'hir> Map<'hir> { match *node { Node::Expr(ref expr) => { match expr.node { - ExprKind::While(..) | ExprKind::Loop(..) => true, + ExprKind::While(..) | ExprKind::Loop(..) | ExprKind::Ret(..) => true, _ => false, } } @@ -691,7 +740,7 @@ impl<'hir> Map<'hir> { self.walk_parent_nodes(id, match_fn, match_non_returning_block).ok() } - /// Retrieve the NodeId for `id`'s parent item, or `id` itself if no + /// Retrieve the `NodeId` for `id`'s parent item, or `id` itself if no /// parent item is in this map. The "parent item" is the closest parent node /// in the HIR which is recorded by the map and is an item, either an item /// in a module, trait, or impl. @@ -708,13 +757,13 @@ impl<'hir> Map<'hir> { } } - /// Returns the DefId of `id`'s nearest module parent, or `id` itself if no + /// Returns the `DefId` of `id`'s nearest module parent, or `id` itself if no /// module parent is in this map. pub fn get_module_parent(&self, id: NodeId) -> DefId { self.local_def_id(self.get_module_parent_node(id)) } - /// Returns the NodeId of `id`'s nearest module parent, or `id` itself if no + /// Returns the `NodeId` of `id`'s nearest module parent, or `id` itself if no /// module parent is in this map. pub fn get_module_parent_node(&self, id: NodeId) -> NodeId { match self.walk_parent_nodes(id, |node| match *node { @@ -727,7 +776,7 @@ impl<'hir> Map<'hir> { } /// Returns the nearest enclosing scope. A scope is an item or block. - /// FIXME it is not clear to me that all items qualify as scopes - statics + /// FIXME: it is not clear to me that all items qualify as scopes -- statics /// and associated types probably shouldn't, for example. Behavior in this /// regard should be expected to be highly unstable. pub fn get_enclosing_scope(&self, id: NodeId) -> Option { @@ -818,11 +867,11 @@ impl<'hir> Map<'hir> { /// Returns the name associated with the given NodeId's AST. pub fn name(&self, id: NodeId) -> Name { match self.get(id) { - Node::Item(i) => i.name, - Node::ForeignItem(i) => i.name, + Node::Item(i) => i.ident.name, + Node::ForeignItem(fi) => fi.ident.name, Node::ImplItem(ii) => ii.ident.name, Node::TraitItem(ti) => ti.ident.name, - Node::Variant(v) => v.node.name, + Node::Variant(v) => v.node.ident.name, Node::Field(f) => f.ident.name, Node::Lifetime(lt) => lt.name.ident().name, Node::GenericParam(param) => param.name.ident().name, @@ -958,7 +1007,7 @@ impl<'a, 'hir> NodesMatchingSuffix<'a, 'hir> { loop { if let Node::Item(item) = map.find(id)? { if item_is_mod(&item) { - return Some((id, item.name)) + return Some((id, item.ident.name)) } } let parent = map.get_parent(id); @@ -1014,22 +1063,23 @@ trait Named { impl Named for Spanned { fn name(&self) -> Name { self.node.name() } } -impl Named for Item { fn name(&self) -> Name { self.name } } -impl Named for ForeignItem { fn name(&self) -> Name { self.name } } -impl Named for VariantKind { fn name(&self) -> Name { self.name } } +impl Named for Item { fn name(&self) -> Name { self.ident.name } } +impl Named for ForeignItem { fn name(&self) -> Name { self.ident.name } } +impl Named for VariantKind { fn name(&self) -> Name { self.ident.name } } impl Named for StructField { fn name(&self) -> Name { self.ident.name } } impl Named for TraitItem { fn name(&self) -> Name { self.ident.name } } impl Named for ImplItem { fn name(&self) -> Name { self.ident.name } } pub fn map_crate<'hir>(sess: &::session::Session, - cstore: &dyn CrateStore, - forest: &'hir mut Forest, + cstore: &CrateStoreDyn, + forest: &'hir Forest, definitions: &'hir Definitions) -> Map<'hir> { - let (map, crate_hash) = { + let ((map, crate_hash), hir_to_node_id) = join(|| { let hcx = ::ich::StableHashingContext::new(sess, &forest.krate, definitions, cstore); - let mut collector = NodeCollector::root(&forest.krate, + let mut collector = NodeCollector::root(sess, + &forest.krate, &forest.dep_graph, &definitions, hcx); @@ -1037,11 +1087,16 @@ pub fn map_crate<'hir>(sess: &::session::Session, let crate_disambiguator = sess.local_crate_disambiguator(); let cmdline_args = sess.opts.dep_tracking_hash(); - collector.finalize_and_compute_crate_hash(crate_disambiguator, - cstore, - sess.source_map(), - cmdline_args) - }; + collector.finalize_and_compute_crate_hash( + crate_disambiguator, + cstore, + cmdline_args + ) + }, || { + // Build the reverse mapping of `node_to_hir_id`. + definitions.node_to_hir_id.iter_enumerated() + .map(|(node_id, &hir_id)| (hir_id, node_id)).collect() + }); if log_enabled!(::log::Level::Debug) { // This only makes sense for ordered stores; note the @@ -1055,10 +1110,6 @@ pub fn map_crate<'hir>(sess: &::session::Session, entries, vector_length, (entries as f64 / vector_length as f64) * 100.); } - // Build the reverse mapping of `node_to_hir_id`. - let hir_to_node_id = definitions.node_to_hir_id.iter_enumerated() - .map(|(node_id, &hir_id)| (hir_id, node_id)).collect(); - let map = Map { forest, dep_graph: forest.dep_graph.clone(), @@ -1068,7 +1119,9 @@ pub fn map_crate<'hir>(sess: &::session::Session, definitions, }; - hir_id_validator::check_crate(&map); + time(sess, "validate hir map", || { + hir_id_validator::check_crate(&map); + }); map } @@ -1199,7 +1252,7 @@ fn node_id_to_string(map: &Map<'_>, id: NodeId, include_id: bool) -> String { } Some(Node::Variant(ref variant)) => { format!("variant {} in {}{}", - variant.node.name, + variant.node.ident, path_str(), id_str) } Some(Node::Field(ref field)) => { @@ -1258,8 +1311,8 @@ fn node_id_to_string(map: &Map<'_>, id: NodeId, include_id: bool) -> String { } pub fn describe_def(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option { - if let Some(node_id) = tcx.hir.as_local_node_id(def_id) { - tcx.hir.describe_def(node_id) + if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { + tcx.hir().describe_def(node_id) } else { bug!("Calling local describe_def query provider for upstream DefId: {:?}", def_id) diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index e28193be34a..657e6e5dcde 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1,14 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// The Rust HIR. +// HIR datatypes. See the [rustc guide] for more info. +//! +//! [rustc guide]: https://rust-lang.github.io/rustc-guide/hir.html pub use self::BlockCheckMode::*; pub use self::CaptureClause::*; @@ -18,17 +10,18 @@ pub use self::PrimTy::*; pub use self::UnOp::*; pub use self::UnsafeSource::*; +use errors::FatalError; use hir::def::Def; use hir::def_id::{DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX}; use util::nodemap::{NodeMap, FxHashSet}; use mir::mono::Linkage; use syntax_pos::{Span, DUMMY_SP, symbol::InternedString}; -use syntax::source_map::{self, Spanned}; +use syntax::source_map::Spanned; use rustc_target::spec::abi::Abi; use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, DUMMY_NODE_ID, AsmDialect}; -use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy}; -use syntax::attr::InlineAttr; +use syntax::ast::{Attribute, Label, Lit, StrStyle, FloatTy, IntTy, UintTy}; +use syntax::attr::{InlineAttr, OptimizeAttr}; use syntax::ext::hygiene::SyntaxContext; use syntax::ptr::P; use syntax::symbol::{Symbol, keywords}; @@ -41,7 +34,7 @@ use rustc_data_structures::sync::{ParallelIterator, par_iter, Send, Sync, scope} use rustc_data_structures::thin_vec::ThinVec; use serialize::{self, Encoder, Encodable, Decoder, Decodable}; -use std::collections::BTreeMap; +use std::collections::{BTreeSet, BTreeMap}; use std::fmt; /// HIR doesn't commit to a concrete storage type and has its own alias for a vector. @@ -71,7 +64,7 @@ pub mod print; /// A HirId uniquely identifies a node in the HIR of the current crate. It is /// composed of the `owner`, which is the DefIndex of the directly enclosing -/// hir::Item, hir::TraitItem, or hir::ImplItem (i.e. the closest "item-like"), +/// hir::Item, hir::TraitItem, or hir::ImplItem (i.e., the closest "item-like"), /// and the `local_id` which is unique within the given owner. /// /// This two-level structure makes for more stable values: One can move an item @@ -150,17 +143,6 @@ pub const DUMMY_HIR_ID: HirId = HirId { pub const DUMMY_ITEM_LOCAL_ID: ItemLocalId = ItemLocalId::MAX; -#[derive(Clone, RustcEncodable, RustcDecodable, Copy)] -pub struct Label { - pub ident: Ident, -} - -impl fmt::Debug for Label { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "label({:?})", self.ident) - } -} - #[derive(Clone, RustcEncodable, RustcDecodable, Copy)] pub struct Lifetime { pub id: NodeId, @@ -181,7 +163,7 @@ pub enum ParamName { Plain(Ident), /// Synthetic name generated when user elided a lifetime in an impl header, - /// e.g. the lifetimes in cases like these: + /// e.g., the lifetimes in cases like these: /// /// impl Foo for &u32 /// impl Foo<'_> for u32 @@ -197,7 +179,7 @@ pub enum ParamName { /// Indicates an illegal name was given and an error has been /// repored (so we should squelch other derived errors). Occurs - /// when e.g. `'_` is used in the wrong place. + /// when e.g., `'_` is used in the wrong place. Error, } @@ -222,7 +204,7 @@ pub enum LifetimeName { /// User-given names or fresh (synthetic) names. Param(ParamName), - /// User typed nothing. e.g. the lifetime in `&u32`. + /// User typed nothing. e.g., the lifetime in `&u32`. Implicit, /// Indicates an error during lowering (usually `'_` in wrong place) @@ -311,7 +293,7 @@ pub struct Path { impl Path { pub fn is_global(&self) -> bool { - !self.segments.is_empty() && self.segments[0].ident.name == keywords::CrateRoot.name() + !self.segments.is_empty() && self.segments[0].ident.name == keywords::PathRoot.name() } } @@ -351,7 +333,7 @@ pub struct PathSegment { /// Whether to infer remaining type parameters, if any. /// This only applies to expression and pattern paths, and /// out of those only the segments with no type parameters - /// to begin with, e.g. `Vec::new` is `>::new::<..>`. + /// to begin with, e.g., `Vec::new` is `>::new::<..>`. pub infer_types: bool, } @@ -388,7 +370,7 @@ impl PathSegment { } // FIXME: hack required because you can't create a static - // GenericArgs, so you can't just return a &GenericArgs. + // `GenericArgs`, so you can't just return a `&GenericArgs`. pub fn with_generic_args(&self, f: F) -> R where F: FnOnce(&GenericArgs) -> R { @@ -428,7 +410,7 @@ pub struct GenericArgs { /// The generic arguments for this path segment. pub args: HirVec, /// Bindings (equality constraints) on associated types, if present. - /// E.g., `Foo`. + /// E.g., `Foo`. pub bindings: HirVec, /// Were arguments written in parenthesized form `Fn(T) -> U`? /// This is required mostly for pretty-printing and diagnostics, @@ -514,17 +496,17 @@ pub type GenericBounds = HirVec; #[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)] pub enum LifetimeParamKind { - // Indicates that the lifetime definition was explicitly declared, like: - // `fn foo<'a>(x: &'a u8) -> &'a u8 { x }` + // Indicates that the lifetime definition was explicitly declared (e.g., in + // `fn foo<'a>(x: &'a u8) -> &'a u8 { x }`). Explicit, // Indicates that the lifetime definition was synthetically added - // as a result of an in-band lifetime usage like: - // `fn foo(x: &'a u8) -> &'a u8 { x }` + // as a result of an in-band lifetime usage (e.g., in + // `fn foo(x: &'a u8) -> &'a u8 { x }`). InBand, - // Indication that the lifetime was elided like both cases here: - // `fn foo(x: &u8) -> &'_ u8 { x }` + // Indication that the lifetime was elided (e.g., in both cases in + // `fn foo(x: &u8) -> &'_ u8 { x }`). Elided, // Indication that the lifetime name was somehow in error. @@ -533,7 +515,7 @@ pub enum LifetimeParamKind { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum GenericParamKind { - /// A lifetime definition, eg `'a: 'b + 'c + 'd`. + /// A lifetime definition (e.g., `'a: 'b + 'c + 'd`). Lifetime { kind: LifetimeParamKind, }, @@ -637,11 +619,11 @@ impl WhereClause { /// A single predicate in a `where` clause #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum WherePredicate { - /// A type binding, eg `for<'c> Foo: Send+Clone+'c` + /// A type binding (e.g., `for<'c> Foo: Send + Clone + 'c`). BoundPredicate(WhereBoundPredicate), - /// A lifetime predicate, e.g. `'a: 'b+'c` + /// A lifetime predicate (e.g., `'a: 'b + 'c`). RegionPredicate(WhereRegionPredicate), - /// An equality predicate (unsupported) + /// An equality predicate (unsupported). EqPredicate(WhereEqPredicate), } @@ -667,7 +649,7 @@ pub struct WhereBoundPredicate { pub bounds: GenericBounds, } -/// A lifetime predicate, e.g. `'a: 'b+'c` +/// A lifetime predicate, e.g., `'a: 'b+'c` #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct WhereRegionPredicate { pub span: Span, @@ -675,7 +657,7 @@ pub struct WhereRegionPredicate { pub bounds: GenericBounds, } -/// An equality predicate (unsupported), e.g. `T=int` +/// An equality predicate (unsupported), e.g., `T=int` #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct WhereEqPredicate { pub id: NodeId, @@ -684,12 +666,21 @@ pub struct WhereEqPredicate { pub rhs_ty: P, } +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +pub struct ModuleItems { + // Use BTreeSets here so items are in the same order as in the + // list of all items in Crate + pub items: BTreeSet, + pub trait_items: BTreeSet, + pub impl_items: BTreeSet, +} + /// The top-level data structure that stores the entire contents of /// the crate currently being compiled. /// /// For more details, see the [rustc guide]. /// -/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/hir.html +/// [rustc guide]: https://rust-lang.github.io/rustc-guide/hir.html #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Crate { pub module: Mod, @@ -697,7 +688,7 @@ pub struct Crate { pub span: Span, pub exported_macros: HirVec, - // NB: We use a BTreeMap here so that `visit_all_items` iterates + // N.B., we use a BTreeMap here so that `visit_all_items` iterates // over the ids in increasing order. In principle it should not // matter what order we visit things in, but in *practice* it // does, because it can affect the order in which errors are @@ -716,6 +707,10 @@ pub struct Crate { /// in the crate, you should iterate over this list rather than the keys /// of bodies. pub body_ids: Vec, + + /// A list of modules written out in the order in which they + /// appear in the crate. This includes the main crate module. + pub modules: BTreeMap, } impl Crate { @@ -815,11 +810,6 @@ pub struct Block { /// break out of this block early. /// Used by `'label: {}` blocks and by `catch` statements. pub targeted_by_break: bool, - /// If true, don't emit return value type errors as the parser had - /// to recover from a parse error so this block will not have an - /// appropriate type. A parse error will have been emitted so the - /// compilation will never succeed if this is true. - pub recovered: bool, } #[derive(Clone, RustcEncodable, RustcDecodable)] @@ -932,11 +922,11 @@ pub enum PatKind { /// A fresh binding `ref mut binding @ OPT_SUBPATTERN`. /// The `NodeId` is the canonical ID for the variable being bound, - /// e.g. in `Ok(x) | Err(x)`, both `x` use the same canonical ID, + /// e.g., in `Ok(x) | Err(x)`, both `x` use the same canonical ID, /// which is the pattern ID of the first `x`. Binding(BindingAnnotation, NodeId, Ident, Option>), - /// A struct or struct variant pattern, e.g. `Variant {x, y, ..}`. + /// A struct or struct variant pattern, e.g., `Variant {x, y, ..}`. /// The `bool` is `true` in the presence of a `..`. Struct(QPath, HirVec>, bool), @@ -954,11 +944,11 @@ pub enum PatKind { Tuple(HirVec>, Option), /// A `box` pattern Box(P), - /// A reference pattern, e.g. `&mut (a, b)` + /// A reference pattern, e.g., `&mut (a, b)` Ref(P, Mutability), /// A literal Lit(P), - /// A range pattern, e.g. `1...2` or `1..2` + /// A range pattern, e.g., `1...2` or `1..2` Range(P, P, RangeEnd), /// `[a, b, ..i, y, z]` is represented as: /// `PatKind::Slice(box [a, b], Some(i), box [y, z])` @@ -1144,45 +1134,41 @@ impl UnOp { } /// A statement -pub type Stmt = Spanned; +#[derive(Clone, RustcEncodable, RustcDecodable)] +pub struct Stmt { + pub id: NodeId, + pub node: StmtKind, + pub span: Span, +} -impl fmt::Debug for StmtKind { +impl fmt::Debug for Stmt { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - // Sadness. - let spanned = source_map::dummy_spanned(self.clone()); - write!(f, - "stmt({}: {})", - spanned.node.id(), - print::to_string(print::NO_ANN, |s| s.print_stmt(&spanned))) + write!(f, "stmt({}: {})", self.id, + print::to_string(print::NO_ANN, |s| s.print_stmt(self))) } } #[derive(Clone, RustcEncodable, RustcDecodable)] pub enum StmtKind { - /// Could be an item or a local (let) binding: - Decl(P, NodeId), + /// A local (let) binding: + Local(P), + /// An item binding: + Item(P), /// Expr without trailing semi-colon (must have unit type): - Expr(P, NodeId), + Expr(P), /// Expr with trailing semi-colon (may have any type): - Semi(P, NodeId), + Semi(P), } impl StmtKind { pub fn attrs(&self) -> &[Attribute] { match *self { - StmtKind::Decl(ref d, _) => d.node.attrs(), - StmtKind::Expr(ref e, _) | - StmtKind::Semi(ref e, _) => &e.attrs, - } - } - - pub fn id(&self) -> NodeId { - match *self { - StmtKind::Decl(_, id) | - StmtKind::Expr(_, id) | - StmtKind::Semi(_, id) => id, + StmtKind::Local(ref l) => &l.attrs, + StmtKind::Item(_) => &[], + StmtKind::Expr(ref e) | + StmtKind::Semi(ref e) => &e.attrs, } } } @@ -1201,32 +1187,6 @@ pub struct Local { pub source: LocalSource, } -pub type Decl = Spanned; - -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] -pub enum DeclKind { - /// A local (let) binding: - Local(P), - /// An item binding: - Item(ItemId), -} - -impl DeclKind { - pub fn attrs(&self) -> &[Attribute] { - match *self { - DeclKind::Local(ref l) => &l.attrs, - DeclKind::Item(_) => &[] - } - } - - pub fn is_local(&self) -> bool { - match *self { - DeclKind::Local(_) => true, - _ => false, - } - } -} - /// represents one arm of a 'match' #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Arm { @@ -1310,6 +1270,9 @@ pub enum BodyOwnerKind { /// Functions and methods. Fn, + /// Closures + Closure, + /// Constants and associated constants. Const, @@ -1317,10 +1280,19 @@ pub enum BodyOwnerKind { Static(Mutability), } +impl BodyOwnerKind { + pub fn is_fn_or_closure(self) -> bool { + match self { + BodyOwnerKind::Fn | BodyOwnerKind::Closure => true, + BodyOwnerKind::Const | BodyOwnerKind::Static(_) => false, + } + } +} + /// A constant (expression) that's not an item or associated item, /// but needs its own `DefId` for type-checking, const-eval, etc. -/// These are usually found nested inside types (e.g. array lengths) -/// or expressions (e.g. repeat counts), and also used to define +/// These are usually found nested inside types (e.g., array lengths) +/// or expressions (e.g., repeat counts), and also used to define /// explicit discriminant values for enum variants. #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)] pub struct AnonConst { @@ -1370,6 +1342,7 @@ impl Expr { ExprKind::Struct(..) => ExprPrecedence::Struct, ExprKind::Repeat(..) => ExprPrecedence::Repeat, ExprKind::Yield(..) => ExprPrecedence::Yield, + ExprKind::Err => ExprPrecedence::Err, } } @@ -1420,7 +1393,8 @@ impl Expr { ExprKind::AddrOf(..) | ExprKind::Binary(..) | ExprKind::Yield(..) | - ExprKind::Cast(..) => { + ExprKind::Cast(..) | + ExprKind::Err => { false } } @@ -1464,7 +1438,7 @@ pub enum ExprKind { /// A unary operation (For example: `!x`, `*x`) Unary(UnOp, P), /// A literal (For example: `1`, `"foo"`) - Lit(P), + Lit(Lit), /// A cast (`foo as f64`) Cast(P, P), Type(P, P), @@ -1533,6 +1507,9 @@ pub enum ExprKind { /// A suspension point for generators. This is `yield ` in Rust. Yield(P), + + /// Placeholder for an expression that wasn't syntactically well formed in some way. + Err, } /// Optionally `Self`-qualified value/type path or associated extension. @@ -1541,12 +1518,12 @@ pub enum QPath { /// Path to a definition, optionally "fully-qualified" with a `Self` /// type, if the path points to an associated item in a trait. /// - /// E.g. an unqualified path like `Clone::clone` has `None` for `Self`, + /// e.g., an unqualified path like `Clone::clone` has `None` for `Self`, /// while ` as Clone>::clone` has `Some(Vec)` for `Self`, /// even though they both have the same two-segment `Clone::clone` `Path`. Resolved(Option>, P), - /// Type-related paths, e.g. `::default` or `::Output`. + /// Type-related paths, e.g., `::default` or `::Output`. /// Will be resolved by type-checking to an associated item. /// /// UFCS source paths can desugar into this, with `Vec::new` turning into @@ -1633,7 +1610,7 @@ pub enum CaptureClause { CaptureByRef, } -// NB: If you change this, you'll probably want to change the corresponding +// N.B., if you change this, you'll probably want to change the corresponding // type structure in middle/ty.rs as well. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct MutTy { @@ -1792,14 +1769,14 @@ pub enum TyKind { Ptr(MutTy), /// A reference (`&'a T` or `&'a mut T`) Rptr(Lifetime, MutTy), - /// A bare function (e.g. `fn(usize) -> bool`) + /// A bare function (e.g., `fn(usize) -> bool`) BareFn(P), /// The never type (`!`) Never, /// A tuple (`(A, B, C, D,...)`) Tup(HirVec), /// A path to a type definition (`module::module::...::Type`), or an - /// associated type, e.g. ` as Trait>::Type` or `::Target`. + /// associated type, e.g., ` as Trait>::Type` or `::Target`. /// /// Type parameters may be stored in each `PathSegment`. Path(QPath), @@ -1814,7 +1791,7 @@ pub enum TyKind { TraitObject(HirVec, Lifetime), /// Unused for now Typeof(AnonConst), - /// TyKind::Infer means the type should be inferred instead of it having been + /// `TyKind::Infer` means the type should be inferred instead of it having been /// specified. This can appear anywhere in a type. Infer, /// Placeholder for a type that has failed to be defined. @@ -1977,6 +1954,15 @@ pub enum FunctionRetTy { Return(P), } +impl fmt::Display for FunctionRetTy { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Return(ref ty) => print::to_string(print::NO_ANN, |s| s.print_type(ty)).fmt(f), + DefaultReturn(_) => "()".fmt(f), + } + } +} + impl FunctionRetTy { pub fn span(&self) -> Span { match *self { @@ -2014,10 +2000,10 @@ pub struct EnumDef { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct VariantKind { - pub name: Name, + pub ident: Ident, pub attrs: HirVec, pub data: VariantData, - /// Explicit discriminant, eg `Foo = 1` + /// Explicit discriminant, e.g., `Foo = 1` pub disr_expr: Option, } @@ -2025,15 +2011,15 @@ pub type Variant = Spanned; #[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)] pub enum UseKind { - /// One import, e.g. `use foo::bar` or `use foo::bar as baz`. + /// One import, e.g., `use foo::bar` or `use foo::bar as baz`. /// Also produced for each element of a list `use`, e.g. // `use foo::{a, b}` lowers to `use foo::a; use foo::b;`. Single, - /// Glob import, e.g. `use foo::*`. + /// Glob import, e.g., `use foo::*`. Glob, - /// Degenerate list import, e.g. `use foo::{a, b}` produces + /// Degenerate list import, e.g., `use foo::{a, b}` produces /// an additional `use foo::{}` for performing checks such as /// unstable feature gating. May be removed in the future. ListStem, @@ -2052,6 +2038,20 @@ pub struct TraitRef { pub hir_ref_id: HirId, } +impl TraitRef { + /// Get the `DefId` of the referenced trait. It _must_ actually be a trait or trait alias. + pub fn trait_def_id(&self) -> DefId { + match self.path.def { + Def::Trait(did) => did, + Def::TraitAlias(did) => did, + Def::Err => { + FatalError.raise(); + } + _ => unreachable!(), + } + } +} + #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct PolyTraitRef { /// The `'a` in `<'a> Foo<&'a T>` @@ -2089,6 +2089,15 @@ impl VisibilityKind { VisibilityKind::Restricted { .. } => true, } } + + pub fn descr(&self) -> &'static str { + match *self { + VisibilityKind::Public => "public", + VisibilityKind::Inherited => "private", + VisibilityKind::Crate(..) => "crate-visible", + VisibilityKind::Restricted { .. } => "restricted", + } + } } #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] @@ -2117,7 +2126,7 @@ impl StructField { /// Id of the whole enum lives in `Item`. /// /// For structs: `NodeId` represents an Id of the structure's constructor, so it is not actually -/// used for `Struct`-structs (but still presents). Structures don't have an analogue of "Id of +/// used for `Struct`-structs (but still present). Structures don't have an analogue of "Id of /// the variant itself" from enum variants. /// Id of the whole struct lives in `Item`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] @@ -2175,7 +2184,7 @@ pub struct ItemId { /// The name might be a dummy name in case of anonymous items #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Item { - pub name: Name, + pub ident: Ident, pub id: NodeId, pub hir_id: HirId, pub attrs: HirVec, @@ -2196,7 +2205,7 @@ pub struct FnHeader { pub enum ItemKind { /// An `extern crate` item, with optional *original* crate name if the crate was renamed. /// - /// E.g. `extern crate foo` or `extern crate foo_bar as foo` + /// e.g., `extern crate foo` or `extern crate foo_bar as foo` ExternCrate(Option), /// `use foo::bar::*;` or `use foo::bar::baz as quux;` @@ -2218,15 +2227,15 @@ pub enum ItemKind { ForeignMod(ForeignMod), /// Module-level inline assembly (from global_asm!) GlobalAsm(P), - /// A type alias, e.g. `type Foo = Bar` + /// A type alias, e.g., `type Foo = Bar` Ty(P, Generics), - /// An existential type definition, e.g. `existential type Foo: Bar;` + /// An existential type definition, e.g., `existential type Foo: Bar;` Existential(ExistTy), - /// An enum definition, e.g. `enum Foo {C, D}` + /// An enum definition, e.g., `enum Foo {C, D}` Enum(EnumDef, Generics), - /// A struct definition, e.g. `struct Foo {x: A}` + /// A struct definition, e.g., `struct Foo {x: A}` Struct(VariantData, Generics), - /// A union definition, e.g. `union Foo {x: A, y: B}` + /// A union definition, e.g., `union Foo {x: A, y: B}` Union(VariantData, Generics), /// Represents a Trait Declaration Trait(IsAuto, Unsafety, Generics, GenericBounds, HirVec), @@ -2330,7 +2339,7 @@ pub enum AssociatedItemKind { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct ForeignItem { - pub name: Name, + pub ident: Ident, pub attrs: HirVec, pub node: ForeignItemKind, pub id: NodeId, @@ -2398,6 +2407,7 @@ pub type GlobMap = NodeMap>; pub fn provide(providers: &mut Providers<'_>) { + check_attr::provide(providers); providers.describe_def = map::describe_def; } @@ -2406,6 +2416,8 @@ pub struct CodegenFnAttrs { pub flags: CodegenFnAttrFlags, /// Parsed representation of the `#[inline]` attribute pub inline: InlineAttr, + /// Parsed representation of the `#[optimize]` attribute + pub optimize: OptimizeAttr, /// The `#[export_name = "..."]` attribute, indicating a custom symbol a /// function should be exported under pub export_name: Option, @@ -2466,6 +2478,7 @@ impl CodegenFnAttrs { CodegenFnAttrs { flags: CodegenFnAttrFlags::empty(), inline: InlineAttr::None, + optimize: OptimizeAttr::None, export_name: None, link_name: None, target_features: vec![], diff --git a/src/librustc/hir/pat_util.rs b/src/librustc/hir/pat_util.rs index 8a714a5fbd8..4df71a8768a 100644 --- a/src/librustc/hir/pat_util.rs +++ b/src/librustc/hir/pat_util.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def::Def; use hir::def_id::DefId; use hir::{self, HirId, PatKind}; @@ -101,7 +91,7 @@ impl hir::Pat { } /// Checks if the pattern contains any patterns that bind something to - /// an ident, e.g. `foo`, or `Foo(foo)` or `foo @ Bar(..)`. + /// an ident, e.g., `foo`, or `Foo(foo)` or `foo @ Bar(..)`. pub fn contains_bindings(&self) -> bool { let mut contains_bindings = false; self.walk(|p| { @@ -116,7 +106,7 @@ impl hir::Pat { } /// Checks if the pattern contains any patterns that bind something to - /// an ident or wildcard, e.g. `foo`, or `Foo(_)`, `foo @ Bar(..)`, + /// an ident or wildcard, e.g., `foo`, or `Foo(_)`, `foo @ Bar(..)`, pub fn contains_bindings_or_wild(&self) -> bool { let mut contains_bindings = false; self.walk(|p| { diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index e69d32ad1de..e950f25c2ac 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_target::spec::abi::Abi; use syntax::ast; use syntax::source_map::{SourceMap, Spanned}; @@ -25,6 +15,7 @@ use hir; use hir::{PatKind, GenericBound, TraitBoundModifier, RangeEnd}; use hir::{GenericParam, GenericParamKind, GenericArg}; +use std::borrow::Cow; use std::cell::Cell; use std::io::{self, Write, Read}; use std::iter::Peekable; @@ -64,7 +55,7 @@ pub trait PpAnn { pub struct NoAnn; impl PpAnn for NoAnn {} -pub const NO_ANN: &'static dyn PpAnn = &NoAnn; +pub const NO_ANN: &dyn PpAnn = &NoAnn; impl PpAnn for hir::Crate { fn try_fetch_item(&self, item: ast::NodeId) -> Option<&hir::Item> { @@ -209,7 +200,7 @@ pub fn to_string(ann: &dyn PpAnn, f: F) -> String String::from_utf8(wr).unwrap() } -pub fn visibility_qualified(vis: &hir::Visibility, w: &str) -> String { +pub fn visibility_qualified>>(vis: &hir::Visibility, w: S) -> String { to_string(NO_ANN, |s| { s.print_visibility(vis)?; s.s.word(w) @@ -226,12 +217,13 @@ impl<'a> State<'a> { self.s.word(" ") } - pub fn word_nbsp(&mut self, w: &str) -> io::Result<()> { + pub fn word_nbsp>>(&mut self, w: S) -> io::Result<()> { self.s.word(w)?; self.nbsp() } - pub fn head(&mut self, w: &str) -> io::Result<()> { + pub fn head>>(&mut self, w: S) -> io::Result<()> { + let w = w.into(); // outer-box is consistent self.cbox(indent_unit)?; // head-box is inconsistent @@ -303,7 +295,7 @@ impl<'a> State<'a> { pub fn synth_comment(&mut self, text: String) -> io::Result<()> { self.s.word("/*")?; self.s.space()?; - self.s.word(&text[..])?; + self.s.word(text)?; self.s.space()?; self.s.word("*/") } @@ -438,7 +430,9 @@ impl<'a> State<'a> { self.s.word("_")?; } hir::TyKind::Err => { - self.s.word("?")?; + self.popen()?; + self.s.word("/*ERROR*/")?; + self.pclose()?; } } self.end() @@ -458,7 +452,7 @@ impl<'a> State<'a> { abi: Abi::Rust, asyncness: hir::IsAsync::NotAsync, }, - Some(item.name), + Some(item.ident.name), generics, &item.vis, arg_names, @@ -468,11 +462,11 @@ impl<'a> State<'a> { self.end() // end the outer fn box } hir::ForeignItemKind::Static(ref t, m) => { - self.head(&visibility_qualified(&item.vis, "static"))?; + self.head(visibility_qualified(&item.vis, "static"))?; if m { self.word_space("mut")?; } - self.print_name(item.name)?; + self.print_ident(item.ident)?; self.word_space(":")?; self.print_type(&t)?; self.s.word(";")?; @@ -480,8 +474,8 @@ impl<'a> State<'a> { self.end() // end the outer cbox } hir::ForeignItemKind::Type => { - self.head(&visibility_qualified(&item.vis, "type"))?; - self.print_name(item.name)?; + self.head(visibility_qualified(&item.vis, "type"))?; + self.print_ident(item.ident)?; self.s.word(";")?; self.end()?; // end the head-ibox self.end() // end the outer cbox @@ -495,7 +489,7 @@ impl<'a> State<'a> { default: Option, vis: &hir::Visibility) -> io::Result<()> { - self.s.word(&visibility_qualified(vis, ""))?; + self.s.word(visibility_qualified(vis, ""))?; self.word_space("const")?; self.print_ident(ident)?; self.word_space(":")?; @@ -534,28 +528,28 @@ impl<'a> State<'a> { self.ann.pre(self, AnnNode::Item(item))?; match item.node { hir::ItemKind::ExternCrate(orig_name) => { - self.head(&visibility_qualified(&item.vis, "extern crate"))?; + self.head(visibility_qualified(&item.vis, "extern crate"))?; if let Some(orig_name) = orig_name { self.print_name(orig_name)?; self.s.space()?; self.s.word("as")?; self.s.space()?; } - self.print_name(item.name)?; + self.print_ident(item.ident)?; self.s.word(";")?; self.end()?; // end inner head-block self.end()?; // end outer head-block } hir::ItemKind::Use(ref path, kind) => { - self.head(&visibility_qualified(&item.vis, "use"))?; + self.head(visibility_qualified(&item.vis, "use"))?; self.print_path(path, false)?; match kind { hir::UseKind::Single => { - if path.segments.last().unwrap().ident.name != item.name { + if path.segments.last().unwrap().ident != item.ident { self.s.space()?; self.word_space("as")?; - self.print_name(item.name)?; + self.print_ident(item.ident)?; } self.s.word(";")?; } @@ -566,11 +560,11 @@ impl<'a> State<'a> { self.end()?; // end outer head-block } hir::ItemKind::Static(ref ty, m, expr) => { - self.head(&visibility_qualified(&item.vis, "static"))?; + self.head(visibility_qualified(&item.vis, "static"))?; if m == hir::MutMutable { self.word_space("mut")?; } - self.print_name(item.name)?; + self.print_ident(item.ident)?; self.word_space(":")?; self.print_type(&ty)?; self.s.space()?; @@ -582,8 +576,8 @@ impl<'a> State<'a> { self.end()?; // end the outer cbox } hir::ItemKind::Const(ref ty, expr) => { - self.head(&visibility_qualified(&item.vis, "const"))?; - self.print_name(item.name)?; + self.head(visibility_qualified(&item.vis, "const"))?; + self.print_ident(item.ident)?; self.word_space(":")?; self.print_type(&ty)?; self.s.space()?; @@ -598,7 +592,7 @@ impl<'a> State<'a> { self.head("")?; self.print_fn(decl, header, - Some(item.name), + Some(item.ident.name), typarams, &item.vis, &[], @@ -609,8 +603,8 @@ impl<'a> State<'a> { self.ann.nested(self, Nested::Body(body))?; } hir::ItemKind::Mod(ref _mod) => { - self.head(&visibility_qualified(&item.vis, "mod"))?; - self.print_name(item.name)?; + self.head(visibility_qualified(&item.vis, "mod"))?; + self.print_ident(item.ident)?; self.nbsp()?; self.bopen()?; self.print_mod(_mod, &item.attrs)?; @@ -618,19 +612,19 @@ impl<'a> State<'a> { } hir::ItemKind::ForeignMod(ref nmod) => { self.head("extern")?; - self.word_nbsp(&nmod.abi.to_string())?; + self.word_nbsp(nmod.abi.to_string())?; self.bopen()?; self.print_foreign_mod(nmod, &item.attrs)?; self.bclose(item.span)?; } hir::ItemKind::GlobalAsm(ref ga) => { - self.head(&visibility_qualified(&item.vis, "global asm"))?; - self.s.word(&ga.asm.as_str())?; + self.head(visibility_qualified(&item.vis, "global asm"))?; + self.s.word(ga.asm.as_str().get())?; self.end()? } hir::ItemKind::Ty(ref ty, ref generics) => { - self.head(&visibility_qualified(&item.vis, "type"))?; - self.print_name(item.name)?; + self.head(visibility_qualified(&item.vis, "type"))?; + self.print_ident(item.ident)?; self.print_generic_params(&generics.params)?; self.end()?; // end the inner ibox @@ -642,8 +636,8 @@ impl<'a> State<'a> { self.end()?; // end the outer ibox } hir::ItemKind::Existential(ref exist) => { - self.head(&visibility_qualified(&item.vis, "existential type"))?; - self.print_name(item.name)?; + self.head(visibility_qualified(&item.vis, "existential type"))?; + self.print_ident(item.ident)?; self.print_generic_params(&exist.generics.params)?; self.end()?; // end the inner ibox @@ -665,15 +659,16 @@ impl<'a> State<'a> { self.end()?; // end the outer ibox } hir::ItemKind::Enum(ref enum_definition, ref params) => { - self.print_enum_def(enum_definition, params, item.name, item.span, &item.vis)?; + self.print_enum_def(enum_definition, params, item.ident.name, item.span, + &item.vis)?; } hir::ItemKind::Struct(ref struct_def, ref generics) => { - self.head(&visibility_qualified(&item.vis, "struct"))?; - self.print_struct(struct_def, generics, item.name, item.span, true)?; + self.head(visibility_qualified(&item.vis, "struct"))?; + self.print_struct(struct_def, generics, item.ident.name, item.span, true)?; } hir::ItemKind::Union(ref struct_def, ref generics) => { - self.head(&visibility_qualified(&item.vis, "union"))?; - self.print_struct(struct_def, generics, item.name, item.span, true)?; + self.head(visibility_qualified(&item.vis, "union"))?; + self.print_struct(struct_def, generics, item.ident.name, item.span, true)?; } hir::ItemKind::Impl(unsafety, polarity, @@ -720,7 +715,7 @@ impl<'a> State<'a> { self.print_is_auto(is_auto)?; self.print_unsafety(unsafety)?; self.word_nbsp("trait")?; - self.print_name(item.name)?; + self.print_ident(item.ident)?; self.print_generic_params(&generics.params)?; let mut real_bounds = Vec::with_capacity(bounds.len()); for b in bounds.iter() { @@ -745,7 +740,7 @@ impl<'a> State<'a> { self.head("")?; self.print_visibility(&item.vis)?; self.word_nbsp("trait")?; - self.print_name(item.name)?; + self.print_ident(item.ident)?; self.print_generic_params(&generics.params)?; let mut real_bounds = Vec::with_capacity(bounds.len()); // FIXME(durka) this seems to be some quite outdated syntax @@ -795,7 +790,7 @@ impl<'a> State<'a> { span: syntax_pos::Span, visibility: &hir::Visibility) -> io::Result<()> { - self.head(&visibility_qualified(visibility, "enum"))?; + self.head(visibility_qualified(visibility, "enum"))?; self.print_name(name)?; self.print_generic_params(&generics.params)?; self.print_where_clause(&generics.where_clause)?; @@ -903,7 +898,7 @@ impl<'a> State<'a> { pub fn print_variant(&mut self, v: &hir::Variant) -> io::Result<()> { self.head("")?; let generics = hir::Generics::empty(); - self.print_struct(&v.node.data, &generics, v.node.name, v.span, false)?; + self.print_struct(&v.node.data, &generics, v.node.ident.name, v.span, false)?; if let Some(ref d) = v.node.disr_expr { self.s.space()?; self.word_space("=")?; @@ -997,14 +992,29 @@ impl<'a> State<'a> { pub fn print_stmt(&mut self, st: &hir::Stmt) -> io::Result<()> { self.maybe_print_comment(st.span.lo())?; match st.node { - hir::StmtKind::Decl(ref decl, _) => { - self.print_decl(&decl)?; + hir::StmtKind::Local(ref loc) => { + self.space_if_not_bol()?; + self.ibox(indent_unit)?; + self.word_nbsp("let")?; + + self.ibox(indent_unit)?; + self.print_local_decl(&loc)?; + self.end()?; + if let Some(ref init) = loc.init { + self.nbsp()?; + self.word_space("=")?; + self.print_expr(&init)?; + } + self.end()? } - hir::StmtKind::Expr(ref expr, _) => { + hir::StmtKind::Item(ref item) => { + self.ann.nested(self, Nested::Item(**item))? + } + hir::StmtKind::Expr(ref expr) => { self.space_if_not_bol()?; self.print_expr(&expr)?; } - hir::StmtKind::Semi(ref expr, _) => { + hir::StmtKind::Semi(ref expr) => { self.space_if_not_bol()?; self.print_expr(&expr)?; self.s.word(";")?; @@ -1548,6 +1558,11 @@ impl<'a> State<'a> { self.word_space("yield")?; self.print_expr_maybe_paren(&expr, parser::PREC_JUMP)?; } + hir::ExprKind::Err => { + self.popen()?; + self.s.word("/*ERROR*/")?; + self.pclose()?; + } } self.ann.post(self, AnnNode::Expr(expr))?; self.end() @@ -1562,39 +1577,15 @@ impl<'a> State<'a> { Ok(()) } - pub fn print_decl(&mut self, decl: &hir::Decl) -> io::Result<()> { - self.maybe_print_comment(decl.span.lo())?; - match decl.node { - hir::DeclKind::Local(ref loc) => { - self.space_if_not_bol()?; - self.ibox(indent_unit)?; - self.word_nbsp("let")?; - - self.ibox(indent_unit)?; - self.print_local_decl(&loc)?; - self.end()?; - if let Some(ref init) = loc.init { - self.nbsp()?; - self.word_space("=")?; - self.print_expr(&init)?; - } - self.end() - } - hir::DeclKind::Item(item) => { - self.ann.nested(self, Nested::Item(item)) - } - } - } - pub fn print_usize(&mut self, i: usize) -> io::Result<()> { - self.s.word(&i.to_string()) + self.s.word(i.to_string()) } pub fn print_ident(&mut self, ident: ast::Ident) -> io::Result<()> { if ident.is_raw_guess() { - self.s.word(&format!("r#{}", ident.name))?; + self.s.word(format!("r#{}", ident.name))?; } else { - self.s.word(&ident.as_str())?; + self.s.word(ident.as_str().get())?; } self.ann.post(self, AnnNode::Name(&ident.name)) } @@ -1620,8 +1611,7 @@ impl<'a> State<'a> { if i > 0 { self.s.word("::")? } - if segment.ident.name != keywords::CrateRoot.name() && - segment.ident.name != keywords::DollarCrate.name() { + if segment.ident.name != keywords::PathRoot.name() { self.print_ident(segment.ident)?; segment.with_generic_args(|generic_args| { self.print_generic_args(generic_args, segment.infer_types, @@ -1634,8 +1624,7 @@ impl<'a> State<'a> { } pub fn print_path_segment(&mut self, segment: &hir::PathSegment) -> io::Result<()> { - if segment.ident.name != keywords::CrateRoot.name() && - segment.ident.name != keywords::DollarCrate.name() { + if segment.ident.name != keywords::PathRoot.name() { self.print_ident(segment.ident)?; segment.with_generic_args(|generic_args| { self.print_generic_args(generic_args, segment.infer_types, false) @@ -1662,8 +1651,7 @@ impl<'a> State<'a> { if i > 0 { self.s.word("::")? } - if segment.ident.name != keywords::CrateRoot.name() && - segment.ident.name != keywords::DollarCrate.name() { + if segment.ident.name != keywords::PathRoot.name() { self.print_ident(segment.ident)?; segment.with_generic_args(|generic_args| { self.print_generic_args(generic_args, @@ -2010,7 +1998,7 @@ impl<'a> State<'a> { self.commasep(Inconsistent, &decl.inputs, |s, ty| { s.ibox(indent_unit)?; if let Some(arg_name) = arg_names.get(i) { - s.s.word(&arg_name.as_str())?; + s.s.word(arg_name.as_str().get())?; s.s.word(":")?; s.s.space()?; } else if let Some(body_id) = body_id { @@ -2073,7 +2061,8 @@ impl<'a> State<'a> { } } - pub fn print_bounds(&mut self, prefix: &str, bounds: &[hir::GenericBound]) -> io::Result<()> { + pub fn print_bounds(&mut self, prefix: &'static str, bounds: &[hir::GenericBound]) + -> io::Result<()> { if !bounds.is_empty() { self.s.word(prefix)?; let mut first = true; @@ -2322,7 +2311,7 @@ impl<'a> State<'a> { Some(Abi::Rust) => Ok(()), Some(abi) => { self.word_nbsp("extern")?; - self.word_nbsp(&abi.to_string()) + self.word_nbsp(abi.to_string()) } None => Ok(()), } @@ -2332,7 +2321,7 @@ impl<'a> State<'a> { match opt_abi { Some(abi) => { self.word_nbsp("extern")?; - self.word_nbsp(&abi.to_string()) + self.word_nbsp(abi.to_string()) } None => Ok(()), } @@ -2342,7 +2331,7 @@ impl<'a> State<'a> { header: hir::FnHeader, vis: &hir::Visibility) -> io::Result<()> { - self.s.word(&visibility_qualified(vis, ""))?; + self.s.word(visibility_qualified(vis, ""))?; match header.constness { hir::Constness::NotConst => {} @@ -2358,7 +2347,7 @@ impl<'a> State<'a> { if header.abi != Abi::Rust { self.word_nbsp("extern")?; - self.word_nbsp(&header.abi.to_string())?; + self.word_nbsp(header.abi.to_string())?; } self.s.word("fn") @@ -2403,18 +2392,10 @@ fn expr_requires_semi_to_be_stmt(e: &hir::Expr) -> bool { /// seen the semicolon, and thus don't need another. fn stmt_ends_with_semi(stmt: &hir::StmtKind) -> bool { match *stmt { - hir::StmtKind::Decl(ref d, _) => { - match d.node { - hir::DeclKind::Local(_) => true, - hir::DeclKind::Item(_) => false, - } - } - hir::StmtKind::Expr(ref e, _) => { - expr_requires_semi_to_be_stmt(&e) - } - hir::StmtKind::Semi(..) => { - false - } + hir::StmtKind::Local(_) => true, + hir::StmtKind::Item(_) => false, + hir::StmtKind::Expr(ref e) => expr_requires_semi_to_be_stmt(&e), + hir::StmtKind::Semi(..) => false, } } @@ -2445,8 +2426,8 @@ fn bin_op_to_assoc_op(op: hir::BinOpKind) -> AssocOp { } } -/// Expressions that syntactically contain an "exterior" struct literal i.e. not surrounded by any -/// parens or other delimiters, e.g. `X { y: 1 }`, `X { y: 1 }.method()`, `foo == X { y: 1 }` and +/// Expressions that syntactically contain an "exterior" struct literal i.e., not surrounded by any +/// parens or other delimiters, e.g., `X { y: 1 }`, `X { y: 1 }.method()`, `foo == X { y: 1 }` and /// `X { y: 1 } == foo` all do, but `(X { y: 1 }) == foo` does not. fn contains_exterior_struct_lit(value: &hir::Expr) -> bool { match value.node { diff --git a/src/librustc/ich/caching_source_map_view.rs b/src/librustc/ich/caching_source_map_view.rs index fbf4297222f..bfe2ca6dd09 100644 --- a/src/librustc/ich/caching_source_map_view.rs +++ b/src/librustc/ich/caching_source_map_view.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::sync::Lrc; use syntax::source_map::SourceMap; use syntax_pos::{BytePos, SourceFile}; diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index 7c623a1874e..d5c9d9ff16d 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir; use hir::def_id::{DefId, DefIndex}; use hir::map::DefPathHash; @@ -45,7 +35,7 @@ fn compute_ignored_attr_names() -> FxHashSet { /// This is the context state available during incr. comp. hashing. It contains /// enough information to transform DefIds and HirIds into stable DefPaths (i.e. /// a reference to the TyCtxt) and it holds a few caches for speeding up various -/// things (e.g. each DefId/DefPath is only hashed once). +/// things (e.g., each DefId/DefPath is only hashed once). #[derive(Clone)] pub struct StableHashingContext<'a> { sess: &'a Session, @@ -86,6 +76,7 @@ impl<'a> StableHashingContext<'a> { // The `krate` here is only used for mapping BodyIds to Bodies. // Don't use it for anything else or you'll run the risk of // leaking data out of the tracking system. + #[inline] pub fn new(sess: &'a Session, krate: &'a hir::Crate, definitions: &'a Definitions, diff --git a/src/librustc/ich/impls_cstore.rs b/src/librustc/ich/impls_cstore.rs index f8cd3b8a18a..fdea62a1dd8 100644 --- a/src/librustc/ich/impls_cstore.rs +++ b/src/librustc/ich/impls_cstore.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains `HashStable` implementations for various data types //! from rustc::middle::cstore in no particular order. diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index ae0d78d2958..9022cabe779 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains `HashStable` implementations for various HIR data //! types in no particular order. @@ -163,7 +153,7 @@ impl_stable_hash_for!(enum hir::LifetimeName { Error, }); -impl_stable_hash_for!(struct hir::Label { +impl_stable_hash_for!(struct ast::Label { ident }); @@ -420,7 +410,6 @@ impl_stable_hash_for!(struct hir::Block { rules, span, targeted_by_break, - recovered, }); impl_stable_hash_for!(struct hir::Pat { @@ -494,7 +483,12 @@ impl_stable_hash_for!(enum hir::UnOp { UnNeg }); -impl_stable_hash_for_spanned!(hir::StmtKind); +impl_stable_hash_for!(struct hir::Stmt { + id, + node, + span, +}); + impl_stable_hash_for!(struct hir::Local { pat, @@ -507,12 +501,6 @@ impl_stable_hash_for!(struct hir::Local { source }); -impl_stable_hash_for_spanned!(hir::DeclKind); -impl_stable_hash_for!(enum hir::DeclKind { - Local(local), - Item(item_id) -}); - impl_stable_hash_for!(struct hir::Arm { attrs, pats, @@ -602,7 +590,8 @@ impl_stable_hash_for!(enum hir::ExprKind { InlineAsm(asm, inputs, outputs), Struct(path, fields, base), Repeat(val, times), - Yield(val) + Yield(val), + Err }); impl_stable_hash_for!(enum hir::LocalSource { @@ -828,7 +817,7 @@ impl_stable_hash_for!(struct hir::EnumDef { }); impl_stable_hash_for!(struct hir::VariantKind { - name, + ident -> (ident.name), attrs, data, disr_expr @@ -862,7 +851,7 @@ impl<'a> HashStable> for hir::Item { hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { let hir::Item { - name, + ident, ref attrs, id: _, hir_id: _, @@ -872,7 +861,7 @@ impl<'a> HashStable> for hir::Item { } = *self; hcx.hash_hir_item_like(|hcx| { - name.hash_stable(hcx, hasher); + ident.name.hash_stable(hcx, hasher); attrs.hash_stable(hcx, hasher); node.hash_stable(hcx, hasher); vis.hash_stable(hcx, hasher); @@ -936,7 +925,7 @@ impl<'a> HashStable> for hir::AssociatedItemKind { } impl_stable_hash_for!(struct hir::ForeignItem { - name, + ident -> (ident.name), attrs, node, id, @@ -951,9 +940,10 @@ impl_stable_hash_for!(enum hir::ForeignItemKind { }); impl_stable_hash_for!(enum hir::StmtKind { - Decl(decl, id), - Expr(expr, id), - Semi(expr, id) + Local(local), + Item(item_id), + Expr(expr), + Semi(expr) }); impl_stable_hash_for!(struct hir::Arg { @@ -1169,6 +1159,7 @@ impl<'a> ToStableHashKey> for hir::TraitCandidate { impl_stable_hash_for!(struct hir::CodegenFnAttrs { flags, inline, + optimize, export_name, link_name, target_features, @@ -1193,6 +1184,14 @@ impl<'hir> HashStable> for attr::InlineAttr { } } +impl<'hir> HashStable> for attr::OptimizeAttr { + fn hash_stable(&self, + hcx: &mut StableHashingContext<'hir>, + hasher: &mut StableHasher) { + mem::discriminant(self).hash_stable(hcx, hasher); + } +} + impl_stable_hash_for!(struct hir::Freevar { def, span diff --git a/src/librustc/ich/impls_mir.rs b/src/librustc/ich/impls_mir.rs index d6ad74f16a9..002ac7cc7a9 100644 --- a/src/librustc/ich/impls_mir.rs +++ b/src/librustc/ich/impls_mir.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains `HashStable` implementations for various MIR data //! types in no particular order. @@ -46,7 +36,7 @@ impl_stable_hash_for!(enum mir::BorrowKind { impl_stable_hash_for!(enum mir::UnsafetyViolationKind { General, - MinConstFn, + GeneralAndConstFn, ExternStatic(lint_node_id), BorrowPacked(lint_node_id), }); @@ -193,55 +183,19 @@ for mir::TerminatorKind<'gcx> { impl_stable_hash_for!(struct mir::Statement<'tcx> { source_info, kind }); -impl<'a, 'gcx> HashStable> -for mir::StatementKind<'gcx> { - fn hash_stable(&self, - hcx: &mut StableHashingContext<'a>, - hasher: &mut StableHasher) { - mem::discriminant(self).hash_stable(hcx, hasher); - - match *self { - mir::StatementKind::Assign(ref place, ref rvalue) => { - place.hash_stable(hcx, hasher); - rvalue.hash_stable(hcx, hasher); - } - mir::StatementKind::FakeRead(ref cause, ref place) => { - cause.hash_stable(hcx, hasher); - place.hash_stable(hcx, hasher); - } - mir::StatementKind::SetDiscriminant { ref place, variant_index } => { - place.hash_stable(hcx, hasher); - variant_index.hash_stable(hcx, hasher); - } - mir::StatementKind::StorageLive(ref place) | - mir::StatementKind::StorageDead(ref place) => { - place.hash_stable(hcx, hasher); - } - mir::StatementKind::EndRegion(ref region_scope) => { - region_scope.hash_stable(hcx, hasher); - } - mir::StatementKind::EscapeToRaw(ref place) => { - place.hash_stable(hcx, hasher); - } - mir::StatementKind::Retag { fn_entry, ref place } => { - fn_entry.hash_stable(hcx, hasher); - place.hash_stable(hcx, hasher); - } - mir::StatementKind::AscribeUserType(ref place, ref variance, ref c_ty) => { - place.hash_stable(hcx, hasher); - variance.hash_stable(hcx, hasher); - c_ty.hash_stable(hcx, hasher); - } - mir::StatementKind::Nop => {} - mir::StatementKind::InlineAsm { ref asm, ref outputs, ref inputs } => { - asm.hash_stable(hcx, hasher); - outputs.hash_stable(hcx, hasher); - inputs.hash_stable(hcx, hasher); - } - } - } -} +impl_stable_hash_for!(impl<'gcx> for enum mir::StatementKind<'gcx> [ mir::StatementKind ] { + Assign(place, rvalue), + FakeRead(cause, place), + SetDiscriminant { place, variant_index }, + StorageLive(place), + StorageDead(place), + Retag(retag_kind, place), + AscribeUserType(place, variance, c_ty), + Nop, + InlineAsm { asm, outputs, inputs }, +}); +impl_stable_hash_for!(enum mir::RetagKind { FnEntry, TwoPhase, Raw, Default }); impl_stable_hash_for!(enum mir::FakeReadCause { ForMatchGuard, ForMatchedPlace, ForLet }); impl<'a, 'gcx> HashStable> for mir::Place<'gcx> { @@ -506,6 +460,7 @@ impl_stable_hash_for!(struct mir::ClosureOutlivesRequirement<'tcx> { impl_stable_hash_for!(enum mir::ConstraintCategory { Return, + Yield, UseAsConst, UseAsStatic, TypeAnnotation, @@ -539,22 +494,5 @@ impl<'a, 'gcx> HashStable> for mir::ClosureOutlivesSubj impl_stable_hash_for!(struct mir::interpret::GlobalId<'tcx> { instance, promoted }); -impl<'a, 'gcx> HashStable> for mir::UserTypeAnnotation<'gcx> { - fn hash_stable(&self, - hcx: &mut StableHashingContext<'a>, - hasher: &mut StableHasher) { - mem::discriminant(self).hash_stable(hcx, hasher); - match *self { - mir::UserTypeAnnotation::Ty(ref ty) => { - ty.hash_stable(hcx, hasher); - } - mir::UserTypeAnnotation::TypeOf(ref def_id, ref substs) => { - def_id.hash_stable(hcx, hasher); - substs.hash_stable(hcx, hasher); - } - } - } -} - impl_stable_hash_for!(struct mir::UserTypeProjection<'tcx> { base, projs }); impl_stable_hash_for!(struct mir::UserTypeProjections<'tcx> { contents }); diff --git a/src/librustc/ich/impls_misc.rs b/src/librustc/ich/impls_misc.rs index db404179175..f79adc8109a 100644 --- a/src/librustc/ich/impls_misc.rs +++ b/src/librustc/ich/impls_misc.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains `HashStable` implementations for various data types //! that don't fit into any of the other impls_xxx modules. diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs index 4be467c01aa..e10359636f7 100644 --- a/src/librustc/ich/impls_syntax.rs +++ b/src/librustc/ich/impls_syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains `HashStable` implementations for various data types //! from libsyntax in no particular order. @@ -134,14 +124,10 @@ impl_stable_hash_for!(struct ::syntax::attr::Stability { const_stability }); -impl<'a> HashStable> -for ::syntax::edition::Edition { - fn hash_stable(&self, - hcx: &mut StableHashingContext<'a>, - hasher: &mut StableHasher) { - mem::discriminant(self).hash_stable(hcx, hasher); - } -} +impl_stable_hash_for!(enum ::syntax::edition::Edition { + Edition2015, + Edition2018, +}); impl<'a> HashStable> for ::syntax::attr::StabilityLevel { @@ -161,7 +147,7 @@ for ::syntax::attr::StabilityLevel { } } -impl_stable_hash_for!(struct ::syntax::attr::RustcDeprecation { since, reason }); +impl_stable_hash_for!(struct ::syntax::attr::RustcDeprecation { since, reason, suggestion }); impl_stable_hash_for!(enum ::syntax::attr::IntType { @@ -178,6 +164,7 @@ impl_stable_hash_for!(enum ::syntax::ast::LitIntType { impl_stable_hash_for_spanned!(::syntax::ast::LitKind); impl_stable_hash_for!(enum ::syntax::ast::LitKind { Str(value, style), + Err(value), ByteStr(value), Byte(value), Char(value), @@ -269,10 +256,10 @@ for tokenstream::TokenTree { span.hash_stable(hcx, hasher); hash_token(token, hcx, hasher); } - tokenstream::TokenTree::Delimited(span, ref delimited) => { + tokenstream::TokenTree::Delimited(span, delim, ref tts) => { span.hash_stable(hcx, hasher); - std_hash::Hash::hash(&delimited.delim, hasher); - for sub_tt in delimited.stream().trees() { + std_hash::Hash::hash(&delim, hasher); + for sub_tt in tts.trees() { sub_tt.hash_stable(hcx, hasher); } } @@ -314,7 +301,6 @@ fn hash_token<'a, 'gcx, W: StableHasherResult>( token::Token::DotDot | token::Token::DotDotDot | token::Token::DotDotEq | - token::Token::DotEq | token::Token::Comma | token::Token::Semi | token::Token::Colon | @@ -344,6 +330,7 @@ fn hash_token<'a, 'gcx, W: StableHasherResult>( match *lit { token::Lit::Byte(val) | token::Lit::Char(val) | + token::Lit::Err(val) | token::Lit::Integer(val) | token::Lit::Float(val) | token::Lit::Str_(val) | @@ -418,13 +405,14 @@ impl_stable_hash_for!(enum ::syntax_pos::hygiene::CompilerDesugaringKind { impl_stable_hash_for!(enum ::syntax_pos::FileName { Real(pb), Macros(s), - QuoteExpansion, - Anon, - MacroExpansion, - ProcMacroSourceCode, - CliCrateAttr, - CfgSpec, - Custom(s) + QuoteExpansion(s), + Anon(s), + MacroExpansion(s), + ProcMacroSourceCode(s), + CliCrateAttr(s), + CfgSpec(s), + Custom(s), + DocTest(pb, line), }); impl<'a> HashStable> for SourceFile { diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 679107160a6..bd2349161f7 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains `HashStable` implementations for various data types //! from rustc::ty in no particular order. @@ -311,9 +301,8 @@ impl_stable_hash_for!(struct ty::FieldDef { impl_stable_hash_for!( impl<'tcx> for enum mir::interpret::ConstValue<'tcx> [ mir::interpret::ConstValue ] { - Unevaluated(def_id, substs), Scalar(val), - ScalarPair(a, b), + Slice(a, b), ByRef(id, alloc, offset), } ); @@ -338,7 +327,7 @@ impl_stable_hash_for!( ); impl_stable_hash_for!( - impl<'tcx, M> for enum mir::interpret::AllocType<'tcx, M> [ mir::interpret::AllocType ] { + impl<'tcx> for enum mir::interpret::AllocKind<'tcx> [ mir::interpret::AllocKind ] { Function(instance), Static(def_id), Memory(mem), @@ -388,6 +377,11 @@ impl_stable_hash_for!(struct ty::Const<'tcx> { val }); +impl_stable_hash_for!(impl<'tcx> for enum ty::LazyConst<'tcx> [ty::LazyConst] { + Unevaluated(did, substs), + Evaluated(c) +}); + impl_stable_hash_for!(enum mir::interpret::ErrorHandled { Reported, TooGeneric @@ -429,6 +423,7 @@ impl_stable_hash_for!( CalledClosureAsFunction, VtableForArgumentlessMethod, ModifiedConstantMemory, + ModifiedStatic, AssumptionNotHeld, InlineAsm, ReallocateNonBasePtr, @@ -482,22 +477,6 @@ impl_stable_hash_for!(enum mir::interpret::InboundsCheck { MaybeDead }); -impl_stable_hash_for!(enum mir::interpret::Lock { - NoLock, - WriteLock(dl), - ReadLock(v) -}); - -impl_stable_hash_for!(struct mir::interpret::DynamicLifetime { - frame, - region -}); - -impl_stable_hash_for!(enum mir::interpret::AccessKind { - Read, - Write -}); - impl_stable_hash_for!(enum ty::Variance { Covariant, Invariant, @@ -684,9 +663,13 @@ for ty::TyKind<'gcx> Param(param_ty) => { param_ty.hash_stable(hcx, hasher); } - Bound(bound_ty) => { + Bound(debruijn, bound_ty) => { + debruijn.hash_stable(hcx, hasher); bound_ty.hash_stable(hcx, hasher); } + ty::Placeholder(placeholder_ty) => { + placeholder_ty.hash_stable(hcx, hasher); + } Foreign(def_id) => { def_id.hash_stable(hcx, hasher); } @@ -890,7 +873,8 @@ for ty::steal::Steal impl_stable_hash_for!(struct ty::ParamEnv<'tcx> { caller_bounds, - reveal + reveal, + def_id }); impl_stable_hash_for!(enum traits::Reveal { @@ -1096,12 +1080,13 @@ impl_stable_hash_for!(struct infer::canonical::CanonicalVarInfo { impl_stable_hash_for!(enum infer::canonical::CanonicalVarKind { Ty(k), + PlaceholderTy(placeholder), Region(ui), PlaceholderRegion(placeholder), }); impl_stable_hash_for!(enum infer::canonical::CanonicalTyVarKind { - General, + General(ui), Int, Float }); @@ -1198,6 +1183,10 @@ impl<'a, 'tcx> HashStable> for traits::Goal<'tcx> { quantifier.hash_stable(hcx, hasher); goal.hash_stable(hcx, hasher); }, + Subtype(a, b) => { + a.hash_stable(hcx, hasher); + b.hash_stable(hcx, hasher); + } CannotProve => { }, } } @@ -1243,3 +1232,42 @@ impl_stable_hash_for!( clauses, } ); + +impl_stable_hash_for!( + impl<'tcx, G> for struct traits::InEnvironment<'tcx, G> { + environment, + goal, + } +); + +impl_stable_hash_for!( + struct ty::CanonicalUserTypeAnnotation<'tcx> { + user_ty, span, inferred_ty + } +); + +impl<'a, 'gcx> HashStable> for ty::UserType<'gcx> { + fn hash_stable(&self, + hcx: &mut StableHashingContext<'a>, + hasher: &mut StableHasher) { + mem::discriminant(self).hash_stable(hcx, hasher); + match *self { + ty::UserType::Ty(ref ty) => { + ty.hash_stable(hcx, hasher); + } + ty::UserType::TypeOf(ref def_id, ref substs) => { + def_id.hash_stable(hcx, hasher); + substs.hash_stable(hcx, hasher); + } + } + } +} + +impl<'a> HashStable> for ty::UserTypeAnnotationIndex { + #[inline] + fn hash_stable(&self, + hcx: &mut StableHashingContext<'a>, + hasher: &mut StableHasher) { + self.index().hash_stable(hcx, hasher); + } +} diff --git a/src/librustc/ich/mod.rs b/src/librustc/ich/mod.rs index 9751c560acd..a3a4c541780 100644 --- a/src/librustc/ich/mod.rs +++ b/src/librustc/ich/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! ICH - Incremental Compilation Hash crate use rustc_data_structures::fingerprint::Fingerprint; @@ -24,15 +14,15 @@ mod impls_misc; mod impls_ty; mod impls_syntax; -pub const ATTR_DIRTY: &'static str = "rustc_dirty"; -pub const ATTR_CLEAN: &'static str = "rustc_clean"; -pub const ATTR_IF_THIS_CHANGED: &'static str = "rustc_if_this_changed"; -pub const ATTR_THEN_THIS_WOULD_NEED: &'static str = "rustc_then_this_would_need"; -pub const ATTR_PARTITION_REUSED: &'static str = "rustc_partition_reused"; -pub const ATTR_PARTITION_CODEGENED: &'static str = "rustc_partition_codegened"; -pub const ATTR_EXPECTED_CGU_REUSE: &'static str = "rustc_expected_cgu_reuse"; +pub const ATTR_DIRTY: &str = "rustc_dirty"; +pub const ATTR_CLEAN: &str = "rustc_clean"; +pub const ATTR_IF_THIS_CHANGED: &str = "rustc_if_this_changed"; +pub const ATTR_THEN_THIS_WOULD_NEED: &str = "rustc_then_this_would_need"; +pub const ATTR_PARTITION_REUSED: &str = "rustc_partition_reused"; +pub const ATTR_PARTITION_CODEGENED: &str = "rustc_partition_codegened"; +pub const ATTR_EXPECTED_CGU_REUSE: &str = "rustc_expected_cgu_reuse"; -pub const IGNORED_ATTRIBUTES: &'static [&'static str] = &[ +pub const IGNORED_ATTRIBUTES: &[&str] = &[ "cfg", ATTR_IF_THIS_CHANGED, ATTR_THEN_THIS_WOULD_NEED, diff --git a/src/librustc/infer/at.rs b/src/librustc/infer/at.rs index 0e4c94aaaf3..328d518ca66 100644 --- a/src/librustc/infer/at.rs +++ b/src/librustc/infer/at.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A nice interface for working with the infcx. The basic idea is to //! do `infcx.at(cause, param_env)`, which sets the "cause" of the //! operation as well as the surrounding parameter environment. Then @@ -52,6 +42,7 @@ pub struct Trace<'a, 'gcx: 'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { + #[inline] pub fn at(&'a self, cause: &'a ObligationCause<'tcx>, param_env: ty::ParamEnv<'tcx>) diff --git a/src/librustc/infer/canonical/canonicalizer.rs b/src/librustc/infer/canonical/canonicalizer.rs index a787eeae663..408cba42ae0 100644 --- a/src/librustc/infer/canonical/canonicalizer.rs +++ b/src/librustc/infer/canonical/canonicalizer.rs @@ -1,19 +1,9 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains the "canonicalizer" itself. //! //! For an overview of what canonicalization is and how it fits into //! rustc, check out the [chapter in the rustc guide][c]. //! -//! [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html +//! [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html use infer::canonical::{ Canonical, CanonicalTyVarKind, CanonicalVarInfo, CanonicalVarKind, Canonicalized, @@ -23,7 +13,7 @@ use infer::InferCtxt; use std::sync::atomic::Ordering; use ty::fold::{TypeFoldable, TypeFolder}; use ty::subst::Kind; -use ty::{self, BoundTy, BoundVar, Lift, List, Ty, TyCtxt, TypeFlags}; +use ty::{self, BoundVar, Lift, List, Ty, TyCtxt, TypeFlags}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::indexed_vec::Idx; @@ -44,7 +34,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { /// To get a good understanding of what is happening here, check /// out the [chapter in the rustc guide][c]. /// - /// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query + /// [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query pub fn canonicalize_query( &self, value: &V, @@ -92,7 +82,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { /// To get a good understanding of what is happening here, check /// out the [chapter in the rustc guide][c]. /// - /// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query-result + /// [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html#canonicalizing-the-query-result pub fn canonicalize_response(&self, value: &V) -> Canonicalized<'gcx, V> where V: TypeFoldable<'tcx> + Lift<'gcx>, @@ -339,11 +329,45 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx> fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> { match t.sty { - ty::Infer(ty::TyVar(_)) => self.canonicalize_ty_var(CanonicalTyVarKind::General, t), + ty::Infer(ty::TyVar(vid)) => { + debug!("canonical: type var found with vid {:?}", vid); + match self.infcx.unwrap().probe_ty_var(vid) { + // `t` could be a float / int variable: canonicalize that instead + Ok(t) => { + debug!("(resolved to {:?})", t); + self.fold_ty(t) + } + + // `TyVar(vid)` is unresolved, track its universe index in the canonicalized + // result + Err(mut ui) => { + if !self.infcx.unwrap().tcx.sess.opts.debugging_opts.chalk { + // FIXME: perf problem described in #55921. + ui = ty::UniverseIndex::ROOT; + } + self.canonicalize_ty_var( + CanonicalVarInfo { + kind: CanonicalVarKind::Ty(CanonicalTyVarKind::General(ui)) + }, + t + ) + } + } + } - ty::Infer(ty::IntVar(_)) => self.canonicalize_ty_var(CanonicalTyVarKind::Int, t), + ty::Infer(ty::IntVar(_)) => self.canonicalize_ty_var( + CanonicalVarInfo { + kind: CanonicalVarKind::Ty(CanonicalTyVarKind::Int) + }, + t + ), - ty::Infer(ty::FloatVar(_)) => self.canonicalize_ty_var(CanonicalTyVarKind::Float, t), + ty::Infer(ty::FloatVar(_)) => self.canonicalize_ty_var( + CanonicalVarInfo { + kind: CanonicalVarKind::Ty(CanonicalTyVarKind::Float) + }, + t + ), ty::Infer(ty::FreshTy(_)) | ty::Infer(ty::FreshIntTy(_)) @@ -351,8 +375,15 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx> bug!("encountered a fresh type during canonicalization") } - ty::Bound(bound_ty) => { - if bound_ty.index >= self.binder_index { + ty::Placeholder(placeholder) => self.canonicalize_ty_var( + CanonicalVarInfo { + kind: CanonicalVarKind::PlaceholderTy(placeholder) + }, + t + ), + + ty::Bound(debruijn, _) => { + if debruijn >= self.binder_index { bug!("escaping bound type during canonicalization") } else { t @@ -408,16 +439,25 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> { V: TypeFoldable<'tcx> + Lift<'gcx>, { let needs_canonical_flags = if canonicalize_region_mode.any() { - TypeFlags::HAS_FREE_REGIONS | TypeFlags::KEEP_IN_LOCAL_TCX + TypeFlags::KEEP_IN_LOCAL_TCX | + TypeFlags::HAS_FREE_REGIONS | // `HAS_RE_PLACEHOLDER` implies `HAS_FREE_REGIONS` + TypeFlags::HAS_TY_PLACEHOLDER } else { - TypeFlags::KEEP_IN_LOCAL_TCX + TypeFlags::KEEP_IN_LOCAL_TCX | + TypeFlags::HAS_RE_PLACEHOLDER | + TypeFlags::HAS_TY_PLACEHOLDER }; let gcx = tcx.global_tcx(); // Fast path: nothing that needs to be canonicalized. if !value.has_type_flags(needs_canonical_flags) { - let out_value = gcx.lift(value).unwrap(); + let out_value = gcx.lift(value).unwrap_or_else(|| { + bug!( + "failed to lift `{:?}` (nothing to canonicalize)", + value + ) + }); let canon_value = Canonical { max_universe: ty::UniverseIndex::ROOT, variables: List::empty(), @@ -574,17 +614,14 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> { /// if `ty_var` is bound to anything; if so, canonicalize /// *that*. Otherwise, create a new canonical variable for /// `ty_var`. - fn canonicalize_ty_var(&mut self, ty_kind: CanonicalTyVarKind, ty_var: Ty<'tcx>) -> Ty<'tcx> { + fn canonicalize_ty_var(&mut self, info: CanonicalVarInfo, ty_var: Ty<'tcx>) -> Ty<'tcx> { let infcx = self.infcx.expect("encountered ty-var without infcx"); let bound_to = infcx.shallow_resolve(ty_var); if bound_to != ty_var { self.fold_ty(bound_to) } else { - let info = CanonicalVarInfo { - kind: CanonicalVarKind::Ty(ty_kind), - }; let var = self.canonical_var(info, ty_var.into()); - self.tcx().mk_ty(ty::Bound(BoundTy::new(self.binder_index, var))) + self.tcx().mk_ty(ty::Bound(self.binder_index, var.into())) } } } diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs index f7eb7118f41..eaf72f5a687 100644 --- a/src/librustc/infer/canonical/mod.rs +++ b/src/librustc/infer/canonical/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! **Canonicalization** is the key to constructing a query in the //! middle of type inference. Ordinarily, it is not possible to store //! types from type inference in query keys, because they contain @@ -29,7 +19,7 @@ //! For a more detailed look at what is happening here, check //! out the [chapter in the rustc guide][c]. //! -//! [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html +//! [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html use infer::{InferCtxt, RegionVariableOrigin, TypeVariableOrigin}; use rustc_data_structures::indexed_vec::IndexVec; @@ -122,6 +112,7 @@ impl CanonicalVarInfo { pub fn is_existential(&self) -> bool { match self.kind { CanonicalVarKind::Ty(_) => true, + CanonicalVarKind::PlaceholderTy(_) => false, CanonicalVarKind::Region(_) => true, CanonicalVarKind::PlaceholderRegion(..) => false, } @@ -136,24 +127,27 @@ pub enum CanonicalVarKind { /// Some kind of type inference variable. Ty(CanonicalTyVarKind), + /// A "placeholder" that represents "any type". + PlaceholderTy(ty::PlaceholderType), + /// Region variable `'?R`. Region(ty::UniverseIndex), /// A "placeholder" that represents "any region". Created when you /// are solving a goal like `for<'a> T: Foo<'a>` to represent the /// bound region `'a`. - PlaceholderRegion(ty::Placeholder), + PlaceholderRegion(ty::PlaceholderRegion), } impl CanonicalVarKind { pub fn universe(self) -> ty::UniverseIndex { match self { - // At present, we don't support higher-ranked - // quantification over types, so all type variables are in - // the root universe. - CanonicalVarKind::Ty(_) => ty::UniverseIndex::ROOT, + CanonicalVarKind::Ty(kind) => match kind { + CanonicalTyVarKind::General(ui) => ui, + CanonicalTyVarKind::Float | CanonicalTyVarKind::Int => ty::UniverseIndex::ROOT, + } - // Region variables can be created in sub-universes. + CanonicalVarKind::PlaceholderTy(placeholder) => placeholder.universe, CanonicalVarKind::Region(ui) => ui, CanonicalVarKind::PlaceholderRegion(placeholder) => placeholder.universe, } @@ -168,7 +162,7 @@ impl CanonicalVarKind { #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcDecodable, RustcEncodable)] pub enum CanonicalTyVarKind { /// General type variable `?T` that can be unified with arbitrary types. - General, + General(ty::UniverseIndex), /// Integral type variable `?I` (that can only be unified with integral types). Int, @@ -358,8 +352,11 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { match cv_info.kind { CanonicalVarKind::Ty(ty_kind) => { let ty = match ty_kind { - CanonicalTyVarKind::General => { - self.next_ty_var(TypeVariableOrigin::MiscVariable(span)) + CanonicalTyVarKind::General(ui) => { + self.next_ty_var_in_universe( + TypeVariableOrigin::MiscVariable(span), + universe_map(ui) + ) } CanonicalTyVarKind::Int => self.tcx.mk_int_var(self.next_int_var_id()), @@ -369,20 +366,27 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { ty.into() } + CanonicalVarKind::PlaceholderTy(ty::PlaceholderType { universe, name }) => { + let universe_mapped = universe_map(universe); + let placeholder_mapped = ty::PlaceholderType { + universe: universe_mapped, + name, + }; + self.tcx.mk_ty(ty::Placeholder(placeholder_mapped)).into() + } + CanonicalVarKind::Region(ui) => self.next_region_var_in_universe( RegionVariableOrigin::MiscVariable(span), universe_map(ui), ).into(), - CanonicalVarKind::PlaceholderRegion(ty::Placeholder { universe, name }) => { + CanonicalVarKind::PlaceholderRegion(ty::PlaceholderRegion { universe, name }) => { let universe_mapped = universe_map(universe); - let placeholder_mapped = ty::Placeholder { + let placeholder_mapped = ty::PlaceholderRegion { universe: universe_mapped, name, }; - self.tcx - .mk_region(ty::RePlaceholder(placeholder_mapped)) - .into() + self.tcx.mk_region(ty::RePlaceholder(placeholder_mapped)).into() } } } @@ -416,9 +420,33 @@ BraceStructLiftImpl! { } impl<'tcx> CanonicalVarValues<'tcx> { - fn len(&self) -> usize { + pub fn len(&self) -> usize { self.var_values.len() } + + /// Make an identity substitution from this one: each bound var + /// is matched to the same bound var, preserving the original kinds. + /// For example, if we have: + /// `self.var_values == [Type(u32), Lifetime('a), Type(u64)]` + /// we'll return a substitution `subst` with: + /// `subst.var_values == [Type(^0), Lifetime(^1), Type(^2)]`. + pub fn make_identity<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self { + use ty::subst::UnpackedKind; + + CanonicalVarValues { + var_values: self.var_values.iter() + .zip(0..) + .map(|(kind, i)| match kind.unpack() { + UnpackedKind::Type(..) => tcx.mk_ty( + ty::Bound(ty::INNERMOST, ty::BoundVar::from_u32(i).into()) + ).into(), + UnpackedKind::Lifetime(..) => tcx.mk_region( + ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(i)) + ).into(), + }) + .collect() + } + } } impl<'a, 'tcx> IntoIterator for &'a CanonicalVarValues<'tcx> { diff --git a/src/librustc/infer/canonical/query_response.rs b/src/librustc/infer/canonical/query_response.rs index 6f3d1026835..7f113f07276 100644 --- a/src/librustc/infer/canonical/query_response.rs +++ b/src/librustc/infer/canonical/query_response.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains the code to instantiate a "query result", and //! in particular to extract out the resulting region obligations and //! encode them therein. @@ -15,7 +5,7 @@ //! For an overview of what canonicaliation is and how it fits into //! rustc, check out the [chapter in the rustc guide][c]. //! -//! [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html +//! [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html use infer::canonical::substitute::substitute_value; use infer::canonical::{ @@ -31,11 +21,12 @@ use rustc_data_structures::sync::Lrc; use std::fmt::Debug; use syntax_pos::DUMMY_SP; use traits::query::{Fallible, NoSolution}; -use traits::{FulfillmentContext, TraitEngine}; +use traits::TraitEngine; use traits::{Obligation, ObligationCause, PredicateObligation}; use ty::fold::TypeFoldable; use ty::subst::{Kind, UnpackedKind}; use ty::{self, BoundVar, Lift, Ty, TyCtxt}; +use util::captures::Captures; impl<'cx, 'gcx, 'tcx> InferCtxtBuilder<'cx, 'gcx, 'tcx> { /// The "main method" for a canonicalized trait query. Given the @@ -57,7 +48,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxtBuilder<'cx, 'gcx, 'tcx> { pub fn enter_canonical_trait_query( &'tcx mut self, canonical_key: &Canonical<'tcx, K>, - operation: impl FnOnce(&InferCtxt<'_, 'gcx, 'tcx>, &mut FulfillmentContext<'tcx>, K) + operation: impl FnOnce(&InferCtxt<'_, 'gcx, 'tcx>, &mut dyn TraitEngine<'tcx>, K) -> Fallible, ) -> Fallible> where @@ -68,9 +59,13 @@ impl<'cx, 'gcx, 'tcx> InferCtxtBuilder<'cx, 'gcx, 'tcx> { DUMMY_SP, canonical_key, |ref infcx, key, canonical_inference_vars| { - let fulfill_cx = &mut FulfillmentContext::new(); - let value = operation(infcx, fulfill_cx, key)?; - infcx.make_canonicalized_query_response(canonical_inference_vars, value, fulfill_cx) + let mut fulfill_cx = TraitEngine::new(infcx.tcx); + let value = operation(infcx, &mut *fulfill_cx, key)?; + infcx.make_canonicalized_query_response( + canonical_inference_vars, + value, + &mut *fulfill_cx + ) }, ) } @@ -100,7 +95,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { &self, inference_vars: CanonicalVarValues<'tcx>, answer: T, - fulfill_cx: &mut FulfillmentContext<'tcx>, + fulfill_cx: &mut dyn TraitEngine<'tcx>, ) -> Fallible> where T: Debug + Lift<'gcx> + TypeFoldable<'tcx>, @@ -116,13 +111,38 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { Ok(Lrc::new(canonical_result)) } + /// A version of `make_canonicalized_query_response` that does + /// not pack in obligations, for contexts that want to drop + /// pending obligations instead of treating them as an ambiguity (e.g. + /// typeck "probing" contexts). + /// + /// If you DO want to keep track of pending obligations (which + /// include all region obligations, so this includes all cases + /// that care about regions) with this function, you have to + /// do it yourself, by e.g. having them be a part of the answer. + pub fn make_query_response_ignoring_pending_obligations( + &self, + inference_vars: CanonicalVarValues<'tcx>, + answer: T + ) -> Canonical<'gcx, QueryResponse<'gcx, >::Lifted>> + where + T: Debug + Lift<'gcx> + TypeFoldable<'tcx>, + { + self.canonicalize_response(&QueryResponse { + var_values: inference_vars, + region_constraints: vec![], + certainty: Certainty::Proven, // Ambiguities are OK! + value: answer, + }) + } + /// Helper for `make_canonicalized_query_response` that does /// everything up until the final canonicalization. fn make_query_response( &self, inference_vars: CanonicalVarValues<'tcx>, answer: T, - fulfill_cx: &mut FulfillmentContext<'tcx>, + fulfill_cx: &mut dyn TraitEngine<'tcx>, ) -> Result, NoSolution> where T: Debug + TypeFoldable<'tcx> + Lift<'gcx>, @@ -184,7 +204,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { /// To get a good understanding of what is happening here, check /// out the [chapter in the rustc guide][c]. /// - /// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html#processing-the-canonicalized-query-result + /// [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html#processing-the-canonicalized-query-result pub fn instantiate_query_response_and_region_obligations( &self, cause: &ObligationCause<'tcx>, @@ -435,21 +455,21 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { match result_value.unpack() { UnpackedKind::Type(result_value) => { // e.g., here `result_value` might be `?0` in the example above... - if let ty::Bound(b) = result_value.sty { + if let ty::Bound(debruijn, b) = result_value.sty { // ...in which case we would set `canonical_vars[0]` to `Some(?U)`. // We only allow a `ty::INNERMOST` index in substitutions. - assert_eq!(b.index, ty::INNERMOST); + assert_eq!(debruijn, ty::INNERMOST); opt_values[b.var] = Some(*original_value); } } UnpackedKind::Lifetime(result_value) => { // e.g., here `result_value` might be `'?1` in the example above... - if let &ty::RegionKind::ReLateBound(index, br) = result_value { + if let &ty::RegionKind::ReLateBound(debruijn, br) = result_value { // ... in which case we would set `canonical_vars[0]` to `Some('static)`. // We only allow a `ty::INNERMOST` index in substitutions. - assert_eq!(index, ty::INNERMOST); + assert_eq!(debruijn, ty::INNERMOST); opt_values[br.assert_bound_var()] = Some(*original_value); } } @@ -527,32 +547,30 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { param_env: ty::ParamEnv<'tcx>, unsubstituted_region_constraints: &'a [QueryRegionConstraint<'tcx>], result_subst: &'a CanonicalVarValues<'tcx>, - ) -> impl Iterator> + 'a { - Box::new( - unsubstituted_region_constraints - .iter() - .map(move |constraint| { - let constraint = substitute_value(self.tcx, result_subst, constraint); - let &ty::OutlivesPredicate(k1, r2) = constraint.skip_binder(); // restored below - - Obligation::new( - cause.clone(), - param_env, - match k1.unpack() { - UnpackedKind::Lifetime(r1) => ty::Predicate::RegionOutlives( - ty::Binder::bind( - ty::OutlivesPredicate(r1, r2) - ) - ), - UnpackedKind::Type(t1) => ty::Predicate::TypeOutlives( - ty::Binder::bind( - ty::OutlivesPredicate(t1, r2) - ) - ), - } - ) - }) - ) as Box> + ) -> impl Iterator> + 'a + Captures<'gcx> { + unsubstituted_region_constraints + .iter() + .map(move |constraint| { + let constraint = substitute_value(self.tcx, result_subst, constraint); + let &ty::OutlivesPredicate(k1, r2) = constraint.skip_binder(); // restored below + + Obligation::new( + cause.clone(), + param_env, + match k1.unpack() { + UnpackedKind::Lifetime(r1) => ty::Predicate::RegionOutlives( + ty::Binder::bind( + ty::OutlivesPredicate(r1, r2) + ) + ), + UnpackedKind::Type(t1) => ty::Predicate::TypeOutlives( + ty::Binder::bind( + ty::OutlivesPredicate(t1, r2) + ) + ), + } + ) + }) } /// Given two sets of values for the same set of canonical variables, unify them. diff --git a/src/librustc/infer/canonical/substitute.rs b/src/librustc/infer/canonical/substitute.rs index e2110e148de..d3ed00481dc 100644 --- a/src/librustc/infer/canonical/substitute.rs +++ b/src/librustc/infer/canonical/substitute.rs @@ -1,20 +1,10 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains code to substitute new values into a //! `Canonical<'tcx, T>`. //! //! For an overview of what canonicalization is and how it fits into //! rustc, check out the [chapter in the rustc guide][c]. //! -//! [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html +//! [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html use infer::canonical::{Canonical, CanonicalVarValues}; use ty::fold::TypeFoldable; diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index f13210926a7..40c11695d51 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /////////////////////////////////////////////////////////////////////////// // # Type combining // @@ -371,7 +361,7 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, ' if self.ambient_variance == ty::Variance::Invariant { // Avoid fetching the variance if we are in an invariant // context; no need, and it can induce dependency cycles - // (e.g. #41849). + // (e.g., #41849). relate::relate_substs(self, None, a_subst, b_subst) } else { let opt_variances = self.tcx().variances_of(item_def_id); diff --git a/src/librustc/infer/equate.rs b/src/librustc/infer/equate.rs index c7b5ddb8341..60a7eb0d54f 100644 --- a/src/librustc/infer/equate.rs +++ b/src/librustc/infer/equate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::combine::{CombineFields, RelationDir}; use super::{Subtype}; @@ -47,9 +37,9 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> b_subst: &'tcx Substs<'tcx>) -> RelateResult<'tcx, &'tcx Substs<'tcx>> { - // NB: Once we are equating types, we don't care about + // N.B., once we are equating types, we don't care about // variance, so don't try to lookup the variance here. This - // also avoids some cycles (e.g. #41849) since looking up + // also avoids some cycles (e.g., #41849) since looking up // variance requires computing types which can require // performing trait matching (which then performs equality // unification). diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 59a490f4a01..66e4cd49c80 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Error Reporting Code for the inference engine //! //! Because of the way inference, and in particular region inference, @@ -97,7 +87,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { ) }; let span = scope.span(self, region_scope_tree); - let tag = match self.hir.find(scope.node_id(self, region_scope_tree)) { + let tag = match self.hir().find(scope.node_id(self, region_scope_tree)) { Some(Node::Block(_)) => "block", Some(Node::Expr(expr)) => match expr.node { hir::ExprKind::Call(..) => "call", @@ -142,12 +132,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { ty::ReEmpty => ("the empty lifetime".to_owned(), None), + ty::RePlaceholder(_) => (format!("any other region"), None), + // FIXME(#13998) RePlaceholder should probably print like // ReFree rather than dumping Debug output on the user. // // We shouldn't really be having unification failures with ReVar // and ReLateBound though. - ty::RePlaceholder(..) | ty::ReVar(_) | ty::ReLateBound(..) | ty::ReErased => { + ty::ReVar(_) | ty::ReLateBound(..) | ty::ReErased => { (format!("lifetime {:?}", region), None) } @@ -190,8 +182,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let cm = self.sess.source_map(); let scope = region.free_region_binding_scope(self); - let node = self.hir.as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID); - let tag = match self.hir.find(node) { + let node = self.hir().as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID); + let tag = match self.hir().find(node) { Some(Node::Block(_)) | Some(Node::Expr(_)) => "body", Some(Node::Item(it)) => Self::item_scope_tag(&it), Some(Node::TraitItem(it)) => Self::trait_item_scope_tag(&it), @@ -200,8 +192,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { }; let (prefix, span) = match *region { ty::ReEarlyBound(ref br) => { - let mut sp = cm.def_span(self.hir.span(node)); - if let Some(param) = self.hir + let mut sp = cm.def_span(self.hir().span(node)); + if let Some(param) = self.hir() .get_generics(scope) .and_then(|generics| generics.get_named(&br.name)) { @@ -213,8 +205,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { bound_region: ty::BoundRegion::BrNamed(_, ref name), .. }) => { - let mut sp = cm.def_span(self.hir.span(node)); - if let Some(param) = self.hir + let mut sp = cm.def_span(self.hir().span(node)); + if let Some(param) = self.hir() .get_generics(scope) .and_then(|generics| generics.get_named(&name)) { @@ -225,15 +217,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { ty::ReFree(ref fr) => match fr.bound_region { ty::BrAnon(idx) => ( format!("the anonymous lifetime #{} defined on", idx + 1), - self.hir.span(node), + self.hir().span(node), ), ty::BrFresh(_) => ( "an anonymous lifetime defined on".to_owned(), - self.hir.span(node), + self.hir().span(node), ), _ => ( format!("the lifetime {} as defined on", fr.bound_region), - cm.def_span(self.hir.span(node)), + cm.def_span(self.hir().span(node)), ), }, _ => bug!(), @@ -334,8 +326,13 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // the error. If all of these fails, we fall back to a rather // general bit of code that displays the error information RegionResolutionError::ConcreteFailure(origin, sub, sup) => { - self.report_concrete_failure(region_scope_tree, origin, sub, sup) - .emit(); + if sub.is_placeholder() || sup.is_placeholder() { + self.report_placeholder_failure(region_scope_tree, origin, sub, sup) + .emit(); + } else { + self.report_concrete_failure(region_scope_tree, origin, sub, sup) + .emit(); + } } RegionResolutionError::GenericBoundFailure(origin, param_ty, sub) => { @@ -349,20 +346,39 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } RegionResolutionError::SubSupConflict( + _, var_origin, sub_origin, sub_r, sup_origin, sup_r, ) => { - self.report_sub_sup_conflict( - region_scope_tree, - var_origin, - sub_origin, - sub_r, - sup_origin, - sup_r, - ); + if sub_r.is_placeholder() { + self.report_placeholder_failure( + region_scope_tree, + sub_origin, + sub_r, + sup_r, + ) + .emit(); + } else if sup_r.is_placeholder() { + self.report_placeholder_failure( + region_scope_tree, + sup_origin, + sub_r, + sup_r, + ) + .emit(); + } else { + self.report_sub_sup_conflict( + region_scope_tree, + var_origin, + sub_origin, + sub_r, + sup_origin, + sup_r, + ); + } } } } @@ -417,7 +433,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { errors.sort_by_key(|u| match *u { RegionResolutionError::ConcreteFailure(ref sro, _, _) => sro.span(), RegionResolutionError::GenericBoundFailure(ref sro, _, _) => sro.span(), - RegionResolutionError::SubSupConflict(ref rvo, _, _, _, _) => rvo.span(), + RegionResolutionError::SubSupConflict(_, ref rvo, _, _, _, _) => rvo.span(), }); errors } @@ -469,8 +485,30 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } - fn note_error_origin(&self, err: &mut DiagnosticBuilder<'tcx>, cause: &ObligationCause<'tcx>) { + fn note_error_origin( + &self, + err: &mut DiagnosticBuilder<'tcx>, + cause: &ObligationCause<'tcx>, + exp_found: Option>>, + ) { match cause.code { + ObligationCauseCode::MatchExpressionArmPattern { span, ty } => { + if ty.is_suggestable() { // don't show type `_` + err.span_label(span, format!("this match expression has type `{}`", ty)); + } + if let Some(ty::error::ExpectedFound { found, .. }) = exp_found { + if ty.is_box() && ty.boxed_ty() == found { + if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) { + err.span_suggestion( + span, + "consider dereferencing the boxed value", + format!("*{}", snippet), + Applicability::MachineApplicable, + ); + } + } + } + } ObligationCauseCode::MatchExpressionArm { arm_span, source } => match source { hir::MatchSource::IfLetDesugar { .. } => { let msg = "`if let` arm with an incompatible type"; @@ -490,6 +528,18 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } }, + ObligationCauseCode::IfExpression { then, outer, semicolon } => { + err.span_label(then, "expected because of this"); + outer.map(|sp| err.span_label(sp, "if and else have incompatible types")); + if let Some(sp) = semicolon { + err.span_suggestion_short( + sp, + "consider removing this semicolon", + String::new(), + Applicability::MachineApplicable, + ); + } + } _ => (), } } @@ -966,6 +1016,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { diag.span_label(span, message); } } + self.suggest_as_ref_where_appropriate(span, &exp_found, diag); } diag.note_expected_found(&"type", expected, found); @@ -979,7 +1030,73 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // It reads better to have the error origin as the final // thing. - self.note_error_origin(diag, &cause); + self.note_error_origin(diag, &cause, exp_found); + } + + /// When encountering a case where `.as_ref()` on a `Result` or `Option` would be appropriate, + /// suggest it. + fn suggest_as_ref_where_appropriate( + &self, + span: Span, + exp_found: &ty::error::ExpectedFound>, + diag: &mut DiagnosticBuilder<'tcx>, + ) { + match (&exp_found.expected.sty, &exp_found.found.sty) { + (TyKind::Adt(exp_def, exp_substs), TyKind::Ref(_, found_ty, _)) => { + if let TyKind::Adt(found_def, found_substs) = found_ty.sty { + let path_str = format!("{:?}", exp_def); + if exp_def == &found_def { + let opt_msg = "you can convert from `&Option` to `Option<&T>` using \ + `.as_ref()`"; + let result_msg = "you can convert from `&Result` to \ + `Result<&T, &E>` using `.as_ref()`"; + let have_as_ref = &[ + ("std::option::Option", opt_msg), + ("core::option::Option", opt_msg), + ("std::result::Result", result_msg), + ("core::result::Result", result_msg), + ]; + if let Some(msg) = have_as_ref.iter() + .filter_map(|(path, msg)| if &path_str == path { + Some(msg) + } else { + None + }).next() + { + let mut show_suggestion = true; + for (exp_ty, found_ty) in exp_substs.types().zip(found_substs.types()) { + match exp_ty.sty { + TyKind::Ref(_, exp_ty, _) => { + match (&exp_ty.sty, &found_ty.sty) { + (_, TyKind::Param(_)) | + (_, TyKind::Infer(_)) | + (TyKind::Param(_), _) | + (TyKind::Infer(_), _) => {} + _ if ty::TyS::same_type(exp_ty, found_ty) => {} + _ => show_suggestion = false, + }; + } + TyKind::Param(_) | TyKind::Infer(_) => {} + _ => show_suggestion = false, + } + } + if let (Ok(snippet), true) = ( + self.tcx.sess.source_map().span_to_snippet(span), + show_suggestion, + ) { + diag.span_suggestion( + span, + msg, + format!("{}.as_ref()", snippet), + Applicability::MachineApplicable, + ); + } + } + } + } + } + _ => {} + } } pub fn report_and_explain_type_error( @@ -1083,7 +1200,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // the expected type argument. if !param.is_self() { let type_param = generics.type_param(param, self.tcx); - let hir = &self.tcx.hir; + let hir = &self.tcx.hir(); hir.as_local_node_id(type_param.def_id).map(|id| { // Get the `hir::Param` to verify whether it already has any bounds. // We do this to avoid suggesting code that ends up as `T: 'a'b`, @@ -1095,7 +1212,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let sp = hir.span(id); // `sp` only covers `T`, change it so that it covers // `T:` when appropriate - let sp = if has_bounds { + let is_impl_trait = bound_kind.to_string().starts_with("impl "); + let sp = if has_bounds && !is_impl_trait { sp.to(self.tcx .sess .source_map() @@ -1103,7 +1221,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } else { sp }; - (sp, has_bounds) + (sp, has_bounds, is_impl_trait) }) } else { None @@ -1136,25 +1254,33 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { fn binding_suggestion<'tcx, S: fmt::Display>( err: &mut DiagnosticBuilder<'tcx>, - type_param_span: Option<(Span, bool)>, + type_param_span: Option<(Span, bool, bool)>, bound_kind: GenericKind<'tcx>, sub: S, ) { - let consider = &format!( - "consider adding an explicit lifetime bound `{}: {}`...", - bound_kind, sub + let consider = format!( + "consider adding an explicit lifetime bound {}", + if type_param_span.map(|(_, _, is_impl_trait)| is_impl_trait).unwrap_or(false) { + format!(" `{}` to `{}`...", sub, bound_kind) + } else { + format!("`{}: {}`...", bound_kind, sub) + }, ); - if let Some((sp, has_lifetimes)) = type_param_span { - let tail = if has_lifetimes { " + " } else { "" }; - let suggestion = format!("{}: {}{}", bound_kind, sub, tail); - err.span_suggestion_short_with_applicability( + if let Some((sp, has_lifetimes, is_impl_trait)) = type_param_span { + let suggestion = if is_impl_trait { + format!("{} + {}", bound_kind, sub) + } else { + let tail = if has_lifetimes { " + " } else { "" }; + format!("{}: {}{}", bound_kind, sub, tail) + }; + err.span_suggestion_short( sp, - consider, + &consider, suggestion, Applicability::MaybeIncorrect, // Issue #41966 ); } else { - err.help(consider); + err.help(&consider); } } @@ -1240,6 +1366,16 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { match (&sup_origin, &sub_origin) { (&infer::Subtype(ref sup_trace), &infer::Subtype(ref sub_trace)) => { + debug!("report_sub_sup_conflict: var_origin={:?}", var_origin); + debug!("report_sub_sup_conflict: sub_region={:?}", sub_region); + debug!("report_sub_sup_conflict: sub_origin={:?}", sub_origin); + debug!("report_sub_sup_conflict: sup_region={:?}", sup_region); + debug!("report_sub_sup_conflict: sup_origin={:?}", sup_origin); + debug!("report_sub_sup_conflict: sup_trace={:?}", sup_trace); + debug!("report_sub_sup_conflict: sub_trace={:?}", sub_trace); + debug!("report_sub_sup_conflict: sup_trace.values={:?}", sup_trace.values); + debug!("report_sub_sup_conflict: sub_trace.values={:?}", sub_trace.values); + if let (Some((sup_expected, sup_found)), Some((sub_expected, sub_found))) = ( self.values_str(&sup_trace.values), self.values_str(&sub_trace.values), @@ -1315,8 +1451,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { format!(" for lifetime parameter `{}` in coherence check", name) } infer::UpvarRegion(ref upvar_id, _) => { - let var_node_id = self.tcx.hir.hir_to_node_id(upvar_id.var_path.hir_id); - let var_name = self.tcx.hir.name(var_node_id); + let var_node_id = self.tcx.hir().hir_to_node_id(upvar_id.var_path.hir_id); + let var_name = self.tcx.hir().name(var_node_id); format!(" for capture of `{}` by closure", var_name) } infer::NLL(..) => bug!("NLL variable found in lexical phase"), @@ -1353,7 +1489,7 @@ impl<'tcx> ObligationCause<'tcx> { } _ => "match arms have incompatible types", }), - IfExpression => Error0308("if and else have incompatible types"), + IfExpression { .. } => Error0308("if and else have incompatible types"), IfExpressionWithNoElse => Error0317("if may be missing an else clause"), MainFunctionType => Error0580("main function has wrong type"), StartFunctionType => Error0308("start function has wrong type"), @@ -1381,7 +1517,7 @@ impl<'tcx> ObligationCause<'tcx> { hir::MatchSource::IfLetDesugar { .. } => "`if let` arms have compatible types", _ => "match arms have compatible types", }, - IfExpression => "if and else have compatible types", + IfExpression { .. } => "if and else have compatible types", IfExpressionWithNoElse => "if missing an else returns ()", MainFunctionType => "`main` function has the correct type", StartFunctionType => "`start` function has the correct type", diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs index efb316243fa..8ee367c87c3 100644 --- a/src/librustc/infer/error_reporting/need_type_info.rs +++ b/src/librustc/infer/error_reporting/need_type_info.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::{self, Local, Pat, Body, HirId}; use hir::intravisit::{self, Visitor, NestedVisitorMap}; use infer::InferCtxt; @@ -109,13 +99,13 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let mut local_visitor = FindLocalByTypeVisitor { infcx: &self, target_ty: &ty, - hir_map: &self.tcx.hir, + hir_map: &self.tcx.hir(), found_local_pattern: None, found_arg_pattern: None, }; if let Some(body_id) = body_id { - let expr = self.tcx.hir.expect_expr(body_id.node_id); + let expr = self.tcx.hir().expect_expr(body_id.node_id); local_visitor.visit_expr(expr); } diff --git a/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs b/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs index 1f84c73a715..8be49b27924 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/different_lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Error Reporting for Anonymous Region Lifetime Errors //! where both the regions are anonymous. @@ -56,9 +46,9 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { let (span, sub, sup) = self.get_regions(); // Determine whether the sub and sup consist of both anonymous (elided) regions. - let anon_reg_sup = self.tcx.is_suitable_region(sup)?; + let anon_reg_sup = self.tcx().is_suitable_region(sup)?; - let anon_reg_sub = self.tcx.is_suitable_region(sub)?; + let anon_reg_sub = self.tcx().is_suitable_region(sub)?; let scope_def_id_sup = anon_reg_sup.def_id; let bregion_sup = anon_reg_sup.boundregion; let scope_def_id_sub = anon_reg_sub.def_id; @@ -148,7 +138,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { }; - struct_span_err!(self.tcx.sess, span, E0623, "lifetime mismatch") + struct_span_err!(self.tcx().sess, span, E0623, "lifetime mismatch") .span_label(span_1, main_label) .span_label(span_2, String::new()) .span_label(span, span_label) diff --git a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs index 10a2d179dd5..eeaa01375ed 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir; use ty::{self, Region, TyCtxt}; use hir::Node; @@ -30,16 +20,16 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { /// { x.push(y); } /// ``` /// The function returns the nested type corresponding to the anonymous region - /// for e.g. `&u8` and Vec<`&u8`. + /// for e.g., `&u8` and Vec<`&u8`. pub(super) fn find_anon_type( &self, region: Region<'tcx>, br: &ty::BoundRegion, ) -> Option<(&hir::Ty, &hir::FnDecl)> { - if let Some(anon_reg) = self.tcx.is_suitable_region(region) { + if let Some(anon_reg) = self.tcx().is_suitable_region(region) { let def_id = anon_reg.def_id; - if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) { - let fndecl = match self.tcx.hir.get(node_id) { + if let Some(node_id) = self.tcx().hir().as_local_node_id(def_id) { + let fndecl = match self.tcx().hir().get(node_id) { Node::Item(&hir::Item { node: hir::ItemKind::Fn(ref fndecl, ..), .. @@ -74,7 +64,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { br: &ty::BoundRegion, ) -> Option<(&'gcx hir::Ty)> { let mut nested_visitor = FindNestedTypeVisitor { - tcx: self.tcx, + tcx: self.tcx(), bound_region: *br, found_type: None, current_index: ty::INNERMOST, @@ -97,14 +87,14 @@ struct FindNestedTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { // associated with the anonymous region we are looking for. bound_region: ty::BoundRegion, // The type where the anonymous lifetime appears - // for e.g. Vec<`&u8`> and <`&u8`> + // for e.g., Vec<`&u8`> and <`&u8`> found_type: Option<&'gcx hir::Ty>, current_index: ty::DebruijnIndex, } impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'gcx> { - NestedVisitorMap::OnlyBodies(&self.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } fn visit_ty(&mut self, arg: &'gcx hir::Ty) { @@ -124,7 +114,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> { hir::TyKind::Rptr(ref lifetime, _) => { // the lifetime of the TyRptr - let hir_id = self.tcx.hir.node_to_hir_id(lifetime.id); + let hir_id = self.tcx.hir().node_to_hir_id(lifetime.id); match (self.tcx.named_region(hir_id), self.bound_region) { // Find the index of the anonymous region that was part of the // error. We will then search the function parameters for a bound @@ -150,7 +140,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> { // region at the right depth with the same index (Some(rl::Region::EarlyBound(_, id, _)), ty::BrNamed(def_id, _)) => { debug!( - "EarlyBound self.infcx.tcx.hir.local_def_id(id)={:?} \ + "EarlyBound self.infcx.tcx.hir().local_def_id(id)={:?} \ def_id={:?}", id, def_id @@ -172,7 +162,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> { "FindNestedTypeVisitor::visit_ty: LateBound depth = {:?}", debruijn_index ); - debug!("self.infcx.tcx.hir.local_def_id(id)={:?}", id); + debug!("self.infcx.tcx.hir().local_def_id(id)={:?}", id); debug!("def_id={:?}", def_id); if debruijn_index == self.current_index && id == def_id { self.found_type = Some(arg); @@ -227,11 +217,11 @@ struct TyPathVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> Visitor<'gcx> for TyPathVisitor<'a, 'gcx, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'gcx> { - NestedVisitorMap::OnlyBodies(&self.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } fn visit_lifetime(&mut self, lifetime: &hir::Lifetime) { - let hir_id = self.tcx.hir.node_to_hir_id(lifetime.id); + let hir_id = self.tcx.hir().node_to_hir_id(lifetime.id); match (self.tcx.named_region(hir_id), self.bound_region) { // the lifetime of the TyPath! (Some(rl::Region::LateBoundAnon(debruijn_index, anon_index)), ty::BrAnon(br_index)) => { @@ -243,7 +233,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for TyPathVisitor<'a, 'gcx, 'tcx> { (Some(rl::Region::EarlyBound(_, id, _)), ty::BrNamed(def_id, _)) => { debug!( - "EarlyBound self.infcx.tcx.hir.local_def_id(id)={:?} \ + "EarlyBound self.infcx.tcx.hir().local_def_id(id)={:?} \ def_id={:?}", id, def_id diff --git a/src/librustc/infer/error_reporting/nice_region_error/mod.rs b/src/librustc/infer/error_reporting/nice_region_error/mod.rs index 0ff5630f63e..d34b71c33f4 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/mod.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::InferCtxt; use infer::lexical_region_resolve::RegionResolutionError; use infer::lexical_region_resolve::RegionResolutionError::*; @@ -18,6 +8,7 @@ use util::common::ErrorReported; mod different_lifetimes; mod find_anon_type; mod named_anon_conflict; +mod placeholder_error; mod outlives_closure; mod static_impl_trait; mod util; @@ -31,15 +22,15 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { if let Some(tables) = self.in_progress_tables { let tables = tables.borrow(); - NiceRegionError::new(self.tcx, error.clone(), Some(&tables)).try_report().is_some() + NiceRegionError::new(self, error.clone(), Some(&tables)).try_report().is_some() } else { - NiceRegionError::new(self.tcx, error.clone(), None).try_report().is_some() + NiceRegionError::new(self, error.clone(), None).try_report().is_some() } } } pub struct NiceRegionError<'cx, 'gcx: 'tcx, 'tcx: 'cx> { - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>, error: Option>, regions: Option<(Span, ty::Region<'tcx>, ty::Region<'tcx>)>, tables: Option<&'cx ty::TypeckTables<'tcx>>, @@ -47,31 +38,36 @@ pub struct NiceRegionError<'cx, 'gcx: 'tcx, 'tcx: 'cx> { impl<'cx, 'gcx, 'tcx> NiceRegionError<'cx, 'gcx, 'tcx> { pub fn new( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>, error: RegionResolutionError<'tcx>, tables: Option<&'cx ty::TypeckTables<'tcx>>, ) -> Self { - Self { tcx, error: Some(error), regions: None, tables } + Self { infcx, error: Some(error), regions: None, tables } } pub fn new_from_span( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>, span: Span, sub: ty::Region<'tcx>, sup: ty::Region<'tcx>, tables: Option<&'cx ty::TypeckTables<'tcx>>, ) -> Self { - Self { tcx, error: None, regions: Some((span, sub, sup)), tables } + Self { infcx, error: None, regions: Some((span, sub, sup)), tables } + } + + fn tcx(&self) -> TyCtxt<'cx, 'gcx, 'tcx> { + self.infcx.tcx } pub fn try_report_from_nll(&self) -> Option { // Due to the improved diagnostics returned by the MIR borrow checker, only a subset of // the nice region errors are required when running under the MIR borrow checker. self.try_report_named_anon_conflict() + .or_else(|| self.try_report_placeholder_conflict()) } pub fn try_report(&self) -> Option { - self.try_report_named_anon_conflict() + self.try_report_from_nll() .or_else(|| self.try_report_anon_anon_conflict()) .or_else(|| self.try_report_outlives_closure()) .or_else(|| self.try_report_static_impl_trait()) @@ -79,8 +75,8 @@ impl<'cx, 'gcx, 'tcx> NiceRegionError<'cx, 'gcx, 'tcx> { pub fn get_regions(&self) -> (Span, ty::Region<'tcx>, ty::Region<'tcx>) { match (&self.error, self.regions) { - (&Some(ConcreteFailure(ref origin, sub, sup)), None) => (origin.span(), sub, sup), - (&Some(SubSupConflict(_, ref origin, sub, _, sup)), None) => (origin.span(), sub, sup), + (Some(ConcreteFailure(origin, sub, sup)), None) => (origin.span(), sub, sup), + (Some(SubSupConflict(_, _, origin, sub, _, sup)), None) => (origin.span(), sub, sup), (None, Some((span, sub, sup))) => (span, sub, sup), (Some(_), Some(_)) => panic!("incorrectly built NiceRegionError"), _ => panic!("trying to report on an incorrect lifetime failure"), diff --git a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs index 6ff008919e5..05333f43373 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Error Reporting for Anonymous Region Lifetime Errors //! where one region is named and the other is anonymous. use infer::error_reporting::nice_region_error::NiceRegionError; @@ -34,23 +24,23 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { // version new_ty of its type where the anonymous region is replaced // with the named one.//scope_def_id let (named, anon, anon_arg_info, region_info) = if self.is_named_region(sub) - && self.tcx.is_suitable_region(sup).is_some() + && self.tcx().is_suitable_region(sup).is_some() && self.find_arg_with_region(sup, sub).is_some() { ( sub, sup, self.find_arg_with_region(sup, sub).unwrap(), - self.tcx.is_suitable_region(sup).unwrap(), + self.tcx().is_suitable_region(sup).unwrap(), ) - } else if self.is_named_region(sup) && self.tcx.is_suitable_region(sub).is_some() + } else if self.is_named_region(sup) && self.tcx().is_suitable_region(sub).is_some() && self.find_arg_with_region(sub, sup).is_some() { ( sup, sub, self.find_arg_with_region(sub, sup).unwrap(), - self.tcx.is_suitable_region(sub).unwrap(), + self.tcx().is_suitable_region(sub).unwrap(), ) } else { return None; // inapplicable @@ -107,12 +97,12 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { }; struct_span_err!( - self.tcx.sess, + self.tcx().sess, span, E0621, "explicit lifetime required in {}", error_var - ).span_suggestion_with_applicability( + ).span_suggestion( new_ty_span, &format!("add explicit lifetime `{}` to {}", named, span_label_var), new_ty.to_string(), diff --git a/src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs b/src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs index 7a92b3084ba..cbd36a8b2db 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/outlives_closure.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Error Reporting for Anonymous Region Lifetime Errors //! where both the regions are anonymous. @@ -46,7 +36,8 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { /// ...because it cannot outlive this closure /// ``` pub(super) fn try_report_outlives_closure(&self) -> Option { - if let Some(SubSupConflict(origin, + if let Some(SubSupConflict(_, + origin, ref sub_origin, _, ref sup_origin, @@ -56,7 +47,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { // closure, provide a specific message pointing this out. if let (&SubregionOrigin::BindingTypeIsNotValidAtDecl(ref external_span), &RegionKind::ReFree(ref free_region)) = (&sub_origin, sup_region) { - let hir = &self.tcx.hir; + let hir = &self.tcx().hir(); if let Some(node_id) = hir.as_local_node_id(free_region.scope) { if let Node::Expr(Expr { node: Closure(_, _, _, closure_span, None), @@ -64,7 +55,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { }) = hir.get(node_id) { let sup_sp = sup_origin.span(); let origin_sp = origin.span(); - let mut err = self.tcx.sess.struct_span_err( + let mut err = self.tcx().sess.struct_span_err( sup_sp, "borrowed data cannot be stored outside of its closure"); err.span_label(sup_sp, "cannot be stored outside of its closure"); diff --git a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs new file mode 100644 index 00000000000..ebac5a0c2a6 --- /dev/null +++ b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs @@ -0,0 +1,444 @@ +use errors::DiagnosticBuilder; +use hir::def_id::DefId; +use infer::error_reporting::nice_region_error::NiceRegionError; +use infer::lexical_region_resolve::RegionResolutionError; +use infer::ValuePairs; +use infer::{SubregionOrigin, TypeTrace}; +use traits::{ObligationCause, ObligationCauseCode}; +use ty; +use ty::error::ExpectedFound; +use ty::subst::Substs; +use util::common::ErrorReported; +use util::ppaux::RegionHighlightMode; + +impl NiceRegionError<'me, 'gcx, 'tcx> { + /// When given a `ConcreteFailure` for a function with arguments containing a named region and + /// an anonymous region, emit a descriptive diagnostic error. + pub(super) fn try_report_placeholder_conflict(&self) -> Option { + match &self.error { + /////////////////////////////////////////////////////////////////////////// + // NB. The ordering of cases in this match is very + // sensitive, because we are often matching against + // specific cases and then using an `_` to match all + // others. + + /////////////////////////////////////////////////////////////////////////// + // Check for errors from comparing trait failures -- first + // with two placeholders, then with one. + Some(RegionResolutionError::SubSupConflict( + vid, + _, + SubregionOrigin::Subtype(TypeTrace { + cause, + values: ValuePairs::TraitRefs(ExpectedFound { expected, found }), + }), + sub_placeholder @ ty::RePlaceholder(_), + _, + sup_placeholder @ ty::RePlaceholder(_), + )) if expected.def_id == found.def_id => Some(self.try_report_placeholders_trait( + Some(self.tcx().mk_region(ty::ReVar(*vid))), + cause, + Some(sub_placeholder), + Some(sup_placeholder), + expected.def_id, + expected.substs, + found.substs, + )), + + Some(RegionResolutionError::SubSupConflict( + vid, + _, + SubregionOrigin::Subtype(TypeTrace { + cause, + values: ValuePairs::TraitRefs(ExpectedFound { expected, found }), + }), + sub_placeholder @ ty::RePlaceholder(_), + _, + _, + )) if expected.def_id == found.def_id => Some(self.try_report_placeholders_trait( + Some(self.tcx().mk_region(ty::ReVar(*vid))), + cause, + Some(sub_placeholder), + None, + expected.def_id, + expected.substs, + found.substs, + )), + + Some(RegionResolutionError::SubSupConflict( + vid, + _, + SubregionOrigin::Subtype(TypeTrace { + cause, + values: ValuePairs::TraitRefs(ExpectedFound { expected, found }), + }), + _, + _, + sup_placeholder @ ty::RePlaceholder(_), + )) if expected.def_id == found.def_id => Some(self.try_report_placeholders_trait( + Some(self.tcx().mk_region(ty::ReVar(*vid))), + cause, + None, + Some(*sup_placeholder), + expected.def_id, + expected.substs, + found.substs, + )), + + Some(RegionResolutionError::SubSupConflict( + vid, + _, + _, + _, + SubregionOrigin::Subtype(TypeTrace { + cause, + values: ValuePairs::TraitRefs(ExpectedFound { expected, found }), + }), + sup_placeholder @ ty::RePlaceholder(_), + )) if expected.def_id == found.def_id => Some(self.try_report_placeholders_trait( + Some(self.tcx().mk_region(ty::ReVar(*vid))), + cause, + None, + Some(*sup_placeholder), + expected.def_id, + expected.substs, + found.substs, + )), + + Some(RegionResolutionError::ConcreteFailure( + SubregionOrigin::Subtype(TypeTrace { + cause, + values: ValuePairs::TraitRefs(ExpectedFound { expected, found }), + }), + sub_region @ ty::RePlaceholder(_), + sup_region @ ty::RePlaceholder(_), + )) if expected.def_id == found.def_id => Some(self.try_report_placeholders_trait( + None, + cause, + Some(*sub_region), + Some(*sup_region), + expected.def_id, + expected.substs, + found.substs, + )), + + Some(RegionResolutionError::ConcreteFailure( + SubregionOrigin::Subtype(TypeTrace { + cause, + values: ValuePairs::TraitRefs(ExpectedFound { expected, found }), + }), + sub_region @ ty::RePlaceholder(_), + sup_region, + )) if expected.def_id == found.def_id => Some(self.try_report_placeholders_trait( + Some(sup_region), + cause, + Some(*sub_region), + None, + expected.def_id, + expected.substs, + found.substs, + )), + + Some(RegionResolutionError::ConcreteFailure( + SubregionOrigin::Subtype(TypeTrace { + cause, + values: ValuePairs::TraitRefs(ExpectedFound { expected, found }), + }), + sub_region, + sup_region @ ty::RePlaceholder(_), + )) if expected.def_id == found.def_id => Some(self.try_report_placeholders_trait( + Some(sub_region), + cause, + None, + Some(*sup_region), + expected.def_id, + expected.substs, + found.substs, + )), + + _ => None, + } + } + + // error[E0308]: implementation of `Foo` does not apply to enough lifetimes + // --> /home/nmatsakis/tmp/foo.rs:12:5 + // | + // 12 | all::<&'static u32>(); + // | ^^^^^^^^^^^^^^^^^^^ lifetime mismatch + // | + // = note: Due to a where-clause on the function `all`, + // = note: `T` must implement `...` for any two lifetimes `'1` and `'2`. + // = note: However, the type `T` only implements `...` for some specific lifetime `'2`. + fn try_report_placeholders_trait( + &self, + vid: Option>, + cause: &ObligationCause<'tcx>, + sub_placeholder: Option>, + sup_placeholder: Option>, + trait_def_id: DefId, + expected_substs: &'tcx Substs<'tcx>, + actual_substs: &'tcx Substs<'tcx>, + ) -> ErrorReported { + debug!( + "try_report_placeholders_trait(\ + vid={:?}, \ + sub_placeholder={:?}, \ + sup_placeholder={:?}, \ + trait_def_id={:?}, \ + expected_substs={:?}, \ + actual_substs={:?})", + vid, sub_placeholder, sup_placeholder, trait_def_id, expected_substs, actual_substs + ); + + let mut err = self.tcx().sess.struct_span_err( + cause.span(&self.tcx()), + &format!( + "implementation of `{}` is not general enough", + self.tcx().item_path_str(trait_def_id), + ), + ); + + match cause.code { + ObligationCauseCode::ItemObligation(def_id) => { + err.note(&format!( + "Due to a where-clause on `{}`,", + self.tcx().item_path_str(def_id), + )); + } + _ => (), + } + + let expected_trait_ref = self.infcx.resolve_type_vars_if_possible(&ty::TraitRef { + def_id: trait_def_id, + substs: expected_substs, + }); + let actual_trait_ref = self.infcx.resolve_type_vars_if_possible(&ty::TraitRef { + def_id: trait_def_id, + substs: actual_substs, + }); + + // Search the expected and actual trait references to see (a) + // whether the sub/sup placeholders appear in them (sometimes + // you have a trait ref like `T: Foo`, where the + // placeholder was created as part of an inner type) and (b) + // whether the inference variable appears. In each case, + // assign a counter value in each case if so. + let mut counter = 0; + let mut has_sub = None; + let mut has_sup = None; + + let mut actual_has_vid = None; + let mut expected_has_vid = None; + + self.tcx().for_each_free_region(&expected_trait_ref, |r| { + if Some(r) == sub_placeholder && has_sub.is_none() { + has_sub = Some(counter); + counter += 1; + } else if Some(r) == sup_placeholder && has_sup.is_none() { + has_sup = Some(counter); + counter += 1; + } + + if Some(r) == vid && expected_has_vid.is_none() { + expected_has_vid = Some(counter); + counter += 1; + } + }); + + self.tcx().for_each_free_region(&actual_trait_ref, |r| { + if Some(r) == vid && actual_has_vid.is_none() { + actual_has_vid = Some(counter); + counter += 1; + } + }); + + let actual_self_ty_has_vid = self + .tcx() + .any_free_region_meets(&actual_trait_ref.self_ty(), |r| Some(r) == vid); + + let expected_self_ty_has_vid = self + .tcx() + .any_free_region_meets(&expected_trait_ref.self_ty(), |r| Some(r) == vid); + + let any_self_ty_has_vid = actual_self_ty_has_vid || expected_self_ty_has_vid; + + debug!( + "try_report_placeholders_trait: actual_has_vid={:?}", + actual_has_vid + ); + debug!( + "try_report_placeholders_trait: expected_has_vid={:?}", + expected_has_vid + ); + debug!("try_report_placeholders_trait: has_sub={:?}", has_sub); + debug!("try_report_placeholders_trait: has_sup={:?}", has_sup); + debug!( + "try_report_placeholders_trait: actual_self_ty_has_vid={:?}", + actual_self_ty_has_vid + ); + debug!( + "try_report_placeholders_trait: expected_self_ty_has_vid={:?}", + expected_self_ty_has_vid + ); + + self.explain_actual_impl_that_was_found( + &mut err, + sub_placeholder, + sup_placeholder, + has_sub, + has_sup, + expected_trait_ref, + actual_trait_ref, + vid, + expected_has_vid, + actual_has_vid, + any_self_ty_has_vid, + ); + + err.emit(); + ErrorReported + } + + /// Add notes with details about the expected and actual trait refs, with attention to cases + /// when placeholder regions are involved: either the trait or the self type containing + /// them needs to be mentioned the closest to the placeholders. + /// This makes the error messages read better, however at the cost of some complexity + /// due to the number of combinations we have to deal with. + fn explain_actual_impl_that_was_found( + &self, + err: &mut DiagnosticBuilder<'_>, + sub_placeholder: Option>, + sup_placeholder: Option>, + has_sub: Option, + has_sup: Option, + expected_trait_ref: ty::TraitRef<'_>, + actual_trait_ref: ty::TraitRef<'_>, + vid: Option>, + expected_has_vid: Option, + actual_has_vid: Option, + any_self_ty_has_vid: bool, + ) { + // The weird thing here with the `maybe_highlighting_region` calls and the + // the match inside is meant to be like this: + // + // - The match checks whether the given things (placeholders, etc) appear + // in the types are about to print + // - Meanwhile, the `maybe_highlighting_region` calls set up + // highlights so that, if they do appear, we will replace + // them `'0` and whatever. (This replacement takes place + // inside the closure given to `maybe_highlighting_region`.) + // + // There is some duplication between the calls -- i.e., the + // `maybe_highlighting_region` checks if (e.g.) `has_sub` is + // None, an then we check again inside the closure, but this + // setup sort of minimized the number of calls and so form. + + RegionHighlightMode::maybe_highlighting_region(sub_placeholder, has_sub, || { + RegionHighlightMode::maybe_highlighting_region(sup_placeholder, has_sup, || { + match (has_sub, has_sup) { + (Some(n1), Some(n2)) => { + if any_self_ty_has_vid { + err.note(&format!( + "`{}` would have to be implemented for the type `{}`, \ + for any two lifetimes `'{}` and `'{}`", + expected_trait_ref, + expected_trait_ref.self_ty(), + std::cmp::min(n1, n2), + std::cmp::max(n1, n2), + )); + } else { + err.note(&format!( + "`{}` must implement `{}`, \ + for any two lifetimes `'{}` and `'{}`", + expected_trait_ref.self_ty(), + expected_trait_ref, + std::cmp::min(n1, n2), + std::cmp::max(n1, n2), + )); + } + } + (Some(n), _) | (_, Some(n)) => { + if any_self_ty_has_vid { + err.note(&format!( + "`{}` would have to be implemented for the type `{}`, \ + for any lifetime `'{}`", + expected_trait_ref, + expected_trait_ref.self_ty(), + n, + )); + } else { + err.note(&format!( + "`{}` must implement `{}`, for any lifetime `'{}`", + expected_trait_ref.self_ty(), + expected_trait_ref, + n, + )); + } + } + (None, None) => RegionHighlightMode::maybe_highlighting_region( + vid, + expected_has_vid, + || { + if let Some(n) = expected_has_vid { + err.note(&format!( + "`{}` would have to be implemented for the type `{}`, \ + for some specific lifetime `'{}`", + expected_trait_ref, + expected_trait_ref.self_ty(), + n, + )); + } else { + if any_self_ty_has_vid { + err.note(&format!( + "`{}` would have to be implemented for the type `{}`", + expected_trait_ref, + expected_trait_ref.self_ty(), + )); + } else { + err.note(&format!( + "`{}` must implement `{}`", + expected_trait_ref.self_ty(), + expected_trait_ref, + )); + } + } + }, + ), + } + }) + }); + + RegionHighlightMode::maybe_highlighting_region( + vid, + actual_has_vid, + || match actual_has_vid { + Some(n) => { + if any_self_ty_has_vid { + err.note(&format!( + "but `{}` is actually implemented for the type `{}`, \ + for some specific lifetime `'{}`", + actual_trait_ref, + actual_trait_ref.self_ty(), + n + )); + } else { + err.note(&format!( + "but `{}` actually implements `{}`, for some specific lifetime `'{}`", + actual_trait_ref.self_ty(), + actual_trait_ref, + n + )); + } + } + + _ => { + err.note(&format!( + "but `{}` is actually implemented for the type `{}`", + actual_trait_ref, + actual_trait_ref.self_ty(), + )); + } + }, + ); + } +} diff --git a/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs b/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs index 766173bf662..4331518d403 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Error Reporting for static impl Traits. use infer::error_reporting::nice_region_error::NiceRegionError; @@ -21,6 +11,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { pub(super) fn try_report_static_impl_trait(&self) -> Option { if let Some(ref error) = self.error { if let RegionResolutionError::SubSupConflict( + _, var_origin, sub_origin, sub_r, @@ -28,13 +19,13 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { sup_r, ) = error.clone() { - let anon_reg_sup = self.tcx.is_suitable_region(sup_r)?; + let anon_reg_sup = self.tcx().is_suitable_region(sup_r)?; if sub_r == &RegionKind::ReStatic && - self.tcx.return_type_impl_trait(anon_reg_sup.def_id).is_some() + self.tcx().return_type_impl_trait(anon_reg_sup.def_id).is_some() { let sp = var_origin.span(); let return_sp = sub_origin.span(); - let mut err = self.tcx.sess.struct_span_err( + let mut err = self.tcx().sess.struct_span_err( sp, "cannot infer an appropriate lifetime", ); @@ -47,7 +38,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { "...but this borrow...", ); - let (lifetime, lt_sp_opt) = self.tcx.msg_span_from_free_region(sup_r); + let (lifetime, lt_sp_opt) = self.tcx().msg_span_from_free_region(sup_r); if let Some(lifetime_sp) = lt_sp_opt { err.span_note( lifetime_sp, @@ -61,8 +52,8 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { }) => name.to_string(), _ => "'_".to_owned(), }; - if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(return_sp) { - err.span_suggestion_with_applicability( + if let Ok(snippet) = self.tcx().sess.source_map().span_to_snippet(return_sp) { + err.span_suggestion( return_sp, &format!( "you can add a constraint to the return type to make it last \ diff --git a/src/librustc/infer/error_reporting/nice_region_error/util.rs b/src/librustc/infer/error_reporting/nice_region_error/util.rs index 013c02f75b8..dd8a33829eb 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/util.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/util.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Helper functions corresponding to lifetime errors due to //! anonymous regions. @@ -54,13 +44,13 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { let (id, bound_region) = match *anon_region { ty::ReFree(ref free_region) => (free_region.scope, free_region.bound_region), ty::ReEarlyBound(ref ebr) => ( - self.tcx.parent_def_id(ebr.def_id).unwrap(), + self.tcx().parent_def_id(ebr.def_id).unwrap(), ty::BoundRegion::BrNamed(ebr.def_id, ebr.name), ), _ => return None, // not a free region }; - let hir = &self.tcx.hir; + let hir = &self.tcx().hir(); if let Some(node_id) = hir.as_local_node_id(id) { if let Some(body_id) = hir.maybe_body_owned_by(node_id) { let body = hir.body(body_id); @@ -76,7 +66,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { let arg_ty_span = hir.span(hir.hir_to_node_id(ty_hir_id)); let ty = tables.node_id_to_type_opt(arg.hir_id)?; let mut found_anon_region = false; - let new_arg_ty = self.tcx.fold_regions(&ty, &mut false, |r, _| { + let new_arg_ty = self.tcx().fold_regions(&ty, &mut false, |r, _| { if *r == *anon_region { found_anon_region = true; replace_region @@ -118,10 +108,10 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { br: ty::BoundRegion, decl: &hir::FnDecl, ) -> Option { - let ret_ty = self.tcx.type_of(scope_def_id); + let ret_ty = self.tcx().type_of(scope_def_id); if let ty::FnDef(_, _) = ret_ty.sty { - let sig = ret_ty.fn_sig(self.tcx); - let late_bound_regions = self.tcx + let sig = ret_ty.fn_sig(self.tcx()); + let late_bound_regions = self.tcx() .collect_referenced_late_bound_regions(&sig.output()); if late_bound_regions.iter().any(|r| *r == br) { return Some(decl.output.span()); @@ -136,7 +126,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { // enable E0621 for it. pub(super) fn is_self_anon(&self, is_first: bool, scope_def_id: DefId) -> bool { is_first - && self.tcx + && self.tcx() .opt_associated_item(scope_def_id) .map(|i| i.method_has_self_argument) == Some(true) } diff --git a/src/librustc/infer/error_reporting/note.rs b/src/librustc/infer/error_reporting/note.rs index a539c321af3..e45a4b17cdd 100644 --- a/src/librustc/infer/error_reporting/note.rs +++ b/src/librustc/infer/error_reporting/note.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::{self, InferCtxt, SubregionOrigin}; use middle::region; use ty::{self, Region}; @@ -41,8 +31,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { "...so that reference does not outlive borrowed content"); } infer::ReborrowUpvar(span, ref upvar_id) => { - let var_node_id = self.tcx.hir.hir_to_node_id(upvar_id.var_path.hir_id); - let var_name = self.tcx.hir.name(var_node_id); + let var_node_id = self.tcx.hir().hir_to_node_id(upvar_id.var_path.hir_id); + let var_name = self.tcx.hir().name(var_node_id); err.span_note(span, &format!("...so that closure can access `{}`", var_name)); } @@ -61,7 +51,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { err.span_note(span, &format!("...so that captured variable `{}` does not outlive the \ enclosing closure", - self.tcx.hir.name(id))); + self.tcx.hir().name(id))); } infer::IndexSlice(span) => { err.span_note(span, "...so that slice is not indexed outside the lifetime"); @@ -174,8 +164,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { err } infer::ReborrowUpvar(span, ref upvar_id) => { - let var_node_id = self.tcx.hir.hir_to_node_id(upvar_id.var_path.hir_id); - let var_name = self.tcx.hir.name(var_node_id); + let var_node_id = self.tcx.hir().hir_to_node_id(upvar_id.var_path.hir_id); + let var_name = self.tcx.hir().name(var_node_id); let mut err = struct_span_err!(self.tcx.sess, span, E0313, @@ -232,7 +222,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { E0474, "captured variable `{}` does not outlive the \ enclosing closure", - self.tcx.hir.name(id)); + self.tcx.hir().name(id)); self.tcx.note_and_explain_region(region_scope_tree, &mut err, "captured variable is valid for ", sup, ""); self.tcx.note_and_explain_region(region_scope_tree, &mut err, @@ -452,4 +442,24 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } } + + pub(super) fn report_placeholder_failure( + &self, + region_scope_tree: ®ion::ScopeTree, + placeholder_origin: SubregionOrigin<'tcx>, + sub: Region<'tcx>, + sup: Region<'tcx>, + ) -> DiagnosticBuilder<'tcx> { + // I can't think how to do better than this right now. -nikomatsakis + match placeholder_origin { + infer::Subtype(trace) => { + let terr = TypeError::RegionsPlaceholderMismatch; + self.report_and_explain_type_error(trace, &terr) + } + + _ => { + self.report_concrete_failure(region_scope_tree, placeholder_origin, sub, sup) + } + } + } } diff --git a/src/librustc/infer/freshen.rs b/src/librustc/infer/freshen.rs index b53444992fa..74abcf82529 100644 --- a/src/librustc/infer/freshen.rs +++ b/src/librustc/infer/freshen.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Freshening is the process of replacing unknown variables with fresh types. The idea is that //! the type, after freshening, contains no inference variables but instead contains either a //! value for each variable or fresh "arbitrary" types wherever a variable would have been. @@ -170,9 +160,6 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> { t } - ty::Bound(..) => - bug!("encountered bound ty during freshening"), - ty::Generator(..) | ty::Bool | ty::Char | @@ -200,6 +187,9 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> { ty::Opaque(..) => { t.super_fold_with(self) } + + ty::Placeholder(..) | + ty::Bound(..) => bug!("unexpected type {:?}", t), } } } diff --git a/src/librustc/infer/fudge.rs b/src/librustc/infer/fudge.rs index 39dc24b86e7..a38db5d210f 100644 --- a/src/librustc/infer/fudge.rs +++ b/src/librustc/infer/fudge.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::type_variable::TypeVariableMap; use ty::{self, Ty, TyCtxt}; use ty::fold::{TypeFoldable, TypeFolder}; diff --git a/src/librustc/infer/glb.rs b/src/librustc/infer/glb.rs index 8968c5949b6..635a6d00270 100644 --- a/src/librustc/infer/glb.rs +++ b/src/librustc/infer/glb.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::combine::CombineFields; use super::InferCtxt; use super::lattice::{self, LatticeDir}; diff --git a/src/librustc/infer/higher_ranked/README.md b/src/librustc/infer/higher_ranked/README.md index b1ac8bae4fb..e7afaa5beb0 100644 --- a/src/librustc/infer/higher_ranked/README.md +++ b/src/librustc/infer/higher_ranked/README.md @@ -1,403 +1,8 @@ -# Skolemization and functions +To learn more about how Higher-ranked trait bounds work in the _old_ trait +solver, see [this chapter][oldhrtb] of the rustc-guide. -One of the trickiest and most subtle aspects of regions is dealing -with higher-ranked things which include bound region variables, such -as function types. I strongly suggest that if you want to understand -the situation, you read this paper (which is, admittedly, very long, -but you don't have to read the whole thing): +To learn more about how they work in the _new_ trait solver, see [this +chapter][newhrtb]. -http://research.microsoft.com/en-us/um/people/simonpj/papers/higher-rank/ - -Although my explanation will never compete with SPJ's (for one thing, -his is approximately 100 pages), I will attempt to explain the basic -problem and also how we solve it. Note that the paper only discusses -subtyping, not the computation of LUB/GLB. - -The problem we are addressing is that there is a kind of subtyping -between functions with bound region parameters. Consider, for -example, whether the following relation holds: - - for<'a> fn(&'a isize) <: for<'b> fn(&'b isize)? (Yes, a => b) - -The answer is that of course it does. These two types are basically -the same, except that in one we used the name `a` and one we used -the name `b`. - -In the examples that follow, it becomes very important to know whether -a lifetime is bound in a function type (that is, is a lifetime -parameter) or appears free (is defined in some outer scope). -Therefore, from now on I will always write the bindings explicitly, -using the Rust syntax `for<'a> fn(&'a isize)` to indicate that `a` is a -lifetime parameter. - -Now let's consider two more function types. Here, we assume that the -`'b` lifetime is defined somewhere outside and hence is not a lifetime -parameter bound by the function type (it "appears free"): - - for<'a> fn(&'a isize) <: fn(&'b isize)? (Yes, a => b) - -This subtyping relation does in fact hold. To see why, you have to -consider what subtyping means. One way to look at `T1 <: T2` is to -say that it means that it is always ok to treat an instance of `T1` as -if it had the type `T2`. So, with our functions, it is always ok to -treat a function that can take pointers with any lifetime as if it -were a function that can only take a pointer with the specific -lifetime `'b`. After all, `'b` is a lifetime, after all, and -the function can take values of any lifetime. - -You can also look at subtyping as the *is a* relationship. This amounts -to the same thing: a function that accepts pointers with any lifetime -*is a* function that accepts pointers with some specific lifetime. - -So, what if we reverse the order of the two function types, like this: - - fn(&'b isize) <: for<'a> fn(&'a isize)? (No) - -Does the subtyping relationship still hold? The answer of course is -no. In this case, the function accepts *only the lifetime `'b`*, -so it is not reasonable to treat it as if it were a function that -accepted any lifetime. - -What about these two examples: - - for<'a,'b> fn(&'a isize, &'b isize) <: for<'a> fn(&'a isize, &'a isize)? (Yes) - for<'a> fn(&'a isize, &'a isize) <: for<'a,'b> fn(&'a isize, &'b isize)? (No) - -Here, it is true that functions which take two pointers with any two -lifetimes can be treated as if they only accepted two pointers with -the same lifetime, but not the reverse. - -## The algorithm - -Here is the algorithm we use to perform the subtyping check: - -1. Replace all bound regions in the subtype with new variables -2. Replace all bound regions in the supertype with placeholder - equivalents. A "placeholder" region is just a new fresh region - name. -3. Check that the parameter and return types match as normal -4. Ensure that no placeholder regions 'leak' into region variables - visible from "the outside" - -Let's walk through some examples and see how this algorithm plays out. - -#### First example - -We'll start with the first example, which was: - - 1. for<'a> fn(&'a T) <: for<'b> fn(&'b T)? Yes: a -> b - -After steps 1 and 2 of the algorithm we will have replaced the types -like so: - - 1. fn(&'A T) <: fn(&'x T)? - -Here the upper case `&A` indicates a *region variable*, that is, a -region whose value is being inferred by the system. I also replaced -`&b` with `&x`---I'll use letters late in the alphabet (`x`, `y`, `z`) -to indicate placeholder region names. We can assume they don't appear -elsewhere. Note that neither the sub- nor the supertype bind any -region names anymore (as indicated by the absence of `<` and `>`). - -The next step is to check that the parameter types match. Because -parameters are contravariant, this means that we check whether: - - &'x T <: &'A T - -Region pointers are contravariant so this implies that - - &A <= &x - -must hold, where `<=` is the subregion relationship. Processing -*this* constrain simply adds a constraint into our graph that `&A <= -&x` and is considered successful (it can, for example, be satisfied by -choosing the value `&x` for `&A`). - -So far we have encountered no error, so the subtype check succeeds. - -#### The third example - -Now let's look first at the third example, which was: - - 3. fn(&'a T) <: for<'b> fn(&'b T)? No! - -After steps 1 and 2 of the algorithm we will have replaced the types -like so: - - 3. fn(&'a T) <: fn(&'x T)? - -This looks pretty much the same as before, except that on the LHS -`'a` was not bound, and hence was left as-is and not replaced with -a variable. The next step is again to check that the parameter types -match. This will ultimately require (as before) that `'a` <= `&x` -must hold: but this does not hold. `self` and `x` are both distinct -free regions. So the subtype check fails. - -#### Checking for placeholder leaks - -You may be wondering about that mysterious last step in the algorithm. -So far it has not been relevant. The purpose of that last step is to -catch something like *this*: - - for<'a> fn() -> fn(&'a T) <: fn() -> for<'b> fn(&'b T)? No. - -Here the function types are the same but for where the binding occurs. -The subtype returns a function that expects a value in precisely one -region. The supertype returns a function that expects a value in any -region. If we allow an instance of the subtype to be used where the -supertype is expected, then, someone could call the fn and think that -the return value has type `fn(&'b T)` when it really has type -`fn(&'a T)` (this is case #3, above). Bad. - -So let's step through what happens when we perform this subtype check. -We first replace the bound regions in the subtype (the supertype has -no bound regions). This gives us: - - fn() -> fn(&'A T) <: fn() -> for<'b> fn(&'b T)? - -Now we compare the return types, which are covariant, and hence we have: - - fn(&'A T) <: for<'b> fn(&'b T)? - -Here we replace the bound region in the supertype with a placeholder to yield: - - fn(&'A T) <: fn(&'x T)? - -And then proceed to compare the argument types: - - &'x T <: &'A T - 'A <= 'x - -Finally, this is where it gets interesting! This is where an error -*should* be reported. But in fact this will not happen. The reason why -is that `A` is a variable: we will infer that its value is the fresh -region `x` and think that everything is happy. In fact, this behavior -is *necessary*, it was key to the first example we walked through. - -The difference between this example and the first one is that the variable -`A` already existed at the point where the placeholders were added. In -the first example, you had two functions: - - for<'a> fn(&'a T) <: for<'b> fn(&'b T) - -and hence `&A` and `&x` were created "together". In general, the -intention of the placeholder names is that they are supposed to be -fresh names that could never be equal to anything from the outside. -But when inference comes into play, we might not be respecting this -rule. - -So the way we solve this is to add a fourth step that examines the -constraints that refer to placeholder names. Basically, consider a -non-directed version of the constraint graph. Let `Tainted(x)` be the -set of all things reachable from a placeholder variable `x`. -`Tainted(x)` should not contain any regions that existed before the -step at which the placeholders were created. So this case here -would fail because `&x` was created alone, but is relatable to `&A`. - -## Computing the LUB and GLB - -The paper I pointed you at is written for Haskell. It does not -therefore considering subtyping and in particular does not consider -LUB or GLB computation. We have to consider this. Here is the -algorithm I implemented. - -First though, let's discuss what we are trying to compute in more -detail. The LUB is basically the "common supertype" and the GLB is -"common subtype"; one catch is that the LUB should be the -*most-specific* common supertype and the GLB should be *most general* -common subtype (as opposed to any common supertype or any common -subtype). - -Anyway, to help clarify, here is a table containing some function -pairs and their LUB/GLB (for conciseness, in this table, I'm just -including the lifetimes here, not the rest of the types, and I'm -writing `fn<>` instead of `for<> fn`): - -``` -Type 1 Type 2 LUB GLB -fn<'a>('a) fn('X) fn('X) fn<'a>('a) -fn('a) fn('X) -- fn<'a>('a) -fn<'a,'b>('a, 'b) fn<'x>('x, 'x) fn<'a>('a, 'a) fn<'a,'b>('a, 'b) -fn<'a,'b>('a, 'b, 'a) fn<'x,'y>('x, 'y, 'y) fn<'a>('a, 'a, 'a) fn<'a,'b,'c>('a,'b,'c) -``` - -### Conventions - -I use lower-case letters (e.g., `&a`) for bound regions and upper-case -letters for free regions (`&A`). Region variables written with a -dollar-sign (e.g., `$a`). I will try to remember to enumerate the -bound-regions on the fn type as well (e.g., `for<'a> fn(&a)`). - -### High-level summary - -Both the LUB and the GLB algorithms work in a similar fashion. They -begin by replacing all bound regions (on both sides) with fresh region -inference variables. Therefore, both functions are converted to types -that contain only free regions. We can then compute the LUB/GLB in a -straightforward way, as described in `combine.rs`. This results in an -interim type T. The algorithms then examine the regions that appear -in T and try to, in some cases, replace them with bound regions to -yield the final result. - -To decide whether to replace a region `R` that appears in `T` with -a bound region, the algorithms make use of two bits of -information. First is a set `V` that contains all region -variables created as part of the LUB/GLB computation (roughly; see -`region_vars_confined_to_snapshot()` for full details). `V` will -contain the region variables created to replace the bound regions -in the input types, but it also contains 'intermediate' variables -created to represent the LUB/GLB of individual regions. -Basically, when asked to compute the LUB/GLB of a region variable -with another region, the inferencer cannot oblige immediately -since the values of that variables are not known. Therefore, it -creates a new variable that is related to the two regions. For -example, the LUB of two variables `$x` and `$y` is a fresh -variable `$z` that is constrained such that `$x <= $z` and `$y <= -$z`. So `V` will contain these intermediate variables as well. - -The other important factor in deciding how to replace a region in T is -the function `Tainted($r)` which, for a region variable, identifies -all regions that the region variable is related to in some way -(`Tainted()` made an appearance in the subtype computation as well). - -### LUB - -The LUB algorithm proceeds in three steps: - -1. Replace all bound regions (on both sides) with fresh region - inference variables. -2. Compute the LUB "as normal", meaning compute the GLB of each - pair of argument types and the LUB of the return types and - so forth. Combine those to a new function type `F`. -3. Replace each region `R` that appears in `F` as follows: - - Let `V` be the set of variables created during the LUB - computational steps 1 and 2, as described in the previous section. - - If `R` is not in `V`, replace `R` with itself. - - If `Tainted(R)` contains a region that is not in `V`, - replace `R` with itself. - - Otherwise, select the earliest variable in `Tainted(R)` that originates - from the left-hand side and replace `R` with the bound region that - this variable was a replacement for. - -So, let's work through the simplest example: `fn(&A)` and `for<'a> fn(&a)`. -In this case, `&a` will be replaced with `$a` and the interim LUB type -`fn($b)` will be computed, where `$b=GLB(&A,$a)`. Therefore, `V = -{$a, $b}` and `Tainted($b) = { $b, $a, &A }`. When we go to replace -`$b`, we find that since `&A \in Tainted($b)` is not a member of `V`, -we leave `$b` as is. When region inference happens, `$b` will be -resolved to `&A`, as we wanted. - -Let's look at a more complex one: `fn(&a, &b)` and `fn(&x, &x)`. In -this case, we'll end up with a (pre-replacement) LUB type of `fn(&g, -&h)` and a graph that looks like: - -``` - $a $b *--$x - \ \ / / - \ $h-* / - $g-----------* -``` - -Here `$g` and `$h` are fresh variables that are created to represent -the LUB/GLB of things requiring inference. This means that `V` and -`Tainted` will look like: - -``` -V = {$a, $b, $g, $h, $x} -Tainted($g) = Tainted($h) = { $a, $b, $h, $g, $x } -``` - -Therefore we replace both `$g` and `$h` with `$a`, and end up -with the type `fn(&a, &a)`. - -### GLB - -The procedure for computing the GLB is similar. The difference lies -in computing the replacements for the various variables. For each -region `R` that appears in the type `F`, we again compute `Tainted(R)` -and examine the results: - -1. If `R` is not in `V`, it is not replaced. -2. Else, if `Tainted(R)` contains only variables in `V`, and it - contains exactly one variable from the LHS and one variable from - the RHS, then `R` can be mapped to the bound version of the - variable from the LHS. -3. Else, if `Tainted(R)` contains no variable from the LHS and no - variable from the RHS, then `R` can be mapped to itself. -4. Else, `R` is mapped to a fresh bound variable. - -These rules are pretty complex. Let's look at some examples to see -how they play out. - -Out first example was `fn(&a)` and `fn(&X)`. In this case, `&a` will -be replaced with `$a` and we will ultimately compute a -(pre-replacement) GLB type of `fn($g)` where `$g=LUB($a,&X)`. -Therefore, `V={$a,$g}` and `Tainted($g)={$g,$a,&X}. To find the -replacement for `$g` we consult the rules above: -- Rule (1) does not apply because `$g \in V` -- Rule (2) does not apply because `&X \in Tainted($g)` -- Rule (3) does not apply because `$a \in Tainted($g)` -- Hence, by rule (4), we replace `$g` with a fresh bound variable `&z`. -So our final result is `fn(&z)`, which is correct. - -The next example is `fn(&A)` and `fn(&Z)`. In this case, we will again -have a (pre-replacement) GLB of `fn(&g)`, where `$g = LUB(&A,&Z)`. -Therefore, `V={$g}` and `Tainted($g) = {$g, &A, &Z}`. In this case, -by rule (3), `$g` is mapped to itself, and hence the result is -`fn($g)`. This result is correct (in this case, at least), but it is -indicative of a case that *can* lead us into concluding that there is -no GLB when in fact a GLB does exist. See the section "Questionable -Results" below for more details. - -The next example is `fn(&a, &b)` and `fn(&c, &c)`. In this case, as -before, we'll end up with `F=fn($g, $h)` where `Tainted($g) = -Tainted($h) = {$g, $h, $a, $b, $c}`. Only rule (4) applies and hence -we'll select fresh bound variables `y` and `z` and wind up with -`fn(&y, &z)`. - -For the last example, let's consider what may seem trivial, but is -not: `fn(&a, &a)` and `fn(&b, &b)`. In this case, we'll get `F=fn($g, -$h)` where `Tainted($g) = {$g, $a, $x}` and `Tainted($h) = {$h, $a, -$x}`. Both of these sets contain exactly one bound variable from each -side, so we'll map them both to `&a`, resulting in `fn(&a, &a)`, which -is the desired result. - -### Shortcomings and correctness - -You may be wondering whether this algorithm is correct. The answer is -"sort of". There are definitely cases where they fail to compute a -result even though a correct result exists. I believe, though, that -if they succeed, then the result is valid, and I will attempt to -convince you. The basic argument is that the "pre-replacement" step -computes a set of constraints. The replacements, then, attempt to -satisfy those constraints, using bound identifiers where needed. - -For now I will briefly go over the cases for LUB/GLB and identify -their intent: - -- LUB: - - The region variables that are substituted in place of bound regions - are intended to collect constraints on those bound regions. - - If Tainted(R) contains only values in V, then this region is unconstrained - and can therefore be generalized, otherwise it cannot. -- GLB: - - The region variables that are substituted in place of bound regions - are intended to collect constraints on those bound regions. - - If Tainted(R) contains exactly one variable from each side, and - only variables in V, that indicates that those two bound regions - must be equated. - - Otherwise, if Tainted(R) references any variables from left or right - side, then it is trying to combine a bound region with a free one or - multiple bound regions, so we need to select fresh bound regions. - -Sorry this is more of a shorthand to myself. I will try to write up something -more convincing in the future. - -#### Where are the algorithms wrong? - -- The pre-replacement computation can fail even though using a - bound-region would have succeeded. -- We will compute GLB(fn(fn($a)), fn(fn($b))) as fn($c) where $c is the - GLB of $a and $b. But if inference finds that $a and $b must be mapped - to regions without a GLB, then this is effectively a failure to compute - the GLB. However, the result `fn<$c>(fn($c))` is a valid GLB. +[oldhrtb]: https://rust-lang.github.io/rustc-guide/traits/hrtb.html +[newhrtb]: https://rust-lang.github.io/rustc-guide/borrow_check/region_inference.html#placeholders-and-universes diff --git a/src/librustc/infer/higher_ranked/mod.rs b/src/librustc/infer/higher_ranked/mod.rs index 8172f620c36..709e8c0ba9b 100644 --- a/src/librustc/infer/higher_ranked/mod.rs +++ b/src/librustc/infer/higher_ranked/mod.rs @@ -1,41 +1,23 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Helper routines for higher-ranked things. See the `doc` module at //! the end of the file for details. -use super::{CombinedSnapshot, - InferCtxt, - HigherRankedType, - SubregionOrigin, - PlaceholderMap}; use super::combine::CombineFields; -use super::region_constraints::{TaintDirections}; +use super::{HigherRankedType, InferCtxt, PlaceholderMap}; -use ty::{self, TyCtxt, Binder, TypeFoldable}; -use ty::error::TypeError; use ty::relate::{Relate, RelateResult, TypeRelation}; -use syntax_pos::Span; -use util::nodemap::{FxHashMap, FxHashSet}; - -pub struct HrMatchResult { - pub value: U, -} +use ty::{self, Binder, TypeFoldable}; impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> { - pub fn higher_ranked_sub(&mut self, a: &Binder, b: &Binder, a_is_expected: bool) - -> RelateResult<'tcx, Binder> - where T: Relate<'tcx> + pub fn higher_ranked_sub( + &mut self, + a: &Binder, + b: &Binder, + a_is_expected: bool, + ) -> RelateResult<'tcx, Binder> + where + T: Relate<'tcx>, { - debug!("higher_ranked_sub(a={:?}, b={:?})", - a, b); + debug!("higher_ranked_sub(a={:?}, b={:?})", a, b); // Rather than checking the subtype relationship between `a` and `b` // as-is, we need to do some extra work here in order to make sure @@ -45,277 +27,35 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> { // please see the large comment at the end of the file in the (inlined) module // `doc`. - // Start a snapshot so we can examine "all bindings that were - // created as part of this type comparison". - return self.infcx.commit_if_ok(|snapshot| { - let span = self.trace.cause.span; - - // First, we instantiate each bound region in the supertype with a - // fresh placeholder region. - let (b_prime, placeholder_map) = - self.infcx.replace_late_bound_regions_with_placeholders(b); + let span = self.trace.cause.span; - // Next, we instantiate each bound region in the subtype - // with a fresh region variable. These region variables -- - // but no other pre-existing region variables -- can name - // the placeholders. - let (a_prime, _) = self.infcx.replace_bound_vars_with_fresh_vars( - span, - HigherRankedType, - a - ); + // First, we instantiate each bound region in the supertype with a + // fresh placeholder region. + let (b_prime, _) = self.infcx.replace_bound_vars_with_placeholders(b); - debug!("a_prime={:?}", a_prime); - debug!("b_prime={:?}", b_prime); + // Next, we instantiate each bound region in the subtype + // with a fresh region variable. These region variables -- + // but no other pre-existing region variables -- can name + // the placeholders. + let (a_prime, _) = + self.infcx + .replace_bound_vars_with_fresh_vars(span, HigherRankedType, a); - // Compare types now that bound regions have been replaced. - let result = self.sub(a_is_expected).relate(&a_prime, &b_prime)?; + debug!("a_prime={:?}", a_prime); + debug!("b_prime={:?}", b_prime); - // Presuming type comparison succeeds, we need to check - // that the placeholder regions do not "leak". - self.infcx.leak_check(!a_is_expected, span, &placeholder_map, snapshot)?; + // Compare types now that bound regions have been replaced. + let result = self.sub(a_is_expected).relate(&a_prime, &b_prime)?; - // We are finished with the placeholder regions now so pop - // them off. - self.infcx.pop_placeholders(placeholder_map, snapshot); + debug!("higher_ranked_sub: OK result={:?}", result); - debug!("higher_ranked_sub: OK result={:?}", result); - - Ok(ty::Binder::bind(result)) - }); + Ok(ty::Binder::bind(result)) } - - /// The value consists of a pair `(t, u)` where `t` is the - /// *matcher* and `u` is a *value*. The idea is to find a - /// substitution `S` such that `S(t) == b`, and then return - /// `S(u)`. In other words, find values for the late-bound regions - /// in `a` that can make `t == b` and then replace the LBR in `u` - /// with those values. - /// - /// This routine is (as of this writing) used in trait matching, - /// particularly projection. - /// - /// NB. It should not happen that there are LBR appearing in `U` - /// that do not appear in `T`. If that happens, those regions are - /// unconstrained, and this routine replaces them with `'static`. - pub fn higher_ranked_match(&mut self, - a_pair: &Binder<(T, U)>, - b_match: &T, - a_is_expected: bool) - -> RelateResult<'tcx, HrMatchResult> - where T: Relate<'tcx>, - U: TypeFoldable<'tcx> - { - debug!("higher_ranked_match(a={:?}, b={:?})", - a_pair, b_match); - - // Start a snapshot so we can examine "all bindings that were - // created as part of this type comparison". - return self.infcx.commit_if_ok(|snapshot| { - // First, we instantiate each bound region in the matcher - // with a placeholder region. - let ((a_match, a_value), placeholder_map) = - self.infcx.replace_late_bound_regions_with_placeholders(a_pair); - - debug!("higher_ranked_match: a_match={:?}", a_match); - debug!("higher_ranked_match: placeholder_map={:?}", placeholder_map); - - // Equate types now that bound regions have been replaced. - self.equate(a_is_expected).relate(&a_match, &b_match)?; - - // Map each placeholder region to a vector of other regions that it - // must be equated with. (Note that this vector may include other - // placeholder regions from `placeholder_map`.) - let placeholder_resolution_map: FxHashMap<_, _> = - placeholder_map - .iter() - .map(|(&br, &placeholder)| { - let tainted_regions = - self.infcx.tainted_regions(snapshot, - placeholder, - TaintDirections::incoming()); // [1] - - // [1] this routine executes after the placeholder - // regions have been *equated* with something - // else, so examining the incoming edges ought to - // be enough to collect all constraints - - (placeholder, (br, tainted_regions)) - }) - .collect(); - - // For each placeholder region, pick a representative -- which can - // be any region from the sets above, except for other members of - // `placeholder_map`. There should always be a representative if things - // are properly well-formed. - let placeholder_representatives: FxHashMap<_, _> = - placeholder_resolution_map - .iter() - .map(|(&placeholder, &(_, ref regions))| { - let representative = - regions.iter() - .filter(|&&r| !placeholder_resolution_map.contains_key(r)) - .cloned() - .next() - .unwrap_or_else(|| { - bug!("no representative region for `{:?}` in `{:?}`", - placeholder, regions) - }); - - (placeholder, representative) - }) - .collect(); - - // Equate all the members of each placeholder set with the - // representative. - for (placeholder, &(_br, ref regions)) in &placeholder_resolution_map { - let representative = &placeholder_representatives[placeholder]; - debug!("higher_ranked_match: \ - placeholder={:?} representative={:?} regions={:?}", - placeholder, representative, regions); - for region in regions.iter() - .filter(|&r| !placeholder_resolution_map.contains_key(r)) - .filter(|&r| r != representative) - { - let origin = SubregionOrigin::Subtype(self.trace.clone()); - self.infcx.borrow_region_constraints() - .make_eqregion(origin, - *representative, - *region); - } - } - - // Replace the placeholder regions appearing in value with - // their representatives - let a_value = - fold_regions_in( - self.tcx(), - &a_value, - |r, _| placeholder_representatives.get(&r).cloned().unwrap_or(r)); - - debug!("higher_ranked_match: value={:?}", a_value); - - // We are now done with these placeholder variables. - self.infcx.pop_placeholders(placeholder_map, snapshot); - - Ok(HrMatchResult { value: a_value }) - }); - } -} - -fn fold_regions_in<'a, 'gcx, 'tcx, T, F>(tcx: TyCtxt<'a, 'gcx, 'tcx>, - unbound_value: &T, - mut fldr: F) - -> T - where T: TypeFoldable<'tcx>, - F: FnMut(ty::Region<'tcx>, ty::DebruijnIndex) -> ty::Region<'tcx>, -{ - tcx.fold_regions(unbound_value, &mut false, |region, current_depth| { - // we should only be encountering "escaping" late-bound regions here, - // because the ones at the current level should have been replaced - // with fresh variables - assert!(match *region { - ty::ReLateBound(..) => false, - _ => true - }); - - fldr(region, current_depth) - }) } impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { - fn tainted_regions(&self, - snapshot: &CombinedSnapshot<'a, 'tcx>, - r: ty::Region<'tcx>, - directions: TaintDirections) - -> FxHashSet> { - self.borrow_region_constraints().tainted( - self.tcx, - &snapshot.region_constraints_snapshot, - r, - directions) - } - - fn region_vars_confined_to_snapshot(&self, - snapshot: &CombinedSnapshot<'a, 'tcx>) - -> Vec - { - /*! - * Returns the set of region variables that do not affect any - * types/regions which existed before `snapshot` was - * started. This is used in the sub/lub/glb computations. The - * idea here is that when we are computing lub/glb of two - * regions, we sometimes create intermediate region variables. - * Those region variables may touch some of the placeholder or - * other "forbidden" regions we created to replace bound - * regions, but they don't really represent an "external" - * constraint. - * - * However, sometimes fresh variables are created for other - * purposes too, and those *may* represent an external - * constraint. In particular, when a type variable is - * instantiated, we create region variables for all the - * regions that appear within, and if that type variable - * pre-existed the snapshot, then those region variables - * represent external constraints. - * - * An example appears in the unit test - * `sub_free_bound_false_infer`. In this test, we want to - * know whether - * - * ```rust - * fn(_#0t) <: for<'a> fn(&'a int) - * ``` - * - * Note that the subtype has a type variable. Because the type - * variable can't be instantiated with a region that is bound - * in the fn signature, this comparison ought to fail. But if - * we're not careful, it will succeed. - * - * The reason is that when we walk through the subtyping - * algorithm, we begin by replacing `'a` with a placeholder - * variable `'1`. We then have `fn(_#0t) <: fn(&'1 int)`. This - * can be made true by unifying `_#0t` with `&'1 int`. In the - * process, we create a fresh variable for the placeholder - * region, `'$2`, and hence we have that `_#0t == &'$2 - * int`. However, because `'$2` was created during the sub - * computation, if we're not careful we will erroneously - * assume it is one of the transient region variables - * representing a lub/glb internally. Not good. - * - * To prevent this, we check for type variables which were - * unified during the snapshot, and say that any region - * variable created during the snapshot but which finds its - * way into a type variable is considered to "escape" the - * snapshot. - */ - - let mut region_vars = - self.borrow_region_constraints().vars_created_since_snapshot( - &snapshot.region_constraints_snapshot); - - let escaping_types = - self.type_variables.borrow_mut().types_escaping_snapshot(&snapshot.type_snapshot); - - let mut escaping_region_vars = FxHashSet::default(); - for ty in &escaping_types { - self.tcx.collect_regions(ty, &mut escaping_region_vars); - } - - region_vars.retain(|®ion_vid| { - let r = ty::ReVar(region_vid); - !escaping_region_vars.contains(&r) - }); - - debug!("region_vars_confined_to_snapshot: region_vars={:?} escaping_types={:?}", - region_vars, - escaping_types); - - region_vars - } - - /// Replace all regions bound by `binder` with placeholder regions and - /// return a map indicating which bound-region was replaced with what + /// Replace all regions (resp. types) bound by `binder` with placeholder + /// regions (resp. types) and return a map indicating which bound-region /// placeholder region. This is the first step of checking subtyping /// when higher-ranked things are involved. /// @@ -329,229 +69,39 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// For more information about how placeholders and HRTBs work, see /// the [rustc guide]. /// - /// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/hrtb.html - pub fn replace_late_bound_regions_with_placeholders( + /// [rustc guide]: https://rust-lang.github.io/rustc-guide/traits/hrtb.html + pub fn replace_bound_vars_with_placeholders( &self, - binder: &ty::Binder, + binder: &ty::Binder ) -> (T, PlaceholderMap<'tcx>) where - T : TypeFoldable<'tcx>, + T: TypeFoldable<'tcx> { let next_universe = self.create_next_universe(); - let (result, map) = self.tcx.replace_late_bound_regions(binder, |br| { - self.tcx.mk_region(ty::RePlaceholder(ty::Placeholder { + let fld_r = |br| { + self.tcx.mk_region(ty::RePlaceholder(ty::PlaceholderRegion { universe: next_universe, name: br, })) - }); - - debug!("replace_late_bound_regions_with_placeholders(binder={:?}, result={:?}, map={:?})", - binder, - result, - map); - - (result, map) - } - - /// Searches the region constraints created since `snapshot` was started - /// and checks to determine whether any of the placeholder regions created - /// in `placeholder_map` would "escape" -- meaning that they are related to - /// other regions in some way. If so, the higher-ranked subtyping doesn't - /// hold. See `README.md` for more details. - pub fn leak_check(&self, - overly_polymorphic: bool, - _span: Span, - placeholder_map: &PlaceholderMap<'tcx>, - snapshot: &CombinedSnapshot<'a, 'tcx>) - -> RelateResult<'tcx, ()> - { - debug!("leak_check: placeholder_map={:?}", - placeholder_map); + }; - // If the user gave `-Zno-leak-check`, then skip the leak - // check completely. This is wildly unsound and also not - // unlikely to cause an ICE or two. It is intended for use - // only during a transition period, in which the MIR typeck - // uses the "universe-style" check, and the rest of typeck - // uses the more conservative leak check. Since the leak - // check is more conservative, we can't test the - // universe-style check without disabling it. - if self.tcx.sess.opts.debugging_opts.no_leak_check { - return Ok(()); - } - - let new_vars = self.region_vars_confined_to_snapshot(snapshot); - for (&placeholder_br, &placeholder) in placeholder_map { - // The inputs to a placeholder variable can only - // be itself or other new variables. - let incoming_taints = self.tainted_regions(snapshot, - placeholder, - TaintDirections::both()); - for &tainted_region in &incoming_taints { - // Each placeholder should only be relatable to itself - // or new variables: - match *tainted_region { - ty::ReVar(vid) => { - if new_vars.contains(&vid) { - continue; - } - } - _ => { - if tainted_region == placeholder { continue; } - } - }; - - debug!("{:?} (which replaced {:?}) is tainted by {:?}", - placeholder, - placeholder_br, - tainted_region); - - return Err(if overly_polymorphic { - debug!("Overly polymorphic!"); - TypeError::RegionsOverlyPolymorphic(placeholder_br, tainted_region) - } else { - debug!("Not as polymorphic!"); - TypeError::RegionsInsufficientlyPolymorphic(placeholder_br, tainted_region) - }) - } - } - - Ok(()) - } - - /// This code converts from placeholder regions back to late-bound - /// regions. It works by replacing each region in the taint set of a - /// placeholder region with a bound-region. The bound region will be bound - /// by the outer-most binder in `value`; the caller must ensure that there is - /// such a binder and it is the right place. - /// - /// This routine is only intended to be used when the leak-check has - /// passed; currently, it's used in the trait matching code to create - /// a set of nested obligations from an impl that matches against - /// something higher-ranked. More details can be found in - /// `librustc/middle/traits/README.md`. - /// - /// As a brief example, consider the obligation `for<'a> Fn(&'a int) - /// -> &'a int`, and the impl: - /// - /// impl Fn for SomethingOrOther - /// where A : Clone - /// { ... } - /// - /// Here we will have replaced `'a` with a placeholder region - /// `'0`. This means that our substitution will be `{A=>&'0 - /// int, R=>&'0 int}`. - /// - /// When we apply the substitution to the bounds, we will wind up with - /// `&'0 int : Clone` as a predicate. As a last step, we then go and - /// replace `'0` with a late-bound region `'a`. The depth is matched - /// to the depth of the predicate, in this case 1, so that the final - /// predicate is `for<'a> &'a int : Clone`. - pub fn plug_leaks(&self, - placeholder_map: PlaceholderMap<'tcx>, - snapshot: &CombinedSnapshot<'a, 'tcx>, - value: T) -> T - where T : TypeFoldable<'tcx> - { - debug!("plug_leaks(placeholder_map={:?}, value={:?})", - placeholder_map, - value); - - if placeholder_map.is_empty() { - return value; - } - - // Compute a mapping from the "taint set" of each placeholder - // region back to the `ty::BoundRegion` that it originally - // represented. Because `leak_check` passed, we know that - // these taint sets are mutually disjoint. - let inv_placeholder_map: FxHashMap, ty::BoundRegion> = - placeholder_map - .iter() - .flat_map(|(&placeholder_br, &placeholder)| { - self.tainted_regions(snapshot, placeholder, TaintDirections::both()) - .into_iter() - .map(move |tainted_region| (tainted_region, placeholder_br)) - }) - .collect(); - - debug!("plug_leaks: inv_placeholder_map={:?}", - inv_placeholder_map); - - // Remove any instantiated type variables from `value`; those can hide - // references to regions from the `fold_regions` code below. - let value = self.resolve_type_vars_if_possible(&value); - - // Map any placeholder byproducts back to a late-bound - // region. Put that late-bound region at whatever the outermost - // binder is that we encountered in `value`. The caller is - // responsible for ensuring that (a) `value` contains at least one - // binder and (b) that binder is the one we want to use. - let result = self.tcx.fold_regions(&value, &mut false, |r, current_depth| { - match inv_placeholder_map.get(&r) { - None => r, - Some(br) => { - // It is the responsibility of the caller to ensure - // that each placeholder region appears within a - // binder. In practice, this routine is only used by - // trait checking, and all of the placeholder regions - // appear inside predicates, which always have - // binders, so this assert is satisfied. - assert!(current_depth > ty::INNERMOST); - - // since leak-check passed, this placeholder region - // should only have incoming edges from variables - // (which ought not to escape the snapshot, but we - // don't check that) or itself - assert!( - match *r { - ty::ReVar(_) => true, - ty::RePlaceholder(index) => index.name == *br, - _ => false, - }, - "leak-check would have us replace {:?} with {:?}", - r, br); - - self.tcx.mk_region(ty::ReLateBound( - current_depth.shifted_out(1), - br.clone(), - )) - } - } - }); - - self.pop_placeholders(placeholder_map, snapshot); + let fld_t = |bound_ty: ty::BoundTy| { + self.tcx.mk_ty(ty::Placeholder(ty::PlaceholderType { + universe: next_universe, + name: bound_ty.var, + })) + }; - debug!("plug_leaks: result={:?}", result); + let (result, map) = self.tcx.replace_bound_vars(binder, fld_r, fld_t); - result - } + debug!( + "replace_bound_vars_with_placeholders(binder={:?}, result={:?}, map={:?})", + binder, + result, + map + ); - /// Pops the placeholder regions found in `placeholder_map` from the region - /// inference context. Whenever you create placeholder regions via - /// `replace_late_bound_regions_with_placeholders`, they must be popped before you - /// commit the enclosing snapshot (if you do not commit, e.g. within a - /// probe or as a result of an error, then this is not necessary, as - /// popping happens as part of the rollback). - /// - /// Note: popping also occurs implicitly as part of `leak_check`. - pub fn pop_placeholders( - &self, - placeholder_map: PlaceholderMap<'tcx>, - snapshot: &CombinedSnapshot<'a, 'tcx>, - ) { - debug!("pop_placeholders({:?})", placeholder_map); - let placeholder_regions: FxHashSet<_> = placeholder_map.values().cloned().collect(); - self.borrow_region_constraints() - .pop_placeholders( - &placeholder_regions, - &snapshot.region_constraints_snapshot, - ); - self.universe.set(snapshot.universe); - if !placeholder_map.is_empty() { - self.projection_cache.borrow_mut().rollback_placeholder( - &snapshot.projection_cache_snapshot); - } + (result, map) } } diff --git a/src/librustc/infer/lattice.rs b/src/librustc/infer/lattice.rs index 6848c625b5a..a8794b4076a 100644 --- a/src/librustc/infer/lattice.rs +++ b/src/librustc/infer/lattice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! # Lattice Variables //! //! This file contains generic code for operating on inference variables diff --git a/src/librustc/infer/lexical_region_resolve/README.md b/src/librustc/infer/lexical_region_resolve/README.md index 6e1c4191173..56320636a67 100644 --- a/src/librustc/infer/lexical_region_resolve/README.md +++ b/src/librustc/infer/lexical_region_resolve/README.md @@ -2,8 +2,12 @@ > WARNING: This README is obsolete and will be removed soon! For > more info on how the current borrowck works, see the [rustc guide]. +> +> As of edition 2018, region inference is done using Non-lexical lifetimes, +> which is described in the guide and [this RFC]. -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html +[rustc guide]: https://rust-lang.github.io/rustc-guide/mir/borrowck.html +[this RFC]: https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md ## Terminology diff --git a/src/librustc/infer/lexical_region_resolve/graphviz.rs b/src/librustc/infer/lexical_region_resolve/graphviz.rs index a210d63f129..7ce2aba54f5 100644 --- a/src/librustc/infer/lexical_region_resolve/graphviz.rs +++ b/src/librustc/infer/lexical_region_resolve/graphviz.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module provides linkage between libgraphviz traits and //! `rustc::middle::typeck::infer::region_constraints`, generating a //! rendering of the graph represented by the list of `Constraint` @@ -31,9 +21,8 @@ use std::borrow::Cow; use std::collections::hash_map::Entry::Vacant; use std::collections::btree_map::BTreeMap; use std::env; -use std::fs::File; +use std::fs; use std::io; -use std::io::prelude::*; use std::sync::atomic::{AtomicBool, Ordering}; fn print_help_message() { @@ -268,5 +257,5 @@ fn dump_region_data_to<'a, 'gcx, 'tcx>(region_rels: &RegionRelations<'a, 'gcx, ' debug!("dump_region_data calling render"); let mut v = Vec::new(); dot::render(&g, &mut v).unwrap(); - File::create(path).and_then(|mut f| f.write_all(&v)) + fs::write(path, &v) } diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs index 75f503d3bcf..c0952fefac0 100644 --- a/src/librustc/infer/lexical_region_resolve/mod.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The code to do lexical region resolution. use infer::region_constraints::Constraint; @@ -23,6 +13,7 @@ use rustc_data_structures::graph::implementation::{ Direction, Graph, NodeIndex, INCOMING, OUTGOING, }; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; +use smallvec::SmallVec; use std::fmt; use std::u32; use ty::fold::TypeFoldable; @@ -83,12 +74,13 @@ pub enum RegionResolutionError<'tcx> { /// `a` (but none of the known bounds are sufficient). GenericBoundFailure(SubregionOrigin<'tcx>, GenericKind<'tcx>, Region<'tcx>), - /// `SubSupConflict(v, sub_origin, sub_r, sup_origin, sup_r)`: + /// `SubSupConflict(v, v_origin, sub_origin, sub_r, sup_origin, sup_r)`: /// - /// Could not infer a value for `v` because `sub_r <= v` (due to - /// `sub_origin`) but `v <= sup_r` (due to `sup_origin`) and + /// Could not infer a value for `v` (which has origin `v_origin`) + /// because `sub_r <= v` (due to `sub_origin`) but `v <= sup_r` (due to `sup_origin`) and /// `sub_r <= sup_r` does not hold. SubSupConflict( + RegionVid, RegionVariableOrigin, SubregionOrigin<'tcx>, Region<'tcx>, @@ -194,29 +186,39 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { } fn expansion(&self, var_values: &mut LexicalRegionResolutions<'tcx>) { - self.iterate_until_fixed_point("Expansion", |constraint, origin| { - debug!("expansion: constraint={:?} origin={:?}", constraint, origin); - match *constraint { + self.iterate_until_fixed_point("Expansion", |constraint| { + debug!("expansion: constraint={:?}", constraint); + let (a_region, b_vid, b_data, retain) = match *constraint { Constraint::RegSubVar(a_region, b_vid) => { let b_data = var_values.value_mut(b_vid); - self.expand_node(a_region, b_vid, b_data) + (a_region, b_vid, b_data, false) } Constraint::VarSubVar(a_vid, b_vid) => match *var_values.value(a_vid) { - VarValue::ErrorValue => false, + VarValue::ErrorValue => return (false, false), VarValue::Value(a_region) => { - let b_node = var_values.value_mut(b_vid); - self.expand_node(a_region, b_vid, b_node) + let b_data = var_values.value_mut(b_vid); + let retain = match *b_data { + VarValue::Value(ReStatic) | VarValue::ErrorValue => false, + _ => true + }; + (a_region, b_vid, b_data, retain) } }, Constraint::RegSubReg(..) | Constraint::VarSubReg(..) => { // These constraints are checked after expansion // is done, in `collect_errors`. - false + return (false, false) } - } + }; + + let changed = self.expand_node(a_region, b_vid, b_data); + (changed, retain) }) } + // This function is very hot in some workloads. There's a single callsite + // so always inlining is ok even though it's large. + #[inline(always)] fn expand_node( &self, a_region: Region<'tcx>, @@ -225,23 +227,49 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { ) -> bool { debug!("expand_node({:?}, {:?} == {:?})", a_region, b_vid, b_data); - // Check if this relationship is implied by a given. match *a_region { + // Check if this relationship is implied by a given. ty::ReEarlyBound(_) | ty::ReFree(_) => if self.data.givens.contains(&(a_region, b_vid)) { debug!("given"); return false; }, + _ => {} } + match *b_data { VarValue::Value(cur_region) => { - let lub = self.lub_concrete_regions(a_region, cur_region); + // Identical scopes can show up quite often, if the fixed point + // iteration converges slowly, skip them + if let (ReScope(a_scope), ReScope(cur_scope)) = (a_region, cur_region) { + if a_scope == cur_scope { + return false; + } + } + + let mut lub = self.lub_concrete_regions(a_region, cur_region); if lub == cur_region { return false; } + // Watch out for `'b: !1` relationships, where the + // universe of `'b` can't name the placeholder `!1`. In + // that case, we have to grow `'b` to be `'static` for the + // relationship to hold. This is obviously a kind of sub-optimal + // choice -- in the future, when we incorporate a knowledge + // of the parameter environment, we might be able to find a + // tighter bound than `'static`. + // + // (This might e.g. arise from being asked to prove `for<'a> { 'b: 'a }`.) + let b_universe = self.var_infos[b_vid].universe; + if let ty::RePlaceholder(p) = lub { + if b_universe.cannot_name(p.universe) { + lub = self.tcx().types.re_static; + } + } + debug!( "Expanding value of {:?} from {:?} to {:?}", b_vid, cur_region, lub @@ -259,6 +287,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { fn lub_concrete_regions(&self, a: Region<'tcx>, b: Region<'tcx>) -> Region<'tcx> { let tcx = self.tcx(); + match (a, b) { (&ty::ReClosureBound(..), _) | (_, &ty::ReClosureBound(..)) @@ -564,10 +593,22 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { lower_bounds.sort_by_key(region_order_key); upper_bounds.sort_by_key(region_order_key); + let node_universe = self.var_infos[node_idx].universe; + for lower_bound in &lower_bounds { + let effective_lower_bound = if let ty::RePlaceholder(p) = lower_bound.region { + if node_universe.cannot_name(p.universe) { + self.tcx().types.re_static + } else { + lower_bound.region + } + } else { + lower_bound.region + }; + for upper_bound in &upper_bounds { if !self.region_rels - .is_subregion_of(lower_bound.region, upper_bound.region) + .is_subregion_of(effective_lower_bound, upper_bound.region) { let origin = self.var_infos[node_idx].origin.clone(); debug!( @@ -576,6 +617,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { origin, node_idx, lower_bound.region, upper_bound.region ); errors.push(RegionResolutionError::SubSupConflict( + node_idx, origin, lower_bound.origin.clone(), lower_bound.region, @@ -590,9 +632,10 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { span_bug!( self.var_infos[node_idx].origin.span(), "collect_error_for_expanding_node() could not find \ - error for var {:?}, lower_bounds={:?}, \ - upper_bounds={:?}", + error for var {:?} in universe {:?}, lower_bounds={:#?}, \ + upper_bounds={:#?}", node_idx, + node_universe, lower_bounds, upper_bounds ); @@ -686,22 +729,23 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { } fn iterate_until_fixed_point(&self, tag: &str, mut body: F) - where - F: FnMut(&Constraint<'tcx>, &SubregionOrigin<'tcx>) -> bool, + where F: FnMut(&Constraint<'tcx>) -> (bool, bool), { + let mut constraints: SmallVec<[_; 16]> = self.data.constraints.keys().collect(); let mut iteration = 0; let mut changed = true; while changed { changed = false; iteration += 1; debug!("---- {} Iteration {}{}", "#", tag, iteration); - for (constraint, origin) in &self.data.constraints { - let edge_changed = body(constraint, origin); + constraints.retain(|constraint| { + let (edge_changed, retain) = body(constraint); if edge_changed { debug!("Updated due to constraint {:?}", constraint); changed = true; } - } + retain + }); } debug!("---- {} Complete after {} iteration(s)", tag, iteration); } diff --git a/src/librustc/infer/lub.rs b/src/librustc/infer/lub.rs index 8875b4169dd..0b9839f69fa 100644 --- a/src/librustc/infer/lub.rs +++ b/src/librustc/infer/lub.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::combine::CombineFields; use super::InferCtxt; use super::lattice::{self, LatticeDir}; diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 87e32be1a17..95898254575 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! See the Book for more information. pub use self::freshen::TypeFreshener; @@ -37,12 +27,11 @@ use ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric}; use ty::fold::TypeFoldable; use ty::relate::RelateResult; use ty::subst::{Kind, Substs}; -use ty::{self, GenericParamDefKind, Ty, TyCtxt}; +use ty::{self, GenericParamDefKind, Ty, TyCtxt, CtxtInterners}; use ty::{FloatVid, IntVid, TyVid}; use util::nodemap::FxHashMap; use self::combine::CombineFields; -use self::higher_ranked::HrMatchResult; use self::lexical_region_resolve::LexicalRegionResolutions; use self::outlives::env::OutlivesEnvironment; use self::region_constraints::{GenericKind, RegionConstraintData, VarInfos, VerifyBound}; @@ -219,7 +208,7 @@ pub struct InferCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { /// `UniverseIndex::root()` but grows from there as we enter /// universal quantifiers. /// - /// NB: At present, we exclude the universal quantifiers on the + /// N.B., at present, we exclude the universal quantifiers on the /// item we are type-checking, and just consider those names as /// part of the root universe. So this would only get incremented /// when we enter into a higher-ranked (`for<..>`) type or trait @@ -227,13 +216,13 @@ pub struct InferCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { universe: Cell, } -/// A map returned by `replace_late_bound_regions_with_placeholders()` +/// A map returned by `replace_bound_vars_with_placeholders()` /// indicating the placeholder region that each late-bound region was /// replaced with. pub type PlaceholderMap<'tcx> = BTreeMap>; /// See `error_reporting` module for more details -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum ValuePairs<'tcx> { Types(ExpectedFound>), Regions(ExpectedFound>), @@ -411,7 +400,7 @@ pub enum NLLRegionVariableOrigin { /// "Universal" instantiation of a higher-ranked region (e.g., /// from a `for<'a> T` binder). Meant to represent "any region". - Placeholder(ty::Placeholder), + Placeholder(ty::PlaceholderRegion), Existential, } @@ -471,6 +460,7 @@ impl fmt::Display for FixupError { pub struct InferCtxtBuilder<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { global_tcx: TyCtxt<'a, 'gcx, 'gcx>, arena: SyncDroplessArena, + interners: Option>, fresh_tables: Option>>, } @@ -479,6 +469,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'gcx> { InferCtxtBuilder { global_tcx: self, arena: SyncDroplessArena::default(), + interners: None, fresh_tables: None, } } @@ -519,10 +510,13 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> { let InferCtxtBuilder { global_tcx, ref arena, + ref mut interners, ref fresh_tables, } = *self; let in_progress_tables = fresh_tables.as_ref(); - global_tcx.enter_local(arena, |tcx| { + // Check that we haven't entered before + assert!(interners.is_none()); + global_tcx.enter_local(arena, interners, |tcx| { f(InferCtxt { tcx, in_progress_tables, @@ -573,7 +567,7 @@ impl<'tcx, T> InferOk<'tcx, T> { pub fn into_value_registering_obligations( self, infcx: &InferCtxt<'_, '_, 'tcx>, - fulfill_cx: &mut impl TraitEngine<'tcx>, + fulfill_cx: &mut dyn TraitEngine<'tcx>, ) -> T { let InferOk { value, obligations } = self; for obligation in obligations { @@ -732,7 +726,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { region_obligations_snapshot: self.region_obligations.borrow().len(), universe: self.universe(), was_in_snapshot: in_snapshot, - // Borrow tables "in progress" (i.e. during typeck) + // Borrow tables "in progress" (i.e., during typeck) // to ban writes from within a snapshot to them. _in_progress_tables: self.in_progress_tables.map(|tables| tables.borrow()), } @@ -790,7 +784,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { self.projection_cache .borrow_mut() - .commit(&projection_cache_snapshot); + .commit(projection_cache_snapshot); self.type_variables.borrow_mut().commit(type_snapshot); self.int_unification_table.borrow_mut().commit(int_snapshot); self.float_unification_table @@ -856,6 +850,20 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { r } + /// Scan the constraints produced since `snapshot` began and returns: + /// + /// - None -- if none of them involve "region outlives" constraints + /// - Some(true) -- if there are `'a: 'b` constraints where `'a` or `'b` is a placehodler + /// - Some(false) -- if there are `'a: 'b` constraints but none involve placeholders + pub fn region_constraints_added_in_snapshot( + &self, + snapshot: &CombinedSnapshot<'a, 'tcx>, + ) -> Option { + self.borrow_region_constraints().region_constraints_added_in_snapshot( + &snapshot.region_constraints_snapshot, + ) + } + pub fn add_given(&self, sub: ty::Region<'tcx>, sup: ty::RegionVid) { self.borrow_region_constraints().add_given(sub, sup); } @@ -927,39 +935,32 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { return None; } - Some(self.commit_if_ok(|snapshot| { - let ( - ty::SubtypePredicate { - a_is_expected, - a, - b, - }, - placeholder_map, - ) = self.replace_late_bound_regions_with_placeholders(predicate); + let ( + ty::SubtypePredicate { + a_is_expected, + a, + b, + }, + _, + ) = self.replace_bound_vars_with_placeholders(predicate); - let cause_span = cause.span; - let ok = self.at(cause, param_env).sub_exp(a_is_expected, a, b)?; - self.leak_check(false, cause_span, &placeholder_map, snapshot)?; - self.pop_placeholders(placeholder_map, snapshot); - Ok(ok.unit()) - })) + Some( + self.at(cause, param_env) + .sub_exp(a_is_expected, a, b) + .map(|ok| ok.unit()), + ) } pub fn region_outlives_predicate( &self, cause: &traits::ObligationCause<'tcx>, predicate: &ty::PolyRegionOutlivesPredicate<'tcx>, - ) -> UnitResult<'tcx> { - self.commit_if_ok(|snapshot| { - let (ty::OutlivesPredicate(r_a, r_b), placeholder_map) = - self.replace_late_bound_regions_with_placeholders(predicate); - let origin = SubregionOrigin::from_obligation_cause(cause, || { - RelateRegionParamBound(cause.span) - }); - self.sub_regions(origin, r_b, r_a); // `b : a` ==> `a <= b` - self.leak_check(false, cause.span, &placeholder_map, snapshot)?; - Ok(self.pop_placeholders(placeholder_map, snapshot)) - }) + ) { + let (ty::OutlivesPredicate(r_a, r_b), _) = + self.replace_bound_vars_with_placeholders(predicate); + let origin = + SubregionOrigin::from_obligation_cause(cause, || RelateRegionParamBound(cause.span)); + self.sub_regions(origin, r_b, r_a); // `b : a` ==> `a <= b` } pub fn next_ty_var_id(&self, diverging: bool, origin: TypeVariableOrigin) -> TyVid { @@ -972,6 +973,17 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { self.tcx.mk_var(self.next_ty_var_id(false, origin)) } + pub fn next_ty_var_in_universe( + &self, + origin: TypeVariableOrigin, + universe: ty::UniverseIndex + ) -> Ty<'tcx> { + let vid = self.type_variables + .borrow_mut() + .new_var(universe, false, origin); + self.tcx.mk_var(vid) + } + pub fn next_diverging_ty_var(&self, origin: TypeVariableOrigin) -> Ty<'tcx> { self.tcx.mk_var(self.next_ty_var_id(true, origin)) } @@ -1036,7 +1048,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // type parameter definition. The substitutions are // for actual parameters that may be referred to by // the default of this type parameter, if it exists. - // E.g. `struct Foo(...);` when + // e.g., `struct Foo(...);` when // used in a path such as `Foo::::new()` will // use an inference variable for `C` with `[T, U]` // as the substitutions for the default, `(T, U)`. @@ -1227,10 +1239,25 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } + /// If `TyVar(vid)` resolves to a type, return that type. Else, return the + /// universe index of `TyVar(vid)`. + pub fn probe_ty_var(&self, vid: TyVid) -> Result, ty::UniverseIndex> { + use self::type_variable::TypeVariableValue; + + match self.type_variables.borrow_mut().probe(vid) { + TypeVariableValue::Known { value } => Ok(value), + TypeVariableValue::Unknown { universe } => Err(universe), + } + } + pub fn shallow_resolve(&self, typ: Ty<'tcx>) -> Ty<'tcx> { self.inlined_shallow_resolve(typ) } + pub fn root_var(&self, var: ty::TyVid) -> ty::TyVid { + self.type_variables.borrow_mut().root_var(var) + } + pub fn resolve_type_vars_if_possible(&self, value: &T) -> T where T: TypeFoldable<'tcx>, @@ -1239,7 +1266,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { * Where possible, replaces type/int/float variables in * `value` with their final value. Note that region variables * are unaffected. If a type variable has not been unified, it - * is left as is. This is an idempotent operation that does + * is left as is. This is an idempotent operation that does * not affect inference state in any way and so you can do it * at will. */ @@ -1276,7 +1303,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /*! * Attempts to resolve all type/region variables in * `value`. Region inference must have been run already (e.g., - * by calling `resolve_regions_and_report_errors`). If some + * by calling `resolve_regions_and_report_errors`). If some * variable was never unified, an `Err` results. * * This method is idempotent, but it not typically not invoked @@ -1309,7 +1336,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let actual_ty = self.resolve_type_vars_if_possible(&actual_ty); debug!("type_error_struct_with_diag({:?}, {:?})", sp, actual_ty); - // Don't report an error if actual type is Error. + // Don't report an error if actual type is `Error`. if actual_ty.references_error() { return self.tcx.sess.diagnostic().struct_dummy(); } @@ -1342,46 +1369,6 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { self.tcx.replace_bound_vars(value, fld_r, fld_t) } - /// Given a higher-ranked projection predicate like: - /// - /// for<'a> >::Output = &'a u32 - /// - /// and a target trait-ref like: - /// - /// > - /// - /// find a substitution `S` for the higher-ranked regions (here, - /// `['a => 'x]`) such that the predicate matches the trait-ref, - /// and then return the value (here, `&'a u32`) but with the - /// substitution applied (hence, `&'x u32`). - /// - /// See `higher_ranked_match` in `higher_ranked/mod.rs` for more - /// details. - pub fn match_poly_projection_predicate( - &self, - cause: ObligationCause<'tcx>, - param_env: ty::ParamEnv<'tcx>, - match_a: ty::PolyProjectionPredicate<'tcx>, - match_b: ty::TraitRef<'tcx>, - ) -> InferResult<'tcx, HrMatchResult>> { - let match_pair = match_a.map_bound(|p| (p.projection_ty.trait_ref(self.tcx), p.ty)); - let trace = TypeTrace { - cause, - values: TraitRefs(ExpectedFound::new( - true, - match_pair.skip_binder().0, - match_b, - )), - }; - - let mut combine = self.combine_fields(trace, param_env); - let result = combine.higher_ranked_match(&match_pair, &match_b, true)?; - Ok(InferOk { - value: result, - obligations: combine.obligations, - }) - } - /// See `verify_generic_bound` method in `region_constraints` pub fn verify_generic_bound( &self, @@ -1396,18 +1383,19 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { .verify_generic_bound(origin, kind, a, bound); } - pub fn type_moves_by_default( + pub fn type_is_copy_modulo_regions( &self, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>, span: Span, ) -> bool { let ty = self.resolve_type_vars_if_possible(&ty); + // Even if the type may have no inference variables, during // type-checking closure types are in local tables only. if !self.in_progress_tables.is_some() || !ty.has_closure_types() { if let Some((param_env, ty)) = self.tcx.lift_to_global(&(param_env, ty)) { - return ty.moves_by_default(self.tcx.global_tcx(), param_env, span); + return ty.is_copy_modulo_regions(self.tcx.global_tcx(), param_env, span); } } @@ -1417,7 +1405,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // rightly refuses to work with inference variables, but // moves_by_default has a cache, which we want to use in other // cases. - !traits::type_known_to_meet_bound(self, param_env, ty, copy_def_id, span) + traits::type_known_to_meet_bound_modulo_regions(self, param_env, ty, copy_def_id, span) } /// Obtains the latest type of the given closure; this may be a diff --git a/src/librustc/infer/nll_relate/mod.rs b/src/librustc/infer/nll_relate/mod.rs index e003c1989e0..7671a471357 100644 --- a/src/librustc/infer/nll_relate/mod.rs +++ b/src/librustc/infer/nll_relate/mod.rs @@ -1,40 +1,41 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This code is kind of an alternate way of doing subtyping, //! supertyping, and type equating, distinct from the `combine.rs` //! code but very similar in its effect and design. Eventually the two -//! ought to be merged. This code is intended for use in NLL. +//! ought to be merged. This code is intended for use in NLL and chalk. //! //! Here are the key differences: //! -//! - This code generally assumes that there are no unbound type -//! inferences variables, because at NLL -//! time types are fully inferred up-to regions. -//! - Actually, to support user-given type annotations like -//! `Vec<_>`, we do have some measure of support for type -//! inference variables, but we impose some simplifying -//! assumptions on them that would not be suitable for the infer -//! code more generally. This could be fixed. +//! - This code may choose to bypass some checks (e.g., the occurs check) +//! in the case where we know that there are no unbound type inference +//! variables. This is the case for NLL, because at NLL time types are fully +//! inferred up-to regions. //! - This code uses "universes" to handle higher-ranked regions and //! not the leak-check. This is "more correct" than what rustc does //! and we are generally migrating in this direction, but NLL had to //! get there first. +//! +//! Also, this code assumes that there are no bound types at all, not even +//! free ones. This is ok because: +//! - we are not relating anything quantified over some type variable +//! - we will have instantiated all the bound type vars already (the one +//! thing we relate in chalk are basically domain goals and their +//! constituents) use crate::infer::InferCtxt; use crate::ty::fold::{TypeFoldable, TypeVisitor}; use crate::ty::relate::{self, Relate, RelateResult, TypeRelation}; use crate::ty::subst::Kind; use crate::ty::{self, Ty, TyCtxt}; +use crate::ty::error::TypeError; +use crate::traits::DomainGoal; use rustc_data_structures::fx::FxHashMap; +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] +pub enum NormalizationStrategy { + Lazy, + Eager, +} + pub struct TypeRelating<'me, 'gcx: 'tcx, 'tcx: 'me, D> where D: TypeRelatingDelegate<'tcx>, @@ -75,6 +76,10 @@ pub trait TypeRelatingDelegate<'tcx> { /// delegate. fn push_outlives(&mut self, sup: ty::Region<'tcx>, sub: ty::Region<'tcx>); + /// Push a domain goal that will need to be proved for the two types to + /// be related. Used for lazy normalization. + fn push_domain_goal(&mut self, domain_goal: DomainGoal<'tcx>); + /// Creates a new universe index. Used when instantiating placeholders. fn create_next_universe(&mut self) -> ty::UniverseIndex; @@ -82,7 +87,7 @@ pub trait TypeRelatingDelegate<'tcx> { /// region that is instantiated existentially. This creates an /// inference variable, typically. /// - /// So e.g. if you have `for<'a> fn(..) <: for<'b> fn(..)`, then + /// So e.g., if you have `for<'a> fn(..) <: for<'b> fn(..)`, then /// we will invoke this method to instantiate `'a` with an /// inference variable (though `'b` would be instantiated first, /// as a placeholder). @@ -92,10 +97,10 @@ pub trait TypeRelatingDelegate<'tcx> { /// higher-ranked region that is instantiated universally. /// This creates a new region placeholder, typically. /// - /// So e.g. if you have `for<'a> fn(..) <: for<'b> fn(..)`, then + /// So e.g., if you have `for<'a> fn(..) <: for<'b> fn(..)`, then /// we will invoke this method to instantiate `'b` with a /// placeholder region. - fn next_placeholder_region(&mut self, placeholder: ty::Placeholder) -> ty::Region<'tcx>; + fn next_placeholder_region(&mut self, placeholder: ty::PlaceholderRegion) -> ty::Region<'tcx>; /// Creates a new existential region in the given universe. This /// is used when handling subtyping and type variables -- if we @@ -105,6 +110,13 @@ pub trait TypeRelatingDelegate<'tcx> { /// relate `Foo<'?0>` with `Foo<'a>` (and probably add an outlives /// relation stating that `'?0: 'a`). fn generalize_existential(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx>; + + /// Define the normalization strategy to use, eager or lazy. + fn normalization() -> NormalizationStrategy; + + /// Enable some optimizations if we do not expect inference variables + /// in the RHS of the relation. + fn forbid_inference_vars() -> bool; } #[derive(Clone, Debug)] @@ -176,7 +188,7 @@ where universe }); - let placeholder = ty::Placeholder { universe, name: br }; + let placeholder = ty::PlaceholderRegion { universe, name: br }; delegate.next_placeholder_region(placeholder) } else { delegate.next_existential_region_var() @@ -242,15 +254,79 @@ where self.delegate.push_outlives(sup, sub); } - /// When we encounter a canonical variable `var` in the output, - /// equate it with `kind`. If the variable has been previously - /// equated, then equate it again. - fn relate_var(&mut self, var_ty: Ty<'tcx>, value_ty: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { - debug!("equate_var(var_ty={:?}, value_ty={:?})", var_ty, value_ty); + /// Relate a projection type and some value type lazily. This will always + /// succeed, but we push an additional `ProjectionEq` goal depending + /// on the value type: + /// - if the value type is any type `T` which is not a projection, we push + /// `ProjectionEq(projection = T)`. + /// - if the value type is another projection `other_projection`, we create + /// a new inference variable `?U` and push the two goals + /// `ProjectionEq(projection = ?U)`, `ProjectionEq(other_projection = ?U)`. + fn relate_projection_ty( + &mut self, + projection_ty: ty::ProjectionTy<'tcx>, + value_ty: ty::Ty<'tcx> + ) -> Ty<'tcx> { + use crate::infer::type_variable::TypeVariableOrigin; + use crate::traits::WhereClause; + use syntax_pos::DUMMY_SP; + + match value_ty.sty { + ty::Projection(other_projection_ty) => { + let var = self.infcx.next_ty_var(TypeVariableOrigin::MiscVariable(DUMMY_SP)); + self.relate_projection_ty(projection_ty, var); + self.relate_projection_ty(other_projection_ty, var); + var + } + + _ => { + let projection = ty::ProjectionPredicate { + projection_ty, + ty: value_ty, + }; + self.delegate.push_domain_goal( + DomainGoal::Holds(WhereClause::ProjectionEq(projection)) + ); + value_ty + } + } + } + + /// Relate a type inference variable with a value type. + fn relate_ty_var( + &mut self, + vid: ty::TyVid, + value_ty: Ty<'tcx> + ) -> RelateResult<'tcx, Ty<'tcx>> { + debug!("relate_ty_var(vid={:?}, value_ty={:?})", vid, value_ty); + + match value_ty.sty { + ty::Infer(ty::TyVar(value_vid)) => { + // Two type variables: just equate them. + self.infcx.type_variables.borrow_mut().equate(vid, value_vid); + return Ok(value_ty); + } - let generalized_ty = self.generalize_value(value_ty); - self.infcx - .force_instantiate_unchecked(var_ty, generalized_ty); + ty::Projection(projection_ty) + if D::normalization() == NormalizationStrategy::Lazy => + { + return Ok(self.relate_projection_ty(projection_ty, self.infcx.tcx.mk_var(vid))); + } + + _ => (), + } + + let generalized_ty = self.generalize_value(value_ty, vid)?; + debug!("relate_ty_var: generalized_ty = {:?}", generalized_ty); + + if D::forbid_inference_vars() { + // In NLL, we don't have type inference variables + // floating around, so we can do this rather imprecise + // variant of the occurs-check. + assert!(!generalized_ty.has_infer_types()); + } + + self.infcx.type_variables.borrow_mut().instantiate(vid, generalized_ty); // The generalized values we extract from `canonical_var_values` have // been fully instantiated and hence the set of scopes we have @@ -264,22 +340,27 @@ where // Restore the old scopes now. self.a_scopes = old_a_scopes; - debug!("equate_var: complete, result = {:?}", result); + debug!("relate_ty_var: complete, result = {:?}", result); result } - fn generalize_value>(&mut self, value: T) -> T { - TypeGeneralizer { - tcx: self.infcx.tcx, + fn generalize_value>( + &mut self, + value: T, + for_vid: ty::TyVid + ) -> RelateResult<'tcx, T> { + let universe = self.infcx.probe_ty_var(for_vid).unwrap_err(); + + let mut generalizer = TypeGeneralizer { + infcx: self.infcx, delegate: &mut self.delegate, first_free_index: ty::INNERMOST, ambient_variance: self.ambient_variance, + for_vid_sub_root: self.infcx.type_variables.borrow_mut().sub_root_var(for_vid), + universe, + }; - // These always correspond to an `_` or `'_` written by - // user, and those are always in the root universe. - universe: ty::UniverseIndex::ROOT, - }.relate(&value, &value) - .unwrap() + generalizer.relate(&value, &value) } } @@ -327,11 +408,35 @@ where Ok(r) } - fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { + fn tys(&mut self, a: Ty<'tcx>, mut b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { let a = self.infcx.shallow_resolve(a); - match a.sty { - ty::Infer(ty::TyVar(_)) | ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_)) => { - self.relate_var(a.into(), b.into()) + + if !D::forbid_inference_vars() { + b = self.infcx.shallow_resolve(b); + } + + match (&a.sty, &b.sty) { + (_, &ty::Infer(ty::TyVar(vid))) => { + if D::forbid_inference_vars() { + // Forbid inference variables in the RHS. + bug!("unexpected inference var {:?}", b) + } else { + self.relate_ty_var(vid, a) + } + } + + (&ty::Infer(ty::TyVar(vid)), _) => self.relate_ty_var(vid, b), + + (&ty::Projection(projection_ty), _) + if D::normalization() == NormalizationStrategy::Lazy => + { + Ok(self.relate_projection_ty(projection_ty, b)) + } + + (_, &ty::Projection(projection_ty)) + if D::normalization() == NormalizationStrategy::Lazy => + { + Ok(self.relate_projection_ty(projection_ty, a)) } _ => { @@ -340,7 +445,8 @@ where a, b, self.ambient_variance ); - relate::super_relate_tys(self, a, b) + // Will also handle unification of `IntVar` and `FloatVar`. + self.infcx.super_combine_tys(self, a, b) } } } @@ -551,7 +657,7 @@ struct TypeGeneralizer<'me, 'gcx: 'tcx, 'tcx: 'me, D> where D: TypeRelatingDelegate<'tcx> + 'me, { - tcx: TyCtxt<'me, 'gcx, 'tcx>, + infcx: &'me InferCtxt<'me, 'gcx, 'tcx>, delegate: &'me mut D, @@ -561,6 +667,14 @@ where first_free_index: ty::DebruijnIndex, + /// The vid of the type variable that is in the process of being + /// instantiated. If we find this within the value we are folding, + /// that means we would have created a cyclic value. + for_vid_sub_root: ty::TyVid, + + /// The universe of the type variable that is in the process of being + /// instantiated. If we find anything that this universe cannot name, + /// we reject the relation. universe: ty::UniverseIndex, } @@ -569,7 +683,7 @@ where D: TypeRelatingDelegate<'tcx>, { fn tcx(&self) -> TyCtxt<'me, 'gcx, 'tcx> { - self.tcx + self.infcx.tcx } fn tag(&self) -> &'static str { @@ -609,17 +723,84 @@ where } fn tys(&mut self, a: Ty<'tcx>, _: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { + use crate::infer::type_variable::TypeVariableValue; + debug!("TypeGeneralizer::tys(a={:?})", a,); match a.sty { - ty::Infer(ty::TyVar(_)) | ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_)) => { + ty::Infer(ty::TyVar(_)) | ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_)) + if D::forbid_inference_vars() => + { bug!( "unexpected inference variable encountered in NLL generalization: {:?}", a ); } - _ => relate::super_relate_tys(self, a, a), + ty::Infer(ty::TyVar(vid)) => { + let mut variables = self.infcx.type_variables.borrow_mut(); + let vid = variables.root_var(vid); + let sub_vid = variables.sub_root_var(vid); + if sub_vid == self.for_vid_sub_root { + // If sub-roots are equal, then `for_vid` and + // `vid` are related via subtyping. + debug!("TypeGeneralizer::tys: occurs check failed"); + return Err(TypeError::Mismatch); + } else { + match variables.probe(vid) { + TypeVariableValue::Known { value: u } => { + drop(variables); + self.relate(&u, &u) + } + TypeVariableValue::Unknown { universe: _universe } => { + if self.ambient_variance == ty::Bivariant { + // FIXME: we may need a WF predicate (related to #54105). + } + + let origin = *variables.var_origin(vid); + + // Replacing with a new variable in the universe `self.universe`, + // it will be unified later with the original type variable in + // the universe `_universe`. + let new_var_id = variables.new_var(self.universe, false, origin); + + let u = self.tcx().mk_var(new_var_id); + debug!( + "generalize: replacing original vid={:?} with new={:?}", + vid, + u + ); + return Ok(u); + } + } + } + } + + ty::Infer(ty::IntVar(_)) | + ty::Infer(ty::FloatVar(_)) => { + // No matter what mode we are in, + // integer/floating-point types must be equal to be + // relatable. + Ok(a) + } + + ty::Placeholder(placeholder) => { + if self.universe.cannot_name(placeholder.universe) { + debug!( + "TypeGeneralizer::tys: root universe {:?} cannot name\ + placeholder in universe {:?}", + self.universe, + placeholder.universe + ); + Err(TypeError::Mismatch) + } else { + Ok(a) + } + } + + _ => { + relate::super_relate_tys(self, a, a) + } } } @@ -673,64 +854,3 @@ where Ok(ty::Binder::bind(result)) } } - -impl InferCtxt<'_, '_, 'tcx> { - /// A hacky sort of method used by the NLL type-relating code: - /// - /// - `var` must be some unbound type variable. - /// - `value` must be a suitable type to use as its value. - /// - /// `var` will then be equated with `value`. Note that this - /// sidesteps a number of important checks, such as the "occurs - /// check" that prevents cyclic types, so it is important not to - /// use this method during regular type-check. - fn force_instantiate_unchecked(&self, var: Ty<'tcx>, value: Ty<'tcx>) { - match (&var.sty, &value.sty) { - (&ty::Infer(ty::TyVar(vid)), _) => { - let mut type_variables = self.type_variables.borrow_mut(); - - // In NLL, we don't have type inference variables - // floating around, so we can do this rather imprecise - // variant of the occurs-check. - assert!(!value.has_infer_types()); - - type_variables.instantiate(vid, value); - } - - (&ty::Infer(ty::IntVar(vid)), &ty::Int(value)) => { - let mut int_unification_table = self.int_unification_table.borrow_mut(); - int_unification_table - .unify_var_value(vid, Some(ty::IntVarValue::IntType(value))) - .unwrap_or_else(|_| { - bug!("failed to unify int var `{:?}` with `{:?}`", vid, value); - }); - } - - (&ty::Infer(ty::IntVar(vid)), &ty::Uint(value)) => { - let mut int_unification_table = self.int_unification_table.borrow_mut(); - int_unification_table - .unify_var_value(vid, Some(ty::IntVarValue::UintType(value))) - .unwrap_or_else(|_| { - bug!("failed to unify int var `{:?}` with `{:?}`", vid, value); - }); - } - - (&ty::Infer(ty::FloatVar(vid)), &ty::Float(value)) => { - let mut float_unification_table = self.float_unification_table.borrow_mut(); - float_unification_table - .unify_var_value(vid, Some(ty::FloatVarValue(value))) - .unwrap_or_else(|_| { - bug!("failed to unify float var `{:?}` with `{:?}`", vid, value) - }); - } - - _ => { - bug!( - "force_instantiate_unchecked invoked with bad combination: var={:?} value={:?}", - var, - value, - ); - } - } - } -} diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index fda9817cc88..5e94bb1f877 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def_id::DefId; use hir; use hir::Node; @@ -29,7 +19,7 @@ pub type OpaqueTypeMap<'tcx> = DefIdMap>; /// appear in the return type). #[derive(Copy, Clone, Debug)] pub struct OpaqueTypeDecl<'tcx> { - /// The substitutions that we apply to the abstract that that this + /// The substitutions that we apply to the abstract that this /// `impl Trait` desugars to. e.g., if: /// /// fn foo<'a, 'b, T>() -> impl Trait<'a> @@ -691,13 +681,13 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> { // let x = || foo(); // returns the Opaque assoc with `foo` // } // ``` - if let Some(opaque_node_id) = tcx.hir.as_local_node_id(def_id) { + if let Some(opaque_node_id) = tcx.hir().as_local_node_id(def_id) { let parent_def_id = self.parent_def_id; let def_scope_default = || { - let opaque_parent_node_id = tcx.hir.get_parent(opaque_node_id); - parent_def_id == tcx.hir.local_def_id(opaque_parent_node_id) + let opaque_parent_node_id = tcx.hir().get_parent(opaque_node_id); + parent_def_id == tcx.hir().local_def_id(opaque_parent_node_id) }; - let in_definition_scope = match tcx.hir.find(opaque_node_id) { + let in_definition_scope = match tcx.hir().find(opaque_node_id) { Some(Node::Item(item)) => match item.node { // impl trait hir::ItemKind::Existential(hir::ExistTy { @@ -725,7 +715,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> { }, _ => bug!( "expected (impl) item, found {}", - tcx.hir.node_to_string(opaque_node_id), + tcx.hir().node_to_string(opaque_node_id), ), }; if in_definition_scope { @@ -761,7 +751,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> { ); // Use the same type variable if the exact same Opaque appears more - // than once in the return type (e.g. if it's passed to a type alias). + // than once in the return type (e.g., if it's passed to a type alias). if let Some(opaque_defn) = self.opaque_types.get(&def_id) { return opaque_defn.concrete_ty; } @@ -783,7 +773,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> { ); // make sure that we are in fact defining the *entire* type - // e.g. `existential type Foo: Bar;` needs to be + // e.g., `existential type Foo: Bar;` needs to be // defined by a function like `fn foo() -> Foo`. debug!( "instantiate_opaque_types: param_env: {:#?}", @@ -848,16 +838,16 @@ pub fn may_define_existential_type( opaque_node_id: ast::NodeId, ) -> bool { let mut node_id = tcx - .hir + .hir() .as_local_node_id(def_id) .unwrap(); // named existential types can be defined by any siblings or // children of siblings - let mod_id = tcx.hir.get_parent(opaque_node_id); + let mod_id = tcx.hir().get_parent(opaque_node_id); // so we walk up the node tree until we hit the root or the parent // of the opaque type while node_id != mod_id && node_id != ast::CRATE_NODE_ID { - node_id = tcx.hir.get_parent(node_id); + node_id = tcx.hir().get_parent(node_id); } // syntactically we are allowed to define the concrete type node_id == mod_id diff --git a/src/librustc/infer/outlives/env.rs b/src/librustc/infer/outlives/env.rs index 726bb388252..677b6136ea0 100644 --- a/src/librustc/infer/outlives/env.rs +++ b/src/librustc/infer/outlives/env.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::outlives::free_region_map::FreeRegionMap; use infer::{GenericKind, InferCtxt}; use rustc_data_structures::fx::FxHashMap; diff --git a/src/librustc/infer/outlives/free_region_map.rs b/src/librustc/infer/outlives/free_region_map.rs index 588a00eb503..a6703c9d679 100644 --- a/src/librustc/infer/outlives/free_region_map.rs +++ b/src/librustc/infer/outlives/free_region_map.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ty::{self, Lift, TyCtxt, Region}; use rustc_data_structures::transitive_relation::TransitiveRelation; diff --git a/src/librustc/infer/outlives/mod.rs b/src/librustc/infer/outlives/mod.rs index 282aef786f0..e421d6fb692 100644 --- a/src/librustc/infer/outlives/mod.rs +++ b/src/librustc/infer/outlives/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Various code related to computing outlives relations. pub mod env; diff --git a/src/librustc/infer/outlives/obligations.rs b/src/librustc/infer/outlives/obligations.rs index 502a5828f3e..abe835c9211 100644 --- a/src/librustc/infer/outlives/obligations.rs +++ b/src/librustc/infer/outlives/obligations.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Code that handles "type-outlives" constraints like `T: 'a`. This //! is based on the `push_outlives_components` function defined on the tcx, //! but it adds a bit of heuristics on top, in particular to deal with @@ -408,7 +398,7 @@ where // Remove outlives bounds that we get from the environment but // which are also deducable from the trait. This arises (cc - // #55756) in cases where you have e.g. `>::Item: + // #55756) in cases where you have e.g., `>::Item: // 'a` in the environment but `trait Foo<'b> { type Item: 'b // }` in the trait definition. approx_env_bounds.retain(|bound| { diff --git a/src/librustc/infer/outlives/verify.rs b/src/librustc/infer/outlives/verify.rs index 5fee04341b6..4e9a8e9ded8 100644 --- a/src/librustc/infer/outlives/verify.rs +++ b/src/librustc/infer/outlives/verify.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def_id::DefId; use infer::outlives::env::RegionBoundPairs; use infer::{GenericKind, VerifyBound}; diff --git a/src/librustc/infer/region_constraints/README.md b/src/librustc/infer/region_constraints/README.md index 61603e6dee6..ea7fffe9dc1 100644 --- a/src/librustc/infer/region_constraints/README.md +++ b/src/librustc/infer/region_constraints/README.md @@ -1,77 +1,3 @@ -# Region constraint collection +For info on how the current borrowck works, see the [rustc guide]. -> WARNING: This README is obsolete and will be removed soon! For -> more info on how the current borrowck works, see the [rustc guide]. - -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html - -## Terminology - -Note that we use the terms region and lifetime interchangeably. - -## Introduction - -As described in the rustc guide [chapter on type inference][ti], and unlike -normal type inference, which is similar in spirit to H-M and thus -works progressively, the region type inference works by accumulating -constraints over the course of a function. Finally, at the end of -processing a function, we process and solve the constraints all at -once. - -[ti]: https://rust-lang-nursery.github.io/rustc-guide/type-inference.html - -The constraints are always of one of three possible forms: - -- `ConstrainVarSubVar(Ri, Rj)` states that region variable Ri must be - a subregion of Rj -- `ConstrainRegSubVar(R, Ri)` states that the concrete region R (which - must not be a variable) must be a subregion of the variable Ri -- `ConstrainVarSubReg(Ri, R)` states the variable Ri should be less - than the concrete region R. This is kind of deprecated and ought to - be replaced with a verify (they essentially play the same role). - -In addition to constraints, we also gather up a set of "verifys" -(what, you don't think Verify is a noun? Get used to it my -friend!). These represent relations that must hold but which don't -influence inference proper. These take the form of: - -- `VerifyRegSubReg(Ri, Rj)` indicates that Ri <= Rj must hold, - where Rj is not an inference variable (and Ri may or may not contain - one). This doesn't influence inference because we will already have - inferred Ri to be as small as possible, so then we just test whether - that result was less than Rj or not. -- `VerifyGenericBound(R, Vb)` is a more complex expression which tests - that the region R must satisfy the bound `Vb`. The bounds themselves - may have structure like "must outlive one of the following regions" - or "must outlive ALL of the following regions. These bounds arise - from constraints like `T: 'a` -- if we know that `T: 'b` and `T: 'c` - (say, from where clauses), then we can conclude that `T: 'a` if `'b: - 'a` *or* `'c: 'a`. - -## Building up the constraints - -Variables and constraints are created using the following methods: - -- `new_region_var()` creates a new, unconstrained region variable; -- `make_subregion(Ri, Rj)` states that Ri is a subregion of Rj -- `lub_regions(Ri, Rj) -> Rk` returns a region Rk which is - the smallest region that is greater than both Ri and Rj -- `glb_regions(Ri, Rj) -> Rk` returns a region Rk which is - the greatest region that is smaller than both Ri and Rj - -The actual region resolution algorithm is not entirely -obvious, though it is also not overly complex. - -## Snapshotting - -It is also permitted to try (and rollback) changes to the graph. This -is done by invoking `start_snapshot()`, which returns a value. Then -later you can call `rollback_to()` which undoes the work. -Alternatively, you can call `commit()` which ends all snapshots. -Snapshots can be recursive---so you can start a snapshot when another -is in progress, but only the root snapshot can "commit". - -## Skolemization - -For a discussion on skolemization and higher-ranked subtyping, please -see the module `middle::infer::higher_ranked::doc`. +[rustc guide]: https://rust-lang.github.io/rustc-guide/mir/borrowck.html diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index 391bfc428c3..56ae850226c 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -1,17 +1,7 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! See README.md use self::CombineMapType::*; -use self::UndoLogEntry::*; +use self::UndoLog::*; use super::unify_key; use super::{MiscVariable, RegionVariableOrigin, SubregionOrigin}; @@ -27,8 +17,6 @@ use ty::{Region, RegionVid}; use std::collections::BTreeMap; use std::{cmp, fmt, mem, u32}; -mod taint; - #[derive(Default)] pub struct RegionConstraintCollector<'tcx> { /// For each `RegionVid`, the corresponding `RegionVariableOrigin`. @@ -52,14 +40,17 @@ pub struct RegionConstraintCollector<'tcx> { /// The undo log records actions that might later be undone. /// - /// Note: when the undo_log is empty, we are not actively + /// Note: `num_open_snapshots` is used to track if we are actively /// snapshotting. When the `start_snapshot()` method is called, we - /// push an OpenSnapshot entry onto the list to indicate that we - /// are now actively snapshotting. The reason for this is that - /// otherwise we end up adding entries for things like the lower - /// bound on a variable and so forth, which can never be rolled - /// back. - undo_log: Vec>, + /// increment `num_open_snapshots` to indicate that we are now actively + /// snapshotting. The reason for this is that otherwise we end up adding + /// entries for things like the lower bound on a variable and so forth, + /// which can never be rolled back. + undo_log: Vec>, + + /// The number of open snapshots, i.e., those that haven't been committed or + /// rolled back. + num_open_snapshots: usize, /// When we add a R1 == R2 constriant, we currently add (a) edges /// R1 <= R2 and R2 <= R1 and (b) we unify the two regions in this @@ -137,6 +128,16 @@ pub enum Constraint<'tcx> { RegSubReg(Region<'tcx>, Region<'tcx>), } +impl Constraint<'_> { + pub fn involves_placeholders(&self) -> bool { + match self { + Constraint::VarSubVar(_, _) => false, + Constraint::VarSubReg(_, r) | Constraint::RegSubVar(r, _) => r.is_placeholder(), + Constraint::RegSubReg(r, s) => r.is_placeholder() || s.is_placeholder(), + } + } +} + /// VerifyGenericBound(T, _, R, RS): The parameter type `T` (or /// associated type) must outlive the region `R`. `T` is known to /// outlive `RS`. Therefore verify that `R <= RS[i]` for some @@ -254,15 +255,7 @@ struct TwoRegions<'tcx> { } #[derive(Copy, Clone, PartialEq)] -enum UndoLogEntry<'tcx> { - /// Pushed when we start a snapshot. - OpenSnapshot, - - /// Replaces an `OpenSnapshot` when a snapshot is committed, but - /// that snapshot is not the root. If the root snapshot is - /// unrolled, all nested snapshots must be committed. - CommitedSnapshot, - +enum UndoLog<'tcx> { /// We added `RegionVid` AddVar(RegionVid), @@ -341,6 +334,8 @@ impl TaintDirections { } } +pub struct ConstraintInfo {} + impl<'tcx> RegionConstraintCollector<'tcx> { pub fn new() -> Self { Self::default() @@ -387,6 +382,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { glbs, bound_count: _, undo_log: _, + num_open_snapshots: _, unification_table, any_unifications, } = self; @@ -415,13 +411,13 @@ impl<'tcx> RegionConstraintCollector<'tcx> { } fn in_snapshot(&self) -> bool { - !self.undo_log.is_empty() + self.num_open_snapshots > 0 } pub fn start_snapshot(&mut self) -> RegionSnapshot { let length = self.undo_log.len(); debug!("RegionConstraintCollector: start_snapshot({})", length); - self.undo_log.push(OpenSnapshot); + self.num_open_snapshots += 1; RegionSnapshot { length, region_snapshot: self.unification_table.snapshot(), @@ -429,39 +425,46 @@ impl<'tcx> RegionConstraintCollector<'tcx> { } } + fn assert_open_snapshot(&self, snapshot: &RegionSnapshot) { + assert!(self.undo_log.len() >= snapshot.length); + assert!(self.num_open_snapshots > 0); + } + pub fn commit(&mut self, snapshot: RegionSnapshot) { debug!("RegionConstraintCollector: commit({})", snapshot.length); - assert!(self.undo_log.len() > snapshot.length); - assert!(self.undo_log[snapshot.length] == OpenSnapshot); + self.assert_open_snapshot(&snapshot); - if snapshot.length == 0 { + if self.num_open_snapshots == 1 { + // The root snapshot. It's safe to clear the undo log because + // there's no snapshot further out that we might need to roll back + // to. + assert!(snapshot.length == 0); self.undo_log.clear(); - } else { - (*self.undo_log)[snapshot.length] = CommitedSnapshot; } + + self.num_open_snapshots -= 1; + self.unification_table.commit(snapshot.region_snapshot); } pub fn rollback_to(&mut self, snapshot: RegionSnapshot) { debug!("RegionConstraintCollector: rollback_to({:?})", snapshot); - assert!(self.undo_log.len() > snapshot.length); - assert!(self.undo_log[snapshot.length] == OpenSnapshot); - while self.undo_log.len() > snapshot.length + 1 { + self.assert_open_snapshot(&snapshot); + + while self.undo_log.len() > snapshot.length { let undo_entry = self.undo_log.pop().unwrap(); self.rollback_undo_entry(undo_entry); } - let c = self.undo_log.pop().unwrap(); - assert!(c == OpenSnapshot); + + self.num_open_snapshots -= 1; + self.unification_table.rollback_to(snapshot.region_snapshot); self.any_unifications = snapshot.any_unifications; } - fn rollback_undo_entry(&mut self, undo_entry: UndoLogEntry<'tcx>) { + fn rollback_undo_entry(&mut self, undo_entry: UndoLog<'tcx>) { match undo_entry { - OpenSnapshot => { - panic!("Failure to observe stack discipline"); - } - Purged | CommitedSnapshot => { + Purged => { // nothing to do here } AddVar(vid) => { @@ -494,7 +497,8 @@ impl<'tcx> RegionConstraintCollector<'tcx> { ) -> RegionVid { let vid = self.var_infos.push(RegionVariableInfo { origin, universe }); - let u_vid = self.unification_table + let u_vid = self + .unification_table .new_key(unify_key::RegionVidKey { min_vid: vid }); assert_eq!(vid, u_vid); if self.in_snapshot() { @@ -521,17 +525,13 @@ impl<'tcx> RegionConstraintCollector<'tcx> { /// in `skols`. This is used after a higher-ranked operation /// completes to remove all trace of the placeholder regions /// created in that time. - pub fn pop_placeholders( - &mut self, - placeholders: &FxHashSet>, - snapshot: &RegionSnapshot, - ) { + pub fn pop_placeholders(&mut self, placeholders: &FxHashSet>) { debug!("pop_placeholders(placeholders={:?})", placeholders); assert!(self.in_snapshot()); - assert!(self.undo_log[snapshot.length] == OpenSnapshot); - let constraints_to_kill: Vec = self.undo_log + let constraints_to_kill: Vec = self + .undo_log .iter() .enumerate() .rev() @@ -548,7 +548,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { fn kill_constraint<'tcx>( placeholders: &FxHashSet>, - undo_entry: &UndoLogEntry<'tcx>, + undo_entry: &UndoLog<'tcx>, ) -> bool { match undo_entry { &AddConstraint(Constraint::VarSubVar(..)) => false, @@ -562,7 +562,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { &AddCombination(_, ref two_regions) => { placeholders.contains(&two_regions.a) || placeholders.contains(&two_regions.b) } - &AddVar(..) | &OpenSnapshot | &Purged | &CommitedSnapshot => false, + &AddVar(..) | &Purged => false, } } } @@ -609,7 +609,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { // never overwrite an existing (constraint, origin) - only insert one if it isn't // present in the map yet. This prevents origins from outside the snapshot being - // replaced with "less informative" origins e.g. during calls to `can_eq` + // replaced with "less informative" origins e.g., during calls to `can_eq` let in_snapshot = self.in_snapshot(); let undo_log = &mut self.undo_log; self.data.constraints.entry(constraint).or_insert_with(|| { @@ -834,37 +834,18 @@ impl<'tcx> RegionConstraintCollector<'tcx> { .filter_map(|&elt| match elt { AddVar(vid) => Some(vid), _ => None, - }) - .collect() - } - - /// Computes all regions that have been related to `r0` since the - /// mark `mark` was made---`r0` itself will be the first - /// entry. The `directions` parameter controls what kind of - /// relations are considered. For example, one can say that only - /// "incoming" edges to `r0` are desired, in which case one will - /// get the set of regions `{r|r <= r0}`. This is used when - /// checking whether placeholder regions are being improperly - /// related to other regions. - pub fn tainted( - &self, - tcx: TyCtxt<'_, '_, 'tcx>, - mark: &RegionSnapshot, - r0: Region<'tcx>, - directions: TaintDirections, - ) -> FxHashSet> { - debug!( - "tainted(mark={:?}, r0={:?}, directions={:?})", - mark, r0, directions - ); + }).collect() + } - // `result_set` acts as a worklist: we explore all outgoing - // edges and add any new regions we find to result_set. This - // is not a terribly efficient implementation. - let mut taint_set = taint::TaintSet::new(directions, r0); - taint_set.fixed_point(tcx, &self.undo_log[mark.length..], &self.data.verifys); - debug!("tainted: result={:?}", taint_set); - return taint_set.into_set(); + /// See [`RegionInference::region_constraints_added_in_snapshot`] + pub fn region_constraints_added_in_snapshot(&self, mark: &RegionSnapshot) -> Option { + self.undo_log[mark.length..] + .iter() + .map(|&elt| match elt { + AddConstraint(constraint) => Some(constraint.involves_placeholders()), + _ => None, + }).max() + .unwrap_or(None) } } diff --git a/src/librustc/infer/region_constraints/taint.rs b/src/librustc/infer/region_constraints/taint.rs deleted file mode 100644 index ef7365276f6..00000000000 --- a/src/librustc/infer/region_constraints/taint.rs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use super::*; - -#[derive(Debug)] -pub(super) struct TaintSet<'tcx> { - directions: TaintDirections, - regions: FxHashSet>, -} - -impl<'tcx> TaintSet<'tcx> { - pub(super) fn new(directions: TaintDirections, initial_region: ty::Region<'tcx>) -> Self { - let mut regions = FxHashSet::default(); - regions.insert(initial_region); - TaintSet { - directions: directions, - regions: regions, - } - } - - pub(super) fn fixed_point( - &mut self, - tcx: TyCtxt<'_, '_, 'tcx>, - undo_log: &[UndoLogEntry<'tcx>], - verifys: &[Verify<'tcx>], - ) { - let mut prev_len = 0; - while prev_len < self.len() { - debug!( - "tainted: prev_len = {:?} new_len = {:?}", - prev_len, - self.len() - ); - - prev_len = self.len(); - - for undo_entry in undo_log { - match undo_entry { - &AddConstraint(Constraint::VarSubVar(a, b)) => { - self.add_edge(tcx.mk_region(ReVar(a)), tcx.mk_region(ReVar(b))); - } - &AddConstraint(Constraint::RegSubVar(a, b)) => { - self.add_edge(a, tcx.mk_region(ReVar(b))); - } - &AddConstraint(Constraint::VarSubReg(a, b)) => { - self.add_edge(tcx.mk_region(ReVar(a)), b); - } - &AddConstraint(Constraint::RegSubReg(a, b)) => { - self.add_edge(a, b); - } - &AddGiven(a, b) => { - self.add_edge(a, tcx.mk_region(ReVar(b))); - } - &AddVerify(i) => { - span_bug!( - verifys[i].origin.span(), - "we never add verifications while doing higher-ranked things", - ) - } - &Purged | &AddCombination(..) | &AddVar(..) | &OpenSnapshot - | &CommitedSnapshot => {} - } - } - } - } - - pub(super) fn into_set(self) -> FxHashSet> { - self.regions - } - - fn len(&self) -> usize { - self.regions.len() - } - - fn add_edge(&mut self, source: ty::Region<'tcx>, target: ty::Region<'tcx>) { - if self.directions.incoming { - if self.regions.contains(&target) { - self.regions.insert(source); - } - } - - if self.directions.outgoing { - if self.regions.contains(&source) { - self.regions.insert(target); - } - } - } -} diff --git a/src/librustc/infer/resolve.rs b/src/librustc/infer/resolve.rs index a0c310ac276..f6131c01b37 100644 --- a/src/librustc/infer/resolve.rs +++ b/src/librustc/infer/resolve.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::{InferCtxt, FixupError, FixupResult}; use ty::{self, Ty, TyCtxt, TypeFoldable}; use ty::fold::{TypeFolder, TypeVisitor}; @@ -25,6 +15,7 @@ pub struct OpportunisticTypeResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> OpportunisticTypeResolver<'a, 'gcx, 'tcx> { + #[inline] pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>) -> Self { OpportunisticTypeResolver { infcx } } diff --git a/src/librustc/infer/sub.rs b/src/librustc/infer/sub.rs index 3b0f9a5e545..df76d1d3afb 100644 --- a/src/librustc/infer/sub.rs +++ b/src/librustc/infer/sub.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::SubregionOrigin; use super::combine::{CombineFields, RelationDir}; diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index bec19ba9099..3ec27bdcf1b 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use syntax::symbol::InternedString; use syntax_pos::Span; use ty::{self, Ty}; @@ -72,7 +62,7 @@ pub type TypeVariableMap = FxHashMap; struct TypeVariableData { origin: TypeVariableOrigin, - diverging: bool + diverging: bool, } #[derive(Copy, Clone, Debug)] @@ -175,7 +165,7 @@ impl<'tcx> TypeVariableTable<'tcx> { /// Creates a new type variable. /// /// - `diverging`: indicates if this is a "diverging" type - /// variable, e.g. one created as the type of a `return` + /// variable, e.g., one created as the type of a `return` /// expression. The code in this module doesn't care if a /// variable is diverging, but the main Rust type-checker will /// sometimes "unify" such variables with the `!` or `()` types. diff --git a/src/librustc/infer/unify_key.rs b/src/librustc/infer/unify_key.rs index f8001e085c4..068ff0c90e7 100644 --- a/src/librustc/infer/unify_key.rs +++ b/src/librustc/infer/unify_key.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ty::{self, FloatVarValue, IntVarValue, Ty, TyCtxt}; use rustc_data_structures::unify::{NoError, EqUnifyValue, UnifyKey, UnifyValue}; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 8910cb64215..3cf3efe1ee2 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The "main crate" of the Rust compiler. This crate contains common //! type definitions that are used by the other crates in the rustc //! "family". Some prominent examples (note that each of these modules @@ -30,7 +20,7 @@ //! //! For more information about how rustc works, see the [rustc guide]. //! -//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/ +//! [rustc guide]: https://rust-lang.github.io/rustc-guide/ //! //! # Note //! @@ -51,7 +41,6 @@ #![feature(nll)] #![feature(non_exhaustive)] #![feature(proc_macro_internals)] -#![feature(quote)] #![feature(optin_builtin_traits)] #![feature(refcell_replace_swap)] #![feature(rustc_diagnostic_macros)] @@ -60,16 +49,16 @@ #![feature(slice_sort_by_cached_key)] #![feature(specialization)] #![feature(unboxed_closures)] +#![feature(thread_local)] #![feature(trace_macros)] #![feature(trusted_len)] #![feature(vec_remove_item)] #![feature(step_trait)] +#![feature(stmt_expr_attributes)] #![feature(integer_atomics)] #![feature(test)] #![feature(in_band_lifetimes)] -#![feature(macro_at_most_once_rep)] #![feature(crate_visibility_modifier)] -#![feature(transpose_result)] #![recursion_limit="512"] @@ -81,6 +70,7 @@ extern crate core; extern crate fmt_macros; extern crate getopts; extern crate graphviz; +extern crate num_cpus; #[macro_use] extern crate lazy_static; #[macro_use] extern crate scoped_tls; #[cfg(windows)] @@ -121,7 +111,7 @@ extern crate test; #[macro_use] mod macros; -// NB: This module needs to be declared first so diagnostics are +// N.B., this module needs to be declared first so diagnostics are // registered before they are used. pub mod diagnostics; diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 01d87bdbf63..35a03823595 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Some lints that are built in to the compiler. //! //! These are the built-in lints that are emitted direct in the main @@ -174,7 +164,7 @@ declare_lint! { declare_lint! { pub LEGACY_DIRECTORY_OWNERSHIP, Deny, - "non-inline, non-`#[path]` modules (e.g. `mod foo;`) were erroneously allowed in some files \ + "non-inline, non-`#[path]` modules (e.g., `mod foo;`) were erroneously allowed in some files \ not named `mod.rs`" } @@ -209,9 +199,9 @@ declare_lint! { } declare_lint! { - pub BAD_REPR, - Warn, - "detects incorrect use of `repr` attribute" + pub ORDER_DEPENDENT_TRAIT_OBJECTS, + Deny, + "trait-object types were treated as different depending on marker-trait order" } declare_lint! { @@ -290,7 +280,7 @@ declare_lint! { declare_lint! { pub IRREFUTABLE_LET_PATTERNS, - Deny, + Warn, "detects irrefutable patterns in if-let and while-let statements" } @@ -309,13 +299,19 @@ declare_lint! { declare_lint! { pub INTRA_DOC_LINK_RESOLUTION_FAILURE, Warn, - "warn about documentation intra links resolution failure" + "failures in resolving intra-doc link targets" } declare_lint! { pub MISSING_DOC_CODE_EXAMPLES, Allow, - "warn about missing code example in an item's documentation" + "detects publicly-exported items without code samples in their documentation" +} + +declare_lint! { + pub PRIVATE_DOC_TESTS, + Allow, + "detects code samples in docs of private items not documented by rustdoc" } declare_lint! { @@ -357,14 +353,37 @@ pub mod parser { Allow, "detects the use of `?` as a macro separator" } + + declare_lint! { + pub ILL_FORMED_ATTRIBUTE_INPUT, + Warn, + "ill-formed attribute inputs that were previously accepted and used in practice" + } +} + +declare_lint! { + pub DEPRECATED_IN_FUTURE, + Allow, + "detects use of items that will be deprecated in a future version", + report_in_external_macro: true +} + +declare_lint! { + pub AMBIGUOUS_ASSOCIATED_ITEMS, + Warn, + "ambiguous associated items" } /// Does nothing as a lint pass, but registers some `Lint`s -/// which are used by other parts of the compiler. +/// that are used by other parts of the compiler. #[derive(Copy, Clone)] pub struct HardwiredLints; impl LintPass for HardwiredLints { + fn name(&self) -> &'static str { + "HardwiredLints" + } + fn get_lints(&self) -> LintArray { lint_array!( ILLEGAL_FLOATING_POINT_LITERAL_PATTERN, @@ -399,6 +418,7 @@ impl LintPass for HardwiredLints { PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES, LATE_BOUND_LIFETIME_ARGUMENTS, INCOHERENT_FUNDAMENTAL_IMPLS, + ORDER_DEPENDENT_TRAIT_OBJECTS, DEPRECATED, UNUSED_UNSAFE, UNUSED_MUT, @@ -415,11 +435,15 @@ impl LintPass for HardwiredLints { DUPLICATE_MACRO_EXPORTS, INTRA_DOC_LINK_RESOLUTION_FAILURE, MISSING_DOC_CODE_EXAMPLES, + PRIVATE_DOC_TESTS, WHERE_CLAUSES_OBJECT_SAFETY, PROC_MACRO_DERIVE_RESOLUTION_FALLBACK, MACRO_USE_EXTERN_CRATE, MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS, parser::QUESTION_MARK_MACRO_SEP, + parser::ILL_FORMED_ATTRIBUTE_INPUT, + DEPRECATED_IN_FUTURE, + AMBIGUOUS_ASSOCIATED_ITEMS, ) } } @@ -449,14 +473,14 @@ impl BuiltinLintDiagnostics { Ok(s) => (format!("dyn {}", s), Applicability::MachineApplicable), Err(_) => ("dyn ".to_string(), Applicability::HasPlaceholders) }; - db.span_suggestion_with_applicability(span, "use `dyn`", sugg, app); + db.span_suggestion(span, "use `dyn`", sugg, app); } BuiltinLintDiagnostics::AbsPathWithModule(span) => { let (sugg, app) = match sess.source_map().span_to_snippet(span) { Ok(ref s) => { // FIXME(Manishearth) ideally the emitting code // can tell us whether or not this is global - let opt_colon = if s.trim_left().starts_with("::") { + let opt_colon = if s.trim_start().starts_with("::") { "" } else { "::" @@ -466,7 +490,7 @@ impl BuiltinLintDiagnostics { } Err(_) => ("crate::".to_string(), Applicability::HasPlaceholders) }; - db.span_suggestion_with_applicability(span, "use `crate`", sugg, app); + db.span_suggestion(span, "use `crate`", sugg, app); } BuiltinLintDiagnostics::DuplicatedMacroExports(ident, earlier_span, later_span) => { db.span_label(later_span, format!("`{}` already exported", ident)); @@ -507,7 +531,7 @@ impl BuiltinLintDiagnostics { (insertion_span, anon_lts) } }; - db.span_suggestion_with_applicability( + db.span_suggestion( replace_span, &format!("indicate the anonymous lifetime{}", if n >= 2 { "s" } else { "" }), suggestion, @@ -515,12 +539,7 @@ impl BuiltinLintDiagnostics { ); } BuiltinLintDiagnostics::UnknownCrateTypes(span, note, sugg) => { - db.span_suggestion_with_applicability( - span, - ¬e, - sugg, - Applicability::MaybeIncorrect - ); + db.span_suggestion(span, ¬e, sugg, Applicability::MaybeIncorrect); } } } diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 469d77403a3..394e404fb88 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of lint checking. //! //! The lint checking is mostly consolidated into one pass which runs @@ -28,8 +18,8 @@ use self::TargetLint::*; use std::slice; use rustc_data_structures::sync::ReadGuard; -use lint::{EarlyLintPassObject, LateLintPassObject}; -use lint::{Level, Lint, LintId, LintPass, LintBuffer}; +use lint::{EarlyLintPass, EarlyLintPassObject, LateLintPassObject}; +use lint::{LintArray, Level, Lint, LintId, LintPass, LintBuffer}; use lint::builtin::BuiltinLintDiagnostics; use lint::levels::{LintLevelSets, LintLevelsBuilder}; use middle::privacy::AccessLevels; @@ -38,15 +28,17 @@ use session::{config, early_error, Session}; use ty::{self, TyCtxt, Ty}; use ty::layout::{LayoutError, LayoutOf, TyLayout}; use util::nodemap::FxHashMap; +use util::common::time; use std::default::Default as StdDefault; use syntax::ast; use syntax::edition; -use syntax_pos::{MultiSpan, Span, symbol::LocalInternedString}; +use syntax_pos::{MultiSpan, Span, symbol::{LocalInternedString, Symbol}}; use errors::DiagnosticBuilder; use hir; use hir::def_id::LOCAL_CRATE; use hir::intravisit as hir_visit; +use syntax::util::lev_distance::find_best_match_for_name; use syntax::visit as ast_visit; /// Information about the registered lints. @@ -83,7 +75,6 @@ pub struct LintSession<'a, PassObject> { passes: Option>, } - /// Lints that are buffered up early on in the `Session` before the /// `LintLevels` is calculated #[derive(PartialEq, RustcEncodable, RustcDecodable, Debug)] @@ -139,8 +130,8 @@ struct LintGroup { pub enum CheckLintNameResult<'a> { Ok(&'a [LintId]), - /// Lint doesn't exist - NoLint, + /// Lint doesn't exist. Potentially contains a suggestion for a correct lint name. + NoLint(Option), /// The lint is either renamed or removed. This is the warning /// message, and an optional new name (`None` if removed). Warning(String, Option), @@ -184,18 +175,25 @@ impl LintStore { pub fn register_early_pass(&mut self, sess: Option<&Session>, from_plugin: bool, + register_only: bool, pass: EarlyLintPassObject) { self.push_pass(sess, from_plugin, &pass); - self.early_passes.as_mut().unwrap().push(pass); + if !register_only { + self.early_passes.as_mut().unwrap().push(pass); + } } pub fn register_pre_expansion_pass( &mut self, sess: Option<&Session>, + from_plugin: bool, + register_only: bool, pass: EarlyLintPassObject, ) { - self.push_pass(sess, false, &pass); - self.pre_expansion_passes.as_mut().unwrap().push(pass); + self.push_pass(sess, from_plugin, &pass); + if !register_only { + self.pre_expansion_passes.as_mut().unwrap().push(pass); + } } pub fn register_late_pass(&mut self, @@ -359,8 +357,14 @@ impl LintStore { CheckLintNameResult::Warning(ref msg, _) => { Some(sess.struct_warn(msg)) }, - CheckLintNameResult::NoLint => { - Some(struct_err!(sess, E0602, "unknown lint: `{}`", lint_name)) + CheckLintNameResult::NoLint(suggestion) => { + let mut err = struct_err!(sess, E0602, "unknown lint: `{}`", lint_name); + + if let Some(suggestion) = suggestion { + err.help(&format!("did you mean: `{}`", suggestion)); + } + + Some(err) } CheckLintNameResult::Tool(result) => match result { Err((Some(_), new_name)) => Some(sess.struct_warn(&format!( @@ -464,7 +468,16 @@ impl LintStore { match self.by_name.get(&complete_name) { None => match self.lint_groups.get(&*complete_name) { // Now we are sure, that this lint exists nowhere - None => CheckLintNameResult::NoLint, + None => { + let symbols = self.by_name.keys() + .map(|name| Symbol::intern(&name)) + .collect::>(); + + let suggestion = + find_best_match_for_name(symbols.iter(), &lint_name.to_lowercase(), None); + + CheckLintNameResult::NoLint(suggestion) + } Some(LintGroup { lint_ids, depr, .. }) => { // Reaching this would be weird, but let's cover this case anyway if let Some(LintAlias { name, silent }) = depr { @@ -484,7 +497,7 @@ impl LintStore { Some(&Id(ref id)) => { CheckLintNameResult::Tool(Err((Some(slice::from_ref(id)), complete_name))) } - _ => CheckLintNameResult::NoLint, + _ => CheckLintNameResult::NoLint(None), } } } @@ -529,6 +542,11 @@ pub struct EarlyContext<'a> { buffered: LintBuffer, } +pub struct EarlyContextAndPass<'a, T: EarlyLintPass> { + context: EarlyContext<'a>, + pass: T, +} + /// Convenience macro for calling a `LintPass` method on every pass in the context. macro_rules! run_lints { ($cx:expr, $f:ident, $($args:expr),*) => ({ // Move the vector of passes out of `$cx` so that we can @@ -554,8 +572,6 @@ pub trait LintContext<'tcx>: Sized { fn lints(&self) -> &LintStore; fn lint_sess(&self) -> &LintSession<'tcx, Self::PassObject>; fn lint_sess_mut(&mut self) -> &mut LintSession<'tcx, Self::PassObject>; - fn enter_attrs(&mut self, attrs: &'tcx [ast::Attribute]); - fn exit_attrs(&mut self, attrs: &'tcx [ast::Attribute]); fn lookup_and_emit>(&self, lint: &'static Lint, @@ -618,15 +634,6 @@ pub trait LintContext<'tcx>: Sized { fn lint(&self, lint: &'static Lint, msg: &str) { self.lookup_and_emit(lint, None as Option, msg); } - - /// Merge the lints specified by any lint attributes into the - /// current lint context, call the provided function, then reset the - /// lints in effect to their previous state. - fn with_lint_attrs(&mut self, - id: ast::NodeId, - attrs: &'tcx [ast::Attribute], - f: F) - where F: FnOnce(&mut Self); } @@ -634,7 +641,6 @@ impl<'a> EarlyContext<'a> { fn new( sess: &'a Session, krate: &'a ast::Crate, - passes: Option>, buffered: LintBuffer, ) -> EarlyContext<'a> { EarlyContext { @@ -642,21 +648,56 @@ impl<'a> EarlyContext<'a> { krate, lint_sess: LintSession { lints: sess.lint_store.borrow(), - passes, + passes: None, }, builder: LintLevelSets::builder(sess), buffered, } } +} + +macro_rules! run_early_pass { ($cx:expr, $f:ident, $($args:expr),*) => ({ + $cx.pass.$f(&$cx.context, $($args),*); +}) } +impl<'a, T: EarlyLintPass> EarlyContextAndPass<'a, T> { fn check_id(&mut self, id: ast::NodeId) { - for early_lint in self.buffered.take(id) { - self.lookup_and_emit_with_diagnostics(early_lint.lint_id.lint, - Some(early_lint.span.clone()), - &early_lint.msg, - early_lint.diagnostic); + for early_lint in self.context.buffered.take(id) { + self.context.lookup_and_emit_with_diagnostics( + early_lint.lint_id.lint, + Some(early_lint.span.clone()), + &early_lint.msg, + early_lint.diagnostic + ); } } + + /// Merge the lints specified by any lint attributes into the + /// current lint context, call the provided function, then reset the + /// lints in effect to their previous state. + fn with_lint_attrs(&mut self, + id: ast::NodeId, + attrs: &'a [ast::Attribute], + f: F) + where F: FnOnce(&mut Self) + { + let push = self.context.builder.push(attrs); + self.check_id(id); + self.enter_attrs(attrs); + f(self); + self.exit_attrs(attrs); + self.context.builder.pop(push); + } + + fn enter_attrs(&mut self, attrs: &'a [ast::Attribute]) { + debug!("early context: enter_attrs({:?})", attrs); + run_early_pass!(self, enter_lint_attrs, attrs); + } + + fn exit_attrs(&mut self, attrs: &'a [ast::Attribute]) { + debug!("early context: exit_attrs({:?})", attrs); + run_early_pass!(self, exit_lint_attrs, attrs); + } } impl<'a, 'tcx> LintContext<'tcx> for LateContext<'a, 'tcx> { @@ -679,16 +720,6 @@ impl<'a, 'tcx> LintContext<'tcx> for LateContext<'a, 'tcx> { &mut self.lint_sess } - fn enter_attrs(&mut self, attrs: &'tcx [ast::Attribute]) { - debug!("late context: enter_attrs({:?})", attrs); - run_lints!(self, enter_lint_attrs, attrs); - } - - fn exit_attrs(&mut self, attrs: &'tcx [ast::Attribute]) { - debug!("late context: exit_attrs({:?})", attrs); - run_lints!(self, exit_lint_attrs, attrs); - } - fn lookup>(&self, lint: &'static Lint, span: Option, @@ -700,20 +731,6 @@ impl<'a, 'tcx> LintContext<'tcx> for LateContext<'a, 'tcx> { None => self.tcx.struct_lint_node(lint, id, msg), } } - - fn with_lint_attrs(&mut self, - id: ast::NodeId, - attrs: &'tcx [ast::Attribute], - f: F) - where F: FnOnce(&mut Self) - { - let prev = self.last_ast_node_with_lint_attrs; - self.last_ast_node_with_lint_attrs = id; - self.enter_attrs(attrs); - f(self); - self.exit_attrs(attrs); - self.last_ast_node_with_lint_attrs = prev; - } } impl<'a> LintContext<'a> for EarlyContext<'a> { @@ -736,16 +753,6 @@ impl<'a> LintContext<'a> for EarlyContext<'a> { &mut self.lint_sess } - fn enter_attrs(&mut self, attrs: &'a [ast::Attribute]) { - debug!("early context: enter_attrs({:?})", attrs); - run_lints!(self, enter_lint_attrs, attrs); - } - - fn exit_attrs(&mut self, attrs: &'a [ast::Attribute]) { - debug!("early context: exit_attrs({:?})", attrs); - run_lints!(self, exit_lint_attrs, attrs); - } - fn lookup>(&self, lint: &'static Lint, span: Option, @@ -753,28 +760,41 @@ impl<'a> LintContext<'a> for EarlyContext<'a> { -> DiagnosticBuilder<'_> { self.builder.struct_lint(lint, span.map(|s| s.into()), msg) } +} +impl<'a, 'tcx> LateContext<'a, 'tcx> { + /// Merge the lints specified by any lint attributes into the + /// current lint context, call the provided function, then reset the + /// lints in effect to their previous state. fn with_lint_attrs(&mut self, id: ast::NodeId, - attrs: &'a [ast::Attribute], + attrs: &'tcx [ast::Attribute], f: F) where F: FnOnce(&mut Self) { - let push = self.builder.push(attrs); - self.check_id(id); + let prev = self.last_ast_node_with_lint_attrs; + self.last_ast_node_with_lint_attrs = id; self.enter_attrs(attrs); f(self); self.exit_attrs(attrs); - self.builder.pop(push); + self.last_ast_node_with_lint_attrs = prev; + } + + fn enter_attrs(&mut self, attrs: &'tcx [ast::Attribute]) { + debug!("late context: enter_attrs({:?})", attrs); + run_lints!(self, enter_lint_attrs, attrs); + } + + fn exit_attrs(&mut self, attrs: &'tcx [ast::Attribute]) { + debug!("late context: exit_attrs({:?})", attrs); + run_lints!(self, exit_lint_attrs, attrs); } -} -impl<'a, 'tcx> LateContext<'a, 'tcx> { fn with_param_env(&mut self, id: ast::NodeId, f: F) where F: FnOnce(&mut Self), { let old_param_env = self.param_env; - self.param_env = self.tcx.param_env(self.tcx.hir.local_def_id(id)); + self.param_env = self.tcx.param_env(self.tcx.hir().local_def_id(id)); f(self); self.param_env = old_param_env; } @@ -797,13 +817,13 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> { /// items in the context of the outer item, so enable /// deep-walking. fn nested_visit_map<'this>(&'this mut self) -> hir_visit::NestedVisitorMap<'this, 'tcx> { - hir_visit::NestedVisitorMap::All(&self.tcx.hir) + hir_visit::NestedVisitorMap::All(&self.tcx.hir()) } fn visit_nested_body(&mut self, body: hir::BodyId) { let old_tables = self.tables; self.tables = self.tcx.body_tables(body); - let body = self.tcx.hir.body(body); + let body = self.tcx.hir().body(body); self.visit_body(body); self.tables = old_tables; } @@ -866,7 +886,7 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> { // in order for `check_fn` to be able to use them. let old_tables = self.tables; self.tables = self.tcx.body_tables(body_id); - let body = self.tcx.hir.body(body_id); + let body = self.tcx.hir().body(body_id); run_lints!(self, check_fn, fk, decl, body, span, id); hir_visit::walk_fn(self, fk, decl, body_id, span, id); run_lints!(self, check_fn_post, fk, decl, body, span, id); @@ -935,11 +955,6 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> { hir_visit::walk_arm(self, a); } - fn visit_decl(&mut self, d: &'tcx hir::Decl) { - run_lints!(self, check_decl, d); - hir_visit::walk_decl(self, d); - } - fn visit_generic_param(&mut self, p: &'tcx hir::GenericParam) { run_lints!(self, check_generic_param, p); hir_visit::walk_generic_param(self, p); @@ -1002,26 +1017,26 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> { } } -impl<'a> ast_visit::Visitor<'a> for EarlyContext<'a> { +impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T> { fn visit_item(&mut self, it: &'a ast::Item) { self.with_lint_attrs(it.id, &it.attrs, |cx| { - run_lints!(cx, check_item, it); + run_early_pass!(cx, check_item, it); ast_visit::walk_item(cx, it); - run_lints!(cx, check_item_post, it); + run_early_pass!(cx, check_item_post, it); }) } fn visit_foreign_item(&mut self, it: &'a ast::ForeignItem) { self.with_lint_attrs(it.id, &it.attrs, |cx| { - run_lints!(cx, check_foreign_item, it); + run_early_pass!(cx, check_foreign_item, it); ast_visit::walk_foreign_item(cx, it); - run_lints!(cx, check_foreign_item_post, it); + run_early_pass!(cx, check_foreign_item_post, it); }) } fn visit_pat(&mut self, p: &'a ast::Pat) { let mut visit_subpats = true; - run_lints!(self, check_pat, p, &mut visit_subpats); + run_early_pass!(self, check_pat, p, &mut visit_subpats); self.check_id(p.id); if visit_subpats { ast_visit::walk_pat(self, p); @@ -1030,23 +1045,23 @@ impl<'a> ast_visit::Visitor<'a> for EarlyContext<'a> { fn visit_expr(&mut self, e: &'a ast::Expr) { self.with_lint_attrs(e.id, &e.attrs, |cx| { - run_lints!(cx, check_expr, e); + run_early_pass!(cx, check_expr, e); ast_visit::walk_expr(cx, e); }) } fn visit_stmt(&mut self, s: &'a ast::Stmt) { - run_lints!(self, check_stmt, s); + run_early_pass!(self, check_stmt, s); self.check_id(s.id); ast_visit::walk_stmt(self, s); } fn visit_fn(&mut self, fk: ast_visit::FnKind<'a>, decl: &'a ast::FnDecl, span: Span, id: ast::NodeId) { - run_lints!(self, check_fn, fk, decl, span, id); + run_early_pass!(self, check_fn, fk, decl, span, id); self.check_id(id); ast_visit::walk_fn(self, fk, decl, span); - run_lints!(self, check_fn_post, fk, decl, span, id); + run_early_pass!(self, check_fn_post, fk, decl, span, id); } fn visit_variant_data(&mut self, @@ -1055,120 +1070,120 @@ impl<'a> ast_visit::Visitor<'a> for EarlyContext<'a> { g: &'a ast::Generics, item_id: ast::NodeId, _: Span) { - run_lints!(self, check_struct_def, s, ident, g, item_id); + run_early_pass!(self, check_struct_def, s, ident, g, item_id); self.check_id(s.id()); ast_visit::walk_struct_def(self, s); - run_lints!(self, check_struct_def_post, s, ident, g, item_id); + run_early_pass!(self, check_struct_def_post, s, ident, g, item_id); } fn visit_struct_field(&mut self, s: &'a ast::StructField) { self.with_lint_attrs(s.id, &s.attrs, |cx| { - run_lints!(cx, check_struct_field, s); + run_early_pass!(cx, check_struct_field, s); ast_visit::walk_struct_field(cx, s); }) } fn visit_variant(&mut self, v: &'a ast::Variant, g: &'a ast::Generics, item_id: ast::NodeId) { self.with_lint_attrs(item_id, &v.node.attrs, |cx| { - run_lints!(cx, check_variant, v, g); + run_early_pass!(cx, check_variant, v, g); ast_visit::walk_variant(cx, v, g, item_id); - run_lints!(cx, check_variant_post, v, g); + run_early_pass!(cx, check_variant_post, v, g); }) } fn visit_ty(&mut self, t: &'a ast::Ty) { - run_lints!(self, check_ty, t); + run_early_pass!(self, check_ty, t); self.check_id(t.id); ast_visit::walk_ty(self, t); } fn visit_ident(&mut self, ident: ast::Ident) { - run_lints!(self, check_ident, ident); + run_early_pass!(self, check_ident, ident); } fn visit_mod(&mut self, m: &'a ast::Mod, s: Span, _a: &[ast::Attribute], n: ast::NodeId) { - run_lints!(self, check_mod, m, s, n); + run_early_pass!(self, check_mod, m, s, n); self.check_id(n); ast_visit::walk_mod(self, m); - run_lints!(self, check_mod_post, m, s, n); + run_early_pass!(self, check_mod_post, m, s, n); } fn visit_local(&mut self, l: &'a ast::Local) { self.with_lint_attrs(l.id, &l.attrs, |cx| { - run_lints!(cx, check_local, l); + run_early_pass!(cx, check_local, l); ast_visit::walk_local(cx, l); }) } fn visit_block(&mut self, b: &'a ast::Block) { - run_lints!(self, check_block, b); + run_early_pass!(self, check_block, b); self.check_id(b.id); ast_visit::walk_block(self, b); - run_lints!(self, check_block_post, b); + run_early_pass!(self, check_block_post, b); } fn visit_arm(&mut self, a: &'a ast::Arm) { - run_lints!(self, check_arm, a); + run_early_pass!(self, check_arm, a); ast_visit::walk_arm(self, a); } fn visit_expr_post(&mut self, e: &'a ast::Expr) { - run_lints!(self, check_expr_post, e); + run_early_pass!(self, check_expr_post, e); } fn visit_generic_param(&mut self, param: &'a ast::GenericParam) { - run_lints!(self, check_generic_param, param); + run_early_pass!(self, check_generic_param, param); ast_visit::walk_generic_param(self, param); } fn visit_generics(&mut self, g: &'a ast::Generics) { - run_lints!(self, check_generics, g); + run_early_pass!(self, check_generics, g); ast_visit::walk_generics(self, g); } fn visit_where_predicate(&mut self, p: &'a ast::WherePredicate) { - run_lints!(self, check_where_predicate, p); + run_early_pass!(self, check_where_predicate, p); ast_visit::walk_where_predicate(self, p); } fn visit_poly_trait_ref(&mut self, t: &'a ast::PolyTraitRef, m: &'a ast::TraitBoundModifier) { - run_lints!(self, check_poly_trait_ref, t, m); + run_early_pass!(self, check_poly_trait_ref, t, m); ast_visit::walk_poly_trait_ref(self, t, m); } fn visit_trait_item(&mut self, trait_item: &'a ast::TraitItem) { self.with_lint_attrs(trait_item.id, &trait_item.attrs, |cx| { - run_lints!(cx, check_trait_item, trait_item); + run_early_pass!(cx, check_trait_item, trait_item); ast_visit::walk_trait_item(cx, trait_item); - run_lints!(cx, check_trait_item_post, trait_item); + run_early_pass!(cx, check_trait_item_post, trait_item); }); } fn visit_impl_item(&mut self, impl_item: &'a ast::ImplItem) { self.with_lint_attrs(impl_item.id, &impl_item.attrs, |cx| { - run_lints!(cx, check_impl_item, impl_item); + run_early_pass!(cx, check_impl_item, impl_item); ast_visit::walk_impl_item(cx, impl_item); - run_lints!(cx, check_impl_item_post, impl_item); + run_early_pass!(cx, check_impl_item_post, impl_item); }); } fn visit_lifetime(&mut self, lt: &'a ast::Lifetime) { - run_lints!(self, check_lifetime, lt); + run_early_pass!(self, check_lifetime, lt); self.check_id(lt.id); } fn visit_path(&mut self, p: &'a ast::Path, id: ast::NodeId) { - run_lints!(self, check_path, p, id); + run_early_pass!(self, check_path, p, id); self.check_id(id); ast_visit::walk_path(self, p); } fn visit_attribute(&mut self, attr: &'a ast::Attribute) { - run_lints!(self, check_attribute, attr); + run_early_pass!(self, check_attribute, attr); } fn visit_mac_def(&mut self, mac: &'a ast::MacroDef, id: ast::NodeId) { - run_lints!(self, check_mac_def, mac, id); + run_early_pass!(self, check_mac_def, mac, id); self.check_id(id); } @@ -1180,7 +1195,7 @@ impl<'a> ast_visit::Visitor<'a> for EarlyContext<'a> { // want to get #53686 fixed quickly. -nmatsakis ast_visit::walk_path(self, &mac.node.path); - run_lints!(self, check_mac, mac); + run_early_pass!(self, check_mac, mac); } } @@ -1191,7 +1206,7 @@ impl<'a> ast_visit::Visitor<'a> for EarlyContext<'a> { pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); - let krate = tcx.hir.krate(); + let krate = tcx.hir().krate(); let passes = tcx.sess.lint_store.borrow_mut().late_passes.take(); let passes = { @@ -1225,43 +1240,112 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { tcx.sess.lint_store.borrow_mut().late_passes = passes; } -pub fn check_ast_crate( +struct EarlyLintPassObjects<'a> { + lints: &'a mut [EarlyLintPassObject], +} + +impl LintPass for EarlyLintPassObjects<'_> { + fn name(&self) -> &'static str { + panic!() + } + + fn get_lints(&self) -> LintArray { + panic!() + } +} + +macro_rules! expand_early_lint_pass_impl_methods { + ([$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( + $(fn $name(&mut self, context: &EarlyContext<'_>, $($param: $arg),*) { + for obj in self.lints.iter_mut() { + obj.$name(context, $($param),*); + } + })* + ) +} + +macro_rules! early_lint_pass_impl { + ([], [$($methods:tt)*]) => ( + impl EarlyLintPass for EarlyLintPassObjects<'_> { + expand_early_lint_pass_impl_methods!([$($methods)*]); + } + ) +} + +early_lint_methods!(early_lint_pass_impl, []); + + +fn early_lint_crate( + sess: &Session, + krate: &ast::Crate, + pass: T, + buffered: LintBuffer, +) -> LintBuffer { + let mut cx = EarlyContextAndPass { + context: EarlyContext::new(sess, krate, buffered), + pass, + }; + + // Visit the whole crate. + cx.with_lint_attrs(ast::CRATE_NODE_ID, &krate.attrs, |cx| { + // since the root module isn't visited as an item (because it isn't an + // item), warn for it here. + run_early_pass!(cx, check_crate, krate); + + ast_visit::walk_crate(cx, krate); + + run_early_pass!(cx, check_crate_post, krate); + }); + cx.context.buffered +} + +pub fn check_ast_crate( sess: &Session, krate: &ast::Crate, pre_expansion: bool, + builtin_lints: T, ) { - let (passes, buffered) = if pre_expansion { + let (mut passes, mut buffered) = if pre_expansion { ( - sess.lint_store.borrow_mut().pre_expansion_passes.take(), + sess.lint_store.borrow_mut().pre_expansion_passes.take().unwrap(), LintBuffer::default(), ) } else { ( - sess.lint_store.borrow_mut().early_passes.take(), + sess.lint_store.borrow_mut().early_passes.take().unwrap(), sess.buffered_lints.borrow_mut().take().unwrap(), ) }; - let (passes, buffered) = { - let mut cx = EarlyContext::new(sess, krate, passes, buffered); - - // Visit the whole crate. - cx.with_lint_attrs(ast::CRATE_NODE_ID, &krate.attrs, |cx| { - // since the root module isn't visited as an item (because it isn't an - // item), warn for it here. - run_lints!(cx, check_crate, krate); - ast_visit::walk_crate(cx, krate); + if !sess.opts.debugging_opts.no_interleave_lints { + buffered = early_lint_crate(sess, krate, builtin_lints, buffered); - run_lints!(cx, check_crate_post, krate); - }); - (cx.lint_sess.passes, cx.buffered) - }; + if !passes.is_empty() { + buffered = early_lint_crate( + sess, + krate, + EarlyLintPassObjects { lints: &mut passes[..] }, + buffered, + ); + } + } else { + for pass in &mut passes { + buffered = time(sess, &format!("running lint: {}", pass.name()), || { + early_lint_crate( + sess, + krate, + EarlyLintPassObjects { lints: slice::from_mut(pass) }, + buffered, + ) + }); + } + } // Put the lint store levels and passes back in the session. if pre_expansion { - sess.lint_store.borrow_mut().pre_expansion_passes = passes; + sess.lint_store.borrow_mut().pre_expansion_passes = Some(passes); } else { - sess.lint_store.borrow_mut().early_passes = passes; + sess.lint_store.borrow_mut().early_passes = Some(passes); } // All of the buffered lints should have been emitted at this point. @@ -1270,7 +1354,7 @@ pub fn check_ast_crate( // // Rustdoc runs everybody-loops before the early lints and removes // function bodies, so it's totally possible for linted - // node ids to not exist (e.g. macros defined within functions for the + // node ids to not exist (e.g., macros defined within functions for the // unused_macro lint) anymore. So we only run this check // when we're not in rustdoc mode. (see issue #47639) if !sess.opts.actually_rustdoc { diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs index cfb9f04c4c6..61691576943 100644 --- a/src/librustc/lint/levels.rs +++ b/src/librustc/lint/levels.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cmp; use errors::{Applicability, DiagnosticBuilder}; @@ -66,7 +56,7 @@ impl LintLevelSets { for &(ref lint_name, level) in &sess.opts.lint_opts { store.check_lint_name_cmdline(sess, &lint_name, level); - // If the cap is less than this specified level, e.g. if we've got + // If the cap is less than this specified level, e.g., if we've got // `--cap-lints allow` but we've also got `-D foo` then we ignore // this specification as the lint cap will set it to allow anyway. let level = cmp::min(level, self.lint_cap); @@ -183,15 +173,15 @@ impl<'a> LintLevelsBuilder<'a> { /// Pushes a list of AST lint attributes onto this context. /// - /// This function will return a `BuilderPush` object which should be be - /// passed to `pop` when this scope for the attributes provided is exited. + /// This function will return a `BuilderPush` object which should be passed + /// to `pop` when this scope for the attributes provided is exited. /// /// This function will perform a number of tasks: /// /// * It'll validate all lint-related attributes in `attrs` /// * It'll mark all lint-related attributes as used /// * Lint levels will be updated based on the attributes provided - /// * Lint attributes are validated, e.g. a #[forbid] can't be switched to + /// * Lint attributes are validated, e.g., a #[forbid] can't be switched to /// #[allow] /// /// Don't forget to call `pop`! @@ -214,8 +204,6 @@ impl<'a> LintLevelsBuilder<'a> { let mut metas = if let Some(metas) = meta.meta_item_list() { metas } else { - let mut err = bad_attr(meta.span); - err.emit(); continue; }; @@ -232,14 +220,13 @@ impl<'a> LintLevelsBuilder<'a> { match item.node { ast::MetaItemKind::Word => {} // actual lint names handled later ast::MetaItemKind::NameValue(ref name_value) => { - let gate_reasons = !self.sess.features_untracked().lint_reasons; if item.ident == "reason" { // found reason, reslice meta list to exclude it metas = &metas[0..metas.len()-1]; // FIXME (#55112): issue unused-attributes lint if we thereby // don't have any lint names (`#[level(reason = "foo")]`) if let ast::LitKind::Str(rationale, _) = name_value.node { - if gate_reasons { + if !self.sess.features_untracked().lint_reasons { feature_gate::emit_feature_err( &self.sess.parse_sess, "lint_reasons", @@ -247,9 +234,8 @@ impl<'a> LintLevelsBuilder<'a> { feature_gate::GateIssue::Language, "lint reasons are experimental" ); - } else { - reason = Some(rationale); } + reason = Some(rationale); } else { let mut err = bad_attr(name_value.span); err.help("reason must be a string literal"); @@ -338,7 +324,7 @@ impl<'a> LintLevelsBuilder<'a> { Some(li.span.into()), &msg, ); - err.span_suggestion_with_applicability( + err.span_suggestion( li.span, "change it to", new_lint_name.to_string(), @@ -376,7 +362,7 @@ impl<'a> LintLevelsBuilder<'a> { Some(li.span.into()), &msg); if let Some(new_name) = renamed { - err.span_suggestion_with_applicability( + err.span_suggestion( li.span, "use the new name", new_name, @@ -385,7 +371,7 @@ impl<'a> LintLevelsBuilder<'a> { } err.emit(); } - CheckLintNameResult::NoLint => { + CheckLintNameResult::NoLint(suggestion) => { let lint = builtin::UNKNOWN_LINTS; let (level, src) = self.sets.get_lint_level(lint, self.cur, @@ -398,22 +384,17 @@ impl<'a> LintLevelsBuilder<'a> { src, Some(li.span.into()), &msg); - if name.as_str().chars().any(|c| c.is_uppercase()) { - let name_lower = name.as_str().to_lowercase().to_string(); - if let CheckLintNameResult::NoLint = - store.check_lint_name(&name_lower, tool_name) { - db.emit(); - } else { - db.span_suggestion_with_applicability( - li.span, - "lowercase the lint name", - name_lower, - Applicability::MachineApplicable - ).emit(); - } - } else { - db.emit(); + + if let Some(suggestion) = suggestion { + db.span_suggestion( + li.span, + "did you mean", + suggestion.to_string(), + Applicability::MachineApplicable, + ); } + + db.emit(); } } } diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 4b878b86252..a95fa350bf1 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Lints, aka compiler warnings. //! //! A 'lint' check is a kind of miscellaneous constraint that a user _might_ @@ -38,7 +28,7 @@ use hir::def_id::{CrateNum, LOCAL_CRATE}; use hir::intravisit; use hir; use lint::builtin::BuiltinLintDiagnostics; -use lint::builtin::parser::QUESTION_MARK_MACRO_SEP; +use lint::builtin::parser::{QUESTION_MARK_MACRO_SEP, ILL_FORMED_ATTRIBUTE_INPUT}; use session::{Session, DiagnosticMessageId}; use std::{hash, ptr}; use syntax::ast; @@ -46,7 +36,6 @@ use syntax::source_map::{MultiSpan, ExpnFormat}; use syntax::early_buffered_lints::BufferedEarlyLintId; use syntax::edition::Edition; use syntax::symbol::Symbol; -use syntax::visit as ast_visit; use syntax_pos::Span; use ty::TyCtxt; use ty::query::Providers; @@ -67,7 +56,7 @@ pub struct Lint { /// `declare_lint!()` invocations to follow the convention of upper-case /// statics without repeating the name. /// - /// The name is written with underscores, e.g. "unused_imports". + /// The name is written with underscores, e.g., "unused_imports". /// On the command line, underscores become dashes. pub name: &'static str, @@ -76,7 +65,7 @@ pub struct Lint { /// Description of the lint or the issue it detects. /// - /// e.g. "imports that are never used" + /// e.g., "imports that are never used" pub desc: &'static str, /// Starting at the given edition, default to the given lint level. If this is `None`, then use @@ -92,6 +81,7 @@ impl Lint { pub fn from_parser_lint_id(lint_id: BufferedEarlyLintId) -> &'static Self { match lint_id { BufferedEarlyLintId::QuestionMarkMacroSep => QUESTION_MARK_MACRO_SEP, + BufferedEarlyLintId::IllFormedAttributeInput => ILL_FORMED_ATTRIBUTE_INPUT, } } @@ -171,9 +161,11 @@ macro_rules! lint_array { pub type LintArray = Vec<&'static Lint>; pub trait LintPass { + fn name(&self) -> &'static str; + /// Get descriptions of the lints this `LintPass` object can emit. /// - /// NB: there is no enforcement that the object only emits lints it registered. + /// N.B., there is no enforcement that the object only emits lints it registered. /// And some `rustc` internal `LintPass`es register lints to be emitted by other /// parts of the compiler. If you want enforced access restrictions for your /// `Lint`, make it a private `static` item in its own module. @@ -201,7 +193,6 @@ macro_rules! late_lint_methods { fn check_stmt(a: &$hir hir::Stmt); fn check_arm(a: &$hir hir::Arm); fn check_pat(a: &$hir hir::Pat); - fn check_decl(a: &$hir hir::Decl); fn check_expr(a: &$hir hir::Expr); fn check_expr_post(a: &$hir hir::Expr); fn check_ty(a: &$hir hir::Ty); @@ -317,6 +308,10 @@ macro_rules! declare_combined_late_lint_pass { } impl LintPass for $name { + fn name(&self) -> &'static str { + panic!() + } + fn get_lints(&self) -> LintArray { let mut lints = Vec::new(); $(lints.extend_from_slice(&self.$passes.get_lints());)* @@ -326,57 +321,139 @@ macro_rules! declare_combined_late_lint_pass { ) } -pub trait EarlyLintPass: LintPass { - fn check_ident(&mut self, _: &EarlyContext<'_>, _: ast::Ident) { } - fn check_crate(&mut self, _: &EarlyContext<'_>, _: &ast::Crate) { } - fn check_crate_post(&mut self, _: &EarlyContext<'_>, _: &ast::Crate) { } - fn check_mod(&mut self, _: &EarlyContext<'_>, _: &ast::Mod, _: Span, _: ast::NodeId) { } - fn check_mod_post(&mut self, _: &EarlyContext<'_>, _: &ast::Mod, _: Span, _: ast::NodeId) { } - fn check_foreign_item(&mut self, _: &EarlyContext<'_>, _: &ast::ForeignItem) { } - fn check_foreign_item_post(&mut self, _: &EarlyContext<'_>, _: &ast::ForeignItem) { } - fn check_item(&mut self, _: &EarlyContext<'_>, _: &ast::Item) { } - fn check_item_post(&mut self, _: &EarlyContext<'_>, _: &ast::Item) { } - fn check_local(&mut self, _: &EarlyContext<'_>, _: &ast::Local) { } - fn check_block(&mut self, _: &EarlyContext<'_>, _: &ast::Block) { } - fn check_block_post(&mut self, _: &EarlyContext<'_>, _: &ast::Block) { } - fn check_stmt(&mut self, _: &EarlyContext<'_>, _: &ast::Stmt) { } - fn check_arm(&mut self, _: &EarlyContext<'_>, _: &ast::Arm) { } - fn check_pat(&mut self, _: &EarlyContext<'_>, _: &ast::Pat, _: &mut bool) { } - fn check_expr(&mut self, _: &EarlyContext<'_>, _: &ast::Expr) { } - fn check_expr_post(&mut self, _: &EarlyContext<'_>, _: &ast::Expr) { } - fn check_ty(&mut self, _: &EarlyContext<'_>, _: &ast::Ty) { } - fn check_generic_param(&mut self, _: &EarlyContext<'_>, _: &ast::GenericParam) { } - fn check_generics(&mut self, _: &EarlyContext<'_>, _: &ast::Generics) { } - fn check_where_predicate(&mut self, _: &EarlyContext<'_>, _: &ast::WherePredicate) { } - fn check_poly_trait_ref(&mut self, _: &EarlyContext<'_>, _: &ast::PolyTraitRef, - _: &ast::TraitBoundModifier) { } - fn check_fn(&mut self, _: &EarlyContext<'_>, - _: ast_visit::FnKind<'_>, _: &ast::FnDecl, _: Span, _: ast::NodeId) { } - fn check_fn_post(&mut self, _: &EarlyContext<'_>, - _: ast_visit::FnKind<'_>, _: &ast::FnDecl, _: Span, _: ast::NodeId) { } - fn check_trait_item(&mut self, _: &EarlyContext<'_>, _: &ast::TraitItem) { } - fn check_trait_item_post(&mut self, _: &EarlyContext<'_>, _: &ast::TraitItem) { } - fn check_impl_item(&mut self, _: &EarlyContext<'_>, _: &ast::ImplItem) { } - fn check_impl_item_post(&mut self, _: &EarlyContext<'_>, _: &ast::ImplItem) { } - fn check_struct_def(&mut self, _: &EarlyContext<'_>, - _: &ast::VariantData, _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { } - fn check_struct_def_post(&mut self, _: &EarlyContext<'_>, - _: &ast::VariantData, _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { } - fn check_struct_field(&mut self, _: &EarlyContext<'_>, _: &ast::StructField) { } - fn check_variant(&mut self, _: &EarlyContext<'_>, _: &ast::Variant, _: &ast::Generics) { } - fn check_variant_post(&mut self, _: &EarlyContext<'_>, _: &ast::Variant, _: &ast::Generics) { } - fn check_lifetime(&mut self, _: &EarlyContext<'_>, _: &ast::Lifetime) { } - fn check_path(&mut self, _: &EarlyContext<'_>, _: &ast::Path, _: ast::NodeId) { } - fn check_attribute(&mut self, _: &EarlyContext<'_>, _: &ast::Attribute) { } - fn check_mac_def(&mut self, _: &EarlyContext<'_>, _: &ast::MacroDef, _id: ast::NodeId) { } - fn check_mac(&mut self, _: &EarlyContext<'_>, _: &ast::Mac) { } - - /// Called when entering a syntax node that can have lint attributes such - /// as `#[allow(...)]`. Called with *all* the attributes of that node. - fn enter_lint_attrs(&mut self, _: &EarlyContext<'_>, _: &[ast::Attribute]) { } - - /// Counterpart to `enter_lint_attrs`. - fn exit_lint_attrs(&mut self, _: &EarlyContext<'_>, _: &[ast::Attribute]) { } +#[macro_export] +macro_rules! early_lint_methods { + ($macro:path, $args:tt) => ( + $macro!($args, [ + fn check_ident(a: ast::Ident); + fn check_crate(a: &ast::Crate); + fn check_crate_post(a: &ast::Crate); + fn check_mod(a: &ast::Mod, b: Span, c: ast::NodeId); + fn check_mod_post(a: &ast::Mod, b: Span, c: ast::NodeId); + fn check_foreign_item(a: &ast::ForeignItem); + fn check_foreign_item_post(a: &ast::ForeignItem); + fn check_item(a: &ast::Item); + fn check_item_post(a: &ast::Item); + fn check_local(a: &ast::Local); + fn check_block(a: &ast::Block); + fn check_block_post(a: &ast::Block); + fn check_stmt(a: &ast::Stmt); + fn check_arm(a: &ast::Arm); + fn check_pat(a: &ast::Pat, b: &mut bool); // FIXME: &mut bool looks just broken + fn check_expr(a: &ast::Expr); + fn check_expr_post(a: &ast::Expr); + fn check_ty(a: &ast::Ty); + fn check_generic_param(a: &ast::GenericParam); + fn check_generics(a: &ast::Generics); + fn check_where_predicate(a: &ast::WherePredicate); + fn check_poly_trait_ref(a: &ast::PolyTraitRef, + b: &ast::TraitBoundModifier); + fn check_fn(a: syntax::visit::FnKind<'_>, b: &ast::FnDecl, c: Span, d_: ast::NodeId); + fn check_fn_post( + a: syntax::visit::FnKind<'_>, + b: &ast::FnDecl, + c: Span, + d: ast::NodeId + ); + fn check_trait_item(a: &ast::TraitItem); + fn check_trait_item_post(a: &ast::TraitItem); + fn check_impl_item(a: &ast::ImplItem); + fn check_impl_item_post(a: &ast::ImplItem); + fn check_struct_def( + a: &ast::VariantData, + b: ast::Ident, + c: &ast::Generics, + d: ast::NodeId + ); + fn check_struct_def_post( + a: &ast::VariantData, + b: ast::Ident, + c: &ast::Generics, + d: ast::NodeId + ); + fn check_struct_field(a: &ast::StructField); + fn check_variant(a: &ast::Variant, b: &ast::Generics); + fn check_variant_post(a: &ast::Variant, b: &ast::Generics); + fn check_lifetime(a: &ast::Lifetime); + fn check_path(a: &ast::Path, b: ast::NodeId); + fn check_attribute(a: &ast::Attribute); + fn check_mac_def(a: &ast::MacroDef, b: ast::NodeId); + fn check_mac(a: &ast::Mac); + + /// Called when entering a syntax node that can have lint attributes such + /// as `#[allow(...)]`. Called with *all* the attributes of that node. + fn enter_lint_attrs(a: &[ast::Attribute]); + + /// Counterpart to `enter_lint_attrs`. + fn exit_lint_attrs(a: &[ast::Attribute]); + ]); + ) +} + +macro_rules! expand_early_lint_pass_methods { + ($context:ty, [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( + $(#[inline(always)] fn $name(&mut self, _: $context, $(_: $arg),*) {})* + ) +} + +macro_rules! declare_early_lint_pass { + ([], [$($methods:tt)*]) => ( + pub trait EarlyLintPass: LintPass { + expand_early_lint_pass_methods!(&EarlyContext<'_>, [$($methods)*]); + } + ) +} + +early_lint_methods!(declare_early_lint_pass, []); + +#[macro_export] +macro_rules! expand_combined_early_lint_pass_method { + ([$($passes:ident),*], $self: ident, $name: ident, $params:tt) => ({ + $($self.$passes.$name $params;)* + }) +} + +#[macro_export] +macro_rules! expand_combined_early_lint_pass_methods { + ($passes:tt, [$($(#[$attr:meta])* fn $name:ident($($param:ident: $arg:ty),*);)*]) => ( + $(fn $name(&mut self, context: &EarlyContext<'_>, $($param: $arg),*) { + expand_combined_early_lint_pass_method!($passes, self, $name, (context, $($param),*)); + })* + ) +} + +#[macro_export] +macro_rules! declare_combined_early_lint_pass { + ([$v:vis $name:ident, [$($passes:ident: $constructor:expr,)*]], $methods:tt) => ( + #[allow(non_snake_case)] + $v struct $name { + $($passes: $passes,)* + } + + impl $name { + $v fn new() -> Self { + Self { + $($passes: $constructor,)* + } + } + } + + impl EarlyLintPass for $name { + expand_combined_early_lint_pass_methods!([$($passes),*], $methods); + } + + impl LintPass for $name { + fn name(&self) -> &'static str { + panic!() + } + + fn get_lints(&self) -> LintArray { + let mut lints = Vec::new(); + $(lints.extend_from_slice(&self.$passes.get_lints());)* + lints + } + } + ) } /// A lint pass boxed up as a trait object. @@ -643,7 +720,7 @@ fn lint_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, cnum: CrateNum) levels: LintLevelSets::builder(tcx.sess), tcx: tcx, }; - let krate = tcx.hir.krate(); + let krate = tcx.hir().krate(); builder.with_lint_attrs(ast::CRATE_NODE_ID, &krate.attrs, |builder| { intravisit::walk_crate(builder, krate); @@ -665,7 +742,7 @@ impl<'a, 'tcx> LintLevelMapBuilder<'a, 'tcx> { where F: FnOnce(&mut Self) { let push = self.levels.push(attrs); - self.levels.register_id(self.tcx.hir.definitions().node_to_hir_id(id)); + self.levels.register_id(self.tcx.hir().definitions().node_to_hir_id(id)); f(self); self.levels.pop(push); } @@ -673,7 +750,7 @@ impl<'a, 'tcx> LintLevelMapBuilder<'a, 'tcx> { impl<'a, 'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> { - intravisit::NestedVisitorMap::All(&self.tcx.hir) + intravisit::NestedVisitorMap::All(&self.tcx.hir()) } fn visit_item(&mut self, it: &'tcx hir::Item) { diff --git a/src/librustc/macros.rs b/src/librustc/macros.rs index 50375435eb9..2978b353199 100644 --- a/src/librustc/macros.rs +++ b/src/librustc/macros.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength macro_rules! enum_from_u32 { diff --git a/src/librustc/middle/allocator.rs b/src/librustc/middle/allocator.rs index 79a9ef0e8b5..bb2e3b4ec19 100644 --- a/src/librustc/middle/allocator.rs +++ b/src/librustc/middle/allocator.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Clone, Copy)] pub enum AllocatorKind { Global, diff --git a/src/librustc/middle/borrowck.rs b/src/librustc/middle/borrowck.rs index 633c5841378..120ba6b1d4e 100644 --- a/src/librustc/middle/borrowck.rs +++ b/src/librustc/middle/borrowck.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ich::StableHashingContext; use hir::HirId; use util::nodemap::FxHashSet; diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 4720bb29549..9168bbf907f 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -1,23 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! the rustc crate store interface. This also includes types that //! are *mostly* used as a part of that interface, but these should //! probably get a better home if someone can find one. @@ -59,7 +39,7 @@ pub enum DepKind { /// A dependency that is only used for its macros. MacrosOnly, /// A dependency that is always injected into the dependency list and so - /// doesn't need to be linked to an rlib, e.g. the injected allocator. + /// doesn't need to be linked to an rlib, e.g., the injected allocator. Implicit, /// A dependency that is required by an rlib version of this crate. /// Ordinary `extern crate`s result in `Explicit` dependencies. @@ -160,7 +140,7 @@ pub enum ExternCrateSource { ), // Crate is loaded by `use`. Use, - /// Crate is implicitly loaded by an absolute or an `extern::` path. + /// Crate is implicitly loaded by an absolute path. Path, } diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 282b5d13e2c..abbf0ae210c 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This implements the dead-code warning pass. It follows middle::reachable // closely. The idea is that all reachable symbols are live, codes called // from live codes are live, and everything else is dead. @@ -25,6 +15,8 @@ use middle::privacy; use ty::{self, TyCtxt}; use util::nodemap::FxHashSet; +use rustc_data_structures::fx::FxHashMap; + use syntax::{ast, source_map}; use syntax::attr; use syntax_pos; @@ -35,7 +27,7 @@ use syntax_pos; // may need to be marked as live. fn should_explore<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, node_id: ast::NodeId) -> bool { - match tcx.hir.find(node_id) { + match tcx.hir().find(node_id) { Some(Node::Item(..)) | Some(Node::ImplItem(..)) | Some(Node::ForeignItem(..)) | @@ -55,12 +47,15 @@ struct MarkSymbolVisitor<'a, 'tcx: 'a> { in_pat: bool, inherited_pub_visibility: bool, ignore_variant_stack: Vec, + // maps from tuple struct constructors to tuple struct items + struct_constructors: FxHashMap, } impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { fn check_def_id(&mut self, def_id: DefId) { - if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) { - if should_explore(self.tcx, node_id) { + if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) { + if should_explore(self.tcx, node_id) || + self.struct_constructors.contains_key(&node_id) { self.worklist.push(node_id); } self.live_symbols.insert(node_id); @@ -68,7 +63,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { } fn insert_def_id(&mut self, def_id: DefId) { - if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) { + if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) { debug_assert!(!should_explore(self.tcx, node_id)); self.live_symbols.insert(node_id); } @@ -137,23 +132,27 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { continue } - if let Some(ref node) = self.tcx.hir.find(id) { + // in the case of tuple struct constructors we want to check the item, not the generated + // tuple struct constructor function + let id = self.struct_constructors.get(&id).cloned().unwrap_or(id); + + if let Some(node) = self.tcx.hir().find(id) { self.live_symbols.insert(id); self.visit_node(node); } } } - fn visit_node(&mut self, node: &Node<'tcx>) { + fn visit_node(&mut self, node: Node<'tcx>) { let had_repr_c = self.repr_has_repr_c; self.repr_has_repr_c = false; let had_inherited_pub_visibility = self.inherited_pub_visibility; self.inherited_pub_visibility = false; - match *node { + match node { Node::Item(item) => { match item.node { hir::ItemKind::Struct(..) | hir::ItemKind::Union(..) => { - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); let def = self.tcx.adt_def(def_id); self.repr_has_repr_c = def.repr.c(); @@ -166,6 +165,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> { hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) | hir::ItemKind::Static(..) + | hir::ItemKind::Existential(..) | hir::ItemKind::Const(..) => { intravisit::walk_item(self, &item); } @@ -205,7 +205,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { fn visit_nested_body(&mut self, body: hir::BodyId) { let old_tables = self.tables; self.tables = self.tcx.body_tables(body); - let body = self.tcx.hir.body(body); + let body = self.tcx.hir().body(body); self.visit_body(body); self.tables = old_tables; } @@ -306,11 +306,11 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>, return true; } - let def_id = tcx.hir.local_def_id(id); + let def_id = tcx.hir().local_def_id(id); let cg_attrs = tcx.codegen_fn_attrs(def_id); // #[used], #[no_mangle], #[export_name], etc also keeps the item alive - // forcefully, e.g. for placing it in a specific section. + // forcefully, e.g., for placing it in a specific section. if cg_attrs.contains_extern_indicator() || cg_attrs.flags.contains(CodegenFnAttrFlags::USED) { return true; @@ -336,6 +336,8 @@ struct LifeSeeder<'k, 'tcx: 'k> { worklist: Vec, krate: &'k hir::Crate, tcx: TyCtxt<'k, 'tcx, 'tcx>, + // see `MarkSymbolVisitor::struct_constructors` + struct_constructors: FxHashMap, } impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> { @@ -378,6 +380,9 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> { } } } + hir::ItemKind::Struct(ref variant_data, _) => { + self.struct_constructors.insert(variant_data.id(), item.id); + } _ => () } } @@ -391,11 +396,11 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> { } } -fn create_and_seed_worklist<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - access_levels: &privacy::AccessLevels, - krate: &hir::Crate) - -> Vec -{ +fn create_and_seed_worklist<'a, 'tcx>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + access_levels: &privacy::AccessLevels, + krate: &hir::Crate, +) -> (Vec, FxHashMap) { let worklist = access_levels.map.iter().filter_map(|(&id, level)| { if level >= &privacy::AccessLevel::Reachable { Some(id) @@ -404,7 +409,7 @@ fn create_and_seed_worklist<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } }).chain( // Seed entry point - tcx.sess.entry_fn.borrow().map(|(id, _, _)| id) + tcx.entry_fn(LOCAL_CRATE).map(|(def_id, _)| tcx.hir().as_local_node_id(def_id).unwrap()) ).collect::>(); // Seed implemented trait items @@ -412,17 +417,18 @@ fn create_and_seed_worklist<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, worklist, krate, tcx, + struct_constructors: Default::default(), }; krate.visit_all_item_likes(&mut life_seeder); - return life_seeder.worklist; + (life_seeder.worklist, life_seeder.struct_constructors) } fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate) -> FxHashSet { - let worklist = create_and_seed_worklist(tcx, access_levels, krate); + let (worklist, struct_constructors) = create_and_seed_worklist(tcx, access_levels, krate); let mut symbol_visitor = MarkSymbolVisitor { worklist, tcx, @@ -432,20 +438,12 @@ fn find_live<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, in_pat: false, inherited_pub_visibility: false, ignore_variant_stack: vec![], + struct_constructors, }; symbol_visitor.mark_live_symbols(); symbol_visitor.live_symbols } -fn get_struct_ctor_id(item: &hir::Item) -> Option { - match item.node { - hir::ItemKind::Struct(ref struct_def, _) if !struct_def.is_struct() => { - Some(struct_def.id()) - } - _ => None - } -} - struct DeadVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, live_symbols: FxHashSet, @@ -463,57 +461,46 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> { | hir::ItemKind::Union(..) => true, _ => false }; - let ctor_id = get_struct_ctor_id(item); - should_warn && !self.symbol_is_live(item.id, ctor_id) + should_warn && !self.symbol_is_live(item.id) } fn should_warn_about_field(&mut self, field: &hir::StructField) -> bool { - let field_type = self.tcx.type_of(self.tcx.hir.local_def_id(field.id)); + let field_type = self.tcx.type_of(self.tcx.hir().local_def_id(field.id)); !field.is_positional() - && !self.symbol_is_live(field.id, None) + && !self.symbol_is_live(field.id) && !field_type.is_phantom_data() && !has_allow_dead_code_or_lang_attr(self.tcx, field.id, &field.attrs) } fn should_warn_about_variant(&mut self, variant: &hir::VariantKind) -> bool { - !self.symbol_is_live(variant.data.id(), None) + !self.symbol_is_live(variant.data.id()) && !has_allow_dead_code_or_lang_attr(self.tcx, variant.data.id(), &variant.attrs) } fn should_warn_about_foreign_item(&mut self, fi: &hir::ForeignItem) -> bool { - !self.symbol_is_live(fi.id, None) + !self.symbol_is_live(fi.id) && !has_allow_dead_code_or_lang_attr(self.tcx, fi.id, &fi.attrs) } // id := node id of an item's definition. - // ctor_id := `Some` if the item is a struct_ctor (tuple struct), - // `None` otherwise. - // If the item is a struct_ctor, then either its `id` or - // `ctor_id` (unwrapped) is in the live_symbols set. More specifically, - // DefMap maps the ExprKind::Path of a struct_ctor to the node referred by - // `ctor_id`. On the other hand, in a statement like - // `type = ;` where refers to a struct_ctor, - // DefMap maps to `id` instead. - fn symbol_is_live(&mut self, - id: ast::NodeId, - ctor_id: Option) - -> bool { - if self.live_symbols.contains(&id) - || ctor_id.map_or(false, |ctor| self.live_symbols.contains(&ctor)) - { + fn symbol_is_live( + &mut self, + id: ast::NodeId, + ) -> bool { + if self.live_symbols.contains(&id) { return true; } // If it's a type whose items are live, then it's live, too. // This is done to handle the case where, for example, the static // method of a private type is used, but the type itself is never // called directly. - let def_id = self.tcx.hir.local_def_id(id); + let def_id = self.tcx.hir().local_def_id(id); let inherent_impls = self.tcx.inherent_impls(def_id); for &impl_did in inherent_impls.iter() { for &item_did in &self.tcx.associated_item_def_ids(impl_did)[..] { - if let Some(item_node_id) = self.tcx.hir.as_local_node_id(item_did) { + if let Some(item_node_id) = self.tcx.hir().as_local_node_id(item_did) { if self.live_symbols.contains(&item_node_id) { return true; } @@ -546,7 +533,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { /// an error. We could do this also by checking the parents, but /// this is how the code is setup and it seems harmless enough. fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::All(&self.tcx.hir) + NestedVisitorMap::All(&self.tcx.hir()) } fn visit_item(&mut self, item: &'tcx hir::Item) { @@ -570,7 +557,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { self.warn_dead_code( item.id, span, - item.name, + item.ident.name, item.node.descriptive_variant(), participle, ); @@ -585,7 +572,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { g: &'tcx hir::Generics, id: ast::NodeId) { if self.should_warn_about_variant(&variant.node) { - self.warn_dead_code(variant.node.data.id(), variant.span, variant.node.name, + self.warn_dead_code(variant.node.data.id(), variant.span, variant.node.ident.name, "variant", "constructed"); } else { intravisit::walk_variant(self, variant, g, id); @@ -594,7 +581,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { fn visit_foreign_item(&mut self, fi: &'tcx hir::ForeignItem) { if self.should_warn_about_foreign_item(fi) { - self.warn_dead_code(fi.id, fi.span, fi.name, + self.warn_dead_code(fi.id, fi.span, fi.ident.name, fi.node.descriptive_variant(), "used"); } intravisit::walk_foreign_item(self, fi); @@ -610,7 +597,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) { match impl_item.node { hir::ImplItemKind::Const(_, body_id) => { - if !self.symbol_is_live(impl_item.id, None) { + if !self.symbol_is_live(impl_item.id) { self.warn_dead_code(impl_item.id, impl_item.span, impl_item.ident.name, @@ -620,7 +607,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { self.visit_nested_body(body_id) } hir::ImplItemKind::Method(_, body_id) => { - if !self.symbol_is_live(impl_item.id, None) { + if !self.symbol_is_live(impl_item.id) { let span = self.tcx.sess.source_map().def_span(impl_item.span); self.warn_dead_code(impl_item.id, span, impl_item.ident.name, "method", "used"); } @@ -647,7 +634,7 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> { pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); - let krate = tcx.hir.krate(); + let krate = tcx.hir().krate(); let live_symbols = find_live(tcx, access_levels, krate); let mut visitor = DeadVisitor { tcx, diff --git a/src/librustc/middle/dependency_format.rs b/src/librustc/middle/dependency_format.rs index 671f513d5b9..16c9344a037 100644 --- a/src/librustc/middle/dependency_format.rs +++ b/src/librustc/middle/dependency_format.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Resolution of mixing rlibs and dylibs //! //! When producing a final artifact, such as a dynamic library, the compiler has @@ -127,9 +117,8 @@ fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sess.crt_static() => Linkage::Static, config::CrateType::Executable => Linkage::Dynamic, - // proc-macro crates are required to be dylibs, and they're currently - // required to link to libsyntax as well. - config::CrateType::ProcMacro => Linkage::Dynamic, + // proc-macro crates are mostly cdylibs, but we also need metadata. + config::CrateType::ProcMacro => Linkage::Static, // No linkage happens with rlibs, we just needed the metadata (which we // got long ago), so don't bother with anything. @@ -202,7 +191,7 @@ fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // static libraries. // // If the crate hasn't been included yet and it's not actually required - // (e.g. it's an allocator) then we skip it here as well. + // (e.g., it's an allocator) then we skip it here as well. for &cnum in tcx.crates().iter() { let src = tcx.used_crate_source(cnum); if src.dylib.is_none() && @@ -307,7 +296,7 @@ fn attempt_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::map as hir_map; -use hir::def_id::{CRATE_DEF_INDEX}; +use hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, LOCAL_CRATE}; use session::{config, Session}; use session::config::EntryFnType; use syntax::ast::NodeId; @@ -18,6 +8,8 @@ use syntax::entry::EntryPointType; use syntax_pos::Span; use hir::{Item, ItemKind, ImplItem, TraitItem}; use hir::itemlikevisit::ItemLikeVisitor; +use ty::TyCtxt; +use ty::query::Providers; struct EntryContext<'a, 'tcx: 'a> { session: &'a Session, @@ -55,39 +47,37 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for EntryContext<'a, 'tcx> { } } -pub fn find_entry_point(session: &Session, - hir_map: &hir_map::Map<'_>, - crate_name: &str) { - let any_exe = session.crate_types.borrow().iter().any(|ty| { +fn entry_fn(tcx: TyCtxt<'_, '_, '_>, cnum: CrateNum) -> Option<(DefId, EntryFnType)> { + assert_eq!(cnum, LOCAL_CRATE); + + let any_exe = tcx.sess.crate_types.borrow().iter().any(|ty| { *ty == config::CrateType::Executable }); if !any_exe { // No need to find a main function - session.entry_fn.set(None); - return + return None; } // If the user wants no main function at all, then stop here. - if attr::contains_name(&hir_map.krate().attrs, "no_main") { - session.entry_fn.set(None); - return + if attr::contains_name(&tcx.hir().krate().attrs, "no_main") { + return None; } let mut ctxt = EntryContext { - session, - map: hir_map, + session: tcx.sess, + map: tcx.hir(), main_fn: None, attr_main_fn: None, start_fn: None, non_main_fns: Vec::new(), }; - hir_map.krate().visit_all_item_likes(&mut ctxt); + tcx.hir().krate().visit_all_item_likes(&mut ctxt); - configure_main(&mut ctxt, crate_name); + configure_main(tcx, &ctxt) } -// Beware, this is duplicated in libsyntax/entry.rs, make sure to keep +// Beware, this is duplicated in `libsyntax/entry.rs`, so make sure to keep // them in sync. fn entry_point_type(item: &Item, at_root: bool) -> EntryPointType { match item.node { @@ -96,9 +86,9 @@ fn entry_point_type(item: &Item, at_root: bool) -> EntryPointType { EntryPointType::Start } else if attr::contains_name(&item.attrs, "main") { EntryPointType::MainAttr - } else if item.name == "main" { + } else if item.ident.name == "main" { if at_root { - // This is a top-level function so can be 'main' + // This is a top-level function so can be 'main'. EntryPointType::MainNamed } else { EntryPointType::OtherMain @@ -145,43 +135,58 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) { .span_label(item.span, "multiple `start` functions") .emit(); } - }, - EntryPointType::None => () + } + EntryPointType::None => (), } } -fn configure_main(this: &mut EntryContext<'_, '_>, crate_name: &str) { - if let Some((node_id, span)) = this.start_fn { - this.session.entry_fn.set(Some((node_id, span, EntryFnType::Start))); - } else if let Some((node_id, span)) = this.attr_main_fn { - this.session.entry_fn.set(Some((node_id, span, EntryFnType::Main))); - } else if let Some((node_id, span)) = this.main_fn { - this.session.entry_fn.set(Some((node_id, span, EntryFnType::Main))); +fn configure_main( + tcx: TyCtxt<'_, '_, '_>, + visitor: &EntryContext<'_, '_>, +) -> Option<(DefId, EntryFnType)> { + if let Some((node_id, _)) = visitor.start_fn { + Some((tcx.hir().local_def_id(node_id), EntryFnType::Start)) + } else if let Some((node_id, _)) = visitor.attr_main_fn { + Some((tcx.hir().local_def_id(node_id), EntryFnType::Main)) + } else if let Some((node_id, _)) = visitor.main_fn { + Some((tcx.hir().local_def_id(node_id), EntryFnType::Main)) } else { // No main function - this.session.entry_fn.set(None); - let mut err = struct_err!(this.session, E0601, - "`main` function not found in crate `{}`", crate_name); - if !this.non_main_fns.is_empty() { + let mut err = struct_err!(tcx.sess, E0601, + "`main` function not found in crate `{}`", tcx.crate_name(LOCAL_CRATE)); + if !visitor.non_main_fns.is_empty() { // There were some functions named 'main' though. Try to give the user a hint. err.note("the main function must be defined at the crate level \ but you have one or more functions named 'main' that are not \ defined at the crate level. Either move the definition or \ attach the `#[main]` attribute to override this behavior."); - for &(_, span) in &this.non_main_fns { + for &(_, span) in &visitor.non_main_fns { err.span_note(span, "here is a function named 'main'"); } err.emit(); - this.session.abort_if_errors(); + tcx.sess.abort_if_errors(); } else { - if let Some(ref filename) = this.session.local_crate_source_file { + if let Some(ref filename) = tcx.sess.local_crate_source_file { err.note(&format!("consider adding a `main` function to `{}`", filename.display())); } - if this.session.teach(&err.get_code().unwrap()) { + if tcx.sess.teach(&err.get_code().unwrap()) { err.note("If you don't know the basics of Rust, you can go look to the Rust Book \ to get started: https://doc.rust-lang.org/book/"); } err.emit(); } + + None } } + +pub fn find_entry_point(tcx: TyCtxt<'_, '_, '_>) -> Option<(DefId, EntryFnType)> { + tcx.entry_fn(LOCAL_CRATE) +} + +pub fn provide(providers: &mut Providers<'_>) { + *providers = Providers { + entry_fn, + ..*providers + }; +} diff --git a/src/librustc/middle/exported_symbols.rs b/src/librustc/middle/exported_symbols.rs index 44572a1977a..a0a73ea0b81 100644 --- a/src/librustc/middle/exported_symbols.rs +++ b/src/librustc/middle/exported_symbols.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def_id::{DefId, LOCAL_CRATE}; use ich::StableHashingContext; use rustc_data_structures::stable_hasher::{StableHasher, HashStable, diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 5b92bfe6ad3..08210c3f075 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A different sort of visitor for walking fn bodies. Unlike the //! normal visitor, which just walks the entire body in one shot, the //! `ExprUseVisitor` determines how expressions are being used. @@ -489,7 +479,8 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { } hir::ExprKind::Continue(..) | - hir::ExprKind::Lit(..) => {} + hir::ExprKind::Lit(..) | + hir::ExprKind::Err => {} hir::ExprKind::Loop(ref blk, _, _) => { self.walk_block(&blk); @@ -598,21 +589,17 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { fn walk_stmt(&mut self, stmt: &hir::Stmt) { match stmt.node { - hir::StmtKind::Decl(ref decl, _) => { - match decl.node { - hir::DeclKind::Local(ref local) => { - self.walk_local(&local); - } + hir::StmtKind::Local(ref local) => { + self.walk_local(&local); + } - hir::DeclKind::Item(_) => { - // we don't visit nested items in this visitor, - // only the fn body we were given. - } - } + hir::StmtKind::Item(_) => { + // we don't visit nested items in this visitor, + // only the fn body we were given. } - hir::StmtKind::Expr(ref expr, _) | - hir::StmtKind::Semi(ref expr, _) => { + hir::StmtKind::Expr(ref expr) | + hir::StmtKind::Semi(ref expr) => { self.consume_expr(&expr); } } @@ -622,7 +609,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { match local.init { None => { local.pat.each_binding(|_, hir_id, span, _| { - let node_id = self.mc.tcx.hir.hir_to_node_id(hir_id); + let node_id = self.mc.tcx.hir().hir_to_node_id(hir_id); self.delegate.decl_without_init(node_id, span); }) } @@ -813,7 +800,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { self.consume_expr(&arm.body); } - /// Walks a pat that occurs in isolation (i.e. top-level of fn + /// Walks a pat that occurs in isolation (i.e., top-level of fn /// arg or let binding. *Not* a match arm or nested pat.) fn walk_irrefutable_pat(&mut self, cmt_discr: mc::cmt<'tcx>, pat: &hir::Pat) { let mut mode = Unknown; @@ -851,7 +838,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { } /// The core driver for walking a pattern; `match_mode` must be - /// established up front, e.g. via `determine_pat_move_mode` (see + /// established up front, e.g., via `determine_pat_move_mode` (see /// also `walk_irrefutable_pat` for patterns that stand alone). fn walk_pat(&mut self, cmt_discr: mc::cmt<'tcx>, pat: &hir::Pat, match_mode: MatchMode) { debug!("walk_pat(cmt_discr={:?}, pat={:?})", cmt_discr, pat); @@ -935,8 +922,8 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { self.tcx().with_freevars(closure_expr.id, |freevars| { for freevar in freevars { - let var_hir_id = self.tcx().hir.node_to_hir_id(freevar.var_id()); - let closure_def_id = self.tcx().hir.local_def_id(closure_expr.id); + let var_hir_id = self.tcx().hir().node_to_hir_id(freevar.var_id()); + let closure_def_id = self.tcx().hir().local_def_id(closure_expr.id); let upvar_id = ty::UpvarId { var_path: ty::UpvarPath { hir_id: var_hir_id }, closure_expr_id: closure_def_id.to_local(), @@ -973,7 +960,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { -> mc::McResult> { // Create the cmt for the variable being borrowed, from the // caller's perspective - let var_hir_id = self.tcx().hir.node_to_hir_id(upvar.var_id()); + let var_hir_id = self.tcx().hir().node_to_hir_id(upvar.var_id()); let var_ty = self.mc.node_ty(var_hir_id)?; self.mc.cat_def(closure_hir_id, closure_span, var_ty, upvar.def) } @@ -985,7 +972,7 @@ fn copy_or_move<'a, 'gcx, 'tcx>(mc: &mc::MemCategorizationContext<'a, 'gcx, 'tcx move_reason: MoveReason) -> ConsumeMode { - if mc.type_moves_by_default(param_env, cmt.ty, cmt.span) { + if !mc.type_is_copy_modulo_regions(param_env, cmt.ty, cmt.span) { Move(move_reason) } else { Copy diff --git a/src/librustc/middle/free_region.rs b/src/librustc/middle/free_region.rs index 1341e3515d5..6e9eadca6a5 100644 --- a/src/librustc/middle/free_region.rs +++ b/src/librustc/middle/free_region.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This file handles the relationships between free regions -- //! meaning lifetime parameters. Ordinarily, free regions are //! unrelated to one another, but they can be related via implied or diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs index d2be0e4dcb9..a0f7954eb0c 100644 --- a/src/librustc/middle/intrinsicck.rs +++ b/src/librustc/middle/intrinsicck.rs @@ -1,17 +1,8 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def::Def; use hir::def_id::DefId; use ty::{self, Ty, TyCtxt}; use ty::layout::{LayoutError, Pointer, SizeSkeleton, VariantIdx}; +use ty::query::{Providers, queries}; use rustc_target::spec::abi::Abi::RustIntrinsic; use rustc_data_structures::indexed_vec::Idx; @@ -20,10 +11,23 @@ use hir::intravisit::{self, Visitor, NestedVisitorMap}; use hir; pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - let mut visitor = ItemVisitor { - tcx, + for &module in tcx.hir().krate().modules.keys() { + queries::check_mod_intrinsics::ensure(tcx, tcx.hir().local_def_id(module)); + } +} + +fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { + tcx.hir().visit_item_likes_in_module( + module_def_id, + &mut ItemVisitor { tcx }.as_deep_visitor() + ); +} + +pub fn provide(providers: &mut Providers<'_>) { + *providers = Providers { + check_mod_intrinsics, + ..*providers }; - tcx.hir.krate().visit_all_item_likes(&mut visitor.as_deep_visitor()); } struct ItemVisitor<'a, 'tcx: 'a> { @@ -107,11 +111,11 @@ impl<'a, 'tcx> ExprVisitor<'a, 'tcx> { format!("{} bits", size.bits()) } Ok(SizeSkeleton::Pointer { tail, .. }) => { - format!("pointer to {}", tail) + format!("pointer to `{}`", tail) } Err(LayoutError::Unknown(bad)) => { if bad == ty { - "this type's size can vary".to_owned() + "this type does not have a fixed size".to_owned() } else { format!("size can vary because of {}", bad) } @@ -120,11 +124,16 @@ impl<'a, 'tcx> ExprVisitor<'a, 'tcx> { } }; - struct_span_err!(self.tcx.sess, span, E0512, - "transmute called with types of different sizes") - .note(&format!("source type: {} ({})", from, skeleton_string(from, sk_from))) - .note(&format!("target type: {} ({})", to, skeleton_string(to, sk_to))) - .emit(); + let mut err = struct_span_err!(self.tcx.sess, span, E0512, + "cannot transmute between types of different sizes, \ + or dependently-sized types"); + if from == to { + err.note(&format!("`{}` does not have a fixed size", from)); + } else { + err.note(&format!("source type: `{}` ({})", from, skeleton_string(from, sk_from))) + .note(&format!("target type: `{}` ({})", to, skeleton_string(to, sk_to))); + } + err.emit() } } @@ -134,8 +143,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ItemVisitor<'a, 'tcx> { } fn visit_nested_body(&mut self, body_id: hir::BodyId) { - let owner_def_id = self.tcx.hir.body_owner_def_id(body_id); - let body = self.tcx.hir.body(body_id); + let owner_def_id = self.tcx.hir().body_owner_def_id(body_id); + let body = self.tcx.hir().body(body_id); let param_env = self.tcx.param_env(owner_def_id); let tables = self.tcx.typeck_tables_of(owner_def_id); ExprVisitor { tcx: self.tcx, param_env, tables }.visit_body(body); diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 75e7e999d83..cf77d17b9a3 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -1,21 +1,11 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Detecting language items. // // Language items are items that represent concepts intrinsic to the language // itself. Examples are: // -// * Traits that specify "kinds"; e.g. "Sync", "Send". +// * Traits that specify "kinds"; e.g., "Sync", "Send". // -// * Traits that represent operators; e.g. "Add", "Sub", "Index". +// * Traits that represent operators; e.g., "Add", "Sub", "Index". // // * Functions called by the compiler itself. @@ -108,7 +98,7 @@ impl<'a, 'v, 'tcx> ItemLikeVisitor<'v> for LanguageItemCollector<'a, 'tcx> { match self.item_refs.get(&*value.as_str()).cloned() { // Known lang item with attribute on correct target. Some((item_index, expected_target)) if actual_target == expected_target => { - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); self.collect_item(item_index, def_id); }, // Known lang item with attribute on incorrect target. @@ -171,7 +161,7 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> { if let Some(original_def_id) = self.items.items[item_index] { if original_def_id != item_def_id { let name = LangItem::from_u32(item_index as u32).unwrap().name(); - let mut err = match self.tcx.hir.span_if_local(item_def_id) { + let mut err = match self.tcx.hir().span_if_local(item_def_id) { Some(span) => struct_span_err!( self.tcx.sess, span, @@ -183,7 +173,7 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> { self.tcx.crate_name(item_def_id.krate), name)), }; - if let Some(span) = self.tcx.hir.span_if_local(original_def_id) { + if let Some(span) = self.tcx.hir().span_if_local(original_def_id) { span_note!(&mut err, span, "first defined here."); } else { err.note(&format!("first defined in crate `{}`.", @@ -221,7 +211,7 @@ pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LanguageItems { collector.collect_item(item_index, def_id); } } - tcx.hir.krate().visit_all_item_likes(&mut collector); + tcx.hir().krate().visit_all_item_likes(&mut collector); let LanguageItemCollector { mut items, .. } = collector; weak_lang_items::check_crate(tcx, &mut items); items @@ -297,9 +287,11 @@ language_item_table! { IndexMutTraitLangItem, "index_mut", index_mut_trait, Target::Trait; UnsafeCellTypeLangItem, "unsafe_cell", unsafe_cell_type, Target::Struct; + VaListTypeLangItem, "va_list", va_list, Target::Struct; DerefTraitLangItem, "deref", deref_trait, Target::Trait; DerefMutTraitLangItem, "deref_mut", deref_mut_trait, Target::Trait; + ReceiverTraitLangItem, "receiver", receiver_trait, Target::Trait; FnTraitLangItem, "fn", fn_trait, Target::Trait; FnMutTraitLangItem, "fn_mut", fn_mut_trait, Target::Trait; @@ -307,6 +299,8 @@ language_item_table! { GeneratorStateLangItem, "generator_state", gen_state, Target::Enum; GeneratorTraitLangItem, "generator", gen_trait, Target::Trait; + UnpinTraitLangItem, "unpin", unpin_trait, Target::Trait; + PinTypeLangItem, "pin", pin_type, Target::Struct; EqTraitLangItem, "eq", eq_trait, Target::Trait; PartialOrdTraitLangItem, "partial_ord", partial_ord_trait, Target::Trait; diff --git a/src/librustc/middle/lib_features.rs b/src/librustc/middle/lib_features.rs index 7d65d412e01..8c23377324f 100644 --- a/src/librustc/middle/lib_features.rs +++ b/src/librustc/middle/lib_features.rs @@ -1,16 +1,6 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. +// Detecting lib features (i.e., features that are not lang features). // -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Detecting lib features (i.e. features that are not lang features). -// -// These are declared using stability attributes (e.g. `#[stable (..)]` +// These are declared using stability attributes (e.g., `#[stable (..)]` // and `#[unstable (..)]`), but are not declared in one single location // (unlike lang features), which means we need to collect them instead. @@ -61,7 +51,7 @@ impl<'a, 'tcx> LibFeatureCollector<'a, 'tcx> { fn extract(&self, attr: &Attribute) -> Option<(Symbol, Option, Span)> { let stab_attrs = vec!["stable", "unstable", "rustc_const_unstable"]; - // Find a stability attribute (i.e. `#[stable (..)]`, `#[unstable (..)]`, + // Find a stability attribute (i.e., `#[stable (..)]`, `#[unstable (..)]`, // `#[rustc_const_unstable (..)]`). if let Some(stab_attr) = stab_attrs.iter().find(|stab_attr| { attr.check_name(stab_attr) @@ -140,7 +130,7 @@ impl<'a, 'tcx> LibFeatureCollector<'a, 'tcx> { impl<'a, 'tcx> Visitor<'tcx> for LibFeatureCollector<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::All(&self.tcx.hir) + NestedVisitorMap::All(&self.tcx.hir()) } fn visit_attribute(&mut self, attr: &'tcx Attribute) { @@ -152,6 +142,6 @@ impl<'a, 'tcx> Visitor<'tcx> for LibFeatureCollector<'a, 'tcx> { pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LibFeatures { let mut collector = LibFeatureCollector::new(tcx); - intravisit::walk_crate(&mut collector, tcx.hir.krate()); + intravisit::walk_crate(&mut collector, tcx.hir().krate()); collector.lib_features } diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 54a0192d2e8..4ef8e1a0cf9 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A classic liveness analysis based on dataflow over the AST. Computes, //! for each local variable in a function, whether that variable is live //! at a given point. Program execution points are identified by their @@ -110,11 +100,12 @@ use self::VarKind::*; use hir::def::*; use hir::Node; use ty::{self, TyCtxt}; +use ty::query::{Providers, queries}; use lint; use errors::Applicability; use util::nodemap::{NodeMap, HirIdMap, HirIdSet}; -use std::collections::VecDeque; +use std::collections::{BTreeMap, VecDeque}; use std::{fmt, u32}; use std::io::prelude::*; use std::io; @@ -124,8 +115,9 @@ use syntax::ptr::P; use syntax::symbol::keywords; use syntax_pos::Span; -use hir::{Expr, HirId}; use hir; +use hir::{Expr, HirId}; +use hir::def_id::DefId; use hir::intravisit::{self, Visitor, FnKind, NestedVisitorMap}; /// For use with `propagate_through_loop`. @@ -176,7 +168,7 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_, '_, '_>) -> Strin impl<'a, 'tcx> Visitor<'tcx> for IrMaps<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::OnlyBodies(&self.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl, @@ -189,11 +181,24 @@ impl<'a, 'tcx> Visitor<'tcx> for IrMaps<'a, 'tcx> { fn visit_arm(&mut self, a: &'tcx hir::Arm) { visit_arm(self, a); } } +fn check_mod_liveness<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { + tcx.hir().visit_item_likes_in_module(module_def_id, &mut IrMaps::new(tcx).as_deep_visitor()); +} + pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - tcx.hir.krate().visit_all_item_likes(&mut IrMaps::new(tcx).as_deep_visitor()); + for &module in tcx.hir().krate().modules.keys() { + queries::check_mod_liveness::ensure(tcx, tcx.hir().local_def_id(module)); + } tcx.sess.abort_if_errors(); } +pub fn provide(providers: &mut Providers<'_>) { + *providers = Providers { + check_mod_liveness, + ..*providers + }; +} + impl fmt::Debug for LiveNode { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "ln({})", self.get()) @@ -362,8 +367,8 @@ fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'a, 'tcx>, // Don't run unused pass for #[derive()] if let FnKind::Method(..) = fk { - let parent = ir.tcx.hir.get_parent(id); - if let Some(Node::Item(i)) = ir.tcx.hir.find(parent) { + let parent = ir.tcx.hir().get_parent(id); + if let Some(Node::Item(i)) = ir.tcx.hir().find(parent) { if i.attrs.iter().any(|a| a.check_name("automatically_derived")) { return; } @@ -372,7 +377,7 @@ fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'a, 'tcx>, debug!("creating fn_maps: {:?}", &fn_maps as *const IrMaps<'_, '_>); - let body = ir.tcx.hir.body(body_id); + let body = ir.tcx.hir().body(body_id); for arg in &body.arguments { arg.pat.each_binding(|_bm, hir_id, _x, ident| { @@ -476,7 +481,7 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) { call_caps.extend(freevars.iter().filter_map(|fv| { if let Def::Local(rv) = fv.def { let fv_ln = ir.add_live_node(FreeVarNode(fv.span)); - let var_hid = ir.tcx.hir.node_to_hir_id(rv); + let var_hid = ir.tcx.hir().node_to_hir_id(rv); Some(CaptureInfo { ln: fv_ln, var_hid }) } else { None @@ -525,6 +530,7 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) { hir::ExprKind::Box(..) | hir::ExprKind::Yield(..) | hir::ExprKind::Type(..) | + hir::ExprKind::Err | hir::ExprKind::Path(hir::QPath::TypeRelative(..)) => { intravisit::walk_expr(ir, expr); } @@ -554,7 +560,7 @@ struct RWUTable { /// 65 bits of data into 32; in the uncommon cases, it expands the 65 bits /// in 96. /// - /// More compact representations are possible -- e.g. use only 2 bits per + /// More compact representations are possible -- e.g., use only 2 bits per /// packed `RWU` and make the secondary table a HashMap that maps from /// indices to `RWU`s -- but this one strikes a good balance between size /// and speed. @@ -920,16 +926,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } fn compute(&mut self, body: &hir::Expr) -> LiveNode { - // if there is a `break` or `again` at the top level, then it's - // effectively a return---this only occurs in `for` loops, - // where the body is really a closure. - - debug!("compute: using id for body, {}", self.ir.tcx.hir.node_to_pretty_string(body.id)); - - let exit_ln = self.s.exit_ln; - - self.break_ln.insert(body.id, exit_ln); - self.cont_ln.insert(body.id, exit_ln); + debug!("compute: using id for body, {}", self.ir.tcx.hir().node_to_pretty_string(body.id)); // the fallthrough exit is only for those cases where we do not // explicitly return: @@ -965,46 +962,31 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { fn propagate_through_stmt(&mut self, stmt: &hir::Stmt, succ: LiveNode) -> LiveNode { match stmt.node { - hir::StmtKind::Decl(ref decl, _) => { - self.propagate_through_decl(&decl, succ) - } + hir::StmtKind::Local(ref local) => { + // Note: we mark the variable as defined regardless of whether + // there is an initializer. Initially I had thought to only mark + // the live variable as defined if it was initialized, and then we + // could check for uninit variables just by scanning what is live + // at the start of the function. But that doesn't work so well for + // immutable variables defined in a loop: + // loop { let x; x = 5; } + // because the "assignment" loops back around and generates an error. + // + // So now we just check that variables defined w/o an + // initializer are not live at the point of their + // initialization, which is mildly more complex than checking + // once at the func header but otherwise equivalent. - hir::StmtKind::Expr(ref expr, _) | hir::StmtKind::Semi(ref expr, _) => { - self.propagate_through_expr(&expr, succ) + let succ = self.propagate_through_opt_expr(local.init.as_ref().map(|e| &**e), succ); + self.define_bindings_in_pat(&local.pat, succ) } - } - } - - fn propagate_through_decl(&mut self, decl: &hir::Decl, succ: LiveNode) - -> LiveNode { - match decl.node { - hir::DeclKind::Local(ref local) => { - self.propagate_through_local(&local, succ) + hir::StmtKind::Item(..) => succ, + hir::StmtKind::Expr(ref expr) | hir::StmtKind::Semi(ref expr) => { + self.propagate_through_expr(&expr, succ) } - hir::DeclKind::Item(_) => succ, } } - fn propagate_through_local(&mut self, local: &hir::Local, succ: LiveNode) - -> LiveNode { - // Note: we mark the variable as defined regardless of whether - // there is an initializer. Initially I had thought to only mark - // the live variable as defined if it was initialized, and then we - // could check for uninit variables just by scanning what is live - // at the start of the function. But that doesn't work so well for - // immutable variables defined in a loop: - // loop { let x; x = 5; } - // because the "assignment" loops back around and generates an error. - // - // So now we just check that variables defined w/o an - // initializer are not live at the point of their - // initialization, which is mildly more complex than checking - // once at the func header but otherwise equivalent. - - let succ = self.propagate_through_opt_expr(local.init.as_ref().map(|e| &**e), succ); - self.define_bindings_in_pat(&local.pat, succ) - } - fn propagate_through_exprs(&mut self, exprs: &[Expr], succ: LiveNode) -> LiveNode { exprs.iter().rev().fold(succ, |succ, expr| { @@ -1021,7 +1003,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode) -> LiveNode { - debug!("propagate_through_expr: {}", self.ir.tcx.hir.node_to_pretty_string(expr.id)); + debug!("propagate_through_expr: {}", self.ir.tcx.hir().node_to_pretty_string(expr.id)); match expr.node { // Interesting cases with control flow or which gen/kill @@ -1033,18 +1015,9 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { self.propagate_through_expr(&e, succ) } - hir::ExprKind::Closure(.., blk_id, _, _) => { + hir::ExprKind::Closure(..) => { debug!("{} is an ExprKind::Closure", - self.ir.tcx.hir.node_to_pretty_string(expr.id)); - - // The next-node for a break is the successor of the entire - // loop. The next-node for a continue is the top of this loop. - let node = self.live_node(expr.hir_id, expr.span); - - let break_ln = succ; - let cont_ln = node; - self.break_ln.insert(blk_id.node_id, break_ln); - self.cont_ln.insert(blk_id.node_id, cont_ln); + self.ir.tcx.hir().node_to_pretty_string(expr.id)); // the construction of a closure itself is not important, // but we have to consider the closed over variables. @@ -1197,8 +1170,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } hir::ExprKind::Call(ref f, ref args) => { - // FIXME(canndrew): This is_never should really be an is_uninhabited - let succ = if self.tables.expr_ty(expr).is_never() { + let m = self.ir.tcx.hir().get_module_parent(expr.id); + let succ = if self.ir.tcx.is_ty_uninhabited_from(m, self.tables.expr_ty(expr)) { self.s.exit_ln } else { succ @@ -1208,8 +1181,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } hir::ExprKind::MethodCall(.., ref args) => { - // FIXME(canndrew): This is_never should really be an is_uninhabited - let succ = if self.tables.expr_ty(expr).is_never() { + let m = self.ir.tcx.hir().get_module_parent(expr.id); + let succ = if self.ir.tcx.is_ty_uninhabited_from(m, self.tables.expr_ty(expr)) { self.s.exit_ln } else { succ @@ -1264,7 +1237,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { self.propagate_through_exprs(inputs, succ) } - hir::ExprKind::Lit(..) | hir::ExprKind::Path(hir::QPath::TypeRelative(..)) => { + hir::ExprKind::Lit(..) | hir::ExprKind::Err | + hir::ExprKind::Path(hir::QPath::TypeRelative(..)) => { succ } @@ -1356,7 +1330,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { let ln = self.live_node(hir_id, span); if acc != 0 { self.init_from_succ(ln, succ); - let var_hid = self.ir.tcx.hir.node_to_hir_id(nid); + let var_hid = self.ir.tcx.hir().node_to_hir_id(nid); let var = self.variable(var_hid, span); self.acc(ln, var, acc); } @@ -1413,17 +1387,18 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } } debug!("propagate_through_loop: using id for loop body {} {}", - expr.id, self.ir.tcx.hir.node_to_pretty_string(body.id)); + expr.id, self.ir.tcx.hir().node_to_pretty_string(body.id)); + - let break_ln = succ; - let cont_ln = ln; - self.break_ln.insert(expr.id, break_ln); - self.cont_ln.insert(expr.id, cont_ln); + self.break_ln.insert(expr.id, succ); let cond_ln = match kind { LoopLoop => ln, WhileLoop(ref cond) => self.propagate_through_expr(&cond, ln), }; + + self.cont_ln.insert(expr.id, cond_ln); + let body_ln = self.propagate_through_block(body, cond_ln); // repeat until fixed point is reached: @@ -1471,7 +1446,7 @@ fn check_local<'a, 'tcx>(this: &mut Liveness<'a, 'tcx>, local: &'tcx hir::Local) None => { this.pat_bindings(&local.pat, |this, ln, var, sp, id| { let span = local.pat.simple_ident().map_or(sp, |ident| ident.span); - this.warn_about_unused(span, id, ln, var); + this.warn_about_unused(vec![span], id, ln, var); }) } } @@ -1480,12 +1455,29 @@ fn check_local<'a, 'tcx>(this: &mut Liveness<'a, 'tcx>, local: &'tcx hir::Local) } fn check_arm<'a, 'tcx>(this: &mut Liveness<'a, 'tcx>, arm: &'tcx hir::Arm) { - // only consider the first pattern; any later patterns must have - // the same bindings, and we also consider the first pattern to be - // the "authoritative" set of ids - this.arm_pats_bindings(arm.pats.first().map(|p| &**p), |this, ln, var, sp, id| { - this.warn_about_unused(sp, id, ln, var); - }); + // Only consider the variable from the first pattern; any later patterns must have + // the same bindings, and we also consider the first pattern to be the "authoritative" set of + // ids. However, we should take the spans of variables with the same name from the later + // patterns so the suggestions to prefix with underscores will apply to those too. + let mut vars: BTreeMap)> = Default::default(); + + for pat in &arm.pats { + this.arm_pats_bindings(Some(&*pat), |this, ln, var, sp, id| { + let name = this.ir.variable_name(var); + vars.entry(name) + .and_modify(|(.., spans)| { + spans.push(sp); + }) + .or_insert_with(|| { + (ln, var, id, vec![sp]) + }); + }); + } + + for (_, (ln, var, id, spans)) in vars { + this.warn_about_unused(spans, id, ln, var); + } + intravisit::walk_arm(this, arm); } @@ -1531,7 +1523,7 @@ fn check_expr<'a, 'tcx>(this: &mut Liveness<'a, 'tcx>, expr: &'tcx Expr) { hir::ExprKind::Block(..) | hir::ExprKind::AddrOf(..) | hir::ExprKind::Struct(..) | hir::ExprKind::Repeat(..) | hir::ExprKind::Closure(..) | hir::ExprKind::Path(_) | hir::ExprKind::Yield(..) | - hir::ExprKind::Box(..) | hir::ExprKind::Type(..) => { + hir::ExprKind::Box(..) | hir::ExprKind::Type(..) | hir::ExprKind::Err => { intravisit::walk_expr(this, expr); } } @@ -1547,7 +1539,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { // mutable, then check for a reassignment to flag the mutability // as being used. let ln = self.live_node(expr.hir_id, expr.span); - let var_hid = self.ir.tcx.hir.node_to_hir_id(nid); + let var_hid = self.ir.tcx.hir().node_to_hir_id(nid); let var = self.variable(var_hid, expr.span); self.warn_about_dead_assign(expr.span, expr.hir_id, ln, var); } @@ -1575,8 +1567,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { let sp = ident.span; let var = self.variable(hir_id, sp); // Ignore unused self. - if ident.name != keywords::SelfValue.name() { - if !self.warn_about_unused(sp, hir_id, entry_ln, var) { + if ident.name != keywords::SelfLower.name() { + if !self.warn_about_unused(vec![sp], hir_id, entry_ln, var) { if self.live_on_entry(entry_ln, var).is_none() { self.report_dead_assign(hir_id, sp, var, true); } @@ -1588,14 +1580,14 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { fn warn_about_unused_or_dead_vars_in_pat(&mut self, pat: &hir::Pat) { self.pat_bindings(pat, |this, ln, var, sp, id| { - if !this.warn_about_unused(sp, id, ln, var) { + if !this.warn_about_unused(vec![sp], id, ln, var) { this.warn_about_dead_assign(sp, id, ln, var); } }) } fn warn_about_unused(&self, - sp: Span, + spans: Vec, hir_id: HirId, ln: LiveNode, var: Variable) @@ -1612,29 +1604,36 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { self.assigned_on_exit(ln, var).is_some() }; - let suggest_underscore_msg = format!("consider using `_{}` instead", name); - if is_assigned { - self.ir.tcx - .lint_hir_note(lint::builtin::UNUSED_VARIABLES, hir_id, sp, - &format!("variable `{}` is assigned to, but never used", - name), - &suggest_underscore_msg); + self.ir.tcx.lint_hir_note( + lint::builtin::UNUSED_VARIABLES, + hir_id, + spans.clone(), + &format!("variable `{}` is assigned to, but never used", name), + &format!("consider using `_{}` instead", name), + ); } else if name != "self" { - let msg = format!("unused variable: `{}`", name); - let mut err = self.ir.tcx - .struct_span_lint_hir(lint::builtin::UNUSED_VARIABLES, hir_id, sp, &msg); + let mut err = self.ir.tcx.struct_span_lint_hir( + lint::builtin::UNUSED_VARIABLES, + hir_id, + spans.clone(), + &format!("unused variable: `{}`", name), + ); + if self.ir.variable_is_shorthand(var) { - err.span_suggestion_with_applicability(sp, "try ignoring the field", - format!("{}: _", name), - Applicability::MachineApplicable); + err.multipart_suggestion( + "try ignoring the field", + spans.iter().map(|span| (*span, format!("{}: _", name))).collect(), + Applicability::MachineApplicable + ); } else { - err.span_suggestion_short_with_applicability( - sp, &suggest_underscore_msg, - format!("_{}", name), + err.multipart_suggestion( + "consider prefixing with an underscore", + spans.iter().map(|span| (*span, format!("_{}", name))).collect(), Applicability::MachineApplicable, ); } + err.emit() } } @@ -1644,11 +1643,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } } - fn warn_about_dead_assign(&self, - sp: Span, - hir_id: HirId, - ln: LiveNode, - var: Variable) { + fn warn_about_dead_assign(&self, sp: Span, hir_id: HirId, ln: LiveNode, var: Variable) { if self.live_on_exit(ln, var).is_none() { self.report_dead_assign(hir_id, sp, var, false); } @@ -1657,11 +1652,15 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { fn report_dead_assign(&self, hir_id: HirId, sp: Span, var: Variable, is_argument: bool) { if let Some(name) = self.should_warn(var) { if is_argument { - self.ir.tcx.lint_hir(lint::builtin::UNUSED_ASSIGNMENTS, hir_id, sp, - &format!("value passed to `{}` is never read", name)); + self.ir.tcx.struct_span_lint_hir(lint::builtin::UNUSED_ASSIGNMENTS, hir_id, sp, + &format!("value passed to `{}` is never read", name)) + .help("maybe it is overwritten before being read?") + .emit(); } else { - self.ir.tcx.lint_hir(lint::builtin::UNUSED_ASSIGNMENTS, hir_id, sp, - &format!("value assigned to `{}` is never read", name)); + self.ir.tcx.struct_span_lint_hir(lint::builtin::UNUSED_ASSIGNMENTS, hir_id, sp, + &format!("value assigned to `{}` is never read", name)) + .help("maybe it is overwritten before being read?") + .emit(); } } } diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index cadf0c42d22..370f0d1a6c6 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! # Categorization //! //! The job of the categorization module is to analyze an expression to @@ -127,7 +117,7 @@ pub enum PointerKind<'tcx> { } // We use the term "interior" to mean "something reachable from the -// base without a pointer dereference", e.g. a field +// base without a pointer dereference", e.g., a field #[derive(Clone, Copy, PartialEq, Eq, Hash)] pub enum InteriorKind { InteriorField(FieldIndex), @@ -153,8 +143,8 @@ impl Hash for FieldIndex { #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub enum InteriorOffsetKind { - Index, // e.g. `array_expr[index_expr]` - Pattern, // e.g. `fn foo([_, a, _, _]: [A; 4]) { ... }` + Index, // e.g., `array_expr[index_expr]` + Pattern, // e.g., `fn foo([_, a, _, _]: [A; 4]) { ... }` } #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] @@ -348,7 +338,7 @@ impl MutabilityCategory { fn from_local(tcx: TyCtxt<'_, '_, '_>, tables: &ty::TypeckTables<'_>, id: ast::NodeId) -> MutabilityCategory { - let ret = match tcx.hir.get(id) { + let ret = match tcx.hir().get(id) { Node::Binding(p) => match p.node { PatKind::Binding(..) => { let bm = *tables.pat_binding_modes() @@ -362,7 +352,7 @@ impl MutabilityCategory { } _ => span_bug!(p.span, "expected identifier pattern") }, - _ => span_bug!(tcx.hir.span(id), "expected identifier pattern") + _ => span_bug!(tcx.hir().span(id), "expected identifier pattern") }; debug!("MutabilityCategory::{}(tcx, id={:?}) => {:?}", "from_local", id, ret); @@ -453,15 +443,16 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { } } - pub fn type_moves_by_default(&self, - param_env: ty::ParamEnv<'tcx>, - ty: Ty<'tcx>, - span: Span) - -> bool { - self.infcx.map(|infcx| infcx.type_moves_by_default(param_env, ty, span)) + pub fn type_is_copy_modulo_regions( + &self, + param_env: ty::ParamEnv<'tcx>, + ty: Ty<'tcx>, + span: Span, + ) -> bool { + self.infcx.map(|infcx| infcx.type_is_copy_modulo_regions(param_env, ty, span)) .or_else(|| { self.tcx.lift_to_global(&(param_env, ty)).map(|(param_env, ty)| { - ty.moves_by_default(self.tcx.global_tcx(), param_env, span) + ty.is_copy_modulo_regions(self.tcx.global_tcx(), param_env, span) }) }) .unwrap_or(true) @@ -495,9 +486,9 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { // FIXME None if self.is_tainted_by_errors() => Err(()), None => { - let id = self.tcx.hir.hir_to_node_id(id); + let id = self.tcx.hir().hir_to_node_id(id); bug!("no type for node {}: {} in mem_categorization", - id, self.tcx.hir.node_to_string(id)); + id, self.tcx.hir().node_to_string(id)); } } } @@ -697,7 +688,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { hir::ExprKind::Block(..) | hir::ExprKind::Loop(..) | hir::ExprKind::Match(..) | hir::ExprKind::Lit(..) | hir::ExprKind::Break(..) | hir::ExprKind::Continue(..) | hir::ExprKind::Struct(..) | hir::ExprKind::Repeat(..) | - hir::ExprKind::InlineAsm(..) | hir::ExprKind::Box(..) => { + hir::ExprKind::InlineAsm(..) | hir::ExprKind::Box(..) | hir::ExprKind::Err => { Ok(self.cat_rvalue_node(expr.hir_id, expr.span, expr_ty)) } } @@ -770,7 +761,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { fn_node_id: ast::NodeId) -> McResult> { - let fn_hir_id = self.tcx.hir.node_to_hir_id(fn_node_id); + let fn_hir_id = self.tcx.hir().node_to_hir_id(fn_node_id); // An upvar can have up to 3 components. We translate first to a // `Categorization::Upvar`, which is itself a fiction -- it represents the reference to the @@ -815,8 +806,8 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { ref t => span_bug!(span, "unexpected type for fn in mem_categorization: {:?}", t), }; - let closure_expr_def_id = self.tcx.hir.local_def_id(fn_node_id); - let var_hir_id = self.tcx.hir.node_to_hir_id(var_id); + let closure_expr_def_id = self.tcx.hir().local_def_id(fn_node_id); + let var_hir_id = self.tcx.hir().node_to_hir_id(var_id); let upvar_id = ty::UpvarId { var_path: ty::UpvarPath { hir_id: var_hir_id }, closure_expr_id: closure_expr_def_id.to_local(), @@ -961,7 +952,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { debug!("cat_rvalue_node: promotable = {:?}", promotable); - // Always promote `[T; 0]` (even when e.g. borrowed mutably). + // Always promote `[T; 0]` (even when e.g., borrowed mutably). let promotable = match expr_ty.sty { ty::Array(_, len) if len.assert_usize(self.tcx) == Some(0) => true, _ => promotable, @@ -1504,7 +1495,7 @@ impl<'tcx> cmt_<'tcx> { "non-place".into() } Categorization::Local(vid) => { - if tcx.hir.is_argument(vid) { + if tcx.hir().is_argument(vid) { "argument" } else { "local variable" diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 880d428e7a5..7736d5e795e 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A pass that checks to make sure private fields and methods aren't used //! outside their scopes. This pass will also generate a set of exported items //! which are available for use externally when compiled as a library. diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 0009a517dd1..10deca836ff 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Finds items that are externally reachable, to determine which items // need to have their metadata (and possibly their AST) serialized. // All items that can be referred to through an exported name are @@ -47,7 +37,7 @@ fn item_might_be_inlined(tcx: TyCtxt<'a, 'tcx, 'tcx>, match item.node { hir::ItemKind::Impl(..) | hir::ItemKind::Fn(..) => { - let generics = tcx.generics_of(tcx.hir.local_def_id(item.id)); + let generics = tcx.generics_of(tcx.hir().local_def_id(item.id)); generics.requires_monomorphization(tcx) } _ => false, @@ -58,12 +48,12 @@ fn method_might_be_inlined<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item: &hir::ImplItem, impl_src: DefId) -> bool { let codegen_fn_attrs = tcx.codegen_fn_attrs(impl_item.hir_id.owner_def_id()); - let generics = tcx.generics_of(tcx.hir.local_def_id(impl_item.id)); + let generics = tcx.generics_of(tcx.hir().local_def_id(impl_item.id)); if codegen_fn_attrs.requests_inline() || generics.requires_monomorphization(tcx) { return true } - if let Some(impl_node_id) = tcx.hir.as_local_node_id(impl_src) { - match tcx.hir.find(impl_node_id) { + if let Some(impl_node_id) = tcx.hir().as_local_node_id(impl_src) { + match tcx.hir().find(impl_node_id) { Some(Node::Item(item)) => item_might_be_inlined(tcx, &item, codegen_fn_attrs), Some(..) | None => @@ -96,7 +86,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ReachableContext<'a, 'tcx> { fn visit_nested_body(&mut self, body: hir::BodyId) { let old_tables = self.tables; self.tables = self.tcx.body_tables(body); - let body = self.tcx.hir.body(body); + let body = self.tcx.hir().body(body); self.visit_body(body); self.tables = old_tables; } @@ -117,8 +107,9 @@ impl<'a, 'tcx> Visitor<'tcx> for ReachableContext<'a, 'tcx> { self.reachable_symbols.insert(node_id); } Some(def) => { - let def_id = def.def_id(); - if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) { + if let Some((node_id, def_id)) = def.opt_def_id().and_then(|def_id| { + self.tcx.hir().as_local_node_id(def_id).map(|node_id| (node_id, def_id)) + }) { if self.def_id_represents_local_inlined_item(def_id) { self.worklist.push(node_id); } else { @@ -150,12 +141,12 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { // Returns true if the given def ID represents a local item that is // eligible for inlining and false otherwise. fn def_id_represents_local_inlined_item(&self, def_id: DefId) -> bool { - let node_id = match self.tcx.hir.as_local_node_id(def_id) { + let node_id = match self.tcx.hir().as_local_node_id(def_id) { Some(node_id) => node_id, None => { return false; } }; - match self.tcx.hir.find(node_id) { + match self.tcx.hir().find(node_id) { Some(Node::Item(item)) => { match item.node { hir::ItemKind::Fn(..) => @@ -181,13 +172,13 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { true } else { let impl_did = self.tcx - .hir + .hir() .get_parent_did(node_id); // Check the impl. If the generics on the self // type of the impl require inlining, this method // does too. - let impl_node_id = self.tcx.hir.as_local_node_id(impl_did).unwrap(); - match self.tcx.hir.expect_item(impl_node_id).node { + let impl_node_id = self.tcx.hir().as_local_node_id(impl_did).unwrap(); + match self.tcx.hir().expect_item(impl_node_id).node { hir::ItemKind::Impl(..) => { let generics = self.tcx.generics_of(impl_did); generics.requires_monomorphization(self.tcx) @@ -213,7 +204,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { continue } - if let Some(ref item) = self.tcx.hir.find(search_item) { + if let Some(ref item) = self.tcx.hir().find(search_item) { self.propagate_node(item, search_item); } } @@ -230,7 +221,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { } else { false }; - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); let codegen_attrs = self.tcx.codegen_fn_attrs(def_id); let is_extern = codegen_attrs.contains_extern_indicator(); let std_internal = codegen_attrs.flags.contains( @@ -251,7 +242,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { Node::Item(item) => { match item.node { hir::ItemKind::Fn(.., body) => { - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); if item_might_be_inlined(self.tcx, &item, self.tcx.codegen_fn_attrs(def_id)) { @@ -304,7 +295,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { self.visit_nested_body(body); } hir::ImplItemKind::Method(_, body) => { - let did = self.tcx.hir.get_parent_did(search_item); + let did = self.tcx.hir().get_parent_did(search_item); if method_might_be_inlined(self.tcx, impl_item, did) { self.visit_nested_body(body) } @@ -325,7 +316,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { Node::MacroDef(_) => {} _ => { bug!("found unexpected thingy in worklist: {}", - self.tcx.hir.node_to_string(search_item)) + self.tcx.hir().node_to_string(search_item)) } } } @@ -350,7 +341,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, // Anything which has custom linkage gets thrown on the worklist no // matter where it is in the crate, along with "special std symbols" // which are currently akin to allocator symbols. - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); let codegen_attrs = self.tcx.codegen_fn_attrs(def_id); if codegen_attrs.contains_extern_indicator() || codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL) { @@ -375,7 +366,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, self.worklist.reserve(provided_trait_methods.len()); for default_method in provided_trait_methods { let node_id = self.tcx - .hir + .hir() .as_local_node_id(default_method.def_id) .unwrap(); self.worklist.push(node_id); @@ -421,7 +412,7 @@ fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) -> reachable_context.worklist.extend(access_levels.map.iter().map(|(id, _)| *id)); for item in tcx.lang_items().items().iter() { if let Some(did) = *item { - if let Some(node_id) = tcx.hir.as_local_node_id(did) { + if let Some(node_id) = tcx.hir().as_local_node_id(did) { reachable_context.worklist.push(node_id); } } @@ -432,7 +423,7 @@ fn reachable_set<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) -> access_levels, worklist: &mut reachable_context.worklist, }; - tcx.hir.krate().visit_all_item_likes(&mut collect_private_impl_items); + tcx.hir().krate().visit_all_item_likes(&mut collect_private_impl_items); } // Step 2: Mark all symbols that the symbols on the worklist touch. diff --git a/src/librustc/middle/recursion_limit.rs b/src/librustc/middle/recursion_limit.rs index 077a20315a2..1eabd7f59e6 100644 --- a/src/librustc/middle/recursion_limit.rs +++ b/src/librustc/middle/recursion_limit.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Recursion limit. // // There are various parts of the compiler that must impose arbitrary limits @@ -21,14 +11,11 @@ use syntax::ast; use rustc_data_structures::sync::Once; pub fn update_limits(sess: &Session, krate: &ast::Crate) { - update_limit(sess, krate, &sess.recursion_limit, "recursion_limit", - "recursion limit", 64); - update_limit(sess, krate, &sess.type_length_limit, "type_length_limit", - "type length limit", 1048576); + update_limit(krate, &sess.recursion_limit, "recursion_limit", 64); + update_limit(krate, &sess.type_length_limit, "type_length_limit", 1048576); } -fn update_limit(sess: &Session, krate: &ast::Crate, limit: &Once, - name: &str, description: &str, default: usize) { +fn update_limit(krate: &ast::Crate, limit: &Once, name: &str, default: usize) { for attr in &krate.attrs { if !attr.check_name(name) { continue; @@ -40,10 +27,6 @@ fn update_limit(sess: &Session, krate: &ast::Crate, limit: &Once, return; } } - - span_err!(sess, attr.span, E0296, - "malformed {} attribute, expected #![{}=\"N\"]", - description, name); } limit.set(default); } diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index d00fbdeca21..31f91a1bae5 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -1,20 +1,10 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This file builds up the `ScopeTree`, which describes //! the parent links in the region hierarchy. //! //! For more information about how MIR-based region-checking works, //! see the [rustc guide]. //! -//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html +//! [rustc guide]: https://rust-lang.github.io/rustc-guide/mir/borrowck.html use ich::{StableHashingContext, NodeIdHashingMode}; use util::nodemap::{FxHashMap, FxHashSet}; @@ -84,7 +74,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher, /// (D9.): DestructionScope for temporaries created during M8. /// (R10.): Remainder scope for block `'b:`, stmt 1 (let y = ...). /// (D11.): DestructionScope for temporaries and bindings from block `'b:`. -/// (D12.): DestructionScope for temporaries created during M1 (e.g. f()). +/// (D12.): DestructionScope for temporaries created during M1 (e.g., f()). /// ``` /// /// Note that while the above picture shows the destruction scopes @@ -155,7 +145,7 @@ pub enum ScopeData { /// everything after that first `let`. (If you want a scope that /// includes EXPR_1 as well, then do not use `Scope::Remainder`, /// but instead another `Scope` that encompasses the whole block, -/// e.g. `Scope::Node`. +/// e.g., `Scope::Node`. /// /// * the subscope with `first_statement_index == 1` is scope of `c`, /// and thus does not include EXPR_2, but covers the `...`. @@ -172,7 +162,7 @@ static_assert!(ASSERT_SCOPE_DATA: mem::size_of::() == 4); impl Scope { /// Returns a item-local id associated with this scope. /// - /// NB: likely to be replaced as API is refined; e.g. pnkfelix + /// N.B., likely to be replaced as API is refined; e.g., pnkfelix /// anticipates `fn entry_node_id` and `fn each_exit_node_id`. pub fn item_local_id(&self) -> hir::ItemLocalId { self.id @@ -181,7 +171,7 @@ impl Scope { pub fn node_id(&self, tcx: TyCtxt<'_, '_, '_>, scope_tree: &ScopeTree) -> ast::NodeId { match scope_tree.root_body { Some(hir_id) => { - tcx.hir.hir_to_node_id(hir::HirId { + tcx.hir().hir_to_node_id(hir::HirId { owner: hir_id.owner, local_id: self.item_local_id() }) @@ -198,9 +188,9 @@ impl Scope { if node_id == ast::DUMMY_NODE_ID { return DUMMY_SP; } - let span = tcx.hir.span(node_id); + let span = tcx.hir().span(node_id); if let ScopeData::Remainder(first_statement_index) = self.data { - if let Node::Block(ref blk) = tcx.hir.get(node_id) { + if let Node::Block(ref blk) = tcx.hir().get(node_id) { // Want span for scope starting after the // indexed statement and ending at end of // `blk`; reuse span of `blk` and shift `lo` @@ -592,10 +582,7 @@ impl<'tcx> ScopeTree { return Some(scope.item_local_id()); } - match self.opt_encl_scope(scope) { - None => return None, - Some(parent) => scope = parent, - } + scope = self.opt_encl_scope(scope)?; } } @@ -663,9 +650,9 @@ impl<'tcx> ScopeTree { -> Scope { let param_owner = tcx.parent_def_id(br.def_id).unwrap(); - let param_owner_id = tcx.hir.as_local_node_id(param_owner).unwrap(); - let scope = tcx.hir.maybe_body_owned_by(param_owner_id).map(|body_id| { - tcx.hir.body(body_id).value.hir_id.local_id + let param_owner_id = tcx.hir().as_local_node_id(param_owner).unwrap(); + let scope = tcx.hir().maybe_body_owned_by(param_owner_id).map(|body_id| { + tcx.hir().body(body_id).value.hir_id.local_id }).unwrap_or_else(|| { // The lifetime was defined on node that doesn't own a body, // which in practice can only mean a trait or an impl, that @@ -674,7 +661,7 @@ impl<'tcx> ScopeTree { "free_scope: {:?} not recognized by the \ region scope tree for {:?} / {:?}", param_owner, - self.root_parent.map(|id| tcx.hir.local_def_id(id)), + self.root_parent.map(|id| tcx.hir().local_def_id(id)), self.root_body.map(|hir_id| DefId::local(hir_id.owner))); // The trait/impl lifetime is in scope for the method's body. @@ -699,9 +686,9 @@ impl<'tcx> ScopeTree { // on the same function that they ended up being freed in. assert_eq!(param_owner, fr.scope); - let param_owner_id = tcx.hir.as_local_node_id(param_owner).unwrap(); - let body_id = tcx.hir.body_owned_by(param_owner_id); - Scope { id: tcx.hir.body(body_id).value.hir_id.local_id, data: ScopeData::CallSite } + let param_owner_id = tcx.hir().as_local_node_id(param_owner).unwrap(); + let body_id = tcx.hir().body_owned_by(param_owner_id); + Scope { id: tcx.hir().body(body_id).value.hir_id.local_id, data: ScopeData::CallSite } } /// Checks whether the given scope contains a `yield`. If so, @@ -773,10 +760,10 @@ fn resolve_block<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, blk: // }, other_argument()); // // Each of the statements within the block is a terminating - // scope, and thus a temporary (e.g. the result of calling + // scope, and thus a temporary (e.g., the result of calling // `bar()` in the initializer expression for `let inner = ...;`) // will be cleaned up immediately after its corresponding - // statement (i.e. `let inner = ...;`) executes. + // statement (i.e., `let inner = ...;`) executes. // // On the other hand, temporaries associated with evaluating the // tail expression for the block are assigned lifetimes so that @@ -797,20 +784,25 @@ fn resolve_block<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, blk: // index information.) for (i, statement) in blk.stmts.iter().enumerate() { - if let hir::StmtKind::Decl(..) = statement.node { - // Each StmtKind::Decl introduces a subscope for bindings - // introduced by the declaration; this subscope covers - // a suffix of the block . Each subscope in a block - // has the previous subscope in the block as a parent, - // except for the first such subscope, which has the - // block itself as a parent. - visitor.enter_scope( - Scope { - id: blk.hir_id.local_id, - data: ScopeData::Remainder(FirstStatementIndex::new(i)) - } - ); - visitor.cx.var_parent = visitor.cx.parent; + match statement.node { + hir::StmtKind::Local(..) | + hir::StmtKind::Item(..) => { + // Each declaration introduces a subscope for bindings + // introduced by the declaration; this subscope covers a + // suffix of the block. Each subscope in a block has the + // previous subscope in the block as a parent, except for + // the first such subscope, which has the block itself as a + // parent. + visitor.enter_scope( + Scope { + id: blk.hir_id.local_id, + data: ScopeData::Remainder(FirstStatementIndex::new(i)) + } + ); + visitor.cx.var_parent = visitor.cx.parent; + } + hir::StmtKind::Expr(..) | + hir::StmtKind::Semi(..) => {} } visitor.visit_stmt(statement) } @@ -848,7 +840,7 @@ fn resolve_pat<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, pat: & } fn resolve_stmt<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, stmt: &'tcx hir::Stmt) { - let stmt_id = visitor.tcx.hir.node_to_hir_id(stmt.node.id()).local_id; + let stmt_id = visitor.tcx.hir().node_to_hir_id(stmt.id).local_id; debug!("resolve_stmt(stmt.id={:?})", stmt_id); // Every statement will clean up the temporaries created during @@ -945,7 +937,7 @@ fn resolve_expr<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, expr: // Manually recurse over closures, because they are the only // case of nested bodies that share the parent environment. hir::ExprKind::Closure(.., body, _, _) => { - let body = visitor.tcx.hir.body(body); + let body = visitor.tcx.hir().body(body); visitor.visit_body(body); } @@ -987,7 +979,7 @@ fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, // As an exception to the normal rules governing temporary // lifetimes, initializers in a let have a temporary lifetime - // of the enclosing block. This means that e.g. a program + // of the enclosing block. This means that e.g., a program // like the following is legal: // // let ref x = HashMap::new(); @@ -1186,7 +1178,7 @@ fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, loop { // Note: give all the expressions matching `ET` with the // extended temporary lifetime, not just the innermost rvalue, - // because in codegen if we must compile e.g. `*rvalue()` + // because in codegen if we must compile e.g., `*rvalue()` // into a temporary, we request the temporary scope of the // outer expression. visitor.scope_tree.record_rvalue_scope(expr.hir_id.local_id, blk_scope); @@ -1247,7 +1239,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'a, 'tcx> { fn visit_body(&mut self, body: &'tcx hir::Body) { let body_id = body.id(); - let owner_id = self.tcx.hir.body_owner(body_id); + let owner_id = self.tcx.hir().body_owner(body_id); debug!("visit_body(id={:?}, span={:?}, body.id={:?}, cx.parent={:?})", owner_id, @@ -1276,15 +1268,15 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'a, 'tcx> { // The body of the every fn is a root scope. self.cx.parent = self.cx.var_parent; - if let hir::BodyOwnerKind::Fn = self.tcx.hir.body_owner_kind(owner_id) { - self.visit_expr(&body.value); + if self.tcx.hir().body_owner_kind(owner_id).is_fn_or_closure() { + self.visit_expr(&body.value) } else { // Only functions have an outer terminating (drop) scope, while // temporaries in constant initializers may be 'static, but only // according to rvalue lifetime semantics, using the same // syntactical rules used for let initializers. // - // E.g. in `let x = &f();`, the temporary holding the result from + // e.g., in `let x = &f();`, the temporary holding the result from // the `f()` call lives for the entirety of the surrounding block. // // Similarly, `const X: ... = &f();` would have the result of `f()` @@ -1295,7 +1287,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'a, 'tcx> { // // However, `const Y: ... = g(&f());`, like `let y = g(&f());`, // would *not* let the `f()` temporary escape into an outer scope - // (i.e. `'static`), which means that after `g` returns, it drops, + // (i.e., `'static`), which means that after `g` returns, it drops, // and all the associated destruction scope rules apply. self.cx.var_parent = None; resolve_local(self, None, Some(&body.value)); @@ -1336,8 +1328,8 @@ fn region_scope_tree<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) return tcx.region_scope_tree(closure_base_def_id); } - let id = tcx.hir.as_local_node_id(def_id).unwrap(); - let scope_tree = if let Some(body_id) = tcx.hir.maybe_body_owned_by(id) { + let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let scope_tree = if let Some(body_id) = tcx.hir().maybe_body_owned_by(id) { let mut visitor = RegionResolutionVisitor { tcx, scope_tree: ScopeTree::default(), @@ -1350,16 +1342,16 @@ fn region_scope_tree<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) terminating_scopes: Default::default(), }; - let body = tcx.hir.body(body_id); + let body = tcx.hir().body(body_id); visitor.scope_tree.root_body = Some(body.value.hir_id); // If the item is an associated const or a method, // record its impl/trait parent, as it can also have // lifetime parameters free in this body. - match tcx.hir.get(id) { + match tcx.hir().get(id) { Node::ImplItem(_) | Node::TraitItem(_) => { - visitor.scope_tree.root_parent = Some(tcx.hir.get_parent(id)); + visitor.scope_tree.root_parent = Some(tcx.hir().get_parent(id)); } _ => {} } diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 6ff450508d1..34db30a1706 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Name resolution for lifetimes. //! //! Name resolution for lifetimes follows MUCH simpler rules than the @@ -303,14 +293,14 @@ enum Scope<'a> { /// Lifetimes introduced by a fn are scoped to the call-site for that fn, /// if this is a fn body, otherwise the original definitions are used. /// Unspecified lifetimes are inferred, unless an elision scope is nested, - /// e.g. `(&T, fn(&T) -> &T);` becomes `(&'_ T, for<'a> fn(&'a T) -> &'a T)`. + /// e.g., `(&T, fn(&T) -> &T);` becomes `(&'_ T, for<'a> fn(&'a T) -> &'a T)`. Body { id: hir::BodyId, s: ScopeRef<'a>, }, /// A scope which either determines unspecified lifetimes or errors - /// on them (e.g. due to ambiguity). For more details, see `Elide`. + /// on them (e.g., due to ambiguity). For more details, see `Elide`. Elision { elide: Elide, s: ScopeRef<'a>, @@ -398,19 +388,19 @@ fn resolve_lifetimes<'tcx>( let mut rl = ResolveLifetimes::default(); for (k, v) in named_region_map.defs { - let hir_id = tcx.hir.node_to_hir_id(k); + let hir_id = tcx.hir().node_to_hir_id(k); let map = rl.defs.entry(hir_id.owner_local_def_id()).or_default(); Lrc::get_mut(map).unwrap().insert(hir_id.local_id, v); } for k in named_region_map.late_bound { - let hir_id = tcx.hir.node_to_hir_id(k); + let hir_id = tcx.hir().node_to_hir_id(k); let map = rl.late_bound .entry(hir_id.owner_local_def_id()) .or_default(); Lrc::get_mut(map).unwrap().insert(hir_id.local_id); } for (k, v) in named_region_map.object_lifetime_defaults { - let hir_id = tcx.hir.node_to_hir_id(k); + let hir_id = tcx.hir().node_to_hir_id(k); let map = rl.object_lifetime_defaults .entry(hir_id.owner_local_def_id()) .or_default(); @@ -423,7 +413,7 @@ fn resolve_lifetimes<'tcx>( } fn krate<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> NamedRegionMap { - let krate = tcx.hir.krate(); + let krate = tcx.hir().krate(); let mut map = NamedRegionMap { defs: Default::default(), late_bound: Default::default(), @@ -460,7 +450,7 @@ fn sub_items_have_self_param(node: &hir::ItemKind) -> bool { impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::All(&self.tcx.hir) + NestedVisitorMap::All(&self.tcx.hir()) } // We want to nest trait/impl items in their parent, but nothing else. @@ -469,7 +459,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { fn visit_nested_body(&mut self, body: hir::BodyId) { // Each body has their own set of labels, save labels. let saved = replace(&mut self.labels_in_fn, vec![]); - let body = self.tcx.hir.body(body); + let body = self.tcx.hir().body(body); extract_labels(self, body); self.with( Scope::Body { @@ -545,7 +535,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { .iter() .filter_map(|param| match param.kind { GenericParamKind::Lifetime { .. } => { - Some(Region::early(&self.tcx.hir, &mut index, param)) + Some(Region::early(&self.tcx.hir(), &mut index, param)) } GenericParamKind::Type { .. } => { type_count += 1; @@ -596,7 +586,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { .iter() .filter_map(|param| match param.kind { GenericParamKind::Lifetime { .. } => { - Some(Region::late(&self.tcx.hir, param)) + Some(Region::late(&self.tcx.hir(), param)) } _ => None, }) @@ -622,13 +612,13 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { LifetimeName::Implicit => { // If the user does not write *anything*, we // use the object lifetime defaulting - // rules. So e.g. `Box` becomes + // rules. So e.g., `Box` becomes // `Box`. self.resolve_object_lifetime_default(lifetime) } LifetimeName::Underscore => { // If the user writes `'_`, we use the *ordinary* elision - // rules. So the `'_` in e.g. `Box` will be + // rules. So the `'_` in e.g., `Box` will be // resolved the same as the `'_` in `&'_ Foo`. // // cc #48468 @@ -655,7 +645,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { // `abstract type MyAnonTy<'b>: MyTrait<'b>;` // ^ ^ this gets resolved in the scope of // the exist_ty generics - let (generics, bounds) = match self.tcx.hir.expect_item(item_id.id).node { + let (generics, bounds) = match self.tcx.hir().expect_item(item_id.id).node { // named existential types are reached via TyKind::Path // this arm is for `impl Trait` in the types of statics, constants and locals hir::ItemKind::Existential(hir::ExistTy { @@ -689,12 +679,12 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { // In the future, this should be fixed and this error should be removed. let def = self.map.defs.get(&lifetime.id).cloned(); if let Some(Region::LateBound(_, def_id, _)) = def { - if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) { + if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) { // Ensure that the parent of the def is an item, not HRTB - let parent_id = self.tcx.hir.get_parent_node(node_id); + let parent_id = self.tcx.hir().get_parent_node(node_id); let parent_impl_id = hir::ImplItemId { node_id: parent_id }; let parent_trait_id = hir::TraitItemId { node_id: parent_id }; - let krate = self.tcx.hir.forest.krate(); + let krate = self.tcx.hir().forest.krate(); if !(krate.items.contains_key(&parent_id) || krate.impl_items.contains_key(&parent_impl_id) || krate.trait_items.contains_key(&parent_trait_id)) @@ -724,7 +714,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { for param in &generics.params { match param.kind { GenericParamKind::Lifetime { .. } => { - let (name, reg) = Region::early(&self.tcx.hir, &mut index, ¶m); + let (name, reg) = Region::early(&self.tcx.hir(), &mut index, ¶m); if let hir::ParamName::Plain(param_name) = name { if param_name.name == keywords::UnderscoreLifetime.name() { // Pick the elided lifetime "definition" if one exists @@ -790,7 +780,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { Method(ref sig, _) => { let tcx = self.tcx; self.visit_early_late( - Some(tcx.hir.get_parent(trait_item.id)), + Some(tcx.hir().get_parent(trait_item.id)), &sig.decl, &trait_item.generics, |this| intravisit::walk_trait_item(this, trait_item), @@ -806,7 +796,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { .iter() .filter_map(|param| match param.kind { GenericParamKind::Lifetime { .. } => { - Some(Region::early(&self.tcx.hir, &mut index, param)) + Some(Region::early(&self.tcx.hir(), &mut index, param)) } GenericParamKind::Type { .. } => { type_count += 1; @@ -845,7 +835,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { Method(ref sig, _) => { let tcx = self.tcx; self.visit_early_late( - Some(tcx.hir.get_parent(impl_item.id)), + Some(tcx.hir().get_parent(impl_item.id)), &sig.decl, &impl_item.generics, |this| intravisit::walk_impl_item(this, impl_item), @@ -861,7 +851,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { .iter() .filter_map(|param| match param.kind { GenericParamKind::Lifetime { .. } => { - Some(Region::early(&self.tcx.hir, &mut index, param)) + Some(Region::early(&self.tcx.hir(), &mut index, param)) } GenericParamKind::Type { .. } => { next_early_index += 1; @@ -891,7 +881,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { .iter() .filter_map(|param| match param.kind { GenericParamKind::Lifetime { .. } => { - Some(Region::early(&self.tcx.hir, &mut index, param)) + Some(Region::early(&self.tcx.hir(), &mut index, param)) } GenericParamKind::Type { .. } => { next_early_index += 1; @@ -976,7 +966,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { .iter() .filter_map(|param| match param.kind { GenericParamKind::Lifetime { .. } => { - Some(Region::late(&self.tcx.hir, param)) + Some(Region::late(&self.tcx.hir(), param)) } _ => None, }) @@ -1051,7 +1041,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { .iter() .filter_map(|param| match param.kind { GenericParamKind::Lifetime { .. } => { - Some(Region::late(&self.tcx.hir, param)) + Some(Region::late(&self.tcx.hir(), param)) } _ => None, }) @@ -1258,12 +1248,12 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) { } => { // FIXME (#24278): non-hygienic comparison if let Some(def) = lifetimes.get(&hir::ParamName::Plain(label.modern())) { - let node_id = tcx.hir.as_local_node_id(def.id().unwrap()).unwrap(); + let node_id = tcx.hir().as_local_node_id(def.id().unwrap()).unwrap(); signal_shadowing_problem( tcx, label.name, - original_lifetime(tcx.hir.span(node_id)), + original_lifetime(tcx.hir().span(node_id)), shadower_label(label.span), ); return; @@ -1279,7 +1269,7 @@ fn compute_object_lifetime_defaults( tcx: TyCtxt<'_, '_, '_>, ) -> NodeMap> { let mut map = NodeMap::default(); - for item in tcx.hir.krate().items.values() { + for item in tcx.hir().krate().items.values() { match item.node { hir::ItemKind::Struct(_, ref generics) | hir::ItemKind::Union(_, ref generics) @@ -1355,7 +1345,7 @@ fn object_lifetime_defaults_for_item( add_bounds(&mut set, ¶m.bounds); - let param_def_id = tcx.hir.local_def_id(param.id); + let param_def_id = tcx.hir().local_def_id(param.id); for predicate in &generics.where_clause.predicates { // Look for `type: ...` where clauses. let data = match *predicate { @@ -1399,7 +1389,7 @@ fn object_lifetime_defaults_for_item( .enumerate() .find(|&(_, (_, lt_name, _))| lt_name == name) .map_or(Set1::Many, |(i, (id, _, origin))| { - let def_id = tcx.hir.local_def_id(id); + let def_id = tcx.hir().local_def_id(id); Set1::One(Region::EarlyBound(i as u32, def_id, origin)) }) } @@ -1492,7 +1482,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { let name = lifetime.name.ident(); let mut remove_decl = None; if let Some(parent_def_id) = self.tcx.parent(def_id) { - if let Some(generics) = self.tcx.hir.get_generics(parent_def_id) { + if let Some(generics) = self.tcx.hir().get_generics(parent_def_id) { remove_decl = self.lifetime_deletion_span(name, generics); } } @@ -1513,8 +1503,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } } }; - if let Node::Lifetime(hir_lifetime) = self.tcx.hir.get(lifetime.id) { - if let Some(parent) = self.tcx.hir.find(self.tcx.hir.get_parent(hir_lifetime.id)) { + if let Node::Lifetime(hir_lifetime) = self.tcx.hir().get(lifetime.id) { + if let Some(parent) = self.tcx.hir().find(self.tcx.hir().get_parent(hir_lifetime.id)) { match parent { Node::Item(item) => { if let hir::ItemKind::Fn(decl, _, _, _) = &item.node { @@ -1536,14 +1526,14 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { // place ("start at" because the latter includes trailing // whitespace), then this is an in-band lifetime if decl_span.shrink_to_lo() == use_span.shrink_to_lo() { - err.span_suggestion_with_applicability( + err.span_suggestion( use_span, "elide the single-use lifetime", String::new(), Applicability::MachineApplicable, ); } else { - err.multipart_suggestion_with_applicability( + err.multipart_suggestion( "elide the single-use lifetime", vec![(decl_span, String::new()), (use_span, String::new())], Applicability::MachineApplicable, @@ -1573,7 +1563,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { .collect(); // ensure that we issue lints in a repeatable order - def_ids.sort_by_key(|&def_id| self.tcx.def_path_hash(def_id)); + def_ids.sort_by_cached_key(|&def_id| self.tcx.def_path_hash(def_id)); for def_id in def_ids { debug!( @@ -1590,9 +1580,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { match lifetimeuseset { Some(LifetimeUseSet::One(lifetime)) => { - let node_id = self.tcx.hir.as_local_node_id(def_id).unwrap(); + let node_id = self.tcx.hir().as_local_node_id(def_id).unwrap(); debug!("node id first={:?}", node_id); - if let Some((id, span, name)) = match self.tcx.hir.get(node_id) { + if let Some((id, span, name)) = match self.tcx.hir().get(node_id) { Node::Lifetime(hir_lifetime) => Some(( hir_lifetime.id, hir_lifetime.span, @@ -1631,8 +1621,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { debug!("Not one use lifetime"); } None => { - let node_id = self.tcx.hir.as_local_node_id(def_id).unwrap(); - if let Some((id, span, name)) = match self.tcx.hir.get(node_id) { + let node_id = self.tcx.hir().as_local_node_id(def_id).unwrap(); + if let Some((id, span, name)) = match self.tcx.hir().get(node_id) { Node::Lifetime(hir_lifetime) => Some(( hir_lifetime.id, hir_lifetime.span, @@ -1651,10 +1641,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { &format!("lifetime parameter `{}` never used", name), ); if let Some(parent_def_id) = self.tcx.parent(def_id) { - if let Some(generics) = self.tcx.hir.get_generics(parent_def_id) { + if let Some(generics) = self.tcx.hir().get_generics(parent_def_id) { let unused_lt_span = self.lifetime_deletion_span(name, generics); if let Some(span) = unused_lt_span { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "elide the unused lifetime", String::new(), @@ -1699,10 +1689,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { { insert_late_bound_lifetimes(self.map, decl, generics); - // Find the start of nested early scopes, e.g. in methods. + // Find the start of nested early scopes, e.g., in methods. let mut index = 0; if let Some(parent_id) = parent_id { - let parent = self.tcx.hir.expect_item(parent_id); + let parent = self.tcx.hir().expect_item(parent_id); if sub_items_have_self_param(&parent.node) { index += 1; // Self comes before lifetimes } @@ -1722,9 +1712,9 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { .filter_map(|param| match param.kind { GenericParamKind::Lifetime { .. } => { if self.map.late_bound.contains(¶m.id) { - Some(Region::late(&self.tcx.hir, param)) + Some(Region::late(&self.tcx.hir(), param)) } else { - Some(Region::early(&self.tcx.hir, &mut index, param)) + Some(Region::early(&self.tcx.hir(), &mut index, param)) } } GenericParamKind::Type { .. } => { @@ -1837,8 +1827,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { if let Region::EarlyBound(..) = def { // Do not free early-bound regions, only late-bound ones. } else if let Some(body_id) = outermost_body { - let fn_id = self.tcx.hir.body_owner(body_id); - match self.tcx.hir.get(fn_id) { + let fn_id = self.tcx.hir().body_owner(body_id); + match self.tcx.hir().get(fn_id) { Node::Item(&hir::Item { node: hir::ItemKind::Fn(..), .. @@ -1851,7 +1841,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { node: hir::ImplItemKind::Method(..), .. }) => { - let scope = self.tcx.hir.local_def_id(fn_id); + let scope = self.tcx.hir().local_def_id(fn_id); def = Region::Free(scope, def.id().unwrap()); } _ => {} @@ -1967,7 +1957,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { }; let map = &self.map; - let unsubst = if let Some(id) = self.tcx.hir.as_local_node_id(def_id) { + let unsubst = if let Some(id) = self.tcx.hir().as_local_node_id(def_id) { &map.object_lifetime_defaults[&id] } else { let tcx = self.tcx; @@ -2061,8 +2051,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { // and whether there's a `self` argument (treated specially). let mut assoc_item_kind = None; let mut impl_self = None; - let parent = self.tcx.hir.get_parent_node(output.id); - let body = match self.tcx.hir.get(parent) { + let parent = self.tcx.hir().get_parent_node(output.id); + let body = match self.tcx.hir().get(parent) { // `fn` definitions and methods. Node::Item(&hir::Item { node: hir::ItemKind::Fn(.., body), @@ -2074,8 +2064,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { .. }) => { if let hir::ItemKind::Trait(.., ref trait_items) = self.tcx - .hir - .expect_item(self.tcx.hir.get_parent(parent)) + .hir() + .expect_item(self.tcx.hir().get_parent(parent)) .node { assoc_item_kind = trait_items @@ -2094,8 +2084,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { .. }) => { if let hir::ItemKind::Impl(.., ref self_ty, ref impl_items) = self.tcx - .hir - .expect_item(self.tcx.hir.get_parent(parent)) + .hir() + .expect_item(self.tcx.hir().get_parent(parent)) .node { impl_self = Some(self_ty); @@ -2360,7 +2350,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } else { (format!("{} + 'static", snippet), Applicability::MaybeIncorrect) }; - db.span_suggestion_with_applicability(span, msg, sugg, applicability); + db.span_suggestion(span, msg, sugg, applicability); false } Err(_) => { @@ -2396,8 +2386,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } = info; let help_name = if let Some(body) = parent { - let arg = &self.tcx.hir.body(body).arguments[index]; - format!("`{}`", self.tcx.hir.node_to_pretty_string(arg.pat.id)) + let arg = &self.tcx.hir().body(body).arguments[index]; + format!("`{}`", self.tcx.hir().node_to_pretty_string(arg.pat.id)) } else { format!("argument {}", index + 1) }; @@ -2603,12 +2593,12 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { ref lifetimes, s, .. } => { if let Some(&def) = lifetimes.get(¶m.name.modern()) { - let node_id = self.tcx.hir.as_local_node_id(def.id().unwrap()).unwrap(); + let node_id = self.tcx.hir().as_local_node_id(def.id().unwrap()).unwrap(); signal_shadowing_problem( self.tcx, param.name.ident().name, - original_lifetime(self.tcx.hir.span(node_id)), + original_lifetime(self.tcx.hir().span(node_id)), shadower_lifetime(¶m), ); return; @@ -2675,7 +2665,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { debug!( "insert_lifetime: {} resolved to {:?} span={:?}", - self.tcx.hir.node_to_string(lifetime_ref.id), + self.tcx.hir().node_to_string(lifetime_ref.id), def, self.tcx.sess.source_map().span_to_string(lifetime_ref.span) ); diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 543d1053b55..a9193e06d89 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -1,36 +1,27 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A pass that annotates every item and method with its stability level, //! propagating default levels lexically from parent to children ast nodes. pub use self::StabilityLevel::*; -use lint; +use lint::{self, Lint}; +use hir::{self, Item, Generics, StructField, Variant, HirId}; use hir::def::Def; use hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, LOCAL_CRATE}; -use ty::{self, TyCtxt}; +use hir::intravisit::{self, Visitor, NestedVisitorMap}; +use ty::query::Providers; +use ty::query::queries; use middle::privacy::AccessLevels; use session::{DiagnosticMessageId, Session}; use syntax::symbol::Symbol; use syntax_pos::{Span, MultiSpan}; use syntax::ast; use syntax::ast::{NodeId, Attribute}; +use syntax::errors::Applicability; use syntax::feature_gate::{GateIssue, emit_feature_err}; use syntax::attr::{self, Stability, Deprecation}; +use ty::{self, TyCtxt}; use util::nodemap::{FxHashSet, FxHashMap}; -use hir; -use hir::{Item, Generics, StructField, Variant, HirId}; -use hir::intravisit::{self, Visitor, NestedVisitorMap}; - use std::mem::replace; use std::cmp::Ordering; @@ -188,7 +179,7 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { } } - let hir_id = self.tcx.hir.node_to_hir_id(id); + let hir_id = self.tcx.hir().node_to_hir_id(id); self.index.stab_map.insert(hir_id, stab); let orig_parent_stab = replace(&mut self.parent_stab, Some(stab)); @@ -198,7 +189,7 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { debug!("annotate: not found, parent = {:?}", self.parent_stab); if let Some(stab) = self.parent_stab { if stab.level.is_unstable() { - let hir_id = self.tcx.hir.node_to_hir_id(id); + let hir_id = self.tcx.hir().node_to_hir_id(id); self.index.stab_map.insert(hir_id, stab); } } @@ -219,7 +210,7 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { // -Zforce-unstable-if-unmarked is set. if let Some(stab) = self.parent_stab { if stab.level.is_unstable() { - let hir_id = self.tcx.hir.node_to_hir_id(id); + let hir_id = self.tcx.hir().node_to_hir_id(id); self.index.stab_map.insert(hir_id, stab); } } @@ -230,7 +221,7 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { } // `Deprecation` is just two pointers, no need to intern it - let hir_id = self.tcx.hir.node_to_hir_id(id); + let hir_id = self.tcx.hir().node_to_hir_id(id); let depr_entry = DeprecationEntry::local(depr, hir_id); self.index.depr_map.insert(hir_id, depr_entry.clone()); @@ -239,7 +230,7 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { visit_children(self); self.parent_depr = orig_parent_depr; } else if let Some(parent_depr) = self.parent_depr.clone() { - let hir_id = self.tcx.hir.node_to_hir_id(id); + let hir_id = self.tcx.hir().node_to_hir_id(id); self.index.depr_map.insert(hir_id, parent_depr); visit_children(self); } else { @@ -254,7 +245,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { /// nested items in the context of the outer item, so enable /// deep-walking. fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::All(&self.tcx.hir) + NestedVisitorMap::All(&self.tcx.hir()) } fn visit_item(&mut self, i: &'tcx Item) { @@ -333,7 +324,7 @@ struct MissingStabilityAnnotations<'a, 'tcx: 'a> { impl<'a, 'tcx: 'a> MissingStabilityAnnotations<'a, 'tcx> { fn check_missing_stability(&self, id: NodeId, span: Span) { - let hir_id = self.tcx.hir.node_to_hir_id(id); + let hir_id = self.tcx.hir().node_to_hir_id(id); let stab = self.tcx.stability().local_stability(hir_id); let is_error = !self.tcx.sess.opts.test && stab.is_none() && @@ -346,7 +337,7 @@ impl<'a, 'tcx: 'a> MissingStabilityAnnotations<'a, 'tcx> { impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::OnlyBodies(&self.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } fn visit_item(&mut self, i: &'tcx Item) { @@ -369,7 +360,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> { } fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) { - let impl_def_id = self.tcx.hir.local_def_id(self.tcx.hir.get_parent(ii.id)); + let impl_def_id = self.tcx.hir().local_def_id(self.tcx.hir().get_parent(ii.id)); if self.tcx.impl_trait_ref(impl_def_id).is_none() { self.check_missing_stability(ii.id, ii.span); } @@ -416,7 +407,7 @@ impl<'a, 'tcx> Index<'tcx> { index.active_features = active_lib_features.iter().map(|&(ref s, _)| s.clone()).collect(); { - let krate = tcx.hir.krate(); + let krate = tcx.hir().krate(); let mut annotator = Annotator { tcx, index: &mut index, @@ -466,18 +457,30 @@ impl<'a, 'tcx> Index<'tcx> { } } +pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { + for &module in tcx.hir().krate().modules.keys() { + queries::check_mod_unstable_api_usage::ensure(tcx, tcx.hir().local_def_id(module)); + } +} + /// Cross-references the feature names of unstable APIs with enabled /// features and possibly prints errors. -pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - let mut checker = Checker { tcx }; - tcx.hir.krate().visit_all_item_likes(&mut checker.as_deep_visitor()); +fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { + tcx.hir().visit_item_likes_in_module(module_def_id, &mut Checker { tcx }.as_deep_visitor()); +} + +pub fn provide(providers: &mut Providers<'_>) { + *providers = Providers { + check_mod_unstable_api_usage, + ..*providers + }; } /// Check whether an item marked with `deprecated(since="X")` is currently -/// deprecated (i.e. whether X is not greater than the current rustc version). +/// deprecated (i.e., whether X is not greater than the current rustc version). pub fn deprecation_in_effect(since: &str) -> bool { fn parse_version(ver: &str) -> Vec { - // We ignore non-integer components of the version (e.g. "nightly"). + // We ignore non-integer components of the version (e.g., "nightly"). ver.split(|c| c == '.' || c == '-').flat_map(|s| s.parse()).collect() } @@ -518,7 +521,7 @@ pub enum EvalResult { } impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { - // (See issue #38412) + // See issue #38412. fn skip_stability_check_due_to_privacy(self, mut def_id: DefId) -> bool { // Check if `def_id` is a trait method. match self.describe_def(def_id) { @@ -528,8 +531,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { if let ty::TraitContainer(trait_def_id) = self.associated_item(def_id).container { // Trait methods do not declare visibility (even // for visibility info in cstore). Use containing - // trait instead, so methods of pub traits are - // themselves considered pub. + // trait instead, so methods of `pub` traits are + // themselves considered `pub`. def_id = trait_def_id; } } @@ -539,10 +542,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let visibility = self.visibility(def_id); match visibility { - // must check stability for pub items. + // Must check stability for `pub` items. ty::Visibility::Public => false, - // these are not visible outside crate; therefore + // These are not visible outside crate; therefore // stability markers are irrelevant, if even present. ty::Visibility::Restricted(..) | ty::Visibility::Invisible => true, @@ -564,18 +567,32 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { return EvalResult::Allow; } - let lint_deprecated = |def_id: DefId, id: NodeId, note: Option| { - let path = self.item_path_str(def_id); - + let lint_deprecated = |def_id: DefId, + id: NodeId, + note: Option, + suggestion: Option, + message: &str, + lint: &'static Lint| { let msg = if let Some(note) = note { - format!("use of deprecated item '{}': {}", path, note) + format!("{}: {}", message, note) } else { - format!("use of deprecated item '{}'", path) + format!("{}", message) }; - self.lint_node(lint::builtin::DEPRECATED, id, span, &msg); + let mut diag = self.struct_span_lint_node(lint, id, span, &msg); + if let Some(suggestion) = suggestion { + if let hir::Node::Expr(_) = self.hir().get(id) { + diag.span_suggestion( + span, + &msg, + suggestion.to_string(), + Applicability::MachineApplicable, + ); + } + } + diag.emit(); if id == ast::DUMMY_NODE_ID { - span_bug!(span, "emitted a deprecated lint with dummy node id: {:?}", def_id); + span_bug!(span, "emitted a {} lint with dummy node id: {:?}", lint.name, def_id); } }; @@ -586,17 +603,41 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // version, then we should display no warning message. let deprecated_in_future_version = if let Some(sym) = depr_entry.attr.since { let since = sym.as_str(); - !deprecation_in_effect(&since) + if !deprecation_in_effect(&since) { + Some(since) + } else { + None + } } else { - false + None }; - let parent_def_id = self.hir.local_def_id(self.hir.get_parent(id)); - let skip = deprecated_in_future_version || - self.lookup_deprecation_entry(parent_def_id) + let parent_def_id = self.hir().local_def_id(self.hir().get_parent(id)); + let skip = self.lookup_deprecation_entry(parent_def_id) .map_or(false, |parent_depr| parent_depr.same_origin(&depr_entry)); - if !skip { - lint_deprecated(def_id, id, depr_entry.attr.note); + + if let Some(since) = deprecated_in_future_version { + let path = self.item_path_str(def_id); + let message = format!("use of item '{}' \ + that will be deprecated in future version {}", + path, + since); + + lint_deprecated(def_id, + id, + depr_entry.attr.note, + None, + &message, + lint::builtin::DEPRECATED_IN_FUTURE); + } else if !skip { + let path = self.item_path_str(def_id); + let message = format!("use of deprecated item '{}'", path); + lint_deprecated(def_id, + id, + depr_entry.attr.note, + None, + &message, + lint::builtin::DEPRECATED); } }; } @@ -613,11 +654,30 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { debug!("stability: \ inspecting def_id={:?} span={:?} of stability={:?}", def_id, span, stability); - if let Some(&Stability{rustc_depr: Some(attr::RustcDeprecation { reason, since }), ..}) - = stability { - if let Some(id) = id { - if deprecation_in_effect(&since.as_str()) { - lint_deprecated(def_id, id, Some(reason)); + if let Some(id) = id { + if let Some(stability) = stability { + if let Some(depr) = &stability.rustc_depr { + let path = self.item_path_str(def_id); + if deprecation_in_effect(&depr.since.as_str()) { + let message = format!("use of deprecated item '{}'", path); + lint_deprecated(def_id, + id, + Some(depr.reason), + depr.suggestion, + &message, + lint::builtin::DEPRECATED); + } else { + let message = format!("use of item '{}' \ + that will be deprecated in future version {}", + path, + depr.since); + lint_deprecated(def_id, + id, + Some(depr.reason), + depr.suggestion, + &message, + lint::builtin::DEPRECATED_IN_FUTURE); + } } } } @@ -628,7 +688,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { return EvalResult::Allow; } - // Issue 38412: private items lack stability markers. + // Issue #38412: private items lack stability markers. if self.skip_stability_check_due_to_privacy(def_id) { return EvalResult::Allow; } @@ -644,7 +704,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // crates also pulled in from crates.io. We want to ideally be // able to compile everything without requiring upstream // modifications, so in the case that this looks like a - // rustc_private crate (e.g. a compiler crate) and we also have + // `rustc_private` crate (e.g., a compiler crate) and we also have // the `-Z force-unstable-if-unmarked` flag present (we're // compiling a compiler crate), then let this missing feature // annotation slide. @@ -717,7 +777,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { /// nested items in the context of the outer item, so enable /// deep-walking. fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::OnlyBodies(&self.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } fn visit_item(&mut self, item: &'tcx hir::Item) { @@ -726,7 +786,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { // compiler-generated `extern crate` items have a dummy span. if item.span.is_dummy() { return } - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); let cnum = match self.tcx.extern_mod_stmt_cnum(def_id) { Some(cnum) => cnum, None => return, @@ -741,7 +801,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { hir::ItemKind::Impl(.., Some(ref t), _, ref impl_item_refs) => { if let Def::Trait(trait_did) = t.path.def { for impl_item_ref in impl_item_refs { - let impl_item = self.tcx.hir.impl_item(impl_item_ref.id); + let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); let trait_item_def_id = self.tcx.associated_items(trait_did) .find(|item| item.ident.name == impl_item.ident.name) .map(|item| item.def_id); @@ -756,7 +816,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { // There's no good place to insert stability check for non-Copy unions, // so semi-randomly perform it here in stability.rs hir::ItemKind::Union(..) if !self.tcx.features().untagged_unions => { - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); let adt_def = self.tcx.adt_def(def_id); let ty = self.tcx.type_of(def_id); @@ -780,7 +840,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { } fn visit_path(&mut self, path: &'tcx hir::Path, id: hir::HirId) { - let id = self.tcx.hir.hir_to_node_id(id); + let id = self.tcx.hir().hir_to_node_id(id); if let Some(def_id) = path.def.opt_def_id() { self.tcx.check_stability(def_id, Some(id), path.span) } @@ -794,14 +854,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } -/// Given the list of enabled features that were not language features (i.e. that +/// Given the list of enabled features that were not language features (i.e., that /// were expected to be library features), and the list of features used from /// libraries, identify activated features that don't exist and error about them. pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); if tcx.stability().staged_api[&LOCAL_CRATE] { - let krate = tcx.hir.krate(); + let krate = tcx.hir().krate(); let mut missing = MissingStabilityAnnotations { tcx, access_levels, diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs index 0d407765c9e..82f19cbb82a 100644 --- a/src/librustc/middle/weak_lang_items.rs +++ b/src/librustc/middle/weak_lang_items.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Validity checking for weak lang items use session::config; @@ -49,7 +39,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, { let mut cx = Context { tcx, items }; - tcx.hir.krate().visit_all_item_likes(&mut cx.as_deep_visitor()); + tcx.hir().krate().visit_all_item_likes(&mut cx.as_deep_visitor()); } verify(tcx, items); } diff --git a/src/librustc/mir/cache.rs b/src/librustc/mir/cache.rs index 32c60c14306..56ab263c477 100644 --- a/src/librustc/mir/cache.rs +++ b/src/librustc/mir/cache.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::indexed_vec::IndexVec; use rustc_data_structures::sync::{RwLock, MappedReadGuard, ReadGuard}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher, diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index 02c0ebcec4f..7ed29c5afd0 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -1,16 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The virtual memory representation of the MIR interpreter -use super::{Pointer, EvalResult, AllocId}; +use super::{ + Pointer, EvalResult, AllocId, ScalarMaybeUndef, write_target_uint, read_target_uint, Scalar, + truncate, +}; use ty::layout::{Size, Align}; use syntax::ast::Mutability; @@ -18,6 +11,7 @@ use std::iter; use mir; use std::ops::{Deref, DerefMut}; use rustc_data_structures::sorted_map::SortedMap; +use rustc_target::abi::HasDataLayout; /// Used by `check_bounds` to indicate whether the pointer needs to be just inbounds /// or also inbounds of a *live* allocation. @@ -49,13 +43,20 @@ pub struct Allocation { pub extra: Extra, } -pub trait AllocationExtra: ::std::fmt::Debug + Default + Clone { + +pub trait AllocationExtra: ::std::fmt::Debug + Clone { + /// Hook to initialize the extra data when an allocation gets created. + fn memory_allocated( + _size: Size, + _memory_extra: &MemoryExtra + ) -> Self; + /// Hook for performing extra checks on a memory read access. /// /// Takes read-only access to the allocation so we can keep all the memory read /// operations take `&self`. Use a `RefCell` in `AllocExtra` if you /// need to mutate. - #[inline] + #[inline(always)] fn memory_read( _alloc: &Allocation, _ptr: Pointer, @@ -65,7 +66,7 @@ pub trait AllocationExtra: ::std::fmt::Debug + Default + Clone { } /// Hook for performing extra checks on a memory write access. - #[inline] + #[inline(always)] fn memory_written( _alloc: &mut Allocation, _ptr: Pointer, @@ -76,7 +77,7 @@ pub trait AllocationExtra: ::std::fmt::Debug + Default + Clone { /// Hook for performing extra checks on a memory deallocation. /// `size` will be the size of the allocation. - #[inline] + #[inline(always)] fn memory_deallocated( _alloc: &mut Allocation, _ptr: Pointer, @@ -86,11 +87,19 @@ pub trait AllocationExtra: ::std::fmt::Debug + Default + Clone { } } -impl AllocationExtra<()> for () {} +impl AllocationExtra<(), ()> for () { + #[inline(always)] + fn memory_allocated( + _size: Size, + _memory_extra: &() + ) -> Self { + () + } +} -impl Allocation { +impl Allocation { /// Creates a read-only allocation initialized by the given bytes - pub fn from_bytes(slice: &[u8], align: Align) -> Self { + pub fn from_bytes(slice: &[u8], align: Align, extra: Extra) -> Self { let mut undef_mask = UndefMask::new(Size::ZERO); undef_mask.grow(Size::from_bytes(slice.len() as u64), true); Self { @@ -99,15 +108,15 @@ impl Allocation { undef_mask, align, mutability: Mutability::Immutable, - extra: Extra::default(), + extra, } } - pub fn from_byte_aligned_bytes(slice: &[u8]) -> Self { - Allocation::from_bytes(slice, Align::from_bytes(1, 1).unwrap()) + pub fn from_byte_aligned_bytes(slice: &[u8], extra: Extra) -> Self { + Allocation::from_bytes(slice, Align::from_bytes(1).unwrap(), extra) } - pub fn undef(size: Size, align: Align) -> Self { + pub fn undef(size: Size, align: Align, extra: Extra) -> Self { assert_eq!(size.bytes() as usize as u64, size.bytes()); Allocation { bytes: vec![0; size.bytes() as usize], @@ -115,13 +124,461 @@ impl Allocation { undef_mask: UndefMask::new(size), align, mutability: Mutability::Mutable, - extra: Extra::default(), + extra, } } } impl<'tcx> ::serialize::UseSpecializedDecodable for &'tcx Allocation {} +/// Alignment and bounds checks +impl<'tcx, Tag, Extra> Allocation { + /// Check if the pointer is "in-bounds". Notice that a pointer pointing at the end + /// of an allocation (i.e., at the first *inaccessible* location) *is* considered + /// in-bounds! This follows C's/LLVM's rules. + /// If you want to check bounds before doing a memory access, better use `check_bounds`. + fn check_bounds_ptr( + &self, + ptr: Pointer, + ) -> EvalResult<'tcx> { + let allocation_size = self.bytes.len() as u64; + ptr.check_in_alloc(Size::from_bytes(allocation_size), InboundsCheck::Live) + } + + /// Check if the memory range beginning at `ptr` and of size `Size` is "in-bounds". + #[inline(always)] + pub fn check_bounds( + &self, + cx: &impl HasDataLayout, + ptr: Pointer, + size: Size, + ) -> EvalResult<'tcx> { + // if ptr.offset is in bounds, then so is ptr (because offset checks for overflow) + self.check_bounds_ptr(ptr.offset(size, cx)?) + } +} + +/// Byte accessors +impl<'tcx, Tag: Copy, Extra> Allocation { + /// The last argument controls whether we error out when there are undefined + /// or pointer bytes. You should never call this, call `get_bytes` or + /// `get_bytes_with_undef_and_ptr` instead, + /// + /// This function also guarantees that the resulting pointer will remain stable + /// even when new allocations are pushed to the `HashMap`. `copy_repeatedly` relies + /// on that. + fn get_bytes_internal( + &self, + cx: &impl HasDataLayout, + ptr: Pointer, + size: Size, + check_defined_and_ptr: bool, + ) -> EvalResult<'tcx, &[u8]> + // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + where Extra: AllocationExtra + { + self.check_bounds(cx, ptr, size)?; + + if check_defined_and_ptr { + self.check_defined(ptr, size)?; + self.check_relocations(cx, ptr, size)?; + } else { + // We still don't want relocations on the *edges* + self.check_relocation_edges(cx, ptr, size)?; + } + + AllocationExtra::memory_read(self, ptr, size)?; + + assert_eq!(ptr.offset.bytes() as usize as u64, ptr.offset.bytes()); + assert_eq!(size.bytes() as usize as u64, size.bytes()); + let offset = ptr.offset.bytes() as usize; + Ok(&self.bytes[offset..offset + size.bytes() as usize]) + } + + #[inline] + pub fn get_bytes( + &self, + cx: &impl HasDataLayout, + ptr: Pointer, + size: Size, + ) -> EvalResult<'tcx, &[u8]> + // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + where Extra: AllocationExtra + { + self.get_bytes_internal(cx, ptr, size, true) + } + + /// It is the caller's responsibility to handle undefined and pointer bytes. + /// However, this still checks that there are no relocations on the *edges*. + #[inline] + pub fn get_bytes_with_undef_and_ptr( + &self, + cx: &impl HasDataLayout, + ptr: Pointer, + size: Size, + ) -> EvalResult<'tcx, &[u8]> + // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + where Extra: AllocationExtra + { + self.get_bytes_internal(cx, ptr, size, false) + } + + /// Just calling this already marks everything as defined and removes relocations, + /// so be sure to actually put data there! + pub fn get_bytes_mut( + &mut self, + cx: &impl HasDataLayout, + ptr: Pointer, + size: Size, + ) -> EvalResult<'tcx, &mut [u8]> + // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + where Extra: AllocationExtra + { + assert_ne!(size.bytes(), 0, "0-sized accesses should never even get a `Pointer`"); + self.check_bounds(cx, ptr, size)?; + + self.mark_definedness(ptr, size, true)?; + self.clear_relocations(cx, ptr, size)?; + + AllocationExtra::memory_written(self, ptr, size)?; + + assert_eq!(ptr.offset.bytes() as usize as u64, ptr.offset.bytes()); + assert_eq!(size.bytes() as usize as u64, size.bytes()); + let offset = ptr.offset.bytes() as usize; + Ok(&mut self.bytes[offset..offset + size.bytes() as usize]) + } +} + +/// Reading and writing +impl<'tcx, Tag: Copy, Extra> Allocation { + /// Reads bytes until a `0` is encountered. Will error if the end of the allocation is reached + /// before a `0` is found. + pub fn read_c_str( + &self, + cx: &impl HasDataLayout, + ptr: Pointer, + ) -> EvalResult<'tcx, &[u8]> + // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + where Extra: AllocationExtra + { + assert_eq!(ptr.offset.bytes() as usize as u64, ptr.offset.bytes()); + let offset = ptr.offset.bytes() as usize; + match self.bytes[offset..].iter().position(|&c| c == 0) { + Some(size) => { + let size_with_null = Size::from_bytes((size + 1) as u64); + // Go through `get_bytes` for checks and AllocationExtra hooks. + // We read the null, so we include it in the request, but we want it removed + // from the result! + Ok(&self.get_bytes(cx, ptr, size_with_null)?[..size]) + } + None => err!(UnterminatedCString(ptr.erase_tag())), + } + } + + /// Validates that `ptr.offset` and `ptr.offset + size` do not point to the middle of a + /// relocation. If `allow_ptr_and_undef` is `false`, also enforces that the memory in the + /// given range contains neither relocations nor undef bytes. + pub fn check_bytes( + &self, + cx: &impl HasDataLayout, + ptr: Pointer, + size: Size, + allow_ptr_and_undef: bool, + ) -> EvalResult<'tcx> + // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + where Extra: AllocationExtra + { + // Check bounds and relocations on the edges + self.get_bytes_with_undef_and_ptr(cx, ptr, size)?; + // Check undef and ptr + if !allow_ptr_and_undef { + self.check_defined(ptr, size)?; + self.check_relocations(cx, ptr, size)?; + } + Ok(()) + } + + /// Writes `src` to the memory starting at `ptr.offset`. + /// + /// Will do bounds checks on the allocation. + pub fn write_bytes( + &mut self, + cx: &impl HasDataLayout, + ptr: Pointer, + src: &[u8], + ) -> EvalResult<'tcx> + // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + where Extra: AllocationExtra + { + let bytes = self.get_bytes_mut(cx, ptr, Size::from_bytes(src.len() as u64))?; + bytes.clone_from_slice(src); + Ok(()) + } + + /// Sets `count` bytes starting at `ptr.offset` with `val`. Basically `memset`. + pub fn write_repeat( + &mut self, + cx: &impl HasDataLayout, + ptr: Pointer, + val: u8, + count: Size + ) -> EvalResult<'tcx> + // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + where Extra: AllocationExtra + { + let bytes = self.get_bytes_mut(cx, ptr, count)?; + for b in bytes { + *b = val; + } + Ok(()) + } + + /// Read a *non-ZST* scalar + /// + /// zsts can't be read out of two reasons: + /// * byteorder cannot work with zero element buffers + /// * in oder to obtain a `Pointer` we need to check for ZSTness anyway due to integer pointers + /// being valid for ZSTs + /// + /// Note: This function does not do *any* alignment checks, you need to do these before calling + pub fn read_scalar( + &self, + cx: &impl HasDataLayout, + ptr: Pointer, + size: Size + ) -> EvalResult<'tcx, ScalarMaybeUndef> + // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + where Extra: AllocationExtra + { + // get_bytes_unchecked tests relocation edges + let bytes = self.get_bytes_with_undef_and_ptr(cx, ptr, size)?; + // Undef check happens *after* we established that the alignment is correct. + // We must not return Ok() for unaligned pointers! + if self.check_defined(ptr, size).is_err() { + // this inflates undefined bytes to the entire scalar, even if only a few + // bytes are undefined + return Ok(ScalarMaybeUndef::Undef); + } + // Now we do the actual reading + let bits = read_target_uint(cx.data_layout().endian, bytes).unwrap(); + // See if we got a pointer + if size != cx.data_layout().pointer_size { + // *Now* better make sure that the inside also is free of relocations. + self.check_relocations(cx, ptr, size)?; + } else { + match self.relocations.get(&ptr.offset) { + Some(&(tag, alloc_id)) => { + let ptr = Pointer::new_with_tag(alloc_id, Size::from_bytes(bits as u64), tag); + return Ok(ScalarMaybeUndef::Scalar(ptr.into())) + } + None => {}, + } + } + // We don't. Just return the bits. + Ok(ScalarMaybeUndef::Scalar(Scalar::from_uint(bits, size))) + } + + /// Note: This function does not do *any* alignment checks, you need to do these before calling + pub fn read_ptr_sized( + &self, + cx: &impl HasDataLayout, + ptr: Pointer, + ) -> EvalResult<'tcx, ScalarMaybeUndef> + // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + where Extra: AllocationExtra + { + self.read_scalar(cx, ptr, cx.data_layout().pointer_size) + } + + /// Write a *non-ZST* scalar + /// + /// zsts can't be read out of two reasons: + /// * byteorder cannot work with zero element buffers + /// * in oder to obtain a `Pointer` we need to check for ZSTness anyway due to integer pointers + /// being valid for ZSTs + /// + /// Note: This function does not do *any* alignment checks, you need to do these before calling + pub fn write_scalar( + &mut self, + cx: &impl HasDataLayout, + ptr: Pointer, + val: ScalarMaybeUndef, + type_size: Size, + ) -> EvalResult<'tcx> + // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + where Extra: AllocationExtra + { + let val = match val { + ScalarMaybeUndef::Scalar(scalar) => scalar, + ScalarMaybeUndef::Undef => return self.mark_definedness(ptr, type_size, false), + }; + + let bytes = match val { + Scalar::Ptr(val) => { + assert_eq!(type_size, cx.data_layout().pointer_size); + val.offset.bytes() as u128 + } + + Scalar::Bits { bits, size } => { + assert_eq!(size as u64, type_size.bytes()); + debug_assert_eq!(truncate(bits, Size::from_bytes(size.into())), bits, + "Unexpected value of size {} when writing to memory", size); + bits + }, + }; + + let endian = cx.data_layout().endian; + let dst = self.get_bytes_mut(cx, ptr, type_size)?; + write_target_uint(endian, dst, bytes).unwrap(); + + // See if we have to also write a relocation + match val { + Scalar::Ptr(val) => { + self.relocations.insert( + ptr.offset, + (val.tag, val.alloc_id), + ); + } + _ => {} + } + + Ok(()) + } + + /// Note: This function does not do *any* alignment checks, you need to do these before calling + pub fn write_ptr_sized( + &mut self, + cx: &impl HasDataLayout, + ptr: Pointer, + val: ScalarMaybeUndef + ) -> EvalResult<'tcx> + // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + where Extra: AllocationExtra + { + let ptr_size = cx.data_layout().pointer_size; + self.write_scalar(cx, ptr.into(), val, ptr_size) + } +} + +/// Relocations +impl<'tcx, Tag: Copy, Extra> Allocation { + /// Return all relocations overlapping with the given ptr-offset pair. + pub fn relocations( + &self, + cx: &impl HasDataLayout, + ptr: Pointer, + size: Size, + ) -> &[(Size, (Tag, AllocId))] { + // We have to go back `pointer_size - 1` bytes, as that one would still overlap with + // the beginning of this range. + let start = ptr.offset.bytes().saturating_sub(cx.data_layout().pointer_size.bytes() - 1); + let end = ptr.offset + size; // this does overflow checking + self.relocations.range(Size::from_bytes(start)..end) + } + + /// Check that there are no relocations overlapping with the given range. + #[inline(always)] + fn check_relocations( + &self, + cx: &impl HasDataLayout, + ptr: Pointer, + size: Size, + ) -> EvalResult<'tcx> { + if self.relocations(cx, ptr, size).is_empty() { + Ok(()) + } else { + err!(ReadPointerAsBytes) + } + } + + /// Remove all relocations inside the given range. + /// If there are relocations overlapping with the edges, they + /// are removed as well *and* the bytes they cover are marked as + /// uninitialized. This is a somewhat odd "spooky action at a distance", + /// but it allows strictly more code to run than if we would just error + /// immediately in that case. + fn clear_relocations( + &mut self, + cx: &impl HasDataLayout, + ptr: Pointer, + size: Size, + ) -> EvalResult<'tcx> { + // Find the start and end of the given range and its outermost relocations. + let (first, last) = { + // Find all relocations overlapping the given range. + let relocations = self.relocations(cx, ptr, size); + if relocations.is_empty() { + return Ok(()); + } + + (relocations.first().unwrap().0, + relocations.last().unwrap().0 + cx.data_layout().pointer_size) + }; + let start = ptr.offset; + let end = start + size; + + // Mark parts of the outermost relocations as undefined if they partially fall outside the + // given range. + if first < start { + self.undef_mask.set_range(first, start, false); + } + if last > end { + self.undef_mask.set_range(end, last, false); + } + + // Forget all the relocations. + self.relocations.remove_range(first..last); + + Ok(()) + } + + /// Error if there are relocations overlapping with the edges of the + /// given memory range. + #[inline] + fn check_relocation_edges( + &self, + cx: &impl HasDataLayout, + ptr: Pointer, + size: Size, + ) -> EvalResult<'tcx> { + self.check_relocations(cx, ptr, Size::ZERO)?; + self.check_relocations(cx, ptr.offset(size, cx)?, Size::ZERO)?; + Ok(()) + } +} + + +/// Undefined bytes +impl<'tcx, Tag, Extra> Allocation { + /// Checks that a range of bytes is defined. If not, returns the `ReadUndefBytes` + /// error which will report the first byte which is undefined. + #[inline] + fn check_defined(&self, ptr: Pointer, size: Size) -> EvalResult<'tcx> { + self.undef_mask.is_range_defined( + ptr.offset, + ptr.offset + size, + ).or_else(|idx| err!(ReadUndefBytes(idx))) + } + + pub fn mark_definedness( + &mut self, + ptr: Pointer, + size: Size, + new_state: bool, + ) -> EvalResult<'tcx> { + if size.bytes() == 0 { + return Ok(()); + } + self.undef_mask.set_range( + ptr.offset, + ptr.offset + size, + new_state, + ); + Ok(()) + } +} + +/// Relocations #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct Relocations(SortedMap); diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index f1ac4b21058..c3fe5d773ab 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::{fmt, env}; use hir::map::definitions::DefPathData; @@ -47,7 +37,7 @@ impl ErrorHandled { } pub type ConstEvalRawResult<'tcx> = Result, ErrorHandled>; -pub type ConstEvalResult<'tcx> = Result<&'tcx ty::Const<'tcx>, ErrorHandled>; +pub type ConstEvalResult<'tcx> = Result, ErrorHandled>; #[derive(Clone, Debug, RustcEncodable, RustcDecodable)] pub struct ConstEvalErr<'tcx> { @@ -183,50 +173,14 @@ pub struct EvalError<'tcx> { impl<'tcx> EvalError<'tcx> { pub fn print_backtrace(&mut self) { if let Some(ref mut backtrace) = self.backtrace { - eprintln!("{}", print_backtrace(&mut *backtrace)); + print_backtrace(&mut *backtrace); } } } -fn print_backtrace(backtrace: &mut Backtrace) -> String { - use std::fmt::Write; - +fn print_backtrace(backtrace: &mut Backtrace) { backtrace.resolve(); - - let mut trace_text = "\n\nAn error occurred in miri:\n".to_string(); - write!(trace_text, "backtrace frames: {}\n", backtrace.frames().len()).unwrap(); - 'frames: for (i, frame) in backtrace.frames().iter().enumerate() { - if frame.symbols().is_empty() { - write!(trace_text, " {}: no symbols\n", i).unwrap(); - } - let mut first = true; - for symbol in frame.symbols() { - if first { - write!(trace_text, " {}: ", i).unwrap(); - first = false; - } else { - let len = i.to_string().len(); - write!(trace_text, " {} ", " ".repeat(len)).unwrap(); - } - if let Some(name) = symbol.name() { - write!(trace_text, "{}\n", name).unwrap(); - } else { - write!(trace_text, "\n").unwrap(); - } - write!(trace_text, " at ").unwrap(); - if let Some(file_path) = symbol.filename() { - write!(trace_text, "{}", file_path.display()).unwrap(); - } else { - write!(trace_text, "").unwrap(); - } - if let Some(line) = symbol.lineno() { - write!(trace_text, ":{}\n", line).unwrap(); - } else { - write!(trace_text, "\n").unwrap(); - } - } - } - trace_text + eprintln!("\n\nAn error occurred in miri:\n{:?}", backtrace); } impl<'tcx> From> for EvalError<'tcx> { @@ -238,7 +192,7 @@ impl<'tcx> From> for EvalError<'tcx> { if val == "immediate" { // Print it now - eprintln!("{}", print_backtrace(&mut backtrace)); + print_backtrace(&mut backtrace); None } else { Some(Box::new(backtrace)) @@ -308,6 +262,7 @@ pub enum EvalErrorKind<'tcx, O> { CalledClosureAsFunction, VtableForArgumentlessMethod, ModifiedConstantMemory, + ModifiedStatic, AssumptionNotHeld, InlineAsm, TypeNotPrimitive(Ty<'tcx>), @@ -377,7 +332,7 @@ impl<'tcx, O> EvalErrorKind<'tcx, O> { "tried to read from foreign (extern) static", InvalidPointerMath => "attempted to do invalid arithmetic on pointers that would leak base addresses, \ - e.g. comparing pointers into different allocations", + e.g., comparing pointers into different allocations", ReadUndefBytes(_) => "attempted to read undefined bytes", DeadLocal => @@ -412,6 +367,8 @@ impl<'tcx, O> EvalErrorKind<'tcx, O> { "tried to call a vtable function without arguments", ModifiedConstantMemory => "tried to modify constant memory", + ModifiedStatic => + "tried to modify a static's initial value from another static's initializer", AssumptionNotHeld => "`assume` argument was false", InlineAsm => @@ -527,7 +484,7 @@ impl<'tcx, O: fmt::Debug> fmt::Debug for EvalErrorKind<'tcx, O> { write!(f, "tried to interpret an invalid 32-bit value as a char: {}", c), AlignmentCheckFailed { required, has } => write!(f, "tried to access memory with alignment {}, but alignment {} is required", - has.abi(), required.abi()), + has.bytes(), required.bytes()), TypeNotPrimitive(ty) => write!(f, "expected primitive type, got {}", ty), Layout(ref err) => @@ -537,8 +494,9 @@ impl<'tcx, O: fmt::Debug> fmt::Debug for EvalErrorKind<'tcx, O> { MachineError(ref inner) => write!(f, "{}", inner), IncorrectAllocationInformation(size, size2, align, align2) => - write!(f, "incorrect alloc info: expected size {} and align {}, got size {} and \ - align {}", size.bytes(), align.abi(), size2.bytes(), align2.abi()), + write!(f, "incorrect alloc info: expected size {} and align {}, \ + got size {} and align {}", + size.bytes(), align.bytes(), size2.bytes(), align2.bytes()), Panic { ref msg, line, col, ref file } => write!(f, "the evaluated program panicked at '{}', {}:{}:{}", msg, file, line, col), InvalidDiscriminant(val) => diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 9369b6e56f1..e6a560b2ad7 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! An interpreter for MIR used in CTFE and by miri #[macro_export] @@ -39,9 +29,7 @@ use mir; use hir::def_id::DefId; use ty::{self, TyCtxt, Instance}; use ty::layout::{self, Size}; -use middle::region; use std::io; -use std::hash::Hash; use rustc_serialize::{Encoder, Decodable, Encodable}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::{Lock as Mutex, HashMapExt}; @@ -51,27 +39,6 @@ use ty::codec::TyDecoder; use std::sync::atomic::{AtomicU32, Ordering}; use std::num::NonZeroU32; -#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] -pub enum Lock { - NoLock, - WriteLock(DynamicLifetime), - /// This should never be empty -- that would be a read lock held and nobody - /// there to release it... - ReadLock(Vec), -} - -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] -pub struct DynamicLifetime { - pub frame: usize, - pub region: Option, // "None" indicates "until the function ends" -} - -#[derive(Copy, Clone, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)] -pub enum AccessKind { - Read, - Write, -} - /// Uniquely identifies a specific constant or static. #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, RustcEncodable, RustcDecodable)] pub struct GlobalId<'tcx> { @@ -90,7 +57,7 @@ impl ::rustc_serialize::UseSpecializedEncodable for AllocId {} impl ::rustc_serialize::UseSpecializedDecodable for AllocId {} #[derive(RustcDecodable, RustcEncodable)] -enum AllocKind { +enum AllocDiscriminant { Alloc, Fn, Static, @@ -104,23 +71,23 @@ pub fn specialized_encode_alloc_id< tcx: TyCtxt<'a, 'tcx, 'tcx>, alloc_id: AllocId, ) -> Result<(), E::Error> { - let alloc_type: AllocType<'tcx, &'tcx Allocation> = + let alloc_kind: AllocKind<'tcx> = tcx.alloc_map.lock().get(alloc_id).expect("no value for AllocId"); - match alloc_type { - AllocType::Memory(alloc) => { + match alloc_kind { + AllocKind::Memory(alloc) => { trace!("encoding {:?} with {:#?}", alloc_id, alloc); - AllocKind::Alloc.encode(encoder)?; + AllocDiscriminant::Alloc.encode(encoder)?; alloc.encode(encoder)?; } - AllocType::Function(fn_instance) => { + AllocKind::Function(fn_instance) => { trace!("encoding {:?} with {:#?}", alloc_id, fn_instance); - AllocKind::Fn.encode(encoder)?; + AllocDiscriminant::Fn.encode(encoder)?; fn_instance.encode(encoder)?; } - AllocType::Static(did) => { + AllocKind::Static(did) => { // referring to statics doesn't need to know about their allocations, // just about its DefId - AllocKind::Static.encode(encoder)?; + AllocDiscriminant::Static.encode(encoder)?; did.encode(encoder)?; } } @@ -189,10 +156,10 @@ impl<'s> AllocDecodingSession<'s> { let idx = decoder.read_u32()? as usize; let pos = self.state.data_offsets[idx] as usize; - // Decode the AllocKind now so that we know if we have to reserve an + // Decode the AllocDiscriminant now so that we know if we have to reserve an // AllocId. let (alloc_kind, pos) = decoder.with_position(pos, |decoder| { - let alloc_kind = AllocKind::decode(decoder)?; + let alloc_kind = AllocDiscriminant::decode(decoder)?; Ok((alloc_kind, decoder.position())) })?; @@ -208,7 +175,7 @@ impl<'s> AllocDecodingSession<'s> { ref mut entry @ State::Empty => { // We are allowed to decode match alloc_kind { - AllocKind::Alloc => { + AllocDiscriminant::Alloc => { // If this is an allocation, we need to reserve an // AllocId so we can decode cyclic graphs. let alloc_id = decoder.tcx().alloc_map.lock().reserve(); @@ -217,7 +184,7 @@ impl<'s> AllocDecodingSession<'s> { alloc_id); Some(alloc_id) }, - AllocKind::Fn | AllocKind::Static => { + AllocDiscriminant::Fn | AllocDiscriminant::Static => { // Fns and statics cannot be cyclic and their AllocId // is determined later by interning *entry = State::InProgressNonAlloc( @@ -251,15 +218,15 @@ impl<'s> AllocDecodingSession<'s> { // Now decode the actual data let alloc_id = decoder.with_position(pos, |decoder| { match alloc_kind { - AllocKind::Alloc => { + AllocDiscriminant::Alloc => { let allocation = <&'tcx Allocation as Decodable>::decode(decoder)?; // We already have a reserved AllocId. let alloc_id = alloc_id.unwrap(); trace!("decoded alloc {:?} {:#?}", alloc_id, allocation); - decoder.tcx().alloc_map.lock().set_id_same_memory(alloc_id, allocation); + decoder.tcx().alloc_map.lock().set_alloc_id_same_memory(alloc_id, allocation); Ok(alloc_id) }, - AllocKind::Fn => { + AllocDiscriminant::Fn => { assert!(alloc_id.is_none()); trace!("creating fn alloc id"); let instance = ty::Instance::decode(decoder)?; @@ -267,7 +234,7 @@ impl<'s> AllocDecodingSession<'s> { let alloc_id = decoder.tcx().alloc_map.lock().create_fn_alloc(instance); Ok(alloc_id) }, - AllocKind::Static => { + AllocDiscriminant::Static => { assert!(alloc_id.is_none()); trace!("creating extern static alloc id at"); let did = DefId::decode(decoder)?; @@ -292,39 +259,42 @@ impl fmt::Display for AllocId { } #[derive(Debug, Clone, Eq, PartialEq, Hash, RustcDecodable, RustcEncodable)] -pub enum AllocType<'tcx, M> { +pub enum AllocKind<'tcx> { /// The alloc id is used as a function pointer Function(Instance<'tcx>), /// The alloc id points to a "lazy" static variable that did not get computed (yet). /// This is also used to break the cycle in recursive statics. Static(DefId), /// The alloc id points to memory - Memory(M) + Memory(&'tcx Allocation), } -pub struct AllocMap<'tcx, M> { +pub struct AllocMap<'tcx> { /// Lets you know what an AllocId refers to - id_to_type: FxHashMap>, + id_to_kind: FxHashMap>, - /// Used to ensure that functions and statics only get one associated AllocId - type_interner: FxHashMap, AllocId>, + /// Used to ensure that statics only get one associated AllocId + type_interner: FxHashMap, AllocId>, /// The AllocId to assign to the next requested id. /// Always incremented, never gets smaller. next_id: AllocId, } -impl<'tcx, M: fmt::Debug + Eq + Hash + Clone> AllocMap<'tcx, M> { +impl<'tcx> AllocMap<'tcx> { pub fn new() -> Self { AllocMap { - id_to_type: Default::default(), + id_to_kind: Default::default(), type_interner: Default::default(), next_id: AllocId(0), } } - /// obtains a new allocation ID that can be referenced but does not + /// Obtains a new allocation ID that can be referenced but does not /// yet have an allocation backing it. + /// + /// Make sure to call `set_alloc_id_memory` or `set_alloc_id_same_memory` before returning such + /// an `AllocId` from a query. pub fn reserve( &mut self, ) -> AllocId { @@ -337,53 +307,73 @@ impl<'tcx, M: fmt::Debug + Eq + Hash + Clone> AllocMap<'tcx, M> { next } - fn intern(&mut self, alloc_type: AllocType<'tcx, M>) -> AllocId { - if let Some(&alloc_id) = self.type_interner.get(&alloc_type) { + fn intern(&mut self, alloc_kind: AllocKind<'tcx>) -> AllocId { + if let Some(&alloc_id) = self.type_interner.get(&alloc_kind) { return alloc_id; } let id = self.reserve(); - debug!("creating alloc_type {:?} with id {}", alloc_type, id); - self.id_to_type.insert(id, alloc_type.clone()); - self.type_interner.insert(alloc_type, id); + debug!("creating alloc_kind {:?} with id {}", alloc_kind, id); + self.id_to_kind.insert(id, alloc_kind.clone()); + self.type_interner.insert(alloc_kind, id); id } - // FIXME: Check if functions have identity. If not, we should not intern these, - // but instead create a new id per use. - // Alternatively we could just make comparing function pointers an error. + /// Functions cannot be identified by pointers, as asm-equal functions can get deduplicated + /// by the linker and functions can be duplicated across crates. + /// We thus generate a new `AllocId` for every mention of a function. This means that + /// `main as fn() == main as fn()` is false, while `let x = main as fn(); x == x` is true. pub fn create_fn_alloc(&mut self, instance: Instance<'tcx>) -> AllocId { - self.intern(AllocType::Function(instance)) + let id = self.reserve(); + self.id_to_kind.insert(id, AllocKind::Function(instance)); + id } - pub fn get(&self, id: AllocId) -> Option> { - self.id_to_type.get(&id).cloned() + /// Returns `None` in case the `AllocId` is dangling. An `EvalContext` can still have a + /// local `Allocation` for that `AllocId`, but having such an `AllocId` in a constant is + /// illegal and will likely ICE. + /// This function exists to allow const eval to detect the difference between evaluation- + /// local dangling pointers and allocations in constants/statics. + pub fn get(&self, id: AllocId) -> Option> { + self.id_to_kind.get(&id).cloned() } - pub fn unwrap_memory(&self, id: AllocId) -> M { + /// Panics if the `AllocId` does not refer to an `Allocation` + pub fn unwrap_memory(&self, id: AllocId) -> &'tcx Allocation { match self.get(id) { - Some(AllocType::Memory(mem)) => mem, + Some(AllocKind::Memory(mem)) => mem, _ => bug!("expected allocation id {} to point to memory", id), } } + /// Generate an `AllocId` for a static or return a cached one in case this function has been + /// called on the same static before. pub fn intern_static(&mut self, static_id: DefId) -> AllocId { - self.intern(AllocType::Static(static_id)) + self.intern(AllocKind::Static(static_id)) } - pub fn allocate(&mut self, mem: M) -> AllocId { + /// Intern the `Allocation` and return a new `AllocId`, even if there's already an identical + /// `Allocation` with a different `AllocId`. + // FIXME: is this really necessary? Can we ensure `FOO` and `BAR` being different after codegen + // in `static FOO: u32 = 42; static BAR: u32 = 42;` even if they reuse the same allocation + // inside rustc? + pub fn allocate(&mut self, mem: &'tcx Allocation) -> AllocId { let id = self.reserve(); - self.set_id_memory(id, mem); + self.set_alloc_id_memory(id, mem); id } - pub fn set_id_memory(&mut self, id: AllocId, mem: M) { - if let Some(old) = self.id_to_type.insert(id, AllocType::Memory(mem)) { + /// Freeze an `AllocId` created with `reserve` by pointing it at an `Allocation`. Trying to + /// call this function twice, even with the same `Allocation` will ICE the compiler. + pub fn set_alloc_id_memory(&mut self, id: AllocId, mem: &'tcx Allocation) { + if let Some(old) = self.id_to_kind.insert(id, AllocKind::Memory(mem)) { bug!("tried to set allocation id {}, but it was already existing as {:#?}", id, old); } } - pub fn set_id_same_memory(&mut self, id: AllocId, mem: M) { - self.id_to_type.insert_same(id, AllocType::Memory(mem)); + /// Freeze an `AllocId` created with `reserve` by pointing it at an `Allocation`. May be called + /// twice for the same `(AllocId, Allocation)` pair. + fn set_alloc_id_same_memory(&mut self, id: AllocId, mem: &'tcx Allocation) { + self.id_to_kind.insert_same(id, AllocKind::Memory(mem)); } } diff --git a/src/librustc/mir/interpret/pointer.rs b/src/librustc/mir/interpret/pointer.rs index 969f2c0e837..498c0b5b917 100644 --- a/src/librustc/mir/interpret/pointer.rs +++ b/src/librustc/mir/interpret/pointer.rs @@ -2,7 +2,7 @@ use mir; use ty::layout::{self, HasDataLayout, Size}; use super::{ - AllocId, EvalResult, + AllocId, EvalResult, InboundsCheck, }; //////////////////////////////////////////////////////////////////////////////// @@ -76,6 +76,8 @@ pub struct Pointer { pub tag: Tag, } +static_assert!(POINTER_SIZE: ::std::mem::size_of::() == 16); + /// Produces a `Pointer` which points to the beginning of the Allocation impl From for Pointer { #[inline(always)] @@ -148,4 +150,21 @@ impl<'tcx, Tag> Pointer { pub fn erase_tag(self) -> Pointer { Pointer { alloc_id: self.alloc_id, offset: self.offset, tag: () } } + + #[inline(always)] + pub fn check_in_alloc( + self, + allocation_size: Size, + check: InboundsCheck, + ) -> EvalResult<'tcx, ()> { + if self.offset > allocation_size { + err!(PointerOutOfBounds { + ptr: self.erase_tag(), + check, + allocation_size, + }) + } else { + Ok(()) + } + } } diff --git a/src/librustc/mir/interpret/value.rs b/src/librustc/mir/interpret/value.rs index 4bcba9d5467..1328a1aeeab 100644 --- a/src/librustc/mir/interpret/value.rs +++ b/src/librustc/mir/interpret/value.rs @@ -1,61 +1,49 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; -use crate::ty::{Ty, subst::Substs, layout::{HasDataLayout, Size}}; -use crate::hir::def_id::DefId; +use crate::ty::{Ty, layout::{HasDataLayout, Size}}; use super::{EvalResult, Pointer, PointerArithmetic, Allocation, AllocId, sign_extend, truncate}; /// Represents the result of a raw const operation, pre-validation. #[derive(Copy, Clone, Debug, Eq, PartialEq, RustcEncodable, RustcDecodable, Hash)] pub struct RawConst<'tcx> { - // the value lives here, at offset 0, and that allocation definitely is a `AllocType::Memory` + // the value lives here, at offset 0, and that allocation definitely is a `AllocKind::Memory` // (so you can use `AllocMap::unwrap_memory`). pub alloc_id: AllocId, pub ty: Ty<'tcx>, } /// Represents a constant value in Rust. Scalar and ScalarPair are optimizations which -/// matches the LocalValue optimizations for easy conversions between Value and ConstValue. +/// matches the LocalState optimizations for easy conversions between Value and ConstValue. #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash)] pub enum ConstValue<'tcx> { - /// Never returned from the `const_eval` query, but the HIR contains these frequently in order - /// to allow HIR creation to happen for everything before needing to be able to run constant - /// evaluation - /// FIXME: The query should then return a type that does not even have this variant. - Unevaluated(DefId, &'tcx Substs<'tcx>), - /// Used only for types with layout::abi::Scalar ABI and ZSTs /// /// Not using the enum `Value` to encode that this must not be `Undef` Scalar(Scalar), - /// Used only for *fat pointers* with layout::abi::ScalarPair + /// Used only for slices and strings (`&[T]`, `&str`, `*const [T]`, `*mut str`, `Box`, ...) /// - /// Needed for pattern matching code related to slices and strings. - ScalarPair(Scalar, Scalar), + /// Empty slices don't necessarily have an address backed by an `AllocId`, thus we also need to + /// enable integer pointers. The `Scalar` type covers exactly those two cases. While we could + /// create dummy-`AllocId`s, the additional code effort for the conversions doesn't seem worth + /// it. + Slice(Scalar, u64), /// An allocation + offset into the allocation. /// Invariant: The AllocId matches the allocation. ByRef(AllocId, &'tcx Allocation, Size), } +#[cfg(target_arch = "x86_64")] +static_assert!(CONST_SIZE: ::std::mem::size_of::>() == 40); + impl<'tcx> ConstValue<'tcx> { #[inline] pub fn try_to_scalar(&self) -> Option { match *self { - ConstValue::Unevaluated(..) | ConstValue::ByRef(..) | - ConstValue::ScalarPair(..) => None, + ConstValue::Slice(..) => None, ConstValue::Scalar(val) => Some(val), } } @@ -74,17 +62,8 @@ impl<'tcx> ConstValue<'tcx> { pub fn new_slice( val: Scalar, len: u64, - cx: &impl HasDataLayout ) -> Self { - ConstValue::ScalarPair(val, Scalar::Bits { - bits: len as u128, - size: cx.data_layout().pointer_size.bytes() as u8, - }) - } - - #[inline] - pub fn new_dyn_trait(val: Scalar, vtable: Pointer) -> Self { - ConstValue::ScalarPair(val, Scalar::Ptr(vtable)) + ConstValue::Slice(val, len) } } @@ -97,7 +76,7 @@ pub enum Scalar { /// The raw bytes of a simple value. Bits { /// The first `size` bytes are the value. - /// Do not try to read less or more bytes that that. The remaining bytes must be 0. + /// Do not try to read less or more bytes than that. The remaining bytes must be 0. size: u8, bits: u128, }, @@ -108,6 +87,9 @@ pub enum Scalar { Ptr(Pointer), } +#[cfg(target_arch = "x86_64")] +static_assert!(SCALAR_SIZE: ::std::mem::size_of::() == 24); + impl fmt::Display for Scalar { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { @@ -138,6 +120,14 @@ impl<'tcx, Tag> Scalar { } } + #[inline] + pub fn with_tag(self, new_tag: Tag) -> Self { + match self { + Scalar::Ptr(ptr) => Scalar::Ptr(Pointer { tag: new_tag, ..ptr }), + Scalar::Bits { bits, size } => Scalar::Bits { bits, size }, + } + } + #[inline] pub fn ptr_null(cx: &impl HasDataLayout) -> Self { Scalar::Bits { diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index d8e45c881f5..82083b4f699 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1,21 +1,10 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! MIR datatypes and passes. See the [rustc guide] for more info. //! -//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/index.html +//! [rustc guide]: https://rust-lang.github.io/rustc-guide/mir/index.html use hir::def::CtorKind; use hir::def_id::DefId; use hir::{self, HirId, InlineAsm}; -use middle::region; use mir::interpret::{ConstValue, EvalErrorKind, Scalar}; use mir::visit::MirVisitable; use rustc_apfloat::ieee::{Double, Single}; @@ -26,7 +15,7 @@ use rustc_data_structures::graph::{self, GraphPredecessors, GraphSuccessors}; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; use rustc_data_structures::sync::Lrc; use rustc_data_structures::sync::MappedReadGuard; -use rustc_serialize as serialize; +use rustc_serialize::{self as serialize}; use smallvec::SmallVec; use std::borrow::Cow; use std::fmt::{self, Debug, Formatter, Write}; @@ -38,9 +27,12 @@ use syntax::ast::{self, Name}; use syntax::symbol::InternedString; use syntax_pos::{Span, DUMMY_SP}; use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; -use ty::subst::{CanonicalUserSubsts, Subst, Substs}; -use ty::{self, AdtDef, CanonicalTy, ClosureSubsts, GeneratorSubsts, Region, Ty, TyCtxt}; +use ty::subst::{Subst, Substs}; use ty::layout::VariantIdx; +use ty::{ + self, AdtDef, CanonicalUserTypeAnnotations, ClosureSubsts, GeneratorSubsts, Region, Ty, TyCtxt, + UserTypeAnnotationIndex, +}; use util::ppaux; pub use mir::interpret::AssertMessage; @@ -132,6 +124,9 @@ pub struct Mir<'tcx> { /// variables and temporaries. pub local_decls: LocalDecls<'tcx>, + /// User type annotations + pub user_type_annotations: CanonicalUserTypeAnnotations<'tcx>, + /// Number of arguments this function takes. /// /// Starting at local 1, `arg_count` locals will be provided by the caller @@ -150,6 +145,14 @@ pub struct Mir<'tcx> { /// This is used for the "rust-call" ABI. pub spread_arg: Option, + /// Mark this MIR of a const context other than const functions as having converted a `&&` or + /// `||` expression into `&` or `|` respectively. This is problematic because if we ever stop + /// this conversion from happening and use short circuiting, we will cause the following code + /// to change the value of `x`: `let mut x = 42; false && { x = 55; true };` + /// + /// List of places where control flow was destroyed. Used for error reporting. + pub control_flow_destroyed: Vec<(Span, String)>, + /// A span representing this MIR, for error reporting pub span: Span, @@ -164,10 +167,12 @@ impl<'tcx> Mir<'tcx> { source_scope_local_data: ClearCrossCrate>, promoted: IndexVec>, yield_ty: Option>, - local_decls: IndexVec>, + local_decls: LocalDecls<'tcx>, + user_type_annotations: CanonicalUserTypeAnnotations<'tcx>, arg_count: usize, upvar_decls: Vec, span: Span, + control_flow_destroyed: Vec<(Span, String)>, ) -> Self { // We need `arg_count` locals, and one for the return place assert!( @@ -187,11 +192,13 @@ impl<'tcx> Mir<'tcx> { generator_drop: None, generator_layout: None, local_decls, + user_type_annotations, arg_count, upvar_decls, spread_arg: None, span, cache: cache::Cache::new(), + control_flow_destroyed, } } @@ -340,7 +347,7 @@ impl<'tcx> Mir<'tcx> { #[inline] pub fn args_iter(&self) -> impl Iterator { let arg_count = self.arg_count; - (1..arg_count + 1).map(Local::new) + (1..=arg_count).map(Local::new) } /// Returns an iterator over all user-defined variables and compiler-generated temporaries (all @@ -419,9 +426,11 @@ impl_stable_hash_for!(struct Mir<'tcx> { generator_drop, generator_layout, local_decls, + user_type_annotations, arg_count, upvar_decls, spread_arg, + control_flow_destroyed, span, cache }); @@ -557,7 +566,7 @@ pub enum BorrowKind { /// Data is mutable and not aliasable. Mut { /// True if this borrow arose from method-call auto-ref - /// (i.e. `adjustment::Adjust::Borrow`) + /// (i.e., `adjustment::Adjust::Borrow`) allow_two_phase_borrow: bool, }, } @@ -693,7 +702,7 @@ mod binding_form_impl { /// expression; that is, a block like `{ STMT_1; STMT_2; EXPR }`. /// /// It is used to improve diagnostics when such temporaries are -/// involved in borrow_check errors, e.g. explanations of where the +/// involved in borrow_check errors, e.g., explanations of where the /// temporaries come from, when their destructors are run, and/or how /// one might revise the code to satisfy the borrow checker's rules. #[derive(Clone, Debug, RustcEncodable, RustcDecodable)] @@ -702,7 +711,7 @@ pub struct BlockTailInfo { /// expression is ignored by the block's expression context. /// /// Examples include `{ ...; tail };` and `let _ = { ...; tail };` - /// but not e.g. `let _x = { ...; tail };` + /// but not e.g., `let _x = { ...; tail };` pub tail_result_is_ignored: bool, } @@ -757,7 +766,7 @@ pub struct LocalDecl<'tcx> { pub ty: Ty<'tcx>, /// If the user manually ascribed a type to this variable, - /// e.g. via `let x: T`, then we carry that type here. The MIR + /// e.g., via `let x: T`, then we carry that type here. The MIR /// borrow checker needs this information since it can affect /// region inference. pub user_ty: UserTypeProjections<'tcx>, @@ -768,7 +777,7 @@ pub struct LocalDecl<'tcx> { /// to generate better debuginfo. pub name: Option, - /// The *syntactic* (i.e. not visibility) source scope the local is defined + /// The *syntactic* (i.e., not visibility) source scope the local is defined /// in. If the local was defined in a let-statement, this /// is *within* the let-statement, rather than outside /// of it. @@ -1657,7 +1666,7 @@ impl<'tcx> TerminatorKind<'tcx> { ), ty: switch_ty, }; - fmt_const_val(&mut s, &c).unwrap(); + fmt_const_val(&mut s, c).unwrap(); s.into() }).chain(iter::once("otherwise".into())) .collect() @@ -1746,9 +1755,12 @@ pub enum StatementKind<'tcx> { Assign(Place<'tcx>, Box>), /// This represents all the reading that a pattern match may do - /// (e.g. inspecting constants and discriminant values), and the + /// (e.g., inspecting constants and discriminant values), and the /// kind of pattern it comes from. This is in order to adapt potential /// error messages to these specific patterns. + /// + /// Note that this also is emitted for regular `let` bindings to ensure that locals that are + /// never accessed still get some sanity checks for e.g. `let x: ! = ..;` FakeRead(FakeReadCause, Place<'tcx>), /// Write the discriminant for a variant to the enum Place. @@ -1775,23 +1787,7 @@ pub enum StatementKind<'tcx> { /// by miri and only generated when "-Z mir-emit-retag" is passed. /// See /// for more details. - Retag { - /// `fn_entry` indicates whether this is the initial retag that happens in the - /// function prolog. - fn_entry: bool, - place: Place<'tcx>, - }, - - /// Escape the given reference to a raw pointer, so that it can be accessed - /// without precise provenance tracking. These statements are currently only interpreted - /// by miri and only generated when "-Z mir-emit-retag" is passed. - /// See - /// for more details. - EscapeToRaw(Operand<'tcx>), - - /// Mark one terminating point of a region scope (i.e. static region). - /// (The starting point(s) arise implicitly from borrows.) - EndRegion(region::Scope), + Retag(RetagKind, Place<'tcx>), /// Encodes a user's type ascription. These need to be preserved /// intact so that NLL can respect them. For example: @@ -1811,6 +1807,19 @@ pub enum StatementKind<'tcx> { Nop, } +/// `RetagKind` describes what kind of retag is to be performed. +#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, PartialEq, Eq)] +pub enum RetagKind { + /// The initial retag when entering a function + FnEntry, + /// Retag preparing for a two-phase borrow + TwoPhase, + /// Retagging raw pointers + Raw, + /// A "normal" retag + Default, +} + /// The `FakeReadCause` describes the type of pattern why a `FakeRead` statement exists. #[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)] pub enum FakeReadCause { @@ -1846,11 +1855,16 @@ impl<'tcx> Debug for Statement<'tcx> { match self.kind { Assign(ref place, ref rv) => write!(fmt, "{:?} = {:?}", place, rv), FakeRead(ref cause, ref place) => write!(fmt, "FakeRead({:?}, {:?})", cause, place), - // (reuse lifetime rendering policy from ppaux.) - EndRegion(ref ce) => write!(fmt, "EndRegion({})", ty::ReScope(*ce)), - Retag { fn_entry, ref place } => - write!(fmt, "Retag({}{:?})", if fn_entry { "[fn entry] " } else { "" }, place), - EscapeToRaw(ref place) => write!(fmt, "EscapeToRaw({:?})", place), + Retag(ref kind, ref place) => + write!(fmt, "Retag({}{:?})", + match kind { + RetagKind::FnEntry => "[fn entry] ", + RetagKind::TwoPhase => "[2phase] ", + RetagKind::Raw => "[raw] ", + RetagKind::Default => "", + }, + place, + ), StorageLive(ref place) => write!(fmt, "StorageLive({:?})", place), StorageDead(ref place) => write!(fmt, "StorageDead({:?})", place), SetDiscriminant { @@ -2035,7 +2049,7 @@ impl<'tcx> Debug for Place<'tcx> { Promoted(ref promoted) => write!(fmt, "({:?}: {:?})", promoted.0, promoted.1), Projection(ref data) => match data.elem { ProjectionElem::Downcast(ref adt_def, index) => { - write!(fmt, "({:?} as {})", data.base, adt_def.variants[index].name) + write!(fmt, "({:?} as {})", data.base, adt_def.variants[index].ident) } ProjectionElem::Deref => write!(fmt, "(*{:?})", data.base), ProjectionElem::Field(field, ty) => { @@ -2140,7 +2154,9 @@ impl<'tcx> Operand<'tcx> { span, ty, user_ty: None, - literal: ty::Const::zero_sized(tcx, ty), + literal: tcx.intern_lazy_const( + ty::LazyConst::Evaluated(ty::Const::zero_sized(ty)), + ), }) } @@ -2179,7 +2195,7 @@ pub enum Rvalue<'tcx> { /// Read the discriminant of an ADT. /// - /// Undefined (i.e. no effort is made to make it defined, but there’s no reason why it cannot + /// Undefined (i.e., no effort is made to make it defined, but there’s no reason why it cannot /// be defined to return, say, a 0) if ADT is not an enum. Discriminant(Place<'tcx>), @@ -2207,7 +2223,7 @@ pub enum CastKind { /// "Unsize" -- convert a thin-or-fat pointer to a fat pointer. /// codegen must figure out the details once full monomorphization /// is known. For example, this could be used to cast from a - /// `&[i32;N]` to a `&[i32]`, or a `Box` to a `Box` + /// `&[i32;N]` to a `&[i32]`, or a `Box` to a `Box` /// (presuming `T: Trait`). Unsize, } @@ -2221,13 +2237,13 @@ pub enum AggregateKind<'tcx> { /// The second field is the variant index. It's equal to 0 for struct /// and union expressions. The fourth field is /// active field number and is present only for union expressions - /// -- e.g. for a union expression `SomeUnion { c: .. }`, the + /// -- e.g., for a union expression `SomeUnion { c: .. }`, the /// active field index would identity the field `c` Adt( &'tcx AdtDef, VariantIdx, &'tcx Substs<'tcx>, - Option>, + Option, Option, ), @@ -2375,17 +2391,17 @@ impl<'tcx> Debug for Rvalue<'tcx> { } AggregateKind::Closure(def_id, _) => ty::tls::with(|tcx| { - if let Some(node_id) = tcx.hir.as_local_node_id(def_id) { + if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { let name = if tcx.sess.opts.debugging_opts.span_free_formats { format!("[closure@{:?}]", node_id) } else { - format!("[closure@{:?}]", tcx.hir.span(node_id)) + format!("[closure@{:?}]", tcx.hir().span(node_id)) }; let mut struct_fmt = fmt.debug_struct(&name); tcx.with_freevars(node_id, |freevars| { for (freevar, place) in freevars.iter().zip(places) { - let var_name = tcx.hir.name(freevar.var_id()); + let var_name = tcx.hir().name(freevar.var_id()); struct_fmt.field(&var_name.as_str(), place); } }); @@ -2397,13 +2413,13 @@ impl<'tcx> Debug for Rvalue<'tcx> { }), AggregateKind::Generator(def_id, _, _) => ty::tls::with(|tcx| { - if let Some(node_id) = tcx.hir.as_local_node_id(def_id) { - let name = format!("[generator@{:?}]", tcx.hir.span(node_id)); + if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { + let name = format!("[generator@{:?}]", tcx.hir().span(node_id)); let mut struct_fmt = fmt.debug_struct(&name); tcx.with_freevars(node_id, |freevars| { for (freevar, place) in freevars.iter().zip(places) { - let var_name = tcx.hir.name(freevar.var_id()); + let var_name = tcx.hir().name(freevar.var_id()); struct_fmt.field(&var_name.as_str(), place); } struct_fmt.field("$state", &places[freevars.len()]); @@ -2441,36 +2457,9 @@ pub struct Constant<'tcx> { /// indicate that `Vec<_>` was explicitly specified. /// /// Needed for NLL to impose user-given type constraints. - pub user_ty: Option>, - - pub literal: &'tcx ty::Const<'tcx>, -} - -/// A user-given type annotation attached to a constant. These arise -/// from constants that are named via paths, like `Foo::::new` and -/// so forth. -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] -pub enum UserTypeAnnotation<'tcx> { - Ty(CanonicalTy<'tcx>), - - /// The canonical type is the result of `type_of(def_id)` with the - /// given substitutions applied. - TypeOf(DefId, CanonicalUserSubsts<'tcx>), -} - -EnumTypeFoldableImpl! { - impl<'tcx> TypeFoldable<'tcx> for UserTypeAnnotation<'tcx> { - (UserTypeAnnotation::Ty)(ty), - (UserTypeAnnotation::TypeOf)(def, substs), - } -} + pub user_ty: Option, -EnumLiftImpl! { - impl<'a, 'tcx> Lift<'tcx> for UserTypeAnnotation<'a> { - type Lifted = UserTypeAnnotation<'tcx>; - (UserTypeAnnotation::Ty)(ty), - (UserTypeAnnotation::TypeOf)(def, substs), - } + pub literal: &'tcx ty::LazyConst<'tcx>, } /// A collection of projections into user types. @@ -2532,6 +2521,48 @@ impl<'tcx> UserTypeProjections<'tcx> { pub fn projections(&self) -> impl Iterator> { self.contents.iter().map(|&(ref user_type, _span)| user_type) } + + pub fn push_projection( + mut self, + user_ty: &UserTypeProjection<'tcx>, + span: Span, + ) -> Self { + self.contents.push((user_ty.clone(), span)); + self + } + + fn map_projections( + mut self, + mut f: impl FnMut(UserTypeProjection<'tcx>) -> UserTypeProjection<'tcx> + ) -> Self { + self.contents = self.contents.drain(..).map(|(proj, span)| (f(proj), span)).collect(); + self + } + + pub fn index(self) -> Self { + self.map_projections(|pat_ty_proj| pat_ty_proj.index()) + } + + pub fn subslice(self, from: u32, to: u32) -> Self { + self.map_projections(|pat_ty_proj| pat_ty_proj.subslice(from, to)) + } + + pub fn deref(self) -> Self { + self.map_projections(|pat_ty_proj| pat_ty_proj.deref()) + } + + pub fn leaf(self, field: Field) -> Self { + self.map_projections(|pat_ty_proj| pat_ty_proj.leaf(field)) + } + + pub fn variant( + self, + adt_def: &'tcx AdtDef, + variant_index: VariantIdx, + field: Field, + ) -> Self { + self.map_projections(|pat_ty_proj| pat_ty_proj.variant(adt_def, variant_index, field)) + } } /// Encodes the effect of a user-supplied type annotation on the @@ -2551,12 +2582,45 @@ impl<'tcx> UserTypeProjections<'tcx> { /// determined by finding the type of the `.0` field from `T`. #[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] pub struct UserTypeProjection<'tcx> { - pub base: UserTypeAnnotation<'tcx>, + pub base: UserTypeAnnotationIndex, pub projs: Vec>, } impl<'tcx> Copy for ProjectionKind<'tcx> { } +impl<'tcx> UserTypeProjection<'tcx> { + pub(crate) fn index(mut self) -> Self { + self.projs.push(ProjectionElem::Index(())); + self + } + + pub(crate) fn subslice(mut self, from: u32, to: u32) -> Self { + self.projs.push(ProjectionElem::Subslice { from, to }); + self + } + + pub(crate) fn deref(mut self) -> Self { + self.projs.push(ProjectionElem::Deref); + self + } + + pub(crate) fn leaf(mut self, field: Field) -> Self { + self.projs.push(ProjectionElem::Field(field, ())); + self + } + + pub(crate) fn variant( + mut self, + adt_def: &'tcx AdtDef, + variant_index: VariantIdx, + field: Field, + ) -> Self { + self.projs.push(ProjectionElem::Downcast(adt_def, variant_index)); + self.projs.push(ProjectionElem::Field(field, ())); + self + } +} + CloneTypeFoldableAndLiftImpls! { ProjectionKind<'tcx>, } impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection<'tcx> { @@ -2593,12 +2657,20 @@ newtype_index! { impl<'tcx> Debug for Constant<'tcx> { fn fmt(&self, fmt: &mut Formatter<'_>) -> fmt::Result { write!(fmt, "const ")?; - fmt_const_val(fmt, self.literal) + fmt_lazy_const_val(fmt, self.literal) } } /// Write a `ConstValue` in a way closer to the original source code than the `Debug` output. -pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const<'_>) -> fmt::Result { +pub fn fmt_lazy_const_val(f: &mut impl Write, const_val: &ty::LazyConst<'_>) -> fmt::Result { + match *const_val { + ty::LazyConst::Unevaluated(..) => write!(f, "{:?}", const_val), + ty::LazyConst::Evaluated(c) => fmt_const_val(f, c), + } +} + +/// Write a `ConstValue` in a way closer to the original source code than the `Debug` output. +pub fn fmt_const_val(f: &mut impl Write, const_val: ty::Const<'_>) -> fmt::Result { use ty::TyKind::*; let value = const_val.val; let ty = const_val.ty; @@ -2630,23 +2702,21 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const<'_>) -> fmt::Resu return write!(f, "{}", item_path_str(did)); } // print string literals - if let ConstValue::ScalarPair(ptr, len) = value { + if let ConstValue::Slice(ptr, len) = value { if let Scalar::Ptr(ptr) = ptr { - if let Scalar::Bits { bits: len, .. } = len { - if let Ref(_, &ty::TyS { sty: Str, .. }, _) = ty.sty { - return ty::tls::with(|tcx| { - let alloc = tcx.alloc_map.lock().get(ptr.alloc_id); - if let Some(interpret::AllocType::Memory(alloc)) = alloc { - assert_eq!(len as usize as u128, len); - let slice = - &alloc.bytes[(ptr.offset.bytes() as usize)..][..(len as usize)]; - let s = ::std::str::from_utf8(slice).expect("non utf8 str from miri"); - write!(f, "{:?}", s) - } else { - write!(f, "pointer to erroneous constant {:?}, {:?}", ptr, len) - } - }); - } + if let Ref(_, &ty::TyS { sty: Str, .. }, _) = ty.sty { + return ty::tls::with(|tcx| { + let alloc = tcx.alloc_map.lock().get(ptr.alloc_id); + if let Some(interpret::AllocKind::Memory(alloc)) = alloc { + assert_eq!(len as usize as u64, len); + let slice = + &alloc.bytes[(ptr.offset.bytes() as usize)..][..(len as usize)]; + let s = ::std::str::from_utf8(slice).expect("non utf8 str from miri"); + write!(f, "{:?}", s) + } else { + write!(f, "pointer to erroneous constant {:?}, {:?}", ptr, len) + } + }); } } } @@ -2777,8 +2847,8 @@ impl Location { #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] pub enum UnsafetyViolationKind { General, - /// unsafety is not allowed at all in min const fn - MinConstFn, + /// Permitted in const fn and regular fns + GeneralAndConstFn, ExternStatic(ast::NodeId), BorrowPacked(ast::NodeId), } @@ -2901,6 +2971,7 @@ pub struct ClosureOutlivesRequirement<'tcx> { #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] pub enum ConstraintCategory { Return, + Yield, UseAsConst, UseAsStatic, TypeAnnotation, @@ -2960,9 +3031,11 @@ CloneTypeFoldableAndLiftImpls! { SourceInfo, UpvarDecl, FakeReadCause, + RetagKind, SourceScope, SourceScopeData, SourceScopeLocalData, + UserTypeAnnotationIndex, } BraceStructTypeFoldableImpl! { @@ -2976,9 +3049,11 @@ BraceStructTypeFoldableImpl! { generator_drop, generator_layout, local_decls, + user_type_annotations, arg_count, upvar_decls, spread_arg, + control_flow_destroyed, span, cache, } @@ -3026,9 +3101,7 @@ EnumTypeFoldableImpl! { (StatementKind::StorageLive)(a), (StatementKind::StorageDead)(a), (StatementKind::InlineAsm) { asm, outputs, inputs }, - (StatementKind::Retag) { fn_entry, place }, - (StatementKind::EscapeToRaw)(place), - (StatementKind::EndRegion)(a), + (StatementKind::Retag)(kind, place), (StatementKind::AscribeUserType)(a, v, b), (StatementKind::Nop), } diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index ff2bf3d7807..55f5c36cde6 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def_id::{DefId, CrateNum, LOCAL_CRATE}; use syntax::ast::NodeId; use syntax::symbol::{Symbol, InternedString}; @@ -272,7 +262,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a> CodegenUnitNameBuilder<'a, 'gcx, 'tcx> { /// /// The '.' before `` makes sure that names with a special /// suffix can never collide with a name built out of regular Rust - /// identifiers (e.g. module paths). + /// identifiers (e.g., module paths). pub fn build_cgu_name(&mut self, cnum: CrateNum, components: I, diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index baa88dba459..649370059f0 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /*! * Methods for the various MIR types. These are intended for use after * building is complete. @@ -85,8 +75,7 @@ impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> { elem: &PlaceElem<'tcx>) -> PlaceTy<'tcx> { - self.projection_ty_core(tcx, elem, |_, _, ty| -> Result, ()> { Ok(ty) }) - .unwrap() + self.projection_ty_core(tcx, elem, |_, _, ty| ty) } /// `place_ty.projection_ty_core(tcx, elem, |...| { ... })` @@ -94,12 +83,12 @@ impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> { /// `Ty` or downcast variant corresponding to that projection. /// The `handle_field` callback must map a `Field` to its `Ty`, /// (which should be trivial when `T` = `Ty`). - pub fn projection_ty_core( + pub fn projection_ty_core( self, tcx: TyCtxt<'a, 'gcx, 'tcx>, elem: &ProjectionElem<'tcx, V, T>, - mut handle_field: impl FnMut(&Self, &Field, &T) -> Result, E>) - -> Result, E> + mut handle_field: impl FnMut(&Self, &Field, &T) -> Ty<'tcx>) + -> PlaceTy<'tcx> where V: ::std::fmt::Debug, T: ::std::fmt::Debug { @@ -150,10 +139,10 @@ impl<'a, 'gcx, 'tcx> PlaceTy<'tcx> { } }, ProjectionElem::Field(ref f, ref fty) => - PlaceTy::Ty { ty: handle_field(&self, f, fty)? }, + PlaceTy::Ty { ty: handle_field(&self, f, fty) }, }; debug!("projection_ty self: {:?} elem: {:?} yields: {:?}", self, elem, answer); - Ok(answer) + answer } } diff --git a/src/librustc/mir/traversal.rs b/src/librustc/mir/traversal.rs index f3a0b7de903..f8398c27cc2 100644 --- a/src/librustc/mir/traversal.rs +++ b/src/librustc/mir/traversal.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::bit_set::BitSet; use super::*; @@ -253,7 +243,7 @@ impl<'a, 'tcx> Iterator for Postorder<'a, 'tcx> { /// ``` /// /// A reverse postorder traversal of this graph is either `A B C D` or `A C B D` -/// Note that for a graph containing no loops (i.e. A DAG), this is equivalent to +/// Note that for a graph containing no loops (i.e., A DAG), this is equivalent to /// a topological sort. /// /// Construction of a `ReversePostorder` traversal requires doing a full diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs index 2a994ee0509..598303f2932 100644 --- a/src/librustc/mir/visit.rs +++ b/src/librustc/mir/visit.rs @@ -1,16 +1,6 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def_id::DefId; use ty::subst::Substs; -use ty::{ClosureSubsts, GeneratorSubsts, Region, Ty}; +use ty::{CanonicalUserTypeAnnotation, ClosureSubsts, GeneratorSubsts, Region, Ty}; use mir::*; use syntax_pos::Span; @@ -33,7 +23,7 @@ use syntax_pos::Span; // in that circumstance. // // For the most part, we do not destructure things external to the -// MIR, e.g. types, spans, etc, but simply visit them and stop. This +// MIR, e.g., types, spans, etc, but simply visit them and stop. This // avoids duplication with other visitors like `TypeFoldable`. // // ## Updating @@ -153,10 +143,10 @@ macro_rules! make_mir_visitor { } fn visit_retag(&mut self, - fn_entry: & $($mutability)* bool, + kind: & $($mutability)* RetagKind, place: & $($mutability)* Place<'tcx>, location: Location) { - self.super_retag(fn_entry, place, location); + self.super_retag(kind, place, location); } fn visit_place(&mut self, @@ -229,9 +219,10 @@ macro_rules! make_mir_visitor { fn visit_user_type_annotation( &mut self, - ty: & $($mutability)* UserTypeAnnotation<'tcx>, + index: UserTypeAnnotationIndex, + ty: & $($mutability)* CanonicalUserTypeAnnotation<'tcx>, ) { - self.super_user_type_annotation(ty); + self.super_user_type_annotation(index, ty); } fn visit_region(&mut self, @@ -241,7 +232,7 @@ macro_rules! make_mir_visitor { } fn visit_const(&mut self, - constant: & $($mutability)* &'tcx ty::Const<'tcx>, + constant: & $($mutability)* &'tcx ty::LazyConst<'tcx>, _: Location) { self.super_const(constant); } @@ -317,6 +308,17 @@ macro_rules! make_mir_visitor { self.visit_local_decl(local, & $($mutability)* mir.local_decls[local]); } + macro_rules! type_annotations { + (mut) => (mir.user_type_annotations.iter_enumerated_mut()); + () => (mir.user_type_annotations.iter_enumerated()); + }; + + for (index, annotation) in type_annotations!($($mutability)*) { + self.visit_user_type_annotation( + index, annotation + ); + } + self.visit_span(&$($mutability)* mir.span); } @@ -377,7 +379,6 @@ macro_rules! make_mir_visitor { location ); } - StatementKind::EndRegion(_) => {} StatementKind::SetDiscriminant{ ref $($mutability)* place, .. } => { self.visit_place( place, @@ -385,9 +386,6 @@ macro_rules! make_mir_visitor { location ); } - StatementKind::EscapeToRaw(ref $($mutability)* op) => { - self.visit_operand(op, location); - } StatementKind::StorageLive(ref $($mutability)* local) => { self.visit_local( local, @@ -417,9 +415,9 @@ macro_rules! make_mir_visitor { self.visit_operand(input, location); } } - StatementKind::Retag { ref $($mutability)* fn_entry, - ref $($mutability)* place } => { - self.visit_retag(fn_entry, place, location); + StatementKind::Retag ( ref $($mutability)* kind, + ref $($mutability)* place ) => { + self.visit_retag(kind, place, location); } StatementKind::AscribeUserType( ref $($mutability)* place, @@ -724,7 +722,7 @@ macro_rules! make_mir_visitor { } fn super_retag(&mut self, - _fn_entry: & $($mutability)* bool, + _kind: & $($mutability)* RetagKind, place: & $($mutability)* Place<'tcx>, location: Location) { self.visit_place( @@ -879,19 +877,17 @@ macro_rules! make_mir_visitor { fn super_user_type_projection( &mut self, - ty: & $($mutability)* UserTypeProjection<'tcx>, + _ty: & $($mutability)* UserTypeProjection<'tcx>, ) { - let UserTypeProjection { - ref $($mutability)* base, - projs: _, // Note: Does not visit projection elems! - } = *ty; - self.visit_user_type_annotation(base); } fn super_user_type_annotation( &mut self, - _ty: & $($mutability)* UserTypeAnnotation<'tcx>, + _index: UserTypeAnnotationIndex, + ty: & $($mutability)* CanonicalUserTypeAnnotation<'tcx>, ) { + self.visit_span(& $($mutability)* ty.span); + self.visit_ty(& $($mutability)* ty.inferred_ty, TyContext::UserTy(ty.span)); } fn super_ty(&mut self, _ty: & $($mutability)* Ty<'tcx>) { @@ -900,7 +896,7 @@ macro_rules! make_mir_visitor { fn super_region(&mut self, _region: & $($mutability)* ty::Region<'tcx>) { } - fn super_const(&mut self, _const: & $($mutability)* &'tcx ty::Const<'tcx>) { + fn super_const(&mut self, _const: & $($mutability)* &'tcx ty::LazyConst<'tcx>) { } fn super_substs(&mut self, _substs: & $($mutability)* &'tcx Substs<'tcx>) { @@ -972,6 +968,9 @@ pub enum TyContext { source_info: SourceInfo, }, + /// The inferred type of a user type annotation. + UserTy(Span), + /// The return type of the function. ReturnTy(SourceInfo), @@ -995,7 +994,7 @@ pub enum NonMutatingUseContext<'tcx> { ShallowBorrow(Region<'tcx>), /// Unique borrow. UniqueBorrow(Region<'tcx>), - /// Used as base for another place, e.g. `x` in `x.y`. Will not mutate the place. + /// Used as base for another place, e.g., `x` in `x.y`. Will not mutate the place. /// For example, the projection `x.y` is not marked as a mutation in these cases: /// /// z = x.y; @@ -1018,7 +1017,7 @@ pub enum MutatingUseContext<'tcx> { Drop, /// Mutable borrow. Borrow(Region<'tcx>), - /// Used as base for another place, e.g. `x` in `x.y`. Could potentially mutate the place. + /// Used as base for another place, e.g., `x` in `x.y`. Could potentially mutate the place. /// For example, the projection `x.y` is marked as a mutation in these cases: /// /// x.y = ...; diff --git a/src/librustc/session/code_stats.rs b/src/librustc/session/code_stats.rs index b1dcfdfcda0..730abacf6f6 100644 --- a/src/librustc/session/code_stats.rs +++ b/src/librustc/session/code_stats.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_target::abi::{Align, Size}; use rustc_data_structures::fx::{FxHashSet}; use std::cmp::{self, Ordering}; @@ -71,7 +61,7 @@ impl CodeStats { let info = TypeSizeInfo { kind, type_description: type_desc.to_string(), - align: align.abi(), + align: align.bytes(), overall_size: overall_size.bytes(), packed: packed, opt_discr_size: opt_discr_size.map(|s| s.bytes()), diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index ee6d970750a..4b1aefb2216 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1,22 +1,12 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Contains infrastructure for configuring the compiler, including parsing //! command line options. use std::str::FromStr; use session::{early_error, early_warn, Session}; -use session::search_paths::SearchPaths; +use session::search_paths::SearchPath; -use rustc_target::spec::{LinkerFlavor, PanicStrategy, RelroLevel}; +use rustc_target::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, RelroLevel}; use rustc_target::spec::{Target, TargetTriple}; use lint; use middle::cstore; @@ -68,6 +58,8 @@ pub enum OptLevel { SizeMin, // -Oz } +impl_stable_hash_via_hash!(OptLevel); + /// This is what the `LtoCli` values get mapped to after resolving defaults and /// and taking other command line options into account. #[derive(Clone, Copy, PartialEq, Hash, Debug)] @@ -374,7 +366,7 @@ top_level_options!( lint_cap: Option [TRACKED], describe_lints: bool [UNTRACKED], output_types: OutputTypes [TRACKED], - search_paths: SearchPaths [UNTRACKED], + search_paths: Vec [UNTRACKED], libs: Vec<(String, Option, Option)> [TRACKED], maybe_sysroot: Option [TRACKED], @@ -593,7 +585,7 @@ impl Default for Options { lint_cap: None, describe_lints: false, output_types: OutputTypes(BTreeMap::new()), - search_paths: SearchPaths::new(), + search_paths: vec![], maybe_sysroot: None, target_triple: TargetTriple::from_triple(host_triple()), test: false, @@ -659,15 +651,15 @@ impl Options { } } -// The type of entry function, so -// users can have their own entry -// functions -#[derive(Copy, Clone, PartialEq)] +// The type of entry function, so users can have their own entry functions +#[derive(Copy, Clone, PartialEq, Hash, Debug)] pub enum EntryFnType { Main, Start, } +impl_stable_hash_via_hash!(EntryFnType); + #[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash, Debug)] pub enum CrateType { Executable, @@ -780,52 +772,54 @@ macro_rules! options { } pub type $setter_name = fn(&mut $struct_name, v: Option<&str>) -> bool; - pub const $stat: &'static [(&'static str, $setter_name, - Option<&'static str>, &'static str)] = + pub const $stat: &[(&str, $setter_name, Option<&str>, &str)] = &[ $( (stringify!($opt), $mod_set::$opt, $mod_desc::$parse, $desc) ),* ]; #[allow(non_upper_case_globals, dead_code)] mod $mod_desc { - pub const parse_bool: Option<&'static str> = None; - pub const parse_opt_bool: Option<&'static str> = + pub const parse_bool: Option<&str> = None; + pub const parse_opt_bool: Option<&str> = Some("one of: `y`, `yes`, `on`, `n`, `no`, or `off`"); - pub const parse_string: Option<&'static str> = Some("a string"); - pub const parse_string_push: Option<&'static str> = Some("a string"); - pub const parse_pathbuf_push: Option<&'static str> = Some("a path"); - pub const parse_opt_string: Option<&'static str> = Some("a string"); - pub const parse_opt_pathbuf: Option<&'static str> = Some("a path"); - pub const parse_list: Option<&'static str> = Some("a space-separated list of strings"); - pub const parse_opt_list: Option<&'static str> = Some("a space-separated list of strings"); - pub const parse_uint: Option<&'static str> = Some("a number"); - pub const parse_passes: Option<&'static str> = + pub const parse_string: Option<&str> = Some("a string"); + pub const parse_string_push: Option<&str> = Some("a string"); + pub const parse_pathbuf_push: Option<&str> = Some("a path"); + pub const parse_opt_string: Option<&str> = Some("a string"); + pub const parse_opt_pathbuf: Option<&str> = Some("a path"); + pub const parse_list: Option<&str> = Some("a space-separated list of strings"); + pub const parse_opt_list: Option<&str> = Some("a space-separated list of strings"); + pub const parse_uint: Option<&str> = Some("a number"); + pub const parse_passes: Option<&str> = Some("a space-separated list of passes, or `all`"); - pub const parse_opt_uint: Option<&'static str> = + pub const parse_opt_uint: Option<&str> = Some("a number"); - pub const parse_panic_strategy: Option<&'static str> = - Some("either `panic` or `abort`"); - pub const parse_relro_level: Option<&'static str> = + pub const parse_panic_strategy: Option<&str> = + Some("either `unwind` or `abort`"); + pub const parse_relro_level: Option<&str> = Some("one of: `full`, `partial`, or `off`"); - pub const parse_sanitizer: Option<&'static str> = + pub const parse_sanitizer: Option<&str> = Some("one of: `address`, `leak`, `memory` or `thread`"); - pub const parse_linker_flavor: Option<&'static str> = + pub const parse_linker_flavor: Option<&str> = Some(::rustc_target::spec::LinkerFlavor::one_of()); - pub const parse_optimization_fuel: Option<&'static str> = + pub const parse_optimization_fuel: Option<&str> = Some("crate=integer"); - pub const parse_unpretty: Option<&'static str> = + pub const parse_unpretty: Option<&str> = Some("`string` or `string=string`"); - pub const parse_lto: Option<&'static str> = + pub const parse_lto: Option<&str> = Some("either a boolean (`yes`, `no`, `on`, `off`, etc), `thin`, \ `fat`, or omitted"); - pub const parse_cross_lang_lto: Option<&'static str> = + pub const parse_cross_lang_lto: Option<&str> = Some("either a boolean (`yes`, `no`, `on`, `off`, etc), \ or the path to the linker plugin"); + pub const parse_merge_functions: Option<&str> = + Some("one of: `disabled`, `trampolines`, or `aliases`"); } #[allow(dead_code)] mod $mod_set { use super::{$struct_name, Passes, Sanitizer, LtoCli, CrossLangLto}; - use rustc_target::spec::{LinkerFlavor, PanicStrategy, RelroLevel}; + use rustc_target::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, RelroLevel}; use std::path::PathBuf; + use std::str::FromStr; $( pub fn $opt(cg: &mut $struct_name, v: Option<&str>) -> bool { @@ -1057,6 +1051,14 @@ macro_rules! options { }; true } + + fn parse_merge_functions(slot: &mut Option, v: Option<&str>) -> bool { + match v.and_then(|s| MergeFunctions::from_str(s).ok()) { + Some(mergefunc) => *slot = Some(mergefunc), + _ => return false, + } + true + } } ) } @@ -1136,6 +1138,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, "enable incremental compilation"), default_linker_libraries: Option = (None, parse_opt_bool, [UNTRACKED], "allow the linker to link its default libraries"), + linker_flavor: Option = (None, parse_linker_flavor, [UNTRACKED], + "Linker flavor"), } options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, @@ -1149,8 +1153,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "when debug-printing compiler state, do not include spans"), // o/w tests have closure@path identify_regions: bool = (false, parse_bool, [UNTRACKED], "make unnamed regions display as '# (where # is some non-ident unique id)"), - emit_end_regions: bool = (false, parse_bool, [UNTRACKED], - "emit EndRegion as part of MIR; enable transforms that solely process EndRegion"), borrowck: Option = (None, parse_opt_string, [UNTRACKED], "select which borrowck is used (`ast`, `mir`, `migrate`, or `compare`)"), two_phase_borrows: bool = (false, parse_bool, [UNTRACKED], @@ -1192,8 +1194,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "prints the llvm optimization passes being run"), ast_json: bool = (false, parse_bool, [UNTRACKED], "print the AST as JSON and halt"), - query_threads: Option = (None, parse_opt_uint, [UNTRACKED], - "execute queries on a thread pool with N threads"), + threads: Option = (None, parse_opt_uint, [UNTRACKED], + "use a thread pool with N threads"), ast_json_noexpand: bool = (false, parse_bool, [UNTRACKED], "print the pre-expansion AST as JSON and halt"), ls: bool = (false, parse_bool, [UNTRACKED], @@ -1238,6 +1240,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "verify incr. comp. hashes of green query instances"), incremental_ignore_spans: bool = (false, parse_bool, [UNTRACKED], "ignore spans during ICH computation -- used for testing"), + instrument_mcount: bool = (false, parse_bool, [TRACKED], + "insert function instrument code for mcount-based tracing"), dump_dep_graph: bool = (false, parse_bool, [UNTRACKED], "dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv)"), query_dep_graph: bool = (false, parse_bool, [UNTRACKED], @@ -1272,10 +1276,14 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "set the MIR optimization level (0-3, default: 1)"), mutable_noalias: Option = (None, parse_opt_bool, [TRACKED], "emit noalias metadata for mutable references (default: yes on LLVM >= 6)"), - arg_align_attributes: bool = (false, parse_bool, [TRACKED], - "emit align metadata for reference arguments"), dump_mir: Option = (None, parse_opt_string, [UNTRACKED], - "dump MIR state at various points in transforms"), + "dump MIR state to file. + `val` is used to select which passes and functions to dump. For example: + `all` matches all passes and functions, + `foo` matches all passes for functions whose name contains 'foo', + `foo & ConstProp` only the 'ConstProp' pass for function names containing 'foo', + `foo | bar` all passes for function names containing 'foo' or 'bar'."), + dump_mir_dir: String = (String::from("mir_dump"), parse_string, [UNTRACKED], "the directory the MIR is dumped into"), dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED], @@ -1283,21 +1291,19 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, dump_mir_exclude_pass_number: bool = (false, parse_bool, [UNTRACKED], "if set, exclude the pass number when dumping MIR (used in tests)"), mir_emit_retag: bool = (false, parse_bool, [TRACKED], - "emit Retagging MIR statements, interpreted e.g. by miri; implies -Zmir-opt-level=0"), + "emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0"), perf_stats: bool = (false, parse_bool, [UNTRACKED], "print some performance-related statistics"), + query_stats: bool = (false, parse_bool, [UNTRACKED], + "print some statistics about the query system"), hir_stats: bool = (false, parse_bool, [UNTRACKED], "print some statistics about AST and HIR"), - mir_stats: bool = (false, parse_bool, [UNTRACKED], - "print some statistics about MIR"), always_encode_mir: bool = (false, parse_bool, [TRACKED], "encode MIR of all functions into the crate metadata"), osx_rpath_install_name: bool = (false, parse_bool, [TRACKED], "pass `-install_name @rpath/...` to the macOS linker"), sanitizer: Option = (None, parse_sanitizer, [TRACKED], "Use a sanitizer"), - linker_flavor: Option = (None, parse_linker_flavor, [UNTRACKED], - "Linker flavor"), fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED], "set the optimization fuel quota for a crate"), print_fuel: Option = (None, parse_opt_string, [TRACKED], @@ -1318,12 +1324,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "Disable the instrumentation pre-inliner, useful for profiling / PGO."), relro_level: Option = (None, parse_relro_level, [TRACKED], "choose which RELRO level to use"), - nll_subminimal_causes: bool = (false, parse_bool, [UNTRACKED], - "when tracking region error causes, accept subminimal results for faster execution."), nll_facts: bool = (false, parse_bool, [UNTRACKED], "dump facts from NLL analysis into side files"), - disable_nll_user_type_assert: bool = (false, parse_bool, [UNTRACKED], - "disable user provided type assertion in NLL"), nll_dont_emit_read_for_match: bool = (false, parse_bool, [UNTRACKED], "in match codegen, do not include FakeRead statements (used by mir-borrowck)"), dont_buffer_diagnostics: bool = (false, parse_bool, [UNTRACKED], @@ -1353,10 +1355,15 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, unpretty: Option = (None, parse_unpretty, [UNTRACKED], "Present the input source, unstable (and less-pretty) variants; valid types are any of the types for `--pretty`, as well as: + `expanded`, `expanded,identified`, + `expanded,hygiene` (with internal representations), `flowgraph=` (graphviz formatted flowgraph for node), + `flowgraph,unlabelled=` (unlabelled graphviz formatted flowgraph for node), `everybody_loops` (all function bodies replaced with `loop {}`), - `hir` (the HIR), `hir,identified`, or - `hir,typed` (HIR with types for each node)."), + `hir` (the HIR), `hir,identified`, + `hir,typed` (HIR with types for each node), + `hir-tree` (dump the raw HIR), + `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)"), run_dsymutil: Option = (None, parse_opt_bool, [TRACKED], "run `dsymutil` and delete intermediate object files"), ui_testing: bool = (false, parse_bool, [UNTRACKED], @@ -1375,6 +1382,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "don't run LLVM in parallel (while keeping codegen-units and ThinLTO)"), no_leak_check: bool = (false, parse_bool, [UNTRACKED], "disables the 'leak check' for subtyping; unsound, but useful for tests"), + no_interleave_lints: bool = (false, parse_bool, [UNTRACKED], + "don't interleave execution of lints; allows benchmarking individual lints"), crate_attr: Vec = (Vec::new(), parse_string_push, [TRACKED], "inject the given attribute in the crate"), self_profile: bool = (false, parse_bool, [UNTRACKED], @@ -1387,6 +1396,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "whether to use the PLT when calling into shared libraries; only has effect for PIC code on systems with ELF binaries (default: PLT is disabled if full relro is enabled)"), + merge_functions: Option = (None, parse_merge_functions, [TRACKED], + "control the operation of the MergeFunctions LLVM pass, taking + the same values as the target option of the same name"), } pub fn default_lib_output() -> CrateType { @@ -1537,7 +1549,7 @@ impl RustcOptGroup { // adds extra rustc-specific metadata to each option; such metadata // is exposed by . The public // functions below ending with `_u` are the functions that return -// *unstable* options, i.e. options that are only enabled when the +// *unstable* options, i.e., options that are only enabled when the // user also passes the `-Z unstable-options` debugging flag. mod opt { // The `fn opt_u` etc below are written so that we can use them @@ -1760,8 +1772,8 @@ pub fn parse_cfgspecs(cfgspecs: Vec) -> ast::CrateConfig { .into_iter() .map(|s| { let sess = parse::ParseSess::new(FilePathMapping::empty()); - let mut parser = - parse::new_parser_from_source_str(&sess, FileName::CfgSpec, s.to_string()); + let filename = FileName::cfg_spec_source_code(&s); + let mut parser = parse::new_parser_from_source_str(&sess, filename, s.to_string()); macro_rules! error {($reason: expr) => { early_error(ErrorOutputType::default(), @@ -1974,17 +1986,17 @@ pub fn build_session_options_and_crate_config( } } - if debugging_opts.query_threads == Some(0) { + if debugging_opts.threads == Some(0) { early_error( error_format, - "Value for query threads must be a positive nonzero integer", + "Value for threads must be a positive nonzero integer", ); } - if debugging_opts.query_threads.unwrap_or(1) > 1 && debugging_opts.fuel.is_some() { + if debugging_opts.threads.unwrap_or(1) > 1 && debugging_opts.fuel.is_some() { early_error( error_format, - "Optimization fuel is incompatible with multiple query threads", + "Optimization fuel is incompatible with multiple threads", ); } @@ -2114,9 +2126,9 @@ pub fn build_session_options_and_crate_config( } }; - let mut search_paths = SearchPaths::new(); + let mut search_paths = vec![]; for s in &matches.opt_strs("L") { - search_paths.add_path(&s[..], error_format); + search_paths.push(SearchPath::from_cli_opt(&s[..], error_format)); } let libs = matches @@ -2385,7 +2397,7 @@ impl fmt::Display for CrateType { /// tracking are hashed into a single value that determines whether the /// incremental compilation cache can be re-used or not. This hashing is done /// via the DepTrackingHash trait defined below, since the standard Hash -/// implementation might not be suitable (e.g. arguments are stored in a Vec, +/// implementation might not be suitable (e.g., arguments are stored in a Vec, /// the hash of which is order dependent, but we might not want the order of /// arguments to make a difference for the hash). /// @@ -2405,7 +2417,7 @@ mod dep_tracking { use super::{CrateType, DebugInfo, ErrorOutputType, OptLevel, OutputTypes, Passes, Sanitizer, LtoCli, CrossLangLto}; use syntax::feature_gate::UnstableFeatures; - use rustc_target::spec::{PanicStrategy, RelroLevel, TargetTriple}; + use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel, TargetTriple}; use syntax::edition::Edition; pub trait DepTrackingHash { @@ -2448,12 +2460,14 @@ mod dep_tracking { impl_dep_tracking_hash_via_hash!(Option); impl_dep_tracking_hash_via_hash!(Option); impl_dep_tracking_hash_via_hash!(Option<(String, u64)>); + impl_dep_tracking_hash_via_hash!(Option); impl_dep_tracking_hash_via_hash!(Option); impl_dep_tracking_hash_via_hash!(Option); impl_dep_tracking_hash_via_hash!(Option); impl_dep_tracking_hash_via_hash!(Option); impl_dep_tracking_hash_via_hash!(Option); impl_dep_tracking_hash_via_hash!(CrateType); + impl_dep_tracking_hash_via_hash!(MergeFunctions); impl_dep_tracking_hash_via_hash!(PanicStrategy); impl_dep_tracking_hash_via_hash!(RelroLevel); impl_dep_tracking_hash_via_hash!(Passes); @@ -2534,11 +2548,12 @@ mod tests { use session::config::{build_configuration, build_session_options_and_crate_config}; use session::config::{LtoCli, CrossLangLto}; use session::build_session; + use session::search_paths::SearchPath; use std::collections::{BTreeMap, BTreeSet}; use std::iter::FromIterator; use std::path::PathBuf; use super::{Externs, OutputType, OutputTypes}; - use rustc_target::spec::{PanicStrategy, RelroLevel}; + use rustc_target::spec::{MergeFunctions, PanicStrategy, RelroLevel}; use syntax::symbol::Symbol; use syntax::edition::{Edition, DEFAULT_EDITION}; use syntax; @@ -2789,48 +2804,48 @@ mod tests { // Reference v1.search_paths - .add_path("native=abc", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("native=abc", super::ErrorOutputType::Json(false))); v1.search_paths - .add_path("crate=def", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("crate=def", super::ErrorOutputType::Json(false))); v1.search_paths - .add_path("dependency=ghi", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("dependency=ghi", super::ErrorOutputType::Json(false))); v1.search_paths - .add_path("framework=jkl", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("framework=jkl", super::ErrorOutputType::Json(false))); v1.search_paths - .add_path("all=mno", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("all=mno", super::ErrorOutputType::Json(false))); v2.search_paths - .add_path("native=abc", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("native=abc", super::ErrorOutputType::Json(false))); v2.search_paths - .add_path("dependency=ghi", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("dependency=ghi", super::ErrorOutputType::Json(false))); v2.search_paths - .add_path("crate=def", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("crate=def", super::ErrorOutputType::Json(false))); v2.search_paths - .add_path("framework=jkl", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("framework=jkl", super::ErrorOutputType::Json(false))); v2.search_paths - .add_path("all=mno", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("all=mno", super::ErrorOutputType::Json(false))); v3.search_paths - .add_path("crate=def", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("crate=def", super::ErrorOutputType::Json(false))); v3.search_paths - .add_path("framework=jkl", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("framework=jkl", super::ErrorOutputType::Json(false))); v3.search_paths - .add_path("native=abc", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("native=abc", super::ErrorOutputType::Json(false))); v3.search_paths - .add_path("dependency=ghi", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("dependency=ghi", super::ErrorOutputType::Json(false))); v3.search_paths - .add_path("all=mno", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("all=mno", super::ErrorOutputType::Json(false))); v4.search_paths - .add_path("all=mno", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("all=mno", super::ErrorOutputType::Json(false))); v4.search_paths - .add_path("native=abc", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("native=abc", super::ErrorOutputType::Json(false))); v4.search_paths - .add_path("crate=def", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("crate=def", super::ErrorOutputType::Json(false))); v4.search_paths - .add_path("dependency=ghi", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("dependency=ghi", super::ErrorOutputType::Json(false))); v4.search_paths - .add_path("framework=jkl", super::ErrorOutputType::Json(false)); + .push(SearchPath::from_cli_opt("framework=jkl", super::ErrorOutputType::Json(false))); assert!(v1.dep_tracking_hash() == v2.dep_tracking_hash()); assert!(v1.dep_tracking_hash() == v3.dep_tracking_hash()); @@ -3193,6 +3208,10 @@ mod tests { opts = reference.clone(); opts.debugging_opts.cross_lang_lto = CrossLangLto::LinkerPluginAuto; assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); + + opts = reference.clone(); + opts.debugging_opts.merge_functions = Some(MergeFunctions::Disabled); + assert!(reference.dep_tracking_hash() != opts.dep_tracking_hash()); } #[test] diff --git a/src/librustc/session/filesearch.rs b/src/librustc/session/filesearch.rs index f410c270bce..19f1c7a18fa 100644 --- a/src/librustc/session/filesearch.rs +++ b/src/librustc/session/filesearch.rs @@ -1,24 +1,13 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] pub use self::FileMatch::*; -use rustc_data_structures::fx::FxHashSet; use std::borrow::Cow; use std::env; use std::fs; use std::path::{Path, PathBuf}; -use session::search_paths::{SearchPaths, PathKind}; +use session::search_paths::{SearchPath, PathKind}; use rustc_fs_util::fix_windows_verbatim_for_gcc; #[derive(Copy, Clone)] @@ -30,31 +19,19 @@ pub enum FileMatch { // A module for searching for libraries pub struct FileSearch<'a> { - pub sysroot: &'a Path, - pub search_paths: &'a SearchPaths, - pub triple: &'a str, - pub kind: PathKind, + sysroot: &'a Path, + triple: &'a str, + search_paths: &'a [SearchPath], + tlib_path: &'a SearchPath, + kind: PathKind, } impl<'a> FileSearch<'a> { - pub fn for_each_lib_search_path(&self, mut f: F) where - F: FnMut(&Path, PathKind) - { - let mut visited_dirs = FxHashSet::default(); - visited_dirs.reserve(self.search_paths.paths.len() + 1); - for (path, kind) in self.search_paths.iter(self.kind) { - f(path, kind); - visited_dirs.insert(path.to_path_buf()); - } - - debug!("filesearch: searching lib path"); - let tlib_path = make_target_lib_path(self.sysroot, - self.triple); - if !visited_dirs.contains(&tlib_path) { - f(&tlib_path, PathKind::All); - } - - visited_dirs.insert(tlib_path); + pub fn search_paths(&self) -> impl Iterator { + let kind = self.kind; + self.search_paths.iter() + .filter(move |sp| sp.kind.matches(kind)) + .chain(std::iter::once(self.tlib_path)) } pub fn get_lib_path(&self) -> PathBuf { @@ -64,14 +41,8 @@ impl<'a> FileSearch<'a> { pub fn search(&self, mut pick: F) where F: FnMut(&Path, PathKind) -> FileMatch { - self.for_each_lib_search_path(|lib_search_path, kind| { - debug!("searching {}", lib_search_path.display()); - let files = match fs::read_dir(lib_search_path) { - Ok(files) => files, - Err(..) => return, - }; - let files = files.filter_map(|p| p.ok().map(|s| s.path())) - .collect::>(); + for search_path in self.search_paths() { + debug!("searching {}", search_path.dir.display()); fn is_rlib(p: &Path) -> bool { p.extension() == Some("rlib".as_ref()) } @@ -79,11 +50,11 @@ impl<'a> FileSearch<'a> { // an rlib and a dylib we only read one of the files of // metadata, so in the name of speed, bring all rlib files to // the front of the search list. - let files1 = files.iter().filter(|p| is_rlib(p)); - let files2 = files.iter().filter(|p| !is_rlib(p)); + let files1 = search_path.files.iter().filter(|p| is_rlib(p)); + let files2 = search_path.files.iter().filter(|p| !is_rlib(p)); for path in files1.chain(files2) { debug!("testing {}", path.display()); - let maybe_picked = pick(path, kind); + let maybe_picked = pick(path, search_path.kind); match maybe_picked { FileMatches => { debug!("picked {}", path.display()); @@ -93,29 +64,30 @@ impl<'a> FileSearch<'a> { } } } - }); + } } pub fn new(sysroot: &'a Path, triple: &'a str, - search_paths: &'a SearchPaths, - kind: PathKind) -> FileSearch<'a> { + search_paths: &'a Vec, + tlib_path: &'a SearchPath, + kind: PathKind) + -> FileSearch<'a> { debug!("using sysroot = {}, triple = {}", sysroot.display(), triple); FileSearch { sysroot, - search_paths, triple, + search_paths, + tlib_path, kind, } } - // Returns a list of directories where target-specific dylibs might be located. - pub fn get_dylib_search_paths(&self) -> Vec { - let mut paths = Vec::new(); - self.for_each_lib_search_path(|lib_search_path, _| { - paths.push(lib_search_path.to_path_buf()); - }); - paths + // Returns just the directories within the search paths. + pub fn search_path_dirs(&self) -> Vec { + self.search_paths() + .map(|sp| sp.dir.to_path_buf()) + .collect() } // Returns a list of directories where target-specific tool binaries are located. @@ -138,8 +110,7 @@ pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf p } -fn make_target_lib_path(sysroot: &Path, - target_triple: &str) -> PathBuf { +pub fn make_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf { sysroot.join(&relative_target_lib_path(sysroot, target_triple)) } @@ -176,15 +147,15 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> { // of the directory where librustc is located, rather than where the rustc // binary is. // If --libdir is set during configuration to the value other than - // "lib" (i.e. non-default), this value is used (see issue #16552). + // "lib" (i.e., non-default), this value is used (see issue #16552). #[cfg(target_pointer_width = "64")] - const PRIMARY_LIB_DIR: &'static str = "lib64"; + const PRIMARY_LIB_DIR: &str = "lib64"; #[cfg(target_pointer_width = "32")] - const PRIMARY_LIB_DIR: &'static str = "lib32"; + const PRIMARY_LIB_DIR: &str = "lib32"; - const SECONDARY_LIB_DIR: &'static str = "lib"; + const SECONDARY_LIB_DIR: &str = "lib"; match option_env!("CFG_LIBDIR_RELATIVE") { Some(libdir) if libdir != "lib" => libdir.into(), @@ -198,4 +169,4 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> { // The name of rustc's own place to organize libraries. // Used to be "rustc", now the default is "rustlib" -const RUST_LIB_DIR: &'static str = "rustlib"; +const RUST_LIB_DIR: &str = "rustlib"; diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 1ec33cfad0e..78a71200f5b 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use self::code_stats::{DataTypeKind, SizeKind, FieldInfo, VariantInfo}; use self::code_stats::CodeStats; @@ -19,15 +9,18 @@ use lint; use lint::builtin::BuiltinLintDiagnostics; use middle::allocator::AllocatorKind; use middle::dependency_format; -use session::search_paths::PathKind; use session::config::{OutputType, Lto}; +use session::search_paths::{PathKind, SearchPath}; use util::nodemap::{FxHashMap, FxHashSet}; use util::common::{duration_to_secs_str, ErrorReported}; use util::common::ProfileQueriesMsg; use rustc_yk_link::YkExtraLinkObject; use rustc_data_structures::base_n; -use rustc_data_structures::sync::{self, Lrc, Lock, LockCell, OneThread, Once, RwLock}; +use rustc_data_structures::sync::{ + self, Lrc, Lock, OneThread, Once, RwLock, AtomicU64, AtomicUsize, Ordering, + Ordering::SeqCst, +}; use errors::{self, DiagnosticBuilder, DiagnosticId, Applicability}; use errors::emitter::{Emitter, EmitterWriter}; @@ -49,16 +42,22 @@ use std::cell::{self, Cell, RefCell}; use std::env; use std::fmt; use std::io::Write; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; use std::time::Duration; use std::sync::mpsc; -use std::sync::atomic::{AtomicUsize, Ordering}; mod code_stats; pub mod config; pub mod filesearch; pub mod search_paths; +pub struct OptimizationFuel { + /// If -zfuel=crate=n is specified, initially set to n. Otherwise 0. + remaining: u64, + /// We're rejecting all further optimizations. + out_of_fuel: bool, +} + /// Represents the data associated with a compilation /// session for a single crate. pub struct Session { @@ -68,12 +67,11 @@ pub struct Session { pub target: config::Config, pub host: Target, pub opts: config::Options, + pub host_tlib_path: SearchPath, + /// This is `None` if the host and target are the same. + pub target_tlib_path: Option, pub parse_sess: ParseSess, - /// For a library crate, this is always none - pub entry_fn: Once>, - pub plugin_registrar_fn: Once>, - pub derive_registrar_fn: Once>, - pub default_sysroot: Option, + pub sysroot: PathBuf, /// The name of the root source file of the crate, in the local file system. /// `None` means that there is no source file. pub local_crate_source_file: Option, @@ -132,6 +130,9 @@ pub struct Session { /// Used by -Z profile-queries in util::common pub profile_channel: Lock>>, + /// Used by -Z self-profile + pub self_profiling_active: bool, + /// Used by -Z self-profile pub self_profiling: Lock, @@ -145,16 +146,15 @@ pub struct Session { /// If -zfuel=crate=n is specified, Some(crate). optimization_fuel_crate: Option, - /// If -zfuel=crate=n is specified, initially set to n. Otherwise 0. - optimization_fuel_limit: LockCell, - /// We're rejecting all further optimizations. - out_of_fuel: LockCell, + + /// Tracks fuel info if If -zfuel=crate=n is specified + optimization_fuel: Lock, // The next two are public because the driver needs to read them. /// If -zprint-fuel=crate, Some(crate). pub print_fuel_crate: Option, /// Always set to zero and incremented so that we can print fuel expended by a crate. - pub print_fuel: LockCell, + pub print_fuel: AtomicU64, /// Loaded up early on in the initialization of this `Session` to avoid /// false positives about a job server in our environment. @@ -407,6 +407,9 @@ impl Session { pub fn next_node_id(&self) -> NodeId { self.reserve_node_ids(1) } + pub(crate) fn current_node_id_count(&self) -> usize { + self.next_node_id.get().as_u32() as usize + } pub fn diagnostic<'a>(&'a self) -> &'a errors::Handler { &self.parse_sess.span_diagnostic } @@ -436,7 +439,7 @@ impl Session { } DiagnosticBuilderMethod::SpanSuggestion(suggestion) => { let span = span_maybe.expect("span_suggestion_* needs a span"); - diag_builder.span_suggestion_with_applicability( + diag_builder.span_suggestion( span, message, suggestion, @@ -511,6 +514,9 @@ impl Session { pub fn profile_queries_and_keys(&self) -> bool { self.opts.debugging_opts.profile_queries_and_keys } + pub fn instrument_mcount(&self) -> bool { + self.opts.debugging_opts.instrument_mcount + } pub fn count_llvm_insns(&self) -> bool { self.opts.debugging_opts.count_llvm_insns } @@ -590,7 +596,7 @@ impl Session { // either return `No` or `ThinLocal`. // If processing command line options determined that we're incompatible - // with ThinLTO (e.g. `-C lto --emit llvm-ir`) then return that option. + // with ThinLTO (e.g., `-C lto --emit llvm-ir`) then return that option. if self.opts.cli_forced_thinlto_off { return config::Lto::No; } @@ -675,7 +681,11 @@ impl Session { } pub fn must_not_eliminate_frame_pointers(&self) -> bool { - if let Some(x) = self.opts.cg.force_frame_pointers { + // "mcount" function relies on stack pointer. + // See https://sourceware.org/binutils/docs/gprof/Implementation.html + if self.instrument_mcount() { + true + } else if let Some(x) = self.opts.cg.force_frame_pointers { x } else { !self.target.target.options.eliminate_frame_pointer @@ -691,34 +701,29 @@ impl Session { ) } - pub fn generate_derive_registrar_symbol(&self, disambiguator: CrateDisambiguator) -> String { + pub fn generate_proc_macro_decls_symbol(&self, disambiguator: CrateDisambiguator) -> String { format!( - "__rustc_derive_registrar_{}__", + "__rustc_proc_macro_decls_{}__", disambiguator.to_fingerprint().to_hex() ) } - pub fn sysroot<'a>(&'a self) -> &'a Path { - match self.opts.maybe_sysroot { - Some(ref sysroot) => sysroot, - None => self.default_sysroot - .as_ref() - .expect("missing sysroot and default_sysroot in Session"), - } - } pub fn target_filesearch(&self, kind: PathKind) -> filesearch::FileSearch<'_> { filesearch::FileSearch::new( - self.sysroot(), + &self.sysroot, self.opts.target_triple.triple(), &self.opts.search_paths, + // target_tlib_path==None means it's the same as host_tlib_path. + self.target_tlib_path.as_ref().unwrap_or(&self.host_tlib_path), kind, ) } pub fn host_filesearch(&self, kind: PathKind) -> filesearch::FileSearch<'_> { filesearch::FileSearch::new( - self.sysroot(), + &self.sysroot, config::host_triple(), &self.opts.search_paths, + &self.host_tlib_path, kind, ) } @@ -829,11 +834,20 @@ impl Session { } } - pub fn profiler ()>(&self, f: F) { + #[inline(never)] + #[cold] + fn profiler_active ()>(&self, f: F) { let mut profiler = self.self_profiling.borrow_mut(); f(&mut profiler); } + #[inline(always)] + pub fn profiler ()>(&self, f: F) { + if unlikely!(self.self_profiling_active) { + self.profiler_active(f) + } + } + pub fn print_profiler_results(&self) { let mut profiler = self.self_profiling.borrow_mut(); profiler.print_results(&self.opts); @@ -867,21 +881,21 @@ impl Session { let mut ret = true; if let Some(ref c) = self.optimization_fuel_crate { if c == crate_name { - assert_eq!(self.query_threads(), 1); - let fuel = self.optimization_fuel_limit.get(); - ret = fuel != 0; - if fuel == 0 && !self.out_of_fuel.get() { + assert_eq!(self.threads(), 1); + let mut fuel = self.optimization_fuel.lock(); + ret = fuel.remaining != 0; + if fuel.remaining == 0 && !fuel.out_of_fuel { eprintln!("optimization-fuel-exhausted: {}", msg()); - self.out_of_fuel.set(true); - } else if fuel > 0 { - self.optimization_fuel_limit.set(fuel - 1); + fuel.out_of_fuel = true; + } else if fuel.remaining > 0 { + fuel.remaining -= 1; } } } if let Some(ref c) = self.print_fuel_crate { if c == crate_name { - assert_eq!(self.query_threads(), 1); - self.print_fuel.set(self.print_fuel.get() + 1); + assert_eq!(self.threads(), 1); + self.print_fuel.fetch_add(1, SeqCst); } } ret @@ -889,14 +903,14 @@ impl Session { /// Returns the number of query threads that should be used for this /// compilation - pub fn query_threads_from_opts(opts: &config::Options) -> usize { - opts.debugging_opts.query_threads.unwrap_or(1) + pub fn threads_from_opts(opts: &config::Options) -> usize { + opts.debugging_opts.threads.unwrap_or(::num_cpus::get()) } /// Returns the number of query threads that should be used for this /// compilation - pub fn query_threads(&self) -> usize { - Self::query_threads_from_opts(&self.opts) + pub fn threads(&self) -> usize { + Self::threads_from_opts(&self.opts) } /// Returns the number of codegen units that should be used for this @@ -1111,9 +1125,18 @@ pub fn build_session_( let target_cfg = config::build_target_config(&sopts, &span_diagnostic); let p_s = parse::ParseSess::with_span_handler(span_diagnostic, source_map); - let default_sysroot = match sopts.maybe_sysroot { - Some(_) => None, - None => Some(filesearch::get_or_default_sysroot()), + let sysroot = match &sopts.maybe_sysroot { + Some(sysroot) => sysroot.clone(), + None => filesearch::get_or_default_sysroot(), + }; + + let host_triple = config::host_triple(); + let target_triple = sopts.target_triple.triple(); + let host_tlib_path = SearchPath::from_sysroot_and_triple(&sysroot, host_triple); + let target_tlib_path = if host_triple == target_triple { + None + } else { + Some(SearchPath::from_sysroot_and_triple(&sysroot, target_triple)) }; let file_path_mapping = sopts.file_path_mapping(); @@ -1122,10 +1145,12 @@ pub fn build_session_( local_crate_source_file.map(|path| file_path_mapping.map_prefix(path).0); let optimization_fuel_crate = sopts.debugging_opts.fuel.as_ref().map(|i| i.0.clone()); - let optimization_fuel_limit = - LockCell::new(sopts.debugging_opts.fuel.as_ref().map(|i| i.1).unwrap_or(0)); + let optimization_fuel = Lock::new(OptimizationFuel { + remaining: sopts.debugging_opts.fuel.as_ref().map(|i| i.1).unwrap_or(0), + out_of_fuel: false, + }); let print_fuel_crate = sopts.debugging_opts.print_fuel.clone(); - let print_fuel = LockCell::new(0); + let print_fuel = AtomicU64::new(0); let working_dir = env::current_dir().unwrap_or_else(|e| p_s.span_diagnostic @@ -1140,17 +1165,18 @@ pub fn build_session_( CguReuseTracker::new_disabled() }; + let self_profiling_active = sopts.debugging_opts.self_profile || + sopts.debugging_opts.profile_json; + let sess = Session { yk_link_objects: RefCell::new(Vec::new()), target: target_cfg, host, opts: sopts, + host_tlib_path, + target_tlib_path, parse_sess: p_s, - // For a library crate, this is always none - entry_fn: Once::new(), - plugin_registrar_fn: Once::new(), - derive_registrar_fn: Once::new(), - default_sysroot, + sysroot, local_crate_source_file, working_dir, lint_store: RwLock::new(lint::LintStore::new()), @@ -1171,6 +1197,7 @@ pub fn build_session_( imported_macro_spans: OneThread::new(RefCell::new(FxHashMap::default())), incr_comp_session: OneThread::new(RefCell::new(IncrCompSession::NotInitialized)), cgu_reuse_tracker, + self_profiling_active, self_profiling: Lock::new(SelfProfiler::new()), profile_channel: Lock::new(None), perf_stats: PerfStats { @@ -1182,10 +1209,9 @@ pub fn build_session_( }, code_stats: Default::default(), optimization_fuel_crate, - optimization_fuel_limit, + optimization_fuel, print_fuel_crate, print_fuel, - out_of_fuel: LockCell::new(false), // Note that this is unsafe because it may misinterpret file descriptors // on Unix as jobserver file descriptors. We hopefully execute this near // the beginning of the process though to ensure we don't get false diff --git a/src/librustc/session/search_paths.rs b/src/librustc/session/search_paths.rs index 768d4f1e5fb..85d64b15712 100644 --- a/src/librustc/session/search_paths.rs +++ b/src/librustc/session/search_paths.rs @@ -1,25 +1,12 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::slice; use std::path::{Path, PathBuf}; use session::{early_error, config}; +use session::filesearch::make_target_lib_path; #[derive(Clone, Debug)] -pub struct SearchPaths { - crate paths: Vec<(PathKind, PathBuf)>, -} - -pub struct Iter<'a> { - kind: PathKind, - iter: slice::Iter<'a, (PathKind, PathBuf)>, +pub struct SearchPath { + pub kind: PathKind, + pub dir: PathBuf, + pub files: Vec, } #[derive(Eq, PartialEq, Clone, Copy, Debug, PartialOrd, Ord, Hash)] @@ -32,12 +19,17 @@ pub enum PathKind { All, } -impl SearchPaths { - pub fn new() -> SearchPaths { - SearchPaths { paths: Vec::new() } +impl PathKind { + pub fn matches(&self, kind: PathKind) -> bool { + match (self, kind) { + (PathKind::All, _) | (_, PathKind::All) => true, + _ => *self == kind, + } } +} - pub fn add_path(&mut self, path: &str, output: config::ErrorOutputType) { +impl SearchPath { + pub fn from_cli_opt(path: &str, output: config::ErrorOutputType) -> Self { let (kind, path) = if path.starts_with("native=") { (PathKind::Native, &path["native=".len()..]) } else if path.starts_with("crate=") { @@ -54,35 +46,28 @@ impl SearchPaths { if path.is_empty() { early_error(output, "empty search path given via `-L`"); } - self.paths.push((kind, PathBuf::from(path))); - } - pub fn iter(&self, kind: PathKind) -> Iter<'_> { - Iter { kind: kind, iter: self.paths.iter() } + let dir = PathBuf::from(path); + Self::new(kind, dir) } -} -impl<'a> Iterator for Iter<'a> { - type Item = (&'a Path, PathKind); + pub fn from_sysroot_and_triple(sysroot: &Path, triple: &str) -> Self { + Self::new(PathKind::All, make_target_lib_path(sysroot, triple)) + } - fn next(&mut self) -> Option<(&'a Path, PathKind)> { - loop { - match self.iter.next() { - Some(&(kind, ref p)) if self.kind == PathKind::All || - kind == PathKind::All || - kind == self.kind => { - return Some((p, kind)) - } - Some(..) => {} - None => return None, + fn new(kind: PathKind, dir: PathBuf) -> Self { + // Get the files within the directory. + let files = match std::fs::read_dir(&dir) { + Ok(files) => { + files.filter_map(|p| { + p.ok().map(|s| s.path()) + }) + .collect::>() } - } - } + Err(..) => vec![], + }; - fn size_hint(&self) -> (usize, Option) { - // This iterator will never return more elements than the base iterator; - // but it can ignore all the remaining elements. - let (_, upper) = self.iter.size_hint(); - (0, upper) + SearchPath { kind, dir, files } } } + diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index c3cca149c2c..92004ece26d 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Support code for rustdoc and external tools . You really don't //! want to be using this unless you need to. @@ -138,7 +128,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { // the first evaluate_predicates call. // // The problem is this: most of rustc, including SelectionContext and traits::project, - // are designed to work with a concrete usage of a type (e.g. Vec + // are designed to work with a concrete usage of a type (e.g., Vec // fn() { Vec }. This information will generally never change - given // the 'T' in fn() { ... }, we'll never know anything else about 'T'. // If we're unable to prove that 'T' implements a particular trait, we're done - @@ -289,7 +279,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { // // One additional consideration is supertrait bounds. Normally, a ParamEnv is only ever // constructed once for a given type. As part of the construction process, the ParamEnv will - // have any supertrait bounds normalized - e.g. if we have a type 'struct Foo', the + // have any supertrait bounds normalized - e.g., if we have a type 'struct Foo', the // ParamEnv will contain 'T: Copy' and 'T: Clone', since 'Copy: Clone'. When we construct our // own ParamEnv, we need to do this ourselves, through traits::elaborate_predicates, or else // SelectionContext will choke on the missing predicates. However, this should never show up in @@ -334,11 +324,16 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { continue; } - let result = select.select(&Obligation::new(dummy_cause.clone(), new_env, pred)); + // Call infcx.resolve_type_vars_if_possible to see if we can + // get rid of any inference variables. + let obligation = infcx.resolve_type_vars_if_possible( + &Obligation::new(dummy_cause.clone(), new_env, pred) + ); + let result = select.select(&obligation); match &result { &Ok(Some(ref vtable)) => { - // If we see an explicit negative impl (e.g. 'impl !Send for MyStruct'), + // If we see an explicit negative impl (e.g., 'impl !Send for MyStruct'), // we immediately bail out, since it's impossible for us to continue. match vtable { Vtable::VtableImpl(VtableImplData { impl_def_id, .. }) => { @@ -369,7 +364,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { } &Ok(None) => {} &Err(SelectionError::Unimplemented) => { - if self.is_of_param(pred.skip_binder().trait_ref.substs) { + if self.is_param_no_infer(pred.skip_binder().trait_ref.substs) { already_visited.remove(&pred); self.add_user_pred( &mut user_computed_preds, @@ -393,12 +388,17 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { computed_preds.extend(user_computed_preds.iter().cloned()); let normalized_preds = elaborate_predicates(tcx, computed_preds.clone().into_iter().collect()); - new_env = ty::ParamEnv::new(tcx.mk_predicates(normalized_preds), param_env.reveal); + new_env = ty::ParamEnv::new( + tcx.mk_predicates(normalized_preds), + param_env.reveal, + None + ); } let final_user_env = ty::ParamEnv::new( tcx.mk_predicates(user_computed_preds.into_iter()), user_env.reveal, + None ); debug!( "evaluate_nested_obligations(ty_did={:?}, trait_did={:?}): succeeded with '{:?}' \ @@ -427,11 +427,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { // If we put both of these predicates in our computed ParamEnv, we'll // confuse SelectionContext, since it will (correctly) view both as being applicable. // - // To solve this, we pick the 'more strict' lifetime bound - i.e. the HRTB + // To solve this, we pick the 'more strict' lifetime bound - i.e., the HRTB // Our end goal is to generate a user-visible description of the conditions // under which a type implements an auto trait. A trait predicate involving // a HRTB means that the type needs to work with any choice of lifetime, - // not just one specific lifetime (e.g. 'static). + // not just one specific lifetime (e.g., 'static). fn add_user_pred<'c>( &self, user_computed_preds: &mut FxHashSet>, @@ -631,18 +631,28 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { finished_map } - pub fn is_of_param(&self, substs: &Substs<'_>) -> bool { - if substs.is_noop() { - return false; - } + fn is_param_no_infer(&self, substs: &Substs<'_>) -> bool { + return self.is_of_param(substs.type_at(0)) && + !substs.types().any(|t| t.has_infer_types()); + } - return match substs.type_at(0).sty { + pub fn is_of_param(&self, ty: Ty<'_>) -> bool { + return match ty.sty { ty::Param(_) => true, - ty::Projection(p) => self.is_of_param(p.substs), + ty::Projection(p) => self.is_of_param(p.self_ty()), _ => false, }; } + fn is_self_referential_projection(&self, p: ty::PolyProjectionPredicate<'_>) -> bool { + match p.ty().skip_binder().sty { + ty::Projection(proj) if proj == p.skip_binder().projection_ty => { + true + }, + _ => false + } + } + pub fn evaluate_nested_obligations< 'b, 'c, @@ -661,28 +671,77 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { ) -> bool { let dummy_cause = ObligationCause::misc(DUMMY_SP, ast::DUMMY_NODE_ID); - for (obligation, predicate) in nested - .filter(|o| o.recursion_depth == 1) + for (obligation, mut predicate) in nested .map(|o| (o.clone(), o.predicate.clone())) { let is_new_pred = fresh_preds.insert(self.clean_pred(select.infcx(), predicate.clone())); + // Resolve any inference variables that we can, to help selection succeed + predicate = select.infcx().resolve_type_vars_if_possible(&predicate); + + // We only add a predicate as a user-displayable bound if + // it involves a generic parameter, and doesn't contain + // any inference variables. + // + // Displaying a bound involving a concrete type (instead of a generic + // parameter) would be pointless, since it's always true + // (e.g. u8: Copy) + // Displaying an inference variable is impossible, since they're + // an internal compiler detail without a defined visual representation + // + // We check this by calling is_of_param on the relevant types + // from the various possible predicates match &predicate { &ty::Predicate::Trait(ref p) => { - let substs = &p.skip_binder().trait_ref.substs; + if self.is_param_no_infer(p.skip_binder().trait_ref.substs) + && !only_projections + && is_new_pred { - if self.is_of_param(substs) && !only_projections && is_new_pred { self.add_user_pred(computed_preds, predicate); } predicates.push_back(p.clone()); } &ty::Predicate::Projection(p) => { - // If the projection isn't all type vars, then - // we don't want to add it as a bound - if self.is_of_param(p.skip_binder().projection_ty.substs) && is_new_pred { - self.add_user_pred(computed_preds, predicate); - } else { + debug!("evaluate_nested_obligations: examining projection predicate {:?}", + predicate); + + // As described above, we only want to display + // bounds which include a generic parameter but don't include + // an inference variable. + // Additionally, we check if we've seen this predicate before, + // to avoid rendering duplicate bounds to the user. + if self.is_param_no_infer(p.skip_binder().projection_ty.substs) + && !p.ty().skip_binder().is_ty_infer() + && is_new_pred { + debug!("evaluate_nested_obligations: adding projection predicate\ + to computed_preds: {:?}", predicate); + + // Under unusual circumstances, we can end up with a self-refeential + // projection predicate. For example: + // ::Value == ::Value + // Not only is displaying this to the user pointless, + // having it in the ParamEnv will cause an issue if we try to call + // poly_project_and_unify_type on the predicate, since this kind of + // predicate will normally never end up in a ParamEnv. + // + // For these reasons, we ignore these weird predicates, + // ensuring that we're able to properly synthesize an auto trait impl + if self.is_self_referential_projection(p) { + debug!("evaluate_nested_obligations: encountered a projection + predicate equating a type with itself! Skipping"); + + } else { + self.add_user_pred(computed_preds, predicate); + } + } + + // We can only call poly_project_and_unify_type when our predicate's + // Ty contains an inference variable - otherwise, there won't be anything to + // unify + if p.ty().skip_binder().has_infer_types() { + debug!("Projecting and unifying projection predicate {:?}", + predicate); match poly_project_and_unify_type(select, &obligation.with(p.clone())) { Err(e) => { debug!( @@ -712,13 +771,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { } } &ty::Predicate::RegionOutlives(ref binder) => { - if select - .infcx() - .region_outlives_predicate(&dummy_cause, binder) - .is_err() - { - return false; - } + let () = select.infcx().region_outlives_predicate(&dummy_cause, binder); } &ty::Predicate::TypeOutlives(ref binder) => { match ( diff --git a/src/librustc/traits/chalk_fulfill.rs b/src/librustc/traits/chalk_fulfill.rs new file mode 100644 index 00000000000..df4e08e0eb5 --- /dev/null +++ b/src/librustc/traits/chalk_fulfill.rs @@ -0,0 +1,165 @@ +use traits::{ + Environment, + InEnvironment, + TraitEngine, + ObligationCause, + PredicateObligation, + FulfillmentError, + FulfillmentErrorCode, + SelectionError, +}; +use traits::query::NoSolution; +use infer::InferCtxt; +use infer::canonical::{Canonical, OriginalQueryValues}; +use ty::{self, Ty}; +use rustc_data_structures::fx::FxHashSet; + +pub type CanonicalGoal<'tcx> = Canonical<'tcx, InEnvironment<'tcx, ty::Predicate<'tcx>>>; + +pub struct FulfillmentContext<'tcx> { + obligations: FxHashSet>>, +} + +impl FulfillmentContext<'tcx> { + crate fn new() -> Self { + FulfillmentContext { + obligations: FxHashSet::default(), + } + } +} + +fn in_environment( + infcx: &InferCtxt<'_, 'gcx, 'tcx>, + obligation: PredicateObligation<'tcx> +) -> InEnvironment<'tcx, PredicateObligation<'tcx>> { + assert!(!infcx.is_in_snapshot()); + let obligation = infcx.resolve_type_vars_if_possible(&obligation); + + let environment = match obligation.param_env.def_id { + Some(def_id) => infcx.tcx.environment(def_id), + None if obligation.param_env.caller_bounds.is_empty() => Environment { + clauses: ty::List::empty(), + }, + _ => bug!("non-empty `ParamEnv` with no def-id"), + }; + + InEnvironment { + environment, + goal: obligation, + } +} + +impl TraitEngine<'tcx> for FulfillmentContext<'tcx> { + fn normalize_projection_type( + &mut self, + infcx: &InferCtxt<'_, 'gcx, 'tcx>, + _param_env: ty::ParamEnv<'tcx>, + projection_ty: ty::ProjectionTy<'tcx>, + _cause: ObligationCause<'tcx>, + ) -> Ty<'tcx> { + infcx.tcx.mk_ty(ty::Projection(projection_ty)) + } + + fn register_predicate_obligation( + &mut self, + infcx: &InferCtxt<'_, 'gcx, 'tcx>, + obligation: PredicateObligation<'tcx>, + ) { + self.obligations.insert(in_environment(infcx, obligation)); + } + + fn select_all_or_error( + &mut self, + infcx: &InferCtxt<'_, 'gcx, 'tcx>, + ) -> Result<(), Vec>> { + self.select_where_possible(infcx)?; + + if self.obligations.is_empty() { + Ok(()) + } else { + let errors = self.obligations.iter() + .map(|obligation| FulfillmentError { + obligation: obligation.goal.clone(), + code: FulfillmentErrorCode::CodeAmbiguity, + }) + .collect(); + Err(errors) + } + } + + fn select_where_possible( + &mut self, + infcx: &InferCtxt<'_, 'gcx, 'tcx>, + ) -> Result<(), Vec>> { + let mut errors = Vec::new(); + let mut next_round = FxHashSet::default(); + let mut making_progress; + + loop { + making_progress = false; + + // We iterate over all obligations, and record if we are able + // to unambiguously prove at least one obligation. + for obligation in self.obligations.drain() { + let mut orig_values = OriginalQueryValues::default(); + let canonical_goal = infcx.canonicalize_query(&InEnvironment { + environment: obligation.environment, + goal: obligation.goal.predicate, + }, &mut orig_values); + + match infcx.tcx.global_tcx().evaluate_goal(canonical_goal) { + Ok(response) => { + if response.is_proven() { + making_progress = true; + + match infcx.instantiate_query_response_and_region_obligations( + &obligation.goal.cause, + obligation.goal.param_env, + &orig_values, + &response + ) { + Ok(infer_ok) => next_round.extend( + infer_ok.obligations + .into_iter() + .map(|obligation| in_environment(infcx, obligation)) + ), + + Err(_err) => errors.push(FulfillmentError { + obligation: obligation.goal, + code: FulfillmentErrorCode::CodeSelectionError( + SelectionError::Unimplemented + ), + }), + } + } else { + // Ambiguous: retry at next round. + next_round.insert(obligation); + } + } + + Err(NoSolution) => errors.push(FulfillmentError { + obligation: obligation.goal, + code: FulfillmentErrorCode::CodeSelectionError( + SelectionError::Unimplemented + ), + }) + } + } + next_round = std::mem::replace(&mut self.obligations, next_round); + + if !making_progress { + break; + } + } + + if errors.is_empty() { + Ok(()) + } else { + Err(errors) + } + } + + fn pending_obligations(&self) -> Vec> { + self.obligations.iter().map(|obligation| obligation.goal.clone()).collect() + } +} diff --git a/src/librustc/traits/codegen/mod.rs b/src/librustc/traits/codegen/mod.rs index 4e88150a18a..94d56c2cbfc 100644 --- a/src/librustc/traits/codegen/mod.rs +++ b/src/librustc/traits/codegen/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file contains various trait resolution methods used by codegen. // They all assume regions can be erased and monomorphic types. It // seems likely that they should eventually be merged into more diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index 71b77909b82..4c7049c3662 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -1,19 +1,10 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! See rustc guide chapters on [trait-resolution] and [trait-specialization] for more info on how //! this works. //! -//! [trait-resolution]: https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html -//! [trait-specialization]: https://rust-lang-nursery.github.io/rustc-guide/traits/specialization.html +//! [trait-resolution]: https://rust-lang.github.io/rustc-guide/traits/resolution.html +//! [trait-specialization]: https://rust-lang.github.io/rustc-guide/traits/specialization.html +use infer::CombinedSnapshot; use hir::def_id::{DefId, LOCAL_CRATE}; use syntax_pos::DUMMY_SP; use traits::{self, Normalized, SelectionContext, Obligation, ObligationCause}; @@ -42,6 +33,17 @@ pub enum Conflict { pub struct OverlapResult<'tcx> { pub impl_header: ty::ImplHeader<'tcx>, pub intercrate_ambiguity_causes: Vec, + + /// True if the overlap might've been permitted before the shift + /// to universes. + pub involves_placeholder: bool, +} + +pub fn add_placeholder_note(err: &mut ::errors::DiagnosticBuilder<'_>) { + err.note(&format!( + "this behavior recently changed as a result of a bug fix; \ + see rust-lang/rust#56105 for details" + )); } /// If there are types that satisfy both impls, invokes `on_overlap` @@ -110,13 +112,22 @@ fn with_fresh_ty_vars<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, ' /// Can both impl `a` and impl `b` be satisfied by a common type (including /// `where` clauses)? If so, returns an `ImplHeader` that unifies the two impls. -fn overlap<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>, - a_def_id: DefId, - b_def_id: DefId) - -> Option> -{ +fn overlap<'cx, 'gcx, 'tcx>( + selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>, + a_def_id: DefId, + b_def_id: DefId, +) -> Option> { debug!("overlap(a_def_id={:?}, b_def_id={:?})", a_def_id, b_def_id); + selcx.infcx().probe(|snapshot| overlap_within_probe(selcx, a_def_id, b_def_id, snapshot)) +} + +fn overlap_within_probe( + selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>, + a_def_id: DefId, + b_def_id: DefId, + snapshot: &CombinedSnapshot<'_, 'tcx>, +) -> Option> { // For the purposes of this check, we don't bring any placeholder // types into scope; instead, we replace the generic types with // fresh type variables, and hence we do our evaluations in an @@ -164,7 +175,13 @@ fn overlap<'cx, 'gcx, 'tcx>(selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>, let impl_header = selcx.infcx().resolve_type_vars_if_possible(&a_impl_header); let intercrate_ambiguity_causes = selcx.take_intercrate_ambiguity_causes(); debug!("overlap: intercrate_ambiguity_causes={:#?}", intercrate_ambiguity_causes); - Some(OverlapResult { impl_header, intercrate_ambiguity_causes }) + + let involves_placeholder = match selcx.infcx().region_constraints_added_in_snapshot(snapshot) { + Some(true) => true, + _ => false, + }; + + Some(OverlapResult { impl_header, intercrate_ambiguity_causes, involves_placeholder }) } pub fn trait_ref_is_knowable<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, @@ -256,12 +273,12 @@ pub fn orphan_check<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, /// The current rule is that a trait-ref orphan checks in a crate C: /// /// 1. Order the parameters in the trait-ref in subst order - Self first, -/// others linearly (e.g. `>` is U < V < W). +/// others linearly (e.g., `>` is U < V < W). /// 2. Of these type parameters, there is at least one type parameter /// in which, walking the type as a tree, you can reach a type local /// to C where all types in-between are fundamental types. Call the /// first such parameter the "local key parameter". -/// - e.g. `Box` is OK, because you can visit LocalType +/// - e.g., `Box` is OK, because you can visit LocalType /// going through `Box`, which is fundamental. /// - similarly, `FundamentalPair, Box>` is OK for /// the same reason. @@ -269,7 +286,7 @@ pub fn orphan_check<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, /// not local), `Vec` is bad, because `Vec<->` is between /// the local type and the type parameter. /// 3. Every type parameter before the local key parameter is fully known in C. -/// - e.g. `impl T: Trait` is bad, because `T` might be +/// - e.g., `impl T: Trait` is bad, because `T` might be /// an unknown type. /// - but `impl LocalType: Trait` is OK, because `LocalType` /// occurs before `T`. @@ -277,7 +294,7 @@ pub fn orphan_check<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, /// through the parameter's type tree, must appear only as a subtree of /// a type local to C, with only fundamental types between the type /// local to C and the local key parameter. -/// - e.g. `Vec>>` (or equivalently `Box>>`) +/// - e.g., `Vec>>` (or equivalently `Box>>`) /// is bad, because the only local type with `T` as a subtree is /// `LocalType`, and `Vec<->` is between it and the type parameter. /// - similarly, `FundamentalPair, T>` is bad, because @@ -288,7 +305,7 @@ pub fn orphan_check<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, /// /// The orphan rules actually serve several different purposes: /// -/// 1. They enable link-safety - i.e. 2 mutually-unknowing crates (where +/// 1. They enable link-safety - i.e., 2 mutually-unknowing crates (where /// every type local to one crate is unknown in the other) can't implement /// the same trait-ref. This follows because it can be seen that no such /// type can orphan-check in 2 such crates. @@ -350,50 +367,75 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>, trait_ref); } - // First, create an ordered iterator over all the type parameters to the trait, with the self - // type appearing first. - // Find the first input type that either references a type parameter OR - // some local type. - for input_ty in trait_ref.input_types() { - if ty_is_local(tcx, input_ty, in_crate) { - debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty); - - // First local input type. Check that there are no - // uncovered type parameters. - let uncovered_tys = uncovered_tys(tcx, input_ty, in_crate); - for uncovered_ty in uncovered_tys { - if let Some(param) = uncovered_ty.walk() - .find(|t| is_possibly_remote_type(t, in_crate)) - { - debug!("orphan_check_trait_ref: uncovered type `{:?}`", param); - return Err(OrphanCheckErr::UncoveredTy(param)); - } + if tcx.features().re_rebalance_coherence { + // Given impl Trait for T0, an impl is valid only + // if at least one of the following is true: + // + // - Trait is a local trait + // (already checked in orphan_check prior to calling this function) + // - All of + // - At least one of the types T0..=Tn must be a local type. + // Let Ti be the first such type. + // - No uncovered type parameters P1..=Pn may appear in T0..Ti (excluding Ti) + // + for input_ty in trait_ref.input_types() { + debug!("orphan_check_trait_ref: check ty `{:?}`", input_ty); + if ty_is_local(tcx, input_ty, in_crate) { + debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty); + return Ok(()); + } else if let ty::Param(_) = input_ty.sty { + debug!("orphan_check_trait_ref: uncovered ty: `{:?}`", input_ty); + return Err(OrphanCheckErr::UncoveredTy(input_ty)) } - - // OK, found local type, all prior types upheld invariant. - return Ok(()); } + // If we exit above loop, never found a local type. + debug!("orphan_check_trait_ref: no local type"); + Err(OrphanCheckErr::NoLocalInputType) + } else { + // First, create an ordered iterator over all the type + // parameters to the trait, with the self type appearing + // first. Find the first input type that either references a + // type parameter OR some local type. + for input_ty in trait_ref.input_types() { + if ty_is_local(tcx, input_ty, in_crate) { + debug!("orphan_check_trait_ref: ty_is_local `{:?}`", input_ty); + + // First local input type. Check that there are no + // uncovered type parameters. + let uncovered_tys = uncovered_tys(tcx, input_ty, in_crate); + for uncovered_ty in uncovered_tys { + if let Some(param) = uncovered_ty.walk() + .find(|t| is_possibly_remote_type(t, in_crate)) + { + debug!("orphan_check_trait_ref: uncovered type `{:?}`", param); + return Err(OrphanCheckErr::UncoveredTy(param)); + } + } + + // OK, found local type, all prior types upheld invariant. + return Ok(()); + } - // Otherwise, enforce invariant that there are no type - // parameters reachable. - if let Some(param) = input_ty.walk() - .find(|t| is_possibly_remote_type(t, in_crate)) - { - debug!("orphan_check_trait_ref: uncovered type `{:?}`", param); - return Err(OrphanCheckErr::UncoveredTy(param)); + // Otherwise, enforce invariant that there are no type + // parameters reachable. + if let Some(param) = input_ty.walk() + .find(|t| is_possibly_remote_type(t, in_crate)) + { + debug!("orphan_check_trait_ref: uncovered type `{:?}`", param); + return Err(OrphanCheckErr::UncoveredTy(param)); + } } + // If we exit above loop, never found a local type. + debug!("orphan_check_trait_ref: no local type"); + Err(OrphanCheckErr::NoLocalInputType) } - - // If we exit above loop, never found a local type. - debug!("orphan_check_trait_ref: no local type"); - return Err(OrphanCheckErr::NoLocalInputType); } fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec> { if ty_is_local_constructor(ty, in_crate) { vec![] - } else if fundamental_ty(tcx, ty) { + } else if fundamental_ty(ty) { ty.walk_shallow() .flat_map(|t| uncovered_tys(tcx, t, in_crate)) .collect() @@ -411,14 +453,13 @@ fn is_possibly_remote_type(ty: Ty<'_>, _in_crate: InCrate) -> bool { fn ty_is_local(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'_>, in_crate: InCrate) -> bool { ty_is_local_constructor(ty, in_crate) || - fundamental_ty(tcx, ty) && ty.walk_shallow().any(|t| ty_is_local(tcx, t, in_crate)) + fundamental_ty(ty) && ty.walk_shallow().any(|t| ty_is_local(tcx, t, in_crate)) } -fn fundamental_ty(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'_>) -> bool { +fn fundamental_ty(ty: Ty<'_>) -> bool { match ty.sty { ty::Ref(..) => true, ty::Adt(def, _) => def.is_fundamental(), - ty::Dynamic(ref data, ..) => tcx.has_attr(data.principal().def_id(), "fundamental"), _ => false } } @@ -455,7 +496,7 @@ fn ty_is_local_constructor(ty: Ty<'_>, in_crate: InCrate) -> bool { false } - ty::Bound(..) | ty::Infer(..) => match in_crate { + ty::Placeholder(..) | ty::Bound(..) | ty::Infer(..) => match in_crate { InCrate::Local => false, // The inference variable might be unified with a local // type in that remote crate. @@ -465,7 +506,13 @@ fn ty_is_local_constructor(ty: Ty<'_>, in_crate: InCrate) -> bool { ty::Adt(def, _) => def_id_is_local(def.did, in_crate), ty::Foreign(did) => def_id_is_local(did, in_crate), - ty::Dynamic(ref tt, ..) => def_id_is_local(tt.principal().def_id(), in_crate), + ty::Dynamic(ref tt, ..) => { + if let Some(principal) = tt.principal() { + def_id_is_local(principal.def_id(), in_crate) + } else { + false + } + } ty::Error => true, diff --git a/src/librustc/traits/engine.rs b/src/librustc/traits/engine.rs index acbf5392cf5..c759a9ddf2c 100644 --- a/src/librustc/traits/engine.rs +++ b/src/librustc/traits/engine.rs @@ -1,18 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::InferCtxt; -use ty::{self, Ty, TyCtxt}; +use ty::{self, Ty, TyCtxt, ToPredicate}; +use traits::Obligation; use hir::def_id::DefId; -use super::{FulfillmentContext, FulfillmentError}; +use super::{ChalkFulfillmentContext, FulfillmentContext, FulfillmentError}; use super::{ObligationCause, PredicateObligation}; pub trait TraitEngine<'tcx>: 'tcx { @@ -24,6 +15,9 @@ pub trait TraitEngine<'tcx>: 'tcx { cause: ObligationCause<'tcx>, ) -> Ty<'tcx>; + /// Requires that `ty` must implement the trait with `def_id` in + /// the given environment. This trait must not have any type + /// parameters (except for `Self`). fn register_bound( &mut self, infcx: &InferCtxt<'_, 'gcx, 'tcx>, @@ -31,7 +25,18 @@ pub trait TraitEngine<'tcx>: 'tcx { ty: Ty<'tcx>, def_id: DefId, cause: ObligationCause<'tcx>, - ); + ) { + let trait_ref = ty::TraitRef { + def_id, + substs: infcx.tcx.mk_substs_trait(ty, &[]), + }; + self.register_predicate_obligation(infcx, Obligation { + cause, + recursion_depth: 0, + param_env, + predicate: trait_ref.to_predicate() + }); + } fn register_predicate_obligation( &mut self, @@ -73,7 +78,11 @@ impl> TraitEngineExt<'tcx> for T { } impl dyn TraitEngine<'tcx> { - pub fn new(_tcx: TyCtxt<'_, '_, 'tcx>) -> Box { - Box::new(FulfillmentContext::new()) + pub fn new(tcx: TyCtxt<'_, '_, 'tcx>) -> Box { + if tcx.sess.opts.debugging_opts.chalk { + Box::new(ChalkFulfillmentContext::new()) + } else { + Box::new(FulfillmentContext::new()) + } } } diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 2761a954cea..5debb119029 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::{ FulfillmentError, FulfillmentErrorCode, @@ -128,7 +118,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } - // returns if `cond` not occurring implies that `error` does not occur - i.e. that + // returns if `cond` not occurring implies that `error` does not occur - i.e., that // `error` occurring implies that `cond` occurs. fn error_implies(&self, cond: &ty::Predicate<'tcx>, @@ -281,7 +271,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { ty::Generator(..) => Some(18), ty::Foreign(..) => Some(19), ty::GeneratorWitness(..) => Some(20), - ty::Bound(..) | ty::Infer(..) | ty::Error => None, + ty::Placeholder(..) | ty::Bound(..) | ty::Infer(..) | ty::Error => None, ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"), } } @@ -428,9 +418,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { Some(format!("[{}]", self.tcx.type_of(def.did).to_string())), )); let tcx = self.tcx; - if let Some(len) = len.val.try_to_scalar().and_then(|scalar| { - scalar.to_usize(&tcx).ok() - }) { + if let Some(len) = len.assert_usize(tcx) { flags.push(( "_Self".to_owned(), Some(format!("[{}; {}]", self.tcx.type_of(def.did).to_string(), len)), @@ -483,7 +471,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } fn report_similar_impl_candidates(&self, - mut impl_candidates: Vec>, + impl_candidates: Vec>, err: &mut DiagnosticBuilder<'_>) { if impl_candidates.is_empty() { @@ -509,14 +497,18 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { }); // Sort impl candidates so that ordering is consistent for UI tests. - let normalized_impl_candidates = &mut impl_candidates[0..end] + let mut normalized_impl_candidates = impl_candidates .iter() .map(normalize) .collect::>(); + + // Sort before taking the `..end` range, + // because the ordering of `impl_candidates` may not be deterministic: + // https://github.com/rust-lang/rust/pull/57475#issuecomment-455519507 normalized_impl_candidates.sort(); err.help(&format!("the following implementations were found:{}{}", - normalized_impl_candidates.join(""), + normalized_impl_candidates[..end].join(""), if len > 5 { format!("\nand {} others", len - 4) } else { @@ -580,7 +572,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let mut err = struct_span_err!(self.tcx.sess, sp, E0276, "{}", msg); - if let Some(trait_item_span) = self.tcx.hir.span_if_local(trait_item_def_id) { + if let Some(trait_item_span) = self.tcx.hir().span_if_local(trait_item_def_id) { let span = self.tcx.sess.source_map().def_span(trait_item_span); err.span_label(span, format!("definition of `{}` from trait", item_name)); } @@ -738,12 +730,9 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } ty::Predicate::RegionOutlives(ref predicate) => { - let predicate = self.resolve_type_vars_if_possible(predicate); - let err = self.region_outlives_predicate(&obligation.cause, - &predicate).err().unwrap(); - struct_span_err!(self.tcx.sess, span, E0279, - "the requirement `{}` is not satisfied (`{}`)", - predicate, err) + // These errors should show up as region + // inference failures. + panic!("region outlives {:?} failed", predicate); } ty::Predicate::Projection(..) | ty::Predicate::TypeOutlives(..) => { @@ -765,8 +754,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { ty::Predicate::ClosureKind(closure_def_id, closure_substs, kind) => { let found_kind = self.closure_kind(closure_def_id, closure_substs).unwrap(); let closure_span = self.tcx.sess.source_map() - .def_span(self.tcx.hir.span_if_local(closure_def_id).unwrap()); - let node_id = self.tcx.hir.as_local_node_id(closure_def_id).unwrap(); + .def_span(self.tcx.hir().span_if_local(closure_def_id).unwrap()); + let node_id = self.tcx.hir().as_local_node_id(closure_def_id).unwrap(); let mut err = struct_span_err!( self.tcx.sess, closure_span, E0525, "expected a closure that implements the `{}` trait, \ @@ -785,7 +774,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // a particular trait. if let Some(tables) = self.in_progress_tables { let tables = tables.borrow(); - let closure_hir_id = self.tcx.hir.node_to_hir_id(node_id); + let closure_hir_id = self.tcx.hir().node_to_hir_id(node_id); match (found_kind, tables.closure_kind_origins().get(closure_hir_id)) { (ty::ClosureKind::FnOnce, Some((span, name))) => { err.span_label(*span, format!( @@ -806,12 +795,21 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } ty::Predicate::WellFormed(ty) => { - // WF predicates cannot themselves make - // errors. They can only block due to - // ambiguity; otherwise, they always - // degenerate into other obligations - // (which may fail). - span_bug!(span, "WF predicate not satisfied for {:?}", ty); + if !self.tcx.sess.opts.debugging_opts.chalk { + // WF predicates cannot themselves make + // errors. They can only block due to + // ambiguity; otherwise, they always + // degenerate into other obligations + // (which may fail). + span_bug!(span, "WF predicate not satisfied for {:?}", ty); + } else { + // FIXME: we'll need a better message which takes into account + // which bounds actually failed to hold. + self.tcx.sess.struct_span_err( + span, + &format!("the type `{}` is not well-formed (chalk)", ty) + ) + } } ty::Predicate::ConstEvaluatable(..) => { @@ -841,7 +839,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { }; let found_span = found_did.and_then(|did| - self.tcx.hir.span_if_local(did) + self.tcx.hir().span_if_local(did) ).map(|sp| self.tcx.sess.source_map().def_span(sp)); // the sp could be an fn def let found = match found_trait_ref.skip_binder().substs.type_at(1).sty { @@ -862,7 +860,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { expected_trait_ref) } else { let (closure_span, found) = found_did - .and_then(|did| self.tcx.hir.get_if_local(did)) + .and_then(|did| self.tcx.hir().get_if_local(did)) .map(|node| { let (found_span, found) = self.get_fn_like_arguments(node); (Some(found_span), found) @@ -901,12 +899,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { code: &ObligationCauseCode<'tcx>, err: &mut DiagnosticBuilder<'tcx>) { if let &ObligationCauseCode::VariableType(node_id) = code { - let parent_node = self.tcx.hir.get_parent_node(node_id); - if let Some(Node::Local(ref local)) = self.tcx.hir.find(parent_node) { + let parent_node = self.tcx.hir().get_parent_node(node_id); + if let Some(Node::Local(ref local)) = self.tcx.hir().find(parent_node) { if let Some(ref expr) = local.init { if let hir::ExprKind::Index(_, _) = expr.node { if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(expr.span) { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, "consider borrowing here", format!("&{}", snippet), @@ -954,7 +952,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let format_str = format!("consider removing {} leading `&`-references", remove_refs); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( sp, &format_str, String::new(), Applicability::MachineApplicable ); break; @@ -976,7 +974,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { node: hir::ExprKind::Closure(_, ref _decl, id, span, _), .. }) => { - (self.tcx.sess.source_map().def_span(span), self.tcx.hir.body(id).arguments.iter() + (self.tcx.sess.source_map().def_span(span), self.tcx.hir().body(id).arguments.iter() .map(|arg| { if let hir::Pat { node: hir::PatKind::Tuple(args, _), @@ -1037,7 +1035,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { ).collect::>()) } Node::StructCtor(ref variant_data) => { - (self.tcx.sess.source_map().def_span(self.tcx.hir.span(variant_data.id())), + (self.tcx.sess.source_map().def_span(self.tcx.hir().span(variant_data.id())), vec![ArgKind::empty(); variant_data.fields().len()]) } _ => panic!("non-FnLike node found: {:?}", node), @@ -1092,13 +1090,27 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { if let Some(found_span) = found_span { err.span_label(found_span, format!("takes {}", found_str)); + // move |_| { ... } + // ^^^^^^^^-- def_span + // + // move |_| { ... } + // ^^^^^-- prefix + let prefix_span = self.tcx.sess.source_map().span_until_non_whitespace(found_span); + // move |_| { ... } + // ^^^-- pipe_span + let pipe_span = if let Some(span) = found_span.trim_start(prefix_span) { + span + } else { + found_span + }; + // Suggest to take and ignore the arguments with expected_args_length `_`s if // found arguments is empty (assume the user just wants to ignore args in this case). // For example, if `expected_args_length` is 2, suggest `|_, _|`. if found_args.is_empty() && is_closure { let underscores = vec!["_"; expected_args.len()].join(", "); - err.span_suggestion_with_applicability( - found_span, + err.span_suggestion( + pipe_span, &format!( "consider changing the closure to take and ignore the expected argument{}", if expected_args.len() < 2 { @@ -1118,11 +1130,12 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { .map(|(name, _)| name.to_owned()) .collect::>() .join(", "); - err.span_suggestion_with_applicability(found_span, - "change the closure to take multiple \ - arguments instead of a single tuple", - format!("|{}|", sugg), - Applicability::MachineApplicable); + err.span_suggestion( + found_span, + "change the closure to take multiple arguments instead of a single tuple", + format!("|{}|", sugg), + Applicability::MachineApplicable, + ); } } if let &[ArgKind::Tuple(_, ref fields)] = &expected_args[..] { @@ -1150,12 +1163,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { String::new() }, ); - err.span_suggestion_with_applicability( + err.span_suggestion( found_span, - "change the closure to accept a tuple instead of \ - individual arguments", + "change the closure to accept a tuple instead of individual arguments", sugg, - Applicability::MachineApplicable + Applicability::MachineApplicable, ); } } @@ -1222,7 +1234,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { -> DiagnosticBuilder<'tcx> { assert!(type_def_id.is_local()); - let span = self.hir.span_if_local(type_def_id).unwrap(); + let span = self.hir().span_if_local(type_def_id).unwrap(); let span = self.sess.source_map().def_span(span); let mut err = struct_span_err!(self.sess, span, E0072, "recursive type `{}` has infinite size", @@ -1436,15 +1448,15 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { match *cause_code { ObligationCauseCode::ExprAssignable | ObligationCauseCode::MatchExpressionArm { .. } | - ObligationCauseCode::IfExpression | + ObligationCauseCode::MatchExpressionArmPattern { .. } | + ObligationCauseCode::IfExpression { .. } | ObligationCauseCode::IfExpressionWithNoElse | ObligationCauseCode::MainFunctionType | ObligationCauseCode::StartFunctionType | ObligationCauseCode::IntrinsicType | ObligationCauseCode::MethodReceiver | ObligationCauseCode::ReturnNoExpression | - ObligationCauseCode::MiscObligation => { - } + ObligationCauseCode::MiscObligation => {} ObligationCauseCode::SliceOrArrayElem => { err.note("slice and array elements must have `Sized` type"); } @@ -1468,7 +1480,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let item_name = tcx.item_path_str(item_def_id); let msg = format!("required by `{}`", item_name); - if let Some(sp) = tcx.hir.span_if_local(item_def_id) { + if let Some(sp) = tcx.hir().span_if_local(item_def_id) { let sp = tcx.sess.source_map().def_span(sp); err.span_note(sp, &msg); } else { diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index bc091a4e7e0..2e00d4d4b7c 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -1,29 +1,18 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::InferCtxt; use mir::interpret::{GlobalId, ErrorHandled}; -use ty::{self, Ty, TypeFoldable, ToPolyTraitRef, ToPredicate}; +use ty::{self, Ty, TypeFoldable, ToPolyTraitRef}; use ty::error::ExpectedFound; use rustc_data_structures::obligation_forest::{DoCompleted, Error, ForestObligation}; use rustc_data_structures::obligation_forest::{ObligationForest, ObligationProcessor}; use rustc_data_structures::obligation_forest::{ProcessResult}; use std::marker::PhantomData; -use hir::def_id::DefId; use super::CodeAmbiguity; use super::CodeProjectionError; use super::CodeSelectionError; use super::engine::{TraitEngine, TraitEngineExt}; use super::{FulfillmentError, FulfillmentErrorCode}; -use super::{ObligationCause, PredicateObligation, Obligation}; +use super::{ObligationCause, PredicateObligation}; use super::project; use super::select::SelectionContext; use super::{Unimplemented, ConstEvalFailure}; @@ -61,6 +50,16 @@ pub struct FulfillmentContext<'tcx> { // type-lives-for-region constraints, and because the type // is well-formed, the constraints should hold. register_region_obligations: bool, + // Is it OK to register obligations into this infcx inside + // an infcx snapshot? + // + // The "primary fulfillment" in many cases in typeck lives + // outside of any snapshot, so any use of it inside a snapshot + // will lead to trouble and therefore is checked against, but + // other fulfillment contexts sometimes do live inside of + // a snapshot (they don't *straddle* a snapshot, so there + // is no trouble there). + usable_in_snapshot: bool } #[derive(Clone, Debug)] @@ -74,14 +73,24 @@ impl<'a, 'gcx, 'tcx> FulfillmentContext<'tcx> { pub fn new() -> FulfillmentContext<'tcx> { FulfillmentContext { predicates: ObligationForest::new(), - register_region_obligations: true + register_region_obligations: true, + usable_in_snapshot: false, + } + } + + pub fn new_in_snapshot() -> FulfillmentContext<'tcx> { + FulfillmentContext { + predicates: ObligationForest::new(), + register_region_obligations: true, + usable_in_snapshot: true, } } pub fn new_ignoring_regions() -> FulfillmentContext<'tcx> { FulfillmentContext { predicates: ObligationForest::new(), - register_region_obligations: false + register_region_obligations: false, + usable_in_snapshot: false } } @@ -163,28 +172,6 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> { normalized_ty } - /// Requires that `ty` must implement the trait with `def_id` in - /// the given environment. This trait must not have any type - /// parameters (except for `Self`). - fn register_bound<'a, 'gcx>(&mut self, - infcx: &InferCtxt<'a, 'gcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, - ty: Ty<'tcx>, - def_id: DefId, - cause: ObligationCause<'tcx>) - { - let trait_ref = ty::TraitRef { - def_id, - substs: infcx.tcx.mk_substs_trait(ty, &[]), - }; - self.register_predicate_obligation(infcx, Obligation { - cause, - recursion_depth: 0, - param_env, - predicate: trait_ref.to_predicate() - }); - } - fn register_predicate_obligation<'a, 'gcx>(&mut self, infcx: &InferCtxt<'a, 'gcx, 'tcx>, obligation: PredicateObligation<'tcx>) @@ -195,7 +182,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> { debug!("register_predicate_obligation(obligation={:?})", obligation); - assert!(!infcx.is_in_snapshot()); + assert!(!infcx.is_in_snapshot() || self.usable_in_snapshot); self.predicates.register_obligation(PendingPredicateObligation { obligation, @@ -203,9 +190,10 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> { }); } - fn select_all_or_error<'a, 'gcx>(&mut self, - infcx: &InferCtxt<'a, 'gcx, 'tcx>) - -> Result<(),Vec>> + fn select_all_or_error<'a, 'gcx>( + &mut self, + infcx: &InferCtxt<'a, 'gcx, 'tcx> + ) -> Result<(),Vec>> { self.select_where_possible(infcx)?; @@ -294,7 +282,7 @@ impl<'a, 'b, 'gcx, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'gcx, if data.is_global() { // no type variables present, can use evaluation for better caching. // FIXME: consider caching errors too. - if self.selcx.infcx().predicate_must_hold(&obligation) { + if self.selcx.infcx().predicate_must_hold_considering_regions(&obligation) { debug!("selecting trait `{:?}` at depth {} evaluated to holds", data, obligation.recursion_depth); return ProcessResult::Changed(vec![]) @@ -343,10 +331,8 @@ impl<'a, 'b, 'gcx, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'gcx, } ty::Predicate::RegionOutlives(ref binder) => { - match self.selcx.infcx().region_outlives_predicate(&obligation.cause, binder) { - Ok(()) => ProcessResult::Changed(vec![]), - Err(_) => ProcessResult::Error(CodeSelectionError(Unimplemented)), - } + let () = self.selcx.infcx().region_outlives_predicate(&obligation.cause, binder); + ProcessResult::Changed(vec![]) } ty::Predicate::TypeOutlives(ref binder) => { diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index 8c3cd5e6612..68383bef37a 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -1,43 +1,50 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Trait Resolution. See [rustc guide] for more info on how this works. +//! Trait Resolution. See the [rustc guide] for more information on how this works. //! -//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html +//! [rustc guide]: https://rust-lang.github.io/rustc-guide/traits/resolution.html -pub use self::SelectionError::*; -pub use self::FulfillmentErrorCode::*; -pub use self::Vtable::*; -pub use self::ObligationCauseCode::*; +#[allow(dead_code)] +pub mod auto_trait; +mod chalk_fulfill; +mod coherence; +pub mod error_reporting; +mod engine; +mod fulfill; +mod project; +mod object_safety; +mod on_unimplemented; +mod select; +mod specialize; +mod structural_impls; +pub mod codegen; +mod util; +pub mod query; use chalk_engine; use hir; use hir::def_id::DefId; -use infer::SuppressRegionErrors; +use infer::{InferCtxt, SuppressRegionErrors}; use infer::outlives::env::OutlivesEnvironment; use middle::region; use mir::interpret::ErrorHandled; +use rustc_data_structures::sync::Lrc; +use syntax::ast; +use syntax_pos::{Span, DUMMY_SP}; use ty::subst::Substs; use ty::{self, AdtKind, List, Ty, TyCtxt, GenericParamDefKind, ToPredicate}; use ty::error::{ExpectedFound, TypeError}; use ty::fold::{TypeFolder, TypeFoldable, TypeVisitor}; -use infer::{InferCtxt}; use util::common::ErrorReported; -use rustc_data_structures::sync::Lrc; use std::fmt::Debug; use std::rc::Rc; -use syntax::ast; -use syntax_pos::{Span, DUMMY_SP}; -pub use self::coherence::{orphan_check, overlapping_impls, OrphanCheckErr, OverlapResult}; +pub use self::SelectionError::*; +pub use self::FulfillmentErrorCode::*; +pub use self::Vtable::*; +pub use self::ObligationCauseCode::*; + +pub use self::coherence::{add_placeholder_note, orphan_check, overlapping_impls}; +pub use self::coherence::{OrphanCheckErr, OverlapResult}; pub use self::fulfill::{FulfillmentContext, PendingPredicateObligation}; pub use self::project::MismatchedProjectionTypes; pub use self::project::{normalize, normalize_projection_type, poly_project_and_unify_type}; @@ -49,27 +56,22 @@ pub use self::select::{EvaluationCache, SelectionContext, SelectionCache}; pub use self::select::{EvaluationResult, IntercrateAmbiguityCause, OverflowError}; pub use self::specialize::{OverlapError, specialization_graph, translate_substs}; pub use self::specialize::find_associated_item; +pub use self::specialize::specialization_graph::FutureCompatOverlapError; +pub use self::specialize::specialization_graph::FutureCompatOverlapErrorKind; pub use self::engine::{TraitEngine, TraitEngineExt}; pub use self::util::{elaborate_predicates, elaborate_trait_ref, elaborate_trait_refs}; -pub use self::util::{supertraits, supertrait_def_ids, Supertraits, SupertraitDefIds}; -pub use self::util::transitive_bounds; +pub use self::util::{supertraits, supertrait_def_ids, transitive_bounds, + Supertraits, SupertraitDefIds}; -#[allow(dead_code)] -pub mod auto_trait; -mod coherence; -pub mod error_reporting; -mod engine; -mod fulfill; -mod project; -mod object_safety; -mod on_unimplemented; -mod select; -mod specialize; -mod structural_impls; -pub mod codegen; -mod util; +pub use self::chalk_fulfill::{ + CanonicalGoal as ChalkCanonicalGoal, + FulfillmentContext as ChalkFulfillmentContext +}; -pub mod query; +pub use self::ObligationCauseCode::*; +pub use self::FulfillmentErrorCode::*; +pub use self::SelectionError::*; +pub use self::Vtable::*; // Whether to enable bug compatibility with issue #43355 #[derive(Copy, Clone, PartialEq, Eq, Debug)] @@ -91,7 +93,7 @@ pub enum TraitQueryMode { Canonical, } -/// An `Obligation` represents some trait reference (e.g. `int:Eq`) for +/// An `Obligation` represents some trait reference (e.g., `int:Eq`) for /// which the vtable must be found. The process of finding a vtable is /// called "resolving" the `Obligation`. This process consists of /// either identifying an `impl` (e.g., `impl Eq for int`) that @@ -218,11 +220,20 @@ pub enum ObligationCauseCode<'tcx> { ExprAssignable, /// Computing common supertype in the arms of a match expression - MatchExpressionArm { arm_span: Span, - source: hir::MatchSource }, + MatchExpressionArm { + arm_span: Span, + source: hir::MatchSource, + }, + + /// Computing common supertype in the pattern guard for the arms of a match expression + MatchExpressionArmPattern { span: Span, ty: Ty<'tcx> }, /// Computing common supertype in an if expression - IfExpression, + IfExpression { + then: Span, + outer: Option, + semicolon: Option, + }, /// Computing common supertype of an if expression with no else counter-part IfExpressionWithNoElse, @@ -323,6 +334,7 @@ pub enum GoalKind<'tcx> { Not(Goal<'tcx>), DomainGoal(DomainGoal<'tcx>), Quantified(QuantifierKind, ty::Binder>), + Subtype(Ty<'tcx>, Ty<'tcx>), CannotProve, } @@ -345,9 +357,9 @@ impl<'tcx> DomainGoal<'tcx> { } impl<'tcx> GoalKind<'tcx> { - pub fn from_poly_domain_goal<'a>( + pub fn from_poly_domain_goal<'a, 'gcx>( domain_goal: PolyDomainGoal<'tcx>, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'a, 'gcx, 'tcx>, ) -> GoalKind<'tcx> { match domain_goal.no_bound_vars() { Some(p) => p.into_goal(), @@ -626,14 +638,14 @@ pub fn predicates_for_generics<'tcx>(cause: ObligationCause<'tcx>, /// `bound` or is not known to meet bound (note that this is /// conservative towards *no impl*, which is the opposite of the /// `evaluate` methods). -pub fn type_known_to_meet_bound<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, - ty: Ty<'tcx>, - def_id: DefId, - span: Span) --> bool -{ - debug!("type_known_to_meet_bound(ty={:?}, bound={:?})", +pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>( + infcx: &InferCtxt<'a, 'gcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + ty: Ty<'tcx>, + def_id: DefId, + span: Span, +) -> bool { + debug!("type_known_to_meet_bound_modulo_regions(ty={:?}, bound={:?})", ty, infcx.tcx.item_path_str(def_id)); @@ -648,7 +660,7 @@ pub fn type_known_to_meet_bound<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx predicate: trait_ref.to_predicate(), }; - let result = infcx.predicate_must_hold(&obligation); + let result = infcx.predicate_must_hold_modulo_regions(&obligation); debug!("type_known_to_meet_ty={:?} bound={} => {:?}", ty, infcx.tcx.item_path_str(def_id), result); @@ -675,13 +687,13 @@ pub fn type_known_to_meet_bound<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx // assume it is move; linear is always ok. match fulfill_cx.select_all_or_error(infcx) { Ok(()) => { - debug!("type_known_to_meet_bound: ty={:?} bound={} success", + debug!("type_known_to_meet_bound_modulo_regions: ty={:?} bound={} success", ty, infcx.tcx.item_path_str(def_id)); true } Err(e) => { - debug!("type_known_to_meet_bound: ty={:?} bound={} errors={:?}", + debug!("type_known_to_meet_bound_modulo_regions: ty={:?} bound={} errors={:?}", ty, infcx.tcx.item_path_str(def_id), e); @@ -809,8 +821,11 @@ pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, debug!("normalize_param_env_or_error: elaborated-predicates={:?}", predicates); - let elaborated_env = ty::ParamEnv::new(tcx.intern_predicates(&predicates), - unnormalized_env.reveal); + let elaborated_env = ty::ParamEnv::new( + tcx.intern_predicates(&predicates), + unnormalized_env.reveal, + unnormalized_env.def_id + ); // HACK: we are trying to normalize the param-env inside *itself*. The problem is that // normalization expects its param-env to be already normalized, which means we have @@ -857,8 +872,11 @@ pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // predicates here anyway. Keeping them here anyway because it seems safer. let outlives_env: Vec<_> = non_outlives_predicates.iter().chain(&outlives_predicates).cloned().collect(); - let outlives_env = ty::ParamEnv::new(tcx.intern_predicates(&outlives_env), - unnormalized_env.reveal); + let outlives_env = ty::ParamEnv::new( + tcx.intern_predicates(&outlives_env), + unnormalized_env.reveal, + None + ); let outlives_predicates = match do_normalize_predicates(tcx, region_context, cause, outlives_env, outlives_predicates) { @@ -874,7 +892,11 @@ pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let mut predicates = non_outlives_predicates; predicates.extend(outlives_predicates); debug!("normalize_param_env_or_error: final predicates={:?}", predicates); - ty::ParamEnv::new(tcx.intern_predicates(&predicates), unnormalized_env.reveal) + ty::ParamEnv::new( + tcx.intern_predicates(&predicates), + unnormalized_env.reveal, + unnormalized_env.def_id + ) } pub fn fully_normalize<'a, 'gcx, 'tcx, T>( @@ -955,7 +977,7 @@ fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx /// Given a trait `trait_ref`, iterates the vtable entries /// that come from `trait_ref`, including its supertraits. -#[inline] // FIXME(#35870) Avoid closures being unexported due to impl Trait. +#[inline] // FIXME(#35870): avoid closures being unexported due to `impl Trait`. fn vtable_methods<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) @@ -1052,6 +1074,7 @@ impl<'tcx,O> Obligation<'tcx,O> { } impl<'tcx> ObligationCause<'tcx> { + #[inline] pub fn new(span: Span, body_id: ast::NodeId, code: ObligationCauseCode<'tcx>) @@ -1168,14 +1191,26 @@ where ) -> bool; } -pub trait ExClauseLift<'tcx> +pub trait ChalkContextLift<'tcx> where Self: chalk_engine::context::Context + Clone, { type LiftedExClause: Debug + 'tcx; + type LiftedDelayedLiteral: Debug + 'tcx; + type LiftedLiteral: Debug + 'tcx; fn lift_ex_clause_to_tcx<'a, 'gcx>( ex_clause: &chalk_engine::ExClause, tcx: TyCtxt<'a, 'gcx, 'tcx>, ) -> Option; + + fn lift_delayed_literal_to_tcx<'a, 'gcx>( + ex_clause: &chalk_engine::DelayedLiteral, + tcx: TyCtxt<'a, 'gcx, 'tcx>, + ) -> Option; + + fn lift_literal_to_tcx<'a, 'gcx>( + ex_clause: &chalk_engine::Literal, + tcx: TyCtxt<'a, 'gcx, 'tcx>, + ) -> Option; } diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index c79fa386123..c37dc2a855e 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! "Object safety" refers to the ability for a trait to be converted //! to an object. In general, traits may only be converted to an //! object if all of their methods meet certain criteria. In particular, @@ -36,7 +26,7 @@ pub enum ObjectSafetyViolation { SizedSelf, /// Supertrait reference references `Self` an in illegal location - /// (e.g. `trait Foo : Bar`) + /// (e.g., `trait Foo : Bar`) SupertraitSelf, /// Method has something illegal @@ -81,7 +71,7 @@ pub enum MethodViolationCode { /// e.g., `fn foo(&self, x: Self)` or `fn foo(&self) -> Self` ReferencesSelf, - /// e.g. `fn foo(&self) where Self: Clone` + /// e.g., `fn foo(&self) where Self: Clone` WhereClauseReferencesSelf(Span), /// e.g., `fn foo()` @@ -190,7 +180,26 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { // In the case of a trait predicate, we can skip the "self" type. data.skip_binder().input_types().skip(1).any(|t| t.has_self_ty()) } - ty::Predicate::Projection(..) | + ty::Predicate::Projection(ref data) => { + // And similarly for projections. This should be redundant with + // the previous check because any projection should have a + // matching `Trait` predicate with the same inputs, but we do + // the check to be safe. + // + // Note that we *do* allow projection *outputs* to contain + // `self` (i.e., `trait Foo: Bar { type Result; }`), + // we just require the user to specify *both* outputs + // in the object type (i.e., `dyn Foo`). + // + // This is ALT2 in issue #56288, see that for discussion of the + // possible alternatives. + data.skip_binder() + .projection_ty + .trait_ref(self) + .input_types() + .skip(1) + .any(|t| t.has_self_ty()) + } ty::Predicate::WellFormed(..) | ty::Predicate::ObjectSafe(..) | ty::Predicate::TypeOutlives(..) | @@ -243,6 +252,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { method: &ty::AssociatedItem) -> Option { + debug!("object_safety_violation_for_method({:?}, {:?})", trait_def_id, method); // Any method that has a `Self : Sized` requisite is otherwise // exempt from the regulations. if self.generics_require_sized_self(method.def_id) { @@ -261,6 +271,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { method: &ty::AssociatedItem) -> bool { + debug!("is_vtable_safe_method({:?}, {:?})", trait_def_id, method); // Any method that has a `Self : Sized` requisite can't be called. if self.generics_require_sized_self(method.def_id) { return false; @@ -343,31 +354,44 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } }; - // e.g. Rc<()> + // e.g., Rc<()> let unit_receiver_ty = self.receiver_for_self_ty( receiver_ty, self.mk_unit(), method.def_id ); match abi_of_ty(unit_receiver_ty) { &Abi::Scalar(..) => (), - abi => bug!("Receiver when Self = () should have a Scalar ABI, found {:?}", abi) + abi => { + self.sess.delay_span_bug( + self.def_span(method.def_id), + &format!( + "Receiver when Self = () should have a Scalar ABI, found {:?}", + abi + ), + ); + } } let trait_object_ty = self.object_ty_for_trait( trait_def_id, self.mk_region(ty::ReStatic) ); - // e.g. Rc + // e.g., Rc let trait_object_receiver = self.receiver_for_self_ty( receiver_ty, trait_object_ty, method.def_id ); match abi_of_ty(trait_object_receiver) { &Abi::ScalarPair(..) => (), - abi => bug!( - "Receiver when Self = {} should have a ScalarPair ABI, found {:?}", - trait_object_ty, abi - ) + abi => { + self.sess.delay_span_bug( + self.def_span(method.def_id), + &format!( + "Receiver when Self = {} should have a ScalarPair ABI, found {:?}", + trait_object_ty, abi + ), + ); + } } } } @@ -376,10 +400,11 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } /// performs a type substitution to produce the version of receiver_ty when `Self = self_ty` - /// e.g. for receiver_ty = `Rc` and self_ty = `Foo`, returns `Rc` + /// e.g., for receiver_ty = `Rc` and self_ty = `Foo`, returns `Rc` fn receiver_for_self_ty( self, receiver_ty: Ty<'tcx>, self_ty: Ty<'tcx>, method_def_id: DefId ) -> Ty<'tcx> { + debug!("receiver_for_self_ty({:?}, {:?}, {:?})", receiver_ty, self_ty, method_def_id); let substs = Substs::for_item(self, method_def_id, |param, _| { if param.index == 0 { self_ty.into() @@ -388,7 +413,10 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } }); - receiver_ty.subst(self, substs) + let result = receiver_ty.subst(self, substs); + debug!("receiver_for_self_ty({:?}, {:?}, {:?}) = {:?}", + receiver_ty, self_ty, method_def_id, result); + result } /// creates the object type for the current trait. For example, @@ -404,18 +432,26 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { ); let mut associated_types = traits::supertraits(self, ty::Binder::dummy(trait_ref)) - .flat_map(|trait_ref| self.associated_items(trait_ref.def_id())) - .filter(|item| item.kind == ty::AssociatedKind::Type) + .flat_map(|super_trait_ref| { + self.associated_items(super_trait_ref.def_id()) + .map(move |item| (super_trait_ref, item)) + }) + .filter(|(_, item)| item.kind == ty::AssociatedKind::Type) .collect::>(); // existential predicates need to be in a specific order - associated_types.sort_by_key(|item| self.def_path_hash(item.def_id)); - - let projection_predicates = associated_types.into_iter().map(|item| { + associated_types.sort_by_cached_key(|(_, item)| self.def_path_hash(item.def_id)); + + let projection_predicates = associated_types.into_iter().map(|(super_trait_ref, item)| { + // We *can* get bound lifetimes here in cases like + // `trait MyTrait: for<'s> OtherTrait<&'s T, Output=bool>`. + // + // binder moved to (*)... + let super_trait_ref = super_trait_ref.skip_binder(); ty::ExistentialPredicate::Projection(ty::ExistentialProjection { - ty: self.mk_projection(item.def_id, trait_ref.substs), + ty: self.mk_projection(item.def_id, super_trait_ref.substs), item_def_id: item.def_id, - substs: trait_ref.substs, + substs: super_trait_ref.substs, }) }); @@ -424,7 +460,8 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { ); let object_ty = self.mk_dynamic( - ty::Binder::dummy(existential_predicates), + // (*) ... binder re-introduced here + ty::Binder::bind(existential_predicates), lifetime, ); @@ -451,7 +488,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { /// /// The only case where the receiver is not dispatchable, but is still a valid receiver /// type (just not object-safe), is when there is more than one level of pointer indirection. - /// e.g. `self: &&Self`, `self: &Rc`, `self: Box>`. In these cases, there + /// e.g., `self: &&Self`, `self: &Rc`, `self: Box>`. In these cases, there /// is no way, or at least no inexpensive way, to coerce the receiver from the version where /// `Self = dyn Trait` to the version where `Self = T`, where `T` is the unknown erased type /// contained by the trait object, because the object that needs to be coerced is behind @@ -559,7 +596,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { self.infer_ctxt().enter(|ref infcx| { // the receiver is dispatchable iff the obligation holds - infcx.predicate_must_hold(&obligation) + infcx.predicate_must_hold_modulo_regions(&obligation) }) } diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs index dcbddc03080..3ec901f50e4 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use fmt_macros::{Parser, Piece, Position}; use hir::def_id::DefId; @@ -167,10 +157,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedDirective { note: None, })) } else { - return Err(parse_error(tcx, attr.span, - "`#[rustc_on_unimplemented]` requires a value", - "value required here", - Some(r#"eg `#[rustc_on_unimplemented(message="foo")]`"#))); + return Err(ErrorReported); }; debug!("of_item({:?}/{:?}) = {:?}", trait_def_id, impl_def_id, result); result @@ -244,7 +231,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedFormatString { { let name = tcx.item_name(trait_def_id); let generics = tcx.generics_of(trait_def_id); - let parser = Parser::new(&self.0, None); + let parser = Parser::new(&self.0, None, vec![], false); let mut result = Ok(()); for token in parser { match token { @@ -303,7 +290,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedFormatString { }).collect::>(); let empty_string = String::new(); - let parser = Parser::new(&self.0, None); + let parser = Parser::new(&self.0, None, vec![], false); parser.map(|p| match p { Piece::String(s) => s, diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index b59bd0e2388..bec45046cb9 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Code for projecting associated types out of trait references. use super::elaborate_predicates; @@ -23,9 +13,8 @@ use super::{VtableImplData, VtableClosureData, VtableGeneratorData, VtableFnPoin use super::util; use hir::def_id::DefId; -use infer::{InferCtxt, InferOk}; +use infer::{InferCtxt, InferOk, LateBoundRegionConversionTime}; use infer::type_variable::TypeVariableOrigin; -use mir::interpret::ConstValue; use mir::interpret::{GlobalId}; use rustc_data_structures::snapshot_map::{Snapshot, SnapshotMap}; use syntax::ast::Ident; @@ -70,7 +59,7 @@ pub enum Reveal { /// be observable directly by the user, `Reveal::All` /// should not be used by checks which may expose /// type equality or type contents to the user. - /// There are some exceptions, e.g. around OIBITS and + /// There are some exceptions, e.g., around OIBITS and /// transmute-checking, which expose some details, but /// not the whole concrete type of the `impl Trait`. All, @@ -202,28 +191,12 @@ pub fn poly_project_and_unify_type<'cx, 'gcx, 'tcx>( obligation); let infcx = selcx.infcx(); - infcx.commit_if_ok(|snapshot| { - let (placeholder_predicate, placeholder_map) = - infcx.replace_late_bound_regions_with_placeholders(&obligation.predicate); - - let skol_obligation = obligation.with(placeholder_predicate); - let r = match project_and_unify_type(selcx, &skol_obligation) { - Ok(result) => { - let span = obligation.cause.span; - match infcx.leak_check(false, span, &placeholder_map, snapshot) { - Ok(()) => Ok(infcx.plug_leaks(placeholder_map, snapshot, result)), - Err(e) => { - debug!("poly_project_and_unify_type: leak check encountered error {:?}", e); - Err(MismatchedProjectionTypes { err: e }) - } - } - } - Err(e) => { - Err(e) - } - }; + infcx.commit_if_ok(|_| { + let (placeholder_predicate, _) = + infcx.replace_bound_vars_with_placeholders(&obligation.predicate); - r + let placeholder_obligation = obligation.with(placeholder_predicate); + project_and_unify_type(selcx, &placeholder_obligation) }) } @@ -420,11 +393,11 @@ impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssociatedTypeNormalizer<'a, } } - fn fold_const(&mut self, constant: &'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx> { - if let ConstValue::Unevaluated(def_id, substs) = constant.val { + fn fold_const(&mut self, constant: &'tcx ty::LazyConst<'tcx>) -> &'tcx ty::LazyConst<'tcx> { + if let ty::LazyConst::Unevaluated(def_id, substs) = *constant { let tcx = self.selcx.tcx().global_tcx(); if let Some(param_env) = self.tcx().lift_to_global(&self.param_env) { - if substs.needs_infer() || substs.has_skol() { + if substs.needs_infer() || substs.has_placeholders() { let identity_substs = Substs::identity_for_item(tcx, def_id); let instance = ty::Instance::resolve(tcx, param_env, def_id, identity_substs); if let Some(instance) = instance { @@ -433,8 +406,9 @@ impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssociatedTypeNormalizer<'a, promoted: None }; if let Ok(evaluated) = tcx.const_eval(param_env.and(cid)) { - let evaluated = evaluated.subst(self.tcx(), substs); - return self.fold_const(evaluated); + let substs = tcx.lift_to_global(&substs).unwrap(); + let evaluated = evaluated.subst(tcx, substs); + return tcx.intern_lazy_const(ty::LazyConst::Evaluated(evaluated)); } } } else { @@ -446,7 +420,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssociatedTypeNormalizer<'a, promoted: None }; if let Ok(evaluated) = tcx.const_eval(param_env.and(cid)) { - return self.fold_const(evaluated) + return tcx.intern_lazy_const(ty::LazyConst::Evaluated(evaluated)); } } } @@ -608,7 +582,7 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>( // created (and hence the new ones will quickly be // discarded as duplicated). But when doing trait // evaluation this is not the case, and dropping the trait - // evaluations can causes ICEs (e.g. #43132). + // evaluations can causes ICEs (e.g., #43132). debug!("opt_normalize_projection_type: \ found normalized ty `{:?}`", ty); @@ -1453,17 +1427,25 @@ fn confirm_callable_candidate<'cx, 'gcx, 'tcx>( fn confirm_param_env_candidate<'cx, 'gcx, 'tcx>( selcx: &mut SelectionContext<'cx, 'gcx, 'tcx>, obligation: &ProjectionTyObligation<'tcx>, - poly_projection: ty::PolyProjectionPredicate<'tcx>) + poly_cache_entry: ty::PolyProjectionPredicate<'tcx>) -> Progress<'tcx> { let infcx = selcx.infcx(); - let cause = obligation.cause.clone(); + let cause = &obligation.cause; let param_env = obligation.param_env; - let trait_ref = obligation.predicate.trait_ref(infcx.tcx); - match infcx.match_poly_projection_predicate(cause, param_env, poly_projection, trait_ref) { - Ok(InferOk { value: ty_match, obligations }) => { + + let (cache_entry, _) = + infcx.replace_bound_vars_with_fresh_vars( + cause.span, + LateBoundRegionConversionTime::HigherRankedType, + &poly_cache_entry); + + let cache_trait_ref = cache_entry.projection_ty.trait_ref(infcx.tcx); + let obligation_trait_ref = obligation.predicate.trait_ref(infcx.tcx); + match infcx.at(cause, param_env).eq(cache_trait_ref, obligation_trait_ref) { + Ok(InferOk { value: _, obligations }) => { Progress { - ty: ty_match.value, + ty: cache_entry.ty, obligations, } } @@ -1473,7 +1455,7 @@ fn confirm_param_env_candidate<'cx, 'gcx, 'tcx>( "Failed to unify obligation `{:?}` \ with poly_projection `{:?}`: {:?}", obligation, - poly_projection, + poly_cache_entry, e); } } @@ -1589,7 +1571,7 @@ fn assoc_ty_def<'cx, 'gcx, 'tcx>( /// When working with a fulfillment context, the derived obligations of each /// projection cache entry will be registered on the fulfillcx, so any users /// that can wait for a fulfillcx fixed point need not care about this. However, -/// users that don't wait for a fixed point (e.g. trait evaluation) have to +/// users that don't wait for a fixed point (e.g., trait evaluation) have to /// resolve the obligations themselves to make sure the projected result is /// ok and avoid issues like #43132. /// @@ -1637,7 +1619,7 @@ enum ProjectionCacheEntry<'tcx> { NormalizedTy(NormalizedTy<'tcx>), } -// NB: intentionally not Clone +// N.B., intentionally not Clone pub struct ProjectionCacheSnapshot { snapshot: Snapshot, } @@ -1652,15 +1634,15 @@ impl<'tcx> ProjectionCache<'tcx> { } pub fn rollback_to(&mut self, snapshot: ProjectionCacheSnapshot) { - self.map.rollback_to(&snapshot.snapshot); + self.map.rollback_to(snapshot.snapshot); } pub fn rollback_placeholder(&mut self, snapshot: &ProjectionCacheSnapshot) { - self.map.partial_rollback(&snapshot.snapshot, &|k| k.ty.has_re_skol()); + self.map.partial_rollback(&snapshot.snapshot, &|k| k.ty.has_re_placeholders()); } - pub fn commit(&mut self, snapshot: &ProjectionCacheSnapshot) { - self.map.commit(&snapshot.snapshot); + pub fn commit(&mut self, snapshot: ProjectionCacheSnapshot) { + self.map.commit(snapshot.snapshot); } /// Try to start normalize `key`; returns an error if @@ -1714,12 +1696,8 @@ impl<'tcx> ProjectionCache<'tcx> { /// to be a NormalizedTy. pub fn complete_normalized(&mut self, key: ProjectionCacheKey<'tcx>, ty: &NormalizedTy<'tcx>) { // We want to insert `ty` with no obligations. If the existing value - // already has no obligations (as is common) we can use `insert_noop` - // to do a minimal amount of work -- the HashMap insertion is skipped, - // and minimal changes are made to the undo log. - if ty.obligations.is_empty() { - self.map.insert_noop(); - } else { + // already has no obligations (as is common) we don't insert anything. + if !ty.obligations.is_empty() { self.map.insert(key, ProjectionCacheEntry::NormalizedTy(Normalized { value: ty.value, obligations: vec![] diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs index 99dc099d577..1fd2172212d 100644 --- a/src/librustc/traits/query/dropck_outlives.rs +++ b/src/librustc/traits/query/dropck_outlives.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::at::At; use infer::InferOk; use infer::canonical::OriginalQueryValues; @@ -55,8 +45,8 @@ impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> { let c_ty = self.infcx.canonicalize_query(&self.param_env.and(ty), &mut orig_values); let span = self.cause.span; debug!("c_ty = {:?}", c_ty); - match &gcx.dropck_outlives(c_ty) { - Ok(result) if result.is_proven() => { + if let Ok(result) = &gcx.dropck_outlives(c_ty) { + if result.is_proven() { if let Ok(InferOk { value, obligations }) = self.infcx.instantiate_query_response_and_region_obligations( self.cause, @@ -72,8 +62,6 @@ impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> { }; } } - - _ => { /* fallthrough to error-handling code below */ } } // Errors and ambiuity in dropck occur in two cases: @@ -82,10 +70,11 @@ impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> { // Either of these should have created an error before. tcx.sess .delay_span_bug(span, "dtorck encountered internal error"); - return InferOk { + + InferOk { value: vec![], obligations: vec![], - }; + } } } @@ -102,7 +91,7 @@ impl<'tcx> DropckOutlivesResult<'tcx> { span: Span, ty: Ty<'tcx>, ) { - for overflow_ty in self.overflows.iter().take(1) { + if let Some(overflow_ty) = self.overflows.iter().next() { let mut err = struct_span_err!( tcx.sess, span, @@ -228,7 +217,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) -> // (T1..Tn) and closures have same properties as T1..Tn -- // check if *any* of those are trivial. - ty::Tuple(ref tys) => tys.iter().cloned().all(|t| trivial_dropck_outlives(tcx, t)), + ty::Tuple(ref tys) => tys.iter().all(|t| trivial_dropck_outlives(tcx, t)), ty::Closure(def_id, ref substs) => substs .upvar_tys(def_id, tcx) .all(|t| trivial_dropck_outlives(tcx, t)), @@ -251,6 +240,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) -> | ty::Projection(..) | ty::Param(_) | ty::Opaque(..) + | ty::Placeholder(..) | ty::Infer(_) | ty::Bound(..) | ty::Generator(..) => false, diff --git a/src/librustc/traits/query/evaluate_obligation.rs b/src/librustc/traits/query/evaluate_obligation.rs index ca11c5f5a08..fdae7d83373 100644 --- a/src/librustc/traits/query/evaluate_obligation.rs +++ b/src/librustc/traits/query/evaluate_obligation.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::InferCtxt; use infer::canonical::OriginalQueryValues; use traits::{EvaluationResult, PredicateObligation, SelectionContext, @@ -26,11 +16,26 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { /// Evaluates whether the predicate can be satisfied in the given /// `ParamEnv`, and returns `false` if not certain. However, this is /// not entirely accurate if inference variables are involved. - pub fn predicate_must_hold( + /// + /// This version may conservatively fail when outlives obligations + /// are required. + pub fn predicate_must_hold_considering_regions( + &self, + obligation: &PredicateObligation<'tcx>, + ) -> bool { + self.evaluate_obligation_no_overflow(obligation).must_apply_considering_regions() + } + + /// Evaluates whether the predicate can be satisfied in the given + /// `ParamEnv`, and returns `false` if not certain. However, this is + /// not entirely accurate if inference variables are involved. + /// + /// This version ignores all outlives constraints. + pub fn predicate_must_hold_modulo_regions( &self, obligation: &PredicateObligation<'tcx>, ) -> bool { - self.evaluate_obligation_no_overflow(obligation) == EvaluationResult::EvaluatedToOk + self.evaluate_obligation_no_overflow(obligation).must_apply_modulo_regions() } /// Evaluate a given predicate, capturing overflow and propagating it back. diff --git a/src/librustc/traits/query/method_autoderef.rs b/src/librustc/traits/query/method_autoderef.rs new file mode 100644 index 00000000000..b4984e12378 --- /dev/null +++ b/src/librustc/traits/query/method_autoderef.rs @@ -0,0 +1,45 @@ +use rustc_data_structures::sync::Lrc; +use infer::canonical::{Canonical, QueryResponse}; +use ty::Ty; + +#[derive(Debug)] +pub struct CandidateStep<'tcx> { + pub self_ty: Canonical<'tcx, QueryResponse<'tcx, Ty<'tcx>>>, + pub autoderefs: usize, + // true if the type results from a dereference of a raw pointer. + // when assembling candidates, we include these steps, but not when + // picking methods. This so that if we have `foo: *const Foo` and `Foo` has methods + // `fn by_raw_ptr(self: *const Self)` and `fn by_ref(&self)`, then + // `foo.by_raw_ptr()` will work and `foo.by_ref()` won't. + pub from_unsafe_deref: bool, + pub unsize: bool, +} + +#[derive(Clone, Debug)] +pub struct MethodAutoderefStepsResult<'tcx> { + /// The valid autoderef steps that could be find. + pub steps: Lrc>>, + /// If Some(T), a type autoderef reported an error on. + pub opt_bad_ty: Option>>, + /// If `true`, `steps` has been truncated due to reaching the + /// recursion limit. + pub reached_recursion_limit: bool, +} + +#[derive(Debug)] +pub struct MethodAutoderefBadTy<'tcx> { + pub reached_raw_pointer: bool, + pub ty: Canonical<'tcx, QueryResponse<'tcx, Ty<'tcx>>>, +} + +impl_stable_hash_for!(struct MethodAutoderefBadTy<'tcx> { + reached_raw_pointer, ty +}); + +impl_stable_hash_for!(struct MethodAutoderefStepsResult<'tcx> { + reached_recursion_limit, steps, opt_bad_ty +}); + +impl_stable_hash_for!(struct CandidateStep<'tcx> { + self_ty, autoderefs, from_unsafe_deref, unsize +}); diff --git a/src/librustc/traits/query/mod.rs b/src/librustc/traits/query/mod.rs index 13683d85444..59f786025b2 100644 --- a/src/librustc/traits/query/mod.rs +++ b/src/librustc/traits/query/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Experimental types for the trait query interface. The methods //! defined in this module are all based on **canonicalization**, //! which makes a canonical query by replacing unbound inference @@ -21,6 +11,7 @@ use ty::{self, Ty}; pub mod dropck_outlives; pub mod evaluate_obligation; +pub mod method_autoderef; pub mod normalize; pub mod normalize_erasing_regions; pub mod outlives_bounds; diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs index 59b086e35de..be05445cfc6 100644 --- a/src/librustc/traits/query/normalize.rs +++ b/src/librustc/traits/query/normalize.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Code for the 'normalization' query. This consists of a wrapper //! which folds deeply, invoking the underlying //! `normalize_projection_ty` query when it encounters projections. @@ -15,7 +5,7 @@ use infer::at::At; use infer::canonical::OriginalQueryValues; use infer::{InferCtxt, InferOk}; -use mir::interpret::{ConstValue, GlobalId}; +use mir::interpret::GlobalId; use traits::project::Normalized; use traits::{Obligation, ObligationCause, PredicateObligation, Reveal}; use ty::fold::{TypeFoldable, TypeFolder}; @@ -198,11 +188,11 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx } } - fn fold_const(&mut self, constant: &'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx> { - if let ConstValue::Unevaluated(def_id, substs) = constant.val { + fn fold_const(&mut self, constant: &'tcx ty::LazyConst<'tcx>) -> &'tcx ty::LazyConst<'tcx> { + if let ty::LazyConst::Unevaluated(def_id, substs) = *constant { let tcx = self.infcx.tcx.global_tcx(); if let Some(param_env) = self.tcx().lift_to_global(&self.param_env) { - if substs.needs_infer() || substs.has_skol() { + if substs.needs_infer() || substs.has_placeholders() { let identity_substs = Substs::identity_for_item(tcx, def_id); let instance = ty::Instance::resolve(tcx, param_env, def_id, identity_substs); if let Some(instance) = instance { @@ -211,8 +201,9 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx promoted: None, }; if let Ok(evaluated) = tcx.const_eval(param_env.and(cid)) { - let evaluated = evaluated.subst(self.tcx(), substs); - return self.fold_const(evaluated); + let substs = tcx.lift_to_global(&substs).unwrap(); + let evaluated = evaluated.subst(tcx, substs); + return tcx.intern_lazy_const(ty::LazyConst::Evaluated(evaluated)); } } } else { @@ -224,7 +215,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx promoted: None, }; if let Ok(evaluated) = tcx.const_eval(param_env.and(cid)) { - return self.fold_const(evaluated) + return tcx.intern_lazy_const(ty::LazyConst::Evaluated(evaluated)); } } } diff --git a/src/librustc/traits/query/normalize_erasing_regions.rs b/src/librustc/traits/query/normalize_erasing_regions.rs index 1cb96a3e33f..e7034065bdf 100644 --- a/src/librustc/traits/query/normalize_erasing_regions.rs +++ b/src/librustc/traits/query/normalize_erasing_regions.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Methods for normalizing when you don't care about regions (and //! aren't doing type inference). If either of those things don't //! apply to you, use `infcx.normalize(...)`. diff --git a/src/librustc/traits/query/outlives_bounds.rs b/src/librustc/traits/query/outlives_bounds.rs index b3fae3bab34..1134cb1b2f5 100644 --- a/src/librustc/traits/query/outlives_bounds.rs +++ b/src/librustc/traits/query/outlives_bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::InferCtxt; use infer::canonical::OriginalQueryValues; use syntax::ast; diff --git a/src/librustc/traits/query/type_op/ascribe_user_type.rs b/src/librustc/traits/query/type_op/ascribe_user_type.rs index 23445781eb2..15f627b3ee8 100644 --- a/src/librustc/traits/query/type_op/ascribe_user_type.rs +++ b/src/librustc/traits/query/type_op/ascribe_user_type.rs @@ -1,38 +1,23 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse}; use traits::query::Fallible; use hir::def_id::DefId; -use mir::ProjectionKind; -use ty::{self, ParamEnvAnd, Ty, TyCtxt}; +use ty::{ParamEnvAnd, Ty, TyCtxt}; use ty::subst::UserSubsts; #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] pub struct AscribeUserType<'tcx> { pub mir_ty: Ty<'tcx>, - pub variance: ty::Variance, pub def_id: DefId, pub user_substs: UserSubsts<'tcx>, - pub projs: &'tcx ty::List>, } impl<'tcx> AscribeUserType<'tcx> { pub fn new( mir_ty: Ty<'tcx>, - variance: ty::Variance, def_id: DefId, user_substs: UserSubsts<'tcx>, - projs: &'tcx ty::List>, ) -> Self { - AscribeUserType { mir_ty, variance, def_id, user_substs, projs } + Self { mir_ty, def_id, user_substs } } } @@ -62,19 +47,19 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for AscribeUserType<'tcx> BraceStructTypeFoldableImpl! { impl<'tcx> TypeFoldable<'tcx> for AscribeUserType<'tcx> { - mir_ty, variance, def_id, user_substs, projs + mir_ty, def_id, user_substs } } BraceStructLiftImpl! { impl<'a, 'tcx> Lift<'tcx> for AscribeUserType<'a> { type Lifted = AscribeUserType<'tcx>; - mir_ty, variance, def_id, user_substs, projs + mir_ty, def_id, user_substs } } impl_stable_hash_for! { struct AscribeUserType<'tcx> { - mir_ty, variance, def_id, user_substs, projs + mir_ty, def_id, user_substs } } diff --git a/src/librustc/traits/query/type_op/custom.rs b/src/librustc/traits/query/type_op/custom.rs index 54860dd0434..0756d2eed8a 100644 --- a/src/librustc/traits/query/type_op/custom.rs +++ b/src/librustc/traits/query/type_op/custom.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::{InferCtxt, InferOk}; use std::fmt; use traits::query::Fallible; diff --git a/src/librustc/traits/query/type_op/eq.rs b/src/librustc/traits/query/type_op/eq.rs index 43dea442df6..7acb8ccb0d3 100644 --- a/src/librustc/traits/query/type_op/eq.rs +++ b/src/librustc/traits/query/type_op/eq.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse}; use traits::query::Fallible; use ty::{ParamEnvAnd, Ty, TyCtxt}; diff --git a/src/librustc/traits/query/type_op/implied_outlives_bounds.rs b/src/librustc/traits/query/type_op/implied_outlives_bounds.rs index d5233851db8..f4a825a669b 100644 --- a/src/librustc/traits/query/type_op/implied_outlives_bounds.rs +++ b/src/librustc/traits/query/type_op/implied_outlives_bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse}; use traits::query::outlives_bounds::OutlivesBound; use traits::query::Fallible; diff --git a/src/librustc/traits/query/type_op/mod.rs b/src/librustc/traits/query/type_op/mod.rs index d20d43cf757..6e5a6080976 100644 --- a/src/librustc/traits/query/type_op/mod.rs +++ b/src/librustc/traits/query/type_op/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::canonical::{ Canonical, Canonicalized, CanonicalizedQueryResponse, OriginalQueryValues, QueryRegionConstraint, QueryResponse, @@ -53,7 +43,7 @@ pub trait TypeOp<'gcx, 'tcx>: Sized + fmt::Debug { /// first canonicalize the key and then invoke the query on the tcx, /// which produces the resulting query region constraints. /// -/// [c]: https://rust-lang-nursery.github.io/rustc-guide/traits/canonicalization.html +/// [c]: https://rust-lang.github.io/rustc-guide/traits/canonicalization.html pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>: fmt::Debug + Sized + TypeFoldable<'tcx> + Lift<'gcx> { diff --git a/src/librustc/traits/query/type_op/normalize.rs b/src/librustc/traits/query/type_op/normalize.rs index c45e8b2554b..98afe2abdbf 100644 --- a/src/librustc/traits/query/type_op/normalize.rs +++ b/src/librustc/traits/query/type_op/normalize.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse}; use std::fmt; use traits::query::Fallible; diff --git a/src/librustc/traits/query/type_op/outlives.rs b/src/librustc/traits/query/type_op/outlives.rs index cd7c6d76eab..108aa373e03 100644 --- a/src/librustc/traits/query/type_op/outlives.rs +++ b/src/librustc/traits/query/type_op/outlives.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse}; use traits::query::dropck_outlives::trivial_dropck_outlives; use traits::query::dropck_outlives::DropckOutlivesResult; diff --git a/src/librustc/traits/query/type_op/prove_predicate.rs b/src/librustc/traits/query/type_op/prove_predicate.rs index 460ddb2a138..d9eb89c9fc7 100644 --- a/src/librustc/traits/query/type_op/prove_predicate.rs +++ b/src/librustc/traits/query/type_op/prove_predicate.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse}; use traits::query::Fallible; use ty::{ParamEnvAnd, Predicate, TyCtxt}; diff --git a/src/librustc/traits/query/type_op/subtype.rs b/src/librustc/traits/query/type_op/subtype.rs index 2b2939c644a..f001c7ea10a 100644 --- a/src/librustc/traits/query/type_op/subtype.rs +++ b/src/librustc/traits/query/type_op/subtype.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use infer::canonical::{Canonical, Canonicalized, CanonicalizedQueryResponse, QueryResponse}; use traits::query::Fallible; use ty::{ParamEnvAnd, Ty, TyCtxt}; diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 550c27ca0ab..6fe4a7a52be 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -1,16 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! See [rustc guide] for more info on how this works. +//! Candidate selection. See the [rustc guide] for more information on how this works. //! -//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html#selection +//! [rustc guide]: https://rust-lang.github.io/rustc-guide/traits/resolution.html#selection use self::EvaluationResult::*; use self::SelectionCandidate::*; @@ -39,7 +29,6 @@ use super::{ use dep_graph::{DepKind, DepNodeIndex}; use hir::def_id::DefId; -use infer; use infer::{InferCtxt, InferOk, TypeFreshener}; use middle::lang_items; use mir::interpret::GlobalId; @@ -53,9 +42,8 @@ use rustc_data_structures::bit_set::GrowableBitSet; use rustc_data_structures::sync::Lock; use rustc_target::spec::abi::Abi; use std::cmp; -use std::fmt; +use std::fmt::{self, Display}; use std::iter; -use std::mem; use std::rc::Rc; use util::nodemap::{FxHashMap, FxHashSet}; @@ -69,10 +57,10 @@ pub struct SelectionContext<'cx, 'gcx: 'cx + 'tcx, 'tcx: 'cx> { /// require themselves. freshener: TypeFreshener<'cx, 'gcx, 'tcx>, - /// If true, indicates that the evaluation should be conservative + /// If `true`, indicates that the evaluation should be conservative /// and consider the possibility of types outside this crate. /// This comes up primarily when resolving ambiguity. Imagine - /// there is some trait reference `$0 : Bar` where `$0` is an + /// there is some trait reference `$0: Bar` where `$0` is an /// inference variable. If `intercrate` is true, then we can never /// say for sure that this reference is not implemented, even if /// there are *no impls at all for `Bar`*, because `$0` could be @@ -80,7 +68,7 @@ pub struct SelectionContext<'cx, 'gcx: 'cx + 'tcx, 'tcx: 'cx> { /// `Bar`. This is the suitable mode for coherence. Elsewhere, /// though, we set this to false, because we are only interested /// in types that the user could actually have written --- in - /// other words, we consider `$0 : Bar` to be unimplemented if + /// other words, we consider `$0: Bar` to be unimplemented if /// there is no type that the user could *actually name* that /// would satisfy it. This avoids crippling inference, basically. intercrate: Option, @@ -338,7 +326,8 @@ enum BuiltinImplConditions<'tcx> { /// evaluations. /// /// The evaluation results are ordered: -/// - `EvaluatedToOk` implies `EvaluatedToAmbig` implies `EvaluatedToUnknown` +/// - `EvaluatedToOk` implies `EvaluatedToOkModuloRegions` +/// implies `EvaluatedToAmbig` implies `EvaluatedToUnknown` /// - `EvaluatedToErr` implies `EvaluatedToRecur` /// - the "union" of evaluation results is equal to their maximum - /// all the "potential success" candidates can potentially succeed, @@ -347,6 +336,8 @@ enum BuiltinImplConditions<'tcx> { pub enum EvaluationResult { /// Evaluation successful EvaluatedToOk, + /// Evaluation successful, but there were unevaluated region obligations + EvaluatedToOkModuloRegions, /// Evaluation is known to be ambiguous - it *might* hold for some /// assignment of inference variables, but it might not. /// @@ -410,9 +401,23 @@ pub enum EvaluationResult { } impl EvaluationResult { + /// True if this evaluation result is known to apply, even + /// considering outlives constraints. + pub fn must_apply_considering_regions(self) -> bool { + self == EvaluatedToOk + } + + /// True if this evaluation result is known to apply, ignoring + /// outlives constraints. + pub fn must_apply_modulo_regions(self) -> bool { + self <= EvaluatedToOkModuloRegions + } + pub fn may_apply(self) -> bool { match self { - EvaluatedToOk | EvaluatedToAmbig | EvaluatedToUnknown => true, + EvaluatedToOk | EvaluatedToOkModuloRegions | EvaluatedToAmbig | EvaluatedToUnknown => { + true + } EvaluatedToErr | EvaluatedToRecur => false, } @@ -422,13 +427,14 @@ impl EvaluationResult { match self { EvaluatedToUnknown | EvaluatedToRecur => true, - EvaluatedToOk | EvaluatedToAmbig | EvaluatedToErr => false, + EvaluatedToOk | EvaluatedToOkModuloRegions | EvaluatedToAmbig | EvaluatedToErr => false, } } } impl_stable_hash_for!(enum self::EvaluationResult { EvaluatedToOk, + EvaluatedToOkModuloRegions, EvaluatedToAmbig, EvaluatedToUnknown, EvaluatedToRecur, @@ -541,33 +547,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { self.infcx } - /// Wraps the inference context's in_snapshot s.t. snapshot handling is only from the selection - /// context's self. - fn in_snapshot(&mut self, f: F) -> R - where - F: FnOnce(&mut Self, &infer::CombinedSnapshot<'cx, 'tcx>) -> R, - { - self.infcx.in_snapshot(|snapshot| f(self, snapshot)) - } - - /// Wraps a probe s.t. obligations collected during it are ignored and old obligations are - /// retained. - fn probe(&mut self, f: F) -> R - where - F: FnOnce(&mut Self, &infer::CombinedSnapshot<'cx, 'tcx>) -> R, - { - self.infcx.probe(|snapshot| f(self, snapshot)) - } - - /// Wraps a commit_if_ok s.t. obligations collected during it are not returned in selection if - /// the transaction fails and s.t. old obligations are retained. - fn commit_if_ok(&mut self, f: F) -> Result - where - F: FnOnce(&mut Self, &infer::CombinedSnapshot<'cx, 'tcx>) -> Result, - { - self.infcx.commit_if_ok(|snapshot| f(self, snapshot)) - } - /////////////////////////////////////////////////////////////////////////// // Selection // @@ -649,8 +628,22 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { &mut self, obligation: &PredicateObligation<'tcx>, ) -> Result { - self.probe(|this, _| { - this.evaluate_predicate_recursively(TraitObligationStackList::empty(), obligation) + self.evaluation_probe(|this| { + this.evaluate_predicate_recursively(TraitObligationStackList::empty(), + obligation.clone()) + }) + } + + fn evaluation_probe( + &mut self, + op: impl FnOnce(&mut Self) -> Result, + ) -> Result { + self.infcx.probe(|snapshot| -> Result { + let result = op(self)?; + match self.infcx.region_constraints_added_in_snapshot(snapshot) { + None => Ok(result), + Some(_) => Ok(result.max(EvaluatedToOkModuloRegions)), + } }) } @@ -663,12 +656,12 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { predicates: I, ) -> Result where - I: IntoIterator>, + I: IntoIterator>, 'tcx: 'a, { let mut result = EvaluatedToOk; for obligation in predicates { - let eval = self.evaluate_predicate_recursively(stack, obligation)?; + let eval = self.evaluate_predicate_recursively(stack, obligation.clone())?; debug!( "evaluate_predicate_recursively({:?}) = {:?}", obligation, eval @@ -687,9 +680,19 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { fn evaluate_predicate_recursively<'o>( &mut self, previous_stack: TraitObligationStackList<'o, 'tcx>, - obligation: &PredicateObligation<'tcx>, + obligation: PredicateObligation<'tcx>, ) -> Result { - debug!("evaluate_predicate_recursively({:?})", obligation); + debug!("evaluate_predicate_recursively(previous_stack={:?}, obligation={:?})", + previous_stack.head(), obligation); + + // Previous_stack stores a TraitObligatiom, while 'obligation' is + // a PredicateObligation. These are distinct types, so we can't + // use any Option combinator method that would force them to be + // the same + match previous_stack.head() { + Some(h) => self.check_recursion_limit(&obligation, h.obligation)?, + None => self.check_recursion_limit(&obligation, &obligation)? + } match obligation.predicate { ty::Predicate::Trait(ref t) => { @@ -703,8 +706,9 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { match self.infcx .subtype_predicate(&obligation.cause, obligation.param_env, p) { - Some(Ok(InferOk { obligations, .. })) => { - self.evaluate_predicates_recursively(previous_stack, &obligations) + Some(Ok(InferOk { mut obligations, .. })) => { + self.add_depth(obligations.iter_mut(), obligation.recursion_depth); + self.evaluate_predicates_recursively(previous_stack,obligations.into_iter()) } Some(Err(_)) => Ok(EvaluatedToErr), None => Ok(EvaluatedToAmbig), @@ -718,98 +722,17 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { ty, obligation.cause.span, ) { - Some(obligations) => { - self.evaluate_predicates_recursively(previous_stack, obligations.iter()) + Some(mut obligations) => { + self.add_depth(obligations.iter_mut(), obligation.recursion_depth); + self.evaluate_predicates_recursively(previous_stack, obligations.into_iter()) } None => Ok(EvaluatedToAmbig), }, - ty::Predicate::TypeOutlives(ref binder) => { - assert!(!binder.has_escaping_bound_vars()); - // Check if the type has higher-ranked vars. - if binder.skip_binder().0.has_escaping_bound_vars() { - // If so, this obligation is an error (for now). Eventually we should be - // able to support additional cases here, like `for<'a> &'a str: 'a`. - - // NOTE: this hack is implemented in both trait fulfillment and - // evaluation. If you fix it in one place, make sure you fix it - // in the other. - - // We don't want to allow this sort of reasoning in intercrate - // mode, for backwards-compatibility reasons. - if self.intercrate.is_some() { - Ok(EvaluatedToAmbig) - } else { - Ok(EvaluatedToErr) - } - } else { - // If the type has no late bound vars, then if we assign all - // the inference variables in it to be 'static, then the type - // will be 'static itself. - // - // Therefore, `staticize(T): 'a` holds for any `'a`, so this - // obligation is fulfilled. Because evaluation works with - // staticized types (yes I know this is involved with #21974), - // we are 100% OK here. - Ok(EvaluatedToOk) - } - } - - ty::Predicate::RegionOutlives(ref binder) => { - let ty::OutlivesPredicate(r_a, r_b) = binder.skip_binder(); - - if r_a == r_b { - // for<'a> 'a: 'a. OK - Ok(EvaluatedToOk) - } else if **r_a == ty::ReStatic { - // 'static: 'x always holds. - // - // This special case is handled somewhat inconsistently - if we - // have an inference variable that is supposed to be equal to - // `'static`, then we don't allow it to be equated to an LBR, - // but if we have a literal `'static`, then we *do*. - // - // This is actually consistent with how our region inference works. - // - // It would appear that this sort of inconsistency would - // cause "instability" problems with evaluation caching. However, - // evaluation caching is only for trait predicates, and when - // trait predicates create nested obligations, they contain - // inference variables for all the regions in the trait - the - // only way this codepath can be reached from trait predicate - // evaluation is when the user typed an explicit `where 'static: 'a` - // lifetime bound (in which case we want to return EvaluatedToOk). - // - // If we ever want to handle inference variables that might be - // equatable with ReStatic, we need to make sure we are not confused by - // technically-allowed-by-RFC-447-but-probably-should-not-be - // impls such as - // ```Rust - // impl<'a, 's, T> X<'s> for T where T: Debug + 'a, 'a: 's - // ``` - Ok(EvaluatedToOk) - } else if r_a.is_late_bound() || r_b.is_late_bound() { - // There is no current way to prove `for<'a> 'a: 'x` - // unless `'a = 'x`, because there are no bounds involving - // lifetimes. - - // It might be possible to prove `for<'a> 'x: 'a` by forcing `'x` - // to be `'static`. However, this is not currently done by type - // inference unless `'x` is literally ReStatic. See the comment - // above. - - // We don't want to allow this sort of reasoning in intercrate - // mode, for backwards-compatibility reasons. - if self.intercrate.is_some() { - Ok(EvaluatedToAmbig) - } else { - Ok(EvaluatedToErr) - } - } else { - // Relating 2 inference variable regions. These will - // always hold if our query is "staticized". - Ok(EvaluatedToOk) - } + ty::Predicate::TypeOutlives(..) | ty::Predicate::RegionOutlives(..) => { + // we do not consider region relationships when + // evaluating trait matches + Ok(EvaluatedToOkModuloRegions) } ty::Predicate::ObjectSafe(trait_def_id) => { @@ -823,10 +746,11 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { ty::Predicate::Projection(ref data) => { let project_obligation = obligation.with(data.clone()); match project::poly_project_and_unify_type(self, &project_obligation) { - Ok(Some(subobligations)) => { + Ok(Some(mut subobligations)) => { + self.add_depth(subobligations.iter_mut(), obligation.recursion_depth); let result = self.evaluate_predicates_recursively( previous_stack, - subobligations.iter(), + subobligations.into_iter(), ); if let Some(key) = ProjectionCacheKey::from_poly_projection_predicate(self, data) @@ -1023,6 +947,11 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { { debug!("evaluate_stack({:?}) --> recursive", stack.fresh_trait_ref); + // Subtle: when checking for a coinductive cycle, we do + // not compare using the "freshened trait refs" (which + // have erased regions) but rather the fully explicit + // trait refs. This is important because it's only a cycle + // if the regions match exactly. let cycle = stack.iter().skip(1).take(rec_index + 1); let cycle = cycle.map(|stack| ty::Predicate::Trait(stack.obligation.predicate)); if self.coinductive_match(cycle) { @@ -1085,12 +1014,12 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { "evaluate_candidate: depth={} candidate={:?}", stack.obligation.recursion_depth, candidate ); - let result = self.probe(|this, _| { + let result = self.evaluation_probe(|this| { let candidate = (*candidate).clone(); match this.confirm_candidate(stack.obligation, candidate) { Ok(selection) => this.evaluate_predicates_recursively( stack.list(), - selection.nested_obligations().iter(), + selection.nested_obligations().into_iter() ), Err(..) => Ok(EvaluatedToErr), } @@ -1165,15 +1094,54 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { .insert(trait_ref, WithDepNode::new(dep_node, result)); } + // For various reasons, it's possible for a subobligation + // to have a *lower* recursion_depth than the obligation used to create it. + // Projection sub-obligations may be returned from the projection cache, + // which results in obligations with an 'old' recursion_depth. + // Additionally, methods like ty::wf::obligations and + // InferCtxt.subtype_predicate produce subobligations without + // taking in a 'parent' depth, causing the generated subobligations + // to have a recursion_depth of 0 + // + // To ensure that obligation_depth never decreasees, we force all subobligations + // to have at least the depth of the original obligation. + fn add_depth>>(&self, it: I, + min_depth: usize) { + it.for_each(|o| o.recursion_depth = cmp::max(min_depth, o.recursion_depth) + 1); + } + + // Check that the recursion limit has not been exceeded. + // + // The weird return type of this function allows it to be used with the 'try' (?) + // operator within certain functions + fn check_recursion_limit, V: Display + TypeFoldable<'tcx>>( + &self, + obligation: &Obligation<'tcx, T>, + error_obligation: &Obligation<'tcx, V> + ) -> Result<(), OverflowError> { + let recursion_limit = *self.infcx.tcx.sess.recursion_limit.get(); + if obligation.recursion_depth >= recursion_limit { + match self.query_mode { + TraitQueryMode::Standard => { + self.infcx().report_overflow_error(error_obligation, true); + } + TraitQueryMode::Canonical => { + return Err(OverflowError); + } + } + } + Ok(()) + } + /////////////////////////////////////////////////////////////////////////// // CANDIDATE ASSEMBLY // // The selection process begins by examining all in-scope impls, // caller obligations, and so forth and assembling a list of - // candidates. See [rustc guide] for more details. + // candidates. See the [rustc guide] for more details. // // [rustc guide]: - // https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html#candidate-assembly + // https://rust-lang.github.io/rustc-guide/traits/resolution.html#candidate-assembly fn candidate_from_obligation<'o>( &mut self, @@ -1181,17 +1149,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { ) -> SelectionResult<'tcx, SelectionCandidate<'tcx>> { // Watch out for overflow. This intentionally bypasses (and does // not update) the cache. - let recursion_limit = *self.infcx.tcx.sess.recursion_limit.get(); - if stack.obligation.recursion_depth >= recursion_limit { - match self.query_mode { - TraitQueryMode::Standard => { - self.infcx().report_overflow_error(&stack.obligation, true); - } - TraitQueryMode::Canonical => { - return Err(Overflow); - } - } - } + self.check_recursion_limit(&stack.obligation, &stack.obligation)?; + // Check the cache. Note that we freshen the trait-ref // separately rather than using `stack.fresh_trait_ref` -- @@ -1615,7 +1574,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { }; if obligation.predicate.skip_binder().self_ty().is_ty_var() { - // Self is a type variable (e.g. `_: AsRef`). + // Self is a type variable (e.g., `_: AsRef`). // // This is somewhat problematic, as the current scheme can't really // handle it turning to be a projection. This does end up as truly @@ -1664,7 +1623,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { self.assemble_candidates_for_unsizing(obligation, &mut candidates); } else { if lang_items.clone_trait() == Some(def_id) { - // Same builtin conditions as `Copy`, i.e. every type which has builtin support + // Same builtin conditions as `Copy`, i.e., every type which has builtin support // for `Copy` also has builtin support for `Clone`, + tuples and arrays of `Clone` // types have builtin support for `Clone`. let clone_conditions = self.copy_clone_conditions(obligation); @@ -1709,8 +1668,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { _ => return, } - let result = self.probe(|this, snapshot| { - this.match_projection_obligation_against_definition_bounds(obligation, snapshot) + let result = self.infcx.probe(|_| { + self.match_projection_obligation_against_definition_bounds(obligation) }); if result { @@ -1721,16 +1680,15 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { fn match_projection_obligation_against_definition_bounds( &mut self, obligation: &TraitObligation<'tcx>, - snapshot: &infer::CombinedSnapshot<'cx, 'tcx>, ) -> bool { let poly_trait_predicate = self.infcx() .resolve_type_vars_if_possible(&obligation.predicate); - let (skol_trait_predicate, placeholder_map) = self.infcx() - .replace_late_bound_regions_with_placeholders(&poly_trait_predicate); + let (skol_trait_predicate, _) = self.infcx() + .replace_bound_vars_with_placeholders(&poly_trait_predicate); debug!( "match_projection_obligation_against_definition_bounds: \ - skol_trait_predicate={:?} placeholder_map={:?}", - skol_trait_predicate, placeholder_map + skol_trait_predicate={:?}", + skol_trait_predicate, ); let (def_id, substs) = match skol_trait_predicate.trait_ref.self_ty().sty { @@ -1762,13 +1720,11 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { let matching_bound = util::elaborate_predicates(self.tcx(), bounds.predicates) .filter_to_traits() .find(|bound| { - self.probe(|this, _| { - this.match_projection( + self.infcx.probe(|_| { + self.match_projection( obligation, bound.clone(), skol_trait_predicate.trait_ref.clone(), - &placeholder_map, - snapshot, ) }) }); @@ -1786,12 +1742,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { obligation, bound, skol_trait_predicate.trait_ref.clone(), - &placeholder_map, - snapshot, ); - self.infcx.pop_placeholders(placeholder_map, snapshot); - assert!(result); true } @@ -1803,20 +1755,11 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { obligation: &TraitObligation<'tcx>, trait_bound: ty::PolyTraitRef<'tcx>, skol_trait_ref: ty::TraitRef<'tcx>, - placeholder_map: &infer::PlaceholderMap<'tcx>, - snapshot: &infer::CombinedSnapshot<'cx, 'tcx>, ) -> bool { debug_assert!(!skol_trait_ref.has_escaping_bound_vars()); - if self.infcx + self.infcx .at(&obligation.cause, obligation.param_env) .sup(ty::Binder::dummy(skol_trait_ref), trait_bound) - .is_err() - { - return false; - } - - self.infcx - .leak_check(false, obligation.cause.span, placeholder_map, snapshot) .is_ok() } @@ -1865,10 +1808,10 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { stack: &TraitObligationStack<'o, 'tcx>, where_clause_trait_ref: ty::PolyTraitRef<'tcx>, ) -> Result { - self.probe(move |this, _| { + self.evaluation_probe(|this| { match this.match_where_clause_trait_ref(stack.obligation, where_clause_trait_ref) { Ok(obligations) => { - this.evaluate_predicates_recursively(stack.list(), obligations.iter()) + this.evaluate_predicates_recursively(stack.list(), obligations.into_iter()) } Err(()) => Ok(EvaluatedToErr), } @@ -2018,14 +1961,10 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { obligation.predicate.def_id(), obligation.predicate.skip_binder().trait_ref.self_ty(), |impl_def_id| { - self.probe(|this, snapshot| { - if let Ok(placeholder_map) = this.match_impl(impl_def_id, obligation, snapshot) + self.infcx.probe(|_| { + if let Ok(_substs) = self.match_impl(impl_def_id, obligation) { candidates.vec.push(ImplCandidate(impl_def_id)); - - // NB: we can safely drop the placeholder map - // since we are in a probe. - mem::drop(placeholder_map); } }); }, @@ -2069,7 +2008,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // that this obligation holds. That could be a // where-clause or, in the case of an object type, // it could be that the object type lists the - // trait (e.g. `Foo+Send : Send`). See + // trait (e.g., `Foo+Send : Send`). See // `compile-fail/typeck-default-trait-impl-send-param.rs` // for an example of a test case that exercises // this path. @@ -2078,6 +2017,24 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // the auto impl might apply, we don't know candidates.ambiguous = true; } + ty::Generator(_, _, movability) + if self.tcx().lang_items().unpin_trait() == Some(def_id) => + { + match movability { + hir::GeneratorMovability::Static => { + // Immovable generators are never `Unpin`, so + // suppress the normal auto-impl candidate for it. + } + hir::GeneratorMovability::Movable => { + // Movable generators are always `Unpin`, so add an + // unconditional builtin candidate. + candidates.vec.push(BuiltinCandidate { + has_nested: false, + }); + } + } + } + _ => candidates.vec.push(AutoImplCandidate(def_id.clone())), } } @@ -2096,11 +2053,11 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { obligation.self_ty().skip_binder() ); - self.probe(|this, _snapshot| { - // the code below doesn't care about regions, and the + self.infcx.probe(|_snapshot| { + // The code below doesn't care about regions, and the // self-ty here doesn't escape this probe, so just erase // any LBR. - let self_ty = this.tcx().erase_late_bound_regions(&obligation.self_ty()); + let self_ty = self.tcx().erase_late_bound_regions(&obligation.self_ty()); let poly_trait_ref = match self_ty.sty { ty::Dynamic(ref data, ..) => { if data.auto_traits() @@ -2114,7 +2071,12 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { return; } - data.principal().with_self_ty(this.tcx(), self_ty) + if let Some(principal) = data.principal() { + principal.with_self_ty(self.tcx(), self_ty) + } else { + // Only auto-trait bounds exist. + return; + } } ty::Infer(ty::TyVar(_)) => { debug!("assemble_candidates_from_object_ty: ambiguous"); @@ -2134,18 +2096,18 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // correct trait, but also the correct type parameters. // For example, we may be trying to upcast `Foo` to `Bar`, // but `Foo` is declared as `trait Foo : Bar`. - let upcast_trait_refs = util::supertraits(this.tcx(), poly_trait_ref) + let upcast_trait_refs = util::supertraits(self.tcx(), poly_trait_ref) .filter(|upcast_trait_ref| { - this.probe(|this, _| { + self.infcx.probe(|_| { let upcast_trait_ref = upcast_trait_ref.clone(); - this.match_poly_trait_ref(obligation, upcast_trait_ref) + self.match_poly_trait_ref(obligation, upcast_trait_ref) .is_ok() }) }) .count(); if upcast_trait_refs > 1 { - // can be upcast in many ways; need more type information + // Can be upcast in many ways; need more type information. candidates.ambiguous = true; } else if upcast_trait_refs == 1 { candidates.vec.push(ObjectCandidate); @@ -2197,8 +2159,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { (&ty::Dynamic(ref data_a, ..), &ty::Dynamic(ref data_b, ..)) => { // Upcasts permit two things: // - // 1. Dropping builtin bounds, e.g. `Foo+Send` to `Foo` - // 2. Tightening the region bound, e.g. `Foo+'a` to `Foo+'b` if `'a : 'b` + // 1. Dropping builtin bounds, e.g., `Foo+Send` to `Foo` + // 2. Tightening the region bound, e.g., `Foo+'a` to `Foo+'b` if `'a : 'b` // // Note that neither of these changes requires any // change at runtime. Eventually this will be @@ -2206,7 +2168,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // // We always upcast when we can because of reason // #2 (region bounds). - data_a.principal().def_id() == data_b.principal().def_id() + data_a.principal_def_id() == data_b.principal_def_id() && data_b.auto_traits() // All of a's auto traits need to be in b's auto traits. .all(|b| data_a.auto_traits().any(|a| a == b)) @@ -2254,7 +2216,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { let def_id = obligation.predicate.def_id(); - if ty::is_trait_alias(self.tcx(), def_id) { + if self.tcx().is_trait_alias(def_id) { candidates.vec.push(TraitAliasCandidate(def_id.clone())); } @@ -2354,13 +2316,14 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { ImplCandidate(other_def) => { // See if we can toss out `victim` based on specialization. // This requires us to know *for sure* that the `other` impl applies - // i.e. EvaluatedToOk: - if other.evaluation == EvaluatedToOk { + // i.e., EvaluatedToOk: + if other.evaluation.must_apply_modulo_regions() { match victim.candidate { ImplCandidate(victim_def) => { let tcx = self.tcx().global_tcx(); return tcx.specializes((other_def, victim_def)) - || tcx.impls_are_allowed_to_overlap(other_def, victim_def); + || tcx.impls_are_allowed_to_overlap( + other_def, victim_def).is_some(); } ParamCandidate(ref cand) => { // Prefer the impl to a global where clause candidate. @@ -2382,7 +2345,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { ParamCandidate(ref cand) => { // Prefer these to a global where-clause bound // (see issue #50825) - is_global(cand) && other.evaluation == EvaluatedToOk + is_global(cand) && other.evaluation.must_apply_modulo_regions() } _ => false, } @@ -2470,7 +2433,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { ty::Infer(ty::TyVar(_)) => Ambiguous, ty::UnnormalizedProjection(..) - | ty::Bound(_) + | ty::Placeholder(..) + | ty::Bound(..) | ty::Infer(ty::FreshTy(_)) | ty::Infer(ty::FreshIntTy(_)) | ty::Infer(ty::FreshFloatTy(_)) => { @@ -2555,7 +2519,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } ty::UnnormalizedProjection(..) - | ty::Bound(_) + | ty::Placeholder(..) + | ty::Bound(..) | ty::Infer(ty::FreshTy(_)) | ty::Infer(ty::FreshIntTy(_)) | ty::Infer(ty::FreshFloatTy(_)) => { @@ -2594,11 +2559,12 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { | ty::Char => Vec::new(), ty::UnnormalizedProjection(..) + | ty::Placeholder(..) | ty::Dynamic(..) | ty::Param(..) | ty::Foreign(..) | ty::Projection(..) - | ty::Bound(_) + | ty::Bound(..) | ty::Infer(ty::TyVar(_)) | ty::Infer(ty::FreshTy(_)) | ty::Infer(ty::FreshIntTy(_)) @@ -2680,20 +2646,20 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // binder moved -\ let ty: ty::Binder> = ty::Binder::bind(ty); // <----/ - self.in_snapshot(|this, snapshot| { - let (skol_ty, placeholder_map) = this.infcx() - .replace_late_bound_regions_with_placeholders(&ty); + self.infcx.in_snapshot(|_| { + let (skol_ty, _) = self.infcx + .replace_bound_vars_with_placeholders(&ty); let Normalized { value: normalized_ty, mut obligations, } = project::normalize_with_depth( - this, + self, param_env, cause.clone(), recursion_depth, &skol_ty, ); - let skol_obligation = this.tcx().predicate_for_trait_def( + let skol_obligation = self.tcx().predicate_for_trait_def( param_env, cause.clone(), trait_def_id, @@ -2702,8 +2668,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { &[], ); obligations.push(skol_obligation); - this.infcx() - .plug_leaks(placeholder_map, snapshot, obligations) + obligations }) }) .collect() @@ -2714,10 +2679,10 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // // Confirmation unifies the output type parameters of the trait // with the values found in the obligation, possibly yielding a - // type error. See [rustc guide] for more details. + // type error. See the [rustc guide] for more details. // // [rustc guide]: - // https://rust-lang-nursery.github.io/rustc-guide/traits/resolution.html#confirmation + // https://rust-lang.github.io/rustc-guide/traits/resolution.html#confirmation fn confirm_candidate( &mut self, @@ -2794,9 +2759,9 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } fn confirm_projection_candidate(&mut self, obligation: &TraitObligation<'tcx>) { - self.in_snapshot(|this, snapshot| { + self.infcx.in_snapshot(|_| { let result = - this.match_projection_obligation_against_definition_bounds(obligation, snapshot); + self.match_projection_obligation_against_definition_bounds(obligation); assert!(result); }) } @@ -2913,19 +2878,17 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { nested, ); - let trait_obligations: Vec> = self.in_snapshot(|this, snapshot| { + let trait_obligations: Vec> = self.infcx.in_snapshot(|_| { let poly_trait_ref = obligation.predicate.to_poly_trait_ref(); - let (trait_ref, placeholder_map) = this.infcx() - .replace_late_bound_regions_with_placeholders(&poly_trait_ref); + let (trait_ref, _) = self.infcx + .replace_bound_vars_with_placeholders(&poly_trait_ref); let cause = obligation.derived_cause(ImplDerivedObligation); - this.impl_or_trait_obligations( + self.impl_or_trait_obligations( cause, obligation.recursion_depth + 1, obligation.param_env, trait_def_id, &trait_ref.substs, - placeholder_map, - snapshot, ) }); @@ -2950,18 +2913,16 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // First, create the substitutions by matching the impl again, // this time not in a probe. - self.in_snapshot(|this, snapshot| { - let (substs, placeholder_map) = this.rematch_impl(impl_def_id, obligation, snapshot); + self.infcx.in_snapshot(|_| { + let substs = self.rematch_impl(impl_def_id, obligation); debug!("confirm_impl_candidate: substs={:?}", substs); let cause = obligation.derived_cause(ImplDerivedObligation); - this.vtable_impl( + self.vtable_impl( impl_def_id, substs, cause, obligation.recursion_depth + 1, obligation.param_env, - placeholder_map, - snapshot, ) }) } @@ -2973,12 +2934,10 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { cause: ObligationCause<'tcx>, recursion_depth: usize, param_env: ty::ParamEnv<'tcx>, - placeholder_map: infer::PlaceholderMap<'tcx>, - snapshot: &infer::CombinedSnapshot<'cx, 'tcx>, ) -> VtableImplData<'tcx, PredicateObligation<'tcx>> { debug!( - "vtable_impl(impl_def_id={:?}, substs={:?}, recursion_depth={}, placeholder_map={:?})", - impl_def_id, substs, recursion_depth, placeholder_map + "vtable_impl(impl_def_id={:?}, substs={:?}, recursion_depth={})", + impl_def_id, substs, recursion_depth, ); let mut impl_obligations = self.impl_or_trait_obligations( @@ -2987,8 +2946,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { param_env, impl_def_id, &substs.value, - placeholder_map, - snapshot, ); debug!( @@ -3000,7 +2957,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // are sufficient to determine the impl substs, without // relying on projections in the impl-trait-ref. // - // e.g. `impl> Foo<::T> for V` + // e.g., `impl> Foo<::T> for V` impl_obligations.append(&mut substs.obligations); VtableImplData { @@ -3023,7 +2980,10 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { let self_ty = self.infcx .shallow_resolve(*obligation.self_ty().skip_binder()); let poly_trait_ref = match self_ty.sty { - ty::Dynamic(ref data, ..) => data.principal().with_self_ty(self.tcx(), self_ty), + ty::Dynamic(ref data, ..) => + data.principal().unwrap_or_else(|| { + span_bug!(obligation.cause.span, "object candidate with no principal") + }).with_self_ty(self.tcx(), self_ty), _ => span_bug!(obligation.cause.span, "object candidate with non-object"), }; @@ -3041,7 +3001,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // reported an ambiguity. (When we do find a match, also // record it for later.) let nonmatching = util::supertraits(tcx, poly_trait_ref).take_while( - |&t| match self.commit_if_ok(|this, _| this.match_poly_trait_ref(obligation, t)) { + |&t| match self.infcx.commit_if_ok(|_| self.match_poly_trait_ref(obligation, t)) { Ok(obligations) => { upcast_trait_ref = Some(t); nested.extend(obligations); @@ -3117,21 +3077,19 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { obligation, alias_def_id ); - self.in_snapshot(|this, snapshot| { - let (predicate, placeholder_map) = this.infcx() - .replace_late_bound_regions_with_placeholders(&obligation.predicate); + self.infcx.in_snapshot(|_| { + let (predicate, _) = self.infcx() + .replace_bound_vars_with_placeholders(&obligation.predicate); let trait_ref = predicate.trait_ref; let trait_def_id = trait_ref.def_id; let substs = trait_ref.substs; - let trait_obligations = this.impl_or_trait_obligations( + let trait_obligations = self.impl_or_trait_obligations( obligation.cause.clone(), obligation.recursion_depth, obligation.param_env, trait_def_id, &substs, - placeholder_map, - snapshot, ); debug!( @@ -3243,11 +3201,14 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { trait_ref, )?); - obligations.push(Obligation::new( - obligation.cause.clone(), - obligation.param_env, - ty::Predicate::ClosureKind(closure_def_id, substs, kind), - )); + // FIXME: chalk + if !self.tcx().sess.opts.debugging_opts.chalk { + obligations.push(Obligation::new( + obligation.cause.clone(), + obligation.param_env, + ty::Predicate::ClosureKind(closure_def_id, substs, kind), + )); + } Ok(VtableClosureData { closure_def_id, @@ -3325,8 +3286,9 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { (&ty::Dynamic(ref data_a, r_a), &ty::Dynamic(ref data_b, r_b)) => { // See assemble_candidates_for_unsizing for more info. let existential_predicates = data_a.map_bound(|data_a| { - let iter = iter::once(ty::ExistentialPredicate::Trait(data_a.principal())) - .chain( + let iter = + data_a.principal().map(|x| ty::ExistentialPredicate::Trait(x)) + .into_iter().chain( data_a .projection_bounds() .map(|x| ty::ExistentialPredicate::Projection(x)), @@ -3338,10 +3300,10 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { ); tcx.mk_existential_predicates(iter) }); - let new_trait = tcx.mk_dynamic(existential_predicates, r_b); + let source_trait = tcx.mk_dynamic(existential_predicates, r_b); let InferOk { obligations, .. } = self.infcx .at(&obligation.cause, obligation.param_env) - .eq(target, new_trait) + .sup(target, source_trait) .map_err(|_| Unimplemented)?; nested.extend(obligations); @@ -3363,7 +3325,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // T -> Trait. (_, &ty::Dynamic(ref data, r)) => { let mut object_dids = data.auto_traits() - .chain(iter::once(data.principal().def_id())); + .chain(data.principal_def_id()); if let Some(did) = object_dids.find(|did| !tcx.is_object_safe(*did)) { return Err(TraitNotObjectSafe(did)); } @@ -3543,13 +3505,9 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { &mut self, impl_def_id: DefId, obligation: &TraitObligation<'tcx>, - snapshot: &infer::CombinedSnapshot<'cx, 'tcx>, - ) -> ( - Normalized<'tcx, &'tcx Substs<'tcx>>, - infer::PlaceholderMap<'tcx>, - ) { - match self.match_impl(impl_def_id, obligation, snapshot) { - Ok((substs, placeholder_map)) => (substs, placeholder_map), + ) -> Normalized<'tcx, &'tcx Substs<'tcx>> { + match self.match_impl(impl_def_id, obligation) { + Ok(substs) => substs, Err(()) => { bug!( "Impl {:?} was matchable against {:?} but now is not", @@ -3564,14 +3522,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { &mut self, impl_def_id: DefId, obligation: &TraitObligation<'tcx>, - snapshot: &infer::CombinedSnapshot<'cx, 'tcx>, - ) -> Result< - ( - Normalized<'tcx, &'tcx Substs<'tcx>>, - infer::PlaceholderMap<'tcx>, - ), - (), - > { + ) -> Result>, ()> { let impl_trait_ref = self.tcx().impl_trait_ref(impl_def_id).unwrap(); // Before we create the substitutions and everything, first @@ -3581,8 +3532,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { return Err(()); } - let (skol_obligation, placeholder_map) = self.infcx() - .replace_late_bound_regions_with_placeholders(&obligation.predicate); + let (skol_obligation, _) = self.infcx() + .replace_bound_vars_with_placeholders(&obligation.predicate); let skol_obligation_trait_ref = skol_obligation.trait_ref; let impl_substs = self.infcx @@ -3613,22 +3564,11 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { .map_err(|e| debug!("match_impl: failed eq_trait_refs due to `{}`", e))?; nested_obligations.extend(obligations); - if let Err(e) = - self.infcx - .leak_check(false, obligation.cause.span, &placeholder_map, snapshot) - { - debug!("match_impl: failed leak check due to `{}`", e); - return Err(()); - } - debug!("match_impl: success impl_substs={:?}", impl_substs); - Ok(( - Normalized { - value: impl_substs, - obligations: nested_obligations, - }, - placeholder_map, - )) + Ok(Normalized { + value: impl_substs, + obligations: nested_obligations, + }) } fn fast_reject_trait_refs( @@ -3783,8 +3723,6 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { param_env: ty::ParamEnv<'tcx>, def_id: DefId, // of impl or trait substs: &Substs<'tcx>, // for impl or trait - placeholder_map: infer::PlaceholderMap<'tcx>, - snapshot: &infer::CombinedSnapshot<'cx, 'tcx>, ) -> Vec> { debug!("impl_or_trait_obligations(def_id={:?})", def_id); let tcx = self.tcx(); @@ -3846,8 +3784,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { let mut seen = FxHashSet::default(); predicates.retain(|i| seen.insert(i.clone())); } - self.infcx() - .plug_leaks(placeholder_map, snapshot, predicates) + + predicates } } @@ -3926,6 +3864,10 @@ impl<'o, 'tcx> TraitObligationStackList<'o, 'tcx> { fn with(r: &'o TraitObligationStack<'o, 'tcx>) -> TraitObligationStackList<'o, 'tcx> { TraitObligationStackList { head: Some(r) } } + + fn head(&self) -> Option<&'o TraitObligationStack<'o, 'tcx>> { + self.head + } } impl<'o, 'tcx> Iterator for TraitObligationStackList<'o, 'tcx> { diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index d3dc1655b0d..e5ed16e7558 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Logic and data structures related to impl specialization, explained in //! greater detail below. //! @@ -17,31 +7,32 @@ //! See the [rustc guide] for a bit more detail on how specialization //! fits together with the rest of the trait machinery. //! -//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/specialization.html +//! [rustc guide]: https://rust-lang.github.io/rustc-guide/traits/specialization.html -use super::{SelectionContext, FulfillmentContext}; -use super::util::impl_trait_ref_and_oblig; +pub mod specialization_graph; -use rustc_data_structures::fx::FxHashSet; use hir::def_id::DefId; use infer::{InferCtxt, InferOk}; -use ty::subst::{Subst, Substs}; -use traits::{self, ObligationCause, TraitEngine}; +use lint; +use traits::{self, coherence, FutureCompatOverlapErrorKind, ObligationCause, TraitEngine}; +use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::sync::Lrc; +use syntax_pos::DUMMY_SP; use traits::select::IntercrateAmbiguityCause; use ty::{self, TyCtxt, TypeFoldable}; -use syntax_pos::DUMMY_SP; -use rustc_data_structures::sync::Lrc; - -use lint; +use ty::subst::{Subst, Substs}; -pub mod specialization_graph; +use super::{SelectionContext, FulfillmentContext}; +use super::util::impl_trait_ref_and_oblig; /// Information pertinent to an overlapping impl error. +#[derive(Debug)] pub struct OverlapError { pub with_impl: DefId, pub trait_desc: String, pub self_desc: Option, pub intercrate_ambiguity_causes: Vec, + pub involves_placeholder: bool, } /// Given a subst for the requested impl, translate it to a subst @@ -85,6 +76,8 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, source_substs: &'tcx Substs<'tcx>, target_node: specialization_graph::Node) -> &'tcx Substs<'tcx> { + debug!("translate_substs({:?}, {:?}, {:?}, {:?})", + param_env, source_impl, source_substs, target_node); let source_trait_ref = infcx.tcx .impl_trait_ref(source_impl) .unwrap() @@ -119,10 +112,13 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, /// whichever applies. pub fn find_associated_item<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, item: &ty::AssociatedItem, substs: &'tcx Substs<'tcx>, impl_data: &super::VtableImplData<'tcx, ()>, ) -> (DefId, &'tcx Substs<'tcx>) { + debug!("find_associated_item({:?}, {:?}, {:?}, {:?})", + param_env, item, substs, impl_data); assert!(!substs.needs_infer()); let trait_def_id = tcx.trait_id_of_impl(impl_data.impl_def_id).unwrap(); @@ -132,7 +128,7 @@ pub fn find_associated_item<'a, 'tcx>( match ancestors.defs(tcx, item.ident, item.kind, trait_def_id).next() { Some(node_item) => { let substs = tcx.infer_ctxt().enter(|infcx| { - let param_env = ty::ParamEnv::reveal_all(); + let param_env = param_env.with_reveal_all(); let substs = substs.rebase_onto(tcx, trait_def_id, impl_data.substs); let substs = translate_substs(&infcx, param_env, impl_data.impl_def_id, substs, node_item.node); @@ -179,7 +175,7 @@ pub(super) fn specializes<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // // See RFC 1210 for more details and justification. - // Currently we do not allow e.g. a negative impl to specialize a positive one + // Currently we do not allow e.g., a negative impl to specialize a positive one if tcx.impl_polarity(impl1_def_id) != tcx.impl_polarity(impl2_def_id) { return false; } @@ -219,12 +215,17 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, source_trait_ref: ty::TraitRef<'tcx>, target_impl: DefId) -> Result<&'tcx Substs<'tcx>, ()> { + debug!("fulfill_implication({:?}, trait_ref={:?} |- {:?} applies)", + param_env, source_trait_ref, target_impl); + let selcx = &mut SelectionContext::new(&infcx); let target_substs = infcx.fresh_substs_for_item(DUMMY_SP, target_impl); let (target_trait_ref, mut obligations) = impl_trait_ref_and_oblig(selcx, param_env, target_impl, target_substs); + debug!("fulfill_implication: target_trait_ref={:?}, obligations={:?}", + target_trait_ref, obligations); // do the impls unify? If not, no specialization. match infcx.at(&ObligationCause::dummy(), param_env) @@ -285,17 +286,18 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, } // Query provider for `specialization_graph_of`. -pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - trait_id: DefId) - -> Lrc { +pub(super) fn specialization_graph_provider<'a, 'tcx>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + trait_id: DefId, +) -> Lrc { let mut sg = specialization_graph::Graph::new(); let mut trait_impls = tcx.all_impls(trait_id); // The coherence checking implementation seems to rely on impls being // iterated over (roughly) in definition order, so we are sorting by - // negated CrateNum (so remote definitions are visited first) and then - // by a flattened version of the DefIndex. + // negated `CrateNum` (so remote definitions are visited first) and then + // by a flattened version of the `DefIndex`. trait_impls.sort_unstable_by_key(|def_id| { (-(def_id.krate.as_u32() as i64), def_id.index.address_space().index(), @@ -308,8 +310,9 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx let insert_result = sg.insert(tcx, impl_def_id); // Report error if there was one. let (overlap, used_to_be_allowed) = match insert_result { - Err(overlap) => (Some(overlap), false), - Ok(opt_overlap) => (opt_overlap, true) + Err(overlap) => (Some(overlap), None), + Ok(Some(overlap)) => (Some(overlap.error), Some(overlap.kind)), + Ok(None) => (None, None) }; if let Some(overlap) = overlap { @@ -319,15 +322,21 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx String::new(), |ty| { format!(" for type `{}`", ty) }), - if used_to_be_allowed { " (E0119)" } else { "" } + if used_to_be_allowed.is_some() { " (E0119)" } else { "" } ); let impl_span = tcx.sess.source_map().def_span( tcx.span_of_impl(impl_def_id).unwrap() ); - let mut err = if used_to_be_allowed { + let mut err = if let Some(kind) = used_to_be_allowed { + let lint = match kind { + FutureCompatOverlapErrorKind::Issue43355 => + lint::builtin::INCOHERENT_FUNDAMENTAL_IMPLS, + FutureCompatOverlapErrorKind::Issue33140 => + lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS, + }; tcx.struct_span_lint_node( - lint::builtin::INCOHERENT_FUNDAMENTAL_IMPLS, - tcx.hir.as_local_node_id(impl_def_id).unwrap(), + lint, + tcx.hir().as_local_node_id(impl_def_id).unwrap(), impl_span, &msg) } else { @@ -362,6 +371,10 @@ pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx cause.add_intercrate_ambiguity_hint(&mut err); } + if overlap.involves_placeholder { + coherence::add_placeholder_note(&mut err); + } + err.emit(); } } else { diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index db0302f3a90..e5780a26a19 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::OverlapError; use hir::def_id::DefId; @@ -29,7 +19,7 @@ use util::nodemap::{DefIdMap, FxHashMap}; /// /// The graph provides two key services: /// -/// - Construction, which implicitly checks for overlapping impls (i.e., impls +/// - Construction. This implicitly checks for overlapping impls (i.e., impls /// that overlap but where neither specializes the other -- an artifact of the /// simple "chain" rule. /// @@ -39,11 +29,11 @@ use util::nodemap::{DefIdMap, FxHashMap}; /// has at most one parent. #[derive(RustcEncodable, RustcDecodable)] pub struct Graph { - // all impls have a parent; the "root" impls have as their parent the def_id - // of the trait + // All impls have a parent; the "root" impls have as their parent the `def_id` + // of the trait. parent: DefIdMap, - // the "root" impls are found by looking up the trait's def_id. + // The "root" impls are found by looking up the trait's def_id. children: DefIdMap, } @@ -68,10 +58,22 @@ struct Children { blanket_impls: Vec, } +#[derive(Copy, Clone, Debug)] +pub enum FutureCompatOverlapErrorKind { + Issue43355, + Issue33140, +} + +#[derive(Debug)] +pub struct FutureCompatOverlapError { + pub error: OverlapError, + pub kind: FutureCompatOverlapErrorKind +} + /// The result of attempting to insert an impl into a group of children. enum Inserted { /// The impl was inserted as a new child in this group of children. - BecameNewSibling(Option), + BecameNewSibling(Option), /// The impl should replace existing impls [X1, ..], because the impl specializes X1, X2, etc. ReplaceChildren(Vec), @@ -81,7 +83,7 @@ enum Inserted { } impl<'a, 'gcx, 'tcx> Children { - /// Insert an impl into this set of children without comparing to any existing impls + /// Insert an impl into this set of children without comparing to any existing impls. fn insert_blindly(&mut self, tcx: TyCtxt<'a, 'gcx, 'tcx>, impl_def_id: DefId) { @@ -132,10 +134,12 @@ impl<'a, 'gcx, 'tcx> Children { simplified_self, ); - for possible_sibling in match simplified_self { - Some(sty) => self.filtered(sty), - None => self.iter(), - } { + let possible_siblings = match simplified_self { + Some(sty) => PotentialSiblings::Filtered(self.filtered(sty)), + None => PotentialSiblings::Unfiltered(self.iter()), + }; + + for possible_sibling in possible_siblings { debug!( "insert: impl_def_id={:?}, simplified_self={:?}, possible_sibling={:?}", impl_def_id, @@ -144,13 +148,13 @@ impl<'a, 'gcx, 'tcx> Children { ); let overlap_error = |overlap: traits::coherence::OverlapResult<'_>| { - // overlap, but no specialization; error out + // Found overlap, but no specialization; error out. let trait_ref = overlap.impl_header.trait_ref.unwrap(); let self_ty = trait_ref.self_ty(); OverlapError { with_impl: possible_sibling, trait_desc: trait_ref.to_string(), - // only report the Self type if it has at least + // Only report the `Self` type if it has at least // some outer concrete shell; otherwise, it's // not adding much information. self_desc: if self_ty.has_concrete_skeleton() { @@ -159,6 +163,7 @@ impl<'a, 'gcx, 'tcx> Children { None }, intercrate_ambiguity_causes: overlap.intercrate_ambiguity_causes, + involves_placeholder: overlap.involves_placeholder, } }; @@ -169,7 +174,19 @@ impl<'a, 'gcx, 'tcx> Children { impl_def_id, traits::IntercrateMode::Issue43355, |overlap| { - if tcx.impls_are_allowed_to_overlap(impl_def_id, possible_sibling) { + if let Some(overlap_kind) = + tcx.impls_are_allowed_to_overlap(impl_def_id, possible_sibling) + { + match overlap_kind { + ty::ImplOverlapKind::Permitted => {} + ty::ImplOverlapKind::Issue33140 => { + last_lint = Some(FutureCompatOverlapError { + error: overlap_error(overlap), + kind: FutureCompatOverlapErrorKind::Issue33140 + }); + } + } + return Ok((false, false)); } @@ -189,7 +206,7 @@ impl<'a, 'gcx, 'tcx> Children { debug!("descending as child of TraitRef {:?}", tcx.impl_trait_ref(possible_sibling).unwrap()); - // the impl specializes possible_sibling + // The impl specializes `possible_sibling`. return Ok(Inserted::ShouldRecurseOn(possible_sibling)); } else if ge && !le { debug!("placing as parent of TraitRef {:?}", @@ -197,13 +214,23 @@ impl<'a, 'gcx, 'tcx> Children { replace_children.push(possible_sibling); } else { - if !tcx.impls_are_allowed_to_overlap(impl_def_id, possible_sibling) { + if let None = tcx.impls_are_allowed_to_overlap( + impl_def_id, possible_sibling) + { + // do future-compat checks for overlap. Have issue #33140 + // errors overwrite issue #43355 errors when both are present. + traits::overlapping_impls( tcx, possible_sibling, impl_def_id, traits::IntercrateMode::Fixed, - |overlap| last_lint = Some(overlap_error(overlap)), + |overlap| { + last_lint = Some(FutureCompatOverlapError { + error: overlap_error(overlap), + kind: FutureCompatOverlapErrorKind::Issue43355 + }); + }, || (), ); } @@ -216,20 +243,43 @@ impl<'a, 'gcx, 'tcx> Children { return Ok(Inserted::ReplaceChildren(replace_children)); } - // no overlap with any potential siblings, so add as a new sibling + // No overlap with any potential siblings, so add as a new sibling. debug!("placing as new sibling"); self.insert_blindly(tcx, impl_def_id); Ok(Inserted::BecameNewSibling(last_lint)) } - fn iter(&mut self) -> Box + '_> { + fn iter(&mut self) -> impl Iterator + '_ { let nonblanket = self.nonblanket_impls.iter_mut().flat_map(|(_, v)| v.iter()); - Box::new(self.blanket_impls.iter().chain(nonblanket).cloned()) + self.blanket_impls.iter().chain(nonblanket).cloned() } - fn filtered(&mut self, sty: SimplifiedType) -> Box + '_> { + fn filtered(&mut self, sty: SimplifiedType) -> impl Iterator + '_ { let nonblanket = self.nonblanket_impls.entry(sty).or_default().iter(); - Box::new(self.blanket_impls.iter().chain(nonblanket).cloned()) + self.blanket_impls.iter().chain(nonblanket).cloned() + } +} + +// A custom iterator used by Children::insert +enum PotentialSiblings + where I: Iterator, + J: Iterator +{ + Unfiltered(I), + Filtered(J) +} + +impl Iterator for PotentialSiblings + where I: Iterator, + J: Iterator +{ + type Item = DefId; + + fn next(&mut self) -> Option { + match *self { + PotentialSiblings::Unfiltered(ref mut iter) => iter.next(), + PotentialSiblings::Filtered(ref mut iter) => iter.next() + } } } @@ -247,7 +297,7 @@ impl<'a, 'gcx, 'tcx> Graph { pub fn insert(&mut self, tcx: TyCtxt<'a, 'gcx, 'tcx>, impl_def_id: DefId) - -> Result, OverlapError> { + -> Result, OverlapError> { assert!(impl_def_id.is_local()); let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); @@ -256,7 +306,7 @@ impl<'a, 'gcx, 'tcx> Graph { debug!("insert({:?}): inserting TraitRef {:?} into specialization graph", impl_def_id, trait_ref); - // if the reference itself contains an earlier error (e.g., due to a + // If the reference itself contains an earlier error (e.g., due to a // resolution failure), then we just insert the impl at the top level of // the graph and claim that there's no overlap (in order to suppress // bogus errors). @@ -275,7 +325,7 @@ impl<'a, 'gcx, 'tcx> Graph { let mut last_lint = None; let simplified = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false); - // Descend the specialization tree, where `parent` is the current parent node + // Descend the specialization tree, where `parent` is the current parent node. loop { use self::Inserted::*; @@ -313,7 +363,7 @@ impl<'a, 'gcx, 'tcx> Graph { siblings.insert_blindly(tcx, impl_def_id); } - // Set G's parent to N and N's parent to P + // Set G's parent to N and N's parent to P. for &grand_child_to_be in &grand_children_to_be { self.parent.insert(grand_child_to_be, impl_def_id); } @@ -429,7 +479,8 @@ impl NodeItem { impl<'a, 'gcx, 'tcx> Ancestors { /// Search the items from the given ancestors, returning each definition /// with the given name and the given kind. - #[inline] // FIXME(#35870) Avoid closures being unexported due to impl Trait. + // FIXME(#35870): avoid closures being unexported due to `impl Trait`. + #[inline] pub fn defs( self, tcx: TyCtxt<'a, 'gcx, 'tcx>, diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs index 3e417f10c44..2f5df022218 100644 --- a/src/librustc/traits/structural_impls.rs +++ b/src/librustc/traits/structural_impls.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use chalk_engine; use smallvec::SmallVec; use traits; @@ -33,8 +23,8 @@ impl<'tcx, O: fmt::Debug> fmt::Debug for traits::Obligation<'tcx, O> { if ty::tls::with(|tcx| tcx.sess.verbose()) { write!( f, - "Obligation(predicate={:?},cause={:?},depth={})", - self.predicate, self.cause, self.recursion_depth + "Obligation(predicate={:?},cause={:?},param_env={:?},depth={})", + self.predicate, self.cause, self.param_env, self.recursion_depth ) } else { write!( @@ -324,7 +314,7 @@ impl<'tcx> TypeVisitor<'tcx> for BoundNamesCollector { use syntax::symbol::Symbol; match t.sty { - ty::Bound(bound_ty) if bound_ty.index == self.binder_index => { + ty::Bound(debruijn, bound_ty) if debruijn == self.binder_index => { self.types.insert( bound_ty.var.as_u32(), match bound_ty.kind { @@ -405,6 +395,7 @@ impl<'tcx> fmt::Display for traits::Goal<'tcx> { Ok(()) } + Subtype(a, b) => write!(fmt, "{} <: {}", a, b), CannotProve => write!(fmt, "CannotProve"), } } @@ -526,7 +517,14 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> { arm_span, source: source, }), - super::IfExpression => Some(super::IfExpression), + super::MatchExpressionArmPattern { span, ty } => { + tcx.lift(&ty).map(|ty| super::MatchExpressionArmPattern { span, ty }) + } + super::IfExpression { then, outer, semicolon } => Some(super::IfExpression { + then, + outer, + semicolon, + }), super::IfExpressionWithNoElse => Some(super::IfExpressionWithNoElse), super::MainFunctionType => Some(super::MainFunctionType), super::StartFunctionType => Some(super::StartFunctionType), @@ -678,6 +676,7 @@ EnumLiftImpl! { (traits::GoalKind::Not)(goal), (traits::GoalKind::DomainGoal)(domain_goal), (traits::GoalKind::Quantified)(kind, goal), + (traits::GoalKind::Subtype)(a, b), (traits::GoalKind::CannotProve), } } @@ -710,12 +709,36 @@ impl<'a, 'tcx, G: Lift<'tcx>> Lift<'tcx> for traits::InEnvironment<'a, G> { impl<'tcx, C> Lift<'tcx> for chalk_engine::ExClause where C: chalk_engine::context::Context + Clone, - C: traits::ExClauseLift<'tcx>, + C: traits::ChalkContextLift<'tcx>, { type Lifted = C::LiftedExClause; fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { - ::lift_ex_clause_to_tcx(self, tcx) + ::lift_ex_clause_to_tcx(self, tcx) + } +} + +impl<'tcx, C> Lift<'tcx> for chalk_engine::DelayedLiteral +where + C: chalk_engine::context::Context + Clone, + C: traits::ChalkContextLift<'tcx>, +{ + type Lifted = C::LiftedDelayedLiteral; + + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + ::lift_delayed_literal_to_tcx(self, tcx) + } +} + +impl<'tcx, C> Lift<'tcx> for chalk_engine::Literal +where + C: chalk_engine::context::Context + Clone, + C: traits::ChalkContextLift<'tcx>, +{ + type Lifted = C::LiftedLiteral; + + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option { + ::lift_literal_to_tcx(self, tcx) } } @@ -850,6 +873,7 @@ EnumTypeFoldableImpl! { (traits::GoalKind::Not)(goal), (traits::GoalKind::DomainGoal)(domain_goal), (traits::GoalKind::Quantified)(qkind, goal), + (traits::GoalKind::Subtype)(a, b), (traits::GoalKind::CannotProve), } } diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index 3a882506b41..5b7ba538672 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -1,20 +1,10 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +use hir; use hir::def_id::DefId; -use ty::subst::{Kind, Subst, Substs}; +use traits::specialize::specialization_graph::NodeItem; use ty::{self, Ty, TyCtxt, ToPredicate, ToPolyTraitRef}; use ty::outlives::Component; +use ty::subst::{Kind, Subst, Substs}; use util::nodemap::FxHashSet; -use hir::{self}; -use traits::specialize::specialization_graph::NodeItem; use super::{Obligation, ObligationCause, PredicateObligation, SelectionContext, Normalized}; @@ -535,9 +525,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } pub fn impl_is_default(self, node_item_def_id: DefId) -> bool { - match self.hir.as_local_node_id(node_item_def_id) { + match self.hir().as_local_node_id(node_item_def_id) { Some(node_id) => { - let item = self.hir.expect_item(node_id); + let item = self.hir().expect_item(node_id); if let hir::ItemKind::Impl(_, _, defaultness, ..) = item.node { defaultness.is_default() } else { diff --git a/src/librustc/ty/_match.rs b/src/librustc/ty/_match.rs index d20b6d36199..34b94d4217d 100644 --- a/src/librustc/ty/_match.rs +++ b/src/librustc/ty/_match.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ty::{self, Ty, TyCtxt}; use ty::error::TypeError; use ty::relate::{self, Relate, TypeRelation, RelateResult}; diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index 3263da8fda3..117112c0c75 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir; use hir::def_id::DefId; use ty::{self, Ty, TyCtxt}; @@ -48,7 +38,7 @@ use ty::subst::Substs; /// stored in `unsize` is `Foo<[i32]>`, we don't store any further detail about /// the underlying conversions from `[i32; 4]` to `[i32]`. /// -/// 3. Coercing a `Box` to `Box` is an interesting special case. In +/// 3. Coercing a `Box` to `Box` is an interesting special case. In /// that case, we have the pointer we need coming in, so there are no /// autoderefs, and no autoref. Instead we just do the `Unsize` transformation. /// At some point, of course, `Box` should move out of the compiler, in which @@ -83,7 +73,7 @@ pub enum Adjust<'tcx> { /// Take the address and produce either a `&` or `*` pointer. Borrow(AutoBorrow<'tcx>), - /// Unsize a pointer/reference value, e.g. `&[T; n]` to + /// Unsize a pointer/reference value, e.g., `&[T; n]` to /// `&[T]`. Note that the source could be a thin or fat pointer. /// This will do things like convert thin pointers to fat /// pointers, or convert structs containing thin pointers to diff --git a/src/librustc/ty/binding.rs b/src/librustc/ty/binding.rs index 971b3c3d14a..2ab14642406 100644 --- a/src/librustc/ty/binding.rs +++ b/src/librustc/ty/binding.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::BindingAnnotation::*; use hir::BindingAnnotation; use hir::Mutability; diff --git a/src/librustc/ty/cast.rs b/src/librustc/ty/cast.rs index ab82f28c8bf..0f067de3649 100644 --- a/src/librustc/ty/cast.rs +++ b/src/librustc/ty/cast.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Helpers for handling cast expressions, used in both // typeck and codegen. diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index 8738f574148..e0e4d9c362a 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This module contains some shared code for encoding and decoding various // things from the `ty` module, and in particular implements support for // "shorthands" which allow to have pointers back into the already encoded @@ -92,7 +82,7 @@ pub fn encode_with_shorthand(encoder: &mut E, let leb128_bits = len * 7; // Check that the shorthand is a not longer than the - // full encoding itself, i.e. it's an obvious win. + // full encoding itself, i.e., it's an obvious win. if leb128_bits >= 64 || (shorthand as u64) < (1 << leb128_bits) { cache(encoder).insert(value.clone(), shorthand); } @@ -257,12 +247,12 @@ pub fn decode_canonical_var_infos<'a, 'tcx, D>(decoder: &mut D) } #[inline] -pub fn decode_const<'a, 'tcx, D>(decoder: &mut D) - -> Result<&'tcx ty::Const<'tcx>, D::Error> +pub fn decode_lazy_const<'a, 'tcx, D>(decoder: &mut D) + -> Result<&'tcx ty::LazyConst<'tcx>, D::Error> where D: TyDecoder<'a, 'tcx>, 'tcx: 'a, { - Ok(decoder.tcx().mk_const(Decodable::decode(decoder)?)) + Ok(decoder.tcx().intern_lazy_const(Decodable::decode(decoder)?)) } #[inline] @@ -399,10 +389,10 @@ macro_rules! implement_ty_decoder { } } - impl<$($typaram),*> SpecializedDecoder<&'tcx $crate::ty::Const<'tcx>> + impl<$($typaram),*> SpecializedDecoder<&'tcx $crate::ty::LazyConst<'tcx>> for $DecoderName<$($typaram),*> { - fn specialized_decode(&mut self) -> Result<&'tcx ty::Const<'tcx>, Self::Error> { - decode_const(self) + fn specialized_decode(&mut self) -> Result<&'tcx ty::LazyConst<'tcx>, Self::Error> { + decode_lazy_const(self) } } diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index 47aea7a5f07..3741f4051b8 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -5,7 +5,6 @@ use ty::TyCtxt; use syntax_pos::symbol::Symbol; use hir::map::blocks::FnLikeNode; use syntax::attr; -use rustc_target::spec::abi; impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { /// Whether the `def_id` counts as const fn in your current crate, considering all active @@ -40,19 +39,12 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { /// Returns true if this function must conform to `min_const_fn` pub fn is_min_const_fn(self, def_id: DefId) -> bool { + // Bail out if the signature doesn't contain `const` + if !self.is_const_fn_raw(def_id) { + return false; + } + if self.features().staged_api { - // some intrinsics are waved through if called inside the - // standard library. Users never need to call them directly - if let abi::Abi::RustIntrinsic = self.fn_sig(def_id).abi() { - assert!(!self.is_const_fn(def_id)); - match &self.item_name(def_id).as_str()[..] { - | "size_of" - | "min_align_of" - | "needs_drop" - => return true, - _ => {}, - } - } // in order for a libstd function to be considered min_const_fn // it needs to be stable and have no `rustc_const_unstable` attribute match self.lookup_stability(def_id) { @@ -66,7 +58,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } } else { // users enabling the `const_fn` feature gate can do what they want - !self.sess.features_untracked().const_fn + !self.features().const_fn } } } @@ -75,10 +67,10 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { /// only checks whether the function has a `const` modifier fn is_const_fn_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { - let node_id = tcx.hir.as_local_node_id(def_id) + let node_id = tcx.hir().as_local_node_id(def_id) .expect("Non-local call to local provider is_const_fn"); - if let Some(fn_like) = FnLikeNode::from_node(tcx.hir.get(node_id)) { + if let Some(fn_like) = FnLikeNode::from_node(tcx.hir().get(node_id)) { fn_like.constness() == hir::Constness::Const } else { false diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index a8ce52a8e15..881c0d4e6d2 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! type context book-keeping use dep_graph::DepGraph; @@ -24,7 +14,7 @@ use hir::map as hir_map; use hir::map::DefPathHash; use lint::{self, Lint}; use ich::{StableHashingContext, NodeIdHashingMode}; -use infer::canonical::{CanonicalVarInfo, CanonicalVarInfos}; +use infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos}; use infer::outlives::free_region_map::FreeRegionMap; use middle::cstore::CrateStoreDyn; use middle::cstore::EncodedMetadata; @@ -33,13 +23,13 @@ use middle::resolve_lifetime::{self, ObjectLifetimeDefault}; use middle::stability; use mir::{self, Mir, interpret, ProjectionKind}; use mir::interpret::Allocation; -use ty::subst::{CanonicalUserSubsts, Kind, Substs, Subst}; +use ty::subst::{Kind, Substs, Subst}; use ty::ReprOptions; use traits; use traits::{Clause, Clauses, GoalKind, Goal, Goals}; use ty::{self, Ty, TypeAndMut}; use ty::{TyS, TyKind, List}; -use ty::{AdtKind, AdtDef, ClosureSubsts, GeneratorSubsts, Region, Const}; +use ty::{AdtKind, AdtDef, ClosureSubsts, GeneratorSubsts, Region, Const, LazyConst}; use ty::{PolyFnSig, InferTy, ParamTy, ProjectionTy, ExistentialPredicate, Predicate}; use ty::RegionKind; use ty::{TyVar, TyVid, IntVar, IntVid, FloatVar, FloatVid}; @@ -48,17 +38,18 @@ use ty::GenericParamDefKind; use ty::layout::{LayoutDetails, TargetDataLayout, VariantIdx}; use ty::query; use ty::steal::Steal; -use ty::BindingMode; -use ty::CanonicalTy; +use ty::subst::{UserSubsts, UnpackedKind}; +use ty::{BoundVar, BindingMode}; use ty::CanonicalPolyFnSig; use util::nodemap::{DefIdMap, DefIdSet, ItemLocalMap}; use util::nodemap::{FxHashMap, FxHashSet}; +use rustc_data_structures::interner::HashInterner; use smallvec::SmallVec; use rustc_data_structures::stable_hasher::{HashStable, hash_stable_hashmap, StableHasher, StableHasherResult, StableVec}; use arena::{TypedArena, SyncDroplessArena}; -use rustc_data_structures::indexed_vec::IndexVec; +use rustc_data_structures::indexed_vec::{Idx, IndexVec}; use rustc_data_structures::sync::{self, Lrc, Lock, WorkerLocal}; use std::any::Any; use std::borrow::Borrow; @@ -68,9 +59,11 @@ use std::hash::{Hash, Hasher}; use std::fmt; use std::mem; use std::ops::{Deref, Bound}; +use std::ptr; use std::iter; use std::sync::mpsc; use std::sync::Arc; +use std::marker::PhantomData; use rustc_target::spec::abi; use syntax::ast::{self, NodeId}; use syntax::attr; @@ -85,6 +78,7 @@ use hir; pub struct AllArenas<'tcx> { pub global: WorkerLocal>, pub interner: SyncDroplessArena, + global_ctxt: Option>, } impl<'tcx> AllArenas<'tcx> { @@ -92,6 +86,7 @@ impl<'tcx> AllArenas<'tcx> { AllArenas { global: WorkerLocal::new(|_| GlobalArenas::default()), interner: SyncDroplessArena::default(), + global_ctxt: None, } } } @@ -113,7 +108,7 @@ pub struct GlobalArenas<'tcx> { const_allocs: TypedArena, } -type InternedSet<'tcx, T> = Lock>>; +type InternedSet<'tcx, T> = Lock, ()>>; pub struct CtxtInterners<'tcx> { /// The arena that types, regions, etc are allocated from @@ -128,7 +123,6 @@ pub struct CtxtInterners<'tcx> { region: InternedSet<'tcx, RegionKind>, existential_predicates: InternedSet<'tcx, List>>, predicates: InternedSet<'tcx, List>>, - const_: InternedSet<'tcx, Const<'tcx>>, clauses: InternedSet<'tcx, List>>, goal: InternedSet<'tcx, GoalKind<'tcx>>, goal_list: InternedSet<'tcx, List>>, @@ -146,7 +140,6 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> { existential_predicates: Default::default(), canonical_var_infos: Default::default(), predicates: Default::default(), - const_: Default::default(), clauses: Default::default(), goal: Default::default(), goal_list: Default::default(), @@ -155,6 +148,7 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> { } /// Intern a type + #[inline(never)] fn intern_ty( local: &CtxtInterners<'tcx>, global: &CtxtInterners<'gcx>, @@ -166,56 +160,45 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> { // determine that all contents are in the global tcx. // See comments on Lift for why we can't use that. if flags.flags.intersects(ty::TypeFlags::KEEP_IN_LOCAL_TCX) { - let mut interner = local.type_.borrow_mut(); - if let Some(&Interned(ty)) = interner.get(&st) { - return ty; - } - - let ty_struct = TyS { - sty: st, - flags: flags.flags, - outer_exclusive_binder: flags.outer_exclusive_binder, - }; + local.type_.borrow_mut().intern(st, |st| { + let ty_struct = TyS { + sty: st, + flags: flags.flags, + outer_exclusive_binder: flags.outer_exclusive_binder, + }; - // Make sure we don't end up with inference - // types/regions in the global interner - if local as *const _ as usize == global as *const _ as usize { - bug!("Attempted to intern `{:?}` which contains \ - inference types/regions in the global type context", - &ty_struct); - } + // Make sure we don't end up with inference + // types/regions in the global interner + if ptr::eq(local, global) { + bug!("Attempted to intern `{:?}` which contains \ + inference types/regions in the global type context", + &ty_struct); + } - // Don't be &mut TyS. - let ty: Ty<'tcx> = local.arena.alloc(ty_struct); - interner.insert(Interned(ty)); - ty + Interned(local.arena.alloc(ty_struct)) + }).0 } else { - let mut interner = global.type_.borrow_mut(); - if let Some(&Interned(ty)) = interner.get(&st) { - return ty; - } - - let ty_struct = TyS { - sty: st, - flags: flags.flags, - outer_exclusive_binder: flags.outer_exclusive_binder, - }; + global.type_.borrow_mut().intern(st, |st| { + let ty_struct = TyS { + sty: st, + flags: flags.flags, + outer_exclusive_binder: flags.outer_exclusive_binder, + }; - // This is safe because all the types the ty_struct can point to - // already is in the global arena - let ty_struct: TyS<'gcx> = unsafe { - mem::transmute(ty_struct) - }; + // This is safe because all the types the ty_struct can point to + // already is in the global arena + let ty_struct: TyS<'gcx> = unsafe { + mem::transmute(ty_struct) + }; - // Don't be &mut TyS. - let ty: Ty<'gcx> = global.arena.alloc(ty_struct); - interner.insert(Interned(ty)); - ty + Interned(global.arena.alloc(ty_struct)) + }).0 } } } pub struct CommonTypes<'tcx> { + pub unit: Ty<'tcx>, pub bool: Ty<'tcx>, pub char: Ty<'tcx>, pub isize: Ty<'tcx>, @@ -259,11 +242,11 @@ fn validate_hir_id_for_typeck_tables(local_id_root: Option, if let Some(local_id_root) = local_id_root { if hir_id.owner != local_id_root.index { ty::tls::with(|tcx| { - let node_id = tcx.hir.hir_to_node_id(hir_id); + let node_id = tcx.hir().hir_to_node_id(hir_id); bug!("node {} with HirId::owner {:?} cannot be placed in \ TypeckTables with local_id_root {:?}", - tcx.hir.node_to_string(node_id), + tcx.hir().node_to_string(node_id), DefId::local(hir_id.owner), local_id_root) }); @@ -358,26 +341,21 @@ pub struct TypeckTables<'tcx> { /// other items. node_substs: ItemLocalMap<&'tcx Substs<'tcx>>, - /// Stores the canonicalized types provided by the user. See also - /// `AscribeUserType` statement in MIR. - user_provided_tys: ItemLocalMap>, + /// This will either store the canonicalized types provided by the user + /// or the substitutions that the user explicitly gave (if any) attached + /// to `id`. These will not include any inferred values. The canonical form + /// is used to capture things like `_` or other unspecified values. + /// + /// For example, if the user wrote `foo.collect::>()`, then the + /// canonical substitutions would include only `for { Vec }`. + /// + /// See also `AscribeUserType` statement in MIR. + user_provided_types: ItemLocalMap>, /// Stores the canonicalized types provided by the user. See also /// `AscribeUserType` statement in MIR. pub user_provided_sigs: DefIdMap>, - /// Stores the substitutions that the user explicitly gave (if any) - /// attached to `id`. These will not include any inferred - /// values. The canonical form is used to capture things like `_` - /// or other unspecified values. - /// - /// Example: - /// - /// If the user wrote `foo.collect::>()`, then the - /// canonical substitutions would include only `for { Vec - /// }`. - user_substs: ItemLocalMap>, - adjustments: ItemLocalMap>>, /// Stores the actual binding mode for all instances of hir::BindingAnnotation. @@ -440,6 +418,12 @@ pub struct TypeckTables<'tcx> { /// All the existential types that are restricted to concrete types /// by this function pub concrete_existential_types: FxHashMap>, + + /// Given the closure ID this map provides the list of UpvarIDs used by it. + /// The upvarID contains the HIR node ID and it also contains the full path + /// leading to the member of the struct or tuple that is used instead of the + /// entire variable. + pub upvar_list: ty::UpvarListMap, } impl<'tcx> TypeckTables<'tcx> { @@ -448,11 +432,10 @@ impl<'tcx> TypeckTables<'tcx> { local_id_root, type_dependent_defs: Default::default(), field_indices: Default::default(), - user_provided_tys: Default::default(), + user_provided_types: Default::default(), user_provided_sigs: Default::default(), node_types: Default::default(), node_substs: Default::default(), - user_substs: Default::default(), adjustments: Default::default(), pat_binding_modes: Default::default(), pat_adjustments: Default::default(), @@ -465,6 +448,7 @@ impl<'tcx> TypeckTables<'tcx> { tainted_by_errors: false, free_region_map: Default::default(), concrete_existential_types: Default::default(), + upvar_list: Default::default(), } } @@ -507,17 +491,21 @@ impl<'tcx> TypeckTables<'tcx> { } } - pub fn user_provided_tys(&self) -> LocalTableInContext<'_, CanonicalTy<'tcx>> { + pub fn user_provided_types( + &self + ) -> LocalTableInContext<'_, CanonicalUserType<'tcx>> { LocalTableInContext { local_id_root: self.local_id_root, - data: &self.user_provided_tys + data: &self.user_provided_types } } - pub fn user_provided_tys_mut(&mut self) -> LocalTableInContextMut<'_, CanonicalTy<'tcx>> { + pub fn user_provided_types_mut( + &mut self + ) -> LocalTableInContextMut<'_, CanonicalUserType<'tcx>> { LocalTableInContextMut { local_id_root: self.local_id_root, - data: &mut self.user_provided_tys + data: &mut self.user_provided_types } } @@ -539,8 +527,8 @@ impl<'tcx> TypeckTables<'tcx> { self.node_id_to_type_opt(id).unwrap_or_else(|| bug!("node_id_to_type: no type for node `{}`", tls::with(|tcx| { - let id = tcx.hir.hir_to_node_id(id); - tcx.hir.node_to_string(id) + let id = tcx.hir().hir_to_node_id(id); + tcx.hir().node_to_string(id) })) ) } @@ -567,18 +555,6 @@ impl<'tcx> TypeckTables<'tcx> { self.node_substs.get(&id.local_id).cloned() } - pub fn user_substs_mut(&mut self) -> LocalTableInContextMut<'_, CanonicalUserSubsts<'tcx>> { - LocalTableInContextMut { - local_id_root: self.local_id_root, - data: &mut self.user_substs - } - } - - pub fn user_substs(&self, id: hir::HirId) -> Option> { - validate_hir_id_for_typeck_tables(self.local_id_root, id, false); - self.user_substs.get(&id.local_id).cloned() - } - // Returns the type of a pattern as a monotype. Like @expr_ty, this function // doesn't provide type parameter substitutions. pub fn pat_ty(&self, pat: &hir::Pat) -> Ty<'tcx> { @@ -596,7 +572,7 @@ impl<'tcx> TypeckTables<'tcx> { // auto-ref. The type returned by this function does not consider such // adjustments. See `expr_ty_adjusted()` instead. // - // NB (2): This type doesn't provide type parameter substitutions; e.g. if you + // NB (2): This type doesn't provide type parameter substitutions; e.g., if you // ask for the type of "id" in "id(3)", it will return "fn(&isize) -> isize" // instead of "fn(ty) -> T with T = isize". pub fn expr_ty(&self, expr: &hir::Expr) -> Ty<'tcx> { @@ -755,11 +731,10 @@ impl<'a, 'gcx> HashStable> for TypeckTables<'gcx> { local_id_root, ref type_dependent_defs, ref field_indices, - ref user_provided_tys, + ref user_provided_types, ref user_provided_sigs, ref node_types, ref node_substs, - ref user_substs, ref adjustments, ref pat_binding_modes, ref pat_adjustments, @@ -774,16 +749,17 @@ impl<'a, 'gcx> HashStable> for TypeckTables<'gcx> { tainted_by_errors, ref free_region_map, ref concrete_existential_types, + ref upvar_list, + } = *self; hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { type_dependent_defs.hash_stable(hcx, hasher); field_indices.hash_stable(hcx, hasher); - user_provided_tys.hash_stable(hcx, hasher); + user_provided_types.hash_stable(hcx, hasher); user_provided_sigs.hash_stable(hcx, hasher); node_types.hash_stable(hcx, hasher); node_substs.hash_stable(hcx, hasher); - user_substs.hash_stable(hcx, hasher); adjustments.hash_stable(hcx, hasher); pat_binding_modes.hash_stable(hcx, hasher); pat_adjustments.hash_stable(hcx, hasher); @@ -817,22 +793,121 @@ impl<'a, 'gcx> HashStable> for TypeckTables<'gcx> { tainted_by_errors.hash_stable(hcx, hasher); free_region_map.hash_stable(hcx, hasher); concrete_existential_types.hash_stable(hcx, hasher); + upvar_list.hash_stable(hcx, hasher); }) } } +newtype_index! { + pub struct UserTypeAnnotationIndex { + DEBUG_FORMAT = "UserType({})", + const START_INDEX = 0, + } +} + +/// Mapping of type annotation indices to canonical user type annotations. +pub type CanonicalUserTypeAnnotations<'tcx> = + IndexVec>; + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +pub struct CanonicalUserTypeAnnotation<'tcx> { + pub user_ty: CanonicalUserType<'tcx>, + pub span: Span, + pub inferred_ty: Ty<'tcx>, +} + +BraceStructTypeFoldableImpl! { + impl<'tcx> TypeFoldable<'tcx> for CanonicalUserTypeAnnotation<'tcx> { + user_ty, span, inferred_ty + } +} + +BraceStructLiftImpl! { + impl<'a, 'tcx> Lift<'tcx> for CanonicalUserTypeAnnotation<'a> { + type Lifted = CanonicalUserTypeAnnotation<'tcx>; + user_ty, span, inferred_ty + } +} + + +/// Canonicalized user type annotation. +pub type CanonicalUserType<'gcx> = Canonical<'gcx, UserType<'gcx>>; + +impl CanonicalUserType<'gcx> { + /// Returns `true` if this represents a substitution of the form `[?0, ?1, ?2]`, + /// i.e. each thing is mapped to a canonical variable with the same index. + pub fn is_identity(&self) -> bool { + match self.value { + UserType::Ty(_) => false, + UserType::TypeOf(_, user_substs) => { + if user_substs.user_self_ty.is_some() { + return false; + } + + user_substs.substs.iter().zip(BoundVar::new(0)..).all(|(kind, cvar)| { + match kind.unpack() { + UnpackedKind::Type(ty) => match ty.sty { + ty::Bound(debruijn, b) => { + // We only allow a `ty::INNERMOST` index in substitutions. + assert_eq!(debruijn, ty::INNERMOST); + cvar == b.var + } + _ => false, + }, + + UnpackedKind::Lifetime(r) => match r { + ty::ReLateBound(debruijn, br) => { + // We only allow a `ty::INNERMOST` index in substitutions. + assert_eq!(*debruijn, ty::INNERMOST); + cvar == br.assert_bound_var() + } + _ => false, + }, + } + }) + }, + } + } +} + +/// A user-given type annotation attached to a constant. These arise +/// from constants that are named via paths, like `Foo::::new` and +/// so forth. +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +pub enum UserType<'tcx> { + Ty(Ty<'tcx>), + + /// The canonical type is the result of `type_of(def_id)` with the + /// given substitutions applied. + TypeOf(DefId, UserSubsts<'tcx>), +} + +EnumTypeFoldableImpl! { + impl<'tcx> TypeFoldable<'tcx> for UserType<'tcx> { + (UserType::Ty)(ty), + (UserType::TypeOf)(def, substs), + } +} + +EnumLiftImpl! { + impl<'a, 'tcx> Lift<'tcx> for UserType<'a> { + type Lifted = UserType<'tcx>; + (UserType::Ty)(ty), + (UserType::TypeOf)(def, substs), + } +} + impl<'tcx> CommonTypes<'tcx> { fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> { let mk = |sty| CtxtInterners::intern_ty(interners, interners, sty); let mk_region = |r| { - if let Some(r) = interners.region.borrow().get(&r) { - return r.0; - } - let r = interners.arena.alloc(r); - interners.region.borrow_mut().insert(Interned(r)); - &*r + interners.region.borrow_mut().intern(r, |r| { + Interned(interners.arena.alloc(r)) + }).0 }; + CommonTypes { + unit: mk(Tuple(List::empty())), bool: mk(Bool), char: mk(Char), never: mk(Never), @@ -876,15 +951,17 @@ pub struct FreeRegionInfo { /// various **compiler queries** that have been performed. See the /// [rustc guide] for more details. /// -/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/ty.html +/// [rustc guide]: https://rust-lang.github.io/rustc-guide/ty.html #[derive(Copy, Clone)] pub struct TyCtxt<'a, 'gcx: 'tcx, 'tcx: 'a> { - gcx: &'a GlobalCtxt<'gcx>, - interners: &'a CtxtInterners<'tcx> + gcx: &'gcx GlobalCtxt<'gcx>, + interners: &'tcx CtxtInterners<'tcx>, + dummy: PhantomData<&'a ()>, } -impl<'a, 'gcx, 'tcx> Deref for TyCtxt<'a, 'gcx, 'tcx> { - type Target = &'a GlobalCtxt<'gcx>; +impl<'gcx> Deref for TyCtxt<'_, 'gcx, '_> { + type Target = &'gcx GlobalCtxt<'gcx>; + #[inline(always)] fn deref(&self) -> &Self::Target { &self.gcx } @@ -912,13 +989,13 @@ pub struct GlobalCtxt<'tcx> { /// Export map produced by name resolution. export_map: FxHashMap>>, - pub hir: hir_map::Map<'tcx>, + hir_map: hir_map::Map<'tcx>, /// A map from DefPathHash -> DefId. Includes DefIds from the local crate /// as well as all upstream crates. Only populated in incremental mode. pub def_path_hash_to_def_id: Option>, - pub(crate) queries: query::Queries<'tcx>, + pub queries: query::Queries<'tcx>, // Records the free variables referenced by every closure // expression. Do not track deps for this, just recompute it from @@ -927,6 +1004,9 @@ pub struct GlobalCtxt<'tcx> { maybe_unused_trait_imports: FxHashSet, maybe_unused_extern_crates: Vec<(DefId, Span)>, + /// A map of glob use to a set of names it actually imports. Currently only + /// used in save-analysis. + glob_map: FxHashMap>, /// Extern prelude entries. The value is `true` if the entry was introduced /// via `extern crate` item and not `--extern` option or compiler built-in. pub extern_prelude: FxHashMap, @@ -950,14 +1030,14 @@ pub struct GlobalCtxt<'tcx> { /// Data layout specification for the current target. pub data_layout: TargetDataLayout, - stability_interner: Lock>, + stability_interner: Lock>, /// Stores the value of constants (and deduplicates the actual memory) - allocation_interner: Lock>, + allocation_interner: Lock>, - pub alloc_map: Lock>, + pub alloc_map: Lock>, - layout_interner: Lock>, + layout_interner: Lock>, /// A general purpose channel to throw data out the back towards LLVM worker /// threads. @@ -973,13 +1053,19 @@ pub struct GlobalCtxt<'tcx> { impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// Get the global TyCtxt. #[inline] - pub fn global_tcx(self) -> TyCtxt<'a, 'gcx, 'gcx> { + pub fn global_tcx(self) -> TyCtxt<'gcx, 'gcx, 'gcx> { TyCtxt { gcx: self.gcx, interners: &self.gcx.global_interners, + dummy: PhantomData, } } + #[inline(always)] + pub fn hir(self) -> &'a hir_map::Map<'gcx> { + &self.hir_map + } + pub fn alloc_generics(self, generics: ty::Generics) -> &'gcx ty::Generics { self.global_arenas.generics.alloc(generics) } @@ -1010,80 +1096,37 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.global_arenas.adt_def.alloc(def) } - pub fn alloc_byte_array(self, bytes: &[u8]) -> &'gcx [u8] { - if bytes.is_empty() { - &[] - } else { - self.global_interners.arena.alloc_slice(bytes) - } - } - - pub fn alloc_const_slice(self, values: &[&'tcx ty::Const<'tcx>]) - -> &'tcx [&'tcx ty::Const<'tcx>] { - if values.is_empty() { - &[] - } else { - self.interners.arena.alloc_slice(values) - } - } - - pub fn alloc_name_const_slice(self, values: &[(ast::Name, &'tcx ty::Const<'tcx>)]) - -> &'tcx [(ast::Name, &'tcx ty::Const<'tcx>)] { - if values.is_empty() { - &[] - } else { - self.interners.arena.alloc_slice(values) - } - } - pub fn intern_const_alloc( self, alloc: Allocation, ) -> &'gcx Allocation { - let allocs = &mut self.allocation_interner.borrow_mut(); - if let Some(alloc) = allocs.get(&alloc) { - return alloc; - } - - let interned = self.global_arenas.const_allocs.alloc(alloc); - if let Some(prev) = allocs.replace(interned) { // insert into interner - bug!("Tried to overwrite interned Allocation: {:#?}", prev) - } - interned + self.allocation_interner.borrow_mut().intern(alloc, |alloc| { + self.global_arenas.const_allocs.alloc(alloc) + }) } /// Allocates a byte or string literal for `mir::interpret`, read-only pub fn allocate_bytes(self, bytes: &[u8]) -> interpret::AllocId { // create an allocation that just contains these bytes - let alloc = interpret::Allocation::from_byte_aligned_bytes(bytes); + let alloc = interpret::Allocation::from_byte_aligned_bytes(bytes, ()); let alloc = self.intern_const_alloc(alloc); self.alloc_map.lock().allocate(alloc) } pub fn intern_stability(self, stab: attr::Stability) -> &'gcx attr::Stability { - let mut stability_interner = self.stability_interner.borrow_mut(); - if let Some(st) = stability_interner.get(&stab) { - return st; - } + self.stability_interner.borrow_mut().intern(stab, |stab| { + self.global_interners.arena.alloc(stab) + }) + } - let interned = self.global_interners.arena.alloc(stab); - if let Some(prev) = stability_interner.replace(interned) { - bug!("Tried to overwrite interned Stability: {:?}", prev) - } - interned + pub fn intern_lazy_const(self, c: ty::LazyConst<'tcx>) -> &'tcx ty::LazyConst<'tcx> { + self.global_interners.arena.alloc(c) } pub fn intern_layout(self, layout: LayoutDetails) -> &'gcx LayoutDetails { - let mut layout_interner = self.layout_interner.borrow_mut(); - if let Some(layout) = layout_interner.get(&layout) { - return layout; - } - - let interned = self.global_arenas.layout.alloc(layout); - if let Some(prev) = layout_interner.replace(interned) { - bug!("Tried to overwrite interned Layout: {:?}", prev) - } - interned + self.layout_interner.borrow_mut().intern(layout, |layout| { + self.global_arenas.layout.alloc(layout) + }) } /// Returns a range of the start/end indices specified with the @@ -1117,9 +1160,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// Returns true if self is the same as self.global_tcx(). fn is_global(self) -> bool { - let local = self.interners as *const _; - let global = &self.global_interners as *const _; - local as usize == global as usize + ptr::eq(self.interners, &self.global_interners) } /// Create a type context and call the closure with a `TyCtxt` reference @@ -1130,7 +1171,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { cstore: &'tcx CrateStoreDyn, local_providers: ty::query::Providers<'tcx>, extern_providers: ty::query::Providers<'tcx>, - arenas: &'tcx AllArenas<'tcx>, + arenas: &'tcx mut AllArenas<'tcx>, resolutions: ty::Resolutions, hir: hir_map::Map<'tcx>, on_disk_query_result_cache: query::OnDiskCache<'tcx>, @@ -1191,7 +1232,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { Lrc::new(StableVec::new(v))); } - let gcx = &GlobalCtxt { + arenas.global_ctxt = Some(GlobalCtxt { sess: s, cstore, global_arenas: &arenas.global, @@ -1215,8 +1256,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { .into_iter() .map(|(id, sp)| (hir.local_def_id(id), sp)) .collect(), + glob_map: resolutions.glob_map.into_iter().map(|(id, names)| { + (hir.local_def_id(id), names) + }).collect(), extern_prelude: resolutions.extern_prelude, - hir, + hir_map: hir, def_path_hash_to_def_id, queries: query::Queries::new( providers, @@ -1234,11 +1278,17 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { alloc_map: Lock::new(interpret::AllocMap::new()), tx_to_llvm_workers: Lock::new(tx), output_filenames: Arc::new(output_filenames.clone()), - }; + }); + + let gcx = arenas.global_ctxt.as_ref().unwrap(); sync::assert_send_val(&gcx); - tls::enter_global(gcx, f) + let r = tls::enter_global(gcx, f); + + gcx.queries.record_computed_queries(s); + + r } pub fn consider_optimizing String>(&self, msg: T) -> bool { @@ -1302,7 +1352,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn def_key(self, id: DefId) -> hir_map::DefKey { if id.is_local() { - self.hir.def_key(id) + self.hir().def_key(id) } else { self.cstore.def_key(id) } @@ -1315,7 +1365,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// be a non-local `DefPath`. pub fn def_path(self, id: DefId) -> hir_map::DefPath { if id.is_local() { - self.hir.def_path(id) + self.hir().def_path(id) } else { self.cstore.def_path(id) } @@ -1324,7 +1374,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { #[inline] pub fn def_path_hash(self, def_id: DefId) -> hir_map::DefPathHash { if def_id.is_local() { - self.hir.definitions().def_path_hash(def_id.index) + self.hir().definitions().def_path_hash(def_id.index) } else { self.cstore.def_path_hash(def_id) } @@ -1361,12 +1411,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.cstore.crate_data_as_rc_any(cnum) } + #[inline(always)] pub fn create_stable_hashing_context(self) -> StableHashingContext<'a> { - let krate = self.dep_graph.with_ignore(|| self.gcx.hir.krate()); + let krate = self.gcx.hir_map.forest.untracked_krate(); StableHashingContext::new(self.sess, krate, - self.hir.definitions(), + self.hir().definitions(), self.cstore) } @@ -1478,15 +1529,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// done with either: `-Ztwo-phase-borrows`, `#![feature(nll)]`, /// or by opting into an edition after 2015. pub fn two_phase_borrows(self) -> bool { - if self.features().nll || self.sess.opts.debugging_opts.two_phase_borrows { - return true; - } - - match self.sess.edition() { - Edition::Edition2015 => false, - Edition::Edition2018 => true, - _ => true, - } + self.sess.rust_2018() || self.features().nll || + self.sess.opts.debugging_opts.two_phase_borrows } /// What mode(s) of borrowck should we run? AST? MIR? both? @@ -1530,23 +1574,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { BorrowckMode::Ast => match self.sess.edition() { Edition::Edition2015 => BorrowckMode::Ast, Edition::Edition2018 => BorrowckMode::Migrate, - - // For now, future editions mean Migrate. (But it - // would make a lot of sense for it to be changed to - // `BorrowckMode::Mir`, depending on how we plan to - // time the forcing of full migration to NLL.) - _ => BorrowckMode::Migrate, }, } } - /// Should we emit EndRegion MIR statements? These are consumed by - /// MIR borrowck, but not when NLL is used. - pub fn emit_end_regions(self) -> bool { - self.sess.opts.debugging_opts.emit_end_regions || - self.use_mir_borrowck() - } - #[inline] pub fn local_crate_exports_generics(self) -> bool { debug_assert!(self.sess.opts.share_generics()); @@ -1574,10 +1605,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { _ => return None, // not a free region }; - let node_id = self.hir + let node_id = self.hir() .as_local_node_id(suitable_region_binding_scope) .unwrap(); - let is_impl_item = match self.hir.find(node_id) { + let is_impl_item = match self.hir().find(node_id) { Some(Node::Item(..)) | Some(Node::TraitItem(..)) => false, Some(Node::ImplItem(..)) => { self.is_bound_region_in_impl_item(suitable_region_binding_scope) @@ -1597,8 +1628,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { scope_def_id: DefId, ) -> Option> { // HACK: `type_of_def_id()` will fail on these (#55796), so return None - let node_id = self.hir.as_local_node_id(scope_def_id).unwrap(); - match self.hir.get(node_id) { + let node_id = self.hir().as_local_node_id(scope_def_id).unwrap(); + match self.hir().get(node_id) { Node::Item(item) => { match item.node { ItemKind::Fn(..) => { /* type_of_def_id() will work */ } @@ -1654,30 +1685,36 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } } -impl<'gcx: 'tcx, 'tcx> GlobalCtxt<'gcx> { +impl<'gcx> GlobalCtxt<'gcx> { /// Call the closure with a local `TyCtxt` using the given arena. - pub fn enter_local( - &self, + /// `interners` is a slot passed so we can create a CtxtInterners + /// with the same lifetime as `arena`. + pub fn enter_local<'tcx, F, R>( + &'gcx self, arena: &'tcx SyncDroplessArena, + interners: &'tcx mut Option>, f: F ) -> R where - F: for<'a> FnOnce(TyCtxt<'a, 'gcx, 'tcx>) -> R + F: FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R, + 'gcx: 'tcx, { - let interners = CtxtInterners::new(arena); + *interners = Some(CtxtInterners::new(&arena)); let tcx = TyCtxt { gcx: self, - interners: &interners, + interners: interners.as_ref().unwrap(), + dummy: PhantomData, }; ty::tls::with_related_context(tcx.global_tcx(), |icx| { let new_icx = ty::tls::ImplicitCtxt { tcx, query: icx.query.clone(), + diagnostics: icx.diagnostics, layout_depth: icx.layout_depth, - task: icx.task, + task_deps: icx.task_deps, }; - ty::tls::enter_context(&new_icx, |new_icx| { - f(new_icx.tcx) + ty::tls::enter_context(&new_icx, |_| { + f(tcx) }) }) } @@ -1699,216 +1736,75 @@ impl<'gcx: 'tcx, 'tcx> GlobalCtxt<'gcx> { /// For Ty, None can be returned if either the type interner doesn't /// contain the TyKind key or if the address of the interned /// pointer differs. The latter case is possible if a primitive type, -/// e.g. `()` or `u8`, was interned in a different context. +/// e.g., `()` or `u8`, was interned in a different context. pub trait Lift<'tcx>: fmt::Debug { type Lifted: fmt::Debug + 'tcx; fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option; } -impl<'a, 'tcx> Lift<'tcx> for Ty<'a> { - type Lifted = Ty<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option> { - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None - } - } -} - -impl<'a, 'tcx> Lift<'tcx> for Region<'a> { - type Lifted = Region<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option> { - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None - } - } -} - -impl<'a, 'tcx> Lift<'tcx> for Goal<'a> { - type Lifted = Goal<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option> { - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None - } - } -} -impl<'a, 'tcx> Lift<'tcx> for &'a List> { - type Lifted = &'tcx List>; - fn lift_to_tcx<'b, 'gcx>( - &self, - tcx: TyCtxt<'b, 'gcx, 'tcx>, - ) -> Option<&'tcx List>> { - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None - } - } -} - -impl<'a, 'tcx> Lift<'tcx> for &'a List> { - type Lifted = &'tcx List>; - fn lift_to_tcx<'b, 'gcx>( - &self, - tcx: TyCtxt<'b, 'gcx, 'tcx>, - ) -> Option<&'tcx List>> { - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None - } - } -} - -impl<'a, 'tcx> Lift<'tcx> for &'a Const<'a> { - type Lifted = &'tcx Const<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<&'tcx Const<'tcx>> { - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None +macro_rules! nop_lift { + ($ty:ty => $lifted:ty) => { + impl<'a, 'tcx> Lift<'tcx> for $ty { + type Lifted = $lifted; + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + if tcx.interners.arena.in_arena(*self as *const _) { + return Some(unsafe { mem::transmute(*self) }); + } + // Also try in the global tcx if we're not that. + if !tcx.is_global() { + self.lift_to_tcx(tcx.global_tcx()) + } else { + None + } + } } - } + }; } -impl<'a, 'tcx> Lift<'tcx> for &'a Substs<'a> { - type Lifted = &'tcx Substs<'tcx>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<&'tcx Substs<'tcx>> { - if self.len() == 0 { - return Some(List::empty()); - } - if tcx.interners.arena.in_arena(&self[..] as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None +macro_rules! nop_list_lift { + ($ty:ty => $lifted:ty) => { + impl<'a, 'tcx> Lift<'tcx> for &'a List<$ty> { + type Lifted = &'tcx List<$lifted>; + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + if self.is_empty() { + return Some(List::empty()); + } + if tcx.interners.arena.in_arena(*self as *const _) { + return Some(unsafe { mem::transmute(*self) }); + } + // Also try in the global tcx if we're not that. + if !tcx.is_global() { + self.lift_to_tcx(tcx.global_tcx()) + } else { + None + } + } } - } + }; } -impl<'a, 'tcx> Lift<'tcx> for &'a List> { - type Lifted = &'tcx List>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) - -> Option<&'tcx List>> { - if self.len() == 0 { - return Some(List::empty()); - } - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None - } - } -} +nop_lift!{Ty<'a> => Ty<'tcx>} +nop_lift!{Region<'a> => Region<'tcx>} +nop_lift!{Goal<'a> => Goal<'tcx>} +nop_lift!{&'a LazyConst<'a> => &'tcx LazyConst<'tcx>} -impl<'a, 'tcx> Lift<'tcx> for &'a List> { - type Lifted = &'tcx List>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) - -> Option<&'tcx List>> { - if self.is_empty() { - return Some(List::empty()); - } - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None - } - } -} +nop_list_lift!{Goal<'a> => Goal<'tcx>} +nop_list_lift!{Clause<'a> => Clause<'tcx>} +nop_list_lift!{Ty<'a> => Ty<'tcx>} +nop_list_lift!{ExistentialPredicate<'a> => ExistentialPredicate<'tcx>} +nop_list_lift!{Predicate<'a> => Predicate<'tcx>} +nop_list_lift!{CanonicalVarInfo => CanonicalVarInfo} +nop_list_lift!{ProjectionKind<'a> => ProjectionKind<'tcx>} -impl<'a, 'tcx> Lift<'tcx> for &'a List> { - type Lifted = &'tcx List>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) - -> Option<&'tcx List>> { - if self.is_empty() { - return Some(List::empty()); - } - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None - } - } -} +// this is the impl for `&'a Substs<'a>` +nop_list_lift!{Kind<'a> => Kind<'tcx>} -impl<'a, 'tcx> Lift<'tcx> for &'a List { - type Lifted = &'tcx List; +impl<'a, 'tcx> Lift<'tcx> for &'a mir::interpret::Allocation { + type Lifted = &'tcx mir::interpret::Allocation; fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { - if self.len() == 0 { - return Some(List::empty()); - } - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None - } - } -} - -impl<'a, 'tcx> Lift<'tcx> for &'a List> { - type Lifted = &'tcx List>; - fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { - if self.len() == 0 { - return Some(List::empty()); - } - if tcx.interners.arena.in_arena(*self as *const _) { - return Some(unsafe { mem::transmute(*self) }); - } - // Also try in the global tcx if we're not that. - if !tcx.is_global() { - self.lift_to_tcx(tcx.global_tcx()) - } else { - None - } + assert!(tcx.global_arenas.const_allocs.in_arena(*self as *const _)); + Some(unsafe { mem::transmute(*self) }) } } @@ -1917,17 +1813,20 @@ pub mod tls { use std::fmt; use std::mem; + use std::marker::PhantomData; + use std::ptr; use syntax_pos; use ty::query; use errors::{Diagnostic, TRACK_DIAGNOSTICS}; use rustc_data_structures::OnDrop; use rustc_data_structures::sync::{self, Lrc, Lock}; - use dep_graph::OpenTask; + use rustc_data_structures::thin_vec::ThinVec; + use dep_graph::TaskDeps; - #[cfg(not(parallel_queries))] + #[cfg(not(parallel_compiler))] use std::cell::Cell; - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] use rayon_core; /// This is the implicit state of rustc. It contains the current @@ -1936,46 +1835,53 @@ pub mod tls { /// you should also have access to an ImplicitCtxt through the functions /// in this module. #[derive(Clone)] - pub struct ImplicitCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { + pub struct ImplicitCtxt<'a, 'gcx: 'tcx, 'tcx> { /// The current TyCtxt. Initially created by `enter_global` and updated /// by `enter_local` with a new local interner - pub tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, - /// The current query job, if any. This is updated by start_job in + /// The current query job, if any. This is updated by JobOwner::start in /// ty::query::plumbing when executing a query pub query: Option>>, + /// Where to store diagnostics for the current query job, if any. + /// This is updated by JobOwner::start in ty::query::plumbing when executing a query + pub diagnostics: Option<&'a Lock>>, + /// Used to prevent layout from recursing too deeply. pub layout_depth: usize, /// The current dep graph task. This is used to add dependencies to queries /// when executing them - pub task: &'a OpenTask, + pub task_deps: Option<&'a Lock>, } /// Sets Rayon's thread local variable which is preserved for Rayon jobs /// to `value` during the call to `f`. It is restored to its previous value after. /// This is used to set the pointer to the new ImplicitCtxt. - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] + #[inline] fn set_tlv R, R>(value: usize, f: F) -> R { rayon_core::tlv::with(value, f) } /// Gets Rayon's thread local variable which is preserved for Rayon jobs. /// This is used to get the pointer to the current ImplicitCtxt. - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] + #[inline] fn get_tlv() -> usize { rayon_core::tlv::get() } /// A thread local variable which stores a pointer to the current ImplicitCtxt - #[cfg(not(parallel_queries))] + #[cfg(not(parallel_compiler))] thread_local!(static TLV: Cell = Cell::new(0)); /// Sets TLV to `value` during the call to `f`. /// It is restored to its previous value after. /// This is used to set the pointer to the new ImplicitCtxt. - #[cfg(not(parallel_queries))] + #[cfg(not(parallel_compiler))] + #[inline] fn set_tlv R, R>(value: usize, f: F) -> R { let old = get_tlv(); let _reset = OnDrop(move || TLV.with(|tlv| tlv.set(old))); @@ -1984,7 +1890,7 @@ pub mod tls { } /// This is used to get the pointer to the current ImplicitCtxt. - #[cfg(not(parallel_queries))] + #[cfg(not(parallel_compiler))] fn get_tlv() -> usize { TLV.with(|tlv| tlv.get()) } @@ -1992,8 +1898,12 @@ pub mod tls { /// This is a callback from libsyntax as it cannot access the implicit state /// in librustc otherwise fn span_debug(span: syntax_pos::Span, f: &mut fmt::Formatter<'_>) -> fmt::Result { - with(|tcx| { - write!(f, "{}", tcx.sess.source_map().span_to_string(span)) + with_opt(|tcx| { + if let Some(tcx) = tcx { + write!(f, "{}", tcx.sess.source_map().span_to_string(span)) + } else { + syntax_pos::default_span_debug(span, f) + } }) } @@ -2003,8 +1913,9 @@ pub mod tls { fn track_diagnostic(diagnostic: &Diagnostic) { with_context_opt(|icx| { if let Some(icx) = icx { - if let Some(ref query) = icx.query { - query.diagnostics.lock().push(diagnostic.clone()); + if let Some(ref diagnostics) = icx.diagnostics { + let mut diagnostics = diagnostics.lock(); + diagnostics.extend(Some(diagnostic.clone())); } } }) @@ -2036,6 +1947,7 @@ pub mod tls { } /// Sets `context` as the new current ImplicitCtxt for the duration of the function `f` + #[inline] pub fn enter_context<'a, 'gcx: 'tcx, 'tcx, F, R>(context: &ImplicitCtxt<'a, 'gcx, 'tcx>, f: F) -> R where F: FnOnce(&ImplicitCtxt<'a, 'gcx, 'tcx>) -> R @@ -2049,8 +1961,8 @@ pub mod tls { /// creating a initial TyCtxt and ImplicitCtxt. /// This happens once per rustc session and TyCtxts only exists /// inside the `f` function. - pub fn enter_global<'gcx, F, R>(gcx: &GlobalCtxt<'gcx>, f: F) -> R - where F: for<'a> FnOnce(TyCtxt<'a, 'gcx, 'gcx>) -> R + pub fn enter_global<'gcx, F, R>(gcx: &'gcx GlobalCtxt<'gcx>, f: F) -> R + where F: FnOnce(TyCtxt<'gcx, 'gcx, 'gcx>) -> R { with_thread_locals(|| { // Update GCX_PTR to indicate there's a GlobalCtxt available @@ -2065,12 +1977,14 @@ pub mod tls { let tcx = TyCtxt { gcx, interners: &gcx.global_interners, + dummy: PhantomData, }; let icx = ImplicitCtxt { tcx, query: None, + diagnostics: None, layout_depth: 0, - task: &OpenTask::Ignore, + task_deps: None, }; enter_context(&icx, |_| { f(tcx) @@ -2094,17 +2008,20 @@ pub mod tls { let tcx = TyCtxt { gcx, interners: &gcx.global_interners, + dummy: PhantomData, }; let icx = ImplicitCtxt { query: None, + diagnostics: None, tcx, layout_depth: 0, - task: &OpenTask::Ignore, + task_deps: None, }; enter_context(&icx, |_| f(tcx)) } /// Allows access to the current ImplicitCtxt in a closure if one is available + #[inline] pub fn with_context_opt(f: F) -> R where F: for<'a, 'gcx, 'tcx> FnOnce(Option<&ImplicitCtxt<'a, 'gcx, 'tcx>>) -> R { @@ -2122,6 +2039,7 @@ pub mod tls { /// Allows access to the current ImplicitCtxt. /// Panics if there is no ImplicitCtxt available + #[inline] pub fn with_context(f: F) -> R where F: for<'a, 'gcx, 'tcx> FnOnce(&ImplicitCtxt<'a, 'gcx, 'tcx>) -> R { @@ -2133,13 +2051,13 @@ pub mod tls { /// with the same 'gcx lifetime as the TyCtxt passed in. /// This will panic if you pass it a TyCtxt which has a different global interner from /// the current ImplicitCtxt's tcx field. + #[inline] pub fn with_related_context<'a, 'gcx, 'tcx1, F, R>(tcx: TyCtxt<'a, 'gcx, 'tcx1>, f: F) -> R where F: for<'b, 'tcx2> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx2>) -> R { with_context(|context| { unsafe { - let gcx = tcx.gcx as *const _ as usize; - assert!(context.tcx.gcx as *const _ as usize == gcx); + assert!(ptr::eq(context.tcx.gcx, tcx.gcx)); let context: &ImplicitCtxt<'_, '_, '_> = mem::transmute(context); f(context) } @@ -2151,15 +2069,14 @@ pub mod tls { /// is given an ImplicitCtxt with the same 'tcx and 'gcx lifetimes as the TyCtxt passed in. /// This will panic if you pass it a TyCtxt which has a different global interner or /// a different local interner from the current ImplicitCtxt's tcx field. + #[inline] pub fn with_fully_related_context<'a, 'gcx, 'tcx, F, R>(tcx: TyCtxt<'a, 'gcx, 'tcx>, f: F) -> R where F: for<'b> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx>) -> R { with_context(|context| { unsafe { - let gcx = tcx.gcx as *const _ as usize; - let interners = tcx.interners as *const _ as usize; - assert!(context.tcx.gcx as *const _ as usize == gcx); - assert!(context.tcx.interners as *const _ as usize == interners); + assert!(ptr::eq(context.tcx.gcx, tcx.gcx)); + assert!(ptr::eq(context.tcx.interners, tcx.interners)); let context: &ImplicitCtxt<'_, '_, '_> = mem::transmute(context); f(context) } @@ -2168,6 +2085,7 @@ pub mod tls { /// Allows access to the TyCtxt in the current ImplicitCtxt. /// Panics if there is no ImplicitCtxt available + #[inline] pub fn with(f: F) -> R where F: for<'a, 'gcx, 'tcx> FnOnce(TyCtxt<'a, 'gcx, 'tcx>) -> R { @@ -2176,6 +2094,7 @@ pub mod tls { /// Allows access to the TyCtxt in the current ImplicitCtxt. /// The closure is passed None if there is no ImplicitCtxt available + #[inline] pub fn with_opt(f: F) -> R where F: for<'a, 'gcx, 'tcx> FnOnce(Option>) -> R { @@ -2207,7 +2126,7 @@ macro_rules! sty_debug_print { }; $(let mut $variant = total;)* - for &Interned(t) in tcx.interners.type_.borrow().iter() { + for &Interned(t) in tcx.interners.type_.borrow().keys() { let variant = match t.sty { ty::Bool | ty::Char | ty::Int(..) | ty::Uint(..) | ty::Float(..) | ty::Str | ty::Never => continue, @@ -2250,7 +2169,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { pub fn print_debug_stats(self) { sty_debug_print!( self, - Adt, Array, Slice, RawPtr, Ref, FnDef, FnPtr, + Adt, Array, Slice, RawPtr, Ref, FnDef, FnPtr, Placeholder, Generator, GeneratorWitness, Dynamic, Closure, Tuple, Bound, Param, Infer, UnnormalizedProjection, Projection, Opaque, Foreign); @@ -2266,7 +2185,14 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { /// An entry in an interner. struct Interned<'tcx, T: 'tcx+?Sized>(&'tcx T); -// NB: An Interned compares and hashes as a sty. +impl<'tcx, T: 'tcx+?Sized> Clone for Interned<'tcx, T> { + fn clone(&self) -> Self { + Interned(self.0) + } +} +impl<'tcx, T: 'tcx+?Sized> Copy for Interned<'tcx, T> {} + +// N.B., an `Interned` compares and hashes as a sty. impl<'tcx> PartialEq for Interned<'tcx, TyS<'tcx>> { fn eq(&self, other: &Interned<'tcx, TyS<'tcx>>) -> bool { self.0.sty == other.0.sty @@ -2287,7 +2213,7 @@ impl<'tcx: 'lcx, 'lcx> Borrow> for Interned<'tcx, TyS<'tcx>> { } } -// NB: An Interned> compares and hashes as its elements. +// N.B., an `Interned>` compares and hashes as its elements. impl<'tcx, T: PartialEq> PartialEq for Interned<'tcx, List> { fn eq(&self, other: &Interned<'tcx, List>) -> bool { self.0[..] == other.0[..] @@ -2386,37 +2312,28 @@ macro_rules! intern_method { // determine that all contents are in the global tcx. // See comments on Lift for why we can't use that. if ($keep_in_local_tcx)(&v) { - let mut interner = self.interners.$name.borrow_mut(); - if let Some(&Interned(v)) = interner.get(key) { - return v; - } - - // Make sure we don't end up with inference - // types/regions in the global tcx. - if self.is_global() { - bug!("Attempted to intern `{:?}` which contains \ - inference types/regions in the global type context", - v); - } - - let i = $alloc_method(&self.interners.arena, v); - interner.insert(Interned(i)); - i + self.interners.$name.borrow_mut().intern_ref(key, || { + // Make sure we don't end up with inference + // types/regions in the global tcx. + if self.is_global() { + bug!("Attempted to intern `{:?}` which contains \ + inference types/regions in the global type context", + v); + } + + Interned($alloc_method(&self.interners.arena, v)) + }).0 } else { - let mut interner = self.global_interners.$name.borrow_mut(); - if let Some(&Interned(v)) = interner.get(key) { - return v; - } - - // This transmutes $alloc<'tcx> to $alloc<'gcx> - let v = unsafe { - mem::transmute(v) - }; - let i: &$lt_tcx $ty = $alloc_method(&self.global_interners.arena, v); - // Cast to 'gcx - let i = unsafe { mem::transmute(i) }; - interner.insert(Interned(i)); - i + self.global_interners.$name.borrow_mut().intern_ref(key, || { + // This transmutes $alloc<'tcx> to $alloc<'gcx> + let v = unsafe { + mem::transmute(v) + }; + let i: &$lt_tcx $ty = $alloc_method(&self.global_interners.arena, v); + // Cast to 'gcx + let i = unsafe { mem::transmute(i) }; + Interned(i) + }).0 } } } @@ -2454,7 +2371,6 @@ pub fn keep_local<'tcx, T: ty::TypeFoldable<'tcx>>(x: &T) -> bool { direct_interners!('tcx, region: mk_region(|r: &RegionKind| r.keep_in_local_tcx()) -> RegionKind, - const_: mk_const(|c: &Const<'_>| keep_local(&c.ty) || keep_local(&c.val)) -> Const<'tcx>, goal: mk_goal(|c: &GoalKind<'_>| keep_local(c)) -> GoalKind<'tcx> ); @@ -2507,7 +2423,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// Given a closure signature `sig`, returns an equivalent `fn` /// type with the same signature. Detuples and so forth -- so - /// e.g. if we have a sig with `Fn<(u32, i32)>` then you would get + /// e.g., if we have a sig with `Fn<(u32, i32)>` then you would get /// a `fn(u32, i32)`. pub fn coerce_closure_fn_ty(self, sig: PolyFnSig<'tcx>) -> Ty<'tcx> { let converted_sig = sig.map_bound(|s| { @@ -2529,6 +2445,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.mk_fn_ptr(converted_sig) } + #[inline] pub fn mk_ty(&self, st: TyKind<'tcx>) -> Ty<'tcx> { CtxtInterners::intern_ty(&self.interners, &self.global_interners, st) } @@ -2562,19 +2479,23 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } + #[inline] pub fn mk_str(self) -> Ty<'tcx> { self.mk_ty(Str) } + #[inline] pub fn mk_static_str(self) -> Ty<'tcx> { self.mk_imm_ref(self.types.re_static, self.mk_str()) } + #[inline] pub fn mk_adt(self, def: &'tcx AdtDef, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { // take a copy of substs so that we own the vectors inside self.mk_ty(Adt(def, substs)) } + #[inline] pub fn mk_foreign(self, def_id: DefId) -> Ty<'tcx> { self.mk_ty(Foreign(def_id)) } @@ -2598,42 +2519,54 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.mk_ty(Adt(adt_def, substs)) } + #[inline] pub fn mk_ptr(self, tm: TypeAndMut<'tcx>) -> Ty<'tcx> { self.mk_ty(RawPtr(tm)) } + #[inline] pub fn mk_ref(self, r: Region<'tcx>, tm: TypeAndMut<'tcx>) -> Ty<'tcx> { self.mk_ty(Ref(r, tm.ty, tm.mutbl)) } + #[inline] pub fn mk_mut_ref(self, r: Region<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { self.mk_ref(r, TypeAndMut {ty: ty, mutbl: hir::MutMutable}) } + #[inline] pub fn mk_imm_ref(self, r: Region<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { self.mk_ref(r, TypeAndMut {ty: ty, mutbl: hir::MutImmutable}) } + #[inline] pub fn mk_mut_ptr(self, ty: Ty<'tcx>) -> Ty<'tcx> { self.mk_ptr(TypeAndMut {ty: ty, mutbl: hir::MutMutable}) } + #[inline] pub fn mk_imm_ptr(self, ty: Ty<'tcx>) -> Ty<'tcx> { self.mk_ptr(TypeAndMut {ty: ty, mutbl: hir::MutImmutable}) } + #[inline] pub fn mk_nil_ptr(self) -> Ty<'tcx> { self.mk_imm_ptr(self.mk_unit()) } + #[inline] pub fn mk_array(self, ty: Ty<'tcx>, n: u64) -> Ty<'tcx> { - self.mk_ty(Array(ty, ty::Const::from_usize(self, n))) + self.mk_ty(Array(ty, self.intern_lazy_const( + ty::LazyConst::Evaluated(ty::Const::from_usize(self.global_tcx(), n)) + ))) } + #[inline] pub fn mk_slice(self, ty: Ty<'tcx>) -> Ty<'tcx> { self.mk_ty(Slice(ty)) } + #[inline] pub fn intern_tup(self, ts: &[Ty<'tcx>]) -> Ty<'tcx> { self.mk_ty(Tuple(self.intern_type_list(ts))) } @@ -2642,10 +2575,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { iter.intern_with(|ts| self.mk_ty(Tuple(self.intern_type_list(ts)))) } + #[inline] pub fn mk_unit(self) -> Ty<'tcx> { - self.intern_tup(&[]) + self.types.unit } + #[inline] pub fn mk_diverging_default(self) -> Ty<'tcx> { if self.features().never_type { self.types.never @@ -2654,19 +2589,23 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } + #[inline] pub fn mk_bool(self) -> Ty<'tcx> { self.mk_ty(Bool) } + #[inline] pub fn mk_fn_def(self, def_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { self.mk_ty(FnDef(def_id, substs)) } + #[inline] pub fn mk_fn_ptr(self, fty: PolyFnSig<'tcx>) -> Ty<'tcx> { self.mk_ty(FnPtr(fty)) } + #[inline] pub fn mk_dynamic( self, obj: ty::Binder<&'tcx List>>, @@ -2675,6 +2614,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.mk_ty(Dynamic(obj, reg)) } + #[inline] pub fn mk_projection(self, item_def_id: DefId, substs: &'tcx Substs<'tcx>) @@ -2685,11 +2625,13 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { })) } + #[inline] pub fn mk_closure(self, closure_id: DefId, closure_substs: ClosureSubsts<'tcx>) -> Ty<'tcx> { self.mk_ty(Closure(closure_id, closure_substs)) } + #[inline] pub fn mk_generator(self, id: DefId, generator_substs: GeneratorSubsts<'tcx>, @@ -2698,34 +2640,41 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.mk_ty(Generator(id, generator_substs, movability)) } + #[inline] pub fn mk_generator_witness(self, types: ty::Binder<&'tcx List>>) -> Ty<'tcx> { self.mk_ty(GeneratorWitness(types)) } + #[inline] pub fn mk_var(self, v: TyVid) -> Ty<'tcx> { self.mk_infer(TyVar(v)) } + #[inline] pub fn mk_int_var(self, v: IntVid) -> Ty<'tcx> { self.mk_infer(IntVar(v)) } + #[inline] pub fn mk_float_var(self, v: FloatVid) -> Ty<'tcx> { self.mk_infer(FloatVar(v)) } + #[inline] pub fn mk_infer(self, it: InferTy) -> Ty<'tcx> { self.mk_ty(Infer(it)) } + #[inline] pub fn mk_ty_param(self, index: u32, name: InternedString) -> Ty<'tcx> { self.mk_ty(Param(ParamTy { idx: index, name: name })) } + #[inline] pub fn mk_self_type(self) -> Ty<'tcx> { - self.mk_ty_param(0, keywords::SelfType.name().as_interned_str()) + self.mk_ty_param(0, keywords::SelfUpper.name().as_interned_str()) } pub fn mk_param_from_def(self, param: &ty::GenericParamDef) -> Kind<'tcx> { @@ -2737,6 +2686,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } + #[inline] pub fn mk_opaque(self, def_id: DefId, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { self.mk_ty(Opaque(def_id, substs)) } @@ -2880,11 +2830,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } pub fn lint_hir_note>(self, - lint: &'static Lint, - hir_id: HirId, - span: S, - msg: &str, - note: &str) { + lint: &'static Lint, + hir_id: HirId, + span: S, + msg: &str, + note: &str) { let mut err = self.struct_span_lint_hir(lint, hir_id, span.into(), msg); err.note(note); err.emit() @@ -2915,11 +2865,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.dep_graph.with_ignore(|| { let sets = self.lint_levels(LOCAL_CRATE); loop { - let hir_id = self.hir.definitions().node_to_hir_id(id); + let hir_id = self.hir().definitions().node_to_hir_id(id); if let Some(pair) = sets.level_and_source(lint, hir_id, self.sess) { return pair } - let next = self.hir.get_parent_node(id); + let next = self.hir().get_parent_node(id); if next == id { bug!("lint traversal reached the root of the crate"); } @@ -2935,7 +2885,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { msg: &str) -> DiagnosticBuilder<'tcx> { - let node_id = self.hir.hir_to_node_id(hir_id); + let node_id = self.hir().hir_to_node_id(hir_id); let (level, src) = self.lint_level_at_node(lint, node_id); lint::struct_lint_level(self.sess, lint, level, src, Some(span.into()), msg) } @@ -3027,9 +2977,6 @@ impl InternIteratorElement for Result { } pub fn provide(providers: &mut ty::query::Providers<'_>) { - // FIXME(#44234) - almost all of these queries have no sub-queries and - // therefore no actual inputs, they're just reading tables calculated in - // resolve! Does this work? Unsure! That's what the issue is about providers.in_scope_traits_map = |tcx, id| tcx.gcx.trait_map.get(&id).cloned(); providers.module_exports = |tcx, id| tcx.gcx.export_map.get(&id).cloned(); providers.crate_name = |tcx, id| { @@ -3052,6 +2999,10 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { assert_eq!(cnum, LOCAL_CRATE); Lrc::new(tcx.maybe_unused_extern_crates.clone()) }; + providers.names_imported_by_glob_use = |tcx, id| { + assert_eq!(id.krate, LOCAL_CRATE); + Lrc::new(tcx.glob_map.get(&id).cloned().unwrap_or_default()) + }; providers.stability_index = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); @@ -3059,16 +3010,16 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { }; providers.lookup_stability = |tcx, id| { assert_eq!(id.krate, LOCAL_CRATE); - let id = tcx.hir.definitions().def_index_to_hir_id(id.index); + let id = tcx.hir().definitions().def_index_to_hir_id(id.index); tcx.stability().local_stability(id) }; providers.lookup_deprecation_entry = |tcx, id| { assert_eq!(id.krate, LOCAL_CRATE); - let id = tcx.hir.definitions().def_index_to_hir_id(id.index); + let id = tcx.hir().definitions().def_index_to_hir_id(id.index); tcx.stability().local_deprecation_entry(id) }; providers.extern_mod_stmt_cnum = |tcx, id| { - let id = tcx.hir.as_local_node_id(id).unwrap(); + let id = tcx.hir().as_local_node_id(id).unwrap(); tcx.cstore.extern_mod_stmt_cnum_untracked(id) }; providers.all_crate_nums = |tcx, cnum| { @@ -3089,10 +3040,10 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { }; providers.is_panic_runtime = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); - attr::contains_name(tcx.hir.krate_attrs(), "panic_runtime") + attr::contains_name(tcx.hir().krate_attrs(), "panic_runtime") }; providers.is_compiler_builtins = |tcx, cnum| { assert_eq!(cnum, LOCAL_CRATE); - attr::contains_name(tcx.hir.krate_attrs(), "compiler_builtins") + attr::contains_name(tcx.hir().krate_attrs(), "compiler_builtins") }; } diff --git a/src/librustc/ty/erase_regions.rs b/src/librustc/ty/erase_regions.rs index f53e634a044..da7e021b2d5 100644 --- a/src/librustc/ty/erase_regions.rs +++ b/src/librustc/ty/erase_regions.rs @@ -1,14 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use ty::{self, Ty, TyCtxt}; +use ty::{self, Ty, TyCtxt, TypeFlags}; use ty::fold::{TypeFolder, TypeFoldable}; pub(super) fn provide(providers: &mut ty::query::Providers<'_>) { @@ -19,7 +9,7 @@ pub(super) fn provide(providers: &mut ty::query::Providers<'_>) { } fn erase_regions_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { - // NB: use `super_fold_with` here. If we used `fold_with`, it + // N.B., use `super_fold_with` here. If we used `fold_with`, it // could invoke the `erase_regions_ty` query recursively. ty.super_fold_with(&mut RegionEraserVisitor { tcx }) } @@ -31,6 +21,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn erase_regions(self, value: &T) -> T where T : TypeFoldable<'tcx> { + // If there's nothing to erase avoid performing the query at all + if !value.has_type_flags(TypeFlags::HAS_RE_LATE_BOUND | TypeFlags::HAS_FREE_REGIONS) { + return value.clone(); + } + let value1 = value.fold_with(&mut RegionEraserVisitor { tcx: self }); debug!("erase_regions({:?}) = {:?}", value, value1); value1 diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 4737c72b1ef..f444013e2a3 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -1,15 +1,5 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def_id::DefId; -use ty::{self, BoundRegion, Region, Ty, TyCtxt}; +use ty::{self, Region, Ty, TyCtxt}; use std::borrow::Cow; use std::fmt; use rustc_target::spec::abi; @@ -19,7 +9,7 @@ use syntax_pos::Span; use hir; -#[derive(Clone, Copy, Debug)] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct ExpectedFound { pub expected: T, pub found: T, @@ -37,8 +27,7 @@ pub enum TypeError<'tcx> { ArgCount, RegionsDoesNotOutlive(Region<'tcx>, Region<'tcx>), - RegionsInsufficientlyPolymorphic(BoundRegion, Region<'tcx>), - RegionsOverlyPolymorphic(BoundRegion, Region<'tcx>), + RegionsPlaceholderMismatch, Sorts(ExpectedFound>), IntMismatch(ExpectedFound), @@ -112,17 +101,8 @@ impl<'tcx> fmt::Display for TypeError<'tcx> { RegionsDoesNotOutlive(..) => { write!(f, "lifetime mismatch") } - RegionsInsufficientlyPolymorphic(br, _) => { - write!(f, - "expected bound lifetime parameter{}{}, found concrete lifetime", - if br.is_named() { " " } else { "" }, - br) - } - RegionsOverlyPolymorphic(br, _) => { - write!(f, - "expected concrete lifetime, found bound lifetime parameter{}{}", - if br.is_named() { " " } else { "" }, - br) + RegionsPlaceholderMismatch => { + write!(f, "one type is more general than the other") } Sorts(values) => ty::tls::with(|tcx| { report_maybe_different(f, &values.expected.sort_string(tcx), @@ -177,11 +157,12 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { ty::Adt(def, _) => format!("{} `{}`", def.descr(), tcx.item_path_str(def.did)).into(), ty::Foreign(def_id) => format!("extern type `{}`", tcx.item_path_str(def_id)).into(), - ty::Array(_, n) => { - match n.assert_usize(tcx) { + ty::Array(_, n) => match n { + ty::LazyConst::Evaluated(n) => match n.assert_usize(tcx) { Some(n) => format!("array of {} elements", n).into(), None => "array".into(), - } + }, + ty::LazyConst::Unevaluated(..) => "array".into(), } ty::Slice(_) => "slice".into(), ty::RawPtr(_) => "*-ptr".into(), @@ -203,16 +184,21 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { ty::FnDef(..) => "fn item".into(), ty::FnPtr(_) => "fn pointer".into(), ty::Dynamic(ref inner, ..) => { - format!("trait {}", tcx.item_path_str(inner.principal().def_id())).into() + if let Some(principal) = inner.principal() { + format!("trait {}", tcx.item_path_str(principal.def_id())).into() + } else { + "trait".into() + } } ty::Closure(..) => "closure".into(), ty::Generator(..) => "generator".into(), ty::GeneratorWitness(..) => "generator witness".into(), ty::Tuple(..) => "tuple".into(), ty::Infer(ty::TyVar(_)) => "inferred type".into(), - ty::Infer(ty::IntVar(_)) => "integral variable".into(), - ty::Infer(ty::FloatVar(_)) => "floating-point variable".into(), - ty::Bound(_) | + ty::Infer(ty::IntVar(_)) => "integer".into(), + ty::Infer(ty::FloatVar(_)) => "floating-point number".into(), + ty::Placeholder(..) => "placeholder type".into(), + ty::Bound(..) => "bound type".into(), ty::Infer(ty::FreshTy(_)) => "fresh type".into(), ty::Infer(ty::FreshIntTy(_)) => "fresh integral type".into(), ty::Infer(ty::FreshFloatTy(_)) => "fresh floating-point type".into(), @@ -251,7 +237,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { { if let Ok(snippet) = self.sess.source_map().span_to_snippet(sp) { if snippet.chars().all(|c| c.is_digit(10) || c == '-' || c == '_') { - db.span_suggestion_with_applicability( + db.span_suggestion( sp, "use a float literal", format!("{}.0", snippet), diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index 380f95993f8..2b41fc4fe34 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def_id::DefId; use ich::StableHashingContext; use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult, @@ -43,6 +33,9 @@ pub enum SimplifiedTypeGen PtrSimplifiedType, NeverSimplifiedType, TupleSimplifiedType(usize), + /// A trait object, all of whose components are markers + /// (e.g., `dyn Send + Sync`). + MarkerTraitObjectSimplifiedType, TraitSimplifiedType(D), ClosureSimplifiedType(D), GeneratorSimplifiedType(D), @@ -78,7 +71,12 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, ty::Array(..) | ty::Slice(_) => Some(ArraySimplifiedType), ty::RawPtr(_) => Some(PtrSimplifiedType), ty::Dynamic(ref trait_info, ..) => { - Some(TraitSimplifiedType(trait_info.principal().def_id())) + match trait_info.principal_def_id() { + Some(principal_def_id) if !tcx.trait_is_auto(principal_def_id) => { + Some(TraitSimplifiedType(principal_def_id)) + } + _ => Some(MarkerTraitObjectSimplifiedType) + } } ty::Ref(_, ty, _) => { // since we introduce auto-refs during method lookup, we @@ -110,7 +108,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, // anything. when lazy normalization happens, this // will change. It would still be nice to have a way // to deal with known-not-to-unify-with-anything - // projections (e.g. the likes of <__S as Encoder>::Error). + // projections (e.g., the likes of <__S as Encoder>::Error). Some(ParameterSimplifiedType) } else { None @@ -122,7 +120,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, ty::Foreign(def_id) => { Some(ForeignSimplifiedType(def_id)) } - ty::Bound(..) | ty::Infer(_) | ty::Error => None, + ty::Placeholder(..) | ty::Bound(..) | ty::Infer(_) | ty::Error => None, } } @@ -142,6 +140,7 @@ impl SimplifiedTypeGen { ArraySimplifiedType => ArraySimplifiedType, PtrSimplifiedType => PtrSimplifiedType, NeverSimplifiedType => NeverSimplifiedType, + MarkerTraitObjectSimplifiedType => MarkerTraitObjectSimplifiedType, TupleSimplifiedType(n) => TupleSimplifiedType(n), TraitSimplifiedType(d) => TraitSimplifiedType(map(d)), ClosureSimplifiedType(d) => ClosureSimplifiedType(map(d)), @@ -170,7 +169,8 @@ impl<'a, 'gcx, D> HashStable> for SimplifiedTypeGen ArraySimplifiedType | PtrSimplifiedType | NeverSimplifiedType | - ParameterSimplifiedType => { + ParameterSimplifiedType | + MarkerTraitObjectSimplifiedType => { // nothing to do } IntSimplifiedType(t) => t.hash_stable(hcx, hasher), diff --git a/src/librustc/ty/flags.rs b/src/librustc/ty/flags.rs index 0764f363250..4fa13a01d5a 100644 --- a/src/librustc/ty/flags.rs +++ b/src/librustc/ty/flags.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use mir::interpret::ConstValue; use ty::subst::Substs; use ty::{self, Ty, TypeFlags, TypeFoldable}; @@ -115,8 +104,12 @@ impl FlagComputation { self.add_substs(&substs.substs); } - &ty::Bound(bound_ty) => { - self.add_binder(bound_ty.index); + &ty::Bound(debruijn, _) => { + self.add_binder(debruijn); + } + + &ty::Placeholder(..) => { + self.add_flags(TypeFlags::HAS_TY_PLACEHOLDER); } &ty::Infer(infer) => { @@ -179,7 +172,10 @@ impl FlagComputation { &ty::Array(tt, len) => { self.add_ty(tt); - self.add_const(len); + if let ty::LazyConst::Unevaluated(_, substs) = len { + self.add_flags(TypeFlags::HAS_PROJECTION); + self.add_substs(substs); + } } &ty::Slice(tt) => { @@ -236,14 +232,6 @@ impl FlagComputation { } } - fn add_const(&mut self, constant: &ty::Const<'_>) { - self.add_ty(constant.ty); - if let ConstValue::Unevaluated(_, substs) = constant.val { - self.add_flags(TypeFlags::HAS_PROJECTION); - self.add_substs(substs); - } - } - fn add_existential_projection(&mut self, projection: &ty::ExistentialProjection<'_>) { self.add_substs(projection.substs); self.add_ty(projection.ty); diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index 2c781483145..28b6f010ce0 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Generalized type folding mechanism. The setup is a bit convoluted //! but allows for convenient usage. Let T be an instance of some //! "foldable type" (one which implements `TypeFoldable`) and F be an @@ -39,7 +29,6 @@ //! These methods return true to indicate that the visitor has found what it is looking for //! and does not need to visit anything else. -use mir::interpret::ConstValue; use hir::def_id::DefId; use ty::{self, Binder, Ty, TyCtxt, TypeFlags}; @@ -102,14 +91,14 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone { fn needs_infer(&self) -> bool { self.has_type_flags(TypeFlags::HAS_TY_INFER | TypeFlags::HAS_RE_INFER) } - fn has_skol(&self) -> bool { - self.has_type_flags(TypeFlags::HAS_RE_SKOL) + fn has_placeholders(&self) -> bool { + self.has_type_flags(TypeFlags::HAS_RE_PLACEHOLDER | TypeFlags::HAS_TY_PLACEHOLDER) } fn needs_subst(&self) -> bool { self.has_type_flags(TypeFlags::NEEDS_SUBST) } - fn has_re_skol(&self) -> bool { - self.has_type_flags(TypeFlags::HAS_RE_SKOL) + fn has_re_placeholders(&self) -> bool { + self.has_type_flags(TypeFlags::HAS_RE_PLACEHOLDER) } fn has_closure_types(&self) -> bool { self.has_type_flags(TypeFlags::HAS_TY_CLOSURE) @@ -120,7 +109,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone { self.has_type_flags(TypeFlags::HAS_FREE_REGIONS) } - /// True if there any any un-erased free regions. + /// True if there are any un-erased free regions. fn has_erasable_regions(&self) -> bool { self.has_type_flags(TypeFlags::HAS_FREE_REGIONS) } @@ -174,7 +163,7 @@ pub trait TypeFolder<'gcx: 'tcx, 'tcx> : Sized { r.super_fold_with(self) } - fn fold_const(&mut self, c: &'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx> { + fn fold_const(&mut self, c: &'tcx ty::LazyConst<'tcx>) -> &'tcx ty::LazyConst<'tcx> { c.super_fold_with(self) } } @@ -192,7 +181,7 @@ pub trait TypeVisitor<'tcx> : Sized { r.super_visit_with(self) } - fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> bool { + fn visit_const(&mut self, c: &'tcx ty::LazyConst<'tcx>) -> bool { c.super_visit_with(self) } } @@ -374,6 +363,7 @@ pub struct RegionFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> RegionFolder<'a, 'gcx, 'tcx> { + #[inline] pub fn new( tcx: TyCtxt<'a, 'gcx, 'tcx>, skipped_regions: &'a mut bool, @@ -460,8 +450,8 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for BoundVarReplacer<'a, 'gcx, 'tcx> fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> { match t.sty { - ty::Bound(bound_ty) => { - if bound_ty.index == self.current_index { + ty::Bound(debruijn, bound_ty) => { + if debruijn == self.current_index { let fld_t = &mut self.fld_t; let ty = fld_t(bound_ty); ty::fold::shift_vars( @@ -526,7 +516,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { T: TypeFoldable<'tcx> { // identity for bound types - let fld_t = |bound_ty| self.mk_ty(ty::Bound(bound_ty)); + let fld_t = |bound_ty| self.mk_ty(ty::Bound(ty::INNERMOST, bound_ty)); self.replace_escaping_bound_vars(value.skip_binder(), fld_r, fld_t) } @@ -542,18 +532,25 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { G: FnMut(ty::BoundTy) -> ty::Ty<'tcx>, T: TypeFoldable<'tcx> { - let mut map = BTreeMap::new(); + use rustc_data_structures::fx::FxHashMap; + + let mut region_map = BTreeMap::new(); + let mut type_map = FxHashMap::default(); if !value.has_escaping_bound_vars() { - (value.clone(), map) + (value.clone(), region_map) } else { let mut real_fld_r = |br| { - *map.entry(br).or_insert_with(|| fld_r(br)) + *region_map.entry(br).or_insert_with(|| fld_r(br)) + }; + + let mut real_fld_t = |bound_ty| { + *type_map.entry(bound_ty).or_insert_with(|| fld_t(bound_ty)) }; - let mut replacer = BoundVarReplacer::new(self, &mut real_fld_r, &mut fld_t); + let mut replacer = BoundVarReplacer::new(self, &mut real_fld_r, &mut real_fld_t); let result = value.fold_with(&mut replacer); - (result, map) + (result, region_map) } } @@ -679,24 +676,31 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // vars. See comment on `shift_vars_through_binders` method in // `subst.rs` for more details. +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] +enum Direction { + In, + Out, +} + struct Shifter<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'tcx>, - current_index: ty::DebruijnIndex, amount: u32, + direction: Direction, } impl Shifter<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, amount: u32) -> Self { + pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, amount: u32, direction: Direction) -> Self { Shifter { tcx, current_index: ty::INNERMOST, amount, + direction, } } } -impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Shifter<'a, 'gcx, 'tcx> { +impl TypeFolder<'gcx, 'tcx> for Shifter<'a, 'gcx, 'tcx> { fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { @@ -712,7 +716,14 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Shifter<'a, 'gcx, 'tcx> { if self.amount == 0 || debruijn < self.current_index { r } else { - let shifted = ty::ReLateBound(debruijn.shifted_in(self.amount), br); + let debruijn = match self.direction { + Direction::In => debruijn.shifted_in(self.amount), + Direction::Out => { + assert!(debruijn.as_u32() >= self.amount); + debruijn.shifted_out(self.amount) + } + }; + let shifted = ty::ReLateBound(debruijn, br); self.tcx.mk_region(shifted) } } @@ -722,16 +733,20 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Shifter<'a, 'gcx, 'tcx> { fn fold_ty(&mut self, ty: ty::Ty<'tcx>) -> ty::Ty<'tcx> { match ty.sty { - ty::Bound(bound_ty) => { - if self.amount == 0 || bound_ty.index < self.current_index { + ty::Bound(debruijn, bound_ty) => { + if self.amount == 0 || debruijn < self.current_index { ty } else { - let shifted = ty::BoundTy { - index: bound_ty.index.shifted_in(self.amount), - var: bound_ty.var, - kind: bound_ty.kind, + let debruijn = match self.direction { + Direction::In => debruijn.shifted_in(self.amount), + Direction::Out => { + assert!(debruijn.as_u32() >= self.amount); + debruijn.shifted_out(self.amount) + } }; - self.tcx.mk_ty(ty::Bound(shifted)) + self.tcx.mk_ty( + ty::Bound(debruijn, bound_ty) + ) } } @@ -763,7 +778,18 @@ pub fn shift_vars<'a, 'gcx, 'tcx, T>( debug!("shift_vars(value={:?}, amount={})", value, amount); - value.fold_with(&mut Shifter::new(tcx, amount)) + value.fold_with(&mut Shifter::new(tcx, amount, Direction::In)) +} + +pub fn shift_out_vars<'a, 'gcx, 'tcx, T>( + tcx: TyCtxt<'a, 'gcx, 'tcx>, + value: &T, + amount: u32 +) -> T where T: TypeFoldable<'tcx> { + debug!("shift_out_vars(value={:?}, amount={})", + value, amount); + + value.fold_with(&mut Shifter::new(tcx, amount, Direction::Out)) } /// An "escaping var" is a bound var whose binder is not part of `t`. A bound var can be a @@ -837,8 +863,8 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor { flags.intersects(self.flags) } - fn visit_const(&mut self, c: &'tcx ty::Const<'tcx>) -> bool { - if let ConstValue::Unevaluated(..) = c.val { + fn visit_const(&mut self, c: &'tcx ty::LazyConst<'tcx>) -> bool { + if let ty::LazyConst::Unevaluated(..) = c { let projection_flags = TypeFlags::HAS_NORMALIZABLE_PROJECTION | TypeFlags::HAS_PROJECTION; if projection_flags.intersects(self.flags) { @@ -857,7 +883,7 @@ struct LateBoundRegionsCollector { /// If true, we only want regions that are known to be /// "constrained" when you equate this type with another type. In - /// particular, if you have e.g. `&'a u32` and `&'b u32`, equating + /// particular, if you have e.g., `&'a u32` and `&'b u32`, equating /// them constraints `'a == 'b`. But if you have `<&'a u32 as /// Trait>::Foo` and `<&'b u32 as Trait>::Foo`, normalizing those /// types may mean that `'a` and `'b` don't appear in the results, diff --git a/src/librustc/ty/inhabitedness/def_id_forest.rs b/src/librustc/ty/inhabitedness/def_id_forest.rs index 7bc77e1b1a1..41fd88607e8 100644 --- a/src/librustc/ty/inhabitedness/def_id_forest.rs +++ b/src/librustc/ty/inhabitedness/def_id_forest.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem; use smallvec::SmallVec; use syntax::ast::CRATE_NODE_ID; @@ -43,7 +33,7 @@ impl<'a, 'gcx, 'tcx> DefIdForest { /// crate. #[inline] pub fn full(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> DefIdForest { - let crate_id = tcx.hir.local_def_id(CRATE_NODE_ID); + let crate_id = tcx.hir().local_def_id(CRATE_NODE_ID); DefIdForest::from_id(crate_id) } @@ -74,10 +64,21 @@ impl<'a, 'gcx, 'tcx> DefIdForest { iter: I) -> DefIdForest where I: IntoIterator { - let mut ret = DefIdForest::full(tcx); + let mut iter = iter.into_iter(); + let mut ret = if let Some(first) = iter.next() { + first + } else { + return DefIdForest::full(tcx); + }; + let mut next_ret = SmallVec::new(); let mut old_ret: SmallVec<[DefId; 1]> = SmallVec::new(); for next_forest in iter { + // No need to continue if the intersection is already empty. + if ret.is_empty() { + break; + } + for id in ret.root_ids.drain() { if next_forest.contains(tcx, id) { next_ret.push(id); diff --git a/src/librustc/ty/inhabitedness/mod.rs b/src/librustc/ty/inhabitedness/mod.rs index 56fe479ffc5..6dfc9681cfd 100644 --- a/src/librustc/ty/inhabitedness/mod.rs +++ b/src/librustc/ty/inhabitedness/mod.rs @@ -1,17 +1,6 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use util::nodemap::{FxHashMap, FxHashSet}; use ty::context::TyCtxt; use ty::{AdtDef, VariantDef, FieldDef, Ty, TyS}; -use ty::{DefId, Substs}; +use ty::{self, DefId, Substs}; use ty::{AdtKind, Visibility}; use ty::TyKind::*; @@ -113,7 +102,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } fn ty_inhabitedness_forest(self, ty: Ty<'tcx>) -> DefIdForest { - ty.uninhabited_from(&mut FxHashMap::default(), self) + ty.uninhabited_from(self) } pub fn is_enum_variant_uninhabited_from(self, @@ -140,7 +129,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let adt_kind = self.adt_def(adt_def_id).adt_kind(); // Compute inhabitedness forest: - variant.uninhabited_from(&mut FxHashMap::default(), self, substs, adt_kind) + variant.uninhabited_from(self, substs, adt_kind) } } @@ -148,12 +137,11 @@ impl<'a, 'gcx, 'tcx> AdtDef { /// Calculate the forest of DefIds from which this adt is visibly uninhabited. fn uninhabited_from( &self, - visited: &mut FxHashMap>>, tcx: TyCtxt<'a, 'gcx, 'tcx>, substs: &'tcx Substs<'tcx>) -> DefIdForest { DefIdForest::intersection(tcx, self.variants.iter().map(|v| { - v.uninhabited_from(visited, tcx, substs, self.adt_kind()) + v.uninhabited_from(tcx, substs, self.adt_kind()) })) } } @@ -162,28 +150,20 @@ impl<'a, 'gcx, 'tcx> VariantDef { /// Calculate the forest of DefIds from which this variant is visibly uninhabited. fn uninhabited_from( &self, - visited: &mut FxHashMap>>, tcx: TyCtxt<'a, 'gcx, 'tcx>, substs: &'tcx Substs<'tcx>, adt_kind: AdtKind) -> DefIdForest { - match adt_kind { - AdtKind::Union => { - DefIdForest::intersection(tcx, self.fields.iter().map(|f| { - f.uninhabited_from(visited, tcx, substs, false) - })) - }, - AdtKind::Struct => { - DefIdForest::union(tcx, self.fields.iter().map(|f| { - f.uninhabited_from(visited, tcx, substs, false) - })) - }, - AdtKind::Enum => { - DefIdForest::union(tcx, self.fields.iter().map(|f| { - f.uninhabited_from(visited, tcx, substs, true) - })) - }, - } + let is_enum = match adt_kind { + // For now, `union`s are never considered uninhabited. + // The precise semantics of inhabitedness with respect to unions is currently undecided. + AdtKind::Union => return DefIdForest::empty(), + AdtKind::Enum => true, + AdtKind::Struct => false, + }; + DefIdForest::union(tcx, self.fields.iter().map(|f| { + f.uninhabited_from(tcx, substs, is_enum) + })) } } @@ -191,13 +171,12 @@ impl<'a, 'gcx, 'tcx> FieldDef { /// Calculate the forest of DefIds from which this field is visibly uninhabited. fn uninhabited_from( &self, - visited: &mut FxHashMap>>, tcx: TyCtxt<'a, 'gcx, 'tcx>, substs: &'tcx Substs<'tcx>, - is_enum: bool) -> DefIdForest - { - let mut data_uninhabitedness = move || { - self.ty(tcx, substs).uninhabited_from(visited, tcx) + is_enum: bool, + ) -> DefIdForest { + let data_uninhabitedness = move || { + self.ty(tcx, substs).uninhabited_from(tcx) }; // FIXME(canndrew): Currently enum fields are (incorrectly) stored with // Visibility::Invisible so we need to override self.vis if we're @@ -220,58 +199,37 @@ impl<'a, 'gcx, 'tcx> FieldDef { impl<'a, 'gcx, 'tcx> TyS<'tcx> { /// Calculate the forest of DefIds from which this type is visibly uninhabited. - fn uninhabited_from( - &self, - visited: &mut FxHashMap>>, - tcx: TyCtxt<'a, 'gcx, 'tcx>) -> DefIdForest + fn uninhabited_from(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> DefIdForest { match self.sty { - Adt(def, substs) => { - { - let substs_set = visited.entry(def.did).or_default(); - if !substs_set.insert(substs) { - // We are already calculating the inhabitedness of this type. - // The type must contain a reference to itself. Break the - // infinite loop. - return DefIdForest::empty(); - } - if substs_set.len() >= tcx.sess.recursion_limit.get() / 4 { - // We have gone very deep, reinstantiating this ADT inside - // itself with different type arguments. We are probably - // hitting an infinite loop. For example, it's possible to write: - // a type Foo - // which contains a Foo<(T, T)> - // which contains a Foo<((T, T), (T, T))> - // which contains a Foo<(((T, T), (T, T)), ((T, T), (T, T)))> - // etc. - let error = format!("reached recursion limit while checking \ - inhabitedness of `{}`", self); - tcx.sess.fatal(&error); - } - } - let ret = def.uninhabited_from(visited, tcx, substs); - let substs_set = visited.get_mut(&def.did).unwrap(); - substs_set.remove(substs); - ret - }, + Adt(def, substs) => def.uninhabited_from(tcx, substs), Never => DefIdForest::full(tcx), + Tuple(ref tys) => { DefIdForest::union(tcx, tys.iter().map(|ty| { - ty.uninhabited_from(visited, tcx) + ty.uninhabited_from(tcx) })) - }, + } + Array(ty, len) => { - match len.assert_usize(tcx) { - // If the array is definitely non-empty, it's uninhabited if - // the type of its elements is uninhabited. - Some(n) if n != 0 => ty.uninhabited_from(visited, tcx), - _ => DefIdForest::empty() + match len { + ty::LazyConst::Unevaluated(..) => DefIdForest::empty(), + ty::LazyConst::Evaluated(len) => match len.assert_usize(tcx) { + // If the array is definitely non-empty, it's uninhabited if + // the type of its elements is uninhabited. + Some(n) if n != 0 => ty.uninhabited_from(tcx), + _ => DefIdForest::empty() + }, } } - Ref(_, ty, _) => { - ty.uninhabited_from(visited, tcx) - } + + // References to uninitialised memory is valid for any type, including + // uninhabited types, in unsafe code, so we treat all references as + // inhabited. + // The precise semantics of inhabitedness with respect to references is currently + // undecided. + Ref(..) => DefIdForest::empty(), _ => DefIdForest::empty(), } diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index b6691df39c1..bc43fedef0f 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::Unsafety; use hir::def_id::DefId; use ty::{self, Ty, PolyFnSig, TypeFoldable, Substs, TyCtxt}; @@ -86,6 +76,11 @@ impl<'a, 'tcx> Instance<'tcx> { let env_region = ty::ReLateBound(ty::INNERMOST, ty::BrEnv); let env_ty = tcx.mk_mut_ref(tcx.mk_region(env_region), ty); + let pin_did = tcx.lang_items().pin_type().unwrap(); + let pin_adt_ref = tcx.adt_def(pin_did); + let pin_substs = tcx.intern_substs(&[env_ty.into()]); + let env_ty = tcx.mk_adt(pin_adt_ref, pin_substs); + sig.map_bound(|sig| { let state_did = tcx.lang_items().gen_state().unwrap(); let state_adt_ref = tcx.adt_def(state_did); @@ -173,10 +168,7 @@ impl<'tcx> InstanceDef<'tcx> { // available to normal end-users. return true } - let codegen_fn_attrs = tcx.codegen_fn_attrs(self.def_id()); - // need to use `is_const_fn_raw` since we don't really care if the user can use it as a - // const fn, just whether the function should be inlined - codegen_fn_attrs.requests_inline() || tcx.is_const_fn_raw(self.def_id()) + tcx.codegen_fn_attrs(self.def_id()).requests_inline() } } @@ -350,9 +342,10 @@ fn resolve_associated_item<'a, 'tcx>( ) -> Option> { let def_id = trait_item.def_id; debug!("resolve_associated_item(trait_item={:?}, \ + param_env={:?}, \ trait_id={:?}, \ rcvr_substs={:?})", - def_id, trait_id, rcvr_substs); + def_id, param_env, trait_id, rcvr_substs); let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_substs); let vtbl = tcx.codegen_fulfill_obligation((param_env, ty::Binder::bind(trait_ref))); @@ -362,7 +355,7 @@ fn resolve_associated_item<'a, 'tcx>( match vtbl { traits::VtableImpl(impl_data) => { let (def_id, substs) = traits::find_associated_item( - tcx, trait_item, rcvr_substs, &impl_data); + tcx, param_env, trait_item, rcvr_substs, &impl_data); let substs = tcx.erase_regions(&substs); Some(ty::Instance::new(def_id, substs)) } diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs index d44ba030841..0ddc5ae8720 100644 --- a/src/librustc/ty/item_path.rs +++ b/src/librustc/ty/item_path.rs @@ -1,20 +1,9 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::map::DefPathData; use hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use ty::{self, DefIdTree, Ty, TyCtxt}; use middle::cstore::{ExternCrate, ExternCrateSource}; use syntax::ast; use syntax::symbol::{keywords, LocalInternedString, Symbol}; -use syntax_pos::edition::Edition; use std::cell::Cell; use std::fmt::Debug; @@ -84,7 +73,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// Returns a string identifying this local node-id. pub fn node_path_str(self, id: ast::NodeId) -> String { - self.item_path_str(self.hir.local_def_id(id)) + self.item_path_str(self.hir().local_def_id(id)) } /// Returns a string identifying this def-id. This string is @@ -140,7 +129,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { debug!("push_krate_path: name={:?}", name); buffer.push(&name); } - } else if self.sess.edition() == Edition::Edition2018 && !pushed_prelude_crate { + } else if self.sess.rust_2018() && !pushed_prelude_crate { SHOULD_PREFIX_WITH_CRATE.with(|flag| { // We only add the `crate::` keyword where appropriate. In particular, // when we've not previously pushed a prelude crate to this path. @@ -221,12 +210,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let visible_parent = visible_parent_map.get(&cur_def).cloned(); let actual_parent = self.parent(cur_def); - debug!( - "try_push_visible_item_path: visible_parent={:?} actual_parent={:?}", - visible_parent, actual_parent, - ); let data = cur_def_key.disambiguated_data.data; + debug!( + "try_push_visible_item_path: data={:?} visible_parent={:?} actual_parent={:?}", + data, visible_parent, actual_parent, + ); let symbol = match data { // In order to output a path that could actually be imported (valid and visible), // we need to handle re-exports correctly. @@ -259,16 +248,16 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // the children of the visible parent (as was done when computing // `visible_parent_map`), looking for the specific child we currently have and then // have access to the re-exported name. - DefPathData::Module(module_name) if visible_parent != actual_parent => { - let mut name: Option = None; - if let Some(visible_parent) = visible_parent { - for child in self.item_children(visible_parent).iter() { - if child.def.def_id() == cur_def { - name = Some(child.ident); - } - } - } - name.map(|n| n.as_str()).unwrap_or(module_name.as_str()) + DefPathData::Module(actual_name) | + DefPathData::TypeNs(actual_name) if visible_parent != actual_parent => { + visible_parent + .and_then(|parent| { + self.item_children(parent) + .iter() + .find(|child| child.def.def_id() == cur_def) + .map(|child| child.ident.as_str()) + }) + .unwrap_or_else(|| actual_name.as_str()) }, _ => { data.get_opt_name().map(|n| n.as_str()).unwrap_or_else(|| { @@ -318,10 +307,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // Unclear if there is any value in distinguishing these. // Probably eventually (and maybe we would even want - // finer-grained distinctions, e.g. between enum/struct). + // finer-grained distinctions, e.g., between enum/struct). data @ DefPathData::Misc | data @ DefPathData::TypeNs(..) | data @ DefPathData::Trait(..) | + data @ DefPathData::TraitAlias(..) | data @ DefPathData::AssocTypeInTrait(..) | data @ DefPathData::AssocTypeInImpl(..) | data @ DefPathData::AssocExistentialInImpl(..) | @@ -465,8 +455,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // only occur very early in the compiler pipeline. let parent_def_id = self.parent_def_id(impl_def_id).unwrap(); self.push_item_path(buffer, parent_def_id, pushed_prelude_crate); - let node_id = self.hir.as_local_node_id(impl_def_id).unwrap(); - let item = self.hir.expect_item(node_id); + let node_id = self.hir().as_local_node_id(impl_def_id).unwrap(); + let item = self.hir().expect_item(node_id); let span_str = self.sess.source_map().span_to_string(item.span); buffer.push(&format!("", span_str)); } @@ -490,7 +480,7 @@ pub fn characteristic_def_id_of_type(ty: Ty<'_>) -> Option { match ty.sty { ty::Adt(adt_def, _) => Some(adt_def.did), - ty::Dynamic(data, ..) => Some(data.principal().def_id()), + ty::Dynamic(data, ..) => data.principal_def_id(), ty::Array(subty, _) | ty::Slice(subty) => characteristic_def_id_of_type(subty), @@ -515,6 +505,7 @@ pub fn characteristic_def_id_of_type(ty: Ty<'_>) -> Option { ty::Str | ty::FnPtr(_) | ty::Projection(_) | + ty::Placeholder(..) | ty::UnnormalizedProjection(..) | ty::Param(_) | ty::Opaque(..) | diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index d7fb8da7acd..1162bff852c 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -1,17 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use session::{self, DataTypeKind}; use ty::{self, Ty, TyCtxt, TypeFoldable, ReprOptions}; -use syntax::ast::{self, IntTy, UintTy}; +use syntax::ast::{self, Ident, IntTy, UintTy}; use syntax::attr; use syntax_pos::DUMMY_SP; @@ -191,7 +181,14 @@ fn layout_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty::tls::enter_context(&icx, |_| { let cx = LayoutCx { tcx, param_env }; - cx.layout_raw_uncached(ty) + let layout = cx.layout_raw_uncached(ty); + // Type-level uninhabitedness should always imply ABI uninhabitedness. + if let Ok(layout) = layout { + if ty.conservative_is_privately_uninhabited(tcx) { + assert!(layout.abi.is_uninhabited()); + } + } + layout }) }) } @@ -205,12 +202,11 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { pub struct LayoutCx<'tcx, C> { pub tcx: C, - pub param_env: ty::ParamEnv<'tcx> + pub param_env: ty::ParamEnv<'tcx>, } impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { - fn layout_raw_uncached(&self, ty: Ty<'tcx>) - -> Result<&'tcx LayoutDetails, LayoutError<'tcx>> { + fn layout_raw_uncached(&self, ty: Ty<'tcx>) -> Result<&'tcx LayoutDetails, LayoutError<'tcx>> { let tcx = self.tcx; let param_env = self.param_env; let dl = self.data_layout(); @@ -226,9 +222,10 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { tcx.intern_layout(LayoutDetails::scalar(self, scalar_unit(value))) }; let scalar_pair = |a: Scalar, b: Scalar| { - let align = a.value.align(dl).max(b.value.align(dl)).max(dl.aggregate_align); - let b_offset = a.value.size(dl).abi_align(b.value.align(dl)); - let size = (b_offset + b.value.size(dl)).abi_align(align); + let b_align = b.value.align(dl); + let align = a.value.align(dl).max(b_align).max(dl.aggregate_align); + let b_offset = a.value.size(dl).align_to(b_align.abi); + let size = (b_offset + b.value.size(dl)).align_to(align.abi); LayoutDetails { variants: Variants::Single { index: VariantIdx::new(0) }, fields: FieldPlacement::Arbitrary { @@ -247,7 +244,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { AlwaysSized, /// A univariant, the last field of which may be coerced to unsized. MaybeUnsized, - /// A univariant, but with a prefix of an arbitrary size & alignment (e.g. enum tag). + /// A univariant, but with a prefix of an arbitrary size & alignment (e.g., enum tag). Prefixed(Size, Align), } @@ -257,10 +254,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { bug!("struct cannot be packed and aligned"); } - let pack = { - let pack = repr.pack as u64; - Align::from_bytes(pack, pack).unwrap() - }; + let pack = Align::from_bytes(repr.pack as u64).unwrap(); let mut align = if packed { dl.i8_align @@ -274,7 +268,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { let mut optimize = !repr.inhibit_struct_field_reordering_opt(); if let StructKind::Prefixed(_, align) = kind { - optimize &= align.abi() == 1; + optimize &= align.bytes() == 1; } if optimize { @@ -285,7 +279,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { }; let optimizing = &mut inverse_memory_index[..end]; let field_align = |f: &TyLayout<'_>| { - if packed { f.align.min(pack).abi() } else { f.align.abi() } + if packed { f.align.abi.min(pack) } else { f.align.abi } }; match kind { StructKind::AlwaysSized | @@ -312,13 +306,13 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { let mut offset = Size::ZERO; if let StructKind::Prefixed(prefix_size, prefix_align) = kind { - if packed { - let prefix_align = prefix_align.min(pack); - align = align.max(prefix_align); + let prefix_align = if packed { + prefix_align.min(pack) } else { - align = align.max(prefix_align); - } - offset = prefix_size.abi_align(prefix_align); + prefix_align + }; + align = align.max(AbiAndPrefAlign::new(prefix_align)); + offset = prefix_size.align_to(prefix_align); } for &i in &inverse_memory_index { @@ -333,15 +327,13 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { } // Invariant: offset < dl.obj_size_bound() <= 1<<61 - if packed { - let field_pack = field.align.min(pack); - offset = offset.abi_align(field_pack); - align = align.max(field_pack); - } - else { - offset = offset.abi_align(field.align); - align = align.max(field.align); - } + let field_align = if packed { + field.align.min(AbiAndPrefAlign::new(pack)) + } else { + field.align + }; + offset = offset.align_to(field_align.abi); + align = align.max(field_align); debug!("univariant offset: {:?} field: {:#?}", offset, field); offsets[i as usize] = offset; @@ -352,7 +344,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { if repr.align > 0 { let repr_align = repr.align as u64; - align = align.max(Align::from_bytes(repr_align, repr_align).unwrap()); + align = align.max(AbiAndPrefAlign::new(Align::from_bytes(repr_align).unwrap())); debug!("univariant repr_align: {:?}", repr_align); } @@ -377,7 +369,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { memory_index = inverse_memory_index; } - let size = min_size.abi_align(align); + let size = min_size.align_to(align.abi); let mut abi = Abi::Aggregate { sized }; // Unpack newtype ABIs and find scalar pairs. @@ -394,7 +386,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { (Some((i, field)), None, None) => { // Field fills the struct and it has a scalar or scalar pair ABI. if offsets[i].bytes() == 0 && - align.abi() == field.align.abi() && + align.abi == field.align.abi && size == field.size { match field.abi { // For plain scalars, or vectors of them, we can't unpack @@ -555,13 +547,19 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { let size = element.size.checked_mul(count, dl) .ok_or(LayoutError::SizeOverflow(ty))?; + let abi = if count != 0 && ty.conservative_is_privately_uninhabited(tcx) { + Abi::Uninhabited + } else { + Abi::Aggregate { sized: true } + }; + tcx.intern_layout(LayoutDetails { variants: Variants::Single { index: VariantIdx::new(0) }, fields: FieldPlacement::Array { stride: element.size, count }, - abi: Abi::Aggregate { sized: true }, + abi, align: element.align, size }) @@ -648,7 +646,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { let size = element.size.checked_mul(count, dl) .ok_or(LayoutError::SizeOverflow(ty))?; let align = dl.vector_align(size); - let size = size.abi_align(align); + let size = size.align_to(align.abi); tcx.intern_layout(LayoutDetails { variants: Variants::Single { index: VariantIdx::new(0) }, @@ -680,10 +678,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { bug!("Union cannot be packed and aligned"); } - let pack = { - let pack = def.repr.pack as u64; - Align::from_bytes(pack, pack).unwrap() - }; + let pack = Align::from_bytes(def.repr.pack as u64).unwrap(); let mut align = if packed { dl.i8_align @@ -694,7 +689,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { if def.repr.align > 0 { let repr_align = def.repr.align as u64; align = align.max( - Align::from_bytes(repr_align, repr_align).unwrap()); + AbiAndPrefAlign::new(Align::from_bytes(repr_align).unwrap())); } let optimize = !def.repr.inhibit_union_abi_opt(); @@ -704,12 +699,12 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { for field in &variants[index] { assert!(!field.is_unsized()); - if packed { - let field_pack = field.align.min(pack); - align = align.max(field_pack); + let field_align = if packed { + field.align.min(AbiAndPrefAlign::new(pack)) } else { - align = align.max(field.align); - } + field.align + }; + align = align.max(field_align); // If all non-ZST fields have the same ABI, forward this ABI if optimize && !field.is_zst() { @@ -749,13 +744,13 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { fields: FieldPlacement::Union(variants[index].len()), abi, align, - size: size.abi_align(align) + size: size.align_to(align.abi) })); } // A variant is absent if it's uninhabited and only has ZST fields. // Present uninhabited variants only require space for their fields, - // but *not* an encoding of the discriminant (e.g. a tag value). + // but *not* an encoding of the discriminant (e.g., a tag value). // See issue #49298 for more details on the need to leave space // for non-ZST uninhabited data (mostly partial initialization). let absent = |fields: &[TyLayout<'_>]| { @@ -964,19 +959,19 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { let mut size = Size::ZERO; // We're interested in the smallest alignment, so start large. - let mut start_align = Align::from_bytes(256, 256).unwrap(); - assert_eq!(Integer::for_abi_align(dl, start_align), None); + let mut start_align = Align::from_bytes(256).unwrap(); + assert_eq!(Integer::for_align(dl, start_align), None); // repr(C) on an enum tells us to make a (tag, union) layout, // so we need to grow the prefix alignment to be at least // the alignment of the union. (This value is used both for // determining the alignment of the overall enum, and the // determining the alignment of the payload after the tag.) - let mut prefix_align = min_ity.align(dl); + let mut prefix_align = min_ity.align(dl).abi; if def.repr.c() { for fields in &variants { for field in fields { - prefix_align = prefix_align.max(field.align); + prefix_align = prefix_align.max(field.align.abi); } } } @@ -989,8 +984,8 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { // Find the first field we can't move later // to make room for a larger discriminant. for field in st.fields.index_by_increasing_offset().map(|j| field_layouts[j]) { - if !field.is_zst() || field.align.abi() != 1 { - start_align = start_align.min(field.align); + if !field.is_zst() || field.align.abi.bytes() != 1 { + start_align = start_align.min(field.align.abi); break; } } @@ -1000,7 +995,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { }).collect::, _>>()?; // Align the maximum variant size to the largest alignment. - size = size.abi_align(align); + size = size.align_to(align.abi); if size.bytes() >= dl.obj_size_bound() { return Err(LayoutError::SizeOverflow(ty)); @@ -1036,7 +1031,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { let mut ity = if def.repr.c() || def.repr.int.is_some() { min_ity } else { - Integer::for_abi_align(dl, start_align).unwrap_or(min_ity) + Integer::for_align(dl, start_align).unwrap_or(min_ity) }; // If the alignment is not larger than the chosen discriminant size, @@ -1166,6 +1161,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { } ty::Bound(..) | + ty::Placeholder(..) | ty::UnnormalizedProjection(..) | ty::GeneratorWitness(..) | ty::Infer(_) => { @@ -1204,7 +1200,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { let type_desc = format!("{:?}", layout.ty); self.tcx.sess.code_stats.borrow_mut().record_type_size(kind, type_desc, - layout.align, + layout.align.abi, layout.size, packed, opt_discr_size, @@ -1232,7 +1228,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { let adt_kind = adt_def.adt_kind(); let adt_packed = adt_def.repr.packed(); - let build_variant_info = |n: Option, + let build_variant_info = |n: Option, flds: &[ast::Name], layout: TyLayout<'tcx>| { let mut min_size = Size::ZERO; @@ -1251,20 +1247,20 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { name: name.to_string(), offset: offset.bytes(), size: field_layout.size.bytes(), - align: field_layout.align.abi(), + align: field_layout.align.abi.bytes(), } } } }).collect(); session::VariantInfo { - name: n.map(|n|n.to_string()), + name: n.map(|n| n.to_string()), kind: if layout.is_unsized() { session::SizeKind::Min } else { session::SizeKind::Exact }, - align: layout.align.abi(), + align: layout.align.abi.bytes(), size: if min_size.bytes() == 0 { layout.size.bytes() } else { @@ -1277,7 +1273,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { match layout.variants { Variants::Single { index } => { debug!("print-type-size `{:#?}` variant {}", - layout, adt_def.variants[index].name); + layout, adt_def.variants[index].ident); if !adt_def.variants.is_empty() { let variant_def = &adt_def.variants[index]; let fields: Vec<_> = @@ -1285,7 +1281,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { record(adt_kind.into(), adt_packed, None, - vec![build_variant_info(Some(variant_def.name), + vec![build_variant_info(Some(variant_def.ident), &fields, layout)]); } else { @@ -1303,7 +1299,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { adt_def.variants.iter_enumerated().map(|(i, variant_def)| { let fields: Vec<_> = variant_def.fields.iter().map(|f| f.ident.name).collect(); - build_variant_info(Some(variant_def.name), + build_variant_info(Some(variant_def.ident), &fields, layout.for_variant(self, i)) }) @@ -1317,7 +1313,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { } } -/// Type size "skeleton", i.e. the only information determining a type's size. +/// Type size "skeleton", i.e., the only information determining a type's size. /// While this is conservative, (aside from constant sizes, only pointers, /// newtypes thereof and null pointer optimized enums are allowed), it is /// enough to statically check common use cases of transmute. @@ -1528,7 +1524,7 @@ impl<'a, 'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { details }; - // NB: This recording is normally disabled; when enabled, it + // N.B., this recording is normally disabled; when enabled, it // can however trigger recursive invocations of `layout_of`. // Therefore, we execute it *after* the main query has // completed, to avoid problems around recursive structures @@ -1555,7 +1551,7 @@ impl<'a, 'tcx> LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'a, 'tcx, 'tcx>> details }; - // NB: This recording is normally disabled; when enabled, it + // N.B., this recording is normally disabled; when enabled, it // can however trigger recursive invocations of `layout_of`. // Therefore, we execute it *after* the main query has // completed, to avoid problems around recursive structures @@ -1666,7 +1662,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx> assert!(i < this.fields.count()); // Reuse the fat *T type as its own thin pointer data field. - // This provides information about e.g. DST struct pointees + // This provides information about e.g., DST struct pointees // (which may have no non-DST form), and will work as long // as the `Abi` or `FieldPlacement` is checked by users. if i == 0 { @@ -1750,7 +1746,8 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx> } ty::Projection(_) | ty::UnnormalizedProjection(..) | ty::Bound(..) | - ty::Opaque(..) | ty::Param(_) | ty::Infer(_) | ty::Error => { + ty::Placeholder(..) | ty::Opaque(..) | ty::Param(_) | ty::Infer(_) | + ty::Error => { bug!("TyLayout::field_type: unexpected type `{}`", this.ty) } }) @@ -1823,7 +1820,9 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { Abi::ScalarPair(ref a, ref b) => { // HACK(nox): We iter on `b` and then `a` because `max_by_key` // returns the last maximum. - let niche = iter::once((b, a.value.size(self).abi_align(b.value.align(self)))) + let niche = iter::once( + (b, a.value.size(self).align_to(b.value.align(self).abi)) + ) .chain(iter::once((a, Size::ZERO))) .filter_map(|(scalar, offset)| scalar_niche(scalar, offset)) .max_by_key(|niche| niche.available); @@ -1843,7 +1842,11 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> { return Ok(None); } } - if let FieldPlacement::Array { .. } = layout.fields { + if let FieldPlacement::Array { count: original_64_bit_count, .. } = layout.fields { + // rust-lang/rust#57038: avoid ICE within FieldPlacement::count when count too big + if original_64_bit_count > usize::max_value() as u64 { + return Err(LayoutError::SizeOverflow(layout.ty)); + } if layout.fields.count() > 0 { return self.find_niche(layout.field(self, 0)?); } else { @@ -1994,12 +1997,16 @@ impl_stable_hash_for!(enum ::ty::layout::Primitive { Pointer }); +impl_stable_hash_for!(struct ::ty::layout::AbiAndPrefAlign { + abi, + pref +}); + impl<'gcx> HashStable> for Align { fn hash_stable(&self, hcx: &mut StableHashingContext<'gcx>, hasher: &mut StableHasher) { - self.abi().hash_stable(hcx, hasher); - self.pref().hash_stable(hcx, hasher); + self.bytes().hash_stable(hcx, hasher); } } diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index ad200449f89..c9089428b23 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -1,20 +1,10 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use self::Variance::*; pub use self::AssociatedItemContainer::*; pub use self::BorrowKind::*; pub use self::IntVarValue::*; pub use self::fold::TypeFoldable; -use hir::{map as hir_map, FreevarMap, TraitMap}; +use hir::{map as hir_map, FreevarMap, GlobMap, TraitMap}; use hir::Node; use hir::def::{Def, CtorKind, ExportMap}; use hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE}; @@ -24,7 +14,6 @@ use ich::Fingerprint; use ich::StableHashingContext; use infer::canonical::Canonical; use middle::lang_items::{FnTraitLangItem, FnMutTraitLangItem, FnOnceTraitLangItem}; -use middle::privacy::AccessLevels; use middle::resolve_lifetime::ObjectLifetimeDefault; use mir::Mir; use mir::interpret::{GlobalId, ErrorHandled}; @@ -69,7 +58,7 @@ pub use self::sty::{InferTy, ParamTy, ProjectionTy, ExistentialPredicate}; pub use self::sty::{ClosureSubsts, GeneratorSubsts, UpvarSubsts, TypeAndMut}; pub use self::sty::{TraitRef, TyKind, PolyTraitRef}; pub use self::sty::{ExistentialTraitRef, PolyExistentialTraitRef}; -pub use self::sty::{ExistentialProjection, PolyExistentialProjection, Const}; +pub use self::sty::{ExistentialProjection, PolyExistentialProjection, Const, LazyConst}; pub use self::sty::{BoundRegion, EarlyBoundRegion, FreeRegion, Region}; pub use self::sty::RegionKind; pub use self::sty::{TyVid, IntVid, FloatVid, RegionVid}; @@ -82,7 +71,11 @@ pub use self::binding::BindingMode; pub use self::binding::BindingMode::*; pub use self::context::{TyCtxt, FreeRegionInfo, GlobalArenas, AllArenas, tls, keep_local}; -pub use self::context::{Lift, TypeckTables}; +pub use self::context::{Lift, TypeckTables, CtxtInterners}; +pub use self::context::{ + UserTypeAnnotationIndex, UserType, CanonicalUserType, + CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, +}; pub use self::instance::{Instance, InstanceDef}; @@ -122,18 +115,6 @@ mod sty; // Data types -/// The complete set of all analyses described in this module. This is -/// produced by the driver and fed to codegen and later passes. -/// -/// NB: These contents are being migrated into queries using the -/// *on-demand* infrastructure. -#[derive(Clone)] -pub struct CrateAnalysis { - pub access_levels: Lrc, - pub name: String, - pub glob_map: Option, -} - #[derive(Clone)] pub struct Resolutions { pub freevars: FreevarMap, @@ -141,6 +122,7 @@ pub struct Resolutions { pub maybe_unused_trait_imports: NodeSet, pub maybe_unused_extern_crates: Vec<(NodeId, Span)>, pub export_map: ExportMap, + pub glob_map: GlobMap, /// Extern prelude entries. The value is `true` if the entry was introduced /// via `extern crate` item and not `--extern` option or compiler built-in. pub extern_prelude: FxHashMap, @@ -289,7 +271,7 @@ impl Visibility { def => Visibility::Restricted(def.def_id()), }, hir::VisibilityKind::Inherited => { - Visibility::Restricted(tcx.hir.get_module_parent(id)) + Visibility::Restricted(tcx.hir().get_module_parent(id)) } } } @@ -432,7 +414,7 @@ bitflags! { const HAS_SELF = 1 << 1; const HAS_TY_INFER = 1 << 2; const HAS_RE_INFER = 1 << 3; - const HAS_RE_SKOL = 1 << 4; + const HAS_RE_PLACEHOLDER = 1 << 4; /// Does this have any `ReEarlyBound` regions? Used to /// determine whether substitition is required, since those @@ -467,6 +449,8 @@ bitflags! { /// if a global bound is safe to evaluate. const HAS_RE_LATE_BOUND = 1 << 13; + const HAS_TY_PLACEHOLDER = 1 << 14; + const NEEDS_SUBST = TypeFlags::HAS_PARAMS.bits | TypeFlags::HAS_SELF.bits | TypeFlags::HAS_RE_EARLY_BOUND.bits; @@ -478,7 +462,7 @@ bitflags! { TypeFlags::HAS_SELF.bits | TypeFlags::HAS_TY_INFER.bits | TypeFlags::HAS_RE_INFER.bits | - TypeFlags::HAS_RE_SKOL.bits | + TypeFlags::HAS_RE_PLACEHOLDER.bits | TypeFlags::HAS_RE_EARLY_BOUND.bits | TypeFlags::HAS_FREE_REGIONS.bits | TypeFlags::HAS_TY_ERR.bits | @@ -486,7 +470,8 @@ bitflags! { TypeFlags::HAS_TY_CLOSURE.bits | TypeFlags::HAS_FREE_LOCAL_NAMES.bits | TypeFlags::KEEP_IN_LOCAL_TCX.bits | - TypeFlags::HAS_RE_LATE_BOUND.bits; + TypeFlags::HAS_RE_LATE_BOUND.bits | + TypeFlags::HAS_TY_PLACEHOLDER.bits; } } @@ -502,15 +487,15 @@ pub struct TyS<'tcx> { /// by some sub-binder. /// /// So, for a type without any late-bound things, like `u32`, this - /// will be INNERMOST, because that is the innermost binder that + /// will be *innermost*, because that is the innermost binder that /// captures nothing. But for a type `&'D u32`, where `'D` is a - /// late-bound region with debruijn index D, this would be D+1 -- - /// the binder itself does not capture D, but D is captured by an - /// inner binder. + /// late-bound region with debruijn index `D`, this would be `D + 1` + /// -- the binder itself does not capture `D`, but `D` is captured + /// by an inner binder. /// - /// We call this concept an "exclusive" binder D (because all + /// We call this concept an "exclusive" binder `D` because all /// debruijn indices within the type are contained within `0..D` - /// (exclusive)). + /// (exclusive). outer_exclusive_binder: ty::DebruijnIndex, } @@ -814,6 +799,7 @@ pub struct UpvarBorrow<'tcx> { pub region: ty::Region<'tcx>, } +pub type UpvarListMap = FxHashMap>; pub type UpvarCaptureMap<'tcx> = FxHashMap>; #[derive(Copy, Clone)] @@ -897,10 +883,10 @@ pub struct GenericParamCount { } /// Information about the formal type/lifetime parameters associated -/// with an item or method. Analogous to hir::Generics. +/// with an item or method. Analogous to `hir::Generics`. /// -/// The ordering of parameters is the same as in Subst (excluding child generics): -/// Self (optionally), Lifetime params..., Type params... +/// The ordering of parameters is the same as in `Subst` (excluding child generics): +/// `Self` (optionally), `Lifetime` params..., `Type` params... #[derive(Clone, Debug, RustcEncodable, RustcDecodable)] pub struct Generics { pub parent: Option, @@ -1272,6 +1258,7 @@ impl<'tcx> PolyProjectionPredicate<'tcx> { self.skip_binder().projection_ty.item_def_id } + #[inline] pub fn to_poly_trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> PolyTraitRef<'tcx> { // Note: unlike with `TraitRef::to_poly_trait_ref()`, // `self.0.trait_ref` is permitted to have escaping regions. @@ -1587,12 +1574,27 @@ impl UniverseIndex { /// universe are just two regions with an unknown relationship to one /// another. #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, PartialOrd, Ord)] -pub struct Placeholder { +pub struct Placeholder { pub universe: UniverseIndex, - pub name: BoundRegion, + pub name: T, } -impl_stable_hash_for!(struct Placeholder { universe, name }); +impl<'a, 'gcx, T> HashStable> for Placeholder + where T: HashStable> +{ + fn hash_stable( + &self, + hcx: &mut StableHashingContext<'a>, + hasher: &mut StableHasher + ) { + self.universe.hash_stable(hcx, hasher); + self.name.hash_stable(hcx, hasher); + } +} + +pub type PlaceholderRegion = Placeholder; + +pub type PlaceholderType = Placeholder; /// When type checking, we use the `ParamEnv` to track /// details about the set of where-clauses that are in scope at this @@ -1608,6 +1610,11 @@ pub struct ParamEnv<'tcx> { /// want `Reveal::All` -- note that this is always paired with an /// empty environment. To get that, use `ParamEnv::reveal()`. pub reveal: traits::Reveal, + + /// If this `ParamEnv` comes from a call to `tcx.param_env(def_id)`, + /// register that `def_id` (useful for transitioning to the chalk trait + /// solver). + pub def_id: Option, } impl<'tcx> ParamEnv<'tcx> { @@ -1615,8 +1622,9 @@ impl<'tcx> ParamEnv<'tcx> { /// there are no where clauses in scope. Hidden types (like `impl /// Trait`) are left hidden, so this is suitable for ordinary /// type-checking. + #[inline] pub fn empty() -> Self { - Self::new(List::empty(), Reveal::UserFacing) + Self::new(List::empty(), Reveal::UserFacing, None) } /// Construct a trait environment with no where clauses in scope @@ -1626,15 +1634,19 @@ impl<'tcx> ParamEnv<'tcx> { /// /// N.B. If you want to have predicates in scope, use `ParamEnv::new`, /// or invoke `param_env.with_reveal_all()`. + #[inline] pub fn reveal_all() -> Self { - Self::new(List::empty(), Reveal::All) + Self::new(List::empty(), Reveal::All, None) } /// Construct a trait environment with the given set of predicates. - pub fn new(caller_bounds: &'tcx List>, - reveal: Reveal) - -> Self { - ty::ParamEnv { caller_bounds, reveal } + #[inline] + pub fn new( + caller_bounds: &'tcx List>, + reveal: Reveal, + def_id: Option + ) -> Self { + ty::ParamEnv { caller_bounds, reveal, def_id } } /// Returns a new parameter environment with the same clauses, but @@ -1659,7 +1671,7 @@ impl<'tcx> ParamEnv<'tcx> { /// pair it with the empty environment. This improves caching and is generally /// invisible. /// - /// NB: We preserve the environment when type-checking because it + /// N.B., we preserve the environment when type-checking because it /// is possible for the user to have wacky where-clauses like /// `where Box: Copy`, which are clearly never /// satisfiable. We generally want to behave as if they were true, @@ -1674,7 +1686,7 @@ impl<'tcx> ParamEnv<'tcx> { } Reveal::All => { - if value.has_skol() + if value.has_placeholders() || value.needs_infer() || value.has_param_types() || value.has_self_ty() @@ -1732,17 +1744,19 @@ bitflags! { pub struct AdtFlags: u32 { const NO_ADT_FLAGS = 0; const IS_ENUM = 1 << 0; - const IS_PHANTOM_DATA = 1 << 1; - const IS_FUNDAMENTAL = 1 << 2; - const IS_UNION = 1 << 3; - const IS_BOX = 1 << 4; + const IS_UNION = 1 << 1; + const IS_STRUCT = 1 << 2; + const HAS_CTOR = 1 << 3; + const IS_PHANTOM_DATA = 1 << 4; + const IS_FUNDAMENTAL = 1 << 5; + const IS_BOX = 1 << 6; /// Indicates whether the type is an `Arc`. - const IS_ARC = 1 << 5; + const IS_ARC = 1 << 7; /// Indicates whether the type is an `Rc`. - const IS_RC = 1 << 6; + const IS_RC = 1 << 8; /// Indicates whether the variant list of this ADT is `#[non_exhaustive]`. /// (i.e., this flag is never set unless this ADT is an enum). - const IS_VARIANT_LIST_NON_EXHAUSTIVE = 1 << 7; + const IS_VARIANT_LIST_NON_EXHAUSTIVE = 1 << 9; } } @@ -1756,10 +1770,10 @@ bitflags! { #[derive(Debug)] pub struct VariantDef { - /// The variant's DefId. If this is a tuple-like struct, - /// this is the DefId of the struct's ctor. + /// The variant's `DefId`. If this is a tuple-like struct, + /// this is the `DefId` of the struct's ctor. pub did: DefId, - pub name: Name, // struct's name if this is a struct + pub ident: Ident, // struct's name if this is a struct pub discr: VariantDiscr, pub fields: Vec, pub ctor_kind: CtorKind, @@ -1776,14 +1790,14 @@ impl<'a, 'gcx, 'tcx> VariantDef { /// /// Note that we *could* use the constructor DefId, because the constructor attributes /// redirect to the base attributes, but compiling a small crate requires - /// loading the AdtDefs for all the structs in the universe (e.g. coherence for any + /// loading the AdtDefs for all the structs in the universe (e.g., coherence for any /// built-in trait), and we do not want to load attributes twice. /// /// If someone speeds up attribute loading to not be a performance concern, they can /// remove this hack and use the constructor DefId everywhere. pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, did: DefId, - name: Name, + ident: Ident, discr: VariantDiscr, fields: Vec, adt_kind: AdtKind, @@ -1791,7 +1805,7 @@ impl<'a, 'gcx, 'tcx> VariantDef { attribute_def_id: DefId) -> Self { - debug!("VariantDef::new({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?})", did, name, discr, + debug!("VariantDef::new({:?}, {:?}, {:?}, {:?}, {:?}, {:?}, {:?})", did, ident, discr, fields, adt_kind, ctor_kind, attribute_def_id); let mut flags = VariantFlags::NO_VARIANT_FLAGS; if adt_kind == AdtKind::Struct && tcx.has_attr(attribute_def_id, "non_exhaustive") { @@ -1800,7 +1814,7 @@ impl<'a, 'gcx, 'tcx> VariantDef { } VariantDef { did, - name, + ident, discr, fields, ctor_kind, @@ -1816,7 +1830,7 @@ impl<'a, 'gcx, 'tcx> VariantDef { impl_stable_hash_for!(struct VariantDef { did, - name, + ident -> (ident.name), discr, fields, ctor_kind, @@ -1825,7 +1839,7 @@ impl_stable_hash_for!(struct VariantDef { #[derive(Copy, Clone, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)] pub enum VariantDiscr { - /// Explicit value for this variant, i.e. `X = 123`. + /// Explicit value for this variant, i.e., `X = 123`. /// The `DefId` corresponds to the embedded constant. Explicit(DefId), @@ -1843,9 +1857,9 @@ pub struct FieldDef { pub vis: Visibility, } -/// The definition of an abstract data type - a struct or enum. +/// The definition of an abstract data type -- a struct or enum. /// -/// These are all interned (by intern_adt_def) into the adt_defs +/// These are all interned (by `intern_adt_def`) into the `adt_defs` /// table. pub struct AdtDef { pub did: DefId, @@ -1957,8 +1971,6 @@ impl_stable_hash_for!(struct ReprFlags { bits }); - - /// Represents the repr options provided by the user, #[derive(Copy, Clone, Debug, Eq, PartialEq, RustcEncodable, RustcDecodable, Default)] pub struct ReprOptions { @@ -2037,9 +2049,10 @@ impl ReprOptions { } /// Returns `true` if this `#[repr()]` should inhibit struct field reordering - /// optimizations, such as with repr(C) or repr(packed(1)). + /// optimizations, such as with repr(C), repr(packed(1)), or repr(). pub fn inhibit_struct_field_reordering_opt(&self) -> bool { - !(self.flags & ReprFlags::IS_UNOPTIMISABLE).is_empty() || (self.pack == 1) + self.flags.intersects(ReprFlags::IS_UNOPTIMISABLE) || self.pack == 1 || + self.int.is_some() } /// Returns true if this `#[repr()]` should inhibit union abi optimisations @@ -2057,31 +2070,43 @@ impl<'a, 'gcx, 'tcx> AdtDef { repr: ReprOptions) -> Self { debug!("AdtDef::new({:?}, {:?}, {:?}, {:?})", did, kind, variants, repr); let mut flags = AdtFlags::NO_ADT_FLAGS; + + if kind == AdtKind::Enum && tcx.has_attr(did, "non_exhaustive") { + debug!("found non-exhaustive variant list for {:?}", did); + flags = flags | AdtFlags::IS_VARIANT_LIST_NON_EXHAUSTIVE; + } + flags |= match kind { + AdtKind::Enum => AdtFlags::IS_ENUM, + AdtKind::Union => AdtFlags::IS_UNION, + AdtKind::Struct => AdtFlags::IS_STRUCT, + }; + + if let AdtKind::Struct = kind { + let variant_def = &variants[VariantIdx::new(0)]; + let def_key = tcx.def_key(variant_def.did); + match def_key.disambiguated_data.data { + DefPathData::StructCtor => flags |= AdtFlags::HAS_CTOR, + _ => (), + } + } + let attrs = tcx.get_attrs(did); if attr::contains_name(&attrs, "fundamental") { - flags = flags | AdtFlags::IS_FUNDAMENTAL; + flags |= AdtFlags::IS_FUNDAMENTAL; } if Some(did) == tcx.lang_items().phantom_data() { - flags = flags | AdtFlags::IS_PHANTOM_DATA; + flags |= AdtFlags::IS_PHANTOM_DATA; } if Some(did) == tcx.lang_items().owned_box() { - flags = flags | AdtFlags::IS_BOX; + flags |= AdtFlags::IS_BOX; } if Some(did) == tcx.lang_items().arc() { - flags = flags | AdtFlags::IS_ARC; + flags |= AdtFlags::IS_ARC; } if Some(did) == tcx.lang_items().rc() { - flags = flags | AdtFlags::IS_RC; - } - if kind == AdtKind::Enum && tcx.has_attr(did, "non_exhaustive") { - debug!("found non-exhaustive variant list for {:?}", did); - flags = flags | AdtFlags::IS_VARIANT_LIST_NON_EXHAUSTIVE; - } - match kind { - AdtKind::Enum => flags = flags | AdtFlags::IS_ENUM, - AdtKind::Union => flags = flags | AdtFlags::IS_UNION, - AdtKind::Struct => {} + flags |= AdtFlags::IS_RC; } + AdtDef { did, variants, @@ -2092,25 +2117,25 @@ impl<'a, 'gcx, 'tcx> AdtDef { #[inline] pub fn is_struct(&self) -> bool { - !self.is_union() && !self.is_enum() + self.flags.contains(AdtFlags::IS_STRUCT) } #[inline] pub fn is_union(&self) -> bool { - self.flags.intersects(AdtFlags::IS_UNION) + self.flags.contains(AdtFlags::IS_UNION) } #[inline] pub fn is_enum(&self) -> bool { - self.flags.intersects(AdtFlags::IS_ENUM) + self.flags.contains(AdtFlags::IS_ENUM) } #[inline] pub fn is_variant_list_non_exhaustive(&self) -> bool { - self.flags.intersects(AdtFlags::IS_VARIANT_LIST_NON_EXHAUSTIVE) + self.flags.contains(AdtFlags::IS_VARIANT_LIST_NON_EXHAUSTIVE) } - /// Returns the kind of the ADT - Struct or Enum. + /// Returns the kind of the ADT. #[inline] pub fn adt_kind(&self) -> AdtKind { if self.is_enum() { @@ -2130,6 +2155,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { } } + #[inline] pub fn variant_descr(&self) -> &'static str { match self.adt_kind() { AdtKind::Struct => "struct", @@ -2138,33 +2164,39 @@ impl<'a, 'gcx, 'tcx> AdtDef { } } - /// Returns whether this type is #[fundamental] for the purposes + /// If this function returns `true`, it implies that `is_struct` must return `true`. + #[inline] + pub fn has_ctor(&self) -> bool { + self.flags.contains(AdtFlags::HAS_CTOR) + } + + /// Returns whether this type is `#[fundamental]` for the purposes /// of coherence checking. #[inline] pub fn is_fundamental(&self) -> bool { - self.flags.intersects(AdtFlags::IS_FUNDAMENTAL) + self.flags.contains(AdtFlags::IS_FUNDAMENTAL) } /// Returns `true` if this is PhantomData. #[inline] pub fn is_phantom_data(&self) -> bool { - self.flags.intersects(AdtFlags::IS_PHANTOM_DATA) + self.flags.contains(AdtFlags::IS_PHANTOM_DATA) } /// Returns `true` if this is `Arc`. pub fn is_arc(&self) -> bool { - self.flags.intersects(AdtFlags::IS_ARC) + self.flags.contains(AdtFlags::IS_ARC) } /// Returns `true` if this is `Rc`. pub fn is_rc(&self) -> bool { - self.flags.intersects(AdtFlags::IS_RC) + self.flags.contains(AdtFlags::IS_RC) } /// Returns `true` if this is Box. #[inline] pub fn is_box(&self) -> bool { - self.flags.intersects(AdtFlags::IS_BOX) + self.flags.contains(AdtFlags::IS_BOX) } /// Returns whether this type has a destructor. @@ -2344,7 +2376,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { /// Self would prevent its containing ADT from being Sized. /// /// Due to normalization being eager, this applies even if - /// the associated type is behind a pointer, e.g. issue #31299. + /// the associated type is behind a pointer, e.g., issue #31299. pub fn sized_constraint(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] { match tcx.try_adt_sized_constraint(DUMMY_SP, self.did) { Ok(tys) => tys, @@ -2430,6 +2462,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { } } + Placeholder(..) | Bound(..) | Infer(..) => { bug!("unexpected type `{:?}` in sized_constraint_for_ty", @@ -2593,31 +2626,70 @@ impl<'gcx> ::std::ops::Deref for Attributes<'gcx> { } } +#[derive(Debug, PartialEq, Eq)] +pub enum ImplOverlapKind { + /// These impls are always allowed to overlap. + Permitted, + /// These impls are allowed to overlap, but that raises + /// an issue #33140 future-compatibility warning. + /// + /// Some background: in Rust 1.0, the trait-object types `Send + Sync` (today's + /// `dyn Send + Sync`) and `Sync + Send` (now `dyn Sync + Send`) were different. + /// + /// The widely-used version 0.1.0 of the crate `traitobject` had accidentally relied + /// that difference, making what reduces to the following set of impls: + /// + /// ``` + /// trait Trait {} + /// impl Trait for dyn Send + Sync {} + /// impl Trait for dyn Sync + Send {} + /// ``` + /// + /// Obviously, once we made these types be identical, that code causes a coherence + /// error and a fairly big headache for us. However, luckily for us, the trait + /// `Trait` used in this case is basically a marker trait, and therefore having + /// overlapping impls for it is sound. + /// + /// To handle this, we basically regard the trait as a marker trait, with an additional + /// future-compatibility warning. To avoid accidentally "stabilizing" this feature, + /// it has the following restrictions: + /// + /// 1. The trait must indeed be a marker-like trait (i.e., no items), and must be + /// positive impls. + /// 2. The trait-ref of both impls must be equal. + /// 3. The trait-ref of both impls must be a trait object type consisting only of + /// marker traits. + /// 4. Neither of the impls can have any where-clauses. + /// + /// Once `traitobject` 0.1.0 is no longer an active concern, this hack can be removed. + Issue33140 +} + impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn body_tables(self, body: hir::BodyId) -> &'gcx TypeckTables<'gcx> { - self.typeck_tables_of(self.hir.body_owner_def_id(body)) + self.typeck_tables_of(self.hir().body_owner_def_id(body)) } /// Returns an iterator of the def-ids for all body-owners in this /// crate. If you would prefer to iterate over the bodies - /// themselves, you can do `self.hir.krate().body_ids.iter()`. + /// themselves, you can do `self.hir().krate().body_ids.iter()`. pub fn body_owners( self, ) -> impl Iterator + Captures<'tcx> + Captures<'gcx> + 'a { - self.hir.krate() - .body_ids - .iter() - .map(move |&body_id| self.hir.body_owner_def_id(body_id)) + self.hir().krate() + .body_ids + .iter() + .map(move |&body_id| self.hir().body_owner_def_id(body_id)) } pub fn par_body_owners(self, f: F) { - par_iter(&self.hir.krate().body_ids).for_each(|&body_id| { - f(self.hir.body_owner_def_id(body_id)) + par_iter(&self.hir().krate().body_ids).for_each(|&body_id| { + f(self.hir().body_owner_def_id(body_id)) }); } pub fn expr_span(self, id: NodeId) -> Span { - match self.hir.find(id) { + match self.hir().find(id) { Some(Node::Expr(e)) => { e.span } @@ -2643,8 +2715,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } pub fn opt_associated_item(self, def_id: DefId) -> Option { - let is_associated_item = if let Some(node_id) = self.hir.as_local_node_id(def_id) { - match self.hir.get(node_id) { + let is_associated_item = if let Some(node_id) = self.hir().as_local_node_id(def_id) { + match self.hir().get(node_id) { Node::TraitItem(_) | Node::ImplItem(_) => true, _ => false, } @@ -2667,7 +2739,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { parent_vis: &hir::Visibility, trait_item_ref: &hir::TraitItemRef) -> AssociatedItem { - let def_id = self.hir.local_def_id(trait_item_ref.id.node_id); + let def_id = self.hir().local_def_id(trait_item_ref.id.node_id); let (kind, has_self) = match trait_item_ref.kind { hir::AssociatedItemKind::Const => (ty::AssociatedKind::Const, false), hir::AssociatedItemKind::Method { has_self } => { @@ -2693,7 +2765,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { parent_def_id: DefId, impl_item_ref: &hir::ImplItemRef) -> AssociatedItem { - let def_id = self.hir.local_def_id(impl_item_ref.id.node_id); + let def_id = self.hir().local_def_id(impl_item_ref.id.node_id); let (kind, has_self) = match impl_item_ref.kind { hir::AssociatedItemKind::Const => (ty::AssociatedKind::Const, false), hir::AssociatedItemKind::Method { has_self } => { @@ -2716,7 +2788,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } pub fn field_index(self, node_id: NodeId, tables: &TypeckTables<'_>) -> usize { - let hir_id = self.hir.node_to_hir_id(node_id); + let hir_id = self.hir().node_to_hir_id(node_id); tables.field_indices().get(hir_id).cloned().expect("no index for a field") } @@ -2744,8 +2816,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// Returns `true` if the impls are the same polarity and the trait either /// has no items or is annotated #[marker] and prevents item overrides. - pub fn impls_are_allowed_to_overlap(self, def_id1: DefId, def_id2: DefId) -> bool { - if self.features().overlapping_marker_traits { + pub fn impls_are_allowed_to_overlap(self, def_id1: DefId, def_id2: DefId) + -> Option + { + let is_legit = if self.features().overlapping_marker_traits { let trait1_is_empty = self.impl_trait_ref(def_id1) .map_or(false, |trait_ref| { self.associated_item_def_ids(trait_ref.def_id).is_empty() @@ -2757,7 +2831,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.impl_polarity(def_id1) == self.impl_polarity(def_id2) && trait1_is_empty && trait2_is_empty - } else if self.features().marker_trait_attr { + } else { let is_marker_impl = |def_id: DefId| -> bool { let trait_ref = self.impl_trait_ref(def_id); trait_ref.map_or(false, |tr| self.trait_def(tr.def_id).is_marker) @@ -2765,8 +2839,29 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.impl_polarity(def_id1) == self.impl_polarity(def_id2) && is_marker_impl(def_id1) && is_marker_impl(def_id2) + }; + + if is_legit { + debug!("impls_are_allowed_to_overlap({:?}, {:?}) = Some(Permitted)", + def_id1, def_id2); + Some(ImplOverlapKind::Permitted) } else { - false + if let Some(self_ty1) = self.issue33140_self_ty(def_id1) { + if let Some(self_ty2) = self.issue33140_self_ty(def_id2) { + if self_ty1 == self_ty2 { + debug!("impls_are_allowed_to_overlap({:?}, {:?}) - issue #33140 HACK", + def_id1, def_id2); + return Some(ImplOverlapKind::Issue33140); + } else { + debug!("impls_are_allowed_to_overlap({:?}, {:?}) - found {:?} != {:?}", + def_id1, def_id2, self_ty1, self_ty2); + } + } + } + + debug!("impls_are_allowed_to_overlap({:?}, {:?}) = None", + def_id1, def_id2); + None } } @@ -2842,20 +2937,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - /// Given the DefId of an item, returns its MIR, borrowed immutably. - /// Returns None if there is no MIR for the DefId - pub fn maybe_optimized_mir(self, did: DefId) -> Option<&'gcx Mir<'gcx>> { - if self.is_mir_available(did) { - Some(self.optimized_mir(did)) - } else { - None - } - } - /// Get the attributes of a definition. pub fn get_attrs(self, did: DefId) -> Attributes<'gcx> { - if let Some(id) = self.hir.as_local_node_id(did) { - Attributes::Borrowed(self.hir.attrs(id)) + if let Some(id) = self.hir().as_local_node_id(did) { + Attributes::Borrowed(self.hir().attrs(id)) } else { Attributes::Owned(self.item_attrs(did)) } @@ -2906,8 +2991,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// with the name of the crate containing the impl. pub fn span_of_impl(self, impl_did: DefId) -> Result { if impl_did.is_local() { - let node_id = self.hir.as_local_node_id(impl_did).unwrap(); - Ok(self.hir.span(node_id)) + let node_id = self.hir().as_local_node_id(impl_did).unwrap(); + Ok(self.hir().span(node_id)) } else { Err(self.crate_name(impl_did.krate)) } @@ -2923,14 +3008,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn adjust_ident(self, mut ident: Ident, scope: DefId, block: NodeId) -> (Ident, DefId) { ident = ident.modern(); let target_expansion = match scope.krate { - LOCAL_CRATE => self.hir.definitions().expansion_that_defined(scope.index), + LOCAL_CRATE => self.hir().definitions().expansion_that_defined(scope.index), _ => Mark::root(), }; let scope = match ident.span.adjust(target_expansion) { Some(actual_expansion) => - self.hir.definitions().parent_module_of_macro_def(actual_expansion), + self.hir().definitions().parent_module_of_macro_def(actual_expansion), None if block == DUMMY_NODE_ID => DefId::local(CRATE_DEF_INDEX), // Dummy DefId - None => self.hir.get_module_parent(block), + None => self.hir().get_module_parent(block), }; (ident, scope) } @@ -2956,7 +3041,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn with_freevars(self, fid: NodeId, f: F) -> T where F: FnOnce(&[hir::Freevar]) -> T, { - let def_id = self.hir.local_def_id(fid); + let def_id = self.hir().local_def_id(fid); match self.freevars(def_id) { None => f(&[]), Some(d) => f(&d), @@ -2965,10 +3050,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> AssociatedItem { - let id = tcx.hir.as_local_node_id(def_id).unwrap(); - let parent_id = tcx.hir.get_parent(id); - let parent_def_id = tcx.hir.local_def_id(parent_id); - let parent_item = tcx.hir.expect_item(parent_id); + let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let parent_id = tcx.hir().get_parent(id); + let parent_def_id = tcx.hir().local_def_id(parent_id); + let parent_item = tcx.hir().expect_item(parent_id); match parent_item.node { hir::ItemKind::Impl(.., ref impl_item_refs) => { if let Some(impl_item_ref) = impl_item_refs.iter().find(|i| i.id.node_id == id) { @@ -3025,19 +3110,19 @@ fn adt_sized_constraint<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Lrc> { - let id = tcx.hir.as_local_node_id(def_id).unwrap(); - let item = tcx.hir.expect_item(id); + let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let item = tcx.hir().expect_item(id); let vec: Vec<_> = match item.node { hir::ItemKind::Trait(.., ref trait_item_refs) => { trait_item_refs.iter() .map(|trait_item_ref| trait_item_ref.id) - .map(|id| tcx.hir.local_def_id(id.node_id)) + .map(|id| tcx.hir().local_def_id(id.node_id)) .collect() } hir::ItemKind::Impl(.., ref impl_item_refs) => { impl_item_refs.iter() .map(|impl_item_ref| impl_item_ref.id) - .map(|id| tcx.hir.local_def_id(id.node_id)) + .map(|id| tcx.hir().local_def_id(id.node_id)) .collect() } hir::ItemKind::TraitAlias(..) => vec![], @@ -3047,7 +3132,7 @@ fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn def_span<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Span { - tcx.hir.span_if_local(def_id).unwrap() + tcx.hir().span_if_local(def_id).unwrap() } /// If the given def ID describes an item belonging to a trait, @@ -3065,8 +3150,8 @@ fn trait_of_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Option /// Yields the parent function's `DefId` if `def_id` is an `impl Trait` definition. pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option { - if let Some(node_id) = tcx.hir.as_local_node_id(def_id) { - if let Node::Item(item) = tcx.hir.get(node_id) { + if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { + if let Node::Item(item) = tcx.hir().get(node_id) { if let hir::ItemKind::Existential(ref exist_ty) = item.node { return exist_ty.impl_trait_fn; } @@ -3075,18 +3160,6 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option, def_id: DefId) -> bool { - if let Some(node_id) = tcx.hir.as_local_node_id(def_id) { - if let Node::Item(item) = tcx.hir.get(node_id) { - if let hir::ItemKind::TraitAlias(..) = item.node { - return true; - } - } - } - false -} - /// See `ParamEnv` struct definition for details. fn param_env<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) @@ -3113,11 +3186,14 @@ fn param_env<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // are any errors at that point, so after type checking you can be // sure that this will succeed without errors anyway. - let unnormalized_env = ty::ParamEnv::new(tcx.intern_predicates(&predicates), - traits::Reveal::UserFacing); + let unnormalized_env = ty::ParamEnv::new( + tcx.intern_predicates(&predicates), + traits::Reveal::UserFacing, + if tcx.sess.opts.debugging_opts.chalk { Some(def_id) } else { None } + ); - let body_id = tcx.hir.as_local_node_id(def_id).map_or(DUMMY_NODE_ID, |id| { - tcx.hir.maybe_body_owned_by(id).map_or(id, |body| body.node_id) + let body_id = tcx.hir().as_local_node_id(def_id).map_or(DUMMY_NODE_ID, |id| { + tcx.hir().maybe_body_owned_by(id).map_or(id, |body| body.node_id) }); let cause = traits::ObligationCause::misc(tcx.def_span(def_id), body_id); traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause) @@ -3139,7 +3215,7 @@ fn crate_hash<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) -> Svh { assert_eq!(crate_num, LOCAL_CRATE); - tcx.hir.crate_hash + tcx.hir().crate_hash } fn instance_def_size_estimate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -3156,6 +3232,59 @@ fn instance_def_size_estimate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } +/// If `def_id` is an issue 33140 hack impl, return its self type. Otherwise +/// return None. +/// +/// See ImplOverlapKind::Issue33140 for more details. +fn issue33140_self_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + def_id: DefId) + -> Option> +{ + debug!("issue33140_self_ty({:?})", def_id); + + let trait_ref = tcx.impl_trait_ref(def_id).unwrap_or_else(|| { + bug!("issue33140_self_ty called on inherent impl {:?}", def_id) + }); + + debug!("issue33140_self_ty({:?}), trait-ref={:?}", def_id, trait_ref); + + let is_marker_like = + tcx.impl_polarity(def_id) == hir::ImplPolarity::Positive && + tcx.associated_item_def_ids(trait_ref.def_id).is_empty(); + + // Check whether these impls would be ok for a marker trait. + if !is_marker_like { + debug!("issue33140_self_ty - not marker-like!"); + return None; + } + + // impl must be `impl Trait for dyn Marker1 + Marker2 + ...` + if trait_ref.substs.len() != 1 { + debug!("issue33140_self_ty - impl has substs!"); + return None; + } + + let predicates = tcx.predicates_of(def_id); + if predicates.parent.is_some() || !predicates.predicates.is_empty() { + debug!("issue33140_self_ty - impl has predicates {:?}!", predicates); + return None; + } + + let self_ty = trait_ref.self_ty(); + let self_ty_matches = match self_ty.sty { + ty::Dynamic(ref data, ty::ReStatic) => data.principal().is_none(), + _ => false + }; + + if self_ty_matches { + debug!("issue33140_self_ty - MATCHES!"); + Some(self_ty) + } else { + debug!("issue33140_self_ty - non-matching self type"); + None + } +} + pub fn provide(providers: &mut ty::query::Providers<'_>) { context::provide(providers); erase_regions::provide(providers); @@ -3174,6 +3303,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { crate_hash, trait_impls_of: trait_def::trait_impls_of_provider, instance_def_size_estimate, + issue33140_self_ty, ..*providers }; } diff --git a/src/librustc/ty/outlives.rs b/src/librustc/ty/outlives.rs index 7fac88a3d78..ca2d5cd718c 100644 --- a/src/librustc/ty/outlives.rs +++ b/src/librustc/ty/outlives.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The outlines relation `T: 'a` or `'a: 'b`. This code frequently // refers to rules defined in RFC 1214 (`OutlivesFooBar`), so see that // RFC for reference. @@ -155,6 +145,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { ty::FnDef(..) | // OutlivesFunction (*) ty::FnPtr(_) | // OutlivesFunction (*) ty::Dynamic(..) | // OutlivesObject, OutlivesFragment (*) + ty::Placeholder(..) | ty::Bound(..) | ty::Error => { // (*) Bare functions and traits are both binders. In the diff --git a/src/librustc/ty/query/README.md b/src/librustc/ty/query/README.md index 0fcaef5de54..4b5e08cecd9 100644 --- a/src/librustc/ty/query/README.md +++ b/src/librustc/ty/query/README.md @@ -1,302 +1,3 @@ -# The Rust Compiler Query System - -The Compiler Query System is the key to our new demand-driven -organization. The idea is pretty simple. You have various queries -that compute things about the input -- for example, there is a query -called `type_of(def_id)` that, given the def-id of some item, will -compute the type of that item and return it to you. - -Query execution is **memoized** -- so the first time you invoke a -query, it will go do the computation, but the next time, the result is -returned from a hashtable. Moreover, query execution fits nicely into -**incremental computation**; the idea is roughly that, when you do a -query, the result **may** be returned to you by loading stored data -from disk (but that's a separate topic we won't discuss further here). - -The overall vision is that, eventually, the entire compiler -control-flow will be query driven. There will effectively be one -top-level query ("compile") that will run compilation on a crate; this -will in turn demand information about that crate, starting from the -*end*. For example: - -- This "compile" query might demand to get a list of codegen-units - (i.e., modules that need to be compiled by LLVM). -- But computing the list of codegen-units would invoke some subquery - that returns the list of all modules defined in the Rust source. -- That query in turn would invoke something asking for the HIR. -- This keeps going further and further back until we wind up doing the - actual parsing. - -However, that vision is not fully realized. Still, big chunks of the -compiler (for example, generating MIR) work exactly like this. - -### Invoking queries - -To invoke a query is simple. The tcx ("type context") offers a method -for each defined query. So, for example, to invoke the `type_of` -query, you would just do this: - -```rust -let ty = tcx.type_of(some_def_id); -``` - -### Cycles between queries - -Currently, cycles during query execution should always result in a -compilation error. Typically, they arise because of illegal programs -that contain cyclic references they shouldn't (though sometimes they -arise because of compiler bugs, in which case we need to factor our -queries in a more fine-grained fashion to avoid them). - -However, it is nonetheless often useful to *recover* from a cycle -(after reporting an error, say) and try to soldier on, so as to give a -better user experience. In order to recover from a cycle, you don't -get to use the nice method-call-style syntax. Instead, you invoke -using the `try_get` method, which looks roughly like this: - -```rust -use ty::query::queries; -... -match queries::type_of::try_get(tcx, DUMMY_SP, self.did) { - Ok(result) => { - // no cycle occurred! You can use `result` - } - Err(err) => { - // A cycle occurred! The error value `err` is a `DiagnosticBuilder`, - // meaning essentially an "in-progress", not-yet-reported error message. - // See below for more details on what to do here. - } -} -``` - -So, if you get back an `Err` from `try_get`, then a cycle *did* occur. This means that -you must ensure that a compiler error message is reported. You can do that in two ways: - -The simplest is to invoke `err.emit()`. This will emit the cycle error to the user. - -However, often cycles happen because of an illegal program, and you -know at that point that an error either already has been reported or -will be reported due to this cycle by some other bit of code. In that -case, you can invoke `err.cancel()` to not emit any error. It is -traditional to then invoke: - -``` -tcx.sess.delay_span_bug(some_span, "some message") -``` - -`delay_span_bug()` is a helper that says: we expect a compilation -error to have happened or to happen in the future; so, if compilation -ultimately succeeds, make an ICE with the message `"some -message"`. This is basically just a precaution in case you are wrong. - -### How the compiler executes a query - -So you may be wondering what happens when you invoke a query -method. The answer is that, for each query, the compiler maintains a -cache -- if your query has already been executed, then, the answer is -simple: we clone the return value out of the cache and return it -(therefore, you should try to ensure that the return types of queries -are cheaply cloneable; insert a `Rc` if necessary). - -#### Providers - -If, however, the query is *not* in the cache, then the compiler will -try to find a suitable **provider**. A provider is a function that has -been defined and linked into the compiler somewhere that contains the -code to compute the result of the query. - -**Providers are defined per-crate.** The compiler maintains, -internally, a table of providers for every crate, at least -conceptually. Right now, there are really two sets: the providers for -queries about the **local crate** (that is, the one being compiled) -and providers for queries about **external crates** (that is, -dependencies of the local crate). Note that what determines the crate -that a query is targeting is not the *kind* of query, but the *key*. -For example, when you invoke `tcx.type_of(def_id)`, that could be a -local query or an external query, depending on what crate the `def_id` -is referring to (see the `self::keys::Key` trait for more information -on how that works). - -Providers always have the same signature: - -```rust -fn provider<'cx, 'tcx>(tcx: TyCtxt<'cx, 'tcx, 'tcx>, - key: QUERY_KEY) - -> QUERY_RESULT -{ - ... -} -``` - -Providers take two arguments: the `tcx` and the query key. Note also -that they take the *global* tcx (i.e., they use the `'tcx` lifetime -twice), rather than taking a tcx with some active inference context. -They return the result of the query. - -#### How providers are setup - -When the tcx is created, it is given the providers by its creator using -the `Providers` struct. This struct is generate by the macros here, but it -is basically a big list of function pointers: - -```rust -struct Providers { - type_of: for<'cx, 'tcx> fn(TyCtxt<'cx, 'tcx, 'tcx>, DefId) -> Ty<'tcx>, - ... -} -``` - -At present, we have one copy of the struct for local crates, and one -for external crates, though the plan is that we may eventually have -one per crate. - -These `Provider` structs are ultimately created and populated by -`librustc_driver`, but it does this by distributing the work -throughout the other `rustc_*` crates. This is done by invoking -various `provide` functions. These functions tend to look something -like this: - -```rust -pub fn provide(providers: &mut Providers) { - *providers = Providers { - type_of, - ..*providers - }; -} -``` - -That is, they take an `&mut Providers` and mutate it in place. Usually -we use the formulation above just because it looks nice, but you could -as well do `providers.type_of = type_of`, which would be equivalent. -(Here, `type_of` would be a top-level function, defined as we saw -before.) So, if we want to add a provider for some other query, -let's call it `fubar`, into the crate above, we might modify the `provide()` -function like so: - -```rust -pub fn provide(providers: &mut Providers) { - *providers = Providers { - type_of, - fubar, - ..*providers - }; -} - -fn fubar<'cx, 'tcx>(tcx: TyCtxt<'cx, 'tcx>, key: DefId) -> Fubar<'tcx> { .. } -``` - -NB. Most of the `rustc_*` crates only provide **local -providers**. Almost all **extern providers** wind up going through the -`rustc_metadata` crate, which loads the information from the crate -metadata. But in some cases there are crates that provide queries for -*both* local and external crates, in which case they define both a -`provide` and a `provide_extern` function that `rustc_driver` can -invoke. - -### Adding a new kind of query - -So suppose you want to add a new kind of query, how do you do so? -Well, defining a query takes place in two steps: - -1. first, you have to specify the query name and arguments; and then, -2. you have to supply query providers where needed. - -To specify the query name and arguments, you simply add an entry -to the big macro invocation in `mod.rs`. This will probably have changed -by the time you read this README, but at present it looks something -like: - -``` -define_queries! { <'tcx> - /// Records the type of every item. - [] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>, - - ... -} -``` - -Each line of the macro defines one query. The name is broken up like this: - -``` -[] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>, -^^ ^^^^^^^ ^^^^^^^^^^ ^^^^^ ^^^^^^^^ -| | | | | -| | | | result type of query -| | | query key type -| | dep-node constructor -| name of query -query flags -``` - -Let's go over them one by one: - -- **Query flags:** these are largely unused right now, but the intention - is that we'll be able to customize various aspects of how the query is - processed. -- **Name of query:** the name of the query method - (`tcx.type_of(..)`). Also used as the name of a struct - (`ty::query::queries::type_of`) that will be generated to represent - this query. -- **Dep-node constructor:** indicates the constructor function that - connects this query to incremental compilation. Typically, this is a - `DepNode` variant, which can be added by modifying the - `define_dep_nodes!` macro invocation in - `librustc/dep_graph/dep_node.rs`. - - However, sometimes we use a custom function, in which case the - name will be in snake case and the function will be defined at the - bottom of the file. This is typically used when the query key is - not a def-id, or just not the type that the dep-node expects. -- **Query key type:** the type of the argument to this query. - This type must implement the `ty::query::keys::Key` trait, which - defines (for example) how to map it to a crate, and so forth. -- **Result type of query:** the type produced by this query. This type - should (a) not use `RefCell` or other interior mutability and (b) be - cheaply cloneable. Interning or using `Rc` or `Arc` is recommended for - non-trivial data types. - - The one exception to those rules is the `ty::steal::Steal` type, - which is used to cheaply modify MIR in place. See the definition - of `Steal` for more details. New uses of `Steal` should **not** be - added without alerting `@rust-lang/compiler`. - -So, to add a query: - -- Add an entry to `define_queries!` using the format above. -- Possibly add a corresponding entry to the dep-node macro. -- Link the provider by modifying the appropriate `provide` method; - or add a new one if needed and ensure that `rustc_driver` is invoking it. - -#### Query structs and descriptions - -For each kind, the `define_queries` macro will generate a "query struct" -named after the query. This struct is a kind of a place-holder -describing the query. Each such struct implements the -`self::config::QueryConfig` trait, which has associated types for the -key/value of that particular query. Basically the code generated looks something -like this: - -```rust -// Dummy struct representing a particular kind of query: -pub struct type_of<'tcx> { phantom: PhantomData<&'tcx ()> } - -impl<'tcx> QueryConfig for type_of<'tcx> { - type Key = DefId; - type Value = Ty<'tcx>; -} -``` - -There is an additional trait that you may wish to implement called -`self::config::QueryDescription`. This trait is used during cycle -errors to give a "human readable" name for the query, so that we can -summarize what was happening when the cycle occurred. Implementing -this trait is optional if the query key is `DefId`, but if you *don't* -implement it, you get a pretty generic error ("processing `foo`..."). -You can put new impls into the `config` module. They look something like this: - -```rust -impl<'tcx> QueryDescription for queries::type_of<'tcx> { - fn describe(tcx: TyCtxt<'_, '_, '_>, key: DefId) -> String { - format!("computing the type of `{}`", tcx.item_path_str(key)) - } -} -``` +For more information about how the query system works, see the [rustc guide]. +[rustc guide]: https://rust-lang.github.io/rustc-guide/query.html diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index bb33def51cc..c4757574ffe 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use dep_graph::SerializedDepNodeIndex; use dep_graph::DepNode; use hir::def_id::{CrateNum, DefId, DefIndex}; @@ -78,11 +68,83 @@ impl<'tcx, M: QueryAccessors<'tcx, Key=DefId>> QueryDescription<'tcx> for M { format!("processing `{}`", tcx.item_path_str(def_id)).into() } else { let name = unsafe { ::std::intrinsics::type_name::() }; - format!("processing `{}` applied to `{:?}`", name, def_id).into() + format!("processing {:?} with query `{}`", def_id, name).into() } } } +impl<'tcx> QueryDescription<'tcx> for queries::check_mod_attrs<'tcx> { + fn describe( + tcx: TyCtxt<'_, '_, '_>, + key: DefId, + ) -> Cow<'static, str> { + format!("checking attributes in {}", key.describe_as_module(tcx)).into() + } +} + +impl<'tcx> QueryDescription<'tcx> for queries::check_mod_unstable_api_usage<'tcx> { + fn describe( + tcx: TyCtxt<'_, '_, '_>, + key: DefId, + ) -> Cow<'static, str> { + format!("checking for unstable API usage in {}", key.describe_as_module(tcx)).into() + } +} + +impl<'tcx> QueryDescription<'tcx> for queries::check_mod_loops<'tcx> { + fn describe( + tcx: TyCtxt<'_, '_, '_>, + key: DefId, + ) -> Cow<'static, str> { + format!("checking loops in {}", key.describe_as_module(tcx)).into() + } +} + +impl<'tcx> QueryDescription<'tcx> for queries::check_mod_item_types<'tcx> { + fn describe( + tcx: TyCtxt<'_, '_, '_>, + key: DefId, + ) -> Cow<'static, str> { + format!("checking item types in {}", key.describe_as_module(tcx)).into() + } +} + +impl<'tcx> QueryDescription<'tcx> for queries::check_mod_privacy<'tcx> { + fn describe( + tcx: TyCtxt<'_, '_, '_>, + key: DefId, + ) -> Cow<'static, str> { + format!("checking privacy in {}", key.describe_as_module(tcx)).into() + } +} + +impl<'tcx> QueryDescription<'tcx> for queries::check_mod_intrinsics<'tcx> { + fn describe( + tcx: TyCtxt<'_, '_, '_>, + key: DefId, + ) -> Cow<'static, str> { + format!("checking intrinsics in {}", key.describe_as_module(tcx)).into() + } +} + +impl<'tcx> QueryDescription<'tcx> for queries::check_mod_liveness<'tcx> { + fn describe( + tcx: TyCtxt<'_, '_, '_>, + key: DefId, + ) -> Cow<'static, str> { + format!("checking liveness of variables in {}", key.describe_as_module(tcx)).into() + } +} + +impl<'tcx> QueryDescription<'tcx> for queries::collect_mod_item_types<'tcx> { + fn describe( + tcx: TyCtxt<'_, '_, '_>, + key: DefId, + ) -> Cow<'static, str> { + format!("collecting item types in {}", key.describe_as_module(tcx)).into() + } +} + impl<'tcx> QueryDescription<'tcx> for queries::normalize_projection_ty<'tcx> { fn describe( _tcx: TyCtxt<'_, '_, '_>, @@ -116,6 +178,15 @@ impl<'tcx> QueryDescription<'tcx> for queries::evaluate_obligation<'tcx> { } } +impl<'tcx> QueryDescription<'tcx> for queries::evaluate_goal<'tcx> { + fn describe( + _tcx: TyCtxt<'_, '_, '_>, + goal: traits::ChalkCanonicalGoal<'tcx> + ) -> Cow<'static, str> { + format!("evaluating trait selection obligation `{}`", goal.value.goal).into() + } +} + impl<'tcx> QueryDescription<'tcx> for queries::type_op_ascribe_user_type<'tcx> { fn describe( _tcx: TyCtxt<'_, '_, '_>, @@ -227,9 +298,9 @@ impl<'tcx> QueryDescription<'tcx> for queries::erase_regions_ty<'tcx> { impl<'tcx> QueryDescription<'tcx> for queries::type_param_predicates<'tcx> { fn describe(tcx: TyCtxt<'_, '_, '_>, (_, def_id): (DefId, DefId)) -> Cow<'static, str> { - let id = tcx.hir.as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_node_id(def_id).unwrap(); format!("computing the bounds for type parameter `{}`", - tcx.hir.ty_param_name(id)).into() + tcx.hir().ty_param_name(id)).into() } } @@ -585,13 +656,19 @@ impl<'tcx> QueryDescription<'tcx> for queries::foreign_modules<'tcx> { } } +impl<'tcx> QueryDescription<'tcx> for queries::entry_fn<'tcx> { + fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> { + "looking up the entry function of a crate".into() + } +} + impl<'tcx> QueryDescription<'tcx> for queries::plugin_registrar_fn<'tcx> { fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> { "looking up the plugin registrar for a crate".into() } } -impl<'tcx> QueryDescription<'tcx> for queries::derive_registrar_fn<'tcx> { +impl<'tcx> QueryDescription<'tcx> for queries::proc_macro_decls_static<'tcx> { fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> { "looking up the derive registrar for a crate".into() } @@ -827,6 +904,12 @@ impl<'tcx> QueryDescription<'tcx> for queries::substitute_normalize_and_test_pre } } +impl<'tcx> QueryDescription<'tcx> for queries::method_autoderef_steps<'tcx> { + fn describe(_tcx: TyCtxt<'_, '_, '_>, goal: CanonicalTyGoal<'tcx>) -> Cow<'static, str> { + format!("computing autoderef types for `{:?}`", goal).into() + } +} + impl<'tcx> QueryDescription<'tcx> for queries::target_features_whitelist<'tcx> { fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> { "looking up the whitelist of target features".into() @@ -884,6 +967,12 @@ impl<'tcx> QueryDescription<'tcx> for queries::dllimport_foreign_items<'tcx> { } } +impl<'tcx> QueryDescription<'tcx> for queries::backend_optimization_level<'tcx> { + fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> { + "optimization level used by backend".into() + } +} + macro_rules! impl_disk_cacheable_query( ($query_name:ident, |$key:tt| $cond:expr) => { impl<'tcx> QueryDescription<'tcx> for queries::$query_name<'tcx> { diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index d588bc8c0cb..abbf74a7761 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] use std::mem; @@ -18,12 +8,16 @@ use syntax_pos::Span; use ty::tls; use ty::query::Query; use ty::query::plumbing::CycleError; +#[cfg(not(parallel_compiler))] +use ty::query::{ + plumbing::TryGetJob, + config::QueryDescription, +}; use ty::context::TyCtxt; -use errors::Diagnostic; use std::process; use std::{fmt, ptr}; -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] use { rayon_core, parking_lot::{Mutex, Condvar}, @@ -59,11 +53,8 @@ pub struct QueryJob<'tcx> { /// The parent query job which created this job and is implicitly waiting on it. pub parent: Option>>, - /// Diagnostic messages which are emitted while the query executes - pub diagnostics: Lock>, - /// The latch which is used to wait on this job - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] latch: QueryLatch<'tcx>, } @@ -71,10 +62,9 @@ impl<'tcx> QueryJob<'tcx> { /// Creates a new query job pub fn new(info: QueryInfo<'tcx>, parent: Option>>) -> Self { QueryJob { - diagnostics: Lock::new(Vec::new()), info, parent, - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] latch: QueryLatch::new(), } } @@ -83,41 +73,52 @@ impl<'tcx> QueryJob<'tcx> { /// /// For single threaded rustc there's no concurrent jobs running, so if we are waiting for any /// query that means that there is a query cycle, thus this always running a cycle error. - pub(super) fn await<'lcx>( + #[cfg(not(parallel_compiler))] + #[inline(never)] + #[cold] + pub(super) fn cycle_error<'lcx, 'a, D: QueryDescription<'tcx>>( &self, tcx: TyCtxt<'_, 'tcx, 'lcx>, span: Span, - ) -> Result<(), CycleError<'tcx>> { - #[cfg(not(parallel_queries))] - { - self.find_cycle_in_stack(tcx, span) - } - - #[cfg(parallel_queries)] - { - tls::with_related_context(tcx, move |icx| { - let mut waiter = Lrc::new(QueryWaiter { - query: icx.query.clone(), - span, - cycle: Lock::new(None), - condvar: Condvar::new(), - }); - self.latch.await(&waiter); + ) -> TryGetJob<'a, 'tcx, D> { + TryGetJob::JobCompleted(Err(Box::new(self.find_cycle_in_stack(tcx, span)))) + } - match Lrc::get_mut(&mut waiter).unwrap().cycle.get_mut().take() { - None => Ok(()), - Some(cycle) => Err(cycle) - } - }) - } + /// Awaits for the query job to complete. + /// + /// For single threaded rustc there's no concurrent jobs running, so if we are waiting for any + /// query that means that there is a query cycle, thus this always running a cycle error. + #[cfg(parallel_compiler)] + pub(super) fn await<'lcx>( + &self, + tcx: TyCtxt<'_, 'tcx, 'lcx>, + span: Span, + ) -> Result<(), Box>> { + tls::with_related_context(tcx, move |icx| { + let mut waiter = Lrc::new(QueryWaiter { + query: icx.query.clone(), + span, + cycle: Lock::new(None), + condvar: Condvar::new(), + }); + self.latch.await(&waiter); + // FIXME: Get rid of this lock. We have ownership of the QueryWaiter + // although another thread may still have a Lrc reference so we cannot + // use Lrc::get_mut + let mut cycle = waiter.cycle.lock(); + match cycle.take() { + None => Ok(()), + Some(cycle) => Err(Box::new(cycle)) + } + }) } - #[cfg(not(parallel_queries))] + #[cfg(not(parallel_compiler))] fn find_cycle_in_stack<'lcx>( &self, tcx: TyCtxt<'_, 'tcx, 'lcx>, span: Span, - ) -> Result<(), CycleError<'tcx>> { + ) -> CycleError<'tcx> { // Get the current executing query (waiter) and find the waitee amongst its parents let mut current_job = tls::with_related_context(tcx, |icx| icx.query.clone()); let mut cycle = Vec::new(); @@ -137,7 +138,7 @@ impl<'tcx> QueryJob<'tcx> { let usage = job.parent.as_ref().map(|parent| { (job.info.span, parent.info.query.clone()) }); - return Err(CycleError { usage, cycle }); + return CycleError { usage, cycle }; } current_job = job.parent.clone(); @@ -151,7 +152,7 @@ impl<'tcx> QueryJob<'tcx> { /// This does nothing for single threaded rustc, /// as there are no concurrent jobs which could be waiting on us pub fn signal_complete(&self) { - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] self.latch.set(); } @@ -160,7 +161,7 @@ impl<'tcx> QueryJob<'tcx> { } } -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] struct QueryWaiter<'tcx> { query: Option>>, condvar: Condvar, @@ -168,7 +169,7 @@ struct QueryWaiter<'tcx> { cycle: Lock>>, } -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] impl<'tcx> QueryWaiter<'tcx> { fn notify(&self, registry: &rayon_core::Registry) { rayon_core::mark_unblocked(registry); @@ -176,18 +177,18 @@ impl<'tcx> QueryWaiter<'tcx> { } } -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] struct QueryLatchInfo<'tcx> { complete: bool, waiters: Vec>>, } -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] struct QueryLatch<'tcx> { info: Mutex>, } -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] impl<'tcx> QueryLatch<'tcx> { fn new() -> Self { QueryLatch { @@ -241,7 +242,7 @@ impl<'tcx> QueryLatch<'tcx> { } /// A resumable waiter of a query. The usize is the index into waiters in the query's latch -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] type Waiter<'tcx> = (Lrc>, usize); /// Visits all the non-resumable and resumable waiters of a query. @@ -253,7 +254,7 @@ type Waiter<'tcx> = (Lrc>, usize); /// For visits of resumable waiters it returns Some(Some(Waiter)) which has the /// required information to resume the waiter. /// If all `visit` calls returns None, this function also returns None. -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] fn visit_waiters<'tcx, F>(query: Lrc>, mut visit: F) -> Option>> where F: FnMut(Span, Lrc>) -> Option>> @@ -281,18 +282,18 @@ where /// `span` is the reason for the `query` to execute. This is initially DUMMY_SP. /// If a cycle is detected, this initial value is replaced with the span causing /// the cycle. -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] fn cycle_check<'tcx>(query: Lrc>, span: Span, stack: &mut Vec<(Span, Lrc>)>, visited: &mut FxHashSet<*const QueryJob<'tcx>> ) -> Option>> { - if visited.contains(&query.as_ptr()) { + if !visited.insert(query.as_ptr()) { return if let Some(p) = stack.iter().position(|q| q.1.as_ptr() == query.as_ptr()) { // We detected a query cycle, fix up the initial span and return Some // Remove previous stack entries - stack.splice(0..p, iter::empty()); + stack.drain(0..p); // Replace the span for the first query with the cycle cause stack[0].0 = span; Some(None) @@ -301,8 +302,7 @@ fn cycle_check<'tcx>(query: Lrc>, } } - // Mark this query is visited and add it to the stack - visited.insert(query.as_ptr()); + // Query marked as visited is added it to the stack stack.push((span, query.clone())); // Visit all the waiters @@ -321,24 +321,20 @@ fn cycle_check<'tcx>(query: Lrc>, /// Finds out if there's a path to the compiler root (aka. code which isn't in a query) /// from `query` without going through any of the queries in `visited`. /// This is achieved with a depth first search. -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] fn connected_to_root<'tcx>( query: Lrc>, visited: &mut FxHashSet<*const QueryJob<'tcx>> ) -> bool { - // This query is connected to the root (it has no query parent), return true - if query.parent.is_none() { - return true; - } - // We already visited this or we're deliberately ignoring it - if visited.contains(&query.as_ptr()) { + if !visited.insert(query.as_ptr()) { return false; } - visited.insert(query.as_ptr()); - - let mut connected = false; + // This query is connected to the root (it has no query parent), return true + if query.parent.is_none() { + return true; + } visit_waiters(query, |_, successor| { if connected_to_root(successor, visited) { @@ -349,12 +345,34 @@ fn connected_to_root<'tcx>( }).is_some() } +// Deterministically pick an query from a list +#[cfg(parallel_compiler)] +fn pick_query<'a, 'tcx, T, F: Fn(&T) -> (Span, Lrc>)>( + tcx: TyCtxt<'_, 'tcx, '_>, + queries: &'a [T], + f: F +) -> &'a T { + // Deterministically pick an entry point + // FIXME: Sort this instead + let mut hcx = tcx.create_stable_hashing_context(); + queries.iter().min_by_key(|v| { + let (span, query) = f(v); + let mut stable_hasher = StableHasher::::new(); + query.info.query.hash_stable(&mut hcx, &mut stable_hasher); + // Prefer entry points which have valid spans for nicer error messages + // We add an integer to the tuple ensuring that entry points + // with valid spans are picked first + let span_cmp = if span == DUMMY_SP { 1 } else { 0 }; + (span_cmp, stable_hasher.finish()) + }).unwrap() +} + /// Looks for query cycles starting from the last query in `jobs`. /// If a cycle is found, all queries in the cycle is removed from `jobs` and /// the function return true. /// If a cycle was not found, the starting query is removed from `jobs` and /// the function returns false. -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] fn remove_cycle<'tcx>( jobs: &mut Vec>>, wakelist: &mut Vec>>, @@ -367,11 +385,9 @@ fn remove_cycle<'tcx>( DUMMY_SP, &mut stack, &mut visited) { - // Reverse the stack so earlier entries require later entries - stack.reverse(); - - // The stack is a vector of pairs of spans and queries - let (mut spans, queries): (Vec<_>, Vec<_>) = stack.into_iter().unzip(); + // The stack is a vector of pairs of spans and queries; reverse it so that + // the earlier entries require later entries + let (mut spans, queries): (Vec<_>, Vec<_>) = stack.into_iter().rev().unzip(); // Shift the spans so that queries are matched with the span for their waitee spans.rotate_right(1); @@ -388,41 +404,49 @@ fn remove_cycle<'tcx>( // Find the queries in the cycle which are // connected to queries outside the cycle - let entry_points = stack.iter().filter_map(|query| { - // Mark all the other queries in the cycle as already visited - let mut visited = FxHashSet::from_iter(stack.iter().filter_map(|q| { - if q.1.as_ptr() != query.1.as_ptr() { - Some(q.1.as_ptr()) - } else { + let entry_points = stack.iter().filter_map(|(span, query)| { + if query.parent.is_none() { + // This query is connected to the root (it has no query parent) + Some((*span, query.clone(), None)) + } else { + let mut waiters = Vec::new(); + // Find all the direct waiters who lead to the root + visit_waiters(query.clone(), |span, waiter| { + // Mark all the other queries in the cycle as already visited + let mut visited = FxHashSet::from_iter(stack.iter().map(|q| q.1.as_ptr())); + + if connected_to_root(waiter.clone(), &mut visited) { + waiters.push((span, waiter)); + } + None + }); + if waiters.is_empty() { + None + } else { + // Deterministically pick one of the waiters to show to the user + let waiter = pick_query(tcx, &waiters, |s| s.clone()).clone(); + Some((*span, query.clone(), Some(waiter))) } - })); - - if connected_to_root(query.1.clone(), &mut visited) { - Some(query.1.clone()) - } else { - None } - }); + }).collect::>, Option<(Span, Lrc>)>)>>(); // Deterministically pick an entry point - // FIXME: Sort this instead - let mut hcx = tcx.create_stable_hashing_context(); - let entry_point = entry_points.min_by_key(|q| { - let mut stable_hasher = StableHasher::::new(); - q.info.query.hash_stable(&mut hcx, &mut stable_hasher); - stable_hasher.finish() - }).unwrap().as_ptr(); + let (_, entry_point, usage) = pick_query(tcx, &entry_points, |e| (e.0, e.1.clone())); // Shift the stack so that our entry point is first - let entry_point_pos = stack.iter().position(|(_, query)| query.as_ptr() == entry_point); + let entry_point_pos = stack.iter().position(|(_, query)| { + query.as_ptr() == entry_point.as_ptr() + }); if let Some(pos) = entry_point_pos { - stack.rotate_right(pos); + stack.rotate_left(pos); } + let usage = usage.as_ref().map(|(span, query)| (*span, query.info.query.clone())); + // Create the cycle error let mut error = CycleError { - usage: None, + usage, cycle: stack.iter().map(|&(s, ref q)| QueryInfo { span: s, query: q.info.query.clone(), @@ -451,7 +475,7 @@ fn remove_cycle<'tcx>( /// Creates a new thread and forwards information in thread locals to it. /// The new thread runs the deadlock handler. /// Must only be called when a deadlock is about to happen. -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] pub unsafe fn handle_deadlock() { use syntax; use syntax_pos; @@ -490,7 +514,7 @@ pub unsafe fn handle_deadlock() { /// uses a query latch and then resuming that waiter. /// There may be multiple cycles involved in a deadlock, so this searches /// all active queries for cycles before finally resuming all the waiters at once. -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] fn deadlock(tcx: TyCtxt<'_, '_, '_>, registry: &rayon_core::Registry) { let on_panic = OnDrop(|| { eprintln!("deadlock handler panicked, aborting process"); diff --git a/src/librustc/ty/query/keys.rs b/src/librustc/ty/query/keys.rs index f2d7a6792b5..af6f5a00dee 100644 --- a/src/librustc/ty/query/keys.rs +++ b/src/librustc/ty/query/keys.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Defines the set of legal keys that can be used in queries. use infer::canonical::Canonical; @@ -146,7 +136,7 @@ impl<'tcx> Key for ty::PolyTraitRef<'tcx>{ } } -impl<'tcx> Key for &'tcx ty::Const<'tcx> { +impl<'tcx> Key for ty::Const<'tcx> { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index 22bd1e26ba3..195bec11ee5 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use dep_graph::{DepConstructor, DepNode}; use errors::DiagnosticBuilder; use hir::def_id::{CrateNum, DefId, DefIndex}; @@ -32,14 +22,15 @@ use mir::mono::CodegenUnit; use mir; use mir::interpret::GlobalId; use session::{CompileResult, CrateDisambiguator}; -use session::config::OutputFilenames; +use session::config::{EntryFnType, OutputFilenames, OptLevel}; use traits::{self, Vtable}; use traits::query::{ CanonicalPredicateGoal, CanonicalProjectionGoal, - CanonicalTyGoal, CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpEqGoal, - CanonicalTypeOpSubtypeGoal, CanonicalTypeOpProvePredicateGoal, + CanonicalTyGoal, CanonicalTypeOpAscribeUserTypeGoal, + CanonicalTypeOpEqGoal, CanonicalTypeOpSubtypeGoal, CanonicalTypeOpProvePredicateGoal, CanonicalTypeOpNormalizeGoal, NoSolution, }; +use traits::query::method_autoderef::MethodAutoderefStepsResult; use traits::query::dropck_outlives::{DtorckConstraint, DropckOutlivesResult}; use traits::query::normalize::NormalizationResult; use traits::query::outlives_bounds::OutlivesBound; @@ -51,6 +42,7 @@ use ty::subst::Substs; use util::nodemap::{DefIdSet, DefIdMap, ItemLocalSet}; use util::common::{ErrorReported}; use util::profiling::ProfileCategory::*; +use session::Session; use rustc_data_structures::bit_set::BitSet; use rustc_data_structures::indexed_vec::IndexVec; @@ -62,6 +54,7 @@ use rustc_target::spec::PanicStrategy; use std::borrow::Cow; use std::ops::Deref; use std::sync::Arc; +use std::intrinsics::type_name; use syntax_pos::{Span, DUMMY_SP}; use syntax_pos::symbol::InternedString; use syntax::attr; @@ -76,7 +69,7 @@ pub use self::plumbing::{force_from_dep_node, CycleError}; mod job; pub use self::job::{QueryJob, QueryInfo}; -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] pub use self::job::handle_deadlock; mod keys; @@ -166,21 +159,21 @@ define_queries! { <'tcx> ) -> Result, NoSolution>, /// True if this is a const fn, use the `is_const_fn` to know whether your crate actually - /// sees it as const fn (e.g. the const-fn-ness might be unstable and you might not have + /// sees it as const fn (e.g., the const-fn-ness might be unstable and you might not have /// the feature gate active) /// - /// DO NOT CALL MANUALLY, it is only meant to cache the base data for the `is_const_fn` - /// function + /// **Do not call this function manually.** It is only meant to cache the base data for the + /// `is_const_fn` function. [] fn is_const_fn_raw: IsConstFn(DefId) -> bool, /// Returns true if calls to the function may be promoted /// - /// This is either because the function is e.g. a tuple-struct or tuple-variant constructor, - /// or because it has the `#[rustc_promotable]` attribute. The attribute should be removed - /// in the future in favour of some form of check which figures out whether the function - /// does not inspect the bits of any of its arguments (so is essentially just a constructor - /// function) + /// This is either because the function is e.g., a tuple-struct or tuple-variant + /// constructor, or because it has the `#[rustc_promotable]` attribute. The attribute should + /// be removed in the future in favour of some form of check which figures out whether the + /// function does not inspect the bits of any of its arguments (so is essentially just a + /// constructor function). [] fn is_promotable_const_fn: IsPromotableConstFn(DefId) -> bool, /// True if this is a foreign item (i.e., linked via `extern { ... }`). @@ -210,6 +203,8 @@ define_queries! { <'tcx> [] fn impl_trait_ref: ImplTraitRef(DefId) -> Option>, [] fn impl_polarity: ImplPolarity(DefId) -> hir::ImplPolarity, + + [] fn issue33140_self_ty: Issue33140SelfTy(DefId) -> Option>, }, TypeChecking { @@ -259,6 +254,24 @@ define_queries! { <'tcx> }, Other { + /// Checks the attributes in the module + [] fn check_mod_attrs: CheckModAttrs(DefId) -> (), + + [] fn check_mod_unstable_api_usage: CheckModUnstableApiUsage(DefId) -> (), + + /// Checks the loops in the module + [] fn check_mod_loops: CheckModLoops(DefId) -> (), + + [] fn check_mod_item_types: CheckModItemTypes(DefId) -> (), + + [] fn check_mod_privacy: CheckModPrivacy(DefId) -> (), + + [] fn check_mod_intrinsics: CheckModIntrinsics(DefId) -> (), + + [] fn check_mod_liveness: CheckModLiveness(DefId) -> (), + + [] fn collect_mod_item_types: CollectModItemTypes(DefId) -> (), + /// Caches CoerceUnsized kinds for impls on custom types. [] fn coerce_unsized_info: CoerceUnsizedInfo(DefId) -> ty::adjustment::CoerceUnsizedInfo, @@ -390,7 +403,7 @@ define_queries! { <'tcx> /// might want to use `reveal_all()` method to change modes. [] fn param_env: ParamEnv(DefId) -> ty::ParamEnv<'tcx>, - /// Trait selection queries. These are best used by invoking `ty.moves_by_default()`, + /// Trait selection queries. These are best used by invoking `ty.is_copy_modulo_regions()`, /// `ty.is_copy()`, etc, since that will prune the environment where possible. [] fn is_copy_raw: is_copy_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool, [] fn is_sized_raw: is_sized_dep_node(ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool, @@ -469,8 +482,11 @@ define_queries! { <'tcx> [] fn foreign_modules: ForeignModules(CrateNum) -> Lrc>, + /// Identifies the entry-point (e.g. the `main` function) for a given + /// crate, returning `None` if there is no entry point (such as for library crates). + [] fn entry_fn: EntryFn(CrateNum) -> Option<(DefId, EntryFnType)>, [] fn plugin_registrar_fn: PluginRegistrarFn(CrateNum) -> Option, - [] fn derive_registrar_fn: DeriveRegistrarFn(CrateNum) -> Option, + [] fn proc_macro_decls_static: ProcMacroDeclsStatic(CrateNum) -> Option, [] fn crate_disambiguator: CrateDisambiguator(CrateNum) -> CrateDisambiguator, [] fn crate_hash: CrateHash(CrateNum) -> Svh, [] fn original_crate_name: OriginalCrateName(CrateNum) -> Symbol, @@ -534,12 +550,14 @@ define_queries! { <'tcx> [] fn maybe_unused_trait_import: MaybeUnusedTraitImport(DefId) -> bool, [] fn maybe_unused_extern_crates: maybe_unused_extern_crates_node(CrateNum) -> Lrc>, + [] fn names_imported_by_glob_use: NamesImportedByGlobUse(DefId) + -> Lrc>, [] fn stability_index: stability_index_node(CrateNum) -> Lrc>, [] fn all_crate_nums: all_crate_nums_node(CrateNum) -> Lrc>, /// A vector of every trait accessible in the whole crate - /// (i.e. including those from subcrates). This is used only for + /// (i.e., including those from subcrates). This is used only for /// error reporting. [] fn all_traits: all_traits_node(CrateNum) -> Lrc>, }, @@ -555,6 +573,7 @@ define_queries! { <'tcx> -> (Arc, Arc>>>), [] fn is_codegened_item: IsCodegenedItem(DefId) -> bool, [] fn codegen_unit: CodegenUnit(InternedString) -> Arc>, + [] fn backend_optimization_level: BackendOptimizationLevel(CrateNum) -> OptLevel, }, Other { @@ -602,6 +621,13 @@ define_queries! { <'tcx> CanonicalPredicateGoal<'tcx> ) -> Result, + [] fn evaluate_goal: EvaluateGoal( + traits::ChalkCanonicalGoal<'tcx> + ) -> Result< + Lrc>>, + NoSolution + >, + /// Do not call this query directly: part of the `Eq` type-op [] fn type_op_ascribe_user_type: TypeOpAscribeUserType( CanonicalTypeOpAscribeUserTypeGoal<'tcx> @@ -668,6 +694,10 @@ define_queries! { <'tcx> [] fn substitute_normalize_and_test_predicates: substitute_normalize_and_test_predicates_node((DefId, &'tcx Substs<'tcx>)) -> bool, + + [] fn method_autoderef_steps: MethodAutoderefSteps( + CanonicalTyGoal<'tcx> + ) -> MethodAutoderefStepsResult<'tcx>, }, Other { @@ -689,7 +719,7 @@ define_queries! { <'tcx> ) -> Clauses<'tcx>, // Get the chalk-style environment of the given item. - [] fn environment: Environment(DefId) -> ty::Binder>, + [] fn environment: Environment(DefId) -> traits::Environment<'tcx>, }, Linking { @@ -705,21 +735,21 @@ impl<'a, 'tcx, 'lcx> TyCtxt<'a, 'tcx, 'lcx> { self, span: Span, key: DefId, - ) -> Result<&'tcx [Ty<'tcx>], DiagnosticBuilder<'a>> { + ) -> Result<&'tcx [Ty<'tcx>], Box>> { self.try_get_query::>(span, key) } pub fn try_needs_drop_raw( self, span: Span, key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>, - ) -> Result> { + ) -> Result>> { self.try_get_query::>(span, key) } pub fn try_optimized_mir( self, span: Span, key: DefId, - ) -> Result<&'tcx mir::Mir<'tcx>, DiagnosticBuilder<'a>> { + ) -> Result<&'tcx mir::Mir<'tcx>, Box>> { self.try_get_query::>(span, key) } } diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 7d3ae64f4fc..a674e942b38 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use dep_graph::{DepNodeIndex, SerializedDepNodeIndex}; use errors::Diagnostic; use hir; @@ -17,6 +7,7 @@ use ich::{CachingSourceMapView, Fingerprint}; use mir::{self, interpret}; use mir::interpret::{AllocDecodingSession, AllocDecodingState}; use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::thin_vec::ThinVec; use rustc_data_structures::sync::{Lrc, Lock, HashMapExt, Once}; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque, @@ -351,11 +342,13 @@ impl<'sess> OnDiskCache<'sess> { /// Store a diagnostic emitted during the current compilation session. /// Anything stored like this will be available via `load_diagnostics` in /// the next compilation session. + #[inline(never)] + #[cold] pub fn store_diagnostics(&self, dep_node_index: DepNodeIndex, - diagnostics: Vec) { + diagnostics: ThinVec) { let mut current_diagnostics = self.current_diagnostics.borrow_mut(); - let prev = current_diagnostics.insert(dep_node_index, diagnostics); + let prev = current_diagnostics.insert(dep_node_index, diagnostics.into()); debug_assert!(prev.is_none()); } @@ -377,16 +370,16 @@ impl<'sess> OnDiskCache<'sess> { /// Since many anonymous queries can share the same `DepNode`, we aggregate /// them -- as opposed to regular queries where we assume that there is a /// 1:1 relationship between query-key and `DepNode`. + #[inline(never)] + #[cold] pub fn store_diagnostics_for_anon_node(&self, dep_node_index: DepNodeIndex, - mut diagnostics: Vec) { + diagnostics: ThinVec) { let mut current_diagnostics = self.current_diagnostics.borrow_mut(); - let x = current_diagnostics.entry(dep_node_index).or_insert_with(|| { - mem::replace(&mut diagnostics, Vec::new()) - }); + let x = current_diagnostics.entry(dep_node_index).or_insert(Vec::new()); - x.extend(diagnostics.into_iter()); + x.extend(Into::>::into(diagnostics)); } fn load_indexed<'tcx, T>(&self, @@ -398,11 +391,7 @@ impl<'sess> OnDiskCache<'sess> { -> Option where T: Decodable { - let pos = if let Some(&pos) = index.get(&dep_node_index) { - pos - } else { - return None - }; + let pos = index.get(&dep_node_index).cloned()?; // Initialize the cnum_map using the value from the thread which finishes the closure first self.cnum_map.init_nonlocking_same(|| { @@ -725,7 +714,7 @@ impl<'a, 'tcx, 'x> SpecializedDecoder for CacheDecoder<'a, 'tcx, 'x> { #[inline] fn specialized_decode(&mut self) -> Result { let hir_id = hir::HirId::decode(self)?; - Ok(self.tcx().hir.hir_to_node_id(hir_id)) + Ok(self.tcx().hir().hir_to_node_id(hir_id)) } } @@ -926,7 +915,7 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a local_id, } = *id; - let def_path_hash = self.tcx.hir.definitions().def_path_hash(owner); + let def_path_hash = self.tcx.hir().definitions().def_path_hash(owner); def_path_hash.encode(self)?; local_id.encode(self) @@ -968,7 +957,7 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder for CacheEncoder<'enc, 'a, 't { #[inline] fn specialized_encode(&mut self, node_id: &NodeId) -> Result<(), Self::Error> { - let hir_id = self.tcx.hir.node_to_hir_id(*node_id); + let hir_id = self.tcx.hir().node_to_hir_id(*node_id); hir_id.encode(self) } } diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index efee39a1d63..e777c883c37 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -1,18 +1,8 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The implementation of the query system itself. Defines the macros //! that generate the actual methods on tcx which find and execute the //! provider, manage the caches, and so forth. -use dep_graph::{DepNodeIndex, DepNode, DepKind, DepNodeColor}; +use dep_graph::{DepNodeIndex, DepNode, DepKind, SerializedDepNodeIndex}; use errors::DiagnosticBuilder; use errors::Level; use errors::Diagnostic; @@ -28,6 +18,7 @@ use util::common::{profq_msg, ProfileQueriesMsg, QueryMsg}; use rustc_data_structures::fx::{FxHashMap}; use rustc_data_structures::sync::{Lrc, Lock}; +use rustc_data_structures::thin_vec::ThinVec; use std::mem; use std::ptr; use std::collections::hash_map::Entry; @@ -37,6 +28,8 @@ use syntax::source_map::DUMMY_SP; pub struct QueryCache<'tcx, D: QueryConfig<'tcx> + ?Sized> { pub(super) results: FxHashMap>, pub(super) active: FxHashMap>, + #[cfg(debug_assertions)] + pub(super) cache_hits: usize, } pub(super) struct QueryValue { @@ -60,6 +53,8 @@ impl<'tcx, M: QueryConfig<'tcx>> Default for QueryCache<'tcx, M> { QueryCache { results: FxHashMap::default(), active: FxHashMap::default(), + #[cfg(debug_assertions)] + cache_hits: 0, } } } @@ -118,12 +113,12 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> { let mut lock = cache.borrow_mut(); if let Some(value) = lock.results.get(key) { profq_msg!(tcx, ProfileQueriesMsg::CacheHit); - tcx.sess.profiler(|p| { - p.record_query(Q::CATEGORY); - p.record_query_hit(Q::CATEGORY); - }); - + tcx.sess.profiler(|p| p.record_query_hit(Q::CATEGORY)); let result = Ok((value.value.clone(), value.index)); + #[cfg(debug_assertions)] + { + lock.cache_hits += 1; + } return TryGetJob::JobCompleted(result); } let job = match lock.active.entry((*key).clone()) { @@ -136,11 +131,14 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> { Entry::Vacant(entry) => { // No job entry for this query. Return a new one to be started later return tls::with_related_context(tcx, |icx| { + // Create the `parent` variable before `info`. This allows LLVM + // to elide the move of `info` + let parent = icx.query.clone(); let info = QueryInfo { span, query: Q::query(key.clone()), }; - let job = Lrc::new(QueryJob::new(info, icx.query.clone())); + let job = Lrc::new(QueryJob::new(info, parent)); let owner = JobOwner { cache, job: job.clone(), @@ -153,14 +151,25 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> { }; mem::drop(lock); - if let Err(cycle) = job.await(tcx, span) { - return TryGetJob::JobCompleted(Err(cycle)); + // If we are single-threaded we know that we have cycle error, + // so we just turn the errror + #[cfg(not(parallel_compiler))] + return job.cycle_error(tcx, span); + + // With parallel queries we might just have to wait on some other + // thread + #[cfg(parallel_compiler)] + { + if let Err(cycle) = job.await(tcx, span) { + return TryGetJob::JobCompleted(Err(cycle)); + } } } } /// Completes the query by updating the query cache with the `result`, /// signals the waiter and forgets the JobOwner, so it won't poison the query + #[inline(always)] pub(super) fn complete(self, result: &Q::Value, dep_node_index: DepNodeIndex) { // We can move out of `self` here because we `mem::forget` it below let key = unsafe { ptr::read(&self.key) }; @@ -183,40 +192,51 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> { /// Executes a job by changing the ImplicitCtxt to point to the /// new query job while it executes. It returns the diagnostics /// captured during execution and the actual result. + #[inline(always)] pub(super) fn start<'lcx, F, R>( &self, tcx: TyCtxt<'_, 'tcx, 'lcx>, + diagnostics: Option<&Lock>>, compute: F) - -> (R, Vec) + -> R where F: for<'b> FnOnce(TyCtxt<'b, 'tcx, 'lcx>) -> R { // The TyCtxt stored in TLS has the same global interner lifetime // as `tcx`, so we use `with_related_context` to relate the 'gcx lifetimes // when accessing the ImplicitCtxt - let r = tls::with_related_context(tcx, move |current_icx| { + tls::with_related_context(tcx, move |current_icx| { // Update the ImplicitCtxt to point to our new query job let new_icx = tls::ImplicitCtxt { - tcx, + tcx: tcx.global_tcx(), query: Some(self.job.clone()), + diagnostics, layout_depth: current_icx.layout_depth, - task: current_icx.task, + task_deps: current_icx.task_deps, }; // Use the ImplicitCtxt while we execute the query tls::enter_context(&new_icx, |_| { compute(tcx) }) - }); + }) + } - // Extract the diagnostic from the job - let diagnostics = mem::replace(&mut *self.job.diagnostics.lock(), Vec::new()); +} - (r, diagnostics) - } +#[inline(always)] +fn with_diagnostics(f: F) -> (R, ThinVec) +where + F: FnOnce(Option<&Lock>>) -> R +{ + let diagnostics = Lock::new(ThinVec::new()); + let result = f(Some(&diagnostics)); + (result, diagnostics.into_inner()) } impl<'a, 'tcx, Q: QueryDescription<'tcx>> Drop for JobOwner<'a, 'tcx, Q> { + #[inline(never)] + #[cold] fn drop(&mut self) { // Poison the query so jobs waiting on it panic self.cache.borrow_mut().active.insert(self.key.clone(), QueryResult::Poisoned); @@ -241,12 +261,16 @@ pub(super) enum TryGetJob<'a, 'tcx: 'a, D: QueryDescription<'tcx> + 'a> { /// The query was already completed. /// Returns the result of the query and its dep node index /// if it succeeded or a cycle error if it failed - JobCompleted(Result<(D::Value, DepNodeIndex), CycleError<'tcx>>), + JobCompleted(Result<(D::Value, DepNodeIndex), Box>>), } impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { - pub(super) fn report_cycle(self, CycleError { usage, cycle: stack }: CycleError<'gcx>) - -> DiagnosticBuilder<'a> + #[inline(never)] + #[cold] + pub(super) fn report_cycle( + self, + box CycleError { usage, cycle: stack }: Box> + ) -> Box> { assert!(!stack.is_empty()); @@ -280,7 +304,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { &format!("cycle used when {}", query.describe(self))); } - return err + return Box::new(err) }) } @@ -311,45 +335,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { eprintln!("end of query stack"); } - /// Try to read a node index for the node dep_node. - /// A node will have an index, when it's already been marked green, or when we can mark it - /// green. This function will mark the current task as a reader of the specified node, when - /// a node index can be found for that node. - pub(super) fn try_mark_green_and_read(self, dep_node: &DepNode) -> Option { - match self.dep_graph.node_color(dep_node) { - Some(DepNodeColor::Green(dep_node_index)) => { - self.dep_graph.read_index(dep_node_index); - Some(dep_node_index) - } - Some(DepNodeColor::Red) => { - None - } - None => { - // try_mark_green (called below) will panic when full incremental - // compilation is disabled. If that's the case, we can't try to mark nodes - // as green anyway, so we can safely return None here. - if !self.dep_graph.is_fully_enabled() { - return None; - } - match self.dep_graph.try_mark_green(self.global_tcx(), &dep_node) { - Some(dep_node_index) => { - debug_assert!(self.dep_graph.is_green(&dep_node)); - self.dep_graph.read_index(dep_node_index); - Some(dep_node_index) - } - None => { - None - } - } - } - } - } - + #[inline(never)] fn try_get_with>( self, span: Span, key: Q::Key) - -> Result> + -> Result>> { debug!("ty::queries::{}::try_get_with(key={:?}, span={:?})", Q::NAME, @@ -363,13 +354,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { ) ); - self.sess.profiler(|p| p.record_query(Q::CATEGORY)); - let job = match JobOwner::try_get(self, span, &key) { TryGetJob::NotYetStarted(job) => job, TryGetJob::JobCompleted(result) => { return result.map(|(v, index)| { - self.sess.profiler(|p| p.record_query_hit(Q::CATEGORY)); self.dep_graph.read_index(index); v }) @@ -380,7 +368,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // expensive for some DepKinds. if !self.dep_graph.is_fully_enabled() { let null_dep_node = DepNode::new_no_params(::dep_graph::DepKind::Null); - return self.force_query_with_job::(key, job, null_dep_node).map(|(v, _)| v); + return Ok(self.force_query_with_job::(key, job, null_dep_node).0); } let dep_node = Q::to_dep_node(self, &key); @@ -389,20 +377,23 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { profq_msg!(self, ProfileQueriesMsg::ProviderBegin); self.sess.profiler(|p| p.start_activity(Q::CATEGORY)); - let res = job.start(self, |tcx| { - tcx.dep_graph.with_anon_task(dep_node.kind, || { - Q::compute(tcx.global_tcx(), key) + let ((result, dep_node_index), diagnostics) = with_diagnostics(|diagnostics| { + job.start(self, diagnostics, |tcx| { + tcx.dep_graph.with_anon_task(dep_node.kind, || { + Q::compute(tcx.global_tcx(), key) + }) }) }); self.sess.profiler(|p| p.end_activity(Q::CATEGORY)); profq_msg!(self, ProfileQueriesMsg::ProviderEnd); - let ((result, dep_node_index), diagnostics) = res; self.dep_graph.read_index(dep_node_index); - self.queries.on_disk_cache - .store_diagnostics_for_anon_node(dep_node_index, diagnostics); + if unlikely!(!diagnostics.is_empty()) { + self.queries.on_disk_cache + .store_diagnostics_for_anon_node(dep_node_index, diagnostics); + } job.complete(&result, dep_node_index); @@ -410,33 +401,32 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } if !dep_node.kind.is_input() { - if let Some(dep_node_index) = self.try_mark_green_and_read(&dep_node) { - profq_msg!(self, ProfileQueriesMsg::CacheHit); - self.sess.profiler(|p| p.record_query_hit(Q::CATEGORY)); - - return self.load_from_disk_and_cache_in_memory::(key, - job, - dep_node_index, - &dep_node) + if let Some((prev_dep_node_index, + dep_node_index)) = self.dep_graph.try_mark_green_and_read(self, + &dep_node) { + return Ok(self.load_from_disk_and_cache_in_memory::( + key, + job, + prev_dep_node_index, + dep_node_index, + &dep_node + )) } } - match self.force_query_with_job::(key, job, dep_node) { - Ok((result, dep_node_index)) => { - self.dep_graph.read_index(dep_node_index); - Ok(result) - } - Err(e) => Err(e) - } + let (result, dep_node_index) = self.force_query_with_job::(key, job, dep_node); + self.dep_graph.read_index(dep_node_index); + Ok(result) } fn load_from_disk_and_cache_in_memory>( self, key: Q::Key, job: JobOwner<'a, 'gcx, Q>, + prev_dep_node_index: SerializedDepNodeIndex, dep_node_index: DepNodeIndex, dep_node: &DepNode - ) -> Result> + ) -> Q::Value { // Note this function can be called concurrently from the same query // We must ensure that this is handled correctly @@ -446,10 +436,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // First we try to load the result from the on-disk cache let result = if Q::cache_on_disk(key.clone()) && self.sess.opts.debugging_opts.incremental_queries { - let prev_dep_node_index = - self.dep_graph.prev_dep_node_index_of(dep_node); - let result = Q::try_load_from_disk(self.global_tcx(), - prev_dep_node_index); + let result = Q::try_load_from_disk(self.global_tcx(), prev_dep_node_index); // We always expect to find a cached result for things that // can be forced from DepNode. @@ -464,65 +451,84 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { }; let result = if let Some(result) = result { + profq_msg!(self, ProfileQueriesMsg::CacheHit); + self.sess.profiler(|p| p.record_query_hit(Q::CATEGORY)); + result } else { // We could not load a result from the on-disk cache, so // recompute. + self.sess.profiler(|p| p.start_activity(Q::CATEGORY)); + // The diagnostics for this query have already been // promoted to the current session during // try_mark_green(), so we can ignore them here. - let (result, _) = job.start(self, |tcx| { + let result = job.start(self, None, |tcx| { // The dep-graph for this computation is already in // place tcx.dep_graph.with_ignore(|| { Q::compute(tcx, key) }) }); + + self.sess.profiler(|p| p.end_activity(Q::CATEGORY)); result }; // If -Zincremental-verify-ich is specified, re-hash results from // the cache and make sure that they have the expected fingerprint. - if self.sess.opts.debugging_opts.incremental_verify_ich { - use rustc_data_structures::stable_hasher::{StableHasher, HashStable}; - use ich::Fingerprint; + if unlikely!(self.sess.opts.debugging_opts.incremental_verify_ich) { + self.incremental_verify_ich::(&result, dep_node, dep_node_index); + } - assert!(Some(self.dep_graph.fingerprint_of(dep_node_index)) == - self.dep_graph.prev_fingerprint_of(dep_node), - "Fingerprint for green query instance not loaded \ - from cache: {:?}", dep_node); + if unlikely!(self.sess.opts.debugging_opts.query_dep_graph) { + self.dep_graph.mark_loaded_from_cache(dep_node_index, true); + } - debug!("BEGIN verify_ich({:?})", dep_node); - let mut hcx = self.create_stable_hashing_context(); - let mut hasher = StableHasher::new(); + job.complete(&result, dep_node_index); - result.hash_stable(&mut hcx, &mut hasher); + result + } - let new_hash: Fingerprint = hasher.finish(); - debug!("END verify_ich({:?})", dep_node); + #[inline(never)] + #[cold] + fn incremental_verify_ich>( + self, + result: &Q::Value, + dep_node: &DepNode, + dep_node_index: DepNodeIndex, + ) { + use rustc_data_structures::stable_hasher::{StableHasher, HashStable}; + use ich::Fingerprint; - let old_hash = self.dep_graph.fingerprint_of(dep_node_index); + assert!(Some(self.dep_graph.fingerprint_of(dep_node_index)) == + self.dep_graph.prev_fingerprint_of(dep_node), + "Fingerprint for green query instance not loaded \ + from cache: {:?}", dep_node); - assert!(new_hash == old_hash, "Found unstable fingerprints \ - for {:?}", dep_node); - } + debug!("BEGIN verify_ich({:?})", dep_node); + let mut hcx = self.create_stable_hashing_context(); + let mut hasher = StableHasher::new(); - if self.sess.opts.debugging_opts.query_dep_graph { - self.dep_graph.mark_loaded_from_cache(dep_node_index, true); - } + result.hash_stable(&mut hcx, &mut hasher); - job.complete(&result, dep_node_index); + let new_hash: Fingerprint = hasher.finish(); + debug!("END verify_ich({:?})", dep_node); - Ok(result) + let old_hash = self.dep_graph.fingerprint_of(dep_node_index); + + assert!(new_hash == old_hash, "Found unstable fingerprints \ + for {:?}", dep_node); } + #[inline(always)] fn force_query_with_job>( self, key: Q::Key, job: JobOwner<'_, 'gcx, Q>, dep_node: DepNode) - -> Result<(Q::Value, DepNodeIndex), CycleError<'gcx>> { + -> (Q::Value, DepNodeIndex) { // If the following assertion triggers, it can have two reasons: // 1. Something is wrong with DepNode creation, either here or // in DepGraph::try_mark_green() @@ -535,42 +541,41 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { key, dep_node); profq_msg!(self, ProfileQueriesMsg::ProviderBegin); - self.sess.profiler(|p| { - p.start_activity(Q::CATEGORY); - p.record_query(Q::CATEGORY); - }); - - let res = job.start(self, |tcx| { - if dep_node.kind.is_eval_always() { - tcx.dep_graph.with_eval_always_task(dep_node, - tcx, - key, - Q::compute) - } else { - tcx.dep_graph.with_task(dep_node, - tcx, - key, - Q::compute) - } + self.sess.profiler(|p| p.start_activity(Q::CATEGORY)); + + let ((result, dep_node_index), diagnostics) = with_diagnostics(|diagnostics| { + job.start(self, diagnostics, |tcx| { + if dep_node.kind.is_eval_always() { + tcx.dep_graph.with_eval_always_task(dep_node, + tcx, + key, + Q::compute) + } else { + tcx.dep_graph.with_task(dep_node, + tcx, + key, + Q::compute) + } + }) }); self.sess.profiler(|p| p.end_activity(Q::CATEGORY)); profq_msg!(self, ProfileQueriesMsg::ProviderEnd); - let ((result, dep_node_index), diagnostics) = res; - - if self.sess.opts.debugging_opts.query_dep_graph { + if unlikely!(self.sess.opts.debugging_opts.query_dep_graph) { self.dep_graph.mark_loaded_from_cache(dep_node_index, false); } if dep_node.kind != ::dep_graph::DepKind::Null { - self.queries.on_disk_cache - .store_diagnostics(dep_node_index, diagnostics); + if unlikely!(!diagnostics.is_empty()) { + self.queries.on_disk_cache + .store_diagnostics(dep_node_index, diagnostics); + } } job.complete(&result, dep_node_index); - Ok((result, dep_node_index)) + (result, dep_node_index) } /// Ensure that either this query has all green inputs or been executed. @@ -586,7 +591,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // Ensuring an "input" or anonymous query makes no sense assert!(!dep_node.kind.is_anon()); assert!(!dep_node.kind.is_input()); - if self.try_mark_green_and_read(&dep_node).is_none() { + if self.dep_graph.try_mark_green_and_read(self, &dep_node).is_none() { // A None return from `try_mark_green_and_read` means that this is either // a new dep node or that the dep node has already been marked red. // Either way, we can't call `dep_graph.read()` as we don't have the @@ -594,14 +599,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // this introduces should be negligible as we'll immediately hit the // in-memory cache, or another query down the line will. - self.sess.profiler(|p| { - p.start_activity(Q::CATEGORY); - p.record_query(Q::CATEGORY); - }); - let _ = self.get_query::(DUMMY_SP, key); - - self.sess.profiler(|p| p.end_activity(Q::CATEGORY)); + } else { + profq_msg!(self, ProfileQueriesMsg::CacheHit); + self.sess.profiler(|p| p.record_query_hit(Q::CATEGORY)); } } @@ -611,37 +612,58 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { key: Q::Key, span: Span, dep_node: DepNode - ) -> Result<(Q::Value, DepNodeIndex), CycleError<'gcx>> { + ) { + profq_msg!( + self, + ProfileQueriesMsg::QueryBegin(span.data(), profq_query_msg!(Q::NAME, self, key)) + ); + // We may be concurrently trying both execute and force a query // Ensure that only one of them runs the query let job = match JobOwner::try_get(self, span, &key) { TryGetJob::NotYetStarted(job) => job, - TryGetJob::JobCompleted(result) => return result, + TryGetJob::JobCompleted(result) => { + if let Err(e) = result { + self.report_cycle(e).emit(); + } + return + } }; - self.force_query_with_job::(key, job, dep_node) + self.force_query_with_job::(key, job, dep_node); } pub(super) fn try_get_query>( self, span: Span, key: Q::Key, - ) -> Result> { + ) -> Result>> { match self.try_get_with::(span, key) { Ok(e) => Ok(e), Err(e) => Err(self.report_cycle(e)), } } + // FIXME: Try uninlining this + #[inline(always)] pub(super) fn get_query>( self, span: Span, key: Q::Key, ) -> Q::Value { - self.try_get_query::(span, key).unwrap_or_else(|mut e| { - e.emit(); - Q::handle_cycle_error(self) + self.try_get_with::(span, key).unwrap_or_else(|e| { + self.emit_error::(e) }) } + + #[inline(never)] + #[cold] + fn emit_error>( + self, + e: Box>, + ) -> Q::Value { + self.report_cycle(e).emit(); + Q::handle_cycle_error(self) + } } macro_rules! handle_cycle_error { @@ -673,7 +695,7 @@ macro_rules! define_queries_inner { [$($modifiers:tt)*] fn $name:ident: $node:ident($K:ty) -> $V:ty,)*) => { use std::mem; - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] use ty::query::job::QueryResult; use rustc_data_structures::sync::Lock; use { @@ -703,7 +725,18 @@ macro_rules! define_queries_inner { } } - #[cfg(parallel_queries)] + pub fn record_computed_queries(&self, sess: &Session) { + sess.profiler(|p| { + $( + p.record_computed_queries( + as QueryConfig<'_>>::CATEGORY, + self.$name.lock().results.len() + ); + )* + }); + } + + #[cfg(parallel_compiler)] pub fn collect_active_jobs(&self) -> Vec>> { let mut jobs = Vec::new(); @@ -723,6 +756,101 @@ macro_rules! define_queries_inner { jobs } + + pub fn print_stats(&self) { + let mut queries = Vec::new(); + + #[derive(Clone)] + struct QueryStats { + name: &'static str, + cache_hits: usize, + key_size: usize, + key_type: &'static str, + value_size: usize, + value_type: &'static str, + entry_count: usize, + } + + fn stats<'tcx, Q: QueryConfig<'tcx>>( + name: &'static str, + map: &QueryCache<'tcx, Q> + ) -> QueryStats { + QueryStats { + name, + #[cfg(debug_assertions)] + cache_hits: map.cache_hits, + #[cfg(not(debug_assertions))] + cache_hits: 0, + key_size: mem::size_of::(), + key_type: unsafe { type_name::() }, + value_size: mem::size_of::(), + value_type: unsafe { type_name::() }, + entry_count: map.results.len(), + } + } + + $( + queries.push(stats::>( + stringify!($name), + &*self.$name.lock() + )); + )* + + if cfg!(debug_assertions) { + let hits: usize = queries.iter().map(|s| s.cache_hits).sum(); + let results: usize = queries.iter().map(|s| s.entry_count).sum(); + println!("\nQuery cache hit rate: {}", hits as f64 / (hits + results) as f64); + } + + let mut query_key_sizes = queries.clone(); + query_key_sizes.sort_by_key(|q| q.key_size); + println!("\nLarge query keys:"); + for q in query_key_sizes.iter().rev() + .filter(|q| q.key_size > 8) { + println!( + " {} - {} x {} - {}", + q.name, + q.key_size, + q.entry_count, + q.key_type + ); + } + + let mut query_value_sizes = queries.clone(); + query_value_sizes.sort_by_key(|q| q.value_size); + println!("\nLarge query values:"); + for q in query_value_sizes.iter().rev() + .filter(|q| q.value_size > 8) { + println!( + " {} - {} x {} - {}", + q.name, + q.value_size, + q.entry_count, + q.value_type + ); + } + + if cfg!(debug_assertions) { + let mut query_cache_hits = queries.clone(); + query_cache_hits.sort_by_key(|q| q.cache_hits); + println!("\nQuery cache hits:"); + for q in query_cache_hits.iter().rev() { + println!( + " {} - {} ({}%)", + q.name, + q.cache_hits, + q.cache_hits as f64 / (q.cache_hits + q.entry_count) as f64 + ); + } + } + + let mut query_value_count = queries.clone(); + query_value_count.sort_by_key(|q| q.entry_count); + println!("\nQuery value count:"); + for q in query_value_count.iter().rev() { + println!(" {} - {}", q.name, q.entry_count); + } + } } #[allow(nonstandard_style)] @@ -806,15 +934,18 @@ macro_rules! define_queries_inner { } impl<$tcx> QueryAccessors<$tcx> for queries::$name<$tcx> { + #[inline(always)] fn query(key: Self::Key) -> Query<'tcx> { Query::$name(key) } + #[inline(always)] fn query_cache<'a>(tcx: TyCtxt<'a, $tcx, '_>) -> &'a Lock> { &tcx.queries.$name } #[allow(unused)] + #[inline(always)] fn to_dep_node(tcx: TyCtxt<'_, $tcx, '_>, key: &Self::Key) -> DepNode { use dep_graph::DepConstructor::*; @@ -828,7 +959,7 @@ macro_rules! define_queries_inner { // HACK(eddyb) it's possible crates may be loaded after // the query engine is created, and because crate loading // is not yet integrated with the query engine, such crates - // would be be missing appropriate entries in `providers`. + // would be missing appropriate entries in `providers`. .unwrap_or(&tcx.queries.fallback_extern_providers) .$name; provider(tcx.global_tcx(), key) @@ -861,6 +992,7 @@ macro_rules! define_queries_inner { impl<'a, 'gcx, 'tcx> Deref for TyCtxtAt<'a, 'gcx, 'tcx> { type Target = TyCtxt<'a, 'gcx, 'tcx>; + #[inline(always)] fn deref(&self) -> &Self::Target { &self.tcx } @@ -869,6 +1001,7 @@ macro_rules! define_queries_inner { impl<'a, $tcx, 'lcx> TyCtxt<'a, $tcx, 'lcx> { /// Return a transparent wrapper for `TyCtxt` which uses /// `span` as the location of queries performed through it. + #[inline(always)] pub fn at(self, span: Span) -> TyCtxtAt<'a, $tcx, 'lcx> { TyCtxtAt { tcx: self, @@ -877,6 +1010,7 @@ macro_rules! define_queries_inner { } $($(#[$attr])* + #[inline(always)] pub fn $name(self, key: $K) -> $V { self.at(DUMMY_SP).$name(key) })* @@ -884,6 +1018,7 @@ macro_rules! define_queries_inner { impl<'a, $tcx, 'lcx> TyCtxtAt<'a, $tcx, 'lcx> { $($(#[$attr])* + #[inline(always)] pub fn $name(self, key: $K) -> $V { self.tcx.get_query::>(self.span, key) })* @@ -904,7 +1039,7 @@ macro_rules! define_queries_inner { macro_rules! define_queries_struct { (tcx: $tcx:tt, input: ($(([$($modifiers:tt)*] [$($attr:tt)*] [$name:ident]))*)) => { - pub(crate) struct Queries<$tcx> { + pub struct Queries<$tcx> { /// This provides access to the incr. comp. on-disk cache for query results. /// Do not access this directly. It is only meant to be used by /// `DepGraph::try_mark_green()` and the query infrastructure. @@ -1023,20 +1158,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, macro_rules! force { ($query:ident, $key:expr) => { { - use $crate::util::common::{ProfileQueriesMsg, profq_msg}; - - profq_msg!(tcx, - ProfileQueriesMsg::QueryBegin( - DUMMY_SP.data(), - profq_query_msg!(::ty::query::queries::$query::NAME, tcx, $key), - ) - ); - - if let Err(e) = tcx.force_query::<::ty::query::queries::$query<'_>>( - $key, DUMMY_SP, *dep_node - ) { - tcx.report_cycle(e).emit(); - } + tcx.force_query::<::ty::query::queries::$query<'_>>($key, DUMMY_SP, *dep_node); } } }; @@ -1080,6 +1202,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, DepKind::ImpliedOutlivesBounds | DepKind::DropckOutlives | DepKind::EvaluateObligation | + DepKind::EvaluateGoal | DepKind::TypeOpAscribeUserType | DepKind::TypeOpEq | DepKind::TypeOpSubtype | @@ -1089,6 +1212,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, DepKind::TypeOpNormalizePolyFnSig | DepKind::TypeOpNormalizeFnSig | DepKind::SubstituteNormalizeAndTestPredicates | + DepKind::MethodAutoderefSteps | DepKind::InstanceDefSizeEstimate | DepKind::ProgramClausesForEnv | @@ -1120,6 +1244,14 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, DepKind::MirBorrowCheck => { force!(mir_borrowck, def_id!()); } DepKind::UnsafetyCheckResult => { force!(unsafety_check_result, def_id!()); } DepKind::UnsafeDeriveOnReprPacked => { force!(unsafe_derive_on_repr_packed, def_id!()); } + DepKind::CheckModAttrs => { force!(check_mod_attrs, def_id!()); } + DepKind::CheckModLoops => { force!(check_mod_loops, def_id!()); } + DepKind::CheckModUnstableApiUsage => { force!(check_mod_unstable_api_usage, def_id!()); } + DepKind::CheckModItemTypes => { force!(check_mod_item_types, def_id!()); } + DepKind::CheckModPrivacy => { force!(check_mod_privacy, def_id!()); } + DepKind::CheckModIntrinsics => { force!(check_mod_intrinsics, def_id!()); } + DepKind::CheckModLiveness => { force!(check_mod_liveness, def_id!()); } + DepKind::CollectModItemTypes => { force!(collect_mod_item_types, def_id!()); } DepKind::Reachability => { force!(reachable_set, LOCAL_CRATE); } DepKind::MirKeys => { force!(mir_keys, LOCAL_CRATE); } DepKind::CrateVariances => { force!(crate_variances, LOCAL_CRATE); } @@ -1136,6 +1268,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, DepKind::AdtDefOfItem => { force!(adt_def, def_id!()); } DepKind::ImplTraitRef => { force!(impl_trait_ref, def_id!()); } DepKind::ImplPolarity => { force!(impl_polarity, def_id!()); } + DepKind::Issue33140SelfTy => { force!(issue33140_self_ty, def_id!()); } DepKind::FnSignature => { force!(fn_sig, def_id!()); } DepKind::CoerceUnsizedInfo => { force!(coerce_unsized_info, def_id!()); } DepKind::ItemVariances => { force!(variances_of, def_id!()); } @@ -1199,8 +1332,9 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, DepKind::CheckImplItemWellFormed => { force!(check_impl_item_well_formed, def_id!()); } DepKind::ReachableNonGenerics => { force!(reachable_non_generics, krate!()); } DepKind::NativeLibraries => { force!(native_libraries, krate!()); } + DepKind::EntryFn => { force!(entry_fn, krate!()); } DepKind::PluginRegistrarFn => { force!(plugin_registrar_fn, krate!()); } - DepKind::DeriveRegistrarFn => { force!(derive_registrar_fn, krate!()); } + DepKind::ProcMacroDeclsStatic => { force!(proc_macro_decls_static, krate!()); } DepKind::CrateDisambiguator => { force!(crate_disambiguator, krate!()); } DepKind::CrateHash => { force!(crate_hash, krate!()); } DepKind::OriginalCrateName => { force!(original_crate_name, krate!()); } @@ -1250,6 +1384,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, DepKind::MaybeUnusedTraitImport => { force!(maybe_unused_trait_import, def_id!()); } + DepKind::NamesImportedByGlobUse => { force!(names_imported_by_glob_use, def_id!()); } DepKind::MaybeUnusedExternCrates => { force!(maybe_unused_extern_crates, LOCAL_CRATE); } DepKind::StabilityIndex => { force!(stability_index, LOCAL_CRATE); } DepKind::AllTraits => { force!(all_traits, LOCAL_CRATE); } @@ -1275,6 +1410,9 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, DepKind::UpstreamMonomorphizationsFor => { force!(upstream_monomorphizations_for, def_id!()); } + DepKind::BackendOptimizationLevel => { + force!(backend_optimization_level, krate!()); + } } true diff --git a/src/librustc/ty/query/values.rs b/src/librustc/ty/query/values.rs index d3d06248792..3f84f1bc789 100644 --- a/src/librustc/ty/query/values.rs +++ b/src/librustc/ty/query/values.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ty::{self, Ty, TyCtxt}; use syntax::symbol::Symbol; diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 082c1bd5fea..a16d6fea74c 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -1,20 +1,10 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Generalized type relating mechanism. A type relation R relates a -//! pair of values (A, B). A and B are usually types or regions but -//! can be other things. Examples of type relations are subtyping, -//! type equality, etc. +//! Generalized type relating mechanism. +//! +//! A type relation `R` relates a pair of values `(A, B)`. `A and B` are usually +//! types or regions but can be other things. Examples of type relations are +//! subtyping, type equality, etc. use hir::def_id::DefId; -use mir::interpret::ConstValue; use ty::subst::{Kind, UnpackedKind, Substs}; use ty::{self, Ty, TyCtxt, TypeFoldable}; use ty::error::{ExpectedFound, TypeError}; @@ -25,6 +15,7 @@ use std::rc::Rc; use std::iter; use rustc_target::spec::abi; use hir as ast; +use traits; pub type RelateResult<'tcx, T> = Result>; @@ -371,6 +362,10 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, bug!("var types encountered in super_relate_tys") } + (ty::Bound(..), _) | (_, ty::Bound(..)) => { + bug!("bound types encountered in super_relate_tys") + } + (&ty::Error, _) | (_, &ty::Error) => { Ok(tcx.types.err) @@ -394,6 +389,10 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, Ok(a) } + (ty::Placeholder(p1), ty::Placeholder(p2)) if p1 == p2 => { + Ok(a) + } + (&ty::Adt(a_def, a_substs), &ty::Adt(b_def, b_substs)) if a_def == b_def => { @@ -469,14 +468,9 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, (&ty::Array(a_t, sz_a), &ty::Array(b_t, sz_b)) => { let t = relation.relate(&a_t, &b_t)?; - assert_eq!(sz_a.ty, tcx.types.usize); - assert_eq!(sz_b.ty, tcx.types.usize); - let to_u64 = |x: &'tcx ty::Const<'tcx>| -> Result { - if let Some(s) = x.assert_usize(tcx) { - return Ok(s); - } - match x.val { - ConstValue::Unevaluated(def_id, substs) => { + let to_u64 = |x: ty::LazyConst<'tcx>| -> Result { + match x { + ty::LazyConst::Unevaluated(def_id, substs) => { // FIXME(eddyb) get the right param_env. let param_env = ty::ParamEnv::empty(); if let Some(substs) = tcx.lift_to_global(&substs) { @@ -502,14 +496,14 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, "array length could not be evaluated"); Err(ErrorReported) } - _ => { + ty::LazyConst::Evaluated(c) => c.assert_usize(tcx).ok_or_else(|| { tcx.sess.delay_span_bug(DUMMY_SP, - &format!("arrays should not have {:?} as length", x)); - Err(ErrorReported) - } + "array length could not be evaluated"); + ErrorReported + }) } }; - match (to_u64(sz_a), to_u64(sz_b)) { + match (to_u64(*sz_a), to_u64(*sz_b)) { (Ok(sz_a_u64), Ok(sz_b_u64)) => { if sz_a_u64 == sz_b_u64 { Ok(tcx.mk_ty(ty::Array(t, sz_a))) @@ -556,8 +550,13 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R, Ok(tcx.mk_fn_ptr(fty)) } - (&ty::Projection(ref a_data), &ty::Projection(ref b_data)) => - { + (ty::UnnormalizedProjection(a_data), ty::UnnormalizedProjection(b_data)) => { + let projection_ty = relation.relate(a_data, b_data)?; + Ok(tcx.mk_ty(ty::UnnormalizedProjection(projection_ty))) + } + + // these two are already handled downstream in case of lazy normalization + (ty::Projection(a_data), ty::Projection(b_data)) => { let projection_ty = relation.relate(a_data, b_data)?; Ok(tcx.mk_projection(projection_ty.item_def_id, projection_ty.substs)) } @@ -710,6 +709,283 @@ impl<'tcx> Relate<'tcx> for Kind<'tcx> { } } +impl<'tcx> Relate<'tcx> for ty::TraitPredicate<'tcx> { + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ty::TraitPredicate<'tcx>, + b: &ty::TraitPredicate<'tcx> + ) -> RelateResult<'tcx, ty::TraitPredicate<'tcx>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + Ok(ty::TraitPredicate { + trait_ref: relation.relate(&a.trait_ref, &b.trait_ref)?, + }) + } +} + +impl<'tcx> Relate<'tcx> for ty::ProjectionPredicate<'tcx> { + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &ty::ProjectionPredicate<'tcx>, + b: &ty::ProjectionPredicate<'tcx>, + ) -> RelateResult<'tcx, ty::ProjectionPredicate<'tcx>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + Ok(ty::ProjectionPredicate { + projection_ty: relation.relate(&a.projection_ty, &b.projection_ty)?, + ty: relation.relate(&a.ty, &b.ty)?, + }) + } +} + +impl<'tcx> Relate<'tcx> for traits::WhereClause<'tcx> { + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &traits::WhereClause<'tcx>, + b: &traits::WhereClause<'tcx> + ) -> RelateResult<'tcx, traits::WhereClause<'tcx>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + use traits::WhereClause::*; + match (a, b) { + (Implemented(a_pred), Implemented(b_pred)) => { + Ok(Implemented(relation.relate(a_pred, b_pred)?)) + } + + (ProjectionEq(a_pred), ProjectionEq(b_pred)) => { + Ok(ProjectionEq(relation.relate(a_pred, b_pred)?)) + } + + (RegionOutlives(a_pred), RegionOutlives(b_pred)) => { + Ok(RegionOutlives(ty::OutlivesPredicate( + relation.relate(&a_pred.0, &b_pred.0)?, + relation.relate(&a_pred.1, &b_pred.1)?, + ))) + } + + (TypeOutlives(a_pred), TypeOutlives(b_pred)) => { + Ok(TypeOutlives(ty::OutlivesPredicate( + relation.relate(&a_pred.0, &b_pred.0)?, + relation.relate(&a_pred.1, &b_pred.1)?, + ))) + } + + _ => Err(TypeError::Mismatch), + } + } +} + +impl<'tcx> Relate<'tcx> for traits::WellFormed<'tcx> { + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &traits::WellFormed<'tcx>, + b: &traits::WellFormed<'tcx> + ) -> RelateResult<'tcx, traits::WellFormed<'tcx>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + use traits::WellFormed::*; + match (a, b) { + (Trait(a_pred), Trait(b_pred)) => Ok(Trait(relation.relate(a_pred, b_pred)?)), + (Ty(a_ty), Ty(b_ty)) => Ok(Ty(relation.relate(a_ty, b_ty)?)), + _ => Err(TypeError::Mismatch), + } + } +} + +impl<'tcx> Relate<'tcx> for traits::FromEnv<'tcx> { + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &traits::FromEnv<'tcx>, + b: &traits::FromEnv<'tcx> + ) -> RelateResult<'tcx, traits::FromEnv<'tcx>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + use traits::FromEnv::*; + match (a, b) { + (Trait(a_pred), Trait(b_pred)) => Ok(Trait(relation.relate(a_pred, b_pred)?)), + (Ty(a_ty), Ty(b_ty)) => Ok(Ty(relation.relate(a_ty, b_ty)?)), + _ => Err(TypeError::Mismatch), + } + } +} + +impl<'tcx> Relate<'tcx> for traits::DomainGoal<'tcx> { + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &traits::DomainGoal<'tcx>, + b: &traits::DomainGoal<'tcx> + ) -> RelateResult<'tcx, traits::DomainGoal<'tcx>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + use traits::DomainGoal::*; + match (a, b) { + (Holds(a_wc), Holds(b_wc)) => Ok(Holds(relation.relate(a_wc, b_wc)?)), + (WellFormed(a_wf), WellFormed(b_wf)) => Ok(WellFormed(relation.relate(a_wf, b_wf)?)), + (FromEnv(a_fe), FromEnv(b_fe)) => Ok(FromEnv(relation.relate(a_fe, b_fe)?)), + + (Normalize(a_pred), Normalize(b_pred)) => { + Ok(Normalize(relation.relate(a_pred, b_pred)?)) + } + + _ => Err(TypeError::Mismatch), + } + } +} + +impl<'tcx> Relate<'tcx> for traits::Goal<'tcx> { + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &traits::Goal<'tcx>, + b: &traits::Goal<'tcx> + ) -> RelateResult<'tcx, traits::Goal<'tcx>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + use traits::GoalKind::*; + match (a, b) { + (Implies(a_clauses, a_goal), Implies(b_clauses, b_goal)) => { + let clauses = relation.relate(a_clauses, b_clauses)?; + let goal = relation.relate(a_goal, b_goal)?; + Ok(relation.tcx().mk_goal(Implies(clauses, goal))) + } + + (And(a_left, a_right), And(b_left, b_right)) => { + let left = relation.relate(a_left, b_left)?; + let right = relation.relate(a_right, b_right)?; + Ok(relation.tcx().mk_goal(And(left, right))) + } + + (Not(a_goal), Not(b_goal)) => { + let goal = relation.relate(a_goal, b_goal)?; + Ok(relation.tcx().mk_goal(Not(goal))) + } + + (DomainGoal(a_goal), DomainGoal(b_goal)) => { + let goal = relation.relate(a_goal, b_goal)?; + Ok(relation.tcx().mk_goal(DomainGoal(goal))) + } + + (Quantified(a_qkind, a_goal), Quantified(b_qkind, b_goal)) + if a_qkind == b_qkind => + { + let goal = relation.relate(a_goal, b_goal)?; + Ok(relation.tcx().mk_goal(Quantified(*a_qkind, goal))) + } + + (CannotProve, CannotProve) => Ok(*a), + + _ => Err(TypeError::Mismatch), + } + } +} + +impl<'tcx> Relate<'tcx> for traits::Goals<'tcx> { + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &traits::Goals<'tcx>, + b: &traits::Goals<'tcx> + ) -> RelateResult<'tcx, traits::Goals<'tcx>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + if a.len() != b.len() { + return Err(TypeError::Mismatch); + } + + let tcx = relation.tcx(); + let goals = a.iter().zip(b.iter()).map(|(a, b)| relation.relate(a, b)); + Ok(tcx.mk_goals(goals)?) + } +} + +impl<'tcx> Relate<'tcx> for traits::Clause<'tcx> { + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &traits::Clause<'tcx>, + b: &traits::Clause<'tcx> + ) -> RelateResult<'tcx, traits::Clause<'tcx>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + use traits::Clause::*; + match (a, b) { + (Implies(a_clause), Implies(b_clause)) => { + let clause = relation.relate(a_clause, b_clause)?; + Ok(Implies(clause)) + } + + (ForAll(a_clause), ForAll(b_clause)) => { + let clause = relation.relate(a_clause, b_clause)?; + Ok(ForAll(clause)) + } + + _ => Err(TypeError::Mismatch), + } + } +} + +impl<'tcx> Relate<'tcx> for traits::Clauses<'tcx> { + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &traits::Clauses<'tcx>, + b: &traits::Clauses<'tcx> + ) -> RelateResult<'tcx, traits::Clauses<'tcx>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + if a.len() != b.len() { + return Err(TypeError::Mismatch); + } + + let tcx = relation.tcx(); + let clauses = a.iter().zip(b.iter()).map(|(a, b)| relation.relate(a, b)); + Ok(tcx.mk_clauses(clauses)?) + } +} + +impl<'tcx> Relate<'tcx> for traits::ProgramClause<'tcx> { + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &traits::ProgramClause<'tcx>, + b: &traits::ProgramClause<'tcx> + ) -> RelateResult<'tcx, traits::ProgramClause<'tcx>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + Ok(traits::ProgramClause { + goal: relation.relate(&a.goal, &b.goal)?, + hypotheses: relation.relate(&a.hypotheses, &b.hypotheses)?, + category: traits::ProgramClauseCategory::Other, + }) + } +} + +impl<'tcx> Relate<'tcx> for traits::Environment<'tcx> { + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &traits::Environment<'tcx>, + b: &traits::Environment<'tcx> + ) -> RelateResult<'tcx, traits::Environment<'tcx>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + Ok(traits::Environment { + clauses: relation.relate(&a.clauses, &b.clauses)?, + }) + } +} + +impl<'tcx, G> Relate<'tcx> for traits::InEnvironment<'tcx, G> + where G: Relate<'tcx> +{ + fn relate<'a, 'gcx, R>( + relation: &mut R, + a: &traits::InEnvironment<'tcx, G>, + b: &traits::InEnvironment<'tcx, G> + ) -> RelateResult<'tcx, traits::InEnvironment<'tcx, G>> + where R: TypeRelation<'a, 'gcx, 'tcx>, 'gcx: 'tcx, 'tcx: 'a + { + Ok(traits::InEnvironment { + environment: relation.relate(&a.environment, &b.environment)?, + goal: relation.relate(&a.goal, &b.goal)?, + }) + } +} + /////////////////////////////////////////////////////////////////////////// // Error handling diff --git a/src/librustc/ty/steal.rs b/src/librustc/ty/steal.rs index fc3353e339b..336a4c3bf22 100644 --- a/src/librustc/ty/steal.rs +++ b/src/librustc/ty/steal.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::sync::{RwLock, ReadGuard, MappedReadGuard}; /// The `Steal` struct is intended to used as the value for a query. diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index e92f92dce63..28f5a65374d 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains implements of the `Lift` and `TypeFoldable` //! traits for various types in the Rust compiler. Most are written by //! hand, though we've recently added some macros (e.g., @@ -35,6 +25,7 @@ CloneTypeFoldableAndLiftImpls! { usize, ::ty::layout::VariantIdx, u64, + String, ::middle::region::Scope, ::syntax::ast::FloatTy, ::syntax::ast::NodeId, @@ -285,6 +276,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ParamEnv<'a> { ty::ParamEnv { reveal: self.reveal, caller_bounds, + def_id: self.def_id, } }) } @@ -442,12 +434,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> { RegionsDoesNotOutlive(a, b) => { return tcx.lift(&(a, b)).map(|(a, b)| RegionsDoesNotOutlive(a, b)) } - RegionsInsufficientlyPolymorphic(a, b) => { - return tcx.lift(&b).map(|b| RegionsInsufficientlyPolymorphic(a, b)) - } - RegionsOverlyPolymorphic(a, b) => { - return tcx.lift(&b).map(|b| RegionsOverlyPolymorphic(a, b)) - } + RegionsPlaceholderMismatch => RegionsPlaceholderMismatch, IntMismatch(x) => IntMismatch(x), FloatMismatch(x) => FloatMismatch(x), Traits(x) => Traits(x), @@ -499,6 +486,26 @@ BraceStructLiftImpl! { } } +BraceStructLiftImpl! { + impl<'a, 'tcx> Lift<'tcx> for ty::Const<'a> { + type Lifted = ty::Const<'tcx>; + val, ty + } +} + +impl<'a, 'tcx> Lift<'tcx> for ConstValue<'a> { + type Lifted = ConstValue<'tcx>; + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option { + match *self { + ConstValue::Scalar(x) => Some(ConstValue::Scalar(x)), + ConstValue::Slice(x, y) => Some(ConstValue::Slice(x, y)), + ConstValue::ByRef(x, alloc, z) => Some(ConstValue::ByRef( + x, alloc.lift_to_tcx(tcx)?, z, + )), + } + } +} + /////////////////////////////////////////////////////////////////////////// // TypeFoldable implementations. // @@ -598,7 +605,7 @@ impl<'tcx, T:TypeFoldable<'tcx>> TypeFoldable<'tcx> for ty::Binder { } BraceStructTypeFoldableImpl! { - impl<'tcx> TypeFoldable<'tcx> for ty::ParamEnv<'tcx> { reveal, caller_bounds } + impl<'tcx> TypeFoldable<'tcx> for ty::ParamEnv<'tcx> { reveal, caller_bounds, def_id } } impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List> { @@ -746,6 +753,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> { ty::Infer(_) | ty::Param(..) | ty::Bound(..) | + ty::Placeholder(..) | ty::Never | ty::Foreign(..) => return self }; @@ -792,6 +800,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> { ty::Error | ty::Infer(_) | ty::Bound(..) | + ty::Placeholder(..) | ty::Param(..) | ty::Never | ty::Foreign(..) => false, @@ -1012,8 +1021,7 @@ EnumTypeFoldableImpl! { (ty::error::TypeError::FixedArraySize)(x), (ty::error::TypeError::ArgCount), (ty::error::TypeError::RegionsDoesNotOutlive)(a, b), - (ty::error::TypeError::RegionsInsufficientlyPolymorphic)(a, b), - (ty::error::TypeError::RegionsOverlyPolymorphic)(a, b), + (ty::error::TypeError::RegionsPlaceholderMismatch), (ty::error::TypeError::IntMismatch)(x), (ty::error::TypeError::FloatMismatch)(x), (ty::error::TypeError::Traits)(x), @@ -1026,47 +1034,54 @@ EnumTypeFoldableImpl! { } } -impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> { +impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::LazyConst<'tcx> { fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self { - match *self { - ConstValue::Scalar(v) => ConstValue::Scalar(v), - ConstValue::ScalarPair(a, b) => ConstValue::ScalarPair(a, b), - ConstValue::ByRef(id, alloc, offset) => ConstValue::ByRef(id, alloc, offset), - ConstValue::Unevaluated(def_id, substs) => { - ConstValue::Unevaluated(def_id, substs.fold_with(folder)) + let new = match self { + ty::LazyConst::Evaluated(v) => ty::LazyConst::Evaluated(v.fold_with(folder)), + ty::LazyConst::Unevaluated(def_id, substs) => { + ty::LazyConst::Unevaluated(*def_id, substs.fold_with(folder)) } - } + }; + folder.tcx().intern_lazy_const(new) + } + + fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self { + folder.fold_const(*self) } fn super_visit_with>(&self, visitor: &mut V) -> bool { match *self { - ConstValue::Scalar(_) | - ConstValue::ScalarPair(_, _) | - ConstValue::ByRef(_, _, _) => false, - ConstValue::Unevaluated(_, substs) => substs.visit_with(visitor), + ty::LazyConst::Evaluated(c) => c.visit_with(visitor), + ty::LazyConst::Unevaluated(_, substs) => substs.visit_with(visitor), } } + + fn visit_with>(&self, visitor: &mut V) -> bool { + visitor.visit_const(self) + } } -impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::Const<'tcx> { +impl<'tcx> TypeFoldable<'tcx> for ty::Const<'tcx> { fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self { let ty = self.ty.fold_with(folder); let val = self.val.fold_with(folder); - folder.tcx().mk_const(ty::Const { + ty::Const { ty, val - }) - } - - fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Self { - folder.fold_const(*self) + } } fn super_visit_with>(&self, visitor: &mut V) -> bool { self.ty.visit_with(visitor) || self.val.visit_with(visitor) } +} - fn visit_with>(&self, visitor: &mut V) -> bool { - visitor.visit_const(self) +impl<'tcx> TypeFoldable<'tcx> for ConstValue<'tcx> { + fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, _folder: &mut F) -> Self { + *self + } + + fn super_visit_with>(&self, _visitor: &mut V) -> bool { + false } } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index f5e4eabc2c9..d9e70f2bbe6 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -1,15 +1,6 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! This module contains TyKind and its major components +//! This module contains `TyKind` and its major components. +use hir; use hir::def_id::DefId; use infer::canonical::Canonical; use mir::interpret::ConstValue; @@ -30,9 +21,6 @@ use syntax::ast::{self, Ident}; use syntax::symbol::{keywords, InternedString}; use serialize; - -use hir; - use self::InferTy::*; use self::TyKind::*; @@ -91,7 +79,7 @@ impl BoundRegion { } } -/// N.B., If you change this, you'll probably want to change the corresponding +/// N.B., if you change this, you'll probably want to change the corresponding /// AST structure in `libsyntax/ast.rs` as well. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] pub enum TyKind<'tcx> { @@ -125,7 +113,7 @@ pub enum TyKind<'tcx> { Str, /// An array with the given length. Written as `[T; n]`. - Array(Ty<'tcx>, &'tcx ty::Const<'tcx>), + Array(Ty<'tcx>, &'tcx ty::LazyConst<'tcx>), /// The pointee of an array slice. Written as `[T]`. Slice(Ty<'tcx>), @@ -201,7 +189,10 @@ pub enum TyKind<'tcx> { Param(ParamTy), /// Bound type variable, used only when preparing a trait query. - Bound(BoundTy), + Bound(ty::DebruijnIndex, BoundTy), + + /// A placeholder type - universally quantified higher-ranked type. + Placeholder(ty::PlaceholderType), /// A type variable used during type checking. Infer(InferTy), @@ -528,11 +519,11 @@ impl<'tcx> UpvarSubsts<'tcx> { #[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Ord, Eq, Hash, RustcEncodable, RustcDecodable)] pub enum ExistentialPredicate<'tcx> { - /// e.g. Iterator + /// e.g., Iterator Trait(ExistentialTraitRef<'tcx>), - /// e.g. Iterator::Item = T + /// e.g., Iterator::Item = T Projection(ExistentialProjection<'tcx>), - /// e.g. Send + /// e.g., Send AutoTrait(DefId), } @@ -578,13 +569,42 @@ impl<'a, 'gcx, 'tcx> Binder> { impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List> {} impl<'tcx> List> { - pub fn principal(&self) -> ExistentialTraitRef<'tcx> { + /// Returns the "principal def id" of this set of existential predicates. + /// + /// A Rust trait object type consists (in addition to a lifetime bound) + /// of a set of trait bounds, which are separated into any number + /// of auto-trait bounds, and at most 1 non-auto-trait bound. The + /// non-auto-trait bound is called the "principal" of the trait + /// object. + /// + /// Only the principal can have methods or type parameters (because + /// auto traits can have neither of them). This is important, because + /// it means the auto traits can be treated as an unordered set (methods + /// would force an order for the vtable, while relating traits with + /// type parameters without knowing the order to relate them in is + /// a rather non-trivial task). + /// + /// For example, in the trait object `dyn fmt::Debug + Sync`, the + /// principal bound is `Some(fmt::Debug)`, while the auto-trait bounds + /// are the set `{Sync}`. + /// + /// It is also possible to have a "trivial" trait object that + /// consists only of auto traits, with no principal - for example, + /// `dyn Send + Sync`. In that case, the set of auto-trait bounds + /// is `{Send, Sync}`, while there is no principal. These trait objects + /// have a "trivial" vtable consisting of just the size, alignment, + /// and destructor. + pub fn principal(&self) -> Option> { match self[0] { - ExistentialPredicate::Trait(tr) => tr, - other => bug!("first predicate is {:?}", other), + ExistentialPredicate::Trait(tr) => Some(tr), + _ => None } } + pub fn principal_def_id(&self) -> Option { + self.principal().map(|d| d.def_id) + } + #[inline] pub fn projection_bounds<'a>(&'a self) -> impl Iterator> + 'a { @@ -608,8 +628,12 @@ impl<'tcx> List> { } impl<'tcx> Binder<&'tcx List>> { - pub fn principal(&self) -> PolyExistentialTraitRef<'tcx> { - Binder::bind(self.skip_binder().principal()) + pub fn principal(&self) -> Option>> { + self.skip_binder().principal().map(Binder::bind) + } + + pub fn principal_def_id(&self) -> Option { + self.skip_binder().principal_def_id() } #[inline] @@ -664,6 +688,7 @@ impl<'tcx> TraitRef<'tcx> { } } + #[inline] pub fn self_ty(&self) -> Ty<'tcx> { self.substs.type_at(0) } @@ -780,7 +805,7 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> { /// Binder`). Note that when we instantiate, /// erase, or otherwise "discharge" these bound vars, we change the /// type from `Binder` to just `T` (see -/// e.g. `liberate_late_bound_regions`). +/// e.g., `liberate_late_bound_regions`). #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct Binder(T); @@ -975,15 +1000,18 @@ impl<'tcx> FnSig<'tcx> { pub type PolyFnSig<'tcx> = Binder>; impl<'tcx> PolyFnSig<'tcx> { + #[inline] pub fn inputs(&self) -> Binder<&'tcx [Ty<'tcx>]> { self.map_bound_ref(|fn_sig| fn_sig.inputs()) } + #[inline] pub fn input(&self, index: usize) -> ty::Binder> { self.map_bound_ref(|fn_sig| fn_sig.inputs()[index]) } pub fn inputs_and_output(&self) -> ty::Binder<&'tcx List>> { self.map_bound_ref(|fn_sig| fn_sig.inputs_and_output) } + #[inline] pub fn output(&self) -> ty::Binder> { self.map_bound_ref(|fn_sig| fn_sig.output()) } @@ -1013,7 +1041,7 @@ impl<'a, 'gcx, 'tcx> ParamTy { } pub fn for_self() -> ParamTy { - ParamTy::new(0, keywords::SelfType.name().as_interned_str()) + ParamTy::new(0, keywords::SelfUpper.name().as_interned_str()) } pub fn for_def(def: &ty::GenericParamDef) -> ParamTy { @@ -1028,7 +1056,7 @@ impl<'a, 'gcx, 'tcx> ParamTy { // FIXME(#50125): Ignoring `Self` with `idx != 0` might lead to weird behavior elsewhere, // but this should only be possible when using `-Z continue-parse-after-error` like // `compile-fail/issue-36638.rs`. - self.name == keywords::SelfType.name().as_str() && self.idx == 0 + self.name == keywords::SelfUpper.name().as_str() && self.idx == 0 } } @@ -1092,12 +1120,12 @@ pub type Region<'tcx> = &'tcx RegionKind; /// with some concrete region before being used. There are 2 kind of /// bound regions: early-bound, which are bound in an item's Generics, /// and are substituted by a Substs, and late-bound, which are part of -/// higher-ranked types (e.g. `for<'a> fn(&'a ())`) and are substituted by +/// higher-ranked types (e.g., `for<'a> fn(&'a ())`) and are substituted by /// the likes of `liberate_late_bound_regions`. The distinction exists /// because higher-ranked lifetimes aren't supported in all places. See [1][2]. /// /// Unlike Param-s, bound regions are not supposed to exist "in the wild" -/// outside their binder, e.g. in types passed to type inference, and +/// outside their binder, e.g., in types passed to type inference, and /// should first be substituted (by placeholder regions, free regions, /// or region variables). /// @@ -1135,7 +1163,7 @@ pub type Region<'tcx> = &'tcx RegionKind; /// /// [1]: http://smallcultfollowing.com/babysteps/blog/2013/10/29/intermingled-parameter-lists/ /// [2]: http://smallcultfollowing.com/babysteps/blog/2013/11/04/intermingled-parameter-lists/ -/// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/traits/hrtb.html +/// [rustc guide]: https://rust-lang.github.io/rustc-guide/traits/hrtb.html #[derive(Clone, PartialEq, Eq, Hash, Copy, RustcEncodable, RustcDecodable, PartialOrd, Ord)] pub enum RegionKind { // Region bound in a type or fn declaration which will be @@ -1153,7 +1181,7 @@ pub enum RegionKind { ReFree(FreeRegion), /// A concrete region naming some statically determined scope - /// (e.g. an expression or sequence of statements) within the + /// (e.g., an expression or sequence of statements) within the /// current function. ReScope(region::Scope), @@ -1165,7 +1193,7 @@ pub enum RegionKind { /// A placeholder region - basically the higher-ranked version of ReFree. /// Should not exist after typeck. - RePlaceholder(ty::Placeholder), + RePlaceholder(ty::PlaceholderRegion), /// Empty lifetime is for data that is never accessed. /// Bottom in the region lattice. We treat ReEmpty somewhat @@ -1242,7 +1270,6 @@ newtype_index! { #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct BoundTy { - pub index: DebruijnIndex, pub var: BoundVar, pub kind: BoundTyKind, } @@ -1253,13 +1280,12 @@ pub enum BoundTyKind { Param(InternedString), } -impl_stable_hash_for!(struct BoundTy { index, var, kind }); +impl_stable_hash_for!(struct BoundTy { var, kind }); impl_stable_hash_for!(enum self::BoundTyKind { Anon, Param(a) }); -impl BoundTy { - pub fn new(index: DebruijnIndex, var: BoundVar) -> Self { +impl From for BoundTy { + fn from(var: BoundVar) -> Self { BoundTy { - index, var, kind: BoundTyKind::Anon, } @@ -1319,7 +1345,7 @@ impl<'a, 'tcx, 'gcx> PolyExistentialProjection<'tcx> { impl DebruijnIndex { /// Returns the resulting index when this value is moved into - /// `amount` number of new binders. So e.g. if you had + /// `amount` number of new binders. So e.g., if you had /// /// for<'a> fn(&'a x) /// @@ -1327,7 +1353,7 @@ impl DebruijnIndex { /// /// for<'a> fn(for<'b> fn(&'a x)) /// - /// you would need to shift the index for `'a` into 1 new binder. + /// you would need to shift the index for `'a` into a new binder. #[must_use] pub fn shifted_in(self, amount: u32) -> DebruijnIndex { DebruijnIndex::from_u32(self.as_u32() + amount) @@ -1403,6 +1429,13 @@ impl RegionKind { } } + pub fn is_placeholder(&self) -> bool { + match *self { + ty::RePlaceholder(..) => true, + _ => false, + } + } + pub fn bound_at_or_above_binder(&self, index: DebruijnIndex) -> bool { match *self { ty::ReLateBound(debruijn, _) => debruijn >= index, @@ -1462,7 +1495,7 @@ impl RegionKind { } ty::RePlaceholder(..) => { flags = flags | TypeFlags::HAS_FREE_REGIONS; - flags = flags | TypeFlags::HAS_RE_SKOL; + flags = flags | TypeFlags::HAS_RE_PLACEHOLDER; } ty::ReLateBound(..) => { flags = flags | TypeFlags::HAS_RE_LATE_BOUND; @@ -1540,6 +1573,51 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } + /// Checks whether a type is definitely uninhabited. This is + /// conservative: for some types that are uninhabited we return `false`, + /// but we only return `true` for types that are definitely uninhabited. + /// `ty.conservative_is_privately_uninhabited` implies that any value of type `ty` + /// will be `Abi::Uninhabited`. (Note that uninhabited types may have nonzero + /// size, to account for partial initialisation. See #49298 for details.) + pub fn conservative_is_privately_uninhabited(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> bool { + // FIXME(varkor): we can make this less conversative by substituting concrete + // type arguments. + match self.sty { + ty::Never => true, + ty::Adt(def, _) if def.is_union() => { + // For now, `union`s are never considered uninhabited. + false + } + ty::Adt(def, _) => { + // Any ADT is uninhabited if either: + // (a) It has no variants (i.e. an empty `enum`); + // (b) Each of its variants (a single one in the case of a `struct`) has at least + // one uninhabited field. + def.variants.iter().all(|var| { + var.fields.iter().any(|field| { + tcx.type_of(field.did).conservative_is_privately_uninhabited(tcx) + }) + }) + } + ty::Tuple(tys) => tys.iter().any(|ty| ty.conservative_is_privately_uninhabited(tcx)), + ty::Array(ty, len) => { + match len.assert_usize(tcx) { + // If the array is definitely non-empty, it's uninhabited if + // the type of its elements is uninhabited. + Some(n) if n != 0 => ty.conservative_is_privately_uninhabited(tcx), + _ => false + } + } + ty::Ref(..) => { + // References to uninitialised memory is valid for any type, including + // uninhabited types, in unsafe code, so we treat all references as + // inhabited. + false + } + _ => false, + } + } + pub fn is_primitive(&self) -> bool { match self.sty { Bool | Char | Int(_) | Uint(_) | Float(_) => true, @@ -1547,6 +1625,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } + #[inline] pub fn is_ty_var(&self) -> bool { match self.sty { Infer(TyVar(_)) => true, @@ -1731,6 +1810,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } + #[inline] pub fn is_integral(&self) -> bool { match self.sty { Infer(IntVar(_)) | Int(_) | Uint(_) => true, @@ -1761,6 +1841,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } + #[inline] pub fn is_fp(&self) -> bool { match self.sty { Infer(FloatVar(_)) | Float(_) => true, @@ -1779,6 +1860,13 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } + pub fn is_pointer_sized(&self) -> bool { + match self.sty { + Int(ast::IntTy::Isize) | Uint(ast::UintTy::Usize) => true, + _ => false, + } + } + pub fn is_machine(&self) -> bool { match self.sty { Int(ast::IntTy::Isize) | Uint(ast::UintTy::Usize) => false, @@ -1794,10 +1882,10 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } - /// Returns the type and mutability of *ty. + /// Returns the type and mutability of `*ty`. /// /// The parameter `explicit` indicates if this is an *explicit* dereference. - /// Some types---notably unsafe ptrs---can only be dereferenced explicitly. + /// Some types -- notably unsafe ptrs -- can only be dereferenced explicitly. pub fn builtin_deref(&self, explicit: bool) -> Option> { match self.sty { Adt(def, _) if def.is_box() => { @@ -1844,6 +1932,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } + #[inline] pub fn ty_adt_def(&self) -> Option<&'tcx AdtDef> { match self.sty { Adt(adt, _) => Some(adt), @@ -1861,7 +1950,9 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } Dynamic(ref obj, region) => { out.push(region); - out.extend(obj.principal().skip_binder().substs.regions()); + if let Some(principal) = obj.principal() { + out.extend(principal.skip_binder().substs.regions()); + } } Adt(_, substs) | Opaque(_, substs) => { out.extend(substs.regions()) @@ -1890,6 +1981,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { Foreign(..) | Param(_) | Bound(..) | + Placeholder(..) | Infer(_) | Error => {} } @@ -1953,7 +2045,8 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { ty::Infer(ty::TyVar(_)) => false, - ty::Bound(_) | + ty::Bound(..) | + ty::Placeholder(..) | ty::Infer(ty::FreshTy(_)) | ty::Infer(ty::FreshIntTy(_)) | ty::Infer(ty::FreshFloatTy(_)) => @@ -1962,6 +2055,35 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } +#[derive(Copy, Clone, Debug, Hash, RustcEncodable, RustcDecodable, Eq, PartialEq, Ord, PartialOrd)] +/// Used in the HIR by using `Unevaluated` everywhere and later normalizing to `Evaluated` if the +/// code is monomorphic enough for that. +pub enum LazyConst<'tcx> { + Unevaluated(DefId, &'tcx Substs<'tcx>), + Evaluated(Const<'tcx>), +} + +#[cfg(target_arch = "x86_64")] +static_assert!(LAZY_CONST_SIZE: ::std::mem::size_of::>() == 56); + +impl<'tcx> LazyConst<'tcx> { + pub fn map_evaluated(self, f: impl FnOnce(Const<'tcx>) -> Option) -> Option { + match self { + LazyConst::Evaluated(c) => f(c), + LazyConst::Unevaluated(..) => None, + } + } + + pub fn assert_usize(self, tcx: TyCtxt<'_, '_, '_>) -> Option { + self.map_evaluated(|c| c.assert_usize(tcx)) + } + + #[inline] + pub fn unwrap_usize(&self, tcx: TyCtxt<'_, '_, '_>) -> u64 { + self.assert_usize(tcx).expect("expected `LazyConst` to contain a usize") + } +} + /// Typed constant value. #[derive(Copy, Clone, Debug, Hash, RustcEncodable, RustcDecodable, Eq, PartialEq, Ord, PartialOrd)] pub struct Const<'tcx> { @@ -1970,38 +2092,19 @@ pub struct Const<'tcx> { pub val: ConstValue<'tcx>, } -impl<'tcx> Const<'tcx> { - pub fn unevaluated( - tcx: TyCtxt<'_, '_, 'tcx>, - def_id: DefId, - substs: &'tcx Substs<'tcx>, - ty: Ty<'tcx>, - ) -> &'tcx Self { - tcx.mk_const(Const { - val: ConstValue::Unevaluated(def_id, substs), - ty, - }) - } - - #[inline] - pub fn from_const_value( - tcx: TyCtxt<'_, '_, 'tcx>, - val: ConstValue<'tcx>, - ty: Ty<'tcx>, - ) -> &'tcx Self { - tcx.mk_const(Const { - val, - ty, - }) - } +#[cfg(target_arch = "x86_64")] +static_assert!(CONST_SIZE: ::std::mem::size_of::>() == 48); +impl<'tcx> Const<'tcx> { #[inline] pub fn from_scalar( - tcx: TyCtxt<'_, '_, 'tcx>, val: Scalar, ty: Ty<'tcx>, - ) -> &'tcx Self { - Self::from_const_value(tcx, ConstValue::Scalar(val), ty) + ) -> Self { + Self { + val: ConstValue::Scalar(val), + ty, + } } #[inline] @@ -2009,7 +2112,7 @@ impl<'tcx> Const<'tcx> { tcx: TyCtxt<'_, '_, 'tcx>, bits: u128, ty: ParamEnvAnd<'tcx, Ty<'tcx>>, - ) -> &'tcx Self { + ) -> Self { let ty = tcx.lift_to_global(&ty).unwrap(); let size = tcx.layout_of(ty).unwrap_or_else(|e| { panic!("could not compute layout for {:?}: {:?}", ty, e) @@ -2017,31 +2120,31 @@ impl<'tcx> Const<'tcx> { let shift = 128 - size.bits(); let truncated = (bits << shift) >> shift; assert_eq!(truncated, bits, "from_bits called with untruncated value"); - Self::from_scalar(tcx, Scalar::Bits { bits, size: size.bytes() as u8 }, ty.value) + Self::from_scalar(Scalar::Bits { bits, size: size.bytes() as u8 }, ty.value) } #[inline] - pub fn zero_sized(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) -> &'tcx Self { - Self::from_scalar(tcx, Scalar::Bits { bits: 0, size: 0 }, ty) + pub fn zero_sized(ty: Ty<'tcx>) -> Self { + Self::from_scalar(Scalar::Bits { bits: 0, size: 0 }, ty) } #[inline] - pub fn from_bool(tcx: TyCtxt<'_, '_, 'tcx>, v: bool) -> &'tcx Self { + pub fn from_bool(tcx: TyCtxt<'_, '_, 'tcx>, v: bool) -> Self { Self::from_bits(tcx, v as u128, ParamEnv::empty().and(tcx.types.bool)) } #[inline] - pub fn from_usize(tcx: TyCtxt<'_, '_, 'tcx>, n: u64) -> &'tcx Self { + pub fn from_usize(tcx: TyCtxt<'_, '_, 'tcx>, n: u64) -> Self { Self::from_bits(tcx, n as u128, ParamEnv::empty().and(tcx.types.usize)) } #[inline] - pub fn from_u32(tcx: TyCtxt<'_, '_, 'tcx>, n: u32) -> &'tcx Self { + pub fn from_u32(tcx: TyCtxt<'_, '_, 'tcx>, n: u32) -> Self { Self::from_bits(tcx, n as u128, ParamEnv::empty().and(tcx.types.u32)) } #[inline] - pub fn from_u64(tcx: TyCtxt<'_, '_, 'tcx>, n: u64) -> &'tcx Self { + pub fn from_u64(tcx: TyCtxt<'_, '_, 'tcx>, n: u64) -> Self { Self::from_bits(tcx, n as u128, ParamEnv::empty().and(tcx.types.u64)) } @@ -2107,4 +2210,4 @@ impl<'tcx> Const<'tcx> { } } -impl<'tcx> serialize::UseSpecializedDecodable for &'tcx Const<'tcx> {} +impl<'tcx> serialize::UseSpecializedDecodable for &'tcx LazyConst<'tcx> {} diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index b7f1731ba44..64e7af815b4 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -1,23 +1,12 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Type substitutions. use hir::def_id::DefId; use infer::canonical::Canonical; -use ty::{self, BoundVar, Lift, List, Ty, TyCtxt}; +use ty::{self, Lift, List, Ty, TyCtxt}; use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use serialize::{self, Encodable, Encoder, Decodable, Decoder}; use syntax_pos::{Span, DUMMY_SP}; -use rustc_data_structures::indexed_vec::Idx; use smallvec::SmallVec; use core::intrinsics; @@ -190,11 +179,12 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { Substs::for_item(tcx, def_id, |param, _| { match param.kind { ty::GenericParamDefKind::Type { .. } => { - tcx.mk_ty(ty::Bound(ty::BoundTy { - index: ty::INNERMOST, - var: ty::BoundVar::from(param.index), - kind: ty::BoundTyKind::Param(param.name), - })).into() + tcx.mk_ty( + ty::Bound(ty::INNERMOST, ty::BoundTy { + var: ty::BoundVar::from(param.index), + kind: ty::BoundTyKind::Param(param.name), + }) + ).into() } ty::GenericParamDefKind::Lifetime => { @@ -315,10 +305,10 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { } /// Transform from substitutions for a child of `source_ancestor` - /// (e.g. a trait or impl) to substitutions for the same child + /// (e.g., a trait or impl) to substitutions for the same child /// in a different item, with `target_substs` as the base for /// the target impl/trait, with the source child-specific - /// parameters (e.g. method parameters) on top of that base. + /// parameters (e.g., method parameters) on top of that base. pub fn rebase_onto(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, source_ancestor: DefId, target_substs: &Substs<'tcx>) @@ -568,43 +558,6 @@ impl<'a, 'gcx, 'tcx> SubstFolder<'a, 'gcx, 'tcx> { pub type CanonicalUserSubsts<'tcx> = Canonical<'tcx, UserSubsts<'tcx>>; -impl CanonicalUserSubsts<'tcx> { - /// True if this represents a substitution like - /// - /// ```text - /// [?0, ?1, ?2] - /// ``` - /// - /// i.e., each thing is mapped to a canonical variable with the same index. - pub fn is_identity(&self) -> bool { - if self.value.user_self_ty.is_some() { - return false; - } - - self.value.substs.iter().zip(BoundVar::new(0)..).all(|(kind, cvar)| { - match kind.unpack() { - UnpackedKind::Type(ty) => match ty.sty { - ty::Bound(b) => { - // We only allow a `ty::INNERMOST` index in substitutions. - assert_eq!(b.index, ty::INNERMOST); - cvar == b.var - } - _ => false, - }, - - UnpackedKind::Lifetime(r) => match r { - ty::ReLateBound(index, br) => { - // We only allow a `ty::INNERMOST` index in substitutions. - assert_eq!(*index, ty::INNERMOST); - cvar == br.assert_bound_var() - } - _ => false, - }, - } - }) - } -} - /// Stores the user-given substs to reach some fully qualified path /// (e.g., `::Item` or `::Item`). #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index af678c3e992..37ec560d6c1 100644 --- a/src/librustc/ty/trait_def.rs +++ b/src/librustc/ty/trait_def.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir; use hir::def_id::DefId; use hir::map::DefPathHash; @@ -189,8 +179,8 @@ pub(super) fn trait_impls_of_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } - for &node_id in tcx.hir.trait_impls(trait_id) { - add_impl(tcx.hir.local_def_id(node_id)); + for &node_id in tcx.hir().trait_impls(trait_id) { + add_impl(tcx.hir().local_def_id(node_id)); } } diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 3d0c54d6b0a..75fc0f716a2 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! misc. type-system utilities too small to deserve their own file use hir::def::Def; @@ -17,7 +7,7 @@ use hir::{self, Node}; use ich::NodeIdHashingMode; use traits::{self, ObligationCause}; use ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable}; -use ty::subst::{Substs, UnpackedKind}; +use ty::subst::{Subst, Substs, UnpackedKind}; use ty::query::TyCtxtAt; use ty::TyKind::*; use ty::layout::{Integer, IntegerExt}; @@ -25,7 +15,7 @@ use util::common::ErrorReported; use middle::lang_items; use rustc_data_structures::stable_hasher::{StableHasher, HashStable}; -use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use std::{cmp, fmt}; use syntax::ast; use syntax::attr::{self, SignedInt, UnsignedInt}; @@ -213,7 +203,7 @@ impl<'tcx> ty::ParamEnv<'tcx> { let cause = ObligationCause { span, ..ObligationCause::dummy() }; let ctx = traits::FulfillmentContext::new(); match traits::fully_normalize(&infcx, ctx, cause, self, &ty) { - Ok(ty) => if infcx.type_moves_by_default(self, ty, span) { + Ok(ty) => if !infcx.type_is_copy_modulo_regions(self, ty, span) { infringing.push(field); } Err(errors) => { @@ -303,7 +293,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// Same as applying struct_tail on `source` and `target`, but only /// keeps going as long as the two types are instances of the same /// structure definitions. - /// For `(Foo>, Foo)`, the result will be `(Foo, Trait)`, + /// For `(Foo>, Foo)`, the result will be `(Foo, Trait)`, /// whereas struct_tail produces `T`, and `Trait`, respectively. pub fn struct_lockstep_tails(self, source: Ty<'tcx>, @@ -344,7 +334,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// themselves. This should really be a unique type; `FreshTy(0)` is a /// popular choice. /// - /// NB: in some cases, particularly around higher-ranked bounds, + /// N.B., in some cases, particularly around higher-ranked bounds, /// this function returns a kind of conservative approximation. /// That is, all regions returned by this function are definitely /// required, but there may be other region bounds that are not @@ -451,9 +441,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // destructor will not access borrowed data, // even if such data is otherwise reachable. // - // Such access can be in plain sight (e.g. dereferencing + // Such access can be in plain sight (e.g., dereferencing // `*foo.0` of `Foo<'a>(&'a u32)`) or indirectly hidden - // (e.g. calling `foo.0.clone()` of `Foo`). + // (e.g., calling `foo.0.clone()` of `Foo`). if self.has_attr(dtor, "unsafe_destructor_blind_to_params") { debug!("destructor_constraint({:?}) - blind", def.did); return vec![]; @@ -536,6 +526,15 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } + /// True if `def_id` refers to a trait alias (i.e., `trait Foo = ...;`). + pub fn is_trait_alias(self, def_id: DefId) -> bool { + if let DefPathData::TraitAlias(_) = self.def_key(def_id).disambiguated_data.data { + true + } else { + false + } + } + /// True if this def-id refers to the implicit constructor for /// a tuple struct like `struct Foo(u32)`. pub fn is_struct_constructor(self, def_id: DefId) -> bool { @@ -601,7 +600,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// Return whether the node pointed to by def_id is a static item, and its mutability pub fn is_static(&self, def_id: DefId) -> Option { - if let Some(node) = self.hir.get_if_local(def_id) { + if let Some(node) = self.hir().get_if_local(def_id) { match node { Node::Item(&hir::Item { node: hir::ItemKind::Static(_, mutbl, _), .. @@ -628,17 +627,100 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } } + + /// Expands the given impl trait type, stopping if the type is recursive. + pub fn try_expand_impl_trait_type( + self, + def_id: DefId, + substs: &'tcx Substs<'tcx>, + ) -> Result, Ty<'tcx>> { + use crate::ty::fold::TypeFolder; + + struct OpaqueTypeExpander<'a, 'gcx, 'tcx> { + // Contains the DefIds of the opaque types that are currently being + // expanded. When we expand an opaque type we insert the DefId of + // that type, and when we finish expanding that type we remove the + // its DefId. + seen_opaque_tys: FxHashSet, + primary_def_id: DefId, + found_recursion: bool, + tcx: TyCtxt<'a, 'gcx, 'tcx>, + } + + impl<'a, 'gcx, 'tcx> OpaqueTypeExpander<'a, 'gcx, 'tcx> { + fn expand_opaque_ty( + &mut self, + def_id: DefId, + substs: &'tcx Substs<'tcx>, + ) -> Option> { + if self.found_recursion { + None + } else if self.seen_opaque_tys.insert(def_id) { + let generic_ty = self.tcx.type_of(def_id); + let concrete_ty = generic_ty.subst(self.tcx, substs); + let expanded_ty = self.fold_ty(concrete_ty); + self.seen_opaque_tys.remove(&def_id); + Some(expanded_ty) + } else { + // If another opaque type that we contain is recursive, then it + // will report the error, so we don't have to. + self.found_recursion = def_id == self.primary_def_id; + None + } + } + } + + impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpaqueTypeExpander<'a, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'_, 'gcx, 'tcx> { + self.tcx + } + + fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> { + if let ty::Opaque(def_id, substs) = t.sty { + self.expand_opaque_ty(def_id, substs).unwrap_or(t) + } else { + t.super_fold_with(self) + } + } + } + + let mut visitor = OpaqueTypeExpander { + seen_opaque_tys: FxHashSet::default(), + primary_def_id: def_id, + found_recursion: false, + tcx: self, + }; + let expanded_type = visitor.expand_opaque_ty(def_id, substs).unwrap(); + if visitor.found_recursion { + Err(expanded_type) + } else { + Ok(expanded_type) + } + } } impl<'a, 'tcx> ty::TyS<'tcx> { - pub fn moves_by_default(&'tcx self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env: ty::ParamEnv<'tcx>, - span: Span) - -> bool { - !tcx.at(span).is_copy_raw(param_env.and(self)) + /// Checks whether values of this type `T` are *moved* or *copied* + /// when referenced -- this amounts to a check for whether `T: + /// Copy`, but note that we **don't** consider lifetimes when + /// doing this check. This means that we may generate MIR which + /// does copies even when the type actually doesn't satisfy the + /// full requirements for the `Copy` trait (cc #29149) -- this + /// winds up being reported as an error during NLL borrow check. + pub fn is_copy_modulo_regions(&'tcx self, + tcx: TyCtxt<'a, 'tcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + span: Span) + -> bool { + tcx.at(span).is_copy_raw(param_env.and(self)) } + /// Checks whether values of this type `T` have a size known at + /// compile time (i.e., whether `T: Sized`). Lifetimes are ignored + /// for the purposes of this check, so it can be an + /// over-approximation in generic contexts, where one can have + /// strange rules like `>::Bar: Sized` that + /// actually carry lifetime requirements. pub fn is_sized(&'tcx self, tcx_at: TyCtxtAt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>)-> bool @@ -646,6 +728,13 @@ impl<'a, 'tcx> ty::TyS<'tcx> { tcx_at.is_sized_raw(param_env.and(self)) } + /// Checks whether values of this type `T` implement the `Freeze` + /// trait -- frozen types are those that do not contain a + /// `UnsafeCell` anywhere. This is a language concept used to + /// distinguish "true immutability", which is relevant to + /// optimization as well as the rules around static values. Note + /// that the `Freeze` trait is not exposed to end users and is + /// effectively an implementation detail. pub fn is_freeze(&'tcx self, tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, @@ -656,7 +745,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { /// If `ty.needs_drop(...)` returns `true`, then `ty` is definitely /// non-copy and *might* have a destructor attached; if it returns - /// `false`, then `ty` definitely has no destructor (i.e. no drop glue). + /// `false`, then `ty` definitely has no destructor (i.e., no drop glue). /// /// (Note that this implies that if `ty` has a destructor attached, /// then `needs_drop` will definitely return `true` for `ty`.) @@ -668,6 +757,19 @@ impl<'a, 'tcx> ty::TyS<'tcx> { tcx.needs_drop_raw(param_env.and(self)) } + pub fn same_type(a: Ty<'tcx>, b: Ty<'tcx>) -> bool { + match (&a.sty, &b.sty) { + (&Adt(did_a, substs_a), &Adt(did_b, substs_b)) => { + if did_a != did_b { + return false; + } + + substs_a.types().zip(substs_b.types()).all(|(a, b)| Self::same_type(a, b)) + } + _ => a == b, + } + } + /// Check whether a type is representable. This means it cannot contain unboxed /// structural recursion. This check is needed for structs and enums. pub fn is_representable(&'tcx self, @@ -711,7 +813,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { // Find non representable fields with their spans fold_repr(def.all_fields().map(|field| { let ty = field.ty(tcx, substs); - let span = tcx.hir.span_if_local(field.did).unwrap_or(sp); + let span = tcx.hir().span_if_local(field.did).unwrap_or(sp); match is_type_structurally_recursive(tcx, span, seen, representable_cache, ty) { @@ -740,19 +842,6 @@ impl<'a, 'tcx> ty::TyS<'tcx> { } } - fn same_type<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool { - match (&a.sty, &b.sty) { - (&Adt(did_a, substs_a), &Adt(did_b, substs_b)) => { - if did_a != did_b { - return false; - } - - substs_a.types().zip(substs_b.types()).all(|(a, b)| same_type(a, b)) - } - _ => a == b, - } - } - // Does the type `ty` directly (without indirection through a pointer) // contain any types on stack `seen`? fn is_type_structurally_recursive<'a, 'tcx>( @@ -817,7 +906,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { // struct Foo { Option> } for &seen_type in iter { - if same_type(ty, seen_type) { + if ty::TyS::same_type(ty, seen_type) { debug!("ContainsRecursive: {:?} contains {:?}", seen_type, ty); @@ -861,11 +950,13 @@ fn is_copy_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let (param_env, ty) = query.into_parts(); let trait_def_id = tcx.require_lang_item(lang_items::CopyTraitLangItem); tcx.infer_ctxt() - .enter(|infcx| traits::type_known_to_meet_bound(&infcx, - param_env, - ty, - trait_def_id, - DUMMY_SP)) + .enter(|infcx| traits::type_known_to_meet_bound_modulo_regions( + &infcx, + param_env, + ty, + trait_def_id, + DUMMY_SP, + )) } fn is_sized_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -875,11 +966,13 @@ fn is_sized_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let (param_env, ty) = query.into_parts(); let trait_def_id = tcx.require_lang_item(lang_items::SizedTraitLangItem); tcx.infer_ctxt() - .enter(|infcx| traits::type_known_to_meet_bound(&infcx, - param_env, - ty, - trait_def_id, - DUMMY_SP)) + .enter(|infcx| traits::type_known_to_meet_bound_modulo_regions( + &infcx, + param_env, + ty, + trait_def_id, + DUMMY_SP, + )) } fn is_freeze_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -889,11 +982,13 @@ fn is_freeze_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let (param_env, ty) = query.into_parts(); let trait_def_id = tcx.require_lang_item(lang_items::FreezeTraitLangItem); tcx.infer_ctxt() - .enter(|infcx| traits::type_known_to_meet_bound(&infcx, - param_env, - ty, - trait_def_id, - DUMMY_SP)) + .enter(|infcx| traits::type_known_to_meet_bound_modulo_regions( + &infcx, + param_env, + ty, + trait_def_id, + DUMMY_SP, + )) } fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -931,11 +1026,11 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // `ManuallyDrop` doesn't have a destructor regardless of field types. ty::Adt(def, _) if Some(def.did) == tcx.lang_items().manually_drop() => false, - // Issue #22536: We first query type_moves_by_default. It sees a + // Issue #22536: We first query `is_copy_modulo_regions`. It sees a // normalized version of the type, and therefore will definitely // know whether the type implements Copy (and thus needs no // cleanup/drop/zeroing) ... - _ if !ty.moves_by_default(tcx, param_env, DUMMY_SP) => false, + _ if ty.is_copy_modulo_regions(tcx, param_env, DUMMY_SP) => false, // ... (issue #22536 continued) but as an optimization, still use // prior logic of asking for the structural "may drop". @@ -952,7 +1047,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Can refer to a type which may drop. // FIXME(eddyb) check this against a ParamEnv. ty::Dynamic(..) | ty::Projection(..) | ty::Param(_) | ty::Bound(..) | - ty::Opaque(..) | ty::Infer(_) | ty::Error => true, + ty::Placeholder(..) | ty::Opaque(..) | ty::Infer(_) | ty::Error => true, ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"), diff --git a/src/librustc/ty/walk.rs b/src/librustc/ty/walk.rs index 284c595ee2d..6887d092fcd 100644 --- a/src/librustc/ty/walk.rs +++ b/src/librustc/ty/walk.rs @@ -1,17 +1,6 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! An iterator over the type substructure. //! WARNING: this does not keep track of the region depth. -use mir::interpret::ConstValue; use ty::{self, Ty}; use smallvec::{self, SmallVec}; @@ -82,10 +71,12 @@ fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) { match parent_ty.sty { ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Str | ty::Infer(_) | ty::Param(_) | ty::Never | ty::Error | - ty::Bound(..) | ty::Foreign(..) => { + ty::Placeholder(..) | ty::Bound(..) | ty::Foreign(..) => { } ty::Array(ty, len) => { - push_const(stack, len); + if let ty::LazyConst::Unevaluated(_, substs) = len { + stack.extend(substs.types().rev()); + } stack.push(ty); } ty::Slice(ty) => { @@ -138,10 +129,3 @@ fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) { } } } - -fn push_const<'tcx>(stack: &mut TypeWalkerStack<'tcx>, constant: &'tcx ty::Const<'tcx>) { - if let ConstValue::Unevaluated(_, substs) = constant.val { - stack.extend(substs.types().rev()); - } - stack.push(constant.ty); -} diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index 1336eac63f8..ef683940296 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -1,15 +1,4 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def_id::DefId; -use mir::interpret::ConstValue; use infer::InferCtxt; use ty::subst::Substs; use traits; @@ -212,11 +201,10 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { } } - /// Pushes the obligations required for a constant value to be WF + /// Pushes the obligations required for an array length to be WF /// into `self.out`. - fn compute_const(&mut self, constant: &'tcx ty::Const<'tcx>) { - self.require_sized(constant.ty, traits::ConstSized); - if let ConstValue::Unevaluated(def_id, substs) = constant.val { + fn compute_array_len(&mut self, constant: ty::LazyConst<'tcx>) { + if let ty::LazyConst::Unevaluated(def_id, substs) = constant { let obligations = self.nominal_obligations(def_id, substs); self.out.extend(obligations); @@ -259,6 +247,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { ty::Never | ty::Param(_) | ty::Bound(..) | + ty::Placeholder(..) | ty::Foreign(..) => { // WfScalar, WfParameter, etc } @@ -269,8 +258,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { ty::Array(subty, len) => { self.require_sized(subty, traits::SliceOrArrayElem); - assert_eq!(len.ty, self.infcx.tcx.types.usize); - self.compute_const(len); + self.compute_array_len(*len); } ty::Tuple(ref tys) => { @@ -298,6 +286,11 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { self.out.extend(obligations); } + ty::FnDef(did, substs) => { + let obligations = self.nominal_obligations(did, substs); + self.out.extend(obligations); + } + ty::Ref(r, rty, _) => { // WfReference if !r.has_escaping_bound_vars() && !rty.has_escaping_bound_vars() { @@ -358,7 +351,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { } } - ty::FnDef(..) | ty::FnPtr(_) => { + ty::FnPtr(_) => { // let the loop iterate into the argument/return // types appearing in the fn signature } @@ -388,7 +381,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { let cause = self.cause(traits::MiscObligation); let component_traits = - data.auto_traits().chain(once(data.principal().def_id())); + data.auto_traits().chain(data.principal_def_id()); self.out.extend( component_traits.map(|did| traits::Obligation::new( cause.clone(), diff --git a/src/librustc/util/bug.rs b/src/librustc/util/bug.rs index 863b70c3df3..7698f5ece98 100644 --- a/src/librustc/util/bug.rs +++ b/src/librustc/util/bug.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // These functions are used by macro expansion for bug! and span_bug! use ty::tls; diff --git a/src/librustc/util/captures.rs b/src/librustc/util/captures.rs index b68cfd278fa..09d576b23c0 100644 --- a/src/librustc/util/captures.rs +++ b/src/librustc/util/captures.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// "Signaling" trait used in impl trait to tag lifetimes that you may /// need to capture but don't really need for other reasons. /// Basically a workaround; see [this comment] for details. diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs index bcc0b8047ef..cc0ca165053 100644 --- a/src/librustc/util/common.rs +++ b/src/librustc/util/common.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] use rustc_data_structures::sync::Lock; @@ -24,12 +14,11 @@ use std::sync::mpsc::{Sender}; use syntax_pos::{SpanData}; use ty::TyCtxt; use dep_graph::{DepNode}; -use proc_macro; use lazy_static; use session::Session; // The name of the associated type for `Fn` return types -pub const FN_OUTPUT_NAME: &'static str = "Output"; +pub const FN_OUTPUT_NAME: &str = "Output"; // Useful type to use with `Result<>` indicate that an error has already // been reported to the user, so no need to continue checking. @@ -47,14 +36,13 @@ lazy_static! { } fn panic_hook(info: &panic::PanicInfo<'_>) { - if !proc_macro::__internal::in_sess() { - (*DEFAULT_HOOK)(info); + (*DEFAULT_HOOK)(info); - let backtrace = env::var_os("RUST_BACKTRACE").map(|x| &x != "0").unwrap_or(false); + let backtrace = env::var_os("RUST_BACKTRACE").map(|x| &x != "0").unwrap_or(false); - if backtrace { - TyCtxt::try_print_query_stack(); - } + if backtrace { + TyCtxt::try_print_query_stack(); + } #[cfg(windows)] unsafe { @@ -66,7 +54,6 @@ fn panic_hook(info: &panic::PanicInfo<'_>) { DebugBreak(); } } - } } pub fn install_panic_hook() { @@ -345,7 +332,7 @@ pub trait MemoizationMap { /// If `key` is present in the map, return the value, /// otherwise invoke `op` and store the value in the map. /// - /// NB: if the receiver is a `DepTrackingMap`, special care is + /// N.B., if the receiver is a `DepTrackingMap`, special care is /// needed in the `op` to ensure that the correct edges are /// added into the dep graph. See the `DepTrackingMap` impl for /// more details! diff --git a/src/librustc/util/nodemap.rs b/src/librustc/util/nodemap.rs index 6adfe2cde6c..fe6ab075a1a 100644 --- a/src/librustc/util/nodemap.rs +++ b/src/librustc/util/nodemap.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! An efficient hash map for node IDs use hir::def_id::DefId; diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index d53370d242b..51e9192cd29 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -1,16 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::def_id::DefId; use hir::map::definitions::DefPathData; -use mir::interpret::ConstValue; use middle::region; use ty::subst::{self, Subst}; use ty::{BrAnon, BrEnv, BrFresh, BrNamed}; @@ -18,8 +7,8 @@ use ty::{Bool, Char, Adt}; use ty::{Error, Str, Array, Slice, Float, FnDef, FnPtr}; use ty::{Param, Bound, RawPtr, Ref, Never, Tuple}; use ty::{Closure, Generator, GeneratorWitness, Foreign, Projection, Opaque}; -use ty::{UnnormalizedProjection, Dynamic, Int, Uint, Infer}; -use ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable, GenericParamCount, GenericParamDefKind}; +use ty::{Placeholder, UnnormalizedProjection, Dynamic, Int, Uint, Infer}; +use ty::{self, Ty, TyCtxt, TypeFoldable, GenericParamCount, GenericParamDefKind}; use util::nodemap::FxHashSet; use std::cell::Cell; @@ -31,17 +20,163 @@ use syntax::ast::CRATE_NODE_ID; use syntax::symbol::{Symbol, InternedString}; use hir; +/// The "region highlights" are used to control region printing during +/// specific error messages. When a "region highlight" is enabled, it +/// gives an alternate way to print specific regions. For now, we +/// always print those regions using a number, so something like `'0`. +/// +/// Regions not selected by the region highlight mode are presently +/// unaffected. +#[derive(Copy, Clone, Default)] +pub struct RegionHighlightMode { + /// If enabled, when we see the selected region, use `"'N"` + /// instead of the ordinary behavior. + highlight_regions: [Option<(ty::RegionKind, usize)>; 3], + + /// If enabled, when printing a "free region" that originated from + /// the given `ty::BoundRegion`, print it as `'1`. Free regions that would ordinarily + /// have names print as normal. + /// + /// This is used when you have a signature like `fn foo(x: &u32, + /// y: &'a u32)` and we want to give a name to the region of the + /// reference `x`. + highlight_bound_region: Option<(ty::BoundRegion, usize)>, +} + thread_local! { /// Mechanism for highlighting of specific regions for display in NLL region inference errors. /// Contains region to highlight and counter for number to use when highlighting. - static HIGHLIGHT_REGION_FOR_REGIONVID: Cell> = Cell::new(None) + static REGION_HIGHLIGHT_MODE: Cell = + Cell::new(RegionHighlightMode::default()) } -thread_local! { - /// Mechanism for highlighting of specific regions for display in NLL's 'borrow does not live - /// long enough' errors. Contains a region to highlight and a counter to use. - static HIGHLIGHT_REGION_FOR_BOUND_REGION: Cell> = - Cell::new(None) +impl RegionHighlightMode { + /// Read and return current region highlight settings (accesses thread-local state).a + pub fn get() -> Self { + REGION_HIGHLIGHT_MODE.with(|c| c.get()) + } + + /// Internal helper to update current settings during the execution of `op`. + fn set( + old_mode: Self, + new_mode: Self, + op: impl FnOnce() -> R, + ) -> R { + REGION_HIGHLIGHT_MODE.with(|c| { + c.set(new_mode); + let result = op(); + c.set(old_mode); + result + }) + } + + /// If `region` and `number` are both `Some`, invoke + /// `highlighting_region`. Otherwise, just invoke `op` directly. + pub fn maybe_highlighting_region( + region: Option>, + number: Option, + op: impl FnOnce() -> R, + ) -> R { + if let Some(k) = region { + if let Some(n) = number { + return Self::highlighting_region(k, n, op); + } + } + + op() + } + + /// During the execution of `op`, highlight the region inference + /// vairable `vid` as `'N`. We can only highlight one region vid + /// at a time. + pub fn highlighting_region( + region: ty::Region<'_>, + number: usize, + op: impl FnOnce() -> R, + ) -> R { + let old_mode = Self::get(); + let mut new_mode = old_mode; + let first_avail_slot = new_mode.highlight_regions.iter_mut() + .filter(|s| s.is_none()) + .next() + .unwrap_or_else(|| { + panic!( + "can only highlight {} placeholders at a time", + old_mode.highlight_regions.len(), + ) + }); + *first_avail_slot = Some((*region, number)); + Self::set(old_mode, new_mode, op) + } + + /// Convenience wrapper for `highlighting_region` + pub fn highlighting_region_vid( + vid: ty::RegionVid, + number: usize, + op: impl FnOnce() -> R, + ) -> R { + Self::highlighting_region(&ty::ReVar(vid), number, op) + } + + /// Returns true if any placeholders are highlighted. + fn any_region_vids_highlighted(&self) -> bool { + Self::get() + .highlight_regions + .iter() + .any(|h| match h { + Some((ty::ReVar(_), _)) => true, + _ => false, + }) + } + + /// Returns `Some(n)` with the number to use for the given region, + /// if any. + fn region_highlighted(&self, region: ty::Region<'_>) -> Option { + Self::get() + .highlight_regions + .iter() + .filter_map(|h| match h { + Some((r, n)) if r == region => Some(*n), + _ => None, + }) + .next() + } + + /// During the execution of `op`, highlight the given bound + /// region. We can only highlight one bound region at a time. See + /// the field `highlight_bound_region` for more detailed notes. + pub fn highlighting_bound_region( + br: ty::BoundRegion, + number: usize, + op: impl FnOnce() -> R, + ) -> R { + let old_mode = Self::get(); + assert!(old_mode.highlight_bound_region.is_none()); + Self::set( + old_mode, + Self { + highlight_bound_region: Some((br, number)), + ..old_mode + }, + op, + ) + } + + /// Returns true if any placeholders are highlighted. + pub fn any_placeholders_highlighted(&self) -> bool { + Self::get() + .highlight_regions + .iter() + .any(|h| match h { + Some((ty::RePlaceholder(_), _)) => true, + _ => false, + }) + } + + /// Returns `Some(N)` if the placeholder `p` is highlighted to print as `'N`. + pub fn placeholder_highlight(&self, p: ty::PlaceholderRegion) -> Option { + self.region_highlighted(&ty::RePlaceholder(p)) + } } macro_rules! gen_display_debug_body { @@ -274,6 +409,7 @@ impl PrintContext { DefPathData::AssocTypeInImpl(_) | DefPathData::AssocExistentialInImpl(_) | DefPathData::Trait(_) | + DefPathData::TraitAlias(_) | DefPathData::Impl | DefPathData::TypeNs(_) => { break; @@ -523,7 +659,7 @@ impl PrintContext { } }; let _ = write!(f, "{}", name); - ty::BrNamed(tcx.hir.local_def_id(CRATE_NODE_ID), name) + ty::BrNamed(tcx.hir().local_def_id(CRATE_NODE_ID), name) } }; tcx.mk_region(ty::ReLateBound(ty::INNERMOST, br)) @@ -563,42 +699,6 @@ pub fn parameterized(f: &mut F, PrintContext::new().parameterized(f, substs, did, projections) } -fn get_highlight_region_for_regionvid() -> Option<(RegionVid, usize)> { - HIGHLIGHT_REGION_FOR_REGIONVID.with(|hr| hr.get()) -} - -pub fn with_highlight_region_for_regionvid( - r: RegionVid, - counter: usize, - op: impl FnOnce() -> R -) -> R { - HIGHLIGHT_REGION_FOR_REGIONVID.with(|hr| { - assert_eq!(hr.get(), None); - hr.set(Some((r, counter))); - let r = op(); - hr.set(None); - r - }) -} - -fn get_highlight_region_for_bound_region() -> Option<(ty::BoundRegion, usize)> { - HIGHLIGHT_REGION_FOR_BOUND_REGION.with(|hr| hr.get()) -} - -pub fn with_highlight_region_for_bound_region( - r: ty::BoundRegion, - counter: usize, - op: impl Fn() -> R -) -> R { - HIGHLIGHT_REGION_FOR_BOUND_REGION.with(|hr| { - assert_eq!(hr.get(), None); - hr.set(Some((r, counter))); - let r = op(); - hr.set(None); - r - }) -} - impl<'a, T: Print> Print for &'a T { fn print(&self, f: &mut F, cx: &mut PrintContext) -> fmt::Result { (*self).print(f, cx) @@ -612,21 +712,43 @@ define_print! { ty::tls::with(|tcx| { // Use a type that can't appear in defaults of type parameters. let dummy_self = tcx.mk_infer(ty::FreshTy(0)); - - let principal = tcx - .lift(&self.principal()) - .expect("could not lift TraitRef for printing") - .with_self_ty(tcx, dummy_self); - let projections = self.projection_bounds().map(|p| { - tcx.lift(&p) - .expect("could not lift projection for printing") - .with_self_ty(tcx, dummy_self) - }).collect::>(); - cx.parameterized(f, principal.substs, principal.def_id, &projections)?; + let mut first = true; + + if let Some(principal) = self.principal() { + let principal = tcx + .lift(&principal) + .expect("could not lift TraitRef for printing") + .with_self_ty(tcx, dummy_self); + let projections = self.projection_bounds().map(|p| { + tcx.lift(&p) + .expect("could not lift projection for printing") + .with_self_ty(tcx, dummy_self) + }).collect::>(); + cx.parameterized(f, principal.substs, principal.def_id, &projections)?; + first = false; + } // Builtin bounds. - for did in self.auto_traits() { - write!(f, " + {}", tcx.item_path_str(did))?; + let mut auto_traits: Vec<_> = self.auto_traits().map(|did| { + tcx.item_path_str(did) + }).collect(); + + // The auto traits come ordered by `DefPathHash`. While + // `DefPathHash` is *stable* in the sense that it depends on + // neither the host nor the phase of the moon, it depends + // "pseudorandomly" on the compiler version and the target. + // + // To avoid that causing instabilities in compiletest + // output, sort the auto-traits alphabetically. + auto_traits.sort(); + + for auto_trait in auto_traits { + if !first { + write!(f, " + ")?; + } + first = false; + + write!(f, "{}", auto_trait)?; } Ok(()) @@ -679,7 +801,7 @@ impl fmt::Debug for ty::UpvarId { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "UpvarId({:?};`{}`;{:?})", self.var_path.hir_id, - ty::tls::with(|tcx| tcx.hir.name(tcx.hir.hir_to_node_id(self.var_path.hir_id))), + ty::tls::with(|tcx| tcx.hir().name(tcx.hir().hir_to_node_id(self.var_path.hir_id))), self.closure_expr_id) } } @@ -719,6 +841,9 @@ define_print! { define_print! { ('tcx) ty::ExistentialTraitRef<'tcx>, (self, f, cx) { + display { + cx.parameterized(f, self.substs, self.def_id, &[]) + } debug { ty::tls::with(|tcx| { let dummy_self = tcx.mk_infer(ty::FreshTy(0)); @@ -747,7 +872,7 @@ define_print! { return self.print_debug(f, cx); } - if let Some((region, counter)) = get_highlight_region_for_bound_region() { + if let Some((region, counter)) = RegionHighlightMode::get().highlight_bound_region { if *self == region { return match *self { BrNamed(_, name) => write!(f, "{}", name), @@ -775,13 +900,37 @@ define_print! { } } +define_print! { + () ty::PlaceholderRegion, (self, f, cx) { + display { + if cx.is_verbose { + return self.print_debug(f, cx); + } + + let highlight = RegionHighlightMode::get(); + if let Some(counter) = highlight.placeholder_highlight(*self) { + write!(f, "'{}", counter) + } else if highlight.any_placeholders_highlighted() { + write!(f, "'_") + } else { + write!(f, "{}", self.name) + } + } + } +} + define_print! { () ty::RegionKind, (self, f, cx) { display { - if cx.is_verbose || get_highlight_region_for_regionvid().is_some() { + if cx.is_verbose { return self.print_debug(f, cx); } + // Watch out for region highlights. + if let Some(n) = RegionHighlightMode::get().region_highlighted(self) { + return write!(f, "'{:?}", n); + } + // These printouts are concise. They do not contain all the information // the user might want to diagnose an error, but there is basically no way // to fit that into a short string. Hence the recommendation to use @@ -791,10 +940,12 @@ define_print! { write!(f, "{}", data.name) } ty::ReLateBound(_, br) | - ty::ReFree(ty::FreeRegion { bound_region: br, .. }) | - ty::RePlaceholder(ty::Placeholder { name: br, .. }) => { + ty::ReFree(ty::FreeRegion { bound_region: br, .. }) => { write!(f, "{}", br) } + ty::RePlaceholder(p) => { + write!(f, "{}", p) + } ty::ReScope(scope) if cx.identify_regions => { match scope.data { region::ScopeData::Node => @@ -813,11 +964,16 @@ define_print! { ), } } - ty::ReVar(region_vid) if cx.identify_regions => { - write!(f, "'{}rv", region_vid.index()) + ty::ReVar(region_vid) => { + if RegionHighlightMode::get().any_region_vids_highlighted() { + write!(f, "{:?}", region_vid) + } else if cx.identify_regions { + write!(f, "'{}rv", region_vid.index()) + } else { + Ok(()) + } } ty::ReScope(_) | - ty::ReVar(_) | ty::ReErased => Ok(()), ty::ReStatic => write!(f, "'static"), ty::ReEmpty => write!(f, "'"), @@ -946,13 +1102,10 @@ impl fmt::Debug for ty::FloatVid { impl fmt::Debug for ty::RegionVid { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if let Some((region, counter)) = get_highlight_region_for_regionvid() { - debug!("RegionVid.fmt: region={:?} self={:?} counter={:?}", region, self, counter); - return if *self == region { - write!(f, "'{:?}", counter) - } else { - write!(f, "'_") - } + if let Some(counter) = RegionHighlightMode::get().region_highlighted(&ty::ReVar(*self)) { + return write!(f, "'{:?}", counter); + } else if RegionHighlightMode::get().any_region_vids_highlighted() { + return write!(f, "'_"); } write!(f, "'_#{}r", self.index()) @@ -1110,13 +1263,13 @@ define_print! { Infer(infer_ty) => write!(f, "{}", infer_ty), Error => write!(f, "[type error]"), Param(ref param_ty) => write!(f, "{}", param_ty), - Bound(bound_ty) => { + Bound(debruijn, bound_ty) => { match bound_ty.kind { ty::BoundTyKind::Anon => { - if bound_ty.index == ty::INNERMOST { + if debruijn == ty::INNERMOST { write!(f, "^{}", bound_ty.var.index()) } else { - write!(f, "^{}_{}", bound_ty.index.index(), bound_ty.var.index()) + write!(f, "^{}_{}", debruijn.index(), bound_ty.var.index()) } } @@ -1144,6 +1297,9 @@ define_print! { data.print(f, cx)?; write!(f, ")") } + Placeholder(placeholder) => { + write!(f, "Placeholder({:?})", placeholder) + } Opaque(def_id, substs) => { if cx.is_verbose { return write!(f, "Opaque({:?}, {:?})", def_id, substs); @@ -1191,6 +1347,8 @@ define_print! { } if !is_sized { write!(f, "{}?Sized", if first { " " } else { "+" })?; + } else if first { + write!(f, " Sized")?; } Ok(()) }) @@ -1205,15 +1363,15 @@ define_print! { write!(f, "[static generator")?; } - if let Some(node_id) = tcx.hir.as_local_node_id(did) { - write!(f, "@{:?}", tcx.hir.span(node_id))?; + if let Some(node_id) = tcx.hir().as_local_node_id(did) { + write!(f, "@{:?}", tcx.hir().span(node_id))?; let mut sep = " "; tcx.with_freevars(node_id, |freevars| { for (freevar, upvar_ty) in freevars.iter().zip(upvar_tys) { print!(f, cx, write("{}{}:", sep, - tcx.hir.name(freevar.var_id())), + tcx.hir().name(freevar.var_id())), print(upvar_ty))?; sep = ", "; } @@ -1241,11 +1399,11 @@ define_print! { let upvar_tys = substs.upvar_tys(did, tcx); write!(f, "[closure")?; - if let Some(node_id) = tcx.hir.as_local_node_id(did) { + if let Some(node_id) = tcx.hir().as_local_node_id(did) { if tcx.sess.opts.debugging_opts.span_free_formats { write!(f, "@{:?}", node_id)?; } else { - write!(f, "@{:?}", tcx.hir.span(node_id))?; + write!(f, "@{:?}", tcx.hir().span(node_id))?; } let mut sep = " "; tcx.with_freevars(node_id, |freevars| { @@ -1253,7 +1411,7 @@ define_print! { print!(f, cx, write("{}{}:", sep, - tcx.hir.name(freevar.var_id())), + tcx.hir().name(freevar.var_id())), print(upvar_ty))?; sep = ", "; } @@ -1276,12 +1434,12 @@ define_print! { }), Array(ty, sz) => { print!(f, cx, write("["), print(ty), write("; "))?; - match sz.val { - ConstValue::Unevaluated(_def_id, _substs) => { + match sz { + ty::LazyConst::Unevaluated(_def_id, _substs) => { write!(f, "_")?; } - _ => ty::tls::with(|tcx| { - write!(f, "{}", sz.unwrap_usize(tcx)) + ty::LazyConst::Evaluated(c) => ty::tls::with(|tcx| { + write!(f, "{}", c.unwrap_usize(tcx)) })?, } write!(f, "]") diff --git a/src/librustc/util/profiling.rs b/src/librustc/util/profiling.rs index 37073b6e820..d31a06d6cb8 100644 --- a/src/librustc/util/profiling.rs +++ b/src/librustc/util/profiling.rs @@ -1,17 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use session::config::Options; use std::fs; -use std::io::{self, StdoutLock, Write}; +use std::io::{self, StderrLock, Write}; use std::time::Instant; macro_rules! define_categories { @@ -61,14 +51,19 @@ macro_rules! define_categories { } } - fn print(&self, lock: &mut StdoutLock<'_>) { - writeln!(lock, "| Phase | Time (ms) | Queries | Hits (%) |") + fn print(&self, lock: &mut StderrLock<'_>) { + writeln!(lock, "| Phase | Time (ms) \ + | Time (%) | Queries | Hits (%)") .unwrap(); - writeln!(lock, "| ---------------- | -------------- | -------------- | -------- |") + writeln!(lock, "| ---------------- | -------------- \ + | -------- | -------------- | --------") .unwrap(); + let total_time = ($(self.times.$name + )* 0) as f32; + $( - let (hits, total) = self.query_counts.$name; + let (hits, computed) = self.query_counts.$name; + let total = hits + computed; let (hits, total) = if total > 0 { (format!("{:.2}", (((hits as f32) / (total as f32)) * 100.0)), total.to_string()) @@ -78,11 +73,12 @@ macro_rules! define_categories { writeln!( lock, - "| {0: <16} | {1: <14} | {2: <14} | {3: <8} |", + "| {0: <16} | {1: <14} | {2: <8.2} | {3: <14} | {4: <8}", stringify!($name), self.times.$name / 1_000_000, + ((self.times.$name as f32) / total_time) * 100.0, total, - hits + hits, ).unwrap(); )* } @@ -91,18 +87,30 @@ macro_rules! define_categories { let mut json = String::from("["); $( - let (hits, total) = self.query_counts.$name; + let (hits, computed) = self.query_counts.$name; + let total = hits + computed; + + //normalize hits to 0% + let hit_percent = + if total > 0 { + ((hits as f32) / (total as f32)) * 100.0 + } else { + 0.0 + }; json.push_str(&format!( - "{{ \"category\": {}, \"time_ms\": {}, - \"query_count\": {}, \"query_hits\": {} }}", + "{{ \"category\": \"{}\", \"time_ms\": {},\ + \"query_count\": {}, \"query_hits\": {} }},", stringify!($name), self.times.$name / 1_000_000, total, - format!("{:.2}", (((hits as f32) / (total as f32)) * 100.0)) + format!("{:.2}", hit_percent) )); )* + //remove the trailing ',' character + json.pop(); + json.push(']'); json @@ -162,14 +170,14 @@ impl SelfProfiler { self.timer_stack.push(category); } - pub fn record_query(&mut self, category: ProfileCategory) { - let (hits, total) = *self.data.query_counts.get(category); - self.data.query_counts.set(category, (hits, total + 1)); + pub fn record_computed_queries(&mut self, category: ProfileCategory, count: usize) { + let (hits, computed) = *self.data.query_counts.get(category); + self.data.query_counts.set(category, (hits, computed + count as u64)); } pub fn record_query_hit(&mut self, category: ProfileCategory) { - let (hits, total) = *self.data.query_counts.get(category); - self.data.query_counts.set(category, (hits + 1, total)); + let (hits, computed) = *self.data.query_counts.get(category); + self.data.query_counts.set(category, (hits + 1, computed)); } pub fn end_activity(&mut self, category: ProfileCategory) { @@ -211,7 +219,7 @@ impl SelfProfiler { self.timer_stack.is_empty(), "there were timers running when print_results() was called"); - let out = io::stdout(); + let out = io::stderr(); let mut lock = out.lock(); let crate_name = diff --git a/src/librustc/util/time_graph.rs b/src/librustc/util/time_graph.rs index 3ba4e4ddbb1..4dd383fd234 100644 --- a/src/librustc/util/time_graph.rs +++ b/src/librustc/util/time_graph.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::fx::FxHashMap; use std::fs::File; use std::io::prelude::*; diff --git a/src/librustc_allocator/Cargo.toml b/src/librustc_allocator/Cargo.toml index cd3ef6a1f04..03d33f413c8 100644 --- a/src/librustc_allocator/Cargo.toml +++ b/src/librustc_allocator/Cargo.toml @@ -16,4 +16,4 @@ rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } log = "0.4" -smallvec = { version = "0.6.5", features = ["union"] } +smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } diff --git a/src/librustc_allocator/expand.rs b/src/librustc_allocator/expand.rs index 5df68d49af5..73a35c7cdcd 100644 --- a/src/librustc_allocator/expand.rs +++ b/src/librustc_allocator/expand.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::middle::allocator::AllocatorKind; use rustc_errors; use smallvec::SmallVec; diff --git a/src/librustc_allocator/lib.rs b/src/librustc_allocator/lib.rs index a2017a4ed0f..41c0be61595 100644 --- a/src/librustc_allocator/lib.rs +++ b/src/librustc_allocator/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #![feature(rustc_private)] diff --git a/src/librustc_apfloat/Cargo.toml b/src/librustc_apfloat/Cargo.toml index a8a5da90c7a..248f2d71f41 100644 --- a/src/librustc_apfloat/Cargo.toml +++ b/src/librustc_apfloat/Cargo.toml @@ -10,4 +10,4 @@ path = "lib.rs" [dependencies] bitflags = "1.0" rustc_cratesio_shim = { path = "../librustc_cratesio_shim" } -smallvec = { version = "0.6.5", features = ["union"] } +smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } diff --git a/src/librustc_apfloat/ieee.rs b/src/librustc_apfloat/ieee.rs index adcb9857ee3..7ad34bec899 100644 --- a/src/librustc_apfloat/ieee.rs +++ b/src/librustc_apfloat/ieee.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use {Category, ExpInt, IEK_INF, IEK_NAN, IEK_ZERO}; use {Float, FloatConvert, ParseError, Round, Status, StatusAnd}; @@ -571,7 +561,7 @@ impl fmt::Display for IeeeFloat { } // Fill with zeros up to precision. if !truncate_zero && precision > digits - 1 { - for _ in 0..precision - digits + 1 { + for _ in 0..=precision - digits { f.write_char('0')?; } } @@ -926,7 +916,7 @@ impl Float for IeeeFloat { // In case MSB resides at the left-hand side of radix point, shift the // mantissa right by some amount to make sure the MSB reside right before - // the radix point (i.e. "MSB . rest-significant-bits"). + // the radix point (i.e., "MSB . rest-significant-bits"). if omsb > S::PRECISION { let bits = omsb - S::PRECISION; loss = sig::shift_right(&mut wide_sig, &mut self.exp, bits).combine(loss); @@ -1969,7 +1959,7 @@ impl IeeeFloat { // in a Limb. When this would overflow do we do a single // bignum multiplication, and then revert again to multiplication // in a Limb. - let mut chars = s[first_sig_digit..last_sig_digit + 1].chars(); + let mut chars = s[first_sig_digit..=last_sig_digit].chars(); loop { let mut val = 0; let mut multiplier = 1; @@ -2351,7 +2341,7 @@ mod sig { // Our exponent should not underflow. *exp = exp.checked_sub(bits as ExpInt).unwrap(); - // Jump is the inter-limb jump; shift is is intra-limb shift. + // Jump is the inter-limb jump; shift is the intra-limb shift. let jump = bits / LIMB_BITS; let shift = bits % LIMB_BITS; @@ -2385,7 +2375,7 @@ mod sig { // Our exponent should not overflow. *exp = exp.checked_add(bits as ExpInt).unwrap(); - // Jump is the inter-limb jump; shift is is intra-limb shift. + // Jump is the inter-limb jump; shift is the intra-limb shift. let jump = bits / LIMB_BITS; let shift = bits % LIMB_BITS; @@ -2674,7 +2664,7 @@ mod sig { // In case MSB resides at the left-hand side of radix point, shift the // mantissa right by some amount to make sure the MSB reside right before - // the radix point (i.e. "MSB . rest-significant-bits"). + // the radix point (i.e., "MSB . rest-significant-bits"). // // Note that the result is not normalized when "omsb < precision". So, the // caller needs to call IeeeFloat::normalize() if normalized value is diff --git a/src/librustc_apfloat/lib.rs b/src/librustc_apfloat/lib.rs index 69c9f385409..6d2c54ca9ff 100644 --- a/src/librustc_apfloat/lib.rs +++ b/src/librustc_apfloat/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Port of LLVM's APFloat software floating-point implementation from the //! following C++ sources (please update commit hash when backporting): //! @@ -26,8 +16,8 @@ //! Comments have been preserved where possible, only slightly adapted. //! //! Instead of keeping a pointer to a configuration struct and inspecting it -//! dynamically on every operation, types (e.g. `ieee::Double`), traits -//! (e.g. `ieee::Semantics`) and associated constants are employed for +//! dynamically on every operation, types (e.g., `ieee::Double`), traits +//! (e.g., `ieee::Semantics`) and associated constants are employed for //! increased type safety and performance. //! //! On-heap bigints are replaced everywhere (except in decimal conversion), @@ -179,7 +169,7 @@ pub struct ParseError(pub &'static str); /// implemented operations. Currently implemented operations are add, subtract, /// multiply, divide, fused-multiply-add, conversion-to-float, /// conversion-to-integer and conversion-from-integer. New rounding modes -/// (e.g. away from zero) can be added with three or four lines of code. +/// (e.g., away from zero) can be added with three or four lines of code. /// /// Four formats are built-in: IEEE single precision, double precision, /// quadruple precision, and x87 80-bit extended double (when operating with @@ -589,7 +579,7 @@ pub trait Float pub trait FloatConvert: Float { /// Convert a value of one floating point type to another. /// The return value corresponds to the IEEE754 exceptions. *loses_info - /// records whether the transformation lost information, i.e. whether + /// records whether the transformation lost information, i.e., whether /// converting the result back to the original type will produce the /// original value (this is almost the same as return value==Status::OK, /// but there are edge cases where this is not so). diff --git a/src/librustc_apfloat/ppc.rs b/src/librustc_apfloat/ppc.rs index e662088e82f..839e88cf340 100644 --- a/src/librustc_apfloat/ppc.rs +++ b/src/librustc_apfloat/ppc.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use {Category, ExpInt, Float, FloatConvert, Round, ParseError, Status, StatusAnd}; use ieee; @@ -288,7 +278,7 @@ where // \ / // Normal // - // e.g. NaN * NaN = NaN + // e.g., NaN * NaN = NaN // Zero * Inf = NaN // Normal * Zero = Zero // Normal * Inf = Inf diff --git a/src/librustc_apfloat/tests/ieee.rs b/src/librustc_apfloat/tests/ieee.rs index 6e06ea858ef..96249020c1a 100644 --- a/src/librustc_apfloat/tests/ieee.rs +++ b/src/librustc_apfloat/tests/ieee.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_use] extern crate rustc_apfloat; diff --git a/src/librustc_apfloat/tests/ppc.rs b/src/librustc_apfloat/tests/ppc.rs index 145c3ddc869..cfb453bd061 100644 --- a/src/librustc_apfloat/tests/ppc.rs +++ b/src/librustc_apfloat/tests/ppc.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate rustc_apfloat; use rustc_apfloat::{Category, Float, Round}; diff --git a/src/librustc_asan/Cargo.toml b/src/librustc_asan/Cargo.toml index 734564c2d85..836caf22abf 100644 --- a/src/librustc_asan/Cargo.toml +++ b/src/librustc_asan/Cargo.toml @@ -16,4 +16,4 @@ cmake = "0.1.18" [dependencies] alloc = { path = "../liballoc" } core = { path = "../libcore" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = "0.1.0" diff --git a/src/librustc_asan/build.rs b/src/librustc_asan/build.rs index a5905df57c8..b42d775deb3 100644 --- a/src/librustc_asan/build.rs +++ b/src/librustc_asan/build.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate build_helper; extern crate cmake; @@ -18,6 +8,8 @@ use cmake::Config; fn main() { if let Some(llvm_config) = env::var_os("LLVM_CONFIG") { + build_helper::restore_library_path(); + let (native, target) = match sanitizer_lib_boilerplate("asan") { Ok(native) => native, _ => return, diff --git a/src/librustc_asan/lib.rs b/src/librustc_asan/lib.rs index 47f917e40c1..d6c8e54c18d 100644 --- a/src/librustc_asan/lib.rs +++ b/src/librustc_asan/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![sanitizer_runtime] #![feature(nll)] #![feature(sanitizer_runtime)] diff --git a/src/librustc_borrowck/borrowck/README.md b/src/librustc_borrowck/borrowck/README.md index 8bc0b4969b8..6c47e8784e0 100644 --- a/src/librustc_borrowck/borrowck/README.md +++ b/src/librustc_borrowck/borrowck/README.md @@ -3,7 +3,7 @@ > WARNING: This README is more or less obsolete, and will be removed > soon! The new system is described in the [rustc guide]. -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/mir/borrowck.html +[rustc guide]: https://rust-lang.github.io/rustc-guide/borrow_check.html This pass has the job of enforcing memory safety. This is a subtle topic. This docs aim to explain both the practice and the theory diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index a802729e3fb..cafb29ed99a 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ---------------------------------------------------------------------- // Checking loans // @@ -105,7 +95,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> { debug!("consume(consume_id={}, cmt={:?}, mode={:?})", consume_id, cmt, mode); - let hir_id = self.tcx().hir.node_to_hir_id(consume_id); + let hir_id = self.tcx().hir().node_to_hir_id(consume_id); self.consume_common(hir_id.local_id, consume_span, cmt, mode); } @@ -139,7 +129,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> { borrow_id, cmt, loan_region, bk, loan_cause); - let hir_id = self.tcx().hir.node_to_hir_id(borrow_id); + let hir_id = self.tcx().hir().node_to_hir_id(borrow_id); if let Some(lp) = opt_loan_path(cmt) { let moved_value_use_kind = match loan_cause { euv::ClosureCapture(_) => MovedInCapture, @@ -185,7 +175,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for CheckLoanCtxt<'a, 'tcx> { } } } - self.check_assignment(self.tcx().hir.node_to_hir_id(assignment_id).local_id, + self.check_assignment(self.tcx().hir().node_to_hir_id(assignment_id).local_id, assignment_span, assignee_cmt); } @@ -199,10 +189,10 @@ pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, body: &hir::Body) { debug!("check_loans(body id={})", body.value.id); - let def_id = bccx.tcx.hir.body_owner_def_id(body.id()); + let def_id = bccx.tcx.hir().body_owner_def_id(body.id()); - let node_id = bccx.tcx.hir.as_local_node_id(def_id).unwrap(); - let movable_generator = !match bccx.tcx.hir.get(node_id) { + let node_id = bccx.tcx.hir().as_local_node_id(def_id).unwrap(); + let movable_generator = !match bccx.tcx.hir().get(node_id) { Node::Expr(&hir::Expr { node: hir::ExprKind::Closure(.., Some(hir::GeneratorMovability::Static)), .. @@ -567,12 +557,8 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> { if new_loan.loan_path.has_fork(&old_loan.loan_path) && common.is_some() { let nl = self.bccx.loan_path_to_string(&common.unwrap()); let ol = nl.clone(); - let new_loan_msg = format!(" (via `{}`)", - self.bccx.loan_path_to_string( - &new_loan.loan_path)); - let old_loan_msg = format!(" (via `{}`)", - self.bccx.loan_path_to_string( - &old_loan.loan_path)); + let new_loan_msg = self.bccx.loan_path_to_string(&new_loan.loan_path); + let old_loan_msg = self.bccx.loan_path_to_string(&old_loan.loan_path); (nl, ol, new_loan_msg, old_loan_msg) } else { (self.bccx.loan_path_to_string(&new_loan.loan_path), @@ -615,7 +601,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> { let new_loan_str = &new_loan.kind.to_user_str(); self.bccx.cannot_reborrow_already_uniquely_borrowed( new_loan.span, "closure", &nl, &new_loan_msg, new_loan_str, - old_loan.span, &old_loan_msg, previous_end_span, Origin::Ast) + old_loan.span, &old_loan_msg, previous_end_span, "", Origin::Ast) } (..) => self.bccx.cannot_reborrow_already_borrowed( @@ -907,7 +893,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> { let lp = opt_loan_path(assignee_cmt).unwrap(); self.move_data.each_assignment_of(assignment_id, &lp, |assign| { if assignee_cmt.mutbl.is_mutable() { - let hir_id = self.bccx.tcx.hir.node_to_hir_id(local_id); + let hir_id = self.bccx.tcx.hir().node_to_hir_id(local_id); self.bccx.used_mut_nodes.borrow_mut().insert(hir_id); } else { self.bccx.report_reassigned_immutable_variable( diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index 7bb5f411752..72437e270b0 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Computes moves. use borrowck::*; @@ -57,9 +47,9 @@ pub enum PatternSource<'tcx> { /// with a reference to the let fn get_pattern_source<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, pat: &Pat) -> PatternSource<'tcx> { - let parent = tcx.hir.get_parent_node(pat.id); + let parent = tcx.hir().get_parent_node(pat.id); - match tcx.hir.get(parent) { + match tcx.hir().get(parent) { Node::Expr(ref e) => { // the enclosing expression must be a `match` or something else assert!(match e.node { @@ -79,7 +69,7 @@ pub fn gather_decl<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, var_id: ast::NodeId, var_ty: Ty<'tcx>) { let loan_path = Rc::new(LoanPath::new(LpVar(var_id), var_ty)); - let hir_id = bccx.tcx.hir.node_to_hir_id(var_id); + let hir_id = bccx.tcx.hir().node_to_hir_id(var_id); move_data.add_move(bccx.tcx, loan_path, hir_id.local_id, Declared); } diff --git a/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs b/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs index 6ef5d65d10d..8fc0a3d6338 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module implements the check that the lifetime of a borrow //! does not exceed the lifetime of the value being borrowed. @@ -114,7 +104,7 @@ impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> { self.bccx.tcx.mk_region(ty::ReScope(self.item_scope)) } Categorization::Local(local_id) => { - let hir_id = self.bccx.tcx.hir.node_to_hir_id(local_id); + let hir_id = self.bccx.tcx.hir().node_to_hir_id(local_id); self.bccx.tcx.mk_region(ty::ReScope( self.bccx.region_scope_tree.var_scope(hir_id.local_id))) } diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index 21fb0cdf90a..d681c771d2f 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ---------------------------------------------------------------------- // Gathering loans // @@ -38,13 +28,13 @@ mod move_error; pub fn gather_loans_in_fn<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, body: hir::BodyId) -> (Vec>, move_data::MoveData<'tcx>) { - let def_id = bccx.tcx.hir.body_owner_def_id(body); + let def_id = bccx.tcx.hir().body_owner_def_id(body); let param_env = bccx.tcx.param_env(def_id); let mut glcx = GatherLoanCtxt { bccx, all_loans: Vec::new(), item_ub: region::Scope { - id: bccx.tcx.hir.body(body).value.hir_id.local_id, + id: bccx.tcx.hir().body(body).value.hir_id.local_id, data: region::ScopeData::Node }, move_data: MoveData::default(), @@ -88,7 +78,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> { euv::Move(move_reason) => { gather_moves::gather_move_from_expr( self.bccx, &self.move_data, &mut self.move_error_collector, - self.bccx.tcx.hir.node_to_hir_id(consume_id).local_id, cmt, move_reason); + self.bccx.tcx.hir().node_to_hir_id(consume_id).local_id, cmt, move_reason); } euv::Copy => { } } @@ -135,7 +125,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> { bk={:?}, loan_cause={:?})", borrow_id, cmt, loan_region, bk, loan_cause); - let hir_id = self.bccx.tcx.hir.node_to_hir_id(borrow_id); + let hir_id = self.bccx.tcx.hir().node_to_hir_id(borrow_id); self.guarantee_valid(hir_id.local_id, borrow_span, cmt, @@ -158,7 +148,7 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for GatherLoanCtxt<'a, 'tcx> { fn decl_without_init(&mut self, id: ast::NodeId, _span: Span) { let ty = self.bccx .tables - .node_id_to_type(self.bccx.tcx.hir.node_to_hir_id(id)); + .node_id_to_type(self.bccx.tcx.hir().node_to_hir_id(id)); gather_moves::gather_decl(self.bccx, &self.move_data, id, ty); } } @@ -280,13 +270,13 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> { self.mark_loan_path_as_mutated(&lp); } gather_moves::gather_assignment(self.bccx, &self.move_data, - self.bccx.tcx.hir.node_to_hir_id(assignment_id) + self.bccx.tcx.hir().node_to_hir_id(assignment_id) .local_id, assignment_span, lp); } None => { - // This can occur with e.g. `*foo() = 5`. In such + // This can occur with e.g., `*foo() = 5`. In such // cases, there is no need to check for conflicts // with moves etc, just ignore. } @@ -448,7 +438,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> { wrapped_path = match current_path.kind { LpVar(local_id) => { if !through_borrow { - let hir_id = self.bccx.tcx.hir.node_to_hir_id(local_id); + let hir_id = self.bccx.tcx.hir().node_to_hir_id(local_id); self.bccx.used_mut_nodes.borrow_mut().insert(hir_id); } None diff --git a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs index cfd530b7e3d..00cbc250bd6 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrowck::BorrowckCtxt; use rustc::middle::mem_categorization as mc; use rustc::middle::mem_categorization::Categorization; @@ -80,7 +70,7 @@ fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &[MoveErr let initializer = e.init.as_ref().expect("should have an initializer to get an error"); if let Ok(snippet) = bccx.tcx.sess.source_map().span_to_snippet(initializer.span) { - err.span_suggestion_with_applicability( + err.span_suggestion( initializer.span, "consider using a reference instead", format!("&{}", snippet), @@ -97,8 +87,8 @@ fn report_move_errors<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, errors: &[MoveErr } } if let NoteClosureEnv(upvar_id) = error.move_from.note { - let var_node_id = bccx.tcx.hir.hir_to_node_id(upvar_id.var_path.hir_id); - err.span_label(bccx.tcx.hir.span(var_node_id), + let var_node_id = bccx.tcx.hir().hir_to_node_id(upvar_id.var_path.hir_id); + err.span_label(bccx.tcx.hir().span(var_node_id), "captured outer variable"); } err.emit(); diff --git a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs index 52c7ebb4beb..a43a7f1e09a 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Computes the restrictions that result from a borrow. use borrowck::*; diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index d189460d088..5c11d622d0a 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! See The Book chapter on the borrow checker for more details. #![allow(non_camel_case_types)] @@ -49,7 +39,6 @@ use syntax_pos::{MultiSpan, Span}; use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; use rustc::hir; -use rustc::hir::intravisit::{self, Visitor}; use dataflow::{DataFlowContext, BitwiseOperator, DataFlowOperator, KillFrom}; @@ -93,9 +82,9 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId) debug!("borrowck(body_owner_def_id={:?})", owner_def_id); - let owner_id = tcx.hir.as_local_node_id(owner_def_id).unwrap(); + let owner_id = tcx.hir().as_local_node_id(owner_def_id).unwrap(); - match tcx.hir.get(owner_id) { + match tcx.hir().get(owner_id) { Node::StructCtor(_) | Node::Variant(_) => { // We get invoked with anything that has MIR, but some of @@ -110,10 +99,10 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId) _ => { } } - let body_id = tcx.hir.body_owned_by(owner_id); + let body_id = tcx.hir().body_owned_by(owner_id); let tables = tcx.typeck_tables_of(owner_def_id); let region_scope_tree = tcx.region_scope_tree(owner_def_id); - let body = tcx.hir.body(body_id); + let body = tcx.hir().body(body_id); let mut bccx = BorrowckCtxt { tcx, tables, @@ -167,12 +156,6 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc where F: FnOnce(&mut BorrowckCtxt<'a, 'tcx>) -> &'c cfg::CFG { // Check the body of fn items. - let tcx = this.tcx; - let id_range = { - let mut visitor = intravisit::IdRangeComputingVisitor::new(&tcx.hir); - visitor.visit_body(this.body); - visitor.result() - }; let (all_loans, move_data) = gather_loans::gather_loans_in_fn(this, body_id); @@ -194,7 +177,6 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc Some(this.body), cfg, LoanDataFlowOperator, - id_range, all_loans.len()); for (loan_idx, loan) in all_loans.iter().enumerate() { loan_dfcx.add_gen(loan.gen_scope.item_local_id(), loan_idx); @@ -208,7 +190,6 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc let flowed_moves = move_data::FlowedMoveData::new(move_data, this, cfg, - id_range, this.body); Some(AnalysisData { all_loans, @@ -217,18 +198,18 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc } /// Accessor for introspective clients inspecting `AnalysisData` and -/// the `BorrowckCtxt` itself , e.g. the flowgraph visualizer. +/// the `BorrowckCtxt` itself , e.g., the flowgraph visualizer. pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, body_id: hir::BodyId, cfg: &cfg::CFG) -> (BorrowckCtxt<'a, 'tcx>, AnalysisData<'a, 'tcx>) { - let owner_id = tcx.hir.body_owner(body_id); - let owner_def_id = tcx.hir.local_def_id(owner_id); + let owner_id = tcx.hir().body_owner(body_id); + let owner_def_id = tcx.hir().local_def_id(owner_id); let tables = tcx.typeck_tables_of(owner_def_id); let region_scope_tree = tcx.region_scope_tree(owner_def_id); - let body = tcx.hir.body(body_id); + let body = tcx.hir().body(body_id); let mut bccx = BorrowckCtxt { tcx, tables, @@ -418,8 +399,8 @@ pub enum LoanPathElem<'tcx> { fn closure_to_block(closure_id: LocalDefId, tcx: TyCtxt) -> ast::NodeId { - let closure_id = tcx.hir.local_def_id_to_node_id(closure_id); - match tcx.hir.get(closure_id) { + let closure_id = tcx.hir().local_def_id_to_node_id(closure_id); + match tcx.hir().get(closure_id) { Node::Expr(expr) => match expr.node { hir::ExprKind::Closure(.., body_id, _, _) => { body_id.node_id @@ -436,12 +417,12 @@ impl<'a, 'tcx> LoanPath<'tcx> { pub fn kill_scope(&self, bccx: &BorrowckCtxt<'a, 'tcx>) -> region::Scope { match self.kind { LpVar(local_id) => { - let hir_id = bccx.tcx.hir.node_to_hir_id(local_id); + let hir_id = bccx.tcx.hir().node_to_hir_id(local_id); bccx.region_scope_tree.var_scope(hir_id.local_id) } LpUpvar(upvar_id) => { let block_id = closure_to_block(upvar_id.closure_expr_id, bccx.tcx); - let hir_id = bccx.tcx.hir.node_to_hir_id(block_id); + let hir_id = bccx.tcx.hir().node_to_hir_id(block_id); region::Scope { id: hir_id.local_id, data: region::ScopeData::Node } } LpDowncast(ref base, _) | @@ -700,8 +681,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { Origin::Ast); let need_note = match lp.ty.sty { ty::Closure(id, _) => { - let node_id = self.tcx.hir.as_local_node_id(id).unwrap(); - let hir_id = self.tcx.hir.node_to_hir_id(node_id); + let node_id = self.tcx.hir().as_local_node_id(id).unwrap(); + let hir_id = self.tcx.hir().node_to_hir_id(node_id); if let Some((span, name)) = self.tables.closure_kind_origins().get(hir_id) { err.span_note(*span, &format!( "closure cannot be invoked more than once because \ @@ -721,7 +702,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { // Get type of value and span where it was previously // moved. - let node_id = self.tcx.hir.hir_to_node_id(hir::HirId { + let node_id = self.tcx.hir().hir_to_node_id(hir::HirId { owner: self.body.value.hir_id.owner, local_id: the_move.id }); @@ -731,10 +712,10 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { } move_data::MoveExpr | - move_data::MovePat => (self.tcx.hir.span(node_id), ""), + move_data::MovePat => (self.tcx.hir().span(node_id), ""), move_data::Captured => - (match self.tcx.hir.expect_expr(node_id).node { + (match self.tcx.hir().expect_expr(node_id).node { hir::ExprKind::Closure(.., fn_decl_span, _) => fn_decl_span, ref r => bug!("Captured({:?}) maps to non-closure: {:?}", the_move.id, r), @@ -846,8 +827,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { MutabilityViolation => { let mut db = self.cannot_assign(error_span, &descr, Origin::Ast); if let mc::NoteClosureEnv(upvar_id) = err.cmt.note { - let node_id = self.tcx.hir.hir_to_node_id(upvar_id.var_path.hir_id); - let sp = self.tcx.hir.span(node_id); + let node_id = self.tcx.hir().hir_to_node_id(upvar_id.var_path.hir_id); + let sp = self.tcx.hir().span(node_id); let fn_closure_msg = "`Fn` closures cannot capture their enclosing \ environment for modifications"; match (self.tcx.sess.source_map().span_to_snippet(sp), &err.cmt.cat) { @@ -869,7 +850,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { }) = cmt.cat { db.note(fn_closure_msg); } else { - db.span_suggestion_with_applicability( + db.span_suggestion( sp, msg, suggestion, @@ -877,7 +858,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { ); } } else { - db.span_suggestion_with_applicability( + db.span_suggestion( sp, msg, suggestion, @@ -916,8 +897,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { // to implement two traits for "one operator" is not very intuitive for // many programmers. if err.cmt.note == mc::NoteIndex { - let node_id = self.tcx.hir.hir_to_node_id(err.cmt.hir_id); - let node = self.tcx.hir.get(node_id); + let node_id = self.tcx.hir().hir_to_node_id(err.cmt.hir_id); + let node = self.tcx.hir().get(node_id); // This pattern probably always matches. if let Node::Expr( @@ -937,7 +918,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { self.note_immutability_blame( &mut db, err.cmt.immutability_blame(), - self.tcx.hir.hir_to_node_id(err.cmt.hir_id) + self.tcx.hir().hir_to_node_id(err.cmt.hir_id) ); db.emit(); self.signal_error(); @@ -1043,7 +1024,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { if let ty::ReScope(scope) = *super_scope { let node_id = scope.node_id(self.tcx, &self.region_scope_tree); - match self.tcx.hir.find(node_id) { + match self.tcx.hir().find(node_id) { Some(Node::Stmt(_)) => { if *sub_scope != ty::ReStatic { db.note("consider using a `let` binding to increase its lifetime"); @@ -1138,8 +1119,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { } else { "consider changing this closure to take self by mutable reference" }; - let node_id = self.tcx.hir.local_def_id_to_node_id(id); - let help_span = self.tcx.hir.span(node_id); + let node_id = self.tcx.hir().local_def_id_to_node_id(id); + let help_span = self.tcx.hir().span(node_id); self.cannot_act_on_capture_in_sharable_fn(span, prefix, (help_span, help_msg), @@ -1153,7 +1134,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { self.note_immutability_blame( &mut err, blame, - self.tcx.hir.hir_to_node_id(cmt.hir_id) + self.tcx.hir().hir_to_node_id(cmt.hir_id) ); if is_closure { @@ -1194,7 +1175,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { } fn local_binding_mode(&self, node_id: ast::NodeId) -> ty::BindingMode { - let pat = match self.tcx.hir.get(node_id) { + let pat = match self.tcx.hir().get(node_id) { Node::Binding(pat) => pat, node => bug!("bad node for local: {:?}", node) }; @@ -1211,13 +1192,13 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { } fn local_ty(&self, node_id: ast::NodeId) -> (Option<&hir::Ty>, bool) { - let parent = self.tcx.hir.get_parent_node(node_id); - let parent_node = self.tcx.hir.get(parent); + let parent = self.tcx.hir().get_parent_node(node_id); + let parent_node = self.tcx.hir().get(parent); // The parent node is like a fn if let Some(fn_like) = FnLikeNode::from_node(parent_node) { // `nid`'s parent's `Body` - let fn_body = self.tcx.hir.body(fn_like.body()); + let fn_body = self.tcx.hir().body(fn_like.body()); // Get the position of `node_id` in the arguments list let arg_pos = fn_body.arguments.iter().position(|arg| arg.pat.id == node_id); if let Some(i) = arg_pos { @@ -1245,10 +1226,10 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { Some(ImmutabilityBlame::LocalDeref(node_id)) => { match self.local_binding_mode(node_id) { ty::BindByReference(..) => { - let let_span = self.tcx.hir.span(node_id); + let let_span = self.tcx.hir().span(node_id); let suggestion = suggest_ref_mut(self.tcx, let_span); if let Some(replace_str) = suggestion { - db.span_suggestion_with_applicability( + db.span_suggestion( let_span, "use a mutable reference instead", replace_str, @@ -1272,12 +1253,12 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { } } Some(ImmutabilityBlame::AdtFieldDeref(_, field)) => { - let node_id = match self.tcx.hir.as_local_node_id(field.did) { + let node_id = match self.tcx.hir().as_local_node_id(field.did) { Some(node_id) => node_id, None => return }; - if let Node::Field(ref field) = self.tcx.hir.get(node_id) { + if let Node::Field(ref field) = self.tcx.hir().get(node_id) { if let Some(msg) = self.suggest_mut_for_immutable(&field.ty, false) { db.span_label(field.ty.span, msg); } @@ -1293,7 +1274,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { db: &mut DiagnosticBuilder, borrowed_node_id: ast::NodeId, binding_node_id: ast::NodeId) { - let let_span = self.tcx.hir.span(binding_node_id); + let let_span = self.tcx.hir().span(binding_node_id); if let ty::BindByValue(..) = self.local_binding_mode(binding_node_id) { if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(let_span) { let (ty, is_implicit_self) = self.local_ty(binding_node_id); @@ -1309,16 +1290,16 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { }, )) = ty.map(|t| &t.node) { - let borrow_expr_id = self.tcx.hir.get_parent_node(borrowed_node_id); - db.span_suggestion_with_applicability( - self.tcx.hir.span(borrow_expr_id), + let borrow_expr_id = self.tcx.hir().get_parent_node(borrowed_node_id); + db.span_suggestion( + self.tcx.hir().span(borrow_expr_id), "consider removing the `&mut`, as it is an \ immutable binding to a mutable reference", snippet, Applicability::MachineApplicable, ); } else { - db.span_suggestion_with_applicability( + db.span_suggestion( let_span, "make this binding mutable", format!("mut {}", snippet), @@ -1345,7 +1326,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { &cmt_path_or_string, capture_span, Origin::Ast) - .span_suggestion_with_applicability( + .span_suggestion( err.span, &format!("to force the closure to take ownership of {} \ (and any other referenced variables), \ @@ -1381,8 +1362,8 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { }; if *kind == ty::ClosureKind::Fn { let closure_node_id = - self.tcx.hir.local_def_id_to_node_id(upvar_id.closure_expr_id); - db.span_help(self.tcx.hir.span(closure_node_id), + self.tcx.hir().local_def_id_to_node_id(upvar_id.closure_expr_id); + db.span_help(self.tcx.hir().span(closure_node_id), "consider changing this closure to take \ self by mutable reference"); } @@ -1391,7 +1372,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { if let Categorization::Deref(..) = err.cmt.cat { db.span_label(*error_span, "cannot borrow as mutable"); } else if let Categorization::Local(local_id) = err.cmt.cat { - let span = self.tcx.hir.span(local_id); + let span = self.tcx.hir().span(local_id); if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) { if snippet.starts_with("ref mut ") || snippet.starts_with("&mut ") { db.span_label(*error_span, "cannot reborrow mutably"); @@ -1416,10 +1397,10 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { out: &mut String) { match loan_path.kind { LpUpvar(ty::UpvarId { var_path: ty::UpvarPath { hir_id: id}, closure_expr_id: _ }) => { - out.push_str(&self.tcx.hir.name(self.tcx.hir.hir_to_node_id(id)).as_str()); + out.push_str(&self.tcx.hir().name(self.tcx.hir().hir_to_node_id(id)).as_str()); } LpVar(id) => { - out.push_str(&self.tcx.hir.name(id).as_str()); + out.push_str(&self.tcx.hir().name(id).as_str()); } LpDowncast(ref lp_base, variant_def_id) => { @@ -1530,13 +1511,13 @@ impl<'tcx> fmt::Debug for LoanPath<'tcx> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.kind { LpVar(id) => { - write!(f, "$({})", ty::tls::with(|tcx| tcx.hir.node_to_string(id))) + write!(f, "$({})", ty::tls::with(|tcx| tcx.hir().node_to_string(id))) } LpUpvar(ty::UpvarId{ var_path: ty::UpvarPath {hir_id: var_id}, closure_expr_id }) => { let s = ty::tls::with(|tcx| { - let var_node_id = tcx.hir.hir_to_node_id(var_id); - tcx.hir.node_to_string(var_node_id) + let var_node_id = tcx.hir().hir_to_node_id(var_id); + tcx.hir().node_to_string(var_node_id) }); write!(f, "$({} captured by id={:?})", s, closure_expr_id) } @@ -1565,13 +1546,13 @@ impl<'tcx> fmt::Display for LoanPath<'tcx> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.kind { LpVar(id) => { - write!(f, "$({})", ty::tls::with(|tcx| tcx.hir.node_to_user_string(id))) + write!(f, "$({})", ty::tls::with(|tcx| tcx.hir().node_to_user_string(id))) } LpUpvar(ty::UpvarId{ var_path: ty::UpvarPath { hir_id }, closure_expr_id: _ }) => { let s = ty::tls::with(|tcx| { - let var_node_id = tcx.hir.hir_to_node_id(hir_id); - tcx.hir.node_to_string(var_node_id) + let var_node_id = tcx.hir().hir_to_node_id(hir_id); + tcx.hir().node_to_string(var_node_id) }); write!(f, "$({} captured by closure)", s) } diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs index 8aa2e4641d4..56c9f928eb0 100644 --- a/src/librustc_borrowck/borrowck/move_data.rs +++ b/src/librustc_borrowck/borrowck/move_data.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Data structures used for tracking moves. Please see the extensive //! comments in the section "Moves and initialization" in `README.md`. @@ -25,7 +15,6 @@ use std::rc::Rc; use std::usize; use syntax_pos::Span; use rustc::hir; -use rustc::hir::intravisit::IdRange; #[derive(Default)] pub struct MoveData<'tcx> { @@ -569,7 +558,6 @@ impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> { pub fn new(move_data: MoveData<'tcx>, bccx: &BorrowckCtxt<'a, 'tcx>, cfg: &cfg::CFG, - id_range: IdRange, body: &hir::Body) -> FlowedMoveData<'a, 'tcx> { let tcx = bccx.tcx; @@ -580,7 +568,6 @@ impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> { Some(body), cfg, MoveDataFlowOperator, - id_range, move_data.moves.borrow().len()); let mut dfcx_assign = DataFlowContext::new(tcx, @@ -588,7 +575,6 @@ impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> { Some(body), cfg, AssignDataFlowOperator, - id_range, move_data.var_assignments.borrow().len()); move_data.add_gen_kills(bccx, diff --git a/src/librustc_borrowck/borrowck/unused.rs b/src/librustc_borrowck/borrowck/unused.rs index 85794c5b10a..5db98f0e223 100644 --- a/src/librustc_borrowck/borrowck/unused.rs +++ b/src/librustc_borrowck/borrowck/unused.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir::intravisit::{Visitor, NestedVisitorMap}; use rustc::hir::{self, HirId}; use rustc::lint::builtin::UNUSED_MUT; @@ -88,11 +78,12 @@ impl<'a, 'tcx> UnusedMutCx<'a, 'tcx> { hir_id, span, "variable does not need to be mutable") - .span_suggestion_short_with_applicability( + .span_suggestion_short( mut_span, "remove this `mut`", String::new(), - Applicability::MachineApplicable) + Applicability::MachineApplicable, + ) .emit(); } } @@ -100,7 +91,7 @@ impl<'a, 'tcx> UnusedMutCx<'a, 'tcx> { impl<'a, 'tcx> Visitor<'tcx> for UnusedMutCx<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::OnlyBodies(&self.bccx.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.bccx.tcx.hir()) } fn visit_arm(&mut self, arm: &hir::Arm) { @@ -114,12 +105,12 @@ impl<'a, 'tcx> Visitor<'tcx> for UnusedMutCx<'a, 'tcx> { impl<'a, 'tcx> Visitor<'tcx> for UsedMutFinder<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::OnlyBodies(&self.bccx.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.bccx.tcx.hir()) } fn visit_nested_body(&mut self, id: hir::BodyId) { - let def_id = self.bccx.tcx.hir.body_owner_def_id(id); + let def_id = self.bccx.tcx.hir().body_owner_def_id(id); self.set.extend(self.bccx.tcx.borrowck(def_id).used_mut_nodes.iter().cloned()); - self.visit_body(self.bccx.tcx.hir.body(id)); + self.visit_body(self.bccx.tcx.hir().body(id)); } } diff --git a/src/librustc_borrowck/dataflow.rs b/src/librustc_borrowck/dataflow.rs index 1760fb138ea..8cf62056740 100644 --- a/src/librustc_borrowck/dataflow.rs +++ b/src/librustc_borrowck/dataflow.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - //! A module for propagating forward dataflow information. The analysis //! assumes that the items to be propagated can be represented as bits //! and thus uses bitvectors. Your job is simply to specify the so-called @@ -26,7 +15,7 @@ use rustc_data_structures::graph::implementation::OUTGOING; use rustc::util::nodemap::FxHashMap; use rustc::hir; -use rustc::hir::intravisit::{self, IdRange}; +use rustc::hir::intravisit; use rustc::hir::print as pprust; @@ -71,7 +60,7 @@ pub struct DataFlowContext<'a, 'tcx: 'a, O> { scope_kills: Vec, /// bits killed as we exit the cfg node directly; if it is jumped - /// over, e.g. via `break`, the kills are not reflected in the + /// over, e.g., via `break`, the kills are not reflected in the /// jump's effects. Updated by `add_kill(KillFrom::Execution)`. action_kills: Vec, @@ -111,7 +100,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> { impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O> { fn nested(&self, state: &mut pprust::State, nested: pprust::Nested) -> io::Result<()> { - pprust::PpAnn::nested(&self.tcx.hir, state, nested) + pprust::PpAnn::nested(self.tcx.hir(), state, nested) } fn pre(&self, ps: &mut pprust::State, @@ -172,7 +161,7 @@ fn build_local_id_to_index(body: Option<&hir::Body>, let mut index = FxHashMap::default(); // FIXME(#15020) Would it be better to fold formals from decl - // into cfg itself? i.e. introduce a fn-based flow-graph in + // into cfg itself? i.e., introduce a fn-based flow-graph in // addition to the current block-based flow-graph, rather than // have to put traversals like this here? if let Some(body) = body { @@ -241,16 +230,15 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> { body: Option<&hir::Body>, cfg: &cfg::CFG, oper: O, - id_range: IdRange, bits_per_id: usize) -> DataFlowContext<'a, 'tcx, O> { let usize_bits = mem::size_of::() * 8; let words_per_id = (bits_per_id + usize_bits - 1) / usize_bits; let num_nodes = cfg.graph.all_nodes().len(); - debug!("DataFlowContext::new(analysis_name: {}, id_range={:?}, \ + debug!("DataFlowContext::new(analysis_name: {}, \ bits_per_id={}, words_per_id={}) \ num_nodes: {}", - analysis_name, id_range, bits_per_id, words_per_id, + analysis_name, bits_per_id, words_per_id, num_nodes); let entry = if oper.initial_value() { usize::MAX } else {0}; @@ -430,7 +418,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> { for offset in 0..usize_bits { let bit = 1 << offset; if (word & bit) != 0 { - // NB: we round up the total number of bits + // N.B., we round up the total number of bits // that we store in any given bit set so that // it is an even multiple of usize::BITS. This // means that there may be some stray bits at diff --git a/src/librustc_borrowck/diagnostics.rs b/src/librustc_borrowck/diagnostics.rs index 3fea01443be..44d8a23fcb9 100644 --- a/src/librustc_borrowck/diagnostics.rs +++ b/src/librustc_borrowck/diagnostics.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] diff --git a/src/librustc_borrowck/graphviz.rs b/src/librustc_borrowck/graphviz.rs index 56dd5a846da..adad8c55f21 100644 --- a/src/librustc_borrowck/graphviz.rs +++ b/src/librustc_borrowck/graphviz.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module provides linkage between rustc::middle::graph and //! libgraphviz traits, specialized to attaching borrowck analysis //! data to rendered labels. diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index 049c4b2bd92..8bdc4e1d5c1 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] @@ -15,7 +5,6 @@ #![allow(non_camel_case_types)] #![feature(nll)] -#![feature(quote)] #![recursion_limit="256"] diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index 04f21950477..4d7443b5885 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -13,7 +13,6 @@ test = false cc = "1.0.1" num_cpus = "1.0" rustc-demangle = "0.1.4" -rustc_codegen_ssa = { path = "../librustc_codegen_ssa" } rustc_llvm = { path = "../librustc_llvm" } rustc_yk_sections = { path = "../librustc_yk_sections" } memmap = "0.6" diff --git a/src/librustc_codegen_llvm/README.md b/src/librustc_codegen_llvm/README.md index 8d1c9a52b24..dda2e5ac18f 100644 --- a/src/librustc_codegen_llvm/README.md +++ b/src/librustc_codegen_llvm/README.md @@ -4,4 +4,4 @@ that runs towards the end of the compilation process. For more information about how codegen works, see the [rustc guide]. -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/codegen.html +[rustc guide]: https://rust-lang.github.io/rustc-guide/codegen.html diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs index 76fc5a6eeec..258d839d32e 100644 --- a/src/librustc_codegen_llvm/abi.rs +++ b/src/librustc_codegen_llvm/abi.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use llvm::{self, AttributePlace}; use rustc_codegen_ssa::MemFlags; use builder::Builder; @@ -73,7 +63,7 @@ impl ArgAttributesExt for ArgAttributes { if let Some(align) = self.pointee_align { llvm::LLVMRustAddAlignmentAttr(llfn, idx.as_uint(), - align.abi() as u32); + align.bytes() as u32); } regular.for_each_kind(|attr| attr.apply_llfn(idx, llfn)); } @@ -98,7 +88,7 @@ impl ArgAttributesExt for ArgAttributes { if let Some(align) = self.pointee_align { llvm::LLVMRustAddAlignmentCallSiteAttr(callsite, idx.as_uint(), - align.abi() as u32); + align.bytes() as u32); } regular.for_each_kind(|attr| attr.apply_callsite(idx, callsite)); } @@ -185,7 +175,7 @@ pub trait ArgTypeExt<'ll, 'tcx> { impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> { /// Get the LLVM type for a place of the original Rust type of - /// this argument/return, i.e. the result of `type_of::type_of`. + /// this argument/return, i.e., the result of `type_of::type_of`. fn memory_ty(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type { self.layout.llvm_type(cx) } @@ -204,7 +194,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> { return; } if self.is_sized_indirect() { - OperandValue::Ref(val, None, self.layout.align).store(bx, dst) + OperandValue::Ref(val, None, self.layout.align.abi).store(bx, dst) } else if self.is_unsized_indirect() { bug!("unsized ArgType must be handled through store_fn_arg"); } else if let PassMode::Cast(cast) = self.mode { @@ -212,9 +202,9 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> { // uses it for i16 -> {i8, i8}, but not for i24 -> {i8, i8, i8}. let can_store_through_cast_ptr = false; if can_store_through_cast_ptr { - let cast_ptr_llty = bx.cx().type_ptr_to(cast.llvm_type(bx.cx())); + let cast_ptr_llty = bx.type_ptr_to(cast.llvm_type(bx)); let cast_dst = bx.pointercast(dst.llval, cast_ptr_llty); - bx.store(val, cast_dst, self.layout.align); + bx.store(val, cast_dst, self.layout.align.abi); } else { // The actual return type is a struct, but the ABI // adaptation code has cast it into some scalar type. The @@ -231,9 +221,9 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> { // bitcasting to the struct type yields invalid cast errors. // We instead thus allocate some scratch space... - let scratch_size = cast.size(bx.cx()); - let scratch_align = cast.align(bx.cx()); - let llscratch = bx.alloca(cast.llvm_type(bx.cx()), "abi_cast", scratch_align); + let scratch_size = cast.size(bx); + let scratch_align = cast.align(bx); + let llscratch = bx.alloca(cast.llvm_type(bx), "abi_cast", scratch_align); bx.lifetime_start(llscratch, scratch_size); // ...where we first store the value... @@ -242,10 +232,10 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> { // ...and then memcpy it to the intended destination. bx.memcpy( dst.llval, - self.layout.align, + self.layout.align.abi, llscratch, scratch_align, - bx.cx().const_usize(self.layout.size.bytes()), + bx.const_usize(self.layout.size.bytes()), MemFlags::empty() ); @@ -273,7 +263,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> { OperandValue::Pair(next(), next()).store(bx, dst); } PassMode::Indirect(_, Some(_)) => { - OperandValue::Ref(next(), Some(next()), self.layout.align).store(bx, dst); + OperandValue::Ref(next(), Some(next()), self.layout.align.abi).store(bx, dst); } PassMode::Direct(_) | PassMode::Indirect(_, None) | PassMode::Cast(_) => { self.store(bx, next(), dst); @@ -299,7 +289,7 @@ impl ArgTypeMethods<'tcx> for Builder<'a, 'll, 'tcx> { ty.store(self, val, dst) } fn memory_ty(&self, ty: &ArgType<'tcx, Ty<'tcx>>) -> &'ll Type { - ty.memory_ty(self.cx()) + ty.memory_ty(self) } } @@ -456,6 +446,9 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { let linux_s390x = target.target_os == "linux" && target.arch == "s390x" && target.target_env == "gnu"; + let linux_sparc64 = target.target_os == "linux" + && target.arch == "sparc64" + && target.target_env == "gnu"; let rust_abi = match sig.abi { RustIntrinsic | PlatformIntrinsic | Rust | RustCall => true, _ => false @@ -489,12 +482,6 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { attrs.pointee_size = pointee.size; attrs.pointee_align = Some(pointee.align); - // HACK(eddyb) LLVM inserts `llvm.assume` calls when inlining functions - // with align attributes, and those calls later block optimizations. - if !is_return && !cx.tcx.sess.opts.debugging_opts.arg_align_attributes { - attrs.pointee_align = None; - } - // `Box` pointer parameters never alias because ownership is transferred // `&mut` pointer parameters never alias other parameters, // or mutable global data @@ -526,8 +513,9 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { if arg.layout.is_zst() { // For some forsaken reason, x86_64-pc-windows-gnu // doesn't ignore zero-sized struct arguments. - // The same is true for s390x-unknown-linux-gnu. - if is_return || rust_abi || (!win_x64_gnu && !linux_s390x) { + // The same is true for s390x-unknown-linux-gnu + // and sparc64-unknown-linux-gnu. + if is_return || rust_abi || (!win_x64_gnu && !linux_s390x && !linux_sparc64) { arg.mode = PassMode::Ignore; } } @@ -545,7 +533,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { adjust_for_rust_scalar(&mut b_attrs, b, arg.layout, - a.value.size(cx).abi_align(b.value.align(cx)), + a.value.size(cx).align_to(b.value.align(cx).abi), false); arg.mode = PassMode::Pair(a_attrs, b_attrs); return arg; @@ -780,7 +768,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { // by the LLVM verifier. if let layout::Int(..) = scalar.value { if !scalar.is_bool() { - let range = scalar.valid_range_exclusive(bx.cx()); + let range = scalar.valid_range_exclusive(bx); if range.start != range.end { bx.range_metadata(callsite, range); } diff --git a/src/librustc_codegen_llvm/allocator.rs b/src/librustc_codegen_llvm/allocator.rs index 7c237407c8f..56bbaf55f75 100644 --- a/src/librustc_codegen_llvm/allocator.rs +++ b/src/librustc_codegen_llvm/allocator.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ffi::CString; use attributes; diff --git a/src/librustc_codegen_llvm/asm.rs b/src/librustc_codegen_llvm/asm.rs index efbe7cad138..5c1a8b070c9 100644 --- a/src/librustc_codegen_llvm/asm.rs +++ b/src/librustc_codegen_llvm/asm.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use llvm; use context::CodegenCx; use type_of::LayoutLlvmExt; @@ -57,7 +47,7 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> { // Default per-arch clobbers // Basically what clang does - let arch_clobbers = match &self.cx().sess().target.target.arch[..] { + let arch_clobbers = match &self.sess().target.target.arch[..] { "x86" | "x86_64" => vec!["~{dirflag}", "~{fpsr}", "~{flags}"], "mips" | "mips64" => vec!["~{$1}"], _ => Vec::new() @@ -76,9 +66,9 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> { // Depending on how many outputs we have, the return type is different let num_outputs = output_types.len(); let output_type = match num_outputs { - 0 => self.cx().type_void(), + 0 => self.type_void(), 1 => output_types[0], - _ => self.cx().type_struct(&output_types, false) + _ => self.type_struct(&output_types, false) }; let asm = CString::new(ia.asm.as_str().as_bytes()).unwrap(); @@ -108,13 +98,13 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> { // back to source locations. See #17552. unsafe { let key = "srcloc"; - let kind = llvm::LLVMGetMDKindIDInContext(self.cx().llcx, + let kind = llvm::LLVMGetMDKindIDInContext(self.llcx, key.as_ptr() as *const c_char, key.len() as c_uint); - let val: &'ll Value = self.cx().const_i32(ia.ctxt.outer().as_u32() as i32); + let val: &'ll Value = self.const_i32(ia.ctxt.outer().as_u32() as i32); llvm::LLVMSetMetadata(r, kind, - llvm::LLVMMDNodeInContext(self.cx().llcx, &val, 1)); + llvm::LLVMMDNodeInContext(self.llcx, &val, 1)); } true diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index 38ab1302cfa..e6bc7bca46b 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -1,12 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. //! Set and unset common attributes on LLVM values. use std::ffi::CString; @@ -14,20 +5,22 @@ use std::ffi::CString; use rustc::hir::{CodegenFnAttrFlags, CodegenFnAttrs}; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::session::Session; -use rustc::session::config::Sanitizer; -use rustc::ty::TyCtxt; +use rustc::session::config::{Sanitizer, OptLevel}; +use rustc::ty::{self, TyCtxt, PolyFnSig}; use rustc::ty::layout::HasTyCtxt; use rustc::ty::query::Providers; +use rustc_data_structures::small_c_str::SmallCStr; use rustc_data_structures::sync::Lrc; use rustc_data_structures::fx::FxHashMap; use rustc_target::spec::PanicStrategy; use rustc_codegen_ssa::traits::*; +use abi::Abi; use attributes; use llvm::{self, Attribute}; use llvm::AttributePlace::Function; use llvm_util; -pub use syntax::attr::{self, InlineAttr}; +pub use syntax::attr::{self, InlineAttr, OptimizeAttr}; use context::CodegenCx; use value::Value; @@ -60,18 +53,11 @@ pub fn emit_uwtable(val: &'ll Value, emit: bool) { /// Tell LLVM whether the function can or cannot unwind. #[inline] -pub fn unwind(val: &'ll Value, can_unwind: bool) { +fn unwind(val: &'ll Value, can_unwind: bool) { Attribute::NoUnwind.toggle_llfn(Function, val, !can_unwind); } -/// Tell LLVM whether it should optimize function for size. -#[inline] -#[allow(dead_code)] // possibly useful function -pub fn set_optimize_for_size(val: &'ll Value, optimize: bool) { - Attribute::OptimizeForSize.toggle_llfn(Function, val, optimize); -} - -/// Tell LLVM if this function should be 'naked', i.e. skip the epilogue and prologue. +/// Tell LLVM if this function should be 'naked', i.e., skip the epilogue and prologue. #[inline] pub fn naked(val: &'ll Value, is_naked: bool) { Attribute::Naked.toggle_llfn(Function, val, is_naked); @@ -85,6 +71,18 @@ pub fn set_frame_pointer_elimination(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) } } +/// Tell LLVM what instrument function to insert. +#[inline] +pub fn set_instrument_function(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) { + if cx.sess().instrument_mcount() { + // Similar to `clang -pg` behavior. Handled by the + // `post-inline-ee-instrument` LLVM pass. + llvm::AddFunctionAttrStringValue( + llfn, llvm::AttributePlace::Function, + const_cstr!("instrument-function-entry-inlined"), const_cstr!("mcount")); + } +} + pub fn set_probestack(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) { // Only use stack probes if the target specification indicates that we // should be using stack probes @@ -129,8 +127,7 @@ pub fn llvm_target_features(sess: &Session) -> impl Iterator { } pub fn apply_target_cpu_attr(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value) { - let cpu = llvm_util::target_cpu(cx.tcx.sess); - let target_cpu = CString::new(cpu).unwrap(); + let target_cpu = SmallCStr::new(llvm_util::target_cpu(cx.tcx.sess)); llvm::AddFunctionAttrStringValue( llfn, llvm::AttributePlace::Function, @@ -147,16 +144,55 @@ pub fn non_lazy_bind(sess: &Session, llfn: &'ll Value) { } } -/// Composite function which sets LLVM attributes for function depending on its AST (#[attribute]) +pub(crate) fn default_optimisation_attrs(sess: &Session, llfn: &'ll Value) { + match sess.opts.optimize { + OptLevel::Size => { + llvm::Attribute::MinSize.unapply_llfn(Function, llfn); + llvm::Attribute::OptimizeForSize.apply_llfn(Function, llfn); + llvm::Attribute::OptimizeNone.unapply_llfn(Function, llfn); + }, + OptLevel::SizeMin => { + llvm::Attribute::MinSize.apply_llfn(Function, llfn); + llvm::Attribute::OptimizeForSize.apply_llfn(Function, llfn); + llvm::Attribute::OptimizeNone.unapply_llfn(Function, llfn); + } + OptLevel::No => { + llvm::Attribute::MinSize.unapply_llfn(Function, llfn); + llvm::Attribute::OptimizeForSize.unapply_llfn(Function, llfn); + llvm::Attribute::OptimizeNone.unapply_llfn(Function, llfn); + } + _ => {} + } +} + + +/// Composite function which sets LLVM attributes for function depending on its AST (`#[attribute]`) /// attributes. pub fn from_fn_attrs( - cx: &CodegenCx<'ll, '_>, + cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, id: Option, + sig: PolyFnSig<'tcx>, ) { let codegen_fn_attrs = id.map(|id| cx.tcx.codegen_fn_attrs(id)) .unwrap_or_else(|| CodegenFnAttrs::new()); + match codegen_fn_attrs.optimize { + OptimizeAttr::None => { + default_optimisation_attrs(cx.tcx.sess, llfn); + } + OptimizeAttr::Speed => { + llvm::Attribute::MinSize.unapply_llfn(Function, llfn); + llvm::Attribute::OptimizeForSize.unapply_llfn(Function, llfn); + llvm::Attribute::OptimizeNone.unapply_llfn(Function, llfn); + } + OptimizeAttr::Size => { + llvm::Attribute::MinSize.apply_llfn(Function, llfn); + llvm::Attribute::OptimizeForSize.apply_llfn(Function, llfn); + llvm::Attribute::OptimizeNone.unapply_llfn(Function, llfn); + } + } + inline(cx, llfn, codegen_fn_attrs.inline); // The `uwtable` attribute according to LLVM is: @@ -181,6 +217,7 @@ pub fn from_fn_attrs( } set_frame_pointer_elimination(cx, llfn); + set_instrument_function(cx, llfn); set_probestack(cx, llfn); if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::COLD) { @@ -194,37 +231,42 @@ pub fn from_fn_attrs( llvm::AttributePlace::ReturnValue, llfn); } - let can_unwind = if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::UNWIND) { - Some(true) + unwind(llfn, if cx.tcx.sess.panic_strategy() != PanicStrategy::Unwind { + // In panic=abort mode we assume nothing can unwind anywhere, so + // optimize based on this! + false + } else if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::UNWIND) { + // If a specific #[unwind] attribute is present, use that + true } else if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_ALLOCATOR_NOUNWIND) { - Some(false) - - // Perhaps questionable, but we assume that anything defined - // *in Rust code* may unwind. Foreign items like `extern "C" { - // fn foo(); }` are assumed not to unwind **unless** they have - // a `#[unwind]` attribute. - } else if id.map(|id| !cx.tcx.is_foreign_item(id)).unwrap_or(false) { - Some(true) - } else { - None - }; - - match can_unwind { - Some(false) => attributes::unwind(llfn, false), - Some(true) if cx.tcx.sess.panic_strategy() == PanicStrategy::Unwind => { - attributes::unwind(llfn, true); + // Special attribute for allocator functions, which can't unwind + false + } else if let Some(id) = id { + let sig = cx.tcx.normalize_erasing_late_bound_regions(ty::ParamEnv::reveal_all(), &sig); + if cx.tcx.is_foreign_item(id) { + // Foreign items like `extern "C" { fn foo(); }` are assumed not to + // unwind + false + } else if sig.abi != Abi::Rust && sig.abi != Abi::RustCall { + // Any items defined in Rust that *don't* have the `extern` ABI are + // defined to not unwind. We insert shims to abort if an unwind + // happens to enforce this. + false + } else { + // Anything else defined in Rust is assumed that it can possibly + // unwind + true } - Some(true) | None => {} - } + } else { + // assume this can possibly unwind, avoiding the application of a + // `nounwind` attribute below. + true + }); // Always annotate functions with the target-cpu they are compiled for. // Without this, ThinLTO won't inline Rust functions into Clang generated // functions (because Clang annotates functions this way too). - // NOTE: For now we just apply this if -Zcross-lang-lto is specified, since - // it introduce a little overhead and isn't really necessary otherwise. - if cx.tcx.sess.opts.debugging_opts.cross_lang_lto.enabled() { - apply_target_cpu_attr(cx, llfn); - } + apply_target_cpu_attr(cx, llfn); let features = llvm_target_features(cx.tcx.sess) .map(|s| s.to_string()) diff --git a/src/librustc_codegen_llvm/back/archive.rs b/src/librustc_codegen_llvm/back/archive.rs index 76c50711639..1cf150dad60 100644 --- a/src/librustc_codegen_llvm/back/archive.rs +++ b/src/librustc_codegen_llvm/back/archive.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A helper class for dealing with static archives use std::ffi::{CString, CStr}; diff --git a/src/librustc_codegen_llvm/back/bytecode.rs b/src/librustc_codegen_llvm/back/bytecode.rs index 0b264de18c1..8b288c45336 100644 --- a/src/librustc_codegen_llvm/back/bytecode.rs +++ b/src/librustc_codegen_llvm/back/bytecode.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Management of the encoding of LLVM bytecode into rlibs //! //! This module contains the management of encoding LLVM bytecode into rlibs, diff --git a/src/librustc_codegen_llvm/back/link.rs b/src/librustc_codegen_llvm/back/link.rs index 179801b6bc7..a4b4756dcc1 100644 --- a/src/librustc_codegen_llvm/back/link.rs +++ b/src/librustc_codegen_llvm/back/link.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use back::wasm; use super::archive::{ArchiveBuilder, ArchiveConfig}; use super::bytecode::RLIB_BYTECODE_EXTENSION; @@ -19,7 +9,7 @@ use super::rpath::RPathConfig; use super::rpath; use metadata::METADATA_FILENAME; use rustc::session::config::{self, DebugInfo, OutputFilenames, OutputType, PrintRequest}; -use rustc::session::config::{RUST_CGU_EXT, Lto}; +use rustc::session::config::{RUST_CGU_EXT, Lto, Sanitizer}; use rustc::session::filesearch; use rustc::session::search_paths::PathKind; use rustc::session::Session; @@ -73,12 +63,12 @@ pub(crate) fn link_binary(sess: &Session, bug!("invalid output type `{:?}` for target os `{}`", crate_type, sess.opts.target_triple); } - let mut out_files = link_binary_output(sess, - codegen_results, - crate_type, - outputs, - crate_name); - out_filenames.append(&mut out_files); + let out_files = link_binary_output(sess, + codegen_results, + crate_type, + outputs, + crate_name); + out_filenames.extend(out_files); } // Remove the temporary object file and metadata if we aren't saving temps @@ -213,12 +203,7 @@ fn link_binary_output(sess: &Session, } fn archive_search_paths(sess: &Session) -> Vec { - let mut search = Vec::new(); - sess.target_filesearch(PathKind::Native).for_each_lib_search_path(|path, _| { - search.push(path.to_path_buf()); - }); - - search + sess.target_filesearch(PathKind::Native).search_path_dirs() } fn archive_config<'a>(sess: &'a Session, @@ -463,6 +448,21 @@ fn print_native_static_libs(sess: &Session, all_native_libs: &[NativeLibrary]) { } } +fn get_file_path(sess: &Session, name: &str) -> PathBuf { + let fs = sess.target_filesearch(PathKind::Native); + let file_path = fs.get_lib_path().join(name); + if file_path.exists() { + return file_path + } + for search_path in fs.search_paths() { + let file_path = search_path.dir.join(name); + if file_path.exists() { + return file_path + } + } + PathBuf::from(name) +} + // Create a dynamic library or executable // // This will invoke the system linker/cc to create the resulting file. This @@ -478,7 +478,6 @@ fn link_natively(sess: &Session, // The invocations of cc share some flags across platforms let (pname, mut cmd) = get_linker(sess, &linker, flavor); - let root = sess.target_filesearch(PathKind::Native).get_lib_path(); if let Some(args) = sess.target.target.options.pre_link_args.get(&flavor) { cmd.args(args); } @@ -492,18 +491,26 @@ fn link_natively(sess: &Session, } cmd.args(&sess.opts.debugging_opts.pre_link_arg); + if sess.target.target.options.is_like_fuchsia { + let prefix = match sess.opts.debugging_opts.sanitizer { + Some(Sanitizer::Address) => "asan/", + _ => "", + }; + cmd.arg(format!("--dynamic-linker={}ld.so.1", prefix)); + } + let pre_link_objects = if crate_type == config::CrateType::Executable { &sess.target.target.options.pre_link_objects_exe } else { &sess.target.target.options.pre_link_objects_dll }; for obj in pre_link_objects { - cmd.arg(root.join(obj)); + cmd.arg(get_file_path(sess, obj)); } if crate_type == config::CrateType::Executable && sess.crt_static() { for obj in &sess.target.target.options.pre_link_objects_exe_crt { - cmd.arg(root.join(obj)); + cmd.arg(get_file_path(sess, obj)); } } @@ -527,11 +534,11 @@ fn link_natively(sess: &Session, cmd.args(args); } for obj in &sess.target.target.options.post_link_objects { - cmd.arg(root.join(obj)); + cmd.arg(get_file_path(sess, obj)); } if sess.crt_static() { for obj in &sess.target.target.options.post_link_objects_crt { - cmd.arg(root.join(obj)); + cmd.arg(get_file_path(sess, obj)); } } if let Some(args) = sess.target.target.options.post_link_args.get(&flavor) { @@ -702,6 +709,11 @@ fn link_natively(sess: &Session, if sess.opts.target_triple.triple() == "wasm32-unknown-unknown" { wasm::rewrite_imports(&out_filename, &codegen_results.crate_info.wasm_imports); + wasm::add_producer_section( + &out_filename, + &sess.edition().to_string(), + option_env!("CFG_VERSION").unwrap_or("unknown"), + ); } } @@ -991,7 +1003,7 @@ fn link_args(cmd: &mut dyn Linker, // // The rationale behind this ordering is that those items lower down in the // list can't depend on items higher up in the list. For example nothing can - // depend on what we just generated (e.g. that'd be a circular dependency). + // depend on what we just generated (e.g., that'd be a circular dependency). // Upstream rust libraries are not allowed to depend on our local native // libraries as that would violate the structure of the DAG, in that // scenario they are required to link to them as well in a shared fashion. @@ -1000,7 +1012,7 @@ fn link_args(cmd: &mut dyn Linker, // well, but they also can't depend on what we just started to add to the // link line. And finally upstream native libraries can't depend on anything // in this DAG so far because they're only dylibs and dylibs can only depend - // on other dylibs (e.g. other native deps). + // on other dylibs (e.g., other native deps). add_local_native_libraries(cmd, sess, codegen_results); add_upstream_rust_crates(cmd, sess, codegen_results, crate_type, tmpdir); add_upstream_native_libraries(cmd, sess, codegen_results, crate_type); @@ -1021,11 +1033,10 @@ fn link_args(cmd: &mut dyn Linker, // where extern libraries might live, based on the // addl_lib_search_paths if sess.opts.cg.rpath { - let sysroot = sess.sysroot(); let target_triple = sess.opts.target_triple.triple(); let mut get_install_prefix_lib_path = || { let install_prefix = option_env!("CFG_PREFIX").expect("CFG_PREFIX"); - let tlib = filesearch::relative_target_lib_path(sysroot, target_triple); + let tlib = filesearch::relative_target_lib_path(&sess.sysroot, target_triple); let mut path = PathBuf::from(install_prefix); path.push(&tlib); @@ -1065,12 +1076,13 @@ fn link_args(cmd: &mut dyn Linker, fn add_local_native_libraries(cmd: &mut dyn Linker, sess: &Session, codegen_results: &CodegenResults) { - sess.target_filesearch(PathKind::All).for_each_lib_search_path(|path, k| { - match k { - PathKind::Framework => { cmd.framework_path(path); } - _ => { cmd.include_path(&fix_windows_verbatim_for_gcc(path)); } + let filesearch = sess.target_filesearch(PathKind::All); + for search_path in filesearch.search_paths() { + match search_path.kind { + PathKind::Framework => { cmd.framework_path(&search_path.dir); } + _ => { cmd.include_path(&fix_windows_verbatim_for_gcc(&search_path.dir)); } } - }); + } let relevant_libs = codegen_results.crate_info.used_libraries.iter().filter(|l| { relevant_lib(sess, l) @@ -1202,7 +1214,7 @@ fn add_upstream_rust_crates(cmd: &mut dyn Linker, // compiler-builtins are always placed last to ensure that they're // linked correctly. // We must always link the `compiler_builtins` crate statically. Even if it - // was already "included" in a dylib (e.g. `libstd` when `-C prefer-dynamic` + // was already "included" in a dylib (e.g., `libstd` when `-C prefer-dynamic` // is used) if let Some(cnum) = compiler_builtins { add_static_crate(cmd, sess, codegen_results, tmpdir, crate_type, cnum); @@ -1382,7 +1394,7 @@ fn add_upstream_rust_crates(cmd: &mut dyn Linker, // because a `dylib` can be reused as an intermediate artifact. // // Note, though, that we don't want to include the whole of a - // compiler-builtins crate (e.g. compiler-rt) because it'll get + // compiler-builtins crate (e.g., compiler-rt) because it'll get // repeatedly linked anyway. if crate_type == config::CrateType::Dylib && codegen_results.crate_info.compiler_builtins != Some(cnum) { diff --git a/src/librustc_codegen_llvm/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs index b5ebd0409da..3e51078dc64 100644 --- a/src/librustc_codegen_llvm/back/lto.rs +++ b/src/librustc_codegen_llvm/back/lto.rs @@ -1,19 +1,9 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use back::bytecode::{DecodedBytecode, RLIB_BYTECODE_EXTENSION}; use rustc_codegen_ssa::back::symbol_export; use rustc_codegen_ssa::back::write::{ModuleConfig, CodegenContext, pre_lto_bitcode_filename}; use rustc_codegen_ssa::back::lto::{SerializedModule, LtoModuleCodegen, ThinShared, ThinModule}; use rustc_codegen_ssa::traits::*; -use back::write::{self, DiagnosticHandlers, with_llvm_pmb, save_temp_bitcode, get_llvm_opt_level}; +use back::write::{self, DiagnosticHandlers, with_llvm_pmb, save_temp_bitcode, to_llvm_opt_settings}; use errors::{FatalError, Handler}; use llvm::archive_ro::ArchiveRO; use llvm::{self, True, False}; @@ -48,18 +38,11 @@ pub fn crate_type_allows_lto(crate_type: config::CrateType) -> bool { } } -/// Performs LTO, which in the case of full LTO means merging all modules into -/// a single one and returning it for further optimizing. For ThinLTO, it will -/// do the global analysis necessary and return two lists, one of the modules -/// the need optimization and another for modules that can simply be copied over -/// from the incr. comp. cache. -pub(crate) fn run(cgcx: &CodegenContext, - modules: Vec>, - cached_modules: Vec<(SerializedModule, WorkProduct)>, - timeline: &mut Timeline) - -> Result<(Vec>, Vec), FatalError> +fn prepare_lto(cgcx: &CodegenContext, + timeline: &mut Timeline, + diag_handler: &Handler) + -> Result<(Vec, Vec<(SerializedModule, CString)>), FatalError> { - let diag_handler = cgcx.create_diag_handler(); let export_threshold = match cgcx.lto { // We're just doing LTO for our one crate Lto::ThinLocal => SymbolExportLevel::Rust, @@ -144,36 +127,74 @@ pub(crate) fn run(cgcx: &CodegenContext, } } + Ok((symbol_white_list, upstream_modules)) +} + +/// Performs fat LTO by merging all modules into a single one and returning it +/// for further optimization. +pub(crate) fn run_fat(cgcx: &CodegenContext, + modules: Vec>, + timeline: &mut Timeline) + -> Result, FatalError> +{ + let diag_handler = cgcx.create_diag_handler(); + let (symbol_white_list, upstream_modules) = prepare_lto(cgcx, timeline, &diag_handler)?; let symbol_white_list = symbol_white_list.iter() .map(|c| c.as_ptr()) .collect::>(); - match cgcx.lto { - Lto::Fat => { - assert!(cached_modules.is_empty()); - let opt_jobs = fat_lto(cgcx, - &diag_handler, - modules, - upstream_modules, - &symbol_white_list, - timeline); - opt_jobs.map(|opt_jobs| (opt_jobs, vec![])) - } - Lto::Thin | - Lto::ThinLocal => { - if cgcx.opts.debugging_opts.cross_lang_lto.enabled() { - unreachable!("We should never reach this case if the LTO step \ - is deferred to the linker"); - } - thin_lto(cgcx, - &diag_handler, - modules, - upstream_modules, - cached_modules, - &symbol_white_list, - timeline) + fat_lto(cgcx, &diag_handler, modules, upstream_modules, &symbol_white_list, timeline) +} + +/// Performs thin LTO by performing necessary global analysis and returning two +/// lists, one of the modules that need optimization and another for modules that +/// can simply be copied over from the incr. comp. cache. +pub(crate) fn run_thin(cgcx: &CodegenContext, + modules: Vec<(String, ThinBuffer)>, + cached_modules: Vec<(SerializedModule, WorkProduct)>, + timeline: &mut Timeline) + -> Result<(Vec>, Vec), FatalError> +{ + let diag_handler = cgcx.create_diag_handler(); + let (symbol_white_list, upstream_modules) = prepare_lto(cgcx, timeline, &diag_handler)?; + let symbol_white_list = symbol_white_list.iter() + .map(|c| c.as_ptr()) + .collect::>(); + if cgcx.opts.debugging_opts.cross_lang_lto.enabled() { + unreachable!("We should never reach this case if the LTO step \ + is deferred to the linker"); + } + thin_lto(cgcx, + &diag_handler, + modules, + upstream_modules, + cached_modules, + &symbol_white_list, + timeline) +} + +pub(crate) fn prepare_thin( + cgcx: &CodegenContext, + module: ModuleCodegen +) -> (String, ThinBuffer) { + let name = module.name.clone(); + let buffer = ThinBuffer::new(module.module_llvm.llmod()); + + // We emit the module after having serialized it into a ThinBuffer + // because only then it will contain the ThinLTO module summary. + if let Some(ref incr_comp_session_dir) = cgcx.incr_comp_session_dir { + if cgcx.config(module.kind).emit_pre_thin_lto_bc { + let path = incr_comp_session_dir + .join(pre_lto_bitcode_filename(&name)); + + fs::write(&path, buffer.data()).unwrap_or_else(|e| { + panic!("Error writing pre-lto-bitcode file `{}`: {}", + path.display(), + e); + }); } - Lto::No => unreachable!(), } + + (name, buffer) } fn fat_lto(cgcx: &CodegenContext, @@ -182,7 +203,7 @@ fn fat_lto(cgcx: &CodegenContext, mut serialized_modules: Vec<(SerializedModule, CString)>, symbol_white_list: &[*const libc::c_char], timeline: &mut Timeline) - -> Result>, FatalError> + -> Result, FatalError> { info!("going for a fat lto"); @@ -225,11 +246,12 @@ fn fat_lto(cgcx: &CodegenContext, // and we want to move everything to the same LLVM context. Currently the // way we know of to do that is to serialize them to a string and them parse // them later. Not great but hey, that's why it's "fat" LTO, right? - for module in modules { + serialized_modules.extend(modules.into_iter().map(|module| { let buffer = ModuleBuffer::new(module.module_llvm.llmod()); let llmod_id = CString::new(&module.name[..]).unwrap(); - serialized_modules.push((SerializedModule::Local(buffer), llmod_id)); - } + + (SerializedModule::Local(buffer), llmod_id) + })); // For all serialized bitcode files we parse them and link them in as we did // above, this is all mostly handled in C++. Like above, though, we don't @@ -270,10 +292,10 @@ fn fat_lto(cgcx: &CodegenContext, timeline.record("passes"); } - Ok(vec![LtoModuleCodegen::Fat { + Ok(LtoModuleCodegen::Fat { module: Some(module), _serialized_bitcode: serialized_bitcode, - }]) + }) } struct Linker<'a>(&'a mut llvm::Linker<'a>); @@ -334,7 +356,7 @@ impl Drop for Linker<'a> { /// they all go out of scope. fn thin_lto(cgcx: &CodegenContext, diag_handler: &Handler, - modules: Vec>, + modules: Vec<(String, ThinBuffer)>, serialized_modules: Vec<(SerializedModule, CString)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, symbol_white_list: &[*const libc::c_char], @@ -349,45 +371,22 @@ fn thin_lto(cgcx: &CodegenContext, .map(|&(_, ref wp)| (wp.cgu_name.clone(), wp.clone())) .collect(); - let mut thin_buffers = Vec::new(); - let mut module_names = Vec::new(); - let mut thin_modules = Vec::new(); - - // FIXME: right now, like with fat LTO, we serialize all in-memory - // modules before working with them and ThinLTO. We really - // shouldn't do this, however, and instead figure out how to - // extract a summary from an in-memory module and then merge that - // into the global index. It turns out that this loop is by far - // the most expensive portion of this small bit of global - // analysis! - for (i, module) in modules.iter().enumerate() { - info!("local module: {} - {}", i, module.name); - let name = CString::new(module.name.clone()).unwrap(); - let buffer = ThinBuffer::new(module.module_llvm.llmod()); - - // We emit the module after having serialized it into a ThinBuffer - // because only then it will contain the ThinLTO module summary. - if let Some(ref incr_comp_session_dir) = cgcx.incr_comp_session_dir { - if cgcx.config(module.kind).emit_pre_thin_lto_bc { - let path = incr_comp_session_dir - .join(pre_lto_bitcode_filename(&module.name)); - - fs::write(&path, buffer.data()).unwrap_or_else(|e| { - panic!("Error writing pre-lto-bitcode file `{}`: {}", - path.display(), - e); - }); - } - } + let full_scope_len = modules.len() + serialized_modules.len() + cached_modules.len(); + let mut thin_buffers = Vec::with_capacity(modules.len()); + let mut module_names = Vec::with_capacity(full_scope_len); + let mut thin_modules = Vec::with_capacity(full_scope_len); + for (i, (name, buffer)) in modules.into_iter().enumerate() { + info!("local module: {} - {}", i, name); + let cname = CString::new(name.clone()).unwrap(); thin_modules.push(llvm::ThinLTOModule { - identifier: name.as_ptr(), + identifier: cname.as_ptr(), data: buffer.data().as_ptr(), len: buffer.data().len(), }); thin_buffers.push(buffer); - module_names.push(name); - timeline.record(&module.name); + module_names.push(cname); + timeline.record(&name); } // FIXME: All upstream crates are deserialized internally in the @@ -406,7 +405,7 @@ fn thin_lto(cgcx: &CodegenContext, // incremental ThinLTO first where we could actually avoid // looking at upstream modules entirely sometimes (the contents, // we must always unconditionally look at the index). - let mut serialized = Vec::new(); + let mut serialized = Vec::with_capacity(serialized_modules.len() + cached_modules.len()); let cached_modules = cached_modules.into_iter().map(|(sm, wp)| { (sm, CString::new(wp.cgu_name).unwrap()) @@ -533,7 +532,7 @@ pub(crate) fn run_pass_manager(cgcx: &CodegenContext, // Note that in general this shouldn't matter too much as you typically // only turn on ThinLTO when you're compiling with optimizations // otherwise. - let opt_level = config.opt_level.map(get_llvm_opt_level) + let opt_level = config.opt_level.map(|x| to_llvm_opt_settings(x).0) .unwrap_or(llvm::CodeGenOptLevel::None); let opt_level = match opt_level { llvm::CodeGenOptLevel::None => llvm::CodeGenOptLevel::Less, diff --git a/src/librustc_codegen_llvm/back/rpath.rs b/src/librustc_codegen_llvm/back/rpath.rs index ee4a9b30a1a..aeff23dec41 100644 --- a/src/librustc_codegen_llvm/back/rpath.rs +++ b/src/librustc_codegen_llvm/back/rpath.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::fx::FxHashSet; use std::env; use std::path::{Path, PathBuf}; @@ -31,14 +21,12 @@ pub fn get_rpath_flags(config: &mut RPathConfig) -> Vec { return Vec::new(); } - let mut flags = Vec::new(); - debug!("preparing the RPATH!"); let libs = config.used_crates.clone(); let libs = libs.iter().filter_map(|&(_, ref l)| l.option()).collect::>(); let rpaths = get_rpaths(config, &libs); - flags.extend_from_slice(&rpaths_to_flags(&rpaths)); + let mut flags = rpaths_to_flags(&rpaths); // Use DT_RUNPATH instead of DT_RPATH if available if config.linker_is_gnu { @@ -49,7 +37,8 @@ pub fn get_rpath_flags(config: &mut RPathConfig) -> Vec { } fn rpaths_to_flags(rpaths: &[String]) -> Vec { - let mut ret = Vec::new(); + let mut ret = Vec::with_capacity(rpaths.len()); // the minimum needed capacity + for rpath in rpaths { if rpath.contains(',') { ret.push("-Wl,-rpath".into()); diff --git a/src/librustc_codegen_llvm/back/wasm.rs b/src/librustc_codegen_llvm/back/wasm.rs index 7101255173c..3501123a37f 100644 --- a/src/librustc_codegen_llvm/back/wasm.rs +++ b/src/librustc_codegen_llvm/back/wasm.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fs; use std::path::Path; use std::str; @@ -17,6 +7,7 @@ use serialize::leb128; // https://webassembly.github.io/spec/core/binary/modules.html#binary-importsec const WASM_IMPORT_SECTION_ID: u8 = 2; +const WASM_CUSTOM_SECTION_ID: u8 = 0; const WASM_EXTERNAL_KIND_FUNCTION: u8 = 0; const WASM_EXTERNAL_KIND_TABLE: u8 = 1; @@ -121,6 +112,112 @@ pub fn rewrite_imports(path: &Path, import_map: &FxHashMap) { } } +/// Add or augment the existing `producers` section to encode information about +/// the Rust compiler used to produce the wasm file. +pub fn add_producer_section( + path: &Path, + rust_version: &str, + rustc_version: &str, +) { + struct Field<'a> { + name: &'a str, + values: Vec>, + } + + #[derive(Copy, Clone)] + struct FieldValue<'a> { + name: &'a str, + version: &'a str, + } + + let wasm = fs::read(path).expect("failed to read wasm output"); + let mut ret = WasmEncoder::new(); + ret.data.extend(&wasm[..8]); + + // skip the 8 byte wasm/version header + let rustc_value = FieldValue { + name: "rustc", + version: rustc_version, + }; + let rust_value = FieldValue { + name: "Rust", + version: rust_version, + }; + let mut fields = Vec::new(); + let mut wrote_rustc = false; + let mut wrote_rust = false; + + // Move all sections from the original wasm file to our output, skipping + // everything except the producers section + for (id, raw) in WasmSections(WasmDecoder::new(&wasm[8..])) { + if id != WASM_CUSTOM_SECTION_ID { + ret.byte(id); + ret.bytes(raw); + continue + } + let mut decoder = WasmDecoder::new(raw); + if decoder.str() != "producers" { + ret.byte(id); + ret.bytes(raw); + continue + } + + // Read off the producers section into our fields outside the loop, + // we'll re-encode the producers section when we're done (to handle an + // entirely missing producers section as well). + info!("rewriting existing producers section"); + + for _ in 0..decoder.u32() { + let name = decoder.str(); + let mut values = Vec::new(); + for _ in 0..decoder.u32() { + let name = decoder.str(); + let version = decoder.str(); + values.push(FieldValue { name, version }); + } + + if name == "language" { + values.push(rust_value); + wrote_rust = true; + } else if name == "processed-by" { + values.push(rustc_value); + wrote_rustc = true; + } + fields.push(Field { name, values }); + } + } + + if !wrote_rust { + fields.push(Field { + name: "language", + values: vec![rust_value], + }); + } + if !wrote_rustc { + fields.push(Field { + name: "processed-by", + values: vec![rustc_value], + }); + } + + // Append the producers section to the end of the wasm file. + let mut section = WasmEncoder::new(); + section.str("producers"); + section.u32(fields.len() as u32); + for field in fields { + section.str(field.name); + section.u32(field.values.len() as u32); + for value in field.values { + section.str(value.name); + section.str(value.version); + } + } + ret.byte(WASM_CUSTOM_SECTION_ID); + ret.bytes(§ion.data); + + fs::write(path, &ret.data).expect("failed to write wasm output"); +} + struct WasmSections<'a>(WasmDecoder<'a>); impl<'a> Iterator for WasmSections<'a> { diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index 7945d381760..47637f3c5d7 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use attributes; use back::bytecode::{self, RLIB_BYTECODE_EXTENSION}; use back::lto::ThinBuffer; @@ -15,15 +5,17 @@ use rustc_codegen_ssa::back::write::{CodegenContext, ModuleConfig, run_assembler use rustc_codegen_ssa::traits::*; use base; use consts; +use rustc::hir::def_id::LOCAL_CRATE; use rustc::session::config::{self, OutputType, Passes, Lto}; use rustc::session::Session; +use rustc::ty::TyCtxt; use time_graph::Timeline; use llvm::{self, DiagnosticInfo, PassManager, SMDiagnostic}; use llvm_util; use ModuleLlvm; use rustc_codegen_ssa::{ModuleCodegen, CompiledModule}; use rustc::util::common::time_ext; -use rustc_fs_util::{path2cstr, link_or_copy}; +use rustc_fs_util::{path_to_c_string, link_or_copy}; use rustc_data_structures::small_c_str::SmallCStr; use errors::{self, Handler, FatalError}; use type_::Type; @@ -80,7 +72,7 @@ pub fn write_output_file( output: &Path, file_type: llvm::FileType) -> Result<(), FatalError> { unsafe { - let output_c = path2cstr(output); + let output_c = path_to_c_string(output); let result = llvm::LLVMRustWriteOutputFile(target, pm, m, output_c.as_ptr(), file_type); if result.into_result().is_err() { let msg = format!("could not write output to {}", output.display()); @@ -91,42 +83,46 @@ pub fn write_output_file( } } -pub(crate) fn get_llvm_opt_level(optimize: config::OptLevel) -> llvm::CodeGenOptLevel { - match optimize { - config::OptLevel::No => llvm::CodeGenOptLevel::None, - config::OptLevel::Less => llvm::CodeGenOptLevel::Less, - config::OptLevel::Default => llvm::CodeGenOptLevel::Default, - config::OptLevel::Aggressive => llvm::CodeGenOptLevel::Aggressive, - _ => llvm::CodeGenOptLevel::Default, - } -} - -pub(crate) fn get_llvm_opt_size(optimize: config::OptLevel) -> llvm::CodeGenOptSize { - match optimize { - config::OptLevel::Size => llvm::CodeGenOptSizeDefault, - config::OptLevel::SizeMin => llvm::CodeGenOptSizeAggressive, - _ => llvm::CodeGenOptSizeNone, - } +pub fn create_target_machine( + tcx: TyCtxt, + find_features: bool, +) -> &'static mut llvm::TargetMachine { + target_machine_factory(tcx.sess, tcx.backend_optimization_level(LOCAL_CRATE), find_features)() + .unwrap_or_else(|err| llvm_err(tcx.sess.diagnostic(), &err).raise() ) } -pub fn create_target_machine( +pub fn create_informational_target_machine( sess: &Session, find_features: bool, ) -> &'static mut llvm::TargetMachine { - target_machine_factory(sess, find_features)().unwrap_or_else(|err| { + target_machine_factory(sess, config::OptLevel::No, find_features)().unwrap_or_else(|err| { llvm_err(sess.diagnostic(), &err).raise() }) } + +pub fn to_llvm_opt_settings(cfg: config::OptLevel) -> (llvm::CodeGenOptLevel, llvm::CodeGenOptSize) +{ + use self::config::OptLevel::*; + match cfg { + No => (llvm::CodeGenOptLevel::None, llvm::CodeGenOptSizeNone), + Less => (llvm::CodeGenOptLevel::Less, llvm::CodeGenOptSizeNone), + Default => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeNone), + Aggressive => (llvm::CodeGenOptLevel::Aggressive, llvm::CodeGenOptSizeNone), + Size => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeDefault), + SizeMin => (llvm::CodeGenOptLevel::Default, llvm::CodeGenOptSizeAggressive), + } +} + // If find_features is true this won't access `sess.crate_types` by assuming // that `is_pie_binary` is false. When we discover LLVM target features // `sess.crate_types` is uninitialized so we cannot access it. -pub fn target_machine_factory(sess: &Session, find_features: bool) +pub fn target_machine_factory(sess: &Session, optlvl: config::OptLevel, find_features: bool) -> Arc Result<&'static mut llvm::TargetMachine, String> + Send + Sync> { let reloc_model = get_reloc_model(sess); - let opt_level = get_llvm_opt_level(sess.opts.optimize); + let (opt_level, _) = to_llvm_opt_settings(optlvl); let use_softfp = sess.opts.cg.soft_float; let ffunction_sections = sess.target.target.options.function_sections; @@ -211,7 +207,7 @@ pub(crate) fn save_temp_bitcode( let ext = format!("{}.bc", name); let cgu = Some(&module.name[..]); let path = cgcx.output_filenames.temp_path_ext(&ext, cgu); - let cstr = path2cstr(&path); + let cstr = path_to_c_string(&path); let llmod = module.module_llvm.llmod(); llvm::LLVMWriteBitcodeToFile(llmod, cstr.as_ptr()); } @@ -324,7 +320,7 @@ pub(crate) unsafe fn optimize(cgcx: &CodegenContext, if config.emit_no_opt_bc { let out = cgcx.output_filenames.temp_path_ext("no-opt.bc", module_name); - let out = path2cstr(&out); + let out = path_to_c_string(&out); llvm::LLVMWriteBitcodeToFile(llmod, out.as_ptr()); } @@ -367,19 +363,20 @@ pub(crate) unsafe fn optimize(cgcx: &CodegenContext, if !config.no_prepopulate_passes { llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod); llvm::LLVMRustAddAnalysisPasses(tm, mpm, llmod); - let opt_level = config.opt_level.map(get_llvm_opt_level) + let opt_level = config.opt_level.map(|x| to_llvm_opt_settings(x).0) .unwrap_or(llvm::CodeGenOptLevel::None); let prepare_for_thin_lto = cgcx.lto == Lto::Thin || cgcx.lto == Lto::ThinLocal || (cgcx.lto != Lto::Fat && cgcx.opts.debugging_opts.cross_lang_lto.enabled()); + with_llvm_pmb(llmod, &config, opt_level, prepare_for_thin_lto, &mut |b| { + llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(b, fpm); + llvm::LLVMPassManagerBuilderPopulateModulePassManager(b, mpm); + }); + have_name_anon_globals_pass = have_name_anon_globals_pass || prepare_for_thin_lto; if using_thin_buffers && !prepare_for_thin_lto { assert!(addpass("name-anon-globals")); have_name_anon_globals_pass = true; } - with_llvm_pmb(llmod, &config, opt_level, prepare_for_thin_lto, &mut |b| { - llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(b, fpm); - llvm::LLVMPassManagerBuilderPopulateModulePassManager(b, mpm); - }) } for pass in &config.passes { @@ -530,7 +527,7 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext, || -> Result<(), FatalError> { if config.emit_ir { let out = cgcx.output_filenames.temp_path(OutputType::LlvmAssembly, module_name); - let out = path2cstr(&out); + let out = path_to_c_string(&out); extern "C" fn demangle_callback(input_ptr: *const c_char, input_len: size_t, @@ -698,7 +695,8 @@ pub unsafe fn with_llvm_pmb(llmod: &llvm::Module, // reasonable defaults and prepare it to actually populate the pass // manager. let builder = llvm::LLVMPassManagerBuilderCreate(); - let opt_size = config.opt_size.map(get_llvm_opt_size).unwrap_or(llvm::CodeGenOptSizeNone); + let opt_size = config.opt_size.map(|x| to_llvm_opt_settings(x).1) + .unwrap_or(llvm::CodeGenOptSizeNone); let inline_threshold = config.inline_threshold; let pgo_gen_path = config.pgo_gen.as_ref().map(|s| { @@ -781,7 +779,7 @@ fn create_msvc_imps( } // The x86 ABI seems to require that leading underscores are added to symbol // names, so we need an extra underscore on 32-bit. There's also a leading - // '\x01' here which disables LLVM's symbol mangling (e.g. no extra + // '\x01' here which disables LLVM's symbol mangling (e.g., no extra // underscores added in front). let prefix = if cgcx.target_pointer_width == "32" { "\x01__imp__" diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index 78693a395b3..6e1ef440a3f 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Codegen the completed AST to the LLVM IR. //! //! Some functions here, such as codegen_block and codegen_expr, return a value -- @@ -146,7 +136,7 @@ pub fn iter_globals(llmod: &'ll llvm::Module) -> ValueIter<'ll> { } } -pub fn compile_codegen_unit<'ll, 'tcx>(tcx: TyCtxt<'ll, 'tcx, 'tcx>, +pub fn compile_codegen_unit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, cgu_name: InternedString) -> Stats { let start_time = Instant::now(); @@ -174,7 +164,7 @@ pub fn compile_codegen_unit<'ll, 'tcx>(tcx: TyCtxt<'ll, 'tcx, 'tcx>, let backend = LlvmCodegenBackend(()); let cgu = tcx.codegen_unit(cgu_name); // Instantiate monomorphizations without filling out definitions yet... - let llvm_module = backend.new_metadata(tcx.sess, &cgu_name.as_str()); + let llvm_module = backend.new_metadata(tcx, &cgu_name.as_str()); let stats = { let cx = CodegenCx::new(tcx, cgu, &llvm_module); let mono_items = cx.codegen_unit @@ -195,7 +185,9 @@ pub fn compile_codegen_unit<'ll, 'tcx>(tcx: TyCtxt<'ll, 'tcx, 'tcx>, // Run replace-all-uses-with for statics that need it for &(old_g, new_g) in cx.statics_to_rauw().borrow().iter() { unsafe { - cx.static_replace_all_uses(old_g, new_g) + let bitcast = llvm::LLVMConstPointerCast(new_g, cx.val_ty(old_g)); + llvm::LLVMReplaceAllUsesWith(old_g, bitcast); + llvm::LLVMDeleteGlobal(old_g); } } diff --git a/src/librustc_codegen_llvm/build.rs b/src/librustc_codegen_llvm/build.rs index 97accbb4b8f..d1fc624c689 100644 --- a/src/librustc_codegen_llvm/build.rs +++ b/src/librustc_codegen_llvm/build.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-env-changed=CFG_VERSION"); diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index 34e4f4d7e18..b79d0da0bcd 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect}; use llvm::{self, False, BasicBlock}; use rustc_codegen_ssa::common::{IntPredicate, TypeKind, RealPredicate}; @@ -20,6 +10,7 @@ use value::Value; use libc::{c_uint, c_char}; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::layout::{self, Align, Size, TyLayout}; +use rustc::hir::def_id::DefId; use rustc::session::config; use rustc_data_structures::small_c_str::SmallCStr; use rustc_codegen_ssa::traits::*; @@ -29,7 +20,7 @@ use rustc_codegen_ssa::mir::operand::{OperandValue, OperandRef}; use rustc_codegen_ssa::mir::place::PlaceRef; use std::borrow::Cow; use std::ffi::CStr; -use std::ops::Range; +use std::ops::{Deref, Range}; use std::ptr; // All Builders must have an llfn associated with them @@ -58,7 +49,6 @@ impl BackendTypes for Builder<'_, 'll, 'tcx> { type Value = as BackendTypes>::Value; type BasicBlock = as BackendTypes>::BasicBlock; type Type = as BackendTypes>::Type; - type Context = as BackendTypes>::Context; type Funclet = as BackendTypes>::Funclet; type DIScope = as BackendTypes>::DIScope; @@ -85,6 +75,13 @@ impl ty::layout::LayoutOf for Builder<'_, '_, 'tcx> { } } +impl Deref for Builder<'_, 'll, 'tcx> { + type Target = CodegenCx<'ll, 'tcx>; + + fn deref(&self) -> &Self::Target { + self.cx + } +} impl HasCodegen<'tcx> for Builder<'_, 'll, 'tcx> { type CodegenCx = CodegenCx<'ll, 'tcx>; @@ -137,11 +134,11 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { } fn count_insn(&self, category: &str) { - if self.cx().sess().codegen_stats() { - self.cx().stats.borrow_mut().n_llvm_insns += 1; + if self.sess().codegen_stats() { + self.stats.borrow_mut().n_llvm_insns += 1; } - if self.cx().sess().count_llvm_insns() { - *self.cx().stats + if self.sess().count_llvm_insns() { + *self.stats .borrow_mut() .llvm_insns .entry(category.to_string()) @@ -457,6 +454,80 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { } } + fn checked_binop( + &mut self, + oop: OverflowOp, + ty: Ty, + lhs: Self::Value, + rhs: Self::Value, + ) -> (Self::Value, Self::Value) { + use syntax::ast::IntTy::*; + use syntax::ast::UintTy::*; + use rustc::ty::{Int, Uint}; + + let new_sty = match ty.sty { + Int(Isize) => Int(self.tcx.sess.target.isize_ty), + Uint(Usize) => Uint(self.tcx.sess.target.usize_ty), + ref t @ Uint(_) | ref t @ Int(_) => t.clone(), + _ => panic!("tried to get overflow intrinsic for op applied to non-int type") + }; + + let name = match oop { + OverflowOp::Add => match new_sty { + Int(I8) => "llvm.sadd.with.overflow.i8", + Int(I16) => "llvm.sadd.with.overflow.i16", + Int(I32) => "llvm.sadd.with.overflow.i32", + Int(I64) => "llvm.sadd.with.overflow.i64", + Int(I128) => "llvm.sadd.with.overflow.i128", + + Uint(U8) => "llvm.uadd.with.overflow.i8", + Uint(U16) => "llvm.uadd.with.overflow.i16", + Uint(U32) => "llvm.uadd.with.overflow.i32", + Uint(U64) => "llvm.uadd.with.overflow.i64", + Uint(U128) => "llvm.uadd.with.overflow.i128", + + _ => unreachable!(), + }, + OverflowOp::Sub => match new_sty { + Int(I8) => "llvm.ssub.with.overflow.i8", + Int(I16) => "llvm.ssub.with.overflow.i16", + Int(I32) => "llvm.ssub.with.overflow.i32", + Int(I64) => "llvm.ssub.with.overflow.i64", + Int(I128) => "llvm.ssub.with.overflow.i128", + + Uint(U8) => "llvm.usub.with.overflow.i8", + Uint(U16) => "llvm.usub.with.overflow.i16", + Uint(U32) => "llvm.usub.with.overflow.i32", + Uint(U64) => "llvm.usub.with.overflow.i64", + Uint(U128) => "llvm.usub.with.overflow.i128", + + _ => unreachable!(), + }, + OverflowOp::Mul => match new_sty { + Int(I8) => "llvm.smul.with.overflow.i8", + Int(I16) => "llvm.smul.with.overflow.i16", + Int(I32) => "llvm.smul.with.overflow.i32", + Int(I64) => "llvm.smul.with.overflow.i64", + Int(I128) => "llvm.smul.with.overflow.i128", + + Uint(U8) => "llvm.umul.with.overflow.i8", + Uint(U16) => "llvm.umul.with.overflow.i16", + Uint(U32) => "llvm.umul.with.overflow.i32", + Uint(U64) => "llvm.umul.with.overflow.i64", + Uint(U128) => "llvm.umul.with.overflow.i128", + + _ => unreachable!(), + }, + }; + + let intrinsic = self.get_intrinsic(&name); + let res = self.call(intrinsic, &[lhs, rhs], None); + ( + self.extract_value(res, 0), + self.extract_value(res, 1), + ) + } + fn alloca(&mut self, ty: &'ll Type, name: &str, align: Align) -> &'ll Value { let mut bx = Builder::with_cx(self.cx); bx.position_at_start(unsafe { @@ -475,7 +546,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { llvm::LLVMBuildAlloca(self.llbuilder, ty, name.as_ptr()) }; - llvm::LLVMSetAlignment(alloca, align.abi() as c_uint); + llvm::LLVMSetAlignment(alloca, align.bytes() as c_uint); alloca } } @@ -494,7 +565,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { llvm::LLVMBuildArrayAlloca(self.llbuilder, ty, len, name.as_ptr()) }; - llvm::LLVMSetAlignment(alloca, align.abi() as c_uint); + llvm::LLVMSetAlignment(alloca, align.bytes() as c_uint); alloca } } @@ -503,7 +574,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { self.count_insn("load"); unsafe { let load = llvm::LLVMBuildLoad(self.llbuilder, ptr, noname()); - llvm::LLVMSetAlignment(load, align.abi() as c_uint); + llvm::LLVMSetAlignment(load, align.bytes() as c_uint); load } } @@ -557,7 +628,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { let vr = scalar.valid_range.clone(); match scalar.value { layout::Int(..) => { - let range = scalar.valid_range_exclusive(bx.cx()); + let range = scalar.valid_range_exclusive(bx); if range.start != range.end { bx.range_metadata(load, range); } @@ -589,17 +660,23 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { }); OperandValue::Immediate(to_immediate(self, llval, place.layout)) } else if let layout::Abi::ScalarPair(ref a, ref b) = place.layout.abi { - let mut load = |i, scalar: &layout::Scalar| { + let b_offset = a.value.size(self).align_to(b.value.align(self).abi); + + let mut load = |i, scalar: &layout::Scalar, align| { let llptr = self.struct_gep(place.llval, i as u64); - let load = self.load(llptr, place.align); + let load = self.load(llptr, align); scalar_load_metadata(self, load, scalar); if scalar.is_bool() { - self.trunc(load, self.cx().type_i1()) + self.trunc(load, self.type_i1()) } else { load } }; - OperandValue::Pair(load(0, a), load(1, b)) + + OperandValue::Pair( + load(0, a, place.align), + load(1, b, place.align.restrict_for_offset(b_offset)), + ) } else { OperandValue::Ref(place.llval, None, place.align) }; @@ -610,7 +687,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { fn range_metadata(&mut self, load: &'ll Value, range: Range) { - if self.cx().sess().target.target.arch == "amdgpu" { + if self.sess().target.target.arch == "amdgpu" { // amdgpu/LLVM does something weird and thinks a i64 value is // split into a v2i32, halving the bitwidth LLVM expects, // tripping an assertion. So, for now, just disable this @@ -658,7 +735,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { let align = if flags.contains(MemFlags::UNALIGNED) { 1 } else { - align.abi() as c_uint + align.bytes() as c_uint }; llvm::LLVMSetAlignment(store, align); if flags.contains(MemFlags::VOLATILE) { @@ -856,7 +933,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { }).collect::>(); debug!("Asm Output Type: {:?}", output); - let fty = self.cx().type_func(&argtys[..], output); + let fty = self.type_func(&argtys[..], output); unsafe { // Ask LLVM to verify that the constraints are well-formed. let constraints_ok = llvm::LLVMRustInlineAsmVerify(fty, cons.as_ptr()); @@ -884,17 +961,17 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { if flags.contains(MemFlags::NONTEMPORAL) { // HACK(nox): This is inefficient but there is no nontemporal memcpy. let val = self.load(src, src_align); - let ptr = self.pointercast(dst, self.cx().type_ptr_to(self.cx().val_ty(val))); + let ptr = self.pointercast(dst, self.type_ptr_to(self.val_ty(val))); self.store_with_flags(val, ptr, dst_align, flags); return; } - let size = self.intcast(size, self.cx().type_isize(), false); + let size = self.intcast(size, self.type_isize(), false); let is_volatile = flags.contains(MemFlags::VOLATILE); - let dst = self.pointercast(dst, self.cx().type_i8p()); - let src = self.pointercast(src, self.cx().type_i8p()); + let dst = self.pointercast(dst, self.type_i8p()); + let src = self.pointercast(src, self.type_i8p()); unsafe { - llvm::LLVMRustBuildMemCpy(self.llbuilder, dst, dst_align.abi() as c_uint, - src, src_align.abi() as c_uint, size, is_volatile); + llvm::LLVMRustBuildMemCpy(self.llbuilder, dst, dst_align.bytes() as c_uint, + src, src_align.bytes() as c_uint, size, is_volatile); } } @@ -904,17 +981,17 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { if flags.contains(MemFlags::NONTEMPORAL) { // HACK(nox): This is inefficient but there is no nontemporal memmove. let val = self.load(src, src_align); - let ptr = self.pointercast(dst, self.cx().type_ptr_to(self.cx().val_ty(val))); + let ptr = self.pointercast(dst, self.type_ptr_to(self.val_ty(val))); self.store_with_flags(val, ptr, dst_align, flags); return; } - let size = self.intcast(size, self.cx().type_isize(), false); + let size = self.intcast(size, self.type_isize(), false); let is_volatile = flags.contains(MemFlags::VOLATILE); - let dst = self.pointercast(dst, self.cx().type_i8p()); - let src = self.pointercast(src, self.cx().type_i8p()); + let dst = self.pointercast(dst, self.type_i8p()); + let src = self.pointercast(src, self.type_i8p()); unsafe { - llvm::LLVMRustBuildMemMove(self.llbuilder, dst, dst_align.abi() as c_uint, - src, src_align.abi() as c_uint, size, is_volatile); + llvm::LLVMRustBuildMemMove(self.llbuilder, dst, dst_align.bytes() as c_uint, + src, src_align.bytes() as c_uint, size, is_volatile); } } @@ -926,28 +1003,22 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { align: Align, flags: MemFlags, ) { - let ptr_width = &self.cx().sess().target.target.target_pointer_width; + let ptr_width = &self.sess().target.target.target_pointer_width; let intrinsic_key = format!("llvm.memset.p0i8.i{}", ptr_width); - let llintrinsicfn = self.cx().get_intrinsic(&intrinsic_key); - let ptr = self.pointercast(ptr, self.cx().type_i8p()); - let align = self.cx().const_u32(align.abi() as u32); - let volatile = self.cx().const_bool(flags.contains(MemFlags::VOLATILE)); + let llintrinsicfn = self.get_intrinsic(&intrinsic_key); + let ptr = self.pointercast(ptr, self.type_i8p()); + let align = self.const_u32(align.bytes() as u32); + let volatile = self.const_bool(flags.contains(MemFlags::VOLATILE)); self.call(llintrinsicfn, &[ptr, fill_byte, size, align, volatile], None); } fn minnum(&mut self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value { self.count_insn("minnum"); - unsafe { - let instr = llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs); - instr.expect("LLVMRustBuildMinNum is not available in LLVM version < 6.0") - } + unsafe { llvm::LLVMRustBuildMinNum(self.llbuilder, lhs, rhs) } } fn maxnum(&mut self, lhs: &'ll Value, rhs: &'ll Value) -> &'ll Value { self.count_insn("maxnum"); - unsafe { - let instr = llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs); - instr.expect("LLVMRustBuildMaxNum is not available in LLVM version < 6.0") - } + unsafe { llvm::LLVMRustBuildMaxNum(self.llbuilder, lhs, rhs) } } fn select( @@ -997,10 +1068,10 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { fn vector_splat(&mut self, num_elts: usize, elt: &'ll Value) -> &'ll Value { unsafe { let elt_ty = self.cx.val_ty(elt); - let undef = llvm::LLVMGetUndef(self.cx().type_vector(elt_ty, num_elts as u64)); + let undef = llvm::LLVMGetUndef(self.type_vector(elt_ty, num_elts as u64)); let vec = self.insert_element(undef, elt, self.cx.const_i32(0)); - let vec_i32_ty = self.cx().type_vector(self.cx().type_i32(), num_elts as u64); - self.shuffle_vector(vec, undef, self.cx().const_null(vec_i32_ty)) + let vec_i32_ty = self.type_vector(self.type_i32(), num_elts as u64); + self.shuffle_vector(vec, undef, self.const_null(vec_i32_ty)) } } @@ -1311,7 +1382,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { let param_tys = self.cx.func_params_types(fn_ty); let all_args_match = param_tys.iter() - .zip(args.iter().map(|&v| self.cx().val_ty(v))) + .zip(args.iter().map(|&v| self.val_ty(v))) .all(|(expected_ty, actual_ty)| *expected_ty == actual_ty); if all_args_match { @@ -1322,7 +1393,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { .zip(args.iter()) .enumerate() .map(|(i, (expected_ty, &actual_val))| { - let actual_ty = self.cx().val_ty(actual_val); + let actual_ty = self.val_ty(actual_val); if expected_ty != actual_ty { debug!("Type mismatch in function call of {:?}. \ Expected {:?} for param {}, got {:?}; injecting bitcast", @@ -1345,22 +1416,6 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { self.call_lifetime_intrinsic("llvm.lifetime.end", ptr, size); } - fn call_lifetime_intrinsic(&mut self, intrinsic: &str, ptr: &'ll Value, size: Size) { - if self.cx.sess().opts.optimize == config::OptLevel::No { - return; - } - - let size = size.bytes(); - if size == 0 { - return; - } - - let lifetime_intrinsic = self.cx.get_intrinsic(intrinsic); - - let ptr = self.pointercast(ptr, self.cx.type_i8p()); - self.call(lifetime_intrinsic, &[self.cx.const_u64(size), ptr], None); - } - fn call( &mut self, llfn: &'ll Value, @@ -1415,3 +1470,27 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { llvm::Attribute::NoInline.apply_callsite(llvm::AttributePlace::Function, llret); } } + +impl StaticBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> { + fn get_static(&self, def_id: DefId) -> &'ll Value { + self.cx().get_static(def_id) + } +} + +impl Builder<'a, 'll, 'tcx> { + fn call_lifetime_intrinsic(&mut self, intrinsic: &str, ptr: &'ll Value, size: Size) { + if self.cx.sess().opts.optimize == config::OptLevel::No { + return; + } + + let size = size.bytes(); + if size == 0 { + return; + } + + let lifetime_intrinsic = self.cx.get_intrinsic(intrinsic); + + let ptr = self.pointercast(ptr, self.cx.type_i8p()); + self.call(lifetime_intrinsic, &[self.cx.const_u64(size), ptr], None); + } +} diff --git a/src/librustc_codegen_llvm/callee.rs b/src/librustc_codegen_llvm/callee.rs index e79880e8de0..0d9d6aa5aa2 100644 --- a/src/librustc_codegen_llvm/callee.rs +++ b/src/librustc_codegen_llvm/callee.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Handles codegen of callees as well as other call-related //! things. Callees are a superset of normal rust values and sometimes //! have different representations. In particular, top-level fn items @@ -81,7 +71,7 @@ pub fn get_fn( // other weird situations. Annoying. if cx.val_ty(llfn) != llptrty { debug!("get_fn: casting {:?} to {:?}", llfn, llptrty); - cx.static_ptrcast(llfn, llptrty) + cx.const_ptrcast(llfn, llptrty) } else { debug!("get_fn: not casting pointer!"); llfn @@ -94,7 +84,7 @@ pub fn get_fn( if instance.def.is_inline(tcx) { attributes::inline(cx, llfn, attributes::InlineAttr::Hint); } - attributes::from_fn_attrs(cx, llfn, Some(instance.def.def_id())); + attributes::from_fn_attrs(cx, llfn, Some(instance.def.def_id()), sig); let instance_def_id = instance.def_id(); diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index 2fc505d42db..675d6ccb504 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types, non_snake_case)] //! Code that is useful in various codegen modules. @@ -21,7 +11,7 @@ use value::Value; use rustc_codegen_ssa::traits::*; use rustc::ty::layout::{HasDataLayout, LayoutOf, self, TyLayout, Size}; -use rustc::mir::interpret::{Scalar, AllocType, Allocation}; +use rustc::mir::interpret::{Scalar, AllocKind, Allocation}; use consts::const_alloc_to_llvm; use rustc_codegen_ssa::mir::place::PlaceRef; @@ -63,7 +53,7 @@ pub use context::CodegenCx; /// /// Each `Block` may contain an instance of this, indicating whether the block /// is part of a landing pad or not. This is used to make decision about whether -/// to emit `invoke` instructions (e.g. in a landing pad we don't continue to +/// to emit `invoke` instructions (e.g., in a landing pad we don't continue to /// use `invoke`) and also about various function call metadata. /// /// For GNU exceptions (`landingpad` + `resume` instructions) this structure is @@ -98,7 +88,6 @@ impl BackendTypes for CodegenCx<'ll, 'tcx> { type Value = &'ll Value; type BasicBlock = &'ll BasicBlock; type Type = &'ll Type; - type Context = &'ll llvm::Context; type Funclet = Funclet<'ll>; type DIScope = &'ll llvm::debuginfo::DIScope; @@ -313,13 +302,13 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { if layout.value == layout::Pointer { unsafe { llvm::LLVMConstIntToPtr(llval, llty) } } else { - self.static_bitcast(llval, llty) + self.const_bitcast(llval, llty) } }, Scalar::Ptr(ptr) => { - let alloc_type = self.tcx.alloc_map.lock().get(ptr.alloc_id); - let base_addr = match alloc_type { - Some(AllocType::Memory(alloc)) => { + let alloc_kind = self.tcx.alloc_map.lock().get(ptr.alloc_id); + let base_addr = match alloc_kind { + Some(AllocKind::Memory(alloc)) => { let init = const_alloc_to_llvm(self, alloc); if alloc.mutability == Mutability::Mutable { self.static_addr_of_mut(init, alloc.align, None) @@ -327,24 +316,24 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { self.static_addr_of(init, alloc.align, None) } } - Some(AllocType::Function(fn_instance)) => { + Some(AllocKind::Function(fn_instance)) => { self.get_fn(fn_instance) } - Some(AllocType::Static(def_id)) => { + Some(AllocKind::Static(def_id)) => { assert!(self.tcx.is_static(def_id).is_some()); self.get_static(def_id) } None => bug!("missing allocation {:?}", ptr.alloc_id), }; let llval = unsafe { llvm::LLVMConstInBoundsGEP( - self.static_bitcast(base_addr, self.type_i8p()), + self.const_bitcast(base_addr, self.type_i8p()), &self.const_usize(ptr.offset.bytes()), 1, ) }; if layout.value != layout::Pointer { unsafe { llvm::LLVMConstPtrToInt(llval, llty) } } else { - self.static_bitcast(llval, llty) + self.const_bitcast(llval, llty) } } } @@ -357,16 +346,20 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { offset: Size, ) -> PlaceRef<'tcx, &'ll Value> { let init = const_alloc_to_llvm(self, alloc); - let base_addr = self.static_addr_of(init, layout.align, None); + let base_addr = self.static_addr_of(init, layout.align.abi, None); let llval = unsafe { llvm::LLVMConstInBoundsGEP( - self.static_bitcast(base_addr, self.type_i8p()), + self.const_bitcast(base_addr, self.type_i8p()), &self.const_usize(offset.bytes()), 1, )}; - let llval = self.static_bitcast(llval, self.type_ptr_to(layout.llvm_type(self))); + let llval = self.const_bitcast(llval, self.type_ptr_to(layout.llvm_type(self))); PlaceRef::new_sized(llval, layout, alloc.align) } + + fn const_ptrcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value { + consts::ptrcast(val, ty) + } } pub fn val_ty(v: &'ll Value) -> &'ll Type { diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index 821ac931aac..b7a9382c338 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use libc::c_uint; use llvm::{self, SetUnnamedAddr, True}; use rustc::hir::def_id::DefId; @@ -94,7 +84,7 @@ fn set_global_alignment(cx: &CodegenCx<'ll, '_>, // Note: GCC and Clang also allow `__attribute__((aligned))` on variables, // which can force it to be smaller. Rust doesn't support this yet. if let Some(min) = cx.sess().target.target.options.min_global_align { - match ty::layout::Align::from_bits(min, min) { + match Align::from_bits(min) { Ok(min) => align = align.max(min), Err(err) => { cx.sess().err(&format!("invalid minimum global alignment: {}", err)); @@ -102,7 +92,7 @@ fn set_global_alignment(cx: &CodegenCx<'ll, '_>, } } unsafe { - llvm::LLVMSetAlignment(gv, align.abi() as u32); + llvm::LLVMSetAlignment(gv, align.bytes() as u32); } } @@ -171,19 +161,14 @@ pub fn ptrcast(val: &'ll Value, ty: &'ll Type) -> &'ll Value { } } -impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> { - - fn static_ptrcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value { - ptrcast(val, ty) - } - - fn static_bitcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value { +impl CodegenCx<'ll, 'tcx> { + crate fn const_bitcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value { unsafe { llvm::LLVMConstBitCast(val, ty) } } - fn static_addr_of_mut( + crate fn static_addr_of_mut( &self, cv: &'ll Value, align: Align, @@ -209,32 +194,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> { } } - fn static_addr_of( - &self, - cv: &'ll Value, - align: Align, - kind: Option<&str>, - ) -> &'ll Value { - if let Some(&gv) = self.const_globals.borrow().get(&cv) { - unsafe { - // Upgrade the alignment in cases where the same constant is used with different - // alignment requirements - let llalign = align.abi() as u32; - if llalign > llvm::LLVMGetAlignment(gv) { - llvm::LLVMSetAlignment(gv, llalign); - } - } - return gv; - } - let gv = self.static_addr_of_mut(cv, align, kind); - unsafe { - llvm::LLVMSetGlobalConstant(gv, True); - } - self.const_globals.borrow_mut().insert(cv, gv); - gv - } - - fn get_static(&self, def_id: DefId) -> &'ll Value { + crate fn get_static(&self, def_id: DefId) -> &'ll Value { let instance = Instance::mono(self.tcx, def_id); if let Some(&g) = self.instances.borrow().get(&instance) { return g; @@ -253,10 +213,10 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> { debug!("get_static: sym={} instance={:?}", sym, instance); - let g = if let Some(id) = self.tcx.hir.as_local_node_id(def_id) { + let g = if let Some(id) = self.tcx.hir().as_local_node_id(def_id) { let llty = self.layout_of(ty).llvm_type(self); - let (g, attrs) = match self.tcx.hir.get(id) { + let (g, attrs) = match self.tcx.hir().get(id) { Node::Item(&hir::Item { ref attrs, span, node: hir::ItemKind::Static(..), .. }) => { @@ -325,7 +285,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> { self.tcx.sess.opts.cg.prefer_dynamic)); if needs_dll_storage_attr { - // This item is external but not foreign, i.e. it originates from an external Rust + // This item is external but not foreign, i.e., it originates from an external Rust // crate. Since we don't know whether this crate will be linked dynamically or // statically in the final application, we always mark such symbols as 'dllimport'. // If final linkage happens to be static, we rely on compiler-emitted __imp_ stubs @@ -354,6 +314,33 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> { self.instances.borrow_mut().insert(instance, g); g } +} + +impl StaticMethods for CodegenCx<'ll, 'tcx> { + fn static_addr_of( + &self, + cv: &'ll Value, + align: Align, + kind: Option<&str>, + ) -> &'ll Value { + if let Some(&gv) = self.const_globals.borrow().get(&cv) { + unsafe { + // Upgrade the alignment in cases where the same constant is used with different + // alignment requirements + let llalign = align.bytes() as u32; + if llalign > llvm::LLVMGetAlignment(gv) { + llvm::LLVMSetAlignment(gv, llalign); + } + } + return gv; + } + let gv = self.static_addr_of_mut(cv, align, kind); + unsafe { + llvm::LLVMSetGlobalConstant(gv, True); + } + self.const_globals.borrow_mut().insert(cv, gv); + gv + } fn codegen_static( &self, @@ -429,7 +416,7 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> { // // By default a global's alignment can be freely increased. // This allows LLVM to generate more performant instructions - // e.g. using load-aligned into a SIMD register. + // e.g., using load-aligned into a SIMD register. // // However, on macOS 10.10 or below, the dynamic linker does not // respect any alignment given on the TLS (radar 24221680). @@ -498,9 +485,4 @@ impl StaticMethods<'tcx> for CodegenCx<'ll, 'tcx> { } } } - unsafe fn static_replace_all_uses(&self, old_g: &'ll Value, new_g: &'ll Value) { - let bitcast = llvm::LLVMConstPointerCast(new_g, self.val_ty(old_g)); - llvm::LLVMReplaceAllUsesWith(old_g, bitcast); - llvm::LLVMDeleteGlobal(old_g); - } } diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 5b088ad2908..f6795588441 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -1,16 +1,5 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use attributes; use llvm; -use llvm_util; use rustc::dep_graph::DepGraphSafe; use rustc::hir; use debuginfo; @@ -61,7 +50,8 @@ pub struct CodegenCx<'ll, 'tcx: 'll> { /// Cache instances of monomorphic and polymorphic items pub instances: RefCell, &'ll Value>>, /// Cache generated vtables - pub vtables: RefCell, ty::PolyExistentialTraitRef<'tcx>), &'ll Value>>, + pub vtables: RefCell, Option>), &'ll Value>>, /// Cache of constant strings, pub const_cstr_cache: RefCell>, @@ -154,16 +144,17 @@ pub fn is_pie_binary(sess: &Session) -> bool { } pub unsafe fn create_module( - sess: &Session, + tcx: TyCtxt, llcx: &'ll llvm::Context, mod_name: &str, ) -> &'ll llvm::Module { + let sess = tcx.sess; let mod_name = SmallCStr::new(mod_name); let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx); // Ensure the data-layout values hardcoded remain the defaults. if sess.target.target.options.is_builtin { - let tm = ::back::write::create_target_machine(sess, false); + let tm = ::back::write::create_target_machine(tcx, false); llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm); llvm::LLVMRustDisposeTargetMachine(tm); @@ -233,7 +224,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { // they're not available to be linked against. This poses a few problems // for the compiler, some of which are somewhat fundamental, but we use // the `use_dll_storage_attrs` variable below to attach the `dllexport` - // attribute to all LLVM functions that are exported e.g. they're + // attribute to all LLVM functions that are exported e.g., they're // already tagged with external linkage). This is suboptimal for a few // reasons: // @@ -314,11 +305,15 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { local_gen_sym_counter: Cell::new(0), } } + + crate fn statics_to_rauw(&self) -> &RefCell> { + &self.statics_to_rauw + } } impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn vtables(&self) -> &RefCell, - ty::PolyExistentialTraitRef<'tcx>), &'ll Value>> + Option>), &'ll Value>> { &self.vtables } @@ -328,7 +323,7 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> { } fn get_fn(&self, instance: Instance<'tcx>) -> &'ll Value { - get_fn(&&self,instance) + get_fn(self, instance) } fn get_param(&self, llfn: &'ll Value, index: c_uint) -> &'ll Value { @@ -405,7 +400,6 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> { )); let llfn = self.declare_fn("rust_eh_unwind_resume", sig); - attributes::unwind(llfn, true); attributes::apply_target_cpu_attr(self, llfn); unwresume.set(Some(llfn)); llfn @@ -431,10 +425,6 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> { &self.codegen_unit } - fn statics_to_rauw(&self) -> &RefCell> { - &self.statics_to_rauw - } - fn used_statics(&self) -> &RefCell> { &self.used_statics } @@ -447,10 +437,6 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> { attributes::apply_target_cpu_attr(self, llfn) } - fn closure_env_needs_indirect_debuginfo(&self) -> bool { - llvm_util::get_major_version() < 6 - } - fn create_used_variable(&self) { let name = const_cstr!("llvm.used"); let section = const_cstr!("llvm.metadata"); @@ -470,8 +456,8 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> { } } -impl IntrinsicDeclarationMethods<'tcx> for CodegenCx<'b, 'tcx> { - fn get_intrinsic(&self, key: &str) -> &'b Value { +impl CodegenCx<'b, 'tcx> { + crate fn get_intrinsic(&self, key: &str) -> &'b Value { if let Some(v) = self.intrinsics.borrow().get(key).cloned() { return v; } @@ -723,17 +709,17 @@ impl IntrinsicDeclarationMethods<'tcx> for CodegenCx<'b, 'tcx> { ifn!("llvm.bitreverse.i64", fn(t_i64) -> t_i64); ifn!("llvm.bitreverse.i128", fn(t_i128) -> t_i128); - ifn!("llvm.fshl.i8", fn(t_i8, t_i8, t_i8) -> t_i8); - ifn!("llvm.fshl.i16", fn(t_i16, t_i16, t_i16) -> t_i16); - ifn!("llvm.fshl.i32", fn(t_i32, t_i32, t_i32) -> t_i32); - ifn!("llvm.fshl.i64", fn(t_i64, t_i64, t_i64) -> t_i64); - ifn!("llvm.fshl.i128", fn(t_i128, t_i128, t_i128) -> t_i128); + ifn!("llvm.fshl.i8", fn(t_i8, t_i8, t_i8) -> t_i8); + ifn!("llvm.fshl.i16", fn(t_i16, t_i16, t_i16) -> t_i16); + ifn!("llvm.fshl.i32", fn(t_i32, t_i32, t_i32) -> t_i32); + ifn!("llvm.fshl.i64", fn(t_i64, t_i64, t_i64) -> t_i64); + ifn!("llvm.fshl.i128", fn(t_i128, t_i128, t_i128) -> t_i128); - ifn!("llvm.fshr.i8", fn(t_i8, t_i8, t_i8) -> t_i8); - ifn!("llvm.fshr.i16", fn(t_i16, t_i16, t_i16) -> t_i16); - ifn!("llvm.fshr.i32", fn(t_i32, t_i32, t_i32) -> t_i32); - ifn!("llvm.fshr.i64", fn(t_i64, t_i64, t_i64) -> t_i64); - ifn!("llvm.fshr.i128", fn(t_i128, t_i128, t_i128) -> t_i128); + ifn!("llvm.fshr.i8", fn(t_i8, t_i8, t_i8) -> t_i8); + ifn!("llvm.fshr.i16", fn(t_i16, t_i16, t_i16) -> t_i16); + ifn!("llvm.fshr.i32", fn(t_i32, t_i32, t_i32) -> t_i32); + ifn!("llvm.fshr.i64", fn(t_i64, t_i64, t_i64) -> t_i64); + ifn!("llvm.fshr.i128", fn(t_i128, t_i128, t_i128) -> t_i128); ifn!("llvm.sadd.with.overflow.i8", fn(t_i8, t_i8) -> mk_struct!{t_i8, i1}); ifn!("llvm.sadd.with.overflow.i16", fn(t_i16, t_i16) -> mk_struct!{t_i16, i1}); @@ -771,6 +757,30 @@ impl IntrinsicDeclarationMethods<'tcx> for CodegenCx<'b, 'tcx> { ifn!("llvm.umul.with.overflow.i64", fn(t_i64, t_i64) -> mk_struct!{t_i64, i1}); ifn!("llvm.umul.with.overflow.i128", fn(t_i128, t_i128) -> mk_struct!{t_i128, i1}); + ifn!("llvm.sadd.sat.i8", fn(t_i8, t_i8) -> t_i8); + ifn!("llvm.sadd.sat.i16", fn(t_i16, t_i16) -> t_i16); + ifn!("llvm.sadd.sat.i32", fn(t_i32, t_i32) -> t_i32); + ifn!("llvm.sadd.sat.i64", fn(t_i64, t_i64) -> t_i64); + ifn!("llvm.sadd.sat.i128", fn(t_i128, t_i128) -> t_i128); + + ifn!("llvm.uadd.sat.i8", fn(t_i8, t_i8) -> t_i8); + ifn!("llvm.uadd.sat.i16", fn(t_i16, t_i16) -> t_i16); + ifn!("llvm.uadd.sat.i32", fn(t_i32, t_i32) -> t_i32); + ifn!("llvm.uadd.sat.i64", fn(t_i64, t_i64) -> t_i64); + ifn!("llvm.uadd.sat.i128", fn(t_i128, t_i128) -> t_i128); + + ifn!("llvm.ssub.sat.i8", fn(t_i8, t_i8) -> t_i8); + ifn!("llvm.ssub.sat.i16", fn(t_i16, t_i16) -> t_i16); + ifn!("llvm.ssub.sat.i32", fn(t_i32, t_i32) -> t_i32); + ifn!("llvm.ssub.sat.i64", fn(t_i64, t_i64) -> t_i64); + ifn!("llvm.ssub.sat.i128", fn(t_i128, t_i128) -> t_i128); + + ifn!("llvm.usub.sat.i8", fn(t_i8, t_i8) -> t_i8); + ifn!("llvm.usub.sat.i16", fn(t_i16, t_i16) -> t_i16); + ifn!("llvm.usub.sat.i32", fn(t_i32, t_i32) -> t_i32); + ifn!("llvm.usub.sat.i64", fn(t_i64, t_i64) -> t_i64); + ifn!("llvm.usub.sat.i128", fn(t_i128, t_i128) -> t_i128); + ifn!("llvm.lifetime.start", fn(t_i64,i8p) -> void); ifn!("llvm.lifetime.end", fn(t_i64, i8p) -> void); @@ -783,6 +793,11 @@ impl IntrinsicDeclarationMethods<'tcx> for CodegenCx<'b, 'tcx> { ifn!("llvm.assume", fn(i1) -> void); ifn!("llvm.prefetch", fn(i8p, t_i32, t_i32, t_i32) -> void); + // variadic intrinsics + ifn!("llvm.va_start", fn(i8p) -> void); + ifn!("llvm.va_end", fn(i8p) -> void); + ifn!("llvm.va_copy", fn(i8p, i8p) -> void); + if self.sess().opts.debuginfo != DebugInfo::None { ifn!("llvm.dbg.declare", fn(self.type_metadata(), self.type_metadata()) -> void); ifn!("llvm.dbg.value", fn(self.type_metadata(), t_i64, self.type_metadata()) -> void); diff --git a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs index c18e126e520..dbd821865f9 100644 --- a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs +++ b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_codegen_ssa::debuginfo::{FunctionDebugContext, FunctionDebugContextData, MirDebugScope}; use super::metadata::file_metadata; use super::utils::{DIB, span_start}; diff --git a/src/librustc_codegen_llvm/debuginfo/doc.rs b/src/librustc_codegen_llvm/debuginfo/doc.rs index ce0476b07eb..a4acc58eca9 100644 --- a/src/librustc_codegen_llvm/debuginfo/doc.rs +++ b/src/librustc_codegen_llvm/debuginfo/doc.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! # Debug Info Module //! //! This module serves the purpose of generating debug symbols. We use LLVM's @@ -166,7 +156,7 @@ //! //! (3) Tuple-, pointer and function types are structurally identified, which //! means that they are equivalent if their component types are equivalent -//! (i.e. (i32, i32) is the same regardless in which crate it is used). +//! (i.e., (i32, i32) is the same regardless in which crate it is used). //! //! This algorithm also provides a stable ID for types that are defined in one //! crate but instantiated from metadata within another crate. We just have to diff --git a/src/librustc_codegen_llvm/debuginfo/gdb.rs b/src/librustc_codegen_llvm/debuginfo/gdb.rs index 0046a072366..c883d603095 100644 --- a/src/librustc_codegen_llvm/debuginfo/gdb.rs +++ b/src/librustc_codegen_llvm/debuginfo/gdb.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // .debug_gdb_scripts binary section. use llvm; @@ -24,11 +14,11 @@ use syntax::attr; /// Inserts a side-effect free instruction sequence that makes sure that the /// .debug_gdb_scripts global is referenced, so it isn't removed by the linker. pub fn insert_reference_to_gdb_debug_scripts_section_global(bx: &mut Builder) { - if needs_gdb_debug_scripts_section(bx.cx()) { - let gdb_debug_scripts_section = get_or_insert_gdb_debug_scripts_section_global(bx.cx()); + if needs_gdb_debug_scripts_section(bx) { + let gdb_debug_scripts_section = get_or_insert_gdb_debug_scripts_section_global(bx); // Load just the first byte as that's all that's necessary to force // LLVM to keep around the reference to the global. - let indices = [bx.cx().const_i32(0), bx.cx().const_i32(0)]; + let indices = [bx.const_i32(0), bx.const_i32(0)]; let element = bx.inbounds_gep(gdb_debug_scripts_section, &indices); let volative_load_instruction = bx.volatile_load(element); unsafe { @@ -76,7 +66,7 @@ pub fn get_or_insert_gdb_debug_scripts_section_global(cx: &CodegenCx<'ll, '_>) pub fn needs_gdb_debug_scripts_section(cx: &CodegenCx) -> bool { let omit_gdb_pretty_printer_section = - attr::contains_name(&cx.tcx.hir.krate_attrs(), + attr::contains_name(&cx.tcx.hir().krate_attrs(), "omit_gdb_pretty_printer_section"); !omit_gdb_pretty_printer_section && diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 1c787a96932..3a7864cb7a5 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use self::RecursiveTypeDescription::*; use self::MemberDescriptionFactory::*; use self::EnumDiscriminantInfo::*; @@ -22,8 +12,8 @@ use abi; use value::Value; use llvm; -use llvm::debuginfo::{DIType, DIFile, DIScope, DIDescriptor, - DICompositeType, DILexicalBlock, DIFlags}; +use llvm::debuginfo::{DIArray, DIType, DIFile, DIScope, DIDescriptor, + DICompositeType, DILexicalBlock, DIFlags, DebugEmissionKind}; use llvm_util; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; @@ -35,12 +25,14 @@ use rustc_data_structures::fingerprint::Fingerprint; use rustc::ty::Instance; use common::CodegenCx; use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt}; -use rustc::ty::layout::{self, Align, HasDataLayout, Integer, IntegerExt, LayoutOf, +use rustc::ty::layout::{self, Align, Integer, IntegerExt, LayoutOf, PrimitiveExt, Size, TyLayout}; +use rustc::ty::subst::UnpackedKind; use rustc::session::config; use rustc::util::nodemap::FxHashMap; -use rustc_fs_util::path2cstr; +use rustc_fs_util::path_to_c_string; use rustc_data_structures::small_c_str::SmallCStr; +use rustc_target::abi::HasDataLayout; use libc::{c_uint, c_longlong}; use std::ffi::CString; @@ -55,7 +47,7 @@ use syntax_pos::{self, Span, FileName}; impl PartialEq for llvm::Metadata { fn eq(&self, other: &Self) -> bool { - self as *const _ == other as *const _ + ptr::eq(self, other) } } @@ -273,6 +265,7 @@ impl RecursiveTypeDescription<'ll, 'tcx> { // ... and attach them to the stub to complete it. set_members_of_composite_type(cx, + unfinished_type, member_holding_stub, member_descriptions); return MetadataCreationResult::new(metadata_stub, true); @@ -323,7 +316,7 @@ fn fixed_vec_metadata( llvm::LLVMRustDIBuilderCreateArrayType( DIB(cx), size.bits(), - align.abi_bits() as u32, + align.bits() as u32, element_type_metadata, subscripts) }; @@ -436,7 +429,8 @@ fn trait_pointer_metadata( // But it does not describe the trait's methods. let containing_scope = match trait_type.sty { - ty::Dynamic(ref data, ..) => Some(get_namespace_for_item(cx, data.principal().def_id())), + ty::Dynamic(ref data, ..) => + data.principal_def_id().map(|did| get_namespace_for_item(cx, did)), _ => { bug!("debuginfo: Unexpected trait-object type in \ trait_pointer_metadata(): {:?}", @@ -465,7 +459,7 @@ fn trait_pointer_metadata( syntax_pos::DUMMY_SP), offset: layout.fields.offset(0), size: data_ptr_field.size, - align: data_ptr_field.align, + align: data_ptr_field.align.abi, flags: DIFlags::FlagArtificial, discriminant: None, }, @@ -474,7 +468,7 @@ fn trait_pointer_metadata( type_metadata: type_metadata(cx, vtable_field.ty, syntax_pos::DUMMY_SP), offset: layout.fields.offset(1), size: vtable_field.size, - align: vtable_field.align, + align: vtable_field.align.abi, flags: DIFlags::FlagArtificial, discriminant: None, }, @@ -506,7 +500,7 @@ pub fn type_metadata( }, None => { // The Ty is not in the TypeMap but maybe we have already seen - // an equivalent type (e.g. only differing in region arguments). + // an equivalent type (e.g., only differing in region arguments). // In order to find out, generate the unique type id and look // that up. let unique_type_id = type_map.get_unique_type_id_of_type(cx, t); @@ -787,7 +781,7 @@ fn basic_type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll DIType { DIB(cx), name.as_ptr(), size.bits(), - align.abi_bits() as u32, + align.bits() as u32, encoding) }; @@ -818,7 +812,7 @@ fn pointer_type_metadata( DIB(cx), pointee_type_metadata, pointer_size.bits(), - pointer_align.abi_bits() as u32, + pointer_align.bits() as u32, name.as_ptr()) } } @@ -852,6 +846,7 @@ pub fn compile_unit_metadata(tcx: TyCtxt, let producer = CString::new(producer).unwrap(); let flags = "\0"; let split_name = "\0"; + let kind = DebugEmissionKind::from_generic(tcx.sess.opts.debuginfo); unsafe { let file_metadata = llvm::LLVMRustDIBuilderCreateFile( @@ -865,7 +860,8 @@ pub fn compile_unit_metadata(tcx: TyCtxt, tcx.sess.opts.optimize != config::OptLevel::No, flags.as_ptr() as *const _, 0, - split_name.as_ptr() as *const _); + split_name.as_ptr() as *const _, + kind); if tcx.sess.opts.debugging_opts.profile { let cu_desc_metadata = llvm::LLVMRustMetadataAsValue(debug_context.llcontext, @@ -892,7 +888,7 @@ pub fn compile_unit_metadata(tcx: TyCtxt, }; fn path_to_mdstring(llcx: &'ll llvm::Context, path: &Path) -> &'ll Value { - let path_str = path2cstr(path); + let path_str = path_to_c_string(path); unsafe { llvm::LLVMMDStringInContext(llcx, path_str.as_ptr(), @@ -985,13 +981,12 @@ impl<'tcx> StructMemberDescriptionFactory<'tcx> { f.ident.to_string() }; let field = layout.field(cx, i); - let (size, align) = field.size_and_align(); MemberDescription { name, type_metadata: type_metadata(cx, field.ty, self.span), offset: layout.fields.offset(i), - size, - align, + size: field.size, + align: field.align.abi, flags: DIFlags::FlagZero, discriminant: None, } @@ -1109,13 +1104,12 @@ impl<'tcx> UnionMemberDescriptionFactory<'tcx> { -> Vec> { self.variant.fields.iter().enumerate().map(|(i, f)| { let field = self.layout.field(cx, i); - let (size, align) = field.size_and_align(); MemberDescription { name: f.ident.to_string(), type_metadata: type_metadata(cx, field.ty, self.span), offset: Size::ZERO, - size, - align, + size: field.size, + align: field.align.abi, flags: DIFlags::FlagZero, discriminant: None, } @@ -1172,7 +1166,10 @@ fn use_enum_fallback(cx: &CodegenCx) -> bool { // On MSVC we have to use the fallback mode, because LLVM doesn't // lower variant parts to PDB. return cx.sess().target.target.options.is_like_msvc - || llvm_util::get_major_version() < 7; + // LLVM version 7 did not release with an important bug fix; + // but the required patch is in the LLVM 8. Rust LLVM reports + // 8 as well. + || llvm_util::get_major_version() < 8; } // Describes the members of an enum value: An enum is described as a union of @@ -1216,6 +1213,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> { member_description_factory.create_member_descriptions(cx); set_members_of_composite_type(cx, + self.enum_type, variant_type_metadata, member_descriptions); vec![ @@ -1223,12 +1221,12 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> { name: if fallback { String::new() } else { - adt.variants[index].name.as_str().to_string() + adt.variants[index].ident.as_str().to_string() }, type_metadata: variant_type_metadata, offset: Size::ZERO, size: self.layout.size, - align: self.layout.align, + align: self.layout.align.abi, flags: DIFlags::FlagZero, discriminant: None, } @@ -1256,18 +1254,19 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> { .create_member_descriptions(cx); set_members_of_composite_type(cx, + self.enum_type, variant_type_metadata, member_descriptions); MemberDescription { name: if fallback { String::new() } else { - adt.variants[i].name.as_str().to_string() + adt.variants[i].ident.as_str().to_string() }, type_metadata: variant_type_metadata, offset: Size::ZERO, size: self.layout.size, - align: self.layout.align, + align: self.layout.align.abi, flags: DIFlags::FlagZero, discriminant: Some(self.layout.ty.ty_adt_def().unwrap() .discriminant_for_variant(cx.tcx, i) @@ -1297,6 +1296,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> { member_description_factory.create_member_descriptions(cx); set_members_of_composite_type(cx, + self.enum_type, variant_type_metadata, variant_member_descriptions); @@ -1327,7 +1327,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> { self.layout, self.layout.fields.offset(0), self.layout.field(cx, 0).size); - name.push_str(&adt.variants[*niche_variants.start()].name.as_str()); + name.push_str(&adt.variants[*niche_variants.start()].ident.as_str()); // Create the (singleton) list of descriptions of union members. vec![ @@ -1336,7 +1336,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> { type_metadata: variant_type_metadata, offset: Size::ZERO, size: variant.size, - align: variant.align, + align: variant.align.abi, flags: DIFlags::FlagZero, discriminant: None, } @@ -1356,6 +1356,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> { .create_member_descriptions(cx); set_members_of_composite_type(cx, + self.enum_type, variant_type_metadata, member_descriptions); @@ -1370,11 +1371,11 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> { }; MemberDescription { - name: adt.variants[i].name.as_str().to_string(), + name: adt.variants[i].ident.as_str().to_string(), type_metadata: variant_type_metadata, offset: Size::ZERO, size: self.layout.size, - align: self.layout.align, + align: self.layout.align.abi, flags: DIFlags::FlagZero, discriminant: niche_value, } @@ -1438,7 +1439,7 @@ fn describe_enum_variant( containing_scope: &'ll DIScope, span: Span, ) -> (&'ll DICompositeType, MemberDescriptionFactory<'ll, 'tcx>) { - let variant_name = variant.name.as_str(); + let variant_name = variant.ident.as_str(); let unique_type_id = debug_context(cx).type_map .borrow_mut() .get_unique_type_id_of_enum_variant( @@ -1532,7 +1533,7 @@ fn prepare_enum_metadata( let enumerators_metadata: Vec<_> = def.discriminants(cx.tcx) .zip(&def.variants) .map(|((_, discr), v)| { - let name = SmallCStr::new(&v.name.as_str()); + let name = SmallCStr::new(&v.ident.as_str()); unsafe { Some(llvm::LLVMRustDIBuilderCreateEnumerator( DIB(cx), @@ -1565,7 +1566,7 @@ fn prepare_enum_metadata( file_metadata, UNKNOWN_LINE_NUMBER, discriminant_size.bits(), - discriminant_align.abi_bits() as u32, + discriminant_align.abi.bits() as u32, create_DIArray(DIB(cx), &enumerators_metadata), discriminant_base_type_metadata, true) }; @@ -1587,8 +1588,6 @@ fn prepare_enum_metadata( _ => {} } - let (enum_type_size, enum_type_align) = layout.size_and_align(); - let enum_name = SmallCStr::new(&enum_name); let unique_type_id_str = SmallCStr::new( debug_context(cx).type_map.borrow().get_unique_type_id_as_string(unique_type_id) @@ -1610,8 +1609,8 @@ fn prepare_enum_metadata( enum_name.as_ptr(), file_metadata, UNKNOWN_LINE_NUMBER, - enum_type_size.bits(), - enum_type_align.abi_bits() as u32, + layout.size.bits(), + layout.align.abi.bits() as u32, DIFlags::FlagZero, None, 0, // RuntimeLang @@ -1659,7 +1658,7 @@ fn prepare_enum_metadata( file_metadata, UNKNOWN_LINE_NUMBER, size.bits(), - align.abi_bits() as u32, + align.abi.bits() as u32, layout.fields.offset(0).bits(), DIFlags::FlagArtificial, discr_metadata)) @@ -1679,7 +1678,7 @@ fn prepare_enum_metadata( file_metadata, UNKNOWN_LINE_NUMBER, size.bits(), - align.abi_bits() as u32, + align.bits() as u32, layout.fields.offset(0).bits(), DIFlags::FlagArtificial, discr_metadata)) @@ -1695,8 +1694,8 @@ fn prepare_enum_metadata( ptr::null_mut(), file_metadata, UNKNOWN_LINE_NUMBER, - enum_type_size.bits(), - enum_type_align.abi_bits() as u32, + layout.size.bits(), + layout.align.abi.bits() as u32, DIFlags::FlagZero, discriminator_metadata, empty_array, @@ -1712,8 +1711,8 @@ fn prepare_enum_metadata( enum_name.as_ptr(), file_metadata, UNKNOWN_LINE_NUMBER, - enum_type_size.bits(), - enum_type_align.abi_bits() as u32, + layout.size.bits(), + layout.align.abi.bits() as u32, DIFlags::FlagZero, None, type_array, @@ -1769,13 +1768,15 @@ fn composite_type_metadata( containing_scope); // ... and immediately create and add the member descriptions. set_members_of_composite_type(cx, + composite_type, composite_type_metadata, member_descriptions); composite_type_metadata } -fn set_members_of_composite_type(cx: &CodegenCx<'ll, '_>, +fn set_members_of_composite_type(cx: &CodegenCx<'ll, 'tcx>, + composite_type: Ty<'tcx>, composite_type_metadata: &'ll DICompositeType, member_descriptions: Vec>) { // In some rare cases LLVM metadata uniquing would lead to an existing type @@ -1807,7 +1808,7 @@ fn set_members_of_composite_type(cx: &CodegenCx<'ll, '_>, unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER, member_description.size.bits(), - member_description.align.abi_bits() as u32, + member_description.align.bits() as u32, member_description.offset.bits(), match member_description.discriminant { None => None, @@ -1819,10 +1820,57 @@ fn set_members_of_composite_type(cx: &CodegenCx<'ll, '_>, }) .collect(); + let type_params = compute_type_parameters(cx, composite_type); unsafe { let type_array = create_DIArray(DIB(cx), &member_metadata[..]); - llvm::LLVMRustDICompositeTypeSetTypeArray( - DIB(cx), composite_type_metadata, type_array); + llvm::LLVMRustDICompositeTypeReplaceArrays( + DIB(cx), composite_type_metadata, Some(type_array), type_params); + } +} + +// Compute the type parameters for a type, if any, for the given +// metadata. +fn compute_type_parameters(cx: &CodegenCx<'ll, 'tcx>, ty: Ty<'tcx>) -> Option<&'ll DIArray> { + if let ty::Adt(def, substs) = ty.sty { + if !substs.types().next().is_none() { + let generics = cx.tcx.generics_of(def.did); + let names = get_parameter_names(cx, generics); + let template_params: Vec<_> = substs.iter().zip(names).filter_map(|(kind, name)| { + if let UnpackedKind::Type(ty) = kind.unpack() { + let actual_type = cx.tcx.normalize_erasing_regions(ParamEnv::reveal_all(), ty); + let actual_type_metadata = + type_metadata(cx, actual_type, syntax_pos::DUMMY_SP); + let name = SmallCStr::new(&name.as_str()); + Some(unsafe { + + Some(llvm::LLVMRustDIBuilderCreateTemplateTypeParameter( + DIB(cx), + None, + name.as_ptr(), + actual_type_metadata, + unknown_file_metadata(cx), + 0, + 0, + )) + }) + } else { + None + } + }).collect(); + + return Some(create_DIArray(DIB(cx), &template_params[..])); + } + } + return Some(create_DIArray(DIB(cx), &[])); + + fn get_parameter_names(cx: &CodegenCx, + generics: &ty::Generics) + -> Vec { + let mut names = generics.parent.map_or(vec![], |def_id| { + get_parameter_names(cx, cx.tcx.generics_of(def_id)) + }); + names.extend(generics.params.iter().map(|param| param.name)); + names } } @@ -1855,7 +1903,7 @@ fn create_struct_stub( unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER, struct_size.bits(), - struct_align.abi_bits() as u32, + struct_align.bits() as u32, DIFlags::FlagZero, None, empty_array, @@ -1893,7 +1941,7 @@ fn create_union_stub( unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER, union_size.bits(), - union_align.abi_bits() as u32, + union_align.bits() as u32, DIFlags::FlagZero, Some(empty_array), 0, // RuntimeLang @@ -1962,7 +2010,7 @@ pub fn create_global_var_metadata( is_local_to_unit, global, None, - global_align.abi() as u32, + global_align.bytes() as u32, ); } } @@ -2000,7 +2048,7 @@ pub fn create_vtable_metadata( unknown_file_metadata(cx), UNKNOWN_LINE_NUMBER, Size::ZERO.bits(), - cx.tcx.data_layout.pointer_align.abi_bits() as u32, + cx.tcx.data_layout.pointer_align.abi.bits() as u32, DIFlags::FlagArtificial, None, empty_array, diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index 1c58c0dbbbd..39325b69867 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // See doc.rs for documentation. mod doc; @@ -23,9 +13,9 @@ use self::source_loc::InternalDebugLocation::{self, UnknownLocation}; use llvm; use llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilder, DISubprogram, DIArray, DIFlags, - DILexicalBlock}; + DISPFlags, DILexicalBlock}; use rustc::hir::CodegenFnAttrFlags; -use rustc::hir::def_id::{DefId, CrateNum}; +use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE}; use rustc::ty::subst::{Substs, UnpackedKind}; use abi::Abi; @@ -202,7 +192,7 @@ impl DebugInfoBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> { cx.sess().opts.optimize != config::OptLevel::No, DIFlags::FlagZero, argument_index, - align.abi() as u32, + align.bytes() as u32, ) }; source_loc::set_debug_location(self, @@ -294,16 +284,14 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { let linkage_name = mangled_name_of_instance(self, instance); let scope_line = span_start(self, span).line; - let is_local_to_unit = is_node_local_to_unit(self, def_id); let function_name = CString::new(name).unwrap(); let linkage_name = SmallCStr::new(&linkage_name.as_str()); let mut flags = DIFlags::FlagPrototyped; - let local_id = self.tcx().hir.as_local_node_id(def_id); - if let Some((id, _, _)) = *self.sess().entry_fn.borrow() { - if local_id == Some(id) { + if let Some((id, _)) = self.tcx.entry_fn(LOCAL_CRATE) { + if id == def_id { flags |= DIFlags::FlagMainSubprogram; } } @@ -312,6 +300,14 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { flags |= DIFlags::FlagNoReturn; } + let mut spflags = DISPFlags::SPFlagDefinition; + if is_node_local_to_unit(self, def_id) { + spflags |= DISPFlags::SPFlagLocalToUnit; + } + if self.sess().opts.optimize != config::OptLevel::No { + spflags |= DISPFlags::SPFlagOptimized; + } + let fn_metadata = unsafe { llvm::LLVMRustDIBuilderCreateFunction( DIB(self), @@ -321,11 +317,9 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { file_metadata, loc.line as c_uint, function_type_metadata, - is_local_to_unit, - true, scope_line as c_uint, flags, - self.sess().opts.optimize != config::OptLevel::No, + spflags, llfn, template_parameters, None) @@ -489,7 +483,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { ); // Only "class" methods are generally understood by LLVM, - // so avoid methods on other types (e.g. `<*mut T>::null`). + // so avoid methods on other types (e.g., `<*mut T>::null`). match impl_self_ty.sty { ty::Adt(def, ..) if !def.is_box() => { Some(type_metadata(cx, impl_self_ty, syntax_pos::DUMMY_SP)) diff --git a/src/librustc_codegen_llvm/debuginfo/namespace.rs b/src/librustc_codegen_llvm/debuginfo/namespace.rs index 06f8a4b131b..36188b8fc47 100644 --- a/src/librustc_codegen_llvm/debuginfo/namespace.rs +++ b/src/librustc_codegen_llvm/debuginfo/namespace.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Namespace Handling. use super::metadata::{unknown_file_metadata, UNKNOWN_LINE_NUMBER}; diff --git a/src/librustc_codegen_llvm/debuginfo/source_loc.rs b/src/librustc_codegen_llvm/debuginfo/source_loc.rs index c6772e8c98e..ccf56c11e73 100644 --- a/src/librustc_codegen_llvm/debuginfo/source_loc.rs +++ b/src/librustc_codegen_llvm/debuginfo/source_loc.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use self::InternalDebugLocation::*; use super::utils::{debug_context, span_start}; @@ -41,7 +31,7 @@ pub fn set_source_location( }; let dbg_loc = if function_debug_context.source_locations_enabled.get() { - debug!("set_source_location: {}", bx.cx().sess().source_map().span_to_string(span)); + debug!("set_source_location: {}", bx.sess().source_map().span_to_string(span)); let loc = span_start(bx.cx(), span); InternalDebugLocation::new(scope.unwrap(), loc.line, loc.col.to_usize()) } else { @@ -76,7 +66,7 @@ pub fn set_debug_location( // For MSVC, set the column number to zero. // Otherwise, emit it. This mimics clang behaviour. // See discussion in https://github.com/rust-lang/rust/issues/42921 - let col_used = if bx.cx().sess().target.target.options.is_like_msvc { + let col_used = if bx.sess().target.target.options.is_like_msvc { UNKNOWN_COLUMN_NUMBER } else { col as c_uint diff --git a/src/librustc_codegen_llvm/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs index c3a15ccca0a..32432f7e4ec 100644 --- a/src/librustc_codegen_llvm/debuginfo/type_names.rs +++ b/src/librustc_codegen_llvm/debuginfo/type_names.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Type Names for Debug Info. use common::CodegenCx; @@ -19,9 +9,9 @@ use rustc_codegen_ssa::traits::*; use rustc::hir; // Compute the name of the type as it should be stored in debuginfo. Does not do -// any caching, i.e. calling the function twice with the same type will also do +// any caching, i.e., calling the function twice with the same type will also do // the work twice. The `qualified` parameter only affects the first level of the -// type name, further levels (i.e. type parameters) are always fully qualified. +// type name, further levels (i.e., type parameters) are always fully qualified. pub fn compute_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, t: Ty<'tcx>, qualified: bool) @@ -117,12 +107,16 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, } }, ty::Dynamic(ref trait_data, ..) => { - let principal = cx.tcx.normalize_erasing_late_bound_regions( - ty::ParamEnv::reveal_all(), - &trait_data.principal(), - ); - push_item_name(cx, principal.def_id, false, output); - push_type_params(cx, principal.substs, output); + if let Some(principal) = trait_data.principal() { + let principal = cx.tcx.normalize_erasing_late_bound_regions( + ty::ParamEnv::reveal_all(), + &principal, + ); + push_item_name(cx, principal.def_id, false, output); + push_type_params(cx, principal.substs, output); + } else { + output.push_str("dyn '_"); + } }, ty::FnDef(..) | ty::FnPtr(_) => { let sig = t.fn_sig(cx.tcx); @@ -172,6 +166,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, } ty::Error | ty::Infer(_) | + ty::Placeholder(..) | ty::UnnormalizedProjection(..) | ty::Projection(..) | ty::Bound(..) | diff --git a/src/librustc_codegen_llvm/debuginfo/utils.rs b/src/librustc_codegen_llvm/debuginfo/utils.rs index 89262beb356..8b85df79d04 100644 --- a/src/librustc_codegen_llvm/debuginfo/utils.rs +++ b/src/librustc_codegen_llvm/debuginfo/utils.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Utility Functions. use super::{CrateDebugContext}; @@ -26,7 +16,7 @@ use syntax_pos::{self, Span}; pub fn is_node_local_to_unit(cx: &CodegenCx, def_id: DefId) -> bool { // The is_local_to_unit flag indicates whether a function is local to the - // current compilation unit (i.e. if it is *static* in the C-sense). The + // current compilation unit (i.e., if it is *static* in the C-sense). The // *reachable* set should provide a good approximation of this, as it // contains everything that might leak out of the current crate (by being // externally visible or by being inlined into something externally diff --git a/src/librustc_codegen_llvm/declare.rs b/src/librustc_codegen_llvm/declare.rs index c23aab409a9..6b7ee16cb71 100644 --- a/src/librustc_codegen_llvm/declare.rs +++ b/src/librustc_codegen_llvm/declare.rs @@ -1,12 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. //! Declare various LLVM values. //! //! Prefer using functions and methods from this module rather than calling LLVM @@ -26,8 +17,7 @@ use rustc::ty::{self, PolyFnSig}; use rustc::ty::layout::LayoutOf; use rustc::session::config::Sanitizer; use rustc_data_structures::small_c_str::SmallCStr; -use rustc_target::spec::PanicStrategy; -use abi::{Abi, FnType, FnTypeExt}; +use abi::{FnType, FnTypeExt}; use attributes; use context::CodegenCx; use type_::Type; @@ -75,23 +65,8 @@ fn declare_raw_fn( } } - match cx.tcx.sess.opts.cg.opt_level.as_ref().map(String::as_ref) { - Some("s") => { - llvm::Attribute::OptimizeForSize.apply_llfn(Function, llfn); - }, - Some("z") => { - llvm::Attribute::MinSize.apply_llfn(Function, llfn); - llvm::Attribute::OptimizeForSize.apply_llfn(Function, llfn); - }, - _ => {}, - } - - if cx.tcx.sess.panic_strategy() != PanicStrategy::Unwind { - attributes::unwind(llfn, false); - } - + attributes::default_optimisation_attrs(cx.tcx.sess, llfn); attributes::non_lazy_bind(cx.sess(), llfn); - llfn } @@ -132,10 +107,6 @@ impl DeclareMethods<'tcx> for CodegenCx<'ll, 'tcx> { llvm::Attribute::NoReturn.apply_llfn(Function, llfn); } - if sig.abi != Abi::Rust && sig.abi != Abi::RustCall { - attributes::unwind(llfn, false); - } - fty.apply_attrs_llfn(llfn); llfn diff --git a/src/librustc_codegen_llvm/diagnostics.rs b/src/librustc_codegen_llvm/diagnostics.rs index 94776f17c79..872fa424e4c 100644 --- a/src/librustc_codegen_llvm/diagnostics.rs +++ b/src/librustc_codegen_llvm/diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] register_long_diagnostics! { diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index b2f1f933da4..58b466dbe6f 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -1,17 +1,6 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals)] use attributes; -use intrinsics::{self, Intrinsic}; use llvm; use llvm_util; use abi::{Abi, FnType, LlvmType, PassMode}; @@ -24,13 +13,14 @@ use context::CodegenCx; use type_::Type; use type_of::LayoutLlvmExt; use rustc::ty::{self, Ty}; -use rustc::ty::layout::{LayoutOf, HasTyCtxt}; -use rustc_codegen_ssa::common::TypeKind; +use rustc::ty::layout::{self, LayoutOf, HasTyCtxt, Primitive}; +use rustc_codegen_ssa::common::{IntPredicate, TypeKind}; use rustc::hir; -use syntax::ast; +use syntax::ast::{self, FloatTy}; use syntax::symbol::Symbol; use builder::Builder; use value::Value; +use va_arg::emit_va_arg; use rustc_codegen_ssa::traits::*; @@ -38,7 +28,7 @@ use rustc::session::Session; use syntax_pos::Span; use std::cmp::Ordering; -use std::iter; +use std::{iter, i128, u128}; fn get_simple_intrinsic(cx: &CodegenCx<'ll, '_>, name: &str) -> Option<&'ll Value> { let llvm_name = match name { @@ -96,7 +86,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { llresult: &'ll Value, span: Span, ) { - let tcx = self.cx().tcx; + let tcx = self.tcx; let (def_id, substs) = match callee_ty.sty { ty::FnDef(def_id, substs) => (def_id, substs), @@ -109,10 +99,10 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { let ret_ty = sig.output(); let name = &*tcx.item_name(def_id).as_str(); - let llret_ty = self.cx().layout_of(ret_ty).llvm_type(self.cx()); - let result = PlaceRef::new_sized(llresult, fn_ty.ret.layout, fn_ty.ret.layout.align); + let llret_ty = self.layout_of(ret_ty).llvm_type(self); + let result = PlaceRef::new_sized(llresult, fn_ty.ret.layout, fn_ty.ret.layout.align.abi); - let simple = get_simple_intrinsic(self.cx(), name); + let simple = get_simple_intrinsic(self, name); let llval = match name { _ if simple.is_some() => { self.call(simple.unwrap(), @@ -123,12 +113,12 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { return; }, "likely" => { - let expect = self.cx().get_intrinsic(&("llvm.expect.i1")); - self.call(expect, &[args[0].immediate(), self.cx().const_bool(true)], None) + let expect = self.get_intrinsic(&("llvm.expect.i1")); + self.call(expect, &[args[0].immediate(), self.const_bool(true)], None) } "unlikely" => { - let expect = self.cx().get_intrinsic(&("llvm.expect.i1")); - self.call(expect, &[args[0].immediate(), self.cx().const_bool(false)], None) + let expect = self.get_intrinsic(&("llvm.expect.i1")); + self.call(expect, &[args[0].immediate(), self.const_bool(false)], None) } "try" => { try_intrinsic(self, @@ -139,12 +129,65 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { return; } "breakpoint" => { - let llfn = self.cx().get_intrinsic(&("llvm.debugtrap")); + let llfn = self.get_intrinsic(&("llvm.debugtrap")); self.call(llfn, &[], None) } "size_of" => { let tp_ty = substs.type_at(0); - self.cx().const_usize(self.cx().size_of(tp_ty).bytes()) + self.const_usize(self.size_of(tp_ty).bytes()) + } + func @ "va_start" | func @ "va_end" => { + let va_list = match (tcx.lang_items().va_list(), &result.layout.ty.sty) { + (Some(did), ty::Adt(def, _)) if def.did == did => args[0].immediate(), + (Some(_), _) => self.load(args[0].immediate(), + tcx.data_layout.pointer_align.abi), + (None, _) => bug!("va_list language item must be defined") + }; + let intrinsic = self.cx().get_intrinsic(&format!("llvm.{}", func)); + self.call(intrinsic, &[va_list], None) + } + "va_copy" => { + let va_list = match (tcx.lang_items().va_list(), &result.layout.ty.sty) { + (Some(did), ty::Adt(def, _)) if def.did == did => args[0].immediate(), + (Some(_), _) => self.load(args[0].immediate(), + tcx.data_layout.pointer_align.abi), + (None, _) => bug!("va_list language item must be defined") + }; + let intrinsic = self.cx().get_intrinsic(&("llvm.va_copy")); + self.call(intrinsic, &[llresult, va_list], None); + return; + } + "va_arg" => { + match fn_ty.ret.layout.abi { + layout::Abi::Scalar(ref scalar) => { + match scalar.value { + Primitive::Int(..) => { + if self.cx().size_of(ret_ty).bytes() < 4 { + // va_arg should not be called on a integer type + // less than 4 bytes in length. If it is, promote + // the integer to a `i32` and truncate the result + // back to the smaller type. + let promoted_result = emit_va_arg(self, args[0], + tcx.types.i32); + self.trunc(promoted_result, llret_ty) + } else { + emit_va_arg(self, args[0], ret_ty) + } + } + Primitive::Float(FloatTy::F64) | + Primitive::Pointer => { + emit_va_arg(self, args[0], ret_ty) + } + // `va_arg` should never be used with the return type f32. + Primitive::Float(FloatTy::F32) => { + bug!("the va_arg intrinsic does not work with `f32`") + } + } + } + _ => { + bug!("the va_arg intrinsic does not work with non-scalar types") + } + } } "size_of_val" => { let tp_ty = substs.type_at(0); @@ -153,12 +196,12 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { glue::size_and_align_of_dst(self, tp_ty, Some(meta)); llsize } else { - self.cx().const_usize(self.cx().size_of(tp_ty).bytes()) + self.const_usize(self.size_of(tp_ty).bytes()) } } "min_align_of" => { let tp_ty = substs.type_at(0); - self.cx().const_usize(self.cx().align_of(tp_ty).abi()) + self.const_usize(self.align_of(tp_ty).bytes()) } "min_align_of_val" => { let tp_ty = substs.type_at(0); @@ -167,24 +210,24 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { glue::size_and_align_of_dst(self, tp_ty, Some(meta)); llalign } else { - self.cx().const_usize(self.cx().align_of(tp_ty).abi()) + self.const_usize(self.align_of(tp_ty).bytes()) } } "pref_align_of" => { let tp_ty = substs.type_at(0); - self.cx().const_usize(self.cx().align_of(tp_ty).pref()) + self.const_usize(self.layout_of(tp_ty).align.pref.bytes()) } "type_name" => { let tp_ty = substs.type_at(0); let ty_name = Symbol::intern(&tp_ty.to_string()).as_str(); - self.cx().const_str_slice(ty_name) + self.const_str_slice(ty_name) } "type_id" => { - self.cx().const_u64(self.cx().tcx.type_id_hash(substs.type_at(0))) + self.const_u64(self.tcx.type_id_hash(substs.type_at(0))) } "init" => { let ty = substs.type_at(0); - if !self.cx().layout_of(ty).is_zst() { + if !self.layout_of(ty).is_zst() { // Just zero out the stack slot. // If we store a zero constant, LLVM will drown in vreg allocation for large // data structures, and the generated code will be awful. (A telltale sign of @@ -194,8 +237,8 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { false, ty, llresult, - self.cx().const_u8(0), - self.cx().const_usize(1) + self.const_u8(0), + self.const_usize(1) ); } return; @@ -207,7 +250,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { "needs_drop" => { let tp_ty = substs.type_at(0); - self.cx().const_bool(self.cx().type_needs_drop(tp_ty)) + self.const_bool(self.type_needs_drop(tp_ty)) } "offset" => { let ptr = args[0].immediate(); @@ -255,18 +298,18 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { let tp_ty = substs.type_at(0); let mut ptr = args[0].immediate(); if let PassMode::Cast(ty) = fn_ty.ret.mode { - ptr = self.pointercast(ptr, self.cx().type_ptr_to(ty.llvm_type(self.cx()))); + ptr = self.pointercast(ptr, self.type_ptr_to(ty.llvm_type(self))); } let load = self.volatile_load(ptr); let align = if name == "unaligned_volatile_load" { 1 } else { - self.cx().align_of(tp_ty).abi() as u32 + self.align_of(tp_ty).bytes() as u32 }; unsafe { llvm::LLVMSetAlignment(load, align); } - to_immediate(self, load, self.cx().layout_of(tp_ty)) + to_immediate(self, load, self.layout_of(tp_ty)) }, "volatile_store" => { let dst = args[0].deref(self.cx()); @@ -280,7 +323,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { }, "prefetch_read_data" | "prefetch_write_data" | "prefetch_read_instruction" | "prefetch_write_instruction" => { - let expect = self.cx().get_intrinsic(&("llvm.prefetch")); + let expect = self.get_intrinsic(&("llvm.prefetch")); let (rw, cache_type) = match name { "prefetch_read_data" => (0, 1), "prefetch_write_data" => (1, 1), @@ -290,35 +333,35 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { }; self.call(expect, &[ args[0].immediate(), - self.cx().const_i32(rw), + self.const_i32(rw), args[1].immediate(), - self.cx().const_i32(cache_type) + self.const_i32(cache_type) ], None) }, "ctlz" | "ctlz_nonzero" | "cttz" | "cttz_nonzero" | "ctpop" | "bswap" | "bitreverse" | "add_with_overflow" | "sub_with_overflow" | "mul_with_overflow" | "overflowing_add" | "overflowing_sub" | "overflowing_mul" | "unchecked_div" | "unchecked_rem" | "unchecked_shl" | "unchecked_shr" | "exact_div" | - "rotate_left" | "rotate_right" => { + "rotate_left" | "rotate_right" | "saturating_add" | "saturating_sub" => { let ty = arg_tys[0]; - match int_type_width_signed(ty, self.cx()) { + match int_type_width_signed(ty, self) { Some((width, signed)) => match name { "ctlz" | "cttz" => { - let y = self.cx().const_bool(false); - let llfn = self.cx().get_intrinsic( + let y = self.const_bool(false); + let llfn = self.get_intrinsic( &format!("llvm.{}.i{}", name, width), ); self.call(llfn, &[args[0].immediate(), y], None) } "ctlz_nonzero" | "cttz_nonzero" => { - let y = self.cx().const_bool(true); + let y = self.const_bool(true); let llvm_name = &format!("llvm.{}.i{}", &name[..4], width); - let llfn = self.cx().get_intrinsic(llvm_name); + let llfn = self.get_intrinsic(llvm_name); self.call(llfn, &[args[0].immediate(), y], None) } "ctpop" => self.call( - self.cx().get_intrinsic(&format!("llvm.ctpop.i{}", width)), + self.get_intrinsic(&format!("llvm.ctpop.i{}", width)), &[args[0].immediate()], None ), @@ -327,7 +370,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { args[0].immediate() // byte swap a u8/i8 is just a no-op } else { self.call( - self.cx().get_intrinsic( + self.get_intrinsic( &format!("llvm.bswap.i{}", width), ), &[args[0].immediate()], @@ -337,7 +380,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { } "bitreverse" => { self.call( - self.cx().get_intrinsic( + self.get_intrinsic( &format!("llvm.bitreverse.i{}", width), ), &[args[0].immediate()], @@ -348,7 +391,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { let intrinsic = format!("llvm.{}{}.with.overflow.i{}", if signed { 's' } else { 'u' }, &name[..3], width); - let llfn = self.cx().get_intrinsic(&intrinsic); + let llfn = self.get_intrinsic(&intrinsic); // Convert `i1` to a `bool`, and write it to the out parameter let pair = self.call(llfn, &[ @@ -357,7 +400,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { ], None); let val = self.extract_value(pair, 0); let overflow = self.extract_value(pair, 1); - let overflow = self.zext(overflow, self.cx().type_bool()); + let overflow = self.zext(overflow, self.type_bool()); let dest = result.project_field(self, 0); self.store(val, dest.llval, dest.align); @@ -402,13 +445,13 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { // rotate = funnel shift with first two args the same let llvm_name = &format!("llvm.fsh{}.i{}", if is_left { 'l' } else { 'r' }, width); - let llfn = self.cx().get_intrinsic(llvm_name); + let llfn = self.get_intrinsic(llvm_name); self.call(llfn, &[val, val, raw_shift], None) } else { // rotate_left: (X << (S % BW)) | (X >> ((BW - S) % BW)) // rotate_right: (X << ((BW - S) % BW)) | (X >> (S % BW)) - let width = self.cx().const_uint( - self.cx().type_ix(width), + let width = self.const_uint( + self.type_ix(width), width, ); let shift = self.urem(raw_shift, width); @@ -425,6 +468,44 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { self.or(shift1, shift2) } }, + "saturating_add" | "saturating_sub" => { + let is_add = name == "saturating_add"; + let lhs = args[0].immediate(); + let rhs = args[1].immediate(); + if llvm_util::get_major_version() >= 8 { + let llvm_name = &format!("llvm.{}{}.sat.i{}", + if signed { 's' } else { 'u' }, + if is_add { "add" } else { "sub" }, + width); + let llfn = self.get_intrinsic(llvm_name); + self.call(llfn, &[lhs, rhs], None) + } else { + let llvm_name = &format!("llvm.{}{}.with.overflow.i{}", + if signed { 's' } else { 'u' }, + if is_add { "add" } else { "sub" }, + width); + let llfn = self.get_intrinsic(llvm_name); + let pair = self.call(llfn, &[lhs, rhs], None); + let val = self.extract_value(pair, 0); + let overflow = self.extract_value(pair, 1); + let llty = self.type_ix(width); + + let limit = if signed { + let limit_lo = self.const_uint_big( + llty, (i128::MIN >> (128 - width)) as u128); + let limit_hi = self.const_uint_big( + llty, (i128::MAX >> (128 - width)) as u128); + let neg = self.icmp( + IntPredicate::IntSLT, val, self.const_uint(llty, 0)); + self.select(neg, limit_hi, limit_lo) + } else if is_add { + self.const_uint_big(llty, u128::MAX >> (128 - width)) + } else { + self.const_uint(llty, 0) + }; + self.select(overflow, limit, val) + } + }, _ => bug!(), }, None => { @@ -496,16 +577,16 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { (SequentiallyConsistent, Monotonic), "failacq" if is_cxchg => (SequentiallyConsistent, Acquire), - _ => self.cx().sess().fatal("unknown ordering in atomic intrinsic") + _ => self.sess().fatal("unknown ordering in atomic intrinsic") }, 4 => match (split[2], split[3]) { ("acq", "failrelaxed") if is_cxchg => (Acquire, Monotonic), ("acqrel", "failrelaxed") if is_cxchg => (AcquireRelease, Monotonic), - _ => self.cx().sess().fatal("unknown ordering in atomic intrinsic") + _ => self.sess().fatal("unknown ordering in atomic intrinsic") }, - _ => self.cx().sess().fatal("Atomic intrinsic not in correct format"), + _ => self.sess().fatal("Atomic intrinsic not in correct format"), }; let invalid_monomorphization = |ty| { @@ -517,7 +598,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { match split[1] { "cxchg" | "cxchgweak" => { let ty = substs.type_at(0); - if int_type_width_signed(ty, self.cx()).is_some() { + if int_type_width_signed(ty, self).is_some() { let weak = split[1] == "cxchgweak"; let pair = self.atomic_cmpxchg( args[0].immediate(), @@ -528,7 +609,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { weak); let val = self.extract_value(pair, 0); let success = self.extract_value(pair, 1); - let success = self.zext(success, self.cx().type_bool()); + let success = self.zext(success, self.type_bool()); let dest = result.project_field(self, 0); self.store(val, dest.llval, dest.align); @@ -542,8 +623,8 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { "load" => { let ty = substs.type_at(0); - if int_type_width_signed(ty, self.cx()).is_some() { - let size = self.cx().size_of(ty); + if int_type_width_signed(ty, self).is_some() { + let size = self.size_of(ty); self.atomic_load(args[0].immediate(), order, size) } else { return invalid_monomorphization(ty); @@ -552,8 +633,8 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { "store" => { let ty = substs.type_at(0); - if int_type_width_signed(ty, self.cx()).is_some() { - let size = self.cx().size_of(ty); + if int_type_width_signed(ty, self).is_some() { + let size = self.size_of(ty); self.atomic_store( args[1].immediate(), args[0].immediate(), @@ -590,11 +671,11 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { "min" => AtomicRmwBinOp::AtomicMin, "umax" => AtomicRmwBinOp::AtomicUMax, "umin" => AtomicRmwBinOp::AtomicUMin, - _ => self.cx().sess().fatal("unknown atomic operation") + _ => self.sess().fatal("unknown atomic operation") }; let ty = substs.type_at(0); - if int_type_width_signed(ty, self.cx()).is_some() { + if int_type_width_signed(ty, self).is_some() { self.atomic_rmw( atom_op, args[0].immediate(), @@ -614,147 +695,12 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { return; } - _ => { - let intr = match Intrinsic::find(&name) { - Some(intr) => intr, - None => bug!("unknown intrinsic '{}'", name), - }; - fn one(x: Vec) -> T { - assert_eq!(x.len(), 1); - x.into_iter().next().unwrap() - } - fn ty_to_type<'ll>( - cx: &CodegenCx<'ll, '_>, - t: &intrinsics::Type - ) -> Vec<&'ll Type> { - use intrinsics::Type::*; - match *t { - Void => vec![cx.type_void()], - Integer(_signed, _width, llvm_width) => { - vec![cx.type_ix( llvm_width as u64)] - } - Float(x) => { - match x { - 32 => vec![cx.type_f32()], - 64 => vec![cx.type_f64()], - _ => bug!() - } - } - Pointer(ref t, ref llvm_elem, _const) => { - let t = llvm_elem.as_ref().unwrap_or(t); - let elem = one(ty_to_type(cx, t)); - vec![cx.type_ptr_to(elem)] - } - Vector(ref t, ref llvm_elem, length) => { - let t = llvm_elem.as_ref().unwrap_or(t); - let elem = one(ty_to_type(cx, t)); - vec![cx.type_vector(elem, length as u64)] - } - Aggregate(false, ref contents) => { - let elems = contents.iter() - .map(|t| one(ty_to_type(cx, t))) - .collect::>(); - vec![cx.type_struct( &elems, false)] - } - Aggregate(true, ref contents) => { - contents.iter() - .flat_map(|t| ty_to_type(cx, t)) - .collect() - } - } - } - - // This allows an argument list like `foo, (bar, baz), - // qux` to be converted into `foo, bar, baz, qux`, integer - // arguments to be truncated as needed and pointers to be - // cast. - fn modify_as_needed<'ll, 'tcx>( - bx: &mut Builder<'_, 'll, 'tcx>, - t: &intrinsics::Type, - arg: &OperandRef<'tcx, &'ll Value>, - ) -> Vec<&'ll Value> { - match *t { - intrinsics::Type::Aggregate(true, ref contents) => { - // We found a tuple that needs squishing! So - // run over the tuple and load each field. - // - // This assumes the type is "simple", i.e. no - // destructors, and the contents are SIMD - // etc. - assert!(!bx.cx().type_needs_drop(arg.layout.ty)); - let (ptr, align) = match arg.val { - OperandValue::Ref(ptr, None, align) => (ptr, align), - _ => bug!() - }; - let arg = PlaceRef::new_sized(ptr, arg.layout, align); - (0..contents.len()).map(|i| { - let field = arg.project_field(bx, i); - bx.load_operand(field).immediate() - }).collect() - } - intrinsics::Type::Pointer(_, Some(ref llvm_elem), _) => { - let llvm_elem = one(ty_to_type(bx.cx(), llvm_elem)); - vec![bx.pointercast(arg.immediate(), bx.cx().type_ptr_to(llvm_elem))] - } - intrinsics::Type::Vector(_, Some(ref llvm_elem), length) => { - let llvm_elem = one(ty_to_type(bx.cx(), llvm_elem)); - vec![ - bx.bitcast(arg.immediate(), - bx.cx().type_vector(llvm_elem, length as u64)) - ] - } - intrinsics::Type::Integer(_, width, llvm_width) if width != llvm_width => { - // the LLVM intrinsic uses a smaller integer - // size than the C intrinsic's signature, so - // we have to trim it down here. - vec![bx.trunc(arg.immediate(), bx.cx().type_ix(llvm_width as u64))] - } - _ => vec![arg.immediate()], - } - } - - - let inputs = intr.inputs.iter() - .flat_map(|t| ty_to_type(self.cx(), t)) - .collect::>(); - - let outputs = one(ty_to_type(self.cx(), &intr.output)); - - let llargs: Vec<_> = intr.inputs.iter().zip(args).flat_map(|(t, arg)| { - modify_as_needed(self, t, arg) - }).collect(); - assert_eq!(inputs.len(), llargs.len()); - - let val = match intr.definition { - intrinsics::IntrinsicDef::Named(name) => { - let f = self.cx().declare_cfn( - name, - self.cx().type_func(&inputs, outputs), - ); - self.call(f, &llargs, None) - } - }; - - match *intr.output { - intrinsics::Type::Aggregate(flatten, ref elems) => { - // the output is a tuple so we need to munge it properly - assert!(!flatten); - - for i in 0..elems.len() { - let dest = result.project_field(self, i); - let val = self.extract_value(val, i as u64); - self.store(val, dest.llval, dest.align); - } - return; - } - _ => val, - } - } + _ => bug!("unknown intrinsic '{}'", name), }; if !fn_ty.ret.is_ignore() { if let PassMode::Cast(ty) = fn_ty.ret.mode { - let ptr_llty = self.cx().type_ptr_to(ty.llvm_type(self.cx())); + let ptr_llty = self.type_ptr_to(ty.llvm_type(self)); let ptr = self.pointercast(result.llval, ptr_llty); self.store(llval, ptr, result.align); } else { @@ -763,6 +709,21 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { } } } + + fn abort(&mut self) { + let fnname = self.get_intrinsic(&("llvm.trap")); + self.call(fnname, &[], None); + } + + fn assume(&mut self, val: Self::Value) { + let assume_intrinsic = self.get_intrinsic("llvm.assume"); + self.call(assume_intrinsic, &[val], None); + } + + fn expect(&mut self, cond: Self::Value, expected: bool) -> Self::Value { + let expect = self.get_intrinsic(&"llvm.expect.i1"); + self.call(expect, &[cond, self.const_bool(expected)], None) + } } fn copy_intrinsic( @@ -774,8 +735,8 @@ fn copy_intrinsic( src: &'ll Value, count: &'ll Value, ) { - let (size, align) = bx.cx().size_and_align_of(ty); - let size = bx.mul(bx.cx().const_usize(size.bytes()), count); + let (size, align) = bx.size_and_align_of(ty); + let size = bx.mul(bx.const_usize(size.bytes()), count); let flags = if volatile { MemFlags::VOLATILE } else { @@ -796,8 +757,8 @@ fn memset_intrinsic( val: &'ll Value, count: &'ll Value ) { - let (size, align) = bx.cx().size_and_align_of(ty); - let size = bx.mul(bx.cx().const_usize(size.bytes()), count); + let (size, align) = bx.size_and_align_of(ty); + let size = bx.mul(bx.const_usize(size.bytes()), count); let flags = if volatile { MemFlags::VOLATILE } else { @@ -813,11 +774,11 @@ fn try_intrinsic( local_ptr: &'ll Value, dest: &'ll Value, ) { - if bx.cx().sess().no_landing_pads() { + if bx.sess().no_landing_pads() { bx.call(func, &[data], None); - let ptr_align = bx.tcx().data_layout.pointer_align; - bx.store(bx.cx().const_null(bx.cx().type_i8p()), dest, ptr_align); - } else if wants_msvc_seh(bx.cx().sess()) { + let ptr_align = bx.tcx().data_layout.pointer_align.abi; + bx.store(bx.const_null(bx.type_i8p()), dest, ptr_align); + } else if wants_msvc_seh(bx.sess()) { codegen_msvc_try(bx, func, data, local_ptr, dest); } else { codegen_gnu_try(bx, func, data, local_ptr, dest); @@ -838,8 +799,8 @@ fn codegen_msvc_try( local_ptr: &'ll Value, dest: &'ll Value, ) { - let llfn = get_rust_try_fn(bx.cx(), &mut |mut bx| { - bx.set_personality_fn(bx.cx().eh_personality()); + let llfn = get_rust_try_fn(bx, &mut |mut bx| { + bx.set_personality_fn(bx.eh_personality()); let mut normal = bx.build_sibling_block("normal"); let mut catchswitch = bx.build_sibling_block("catchswitch"); @@ -889,26 +850,26 @@ fn codegen_msvc_try( // } // // More information can be found in libstd's seh.rs implementation. - let i64p = bx.cx().type_ptr_to(bx.cx().type_i64()); - let ptr_align = bx.tcx().data_layout.pointer_align; + let i64p = bx.type_ptr_to(bx.type_i64()); + let ptr_align = bx.tcx().data_layout.pointer_align.abi; let slot = bx.alloca(i64p, "slot", ptr_align); bx.invoke(func, &[data], normal.llbb(), catchswitch.llbb(), None); - normal.ret(bx.cx().const_i32(0)); + normal.ret(bx.const_i32(0)); let cs = catchswitch.catch_switch(None, None, 1); catchswitch.add_handler(cs, catchpad.llbb()); let tydesc = match bx.tcx().lang_items().msvc_try_filter() { - Some(did) => bx.cx().get_static(did), + Some(did) => bx.get_static(did), None => bug!("msvc_try_filter not defined"), }; - let funclet = catchpad.catch_pad(cs, &[tydesc, bx.cx().const_i32(0), slot]); + let funclet = catchpad.catch_pad(cs, &[tydesc, bx.const_i32(0), slot]); let addr = catchpad.load(slot, ptr_align); - let i64_align = bx.tcx().data_layout.i64_align; + let i64_align = bx.tcx().data_layout.i64_align.abi; let arg1 = catchpad.load(addr, i64_align); - let val1 = bx.cx().const_i32(1); + let val1 = bx.const_i32(1); let gep1 = catchpad.inbounds_gep(addr, &[val1]); let arg2 = catchpad.load(gep1, i64_align); let local_ptr = catchpad.bitcast(local_ptr, i64p); @@ -917,18 +878,18 @@ fn codegen_msvc_try( catchpad.store(arg2, gep2, i64_align); catchpad.catch_ret(&funclet, caught.llbb()); - caught.ret(bx.cx().const_i32(1)); + caught.ret(bx.const_i32(1)); }); // Note that no invoke is used here because by definition this function // can't panic (that's what it's catching). let ret = bx.call(llfn, &[func, data, local_ptr], None); - let i32_align = bx.tcx().data_layout.i32_align; + let i32_align = bx.tcx().data_layout.i32_align.abi; bx.store(ret, dest, i32_align); } // Definition of the standard "try" function for Rust using the GNU-like model -// of exceptions (e.g. the normal semantics of LLVM's landingpad and invoke +// of exceptions (e.g., the normal semantics of LLVM's landingpad and invoke // instructions). // // This codegen is a little surprising because we always call a shim @@ -945,7 +906,7 @@ fn codegen_gnu_try( local_ptr: &'ll Value, dest: &'ll Value, ) { - let llfn = get_rust_try_fn(bx.cx(), &mut |mut bx| { + let llfn = get_rust_try_fn(bx, &mut |mut bx| { // Codegens the shims described above: // // bx: @@ -970,7 +931,7 @@ fn codegen_gnu_try( let data = llvm::get_param(bx.llfn(), 1); let local_ptr = llvm::get_param(bx.llfn(), 2); bx.invoke(func, &[data], then.llbb(), catch.llbb(), None); - then.ret(bx.cx().const_i32(0)); + then.ret(bx.const_i32(0)); // Type indicator for the exception being thrown. // @@ -978,20 +939,20 @@ fn codegen_gnu_try( // being thrown. The second value is a "selector" indicating which of // the landing pad clauses the exception's type had been matched to. // rust_try ignores the selector. - let lpad_ty = bx.cx().type_struct(&[bx.cx().type_i8p(), bx.cx().type_i32()], false); - let vals = catch.landing_pad(lpad_ty, bx.cx().eh_personality(), 1); - catch.add_clause(vals, bx.cx().const_null(bx.cx().type_i8p())); + let lpad_ty = bx.type_struct(&[bx.type_i8p(), bx.type_i32()], false); + let vals = catch.landing_pad(lpad_ty, bx.eh_personality(), 1); + catch.add_clause(vals, bx.const_null(bx.type_i8p())); let ptr = catch.extract_value(vals, 0); - let ptr_align = bx.tcx().data_layout.pointer_align; - let bitcast = catch.bitcast(local_ptr, bx.cx().type_ptr_to(bx.cx().type_i8p())); + let ptr_align = bx.tcx().data_layout.pointer_align.abi; + let bitcast = catch.bitcast(local_ptr, bx.type_ptr_to(bx.type_i8p())); catch.store(ptr, bitcast, ptr_align); - catch.ret(bx.cx().const_i32(1)); + catch.ret(bx.const_i32(1)); }); // Note that no invoke is used here because by definition this function // can't panic (that's what it's catching). let ret = bx.call(llfn, &[func, data, local_ptr], None); - let i32_align = bx.tcx().data_layout.i32_align; + let i32_align = bx.tcx().data_layout.i32_align.abi; bx.store(ret, dest, i32_align); } @@ -1012,7 +973,7 @@ fn gen_fn<'ll, 'tcx>( Abi::Rust )); let llfn = cx.define_internal_fn(name, rust_fn_sig); - attributes::from_fn_attrs(cx, llfn, None); + attributes::from_fn_attrs(cx, llfn, None, rust_fn_sig); let bx = Builder::new_block(cx, llfn, "entry-block"); codegen(bx); llfn @@ -1066,7 +1027,7 @@ fn generic_simd_intrinsic( }; ($msg: tt, $($fmt: tt)*) => { span_invalid_monomorphization_error( - bx.cx().sess(), span, + bx.sess(), span, &format!(concat!("invalid monomorphization of `{}` intrinsic: ", $msg), name, $($fmt)*)); } @@ -1102,7 +1063,28 @@ fn generic_simd_intrinsic( ); let arg_tys = sig.inputs(); - // every intrinsic takes a SIMD vector as its first argument + if name == "simd_select_bitmask" { + let in_ty = arg_tys[0]; + let m_len = match in_ty.sty { + // Note that this `.unwrap()` crashes for isize/usize, that's sort + // of intentional as there's not currently a use case for that. + ty::Int(i) => i.bit_width().unwrap(), + ty::Uint(i) => i.bit_width().unwrap(), + _ => return_error!("`{}` is not an integral type", in_ty), + }; + require_simd!(arg_tys[1], "argument"); + let v_len = arg_tys[1].simd_size(tcx); + require!(m_len == v_len, + "mismatched lengths: mask length `{}` != other vector length `{}`", + m_len, v_len + ); + let i1 = bx.type_i1(); + let i1xn = bx.type_vector(i1, m_len as u64); + let m_i1s = bx.bitcast(args[0].immediate(), i1xn); + return Ok(bx.select(m_i1s, args[1].immediate(), args[2].immediate())); + } + + // every intrinsic below takes a SIMD vector as its first argument require_simd!(arg_tys[0], "input"); let in_ty = arg_tys[0]; let in_elem = arg_tys[0].simd_type(tcx); @@ -1127,7 +1109,7 @@ fn generic_simd_intrinsic( found `{}` with length {}", in_len, in_ty, ret_ty, out_len); - require!(bx.cx().type_kind(bx.cx().element_type(llret_ty)) == TypeKind::Integer, + require!(bx.type_kind(bx.element_type(llret_ty)) == TypeKind::Integer, "expected return type with integer elements, found `{}` with non-integer `{}`", ret_ty, ret_ty.simd_type(tcx)); @@ -1163,8 +1145,8 @@ fn generic_simd_intrinsic( let indices: Option> = (0..n) .map(|i| { let arg_idx = i; - let val = bx.cx().const_get_elt(vector, i as u64); - match bx.cx().const_to_opt_u128(val, true) { + let val = bx.const_get_elt(vector, i as u64); + match bx.const_to_opt_u128(val, true) { None => { emit_error!("shuffle index #{} is not a constant", arg_idx); None @@ -1174,18 +1156,18 @@ fn generic_simd_intrinsic( arg_idx, total_len); None } - Some(idx) => Some(bx.cx().const_i32(idx as i32)), + Some(idx) => Some(bx.const_i32(idx as i32)), } }) .collect(); let indices = match indices { Some(i) => i, - None => return Ok(bx.cx().const_null(llret_ty)) + None => return Ok(bx.const_null(llret_ty)) }; return Ok(bx.shuffle_vector(args[0].immediate(), args[1].immediate(), - bx.cx().const_vector(&indices))) + bx.const_vector(&indices))) } if name == "simd_insert" { @@ -1206,6 +1188,7 @@ fn generic_simd_intrinsic( if name == "simd_select" { let m_elem_ty = in_elem; let m_len = in_len; + require_simd!(arg_tys[1], "argument"); let v_len = arg_tys[1].simd_size(tcx); require!(m_len == v_len, "mismatched lengths: mask length `{}` != other vector length `{}`", @@ -1216,12 +1199,58 @@ fn generic_simd_intrinsic( _ => return_error!("mask element type is `{}`, expected `i_`", m_elem_ty) } // truncate the mask to a vector of i1s - let i1 = bx.cx().type_i1(); - let i1xn = bx.cx().type_vector(i1, m_len as u64); + let i1 = bx.type_i1(); + let i1xn = bx.type_vector(i1, m_len as u64); let m_i1s = bx.trunc(args[0].immediate(), i1xn); return Ok(bx.select(m_i1s, args[1].immediate(), args[2].immediate())); } + if name == "simd_bitmask" { + // The `fn simd_bitmask(vector) -> unsigned integer` intrinsic takes a + // vector mask and returns an unsigned integer containing the most + // significant bit (MSB) of each lane. + use rustc_target::abi::HasDataLayout; + + // If the vector has less than 8 lanes, an u8 is returned with zeroed + // trailing bits. + let expected_int_bits = in_len.max(8); + match ret_ty.sty { + ty::Uint(i) if i.bit_width() == Some(expected_int_bits) => (), + _ => return_error!( + "bitmask `{}`, expected `u{}`", + ret_ty, expected_int_bits + ), + } + + // Integer vector : + let (i_xn, in_elem_bitwidth) = match in_elem.sty { + ty::Int(i) => ( + args[0].immediate(), + i.bit_width().unwrap_or(bx.data_layout().pointer_size.bits() as _) + ), + ty::Uint(i) => ( + args[0].immediate(), + i.bit_width().unwrap_or(bx.data_layout().pointer_size.bits() as _) + ), + _ => return_error!( + "vector argument `{}`'s element type `{}`, expected integer element type", + in_ty, in_elem + ), + }; + + // Shift the MSB to the right by "in_elem_bitwidth - 1" into the first bit position. + let shift_indices = vec![ + bx.cx.const_int(bx.type_ix(in_elem_bitwidth as _), (in_elem_bitwidth - 1) as _); in_len + ]; + let i_xn_msb = bx.lshr(i_xn, bx.const_vector(shift_indices.as_slice())); + // Truncate vector to an + let i1xn = bx.trunc(i_xn_msb, bx.type_vector(bx.type_i1(), in_len as _)); + // Bitcast to iN: + let i_ = bx.bitcast(i1xn, bx.type_ix(in_len as _)); + // Zero-extend iN to the bitmask type: + return Ok(bx.zext(i_, bx.type_ix(expected_int_bits as _))); + } + fn simd_simple_float_intrinsic( name: &str, in_elem: &::rustc::ty::TyS, @@ -1237,7 +1266,7 @@ fn generic_simd_intrinsic( }; ($msg: tt, $($fmt: tt)*) => { span_invalid_monomorphization_error( - bx.cx().sess(), span, + bx.sess(), span, &format!(concat!("invalid monomorphization of `{}` intrinsic: ", $msg), name, $($fmt)*)); } @@ -1278,7 +1307,7 @@ fn generic_simd_intrinsic( }; let llvm_name = &format!("llvm.{0}.v{1}{2}", name, in_len, ety); - let intrinsic = bx.cx().get_intrinsic(&llvm_name); + let intrinsic = bx.get_intrinsic(&llvm_name); let c = bx.call(intrinsic, &args.iter().map(|arg| arg.immediate()).collect::>(), None); @@ -1435,28 +1464,28 @@ fn generic_simd_intrinsic( } // Alignment of T, must be a constant integer value: - let alignment_ty = bx.cx().type_i32(); - let alignment = bx.cx().const_i32(bx.cx().align_of(in_elem).abi() as i32); + let alignment_ty = bx.type_i32(); + let alignment = bx.const_i32(bx.align_of(in_elem).bytes() as i32); // Truncate the mask vector to a vector of i1s: let (mask, mask_ty) = { - let i1 = bx.cx().type_i1(); - let i1xn = bx.cx().type_vector(i1, in_len as u64); + let i1 = bx.type_i1(); + let i1xn = bx.type_vector(i1, in_len as u64); (bx.trunc(args[2].immediate(), i1xn), i1xn) }; // Type of the vector of pointers: - let llvm_pointer_vec_ty = llvm_vector_ty(bx.cx(), underlying_ty, in_len, pointer_count); + let llvm_pointer_vec_ty = llvm_vector_ty(bx, underlying_ty, in_len, pointer_count); let llvm_pointer_vec_str = llvm_vector_str(underlying_ty, in_len, pointer_count); // Type of the vector of elements: - let llvm_elem_vec_ty = llvm_vector_ty(bx.cx(), underlying_ty, in_len, pointer_count - 1); + let llvm_elem_vec_ty = llvm_vector_ty(bx, underlying_ty, in_len, pointer_count - 1); let llvm_elem_vec_str = llvm_vector_str(underlying_ty, in_len, pointer_count - 1); let llvm_intrinsic = format!("llvm.masked.gather.{}.{}", llvm_elem_vec_str, llvm_pointer_vec_str); - let f = bx.cx().declare_cfn(&llvm_intrinsic, - bx.cx().type_func(&[ + let f = bx.declare_cfn(&llvm_intrinsic, + bx.type_func(&[ llvm_pointer_vec_ty, alignment_ty, mask_ty, @@ -1535,30 +1564,30 @@ fn generic_simd_intrinsic( } // Alignment of T, must be a constant integer value: - let alignment_ty = bx.cx().type_i32(); - let alignment = bx.cx().const_i32(bx.cx().align_of(in_elem).abi() as i32); + let alignment_ty = bx.type_i32(); + let alignment = bx.const_i32(bx.align_of(in_elem).bytes() as i32); // Truncate the mask vector to a vector of i1s: let (mask, mask_ty) = { - let i1 = bx.cx().type_i1(); - let i1xn = bx.cx().type_vector(i1, in_len as u64); + let i1 = bx.type_i1(); + let i1xn = bx.type_vector(i1, in_len as u64); (bx.trunc(args[2].immediate(), i1xn), i1xn) }; - let ret_t = bx.cx().type_void(); + let ret_t = bx.type_void(); // Type of the vector of pointers: - let llvm_pointer_vec_ty = llvm_vector_ty(bx.cx(), underlying_ty, in_len, pointer_count); + let llvm_pointer_vec_ty = llvm_vector_ty(bx, underlying_ty, in_len, pointer_count); let llvm_pointer_vec_str = llvm_vector_str(underlying_ty, in_len, pointer_count); // Type of the vector of elements: - let llvm_elem_vec_ty = llvm_vector_ty(bx.cx(), underlying_ty, in_len, pointer_count - 1); + let llvm_elem_vec_ty = llvm_vector_ty(bx, underlying_ty, in_len, pointer_count - 1); let llvm_elem_vec_str = llvm_vector_str(underlying_ty, in_len, pointer_count - 1); let llvm_intrinsic = format!("llvm.masked.scatter.{}.{}", llvm_elem_vec_str, llvm_pointer_vec_str); - let f = bx.cx().declare_cfn(&llvm_intrinsic, - bx.cx().type_func(&[llvm_elem_vec_ty, + let f = bx.declare_cfn(&llvm_intrinsic, + bx.type_func(&[llvm_elem_vec_ty, llvm_pointer_vec_ty, alignment_ty, mask_ty], ret_t)); @@ -1598,7 +1627,7 @@ fn generic_simd_intrinsic( // code is generated // * if the accumulator of the fmul isn't 1, incorrect // code is generated - match bx.cx().const_get_real(acc) { + match bx.const_get_real(acc) { None => return_error!("accumulator of {} is not a constant", $name), Some((v, loses_info)) => { if $name.contains("mul") && v != 1.0_f64 { @@ -1614,8 +1643,8 @@ fn generic_simd_intrinsic( } else { // unordered arithmetic reductions do not: match f.bit_width() { - 32 => bx.cx().const_undef(bx.cx().type_f32()), - 64 => bx.cx().const_undef(bx.cx().type_f64()), + 32 => bx.const_undef(bx.type_f32()), + 64 => bx.const_undef(bx.type_f64()), v => { return_error!(r#" unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#, @@ -1692,8 +1721,8 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#, } // boolean reductions operate on vectors of i1s: - let i1 = bx.cx().type_i1(); - let i1xn = bx.cx().type_vector(i1, in_len as u64); + let i1 = bx.type_i1(); + let i1xn = bx.type_vector(i1, in_len as u64); bx.trunc(args[0].immediate(), i1xn) }; return match in_elem.sty { @@ -1703,7 +1732,7 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#, if !$boolean { r } else { - bx.zext(r, bx.cx().type_bool()) + bx.zext(r, bx.type_bool()) } ) }, diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 943cdcf190c..afa002efb77 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The Rust compiler. //! //! # Note @@ -27,7 +17,6 @@ #![allow(unused_attributes)] #![feature(libc)] #![feature(nll)] -#![feature(quote)] #![feature(range_contains)] #![feature(rustc_diagnostic_macros)] #![feature(slice_sort_by_cached_key)] @@ -53,7 +42,6 @@ extern crate rustc_target; extern crate rustc_demangle; extern crate rustc_incremental; extern crate rustc_llvm; -extern crate rustc_platform_intrinsics as intrinsics; extern crate rustc_codegen_utils; extern crate rustc_codegen_ssa; extern crate rustc_fs_util; @@ -85,7 +73,7 @@ use rustc::dep_graph::DepGraph; use rustc::middle::allocator::AllocatorKind; use rustc::middle::cstore::{EncodedMetadata, MetadataLoader}; use rustc::session::{Session, CompileIncomplete}; -use rustc::session::config::{OutputFilenames, OutputType, PrintRequest}; +use rustc::session::config::{OutputFilenames, OutputType, PrintRequest, OptLevel}; use rustc::ty::{self, TyCtxt}; use rustc::util::nodemap::DefIdSet; use rustc::util::time_graph; @@ -129,13 +117,14 @@ mod mono_item; mod type_; mod type_of; mod value; +mod va_arg; #[derive(Clone)] pub struct LlvmCodegenBackend(()); impl ExtraBackendMethods for LlvmCodegenBackend { - fn new_metadata(&self, sess: &Session, mod_name: &str) -> ModuleLlvm { - ModuleLlvm::new(sess, mod_name) + fn new_metadata(&self, tcx: TyCtxt, mod_name: &str) -> ModuleLlvm { + ModuleLlvm::new(tcx, mod_name) } fn write_metadata<'b, 'gcx>( &self, @@ -157,10 +146,11 @@ impl ExtraBackendMethods for LlvmCodegenBackend { fn target_machine_factory( &self, sess: &Session, + optlvl: OptLevel, find_features: bool ) -> Arc Result<&'static mut llvm::TargetMachine, String> + Send + Sync> { - back::write::target_machine_factory(sess, find_features) + back::write::target_machine_factory(sess, optlvl, find_features) } fn target_cpu<'b>(&self, sess: &'b Session) -> &'b str { llvm_util::target_cpu(sess) @@ -177,13 +167,20 @@ impl WriteBackendMethods for LlvmCodegenBackend { fn print_pass_timings(&self) { unsafe { llvm::LLVMRustPrintPassTimings(); } } - fn run_lto( + fn run_fat_lto( cgcx: &CodegenContext, modules: Vec>, + timeline: &mut Timeline + ) -> Result, FatalError> { + back::lto::run_fat(cgcx, modules, timeline) + } + fn run_thin_lto( + cgcx: &CodegenContext, + modules: Vec<(String, Self::ThinBuffer)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, timeline: &mut Timeline ) -> Result<(Vec>, Vec), FatalError> { - back::lto::run(cgcx, modules, cached_modules, timeline) + back::lto::run_thin(cgcx, modules, cached_modules, timeline) } unsafe fn optimize( cgcx: &CodegenContext, @@ -210,6 +207,12 @@ impl WriteBackendMethods for LlvmCodegenBackend { ) -> Result { back::write::codegen(cgcx, diag_handler, module, config, timeline) } + fn prepare_thin( + cgcx: &CodegenContext, + module: ModuleCodegen + ) -> (String, Self::ThinBuffer) { + back::lto::prepare_thin(cgcx, module) + } fn run_lto_pass_manager( cgcx: &CodegenContext, module: &ModuleCodegen, @@ -365,15 +368,15 @@ unsafe impl Send for ModuleLlvm { } unsafe impl Sync for ModuleLlvm { } impl ModuleLlvm { - fn new(sess: &Session, mod_name: &str) -> Self { + fn new(tcx: TyCtxt, mod_name: &str) -> Self { unsafe { - let llcx = llvm::LLVMRustContextCreate(sess.fewer_names()); - let llmod_raw = context::create_module(sess, llcx, mod_name) as *const _; + let llcx = llvm::LLVMRustContextCreate(tcx.sess.fewer_names()); + let llmod_raw = context::create_module(tcx, llcx, mod_name) as *const _; ModuleLlvm { llmod_raw, llcx, - tm: create_target_machine(sess, false), + tm: create_target_machine(tcx, false), } } } diff --git a/src/librustc_codegen_llvm/llvm/archive_ro.rs b/src/librustc_codegen_llvm/llvm/archive_ro.rs index 2a77f256e3a..548fffe0ecb 100644 --- a/src/librustc_codegen_llvm/llvm/archive_ro.rs +++ b/src/librustc_codegen_llvm/llvm/archive_ro.rs @@ -1,19 +1,9 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A wrapper around LLVM's archive (.a) code -use std::ffi::CString; use std::path::Path; use std::slice; use std::str; +use rustc_fs_util::path_to_c_string; pub struct ArchiveRO { pub raw: &'static mut super::Archive, @@ -38,24 +28,12 @@ impl ArchiveRO { /// raised. pub fn open(dst: &Path) -> Result { return unsafe { - let s = path2cstr(dst); + let s = path_to_c_string(dst); let ar = super::LLVMRustOpenArchive(s.as_ptr()).ok_or_else(|| { super::last_error().unwrap_or_else(|| "failed to open archive".to_owned()) })?; Ok(ArchiveRO { raw: ar }) }; - - #[cfg(unix)] - fn path2cstr(p: &Path) -> CString { - use std::os::unix::prelude::*; - use std::ffi::OsStr; - let p: &OsStr = p.as_ref(); - CString::new(p.as_bytes()).unwrap() - } - #[cfg(windows)] - fn path2cstr(p: &Path) -> CString { - CString::new(p.to_str().unwrap()).unwrap() - } } pub fn iter(&self) -> Iter { diff --git a/src/librustc_codegen_llvm/llvm/diagnostic.rs b/src/librustc_codegen_llvm/llvm/diagnostic.rs index b080c51c83a..0f5d28f9fec 100644 --- a/src/librustc_codegen_llvm/llvm/diagnostic.rs +++ b/src/librustc_codegen_llvm/llvm/diagnostic.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! LLVM diagnostic reports. pub use self::OptimizationDiagnosticKind::*; diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index f1a966d7654..58bdfc47fca 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -1,18 +1,8 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::debuginfo::{ DIBuilder, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType, DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable, DIGlobalVariableExpression, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator, - DINameSpace, DIFlags, + DINameSpace, DIFlags, DISPFlags, DebugEmissionKind, }; use libc::{c_uint, c_int, size_t, c_char}; @@ -125,6 +115,7 @@ pub enum Attribute { SanitizeAddress = 21, SanitizeMemory = 22, NonLazyBind = 23, + OptimizeNone = 24, } /// LLVMIntPredicate @@ -601,6 +592,40 @@ pub mod debuginfo { const FlagMainSubprogram = (1 << 21); } } + + // These values **must** match with LLVMRustDISPFlags!! + bitflags! { + #[repr(C)] + #[derive(Default)] + pub struct DISPFlags: ::libc::uint32_t { + const SPFlagZero = 0; + const SPFlagVirtual = 1; + const SPFlagPureVirtual = 2; + const SPFlagLocalToUnit = (1 << 2); + const SPFlagDefinition = (1 << 3); + const SPFlagOptimized = (1 << 4); + } + } + + /// LLVMRustDebugEmissionKind + #[derive(Copy, Clone)] + #[repr(C)] + pub enum DebugEmissionKind { + NoDebug, + FullDebug, + LineTablesOnly, + } + + impl DebugEmissionKind { + pub fn from_generic(kind: rustc::session::config::DebugInfo) -> Self { + use rustc::session::config::DebugInfo; + match kind { + DebugInfo::None => DebugEmissionKind::NoDebug, + DebugInfo::Limited => DebugEmissionKind::LineTablesOnly, + DebugInfo::Full => DebugEmissionKind::FullDebug, + } + } + } } extern { pub type ModuleBuffer; } @@ -1222,12 +1247,12 @@ extern "C" { B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value, - ) -> Option<&'a Value>; + ) -> &'a Value; pub fn LLVMRustBuildMaxNum( B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value, - ) -> Option<&'a Value>; + ) -> &'a Value; // Atomic Operations pub fn LLVMRustBuildAtomicLoad(B: &Builder<'a>, @@ -1358,6 +1383,7 @@ extern "C" { pub fn LLVMRustDebugMetadataVersion() -> u32; pub fn LLVMRustVersionMajor() -> u32; pub fn LLVMRustVersionMinor() -> u32; + pub fn LLVMRustIsRustLLVM() -> bool; pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32); @@ -1376,7 +1402,8 @@ extern "C" { isOptimized: bool, Flags: *const c_char, RuntimeVer: c_uint, - SplitName: *const c_char) + SplitName: *const c_char, + kind: DebugEmissionKind) -> &'a DIDescriptor; pub fn LLVMRustDIBuilderCreateFile(Builder: &DIBuilder<'a>, @@ -1396,11 +1423,9 @@ extern "C" { File: &'a DIFile, LineNo: c_uint, Ty: &'a DIType, - isLocalToUnit: bool, - isDefinition: bool, ScopeLine: c_uint, Flags: DIFlags, - isOptimized: bool, + SPFlags: DISPFlags, Fn: &'a Value, TParam: &'a DIArray, Decl: Option<&'a DIDescriptor>) @@ -1538,7 +1563,7 @@ extern "C" { AlignInBits: u32, Elements: &'a DIArray, ClassType: &'a DIType, - IsFixed: bool) + IsScoped: bool) -> &'a DIType; pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>, @@ -1586,9 +1611,10 @@ extern "C" { LineNo: c_uint) -> &'a DINameSpace; - pub fn LLVMRustDICompositeTypeSetTypeArray(Builder: &DIBuilder<'a>, - CompositeType: &'a DIType, - TypeArray: &'a DIArray); + pub fn LLVMRustDICompositeTypeReplaceArrays(Builder: &DIBuilder<'a>, + CompositeType: &'a DIType, + Elements: Option<&'a DIArray>, + Params: Option<&'a DIArray>); pub fn LLVMRustDIBuilderCreateDebugLocation(Context: &'a Context, @@ -1599,15 +1625,12 @@ extern "C" { -> &'a Value; pub fn LLVMRustDIBuilderCreateOpDeref() -> i64; pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64; -} -#[allow(improper_ctypes)] // FIXME(#52456) needed for RustString. -extern "C" { + #[allow(improper_ctypes)] pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString); + #[allow(improper_ctypes)] pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString); -} -extern "C" { pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&Value>; pub fn LLVMIsAConstantFP(value_ref: &Value) -> Option<&Value>; @@ -1685,21 +1708,15 @@ extern "C" { pub fn LLVMRustDestroyArchive(AR: &'static mut Archive); pub fn LLVMRustGetSectionName(SI: &SectionIterator, data: &mut *const c_char) -> size_t; -} -#[allow(improper_ctypes)] // FIXME(#52456) needed for RustString. -extern "C" { + #[allow(improper_ctypes)] pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString); -} -extern "C" { pub fn LLVMContextSetDiagnosticHandler(C: &Context, Handler: DiagnosticHandler, DiagnosticContext: *mut c_void); -} -#[allow(improper_ctypes)] // FIXME(#52456) needed for RustString. -extern "C" { + #[allow(improper_ctypes)] pub fn LLVMRustUnpackOptimizationDiagnostic(DI: &'a DiagnosticInfo, pass_name_out: &RustString, function_out: &mut Option<&'a Value>, @@ -1707,34 +1724,23 @@ extern "C" { loc_column_out: &mut c_uint, loc_filename_out: &RustString, message_out: &RustString); -} -extern "C" { pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: &'a DiagnosticInfo, cookie_out: &mut c_uint, message_out: &mut Option<&'a Twine>, instruction_out: &mut Option<&'a Value>); -} -#[allow(improper_ctypes)] // FIXME(#52456) needed for RustString. -extern "C" { + #[allow(improper_ctypes)] pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString); -} - -extern "C" { pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind; pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: &Context, H: InlineAsmDiagHandler, CX: *mut c_void); -} -#[allow(improper_ctypes)] // FIXME(#52456) needed for RustString. -extern "C" { + #[allow(improper_ctypes)] pub fn LLVMRustWriteSMDiagnosticToString(d: &SMDiagnostic, s: &RustString); -} -extern "C" { pub fn LLVMRustWriteArchive(Dst: *const c_char, NumMembers: size_t, Members: *const &RustArchiveMember, diff --git a/src/librustc_codegen_llvm/llvm/mod.rs b/src/librustc_codegen_llvm/llvm/mod.rs index fbd5192a63f..6a596d78da2 100644 --- a/src/librustc_codegen_llvm/llvm/mod.rs +++ b/src/librustc_codegen_llvm/llvm/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] @@ -125,7 +115,7 @@ pub fn SetFunctionCallConv(fn_: &'a Value, cc: CallConv) { // example happen for generics when using multiple codegen units. This function simply uses the // value's name as the comdat value to make sure that it is in a 1-to-1 relationship to the // function. -// For more details on COMDAT sections see e.g. http://www.airs.com/blog/archives/52 +// For more details on COMDAT sections see e.g., http://www.airs.com/blog/archives/52 pub fn SetUniqueComdat(llmod: &Module, val: &'a Value) { unsafe { LLVMRustSetComdat(llmod, val, LLVMGetValueName(val)); diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs index 267d7e0d54b..b46e6ef84b9 100644 --- a/src/librustc_codegen_llvm/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -1,18 +1,9 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use syntax_pos::symbol::Symbol; -use back::write::create_target_machine; +use back::write::create_informational_target_machine; use llvm; use rustc::session::Session; use rustc::session::config::PrintRequest; +use rustc_target::spec::MergeFunctions; use libc::c_int; use std::ffi::CString; use syntax::feature_gate::UnstableFeatures; @@ -70,6 +61,20 @@ unsafe fn configure_llvm(sess: &Session) { if sess.opts.debugging_opts.disable_instrumentation_preinliner { add("-disable-preinline"); } + if llvm::LLVMRustIsRustLLVM() { + match sess.opts.debugging_opts.merge_functions + .unwrap_or(sess.target.target.options.merge_functions) { + MergeFunctions::Disabled | + MergeFunctions::Trampolines => {} + MergeFunctions::Aliases => { + add("-mergefunc-use-aliases"); + } + } + } + + // HACK(eddyb) LLVM inserts `llvm.assume` calls to preserve align attributes + // during inlining. Unfortunately these may block other optimizations. + add("-preserve-alignment-assumptions-during-inlining=false"); for arg in &sess.opts.cg.llvm_args { add(&(*arg)); @@ -121,6 +126,7 @@ const AARCH64_WHITELIST: &[(&str, Option<&str>)] = &[ ]; const X86_WHITELIST: &[(&str, Option<&str>)] = &[ + ("adx", Some("adx_target_feature")), ("aes", None), ("avx", None), ("avx2", None), @@ -136,10 +142,12 @@ const X86_WHITELIST: &[(&str, Option<&str>)] = &[ ("avx512vpopcntdq", Some("avx512_target_feature")), ("bmi1", None), ("bmi2", None), + ("cmpxchg16b", Some("cmpxchg16b_target_feature")), ("fma", None), ("fxsr", None), ("lzcnt", None), ("mmx", Some("mmx_target_feature")), + ("movbe", Some("movbe_target_feature")), ("pclmulqdq", None), ("popcnt", None), ("rdrand", None), @@ -208,6 +216,7 @@ pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str { ("x86", "pclmulqdq") => "pclmul", ("x86", "rdrand") => "rdrnd", ("x86", "bmi1") => "bmi", + ("x86", "cmpxchg16b") => "cx16", ("aarch64", "fp") => "fp-armv8", ("aarch64", "fp16") => "fullfp16", (_, s) => s, @@ -215,7 +224,7 @@ pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str { } pub fn target_features(sess: &Session) -> Vec { - let target_machine = create_target_machine(sess, true); + let target_machine = create_informational_target_machine(sess, true); target_feature_whitelist(sess) .iter() .filter_map(|&(feature, gate)| { @@ -268,7 +277,7 @@ pub fn print_passes() { pub(crate) fn print(req: PrintRequest, sess: &Session) { require_inited(); - let tm = create_target_machine(sess, true); + let tm = create_informational_target_machine(sess, true); unsafe { match req { PrintRequest::TargetCPUs => llvm::LLVMRustPrintTargetCPUs(tm), diff --git a/src/librustc_codegen_llvm/metadata.rs b/src/librustc_codegen_llvm/metadata.rs index 7752465d885..6e77768b558 100644 --- a/src/librustc_codegen_llvm/metadata.rs +++ b/src/librustc_codegen_llvm/metadata.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::middle::cstore::MetadataLoader; use rustc_target::spec::Target; use llvm; @@ -18,7 +8,7 @@ use rustc_data_structures::owning_ref::OwningRef; use std::path::Path; use std::ptr; use std::slice; -use rustc_fs_util::path2cstr; +use rustc_fs_util::path_to_c_string; pub use rustc_data_structures::sync::MetadataRef; @@ -57,7 +47,7 @@ impl MetadataLoader for LlvmMetadataLoader { filename: &Path) -> Result { unsafe { - let buf = path2cstr(filename); + let buf = path_to_c_string(filename); let mb = llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf.as_ptr()) .ok_or_else(|| format!("error reading library: '{}'", filename.display()))?; let of = ObjectFile::new(mb) diff --git a/src/librustc_codegen_llvm/mono_item.rs b/src/librustc_codegen_llvm/mono_item.rs index 9b2d17d65ca..69fc8783dc8 100644 --- a/src/librustc_codegen_llvm/mono_item.rs +++ b/src/librustc_codegen_llvm/mono_item.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use attributes; use base; use context::CodegenCx; @@ -63,7 +53,7 @@ impl PreDefineMethods<'tcx> for CodegenCx<'ll, 'tcx> { llvm::SetUniqueComdat(self.llmod, lldecl); } - // If we're compiling the compiler-builtins crate, e.g. the equivalent of + // If we're compiling the compiler-builtins crate, e.g., the equivalent of // compiler-rt, then we want to implicitly compile everything with hidden // visibility as we're going to link this object all over the place but // don't want the symbols to get exported. @@ -82,7 +72,12 @@ impl PreDefineMethods<'tcx> for CodegenCx<'ll, 'tcx> { if instance.def.is_inline(self.tcx) { attributes::inline(self, lldecl, attributes::InlineAttr::Hint); } - attributes::from_fn_attrs(self, lldecl, Some(instance.def.def_id())); + attributes::from_fn_attrs( + self, + lldecl, + Some(instance.def.def_id()), + mono_sig, + ); self.instances.borrow_mut().insert(instance, lldecl); } diff --git a/src/librustc_codegen_llvm/type_.rs b/src/librustc_codegen_llvm/type_.rs index 5c4ebc35240..958e00506d6 100644 --- a/src/librustc_codegen_llvm/type_.rs +++ b/src/librustc_codegen_llvm/type_.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals)] pub use llvm::Type; @@ -30,12 +20,13 @@ use abi::{LlvmType, FnTypeExt}; use std::fmt; use std::cell::RefCell; +use std::ptr; use libc::c_uint; impl PartialEq for Type { fn eq(&self, other: &Self) -> bool { - self as *const _ == other as *const _ + ptr::eq(self, other) } } @@ -47,6 +38,22 @@ impl fmt::Debug for Type { } } +impl CodegenCx<'ll, 'tcx> { + crate fn type_named_struct(&self, name: &str) -> &'ll Type { + let name = SmallCStr::new(name); + unsafe { + llvm::LLVMStructCreateNamed(self.llcx, name.as_ptr()) + } + } + + crate fn set_struct_body(&self, ty: &'ll Type, els: &[&'ll Type], packed: bool) { + unsafe { + llvm::LLVMStructSetBody(ty, els.as_ptr(), + els.len() as c_uint, packed as Bool) + } + } +} + impl BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn type_void(&self) -> &'ll Type { unsafe { @@ -160,13 +167,6 @@ impl BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> { } } - fn type_named_struct(&self, name: &str) -> &'ll Type { - let name = SmallCStr::new(name); - unsafe { - llvm::LLVMStructCreateNamed(self.llcx, name.as_ptr()) - } - } - fn type_array(&self, ty: &'ll Type, len: u64) -> &'ll Type { unsafe { @@ -186,13 +186,6 @@ impl BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> { } } - fn set_struct_body(&self, ty: &'ll Type, els: &[&'ll Type], packed: bool) { - unsafe { - llvm::LLVMStructSetBody(ty, els.as_ptr(), - els.len() as c_uint, packed as Bool) - } - } - fn type_ptr_to(&self, ty: &'ll Type) -> &'ll Type { assert_ne!(self.type_kind(ty), TypeKind::Function, "don't call ptr_to on function types, use ptr_to_llvm_type on FnType instead"); @@ -253,7 +246,7 @@ impl Type { } } - // Creates an integer type with the given number of bits, e.g. i24 + // Creates an integer type with the given number of bits, e.g., i24 pub fn ix_llcx( llcx: &llvm::Context, num_bits: u64 diff --git a/src/librustc_codegen_llvm/type_of.rs b/src/librustc_codegen_llvm/type_of.rs index 90c02cddb2b..afaeb352cd9 100644 --- a/src/librustc_codegen_llvm/type_of.rs +++ b/src/librustc_codegen_llvm/type_of.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::{FnType, FnTypeExt}; use common::*; use rustc::hir; @@ -15,8 +5,8 @@ use rustc::ty::{self, Ty, TypeFoldable}; use rustc::ty::layout::{self, Align, LayoutOf, Size, TyLayout}; use rustc_target::abi::FloatTy; use rustc_mir::monomorphize::item::DefPathBasedNames; -use type_::Type; use rustc_codegen_ssa::traits::*; +use type_::Type; use std::fmt::Write; @@ -65,12 +55,12 @@ fn uncached_llvm_type<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, ty::Str => { let mut name = String::with_capacity(32); let printer = DefPathBasedNames::new(cx.tcx, true, true); - printer.push_type_name(layout.ty, &mut name); + printer.push_type_name(layout.ty, &mut name, false); if let (&ty::Adt(def, _), &layout::Variants::Single { index }) = (&layout.ty.sty, &layout.variants) { if def.is_enum() && !def.variants.is_empty() { - write!(&mut name, "::{}", def.variants[index].name).unwrap(); + write!(&mut name, "::{}", def.variants[index].ident).unwrap(); } } Some(name) @@ -80,14 +70,14 @@ fn uncached_llvm_type<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, match layout.fields { layout::FieldPlacement::Union(_) => { - let fill = cx.type_padding_filler( layout.size, layout.align); + let fill = cx.type_padding_filler(layout.size, layout.align.abi); let packed = false; match name { None => { - cx.type_struct( &[fill], packed) + cx.type_struct(&[fill], packed) } Some(ref name) => { - let llty = cx.type_named_struct( name); + let llty = cx.type_named_struct(name); cx.set_struct_body(llty, &[fill], packed); llty } @@ -120,23 +110,23 @@ fn struct_llfields<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, let mut packed = false; let mut offset = Size::ZERO; - let mut prev_effective_align = layout.align; + let mut prev_effective_align = layout.align.abi; let mut result: Vec<_> = Vec::with_capacity(1 + field_count * 2); for i in layout.fields.index_by_increasing_offset() { let target_offset = layout.fields.offset(i as usize); let field = layout.field(cx, i); - let effective_field_align = layout.align - .min(field.align) + let effective_field_align = layout.align.abi + .min(field.align.abi) .restrict_for_offset(target_offset); - packed |= effective_field_align.abi() < field.align.abi(); + packed |= effective_field_align < field.align.abi; debug!("struct_llfields: {}: {:?} offset: {:?} target_offset: {:?} \ effective_field_align: {}", - i, field, offset, target_offset, effective_field_align.abi()); + i, field, offset, target_offset, effective_field_align.bytes()); assert!(target_offset >= offset); let padding = target_offset - offset; let padding_align = prev_effective_align.min(effective_field_align); - assert_eq!(offset.abi_align(padding_align) + padding, target_offset); + assert_eq!(offset.align_to(padding_align) + padding, target_offset); result.push(cx.type_padding_filler( padding, padding_align)); debug!(" padding before: {:?}", padding); @@ -151,7 +141,7 @@ fn struct_llfields<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, } let padding = layout.size - offset; let padding_align = prev_effective_align; - assert_eq!(offset.abi_align(padding_align) + padding, layout.size); + assert_eq!(offset.align_to(padding_align) + padding, layout.size); debug!("struct_llfields: pad_bytes: {:?} offset: {:?} stride: {:?}", padding, offset, layout.size); result.push(cx.type_padding_filler(padding, padding_align)); @@ -166,7 +156,7 @@ fn struct_llfields<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, impl<'a, 'tcx> CodegenCx<'a, 'tcx> { pub fn align_of(&self, ty: Ty<'tcx>) -> Align { - self.layout_of(ty).align + self.layout_of(ty).align.abi } pub fn size_of(&self, ty: Ty<'tcx>) -> Size { @@ -174,7 +164,8 @@ impl<'a, 'tcx> CodegenCx<'a, 'tcx> { } pub fn size_and_align_of(&self, ty: Ty<'tcx>) -> (Size, Align) { - self.layout_of(ty).size_and_align() + let layout = self.layout_of(ty); + (layout.size, layout.align.abi) } } @@ -235,7 +226,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> { } } - /// Get the LLVM type corresponding to a Rust type, i.e. `rustc::ty::Ty`. + /// Get the LLVM type corresponding to a Rust type, i.e., `rustc::ty::Ty`. /// The pointee type of the pointer in `PlaceRef` is always this type. /// For sized types, it is also the right LLVM type for an `alloca` /// containing a value of that type, and most immediates (except `bool`). @@ -332,7 +323,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> { layout::Pointer => { // If we know the alignment, pick something better than i8. let pointee = if let Some(pointee) = self.pointee_info_at(cx, offset) { - cx.type_pointee_for_abi_align( pointee.align) + cx.type_pointee_for_align(pointee.align) } else { cx.type_i8() }; @@ -376,7 +367,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> { let offset = if index == 0 { Size::ZERO } else { - a.value.size(cx).abi_align(b.value.align(cx)) + a.value.size(cx).align_to(b.value.align(cx).abi) }; self.scalar_llvm_type_at(cx, scalar, offset) } @@ -469,9 +460,9 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> { // (according to its type), or null (which the // niche field's scalar validity range encodes). // This allows using `dereferenceable_or_null` - // for e.g. `Option<&T>`, and this will continue + // for e.g., `Option<&T>`, and this will continue // to work as long as we don't start using more - // niches than just null (e.g. the first page + // niches than just null (e.g., the first page // of the address space, or unaligned pointers). if self.fields.offset(0) == offset { Some(self.for_variant(cx, dataful_variant)) diff --git a/src/librustc_codegen_llvm/va_arg.rs b/src/librustc_codegen_llvm/va_arg.rs new file mode 100644 index 00000000000..9239f85a8f2 --- /dev/null +++ b/src/librustc_codegen_llvm/va_arg.rs @@ -0,0 +1,148 @@ +use builder::Builder; +use rustc_codegen_ssa::mir::operand::OperandRef; +use rustc_codegen_ssa::traits::{BaseTypeMethods, BuilderMethods, ConstMethods, DerivedTypeMethods}; +use rustc::ty::layout::{Align, HasDataLayout, HasTyCtxt, LayoutOf, Size}; +use rustc::ty::Ty; +use type_::Type; +use type_of::LayoutLlvmExt; +use value::Value; + +#[allow(dead_code)] +fn round_pointer_up_to_alignment( + bx: &mut Builder<'a, 'll, 'tcx>, + addr: &'ll Value, + align: Align, + ptr_ty: &'ll Type +) -> &'ll Value { + let mut ptr_as_int = bx.ptrtoint(addr, bx.cx().type_isize()); + ptr_as_int = bx.add(ptr_as_int, bx.cx().const_i32(align.bytes() as i32 - 1)); + ptr_as_int = bx.and(ptr_as_int, bx.cx().const_i32(-(align.bytes() as i32))); + bx.inttoptr(ptr_as_int, ptr_ty) +} + +fn emit_direct_ptr_va_arg( + bx: &mut Builder<'a, 'll, 'tcx>, + list: OperandRef<'tcx, &'ll Value>, + llty: &'ll Type, + size: Size, + align: Align, + slot_size: Align, + allow_higher_align: bool +) -> (&'ll Value, Align) { + let va_list_ptr_ty = bx.cx().type_ptr_to(bx.cx.type_i8p()); + let va_list_addr = if list.layout.llvm_type(bx.cx) != va_list_ptr_ty { + bx.bitcast(list.immediate(), va_list_ptr_ty) + } else { + list.immediate() + }; + + let ptr = bx.load(va_list_addr, bx.tcx().data_layout.pointer_align.abi); + + let (addr, addr_align) = if allow_higher_align && align > slot_size { + (round_pointer_up_to_alignment(bx, ptr, align, bx.cx().type_i8p()), align) + } else { + (ptr, slot_size) + }; + + + let aligned_size = size.align_to(slot_size).bytes() as i32; + let full_direct_size = bx.cx().const_i32(aligned_size); + let next = bx.inbounds_gep(addr, &[full_direct_size]); + bx.store(next, va_list_addr, bx.tcx().data_layout.pointer_align.abi); + + if size.bytes() < slot_size.bytes() && + &*bx.tcx().sess.target.target.target_endian == "big" { + let adjusted_size = bx.cx().const_i32((slot_size.bytes() - size.bytes()) as i32); + let adjusted = bx.inbounds_gep(addr, &[adjusted_size]); + (bx.bitcast(adjusted, bx.cx().type_ptr_to(llty)), addr_align) + } else { + (bx.bitcast(addr, bx.cx().type_ptr_to(llty)), addr_align) + } +} + +fn emit_ptr_va_arg( + bx: &mut Builder<'a, 'll, 'tcx>, + list: OperandRef<'tcx, &'ll Value>, + target_ty: Ty<'tcx>, + indirect: bool, + slot_size: Align, + allow_higher_align: bool +) -> &'ll Value { + let layout = bx.cx.layout_of(target_ty); + let (llty, size, align) = if indirect { + (bx.cx.layout_of(bx.cx.tcx.mk_imm_ptr(target_ty)).llvm_type(bx.cx), + bx.cx.data_layout().pointer_size, + bx.cx.data_layout().pointer_align) + } else { + (layout.llvm_type(bx.cx), + layout.size, + layout.align) + }; + let (addr, addr_align) = emit_direct_ptr_va_arg(bx, list, llty, size, align.abi, + slot_size, allow_higher_align); + if indirect { + let tmp_ret = bx.load(addr, addr_align); + bx.load(tmp_ret, align.abi) + } else { + bx.load(addr, addr_align) + } +} + +pub(super) fn emit_va_arg( + bx: &mut Builder<'a, 'll, 'tcx>, + addr: OperandRef<'tcx, &'ll Value>, + target_ty: Ty<'tcx>, +) -> &'ll Value { + // Determine the va_arg implementation to use. The LLVM va_arg instruction + // is lacking in some instances, so we should only use it as a fallback. + let target = &bx.cx.tcx.sess.target.target; + let arch = &bx.cx.tcx.sess.target.target.arch; + match (&**arch, target.options.is_like_windows) { + // Windows x86 + ("x86", true) => { + emit_ptr_va_arg(bx, addr, target_ty, false, + Align::from_bytes(4).unwrap(), false) + } + // Generic x86 + ("x86", _) => { + emit_ptr_va_arg(bx, addr, target_ty, false, + Align::from_bytes(4).unwrap(), true) + } + // Windows Aarch64 + ("aarch4", true) => { + emit_ptr_va_arg(bx, addr, target_ty, false, + Align::from_bytes(8).unwrap(), false) + } + // iOS Aarch64 + ("aarch4", _) if target.target_os == "ios" => { + emit_ptr_va_arg(bx, addr, target_ty, false, + Align::from_bytes(8).unwrap(), true) + } + // Windows x86_64 + ("x86_64", true) => { + let target_ty_size = bx.cx.size_of(target_ty).bytes(); + let indirect = if target_ty_size > 8 || !target_ty_size.is_power_of_two() { + true + } else { + false + }; + emit_ptr_va_arg(bx, addr, target_ty, indirect, + Align::from_bytes(8).unwrap(), false) + } + // For all other architecture/OS combinations fall back to using + // the LLVM va_arg instruction. + // https://llvm.org/docs/LangRef.html#va-arg-instruction + _ => { + let va_list = if (target.arch == "aarch64" || + target.arch == "x86_64" || + target.arch == "powerpc") && + !target.options.is_like_windows { + bx.load(addr.immediate(), bx.tcx().data_layout.pointer_align.abi) + } else { + addr.immediate() + }; + bx.va_arg(va_list, bx.cx.layout_of(target_ty).llvm_type(bx.cx)) + } + } +} + diff --git a/src/librustc_codegen_llvm/value.rs b/src/librustc_codegen_llvm/value.rs index 4bf5b09baa6..3ad1521be93 100644 --- a/src/librustc_codegen_llvm/value.rs +++ b/src/librustc_codegen_llvm/value.rs @@ -1,23 +1,14 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use llvm::Value; use llvm; use std::fmt; use std::hash::{Hash, Hasher}; +use std::ptr; impl PartialEq for Value { fn eq(&self, other: &Self) -> bool { - self as *const _ == other as *const _ + ptr::eq(self, other) } } diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index a158c34f9d1..50994497c28 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -6,10 +6,29 @@ version = "0.0.0" [lib] name = "rustc_codegen_ssa" path = "lib.rs" +crate-type = ["dylib"] test = false [dependencies] +bitflags = "1.0.4" cc = "1.0.1" num_cpus = "1.0" rustc-demangle = "0.1.4" memmap = "0.6" +log = "0.4.5" +libc = "0.2.44" +jobserver = "0.1.11" + +serialize = { path = "../libserialize" } +syntax = { path = "../libsyntax" } +syntax_pos = { path = "../libsyntax_pos" } +rustc = { path = "../librustc" } +rustc_allocator = { path = "../librustc_allocator" } +rustc_apfloat = { path = "../librustc_apfloat" } +rustc_codegen_utils = { path = "../librustc_codegen_utils" } +rustc_data_structures = { path = "../librustc_data_structures"} +rustc_errors = { path = "../librustc_errors" } +rustc_fs_util = { path = "../librustc_fs_util" } +rustc_incremental = { path = "../librustc_incremental" } +rustc_mir = { path = "../librustc_mir" } +rustc_target = { path = "../librustc_target" } diff --git a/src/librustc_codegen_ssa/back/archive.rs b/src/librustc_codegen_ssa/back/archive.rs index b5e1deb0d5d..0a16d1b03e2 100644 --- a/src/librustc_codegen_ssa/back/archive.rs +++ b/src/librustc_codegen_ssa/back/archive.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::session::Session; use std::path::PathBuf; diff --git a/src/librustc_codegen_ssa/back/command.rs b/src/librustc_codegen_ssa/back/command.rs index 9ebbdd7c3c9..bc484ace584 100644 --- a/src/librustc_codegen_ssa/back/command.rs +++ b/src/librustc_codegen_ssa/back/command.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A thin wrapper around `Command` in the standard library which allows us to //! read the arguments that are built up. diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index b0575b841d5..d03bb0a3d73 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// For all the linkers we support, and information they might /// need out of the shared crate context before we get rid of it. @@ -161,7 +151,11 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) { LinkerFlavor::Lld(_) => "lld", }), flavor)), (Some(linker), None) => { - let stem = linker.file_stem().and_then(|stem| stem.to_str()).unwrap_or_else(|| { + let stem = if linker.extension().and_then(|ext| ext.to_str()) == Some("exe") { + linker.file_stem().and_then(|stem| stem.to_str()) + } else { + linker.to_str() + }.unwrap_or_else(|| { sess.fatal("couldn't extract file stem from specified linker"); }).to_owned(); @@ -188,11 +182,7 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) { // linker and linker flavor specified via command line have precedence over what the target // specification specifies - if let Some(ret) = infer_from( - sess, - sess.opts.cg.linker.clone(), - sess.opts.debugging_opts.linker_flavor, - ) { + if let Some(ret) = infer_from(sess, sess.opts.cg.linker.clone(), sess.opts.cg.linker_flavor) { return ret; } diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index da9cfbb94d1..ad61f8f01d8 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::symbol_export; use super::command::Command; use super::archive; @@ -91,11 +81,7 @@ impl LinkerInfo { } LinkerFlavor::Lld(LldFlavor::Wasm) => { - Box::new(WasmLd { - cmd, - sess, - info: self - }) as Box + Box::new(WasmLd::new(cmd, sess, self)) as Box } } } @@ -107,7 +93,7 @@ impl LinkerInfo { /// This trait is the total list of requirements needed by `back::link` and /// represents the meaning of each option being passed down. This trait is then /// used to dispatch on whether a GNU-like linker (generally `ld.exe`) or an -/// MSVC linker (e.g. `link.exe`) is being used. +/// MSVC linker (e.g., `link.exe`) is being used. pub trait Linker { fn link_dylib(&mut self, lib: &str); fn link_rust_dylib(&mut self, lib: &str, path: &Path); @@ -606,8 +592,7 @@ impl<'a> Linker for MsvcLinker<'a> { self.cmd.arg("/DEBUG"); // This will cause the Microsoft linker to embed .natvis info into the PDB file - let sysroot = self.sess.sysroot(); - let natvis_dir_path = sysroot.join("lib\\rustlib\\etc"); + let natvis_dir_path = self.sess.sysroot.join("lib\\rustlib\\etc"); if let Ok(natvis_dir) = fs::read_dir(&natvis_dir_path) { // LLVM 5.0.0's lld-link frontend doesn't yet recognize, and chokes // on, the /NATVIS:... flags. LLVM 6 (or earlier) should at worst ignore @@ -887,6 +872,64 @@ pub struct WasmLd<'a> { info: &'a LinkerInfo, } +impl<'a> WasmLd<'a> { + fn new(mut cmd: Command, sess: &'a Session, info: &'a LinkerInfo) -> WasmLd<'a> { + // There have been reports in the wild (rustwasm/wasm-bindgen#119) of + // using threads causing weird hangs and bugs. Disable it entirely as + // this isn't yet the bottleneck of compilation at all anyway. + cmd.arg("--no-threads"); + + // By default LLD only gives us one page of stack (64k) which is a + // little small. Default to a larger stack closer to other PC platforms + // (1MB) and users can always inject their own link-args to override this. + cmd.arg("-z").arg("stack-size=1048576"); + + // By default LLD's memory layout is: + // + // 1. First, a blank page + // 2. Next, all static data + // 3. Finally, the main stack (which grows down) + // + // This has the unfortunate consequence that on stack overflows you + // corrupt static data and can cause some exceedingly weird bugs. To + // help detect this a little sooner we instead request that the stack is + // placed before static data. + // + // This means that we'll generate slightly larger binaries as references + // to static data will take more bytes in the ULEB128 encoding, but + // stack overflow will be guaranteed to trap as it underflows instead of + // corrupting static data. + cmd.arg("--stack-first"); + + // FIXME we probably shouldn't pass this but instead pass an explicit + // whitelist of symbols we'll allow to be undefined. Unfortunately + // though we can't handle symbols like `log10` that LLVM injects at a + // super late date without actually parsing object files. For now let's + // stick to this and hopefully fix it before stabilization happens. + cmd.arg("--allow-undefined"); + + // For now we just never have an entry symbol + cmd.arg("--no-entry"); + + // Rust code should never have warnings, and warnings are often + // indicative of bugs, let's prevent them. + cmd.arg("--fatal-warnings"); + + // The symbol visibility story is a bit in flux right now with LLD. + // It's... not entirely clear to me what's going on, but this looks to + // make everything work when `export_symbols` isn't otherwise called for + // things like executables. + cmd.arg("--export-dynamic"); + + // LLD only implements C++-like demangling, which doesn't match our own + // mangling scheme. Tell LLD to not demangle anything and leave it up to + // us to demangle these symbols later. + cmd.arg("--no-demangle"); + + WasmLd { cmd, sess, info } + } +} + impl<'a> Linker for WasmLd<'a> { fn link_dylib(&mut self, lib: &str) { self.cmd.arg("-l").arg(lib); @@ -993,50 +1036,6 @@ impl<'a> Linker for WasmLd<'a> { } fn finalize(&mut self) -> Command { - // There have been reports in the wild (rustwasm/wasm-bindgen#119) of - // using threads causing weird hangs and bugs. Disable it entirely as - // this isn't yet the bottleneck of compilation at all anyway. - self.cmd.arg("--no-threads"); - - // By default LLD only gives us one page of stack (64k) which is a - // little small. Default to a larger stack closer to other PC platforms - // (1MB) and users can always inject their own link-args to override this. - self.cmd.arg("-z").arg("stack-size=1048576"); - - // By default LLD's memory layout is: - // - // 1. First, a blank page - // 2. Next, all static data - // 3. Finally, the main stack (which grows down) - // - // This has the unfortunate consequence that on stack overflows you - // corrupt static data and can cause some exceedingly weird bugs. To - // help detect this a little sooner we instead request that the stack is - // placed before static data. - // - // This means that we'll generate slightly larger binaries as references - // to static data will take more bytes in the ULEB128 encoding, but - // stack overflow will be guaranteed to trap as it underflows instead of - // corrupting static data. - self.cmd.arg("--stack-first"); - - // FIXME we probably shouldn't pass this but instead pass an explicit - // whitelist of symbols we'll allow to be undefined. Unfortunately - // though we can't handle symbols like `log10` that LLVM injects at a - // super late date without actually parsing object files. For now let's - // stick to this and hopefully fix it before stabilization happens. - self.cmd.arg("--allow-undefined"); - - // For now we just never have an entry symbol - self.cmd.arg("--no-entry"); - - // Make the default table accessible - self.cmd.arg("--export-table"); - - // Rust code should never have warnings, and warnings are often - // indicative of bugs, let's prevent them. - self.cmd.arg("--fatal-warnings"); - ::std::mem::replace(&mut self.cmd, Command::new("")) } @@ -1050,6 +1049,10 @@ impl<'a> Linker for WasmLd<'a> { } fn exported_symbols(tcx: TyCtxt, crate_type: CrateType) -> Vec { + if let Some(ref exports) = tcx.sess.target.target.options.override_export_symbols { + return exports.clone() + } + let mut symbols = Vec::new(); let export_threshold = symbol_export::crates_export_threshold(&[crate_type]); diff --git a/src/librustc_codegen_ssa/back/lto.rs b/src/librustc_codegen_ssa/back/lto.rs index 8d03edca004..f0fb115f91b 100644 --- a/src/librustc_codegen_ssa/back/lto.rs +++ b/src/librustc_codegen_ssa/back/lto.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::write::CodegenContext; use traits::*; use ModuleCodegen; diff --git a/src/librustc_codegen_ssa/back/mod.rs b/src/librustc_codegen_ssa/back/mod.rs index 3d7ead74d1c..888108408fb 100644 --- a/src/librustc_codegen_ssa/back/mod.rs +++ b/src/librustc_codegen_ssa/back/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod write; pub mod linker; pub mod lto; diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index 0463da00c89..c372892c521 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::sync::Lrc; use std::sync::Arc; @@ -85,7 +75,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // categories: // // 1. Those that are included statically via a static library - // 2. Those included otherwise (e.g. dynamically or via a framework) + // 2. Those included otherwise (e.g., dynamically or via a framework) // // Although our LLVM module is not literally emitting code for the // statically included symbols, it's an export of our library which @@ -93,9 +83,9 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // // As a result, if this id is an FFI item (foreign item) then we only // let it through if it's included statically. - match tcx.hir.get(node_id) { + match tcx.hir().get(node_id) { Node::ForeignItem(..) => { - let def_id = tcx.hir.local_def_id(node_id); + let def_id = tcx.hir().local_def_id(node_id); if tcx.is_statically_included_foreign_item(def_id) { Some(def_id) } else { @@ -115,7 +105,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, node: hir::ImplItemKind::Method(..), .. }) => { - let def_id = tcx.hir.local_def_id(node_id); + let def_id = tcx.hir().local_def_id(node_id); let generics = tcx.generics_of(def_id); if !generics.requires_monomorphization(tcx) && // Functions marked with #[inline] are only ever codegened @@ -157,14 +147,12 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }) .collect(); - if let Some(id) = *tcx.sess.derive_registrar_fn.get() { - let def_id = tcx.hir.local_def_id(id); - reachable_non_generics.insert(def_id, SymbolExportLevel::C); + if let Some(id) = tcx.proc_macro_decls_static(LOCAL_CRATE) { + reachable_non_generics.insert(id, SymbolExportLevel::C); } - if let Some(id) = *tcx.sess.plugin_registrar_fn.get() { - let def_id = tcx.hir.local_def_id(id); - reachable_non_generics.insert(def_id, SymbolExportLevel::C); + if let Some(id) = tcx.plugin_registrar_fn(LOCAL_CRATE) { + reachable_non_generics.insert(id, SymbolExportLevel::C); } Lrc::new(reachable_non_generics) @@ -206,7 +194,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }) .collect(); - if tcx.sess.entry_fn.borrow().is_some() { + if tcx.entry_fn(LOCAL_CRATE).is_some() { let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new("main")); symbols.push((exported_symbol, SymbolExportLevel::C)); @@ -225,14 +213,15 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // These are weak symbols that point to the profile version and the // profile name, which need to be treated as exported so LTO doesn't nix // them. - const PROFILER_WEAK_SYMBOLS: [&'static str; 2] = [ + const PROFILER_WEAK_SYMBOLS: [&str; 2] = [ "__llvm_profile_raw_version", "__llvm_profile_filename", ]; - for sym in &PROFILER_WEAK_SYMBOLS { + + symbols.extend(PROFILER_WEAK_SYMBOLS.iter().map(|sym| { let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(sym)); - symbols.push((exported_symbol, SymbolExportLevel::C)); - } + (exported_symbol, SymbolExportLevel::C) + })); } if tcx.sess.crate_types.borrow().contains(&config::CrateType::Dylib) { @@ -354,7 +343,7 @@ fn upstream_monomorphizations_for_provider<'a, 'tcx>( } fn is_unreachable_local_definition_provider(tcx: TyCtxt, def_id: DefId) -> bool { - if let Some(node_id) = tcx.hir.as_local_node_id(def_id) { + if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { !tcx.reachable_set(LOCAL_CRATE).0.contains(&node_id) } else { bug!("is_unreachable_local_definition called with non-local DefId: {:?}", @@ -392,7 +381,7 @@ fn symbol_export_level(tcx: TyCtxt, sym_def_id: DefId) -> SymbolExportLevel { if let Some(Node::Item(&hir::Item { node: hir::ItemKind::Static(..), .. - })) = tcx.hir.get_if_local(sym_def_id) { + })) = tcx.hir().get_if_local(sym_def_id) { return SymbolExportLevel::Rust; } } diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 46aee5339ba..67d4d408bab 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use {ModuleCodegen, ModuleKind, CachedModuleCodegen, CompiledModule, CrateInfo, CodegenResults, RLIB_BYTECODE_EXTENSION}; use super::linker::LinkerInfo; @@ -34,6 +24,7 @@ use rustc_fs_util::link_or_copy; use rustc_data_structures::svh::Svh; use rustc_errors::{Handler, Level, DiagnosticBuilder, FatalError, DiagnosticId}; use rustc_errors::emitter::{Emitter}; +use rustc_target::spec::MergeFunctions; use syntax::attr; use syntax::ext::hygiene::Mark; use syntax_pos::MultiSpan; @@ -162,8 +153,24 @@ impl ModuleConfig { sess.opts.optimize == config::OptLevel::Aggressive && !sess.target.target.options.is_like_emscripten; - self.merge_functions = sess.opts.optimize == config::OptLevel::Default || - sess.opts.optimize == config::OptLevel::Aggressive; + // Some targets (namely, NVPTX) interact badly with the MergeFunctions + // pass. This is because MergeFunctions can generate new function calls + // which may interfere with the target calling convention; e.g. for the + // NVPTX target, PTX kernels should not call other PTX kernels. + // MergeFunctions can also be configured to generate aliases instead, + // but aliases are not supported by some backends (again, NVPTX). + // Therefore, allow targets to opt out of the MergeFunctions pass, + // but otherwise keep the pass enabled (at O2 and O3) since it can be + // useful for reducing code size. + self.merge_functions = match sess.opts.debugging_opts.merge_functions + .unwrap_or(sess.target.target.options.merge_functions) { + MergeFunctions::Disabled => false, + MergeFunctions::Trampolines | + MergeFunctions::Aliases => { + sess.opts.optimize == config::OptLevel::Default || + sess.opts.optimize == config::OptLevel::Aggressive + } + }; } pub fn bitcode_needed(&self) -> bool { @@ -252,7 +259,8 @@ impl CodegenContext { fn generate_lto_work( cgcx: &CodegenContext, - modules: Vec>, + needs_fat_lto: Vec>, + needs_thin_lto: Vec<(String, B::ThinBuffer)>, import_only_modules: Vec<(SerializedModule, WorkProduct)> ) -> Vec<(WorkItem, u64)> { let mut timeline = cgcx.time_graph.as_ref().map(|tg| { @@ -260,22 +268,28 @@ fn generate_lto_work( CODEGEN_WORK_PACKAGE_KIND, "generate lto") }).unwrap_or(Timeline::noop()); - let (lto_modules, copy_jobs) = B::run_lto(cgcx, modules, import_only_modules, &mut timeline) - .unwrap_or_else(|e| e.raise()); - let lto_modules = lto_modules.into_iter().map(|module| { + let (lto_modules, copy_jobs) = if !needs_fat_lto.is_empty() { + assert!(needs_thin_lto.is_empty()); + assert!(import_only_modules.is_empty()); + let lto_module = B::run_fat_lto(cgcx, needs_fat_lto, &mut timeline) + .unwrap_or_else(|e| e.raise()); + (vec![lto_module], vec![]) + } else { + assert!(needs_fat_lto.is_empty()); + B::run_thin_lto(cgcx, needs_thin_lto, import_only_modules, &mut timeline) + .unwrap_or_else(|e| e.raise()) + }; + + lto_modules.into_iter().map(|module| { let cost = module.cost(); (WorkItem::LTO(module), cost) - }); - - let copy_jobs = copy_jobs.into_iter().map(|wp| { + }).chain(copy_jobs.into_iter().map(|wp| { (WorkItem::CopyPostLtoArtifacts(CachedModuleCodegen { name: wp.cgu_name.clone(), source: wp, }), 0) - }); - - lto_modules.chain(copy_jobs).collect() + })).collect() } pub struct CompiledModules { @@ -313,8 +327,8 @@ pub fn start_async_codegen( let sess = tcx.sess; let crate_name = tcx.crate_name(LOCAL_CRATE); let crate_hash = tcx.crate_hash(LOCAL_CRATE); - let no_builtins = attr::contains_name(&tcx.hir.krate().attrs, "no_builtins"); - let subsystem = attr::first_attr_value_str_by_name(&tcx.hir.krate().attrs, + let no_builtins = attr::contains_name(&tcx.hir().krate().attrs, "no_builtins"); + let subsystem = attr::first_attr_value_str_by_name(&tcx.hir().krate().attrs, "windows_subsystem"); let windows_subsystem = subsystem.map(|subsystem| { if subsystem != "windows" && subsystem != "console" { @@ -671,16 +685,17 @@ impl WorkItem { } } -enum WorkItemResult { +enum WorkItemResult { Compiled(CompiledModule), - NeedsLTO(ModuleCodegen), + NeedsFatLTO(ModuleCodegen), + NeedsThinLTO(String, B::ThinBuffer), } fn execute_work_item( cgcx: &CodegenContext, work_item: WorkItem, timeline: &mut Timeline -) -> Result, FatalError> { +) -> Result, FatalError> { let module_config = cgcx.config(work_item.module_kind()); match work_item { @@ -696,67 +711,80 @@ fn execute_work_item( } } +// Actual LTO type we end up chosing based on multiple factors. +enum ComputedLtoType { + No, + Thin, + Fat, +} + fn execute_optimize_work_item( cgcx: &CodegenContext, module: ModuleCodegen, module_config: &ModuleConfig, timeline: &mut Timeline -) -> Result, FatalError> { +) -> Result, FatalError> { let diag_handler = cgcx.create_diag_handler(); unsafe { B::optimize(cgcx, &diag_handler, &module, module_config, timeline)?; } - let linker_does_lto = cgcx.opts.debugging_opts.cross_lang_lto.enabled(); - // After we've done the initial round of optimizations we need to // decide whether to synchronously codegen this module or ship it // back to the coordinator thread for further LTO processing (which // has to wait for all the initial modules to be optimized). - // - // Here we dispatch based on the `cgcx.lto` and kind of module we're - // codegenning... - let needs_lto = match cgcx.lto { - Lto::No => false, - // If the linker does LTO, we don't have to do it. Note that we - // keep doing full LTO, if it is requested, as not to break the - // assumption that the output will be a single module. - Lto::Thin | Lto::ThinLocal if linker_does_lto => false, + // If the linker does LTO, we don't have to do it. Note that we + // keep doing full LTO, if it is requested, as not to break the + // assumption that the output will be a single module. + let linker_does_lto = cgcx.opts.debugging_opts.cross_lang_lto.enabled(); - // Here we've got a full crate graph LTO requested. We ignore - // this, however, if the crate type is only an rlib as there's - // no full crate graph to process, that'll happen later. - // - // This use case currently comes up primarily for targets that - // require LTO so the request for LTO is always unconditionally - // passed down to the backend, but we don't actually want to do - // anything about it yet until we've got a final product. - Lto::Fat | Lto::Thin => { - cgcx.crate_types.len() != 1 || - cgcx.crate_types[0] != config::CrateType::Rlib - } + // When we're automatically doing ThinLTO for multi-codegen-unit + // builds we don't actually want to LTO the allocator modules if + // it shows up. This is due to various linker shenanigans that + // we'll encounter later. + let is_allocator = module.kind == ModuleKind::Allocator; - // When we're automatically doing ThinLTO for multi-codegen-unit - // builds we don't actually want to LTO the allocator modules if - // it shows up. This is due to various linker shenanigans that - // we'll encounter later. - Lto::ThinLocal => { - module.kind != ModuleKind::Allocator - } - }; + // We ignore a request for full crate grath LTO if the cate type + // is only an rlib, as there is no full crate graph to process, + // that'll happen later. + // + // This use case currently comes up primarily for targets that + // require LTO so the request for LTO is always unconditionally + // passed down to the backend, but we don't actually want to do + // anything about it yet until we've got a final product. + let is_rlib = cgcx.crate_types.len() == 1 + && cgcx.crate_types[0] == config::CrateType::Rlib; // Metadata modules never participate in LTO regardless of the lto // settings. - let needs_lto = needs_lto && module.kind != ModuleKind::Metadata; - - if needs_lto { - Ok(WorkItemResult::NeedsLTO(module)) + let lto_type = if module.kind == ModuleKind::Metadata { + ComputedLtoType::No } else { - let module = unsafe { B::codegen(cgcx, &diag_handler, module, module_config, timeline)? }; - Ok(WorkItemResult::Compiled(module)) - } + match cgcx.lto { + Lto::ThinLocal if !linker_does_lto && !is_allocator + => ComputedLtoType::Thin, + Lto::Thin if !linker_does_lto && !is_rlib + => ComputedLtoType::Thin, + Lto::Fat if !is_rlib => ComputedLtoType::Fat, + _ => ComputedLtoType::No, + } + }; + + Ok(match lto_type { + ComputedLtoType::No => { + let module = unsafe { + B::codegen(cgcx, &diag_handler, module, module_config, timeline)? + }; + WorkItemResult::Compiled(module) + } + ComputedLtoType::Thin => { + let (name, thin_buffer) = B::prepare_thin(cgcx, module); + WorkItemResult::NeedsThinLTO(name, thin_buffer) + } + ComputedLtoType::Fat => WorkItemResult::NeedsFatLTO(module), + }) } fn execute_copy_from_cache_work_item( @@ -764,7 +792,7 @@ fn execute_copy_from_cache_work_item( module: CachedModuleCodegen, module_config: &ModuleConfig, _: &mut Timeline -) -> Result, FatalError> { +) -> Result, FatalError> { let incr_comp_session_dir = cgcx.incr_comp_session_dir .as_ref() .unwrap(); @@ -826,7 +854,7 @@ fn execute_lto_work_item( mut module: lto::LtoModuleCodegen, module_config: &ModuleConfig, timeline: &mut Timeline -) -> Result, FatalError> { +) -> Result, FatalError> { let diag_handler = cgcx.create_diag_handler(); unsafe { @@ -838,10 +866,15 @@ fn execute_lto_work_item( pub enum Message { Token(io::Result), - NeedsLTO { + NeedsFatLTO { result: ModuleCodegen, worker_id: usize, }, + NeedsThinLTO { + name: String, + thin_buffer: B::ThinBuffer, + worker_id: usize, + }, Done { result: Result, worker_id: usize, @@ -949,6 +982,7 @@ fn start_executing_work( None }; + let ol = tcx.backend_optimization_level(LOCAL_CRATE); let cgcx = CodegenContext:: { backend: backend.clone(), crate_types: sess.crate_types.borrow().clone(), @@ -972,7 +1006,7 @@ fn start_executing_work( regular_module_config: modules_config, metadata_module_config: metadata_config, allocator_module_config: allocator_config, - tm_factory: TargetMachineFactory(backend.target_machine_factory(tcx.sess, false)), + tm_factory: TargetMachineFactory(backend.target_machine_factory(tcx.sess, ol, false)), total_cgus, msvc_imps_needed: msvc_imps_needed(tcx), target_pointer_width: tcx.sess.target.target.target_pointer_width.clone(), @@ -1137,7 +1171,8 @@ fn start_executing_work( let mut compiled_modules = vec![]; let mut compiled_metadata_module = None; let mut compiled_allocator_module = None; - let mut needs_lto = Vec::new(); + let mut needs_fat_lto = Vec::new(); + let mut needs_thin_lto = Vec::new(); let mut lto_import_only_modules = Vec::new(); let mut started_lto = false; let mut codegen_aborted = false; @@ -1166,7 +1201,8 @@ fn start_executing_work( running > 0 || (!codegen_aborted && ( work_items.len() > 0 || - needs_lto.len() > 0 || + needs_fat_lto.len() > 0 || + needs_thin_lto.len() > 0 || lto_import_only_modules.len() > 0 || main_thread_worker_state != MainThreadWorkerState::Idle )) @@ -1212,12 +1248,17 @@ fn start_executing_work( running == 0 && main_thread_worker_state == MainThreadWorkerState::Idle { assert!(!started_lto); - assert!(needs_lto.len() + lto_import_only_modules.len() > 0); started_lto = true; - let modules = mem::replace(&mut needs_lto, Vec::new()); + + let needs_fat_lto = + mem::replace(&mut needs_fat_lto, Vec::new()); + let needs_thin_lto = + mem::replace(&mut needs_thin_lto, Vec::new()); let import_only_modules = mem::replace(&mut lto_import_only_modules, Vec::new()); - for (work, cost) in generate_lto_work(&cgcx, modules, import_only_modules) { + + for (work, cost) in generate_lto_work(&cgcx, needs_fat_lto, + needs_thin_lto, import_only_modules) { let insertion_index = work_items .binary_search_by_key(&cost, |&(_, cost)| cost) .unwrap_or_else(|e| e); @@ -1284,6 +1325,21 @@ fn start_executing_work( // Relinquish accidentally acquired extra tokens tokens.truncate(running); + // If a thread exits successfully then we drop a token associated + // with that worker and update our `running` count. We may later + // re-acquire a token to continue running more work. We may also not + // actually drop a token here if the worker was running with an + // "ephemeral token" + let mut free_worker = |worker_id| { + if main_thread_worker_state == MainThreadWorkerState::LLVMing { + main_thread_worker_state = MainThreadWorkerState::Idle; + } else { + running -= 1; + } + + free_worker_ids.push(worker_id); + }; + let msg = coordinator_receive.recv().unwrap(); match *msg.downcast::>().ok().unwrap() { // Save the token locally and the next turn of the loop will use @@ -1358,24 +1414,8 @@ fn start_executing_work( assert_eq!(main_thread_worker_state, MainThreadWorkerState::Codegenning); } - - // If a thread exits successfully then we drop a token associated - // with that worker and update our `running` count. We may later - // re-acquire a token to continue running more work. We may also not - // actually drop a token here if the worker was running with an - // "ephemeral token" - // - // Note that if the thread failed that means it panicked, so we - // abort immediately. Message::Done { result: Ok(compiled_module), worker_id } => { - if main_thread_worker_state == MainThreadWorkerState::LLVMing { - main_thread_worker_state = MainThreadWorkerState::Idle; - } else { - running -= 1; - } - - free_worker_ids.push(worker_id); - + free_worker(worker_id); match compiled_module.kind { ModuleKind::Regular => { compiled_modules.push(compiled_module); @@ -1390,15 +1430,15 @@ fn start_executing_work( } } } - Message::NeedsLTO { result, worker_id } => { + Message::NeedsFatLTO { result, worker_id } => { assert!(!started_lto); - if main_thread_worker_state == MainThreadWorkerState::LLVMing { - main_thread_worker_state = MainThreadWorkerState::Idle; - } else { - running -= 1; - } - free_worker_ids.push(worker_id); - needs_lto.push(result); + free_worker(worker_id); + needs_fat_lto.push(result); + } + Message::NeedsThinLTO { name, thin_buffer, worker_id } => { + assert!(!started_lto); + free_worker(worker_id); + needs_thin_lto.push((name, thin_buffer)); } Message::AddImportOnlyModule { module_data, work_product } => { assert!(!started_lto); @@ -1408,6 +1448,7 @@ fn start_executing_work( lto_import_only_modules.push((module_data, work_product)); main_thread_worker_state = MainThreadWorkerState::Idle; } + // If the thread failed that means it panicked, so we abort immediately. Message::Done { result: Err(()), worker_id: _ } => { bug!("worker thread panicked"); } @@ -1485,7 +1526,7 @@ fn spawn_work( // we exit. struct Bomb { coordinator_send: Sender>, - result: Option>, + result: Option>, worker_id: usize, } impl Drop for Bomb { @@ -1495,8 +1536,11 @@ fn spawn_work( Some(WorkItemResult::Compiled(m)) => { Message::Done:: { result: Ok(m), worker_id } } - Some(WorkItemResult::NeedsLTO(m)) => { - Message::NeedsLTO:: { result: m, worker_id } + Some(WorkItemResult::NeedsFatLTO(m)) => { + Message::NeedsFatLTO:: { result: m, worker_id } + } + Some(WorkItemResult::NeedsThinLTO(name, thin_buffer)) => { + Message::NeedsThinLTO:: { name, thin_buffer, worker_id } } None => Message::Done:: { result: Err(()), worker_id } }; diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index c5fd03c93e3..3d507f1181f 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Codegen the completed AST to the LLVM IR. //! //! Some functions here, such as codegen_block and codegen_expr, return a value -- @@ -193,7 +183,7 @@ pub fn unsized_info<'tcx, Cx: CodegenMethods<'tcx>>( (_, &ty::Dynamic(ref data, ..)) => { let vtable_ptr = cx.layout_of(cx.tcx().mk_mut_ptr(target)) .field(cx, FAT_PTR_EXTRA); - cx.static_ptrcast(meth::get_vtable(cx, source, data.principal()), + cx.const_ptrcast(meth::get_vtable(cx, source, data.principal()), cx.backend_type(vtable_ptr)) } _ => bug!("unsized_info: invalid unsizing {:?} -> {:?}", @@ -269,7 +259,7 @@ pub fn coerce_unsized_into<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( let (base, info) = match bx.load_operand(src).val { OperandValue::Pair(base, info) => { // fat-ptr to fat-ptr unsize preserves the vtable - // i.e. &'a fmt::Debug+Send => &'a fmt::Debug + // i.e., &'a fmt::Debug+Send => &'a fmt::Debug // So we need to pointercast the base to ensure // the types match up. let thin_ptr = dst.layout.field(bx.cx(), FAT_PTR_ADDR); @@ -367,14 +357,6 @@ pub fn wants_msvc_seh(sess: &Session) -> bool { sess.target.target.options.is_like_msvc } -pub fn call_assume<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( - bx: &mut Bx, - val: Bx::Value -) { - let assume_intrinsic = bx.cx().get_intrinsic("llvm.assume"); - bx.call(assume_intrinsic, &[val], None); -} - pub fn from_immediate<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, val: Bx::Value @@ -460,10 +442,8 @@ pub fn codegen_instance<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( pub fn maybe_create_entry_wrapper<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( cx: &'a Bx::CodegenCx ) { - let (main_def_id, span) = match *cx.sess().entry_fn.borrow() { - Some((id, span, _)) => { - (cx.tcx().hir.local_def_id(id), span) - } + let (main_def_id, span) = match cx.tcx().entry_fn(LOCAL_CRATE) { + Some((def_id, _)) => { (def_id, cx.tcx().def_span(def_id)) }, None => return, }; @@ -477,7 +457,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( let main_llfn = cx.get_fn(instance); - let et = cx.sess().entry_fn.get().map(|e| e.2); + let et = cx.tcx().entry_fn(LOCAL_CRATE).map(|e| e.1); match et { Some(EntryFnType::Main) => create_entry_fn::(cx, span, main_llfn, main_def_id, true), Some(EntryFnType::Start) => create_entry_fn::(cx, span, main_llfn, main_def_id, false), @@ -572,7 +552,7 @@ pub fn codegen_crate( &["crate"], Some("metadata")).as_str() .to_string(); - let metadata_llvm_module = backend.new_metadata(tcx.sess, &metadata_cgu_name); + let metadata_llvm_module = backend.new_metadata(tcx, &metadata_cgu_name); let metadata = time(tcx.sess, "write metadata", || { backend.write_metadata(tcx, &metadata_llvm_module) }); @@ -657,7 +637,7 @@ pub fn codegen_crate( &["crate"], Some("allocator")).as_str() .to_string(); - let modules = backend.new_metadata(tcx.sess, &llmod_id); + let modules = backend.new_metadata(tcx, &llmod_id); time(tcx.sess, "write allocator module", || { backend.codegen_allocator(tcx, &modules, kind) }); @@ -918,6 +898,39 @@ fn is_codegened_item(tcx: TyCtxt, id: DefId) -> bool { } pub fn provide_both(providers: &mut Providers) { + providers.backend_optimization_level = |tcx, cratenum| { + let for_speed = match tcx.sess.opts.optimize { + // If globally no optimisation is done, #[optimize] has no effect. + // + // This is done because if we ended up "upgrading" to `-O2` here, we’d populate the + // pass manager and it is likely that some module-wide passes (such as inliner or + // cross-function constant propagation) would ignore the `optnone` annotation we put + // on the functions, thus necessarily involving these functions into optimisations. + config::OptLevel::No => return config::OptLevel::No, + // If globally optimise-speed is already specified, just use that level. + config::OptLevel::Less => return config::OptLevel::Less, + config::OptLevel::Default => return config::OptLevel::Default, + config::OptLevel::Aggressive => return config::OptLevel::Aggressive, + // If globally optimize-for-size has been requested, use -O2 instead (if optimize(size) + // are present). + config::OptLevel::Size => config::OptLevel::Default, + config::OptLevel::SizeMin => config::OptLevel::Default, + }; + + let (defids, _) = tcx.collect_and_partition_mono_items(cratenum); + for id in &*defids { + let hir::CodegenFnAttrs { optimize, .. } = tcx.codegen_fn_attrs(*id); + match optimize { + attr::OptimizeAttr::None => continue, + attr::OptimizeAttr::Size => continue, + attr::OptimizeAttr::Speed => { + return for_speed; + } + } + } + return tcx.sess.opts.optimize; + }; + providers.dllimport_foreign_items = |tcx, krate| { let module_map = tcx.foreign_modules(krate); let module_map = module_map.iter() diff --git a/src/librustc_codegen_ssa/callee.rs b/src/librustc_codegen_ssa/callee.rs index 5ff1d9b5992..aa13e525a73 100644 --- a/src/librustc_codegen_ssa/callee.rs +++ b/src/librustc_codegen_ssa/callee.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use traits::*; use rustc::ty; use rustc::ty::subst::Substs; diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs index 6259318a3c9..cfb5d24fc12 100644 --- a/src/librustc_codegen_ssa/common.rs +++ b/src/librustc_codegen_ssa/common.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![allow(non_camel_case_types, non_snake_case)] use rustc::ty::{self, Ty, TyCtxt}; @@ -158,7 +149,7 @@ pub fn langcall(tcx: TyCtxt, } // To avoid UB from LLVM, these two functions mask RHS with an -// appropriate mask unconditionally (i.e. the fallback behavior for +// appropriate mask unconditionally (i.e., the fallback behavior for // all shifts). For 32- and 64-bit types, this matches the semantics // of Java. (See related discussion on #1877 and #10183.) @@ -194,7 +185,7 @@ fn shift_mask_rhs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, rhs: Bx::Value ) -> Bx::Value { - let rhs_llty = bx.cx().val_ty(rhs); + let rhs_llty = bx.val_ty(rhs); let shift_val = shift_mask_val(bx, rhs_llty, rhs_llty, false); bx.and(rhs, shift_val) } @@ -205,25 +196,25 @@ pub fn shift_mask_val<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( mask_llty: Bx::Type, invert: bool ) -> Bx::Value { - let kind = bx.cx().type_kind(llty); + let kind = bx.type_kind(llty); match kind { TypeKind::Integer => { // i8/u8 can shift by at most 7, i16/u16 by at most 15, etc. - let val = bx.cx().int_width(llty) - 1; + let val = bx.int_width(llty) - 1; if invert { - bx.cx().const_int(mask_llty, !val as i64) + bx.const_int(mask_llty, !val as i64) } else { - bx.cx().const_uint(mask_llty, val) + bx.const_uint(mask_llty, val) } }, TypeKind::Vector => { let mask = shift_mask_val( bx, - bx.cx().element_type(llty), - bx.cx().element_type(mask_llty), + bx.element_type(llty), + bx.element_type(mask_llty), invert ); - bx.vector_splat(bx.cx().vector_length(mask_llty), mask) + bx.vector_splat(bx.vector_length(mask_llty), mask) }, _ => bug!("shift_mask_val: expected Integer or Vector, found {:?}", kind), } diff --git a/src/librustc_codegen_ssa/debuginfo.rs b/src/librustc_codegen_ssa/debuginfo.rs index 0fc61422bb3..c4531ff90ae 100644 --- a/src/librustc_codegen_ssa/debuginfo.rs +++ b/src/librustc_codegen_ssa/debuginfo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use syntax_pos::{BytePos, Span}; use rustc::hir::def_id::CrateNum; use std::cell::Cell; @@ -23,22 +13,21 @@ impl FunctionDebugContext { match *self { FunctionDebugContext::RegularContext(ref data) => data, FunctionDebugContext::DebugInfoDisabled => { - span_bug!(span, "{}", FunctionDebugContext::::debuginfo_disabled_message()); + span_bug!( + span, + "debuginfo: Error trying to access FunctionDebugContext \ + although debug info is disabled!", + ); } FunctionDebugContext::FunctionWithoutDebugInfo => { - span_bug!(span, "{}", FunctionDebugContext::::should_be_ignored_message()); + span_bug!( + span, + "debuginfo: Error trying to access FunctionDebugContext \ + for function that should be ignored by debug info!", + ); } } } - - fn debuginfo_disabled_message() -> &'static str { - "debuginfo: Error trying to access FunctionDebugContext although debug info is disabled!" - } - - fn should_be_ignored_message() -> &'static str { - "debuginfo: Error trying to access FunctionDebugContext for function that should be \ - ignored by debug info!" - } } /// Enables emitting source locations for the given functions. diff --git a/src/librustc_codegen_ssa/diagnostics.rs b/src/librustc_codegen_ssa/diagnostics.rs index abe19068889..e7ef178cfab 100644 --- a/src/librustc_codegen_ssa/diagnostics.rs +++ b/src/librustc_codegen_ssa/diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] register_long_diagnostics! { diff --git a/src/librustc_codegen_ssa/glue.rs b/src/librustc_codegen_ssa/glue.rs index 515f36b5c65..ed63e1e62ee 100644 --- a/src/librustc_codegen_ssa/glue.rs +++ b/src/librustc_codegen_ssa/glue.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! // // Code relating to drop glue. @@ -16,7 +6,6 @@ use std; use common::IntPredicate; use meth; -use rustc::ty::layout::LayoutOf; use rustc::ty::{self, Ty}; use traits::*; @@ -25,14 +14,12 @@ pub fn size_and_align_of_dst<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( t: Ty<'tcx>, info: Option ) -> (Bx::Value, Bx::Value) { - debug!("calculate size of DST: {}; with lost info: {:?}", - t, info); - if bx.cx().type_is_sized(t) { - let (size, align) = bx.cx().layout_of(t).size_and_align(); - debug!("size_and_align_of_dst t={} info={:?} size: {:?} align: {:?}", - t, info, size, align); - let size = bx.cx().const_usize(size.bytes()); - let align = bx.cx().const_usize(align.abi()); + let layout = bx.layout_of(t); + debug!("size_and_align_of_dst(ty={}, info={:?}): layout: {:?}", + t, info, layout); + if !layout.is_unsized() { + let size = bx.const_usize(layout.size.bytes()); + let align = bx.const_usize(layout.align.abi.bytes()); return (size, align); } match t.sty { @@ -42,32 +29,30 @@ pub fn size_and_align_of_dst<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( (meth::SIZE.get_usize(bx, vtable), meth::ALIGN.get_usize(bx, vtable)) } ty::Slice(_) | ty::Str => { - let unit = t.sequence_element_type(bx.tcx()); + let unit = layout.field(bx, 0); // The info in this case is the length of the str, so the size is that // times the unit size. - let (size, align) = bx.cx().layout_of(unit).size_and_align(); - (bx.mul(info.unwrap(), bx.cx().const_usize(size.bytes())), - bx.cx().const_usize(align.abi())) + (bx.mul(info.unwrap(), bx.const_usize(unit.size.bytes())), + bx.const_usize(unit.align.abi.bytes())) } _ => { // First get the size of all statically known fields. // Don't use size_of because it also rounds up to alignment, which we // want to avoid, as the unsized field's alignment could be smaller. assert!(!t.is_simd()); - let layout = bx.cx().layout_of(t); debug!("DST {} layout: {:?}", t, layout); let i = layout.fields.count() - 1; let sized_size = layout.fields.offset(i).bytes(); - let sized_align = layout.align.abi(); + let sized_align = layout.align.abi.bytes(); debug!("DST {} statically sized prefix size: {} align: {}", t, sized_size, sized_align); - let sized_size = bx.cx().const_usize(sized_size); - let sized_align = bx.cx().const_usize(sized_align); + let sized_size = bx.const_usize(sized_size); + let sized_align = bx.const_usize(sized_align); // Recurse to get the size of the dynamically sized field (must be // the last field). - let field_ty = layout.field(bx.cx(), i).ty; + let field_ty = layout.field(bx, i).ty; let (unsized_size, mut unsized_align) = size_and_align_of_dst(bx, field_ty, info); // FIXME (#26403, #27023): We should be adding padding @@ -89,12 +74,12 @@ pub fn size_and_align_of_dst<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( // Choose max of two known alignments (combined value must // be aligned according to more restrictive of the two). - let align = match (bx.cx().const_to_opt_u128(sized_align, false), - bx.cx().const_to_opt_u128(unsized_align, false)) { + let align = match (bx.const_to_opt_u128(sized_align, false), + bx.const_to_opt_u128(unsized_align, false)) { (Some(sized_align), Some(unsized_align)) => { // If both alignments are constant, (the sized_align should always be), then // pick the correct alignment statically. - bx.cx().const_usize(std::cmp::max(sized_align, unsized_align) as u64) + bx.const_usize(std::cmp::max(sized_align, unsized_align) as u64) } _ => { let cmp = bx.icmp(IntPredicate::IntUGT, sized_align, unsized_align); @@ -112,7 +97,7 @@ pub fn size_and_align_of_dst<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( // emulated via the semi-standard fast bit trick: // // `(size + (align-1)) & -align` - let one = bx.cx().const_usize(1); + let one = bx.const_usize(1); let addend = bx.sub(align, one); let add = bx.add(size, addend); let neg = bx.neg(align); diff --git a/src/librustc_codegen_ssa/lib.rs b/src/librustc_codegen_ssa/lib.rs index 24ede4db6e3..1accbeb2aa8 100644 --- a/src/librustc_codegen_ssa/lib.rs +++ b/src/librustc_codegen_ssa/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] @@ -22,7 +12,8 @@ #![feature(nll)] #![allow(unused_attributes)] #![allow(dead_code)] -#![feature(quote)] + +#![recursion_limit="256"] //! This crate contains codegen code that is used by all codegen backends (LLVM and others). //! The backend-agnostic functions of this crate use functions defined in various traits that @@ -61,7 +52,7 @@ use rustc_data_structures::svh::Svh; use rustc::middle::cstore::{LibSource, CrateSource, NativeLibrary}; use syntax_pos::symbol::Symbol; -// NB: This module needs to be declared first so diagnostics are +// N.B., this module needs to be declared first so diagnostics are // registered before they are used. mod diagnostics; diff --git a/src/librustc_codegen_ssa/meth.rs b/src/librustc_codegen_ssa/meth.rs index 06c4f7a87d8..98ad2616eea 100644 --- a/src/librustc_codegen_ssa/meth.rs +++ b/src/librustc_codegen_ssa/meth.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_target::abi::call::FnType; use callee; use rustc_mir::monomorphize; @@ -39,10 +29,10 @@ impl<'a, 'tcx: 'a> VirtualIndex { let llvtable = bx.pointercast( llvtable, - bx.cx().type_ptr_to(bx.cx().fn_ptr_backend_type(fn_ty)) + bx.type_ptr_to(bx.fn_ptr_backend_type(fn_ty)) ); - let ptr_align = bx.tcx().data_layout.pointer_align; - let gep = bx.inbounds_gep(llvtable, &[bx.cx().const_usize(self.0)]); + let ptr_align = bx.tcx().data_layout.pointer_align.abi; + let gep = bx.inbounds_gep(llvtable, &[bx.const_usize(self.0)]); let ptr = bx.load(gep, ptr_align); bx.nonnull_metadata(ptr); // Vtable loads are invariant @@ -58,9 +48,9 @@ impl<'a, 'tcx: 'a> VirtualIndex { // Load the data pointer from the object. debug!("get_int({:?}, {:?})", llvtable, self); - let llvtable = bx.pointercast(llvtable, bx.cx().type_ptr_to(bx.cx().type_isize())); - let usize_align = bx.tcx().data_layout.pointer_align; - let gep = bx.inbounds_gep(llvtable, &[bx.cx().const_usize(self.0)]); + let llvtable = bx.pointercast(llvtable, bx.type_ptr_to(bx.type_isize())); + let usize_align = bx.tcx().data_layout.pointer_align.abi; + let gep = bx.inbounds_gep(llvtable, &[bx.const_usize(self.0)]); let ptr = bx.load(gep, usize_align); // Vtable loads are invariant bx.set_invariant_load(ptr); @@ -74,12 +64,12 @@ impl<'a, 'tcx: 'a> VirtualIndex { /// The vtables are cached instead of created on every call. /// /// The `trait_ref` encodes the erased self type. Hence if we are -/// making an object `Foo` from a value of type `Foo`, then +/// making an object `Foo` from a value of type `Foo`, then /// `trait_ref` would map `T:Trait`. pub fn get_vtable<'tcx, Cx: CodegenMethods<'tcx>>( cx: &Cx, ty: Ty<'tcx>, - trait_ref: ty::PolyExistentialTraitRef<'tcx>, + trait_ref: Option>, ) -> Cx::Value { let tcx = cx.tcx(); @@ -93,26 +83,33 @@ pub fn get_vtable<'tcx, Cx: CodegenMethods<'tcx>>( // Not in the cache. Build it. let nullptr = cx.const_null(cx.type_i8p()); - let methods = tcx.vtable_methods(trait_ref.with_self_ty(tcx, ty)); - let methods = methods.iter().cloned().map(|opt_mth| { + let methods_root; + let methods = if let Some(trait_ref) = trait_ref { + methods_root = tcx.vtable_methods(trait_ref.with_self_ty(tcx, ty)); + methods_root.iter() + } else { + (&[]).iter() + }; + + let methods = methods.cloned().map(|opt_mth| { opt_mth.map_or(nullptr, |(def_id, substs)| { callee::resolve_and_get_fn_for_vtable(cx, def_id, substs) }) }); - let (size, align) = cx.layout_of(ty).size_and_align(); + let layout = cx.layout_of(ty); // ///////////////////////////////////////////////////////////////////////////////////////////// // If you touch this code, be sure to also make the corresponding changes to // `get_vtable` in rust_mir/interpret/traits.rs // ///////////////////////////////////////////////////////////////////////////////////////////// let components: Vec<_> = [ cx.get_fn(monomorphize::resolve_drop_in_place(cx.tcx(), ty)), - cx.const_usize(size.bytes()), - cx.const_usize(align.abi()) + cx.const_usize(layout.size.bytes()), + cx.const_usize(layout.align.abi.bytes()) ].iter().cloned().chain(methods).collect(); let vtable_const = cx.const_struct(&components, false); - let align = cx.data_layout().pointer_align; + let align = cx.data_layout().pointer_align.abi; let vtable = cx.static_addr_of(vtable_const, align, Some("vtable")); cx.create_vtable_metadata(ty, vtable); diff --git a/src/librustc_codegen_ssa/mir/analyze.rs b/src/librustc_codegen_ssa/mir/analyze.rs index c7e2c76c3e5..f3475d1c489 100644 --- a/src/librustc_codegen_ssa/mir/analyze.rs +++ b/src/librustc_codegen_ssa/mir/analyze.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! An analysis to determine which locals require allocas and //! which do not. @@ -43,7 +33,7 @@ pub fn non_ssa_locals<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( // These sorts of types require an alloca. Note that // is_llvm_immediate() may *still* be true, particularly // for newtypes, but we currently force some types - // (e.g. structs) into an alloca unconditionally, just so + // (e.g., structs) into an alloca unconditionally, just so // that we don't have to deal with having two pathways // (gep vs extractvalue etc). analyzer.not_ssa(mir::Local::new(index)); @@ -227,9 +217,9 @@ impl<'mir, 'a: 'mir, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx> PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) | PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) => { - // Reads from uninitialized variables (e.g. in dead code, after + // Reads from uninitialized variables (e.g., in dead code, after // optimizations) require locals to be in (uninitialized) memory. - // NB: there can be uninitialized reads of a local visited after + // N.B., there can be uninitialized reads of a local visited after // an assignment to that local, if they happen on disjoint paths. let ssa_read = match self.first_assignment(local) { Some(assignment_location) => { diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index 1702ad19b76..aa82c853257 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::middle::lang_items; use rustc::ty::{self, Ty, TypeFoldable}; use rustc::ty::layout::{self, LayoutOf, HasTyCtxt}; @@ -182,22 +172,20 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let lp1 = bx.load_operand(lp1).immediate(); slot.storage_dead(&mut bx); - if !bx.cx().sess().target.target.options.custom_unwind_resume { - let mut lp = bx.cx().const_undef(self.landing_pad_type()); + if !bx.sess().target.target.options.custom_unwind_resume { + let mut lp = bx.const_undef(self.landing_pad_type()); lp = bx.insert_value(lp, lp0, 0); lp = bx.insert_value(lp, lp1, 1); bx.resume(lp); } else { - bx.call(bx.cx().eh_unwind_resume(), &[lp0], funclet(self)); + bx.call(bx.eh_unwind_resume(), &[lp0], funclet(self)); bx.unreachable(); } } } mir::TerminatorKind::Abort => { - // Call core::intrinsics::abort() - let fnname = bx.cx().get_intrinsic(&("llvm.trap")); - bx.call(fnname, &[], None); + bx.abort(); bx.unreachable(); } @@ -220,10 +208,10 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bx.cond_br(discr.immediate(), lltrue, llfalse); } } else { - let switch_llty = bx.cx().immediate_backend_type( - bx.cx().layout_of(switch_ty) + let switch_llty = bx.immediate_backend_type( + bx.layout_of(switch_ty) ); - let llval = bx.cx().const_uint_big(switch_llty, values[0]); + let llval = bx.const_uint_big(switch_llty, values[0]); let cmp = bx.icmp(IntPredicate::IntEQ, discr.immediate(), llval); bx.cond_br(cmp, lltrue, llfalse); } @@ -232,11 +220,11 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let switch = bx.switch(discr.immediate(), llblock(self, *otherwise), values.len()); - let switch_llty = bx.cx().immediate_backend_type( - bx.cx().layout_of(switch_ty) + let switch_llty = bx.immediate_backend_type( + bx.layout_of(switch_ty) ); for (&value, target) in values.iter().zip(targets) { - let llval = bx.cx().const_uint_big(switch_llty, value); + let llval = bx.const_uint_big(switch_llty, value); let llbb = llblock(self, *target); bx.add_case(switch, llval, llbb) } @@ -280,15 +268,15 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { scratch.llval } Ref(llval, _, align) => { - assert_eq!(align.abi(), op.layout.align.abi(), + assert_eq!(align, op.layout.align.abi, "return place is unaligned!"); llval } }; - let addr = bx.pointercast(llslot, bx.cx().type_ptr_to( - bx.cx().cast_backend_type(&cast_ty) + let addr = bx.pointercast(llslot, bx.type_ptr_to( + bx.cast_backend_type(&cast_ty) )); - bx.load(addr, self.fn_ty.ret.layout.align) + bx.load(addr, self.fn_ty.ret.layout.align.abi) } }; bx.ret(llval); @@ -301,7 +289,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { mir::TerminatorKind::Drop { ref location, target, unwind } => { let ty = location.ty(self.mir, bx.tcx()).to_ty(bx.tcx()); let ty = self.monomorphize(&ty); - let drop_fn = monomorphize::resolve_drop_in_place(bx.cx().tcx(), ty); + let drop_fn = monomorphize::resolve_drop_in_place(bx.tcx(), ty); if let ty::InstanceDef::DropGlue(_, None) = drop_fn.def { // we don't actually need to drop anything. @@ -325,14 +313,14 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { ty::ParamEnv::reveal_all(), &sig, ); - let fn_ty = bx.cx().new_vtable(sig, &[]); + let fn_ty = bx.new_vtable(sig, &[]); let vtable = args[1]; args = &args[..1]; (meth::DESTRUCTOR.get_fn(&mut bx, vtable, &fn_ty), fn_ty) } _ => { - (bx.cx().get_fn(drop_fn), - bx.cx().fn_type_of_instance(&drop_fn)) + (bx.get_fn(drop_fn), + bx.fn_type_of_instance(&drop_fn)) } }; do_call(self, &mut bx, fn_ty, drop_fn, args, @@ -342,7 +330,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { mir::TerminatorKind::Assert { ref cond, expected, ref msg, target, cleanup } => { let cond = self.codegen_operand(&mut bx, cond).immediate(); - let mut const_cond = bx.cx().const_to_opt_u128(cond, false).map(|c| c == 1); + let mut const_cond = bx.const_to_opt_u128(cond, false).map(|c| c == 1); // This case can currently arise only from functions marked // with #[rustc_inherit_overflow_checks] and inlined from @@ -351,7 +339,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // NOTE: Unlike binops, negation doesn't have its own // checked operation, just a comparison with the minimum // value, so we have to check for the assert message. - if !bx.cx().check_overflow() { + if !bx.check_overflow() { if let mir::interpret::EvalErrorKind::OverflowNeg = *msg { const_cond = Some(expected); } @@ -364,8 +352,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } // Pass the condition through llvm.expect for branch hinting. - let expect = bx.cx().get_intrinsic(&"llvm.expect.i1"); - let cond = bx.call(expect, &[cond, bx.cx().const_bool(expected)], None); + let cond = bx.expect(cond, expected); // Create the failure block and the conditional branch to it. let lltarget = llblock(self, target); @@ -381,14 +368,14 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { self.set_debug_loc(&mut bx, terminator.source_info); // Get the location information. - let loc = bx.cx().sess().source_map().lookup_char_pos(span.lo()); + let loc = bx.sess().source_map().lookup_char_pos(span.lo()); let filename = Symbol::intern(&loc.file.name.to_string()).as_str(); - let filename = bx.cx().const_str_slice(filename); - let line = bx.cx().const_u32(loc.line as u32); - let col = bx.cx().const_u32(loc.col.to_usize() as u32 + 1); - let align = tcx.data_layout.aggregate_align - .max(tcx.data_layout.i32_align) - .max(tcx.data_layout.pointer_align); + let filename = bx.const_str_slice(filename); + let line = bx.const_u32(loc.line as u32); + let col = bx.const_u32(loc.col.to_usize() as u32 + 1); + let align = tcx.data_layout.aggregate_align.abi + .max(tcx.data_layout.i32_align.abi) + .max(tcx.data_layout.pointer_align.abi); // Put together the arguments to the panic entry point. let (lang_item, args) = match *msg { @@ -396,8 +383,8 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let len = self.codegen_operand(&mut bx, len).immediate(); let index = self.codegen_operand(&mut bx, index).immediate(); - let file_line_col = bx.cx().const_struct(&[filename, line, col], false); - let file_line_col = bx.cx().static_addr_of( + let file_line_col = bx.const_struct(&[filename, line, col], false); + let file_line_col = bx.static_addr_of( file_line_col, align, Some("panic_bounds_check_loc") @@ -408,12 +395,12 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { _ => { let str = msg.description(); let msg_str = Symbol::intern(str).as_str(); - let msg_str = bx.cx().const_str_slice(msg_str); - let msg_file_line_col = bx.cx().const_struct( + let msg_str = bx.const_str_slice(msg_str); + let msg_file_line_col = bx.const_struct( &[msg_str, filename, line, col], false ); - let msg_file_line_col = bx.cx().static_addr_of( + let msg_file_line_col = bx.static_addr_of( msg_file_line_col, align, Some("panic_loc") @@ -426,8 +413,8 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // Obtain the panic entry point. let def_id = common::langcall(bx.tcx(), Some(span), "", lang_item); let instance = ty::Instance::mono(bx.tcx(), def_id); - let fn_ty = bx.cx().fn_type_of_instance(&instance); - let llfn = bx.cx().get_fn(instance); + let fn_ty = bx.fn_type_of_instance(&instance); + let llfn = bx.get_fn(instance); // Codegen the actual panic invoke/call. do_call(self, &mut bx, fn_ty, llfn, &args, None, cleanup); @@ -449,7 +436,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let (instance, mut llfn) = match callee.layout.ty.sty { ty::FnDef(def_id, substs) => { - (Some(ty::Instance::resolve(bx.cx().tcx(), + (Some(ty::Instance::resolve(bx.tcx(), ty::ParamEnv::reveal_all(), def_id, substs).unwrap()), @@ -488,7 +475,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // we can do what we like. Here, we declare that transmuting // into an uninhabited type is impossible, so anything following // it must be unreachable. - assert_eq!(bx.cx().layout_of(sig.output()).abi, layout::Abi::Uninhabited); + assert_eq!(bx.layout_of(sig.output()).abi, layout::Abi::Uninhabited); bx.unreachable(); } return; @@ -502,7 +489,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let fn_ty = match def { Some(ty::InstanceDef::Virtual(..)) => { - bx.cx().new_vtable(sig, &extra_args) + bx.new_vtable(sig, &extra_args) } Some(ty::InstanceDef::DropGlue(_, None)) => { // empty drop glue - a nop. @@ -510,56 +497,60 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { funclet_br(self, &mut bx, target); return; } - _ => bx.cx().new_fn_type(sig, &extra_args) + _ => bx.new_fn_type(sig, &extra_args) }; - // emit a panic instead of instantiating an uninhabited type - if (intrinsic == Some("init") || intrinsic == Some("uninit")) && - fn_ty.ret.layout.abi.is_uninhabited() - { - let loc = bx.cx().sess().source_map().lookup_char_pos(span.lo()); - let filename = Symbol::intern(&loc.file.name.to_string()).as_str(); - let filename = bx.cx().const_str_slice(filename); - let line = bx.cx().const_u32(loc.line as u32); - let col = bx.cx().const_u32(loc.col.to_usize() as u32 + 1); - let align = tcx.data_layout.aggregate_align - .max(tcx.data_layout.i32_align) - .max(tcx.data_layout.pointer_align); - - let str = format!( - "Attempted to instantiate uninhabited type {} using mem::{}", - sig.output(), - if intrinsic == Some("init") { "zeroed" } else { "uninitialized" } - ); - let msg_str = Symbol::intern(&str).as_str(); - let msg_str = bx.cx().const_str_slice(msg_str); - let msg_file_line_col = bx.cx().const_struct( - &[msg_str, filename, line, col], - false, - ); - let msg_file_line_col = bx.cx().static_addr_of( - msg_file_line_col, - align, - Some("panic_loc"), - ); + // emit a panic or a NOP for `panic_if_uninhabited` + if intrinsic == Some("panic_if_uninhabited") { + let ty = instance.unwrap().substs.type_at(0); + let layout = bx.layout_of(ty); + if layout.abi.is_uninhabited() { + let loc = bx.sess().source_map().lookup_char_pos(span.lo()); + let filename = Symbol::intern(&loc.file.name.to_string()).as_str(); + let filename = bx.const_str_slice(filename); + let line = bx.const_u32(loc.line as u32); + let col = bx.const_u32(loc.col.to_usize() as u32 + 1); + let align = tcx.data_layout.aggregate_align.abi + .max(tcx.data_layout.i32_align.abi) + .max(tcx.data_layout.pointer_align.abi); + + let str = format!( + "Attempted to instantiate uninhabited type {}", + ty + ); + let msg_str = Symbol::intern(&str).as_str(); + let msg_str = bx.const_str_slice(msg_str); + let msg_file_line_col = bx.const_struct( + &[msg_str, filename, line, col], + false, + ); + let msg_file_line_col = bx.static_addr_of( + msg_file_line_col, + align, + Some("panic_loc"), + ); - // Obtain the panic entry point. - let def_id = - common::langcall(bx.tcx(), Some(span), "", lang_items::PanicFnLangItem); - let instance = ty::Instance::mono(bx.tcx(), def_id); - let fn_ty = bx.cx().fn_type_of_instance(&instance); - let llfn = bx.cx().get_fn(instance); - - // Codegen the actual panic invoke/call. - do_call( - self, - &mut bx, - fn_ty, - llfn, - &[msg_file_line_col], - destination.as_ref().map(|(_, bb)| (ReturnDest::Nothing, *bb)), - cleanup, - ); + // Obtain the panic entry point. + let def_id = + common::langcall(bx.tcx(), Some(span), "", lang_items::PanicFnLangItem); + let instance = ty::Instance::mono(bx.tcx(), def_id); + let fn_ty = bx.fn_type_of_instance(&instance); + let llfn = bx.get_fn(instance); + + // Codegen the actual panic invoke/call. + do_call( + self, + &mut bx, + fn_ty, + llfn, + &[msg_file_line_col], + destination.as_ref().map(|(_, bb)| (ReturnDest::Nothing, *bb)), + cleanup, + ); + } else { + // a NOP + funclet_br(self, &mut bx, destination.as_ref().unwrap().1); + } return; } @@ -580,7 +571,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let dest = match ret_dest { _ if fn_ty.ret.is_indirect() => llargs[0], ReturnDest::Nothing => { - bx.cx().const_undef(bx.cx().type_ptr_to(bx.memory_ty(&fn_ty.ret))) + bx.const_undef(bx.type_ptr_to(bx.memory_ty(&fn_ty.ret))) } ReturnDest::IndirectOperand(dst, _) | ReturnDest::Store(dst) => dst.llval, @@ -614,7 +605,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { ); return OperandRef { val: Immediate(llval), - layout: bx.cx().layout_of(ty), + layout: bx.layout_of(ty), }; }, @@ -632,7 +623,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { ); return OperandRef { val: Immediate(llval), - layout: bx.cx().layout_of(ty) + layout: bx.layout_of(ty) }; } } @@ -642,7 +633,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { }).collect(); - let callee_ty = instance.as_ref().unwrap().ty(bx.cx().tcx()); + let callee_ty = instance.as_ref().unwrap().ty(bx.tcx()); bx.codegen_intrinsic_call(callee_ty, &fn_ty, &args, dest, terminator.source_info.span); @@ -739,7 +730,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let fn_ptr = match (llfn, instance) { (Some(llfn), _) => llfn, - (None, Some(instance)) => bx.cx().get_fn(instance), + (None, Some(instance)) => bx.get_fn(instance), _ => span_bug!(span, "no llfn for call"), }; @@ -763,7 +754,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { ) { // Fill padding with undef value, where applicable. if let Some(ty) = arg.pad { - llargs.push(bx.cx().const_undef(bx.cx().reg_backend_type(&ty))) + llargs.push(bx.const_undef(bx.reg_backend_type(&ty))) } if arg.is_ignore() { @@ -800,12 +791,12 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { (scratch.llval, scratch.align, true) } _ => { - (op.immediate_or_packed_pair(bx), arg.layout.align, false) + (op.immediate_or_packed_pair(bx), arg.layout.align.abi, false) } } } Ref(llval, _, align) => { - if arg.is_indirect() && align.abi() < arg.layout.align.abi() { + if arg.is_indirect() && align < arg.layout.align.abi { // `foo(packed.large_field)`. We can't pass the (unaligned) field directly. I // think that ATM (Rust 1.16) we only pass temporaries, but we shouldn't // have scary latent bugs around. @@ -823,10 +814,10 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { if by_ref && !arg.is_indirect() { // Have to load the argument, maybe while casting it. if let PassMode::Cast(ty) = arg.mode { - let addr = bx.pointercast(llval, bx.cx().type_ptr_to( - bx.cx().cast_backend_type(&ty)) + let addr = bx.pointercast(llval, bx.type_ptr_to( + bx.cast_backend_type(&ty)) ); - llval = bx.load(addr, align.min(arg.layout.align)); + llval = bx.load(addr, align.min(arg.layout.align.abi)); } else { // We can't use `PlaceRef::load` here because the argument // may have a type we don't treat as immediate, but the ABI @@ -1006,7 +997,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { self.codegen_place(bx, dest) }; if fn_ret.is_indirect() { - if dest.align.abi() < dest.layout.align.abi() { + if dest.align < dest.layout.align.abi { // Currently, MIR code generation does not create calls // that store directly to fields of packed structs (in // fact, the calls it creates write only to temps), @@ -1033,7 +1024,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { LocalRef::Place(place) => self.codegen_transmute_into(bx, src, place), LocalRef::UnsizedPlace(_) => bug!("transmute must not involve unsized locals"), LocalRef::Operand(None) => { - let dst_layout = bx.cx().layout_of(self.monomorphized_place_ty(dst)); + let dst_layout = bx.layout_of(self.monomorphized_place_ty(dst)); assert!(!dst_layout.ty.has_erasable_regions()); let place = PlaceRef::alloca(bx, dst_layout, "transmute_temp"); place.storage_live(bx); @@ -1060,9 +1051,9 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { dst: PlaceRef<'tcx, Bx::Value> ) { let src = self.codegen_operand(bx, src); - let llty = bx.cx().backend_type(src.layout); - let cast_ptr = bx.pointercast(dst.llval, bx.cx().type_ptr_to(llty)); - let align = src.layout.align.min(dst.layout.align); + let llty = bx.backend_type(src.layout); + let cast_ptr = bx.pointercast(dst.llval, bx.type_ptr_to(llty)); + let align = src.layout.align.abi.min(dst.align); src.val.store(bx, PlaceRef::new_sized(cast_ptr, src.layout, align)); } diff --git a/src/librustc_codegen_ssa/mir/constant.rs b/src/librustc_codegen_ssa/mir/constant.rs index 568e1f0b38a..56d4342e6e1 100644 --- a/src/librustc_codegen_ssa/mir/constant.rs +++ b/src/librustc_codegen_ssa/mir/constant.rs @@ -1,20 +1,10 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::mir::interpret::ErrorHandled; use rustc_mir::const_eval::const_field; use rustc::mir; use rustc_data_structures::indexed_vec::Idx; -use rustc::mir::interpret::{GlobalId, ConstValue}; +use rustc::mir::interpret::GlobalId; use rustc::ty::{self, Ty}; -use rustc::ty::layout::{self, LayoutOf}; +use rustc::ty::layout; use syntax::source_map::Span; use traits::*; @@ -24,10 +14,10 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { fn fully_evaluate( &mut self, bx: &Bx, - constant: &'tcx ty::Const<'tcx>, - ) -> Result<&'tcx ty::Const<'tcx>, ErrorHandled> { - match constant.val { - ConstValue::Unevaluated(def_id, ref substs) => { + constant: &'tcx ty::LazyConst<'tcx>, + ) -> Result, ErrorHandled> { + match *constant { + ty::LazyConst::Unevaluated(def_id, ref substs) => { let tcx = bx.tcx(); let param_env = ty::ParamEnv::reveal_all(); let instance = ty::Instance::resolve(tcx, param_env, def_id, substs).unwrap(); @@ -37,7 +27,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { }; tcx.const_eval(param_env.and(cid)) }, - _ => Ok(constant), + ty::LazyConst::Evaluated(constant) => Ok(constant), } } @@ -45,7 +35,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { &mut self, bx: &Bx, constant: &mir::Constant<'tcx>, - ) -> Result<&'tcx ty::Const<'tcx>, ErrorHandled> { + ) -> Result, ErrorHandled> { let c = self.monomorphize(&constant.literal); self.fully_evaluate(bx, c) } @@ -56,7 +46,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bx: &Bx, span: Span, ty: Ty<'tcx>, - constant: Result<&'tcx ty::Const<'tcx>, ErrorHandled>, + constant: Result, ErrorHandled>, ) -> (Bx::Value, Ty<'tcx>) { constant .and_then(|c| { @@ -69,26 +59,25 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let field = const_field( bx.tcx(), ty::ParamEnv::reveal_all(), - self.instance, None, mir::Field::new(field as usize), c, )?; if let Some(prim) = field.val.try_to_scalar() { - let layout = bx.cx().layout_of(field_ty); + let layout = bx.layout_of(field_ty); let scalar = match layout.abi { layout::Abi::Scalar(ref x) => x, _ => bug!("from_const: invalid ByVal layout: {:#?}", layout) }; - Ok(bx.cx().scalar_to_backend( + Ok(bx.scalar_to_backend( prim, scalar, - bx.cx().immediate_backend_type(layout), + bx.immediate_backend_type(layout), )) } else { bug!("simd shuffle field {:?}", field) } }).collect(); - let llval = bx.cx().const_struct(&values?, false); + let llval = bx.const_struct(&values?, false); Ok((llval, c.ty)) }) .unwrap_or_else(|_| { @@ -98,8 +87,8 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { ); // We've errored, so we don't have to produce working code. let ty = self.monomorphize(&ty); - let llty = bx.cx().backend_type(bx.cx().layout_of(ty)); - (bx.cx().const_undef(llty), ty) + let llty = bx.backend_type(bx.layout_of(ty)); + (bx.const_undef(llty), ty) }) } } diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 0579afe1d49..c7e2131eed5 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -1,16 +1,6 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use libc::c_uint; use rustc::ty::{self, Ty, TypeFoldable, UpvarSubsts}; -use rustc::ty::layout::{LayoutOf, TyLayout, HasTyCtxt}; +use rustc::ty::layout::{TyLayout, HasTyCtxt}; use rustc::mir::{self, Mir}; use rustc::ty::subst::Substs; use rustc::session::config::DebugInfo; @@ -266,14 +256,14 @@ pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( let mut allocate_local = |local| { let decl = &mir.local_decls[local]; - let layout = bx.cx().layout_of(fx.monomorphize(&decl.ty)); + let layout = bx.layout_of(fx.monomorphize(&decl.ty)); assert!(!layout.ty.has_erasable_regions()); if let Some(name) = decl.name { // User variable let debug_scope = fx.scopes[decl.visibility_scope]; let dbg = debug_scope.is_valid() && - bx.cx().sess().opts.debuginfo == DebugInfo::Full; + bx.sess().opts.debuginfo == DebugInfo::Full; if !memory_locals.contains(local) && !dbg { debug!("alloc: {:?} ({}) -> operand", local, name); @@ -304,7 +294,7 @@ pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( if local == mir::RETURN_PLACE && fx.fn_ty.ret.is_indirect() { debug!("alloc: {:?} (return place) -> place", local); let llretptr = fx.cx.get_param(llfn, 0); - LocalRef::Place(PlaceRef::new_sized(llretptr, layout, layout.align)) + LocalRef::Place(PlaceRef::new_sized(llretptr, layout, layout.align.abi)) } else if memory_locals.contains(local) { debug!("alloc: {:?} -> place", local); if layout.is_unsized() { @@ -376,7 +366,7 @@ fn create_funclets<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( { block_bxs.iter_enumerated().zip(cleanup_kinds).map(|((bb, &llbb), cleanup_kind)| { match *cleanup_kind { - CleanupKind::Funclet if base::wants_msvc_seh(bx.cx().sess()) => {} + CleanupKind::Funclet if base::wants_msvc_seh(bx.sess()) => {} _ => return (None, None) } @@ -415,8 +405,8 @@ fn create_funclets<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( // C++ personality function, but `catch (...)` has no type so // it's null. The 64 here is actually a bitfield which // represents that this is a catch-all block. - let null = bx.cx().const_null(bx.cx().type_i8p()); - let sixty_four = bx.cx().const_i32(64); + let null = bx.const_null(bx.type_i8p()); + let sixty_four = bx.const_i32(64); funclet = cp_bx.catch_pad(cs, &[null, sixty_four, null]); cp_bx.br(llbb); } @@ -451,7 +441,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( // Get the argument scope, if it exists and if we need it. let arg_scope = scopes[mir::OUTERMOST_SOURCE_SCOPE]; - let arg_scope = if bx.cx().sess().opts.debuginfo == DebugInfo::Full { + let arg_scope = if bx.sess().opts.debuginfo == DebugInfo::Full { arg_scope.scope_metadata } else { None @@ -467,7 +457,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( }; if Some(local) == mir.spread_arg { - // This argument (e.g. the last argument in the "rust-call" ABI) + // This argument (e.g., the last argument in the "rust-call" ABI) // is a tuple that was spread at the ABI level and now we have // to reconstruct it into a tuple local variable, from multiple // individual LLVM function arguments. @@ -478,7 +468,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( _ => bug!("spread argument isn't a tuple?!") }; - let place = PlaceRef::alloca(bx, bx.cx().layout_of(arg_ty), &name); + let place = PlaceRef::alloca(bx, bx.layout_of(arg_ty), &name); for i in 0..tupled_arg_tys.len() { let arg = &fx.fn_ty.args[idx]; idx += 1; @@ -524,18 +514,18 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( return local(OperandRef::new_zst(bx.cx(), arg.layout)); } PassMode::Direct(_) => { - let llarg = bx.cx().get_param(bx.llfn(), llarg_idx as c_uint); + let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint); bx.set_value_name(llarg, &name); llarg_idx += 1; return local( OperandRef::from_immediate_or_packed_pair(bx, llarg, arg.layout)); } PassMode::Pair(..) => { - let a = bx.cx().get_param(bx.llfn(), llarg_idx as c_uint); + let a = bx.get_param(bx.llfn(), llarg_idx as c_uint); bx.set_value_name(a, &(name.clone() + ".0")); llarg_idx += 1; - let b = bx.cx().get_param(bx.llfn(), llarg_idx as c_uint); + let b = bx.get_param(bx.llfn(), llarg_idx as c_uint); bx.set_value_name(b, &(name + ".1")); llarg_idx += 1; @@ -552,16 +542,16 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( // Don't copy an indirect argument to an alloca, the caller // already put it in a temporary alloca and gave it up. // FIXME: lifetimes - let llarg = bx.cx().get_param(bx.llfn(), llarg_idx as c_uint); + let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint); bx.set_value_name(llarg, &name); llarg_idx += 1; - PlaceRef::new_sized(llarg, arg.layout, arg.layout.align) + PlaceRef::new_sized(llarg, arg.layout, arg.layout.align.abi) } else if arg.is_unsized_indirect() { // As the storage for the indirect argument lives during // the whole function call, we just copy the fat pointer. - let llarg = bx.cx().get_param(bx.llfn(), llarg_idx as c_uint); + let llarg = bx.get_param(bx.llfn(), llarg_idx as c_uint); llarg_idx += 1; - let llextra = bx.cx().get_param(bx.llfn(), llarg_idx as c_uint); + let llextra = bx.get_param(bx.llfn(), llarg_idx as c_uint); llarg_idx += 1; let indirect_operand = OperandValue::Pair(llarg, llextra); @@ -596,10 +586,17 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( return; } + let pin_did = tcx.lang_items().pin_type(); // Or is it the closure environment? let (closure_layout, env_ref) = match arg.layout.ty.sty { ty::RawPtr(ty::TypeAndMut { ty, .. }) | - ty::Ref(_, ty, _) => (bx.cx().layout_of(ty), true), + ty::Ref(_, ty, _) => (bx.layout_of(ty), true), + ty::Adt(def, substs) if Some(def.did) == pin_did => { + match substs.type_at(0).sty { + ty::Ref(_, ty, _) => (bx.layout_of(ty), true), + _ => (arg.layout, false), + } + } _ => (arg.layout, false) }; @@ -610,35 +607,13 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( }; let upvar_tys = upvar_substs.upvar_tys(def_id, tcx); - // Store the pointer to closure data in an alloca for debuginfo - // because that's what the llvm.dbg.declare intrinsic expects. - - // FIXME(eddyb) this shouldn't be necessary but SROA seems to - // mishandle DW_OP_plus not preceded by DW_OP_deref, i.e. it - // doesn't actually strip the offset when splitting the closure - // environment into its components so it ends up out of bounds. - // (cuviper) It seems to be fine without the alloca on LLVM 6 and later. - let env_alloca = !env_ref && bx.cx().closure_env_needs_indirect_debuginfo(); - let env_ptr = if env_alloca { - let scratch = PlaceRef::alloca(bx, - bx.cx().layout_of(tcx.mk_mut_ptr(arg.layout.ty)), - "__debuginfo_env_ptr"); - bx.store(place.llval, scratch.llval, scratch.align); - scratch.llval - } else { - place.llval - }; - for (i, (decl, ty)) in mir.upvar_decls.iter().zip(upvar_tys).enumerate() { let byte_offset_of_var_in_env = closure_layout.fields.offset(i).bytes(); - let ops = bx.cx().debuginfo_upvar_decls_ops_sequence(byte_offset_of_var_in_env); + let ops = bx.debuginfo_upvar_decls_ops_sequence(byte_offset_of_var_in_env); // The environment and the capture can each be indirect. - - // FIXME(eddyb) see above why we sometimes have to keep - // a pointer in an alloca for debuginfo atm. - let mut ops = if env_ref || env_alloca { &ops[..] } else { &ops[1..] }; + let mut ops = if env_ref { &ops[..] } else { &ops[1..] }; let ty = if let (true, &ty::Ref(_, ty, _)) = (decl.by_ref, &ty.sty) { ty @@ -648,7 +623,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( }; let variable_access = VariableAccess::IndirectVariable { - alloca: env_ptr, + alloca: place.llval, address_operations: &ops }; bx.declare_local( diff --git a/src/librustc_codegen_ssa/mir/operand.rs b/src/librustc_codegen_ssa/mir/operand.rs index d574d89d67e..8aad4c1f6e1 100644 --- a/src/librustc_codegen_ssa/mir/operand.rs +++ b/src/librustc_codegen_ssa/mir/operand.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::mir::interpret::{ConstValue, ErrorHandled}; use rustc::mir; use rustc::ty; @@ -77,7 +67,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> { pub fn from_const>( bx: &mut Bx, - val: &'tcx ty::Const<'tcx> + val: ty::Const<'tcx> ) -> Result { let layout = bx.cx().layout_of(val.ty); @@ -86,7 +76,6 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> { } let val = match val.val { - ConstValue::Unevaluated(..) => bug!(), ConstValue::Scalar(x) => { let scalar = match layout.abi { layout::Abi::Scalar(ref x) => x, @@ -99,9 +88,9 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> { ); OperandValue::Immediate(llval) }, - ConstValue::ScalarPair(a, b) => { - let (a_scalar, b_scalar) = match layout.abi { - layout::Abi::ScalarPair(ref a, ref b) => (a, b), + ConstValue::Slice(a, b) => { + let a_scalar = match layout.abi { + layout::Abi::ScalarPair(ref a, _) => a, _ => bug!("from_const: invalid ScalarPair layout: {:#?}", layout) }; let a_llval = bx.cx().scalar_to_backend( @@ -109,11 +98,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> { a_scalar, bx.cx().scalar_pair_element_backend_type(layout, 0, true), ); - let b_llval = bx.cx().scalar_to_backend( - b, - b_scalar, - bx.cx().scalar_pair_element_backend_type(layout, 1, true), - ); + let b_llval = bx.cx().const_usize(b); OperandValue::Pair(a_llval, b_llval) }, ConstValue::ByRef(_, alloc, offset) => { @@ -152,7 +137,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> { llval: llptr, llextra, layout, - align: layout.align, + align: layout.align.abi, } } @@ -228,7 +213,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> { OperandValue::Immediate(a_llval) } else { assert_eq!(offset, a.value.size(bx.cx()) - .abi_align(b.value.align(bx.cx()))); + .align_to(b.value.align(bx.cx()).abi)); assert_eq!(field.size, b.value.size(bx.cx())); OperandValue::Immediate(b_llval) } @@ -244,13 +229,24 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> { }; // HACK(eddyb) have to bitcast pointers until LLVM removes pointee types. + // Bools in union fields needs to be truncated. + let to_immediate_or_cast = |bx: &mut Bx, val, ty| { + if ty == bx.cx().type_i1() { + bx.trunc(val, ty) + } else { + bx.bitcast(val, ty) + } + }; + match val { OperandValue::Immediate(ref mut llval) => { - *llval = bx.bitcast(*llval, bx.cx().immediate_backend_type(field)); + *llval = to_immediate_or_cast(bx, *llval, bx.cx().immediate_backend_type(field)); } OperandValue::Pair(ref mut a, ref mut b) => { - *a = bx.bitcast(*a, bx.cx().scalar_pair_element_backend_type(field, 0, true)); - *b = bx.bitcast(*b, bx.cx().scalar_pair_element_backend_type(field, 1, true)); + *a = to_immediate_or_cast(bx, *a, bx.cx() + .scalar_pair_element_backend_type(field, 0, true)); + *b = to_immediate_or_cast(bx, *b, bx.cx() + .scalar_pair_element_backend_type(field, 1, true)); } OperandValue::Ref(..) => bug!() } @@ -320,11 +316,21 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandValue { bx.store_with_flags(val, dest.llval, dest.align, flags); } OperandValue::Pair(a, b) => { - for (i, &x) in [a, b].iter().enumerate() { - let llptr = bx.struct_gep(dest.llval, i as u64); - let val = base::from_immediate(bx, x); - bx.store_with_flags(val, llptr, dest.align, flags); - } + let (a_scalar, b_scalar) = match dest.layout.abi { + layout::Abi::ScalarPair(ref a, ref b) => (a, b), + _ => bug!("store_with_flags: invalid ScalarPair layout: {:#?}", dest.layout) + }; + let b_offset = a_scalar.value.size(bx).align_to(b_scalar.value.align(bx).abi); + + let llptr = bx.struct_gep(dest.llval, 0); + let val = base::from_immediate(bx, a); + let align = dest.align; + bx.store_with_flags(val, llptr, align, flags); + + let llptr = bx.struct_gep(dest.llval, 1); + let val = base::from_immediate(bx, b); + let align = dest.align.restrict_for_offset(b_offset); + bx.store_with_flags(val, llptr, align, flags); } } } @@ -348,8 +354,8 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandValue { }; // FIXME: choose an appropriate alignment, or use dynamic align somehow - let max_align = Align::from_bits(128, 128).unwrap(); - let min_align = Align::from_bits(8, 8).unwrap(); + let max_align = Align::from_bits(128).unwrap(); + let min_align = Align::from_bits(8).unwrap(); // Allocate an appropriate region on the stack, and copy the value into it let (llsize, _) = glue::size_and_align_of_dst(bx, unsized_ty, Some(llextra)); @@ -463,14 +469,13 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } // Allow RalfJ to sleep soundly knowing that even refactorings that remove // the above error (or silence it under some conditions) will not cause UB - let fnname = bx.cx().get_intrinsic(&("llvm.trap")); - bx.call(fnname, &[], None); + bx.abort(); // We've errored, so we don't have to produce working code. let layout = bx.cx().layout_of(ty); bx.load_operand(PlaceRef::new_sized( bx.cx().const_undef(bx.cx().type_ptr_to(bx.cx().backend_type(layout))), layout, - layout.align, + layout.align.abi, )) }) } diff --git a/src/librustc_codegen_ssa/mir/place.rs b/src/librustc_codegen_ssa/mir/place.rs index 5b36ee8fd18..b10611e5ac7 100644 --- a/src/librustc_codegen_ssa/mir/place.rs +++ b/src/librustc_codegen_ssa/mir/place.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty::{self, Ty}; use rustc::ty::layout::{self, Align, TyLayout, LayoutOf, VariantIdx, HasTyCtxt}; use rustc::mir; @@ -58,8 +48,8 @@ impl<'a, 'tcx: 'a, V: CodegenObject> PlaceRef<'tcx, V> { ) -> Self { debug!("alloca({:?}: {:?})", name, layout); assert!(!layout.is_unsized(), "tried to statically allocate unsized place"); - let tmp = bx.alloca(bx.cx().backend_type(layout), name, layout.align); - Self::new_sized(tmp, layout, layout.align) + let tmp = bx.alloca(bx.cx().backend_type(layout), name, layout.align.abi); + Self::new_sized(tmp, layout, layout.align.abi) } /// Returns a place for an indirect reference to an unsized place. @@ -109,7 +99,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> PlaceRef<'tcx, V> { self.llval } else if let layout::Abi::ScalarPair(ref a, ref b) = self.layout.abi { // Offsets have to match either first or second field. - assert_eq!(offset, a.value.size(bx.cx()).abi_align(b.value.align(bx.cx()))); + assert_eq!(offset, a.value.size(bx.cx()).align_to(b.value.align(bx.cx()).abi)); bx.struct_gep(self.llval, 1) } else { bx.struct_gep(self.llval, bx.cx().backend_field_index(self.layout, ix)) @@ -143,7 +133,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> PlaceRef<'tcx, V> { if def.repr.packed() { // FIXME(eddyb) generalize the adjustment when we // start supporting packing to larger alignments. - assert_eq!(self.layout.align.abi(), 1); + assert_eq!(self.layout.align.abi.bytes(), 1); return simple(); } } @@ -229,9 +219,9 @@ impl<'a, 'tcx: 'a, V: CodegenObject> PlaceRef<'tcx, V> { layout::Variants::Tagged { ref tag, .. } => { let signed = match tag.value { // We use `i1` for bytes that are always `0` or `1`, - // e.g. `#[repr(i8)] enum E { A, B }`, but we can't + // e.g., `#[repr(i8)] enum E { A, B }`, but we can't // let LLVM interpret the `i1` as signed, because - // then `i1 1` (i.e. E::B) is effectively `i8 -1`. + // then `i1 1` (i.e., E::B) is effectively `i8 -1`. layout::Int(_, signed) => !tag.is_bool() && signed, _ => false }; @@ -308,9 +298,8 @@ impl<'a, 'tcx: 'a, V: CodegenObject> PlaceRef<'tcx, V> { // Issue #34427: As workaround for LLVM bug on ARM, // use memset of 0 before assigning niche value. let fill_byte = bx.cx().const_u8(0); - let (size, align) = self.layout.size_and_align(); - let size = bx.cx().const_usize(size.bytes()); - bx.memset(self.llval, fill_byte, size, align, MemFlags::empty()); + let size = bx.cx().const_usize(self.layout.size.bytes()); + bx.memset(self.llval, fill_byte, size, self.align, MemFlags::empty()); } let niche = self.project_field(bx, 0); @@ -336,11 +325,20 @@ impl<'a, 'tcx: 'a, V: CodegenObject> PlaceRef<'tcx, V> { bx: &mut Bx, llindex: V ) -> Self { + // Statically compute the offset if we can, otherwise just use the element size, + // as this will yield the lowest alignment. + let layout = self.layout.field(bx, 0); + let offset = if bx.is_const_integral(llindex) { + layout.size.checked_mul(bx.const_to_uint(llindex), bx).unwrap_or(layout.size) + } else { + layout.size + }; + PlaceRef { llval: bx.inbounds_gep(self.llval, &[bx.cx().const_usize(0), llindex]), llextra: None, - layout: self.layout.field(bx.cx(), 0), - align: self.align + layout, + align: self.align.restrict_for_offset(offset), } } @@ -414,18 +412,17 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // and compile-time agree on values // With floats that won't always be true // so we generate an abort - let fnname = bx.cx().get_intrinsic(&("llvm.trap")); - bx.call(fnname, &[], None); + bx.abort(); let llval = bx.cx().const_undef( bx.cx().type_ptr_to(bx.cx().backend_type(layout)) ); - PlaceRef::new_sized(llval, layout, layout.align) + PlaceRef::new_sized(llval, layout, layout.align.abi) } } } mir::Place::Static(box mir::Static { def_id, ty }) => { let layout = cx.layout_of(self.monomorphize(&ty)); - PlaceRef::new_sized(cx.get_static(def_id), layout, layout.align) + PlaceRef::new_sized(bx.get_static(def_id), layout, layout.align.abi) }, mir::Place::Projection(box mir::Projection { ref base, diff --git a/src/librustc_codegen_ssa/mir/rvalue.rs b/src/librustc_codegen_ssa/mir/rvalue.rs index 6b1efa060fd..9ca5414fa71 100644 --- a/src/librustc_codegen_ssa/mir/rvalue.rs +++ b/src/librustc_codegen_ssa/mir/rvalue.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty::{self, Ty}; use rustc::ty::cast::{CastTy, IntTy}; use rustc::ty::layout::{self, LayoutOf, HasTyCtxt}; @@ -131,8 +121,9 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let keep_going = header_bx.icmp(IntPredicate::IntNE, current, end); header_bx.cond_br(keep_going, body_bx.llbb(), next_bx.llbb()); + let align = dest.align.restrict_for_offset(dest.layout.field(bx.cx(), 0).size); cg_elem.val.store(&mut body_bx, - PlaceRef::new_sized(current, cg_elem.layout, dest.align)); + PlaceRef::new_sized(current, cg_elem.layout, align)); let next = body_bx.inbounds_gep(current, &[bx.cx().const_usize(1)]); body_bx.br(header_bx.llbb()); @@ -319,9 +310,9 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { if let layout::Abi::Scalar(ref scalar) = operand.layout.abi { if let layout::Int(_, s) = scalar.value { // We use `i1` for bytes that are always `0` or `1`, - // e.g. `#[repr(i8)] enum E { A, B }`, but we can't + // e.g., `#[repr(i8)] enum E { A, B }`, but we can't // let LLVM interpret the `i1` as signed, because - // then `i1 1` (i.e. E::B) is effectively `i8 -1`. + // then `i1 1` (i.e., E::B) is effectively `i8 -1`. signed = !scalar.is_bool() && s; let er = scalar.valid_range_exclusive(bx.cx()); @@ -337,7 +328,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { llval, ll_t_in_const ); - base::call_assume(&mut bx, cmp); + bx.assume(cmp); } } } @@ -496,10 +487,10 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } mir::Rvalue::NullaryOp(mir::NullOp::Box, content_ty) => { - let content_ty: Ty<'tcx> = self.monomorphize(&content_ty); - let (size, align) = bx.cx().layout_of(content_ty).size_and_align(); - let llsize = bx.cx().const_usize(size.bytes()); - let llalign = bx.cx().const_usize(align.abi()); + let content_ty = self.monomorphize(&content_ty); + let content_layout = bx.cx().layout_of(content_ty); + let llsize = bx.cx().const_usize(content_layout.size.bytes()); + let llalign = bx.cx().const_usize(content_layout.align.abi.bytes()); let box_layout = bx.cx().layout_of(bx.tcx().mk_box(content_ty)); let llty_ptr = bx.cx().backend_type(box_layout); @@ -693,11 +684,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { mir::BinOp::Mul => OverflowOp::Mul, _ => unreachable!() }; - let intrinsic = get_overflow_intrinsic(oop, bx, input_ty); - let res = bx.call(intrinsic, &[lhs, rhs], None); - - (bx.extract_value(res, 0), - bx.extract_value(res, 1)) + bx.checked_binop(oop, input_ty, lhs, rhs) } mir::BinOp::Shl | mir::BinOp::Shr => { let lhs_llty = bx.cx().val_ty(lhs); @@ -744,80 +731,6 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } } -#[derive(Copy, Clone)] -enum OverflowOp { - Add, Sub, Mul -} - -fn get_overflow_intrinsic<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( - oop: OverflowOp, - bx: &mut Bx, - ty: Ty -) -> Bx::Value { - use syntax::ast::IntTy::*; - use syntax::ast::UintTy::*; - use rustc::ty::{Int, Uint}; - - let tcx = bx.tcx(); - - let new_sty = match ty.sty { - Int(Isize) => Int(tcx.sess.target.isize_ty), - Uint(Usize) => Uint(tcx.sess.target.usize_ty), - ref t @ Uint(_) | ref t @ Int(_) => t.clone(), - _ => panic!("tried to get overflow intrinsic for op applied to non-int type") - }; - - let name = match oop { - OverflowOp::Add => match new_sty { - Int(I8) => "llvm.sadd.with.overflow.i8", - Int(I16) => "llvm.sadd.with.overflow.i16", - Int(I32) => "llvm.sadd.with.overflow.i32", - Int(I64) => "llvm.sadd.with.overflow.i64", - Int(I128) => "llvm.sadd.with.overflow.i128", - - Uint(U8) => "llvm.uadd.with.overflow.i8", - Uint(U16) => "llvm.uadd.with.overflow.i16", - Uint(U32) => "llvm.uadd.with.overflow.i32", - Uint(U64) => "llvm.uadd.with.overflow.i64", - Uint(U128) => "llvm.uadd.with.overflow.i128", - - _ => unreachable!(), - }, - OverflowOp::Sub => match new_sty { - Int(I8) => "llvm.ssub.with.overflow.i8", - Int(I16) => "llvm.ssub.with.overflow.i16", - Int(I32) => "llvm.ssub.with.overflow.i32", - Int(I64) => "llvm.ssub.with.overflow.i64", - Int(I128) => "llvm.ssub.with.overflow.i128", - - Uint(U8) => "llvm.usub.with.overflow.i8", - Uint(U16) => "llvm.usub.with.overflow.i16", - Uint(U32) => "llvm.usub.with.overflow.i32", - Uint(U64) => "llvm.usub.with.overflow.i64", - Uint(U128) => "llvm.usub.with.overflow.i128", - - _ => unreachable!(), - }, - OverflowOp::Mul => match new_sty { - Int(I8) => "llvm.smul.with.overflow.i8", - Int(I16) => "llvm.smul.with.overflow.i16", - Int(I32) => "llvm.smul.with.overflow.i32", - Int(I64) => "llvm.smul.with.overflow.i64", - Int(I128) => "llvm.smul.with.overflow.i128", - - Uint(U8) => "llvm.umul.with.overflow.i8", - Uint(U16) => "llvm.umul.with.overflow.i16", - Uint(U32) => "llvm.umul.with.overflow.i32", - Uint(U64) => "llvm.umul.with.overflow.i64", - Uint(U128) => "llvm.umul.with.overflow.i128", - - _ => unreachable!(), - }, - }; - - bx.cx().get_intrinsic(&name) -} - fn cast_int_to_float<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, signed: bool, diff --git a/src/librustc_codegen_ssa/mir/statement.rs b/src/librustc_codegen_ssa/mir/statement.rs index a69474142ab..9561a57d0a7 100644 --- a/src/librustc_codegen_ssa/mir/statement.rs +++ b/src/librustc_codegen_ssa/mir/statement.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::mir; use traits::BuilderMethods; @@ -89,7 +79,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { if let OperandValue::Immediate(_) = op.val { acc.push(op.immediate()); } else { - span_err!(bx.cx().sess(), span.to_owned(), E0669, + span_err!(bx.sess(), span.to_owned(), E0669, "invalid value for constraint in inline assembly"); } acc @@ -98,16 +88,14 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { if input_vals.len() == inputs.len() { let res = bx.codegen_inline_asm(asm, outputs, input_vals); if !res { - span_err!(bx.cx().sess(), statement.source_info.span, E0668, + span_err!(bx.sess(), statement.source_info.span, E0668, "malformed inline assembly"); } } bx } mir::StatementKind::FakeRead(..) | - mir::StatementKind::EndRegion(..) | mir::StatementKind::Retag { .. } | - mir::StatementKind::EscapeToRaw { .. } | mir::StatementKind::AscribeUserType(..) | mir::StatementKind::Nop => bx, } diff --git a/src/librustc_codegen_ssa/mono_item.rs b/src/librustc_codegen_ssa/mono_item.rs index 53acb3e376c..8488ab2ae86 100644 --- a/src/librustc_codegen_ssa/mono_item.rs +++ b/src/librustc_codegen_ssa/mono_item.rs @@ -1,19 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Walks the crate looking for items/impl-items/trait-items that have -//! either a `rustc_symbol_name` or `rustc_item_path` attribute and -//! generates an error giving, respectively, the symbol name or -//! item-path. This is used for unit testing the code that generates -//! paths etc in all kinds of annoying scenarios. - use base; use rustc::hir; use rustc::hir::def::Def; @@ -29,7 +13,7 @@ pub use rustc_mir::monomorphize::item::MonoItemExt as BaseMonoItemExt; pub trait MonoItemExt<'a, 'tcx: 'a>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> { fn define>(&self, cx: &'a Bx::CodegenCx) { debug!("BEGIN IMPLEMENTING '{} ({})' in cgu {}", - self.to_string(cx.tcx()), + self.to_string(cx.tcx(), true), self.to_raw_string(), cx.codegen_unit().name()); @@ -48,7 +32,7 @@ pub trait MonoItemExt<'a, 'tcx: 'a>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> { cx.codegen_static(def_id, is_mutable); } MonoItem::GlobalAsm(node_id) => { - let item = cx.tcx().hir.expect_item(node_id); + let item = cx.tcx().hir().expect_item(node_id); if let hir::ItemKind::GlobalAsm(ref ga) = item.node { cx.codegen_global_asm(ga); } else { @@ -61,7 +45,7 @@ pub trait MonoItemExt<'a, 'tcx: 'a>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> { } debug!("END IMPLEMENTING '{} ({})' in cgu {}", - self.to_string(cx.tcx()), + self.to_string(cx.tcx(), true), self.to_raw_string(), cx.codegen_unit().name()); } @@ -73,7 +57,7 @@ pub trait MonoItemExt<'a, 'tcx: 'a>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> { visibility: Visibility ) { debug!("BEGIN PREDEFINING '{} ({})' in cgu {}", - self.to_string(cx.tcx()), + self.to_string(cx.tcx(), true), self.to_raw_string(), cx.codegen_unit().name()); @@ -92,7 +76,7 @@ pub trait MonoItemExt<'a, 'tcx: 'a>: fmt::Debug + BaseMonoItemExt<'a, 'tcx> { } debug!("END PREDEFINING '{} ({})' in cgu {}", - self.to_string(cx.tcx()), + self.to_string(cx.tcx(), true), self.to_raw_string(), cx.codegen_unit().name()); } diff --git a/src/librustc_codegen_ssa/traits/abi.rs b/src/librustc_codegen_ssa/traits/abi.rs index f35eb84813f..8f7fa199b05 100644 --- a/src/librustc_codegen_ssa/traits/abi.rs +++ b/src/librustc_codegen_ssa/traits/abi.rs @@ -1,14 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use super::HasCodegen; +use super::BackendTypes; use rustc::ty::{FnSig, Instance, Ty}; use rustc_target::abi::call::FnType; @@ -18,6 +8,6 @@ pub trait AbiMethods<'tcx> { fn fn_type_of_instance(&self, instance: &Instance<'tcx>) -> FnType<'tcx, Ty<'tcx>>; } -pub trait AbiBuilderMethods<'tcx>: HasCodegen<'tcx> { +pub trait AbiBuilderMethods<'tcx>: BackendTypes { fn apply_attrs_callsite(&mut self, ty: &FnType<'tcx, Ty<'tcx>>, callsite: Self::Value); } diff --git a/src/librustc_codegen_ssa/traits/asm.rs b/src/librustc_codegen_ssa/traits/asm.rs index 93e4869e937..7fe16925a3f 100644 --- a/src/librustc_codegen_ssa/traits/asm.rs +++ b/src/librustc_codegen_ssa/traits/asm.rs @@ -1,20 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use super::Backend; -use super::HasCodegen; +use super::BackendTypes; use mir::place::PlaceRef; use rustc::hir::{GlobalAsm, InlineAsm}; -pub trait AsmBuilderMethods<'tcx>: HasCodegen<'tcx> { - // Take an inline assembly expression and splat it out via LLVM +pub trait AsmBuilderMethods<'tcx>: BackendTypes { + /// Take an inline assembly expression and splat it out via LLVM fn codegen_inline_asm( &mut self, ia: &InlineAsm, @@ -23,6 +12,6 @@ pub trait AsmBuilderMethods<'tcx>: HasCodegen<'tcx> { ) -> bool; } -pub trait AsmMethods<'tcx>: Backend<'tcx> { +pub trait AsmMethods<'tcx> { fn codegen_global_asm(&self, ga: &GlobalAsm); } diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index b4d376cf5f0..73c7614d913 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty::layout::{HasTyCtxt, LayoutOf, TyLayout}; use rustc::ty::Ty; @@ -16,7 +6,7 @@ use super::CodegenObject; use rustc::middle::allocator::AllocatorKind; use rustc::middle::cstore::EncodedMetadata; use rustc::mir::mono::Stats; -use rustc::session::Session; +use rustc::session::{Session, config}; use rustc::ty::TyCtxt; use rustc_codegen_utils::codegen_backend::CodegenBackend; use std::sync::Arc; @@ -26,7 +16,6 @@ pub trait BackendTypes { type Value: CodegenObject; type BasicBlock: Copy; type Type: CodegenObject; - type Context; type Funclet; type DIScope: Copy; @@ -39,10 +28,11 @@ pub trait Backend<'tcx>: impl<'tcx, T> Backend<'tcx> for T where Self: BackendTypes + HasTyCtxt<'tcx> + LayoutOf, TyLayout = TyLayout<'tcx>> -{} +{ +} pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Send { - fn new_metadata(&self, sess: &Session, mod_name: &str) -> Self::Module; + fn new_metadata(&self, sess: TyCtxt, mod_name: &str) -> Self::Module; fn write_metadata<'b, 'gcx>( &self, tcx: TyCtxt<'b, 'gcx, 'gcx>, @@ -60,6 +50,7 @@ pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Se fn target_machine_factory( &self, sess: &Session, + opt_level: config::OptLevel, find_features: bool, ) -> Arc Result + Send + Sync>; fn target_cpu<'b>(&self, sess: &'b Session) -> &'b str; diff --git a/src/librustc_codegen_ssa/traits/builder.rs b/src/librustc_codegen_ssa/traits/builder.rs index 3757c514d2c..bc66087d3ce 100644 --- a/src/librustc_codegen_ssa/traits/builder.rs +++ b/src/librustc_codegen_ssa/traits/builder.rs @@ -1,30 +1,28 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::abi::AbiBuilderMethods; use super::asm::AsmBuilderMethods; use super::debuginfo::DebugInfoBuilderMethods; use super::intrinsic::IntrinsicCallMethods; use super::type_::ArgTypeMethods; -use super::HasCodegen; +use super::{HasCodegen, StaticBuilderMethods}; use common::{AtomicOrdering, AtomicRmwBinOp, IntPredicate, RealPredicate, SynchronizationScope}; -use std::ffi::CStr; use mir::operand::OperandRef; use mir::place::PlaceRef; +use rustc::ty::Ty; use rustc::ty::layout::{Align, Size}; +use std::ffi::CStr; use MemFlags; use std::borrow::Cow; use std::ops::Range; use syntax::ast::AsmDialect; +#[derive(Copy, Clone)] +pub enum OverflowOp { + Add, + Sub, + Mul, +} + pub trait BuilderMethods<'a, 'tcx: 'a>: HasCodegen<'tcx> + DebugInfoBuilderMethods<'tcx> @@ -32,6 +30,7 @@ pub trait BuilderMethods<'a, 'tcx: 'a>: + AbiBuilderMethods<'tcx> + IntrinsicCallMethods<'tcx> + AsmBuilderMethods<'tcx> + + StaticBuilderMethods<'tcx> { fn new_block<'b>(cx: &'a Self::CodegenCx, llfn: Self::Value, name: &'b str) -> Self; fn with_cx(cx: &'a Self::CodegenCx) -> Self; @@ -97,6 +96,14 @@ pub trait BuilderMethods<'a, 'tcx: 'a>: fn fneg(&mut self, v: Self::Value) -> Self::Value; fn not(&mut self, v: Self::Value) -> Self::Value; + fn checked_binop( + &mut self, + oop: OverflowOp, + ty: Ty, + lhs: Self::Value, + rhs: Self::Value, + ) -> (Self::Value, Self::Value); + fn alloca(&mut self, ty: Self::Type, name: &str, align: Align) -> Self::Value; fn dynamic_alloca(&mut self, ty: Self::Type, name: &str, align: Align) -> Self::Value; fn array_alloca( @@ -297,18 +304,12 @@ pub trait BuilderMethods<'a, 'tcx: 'a>: ) -> Cow<'b, [Self::Value]> where [Self::Value]: ToOwned; + + /// Called for `StorageLive` fn lifetime_start(&mut self, ptr: Self::Value, size: Size); - fn lifetime_end(&mut self, ptr: Self::Value, size: Size); - /// If LLVM lifetime intrinsic support is enabled (i.e. optimizations - /// on), and `ptr` is nonzero-sized, then extracts the size of `ptr` - /// and the intrinsic for `lt` and passes them to `emit`, which is in - /// charge of generating code to call the passed intrinsic on whatever - /// block of generated code is targeted for the intrinsic. - /// - /// If LLVM lifetime intrinsic support is disabled (i.e. optimizations - /// off) or `ptr` is zero-sized, then no-op (does not call `emit`). - fn call_lifetime_intrinsic(&mut self, intrinsic: &str, ptr: Self::Value, size: Size); + /// Called for `StorageDead` + fn lifetime_end(&mut self, ptr: Self::Value, size: Size); fn call( &mut self, diff --git a/src/librustc_codegen_ssa/traits/consts.rs b/src/librustc_codegen_ssa/traits/consts.rs index c0a54452195..482fb67e2b0 100644 --- a/src/librustc_codegen_ssa/traits/consts.rs +++ b/src/librustc_codegen_ssa/traits/consts.rs @@ -1,23 +1,12 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use super::Backend; +use super::BackendTypes; use mir::place::PlaceRef; use rustc::mir::interpret::Allocation; use rustc::mir::interpret::Scalar; use rustc::ty::layout; use syntax::symbol::LocalInternedString; -pub trait ConstMethods<'tcx>: Backend<'tcx> { +pub trait ConstMethods<'tcx>: BackendTypes { // Constant constructors - fn const_null(&self, t: Self::Type) -> Self::Value; fn const_undef(&self, t: Self::Type) -> Self::Value; fn const_int(&self, t: Self::Type, i: i64) -> Self::Value; @@ -61,4 +50,6 @@ pub trait ConstMethods<'tcx>: Backend<'tcx> { alloc: &Allocation, offset: layout::Size, ) -> PlaceRef<'tcx, Self::Value>; + + fn const_ptrcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value; } diff --git a/src/librustc_codegen_ssa/traits/debuginfo.rs b/src/librustc_codegen_ssa/traits/debuginfo.rs index 643776fcd64..4163faa5914 100644 --- a/src/librustc_codegen_ssa/traits/debuginfo.rs +++ b/src/librustc_codegen_ssa/traits/debuginfo.rs @@ -1,15 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use super::Backend; -use super::HasCodegen; +use super::BackendTypes; use debuginfo::{FunctionDebugContext, MirDebugScope, VariableAccess, VariableKind}; use rustc::hir::def_id::CrateNum; use rustc::mir; @@ -19,7 +8,7 @@ use rustc_mir::monomorphize::Instance; use syntax::ast::Name; use syntax_pos::{SourceFile, Span}; -pub trait DebugInfoMethods<'tcx>: Backend<'tcx> { +pub trait DebugInfoMethods<'tcx>: BackendTypes { fn create_vtable_metadata(&self, ty: Ty<'tcx>, vtable: Self::Value); /// Creates the function-specific debug context. @@ -51,7 +40,7 @@ pub trait DebugInfoMethods<'tcx>: Backend<'tcx> { fn debuginfo_upvar_decls_ops_sequence(&self, byte_offset_of_var_in_env: u64) -> [i64; 4]; } -pub trait DebugInfoBuilderMethods<'tcx>: HasCodegen<'tcx> { +pub trait DebugInfoBuilderMethods<'tcx>: BackendTypes { fn declare_local( &mut self, dbg_context: &FunctionDebugContext, diff --git a/src/librustc_codegen_ssa/traits/declare.rs b/src/librustc_codegen_ssa/traits/declare.rs index 38ef52e3c8e..3cd3c4e48b9 100644 --- a/src/librustc_codegen_ssa/traits/declare.rs +++ b/src/librustc_codegen_ssa/traits/declare.rs @@ -1,20 +1,10 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use super::Backend; +use super::BackendTypes; use rustc::hir::def_id::DefId; use rustc::mir::mono::{Linkage, Visibility}; use rustc::ty; use rustc_mir::monomorphize::Instance; -pub trait DeclareMethods<'tcx>: Backend<'tcx> { +pub trait DeclareMethods<'tcx>: BackendTypes { /// Declare a global value. /// /// If there’s a value with the same name already declared, the function will @@ -41,7 +31,7 @@ pub trait DeclareMethods<'tcx>: Backend<'tcx> { /// Use this function when you intend to define a global. This function will /// return None if the name already has a definition associated with it. In that /// case an error should be reported to the user, because it usually happens due - /// to user’s fault (e.g. misuse of #[no_mangle] or #[export_name] attributes). + /// to user’s fault (e.g., misuse of #[no_mangle] or #[export_name] attributes). fn define_global(&self, name: &str, ty: Self::Type) -> Option; /// Declare a private global @@ -71,7 +61,7 @@ pub trait DeclareMethods<'tcx>: Backend<'tcx> { fn get_defined_value(&self, name: &str) -> Option; } -pub trait PreDefineMethods<'tcx>: Backend<'tcx> { +pub trait PreDefineMethods<'tcx>: BackendTypes { fn predefine_static( &self, def_id: DefId, diff --git a/src/librustc_codegen_ssa/traits/intrinsic.rs b/src/librustc_codegen_ssa/traits/intrinsic.rs index 53a7878796b..a2d6b0550f8 100644 --- a/src/librustc_codegen_ssa/traits/intrinsic.rs +++ b/src/librustc_codegen_ssa/traits/intrinsic.rs @@ -1,21 +1,10 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use super::Backend; -use super::HasCodegen; +use super::BackendTypes; use mir::operand::OperandRef; use rustc::ty::Ty; use rustc_target::abi::call::FnType; use syntax_pos::Span; -pub trait IntrinsicCallMethods<'tcx>: HasCodegen<'tcx> { +pub trait IntrinsicCallMethods<'tcx>: BackendTypes { /// Remember to add all intrinsics here, in librustc_typeck/check/mod.rs, /// and in libcore/intrinsics.rs; if you need access to any llvm intrinsics, /// add them to librustc_codegen_llvm/context.rs @@ -27,11 +16,8 @@ pub trait IntrinsicCallMethods<'tcx>: HasCodegen<'tcx> { llresult: Self::Value, span: Span, ); -} - -pub trait IntrinsicDeclarationMethods<'tcx>: Backend<'tcx> { - fn get_intrinsic(&self, key: &str) -> Self::Value; - /// Declare any llvm intrinsics that you might need - fn declare_intrinsic(&self, key: &str) -> Option; + fn abort(&mut self); + fn assume(&mut self, val: Self::Value); + fn expect(&mut self, cond: Self::Value, expected: bool) -> Self::Value; } diff --git a/src/librustc_codegen_ssa/traits/misc.rs b/src/librustc_codegen_ssa/traits/misc.rs index 0425b8e8e23..b2315556366 100644 --- a/src/librustc_codegen_ssa/traits/misc.rs +++ b/src/librustc_codegen_ssa/traits/misc.rs @@ -1,14 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use super::Backend; +use super::BackendTypes; use libc::c_uint; use rustc::mir::mono::Stats; use rustc::session::Session; @@ -18,10 +8,10 @@ use rustc_mir::monomorphize::partitioning::CodegenUnit; use std::cell::RefCell; use std::sync::Arc; -pub trait MiscMethods<'tcx>: Backend<'tcx> { +pub trait MiscMethods<'tcx>: BackendTypes { fn vtables( &self, - ) -> &RefCell, ty::PolyExistentialTraitRef<'tcx>), Self::Value>>; + ) -> &RefCell, Option>), Self::Value>>; fn check_overflow(&self) -> bool; fn instances(&self) -> &RefCell, Self::Value>>; fn get_fn(&self, instance: Instance<'tcx>) -> Self::Value; @@ -32,8 +22,6 @@ pub trait MiscMethods<'tcx>: Backend<'tcx> { fn stats(&self) -> &RefCell; fn consume_stats(self) -> RefCell; fn codegen_unit(&self) -> &Arc>; - fn statics_to_rauw(&self) -> &RefCell>; - fn closure_env_needs_indirect_debuginfo(&self) -> bool; fn used_statics(&self) -> &RefCell>; fn set_frame_pointer_elimination(&self, llfn: Self::Value); fn apply_target_cpu_attr(&self, llfn: Self::Value); diff --git a/src/librustc_codegen_ssa/traits/mod.rs b/src/librustc_codegen_ssa/traits/mod.rs index 5cff31e17b5..8fe8b7ecd47 100644 --- a/src/librustc_codegen_ssa/traits/mod.rs +++ b/src/librustc_codegen_ssa/traits/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Interface of a Rust codegen backend //! //! This crate defines all the traits that have to be implemented by a codegen backend in order to @@ -40,13 +30,13 @@ mod write; pub use self::abi::{AbiBuilderMethods, AbiMethods}; pub use self::asm::{AsmBuilderMethods, AsmMethods}; pub use self::backend::{Backend, BackendTypes, ExtraBackendMethods}; -pub use self::builder::BuilderMethods; +pub use self::builder::{BuilderMethods, OverflowOp}; pub use self::consts::ConstMethods; pub use self::debuginfo::{DebugInfoBuilderMethods, DebugInfoMethods}; pub use self::declare::{DeclareMethods, PreDefineMethods}; -pub use self::intrinsic::{IntrinsicCallMethods, IntrinsicDeclarationMethods}; +pub use self::intrinsic::IntrinsicCallMethods; pub use self::misc::MiscMethods; -pub use self::statics::StaticMethods; +pub use self::statics::{StaticMethods, StaticBuilderMethods}; pub use self::type_::{ ArgTypeMethods, BaseTypeMethods, DerivedTypeMethods, LayoutTypeMethods, TypeMethods, }; @@ -62,10 +52,9 @@ pub trait CodegenMethods<'tcx>: + TypeMethods<'tcx> + MiscMethods<'tcx> + ConstMethods<'tcx> - + StaticMethods<'tcx> + + StaticMethods + DebugInfoMethods<'tcx> + AbiMethods<'tcx> - + IntrinsicDeclarationMethods<'tcx> + DeclareMethods<'tcx> + AsmMethods<'tcx> + PreDefineMethods<'tcx> @@ -77,22 +66,23 @@ impl<'tcx, T> CodegenMethods<'tcx> for T where + TypeMethods<'tcx> + MiscMethods<'tcx> + ConstMethods<'tcx> - + StaticMethods<'tcx> + + StaticMethods + DebugInfoMethods<'tcx> + AbiMethods<'tcx> - + IntrinsicDeclarationMethods<'tcx> + DeclareMethods<'tcx> + AsmMethods<'tcx> + PreDefineMethods<'tcx> -{} +{ +} -pub trait HasCodegen<'tcx>: Backend<'tcx> { +pub trait HasCodegen<'tcx>: + Backend<'tcx> + ::std::ops::Deref>::CodegenCx> +{ type CodegenCx: CodegenMethods<'tcx> + BackendTypes< Value = Self::Value, BasicBlock = Self::BasicBlock, Type = Self::Type, - Context = Self::Context, Funclet = Self::Funclet, DIScope = Self::DIScope, >; diff --git a/src/librustc_codegen_ssa/traits/statics.rs b/src/librustc_codegen_ssa/traits/statics.rs index 172c48f8a85..c4e7fe703c2 100644 --- a/src/librustc_codegen_ssa/traits/statics.rs +++ b/src/librustc_codegen_ssa/traits/statics.rs @@ -1,23 +1,12 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use super::Backend; +use super::BackendTypes; use rustc::hir::def_id::DefId; use rustc::ty::layout::Align; -pub trait StaticMethods<'tcx>: Backend<'tcx> { - fn static_ptrcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value; - fn static_bitcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value; - fn static_addr_of_mut(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value; +pub trait StaticMethods: BackendTypes { fn static_addr_of(&self, cv: Self::Value, align: Align, kind: Option<&str>) -> Self::Value; - fn get_static(&self, def_id: DefId) -> Self::Value; fn codegen_static(&self, def_id: DefId, is_mutable: bool); - unsafe fn static_replace_all_uses(&self, old_g: Self::Value, new_g: Self::Value); +} + +pub trait StaticBuilderMethods<'tcx>: BackendTypes { + fn get_static(&self, def_id: DefId) -> Self::Value; } diff --git a/src/librustc_codegen_ssa/traits/type_.rs b/src/librustc_codegen_ssa/traits/type_.rs index 1aa1f45f517..2ec0c8e5a75 100644 --- a/src/librustc_codegen_ssa/traits/type_.rs +++ b/src/librustc_codegen_ssa/traits/type_.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::misc::MiscMethods; use super::Backend; use super::HasCodegen; @@ -20,6 +10,8 @@ use rustc_target::abi::call::{ArgType, CastTarget, FnType, Reg}; use std::cell::RefCell; use syntax::ast; +// This depends on `Backend` and not `BackendTypes`, because consumers will probably want to use +// `LayoutOf` or `HasTyCtxt`. This way, they don't have to add a constraint on it themselves. pub trait BaseTypeMethods<'tcx>: Backend<'tcx> { fn type_void(&self) -> Self::Type; fn type_metadata(&self) -> Self::Type; @@ -30,7 +22,7 @@ pub trait BaseTypeMethods<'tcx>: Backend<'tcx> { fn type_i64(&self) -> Self::Type; fn type_i128(&self) -> Self::Type; - // Creates an integer type with the given number of bits, e.g. i24 + // Creates an integer type with the given number of bits, e.g., i24 fn type_ix(&self, num_bits: u64) -> Self::Type; fn type_isize(&self) -> Self::Type; @@ -41,11 +33,9 @@ pub trait BaseTypeMethods<'tcx>: Backend<'tcx> { fn type_func(&self, args: &[Self::Type], ret: Self::Type) -> Self::Type; fn type_variadic_func(&self, args: &[Self::Type], ret: Self::Type) -> Self::Type; fn type_struct(&self, els: &[Self::Type], packed: bool) -> Self::Type; - fn type_named_struct(&self, name: &str) -> Self::Type; fn type_array(&self, ty: Self::Type, len: u64) -> Self::Type; fn type_vector(&self, ty: Self::Type, len: u64) -> Self::Type; fn type_kind(&self, ty: Self::Type) -> TypeKind; - fn set_struct_body(&self, ty: Self::Type, els: &[Self::Type], packed: bool); fn type_ptr_to(&self, ty: Self::Type) -> Self::Type; fn element_type(&self, ty: Self::Type) -> Self::Type; @@ -120,16 +110,16 @@ pub trait DerivedTypeMethods<'tcx>: BaseTypeMethods<'tcx> + MiscMethods<'tcx> { } } - fn type_pointee_for_abi_align(&self, align: Align) -> Self::Type { + fn type_pointee_for_align(&self, align: Align) -> Self::Type { // FIXME(eddyb) We could find a better approximation if ity.align < align. - let ity = layout::Integer::approximate_abi_align(self, align); + let ity = layout::Integer::approximate_align(self, align); self.type_from_integer(ity) } /// Return a LLVM type that has at most the required alignment, /// and exactly the required size, as a best-effort padding array. fn type_padding_filler(&self, size: Size, align: Align) -> Self::Type { - let unit = layout::Integer::approximate_abi_align(self, align); + let unit = layout::Integer::approximate_align(self, align); let size = size.bytes(); let unit_size = unit.size().bytes(); assert_eq!(size % unit_size, 0); diff --git a/src/librustc_codegen_ssa/traits/write.rs b/src/librustc_codegen_ssa/traits/write.rs index 72522e19af2..cea89a7f99b 100644 --- a/src/librustc_codegen_ssa/traits/write.rs +++ b/src/librustc_codegen_ssa/traits/write.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use back::lto::{LtoModuleCodegen, SerializedModule, ThinModule}; use back::write::{CodegenContext, ModuleConfig}; use {CompiledModule, ModuleCodegen}; @@ -24,14 +14,19 @@ pub trait WriteBackendMethods: 'static + Sized + Clone { type ThinData: Send + Sync; type ThinBuffer: ThinBufferMethods; - /// Performs LTO, which in the case of full LTO means merging all modules into - /// a single one and returning it for further optimizing. For ThinLTO, it will - /// do the global analysis necessary and return two lists, one of the modules - /// the need optimization and another for modules that can simply be copied over - /// from the incr. comp. cache. - fn run_lto( + /// Performs fat LTO by merging all modules into a single one and returning it + /// for further optimization. + fn run_fat_lto( cgcx: &CodegenContext, modules: Vec>, + timeline: &mut Timeline, + ) -> Result, FatalError>; + /// Performs thin LTO by performing necessary global analysis and returning two + /// lists, one of the modules that need optimization and another for modules that + /// can simply be copied over from the incr. comp. cache. + fn run_thin_lto( + cgcx: &CodegenContext, + modules: Vec<(String, Self::ThinBuffer)>, cached_modules: Vec<(SerializedModule, WorkProduct)>, timeline: &mut Timeline, ) -> Result<(Vec>, Vec), FatalError>; @@ -55,6 +50,10 @@ pub trait WriteBackendMethods: 'static + Sized + Clone { config: &ModuleConfig, timeline: &mut Timeline, ) -> Result; + fn prepare_thin( + cgcx: &CodegenContext, + module: ModuleCodegen + ) -> (String, Self::ThinBuffer); fn run_lto_pass_manager( cgcx: &CodegenContext, llmod: &ModuleCodegen, diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs index c76ae04dcbb..0f969a1a8d2 100644 --- a/src/librustc_codegen_utils/codegen_backend.rs +++ b/src/librustc_codegen_utils/codegen_backend.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The Rust compiler. //! //! # Note @@ -22,8 +12,8 @@ #![feature(box_syntax)] use std::any::Any; -use std::io::{self, Write}; -use std::fs::File; +use std::io::Write; +use std::fs; use std::path::Path; use std::sync::{mpsc, Arc}; @@ -82,13 +72,9 @@ pub struct NoLlvmMetadataLoader; impl MetadataLoader for NoLlvmMetadataLoader { fn get_rlib_metadata(&self, _: &Target, filename: &Path) -> Result { - let mut file = File::open(filename) - .map_err(|e| format!("metadata file open err: {:?}", e))?; - - let mut buf = Vec::new(); - io::copy(&mut file, &mut buf).unwrap(); - let buf: OwningRef, [u8]> = OwningRef::new(buf).into(); - return Ok(rustc_erase_owner!(buf.map_owner_box())); + let buf = fs::read(filename).map_err(|e| format!("metadata file open err: {:?}", e))?; + let buf: OwningRef, [u8]> = OwningRef::new(buf); + Ok(rustc_erase_owner!(buf.map_owner_box())) } fn get_dylib_metadata(&self, target: &Target, filename: &Path) -> Result { @@ -104,7 +90,7 @@ pub struct OngoingCodegen { } impl MetadataOnlyCodegenBackend { - pub fn new() -> Box { + pub fn boxed() -> Box { box MetadataOnlyCodegenBackend(()) } } @@ -160,20 +146,13 @@ impl CodegenBackend for MetadataOnlyCodegenBackend { // ::rustc::middle::dependency_format::calculate(tcx); let _ = tcx.link_args(LOCAL_CRATE); let _ = tcx.native_libraries(LOCAL_CRATE); - for mono_item in - collector::collect_crate_mono_items( - tcx, - collector::MonoItemCollectionMode::Eager - ).0 { - match mono_item { - MonoItem::Fn(inst) => { - let def_id = inst.def_id(); - if def_id.is_local() { - let _ = inst.def.is_inline(tcx); - let _ = tcx.codegen_fn_attrs(def_id); - } + let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE); + for (mono_item, _) in cgus.iter().flat_map(|cgu| cgu.items().iter()) { + if let MonoItem::Fn(inst) = mono_item { + let def_id = inst.def_id(); + if def_id.is_local() { + let _ = tcx.codegen_fn_attrs(def_id); } - _ => {} } } tcx.sess.abort_if_errors(); @@ -189,7 +168,7 @@ impl CodegenBackend for MetadataOnlyCodegenBackend { }).collect(); (box OngoingCodegen { - metadata: metadata, + metadata, metadata_version: tcx.metadata_encoding_version().to_vec(), crate_name: tcx.crate_name(LOCAL_CRATE), }, Arc::new(def_ids)) @@ -220,8 +199,7 @@ impl CodegenBackend for MetadataOnlyCodegenBackend { } else { &ongoing_codegen.metadata.raw_data }; - let mut file = File::create(&output_name).unwrap(); - file.write_all(metadata).unwrap(); + fs::write(&output_name, metadata).unwrap(); } sess.abort_if_errors(); diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs index c3edbb633c7..1f590d46ed8 100644 --- a/src/librustc_codegen_utils/lib.rs +++ b/src/librustc_codegen_utils/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! # Note //! //! This API is completely unstable and subject to change. @@ -21,7 +11,6 @@ #![feature(custom_attribute)] #![feature(nll)] #![allow(unused_attributes)] -#![feature(quote)] #![feature(rustc_diagnostic_macros)] #![recursion_limit="256"] @@ -41,6 +30,7 @@ extern crate syntax_pos; #[macro_use] extern crate rustc_data_structures; use rustc::ty::TyCtxt; +use rustc::hir::def_id::LOCAL_CRATE; pub mod link; pub mod codegen_backend; @@ -52,13 +42,9 @@ pub mod symbol_names_test; /// that actually test that compilation succeeds without /// reporting an error. pub fn check_for_rustc_errors_attr(tcx: TyCtxt) { - if let Some((id, span, _)) = *tcx.sess.entry_fn.borrow() { - let main_def_id = tcx.hir.local_def_id(id); - - if tcx.has_attr(main_def_id, "rustc_error") { - tcx.sess.span_fatal(span, "compilation successful"); + if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) { + if tcx.has_attr(def_id, "rustc_error") { + tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful"); } } } - -__build_diagnostic_array! { librustc_codegen_utils, DIAGNOSTICS } diff --git a/src/librustc_codegen_utils/link.rs b/src/librustc_codegen_utils/link.rs index b11aa687326..09e22bd2c91 100644 --- a/src/librustc_codegen_utils/link.rs +++ b/src/librustc_codegen_utils/link.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::session::config::{self, OutputFilenames, Input, OutputType}; use rustc::session::Session; use std::path::{Path, PathBuf}; diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index f8593363bb1..9267f14f242 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The Rust Linkage Model and Symbol Names //! ======================================= //! @@ -71,7 +61,7 @@ //! order to also avoid inter-crate conflicts two more measures are taken: //! //! - The name of the crate containing the symbol is prepended to the symbol -//! name, i.e. symbols are "crate qualified". For example, a function `foo` in +//! name, i.e., symbols are "crate qualified". For example, a function `foo` in //! module `bar` in crate `baz` would get a symbol name like //! `baz::bar::foo::{hash}` instead of just `bar::foo::{hash}`. This avoids //! simple conflicts between functions from different crates. @@ -250,22 +240,22 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance debug!("symbol_name(def_id={:?}, substs={:?})", def_id, substs); - let node_id = tcx.hir.as_local_node_id(def_id); + let node_id = tcx.hir().as_local_node_id(def_id); - if let Some(id) = node_id { - if *tcx.sess.plugin_registrar_fn.get() == Some(id) { + if def_id.is_local() { + if tcx.plugin_registrar_fn(LOCAL_CRATE) == Some(def_id) { let disambiguator = tcx.sess.local_crate_disambiguator(); return tcx.sess.generate_plugin_registrar_symbol(disambiguator); } - if *tcx.sess.derive_registrar_fn.get() == Some(id) { + if tcx.proc_macro_decls_static(LOCAL_CRATE) == Some(def_id) { let disambiguator = tcx.sess.local_crate_disambiguator(); - return tcx.sess.generate_derive_registrar_symbol(disambiguator); + return tcx.sess.generate_proc_macro_decls_symbol(disambiguator); } } // FIXME(eddyb) Precompute a custom symbol name based on attributes. let is_foreign = if let Some(id) = node_id { - match tcx.hir.get(id) { + match tcx.hir().get(id) { Node::ForeignItem(_) => true, _ => false, } @@ -389,7 +379,7 @@ impl SymbolPathBuffer { impl ItemPathBuffer for SymbolPathBuffer { fn root_mode(&self) -> &RootMode { - const ABSOLUTE: &'static RootMode = &RootMode::Absolute; + const ABSOLUTE: &RootMode = &RootMode::Absolute; ABSOLUTE } diff --git a/src/librustc_codegen_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs index 6eaf0c1c08d..a11eb4da66a 100644 --- a/src/librustc_codegen_utils/symbol_names_test.rs +++ b/src/librustc_codegen_utils/symbol_names_test.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Walks the crate looking for items/impl-items/trait-items that have //! either a `rustc_symbol_name` or `rustc_item_path` attribute and //! generates an error giving, respectively, the symbol name or @@ -33,7 +23,7 @@ pub fn report_symbol_names<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { let mut visitor = SymbolNamesTest { tcx }; - tcx.hir.krate().visit_all_item_likes(&mut visitor); + tcx.hir().krate().visit_all_item_likes(&mut visitor); }) } @@ -45,7 +35,7 @@ impl<'a, 'tcx> SymbolNamesTest<'a, 'tcx> { fn process_attrs(&mut self, node_id: ast::NodeId) { let tcx = self.tcx; - let def_id = tcx.hir.local_def_id(node_id); + let def_id = tcx.hir().local_def_id(node_id); for attr in tcx.get_attrs(def_id).iter() { if attr.check_name(SYMBOL_NAME) { // for now, can only use on monomorphic names diff --git a/src/librustc_cratesio_shim/src/lib.rs b/src/librustc_cratesio_shim/src/lib.rs index 1fe70fa23b7..4024087f4d3 100644 --- a/src/librustc_cratesio_shim/src/lib.rs +++ b/src/librustc_cratesio_shim/src/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // See Cargo.toml for a comment explaining this crate. #![allow(unused_extern_crates)] @@ -15,4 +5,5 @@ extern crate bitflags; extern crate log; +extern crate proc_macro; extern crate unicode_width; diff --git a/src/librustc_data_structures/Cargo.toml b/src/librustc_data_structures/Cargo.toml index 5b3dd38adf2..1754376a5d7 100644 --- a/src/librustc_data_structures/Cargo.toml +++ b/src/librustc_data_structures/Cargo.toml @@ -9,7 +9,7 @@ path = "lib.rs" crate-type = ["dylib"] [dependencies] -ena = "0.10.1" +ena = "0.11" log = "0.4" rustc_cratesio_shim = { path = "../librustc_cratesio_shim" } serialize = { path = "../libserialize" } @@ -19,7 +19,7 @@ stable_deref_trait = "1.0.0" rustc-rayon = "0.1.1" rustc-rayon-core = "0.1.1" rustc-hash = "1.0.1" -smallvec = { version = "0.6.5", features = ["union"] } +smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } [dependencies.parking_lot] version = "0.6" diff --git a/src/librustc_data_structures/base_n.rs b/src/librustc_data_structures/base_n.rs index d3b47daa5b4..c9c1933f25b 100644 --- a/src/librustc_data_structures/base_n.rs +++ b/src/librustc_data_structures/base_n.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Convert unsigned integers into a string representation with some base. /// Bases up to and including 36 can be used for case-insensitive things. diff --git a/src/librustc_data_structures/bit_set.rs b/src/librustc_data_structures/bit_set.rs index 28aad49b09b..8adfe3749af 100644 --- a/src/librustc_data_structures/bit_set.rs +++ b/src/librustc_data_structures/bit_set.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use indexed_vec::{Idx, IndexVec}; use smallvec::SmallVec; use std::fmt; diff --git a/src/librustc_data_structures/const_cstr.rs b/src/librustc_data_structures/const_cstr.rs index 4589d973b6a..fbe2f29f706 100644 --- a/src/librustc_data_structures/const_cstr.rs +++ b/src/librustc_data_structures/const_cstr.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// This macro creates a zero-overhead &CStr by adding a NUL terminator to /// the string literal passed into it at compile-time. Use it like: /// diff --git a/src/librustc_data_structures/fingerprint.rs b/src/librustc_data_structures/fingerprint.rs index aa9ddda2b93..2e596ca3e44 100644 --- a/src/librustc_data_structures/fingerprint.rs +++ b/src/librustc_data_structures/fingerprint.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem; use stable_hasher; use serialize; @@ -86,6 +76,7 @@ impl ::std::fmt::Display for Fingerprint { } impl stable_hasher::StableHasherResult for Fingerprint { + #[inline] fn finish(hasher: stable_hasher::StableHasher) -> Self { let (_0, _1) = hasher.finalize(); Fingerprint(_0, _1) diff --git a/src/librustc_data_structures/flock.rs b/src/librustc_data_structures/flock.rs index 86e48e21626..2dea249f1c0 100644 --- a/src/librustc_data_structures/flock.rs +++ b/src/librustc_data_structures/flock.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Simple file-locking apis for each OS. //! //! This is not meant to be in the standard library, it does nothing with @@ -41,12 +31,6 @@ cfg_if! { // not actually here, but brings in line with freebsd pub l_sysid: libc::c_int, } - - pub const F_RDLCK: libc::c_short = 0; - pub const F_WRLCK: libc::c_short = 1; - pub const F_UNLCK: libc::c_short = 2; - pub const F_SETLK: libc::c_int = 6; - pub const F_SETLKW: libc::c_int = 7; } #[cfg(target_os = "freebsd")] @@ -62,12 +46,6 @@ cfg_if! { pub l_whence: libc::c_short, pub l_sysid: libc::c_int, } - - pub const F_RDLCK: libc::c_short = 1; - pub const F_UNLCK: libc::c_short = 2; - pub const F_WRLCK: libc::c_short = 3; - pub const F_SETLK: libc::c_int = 12; - pub const F_SETLKW: libc::c_int = 13; } #[cfg(any(target_os = "dragonfly", @@ -88,12 +66,6 @@ cfg_if! { // not actually here, but brings in line with freebsd pub l_sysid: libc::c_int, } - - pub const F_RDLCK: libc::c_short = 1; - pub const F_UNLCK: libc::c_short = 2; - pub const F_WRLCK: libc::c_short = 3; - pub const F_SETLK: libc::c_int = 8; - pub const F_SETLKW: libc::c_int = 9; } #[cfg(target_os = "haiku")] @@ -111,12 +83,6 @@ cfg_if! { // not actually here, but brings in line with freebsd pub l_sysid: libc::c_int, } - - pub const F_RDLCK: libc::c_short = 0x0040; - pub const F_UNLCK: libc::c_short = 0x0200; - pub const F_WRLCK: libc::c_short = 0x0400; - pub const F_SETLK: libc::c_int = 0x0080; - pub const F_SETLKW: libc::c_int = 0x0100; } #[cfg(any(target_os = "macos", target_os = "ios"))] @@ -134,12 +100,6 @@ cfg_if! { // not actually here, but brings in line with freebsd pub l_sysid: libc::c_int, } - - pub const F_RDLCK: libc::c_short = 1; - pub const F_UNLCK: libc::c_short = 2; - pub const F_WRLCK: libc::c_short = 3; - pub const F_SETLK: libc::c_int = 8; - pub const F_SETLKW: libc::c_int = 9; } #[cfg(target_os = "solaris")] @@ -155,12 +115,6 @@ cfg_if! { pub l_sysid: libc::c_int, pub l_pid: libc::pid_t, } - - pub const F_RDLCK: libc::c_short = 1; - pub const F_WRLCK: libc::c_short = 2; - pub const F_UNLCK: libc::c_short = 3; - pub const F_SETLK: libc::c_int = 6; - pub const F_SETLKW: libc::c_int = 7; } #[derive(Debug)] @@ -192,9 +146,9 @@ cfg_if! { } let lock_type = if exclusive { - os::F_WRLCK + libc::F_WRLCK as libc::c_short } else { - os::F_RDLCK + libc::F_RDLCK as libc::c_short }; let flock = os::flock { @@ -205,7 +159,7 @@ cfg_if! { l_type: lock_type, l_sysid: 0, }; - let cmd = if wait { os::F_SETLKW } else { os::F_SETLK }; + let cmd = if wait { libc::F_SETLKW } else { libc::F_SETLK }; let ret = unsafe { libc::fcntl(fd, cmd, &flock) }; @@ -226,11 +180,11 @@ cfg_if! { l_len: 0, l_pid: 0, l_whence: libc::SEEK_SET as libc::c_short, - l_type: os::F_UNLCK, + l_type: libc::F_UNLCK as libc::c_short, l_sysid: 0, }; unsafe { - libc::fcntl(self.fd, os::F_SETLK, &flock); + libc::fcntl(self.fd, libc::F_SETLK, &flock); libc::close(self.fd); } } diff --git a/src/librustc_data_structures/fx.rs b/src/librustc_data_structures/fx.rs index 7c7fc3a9346..a2afeffe730 100644 --- a/src/librustc_data_structures/fx.rs +++ b/src/librustc_data_structures/fx.rs @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use rustc_hash::{FxHasher, FxHashMap, FxHashSet}; diff --git a/src/librustc_data_structures/graph/dominators/mod.rs b/src/librustc_data_structures/graph/dominators/mod.rs index 9b7f4cec47b..536efffbb22 100644 --- a/src/librustc_data_structures/graph/dominators/mod.rs +++ b/src/librustc_data_structures/graph/dominators/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Algorithm citation: //! A Simple, Fast Dominance Algorithm. //! Keith D. Cooper, Timothy J. Harvey, and Ken Kennedy diff --git a/src/librustc_data_structures/graph/dominators/test.rs b/src/librustc_data_structures/graph/dominators/test.rs index 0af878cac2d..5d17ce9e909 100644 --- a/src/librustc_data_structures/graph/dominators/test.rs +++ b/src/librustc_data_structures/graph/dominators/test.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::super::test::TestGraph; use super::*; diff --git a/src/librustc_data_structures/graph/implementation/mod.rs b/src/librustc_data_structures/graph/implementation/mod.rs index c31321fa374..0768873f836 100644 --- a/src/librustc_data_structures/graph/implementation/mod.rs +++ b/src/librustc_data_structures/graph/implementation/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A graph module for use in dataflow, region resolution, and elsewhere. //! //! # Interface details diff --git a/src/librustc_data_structures/graph/implementation/tests.rs b/src/librustc_data_structures/graph/implementation/tests.rs index 3814827b5df..a7a25042396 100644 --- a/src/librustc_data_structures/graph/implementation/tests.rs +++ b/src/librustc_data_structures/graph/implementation/tests.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use graph::implementation::*; use std::fmt::Debug; diff --git a/src/librustc_data_structures/graph/iterate/mod.rs b/src/librustc_data_structures/graph/iterate/mod.rs index 3afdc88d602..c09364b0a53 100644 --- a/src/librustc_data_structures/graph/iterate/mod.rs +++ b/src/librustc_data_structures/graph/iterate/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::super::indexed_vec::IndexVec; use super::{DirectedGraph, WithSuccessors, WithNumNodes}; diff --git a/src/librustc_data_structures/graph/iterate/test.rs b/src/librustc_data_structures/graph/iterate/test.rs index 100881ddfdd..62e48aaec53 100644 --- a/src/librustc_data_structures/graph/iterate/test.rs +++ b/src/librustc_data_structures/graph/iterate/test.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::super::test::TestGraph; use super::*; diff --git a/src/librustc_data_structures/graph/mod.rs b/src/librustc_data_structures/graph/mod.rs index 7265e4e8c7c..3d47b7d49fb 100644 --- a/src/librustc_data_structures/graph/mod.rs +++ b/src/librustc_data_structures/graph/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::indexed_vec::Idx; pub mod dominators; diff --git a/src/librustc_data_structures/graph/reference.rs b/src/librustc_data_structures/graph/reference.rs index a7b763db8da..5ad2a71e1d7 100644 --- a/src/librustc_data_structures/graph/reference.rs +++ b/src/librustc_data_structures/graph/reference.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::*; impl<'graph, G: DirectedGraph> DirectedGraph for &'graph G { diff --git a/src/librustc_data_structures/graph/scc/mod.rs b/src/librustc_data_structures/graph/scc/mod.rs index 64de0c2f565..baab377ef12 100644 --- a/src/librustc_data_structures/graph/scc/mod.rs +++ b/src/librustc_data_structures/graph/scc/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Routine to compute the strongly connected components (SCCs) of a //! graph, as well as the resulting DAG if each SCC is replaced with a //! node in the graph. This uses Tarjan's algorithm that completes in diff --git a/src/librustc_data_structures/graph/scc/test.rs b/src/librustc_data_structures/graph/scc/test.rs index 405e1b3a617..e23cb1348b0 100644 --- a/src/librustc_data_structures/graph/scc/test.rs +++ b/src/librustc_data_structures/graph/scc/test.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![cfg(test)] use graph::test::TestGraph; diff --git a/src/librustc_data_structures/graph/test.rs b/src/librustc_data_structures/graph/test.rs index 26cc2c9f17c..3d482e448bd 100644 --- a/src/librustc_data_structures/graph/test.rs +++ b/src/librustc_data_structures/graph/test.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use fx::FxHashMap; use std::cmp::max; use std::slice; diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs index a59bf9d530c..8d8fbe588a0 100644 --- a/src/librustc_data_structures/indexed_vec.rs +++ b/src/librustc_data_structures/indexed_vec.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Debug; use std::iter::{self, FromIterator}; use std::slice; @@ -98,12 +88,18 @@ macro_rules! newtype_index { @max [$max:expr] @vis [$v:vis] @debug_format [$debug_format:tt]) => ( - #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)] + #[derive(Copy, PartialEq, Eq, Hash, PartialOrd, Ord, $($derives),*)] #[rustc_layout_scalar_valid_range_end($max)] $v struct $type { private: u32 } + impl Clone for $type { + fn clone(&self) -> Self { + *self + } + } + impl $type { $v const MAX_AS_U32: u32 = $max; @@ -145,7 +141,7 @@ macro_rules! newtype_index { #[inline] $v const unsafe fn from_u32_unchecked(value: u32) -> Self { - $type { private: value } + unsafe { $type { private: value } } } /// Extract value of this index as an integer. @@ -328,12 +324,13 @@ macro_rules! newtype_index { derive [$($derives:ident,)+] $($tokens:tt)*) => ( newtype_index!( - @derives [$($derives,)+ RustcDecodable, RustcEncodable,] + @derives [$($derives,)+ RustcEncodable,] @type [$type] @max [$max] @vis [$v] @debug_format [$debug_format] $($tokens)*); + newtype_index!(@decodable $type); ); // The case where no derives are added, but encodable is overridden. Don't @@ -360,12 +357,29 @@ macro_rules! newtype_index { @debug_format [$debug_format:tt] $($tokens:tt)*) => ( newtype_index!( - @derives [RustcDecodable, RustcEncodable,] + @derives [RustcEncodable,] @type [$type] @max [$max] @vis [$v] @debug_format [$debug_format] $($tokens)*); + newtype_index!(@decodable $type); + ); + + (@decodable $type:ident) => ( + impl $type { + fn __decodable__impl__hack() { + mod __more_hacks_because__self_doesnt_work_in_functions { + extern crate serialize; + use self::serialize::{Decodable, Decoder}; + impl Decodable for super::$type { + fn decode(d: &mut D) -> Result { + d.read_u32().map(Self::from) + } + } + } + } + } ); // Rewrite final without comma to one that includes comma diff --git a/src/librustc_data_structures/interner.rs b/src/librustc_data_structures/interner.rs new file mode 100644 index 00000000000..36ccbb704a7 --- /dev/null +++ b/src/librustc_data_structures/interner.rs @@ -0,0 +1,58 @@ +use std::hash::Hash; +use std::hash::BuildHasher; +use std::hash::Hasher; +use std::collections::HashMap; +use std::collections::hash_map::RawEntryMut; +use std::borrow::Borrow; + +pub trait HashInterner { + fn intern_ref K>(&mut self, value: &Q, make: F) -> K + where K: Borrow, + Q: Hash + Eq; + + fn intern K>(&mut self, value: Q, make: F) -> K + where K: Borrow, + Q: Hash + Eq; +} + +impl HashInterner for HashMap { + #[inline] + fn intern_ref K>(&mut self, value: &Q, make: F) -> K + where K: Borrow, + Q: Hash + Eq + { + let mut hasher = self.hasher().build_hasher(); + value.hash(&mut hasher); + let hash = hasher.finish(); + let entry = self.raw_entry_mut().from_key_hashed_nocheck(hash, value); + + match entry { + RawEntryMut::Occupied(e) => *e.key(), + RawEntryMut::Vacant(e) => { + let v = make(); + e.insert_hashed_nocheck(hash, v, ()); + v + } + } + } + + #[inline] + fn intern K>(&mut self, value: Q, make: F) -> K + where K: Borrow, + Q: Hash + Eq + { + let mut hasher = self.hasher().build_hasher(); + value.hash(&mut hasher); + let hash = hasher.finish(); + let entry = self.raw_entry_mut().from_key_hashed_nocheck(hash, &value); + + match entry { + RawEntryMut::Occupied(e) => *e.key(), + RawEntryMut::Vacant(e) => { + let v = make(value); + e.insert_hashed_nocheck(hash, v, ()); + v + } + } + } +} diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index 135abebdacb..ec71f515894 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Various data structures used by the Rust compiler. The intention //! is that code in here should be not be *specific* to rustc, so that //! it can be easily unit tested and so forth. @@ -28,7 +18,10 @@ #![feature(optin_builtin_traits)] #![feature(nll)] #![feature(allow_internal_unstable)] -#![feature(vec_resize_with)] +#![feature(hash_raw_entry)] +#![feature(stmt_expr_attributes)] +#![feature(core_intrinsics)] +#![feature(integer_atomics)] #![cfg_attr(unix, feature(libc))] #![cfg_attr(test, feature(test))] @@ -57,6 +50,26 @@ extern crate rustc_cratesio_shim; pub use rustc_serialize::hex::ToHex; +#[macro_export] +macro_rules! likely { + ($e:expr) => { + #[allow(unused_unsafe)] + { + unsafe { std::intrinsics::likely($e) } + } + } +} + +#[macro_export] +macro_rules! unlikely { + ($e:expr) => { + #[allow(unused_unsafe)] + { + unsafe { std::intrinsics::unlikely($e) } + } + } +} + pub mod macros; pub mod svh; pub mod base_n; @@ -66,6 +79,7 @@ pub mod flock; pub mod fx; pub mod graph; pub mod indexed_vec; +pub mod interner; pub mod obligation_forest; pub mod owning_ref; pub mod ptr_key; @@ -79,7 +93,6 @@ pub mod sync; pub mod tiny_list; pub mod thin_vec; pub mod transitive_relation; -pub mod tuple_slice; pub use ena::unify; pub mod vec_linked_list; pub mod work_queue; @@ -90,12 +103,14 @@ pub struct OnDrop(pub F); impl OnDrop { /// Forgets the function which prevents it from running. /// Ensure that the function owns no memory, otherwise it will be leaked. + #[inline] pub fn disable(self) { std::mem::forget(self); } } impl Drop for OnDrop { + #[inline] fn drop(&mut self) { (self.0)(); } diff --git a/src/librustc_data_structures/macros.rs b/src/librustc_data_structures/macros.rs index 3cc91b0e93f..a661f0c78ab 100644 --- a/src/librustc_data_structures/macros.rs +++ b/src/librustc_data_structures/macros.rs @@ -1,21 +1,12 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// A simple static assertion macro. The first argument should be a unique /// ALL_CAPS identifier that describes the condition. #[macro_export] +#[allow_internal_unstable] macro_rules! static_assert { ($name:ident: $test:expr) => { // Use the bool to access an array such that if the bool is false, the access // is out-of-bounds. #[allow(dead_code)] - static $name: () = [()][!$test as usize]; + static $name: () = [()][!($test: bool) as usize]; } } diff --git a/src/librustc_data_structures/obligation_forest/README.md b/src/librustc_data_structures/obligation_forest/README.md deleted file mode 100644 index 982a2bacce1..00000000000 --- a/src/librustc_data_structures/obligation_forest/README.md +++ /dev/null @@ -1,81 +0,0 @@ -The `ObligationForest` is a utility data structure used in trait -matching to track the set of outstanding obligations (those not yet -resolved to success or error). It also tracks the "backtrace" of each -pending obligation (why we are trying to figure this out in the first -place). - -### External view - -`ObligationForest` supports two main public operations (there are a -few others not discussed here): - -1. Add a new root obligations (`push_tree`). -2. Process the pending obligations (`process_obligations`). - -When a new obligation `N` is added, it becomes the root of an -obligation tree. This tree can also carry some per-tree state `T`, -which is given at the same time. This tree is a singleton to start, so -`N` is both the root and the only leaf. Each time the -`process_obligations` method is called, it will invoke its callback -with every pending obligation (so that will include `N`, the first -time). The callback also receives a (mutable) reference to the -per-tree state `T`. The callback should process the obligation `O` -that it is given and return one of three results: - -- `Ok(None)` -> ambiguous result. Obligation was neither a success - nor a failure. It is assumed that further attempts to process the - obligation will yield the same result unless something in the - surrounding environment changes. -- `Ok(Some(C))` - the obligation was *shallowly successful*. The - vector `C` is a list of subobligations. The meaning of this is that - `O` was successful on the assumption that all the obligations in `C` - are also successful. Therefore, `O` is only considered a "true" - success if `C` is empty. Otherwise, `O` is put into a suspended - state and the obligations in `C` become the new pending - obligations. They will be processed the next time you call - `process_obligations`. -- `Err(E)` -> obligation failed with error `E`. We will collect this - error and return it from `process_obligations`, along with the - "backtrace" of obligations (that is, the list of obligations up to - and including the root of the failed obligation). No further - obligations from that same tree will be processed, since the tree is - now considered to be in error. - -When the call to `process_obligations` completes, you get back an `Outcome`, -which includes three bits of information: - -- `completed`: a list of obligations where processing was fully - completed without error (meaning that all transitive subobligations - have also been completed). So, for example, if the callback from - `process_obligations` returns `Ok(Some(C))` for some obligation `O`, - then `O` will be considered completed right away if `C` is the - empty vector. Otherwise it will only be considered completed once - all the obligations in `C` have been found completed. -- `errors`: a list of errors that occurred and associated backtraces - at the time of error, which can be used to give context to the user. -- `stalled`: if true, then none of the existing obligations were - *shallowly successful* (that is, no callback returned `Ok(Some(_))`). - This implies that all obligations were either errors or returned an - ambiguous result, which means that any further calls to - `process_obligations` would simply yield back further ambiguous - results. This is used by the `FulfillmentContext` to decide when it - has reached a steady state. - -#### Snapshots - -The `ObligationForest` supports a limited form of snapshots; see -`start_snapshot`; `commit_snapshot`; and `rollback_snapshot`. In -particular, you can use a snapshot to roll back new root -obligations. However, it is an error to attempt to -`process_obligations` during a snapshot. - -### Implementation details - -For the most part, comments specific to the implementation are in the -code. This file only contains a very high-level overview. Basically, -the forest is stored in a vector. Each element of the vector is a node -in some tree. Each node in the vector has the index of an (optional) -parent and (for convenience) its root (which may be itself). It also -has a current state, described by `NodeState`. After each -processing step, we compress the vector to remove completed and error -nodes, which aren't needed anymore. diff --git a/src/librustc_data_structures/obligation_forest/graphviz.rs b/src/librustc_data_structures/obligation_forest/graphviz.rs index dcd448ee44f..c2e3938b305 100644 --- a/src/librustc_data_structures/obligation_forest/graphviz.rs +++ b/src/librustc_data_structures/obligation_forest/graphviz.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use graphviz as dot; use obligation_forest::{ForestObligation, ObligationForest}; use std::env::var_os; diff --git a/src/librustc_data_structures/obligation_forest/mod.rs b/src/librustc_data_structures/obligation_forest/mod.rs index c211d888df1..9dd7d204f03 100644 --- a/src/librustc_data_structures/obligation_forest/mod.rs +++ b/src/librustc_data_structures/obligation_forest/mod.rs @@ -1,19 +1,84 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The `ObligationForest` is a utility data structure used in trait -//! matching to track the set of outstanding obligations (those not -//! yet resolved to success or error). It also tracks the "backtrace" -//! of each pending obligation (why we are trying to figure this out -//! in the first place). See README.md for a general overview of how -//! to use this class. +//! matching to track the set of outstanding obligations (those not yet +//! resolved to success or error). It also tracks the "backtrace" of each +//! pending obligation (why we are trying to figure this out in the first +//! place). +//! +//! ### External view +//! +//! `ObligationForest` supports two main public operations (there are a +//! few others not discussed here): +//! +//! 1. Add a new root obligations (`push_tree`). +//! 2. Process the pending obligations (`process_obligations`). +//! +//! When a new obligation `N` is added, it becomes the root of an +//! obligation tree. This tree can also carry some per-tree state `T`, +//! which is given at the same time. This tree is a singleton to start, so +//! `N` is both the root and the only leaf. Each time the +//! `process_obligations` method is called, it will invoke its callback +//! with every pending obligation (so that will include `N`, the first +//! time). The callback also receives a (mutable) reference to the +//! per-tree state `T`. The callback should process the obligation `O` +//! that it is given and return one of three results: +//! +//! - `Ok(None)` -> ambiguous result. Obligation was neither a success +//! nor a failure. It is assumed that further attempts to process the +//! obligation will yield the same result unless something in the +//! surrounding environment changes. +//! - `Ok(Some(C))` - the obligation was *shallowly successful*. The +//! vector `C` is a list of subobligations. The meaning of this is that +//! `O` was successful on the assumption that all the obligations in `C` +//! are also successful. Therefore, `O` is only considered a "true" +//! success if `C` is empty. Otherwise, `O` is put into a suspended +//! state and the obligations in `C` become the new pending +//! obligations. They will be processed the next time you call +//! `process_obligations`. +//! - `Err(E)` -> obligation failed with error `E`. We will collect this +//! error and return it from `process_obligations`, along with the +//! "backtrace" of obligations (that is, the list of obligations up to +//! and including the root of the failed obligation). No further +//! obligations from that same tree will be processed, since the tree is +//! now considered to be in error. +//! +//! When the call to `process_obligations` completes, you get back an `Outcome`, +//! which includes three bits of information: +//! +//! - `completed`: a list of obligations where processing was fully +//! completed without error (meaning that all transitive subobligations +//! have also been completed). So, for example, if the callback from +//! `process_obligations` returns `Ok(Some(C))` for some obligation `O`, +//! then `O` will be considered completed right away if `C` is the +//! empty vector. Otherwise it will only be considered completed once +//! all the obligations in `C` have been found completed. +//! - `errors`: a list of errors that occurred and associated backtraces +//! at the time of error, which can be used to give context to the user. +//! - `stalled`: if true, then none of the existing obligations were +//! *shallowly successful* (that is, no callback returned `Ok(Some(_))`). +//! This implies that all obligations were either errors or returned an +//! ambiguous result, which means that any further calls to +//! `process_obligations` would simply yield back further ambiguous +//! results. This is used by the `FulfillmentContext` to decide when it +//! has reached a steady state. +//! +//! #### Snapshots +//! +//! The `ObligationForest` supports a limited form of snapshots; see +//! `start_snapshot`; `commit_snapshot`; and `rollback_snapshot`. In +//! particular, you can use a snapshot to roll back new root +//! obligations. However, it is an error to attempt to +//! `process_obligations` during a snapshot. +//! +//! ### Implementation details +//! +//! For the most part, comments specific to the implementation are in the +//! code. This file only contains a very high-level overview. Basically, +//! the forest is stored in a vector. Each element of the vector is a node +//! in some tree. Each node in the vector has the index of an (optional) +//! parent and (for convenience) its root (which may be itself). It also +//! has a current state, described by `NodeState`. After each +//! processing step, we compress the vector to remove completed and error +//! nodes, which aren't needed anymore. use fx::{FxHashMap, FxHashSet}; @@ -531,7 +596,7 @@ impl ObligationForest { /// indices. Cannot be used during a transaction. /// /// Beforehand, all nodes must be marked as `Done` and no cycles - /// on these nodes may be present. This is done by e.g. `process_cycles`. + /// on these nodes may be present. This is done by e.g., `process_cycles`. #[inline(never)] fn compress(&mut self, do_completed: DoCompleted) -> Option> { let nodes_len = self.nodes.len(); diff --git a/src/librustc_data_structures/obligation_forest/node_index.rs b/src/librustc_data_structures/obligation_forest/node_index.rs index d89bd22ec96..69ea473e054 100644 --- a/src/librustc_data_structures/obligation_forest/node_index.rs +++ b/src/librustc_data_structures/obligation_forest/node_index.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::num::NonZeroU32; use std::u32; diff --git a/src/librustc_data_structures/obligation_forest/test.rs b/src/librustc_data_structures/obligation_forest/test.rs index 2a418973fbd..27d4bf4959e 100644 --- a/src/librustc_data_structures/obligation_forest/test.rs +++ b/src/librustc_data_structures/obligation_forest/test.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![cfg(test)] use super::{Error, DoCompleted, ObligationForest, ObligationProcessor, Outcome, ProcessResult}; diff --git a/src/librustc_data_structures/owning_ref/mod.rs b/src/librustc_data_structures/owning_ref/mod.rs index 27c2f8b718a..0b126e5c572 100644 --- a/src/librustc_data_structures/owning_ref/mod.rs +++ b/src/librustc_data_structures/owning_ref/mod.rs @@ -215,7 +215,7 @@ fn main() { ## Mutable reference When the owned container implements `DerefMut`, it is also possible to make -a _mutable owning reference_. (E.g. with `Box`, `RefMut`, `MutexGuard`) +a _mutable owning reference_. (e.g., with `Box`, `RefMut`, `MutexGuard`) ``` extern crate owning_ref; @@ -452,7 +452,7 @@ impl OwningRef { /// use owning_ref::{OwningRef, Erased}; /// /// fn main() { - /// // NB: Using the concrete types here for explicitness. + /// // N.B., using the concrete types here for explicitness. /// // For less verbose code type aliases like `BoxRef` are provided. /// /// let owning_ref_a: OwningRef, [i32; 4]> @@ -722,7 +722,7 @@ impl OwningRefMut { /// use owning_ref::{OwningRefMut, Erased}; /// /// fn main() { - /// // NB: Using the concrete types here for explicitness. + /// // N.B., using the concrete types here for explicitness. /// // For less verbose code type aliases like `BoxRef` are provided. /// /// let owning_ref_mut_a: OwningRefMut, [i32; 4]> @@ -1124,8 +1124,8 @@ impl ToHandleMut for RefCell { unsafe fn to_handle_mut(x: *const Self) -> Self::HandleMut { (*x).borrow_mut() } } -// NB: Implementing ToHandle{,Mut} for Mutex and RwLock requires a decision -// about which handle creation to use (i.e. read() vs try_read()) as well as +// N.B., implementing ToHandle{,Mut} for Mutex and RwLock requires a decision +// about which handle creation to use (i.e., read() vs try_read()) as well as // what to do with error results. /// Typedef of a owning reference that uses a `Box` as the owner. diff --git a/src/librustc_data_structures/ptr_key.rs b/src/librustc_data_structures/ptr_key.rs index 6835dab38df..322dcbe8f08 100644 --- a/src/librustc_data_structures/ptr_key.rs +++ b/src/librustc_data_structures/ptr_key.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::{hash, ptr}; use std::ops::Deref; diff --git a/src/librustc_data_structures/sip128.rs b/src/librustc_data_structures/sip128.rs index 1f0b0d9cbfb..9ec9a398400 100644 --- a/src/librustc_data_structures/sip128.rs +++ b/src/librustc_data_structures/sip128.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This is a copy of `core::hash::sip` adapted to providing 128 bit hashes. use std::cmp; diff --git a/src/librustc_data_structures/small_c_str.rs b/src/librustc_data_structures/small_c_str.rs index 08794fbec8d..bde7911267f 100644 --- a/src/librustc_data_structures/small_c_str.rs +++ b/src/librustc_data_structures/small_c_str.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ffi; use std::ops::Deref; diff --git a/src/librustc_data_structures/snapshot_map/mod.rs b/src/librustc_data_structures/snapshot_map/mod.rs index 0b42cb1eddd..d408727aea5 100644 --- a/src/librustc_data_structures/snapshot_map/mod.rs +++ b/src/librustc_data_structures/snapshot_map/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use fx::FxHashMap; use std::hash::Hash; use std::ops; @@ -21,6 +11,7 @@ pub struct SnapshotMap { map: FxHashMap, undo_log: Vec>, + num_open_snapshots: usize, } // HACK(eddyb) manual impl avoids `Default` bounds on `K` and `V`. @@ -31,6 +22,7 @@ impl Default for SnapshotMap SnapshotMap { map: Default::default(), undo_log: Default::default(), + num_open_snapshots: 0, } } } @@ -40,11 +32,9 @@ pub struct Snapshot { } enum UndoLog { - OpenSnapshot, - CommittedSnapshot, Inserted(K), Overwrite(K, V), - Noop, + Purged, } impl SnapshotMap @@ -53,18 +43,23 @@ impl SnapshotMap pub fn clear(&mut self) { self.map.clear(); self.undo_log.clear(); + self.num_open_snapshots = 0; + } + + fn in_snapshot(&self) -> bool { + self.num_open_snapshots > 0 } pub fn insert(&mut self, key: K, value: V) -> bool { match self.map.insert(key.clone(), value) { None => { - if !self.undo_log.is_empty() { + if self.in_snapshot() { self.undo_log.push(UndoLog::Inserted(key)); } true } Some(old_value) => { - if !self.undo_log.is_empty() { + if self.in_snapshot() { self.undo_log.push(UndoLog::Overwrite(key, old_value)); } false @@ -72,16 +67,10 @@ impl SnapshotMap } } - pub fn insert_noop(&mut self) { - if !self.undo_log.is_empty() { - self.undo_log.push(UndoLog::Noop); - } - } - pub fn remove(&mut self, key: K) -> bool { match self.map.remove(&key) { Some(old_value) => { - if !self.undo_log.is_empty() { + if self.in_snapshot() { self.undo_log.push(UndoLog::Overwrite(key, old_value)); } true @@ -95,27 +84,27 @@ impl SnapshotMap } pub fn snapshot(&mut self) -> Snapshot { - self.undo_log.push(UndoLog::OpenSnapshot); - let len = self.undo_log.len() - 1; + let len = self.undo_log.len(); + self.num_open_snapshots += 1; Snapshot { len } } fn assert_open_snapshot(&self, snapshot: &Snapshot) { - assert!(snapshot.len < self.undo_log.len()); - assert!(match self.undo_log[snapshot.len] { - UndoLog::OpenSnapshot => true, - _ => false, - }); + assert!(self.undo_log.len() >= snapshot.len); + assert!(self.num_open_snapshots > 0); } - pub fn commit(&mut self, snapshot: &Snapshot) { - self.assert_open_snapshot(snapshot); - if snapshot.len == 0 { - // The root snapshot. - self.undo_log.truncate(0); - } else { - self.undo_log[snapshot.len] = UndoLog::CommittedSnapshot; + pub fn commit(&mut self, snapshot: Snapshot) { + self.assert_open_snapshot(&snapshot); + if self.num_open_snapshots == 1 { + // The root snapshot. It's safe to clear the undo log because + // there's no snapshot further out that we might need to roll back + // to. + assert!(snapshot.len == 0); + self.undo_log.clear(); } + + self.num_open_snapshots -= 1; } pub fn partial_rollback(&mut self, @@ -124,45 +113,32 @@ impl SnapshotMap where F: Fn(&K) -> bool { self.assert_open_snapshot(snapshot); - for i in (snapshot.len + 1..self.undo_log.len()).rev() { + for i in (snapshot.len .. self.undo_log.len()).rev() { let reverse = match self.undo_log[i] { - UndoLog::OpenSnapshot => false, - UndoLog::CommittedSnapshot => false, - UndoLog::Noop => false, + UndoLog::Purged => false, UndoLog::Inserted(ref k) => should_revert_key(k), UndoLog::Overwrite(ref k, _) => should_revert_key(k), }; if reverse { - let entry = mem::replace(&mut self.undo_log[i], UndoLog::Noop); + let entry = mem::replace(&mut self.undo_log[i], UndoLog::Purged); self.reverse(entry); } } } - pub fn rollback_to(&mut self, snapshot: &Snapshot) { - self.assert_open_snapshot(snapshot); - while self.undo_log.len() > snapshot.len + 1 { + pub fn rollback_to(&mut self, snapshot: Snapshot) { + self.assert_open_snapshot(&snapshot); + while self.undo_log.len() > snapshot.len { let entry = self.undo_log.pop().unwrap(); self.reverse(entry); } - let v = self.undo_log.pop().unwrap(); - assert!(match v { - UndoLog::OpenSnapshot => true, - _ => false, - }); - assert!(self.undo_log.len() == snapshot.len); + self.num_open_snapshots -= 1; } fn reverse(&mut self, entry: UndoLog) { match entry { - UndoLog::OpenSnapshot => { - panic!("cannot rollback an uncommitted snapshot"); - } - - UndoLog::CommittedSnapshot => {} - UndoLog::Inserted(key) => { self.map.remove(&key); } @@ -171,7 +147,7 @@ impl SnapshotMap self.map.insert(key, old_value); } - UndoLog::Noop => {} + UndoLog::Purged => {} } } } diff --git a/src/librustc_data_structures/snapshot_map/test.rs b/src/librustc_data_structures/snapshot_map/test.rs index 700f9c95e3b..72ca53c2be9 100644 --- a/src/librustc_data_structures/snapshot_map/test.rs +++ b/src/librustc_data_structures/snapshot_map/test.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::SnapshotMap; #[test] @@ -17,10 +7,10 @@ fn basic() { let snapshot = map.snapshot(); map.insert(22, "thirty-three"); assert_eq!(map[&22], "thirty-three"); - map.insert(44, "fourty-four"); - assert_eq!(map[&44], "fourty-four"); + map.insert(44, "forty-four"); + assert_eq!(map[&44], "forty-four"); assert_eq!(map.get(&33), None); - map.rollback_to(&snapshot); + map.rollback_to(snapshot); assert_eq!(map[&22], "twenty-two"); assert_eq!(map.get(&33), None); assert_eq!(map.get(&44), None); @@ -32,8 +22,11 @@ fn out_of_order() { let mut map = SnapshotMap::default(); map.insert(22, "twenty-two"); let snapshot1 = map.snapshot(); - let _snapshot2 = map.snapshot(); - map.rollback_to(&snapshot1); + map.insert(33, "thirty-three"); + let snapshot2 = map.snapshot(); + map.insert(44, "forty-four"); + map.rollback_to(snapshot1); // bogus, but accepted + map.rollback_to(snapshot2); // asserts } #[test] @@ -43,8 +36,8 @@ fn nested_commit_then_rollback() { let snapshot1 = map.snapshot(); let snapshot2 = map.snapshot(); map.insert(22, "thirty-three"); - map.commit(&snapshot2); + map.commit(snapshot2); assert_eq!(map[&22], "thirty-three"); - map.rollback_to(&snapshot1); + map.rollback_to(snapshot1); assert_eq!(map[&22], "twenty-two"); } diff --git a/src/librustc_data_structures/sorted_map.rs b/src/librustc_data_structures/sorted_map.rs index 29d99a6aef3..64bbb8d7c08 100644 --- a/src/librustc_data_structures/sorted_map.rs +++ b/src/librustc_data_structures/sorted_map.rs @@ -1,16 +1,6 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::borrow::Borrow; use std::cmp::Ordering; -use std::convert::From; +use std::iter::FromIterator; use std::mem; use std::ops::{RangeBounds, Bound, Index, IndexMut}; @@ -25,11 +15,10 @@ use std::ops::{RangeBounds, Bound, Index, IndexMut}; #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default, Debug, RustcEncodable, RustcDecodable)] pub struct SortedMap { - data: Vec<(K,V)> + data: Vec<(K, V)> } impl SortedMap { - #[inline] pub fn new() -> SortedMap { SortedMap { @@ -82,7 +71,10 @@ impl SortedMap { } #[inline] - pub fn get(&self, key: &K) -> Option<&V> { + pub fn get(&self, key: &Q) -> Option<&V> + where K: Borrow, + Q: Ord + ?Sized + { match self.lookup_index_for(key) { Ok(index) => { unsafe { @@ -96,7 +88,10 @@ impl SortedMap { } #[inline] - pub fn get_mut(&mut self, key: &K) -> Option<&mut V> { + pub fn get_mut(&mut self, key: &Q) -> Option<&mut V> + where K: Borrow, + Q: Ord + ?Sized + { match self.lookup_index_for(key) { Ok(index) => { unsafe { @@ -122,13 +117,13 @@ impl SortedMap { /// Iterate over the keys, sorted #[inline] - pub fn keys(&self) -> impl Iterator + ExactSizeIterator { + pub fn keys(&self) -> impl Iterator + ExactSizeIterator { self.data.iter().map(|&(ref k, _)| k) } /// Iterate over values, sorted by key #[inline] - pub fn values(&self) -> impl Iterator + ExactSizeIterator { + pub fn values(&self) -> impl Iterator + ExactSizeIterator { self.data.iter().map(|&(_, ref v)| v) } @@ -137,6 +132,11 @@ impl SortedMap { self.data.len() } + #[inline] + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + #[inline] pub fn range(&self, range: R) -> &[(K, V)] where R: RangeBounds @@ -207,8 +207,11 @@ impl SortedMap { /// Looks up the key in `self.data` via `slice::binary_search()`. #[inline(always)] - fn lookup_index_for(&self, key: &K) -> Result { - self.data.binary_search_by(|&(ref x, _)| x.cmp(key)) + fn lookup_index_for(&self, key: &Q) -> Result + where K: Borrow, + Q: Ord + ?Sized + { + self.data.binary_search_by(|&(ref x, _)| x.borrow().cmp(key)) } #[inline] @@ -247,38 +250,54 @@ impl SortedMap { (start, end) } + + #[inline] + pub fn contains_key(&self, key: &Q) -> bool + where K: Borrow, + Q: Ord + ?Sized + { + self.get(key).is_some() + } } impl IntoIterator for SortedMap { type Item = (K, V); type IntoIter = ::std::vec::IntoIter<(K, V)>; + fn into_iter(self) -> Self::IntoIter { self.data.into_iter() } } -impl> Index for SortedMap { +impl<'a, K, Q, V> Index<&'a Q> for SortedMap + where K: Ord + Borrow, + Q: Ord + ?Sized +{ type Output = V; - fn index(&self, index: Q) -> &Self::Output { - let k: &K = index.borrow(); - self.get(k).unwrap() + + fn index(&self, key: &Q) -> &Self::Output { + self.get(key).expect("no entry found for key") } } -impl> IndexMut for SortedMap { - fn index_mut(&mut self, index: Q) -> &mut Self::Output { - let k: &K = index.borrow(); - self.get_mut(k).unwrap() +impl<'a, K, Q, V> IndexMut<&'a Q> for SortedMap + where K: Ord + Borrow, + Q: Ord + ?Sized +{ + fn index_mut(&mut self, key: &Q) -> &mut Self::Output { + self.get_mut(key).expect("no entry found for key") } } -impl> From for SortedMap { - fn from(data: I) -> Self { - let mut data: Vec<(K, V)> = data.collect(); +impl FromIterator<(K, V)> for SortedMap { + fn from_iter>(iter: T) -> Self { + let mut data: Vec<(K, V)> = iter.into_iter().collect(); + data.sort_unstable_by(|&(ref k1, _), &(ref k2, _)| k1.cmp(k2)); data.dedup_by(|&mut (ref k1, _), &mut (ref k2, _)| { k1.cmp(k2) == Ordering::Equal }); + SortedMap { data } diff --git a/src/librustc_data_structures/stable_hasher.rs b/src/librustc_data_structures/stable_hasher.rs index c85d771a181..4583f12ec8c 100644 --- a/src/librustc_data_structures/stable_hasher.rs +++ b/src/librustc_data_structures/stable_hasher.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::hash::{Hash, Hasher, BuildHasher}; use std::marker::PhantomData; use std::mem; diff --git a/src/librustc_data_structures/svh.rs b/src/librustc_data_structures/svh.rs index 3d17824608c..74947953497 100644 --- a/src/librustc_data_structures/svh.rs +++ b/src/librustc_data_structures/svh.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Calculation and management of a Strict Version Hash for crates //! //! The SVH is used for incremental compilation to track when HIR diff --git a/src/librustc_data_structures/sync.rs b/src/librustc_data_structures/sync.rs index 6a4012c8198..cae3087fe58 100644 --- a/src/librustc_data_structures/sync.rs +++ b/src/librustc_data_structures/sync.rs @@ -1,43 +1,25 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! This module defines types which are thread safe if cfg!(parallel_queries) is true. +//! This module defines types which are thread safe if cfg!(parallel_compiler) is true. //! //! `Lrc` is an alias of either Rc or Arc. //! //! `Lock` is a mutex. -//! It internally uses `parking_lot::Mutex` if cfg!(parallel_queries) is true, +//! It internally uses `parking_lot::Mutex` if cfg!(parallel_compiler) is true, //! `RefCell` otherwise. //! //! `RwLock` is a read-write lock. -//! It internally uses `parking_lot::RwLock` if cfg!(parallel_queries) is true, +//! It internally uses `parking_lot::RwLock` if cfg!(parallel_compiler) is true, //! `RefCell` otherwise. //! -//! `LockCell` is a thread safe version of `Cell`, with `set` and `get` operations. -//! It can never deadlock. It uses `Cell` when -//! cfg!(parallel_queries) is false, otherwise it is a `Lock`. +//! `MTLock` is a mutex which disappears if cfg!(parallel_compiler) is false. //! -//! `MTLock` is a mutex which disappears if cfg!(parallel_queries) is false. -//! -//! `MTRef` is a immutable reference if cfg!(parallel_queries), and an mutable reference otherwise. +//! `MTRef` is a immutable reference if cfg!(parallel_compiler), and an mutable reference otherwise. //! //! `rustc_erase_owner!` erases a OwningRef owner into Erased or Erased + Send + Sync -//! depending on the value of cfg!(parallel_queries). +//! depending on the value of cfg!(parallel_compiler). use std::collections::HashMap; use std::hash::{Hash, BuildHasher}; -use std::cmp::Ordering; use std::marker::PhantomData; -use std::fmt::Debug; -use std::fmt::Formatter; -use std::fmt; use std::ops::{Deref, DerefMut}; use owning_ref::{Erased, OwningRef}; @@ -64,8 +46,11 @@ pub fn serial_scope(f: F) -> R f(&SerialScope) } +pub use std::sync::atomic::Ordering::SeqCst; +pub use std::sync::atomic::Ordering; + cfg_if! { - if #[cfg(not(parallel_queries))] { + if #[cfg(not(parallel_compiler))] { pub auto trait Send {} pub auto trait Sync {} @@ -79,6 +64,66 @@ cfg_if! { } } + use std::ops::Add; + + #[derive(Debug)] + pub struct Atomic(Cell); + + impl Atomic { + #[inline] + pub fn new(v: T) -> Self { + Atomic(Cell::new(v)) + } + } + + impl Atomic { + pub fn into_inner(self) -> T { + self.0.into_inner() + } + + #[inline] + pub fn load(&self, _: Ordering) -> T { + self.0.get() + } + + #[inline] + pub fn store(&self, val: T, _: Ordering) { + self.0.set(val) + } + + pub fn swap(&self, val: T, _: Ordering) -> T { + self.0.replace(val) + } + + pub fn compare_exchange(&self, + current: T, + new: T, + _: Ordering, + _: Ordering) + -> Result { + let read = self.0.get(); + if read == current { + self.0.set(new); + Ok(read) + } else { + Err(read) + } + } + } + + impl + Copy> Atomic { + pub fn fetch_add(&self, val: T, _: Ordering) -> T { + let old = self.0.get(); + self.0.set(old + val); + old + } + } + + pub type AtomicUsize = Atomic; + pub type AtomicBool = Atomic; + pub type AtomicU32 = Atomic; + pub type AtomicU64 = Atomic; + pub use self::serial_join as join; pub use self::serial_scope as scope; @@ -170,47 +215,6 @@ cfg_if! { MTLock(self.0.clone()) } } - - pub struct LockCell(Cell); - - impl LockCell { - #[inline(always)] - pub fn new(inner: T) -> Self { - LockCell(Cell::new(inner)) - } - - #[inline(always)] - pub fn into_inner(self) -> T { - self.0.into_inner() - } - - #[inline(always)] - pub fn set(&self, new_inner: T) { - self.0.set(new_inner); - } - - #[inline(always)] - pub fn get(&self) -> T where T: Copy { - self.0.get() - } - - #[inline(always)] - pub fn set_mut(&mut self, new_inner: T) { - self.0.set(new_inner); - } - - #[inline(always)] - pub fn get_mut(&mut self) -> T where T: Copy { - self.0.get() - } - } - - impl LockCell> { - #[inline(always)] - pub fn take(&self) -> Option { - unsafe { (*self.0.as_ptr()).take() } - } - } } else { pub use std::marker::Send as Send; pub use std::marker::Sync as Sync; @@ -223,6 +227,8 @@ cfg_if! { pub use parking_lot::MutexGuard as LockGuard; pub use parking_lot::MappedMutexGuard as MappedLockGuard; + pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32, AtomicU64}; + pub use std::sync::Arc as Lrc; pub use std::sync::Weak as Weak; @@ -288,51 +294,11 @@ cfg_if! { v.erase_send_sync_owner() }} } - - pub struct LockCell(Lock); - - impl LockCell { - #[inline(always)] - pub fn new(inner: T) -> Self { - LockCell(Lock::new(inner)) - } - - #[inline(always)] - pub fn into_inner(self) -> T { - self.0.into_inner() - } - - #[inline(always)] - pub fn set(&self, new_inner: T) { - *self.0.lock() = new_inner; - } - - #[inline(always)] - pub fn get(&self) -> T where T: Copy { - *self.0.lock() - } - - #[inline(always)] - pub fn set_mut(&mut self, new_inner: T) { - *self.0.get_mut() = new_inner; - } - - #[inline(always)] - pub fn get_mut(&mut self) -> T where T: Copy { - *self.0.get_mut() - } - } - - impl LockCell> { - #[inline(always)] - pub fn take(&self) -> Option { - self.0.lock().take() - } - } } } pub fn assert_sync() {} +pub fn assert_send() {} pub fn assert_send_val(_t: &T) {} pub fn assert_send_sync_val(_t: &T) {} @@ -476,65 +442,6 @@ impl Once { } } -impl Debug for LockCell { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { - f.debug_struct("LockCell") - .field("value", &self.get()) - .finish() - } -} - -impl Default for LockCell { - /// Creates a `LockCell`, with the `Default` value for T. - #[inline] - fn default() -> LockCell { - LockCell::new(Default::default()) - } -} - -impl PartialEq for LockCell { - #[inline] - fn eq(&self, other: &LockCell) -> bool { - self.get() == other.get() - } -} - -impl Eq for LockCell {} - -impl PartialOrd for LockCell { - #[inline] - fn partial_cmp(&self, other: &LockCell) -> Option { - self.get().partial_cmp(&other.get()) - } - - #[inline] - fn lt(&self, other: &LockCell) -> bool { - self.get() < other.get() - } - - #[inline] - fn le(&self, other: &LockCell) -> bool { - self.get() <= other.get() - } - - #[inline] - fn gt(&self, other: &LockCell) -> bool { - self.get() > other.get() - } - - #[inline] - fn ge(&self, other: &LockCell) -> bool { - self.get() >= other.get() - } -} - -impl Ord for LockCell { - #[inline] - fn cmp(&self, other: &LockCell) -> Ordering { - self.get().cmp(&other.get()) - } -} - #[derive(Debug)] pub struct Lock(InnerLock); @@ -554,19 +461,19 @@ impl Lock { self.0.get_mut() } - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] #[inline(always)] pub fn try_lock(&self) -> Option> { self.0.try_lock() } - #[cfg(not(parallel_queries))] + #[cfg(not(parallel_compiler))] #[inline(always)] pub fn try_lock(&self) -> Option> { self.0.try_borrow_mut().ok() } - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] #[inline(always)] pub fn lock(&self) -> LockGuard { if ERROR_CHECKING { @@ -576,7 +483,7 @@ impl Lock { } } - #[cfg(not(parallel_queries))] + #[cfg(not(parallel_compiler))] #[inline(always)] pub fn lock(&self) -> LockGuard { self.0.borrow_mut() @@ -632,13 +539,13 @@ impl RwLock { self.0.get_mut() } - #[cfg(not(parallel_queries))] + #[cfg(not(parallel_compiler))] #[inline(always)] pub fn read(&self) -> ReadGuard { self.0.borrow() } - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] #[inline(always)] pub fn read(&self) -> ReadGuard { if ERROR_CHECKING { @@ -653,25 +560,25 @@ impl RwLock { f(&*self.read()) } - #[cfg(not(parallel_queries))] + #[cfg(not(parallel_compiler))] #[inline(always)] pub fn try_write(&self) -> Result, ()> { self.0.try_borrow_mut().map_err(|_| ()) } - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] #[inline(always)] pub fn try_write(&self) -> Result, ()> { self.0.try_write().ok_or(()) } - #[cfg(not(parallel_queries))] + #[cfg(not(parallel_compiler))] #[inline(always)] pub fn write(&self) -> WriteGuard { self.0.borrow_mut() } - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] #[inline(always)] pub fn write(&self) -> WriteGuard { if ERROR_CHECKING { @@ -709,27 +616,27 @@ impl Clone for RwLock { /// It will panic if it is used on multiple threads. #[derive(Copy, Clone, Hash, Debug, Eq, PartialEq)] pub struct OneThread { - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] thread: thread::ThreadId, inner: T, } -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] unsafe impl std::marker::Sync for OneThread {} -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] unsafe impl std::marker::Send for OneThread {} impl OneThread { #[inline(always)] fn check(&self) { - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] assert_eq!(thread::current().id(), self.thread); } #[inline(always)] pub fn new(inner: T) -> Self { OneThread { - #[cfg(parallel_queries)] + #[cfg(parallel_compiler)] thread: thread::current().id(), inner, } diff --git a/src/librustc_data_structures/thin_vec.rs b/src/librustc_data_structures/thin_vec.rs index 546686b46b8..359f9b7842d 100644 --- a/src/librustc_data_structures/thin_vec.rs +++ b/src/librustc_data_structures/thin_vec.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -/// A vector type optimized for cases where this size is usually 0 (c.f. `SmallVector`). +/// A vector type optimized for cases where this size is usually 0 (cf. `SmallVector`). /// The `Option>` wrapping allows us to represent a zero sized vector with `None`, /// which uses only a single (null) pointer. #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] diff --git a/src/librustc_data_structures/tiny_list.rs b/src/librustc_data_structures/tiny_list.rs index 9dbf0ea9f43..d660486d584 100644 --- a/src/librustc_data_structures/tiny_list.rs +++ b/src/librustc_data_structures/tiny_list.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - //! A singly-linked list. //! //! Using this data structure only makes sense under very specific diff --git a/src/librustc_data_structures/transitive_relation.rs b/src/librustc_data_structures/transitive_relation.rs index fd5dfab9e61..9d675ed3096 100644 --- a/src/librustc_data_structures/transitive_relation.rs +++ b/src/librustc_data_structures/transitive_relation.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use bit_set::BitMatrix; use fx::FxHashMap; use sync::Lock; @@ -304,7 +294,7 @@ impl TransitiveRelation { /// /// The intuition is that this moves "one step up" through a lattice /// (where the relation is encoding the `<=` relation for the lattice). - /// So e.g. if the relation is `->` and we have + /// So e.g., if the relation is `->` and we have /// /// ``` /// a -> b -> d -> f diff --git a/src/librustc_data_structures/tuple_slice.rs b/src/librustc_data_structures/tuple_slice.rs deleted file mode 100644 index b7c71dd3664..00000000000 --- a/src/librustc_data_structures/tuple_slice.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::slice; - -/// Allows to view uniform tuples as slices -pub trait TupleSlice { - fn as_slice(&self) -> &[T]; - fn as_mut_slice(&mut self) -> &mut [T]; -} - -macro_rules! impl_tuple_slice { - ($tuple_type:ty, $size:expr) => { - impl TupleSlice for $tuple_type { - fn as_slice(&self) -> &[T] { - unsafe { - let ptr = &self.0 as *const T; - slice::from_raw_parts(ptr, $size) - } - } - - fn as_mut_slice(&mut self) -> &mut [T] { - unsafe { - let ptr = &mut self.0 as *mut T; - slice::from_raw_parts_mut(ptr, $size) - } - } - } - } -} - -impl_tuple_slice!((T, T), 2); -impl_tuple_slice!((T, T, T), 3); -impl_tuple_slice!((T, T, T, T), 4); -impl_tuple_slice!((T, T, T, T, T), 5); -impl_tuple_slice!((T, T, T, T, T, T), 6); -impl_tuple_slice!((T, T, T, T, T, T, T), 7); -impl_tuple_slice!((T, T, T, T, T, T, T, T), 8); - -#[test] -fn test_sliced_tuples() { - let t2 = (100, 101); - assert_eq!(t2.as_slice(), &[100, 101]); - - let t3 = (102, 103, 104); - assert_eq!(t3.as_slice(), &[102, 103, 104]); - - let t4 = (105, 106, 107, 108); - assert_eq!(t4.as_slice(), &[105, 106, 107, 108]); - - let t5 = (109, 110, 111, 112, 113); - assert_eq!(t5.as_slice(), &[109, 110, 111, 112, 113]); - - let t6 = (114, 115, 116, 117, 118, 119); - assert_eq!(t6.as_slice(), &[114, 115, 116, 117, 118, 119]); - - let t7 = (120, 121, 122, 123, 124, 125, 126); - assert_eq!(t7.as_slice(), &[120, 121, 122, 123, 124, 125, 126]); - - let t8 = (127, 128, 129, 130, 131, 132, 133, 134); - assert_eq!(t8.as_slice(), &[127, 128, 129, 130, 131, 132, 133, 134]); - -} diff --git a/src/librustc_data_structures/vec_linked_list.rs b/src/librustc_data_structures/vec_linked_list.rs index 390dca6b905..3b6984dd075 100644 --- a/src/librustc_data_structures/vec_linked_list.rs +++ b/src/librustc_data_structures/vec_linked_list.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use indexed_vec::{Idx, IndexVec}; pub fn iter( diff --git a/src/librustc_data_structures/work_queue.rs b/src/librustc_data_structures/work_queue.rs index eff80a98c9d..0a928de7961 100644 --- a/src/librustc_data_structures/work_queue.rs +++ b/src/librustc_data_structures/work_queue.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use bit_set::BitSet; use indexed_vec::Idx; use std::collections::VecDeque; diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index 4462e59dada..713492c7f34 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -37,11 +37,6 @@ rustc_yk_sections = { path = "../librustc_yk_sections" } rustc_yk_link = { path = "../librustc_yk_link" } serialize = { path = "../libserialize" } syntax = { path = "../libsyntax" } -smallvec = { version = "0.6.5", features = ["union"] } +smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } syntax_ext = { path = "../libsyntax_ext" } syntax_pos = { path = "../libsyntax_pos" } - -[dependencies.jemalloc-sys] -version = '0.1.8' -optional = true -features = ['unprefixed_malloc_on_supported_platforms'] diff --git a/src/librustc_driver/README.md b/src/librustc_driver/README.md index fef249a9e4e..c4d73953e9b 100644 --- a/src/librustc_driver/README.md +++ b/src/librustc_driver/README.md @@ -7,4 +7,4 @@ options). For more information about how the driver works, see the [rustc guide]. -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/rustc-driver.html +[rustc guide]: https://rust-lang.github.io/rustc-guide/rustc-driver.html diff --git a/src/librustc_driver/build.rs b/src/librustc_driver/build.rs index 9844f3b557a..414d13445f0 100644 --- a/src/librustc_driver/build.rs +++ b/src/librustc_driver/build.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-env-changed=CFG_RELEASE"); diff --git a/src/librustc_driver/derive_registrar.rs b/src/librustc_driver/derive_registrar.rs deleted file mode 100644 index 9983efce6af..00000000000 --- a/src/librustc_driver/derive_registrar.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::map::Map; -use rustc::hir; -use syntax::ast; -use syntax::attr; - -pub fn find(hir_map: &Map) -> Option { - let krate = hir_map.krate(); - - let mut finder = Finder { registrar: None }; - krate.visit_all_item_likes(&mut finder); - finder.registrar -} - -struct Finder { - registrar: Option, -} - -impl<'v> ItemLikeVisitor<'v> for Finder { - fn visit_item(&mut self, item: &hir::Item) { - if attr::contains_name(&item.attrs, "rustc_derive_registrar") { - self.registrar = Some(item.id); - } - } - - fn visit_trait_item(&mut self, _trait_item: &hir::TraitItem) { - } - - fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) { - } -} - diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 66aae67c228..ca12c693675 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -1,49 +1,51 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::dep_graph::DepGraph; -use rustc::hir::{self, map as hir_map}; +use rustc::hir; use rustc::hir::lowering::lower_crate; -use rustc::hir::def_id::LOCAL_CRATE; -use rustc_data_structures::fingerprint::Fingerprint; -use rustc_data_structures::stable_hasher::StableHasher; -use rustc_mir as mir; -use rustc::session::{CompileResult, CrateDisambiguator, Session}; -use rustc::session::CompileIncomplete; -use rustc::session::config::{self, Input, OutputFilenames, OutputType}; -use rustc::session::search_paths::PathKind; +use rustc::hir::map as hir_map; use rustc::lint; use rustc::middle::{self, reachable, resolve_lifetime, stability}; -use rustc::middle::privacy::AccessLevels; use rustc::ty::{self, AllArenas, Resolutions, TyCtxt}; use rustc::traits; use rustc::util::common::{install_panic_hook, time, ErrorReported}; use rustc::util::profiling::ProfileCategory; +use rustc::session::{CompileResult, CrateDisambiguator, Session}; +use rustc::session::CompileIncomplete; +use rustc::session::config::{self, Input, OutputFilenames, OutputType}; +use rustc::session::search_paths::PathKind; use rustc_allocator as allocator; use rustc_borrowck as borrowck; +use rustc_codegen_utils::codegen_backend::CodegenBackend; +use rustc_data_structures::fingerprint::Fingerprint; +use rustc_data_structures::stable_hasher::StableHasher; +use rustc_data_structures::sync::{self, Lock}; use rustc_incremental; -use rustc_resolve::{MakeGlobMap, Resolver, ResolverArenas}; use rustc_metadata::creader::CrateLoader; use rustc_metadata::cstore::{self, CStore}; +use rustc_mir as mir; +use rustc_passes::{self, ast_validation, hir_stats, loops, rvalue_promotion, layout_test}; +use rustc_plugin as plugin; +use rustc_plugin::registry::Registry; +use rustc_privacy; +use rustc_resolve::{Resolver, ResolverArenas}; use rustc_traits; -use rustc_codegen_utils::codegen_backend::CodegenBackend; -use rustc_codegen_utils::link::out_filename; use rustc_typeck as typeck; -use rustc_privacy; -use rustc_plugin::registry::Registry; -use rustc_plugin as plugin; -use rustc_passes::{self, ast_validation, hir_stats, loops, rvalue_promotion}; +use syntax::{self, ast, attr, diagnostics, visit}; +use syntax::early_buffered_lints::BufferedEarlyLint; +use syntax::ext::base::ExtCtxt; +use syntax::fold::Folder; +use syntax::parse::{self, PResult}; +use syntax::util::node_count::NodeCounter; +use syntax::util::lev_distance::find_best_match_for_name; +use syntax::symbol::Symbol; +use syntax_pos::{FileName, hygiene}; +use syntax_ext; + +use rustc_codegen_utils::link::out_filename; use rustc_yk_sections::mir_cfg::emit_mir_cfg_section; use rustc_yk_sections::with_yk_debug_sections; use rustc::util::nodemap::DefIdSet; -use super::Compilation; +use std::sync::Arc; +use rustc::hir::def_id::LOCAL_CRATE; use serialize::json; @@ -54,25 +56,14 @@ use std::fs; use std::io::{self, Write}; use std::iter; use std::path::{Path, PathBuf}; -use rustc_data_structures::sync::{self, Lrc, Lock}; -use std::sync::{mpsc, Arc}; -use syntax::{self, ast, attr, diagnostics, visit}; -use syntax::early_buffered_lints::BufferedEarlyLint; -use syntax::ext::base::ExtCtxt; -use syntax::fold::Folder; -use syntax::parse::{self, PResult}; -use syntax::util::node_count::NodeCounter; -use syntax::util::lev_distance::find_best_match_for_name; -use syntax::symbol::Symbol; -use syntax_pos::{FileName, hygiene}; -use syntax_ext; +use std::sync::mpsc; -use derive_registrar; use pretty::ReplaceBodyWithLoop; - +use proc_macro_decls; use profile; +use super::Compilation; -#[cfg(not(parallel_queries))] +#[cfg(not(parallel_compiler))] pub fn spawn_thread_pool R + sync::Send, R: sync::Send>( opts: config::Options, f: F @@ -82,7 +73,7 @@ pub fn spawn_thread_pool R + sync::Send, R: sync:: }) } -#[cfg(parallel_queries)] +#[cfg(parallel_compiler)] pub fn spawn_thread_pool R + sync::Send, R: sync::Send>( opts: config::Options, f: F @@ -94,9 +85,9 @@ pub fn spawn_thread_pool R + sync::Send, R: sync:: let gcx_ptr = &Lock::new(0); let config = ThreadPoolBuilder::new() - .num_threads(Session::query_threads_from_opts(&opts)) + .num_threads(Session::threads_from_opts(&opts)) .deadlock_handler(|| unsafe { ty::query::handle_deadlock() }) - .stack_size(16 * 1024 * 1024); + .stack_size(::STACK_SIZE); let with_pool = move |pool: &ThreadPool| { pool.install(move || f(opts)) @@ -184,7 +175,6 @@ pub fn compile_input( let ExpansionResult { expanded_crate, defs, - analysis, resolutions, mut hir_forest, } = { @@ -195,7 +185,6 @@ pub fn compile_input( registry, &crate_name, addl_plugins, - control.make_glob_map, |expanded_crate| { let mut state = CompileState::state_after_expand( input, @@ -251,8 +240,6 @@ pub fn compile_input( } } - let arenas = AllArenas::new(); - // Construct the HIR map let hir_map = time(sess, "indexing hir", || { hir_map::map_crate(sess, cstore, &mut hir_forest, &defs) @@ -268,10 +255,8 @@ pub fn compile_input( sess, outdir, output, - &arenas, &cstore, &hir_map, - &analysis, &resolutions, &expanded_crate, &hir_map.krate(), @@ -289,18 +274,19 @@ pub fn compile_input( None }; + let mut arenas = AllArenas::new(); + phase_3_run_analysis_passes( &*codegen_backend, control, sess, cstore, hir_map, - analysis, resolutions, - &arenas, + &mut arenas, &crate_name, &outputs, - |tcx, analysis, rx, result| { + |tcx, rx, result| { { // Eventually, we will want to track plugins. tcx.dep_graph.with_ignore(|| { @@ -310,8 +296,7 @@ pub fn compile_input( outdir, output, opt_crate, - tcx.hir.krate(), - &analysis, + tcx.hir().krate(), tcx, &crate_name, ); @@ -355,6 +340,10 @@ pub fn compile_input( .push(emit_mir_cfg_section(&tcx, &def_ids, out_fname)); } + if tcx.sess.opts.debugging_opts.query_stats { + tcx.queries.print_stats(); + } + Ok((outputs.clone(), ongoing_codegen, tcx.dep_graph.clone())) }, )?? @@ -372,10 +361,10 @@ pub fn compile_input( if sess.opts.debugging_opts.self_profile { sess.print_profiler_results(); + } - if sess.opts.debugging_opts.profile_json { - sess.save_json_results(); - } + if sess.opts.debugging_opts.profile_json { + sess.save_json_results(); } controller_entry_point!( @@ -418,7 +407,6 @@ pub struct CompileController<'a> { // FIXME we probably want to group the below options together and offer a // better API, rather than this ad-hoc approach. - pub make_glob_map: MakeGlobMap, // Whether the compiler should keep the ast beyond parsing. pub keep_ast: bool, // -Zcontinue-parse-after-error @@ -426,21 +414,21 @@ pub struct CompileController<'a> { /// Allows overriding default rustc query providers, /// after `default_provide` has installed them. - pub provide: Box, + pub provide: Box, /// Same as `provide`, but only for non-local crates, /// applied after `default_provide_extern`. - pub provide_extern: Box, + pub provide_extern: Box, } impl<'a> CompileController<'a> { pub fn basic() -> CompileController<'a> { + sync::assert_send::(); CompileController { after_parse: PhaseController::basic(), after_expand: PhaseController::basic(), after_hir_lowering: PhaseController::basic(), after_analysis: PhaseController::basic(), compilation_done: PhaseController::basic(), - make_glob_map: MakeGlobMap::No, keep_ast: false, continue_parse_after_error: false, provide: box |_| {}, @@ -523,7 +511,7 @@ pub struct PhaseController<'a> { // If true then the compiler will try to run the callback even if the phase // ends with an error. Note that this is not always possible. pub run_callback_on_error: bool, - pub callback: Box, + pub callback: Box, } impl<'a> PhaseController<'a> { @@ -549,12 +537,10 @@ pub struct CompileState<'a, 'tcx: 'a> { pub output_filenames: Option<&'a OutputFilenames>, pub out_dir: Option<&'a Path>, pub out_file: Option<&'a Path>, - pub arenas: Option<&'tcx AllArenas<'tcx>>, pub expanded_crate: Option<&'a ast::Crate>, pub hir_crate: Option<&'a hir::Crate>, pub hir_map: Option<&'a hir_map::Map<'tcx>>, pub resolutions: Option<&'a Resolutions>, - pub analysis: Option<&'a ty::CrateAnalysis>, pub tcx: Option>, } @@ -565,7 +551,6 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> { session, out_dir: out_dir.as_ref().map(|s| &**s), out_file: None, - arenas: None, krate: None, registry: None, cstore: None, @@ -575,7 +560,6 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> { hir_crate: None, hir_map: None, resolutions: None, - analysis: None, tcx: None, } } @@ -621,10 +605,8 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> { session: &'tcx Session, out_dir: &'a Option, out_file: &'a Option, - arenas: &'tcx AllArenas<'tcx>, cstore: &'tcx CStore, hir_map: &'a hir_map::Map<'tcx>, - analysis: &'a ty::CrateAnalysis, resolutions: &'a Resolutions, krate: &'a ast::Crate, hir_crate: &'a hir::Crate, @@ -633,10 +615,8 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> { ) -> Self { CompileState { crate_name: Some(crate_name), - arenas: Some(arenas), cstore: Some(cstore), hir_map: Some(hir_map), - analysis: Some(analysis), resolutions: Some(resolutions), expanded_crate: Some(krate), hir_crate: Some(hir_crate), @@ -653,12 +633,10 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> { out_file: &'a Option, krate: Option<&'a ast::Crate>, hir_crate: &'a hir::Crate, - analysis: &'a ty::CrateAnalysis, tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_name: &'a str, ) -> Self { CompileState { - analysis: Some(analysis), tcx: Some(tcx), expanded_crate: krate, hir_crate: Some(hir_crate), @@ -741,14 +719,13 @@ fn count_nodes(krate: &ast::Crate) -> usize { pub struct ExpansionResult { pub expanded_crate: ast::Crate, pub defs: hir_map::Definitions, - pub analysis: ty::CrateAnalysis, pub resolutions: Resolutions, pub hir_forest: hir_map::Forest, } -pub struct InnerExpansionResult<'a, 'b: 'a> { +pub struct InnerExpansionResult<'a> { pub expanded_crate: ast::Crate, - pub resolver: Resolver<'a, 'b>, + pub resolver: Resolver<'a>, pub hir_forest: hir_map::Forest, } @@ -766,7 +743,6 @@ pub fn phase_2_configure_and_expand( registry: Option, crate_name: &str, addl_plugins: Option>, - make_glob_map: MakeGlobMap, after_expand: F, ) -> Result where @@ -786,7 +762,6 @@ where registry, crate_name, addl_plugins, - make_glob_map, &resolver_arenas, &mut crate_loader, after_expand, @@ -804,22 +779,13 @@ where freevars: resolver.freevars, export_map: resolver.export_map, trait_map: resolver.trait_map, + glob_map: resolver.glob_map, maybe_unused_trait_imports: resolver.maybe_unused_trait_imports, maybe_unused_extern_crates: resolver.maybe_unused_extern_crates, extern_prelude: resolver.extern_prelude.iter().map(|(ident, entry)| { (ident.name, entry.introduced_by_item) }).collect(), }, - - analysis: ty::CrateAnalysis { - access_levels: Lrc::new(AccessLevels::default()), - name: crate_name.to_string(), - glob_map: if resolver.make_glob_map { - Some(resolver.glob_map) - } else { - None - }, - }, }), Err(x) => Err(x), } @@ -827,18 +793,17 @@ where /// Same as phase_2_configure_and_expand, but doesn't let you keep the resolver /// around -pub fn phase_2_configure_and_expand_inner<'a, 'b: 'a, F>( +pub fn phase_2_configure_and_expand_inner<'a, F>( sess: &'a Session, cstore: &'a CStore, mut krate: ast::Crate, registry: Option, crate_name: &str, addl_plugins: Option>, - make_glob_map: MakeGlobMap, resolver_arenas: &'a ResolverArenas<'a>, - crate_loader: &'a mut CrateLoader<'b>, + crate_loader: &'a mut CrateLoader<'a>, after_expand: F, -) -> Result, CompileIncomplete> +) -> Result, CompileIncomplete> where F: FnOnce(&ast::Crate) -> CompileResult, { @@ -924,7 +889,6 @@ where } }); - let whitelisted_legacy_custom_derives = registry.take_whitelisted_custom_derives(); let Registry { syntax_exts, early_lint_passes, @@ -938,7 +902,7 @@ where sess.track_errors(|| { let mut ls = sess.lint_store.borrow_mut(); for pass in early_lint_passes { - ls.register_early_pass(Some(sess), true, pass); + ls.register_early_pass(Some(sess), true, false, pass); } for pass in late_lint_passes { ls.register_late_pass(Some(sess), true, pass); @@ -959,7 +923,11 @@ where } time(sess, "pre ast expansion lint checks", || { - lint::check_ast_crate(sess, &krate, true) + lint::check_ast_crate( + sess, + &krate, + true, + rustc_lint::BuiltinCombinedPreExpansionLintPass::new()); }); let mut resolver = Resolver::new( @@ -967,12 +935,10 @@ where cstore, &krate, crate_name, - make_glob_map, crate_loader, &resolver_arenas, ); - resolver.whitelisted_legacy_custom_derives = whitelisted_legacy_custom_derives; - syntax_ext::register_builtins(&mut resolver, syntax_exts, sess.features_untracked().quote); + syntax_ext::register_builtins(&mut resolver, syntax_exts); // Expand all macros sess.profiler(|p| p.start_activity(ProfileCategory::Expansion)); @@ -993,7 +959,7 @@ where let mut old_path = OsString::new(); if cfg!(windows) { old_path = env::var_os("PATH").unwrap_or(old_path); - let mut new_path = sess.host_filesearch(PathKind::All).get_dylib_search_paths(); + let mut new_path = sess.host_filesearch(PathKind::All).search_path_dirs(); for path in env::split_paths(&old_path) { if !new_path.contains(&path) { new_path.push(path); @@ -1020,7 +986,6 @@ where }; let mut ecx = ExtCtxt::new(&sess.parse_sess, cfg, &mut resolver); - let err_count = ecx.parse_sess.span_diagnostic.err_count(); // Expand macros now! let krate = time(sess, "expand crate", || { @@ -1046,9 +1011,6 @@ where let msg = "missing fragment specifier"; sess.buffer_lint(lint, ast::CRATE_NODE_ID, span, msg); } - if ecx.parse_sess.span_diagnostic.err_count() - ecx.resolve_err_count > err_count { - ecx.parse_sess.span_diagnostic.abort_if_errors(); - } if cfg!(windows) { env::set_var("PATH", &old_path); } @@ -1073,6 +1035,10 @@ where krate = ReplaceBodyWithLoop::new(sess).fold_crate(krate); } + let (has_proc_macro_decls, has_global_allocator) = time(sess, "AST validation", || { + ast_validation::check_crate(sess, &krate) + }); + // If we're in rustdoc we're always compiling as an rlib, but that'll trip a // bunch of checks in the `modify` function below. For now just skip this // step entirely if we're rustdoc as it's not too useful anyway. @@ -1082,11 +1048,12 @@ where let num_crate_types = crate_types.len(); let is_proc_macro_crate = crate_types.contains(&config::CrateType::ProcMacro); let is_test_crate = sess.opts.test; - syntax_ext::proc_macro_registrar::modify( + syntax_ext::proc_macro_decls::modify( &sess.parse_sess, &mut resolver, krate, is_proc_macro_crate, + has_proc_macro_decls, is_test_crate, num_crate_types, sess.diagnostic(), @@ -1094,25 +1061,18 @@ where }); } - // Expand global allocators, which are treated as an in-tree proc macro - krate = time(sess, "creating allocators", || { - allocator::expand::modify( - &sess.parse_sess, - &mut resolver, - krate, - crate_name.to_string(), - sess.diagnostic(), - ) - }); - - // Add all buffered lints from the `ParseSess` to the `Session`. - sess.parse_sess.buffered_lints.with_lock(|buffered_lints| { - info!("{} parse sess buffered_lints", buffered_lints.len()); - for BufferedEarlyLint{id, span, msg, lint_id} in buffered_lints.drain(..) { - let lint = lint::Lint::from_parser_lint_id(lint_id); - sess.buffer_lint(lint, id, span, &msg); - } - }); + if has_global_allocator { + // Expand global allocators, which are treated as an in-tree proc macro + krate = time(sess, "creating allocators", || { + allocator::expand::modify( + &sess.parse_sess, + &mut resolver, + krate, + crate_name.to_string(), + sess.diagnostic(), + ) + }); + } // Done with macro expansion! @@ -1130,33 +1090,29 @@ where println!("{}", json::as_json(&krate)); } - time(sess, "AST validation", || { - ast_validation::check_crate(sess, &krate) - }); - - time(sess, "name resolution", || -> CompileResult { + time(sess, "name resolution", || { resolver.resolve_crate(&krate); - Ok(()) - })?; + }); // Needs to go *after* expansion to be able to check the results of macro expansion. time(sess, "complete gated feature checking", || { - sess.track_errors(|| { - syntax::feature_gate::check_crate( - &krate, - &sess.parse_sess, - &sess.features_untracked(), - &attributes, - sess.opts.unstable_features, - ); - }) - })?; + syntax::feature_gate::check_crate( + &krate, + &sess.parse_sess, + &sess.features_untracked(), + &attributes, + sess.opts.unstable_features, + ); + }); - // Unresolved macros might be due to mistyped `#[macro_use]`, - // so abort after checking for unknown attributes. (#49074) - if resolver.found_unresolved_macro { - sess.diagnostic().abort_if_errors(); - } + // Add all buffered lints from the `ParseSess` to the `Session`. + sess.parse_sess.buffered_lints.with_lock(|buffered_lints| { + info!("{} parse sess buffered_lints", buffered_lints.len()); + for BufferedEarlyLint{id, span, msg, lint_id} in buffered_lints.drain(..) { + let lint = lint::Lint::from_parser_lint_id(lint_id); + sess.buffer_lint(lint, id, span, &msg); + } + }); // Lower ast -> hir. // First, we need to collect the dep_graph. @@ -1186,7 +1142,7 @@ where }); time(sess, "early lint checks", || { - lint::check_ast_crate(sess, &krate, false) + lint::check_ast_crate(sess, &krate, false, rustc_lint::BuiltinCombinedEarlyLintPass::new()) }); // Discard hygiene data, which isn't required after lowering to HIR. @@ -1202,6 +1158,8 @@ where } pub fn default_provide(providers: &mut ty::query::Providers) { + proc_macro_decls::provide(providers); + plugin::build::provide(providers); hir::provide(providers); borrowck::provide(providers); mir::provide(providers); @@ -1211,10 +1169,14 @@ pub fn default_provide(providers: &mut ty::query::Providers) { typeck::provide(providers); ty::provide(providers); traits::provide(providers); + stability::provide(providers); + middle::intrinsicck::provide(providers); + middle::liveness::provide(providers); reachable::provide(providers); rustc_passes::provide(providers); rustc_traits::provide(providers); middle::region::provide(providers); + middle::entry::provide(providers); cstore::provide(providers); lint::provide(providers); } @@ -1232,9 +1194,8 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>( sess: &'tcx Session, cstore: &'tcx CStore, hir_map: hir_map::Map<'tcx>, - mut analysis: ty::CrateAnalysis, resolutions: Resolutions, - arenas: &'tcx AllArenas<'tcx>, + arenas: &'tcx mut AllArenas<'tcx>, name: &str, output_filenames: &OutputFilenames, f: F, @@ -1242,7 +1203,6 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>( where F: for<'a> FnOnce( TyCtxt<'a, 'tcx, 'tcx>, - ty::CrateAnalysis, mpsc::Receiver>, CompileResult, ) -> R, @@ -1251,19 +1211,6 @@ where rustc_incremental::load_query_result_cache(sess) }); - time(sess, "looking for entry point", || { - middle::entry::find_entry_point(sess, &hir_map, name) - }); - - sess.plugin_registrar_fn - .set(time(sess, "looking for plugin registrar", || { - plugin::build::find_plugin_registrar(sess.diagnostic(), &hir_map) - })); - sess.derive_registrar_fn - .set(derive_registrar::find(&hir_map)); - - time(sess, "loop checking", || loops::check_crate(sess, &hir_map)); - let mut local_providers = ty::query::Providers::default(); default_provide(&mut local_providers); codegen_backend.provide(&mut local_providers); @@ -1291,7 +1238,21 @@ where |tcx| { // Do some initialization of the DepGraph that can only be done with the // tcx available. - rustc_incremental::dep_graph_tcx_init(tcx); + time(sess, "dep graph tcx init", || rustc_incremental::dep_graph_tcx_init(tcx)); + + time(sess, "looking for entry point", || { + middle::entry::find_entry_point(tcx) + }); + + time(sess, "looking for plugin registrar", || { + plugin::build::find_plugin_registrar(tcx) + }); + + time(sess, "looking for derive registrar", || { + proc_macro_decls::find(tcx) + }); + + time(sess, "loop checking", || loops::check_crate(tcx)); time(sess, "attribute checking", || { hir::check_attr::check_crate(tcx) @@ -1305,7 +1266,7 @@ where match typeck::check_crate(tcx) { Ok(x) => x, Err(x) => { - f(tcx, analysis, rx, Err(x)); + f(tcx, rx, Err(x)); return Err(x); } } @@ -1314,8 +1275,9 @@ where rvalue_promotion::check_crate(tcx) }); - analysis.access_levels = - time(sess, "privacy checking", || rustc_privacy::check_crate(tcx)); + time(sess, "privacy checking", || { + rustc_privacy::check_crate(tcx) + }); time(sess, "intrinsic checking", || { middle::intrinsicck::check_crate(tcx) @@ -1350,6 +1312,9 @@ where mir::transform::check_unsafety::check_unsafety(tcx, def_id) } }); + + time(sess, "layout testing", || layout_test::test_layout(tcx)); + // Avoid overwhelming user with errors if type checking failed. // I'm not sure how helpful this is, to be honest, but it avoids // a @@ -1357,7 +1322,7 @@ where // lint warnings and so on -- kindck used to do this abort, but // kindck is gone now). -nmatsakis if sess.err_count() > 0 { - return Ok(f(tcx, analysis, rx, sess.compile_status())); + return Ok(f(tcx, rx, sess.compile_status())); } time(sess, "death checking", || middle::dead::check_crate(tcx)); @@ -1368,7 +1333,7 @@ where time(sess, "lint checking", || lint::check_crate(tcx)); - return Ok(f(tcx, analysis, rx, tcx.sess.compile_status())); + return Ok(f(tcx, rx, tcx.sess.compile_status())); }, ) } @@ -1570,13 +1535,7 @@ pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec { - session - .struct_span_err(a.span, "`crate_type` requires a value") - .note("for example: `#![crate_type=\"lib\"]`") - .emit(); - None - } + None => None } } else { None diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index cd6970dea4b..48342c0dd73 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The Rust compiler. //! //! # Note @@ -21,12 +11,11 @@ #![feature(box_syntax)] #![cfg_attr(unix, feature(libc))] #![feature(nll)] -#![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(slice_sort_by_cached_key)] #![feature(set_stdio)] -#![feature(rustc_stack_internals)] #![feature(no_debug)] +#![feature(integer_atomics)] #![recursion_limit="256"] @@ -66,21 +55,12 @@ extern crate syntax_pos; extern crate rustc_yk_sections; extern crate rustc_yk_link; -// Note that the linkage here should be all that we need, on Linux we're not -// prefixing the symbols here so this should naturally override our default -// allocator. On OSX it should override via the zone allocator. We shouldn't -// enable this by default on other platforms, so other platforms aren't handled -// here yet. -#[cfg(feature = "jemalloc-sys")] -extern crate jemalloc_sys; - use driver::CompileController; use pretty::{PpMode, UserIdentifiedItem}; -use rustc_resolve as resolve; use rustc_save_analysis as save; use rustc_save_analysis::DumpHandler; -use rustc_data_structures::sync::{self, Lrc}; +use rustc_data_structures::sync::{self, Lrc, Ordering::SeqCst}; use rustc_data_structures::OnDrop; use rustc::session::{self, config, Session, build_session, CompileResult}; use rustc::session::CompileIncomplete; @@ -113,7 +93,7 @@ use std::panic; use std::path::{PathBuf, Path}; use std::process::{self, Command, Stdio}; use std::str; -use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; +use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Once, ONCE_INIT}; use std::thread; @@ -129,7 +109,7 @@ mod test; pub mod profile; pub mod driver; pub mod pretty; -mod derive_registrar; +mod proc_macro_decls; pub mod target_features { use syntax::ast; @@ -221,14 +201,7 @@ pub fn run(run_compiler: F) -> isize } fn load_backend_from_dylib(path: &Path) -> fn() -> Box { - // Note that we're specifically using `open_global_now` here rather than - // `open`, namely we want the behavior on Unix of RTLD_GLOBAL and RTLD_NOW, - // where NOW means "bind everything right now" because we don't want - // surprises later on and RTLD_GLOBAL allows the symbols to be made - // available for future dynamic libraries opened. This is currently used by - // loading LLVM and then making its symbols available for other dynamic - // libraries. - let lib = DynamicLibrary::open_global_now(path).unwrap_or_else(|err| { + let lib = DynamicLibrary::open(Some(path)).unwrap_or_else(|err| { let err = format!("couldn't load codegen backend {:?}: {:?}", path, err); early_error(ErrorOutputType::default(), &err); }); @@ -260,7 +233,7 @@ pub fn get_codegen_backend(sess: &Session) -> Box { .unwrap_or(&sess.target.target.options.codegen_backend); let backend = match &codegen_name[..] { "metadata_only" => { - rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::new + rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::boxed } filename if filename.contains(".") => { load_backend_from_dylib(filename.as_ref()) @@ -283,7 +256,7 @@ fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box { // general this assertion never trips due to the once guard in `get_codegen_backend`, // but there's a few manual calls to this function in this file we protect // against. - static LOADED: AtomicBool = ATOMIC_BOOL_INIT; + static LOADED: AtomicBool = AtomicBool::new(false); assert!(!LOADED.fetch_or(true, Ordering::SeqCst), "cannot load the default codegen backend twice"); @@ -293,7 +266,7 @@ fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box { // let's just return a dummy creation function which won't be used in // general anyway. if cfg!(test) { - return rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::new + return rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::boxed } let target = session::config::host_triple(); @@ -596,7 +569,7 @@ fn make_input(free_matches: &[String]) -> Option<(Input, Option, Option } else { None }; - Some((Input::Str { name: FileName::Anon, input: src }, + Some((Input::Str { name: FileName::anon_source_code(&src), input: src }, None, err)) } else { Some((Input::File(PathBuf::from(ifile)), @@ -907,13 +880,11 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls { pretty::print_after_hir_lowering(state.session, state.cstore.unwrap(), state.hir_map.unwrap(), - state.analysis.unwrap(), state.resolutions.unwrap(), state.input, &state.expanded_crate.take().unwrap(), state.crate_name.unwrap(), ppm, - state.arenas.unwrap(), state.output_filenames.unwrap(), opt_uii.clone(), state.out_file); @@ -956,7 +927,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls { let sess = state.session; eprintln!("Fuel used by {}: {}", sess.print_fuel_crate.as_ref().unwrap(), - sess.print_fuel.get()); + sess.print_fuel.load(SeqCst)); } } control @@ -969,7 +940,6 @@ pub fn enable_save_analysis(control: &mut CompileController) { time(state.session, "save analysis", || { save::process_crate(state.tcx.unwrap(), state.expanded_crate.unwrap(), - state.analysis.unwrap(), state.crate_name.unwrap(), state.input, None, @@ -978,7 +948,6 @@ pub fn enable_save_analysis(control: &mut CompileController) { }); }; control.after_analysis.run_callback_on_error = true; - control.make_glob_map = resolve::MakeGlobMap::Yes; } impl RustcDefaultCalls { @@ -1044,7 +1013,7 @@ impl RustcDefaultCalls { targets.sort(); println!("{}", targets.join("\n")); }, - Sysroot => println!("{}", sess.sysroot().display()), + Sysroot => println!("{}", sess.sysroot.display()), TargetSpec => println!("{}", sess.target.target.to_json().pretty()), FileNames | CrateName => { let input = input.unwrap_or_else(|| @@ -1470,6 +1439,11 @@ fn parse_crate_attrs<'a>(sess: &'a Session, input: &Input) -> PResult<'a, Vec(name: String, f: F) -> Result R + Send + 'static, R: Send + 'static, { - // Temporarily have stack size set to 16MB to deal with nom-using crates failing - const STACK_SIZE: usize = 16 * 1024 * 1024; // 16MB - - #[cfg(all(unix, not(target_os = "haiku")))] - let spawn_thread = unsafe { - // Fetch the current resource limits - let mut rlim = libc::rlimit { - rlim_cur: 0, - rlim_max: 0, - }; - if libc::getrlimit(libc::RLIMIT_STACK, &mut rlim) != 0 { - let err = io::Error::last_os_error(); - error!("in_rustc_thread: error calling getrlimit: {}", err); - true - } else if rlim.rlim_max < STACK_SIZE as libc::rlim_t { - true - } else if rlim.rlim_cur < STACK_SIZE as libc::rlim_t { - std::rt::deinit_stack_guard(); - rlim.rlim_cur = STACK_SIZE as libc::rlim_t; - if libc::setrlimit(libc::RLIMIT_STACK, &mut rlim) != 0 { - let err = io::Error::last_os_error(); - error!("in_rustc_thread: error calling setrlimit: {}", err); - std::rt::update_stack_guard(); - true - } else { - std::rt::update_stack_guard(); - false - } - } else { - false - } - }; - - // We set the stack size at link time. See src/rustc/rustc.rs. - #[cfg(windows)] - let spawn_thread = false; - - #[cfg(target_os = "haiku")] - let spawn_thread = unsafe { - // Haiku does not have setrlimit implemented for the stack size. - // By default it does have the 16 MB stack limit, but we check this in - // case the minimum STACK_SIZE changes or Haiku's defaults change. - let mut rlim = libc::rlimit { - rlim_cur: 0, - rlim_max: 0, - }; - if libc::getrlimit(libc::RLIMIT_STACK, &mut rlim) != 0 { - let err = io::Error::last_os_error(); - error!("in_rustc_thread: error calling getrlimit: {}", err); - true - } else if rlim.rlim_cur >= STACK_SIZE { - false - } else { - true - } - }; - - #[cfg(not(any(windows, unix)))] - let spawn_thread = true; - - // The or condition is added from backward compatibility. - if spawn_thread || env::var_os("RUST_MIN_STACK").is_some() { + // We need a thread for soundness of thread local storage in rustc. For debugging purposes + // we allow an escape hatch where everything runs on the main thread. + if env::var_os("RUSTC_UNSTABLE_NO_MAIN_THREAD").is_none() { let mut cfg = thread::Builder::new().name(name); - // FIXME: Hacks on hacks. If the env is trying to override the stack size - // then *don't* set it explicitly. + // If the env is trying to override the stack size then *don't* set it explicitly. + // The libstd thread impl will fetch the `RUST_MIN_STACK` env var itself. if env::var_os("RUST_MIN_STACK").is_none() { cfg = cfg.stack_size(STACK_SIZE); } @@ -1699,7 +1614,6 @@ pub fn diagnostics_registry() -> errors::registry::Registry { all_errors.extend_from_slice(&rustc_privacy::DIAGNOSTICS); // FIXME: need to figure out a way to get these back in here // all_errors.extend_from_slice(get_codegen_backend(sess).diagnostics()); - all_errors.extend_from_slice(&rustc_codegen_utils::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_metadata::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_passes::DIAGNOSTICS); all_errors.extend_from_slice(&rustc_plugin::DIAGNOSTICS); diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index c7ba31e3395..d980c5a3d29 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -1,32 +1,18 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The various pretty print routines. - -pub use self::UserIdentifiedItem::*; -pub use self::PpSourceMode::*; -pub use self::PpMode::*; -use self::NodesMatchingUII::*; +//! The various pretty-printing routines. -use {abort_on_err, driver}; - -use rustc::ty::{self, TyCtxt, Resolutions, AllArenas}; use rustc::cfg; use rustc::cfg::graphviz::LabelledCFG; +use rustc::hir; +use rustc::hir::map as hir_map; +use rustc::hir::map::blocks; +use rustc::hir::print as pprust_hir; use rustc::session::Session; use rustc::session::config::{Input, OutputFilenames}; +use rustc::ty::{self, TyCtxt, Resolutions, AllArenas}; use rustc_borrowck as borrowck; use rustc_borrowck::graphviz as borrowck_dot; use rustc_data_structures::thin_vec::ThinVec; use rustc_metadata::cstore::CStore; - use rustc_mir::util::{write_mir_pretty, write_mir_graphviz}; use syntax::ast::{self, BlockCheckMode}; @@ -47,10 +33,11 @@ use std::path::Path; use std::str::FromStr; use std::mem; -use rustc::hir::map as hir_map; -use rustc::hir::map::blocks; -use rustc::hir; -use rustc::hir::print as pprust_hir; +pub use self::UserIdentifiedItem::*; +pub use self::PpSourceMode::*; +pub use self::PpMode::*; +use self::NodesMatchingUII::*; +use {abort_on_err, driver}; #[derive(Copy, Clone, PartialEq, Debug)] pub enum PpSourceMode { @@ -136,7 +123,8 @@ pub fn parse_pretty(sess: &Session, sess.fatal(&format!("argument to `unpretty` must be one of `normal`, \ `expanded`, `flowgraph[,unlabelled]=`, \ `identified`, `expanded,identified`, `everybody_loops`, \ - `hir`, `hir,identified`, `hir,typed`, or `mir`; got {}", + `hir`, `hir,identified`, `hir,typed`, `hir-tree`, \ + `mir` or `mir-cfg`; got {}", name)); } else { sess.fatal(&format!("argument to `pretty` must be one of `normal`, `expanded`, \ @@ -203,9 +191,7 @@ impl PpSourceMode { sess: &'tcx Session, cstore: &'tcx CStore, hir_map: &hir_map::Map<'tcx>, - analysis: &ty::CrateAnalysis, resolutions: &Resolutions, - arenas: &'tcx AllArenas<'tcx>, output_filenames: &OutputFilenames, id: &str, f: F @@ -231,17 +217,17 @@ impl PpSourceMode { PpmTyped => { let control = &driver::CompileController::basic(); let codegen_backend = ::get_codegen_backend(sess); + let mut arenas = AllArenas::new(); abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend, control, sess, cstore, hir_map.clone(), - analysis.clone(), resolutions.clone(), - arenas, + &mut arenas, id, output_filenames, - |tcx, _, _, _| { + |tcx, _, _| { let empty_tables = ty::TypeckTables::empty(None); let annotation = TypedAnnotation { tcx, @@ -495,7 +481,7 @@ impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> { } fn hir_map<'a>(&'a self) -> Option<&'a hir_map::Map<'tcx>> { - Some(&self.tcx.hir) + Some(&self.tcx.hir()) } fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn { @@ -514,7 +500,7 @@ impl<'a, 'tcx> pprust_hir::PpAnn for TypedAnnotation<'a, 'tcx> { if let pprust_hir::Nested::Body(id) = nested { self.tables.set(self.tcx.body_tables(id)); } - pprust_hir::PpAnn::nested(&self.tcx.hir, state, nested)?; + pprust_hir::PpAnn::nested(self.tcx.hir(), state, nested)?; self.tables.set(old_tables); Ok(()) } @@ -530,7 +516,7 @@ impl<'a, 'tcx> pprust_hir::PpAnn for TypedAnnotation<'a, 'tcx> { s.s.space()?; s.s.word("as")?; s.s.space()?; - s.s.word(&self.tables.get().expr_ty(expr).to_string())?; + s.s.word(self.tables.get().expr_ty(expr).to_string())?; s.pclose() } _ => Ok(()), @@ -754,7 +740,6 @@ impl<'a> fold::Folder for ReplaceBodyWithLoop<'a> { fn fold_block(&mut self, b: P) -> P { fn stmt_to_block(rules: ast::BlockCheckMode, - recovered: bool, s: Option, sess: &Session) -> ast::Block { ast::Block { @@ -762,7 +747,6 @@ impl<'a> fold::Folder for ReplaceBodyWithLoop<'a> { rules, id: sess.next_node_id(), span: syntax_pos::DUMMY_SP, - recovered, } } @@ -781,7 +765,7 @@ impl<'a> fold::Folder for ReplaceBodyWithLoop<'a> { } } - let empty_block = stmt_to_block(BlockCheckMode::Default, false, None, self.sess); + let empty_block = stmt_to_block(BlockCheckMode::Default, None, self.sess); let loop_expr = P(ast::Expr { node: ast::ExprKind::Loop(P(empty_block), None), id: self.sess.next_node_id(), @@ -822,7 +806,7 @@ impl<'a> fold::Folder for ReplaceBodyWithLoop<'a> { old_blocks.push(new_block); } - stmt_to_block(b.rules, b.recovered, Some(loop_stmt), self.sess) + stmt_to_block(b.rules, Some(loop_stmt), self.sess) } else { //push `loop {}` onto the end of our fresh block and yield that new_block.stmts.push(loop_stmt); @@ -851,18 +835,18 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec, // Find the function this expression is from. let mut node_id = expr.id; loop { - let node = tcx.hir.get(node_id); + let node = tcx.hir().get(node_id); if let Some(n) = hir::map::blocks::FnLikeNode::from_node(node) { break n.body(); } - let parent = tcx.hir.get_parent_node(node_id); + let parent = tcx.hir().get_parent_node(node_id); assert_ne!(node_id, parent); node_id = parent; } } blocks::Code::FnLike(fn_like) => fn_like.body(), }; - let body = tcx.hir.body(body_id); + let body = tcx.hir().body(body_id); let cfg = cfg::CFG::new(tcx, &body); let labelled_edges = mode != PpFlowGraphMode::UnlabelledEdges; let lcfg = LabelledCFG { @@ -974,13 +958,11 @@ pub fn print_after_parsing(sess: &Session, pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, cstore: &'tcx CStore, hir_map: &hir_map::Map<'tcx>, - analysis: &ty::CrateAnalysis, resolutions: &Resolutions, input: &Input, krate: &ast::Crate, crate_name: &str, ppm: PpMode, - arenas: &'tcx AllArenas<'tcx>, output_filenames: &OutputFilenames, opt_uii: Option, ofile: Option<&Path>) { @@ -988,10 +970,8 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, print_with_analysis(sess, cstore, hir_map, - analysis, resolutions, crate_name, - arenas, output_filenames, ppm, opt_uii, @@ -1027,9 +1007,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, s.call_with_pp_support_hir(sess, cstore, hir_map, - analysis, resolutions, - arenas, output_filenames, crate_name, move |annotation, krate| { @@ -1051,9 +1029,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, s.call_with_pp_support_hir(sess, cstore, hir_map, - analysis, resolutions, - arenas, output_filenames, crate_name, move |_annotation, krate| { @@ -1067,9 +1043,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, s.call_with_pp_support_hir(sess, cstore, hir_map, - analysis, resolutions, - arenas, output_filenames, crate_name, move |annotation, _| { @@ -1101,9 +1075,7 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, s.call_with_pp_support_hir(sess, cstore, hir_map, - analysis, resolutions, - arenas, output_filenames, crate_name, move |_annotation, _krate| { @@ -1124,16 +1096,14 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session, } // In an ideal world, this would be a public function called by the driver after -// analsysis is performed. However, we want to call `phase_3_run_analysis_passes` +// analysis is performed. However, we want to call `phase_3_run_analysis_passes` // with a different callback than the standard driver, so that isn't easy. // Instead, we call that function ourselves. fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session, cstore: &'a CStore, hir_map: &hir_map::Map<'tcx>, - analysis: &ty::CrateAnalysis, resolutions: &Resolutions, crate_name: &str, - arenas: &'tcx AllArenas<'tcx>, output_filenames: &OutputFilenames, ppm: PpMode, uii: Option, @@ -1150,21 +1120,21 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session, let control = &driver::CompileController::basic(); let codegen_backend = ::get_codegen_backend(sess); + let mut arenas = AllArenas::new(); abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend, control, sess, cstore, hir_map.clone(), - analysis.clone(), resolutions.clone(), - arenas, + &mut arenas, crate_name, output_filenames, - |tcx, _, _, _| { + |tcx, _, _| { match ppm { PpmMir | PpmMirCFG => { if let Some(nodeid) = nodeid { - let def_id = tcx.hir.local_def_id(nodeid); + let def_id = tcx.hir().local_def_id(nodeid); match ppm { PpmMir => write_mir_pretty(tcx, Some(def_id), &mut out), PpmMirCFG => write_mir_graphviz(tcx, Some(def_id), &mut out), @@ -1183,11 +1153,11 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session, let nodeid = nodeid.expect("`pretty flowgraph=..` needs NodeId (int) or unique path \ suffix (b::c::d)"); - let node = tcx.hir.find(nodeid).unwrap_or_else(|| { + let node = tcx.hir().find(nodeid).unwrap_or_else(|| { tcx.sess.fatal(&format!("--pretty flowgraph couldn't find id: {}", nodeid)) }); - match blocks::Code::from_node(&tcx.hir, nodeid) { + match blocks::Code::from_node(&tcx.hir(), nodeid) { Some(code) => { let variants = gather_flowgraph_variants(tcx.sess); @@ -1200,7 +1170,7 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session, got {:?}", node); - tcx.sess.span_fatal(tcx.hir.span(nodeid), &message) + tcx.sess.span_fatal(tcx.hir().span(nodeid), &message) } } } diff --git a/src/librustc_driver/proc_macro_decls.rs b/src/librustc_driver/proc_macro_decls.rs new file mode 100644 index 00000000000..093d15b7e3c --- /dev/null +++ b/src/librustc_driver/proc_macro_decls.rs @@ -0,0 +1,48 @@ +use rustc::hir::itemlikevisit::ItemLikeVisitor; +use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; +use rustc::hir; +use rustc::ty::TyCtxt; +use rustc::ty::query::Providers; +use syntax::ast; +use syntax::attr; + +pub fn find<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> Option { + tcx.proc_macro_decls_static(LOCAL_CRATE) +} + +fn proc_macro_decls_static<'tcx>( + tcx: TyCtxt<'_, 'tcx, 'tcx>, + cnum: CrateNum, +) -> Option { + assert_eq!(cnum, LOCAL_CRATE); + + let mut finder = Finder { decls: None }; + tcx.hir().krate().visit_all_item_likes(&mut finder); + + finder.decls.map(|id| tcx.hir().local_def_id(id)) +} + +struct Finder { + decls: Option, +} + +impl<'v> ItemLikeVisitor<'v> for Finder { + fn visit_item(&mut self, item: &hir::Item) { + if attr::contains_name(&item.attrs, "rustc_proc_macro_decls") { + self.decls = Some(item.id); + } + } + + fn visit_trait_item(&mut self, _trait_item: &hir::TraitItem) { + } + + fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) { + } +} + +pub(crate) fn provide(providers: &mut Providers<'_>) { + *providers = Providers { + proc_macro_decls_static, + ..*providers + }; +} diff --git a/src/librustc_driver/profile/mod.rs b/src/librustc_driver/profile/mod.rs index d334a9476ce..eb13a5668f9 100644 --- a/src/librustc_driver/profile/mod.rs +++ b/src/librustc_driver/profile/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::session::Session; use rustc::util::common::{ProfQDumpParams, ProfileQueriesMsg, profq_msg, profq_set_chan}; use std::sync::mpsc::{Receiver}; @@ -64,9 +54,7 @@ struct StackFrame { } fn total_duration(traces: &[trace::Rec]) -> Duration { - let mut sum : Duration = Duration::new(0, 0); - for t in traces.iter() { sum += t.dur_total; } - return sum + Duration::new(0, 0) + traces.iter().map(|t| t.dur_total).sum() } // profiling thread; retains state (in local variables) and dump traces, upon request. @@ -93,40 +81,38 @@ fn profile_queries_thread(r: Receiver) { ProfileQueriesMsg::Dump(params) => { assert!(stack.is_empty()); assert!(frame.parse_st == ParseState::Clear); - { - // write log of all messages - if params.dump_profq_msg_log { - let mut log_file = - File::create(format!("{}.log.txt", params.path)).unwrap(); - for m in profq_msgs.iter() { - writeln!(&mut log_file, "{:?}", m).unwrap() - }; - } - // write HTML file, and counts file - let html_path = format!("{}.html", params.path); - let mut html_file = File::create(&html_path).unwrap(); + // write log of all messages + if params.dump_profq_msg_log { + let mut log_file = + File::create(format!("{}.log.txt", params.path)).unwrap(); + for m in profq_msgs.iter() { + writeln!(&mut log_file, "{:?}", m).unwrap() + }; + } - let counts_path = format!("{}.counts.txt", params.path); - let mut counts_file = File::create(&counts_path).unwrap(); + // write HTML file, and counts file + let html_path = format!("{}.html", params.path); + let mut html_file = File::create(&html_path).unwrap(); - writeln!(html_file, - "\n\n", - "profile_queries.css").unwrap(); - writeln!(html_file, "\n\n").unwrap(); - trace::write_traces(&mut html_file, &mut counts_file, &frame.traces); - writeln!(html_file, "\n").unwrap(); + let counts_path = format!("{}.counts.txt", params.path); + let mut counts_file = File::create(&counts_path).unwrap(); - let ack_path = format!("{}.ack", params.path); - let ack_file = File::create(&ack_path).unwrap(); - drop(ack_file); + writeln!(html_file, + "\n\n", + "profile_queries.css").unwrap(); + writeln!(html_file, "\n\n").unwrap(); + trace::write_traces(&mut html_file, &mut counts_file, &frame.traces); + writeln!(html_file, "\n").unwrap(); - // Tell main thread that we are done, e.g., so it can exit - params.ack.send(()).unwrap(); - } - continue + let ack_path = format!("{}.ack", params.path); + let ack_file = File::create(&ack_path).unwrap(); + drop(ack_file); + + // Tell main thread that we are done, e.g., so it can exit + params.ack.send(()).unwrap(); } // Actual query message: msg => { @@ -134,9 +120,9 @@ fn profile_queries_thread(r: Receiver) { profq_msgs.push(msg.clone()); // Respond to the message, knowing that we've already handled Halt and Dump, above. match (frame.parse_st.clone(), msg) { - (_,ProfileQueriesMsg::Halt) => unreachable!(), - (_,ProfileQueriesMsg::Dump(_)) => unreachable!(), - + (_, ProfileQueriesMsg::Halt) | (_, ProfileQueriesMsg::Dump(_)) => { + unreachable!(); + }, // Parse State: Clear (ParseState::Clear, ProfileQueriesMsg::QueryBegin(span, querymsg)) => { @@ -163,8 +149,8 @@ fn profile_queries_thread(r: Receiver) { ParseState::HaveQuery(q, start) => { let duration = start.elapsed(); frame = StackFrame{ - parse_st:ParseState::Clear, - traces:old_frame.traces + parse_st: ParseState::Clear, + traces: old_frame.traces }; let dur_extent = total_duration(&provider_extent); let trace = Rec { @@ -181,18 +167,16 @@ fn profile_queries_thread(r: Receiver) { } } }, - - (ParseState::Clear, ProfileQueriesMsg::TimeBegin(msg)) => { let start = Instant::now(); frame.parse_st = ParseState::HaveTimeBegin(msg, start); stack.push(frame); - frame = StackFrame{parse_st:ParseState::Clear, traces:vec![]}; + frame = StackFrame{parse_st: ParseState::Clear, traces: vec![]}; + }, + (_, ProfileQueriesMsg::TimeBegin(_)) => { + panic!("parse error; did not expect time begin here"); }, - (_, ProfileQueriesMsg::TimeBegin(_)) => - panic!("parse error; did not expect time begin here"), - (ParseState::Clear, ProfileQueriesMsg::TimeEnd) => { let provider_extent = frame.traces; @@ -204,8 +188,8 @@ fn profile_queries_thread(r: Receiver) { ParseState::HaveTimeBegin(msg, start) => { let duration = start.elapsed(); frame = StackFrame{ - parse_st:ParseState::Clear, - traces:old_frame.traces + parse_st: ParseState::Clear, + traces: old_frame.traces }; let dur_extent = total_duration(&provider_extent); let trace = Rec { @@ -222,18 +206,19 @@ fn profile_queries_thread(r: Receiver) { } } }, - (_, ProfileQueriesMsg::TimeEnd) => { panic!("parse error") } - + (_, ProfileQueriesMsg::TimeEnd) => { + panic!("parse error") + }, (ParseState::Clear, ProfileQueriesMsg::TaskBegin(key)) => { let start = Instant::now(); frame.parse_st = ParseState::HaveTaskBegin(key, start); stack.push(frame); - frame = StackFrame{parse_st:ParseState::Clear, traces:vec![]}; + frame = StackFrame{ parse_st: ParseState::Clear, traces: vec![] }; + }, + (_, ProfileQueriesMsg::TaskBegin(_)) => { + panic!("parse error; did not expect time begin here"); }, - (_, ProfileQueriesMsg::TaskBegin(_)) => - panic!("parse error; did not expect time begin here"), - (ParseState::Clear, ProfileQueriesMsg::TaskEnd) => { let provider_extent = frame.traces; @@ -245,8 +230,8 @@ fn profile_queries_thread(r: Receiver) { ParseState::HaveTaskBegin(key, start) => { let duration = start.elapsed(); frame = StackFrame{ - parse_st:ParseState::Clear, - traces:old_frame.traces + parse_st: ParseState::Clear, + traces: old_frame.traces }; let dur_extent = total_duration(&provider_extent); let trace = Rec { @@ -263,8 +248,9 @@ fn profile_queries_thread(r: Receiver) { } } }, - (_, ProfileQueriesMsg::TaskEnd) => { panic!("parse error") } - + (_, ProfileQueriesMsg::TaskEnd) => { + panic!("parse error") + }, // Parse State: HaveQuery (ParseState::HaveQuery(q,start), ProfileQueriesMsg::CacheHit) => { @@ -279,26 +265,25 @@ fn profile_queries_thread(r: Receiver) { frame.traces.push( trace ); frame.parse_st = ParseState::Clear; }, - (ParseState::HaveQuery(_,_), + (ParseState::HaveQuery(_, _), ProfileQueriesMsg::ProviderBegin) => { stack.push(frame); - frame = StackFrame{parse_st:ParseState::Clear, traces:vec![]}; + frame = StackFrame{ parse_st: ParseState::Clear, traces: vec![] }; }, // Parse errors: - (ParseState::HaveQuery(q,_), + (ParseState::HaveQuery(q, _), ProfileQueriesMsg::ProviderEnd) => { panic!("parse error: unexpected ProviderEnd; \ expected something else to follow BeginQuery for {:?}", q) }, - (ParseState::HaveQuery(q1,_), - ProfileQueriesMsg::QueryBegin(span2,querymsg2)) => { + (ParseState::HaveQuery(q1, _), + ProfileQueriesMsg::QueryBegin(span2, querymsg2)) => { panic!("parse error: unexpected QueryBegin; \ earlier query is unfinished: {:?} and now {:?}", - q1, Query{span:span2, msg:querymsg2}) + q1, Query{span:span2, msg: querymsg2}) }, - (ParseState::HaveTimeBegin(_, _), _) => { unreachable!() }, diff --git a/src/librustc_driver/profile/trace.rs b/src/librustc_driver/profile/trace.rs index 9589ae2a8db..95c4ea6ff23 100644 --- a/src/librustc_driver/profile/trace.rs +++ b/src/librustc_driver/profile/trace.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::*; use syntax_pos::SpanData; use rustc_data_structures::fx::FxHashMap; diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index 8865c7e438e..afcf08632a4 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -1,25 +1,12 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! # Standalone Tests for the Inference Module -use std::path::PathBuf; -use std::sync::mpsc; - use driver; use errors; use errors::emitter::Emitter; use errors::{DiagnosticBuilder, Level}; +use rustc::hir; use rustc::hir::map as hir_map; use rustc::infer::outlives::env::OutlivesEnvironment; -use rustc::infer::type_variable::TypeVariableOrigin; use rustc::infer::{self, InferOk, InferResult, SuppressRegionErrors}; use rustc::middle::region; use rustc::session::config::{OutputFilenames, OutputTypes}; @@ -31,16 +18,15 @@ use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc_data_structures::sync::{self, Lrc}; use rustc_lint; use rustc_metadata::cstore::CStore; -use rustc_resolve::MakeGlobMap; use rustc_target::spec::abi::Abi; use syntax; use syntax::ast; use syntax::feature_gate::UnstableFeatures; use syntax::source_map::{FileName, FilePathMapping, SourceMap}; use syntax::symbol::Symbol; -use syntax_pos::DUMMY_SP; -use rustc::hir; +use std::path::PathBuf; +use std::sync::mpsc; struct Env<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { infcx: &'a infer::InferCtxt<'a, 'gcx, 'tcx>, @@ -98,7 +84,7 @@ fn errors(msgs: &[&str]) -> (Box, usize) { fn test_env(source_string: &str, args: (Box, usize), body: F) where - F: FnOnce(Env), + F: FnOnce(Env) + sync::Send, { syntax::with_globals(|| { let mut options = config::Options::default(); @@ -129,7 +115,7 @@ fn test_env_with_pool( let cstore = CStore::new(::get_codegen_backend(&sess).metadata_loader()); rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); let input = config::Input::Str { - name: FileName::Anon, + name: FileName::anon_source_code(&source_string), input: source_string.to_string(), }; let krate = @@ -147,15 +133,14 @@ fn test_env_with_pool( None, "test", None, - MakeGlobMap::No, |_| Ok(()), ).expect("phase 2 aborted") }; - let arenas = ty::AllArenas::new(); + let mut arenas = ty::AllArenas::new(); let hir_map = hir_map::map_crate(&sess, &cstore, &mut hir_forest, &defs); - // run just enough stuff to build a tcx: + // Run just enough stuff to build a tcx. let (tx, _rx) = mpsc::channel(); let outputs = OutputFilenames { out_directory: PathBuf::new(), @@ -169,7 +154,7 @@ fn test_env_with_pool( &cstore, ty::query::Providers::default(), ty::query::Providers::default(), - &arenas, + &mut arenas, resolutions, hir_map, OnDiskCache::new_empty(sess.source_map()), @@ -186,7 +171,7 @@ fn test_env_with_pool( param_env: param_env, }); let outlives_env = OutlivesEnvironment::new(param_env); - let def_id = tcx.hir.local_def_id(ast::CRATE_NODE_ID); + let def_id = tcx.hir().local_def_id(ast::CRATE_NODE_ID); infcx.resolve_regions_and_report_errors( def_id, ®ion_scope_tree, @@ -228,8 +213,8 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> { } pub fn create_simple_region_hierarchy(&mut self) { - // creates a region hierarchy where 1 is root, 10 and 11 are - // children of 1, etc + // Creates a region hierarchy where 1 is root, 10 and 11 are + // children of 1, etc. let dscope = region::Scope { id: hir::ItemLocalId::from_u32(1), @@ -256,7 +241,7 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> { #[allow(dead_code)] // this seems like it could be useful, even if we don't use it now pub fn lookup_item(&self, names: &[String]) -> ast::NodeId { - return match search_mod(self, &self.infcx.tcx.hir.krate().module, 0, names) { + return match search_mod(self, &self.infcx.tcx.hir().krate().module, 0, names) { Some(id) => id, None => { panic!("no item found: `{}`", names.join("::")); @@ -271,8 +256,8 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> { ) -> Option { assert!(idx < names.len()); for item in &m.item_ids { - let item = this.infcx.tcx.hir.expect_item(item.id); - if item.name.to_string() == names[idx] { + let item = this.infcx.tcx.hir().expect_item(item.id); + if item.ident.to_string() == names[idx] { return search(this, item, idx + 1, names); } } @@ -364,7 +349,7 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> { self.infcx .tcx .mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { - def_id: self.infcx.tcx.hir.local_def_id(ast::CRATE_NODE_ID), + def_id: self.infcx.tcx.hir().local_def_id(ast::CRATE_NODE_ID), index, name, })) @@ -410,7 +395,7 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> { pub fn re_free(&self, id: u32) -> ty::Region<'tcx> { self.infcx.tcx.mk_region(ty::ReFree(ty::FreeRegion { - scope: self.infcx.tcx.hir.local_def_id(ast::CRATE_NODE_ID), + scope: self.infcx.tcx.hir().local_def_id(ast::CRATE_NODE_ID), bound_region: ty::BrAnon(id), })) } @@ -434,7 +419,7 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> { obligations, value: (), }) => { - // None of these tests should require nested obligations: + // None of these tests should require nested obligations. assert!(obligations.is_empty()); } Err(ref e) => { @@ -442,17 +427,6 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> { } } } - - /// Checks that `t1 <: t2` is false (this may register additional - /// region checks). - pub fn check_not_sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) { - match self.sub(t1, t2) { - Err(_) => {} - Ok(_) => { - panic!("unexpected success computing sub({:?},{:?})", t1, t2); - } - } - } } #[test] @@ -476,37 +450,18 @@ fn contravariant_region_ptr_err() { env.assert_eq(t_rptr1, t_rptr1); env.assert_eq(t_rptr10, t_rptr10); - // will cause an error when regions are resolved + // This will cause an error when regions are resolved. env.make_subtype(t_rptr10, t_rptr1); }) } -#[test] -fn sub_free_bound_false() { - //! Test that: - //! - //! fn(&'a isize) <: for<'b> fn(&'b isize) - //! - //! does NOT hold. - - test_env(EMPTY_SOURCE_STR, errors(&[]), |mut env| { - env.create_simple_region_hierarchy(); - let t_rptr_free1 = env.t_rptr_free(1); - let t_rptr_bound1 = env.t_rptr_late_bound(1); - env.check_not_sub( - env.t_fn(&[t_rptr_free1], env.tcx().types.isize), - env.t_fn(&[t_rptr_bound1], env.tcx().types.isize), - ); - }) -} - #[test] fn sub_bound_free_true() { //! Test that: //! //! for<'a> fn(&'a isize) <: fn(&'b isize) //! - //! DOES hold. + //! *does* hold. test_env(EMPTY_SOURCE_STR, errors(&[]), |mut env| { env.create_simple_region_hierarchy(); @@ -519,25 +474,6 @@ fn sub_bound_free_true() { }) } -#[test] -fn sub_free_bound_false_infer() { - //! Test that: - //! - //! fn(_#1) <: for<'b> fn(&'b isize) - //! - //! does NOT hold for any instantiation of `_#1`. - - test_env(EMPTY_SOURCE_STR, errors(&[]), |env| { - let t_infer1 = env.infcx - .next_ty_var(TypeVariableOrigin::MiscVariable(DUMMY_SP)); - let t_rptr_bound1 = env.t_rptr_late_bound(1); - env.check_not_sub( - env.t_fn(&[t_infer1], env.tcx().types.isize), - env.t_fn(&[t_rptr_bound1], env.tcx().types.isize), - ); - }) -} - /// Test substituting a bound region into a function, which introduces another level of binding. /// This requires adjusting the Debruijn index. #[test] @@ -578,11 +514,11 @@ fn subst_ty_renumber_bound() { fn subst_ty_renumber_some_bounds() { test_env(EMPTY_SOURCE_STR, errors(&[]), |env| { // Situation: - // Theta = [A -> &'a foo] + // `Theta = [A -> &'a foo]` let t_rptr_bound1 = env.t_rptr_late_bound(1); - // t_source = (A, fn(A)) + // `t_source = (A, fn(A))` let t_source = { let t_param = env.t_param(0); env.t_pair(t_param, env.t_fn(&[t_param], env.t_nil())) @@ -591,9 +527,9 @@ fn subst_ty_renumber_some_bounds() { let substs = env.infcx.tcx.intern_substs(&[t_rptr_bound1.into()]); let t_substituted = t_source.subst(env.infcx.tcx, substs); - // t_expected = (&'a isize, fn(&'a isize)) + // `t_expected = (&'a isize, fn(&'a isize))` // - // but not that the Debruijn index is different in the different cases. + // However, note that the Debruijn index is different in the different cases. let t_expected = { let t_rptr_bound2 = env.t_rptr_late_bound_with_debruijn(1, d2()); env.t_pair(t_rptr_bound1, env.t_fn(&[t_rptr_bound2], env.t_nil())) @@ -613,7 +549,7 @@ fn subst_ty_renumber_some_bounds() { fn escaping() { test_env(EMPTY_SOURCE_STR, errors(&[]), |mut env| { // Situation: - // Theta = [A -> &'a foo] + // `Theta = [A -> &'a foo]` env.create_simple_region_hierarchy(); assert!(!env.t_nil().has_escaping_bound_vars()); @@ -627,7 +563,7 @@ fn escaping() { let t_rptr_bound2 = env.t_rptr_late_bound_with_debruijn(1, d2()); assert!(t_rptr_bound2.has_escaping_bound_vars()); - // t_fn = fn(A) + // `t_fn = fn(A)` let t_param = env.t_param(0); assert!(!t_param.has_escaping_bound_vars()); let t_fn = env.t_fn(&[t_param], env.t_nil()); @@ -642,7 +578,7 @@ fn subst_region_renumber_region() { test_env(EMPTY_SOURCE_STR, errors(&[]), |env| { let re_bound1 = env.re_late_bound_with_debruijn(1, d1()); - // type t_source<'a> = fn(&'a isize) + // `type t_source<'a> = fn(&'a isize)` let t_source = { let re_early = env.re_early_bound(0, "'a"); env.t_fn(&[env.t_rptr(re_early)], env.t_nil()) @@ -651,7 +587,7 @@ fn subst_region_renumber_region() { let substs = env.infcx.tcx.intern_substs(&[re_bound1.into()]); let t_substituted = t_source.subst(env.infcx.tcx, substs); - // t_expected = fn(&'a isize) + // `t_expected = fn(&'a isize)` // // but not that the Debruijn index is different in the different cases. let t_expected = { diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index a323282f233..06a1761a1e7 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use CodeSuggestion; use SubstitutionPart; use Substitution; @@ -139,6 +129,17 @@ impl Diagnostic { self } + pub fn replace_span_with(&mut self, after: Span) -> &mut Self { + let before = self.span.clone(); + self.set_span(after); + for span_label in before.span_labels() { + if let Some(label) = span_label.label { + self.span_label(after, label); + } + } + self + } + pub fn note_expected_found(&mut self, label: &dyn fmt::Display, expected: DiagnosticStyledString, @@ -228,59 +229,7 @@ impl Diagnostic { self } - /// Prints out a message with a suggested edit of the code. If the suggestion is presented - /// inline it will only show the text message and not the text. - /// - /// See `CodeSuggestion` for more information. - #[deprecated(note = "Use `span_suggestion_short_with_applicability`")] - pub fn span_suggestion_short(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self { - self.suggestions.push(CodeSuggestion { - substitutions: vec![Substitution { - parts: vec![SubstitutionPart { - snippet: suggestion, - span: sp, - }], - }], - msg: msg.to_owned(), - show_code_when_inline: false, - applicability: Applicability::Unspecified, - }); - self - } - - /// Prints out a message with a suggested edit of the code. - /// - /// In case of short messages and a simple suggestion, - /// rustc displays it as a label like - /// - /// "try adding parentheses: `(tup.0).1`" - /// - /// The message - /// - /// * should not end in any punctuation (a `:` is added automatically) - /// * should not be a question - /// * should not contain any parts like "the following", "as shown" - /// * may look like "to do xyz, use" or "to do xyz, use abc" - /// * may contain a name of a function, variable or type, but not whole expressions - /// - /// See `CodeSuggestion` for more information. - #[deprecated(note = "Use `span_suggestion_with_applicability`")] - pub fn span_suggestion(&mut self, sp: Span, msg: &str, suggestion: String) -> &mut Self { - self.suggestions.push(CodeSuggestion { - substitutions: vec![Substitution { - parts: vec![SubstitutionPart { - snippet: suggestion, - span: sp, - }], - }], - msg: msg.to_owned(), - show_code_when_inline: true, - applicability: Applicability::Unspecified, - }); - self - } - - pub fn multipart_suggestion_with_applicability( + pub fn multipart_suggestion( &mut self, msg: &str, suggestion: Vec<(Span, String)>, @@ -300,39 +249,24 @@ impl Diagnostic { self } - #[deprecated(note = "Use `multipart_suggestion_with_applicability`")] - pub fn multipart_suggestion( - &mut self, - msg: &str, - suggestion: Vec<(Span, String)>, - ) -> &mut Self { - self.multipart_suggestion_with_applicability( - msg, - suggestion, - Applicability::Unspecified, - ) - } - - /// Prints out a message with multiple suggested edits of the code. - #[deprecated(note = "Use `span_suggestions_with_applicability`")] - pub fn span_suggestions(&mut self, sp: Span, msg: &str, suggestions: Vec) -> &mut Self { - self.suggestions.push(CodeSuggestion { - substitutions: suggestions.into_iter().map(|snippet| Substitution { - parts: vec![SubstitutionPart { - snippet, - span: sp, - }], - }).collect(), - msg: msg.to_owned(), - show_code_when_inline: true, - applicability: Applicability::Unspecified, - }); - self - } - - /// This is a suggestion that may contain mistakes or fillers and should - /// be read and understood by a human. - pub fn span_suggestion_with_applicability(&mut self, sp: Span, msg: &str, + /// Prints out a message with a suggested edit of the code. + /// + /// In case of short messages and a simple suggestion, rustc displays it as a label: + /// + /// ```text + /// try adding parentheses: `(tup.0).1` + /// ``` + /// + /// The message + /// + /// * should not end in any punctuation (a `:` is added automatically) + /// * should not be a question (avoid language like "did you mean") + /// * should not contain any phrases like "the following", "as shown", etc. + /// * may look like "to do xyz, use" or "to do xyz, use abc" + /// * may contain a name of a function, variable, or type, but not whole expressions + /// + /// See `CodeSuggestion` for more information. + pub fn span_suggestion(&mut self, sp: Span, msg: &str, suggestion: String, applicability: Applicability) -> &mut Self { self.suggestions.push(CodeSuggestion { @@ -349,7 +283,8 @@ impl Diagnostic { self } - pub fn span_suggestions_with_applicability(&mut self, sp: Span, msg: &str, + /// Prints out a message with multiple suggested edits of the code. + pub fn span_suggestions(&mut self, sp: Span, msg: &str, suggestions: impl Iterator, applicability: Applicability) -> &mut Self { self.suggestions.push(CodeSuggestion { @@ -366,7 +301,11 @@ impl Diagnostic { self } - pub fn span_suggestion_short_with_applicability( + /// Prints out a message with a suggested edit of the code. If the suggestion is presented + /// inline, it will only show the message and not the suggestion. + /// + /// See `CodeSuggestion` for more information. + pub fn span_suggestion_short( &mut self, sp: Span, msg: &str, suggestion: String, applicability: Applicability ) -> &mut Self { self.suggestions.push(CodeSuggestion { diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 2f16470530e..f423a4cd1a7 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use Diagnostic; use DiagnosticId; use DiagnosticStyledString; @@ -43,18 +33,24 @@ pub struct DiagnosticBuilder<'a> { /// it easy to declare such methods on the builder. macro_rules! forward { // Forward pattern for &self -> &Self - (pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)*) -> &Self) => { + ( + $(#[$attrs:meta])* + pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)*) -> &Self + ) => { + $(#[$attrs])* pub fn $n(&self, $($name: $ty),*) -> &Self { - #[allow(deprecated)] self.diagnostic.$n($($name),*); self } }; // Forward pattern for &mut self -> &mut Self - (pub fn $n:ident(&mut self, $($name:ident: $ty:ty),* $(,)*) -> &mut Self) => { + ( + $(#[$attrs:meta])* + pub fn $n:ident(&mut self, $($name:ident: $ty:ty),* $(,)*) -> &mut Self + ) => { + $(#[$attrs])* pub fn $n(&mut self, $($name: $ty),*) -> &mut Self { - #[allow(deprecated)] self.diagnostic.$n($($name),*); self } @@ -62,12 +58,16 @@ macro_rules! forward { // Forward pattern for &mut self -> &mut Self, with S: Into // type parameter. No obvious way to make this more generic. - (pub fn $n:ident>( - &mut self, - $($name:ident: $ty:ty),* - $(,)*) -> &mut Self) => { + ( + $(#[$attrs:meta])* + pub fn $n:ident>( + &mut self, + $($name:ident: $ty:ty),* + $(,)* + ) -> &mut Self + ) => { + $(#[$attrs])* pub fn $n>(&mut self, $($name: $ty),*) -> &mut Self { - #[allow(deprecated)] self.diagnostic.$n($($name),*); self } @@ -187,44 +187,16 @@ impl<'a> DiagnosticBuilder<'a> { msg: &str, ) -> &mut Self); - #[deprecated(note = "Use `span_suggestion_short_with_applicability`")] - forward!(pub fn span_suggestion_short( - &mut self, - sp: Span, - msg: &str, - suggestion: String, - ) -> &mut Self); - - #[deprecated(note = "Use `multipart_suggestion_with_applicability`")] - forward!(pub fn multipart_suggestion( + pub fn multipart_suggestion( &mut self, msg: &str, suggestion: Vec<(Span, String)>, - ) -> &mut Self); - - #[deprecated(note = "Use `span_suggestion_with_applicability`")] - forward!(pub fn span_suggestion(&mut self, - sp: Span, - msg: &str, - suggestion: String, - ) -> &mut Self); - - #[deprecated(note = "Use `span_suggestions_with_applicability`")] - forward!(pub fn span_suggestions(&mut self, - sp: Span, - msg: &str, - suggestions: Vec, - ) -> &mut Self); - - pub fn multipart_suggestion_with_applicability(&mut self, - msg: &str, - suggestion: Vec<(Span, String)>, - applicability: Applicability, - ) -> &mut Self { + applicability: Applicability, + ) -> &mut Self { if !self.allow_suggestions { return self } - self.diagnostic.multipart_suggestion_with_applicability( + self.diagnostic.multipart_suggestion( msg, suggestion, applicability, @@ -232,16 +204,17 @@ impl<'a> DiagnosticBuilder<'a> { self } - pub fn span_suggestion_with_applicability(&mut self, - sp: Span, - msg: &str, - suggestion: String, - applicability: Applicability) - -> &mut Self { + pub fn span_suggestion( + &mut self, + sp: Span, + msg: &str, + suggestion: String, + applicability: Applicability, + ) -> &mut Self { if !self.allow_suggestions { return self } - self.diagnostic.span_suggestion_with_applicability( + self.diagnostic.span_suggestion( sp, msg, suggestion, @@ -250,16 +223,17 @@ impl<'a> DiagnosticBuilder<'a> { self } - pub fn span_suggestions_with_applicability(&mut self, - sp: Span, - msg: &str, - suggestions: impl Iterator, - applicability: Applicability) - -> &mut Self { + pub fn span_suggestions( + &mut self, + sp: Span, + msg: &str, + suggestions: impl Iterator, + applicability: Applicability, + ) -> &mut Self { if !self.allow_suggestions { return self } - self.diagnostic.span_suggestions_with_applicability( + self.diagnostic.span_suggestions( sp, msg, suggestions, @@ -268,16 +242,17 @@ impl<'a> DiagnosticBuilder<'a> { self } - pub fn span_suggestion_short_with_applicability(&mut self, - sp: Span, - msg: &str, - suggestion: String, - applicability: Applicability) - -> &mut Self { + pub fn span_suggestion_short( + &mut self, + sp: Span, + msg: &str, + suggestion: String, + applicability: Applicability, + ) -> &mut Self { if !self.allow_suggestions { return self } - self.diagnostic.span_suggestion_short_with_applicability( + self.diagnostic.span_suggestion_short( sp, msg, suggestion, diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 7e69e98071d..25d09a33c15 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use self::Destination::*; use syntax_pos::{SourceFile, Span, MultiSpan}; @@ -549,7 +539,7 @@ impl EmitterWriter { // 3 | // 4 | } // | - for pos in 0..line_len + 1 { + for pos in 0..=line_len { draw_col_separator(buffer, line_offset + pos + 1, width_offset - 2); buffer.putc(line_offset + pos + 1, width_offset - 2, @@ -617,7 +607,7 @@ impl EmitterWriter { let pos = pos + 1; if pos > 1 && (annotation.has_label() || annotation.takes_space()) { - for p in line_offset + 1..line_offset + pos + 1 { + for p in line_offset + 1..=line_offset + pos { buffer.putc(p, code_offset + annotation.start_col, '|', @@ -634,7 +624,7 @@ impl EmitterWriter { } } AnnotationType::MultilineEnd(depth) => { - for p in line_offset..line_offset + pos + 1 { + for p in line_offset..=line_offset + pos { buffer.putc(p, width_offset + depth - 1, '|', @@ -969,7 +959,7 @@ impl EmitterWriter { Style::MainHeaderMsg }; - if msp.primary_spans().is_empty() && msp.span_labels().is_empty() && is_secondary + if !msp.has_primary_spans() && !msp.has_span_labels() && is_secondary && !self.short_message { // This is a secondary message with no span info for _ in 0..max_line_num_len { @@ -1044,7 +1034,7 @@ impl EmitterWriter { buffer.append(buffer_msg_line_offset, &format!("{}:{}:{}", loc.file.name, - sm.doctest_offset_line(loc.line), + sm.doctest_offset_line(&loc.file.name, loc.line), loc.col.0 + 1), Style::LineAndColumn); for _ in 0..max_line_num_len { @@ -1054,7 +1044,7 @@ impl EmitterWriter { buffer.prepend(0, &format!("{}:{}:{}: ", loc.file.name, - sm.doctest_offset_line(loc.line), + sm.doctest_offset_line(&loc.file.name, loc.line), loc.col.0 + 1), Style::LineAndColumn); } @@ -1075,7 +1065,8 @@ impl EmitterWriter { }; format!("{}:{}{}", annotated_file.file.name, - sm.doctest_offset_line(first_line.line_index), + sm.doctest_offset_line( + &annotated_file.file.name, first_line.line_index), col) } else { annotated_file.file.name.to_string() @@ -1261,7 +1252,7 @@ impl EmitterWriter { // Do not underline the leading... let start = part.snippet.len() - .saturating_sub(part.snippet.trim_left().len()); + .saturating_sub(part.snippet.trim_start().len()); // ...or trailing spaces. Account for substitutions containing unicode // characters. let sub_len = part.snippet.trim().chars().fold(0, |acc, ch| { diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 0fb77a7a3ab..64d5ca0c2a7 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] @@ -36,15 +26,13 @@ use self::Level::*; use emitter::{Emitter, EmitterWriter}; -use rustc_data_structures::sync::{self, Lrc, Lock, LockCell}; +use rustc_data_structures::sync::{self, Lrc, Lock, AtomicUsize, AtomicBool, SeqCst}; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::stable_hasher::StableHasher; use std::borrow::Cow; use std::cell::Cell; use std::{error, fmt}; -use std::sync::atomic::AtomicUsize; -use std::sync::atomic::Ordering::SeqCst; use std::panic; use termcolor::{ColorSpec, Color}; @@ -66,12 +54,28 @@ use syntax_pos::{BytePos, Span, NO_EXPANSION}; +/// Indicates the confidence in the correctness of a suggestion. +/// +/// All suggestions are marked with an `Applicability`. Tools use the applicability of a suggestion +/// to determine whether it should be automatically applied or if the user should be consulted +/// before applying the suggestion. #[derive(Copy, Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)] pub enum Applicability { + /// The suggestion is definitely what the user intended. This suggestion should be + /// automatically applied. MachineApplicable, - HasPlaceholders, + + /// The suggestion may be what the user intended, but it is uncertain. The suggestion should + /// result in valid Rust code if it is applied. MaybeIncorrect, - Unspecified + + /// The suggestion contains placeholders like `(...)` or `{ /* fields */ }`. The suggestion + /// cannot be applied automatically because it will not result in valid Rust code. The user + /// will need to fill in the placeholders. + HasPlaceholders, + + /// The applicability of the suggestion is unknown. + Unspecified, } #[derive(Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)] @@ -130,7 +134,7 @@ pub trait SourceMapper { fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option; fn call_span_if_macro(&self, sp: Span) -> Span; fn ensure_source_file_source_present(&self, source_file: Lrc) -> bool; - fn doctest_offset_line(&self, line: usize) -> usize; + fn doctest_offset_line(&self, file: &FileName, line: usize) -> usize; } impl CodeSuggestion { @@ -147,10 +151,11 @@ impl CodeSuggestion { if let Some(line) = line_opt { if let Some(lo) = line.char_indices().map(|(i, _)| i).nth(lo) { let hi_opt = hi_opt.and_then(|hi| line.char_indices().map(|(i, _)| i).nth(hi)); - buf.push_str(match hi_opt { - Some(hi) => &line[lo..hi], - None => &line[lo..], - }); + match hi_opt { + Some(hi) if hi > lo => buf.push_str(&line[lo..hi]), + Some(_) => (), + None => buf.push_str(&line[lo..]), + } } if let None = hi_opt { buf.push('\n'); @@ -281,7 +286,7 @@ pub struct Handler { err_count: AtomicUsize, emitter: Lock>, - continue_after_error: LockCell, + continue_after_error: AtomicBool, delayed_span_bugs: Lock>, // This set contains the `DiagnosticId` of all emitted diagnostics to avoid @@ -380,7 +385,7 @@ impl Handler { flags, err_count: AtomicUsize::new(0), emitter: Lock::new(e), - continue_after_error: LockCell::new(true), + continue_after_error: AtomicBool::new(true), delayed_span_bugs: Lock::new(Vec::new()), taught_diagnostics: Default::default(), emitted_diagnostic_codes: Default::default(), @@ -389,7 +394,7 @@ impl Handler { } pub fn set_continue_after_error(&self, continue_after_error: bool) { - self.continue_after_error.set(continue_after_error); + self.continue_after_error.store(continue_after_error, SeqCst); } /// Resets the diagnostic error count as well as the cached emitted diagnostics. @@ -668,7 +673,7 @@ impl Handler { let mut db = DiagnosticBuilder::new(self, lvl, msg); db.set_span(msp.clone()); db.emit(); - if !self.continue_after_error.get() { + if !self.continue_after_error.load(SeqCst) { self.abort_if_errors(); } } @@ -679,7 +684,7 @@ impl Handler { let mut db = DiagnosticBuilder::new_with_code(self, lvl, Some(code), msg); db.set_span(msp.clone()); db.emit(); - if !self.continue_after_error.get() { + if !self.continue_after_error.load(SeqCst) { self.abort_if_errors(); } } diff --git a/src/librustc_errors/lock.rs b/src/librustc_errors/lock.rs index ff323073c62..f731791efe6 100644 --- a/src/librustc_errors/lock.rs +++ b/src/librustc_errors/lock.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Bindings to acquire a global named lock. //! //! This is intended to be used to synchronize multiple compiler processes to diff --git a/src/librustc_errors/registry.rs b/src/librustc_errors/registry.rs index 9a2302171ba..771542cb06f 100644 --- a/src/librustc_errors/registry.rs +++ b/src/librustc_errors/registry.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::fx::FxHashMap; #[derive(Clone)] diff --git a/src/librustc_errors/snippet.rs b/src/librustc_errors/snippet.rs index 002261dc1a5..da1da77f398 100644 --- a/src/librustc_errors/snippet.rs +++ b/src/librustc_errors/snippet.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Code for annotating snippets. use Level; diff --git a/src/librustc_errors/styled_buffer.rs b/src/librustc_errors/styled_buffer.rs index 2c736ec22c3..880f09e75e3 100644 --- a/src/librustc_errors/styled_buffer.rs +++ b/src/librustc_errors/styled_buffer.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Code for creating styled buffers use snippet::{Style, StyledString}; diff --git a/src/librustc_fs_util/lib.rs b/src/librustc_fs_util/lib.rs index ffe420b109d..74ff121f803 100644 --- a/src/librustc_fs_util/lib.rs +++ b/src/librustc_fs_util/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::path::{Path, PathBuf}; use std::ffi::CString; use std::fs; @@ -116,13 +106,13 @@ pub fn rename_or_copy_remove, Q: AsRef>(p: P, } #[cfg(unix)] -pub fn path2cstr(p: &Path) -> CString { - use std::os::unix::prelude::*; +pub fn path_to_c_string(p: &Path) -> CString { + use std::os::unix::ffi::OsStrExt; use std::ffi::OsStr; let p: &OsStr = p.as_ref(); CString::new(p.as_bytes()).unwrap() } #[cfg(windows)] -pub fn path2cstr(p: &Path) -> CString { +pub fn path_to_c_string(p: &Path) -> CString { CString::new(p.to_str().unwrap()).unwrap() } diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index 22a0cc983da..57ab48493fa 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This pass is only used for the UNIT TESTS and DEBUGGING NEEDS //! around dependency graph construction. It serves two purposes; it //! will dump graphs in graphviz form to disk, and it searches for @@ -79,8 +69,8 @@ pub fn assert_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { let mut visitor = IfThisChanged { tcx, if_this_changed: vec![], then_this_would_need: vec![] }; - visitor.process_attrs(ast::CRATE_NODE_ID, &tcx.hir.krate().attrs); - tcx.hir.krate().visit_all_item_likes(&mut visitor.as_deep_visitor()); + visitor.process_attrs(ast::CRATE_NODE_ID, &tcx.hir().krate().attrs); + tcx.hir().krate().visit_all_item_likes(&mut visitor.as_deep_visitor()); (visitor.if_this_changed, visitor.then_this_would_need) }; @@ -121,7 +111,7 @@ impl<'a, 'tcx> IfThisChanged<'a, 'tcx> { } fn process_attrs(&mut self, node_id: ast::NodeId, attrs: &[ast::Attribute]) { - let def_id = self.tcx.hir.local_def_id(node_id); + let def_id = self.tcx.hir().local_def_id(node_id); let def_path_hash = self.tcx.def_path_hash(def_id); for attr in attrs { if attr.check_name(ATTR_IF_THIS_CHANGED) { @@ -170,7 +160,7 @@ impl<'a, 'tcx> IfThisChanged<'a, 'tcx> { impl<'a, 'tcx> Visitor<'tcx> for IfThisChanged<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::OnlyBodies(&self.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } fn visit_item(&mut self, item: &'tcx hir::Item) { diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index 4ff2529b26d..5cbb412052d 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This pass is only used for UNIT TESTS related to incremental //! compilation. It tests whether a particular `.o` file will be re-used //! from a previous compilation or whether it must be regenerated. @@ -40,9 +30,9 @@ use syntax::ast; use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_CODEGENED, ATTR_EXPECTED_CGU_REUSE}; -const MODULE: &'static str = "module"; -const CFG: &'static str = "cfg"; -const KIND: &'static str = "kind"; +const MODULE: &str = "module"; +const CFG: &str = "cfg"; +const KIND: &str = "kind"; pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { @@ -62,7 +52,7 @@ pub fn assert_module_sources<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { available_cgus }; - for attr in &tcx.hir.krate().attrs { + for attr in &tcx.hir().krate().attrs { ams.check_attr(attr); } }) diff --git a/src/librustc_incremental/build.rs b/src/librustc_incremental/build.rs index f18a3f9b940..d230ba91039 100644 --- a/src/librustc_incremental/build.rs +++ b/src/librustc_incremental/build.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-env-changed=CFG_VERSION"); diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs index d0897a96182..ae2e6e0b94c 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Support for serializing the dep-graph and reloading it. #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", diff --git a/src/librustc_incremental/persist/data.rs b/src/librustc_incremental/persist/data.rs index d7d142aac75..49b4bb06114 100644 --- a/src/librustc_incremental/persist/data.rs +++ b/src/librustc_incremental/persist/data.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The data that we will serialize and deserialize. use rustc::dep_graph::{WorkProduct, WorkProductId}; diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index f76086139ed..3ff4d2ec38d 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Debugging code to test fingerprints computed for query results. //! For each node marked with `#[rustc_clean]` or `#[rustc_dirty]`, //! we will compare the fingerprint from the current and from the previous @@ -78,7 +68,7 @@ const BASE_IMPL: &[&str] = &[ ]; /// DepNodes for MirValidated/Optimized, which is relevant in "executable" -/// code, i.e. functions+methods +/// code, i.e., functions+methods const BASE_MIR: &[&str] = &[ label_strs::MirOptimized, label_strs::MirValidated, @@ -223,7 +213,7 @@ pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { } tcx.dep_graph.with_ignore(|| { - let krate = tcx.hir.krate(); + let krate = tcx.hir().krate(); let mut dirty_clean_visitor = DirtyCleanVisitor { tcx, checked_attrs: Default::default(), @@ -333,7 +323,7 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { /// Return all DepNode labels that should be asserted for this item. /// index=0 is the "name" used for error messages fn auto_labels(&mut self, item_id: ast::NodeId, attr: &Attribute) -> (&'static str, Labels) { - let node = self.tcx.hir.get(item_id); + let node = self.tcx.hir().get(item_id); let (name, labels) = match node { HirNode::Item(item) => { match item.node { @@ -364,16 +354,16 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { // Module-level inline assembly (from global_asm!) HirItem::GlobalAsm(..) => ("ItemGlobalAsm", LABELS_HIR_ONLY), - // A type alias, e.g. `type Foo = Bar` + // A type alias, e.g., `type Foo = Bar` HirItem::Ty(..) => ("ItemTy", LABELS_HIR_ONLY), - // An enum definition, e.g. `enum Foo {C, D}` + // An enum definition, e.g., `enum Foo {C, D}` HirItem::Enum(..) => ("ItemEnum", LABELS_ADT), - // A struct definition, e.g. `struct Foo {x: A}` + // A struct definition, e.g., `struct Foo {x: A}` HirItem::Struct(..) => ("ItemStruct", LABELS_ADT), - // A union definition, e.g. `union Foo {x: A, y: B}` + // A union definition, e.g., `union Foo {x: A, y: B}` HirItem::Union(..) => ("ItemUnion", LABELS_ADT), // Represents a Trait Declaration @@ -511,7 +501,7 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { } fn check_item(&mut self, item_id: ast::NodeId, item_span: Span) { - let def_id = self.tcx.hir.local_def_id(item_id); + let def_id = self.tcx.hir().local_def_id(item_id); for attr in self.tcx.get_attrs(def_id).iter() { let assertion = match self.assertion_maybe(item_id, attr) { Some(a) => a, @@ -630,7 +620,7 @@ impl<'a, 'tcx> FindAllAttrs<'a, 'tcx> { impl<'a, 'tcx> intravisit::Visitor<'tcx> for FindAllAttrs<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> { - intravisit::NestedVisitorMap::All(&self.tcx.hir) + intravisit::NestedVisitorMap::All(&self.tcx.hir()) } fn visit_attribute(&mut self, attr: &'tcx Attribute) { diff --git a/src/librustc_incremental/persist/file_format.rs b/src/librustc_incremental/persist/file_format.rs index 98f7873fda0..3b88a14f3a2 100644 --- a/src/librustc_incremental/persist/file_format.rs +++ b/src/librustc_incremental/persist/file_format.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module defines a generic file format that allows to check if a given //! file generated by incremental compilation was generated by a compatible //! compiler version. This file format is used for the on-disk version of the @@ -28,7 +18,7 @@ use rustc::session::config::nightly_options; use rustc_serialize::opaque::Encoder; /// The first few bytes of files generated by incremental compilation -const FILE_MAGIC: &'static [u8] = b"RSIC"; +const FILE_MAGIC: &[u8] = b"RSIC"; /// Change this if the header format changes const HEADER_FORMAT_VERSION: u16 = 0; @@ -36,7 +26,7 @@ const HEADER_FORMAT_VERSION: u16 = 0; /// A version string that hopefully is always different for compiler versions /// with different encodings of incremental compilation artifacts. Contains /// the git commit hash. -const RUSTC_VERSION: Option<&'static str> = option_env!("CFG_VERSION"); +const RUSTC_VERSION: Option<&str> = option_env!("CFG_VERSION"); pub fn write_file_header(stream: &mut Encoder) { stream.emit_raw_bytes(FILE_MAGIC); diff --git a/src/librustc_incremental/persist/fs.rs b/src/librustc_incremental/persist/fs.rs index 2a8a0baf571..ff8b76829eb 100644 --- a/src/librustc_incremental/persist/fs.rs +++ b/src/librustc_incremental/persist/fs.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - //! This module manages how the incremental compilation cache is represented in //! the file system. //! @@ -128,10 +117,10 @@ use std::time::{UNIX_EPOCH, SystemTime, Duration}; use rand::{RngCore, thread_rng}; -const LOCK_FILE_EXT: &'static str = ".lock"; -const DEP_GRAPH_FILENAME: &'static str = "dep-graph.bin"; -const WORK_PRODUCTS_FILENAME: &'static str = "work-products.bin"; -const QUERY_CACHE_FILENAME: &'static str = "query-cache.bin"; +const LOCK_FILE_EXT: &str = ".lock"; +const DEP_GRAPH_FILENAME: &str = "dep-graph.bin"; +const WORK_PRODUCTS_FILENAME: &str = "work-products.bin"; +const QUERY_CACHE_FILENAME: &str = "query-cache.bin"; // We encode integers using the following base, so they are shorter than decimal // or hexadecimal numbers (we want short file and directory names). Since these @@ -354,7 +343,7 @@ pub fn finalize_session_directory(sess: &Session, svh: Svh) { } // State: "s-{timestamp}-{random-number}-" - let mut new_sub_dir_name = String::from(&old_sub_dir_name[.. dash_indices[2] + 1]); + let mut new_sub_dir_name = String::from(&old_sub_dir_name[..= dash_indices[2]]); // Append the svh base_n::push_str(svh.as_u64() as u128, INT_ENCODE_BASE, &mut new_sub_dir_name); @@ -659,7 +648,7 @@ pub fn garbage_collect_session_directories(sess: &Session) -> io::Result<()> { let mut session_directories = FxHashSet::default(); let mut lock_files = FxHashSet::default(); - for dir_entry in try!(crate_directory.read_dir()) { + for dir_entry in crate_directory.read_dir()? { let dir_entry = match dir_entry { Ok(dir_entry) => dir_entry, _ => { @@ -887,7 +876,7 @@ fn all_except_most_recent(deletion_candidates: Vec<(SystemTime, PathBuf, Option< /// into the '\\?\' format, which supports much longer paths. fn safe_remove_dir_all(p: &Path) -> io::Result<()> { if p.exists() { - let canonicalized = try!(p.canonicalize()); + let canonicalized = p.canonicalize()?; std_fs::remove_dir_all(canonicalized) } else { Ok(()) @@ -896,7 +885,7 @@ fn safe_remove_dir_all(p: &Path) -> io::Result<()> { fn safe_remove_file(p: &Path) -> io::Result<()> { if p.exists() { - let canonicalized = try!(p.canonicalize()); + let canonicalized = p.canonicalize()?; std_fs::remove_file(canonicalized) } else { Ok(()) diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs index 2f7e1af1ff6..f330de71918 100644 --- a/src/librustc_incremental/persist/load.rs +++ b/src/librustc_incremental/persist/load.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Code to save/load the dep-graph from files. use rustc_data_structures::fx::FxHashMap; diff --git a/src/librustc_incremental/persist/mod.rs b/src/librustc_incremental/persist/mod.rs index 17d36ba3fa7..bd59f24d04e 100644 --- a/src/librustc_incremental/persist/mod.rs +++ b/src/librustc_incremental/persist/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! When in incremental mode, this pass dumps out the dependency graph //! into the given directory. At the same time, it also hashes the //! various HIR nodes. diff --git a/src/librustc_incremental/persist/save.rs b/src/librustc_incremental/persist/save.rs index 6279df4e580..6a7553b3882 100644 --- a/src/librustc_incremental/persist/save.rs +++ b/src/librustc_incremental/persist/save.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::dep_graph::{DepGraph, DepKind, WorkProduct, WorkProductId}; use rustc::session::Session; use rustc::ty::TyCtxt; @@ -159,8 +149,6 @@ fn encode_dep_graph(tcx: TyCtxt, let total_node_count = serialized_graph.nodes.len(); let total_edge_count = serialized_graph.edge_list_data.len(); - let (total_edge_reads, total_duplicate_edge_reads) = - tcx.dep_graph.edge_deduplication_data(); let mut counts: FxHashMap<_, Stat> = FxHashMap::default(); @@ -198,8 +186,11 @@ fn encode_dep_graph(tcx: TyCtxt, println!("[incremental]"); println!("[incremental] Total Node Count: {}", total_node_count); println!("[incremental] Total Edge Count: {}", total_edge_count); - println!("[incremental] Total Edge Reads: {}", total_edge_reads); - println!("[incremental] Total Duplicate Edge Reads: {}", total_duplicate_edge_reads); + if let Some((total_edge_reads, + total_duplicate_edge_reads)) = tcx.dep_graph.edge_deduplication_data() { + println!("[incremental] Total Edge Reads: {}", total_edge_reads); + println!("[incremental] Total Duplicate Edge Reads: {}", total_duplicate_edge_reads); + } println!("[incremental]"); println!("[incremental] {:<36}| {:<17}| {:<12}| {:<17}|", "Node Kind", diff --git a/src/librustc_incremental/persist/work_product.rs b/src/librustc_incremental/persist/work_product.rs index cfe59b1f672..535f6930aa3 100644 --- a/src/librustc_incremental/persist/work_product.rs +++ b/src/librustc_incremental/persist/work_product.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains files for saving intermediate work-products. use persist::fs::*; @@ -29,7 +19,7 @@ pub fn copy_cgu_workproducts_to_incr_comp_cache_dir( return None } - let saved_files: Option> = + let saved_files = files.iter() .map(|&(kind, ref path)| { let extension = match kind { @@ -51,11 +41,7 @@ pub fn copy_cgu_workproducts_to_incr_comp_cache_dir( } } }) - .collect(); - let saved_files = match saved_files { - None => return None, - Some(v) => v, - }; + .collect::>>()?; let work_product = WorkProduct { cgu_name: cgu_name.to_string(), diff --git a/src/librustc_lint/Cargo.toml b/src/librustc_lint/Cargo.toml index fe197e3e2e2..7fb7a06ea1a 100644 --- a/src/librustc_lint/Cargo.toml +++ b/src/librustc_lint/Cargo.toml @@ -12,7 +12,6 @@ test = false [dependencies] log = "0.4" rustc = { path = "../librustc" } -rustc_mir = { path = "../librustc_mir"} rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 7dd1ca3493e..46e784c4099 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Lints in the Rust compiler. //! //! This contains lints which can feasibly be implemented as their own @@ -29,7 +19,7 @@ //! a `pub fn new()`. use rustc::hir::def::Def; -use rustc::hir::def_id::DefId; +use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::ty::{self, Ty}; use hir::Node; use util::nodemap::NodeSet; @@ -45,14 +35,15 @@ use syntax::ast::Expr; use syntax::attr; use syntax::source_map::Spanned; use syntax::edition::Edition; -use syntax::feature_gate::{AttributeGate, AttributeType, Stability, deprecated_attributes}; +use syntax::feature_gate::{AttributeGate, AttributeTemplate, AttributeType}; +use syntax::feature_gate::{Stability, deprecated_attributes}; use syntax_pos::{BytePos, Span, SyntaxContext}; use syntax::symbol::keywords; use syntax::errors::{Applicability, DiagnosticBuilder}; use syntax::print::pprust::expr_to_string; +use syntax::visit::FnKind; use rustc::hir::{self, GenericParamKind, PatKind}; -use rustc::hir::intravisit::FnKind; use nonstandard_style::{MethodLateContext, method_context}; @@ -69,6 +60,10 @@ declare_lint! { pub struct WhileTrue; impl LintPass for WhileTrue { + fn name(&self) -> &'static str { + "WhileTrue" + } + fn get_lints(&self) -> LintArray { lint_array!(WHILE_TRUE) } @@ -83,7 +78,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for WhileTrue { let msg = "denote infinite loops with `loop { ... }`"; let condition_span = cx.tcx.sess.source_map().def_span(e.span); let mut err = cx.struct_span_lint(WHILE_TRUE, condition_span, msg); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( condition_span, "use `loop`", "loop".to_owned(), @@ -118,6 +113,10 @@ impl BoxPointers { } impl LintPass for BoxPointers { + fn name(&self) -> &'static str { + "BoxPointers" + } + fn get_lints(&self) -> LintArray { lint_array!(BOX_POINTERS) } @@ -131,7 +130,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers { hir::ItemKind::Enum(..) | hir::ItemKind::Struct(..) | hir::ItemKind::Union(..) => { - let def_id = cx.tcx.hir.local_def_id(it.id); + let def_id = cx.tcx.hir().local_def_id(it.id); self.check_heap_type(cx, it.span, cx.tcx.type_of(def_id)) } _ => () @@ -142,7 +141,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxPointers { hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { for struct_field in struct_def.fields() { - let def_id = cx.tcx.hir.local_def_id(struct_field.id); + let def_id = cx.tcx.hir().local_def_id(struct_field.id); self.check_heap_type(cx, struct_field.span, cx.tcx.type_of(def_id)); } @@ -167,6 +166,10 @@ declare_lint! { pub struct NonShorthandFieldPatterns; impl LintPass for NonShorthandFieldPatterns { + fn name(&self) -> &'static str { + "NonShorthandFieldPatterns" + } + fn get_lints(&self) -> LintArray { lint_array!(NON_SHORTHAND_FIELD_PATTERNS) } @@ -196,7 +199,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns { &format!("the `{}:` in this pattern is redundant", ident)); let subspan = cx.tcx.sess.source_map().span_through_char(fieldpat.span, ':'); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( subspan, "remove this", ident.to_string(), @@ -220,13 +223,17 @@ declare_lint! { pub struct UnsafeCode; impl LintPass for UnsafeCode { + fn name(&self) -> &'static str { + "UnsafeCode" + } + fn get_lints(&self) -> LintArray { lint_array!(UNSAFE_CODE) } } impl UnsafeCode { - fn report_unsafe(&self, cx: &LateContext, span: Span, desc: &'static str) { + fn report_unsafe(&self, cx: &EarlyContext, span: Span, desc: &'static str) { // This comes from a macro that has #[allow_internal_unsafe]. if span.allows_unsafe() { return; @@ -236,23 +243,31 @@ impl UnsafeCode { } } -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnsafeCode { - fn check_expr(&mut self, cx: &LateContext, e: &hir::Expr) { - if let hir::ExprKind::Block(ref blk, _) = e.node { +impl EarlyLintPass for UnsafeCode { + fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) { + if attr.check_name("allow_internal_unsafe") { + self.report_unsafe(cx, attr.span, "`allow_internal_unsafe` allows defining \ + macros using unsafe without triggering \ + the `unsafe_code` lint at their call site"); + } + } + + fn check_expr(&mut self, cx: &EarlyContext, e: &ast::Expr) { + if let ast::ExprKind::Block(ref blk, _) = e.node { // Don't warn about generated blocks, that'll just pollute the output. - if blk.rules == hir::UnsafeBlock(hir::UserProvided) { + if blk.rules == ast::BlockCheckMode::Unsafe(ast::UserProvided) { self.report_unsafe(cx, blk.span, "usage of an `unsafe` block"); } } } - fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { + fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { match it.node { - hir::ItemKind::Trait(_, hir::Unsafety::Unsafe, ..) => { + ast::ItemKind::Trait(_, ast::Unsafety::Unsafe, ..) => { self.report_unsafe(cx, it.span, "declaration of an `unsafe` trait") } - hir::ItemKind::Impl(hir::Unsafety::Unsafe, ..) => { + ast::ItemKind::Impl(ast::Unsafety::Unsafe, ..) => { self.report_unsafe(cx, it.span, "implementation of an `unsafe` trait") } @@ -261,19 +276,18 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnsafeCode { } fn check_fn(&mut self, - cx: &LateContext, - fk: FnKind<'tcx>, - _: &hir::FnDecl, - _: &hir::Body, + cx: &EarlyContext, + fk: FnKind, + _: &ast::FnDecl, span: Span, _: ast::NodeId) { match fk { - FnKind::ItemFn(_, _, hir::FnHeader { unsafety: hir::Unsafety::Unsafe, .. }, ..) => { + FnKind::ItemFn(_, ast::FnHeader { unsafety: ast::Unsafety::Unsafe, .. }, ..) => { self.report_unsafe(cx, span, "declaration of an `unsafe` function") } FnKind::Method(_, sig, ..) => { - if sig.header.unsafety == hir::Unsafety::Unsafe { + if sig.header.unsafety == ast::Unsafety::Unsafe { self.report_unsafe(cx, span, "implementation of an `unsafe` method") } } @@ -282,9 +296,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnsafeCode { } } - fn check_trait_item(&mut self, cx: &LateContext, item: &hir::TraitItem) { - if let hir::TraitItemKind::Method(ref sig, hir::TraitMethod::Required(_)) = item.node { - if sig.header.unsafety == hir::Unsafety::Unsafe { + fn check_trait_item(&mut self, cx: &EarlyContext, item: &ast::TraitItem) { + if let ast::TraitItemKind::Method(ref sig, None) = item.node { + if sig.header.unsafety == ast::Unsafety::Unsafe { self.report_unsafe(cx, item.span, "declaration of an `unsafe` method") } } @@ -307,6 +321,26 @@ pub struct MissingDoc { private_traits: FxHashSet, } +fn has_doc(attr: &ast::Attribute) -> bool { + if !attr.check_name("doc") { + return false; + } + + if attr.is_value_str() { + return true; + } + + if let Some(list) = attr.meta_item_list() { + for meta in list { + if meta.check_name("include") || meta.check_name("hidden") { + return true; + } + } + } + + false +} + impl MissingDoc { pub fn new() -> MissingDoc { MissingDoc { @@ -345,26 +379,6 @@ impl MissingDoc { } } - fn has_doc(attr: &ast::Attribute) -> bool { - if !attr.check_name("doc") { - return false; - } - - if attr.is_value_str() { - return true; - } - - if let Some(list) = attr.meta_item_list() { - for meta in list { - if meta.check_name("include") { - return true; - } - } - } - - false - } - let has_doc = attrs.iter().any(|a| has_doc(a)); if !has_doc { cx.span_lint(MISSING_DOCS, @@ -375,6 +389,10 @@ impl MissingDoc { } impl LintPass for MissingDoc { + fn name(&self) -> &'static str { + "MissingDoc" + } + fn get_lints(&self) -> LintArray { lint_array!(MISSING_DOCS) } @@ -399,6 +417,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { self.check_missing_docs_attrs(cx, None, &krate.attrs, krate.span, "crate"); + + for macro_def in &krate.exported_macros { + let has_doc = macro_def.attrs.iter().any(|a| has_doc(a)); + if !has_doc { + cx.span_lint(MISSING_DOCS, + cx.tcx.sess.source_map().def_span(macro_def.span), + "missing documentation for macro"); + } + } } fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { @@ -424,8 +451,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { // If the trait is private, add the impl items to private_traits so they don't get // reported for missing docs. let real_trait = trait_ref.path.def.def_id(); - if let Some(node_id) = cx.tcx.hir.as_local_node_id(real_trait) { - match cx.tcx.hir.find(node_id) { + if let Some(node_id) = cx.tcx.hir().as_local_node_id(real_trait) { + match cx.tcx.hir().find(node_id) { Some(Node::Item(item)) => { if let hir::VisibilityKind::Inherited = item.vis.node { for impl_item_ref in impl_item_refs { @@ -512,6 +539,10 @@ declare_lint! { pub struct MissingCopyImplementations; impl LintPass for MissingCopyImplementations { + fn name(&self) -> &'static str { + "MissingCopyImplementations" + } + fn get_lints(&self) -> LintArray { lint_array!(MISSING_COPY_IMPLEMENTATIONS) } @@ -527,21 +558,21 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingCopyImplementations { if !ast_generics.params.is_empty() { return; } - let def = cx.tcx.adt_def(cx.tcx.hir.local_def_id(item.id)); + let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id(item.id)); (def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[]))) } hir::ItemKind::Union(_, ref ast_generics) => { if !ast_generics.params.is_empty() { return; } - let def = cx.tcx.adt_def(cx.tcx.hir.local_def_id(item.id)); + let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id(item.id)); (def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[]))) } hir::ItemKind::Enum(_, ref ast_generics) => { if !ast_generics.params.is_empty() { return; } - let def = cx.tcx.adt_def(cx.tcx.hir.local_def_id(item.id)); + let def = cx.tcx.adt_def(cx.tcx.hir().local_def_id(item.id)); (def, cx.tcx.mk_adt(def, cx.tcx.intern_substs(&[]))) } _ => return, @@ -550,7 +581,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingCopyImplementations { return; } let param_env = ty::ParamEnv::empty(); - if !ty.moves_by_default(cx.tcx, param_env, item.span) { + if ty.is_copy_modulo_regions(cx.tcx, param_env, item.span) { return; } if param_env.can_type_implement_copy(cx.tcx, ty).is_ok() { @@ -579,6 +610,10 @@ impl MissingDebugImplementations { } impl LintPass for MissingDebugImplementations { + fn name(&self) -> &'static str { + "MissingDebugImplementations" + } + fn get_lints(&self) -> LintArray { lint_array!(MISSING_DEBUG_IMPLEMENTATIONS) } @@ -606,7 +641,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDebugImplementations { let mut impls = NodeSet::default(); cx.tcx.for_each_impl(debug, |d| { if let Some(ty_def) = cx.tcx.type_of(d).ty_adt_def() { - if let Some(node_id) = cx.tcx.hir.as_local_node_id(ty_def.did) { + if let Some(node_id) = cx.tcx.hir().as_local_node_id(ty_def.did) { impls.insert(node_id); } } @@ -636,6 +671,10 @@ declare_lint! { pub struct AnonymousParameters; impl LintPass for AnonymousParameters { + fn name(&self) -> &'static str { + "AnonymousParameters" + } + fn get_lints(&self) -> LintArray { lint_array!(ANONYMOUS_PARAMETERS) } @@ -665,7 +704,7 @@ impl EarlyLintPass for AnonymousParameters { arg.pat.span, "anonymous parameters are deprecated and will be \ removed in the next edition." - ).span_suggestion_with_applicability( + ).span_suggestion( arg.pat.span, "Try naming the parameter or explicitly \ ignoring it", @@ -683,86 +722,12 @@ impl EarlyLintPass for AnonymousParameters { } } -/// Checks for incorrect use use of `repr` attributes. -#[derive(Clone)] -pub struct BadRepr; - -impl LintPass for BadRepr { - fn get_lints(&self) -> LintArray { - lint_array!() - } -} - -impl EarlyLintPass for BadRepr { - fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) { - if attr.name() == "repr" { - let list = attr.meta_item_list(); - - let repr_str = |lit: &str| { format!("#[repr({})]", lit) }; - - // Emit warnings with `repr` either has a literal assignment (`#[repr = "C"]`) or - // no hints (``#[repr]`) - let has_hints = list.as_ref().map(|ref list| !list.is_empty()).unwrap_or(false); - if !has_hints { - let mut suggested = false; - let mut warn = if let Some(ref lit) = attr.value_str() { - // avoid warning about empty `repr` on `#[repr = "foo"]` - let mut warn = cx.struct_span_lint( - BAD_REPR, - attr.span, - "`repr` attribute isn't configurable with a literal", - ); - match lit.to_string().as_ref() { - | "C" | "packed" | "rust" | "transparent" - | "u8" | "u16" | "u32" | "u64" | "u128" | "usize" - | "i8" | "i16" | "i32" | "i64" | "i128" | "isize" => { - // if the literal could have been a valid `repr` arg, - // suggest the correct syntax - warn.span_suggestion_with_applicability( - attr.span, - "give `repr` a hint", - repr_str(&lit.as_str()), - Applicability::MachineApplicable - ); - suggested = true; - } - _ => { // the literal wasn't a valid `repr` arg - warn.span_label(attr.span, "needs a hint"); - } - }; - warn - } else { - let mut warn = cx.struct_span_lint( - BAD_REPR, - attr.span, - "`repr` attribute must have a hint", - ); - warn.span_label(attr.span, "needs a hint"); - warn - }; - if !suggested { - warn.help(&format!( - "valid hints include `{}`, `{}`, `{}` and `{}`", - repr_str("C"), - repr_str("packed"), - repr_str("rust"), - repr_str("transparent"), - )); - warn.note("for more information, visit \ - "); - } - warn.emit(); - } - } - } -} - /// Checks for use of attributes which have been deprecated. #[derive(Clone)] pub struct DeprecatedAttr { // This is not free to compute, so we want to keep it around, rather than // compute it for every attribute. - depr_attrs: Vec<&'static (&'static str, AttributeType, AttributeGate)>, + depr_attrs: Vec<&'static (&'static str, AttributeType, AttributeTemplate, AttributeGate)>, } impl DeprecatedAttr { @@ -774,6 +739,10 @@ impl DeprecatedAttr { } impl LintPass for DeprecatedAttr { + fn name(&self) -> &'static str { + "DeprecatedAttr" + } + fn get_lints(&self) -> LintArray { lint_array!() } @@ -781,7 +750,7 @@ impl LintPass for DeprecatedAttr { impl EarlyLintPass for DeprecatedAttr { fn check_attribute(&mut self, cx: &EarlyContext, attr: &ast::Attribute) { - for &&(n, _, ref g) in &self.depr_attrs { + for &&(n, _, _, ref g) in &self.depr_attrs { if attr.name() == n { if let &AttributeGate::Gated(Stability::Deprecated(link, suggestion), ref name, @@ -790,7 +759,7 @@ impl EarlyLintPass for DeprecatedAttr { let msg = format!("use of deprecated attribute `{}`: {}. See {}", name, reason, link); let mut err = cx.struct_span_lint(DEPRECATED, attr.span, &msg); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( attr.span, suggestion.unwrap_or("remove this attribute"), String::new(), @@ -814,6 +783,10 @@ declare_lint! { pub struct UnusedDocComment; impl LintPass for UnusedDocComment { + fn name(&self) -> &'static str { + "UnusedDocComment" + } + fn get_lints(&self) -> LintArray { lint_array![UNUSED_DOC_COMMENTS] } @@ -854,6 +827,10 @@ declare_lint! { pub struct PluginAsLibrary; impl LintPass for PluginAsLibrary { + fn name(&self) -> &'static str { + "PluginAsLibrary" + } + fn get_lints(&self) -> LintArray { lint_array![PLUGIN_AS_LIBRARY] } @@ -861,7 +838,7 @@ impl LintPass for PluginAsLibrary { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PluginAsLibrary { fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { - if cx.sess().plugin_registrar_fn.get().is_some() { + if cx.tcx.plugin_registrar_fn(LOCAL_CRATE).is_some() { // We're compiling a plugin; it's fine to link other plugins. return; } @@ -871,7 +848,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PluginAsLibrary { _ => return, }; - let def_id = cx.tcx.hir.local_def_id(it.id); + let def_id = cx.tcx.hir().local_def_id(it.id); let prfn = match cx.tcx.extern_mod_stmt_cnum(def_id) { Some(cnum) => cx.tcx.plugin_registrar_fn(cnum), None => { @@ -906,6 +883,10 @@ declare_lint! { pub struct InvalidNoMangleItems; impl LintPass for InvalidNoMangleItems { + fn name(&self) -> &'static str { + "InvalidNoMangleItems" + } + fn get_lints(&self) -> LintArray { lint_array!(NO_MANGLE_CONST_ITEMS, NO_MANGLE_GENERIC_ITEMS) @@ -925,7 +906,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems { it.span, "functions generic over \ types must be mangled"); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( no_mangle_attr.span, "remove this attribute", String::new(), @@ -953,7 +934,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidNoMangleItems { .unwrap_or(0) as u32; // `const` is 5 chars let const_span = it.span.with_hi(BytePos(it.span.lo().0 + start + 5)); - err.span_suggestion_with_applicability( + err.span_suggestion( const_span, "try a static value", "pub static".to_owned(), @@ -977,6 +958,10 @@ declare_lint! { } impl LintPass for MutableTransmutes { + fn name(&self) -> &'static str { + "MutableTransmutes" + } + fn get_lints(&self) -> LintArray { lint_array!(MUTABLE_TRANSMUTES) } @@ -1037,6 +1022,10 @@ declare_lint! { } impl LintPass for UnstableFeatures { + fn name(&self) -> &'static str { + "UnstableFeatures" + } + fn get_lints(&self) -> LintArray { lint_array!(UNSTABLE_FEATURES) } @@ -1064,6 +1053,10 @@ declare_lint! { } impl LintPass for UnionsWithDropFields { + fn name(&self) -> &'static str { + "UnionsWithDropFields" + } + fn get_lints(&self) -> LintArray { lint_array!(UNIONS_WITH_DROP_FIELDS) } @@ -1073,7 +1066,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnionsWithDropFields { fn check_item(&mut self, ctx: &LateContext, item: &hir::Item) { if let hir::ItemKind::Union(ref vdata, _) = item.node { for field in vdata.fields() { - let field_ty = ctx.tcx.type_of(ctx.tcx.hir.local_def_id(field.id)); + let field_ty = ctx.tcx.type_of(ctx.tcx.hir().local_def_id(field.id)); if field_ty.needs_drop(ctx.tcx, ctx.param_env) { ctx.span_lint(UNIONS_WITH_DROP_FIELDS, field.span, @@ -1096,6 +1089,10 @@ declare_lint! { } impl LintPass for UnreachablePub { + fn name(&self) -> &'static str { + "UnreachablePub" + } + fn get_lints(&self) -> LintArray { lint_array!(UNREACHABLE_PUB) } @@ -1119,10 +1116,12 @@ impl UnreachablePub { "pub(crate)" }.to_owned(); - err.span_suggestion_with_applicability(vis.span, - "consider restricting its visibility", - replacement, - applicability); + err.span_suggestion( + vis.span, + "consider restricting its visibility", + replacement, + applicability, + ); if exportable { err.help("or consider exporting it for use by other crates"); } @@ -1166,6 +1165,10 @@ declare_lint! { } impl LintPass for TypeAliasBounds { + fn name(&self) -> &'static str { + "TypeAliasBounds" + } + fn get_lints(&self) -> LintArray { lint_array!(TYPE_ALIAS_BOUNDS) } @@ -1270,12 +1273,16 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeAliasBounds { pub struct UnusedBrokenConst; impl LintPass for UnusedBrokenConst { + fn name(&self) -> &'static str { + "UnusedBrokenConst" + } + fn get_lints(&self) -> LintArray { lint_array!() } } fn check_const(cx: &LateContext, body_id: hir::BodyId) { - let def_id = cx.tcx.hir.body_owner_def_id(body_id); + let def_id = cx.tcx.hir().body_owner_def_id(body_id); let is_static = cx.tcx.is_static(def_id).is_some(); let param_env = if is_static { // Use the same param_env as `codegen_static_initializer`, to reuse the cache. @@ -1316,6 +1323,10 @@ declare_lint! { } impl LintPass for TrivialConstraints { + fn name(&self) -> &'static str { + "TrivialConstraints" + } + fn get_lints(&self) -> LintArray { lint_array!(TRIVIAL_BOUNDS) } @@ -1332,7 +1343,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TrivialConstraints { if cx.tcx.features().trivial_bounds { - let def_id = cx.tcx.hir.local_def_id(item.id); + let def_id = cx.tcx.hir().local_def_id(item.id); let predicates = cx.tcx.predicates_of(def_id); for &(predicate, span) in &predicates.predicates { let predicate_kind_name = match predicate { @@ -1370,6 +1381,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TrivialConstraints { pub struct SoftLints; impl LintPass for SoftLints { + fn name(&self) -> &'static str { + "SoftLints" + } + fn get_lints(&self) -> LintArray { lint_array!( WHILE_TRUE, @@ -1404,6 +1419,10 @@ declare_lint! { pub struct EllipsisInclusiveRangePatterns; impl LintPass for EllipsisInclusiveRangePatterns { + fn name(&self) -> &'static str { + "EllipsisInclusiveRangePatterns" + } + fn get_lints(&self) -> LintArray { lint_array!(ELLIPSIS_INCLUSIVE_RANGE_PATTERNS) } @@ -1435,7 +1454,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns { if parenthesise { *visit_subpats = false; let mut err = cx.struct_span_lint(ELLIPSIS_INCLUSIVE_RANGE_PATTERNS, pat.span, msg); - err.span_suggestion_with_applicability( + err.span_suggestion( pat.span, suggestion, format!("&({}..={})", expr_to_string(&start), expr_to_string(&end)), @@ -1444,7 +1463,7 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns { err.emit(); } else { let mut err = cx.struct_span_lint(ELLIPSIS_INCLUSIVE_RANGE_PATTERNS, join, msg); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( join, suggestion, "..=".to_owned(), @@ -1478,6 +1497,10 @@ impl UnnameableTestItems { } impl LintPass for UnnameableTestItems { + fn name(&self) -> &'static str { + "UnnameableTestItems" + } + fn get_lints(&self) -> LintArray { lint_array!(UNNAMEABLE_TEST_ITEMS) } @@ -1521,6 +1544,10 @@ declare_lint! { pub struct KeywordIdents; impl LintPass for KeywordIdents { + fn name(&self) -> &'static str { + "KeywordIdents" + } + fn get_lints(&self) -> LintArray { lint_array!(KEYWORD_IDENTS) } @@ -1540,8 +1567,8 @@ impl KeywordIdents { } _ => {}, } - TokenTree::Delimited(_, ref delim) => { - self.check_tokens(cx, delim.tts.clone().into()) + TokenTree::Delimited(_, _, tts) => { + self.check_tokens(cx, tts) }, } } @@ -1573,7 +1600,7 @@ impl EarlyLintPass for KeywordIdents { } } - // no new keywords yet for 2018 edition and beyond + // There are no new keywords yet for the 2018 edition and beyond. // However, `await` is a "false" keyword in the 2018 edition, // and can only be used if the `async_await` feature is enabled. // Otherwise, we emit an error. @@ -1588,7 +1615,7 @@ impl EarlyLintPass for KeywordIdents { E0721, "`await` is a keyword in the {} edition", cur_edition, ); - err.span_suggestion_with_applicability( + err.span_suggestion( ident.span, "you can use a raw identifier to stay compatible", "r#await".to_string(), @@ -1612,7 +1639,7 @@ impl EarlyLintPass for KeywordIdents { ident.as_str(), next_edition), ); - lint.span_suggestion_with_applicability( + lint.span_suggestion( ident.span, "you can use a raw identifier to stay compatible", format!("r#{}", ident.as_str()), @@ -1626,6 +1653,10 @@ impl EarlyLintPass for KeywordIdents { pub struct ExplicitOutlivesRequirements; impl LintPass for ExplicitOutlivesRequirements { + fn name(&self) -> &'static str { + "ExplicitOutlivesRequirements" + } + fn get_lints(&self) -> LintArray { lint_array![EXPLICIT_OUTLIVES_REQUIREMENTS] } @@ -1746,7 +1777,7 @@ impl ExplicitOutlivesRequirements { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements { fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item) { let infer_static = cx.tcx.features().infer_static_outlives_requirements; - let def_id = cx.tcx.hir.local_def_id(item.id); + let def_id = cx.tcx.hir().local_def_id(item.id); if let hir::ItemKind::Struct(_, ref generics) = item.node { let mut bound_count = 0; let mut lint_spans = Vec::new(); @@ -1836,7 +1867,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements { lint_spans.clone(), "outlives requirements can be inferred" ); - err.multipart_suggestion_with_applicability( + err.multipart_suggestion( if bound_count == 1 { "remove this bound" } else { diff --git a/src/librustc_lint/diagnostics.rs b/src/librustc_lint/diagnostics.rs index 59f005a5de8..9a608e4fef0 100644 --- a/src/librustc_lint/diagnostics.rs +++ b/src/librustc_lint/diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - register_diagnostics! { E0721, // `await` keyword } diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 57cbecb5c67..6607951d2cd 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -1,21 +1,11 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Lints in the Rust compiler. +//! # Lints in the Rust compiler //! //! This currently only contains the definitions and implementations //! of most of the lints that `rustc` supports directly, it does not //! contain the infrastructure for defining/registering lints. That is //! available in `rustc::lint` and `rustc_plugin` respectively. //! -//! # Note +//! ## Note //! //! This API is completely unstable and subject to change. @@ -27,9 +17,9 @@ #![feature(box_patterns)] #![feature(box_syntax)] #![feature(nll)] -#![feature(quote)] #![feature(rustc_diagnostic_macros)] -#![feature(macro_at_most_once_rep)] + +#![recursion_limit="256"] #[macro_use] extern crate syntax; @@ -37,38 +27,41 @@ extern crate syntax; extern crate rustc; #[macro_use] extern crate log; -extern crate rustc_mir; extern crate rustc_target; extern crate syntax_pos; extern crate rustc_data_structures; +mod diagnostics; +mod nonstandard_style; +pub mod builtin; +mod types; +mod unused; + use rustc::lint; -use rustc::lint::{LateContext, LateLintPass, LintPass, LintArray}; +use rustc::lint::{EarlyContext, LateContext, LateLintPass, EarlyLintPass, LintPass, LintArray}; use rustc::lint::builtin::{ BARE_TRAIT_OBJECTS, ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE, ELIDED_LIFETIMES_IN_PATHS, EXPLICIT_OUTLIVES_REQUIREMENTS, - parser::QUESTION_MARK_MACRO_SEP + INTRA_DOC_LINK_RESOLUTION_FAILURE, + MISSING_DOC_CODE_EXAMPLES, + PRIVATE_DOC_TESTS, + parser::QUESTION_MARK_MACRO_SEP, + parser::ILL_FORMED_ATTRIBUTE_INPUT, }; use rustc::session; use rustc::util; use rustc::hir; use syntax::ast; +use syntax::edition::Edition; use syntax_pos::Span; use session::Session; -use syntax::edition::Edition; use lint::LintId; use lint::FutureIncompatibleInfo; -mod diagnostics; -mod nonstandard_style; -pub mod builtin; -mod types; -mod unused; - use nonstandard_style::*; use builtin::*; use types::*; @@ -77,56 +70,68 @@ use unused::*; /// Useful for other parts of the compiler. pub use builtin::SoftLints; +macro_rules! pre_expansion_lint_passes { + ($macro:path, $args:tt) => ( + $macro!($args, [ + KeywordIdents: KeywordIdents, + ]); + ) +} + +macro_rules! early_lint_passes { + ($macro:path, $args:tt) => ( + $macro!($args, [ + UnusedParens: UnusedParens, + UnusedImportBraces: UnusedImportBraces, + UnsafeCode: UnsafeCode, + AnonymousParameters: AnonymousParameters, + UnusedDocComment: UnusedDocComment, + EllipsisInclusiveRangePatterns: EllipsisInclusiveRangePatterns, + NonCamelCaseTypes: NonCamelCaseTypes, + DeprecatedAttr: DeprecatedAttr::new(), + ]); + ) +} + +macro_rules! declare_combined_early_pass { + ([$name:ident], $passes:tt) => ( + early_lint_methods!(declare_combined_early_lint_pass, [pub $name, $passes]); + ) +} + +pre_expansion_lint_passes!(declare_combined_early_pass, [BuiltinCombinedPreExpansionLintPass]); +early_lint_passes!(declare_combined_early_pass, [BuiltinCombinedEarlyLintPass]); + /// Tell the `LintStore` about all the built-in lints (the ones /// defined in this crate and the ones defined in /// `rustc::lint::builtin`). pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { - macro_rules! add_early_builtin { - ($sess:ident, $($name:ident),*,) => ( - {$( - store.register_early_pass($sess, false, box $name); - )*} - ) - } - - macro_rules! add_pre_expansion_builtin { - ($sess:ident, $($name:ident),*,) => ( - {$( - store.register_pre_expansion_pass($sess, box $name); - )*} - ) - } - - macro_rules! add_early_builtin_with_new { - ($sess:ident, $($name:ident),*,) => ( - {$( - store.register_early_pass($sess, false, box $name::new()); - )*} - ) - } - macro_rules! add_lint_group { ($sess:ident, $name:expr, $($lint:ident),*) => ( store.register_group($sess, false, $name, None, vec![$(LintId::of($lint)),*]); ) } - add_pre_expansion_builtin!(sess, - KeywordIdents, - ); - - add_early_builtin!(sess, - UnusedParens, - UnusedImportBraces, - AnonymousParameters, - UnusedDocComment, - BadRepr, - EllipsisInclusiveRangePatterns, - ); + macro_rules! register_passes { + ([$method:ident], [$($passes:ident: $constructor:expr,)*]) => ( + $( + store.$method(sess, false, false, box $constructor); + )* + ) + } - add_early_builtin_with_new!(sess, - DeprecatedAttr, - ); + if sess.map(|sess| sess.opts.debugging_opts.no_interleave_lints).unwrap_or(false) { + pre_expansion_lint_passes!(register_passes, [register_pre_expansion_pass]); + early_lint_passes!(register_passes, [register_early_pass]); + } else { + store.register_pre_expansion_pass( + sess, + false, + true, + box BuiltinCombinedPreExpansionLintPass::new() + ); + store.register_early_pass(sess, false, true, box BuiltinCombinedEarlyLintPass::new()); + } late_lint_methods!(declare_combined_late_lint_pass, [BuiltinCombinedLateLintPass, [ HardwiredLints: HardwiredLints, @@ -137,11 +142,9 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { UnusedAttributes: UnusedAttributes, PathStatements: PathStatements, UnusedResults: UnusedResults, - NonCamelCaseTypes: NonCamelCaseTypes, NonSnakeCase: NonSnakeCase, NonUpperCaseGlobals: NonUpperCaseGlobals, NonShorthandFieldPatterns: NonShorthandFieldPatterns, - UnsafeCode: UnsafeCode, UnusedAllocation: UnusedAllocation, MissingCopyImplementations: MissingCopyImplementations, UnstableFeatures: UnstableFeatures, @@ -206,6 +209,12 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { // MACRO_USE_EXTERN_CRATE, ); + add_lint_group!(sess, + "rustdoc", + INTRA_DOC_LINK_RESOLUTION_FAILURE, + MISSING_DOC_CODE_EXAMPLES, + PRIVATE_DOC_TESTS); + // Guidelines for creating a future incompatibility lint: // // - Create a lint defaulting to warn as normal, with ideally the same error @@ -214,8 +223,7 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { // and include the full URL, sort items in ascending order of issue numbers. // - Later, change lint to error // - Eventually, remove lint - store.register_future_incompatible(sess, - vec![ + store.register_future_incompatible(sess, vec![ FutureIncompatibleInfo { id: LintId::of(PRIVATE_IN_PUBLIC), reference: "issue #34537 ", @@ -296,6 +304,11 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { reference: "issue #46205 ", edition: None, }, + FutureIncompatibleInfo { + id: LintId::of(ORDER_DEPENDENT_TRAIT_OBJECTS), + reference: "issue #56484 ", + edition: None, + }, FutureIncompatibleInfo { id: LintId::of(TYVAR_BEHIND_RAW_POINTER), reference: "issue #46906 ", @@ -333,9 +346,19 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { reference: "issue #52234 ", edition: None, }, + FutureIncompatibleInfo { + id: LintId::of(ILL_FORMED_ATTRIBUTE_INPUT), + reference: "issue #57571 ", + edition: None, + }, + FutureIncompatibleInfo { + id: LintId::of(AMBIGUOUS_ASSOCIATED_ITEMS), + reference: "issue #57644 ", + edition: None, + }, ]); - // Register renamed and removed lints + // Register renamed and removed lints. store.register_renamed("single_use_lifetime", "single_use_lifetimes"); store.register_renamed("elided_lifetime_in_path", "elided_lifetimes_in_paths"); store.register_renamed("bare_trait_object", "bare_trait_objects"); @@ -346,10 +369,10 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate"); store.register_removed("negate_unsigned", "cast a signed value instead"); store.register_removed("raw_pointer_derive", "using derive with raw pointers is ok"); - // Register lint group aliases + // Register lint group aliases. store.register_group_alias("nonstandard_style", "bad_style"); - // This was renamed to raw_pointer_derive, which was then removed, - // so it is also considered removed + // This was renamed to `raw_pointer_derive`, which was then removed, + // so it is also considered removed. store.register_removed("raw_pointer_deriving", "using derive with raw pointers is ok"); store.register_removed("drop_with_repr_extern", "drop flags have been removed"); store.register_removed("fat_ptr_transmutes", "was accidentally removed back in 2014"); @@ -379,7 +402,9 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { store.register_removed("resolve_trait_on_defaulted_unit", "converted into hard error, see https://github.com/rust-lang/rust/issues/48950"); store.register_removed("private_no_mangle_fns", - "no longer an warning, #[no_mangle] functions always exported"); + "no longer a warning, #[no_mangle] functions always exported"); store.register_removed("private_no_mangle_statics", - "no longer an warning, #[no_mangle] statics always exported"); + "no longer a warning, #[no_mangle] statics always exported"); + store.register_removed("bad_repr", + "replaced with a generic attribute input check"); } diff --git a/src/librustc_lint/nonstandard_style.rs b/src/librustc_lint/nonstandard_style.rs index 40781b0771d..bbf0edc6efb 100644 --- a/src/librustc_lint/nonstandard_style.rs +++ b/src/librustc_lint/nonstandard_style.rs @@ -1,25 +1,14 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +use rustc::hir::{self, GenericParamKind, PatKind}; use rustc::hir::def::Def; +use rustc::hir::intravisit::FnKind; use rustc::ty; -use lint::{LateContext, LintContext, LintArray}; -use lint::{LintPass, LateLintPass}; - use rustc_target::spec::abi::Abi; +use lint::{EarlyContext, LateContext, LintContext, LintArray}; +use lint::{EarlyLintPass, LintPass, LateLintPass}; use syntax::ast; use syntax::attr; -use syntax_pos::Span; - -use rustc::hir::{self, GenericParamKind, PatKind}; -use rustc::hir::intravisit::FnKind; +use syntax::errors::Applicability; +use syntax_pos::{BytePos, symbol::Ident, Span}; #[derive(PartialEq)] pub enum MethodLateContext { @@ -29,7 +18,7 @@ pub enum MethodLateContext { } pub fn method_context(cx: &LateContext, id: ast::NodeId) -> MethodLateContext { - let def_id = cx.tcx.hir.local_def_id(id); + let def_id = cx.tcx.hir().local_def_id(id); let item = cx.tcx.associated_item(def_id); match item.container { ty::TraitContainer(..) => MethodLateContext::TraitAutoImpl, @@ -52,13 +41,12 @@ declare_lint! { pub struct NonCamelCaseTypes; impl NonCamelCaseTypes { - fn check_case(&self, cx: &LateContext, sort: &str, name: ast::Name, span: Span) { + fn check_case(&self, cx: &EarlyContext, sort: &str, ident: &Ident) { fn char_has_case(c: char) -> bool { c.is_lowercase() || c.is_uppercase() } - fn is_camel_case(name: ast::Name) -> bool { - let name = name.as_str(); + fn is_camel_case(name: &str) -> bool { let name = name.trim_matches('_'); if name.is_empty() { return true; @@ -98,30 +86,40 @@ impl NonCamelCaseTypes { }).0 } + let name = &ident.name.as_str(); + if !is_camel_case(name) { - let c = to_camel_case(&name.as_str()); - let m = if c.is_empty() { - format!("{} `{}` should have a camel case name such as `CamelCase`", sort, name) - } else { - format!("{} `{}` should have a camel case name such as `{}`", sort, name, c) - }; - cx.span_lint(NON_CAMEL_CASE_TYPES, span, &m); + let c = to_camel_case(name); + + let msg = format!("{} `{}` should have a camel case name", sort, name); + cx.struct_span_lint(NON_CAMEL_CASE_TYPES, ident.span, &msg) + .span_suggestion( + ident.span, + "convert the identifier to camel case", + c, + Applicability::MaybeIncorrect, + ) + .emit(); } } } impl LintPass for NonCamelCaseTypes { + fn name(&self) -> &'static str { + "NonCamelCaseTypes" + } + fn get_lints(&self) -> LintArray { lint_array!(NON_CAMEL_CASE_TYPES) } } -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCamelCaseTypes { - fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { +impl EarlyLintPass for NonCamelCaseTypes { + fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { let has_repr_c = it.attrs .iter() .any(|attr| { - attr::find_repr_attrs(&cx.tcx.sess.parse_sess, attr) + attr::find_repr_attrs(&cx.sess.parse_sess, attr) .iter() .any(|r| r == &attr::ReprC) }); @@ -131,27 +129,22 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCamelCaseTypes { } match it.node { - hir::ItemKind::Ty(..) | - hir::ItemKind::Enum(..) | - hir::ItemKind::Struct(..) | - hir::ItemKind::Union(..) => self.check_case(cx, "type", it.name, it.span), - hir::ItemKind::Trait(..) => self.check_case(cx, "trait", it.name, it.span), + ast::ItemKind::Ty(..) | + ast::ItemKind::Enum(..) | + ast::ItemKind::Struct(..) | + ast::ItemKind::Union(..) => self.check_case(cx, "type", &it.ident), + ast::ItemKind::Trait(..) => self.check_case(cx, "trait", &it.ident), _ => (), } } - fn check_variant(&mut self, cx: &LateContext, v: &hir::Variant, _: &hir::Generics) { - self.check_case(cx, "variant", v.node.name, v.span); + fn check_variant(&mut self, cx: &EarlyContext, v: &ast::Variant, _: &ast::Generics) { + self.check_case(cx, "variant", &v.node.ident); } - fn check_generic_param(&mut self, cx: &LateContext, param: &hir::GenericParam) { - match param.kind { - GenericParamKind::Lifetime { .. } => {} - GenericParamKind::Type { synthetic, .. } => { - if synthetic.is_none() { - self.check_case(cx, "type parameter", param.name.ident().name, param.span); - } - } + fn check_generic_param(&mut self, cx: &EarlyContext, param: &ast::GenericParam) { + if let ast::GenericParamKind::Type { .. } = param.kind { + self.check_case(cx, "type parameter", ¶m.ident); } } } @@ -169,7 +162,7 @@ impl NonSnakeCase { fn to_snake_case(mut str: &str) -> String { let mut words = vec![]; // Preserve leading underscores - str = str.trim_left_matches(|c: char| { + str = str.trim_start_matches(|c: char| { if c == '_' { words.push(String::new()); true @@ -196,12 +189,13 @@ impl NonSnakeCase { words.join("_") } - fn check_snake_case(&self, cx: &LateContext, sort: &str, name: &str, span: Option) { + /// Checks if a given identifier is snake case, and reports a diagnostic if not. + fn check_snake_case(&self, cx: &LateContext, sort: &str, ident: &Ident) { fn is_snake_case(ident: &str) -> bool { if ident.is_empty() { return true; } - let ident = ident.trim_left_matches('\''); + let ident = ident.trim_start_matches('\''); let ident = ident.trim_matches('_'); let mut allow_underscore = true; @@ -218,25 +212,37 @@ impl NonSnakeCase { }) } + let name = &ident.name.as_str(); + if !is_snake_case(name) { let sc = NonSnakeCase::to_snake_case(name); - let msg = if sc != name { - format!("{} `{}` should have a snake case name such as `{}`", - sort, - name, - sc) + + let msg = format!("{} `{}` should have a snake case name", sort, name); + let mut err = cx.struct_span_lint(NON_SNAKE_CASE, ident.span, &msg); + + // We have a valid span in almost all cases, but we don't have one when linting a crate + // name provided via the command line. + if !ident.span.is_dummy() { + err.span_suggestion( + ident.span, + "convert the identifier to snake case", + sc, + Applicability::MaybeIncorrect, + ); } else { - format!("{} `{}` should have a snake case name", sort, name) - }; - match span { - Some(span) => cx.span_lint(NON_SNAKE_CASE, span, &msg), - None => cx.lint(NON_SNAKE_CASE, &msg), + err.help(&format!("convert the identifier to snake case: `{}`", sc)); } + + err.emit(); } } } impl LintPass for NonSnakeCase { + fn name(&self) -> &'static str { + "NonSnakeCase" + } + fn get_lints(&self) -> LintArray { lint_array!(NON_SNAKE_CASE) } @@ -244,50 +250,75 @@ impl LintPass for NonSnakeCase { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase { fn check_crate(&mut self, cx: &LateContext, cr: &hir::Crate) { - let attr_crate_name = attr::find_by_name(&cr.attrs, "crate_name") - .and_then(|at| at.value_str().map(|s| (at, s))); - if let Some(ref name) = cx.tcx.sess.opts.crate_name { - self.check_snake_case(cx, "crate", name, None); - } else if let Some((attr, name)) = attr_crate_name { - self.check_snake_case(cx, "crate", &name.as_str(), Some(attr.span)); + let crate_ident = if let Some(name) = &cx.tcx.sess.opts.crate_name { + Some(Ident::from_str(name)) + } else { + attr::find_by_name(&cr.attrs, "crate_name") + .and_then(|attr| attr.meta()) + .and_then(|meta| { + meta.name_value_literal().and_then(|lit| { + if let ast::LitKind::Str(name, ..) = lit.node { + // Discard the double quotes surrounding the literal. + let sp = cx.sess().source_map().span_to_snippet(lit.span) + .ok() + .and_then(|snippet| { + let left = snippet.find('"')?; + let right = snippet.rfind('"').map(|pos| snippet.len() - pos)?; + + Some( + lit.span + .with_lo(lit.span.lo() + BytePos(left as u32 + 1)) + .with_hi(lit.span.hi() - BytePos(right as u32)), + ) + }) + .unwrap_or_else(|| lit.span); + + Some(Ident::new(name, sp)) + } else { + None + } + }) + }) + }; + + if let Some(ident) = &crate_ident { + self.check_snake_case(cx, "crate", ident); } } fn check_generic_param(&mut self, cx: &LateContext, param: &hir::GenericParam) { - match param.kind { - GenericParamKind::Lifetime { .. } => { - let name = param.name.ident().as_str(); - self.check_snake_case(cx, "lifetime", &name, Some(param.span)); - } - GenericParamKind::Type { .. } => {} + if let GenericParamKind::Lifetime { .. } = param.kind { + self.check_snake_case(cx, "lifetime", ¶m.name.ident()); } } - fn check_fn(&mut self, - cx: &LateContext, - fk: FnKind, - _: &hir::FnDecl, - _: &hir::Body, - span: Span, - id: ast::NodeId) { - match fk { - FnKind::Method(name, ..) => { + fn check_fn( + &mut self, + cx: &LateContext, + fk: FnKind, + _: &hir::FnDecl, + _: &hir::Body, + _: Span, + id: ast::NodeId, + ) { + match &fk { + FnKind::Method(ident, ..) => { match method_context(cx, id) { MethodLateContext::PlainImpl => { - self.check_snake_case(cx, "method", &name.as_str(), Some(span)) + self.check_snake_case(cx, "method", ident); } MethodLateContext::TraitAutoImpl => { - self.check_snake_case(cx, "trait method", &name.as_str(), Some(span)) + self.check_snake_case(cx, "trait method", ident); } _ => (), } } - FnKind::ItemFn(name, _, header, _, attrs) => { + FnKind::ItemFn(ident, _, header, _, attrs) => { // Skip foreign-ABI #[no_mangle] functions (Issue #31924) - if header.abi != Abi::Rust && attr::find_by_name(attrs, "no_mangle").is_some() { + if header.abi != Abi::Rust && attr::contains_name(attrs, "no_mangle") { return; } - self.check_snake_case(cx, "function", &name.as_str(), Some(span)) + self.check_snake_case(cx, "function", ident); } FnKind::Closure(_) => (), } @@ -295,36 +326,35 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase { fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { if let hir::ItemKind::Mod(_) = it.node { - self.check_snake_case(cx, "module", &it.name.as_str(), Some(it.span)); + self.check_snake_case(cx, "module", &it.ident); } } fn check_trait_item(&mut self, cx: &LateContext, item: &hir::TraitItem) { - if let hir::TraitItemKind::Method(_, hir::TraitMethod::Required(ref pnames)) = item.node { - self.check_snake_case(cx, - "trait method", - &item.ident.as_str(), - Some(item.span)); + if let hir::TraitItemKind::Method(_, hir::TraitMethod::Required(pnames)) = &item.node { + self.check_snake_case(cx, "trait method", &item.ident); for param_name in pnames { - self.check_snake_case(cx, "variable", ¶m_name.as_str(), Some(param_name.span)); + self.check_snake_case(cx, "variable", param_name); } } } fn check_pat(&mut self, cx: &LateContext, p: &hir::Pat) { - if let &PatKind::Binding(_, _, ref ident, _) = &p.node { - self.check_snake_case(cx, "variable", &ident.as_str(), Some(p.span)); + if let &PatKind::Binding(_, _, ident, _) = &p.node { + self.check_snake_case(cx, "variable", &ident); } } - fn check_struct_def(&mut self, - cx: &LateContext, - s: &hir::VariantData, - _: ast::Name, - _: &hir::Generics, - _: ast::NodeId) { + fn check_struct_def( + &mut self, + cx: &LateContext, + s: &hir::VariantData, + _: ast::Name, + _: &hir::Generics, + _: ast::NodeId, + ) { for sf in s.fields() { - self.check_snake_case(cx, "structure field", &sf.ident.as_str(), Some(sf.span)); + self.check_snake_case(cx, "structure field", &sf.ident); } } } @@ -339,26 +369,30 @@ declare_lint! { pub struct NonUpperCaseGlobals; impl NonUpperCaseGlobals { - fn check_upper_case(cx: &LateContext, sort: &str, name: ast::Name, span: Span) { - if name.as_str().chars().any(|c| c.is_lowercase()) { - let uc = NonSnakeCase::to_snake_case(&name.as_str()).to_uppercase(); - if name != &*uc { - cx.span_lint(NON_UPPER_CASE_GLOBALS, - span, - &format!("{} `{}` should have an upper case name such as `{}`", - sort, - name, - uc)); - } else { - cx.span_lint(NON_UPPER_CASE_GLOBALS, - span, - &format!("{} `{}` should have an upper case name", sort, name)); - } + fn check_upper_case(cx: &LateContext, sort: &str, ident: &Ident) { + let name = &ident.name.as_str(); + + if name.chars().any(|c| c.is_lowercase()) { + let uc = NonSnakeCase::to_snake_case(&name).to_uppercase(); + + let msg = format!("{} `{}` should have an upper case name", sort, name); + cx.struct_span_lint(NON_UPPER_CASE_GLOBALS, ident.span, &msg) + .span_suggestion( + ident.span, + "convert the identifier to upper case", + uc, + Applicability::MaybeIncorrect, + ) + .emit(); } } } impl LintPass for NonUpperCaseGlobals { + fn name(&self) -> &'static str { + "NonUpperCaseGlobals" + } + fn get_lints(&self) -> LintArray { lint_array!(NON_UPPER_CASE_GLOBALS) } @@ -367,36 +401,25 @@ impl LintPass for NonUpperCaseGlobals { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals { fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { match it.node { - hir::ItemKind::Static(..) => { - if attr::find_by_name(&it.attrs, "no_mangle").is_some() { - return; - } - NonUpperCaseGlobals::check_upper_case(cx, "static variable", it.name, it.span); + hir::ItemKind::Static(..) if !attr::contains_name(&it.attrs, "no_mangle") => { + NonUpperCaseGlobals::check_upper_case(cx, "static variable", &it.ident); } hir::ItemKind::Const(..) => { - NonUpperCaseGlobals::check_upper_case(cx, "constant", it.name, it.span); + NonUpperCaseGlobals::check_upper_case(cx, "constant", &it.ident); } _ => {} } } fn check_trait_item(&mut self, cx: &LateContext, ti: &hir::TraitItem) { - match ti.node { - hir::TraitItemKind::Const(..) => { - NonUpperCaseGlobals::check_upper_case(cx, "associated constant", - ti.ident.name, ti.span); - } - _ => {} + if let hir::TraitItemKind::Const(..) = ti.node { + NonUpperCaseGlobals::check_upper_case(cx, "associated constant", &ti.ident); } } fn check_impl_item(&mut self, cx: &LateContext, ii: &hir::ImplItem) { - match ii.node { - hir::ImplItemKind::Const(..) => { - NonUpperCaseGlobals::check_upper_case(cx, "associated constant", - ii.ident.name, ii.span); - } - _ => {} + if let hir::ImplItemKind::Const(..) = ii.node { + NonUpperCaseGlobals::check_upper_case(cx, "associated constant", &ii.ident); } } @@ -405,10 +428,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals { if let PatKind::Path(hir::QPath::Resolved(None, ref path)) = p.node { if let Def::Const(..) = path.def { if path.segments.len() == 1 { - NonUpperCaseGlobals::check_upper_case(cx, - "constant in pattern", - path.segments[0].ident.name, - path.span); + NonUpperCaseGlobals::check_upper_case( + cx, + "constant in pattern", + &path.segments[0].ident + ); } } } diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 0e2d041b1ff..4abd55b7e31 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] use rustc::hir::Node; @@ -31,6 +21,8 @@ use syntax::source_map; use rustc::hir; +use rustc::mir::interpret::{sign_extend, truncate}; + declare_lint! { UNUSED_COMPARISONS, Warn, @@ -63,6 +55,10 @@ impl TypeLimits { } impl LintPass for TypeLimits { + fn name(&self) -> &'static str { + "TypeLimits" + } + fn get_lints(&self) -> LintArray { lint_array!(UNUSED_COMPARISONS, OVERFLOWING_LITERALS) @@ -139,15 +135,15 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { _ => bug!(), }; if lit_val < min || lit_val > max { - let parent_id = cx.tcx.hir.get_parent_node(e.id); - if let Node::Expr(parent_expr) = cx.tcx.hir.get(parent_id) { + let parent_id = cx.tcx.hir().get_parent_node(e.id); + if let Node::Expr(parent_expr) = cx.tcx.hir().get(parent_id) { if let hir::ExprKind::Cast(..) = parent_expr.node { if let ty::Char = cx.tables.expr_ty(parent_expr).sty { let mut err = cx.struct_span_lint( OVERFLOWING_LITERALS, parent_expr.span, "only u8 can be cast into char"); - err.span_suggestion_with_applicability( + err.span_suggestion( parent_expr.span, &"use a char literal instead", format!("'\\u{{{:X}}}'", lit_val), @@ -378,14 +374,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { let (t, actually) = match ty { ty::Int(t) => { let ity = attr::IntType::SignedInt(t); - let bits = layout::Integer::from_attr(&cx.tcx, ity).size().bits(); - let actually = (val << (128 - bits)) as i128 >> (128 - bits); + let size = layout::Integer::from_attr(&cx.tcx, ity).size(); + let actually = sign_extend(val, size) as i128; (format!("{:?}", t), actually.to_string()) } ty::Uint(t) => { let ity = attr::IntType::UnsignedInt(t); - let bits = layout::Integer::from_attr(&cx.tcx, ity).size().bits(); - let actually = (val << (128 - bits)) >> (128 - bits); + let size = layout::Integer::from_attr(&cx.tcx, ity).size(); + let actually = truncate(val, size); (format!("{:?}", t), actually.to_string()) } _ => bug!(), @@ -405,7 +401,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { { if let Some(pos) = repr_str.chars().position(|c| c == 'i' || c == 'u') { let (sans_suffix, _) = repr_str.split_at(pos); - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("consider using `{}` instead", sugg_ty), format!("{}{}", sans_suffix, sugg_ty), @@ -727,6 +723,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { ty::Closure(..) | ty::Generator(..) | ty::GeneratorWitness(..) | + ty::Placeholder(..) | ty::UnnormalizedProjection(..) | ty::Projection(..) | ty::Opaque(..) | @@ -755,7 +752,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { diag.help(s); } if let ty::Adt(def, _) = unsafe_ty.sty { - if let Some(sp) = self.cx.tcx.hir.span_if_local(def.did) { + if let Some(sp) = self.cx.tcx.hir().span_if_local(def.did) { diag.span_note(sp, "type defined here"); } } @@ -765,7 +762,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } fn check_foreign_fn(&mut self, id: ast::NodeId, decl: &hir::FnDecl) { - let def_id = self.cx.tcx.hir.local_def_id(id); + let def_id = self.cx.tcx.hir().local_def_id(id); let sig = self.cx.tcx.fn_sig(def_id); let sig = self.cx.tcx.erase_late_bound_regions(&sig); @@ -782,7 +779,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } fn check_foreign_static(&mut self, id: ast::NodeId, span: Span) { - let def_id = self.cx.tcx.hir.local_def_id(id); + let def_id = self.cx.tcx.hir().local_def_id(id); let ty = self.cx.tcx.type_of(def_id); self.check_type_for_ffi_and_report_errors(span, ty); } @@ -792,6 +789,10 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { pub struct ImproperCTypes; impl LintPass for ImproperCTypes { + fn name(&self) -> &'static str { + "ImproperCTypes" + } + fn get_lints(&self) -> LintArray { lint_array!(IMPROPER_CTYPES) } @@ -800,7 +801,7 @@ impl LintPass for ImproperCTypes { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes { fn check_foreign_item(&mut self, cx: &LateContext, it: &hir::ForeignItem) { let mut vis = ImproperCTypesVisitor { cx }; - let abi = cx.tcx.hir.get_foreign_abi(it.id); + let abi = cx.tcx.hir().get_foreign_abi(it.id); if abi != Abi::RustIntrinsic && abi != Abi::PlatformIntrinsic { match it.node { hir::ForeignItemKind::Fn(ref decl, _, _) => { @@ -818,6 +819,10 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes { pub struct VariantSizeDifferences; impl LintPass for VariantSizeDifferences { + fn name(&self) -> &'static str { + "VariantSizeDifferences" + } + fn get_lints(&self) -> LintArray { lint_array!(VARIANT_SIZE_DIFFERENCES) } @@ -826,7 +831,7 @@ impl LintPass for VariantSizeDifferences { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for VariantSizeDifferences { fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { if let hir::ItemKind::Enum(ref enum_definition, _) = it.node { - let item_def_id = cx.tcx.hir.local_def_id(it.id); + let item_def_id = cx.tcx.hir().local_def_id(it.id); let t = cx.tcx.type_of(item_def_id); let ty = cx.tcx.erase_regions(&t); match cx.layout_of(ty) { @@ -846,7 +851,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for VariantSizeDifferences { let bytes = variant_layout.size.bytes().saturating_sub(discr_size); debug!("- variant `{}` is {} bytes large", - variant.node.name, + variant.node.ident, bytes); bytes }) diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index fab618d9c8e..acf5da1e188 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir::def::Def; use rustc::hir::def_id::DefId; use rustc::ty; @@ -43,6 +33,10 @@ declare_lint! { pub struct UnusedResults; impl LintPass for UnusedResults { + fn name(&self) -> &'static str { + "UnusedResults" + } + fn get_lints(&self) -> LintArray { lint_array!(UNUSED_MUST_USE, UNUSED_RESULTS) } @@ -51,7 +45,7 @@ impl LintPass for UnusedResults { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) { let expr = match s.node { - hir::StmtKind::Semi(ref expr, _) => &**expr, + hir::StmtKind::Semi(ref expr) => &**expr, _ => return, }; @@ -61,7 +55,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { let t = cx.tables.expr_ty(&expr); let type_permits_lack_of_use = if t.is_unit() - || cx.tcx.is_ty_uninhabited_from(cx.tcx.hir.get_module_parent(expr.id), t) { + || cx.tcx.is_ty_uninhabited_from(cx.tcx.hir().get_module_parent(expr.id), t) { true } else { match t.sty { @@ -208,6 +202,10 @@ declare_lint! { pub struct PathStatements; impl LintPass for PathStatements { + fn name(&self) -> &'static str { + "PathStatements" + } + fn get_lints(&self) -> LintArray { lint_array!(PATH_STATEMENTS) } @@ -215,7 +213,7 @@ impl LintPass for PathStatements { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PathStatements { fn check_stmt(&mut self, cx: &LateContext, s: &hir::Stmt) { - if let hir::StmtKind::Semi(ref expr, _) = s.node { + if let hir::StmtKind::Semi(ref expr) = s.node { if let hir::ExprKind::Path(_) = expr.node { cx.span_lint(PATH_STATEMENTS, s.span, "path statement with no effect"); } @@ -233,6 +231,10 @@ declare_lint! { pub struct UnusedAttributes; impl LintPass for UnusedAttributes { + fn name(&self) -> &'static str { + "UnusedAttributes" + } + fn get_lints(&self) -> LintArray { lint_array!(UNUSED_ATTRIBUTES) } @@ -242,7 +244,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedAttributes { fn check_attribute(&mut self, cx: &LateContext, attr: &ast::Attribute) { debug!("checking attribute: {:?}", attr); // Note that check_name() marks the attribute as used if it matches. - for &(ref name, ty, _) in BUILTIN_ATTRIBUTES { + for &(name, ty, ..) in BUILTIN_ATTRIBUTES { match ty { AttributeType::Whitelisted if attr.check_name(name) => { debug!("{:?} is Whitelisted", name); @@ -266,7 +268,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedAttributes { cx.span_lint(UNUSED_ATTRIBUTES, attr.span, "unused attribute"); // Is it a builtin attribute that must be used at the crate level? let known_crate = BUILTIN_ATTRIBUTES.iter() - .find(|&&(builtin, ty, _)| name == builtin && ty == AttributeType::CrateLevel) + .find(|&&(builtin, ty, ..)| name == builtin && ty == AttributeType::CrateLevel) .is_some(); // Has a plugin registered this attribute as one that must be used at @@ -364,17 +366,21 @@ impl UnusedParens { _ => false, } }).to_owned(); - err.span_suggestion_short_with_applicability( - span, - "remove these parentheses", - parens_removed, - Applicability::MachineApplicable - ); + err.span_suggestion_short( + span, + "remove these parentheses", + parens_removed, + Applicability::MachineApplicable, + ); err.emit(); } } impl LintPass for UnusedParens { + fn name(&self) -> &'static str { + "UnusedParens" + } + fn get_lints(&self) -> LintArray { lint_array!(UNUSED_PARENS) } @@ -473,7 +479,7 @@ impl UnusedImportBraces { match items[0].0.kind { ast::UseTreeKind::Simple(rename, ..) => { let orig_ident = items[0].0.prefix.segments.last().unwrap().ident; - if orig_ident.name == keywords::SelfValue.name() { + if orig_ident.name == keywords::SelfLower.name() { return; } node_ident = rename.unwrap_or(orig_ident); @@ -493,6 +499,10 @@ impl UnusedImportBraces { } impl LintPass for UnusedImportBraces { + fn name(&self) -> &'static str { + "UnusedImportBraces" + } + fn get_lints(&self) -> LintArray { lint_array!(UNUSED_IMPORT_BRACES) } @@ -516,6 +526,10 @@ declare_lint! { pub struct UnusedAllocation; impl LintPass for UnusedAllocation { + fn name(&self) -> &'static str { + "UnusedAllocation" + } + fn get_lints(&self) -> LintArray { lint_array!(UNUSED_ALLOCATION) } diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index 7d01ed556c8..cd91fcb2995 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate cc; extern crate build_helper; @@ -34,6 +24,8 @@ fn main() { return; } + build_helper::restore_library_path(); + let target = env::var("TARGET").expect("TARGET was not set"); let llvm_config = env::var_os("LLVM_CONFIG") .map(PathBuf::from) @@ -142,6 +134,10 @@ fn main() { continue; } + if flag.starts_with("-flto") { + continue; + } + // -Wdate-time is not supported by the netbsd cross compiler if is_crossed && target.contains("netbsd") && flag.contains("date-time") { continue; @@ -192,11 +188,11 @@ fn main() { // On MSVC llvm-config will print the full name to libraries, but // we're only interested in the name part let name = Path::new(lib).file_name().unwrap().to_str().unwrap(); - name.trim_right_matches(".lib") + name.trim_end_matches(".lib") } else if lib.ends_with(".lib") { // Some MSVC libraries just come up with `.lib` tacked on, so chop // that off - lib.trim_right_matches(".lib") + lib.trim_end_matches(".lib") } else { continue; }; @@ -242,15 +238,20 @@ fn main() { } let llvm_static_stdcpp = env::var_os("LLVM_STATIC_STDCPP"); + let llvm_use_libcxx = env::var_os("LLVM_USE_LIBCXX"); let stdcppname = if target.contains("openbsd") { // llvm-config on OpenBSD doesn't mention stdlib=libc++ "c++" } else if target.contains("freebsd") { "c++" + } else if target.contains("darwin") { + "c++" } else if target.contains("netbsd") && llvm_static_stdcpp.is_some() { // NetBSD uses a separate library when relocation is required "stdc++_pic" + } else if llvm_use_libcxx.is_some() { + "c++" } else { "stdc++" }; diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index 1c48d844739..ca66540fa25 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #![feature(static_nobundle)] @@ -22,7 +12,7 @@ extern crate rustc_cratesio_shim; // NOTE: This crate only exists to allow linking on mingw targets. /// Initialize targets enabled by the build script via `cfg(llvm_component = "...")`. -/// NB: this function can't be moved to `rustc_codegen_llvm` because of the `cfg`s. +/// N.B., this function can't be moved to `rustc_codegen_llvm` because of the `cfg`s. pub fn initialize_available_targets() { macro_rules! init_target( ($cfg:meta, $($method:ident),*) => { { diff --git a/src/librustc_lsan/Cargo.toml b/src/librustc_lsan/Cargo.toml index 2573825a5ff..a8e11df7670 100644 --- a/src/librustc_lsan/Cargo.toml +++ b/src/librustc_lsan/Cargo.toml @@ -16,4 +16,4 @@ cmake = "0.1.18" [dependencies] alloc = { path = "../liballoc" } core = { path = "../libcore" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = "0.1.0" diff --git a/src/librustc_lsan/build.rs b/src/librustc_lsan/build.rs index 05e40cdcedd..ad528bb0390 100644 --- a/src/librustc_lsan/build.rs +++ b/src/librustc_lsan/build.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate build_helper; extern crate cmake; @@ -18,6 +8,8 @@ use cmake::Config; fn main() { if let Some(llvm_config) = env::var_os("LLVM_CONFIG") { + build_helper::restore_library_path(); + let (native, target) = match sanitizer_lib_boilerplate("lsan") { Ok(native) => native, _ => return, diff --git a/src/librustc_lsan/lib.rs b/src/librustc_lsan/lib.rs index 47f917e40c1..d6c8e54c18d 100644 --- a/src/librustc_lsan/lib.rs +++ b/src/librustc_lsan/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![sanitizer_runtime] #![feature(nll)] #![feature(sanitizer_runtime)] diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml index 276e2a911e6..337c87c24ba 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -12,7 +12,6 @@ crate-type = ["dylib"] flate2 = "1.0" log = "0.4" memmap = "0.6" -proc_macro = { path = "../libproc_macro" } rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_errors = { path = "../librustc_errors" } diff --git a/src/librustc_metadata/build.rs b/src/librustc_metadata/build.rs index f18a3f9b940..d230ba91039 100644 --- a/src/librustc_metadata/build.rs +++ b/src/librustc_metadata/build.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-env-changed=CFG_VERSION"); diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index a14dd99eeb3..e9785e7c88d 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Validates all used crates and extern libraries and loads their metadata use cstore::{self, CStore, CrateSource, MetadataBlob}; @@ -36,7 +26,6 @@ use std::{cmp, fs}; use syntax::ast; use syntax::attr; -use syntax::edition::Edition; use syntax::ext::base::SyntaxExtension; use syntax::symbol::Symbol; use syntax::visit; @@ -231,7 +220,7 @@ impl<'a> CrateLoader<'a> { let dependencies: Vec = cnum_map.iter().cloned().collect(); - let proc_macros = crate_root.macro_derive_registrar.map(|_| { + let proc_macros = crate_root.proc_macro_decls_static.map(|_| { self.load_derive_macros(&crate_root, dylib.clone().map(|p| p.0), span) }); @@ -339,7 +328,7 @@ impl<'a> CrateLoader<'a> { match result { LoadResult::Previous(cnum) => { let data = self.cstore.get_crate_data(cnum); - if data.root.macro_derive_registrar.is_some() { + if data.root.proc_macro_decls_static.is_some() { dep_kind = DepKind::UnexportedMacrosOnly; } data.dep_kind.with_lock(|data_dep_kind| { @@ -431,7 +420,7 @@ impl<'a> CrateLoader<'a> { dep_kind: DepKind) -> cstore::CrateNumMap { debug!("resolving deps of external crate"); - if crate_root.macro_derive_registrar.is_some() { + if crate_root.proc_macro_decls_static.is_some() { return cstore::CrateNumMap::new(); } @@ -533,9 +522,8 @@ impl<'a> CrateLoader<'a> { fn load_derive_macros(&mut self, root: &CrateRoot, dylib: Option, span: Span) -> Vec<(ast::Name, Lrc)> { use std::{env, mem}; - use proc_macro::TokenStream; - use proc_macro::__internal::Registry; use dynamic_lib::DynamicLibrary; + use proc_macro::bridge::client::ProcMacro; use syntax_ext::deriving::custom::ProcMacroDerive; use syntax_ext::proc_macro_impl::{AttrProcMacro, BangProcMacro}; @@ -550,61 +538,49 @@ impl<'a> CrateLoader<'a> { Err(err) => self.sess.span_fatal(span, &err), }; - let sym = self.sess.generate_derive_registrar_symbol(root.disambiguator); - let registrar = unsafe { + let sym = self.sess.generate_proc_macro_decls_symbol(root.disambiguator); + let decls = unsafe { let sym = match lib.symbol(&sym) { Ok(f) => f, Err(err) => self.sess.span_fatal(span, &err), }; - mem::transmute::<*mut u8, fn(&mut dyn Registry)>(sym) + *(sym as *const &[ProcMacro]) }; - struct MyRegistrar { - extensions: Vec<(ast::Name, Lrc)>, - edition: Edition, - } - - impl Registry for MyRegistrar { - fn register_custom_derive(&mut self, - trait_name: &str, - expand: fn(TokenStream) -> TokenStream, - attributes: &[&'static str]) { - let attrs = attributes.iter().cloned().map(Symbol::intern).collect::>(); - let derive = ProcMacroDerive::new(expand, attrs.clone()); - let derive = SyntaxExtension::ProcMacroDerive( - Box::new(derive), attrs, self.edition - ); - self.extensions.push((Symbol::intern(trait_name), Lrc::new(derive))); - } - - fn register_attr_proc_macro(&mut self, - name: &str, - expand: fn(TokenStream, TokenStream) -> TokenStream) { - let expand = SyntaxExtension::AttrProcMacro( - Box::new(AttrProcMacro { inner: expand }), self.edition - ); - self.extensions.push((Symbol::intern(name), Lrc::new(expand))); - } - - fn register_bang_proc_macro(&mut self, - name: &str, - expand: fn(TokenStream) -> TokenStream) { - let expand = SyntaxExtension::ProcMacro { - expander: Box::new(BangProcMacro { inner: expand }), - allow_internal_unstable: false, - edition: self.edition, - }; - self.extensions.push((Symbol::intern(name), Lrc::new(expand))); + let extensions = decls.iter().map(|&decl| { + match decl { + ProcMacro::CustomDerive { trait_name, attributes, client } => { + let attrs = attributes.iter().cloned().map(Symbol::intern).collect::>(); + (trait_name, SyntaxExtension::ProcMacroDerive( + Box::new(ProcMacroDerive { + client, + attrs: attrs.clone(), + }), + attrs, + root.edition, + )) + } + ProcMacro::Attr { name, client } => { + (name, SyntaxExtension::AttrProcMacro( + Box::new(AttrProcMacro { client }), + root.edition, + )) + } + ProcMacro::Bang { name, client } => { + (name, SyntaxExtension::ProcMacro { + expander: Box::new(BangProcMacro { client }), + allow_internal_unstable: false, + edition: root.edition, + }) + } } - } - - let mut my_registrar = MyRegistrar { extensions: Vec::new(), edition: root.edition }; - registrar(&mut my_registrar); + }).map(|(name, ext)| (Symbol::intern(name), Lrc::new(ext))).collect(); // Intentionally leak the dynamic library. We can't ever unload it // since the library can make things that will live arbitrarily long. mem::forget(lib); - my_registrar.extensions + + extensions } /// Look for a plugin registrar. Returns library path, crate diff --git a/src/librustc_metadata/cstore.rs b/src/librustc_metadata/cstore.rs index 2be9883d03d..543fb5d5df5 100644 --- a/src/librustc_metadata/cstore.rs +++ b/src/librustc_metadata/cstore.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The crate store - a central repo for information collected about external // crates and libraries @@ -56,7 +46,7 @@ pub struct CrateMetadata { /// Original name of the crate. pub name: Symbol, - /// Name of the crate as imported. I.e. if imported with + /// Name of the crate as imported. I.e., if imported with /// `extern crate foo as bar;` this will be `bar`. pub imported_name: Symbol, diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index c7bd1744a3d..e61229db86d 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cstore::{self, LoadedMacro}; use encoder; use link_args; @@ -203,8 +193,8 @@ provide! { <'tcx> tcx, def_id, other, cdata, DefId { krate: def_id.krate, index } }) } - derive_registrar_fn => { - cdata.root.macro_derive_registrar.map(|index| { + proc_macro_decls_static => { + cdata.root.proc_macro_decls_static.map(|index| { DefId { krate: def_id.krate, index } }) } @@ -307,7 +297,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { Lrc::new(link_args::collect(tcx)) }, - // Returns a map from a sufficiently visible external item (i.e. an + // Returns a map from a sufficiently visible external item (i.e., an // external item that is visible from at least one local module) to a // sufficiently visible parent (considering modules that re-export the // external item to be parents). @@ -431,8 +421,9 @@ impl cstore::CStore { use syntax::ext::base::SyntaxExtension; use syntax_ext::proc_macro_impl::BangProcMacro; + let client = ::proc_macro::bridge::client::Client::expand1(::proc_macro::quote); let ext = SyntaxExtension::ProcMacro { - expander: Box::new(BangProcMacro { inner: ::proc_macro::quote }), + expander: Box::new(BangProcMacro { client }), allow_internal_unstable: true, edition: data.root.edition, }; diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 1c7e3c95d14..ad6296e1a3b 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Decoding metadata from a single crate's metadata use cstore::{self, CrateMetadata, MetadataBlob, NativeLibrary, ForeignModule}; @@ -428,6 +418,7 @@ impl<'tcx> EntryKind<'tcx> { EntryKind::Mod(_) => Def::Mod(did), EntryKind::Variant(_) => Def::Variant(did), EntryKind::Trait(_) => Def::Trait(did), + EntryKind::TraitAlias(_) => Def::TraitAlias(did), EntryKind::Enum(..) => Def::Enum(did), EntryKind::MacroDef(_) => Def::Macro(did, MacroKind::Bang), EntryKind::ForeignType => Def::ForeignTy(did), @@ -530,17 +521,26 @@ impl<'a, 'tcx> CrateMetadata { } pub fn get_trait_def(&self, item_id: DefIndex, sess: &Session) -> ty::TraitDef { - let data = match self.entry(item_id).kind { - EntryKind::Trait(data) => data.decode((self, sess)), - _ => bug!(), - }; - - ty::TraitDef::new(self.local_def_id(item_id), - data.unsafety, - data.paren_sugar, - data.has_auto_impl, - data.is_marker, - self.def_path_table.def_path_hash(item_id)) + match self.entry(item_id).kind { + EntryKind::Trait(data) => { + let data = data.decode((self, sess)); + ty::TraitDef::new(self.local_def_id(item_id), + data.unsafety, + data.paren_sugar, + data.has_auto_impl, + data.is_marker, + self.def_path_table.def_path_hash(item_id)) + }, + EntryKind::TraitAlias(_) => { + ty::TraitDef::new(self.local_def_id(item_id), + hir::Unsafety::Normal, + false, + false, + false, + self.def_path_table.def_path_hash(item_id)) + }, + _ => bug!("def-index does not refer to trait or trait alias"), + } } fn get_variant(&self, @@ -563,7 +563,7 @@ impl<'a, 'tcx> CrateMetadata { ty::VariantDef::new( tcx, def_id, - self.item_name(index).as_symbol(), + Ident::from_interned_str(self.item_name(index)), data.discr, item.children.decode(self).map(|index| { let f = self.entry(index); @@ -625,10 +625,13 @@ impl<'a, 'tcx> CrateMetadata { item_id: DefIndex, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> ty::GenericPredicates<'tcx> { - match self.entry(item_id).kind { - EntryKind::Trait(data) => data.decode(self).super_predicates.decode((self, tcx)), - _ => bug!(), - } + let super_predicates = match self.entry(item_id).kind { + EntryKind::Trait(data) => data.decode(self).super_predicates, + EntryKind::TraitAlias(data) => data.decode(self).super_predicates, + _ => bug!("def-index does not refer to trait or trait alias"), + }; + + super_predicates.decode((self, tcx)) } pub fn get_generics(&self, @@ -890,6 +893,9 @@ impl<'a, 'tcx> CrateMetadata { EntryKind::AssociatedType(container) => { (ty::AssociatedKind::Type, container, false) } + EntryKind::AssociatedExistential(container) => { + (ty::AssociatedKind::Existential, container, false) + } _ => bug!("cannot get associated-item of `{:?}`", def_key) }; @@ -1024,7 +1030,8 @@ impl<'a, 'tcx> CrateMetadata { } def_key.parent.and_then(|parent_index| { match self.entry(parent_index).kind { - EntryKind::Trait(_) => Some(self.local_def_id(parent_index)), + EntryKind::Trait(_) | + EntryKind::TraitAlias(_) => Some(self.local_def_id(parent_index)), _ => None, } }) diff --git a/src/librustc_metadata/diagnostics.rs b/src/librustc_metadata/diagnostics.rs index b38c1235573..1b185243474 100644 --- a/src/librustc_metadata/diagnostics.rs +++ b/src/librustc_metadata/diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] register_long_diagnostics! { diff --git a/src/librustc_metadata/dynamic_lib.rs b/src/librustc_metadata/dynamic_lib.rs index 182a071277e..7d1c3c09d33 100644 --- a/src/librustc_metadata/dynamic_lib.rs +++ b/src/librustc_metadata/dynamic_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Dynamic library facilities. //! //! A simple wrapper over the platform's dynamic library facilities diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 5421972a4ad..afb0218501d 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use index::Index; use index_builder::{FromId, IndexBuilder, Untracked}; use isolated_encoder::IsolatedEncoder; @@ -318,7 +308,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { } fn encode_info_for_items(&mut self) -> Index { - let krate = self.tcx.hir.krate(); + let krate = self.tcx.hir().krate(); let mut index = IndexBuilder::new(self); let vis = Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Public }; index.record(DefId::local(CRATE_DEF_INDEX), @@ -333,7 +323,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { } fn encode_def_path_table(&mut self) -> Lazy { - let definitions = self.tcx.hir.definitions(); + let definitions = self.tcx.hir().definitions(); self.lazy(definitions.def_path_table()) } @@ -475,7 +465,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { let index = items.write_index(&mut self.opaque); let index_bytes = self.position() - i; - let attrs = tcx.hir.krate_attrs(); + let attrs = tcx.hir().krate_attrs(); let is_proc_macro = tcx.sess.crate_types.borrow().contains(&CrateType::ProcMacro); let has_default_lib_allocator = attr::contains_name(&attrs, "default_lib_allocator"); let has_global_allocator = *tcx.sess.has_global_allocator.get(); @@ -492,13 +482,10 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { has_global_allocator: has_global_allocator, has_panic_handler: has_panic_handler, has_default_lib_allocator: has_default_lib_allocator, - plugin_registrar_fn: tcx.sess - .plugin_registrar_fn - .get() - .map(|id| tcx.hir.local_def_id(id).index), - macro_derive_registrar: if is_proc_macro { - let id = tcx.sess.derive_registrar_fn.get().unwrap(); - Some(tcx.hir.local_def_id(id).index) + plugin_registrar_fn: tcx.plugin_registrar_fn(LOCAL_CRATE).map(|id| id.index), + proc_macro_decls_static: if is_proc_macro { + let id = tcx.proc_macro_decls_static(LOCAL_CRATE).unwrap(); + Some(id.index) } else { None }, @@ -600,8 +587,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { } }; - let enum_id = tcx.hir.as_local_node_id(enum_did).unwrap(); - let enum_vis = &tcx.hir.expect_item(enum_id).vis; + let enum_id = tcx.hir().as_local_node_id(enum_did).unwrap(); + let enum_vis = &tcx.hir().expect_item(enum_id).vis; Entry { kind: EntryKind::Variant(self.lazy(&data)), @@ -636,7 +623,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { &hir::Visibility)>) -> Entry<'tcx> { let tcx = self.tcx; - let def_id = tcx.hir.local_def_id(id); + let def_id = tcx.hir().local_def_id(id); debug!("IsolatedEncoder::encode_info_for_mod({:?})", def_id); let data = ModData { @@ -652,7 +639,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { span: self.lazy(&tcx.def_span(def_id)), attributes: self.encode_attributes(attrs), children: self.lazy_seq(md.item_ids.iter().map(|item_id| { - tcx.hir.local_def_id(item_id.id).index + tcx.hir().local_def_id(item_id.id).index })), stability: self.encode_stability(def_id), deprecation: self.encode_deprecation(def_id), @@ -686,8 +673,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { let def_id = field.did; debug!("IsolatedEncoder::encode_field({:?})", def_id); - let variant_id = tcx.hir.as_local_node_id(variant.did).unwrap(); - let variant_data = tcx.hir.expect_variant_data(variant_id); + let variant_id = tcx.hir().as_local_node_id(variant.did).unwrap(); + let variant_data = tcx.hir().expect_variant_data(variant_id); Entry { kind: EntryKind::Field, @@ -726,8 +713,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { } }; - let struct_id = tcx.hir.as_local_node_id(adt_def_id).unwrap(); - let struct_vis = &tcx.hir.expect_item(struct_id).vis; + let struct_id = tcx.hir().as_local_node_id(adt_def_id).unwrap(); + let struct_vis = &tcx.hir().expect_item(struct_id).vis; let mut ctor_vis = ty::Visibility::from_hir(struct_vis, struct_id, tcx); for field in &variant.fields { if ctor_vis.is_at_least(field.vis, tcx) { @@ -791,8 +778,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { debug!("IsolatedEncoder::encode_info_for_trait_item({:?})", def_id); let tcx = self.tcx; - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let ast_item = tcx.hir.expect_trait_item(node_id); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let ast_item = tcx.hir().expect_trait_item(node_id); let trait_item = tcx.associated_item(def_id); let container = match trait_item.defaultness { @@ -814,7 +801,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { }; let rendered = - hir::print::to_string(&self.tcx.hir, |s| s.print_trait_item(ast_item)); + hir::print::to_string(self.tcx.hir(), |s| s.print_trait_item(ast_item)); let rendered_const = self.lazy(&RenderedConst(rendered)); EntryKind::AssociatedConst(container, const_qualif, rendered_const) @@ -891,7 +878,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { } fn const_qualif(&self, mir: u8, body_id: hir::BodyId) -> ConstQualif { - let body_owner_def_id = self.tcx.hir.body_owner_def_id(body_id); + let body_owner_def_id = self.tcx.hir().body_owner_def_id(body_id); let ast_promotable = self.tcx.const_is_rvalue_promotable_to_static(body_owner_def_id); ConstQualif { mir, ast_promotable } @@ -901,8 +888,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { debug!("IsolatedEncoder::encode_info_for_impl_item({:?})", def_id); let tcx = self.tcx; - let node_id = self.tcx.hir.as_local_node_id(def_id).unwrap(); - let ast_item = self.tcx.hir.expect_impl_item(node_id); + let node_id = self.tcx.hir().as_local_node_id(def_id).unwrap(); + let ast_item = self.tcx.hir().expect_impl_item(node_id); let impl_item = self.tcx.associated_item(def_id); let container = match impl_item.defaultness { @@ -987,7 +974,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { fn encode_fn_arg_names_for_body(&mut self, body_id: hir::BodyId) -> LazySeq { self.tcx.dep_graph.with_ignore(|| { - let body = self.tcx.hir.body(body_id); + let body = self.tcx.hir().body(body_id); self.lazy_seq(body.arguments.iter().map(|arg| { match arg.pat.node { PatKind::Binding(_, _, ident, _) => ident.name, @@ -1036,8 +1023,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { } fn encode_rendered_const_for_body(&mut self, body_id: hir::BodyId) -> Lazy { - let body = self.tcx.hir.body(body_id); - let rendered = hir::print::to_string(&self.tcx.hir, |s| s.print_expr(&body.value)); + let body = self.tcx.hir().body(body_id); + let rendered = hir::print::to_string(self.tcx.hir(), |s| s.print_expr(&body.value)); let rendered_const = &RenderedConst(rendered); self.lazy(rendered_const) } @@ -1081,7 +1068,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { // for methods, write all the stuff get_trait_method // needs to know let struct_ctor = if !struct_def.is_struct() { - Some(tcx.hir.local_def_id(struct_def.id()).index) + Some(tcx.hir().local_def_id(struct_def.id()).index) } else { None }; @@ -1153,8 +1140,14 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { EntryKind::Trait(self.lazy(&data)) } + hir::ItemKind::TraitAlias(..) => { + let data = TraitAliasData { + super_predicates: self.lazy(&tcx.super_predicates_of(def_id)), + }; + + EntryKind::TraitAlias(self.lazy(&data)) + } hir::ItemKind::ExternCrate(_) | - hir::ItemKind::TraitAlias(..) | hir::ItemKind::Use(..) => bug!("cannot encode info for item {:?}", item), }; @@ -1167,7 +1160,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { hir::ItemKind::ForeignMod(ref fm) => { self.lazy_seq(fm.items .iter() - .map(|foreign_item| tcx.hir.local_def_id(foreign_item.id).index)) + .map(|foreign_item| tcx.hir().local_def_id(foreign_item.id).index)) } hir::ItemKind::Enum(..) => { let def = self.tcx.adt_def(def_id); @@ -1227,6 +1220,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { hir::ItemKind::Impl(..) | hir::ItemKind::Existential(..) | hir::ItemKind::Trait(..) => Some(self.encode_generics(def_id)), + hir::ItemKind::TraitAlias(..) => Some(self.encode_generics(def_id)), _ => None, }, predicates: match item.node { @@ -1239,7 +1233,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { hir::ItemKind::Union(..) | hir::ItemKind::Impl(..) | hir::ItemKind::Existential(..) | - hir::ItemKind::Trait(..) => Some(self.encode_predicates(def_id)), + hir::ItemKind::Trait(..) | + hir::ItemKind::TraitAlias(..) => Some(self.encode_predicates(def_id)), _ => None, }, @@ -1249,7 +1244,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { // hack. (No reason not to expand it in the future if // necessary.) predicates_defined_on: match item.node { - hir::ItemKind::Trait(..) => Some(self.encode_predicates_defined_on(def_id)), + hir::ItemKind::Trait(..) | + hir::ItemKind::TraitAlias(..) => Some(self.encode_predicates_defined_on(def_id)), _ => None, // not *wrong* for other kinds of items, but not needed }, @@ -1282,7 +1278,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { /// Serialize the text of exported macros fn encode_info_for_macro_def(&mut self, macro_def: &hir::MacroDef) -> Entry<'tcx> { use syntax::print::pprust; - let def_id = self.tcx.hir.local_def_id(macro_def.id); + let def_id = self.tcx.hir().local_def_id(macro_def.id); Entry { kind: EntryKind::MacroDef(self.lazy(&MacroDef { body: pprust::tts_to_string(¯o_def.body.trees().collect::>()), @@ -1339,8 +1335,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { let tcx = self.tcx; let tables = self.tcx.typeck_tables_of(def_id); - let node_id = self.tcx.hir.as_local_node_id(def_id).unwrap(); - let hir_id = self.tcx.hir.node_to_hir_id(node_id); + let node_id = self.tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = self.tcx.hir().node_to_hir_id(node_id); let kind = match tables.node_id_to_type(hir_id).sty { ty::Generator(def_id, ..) => { let layout = self.tcx.generator_layout(def_id); @@ -1382,8 +1378,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { fn encode_info_for_anon_const(&mut self, def_id: DefId) -> Entry<'tcx> { debug!("IsolatedEncoder::encode_info_for_anon_const({:?})", def_id); let tcx = self.tcx; - let id = tcx.hir.as_local_node_id(def_id).unwrap(); - let body_id = tcx.hir.body_owned_by(id); + let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let body_id = tcx.hir().body_owned_by(id); let const_data = self.encode_rendered_const_for_body(body_id); let mir = tcx.mir_const_qualif(def_id).0; @@ -1491,7 +1487,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { tcx, impls: FxHashMap::default(), }; - tcx.hir.krate().visit_all_item_likes(&mut visitor); + tcx.hir().krate().visit_all_item_likes(&mut visitor); let mut all_impls: Vec<_> = visitor.impls.into_iter().collect(); @@ -1505,7 +1501,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { .map(|(trait_def_id, mut impls)| { // Bring everything into deterministic order for hashing impls.sort_by_cached_key(|&def_index| { - tcx.hir.definitions().def_path_hash(def_index) + tcx.hir().definitions().def_path_hash(def_index) }); TraitImpls { @@ -1617,7 +1613,7 @@ struct EncodeVisitor<'a, 'b: 'a, 'tcx: 'b> { impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::OnlyBodies(&self.index.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.index.tcx.hir()) } fn visit_expr(&mut self, ex: &'tcx hir::Expr) { intravisit::walk_expr(self, ex); @@ -1625,7 +1621,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> { } fn visit_item(&mut self, item: &'tcx hir::Item) { intravisit::walk_item(self, item); - let def_id = self.index.tcx.hir.local_def_id(item.id); + let def_id = self.index.tcx.hir().local_def_id(item.id); match item.node { hir::ItemKind::ExternCrate(_) | hir::ItemKind::Use(..) => (), // ignore these @@ -1635,7 +1631,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> { } fn visit_foreign_item(&mut self, ni: &'tcx hir::ForeignItem) { intravisit::walk_foreign_item(self, ni); - let def_id = self.index.tcx.hir.local_def_id(ni.id); + let def_id = self.index.tcx.hir().local_def_id(ni.id); self.index.record(def_id, IsolatedEncoder::encode_info_for_foreign_item, (def_id, ni)); @@ -1647,7 +1643,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> { intravisit::walk_variant(self, v, g, id); if let Some(ref discr) = v.node.disr_expr { - let def_id = self.index.tcx.hir.local_def_id(discr.id); + let def_id = self.index.tcx.hir().local_def_id(discr.id); self.index.record(def_id, IsolatedEncoder::encode_info_for_anon_const, def_id); } } @@ -1660,7 +1656,7 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> { self.index.encode_info_for_ty(ty); } fn visit_macro_def(&mut self, macro_def: &'tcx hir::MacroDef) { - let def_id = self.index.tcx.hir.local_def_id(macro_def.id); + let def_id = self.index.tcx.hir().local_def_id(macro_def.id); self.index.record(def_id, IsolatedEncoder::encode_info_for_macro_def, macro_def); } } @@ -1682,7 +1678,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { match param.kind { hir::GenericParamKind::Lifetime { .. } => {} hir::GenericParamKind::Type { ref default, .. } => { - let def_id = self.tcx.hir.local_def_id(param.id); + let def_id = self.tcx.hir().local_def_id(param.id); let has_default = Untracked(default.is_some()); let encode_info = IsolatedEncoder::encode_info_for_ty_param; self.record(def_id, encode_info, (def_id, has_default)); @@ -1694,7 +1690,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { fn encode_info_for_ty(&mut self, ty: &hir::Ty) { match ty.node { hir::TyKind::Array(_, ref length) => { - let def_id = self.tcx.hir.local_def_id(length.id); + let def_id = self.tcx.hir().local_def_id(length.id); self.record(def_id, IsolatedEncoder::encode_info_for_anon_const, def_id); } _ => {} @@ -1704,7 +1700,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { fn encode_info_for_expr(&mut self, expr: &hir::Expr) { match expr.node { hir::ExprKind::Closure(..) => { - let def_id = self.tcx.hir.local_def_id(expr.id); + let def_id = self.tcx.hir().local_def_id(expr.id); self.record(def_id, IsolatedEncoder::encode_info_for_closure, def_id); } _ => {} @@ -1716,7 +1712,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { /// so it's easier to do that here then to wait until we would encounter /// normally in the visitor walk. fn encode_addl_info_for_item(&mut self, item: &hir::Item) { - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); match item.node { hir::ItemKind::Static(..) | hir::ItemKind::Const(..) | @@ -1746,7 +1742,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { // If the struct has a constructor, encode it. if !struct_def.is_struct() { - let ctor_def_id = self.tcx.hir.local_def_id(struct_def.id()); + let ctor_def_id = self.tcx.hir().local_def_id(struct_def.id()); self.record(ctor_def_id, IsolatedEncoder::encode_struct_ctor, (def_id, ctor_def_id)); @@ -1781,7 +1777,7 @@ struct ImplVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { if let hir::ItemKind::Impl(..) = item.node { - let impl_id = self.tcx.hir.local_def_id(item.id); + let impl_id = self.tcx.hir().local_def_id(item.id); if let Some(trait_ref) = self.tcx.impl_trait_ref(impl_id) { self.impls .entry(trait_ref.def_id) diff --git a/src/librustc_metadata/foreign_modules.rs b/src/librustc_metadata/foreign_modules.rs index e96d56fb388..2c03bd6659f 100644 --- a/src/librustc_metadata/foreign_modules.rs +++ b/src/librustc_metadata/foreign_modules.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir; use rustc::middle::cstore::ForeignModule; @@ -18,7 +8,7 @@ pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Vec { tcx, modules: Vec::new(), }; - tcx.hir.krate().visit_all_item_likes(&mut collector); + tcx.hir().krate().visit_all_item_likes(&mut collector); return collector.modules } @@ -35,11 +25,11 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for Collector<'a, 'tcx> { }; let foreign_items = fm.items.iter() - .map(|it| self.tcx.hir.local_def_id(it.id)) + .map(|it| self.tcx.hir().local_def_id(it.id)) .collect(); self.modules.push(ForeignModule { foreign_items, - def_id: self.tcx.hir.local_def_id(it.id), + def_id: self.tcx.hir().local_def_id(it.id), }); } diff --git a/src/librustc_metadata/index.rs b/src/librustc_metadata/index.rs index 0b4f7e579ac..ccf398241b1 100644 --- a/src/librustc_metadata/index.rs +++ b/src/librustc_metadata/index.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use schema::*; use rustc::hir::def_id::{DefId, DefIndex, DefIndexAddressSpace}; diff --git a/src/librustc_metadata/index_builder.rs b/src/librustc_metadata/index_builder.rs index fd2c2237c32..3608b12aea9 100644 --- a/src/librustc_metadata/index_builder.rs +++ b/src/librustc_metadata/index_builder.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Builder types for generating the "item data" section of the //! metadata. This section winds up looking like this: //! @@ -90,7 +80,7 @@ impl<'a, 'b, 'tcx> DerefMut for IndexBuilder<'a, 'b, 'tcx> { impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { pub fn new(ecx: &'a mut EncodeContext<'b, 'tcx>) -> Self { IndexBuilder { - items: Index::new(ecx.tcx.hir.definitions().def_index_counts_lo_hi()), + items: Index::new(ecx.tcx.hir().definitions().def_index_counts_lo_hi()), ecx, } } @@ -195,7 +185,7 @@ macro_rules! read_hir { ($t:ty) => { impl<'tcx> DepGraphRead for &'tcx $t { fn read(&self, tcx: TyCtxt) { - tcx.hir.read(self.id); + tcx.hir().read(self.id); } } } @@ -229,6 +219,6 @@ pub struct FromId(pub ast::NodeId, pub T); impl DepGraphRead for FromId { fn read(&self, tcx: TyCtxt) { - tcx.hir.read(self.0); + tcx.hir().read(self.0); } } diff --git a/src/librustc_metadata/isolated_encoder.rs b/src/librustc_metadata/isolated_encoder.rs index 88594afa320..c09d35d150a 100644 --- a/src/librustc_metadata/isolated_encoder.rs +++ b/src/librustc_metadata/isolated_encoder.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use encoder::EncodeContext; use schema::{Lazy, LazySeq}; use rustc::ty::TyCtxt; diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index 0322c888ad5..1a661421240 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -1,24 +1,12 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] #![feature(box_patterns)] #![feature(libc)] -#![feature(macro_at_most_once_rep)] #![feature(nll)] #![feature(proc_macro_internals)] #![feature(proc_macro_quote)] -#![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(slice_sort_by_cached_key)] #![feature(crate_visibility_modifier)] diff --git a/src/librustc_metadata/link_args.rs b/src/librustc_metadata/link_args.rs index 008e1e363ff..6741b5235db 100644 --- a/src/librustc_metadata/link_args.rs +++ b/src/librustc_metadata/link_args.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir; use rustc::ty::TyCtxt; @@ -17,9 +7,9 @@ pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Vec { let mut collector = Collector { args: Vec::new(), }; - tcx.hir.krate().visit_all_item_likes(&mut collector); + tcx.hir().krate().visit_all_item_likes(&mut collector); - for attr in tcx.hir.krate().attrs.iter() { + for attr in tcx.hir().krate().attrs.iter() { if attr.path == "link_args" { if let Some(linkarg) = attr.value_str() { collector.add_link_args(&linkarg.as_str()); diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs index 528c96f240d..6b49d6b9e52 100644 --- a/src/librustc_metadata/locator.rs +++ b/src/librustc_metadata/locator.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Finds crate binaries and loads their metadata //! //! Might I be the first to welcome you to a world of platform differences, @@ -661,7 +651,7 @@ impl<'a> Context<'a> { // Ok so at this point we've determined that `(lib, kind)` above is // a candidate crate to load, and that `slot` is either none (this // is the first crate of its kind) or if some the previous path has - // the exact same hash (e.g. it's the exact same crate). + // the exact same hash (e.g., it's the exact same crate). // // In principle these two candidate crates are exactly the same so // we can choose either of them to link. As a stupidly gross hack, @@ -678,7 +668,7 @@ impl<'a> Context<'a> { // candidates are all canonicalized, so we canonicalize the sysroot // as well. if let Some((ref prev, _)) = ret { - let sysroot = self.sess.sysroot(); + let sysroot = &self.sess.sysroot; let sysroot = sysroot.canonicalize() .unwrap_or_else(|_| sysroot.to_path_buf()); if prev.starts_with(&sysroot) { @@ -713,7 +703,7 @@ impl<'a> Context<'a> { let root = metadata.get_root(); if let Some(is_proc_macro) = self.is_proc_macro { - if root.macro_derive_registrar.is_some() != is_proc_macro { + if root.proc_macro_decls_static.is_some() != is_proc_macro { return None; } } diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index 392644c793d..1f00086e32f 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir; use rustc::middle::cstore::{self, NativeLibrary}; @@ -25,7 +15,7 @@ pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Vec { tcx, libs: Vec::new(), }; - tcx.hir.krate().visit_all_item_likes(&mut collector); + tcx.hir().krate().visit_all_item_likes(&mut collector); collector.process_command_line(); return collector.libs } @@ -65,7 +55,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for Collector<'a, 'tcx> { name: None, kind: cstore::NativeUnknown, cfg: None, - foreign_module: Some(self.tcx.hir.local_def_id(it.id)), + foreign_module: Some(self.tcx.hir().local_def_id(it.id)), wasm_import_module: None, }; let mut kind_specified = false; @@ -173,7 +163,7 @@ impl<'a, 'tcx> Collector<'a, 'tcx> { !self.tcx.features().static_nobundle { feature_gate::emit_feature_err(&self.tcx.sess.parse_sess, "static_nobundle", - span.unwrap(), + span.unwrap_or_else(|| syntax_pos::DUMMY_SP), GateIssue::Language, "kind=\"static-nobundle\" is feature gated"); } diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index da2a8ae714b..f3ff9747625 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use index; use rustc::hir; @@ -40,7 +30,7 @@ pub fn rustc_version() -> String { } /// Metadata encoding version. -/// NB: increment this if you change the format of metadata such that +/// N.B., increment this if you change the format of metadata such that /// the rustc version can't be found to compare with `rustc_version()`. pub const METADATA_VERSION: u8 = 4; @@ -52,7 +42,7 @@ pub const METADATA_VERSION: u8 = 4; /// This header is followed by the position of the `CrateRoot`, /// which is encoded as a 32-bit big-endian unsigned integer, /// and further followed by the rustc version string. -pub const METADATA_HEADER: &'static [u8; 12] = +pub const METADATA_HEADER: &[u8; 12] = &[0, 0, 0, 0, b'r', b'u', b's', b't', 0, 0, 0, METADATA_VERSION]; /// A value of type T referred to by its absolute position @@ -196,7 +186,7 @@ pub struct CrateRoot { pub has_panic_handler: bool, pub has_default_lib_allocator: bool, pub plugin_registrar_fn: Option, - pub macro_derive_registrar: Option, + pub proc_macro_decls_static: Option, pub crate_deps: LazySeq, pub dylib_dependency_formats: LazySeq>, @@ -326,6 +316,7 @@ pub enum EntryKind<'tcx> { AssociatedType(AssociatedContainer), AssociatedExistential(AssociatedContainer), AssociatedConst(AssociatedContainer, ConstQualif, Lazy), + TraitAlias(Lazy>), } impl<'a, 'gcx> HashStable> for EntryKind<'gcx> { @@ -380,6 +371,9 @@ impl<'a, 'gcx> HashStable> for EntryKind<'gcx> { EntryKind::Trait(ref trait_data) => { trait_data.hash_stable(hcx, hasher); } + EntryKind::TraitAlias(ref trait_alias_data) => { + trait_alias_data.hash_stable(hcx, hasher); + } EntryKind::Impl(ref impl_data) => { impl_data.hash_stable(hcx, hasher); } @@ -484,6 +478,15 @@ impl_stable_hash_for!(struct TraitData<'tcx> { super_predicates }); +#[derive(RustcEncodable, RustcDecodable)] +pub struct TraitAliasData<'tcx> { + pub super_predicates: Lazy>, +} + +impl_stable_hash_for!(struct TraitAliasData<'tcx> { + super_predicates +}); + #[derive(RustcEncodable, RustcDecodable)] pub struct ImplData<'tcx> { pub polarity: hir::ImplPolarity, diff --git a/src/librustc_mir/Cargo.toml b/src/librustc_mir/Cargo.toml index 2da0ede9d15..f0234c48c3e 100644 --- a/src/librustc_mir/Cargo.toml +++ b/src/librustc_mir/Cargo.toml @@ -15,7 +15,7 @@ either = "1.5.0" graphviz = { path = "../libgraphviz" } log = "0.4" log_settings = "0.1.1" -polonius-engine = "0.5.0" +polonius-engine = "0.6.2" rustc = { path = "../librustc" } rustc_target = { path = "../librustc_target" } rustc_data_structures = { path = "../librustc_data_structures" } @@ -25,4 +25,4 @@ syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } byteorder = { version = "1.1", features = ["i128"] } rustc_apfloat = { path = "../librustc_apfloat" } -smallvec = { version = "0.6.5", features = ["union"] } +smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index c432826dca8..ecbc6118bc3 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -1,22 +1,13 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::place_ext::PlaceExt; +use borrow_check::nll::ToRegionVid; use dataflow::indexes::BorrowIndex; use dataflow::move_paths::MoveData; use rustc::mir::traversal; use rustc::mir::visit::{ PlaceContext, Visitor, NonUseContext, MutatingUseContext, NonMutatingUseContext }; -use rustc::mir::{self, Location, Mir, Place, Local}; -use rustc::ty::{Region, TyCtxt}; +use rustc::mir::{self, Location, Mir, Local}; +use rustc::ty::{RegionVid, TyCtxt}; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_data_structures::indexed_vec::IndexVec; use rustc_data_structures::bit_set::BitSet; @@ -40,10 +31,6 @@ crate struct BorrowSet<'tcx> { /// only need to store one borrow index crate activation_map: FxHashMap>, - /// Every borrow has a region; this maps each such regions back to - /// its borrow-indexes. - crate region_map: FxHashMap, FxHashSet>, - /// Map from local to all the borrows on that local crate local_map: FxHashMap>, @@ -77,7 +64,7 @@ crate struct BorrowData<'tcx> { /// What kind of borrow this is crate kind: mir::BorrowKind, /// The region for which this borrow is live - crate region: Region<'tcx>, + crate region: RegionVid, /// Place from which we are borrowing crate borrowed_place: mir::Place<'tcx>, /// Place to which the borrow was stored @@ -92,13 +79,7 @@ impl<'tcx> fmt::Display for BorrowData<'tcx> { mir::BorrowKind::Unique => "uniq ", mir::BorrowKind::Mut { .. } => "mut ", }; - let region = self.region.to_string(); - let separator = if !region.is_empty() { - " " - } else { - "" - }; - write!(w, "&{}{}{}{:?}", region, separator, kind, self.borrowed_place) + write!(w, "&{:?} {}{:?}", self.region, kind, self.borrowed_place) } } @@ -154,7 +135,6 @@ impl<'tcx> BorrowSet<'tcx> { idx_vec: IndexVec::new(), location_map: Default::default(), activation_map: Default::default(), - region_map: Default::default(), local_map: Default::default(), pending_activations: Default::default(), locals_state_at_exit: @@ -169,7 +149,6 @@ impl<'tcx> BorrowSet<'tcx> { borrows: visitor.idx_vec, location_map: visitor.location_map, activation_map: visitor.activation_map, - region_map: visitor.region_map, local_map: visitor.local_map, locals_state_at_exit: visitor.locals_state_at_exit, } @@ -189,7 +168,6 @@ struct GatherBorrows<'a, 'gcx: 'tcx, 'tcx: 'a> { idx_vec: IndexVec>, location_map: FxHashMap, activation_map: FxHashMap>, - region_map: FxHashMap, FxHashSet>, local_map: FxHashMap>, /// When we encounter a 2-phase borrow statement, it will always @@ -219,6 +197,8 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> { return; } + let region = region.to_region_vid(); + let borrow = BorrowData { kind, region, @@ -230,9 +210,8 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> { let idx = self.idx_vec.push(borrow); self.location_map.insert(location, idx); - self.insert_as_pending_if_two_phase(location, &assigned_place, region, kind, idx); + self.insert_as_pending_if_two_phase(location, &assigned_place, kind, idx); - self.region_map.entry(region).or_default().insert(idx); if let Some(local) = borrowed_place.root_local() { self.local_map.entry(local).or_default().insert(idx); } @@ -241,68 +220,68 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> { self.super_assign(block, assigned_place, rvalue, location) } - fn visit_place( + fn visit_local( &mut self, - place: &mir::Place<'tcx>, + temp: &Local, context: PlaceContext<'tcx>, location: Location, ) { - self.super_place(place, context, location); - - // We found a use of some temporary TEMP... - if let Place::Local(temp) = place { - // ... check whether we (earlier) saw a 2-phase borrow like - // - // TMP = &mut place - if let Some(&borrow_index) = self.pending_activations.get(temp) { - let borrow_data = &mut self.idx_vec[borrow_index]; - - // Watch out: the use of TMP in the borrow itself - // doesn't count as an activation. =) - if borrow_data.reserve_location == location && - context == PlaceContext::MutatingUse(MutatingUseContext::Store) - { - return; - } + if !context.is_use() { + return; + } - if let TwoPhaseActivation::ActivatedAt(other_location) = - borrow_data.activation_location { - span_bug!( - self.mir.source_info(location).span, - "found two uses for 2-phase borrow temporary {:?}: \ - {:?} and {:?}", - temp, - location, - other_location, - ); - } + // We found a use of some temporary TMP + // check whether we (earlier) saw a 2-phase borrow like + // + // TMP = &mut place + if let Some(&borrow_index) = self.pending_activations.get(temp) { + let borrow_data = &mut self.idx_vec[borrow_index]; - // Otherwise, this is the unique later use - // that we expect. - borrow_data.activation_location = match context { - // The use of TMP in a shared borrow does not - // count as an actual activation. - PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow(..)) | - PlaceContext::NonMutatingUse(NonMutatingUseContext::ShallowBorrow(..)) => - TwoPhaseActivation::NotActivated, - _ => { - // Double check: This borrow is indeed a two-phase borrow (that is, - // we are 'transitioning' from `NotActivated` to `ActivatedAt`) and - // we've not found any other activations (checked above). - assert_eq!( - borrow_data.activation_location, - TwoPhaseActivation::NotActivated, - "never found an activation for this borrow!", - ); - - self.activation_map - .entry(location) - .or_default() - .push(borrow_index); - TwoPhaseActivation::ActivatedAt(location) - } - }; + // Watch out: the use of TMP in the borrow itself + // doesn't count as an activation. =) + if borrow_data.reserve_location == location && + context == PlaceContext::MutatingUse(MutatingUseContext::Store) + { + return; } + + if let TwoPhaseActivation::ActivatedAt(other_location) = + borrow_data.activation_location { + span_bug!( + self.mir.source_info(location).span, + "found two uses for 2-phase borrow temporary {:?}: \ + {:?} and {:?}", + temp, + location, + other_location, + ); + } + + // Otherwise, this is the unique later use + // that we expect. + borrow_data.activation_location = match context { + // The use of TMP in a shared borrow does not + // count as an actual activation. + PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow(..)) | + PlaceContext::NonMutatingUse(NonMutatingUseContext::ShallowBorrow(..)) => + TwoPhaseActivation::NotActivated, + _ => { + // Double check: This borrow is indeed a two-phase borrow (that is, + // we are 'transitioning' from `NotActivated` to `ActivatedAt`) and + // we've not found any other activations (checked above). + assert_eq!( + borrow_data.activation_location, + TwoPhaseActivation::NotActivated, + "never found an activation for this borrow!", + ); + + self.activation_map + .entry(location) + .or_default() + .push(borrow_index); + TwoPhaseActivation::ActivatedAt(location) + } + }; } } @@ -314,7 +293,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> { let borrow_data = &self.idx_vec[borrow_index]; assert_eq!(borrow_data.reserve_location, location); assert_eq!(borrow_data.kind, kind); - assert_eq!(borrow_data.region, region); + assert_eq!(borrow_data.region, region.to_region_vid()); assert_eq!(borrow_data.borrowed_place, *place); } @@ -347,13 +326,12 @@ impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> { &mut self, start_location: Location, assigned_place: &mir::Place<'tcx>, - region: Region<'tcx>, kind: mir::BorrowKind, borrow_index: BorrowIndex, ) { debug!( - "Borrows::insert_as_pending_if_two_phase({:?}, {:?}, {:?}, {:?})", - start_location, assigned_place, region, borrow_index, + "Borrows::insert_as_pending_if_two_phase({:?}, {:?}, {:?})", + start_location, assigned_place, borrow_index, ); if !self.allow_two_phase_borrow(kind) { diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index 3c4d8e09fc1..b0700317567 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::nll::explain_borrow::BorrowExplanation; use borrow_check::nll::region_infer::{RegionName, RegionNameSource}; use borrow_check::prefixes::IsPrefixOf; @@ -22,7 +12,7 @@ use rustc::mir::{ TerminatorKind, VarBindingForm, }; use rustc::ty::{self, DefIdTree}; -use rustc::util::ppaux::with_highlight_region_for_bound_region; +use rustc::util::ppaux::RegionHighlightMode; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::sync::Lrc; @@ -133,7 +123,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { Origin::Mir, ); - self.add_closure_invoked_twice_with_moved_variable_suggestion( + self.add_moved_or_invoked_closure_note( context.loc, used_place, &mut err, @@ -191,38 +181,55 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { ); } - if let Some(ty) = self.retrieve_type_for_place(used_place) { - let needs_note = match ty.sty { - ty::Closure(id, _) => { - let tables = self.infcx.tcx.typeck_tables_of(id); - let node_id = self.infcx.tcx.hir.as_local_node_id(id).unwrap(); - let hir_id = self.infcx.tcx.hir.node_to_hir_id(node_id); - - tables.closure_kind_origins().get(hir_id).is_none() - } - _ => true, - }; + let ty = used_place.ty(self.mir, self.infcx.tcx).to_ty(self.infcx.tcx); + let needs_note = match ty.sty { + ty::Closure(id, _) => { + let tables = self.infcx.tcx.typeck_tables_of(id); + let node_id = self.infcx.tcx.hir().as_local_node_id(id).unwrap(); + let hir_id = self.infcx.tcx.hir().node_to_hir_id(node_id); - if needs_note { - let mpi = self.move_data.moves[move_out_indices[0]].path; - let place = &self.move_data.move_paths[mpi].place; + tables.closure_kind_origins().get(hir_id).is_none() + } + _ => true, + }; - if let Some(ty) = self.retrieve_type_for_place(place) { - let note_msg = match self.describe_place_with_options( - place, - IncludingDowncast(true), - ) { - Some(name) => format!("`{}`", name), - None => "value".to_owned(), - }; + if needs_note { + let mpi = self.move_data.moves[move_out_indices[0]].path; + let place = &self.move_data.move_paths[mpi].place; - err.note(&format!( - "move occurs because {} has type `{}`, \ - which does not implement the `Copy` trait", - note_msg, ty - )); + let ty = place.ty(self.mir, self.infcx.tcx).to_ty(self.infcx.tcx); + let opt_name = self.describe_place_with_options(place, IncludingDowncast(true)); + let note_msg = match opt_name { + Some(ref name) => format!("`{}`", name), + None => "value".to_owned(), + }; + if let ty::TyKind::Param(param_ty) = ty.sty { + let tcx = self.infcx.tcx; + let generics = tcx.generics_of(self.mir_def_id); + let def_id = generics.type_param(¶m_ty, tcx).def_id; + if let Some(sp) = tcx.hir().span_if_local(def_id) { + err.span_label( + sp, + "consider adding a `Copy` constraint to this type argument", + ); } } + if let Place::Local(local) = place { + let decl = &self.mir.local_decls[*local]; + err.span_label( + decl.source_info.span, + format!( + "move occurs because {} has type `{}`, \ + which does not implement the `Copy` trait", + note_msg, ty, + )); + } else { + err.note(&format!( + "move occurs because {} has type `{}`, \ + which does not implement the `Copy` trait", + note_msg, ty + )); + } } if let Some((_, mut old_err)) = self.move_error_reported @@ -339,12 +346,19 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { "closure" }; - let desc_place = self.describe_place(place).unwrap_or_else(|| "_".to_owned()); - let tcx = self.infcx.tcx; + let (desc_place, msg_place, msg_borrow, union_type_name) = + self.describe_place_for_conflicting_borrow(place, &issued_borrow.borrowed_place); - let first_borrow_desc; + let explanation = self.explain_why_borrow_contains_point(context, issued_borrow, None); + let second_borrow_desc = if explanation.is_explained() { + "second " + } else { + "" + }; // FIXME: supply non-"" `opt_via` when appropriate + let tcx = self.infcx.tcx; + let first_borrow_desc; let mut err = match ( gen_borrow_kind, "immutable", @@ -358,12 +372,12 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { tcx.cannot_reborrow_already_borrowed( span, &desc_place, - "", + &msg_place, lft, issued_span, "it", rgt, - "", + &msg_borrow, None, Origin::Mir, ) @@ -373,12 +387,12 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { tcx.cannot_reborrow_already_borrowed( span, &desc_place, - "", + &msg_place, lft, issued_span, "it", rgt, - "", + &msg_borrow, None, Origin::Mir, ) @@ -389,9 +403,9 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { tcx.cannot_mutably_borrow_multiply( span, &desc_place, - "", + &msg_place, issued_span, - "", + &msg_borrow, None, Origin::Mir, ) @@ -454,6 +468,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { issued_span, "", None, + second_borrow_desc, Origin::Mir, ) } @@ -469,6 +484,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { issued_span, "", None, + second_borrow_desc, Origin::Mir, ) } @@ -513,12 +529,118 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { ); } - self.explain_why_borrow_contains_point(context, issued_borrow, None) + if union_type_name != "" { + err.note(&format!( + "`{}` is a field of the union `{}`, so it overlaps the field `{}`", + msg_place, union_type_name, msg_borrow, + )); + } + + explanation .add_explanation_to_diagnostic(self.infcx.tcx, self.mir, &mut err, first_borrow_desc); err.buffer(&mut self.errors_buffer); } + /// Returns the description of the root place for a conflicting borrow and the full + /// descriptions of the places that caused the conflict. + /// + /// In the simplest case, where there are no unions involved, if a mutable borrow of `x` is + /// attempted while a shared borrow is live, then this function will return: + /// + /// ("x", "", "") + /// + /// In the simple union case, if a mutable borrow of a union field `x.z` is attempted while + /// a shared borrow of another field `x.y`, then this function will return: + /// + /// ("x", "x.z", "x.y") + /// + /// In the more complex union case, where the union is a field of a struct, then if a mutable + /// borrow of a union field in a struct `x.u.z` is attempted while a shared borrow of + /// another field `x.u.y`, then this function will return: + /// + /// ("x.u", "x.u.z", "x.u.y") + /// + /// This is used when creating error messages like below: + /// + /// > cannot borrow `a.u` (via `a.u.z.c`) as immutable because it is also borrowed as + /// > mutable (via `a.u.s.b`) [E0502] + pub(super) fn describe_place_for_conflicting_borrow( + &self, + first_borrowed_place: &Place<'tcx>, + second_borrowed_place: &Place<'tcx>, + ) -> (String, String, String, String) { + // Define a small closure that we can use to check if the type of a place + // is a union. + let is_union = |place: &Place<'tcx>| -> bool { + place.ty(self.mir, self.infcx.tcx) + .to_ty(self.infcx.tcx) + .ty_adt_def() + .map(|adt| adt.is_union()) + .unwrap_or(false) + }; + + // Start with an empty tuple, so we can use the functions on `Option` to reduce some + // code duplication (particularly around returning an empty description in the failure + // case). + Some(()) + .filter(|_| { + // If we have a conflicting borrow of the same place, then we don't want to add + // an extraneous "via x.y" to our diagnostics, so filter out this case. + first_borrowed_place != second_borrowed_place + }) + .and_then(|_| { + // We're going to want to traverse the first borrowed place to see if we can find + // field access to a union. If we find that, then we will keep the place of the + // union being accessed and the field that was being accessed so we can check the + // second borrowed place for the same union and a access to a different field. + let mut current = first_borrowed_place; + while let Place::Projection(box PlaceProjection { base, elem }) = current { + match elem { + ProjectionElem::Field(field, _) if is_union(base) => { + return Some((base, field)); + }, + _ => current = base, + } + } + None + }) + .and_then(|(target_base, target_field)| { + // With the place of a union and a field access into it, we traverse the second + // borrowed place and look for a access to a different field of the same union. + let mut current = second_borrowed_place; + while let Place::Projection(box PlaceProjection { base, elem }) = current { + match elem { + ProjectionElem::Field(field, _) if { + is_union(base) && field != target_field && base == target_base + } => { + let desc_base = self.describe_place(base) + .unwrap_or_else(|| "_".to_owned()); + let desc_first = self.describe_place(first_borrowed_place) + .unwrap_or_else(|| "_".to_owned()); + let desc_second = self.describe_place(second_borrowed_place) + .unwrap_or_else(|| "_".to_owned()); + + // Also compute the name of the union type, eg. `Foo` so we + // can add a helpful note with it. + let ty = base.ty(self.mir, self.infcx.tcx).to_ty(self.infcx.tcx); + + return Some((desc_base, desc_first, desc_second, ty.to_string())); + }, + _ => current = base, + } + } + None + }) + .unwrap_or_else(|| { + // If we didn't find a field access into a union, or both places match, then + // only return the description of the first place. + let desc_place = self.describe_place(first_borrowed_place) + .unwrap_or_else(|| "_".to_owned()); + (desc_place, "".to_string(), "".to_string(), "".to_string()) + }) + } + /// Reports StorageDeadOrDrop of `place` conflicts with `borrow`. /// /// This means that some data referenced by `borrow` needs to live @@ -711,13 +833,13 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { format!("`{}` would have to be valid for `{}`...", name, region_name), ); - if let Some(fn_node_id) = self.infcx.tcx.hir.as_local_node_id(self.mir_def_id) { + if let Some(fn_node_id) = self.infcx.tcx.hir().as_local_node_id(self.mir_def_id) { err.span_label( drop_span, format!( "...but `{}` will be dropped here, when the function `{}` returns", name, - self.infcx.tcx.hir.name(fn_node_id), + self.infcx.tcx.hir().name(fn_node_id), ), ); @@ -726,7 +848,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { functions can only return borrows to data passed as arguments", ); err.note( - "to learn more, visit ", ); } else { @@ -1017,7 +1139,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { Err(_) => "move || ".to_string() }; - err.span_suggestion_with_applicability( + err.span_suggestion( args_span, &format!("to force the closure to take ownership of {} (and any \ other referenced variables), use the `move` keyword", @@ -1055,7 +1177,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let escapes_from = if tcx.is_closure(self.mir_def_id) { let tables = tcx.typeck_tables_of(self.mir_def_id); - let mir_hir_id = tcx.hir.def_index_to_hir_id(self.mir_def_id.index); + let mir_hir_id = tcx.hir().def_index_to_hir_id(self.mir_def_id.index); match tables.node_id_to_type(mir_hir_id).sty { ty::Closure(..) => "closure", ty::Generator(..) => "generator", @@ -1240,7 +1362,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { /// (part of) a non-`mut` local that occurs potentially after that /// local has already been initialized. `place` is the path being /// assigned; `err_place` is a place providing a reason why - /// `place` is not mutable (e.g. the non-`mut` local `x` in an + /// `place` is not mutable (e.g., the non-`mut` local `x` in an /// assignment to `x.f`). pub(super) fn report_illegal_reassignment( &mut self, @@ -1306,7 +1428,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { if let Some(decl) = local_decl { if let Some(name) = decl.name { if decl.can_be_made_mutable() { - err.span_suggestion_with_applicability( + err.span_suggestion( decl.source_info.span, "make this binding mutable", format!("mut {}", name), @@ -1332,7 +1454,8 @@ enum StorageDeadOrDrop<'tcx> { impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { - /// Adds a suggestion when a closure is invoked twice with a moved variable. + /// Adds a suggestion when a closure is invoked twice with a moved variable or when a closure + /// is moved after being invoked. /// /// ```text /// note: closure cannot be invoked more than once because it moves the variable `dict` out of @@ -1342,30 +1465,18 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { /// LL | for (key, value) in dict { /// | ^^^^ /// ``` - pub(super) fn add_closure_invoked_twice_with_moved_variable_suggestion( + pub(super) fn add_moved_or_invoked_closure_note( &self, location: Location, place: &Place<'tcx>, diag: &mut DiagnosticBuilder<'_>, ) { + debug!("add_moved_or_invoked_closure_note: location={:?} place={:?}", location, place); let mut target = place.local(); - debug!( - "add_closure_invoked_twice_with_moved_variable_suggestion: location={:?} place={:?} \ - target={:?}", - location, place, target, - ); for stmt in &self.mir[location.block].statements[location.statement_index..] { - debug!( - "add_closure_invoked_twice_with_moved_variable_suggestion: stmt={:?} \ - target={:?}", - stmt, target, - ); + debug!("add_moved_or_invoked_closure_note: stmt={:?} target={:?}", stmt, target); if let StatementKind::Assign(into, box Rvalue::Use(from)) = &stmt.kind { - debug!( - "add_closure_invoked_twice_with_moved_variable_suggestion: into={:?} \ - from={:?}", - into, from, - ); + debug!("add_fnonce_closure_note: into={:?} from={:?}", into, from); match from { Operand::Copy(ref place) | Operand::Move(ref place) if target == place.local() => @@ -1375,21 +1486,21 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { } } - + // Check if we are attempting to call a closure after it has been invoked. let terminator = self.mir[location.block].terminator(); - debug!( - "add_closure_invoked_twice_with_moved_variable_suggestion: terminator={:?}", - terminator, - ); + debug!("add_moved_or_invoked_closure_note: terminator={:?}", terminator); if let TerminatorKind::Call { func: Operand::Constant(box Constant { - literal: ty::Const { ty: &ty::TyS { sty: ty::TyKind::FnDef(id, _), .. }, .. }, + literal: ty::LazyConst::Evaluated(ty::Const { + ty: &ty::TyS { sty: ty::TyKind::FnDef(id, _), .. }, + .. + }), .. }), args, .. } = &terminator.kind { - debug!("add_closure_invoked_twice_with_moved_variable_suggestion: id={:?}", id); + debug!("add_moved_or_invoked_closure_note: id={:?}", id); if self.infcx.tcx.parent(id) == self.infcx.tcx.lang_items().fn_once_trait() { let closure = match args.first() { Some(Operand::Copy(ref place)) | @@ -1397,33 +1508,51 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { place.local().unwrap(), _ => return, }; - debug!( - "add_closure_invoked_twice_with_moved_variable_suggestion: closure={:?}", - closure, - ); - if let ty::TyKind::Closure(did, _substs) = self.mir.local_decls[closure].ty.sty { - let node_id = match self.infcx.tcx.hir.as_local_node_id(did) { - Some(node_id) => node_id, - _ => return, - }; - let hir_id = self.infcx.tcx.hir.node_to_hir_id(node_id); + debug!("add_moved_or_invoked_closure_note: closure={:?}", closure); + if let ty::TyKind::Closure(did, _) = self.mir.local_decls[closure].ty.sty { + let node_id = self.infcx.tcx.hir().as_local_node_id(did).unwrap(); + let hir_id = self.infcx.tcx.hir().node_to_hir_id(node_id); - if let Some(( - span, name - )) = self.infcx.tcx.typeck_tables_of(did).closure_kind_origins().get(hir_id) { + if let Some((span, name)) = self.infcx.tcx.typeck_tables_of(did) + .closure_kind_origins() + .get(hir_id) + { diag.span_note( *span, &format!( - "closure cannot be invoked more than once because it \ - moves the variable `{}` out of its environment", - name, + "closure cannot be invoked more than once because it moves the \ + variable `{}` out of its environment", + name, ), ); + return; } } } } + + // Check if we are just moving a closure after it has been invoked. + if let Some(target) = target { + if let ty::TyKind::Closure(did, _) = self.mir.local_decls[target].ty.sty { + let node_id = self.infcx.tcx.hir().as_local_node_id(did).unwrap(); + let hir_id = self.infcx.tcx.hir().node_to_hir_id(node_id); + + if let Some((span, name)) = self.infcx.tcx.typeck_tables_of(did) + .closure_kind_origins() + .get(hir_id) + { + diag.span_note( + *span, + &format!( + "closure cannot be moved more than once as it is not `Copy` due to \ + moving the variable `{}` out of its environment", + name + ), + ); + } + } + } } /// End-user visible description of `place` if one can be found. If the @@ -1559,7 +1688,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { )?; buf.push_str("["); if self.append_local_to_string(index, buf).is_err() { - buf.push_str(".."); + buf.push_str("_"); } buf.push_str("]"); } @@ -1645,12 +1774,12 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // the local code in the current crate, so this returns an `Option` in case // the closure comes from another crate. But in that case we wouldn't // be borrowck'ing it, so we can just unwrap: - let node_id = self.infcx.tcx.hir.as_local_node_id(def_id).unwrap(); + let node_id = self.infcx.tcx.hir().as_local_node_id(def_id).unwrap(); let freevar = self.infcx .tcx .with_freevars(node_id, |fv| fv[field.index()]); - self.infcx.tcx.hir.name(freevar.var_id()).to_string() + self.infcx.tcx.hir().name(freevar.var_id()).to_string() } _ => { // Might need a revision when the fields in trait RFC is implemented @@ -1664,22 +1793,6 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { } } - /// Retrieve type of a place for the current MIR representation - fn retrieve_type_for_place(&self, place: &Place<'tcx>) -> Option { - match place { - Place::Local(local) => { - let local = &self.mir.local_decls[*local]; - Some(local.ty) - } - Place::Promoted(ref prom) => Some(prom.1), - Place::Static(ref st) => Some(st.ty), - Place::Projection(ref proj) => match proj.elem { - ProjectionElem::Field(_, ty) => Some(ty), - _ => None, - }, - } - } - /// Check if a place is a thread-local static. pub fn is_place_thread_local(&self, place: &Place<'tcx>) -> bool { if let Place::Static(statik) = place { @@ -1971,8 +2084,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { ) -> Option { debug!("annotate_fn_sig: did={:?} sig={:?}", did, sig); let is_closure = self.infcx.tcx.is_closure(did); - let fn_node_id = self.infcx.tcx.hir.as_local_node_id(did)?; - let fn_decl = self.infcx.tcx.hir.fn_decl(fn_node_id)?; + let fn_node_id = self.infcx.tcx.hir().as_local_node_id(did)?; + let fn_decl = self.infcx.tcx.hir().fn_decl(fn_node_id)?; // We need to work out which arguments to highlight. We do this by looking // at the return type, where there are three cases: @@ -2151,7 +2264,7 @@ impl<'tcx> AnnotatedBorrowFnSignature<'tcx> { "argument and return type have the same lifetime due to lifetime elision rules", ); diag.note( - "to learn more, visit ", ); @@ -2193,10 +2306,10 @@ impl<'tcx> AnnotatedBorrowFnSignature<'tcx> { match ty.sty { ty::TyKind::Ref(ty::RegionKind::ReLateBound(_, br), _, _) | ty::TyKind::Ref( - ty::RegionKind::RePlaceholder(ty::Placeholder { name: br, .. }), + ty::RegionKind::RePlaceholder(ty::PlaceholderRegion { name: br, .. }), _, _, - ) => with_highlight_region_for_bound_region(*br, counter, || ty.to_string()), + ) => RegionHighlightMode::highlighting_bound_region(*br, counter, || ty.to_string()), _ => ty.to_string(), } } @@ -2207,8 +2320,12 @@ impl<'tcx> AnnotatedBorrowFnSignature<'tcx> { match ty.sty { ty::TyKind::Ref(region, _, _) => match region { ty::RegionKind::ReLateBound(_, br) - | ty::RegionKind::RePlaceholder(ty::Placeholder { name: br, .. }) => { - with_highlight_region_for_bound_region(*br, counter, || region.to_string()) + | ty::RegionKind::RePlaceholder(ty::PlaceholderRegion { name: br, .. }) => { + RegionHighlightMode::highlighting_bound_region( + *br, + counter, + || region.to_string(), + ) } _ => region.to_string(), }, @@ -2414,8 +2531,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { "closure_span: def_id={:?} target_place={:?} places={:?}", def_id, target_place, places ); - let node_id = self.infcx.tcx.hir.as_local_node_id(def_id)?; - let expr = &self.infcx.tcx.hir.expect_expr(node_id).node; + let node_id = self.infcx.tcx.hir().as_local_node_id(def_id)?; + let expr = &self.infcx.tcx.hir().expect_expr(node_id).node; debug!("closure_span: node_id={:?} expr={:?}", node_id, expr); if let hir::ExprKind::Closure( .., args_span, _ diff --git a/src/librustc_mir/borrow_check/flows.rs b/src/librustc_mir/borrow_check/flows.rs index 16bb1ef78dc..4eeb19c4e7a 100644 --- a/src/librustc_mir/borrow_check/flows.rs +++ b/src/librustc_mir/borrow_check/flows.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Manages the dataflow bits required for borrowck. //! //! FIXME: this might be better as a "generic" fixed-point combinator, @@ -33,9 +23,9 @@ use std::rc::Rc; // (forced to be `pub` due to its use as an associated type below.) crate struct Flows<'b, 'gcx: 'tcx, 'tcx: 'b> { - borrows: FlowAtLocation>, - pub uninits: FlowAtLocation>, - pub ever_inits: FlowAtLocation>, + borrows: FlowAtLocation<'tcx, Borrows<'b, 'gcx, 'tcx>>, + pub uninits: FlowAtLocation<'tcx, MaybeUninitializedPlaces<'b, 'gcx, 'tcx>>, + pub ever_inits: FlowAtLocation<'tcx, EverInitializedPlaces<'b, 'gcx, 'tcx>>, /// Polonius Output pub polonius_output: Option>>, @@ -43,9 +33,9 @@ crate struct Flows<'b, 'gcx: 'tcx, 'tcx: 'b> { impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> { crate fn new( - borrows: FlowAtLocation>, - uninits: FlowAtLocation>, - ever_inits: FlowAtLocation>, + borrows: FlowAtLocation<'tcx, Borrows<'b, 'gcx, 'tcx>>, + uninits: FlowAtLocation<'tcx, MaybeUninitializedPlaces<'b, 'gcx, 'tcx>>, + ever_inits: FlowAtLocation<'tcx, EverInitializedPlaces<'b, 'gcx, 'tcx>>, polonius_output: Option>>, ) -> Self { Flows { diff --git a/src/librustc_mir/borrow_check/location.rs b/src/librustc_mir/borrow_check/location.rs index b3e159dd844..20a477576c9 100644 --- a/src/librustc_mir/borrow_check/location.rs +++ b/src/librustc_mir/borrow_check/location.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::mir::{BasicBlock, Location, Mir}; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index f0d3b863f78..5597e4a6c59 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -1,20 +1,9 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This query borrow-checks the MIR to (further) ensure it is not broken. use borrow_check::nll::region_infer::RegionInferenceContext; use rustc::hir; use rustc::hir::Node; use rustc::hir::def_id::DefId; -use rustc::hir::map::definitions::DefPathData; use rustc::infer::InferCtxt; use rustc::lint::builtin::UNUSED_MUT; use rustc::middle::borrowck::SignalledError; @@ -64,7 +53,7 @@ mod move_errors; mod mutability_errors; mod path_utils; crate mod place_ext; -mod places_conflict; +crate mod places_conflict; mod prefixes; mod used_muts; @@ -138,7 +127,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( let attributes = tcx.get_attrs(def_id); let param_env = tcx.param_env(def_id); let id = tcx - .hir + .hir() .as_local_node_id(def_id) .expect("do_mir_borrowck: non-local DefId"); @@ -162,10 +151,6 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( move_data: move_data, param_env: param_env, }; - let body_id = match tcx.def_key(def_id).disambiguated_data.data { - DefPathData::StructCtor | DefPathData::EnumVariant(_) => None, - _ => Some(tcx.hir.body_owned_by(id)), - }; let dead_unwinds = BitSet::new_empty(mir.basic_blocks().len()); let mut flow_inits = FlowAtLocation::new(do_dataflow( @@ -178,10 +163,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( |bd, i| DebugFormatted::new(&bd.move_data().move_paths[i]), )); - let locals_are_invalidated_at_exit = match tcx.hir.body_owner_kind(id) { - hir::BodyOwnerKind::Const | hir::BodyOwnerKind::Static(_) => false, - hir::BodyOwnerKind::Fn => true, - }; + let locals_are_invalidated_at_exit = tcx.hir().body_owner_kind(id).is_fn_or_closure(); let borrow_set = Rc::new(BorrowSet::build( tcx, mir, locals_are_invalidated_at_exit, &mdpe.move_data)); @@ -212,7 +194,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( id, &attributes, &dead_unwinds, - Borrows::new(tcx, mir, regioncx.clone(), def_id, body_id, &borrow_set), + Borrows::new(tcx, mir, regioncx.clone(), &borrow_set), |rs, i| DebugFormatted::new(&rs.location(i)), )); let flow_uninits = FlowAtLocation::new(do_dataflow( @@ -234,7 +216,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( |bd, i| DebugFormatted::new(&bd.move_data().inits[i]), )); - let movable_generator = match tcx.hir.get(id) { + let movable_generator = match tcx.hir().get(id) { Node::Expr(&hir::Expr { node: hir::ExprKind::Closure(.., Some(hir::GeneratorMovability::Static)), .. @@ -325,7 +307,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( span, "variable does not need to be mutable", ) - .span_suggestion_short_with_applicability( + .span_suggestion_short( mut_span, "remove this `mut`", String::new(), @@ -378,10 +360,14 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( for err in &mut mbcx.errors_buffer { if err.is_error() { err.level = Level::Warning; - err.warn("This error has been downgraded to a warning \ - for backwards compatibility with previous releases.\n\ - It represents potential unsoundness in your code.\n\ - This warning will become a hard error in the future."); + err.warn( + "this error has been downgraded to a warning for backwards \ + compatibility with previous releases", + ); + err.warn( + "this represents potential undefined behavior in your code and \ + this warning will become a hard error in the future", + ); } } } @@ -550,7 +536,7 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx self.mutate_place( ContextKind::SetDiscrim.new(location), (place, span), - Shallow(Some(ArtificialField::Discriminant)), + Shallow(None), JustWrite, flow_state, ); @@ -592,14 +578,9 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx self.consume_operand(context, (input, span), flow_state); } } - StatementKind::EndRegion(ref _rgn) => { - // ignored when consuming results (update to - // flow_state already handled). - } StatementKind::Nop | StatementKind::AscribeUserType(..) | StatementKind::Retag { .. } - | StatementKind::EscapeToRaw { .. } | StatementKind::StorageLive(..) => { // `Nop`, `AscribeUserType`, `Retag`, and `StorageLive` are irrelevant // to borrow check. @@ -791,7 +772,6 @@ use self::AccessDepth::{Deep, Shallow}; #[derive(Copy, Clone, PartialEq, Eq, Debug)] enum ArtificialField { - Discriminant, ArrayLength, ShallowBorrow, } @@ -1200,14 +1180,14 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { Rvalue::Len(ref place) | Rvalue::Discriminant(ref place) => { let af = match *rvalue { - Rvalue::Len(..) => ArtificialField::ArrayLength, - Rvalue::Discriminant(..) => ArtificialField::Discriminant, + Rvalue::Len(..) => Some(ArtificialField::ArrayLength), + Rvalue::Discriminant(..) => None, _ => unreachable!(), }; self.access_place( context, (place, span), - (Shallow(Some(af)), Read(ReadKind::Copy)), + (Shallow(af), Read(ReadKind::Copy)), LocalMutationIsAllowed::No, flow_state, ); @@ -1379,7 +1359,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { place, borrow.kind, root_place, - sd + sd, + places_conflict::PlaceConflictBias::Overlap, ) { debug!("check_for_invalidation_at_exit({:?}): INVALID", place); // FIXME: should be talking about the region lifetime instead @@ -1535,7 +1516,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // ancestors; dataflow recurs on children when parents // move (to support partial (re)inits). // - // (I.e. querying parents breaks scenario 7; but may want + // (I.e., querying parents breaks scenario 7; but may want // to do such a query based on partial-init feature-gate.) } } @@ -1571,7 +1552,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // // (Distinct from handling of scenarios 1+2+4 above because // `place` does not interfere with suffixes of its prefixes, - // e.g. `a.b.c` does not interfere with `a.b.d`) + // e.g., `a.b.c` does not interfere with `a.b.d`) // // This code covers scenario 1. @@ -1744,7 +1725,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // // This does not use check_if_path_or_subpath_is_moved, // because we want to *allow* reinitializations of fields: - // e.g. want to allow + // e.g., want to allow // // `let mut s = ...; drop(s.x); s.x=Val;` // @@ -2175,7 +2156,7 @@ enum Overlap { /// `u.a.x` and `a.b.y` are. Arbitrary, /// The places have the same type, and are either completely disjoint - /// or equal - i.e. they can't "partially" overlap as can occur with + /// or equal - i.e., they can't "partially" overlap as can occur with /// unions. This is the "base case" on which we recur for extensions /// of the place. EqualOrDisjoint, diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/move_errors.rs index a556199b875..8539b5c26ce 100644 --- a/src/librustc_mir/borrow_check/move_errors.rs +++ b/src/librustc_mir/borrow_check/move_errors.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::unicode::property::Pattern_White_Space; use std::fmt::{self, Display}; @@ -40,7 +30,7 @@ use util::borrowck_errors::{BorrowckErrors, Origin}; #[derive(Debug)] enum GroupedMoveError<'tcx> { // Place expression can't be moved from, - // e.g. match x[0] { s => (), } where x: &[String] + // e.g., match x[0] { s => (), } where x: &[String] MovesFromPlace { original_path: Place<'tcx>, span: Span, @@ -49,7 +39,7 @@ enum GroupedMoveError<'tcx> { binds_to: Vec, }, // Part of a value expression can't be moved from, - // e.g. match &String::new() { &x => (), } + // e.g., match &String::new() { &x => (), } MovesFromValue { original_path: Place<'tcx>, span: Span, @@ -319,8 +309,8 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { let upvar_hir_id = upvar_decl.var_hir_id.assert_crate_local(); let upvar_node_id = - self.infcx.tcx.hir.hir_to_node_id(upvar_hir_id); - let upvar_span = self.infcx.tcx.hir.span(upvar_node_id); + self.infcx.tcx.hir().hir_to_node_id(upvar_hir_id); + let upvar_span = self.infcx.tcx.hir().span(upvar_node_id); diag.span_label(upvar_span, "captured outer variable"); break; } @@ -378,14 +368,14 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { // expressions `a[b]`, which roughly desugar to // `*Index::index(&a, b)` or // `*IndexMut::index_mut(&mut a, b)`. - err.span_suggestion_with_applicability( + err.span_suggestion( span, "consider removing the `*`", snippet[1..].to_owned(), Applicability::Unspecified, ); } else { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "consider borrowing here", format!("&{}", snippet), @@ -426,13 +416,13 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { .span_to_snippet(pat_span) .unwrap(); if pat_snippet.starts_with('&') { - let pat_snippet = pat_snippet[1..].trim_left(); + let pat_snippet = pat_snippet[1..].trim_start(); let suggestion; let to_remove; if pat_snippet.starts_with("mut") && pat_snippet["mut".len()..].starts_with(Pattern_White_Space) { - suggestion = pat_snippet["mut".len()..].trim_left(); + suggestion = pat_snippet["mut".len()..].trim_start(); to_remove = "&mut"; } else { suggestion = pat_snippet; @@ -449,7 +439,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { suggestions.sort_unstable_by_key(|&(span, _, _)| span); suggestions.dedup_by_key(|&mut (span, _, _)| span); for (span, to_remove, suggestion) in suggestions { - err.span_suggestion_with_applicability( + err.span_suggestion( span, &format!("consider removing the `{}`", to_remove), suggestion, diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index 7afe2c67adc..4755c6daf0a 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir; use rustc::hir::Node; use rustc::mir::{self, BindingForm, Constant, ClearCrossCrate, Local, Location, Mir}; @@ -241,7 +231,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { base.ty(self.mir, self.infcx.tcx).to_ty(self.infcx.tcx), field, ) { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "consider changing this to be mutable", message, @@ -263,7 +253,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { // Deliberately fall into this case for all implicit self types, // so that we don't fall in to the next case with them. *kind == mir::ImplicitSelfKind::MutRef - } else if Some(keywords::SelfValue.name()) == local_decl.name { + } else if Some(keywords::SelfLower.name()) == local_decl.name { // Otherwise, check if the name is the self kewyord - in which case // we have an explicit self. Do the same thing in this case and check // for a `self: &mut Self` to suggest removing the `&mut`. @@ -295,7 +285,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { assert_eq!(local_decl.mutability, Mutability::Not); err.span_label(span, format!("cannot {ACT}", ACT = act)); - err.span_suggestion_with_applicability( + err.span_suggestion( local_decl.source_info.span, "consider changing this to be mutable", format!("mut {}", local_decl.name.unwrap()), @@ -317,8 +307,8 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { let upvar_hir_id = self.mir.upvar_decls[upvar_index.index()] .var_hir_id .assert_crate_local(); - let upvar_node_id = self.infcx.tcx.hir.hir_to_node_id(upvar_hir_id); - if let Some(Node::Binding(pat)) = self.infcx.tcx.hir.find(upvar_node_id) { + let upvar_node_id = self.infcx.tcx.hir().hir_to_node_id(upvar_hir_id); + if let Some(Node::Binding(pat)) = self.infcx.tcx.hir().find(upvar_node_id) { if let hir::PatKind::Binding( hir::BindingAnnotation::Unannotated, _, @@ -326,7 +316,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { _, ) = pat.node { - err.span_suggestion_with_applicability( + err.span_suggestion( upvar_ident.span, "consider changing this to be mutable", format!("mut {}", upvar_ident.name), @@ -420,7 +410,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { }; if let Some((err_help_span, suggested_code)) = suggestion { - err.span_suggestion_with_applicability( + err.span_suggestion( err_help_span, &format!("consider changing this to be a mutable {}", pointer_desc), suggested_code, @@ -478,13 +468,13 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { Terminator { kind: TerminatorKind::Call { func: Operand::Constant(box Constant { - literal: Const { + literal: ty::LazyConst::Evaluated(Const { ty: &TyS { sty: TyKind::FnDef(id, substs), .. }, .. - }, + }), .. }), .. @@ -641,8 +631,8 @@ fn annotate_struct_field( if let ty::TyKind::Adt(def, _) = ty.sty { let field = def.all_fields().nth(field.index())?; // Use the HIR types to construct the diagnostic message. - let node_id = tcx.hir.as_local_node_id(field.did)?; - let node = tcx.hir.find(node_id)?; + let node_id = tcx.hir().as_local_node_id(field.did)?; + let node = tcx.hir().find(node_id)?; // Now we're dealing with the actual struct that we're going to suggest a change to, // we can expect a field that is an immutable reference to a type. if let hir::Node::Field(field) = node { diff --git a/src/librustc_mir/borrow_check/nll/constraint_generation.rs b/src/librustc_mir/borrow_check/nll/constraint_generation.rs index 1d8d028137a..588f46cb77f 100644 --- a/src/librustc_mir/borrow_check/nll/constraint_generation.rs +++ b/src/librustc_mir/borrow_check/nll/constraint_generation.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::borrow_set::BorrowSet; use borrow_check::location::LocationTable; use borrow_check::nll::ToRegionVid; @@ -17,7 +7,7 @@ use rustc::infer::InferCtxt; use rustc::mir::visit::TyContext; use rustc::mir::visit::Visitor; use rustc::mir::{BasicBlock, BasicBlockData, Location, Mir, Place, Rvalue}; -use rustc::mir::{Statement, Terminator}; +use rustc::mir::{SourceInfo, Statement, Terminator}; use rustc::mir::UserTypeProjection; use rustc::ty::fold::TypeFoldable; use rustc::ty::subst::Substs; @@ -76,11 +66,12 @@ impl<'cg, 'cx, 'gcx, 'tcx> Visitor<'tcx> for ConstraintGeneration<'cg, 'cx, 'gcx /// call. Make them live at the location where they appear. fn visit_ty(&mut self, ty: &ty::Ty<'tcx>, ty_context: TyContext) { match ty_context { - TyContext::ReturnTy(source_info) - | TyContext::YieldTy(source_info) - | TyContext::LocalDecl { source_info, .. } => { + TyContext::ReturnTy(SourceInfo { span, .. }) + | TyContext::YieldTy(SourceInfo { span, .. }) + | TyContext::UserTy(span) + | TyContext::LocalDecl { source_info: SourceInfo { span, .. }, .. } => { span_bug!( - source_info.span, + span, "should not be visiting outside of the CFG: {:?}", ty_context ); diff --git a/src/librustc_mir/borrow_check/nll/constraints/graph.rs b/src/librustc_mir/borrow_check/nll/constraints/graph.rs index 3d4b2456f96..fe9ccb489e4 100644 --- a/src/librustc_mir/borrow_check/nll/constraints/graph.rs +++ b/src/librustc_mir/borrow_check/nll/constraints/graph.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::nll::type_check::Locations; use borrow_check::nll::constraints::ConstraintIndex; use borrow_check::nll::constraints::{ConstraintSet, OutlivesConstraint}; diff --git a/src/librustc_mir/borrow_check/nll/constraints/mod.rs b/src/librustc_mir/borrow_check/nll/constraints/mod.rs index a873af8333a..146bd65dd11 100644 --- a/src/librustc_mir/borrow_check/nll/constraints/mod.rs +++ b/src/librustc_mir/borrow_check/nll/constraints/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::mir::ConstraintCategory; use rustc::ty::RegionVid; use rustc_data_structures::graph::scc::Sccs; @@ -40,7 +30,7 @@ impl ConstraintSet { /// Constructs a "normal" graph from the constraint set; the graph makes it /// easy to find the constraints affecting a particular region. /// - /// NB: This graph contains a "frozen" view of the current + /// N.B., this graph contains a "frozen" view of the current /// constraints. any new constraints added to the `ConstraintSet` /// after the graph is built will not be present in the graph. crate fn graph(&self, num_region_vars: usize) -> graph::NormalConstraintGraph { diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs index 1e6ba638e1c..53035dae4f3 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::VecDeque; use std::rc::Rc; diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs index 2bf531d1d3e..968c0f53a48 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::borrow_set::BorrowData; use borrow_check::error_reporting::UseSpans; use borrow_check::nll::ConstraintDescription; @@ -52,6 +42,12 @@ pub(in borrow_check) enum LaterUseKind { } impl BorrowExplanation { + pub(in borrow_check) fn is_explained(&self) -> bool { + match self { + BorrowExplanation::Unexplained => false, + _ => true, + } + } pub(in borrow_check) fn add_explanation_to_diagnostic<'cx, 'gcx, 'tcx>( &self, tcx: TyCtxt<'cx, 'gcx, 'tcx>, @@ -206,7 +202,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let mir = self.mir; let tcx = self.infcx.tcx; - let borrow_region_vid = regioncx.to_region_vid(borrow.region); + let borrow_region_vid = borrow.region; debug!( "explain_why_borrow_contains_point: borrow_region_vid={:?}", borrow_region_vid @@ -271,13 +267,17 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { borrow_region_vid, region, ); - let opt_place_desc = self.describe_place(&borrow.borrowed_place); - BorrowExplanation::MustBeValidFor { - category, - from_closure, - span, - region_name, - opt_place_desc, + if let Some(region_name) = region_name { + let opt_place_desc = self.describe_place(&borrow.borrowed_place); + BorrowExplanation::MustBeValidFor { + category, + from_closure, + span, + region_name, + opt_place_desc, + } + } else { + BorrowExplanation::Unexplained } } else { BorrowExplanation::Unexplained diff --git a/src/librustc_mir/borrow_check/nll/facts.rs b/src/librustc_mir/borrow_check/nll/facts.rs index 465707ecc17..bc33a1c9c65 100644 --- a/src/librustc_mir/borrow_check/nll/facts.rs +++ b/src/librustc_mir/borrow_check/nll/facts.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::location::{LocationIndex, LocationTable}; use dataflow::indexes::BorrowIndex; use polonius_engine::AllFacts as PoloniusAllFacts; diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index 576509c0fdd..112b3995255 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::borrow_set::BorrowSet; use borrow_check::location::LocationTable; use borrow_check::{JustWrite, WriteAndRead}; @@ -66,10 +56,14 @@ struct InvalidationGenerator<'cx, 'tcx: 'cx, 'gcx: 'tcx> { /// Visits the whole MIR and generates invalidates() facts /// Most of the code implementing this was stolen from borrow_check/mod.rs impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> { - fn visit_statement(&mut self, - block: BasicBlock, - statement: &Statement<'tcx>, - location: Location) { + fn visit_statement( + &mut self, + block: BasicBlock, + statement: &Statement<'tcx>, + location: Location, + ) { + self.check_activations(location); + match statement.kind { StatementKind::Assign(ref lhs, ref rhs) => { self.consume_rvalue( @@ -99,7 +93,7 @@ impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> { self.mutate_place( ContextKind::SetDiscrim.new(location), place, - Shallow(Some(ArtificialField::Discriminant)), + Shallow(None), JustWrite, ); } @@ -132,12 +126,9 @@ impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> { self.consume_operand(context, input); } } - // EndRegion matters to older NLL/MIR AST borrowck, not to alias NLL - StatementKind::EndRegion(..) | StatementKind::Nop | StatementKind::AscribeUserType(..) | StatementKind::Retag { .. } | - StatementKind::EscapeToRaw { .. } | StatementKind::StorageLive(..) => { // `Nop`, `AscribeUserType`, `Retag`, and `StorageLive` are irrelevant // to borrow check. @@ -161,6 +152,8 @@ impl<'cx, 'tcx, 'gcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx, 'gcx> { terminator: &Terminator<'tcx>, location: Location ) { + self.check_activations(location); + match terminator.kind { TerminatorKind::SwitchInt { ref discr, @@ -362,14 +355,14 @@ impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> { Rvalue::Len(ref place) | Rvalue::Discriminant(ref place) => { let af = match *rvalue { - Rvalue::Len(..) => ArtificialField::ArrayLength, - Rvalue::Discriminant(..) => ArtificialField::Discriminant, + Rvalue::Len(..) => Some(ArtificialField::ArrayLength), + Rvalue::Discriminant(..) => None, _ => unreachable!(), }; self.access_place( context, place, - (Shallow(Some(af)), Read(ReadKind::Copy)), + (Shallow(af), Read(ReadKind::Copy)), LocalMutationIsAllowed::No, ); } @@ -484,5 +477,41 @@ impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cx, 'tcx, 'gcx> { let lidx = self.location_table.start_index(l); self.all_facts.invalidates.push((lidx, b)); } + + fn check_activations( + &mut self, + location: Location, + ) { + if !self.tcx.two_phase_borrows() { + return; + } + + // Two-phase borrow support: For each activation that is newly + // generated at this statement, check if it interferes with + // another borrow. + for &borrow_index in self.borrow_set.activations_at_location(location) { + let borrow = &self.borrow_set[borrow_index]; + + // only mutable borrows should be 2-phase + assert!(match borrow.kind { + BorrowKind::Shared | BorrowKind::Shallow => false, + BorrowKind::Unique | BorrowKind::Mut { .. } => true, + }); + + self.access_place( + ContextKind::Activation.new(location), + &borrow.borrowed_place, + ( + Deep, + Activation(WriteKind::MutableBorrow(borrow.kind), borrow_index), + ), + LocalMutationIsAllowed::No, + ); + + // We do not need to call `check_if_path_or_subpath_is_moved` + // again, as we already called it when we made the + // initial reservation. + } + } } diff --git a/src/librustc_mir/borrow_check/nll/mod.rs b/src/librustc_mir/borrow_check/nll/mod.rs index 0c4140caee8..a092c3b8ecd 100644 --- a/src/librustc_mir/borrow_check/nll/mod.rs +++ b/src/librustc_mir/borrow_check/nll/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::borrow_set::BorrowSet; use borrow_check::location::{LocationIndex, LocationTable}; use borrow_check::nll::facts::AllFactsExt; @@ -85,7 +75,7 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>( mir: &Mir<'tcx>, location_table: &LocationTable, param_env: ty::ParamEnv<'gcx>, - flow_inits: &mut FlowAtLocation>, + flow_inits: &mut FlowAtLocation<'tcx, MaybeInitializedPlaces<'cx, 'gcx, 'tcx>>, move_data: &MoveData<'tcx>, borrow_set: &BorrowSet<'tcx>, errors_buffer: &mut Vec, @@ -176,7 +166,7 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>( // Dump facts if requested. let polonius_output = all_facts.and_then(|all_facts| { if infcx.tcx.sess.opts.debugging_opts.nll_facts { - let def_path = infcx.tcx.hir.def_path(def_id); + let def_path = infcx.tcx.hir().def_path(def_id); let dir_path = PathBuf::from("nll-facts").join(def_path.to_filename_friendly_no_crate()); all_facts.write_to_dir(dir_path, location_table).unwrap(); @@ -240,13 +230,14 @@ fn dump_mir_results<'a, 'gcx, 'tcx>( // Before the CFG, dump out the values for each region variable. PassWhere::BeforeCFG => { regioncx.dump_mir(out)?; + writeln!(out, "|")?; if let Some(closure_region_requirements) = closure_region_requirements { - writeln!(out, "|")?; writeln!(out, "| Free Region Constraints")?; for_each_region_constraint(closure_region_requirements, &mut |msg| { writeln!(out, "| {}", msg) })?; + writeln!(out, "|")?; } } diff --git a/src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs b/src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs index 268a37c7086..df6d187e442 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! As part of generating the regions, if you enable `-Zdump-mir=nll`, //! we will generate an annotated copy of the MIR that includes the //! state of region inference. This code handles emitting the region diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs index 3358e5851f9..ec68ddaf3c8 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::nll::constraints::OutlivesConstraint; use borrow_check::nll::region_infer::RegionInferenceContext; use borrow_check::nll::type_check::Locations; @@ -38,6 +28,7 @@ impl ConstraintDescription for ConstraintCategory { match self { ConstraintCategory::Assignment => "assignment ", ConstraintCategory::Return => "returning this value ", + ConstraintCategory::Yield => "yielding this value ", ConstraintCategory::UseAsConst => "using this value as a constant ", ConstraintCategory::UseAsStatic => "using this value as a static ", ConstraintCategory::Cast => "cast ", @@ -133,11 +124,10 @@ impl<'tcx> RegionInferenceContext<'tcx> { let constraint_sup_scc = self.constraint_sccs.scc(constraint.sup); match categorized_path[i].0 { - ConstraintCategory::OpaqueType - | ConstraintCategory::Boring - | ConstraintCategory::BoringNoLocation - | ConstraintCategory::Internal => false, - ConstraintCategory::TypeAnnotation | ConstraintCategory::Return => true, + ConstraintCategory::OpaqueType | ConstraintCategory::Boring | + ConstraintCategory::BoringNoLocation | ConstraintCategory::Internal => false, + ConstraintCategory::TypeAnnotation | ConstraintCategory::Return | + ConstraintCategory::Yield => true, _ => constraint_sup_scc != target_scc, } }); @@ -253,7 +243,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { // Check if we can use one of the "nice region errors". if let (Some(f), Some(o)) = (self.to_error_region(fr), self.to_error_region(outlived_fr)) { let tables = infcx.tcx.typeck_tables_of(mir_def_id); - let nice = NiceRegionError::new_from_span(infcx.tcx, span, o, f, Some(tables)); + let nice = NiceRegionError::new_from_span(infcx, span, o, f, Some(tables)); if let Some(_error_reported) = nice.try_report_from_nll() { return; } @@ -376,9 +366,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { diag.span_label(span, message); - match self.give_region_a_name(infcx, mir, mir_def_id, outlived_fr, &mut 1) - .source - { + match self.give_region_a_name(infcx, mir, mir_def_id, outlived_fr, &mut 1).unwrap().source { RegionNameSource::NamedEarlyBoundRegion(fr_span) | RegionNameSource::NamedFreeRegion(fr_span) | RegionNameSource::SynthesizedFreeEnvRegion(fr_span, _) @@ -517,14 +505,14 @@ impl<'tcx> RegionInferenceContext<'tcx> { ) { let mut diag = infcx.tcx.sess.struct_span_err( span, - "unsatisfied lifetime constraints", // FIXME + "lifetime may not live long enough" ); let counter = &mut 1; - let fr_name = self.give_region_a_name(infcx, mir, mir_def_id, fr, counter); + let fr_name = self.give_region_a_name(infcx, mir, mir_def_id, fr, counter).unwrap(); fr_name.highlight_region_name(&mut diag); let outlived_fr_name = - self.give_region_a_name(infcx, mir, mir_def_id, outlived_fr, counter); + self.give_region_a_name(infcx, mir, mir_def_id, outlived_fr, counter).unwrap(); outlived_fr_name.highlight_region_name(&mut diag); let mir_def_name = if infcx.tcx.is_closure(mir_def_id) { @@ -638,7 +626,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { "'_".to_string() }; - diag.span_suggestion_with_applicability( + diag.span_suggestion( span, &format!( "to allow this impl Trait to capture borrowed data with lifetime \ @@ -661,7 +649,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { infcx: &InferCtxt<'_, '_, 'tcx>, borrow_region: RegionVid, outlived_region: RegionVid, - ) -> (ConstraintCategory, bool, Span, RegionName) { + ) -> (ConstraintCategory, bool, Span, Option) { let (category, from_closure, span) = self.best_blame_constraint(mir, borrow_region, |r| r == outlived_region); let outlived_fr_name = diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs index a32fb0503a8..bff80155112 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::{self, Display}; use borrow_check::nll::region_infer::RegionInferenceContext; use borrow_check::nll::universal_regions::DefiningTy; @@ -18,7 +8,7 @@ use rustc::infer::InferCtxt; use rustc::mir::Mir; use rustc::ty::subst::{Substs, UnpackedKind}; use rustc::ty::{self, RegionKind, RegionVid, Ty, TyCtxt}; -use rustc::util::ppaux::with_highlight_region_for_regionvid; +use rustc::util::ppaux::RegionHighlightMode; use rustc_errors::DiagnosticBuilder; use syntax::ast::{Name, DUMMY_NODE_ID}; use syntax::symbol::keywords; @@ -157,7 +147,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { mir_def_id: DefId, fr: RegionVid, counter: &mut usize, - ) -> RegionName { + ) -> Option { debug!("give_region_a_name(fr={:?}, counter={})", fr, counter); assert!(self.universal_regions.is_universal_region(fr)); @@ -177,8 +167,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { self.give_name_if_anonymous_region_appears_in_output( infcx, mir, mir_def_id, fr, counter, ) - }) - .unwrap_or_else(|| span_bug!(mir.span, "can't make a name for free region {:?}", fr)); + }); debug!("give_region_a_name: gave name {:?}", value); value @@ -226,12 +215,14 @@ impl<'tcx> RegionInferenceContext<'tcx> { }, ty::BoundRegion::BrEnv => { - let mir_node_id = tcx.hir.as_local_node_id(mir_def_id).expect("non-local mir"); + let mir_node_id = tcx.hir() + .as_local_node_id(mir_def_id) + .expect("non-local mir"); let def_ty = self.universal_regions.defining_ty; if let DefiningTy::Closure(def_id, substs) = def_ty { let args_span = if let hir::ExprKind::Closure(_, _, _, span, _) = - tcx.hir.expect_expr(mir_node_id).node + tcx.hir().expect_expr(mir_node_id).node { span } else { @@ -302,10 +293,10 @@ impl<'tcx> RegionInferenceContext<'tcx> { name: &InternedString, ) -> Span { let scope = error_region.free_region_binding_scope(tcx); - let node = tcx.hir.as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID); + let node = tcx.hir().as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID); - let span = tcx.sess.source_map().def_span(tcx.hir.span(node)); - if let Some(param) = tcx.hir + let span = tcx.sess.source_map().def_span(tcx.hir().span(node)); + if let Some(param) = tcx.hir() .get_generics(scope) .and_then(|generics| generics.get_named(name)) { @@ -361,8 +352,8 @@ impl<'tcx> RegionInferenceContext<'tcx> { argument_index: usize, counter: &mut usize, ) -> Option { - let mir_node_id = infcx.tcx.hir.as_local_node_id(mir_def_id)?; - let fn_decl = infcx.tcx.hir.fn_decl(mir_node_id)?; + let mir_node_id = infcx.tcx.hir().as_local_node_id(mir_def_id)?; + let fn_decl = infcx.tcx.hir().fn_decl(mir_node_id)?; let argument_hir_ty: &hir::Ty = &fn_decl.inputs[argument_index]; match argument_hir_ty.node { // This indicates a variable with no type annotation, like @@ -405,7 +396,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { argument_ty: Ty<'tcx>, counter: &mut usize, ) -> Option { - let type_name = with_highlight_region_for_regionvid(needle_fr, *counter, || { + let type_name = RegionHighlightMode::highlighting_region_vid(needle_fr, *counter, || { infcx.extract_type_name(&argument_ty) }); @@ -682,12 +673,13 @@ impl<'tcx> RegionInferenceContext<'tcx> { return None; } - let type_name = with_highlight_region_for_regionvid( - fr, *counter, || infcx.extract_type_name(&return_ty)); + let type_name = RegionHighlightMode::highlighting_region_vid( + fr, *counter, || infcx.extract_type_name(&return_ty), + ); - let mir_node_id = tcx.hir.as_local_node_id(mir_def_id).expect("non-local mir"); + let mir_node_id = tcx.hir().as_local_node_id(mir_def_id).expect("non-local mir"); - let (return_span, mir_description) = match tcx.hir.get(mir_node_id) { + let (return_span, mir_description) = match tcx.hir().get(mir_node_id) { hir::Node::Expr(hir::Expr { node: hir::ExprKind::Closure(_, _, _, span, gen_move), .. diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs index 73fa1b0cfb7..c2f2e99c0a5 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::nll::region_infer::RegionInferenceContext; use borrow_check::nll::ToRegionVid; use rustc::mir::{Local, Mir}; @@ -81,11 +71,11 @@ impl<'tcx> RegionInferenceContext<'tcx> { upvar_index: usize, ) -> (Symbol, Span) { let upvar_hir_id = mir.upvar_decls[upvar_index].var_hir_id.assert_crate_local(); - let upvar_node_id = tcx.hir.hir_to_node_id(upvar_hir_id); + let upvar_node_id = tcx.hir().hir_to_node_id(upvar_hir_id); debug!("get_upvar_name_and_span_for_region: upvar_node_id={:?}", upvar_node_id); - let upvar_name = tcx.hir.name(upvar_node_id); - let upvar_span = tcx.hir.span(upvar_node_id); + let upvar_name = tcx.hir().name(upvar_node_id); + let upvar_span = tcx.hir().span(upvar_node_id); debug!("get_upvar_name_and_span_for_region: upvar_name={:?} upvar_span={:?}", upvar_name, upvar_span); @@ -95,7 +85,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// Search the argument types for one that references fr (which should be a free region). /// Returns Some(_) with the index of the input if one is found. /// - /// NB: In the case of a closure, the index is indexing into the signature as seen by the + /// N.B., in the case of a closure, the index is indexing into the signature as seen by the /// user - in particular, index 0 is not the implicit self parameter. crate fn get_argument_index_for_region( &self, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs b/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs index e2e19a85bec..2da158be432 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/graphviz.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module provides linkage between RegionInferenceContext and //! libgraphviz traits, specialized to attaching borrowck analysis //! data to rendered labels. diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs index 376f4459242..fee5dc86465 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::universal_regions::UniversalRegions; use borrow_check::nll::constraints::graph::NormalConstraintGraph; use borrow_check::nll::constraints::{ConstraintSccIndex, ConstraintSet, OutlivesConstraint}; @@ -119,7 +109,7 @@ struct RegionDefinition<'tcx> { external_name: Option>, } -/// NB: The variants in `Cause` are intentionally ordered. Lower +/// N.B., the variants in `Cause` are intentionally ordered. Lower /// values are preferred when it comes to error messages. Do not /// reorder willy nilly. #[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq)] @@ -657,7 +647,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { .buffer(errors_buffer); } else { // FIXME. We should handle this case better. It - // indicates that we have e.g. some region variable + // indicates that we have e.g., some region variable // whose value is like `'a+'b` where `'a` and `'b` are // distinct unrelated univesal regions that are not // known to outlive one another. It'd be nice to have @@ -1208,7 +1198,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { blame_span: blame_span_category.1, category: blame_span_category.0, }); - return; + continue; } } @@ -1230,7 +1220,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { mir: &Mir<'tcx>, _mir_def_id: DefId, longer_fr: RegionVid, - placeholder: ty::Placeholder, + placeholder: ty::PlaceholderRegion, ) { debug!( "check_bound_universal_region(fr={:?}, placeholder={:?})", diff --git a/src/librustc_mir/borrow_check/nll/region_infer/values.rs b/src/librustc_mir/borrow_check/nll/region_infer/values.rs index 2b7ef38d3ed..88e8310db68 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/values.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/values.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::mir::{BasicBlock, Location, Mir}; use rustc::ty::{self, RegionVid}; use rustc_data_structures::bit_set::{HybridBitSet, SparseBitMatrix}; @@ -48,7 +38,7 @@ impl RegionValueElements { let mut basic_blocks = IndexVec::with_capacity(num_points); for (bb, bb_data) in mir.basic_blocks().iter_enumerated() { - basic_blocks.extend((0..bb_data.statements.len() + 1).map(|_| bb)); + basic_blocks.extend((0..=bb_data.statements.len()).map(|_| bb)); } Self { @@ -150,7 +140,7 @@ crate enum RegionElement { /// A placeholder (e.g., instantiated from a `for<'a> fn(&'a u32)` /// type). - PlaceholderRegion(ty::Placeholder), + PlaceholderRegion(ty::PlaceholderRegion), } /// When we initially compute liveness, we use a bit matrix storing @@ -219,17 +209,17 @@ impl LivenessValues { } } -/// Maps from `ty::Placeholder` values that are used in the rest of +/// Maps from `ty::PlaceholderRegion` values that are used in the rest of /// rustc to the internal `PlaceholderIndex` values that are used in /// NLL. #[derive(Default)] crate struct PlaceholderIndices { - to_index: FxHashMap, - from_index: IndexVec, + to_index: FxHashMap, + from_index: IndexVec, } impl PlaceholderIndices { - crate fn insert(&mut self, placeholder: ty::Placeholder) -> PlaceholderIndex { + crate fn insert(&mut self, placeholder: ty::PlaceholderRegion) -> PlaceholderIndex { let PlaceholderIndices { to_index, from_index, @@ -239,11 +229,11 @@ impl PlaceholderIndices { .or_insert_with(|| from_index.push(placeholder)) } - crate fn lookup_index(&self, placeholder: ty::Placeholder) -> PlaceholderIndex { + crate fn lookup_index(&self, placeholder: ty::PlaceholderRegion) -> PlaceholderIndex { self.to_index[&placeholder] } - crate fn lookup_placeholder(&self, placeholder: PlaceholderIndex) -> ty::Placeholder { + crate fn lookup_placeholder(&self, placeholder: PlaceholderIndex) -> ty::PlaceholderRegion { self.from_index[placeholder] } @@ -313,7 +303,7 @@ impl RegionValues { self.points.insert_all_into_row(r); } - /// Add all elements in `r_from` to `r_to` (because e.g. `r_to: + /// Add all elements in `r_from` to `r_to` (because e.g., `r_to: /// r_from`). crate fn add_region(&mut self, r_to: N, r_from: N) -> bool { self.points.union_rows(r_from, r_to) @@ -375,7 +365,7 @@ impl RegionValues { crate fn placeholders_contained_in<'a>( &'a self, r: N, - ) -> impl Iterator + 'a { + ) -> impl Iterator + 'a { self.placeholders .row(r) .into_iter() @@ -432,7 +422,7 @@ impl ToElementIndex for RegionVid { } } -impl ToElementIndex for ty::Placeholder { +impl ToElementIndex for ty::PlaceholderRegion { fn add_to_row(self, values: &mut RegionValues, row: N) -> bool { let index = values.placeholder_indices.lookup_index(self); values.placeholders.insert(row, index) diff --git a/src/librustc_mir/borrow_check/nll/renumber.rs b/src/librustc_mir/borrow_check/nll/renumber.rs index 363afb87ed9..e6a974fd8cc 100644 --- a/src/librustc_mir/borrow_check/nll/renumber.rs +++ b/src/librustc_mir/borrow_check/nll/renumber.rs @@ -1,16 +1,6 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty::subst::Substs; use rustc::ty::{self, ClosureSubsts, GeneratorSubsts, Ty, TypeFoldable}; -use rustc::mir::{BasicBlock, Location, Mir, Statement, StatementKind, UserTypeAnnotation}; +use rustc::mir::{Location, Mir}; use rustc::mir::visit::{MutVisitor, TyContext}; use rustc::infer::{InferCtxt, NLLRegionVariableOrigin}; @@ -65,14 +55,6 @@ impl<'a, 'gcx, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'gcx, 'tcx> { debug!("visit_ty: ty={:?}", ty); } - fn visit_user_type_annotation(&mut self, _ty: &mut UserTypeAnnotation<'tcx>) { - // User type annotations represent the types that the user - // wrote in the progarm. We don't want to erase the regions - // from these types: rather, we want to add them as - // constraints at type-check time. - debug!("visit_user_type_annotation: skipping renumber"); - } - fn visit_substs(&mut self, substs: &mut &'tcx Substs<'tcx>, location: Location) { debug!("visit_substs(substs={:?}, location={:?})", substs, location); @@ -90,7 +72,7 @@ impl<'a, 'gcx, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'gcx, 'tcx> { debug!("visit_region: region={:?}", region); } - fn visit_const(&mut self, constant: &mut &'tcx ty::Const<'tcx>, _location: Location) { + fn visit_const(&mut self, constant: &mut &'tcx ty::LazyConst<'tcx>, _location: Location) { *constant = self.renumber_regions(&*constant); } @@ -119,16 +101,4 @@ impl<'a, 'gcx, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'gcx, 'tcx> { debug!("visit_closure_substs: substs={:?}", substs); } - - fn visit_statement( - &mut self, - block: BasicBlock, - statement: &mut Statement<'tcx>, - location: Location, - ) { - if let StatementKind::EndRegion(_) = statement.kind { - statement.kind = StatementKind::Nop; - } - self.super_statement(block, statement, location); - } } diff --git a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs index 35ec4781435..b7555e57a62 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::nll::constraints::OutlivesConstraint; use borrow_check::nll::region_infer::TypeTest; use borrow_check::nll::type_check::{Locations, MirTypeckRegionConstraints}; diff --git a/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs b/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs index 3d0f3d9fc7d..b19dc9091cb 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::nll::type_check::constraint_conversion; use borrow_check::nll::type_check::{Locations, MirTypeckRegionConstraints}; use borrow_check::nll::universal_regions::UniversalRegions; diff --git a/src/librustc_mir/borrow_check/nll/type_check/input_output.rs b/src/librustc_mir/borrow_check/nll/type_check/input_output.rs index 85ea39e538f..ef0f7e1b217 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/input_output.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/input_output.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains code to equate the input/output types appearing //! in the MIR with the expected input/output types from the function //! signature. This requires a bit of processing, as the expected types @@ -40,7 +30,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { // If the user explicitly annotated the input types, extract // those. // - // e.g. `|x: FxHashMap<_, &'static u32>| ...` + // e.g., `|x: FxHashMap<_, &'static u32>| ...` let user_provided_sig; if !self.tcx().is_closure(self.mir_def_id) { user_provided_sig = None; @@ -50,7 +40,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { None => None, Some(user_provided_poly_sig) => { // Instantiate the canonicalized variables from - // user-provided signature (e.g. the `_` in the code + // user-provided signature (e.g., the `_` in the code // above) with fresh variables. let (poly_sig, _) = self.infcx.instantiate_canonical_with_fresh_inference_vars( mir.span, diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs index cc176cbc403..dda74e6a6a6 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! For the NLL computation, we need to compute liveness, but only for those //! local variables whose types contain regions. The others are not of interest //! to us. This file defines a new index type (LiveVar) that indexes into diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs index 4b39d58cd96..3f13cc8b647 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::nll::region_infer::values::{PointIndex, RegionValueElements}; use borrow_check::nll::type_check::liveness::liveness_map::{LiveVar, NllLivenessMap}; use rustc::mir::visit::{PlaceContext, Visitor}; @@ -23,7 +13,7 @@ crate struct LocalUseMap<'me> { liveness_map: &'me NllLivenessMap, /// Head of a linked list of **definitions** of each variable -- - /// definition in this context means assignment, e.g. `x` is + /// definition in this context means assignment, e.g., `x` is /// defined in `x = y` but not `y`; that first def is the head of /// a linked list that lets you enumerate all places the variable /// is assigned. diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs index 9ccdc84db15..633695a9b9c 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::location::LocationTable; use borrow_check::nll::region_infer::values::RegionValueElements; use borrow_check::nll::constraints::ConstraintSet; @@ -39,7 +29,7 @@ pub(super) fn generate<'gcx, 'tcx>( typeck: &mut TypeChecker<'_, 'gcx, 'tcx>, mir: &Mir<'tcx>, elements: &Rc, - flow_inits: &mut FlowAtLocation>, + flow_inits: &mut FlowAtLocation<'tcx, MaybeInitializedPlaces<'_, 'gcx, 'tcx>>, move_data: &MoveData<'tcx>, location_table: &LocationTable, ) { diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs index bc4e0ca2351..77e8dd9d130 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::location::LocationTable; use borrow_check::nll::region_infer::values::{self, PointIndex, RegionValueElements}; use borrow_check::nll::type_check::liveness::liveness_map::{LiveVar, NllLivenessMap}; @@ -46,7 +36,7 @@ pub(super) fn trace( typeck: &mut TypeChecker<'_, 'gcx, 'tcx>, mir: &Mir<'tcx>, elements: &Rc, - flow_inits: &mut FlowAtLocation>, + flow_inits: &mut FlowAtLocation<'tcx, MaybeInitializedPlaces<'_, 'gcx, 'tcx>>, move_data: &MoveData<'tcx>, liveness_map: &NllLivenessMap, location_table: &LocationTable, @@ -99,7 +89,7 @@ where /// Results of dataflow tracking which variables (and paths) have been /// initialized. - flow_inits: &'me mut FlowAtLocation>, + flow_inits: &'me mut FlowAtLocation<'tcx, MaybeInitializedPlaces<'flow, 'gcx, 'tcx>>, /// Index indicating where each variable is assigned, used, or /// dropped. diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 06dfd4bc2cc..3e6aa358ee0 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -1,14 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This pass type-checks the MIR to ensure it is not broken. + #![allow(unreachable_code)] use borrow_check::borrow_set::BorrowSet; @@ -44,8 +35,11 @@ use rustc::traits::query::type_op::custom::CustomTypeOp; use rustc::traits::query::{Fallible, NoSolution}; use rustc::traits::{ObligationCause, PredicateObligations}; use rustc::ty::fold::TypeFoldable; -use rustc::ty::subst::{Subst, Substs, UnpackedKind}; -use rustc::ty::{self, RegionVid, ToPolyTraitRef, Ty, TyCtxt, TyKind}; +use rustc::ty::subst::{Subst, Substs, UnpackedKind, UserSubsts}; +use rustc::ty::{ + self, RegionVid, ToPolyTraitRef, Ty, TyCtxt, TyKind, UserType, + CanonicalUserTypeAnnotation, UserTypeAnnotationIndex, +}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; use rustc::ty::layout::VariantIdx; @@ -122,7 +116,7 @@ pub(crate) fn type_check<'gcx, 'tcx>( location_table: &LocationTable, borrow_set: &BorrowSet<'tcx>, all_facts: &mut Option, - flow_inits: &mut FlowAtLocation>, + flow_inits: &mut FlowAtLocation<'tcx, MaybeInitializedPlaces<'_, 'gcx, 'tcx>>, move_data: &MoveData<'tcx>, elements: &Rc, ) -> MirTypeckResults<'tcx> { @@ -281,23 +275,57 @@ impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> { self.sanitize_constant(constant, location); self.sanitize_type(constant, constant.ty); - if let Some(user_ty) = constant.user_ty { + if let Some(annotation_index) = constant.user_ty { if let Err(terr) = self.cx.relate_type_and_user_type( constant.ty, ty::Variance::Invariant, - &UserTypeProjection { base: user_ty, projs: vec![], }, + &UserTypeProjection { base: annotation_index, projs: vec![], }, location.to_locations(), ConstraintCategory::Boring, ) { + let annotation = &self.mir.user_type_annotations[annotation_index]; span_mirbug!( self, constant, "bad constant user type {:?} vs {:?}: {:?}", - user_ty, + annotation, constant.ty, terr, ); } + } else { + match *constant.literal { + ty::LazyConst::Unevaluated(def_id, substs) => { + if let Err(terr) = self.cx.fully_perform_op( + location.to_locations(), + ConstraintCategory::Boring, + self.cx.param_env.and(type_op::ascribe_user_type::AscribeUserType::new( + constant.ty, def_id, UserSubsts { substs, user_self_ty: None }, + )), + ) { + span_mirbug!( + self, + constant, + "bad constant type {:?} ({:?})", + constant, + terr + ); + } + } + ty::LazyConst::Evaluated(lit) => { + if let ty::FnDef(def_id, substs) = lit.ty.sty { + let tcx = self.tcx(); + + let instantiated_predicates = tcx + .predicates_of(def_id) + .instantiate(tcx, substs); + self.cx.normalize_and_prove_instantiated_predicates( + instantiated_predicates, + location.to_locations(), + ); + } + } + } } } @@ -312,8 +340,20 @@ impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> { self.sanitize_type(local_decl, local_decl.ty); for (user_ty, span) in local_decl.user_ty.projections_and_spans() { + let ty = if !local_decl.is_nonref_binding() { + // If we have a binding of the form `let ref x: T = ..` then remove the outermost + // reference so we can check the type annotation for the remaining type. + if let ty::Ref(_, rty, _) = local_decl.ty.sty { + rty + } else { + bug!("{:?} with ref binding has wrong type {}", local, local_decl.ty); + } + } else { + local_decl.ty + }; + if let Err(terr) = self.cx.relate_type_and_user_type( - local_decl.ty, + ty, ty::Variance::Invariant, user_ty, Locations::All(*span), @@ -367,47 +407,24 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { } } - /// Checks that the constant's `ty` field matches up with what - /// would be expected from its literal. + /// Checks that the constant's `ty` field matches up with what would be + /// expected from its literal. Unevaluated constants and well-formed + /// constraints are checked by `visit_constant`. fn sanitize_constant(&mut self, constant: &Constant<'tcx>, location: Location) { debug!( "sanitize_constant(constant={:?}, location={:?})", constant, location ); - // FIXME(#46702) -- We need some way to get the predicates - // associated with the "pre-evaluated" form of the - // constant. For example, consider that the constant - // may have associated constant projections (`>::SOME_CONST`) that impose - // constraints on `'a` and `'b`. These constraints - // would be lost if we just look at the normalized - // value. - if let ty::FnDef(def_id, substs) = constant.literal.ty.sty { - let tcx = self.tcx(); - let type_checker = &mut self.cx; - - // FIXME -- For now, use the substitutions from - // `value.ty` rather than `value.val`. The - // renumberer will rewrite them to independent - // sets of regions; in principle, we ought to - // derive the type of the `value.val` from "first - // principles" and equate with value.ty, but as we - // are transitioning to the miri-based system, we - // don't have a handy function for that, so for - // now we just ignore `value.val` regions. - - let instantiated_predicates = tcx.predicates_of(def_id).instantiate(tcx, substs); - type_checker.normalize_and_prove_instantiated_predicates( - instantiated_predicates, - location.to_locations(), - ); - } + let literal = match constant.literal { + ty::LazyConst::Evaluated(lit) => lit, + ty::LazyConst::Unevaluated(..) => return, + }; - debug!("sanitize_constant: expected_ty={:?}", constant.literal.ty); + debug!("sanitize_constant: expected_ty={:?}", literal.ty); if let Err(terr) = self.cx.eq_types( - constant.literal.ty, + literal.ty, constant.ty, location.to_locations(), ConstraintCategory::Boring, @@ -417,7 +434,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { constant, "constant {:?} should have type {:?} but has {:?} ({:?})", constant, - constant.literal.ty, + literal.ty, constant.ty, terr, ); @@ -496,13 +513,17 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { substs: tcx.mk_substs_trait(place_ty.to_ty(tcx), &[]), }; - // In order to have a Copy operand, the type T of the value must be Copy. Note that we - // prove that T: Copy, rather than using the type_moves_by_default test. This is - // important because type_moves_by_default ignores the resulting region obligations and - // assumes they pass. This can result in bounds from Copy impls being unsoundly ignored - // (e.g., #29149). Note that we decide to use Copy before knowing whether the bounds - // fully apply: in effect, the rule is that if a value of some type could implement - // Copy, then it must. + // In order to have a Copy operand, the type T of the + // value must be Copy. Note that we prove that T: Copy, + // rather than using the `is_copy_modulo_regions` + // test. This is important because + // `is_copy_modulo_regions` ignores the resulting region + // obligations and assumes they pass. This can result in + // bounds from Copy impls being unsoundly ignored (e.g., + // #29149). Note that we decide to use Copy before knowing + // whether the bounds fully apply: in effect, the rule is + // that if a value of some type could implement Copy, then + // it must. self.cx.prove_trait_ref( trait_ref, location.to_locations(), @@ -777,7 +798,7 @@ impl MirTypeckRegionConstraints<'tcx> { fn placeholder_region( &mut self, infcx: &InferCtxt<'_, '_, 'tcx>, - placeholder: ty::Placeholder, + placeholder: ty::PlaceholderRegion, ) -> ty::Region<'tcx> { let placeholder_index = self.placeholder_indices.insert(placeholder); match self.placeholder_index_to_region.get(placeholder_index) { @@ -869,7 +890,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { borrowck_context: Option<&'a mut BorrowCheckContext<'a, 'tcx>>, universal_region_relations: Option<&'a UniversalRegionRelations<'tcx>>, ) -> Self { - TypeChecker { + let mut checker = Self { infcx, last_span: DUMMY_SP, mir, @@ -880,6 +901,68 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { borrowck_context, reported_errors: Default::default(), universal_region_relations, + }; + checker.check_user_type_annotations(); + checker + } + + /// Equate the inferred type and the annotated type for user type annotations + fn check_user_type_annotations(&mut self) { + debug!( + "check_user_type_annotations: user_type_annotations={:?}", + self.mir.user_type_annotations + ); + for user_annotation in &self.mir.user_type_annotations { + let CanonicalUserTypeAnnotation { span, ref user_ty, inferred_ty } = *user_annotation; + let (annotation, _) = self.infcx.instantiate_canonical_with_fresh_inference_vars( + span, user_ty + ); + match annotation { + UserType::Ty(mut ty) => { + ty = self.normalize(ty, Locations::All(span)); + + if let Err(terr) = self.eq_types( + ty, + inferred_ty, + Locations::All(span), + ConstraintCategory::BoringNoLocation, + ) { + span_mirbug!( + self, + user_annotation, + "bad user type ({:?} = {:?}): {:?}", + ty, + inferred_ty, + terr + ); + } + + self.prove_predicate( + ty::Predicate::WellFormed(inferred_ty), + Locations::All(span), + ConstraintCategory::TypeAnnotation, + ); + }, + UserType::TypeOf(def_id, user_substs) => { + if let Err(terr) = self.fully_perform_op( + Locations::All(span), + ConstraintCategory::BoringNoLocation, + self.param_env.and(type_op::ascribe_user_type::AscribeUserType::new( + inferred_ty, def_id, user_substs, + )), + ) { + span_mirbug!( + self, + user_annotation, + "bad user type AscribeUserType({:?}, {:?} {:?}): {:?}", + inferred_ty, + def_id, + user_substs, + terr + ); + } + }, + } } } @@ -1012,68 +1095,23 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { a, v, user_ty, locations, ); - match user_ty.base { - UserTypeAnnotation::Ty(canonical_ty) => { - let (ty, _) = self.infcx - .instantiate_canonical_with_fresh_inference_vars(DUMMY_SP, &canonical_ty); - - // The `TypeRelating` code assumes that "unresolved inference - // variables" appear in the "a" side, so flip `Contravariant` - // ambient variance to get the right relationship. - let v1 = ty::Contravariant.xform(v); + let annotated_type = self.mir.user_type_annotations[user_ty.base].inferred_ty; + let mut curr_projected_ty = PlaceTy::from_ty(annotated_type); - let tcx = self.infcx.tcx; - let ty = self.normalize(ty, locations); + let tcx = self.infcx.tcx; - // We need to follow any provided projetions into the type. - // - // if we hit a ty var as we descend, then just skip the - // attempt to relate the mir local with any type. - #[derive(Debug)] struct HitTyVar; - let mut curr_projected_ty: Result; - - curr_projected_ty = Ok(PlaceTy::from_ty(ty)); - for proj in &user_ty.projs { - let projected_ty = if let Ok(projected_ty) = curr_projected_ty { - projected_ty - } else { - break; - }; - curr_projected_ty = projected_ty.projection_ty_core( - tcx, proj, |this, field, &()| { - if this.to_ty(tcx).is_ty_var() { - Err(HitTyVar) - } else { - let ty = this.field_ty(tcx, field); - Ok(self.normalize(ty, locations)) - } - }); - } - debug!("user_ty base: {:?} freshened: {:?} projs: {:?} yields: {:?}", - user_ty.base, ty, user_ty.projs, curr_projected_ty); - - if let Ok(projected_ty) = curr_projected_ty { - let ty = projected_ty.to_ty(tcx); - self.relate_types(ty, v1, a, locations, category)?; - } - } - UserTypeAnnotation::TypeOf(def_id, canonical_substs) => { - let ( - user_substs, - _, - ) = self.infcx - .instantiate_canonical_with_fresh_inference_vars(DUMMY_SP, &canonical_substs); - - let projs = self.infcx.tcx.intern_projs(&user_ty.projs); - self.fully_perform_op( - locations, - category, - self.param_env.and(type_op::ascribe_user_type::AscribeUserType::new( - a, v, def_id, user_substs, projs, - )), - )?; - } + for proj in &user_ty.projs { + let projected_ty = curr_projected_ty.projection_ty_core(tcx, proj, |this, field, &()| { + let ty = this.field_ty(tcx, field); + self.normalize(ty, locations) + }); + curr_projected_ty = projected_ty; } + debug!("user_ty base: {:?} freshened: {:?} projs: {:?} yields: {:?}", + user_ty.base, annotated_type, user_ty.projs, curr_projected_ty); + + let ty = curr_projected_ty.to_ty(tcx); + self.relate_types(a, v, ty, locations, category)?; Ok(()) } @@ -1234,19 +1272,20 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { ); } - if let Some(user_ty) = self.rvalue_user_ty(rv) { + if let Some(annotation_index) = self.rvalue_user_ty(rv) { if let Err(terr) = self.relate_type_and_user_type( rv_ty, ty::Variance::Invariant, - &UserTypeProjection { base: user_ty, projs: vec![], }, + &UserTypeProjection { base: annotation_index, projs: vec![], }, location.to_locations(), ConstraintCategory::Boring, ) { + let annotation = &mir.user_type_annotations[annotation_index]; span_mirbug!( self, stmt, "bad user type on rvalue ({:?} = {:?}): {:?}", - user_ty, + annotation, rv_ty, terr ); @@ -1291,21 +1330,23 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { ); }; } - StatementKind::AscribeUserType(ref place, variance, box ref c_ty) => { + StatementKind::AscribeUserType(ref place, variance, box ref projection) => { let place_ty = place.ty(mir, tcx).to_ty(tcx); if let Err(terr) = self.relate_type_and_user_type( place_ty, variance, - c_ty, + projection, Locations::All(stmt.source_info.span), ConstraintCategory::TypeAnnotation, ) { + let annotation = &mir.user_type_annotations[projection.base]; span_mirbug!( self, stmt, - "bad type assert ({:?} <: {:?}): {:?}", + "bad type assert ({:?} <: {:?} with projections {:?}): {:?}", place_ty, - c_ty, + annotation, + projection.projs, terr ); } @@ -1314,9 +1355,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { | StatementKind::StorageLive(..) | StatementKind::StorageDead(..) | StatementKind::InlineAsm { .. } - | StatementKind::EndRegion(_) | StatementKind::Retag { .. } - | StatementKind::EscapeToRaw { .. } | StatementKind::Nop => {} } } @@ -1416,7 +1455,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { self.check_call_dest(mir, term, &sig, destination, term_location); self.prove_predicates( - sig.inputs().iter().map(|ty| ty::Predicate::WellFormed(ty)), + sig.inputs_and_output.iter().map(|ty| ty::Predicate::WellFormed(ty)), term_location.to_locations(), ConstraintCategory::Boring, ); @@ -1468,7 +1507,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { value_ty, ty, term_location.to_locations(), - ConstraintCategory::Return, + ConstraintCategory::Yield, ) { span_mirbug!( self, @@ -1546,8 +1585,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { } } None => { - // FIXME(canndrew): This is_never should probably be an is_uninhabited - if !sig.output().is_never() { + if !sig.output().conservative_is_privately_uninhabited(self.tcx()) { span_mirbug!(self, term, "call to converging function {:?} w/o dest", sig); } } @@ -1967,7 +2005,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { /// If this rvalue supports a user-given type annotation, then /// extract and return it. This represents the final type of the /// rvalue and will be unified with the inferred type. - fn rvalue_user_ty(&self, rvalue: &Rvalue<'tcx>) -> Option> { + fn rvalue_user_ty(&self, rvalue: &Rvalue<'tcx>) -> Option { match rvalue { Rvalue::Use(_) | Rvalue::Repeat(..) diff --git a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs b/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs index b82efb29f6e..74ad7d988cc 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs @@ -1,19 +1,10 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::nll::constraints::OutlivesConstraint; use borrow_check::nll::type_check::{BorrowCheckContext, Locations}; -use rustc::infer::nll_relate::{TypeRelating, TypeRelatingDelegate}; +use rustc::infer::nll_relate::{TypeRelating, TypeRelatingDelegate, NormalizationStrategy}; use rustc::infer::{InferCtxt, NLLRegionVariableOrigin}; use rustc::mir::ConstraintCategory; use rustc::traits::query::Fallible; +use rustc::traits::DomainGoal; use rustc::ty::relate::TypeRelation; use rustc::ty::{self, Ty}; @@ -38,7 +29,7 @@ pub(super) fn relate_types<'tcx>( TypeRelating::new( infcx, NllTypeRelatingDelegate::new(infcx, borrowck_context, locations, category), - v, + v ).relate(&a, &b)?; Ok(()) } @@ -84,7 +75,10 @@ impl TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, '_, 'tcx> { } } - fn next_placeholder_region(&mut self, placeholder: ty::Placeholder) -> ty::Region<'tcx> { + fn next_placeholder_region( + &mut self, + placeholder: ty::PlaceholderRegion + ) -> ty::Region<'tcx> { if let Some(borrowck_context) = &mut self.borrowck_context { borrowck_context.constraints.placeholder_region(self.infcx, placeholder) } else { @@ -112,4 +106,16 @@ impl TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, '_, 'tcx> { }); } } + + fn push_domain_goal(&mut self, _: DomainGoal<'tcx>) { + bug!("should never be invoked with eager normalization") + } + + fn normalization() -> NormalizationStrategy { + NormalizationStrategy::Eager + } + + fn forbid_inference_vars() -> bool { + true + } } diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index c54a4f96b7d..0a214e60bdd 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Code to extract the universally quantified regions declared on a //! function and the relationships between them. For example: //! @@ -210,8 +200,8 @@ impl<'tcx> UniversalRegions<'tcx> { param_env: ty::ParamEnv<'tcx>, ) -> Self { let tcx = infcx.tcx; - let mir_node_id = tcx.hir.as_local_node_id(mir_def_id).unwrap(); - let mir_hir_id = tcx.hir.node_to_hir_id(mir_node_id); + let mir_node_id = tcx.hir().as_local_node_id(mir_def_id).unwrap(); + let mir_hir_id = tcx.hir().node_to_hir_id(mir_node_id); UniversalRegionsBuilder { infcx, mir_def_id, @@ -485,7 +475,8 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> { let tcx = self.infcx.tcx; let closure_base_def_id = tcx.closure_base_def_id(self.mir_def_id); - match tcx.hir.body_owner_kind(self.mir_node_id) { + match tcx.hir().body_owner_kind(self.mir_node_id) { + BodyOwnerKind::Closure | BodyOwnerKind::Fn => { let defining_ty = if self.mir_def_id == closure_base_def_id { tcx.type_of(closure_base_def_id) @@ -780,9 +771,9 @@ fn for_each_late_bound_region_defined_on<'tcx>( owner: fn_def_id.index, local_id: *late_bound, }; - let region_node_id = tcx.hir.hir_to_node_id(hir_id); - let name = tcx.hir.name(region_node_id).as_interned_str(); - let region_def_id = tcx.hir.local_def_id(region_node_id); + let region_node_id = tcx.hir().hir_to_node_id(hir_id); + let name = tcx.hir().name(region_node_id).as_interned_str(); + let region_def_id = tcx.hir().local_def_id(region_node_id); let liberated_region = tcx.mk_region(ty::ReFree(ty::FreeRegion { scope: fn_def_id, bound_region: ty::BoundRegion::BrNamed(region_def_id, name), diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index 9250c04969f..6875aced8d2 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::borrow_set::{BorrowSet, BorrowData, TwoPhaseActivation}; use borrow_check::places_conflict; use borrow_check::Context; @@ -68,6 +58,7 @@ pub(super) fn each_borrow_involving_path<'a, 'tcx, 'gcx: 'tcx, F, I, S> ( borrowed.kind, place, access, + places_conflict::PlaceConflictBias::Overlap, ) { debug!( "each_borrow_involving_path: {:?} @ {:?} vs. {:?}/{:?}", diff --git a/src/librustc_mir/borrow_check/place_ext.rs b/src/librustc_mir/borrow_check/place_ext.rs index 740cc645984..4d0b25b1024 100644 --- a/src/librustc_mir/borrow_check/place_ext.rs +++ b/src/librustc_mir/borrow_check/place_ext.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir; use rustc::mir::ProjectionElem; use rustc::mir::{Local, Mir, Place, Mutability}; diff --git a/src/librustc_mir/borrow_check/places_conflict.rs b/src/librustc_mir/borrow_check/places_conflict.rs index 715d6e0c0d1..ac7182abb36 100644 --- a/src/librustc_mir/borrow_check/places_conflict.rs +++ b/src/librustc_mir/borrow_check/places_conflict.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::ArtificialField; use borrow_check::Overlap; use borrow_check::{Deep, Shallow, AccessDepth}; @@ -17,6 +7,43 @@ use rustc::mir::{Projection, ProjectionElem}; use rustc::ty::{self, TyCtxt}; use std::cmp::max; +/// When checking if a place conflicts with another place, this enum is used to influence decisions +/// where a place might be equal or disjoint with another place, such as if `a[i] == a[j]`. +/// `PlaceConflictBias::Overlap` would bias toward assuming that `i` might equal `j` and that these +/// places overlap. `PlaceConflictBias::NoOverlap` assumes that for the purposes of the predicate +/// being run in the calling context, the conservative choice is to assume the compared indices +/// are disjoint (and therefore, do not overlap). +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +crate enum PlaceConflictBias { + Overlap, + NoOverlap, +} + +/// Helper function for checking if places conflict with a mutable borrow and deep access depth. +/// This is used to check for places conflicting outside of the borrow checking code (such as in +/// dataflow). +crate fn places_conflict<'gcx, 'tcx>( + tcx: TyCtxt<'_, 'gcx, 'tcx>, + mir: &Mir<'tcx>, + borrow_place: &Place<'tcx>, + access_place: &Place<'tcx>, + bias: PlaceConflictBias, +) -> bool { + borrow_conflicts_with_place( + tcx, + mir, + borrow_place, + BorrowKind::Mut { allow_two_phase_borrow: true }, + access_place, + AccessDepth::Deep, + bias, + ) +} + +/// Checks whether the `borrow_place` conflicts with the `access_place` given a borrow kind and +/// access depth. The `bias` parameter is used to determine how the unknowable (comparing runtime +/// array indices, for example) should be interpreted - this depends on what the caller wants in +/// order to make the conservative choice and preserve soundness. pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>( tcx: TyCtxt<'_, 'gcx, 'tcx>, mir: &Mir<'tcx>, @@ -24,10 +51,11 @@ pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>( borrow_kind: BorrowKind, access_place: &Place<'tcx>, access: AccessDepth, + bias: PlaceConflictBias, ) -> bool { debug!( - "borrow_conflicts_with_place({:?},{:?},{:?})", - borrow_place, access_place, access + "borrow_conflicts_with_place({:?}, {:?}, {:?}, {:?})", + borrow_place, access_place, access, bias, ); // This Local/Local case is handled by the more general code below, but @@ -46,7 +74,8 @@ pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>( borrow_components, borrow_kind, access_components, - access + access, + bias, ) }) }) @@ -59,6 +88,7 @@ fn place_components_conflict<'gcx, 'tcx>( borrow_kind: BorrowKind, mut access_components: PlaceComponentsIter<'_, 'tcx>, access: AccessDepth, + bias: PlaceConflictBias, ) -> bool { // The borrowck rules for proving disjointness are applied from the "root" of the // borrow forwards, iterating over "similar" projections in lockstep until @@ -121,17 +151,17 @@ fn place_components_conflict<'gcx, 'tcx>( // check whether the components being borrowed vs // accessed are disjoint (as in the second example, // but not the first). - match place_element_conflict(tcx, mir, borrow_c, access_c) { + match place_element_conflict(tcx, mir, borrow_c, access_c, bias) { Overlap::Arbitrary => { // We have encountered different fields of potentially // the same union - the borrow now partially overlaps. // // There is no *easy* way of comparing the fields // further on, because they might have different types - // (e.g. borrows of `u.a.0` and `u.b.y` where `.0` and + // (e.g., borrows of `u.a.0` and `u.b.y` where `.0` and // `.y` come from different structs). // - // We could try to do some things here - e.g. count + // We could try to do some things here - e.g., count // dereferences - but that's probably not a good // idea, at least for now, so just give up and // report a conflict. This is unsafe code anyway so @@ -165,24 +195,21 @@ fn place_components_conflict<'gcx, 'tcx>( let base_ty = base.ty(mir, tcx).to_ty(tcx); match (elem, &base_ty.sty, access) { - (_, _, Shallow(Some(ArtificialField::Discriminant))) - | (_, _, Shallow(Some(ArtificialField::ArrayLength))) + (_, _, Shallow(Some(ArtificialField::ArrayLength))) | (_, _, Shallow(Some(ArtificialField::ShallowBorrow))) => { - // The discriminant and array length are like - // additional fields on the type; they do not - // overlap any existing data there. Furthermore, - // they cannot actually be a prefix of any - // borrowed place (at least in MIR as it is - // currently.) + // The array length is like additional fields on the + // type; it does not overlap any existing data there. + // Furthermore, if cannot actually be a prefix of any + // borrowed place (at least in MIR as it is currently.) // - // e.g. a (mutable) borrow of `a[5]` while we read the + // e.g., a (mutable) borrow of `a[5]` while we read the // array length of `a`. debug!("borrow_conflicts_with_place: implicit field"); return false; } (ProjectionElem::Deref, _, Shallow(None)) => { - // e.g. a borrow of `*x.y` while we shallowly access `x.y` or some + // e.g., a borrow of `*x.y` while we shallowly access `x.y` or some // prefix thereof - the shallow access can't touch anything behind // the pointer. debug!("borrow_conflicts_with_place: shallow access behind ptr"); @@ -193,7 +220,7 @@ fn place_components_conflict<'gcx, 'tcx>( bug!("Tracking borrow behind shared reference."); } (ProjectionElem::Deref, ty::Ref(_, _, hir::MutMutable), AccessDepth::Drop) => { - // Values behind a mutatble reference are not access either by Dropping a + // Values behind a mutable reference are not access either by dropping a // value, or by StorageDead debug!("borrow_conflicts_with_place: drop access behind ptr"); return false; @@ -216,7 +243,7 @@ fn place_components_conflict<'gcx, 'tcx>( | (ProjectionElem::Downcast { .. }, _, _) => { // Recursive case. This can still be disjoint on a // further iteration if this a shallow access and - // there's a deref later on, e.g. a borrow + // there's a deref later on, e.g., a borrow // of `*x.y` while accessing `x`. } } @@ -251,7 +278,7 @@ fn place_components_conflict<'gcx, 'tcx>( /// the place `a` with a "next" pointer to `a.b`). Created by /// `unroll_place`. /// -/// NB: This particular impl strategy is not the most obvious. It was +/// N.B., this particular impl strategy is not the most obvious. It was /// chosen because it makes a measurable difference to NLL /// performance, as this code (`borrow_conflicts_with_place`) is somewhat hot. struct PlaceComponents<'p, 'tcx: 'p> { @@ -277,7 +304,7 @@ impl<'p, 'tcx> PlaceComponents<'p, 'tcx> { /// Iterator over components; see `PlaceComponents::iter` for more /// information. /// -/// NB: This is not a *true* Rust iterator -- the code above just +/// N.B., this is not a *true* Rust iterator -- the code above just /// manually invokes `next`. This is because we (sometimes) want to /// keep executing even after `None` has been returned. struct PlaceComponentsIter<'p, 'tcx: 'p> { @@ -331,6 +358,7 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>( mir: &Mir<'tcx>, elem1: &Place<'tcx>, elem2: &Place<'tcx>, + bias: PlaceConflictBias, ) -> Overlap { match (elem1, elem2) { (Place::Local(l1), Place::Local(l2)) => { @@ -384,13 +412,13 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>( (Place::Projection(pi1), Place::Projection(pi2)) => { match (&pi1.elem, &pi2.elem) { (ProjectionElem::Deref, ProjectionElem::Deref) => { - // derefs (e.g. `*x` vs. `*x`) - recur. + // derefs (e.g., `*x` vs. `*x`) - recur. debug!("place_element_conflict: DISJOINT-OR-EQ-DEREF"); Overlap::EqualOrDisjoint } (ProjectionElem::Field(f1, _), ProjectionElem::Field(f2, _)) => { if f1 == f2 { - // same field (e.g. `a.y` vs. `a.y`) - recur. + // same field (e.g., `a.y` vs. `a.y`) - recur. debug!("place_element_conflict: DISJOINT-OR-EQ-FIELD"); Overlap::EqualOrDisjoint } else { @@ -448,10 +476,20 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>( | (ProjectionElem::ConstantIndex { .. }, ProjectionElem::Index(..)) | (ProjectionElem::Subslice { .. }, ProjectionElem::Index(..)) => { // Array indexes (`a[0]` vs. `a[i]`). These can either be disjoint - // (if the indexes differ) or equal (if they are the same), so this - // is the recursive case that gives "equal *or* disjoint" its meaning. - debug!("place_element_conflict: DISJOINT-OR-EQ-ARRAY-INDEX"); - Overlap::EqualOrDisjoint + // (if the indexes differ) or equal (if they are the same). + match bias { + PlaceConflictBias::Overlap => { + // If we are biased towards overlapping, then this is the recursive + // case that gives "equal *or* disjoint" its meaning. + debug!("place_element_conflict: DISJOINT-OR-EQ-ARRAY-INDEX"); + Overlap::EqualOrDisjoint + } + PlaceConflictBias::NoOverlap => { + // If we are biased towards no overlapping, then this is disjoint. + debug!("place_element_conflict: DISJOINT-ARRAY-INDEX"); + Overlap::Disjoint + } + } } (ProjectionElem::ConstantIndex { offset: o1, min_length: _, from_end: false }, ProjectionElem::ConstantIndex { offset: o2, min_length: _, from_end: false }) diff --git a/src/librustc_mir/borrow_check/prefixes.rs b/src/librustc_mir/borrow_check/prefixes.rs index f73e08eb135..c3a8381cd58 100644 --- a/src/librustc_mir/borrow_check/prefixes.rs +++ b/src/librustc_mir/borrow_check/prefixes.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! From the NLL RFC: "The deep [aka 'supporting'] prefixes for an //! place are formed by stripping away fields and derefs, except that //! we stop when we reach the deref of a shared reference. [...] " @@ -87,14 +77,11 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { impl<'cx, 'gcx, 'tcx> Iterator for Prefixes<'cx, 'gcx, 'tcx> { type Item = &'cx Place<'tcx>; fn next(&mut self) -> Option { - let mut cursor = match self.next { - None => return None, - Some(place) => place, - }; + let mut cursor = self.next?; // Post-processing `place`: Enqueue any remaining // work. Also, `place` may not be a prefix itself, but - // may hold one further down (e.g. we never return + // may hold one further down (e.g., we never return // downcasts here, but may return a base of a downcast). 'cursor: loop { diff --git a/src/librustc_mir/borrow_check/used_muts.rs b/src/librustc_mir/borrow_check/used_muts.rs index 7c75fb59917..0ff7ff4de10 100644 --- a/src/librustc_mir/borrow_check/used_muts.rs +++ b/src/librustc_mir/borrow_check/used_muts.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::mir::visit::{PlaceContext, Visitor}; use rustc::mir::{BasicBlock, Local, Location, Place, Statement, StatementKind, TerminatorKind}; diff --git a/src/librustc_mir/build/block.rs b/src/librustc_mir/build/block.rs index 2ef71617b7c..f3d89a7a025 100644 --- a/src/librustc_mir/build/block.rs +++ b/src/librustc_mir/build/block.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use build::{BlockAnd, BlockAndExtension, BlockFrame, Builder}; use build::ForGuard::OutsideGuard; use build::matches::ArmHasGuard; @@ -117,7 +107,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { }; this.block_context.push(BlockFrame::Statement { ignores_expr_result }); - // Enter the remainder scope, i.e. the bindings' destruction scope. + // Enter the remainder scope, i.e., the bindings' destruction scope. this.push_scope((remainder_scope, source_info)); let_scope_stack.push(remainder_scope); @@ -151,9 +141,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { None, remainder_span, lint_level, slice::from_ref(&pattern), ArmHasGuard(false), None); + debug!("ast_block_stmts: pattern={:?}", pattern); this.visit_bindings( &pattern, - &PatternTypeProjections::none(), + UserTypeProjections::none(), &mut |this, _, _, _, node, span, _, _| { this.storage_live_binding(block, node, span, OutsideGuard); this.schedule_drop_for_binding(node, span, OutsideGuard); diff --git a/src/librustc_mir/build/cfg.rs b/src/librustc_mir/build/cfg.rs index 619ebb1675c..a9e468db1d1 100644 --- a/src/librustc_mir/build/cfg.rs +++ b/src/librustc_mir/build/cfg.rs @@ -1,22 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - //! Routines for manipulating the control-flow graph. use build::CFG; -use rustc::middle::region; use rustc::mir::*; -use rustc::ty::TyCtxt; impl<'tcx> CFG<'tcx> { pub fn block_data(&self, blk: BasicBlock) -> &BasicBlockData<'tcx> { @@ -45,30 +30,6 @@ impl<'tcx> CFG<'tcx> { self.block_data_mut(block).statements.push(statement); } - pub fn push_end_region<'a, 'gcx:'a+'tcx>(&mut self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, - block: BasicBlock, - source_info: SourceInfo, - region_scope: region::Scope) { - if tcx.emit_end_regions() { - if let region::ScopeData::CallSite = region_scope.data { - // The CallSite scope (aka the root scope) is sort of weird, in that it is - // supposed to "separate" the "interior" and "exterior" of a closure. Being - // that, it is not really a part of the region hierarchy, but for some - // reason it *is* considered a part of it. - // - // It should die a hopefully painful death with NLL, so let's leave this hack - // for now so that nobody can complain about soundness. - return - } - - self.push(block, Statement { - source_info, - kind: StatementKind::EndRegion(region_scope), - }); - } - } - pub fn push_assign(&mut self, block: BasicBlock, source_info: SourceInfo, diff --git a/src/librustc_mir/build/expr/as_constant.rs b/src/librustc_mir/build/expr/as_constant.rs index 606bd2978b6..31e0c0daa3f 100644 --- a/src/librustc_mir/build/expr/as_constant.rs +++ b/src/librustc_mir/build/expr/as_constant.rs @@ -1,18 +1,9 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! See docs in build/expr/mod.rs use build::Builder; use hair::*; use rustc::mir::*; +use rustc::ty::CanonicalUserTypeAnnotation; impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { /// Compile `expr`, yielding a compile-time constant. Assumes that @@ -39,11 +30,20 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { lint_level: _, value, } => this.as_constant(value), - ExprKind::Literal { literal, user_ty } => Constant { - span, - ty, - user_ty, - literal, + ExprKind::Literal { literal, user_ty } => { + let user_ty = user_ty.map(|user_ty| { + this.canonical_user_type_annotations.push(CanonicalUserTypeAnnotation { + span, + user_ty, + inferred_ty: ty, + }) + }); + Constant { + span, + ty, + user_ty, + literal, + } }, _ => span_bug!(span, "expression is not a valid constant {:?}", kind), } diff --git a/src/librustc_mir/build/expr/as_operand.rs b/src/librustc_mir/build/expr/as_operand.rs index 8046d898e0a..1f653575a7f 100644 --- a/src/librustc_mir/build/expr/as_operand.rs +++ b/src/librustc_mir/build/expr/as_operand.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! See docs in build/expr/mod.rs use build::expr::category::Category; diff --git a/src/librustc_mir/build/expr/as_place.rs b/src/librustc_mir/build/expr/as_place.rs index cb3c88876a3..6bd61ab53fd 100644 --- a/src/librustc_mir/build/expr/as_place.rs +++ b/src/librustc_mir/build/expr/as_place.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! See docs in build/expr/mod.rs use build::expr::category::Category; @@ -16,7 +6,7 @@ use build::{BlockAnd, BlockAndExtension, Builder}; use hair::*; use rustc::mir::interpret::EvalErrorKind::BoundsCheck; use rustc::mir::*; -use rustc::ty::Variance; +use rustc::ty::{CanonicalUserTypeAnnotation, Variance}; use rustc_data_structures::indexed_vec::Idx; @@ -143,6 +133,13 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ExprKind::PlaceTypeAscription { source, user_ty } => { let place = unpack!(block = this.as_place(block, source)); if let Some(user_ty) = user_ty { + let annotation_index = this.canonical_user_type_annotations.push( + CanonicalUserTypeAnnotation { + span: source_info.span, + user_ty, + inferred_ty: expr.ty, + } + ); this.cfg.push( block, Statement { @@ -150,7 +147,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { kind: StatementKind::AscribeUserType( place.clone(), Variance::Invariant, - box UserTypeProjection { base: user_ty, projs: vec![], }, + box UserTypeProjection { base: annotation_index, projs: vec![], }, ), }, ); @@ -163,6 +160,13 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { block = this.as_temp(block, source.temp_lifetime, source, mutability) ); if let Some(user_ty) = user_ty { + let annotation_index = this.canonical_user_type_annotations.push( + CanonicalUserTypeAnnotation { + span: source_info.span, + user_ty, + inferred_ty: expr.ty, + } + ); this.cfg.push( block, Statement { @@ -170,7 +174,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { kind: StatementKind::AscribeUserType( Place::Local(temp.clone()), Variance::Invariant, - box UserTypeProjection { base: user_ty, projs: vec![], }, + box UserTypeProjection { base: annotation_index, projs: vec![], }, ), }, ); diff --git a/src/librustc_mir/build/expr/as_rvalue.rs b/src/librustc_mir/build/expr/as_rvalue.rs index 18ce7ae4907..3de2f475786 100644 --- a/src/librustc_mir/build/expr/as_rvalue.rs +++ b/src/librustc_mir/build/expr/as_rvalue.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! See docs in build/expr/mod.rs +//! See docs in `build/expr/mod.rs`. use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::indexed_vec::Idx; @@ -19,7 +9,7 @@ use hair::*; use rustc::middle::region; use rustc::mir::interpret::EvalErrorKind; use rustc::mir::*; -use rustc::ty::{self, Ty, UpvarSubsts}; +use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty, UpvarSubsts}; use syntax_pos::Span; impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { @@ -77,7 +67,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { block.and(Rvalue::Repeat(value_operand, count)) } ExprKind::Borrow { - region, borrow_kind, arg, } => { @@ -85,7 +74,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { BorrowKind::Shared => unpack!(block = this.as_read_only_place(block, arg)), _ => unpack!(block = this.as_place(block, arg)), }; - block.and(Rvalue::Ref(region, borrow_kind, arg_place)) + block.and(Rvalue::Ref(this.hir.tcx().types.re_erased, borrow_kind, arg_place)) } ExprKind::Binary { op, lhs, rhs } => { let lhs = unpack!(block = this.as_operand(block, scope, lhs)); @@ -259,11 +248,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { BorrowKind::Mut { allow_two_phase_borrow: false, }, - region, arg, } => unpack!( block = this.limit_capture_mutability( - upvar.span, upvar.ty, scope, block, arg, region, + upvar.span, upvar.ty, scope, block, arg, ) ), _ => unpack!(block = this.as_operand(block, scope, upvar)), @@ -280,11 +268,13 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { span: expr_span, ty: this.hir.tcx().types.u32, user_ty: None, - literal: ty::Const::from_bits( - this.hir.tcx(), - 0, - ty::ParamEnv::empty().and(this.hir.tcx().types.u32), - ), + literal: this.hir.tcx().intern_lazy_const(ty::LazyConst::Evaluated( + ty::Const::from_bits( + this.hir.tcx(), + 0, + ty::ParamEnv::empty().and(this.hir.tcx().types.u32), + ), + )), })); box AggregateKind::Generator(closure_id, substs, movability) } @@ -341,6 +331,14 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { .collect() }; + let inferred_ty = expr.ty; + let user_ty = user_ty.map(|ty| { + this.canonical_user_type_annotations.push(CanonicalUserTypeAnnotation { + span: source_info.span, + user_ty: ty, + inferred_ty, + }) + }); let adt = box AggregateKind::Adt( adt_def, variant_index, @@ -505,7 +503,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { temp_lifetime: Option, mut block: BasicBlock, arg: ExprRef<'tcx>, - region: &'tcx ty::RegionKind, ) -> BlockAnd> { let this = self; @@ -587,7 +584,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { block, source_info, &Place::Local(temp), - Rvalue::Ref(region, borrow_kind, arg_place), + Rvalue::Ref(this.hir.tcx().types.re_erased, borrow_kind, arg_place), ); // In constants, temp_lifetime is None. We should not need to drop diff --git a/src/librustc_mir/build/expr/as_temp.rs b/src/librustc_mir/build/expr/as_temp.rs index 8f50a1e9a21..df271ff6e40 100644 --- a/src/librustc_mir/build/expr/as_temp.rs +++ b/src/librustc_mir/build/expr/as_temp.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! See docs in build/expr/mod.rs use build::{BlockAnd, BlockAndExtension, Builder}; @@ -85,9 +75,15 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { unpack!(block = this.into(&Place::Local(temp), block, expr)); - // In constants, temp_lifetime is None. We should not need to drop - // anything because no values with a destructor can be created in - // a constant at this time, even if the type may need dropping. + // In constants, temp_lifetime is None for temporaries that live for the + // 'static lifetime. Thus we do not drop these temporaries and simply leak them. + // This is equivalent to what `let x = &foo();` does in functions. The temporary + // is lifted to their surrounding scope. In a function that means the temporary lives + // until just before the function returns. In constants that means it outlives the + // constant's initialization value computation. Anything outliving a constant + // must have the `'static` lifetime and live forever. + // Anything with a shorter lifetime (e.g the `&foo()` in `bar(&foo())` or anything + // within a block will keep the regular drops just like runtime code. if let Some(temp_lifetime) = temp_lifetime { this.schedule_drop_storage_and_value( expr_span, diff --git a/src/librustc_mir/build/expr/category.rs b/src/librustc_mir/build/expr/category.rs index 05a9079cdb1..53f84a49569 100644 --- a/src/librustc_mir/build/expr/category.rs +++ b/src/librustc_mir/build/expr/category.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hair::*; #[derive(Debug, PartialEq)] diff --git a/src/librustc_mir/build/expr/into.rs b/src/librustc_mir/build/expr/into.rs index 8eb46a04839..2ffff68137d 100644 --- a/src/librustc_mir/build/expr/into.rs +++ b/src/librustc_mir/build/expr/into.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! See docs in build/expr/mod.rs use build::expr::category::{Category, RvalueFunc}; @@ -126,18 +116,17 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ExprKind::LogicalOp { op, lhs, rhs } => { // And: // - // [block: If(lhs)] -true-> [else_block: If(rhs)] -true-> [true_block] - // | | (false) - // +----------false-----------+------------------> [false_block] + // [block: If(lhs)] -true-> [else_block: dest = (rhs)] + // | (false) + // [shortcurcuit_block: dest = false] // // Or: // - // [block: If(lhs)] -false-> [else_block: If(rhs)] -true-> [true_block] - // | (true) | (false) - // [true_block] [false_block] + // [block: If(lhs)] -false-> [else_block: dest = (rhs)] + // | (true) + // [shortcurcuit_block: dest = true] - let (true_block, false_block, mut else_block, join_block) = ( - this.cfg.start_new_block(), + let (shortcircuit_block, mut else_block, join_block) = ( this.cfg.start_new_block(), this.cfg.start_new_block(), this.cfg.start_new_block(), @@ -145,47 +134,41 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let lhs = unpack!(block = this.as_local_operand(block, lhs)); let blocks = match op { - LogicalOp::And => (else_block, false_block), - LogicalOp::Or => (true_block, else_block), + LogicalOp::And => (else_block, shortcircuit_block), + LogicalOp::Or => (shortcircuit_block, else_block), }; let term = TerminatorKind::if_(this.hir.tcx(), lhs, blocks.0, blocks.1); this.cfg.terminate(block, source_info, term); - let rhs = unpack!(else_block = this.as_local_operand(else_block, rhs)); - let term = TerminatorKind::if_(this.hir.tcx(), rhs, true_block, false_block); - this.cfg.terminate(else_block, source_info, term); - this.cfg.push_assign_constant( - true_block, + shortcircuit_block, source_info, destination, Constant { span: expr_span, ty: this.hir.bool_ty(), user_ty: None, - literal: this.hir.true_literal(), + literal: match op { + LogicalOp::And => this.hir.false_literal(), + LogicalOp::Or => this.hir.true_literal(), + }, }, ); - - this.cfg.push_assign_constant( - false_block, + this.cfg.terminate( + shortcircuit_block, source_info, - destination, - Constant { - span: expr_span, - ty: this.hir.bool_ty(), - user_ty: None, - literal: this.hir.false_literal(), - }, + TerminatorKind::Goto { target: join_block }, ); - this.cfg.terminate( - true_block, + let rhs = unpack!(else_block = this.as_local_operand(else_block, rhs)); + this.cfg.push_assign( + else_block, source_info, - TerminatorKind::Goto { target: join_block }, + destination, + Rvalue::Use(rhs), ); this.cfg.terminate( - false_block, + else_block, source_info, TerminatorKind::Goto { target: join_block }, ); @@ -275,8 +258,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { exit_block.unit() } ExprKind::Call { ty, fun, args, from_hir_call } => { - // FIXME(canndrew): This is_never should probably be an is_uninhabited - let diverges = expr.ty.is_never(); let intrinsic = match ty.sty { ty::FnDef(def_id, _) => { let f = ty.fn_sig(this.hir.tcx()); @@ -332,7 +313,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { func: fun, args, cleanup: Some(cleanup), - destination: if diverges { + // FIXME(varkor): replace this with an uninhabitedness-based check. + // This requires getting access to the current module to call + // `tcx.is_ty_uninhabited_from`, which is currently tricky to do. + destination: if expr.ty.is_never() { None } else { Some((destination.clone(), success)) @@ -414,15 +398,14 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // must be handled above or else we get an // infinite loop in the builder; see - // e.g. `ExprKind::VarRef` above + // e.g., `ExprKind::VarRef` above Category::Place => false, _ => true, }); let rvalue = unpack!(block = this.as_local_rvalue(block, expr)); - this.cfg - .push_assign(block, source_info, destination, rvalue); + this.cfg.push_assign(block, source_info, destination, rvalue); block.unit() } }; diff --git a/src/librustc_mir/build/expr/mod.rs b/src/librustc_mir/build/expr/mod.rs index 6442ba34da4..ac8c7e725e1 100644 --- a/src/librustc_mir/build/expr/mod.rs +++ b/src/librustc_mir/build/expr/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Builds MIR from expressions. As a caller into this module, you //! have many options, but the first thing you have to decide is //! whether you are evaluating this expression for its *value*, its diff --git a/src/librustc_mir/build/expr/stmt.rs b/src/librustc_mir/build/expr/stmt.rs index 45235b31539..1cbc60586c3 100644 --- a/src/librustc_mir/build/expr/stmt.rs +++ b/src/librustc_mir/build/expr/stmt.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use build::scope::BreakableScope; use build::{BlockAnd, BlockAndExtension, BlockFrame, Builder}; use hair::*; @@ -16,7 +6,7 @@ use rustc::mir::*; impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { /// Builds a block of MIR statements to evaluate the HAIR `expr`. /// If the original expression was an AST statement, - /// (e.g. `some().code(&here());`) then `opt_stmt_span` is the + /// (e.g., `some().code(&here());`) then `opt_stmt_span` is the /// span of that statement (including its semicolon, if any). /// Diagnostics use this span (which may be larger than that of /// `expr`) to identify when statement temporaries are dropped. diff --git a/src/librustc_mir/build/into.rs b/src/librustc_mir/build/into.rs index 9c8d0b2aeb9..1b291260820 100644 --- a/src/librustc_mir/build/into.rs +++ b/src/librustc_mir/build/into.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! In general, there are a number of things for which it's convenient //! to just call `builder.into` and have it emit its result into a //! given location. This is basically for expressions or things that can be -//! wrapped up as expressions (e.g. blocks). To make this ergonomic, we use this +//! wrapped up as expressions (e.g., blocks). To make this ergonomic, we use this //! latter `EvalInto` trait. use build::{BlockAnd, Builder}; diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index 342aaf9039d..2f1e8c03f2f 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Code related to match expressions. These are sufficiently complex //! to warrant their own module and submodules. :) This main module //! includes the high-level algorithm, the submodules contain the @@ -18,10 +8,8 @@ use build::ForGuard::{self, OutsideGuard, RefWithinGuard, ValWithinGuard}; use build::{BlockAnd, BlockAndExtension, Builder}; use build::{GuardFrame, GuardFrameLocal, LocalsForNode}; use hair::*; -use hair::pattern::PatternTypeProjections; -use rustc::hir; use rustc::mir::*; -use rustc::ty::{self, Ty}; +use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty}; use rustc::ty::layout::VariantIdx; use rustc_data_structures::bit_set::BitSet; use rustc_data_structures::fx::FxHashMap; @@ -100,8 +88,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { .collect(); // create binding start block for link them by false edges - let candidate_count = arms.iter().fold(0, |ac, c| ac + c.patterns.len()); - let pre_binding_blocks: Vec<_> = (0..candidate_count + 1) + let candidate_count = arms.iter().map(|c| c.patterns.len()).sum::(); + let pre_binding_blocks: Vec<_> = (0..=candidate_count) .map(|_| self.cfg.start_new_block()) .collect(); @@ -111,7 +99,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // pattern, which means there may be more than one candidate // *per arm*. These candidates are kept sorted such that the // highest priority candidate comes first in the list. - // (i.e. same order as in source) + // (i.e., same order as in source) let candidates: Vec<_> = arms.iter() .enumerate() @@ -296,6 +284,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { .. }, user_ty: pat_ascription_ty, + variance: _, user_ty_span, } => { let place = @@ -313,14 +302,33 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ); let ty_source_info = self.source_info(user_ty_span); + let user_ty = box pat_ascription_ty.user_ty( + &mut self.canonical_user_type_annotations, + place.ty(&self.local_decls, self.hir.tcx()).to_ty(self.hir.tcx()), + ty_source_info.span, + ); self.cfg.push( block, Statement { source_info: ty_source_info, kind: StatementKind::AscribeUserType( place, + // We always use invariant as the variance here. This is because the + // variance field from the ascription refers to the variance to use + // when applying the type to the value being matched, but this + // ascription applies rather to the type of the binding. e.g., in this + // example: + // + // ``` + // let x: T = + // ``` + // + // We are creating an ascription that defines the type of `x` to be + // exactly `T` (i.e., with invariance). The variance field, in + // contrast, is intended to be used to relate `T` to the type of + // ``. ty::Variance::Invariant, - box pat_ascription_ty.user_ty(), + user_ty, ), }, ); @@ -337,7 +345,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { pub fn place_into_pattern( &mut self, - mut block: BasicBlock, + block: BasicBlock, irrefutable_pat: Pattern<'tcx>, initializer: &Place<'tcx>, set_match_place: bool, @@ -359,7 +367,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // Simplify the candidate. Since the pattern is irrefutable, this should // always convert all match-pairs into bindings. - unpack!(block = self.simplify_candidate(block, &mut candidate)); + self.simplify_candidate(&mut candidate); if !candidate.match_pairs.is_empty() { span_bug!( @@ -417,9 +425,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ); let mut scope = self.source_scope; let num_patterns = patterns.len(); + debug!("declare_bindings: patterns={:?}", patterns); self.visit_bindings( &patterns[0], - &PatternTypeProjections::none(), + UserTypeProjections::none(), &mut |this, mutability, name, mode, var, span, ty, user_ty| { if visibility_scope.is_none() { visibility_scope = @@ -470,7 +479,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ); let place = Place::Local(local_id); let var_ty = self.local_decls[local_id].ty; - let hir_id = self.hir.tcx().hir.node_to_hir_id(var); + let hir_id = self.hir.tcx().hir().node_to_hir_id(var); let region_scope = self.hir.region_scope_tree.var_scope(hir_id.local_id); self.schedule_drop(span, region_scope, &place, var_ty, DropKind::Storage); place @@ -479,7 +488,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { pub fn schedule_drop_for_binding(&mut self, var: NodeId, span: Span, for_guard: ForGuard) { let local_id = self.var_local_id(var, for_guard); let var_ty = self.local_decls[local_id].ty; - let hir_id = self.hir.tcx().hir.node_to_hir_id(var); + let hir_id = self.hir.tcx().hir().node_to_hir_id(var); let region_scope = self.hir.region_scope_tree.var_scope(hir_id.local_id); self.schedule_drop( span, @@ -495,7 +504,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { pub(super) fn visit_bindings( &mut self, pattern: &Pattern<'tcx>, - pattern_user_ty: &PatternTypeProjections<'tcx>, + pattern_user_ty: UserTypeProjections<'tcx>, f: &mut impl FnMut( &mut Self, Mutability, @@ -504,9 +513,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { NodeId, Span, Ty<'tcx>, - &PatternTypeProjections<'tcx>, + UserTypeProjections<'tcx>, ), ) { + debug!("visit_bindings: pattern={:?} pattern_user_ty={:?}", pattern, pattern_user_ty); match *pattern.kind { PatternKind::Binding { mutability, @@ -517,19 +527,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ref subpattern, .. } => { - let pattern_ref_binding; // sidestep temp lifetime limitations. - let binding_user_ty = match mode { - BindingMode::ByValue => { pattern_user_ty } - BindingMode::ByRef(..) => { - // If this is a `ref` binding (e.g., `let ref - // x: T = ..`), then the type of `x` is not - // `T` but rather `&T`. - pattern_ref_binding = pattern_user_ty.ref_binding(); - &pattern_ref_binding - } - }; - - f(self, mutability, name, mode, var, pattern.span, ty, binding_user_ty); + f(self, mutability, name, mode, var, pattern.span, ty, pattern_user_ty.clone()); if let Some(subpattern) = subpattern.as_ref() { self.visit_bindings(subpattern, pattern_user_ty, f); } @@ -547,41 +545,59 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let from = u32::try_from(prefix.len()).unwrap(); let to = u32::try_from(suffix.len()).unwrap(); for subpattern in prefix { - self.visit_bindings(subpattern, &pattern_user_ty.index(), f); + self.visit_bindings(subpattern, pattern_user_ty.clone().index(), f); } for subpattern in slice { - self.visit_bindings(subpattern, &pattern_user_ty.subslice(from, to), f); + self.visit_bindings(subpattern, pattern_user_ty.clone().subslice(from, to), f); } for subpattern in suffix { - self.visit_bindings(subpattern, &pattern_user_ty.index(), f); + self.visit_bindings(subpattern, pattern_user_ty.clone().index(), f); } } PatternKind::Constant { .. } | PatternKind::Range { .. } | PatternKind::Wild => {} PatternKind::Deref { ref subpattern } => { - self.visit_bindings(subpattern, &pattern_user_ty.deref(), f); + self.visit_bindings(subpattern, pattern_user_ty.deref(), f); } - PatternKind::AscribeUserType { ref subpattern, ref user_ty, user_ty_span } => { + PatternKind::AscribeUserType { + ref subpattern, + ref user_ty, + user_ty_span, + variance: _, + } => { // This corresponds to something like // // ``` // let A::<'a>(_): A<'static> = ...; // ``` - let subpattern_user_ty = pattern_user_ty.add_user_type(user_ty, user_ty_span); - self.visit_bindings(subpattern, &subpattern_user_ty, f) + // + // Note that the variance doesn't apply here, as we are tracking the effect + // of `user_ty` on any bindings contained with subpattern. + let annotation = CanonicalUserTypeAnnotation { + span: user_ty_span, + user_ty: user_ty.user_ty, + inferred_ty: subpattern.ty, + }; + let projection = UserTypeProjection { + base: self.canonical_user_type_annotations.push(annotation), + projs: Vec::new(), + }; + let subpattern_user_ty = pattern_user_ty.push_projection(&projection, user_ty_span); + self.visit_bindings(subpattern, subpattern_user_ty, f) } PatternKind::Leaf { ref subpatterns } => { for subpattern in subpatterns { - let subpattern_user_ty = pattern_user_ty.leaf(subpattern.field); - self.visit_bindings(&subpattern.pattern, &subpattern_user_ty, f); + let subpattern_user_ty = pattern_user_ty.clone().leaf(subpattern.field); + debug!("visit_bindings: subpattern_user_ty={:?}", subpattern_user_ty); + self.visit_bindings(&subpattern.pattern, subpattern_user_ty, f); } } PatternKind::Variant { adt_def, substs: _, variant_index, ref subpatterns } => { for subpattern in subpatterns { - let subpattern_user_ty = pattern_user_ty.variant( + let subpattern_user_ty = pattern_user_ty.clone().variant( adt_def, variant_index, subpattern.field); - self.visit_bindings(&subpattern.pattern, &subpattern_user_ty, f); + self.visit_bindings(&subpattern.pattern, subpattern_user_ty, f); } } } @@ -630,7 +646,7 @@ struct Binding<'tcx> { var_id: NodeId, var_ty: Ty<'tcx>, mutability: Mutability, - binding_mode: BindingMode<'tcx>, + binding_mode: BindingMode, } /// Indicates that the type of `source` must be a subtype of the @@ -641,6 +657,7 @@ struct Ascription<'tcx> { span: Span, source: Place<'tcx>, user_ty: PatternTypeProjection<'tcx>, + variance: ty::Variance, } #[derive(Clone, Debug)] @@ -671,22 +688,17 @@ enum TestKind<'tcx> { SwitchInt { switch_ty: Ty<'tcx>, options: Vec, - indices: FxHashMap<&'tcx ty::Const<'tcx>, usize>, + indices: FxHashMap, usize>, }, // test for equality Eq { - value: &'tcx ty::Const<'tcx>, + value: ty::Const<'tcx>, ty: Ty<'tcx>, }, // test whether the value falls within an inclusive or exclusive range - Range { - lo: &'tcx ty::Const<'tcx>, - hi: &'tcx ty::Const<'tcx>, - ty: Ty<'tcx>, - end: hir::RangeEnd, - }, + Range(PatternRange<'tcx>), // test length of the slice is equal to len Len { @@ -745,7 +757,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // complete, all the match pairs which remain require some // form of test, whether it be a switch or pattern comparison. for candidate in &mut candidates { - unpack!(block = self.simplify_candidate(block, candidate)); + self.simplify_candidate(candidate); } // The candidates are sorted by priority. Check to see @@ -1035,7 +1047,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { test, match_pair ); let target_blocks = self.perform_test(block, &match_pair.place, &test); - let mut target_candidates: Vec<_> = (0..target_blocks.len()).map(|_| vec![]).collect(); + let mut target_candidates = vec![vec![]; target_blocks.len()]; // Sort the candidates into the appropriate vector in // `target_candidates`. Note that at some point we may @@ -1330,14 +1342,19 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ascription.user_ty, ); + let user_ty = box ascription.user_ty.clone().user_ty( + &mut self.canonical_user_type_annotations, + ascription.source.ty(&self.local_decls, self.hir.tcx()).to_ty(self.hir.tcx()), + source_info.span + ); self.cfg.push( block, Statement { source_info, kind: StatementKind::AscribeUserType( ascription.source.clone(), - ty::Variance::Covariant, - box ascription.user_ty.clone().user_ty(), + ascription.variance, + user_ty, ), }, ); @@ -1360,7 +1377,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // Assign each of the bindings. Since we are binding for a // guard expression, this will never trigger moves out of the // candidate. - let re_empty = self.hir.tcx().types.re_empty; + let re_erased = self.hir.tcx().types.re_erased; for binding in bindings { let source_info = self.source_info(binding.span); @@ -1376,15 +1393,15 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { self.schedule_drop_for_binding(binding.var_id, binding.span, RefWithinGuard); match binding.binding_mode { BindingMode::ByValue => { - let rvalue = Rvalue::Ref(re_empty, BorrowKind::Shared, binding.source.clone()); + let rvalue = Rvalue::Ref(re_erased, BorrowKind::Shared, binding.source.clone()); self.cfg .push_assign(block, source_info, &ref_for_guard, rvalue); } - BindingMode::ByRef(region, borrow_kind) => { + BindingMode::ByRef(borrow_kind) => { // Tricky business: For `ref id` and `ref mut id` // patterns, we want `id` within the guard to // correspond to a temp of type `& &T` or `& &mut - // T` (i.e. a "borrow of a borrow") that is + // T` (i.e., a "borrow of a borrow") that is // implicitly dereferenced. // // To borrow a borrow, we need that inner borrow @@ -1420,10 +1437,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { allow_two_phase_borrow: true, }, }; - let rvalue = Rvalue::Ref(region, borrow_kind, binding.source.clone()); + let rvalue = Rvalue::Ref(re_erased, borrow_kind, binding.source.clone()); self.cfg .push_assign(block, source_info, &val_for_guard, rvalue); - let rvalue = Rvalue::Ref(region, BorrowKind::Shared, val_for_guard); + let rvalue = Rvalue::Ref(re_erased, BorrowKind::Shared, val_for_guard); self.cfg .push_assign(block, source_info, &ref_for_guard, rvalue); } @@ -1441,6 +1458,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { block, bindings ); + + let re_erased = self.hir.tcx().types.re_erased; // Assign each of the bindings. This may trigger moves out of the candidate. for binding in bindings { let source_info = self.source_info(binding.span); @@ -1451,8 +1470,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { BindingMode::ByValue => { Rvalue::Use(self.consume_by_copy_or_move(binding.source.clone())) } - BindingMode::ByRef(region, borrow_kind) => { - Rvalue::Ref(region, borrow_kind, binding.source.clone()) + BindingMode::ByRef(borrow_kind) => { + Rvalue::Ref(re_erased, borrow_kind, binding.source.clone()) } }; self.cfg.push_assign(block, source_info, &local, rvalue); @@ -1484,7 +1503,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { num_patterns: usize, var_id: NodeId, var_ty: Ty<'tcx>, - user_var_ty: &PatternTypeProjections<'tcx>, + user_ty: UserTypeProjections<'tcx>, has_guard: ArmHasGuard, opt_match_place: Option<(Option>, Span)>, pat_span: Span, @@ -1498,12 +1517,13 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let tcx = self.hir.tcx(); let binding_mode = match mode { BindingMode::ByValue => ty::BindingMode::BindByValue(mutability.into()), - BindingMode::ByRef { .. } => ty::BindingMode::BindByReference(mutability.into()), + BindingMode::ByRef(_) => ty::BindingMode::BindByReference(mutability.into()), }; + debug!("declare_binding: user_ty={:?}", user_ty); let local = LocalDecl::<'tcx> { mutability, ty: var_ty, - user_ty: user_var_ty.clone().user_ty(), + user_ty, name: Some(name), source_info, visibility_scope, @@ -1535,7 +1555,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let ref_for_guard = self.local_decls.push(LocalDecl::<'tcx> { // See previous comment. mutability: Mutability::Not, - ty: tcx.mk_imm_ref(tcx.types.re_empty, var_ty), + ty: tcx.mk_imm_ref(tcx.types.re_erased, var_ty), user_ty: UserTypeProjections::none(), name: Some(name), source_info, @@ -1604,7 +1624,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { for (matched_place, borrow_kind) in all_fake_borrows { let borrowed_input = - Rvalue::Ref(tcx.types.re_empty, borrow_kind, matched_place.clone()); + Rvalue::Ref(tcx.types.re_erased, borrow_kind, matched_place.clone()); let borrowed_input_ty = borrowed_input.ty(&self.local_decls, tcx); let borrowed_input_temp = self.temp(borrowed_input_ty, source_info.span); self.cfg.push_assign( diff --git a/src/librustc_mir/build/matches/simplify.rs b/src/librustc_mir/build/matches/simplify.rs index cfea357334f..22bc3506803 100644 --- a/src/librustc_mir/build/matches/simplify.rs +++ b/src/librustc_mir/build/matches/simplify.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Simplifying Candidates //! //! *Simplifying* a match pair `place @ pattern` means breaking it down @@ -22,33 +12,35 @@ //! sort of test: for example, testing which variant an enum is, or //! testing a value against a constant. -use build::{BlockAnd, BlockAndExtension, Builder}; +use build::Builder; use build::matches::{Ascription, Binding, MatchPair, Candidate}; use hair::*; -use rustc::mir::*; +use rustc::ty; +use rustc::ty::layout::{Integer, IntegerExt, Size}; +use syntax::attr::{SignedInt, UnsignedInt}; +use rustc::hir::RangeEnd; use std::mem; impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { pub fn simplify_candidate<'pat>(&mut self, - block: BasicBlock, - candidate: &mut Candidate<'pat, 'tcx>) - -> BlockAnd<()> { + candidate: &mut Candidate<'pat, 'tcx>) { // repeatedly simplify match pairs until fixed point is reached loop { let match_pairs = mem::replace(&mut candidate.match_pairs, vec![]); - let mut progress = match_pairs.len(); // count how many were simplified + let mut changed = false; for match_pair in match_pairs { match self.simplify_match_pair(match_pair, candidate) { - Ok(()) => {} + Ok(()) => { + changed = true; + } Err(match_pair) => { candidate.match_pairs.push(match_pair); - progress -= 1; // this one was not simplified } } } - if progress == 0 { - return block.unit(); // if we were not able to simplify any, done. + if !changed { + return; // if we were not able to simplify any, done. } } } @@ -62,12 +54,21 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { match_pair: MatchPair<'pat, 'tcx>, candidate: &mut Candidate<'pat, 'tcx>) -> Result<(), MatchPair<'pat, 'tcx>> { + let tcx = self.hir.tcx(); match *match_pair.pattern.kind { - PatternKind::AscribeUserType { ref subpattern, ref user_ty, user_ty_span } => { + PatternKind::AscribeUserType { + ref subpattern, + variance, + ref user_ty, + user_ty_span + } => { + // Apply the type ascription to the value at `match_pair.place`, which is the + // value being matched, taking the variance field into account. candidate.ascriptions.push(Ascription { span: user_ty_span, user_ty: user_ty.clone(), source: match_pair.place.clone(), + variance, }); candidate.match_pairs.push(MatchPair::new(match_pair.place, subpattern)); @@ -104,7 +105,34 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { Err(match_pair) } - PatternKind::Range { .. } => { + PatternKind::Range(PatternRange { lo, hi, ty, end }) => { + let range = match ty.sty { + ty::Char => { + Some(('\u{0000}' as u128, '\u{10FFFF}' as u128, Size::from_bits(32))) + } + ty::Int(ity) => { + // FIXME(49937): refactor these bit manipulations into interpret. + let size = Integer::from_attr(&tcx, SignedInt(ity)).size(); + let min = 1u128 << (size.bits() - 1); + let max = (1u128 << (size.bits() - 1)) - 1; + Some((min, max, size)) + } + ty::Uint(uty) => { + // FIXME(49937): refactor these bit manipulations into interpret. + let size = Integer::from_attr(&tcx, UnsignedInt(uty)).size(); + let max = !0u128 >> (128 - size.bits()); + Some((0, max, size)) + } + _ => None, + }; + if let Some((min, max, sz)) = range { + if let (Some(lo), Some(hi)) = (lo.val.try_to_bits(sz), hi.val.try_to_bits(sz)) { + if lo <= min && (hi > max || hi == max && end == RangeEnd::Included) { + // Irrefutable pattern match. + return Ok(()); + } + } + } Err(match_pair) } diff --git a/src/librustc_mir/build/matches/test.rs b/src/librustc_mir/build/matches/test.rs index 5d9cb014f58..696c173b048 100644 --- a/src/librustc_mir/build/matches/test.rs +++ b/src/librustc_mir/build/matches/test.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Testing candidates // // After candidates have been simplified, the only match pairs that @@ -18,6 +8,7 @@ use build::Builder; use build::matches::{Candidate, MatchPair, Test, TestKind}; use hair::*; +use hair::pattern::compare_const_vals; use rustc_data_structures::bit_set::BitSet; use rustc_data_structures::fx::FxHashMap; use rustc::ty::{self, Ty}; @@ -71,16 +62,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } } - PatternKind::Range { lo, hi, ty, end } => { - assert!(ty == match_pair.pattern.ty); + PatternKind::Range(range) => { + assert!(range.ty == match_pair.pattern.ty); Test { span: match_pair.pattern.span, - kind: TestKind::Range { - lo, - hi, - ty, - end, - }, + kind: TestKind::Range(range), } } @@ -115,7 +101,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { candidate: &Candidate<'pat, 'tcx>, switch_ty: Ty<'tcx>, options: &mut Vec, - indices: &mut FxHashMap<&'tcx ty::Const<'tcx>, usize>) + indices: &mut FxHashMap, usize>) -> bool { let match_pair = match candidate.match_pairs.iter().find(|mp| mp.place == *test_place) { @@ -136,7 +122,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { PatternKind::Variant { .. } => { panic!("you should have called add_variants_to_switch instead!"); } - PatternKind::Range { .. } | + PatternKind::Range(range) => { + // Check that none of the switch values are in the range. + self.values_not_contained_in_range(range, indices) + .unwrap_or(false) + } PatternKind::Slice { .. } | PatternKind::Array { .. } | PatternKind::Wild | @@ -200,20 +190,18 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { for (idx, discr) in adt_def.discriminants(tcx) { target_blocks.push(if variants.contains(idx) { values.push(discr.val); - targets.push(self.cfg.start_new_block()); - *targets.last().unwrap() + let block = self.cfg.start_new_block(); + targets.push(block); + block } else { - if otherwise_block.is_none() { - otherwise_block = Some(self.cfg.start_new_block()); - } - otherwise_block.unwrap() + *otherwise_block + .get_or_insert_with(|| self.cfg.start_new_block()) }); } - if let Some(otherwise_block) = otherwise_block { - targets.push(otherwise_block); - } else { - targets.push(self.unreachable_block()); - } + targets.push( + otherwise_block + .unwrap_or_else(|| self.unreachable_block()), + ); debug!("num_enum_variants: {}, tested variants: {:?}, variants: {:?}", num_enum_variants, values, variants); let discr_ty = adt_def.repr.discr_type().to_ty(tcx); @@ -314,18 +302,18 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } let eq_def_id = self.hir.tcx().lang_items().eq_trait().unwrap(); let (mty, method) = self.hir.trait_method(eq_def_id, "eq", ty, &[ty.into()]); + let method = self.hir.tcx().intern_lazy_const(ty::LazyConst::Evaluated(method)); + let re_erased = self.hir.tcx().types.re_erased; // take the argument by reference - let region_scope = self.topmost_scope(); - let region = self.hir.tcx().mk_region(ty::ReScope(region_scope)); let tam = ty::TypeAndMut { ty, mutbl: Mutability::MutImmutable, }; - let ref_ty = self.hir.tcx().mk_ref(region, tam); + let ref_ty = self.hir.tcx().mk_ref(re_erased, tam); // let lhs_ref_place = &lhs; - let ref_rvalue = Rvalue::Ref(region, BorrowKind::Shared, place); + let ref_rvalue = Rvalue::Ref(re_erased, BorrowKind::Shared, place); let lhs_ref_place = self.temp(ref_ty, test.span); self.cfg.push_assign(block, source_info, &lhs_ref_place, ref_rvalue); let val = Operand::Move(lhs_ref_place); @@ -335,7 +323,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { self.cfg.push_assign(block, source_info, &rhs_place, Rvalue::Use(expect)); // let rhs_ref_place = &rhs_place; - let ref_rvalue = Rvalue::Ref(region, BorrowKind::Shared, rhs_place); + let ref_rvalue = Rvalue::Ref(re_erased, BorrowKind::Shared, rhs_place); let rhs_ref_place = self.temp(ref_ty, test.span); self.cfg.push_assign(block, source_info, &rhs_ref_place, ref_rvalue); let expect = Operand::Move(rhs_ref_place); @@ -349,7 +337,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { span: test.span, ty: mty, - // FIXME(#47184): This constant comes from user + // FIXME(#54571): This constant comes from user // input (a constant in a pattern). Are // there forms where users can add type // annotations here? For example, an @@ -378,7 +366,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } } - TestKind::Range { ref lo, ref hi, ty, ref end } => { + TestKind::Range(PatternRange { ref lo, ref hi, ty, ref end }) => { // Test `val` by computing `lo <= val && val <= hi`, using primitive comparisons. let lo = self.literal_operand(test.span, ty.clone(), lo.clone()); let hi = self.literal_operand(test.span, ty.clone(), hi.clone()); @@ -490,8 +478,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // away.) let tested_match_pair = candidate.match_pairs.iter() .enumerate() - .filter(|&(_, mp)| mp.place == *test_place) - .next(); + .find(|&(_, mp)| mp.place == *test_place); let (match_pair_index, match_pair) = match tested_match_pair { Some(pair) => pair, None => { @@ -532,6 +519,24 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { resulting_candidates[index].push(new_candidate); true } + + (&TestKind::SwitchInt { switch_ty: _, ref options, ref indices }, + &PatternKind::Range(range)) => { + let not_contained = self + .values_not_contained_in_range(range, indices) + .unwrap_or(false); + + if not_contained { + // No switch values are contained in the pattern range, + // so the pattern can be matched only if this test fails. + let otherwise = options.len(); + resulting_candidates[otherwise].push(candidate.clone()); + true + } else { + false + } + } + (&TestKind::SwitchInt { .. }, _) => false, @@ -610,8 +615,63 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } } + (&TestKind::Range(test), + &PatternKind::Range(pat)) => { + if test == pat { + resulting_candidates[0] + .push(self.candidate_without_match_pair( + match_pair_index, + candidate, + )); + return true; + } + + let no_overlap = (|| { + use std::cmp::Ordering::*; + use rustc::hir::RangeEnd::*; + + let param_env = ty::ParamEnv::empty().and(test.ty); + let tcx = self.hir.tcx(); + + let lo = compare_const_vals(tcx, test.lo, pat.hi, param_env)?; + let hi = compare_const_vals(tcx, test.hi, pat.lo, param_env)?; + + match (test.end, pat.end, lo, hi) { + // pat < test + (_, _, Greater, _) | + (_, Excluded, Equal, _) | + // pat > test + (_, _, _, Less) | + (Excluded, _, _, Equal) => Some(true), + _ => Some(false), + } + })(); + + if no_overlap == Some(true) { + // Testing range does not overlap with pattern range, + // so the pattern can be matched only if this test fails. + resulting_candidates[1].push(candidate.clone()); + true + } else { + false + } + } + + (&TestKind::Range(range), &PatternKind::Constant { value }) => { + if self.const_range_contains(range, value) == Some(false) { + // `value` is not contained in the testing range, + // so `value` can be matched only if this test fails. + resulting_candidates[1].push(candidate.clone()); + true + } else { + false + } + } + + (&TestKind::Range { .. }, _) => false, + + (&TestKind::Eq { .. }, _) | - (&TestKind::Range { .. }, _) | (&TestKind::Len { .. }, _) => { // These are all binary tests. // @@ -722,6 +782,40 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { "simplifyable pattern found: {:?}", match_pair.pattern) } + + fn const_range_contains( + &self, + range: PatternRange<'tcx>, + value: ty::Const<'tcx>, + ) -> Option { + use std::cmp::Ordering::*; + + let param_env = ty::ParamEnv::empty().and(range.ty); + let tcx = self.hir.tcx(); + + let a = compare_const_vals(tcx, range.lo, value, param_env)?; + let b = compare_const_vals(tcx, value, range.hi, param_env)?; + + match (b, range.end) { + (Less, _) | + (Equal, RangeEnd::Included) if a != Greater => Some(true), + _ => Some(false), + } + } + + fn values_not_contained_in_range( + &self, + range: PatternRange<'tcx>, + indices: &FxHashMap, usize>, + ) -> Option { + for &val in indices.keys() { + if self.const_range_contains(range, val)? { + return Some(false); + } + } + + Some(true) + } } fn is_switch_ty<'tcx>(ty: Ty<'tcx>) -> bool { diff --git a/src/librustc_mir/build/matches/util.rs b/src/librustc_mir/build/matches/util.rs index a87660db2d3..b5a1a388e9c 100644 --- a/src/librustc_mir/build/matches/util.rs +++ b/src/librustc_mir/build/matches/util.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use build::Builder; use build::matches::MatchPair; use hair::*; diff --git a/src/librustc_mir/build/misc.rs b/src/librustc_mir/build/misc.rs index 9405f43c056..c849c022428 100644 --- a/src/librustc_mir/build/misc.rs +++ b/src/librustc_mir/build/misc.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Miscellaneous builder routines that are not specific to building any particular //! kind of thing. @@ -22,7 +12,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { /// Add a new temporary value of type `ty` storing the result of /// evaluating `expr`. /// - /// NB: **No cleanup is scheduled for this temporary.** You should + /// N.B., **No cleanup is scheduled for this temporary.** You should /// call `schedule_drop` once the temporary is initialized. pub fn temp(&mut self, ty: Ty<'tcx>, span: Span) -> Place<'tcx> { let temp = self.local_decls.push(LocalDecl::new_temp(ty, span)); @@ -37,13 +27,13 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { pub fn literal_operand(&mut self, span: Span, ty: Ty<'tcx>, - literal: &'tcx ty::Const<'tcx>) + literal: ty::Const<'tcx>) -> Operand<'tcx> { let constant = box Constant { span, ty, user_ty: None, - literal, + literal: self.hir.tcx().intern_lazy_const(ty::LazyConst::Evaluated(literal)), }; Operand::Constant(constant) } @@ -81,7 +71,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { pub fn consume_by_copy_or_move(&self, place: Place<'tcx>) -> Operand<'tcx> { let tcx = self.hir.tcx(); let ty = place.ty(&self.local_decls, tcx).to_ty(tcx); - if self.hir.type_moves_by_default(ty, DUMMY_SP) { + if !self.hir.type_is_copy_modulo_regions(ty, DUMMY_SP) { Operand::Move(place) } else { Operand::Copy(place) diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index d95a74be776..420ae113ad3 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -1,21 +1,10 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use build; use build::scope::{CachedBlock, DropKind}; use hair::cx::Cx; use hair::{LintLevel, BindingMode, PatternKind}; use rustc::hir; use rustc::hir::Node; -use rustc::hir::def_id::{DefId, LocalDefId}; +use rustc::hir::def_id::DefId; use rustc::middle::region; use rustc::mir::*; use rustc::mir::visit::{MutVisitor, TyContext}; @@ -39,10 +28,10 @@ use super::lints; /// Construct the MIR for a given def-id. pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'tcx> { - let id = tcx.hir.as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_node_id(def_id).unwrap(); // Figure out what primary body this item has. - let (body_id, return_ty_span) = match tcx.hir.get(id) { + let (body_id, return_ty_span) = match tcx.hir().get(id) { Node::Variant(variant) => return create_constructor_shim(tcx, id, &variant.node.data), Node::StructCtor(ctor) => @@ -76,23 +65,24 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t (*body_id, ty.span) } Node::AnonConst(hir::AnonConst { body, id, .. }) => { - (*body, tcx.hir.span(*id)) + (*body, tcx.hir().span(*id)) } - _ => span_bug!(tcx.hir.span(id), "can't build MIR for {:?}", def_id), + _ => span_bug!(tcx.hir().span(id), "can't build MIR for {:?}", def_id), }; tcx.infer_ctxt().enter(|infcx| { let cx = Cx::new(&infcx, id); let mut mir = if cx.tables().tainted_by_errors { build::construct_error(cx, body_id) - } else if let hir::BodyOwnerKind::Fn = cx.body_owner_kind { + } else if cx.body_owner_kind.is_fn_or_closure() { // fetch the fully liberated fn signature (that is, all bound // types/lifetimes replaced) - let fn_hir_id = tcx.hir.node_to_hir_id(id); + let fn_hir_id = tcx.hir().node_to_hir_id(id); let fn_sig = cx.tables().liberated_fn_sigs()[fn_hir_id].clone(); + let fn_def_id = tcx.hir().local_def_id(id); - let ty = tcx.type_of(tcx.hir.local_def_id(id)); + let ty = tcx.type_of(fn_def_id); let mut abi = fn_sig.abi; let implicit_argument = match ty.sty { ty::Closure(..) => { @@ -108,24 +98,23 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t _ => None, }; - // FIXME: safety in closures let safety = match fn_sig.unsafety { hir::Unsafety::Normal => Safety::Safe, hir::Unsafety::Unsafe => Safety::FnUnsafe, }; - let body = tcx.hir.body(body_id); + let body = tcx.hir().body(body_id); let explicit_arguments = body.arguments .iter() .enumerate() .map(|(index, arg)| { - let owner_id = tcx.hir.body_owner(body_id); + let owner_id = tcx.hir().body_owner(body_id); let opt_ty_info; let self_arg; - if let Some(ref fn_decl) = tcx.hir.fn_decl(owner_id) { + if let Some(ref fn_decl) = tcx.hir().fn_decl(owner_id) { let ty_hir_id = fn_decl.inputs[index].hir_id; - let ty_span = tcx.hir.span(tcx.hir.hir_to_node_id(ty_hir_id)); + let ty_span = tcx.hir().span(tcx.hir().hir_to_node_id(ty_hir_id)); opt_ty_info = Some(ty_span); self_arg = if index == 0 && fn_decl.implicit_self.has_implicit_self() { match fn_decl.implicit_self { @@ -152,7 +141,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t ty::Generator(gen_def_id, gen_substs, ..) => gen_substs.sig(gen_def_id, tcx), _ => - span_bug!(tcx.hir.span(id), "generator w/o generator type: {:?}", ty), + span_bug!(tcx.hir().span(id), "generator w/o generator type: {:?}", ty), }; (Some(gen_sig.yield_ty), gen_sig.return_ty) } else { @@ -213,7 +202,7 @@ impl<'a, 'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'a, 'gcx> { } } - fn visit_const(&mut self, constant: &mut &'tcx ty::Const<'tcx>, _: Location) { + fn visit_const(&mut self, constant: &mut &'tcx ty::LazyConst<'tcx>, _: Location) { if let Some(lifted) = self.tcx.lift(constant) { *constant = lifted; } else { @@ -239,7 +228,7 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, v: &'tcx hir::VariantData) -> Mir<'tcx> { - let span = tcx.hir.span(ctor_id); + let span = tcx.hir().span(ctor_id); if let hir::VariantData::Tuple(ref fields, ctor_id) = *v { tcx.infer_ctxt().enter(|infcx| { let mut mir = shim::build_adt_ctor(&infcx, ctor_id, fields, span); @@ -256,7 +245,7 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }; mir_util::dump_mir(tcx, None, "mir_map", &0, - MirSource::item(tcx.hir.local_def_id(ctor_id)), + MirSource::item(tcx.hir().local_def_id(ctor_id)), &mir, |_, _| Ok(()) ); mir @@ -273,7 +262,7 @@ fn liberated_closure_env_ty<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, closure_expr_id: ast::NodeId, body_id: hir::BodyId) -> Ty<'tcx> { - let closure_expr_hir_id = tcx.hir.node_to_hir_id(closure_expr_id); + let closure_expr_hir_id = tcx.hir().node_to_hir_id(closure_expr_id); let closure_ty = tcx.body_tables(body_id).node_id_to_type(closure_expr_hir_id); let (closure_def_id, closure_substs) = match closure_ty.sty { @@ -390,6 +379,7 @@ struct Builder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { /// (A match binding can have two locals; the 2nd is for the arm's guard.) var_indices: NodeMap, local_decls: IndexVec>, + canonical_user_type_annotations: ty::CanonicalUserTypeAnnotations<'tcx>, upvar_decls: Vec, unit_temp: Option>, @@ -621,12 +611,7 @@ fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, // unwind anyway. Don't stop them. let attrs = &tcx.get_attrs(fn_def_id); match attr::find_unwind_attr(Some(tcx.sess.diagnostic()), attrs) { - None => { - // FIXME(rust-lang/rust#48251) -- Had to disable - // abort-on-panic for backwards compatibility reasons. - false - } - + None => true, Some(UnwindAttr::Allowed) => false, Some(UnwindAttr::Aborts) => true, } @@ -655,21 +640,29 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, let arguments: Vec<_> = arguments.collect(); let tcx = hir.tcx(); - let span = tcx.hir.span(fn_id); + let tcx_hir = tcx.hir(); + let span = tcx_hir.span(fn_id); + + let hir_tables = hir.tables(); + let fn_def_id = tcx_hir.local_def_id(fn_id); // Gather the upvars of a closure, if any. - let upvar_decls: Vec<_> = tcx.with_freevars(fn_id, |freevars| { - freevars.iter().map(|fv| { - let var_id = fv.var_id(); - let var_hir_id = tcx.hir.node_to_hir_id(var_id); - let closure_expr_id = tcx.hir.local_def_id(fn_id); - let capture = hir.tables().upvar_capture(ty::UpvarId { - var_path: ty::UpvarPath {hir_id: var_hir_id}, - closure_expr_id: LocalDefId::from_def_id(closure_expr_id), - }); + // In analyze_closure() in upvar.rs we gathered a list of upvars used by a + // closure and we stored in a map called upvar_list in TypeckTables indexed + // with the closure's DefId. Here, we run through that vec of UpvarIds for + // the given closure and use the necessary information to create UpvarDecl. + let upvar_decls: Vec<_> = hir_tables + .upvar_list + .get(&fn_def_id) + .into_iter() + .flatten() + .map(|upvar_id| { + let var_hir_id = upvar_id.var_path.hir_id; + let var_node_id = tcx_hir.hir_to_node_id(var_hir_id); + let capture = hir_tables.upvar_capture(*upvar_id); let by_ref = match capture { ty::UpvarCapture::ByValue => false, - ty::UpvarCapture::ByRef(..) => true + ty::UpvarCapture::ByRef(..) => true, }; let mut decl = UpvarDecl { debug_name: keywords::Invalid.name(), @@ -677,10 +670,9 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, by_ref, mutability: Mutability::Not, }; - if let Some(Node::Binding(pat)) = tcx.hir.find(var_id) { + if let Some(Node::Binding(pat)) = tcx_hir.find(var_node_id) { if let hir::PatKind::Binding(_, _, ident, _) = pat.node { decl.debug_name = ident.name; - if let Some(&bm) = hir.tables.pat_binding_modes().get(pat.hir_id) { if bm == ty::BindByValue(hir::MutMutable) { decl.mutability = Mutability::Mut; @@ -693,8 +685,8 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, } } decl - }).collect() - }); + }) + .collect(); let mut builder = Builder::new(hir, span, @@ -704,7 +696,6 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, return_ty_span, upvar_decls); - let fn_def_id = tcx.hir.local_def_id(fn_id); let call_site_scope = region::Scope { id: body.value.hir_id.local_id, data: region::ScopeData::CallSite @@ -747,7 +738,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, // RustCall pseudo-ABI untuples the last argument. spread_arg = Some(Local::new(arguments.len())); } - let closure_expr_id = tcx.hir.local_def_id(fn_id); + let closure_expr_id = tcx_hir.local_def_id(fn_id); info!("fn_id {:?} has attrs {:?}", closure_expr_id, tcx.get_attrs(closure_expr_id)); @@ -762,10 +753,10 @@ fn construct_const<'a, 'gcx, 'tcx>( ty_span: Span, ) -> Mir<'tcx> { let tcx = hir.tcx(); - let ast_expr = &tcx.hir.body(body_id).value; + let ast_expr = &tcx.hir().body(body_id).value; let ty = hir.tables().expr_ty_adjusted(ast_expr); - let owner_id = tcx.hir.body_owner(body_id); - let span = tcx.hir.span(owner_id); + let owner_id = tcx.hir().body_owner(body_id); + let span = tcx.hir().span(owner_id); let mut builder = Builder::new(hir, span, 0, Safety::Safe, ty, ty_span,vec![]); let mut block = START_BLOCK; @@ -791,8 +782,8 @@ fn construct_const<'a, 'gcx, 'tcx>( fn construct_error<'a, 'gcx, 'tcx>(hir: Cx<'a, 'gcx, 'tcx>, body_id: hir::BodyId) -> Mir<'tcx> { - let owner_id = hir.tcx().hir.body_owner(body_id); - let span = hir.tcx().hir.span(owner_id); + let owner_id = hir.tcx().hir().body_owner(body_id); + let span = hir.tcx().hir().span(owner_id); let ty = hir.tcx().types.err; let mut builder = Builder::new(hir, span, 0, Safety::Safe, ty, span, vec![]); let source_info = builder.source_info(span); @@ -828,6 +819,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { LocalDecl::new_return_place(return_ty, return_span), 1, ), + canonical_user_type_annotations: IndexVec::new(), upvar_decls, var_indices: Default::default(), unit_temp: None, @@ -854,15 +846,18 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } } - Mir::new(self.cfg.basic_blocks, - self.source_scopes, - ClearCrossCrate::Set(self.source_scope_local_data), - IndexVec::new(), - yield_ty, - self.local_decls, - self.arg_count, - self.upvar_decls, - self.fn_span + Mir::new( + self.cfg.basic_blocks, + self.source_scopes, + ClearCrossCrate::Set(self.source_scope_local_data), + IndexVec::new(), + yield_ty, + self.local_decls, + self.canonical_user_type_annotations, + self.arg_count, + self.upvar_decls, + self.fn_span, + self.hir.control_flow_destroyed(), ) } @@ -915,6 +910,13 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let place = Place::Local(local); let &ArgInfo(ty, opt_ty_info, pattern, ref self_binding) = arg_info; + // Make sure we drop (parts of) the argument even when not matched on. + self.schedule_drop( + pattern.as_ref().map_or(ast_body.span, |pat| pat.span), + argument_scope, &place, ty, + DropKind::Value { cached_block: CachedBlock::default() }, + ); + if let Some(pattern) = pattern { let pattern = self.hir.pattern_from_hir(pattern); let span = pattern.span; @@ -946,13 +948,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } } } - - // Make sure we drop (parts of) the argument even when not matched on. - self.schedule_drop( - pattern.as_ref().map_or(ast_body.span, |pat| pat.span), - argument_scope, &place, ty, - DropKind::Value { cached_block: CachedBlock::default() }, - ); } // Enter the argument pattern bindings source scope, if it exists. diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index 99badd5a03f..78abba5f885 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /*! Managing the scope stack. The scopes are tied to lexical scopes, so as we descend the HAIR, we push a scope on the stack, build its @@ -90,12 +80,13 @@ should go to. use build::{BlockAnd, BlockAndExtension, Builder, CFG}; use hair::LintLevel; use rustc::middle::region; -use rustc::ty::{Ty, TyCtxt}; +use rustc::ty::Ty; use rustc::hir; use rustc::hir::def_id::LOCAL_CRATE; use rustc::mir::*; use syntax_pos::{Span}; use rustc_data_structures::fx::FxHashMap; +use std::collections::hash_map::Entry; #[derive(Debug)] pub struct Scope<'tcx> { @@ -151,7 +142,7 @@ struct DropData<'tcx> { pub(crate) struct CachedBlock { /// The cached block for the cleanups-on-diverge path. This block /// contains code to run the current drop and all the preceding - /// drops (i.e. those having lower index in Drop’s Scope drop + /// drops (i.e., those having lower index in Drop’s Scope drop /// array) unwind: Option, @@ -181,7 +172,7 @@ pub struct BreakableScope<'tcx> { /// Block to branch into when the loop or block terminates (either by being `break`-en out /// from, or by having its condition to become false) pub break_block: BasicBlock, - /// The destination of the loop/block expression itself (i.e. where to put the result of a + /// The destination of the loop/block expression itself (i.e., where to put the result of a /// `break` expression) pub break_destination: Place<'tcx>, } @@ -224,7 +215,7 @@ impl<'tcx> Scope<'tcx> { /// Should always be run for all inner scopes when a drop is pushed into some scope enclosing a /// larger extent of code. /// - /// `storage_only` controls whether to invalidate only drop paths run `StorageDead`. + /// `storage_only` controls whether to invalidate only drop paths that run `StorageDead`. /// `this_scope_only` controls whether to invalidate only drop paths that refer to the current /// top-of-scope (as opposed to dependent scopes). fn invalidate_cache(&mut self, storage_only: bool, this_scope_only: bool) { @@ -242,8 +233,8 @@ impl<'tcx> Scope<'tcx> { } if !storage_only && !this_scope_only { - for dropdata in &mut self.drops { - if let DropKind::Value { ref mut cached_block } = dropdata.kind { + for drop_data in &mut self.drops { + if let DropKind::Value { ref mut cached_block } = drop_data.kind { cached_block.invalidate(); } } @@ -321,11 +312,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let same_lint_scopes = tcx.dep_graph.with_ignore(|| { let sets = tcx.lint_levels(LOCAL_CRATE); let parent_hir_id = - tcx.hir.definitions().node_to_hir_id( + tcx.hir().definitions().node_to_hir_id( self.source_scope_local_data[source_scope].lint_root - ); + ); let current_hir_id = - tcx.hir.definitions().node_to_hir_id(node_id); + tcx.hir().definitions().node_to_hir_id(node_id); sets.lint_level_set(parent_hir_id) == sets.lint_level_set(current_hir_id) }); @@ -333,7 +324,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { if !same_lint_scopes { self.source_scope = self.new_source_scope(region_scope.1.span, lint_level, - None); + None); } } self.push_scope(region_scope); @@ -381,15 +372,18 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let scope = self.scopes.pop().unwrap(); assert_eq!(scope.region_scope, region_scope.0); - self.cfg.push_end_region(self.hir.tcx(), block, region_scope.1, scope.region_scope); - let resume_block = self.resume_block(); - unpack!(block = build_scope_drops(&mut self.cfg, - resume_block, - &scope, - &self.scopes, - block, - self.arg_count, - false)); + let unwind_to = self.scopes.last().and_then(|next_scope| { + next_scope.cached_unwind.get(false) + }).unwrap_or_else(|| self.resume_block()); + + unpack!(block = build_scope_drops( + &mut self.cfg, + &scope, + block, + unwind_to, + self.arg_count, + false, + )); block.unit() } @@ -397,8 +391,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { /// Branch out of `block` to `target`, exiting all scopes up to /// and including `region_scope`. This will insert whatever drops are - /// needed, as well as tracking this exit for the SEME region. See - /// module comment for details. + /// needed. See module comment for details. pub fn exit_scope(&mut self, span: Span, region_scope: (region::Scope, SourceInfo), @@ -416,41 +409,51 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // If we are emitting a `drop` statement, we need to have the cached // diverge cleanup pads ready in case that drop panics. - let may_panic = self.scopes[(len - scope_count)..].iter() - .any(|s| s.drops.iter().any(|s| s.kind.may_panic())); + let may_panic = self.scopes[(len - scope_count)..].iter().any(|s| s.needs_cleanup); if may_panic { self.diverge_cleanup(); } - { - let resume_block = self.resume_block(); - let mut rest = &mut self.scopes[(len - scope_count)..]; - while let Some((scope, rest_)) = {rest}.split_last_mut() { - rest = rest_; - block = if let Some(&e) = scope.cached_exits.get(&(target, region_scope.0)) { - self.cfg.terminate(block, scope.source_info(span), - TerminatorKind::Goto { target: e }); - return; - } else { - let b = self.cfg.start_new_block(); - self.cfg.terminate(block, scope.source_info(span), - TerminatorKind::Goto { target: b }); - scope.cached_exits.insert((target, region_scope.0), b); - b + let mut scopes = self.scopes[(len - scope_count - 1)..].iter_mut().rev(); + let mut scope = scopes.next().unwrap(); + for next_scope in scopes { + if scope.drops.is_empty() { + scope = next_scope; + continue; + } + let source_info = scope.source_info(span); + block = match scope.cached_exits.entry((target, region_scope.0)) { + Entry::Occupied(e) => { + self.cfg.terminate(block, source_info, + TerminatorKind::Goto { target: *e.get() }); + return; + } + Entry::Vacant(v) => { + let b = self.cfg.start_new_block(); + self.cfg.terminate(block, source_info, + TerminatorKind::Goto { target: b }); + v.insert(b); + b + } }; - // End all regions for scopes out of which we are breaking. - self.cfg.push_end_region(self.hir.tcx(), block, region_scope.1, scope.region_scope); + let unwind_to = next_scope.cached_unwind.get(false).unwrap_or_else(|| { + debug_assert!(!may_panic, "cached block not present?"); + START_BLOCK + }); - unpack!(block = build_scope_drops(&mut self.cfg, - resume_block, - scope, - rest, - block, - self.arg_count, - false)); - } + unpack!(block = build_scope_drops( + &mut self.cfg, + scope, + block, + unwind_to, + self.arg_count, + false, + )); + + scope = next_scope; } + let scope = &self.scopes[len - scope_count]; self.cfg.terminate(block, scope.source_info(span), TerminatorKind::Goto { target }); @@ -465,20 +468,20 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { return None; } - // Fill in the cache + // Fill in the cache for unwinds self.diverge_cleanup_gen(true); let src_info = self.scopes[0].source_info(self.fn_span); + let resume_block = self.resume_block(); + let mut scopes = self.scopes.iter_mut().rev().peekable(); let mut block = self.cfg.start_new_block(); let result = block; - let resume_block = self.resume_block(); - let mut rest = &mut self.scopes[..]; - while let Some((scope, rest_)) = {rest}.split_last_mut() { - rest = rest_; + while let Some(scope) = scopes.next() { if !scope.needs_cleanup { continue; } + block = if let Some(b) = scope.cached_generator_drop { self.cfg.terminate(block, src_info, TerminatorKind::Goto { target: b }); @@ -491,16 +494,20 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { b }; - // End all regions for scopes out of which we are breaking. - self.cfg.push_end_region(self.hir.tcx(), block, src_info, scope.region_scope); - - unpack!(block = build_scope_drops(&mut self.cfg, - resume_block, - scope, - rest, - block, - self.arg_count, - true)); + let unwind_to = scopes.peek().as_ref().map(|scope| { + scope.cached_unwind.get(true).unwrap_or_else(|| { + span_bug!(src_info.span, "cached block not present?") + }) + }).unwrap_or(resume_block); + + unpack!(block = build_scope_drops( + &mut self.cfg, + scope, + block, + unwind_to, + self.arg_count, + true, + )); } self.cfg.terminate(block, src_info, TerminatorKind::GeneratorDrop); @@ -510,9 +517,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { /// Creates a new source scope, nested in the current one. pub fn new_source_scope(&mut self, - span: Span, - lint_level: LintLevel, - safety: Option) -> SourceScope { + span: Span, + lint_level: LintLevel, + safety: Option) -> SourceScope { let parent = self.source_scope; debug!("new_source_scope({:?}, {:?}, {:?}) - parent({:?})={:?}", span, lint_level, safety, @@ -606,6 +613,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { hir::BodyOwnerKind::Static(_) => // No need to free storage in this context. None, + hir::BodyOwnerKind::Closure | hir::BodyOwnerKind::Fn => Some(self.topmost_scope()), } @@ -720,7 +728,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // // Note that this code iterates scopes from the inner-most to the outer-most, // invalidating caches of each scope visited. This way bare minimum of the - // caches gets invalidated. i.e. if a new drop is added into the middle scope, the + // caches gets invalidated. i.e., if a new drop is added into the middle scope, the // cache of outer scpoe stays intact. scope.invalidate_cache(!needs_drop, this_scope); if this_scope { @@ -749,8 +757,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { /// Creates a path that performs all required cleanup for unwinding. /// /// This path terminates in Resume. Returns the start of the path. - /// See module comment for more details. None indicates there’s no - /// cleanup to do at this point. + /// See module comment for more details. pub fn diverge_cleanup(&mut self) -> BasicBlock { self.diverge_cleanup_gen(false) } @@ -772,11 +779,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } fn diverge_cleanup_gen(&mut self, generator_drop: bool) -> BasicBlock { - // To start, create the resume terminator. - let mut target = self.resume_block(); - - let Builder { ref mut cfg, ref mut scopes, .. } = *self; - // Build up the drops in **reverse** order. The end result will // look like: // @@ -788,11 +790,17 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // store caches. If everything is cached, we'll just walk right // to left reading the cached results but never created anything. - if scopes.iter().any(|scope| scope.needs_cleanup) { - for scope in scopes.iter_mut() { - target = build_diverge_scope(self.hir.tcx(), cfg, scope.region_scope_span, - scope, target, generator_drop); - } + // Find the last cached block + let (mut target, first_uncached) = if let Some(cached_index) = self.scopes.iter() + .rposition(|scope| scope.cached_unwind.get(generator_drop).is_some()) { + (self.scopes[cached_index].cached_unwind.get(generator_drop).unwrap(), cached_index + 1) + } else { + (self.resume_block(), 0) + }; + + for scope in self.scopes[first_uncached..].iter_mut() { + target = build_diverge_scope(&mut self.cfg, scope.region_scope_span, + scope, target, generator_drop); } target @@ -866,64 +874,62 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } /// Builds drops for pop_scope and exit_scope. -fn build_scope_drops<'tcx>(cfg: &mut CFG<'tcx>, - resume_block: BasicBlock, - scope: &Scope<'tcx>, - earlier_scopes: &[Scope<'tcx>], - mut block: BasicBlock, - arg_count: usize, - generator_drop: bool) - -> BlockAnd<()> { - debug!("build_scope_drops({:?} -> {:?})", block, scope); - let mut iter = scope.drops.iter().rev(); - while let Some(drop_data) = iter.next() { +fn build_scope_drops<'tcx>( + cfg: &mut CFG<'tcx>, + scope: &Scope<'tcx>, + mut block: BasicBlock, + last_unwind_to: BasicBlock, + arg_count: usize, + generator_drop: bool, +) -> BlockAnd<()> { + debug!("build_scope_drops({:?} -> {:?}", block, scope); + + // Build up the drops in evaluation order. The end result will + // look like: + // + // [SDs, drops[n]] --..> [SDs, drop[1]] -> [SDs, drop[0]] -> [[SDs]] + // | | | + // : | | + // V V + // [drop[n]] -...-> [drop[1]] ------> [drop[0]] ------> [last_unwind_to] + // + // The horizontal arrows represent the execution path when the drops return + // successfully. The downwards arrows represent the execution path when the + // drops panic (panicking while unwinding will abort, so there's no need for + // another set of arrows). The drops for the unwind path should have already + // been generated by `diverge_cleanup_gen`. + // + // The code in this function reads from right to left. + // Storage dead drops have to be done left to right (since we can only push + // to the end of a Vec). So, we find the next drop and then call + // push_storage_deads which will iterate backwards through them so that + // they are added in the correct order. + + let mut unwind_blocks = scope.drops.iter().rev().filter_map(|drop_data| { + if let DropKind::Value { cached_block } = drop_data.kind { + Some(cached_block.get(generator_drop).unwrap_or_else(|| { + span_bug!(drop_data.span, "cached block not present?") + })) + } else { + None + } + }); + + // When we unwind from a drop, we start cleaning up from the next one, so + // we don't need this block. + unwind_blocks.next(); + + for drop_data in scope.drops.iter().rev() { let source_info = scope.source_info(drop_data.span); match drop_data.kind { DropKind::Value { .. } => { - // Try to find the next block with its cached block for us to - // diverge into, either a previous block in this current scope or - // the top of the previous scope. - // - // If it wasn't for EndRegion, we could just chain all the DropData - // together and pick the first DropKind::Value. Please do that - // when we replace EndRegion with NLL. - let on_diverge = iter.clone().filter_map(|dd| { - match dd.kind { - DropKind::Value { cached_block } => Some(cached_block), - DropKind::Storage => None - } - }).next().or_else(|| { - if earlier_scopes.iter().any(|scope| scope.needs_cleanup) { - // If *any* scope requires cleanup code to be run, - // we must use the cached unwind from the *topmost* - // scope, to ensure all EndRegions from surrounding - // scopes are executed before the drop code runs. - Some(earlier_scopes.last().unwrap().cached_unwind) - } else { - // We don't need any further cleanup, so return None - // to avoid creating a landing pad. We can skip - // EndRegions because all local regions end anyway - // when the function unwinds. - // - // This is an important optimization because LLVM is - // terrible at optimizing landing pads. FIXME: I think - // it would be cleaner and better to do this optimization - // in SimplifyCfg instead of here. - None - } - }); - - let on_diverge = on_diverge.map(|cached_block| { - cached_block.get(generator_drop).unwrap_or_else(|| { - span_bug!(drop_data.span, "cached block not present?") - }) - }); + let unwind_to = unwind_blocks.next().unwrap_or(last_unwind_to); let next = cfg.start_new_block(); cfg.terminate(block, source_info, TerminatorKind::Drop { location: drop_data.location.clone(), target: next, - unwind: Some(on_diverge.unwrap_or(resume_block)) + unwind: Some(unwind_to) }); block = next; } @@ -950,21 +956,17 @@ fn build_scope_drops<'tcx>(cfg: &mut CFG<'tcx>, block.unit() } -fn build_diverge_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, - cfg: &mut CFG<'tcx>, - span: Span, - scope: &mut Scope<'tcx>, - mut target: BasicBlock, - generator_drop: bool) - -> BasicBlock +fn build_diverge_scope<'tcx>(cfg: &mut CFG<'tcx>, + span: Span, + scope: &mut Scope<'tcx>, + mut target: BasicBlock, + generator_drop: bool) + -> BasicBlock { // Build up the drops in **reverse** order. The end result will // look like: // - // [EndRegion Block] -> [drops[n]] -...-> [drops[0]] -> [Free] -> [target] - // | | - // +---------------------------------------------------------+ - // code for scope + // [drops[n]] -...-> [drops[0]] -> [target] // // The code in this function reads from right to left. At each // point, we check for cached blocks representing the @@ -1009,21 +1011,7 @@ fn build_diverge_scope<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, }; } - // Finally, push the EndRegion block, used by mir-borrowck, and set - // `cached_unwind` to point to it (Block becomes trivial goto after - // pass that removes all EndRegions). - target = { - let cached_block = scope.cached_unwind.ref_mut(generator_drop); - if let Some(cached_block) = *cached_block { - cached_block - } else { - let block = cfg.start_new_cleanup_block(); - cfg.push_end_region(tcx, block, source_info(span), scope.region_scope); - cfg.terminate(block, source_info(span), TerminatorKind::Goto { target }); - *cached_block = Some(block); - block - } - }; + *scope.cached_unwind.ref_mut(generator_drop) = Some(target); debug!("build_diverge_scope({:?}, {:?}) = {:?}", scope, span, target); diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index 3b32fe21adf..f83a930353b 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Not in interpret to make sure we do not use private implementation details use std::fmt; @@ -20,11 +10,10 @@ use rustc::hir::{self, def_id::DefId}; use rustc::hir::def::Def; use rustc::mir::interpret::{ConstEvalErr, ErrorHandled}; use rustc::mir; -use rustc::ty::{self, TyCtxt, Instance, query::TyCtxtAt}; +use rustc::ty::{self, TyCtxt, query::TyCtxtAt}; use rustc::ty::layout::{self, LayoutOf, TyLayout, VariantIdx}; use rustc::ty::subst::Subst; use rustc::traits::Reveal; -use rustc_data_structures::indexed_vec::IndexVec; use rustc_data_structures::fx::FxHashMap; use rustc::util::common::ErrorReported; @@ -45,48 +34,20 @@ const STEPS_UNTIL_DETECTOR_ENABLED: isize = 1_000_000; /// Should be a power of two for performance reasons. const DETECTOR_SNAPSHOT_PERIOD: isize = 256; -pub fn mk_borrowck_eval_cx<'a, 'mir, 'tcx>( +/// The `EvalContext` is only meant to be used to do field and index projections into constants for +/// `simd_shuffle` and const patterns in match arms. +/// +/// The function containing the `match` that is currently being analyzed may have generic bounds +/// that inform us about the generic bounds of the constant. E.g. using an associated constant +/// of a function's generic parameter will require knowledge about the bounds on the generic +/// parameter. These bounds are passed to `mk_eval_cx` via the `ParamEnv` argument. +pub(crate) fn mk_eval_cx<'a, 'mir, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, - instance: Instance<'tcx>, - mir: &'mir mir::Mir<'tcx>, span: Span, -) -> EvalResult<'tcx, CompileTimeEvalContext<'a, 'mir, 'tcx>> { - debug!("mk_borrowck_eval_cx: {:?}", instance); - let param_env = tcx.param_env(instance.def_id()); - let mut ecx = EvalContext::new(tcx.at(span), param_env, CompileTimeInterpreter::new()); - // insert a stack frame so any queries have the correct substs - // cannot use `push_stack_frame`; if we do `const_prop` explodes - ecx.stack.push(interpret::Frame { - block: mir::START_BLOCK, - locals: IndexVec::new(), - instance, - span, - mir, - return_place: None, - return_to_block: StackPopCleanup::Goto(None), // never pop - stmt: 0, - }); - Ok(ecx) -} - -pub fn mk_eval_cx<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - instance: Instance<'tcx>, param_env: ty::ParamEnv<'tcx>, -) -> EvalResult<'tcx, CompileTimeEvalContext<'a, 'tcx, 'tcx>> { - debug!("mk_eval_cx: {:?}, {:?}", instance, param_env); - let span = tcx.def_span(instance.def_id()); - let mut ecx = EvalContext::new(tcx.at(span), param_env, CompileTimeInterpreter::new()); - let mir = ecx.load_mir(instance.def)?; - // insert a stack frame so any queries have the correct substs - ecx.push_stack_frame( - instance, - mir.span, - mir, - None, - StackPopCleanup::Goto(None), // never pop - )?; - Ok(ecx) +) -> CompileTimeEvalContext<'a, 'mir, 'tcx> { + debug!("mk_eval_cx: {:?}", param_env); + EvalContext::new(tcx.at(span), param_env, CompileTimeInterpreter::new()) } pub(crate) fn eval_promoted<'a, 'mir, 'tcx>( @@ -95,7 +56,8 @@ pub(crate) fn eval_promoted<'a, 'mir, 'tcx>( mir: &'mir mir::Mir<'tcx>, param_env: ty::ParamEnv<'tcx>, ) -> EvalResult<'tcx, MPlaceTy<'tcx>> { - let mut ecx = mk_borrowck_eval_cx(tcx, cid.instance, mir, DUMMY_SP).unwrap(); + let span = tcx.def_span(cid.instance.def_id()); + let mut ecx = mk_eval_cx(tcx, span, param_env); eval_body_using_ecx(&mut ecx, cid, Some(mir), param_env) } @@ -104,15 +66,12 @@ pub fn op_to_const<'tcx>( ecx: &CompileTimeEvalContext<'_, '_, 'tcx>, op: OpTy<'tcx>, may_normalize: bool, -) -> EvalResult<'tcx, &'tcx ty::Const<'tcx>> { - // We do not normalize just any data. Only scalar layout and fat pointers. +) -> EvalResult<'tcx, ty::Const<'tcx>> { + // We do not normalize just any data. Only scalar layout and slices. let normalize = may_normalize && match op.layout.abi { layout::Abi::Scalar(..) => true, - layout::Abi::ScalarPair(..) => { - // Must be a fat pointer - op.layout.ty.builtin_deref(true).is_some() - }, + layout::Abi::ScalarPair(..) => op.layout.ty.is_slice(), _ => false, }; let normalized_op = if normalize { @@ -129,7 +88,7 @@ pub fn op_to_const<'tcx>( assert!(meta.is_none()); let ptr = ptr.to_ptr()?; let alloc = ecx.memory.get(ptr.alloc_id)?; - assert!(alloc.align.abi() >= align.abi()); + assert!(alloc.align >= align); assert!(alloc.bytes.len() as u64 - ptr.offset.bytes() >= op.layout.size.bytes()); let mut alloc = alloc.clone(); alloc.align = align; @@ -141,16 +100,18 @@ pub fn op_to_const<'tcx>( Ok(Immediate::Scalar(x)) => ConstValue::Scalar(x.not_undef()?), Ok(Immediate::ScalarPair(a, b)) => - ConstValue::ScalarPair(a.not_undef()?, b.not_undef()?), + ConstValue::Slice(a.not_undef()?, b.to_usize(ecx)?), }; - Ok(ty::Const::from_const_value(ecx.tcx.tcx, val, op.layout.ty)) + Ok(ty::Const { val, ty: op.layout.ty }) } -pub fn const_to_op<'tcx>( + +pub fn lazy_const_to_op<'tcx>( ecx: &CompileTimeEvalContext<'_, '_, 'tcx>, - cnst: &ty::Const<'tcx>, + cnst: ty::LazyConst<'tcx>, + ty: ty::Ty<'tcx>, ) -> EvalResult<'tcx, OpTy<'tcx>> { - let op = ecx.const_value_to_op(cnst.val)?; - Ok(OpTy { op, layout: ecx.layout_of(cnst.ty)? }) + let op = ecx.const_value_to_op(cnst)?; + Ok(OpTy { op, layout: ecx.layout_of(ty)? }) } fn eval_body_and_ecx<'a, 'mir, 'tcx>( @@ -186,7 +147,7 @@ fn eval_body_using_ecx<'mir, 'tcx>( } let layout = ecx.layout_of(mir.return_ty().subst(tcx, cid.instance.substs))?; assert!(!layout.is_unsized()); - let ret = ecx.allocate(layout, MemoryKind::Stack)?; + let ret = ecx.allocate(layout, MemoryKind::Stack); let name = ty::tls::with(|tcx| tcx.item_path_str(cid.instance.def_id())); let prom = cid.promoted.map_or(String::new(), |p| format!("::promoted[{:?}]", p)); @@ -353,9 +314,12 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> for CompileTimeInterpreter<'a, 'mir, 'tcx> { type MemoryKinds = !; - type AllocExtra = (); type PointerTag = (); + type FrameExtra = (); + type MemoryExtra = (); + type AllocExtra = (); + type MemoryMap = FxHashMap, Allocation)>; const STATIC_KIND: Option = None; // no copying of statics allowed @@ -373,19 +337,22 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> ret: Option, ) -> EvalResult<'tcx, Option<&'mir mir::Mir<'tcx>>> { debug!("eval_fn_call: {:?}", instance); - // Execution might have wandered off into other crates, so we cannot to a stability- - // sensitive check here. But we can at least rule out functions that are not const - // at all. - if !ecx.tcx.is_const_fn_raw(instance.def_id()) { - // Some functions we support even if they are non-const -- but avoid testing - // that for const fn! We certainly do *not* want to actually call the fn - // though, so be sure we return here. - return if ecx.hook_fn(instance, args, dest)? { - ecx.goto_block(ret)?; // fully evaluated and done - Ok(None) - } else { - err!(MachineError(format!("calling non-const function `{}`", instance))) - }; + // Only check non-glue functions + if let ty::InstanceDef::Item(def_id) = instance.def { + // Execution might have wandered off into other crates, so we cannot to a stability- + // sensitive check here. But we can at least rule out functions that are not const + // at all. + if !ecx.tcx.is_const_fn_raw(def_id) { + // Some functions we support even if they are non-const -- but avoid testing + // that for const fn! We certainly do *not* want to actually call the fn + // though, so be sure we return here. + return if ecx.hook_fn(instance, args, dest)? { + ecx.goto_block(ret)?; // fully evaluated and done + Ok(None) + } else { + err!(MachineError(format!("calling non-const function `{}`", instance))) + }; + } } // This is a const fn. Call it. Ok(Some(match ecx.load_mir(instance.def) { @@ -432,16 +399,18 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> } fn find_foreign_static( - _tcx: TyCtxtAt<'a, 'tcx, 'tcx>, _def_id: DefId, + _tcx: TyCtxtAt<'a, 'tcx, 'tcx>, + _memory_extra: &(), ) -> EvalResult<'tcx, Cow<'tcx, Allocation>> { err!(ReadForeignStatic) } #[inline(always)] - fn adjust_static_allocation( - alloc: &'_ Allocation - ) -> Cow<'_, Allocation> { + fn adjust_static_allocation<'b>( + alloc: &'b Allocation, + _memory_extra: &(), + ) -> Cow<'b, Allocation> { // We do not use a tag so we can just cheaply forward the reference Cow::Borrowed(alloc) } @@ -484,8 +453,24 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> _ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>, ptr: Pointer, _kind: MemoryKind, - ) -> EvalResult<'tcx, Pointer> { - Ok(ptr) + ) -> Pointer { + ptr + } + + #[inline(always)] + fn stack_push( + _ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>, + ) -> EvalResult<'tcx> { + Ok(()) + } + + /// Called immediately before a stack frame gets popped + #[inline(always)] + fn stack_pop( + _ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>, + _extra: (), + ) -> EvalResult<'tcx> { + Ok(()) } } @@ -493,16 +478,15 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> pub fn const_field<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, - instance: ty::Instance<'tcx>, variant: Option, field: mir::Field, - value: &'tcx ty::Const<'tcx>, + value: ty::Const<'tcx>, ) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> { - trace!("const_field: {:?}, {:?}, {:?}", instance, field, value); - let ecx = mk_eval_cx(tcx, instance, param_env).unwrap(); + trace!("const_field: {:?}, {:?}", field, value); + let ecx = mk_eval_cx(tcx, DUMMY_SP, param_env); let result = (|| { // get the operand again - let op = const_to_op(&ecx, value)?; + let op = lazy_const_to_op(&ecx, ty::LazyConst::Evaluated(value), value.ty)?; // downcast let down = match variant { None => op, @@ -524,12 +508,11 @@ pub fn const_field<'a, 'tcx>( pub fn const_variant_index<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, - instance: ty::Instance<'tcx>, - val: &'tcx ty::Const<'tcx>, + val: ty::Const<'tcx>, ) -> EvalResult<'tcx, VariantIdx> { - trace!("const_variant_index: {:?}, {:?}", instance, val); - let ecx = mk_eval_cx(tcx, instance, param_env).unwrap(); - let op = const_to_op(&ecx, val)?; + trace!("const_variant_index: {:?}", val); + let ecx = mk_eval_cx(tcx, DUMMY_SP, param_env); + let op = lazy_const_to_op(&ecx, ty::LazyConst::Evaluated(val), val.ty)?; Ok(ecx.read_discriminant(op)?.1) } @@ -548,7 +531,7 @@ fn validate_and_turn_into_const<'a, 'tcx>( key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, ) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> { let cid = key.value; - let ecx = mk_eval_cx(tcx, cid.instance, key.param_env).unwrap(); + let ecx = mk_eval_cx(tcx, tcx.def_span(key.value.instance.def_id()), key.param_env); let val = (|| { let op = ecx.raw_const_to_mplace(constant)?.into(); // FIXME: Once the visitor infrastructure landed, change validation to @@ -642,7 +625,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>( let cid = key.value; let def_id = cid.instance.def.def_id(); - if let Some(id) = tcx.hir.as_local_node_id(def_id) { + if let Some(id) = tcx.hir().as_local_node_id(def_id) { let tables = tcx.typeck_tables_of(def_id); // Do match-check before building MIR @@ -650,7 +633,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>( return Err(ErrorHandled::Reported) } - if let hir::BodyOwnerKind::Const = tcx.hir.body_owner_kind(id) { + if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind(id) { tcx.mir_const_qualif(def_id); } @@ -670,12 +653,16 @@ pub fn const_eval_raw_provider<'a, 'tcx>( let err = error_to_const_error(&ecx, error); // errors in statics are always emitted as fatal errors if tcx.is_static(def_id).is_some() { - let err = err.report_as_error(ecx.tcx, "could not evaluate static initializer"); - // check that a static never produces `TooGeneric` + let reported_err = err.report_as_error(ecx.tcx, + "could not evaluate static initializer"); + // Ensure that if the above error was either `TooGeneric` or `Reported` + // an error must be reported. if tcx.sess.err_count() == 0 { - span_bug!(ecx.tcx.span, "static eval failure didn't emit an error: {:#?}", err); + tcx.sess.delay_span_bug(err.span, + &format!("static eval failure did not emit an error: {:#?}", + reported_err)); } - err + reported_err } else if def_id.is_local() { // constant defined in this crate, we can figure out a lint level! match tcx.describe_def(def_id) { @@ -686,7 +673,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>( // because any code that existed before validation could not have failed validation // thus preventing such a hard error from being a backwards compatibility hazard Some(Def::Const(_)) | Some(Def::AssociatedConst(_)) => { - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); err.report_as_lint( tcx.at(tcx.def_span(def_id)), "any use of this value will cause an error", @@ -706,7 +693,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>( err.report_as_lint( tcx.at(span), "reaching this expression at runtime will panic or abort", - tcx.hir.as_local_node_id(def_id).unwrap(), + tcx.hir().as_local_node_id(def_id).unwrap(), ) } // anything else (array lengths, enum initializers, constant patterns) are reported diff --git a/src/librustc_mir/dataflow/at_location.rs b/src/librustc_mir/dataflow/at_location.rs index d815bfedc37..375bc4fead4 100644 --- a/src/librustc_mir/dataflow/at_location.rs +++ b/src/librustc_mir/dataflow/at_location.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A nice wrapper to consume dataflow results at several CFG //! locations. @@ -67,22 +57,22 @@ pub trait FlowsAtLocation { /// effects at any point in the control-flow graph by starting with /// the state at the start of the basic block (`reset_to_entry_of`) /// and then replaying the effects of statements and terminators -/// (e.g. via `reconstruct_statement_effect` and +/// (e.g., via `reconstruct_statement_effect` and /// `reconstruct_terminator_effect`; don't forget to call /// `apply_local_effect`). -pub struct FlowAtLocation +pub struct FlowAtLocation<'tcx, BD> where - BD: BitDenotation, + BD: BitDenotation<'tcx>, { - base_results: DataflowResults, + base_results: DataflowResults<'tcx, BD>, curr_state: BitSet, stmt_gen: HybridBitSet, stmt_kill: HybridBitSet, } -impl FlowAtLocation +impl<'tcx, BD> FlowAtLocation<'tcx, BD> where - BD: BitDenotation, + BD: BitDenotation<'tcx>, { /// Iterate over each bit set in the current state. pub fn each_state_bit(&self, f: F) @@ -102,7 +92,7 @@ where self.stmt_gen.iter().for_each(f) } - pub fn new(results: DataflowResults) -> Self { + pub fn new(results: DataflowResults<'tcx, BD>) -> Self { let bits_per_block = results.sets().bits_per_block(); let curr_state = BitSet::new_empty(bits_per_block); let stmt_gen = HybridBitSet::new_empty(bits_per_block); @@ -143,8 +133,8 @@ where } } -impl FlowsAtLocation for FlowAtLocation - where BD: BitDenotation +impl<'tcx, BD> FlowsAtLocation for FlowAtLocation<'tcx, BD> + where BD: BitDenotation<'tcx> { fn reset_to_entry_of(&mut self, bb: BasicBlock) { self.curr_state.overwrite(self.base_results.sets().on_entry_set_for(bb.index())); @@ -213,9 +203,9 @@ impl FlowsAtLocation for FlowAtLocation } -impl<'tcx, T> FlowAtLocation +impl<'tcx, T> FlowAtLocation<'tcx, T> where - T: HasMoveData<'tcx> + BitDenotation, + T: HasMoveData<'tcx> + BitDenotation<'tcx, Idx = MovePathIndex>, { pub fn has_any_child_of(&self, mpi: T::Idx) -> Option { // We process `mpi` before the loop below, for two reasons: diff --git a/src/librustc_mir/dataflow/drop_flag_effects.rs b/src/librustc_mir/dataflow/drop_flag_effects.rs index 7af1daae4ca..22fb7a3bc47 100644 --- a/src/librustc_mir/dataflow/drop_flag_effects.rs +++ b/src/librustc_mir/dataflow/drop_flag_effects.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::mir::{self, Mir, Location}; use rustc::ty::{self, TyCtxt}; use util::elaborate_drops::DropFlagState; diff --git a/src/librustc_mir/dataflow/graphviz.rs b/src/librustc_mir/dataflow/graphviz.rs index 6896c91352f..34752baa020 100644 --- a/src/librustc_mir/dataflow/graphviz.rs +++ b/src/librustc_mir/dataflow/graphviz.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Hook into libgraphviz for rendering dataflow graphs for MIR. use syntax::ast::NodeId; @@ -25,19 +15,19 @@ use super::DataflowBuilder; use super::DebugFormatted; pub trait MirWithFlowState<'tcx> { - type BD: BitDenotation; + type BD: BitDenotation<'tcx>; fn node_id(&self) -> NodeId; fn mir(&self) -> &Mir<'tcx>; - fn flow_state(&self) -> &DataflowState; + fn flow_state(&self) -> &DataflowState<'tcx, Self::BD>; } impl<'a, 'tcx, BD> MirWithFlowState<'tcx> for DataflowBuilder<'a, 'tcx, BD> - where BD: BitDenotation + where BD: BitDenotation<'tcx> { type BD = BD; fn node_id(&self) -> NodeId { self.node_id } fn mir(&self) -> &Mir<'tcx> { self.flow_state.mir() } - fn flow_state(&self) -> &DataflowState { &self.flow_state.flow_state } + fn flow_state(&self) -> &DataflowState<'tcx, Self::BD> { &self.flow_state.flow_state } } struct Graph<'a, 'tcx, MWF:'a, P> where @@ -53,8 +43,8 @@ pub(crate) fn print_borrowck_graph_to<'a, 'tcx, BD, P>( path: &Path, render_idx: P) -> io::Result<()> - where BD: BitDenotation, - P: Fn(&BD, BD::Idx) -> DebugFormatted + where BD: BitDenotation<'tcx>, + P: Fn(&BD, BD::Idx) -> DebugFormatted, { let g = Graph { mbcx, phantom: PhantomData, render_idx }; let mut v = Vec::new(); @@ -76,7 +66,7 @@ fn outgoing(mir: &Mir, bb: BasicBlock) -> Vec { impl<'a, 'tcx, MWF, P> dot::Labeller<'a> for Graph<'a, 'tcx, MWF, P> where MWF: MirWithFlowState<'tcx>, - P: Fn(&MWF::BD, ::Idx) -> DebugFormatted, + P: Fn(&MWF::BD, >::Idx) -> DebugFormatted, { type Node = Node; type Edge = Edge; @@ -128,7 +118,7 @@ impl<'a, 'tcx, MWF, P> dot::Labeller<'a> for Graph<'a, 'tcx, MWF, P> impl<'a, 'tcx, MWF, P> Graph<'a, 'tcx, MWF, P> where MWF: MirWithFlowState<'tcx>, - P: Fn(&MWF::BD, ::Idx) -> DebugFormatted, + P: Fn(&MWF::BD, >::Idx) -> DebugFormatted, { /// Generate the node label fn node_label_internal(&self, @@ -137,8 +127,8 @@ where MWF: MirWithFlowState<'tcx>, block: BasicBlock, mir: &Mir) -> io::Result<()> { // Header rows - const HDRS: [&'static str; 4] = ["ENTRY", "MIR", "BLOCK GENS", "BLOCK KILLS"]; - const HDR_FMT: &'static str = "bgcolor=\"grey\""; + const HDRS: [&str; 4] = ["ENTRY", "MIR", "BLOCK GENS", "BLOCK KILLS"]; + const HDR_FMT: &str = "bgcolor=\"grey\""; write!(w, "")?; diff --git a/src/librustc_mir/dataflow/impls/borrowed_locals.rs b/src/librustc_mir/dataflow/impls/borrowed_locals.rs index 1e279d8dd97..9d03e35a350 100644 --- a/src/librustc_mir/dataflow/impls/borrowed_locals.rs +++ b/src/librustc_mir/dataflow/impls/borrowed_locals.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use super::*; use rustc::mir::*; @@ -36,7 +26,7 @@ impl<'a, 'tcx: 'a> HaveBeenBorrowedLocals<'a, 'tcx> { } } -impl<'a, 'tcx> BitDenotation for HaveBeenBorrowedLocals<'a, 'tcx> { +impl<'a, 'tcx> BitDenotation<'tcx> for HaveBeenBorrowedLocals<'a, 'tcx> { type Idx = Local; fn name() -> &'static str { "has_been_borrowed_locals" } fn bits_per_block(&self) -> usize { @@ -71,11 +61,13 @@ impl<'a, 'tcx> BitDenotation for HaveBeenBorrowedLocals<'a, 'tcx> { }.visit_terminator(loc.block, self.mir[loc.block].terminator(), loc); } - fn propagate_call_return(&self, - _in_out: &mut BitSet, - _call_bb: mir::BasicBlock, - _dest_bb: mir::BasicBlock, - _dest_place: &mir::Place) { + fn propagate_call_return( + &self, + _in_out: &mut BitSet, + _call_bb: mir::BasicBlock, + _dest_bb: mir::BasicBlock, + _dest_place: &mir::Place<'tcx>, + ) { // Nothing to do when a call returns successfully } } diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index 811da9e1acc..72218e29cfd 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -1,34 +1,19 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::borrow_set::{BorrowSet, BorrowData}; use borrow_check::place_ext::PlaceExt; -use rustc; -use rustc::hir; -use rustc::hir::def_id::DefId; -use rustc::middle::region; use rustc::mir::{self, Location, Place, Mir}; use rustc::ty::TyCtxt; -use rustc::ty::{RegionKind, RegionVid}; -use rustc::ty::RegionKind::ReScope; +use rustc::ty::RegionVid; use rustc_data_structures::bit_set::{BitSet, BitSetOperator}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; -use rustc_data_structures::sync::Lrc; use dataflow::{BitDenotation, BlockSets, InitialFlow}; pub use dataflow::indexes::BorrowIndex; use borrow_check::nll::region_infer::RegionInferenceContext; use borrow_check::nll::ToRegionVid; +use borrow_check::places_conflict; use std::rc::Rc; @@ -42,8 +27,6 @@ use std::rc::Rc; pub struct Borrows<'a, 'gcx: 'tcx, 'tcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'tcx>, mir: &'a Mir<'tcx>, - scope_tree: Lrc, - root_scope: Option, borrow_set: Rc>, borrows_out_of_scope_at_location: FxHashMap>, @@ -150,18 +133,8 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> { tcx: TyCtxt<'a, 'gcx, 'tcx>, mir: &'a Mir<'tcx>, nonlexical_regioncx: Rc>, - def_id: DefId, - body_id: Option, borrow_set: &Rc>, ) -> Self { - let scope_tree = tcx.region_scope_tree(def_id); - let root_scope = body_id.map(|body_id| { - region::Scope { - id: tcx.hir.body(body_id).value.hir_id.local_id, - data: region::ScopeData::CallSite - } - }); - let mut borrows_out_of_scope_at_location = FxHashMap::default(); for (borrow_index, borrow_data) in borrow_set.borrows.iter_enumerated() { let borrow_region = borrow_data.region.to_region_vid(); @@ -177,8 +150,6 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> { mir: mir, borrow_set: borrow_set.clone(), borrows_out_of_scope_at_location, - scope_tree, - root_scope, _nonlexical_regioncx: nonlexical_regioncx, } } @@ -190,8 +161,7 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> { } /// Add all borrows to the kill set, if those borrows are out of scope at `location`. - /// That means either they went out of either a nonlexical scope, if we care about those - /// at the moment, or the location represents a lexical EndRegion + /// That means they went out of a nonlexical scope fn kill_loans_out_of_scope_at_location(&self, sets: &mut BlockSets, location: Location) { @@ -211,17 +181,55 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> { } } - fn kill_borrows_on_local(&self, - sets: &mut BlockSets, - local: &rustc::mir::Local) - { - if let Some(borrow_indexes) = self.borrow_set.local_map.get(local) { - sets.kill_all(borrow_indexes); + /// Kill any borrows that conflict with `place`. + fn kill_borrows_on_place( + &self, + sets: &mut BlockSets, + place: &Place<'tcx> + ) { + debug!("kill_borrows_on_place: place={:?}", place); + // Handle the `Place::Local(..)` case first and exit early. + if let Place::Local(local) = place { + if let Some(borrow_indices) = self.borrow_set.local_map.get(&local) { + debug!("kill_borrows_on_place: borrow_indices={:?}", borrow_indices); + sets.kill_all(borrow_indices); + return; + } + } + + // Otherwise, look at all borrows that are live and if they conflict with the assignment + // into our place then we can kill them. + let mut borrows = sets.on_entry.clone(); + let _ = borrows.union(sets.gen_set); + for borrow_index in borrows.iter() { + let borrow_data = &self.borrows()[borrow_index]; + debug!( + "kill_borrows_on_place: borrow_index={:?} borrow_data={:?}", + borrow_index, borrow_data, + ); + + // By passing `PlaceConflictBias::NoOverlap`, we conservatively assume that any given + // pair of array indices are unequal, so that when `places_conflict` returns true, we + // will be assured that two places being compared definitely denotes the same sets of + // locations. + if places_conflict::places_conflict( + self.tcx, + self.mir, + &borrow_data.borrowed_place, + place, + places_conflict::PlaceConflictBias::NoOverlap, + ) { + debug!( + "kill_borrows_on_place: (kill) borrow_index={:?} borrow_data={:?}", + borrow_index, borrow_data, + ); + sets.kill(borrow_index); + } } } } -impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for Borrows<'a, 'gcx, 'tcx> { type Idx = BorrowIndex; fn name() -> &'static str { "borrows" } fn bits_per_block(&self) -> usize { @@ -242,7 +250,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> { } fn statement_effect(&self, sets: &mut BlockSets, location: Location) { - debug!("Borrows::statement_effect sets: {:?} location: {:?}", sets, location); + debug!("Borrows::statement_effect: sets={:?} location={:?}", sets, location); let block = &self.mir.basic_blocks().get(location.block).unwrap_or_else(|| { panic!("could not find block at location {:?}", location); @@ -251,25 +259,14 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> { panic!("could not find statement at location {:?}"); }); + debug!("Borrows::statement_effect: stmt={:?}", stmt); match stmt.kind { - mir::StatementKind::EndRegion(_) => { - } - mir::StatementKind::Assign(ref lhs, ref rhs) => { // Make sure there are no remaining borrows for variables // that are assigned over. - if let Place::Local(ref local) = *lhs { - // FIXME: Handle the case in which we're assigning over - // a projection (`foo.bar`). - self.kill_borrows_on_local(sets, local); - } - - // NOTE: if/when the Assign case is revised to inspect - // the assigned_place here, make sure to also - // re-consider the current implementations of the - // propagate_call_return method. + self.kill_borrows_on_place(sets, lhs); - if let mir::Rvalue::Ref(region, _, ref place) = **rhs { + if let mir::Rvalue::Ref(_, _, ref place) = **rhs { if place.ignore_borrow( self.tcx, self.mir, @@ -281,56 +278,20 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> { panic!("could not find BorrowIndex for location {:?}", location); }); - if let RegionKind::ReEmpty = region { - // If the borrowed value dies before the borrow is used, the region for - // the borrow can be empty. Don't track the borrow in that case. - debug!("Borrows::statement_effect_on_borrows \ - location: {:?} stmt: {:?} has empty region, killing {:?}", - location, stmt.kind, index); - sets.kill(*index); - return - } else { - debug!("Borrows::statement_effect_on_borrows location: {:?} stmt: {:?}", - location, stmt.kind); - } - - assert!(self.borrow_set.region_map.get(region).unwrap_or_else(|| { - panic!("could not find BorrowIndexs for region {:?}", region); - }).contains(&index)); sets.gen(*index); - - // Issue #46746: Two-phase borrows handles - // stmts of form `Tmp = &mut Borrow` ... - match lhs { - Place::Promoted(_) | - Place::Local(..) | Place::Static(..) => {} // okay - Place::Projection(..) => { - // ... can assign into projections, - // e.g. `box (&mut _)`. Current - // conservative solution: force - // immediate activation here. - sets.gen(*index); - } - } } } mir::StatementKind::StorageDead(local) => { // Make sure there are no remaining borrows for locals that // are gone out of scope. - self.kill_borrows_on_local(sets, &local) + self.kill_borrows_on_place(sets, &Place::Local(local)); } mir::StatementKind::InlineAsm { ref outputs, ref asm, .. } => { for (output, kind) in outputs.iter().zip(&asm.outputs) { if !kind.is_indirect && !kind.is_rw { - // Make sure there are no remaining borrows for direct - // output variables. - if let Place::Local(ref local) = *output { - // FIXME: Handle the case in which we're assigning over - // a projection (`foo.bar`). - self.kill_borrows_on_local(sets, local); - } + self.kill_borrows_on_place(sets, output); } } } @@ -339,7 +300,6 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> { mir::StatementKind::SetDiscriminant { .. } | mir::StatementKind::StorageLive(..) | mir::StatementKind::Retag { .. } | - mir::StatementKind::EscapeToRaw { .. } | mir::StatementKind::AscribeUserType(..) | mir::StatementKind::Nop => {} @@ -353,63 +313,15 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> { self.kill_loans_out_of_scope_at_location(sets, location); } - fn terminator_effect(&self, sets: &mut BlockSets, location: Location) { - debug!("Borrows::terminator_effect sets: {:?} location: {:?}", sets, location); - - let block = &self.mir.basic_blocks().get(location.block).unwrap_or_else(|| { - panic!("could not find block at location {:?}", location); - }); + fn terminator_effect(&self, _: &mut BlockSets, _: Location) {} - let term = block.terminator(); - match term.kind { - mir::TerminatorKind::Resume | - mir::TerminatorKind::Return | - mir::TerminatorKind::GeneratorDrop => { - // When we return from the function, then all `ReScope`-style regions - // are guaranteed to have ended. - // Normally, there would be `EndRegion` statements that come before, - // and hence most of these loans will already be dead -- but, in some cases - // like unwind paths, we do not always emit `EndRegion` statements, so we - // add some kills here as a "backup" and to avoid spurious error messages. - for (borrow_index, borrow_data) in self.borrow_set.borrows.iter_enumerated() { - if let ReScope(scope) = borrow_data.region { - // Check that the scope is not actually a scope from a function that is - // a parent of our closure. Note that the CallSite scope itself is - // *outside* of the closure, for some weird reason. - if let Some(root_scope) = self.root_scope { - if *scope != root_scope && - self.scope_tree.is_subscope_of(*scope, root_scope) - { - sets.kill(borrow_index); - } - } - } - } - } - mir::TerminatorKind::Abort | - mir::TerminatorKind::SwitchInt {..} | - mir::TerminatorKind::Drop {..} | - mir::TerminatorKind::DropAndReplace {..} | - mir::TerminatorKind::Call {..} | - mir::TerminatorKind::Assert {..} | - mir::TerminatorKind::Yield {..} | - mir::TerminatorKind::Goto {..} | - mir::TerminatorKind::FalseEdges {..} | - mir::TerminatorKind::FalseUnwind {..} | - mir::TerminatorKind::Unreachable => {} - } - } - - fn propagate_call_return(&self, - _in_out: &mut BitSet, - _call_bb: mir::BasicBlock, - _dest_bb: mir::BasicBlock, - _dest_place: &mir::Place) { - // there are no effects on borrows from method call return... - // - // ... but if overwriting a place can affect flow state, then - // latter is not true; see NOTE on Assign case in - // statement_effect_on_borrows. + fn propagate_call_return( + &self, + _in_out: &mut BitSet, + _call_bb: mir::BasicBlock, + _dest_bb: mir::BasicBlock, + _dest_place: &mir::Place<'tcx>, + ) { } } @@ -426,4 +338,3 @@ impl<'a, 'gcx, 'tcx> InitialFlow for Borrows<'a, 'gcx, 'tcx> { false // bottom = nothing is reserved or activated yet } } - diff --git a/src/librustc_mir/dataflow/impls/mod.rs b/src/librustc_mir/dataflow/impls/mod.rs index efdf9c33023..1ccda3a12e4 100644 --- a/src/librustc_mir/dataflow/impls/mod.rs +++ b/src/librustc_mir/dataflow/impls/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Dataflow analyses are built upon some interpretation of the //! bitvectors attached to each basic block, represented via a //! zero-sized structure. @@ -293,7 +283,7 @@ impl<'a, 'gcx, 'tcx> DefinitelyInitializedPlaces<'a, 'gcx, 'tcx> { } } -impl<'a, 'gcx, 'tcx> BitDenotation for MaybeInitializedPlaces<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for MaybeInitializedPlaces<'a, 'gcx, 'tcx> { type Idx = MovePathIndex; fn name() -> &'static str { "maybe_init" } fn bits_per_block(&self) -> usize { @@ -331,11 +321,13 @@ impl<'a, 'gcx, 'tcx> BitDenotation for MaybeInitializedPlaces<'a, 'gcx, 'tcx> { ) } - fn propagate_call_return(&self, - in_out: &mut BitSet, - _call_bb: mir::BasicBlock, - _dest_bb: mir::BasicBlock, - dest_place: &mir::Place) { + fn propagate_call_return( + &self, + in_out: &mut BitSet, + _call_bb: mir::BasicBlock, + _dest_bb: mir::BasicBlock, + dest_place: &mir::Place<'tcx>, + ) { // when a call returns successfully, that means we need to set // the bits for that dest_place to 1 (initialized). on_lookup_result_bits(self.tcx, self.mir, self.move_data(), @@ -344,7 +336,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation for MaybeInitializedPlaces<'a, 'gcx, 'tcx> { } } -impl<'a, 'gcx, 'tcx> BitDenotation for MaybeUninitializedPlaces<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for MaybeUninitializedPlaces<'a, 'gcx, 'tcx> { type Idx = MovePathIndex; fn name() -> &'static str { "maybe_uninit" } fn bits_per_block(&self) -> usize { @@ -387,11 +379,13 @@ impl<'a, 'gcx, 'tcx> BitDenotation for MaybeUninitializedPlaces<'a, 'gcx, 'tcx> ) } - fn propagate_call_return(&self, - in_out: &mut BitSet, - _call_bb: mir::BasicBlock, - _dest_bb: mir::BasicBlock, - dest_place: &mir::Place) { + fn propagate_call_return( + &self, + in_out: &mut BitSet, + _call_bb: mir::BasicBlock, + _dest_bb: mir::BasicBlock, + dest_place: &mir::Place<'tcx>, + ) { // when a call returns successfully, that means we need to set // the bits for that dest_place to 0 (initialized). on_lookup_result_bits(self.tcx, self.mir, self.move_data(), @@ -400,7 +394,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation for MaybeUninitializedPlaces<'a, 'gcx, 'tcx> } } -impl<'a, 'gcx, 'tcx> BitDenotation for DefinitelyInitializedPlaces<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for DefinitelyInitializedPlaces<'a, 'gcx, 'tcx> { type Idx = MovePathIndex; fn name() -> &'static str { "definite_init" } fn bits_per_block(&self) -> usize { @@ -441,11 +435,13 @@ impl<'a, 'gcx, 'tcx> BitDenotation for DefinitelyInitializedPlaces<'a, 'gcx, 'tc ) } - fn propagate_call_return(&self, - in_out: &mut BitSet, - _call_bb: mir::BasicBlock, - _dest_bb: mir::BasicBlock, - dest_place: &mir::Place) { + fn propagate_call_return( + &self, + in_out: &mut BitSet, + _call_bb: mir::BasicBlock, + _dest_bb: mir::BasicBlock, + dest_place: &mir::Place<'tcx>, + ) { // when a call returns successfully, that means we need to set // the bits for that dest_place to 1 (initialized). on_lookup_result_bits(self.tcx, self.mir, self.move_data(), @@ -454,7 +450,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation for DefinitelyInitializedPlaces<'a, 'gcx, 'tc } } -impl<'a, 'gcx, 'tcx> BitDenotation for EverInitializedPlaces<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for EverInitializedPlaces<'a, 'gcx, 'tcx> { type Idx = InitIndex; fn name() -> &'static str { "ever_init" } fn bits_per_block(&self) -> usize { @@ -488,7 +484,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation for EverInitializedPlaces<'a, 'gcx, 'tcx> { // // FIXME(#46525): We *need* to do this for StorageLive as well as // StorageDead, because lifetimes of match bindings with guards are - // weird - i.e. this code + // weird - i.e., this code // // ``` // fn main() { @@ -530,11 +526,13 @@ impl<'a, 'gcx, 'tcx> BitDenotation for EverInitializedPlaces<'a, 'gcx, 'tcx> { ); } - fn propagate_call_return(&self, - in_out: &mut BitSet, - call_bb: mir::BasicBlock, - _dest_bb: mir::BasicBlock, - _dest_place: &mir::Place) { + fn propagate_call_return( + &self, + in_out: &mut BitSet, + call_bb: mir::BasicBlock, + _dest_bb: mir::BasicBlock, + _dest_place: &mir::Place<'tcx>, + ) { let move_data = self.move_data(); let bits_per_block = self.bits_per_block(); let init_loc_map = &move_data.init_loc_map; diff --git a/src/librustc_mir/dataflow/impls/storage_liveness.rs b/src/librustc_mir/dataflow/impls/storage_liveness.rs index c8faa34df8a..9c17076e6fd 100644 --- a/src/librustc_mir/dataflow/impls/storage_liveness.rs +++ b/src/librustc_mir/dataflow/impls/storage_liveness.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use super::*; use rustc::mir::*; @@ -29,7 +19,7 @@ impl<'a, 'tcx: 'a> MaybeStorageLive<'a, 'tcx> { } } -impl<'a, 'tcx> BitDenotation for MaybeStorageLive<'a, 'tcx> { +impl<'a, 'tcx> BitDenotation<'tcx> for MaybeStorageLive<'a, 'tcx> { type Idx = Local; fn name() -> &'static str { "maybe_storage_live" } fn bits_per_block(&self) -> usize { @@ -58,11 +48,13 @@ impl<'a, 'tcx> BitDenotation for MaybeStorageLive<'a, 'tcx> { // Terminators have no effect } - fn propagate_call_return(&self, - _in_out: &mut BitSet, - _call_bb: mir::BasicBlock, - _dest_bb: mir::BasicBlock, - _dest_place: &mir::Place) { + fn propagate_call_return( + &self, + _in_out: &mut BitSet, + _call_bb: mir::BasicBlock, + _dest_bb: mir::BasicBlock, + _dest_place: &mir::Place<'tcx>, + ) { // Nothing to do when a call returns successfully } } diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index c19145636e6..f09db970b73 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use syntax::ast::{self, MetaItem}; use rustc_data_structures::bit_set::{BitSet, BitSetOperator, HybridBitSet}; @@ -44,7 +34,9 @@ pub mod move_paths; pub(crate) use self::move_paths::indexes; -pub(crate) struct DataflowBuilder<'a, 'tcx: 'a, BD> where BD: BitDenotation +pub(crate) struct DataflowBuilder<'a, 'tcx: 'a, BD> +where + BD: BitDenotation<'tcx> { node_id: ast::NodeId, flow_state: DataflowAnalysis<'a, 'tcx, BD>, @@ -71,7 +63,7 @@ impl fmt::Debug for DebugFormatted { } } -pub(crate) trait Dataflow { +pub(crate) trait Dataflow<'tcx, BD: BitDenotation<'tcx>> { /// Sets up and runs the dataflow problem, using `p` to render results if /// implementation so chooses. fn dataflow

(&mut self, p: P) where P: Fn(&BD, BD::Idx) -> DebugFormatted { @@ -87,7 +79,9 @@ pub(crate) trait Dataflow { fn propagate(&mut self); } -impl<'a, 'tcx: 'a, BD> Dataflow for DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation +impl<'a, 'tcx: 'a, BD> Dataflow<'tcx, BD> for DataflowBuilder<'a, 'tcx, BD> +where + BD: BitDenotation<'tcx> { fn dataflow

(&mut self, p: P) where P: Fn(&BD, BD::Idx) -> DebugFormatted { self.flow_state.build_sets(); @@ -127,21 +121,21 @@ pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'a, 'gcx, 'tcx>, dead_unwinds: &BitSet, bd: BD, p: P) - -> DataflowResults - where BD: BitDenotation + InitialFlow, + -> DataflowResults<'tcx, BD> + where BD: BitDenotation<'tcx> + InitialFlow, P: Fn(&BD, BD::Idx) -> DebugFormatted { let flow_state = DataflowAnalysis::new(mir, dead_unwinds, bd); flow_state.run(tcx, node_id, attributes, p) } -impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation +impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx> { pub(crate) fn run

(self, tcx: TyCtxt<'a, 'gcx, 'tcx>, node_id: ast::NodeId, attributes: &[ast::Attribute], - p: P) -> DataflowResults + p: P) -> DataflowResults<'tcx, BD> where P: Fn(&BD, BD::Idx) -> DebugFormatted { let name_found = |sess: &Session, attrs: &[ast::Attribute], name| -> Option { @@ -173,12 +167,12 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitD } } -struct PropagationContext<'b, 'a: 'b, 'tcx: 'a, O> where O: 'b + BitDenotation +struct PropagationContext<'b, 'a: 'b, 'tcx: 'a, O> where O: 'b + BitDenotation<'tcx> { builder: &'b mut DataflowAnalysis<'a, 'tcx, O>, } -impl<'a, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation +impl<'a, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx> { fn propagate(&mut self) { let mut temp = BitSet::new_empty(self.flow_state.sets.bits_per_block); @@ -228,7 +222,7 @@ impl<'a, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation } } -impl<'b, 'a: 'b, 'tcx: 'a, BD> PropagationContext<'b, 'a, 'tcx, BD> where BD: BitDenotation +impl<'b, 'a: 'b, 'tcx: 'a, BD> PropagationContext<'b, 'a, 'tcx, BD> where BD: BitDenotation<'tcx> { fn walk_cfg(&mut self, in_out: &mut BitSet) { let mut dirty_queue: WorkQueue = @@ -259,7 +253,7 @@ fn dataflow_path(context: &str, path: &str) -> PathBuf { path } -impl<'a, 'tcx: 'a, BD> DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation +impl<'a, 'tcx: 'a, BD> DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation<'tcx> { fn pre_dataflow_instrumentation

(&self, p: P) -> io::Result<()> where P: Fn(&BD, BD::Idx) -> DebugFormatted @@ -290,7 +284,7 @@ impl<'a, 'tcx: 'a, BD> DataflowBuilder<'a, 'tcx, BD> where BD: BitDenotation /// It abstracts over the FlowState and also completely hides the /// underlying flow analysis results, because it needs to handle cases /// where we are combining the results of *multiple* flow analyses -/// (e.g. borrows + inits + uninits). +/// (e.g., borrows + inits + uninits). pub(crate) trait DataflowResultsConsumer<'a, 'tcx: 'a> { type FlowState: FlowsAtLocation; @@ -347,10 +341,10 @@ pub(crate) trait DataflowResultsConsumer<'a, 'tcx: 'a> { fn mir(&self) -> &'a Mir<'tcx>; } -pub fn state_for_location<'tcx, T: BitDenotation>(loc: Location, - analysis: &T, - result: &DataflowResults, - mir: &Mir<'tcx>) +pub fn state_for_location<'tcx, T: BitDenotation<'tcx>>(loc: Location, + analysis: &T, + result: &DataflowResults<'tcx, T>, + mir: &Mir<'tcx>) -> BitSet { let mut on_entry = result.sets().on_entry_set_for(loc.block.index()).to_owned(); let mut kill_set = on_entry.to_hybrid(); @@ -381,25 +375,25 @@ pub fn state_for_location<'tcx, T: BitDenotation>(loc: Location, gen_set.to_dense() } -pub struct DataflowAnalysis<'a, 'tcx: 'a, O> where O: BitDenotation +pub struct DataflowAnalysis<'a, 'tcx: 'a, O> where O: BitDenotation<'tcx> { - flow_state: DataflowState, + flow_state: DataflowState<'tcx, O>, dead_unwinds: &'a BitSet, mir: &'a Mir<'tcx>, } -impl<'a, 'tcx: 'a, O> DataflowAnalysis<'a, 'tcx, O> where O: BitDenotation +impl<'a, 'tcx: 'a, O> DataflowAnalysis<'a, 'tcx, O> where O: BitDenotation<'tcx> { - pub fn results(self) -> DataflowResults { + pub fn results(self) -> DataflowResults<'tcx, O> { DataflowResults(self.flow_state) } pub fn mir(&self) -> &'a Mir<'tcx> { self.mir } } -pub struct DataflowResults(pub(crate) DataflowState) where O: BitDenotation; +pub struct DataflowResults<'tcx, O>(pub(crate) DataflowState<'tcx, O>) where O: BitDenotation<'tcx>; -impl DataflowResults { +impl<'tcx, O: BitDenotation<'tcx>> DataflowResults<'tcx, O> { pub fn sets(&self) -> &AllSets { &self.0.sets } @@ -411,7 +405,7 @@ impl DataflowResults { /// State of a dataflow analysis; couples a collection of bit sets /// with operator used to initialize and merge bits during analysis. -pub struct DataflowState +pub struct DataflowState<'tcx, O: BitDenotation<'tcx>> { /// All the sets for the analysis. (Factored into its /// own structure so that we can borrow it mutably @@ -422,7 +416,7 @@ pub struct DataflowState pub(crate) operator: O, } -impl DataflowState { +impl<'tcx, O: BitDenotation<'tcx>> DataflowState<'tcx, O> { pub(crate) fn interpret_set<'c, P>(&self, o: &'c O, set: &BitSet, @@ -553,7 +547,7 @@ impl AllSets { /// Parameterization for the precise form of data flow that is used. /// `InitialFlow` handles initializing the bitvectors before any /// code is inspected by the analysis. Analyses that need more nuanced -/// initialization (e.g. they need to consult the results of some other +/// initialization (e.g., they need to consult the results of some other /// dataflow analysis to set up the initial bitvectors) should not /// implement this. pub trait InitialFlow { @@ -561,7 +555,7 @@ pub trait InitialFlow { fn bottom_value() -> bool; } -pub trait BitDenotation: BitSetOperator { +pub trait BitDenotation<'tcx>: BitSetOperator { /// Specifies what index type is used to access the bitvector. type Idx: Idx; @@ -592,7 +586,7 @@ pub trait BitDenotation: BitSetOperator { /// A name describing the dataflow analysis that this /// BitDenotation is supporting. The name should be something - /// suitable for plugging in as part of a filename e.g. avoid + /// suitable for plugging in as part of a filename e.g., avoid /// space-characters or other things that tend to look bad on a /// file system, like slashes or periods. It is also better for /// the name to be reasonably short, again because it will be @@ -687,14 +681,16 @@ pub trait BitDenotation: BitSetOperator { /// be better to represent this as an additional gen- and /// kill-sets associated with each edge coming out of the basic /// block. - fn propagate_call_return(&self, - in_out: &mut BitSet, - call_bb: mir::BasicBlock, - dest_bb: mir::BasicBlock, - dest_place: &mir::Place); + fn propagate_call_return( + &self, + in_out: &mut BitSet, + call_bb: mir::BasicBlock, + dest_bb: mir::BasicBlock, + dest_place: &mir::Place<'tcx>, + ); } -impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation +impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation<'tcx> { pub fn new(mir: &'a Mir<'tcx>, dead_unwinds: &'a BitSet, @@ -726,8 +722,7 @@ impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation } } -impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation -{ +impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation<'tcx> { /// Propagates the bits of `in_out` into all the successors of `bb`, /// using bitwise operator denoted by `self.operator`. /// @@ -739,12 +734,12 @@ impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation /// To reflect this, the `propagate_call_return` method of the /// `BitDenotation` mutates `in_out` when propagating `in_out` via /// a call terminator; such mutation is performed *last*, to - /// ensure its side-effects do not leak elsewhere (e.g. into + /// ensure its side-effects do not leak elsewhere (e.g., into /// unwind target). fn propagate_bits_into_graph_successors_of( &mut self, in_out: &mut BitSet, - (bb, bb_data): (mir::BasicBlock, &mir::BasicBlockData), + (bb, bb_data): (mir::BasicBlock, &mir::BasicBlockData<'tcx>), dirty_list: &mut WorkQueue) { match bb_data.terminator().kind { diff --git a/src/librustc_mir/dataflow/move_paths/abs_domain.rs b/src/librustc_mir/dataflow/move_paths/abs_domain.rs index 4d20857bc2e..ff594fd3bed 100644 --- a/src/librustc_mir/dataflow/move_paths/abs_domain.rs +++ b/src/librustc_mir/dataflow/move_paths/abs_domain.rs @@ -1,16 +1,6 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The move-analysis portion of borrowck needs to work in an abstract //! domain of lifted Places. Most of the Place variants fall into a -//! one-to-one mapping between the concrete and abstract (e.g. a +//! one-to-one mapping between the concrete and abstract (e.g., a //! field-deref on a local-variable, `x.field`, has the same meaning //! in both domains). Indexed-Projections are the exception: `a[x]` //! needs to be treated as mapping to the same move path as `a[y]` as diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index 0e2376d201f..1ae050654b4 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty::{self, TyCtxt}; use rustc::mir::*; use rustc::mir::tcx::RvalueInitializationState; @@ -128,7 +118,7 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> { proj: &PlaceProjection<'tcx>) -> Result> { - let base = try!(self.move_path_for(&proj.base)); + let base = self.move_path_for(&proj.base)?; let mir = self.builder.mir; let tcx = self.builder.tcx; let place_ty = proj.base.ty(mir, tcx).to_ty(tcx); @@ -301,9 +291,7 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> { span_bug!(stmt.source_info.span, "SetDiscriminant should not exist during borrowck"); } - StatementKind::EndRegion(..) | StatementKind::Retag { .. } | - StatementKind::EscapeToRaw { .. } | StatementKind::AscribeUserType(..) | StatementKind::Nop => {} } diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index 2a026b8f52c..d77216220ac 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use rustc::ty::{self, TyCtxt}; use rustc::mir::*; use rustc::util::nodemap::FxHashMap; diff --git a/src/librustc_mir/diagnostics.rs b/src/librustc_mir/diagnostics.rs index 56a9daf84f7..eb721754216 100644 --- a/src/librustc_mir/diagnostics.rs +++ b/src/librustc_mir/diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] register_long_diagnostics! { @@ -335,11 +325,13 @@ match Some(42) { "##, E0162: r##" +#### Note: this error code is no longer emitted by the compiler. + An if-let pattern attempts to match the pattern, and enters the body if the match was successful. If the match is irrefutable (when it cannot fail to match), use a regular `let`-binding instead. For instance: -```compile_fail,E0162 +```compile_pass struct Irrefutable(i32); let irr = Irrefutable(0); @@ -362,11 +354,13 @@ println!("{}", x); "##, E0165: r##" +#### Note: this error code is no longer emitted by the compiler. + A while-let pattern attempts to match the pattern, and enters the body if the match was successful. If the match is irrefutable (when it cannot fail to match), use a regular `let`-binding inside a `loop` instead. For instance: -```compile_fail,E0165 +```compile_pass,no_run struct Irrefutable(i32); let irr = Irrefutable(0); @@ -579,7 +573,7 @@ const Y: i32 = A; ``` "##, -// FIXME(#24111) Change the language here when const fn stabilizes +// FIXME(#57563) Change the language here when const fn stabilizes E0015: r##" The only functions that can be called in static or constant expressions are `const` functions, and struct/enum constructors. `const` functions are only @@ -606,7 +600,7 @@ static X: i32 = 1; const C: i32 = 2; // these three are not allowed: -const CR: &'static mut i32 = &mut C; +const CR: &mut i32 = &mut C; static STATIC_REF: &'static mut i32 = &mut X; static CONST_REF: &'static mut i32 = &mut C; ``` @@ -1133,9 +1127,9 @@ A borrow of a constant containing interior mutability was attempted. Erroneous code example: ```compile_fail,E0492 -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT}; +use std::sync::atomic::AtomicUsize; -const A: AtomicUsize = ATOMIC_USIZE_INIT; +const A: AtomicUsize = AtomicUsize::new(0); static B: &'static AtomicUsize = &A; // error: cannot borrow a constant which may contain interior mutability, // create a static instead @@ -1151,9 +1145,9 @@ explicitly a single memory location, which can be mutated at will. So, in order to solve this error, either use statics which are `Sync`: ``` -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT}; +use std::sync::atomic::AtomicUsize; -static A: AtomicUsize = ATOMIC_USIZE_INIT; +static A: AtomicUsize = AtomicUsize::new(0); static B: &'static AtomicUsize = &A; // ok! ``` @@ -1163,7 +1157,7 @@ You can also have this error while using a cell type: use std::cell::Cell; const A: Cell = Cell::new(1); -const B: &'static Cell = &A; +const B: &Cell = &A; // error: cannot borrow a constant which may contain interior mutability, // create a static instead @@ -1171,10 +1165,10 @@ const B: &'static Cell = &A; struct C { a: Cell } const D: C = C { a: Cell::new(1) }; -const E: &'static Cell = &D.a; // error +const E: &Cell = &D.a; // error // or: -const F: &'static C = &D; // error +const F: &C = &D; // error ``` This is because cell types do operations that are not thread-safe. Due to this, @@ -2125,14 +2119,15 @@ This error occurs because a borrow in a generator persists across a yield point. ```compile_fail,E0626 -# #![feature(generators, generator_trait)] +# #![feature(generators, generator_trait, pin)] # use std::ops::Generator; +# use std::pin::Pin; let mut b = || { let a = &String::new(); // <-- This borrow... yield (); // ...is still in scope here, when the yield occurs. println!("{}", a); }; -unsafe { b.resume() }; +Pin::new(&mut b).resume(); ``` At present, it is not permitted to have a yield that occurs while a @@ -2143,14 +2138,15 @@ resolve the previous example by removing the borrow and just storing the integer by value: ``` -# #![feature(generators, generator_trait)] +# #![feature(generators, generator_trait, pin)] # use std::ops::Generator; +# use std::pin::Pin; let mut b = || { let a = 3; yield (); println!("{}", a); }; -unsafe { b.resume() }; +Pin::new(&mut b).resume(); ``` This is a very simple case, of course. In more complex cases, we may @@ -2160,37 +2156,40 @@ in those cases, something like the `Rc` or `Arc` types may be useful. This error also frequently arises with iteration: ```compile_fail,E0626 -# #![feature(generators, generator_trait)] +# #![feature(generators, generator_trait, pin)] # use std::ops::Generator; +# use std::pin::Pin; let mut b = || { let v = vec![1,2,3]; for &x in &v { // <-- borrow of `v` is still in scope... yield x; // ...when this yield occurs. } }; -unsafe { b.resume() }; +Pin::new(&mut b).resume(); ``` Such cases can sometimes be resolved by iterating "by value" (or using `into_iter()`) to avoid borrowing: ``` -# #![feature(generators, generator_trait)] +# #![feature(generators, generator_trait, pin)] # use std::ops::Generator; +# use std::pin::Pin; let mut b = || { let v = vec![1,2,3]; for x in v { // <-- Take ownership of the values instead! yield x; // <-- Now yield is OK. } }; -unsafe { b.resume() }; +Pin::new(&mut b).resume(); ``` If taking ownership is not an option, using indices can work too: ``` -# #![feature(generators, generator_trait)] +# #![feature(generators, generator_trait, pin)] # use std::ops::Generator; +# use std::pin::Pin; let mut b = || { let v = vec![1,2,3]; let len = v.len(); // (*) @@ -2199,7 +2198,7 @@ let mut b = || { yield x; // <-- Now yield is OK. } }; -unsafe { b.resume() }; +Pin::new(&mut b).resume(); // (*) -- Unfortunately, these temporaries are currently required. // See . @@ -2344,7 +2343,7 @@ local variable that already exists, and hence no temporary is created. Temporaries are not always dropped at the end of the enclosing statement. In simple cases where the `&` expression is immediately stored into a variable, the compiler will automatically extend -the lifetime of the temporary until the end of the enclosinb +the lifetime of the temporary until the end of the enclosing block. Therefore, an alternative way to fix the original program is to write `let tmp = &foo()` and not `let tmp = foo()`: diff --git a/src/librustc_mir/hair/constant.rs b/src/librustc_mir/hair/constant.rs new file mode 100644 index 00000000000..21c471d49ee --- /dev/null +++ b/src/librustc_mir/hair/constant.rs @@ -0,0 +1,110 @@ +use syntax::ast; +use rustc::ty::{self, Ty, TyCtxt, ParamEnv}; +use syntax_pos::symbol::Symbol; +use rustc::mir::interpret::{ConstValue, Scalar}; + +#[derive(PartialEq)] +crate enum LitToConstError { + UnparseableFloat, + Reported, +} + +crate fn lit_to_const<'a, 'gcx, 'tcx>( + lit: &'tcx ast::LitKind, + tcx: TyCtxt<'a, 'gcx, 'tcx>, + ty: Ty<'tcx>, + neg: bool, +) -> Result, LitToConstError> { + use syntax::ast::*; + + let trunc = |n| { + let param_ty = ParamEnv::reveal_all().and(tcx.lift_to_global(&ty).unwrap()); + let width = tcx.layout_of(param_ty).map_err(|_| LitToConstError::Reported)?.size; + trace!("trunc {} with size {} and shift {}", n, width.bits(), 128 - width.bits()); + let shift = 128 - width.bits(); + let result = (n << shift) >> shift; + trace!("trunc result: {}", result); + Ok(ConstValue::Scalar(Scalar::Bits { + bits: result, + size: width.bytes() as u8, + })) + }; + + use rustc::mir::interpret::*; + let lit = match *lit { + LitKind::Str(ref s, _) => { + let s = s.as_str(); + let id = tcx.allocate_bytes(s.as_bytes()); + ConstValue::new_slice(Scalar::Ptr(id.into()), s.len() as u64) + }, + LitKind::Err(ref s) => { + let s = s.as_str(); + let id = tcx.allocate_bytes(s.as_bytes()); + return Ok(ty::Const { + val: ConstValue::new_slice(Scalar::Ptr(id.into()), s.len() as u64), + ty: tcx.types.err, + }); + }, + LitKind::ByteStr(ref data) => { + let id = tcx.allocate_bytes(data); + ConstValue::Scalar(Scalar::Ptr(id.into())) + }, + LitKind::Byte(n) => ConstValue::Scalar(Scalar::Bits { + bits: n as u128, + size: 1, + }), + LitKind::Int(n, _) if neg => { + let n = n as i128; + let n = n.overflowing_neg().0; + trunc(n as u128)? + }, + LitKind::Int(n, _) => trunc(n)?, + LitKind::Float(n, fty) => { + parse_float(n, fty, neg).map_err(|_| LitToConstError::UnparseableFloat)? + } + LitKind::FloatUnsuffixed(n) => { + let fty = match ty.sty { + ty::Float(fty) => fty, + _ => bug!() + }; + parse_float(n, fty, neg).map_err(|_| LitToConstError::UnparseableFloat)? + } + LitKind::Bool(b) => ConstValue::Scalar(Scalar::from_bool(b)), + LitKind::Char(c) => ConstValue::Scalar(Scalar::from_char(c)), + }; + Ok(ty::Const { val: lit, ty }) +} + +fn parse_float<'tcx>( + num: Symbol, + fty: ast::FloatTy, + neg: bool, +) -> Result, ()> { + let num = num.as_str(); + use rustc_apfloat::ieee::{Single, Double}; + use rustc_apfloat::Float; + let (bits, size) = match fty { + ast::FloatTy::F32 => { + num.parse::().map_err(|_| ())?; + let mut f = num.parse::().unwrap_or_else(|e| { + panic!("apfloat::ieee::Single failed to parse `{}`: {:?}", num, e) + }); + if neg { + f = -f; + } + (f.to_bits(), 4) + } + ast::FloatTy::F64 => { + num.parse::().map_err(|_| ())?; + let mut f = num.parse::().unwrap_or_else(|e| { + panic!("apfloat::ieee::Single failed to parse `{}`: {:?}", num, e) + }); + if neg { + f = -f; + } + (f.to_bits(), 8) + } + }; + + Ok(ConstValue::Scalar(Scalar::Bits { bits, size })) +} diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs index d56ddcb4944..c50d9ddcb15 100644 --- a/src/librustc_mir/hair/cx/block.rs +++ b/src/librustc_mir/hair/cx/block.rs @@ -1,18 +1,9 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hair::*; use hair::cx::Cx; use hair::cx::to_ref::ToRef; use rustc::middle::region; use rustc::hir; +use rustc::ty; use rustc_data_structures::indexed_vec::Idx; @@ -55,12 +46,12 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, -> Vec> { let mut result = vec![]; for (index, stmt) in stmts.iter().enumerate() { - let hir_id = cx.tcx.hir.node_to_hir_id(stmt.node.id()); + let hir_id = cx.tcx.hir().node_to_hir_id(stmt.id); let opt_dxn_ext = cx.region_scope_tree.opt_destruction_scope(hir_id.local_id); - let stmt_span = StatementSpan(cx.tcx.hir.span(stmt.node.id())); + let stmt_span = StatementSpan(cx.tcx.hir().span(stmt.id)); match stmt.node { - hir::StmtKind::Expr(ref expr, _) | - hir::StmtKind::Semi(ref expr, _) => { + hir::StmtKind::Expr(ref expr) | + hir::StmtKind::Semi(ref expr) => { result.push(StmtRef::Mirror(Box::new(Stmt { kind: StmtKind::Expr { scope: region::Scope { @@ -73,50 +64,48 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, span: stmt_span, }))) } - hir::StmtKind::Decl(ref decl, _) => { - match decl.node { - hir::DeclKind::Item(..) => { - // ignore for purposes of the MIR - } - hir::DeclKind::Local(ref local) => { - let remainder_scope = region::Scope { - id: block_id, - data: region::ScopeData::Remainder( - region::FirstStatementIndex::new(index)), - }; - - let mut pattern = cx.pattern_from_hir(&local.pat); + hir::StmtKind::Item(..) => { + // ignore for purposes of the MIR + } + hir::StmtKind::Local(ref local) => { + let remainder_scope = region::Scope { + id: block_id, + data: region::ScopeData::Remainder( + region::FirstStatementIndex::new(index)), + }; - if let Some(ty) = &local.ty { - if let Some(&user_ty) = cx.tables.user_provided_tys().get(ty.hir_id) { - pattern = Pattern { - ty: pattern.ty, - span: pattern.span, - kind: Box::new(PatternKind::AscribeUserType { - user_ty: PatternTypeProjection::from_canonical_ty(user_ty), - user_ty_span: ty.span, - subpattern: pattern - }) - }; - } - } + let mut pattern = cx.pattern_from_hir(&local.pat); - result.push(StmtRef::Mirror(Box::new(Stmt { - kind: StmtKind::Let { - remainder_scope: remainder_scope, - init_scope: region::Scope { - id: hir_id.local_id, - data: region::ScopeData::Node - }, - pattern, - initializer: local.init.to_ref(), - lint_level: cx.lint_level_of(local.id), - }, - opt_destruction_scope: opt_dxn_ext, - span: stmt_span, - }))); + if let Some(ty) = &local.ty { + if let Some(&user_ty) = cx.tables.user_provided_types().get(ty.hir_id) { + debug!("mirror_stmts: user_ty={:?}", user_ty); + pattern = Pattern { + ty: pattern.ty, + span: pattern.span, + kind: Box::new(PatternKind::AscribeUserType { + user_ty: PatternTypeProjection::from_user_type(user_ty), + user_ty_span: ty.span, + subpattern: pattern, + variance: ty::Variance::Covariant, + }) + }; } } + + result.push(StmtRef::Mirror(Box::new(Stmt { + kind: StmtKind::Let { + remainder_scope: remainder_scope, + init_scope: region::Scope { + id: hir_id.local_id, + data: region::ScopeData::Node + }, + pattern, + initializer: local.init.to_ref(), + lint_level: cx.lint_level_of(local.id), + }, + opt_destruction_scope: opt_dxn_ext, + span: stmt_span, + }))); } } } diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 2e9edf20c57..8d64c9e9ada 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hair::*; use rustc_data_structures::indexed_vec::Idx; use hair::cx::Cx; @@ -21,7 +11,7 @@ use rustc::ty::adjustment::{Adjustment, Adjust, AutoBorrow, AutoBorrowMutability use rustc::ty::cast::CastKind as TyCastKind; use rustc::hir; use rustc::hir::def_id::LocalDefId; -use rustc::mir::{BorrowKind}; +use rustc::mir::BorrowKind; use syntax_pos::Span; impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr { @@ -134,7 +124,6 @@ fn apply_adjustment<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }), span, kind: ExprKind::Borrow { - region: deref.region, borrow_kind: deref.mutbl.to_borrow_kind(), arg: expr.to_ref(), }, @@ -142,32 +131,24 @@ fn apply_adjustment<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, overloaded_place(cx, hir_expr, adjustment.target, Some(call), vec![expr.to_ref()]) } - Adjust::Borrow(AutoBorrow::Ref(r, m)) => { + Adjust::Borrow(AutoBorrow::Ref(_, m)) => { ExprKind::Borrow { - region: r, borrow_kind: m.to_borrow_kind(), arg: expr.to_ref(), } } Adjust::Borrow(AutoBorrow::RawPtr(m)) => { // Convert this to a suitable `&foo` and - // then an unsafe coercion. Limit the region to be just this - // expression. - let region = ty::ReScope(region::Scope { - id: hir_expr.hir_id.local_id, - data: region::ScopeData::Node - }); - let region = cx.tcx.mk_region(region); + // then an unsafe coercion. expr = Expr { temp_lifetime, - ty: cx.tcx.mk_ref(region, + ty: cx.tcx.mk_ref(cx.tcx.types.re_erased, ty::TypeAndMut { ty: expr.ty, mutbl: m, }), span, kind: ExprKind::Borrow { - region, borrow_kind: m.to_borrow_kind(), arg: expr.to_ref(), }, @@ -181,7 +162,7 @@ fn apply_adjustment<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, // To ensure that both implicit and explicit coercions are // handled the same way, we insert an extra layer of indirection here. - // For explicit casts (e.g. 'foo as *const T'), the source of the 'Use' + // For explicit casts (e.g., 'foo as *const T'), the source of the 'Use' // will be an ExprKind::Hair with the appropriate cast expression. Here, // we make our Use source the generated Cast from the original coercion. // @@ -293,9 +274,16 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }; if let Some((adt_def, index)) = adt_data { let substs = cx.tables().node_substs(fun.hir_id); - - let user_ty = cx.tables().user_substs(fun.hir_id) - .map(|user_substs| UserTypeAnnotation::TypeOf(adt_def.did, user_substs)); + let user_provided_types = cx.tables().user_provided_types(); + let user_ty = user_provided_types.get(fun.hir_id) + .map(|u_ty| *u_ty) + .map(|mut u_ty| { + if let UserType::TypeOf(ref mut did, _) = &mut u_ty.value { + *did = adt_def.did; + } + u_ty + }); + debug!("make_mirror_unadjusted: (call) user_ty={:?}", user_ty); let field_refs = args.iter() .enumerate() @@ -326,12 +314,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, } hir::ExprKind::AddrOf(mutbl, ref expr) => { - let region = match expr_ty.sty { - ty::Ref(r, _, _) => r, - _ => span_bug!(expr.span, "type of & not region"), - }; ExprKind::Borrow { - region, borrow_kind: mutbl.to_borrow_kind(), arg: expr.to_ref(), } @@ -359,7 +342,9 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, } hir::ExprKind::Lit(ref lit) => ExprKind::Literal { - literal: cx.const_eval_literal(&lit.node, expr_ty, lit.span, false), + literal: cx.tcx.intern_lazy_const(ty::LazyConst::Evaluated( + cx.const_eval_literal(&lit.node, expr_ty, lit.span, false) + )), user_ty: None, }, @@ -372,6 +357,10 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, // FIXME(eddyb) use logical ops in constants when // they can handle that kind of control-flow. (hir::BinOpKind::And, hir::Constness::Const) => { + cx.control_flow_destroyed.push(( + op.span, + "`&&` operator".into(), + )); ExprKind::Binary { op: BinOp::BitAnd, lhs: lhs.to_ref(), @@ -379,6 +368,10 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, } } (hir::BinOpKind::Or, hir::Constness::Const) => { + cx.control_flow_destroyed.push(( + op.span, + "`||` operator".into(), + )); ExprKind::Binary { op: BinOp::BitOr, lhs: lhs.to_ref(), @@ -449,7 +442,9 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, } else { if let hir::ExprKind::Lit(ref lit) = arg.node { ExprKind::Literal { - literal: cx.const_eval_literal(&lit.node, expr_ty, lit.span, true), + literal: cx.tcx.intern_lazy_const(ty::LazyConst::Evaluated( + cx.const_eval_literal(&lit.node, expr_ty, lit.span, true) + )), user_ty: None, } } else { @@ -466,11 +461,14 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ty::Adt(adt, substs) => { match adt.adt_kind() { AdtKind::Struct | AdtKind::Union => { + let user_provided_types = cx.tables().user_provided_types(); + let user_ty = user_provided_types.get(expr.hir_id).map(|u_ty| *u_ty); + debug!("make_mirror_unadjusted: (struct/union) user_ty={:?}", user_ty); ExprKind::Adt { adt_def: adt, variant_index: VariantIdx::new(0), substs, - user_ty: cx.user_substs_applied_to_adt(expr.hir_id, adt), + user_ty, fields: field_refs(cx, fields), base: base.as_ref().map(|base| { FruInfo { @@ -483,20 +481,24 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, } } AdtKind::Enum => { - let def = match *qpath { - hir::QPath::Resolved(_, ref path) => path.def, - hir::QPath::TypeRelative(..) => Def::Err, - }; + let def = cx.tables().qpath_def(qpath, expr.hir_id); match def { Def::Variant(variant_id) => { assert!(base.is_none()); let index = adt.variant_index_with_id(variant_id); + let user_provided_types = cx.tables().user_provided_types(); + let user_ty = user_provided_types.get(expr.hir_id) + .map(|u_ty| *u_ty); + debug!( + "make_mirror_unadjusted: (variant) user_ty={:?}", + user_ty + ); ExprKind::Adt { adt_def: adt, variant_index: index, substs, - user_ty: cx.user_substs_applied_to_adt(expr.hir_id, adt), + user_ty, fields: field_refs(cx, fields), base: None, } @@ -556,7 +558,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, // Now comes the rote stuff: hir::ExprKind::Repeat(ref v, ref count) => { - let def_id = cx.tcx.hir.local_def_id(count.id); + let def_id = cx.tcx.hir().local_def_id(count.id); let substs = Substs::identity_for_item(cx.tcx.global_tcx(), def_id); let instance = ty::Instance::resolve( cx.tcx.global_tcx(), @@ -588,7 +590,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, match dest.target_id { Ok(target_id) => ExprKind::Break { label: region::Scope { - id: cx.tcx.hir.node_to_hir_id(target_id).local_id, + id: cx.tcx.hir().node_to_hir_id(target_id).local_id, data: region::ScopeData::Node }, value: value.to_ref(), @@ -600,7 +602,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, match dest.target_id { Ok(loop_id) => ExprKind::Continue { label: region::Scope { - id: cx.tcx.hir.node_to_hir_id(loop_id).local_id, + id: cx.tcx.hir().node_to_hir_id(loop_id).local_id, data: region::ScopeData::Node }, }, @@ -640,8 +642,8 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, } hir::ExprKind::Cast(ref source, ref cast_ty) => { // Check for a user-given type annotation on this `cast` - let user_ty = cx.tables.user_provided_tys().get(cast_ty.hir_id) - .map(|&t| UserTypeAnnotation::Ty(t)); + let user_provided_types = cx.tables.user_provided_types(); + let user_ty = user_provided_types.get(cast_ty.hir_id); debug!( "cast({:?}) has ty w/ hir_id {:?} and user provided ty {:?}", @@ -699,24 +701,22 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, temp_lifetime, ty: var_ty, span: expr.span, - kind: ExprKind::Literal { literal, user_ty: None }, + kind: ExprKind::Literal { + literal: cx.tcx.intern_lazy_const(literal), + user_ty: None + }, }.to_ref(); - let offset = mk_const(ty::Const::from_bits( + let offset = mk_const(ty::LazyConst::Evaluated(ty::Const::from_bits( cx.tcx, offset as u128, cx.param_env.and(var_ty), - )); + ))); match did { Some(did) => { // in case we are offsetting from a computed discriminant // and not the beginning of discriminants (which is always `0`) let substs = Substs::identity_for_item(cx.tcx(), did); - let lhs = mk_const(ty::Const::unevaluated( - cx.tcx(), - did, - substs, - var_ty, - )); + let lhs = mk_const(ty::LazyConst::Unevaluated(did, substs)); let bin = ExprKind::Binary { op: BinOp::Add, lhs, @@ -747,20 +747,20 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, span: expr.span, kind: cast, }; + debug!("make_mirror_unadjusted: (cast) user_ty={:?}", user_ty); ExprKind::ValueTypeAscription { source: cast_expr.to_ref(), - user_ty: Some(user_ty), + user_ty: Some(*user_ty), } } else { cast } } hir::ExprKind::Type(ref source, ref ty) => { - let user_provided_tys = cx.tables.user_provided_tys(); - let user_ty = user_provided_tys - .get(ty.hir_id) - .map(|&c_ty| UserTypeAnnotation::Ty(c_ty)); + let user_provided_types = cx.tables.user_provided_types(); + let user_ty = user_provided_types.get(ty.hir_id).map(|u_ty| *u_ty); + debug!("make_mirror_unadjusted: (type) user_ty={:?}", user_ty); if source.is_place_expr() { ExprKind::PlaceTypeAscription { source: source.to_ref(), @@ -782,6 +782,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, hir::ExprKind::Tup(ref fields) => ExprKind::Tuple { fields: fields.to_ref() }, hir::ExprKind::Yield(ref v) => ExprKind::Yield { value: v.to_ref() }, + hir::ExprKind::Err => unreachable!(), }; Expr { @@ -796,8 +797,9 @@ fn user_substs_applied_to_def( cx: &mut Cx<'a, 'gcx, 'tcx>, hir_id: hir::HirId, def: &Def, -) -> Option> { - match def { +) -> Option> { + debug!("user_substs_applied_to_def: def={:?}", def); + let user_provided_type = match def { // A reference to something callable -- e.g., a fn, method, or // a tuple-struct or tuple-variant. This has the type of a // `Fn` but with the user-given substitutions. @@ -806,8 +808,7 @@ fn user_substs_applied_to_def( Def::StructCtor(_, CtorKind::Fn) | Def::VariantCtor(_, CtorKind::Fn) | Def::Const(_) | - Def::AssociatedConst(_) => - Some(UserTypeAnnotation::TypeOf(def.def_id(), cx.tables().user_substs(hir_id)?)), + Def::AssociatedConst(_) => cx.tables().user_provided_types().get(hir_id).map(|u_ty| *u_ty), // A unit struct/variant which is used as a value (e.g., // `None`). This has the type of the enum/struct that defines @@ -823,7 +824,9 @@ fn user_substs_applied_to_def( _ => bug!("user_substs_applied_to_def: unexpected def {:?} at {:?}", def, hir_id) - } + }; + debug!("user_substs_applied_to_def: user_provided_type={:?}", user_provided_type); + user_provided_type } fn method_callee<'a, 'gcx, 'tcx>( @@ -843,6 +846,7 @@ fn method_callee<'a, 'gcx, 'tcx>( span_bug!(expr.span, "no type-dependent def for method callee") }); let user_ty = user_substs_applied_to_def(cx, expr.hir_id, def); + debug!("method_callee: user_ty={:?}", user_ty); (def.def_id(), cx.tables().node_substs(expr.hir_id), user_ty) } }; @@ -852,7 +856,9 @@ fn method_callee<'a, 'gcx, 'tcx>( ty, span, kind: ExprKind::Literal { - literal: ty::Const::zero_sized(cx.tcx(), ty), + literal: cx.tcx().intern_lazy_const(ty::LazyConst::Evaluated( + ty::Const::zero_sized(ty) + )), user_ty, }, } @@ -910,11 +916,11 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, Def::VariantCtor(_, CtorKind::Fn) | Def::SelfCtor(..) => { let user_ty = user_substs_applied_to_def(cx, expr.hir_id, &def); + debug!("convert_path_expr: user_ty={:?}", user_ty); ExprKind::Literal { - literal: ty::Const::zero_sized( - cx.tcx, + literal: cx.tcx.intern_lazy_const(ty::LazyConst::Evaluated(ty::Const::zero_sized( cx.tables().node_id_to_type(expr.hir_id), - ), + ))), user_ty, } }, @@ -922,19 +928,18 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, Def::Const(def_id) | Def::AssociatedConst(def_id) => { let user_ty = user_substs_applied_to_def(cx, expr.hir_id, &def); + debug!("convert_path_expr: (const) user_ty={:?}", user_ty); ExprKind::Literal { - literal: ty::Const::unevaluated( - cx.tcx, - def_id, - substs, - cx.tables().node_id_to_type(expr.hir_id), - ), + literal: cx.tcx.intern_lazy_const(ty::LazyConst::Unevaluated(def_id, substs)), user_ty, } }, Def::StructCtor(def_id, CtorKind::Const) | Def::VariantCtor(def_id, CtorKind::Const) => { + let user_provided_types = cx.tables.user_provided_types(); + let user_provided_type = user_provided_types.get(expr.hir_id).map(|u_ty| *u_ty); + debug!("convert_path_expr: user_provided_type={:?}", user_provided_type); match cx.tables().node_id_to_type(expr.hir_id).sty { // A unit struct/variant which is used as a value. // We return a completely different ExprKind here to account for this special case. @@ -943,7 +948,7 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, adt_def, variant_index: adt_def.variant_index_with_id(def_id), substs, - user_ty: cx.user_substs_applied_to_adt(expr.hir_id, adt_def), + user_ty: user_provided_type, fields: vec![], base: None, } @@ -974,17 +979,17 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, var_id, index, closure_expr_id); - let var_hir_id = cx.tcx.hir.node_to_hir_id(var_id); + let var_hir_id = cx.tcx.hir().node_to_hir_id(var_id); let var_ty = cx.tables().node_id_to_type(var_hir_id); // FIXME free regions in closures are not right let closure_ty = cx.tables() - .node_id_to_type(cx.tcx.hir.node_to_hir_id(closure_expr_id)); + .node_id_to_type(cx.tcx.hir().node_to_hir_id(closure_expr_id)); // FIXME we're just hard-coding the idea that the // signature will be &self or &mut self and hence will // have a bound region with number 0 - let closure_def_id = cx.tcx.hir.local_def_id(closure_expr_id); + let closure_def_id = cx.tcx.hir().local_def_id(closure_expr_id); let region = ty::ReFree(ty::FreeRegion { scope: closure_def_id, bound_region: ty::BoundRegion::BrAnon(0), @@ -1176,10 +1181,10 @@ fn capture_freevar<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, freevar: &hir::Freevar, freevar_ty: Ty<'tcx>) -> ExprRef<'tcx> { - let var_hir_id = cx.tcx.hir.node_to_hir_id(freevar.var_id()); + let var_hir_id = cx.tcx.hir().node_to_hir_id(freevar.var_id()); let upvar_id = ty::UpvarId { var_path: ty::UpvarPath { hir_id: var_hir_id }, - closure_expr_id: cx.tcx.hir.local_def_id(closure_expr.id).to_local(), + closure_expr_id: cx.tcx.hir().local_def_id(closure_expr.id).to_local(), }; let upvar_capture = cx.tables().upvar_capture(upvar_id); let temp_lifetime = cx.region_scope_tree.temporary_scope(closure_expr.hir_id.local_id); @@ -1203,7 +1208,6 @@ fn capture_freevar<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ty: freevar_ty, span: closure_expr.span, kind: ExprKind::Borrow { - region: upvar_borrow.region, borrow_kind, arg: captured_var.to_ref(), }, @@ -1212,7 +1216,7 @@ fn capture_freevar<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, } } -/// Converts a list of named fields (i.e. for struct-like struct/enum ADTs) into FieldExprRef. +/// Converts a list of named fields (i.e., for struct-like struct/enum ADTs) into FieldExprRef. fn field_refs<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, fields: &'tcx [hir::Field]) -> Vec> { diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index 733580b3ce2..f514cac6326 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains the code to convert from the wacky tcx data //! structures into the hair. The `builder` is generally ignorant of //! the tcx etc, and instead goes through the `Cx` for most of its @@ -26,12 +16,12 @@ use rustc::ty::subst::Subst; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::subst::{Kind, Substs}; use rustc::ty::layout::VariantIdx; -use syntax::ast::{self, LitKind}; +use syntax::ast; use syntax::attr; use syntax::symbol::Symbol; use rustc::hir; use rustc_data_structures::sync::Lrc; -use hair::pattern::parse_float; +use hair::constant::{lit_to_const, LitToConstError}; #[derive(Clone)] pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { @@ -56,22 +46,26 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { /// True if this constant/function needs overflow checks. check_overflow: bool, + + /// See field with the same name on `Mir` + control_flow_destroyed: Vec<(Span, String)>, } impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, src_id: ast::NodeId) -> Cx<'a, 'gcx, 'tcx> { let tcx = infcx.tcx; - let src_def_id = tcx.hir.local_def_id(src_id); - let body_owner_kind = tcx.hir.body_owner_kind(src_id); + let src_def_id = tcx.hir().local_def_id(src_id); + let body_owner_kind = tcx.hir().body_owner_kind(src_id); let constness = match body_owner_kind { hir::BodyOwnerKind::Const | hir::BodyOwnerKind::Static(_) => hir::Constness::Const, + hir::BodyOwnerKind::Closure | hir::BodyOwnerKind::Fn => hir::Constness::NotConst, }; - let attrs = tcx.hir.attrs(src_id); + let attrs = tcx.hir().attrs(src_id); // Some functions always have overflow checks enabled, // however, they may not get codegen'd, depending on @@ -96,9 +90,13 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { constness, body_owner_kind, check_overflow, + control_flow_destroyed: Vec::new(), } } + pub fn control_flow_destroyed(self) -> Vec<(Span, String)> { + self.control_flow_destroyed + } } impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { @@ -111,8 +109,8 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { self.tcx.types.usize } - pub fn usize_literal(&mut self, value: u64) -> &'tcx ty::Const<'tcx> { - ty::Const::from_usize(self.tcx, value) + pub fn usize_literal(&mut self, value: u64) -> &'tcx ty::LazyConst<'tcx> { + self.tcx.intern_lazy_const(ty::LazyConst::Evaluated(ty::Const::from_usize(self.tcx, value))) } pub fn bool_ty(&mut self) -> Ty<'tcx> { @@ -123,84 +121,41 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { self.tcx.mk_unit() } - pub fn true_literal(&mut self) -> &'tcx ty::Const<'tcx> { - ty::Const::from_bool(self.tcx, true) + pub fn true_literal(&mut self) -> &'tcx ty::LazyConst<'tcx> { + self.tcx.intern_lazy_const(ty::LazyConst::Evaluated(ty::Const::from_bool(self.tcx, true))) } - pub fn false_literal(&mut self) -> &'tcx ty::Const<'tcx> { - ty::Const::from_bool(self.tcx, false) + pub fn false_literal(&mut self) -> &'tcx ty::LazyConst<'tcx> { + self.tcx.intern_lazy_const(ty::LazyConst::Evaluated(ty::Const::from_bool(self.tcx, false))) } - // FIXME: Combine with rustc_mir::hair::pattern::lit_to_const pub fn const_eval_literal( &mut self, lit: &'tcx ast::LitKind, ty: Ty<'tcx>, sp: Span, neg: bool, - ) -> &'tcx ty::Const<'tcx> { + ) -> ty::Const<'tcx> { trace!("const_eval_literal: {:#?}, {:?}, {:?}, {:?}", lit, ty, sp, neg); - let parse_float = |num, fty| -> ConstValue<'tcx> { - parse_float(num, fty, neg).unwrap_or_else(|_| { + match lit_to_const(lit, self.tcx, ty, neg) { + Ok(c) => c, + Err(LitToConstError::UnparseableFloat) => { // FIXME(#31407) this is only necessary because float parsing is buggy - self.tcx.sess.span_fatal(sp, "could not evaluate float literal (see issue #31407)"); - }) - }; - - let trunc = |n| { - let param_ty = self.param_env.and(self.tcx.lift_to_global(&ty).unwrap()); - let width = self.tcx.layout_of(param_ty).unwrap().size; - trace!("trunc {} with size {} and shift {}", n, width.bits(), 128 - width.bits()); - let shift = 128 - width.bits(); - let result = (n << shift) >> shift; - trace!("trunc result: {}", result); - ConstValue::Scalar(Scalar::Bits { - bits: result, - size: width.bytes() as u8, - }) - }; - - use rustc::mir::interpret::*; - let lit = match *lit { - LitKind::Str(ref s, _) => { - let s = s.as_str(); - let id = self.tcx.allocate_bytes(s.as_bytes()); - ConstValue::new_slice(Scalar::Ptr(id.into()), s.len() as u64, &self.tcx) - }, - LitKind::ByteStr(ref data) => { - let id = self.tcx.allocate_bytes(data); - ConstValue::Scalar(Scalar::Ptr(id.into())) - }, - LitKind::Byte(n) => ConstValue::Scalar(Scalar::Bits { - bits: n as u128, - size: 1, - }), - LitKind::Int(n, _) if neg => { - let n = n as i128; - let n = n.overflowing_neg().0; - trunc(n as u128) + self.tcx.sess.span_err(sp, "could not evaluate float literal (see issue #31407)"); + // create a dummy value and continue compiling + Const::from_bits(self.tcx, 0, self.param_env.and(ty)) }, - LitKind::Int(n, _) => trunc(n), - LitKind::Float(n, fty) => { - parse_float(n, fty) + Err(LitToConstError::Reported) => { + // create a dummy value and continue compiling + Const::from_bits(self.tcx, 0, self.param_env.and(ty)) } - LitKind::FloatUnsuffixed(n) => { - let fty = match ty.sty { - ty::Float(fty) => fty, - _ => bug!() - }; - parse_float(n, fty) - } - LitKind::Bool(b) => ConstValue::Scalar(Scalar::from_bool(b)), - LitKind::Char(c) => ConstValue::Scalar(Scalar::from_char(c)), - }; - ty::Const::from_const_value(self.tcx, lit, ty) + } } pub fn pattern_from_hir(&mut self, p: &hir::Pat) -> Pattern<'tcx> { let tcx = self.tcx.global_tcx(); - let p = match tcx.hir.get(p.id) { + let p = match tcx.hir().get(p.id) { Node::Pat(p) | Node::Binding(p) => p, node => bug!("pattern became {:?}", node) }; @@ -215,14 +170,14 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { method_name: &str, self_ty: Ty<'tcx>, params: &[Kind<'tcx>]) - -> (Ty<'tcx>, &'tcx ty::Const<'tcx>) { + -> (Ty<'tcx>, ty::Const<'tcx>) { let method_name = Symbol::intern(method_name); let substs = self.tcx.mk_substs_trait(self_ty, params); for item in self.tcx.associated_items(trait_def_id) { if item.kind == ty::AssociatedKind::Method && item.ident.name == method_name { let method_ty = self.tcx.type_of(item.def_id); let method_ty = method_ty.subst(self.tcx, substs); - return (method_ty, ty::Const::zero_sized(self.tcx, method_ty)); + return (method_ty, ty::Const::zero_sized(method_ty)); } } @@ -245,7 +200,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { } fn lint_level_of(&self, node_id: ast::NodeId) -> LintLevel { - let hir_id = self.tcx.hir.definitions().node_to_hir_id(node_id); + let hir_id = self.tcx.hir().definitions().node_to_hir_id(node_id); let has_lint_level = self.tcx.dep_graph.with_ignore(|| { self.tcx.lint_levels(LOCAL_CRATE).lint_level_set(hir_id).is_some() }); @@ -269,8 +224,8 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { self.check_overflow } - pub fn type_moves_by_default(&self, ty: Ty<'tcx>, span: Span) -> bool { - self.infcx.type_moves_by_default(self.param_env, ty, span) + pub fn type_is_copy_modulo_regions(&self, ty: Ty<'tcx>, span: Span) -> bool { + self.infcx.type_is_copy_modulo_regions(self.param_env, ty, span) } } @@ -296,11 +251,11 @@ fn lint_level_for_hir_id(tcx: TyCtxt, mut id: ast::NodeId) -> ast::NodeId { tcx.dep_graph.with_ignore(|| { let sets = tcx.lint_levels(LOCAL_CRATE); loop { - let hir_id = tcx.hir.definitions().node_to_hir_id(id); + let hir_id = tcx.hir().definitions().node_to_hir_id(id); if sets.lint_level_set(hir_id).is_some() { return id } - let next = tcx.hir.get_parent_node(id); + let next = tcx.hir().get_parent_node(id); if next == id { bug!("lint traversal reached the root of the crate"); } diff --git a/src/librustc_mir/hair/cx/to_ref.rs b/src/librustc_mir/hair/cx/to_ref.rs index 6930a959d65..1b87e4450c5 100644 --- a/src/librustc_mir/hair/cx/to_ref.rs +++ b/src/librustc_mir/hair/cx/to_ref.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hair::*; use rustc::hir; diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs index 3078f10598c..f0f8acb31df 100644 --- a/src/librustc_mir/hair/mod.rs +++ b/src/librustc_mir/hair/mod.rs @@ -1,24 +1,15 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The MIR is built from some high-level abstract IR //! (HAIR). This section defines the HAIR along with a trait for //! accessing it. The intention is to allow MIR construction to be //! unit-tested and separated from the Rust source and compiler data //! structures. -use rustc::mir::{BinOp, BorrowKind, UserTypeAnnotation, Field, UnOp}; +use rustc::mir::{BinOp, BorrowKind, Field, UnOp}; use rustc::hir::def_id::DefId; +use rustc::infer::canonical::Canonical; use rustc::middle::region; use rustc::ty::subst::Substs; -use rustc::ty::{AdtDef, UpvarSubsts, Region, Ty, Const}; +use rustc::ty::{AdtDef, UpvarSubsts, Ty, Const, LazyConst, UserType}; use rustc::ty::layout::VariantIdx; use rustc::hir; use syntax::ast; @@ -26,10 +17,11 @@ use syntax_pos::Span; use self::cx::Cx; pub mod cx; +mod constant; pub mod pattern; -pub use self::pattern::{BindingMode, Pattern, PatternKind, FieldPattern}; -pub(crate) use self::pattern::{PatternTypeProjection, PatternTypeProjections}; +pub use self::pattern::{BindingMode, Pattern, PatternKind, PatternRange, FieldPattern}; +pub(crate) use self::pattern::PatternTypeProjection; mod util; @@ -243,7 +235,6 @@ pub enum ExprKind<'tcx> { id: DefId, }, Borrow { - region: Region<'tcx>, borrow_kind: BorrowKind, arg: ExprRef<'tcx>, }, @@ -274,7 +265,7 @@ pub enum ExprKind<'tcx> { /// Optional user-given substs: for something like `let x = /// Bar:: { ... }`. - user_ty: Option>, + user_ty: Option>>, fields: Vec>, base: Option> @@ -282,12 +273,12 @@ pub enum ExprKind<'tcx> { PlaceTypeAscription { source: ExprRef<'tcx>, /// Type that the user gave to this expression - user_ty: Option>, + user_ty: Option>>, }, ValueTypeAscription { source: ExprRef<'tcx>, /// Type that the user gave to this expression - user_ty: Option>, + user_ty: Option>>, }, Closure { closure_id: DefId, @@ -296,8 +287,8 @@ pub enum ExprKind<'tcx> { movability: Option, }, Literal { - literal: &'tcx Const<'tcx>, - user_ty: Option>, + literal: &'tcx LazyConst<'tcx>, + user_ty: Option>>, }, InlineAsm { asm: &'tcx hir::InlineAsm, diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index fd869d6c334..7f5b1a761d2 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// This file includes the logic for exhaustiveness and usefulness checking for /// pattern-matching. Specifically, given a list of patterns for a type, we can /// tell whether: @@ -29,9 +19,9 @@ /// /// If we have this predicate, then we can easily compute both exhaustiveness of an /// entire set of patterns and the individual usefulness of each one. -/// (a) the set of patterns is exhaustive iff `U(P, _)` is false (i.e. adding a wildcard +/// (a) the set of patterns is exhaustive iff `U(P, _)` is false (i.e., adding a wildcard /// match doesn't increase the number of values we're matching) -/// (b) a pattern `p_i` is not useful if `U(P[0..=(i-1), p_i)` is false (i.e. adding a +/// (b) a pattern `p_i` is not useful if `U(P[0..=(i-1), p_i)` is false (i.e., adding a /// pattern to those that have come before it doesn't increase the number of values /// we're matching). /// @@ -90,17 +80,17 @@ /// /// The algorithm for computing `U` /// ------------------------------- -/// The algorithm is inductive (on the number of columns: i.e. components of tuple patterns). +/// The algorithm is inductive (on the number of columns: i.e., components of tuple patterns). /// That means we're going to check the components from left-to-right, so the algorithm /// operates principally on the first component of the matrix and new pattern `p_{m + 1}`. /// This algorithm is realised in the `is_useful` function. /// -/// Base case. (`n = 0`, i.e. an empty tuple pattern) -/// - If `P` already contains an empty pattern (i.e. if the number of patterns `m > 0`), +/// Base case. (`n = 0`, i.e., an empty tuple pattern) +/// - If `P` already contains an empty pattern (i.e., if the number of patterns `m > 0`), /// then `U(P, p_{m + 1})` is false. /// - Otherwise, `P` must be empty, so `U(P, p_{m + 1})` is true. /// -/// Inductive step. (`n > 0`, i.e. whether there's at least one column +/// Inductive step. (`n > 0`, i.e., whether there's at least one column /// [which may then be expanded into further columns later]) /// We're going to match on the new pattern, `p_{m + 1}`. /// - If `p_{m + 1} == c(r_1, .., r_a)`, then we have a constructor pattern. @@ -113,7 +103,7 @@ /// + All the constructors of the first component of the type exist within /// all the rows (after having expanded OR-patterns). In this case: /// `U(P, p_{m + 1}) := ∨(k ϵ constructors) U(S(k, P), S(k, p_{m + 1}))` -/// I.e. the pattern `p_{m + 1}` is only useful when all the constructors are +/// I.e., the pattern `p_{m + 1}` is only useful when all the constructors are /// present *if* its later components are useful for the respective constructors /// covered by `p_{m + 1}` (usually a single constructor, but all in the case of `_`). /// + Some constructors are not present in the existing rows (after having expanded @@ -156,14 +146,14 @@ /// - When we're testing for usefulness of a pattern and the pattern's first component is a /// wildcard. /// + If all the constructors appear in the matrix, we have a slight complication. By default, -/// the behaviour (i.e. a disjunction over specialised matrices for each constructor) is +/// the behaviour (i.e., a disjunction over specialised matrices for each constructor) is /// invalid, because we want a disjunction over every *integer* in each range, not just a /// disjunction over every range. This is a bit more tricky to deal with: essentially we need /// to form equivalence classes of subranges of the constructor range for which the behaviour /// of the matrix `P` and new pattern `p_{m + 1}` are the same. This is described in more /// detail in `split_grouped_constructors`. /// + If some constructors are missing from the matrix, it turns out we don't need to do -/// anything special (because we know none of the integers are actually wildcards: i.e. we +/// anything special (because we know none of the integers are actually wildcards: i.e., we /// can't span wildcards using ranges). use self::Constructor::*; @@ -173,16 +163,16 @@ use self::WitnessPreference::*; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::indexed_vec::Idx; -use super::{FieldPattern, Pattern, PatternKind}; +use super::{FieldPattern, Pattern, PatternKind, PatternRange}; use super::{PatternFoldable, PatternFolder, compare_const_vals}; use rustc::hir::def_id::DefId; use rustc::hir::RangeEnd; -use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; -use rustc::ty::layout::{Integer, IntegerExt, VariantIdx}; +use rustc::ty::{self, Ty, TyCtxt, TypeFoldable, Const}; +use rustc::ty::layout::{Integer, IntegerExt, VariantIdx, Size}; use rustc::mir::Field; -use rustc::mir::interpret::ConstValue; +use rustc::mir::interpret::{ConstValue, Pointer, Scalar}; use rustc::util::common::ErrorReported; use syntax::attr::{SignedInt, UnsignedInt}; @@ -190,6 +180,7 @@ use syntax_pos::{Span, DUMMY_SP}; use arena::TypedArena; +use smallvec::{SmallVec, smallvec}; use std::cmp::{self, Ordering, min, max}; use std::fmt; use std::iter::{FromIterator, IntoIterator}; @@ -199,14 +190,63 @@ use std::u128; pub fn expand_pattern<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>, pat: Pattern<'tcx>) -> &'a Pattern<'tcx> { - cx.pattern_arena.alloc(LiteralExpander.fold_pattern(&pat)) + cx.pattern_arena.alloc(LiteralExpander { tcx: cx.tcx }.fold_pattern(&pat)) +} + +struct LiteralExpander<'a, 'tcx> { + tcx: TyCtxt<'a, 'tcx, 'tcx> } -struct LiteralExpander; -impl<'tcx> PatternFolder<'tcx> for LiteralExpander { +impl<'a, 'tcx> LiteralExpander<'a, 'tcx> { + /// Derefs `val` and potentially unsizes the value if `crty` is an array and `rty` a slice. + /// + /// `crty` and `rty` can differ because you can use array constants in the presence of slice + /// patterns. So the pattern may end up being a slice, but the constant is an array. We convert + /// the array to a slice in that case. + fn fold_const_value_deref( + &mut self, + val: ConstValue<'tcx>, + // the pattern's pointee type + rty: Ty<'tcx>, + // the constant's pointee type + crty: Ty<'tcx>, + ) -> ConstValue<'tcx> { + match (val, &crty.sty, &rty.sty) { + // the easy case, deref a reference + (ConstValue::Scalar(Scalar::Ptr(p)), x, y) if x == y => ConstValue::ByRef( + p.alloc_id, + self.tcx.alloc_map.lock().unwrap_memory(p.alloc_id), + p.offset, + ), + // unsize array to slice if pattern is array but match value or other patterns are slice + (ConstValue::Scalar(Scalar::Ptr(p)), ty::Array(t, n), ty::Slice(u)) => { + assert_eq!(t, u); + ConstValue::Slice( + Scalar::Ptr(p), + n.map_evaluated(|val| val.val.try_to_scalar()) + .unwrap() + .to_usize(&self.tcx) + .unwrap(), + ) + }, + // fat pointers stay the same + (ConstValue::Slice(..), _, _) => val, + // FIXME(oli-obk): this is reachable for `const FOO: &&&u32 = &&&42;` being used + _ => bug!("cannot deref {:#?}, {} -> {}", val, crty, rty), + } + } +} + +impl<'a, 'tcx> PatternFolder<'tcx> for LiteralExpander<'a, 'tcx> { fn fold_pattern(&mut self, pat: &Pattern<'tcx>) -> Pattern<'tcx> { match (&pat.ty.sty, &*pat.kind) { - (&ty::Ref(_, rty, _), &PatternKind::Constant { ref value }) => { + ( + &ty::Ref(_, rty, _), + &PatternKind::Constant { value: Const { + val, + ty: ty::TyS { sty: ty::Ref(_, crty, _), .. }, + } }, + ) => { Pattern { ty: pat.ty, span: pat.span, @@ -214,7 +254,10 @@ impl<'tcx> PatternFolder<'tcx> for LiteralExpander { subpattern: Pattern { ty: rty, span: pat.span, - kind: box PatternKind::Constant { value: value.clone() }, + kind: box PatternKind::Constant { value: Const { + val: self.fold_const_value_deref(val, rty, crty), + ty: rty, + } }, } } } @@ -237,14 +280,16 @@ impl<'tcx> Pattern<'tcx> { } } -pub struct Matrix<'a, 'tcx: 'a>(Vec>>); +/// A 2D matrix. Nx1 matrices are very common, which is why `SmallVec[_; 2]` +/// works well for each row. +pub struct Matrix<'p, 'tcx: 'p>(Vec; 2]>>); -impl<'a, 'tcx> Matrix<'a, 'tcx> { +impl<'p, 'tcx> Matrix<'p, 'tcx> { pub fn empty() -> Self { Matrix(vec![]) } - pub fn push(&mut self, row: Vec<&'a Pattern<'tcx>>) { + pub fn push(&mut self, row: SmallVec<[&'p Pattern<'tcx>; 2]>) { self.0.push(row) } } @@ -261,7 +306,7 @@ impl<'a, 'tcx> Matrix<'a, 'tcx> { /// ++++++++++++++++++++++++++ /// + _ + [_, _, ..tail] + /// ++++++++++++++++++++++++++ -impl<'a, 'tcx> fmt::Debug for Matrix<'a, 'tcx> { +impl<'p, 'tcx> fmt::Debug for Matrix<'p, 'tcx> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "\n")?; @@ -293,8 +338,9 @@ impl<'a, 'tcx> fmt::Debug for Matrix<'a, 'tcx> { } } -impl<'a, 'tcx> FromIterator>> for Matrix<'a, 'tcx> { - fn from_iter>>>(iter: T) -> Self +impl<'p, 'tcx> FromIterator; 2]>> for Matrix<'p, 'tcx> { + fn from_iter(iter: T) -> Self + where T: IntoIterator; 2]>> { Matrix(iter.into_iter().collect()) } @@ -309,6 +355,7 @@ pub struct MatchCheckCtxt<'a, 'tcx: 'a> { /// outside it's module and should not be matchable with an empty match /// statement. pub module: DefId, + param_env: ty::ParamEnv<'tcx>, pub pattern_arena: &'a TypedArena>, pub byte_array_map: FxHashMap<*const Pattern<'tcx>, Vec<&'a Pattern<'tcx>>>, } @@ -316,6 +363,7 @@ pub struct MatchCheckCtxt<'a, 'tcx: 'a> { impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { pub fn create_and_enter( tcx: TyCtxt<'a, 'tcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, module: DefId, f: F) -> R where F: for<'b> FnOnce(MatchCheckCtxt<'b, 'tcx>) -> R @@ -324,53 +372,13 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { f(MatchCheckCtxt { tcx, + param_env, module, pattern_arena: &pattern_arena, byte_array_map: FxHashMap::default(), }) } - // convert a byte-string pattern to a list of u8 patterns. - fn lower_byte_str_pattern<'p>(&mut self, pat: &'p Pattern<'tcx>) -> Vec<&'p Pattern<'tcx>> - where 'a: 'p - { - let pattern_arena = &*self.pattern_arena; - let tcx = self.tcx; - self.byte_array_map.entry(pat).or_insert_with(|| { - match pat.kind { - box PatternKind::Constant { - value: const_val - } => { - if let Some(ptr) = const_val.to_ptr() { - let is_array_ptr = const_val.ty - .builtin_deref(true) - .and_then(|t| t.ty.builtin_index()) - .map_or(false, |t| t == tcx.types.u8); - assert!(is_array_ptr); - let alloc = tcx.alloc_map.lock().unwrap_memory(ptr.alloc_id); - assert_eq!(ptr.offset.bytes(), 0); - // FIXME: check length - alloc.bytes.iter().map(|b| { - &*pattern_arena.alloc(Pattern { - ty: tcx.types.u8, - span: pat.span, - kind: box PatternKind::Constant { - value: ty::Const::from_bits( - tcx, - *b as u128, - ty::ParamEnv::empty().and(tcx.types.u8)) - } - }) - }).collect() - } else { - bug!("not a byte str: {:?}", const_val) - } - } - _ => span_bug!(pat.span, "unexpected byte array pattern {:?}", pat) - } - }).clone() - } - fn is_uninhabited(&self, ty: Ty<'tcx>) -> bool { if self.tcx.features().exhaustive_patterns { self.tcx.is_ty_uninhabited_from(self.module, ty) @@ -409,12 +417,12 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { #[derive(Clone, Debug, PartialEq)] pub enum Constructor<'tcx> { /// The constructor of all patterns that don't vary by constructor, - /// e.g. struct patterns and fixed-length arrays. + /// e.g., struct patterns and fixed-length arrays. Single, /// Enum variants. Variant(DefId), /// Literal values. - ConstantValue(&'tcx ty::Const<'tcx>), + ConstantValue(ty::Const<'tcx>), /// Ranges of literal values (`2...5` and `2..5`). ConstantRange(u128, u128, Ty<'tcx>, RangeEnd), /// Array patterns of length n. @@ -422,13 +430,24 @@ pub enum Constructor<'tcx> { } impl<'tcx> Constructor<'tcx> { - fn variant_index_for_adt(&self, adt: &'tcx ty::AdtDef) -> VariantIdx { + fn variant_index_for_adt<'a>( + &self, + cx: &MatchCheckCtxt<'a, 'tcx>, + adt: &'tcx ty::AdtDef, + ) -> VariantIdx { match self { &Variant(vid) => adt.variant_index_with_id(vid), &Single => { assert!(!adt.is_enum()); VariantIdx::new(0) } + &ConstantValue(c) => { + ::const_eval::const_variant_index( + cx.tcx, + cx.param_env, + c, + ).unwrap() + }, _ => bug!("bad constructor {:?} for adt {:?}", self, adt) } } @@ -526,7 +545,7 @@ impl<'tcx> Witness<'tcx> { /// patterns expanded by the specialization step. /// /// When a pattern P is discovered to be useful, this function is used bottom-up - /// to reconstruct a complete witness, e.g. a pattern P' that covers a subset + /// to reconstruct a complete witness, e.g., a pattern P' that covers a subset /// of values, V, where each value in that set is not covered by any previously /// used patterns and is covered by the pattern P'. Examples: /// @@ -562,7 +581,7 @@ impl<'tcx> Witness<'tcx> { PatternKind::Variant { adt_def: adt, substs, - variant_index: ctor.variant_index_for_adt(adt), + variant_index: ctor.variant_index_for_adt(cx, adt), subpatterns: pats } } else { @@ -588,12 +607,12 @@ impl<'tcx> Witness<'tcx> { _ => { match *ctor { ConstantValue(value) => PatternKind::Constant { value }, - ConstantRange(lo, hi, ty, end) => PatternKind::Range { + ConstantRange(lo, hi, ty, end) => PatternKind::Range(PatternRange { lo: ty::Const::from_bits(cx.tcx, lo, ty::ParamEnv::empty().and(ty)), hi: ty::Const::from_bits(cx.tcx, hi, ty::ParamEnv::empty().and(ty)), ty, end, - }, + }), _ => PatternKind::Wild, } } @@ -622,7 +641,6 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, -> Vec> { debug!("all_constructors({:?})", pcx.ty); - let exhaustive_integer_patterns = cx.tcx.features().exhaustive_integer_patterns; let ctors = match pcx.ty.sty { ty::Bool => { [true, false].iter().map(|&b| { @@ -652,7 +670,7 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, .map(|v| Variant(v.did)) .collect() } - ty::Char if exhaustive_integer_patterns => { + ty::Char => { vec![ // The valid Unicode Scalar Value ranges. ConstantRange('\u{0000}' as u128, @@ -667,14 +685,14 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, ), ] } - ty::Int(ity) if exhaustive_integer_patterns => { + ty::Int(ity) => { // FIXME(49937): refactor these bit manipulations into interpret. let bits = Integer::from_attr(&cx.tcx, SignedInt(ity)).size().bits() as u128; let min = 1u128 << (bits - 1); let max = (1u128 << (bits - 1)) - 1; vec![ConstantRange(min, max, pcx.ty, RangeEnd::Included)] } - ty::Uint(uty) if exhaustive_integer_patterns => { + ty::Uint(uty) => { // FIXME(49937): refactor these bit manipulations into interpret. let bits = Integer::from_attr(&cx.tcx, UnsignedInt(uty)).size().bits() as u128; let max = !0u128 >> (128 - bits); @@ -767,15 +785,17 @@ fn max_slice_length<'p, 'a: 'p, 'tcx: 'a, I>( for row in patterns { match *row.kind { PatternKind::Constant { value } => { - if let Some(ptr) = value.to_ptr() { - let is_array_ptr = value.ty - .builtin_deref(true) - .and_then(|t| t.ty.builtin_index()) - .map_or(false, |t| t == cx.tcx.types.u8); - if is_array_ptr { - let alloc = cx.tcx.alloc_map.lock().unwrap_memory(ptr.alloc_id); - max_fixed_len = cmp::max(max_fixed_len, alloc.bytes.len() as u64); - } + // extract the length of an array/slice from a constant + match (value.val, &value.ty.sty) { + (_, ty::Array(_, n)) => max_fixed_len = cmp::max( + max_fixed_len, + n.unwrap_usize(cx.tcx), + ), + (ConstValue::Slice(_, n), ty::Slice(_)) => max_fixed_len = cmp::max( + max_fixed_len, + n, + ), + _ => {}, } } PatternKind::Slice { ref prefix, slice: None, ref suffix } => { @@ -802,7 +822,7 @@ fn max_slice_length<'p, 'a: 'p, 'tcx: 'a, I>( /// straightforward. See `signed_bias` for details. /// /// `IntRange` is never used to encode an empty range or a "range" that wraps -/// around the (offset) space: i.e. `range.lo <= range.hi`. +/// around the (offset) space: i.e., `range.lo <= range.hi`. #[derive(Clone)] struct IntRange<'tcx> { pub range: RangeInclusive, @@ -813,8 +833,17 @@ impl<'tcx> IntRange<'tcx> { fn from_ctor(tcx: TyCtxt<'_, 'tcx, 'tcx>, ctor: &Constructor<'tcx>) -> Option> { + // Floating-point ranges are permitted and we don't want + // to consider them when constructing integer ranges. + fn is_integral<'tcx>(ty: Ty<'tcx>) -> bool { + match ty.sty { + ty::Char | ty::Int(_) | ty::Uint(_) => true, + _ => false, + } + } + match ctor { - ConstantRange(lo, hi, ty, end) => { + ConstantRange(lo, hi, ty, end) if is_integral(ty) => { // Perform a shift if the underlying types are signed, // which makes the interval arithmetic simpler. let bias = IntRange::signed_bias(tcx, ty); @@ -827,7 +856,7 @@ impl<'tcx> IntRange<'tcx> { Some(IntRange { range: lo..=(hi - offset), ty }) } } - ConstantValue(val) => { + ConstantValue(val) if is_integral(val.ty) => { let ty = val.ty; if let Some(val) = val.assert_bits(tcx, ty::ParamEnv::empty().and(ty)) { let bias = IntRange::signed_bias(tcx, ty); @@ -837,9 +866,7 @@ impl<'tcx> IntRange<'tcx> { None } } - Single | Variant(_) | Slice(_) => { - None - } + _ => None, } } @@ -848,7 +875,7 @@ impl<'tcx> IntRange<'tcx> { -> Option> { Self::from_ctor(tcx, &match pat.kind { box PatternKind::Constant { value } => ConstantValue(value), - box PatternKind::Range { lo, hi, ty, end } => ConstantRange( + box PatternKind::Range(PatternRange { lo, hi, ty, end }) => ConstantRange( lo.to_bits(tcx, ty::ParamEnv::empty().and(ty)).unwrap(), hi.to_bits(tcx, ty::ParamEnv::empty().and(ty)).unwrap(), ty, @@ -886,7 +913,7 @@ impl<'tcx> IntRange<'tcx> { } /// Return a collection of ranges that spans the values covered by `ranges`, subtracted - /// by the values covered by `self`: i.e. `ranges \ self` (in set notation). + /// by the values covered by `self`: i.e., `ranges \ self` (in set notation). fn subtract_from(self, tcx: TyCtxt<'_, 'tcx, 'tcx>, ranges: Vec>) @@ -971,12 +998,10 @@ fn compute_missing_ctors<'a, 'tcx: 'a>( // If a constructor appears in a `match` arm, we can // eliminate it straight away. refined_ctors = vec![] - } else if tcx.features().exhaustive_integer_patterns { - if let Some(interval) = IntRange::from_ctor(tcx, used_ctor) { - // Refine the required constructors for the type by subtracting - // the range defined by the current constructor pattern. - refined_ctors = interval.subtract_from(tcx, refined_ctors); - } + } else if let Some(interval) = IntRange::from_ctor(tcx, used_ctor) { + // Refine the required constructors for the type by subtracting + // the range defined by the current constructor pattern. + refined_ctors = interval.subtract_from(tcx, refined_ctors); } // If the constructor patterns that have been considered so far @@ -1032,7 +1057,7 @@ fn compute_missing_ctors<'a, 'tcx: 'a>( /// matrix isn't exhaustive). pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, matrix: &Matrix<'p, 'tcx>, - v: &[&'p Pattern<'tcx>], + v: &[&Pattern<'tcx>], witness: WitnessPreference) -> Usefulness<'tcx> { let &Matrix(ref rows) = matrix; @@ -1132,7 +1157,8 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, // For privately empty and non-exhaustive enums, we work as if there were an "extra" // `_` constructor for the type, so we can never match over all constructors. - let is_non_exhaustive = is_privately_empty || is_declared_nonexhaustive; + let is_non_exhaustive = is_privately_empty || is_declared_nonexhaustive || + (pcx.ty.is_pointer_sized() && !cx.tcx.features().precise_pointer_size_matching); if cheap_missing_ctors == MissingCtors::Empty && !is_non_exhaustive { split_grouped_constructors(cx.tcx, all_ctors, matrix, pcx.ty).into_iter().map(|c| { @@ -1141,7 +1167,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, } else { let matrix = rows.iter().filter_map(|r| { if r[0].is_wildcard() { - Some(r[1..].to_vec()) + Some(SmallVec::from_slice(&r[1..])) } else { None } @@ -1155,7 +1181,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, // // There are 2 ways we can report a witness here. // Commonly, we can report all the "free" - // constructors as witnesses, e.g. if we have: + // constructors as witnesses, e.g., if we have: // // ``` // enum Direction { N, S, E, W } @@ -1170,7 +1196,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, // 1) If the user is matching against a non-exhaustive // enum, there is no point in enumerating all possible // variants, because the user can't actually match - // against them himself, e.g. in an example like: + // against them himself, e.g., in an example like: // ``` // let err: io::ErrorKind = ...; // match err { @@ -1184,7 +1210,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, // case). // // 2) If the user didn't actually specify a constructor - // in this arm, e.g. in + // in this arm, e.g., in // ``` // let x: (Direction, Direction, bool) = ...; // let (_, _, false) = x; @@ -1230,12 +1256,12 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, } } -/// A shorthand for the `U(S(c, P), S(c, q))` operation from the paper. I.e. `is_useful` applied +/// A shorthand for the `U(S(c, P), S(c, q))` operation from the paper. I.e., `is_useful` applied /// to the specialised version of both the pattern matrix `P` and the new pattern `q`. -fn is_useful_specialized<'p, 'a:'p, 'tcx: 'a>( +fn is_useful_specialized<'p, 'a: 'p, 'tcx: 'a>( cx: &mut MatchCheckCtxt<'a, 'tcx>, &Matrix(ref m): &Matrix<'p, 'tcx>, - v: &[&'p Pattern<'tcx>], + v: &[&Pattern<'tcx>], ctor: Constructor<'tcx>, lty: Ty<'tcx>, witness: WitnessPreference, @@ -1288,7 +1314,7 @@ fn pat_constructors<'tcx>(cx: &mut MatchCheckCtxt<'_, 'tcx>, Some(vec![Variant(adt_def.variants[variant_index].did)]) } PatternKind::Constant { value } => Some(vec![ConstantValue(value)]), - PatternKind::Range { lo, hi, ty, end } => + PatternKind::Range(PatternRange { lo, hi, ty, end }) => Some(vec![ConstantRange( lo.to_bits(cx.tcx, ty::ParamEnv::empty().and(ty)).unwrap(), hi.to_bits(cx.tcx, ty::ParamEnv::empty().and(ty)).unwrap(), @@ -1317,7 +1343,7 @@ fn pat_constructors<'tcx>(cx: &mut MatchCheckCtxt<'_, 'tcx>, /// /// For instance, a tuple pattern (_, 42, Some([])) has the arity of 3. /// A struct pattern's arity is the number of fields it contains, etc. -fn constructor_arity(_cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> u64 { +fn constructor_arity(cx: &MatchCheckCtxt<'a, 'tcx>, ctor: &Constructor<'tcx>, ty: Ty<'tcx>) -> u64 { debug!("constructor_arity({:#?}, {:?})", ctor, ty); match ty.sty { ty::Tuple(ref fs) => fs.len() as u64, @@ -1328,7 +1354,7 @@ fn constructor_arity(_cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> u64 { }, ty::Ref(..) => 1, ty::Adt(adt, _) => { - adt.variants[ctor.variant_index_for_adt(adt)].fields.len() as u64 + adt.variants[ctor.variant_index_for_adt(cx, adt)].fields.len() as u64 } _ => 0 } @@ -1339,7 +1365,7 @@ fn constructor_arity(_cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> u64 { /// /// For instance, a tuple pattern (43u32, 'a') has sub pattern types [u32, char]. fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>, - ctor: &Constructor, + ctor: &Constructor<'tcx>, ty: Ty<'tcx>) -> Vec> { debug!("constructor_sub_pattern_tys({:#?}, {:?})", ctor, ty); @@ -1356,11 +1382,18 @@ fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>, // Use T as the sub pattern type of Box. vec![substs.type_at(0)] } else { - adt.variants[ctor.variant_index_for_adt(adt)].fields.iter().map(|field| { + adt.variants[ctor.variant_index_for_adt(cx, adt)].fields.iter().map(|field| { let is_visible = adt.is_enum() || field.vis.is_accessible_from(cx.module, cx.tcx); if is_visible { - field.ty(cx.tcx, substs) + let ty = field.ty(cx.tcx, substs); + match ty.sty { + // If the field type returned is an array of an unknown + // size return an TyErr. + ty::Array(_, len) if len.assert_usize(cx.tcx).is_none() => + cx.tcx.types.err, + _ => ty, + } } else { // Treat all non-visible fields as TyErr. They // can't appear in any other pattern from @@ -1377,33 +1410,60 @@ fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>, } } -fn slice_pat_covered_by_constructor<'tcx>( +// checks whether a constant is equal to a user-written slice pattern. Only supports byte slices, +// meaning all other types will compare unequal and thus equal patterns often do not cause the +// second pattern to lint about unreachable match arms. +fn slice_pat_covered_by_const<'tcx>( tcx: TyCtxt<'_, 'tcx, '_>, _span: Span, - ctor: &Constructor, + const_val: ty::Const<'tcx>, prefix: &[Pattern<'tcx>], slice: &Option>, suffix: &[Pattern<'tcx>] ) -> Result { - let data: &[u8] = match *ctor { - ConstantValue(const_val) => { - let val = match const_val.val { - ConstValue::Unevaluated(..) | - ConstValue::ByRef(..) => bug!("unexpected ConstValue: {:?}", const_val), - ConstValue::Scalar(val) | ConstValue::ScalarPair(val, _) => val, - }; - if let Ok(ptr) = val.to_ptr() { - let is_array_ptr = const_val.ty - .builtin_deref(true) - .and_then(|t| t.ty.builtin_index()) - .map_or(false, |t| t == tcx.types.u8); - assert!(is_array_ptr); - tcx.alloc_map.lock().unwrap_memory(ptr.alloc_id).bytes.as_ref() - } else { - bug!("unexpected non-ptr ConstantValue") + let data: &[u8] = match (const_val.val, &const_val.ty.sty) { + (ConstValue::ByRef(id, alloc, offset), ty::Array(t, n)) => { + if *t != tcx.types.u8 { + // FIXME(oli-obk): can't mix const patterns with slice patterns and get + // any sort of exhaustiveness/unreachable check yet + // This solely means that we don't lint about unreachable patterns, even if some + // are definitely unreachable. + return Ok(false); } - } - _ => bug!() + let ptr = Pointer::new(id, offset); + let n = n.assert_usize(tcx).unwrap(); + alloc.get_bytes(&tcx, ptr, Size::from_bytes(n)).unwrap() + }, + // a slice fat pointer to a zero length slice + (ConstValue::Slice(Scalar::Bits { .. }, 0), ty::Slice(t)) => { + if *t != tcx.types.u8 { + // FIXME(oli-obk): can't mix const patterns with slice patterns and get + // any sort of exhaustiveness/unreachable check yet + // This solely means that we don't lint about unreachable patterns, even if some + // are definitely unreachable. + return Ok(false); + } + &[] + }, + // + (ConstValue::Slice(Scalar::Ptr(ptr), n), ty::Slice(t)) => { + if *t != tcx.types.u8 { + // FIXME(oli-obk): can't mix const patterns with slice patterns and get + // any sort of exhaustiveness/unreachable check yet + // This solely means that we don't lint about unreachable patterns, even if some + // are definitely unreachable. + return Ok(false); + } + tcx.alloc_map + .lock() + .unwrap_memory(ptr.alloc_id) + .get_bytes(&tcx, ptr, Size::from_bytes(n)) + .unwrap() + }, + _ => bug!( + "slice_pat_covered_by_const: {:#?}, {:#?}, {:#?}, {:#?}", + const_val, prefix, slice, suffix, + ), }; let pat_len = prefix.len() + suffix.len(); @@ -1433,17 +1493,16 @@ fn slice_pat_covered_by_constructor<'tcx>( // Whether to evaluate a constructor using exhaustive integer matching. This is true if the // constructor is a range or constant with an integer type. fn should_treat_range_exhaustively(tcx: TyCtxt<'_, 'tcx, 'tcx>, ctor: &Constructor<'tcx>) -> bool { - if tcx.features().exhaustive_integer_patterns { - let ty = match ctor { - ConstantValue(value) => value.ty, - ConstantRange(_, _, ty, _) => ty, - _ => return false, - }; - if let ty::Char | ty::Int(_) | ty::Uint(_) = ty.sty { - return true; - } + let ty = match ctor { + ConstantValue(value) => value.ty, + ConstantRange(_, _, ty, _) => ty, + _ => return false, + }; + if let ty::Char | ty::Int(_) | ty::Uint(_) = ty.sty { + !ty.is_pointer_sized() || tcx.features().precise_pointer_size_matching + } else { + false } - false } /// For exhaustive integer matching, some constructors are grouped within other constructors @@ -1452,7 +1511,7 @@ fn should_treat_range_exhaustively(tcx: TyCtxt<'_, 'tcx, 'tcx>, ctor: &Construct /// the groups (the ranges). Thus we need to split the groups up. Splitting them up naïvely would /// mean creating a separate constructor for every single value in the range, which is clearly /// impractical. However, observe that for some ranges of integers, the specialisation will be -/// identical across all values in that range (i.e. there are equivalence classes of ranges of +/// identical across all values in that range (i.e., there are equivalence classes of ranges of /// constructors based on their `is_useful_specialized` outcome). These classes are grouped by /// the patterns that apply to them (in the matrix `P`). We can split the range whenever the /// patterns that apply to that range (specifically: the patterns that *intersect* with that range) @@ -1461,7 +1520,7 @@ fn should_treat_range_exhaustively(tcx: TyCtxt<'_, 'tcx, 'tcx>, ctor: &Construct /// the group of intersecting patterns changes (using the method described below). /// And voilà! We're testing precisely those ranges that we need to, without any exhaustive matching /// on actual integers. The nice thing about this is that the number of subranges is linear in the -/// number of rows in the matrix (i.e. the number of cases in the `match` statement), so we don't +/// number of rows in the matrix (i.e., the number of cases in the `match` statement), so we don't /// need to be worried about matching over gargantuan ranges. /// /// Essentially, given the first column of a matrix representing ranges, looking like the following: @@ -1560,7 +1619,7 @@ fn constructor_intersects_pattern<'p, 'a: 'p, 'tcx: 'a>( tcx: TyCtxt<'a, 'tcx, 'tcx>, ctor: &Constructor<'tcx>, pat: &'p Pattern<'tcx>, -) -> Option>> { +) -> Option; 2]>> { if should_treat_range_exhaustively(tcx, ctor) { match (IntRange::from_ctor(tcx, ctor), IntRange::from_pat(tcx, pat)) { (Some(ctor), Some(pat)) => { @@ -1568,7 +1627,7 @@ fn constructor_intersects_pattern<'p, 'a: 'p, 'tcx: 'a>( let (pat_lo, pat_hi) = pat.range.into_inner(); let (ctor_lo, ctor_hi) = ctor.range.into_inner(); assert!(pat_lo <= ctor_lo && ctor_hi <= pat_hi); - vec![] + smallvec![] }) } _ => None, @@ -1578,7 +1637,7 @@ fn constructor_intersects_pattern<'p, 'a: 'p, 'tcx: 'a>( // conveniently handled by `IntRange`. For these cases, the constructor may not be a range // so intersection actually devolves into being covered by the pattern. match constructor_covered_by_range(tcx, ctor, pat) { - Ok(true) => Some(vec![]), + Ok(true) => Some(smallvec![]), Ok(false) | Err(ErrorReported) => None, } } @@ -1591,7 +1650,7 @@ fn constructor_covered_by_range<'a, 'tcx>( ) -> Result { let (from, to, end, ty) = match pat.kind { box PatternKind::Constant { value } => (value, value, RangeEnd::Included, value.ty), - box PatternKind::Range { lo, hi, ty, end } => (lo, hi, end, ty), + box PatternKind::Range(PatternRange { lo, hi, end, ty }) => (lo, hi, end, ty), _ => bug!("`constructor_covered_by_range` called with {:?}", pat), }; trace!("constructor_covered_by_range {:#?}, {:#?}, {:#?}, {}", ctor, from, to, ty); @@ -1649,9 +1708,9 @@ fn constructor_covered_by_range<'a, 'tcx>( fn patterns_for_variant<'p, 'a: 'p, 'tcx: 'a>( subpatterns: &'p [FieldPattern<'tcx>], wild_patterns: &[&'p Pattern<'tcx>]) - -> Vec<&'p Pattern<'tcx>> + -> SmallVec<[&'p Pattern<'tcx>; 2]> { - let mut result = wild_patterns.to_owned(); + let mut result = SmallVec::from_slice(wild_patterns); for subpat in subpatterns { result[subpat.field.index()] = &subpat.pattern; @@ -1674,15 +1733,16 @@ fn specialize<'p, 'a: 'p, 'tcx: 'a>( r: &[&'p Pattern<'tcx>], constructor: &Constructor<'tcx>, wild_patterns: &[&'p Pattern<'tcx>], -) -> Option>> { +) -> Option; 2]>> { let pat = &r[0]; - let head: Option> = match *pat.kind { - PatternKind::AscribeUserType { ref subpattern, .. } => - specialize(cx, ::std::slice::from_ref(&subpattern), constructor, wild_patterns), + let head = match *pat.kind { + PatternKind::AscribeUserType { ref subpattern, .. } => { + specialize(cx, ::std::slice::from_ref(&subpattern), constructor, wild_patterns) + } PatternKind::Binding { .. } | PatternKind::Wild => { - Some(wild_patterns.to_owned()) + Some(SmallVec::from_slice(wild_patterns)) } PatternKind::Variant { adt_def, variant_index, ref subpatterns, .. } => { @@ -1699,32 +1759,83 @@ fn specialize<'p, 'a: 'p, 'tcx: 'a>( } PatternKind::Deref { ref subpattern } => { - Some(vec![subpattern]) + Some(smallvec![subpattern]) } PatternKind::Constant { value } => { match *constructor { Slice(..) => { - if let Some(ptr) = value.to_ptr() { - let is_array_ptr = value.ty - .builtin_deref(true) - .and_then(|t| t.ty.builtin_index()) - .map_or(false, |t| t == cx.tcx.types.u8); - assert!(is_array_ptr); - let data_len = cx.tcx - .alloc_map - .lock() - .unwrap_memory(ptr.alloc_id) - .bytes - .len(); - if wild_patterns.len() == data_len { - Some(cx.lower_byte_str_pattern(pat)) - } else { - None + // we extract an `Option` for the pointer because slices of zero elements don't + // necessarily point to memory, they are usually just integers. The only time + // they should be pointing to memory is when they are subslices of nonzero + // slices + let (opt_ptr, n, ty) = match value.ty.sty { + ty::TyKind::Array(t, n) => { + match value.val { + ConstValue::ByRef(id, alloc, offset) => ( + Some((Pointer::new(id, offset), alloc)), + n.unwrap_usize(cx.tcx), + t, + ), + _ => span_bug!( + pat.span, + "array pattern is {:?}", value, + ), + } + }, + ty::TyKind::Slice(t) => { + match value.val { + ConstValue::Slice(ptr, n) => ( + ptr.to_ptr().ok().map(|ptr| ( + ptr, + cx.tcx.alloc_map.lock().unwrap_memory(ptr.alloc_id), + )), + n, + t, + ), + _ => span_bug!( + pat.span, + "slice pattern constant must be scalar pair but is {:?}", + value, + ), + } + }, + _ => span_bug!( + pat.span, + "unexpected const-val {:?} with ctor {:?}", + value, + constructor, + ), + }; + if wild_patterns.len() as u64 == n { + // convert a constant slice/array pattern to a list of patterns. + match (n, opt_ptr) { + (0, _) => Some(SmallVec::new()), + (_, Some((ptr, alloc))) => { + let layout = cx.tcx.layout_of(cx.param_env.and(ty)).ok()?; + (0..n).map(|i| { + let ptr = ptr.offset(layout.size * i, &cx.tcx).ok()?; + let scalar = alloc.read_scalar( + &cx.tcx, ptr, layout.size, + ).ok()?; + let scalar = scalar.not_undef().ok()?; + let value = ty::Const::from_scalar(scalar, ty); + let pattern = Pattern { + ty, + span: pat.span, + kind: box PatternKind::Constant { value }, + }; + Some(&*cx.pattern_arena.alloc(pattern)) + }).collect() + }, + (_, None) => span_bug!( + pat.span, + "non zero length slice with const-val {:?}", + value, + ), } } else { - span_bug!(pat.span, - "unexpected const-val {:?} with ctor {:?}", value, constructor) + None } } _ => { @@ -1763,11 +1874,9 @@ fn specialize<'p, 'a: 'p, 'tcx: 'a>( None } } - ConstantValue(..) => { - match slice_pat_covered_by_constructor( - cx.tcx, pat.span, constructor, prefix, slice, suffix - ) { - Ok(true) => Some(vec![]), + ConstantValue(cv) => { + match slice_pat_covered_by_const(cx.tcx, pat.span, cv, prefix, slice, suffix) { + Ok(true) => Some(smallvec![]), Ok(false) => None, Err(ErrorReported) => None } diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index bafabe4e997..10a4575d812 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::_match::{MatchCheckCtxt, Matrix, expand_pattern, is_useful}; use super::_match::Usefulness::*; use super::_match::WitnessPreference::*; @@ -31,6 +21,7 @@ use rustc::hir::def_id::DefId; use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; use rustc::hir::{self, Pat, PatKind}; +use smallvec::smallvec; use std::slice; use syntax::ast; @@ -41,18 +32,18 @@ struct OuterVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx> } impl<'a, 'tcx> Visitor<'tcx> for OuterVisitor<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::OnlyBodies(&self.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } fn visit_body(&mut self, body: &'tcx hir::Body) { intravisit::walk_body(self, body); - let def_id = self.tcx.hir.body_owner_def_id(body.id()); + let def_id = self.tcx.hir().body_owner_def_id(body.id()); let _ = self.tcx.check_match(def_id); } } pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - tcx.hir.krate().visit_all_item_likes(&mut OuterVisitor { tcx }.as_deep_visitor()); + tcx.hir().krate().visit_all_item_likes(&mut OuterVisitor { tcx }.as_deep_visitor()); tcx.sess.abort_if_errors(); } @@ -60,8 +51,8 @@ pub(crate) fn check_match<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, ) -> Result<(), ErrorReported> { - let body_id = if let Some(id) = tcx.hir.as_local_node_id(def_id) { - tcx.hir.body_owned_by(id) + let body_id = if let Some(id) = tcx.hir().as_local_node_id(def_id) { + tcx.hir().body_owned_by(id) } else { return Ok(()); }; @@ -73,7 +64,7 @@ pub(crate) fn check_match<'a, 'tcx>( region_scope_tree: &tcx.region_scope_tree(def_id), param_env: tcx.param_env(def_id), identity_substs: Substs::identity_for_item(tcx, def_id), - }.visit_body(tcx.hir.body(body_id)); + }.visit_body(tcx.hir().body(body_id)); }) } @@ -188,12 +179,12 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { // Third, perform some lints. for pat in &arm.pats { - check_for_bindings_named_the_same_as_variants(self, pat); + check_for_bindings_named_same_as_variants(self, pat); } } - let module = self.tcx.hir.get_module_parent(scrut.id); - MatchCheckCtxt::create_and_enter(self.tcx, module, |ref mut cx| { + let module = self.tcx.hir().get_module_parent(scrut.id); + MatchCheckCtxt::create_and_enter(self.tcx, self.param_env, module, |ref mut cx| { let mut have_errors = false; let inlined_arms : Vec<(Vec<_>, _)> = arms.iter().map(|arm| ( @@ -224,17 +215,21 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { // Then, if the match has no arms, check whether the scrutinee // is uninhabited. let pat_ty = self.tables.node_id_to_type(scrut.hir_id); - let module = self.tcx.hir.get_module_parent(scrut.id); + let module = self.tcx.hir().get_module_parent(scrut.id); if inlined_arms.is_empty() { let scrutinee_is_uninhabited = if self.tcx.features().exhaustive_patterns { self.tcx.is_ty_uninhabited_from(module, pat_ty) } else { - self.conservative_is_uninhabited(pat_ty) + match pat_ty.sty { + ty::Never => true, + ty::Adt(def, _) => def.variants.is_empty(), + _ => false + } }; if !scrutinee_is_uninhabited { // We know the type is inhabited, so this must be wrong let mut err = create_e0004(self.tcx.sess, scrut.span, - format!("non-exhaustive patterns: type {} \ + format!("non-exhaustive patterns: type `{}` \ is non-empty", pat_ty)); span_help!(&mut err, scrut.span, @@ -250,31 +245,22 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { .iter() .filter(|&&(_, guard)| guard.is_none()) .flat_map(|arm| &arm.0) - .map(|pat| vec![pat.0]) + .map(|pat| smallvec![pat.0]) .collect(); let scrut_ty = self.tables.node_id_to_type(scrut.hir_id); check_exhaustive(cx, scrut_ty, scrut.span, &matrix); }) } - fn conservative_is_uninhabited(&self, scrutinee_ty: Ty<'tcx>) -> bool { - // "rustc-1.0-style" uncontentious uninhabitableness check - match scrutinee_ty.sty { - ty::Never => true, - ty::Adt(def, _) => def.variants.is_empty(), - _ => false - } - } - fn check_irrefutable(&self, pat: &'tcx Pat, origin: &str) { - let module = self.tcx.hir.get_module_parent(pat.id); - MatchCheckCtxt::create_and_enter(self.tcx, module, |ref mut cx| { + let module = self.tcx.hir().get_module_parent(pat.id); + MatchCheckCtxt::create_and_enter(self.tcx, self.param_env, module, |ref mut cx| { let mut patcx = PatternContext::new(self.tcx, self.param_env.and(self.identity_substs), self.tables); let pattern = patcx.lower_pattern(pat); let pattern_ty = pattern.ty; - let pats: Matrix = vec![vec![ + let pats: Matrix = vec![smallvec![ expand_pattern(cx, pattern) ]].into_iter().collect(); @@ -309,7 +295,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { } } -fn check_for_bindings_named_the_same_as_variants(cx: &MatchVisitor, pat: &Pat) { +fn check_for_bindings_named_same_as_variants(cx: &MatchVisitor, pat: &Pat) { pat.walk(|p| { if let PatKind::Binding(_, _, ident, None) = p.node { if let Some(&bm) = cx.tables.pat_binding_modes().get(p.hir_id) { @@ -320,14 +306,14 @@ fn check_for_bindings_named_the_same_as_variants(cx: &MatchVisitor, pat: &Pat) { let pat_ty = cx.tables.pat_ty(p); if let ty::Adt(edef, _) = pat_ty.sty { if edef.is_enum() && edef.variants.iter().any(|variant| { - variant.name == ident.name && variant.ctor_kind == CtorKind::Const + variant.ident == ident && variant.ctor_kind == CtorKind::Const }) { let ty_path = cx.tcx.item_path_str(edef.did); let mut err = struct_span_warn!(cx.tcx.sess, p.span, E0170, "pattern binding `{}` is named the same as one \ of the variants of the type `{}`", ident, ty_path); - err.span_suggestion_with_applicability( + err.span_suggestion( p.span, "to match on the variant, qualify the path", format!("{}::{}", ty_path, ident), @@ -364,36 +350,20 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, { let mut seen = Matrix::empty(); let mut catchall = None; - let mut printed_if_let_err = false; for (arm_index, &(ref pats, guard)) in arms.iter().enumerate() { for &(pat, hir_pat) in pats { - let v = vec![pat]; + let v = smallvec![pat]; match is_useful(cx, &seen, &v, LeaveOutWitness) { NotUseful => { match source { hir::MatchSource::IfLetDesugar { .. } => { - if cx.tcx.features().irrefutable_let_patterns { - cx.tcx.lint_node( - lint::builtin::IRREFUTABLE_LET_PATTERNS, - hir_pat.id, pat.span, - "irrefutable if-let pattern"); - } else { - if printed_if_let_err { - // we already printed an irrefutable if-let pattern error. - // We don't want two, that's just confusing. - } else { - // find the first arm pattern so we can use its span - let &(ref first_arm_pats, _) = &arms[0]; - let first_pat = &first_arm_pats[0]; - let span = first_pat.0.span; - struct_span_err!(cx.tcx.sess, span, E0162, - "irrefutable if-let pattern") - .span_label(span, "irrefutable pattern") - .emit(); - printed_if_let_err = true; - } - } + cx.tcx.lint_node( + lint::builtin::IRREFUTABLE_LET_PATTERNS, + hir_pat.id, + pat.span, + "irrefutable if-let pattern", + ); } hir::MatchSource::WhileLetDesugar => { @@ -408,21 +378,12 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, }, // The arm with the wildcard pattern. 1 => { - if cx.tcx.features().irrefutable_let_patterns { - cx.tcx.lint_node( - lint::builtin::IRREFUTABLE_LET_PATTERNS, - hir_pat.id, pat.span, - "irrefutable while-let pattern"); - } else { - // find the first arm pattern so we can use its span - let &(ref first_arm_pats, _) = &arms[0]; - let first_pat = &first_arm_pats[0]; - let span = first_pat.0.span; - struct_span_err!(cx.tcx.sess, span, E0165, - "irrefutable while-let pattern") - .span_label(span, "irrefutable pattern") - .emit(); - } + cx.tcx.lint_node( + lint::builtin::IRREFUTABLE_LET_PATTERNS, + hir_pat.id, + pat.span, + "irrefutable while-let pattern", + ); }, _ => bug!(), } @@ -462,10 +423,10 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, } } -fn check_exhaustive<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, +fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, scrut_ty: Ty<'tcx>, sp: Span, - matrix: &Matrix<'a, 'tcx>) { + matrix: &Matrix<'p, 'tcx>) { let wild_pattern = Pattern { ty: scrut_ty, span: DUMMY_SP, @@ -559,7 +520,7 @@ fn check_legality_of_move_bindings(cx: &MatchVisitor, match bm { ty::BindByValue(..) => { let pat_ty = cx.tables.node_id_to_type(p.hir_id); - if pat_ty.moves_by_default(cx.tcx, cx.param_env, pat.span) { + if !pat_ty.is_copy_modulo_regions(cx.tcx, cx.param_env, pat.span) { check_move(p, sub.as_ref().map(|p| &**p), span_vec); } } diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 941744c0aab..7d48cdc1d8a 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Code to validate patterns/matches mod _match; @@ -19,11 +9,13 @@ pub(crate) use self::check_match::check_match; use const_eval::{const_field, const_variant_index}; use hair::util::UserAnnotatedTyHelpers; +use hair::constant::*; use rustc::mir::{fmt_const_val, Field, BorrowKind, Mutability}; -use rustc::mir::{ProjectionElem, UserTypeAnnotation, UserTypeProjection, UserTypeProjections}; +use rustc::mir::{UserTypeProjection}; use rustc::mir::interpret::{Scalar, GlobalId, ConstValue, sign_extend}; -use rustc::ty::{self, Region, TyCtxt, AdtDef, Ty}; +use rustc::ty::{self, Region, TyCtxt, AdtDef, Ty, Lift, UserType}; +use rustc::ty::{CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations}; use rustc::ty::subst::{Substs, Kind}; use rustc::ty::layout::VariantIdx; use rustc::hir::{self, PatKind, RangeEnd}; @@ -37,7 +29,6 @@ use std::fmt; use syntax::ast; use syntax::ptr::P; use syntax_pos::Span; -use syntax_pos::symbol::Symbol; #[derive(Clone, Debug)] pub enum PatternError { @@ -48,9 +39,9 @@ pub enum PatternError { } #[derive(Copy, Clone, Debug)] -pub enum BindingMode<'tcx> { +pub enum BindingMode { ByValue, - ByRef(Region<'tcx>, BorrowKind), + ByRef(BorrowKind), } #[derive(Clone, Debug)] @@ -68,113 +59,32 @@ pub struct Pattern<'tcx> { #[derive(Clone, Debug)] -pub(crate) struct PatternTypeProjections<'tcx> { - contents: Vec<(PatternTypeProjection<'tcx>, Span)>, -} - -impl<'tcx> PatternTypeProjections<'tcx> { - pub(crate) fn user_ty(self) -> UserTypeProjections<'tcx> { - UserTypeProjections::from_projections( - self.contents.into_iter().map(|(pat_ty_proj, span)| (pat_ty_proj.user_ty(), span))) - } - - pub(crate) fn none() -> Self { - PatternTypeProjections { contents: vec![] } - } - - pub(crate) fn ref_binding(&self) -> Self { - // FIXME(#47184): ignore for now - PatternTypeProjections { contents: vec![] } - } - - fn map_projs(&self, - mut f: impl FnMut(&PatternTypeProjection<'tcx>) -> PatternTypeProjection<'tcx>) - -> Self - { - PatternTypeProjections { - contents: self.contents - .iter() - .map(|(proj, span)| (f(proj), *span)) - .collect(), } - } - - pub(crate) fn index(&self) -> Self { self.map_projs(|pat_ty_proj| pat_ty_proj.index()) } - - pub(crate) fn subslice(&self, from: u32, to: u32) -> Self { - self.map_projs(|pat_ty_proj| pat_ty_proj.subslice(from, to)) - } - - pub(crate) fn deref(&self) -> Self { self.map_projs(|pat_ty_proj| pat_ty_proj.deref()) } - - pub(crate) fn leaf(&self, field: Field) -> Self { - self.map_projs(|pat_ty_proj| pat_ty_proj.leaf(field)) - } - - pub(crate) fn variant(&self, - adt_def: &'tcx AdtDef, - variant_index: VariantIdx, - field: Field) -> Self { - self.map_projs(|pat_ty_proj| pat_ty_proj.variant(adt_def, variant_index, field)) - } - - pub(crate) fn add_user_type(&self, user_ty: &PatternTypeProjection<'tcx>, sp: Span) -> Self { - let mut new = self.clone(); - new.contents.push((user_ty.clone(), sp)); - new - } +pub struct PatternTypeProjection<'tcx> { + pub user_ty: CanonicalUserType<'tcx>, } -#[derive(Clone, Debug)] -pub struct PatternTypeProjection<'tcx>(UserTypeProjection<'tcx>); - impl<'tcx> PatternTypeProjection<'tcx> { - pub(crate) fn index(&self) -> Self { - let mut new = self.clone(); - new.0.projs.push(ProjectionElem::Index(())); - new - } - - pub(crate) fn subslice(&self, from: u32, to: u32) -> Self { - let mut new = self.clone(); - new.0.projs.push(ProjectionElem::Subslice { from, to }); - new - } - - pub(crate) fn deref(&self) -> Self { - let mut new = self.clone(); - new.0.projs.push(ProjectionElem::Deref); - new - } - - pub(crate) fn leaf(&self, field: Field) -> Self { - let mut new = self.clone(); - new.0.projs.push(ProjectionElem::Field(field, ())); - new - } - - pub(crate) fn variant(&self, - adt_def: &'tcx AdtDef, - variant_index: VariantIdx, - field: Field) -> Self { - let mut new = self.clone(); - new.0.projs.push(ProjectionElem::Downcast(adt_def, variant_index)); - new.0.projs.push(ProjectionElem::Field(field, ())); - new - } - - pub(crate) fn from_canonical_ty(c_ty: ty::CanonicalTy<'tcx>) -> Self { - Self::from_user_type(UserTypeAnnotation::Ty(c_ty)) - } - - pub(crate) fn from_user_type(u_ty: UserTypeAnnotation<'tcx>) -> Self { - Self::from_user_type_proj(UserTypeProjection { base: u_ty, projs: vec![], }) + pub(crate) fn from_user_type(user_annotation: CanonicalUserType<'tcx>) -> Self { + Self { + user_ty: user_annotation, + } } - pub(crate) fn from_user_type_proj(u_ty: UserTypeProjection<'tcx>) -> Self { - PatternTypeProjection(u_ty) + pub(crate) fn user_ty( + self, + annotations: &mut CanonicalUserTypeAnnotations<'tcx>, + inferred_ty: Ty<'tcx>, + span: Span, + ) -> UserTypeProjection<'tcx> { + UserTypeProjection { + base: annotations.push(CanonicalUserTypeAnnotation { + span, + user_ty: self.user_ty, + inferred_ty, + }), + projs: Vec::new(), + } } - - pub(crate) fn user_ty(self) -> UserTypeProjection<'tcx> { self.0 } } #[derive(Clone, Debug)] @@ -184,6 +94,25 @@ pub enum PatternKind<'tcx> { AscribeUserType { user_ty: PatternTypeProjection<'tcx>, subpattern: Pattern<'tcx>, + /// Variance to use when relating the type `user_ty` to the **type of the value being + /// matched**. Typically, this is `Variance::Covariant`, since the value being matched must + /// have a type that is some subtype of the ascribed type. + /// + /// Note that this variance does not apply for any bindings within subpatterns. The type + /// assigned to those bindings must be exactly equal to the `user_ty` given here. + /// + /// The only place where this field is not `Covariant` is when matching constants, where + /// we currently use `Contravariant` -- this is because the constant type just needs to + /// be "comparable" to the type of the input value. So, for example: + /// + /// ```text + /// match x { "foo" => .. } + /// ``` + /// + /// requires that `&'static str <: T_x`, where `T_x` is the type of `x`. Really, we should + /// probably be checking for a `PartialEq` impl instead, but this preserves the behavior + /// of the old type-check for now. See #57280 for details. + variance: ty::Variance, user_ty_span: Span, }, @@ -191,7 +120,7 @@ pub enum PatternKind<'tcx> { Binding { mutability: Mutability, name: ast::Name, - mode: BindingMode<'tcx>, + mode: BindingMode, var: ast::NodeId, ty: Ty<'tcx>, subpattern: Option>, @@ -216,19 +145,14 @@ pub enum PatternKind<'tcx> { }, Constant { - value: &'tcx ty::Const<'tcx>, + value: ty::Const<'tcx>, }, - Range { - lo: &'tcx ty::Const<'tcx>, - hi: &'tcx ty::Const<'tcx>, - ty: Ty<'tcx>, - end: RangeEnd, - }, + Range(PatternRange<'tcx>), /// matches against a slice, checking the length and extracting elements. /// irrefutable when there is a slice pattern and both `prefix` and `suffix` are empty. - /// e.g. `&[ref xs..]`. + /// e.g., `&[ref xs..]`. Slice { prefix: Vec>, slice: Option>, @@ -243,6 +167,14 @@ pub enum PatternKind<'tcx> { }, } +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct PatternRange<'tcx> { + pub lo: ty::Const<'tcx>, + pub hi: ty::Const<'tcx>, + pub ty: Ty<'tcx>, + pub end: RangeEnd, +} + impl<'tcx> fmt::Display for Pattern<'tcx> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self.kind { @@ -252,7 +184,7 @@ impl<'tcx> fmt::Display for Pattern<'tcx> { PatternKind::Binding { mutability, name, mode, ref subpattern, .. } => { let is_mut = match mode { BindingMode::ByValue => mutability == Mutability::Mut, - BindingMode::ByRef(_, bk) => { + BindingMode::ByRef(bk) => { write!(f, "ref ")?; match bk { BorrowKind::Mut { .. } => true, _ => false } } @@ -287,7 +219,7 @@ impl<'tcx> fmt::Display for Pattern<'tcx> { let mut start_or_continue = || if first { first = false; "" } else { ", " }; if let Some(variant) = variant { - write!(f, "{}", variant.name)?; + write!(f, "{}", variant.ident)?; // Only for Adt we can have `S {...}`, // which we handle separately here. @@ -354,7 +286,7 @@ impl<'tcx> fmt::Display for Pattern<'tcx> { PatternKind::Constant { value } => { fmt_const_val(f, value) } - PatternKind::Range { lo, hi, ty: _, end } => { + PatternKind::Range(PatternRange { lo, hi, ty: _, end }) => { fmt_const_val(f, lo)?; match end { RangeEnd::Included => write!(f, "..=")?, @@ -483,7 +415,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { ); match (end, cmp) { (RangeEnd::Excluded, Some(Ordering::Less)) => - PatternKind::Range { lo, hi, ty, end }, + PatternKind::Range(PatternRange { lo, hi, ty, end }), (RangeEnd::Excluded, _) => { span_err!( self.tcx.sess, @@ -497,7 +429,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatternKind::Constant { value: lo } } (RangeEnd::Included, Some(Ordering::Less)) => { - PatternKind::Range { lo, hi, ty, end } + PatternKind::Range(PatternRange { lo, hi, ty, end }) } (RangeEnd::Included, _) => { let mut err = struct_span_err!( @@ -583,12 +515,9 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatKind::Binding(_, id, ident, ref sub) => { let var_ty = self.tables.node_id_to_type(pat.hir_id); - let region = match var_ty.sty { - ty::Ref(r, _, _) => Some(r), - ty::Error => { // Avoid ICE - return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) }; - } - _ => None, + if let ty::Error = var_ty.sty { + // Avoid ICE + return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) }; }; let bm = *self.tables.pat_binding_modes().get(pat.hir_id) .expect("missing binding mode"); @@ -599,10 +528,10 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { (Mutability::Not, BindingMode::ByValue), ty::BindByReference(hir::MutMutable) => (Mutability::Not, BindingMode::ByRef( - region.unwrap(), BorrowKind::Mut { allow_two_phase_borrow: false })), + BorrowKind::Mut { allow_two_phase_borrow: false })), ty::BindByReference(hir::MutImmutable) => (Mutability::Not, BindingMode::ByRef( - region.unwrap(), BorrowKind::Shared)), + BorrowKind::Shared)), }; // A ref x pattern is the same node used for x, and as such it has @@ -795,19 +724,16 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { }; if let Some(user_ty) = self.user_substs_applied_to_ty_of_hir_id(hir_id) { - let subpattern = Pattern { - span, - ty, - kind: Box::new(kind), - }; - - debug!("pattern user_ty = {:?} for pattern at {:?}", user_ty, span); - - let pat_ty = PatternTypeProjection::from_user_type(user_ty); + debug!("lower_variant_or_leaf: kind={:?} user_ty={:?} span={:?}", kind, user_ty, span); kind = PatternKind::AscribeUserType { - subpattern, - user_ty: pat_ty, + subpattern: Pattern { + span, + ty, + kind: Box::new(kind), + }, + user_ty: PatternTypeProjection::from_user_type(user_ty), user_ty_span: span, + variance: ty::Variance::Covariant, }; } @@ -844,7 +770,31 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { }; match self.tcx.at(span).const_eval(self.param_env.and(cid)) { Ok(value) => { - return self.const_to_pat(instance, value, id, span) + let pattern = self.const_to_pat(instance, value, id, span); + if !is_associated_const { + return pattern; + } + + let user_provided_types = self.tables().user_provided_types(); + return if let Some(u_ty) = user_provided_types.get(id) { + let user_ty = PatternTypeProjection::from_user_type(*u_ty); + Pattern { + span, + kind: Box::new( + PatternKind::AscribeUserType { + subpattern: pattern, + /// Note that use `Contravariant` here. See the + /// `variance` field documentation for details. + variance: ty::Variance::Contravariant, + user_ty, + user_ty_span: span, + } + ), + ty: value.ty, + } + } else { + pattern + } }, Err(_) => { self.tcx.sess.span_err( @@ -891,12 +841,11 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { ); *self.const_to_pat(instance, val, expr.hir_id, lit.span).kind }, - Err(e) => { - if e == LitToConstError::UnparseableFloat { - self.errors.push(PatternError::FloatBug); - } + Err(LitToConstError::UnparseableFloat) => { + self.errors.push(PatternError::FloatBug); PatternKind::Wild }, + Err(LitToConstError::Reported) => PatternKind::Wild, } }, hir::ExprKind::Path(ref qpath) => *self.lower_path(qpath, expr.hir_id, expr.span).kind, @@ -914,12 +863,11 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { ); *self.const_to_pat(instance, val, expr.hir_id, lit.span).kind }, - Err(e) => { - if e == LitToConstError::UnparseableFloat { - self.errors.push(PatternError::FloatBug); - } + Err(LitToConstError::UnparseableFloat) => { + self.errors.push(PatternError::FloatBug); PatternKind::Wild }, + Err(LitToConstError::Reported) => PatternKind::Wild, } } _ => span_bug!(expr.span, "not a literal: {:?}", expr), @@ -932,15 +880,15 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { fn const_to_pat( &self, instance: ty::Instance<'tcx>, - cv: &'tcx ty::Const<'tcx>, + cv: ty::Const<'tcx>, id: hir::HirId, span: Span, ) -> Pattern<'tcx> { - debug!("const_to_pat: cv={:#?}", cv); + debug!("const_to_pat: cv={:#?} id={:?}", cv, id); let adt_subpattern = |i, variant_opt| { let field = Field::new(i); let val = const_field( - self.tcx, self.param_env, instance, + self.tcx, self.param_env, variant_opt, field, cv, ).expect("field access failed"); self.const_to_pat(instance, val, id, span) @@ -954,9 +902,10 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { } }).collect::>() }; + debug!("const_to_pat: cv.ty={:?} span={:?}", cv.ty, span); let kind = match cv.ty.sty { ty::Float(_) => { - let id = self.tcx.hir.hir_to_node_id(id); + let id = self.tcx.hir().hir_to_node_id(id); self.tcx.lint_node( ::rustc::lint::builtin::ILLEGAL_FLOATING_POINT_LITERAL_PATTERN, id, @@ -982,7 +931,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { }, ty::Adt(adt_def, substs) if adt_def.is_enum() => { let variant_index = const_variant_index( - self.tcx, self.param_env, instance, cv + self.tcx, self.param_env, cv ).expect("const_variant_index failed"); let subpatterns = adt_subpatterns( adt_def.variants[variant_index].fields.len(), @@ -1092,9 +1041,9 @@ macro_rules! CloneImpls { } CloneImpls!{ <'tcx> - Span, Field, Mutability, ast::Name, ast::NodeId, usize, &'tcx ty::Const<'tcx>, - Region<'tcx>, Ty<'tcx>, BindingMode<'tcx>, &'tcx AdtDef, - &'tcx Substs<'tcx>, &'tcx Kind<'tcx>, UserTypeAnnotation<'tcx>, + Span, Field, Mutability, ast::Name, ast::NodeId, usize, ty::Const<'tcx>, + Region<'tcx>, Ty<'tcx>, BindingMode, &'tcx AdtDef, + &'tcx Substs<'tcx>, &'tcx Kind<'tcx>, UserType<'tcx>, UserTypeProjection<'tcx>, PatternTypeProjection<'tcx> } @@ -1131,11 +1080,13 @@ impl<'tcx> PatternFoldable<'tcx> for PatternKind<'tcx> { PatternKind::Wild => PatternKind::Wild, PatternKind::AscribeUserType { ref subpattern, + variance, ref user_ty, user_ty_span, } => PatternKind::AscribeUserType { subpattern: subpattern.fold_with(folder), user_ty: user_ty.fold_with(folder), + variance, user_ty_span, }, PatternKind::Binding { @@ -1179,17 +1130,17 @@ impl<'tcx> PatternFoldable<'tcx> for PatternKind<'tcx> { } => PatternKind::Constant { value: value.fold_with(folder) }, - PatternKind::Range { + PatternKind::Range(PatternRange { lo, hi, ty, end, - } => PatternKind::Range { + }) => PatternKind::Range(PatternRange { lo: lo.fold_with(folder), hi: hi.fold_with(folder), ty: ty.fold_with(folder), end, - }, + }), PatternKind::Slice { ref prefix, ref slice, @@ -1212,10 +1163,10 @@ impl<'tcx> PatternFoldable<'tcx> for PatternKind<'tcx> { } } -pub fn compare_const_vals<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - a: &'tcx ty::Const<'tcx>, - b: &'tcx ty::Const<'tcx>, +pub fn compare_const_vals<'a, 'gcx, 'tcx>( + tcx: TyCtxt<'a, 'gcx, 'tcx>, + a: ty::Const<'tcx>, + b: ty::Const<'tcx>, ty: ty::ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> Option { trace!("compare_const_vals: {:?}, {:?}", a, b); @@ -1235,6 +1186,9 @@ pub fn compare_const_vals<'a, 'tcx>( return fallback(); } + let tcx = tcx.global_tcx(); + let (a, b, ty) = (a, b, ty).lift_to_tcx(tcx).unwrap(); + // FIXME: This should use assert_bits(ty) instead of use_bits // but triggers possibly bugs due to mismatching of arrays and slices if let (Some(a), Some(b)) = (a.to_bits(tcx, ty), b.to_bits(tcx, ty)) { @@ -1261,157 +1215,30 @@ pub fn compare_const_vals<'a, 'tcx>( } } - if let ty::Ref(_, rty, _) = ty.value.sty { - if let ty::Str = rty.sty { - match (a.val, b.val) { - ( - ConstValue::ScalarPair( - Scalar::Ptr(ptr_a), - len_a, - ), - ConstValue::ScalarPair( - Scalar::Ptr(ptr_b), - len_b, - ), - ) if ptr_a.offset.bytes() == 0 && ptr_b.offset.bytes() == 0 => { - if let Ok(len_a) = len_a.to_bits(tcx.data_layout.pointer_size) { - if let Ok(len_b) = len_b.to_bits(tcx.data_layout.pointer_size) { - if len_a == len_b { - let map = tcx.alloc_map.lock(); - let alloc_a = map.unwrap_memory(ptr_a.alloc_id); - let alloc_b = map.unwrap_memory(ptr_b.alloc_id); - if alloc_a.bytes.len() as u128 == len_a { - return from_bool(alloc_a == alloc_b); - } - } - } + if let ty::Str = ty.value.sty { + match (a.val, b.val) { + ( + ConstValue::Slice( + Scalar::Ptr(ptr_a), + len_a, + ), + ConstValue::Slice( + Scalar::Ptr(ptr_b), + len_b, + ), + ) if ptr_a.offset.bytes() == 0 && ptr_b.offset.bytes() == 0 => { + if len_a == len_b { + let map = tcx.alloc_map.lock(); + let alloc_a = map.unwrap_memory(ptr_a.alloc_id); + let alloc_b = map.unwrap_memory(ptr_b.alloc_id); + if alloc_a.bytes.len() as u64 == len_a { + return from_bool(alloc_a == alloc_b); } } - _ => (), } + _ => (), } } fallback() } - -#[derive(PartialEq)] -enum LitToConstError { - UnparseableFloat, - Propagated, -} - -// FIXME: Combine with rustc_mir::hair::cx::const_eval_literal -fn lit_to_const<'a, 'tcx>(lit: &'tcx ast::LitKind, - tcx: TyCtxt<'a, 'tcx, 'tcx>, - ty: Ty<'tcx>, - neg: bool) - -> Result<&'tcx ty::Const<'tcx>, LitToConstError> { - use syntax::ast::*; - - use rustc::mir::interpret::*; - let lit = match *lit { - LitKind::Str(ref s, _) => { - let s = s.as_str(); - let id = tcx.allocate_bytes(s.as_bytes()); - ConstValue::new_slice(Scalar::Ptr(id.into()), s.len() as u64, &tcx) - }, - LitKind::ByteStr(ref data) => { - let id = tcx.allocate_bytes(data); - ConstValue::Scalar(Scalar::Ptr(id.into())) - }, - LitKind::Byte(n) => ConstValue::Scalar(Scalar::Bits { - bits: n as u128, - size: 1, - }), - LitKind::Int(n, _) => { - enum Int { - Signed(IntTy), - Unsigned(UintTy), - } - let ity = match ty.sty { - ty::Int(IntTy::Isize) => Int::Signed(tcx.sess.target.isize_ty), - ty::Int(other) => Int::Signed(other), - ty::Uint(UintTy::Usize) => Int::Unsigned(tcx.sess.target.usize_ty), - ty::Uint(other) => Int::Unsigned(other), - ty::Error => { // Avoid ICE (#51963) - return Err(LitToConstError::Propagated); - } - _ => bug!("literal integer type with bad type ({:?})", ty.sty), - }; - // This converts from LitKind::Int (which is sign extended) to - // Scalar::Bytes (which is zero extended) - let n = match ity { - // FIXME(oli-obk): are these casts correct? - Int::Signed(IntTy::I8) if neg => - (n as i8).overflowing_neg().0 as u8 as u128, - Int::Signed(IntTy::I16) if neg => - (n as i16).overflowing_neg().0 as u16 as u128, - Int::Signed(IntTy::I32) if neg => - (n as i32).overflowing_neg().0 as u32 as u128, - Int::Signed(IntTy::I64) if neg => - (n as i64).overflowing_neg().0 as u64 as u128, - Int::Signed(IntTy::I128) if neg => - (n as i128).overflowing_neg().0 as u128, - Int::Signed(IntTy::I8) | Int::Unsigned(UintTy::U8) => n as u8 as u128, - Int::Signed(IntTy::I16) | Int::Unsigned(UintTy::U16) => n as u16 as u128, - Int::Signed(IntTy::I32) | Int::Unsigned(UintTy::U32) => n as u32 as u128, - Int::Signed(IntTy::I64) | Int::Unsigned(UintTy::U64) => n as u64 as u128, - Int::Signed(IntTy::I128)| Int::Unsigned(UintTy::U128) => n, - _ => bug!(), - }; - let size = tcx.layout_of(ty::ParamEnv::empty().and(ty)).unwrap().size.bytes() as u8; - ConstValue::Scalar(Scalar::Bits { - bits: n, - size, - }) - }, - LitKind::Float(n, fty) => { - parse_float(n, fty, neg).map_err(|_| LitToConstError::UnparseableFloat)? - } - LitKind::FloatUnsuffixed(n) => { - let fty = match ty.sty { - ty::Float(fty) => fty, - _ => bug!() - }; - parse_float(n, fty, neg).map_err(|_| LitToConstError::UnparseableFloat)? - } - LitKind::Bool(b) => ConstValue::Scalar(Scalar::from_bool(b)), - LitKind::Char(c) => ConstValue::Scalar(Scalar::from_char(c)), - }; - Ok(ty::Const::from_const_value(tcx, lit, ty)) -} - -pub fn parse_float<'tcx>( - num: Symbol, - fty: ast::FloatTy, - neg: bool, -) -> Result, ()> { - let num = num.as_str(); - use rustc_apfloat::ieee::{Single, Double}; - use rustc_apfloat::Float; - let (bits, size) = match fty { - ast::FloatTy::F32 => { - num.parse::().map_err(|_| ())?; - let mut f = num.parse::().unwrap_or_else(|e| { - panic!("apfloat::ieee::Single failed to parse `{}`: {:?}", num, e) - }); - if neg { - f = -f; - } - (f.to_bits(), 4) - } - ast::FloatTy::F64 => { - num.parse::().map_err(|_| ())?; - let mut f = num.parse::().unwrap_or_else(|e| { - panic!("apfloat::ieee::Single failed to parse `{}`: {:?}", num, e) - }); - if neg { - f = -f; - } - (f.to_bits(), 8) - } - }; - - Ok(ConstValue::Scalar(Scalar::Bits { bits, size })) -} diff --git a/src/librustc_mir/hair/util.rs b/src/librustc_mir/hair/util.rs index f81a0fa5dfa..cb4a72387fa 100644 --- a/src/librustc_mir/hair/util.rs +++ b/src/librustc_mir/hair/util.rs @@ -1,47 +1,31 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir; -use rustc::mir::UserTypeAnnotation; -use rustc::ty::{self, AdtDef, TyCtxt}; +use rustc::ty::{self, CanonicalUserType, TyCtxt, UserType}; crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> { fn tcx(&self) -> TyCtxt<'_, 'gcx, 'tcx>; fn tables(&self) -> &ty::TypeckTables<'tcx>; - fn user_substs_applied_to_adt( - &self, - hir_id: hir::HirId, - adt_def: &'tcx AdtDef, - ) -> Option> { - let user_substs = self.tables().user_substs(hir_id)?; - Some(UserTypeAnnotation::TypeOf(adt_def.did, user_substs)) - } - /// Looks up the type associated with this hir-id and applies the /// user-given substitutions; the hir-id must map to a suitable /// type. fn user_substs_applied_to_ty_of_hir_id( &self, hir_id: hir::HirId, - ) -> Option> { - let user_substs = self.tables().user_substs(hir_id)?; + ) -> Option> { + let user_provided_types = self.tables().user_provided_types(); + let mut user_ty = *user_provided_types.get(hir_id)?; + debug!("user_subts_applied_to_ty_of_hir_id: user_ty={:?}", user_ty); match &self.tables().node_id_to_type(hir_id).sty { - ty::Adt(adt_def, _) => Some(UserTypeAnnotation::TypeOf(adt_def.did, user_substs)), - ty::FnDef(def_id, _) => Some(UserTypeAnnotation::TypeOf(*def_id, user_substs)), - sty => bug!( - "sty: {:?} should not have user-substs {:?} recorded ", - sty, - user_substs - ), + ty::Adt(adt_def, ..) => { + if let UserType::TypeOf(ref mut did, _) = &mut user_ty.value { + *did = adt_def.did; + } + Some(user_ty) + } + ty::FnDef(..) => Some(user_ty), + sty => + bug!("sty: {:?} should not have user provided type {:?} recorded ", sty, user_ty), } } } diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index 7d636b77ced..c3b71be8354 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty::{self, Ty, TypeAndMut}; use rustc::ty::layout::{self, TyLayout, Size}; use syntax::ast::{FloatTy, IntTy, UintTy}; @@ -44,22 +34,16 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } Misc => { - let src_layout = src.layout; let src = self.read_immediate(src)?; - // There are no casts to references - assert!(!dest.layout.ty.is_region_ptr()); - // Hence we make all casts erase the tag - let src = src.erase_tag().with_default_tag(); - - if self.type_is_fat_ptr(src_layout.ty) { - match (src, self.type_is_fat_ptr(dest.layout.ty)) { + if self.type_is_fat_ptr(src.layout.ty) { + match (*src, self.type_is_fat_ptr(dest.layout.ty)) { // pointers to extern types (Immediate::Scalar(_),_) | // slices and trait objects to other slices/trait objects (Immediate::ScalarPair(..), true) => { // No change to immediate - self.write_immediate(src, dest)?; + self.write_immediate(*src, dest)?; } // slices and trait objects to thin pointers (dropping the metadata) (Immediate::ScalarPair(data, _), false) => { @@ -67,11 +51,11 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } } } else { - match src_layout.variants { + match src.layout.variants { layout::Variants::Single { index } => { - if let Some(def) = src_layout.ty.ty_adt_def() { + if let Some(def) = src.layout.ty.ty_adt_def() { // Cast from a univariant enum - assert!(src_layout.is_zst()); + assert!(src.layout.is_zst()); let discr_val = def .discriminant_for_variant(*self.tcx, index) .val; @@ -84,7 +68,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> layout::Variants::NicheFilling { .. } => {}, } - let dest_val = self.cast_scalar(src.to_scalar()?, src_layout, dest.layout)?; + let dest_val = self.cast_scalar(src.to_scalar()?, src.layout, dest.layout)?; self.write_scalar(dest_val, dest)?; } } @@ -125,11 +109,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> // The src operand does not matter, just its type match src.layout.ty.sty { ty::Closure(def_id, substs) => { - let substs = self.tcx.subst_and_normalize_erasing_regions( - self.substs(), - ty::ParamEnv::reveal_all(), - &substs, - ); + let substs = self.subst_and_normalize_erasing_regions(substs)?; let instance = ty::Instance::resolve_closure( *self.tcx, def_id, diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 59083413582..1b976d822eb 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -1,13 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +use std::cell::Cell; use std::fmt::Write; use std::mem; @@ -49,15 +40,15 @@ pub struct EvalContext<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>> { pub(crate) memory: Memory<'a, 'mir, 'tcx, M>, /// The virtual call stack. - pub(crate) stack: Vec>, + pub(crate) stack: Vec>, /// A cache for deduplicating vtables - pub(super) vtables: FxHashMap<(Ty<'tcx>, ty::PolyExistentialTraitRef<'tcx>), AllocId>, + pub(super) vtables: FxHashMap<(Ty<'tcx>, Option>), AllocId>, } /// A stack frame. #[derive(Clone)] -pub struct Frame<'mir, 'tcx: 'mir, Tag=()> { +pub struct Frame<'mir, 'tcx: 'mir, Tag=(), Extra=()> { //////////////////////////////////////////////////////////////////////////////// // Function and callsite information //////////////////////////////////////////////////////////////////////////////// @@ -85,7 +76,7 @@ pub struct Frame<'mir, 'tcx: 'mir, Tag=()> { /// The locals are stored as `Option`s. /// `None` represents a local that is currently dead, while a live local /// can either directly contain `Scalar` or refer to some part of an `Allocation`. - pub locals: IndexVec>, + pub locals: IndexVec>, //////////////////////////////////////////////////////////////////////////////// // Current position within the function @@ -96,6 +87,9 @@ pub struct Frame<'mir, 'tcx: 'mir, Tag=()> { /// The index of the currently evaluated statement. pub stmt: usize, + + /// Extra data for the machine + pub extra: Extra, } #[derive(Clone, Debug, Eq, PartialEq, Hash)] @@ -111,7 +105,15 @@ pub enum StackPopCleanup { None { cleanup: bool }, } -// State of a local variable +/// State of a local variable including a memoized layout +#[derive(Clone, PartialEq, Eq)] +pub struct LocalState<'tcx, Tag=(), Id=AllocId> { + pub state: LocalValue, + /// Don't modify if `Some`, this is only used to prevent computing the layout twice + pub layout: Cell>>, +} + +/// State of a local variable #[derive(Copy, Clone, PartialEq, Eq, Hash)] pub enum LocalValue { Dead, @@ -122,16 +124,16 @@ pub enum LocalValue { Live(Operand), } -impl<'tcx, Tag> LocalValue { +impl<'tcx, Tag> LocalState<'tcx, Tag> { pub fn access(&self) -> EvalResult<'tcx, &Operand> { - match self { + match self.state { LocalValue::Dead => err!(DeadLocal), LocalValue::Live(ref val) => Ok(val), } } pub fn access_mut(&mut self) -> EvalResult<'tcx, &mut Operand> { - match self { + match self.state { LocalValue::Dead => err!(DeadLocal), LocalValue::Live(ref mut val) => Ok(val), } @@ -196,7 +198,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc } #[inline(always)] - pub fn stack(&self) -> &[Frame<'mir, 'tcx, M::PointerTag>] { + pub fn stack(&self) -> &[Frame<'mir, 'tcx, M::PointerTag, M::FrameExtra>] { &self.stack } @@ -207,12 +209,12 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc } #[inline(always)] - pub fn frame(&self) -> &Frame<'mir, 'tcx, M::PointerTag> { + pub fn frame(&self) -> &Frame<'mir, 'tcx, M::PointerTag, M::FrameExtra> { self.stack.last().expect("no call frames exist") } #[inline(always)] - pub fn frame_mut(&mut self) -> &mut Frame<'mir, 'tcx, M::PointerTag> { + pub fn frame_mut(&mut self) -> &mut Frame<'mir, 'tcx, M::PointerTag, M::FrameExtra> { self.stack.last_mut().expect("no call frames exist") } @@ -221,11 +223,21 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc self.frame().mir } - pub fn substs(&self) -> &'tcx Substs<'tcx> { - if let Some(frame) = self.stack.last() { - frame.instance.substs - } else { - Substs::empty() + pub(super) fn subst_and_normalize_erasing_regions>( + &self, + substs: T, + ) -> EvalResult<'tcx, T> { + match self.stack.last() { + Some(frame) => Ok(self.tcx.subst_and_normalize_erasing_regions( + frame.instance.substs, + self.param_env, + &substs, + )), + None => if substs.needs_subst() { + err!(TooGeneric).into() + } else { + Ok(substs) + }, } } @@ -235,13 +247,9 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc substs: &'tcx Substs<'tcx> ) -> EvalResult<'tcx, ty::Instance<'tcx>> { trace!("resolve: {:?}, {:#?}", def_id, substs); - trace!("substs: {:#?}", self.substs()); trace!("param_env: {:#?}", self.param_env); - let substs = self.tcx.subst_and_normalize_erasing_regions( - self.substs(), - self.param_env, - &substs, - ); + let substs = self.subst_and_normalize_erasing_regions(substs)?; + trace!("substs: {:#?}", substs); ty::Instance::resolve( *self.tcx, self.param_env, @@ -272,16 +280,30 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc } trace!("load mir {:?}", instance); match instance { - ty::InstanceDef::Item(def_id) => { - self.tcx.maybe_optimized_mir(def_id).ok_or_else(|| - EvalErrorKind::NoMirFor(self.tcx.item_path_str(def_id)).into() - ) - } + ty::InstanceDef::Item(def_id) => if self.tcx.is_mir_available(did) { + Ok(self.tcx.optimized_mir(did)) + } else { + err!(NoMirFor(self.tcx.item_path_str(def_id))) + }, _ => Ok(self.tcx.instance_mir(instance)), } } - pub fn monomorphize + Subst<'tcx>>( + pub(super) fn monomorphize + Subst<'tcx>>( + &self, + t: T, + ) -> EvalResult<'tcx, T> { + match self.stack.last() { + Some(frame) => Ok(self.monomorphize_with_substs(t, frame.instance.substs)), + None => if t.needs_subst() { + err!(TooGeneric).into() + } else { + Ok(t) + }, + } + } + + fn monomorphize_with_substs + Subst<'tcx>>( &self, t: T, substs: &'tcx Substs<'tcx> @@ -294,12 +316,22 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc pub fn layout_of_local( &self, - frame: &Frame<'mir, 'tcx, M::PointerTag>, - local: mir::Local + frame: &Frame<'mir, 'tcx, M::PointerTag, M::FrameExtra>, + local: mir::Local, + layout: Option>, ) -> EvalResult<'tcx, TyLayout<'tcx>> { - let local_ty = frame.mir.local_decls[local].ty; - let local_ty = self.monomorphize(local_ty, frame.instance.substs); - self.layout_of(local_ty) + match frame.locals[local].layout.get() { + None => { + let layout = ::interpret::operand::from_known_layout(layout, || { + let local_ty = frame.mir.local_decls[local].ty; + let local_ty = self.monomorphize_with_substs(local_ty, frame.instance.substs); + self.layout_of(local_ty) + })?; + frame.locals[local].layout.set(Some(layout)); + Ok(layout) + } + Some(layout) => Ok(layout), + } } pub fn str_to_immediate(&mut self, s: &str) -> EvalResult<'tcx, Immediate> { @@ -316,7 +348,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc layout: TyLayout<'tcx>, ) -> EvalResult<'tcx, Option<(Size, Align)>> { if !layout.is_unsized() { - return Ok(Some(layout.size_and_align())); + return Ok(Some((layout.size, layout.align.abi))); } match layout.ty.sty { ty::Adt(..) | ty::Tuple(..) => { @@ -328,7 +360,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc trace!("DST layout: {:?}", layout); let sized_size = layout.fields.offset(layout.fields.count() - 1); - let sized_align = layout.align; + let sized_align = layout.align.abi; trace!( "DST {} statically sized prefix size: {:?} align: {:?}", layout.ty, @@ -381,7 +413,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc // // `(size + (align-1)) & -align` - Ok(Some((size.abi_align(align), align))) + Ok(Some((size.align_to(align), align))) } ty::Dynamic(..) => { let vtable = metadata.expect("dyn trait fat ptr must have vtable").to_ptr()?; @@ -391,8 +423,8 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc ty::Slice(_) | ty::Str => { let len = metadata.expect("slice fat ptr must have vtable").to_usize(self)?; - let (elem_size, align) = layout.field(self, 0)?.size_and_align(); - Ok(Some((elem_size * len, align))) + let elem = layout.field(self, 0)?; + Ok(Some((elem.size * len, elem.align.abi))) } ty::Foreign(_) => { @@ -419,11 +451,12 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc return_to_block: StackPopCleanup, ) -> EvalResult<'tcx> { if self.stack.len() > 1 { // FIXME should be "> 0", printing topmost frame crashes rustc... - debug!("PAUSING({}) {}", self.cur_frame(), self.frame().instance); + info!("PAUSING({}) {}", self.cur_frame(), self.frame().instance); } ::log_settings::settings().indentation += 1; // first push a stack frame so we have access to the local substs + let extra = M::stack_push(self)?; self.stack.push(Frame { mir, block: mir::START_BLOCK, @@ -435,6 +468,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc span, instance, stmt: 0, + extra, }); // don't allocate at all for trivial constants @@ -442,12 +476,16 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc // We put some marker immediate into the locals that we later want to initialize. // This can be anything except for LocalValue::Dead -- because *that* is the // value we use for things that we know are initially dead. - let dummy = - LocalValue::Live(Operand::Immediate(Immediate::Scalar(ScalarMaybeUndef::Undef))); + let dummy = LocalState { + state: LocalValue::Live(Operand::Immediate(Immediate::Scalar( + ScalarMaybeUndef::Undef, + ))), + layout: Cell::new(None), + }; let mut locals = IndexVec::from_elem(dummy, &mir.local_decls); // Return place is handled specially by the `eval_place` functions, and the // entry in `locals` should never be used. Make it dead, to be sure. - locals[mir::RETURN_PLACE] = LocalValue::Dead; + locals[mir::RETURN_PLACE].state = LocalValue::Dead; // Now mark those locals as dead that we do not want to initialize match self.tcx.describe_def(instance.def_id()) { // statics and constants don't have `Storage*` statements, no need to look for them @@ -460,7 +498,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc match stmt.kind { StorageLive(local) | StorageDead(local) => { - locals[local] = LocalValue::Dead; + locals[local].state = LocalValue::Dead; } _ => {} } @@ -469,12 +507,14 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc }, } // Finally, properly initialize all those that still have the dummy value - for (local, decl) in locals.iter_mut().zip(mir.local_decls.iter()) { - match *local { + for (idx, local) in locals.iter_enumerated_mut() { + match local.state { LocalValue::Live(_) => { - // This needs to be peoperly initialized. - let layout = self.layout_of(self.monomorphize(decl.ty, instance.substs))?; - *local = LocalValue::Live(self.uninit_operand(layout)?); + // This needs to be properly initialized. + let ty = self.monomorphize(mir.local_decls[idx].ty)?; + let layout = self.layout_of(ty)?; + local.state = LocalValue::Live(self.uninit_operand(layout)?); + local.layout = Cell::new(Some(layout)); } LocalValue::Dead => { // Nothing to do @@ -486,7 +526,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc } if self.stack.len() > 1 { // FIXME no check should be needed, but some instances ICE - debug!("ENTERING({}) {}", self.cur_frame(), self.frame().instance); + info!("ENTERING({}) {}", self.cur_frame(), self.frame().instance); } if self.stack.len() > self.tcx.sess.const_eval_stack_frame_limit { @@ -498,30 +538,31 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc pub(super) fn pop_stack_frame(&mut self) -> EvalResult<'tcx> { if self.stack.len() > 1 { // FIXME no check should be needed, but some instances ICE - debug!("LEAVING({}) {}", self.cur_frame(), self.frame().instance); + info!("LEAVING({}) {}", self.cur_frame(), self.frame().instance); } ::log_settings::settings().indentation -= 1; let frame = self.stack.pop().expect( "tried to pop a stack frame, but there were none", ); + M::stack_pop(self, frame.extra)?; + // Abort early if we do not want to clean up: We also avoid validation in that case, + // because this is CTFE and the final value will be thoroughly validated anyway. match frame.return_to_block { - StackPopCleanup::Goto(block) => { - self.goto_block(block)?; - } + StackPopCleanup::Goto(_) => {}, StackPopCleanup::None { cleanup } => { if !cleanup { - // Leak the locals. Also skip validation, this is only used by - // static/const computation which does its own (stronger) final - // validation. + assert!(self.stack.is_empty(), "only the topmost frame should ever be leaked"); + // Leak the locals, skip validation. return Ok(()); } } } // Deallocate all locals that are backed by an allocation. for local in frame.locals { - self.deallocate_local(local)?; + self.deallocate_local(local.state)?; } - // Validate the return value. + // Validate the return value. Do this after deallocating so that we catch dangling + // references. if let Some(return_place) = frame.return_place { if M::enforce_validity(self) { // Data got changed, better make sure it matches the type! @@ -542,9 +583,16 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc // Uh, that shouldn't happen... the function did not intend to return return err!(Unreachable); } + // Jump to new block -- *after* validation so that the spans make more sense. + match frame.return_to_block { + StackPopCleanup::Goto(block) => { + self.goto_block(block)?; + } + StackPopCleanup::None { .. } => {} + } if self.stack.len() > 1 { // FIXME should be "> 0", printing topmost frame crashes rustc... - debug!("CONTINUING({}) {}", self.cur_frame(), self.frame().instance); + info!("CONTINUING({}) {}", self.cur_frame(), self.frame().instance); } Ok(()) @@ -559,10 +607,10 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc assert!(local != mir::RETURN_PLACE, "Cannot make return place live"); trace!("{:?} is now live", local); - let layout = self.layout_of_local(self.frame(), local)?; + let layout = self.layout_of_local(self.frame(), local, None)?; let init = LocalValue::Live(self.uninit_operand(layout)?); // StorageLive *always* kills the value that's currently stored - Ok(mem::replace(&mut self.frame_mut().locals[local], init)) + Ok(mem::replace(&mut self.frame_mut().locals[local].state, init)) } /// Returns the old value of the local. @@ -571,7 +619,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc assert!(local != mir::RETURN_PLACE, "Cannot make return place dead"); trace!("{:?} is now dead", local); - mem::replace(&mut self.frame_mut().locals[local], LocalValue::Dead) + mem::replace(&mut self.frame_mut().locals[local].state, LocalValue::Dead) } pub(super) fn deallocate_local( @@ -636,7 +684,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc let (ptr, align) = mplace.to_scalar_ptr_align(); match ptr { Scalar::Ptr(ptr) => { - write!(msg, " by align({}) ref:", align.abi()).unwrap(); + write!(msg, " by align({}) ref:", align.bytes()).unwrap(); allocs.push(ptr.alloc_id); } ptr => write!(msg, " by integral ref: {:?}", ptr).unwrap(), @@ -665,7 +713,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc Place::Ptr(mplace) => { match mplace.ptr { Scalar::Ptr(ptr) => { - trace!("by align({}) ref:", mplace.align.abi()); + trace!("by align({}) ref:", mplace.align.bytes()); self.memory.dump_alloc(ptr.alloc_id); } ptr => trace!(" integral by ref: {:?}", ptr), diff --git a/src/librustc_mir/interpret/intrinsics.rs b/src/librustc_mir/interpret/intrinsics.rs index 7ef94005970..d8778dfeef7 100644 --- a/src/librustc_mir/interpret/intrinsics.rs +++ b/src/librustc_mir/interpret/intrinsics.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Intrinsics and other functions that the miri engine executes without //! looking at their MIR. Intrinsics/functions supported here are shared by CTFE //! and miri. @@ -60,7 +50,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> match intrinsic_name { "min_align_of" => { let elem_ty = substs.type_at(0); - let elem_align = self.layout_of(elem_ty)?.align.abi(); + let elem_align = self.layout_of(elem_ty)?.align.abi.bytes(); let align_val = Scalar::from_uint(elem_align, dest.layout.size); self.write_scalar(align_val, dest)?; } @@ -103,7 +93,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> if bits == 0 { return err!(Intrinsic(format!("{} called on 0", intrinsic_name))); } - numeric_intrinsic(intrinsic_name.trim_right_matches("_nonzero"), bits, kind)? + numeric_intrinsic(intrinsic_name.trim_end_matches("_nonzero"), bits, kind)? } else { numeric_intrinsic(intrinsic_name, bits, kind)? }; diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index 57640dc48f1..26d526a6f5f 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains everything needed to instantiate an interpreter. //! This separation exists to ensure that no fancy miri features like //! interpreting common C functions leak into CTFE. @@ -77,8 +67,16 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { /// The `default()` is used for pointers to consts, statics, vtables and functions. type PointerTag: ::std::fmt::Debug + Default + Copy + Eq + Hash + 'static; + /// Extra data stored in every call frame. + type FrameExtra; + + /// Extra data stored in memory. A reference to this is available when `AllocExtra` + /// gets initialized, so you can e.g., have an `Rc` here if there is global state you + /// need access to in the `AllocExtra` hooks. + type MemoryExtra: Default; + /// Extra data stored in every allocation. - type AllocExtra: AllocationExtra; + type AllocExtra: AllocationExtra + 'static; /// Memory's allocation map type MemoryMap: @@ -89,7 +87,8 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { Default + Clone; - /// The memory kind to use for copied statics -- or None if those are not supported. + /// The memory kind to use for copied statics -- or None if statics should not be mutated + /// and thus any such attempt will cause a `ModifiedStatic` error to be raised. /// Statics are copied under two circumstances: When they are mutated, and when /// `static_with_default_tag` or `find_foreign_static` (see below) returns an owned allocation /// that is added to the memory so that the work is not done twice. @@ -135,8 +134,9 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { /// the machine memory. (This relies on `AllocMap::get_or` being able to add the /// owned allocation to the map even when the map is shared.) fn find_foreign_static( - tcx: TyCtxtAt<'a, 'tcx, 'tcx>, def_id: DefId, + tcx: TyCtxtAt<'a, 'tcx, 'tcx>, + memory_extra: &Self::MemoryExtra, ) -> EvalResult<'tcx, Cow<'tcx, Allocation>>; /// Called to turn an allocation obtained from the `tcx` into one that has @@ -146,9 +146,10 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { /// allocation (because a copy had to be done to add tags or metadata), machine memory will /// cache the result. (This relies on `AllocMap::get_or` being able to add the /// owned allocation to the map even when the map is shared.) - fn adjust_static_allocation( - alloc: &'_ Allocation - ) -> Cow<'_, Allocation>; + fn adjust_static_allocation<'b>( + alloc: &'b Allocation, + memory_extra: &Self::MemoryExtra, + ) -> Cow<'b, Allocation>; /// Called for all binary operations on integer(-like) types when one operand is a pointer /// value, and for the `Offset` operation that is inherently about pointers. @@ -174,7 +175,7 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>, ptr: Pointer, kind: MemoryKind, - ) -> EvalResult<'tcx, Pointer>; + ) -> Pointer; /// Executed when evaluating the `*` operator: Following a reference. /// This has the chance to adjust the tag. It should not change anything else! @@ -192,18 +193,20 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized { #[inline] fn retag( _ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>, - _fn_entry: bool, + _kind: mir::RetagKind, _place: PlaceTy<'tcx, Self::PointerTag>, ) -> EvalResult<'tcx> { Ok(()) } - /// Execute an escape-to-raw operation - #[inline] - fn escape_to_raw( - _ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>, - _ptr: OpTy<'tcx, Self::PointerTag>, - ) -> EvalResult<'tcx> { - Ok(()) - } + /// Called immediately before a new stack frame got pushed + fn stack_push( + ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>, + ) -> EvalResult<'tcx, Self::FrameExtra>; + + /// Called immediately after a stack frame gets popped + fn stack_pop( + ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>, + extra: Self::FrameExtra, + ) -> EvalResult<'tcx>; } diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 7dd42c66649..3832d7e8d62 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The memory subsystem. //! //! Generally, we use `Pointer` to denote memory addresses. However, some operations @@ -21,16 +11,16 @@ use std::ptr; use std::borrow::Cow; use rustc::ty::{self, Instance, ParamEnv, query::TyCtxtAt}; -use rustc::ty::layout::{self, Align, TargetDataLayout, Size, HasDataLayout}; +use rustc::ty::layout::{Align, TargetDataLayout, Size, HasDataLayout}; pub use rustc::mir::interpret::{truncate, write_target_uint, read_target_uint}; use rustc_data_structures::fx::{FxHashSet, FxHashMap}; use syntax::ast::Mutability; use super::{ - Pointer, AllocId, Allocation, GlobalId, AllocationExtra, InboundsCheck, - EvalResult, Scalar, EvalErrorKind, AllocType, PointerArithmetic, - Machine, AllocMap, MayLeak, ScalarMaybeUndef, ErrorHandled, + Pointer, AllocId, Allocation, GlobalId, AllocationExtra, + EvalResult, Scalar, EvalErrorKind, AllocKind, PointerArithmetic, + Machine, AllocMap, MayLeak, ErrorHandled, InboundsCheck, }; #[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)] @@ -55,7 +45,7 @@ impl MayLeak for MemoryKind { } // `Memory` has to depend on the `Machine` because some of its operations -// (e.g. `get`) call a `Machine` hook. +// (e.g., `get`) call a `Machine` hook. pub struct Memory<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>> { /// Allocations local to this instance of the miri engine. The kind /// helps ensure that the same mechanism is used for allocation and @@ -73,6 +63,9 @@ pub struct Memory<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>> { /// that do not exist any more. dead_alloc_map: FxHashMap, + /// Extra data added by the machine. + pub extra: M::MemoryExtra, + /// Lets us implement `HasDataLayout`, which is awfully convenient. pub(super) tcx: TyCtxtAt<'a, 'tcx, 'tcx>, } @@ -88,13 +81,19 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> HasDataLayout // FIXME: Really we shouldn't clone memory, ever. Snapshot machinery should instead // carefully copy only the reachable parts. -impl<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>> - Clone for Memory<'a, 'mir, 'tcx, M> +impl<'a, 'mir, 'tcx, M> + Clone +for + Memory<'a, 'mir, 'tcx, M> +where + M: Machine<'a, 'mir, 'tcx, PointerTag=(), AllocExtra=(), MemoryExtra=()>, + M::MemoryMap: AllocMap, Allocation)>, { fn clone(&self) -> Self { Memory { alloc_map: self.alloc_map.clone(), dead_alloc_map: self.dead_alloc_map.clone(), + extra: (), tcx: self.tcx, } } @@ -103,8 +102,9 @@ impl<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>> impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { pub fn new(tcx: TyCtxtAt<'a, 'tcx, 'tcx>) -> Self { Memory { - alloc_map: Default::default(), + alloc_map: M::MemoryMap::default(), dead_alloc_map: FxHashMap::default(), + extra: M::MemoryExtra::default(), tcx, } } @@ -121,10 +121,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { &mut self, alloc: Allocation, kind: MemoryKind, - ) -> EvalResult<'tcx, AllocId> { + ) -> AllocId { let id = self.tcx.alloc_map.lock().reserve(); self.alloc_map.insert(id, (kind, alloc)); - Ok(id) + id } pub fn allocate( @@ -132,8 +132,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { size: Size, align: Align, kind: MemoryKind, - ) -> EvalResult<'tcx, Pointer> { - Ok(Pointer::from(self.allocate_with(Allocation::undef(size, align), kind)?)) + ) -> Pointer { + let extra = AllocationExtra::memory_allocated(size, &self.extra); + Pointer::from(self.allocate_with(Allocation::undef(size, align, extra), kind)) } pub fn reallocate( @@ -151,7 +152,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { // For simplicities' sake, we implement reallocate as "alloc, copy, dealloc". // This happens so rarely, the perf advantage is outweighed by the maintenance cost. - let new_ptr = self.allocate(new_size, new_align, kind)?; + let new_ptr = self.allocate(new_size, new_align, kind); self.copy( ptr.into(), old_align, @@ -193,12 +194,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { None => { // Deallocating static memory -- always an error return match self.tcx.alloc_map.lock().get(ptr.alloc_id) { - Some(AllocType::Function(..)) => err!(DeallocatedWrongMemoryKind( + Some(AllocKind::Function(..)) => err!(DeallocatedWrongMemoryKind( "function".to_string(), format!("{:?}", kind), )), - Some(AllocType::Static(..)) | - Some(AllocType::Memory(..)) => err!(DeallocatedWrongMemoryKind( + Some(AllocKind::Static(..)) | + Some(AllocKind::Memory(..)) => err!(DeallocatedWrongMemoryKind( "static".to_string(), format!("{:?}", kind), )), @@ -251,9 +252,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { Scalar::Ptr(ptr) => { // check this is not NULL -- which we can ensure only if this is in-bounds // of some (potentially dead) allocation. - self.check_bounds_ptr(ptr, InboundsCheck::MaybeDead)?; - // data required for alignment check - let (_, align) = self.get_size_and_align(ptr.alloc_id); + let align = self.check_bounds_ptr(ptr, InboundsCheck::MaybeDead)?; (ptr.offset.bytes(), align) } Scalar::Bits { bits, size } => { @@ -268,18 +267,18 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { } }; // Check alignment - if alloc_align.abi() < required_align.abi() { + if alloc_align.bytes() < required_align.bytes() { return err!(AlignmentCheckFailed { has: alloc_align, required: required_align, }); } - if offset % required_align.abi() == 0 { + if offset % required_align.bytes() == 0 { Ok(()) } else { - let has = offset % required_align.abi(); + let has = offset % required_align.bytes(); err!(AlignmentCheckFailed { - has: Align::from_bytes(has, has).unwrap(), + has: Align::from_bytes(has).unwrap(), required: required_align, }) } @@ -287,44 +286,17 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { /// Check if the pointer is "in-bounds". Notice that a pointer pointing at the end /// of an allocation (i.e., at the first *inaccessible* location) *is* considered - /// in-bounds! This follows C's/LLVM's rules. `check` indicates whether we - /// additionally require the pointer to be pointing to a *live* (still allocated) - /// allocation. - /// If you want to check bounds before doing a memory access, better use `check_bounds`. + /// in-bounds! This follows C's/LLVM's rules. + /// If you want to check bounds before doing a memory access, better first obtain + /// an `Allocation` and call `check_bounds`. pub fn check_bounds_ptr( &self, ptr: Pointer, - check: InboundsCheck, - ) -> EvalResult<'tcx> { - let allocation_size = match check { - InboundsCheck::Live => { - let alloc = self.get(ptr.alloc_id)?; - alloc.bytes.len() as u64 - } - InboundsCheck::MaybeDead => { - self.get_size_and_align(ptr.alloc_id).0.bytes() - } - }; - if ptr.offset.bytes() > allocation_size { - return err!(PointerOutOfBounds { - ptr: ptr.erase_tag(), - check, - allocation_size: Size::from_bytes(allocation_size), - }); - } - Ok(()) - } - - /// Check if the memory range beginning at `ptr` and of size `Size` is "in-bounds". - #[inline(always)] - pub fn check_bounds( - &self, - ptr: Pointer, - size: Size, - check: InboundsCheck, - ) -> EvalResult<'tcx> { - // if ptr.offset is in bounds, then so is ptr (because offset checks for overflow) - self.check_bounds_ptr(ptr.offset(size, &*self)?, check) + liveness: InboundsCheck, + ) -> EvalResult<'tcx, Align> { + let (allocation_size, align) = self.get_size_and_align(ptr.alloc_id, liveness)?; + ptr.check_in_alloc(allocation_size, liveness)?; + Ok(align) } } @@ -336,20 +308,21 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { /// this machine use the same pointer tag, so it is indirected through /// `M::static_with_default_tag`. fn get_static_alloc( - tcx: TyCtxtAt<'a, 'tcx, 'tcx>, id: AllocId, + tcx: TyCtxtAt<'a, 'tcx, 'tcx>, + memory_extra: &M::MemoryExtra, ) -> EvalResult<'tcx, Cow<'tcx, Allocation>> { let alloc = tcx.alloc_map.lock().get(id); let def_id = match alloc { - Some(AllocType::Memory(mem)) => { + Some(AllocKind::Memory(mem)) => { // We got tcx memory. Let the machine figure out whether and how to // turn that into memory with the right pointer tag. - return Ok(M::adjust_static_allocation(mem)) + return Ok(M::adjust_static_allocation(mem, memory_extra)) } - Some(AllocType::Function(..)) => { + Some(AllocKind::Function(..)) => { return err!(DerefFunctionPointer) } - Some(AllocType::Static(did)) => { + Some(AllocKind::Static(did)) => { did } None => @@ -358,7 +331,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { // We got a "lazy" static that has not been computed yet, do some work trace!("static_alloc: Need to compute {:?}", def_id); if tcx.is_foreign_item(def_id) { - return M::find_foreign_static(tcx, def_id); + return M::find_foreign_static(def_id, tcx, memory_extra); } let instance = Instance::mono(tcx.tcx, def_id); let gid = GlobalId { @@ -378,7 +351,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { let allocation = tcx.alloc_map.lock().unwrap_memory(raw_const.alloc_id); // We got tcx memory. Let the machine figure out whether and how to // turn that into memory with the right pointer tag. - M::adjust_static_allocation(allocation) + M::adjust_static_allocation(allocation, memory_extra) }) } @@ -388,7 +361,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { // `get_static_alloc` that we can actually use directly without inserting anything anywhere. // So the error type is `EvalResult<'tcx, &Allocation>`. let a = self.alloc_map.get_or(id, || { - let alloc = Self::get_static_alloc(self.tcx, id).map_err(Err)?; + let alloc = Self::get_static_alloc(id, self.tcx, &self.extra).map_err(Err)?; match alloc { Cow::Borrowed(alloc) => { // We got a ref, cheaply return that as an "error" so that the @@ -417,17 +390,18 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { id: AllocId, ) -> EvalResult<'tcx, &mut Allocation> { let tcx = self.tcx; + let memory_extra = &self.extra; let a = self.alloc_map.get_mut_or(id, || { // Need to make a copy, even if `get_static_alloc` is able // to give us a cheap reference. - let alloc = Self::get_static_alloc(tcx, id)?; + let alloc = Self::get_static_alloc(id, tcx, memory_extra)?; if alloc.mutability == Mutability::Immutable { return err!(ModifiedConstantMemory); } - let kind = M::STATIC_KIND.expect( - "An allocation is being mutated but the machine does not expect that to happen" - ); - Ok((MemoryKind::Machine(kind), alloc.into_owned())) + match M::STATIC_KIND { + Some(kind) => Ok((MemoryKind::Machine(kind), alloc.into_owned())), + None => err!(ModifiedStatic), + } }); // Unpack the error type manually because type inference doesn't // work otherwise (and we cannot help it because `impl Trait`) @@ -443,27 +417,37 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { } } - pub fn get_size_and_align(&self, id: AllocId) -> (Size, Align) { + /// Obtain the size and alignment of an allocation, even if that allocation has been deallocated + /// + /// If `liveness` is `InboundsCheck::Dead`, this function always returns `Ok` + pub fn get_size_and_align( + &self, + id: AllocId, + liveness: InboundsCheck, + ) -> EvalResult<'static, (Size, Align)> { if let Ok(alloc) = self.get(id) { - return (Size::from_bytes(alloc.bytes.len() as u64), alloc.align); + return Ok((Size::from_bytes(alloc.bytes.len() as u64), alloc.align)); } // Could also be a fn ptr or extern static match self.tcx.alloc_map.lock().get(id) { - Some(AllocType::Function(..)) => (Size::ZERO, Align::from_bytes(1, 1).unwrap()), - Some(AllocType::Static(did)) => { + Some(AllocKind::Function(..)) => Ok((Size::ZERO, Align::from_bytes(1).unwrap())), + Some(AllocKind::Static(did)) => { // The only way `get` couldn't have worked here is if this is an extern static assert!(self.tcx.is_foreign_item(did)); // Use size and align of the type let ty = self.tcx.type_of(did); let layout = self.tcx.layout_of(ParamEnv::empty().and(ty)).unwrap(); - (layout.size, layout.align) - } - _ => { - // Must be a deallocated pointer - *self.dead_alloc_map.get(&id).expect( - "allocation missing in dead_alloc_map" - ) + Ok((layout.size, layout.align.abi)) } + _ => match liveness { + InboundsCheck::MaybeDead => { + // Must be a deallocated pointer + Ok(*self.dead_alloc_map.get(&id).expect( + "allocation missing in dead_alloc_map" + )) + }, + InboundsCheck::Live => err!(DanglingPointerDeref), + }, } } @@ -473,7 +457,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { } trace!("reading fn ptr: {}", ptr.alloc_id); match self.tcx.alloc_map.lock().get(ptr.alloc_id) { - Some(AllocType::Function(instance)) => Ok(instance), + Some(AllocKind::Function(instance)) => Ok(instance), _ => Err(EvalErrorKind::ExecuteMemory.into()), } } @@ -521,7 +505,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { "{}({} bytes, alignment {}){}", msg, alloc.bytes.len(), - alloc.align.abi(), + alloc.align.bytes(), extra ); @@ -571,16 +555,16 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { Err(()) => { // static alloc? match self.tcx.alloc_map.lock().get(id) { - Some(AllocType::Memory(alloc)) => { + Some(AllocKind::Memory(alloc)) => { self.dump_alloc_helper( &mut allocs_seen, &mut allocs_to_print, msg, alloc, " (immutable)".to_owned() ); } - Some(AllocType::Function(func)) => { + Some(AllocKind::Function(func)) => { trace!("{} {}", msg, func); } - Some(AllocType::Static(did)) => { + Some(AllocKind::Static(did)) => { trace!("{} {:?}", msg, did); } None => { @@ -609,94 +593,27 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { } } -/// Byte accessors +/// Byte Accessors impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { - /// The last argument controls whether we error out when there are undefined - /// or pointer bytes. You should never call this, call `get_bytes` or - /// `get_bytes_with_undef_and_ptr` instead, - /// - /// This function also guarantees that the resulting pointer will remain stable - /// even when new allocations are pushed to the `HashMap`. `copy_repeatedly` relies - /// on that. - fn get_bytes_internal( + pub fn read_bytes( &self, - ptr: Pointer, + ptr: Scalar, size: Size, - align: Align, - check_defined_and_ptr: bool, ) -> EvalResult<'tcx, &[u8]> { - assert_ne!(size.bytes(), 0, "0-sized accesses should never even get a `Pointer`"); - self.check_align(ptr.into(), align)?; - self.check_bounds(ptr, size, InboundsCheck::Live)?; - - if check_defined_and_ptr { - self.check_defined(ptr, size)?; - self.check_relocations(ptr, size)?; + if size.bytes() == 0 { + Ok(&[]) } else { - // We still don't want relocations on the *edges* - self.check_relocation_edges(ptr, size)?; + let ptr = ptr.to_ptr()?; + self.get(ptr.alloc_id)?.get_bytes(self, ptr, size) } - - let alloc = self.get(ptr.alloc_id)?; - AllocationExtra::memory_read(alloc, ptr, size)?; - - assert_eq!(ptr.offset.bytes() as usize as u64, ptr.offset.bytes()); - assert_eq!(size.bytes() as usize as u64, size.bytes()); - let offset = ptr.offset.bytes() as usize; - Ok(&alloc.bytes[offset..offset + size.bytes() as usize]) - } - - #[inline] - fn get_bytes( - &self, - ptr: Pointer, - size: Size, - align: Align - ) -> EvalResult<'tcx, &[u8]> { - self.get_bytes_internal(ptr, size, align, true) - } - - /// It is the caller's responsibility to handle undefined and pointer bytes. - /// However, this still checks that there are no relocations on the *edges*. - #[inline] - fn get_bytes_with_undef_and_ptr( - &self, - ptr: Pointer, - size: Size, - align: Align - ) -> EvalResult<'tcx, &[u8]> { - self.get_bytes_internal(ptr, size, align, false) - } - - /// Just calling this already marks everything as defined and removes relocations, - /// so be sure to actually put data there! - fn get_bytes_mut( - &mut self, - ptr: Pointer, - size: Size, - align: Align, - ) -> EvalResult<'tcx, &mut [u8]> { - assert_ne!(size.bytes(), 0, "0-sized accesses should never even get a `Pointer`"); - self.check_align(ptr.into(), align)?; - self.check_bounds(ptr, size, InboundsCheck::Live)?; - - self.mark_definedness(ptr, size, true)?; - self.clear_relocations(ptr, size)?; - - let alloc = self.get_mut(ptr.alloc_id)?; - AllocationExtra::memory_written(alloc, ptr, size)?; - - assert_eq!(ptr.offset.bytes() as usize as u64, ptr.offset.bytes()); - assert_eq!(size.bytes() as usize as u64, size.bytes()); - let offset = ptr.offset.bytes() as usize; - Ok(&mut alloc.bytes[offset..offset + size.bytes() as usize]) } } /// Interning (for CTFE) impl<'a, 'mir, 'tcx, M> Memory<'a, 'mir, 'tcx, M> where - M: Machine<'a, 'mir, 'tcx, PointerTag=(), AllocExtra=()>, + M: Machine<'a, 'mir, 'tcx, PointerTag=(), AllocExtra=(), MemoryExtra=()>, + // FIXME: Working around https://github.com/rust-lang/rust/issues/24159 M::MemoryMap: AllocMap, Allocation)>, { /// mark an allocation as static and initialized, either mutable or not @@ -719,7 +636,7 @@ where // ensure llvm knows not to put this into immutable memory alloc.mutability = mutability; let alloc = self.tcx.intern_const_alloc(alloc); - self.tcx.alloc_map.lock().set_id_memory(alloc_id, alloc); + self.tcx.alloc_map.lock().set_alloc_id_memory(alloc_id, alloc); // recurse into inner allocations for &(_, alloc) in alloc.relocations.values() { // FIXME: Reusing the mutability here is likely incorrect. It is originally @@ -766,10 +683,11 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { length: u64, nonoverlapping: bool, ) -> EvalResult<'tcx> { + self.check_align(src, src_align)?; + self.check_align(dest, dest_align)?; if size.bytes() == 0 { - // Nothing to do for ZST, other than checking alignment and non-NULLness. - self.check_align(src, src_align)?; - self.check_align(dest, dest_align)?; + // Nothing to do for ZST, other than checking alignment and + // non-NULLness which already happened. return Ok(()); } let src = src.to_ptr()?; @@ -781,15 +699,20 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { // (`get_bytes_with_undef_and_ptr` below checks that there are no // relocations overlapping the edges; those would not be handled correctly). let relocations = { - let relocations = self.relocations(src, size)?; + let relocations = self.get(src.alloc_id)?.relocations(self, src, size); let mut new_relocations = Vec::with_capacity(relocations.len() * (length as usize)); for i in 0..length { new_relocations.extend( relocations .iter() .map(|&(offset, reloc)| { - (offset + dest.offset - src.offset + (i * size * relocations.len() as u64), - reloc) + // compute offset for current repetition + let dest_offset = dest.offset + (i * size); + ( + // shift offsets from source allocation to destination allocation + offset + dest_offset - src.offset, + reloc, + ) }) ); } @@ -797,9 +720,15 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { new_relocations }; - // This also checks alignment, and relocation edges on the src. - let src_bytes = self.get_bytes_with_undef_and_ptr(src, size, src_align)?.as_ptr(); - let dest_bytes = self.get_bytes_mut(dest, size * length, dest_align)?.as_mut_ptr(); + let tcx = self.tcx.tcx; + + // This checks relocation edges on the src. + let src_bytes = self.get(src.alloc_id)? + .get_bytes_with_undef_and_ptr(&tcx, src, size)? + .as_ptr(); + let dest_bytes = self.get_mut(dest.alloc_id)? + .get_bytes_mut(&tcx, dest, size * length)? + .as_mut_ptr(); // SAFE: The above indexing would have panicked if there weren't at least `size` bytes // behind `src` and `dest`. Also, we use the overlapping-safe `ptr::copy` if `src` and @@ -840,276 +769,6 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { Ok(()) } - - pub fn read_c_str(&self, ptr: Pointer) -> EvalResult<'tcx, &[u8]> { - let alloc = self.get(ptr.alloc_id)?; - assert_eq!(ptr.offset.bytes() as usize as u64, ptr.offset.bytes()); - let offset = ptr.offset.bytes() as usize; - match alloc.bytes[offset..].iter().position(|&c| c == 0) { - Some(size) => { - let p1 = Size::from_bytes((size + 1) as u64); - self.check_relocations(ptr, p1)?; - self.check_defined(ptr, p1)?; - Ok(&alloc.bytes[offset..offset + size]) - } - None => err!(UnterminatedCString(ptr.erase_tag())), - } - } - - pub fn check_bytes( - &self, - ptr: Scalar, - size: Size, - allow_ptr_and_undef: bool, - ) -> EvalResult<'tcx> { - // Empty accesses don't need to be valid pointers, but they should still be non-NULL - let align = Align::from_bytes(1, 1).unwrap(); - if size.bytes() == 0 { - self.check_align(ptr, align)?; - return Ok(()); - } - let ptr = ptr.to_ptr()?; - // Check bounds, align and relocations on the edges - self.get_bytes_with_undef_and_ptr(ptr, size, align)?; - // Check undef and ptr - if !allow_ptr_and_undef { - self.check_defined(ptr, size)?; - self.check_relocations(ptr, size)?; - } - Ok(()) - } - - pub fn read_bytes(&self, ptr: Scalar, size: Size) -> EvalResult<'tcx, &[u8]> { - // Empty accesses don't need to be valid pointers, but they should still be non-NULL - let align = Align::from_bytes(1, 1).unwrap(); - if size.bytes() == 0 { - self.check_align(ptr, align)?; - return Ok(&[]); - } - self.get_bytes(ptr.to_ptr()?, size, align) - } - - pub fn write_bytes(&mut self, ptr: Scalar, src: &[u8]) -> EvalResult<'tcx> { - // Empty accesses don't need to be valid pointers, but they should still be non-NULL - let align = Align::from_bytes(1, 1).unwrap(); - if src.is_empty() { - self.check_align(ptr, align)?; - return Ok(()); - } - let bytes = self.get_bytes_mut(ptr.to_ptr()?, Size::from_bytes(src.len() as u64), align)?; - bytes.clone_from_slice(src); - Ok(()) - } - - pub fn write_repeat( - &mut self, - ptr: Scalar, - val: u8, - count: Size - ) -> EvalResult<'tcx> { - // Empty accesses don't need to be valid pointers, but they should still be non-NULL - let align = Align::from_bytes(1, 1).unwrap(); - if count.bytes() == 0 { - self.check_align(ptr, align)?; - return Ok(()); - } - let bytes = self.get_bytes_mut(ptr.to_ptr()?, count, align)?; - for b in bytes { - *b = val; - } - Ok(()) - } - - /// Read a *non-ZST* scalar - pub fn read_scalar( - &self, - ptr: Pointer, - ptr_align: Align, - size: Size - ) -> EvalResult<'tcx, ScalarMaybeUndef> { - // get_bytes_unchecked tests alignment and relocation edges - let bytes = self.get_bytes_with_undef_and_ptr( - ptr, size, ptr_align.min(self.int_align(size)) - )?; - // Undef check happens *after* we established that the alignment is correct. - // We must not return Ok() for unaligned pointers! - if self.check_defined(ptr, size).is_err() { - // this inflates undefined bytes to the entire scalar, even if only a few - // bytes are undefined - return Ok(ScalarMaybeUndef::Undef); - } - // Now we do the actual reading - let bits = read_target_uint(self.tcx.data_layout.endian, bytes).unwrap(); - // See if we got a pointer - if size != self.pointer_size() { - // *Now* better make sure that the inside also is free of relocations. - self.check_relocations(ptr, size)?; - } else { - let alloc = self.get(ptr.alloc_id)?; - match alloc.relocations.get(&ptr.offset) { - Some(&(tag, alloc_id)) => { - let ptr = Pointer::new_with_tag(alloc_id, Size::from_bytes(bits as u64), tag); - return Ok(ScalarMaybeUndef::Scalar(ptr.into())) - } - None => {}, - } - } - // We don't. Just return the bits. - Ok(ScalarMaybeUndef::Scalar(Scalar::from_uint(bits, size))) - } - - pub fn read_ptr_sized( - &self, - ptr: Pointer, - ptr_align: Align - ) -> EvalResult<'tcx, ScalarMaybeUndef> { - self.read_scalar(ptr, ptr_align, self.pointer_size()) - } - - /// Write a *non-ZST* scalar - pub fn write_scalar( - &mut self, - ptr: Pointer, - ptr_align: Align, - val: ScalarMaybeUndef, - type_size: Size, - ) -> EvalResult<'tcx> { - let val = match val { - ScalarMaybeUndef::Scalar(scalar) => scalar, - ScalarMaybeUndef::Undef => return self.mark_definedness(ptr, type_size, false), - }; - - let bytes = match val { - Scalar::Ptr(val) => { - assert_eq!(type_size, self.pointer_size()); - val.offset.bytes() as u128 - } - - Scalar::Bits { bits, size } => { - assert_eq!(size as u64, type_size.bytes()); - debug_assert_eq!(truncate(bits, Size::from_bytes(size.into())), bits, - "Unexpected value of size {} when writing to memory", size); - bits - }, - }; - - { - // get_bytes_mut checks alignment - let endian = self.tcx.data_layout.endian; - let dst = self.get_bytes_mut(ptr, type_size, ptr_align)?; - write_target_uint(endian, dst, bytes).unwrap(); - } - - // See if we have to also write a relocation - match val { - Scalar::Ptr(val) => { - self.get_mut(ptr.alloc_id)?.relocations.insert( - ptr.offset, - (val.tag, val.alloc_id), - ); - } - _ => {} - } - - Ok(()) - } - - pub fn write_ptr_sized( - &mut self, - ptr: Pointer, - ptr_align: Align, - val: ScalarMaybeUndef - ) -> EvalResult<'tcx> { - let ptr_size = self.pointer_size(); - self.write_scalar(ptr.into(), ptr_align, val, ptr_size) - } - - fn int_align(&self, size: Size) -> Align { - // We assume pointer-sized integers have the same alignment as pointers. - // We also assume signed and unsigned integers of the same size have the same alignment. - let ity = match size.bytes() { - 1 => layout::I8, - 2 => layout::I16, - 4 => layout::I32, - 8 => layout::I64, - 16 => layout::I128, - _ => bug!("bad integer size: {}", size.bytes()), - }; - ity.align(self) - } -} - -/// Relocations -impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { - /// Return all relocations overlapping with the given ptr-offset pair. - fn relocations( - &self, - ptr: Pointer, - size: Size, - ) -> EvalResult<'tcx, &[(Size, (M::PointerTag, AllocId))]> { - // We have to go back `pointer_size - 1` bytes, as that one would still overlap with - // the beginning of this range. - let start = ptr.offset.bytes().saturating_sub(self.pointer_size().bytes() - 1); - let end = ptr.offset + size; // this does overflow checking - Ok(self.get(ptr.alloc_id)?.relocations.range(Size::from_bytes(start)..end)) - } - - /// Check that there ar eno relocations overlapping with the given range. - #[inline(always)] - fn check_relocations(&self, ptr: Pointer, size: Size) -> EvalResult<'tcx> { - if self.relocations(ptr, size)?.len() != 0 { - err!(ReadPointerAsBytes) - } else { - Ok(()) - } - } - - /// Remove all relocations inside the given range. - /// If there are relocations overlapping with the edges, they - /// are removed as well *and* the bytes they cover are marked as - /// uninitialized. This is a somewhat odd "spooky action at a distance", - /// but it allows strictly more code to run than if we would just error - /// immediately in that case. - fn clear_relocations(&mut self, ptr: Pointer, size: Size) -> EvalResult<'tcx> { - // Find the start and end of the given range and its outermost relocations. - let (first, last) = { - // Find all relocations overlapping the given range. - let relocations = self.relocations(ptr, size)?; - if relocations.is_empty() { - return Ok(()); - } - - (relocations.first().unwrap().0, - relocations.last().unwrap().0 + self.pointer_size()) - }; - let start = ptr.offset; - let end = start + size; - - let alloc = self.get_mut(ptr.alloc_id)?; - - // Mark parts of the outermost relocations as undefined if they partially fall outside the - // given range. - if first < start { - alloc.undef_mask.set_range(first, start, false); - } - if last > end { - alloc.undef_mask.set_range(end, last, false); - } - - // Forget all the relocations. - alloc.relocations.remove_range(first..last); - - Ok(()) - } - - /// Error if there are relocations overlapping with the edges of the - /// given memory range. - #[inline] - fn check_relocation_edges(&self, ptr: Pointer, size: Size) -> EvalResult<'tcx> { - self.check_relocations(ptr, Size::ZERO)?; - self.check_relocations(ptr.offset(size, self)?, Size::ZERO)?; - Ok(()) - } } /// Undefined bytes @@ -1141,33 +800,4 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { Ok(()) } - - /// Checks that a range of bytes is defined. If not, returns the `ReadUndefBytes` - /// error which will report the first byte which is undefined. - #[inline] - fn check_defined(&self, ptr: Pointer, size: Size) -> EvalResult<'tcx> { - let alloc = self.get(ptr.alloc_id)?; - alloc.undef_mask.is_range_defined( - ptr.offset, - ptr.offset + size, - ).or_else(|idx| err!(ReadUndefBytes(idx))) - } - - pub fn mark_definedness( - &mut self, - ptr: Pointer, - size: Size, - new_state: bool, - ) -> EvalResult<'tcx> { - if size.bytes() == 0 { - return Ok(()); - } - let alloc = self.get_mut(ptr.alloc_id)?; - alloc.undef_mask.set_range( - ptr.offset, - ptr.offset + size, - new_state, - ); - Ok(()) - } } diff --git a/src/librustc_mir/interpret/mod.rs b/src/librustc_mir/interpret/mod.rs index 96ea0d50949..d2ab3fcb7a3 100644 --- a/src/librustc_mir/interpret/mod.rs +++ b/src/librustc_mir/interpret/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! An interpreter for MIR used in CTFE and by miri mod cast; @@ -28,7 +18,7 @@ mod visitor; pub use rustc::mir::interpret::*; // have all the `interpret` symbols in one place: here pub use self::eval_context::{ - EvalContext, Frame, StackPopCleanup, LocalValue, + EvalContext, Frame, StackPopCleanup, LocalState, LocalValue, }; pub use self::place::{Place, PlaceTy, MemPlace, MPlaceTy}; diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 5d993cfee08..37e421c2e73 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -1,25 +1,15 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Functions concerning immediate values and operands, and reading from operands. //! All high-level functions to read from memory work on operands as sources. use std::convert::TryInto; -use rustc::mir; +use rustc::{mir, ty}; use rustc::ty::layout::{self, Size, LayoutOf, TyLayout, HasDataLayout, IntegerExt, VariantIdx}; use rustc::mir::interpret::{ - GlobalId, AllocId, + GlobalId, AllocId, InboundsCheck, ConstValue, Pointer, Scalar, - EvalResult, EvalErrorKind, InboundsCheck, + EvalResult, EvalErrorKind, }; use super::{EvalContext, Machine, MemPlace, MPlaceTy, MemoryKind}; pub use rustc::mir::interpret::ScalarMaybeUndef; @@ -237,7 +227,7 @@ impl<'tcx, Tag> OpTy<'tcx, Tag> // Use the existing layout if given (but sanity check in debug mode), // or compute the layout. #[inline(always)] -fn from_known_layout<'tcx>( +pub(super) fn from_known_layout<'tcx>( layout: Option>, compute: impl FnOnce() -> EvalResult<'tcx, TyLayout<'tcx>> ) -> EvalResult<'tcx, TyLayout<'tcx>> { @@ -275,21 +265,31 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> return Ok(Some(Immediate::Scalar(Scalar::zst().into()))); } + // check for integer pointers before alignment to report better errors let ptr = ptr.to_ptr()?; + self.memory.check_align(ptr.into(), ptr_align)?; match mplace.layout.abi { layout::Abi::Scalar(..) => { - let scalar = self.memory.read_scalar(ptr, ptr_align, mplace.layout.size)?; + let scalar = self.memory + .get(ptr.alloc_id)? + .read_scalar(self, ptr, mplace.layout.size)?; Ok(Some(Immediate::Scalar(scalar))) } layout::Abi::ScalarPair(ref a, ref b) => { let (a, b) = (&a.value, &b.value); let (a_size, b_size) = (a.size(self), b.size(self)); let a_ptr = ptr; - let b_offset = a_size.abi_align(b.align(self)); + let b_offset = a_size.align_to(b.align(self).abi); assert!(b_offset.bytes() > 0); // we later use the offset to test which field to use - let b_ptr = ptr.offset(b_offset, self)?.into(); - let a_val = self.memory.read_scalar(a_ptr, ptr_align, a_size)?; - let b_val = self.memory.read_scalar(b_ptr, ptr_align, b_size)?; + let b_ptr = ptr.offset(b_offset, self)?; + let a_val = self.memory + .get(ptr.alloc_id)? + .read_scalar(self, a_ptr, a_size)?; + let b_align = ptr_align.restrict_for_offset(b_offset); + self.memory.check_align(b_ptr.into(), b_align)?; + let b_val = self.memory + .get(ptr.alloc_id)? + .read_scalar(self, b_ptr, b_size)?; Ok(Some(Immediate::ScalarPair(a_val, b_val))) } _ => Ok(None), @@ -372,7 +372,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> _ => { trace!("Forcing allocation for local of type {:?}", layout.ty); Operand::Indirect( - *self.allocate(layout, MemoryKind::Stack)? + *self.allocate(layout, MemoryKind::Stack) ) } }) @@ -457,24 +457,20 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } /// This is used by [priroda](https://github.com/oli-obk/priroda) to get an OpTy from a local - /// - /// When you know the layout of the local in advance, you can pass it as last argument pub fn access_local( &self, - frame: &super::Frame<'mir, 'tcx, M::PointerTag>, + frame: &super::Frame<'mir, 'tcx, M::PointerTag, M::FrameExtra>, local: mir::Local, layout: Option>, ) -> EvalResult<'tcx, OpTy<'tcx, M::PointerTag>> { assert_ne!(local, mir::RETURN_PLACE); let op = *frame.locals[local].access()?; - let layout = from_known_layout(layout, - || self.layout_of_local(frame, local))?; + let layout = self.layout_of_local(frame, local, layout)?; Ok(OpTy { op, layout }) } // Evaluate a place with the goal of reading from it. This lets us sometimes - // avoid allocations. If you already know the layout, you can pass it in - // to avoid looking it up again. + // avoid allocations. fn eval_place_to_op( &self, mir_place: &mir::Place<'tcx>, @@ -514,10 +510,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> Constant(ref constant) => { let layout = from_known_layout(layout, || { - let ty = self.monomorphize(mir_op.ty(self.mir(), *self.tcx), self.substs()); + let ty = self.monomorphize(mir_op.ty(self.mir(), *self.tcx))?; self.layout_of(ty) })?; - let op = self.const_value_to_op(constant.literal.val)?; + let op = self.const_value_to_op(*constant.literal)?; OpTy { op, layout } } }; @@ -540,17 +536,20 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> // `eval_operand`, ideally). pub(crate) fn const_value_to_op( &self, - val: ConstValue<'tcx>, + val: ty::LazyConst<'tcx>, ) -> EvalResult<'tcx, Operand> { trace!("const_value_to_op: {:?}", val); - match val { - ConstValue::Unevaluated(def_id, substs) => { + let val = match val { + ty::LazyConst::Unevaluated(def_id, substs) => { let instance = self.resolve(def_id, substs)?; - Ok(*OpTy::from(self.const_eval_raw(GlobalId { + return Ok(*OpTy::from(self.const_eval_raw(GlobalId { instance, promoted: None, - })?)) - } + })?)); + }, + ty::LazyConst::Evaluated(c) => c, + }; + match val.val { ConstValue::ByRef(id, alloc, offset) => { // We rely on mutability being set correctly in that allocation to prevent writes // where none should happen -- and for `static mut`, we copy on demand anyway. @@ -558,10 +557,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> MemPlace::from_ptr(Pointer::new(id, offset), alloc.align) ).with_default_tag()) }, - ConstValue::ScalarPair(a, b) => + ConstValue::Slice(a, b) => Ok(Operand::Immediate(Immediate::ScalarPair( a.into(), - b.into(), + Scalar::from_uint(b, self.tcx.data_layout.pointer_size).into(), )).with_default_tag()), ConstValue::Scalar(x) => Ok(Operand::Immediate(Immediate::Scalar(x.into())).with_default_tag()), diff --git a/src/librustc_mir/interpret/operator.rs b/src/librustc_mir/interpret/operator.rs index 31824d5ec4a..5e3335f4c72 100644 --- a/src/librustc_mir/interpret/operator.rs +++ b/src/librustc_mir/interpret/operator.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::mir; use rustc::ty::{self, layout::{Size, TyLayout}}; use syntax::ast::FloatTy; diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 9f248d46350..9ca7f9d8e27 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Computations on places -- field projections, going from mir::Place, and writing //! into a place. //! All high-level functions to write to memory work on places as destinations. @@ -19,6 +9,7 @@ use rustc::hir; use rustc::mir; use rustc::ty::{self, Ty}; use rustc::ty::layout::{self, Size, Align, LayoutOf, TyLayout, HasDataLayout, VariantIdx}; +use rustc::ty::TypeFoldable; use super::{ GlobalId, AllocId, Allocation, Scalar, EvalResult, Pointer, PointerArithmetic, @@ -35,7 +26,7 @@ pub struct MemPlace { pub align: Align, /// Metadata for unsized places. Interpretation is up to the type. /// Must not be present for sized types, but can be missing for unsized types - /// (e.g. `extern type`). + /// (e.g., `extern type`). pub meta: Option>, } @@ -115,6 +106,16 @@ impl MemPlace { } } + #[inline] + pub fn with_tag(self, new_tag: Tag) -> Self + { + MemPlace { + ptr: self.ptr.with_tag(new_tag), + align: self.align, + meta: self.meta, + } + } + #[inline(always)] pub fn from_scalar_ptr(ptr: Scalar, align: Align) -> Self { MemPlace { @@ -127,7 +128,7 @@ impl MemPlace { /// Produces a Place that will error if attempted to be read from or written to #[inline(always)] pub fn null(cx: &impl HasDataLayout) -> Self { - Self::from_scalar_ptr(Scalar::ptr_null(cx), Align::from_bytes(1, 1).unwrap()) + Self::from_scalar_ptr(Scalar::ptr_null(cx), Align::from_bytes(1).unwrap()) } #[inline(always)] @@ -159,6 +160,19 @@ impl MemPlace { Some(meta) => Immediate::ScalarPair(self.ptr.into(), meta.into()), } } + + pub fn offset( + self, + offset: Size, + meta: Option>, + cx: &impl HasDataLayout, + ) -> EvalResult<'tcx, Self> { + Ok(MemPlace { + ptr: self.ptr.ptr_offset(offset, cx)?, + align: self.align.restrict_for_offset(offset), + meta, + }) + } } impl<'tcx, Tag> MPlaceTy<'tcx, Tag> { @@ -167,16 +181,39 @@ impl<'tcx, Tag> MPlaceTy<'tcx, Tag> { pub fn dangling(layout: TyLayout<'tcx>, cx: &impl HasDataLayout) -> Self { MPlaceTy { mplace: MemPlace::from_scalar_ptr( - Scalar::from_uint(layout.align.abi(), cx.pointer_size()), - layout.align + Scalar::from_uint(layout.align.abi.bytes(), cx.pointer_size()), + layout.align.abi ), layout } } + #[inline] + pub fn with_tag(self, new_tag: Tag) -> Self + { + MPlaceTy { + mplace: self.mplace.with_tag(new_tag), + layout: self.layout, + } + } + + #[inline] + pub fn offset( + self, + offset: Size, + meta: Option>, + layout: TyLayout<'tcx>, + cx: &impl HasDataLayout, + ) -> EvalResult<'tcx, Self> { + Ok(MPlaceTy { + mplace: self.mplace.offset(offset, meta, cx)?, + layout, + }) + } + #[inline] fn from_aligned_ptr(ptr: Pointer, layout: TyLayout<'tcx>) -> Self { - MPlaceTy { mplace: MemPlace::from_ptr(ptr, layout.align), layout } + MPlaceTy { mplace: MemPlace::from_ptr(ptr, layout.align.abi), layout } } #[inline] @@ -190,7 +227,7 @@ impl<'tcx, Tag> MPlaceTy<'tcx, Tag> { } } else { // Go through the layout. There are lots of types that support a length, - // e.g. SIMD types. + // e.g., SIMD types. match self.layout.fields { layout::FieldPlacement::Array { count, .. } => Ok(count), _ => bug!("len not supported on sized type {:?}", self.layout.ty), @@ -269,10 +306,12 @@ impl<'tcx, Tag: ::std::fmt::Debug> PlaceTy<'tcx, Tag> { // separating the pointer tag for `impl Trait`, see https://github.com/rust-lang/rust/issues/54385 impl<'a, 'mir, 'tcx, Tag, M> EvalContext<'a, 'mir, 'tcx, M> where + // FIXME: Working around https://github.com/rust-lang/rust/issues/54385 Tag: ::std::fmt::Debug+Default+Copy+Eq+Hash+'static, M: Machine<'a, 'mir, 'tcx, PointerTag=Tag>, + // FIXME: Working around https://github.com/rust-lang/rust/issues/24159 M::MemoryMap: AllocMap, Allocation)>, - M::AllocExtra: AllocationExtra, + M::AllocExtra: AllocationExtra, { /// Take a value, which represents a (thin or fat) reference, and make it a place. /// Alignment is just based on the type. This is the inverse of `MemPlace::to_ref()`. @@ -287,7 +326,7 @@ where let mplace = MemPlace { ptr: val.to_scalar_ptr()?, - align: layout.align, + align: layout.align.abi, meta: val.to_meta()?, }; Ok(MPlaceTy { mplace, layout }) @@ -356,24 +395,20 @@ where // FIXME: Once we have made decisions for how to handle size and alignment // of `extern type`, this should be adapted. It is just a temporary hack // to get some code to work that probably ought to work. - field_layout.align, + field_layout.align.abi, None => bug!("Cannot compute offset for extern type field at non-0 offset"), }; - (base.meta, offset.abi_align(align)) + (base.meta, offset.align_to(align)) } else { // base.meta could be present; we might be accessing a sized field of an unsized // struct. (None, offset) }; - let ptr = base.ptr.ptr_offset(offset, self)?; - let align = base.align - // We do not look at `base.layout.align` nor `field_layout.align`, unlike - // codegen -- mostly to see if we can get away with that - .restrict_for_offset(offset); // must be last thing that happens - - Ok(MPlaceTy { mplace: MemPlace { ptr, align, meta }, layout: field_layout }) + // We do not look at `base.layout.align` nor `field_layout.align`, unlike + // codegen -- mostly to see if we can get away with that + base.offset(offset, meta, field_layout, self) } // Iterates over all fields of an array. Much more efficient than doing the @@ -391,13 +426,7 @@ where }; let layout = base.layout.field(self, 0)?; let dl = &self.tcx.data_layout; - Ok((0..len).map(move |i| { - let ptr = base.ptr.ptr_offset(i * stride, dl)?; - Ok(MPlaceTy { - mplace: MemPlace { ptr, align: base.align, meta: None }, - layout - }) - })) + Ok((0..len).map(move |i| base.offset(i * stride, None, layout, dl))) } pub fn mplace_subslice( @@ -416,7 +445,6 @@ where stride * from, _ => bug!("Unexpected layout of index access: {:#?}", base.layout), }; - let ptr = base.ptr.ptr_offset(from_offset, self)?; // Compute meta and new layout let inner_len = len - to - from; @@ -433,11 +461,7 @@ where bug!("cannot subslice non-array type: `{:?}`", base.layout.ty), }; let layout = self.layout_of(ty)?; - - Ok(MPlaceTy { - mplace: MemPlace { ptr, align: base.align, meta }, - layout - }) + base.offset(from_offset, meta, layout, self) } pub fn mplace_downcast( @@ -560,8 +584,8 @@ where } Static(ref static_) => { - let ty = self.monomorphize(static_.ty, self.substs()); - let layout = self.layout_of(ty)?; + assert!(!static_.ty.needs_subst()); + let layout = self.layout_of(static_.ty)?; let instance = ty::Instance::mono(*self.tcx, static_.def_id); let cid = GlobalId { instance, @@ -600,7 +624,7 @@ where // their layout on return. PlaceTy { place: *return_place, - layout: self.layout_of_local(self.frame(), mir::RETURN_PLACE)?, + layout: self.layout_of(self.monomorphize(self.frame().mir.return_ty())?)?, }, None => return err!(InvalidNullPointerUsage), }, @@ -609,7 +633,7 @@ where frame: self.cur_frame(), local, }, - layout: self.layout_of_local(self.frame(), local)?, + layout: self.layout_of_local(self.frame(), local, None)?, }, Projection(ref proj) => { @@ -713,11 +737,13 @@ where // Nothing to do for ZSTs, other than checking alignment if dest.layout.is_zst() { - self.memory.check_align(ptr, ptr_align)?; - return Ok(()); + return self.memory.check_align(ptr, ptr_align); } + // check for integer pointers before alignment to report better errors let ptr = ptr.to_ptr()?; + self.memory.check_align(ptr.into(), ptr_align)?; + let tcx = &*self.tcx; // FIXME: We should check that there are dest.layout.size many bytes available in // memory. The code below is not sufficient, with enough padding it might not // cover all the bytes! @@ -728,9 +754,8 @@ where _ => bug!("write_immediate_to_mplace: invalid Scalar layout: {:#?}", dest.layout) } - - self.memory.write_scalar( - ptr, ptr_align.min(dest.layout.align), scalar, dest.layout.size + self.memory.get_mut(ptr.alloc_id)?.write_scalar( + tcx, ptr, scalar, dest.layout.size ) } Immediate::ScalarPair(a_val, b_val) => { @@ -740,16 +765,22 @@ where dest.layout) }; let (a_size, b_size) = (a.size(self), b.size(self)); - let (a_align, b_align) = (a.align(self), b.align(self)); - let b_offset = a_size.abi_align(b_align); - let b_ptr = ptr.offset(b_offset, self)?.into(); + let b_offset = a_size.align_to(b.align(self).abi); + let b_align = ptr_align.restrict_for_offset(b_offset); + let b_ptr = ptr.offset(b_offset, self)?; + + self.memory.check_align(b_ptr.into(), b_align)?; // It is tempting to verify `b_offset` against `layout.fields.offset(1)`, // but that does not work: We could be a newtype around a pair, then the // fields do not match the `ScalarPair` components. - self.memory.write_scalar(ptr, ptr_align.min(a_align), a_val, a_size)?; - self.memory.write_scalar(b_ptr, ptr_align.min(b_align), b_val, b_size) + self.memory + .get_mut(ptr.alloc_id)? + .write_scalar(tcx, ptr, a_val, a_size)?; + self.memory + .get_mut(b_ptr.alloc_id)? + .write_scalar(tcx, b_ptr, b_val, b_size) } } } @@ -868,10 +899,10 @@ where // a fake pointer? Are we even called for ZST? // We need the layout of the local. We can NOT use the layout we got, - // that might e.g. be an inner field of a struct with `Scalar` layout, + // that might e.g., be an inner field of a struct with `Scalar` layout, // that has different alignment than the outer field. - let local_layout = self.layout_of_local(&self.stack[frame], local)?; - let ptr = self.allocate(local_layout, MemoryKind::Stack)?; + let local_layout = self.layout_of_local(&self.stack[frame], local, None)?; + let ptr = self.allocate(local_layout, MemoryKind::Stack); // We don't have to validate as we can assume the local // was already valid for its type. self.write_immediate_to_mplace_no_validate(value, ptr)?; @@ -893,15 +924,15 @@ where &mut self, layout: TyLayout<'tcx>, kind: MemoryKind, - ) -> EvalResult<'tcx, MPlaceTy<'tcx, M::PointerTag>> { + ) -> MPlaceTy<'tcx, M::PointerTag> { if layout.is_unsized() { assert!(self.tcx.features().unsized_locals, "cannot alloc memory for unsized type"); // FIXME: What should we do here? We should definitely also tag! - Ok(MPlaceTy::dangling(layout, self)) + MPlaceTy::dangling(layout, self) } else { - let ptr = self.memory.allocate(layout.size, layout.align, kind)?; - let ptr = M::tag_new_allocation(self, ptr, kind)?; - Ok(MPlaceTy::from_aligned_ptr(ptr, layout)) + let ptr = self.memory.allocate(layout.size, layout.align.abi, kind); + let ptr = M::tag_new_allocation(self, ptr, kind); + MPlaceTy::from_aligned_ptr(ptr, layout) } } @@ -998,7 +1029,8 @@ where if cfg!(debug_assertions) { let (size, align) = self.read_size_and_align_from_vtable(vtable)?; assert_eq!(size, layout.size); - assert_eq!(align.abi(), layout.align.abi()); // only ABI alignment is preserved + // only ABI alignment is preserved + assert_eq!(align, layout.align.abi); } let mplace = MPlaceTy { diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index 4b63335ad96..5fae461bdc2 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -23,8 +23,8 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use syntax::ast::Mutability; use syntax::source_map::Span; -use super::eval_context::{LocalValue, StackPopCleanup}; -use super::{Frame, Memory, Operand, MemPlace, Place, Immediate, ScalarMaybeUndef}; +use super::eval_context::{LocalState, StackPopCleanup}; +use super::{Frame, Memory, Operand, MemPlace, Place, Immediate, ScalarMaybeUndef, LocalValue}; use const_eval::CompileTimeInterpreter; #[derive(Default)] @@ -314,7 +314,7 @@ struct FrameSnapshot<'a, 'tcx: 'a> { stmt: usize, } -impl_stable_hash_for!(impl<'tcx, 'mir: 'tcx> for struct Frame<'mir, 'tcx> { +impl_stable_hash_for!(impl<'mir, 'tcx: 'mir> for struct Frame<'mir, 'tcx> { mir, instance, span, @@ -323,6 +323,7 @@ impl_stable_hash_for!(impl<'tcx, 'mir: 'tcx> for struct Frame<'mir, 'tcx> { locals, block, stmt, + extra, }); impl<'a, 'mir, 'tcx, Ctx> Snapshot<'a, Ctx> for &'a Frame<'mir, 'tcx> @@ -340,6 +341,7 @@ impl<'a, 'mir, 'tcx, Ctx> Snapshot<'a, Ctx> for &'a Frame<'mir, 'tcx> locals, block, stmt, + extra: _, } = self; FrameSnapshot { @@ -354,6 +356,22 @@ impl<'a, 'mir, 'tcx, Ctx> Snapshot<'a, Ctx> for &'a Frame<'mir, 'tcx> } } +impl<'a, 'tcx, Ctx> Snapshot<'a, Ctx> for &'a LocalState<'tcx> + where Ctx: SnapshotContext<'a>, +{ + type Item = LocalValue<(), AllocIdSnapshot<'a>>; + + fn snapshot(&self, ctx: &'a Ctx) -> Self::Item { + let LocalState { state, layout: _ } = self; + state.snapshot(ctx) + } +} + +impl_stable_hash_for!(struct LocalState<'tcx> { + state, + layout -> _, +}); + impl<'a, 'b, 'mir, 'tcx: 'a+'mir> SnapshotContext<'b> for Memory<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>> { diff --git a/src/librustc_mir/interpret/step.rs b/src/librustc_mir/interpret/step.rs index ac13e5982da..25f3e4c1f77 100644 --- a/src/librustc_mir/interpret/step.rs +++ b/src/librustc_mir/interpret/step.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains the `EvalContext` methods for executing a single step of the interpreter. //! //! The main entry point is the `step` method. @@ -18,7 +8,7 @@ use rustc::mir::interpret::{EvalResult, Scalar, PointerArithmetic}; use super::{EvalContext, Machine}; -/// Classify whether an operator is "left-homogeneous", i.e. the LHS has the +/// Classify whether an operator is "left-homogeneous", i.e., the LHS has the /// same type as the result. #[inline] fn binop_left_homogeneous(op: mir::BinOp) -> bool { @@ -31,7 +21,7 @@ fn binop_left_homogeneous(op: mir::BinOp) -> bool { false, } } -/// Classify whether an operator is "right-homogeneous", i.e. the RHS has the +/// Classify whether an operator is "right-homogeneous", i.e., the RHS has the /// same type as the LHS. #[inline] fn binop_right_homogeneous(op: mir::BinOp) -> bool { @@ -81,11 +71,11 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } fn statement(&mut self, stmt: &mir::Statement<'tcx>) -> EvalResult<'tcx> { - debug!("{:?}", stmt); + info!("{:?}", stmt); use rustc::mir::StatementKind::*; - // Some statements (e.g. box) push new stack frames. + // Some statements (e.g., box) push new stack frames. // We have to record the stack frame number *before* executing the statement. let frame_idx = self.cur_frame(); self.tcx.span = stmt.source_info.span; @@ -119,17 +109,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> FakeRead(..) => {} // Stacked Borrows. - Retag { fn_entry, ref place } => { + Retag(kind, ref place) => { let dest = self.eval_place(place)?; - M::retag(self, fn_entry, dest)?; - } - EscapeToRaw(ref op) => { - let op = self.eval_operand(op, None)?; - M::escape_to_raw(self, op)?; + M::retag(self, kind, dest)?; } // Statements we do not track. - EndRegion(..) => {} AscribeUserType(..) => {} // Defined to do nothing. These are added by optimization passes, to avoid changing the @@ -263,7 +248,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } NullaryOp(mir::NullOp::SizeOf, ty) => { - let ty = self.monomorphize(ty, self.substs()); + let ty = self.monomorphize(ty)?; let layout = self.layout_of(ty)?; assert!(!layout.is_unsized(), "SizeOf nullary MIR operator called for unsized type"); @@ -275,7 +260,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } Cast(kind, ref operand, cast_ty) => { - debug_assert_eq!(self.monomorphize(cast_ty, self.substs()), dest.layout.ty); + debug_assert_eq!(self.monomorphize(cast_ty)?, dest.layout.ty); let src = self.eval_operand(operand, None)?; self.cast(src, kind, dest)?; } @@ -294,7 +279,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } fn terminator(&mut self, terminator: &mir::Terminator<'tcx>) -> EvalResult<'tcx> { - debug!("{:?}", terminator.kind); + info!("{:?}", terminator.kind); self.tcx.span = terminator.source_info.span; self.memory.tcx.span = terminator.source_info.span; @@ -304,7 +289,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> if !self.stack.is_empty() { // This should change *something* debug_assert!(self.cur_frame() != old_stack || self.frame().block != old_bb); - debug!("// {:?}", self.frame().block); + info!("// {:?}", self.frame().block); } Ok(()) } diff --git a/src/librustc_mir/interpret/terminator.rs b/src/librustc_mir/interpret/terminator.rs index 6070b31d3e7..7e823524c18 100644 --- a/src/librustc_mir/interpret/terminator.rs +++ b/src/librustc_mir/interpret/terminator.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::borrow::Cow; use rustc::{mir, ty}; @@ -182,6 +172,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } fn check_argument_compat( + rust_abi: bool, caller: TyLayout<'tcx>, callee: TyLayout<'tcx>, ) -> bool { @@ -189,13 +180,20 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> // No question return true; } + if !rust_abi { + // Don't risk anything + return false; + } // Compare layout match (&caller.abi, &callee.abi) { + // Different valid ranges are okay (once we enforce validity, + // that will take care to make it UB to leave the range, just + // like for transmute). (layout::Abi::Scalar(ref caller), layout::Abi::Scalar(ref callee)) => - // Different valid ranges are okay (once we enforce validity, - // that will take care to make it UB to leave the range, just - // like for transmute). caller.value == callee.value, + (layout::Abi::ScalarPair(ref caller1, ref caller2), + layout::Abi::ScalarPair(ref callee1, ref callee2)) => + caller1.value == callee1.value && caller2.value == callee2.value, // Be conservative _ => false } @@ -204,22 +202,22 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> /// Pass a single argument, checking the types for compatibility. fn pass_argument( &mut self, - skip_zst: bool, + rust_abi: bool, caller_arg: &mut impl Iterator>, callee_arg: PlaceTy<'tcx, M::PointerTag>, ) -> EvalResult<'tcx> { - if skip_zst && callee_arg.layout.is_zst() { + if rust_abi && callee_arg.layout.is_zst() { // Nothing to do. trace!("Skipping callee ZST"); return Ok(()); } let caller_arg = caller_arg.next() .ok_or_else(|| EvalErrorKind::FunctionArgCountMismatch)?; - if skip_zst { + if rust_abi { debug_assert!(!caller_arg.layout.is_zst(), "ZSTs must have been already filtered out"); } // Now, check - if !Self::check_argument_compat(caller_arg.layout, callee_arg.layout) { + if !Self::check_argument_compat(rust_abi, caller_arg.layout, callee_arg.layout) { return err!(FunctionArgMismatch(caller_arg.layout.ty, callee_arg.layout.ty)); } // We allow some transmutes here @@ -244,7 +242,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> return err!(FunctionAbiMismatch(caller_abi, Abi::RustIntrinsic)); } // The intrinsic itself cannot diverge, so if we got here without a return - // place... (can happen e.g. for transmute returning `!`) + // place... (can happen e.g., for transmute returning `!`) let dest = match dest { Some(dest) => dest, None => return err!(Unreachable) @@ -311,7 +309,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> mir.spread_arg, mir.args_iter() .map(|local| - (local, self.layout_of_local(self.frame(), local).unwrap().ty) + (local, self.layout_of_local(self.frame(), local, None).unwrap().ty) ) .collect::>() ); @@ -319,7 +317,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> // Figure out how to pass which arguments. // We have two iterators: Where the arguments come from, // and where they go to. - let skip_zst = match caller_abi { + let rust_abi = match caller_abi { Abi::Rust | Abi::RustCall => true, _ => false }; @@ -344,7 +342,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> }; // Skip ZSTs let mut caller_iter = caller_args.iter() - .filter(|op| !skip_zst || !op.layout.is_zst()) + .filter(|op| !rust_abi || !op.layout.is_zst()) .map(|op| *op); // Now we have to spread them out across the callee's locals, @@ -359,11 +357,11 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> // Must be a tuple for i in 0..dest.layout.fields.count() { let dest = self.place_field(dest, i as u64)?; - self.pass_argument(skip_zst, &mut caller_iter, dest)?; + self.pass_argument(rust_abi, &mut caller_iter, dest)?; } } else { // Normal argument - self.pass_argument(skip_zst, &mut caller_iter, dest)?; + self.pass_argument(rust_abi, &mut caller_iter, dest)?; } } // Now we should have no more caller args @@ -374,14 +372,18 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> // Don't forget to check the return type! if let Some(caller_ret) = dest { let callee_ret = self.eval_place(&mir::Place::Local(mir::RETURN_PLACE))?; - if !Self::check_argument_compat(caller_ret.layout, callee_ret.layout) { + if !Self::check_argument_compat( + rust_abi, + caller_ret.layout, + callee_ret.layout, + ) { return err!(FunctionRetMismatch( caller_ret.layout.ty, callee_ret.layout.ty )); } } else { let callee_layout = - self.layout_of_local(self.frame(), mir::RETURN_PLACE)?; + self.layout_of_local(self.frame(), mir::RETURN_PLACE, None)?; if !callee_layout.abi.is_uninhabited() { return err!(FunctionRetMismatch( self.tcx.types.never, callee_layout.ty @@ -401,12 +403,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> // cannot use the shim here, because that will only result in infinite recursion ty::InstanceDef::Virtual(_, idx) => { let ptr_size = self.pointer_size(); - let ptr_align = self.tcx.data_layout.pointer_align; let ptr = self.deref_operand(args[0])?; let vtable = ptr.vtable()?; - let fn_ptr = self.memory.read_ptr_sized( + self.memory.check_align(vtable.into(), self.tcx.data_layout.pointer_align.abi)?; + let fn_ptr = self.memory.get(vtable.alloc_id)?.read_ptr_sized( + self, vtable.offset(ptr_size * (idx as u64 + 3), self)?, - ptr_align )?.to_ptr()?; let instance = self.memory.get_fn(fn_ptr)?; diff --git a/src/librustc_mir/interpret/traits.rs b/src/librustc_mir/interpret/traits.rs index c5366a5ce6a..642bbc114f5 100644 --- a/src/librustc_mir/interpret/traits.rs +++ b/src/librustc_mir/interpret/traits.rs @@ -1,13 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +use rustc_data_structures::sync::Lrc; use rustc::ty::{self, Ty}; use rustc::ty::layout::{Size, Align, LayoutOf}; use rustc::mir::interpret::{Scalar, Pointer, EvalResult, PointerArithmetic}; @@ -24,7 +15,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> pub fn get_vtable( &mut self, ty: Ty<'tcx>, - poly_trait_ref: ty::PolyExistentialTraitRef<'tcx>, + poly_trait_ref: Option>, ) -> EvalResult<'tcx, Pointer> { trace!("get_vtable(trait_ref={:?})", poly_trait_ref); @@ -34,18 +25,22 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> return Ok(Pointer::from(vtable).with_default_tag()); } - let trait_ref = poly_trait_ref.with_self_ty(*self.tcx, ty); - let trait_ref = self.tcx.erase_regions(&trait_ref); + let methods = if let Some(poly_trait_ref) = poly_trait_ref { + let trait_ref = poly_trait_ref.with_self_ty(*self.tcx, ty); + let trait_ref = self.tcx.erase_regions(&trait_ref); - let methods = self.tcx.vtable_methods(trait_ref); + self.tcx.vtable_methods(trait_ref) + } else { + Lrc::new(Vec::new()) + }; let layout = self.layout_of(ty)?; assert!(!layout.is_unsized(), "can't create a vtable for an unsized type"); let size = layout.size.bytes(); - let align = layout.align.abi(); + let align = layout.align.abi.bytes(); let ptr_size = self.pointer_size(); - let ptr_align = self.tcx.data_layout.pointer_align; + let ptr_align = self.tcx.data_layout.pointer_align.abi; // ///////////////////////////////////////////////////////////////////////////////////////// // If you touch this code, be sure to also make the corresponding changes to // `get_vtable` in rust_codegen_llvm/meth.rs @@ -54,24 +49,35 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> ptr_size * (3 + methods.len() as u64), ptr_align, MemoryKind::Vtable, - )?.with_default_tag(); + ).with_default_tag(); + let tcx = &*self.tcx; - let drop = ::monomorphize::resolve_drop_in_place(*self.tcx, ty); + let drop = ::monomorphize::resolve_drop_in_place(*tcx, ty); let drop = self.memory.create_fn_alloc(drop).with_default_tag(); - self.memory.write_ptr_sized(vtable, ptr_align, Scalar::Ptr(drop).into())?; + // no need to do any alignment checks on the memory accesses below, because we know the + // allocation is correctly aligned as we created it above. Also we're only offsetting by + // multiples of `ptr_align`, which means that it will stay aligned to `ptr_align`. + self.memory + .get_mut(vtable.alloc_id)? + .write_ptr_sized(tcx, vtable, Scalar::Ptr(drop).into())?; let size_ptr = vtable.offset(ptr_size, self)?; - self.memory.write_ptr_sized(size_ptr, ptr_align, Scalar::from_uint(size, ptr_size).into())?; + self.memory + .get_mut(size_ptr.alloc_id)? + .write_ptr_sized(tcx, size_ptr, Scalar::from_uint(size, ptr_size).into())?; let align_ptr = vtable.offset(ptr_size * 2, self)?; - self.memory.write_ptr_sized(align_ptr, ptr_align, - Scalar::from_uint(align, ptr_size).into())?; + self.memory + .get_mut(align_ptr.alloc_id)? + .write_ptr_sized(tcx, align_ptr, Scalar::from_uint(align, ptr_size).into())?; for (i, method) in methods.iter().enumerate() { if let Some((def_id, substs)) = *method { let instance = self.resolve(def_id, substs)?; let fn_ptr = self.memory.create_fn_alloc(instance).with_default_tag(); let method_ptr = vtable.offset(ptr_size * (3 + i as u64), self)?; - self.memory.write_ptr_sized(method_ptr, ptr_align, Scalar::Ptr(fn_ptr).into())?; + self.memory + .get_mut(method_ptr.alloc_id)? + .write_ptr_sized(tcx, method_ptr, Scalar::Ptr(fn_ptr).into())?; } } @@ -87,8 +93,11 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> vtable: Pointer, ) -> EvalResult<'tcx, (ty::Instance<'tcx>, ty::Ty<'tcx>)> { // we don't care about the pointee type, we just want a pointer - let pointer_align = self.tcx.data_layout.pointer_align; - let drop_fn = self.memory.read_ptr_sized(vtable, pointer_align)?.to_ptr()?; + self.memory.check_align(vtable.into(), self.tcx.data_layout.pointer_align.abi)?; + let drop_fn = self.memory + .get(vtable.alloc_id)? + .read_ptr_sized(self, vtable)? + .to_ptr()?; let drop_instance = self.memory.get_fn(drop_fn)?; trace!("Found drop fn: {:?}", drop_instance); let fn_sig = drop_instance.ty(*self.tcx).fn_sig(*self.tcx); @@ -103,13 +112,14 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> vtable: Pointer, ) -> EvalResult<'tcx, (Size, Align)> { let pointer_size = self.pointer_size(); - let pointer_align = self.tcx.data_layout.pointer_align; - let size = self.memory.read_ptr_sized(vtable.offset(pointer_size, self)?,pointer_align)? + self.memory.check_align(vtable.into(), self.tcx.data_layout.pointer_align.abi)?; + let alloc = self.memory.get(vtable.alloc_id)?; + let size = alloc.read_ptr_sized(self, vtable.offset(pointer_size, self)?)? .to_bits(pointer_size)? as u64; - let align = self.memory.read_ptr_sized( + let align = alloc.read_ptr_sized( + self, vtable.offset(pointer_size * 2, self)?, - pointer_align )?.to_bits(pointer_size)? as u64; - Ok((Size::from_bytes(size), Align::from_bytes(align, align).unwrap())) + Ok((Size::from_bytes(size), Align::from_bytes(align).unwrap())) } } diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index ad7ffd291be..8f5a5bf8ee3 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Write; use std::hash::Hash; use std::ops::RangeInclusive; @@ -17,11 +7,11 @@ use rustc::ty::layout::{self, Size, Align, TyLayout, LayoutOf, VariantIdx}; use rustc::ty; use rustc_data_structures::fx::FxHashSet; use rustc::mir::interpret::{ - Scalar, AllocType, EvalResult, EvalErrorKind, InboundsCheck, + Scalar, AllocKind, EvalResult, EvalErrorKind, }; use super::{ - OpTy, MPlaceTy, Machine, EvalContext, ValueVisitor + OpTy, Machine, EvalContext, ValueVisitor, }; macro_rules! validation_failure { @@ -256,7 +246,7 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> variant_id: VariantIdx, new_op: OpTy<'tcx, M::PointerTag> ) -> EvalResult<'tcx> { - let name = old_op.layout.ty.ty_adt_def().unwrap().variants[variant_id].name; + let name = old_op.layout.ty.ty_adt_def().unwrap().variants[variant_id].ident.name; self.visit_elem(new_op, PathElem::Variant(name)) } @@ -312,12 +302,16 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> } } ty::RawPtr(..) => { - // No undef allowed here. Eventually this should be consistent with - // the integer types. - let _ptr = try_validation!(value.to_scalar_ptr(), - "undefined address in pointer", self.path); - let _meta = try_validation!(value.to_meta(), - "uninitialized data in fat pointer metadata", self.path); + if self.const_mode { + // Integers/floats in CTFE: For consistency with integers, we do not + // accept undef. + let _ptr = try_validation!(value.to_scalar_ptr(), + "undefined address in raw pointer", self.path); + let _meta = try_validation!(value.to_meta(), + "uninitialized data in raw fat pointer metadata", self.path); + } else { + // Remain consistent with `usize`: Accept anything. + } } _ if ty.is_box() || ty.is_region_ptr() => { // Handle fat pointers. @@ -355,7 +349,7 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> // for the purpose of validity, consider foreign types to have // alignment and size determined by the layout (size will be 0, // alignment should take attributes into account). - .unwrap_or_else(|| layout.size_and_align()); + .unwrap_or_else(|| (layout.size, layout.align.abi)); match self.ecx.memory.check_align(ptr, align) { Ok(_) => {}, Err(err) => { @@ -384,7 +378,7 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> "integer pointer in non-ZST reference", self.path); // Skip validation entirely for some external statics let alloc_kind = self.ecx.tcx.alloc_map.lock().get(ptr.alloc_id); - if let Some(AllocType::Static(did)) = alloc_kind { + if let Some(AllocKind::Static(did)) = alloc_kind { // `extern static` cannot be validated as they have no body. // FIXME: Statics from other crates are also skipped. // They might be checked at a different type, but for now we @@ -396,13 +390,15 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> // Maintain the invariant that the place we are checking is // already verified to be in-bounds. try_validation!( - self.ecx.memory.check_bounds(ptr, size, InboundsCheck::Live), + self.ecx.memory + .get(ptr.alloc_id)? + .check_bounds(self.ecx, ptr, size), "dangling (not entirely in bounds) reference", self.path); } // Check if we have encountered this pointer+layout combination // before. Proceed recursively even for integer pointers, no // reason to skip them! They are (recursively) valid for some ZST, - // but not for others (e.g. `!` is a ZST). + // but not for others (e.g., `!` is a ZST). let op = place.into(); if ref_tracking.seen.insert(op) { trace!("Recursing below ptr {:#?}", *op); @@ -453,8 +449,13 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> } // At least one value is excluded. Get the bits. let value = try_validation!(value.not_undef(), - value, self.path, - format!("something in the range {:?}", layout.valid_range)); + value, + self.path, + format!( + "something {}", + wrapping_range_format(&layout.valid_range, max_hi), + ) + ); let bits = match value { Scalar::Ptr(ptr) => { if lo == 1 && hi == max_hi { @@ -463,7 +464,7 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> // for function pointers. let non_null = self.ecx.memory.check_align( - Scalar::Ptr(ptr), Align::from_bytes(1, 1).unwrap() + Scalar::Ptr(ptr), Align::from_bytes(1).unwrap() ).is_ok() || self.ecx.memory.get_fn(ptr).is_ok(); if !non_null { @@ -520,31 +521,37 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> _ => false, } } => { - let mplace = if op.layout.is_zst() { - // it's a ZST, the memory content cannot matter - MPlaceTy::dangling(op.layout, self.ecx) - } else { - // non-ZST array/slice/str cannot be immediate - op.to_mem_place() - }; + // bailing out for zsts is ok, since the array element type can only be int/float + if op.layout.is_zst() { + return Ok(()); + } + // non-ZST array cannot be immediate, slices are never immediate + let mplace = op.to_mem_place(); // This is the length of the array/slice. let len = mplace.len(self.ecx)?; + // zero length slices have nothing to be checked + if len == 0 { + return Ok(()); + } // This is the element type size. let ty_size = self.ecx.layout_of(tys)?.size; // This is the size in bytes of the whole array. let size = ty_size * len; + let ptr = mplace.ptr.to_ptr()?; + // NOTE: Keep this in sync with the handling of integer and float // types above, in `visit_primitive`. // In run-time mode, we accept pointers in here. This is actually more - // permissive than a per-element check would be, e.g. we accept + // permissive than a per-element check would be, e.g., we accept // an &[u8] that contains a pointer even though bytewise checking would // reject it. However, that's good: We don't inherently want // to reject those pointers, we just do not have the machinery to // talk about parts of a pointer. // We also accept undef, for consistency with the type-based checks. - match self.ecx.memory.check_bytes( - mplace.ptr, + match self.ecx.memory.get(ptr.alloc_id)?.check_bytes( + self.ecx, + ptr, size, /*allow_ptr_and_undef*/!self.const_mode, ) { diff --git a/src/librustc_mir/interpret/visitor.rs b/src/librustc_mir/interpret/visitor.rs index f0a71242599..4773f5627d7 100644 --- a/src/librustc_mir/interpret/visitor.rs +++ b/src/librustc_mir/interpret/visitor.rs @@ -158,7 +158,9 @@ macro_rules! make_value_visitor { ) -> EvalResult<'tcx> { self.walk_aggregate(v, fields) } - /// Called each time we recurse down to a field, passing in old and new value. + + /// Called each time we recurse down to a field of a "product-like" aggregate + /// (structs, tuples, arrays and the like, but not enums), passing in old and new value. /// This gives the visitor the chance to track the stack of nested fields that /// we are descending through. #[inline(always)] @@ -171,6 +173,19 @@ macro_rules! make_value_visitor { self.visit_value(new_val) } + /// Called for recursing into the field of a generator. These are not known to be + /// initialized, so we treat them like unions. + #[inline(always)] + fn visit_generator_field( + &mut self, + _old_val: Self::V, + _field: usize, + new_val: Self::V, + ) -> EvalResult<'tcx> { + self.visit_union(new_val) + } + + /// Called when recursing into an enum variant. #[inline(always)] fn visit_variant( &mut self, @@ -257,7 +272,7 @@ macro_rules! make_value_visitor { // is very relevant for `NonNull` and similar structs: We need to visit them // at their scalar layout *before* descending into their fields. // FIXME: We could avoid some redundant checks here. For newtypes wrapping - // scalars, we do the same check on every "level" (e.g. first we check + // scalars, we do the same check on every "level" (e.g., first we check // MyNewtype and then the scalar in there). match v.layout().abi { layout::Abi::Uninhabited => { @@ -291,17 +306,33 @@ macro_rules! make_value_visitor { // use that as an unambiguous signal for detecting primitives. Make sure // we did not miss any primitive. debug_assert!(fields > 0); - self.visit_union(v)?; + self.visit_union(v) }, layout::FieldPlacement::Arbitrary { ref offsets, .. } => { - // FIXME: We collect in a vec because otherwise there are lifetime errors: - // Projecting to a field needs (mutable!) access to `ecx`. - let fields: Vec> = - (0..offsets.len()).map(|i| { - v.project_field(self.ecx(), i as u64) - }) - .collect(); - self.visit_aggregate(v, fields.into_iter())?; + // Special handling needed for generators: All but the first field + // (which is the state) are actually implicitly `MaybeUninit`, i.e., + // they may or may not be initialized, so we cannot visit them. + match v.layout().ty.sty { + ty::Generator(..) => { + let field = v.project_field(self.ecx(), 0)?; + self.visit_aggregate(v, std::iter::once(Ok(field)))?; + for i in 1..offsets.len() { + let field = v.project_field(self.ecx(), i as u64)?; + self.visit_generator_field(v, i, field)?; + } + Ok(()) + } + _ => { + // FIXME: We collect in a vec because otherwise there are lifetime + // errors: Projecting to a field needs access to `ecx`. + let fields: Vec> = + (0..offsets.len()).map(|i| { + v.project_field(self.ecx(), i as u64) + }) + .collect(); + self.visit_aggregate(v, fields.into_iter()) + } + } }, layout::FieldPlacement::Array { .. } => { // Let's get an mplace first. @@ -317,10 +348,9 @@ macro_rules! make_value_visitor { .map(|f| f.and_then(|f| { Ok(Value::from_mem_place(f)) })); - self.visit_aggregate(v, iter)?; + self.visit_aggregate(v, iter) } } - Ok(()) } } } diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index 1a35f4da20b..ccfc15bac04 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /*! Rust MIR: a lowered representation of Rust. Also: an experiment! @@ -34,10 +24,8 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![feature(unicode_internals)] #![feature(step_trait)] #![feature(slice_concat_ext)] -#![feature(if_while_or_patterns)] #![feature(try_from)] #![feature(reverse_bits)] -#![feature(underscore_imports)] #![recursion_limit="256"] diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index 4c7938504c1..8ded31d89da 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::bit_set::BitSet; use rustc::hir::def_id::DefId; use rustc::hir::intravisit::FnKind; @@ -20,9 +10,9 @@ use rustc::ty::subst::Substs; pub fn check(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &Mir<'tcx>, def_id: DefId) { - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - if let Some(fn_like_node) = FnLikeNode::from_node(tcx.hir.get(node_id)) { + if let Some(fn_like_node) = FnLikeNode::from_node(tcx.hir().get(node_id)) { check_fn_for_unconditional_recursion(tcx, fn_like_node.kind(), mir, def_id); } } @@ -39,11 +29,11 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>, //FIXME(#54444) rewrite this lint to use the dataflow framework // Walk through this function (say `f`) looking to see if - // every possible path references itself, i.e. the function is + // every possible path references itself, i.e., the function is // called recursively unconditionally. This is done by trying // to find a path from the entry node to the exit node that // *doesn't* call `f` by traversing from the entry while - // pretending that calls of `f` are sinks (i.e. ignoring any + // pretending that calls of `f` are sinks (i.e., ignoring any // exit edges from them). // // NB. this has an edge case with non-returning statements, @@ -62,7 +52,7 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>, // considers this to be an error for two reasons, (a) it is // easier to implement, and (b) it seems rare to actually want // to have behaviour like the above, rather than - // e.g. accidentally recursing after an assert. + // e.g., accidentally recursing after an assert. let basic_blocks = mir.basic_blocks(); let mut reachable_without_self_call_queue = vec![mir::START_BLOCK]; @@ -135,12 +125,12 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>, } // Check the number of self calls because a function that - // doesn't return (e.g. calls a `-> !` function or `loop { /* + // doesn't return (e.g., calls a `-> !` function or `loop { /* // no break */ }`) shouldn't be linted unless it actually // recurs. if !reached_exit_without_self_call && !self_call_locations.is_empty() { - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let sp = tcx.sess.source_map().def_span(tcx.hir.span(node_id)); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let sp = tcx.sess.source_map().def_span(tcx.hir().span(node_id)); let mut db = tcx.struct_span_lint_node(UNCONDITIONAL_RECURSION, node_id, sp, diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index b4ffb39a2eb..e713ab17c3a 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Mono Item Collection //! =========================== //! @@ -139,7 +129,7 @@ //! //! #### Boxes //! Since `Box` expression have special compiler support, no explicit calls to -//! `exchange_malloc()` and `exchange_free()` may show up in MIR, even if the +//! `exchange_malloc()` and `box_free()` may show up in MIR, even if the //! compiler will generate them. We have to observe `Rvalue::Box` expressions //! and Box-typed drop-statements for that purpose. //! @@ -178,10 +168,6 @@ //! Some things are not yet fully implemented in the current version of this //! module. //! -//! ### Initializers of Constants and Statics -//! Since no MIR is constructed yet for initializer expressions of constants and -//! statics we cannot inspect these properly. -//! //! ### Const Fns //! Ideally, no mono item should be generated for const fns unless there //! is a call to them that cannot be evaluated at compile time. At the moment @@ -191,18 +177,17 @@ use rustc::hir::{self, CodegenFnAttrFlags}; use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::Node; -use rustc::hir::def_id::DefId; +use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::mir::interpret::{AllocId, ConstValue}; use rustc::middle::lang_items::{ExchangeMallocFnLangItem, StartFnLangItem}; use rustc::ty::subst::Substs; use rustc::ty::{self, TypeFoldable, Ty, TyCtxt, GenericParamDefKind}; use rustc::ty::adjustment::CustomCoerceUnsized; -use rustc::session::config; +use rustc::session::config::EntryFnType; use rustc::mir::{self, Location, Promoted}; use rustc::mir::visit::Visitor as MirVisitor; use rustc::mir::mono::MonoItem; -use rustc::mir::interpret::{Scalar, GlobalId, AllocType, ErrorHandled}; +use rustc::mir::interpret::{Scalar, GlobalId, AllocKind, ErrorHandled}; use monomorphize::{self, Instance}; use rustc::util::nodemap::{FxHashSet, FxHashMap, DefIdMap}; @@ -336,9 +321,7 @@ fn collect_roots<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let mut roots = Vec::new(); { - let entry_fn = tcx.sess.entry_fn.borrow().map(|(node_id, _, _)| { - tcx.hir.local_def_id(node_id) - }); + let entry_fn = tcx.entry_fn(LOCAL_CRATE); debug!("collect_roots: entry_fn = {:?}", entry_fn); @@ -349,7 +332,7 @@ fn collect_roots<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, output: &mut roots, }; - tcx.hir.krate().visit_all_item_likes(&mut visitor); + tcx.hir().krate().visit_all_item_likes(&mut visitor); visitor.push_extra_entry_roots(); } @@ -372,7 +355,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // We've been here already, no need to search again. return; } - debug!("BEGIN collect_items_rec({})", starting_point.to_string(tcx)); + debug!("BEGIN collect_items_rec({})", starting_point.to_string(tcx, true)); let mut neighbors = Vec::new(); let recursion_depth_reset; @@ -396,7 +379,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let param_env = ty::ParamEnv::reveal_all(); if let Ok(val) = tcx.const_eval(param_env.and(cid)) { - collect_const(tcx, val, instance.substs, &mut neighbors); + collect_const(tcx, val, &mut neighbors); } } MonoItem::Fn(instance) => { @@ -426,7 +409,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, recursion_depths.insert(def_id, depth); } - debug!("END collect_items_rec({})", starting_point.to_string(tcx)); + debug!("END collect_items_rec({})", starting_point.to_string(tcx, true)); } fn record_accesses<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -467,8 +450,8 @@ fn check_recursion_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if recursion_depth > *tcx.sess.recursion_limit.get() { let error = format!("reached the recursion limit while instantiating `{}`", instance); - if let Some(node_id) = tcx.hir.as_local_node_id(def_id) { - tcx.sess.span_fatal(tcx.hir.span(node_id), &error); + if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { + tcx.sess.span_fatal(tcx.hir().span(node_id), &error); } else { tcx.sess.fatal(&error); } @@ -499,8 +482,8 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let instance_name = instance.to_string(); let msg = format!("reached the type-length limit while instantiating `{:.64}...`", instance_name); - let mut diag = if let Some(node_id) = tcx.hir.as_local_node_id(instance.def_id()) { - tcx.sess.struct_span_fatal(tcx.hir.span(node_id), &msg) + let mut diag = if let Some(node_id) = tcx.hir().as_local_node_id(instance.def_id()) { + tcx.sess.struct_span_fatal(tcx.hir().span(node_id), &msg) } else { tcx.sess.struct_fatal(&msg) }; @@ -598,10 +581,10 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { self.super_rvalue(rvalue, location); } - fn visit_const(&mut self, constant: &&'tcx ty::Const<'tcx>, location: Location) { + fn visit_const(&mut self, constant: &&'tcx ty::LazyConst<'tcx>, location: Location) { debug!("visiting const {:?} @ {:?}", *constant, location); - collect_const(self.tcx, constant, self.param_substs, self.output); + collect_lazy_const(self.tcx, constant, self.param_substs, self.output); self.super_const(constant); } @@ -741,27 +724,27 @@ fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: ty::InstanceDef::CloneShim(..) => return true }; - return match tcx.hir.get_if_local(def_id) { - Some(Node::ForeignItem(..)) => { - false // foreign items are linked against, not codegened. - } - Some(_) => true, - None => { - if tcx.is_reachable_non_generic(def_id) || - tcx.is_foreign_item(def_id) || - is_available_upstream_generic(tcx, def_id, instance.substs) - { - // We can link to the item in question, no instance needed - // in this crate - false - } else { - if !tcx.is_mir_available(def_id) { - bug!("Cannot create local mono-item for {:?}", def_id) - } - true - } - } - }; + if tcx.is_foreign_item(def_id) { + // We can always link to foreign items + return false; + } + + if def_id.is_local() { + // local items cannot be referred to locally without monomorphizing them locally + return true; + } + + if tcx.is_reachable_non_generic(def_id) || + is_available_upstream_generic(tcx, def_id, instance.substs) { + // We can link to the item in question, no instance needed + // in this crate + return false; + } + + if !tcx.is_mir_available(def_id) { + bug!("Cannot create local mono-item for {:?}", def_id) + } + return true; fn is_available_upstream_generic<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, @@ -826,7 +809,7 @@ fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: /// Again, we want this `find_vtable_types_for_unsizing()` to provide the pair /// `(SomeStruct, SomeTrait)`. /// -/// Finally, there is also the case of custom unsizing coercions, e.g. for +/// Finally, there is also the case of custom unsizing coercions, e.g., for /// smart pointers such as `Rc` and `Arc`. fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, source_ty: Ty<'tcx>, @@ -909,20 +892,23 @@ fn create_mono_items_for_vtable_methods<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, !impl_ty.needs_subst() && !impl_ty.has_escaping_bound_vars()); if let ty::Dynamic(ref trait_ty, ..) = trait_ty.sty { - let poly_trait_ref = trait_ty.principal().with_self_ty(tcx, impl_ty); - assert!(!poly_trait_ref.has_escaping_bound_vars()); - - // Walk all methods of the trait, including those of its supertraits - let methods = tcx.vtable_methods(poly_trait_ref); - let methods = methods.iter().cloned().filter_map(|method| method) - .map(|(def_id, substs)| ty::Instance::resolve_for_vtable( + if let Some(principal) = trait_ty.principal() { + let poly_trait_ref = principal.with_self_ty(tcx, impl_ty); + assert!(!poly_trait_ref.has_escaping_bound_vars()); + + // Walk all methods of the trait, including those of its supertraits + let methods = tcx.vtable_methods(poly_trait_ref); + let methods = methods.iter().cloned().filter_map(|method| method) + .map(|(def_id, substs)| ty::Instance::resolve_for_vtable( tcx, ty::ParamEnv::reveal_all(), def_id, substs).unwrap()) - .filter(|&instance| should_monomorphize_locally(tcx, &instance)) - .map(|instance| create_fn_mono_item(instance)); - output.extend(methods); + .filter(|&instance| should_monomorphize_locally(tcx, &instance)) + .map(|instance| create_fn_mono_item(instance)); + output.extend(methods); + } + // Also add the destructor visit_drop_use(tcx, impl_ty, false, output); } @@ -936,7 +922,7 @@ struct RootCollector<'b, 'a: 'b, 'tcx: 'a + 'b> { tcx: TyCtxt<'a, 'tcx, 'tcx>, mode: MonoItemCollectionMode, output: &'b mut Vec>, - entry_fn: Option, + entry_fn: Option<(DefId, EntryFnType)>, } impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { @@ -966,7 +952,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { hir::ItemKind::Union(_, ref generics) => { if generics.params.is_empty() { if self.mode == MonoItemCollectionMode::Eager { - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); debug!("RootCollector: ADT drop-glue for {}", def_id_to_string(self.tcx, def_id)); @@ -978,11 +964,11 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { hir::ItemKind::GlobalAsm(..) => { debug!("RootCollector: ItemKind::GlobalAsm({})", def_id_to_string(self.tcx, - self.tcx.hir.local_def_id(item.id))); + self.tcx.hir().local_def_id(item.id))); self.output.push(MonoItem::GlobalAsm(item.id)); } hir::ItemKind::Static(..) => { - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); debug!("RootCollector: ItemKind::Static({})", def_id_to_string(self.tcx, def_id)); self.output.push(MonoItem::Static(def_id)); @@ -992,7 +978,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { // actually used somewhere. Just declaring them is insufficient. // but even just declaring them must collect the items they refer to - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); let instance = Instance::mono(self.tcx, def_id); let cid = GlobalId { @@ -1002,11 +988,11 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { let param_env = ty::ParamEnv::reveal_all(); if let Ok(val) = self.tcx.const_eval(param_env.and(cid)) { - collect_const(self.tcx, val, instance.substs, &mut self.output); + collect_const(self.tcx, val, &mut self.output); } } hir::ItemKind::Fn(..) => { - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); self.push_if_root(def_id); } } @@ -1020,7 +1006,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { fn visit_impl_item(&mut self, ii: &'v hir::ImplItem) { match ii.node { hir::ImplItemKind::Method(hir::MethodSig { .. }, _) => { - let def_id = self.tcx.hir.local_def_id(ii.id); + let def_id = self.tcx.hir().local_def_id(ii.id); self.push_if_root(def_id); } _ => { /* Nothing to do here */ } @@ -1035,7 +1021,7 @@ impl<'b, 'a, 'v> RootCollector<'b, 'a, 'v> { true } MonoItemCollectionMode::Lazy => { - self.entry_fn == Some(def_id) || + self.entry_fn.map(|(id, _)| id) == Some(def_id) || self.tcx.is_reachable_non_generic(def_id) || self.tcx.codegen_fn_attrs(def_id).flags.contains( CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL) @@ -1060,14 +1046,9 @@ impl<'b, 'a, 'v> RootCollector<'b, 'a, 'v> { /// the return type of `main`. This is not needed when /// the user writes their own `start` manually. fn push_extra_entry_roots(&mut self) { - if self.tcx.sess.entry_fn.get().map(|e| e.2) != Some(config::EntryFnType::Main) { - return - } - - let main_def_id = if let Some(def_id) = self.entry_fn { - def_id - } else { - return + let main_def_id = match self.entry_fn { + Some((def_id, EntryFnType::Main)) => def_id, + _ => return, }; let start_def_id = match self.tcx.lang_items().require(StartFnLangItem) { @@ -1113,7 +1094,7 @@ fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } - let impl_def_id = tcx.hir.local_def_id(item.id); + let impl_def_id = tcx.hir().local_def_id(item.id); debug!("create_mono_items_for_default_impls(item={})", def_id_to_string(tcx, impl_def_id)); @@ -1166,22 +1147,22 @@ fn collect_miri<'a, 'tcx>( alloc_id: AllocId, output: &mut Vec>, ) { - let alloc_type = tcx.alloc_map.lock().get(alloc_id); - match alloc_type { - Some(AllocType::Static(did)) => { + let alloc_kind = tcx.alloc_map.lock().get(alloc_id); + match alloc_kind { + Some(AllocKind::Static(did)) => { let instance = Instance::mono(tcx, did); if should_monomorphize_locally(tcx, &instance) { trace!("collecting static {:?}", did); output.push(MonoItem::Static(did)); } } - Some(AllocType::Memory(alloc)) => { + Some(AllocKind::Memory(alloc)) => { trace!("collecting {:?} with {:#?}", alloc_id, alloc); for &((), inner) in alloc.relocations.values() { collect_miri(tcx, inner, output); } }, - Some(AllocType::Function(fn_instance)) => { + Some(AllocKind::Function(fn_instance)) => { if should_monomorphize_locally(tcx, &fn_instance) { trace!("collecting {:?} with {:#?}", alloc_id, fn_instance); output.push(create_fn_mono_item(fn_instance)); @@ -1213,7 +1194,7 @@ fn collect_neighbours<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, promoted: Some(i), }; match tcx.const_eval(param_env.and(cid)) { - Ok(val) => collect_const(tcx, val, instance.substs, output), + Ok(val) => collect_const(tcx, val, output), Err(ErrorHandled::Reported) => {}, Err(ErrorHandled::TooGeneric) => span_bug!( mir.promoted[i].span, "collection encountered polymorphic constant", @@ -1231,49 +1212,49 @@ fn def_id_to_string<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, output } -fn collect_const<'a, 'tcx>( +fn collect_lazy_const<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, - constant: &ty::Const<'tcx>, + constant: &ty::LazyConst<'tcx>, param_substs: &'tcx Substs<'tcx>, output: &mut Vec>, ) { - debug!("visiting const {:?}", *constant); + let (def_id, substs) = match *constant { + ty::LazyConst::Evaluated(c) => return collect_const(tcx, c, output), + ty::LazyConst::Unevaluated(did, substs) => (did, substs), + }; + let param_env = ty::ParamEnv::reveal_all(); + let substs = tcx.subst_and_normalize_erasing_regions( + param_substs, + param_env, + &substs, + ); + let instance = ty::Instance::resolve(tcx, + param_env, + def_id, + substs).unwrap(); + + let cid = GlobalId { + instance, + promoted: None, + }; + match tcx.const_eval(param_env.and(cid)) { + Ok(val) => collect_const(tcx, val, output), + Err(ErrorHandled::Reported) => {}, + Err(ErrorHandled::TooGeneric) => span_bug!( + tcx.def_span(def_id), "collection encountered polymorphic constant", + ), + } +} - let val = match constant.val { - ConstValue::Unevaluated(def_id, substs) => { - let param_env = ty::ParamEnv::reveal_all(); - let substs = tcx.subst_and_normalize_erasing_regions( - param_substs, - param_env, - &substs, - ); - let instance = ty::Instance::resolve(tcx, - param_env, - def_id, - substs).unwrap(); +fn collect_const<'a, 'tcx>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + constant: ty::Const<'tcx>, + output: &mut Vec>, +) { + debug!("visiting const {:?}", constant); - let cid = GlobalId { - instance, - promoted: None, - }; - match tcx.const_eval(param_env.and(cid)) { - Ok(val) => val.val, - Err(ErrorHandled::Reported) => return, - Err(ErrorHandled::TooGeneric) => span_bug!( - tcx.def_span(def_id), "collection encountered polymorphic constant", - ), - } - }, - _ => constant.val, - }; - match val { - ConstValue::Unevaluated(..) => bug!("const eval yielded unevaluated const"), - ConstValue::ScalarPair(Scalar::Ptr(a), Scalar::Ptr(b)) => { - collect_miri(tcx, a.alloc_id, output); - collect_miri(tcx, b.alloc_id, output); - } - ConstValue::ScalarPair(_, Scalar::Ptr(ptr)) | - ConstValue::ScalarPair(Scalar::Ptr(ptr), _) | + match constant.val { + ConstValue::Slice(Scalar::Ptr(ptr), _) | ConstValue::Scalar(Scalar::Ptr(ptr)) => collect_miri(tcx, ptr.alloc_id, output), ConstValue::ByRef(_id, alloc, _offset) => { diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index 9d69a5669b1..431cc0d52b4 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -1,22 +1,6 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Walks the crate looking for items/impl-items/trait-items that have -//! either a `rustc_symbol_name` or `rustc_item_path` attribute and -//! generates an error giving, respectively, the symbol name or -//! item-path. This is used for unit testing the code that generates -//! paths etc in all kinds of annoying scenarios. - use monomorphize::Instance; use rustc::hir; -use rustc::hir::def_id::DefId; +use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::session::config::OptLevel; use rustc::ty::{self, Ty, TyCtxt, ClosureSubsts, GeneratorSubsts}; use rustc::ty::subst::Substs; @@ -74,7 +58,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { tcx.symbol_name(Instance::mono(tcx, def_id)) } MonoItem::GlobalAsm(node_id) => { - let def_id = tcx.hir.local_def_id(node_id); + let def_id = tcx.hir().local_def_id(node_id); ty::SymbolName { name: Symbol::intern(&format!("global_asm_{:?}", def_id)).as_interned_str() } @@ -91,8 +75,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { match *self.as_mono_item() { MonoItem::Fn(ref instance) => { - let entry_def_id = - tcx.sess.entry_fn.borrow().map(|(id, _, _)| tcx.hir.local_def_id(id)); + let entry_def_id = tcx.entry_fn(LOCAL_CRATE).map(|(id, _)| id); // If this function isn't inlined or otherwise has explicit // linkage, then we'll be creating a globally shared version. if self.explicit_linkage(tcx).is_some() || @@ -176,14 +159,14 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { tcx.substitute_normalize_and_test_predicates((def_id, &substs)) } - fn to_string(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> String { + fn to_string(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, debug: bool) -> String { return match *self.as_mono_item() { MonoItem::Fn(instance) => { - to_string_internal(tcx, "fn ", instance) + to_string_internal(tcx, "fn ", instance, debug) }, MonoItem::Static(def_id) => { let instance = Instance::new(def_id, tcx.intern_substs(&[])); - to_string_internal(tcx, "static ", instance) + to_string_internal(tcx, "static ", instance, debug) }, MonoItem::GlobalAsm(..) => { "global_asm".to_string() @@ -192,12 +175,13 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, prefix: &str, - instance: Instance<'tcx>) + instance: Instance<'tcx>, + debug: bool) -> String { let mut result = String::with_capacity(32); result.push_str(prefix); let printer = DefPathBasedNames::new(tcx, false, false); - printer.push_instance_as_string(instance, &mut result); + printer.push_instance_as_string(instance, &mut result, debug); result } } @@ -205,15 +189,15 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option { match *self.as_mono_item() { MonoItem::Fn(Instance { def, .. }) => { - tcx.hir.as_local_node_id(def.def_id()) + tcx.hir().as_local_node_id(def.def_id()) } MonoItem::Static(def_id) => { - tcx.hir.as_local_node_id(def_id) + tcx.hir().as_local_node_id(def_id) } MonoItem::GlobalAsm(node_id) => { Some(node_id) } - }.map(|node_id| tcx.hir.span(node_id)) + }.map(|node_id| tcx.hir().span(node_id)) } } @@ -255,7 +239,13 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { } } - pub fn push_type_name(&self, t: Ty<'tcx>, output: &mut String) { + // Pushes the type name of the specified type to the provided string. + // If 'debug' is true, printing normally unprintable types is allowed + // (e.g. ty::GeneratorWitness). This parameter should only be set when + // this method is being used for logging purposes (e.g. with debug! or info!) + // When being used for codegen purposes, 'debug' should be set to 'false' + // in order to catch unexpected types that should never end up in a type name + pub fn push_type_name(&self, t: Ty<'tcx>, output: &mut String, debug: bool) { match t.sty { ty::Bool => output.push_str("bool"), ty::Char => output.push_str("char"), @@ -277,12 +267,12 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { ty::Float(ast::FloatTy::F64) => output.push_str("f64"), ty::Adt(adt_def, substs) => { self.push_def_path(adt_def.did, output); - self.push_type_params(substs, iter::empty(), output); + self.push_type_params(substs, iter::empty(), output, debug); }, ty::Tuple(component_types) => { output.push('('); for &component_type in component_types { - self.push_type_name(component_type, output); + self.push_type_name(component_type, output, debug); output.push_str(", "); } if !component_types.is_empty() { @@ -298,7 +288,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { hir::MutMutable => output.push_str("mut "), } - self.push_type_name(inner_type, output); + self.push_type_name(inner_type, output, debug); }, ty::Ref(_, inner_type, mutbl) => { output.push('&'); @@ -306,27 +296,31 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { output.push_str("mut "); } - self.push_type_name(inner_type, output); + self.push_type_name(inner_type, output, debug); }, ty::Array(inner_type, len) => { output.push('['); - self.push_type_name(inner_type, output); + self.push_type_name(inner_type, output, debug); write!(output, "; {}", len.unwrap_usize(self.tcx)).unwrap(); output.push(']'); }, ty::Slice(inner_type) => { output.push('['); - self.push_type_name(inner_type, output); + self.push_type_name(inner_type, output, debug); output.push(']'); }, ty::Dynamic(ref trait_data, ..) => { - let principal = trait_data.principal(); - self.push_def_path(principal.def_id(), output); - self.push_type_params( - principal.skip_binder().substs, - trait_data.projection_bounds(), - output, - ); + if let Some(principal) = trait_data.principal() { + self.push_def_path(principal.def_id(), output); + self.push_type_params( + principal.skip_binder().substs, + trait_data.projection_bounds(), + output, + debug + ); + } else { + output.push_str("dyn '_"); + } }, ty::Foreign(did) => self.push_def_path(did, output), ty::FnDef(..) | @@ -352,7 +346,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { if !sig.inputs().is_empty() { for ¶meter_type in sig.inputs() { - self.push_type_name(parameter_type, output); + self.push_type_name(parameter_type, output, debug); output.push_str(", "); } output.pop(); @@ -371,7 +365,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { if !sig.output().is_unit() { output.push_str(" -> "); - self.push_type_name(sig.output(), output); + self.push_type_name(sig.output(), output, debug); } }, ty::Generator(def_id, GeneratorSubsts { ref substs }, _) | @@ -379,18 +373,23 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { self.push_def_path(def_id, output); let generics = self.tcx.generics_of(self.tcx.closure_base_def_id(def_id)); let substs = substs.truncate_to(self.tcx, generics); - self.push_type_params(substs, iter::empty(), output); + self.push_type_params(substs, iter::empty(), output, debug); } ty::Error | ty::Bound(..) | ty::Infer(_) | + ty::Placeholder(..) | ty::UnnormalizedProjection(..) | ty::Projection(..) | ty::Param(_) | ty::GeneratorWitness(_) | ty::Opaque(..) => { - bug!("DefPathBasedNames: Trying to create type name for \ + if debug { + output.push_str(&format!("`{:?}`", t)); + } else { + bug!("DefPathBasedNames: Trying to create type name for \ unexpected type: {:?}", t); + } } } } @@ -425,7 +424,8 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { fn push_type_params(&self, substs: &Substs<'tcx>, projections: I, - output: &mut String) + output: &mut String, + debug: bool) where I: Iterator> { let mut projections = projections.peekable(); @@ -436,7 +436,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { output.push('<'); for type_parameter in substs.types() { - self.push_type_name(type_parameter, output); + self.push_type_name(type_parameter, output, debug); output.push_str(", "); } @@ -445,7 +445,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { let name = &self.tcx.associated_item(projection.item_def_id).ident.as_str(); output.push_str(name); output.push_str("="); - self.push_type_name(projection.ty, output); + self.push_type_name(projection.ty, output, debug); output.push_str(", "); } @@ -457,8 +457,9 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { pub fn push_instance_as_string(&self, instance: Instance<'tcx>, - output: &mut String) { + output: &mut String, + debug: bool) { self.push_def_path(instance.def_id(), output); - self.push_type_params(instance.substs, iter::empty(), output); + self.push_type_params(instance.substs, iter::empty(), output, debug); } } diff --git a/src/librustc_mir/monomorphize/mod.rs b/src/librustc_mir/monomorphize/mod.rs index 30556759bd3..7fa904d32cb 100644 --- a/src/librustc_mir/monomorphize/mod.rs +++ b/src/librustc_mir/monomorphize/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir::def_id::DefId; use rustc::middle::lang_items::DropInPlaceFnLangItem; use rustc::traits; diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index 6dba020120f..569e4c828f6 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Partitioning Codegen Units for Incremental Compilation //! ====================================================== //! @@ -51,7 +41,7 @@ //! //! - There are two codegen units for every source-level module: //! - One for "stable", that is non-generic, code -//! - One for more "volatile" code, i.e. monomorphized instances of functions +//! - One for more "volatile" code, i.e., monomorphized instances of functions //! defined in that module //! //! In order to see why this heuristic makes sense, let's take a look at when a @@ -184,7 +174,7 @@ pub trait CodegenUnitExt<'tcx> { // the codegen tests and can even make item order // unstable. InstanceDef::Item(def_id) => { - tcx.hir.as_local_node_id(def_id) + tcx.hir().as_local_node_id(def_id) } InstanceDef::VtableShim(..) | InstanceDef::Intrinsic(..) | @@ -198,7 +188,7 @@ pub trait CodegenUnitExt<'tcx> { } } MonoItem::Static(def_id) => { - tcx.hir.as_local_node_id(def_id) + tcx.hir().as_local_node_id(def_id) } MonoItem::GlobalAsm(node_id) => { Some(node_id) @@ -415,7 +405,7 @@ fn mono_item_visibility( }; } MonoItem::GlobalAsm(node_id) => { - let def_id = tcx.hir.local_def_id(*node_id); + let def_id = tcx.hir().local_def_id(*node_id); return if tcx.is_reachable_non_generic(def_id) { *can_be_internalized = false; default_visibility(tcx, def_id, false) @@ -585,7 +575,7 @@ fn merge_codegen_units<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, // smallest into each other) we're sure to start off with a deterministic // order (sorted by name). This'll mean that if two cgus have the same size // the stable sort below will keep everything nice and deterministic. - codegen_units.sort_by_key(|cgu| cgu.name().clone()); + codegen_units.sort_by_key(|cgu| *cgu.name()); // Merge the two smallest codegen units until the target size is reached. while codegen_units.len() > target_cgu_count { @@ -799,7 +789,7 @@ fn characteristic_def_id_of_mono_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, Some(def_id) } MonoItem::Static(def_id) => Some(def_id), - MonoItem::GlobalAsm(node_id) => Some(tcx.hir.local_def_id(node_id)), + MonoItem::GlobalAsm(node_id) => Some(tcx.hir().local_def_id(node_id)), } } @@ -889,7 +879,7 @@ fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, .unwrap_or(""); debug!(" - {} [{:?}] [{}]", - mono_item.to_string(tcx), + mono_item.to_string(tcx, true), linkage, symbol_hash); } @@ -981,11 +971,11 @@ fn collect_and_partition_mono_items<'a, 'tcx>( let mut item_keys: Vec<_> = items .iter() .map(|i| { - let mut output = i.to_string(tcx); + let mut output = i.to_string(tcx, false); output.push_str(" @@"); let mut empty = Vec::new(); let cgus = item_to_cgus.get_mut(i).unwrap_or(&mut empty); - cgus.as_mut_slice().sort_by_key(|&(ref name, _)| name.clone()); + cgus.sort_by_key(|(name, _)| *name); cgus.dedup(); for &(ref cgu_name, (linkage, _)) in cgus.iter() { output.push_str(" "); diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 93bf1b3e36e..751815eab28 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir; use rustc::hir::def_id::DefId; use rustc::infer; @@ -217,20 +207,22 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, IndexVec::new(), None, local_decls_for_sig(&sig, span), + IndexVec::new(), sig.inputs().len(), vec![], - span + span, + vec![], ); if let Some(..) = ty { // The first argument (index 0), but add 1 for the return value. let dropee_ptr = Place::Local(Local::new(1+0)); if tcx.sess.opts.debugging_opts.mir_emit_retag { - // We use raw ptr operations, better prepare the alias tracking for that + // Function arguments should be retagged, and we make this one raw. mir.basic_blocks_mut()[START_BLOCK].statements.insert(0, Statement { source_info, - kind: StatementKind::EscapeToRaw(Operand::Copy(dropee_ptr.clone())), - }) + kind: StatementKind::Retag(RetagKind::Raw, dropee_ptr.clone()), + }); } let patch = { let param_env = tcx.param_env(def_id).with_reveal_all(); @@ -318,7 +310,7 @@ fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, debug!("build_clone_shim(def_id={:?})", def_id); let mut builder = CloneShimBuilder::new(tcx, def_id, self_ty); - let is_copy = !self_ty.moves_by_default(tcx, tcx.param_env(def_id), builder.span); + let is_copy = self_ty.is_copy_modulo_regions(tcx, tcx.param_env(def_id), builder.span); let dest = Place::Local(RETURN_PLACE); let src = Place::Local(Local::new(1+0)).deref(); @@ -385,9 +377,11 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { IndexVec::new(), None, self.local_decls, + IndexVec::new(), self.sig.inputs().len(), vec![], - self.span + self.span, + vec![], ) } @@ -465,7 +459,9 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { span: self.span, ty: func_ty, user_ty: None, - literal: ty::Const::zero_sized(self.tcx, func_ty), + literal: tcx.intern_lazy_const(ty::LazyConst::Evaluated( + ty::Const::zero_sized(func_ty), + )), }); let ref_loc = self.make_place( @@ -525,7 +521,9 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { span: self.span, ty: self.tcx.types.usize, user_ty: None, - literal: ty::Const::from_usize(self.tcx, value), + literal: self.tcx.intern_lazy_const(ty::LazyConst::Evaluated( + ty::Const::from_usize(self.tcx, value), + )), } } @@ -761,7 +759,9 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span, ty, user_ty: None, - literal: ty::Const::zero_sized(tcx, ty), + literal: tcx.intern_lazy_const(ty::LazyConst::Evaluated( + ty::Const::zero_sized(ty) + )), }), vec![rcvr]) } @@ -833,9 +833,11 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, IndexVec::new(), None, local_decls, + IndexVec::new(), sig.inputs().len(), vec![], - span + span, + vec![], ); if let Abi::RustCall = sig.abi { mir.spread_arg = Some(Local::new(sig.inputs().len())); @@ -851,7 +853,7 @@ pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, { let tcx = infcx.tcx; let gcx = tcx.global_tcx(); - let def_id = tcx.hir.local_def_id(ctor_id); + let def_id = tcx.hir().local_def_id(ctor_id); let param_env = gcx.param_env(def_id); // Normalize the sig. @@ -910,8 +912,10 @@ pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, IndexVec::new(), None, local_decls, + IndexVec::new(), sig.inputs().len(), vec![], - span + span, + vec![], ) } diff --git a/src/librustc_mir/transform/add_call_guards.rs b/src/librustc_mir/transform/add_call_guards.rs index 26927904440..3ea1c8e82ff 100644 --- a/src/librustc_mir/transform/add_call_guards.rs +++ b/src/librustc_mir/transform/add_call_guards.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty::TyCtxt; use rustc::mir::*; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; diff --git a/src/librustc_mir/transform/add_moves_for_packed_drops.rs b/src/librustc_mir/transform/add_moves_for_packed_drops.rs index 203669c61ba..8ec6902cf15 100644 --- a/src/librustc_mir/transform/add_moves_for_packed_drops.rs +++ b/src/librustc_mir/transform/add_moves_for_packed_drops.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir::def_id::DefId; use rustc::mir::*; use rustc::ty::TyCtxt; diff --git a/src/librustc_mir/transform/add_retag.rs b/src/librustc_mir/transform/add_retag.rs index be7e34e2dcb..3d5897bca9f 100644 --- a/src/librustc_mir/transform/add_retag.rs +++ b/src/librustc_mir/transform/add_retag.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This pass adds validation calls (AcquireValid, ReleaseValid) where appropriate. //! It has to be run really early, before transformations like inlining, because //! introducing these calls *adds* UB -- so, conceptually, this pass is actually part @@ -118,7 +108,7 @@ impl MirPass for AddRetag { basic_blocks[START_BLOCK].statements.splice(0..0, places.into_iter().map(|place| Statement { source_info, - kind: StatementKind::Retag { fn_entry: true, place }, + kind: StatementKind::Retag(RetagKind::FnEntry, place), }) ); } @@ -154,7 +144,7 @@ impl MirPass for AddRetag { for (source_info, dest_place, dest_block) in returns { basic_blocks[dest_block].statements.insert(0, Statement { source_info, - kind: StatementKind::Retag { fn_entry: false, place: dest_place }, + kind: StatementKind::Retag(RetagKind::Default, dest_place), }); } @@ -164,9 +154,9 @@ impl MirPass for AddRetag { // We want to insert statements as we iterate. To this end, we // iterate backwards using indices. for i in (0..block_data.statements.len()).rev() { - match block_data.statements[i].kind { - // If we are casting *from* a reference, we may have to escape-to-raw. - StatementKind::Assign(_, box Rvalue::Cast( + let (retag_kind, place) = match block_data.statements[i].kind { + // If we are casting *from* a reference, we may have to retag-as-raw. + StatementKind::Assign(ref place, box Rvalue::Cast( CastKind::Misc, ref src, dest_ty, @@ -175,33 +165,35 @@ impl MirPass for AddRetag { if src_ty.is_region_ptr() { // The only `Misc` casts on references are those creating raw pointers. assert!(dest_ty.is_unsafe_ptr()); - // Insert escape-to-raw before the cast. We are not concerned - // with stability here: Our EscapeToRaw will not change the value - // that the cast will then use. - // `src` might be a "move", but we rely on this not actually moving - // but just doing a memcpy. It is crucial that we do EscapeToRaw - // on the src because we need it with its original type. - let source_info = block_data.statements[i].source_info; - block_data.statements.insert(i, Statement { - source_info, - kind: StatementKind::EscapeToRaw(src.clone()), - }); + (RetagKind::Raw, place) + } else { + // Some other cast, no retag + continue } } // Assignments of reference or ptr type are the ones where we may have // to update tags. This includes `x = &[mut] ...` and hence // we also retag after taking a reference! - StatementKind::Assign(ref place, _) if needs_retag(place) => { - // Insert a retag after the assignment. - let source_info = block_data.statements[i].source_info; - block_data.statements.insert(i+1, Statement { - source_info, - kind: StatementKind::Retag { fn_entry: false, place: place.clone() }, - }); + StatementKind::Assign(ref place, box ref rvalue) if needs_retag(place) => { + let kind = match rvalue { + Rvalue::Ref(_, borrow_kind, _) + if borrow_kind.allows_two_phase_borrow() + => + RetagKind::TwoPhase, + _ => + RetagKind::Default, + }; + (kind, place) } // Do nothing for the rest - _ => {}, + _ => continue, }; + // Insert a retag after the statement. + let source_info = block_data.statements[i].source_info; + block_data.statements.insert(i+1, Statement { + source_info, + kind: StatementKind::Retag(retag_kind, place.clone()), + }); } } } diff --git a/src/librustc_mir/transform/add_yk_swt_calls.rs b/src/librustc_mir/transform/add_yk_swt_calls.rs index cfb9af6011d..06ff7cbc71a 100644 --- a/src/librustc_mir/transform/add_yk_swt_calls.rs +++ b/src/librustc_mir/transform/add_yk_swt_calls.rs @@ -76,25 +76,31 @@ impl MirPass for AddYkSWTCalls { let ret_place = Place::Local(Local::new(num_orig_local_decls + new_local_decls.len())); new_local_decls.push(ret_val); + let crate_hash_const = tcx.intern_lazy_const( + ty::LazyConst::Evaluated(ty::Const::from_u64(tcx, local_crate_hash))); let crate_hash_oper = Operand::Constant(box Constant { span: DUMMY_SP, ty: u64_ty, user_ty: None, - literal: ty::Const::from_u64(tcx, local_crate_hash), + literal: crate_hash_const, }); + let def_idx_const = tcx.intern_lazy_const( + ty::LazyConst::Evaluated(ty::Const::from_u32(tcx, self.0.as_raw_u32()))); let def_idx_oper = Operand::Constant(box Constant { span: DUMMY_SP, ty: u32_ty, user_ty: None, - literal: ty::Const::from_u32(tcx, self.0.as_raw_u32()), + literal: def_idx_const, }); + let bb_const = tcx.intern_lazy_const( + ty::LazyConst::Evaluated(ty::Const::from_u32(tcx, bb.index() as u32))); let bb_oper = Operand::Constant(box Constant { span: DUMMY_SP, ty: u32_ty, user_ty: None, - literal: ty::Const::from_u32(tcx, bb.index() as u32), + literal: bb_const, }); let rec_fn_oper = Operand::function_handle(tcx, rec_fn_defid, @@ -151,7 +157,7 @@ fn is_untraceable(tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource) -> bool { } // Similar to `#[no_trace]`, don't transform anything inside a crate marked `#![no_trace]`. - for attr in tcx.hir.krate_attrs() { + for attr in tcx.hir().krate_attrs() { if attr.check_name("no_trace") { return true; } @@ -159,7 +165,7 @@ fn is_untraceable(tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource) -> bool { // We can't call the software tracing function if the crate doesn't depend upon libcore because // that's where the entry point to the trace recorder function lives. - if attr::contains_name(tcx.hir.krate_attrs(), "no_core") { + if attr::contains_name(tcx.hir().krate_attrs(), "no_core") { return true; } @@ -176,9 +182,9 @@ fn is_untraceable(tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource) -> bool { } // For the same reason as above, regular const functions can't be transformed. - let node_id = tcx.hir.as_local_node_id(src.def_id) + let node_id = tcx.hir().as_local_node_id(src.def_id) .expect("Failed to get node id"); - if let Some(fn_like) = FnLikeNode::from_node(tcx.hir.get(node_id)) { + if let Some(fn_like) = FnLikeNode::from_node(tcx.hir().get(node_id)) { fn_like.constness() == hir::Constness::Const } else { true diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 4ebeebca227..ab8da2f352c 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -1,19 +1,10 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::indexed_vec::IndexVec; use rustc_data_structures::sync::Lrc; use rustc::ty::query::Providers; use rustc::ty::{self, TyCtxt}; +use rustc::ty::cast::CastTy; use rustc::hir; use rustc::hir::Node; use rustc::hir::def_id::DefId; @@ -24,30 +15,40 @@ use rustc::mir::visit::{PlaceContext, Visitor, MutatingUseContext}; use syntax::ast; use syntax::symbol::Symbol; +use std::ops::Bound; + use util; pub struct UnsafetyChecker<'a, 'tcx: 'a> { mir: &'a Mir<'tcx>, + const_context: bool, min_const_fn: bool, source_scope_local_data: &'a IndexVec, violations: Vec, source_info: SourceInfo, tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, + /// mark an `unsafe` block as used, so we don't lint it used_unsafe: FxHashSet, inherited_blocks: Vec<(ast::NodeId, bool)>, } impl<'a, 'gcx, 'tcx> UnsafetyChecker<'a, 'tcx> { fn new( + const_context: bool, min_const_fn: bool, mir: &'a Mir<'tcx>, source_scope_local_data: &'a IndexVec, tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ) -> Self { + // sanity check + if min_const_fn { + assert!(const_context); + } Self { mir, + const_context, min_const_fn, source_scope_local_data, violations: vec![], @@ -93,7 +94,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { if let hir::Unsafety::Unsafe = sig.unsafety() { self.require_unsafe("call to unsafe function", "consult the function's documentation for information on how to avoid \ - undefined behavior") + undefined behavior", UnsafetyViolationKind::GeneralAndConstFn) } } } @@ -112,9 +113,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { StatementKind::SetDiscriminant { .. } | StatementKind::StorageLive(..) | StatementKind::StorageDead(..) | - StatementKind::EndRegion(..) | StatementKind::Retag { .. } | - StatementKind::EscapeToRaw { .. } | StatementKind::AscribeUserType(..) | StatementKind::Nop => { // safe (at least as emitted during MIR construction) @@ -122,7 +121,8 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { StatementKind::InlineAsm { .. } => { self.require_unsafe("use of inline assembly", - "inline assembly is entirely unchecked and can cause undefined behavior") + "inline assembly is entirely unchecked and can cause undefined behavior", + UnsafetyViolationKind::General) }, } self.super_statement(block, statement, location); @@ -132,19 +132,70 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { rvalue: &Rvalue<'tcx>, location: Location) { - if let &Rvalue::Aggregate(box ref aggregate, _) = rvalue { - match aggregate { - &AggregateKind::Array(..) | - &AggregateKind::Tuple | - &AggregateKind::Adt(..) => {} - &AggregateKind::Closure(def_id, _) | - &AggregateKind::Generator(def_id, _, _) => { - let UnsafetyCheckResult { - violations, unsafe_blocks - } = self.tcx.unsafety_check_result(def_id); - self.register_violations(&violations, &unsafe_blocks); + match rvalue { + Rvalue::Aggregate(box ref aggregate, _) => { + match aggregate { + &AggregateKind::Array(..) | + &AggregateKind::Tuple => {} + &AggregateKind::Adt(ref def, ..) => { + match self.tcx.layout_scalar_valid_range(def.did) { + (Bound::Unbounded, Bound::Unbounded) => {}, + _ => self.require_unsafe( + "initializing type with `rustc_layout_scalar_valid_range` attr", + "initializing a layout restricted type's field with a value \ + outside the valid range is undefined behavior", + UnsafetyViolationKind::GeneralAndConstFn, + ), + } + } + &AggregateKind::Closure(def_id, _) | + &AggregateKind::Generator(def_id, _, _) => { + let UnsafetyCheckResult { + violations, unsafe_blocks + } = self.tcx.unsafety_check_result(def_id); + self.register_violations(&violations, &unsafe_blocks); + } + } + }, + // casting pointers to ints is unsafe in const fn because the const evaluator cannot + // possibly know what the result of various operations like `address / 2` would be + // pointers during const evaluation have no integral address, only an abstract one + Rvalue::Cast(CastKind::Misc, ref operand, cast_ty) + if self.const_context && self.tcx.features().const_raw_ptr_to_usize_cast => { + let operand_ty = operand.ty(self.mir, self.tcx); + let cast_in = CastTy::from_ty(operand_ty).expect("bad input type for cast"); + let cast_out = CastTy::from_ty(cast_ty).expect("bad output type for cast"); + match (cast_in, cast_out) { + (CastTy::Ptr(_), CastTy::Int(_)) | + (CastTy::FnPtr, CastTy::Int(_)) => { + self.register_violations(&[UnsafetyViolation { + source_info: self.source_info, + description: Symbol::intern("cast of pointer to int").as_interned_str(), + details: Symbol::intern("casting pointers to integers in constants") + .as_interned_str(), + kind: UnsafetyViolationKind::General, + }], &[]); + }, + _ => {}, } } + // raw pointer and fn pointer operations are unsafe as it is not clear whether one + // pointer would be "less" or "equal" to another, because we cannot know where llvm + // or the linker will place various statics in memory. Without this information the + // result of a comparison of addresses would differ between runtime and compile-time. + Rvalue::BinaryOp(_, ref lhs, _) + if self.const_context && self.tcx.features().const_compare_raw_pointers => { + if let ty::RawPtr(_) | ty::FnPtr(..) = lhs.ty(self.mir, self.tcx).sty { + self.register_violations(&[UnsafetyViolation { + source_info: self.source_info, + description: Symbol::intern("pointer operation").as_interned_str(), + details: Symbol::intern("operations on pointers in constants") + .as_interned_str(), + kind: UnsafetyViolationKind::General, + }], &[]); + } + } + _ => {}, } self.super_rvalue(rvalue, location); } @@ -153,28 +204,43 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { place: &Place<'tcx>, context: PlaceContext<'tcx>, location: Location) { - if context.is_borrow() { - if util::is_disaligned(self.tcx, self.mir, self.param_env, place) { - let source_info = self.source_info; - let lint_root = - self.source_scope_local_data[source_info.scope].lint_root; - self.register_violations(&[UnsafetyViolation { - source_info, - description: Symbol::intern("borrow of packed field").as_interned_str(), - details: - Symbol::intern("fields of packed structs might be misaligned: \ - dereferencing a misaligned pointer or even just creating a \ - misaligned reference is undefined behavior") - .as_interned_str(), - kind: UnsafetyViolationKind::BorrowPacked(lint_root) - }], &[]); - } - } - match place { &Place::Projection(box Projection { ref base, ref elem }) => { + if context.is_borrow() { + if util::is_disaligned(self.tcx, self.mir, self.param_env, place) { + let source_info = self.source_info; + let lint_root = + self.source_scope_local_data[source_info.scope].lint_root; + self.register_violations(&[UnsafetyViolation { + source_info, + description: Symbol::intern("borrow of packed field").as_interned_str(), + details: + Symbol::intern("fields of packed structs might be misaligned: \ + dereferencing a misaligned pointer or even just \ + creating a misaligned reference is undefined \ + behavior") + .as_interned_str(), + kind: UnsafetyViolationKind::BorrowPacked(lint_root) + }], &[]); + } + } + let is_borrow_of_interior_mut = context.is_borrow() && !base + .ty(self.mir, self.tcx) + .to_ty(self.tcx) + .is_freeze(self.tcx, self.param_env, self.source_info.span); + // prevent + // * `&mut x.field` + // * `x.field = y;` + // * `&x.field` if `field`'s type has interior mutability + // because either of these would allow modifying the layout constrained field and + // insert values that violate the layout constraints. + if context.is_mutating_use() || is_borrow_of_interior_mut { + self.check_mut_borrowing_layout_constrained_field( + place, context.is_mutating_use(), + ); + } let old_source_info = self.source_info; if let &Place::Local(local) = base { if self.mir.local_decls[local].internal { @@ -190,7 +256,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { self.require_unsafe("dereference of raw pointer", "raw pointers may be NULL, dangling or unaligned; they can violate \ aliasing rules and cause data races: all of these are undefined \ - behavior") + behavior", UnsafetyViolationKind::General) } ty::Adt(adt, _) => { if adt.is_union() { @@ -207,20 +273,24 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { "non-field projection {:?} from union?", place) }; - if elem_ty.moves_by_default(self.tcx, self.param_env, - self.source_info.span) { + if !elem_ty.is_copy_modulo_regions( + self.tcx, + self.param_env, + self.source_info.span, + ) { self.require_unsafe( "assignment to non-`Copy` union field", "the previous content of the field will be dropped, which \ causes undefined behavior if the field was not properly \ - initialized") + initialized", UnsafetyViolationKind::General) } else { // write to non-move union, safe } } else { self.require_unsafe("access to union field", "the field may not be properly initialized: using \ - uninitialized data will cause undefined behavior") + uninitialized data will cause undefined behavior", + UnsafetyViolationKind::General) } } } @@ -238,7 +308,8 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { if self.tcx.is_static(def_id) == Some(hir::Mutability::MutMutable) { self.require_unsafe("use of mutable static", "mutable statics can be mutated by multiple threads: aliasing violations \ - or data races will cause undefined behavior"); + or data races will cause undefined behavior", + UnsafetyViolationKind::General); } else if self.tcx.is_foreign_item(def_id) { let source_info = self.source_info; let lint_root = @@ -261,45 +332,76 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { } impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { - fn require_unsafe(&mut self, - description: &'static str, - details: &'static str) - { + fn require_unsafe( + &mut self, + description: &'static str, + details: &'static str, + kind: UnsafetyViolationKind, + ) { let source_info = self.source_info; self.register_violations(&[UnsafetyViolation { source_info, description: Symbol::intern(description).as_interned_str(), details: Symbol::intern(details).as_interned_str(), - kind: UnsafetyViolationKind::General, + kind, }], &[]); } fn register_violations(&mut self, violations: &[UnsafetyViolation], unsafe_blocks: &[(ast::NodeId, bool)]) { - if self.min_const_fn { - for violation in violations { - let mut violation = violation.clone(); - violation.kind = UnsafetyViolationKind::MinConstFn; - if !self.violations.contains(&violation) { - self.violations.push(violation) - } - } - } - let within_unsafe = match self.source_scope_local_data[self.source_info.scope].safety { + let safety = self.source_scope_local_data[self.source_info.scope].safety; + let within_unsafe = match safety { + // `unsafe` blocks are required in safe code Safety::Safe => { for violation in violations { - if !self.violations.contains(violation) { - self.violations.push(violation.clone()) + let mut violation = violation.clone(); + match violation.kind { + UnsafetyViolationKind::GeneralAndConstFn | + UnsafetyViolationKind::General => {}, + UnsafetyViolationKind::BorrowPacked(_) | + UnsafetyViolationKind::ExternStatic(_) => if self.min_const_fn { + // const fns don't need to be backwards compatible and can + // emit these violations as a hard error instead of a backwards + // compat lint + violation.kind = UnsafetyViolationKind::General; + }, + } + if !self.violations.contains(&violation) { + self.violations.push(violation) } } false } + // `unsafe` function bodies allow unsafe without additional unsafe blocks Safety::BuiltinUnsafe | Safety::FnUnsafe => true, Safety::ExplicitUnsafe(node_id) => { + // mark unsafe block as used if there are any unsafe operations inside if !violations.is_empty() { self.used_unsafe.insert(node_id); } + // only some unsafety is allowed in const fn + if self.min_const_fn { + for violation in violations { + match violation.kind { + // these unsafe things are stable in const fn + UnsafetyViolationKind::GeneralAndConstFn => {}, + // these things are forbidden in const fns + UnsafetyViolationKind::General | + UnsafetyViolationKind::BorrowPacked(_) | + UnsafetyViolationKind::ExternStatic(_) => { + let mut violation = violation.clone(); + // const fns don't need to be backwards compatible and can + // emit these violations as a hard error instead of a backwards + // compat lint + violation.kind = UnsafetyViolationKind::General; + if !self.violations.contains(&violation) { + self.violations.push(violation) + } + }, + } + } + } true } }; @@ -307,6 +409,53 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { (node_id, is_used && !within_unsafe) })); } + fn check_mut_borrowing_layout_constrained_field( + &mut self, + mut place: &Place<'tcx>, + is_mut_use: bool, + ) { + while let &Place::Projection(box Projection { + ref base, ref elem + }) = place { + match *elem { + ProjectionElem::Field(..) => { + let ty = base.ty(&self.mir.local_decls, self.tcx).to_ty(self.tcx); + match ty.sty { + ty::Adt(def, _) => match self.tcx.layout_scalar_valid_range(def.did) { + (Bound::Unbounded, Bound::Unbounded) => {}, + _ => { + let (description, details) = if is_mut_use { + ( + "mutation of layout constrained field", + "mutating layout constrained fields cannot statically be \ + checked for valid values", + ) + } else { + ( + "borrow of layout constrained field with interior \ + mutability", + "references to fields of layout constrained fields \ + lose the constraints. Coupled with interior mutability, \ + the field can be changed to invalid values", + ) + }; + let source_info = self.source_info; + self.register_violations(&[UnsafetyViolation { + source_info, + description: Symbol::intern(description).as_interned_str(), + details: Symbol::intern(details).as_interned_str(), + kind: UnsafetyViolationKind::GeneralAndConstFn, + }], &[]); + } + }, + _ => {} + } + } + _ => {} + } + place = base; + } + } } pub(crate) fn provide(providers: &mut Providers) { @@ -344,8 +493,8 @@ fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, unsafe_blocks: &'a mut Vec<(ast::NodeId, bool)>) { let body_id = - tcx.hir.as_local_node_id(def_id).and_then(|node_id| { - tcx.hir.maybe_body_owned_by(node_id) + tcx.hir().as_local_node_id(def_id).and_then(|node_id| { + tcx.hir().maybe_body_owned_by(node_id) }); let body_id = match body_id { @@ -355,7 +504,7 @@ fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, return } }; - let body = tcx.hir.body(body_id); + let body = tcx.hir().body(body_id); debug!("check_unused_unsafe({:?}, body={:?}, used_unsafe={:?})", def_id, body, used_unsafe); @@ -368,7 +517,7 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { debug!("unsafety_violations({:?})", def_id); - // NB: this borrow is valid because all the consumers of + // N.B., this borrow is valid because all the consumers of // `mir_built` force this. let mir = &tcx.mir_built(def_id).borrow(); @@ -384,8 +533,16 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) }; let param_env = tcx.param_env(def_id); + + let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let (const_context, min_const_fn) = match tcx.hir().body_owner_kind(id) { + hir::BodyOwnerKind::Closure => (false, false), + hir::BodyOwnerKind::Fn => (tcx.is_const_fn(def_id), tcx.is_min_const_fn(def_id)), + hir::BodyOwnerKind::Const | + hir::BodyOwnerKind::Static(_) => (true, false), + }; let mut checker = UnsafetyChecker::new( - tcx.is_const_fn(def_id) && tcx.is_min_const_fn(def_id), + const_context, min_const_fn, mir, source_scope_local_data, tcx, param_env); checker.visit_mir(mir); @@ -397,7 +554,7 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) } fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { - let lint_node_id = match tcx.hir.as_local_node_id(def_id) { + let lint_node_id = match tcx.hir().as_local_node_id(def_id) { Some(node_id) => node_id, None => bug!("checking unsafety for non-local def id {:?}", def_id) }; @@ -421,14 +578,14 @@ fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: D fn is_enclosed(tcx: TyCtxt, used_unsafe: &FxHashSet, id: ast::NodeId) -> Option<(String, ast::NodeId)> { - let parent_id = tcx.hir.get_parent_node(id); + let parent_id = tcx.hir().get_parent_node(id); if parent_id != id { if used_unsafe.contains(&parent_id) { Some(("block".to_string(), parent_id)) } else if let Some(Node::Item(&hir::Item { node: hir::ItemKind::Fn(_, header, _, _), .. - })) = tcx.hir.find(parent_id) { + })) = tcx.hir().find(parent_id) { match header.unsafety { hir::Unsafety::Unsafe => Some(("fn".to_string(), parent_id)), hir::Unsafety::Normal => None, @@ -442,12 +599,12 @@ fn is_enclosed(tcx: TyCtxt, } fn report_unused_unsafe(tcx: TyCtxt, used_unsafe: &FxHashSet, id: ast::NodeId) { - let span = tcx.sess.source_map().def_span(tcx.hir.span(id)); + let span = tcx.sess.source_map().def_span(tcx.hir().span(id)); let msg = "unnecessary `unsafe` block"; let mut db = tcx.struct_span_lint_node(UNUSED_UNSAFE, id, span, msg); db.span_label(span, msg); if let Some((kind, id)) = is_enclosed(tcx, used_unsafe, id) { - db.span_label(tcx.sess.source_map().def_span(tcx.hir.span(id)), + db.span_label(tcx.sess.source_map().def_span(tcx.hir().span(id)), format!("because it's nested under this `unsafe` {}", kind)); } db.emit(); @@ -487,6 +644,7 @@ pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { } in violations.iter() { // Report an error. match kind { + UnsafetyViolationKind::GeneralAndConstFn | UnsafetyViolationKind::General => { struct_span_err!( tcx.sess, source_info.span, E0133, @@ -495,15 +653,6 @@ pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { .note(&details.as_str()[..]) .emit(); } - UnsafetyViolationKind::MinConstFn => { - tcx.sess.struct_span_err( - source_info.span, - &format!("{} is unsafe and unsafe operations \ - are not allowed in const fn", description)) - .span_label(source_info.span, &description.as_str()[..]) - .note(&details.as_str()[..]) - .emit(); - } UnsafetyViolationKind::ExternStatic(lint_node_id) => { tcx.lint_node_note(SAFE_EXTERN_STATICS, lint_node_id, diff --git a/src/librustc_mir/transform/cleanup_post_borrowck.rs b/src/librustc_mir/transform/cleanup_post_borrowck.rs index 98311444e28..e6df6b7fd27 100644 --- a/src/librustc_mir/transform/cleanup_post_borrowck.rs +++ b/src/librustc_mir/transform/cleanup_post_borrowck.rs @@ -1,120 +1,33 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module provides two passes: //! -//! - `CleanEndRegions`, that reduces the set of `EndRegion` statements -//! in the MIR. -//! - `CleanAscribeUserType`, that replaces all `AscribeUserType` statements -//! with `Nop`. +//! - [`CleanAscribeUserType`], that replaces all [`AscribeUserType`] +//! statements with [`Nop`]. +//! - [`CleanFakeReadsAndBorrows`], that replaces all [`FakeRead`] statements +//! and borrows that are read by [`ForMatchGuard`] fake reads with [`Nop`]. //! -//! The `CleanEndRegions` "pass" is actually implemented as two +//! The `CleanFakeReadsAndBorrows` "pass" is actually implemented as two //! traversals (aka visits) of the input MIR. The first traversal, -//! `GatherBorrowedRegions`, finds all of the regions in the MIR -//! that are involved in a borrow. -//! -//! The second traversal, `DeleteTrivialEndRegions`, walks over the -//! MIR and removes any `EndRegion` that is applied to a region that -//! was not seen in the previous pass. +//! [`DeleteAndRecordFakeReads`], deletes the fake reads and finds the +//! temporaries read by [`ForMatchGuard`] reads, and [`DeleteFakeBorrows`] +//! deletes the initialization of those temporaries. //! -//! The `CleanAscribeUserType` pass runs at a distinct time from the -//! `CleanEndRegions` pass. It is important that the `CleanAscribeUserType` -//! pass runs after the MIR borrowck so that the NLL type checker can -//! perform the type assertion when it encounters the `AscribeUserType` -//! statements. +//! [`CleanAscribeUserType`]: cleanup_post_borrowck::CleanAscribeUserType +//! [`CleanFakeReadsAndBorrows`]: cleanup_post_borrowck::CleanFakeReadsAndBorrows +//! [`DeleteAndRecordFakeReads`]: cleanup_post_borrowck::DeleteAndRecordFakeReads +//! [`DeleteFakeBorrows`]: cleanup_post_borrowck::DeleteFakeBorrows +//! [`AscribeUserType`]: rustc::mir::StatementKind::AscribeUserType +//! [`Nop`]: rustc::mir::StatementKind::Nop +//! [`FakeRead`]: rustc::mir::StatementKind::FakeRead +//! [`ForMatchGuard`]: rustc::mir::FakeReadCause::ForMatchGuard use rustc_data_structures::fx::FxHashSet; -use rustc::middle::region; use rustc::mir::{BasicBlock, FakeReadCause, Local, Location, Mir, Place}; -use rustc::mir::{Rvalue, Statement, StatementKind}; -use rustc::mir::visit::{MutVisitor, Visitor, TyContext}; -use rustc::ty::{Ty, RegionKind, TyCtxt}; -use smallvec::smallvec; +use rustc::mir::{Statement, StatementKind}; +use rustc::mir::visit::MutVisitor; +use rustc::ty::TyCtxt; use transform::{MirPass, MirSource}; -pub struct CleanEndRegions; - -#[derive(Default)] -struct GatherBorrowedRegions { - seen_regions: FxHashSet, -} - -struct DeleteTrivialEndRegions<'a> { - seen_regions: &'a FxHashSet, -} - -impl MirPass for CleanEndRegions { - fn run_pass<'a, 'tcx>(&self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, - _source: MirSource, - mir: &mut Mir<'tcx>) { - if !tcx.emit_end_regions() { return; } - - let mut gather = GatherBorrowedRegions::default(); - gather.visit_mir(mir); - - let mut delete = DeleteTrivialEndRegions { seen_regions: &mut gather.seen_regions }; - delete.visit_mir(mir); - } -} - -impl<'tcx> Visitor<'tcx> for GatherBorrowedRegions { - fn visit_rvalue(&mut self, - rvalue: &Rvalue<'tcx>, - location: Location) { - // Gather regions that are used for borrows - if let Rvalue::Ref(r, _, _) = *rvalue { - if let RegionKind::ReScope(ce) = *r { - self.seen_regions.insert(ce); - } - } - self.super_rvalue(rvalue, location); - } - - fn visit_ty(&mut self, ty: &Ty<'tcx>, _: TyContext) { - // Gather regions that occur in types - let mut regions = smallvec![]; - for t in ty.walk() { - t.push_regions(&mut regions); - } - for re in regions { - match *re { - RegionKind::ReScope(ce) => { self.seen_regions.insert(ce); } - _ => {}, - } - } - self.super_ty(ty); - } -} - -impl<'a, 'tcx> MutVisitor<'tcx> for DeleteTrivialEndRegions<'a> { - fn visit_statement(&mut self, - block: BasicBlock, - statement: &mut Statement<'tcx>, - location: Location) { - let mut delete_it = false; - - if let StatementKind::EndRegion(ref region_scope) = statement.kind { - if !self.seen_regions.contains(region_scope) { - delete_it = true; - } - } - - if delete_it { - statement.make_nop(); - } - self.super_statement(block, statement, location); - } -} - pub struct CleanAscribeUserType; pub struct DeleteAscribeUserType; diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 661ca4773b4..dc556a15cd8 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Propagates constants for early reporting of statically known //! assertion failures @@ -30,7 +20,8 @@ use rustc::ty::layout::{ use interpret::{self, EvalContext, ScalarMaybeUndef, Immediate, OpTy, MemoryKind}; use const_eval::{ - CompileTimeInterpreter, const_to_op, error_to_const_error, eval_promoted, mk_borrowck_eval_cx + CompileTimeInterpreter, error_to_const_error, eval_promoted, mk_eval_cx, + lazy_const_to_op, }; use transform::{MirPass, MirSource}; @@ -47,10 +38,10 @@ impl MirPass for ConstProp { } use rustc::hir::map::blocks::FnLikeNode; - let node_id = tcx.hir.as_local_node_id(source.def_id) + let node_id = tcx.hir().as_local_node_id(source.def_id) .expect("Non-local call to local provider is_const_fn"); - let is_fn_like = FnLikeNode::from_node(tcx.hir.get(node_id)).is_some(); + let is_fn_like = FnLikeNode::from_node(tcx.hir().get(node_id)).is_some(); let is_assoc_const = match tcx.describe_def(source.def_id) { Some(Def::AssociatedConst(_)) => true, _ => false, @@ -119,9 +110,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { source: MirSource, ) -> ConstPropagator<'a, 'mir, 'tcx> { let param_env = tcx.param_env(source.def_id); - let substs = Substs::identity_for_item(tcx, source.def_id); - let instance = Instance::new(source.def_id, substs); - let ecx = mk_borrowck_eval_cx(tcx, instance, mir, DUMMY_SP).unwrap(); + let ecx = mk_eval_cx(tcx, tcx.def_span(source.def_id), param_env); ConstPropagator { ecx, mir, @@ -199,6 +188,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { | CalledClosureAsFunction | VtableForArgumentlessMethod | ModifiedConstantMemory + | ModifiedStatic | AssumptionNotHeld // FIXME: should probably be removed and turned into a bug! call | TypeNotPrimitive(_) @@ -264,7 +254,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { source_info: SourceInfo, ) -> Option> { self.ecx.tcx.span = source_info.span; - match const_to_op(&self.ecx, c.literal) { + match lazy_const_to_op(&self.ecx, *c.literal, c.ty) { Ok(op) => { Some((op, c.span)) }, @@ -288,7 +278,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { })?; Some((res, span)) }, - // We could get more projections by using e.g. `operand_projection`, + // We could get more projections by using e.g., `operand_projection`, // but we do not even have the stack frame set up properly so // an `Index` projection would throw us off-track. _ => None, @@ -345,7 +335,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { Rvalue::Cast(kind, ref operand, _) => { let (op, span) = self.eval_operand(operand, source_info)?; self.use_ecx(source_info, |this| { - let dest = this.ecx.allocate(place_layout, MemoryKind::Stack)?; + let dest = this.ecx.allocate(place_layout, MemoryKind::Stack); this.ecx.cast(op, kind, dest.into())?; Ok((dest.into(), span)) }) @@ -617,7 +607,7 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { .span; let node_id = self .tcx - .hir + .hir() .as_local_node_id(self.source.def_id) .expect("some part of a failing const eval must be local"); use rustc::mir::interpret::EvalErrorKind::*; diff --git a/src/librustc_mir/transform/copy_prop.rs b/src/librustc_mir/transform/copy_prop.rs index 6d0b25b2c69..55e14077c3e 100644 --- a/src/librustc_mir/transform/copy_prop.rs +++ b/src/librustc_mir/transform/copy_prop.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Trivial copy propagation pass. //! //! This uses def-use analysis to remove values that have exactly one def and one use, which must diff --git a/src/librustc_mir/transform/deaggregator.rs b/src/librustc_mir/transform/deaggregator.rs index 8a14890f92e..a2fe9def8ee 100644 --- a/src/librustc_mir/transform/deaggregator.rs +++ b/src/librustc_mir/transform/deaggregator.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty::TyCtxt; use rustc::mir::*; use rustc_data_structures::indexed_vec::Idx; diff --git a/src/librustc_mir/transform/dump_mir.rs b/src/librustc_mir/transform/dump_mir.rs index a16ef2adea9..8fabb2d11fc 100644 --- a/src/librustc_mir/transform/dump_mir.rs +++ b/src/librustc_mir/transform/dump_mir.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This pass just dumps MIR at a specified point. use std::borrow::Cow; diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 2b3fd552e0f..06e16de8b43 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use dataflow::move_paths::{HasMoveData, MoveData, MovePathIndex, LookupResult}; use dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces}; use dataflow::{DataflowResults}; @@ -38,7 +28,7 @@ impl MirPass for ElaborateDrops { { debug!("elaborate_drops({:?} @ {:?})", src, mir.span); - let id = tcx.hir.as_local_node_id(src.def_id).unwrap(); + let id = tcx.hir().as_local_node_id(src.def_id).unwrap(); let param_env = tcx.param_env(src.def_id).with_reveal_all(); let move_data = match MoveData::gather_moves(mir, tcx) { Ok(move_data) => move_data, @@ -303,8 +293,8 @@ struct ElaborateDropsCtxt<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &'a Mir<'tcx>, env: &'a MoveDataParamEnv<'tcx, 'tcx>, - flow_inits: DataflowResults>, - flow_uninits: DataflowResults>, + flow_inits: DataflowResults<'tcx, MaybeInitializedPlaces<'a, 'tcx, 'tcx>>, + flow_uninits: DataflowResults<'tcx, MaybeUninitializedPlaces<'a, 'tcx, 'tcx>>, drop_flags: FxHashMap, patch: MirPatch<'tcx>, } @@ -543,7 +533,9 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { span, ty: self.tcx.types.bool, user_ty: None, - literal: ty::Const::from_bool(self.tcx, val), + literal: self.tcx.intern_lazy_const(ty::LazyConst::Evaluated( + ty::Const::from_bool(self.tcx, val), + )), }))) } diff --git a/src/librustc_mir/transform/erase_regions.rs b/src/librustc_mir/transform/erase_regions.rs index 6351a6b40cb..b464b7d65e4 100644 --- a/src/librustc_mir/transform/erase_regions.rs +++ b/src/librustc_mir/transform/erase_regions.rs @@ -1,18 +1,8 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This pass erases all early-bound regions from the types occurring in the MIR. //! We want to do this once just before codegen, so codegen does not have to take //! care erasing regions all over the place. //! NOTE: We do NOT erase regions of statements that are relevant for -//! "types-as-contracts"-validation, namely, AcquireValid, ReleaseValid, and EndRegion. +//! "types-as-contracts"-validation, namely, AcquireValid, ReleaseValid use rustc::ty::subst::Substs; use rustc::ty::{self, Ty, TyCtxt}; @@ -42,7 +32,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for EraseRegionsVisitor<'a, 'tcx> { *region = self.tcx.types.re_erased; } - fn visit_const(&mut self, constant: &mut &'tcx ty::Const<'tcx>, _: Location) { + fn visit_const(&mut self, constant: &mut &'tcx ty::LazyConst<'tcx>, _: Location) { *constant = self.tcx.erase_regions(constant); } @@ -54,10 +44,6 @@ impl<'a, 'tcx> MutVisitor<'tcx> for EraseRegionsVisitor<'a, 'tcx> { block: BasicBlock, statement: &mut Statement<'tcx>, location: Location) { - if let StatementKind::EndRegion(_) = statement.kind { - statement.kind = StatementKind::Nop; - } - self.super_statement(block, statement, location); } } diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 24cc4cce747..f5cc6a43e28 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This is the implementation of the pass which transforms generators into state machines. //! //! MIR generation for generators creates a function which has a self argument which @@ -123,6 +113,33 @@ impl<'tcx> MutVisitor<'tcx> for DerefArgVisitor { } } +struct PinArgVisitor<'tcx> { + ref_gen_ty: Ty<'tcx>, +} + +impl<'tcx> MutVisitor<'tcx> for PinArgVisitor<'tcx> { + fn visit_local(&mut self, + local: &mut Local, + _: PlaceContext<'tcx>, + _: Location) { + assert_ne!(*local, self_arg()); + } + + fn visit_place(&mut self, + place: &mut Place<'tcx>, + context: PlaceContext<'tcx>, + location: Location) { + if *place == Place::Local(self_arg()) { + *place = Place::Projection(Box::new(Projection { + base: place.clone(), + elem: ProjectionElem::Field(Field::new(0), self.ref_gen_ty), + })); + } else { + self.super_place(place, context, location); + } + } +} + fn self_arg() -> Local { Local::new(1) } @@ -181,11 +198,11 @@ impl<'a, 'tcx> TransformVisitor<'a, 'tcx> { span: source_info.span, ty: self.tcx.types.u32, user_ty: None, - literal: ty::Const::from_bits( + literal: self.tcx.intern_lazy_const(ty::LazyConst::Evaluated(ty::Const::from_bits( self.tcx, state_disc.into(), ty::ParamEnv::empty().and(self.tcx.types.u32) - ), + ))), }); Statement { source_info, @@ -296,6 +313,23 @@ fn make_generator_state_argument_indirect<'a, 'tcx>( DerefArgVisitor.visit_mir(mir); } +fn make_generator_state_argument_pinned<'a, 'tcx>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + mir: &mut Mir<'tcx>) { + let ref_gen_ty = mir.local_decls.raw[1].ty; + + let pin_did = tcx.lang_items().pin_type().unwrap(); + let pin_adt_ref = tcx.adt_def(pin_did); + let substs = tcx.intern_substs(&[ref_gen_ty.into()]); + let pin_ref_gen_ty = tcx.mk_adt(pin_adt_ref, substs); + + // Replace the by ref generator argument + mir.local_decls.raw[1].ty = pin_ref_gen_ty; + + // Add the Pin field access to accesses of the generator state + PinArgVisitor { ref_gen_ty }.visit_mir(mir); +} + fn replace_result_variable<'tcx>( ret_ty: Ty<'tcx>, mir: &mut Mir<'tcx>, @@ -339,36 +373,6 @@ impl<'tcx> Visitor<'tcx> for StorageIgnored { } } -struct BorrowedLocals(liveness::LiveVarSet); - -fn mark_as_borrowed<'tcx>(place: &Place<'tcx>, locals: &mut BorrowedLocals) { - match *place { - Place::Local(l) => { locals.0.insert(l); }, - Place::Promoted(_) | - Place::Static(..) => (), - Place::Projection(ref proj) => { - match proj.elem { - // For derefs we don't look any further. - // If it pointed to a Local, it would already be borrowed elsewhere - ProjectionElem::Deref => (), - _ => mark_as_borrowed(&proj.base, locals) - } - } - } -} - -impl<'tcx> Visitor<'tcx> for BorrowedLocals { - fn visit_rvalue(&mut self, - rvalue: &Rvalue<'tcx>, - location: Location) { - if let Rvalue::Ref(_, _, ref place) = *rvalue { - mark_as_borrowed(place, self); - } - - self.super_rvalue(rvalue, location) - } -} - fn locals_live_across_suspend_points( tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &Mir<'tcx>, @@ -379,7 +383,7 @@ fn locals_live_across_suspend_points( FxHashMap>, ) { let dead_unwinds = BitSet::new_empty(mir.basic_blocks().len()); - let node_id = tcx.hir.as_local_node_id(source.def_id).unwrap(); + let node_id = tcx.hir().as_local_node_id(source.def_id).unwrap(); // Calculate when MIR locals have live storage. This gives us an upper bound of their // lifetimes. @@ -689,7 +693,7 @@ fn create_generator_drop_shim<'a, 'tcx>( // Alias tracking must know we changed the type mir.basic_blocks_mut()[START_BLOCK].statements.insert(0, Statement { source_info, - kind: StatementKind::EscapeToRaw(Operand::Copy(Place::Local(self_arg()))), + kind: StatementKind::Retag(RetagKind::Raw, Place::Local(self_arg())), }) } @@ -727,7 +731,9 @@ fn insert_panic_block<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: mir.span, ty: tcx.types.bool, user_ty: None, - literal: ty::Const::from_bool(tcx, false), + literal: tcx.intern_lazy_const(ty::LazyConst::Evaluated( + ty::Const::from_bool(tcx, false), + )), }), expected: true, msg: message, @@ -779,6 +785,7 @@ fn create_generator_resume_function<'a, 'tcx>( insert_switch(tcx, mir, cases, &transform, TerminatorKind::Unreachable); make_generator_state_argument_indirect(tcx, def_id, mir); + make_generator_state_argument_pinned(tcx, mir); no_landing_pads(tcx, mir); diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 1cce0de5152..9f0907adc98 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -1,16 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Inlining pass for MIR functions -use rustc::hir; use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def_id::DefId; @@ -83,16 +72,13 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let param_env = self.tcx.param_env(self.source.def_id); // Only do inlining into fn bodies. - let id = self.tcx.hir.as_local_node_id(self.source.def_id).unwrap(); - let body_owner_kind = self.tcx.hir.body_owner_kind(id); - - if let (hir::BodyOwnerKind::Fn, None) = (body_owner_kind, self.source.promoted) { - + let id = self.tcx.hir().as_local_node_id(self.source.def_id).unwrap(); + if self.tcx.hir().body_owner_kind(id).is_fn_or_closure() && self.source.promoted.is_none() { for (bb, bb_data) in caller_mir.basic_blocks().iter_enumerated() { if let Some(callsite) = self.get_valid_function_call(bb, - bb_data, - caller_mir, - param_env) { + bb_data, + caller_mir, + param_env) { callsites.push_back(callsite); } } @@ -575,10 +561,10 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { // The `tmp0`, `tmp1`, and `tmp2` in our example abonve. let tuple_tmp_args = tuple_tys.iter().enumerate().map(|(i, ty)| { - // This is e.g. `tuple_tmp.0` in our example above. + // This is e.g., `tuple_tmp.0` in our example above. let tuple_field = Operand::Move(tuple.clone().field(Field::new(i), ty)); - // Spill to a local to make e.g. `tmp0`. + // Spill to a local to make e.g., `tmp0`. self.create_temp_if_necessary(tuple_field, callsite, caller_mir) }); @@ -707,12 +693,19 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> { self.in_cleanup_block = false; } - fn visit_retag(&mut self, fn_entry: &mut bool, place: &mut Place<'tcx>, loc: Location) { - self.super_retag(fn_entry, place, loc); + fn visit_retag( + &mut self, + kind: &mut RetagKind, + place: &mut Place<'tcx>, + loc: Location, + ) { + self.super_retag(kind, place, loc); // We have to patch all inlined retags to be aware that they are no longer // happening on function entry. - *fn_entry = false; + if *kind == RetagKind::FnEntry { + *kind = RetagKind::Default; + } } fn visit_terminator_kind(&mut self, block: BasicBlock, diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index 12780ef8be9..2b5e761d1d0 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Performs various peephole optimizations. use rustc::mir::{Constant, Location, Place, Mir, Operand, ProjectionElem, Rvalue, Local}; diff --git a/src/librustc_mir/transform/lower_128bit.rs b/src/librustc_mir/transform/lower_128bit.rs index 80072153167..d14e0f078e6 100644 --- a/src/librustc_mir/transform/lower_128bit.rs +++ b/src/librustc_mir/transform/lower_128bit.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Replaces 128-bit operators with lang item calls use rustc::hir::def_id::DefId; diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index aad16c4fde6..f379fe933ff 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use borrow_check::nll::type_check; use build; use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; @@ -36,7 +26,7 @@ pub mod elaborate_drops; pub mod add_call_guards; pub mod promote_consts; pub mod qualify_consts; -mod qualify_min_const_fn; +pub mod qualify_min_const_fn; pub mod remove_noop_landing_pads; pub mod dump_mir; pub mod deaggregator; @@ -92,7 +82,7 @@ fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum) _: ast::NodeId, _: Span) { if let hir::VariantData::Tuple(_, node_id) = *v { - self.set.insert(self.tcx.hir.local_def_id(node_id)); + self.set.insert(self.tcx.hir().local_def_id(node_id)); } intravisit::walk_struct_def(self, v) } @@ -100,7 +90,7 @@ fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum) NestedVisitorMap::None } } - tcx.hir.krate().visit_all_item_likes(&mut GatherCtors { + tcx.hir().krate().visit_all_item_likes(&mut GatherCtors { tcx, set: &mut set, }.as_deep_visitor()); @@ -210,9 +200,6 @@ fn mir_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Stea let mut mir = tcx.mir_built(def_id).steal(); run_passes(tcx, &mut mir, def_id, MirPhase::Const, &[ - // Remove all `EndRegion` statements that are not involved in borrows. - &cleanup_post_borrowck::CleanEndRegions, - // What we need to do constant evaluation. &simplify::SimplifyCfg::new("initial"), &type_check::TypeckMir, @@ -223,8 +210,8 @@ fn mir_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Stea } fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - if let hir::BodyOwnerKind::Const = tcx.hir.body_owner_kind(node_id) { + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind(node_id) { // Ensure that we compute the `mir_const_qualif` for constants at // this point, before we steal the mir-const result. let _ = tcx.mir_const_qualif(def_id); diff --git a/src/librustc_mir/transform/no_landing_pads.rs b/src/librustc_mir/transform/no_landing_pads.rs index c8f171d4160..2d13b066270 100644 --- a/src/librustc_mir/transform/no_landing_pads.rs +++ b/src/librustc_mir/transform/no_landing_pads.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This pass removes the unwind branch of all the terminators when the no-landing-pads option is //! specified. diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index c5add626078..1602fc35a2c 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A pass that promotes borrows of constant rvalues. //! //! The rvalues considered constant are trees of temps, @@ -123,7 +113,7 @@ impl<'tcx> Visitor<'tcx> for TempCollector<'tcx> { } } else if let TempState::Defined { ref mut uses, .. } = *temp { // We always allow borrows, even mutable ones, as we need - // to promote mutable borrows of some ZSTs e.g. `&mut []`. + // to promote mutable borrows of some ZSTs e.g., `&mut []`. let allowed_use = context.is_borrow() || context.is_nonmutating_use(); debug!("visit_local: allowed_use={:?}", allowed_use); if allowed_use { @@ -410,9 +400,11 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>, IndexVec::new(), None, initial_locals, + IndexVec::new(), 0, vec![], - mir.span + mir.span, + vec![], ), tcx, source: mir, diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 00309b0a3e9..2d941902deb 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A pass that qualifies constness of temporaries in constants, //! static initializers and functions and also drives promotion. //! @@ -17,9 +7,10 @@ use rustc_data_structures::bit_set::BitSet; use rustc_data_structures::indexed_vec::IndexVec; use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::sync::Lrc; +use rustc_target::spec::abi::Abi; use rustc::hir; use rustc::hir::def_id::DefId; -use rustc::mir::interpret::ConstValue; use rustc::traits::{self, TraitEngine}; use rustc::ty::{self, TyCtxt, Ty, TypeFoldable}; use rustc::ty::cast::CastTy; @@ -28,13 +19,12 @@ use rustc::mir::*; use rustc::mir::traversal::ReversePostorder; use rustc::mir::visit::{PlaceContext, Visitor, MutatingUseContext, NonMutatingUseContext}; use rustc::middle::lang_items; -use rustc_target::spec::abi::Abi; +use rustc::session::config::nightly_options; use syntax::ast::LitKind; -use syntax::feature_gate::{UnstableFeatures, feature_err, emit_feature_err, GateIssue}; +use syntax::feature_gate::{UnstableFeatures, emit_feature_err, GateIssue}; use syntax_pos::{Span, DUMMY_SP}; use std::fmt; -use rustc_data_structures::sync::Lrc; use std::usize; use transform::{MirPass, MirSource}; @@ -114,7 +104,6 @@ struct Qualifier<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { param_env: ty::ParamEnv<'tcx>, local_qualif: IndexVec>, qualif: Qualif, - const_fn_arg_vars: BitSet, temp_promotion_state: IndexVec, promotion_candidates: Vec } @@ -149,7 +138,6 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> { param_env, local_qualif, qualif: Qualif::empty(), - const_fn_arg_vars: BitSet::new_empty(mir.local_decls.len()), temp_promotion_state: temps, promotion_candidates: vec![] } @@ -178,26 +166,6 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> { } } - /// Error about extra statements in a constant. - fn statement_like(&mut self) { - self.add(Qualif::NOT_CONST); - if self.mode != Mode::Fn { - let mut err = feature_err( - &self.tcx.sess.parse_sess, - "const_let", - self.span, - GateIssue::Language, - &format!("statements in {}s are unstable", self.mode), - ); - if self.tcx.sess.teach(&err.get_code().unwrap()) { - err.note("Blocks in constants may only contain items (such as constant, function \ - definition, etc...) and a tail expression."); - err.help("To avoid it, you have to replace the non-item object."); - } - err.emit(); - } - } - /// Add the given qualification to self.qualif. fn add(&mut self, qualif: Qualif) { self.qualif = self.qualif | qualif; @@ -243,41 +211,46 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> { return; } - match *dest { - Place::Local(index) if (self.mir.local_kind(index) == LocalKind::Var || - self.mir.local_kind(index) == LocalKind::Arg) && - self.tcx.sess.features_untracked().const_let => { - debug!("store to var {:?}", index); - self.local_qualif[index] = Some(self.qualif); - } - Place::Local(index) if self.mir.local_kind(index) == LocalKind::Temp || - self.mir.local_kind(index) == LocalKind::ReturnPointer => { - debug!("store to {:?} (temp or return pointer)", index); - store(&mut self.local_qualif[index]) - } - - Place::Projection(box Projection { - base: Place::Local(index), - elem: ProjectionElem::Deref - }) if self.mir.local_kind(index) == LocalKind::Temp - && self.mir.local_decls[index].ty.is_box() - && self.local_qualif[index].map_or(false, |qualif| { - qualif.contains(Qualif::NOT_CONST) - }) => { - // Part of `box expr`, we should've errored - // already for the Box allocation Rvalue. - } - - // This must be an explicit assignment. - _ => { - // Catch more errors in the destination. - self.visit_place( - dest, - PlaceContext::MutatingUse(MutatingUseContext::Store), - location - ); - self.statement_like(); + let mut dest = dest; + let index = loop { + match dest { + // We treat all locals equal in constants + Place::Local(index) => break *index, + // projections are transparent for assignments + // we qualify the entire destination at once, even if just a field would have + // stricter qualification + Place::Projection(proj) => { + // Catch more errors in the destination. `visit_place` also checks various + // projection rules like union field access and raw pointer deref + self.visit_place( + dest, + PlaceContext::MutatingUse(MutatingUseContext::Store), + location + ); + dest = &proj.base; + }, + Place::Promoted(..) => bug!("promoteds don't exist yet during promotion"), + Place::Static(..) => { + // Catch more errors in the destination. `visit_place` also checks that we + // do not try to access statics from constants or try to mutate statics + self.visit_place( + dest, + PlaceContext::MutatingUse(MutatingUseContext::Store), + location + ); + return; + } } + }; + debug!("store to var {:?}", index); + match &mut self.local_qualif[index] { + // this is overly restrictive, because even full assignments do not clear the qualif + // While we could special case full assignments, this would be inconsistent with + // aggregates where we overwrite all fields via assignments, which would not get + // that feature. + Some(ref mut qualif) => *qualif = *qualif | self.qualif, + // insert new qualification + qualif @ None => *qualif = Some(self.qualif), } } @@ -318,45 +291,6 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> { TerminatorKind::FalseUnwind { .. } => None, TerminatorKind::Return => { - if !self.tcx.sess.features_untracked().const_let { - // Check for unused values. This usually means - // there are extra statements in the AST. - for temp in mir.temps_iter() { - if self.local_qualif[temp].is_none() { - continue; - } - - let state = self.temp_promotion_state[temp]; - if let TempState::Defined { location, uses: 0 } = state { - let data = &mir[location.block]; - let stmt_idx = location.statement_index; - - // Get the span for the initialization. - let source_info = if stmt_idx < data.statements.len() { - data.statements[stmt_idx].source_info - } else { - data.terminator().source_info - }; - self.span = source_info.span; - - // Treat this as a statement in the AST. - self.statement_like(); - } - } - - // Make sure there are no extra unassigned variables. - self.qualif = Qualif::NOT_CONST; - for index in mir.vars_iter() { - if !self.const_fn_arg_vars.contains(index) { - debug!("unassigned variable {:?}", index); - self.assign(&Place::Local(index), Location { - block: bb, - statement_index: usize::MAX, - }); - } - } - } - break; } }; @@ -425,12 +359,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { LocalKind::ReturnPointer => { self.not_const(); } - LocalKind::Var if !self.tcx.sess.features_untracked().const_let => { - if self.mode != Mode::Fn { - emit_feature_err(&self.tcx.sess.parse_sess, "const_let", - self.span, GateIssue::Language, - &format!("let bindings in {}s are unstable",self.mode)); - } + LocalKind::Var if self.mode == Mode::Fn => { self.add(Qualif::NOT_CONST); } LocalKind::Var | @@ -478,6 +407,16 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { // Only allow statics (not consts) to refer to other statics. if self.mode == Mode::Static || self.mode == Mode::StaticMut { + if self.mode == Mode::Static && context.is_mutating_use() { + // this is not strictly necessary as miri will also bail out + // For interior mutability we can't really catch this statically as that + // goes through raw pointers and intermediate temporaries, so miri has + // to catch this anyway + self.tcx.sess.span_err( + self.span, + "cannot mutate statics in the initializer of another static", + ); + } return; } self.add(Qualif::NOT_CONST); @@ -503,13 +442,19 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { this.super_place(place, context, location); match proj.elem { ProjectionElem::Deref => { - this.add(Qualif::NOT_CONST); + if context.is_mutating_use() { + // `not_const` errors out in const contexts + this.not_const() + } else { + // just make sure this doesn't get promoted + this.add(Qualif::NOT_CONST); + } let base_ty = proj.base.ty(this.mir, this.tcx).to_ty(this.tcx); match this.mode { Mode::Fn => {}, _ => { if let ty::RawPtr(_) = base_ty.sty { - if !this.tcx.sess.features_untracked().const_raw_ptr_deref { + if !this.tcx.features().const_raw_ptr_deref { emit_feature_err( &this.tcx.sess.parse_sess, "const_raw_ptr_deref", this.span, GateIssue::Language, @@ -524,6 +469,8 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { } } + ProjectionElem::ConstantIndex {..} | + ProjectionElem::Subslice {..} | ProjectionElem::Field(..) | ProjectionElem::Index(_) => { let base_ty = proj.base.ty(this.mir, this.tcx).to_ty(this.tcx); @@ -532,7 +479,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { match this.mode { Mode::Fn => this.not_const(), Mode::ConstFn => { - if !this.tcx.sess.features_untracked().const_fn_union { + if !this.tcx.features().const_fn_union { emit_feature_err( &this.tcx.sess.parse_sess, "const_fn_union", this.span, GateIssue::Language, @@ -553,8 +500,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { this.qualif.restrict(ty, this.tcx, this.param_env); } - ProjectionElem::ConstantIndex {..} | - ProjectionElem::Subslice {..} | ProjectionElem::Downcast(..) => { this.not_const() } @@ -579,20 +524,20 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { } } Operand::Constant(ref constant) => { - if let ConstValue::Unevaluated(def_id, _) = constant.literal.val { + if let ty::LazyConst::Unevaluated(def_id, _) = constant.literal { // Don't peek inside trait associated constants. - if self.tcx.trait_of_item(def_id).is_some() { - self.add_type(constant.literal.ty); + if self.tcx.trait_of_item(*def_id).is_some() { + self.add_type(constant.ty); } else { - let (bits, _) = self.tcx.at(constant.span).mir_const_qualif(def_id); + let (bits, _) = self.tcx.at(constant.span).mir_const_qualif(*def_id); let qualif = Qualif::from_bits(bits).expect("invalid mir_const_qualif"); self.add(qualif); // Just in case the type is more specific than - // the definition, e.g. impl associated const + // the definition, e.g., impl associated const // with type parameters, take it into account. - self.qualif.restrict(constant.literal.ty, self.tcx, self.param_env); + self.qualif.restrict(constant.ty, self.tcx, self.param_env); } } } @@ -758,7 +703,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { if let Mode::Fn = self.mode { // in normal functions, mark such casts as not promotable self.add(Qualif::NOT_CONST); - } else if !self.tcx.sess.features_untracked().const_raw_ptr_to_usize_cast { + } else if !self.tcx.features().const_raw_ptr_to_usize_cast { // in const fn and constants require the feature gate // FIXME: make it unsafe inside const fn and constants emit_feature_err( @@ -785,7 +730,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { if let Mode::Fn = self.mode { // raw pointer operations are not allowed inside promoteds self.add(Qualif::NOT_CONST); - } else if !self.tcx.sess.features_untracked().const_compare_raw_pointers { + } else if !self.tcx.features().const_compare_raw_pointers { // require the feature gate inside constants and const fn // FIXME: make it unsafe to use these operations emit_feature_err( @@ -846,145 +791,163 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { let mut is_shuffle = false; let mut is_const_fn = false; let mut is_promotable_const_fn = false; - if let ty::FnDef(def_id, _) = fn_ty.sty { - callee_def_id = Some(def_id); - match self.tcx.fn_sig(def_id).abi() { - Abi::RustIntrinsic | - Abi::PlatformIntrinsic => { - assert!(!self.tcx.is_const_fn(def_id)); - match &self.tcx.item_name(def_id).as_str()[..] { - | "size_of" - | "min_align_of" - | "needs_drop" - | "type_id" - | "bswap" - | "bitreverse" - | "ctpop" - | "cttz" - | "cttz_nonzero" - | "ctlz" - | "ctlz_nonzero" - | "overflowing_add" - | "overflowing_sub" - | "overflowing_mul" - | "unchecked_shl" - | "unchecked_shr" - | "rotate_left" - | "rotate_right" - | "add_with_overflow" - | "sub_with_overflow" - | "mul_with_overflow" - // no need to check feature gates, intrinsics are only callable from the - // libstd or with forever unstable feature gates - => is_const_fn = true, - // special intrinsic that can be called diretly without an intrinsic - // feature gate needs a language feature gate - "transmute" => { - // never promote transmute calls - if self.mode != Mode::Fn { - is_const_fn = true; - // const eval transmute calls only with the feature gate - if !self.tcx.sess.features_untracked().const_transmute { - emit_feature_err( - &self.tcx.sess.parse_sess, "const_transmute", - self.span, GateIssue::Language, - &format!("The use of std::mem::transmute() \ - is gated in {}s", self.mode)); + match fn_ty.sty { + ty::FnDef(def_id, _) => { + callee_def_id = Some(def_id); + match self.tcx.fn_sig(def_id).abi() { + Abi::RustIntrinsic | + Abi::PlatformIntrinsic => { + assert!(!self.tcx.is_const_fn(def_id)); + match &self.tcx.item_name(def_id).as_str()[..] { + | "size_of" + | "min_align_of" + | "needs_drop" + | "type_id" + | "bswap" + | "bitreverse" + | "ctpop" + | "cttz" + | "cttz_nonzero" + | "ctlz" + | "ctlz_nonzero" + | "overflowing_add" + | "overflowing_sub" + | "overflowing_mul" + | "unchecked_shl" + | "unchecked_shr" + | "rotate_left" + | "rotate_right" + | "add_with_overflow" + | "sub_with_overflow" + | "mul_with_overflow" + // no need to check feature gates, intrinsics are only callable + // from the libstd or with forever unstable feature gates + => is_const_fn = true, + // special intrinsic that can be called diretly without an intrinsic + // feature gate needs a language feature gate + "transmute" => { + // never promote transmute calls + if self.mode != Mode::Fn { + is_const_fn = true; + // const eval transmute calls only with the feature gate + if !self.tcx.features().const_transmute { + emit_feature_err( + &self.tcx.sess.parse_sess, "const_transmute", + self.span, GateIssue::Language, + &format!("The use of std::mem::transmute() \ + is gated in {}s", self.mode)); + } } } - } - name if name.starts_with("simd_shuffle") => { - is_shuffle = true; - } + name if name.starts_with("simd_shuffle") => { + is_shuffle = true; + } - _ => {} - } - } - _ => { - // in normal functions we only care about promotion - if self.mode == Mode::Fn { - // never promote const fn calls of - // functions without #[rustc_promotable] - if self.tcx.is_promotable_const_fn(def_id) { - is_const_fn = true; - is_promotable_const_fn = true; - } else if self.tcx.is_const_fn(def_id) { - is_const_fn = true; + _ => {} } - } else { - // stable const fn or unstable const fns with their feature gate - // active - if self.tcx.is_const_fn(def_id) { - is_const_fn = true; - } else if self.is_const_panic_fn(def_id) { - // check the const_panic feature gate - // FIXME: cannot allow this inside `allow_internal_unstable` because - // that would make `panic!` insta stable in constants, since the - // macro is marked with the attr - if self.tcx.sess.features_untracked().const_panic { + } + _ => { + // In normal functions we only care about promotion. + if self.mode == Mode::Fn { + // Never promote const fn calls of + // functions without `#[rustc_promotable]`. + if self.tcx.is_promotable_const_fn(def_id) { is_const_fn = true; - } else { - // don't allow panics in constants without the feature gate - emit_feature_err( - &self.tcx.sess.parse_sess, - "const_panic", - self.span, - GateIssue::Language, - &format!("panicking in {}s is unstable", self.mode), - ); - } - } else if let Some(feature) = self.tcx.is_unstable_const_fn(def_id) { - // check `#[unstable]` const fns or `#[rustc_const_unstable]` - // functions without the feature gate active in this crate to report - // a better error message than the one below - if self.span.allows_unstable() { - // `allow_internal_unstable` can make such calls stable + is_promotable_const_fn = true; + } else if self.tcx.is_const_fn(def_id) { is_const_fn = true; - } else { - let mut err = self.tcx.sess.struct_span_err(self.span, - &format!("`{}` is not yet stable as a const fn", - self.tcx.item_path_str(def_id))); - help!(&mut err, - "in Nightly builds, add `#![feature({})]` \ - to the crate attributes to enable", - feature); - err.emit(); } } else { - // FIXME(#24111) Remove this check when const fn stabilizes - let (msg, note) = if let UnstableFeatures::Disallow = - self.tcx.sess.opts.unstable_features { - (format!("calls in {}s are limited to \ - tuple structs and tuple variants", - self.mode), - Some("a limited form of compile-time function \ - evaluation is available on a nightly \ - compiler via `const fn`")) + // stable const fns or unstable const fns with their feature gate + // active + if self.tcx.is_const_fn(def_id) { + is_const_fn = true; + } else if self.is_const_panic_fn(def_id) { + // Check the const_panic feature gate. + // FIXME: cannot allow this inside `allow_internal_unstable` + // because that would make `panic!` insta stable in constants, + // since the macro is marked with the attribute. + if self.tcx.features().const_panic { + is_const_fn = true; + } else { + // Don't allow panics in constants without the feature gate. + emit_feature_err( + &self.tcx.sess.parse_sess, + "const_panic", + self.span, + GateIssue::Language, + &format!("panicking in {}s is unstable", self.mode), + ); + } + } else if let Some(feature) + = self.tcx.is_unstable_const_fn(def_id) { + // Check `#[unstable]` const fns or `#[rustc_const_unstable]` + // functions without the feature gate active in this crate in + // order to report a better error message than the one below. + if self.span.allows_unstable() { + // `allow_internal_unstable` can make such calls stable. + is_const_fn = true; + } else { + let mut err = self.tcx.sess.struct_span_err(self.span, + &format!("`{}` is not yet stable as a const fn", + self.tcx.item_path_str(def_id))); + if nightly_options::is_nightly_build() { + help!(&mut err, + "add `#![feature({})]` to the \ + crate attributes to enable", + feature); + } + err.emit(); + } } else { - (format!("calls in {}s are limited \ - to constant functions, \ - tuple structs and tuple variants", - self.mode), - None) - }; - let mut err = struct_span_err!( - self.tcx.sess, - self.span, - E0015, - "{}", - msg, - ); - if let Some(note) = note { - err.span_note(self.span, note); + // FIXME(#57563): remove this check when const fn stabilizes. + let (msg, note) = if let UnstableFeatures::Disallow = + self.tcx.sess.opts.unstable_features { + (format!("calls in {}s are limited to \ + tuple structs and tuple variants", + self.mode), + Some("a limited form of compile-time function \ + evaluation is available on a nightly \ + compiler via `const fn`")) + } else { + (format!("calls in {}s are limited \ + to constant functions, \ + tuple structs and tuple variants", + self.mode), + None) + }; + let mut err = struct_span_err!( + self.tcx.sess, + self.span, + E0015, + "{}", + msg, + ); + if let Some(note) = note { + err.span_note(self.span, note); + } + err.emit(); } - err.emit(); } } } + }, + ty::FnPtr(_) => { + if self.mode != Mode::Fn { + let mut err = self.tcx.sess.struct_span_err( + self.span, + &format!("function pointers are not allowed in const fn")); + err.emit(); + } + }, + _ => { + self.not_const(); + return } } + let constant_arguments = callee_def_id.and_then(|id| { args_required_const(self.tcx, id) }); @@ -1017,7 +980,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { // we care about constness, not promotability. // If we checked for promotability, we'd miss out on // the results of function calls (which are never promoted - // in runtime code) + // in runtime code). // This is not a problem, because the argument explicitly // requests constness, in contrast to regular promotion // which happens even without the user requesting it. @@ -1034,7 +997,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { }); } - // non-const fn calls. + // non-const fn calls if !is_const_fn { self.qualif = Qualif::NOT_CONST; if self.mode != Mode::Fn { @@ -1067,7 +1030,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { // Deny *any* live drops anywhere other than functions. if self.mode != Mode::Fn { - // HACK(eddyb) Emulate a bit of dataflow analysis, + // HACK(eddyb): emulate a bit of dataflow analysis, // conservatively, that drop elaboration will do. let needs_drop = if let Place::Local(local) = *place { if self.local_qualif[local].map_or(true, |q| q.contains(Qualif::NEEDS_DROP)) { @@ -1105,48 +1068,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { debug!("visit_assign: dest={:?} rvalue={:?} location={:?}", dest, rvalue, location); self.visit_rvalue(rvalue, location); - // Check the allowed const fn argument forms. - if let (Mode::ConstFn, &Place::Local(index)) = (self.mode, dest) { - if self.mir.local_kind(index) == LocalKind::Var && - self.const_fn_arg_vars.insert(index) && - !self.tcx.sess.features_untracked().const_let { - - // Direct use of an argument is permitted. - match *rvalue { - Rvalue::Use(Operand::Copy(Place::Local(local))) | - Rvalue::Use(Operand::Move(Place::Local(local))) => { - if self.mir.local_kind(local) == LocalKind::Arg { - return; - } - } - _ => {} - } - - // Avoid a generic error for other uses of arguments. - if self.qualif.contains(Qualif::FN_ARGUMENT) { - let decl = &self.mir.local_decls[index]; - let mut err = feature_err( - &self.tcx.sess.parse_sess, - "const_let", - decl.source_info.span, - GateIssue::Language, - "arguments of constant functions can only be immutable by-value bindings" - ); - if self.tcx.sess.teach(&err.get_code().unwrap()) { - err.note("Constant functions are not allowed to mutate anything. Thus, \ - binding to an argument with a mutable pattern is not allowed."); - err.note("Remove any mutable bindings from the argument list to fix this \ - error. In case you need to mutate the argument, try lazily \ - initializing a global variable instead of using a const fn, or \ - refactoring the code to a functional style to avoid mutation if \ - possible."); - } - err.emit(); - return; - } - } - } - self.assign(dest, location); } @@ -1168,9 +1089,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> { StatementKind::StorageLive(_) | StatementKind::StorageDead(_) | StatementKind::InlineAsm {..} | - StatementKind::EndRegion(_) | StatementKind::Retag { .. } | - StatementKind::EscapeToRaw { .. } | StatementKind::AscribeUserType(..) | StatementKind::Nop => {} } @@ -1196,7 +1115,7 @@ pub fn provide(providers: &mut Providers) { fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> (u8, Lrc>) { - // NB: This `borrow()` is guaranteed to be valid (i.e., the value + // N.B., this `borrow()` is guaranteed to be valid (i.e., the value // cannot yet be stolen), because `mir_validated()`, which steals // from `mir_const(), forces this query to execute before // performing the steal. @@ -1230,9 +1149,10 @@ impl MirPass for QualifyAndPromoteConstants { } let def_id = src.def_id; - let id = tcx.hir.as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_node_id(def_id).unwrap(); let mut const_promoted_temps = None; - let mode = match tcx.hir.body_owner_kind(id) { + let mode = match tcx.hir().body_owner_kind(id) { + hir::BodyOwnerKind::Closure => Mode::Fn, hir::BodyOwnerKind::Fn => { if tcx.is_const_fn(def_id) { Mode::ConstFn @@ -1281,6 +1201,37 @@ impl MirPass for QualifyAndPromoteConstants { // Do the actual promotion, now that we know what's viable. promote_consts::promote_candidates(mir, tcx, temps, candidates); } else { + if !mir.control_flow_destroyed.is_empty() { + let mut locals = mir.vars_iter(); + if let Some(local) = locals.next() { + let span = mir.local_decls[local].source_info.span; + let mut error = tcx.sess.struct_span_err( + span, + &format!( + "new features like let bindings are not permitted in {}s \ + which also use short circuiting operators", + mode, + ), + ); + for (span, kind) in mir.control_flow_destroyed.iter() { + error.span_note( + *span, + &format!("use of {} here does not actually short circuit due to \ + the const evaluator presently not being able to do control flow. \ + See https://github.com/rust-lang/rust/issues/49146 for more \ + information.", kind), + ); + } + for local in locals { + let span = mir.local_decls[local].source_info.span; + error.span_note( + span, + "more locals defined here", + ); + } + error.emit(); + } + } let promoted_temps = if mode == Mode::Const { // Already computed by `mir_const_qualif`. const_promoted_temps.unwrap() diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index ed13063cfdf..85bf1e70ebf 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -2,6 +2,7 @@ use rustc::hir::def_id::DefId; use rustc::hir; use rustc::mir::*; use rustc::ty::{self, Predicate, TyCtxt}; +use rustc_target::spec::abi; use std::borrow::Cow; use syntax_pos::Span; @@ -20,6 +21,7 @@ pub fn is_min_const_fn( | Predicate::RegionOutlives(_) | Predicate::TypeOutlives(_) | Predicate::WellFormed(_) + | Predicate::Projection(_) | Predicate::ConstEvaluatable(..) => continue, | Predicate::ObjectSafe(_) => { bug!("object safe predicate on function: {:#?}", predicate) @@ -28,13 +30,6 @@ pub fn is_min_const_fn( bug!("closure kind predicate on function: {:#?}", predicate) } Predicate::Subtype(_) => bug!("subtype predicate on function: {:#?}", predicate), - Predicate::Projection(_) => { - let span = tcx.def_span(current); - // we'll hit a `Predicate::Trait` later which will report an error - tcx.sess - .delay_span_bug(span, "projection without trait bound"); - continue; - } Predicate::Trait(pred) => { if Some(pred.def_id()) == tcx.lang_items().sized_trait() { continue; @@ -64,12 +59,6 @@ pub fn is_min_const_fn( } } - for local in mir.vars_iter() { - return Err(( - mir.local_decls[local].source_info.span, - "local variables in const fn are unstable".into(), - )); - } for local in &mir.local_decls { check_ty(tcx, local.ty, local.source_info.span)?; } @@ -146,7 +135,7 @@ fn check_rvalue( check_operand(tcx, mir, operand, span) } Rvalue::Len(place) | Rvalue::Discriminant(place) | Rvalue::Ref(_, _, place) => { - check_place(tcx, mir, place, span, PlaceMode::Read) + check_place(tcx, mir, place, span) } Rvalue::Cast(CastKind::Misc, operand, cast_ty) => { use rustc::ty::cast::CastTy; @@ -212,11 +201,6 @@ fn check_rvalue( } } -enum PlaceMode { - Assign, - Read, -} - fn check_statement( tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &'a Mir<'tcx>, @@ -225,11 +209,11 @@ fn check_statement( let span = statement.source_info.span; match &statement.kind { StatementKind::Assign(place, rval) => { - check_place(tcx, mir, place, span, PlaceMode::Assign)?; + check_place(tcx, mir, place, span)?; check_rvalue(tcx, mir, rval, span) } - StatementKind::FakeRead(..) => Err((span, "match in const fn is unstable".into())), + StatementKind::FakeRead(_, place) => check_place(tcx, mir, place, span), // just an assignment StatementKind::SetDiscriminant { .. } => Ok(()), @@ -242,8 +226,6 @@ fn check_statement( | StatementKind::StorageLive(_) | StatementKind::StorageDead(_) | StatementKind::Retag { .. } - | StatementKind::EscapeToRaw { .. } - | StatementKind::EndRegion(_) | StatementKind::AscribeUserType(..) | StatementKind::Nop => Ok(()), } @@ -257,7 +239,7 @@ fn check_operand( ) -> McfResult { match operand { Operand::Move(place) | Operand::Copy(place) => { - check_place(tcx, mir, place, span, PlaceMode::Read) + check_place(tcx, mir, place, span) } Operand::Constant(_) => Ok(()), } @@ -268,29 +250,17 @@ fn check_place( mir: &'a Mir<'tcx>, place: &Place<'tcx>, span: Span, - mode: PlaceMode, ) -> McfResult { match place { - Place::Local(l) => match mode { - PlaceMode::Assign => match mir.local_kind(*l) { - LocalKind::Temp | LocalKind::ReturnPointer => Ok(()), - LocalKind::Arg | LocalKind::Var => { - Err((span, "assignments in const fn are unstable".into())) - } - }, - PlaceMode::Read => Ok(()), - }, + Place::Local(_) => Ok(()), // promoteds are always fine, they are essentially constants Place::Promoted(_) => Ok(()), Place::Static(_) => Err((span, "cannot access `static` items in const fn".into())), Place::Projection(proj) => { match proj.elem { + | ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } | ProjectionElem::Deref | ProjectionElem::Field(..) | ProjectionElem::Index(_) => { - check_place(tcx, mir, &proj.base, span, mode) - } - // slice patterns are unstable - | ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } => { - return Err((span, "slice patterns in const fn are unstable".into())) + check_place(tcx, mir, &proj.base, span) } | ProjectionElem::Downcast(..) => { Err((span, "`match` or `if let` in `const fn` is unstable".into())) @@ -312,10 +282,10 @@ fn check_terminator( | TerminatorKind::Resume => Ok(()), TerminatorKind::Drop { location, .. } => { - check_place(tcx, mir, location, span, PlaceMode::Read) + check_place(tcx, mir, location, span) } TerminatorKind::DropAndReplace { location, value, .. } => { - check_place(tcx, mir, location, span, PlaceMode::Read)?; + check_place(tcx, mir, location, span)?; check_operand(tcx, mir, value, span) }, @@ -339,19 +309,36 @@ fn check_terminator( } => { let fn_ty = func.ty(mir, tcx); if let ty::FnDef(def_id, _) = fn_ty.sty { - if tcx.is_min_const_fn(def_id) { - check_operand(tcx, mir, func, span)?; - for arg in args { - check_operand(tcx, mir, arg, span)?; - } - Ok(()) - } else { - Err(( + // some intrinsics are waved through if called inside the + // standard library. Users never need to call them directly + match tcx.fn_sig(def_id).abi() { + abi::Abi::RustIntrinsic => if !is_intrinsic_whitelisted(tcx, def_id) { + return Err(( + span, + "can only call a curated list of intrinsics in `min_const_fn`".into(), + )) + }, + abi::Abi::Rust if tcx.is_min_const_fn(def_id) => {}, + abi::Abi::Rust => return Err(( span, "can only call other `min_const_fn` within a `min_const_fn`".into(), - )) + )), + abi => return Err(( + span, + format!( + "cannot call functions with `{}` abi in `min_const_fn`", + abi, + ).into(), + )), } + + check_operand(tcx, mir, func, span)?; + + for arg in args { + check_operand(tcx, mir, arg, span)?; + } + Ok(()) } else { Err((span, "can only call other const fns within const fn".into())) } @@ -365,10 +352,38 @@ fn check_terminator( cleanup: _, } => check_operand(tcx, mir, cond, span), - | TerminatorKind::FalseUnwind { .. } => span_bug!( - terminator.source_info.span, - "min_const_fn encountered `{:#?}`", - terminator - ), + TerminatorKind::FalseUnwind { .. } => { + Err((span, "loops are not allowed in const fn".into())) + }, + } +} + +/// Returns true if the `def_id` refers to an intrisic which we've whitelisted +/// for being called from stable `const fn`s (`min_const_fn`). +/// +/// Adding more intrinsics requires sign-off from @rust-lang/lang. +fn is_intrinsic_whitelisted(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { + match &tcx.item_name(def_id).as_str()[..] { + | "size_of" + | "min_align_of" + | "needs_drop" + // Arithmetic: + | "add_with_overflow" // ~> .overflowing_add + | "sub_with_overflow" // ~> .overflowing_sub + | "mul_with_overflow" // ~> .overflowing_mul + | "overflowing_add" // ~> .wrapping_add + | "overflowing_sub" // ~> .wrapping_sub + | "overflowing_mul" // ~> .wrapping_mul + | "unchecked_shl" // ~> .wrapping_shl + | "unchecked_shr" // ~> .wrapping_shr + | "rotate_left" // ~> .rotate_left + | "rotate_right" // ~> .rotate_right + | "ctpop" // ~> .count_ones + | "ctlz" // ~> .leading_zeros + | "cttz" // ~> .trailing_zeros + | "bswap" // ~> .swap_bytes + | "bitreverse" // ~> .reverse_bits + => true, + _ => false, } } diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index 445ffbbcf34..c8ef2decf26 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty::TyCtxt; use rustc::mir::*; use rustc_data_structures::bit_set::BitSet; @@ -52,24 +42,20 @@ impl RemoveNoopLandingPads { StatementKind::FakeRead(..) | StatementKind::StorageLive(_) | StatementKind::StorageDead(_) | - StatementKind::EndRegion(_) | StatementKind::AscribeUserType(..) | StatementKind::Nop => { - // These are all nops in a landing pad (there's some - // borrowck interaction between EndRegion and storage - // instructions, but this should all run after borrowck). + // These are all nops in a landing pad } StatementKind::Assign(Place::Local(_), box Rvalue::Use(_)) => { - // Writing to a local (e.g. a drop flag) does not + // Writing to a local (e.g., a drop flag) does not // turn a landing pad to a non-nop } StatementKind::Assign { .. } | StatementKind::SetDiscriminant { .. } | StatementKind::InlineAsm { .. } | - StatementKind::Retag { .. } | - StatementKind::EscapeToRaw { .. } => { + StatementKind::Retag { .. } => { return false; } } diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index 8f026c706fd..36a6279e503 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_target::spec::abi::{Abi}; use syntax::ast; use syntax_pos::Span; @@ -34,7 +24,7 @@ impl MirPass for SanityCheck { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource, mir: &mut Mir<'tcx>) { let def_id = src.def_id; - let id = tcx.hir.as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_node_id(def_id).unwrap(); if !tcx.has_attr(def_id, "rustc_mir") { debug!("skipping rustc_peek::SanityCheck on {}", tcx.item_path_str(def_id)); return; @@ -95,8 +85,8 @@ pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &Mir<'tcx>, id: ast::NodeId, _attributes: &[ast::Attribute], - results: &DataflowResults) - where O: BitDenotation + HasMoveData<'tcx> + results: &DataflowResults<'tcx, O>) + where O: BitDenotation<'tcx, Idx=MovePathIndex> + HasMoveData<'tcx> { debug!("sanity_check_via_rustc_peek id: {:?}", id); // FIXME: this is not DRY. Figure out way to abstract this and @@ -110,9 +100,9 @@ pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &Mir<'tcx>, - results: &DataflowResults, + results: &DataflowResults<'tcx, O>, bb: mir::BasicBlock) where - O: BitDenotation + HasMoveData<'tcx> + O: BitDenotation<'tcx, Idx=MovePathIndex> + HasMoveData<'tcx> { let move_data = results.0.operator.move_data(); let mir::BasicBlockData { ref statements, ref terminator, is_cleanup: _ } = mir[bb]; @@ -161,9 +151,7 @@ fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir::StatementKind::StorageLive(_) | mir::StatementKind::StorageDead(_) | mir::StatementKind::InlineAsm { .. } | - mir::StatementKind::EndRegion(_) | mir::StatementKind::Retag { .. } | - mir::StatementKind::EscapeToRaw { .. } | mir::StatementKind::AscribeUserType(..) | mir::StatementKind::Nop => continue, mir::StatementKind::SetDiscriminant{ .. } => diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index f643870dec2..ed2da98dd53 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A number of passes which remove various redundancies in the CFG. //! //! The `SimplifyCfg` pass gets rid of unnecessary blocks in the CFG, whereas the `SimplifyLocals` @@ -108,10 +98,14 @@ impl<'a, 'tcx: 'a> CfgSimplifier<'a, 'tcx> { pub fn simplify(mut self) { self.strip_nops(); + let mut start = START_BLOCK; + loop { let mut changed = false; - for bb in (0..self.basic_blocks.len()).map(BasicBlock::new) { + self.collapse_goto_chain(&mut start, &mut changed); + + for bb in self.basic_blocks.indices() { if self.pred_count[bb] == 0 { continue } @@ -142,6 +136,27 @@ impl<'a, 'tcx: 'a> CfgSimplifier<'a, 'tcx> { if !changed { break } } + + if start != START_BLOCK { + debug_assert!(self.pred_count[START_BLOCK] == 0); + self.basic_blocks.swap(START_BLOCK, start); + self.pred_count.swap(START_BLOCK, start); + + // pred_count == 1 if the start block has no predecessor _blocks_. + if self.pred_count[START_BLOCK] > 1 { + for (bb, data) in self.basic_blocks.iter_enumerated_mut() { + if self.pred_count[bb] == 0 { + continue; + } + + for target in data.terminator_mut().successors_mut() { + if *target == start { + *target = START_BLOCK; + } + } + } + } + } } // Collapse a goto chain starting from `start` diff --git a/src/librustc_mir/transform/simplify_branches.rs b/src/librustc_mir/transform/simplify_branches.rs index b2489809543..abaea709463 100644 --- a/src/librustc_mir/transform/simplify_branches.rs +++ b/src/librustc_mir/transform/simplify_branches.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A pass that simplifies branches when their condition is known. use rustc::ty::{TyCtxt, ParamEnv}; @@ -40,11 +30,12 @@ impl MirPass for SimplifyBranches { discr: Operand::Constant(ref c), switch_ty, ref values, ref targets, .. } => { let switch_ty = ParamEnv::empty().and(switch_ty); - if let Some(constint) = c.literal.assert_bits(tcx, switch_ty) { + let constant = c.literal.map_evaluated(|c| c.assert_bits(tcx, switch_ty)); + if let Some(constant) = constant { let (otherwise, targets) = targets.split_last().unwrap(); let mut ret = TerminatorKind::Goto { target: *otherwise }; for (&v, t) in values.iter().zip(targets.iter()) { - if v == constint { + if v == constant { ret = TerminatorKind::Goto { target: *t }; break; } @@ -56,9 +47,8 @@ impl MirPass for SimplifyBranches { }, TerminatorKind::Assert { target, cond: Operand::Constant(ref c), expected, .. - } if (c.literal.assert_bool(tcx) == Some(true)) == expected => { - TerminatorKind::Goto { target } - }, + } if (c.literal.map_evaluated(|e| e.assert_bool(tcx)) == Some(true)) == expected => + TerminatorKind::Goto { target }, TerminatorKind::FalseEdges { real_target, .. } => { TerminatorKind::Goto { target: real_target } }, diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index 949b8f74f71..5ab9669baac 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This pass converts move out from array by Subslice and // ConstIndex{.., from_end: true} to ConstIndex move out(s) from begin // of array. It allows detect error by mir borrowck and elaborate diff --git a/src/librustc_mir/util/alignment.rs b/src/librustc_mir/util/alignment.rs index 8717bd08ae4..659b5beb305 100644 --- a/src/librustc_mir/util/alignment.rs +++ b/src/librustc_mir/util/alignment.rs @@ -1,14 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use rustc::ty::{self, TyCtxt}; use rustc::mir::*; @@ -30,7 +19,7 @@ pub fn is_disaligned<'a, 'tcx, L>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let ty = place.ty(local_decls, tcx).to_ty(tcx); match tcx.layout_raw(param_env.and(ty)) { - Ok(layout) if layout.align.abi() == 1 => { + Ok(layout) if layout.align.abi.bytes() == 1 => { // if the alignment is 1, the type can't be further // disaligned. debug!("is_disaligned({:?}) - align = 1", place); diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs index ae0483e3c14..7ad73aaa3f9 100644 --- a/src/librustc_mir/util/borrowck_errors.rs +++ b/src/librustc_mir/util/borrowck_errors.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::session::config::BorrowckMode; use rustc::ty::{self, TyCtxt}; use rustc_errors::{DiagnosticBuilder, DiagnosticId}; @@ -148,13 +138,15 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { old_load_end_span: Option, o: Origin, ) -> DiagnosticBuilder<'cx> { + let via = |msg: &str| + if msg.is_empty() { msg.to_string() } else { format!(" (via `{}`)", msg) }; let mut err = struct_span_err!( self, new_loan_span, E0499, "cannot borrow `{}`{} as mutable more than once at a time{OGN}", desc, - opt_via, + via(opt_via), OGN = o ); if old_loan_span == new_loan_span { @@ -174,11 +166,11 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { } else { err.span_label( old_loan_span, - format!("first mutable borrow occurs here{}", old_opt_via), + format!("first mutable borrow occurs here{}", via(old_opt_via)), ); err.span_label( new_loan_span, - format!("second mutable borrow occurs here{}", opt_via), + format!("second mutable borrow occurs here{}", via(opt_via)), ); if let Some(old_load_end_span) = old_load_end_span { err.span_label(old_load_end_span, "first borrow ends here"); @@ -261,6 +253,7 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { old_loan_span: Span, old_opt_via: &str, previous_end_span: Option, + second_borrow_desc: &str, o: Origin, ) -> DiagnosticBuilder<'cx> { let mut err = struct_span_err!( @@ -274,7 +267,10 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { kind_new, OGN = o ); - err.span_label(new_loan_span, format!("borrow occurs here{}", opt_via)); + err.span_label( + new_loan_span, + format!("{}borrow occurs here{}", second_borrow_desc, opt_via), + ); err.span_label( old_loan_span, format!("{} construction occurs here{}", container_name, old_opt_via), @@ -298,27 +294,46 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { old_load_end_span: Option, o: Origin, ) -> DiagnosticBuilder<'cx> { + let via = |msg: &str| + if msg.is_empty() { msg.to_string() } else { format!(" (via `{}`)", msg) }; let mut err = struct_span_err!( self, span, E0502, - "cannot borrow `{}`{} as {} because {} is also borrowed as {}{}{OGN}", + "cannot borrow `{}`{} as {} because {} is also borrowed \ + as {}{}{OGN}", desc_new, - msg_new, + via(msg_new), kind_new, noun_old, kind_old, - msg_old, + via(msg_old), OGN = o ); - err.span_label(span, format!("{} borrow occurs here{}", kind_new, msg_new)); - err.span_label( - old_span, - format!("{} borrow occurs here{}", kind_old, msg_old), - ); + + if msg_new == "" { + // If `msg_new` is empty, then this isn't a borrow of a union field. + err.span_label(span, format!("{} borrow occurs here", kind_new)); + err.span_label(old_span, format!("{} borrow occurs here", kind_old)); + } else { + // If `msg_new` isn't empty, then this a borrow of a union field. + err.span_label( + span, + format!( + "{} borrow of `{}` -- which overlaps with `{}` -- occurs here", + kind_new, msg_new, msg_old, + ) + ); + err.span_label( + old_span, + format!("{} borrow occurs here{}", kind_old, via(msg_old)), + ); + } + if let Some(old_load_end_span) = old_load_end_span { err.span_label(old_load_end_span, format!("{} borrow ends here", kind_old)); } + self.cancel_if_wrong_origin(err, o) } diff --git a/src/librustc_mir/util/collect_writes.rs b/src/librustc_mir/util/collect_writes.rs index 3e1d0852dee..fd94c49dd1d 100644 --- a/src/librustc_mir/util/collect_writes.rs +++ b/src/librustc_mir/util/collect_writes.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::mir::{Local, Location}; use rustc::mir::Mir; use rustc::mir::visit::PlaceContext; diff --git a/src/librustc_mir/util/def_use.rs b/src/librustc_mir/util/def_use.rs index 07de346e795..057a7c8be88 100644 --- a/src/librustc_mir/util/def_use.rs +++ b/src/librustc_mir/util/def_use.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Def-use analysis. use rustc::mir::{Local, Location, Mir}; diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index 2c7f337b3b1..8b55a4424ae 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; use rustc::hir; use rustc::mir::*; @@ -24,8 +14,8 @@ use std::u32; #[derive(Debug, PartialEq, Eq, Copy, Clone)] pub enum DropFlagState { - Present, // i.e. initialized - Absent, // i.e. deinitialized or "moved" + Present, // i.e., initialized + Absent, // i.e., deinitialized or "moved" } impl DropFlagState { @@ -973,7 +963,9 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> span: self.source_info.span, ty: self.tcx().types.usize, user_ty: None, - literal: ty::Const::from_usize(self.tcx(), val.into()), + literal: self.tcx().intern_lazy_const(ty::LazyConst::Evaluated( + ty::Const::from_usize(self.tcx(), val.into()) + )), }) } diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index 0b883f68bff..b68898f7130 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use dot; use rustc::hir::def_id::DefId; use rustc::mir::*; @@ -38,7 +28,7 @@ pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'_, '_, 'tcx>, w: &mut W) -> io::Result<()> where W: Write { - writeln!(w, "digraph Mir_{} {{", tcx.hir.as_local_node_id(def_id).unwrap())?; + writeln!(w, "digraph Mir_{} {{", tcx.hir().as_local_node_id(def_id).unwrap())?; // Global graph properties writeln!(w, r#" graph [fontname="monospace"];"#)?; diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index 12c13b8f815..b68c6f8748f 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Liveness analysis which computes liveness of MIR local variables at the boundary of basic blocks //! //! This analysis considers references as being used only at the point of the @@ -29,7 +19,7 @@ //! ``` //! //! This means that users of this analysis still have to check whether -//! pre-existing references can be used to access the value (e.g. at movable +//! pre-existing references can be used to access the value (e.g., at movable //! generator yield points, all pre-existing references are invalidated, so this //! doesn't matter). @@ -343,7 +333,7 @@ fn dump_matched_mir_node<'a, 'tcx, V: Idx>( ) { let mut file_path = PathBuf::new(); file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir)); - let item_id = tcx.hir.as_local_node_id(source.def_id).unwrap(); + let item_id = tcx.hir().as_local_node_id(source.def_id).unwrap(); let file_name = format!("rustc.node{}{}-liveness.mir", item_id, pass_name); file_path.push(&file_name); let _ = fs::File::create(&file_path).and_then(|mut file| { diff --git a/src/librustc_mir/util/mod.rs b/src/librustc_mir/util/mod.rs index 1e624081bcf..29614a33f8e 100644 --- a/src/librustc_mir/util/mod.rs +++ b/src/librustc_mir/util/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::unicode::property::Pattern_White_Space; use rustc::ty; use syntax_pos::Span; diff --git a/src/librustc_mir/util/patch.rs b/src/librustc_mir/util/patch.rs index 807c8386693..5a1f94677a1 100644 --- a/src/librustc_mir/util/patch.rs +++ b/src/librustc_mir/util/patch.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty::Ty; use rustc::mir::*; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index c74492fe649..3a15356806a 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::mir::*; @@ -24,7 +14,7 @@ use std::path::{Path, PathBuf}; use super::graphviz::write_mir_fn_graphviz; use transform::MirSource; -const INDENT: &'static str = " "; +const INDENT: &str = " "; /// Alignment for lining up comments following MIR statements pub(crate) const ALIGN: usize = 40; @@ -152,6 +142,7 @@ fn dump_matched_mir_node<'a, 'gcx, 'tcx, F>( } writeln!(file, "")?; extra_data(PassWhere::BeforeCFG, &mut file)?; + write_user_type_annotations(mir, &mut file)?; write_mir_fn(tcx, source, mir, &mut extra_data, &mut file)?; extra_data(PassWhere::AfterCFG, &mut file)?; }; @@ -193,7 +184,7 @@ fn dump_path( let mut file_path = PathBuf::new(); file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir)); - let item_name = tcx.hir + let item_name = tcx.hir() .def_path(source.def_id) .to_filename_friendly_no_crate(); @@ -408,12 +399,21 @@ impl<'cx, 'gcx, 'tcx> Visitor<'tcx> for ExtraComments<'cx, 'gcx, 'tcx> { self.push(&format!("+ literal: {:?}", literal)); } - fn visit_const(&mut self, constant: &&'tcx ty::Const<'tcx>, _: Location) { + fn visit_const(&mut self, constant: &&'tcx ty::LazyConst<'tcx>, _: Location) { self.super_const(constant); - let ty::Const { ty, val, .. } = constant; - self.push("ty::Const"); - self.push(&format!("+ ty: {:?}", ty)); - self.push(&format!("+ val: {:?}", val)); + match constant { + ty::LazyConst::Evaluated(constant) => { + let ty::Const { ty, val, .. } = constant; + self.push("ty::Const"); + self.push(&format!("+ ty: {:?}", ty)); + self.push(&format!("+ val: {:?}", val)); + }, + ty::LazyConst::Unevaluated(did, substs) => { + self.push("ty::LazyConst::Unevaluated"); + self.push(&format!("+ did: {:?}", did)); + self.push(&format!("+ substs: {:?}", substs)); + }, + } } fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) { @@ -569,10 +569,11 @@ pub fn write_mir_intro<'a, 'gcx, 'tcx>( } fn write_mir_sig(tcx: TyCtxt, src: MirSource, mir: &Mir, w: &mut dyn Write) -> io::Result<()> { - let id = tcx.hir.as_local_node_id(src.def_id).unwrap(); - let body_owner_kind = tcx.hir.body_owner_kind(id); + let id = tcx.hir().as_local_node_id(src.def_id).unwrap(); + let body_owner_kind = tcx.hir().body_owner_kind(id); match (body_owner_kind, src.promoted) { (_, Some(i)) => write!(w, "{:?} in", i)?, + (hir::BodyOwnerKind::Closure, _) | (hir::BodyOwnerKind::Fn, _) => write!(w, "fn")?, (hir::BodyOwnerKind::Const, _) => write!(w, "const")?, (hir::BodyOwnerKind::Static(hir::MutImmutable), _) => write!(w, "static")?, @@ -585,6 +586,7 @@ fn write_mir_sig(tcx: TyCtxt, src: MirSource, mir: &Mir, w: &mut dyn Write) -> i })?; match (body_owner_kind, src.promoted) { + (hir::BodyOwnerKind::Closure, None) | (hir::BodyOwnerKind::Fn, None) => { write!(w, "(")?; @@ -628,6 +630,19 @@ fn write_temp_decls(mir: &Mir, w: &mut dyn Write) -> io::Result<()> { Ok(()) } +fn write_user_type_annotations(mir: &Mir, w: &mut dyn Write) -> io::Result<()> { + if !mir.user_type_annotations.is_empty() { + writeln!(w, "| User Type Annotations")?; + } + for (index, annotation) in mir.user_type_annotations.iter_enumerated() { + writeln!(w, "| {:?}: {:?} at {:?}", index.index(), annotation.user_ty, annotation.span)?; + } + if !mir.user_type_annotations.is_empty() { + writeln!(w, "|")?; + } + Ok(()) +} + pub fn dump_mir_def_ids(tcx: TyCtxt, single: Option) -> Vec { if let Some(i) = single { vec![i] diff --git a/src/librustc_msan/Cargo.toml b/src/librustc_msan/Cargo.toml index 29165675a2a..78c39d03e45 100644 --- a/src/librustc_msan/Cargo.toml +++ b/src/librustc_msan/Cargo.toml @@ -16,4 +16,4 @@ cmake = "0.1.18" [dependencies] alloc = { path = "../liballoc" } core = { path = "../libcore" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = "0.1.0" diff --git a/src/librustc_msan/build.rs b/src/librustc_msan/build.rs index 4abfc358560..085514b5a01 100644 --- a/src/librustc_msan/build.rs +++ b/src/librustc_msan/build.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate build_helper; extern crate cmake; @@ -18,6 +8,8 @@ use cmake::Config; fn main() { if let Some(llvm_config) = env::var_os("LLVM_CONFIG") { + build_helper::restore_library_path(); + let (native, target) = match sanitizer_lib_boilerplate("msan") { Ok(native) => native, _ => return, diff --git a/src/librustc_msan/lib.rs b/src/librustc_msan/lib.rs index 47f917e40c1..d6c8e54c18d 100644 --- a/src/librustc_msan/lib.rs +++ b/src/librustc_msan/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![sanitizer_runtime] #![feature(nll)] #![feature(sanitizer_runtime)] diff --git a/src/librustc_passes/Cargo.toml b/src/librustc_passes/Cargo.toml index 2babb93eedb..f5154a033af 100644 --- a/src/librustc_passes/Cargo.toml +++ b/src/librustc_passes/Cargo.toml @@ -14,5 +14,6 @@ rustc = { path = "../librustc" } rustc_mir = { path = "../librustc_mir"} rustc_data_structures = { path = "../librustc_data_structures" } syntax = { path = "../libsyntax" } +syntax_ext = { path = "../libsyntax_ext" } syntax_pos = { path = "../libsyntax_pos" } rustc_errors = { path = "../librustc_errors" } diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index b878a330ab6..3deb2ff8d8a 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Validate AST before lowering it to HIR // // This pass is supposed to catch things that fit into AST data structures, @@ -16,6 +6,7 @@ // This pass is supposed to perform only simple checks not requiring name resolution // or type checking or some other kind of complex analysis. +use std::mem; use rustc::lint; use rustc::session::Session; use syntax::ast::*; @@ -24,15 +15,82 @@ use syntax::source_map::Spanned; use syntax::symbol::keywords; use syntax::ptr::P; use syntax::visit::{self, Visitor}; +use syntax_ext::proc_macro_decls::is_proc_macro_attr; use syntax_pos::Span; use errors; use errors::Applicability; struct AstValidator<'a> { session: &'a Session, + has_proc_macro_decls: bool, + has_global_allocator: bool, + + // Used to ban nested `impl Trait`, e.g., `impl Into`. + // Nested `impl Trait` _is_ allowed in associated type position, + // e.g `impl Iterator` + outer_impl_trait: Option, + + // Used to ban `impl Trait` in path projections like `::Item` + // or `Foo::Bar` + is_impl_trait_banned: bool, } impl<'a> AstValidator<'a> { + fn with_banned_impl_trait(&mut self, f: impl FnOnce(&mut Self)) { + let old = mem::replace(&mut self.is_impl_trait_banned, true); + f(self); + self.is_impl_trait_banned = old; + } + + fn with_impl_trait(&mut self, outer_impl_trait: Option, f: impl FnOnce(&mut Self)) { + let old = mem::replace(&mut self.outer_impl_trait, outer_impl_trait); + f(self); + self.outer_impl_trait = old; + } + + // Mirrors visit::walk_ty, but tracks relevant state + fn walk_ty(&mut self, t: &'a Ty) { + match t.node { + TyKind::ImplTrait(..) => { + self.with_impl_trait(Some(t.span), |this| visit::walk_ty(this, t)) + } + TyKind::Path(ref qself, ref path) => { + // We allow these: + // - `Option` + // - `option::Option` + // - `option::Option::Foo + // + // But not these: + // - `::Foo` + // - `option::Option::Foo`. + // + // To implement this, we disallow `impl Trait` from `qself` + // (for cases like `::Foo>`) + // but we allow `impl Trait` in `GenericArgs` + // iff there are no more PathSegments. + if let Some(ref qself) = *qself { + // `impl Trait` in `qself` is always illegal + self.with_banned_impl_trait(|this| this.visit_ty(&qself.ty)); + } + + // Note that there should be a call to visit_path here, + // so if any logic is added to process `Path`s a call to it should be + // added both in visit_path and here. This code mirrors visit::walk_path. + for (i, segment) in path.segments.iter().enumerate() { + // Allow `impl Trait` iff we're on the final path segment + if i == path.segments.len() - 1 { + self.visit_path_segment(path.span, segment); + } else { + self.with_banned_impl_trait(|this| { + this.visit_path_segment(path.span, segment) + }); + } + } + } + _ => visit::walk_ty(self, t), + } + } + fn err_handler(&self) -> &errors::Handler { &self.session.diagnostic() } @@ -182,7 +240,7 @@ impl<'a> AstValidator<'a> { ); if let Ok(snippet) = self.session.source_map().span_to_snippet(span) { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "consider adding parentheses", format!("({})", snippet), Applicability::MachineApplicable, ); @@ -235,7 +293,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { ); match val.node { ExprKind::Lit(ref v) if v.node.is_numeric() => { - err.span_suggestion_with_applicability( + err.span_suggestion( place.span.between(val.span), "if you meant to write a comparison against a negative value, add a \ space in between `<` and `-`", @@ -277,6 +335,19 @@ impl<'a> Visitor<'a> for AstValidator<'a> { self.no_questions_in_bounds(bounds, "trait object types", false); } TyKind::ImplTrait(_, ref bounds) => { + if self.is_impl_trait_banned { + struct_span_err!(self.session, ty.span, E0667, + "`impl Trait` is not allowed in path parameters").emit(); + } + + if let Some(outer_impl_trait) = self.outer_impl_trait { + struct_span_err!(self.session, ty.span, E0666, + "nested `impl Trait` is not allowed") + .span_label(outer_impl_trait, "outer `impl Trait`") + .span_label(ty.span, "nested `impl Trait` here") + .emit(); + + } if !bounds.iter() .any(|b| if let GenericBound::Trait(..) = *b { true } else { false }) { self.err_handler().span_err(ty.span, "at least one trait must be specified"); @@ -285,26 +356,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { _ => {} } - visit::walk_ty(self, ty) - } - - fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) { - // Check if the path in this `use` is not generic, such as `use foo::bar;` While this - // can't happen normally thanks to the parser, a generic might sneak in if the `use` is - // built using a macro. - // - // macro_use foo { - // ($p:path) => { use $p; } - // } - // foo!(bar::baz); - use_tree.prefix.segments.iter().find(|segment| { - segment.args.is_some() - }).map(|segment| { - self.err_handler().span_err(segment.args.as_ref().unwrap().span(), - "generic arguments in import path"); - }); - - visit::walk_use_tree(self, use_tree, id); + self.walk_ty(ty) } fn visit_label(&mut self, label: &'a Label) { @@ -318,6 +370,14 @@ impl<'a> Visitor<'a> for AstValidator<'a> { } fn visit_item(&mut self, item: &'a Item) { + if item.attrs.iter().any(|attr| is_proc_macro_attr(attr) ) { + self.has_proc_macro_decls = true; + } + + if attr::contains_name(&item.attrs, "global_allocator") { + self.has_global_allocator = true; + } + match item.node { ItemKind::Impl(unsafety, polarity, _, _, Some(..), ref ty, ref impl_items) => { self.invalid_visibility(&item.vis, None); @@ -404,7 +464,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { } } ItemKind::Mod(_) => { - // Ensure that `path` attributes on modules are recorded as used (c.f. #35584). + // Ensure that `path` attributes on modules are recorded as used (cf. issue #35584). attr::first_attr_value_str_by_name(&item.attrs, "path"); if attr::contains_name(&item.attrs, "warn_directory_ownership") { let lint = lint::builtin::LEGACY_DIRECTORY_OWNERSHIP; @@ -443,15 +503,26 @@ impl<'a> Visitor<'a> for AstValidator<'a> { visit::walk_foreign_item(self, fi) } - fn visit_vis(&mut self, vis: &'a Visibility) { - if let VisibilityKind::Restricted { ref path, .. } = vis.node { - path.segments.iter().find(|segment| segment.args.is_some()).map(|segment| { - self.err_handler().span_err(segment.args.as_ref().unwrap().span(), - "generic arguments in visibility path"); - }); + // Mirrors visit::walk_generic_args, but tracks relevant state + fn visit_generic_args(&mut self, _: Span, generic_args: &'a GenericArgs) { + match *generic_args { + GenericArgs::AngleBracketed(ref data) => { + walk_list!(self, visit_generic_arg, &data.args); + // Type bindings such as `Item=impl Debug` in `Iterator` + // are allowed to contain nested `impl Trait`. + self.with_impl_trait(None, |this| { + walk_list!(this, visit_assoc_type_binding, &data.bindings); + }); + } + GenericArgs::Parenthesized(ref data) => { + walk_list!(self, visit_ty, &data.inputs); + if let Some(ref type_) = data.output { + // `-> Foo` syntax is essentially an associated type binding, + // so it is also allowed to contain nested `impl Trait`. + self.with_impl_trait(None, |this| visit::walk_ty(this, type_)); + } + } } - - visit::walk_vis(self, vis) } fn visit_generics(&mut self, generics: &'a Generics) { @@ -478,8 +549,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> { } for predicate in &generics.where_clause.predicates { if let WherePredicate::EqPredicate(ref predicate) = *predicate { - self.err_handler().span_err(predicate.span, "equality constraints are not yet \ - supported in where clauses (#20041)"); + self.err_handler() + .span_err(predicate.span, "equality constraints are not yet \ + supported in where clauses (see #20041)"); } } visit::walk_generics(self, generics) @@ -529,148 +601,15 @@ impl<'a> Visitor<'a> for AstValidator<'a> { } } -// Bans nested `impl Trait`, e.g. `impl Into`. -// Nested `impl Trait` _is_ allowed in associated type position, -// e.g `impl Iterator` -struct NestedImplTraitVisitor<'a> { - session: &'a Session, - outer_impl_trait: Option, -} - -impl<'a> NestedImplTraitVisitor<'a> { - fn with_impl_trait(&mut self, outer_impl_trait: Option, f: F) - where F: FnOnce(&mut NestedImplTraitVisitor<'a>) - { - let old_outer_impl_trait = self.outer_impl_trait; - self.outer_impl_trait = outer_impl_trait; - f(self); - self.outer_impl_trait = old_outer_impl_trait; - } -} - - -impl<'a> Visitor<'a> for NestedImplTraitVisitor<'a> { - fn visit_ty(&mut self, t: &'a Ty) { - if let TyKind::ImplTrait(..) = t.node { - if let Some(outer_impl_trait) = self.outer_impl_trait { - struct_span_err!(self.session, t.span, E0666, - "nested `impl Trait` is not allowed") - .span_label(outer_impl_trait, "outer `impl Trait`") - .span_label(t.span, "nested `impl Trait` here") - .emit(); - - } - self.with_impl_trait(Some(t.span), |this| visit::walk_ty(this, t)); - } else { - visit::walk_ty(self, t); - } - } - fn visit_generic_args(&mut self, _: Span, generic_args: &'a GenericArgs) { - match *generic_args { - GenericArgs::AngleBracketed(ref data) => { - for arg in &data.args { - self.visit_generic_arg(arg) - } - for type_binding in &data.bindings { - // Type bindings such as `Item=impl Debug` in `Iterator` - // are allowed to contain nested `impl Trait`. - self.with_impl_trait(None, |this| visit::walk_ty(this, &type_binding.ty)); - } - } - GenericArgs::Parenthesized(ref data) => { - for type_ in &data.inputs { - self.visit_ty(type_); - } - if let Some(ref type_) = data.output { - // `-> Foo` syntax is essentially an associated type binding, - // so it is also allowed to contain nested `impl Trait`. - self.with_impl_trait(None, |this| visit::walk_ty(this, type_)); - } - } - } - } - - fn visit_mac(&mut self, _mac: &Spanned) { - // covered in AstValidator - } -} - -// Bans `impl Trait` in path projections like `::Item` or `Foo::Bar`. -struct ImplTraitProjectionVisitor<'a> { - session: &'a Session, - is_banned: bool, -} - -impl<'a> ImplTraitProjectionVisitor<'a> { - fn with_ban(&mut self, f: F) - where F: FnOnce(&mut ImplTraitProjectionVisitor<'a>) - { - let old_is_banned = self.is_banned; - self.is_banned = true; - f(self); - self.is_banned = old_is_banned; - } -} - -impl<'a> Visitor<'a> for ImplTraitProjectionVisitor<'a> { - fn visit_ty(&mut self, t: &'a Ty) { - match t.node { - TyKind::ImplTrait(..) => { - if self.is_banned { - struct_span_err!(self.session, t.span, E0667, - "`impl Trait` is not allowed in path parameters").emit(); - } - } - TyKind::Path(ref qself, ref path) => { - // We allow these: - // - `Option` - // - `option::Option` - // - `option::Option::Foo - // - // But not these: - // - `::Foo` - // - `option::Option::Foo`. - // - // To implement this, we disallow `impl Trait` from `qself` - // (for cases like `::Foo>`) - // but we allow `impl Trait` in `GenericArgs` - // iff there are no more PathSegments. - if let Some(ref qself) = *qself { - // `impl Trait` in `qself` is always illegal - self.with_ban(|this| this.visit_ty(&qself.ty)); - } - - for (i, segment) in path.segments.iter().enumerate() { - // Allow `impl Trait` iff we're on the final path segment - if i == path.segments.len() - 1 { - visit::walk_path_segment(self, path.span, segment); - } else { - self.with_ban(|this| - visit::walk_path_segment(this, path.span, segment)); - } - } - } - _ => visit::walk_ty(self, t), - } - } - - fn visit_mac(&mut self, _mac: &Spanned) { - // covered in AstValidator - } -} - -pub fn check_crate(session: &Session, krate: &Crate) { - visit::walk_crate( - &mut NestedImplTraitVisitor { - session, - outer_impl_trait: None, - }, krate); - - visit::walk_crate( - &mut ImplTraitProjectionVisitor { - session, - is_banned: false, - }, krate); - - visit::walk_crate(&mut AstValidator { session }, krate) +pub fn check_crate(session: &Session, krate: &Crate) -> (bool, bool) { + let mut validator = AstValidator { + session, + has_proc_macro_decls: false, + has_global_allocator: false, + outer_impl_trait: None, + is_impl_trait_banned: false, + }; + visit::walk_crate(&mut validator, krate); + + (validator.has_proc_macro_decls, validator.has_global_allocator) } diff --git a/src/librustc_passes/diagnostics.rs b/src/librustc_passes/diagnostics.rs index f1d0a4fee34..037227aeb71 100644 --- a/src/librustc_passes/diagnostics.rs +++ b/src/librustc_passes/diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] register_long_diagnostics! { diff --git a/src/librustc_passes/hir_stats.rs b/src/librustc_passes/hir_stats.rs index 019fb9565f4..74d6d75a7f5 100644 --- a/src/librustc_passes/hir_stats.rs +++ b/src/librustc_passes/hir_stats.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The visitors in this module collect sizes and counts of the most important // pieces of AST and HIR. The resulting numbers are good approximations but not // completely accurate (some things might be counted twice, others missed). @@ -154,7 +144,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_stmt(&mut self, s: &'v hir::Stmt) { - self.record("Stmt", Id::Node(s.node.id()), s); + self.record("Stmt", Id::Node(s.id), s); hir_visit::walk_stmt(self, s) } @@ -168,11 +158,6 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { hir_visit::walk_pat(self, p) } - fn visit_decl(&mut self, d: &'v hir::Decl) { - self.record("Decl", Id::None, d); - hir_visit::walk_decl(self, d) - } - fn visit_expr(&mut self, ex: &'v hir::Expr) { self.record("Expr", Id::Node(ex.id), ex); hir_visit::walk_expr(self, ex) diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs new file mode 100644 index 00000000000..d21707c578b --- /dev/null +++ b/src/librustc_passes/layout_test.rs @@ -0,0 +1,132 @@ +use rustc::hir; +use rustc::hir::def_id::DefId; +use rustc::hir::itemlikevisit::ItemLikeVisitor; +use rustc::hir::ItemKind; +use rustc::ty::layout::HasDataLayout; +use rustc::ty::layout::HasTyCtxt; +use rustc::ty::layout::LayoutOf; +use rustc::ty::layout::TargetDataLayout; +use rustc::ty::layout::TyLayout; +use rustc::ty::ParamEnv; +use rustc::ty::Ty; +use rustc::ty::TyCtxt; +use syntax::ast::Attribute; + +pub fn test_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { + if tcx.features().rustc_attrs { + // if the `rustc_attrs` feature is not enabled, don't bother testing layout + tcx.hir() + .krate() + .visit_all_item_likes(&mut VarianceTest { tcx }); + } +} + +struct VarianceTest<'a, 'tcx: 'a> { + tcx: TyCtxt<'a, 'tcx, 'tcx>, +} + +impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> { + fn visit_item(&mut self, item: &'tcx hir::Item) { + let item_def_id = self.tcx.hir().local_def_id(item.id); + + if let ItemKind::Ty(..) = item.node { + for attr in self.tcx.get_attrs(item_def_id).iter() { + if attr.check_name("rustc_layout") { + self.dump_layout_of(item_def_id, item, attr); + } + } + } + } + + fn visit_trait_item(&mut self, _: &'tcx hir::TraitItem) {} + fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem) {} +} + +impl<'a, 'tcx> VarianceTest<'a, 'tcx> { + fn dump_layout_of(&self, item_def_id: DefId, item: &hir::Item, attr: &Attribute) { + let tcx = self.tcx; + let param_env = self.tcx.param_env(item_def_id); + let ty = self.tcx.type_of(item_def_id); + match self.tcx.layout_of(param_env.and(ty)) { + Ok(ty_layout) => { + // Check out the `#[rustc_layout(..)]` attribute to tell what to dump. + // The `..` are the names of fields to dump. + let meta_items = attr.meta_item_list().unwrap_or_default(); + for meta_item in meta_items { + let name = meta_item.word().map(|mi| mi.name().as_str()); + let name = name.as_ref().map(|s| &s[..]).unwrap_or(""); + + match name { + "abi" => { + self.tcx + .sess + .span_err(item.span, &format!("abi: {:?}", ty_layout.abi)); + } + + "align" => { + self.tcx + .sess + .span_err(item.span, &format!("align: {:?}", ty_layout.align)); + } + + "size" => { + self.tcx + .sess + .span_err(item.span, &format!("size: {:?}", ty_layout.size)); + } + + "homogeneous_aggregate" => { + self.tcx.sess.span_err( + item.span, + &format!( + "homogeneous_aggregate: {:?}", + ty_layout + .homogeneous_aggregate(&UnwrapLayoutCx { tcx, param_env }), + ), + ); + } + + _ => { + self.tcx.sess.span_err( + meta_item.span, + &format!("unrecognized field name `{}`", name), + ); + } + } + } + } + + Err(layout_error) => { + self.tcx + .sess + .span_err(item.span, &format!("layout error: {:?}", layout_error)); + } + } + } +} + +struct UnwrapLayoutCx<'me, 'tcx> { + tcx: TyCtxt<'me, 'tcx, 'tcx>, + param_env: ParamEnv<'tcx>, +} + +impl<'me, 'tcx> LayoutOf for UnwrapLayoutCx<'me, 'tcx> { + type Ty = Ty<'tcx>; + type TyLayout = TyLayout<'tcx>; + + fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout { + self.tcx.layout_of(self.param_env.and(ty)).unwrap() + } +} + +impl<'me, 'tcx> HasTyCtxt<'tcx> for UnwrapLayoutCx<'me, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> { + self.tcx + } +} + +impl<'me, 'tcx> HasDataLayout for UnwrapLayoutCx<'me, 'tcx> { + fn data_layout(&self) -> &TargetDataLayout { + self.tcx.data_layout() + } +} diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs index 42ead92783d..76605c58a78 100644 --- a/src/librustc_passes/lib.rs +++ b/src/librustc_passes/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Various checks //! //! # Note @@ -21,6 +11,8 @@ #![feature(nll)] #![feature(rustc_diagnostic_macros)] +#![recursion_limit="256"] + #[macro_use] extern crate rustc; extern crate rustc_mir; @@ -30,6 +22,7 @@ extern crate rustc_data_structures; extern crate log; #[macro_use] extern crate syntax; +extern crate syntax_ext; extern crate syntax_pos; extern crate rustc_errors as errors; @@ -40,11 +33,12 @@ mod diagnostics; pub mod ast_validation; pub mod rvalue_promotion; pub mod hir_stats; +pub mod layout_test; pub mod loops; -mod mir_stats; __build_diagnostic_array! { librustc_passes, DIAGNOSTICS } pub fn provide(providers: &mut Providers) { rvalue_promotion::provide(providers); + loops::provide(providers); } diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index a87e86aee0c..0dcfc72d10b 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -1,16 +1,11 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. use self::Context::*; use rustc::session::Session; +use rustc::ty::query::Providers; +use rustc::ty::query::queries; +use rustc::ty::TyCtxt; +use rustc::hir::def_id::DefId; use rustc::hir::map::Map; use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; use rustc::hir::{self, Node, Destination}; @@ -51,28 +46,32 @@ struct CheckLoopVisitor<'a, 'hir: 'a> { cx: Context, } -pub fn check_crate(sess: &Session, map: &Map) { - let krate = map.krate(); - krate.visit_all_item_likes(&mut CheckLoopVisitor { - sess, - hir_map: map, +pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { + for &module in tcx.hir().krate().modules.keys() { + queries::check_mod_loops::ensure(tcx, tcx.hir().local_def_id(module)); + } +} + +fn check_mod_loops<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { + tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckLoopVisitor { + sess: &tcx.sess, + hir_map: &tcx.hir(), cx: Normal, }.as_deep_visitor()); } +pub(crate) fn provide(providers: &mut Providers) { + *providers = Providers { + check_mod_loops, + ..*providers + }; +} + impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'hir> { NestedVisitorMap::OnlyBodies(&self.hir_map) } - fn visit_item(&mut self, i: &'hir hir::Item) { - self.with_context(Normal, |v| intravisit::walk_item(v, i)); - } - - fn visit_impl_item(&mut self, i: &'hir hir::ImplItem) { - self.with_context(Normal, |v| intravisit::walk_impl_item(v, i)); - } - fn visit_anon_const(&mut self, c: &'hir hir::AnonConst) { self.with_context(AnonConst, |v| intravisit::walk_anon_const(v, c)); } @@ -141,7 +140,7 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { .span_label(e.span, "can only break with a value inside \ `loop` or breakable block") - .span_suggestion_with_applicability( + .span_suggestion( e.span, &format!( "instead, use `break` on its own \ diff --git a/src/librustc_passes/mir_stats.rs b/src/librustc_passes/mir_stats.rs deleted file mode 100644 index 68840ed4a48..00000000000 --- a/src/librustc_passes/mir_stats.rs +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// The visitors in this module collect sizes and counts of the most important -// pieces of MIR. The resulting numbers are good approximations but not -// completely accurate (some things might be counted twice, others missed). - -use rustc::mir::{AggregateKind, AssertMessage, BasicBlock, BasicBlockData}; -use rustc::mir::{Constant, Location, Local, LocalDecl}; -use rustc::mir::{Place, PlaceElem, PlaceProjection}; -use rustc::mir::{Mir, Operand, ProjectionElem}; -use rustc::mir::{Rvalue, SourceInfo, Statement, StatementKind}; -use rustc::mir::{Terminator, TerminatorKind, SourceScope, SourceScopeData}; -use rustc::mir::interpret::EvalErrorKind; -use rustc::mir::visit as mir_visit; -use rustc::ty::{self, ClosureSubsts, TyCtxt}; -use rustc::util::nodemap::{FxHashMap}; - -struct NodeData { - count: usize, - size: usize, -} - -struct StatCollector<'a, 'tcx: 'a> { - _tcx: TyCtxt<'a, 'tcx, 'tcx>, - data: FxHashMap<&'static str, NodeData>, -} - -impl<'a, 'tcx> StatCollector<'a, 'tcx> { - - fn record_with_size(&mut self, label: &'static str, node_size: usize) { - let entry = self.data.entry(label).or_insert(NodeData { - count: 0, - size: 0, - }); - - entry.count += 1; - entry.size = node_size; - } - - fn record(&mut self, label: &'static str, node: &T) { - self.record_with_size(label, ::std::mem::size_of_val(node)); - } -} - -impl<'a, 'tcx> mir_visit::Visitor<'tcx> for StatCollector<'a, 'tcx> { - fn visit_mir(&mut self, mir: &Mir<'tcx>) { - self.record("Mir", mir); - - // since the `super_mir` method does not traverse the MIR of - // promoted rvalues, (but we still want to gather statistics - // on the structures represented there) we manually traverse - // the promoted rvalues here. - for promoted_mir in &mir.promoted { - self.visit_mir(promoted_mir); - } - - self.super_mir(mir); - } - - fn visit_basic_block_data(&mut self, block: BasicBlock, data: &BasicBlockData<'tcx>) { - self.record("BasicBlockData", data); - self.super_basic_block_data(block, data); - } - - fn visit_source_scope_data(&mut self, scope_data: &SourceScopeData) { - self.record("SourceScopeData", scope_data); - self.super_source_scope_data(scope_data); - } - - fn visit_statement(&mut self, - block: BasicBlock, - statement: &Statement<'tcx>, - location: Location) { - self.record("Statement", statement); - self.record(match statement.kind { - StatementKind::Assign(..) => "StatementKind::Assign", - StatementKind::FakeRead(..) => "StatementKind::FakeRead", - StatementKind::EndRegion(..) => "StatementKind::EndRegion", - StatementKind::Retag { .. } => "StatementKind::Retag", - StatementKind::EscapeToRaw { .. } => "StatementKind::EscapeToRaw", - StatementKind::SetDiscriminant { .. } => "StatementKind::SetDiscriminant", - StatementKind::StorageLive(..) => "StatementKind::StorageLive", - StatementKind::StorageDead(..) => "StatementKind::StorageDead", - StatementKind::InlineAsm { .. } => "StatementKind::InlineAsm", - StatementKind::AscribeUserType(..) => "StatementKind::AscribeUserType", - StatementKind::Nop => "StatementKind::Nop", - }, &statement.kind); - self.super_statement(block, statement, location); - } - - fn visit_terminator(&mut self, - block: BasicBlock, - terminator: &Terminator<'tcx>, - location: Location) { - self.record("Terminator", terminator); - self.super_terminator(block, terminator, location); - } - - fn visit_terminator_kind(&mut self, - block: BasicBlock, - kind: &TerminatorKind<'tcx>, - location: Location) { - self.record("TerminatorKind", kind); - self.record(match *kind { - TerminatorKind::Goto { .. } => "TerminatorKind::Goto", - TerminatorKind::SwitchInt { .. } => "TerminatorKind::SwitchInt", - TerminatorKind::Resume => "TerminatorKind::Resume", - TerminatorKind::Abort => "TerminatorKind::Abort", - TerminatorKind::Return => "TerminatorKind::Return", - TerminatorKind::Unreachable => "TerminatorKind::Unreachable", - TerminatorKind::Drop { .. } => "TerminatorKind::Drop", - TerminatorKind::DropAndReplace { .. } => "TerminatorKind::DropAndReplace", - TerminatorKind::Call { .. } => "TerminatorKind::Call", - TerminatorKind::Assert { .. } => "TerminatorKind::Assert", - TerminatorKind::GeneratorDrop => "TerminatorKind::GeneratorDrop", - TerminatorKind::Yield { .. } => "TerminatorKind::Yield", - TerminatorKind::FalseEdges { .. } => "TerminatorKind::FalseEdges", - TerminatorKind::FalseUnwind { .. } => "TerminatorKind::FalseUnwind", - }, kind); - self.super_terminator_kind(block, kind, location); - } - - fn visit_assert_message(&mut self, msg: &AssertMessage<'tcx>, location: Location) { - self.record("AssertMessage", msg); - self.record(match *msg { - EvalErrorKind::BoundsCheck { .. } => "AssertMessage::BoundsCheck", - EvalErrorKind::Overflow(..) => "AssertMessage::Overflow", - EvalErrorKind::OverflowNeg => "AssertMessage::OverflowNeg", - EvalErrorKind::DivisionByZero => "AssertMessage::DivisionByZero", - EvalErrorKind::RemainderByZero => "AssertMessage::RemainderByZero", - EvalErrorKind::GeneratorResumedAfterReturn => { - "AssertMessage::GeneratorResumedAfterReturn" - } - EvalErrorKind::GeneratorResumedAfterPanic => { - "AssertMessage::GeneratorResumedAfterPanic" - } - _ => bug!(), - }, msg); - self.super_assert_message(msg, location); - } - - fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) { - self.record("Rvalue", rvalue); - let rvalue_kind = match *rvalue { - Rvalue::Use(..) => "Rvalue::Use", - Rvalue::Repeat(..) => "Rvalue::Repeat", - Rvalue::Ref(..) => "Rvalue::Ref", - Rvalue::Len(..) => "Rvalue::Len", - Rvalue::Cast(..) => "Rvalue::Cast", - Rvalue::BinaryOp(..) => "Rvalue::BinaryOp", - Rvalue::CheckedBinaryOp(..) => "Rvalue::CheckedBinaryOp", - Rvalue::UnaryOp(..) => "Rvalue::UnaryOp", - Rvalue::Discriminant(..) => "Rvalue::Discriminant", - Rvalue::NullaryOp(..) => "Rvalue::NullaryOp", - Rvalue::Aggregate(ref kind, ref _operands) => { - // AggregateKind is not distinguished by visit API, so - // record it. (`super_rvalue` handles `_operands`.) - self.record(match **kind { - AggregateKind::Array(_) => "AggregateKind::Array", - AggregateKind::Tuple => "AggregateKind::Tuple", - AggregateKind::Adt(..) => "AggregateKind::Adt", - AggregateKind::Closure(..) => "AggregateKind::Closure", - AggregateKind::Generator(..) => "AggregateKind::Generator", - }, kind); - - "Rvalue::Aggregate" - } - }; - self.record(rvalue_kind, rvalue); - self.super_rvalue(rvalue, location); - } - - fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) { - self.record("Operand", operand); - self.record(match *operand { - Operand::Copy(..) => "Operand::Copy", - Operand::Move(..) => "Operand::Move", - Operand::Constant(..) => "Operand::Constant", - }, operand); - self.super_operand(operand, location); - } - - fn visit_place(&mut self, - place: &Place<'tcx>, - context: mir_visit::PlaceContext<'tcx>, - location: Location) { - self.record("Place", place); - self.record(match *place { - Place::Local(..) => "Place::Local", - Place::Static(..) => "Place::Static", - Place::Promoted(..) => "Place::Promoted", - Place::Projection(..) => "Place::Projection", - }, place); - self.super_place(place, context, location); - } - - fn visit_projection(&mut self, - place: &PlaceProjection<'tcx>, - context: mir_visit::PlaceContext<'tcx>, - location: Location) { - self.record("PlaceProjection", place); - self.super_projection(place, context, location); - } - - fn visit_projection_elem(&mut self, - place: &PlaceElem<'tcx>, - location: Location) { - self.record("PlaceElem", place); - self.record(match *place { - ProjectionElem::Deref => "PlaceElem::Deref", - ProjectionElem::Subslice { .. } => "PlaceElem::Subslice", - ProjectionElem::Field(..) => "PlaceElem::Field", - ProjectionElem::Index(..) => "PlaceElem::Index", - ProjectionElem::ConstantIndex { .. } => "PlaceElem::ConstantIndex", - ProjectionElem::Downcast(..) => "PlaceElem::Downcast", - }, place); - self.super_projection_elem(place, location); - } - - fn visit_constant(&mut self, constant: &Constant<'tcx>, location: Location) { - self.record("Constant", constant); - self.super_constant(constant, location); - } - - fn visit_source_info(&mut self, source_info: &SourceInfo) { - self.record("SourceInfo", source_info); - self.super_source_info(source_info); - } - - fn visit_closure_substs(&mut self, substs: &ClosureSubsts<'tcx>, _: Location) { - self.record("ClosureSubsts", substs); - self.super_closure_substs(substs); - } - - fn visit_const(&mut self, constant: &&'tcx ty::Const<'tcx>, _: Location) { - self.record("Const", constant); - self.super_const(constant); - } - - fn visit_local_decl(&mut self, local: Local, local_decl: &LocalDecl<'tcx>) { - self.record("LocalDecl", local_decl); - self.super_local_decl(local, local_decl); - } - - fn visit_source_scope(&mut self, scope: &SourceScope) { - self.record("VisiblityScope", scope); - self.super_source_scope(scope); - } -} diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 099c6df32ad..c11b1af9776 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Verifies that the types and values of const and static items // are safe. The rules enforced by this module are: // @@ -50,8 +40,8 @@ pub fn provide(providers: &mut Providers) { } pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &body_id in &tcx.hir.krate().body_ids { - let def_id = tcx.hir.body_owner_def_id(body_id); + for &body_id in &tcx.hir().krate().body_ids { + let def_id = tcx.hir().body_owner_def_id(body_id); tcx.const_is_rvalue_promotable_to_static(def_id); } tcx.sess.abort_if_errors(); @@ -63,10 +53,10 @@ fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, { assert!(def_id.is_local()); - let node_id = tcx.hir.as_local_node_id(def_id) + let node_id = tcx.hir().as_local_node_id(def_id) .expect("rvalue_promotable_map invoked with non-local def-id"); - let body_id = tcx.hir.body_owned_by(node_id); - let body_hir_id = tcx.hir.node_to_hir_id(body_id.node_id); + let body_id = tcx.hir().body_owned_by(node_id); + let body_hir_id = tcx.hir().node_to_hir_id(body_id.node_id); tcx.rvalue_promotable_map(def_id).contains(&body_hir_id.local_id) } @@ -91,9 +81,9 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }; // `def_id` should be a `Body` owner - let node_id = tcx.hir.as_local_node_id(def_id) + let node_id = tcx.hir().as_local_node_id(def_id) .expect("rvalue_promotable_map invoked with non-local def-id"); - let body_id = tcx.hir.body_owned_by(node_id); + let body_id = tcx.hir().body_owned_by(node_id); let _ = visitor.check_nested_body(body_id); Lrc::new(visitor.result) @@ -189,8 +179,8 @@ impl<'a, 'gcx> CheckCrateVisitor<'a, 'gcx> { impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { fn check_nested_body(&mut self, body_id: hir::BodyId) -> Promotability { - let item_id = self.tcx.hir.body_owner(body_id); - let item_def_id = self.tcx.hir.local_def_id(item_id); + let item_id = self.tcx.hir().body_owner(body_id); + let item_def_id = self.tcx.hir().local_def_id(item_id); let outer_in_fn = self.in_fn; let outer_tables = self.tables; @@ -200,7 +190,8 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { self.in_fn = false; self.in_static = false; - match self.tcx.hir.body_owner_kind(item_id) { + match self.tcx.hir().body_owner_kind(item_id) { + hir::BodyOwnerKind::Closure | hir::BodyOwnerKind::Fn => self.in_fn = true, hir::BodyOwnerKind::Static(_) => self.in_static = true, _ => {} @@ -211,7 +202,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { self.param_env = self.tcx.param_env(item_def_id); self.identity_substs = Substs::identity_for_item(self.tcx, item_def_id); - let body = self.tcx.hir.body(body_id); + let body = self.tcx.hir().body(body_id); let tcx = self.tcx; let param_env = self.param_env; @@ -230,26 +221,22 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { fn check_stmt(&mut self, stmt: &'tcx hir::Stmt) -> Promotability { match stmt.node { - hir::StmtKind::Decl(ref decl, _node_id) => { - match &decl.node { - hir::DeclKind::Local(local) => { - if self.remove_mut_rvalue_borrow(&local.pat) { - if let Some(init) = &local.init { - self.mut_rvalue_borrows.insert(init.id); - } - } - - if let Some(ref expr) = local.init { - let _ = self.check_expr(&expr); - } - NotPromotable + hir::StmtKind::Local(ref local) => { + if self.remove_mut_rvalue_borrow(&local.pat) { + if let Some(init) = &local.init { + self.mut_rvalue_borrows.insert(init.id); } - // Item statements are allowed - hir::DeclKind::Item(_) => Promotable } + + if let Some(ref expr) = local.init { + let _ = self.check_expr(&expr); + } + NotPromotable } - hir::StmtKind::Expr(ref box_expr, _node_id) | - hir::StmtKind::Semi(ref box_expr, _node_id) => { + // Item statements are allowed + hir::StmtKind::Item(..) => Promotable, + hir::StmtKind::Expr(ref box_expr) | + hir::StmtKind::Semi(ref box_expr) => { let _ = self.check_expr(box_expr); NotPromotable } @@ -383,7 +370,7 @@ fn check_expr_kind<'a, 'tcx>( NotPromotable }; // Just in case the type is more specific than the definition, - // e.g. impl associated const with type parameters, check it. + // e.g., impl associated const with type parameters, check it. // Also, trait associated consts are relaxed by this. promotable | v.type_promotability(node_ty) } @@ -459,7 +446,8 @@ fn check_expr_kind<'a, 'tcx>( struct_result } - hir::ExprKind::Lit(_) => Promotable, + hir::ExprKind::Lit(_) | + hir::ExprKind::Err => Promotable, hir::ExprKind::AddrOf(_, ref expr) | hir::ExprKind::Repeat(ref expr, _) => { diff --git a/src/librustc_platform_intrinsics/Cargo.toml b/src/librustc_platform_intrinsics/Cargo.toml deleted file mode 100644 index 92f37f974ef..00000000000 --- a/src/librustc_platform_intrinsics/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -authors = ["The Rust Project Developers"] -name = "rustc_platform_intrinsics" -version = "0.0.0" - -[lib] -name = "rustc_platform_intrinsics" -path = "lib.rs" -crate-type = ["dylib"] diff --git a/src/librustc_platform_intrinsics/aarch64.rs b/src/librustc_platform_intrinsics/aarch64.rs deleted file mode 100644 index 14925cd6d4d..00000000000 --- a/src/librustc_platform_intrinsics/aarch64.rs +++ /dev/null @@ -1,3414 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// DO NOT EDIT: autogenerated by etc/platform-intrinsics/generator.py -// ignore-tidy-linelength - -#![allow(unused_imports)] - -use {Intrinsic, Type}; -use IntrinsicDef::Named; - -pub fn find(name: &str) -> Option { - if !name.starts_with("aarch64_v") { return None } - Some(match &name["aarch64_v".len()..] { - "hadd_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.shadd.v8i8") - }, - "hadd_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.uhadd.v8i8") - }, - "hadd_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.shadd.v4i16") - }, - "hadd_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.uhadd.v4i16") - }, - "hadd_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.shadd.v2i32") - }, - "hadd_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.uhadd.v2i32") - }, - "haddq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.shadd.v16i8") - }, - "haddq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.uhadd.v16i8") - }, - "haddq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.shadd.v8i16") - }, - "haddq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.uhadd.v8i16") - }, - "haddq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.shadd.v4i32") - }, - "haddq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.uhadd.v4i32") - }, - "rhadd_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.srhadd.v8i8") - }, - "rhadd_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.urhadd.v8i8") - }, - "rhadd_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.srhadd.v4i16") - }, - "rhadd_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.urhadd.v4i16") - }, - "rhadd_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.srhadd.v2i32") - }, - "rhadd_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.urhadd.v2i32") - }, - "rhaddq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.srhadd.v16i8") - }, - "rhaddq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.urhadd.v16i8") - }, - "rhaddq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.srhadd.v8i16") - }, - "rhaddq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.urhadd.v8i16") - }, - "rhaddq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.srhadd.v4i32") - }, - "rhaddq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.urhadd.v4i32") - }, - "qadd_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sqadd.v8i8") - }, - "qadd_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.uqadd.v8i8") - }, - "qadd_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqadd.v4i16") - }, - "qadd_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.uqadd.v4i16") - }, - "qadd_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqadd.v2i32") - }, - "qadd_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.uqadd.v2i32") - }, - "qadd_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.aarch64.neon.sqadd.v1i64") - }, - "qadd_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::U64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.aarch64.neon.uqadd.v1i64") - }, - "qaddq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.sqadd.v16i8") - }, - "qaddq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.uqadd.v16i8") - }, - "qaddq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.sqadd.v8i16") - }, - "qaddq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.uqadd.v8i16") - }, - "qaddq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.sqadd.v4i32") - }, - "qaddq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.uqadd.v4i32") - }, - "qaddq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.sqadd.v2i64") - }, - "qaddq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.uqadd.v2i64") - }, - "uqadd_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::U8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.suqadd.v16i8") - }, - "uqadd_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::U16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.suqadd.v8i16") - }, - "uqadd_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::U32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.suqadd.v4i32") - }, - "uqadd_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::U64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.suqadd.v2i64") - }, - "sqadd_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::I8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.usqadd.v16i8") - }, - "sqadd_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::I16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.usqadd.v8i16") - }, - "sqadd_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::I32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.usqadd.v4i32") - }, - "sqadd_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::I64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.usqadd.v2i64") - }, - "raddhn_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.raddhn.v8i8") - }, - "raddhn_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.raddhn.v8i8") - }, - "raddhn_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.raddhn.v4i16") - }, - "raddhn_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.raddhn.v4i16") - }, - "raddhn_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.raddhn.v2i32") - }, - "raddhn_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.raddhn.v2i32") - }, - "fmulx_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.fmulx.v2f32") - }, - "fmulx_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x1, &::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.aarch64.neon.fmulx.v1f64") - }, - "fmulxq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.fmulx.v4f32") - }, - "fmulxq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.fmulx.v2f64") - }, - "fma_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.fma.v2f32") - }, - "fma_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x1, &::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.fma.v1f64") - }, - "fmaq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.fma.v4f32") - }, - "fmaq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.fma.v2f64") - }, - "qdmulh_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqdmulh.v4i16") - }, - "qdmulh_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqdmulh.v2i32") - }, - "qdmulhq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.sqdmulh.v8i16") - }, - "qdmulhq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.sqdmulh.v4i32") - }, - "qrdmulh_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqrdmulh.v4i16") - }, - "qrdmulh_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqrdmulh.v2i32") - }, - "qrdmulhq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.sqrdmulh.v8i16") - }, - "qrdmulhq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.sqrdmulh.v4i32") - }, - "mull_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.smull.v8i16") - }, - "mull_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.umull.v8i16") - }, - "mull_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.smull.v4i32") - }, - "mull_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.umull.v4i32") - }, - "mull_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.smull.v2i64") - }, - "mull_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.umull.v2i64") - }, - "qdmullq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.sqdmull.v8i16") - }, - "qdmullq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.sqdmull.v4i32") - }, - "hsub_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.shsub.v8i8") - }, - "hsub_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.uhsub.v8i8") - }, - "hsub_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.shsub.v4i16") - }, - "hsub_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.uhsub.v4i16") - }, - "hsub_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.shsub.v2i32") - }, - "hsub_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.uhsub.v2i32") - }, - "hsubq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.shsub.v16i8") - }, - "hsubq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.uhsub.v16i8") - }, - "hsubq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.shsub.v8i16") - }, - "hsubq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.uhsub.v8i16") - }, - "hsubq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.shsub.v4i32") - }, - "hsubq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.uhsub.v4i32") - }, - "qsub_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sqsub.v8i8") - }, - "qsub_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.uqsub.v8i8") - }, - "qsub_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqsub.v4i16") - }, - "qsub_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.uqsub.v4i16") - }, - "qsub_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqsub.v2i32") - }, - "qsub_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.uqsub.v2i32") - }, - "qsub_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.aarch64.neon.sqsub.v1i64") - }, - "qsub_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::U64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.aarch64.neon.uqsub.v1i64") - }, - "qsubq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.sqsub.v16i8") - }, - "qsubq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.uqsub.v16i8") - }, - "qsubq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.sqsub.v8i16") - }, - "qsubq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.uqsub.v8i16") - }, - "qsubq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.sqsub.v4i32") - }, - "qsubq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.uqsub.v4i32") - }, - "qsubq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.sqsub.v2i64") - }, - "qsubq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.uqsub.v2i64") - }, - "rsubhn_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.rsubhn.v8i8") - }, - "rsubhn_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.rsubhn.v8i8") - }, - "rsubhn_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.rsubhn.v4i16") - }, - "rsubhn_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.rsubhn.v4i16") - }, - "rsubhn_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.rsubhn.v2i32") - }, - "rsubhn_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.rsubhn.v2i32") - }, - "abd_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sabd.v8i8") - }, - "abd_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.uabd.v8i8") - }, - "abd_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sabd.v4i16") - }, - "abd_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.uabd.v4i16") - }, - "abd_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sabd.v2i32") - }, - "abd_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.uabd.v2i32") - }, - "abd_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.fabd.v2f32") - }, - "abd_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x1, &::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.aarch64.neon.fabd.v1f64") - }, - "abdq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.sabd.v16i8") - }, - "abdq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.uabd.v16i8") - }, - "abdq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.sabd.v8i16") - }, - "abdq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.uabd.v8i16") - }, - "abdq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.sabd.v4i32") - }, - "abdq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.uabd.v4i32") - }, - "abdq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.fabd.v4f32") - }, - "abdq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.fabd.v2f64") - }, - "max_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.smax.v8i8") - }, - "max_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.umax.v8i8") - }, - "max_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.smax.v4i16") - }, - "max_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.umax.v4i16") - }, - "max_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.smax.v2i32") - }, - "max_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.umax.v2i32") - }, - "max_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.fmax.v2f32") - }, - "max_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x1, &::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.aarch64.neon.fmax.v1f64") - }, - "maxq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.smax.v16i8") - }, - "maxq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.umax.v16i8") - }, - "maxq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.smax.v8i16") - }, - "maxq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.umax.v8i16") - }, - "maxq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.smax.v4i32") - }, - "maxq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.umax.v4i32") - }, - "maxq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.fmax.v4f32") - }, - "maxq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.fmax.v2f64") - }, - "min_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.smin.v8i8") - }, - "min_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.umin.v8i8") - }, - "min_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.smin.v4i16") - }, - "min_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.umin.v4i16") - }, - "min_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.smin.v2i32") - }, - "min_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.umin.v2i32") - }, - "min_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.fmin.v2f32") - }, - "min_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x1, &::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.aarch64.neon.fmin.v1f64") - }, - "minq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.smin.v16i8") - }, - "minq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.umin.v16i8") - }, - "minq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.smin.v8i16") - }, - "minq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.umin.v8i16") - }, - "minq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.smin.v4i32") - }, - "minq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.umin.v4i32") - }, - "minq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.fmin.v4f32") - }, - "minq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.fmin.v2f64") - }, - "maxnm_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.fmaxnm.v2f32") - }, - "maxnm_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x1, &::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.aarch64.neon.fmaxnm.v1f64") - }, - "maxnmq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.fmaxnm.v4f32") - }, - "maxnmq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.fmaxnm.v2f64") - }, - "minnm_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.fminnm.v2f32") - }, - "minnm_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x1, &::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.aarch64.neon.fminnm.v1f64") - }, - "minnmq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.fminnm.v4f32") - }, - "minnmq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.fminnm.v2f64") - }, - "shl_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sshl.v8i8") - }, - "shl_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::I8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.ushl.v8i8") - }, - "shl_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sshl.v4i16") - }, - "shl_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::I16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.ushl.v4i16") - }, - "shl_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sshl.v2i32") - }, - "shl_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::I32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.ushl.v2i32") - }, - "shl_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.aarch64.neon.sshl.v1i64") - }, - "shl_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::I64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.aarch64.neon.ushl.v1i64") - }, - "shlq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.sshl.v16i8") - }, - "shlq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::I8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.ushl.v16i8") - }, - "shlq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.sshl.v8i16") - }, - "shlq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::I16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.ushl.v8i16") - }, - "shlq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.sshl.v4i32") - }, - "shlq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::I32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.ushl.v4i32") - }, - "shlq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.sshl.v2i64") - }, - "shlq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::I64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.ushl.v2i64") - }, - "qshl_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sqshl.v8i8") - }, - "qshl_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::I8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.uqshl.v8i8") - }, - "qshl_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqshl.v4i16") - }, - "qshl_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::I16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.uqshl.v4i16") - }, - "qshl_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqshl.v2i32") - }, - "qshl_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::I32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.uqshl.v2i32") - }, - "qshl_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.aarch64.neon.sqshl.v1i64") - }, - "qshl_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::I64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.aarch64.neon.uqshl.v1i64") - }, - "qshlq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.sqshl.v16i8") - }, - "qshlq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::I8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.uqshl.v16i8") - }, - "qshlq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.sqshl.v8i16") - }, - "qshlq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::I16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.uqshl.v8i16") - }, - "qshlq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.sqshl.v4i32") - }, - "qshlq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::I32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.uqshl.v4i32") - }, - "qshlq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.sqshl.v2i64") - }, - "qshlq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::I64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.uqshl.v2i64") - }, - "rshl_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.srshl.v8i8") - }, - "rshl_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::I8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.urshl.v8i8") - }, - "rshl_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.srshl.v4i16") - }, - "rshl_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::I16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.urshl.v4i16") - }, - "rshl_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.srshl.v2i32") - }, - "rshl_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::I32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.urshl.v2i32") - }, - "rshl_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.aarch64.neon.srshl.v1i64") - }, - "rshl_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::I64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.aarch64.neon.urshl.v1i64") - }, - "rshlq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.srshl.v16i8") - }, - "rshlq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::I8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.urshl.v16i8") - }, - "rshlq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.srshl.v8i16") - }, - "rshlq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::I16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.urshl.v8i16") - }, - "rshlq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.srshl.v4i32") - }, - "rshlq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::I32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.urshl.v4i32") - }, - "rshlq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.srshl.v2i64") - }, - "rshlq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::I64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.urshl.v2i64") - }, - "qrshl_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sqrshl.v8i8") - }, - "qrshl_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::I8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.uqrshl.v8i8") - }, - "qrshl_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqrshl.v4i16") - }, - "qrshl_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::I16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.uqrshl.v4i16") - }, - "qrshl_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqrshl.v2i32") - }, - "qrshl_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::I32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.uqrshl.v2i32") - }, - "qrshl_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.aarch64.neon.sqrshl.v1i64") - }, - "qrshl_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::I64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.aarch64.neon.uqrshl.v1i64") - }, - "qrshlq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.sqrshl.v16i8") - }, - "qrshlq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::I8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.uqrshl.v16i8") - }, - "qrshlq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.sqrshl.v8i16") - }, - "qrshlq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::I16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.uqrshl.v8i16") - }, - "qrshlq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.sqrshl.v4i32") - }, - "qrshlq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::I32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.uqrshl.v4i32") - }, - "qrshlq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.sqrshl.v2i64") - }, - "qrshlq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::I64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.uqrshl.v2i64") - }, - "qshrun_n_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::U32]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sqshrun.v8i8") - }, - "qshrun_n_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::U32]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqshrun.v4i16") - }, - "qshrun_n_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::U32]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqshrun.v2i32") - }, - "qrshrun_n_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::U32]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sqrshrun.v8i8") - }, - "qrshrun_n_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::U32]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqrshrun.v4i16") - }, - "qrshrun_n_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::U32]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqrshrun.v2i32") - }, - "qshrn_n_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::U32]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sqshrn.v8i8") - }, - "qshrn_n_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U32]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.uqshrn.v8i8") - }, - "qshrn_n_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::U32]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqshrn.v4i16") - }, - "qshrn_n_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.uqshrn.v4i16") - }, - "qshrn_n_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::U32]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqshrn.v2i32") - }, - "qshrn_n_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.uqshrn.v2i32") - }, - "rshrn_n_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::U32]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.rshrn.v8i8") - }, - "rshrn_n_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U32]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.rshrn.v8i8") - }, - "rshrn_n_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::U32]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.rshrn.v4i16") - }, - "rshrn_n_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.rshrn.v4i16") - }, - "rshrn_n_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::U32]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.rshrn.v2i32") - }, - "rshrn_n_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.rshrn.v2i32") - }, - "qrshrn_n_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::U32]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sqrshrn.v8i8") - }, - "qrshrn_n_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U32]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.uqrshrn.v8i8") - }, - "qrshrn_n_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::U32]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqrshrn.v4i16") - }, - "qrshrn_n_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.uqrshrn.v4i16") - }, - "qrshrn_n_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::U32]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqrshrn.v2i32") - }, - "qrshrn_n_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.uqrshrn.v2i32") - }, - "sri_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.vsri.v8i8") - }, - "sri_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.vsri.v8i8") - }, - "sri_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.vsri.v4i16") - }, - "sri_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.vsri.v4i16") - }, - "sri_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.vsri.v2i32") - }, - "sri_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.vsri.v2i32") - }, - "sri_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.aarch64.neon.vsri.v1i64") - }, - "sri_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::U64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.aarch64.neon.vsri.v1i64") - }, - "sriq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.vsri.v16i8") - }, - "sriq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.vsri.v16i8") - }, - "sriq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.vsri.v8i16") - }, - "sriq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.vsri.v8i16") - }, - "sriq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.vsri.v4i32") - }, - "sriq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.vsri.v4i32") - }, - "sriq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.vsri.v2i64") - }, - "sriq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.vsri.v2i64") - }, - "sli_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.vsli.v8i8") - }, - "sli_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.vsli.v8i8") - }, - "sli_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.vsli.v4i16") - }, - "sli_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.vsli.v4i16") - }, - "sli_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.vsli.v2i32") - }, - "sli_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.vsli.v2i32") - }, - "sli_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.aarch64.neon.vsli.v1i64") - }, - "sli_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::U64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.aarch64.neon.vsli.v1i64") - }, - "sliq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.vsli.v16i8") - }, - "sliq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.vsli.v16i8") - }, - "sliq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.vsli.v8i16") - }, - "sliq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.vsli.v8i16") - }, - "sliq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.vsli.v4i32") - }, - "sliq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.vsli.v4i32") - }, - "sliq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.vsli.v2i64") - }, - "sliq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.vsli.v2i64") - }, - "vqmovn_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sqxtn.v8i8") - }, - "vqmovn_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.uqxtn.v8i8") - }, - "vqmovn_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqxtn.v4i16") - }, - "vqmovn_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.uqxtn.v4i16") - }, - "vqmovn_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I64x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqxtn.v2i32") - }, - "vqmovn_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U64x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.uqxtn.v2i32") - }, - "abs_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.abs.v8i8") - }, - "abs_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.abs.v4i16") - }, - "abs_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.abs.v2i32") - }, - "abs_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.aarch64.neon.abs.v1i64") - }, - "absq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.abs.v16i8") - }, - "absq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.abs.v8i16") - }, - "absq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.abs.v4i32") - }, - "absq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.abs.v2i64") - }, - "abs_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.fabs.v2f32") - }, - "abs_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.fabs.v1f64") - }, - "absq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.fabs.v4f32") - }, - "absq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.fabs.v2f64") - }, - "qabs_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sqabs.v8i8") - }, - "qabs_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqabs.v4i16") - }, - "qabs_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqabs.v2i32") - }, - "qabs_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.aarch64.neon.sqabs.v1i64") - }, - "qabsq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.sqabs.v16i8") - }, - "qabsq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.sqabs.v8i16") - }, - "qabsq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.sqabs.v4i32") - }, - "qabsq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.sqabs.v2i64") - }, - "qneg_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sqneg.v8i8") - }, - "qneg_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sqneg.v4i16") - }, - "qneg_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sqneg.v2i32") - }, - "qneg_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.aarch64.neon.sqneg.v1i64") - }, - "qnegq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.sqneg.v16i8") - }, - "qnegq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.sqneg.v8i16") - }, - "qnegq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.sqneg.v4i32") - }, - "qnegq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.sqneg.v2i64") - }, - "clz_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.ctlz.v8i8") - }, - "clz_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.ctlz.v8i8") - }, - "clz_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.ctlz.v4i16") - }, - "clz_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.ctlz.v4i16") - }, - "clz_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.ctlz.v2i32") - }, - "clz_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.ctlz.v2i32") - }, - "clzq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ctlz.v16i8") - }, - "clzq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.ctlz.v16i8") - }, - "clzq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ctlz.v8i16") - }, - "clzq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.ctlz.v8i16") - }, - "clzq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ctlz.v4i32") - }, - "clzq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ctlz.v4i32") - }, - "cls_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.cls.v8i8") - }, - "cls_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.cls.v8i8") - }, - "cls_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.cls.v4i16") - }, - "cls_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.cls.v4i16") - }, - "cls_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.cls.v2i32") - }, - "cls_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.cls.v2i32") - }, - "clsq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.cls.v16i8") - }, - "clsq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.cls.v16i8") - }, - "clsq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.cls.v8i16") - }, - "clsq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.cls.v8i16") - }, - "clsq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.cls.v4i32") - }, - "clsq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.cls.v4i32") - }, - "cnt_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.ctpop.v8i8") - }, - "cnt_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.ctpop.v8i8") - }, - "cntq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ctpop.v16i8") - }, - "cntq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.ctpop.v16i8") - }, - "recpe_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.urecpe.v2i32") - }, - "recpe_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.frecpe.v2f32") - }, - "recpe_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.aarch64.neon.frecpe.v1f64") - }, - "recpeq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.urecpe.v4i32") - }, - "recpeq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.frecpe.v4f32") - }, - "recpeq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.frecpe.v2f64") - }, - "recps_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.frecps.v2f32") - }, - "recps_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x1, &::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.aarch64.neon.frecps.v1f64") - }, - "recpsq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.frecps.v4f32") - }, - "recpsq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.frecps.v2f64") - }, - "sqrt_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.sqrt.v2f32") - }, - "sqrt_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.sqrt.v1f64") - }, - "sqrtq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.sqrt.v4f32") - }, - "sqrtq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.sqrt.v2f64") - }, - "rsqrte_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.ursqrte.v2i32") - }, - "rsqrte_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.frsqrte.v2f32") - }, - "rsqrte_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.aarch64.neon.frsqrte.v1f64") - }, - "rsqrteq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.ursqrte.v4i32") - }, - "rsqrteq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.frsqrte.v4f32") - }, - "rsqrteq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.frsqrte.v2f64") - }, - "rsqrts_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.frsqrts.v2f32") - }, - "rsqrts_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x1, &::F64x1]; &INPUTS }, - output: &::F64x1, - definition: Named("llvm.aarch64.neon.frsqrts.v1f64") - }, - "rsqrtsq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.frsqrts.v4f32") - }, - "rsqrtsq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.frsqrts.v2f64") - }, - "rbit_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.rbit.v8i8") - }, - "rbit_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.rbit.v8i8") - }, - "rbitq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.rbit.v16i8") - }, - "rbitq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.rbit.v16i8") - }, - "ld2_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, Some(&::I8x8), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v8i8.p0v8i8") - }, - "ld2_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8, Some(&::U8x8), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v8i8.p0v8i8") - }, - "ld2_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I16, Some(&::I16x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v4i16.p0v4i16") - }, - "ld2_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U16, Some(&::U16x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v4i16.p0v4i16") - }, - "ld2_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I32, Some(&::I32x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v2i32.p0v2i32") - }, - "ld2_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U32, Some(&::U32x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v2i32.p0v2i32") - }, - "ld2_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I64, Some(&::I64x1), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v1i64.p0v1i64") - }, - "ld2_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U64, Some(&::U64x1), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U64x1, &::U64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v1i64.p0v1i64") - }, - "ld2_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F32, Some(&::F32x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v2f32.p0v2f32") - }, - "ld2_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F64, Some(&::F64x1), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::F64x1, &::F64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v1f64.p0v1f64") - }, - "ld2q_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, Some(&::I8x16), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v16i8.p0v16i8") - }, - "ld2q_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8, Some(&::U8x16), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v16i8.p0v16i8") - }, - "ld2q_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I16, Some(&::I16x8), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v8i16.p0v8i16") - }, - "ld2q_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U16, Some(&::U16x8), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v8i16.p0v8i16") - }, - "ld2q_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I32, Some(&::I32x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v4i32.p0v4i32") - }, - "ld2q_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U32, Some(&::U32x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v4i32.p0v4i32") - }, - "ld2q_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I64, Some(&::I64x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v2i64.p0v2i64") - }, - "ld2q_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U64, Some(&::U64x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v2i64.p0v2i64") - }, - "ld2q_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F32, Some(&::F32x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v4f32.p0v4f32") - }, - "ld2q_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F64, Some(&::F64x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v2f64.p0v2f64") - }, - "ld3_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, Some(&::I8x8), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I8x8, &::I8x8, &::I8x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v8i8.p0v8i8") - }, - "ld3_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8, Some(&::U8x8), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U8x8, &::U8x8, &::U8x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v8i8.p0v8i8") - }, - "ld3_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I16, Some(&::I16x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I16x4, &::I16x4, &::I16x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v4i16.p0v4i16") - }, - "ld3_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U16, Some(&::U16x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U16x4, &::U16x4, &::U16x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v4i16.p0v4i16") - }, - "ld3_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I32, Some(&::I32x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I32x2, &::I32x2, &::I32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v2i32.p0v2i32") - }, - "ld3_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U32, Some(&::U32x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U32x2, &::U32x2, &::U32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v2i32.p0v2i32") - }, - "ld3_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I64, Some(&::I64x1), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I64x1, &::I64x1, &::I64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v1i64.p0v1i64") - }, - "ld3_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U64, Some(&::U64x1), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U64x1, &::U64x1, &::U64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v1i64.p0v1i64") - }, - "ld3_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F32, Some(&::F32x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::F32x2, &::F32x2, &::F32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v2f32.p0v2f32") - }, - "ld3_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F64, Some(&::F64x1), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::F64x1, &::F64x1, &::F64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v1f64.p0v1f64") - }, - "ld3q_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, Some(&::I8x16), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I8x16]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v16i8.p0v16i8") - }, - "ld3q_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8, Some(&::U8x16), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U8x16, &::U8x16, &::U8x16]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v16i8.p0v16i8") - }, - "ld3q_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I16, Some(&::I16x8), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I16x8, &::I16x8, &::I16x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v8i16.p0v8i16") - }, - "ld3q_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U16, Some(&::U16x8), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U16x8, &::U16x8, &::U16x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v8i16.p0v8i16") - }, - "ld3q_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I32, Some(&::I32x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I32x4, &::I32x4, &::I32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v4i32.p0v4i32") - }, - "ld3q_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U32, Some(&::U32x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U32x4, &::U32x4, &::U32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v4i32.p0v4i32") - }, - "ld3q_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I64, Some(&::I64x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I64x2, &::I64x2, &::I64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v2i64.p0v2i64") - }, - "ld3q_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U64, Some(&::U64x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U64x2, &::U64x2, &::U64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v2i64.p0v2i64") - }, - "ld3q_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F32, Some(&::F32x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::F32x4, &::F32x4, &::F32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v4f32.p0v4f32") - }, - "ld3q_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F64, Some(&::F64x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::F64x2, &::F64x2, &::F64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v2f64.p0v2f64") - }, - "ld4_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, Some(&::I8x8), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I8x8, &::I8x8, &::I8x8, &::I8x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v8i8.p0v8i8") - }, - "ld4_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8, Some(&::U8x8), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U8x8, &::U8x8, &::U8x8, &::U8x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v8i8.p0v8i8") - }, - "ld4_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I16, Some(&::I16x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I16x4, &::I16x4, &::I16x4, &::I16x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v4i16.p0v4i16") - }, - "ld4_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U16, Some(&::U16x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U16x4, &::U16x4, &::U16x4, &::U16x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v4i16.p0v4i16") - }, - "ld4_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I32, Some(&::I32x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I32x2, &::I32x2, &::I32x2, &::I32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v2i32.p0v2i32") - }, - "ld4_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U32, Some(&::U32x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U32x2, &::U32x2, &::U32x2, &::U32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v2i32.p0v2i32") - }, - "ld4_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I64, Some(&::I64x1), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I64x1, &::I64x1, &::I64x1, &::I64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v1i64.p0v1i64") - }, - "ld4_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U64, Some(&::U64x1), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U64x1, &::U64x1, &::U64x1, &::U64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v1i64.p0v1i64") - }, - "ld4_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F32, Some(&::F32x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::F32x2, &::F32x2, &::F32x2, &::F32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v2f32.p0v2f32") - }, - "ld4_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F64, Some(&::F64x1), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::F64x1, &::F64x1, &::F64x1, &::F64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v1f64.p0v1f64") - }, - "ld4q_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, Some(&::I8x16), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I8x16, &::I8x16, &::I8x16, &::I8x16]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v16i8.p0v16i8") - }, - "ld4q_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8, Some(&::U8x16), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U8x16, &::U8x16, &::U8x16, &::U8x16]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v16i8.p0v16i8") - }, - "ld4q_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I16, Some(&::I16x8), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I16x8, &::I16x8, &::I16x8, &::I16x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v8i16.p0v8i16") - }, - "ld4q_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U16, Some(&::U16x8), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U16x8, &::U16x8, &::U16x8, &::U16x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v8i16.p0v8i16") - }, - "ld4q_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I32, Some(&::I32x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I32x4, &::I32x4, &::I32x4, &::I32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v4i32.p0v4i32") - }, - "ld4q_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U32, Some(&::U32x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U32x4, &::U32x4, &::U32x4, &::U32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v4i32.p0v4i32") - }, - "ld4q_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I64, Some(&::I64x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I64x2, &::I64x2, &::I64x2, &::I64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v2i64.p0v2i64") - }, - "ld4q_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U64, Some(&::U64x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U64x2, &::U64x2, &::U64x2, &::U64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v2i64.p0v2i64") - }, - "ld4q_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F32, Some(&::F32x4), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::F32x4, &::F32x4, &::F32x4, &::F32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v4f32.p0v4f32") - }, - "ld4q_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F64, Some(&::F64x2), true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::F64x2, &::F64x2, &::F64x2, &::F64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v2f64.p0v2f64") - }, - "ld2_dup_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v8i8.p0i8") - }, - "ld2_dup_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v8i8.p0i8") - }, - "ld2_dup_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I16, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v4i16.p0i16") - }, - "ld2_dup_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U16, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v4i16.p0i16") - }, - "ld2_dup_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v2i32.p0i32") - }, - "ld2_dup_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v2i32.p0i32") - }, - "ld2_dup_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v1i64.p0i64") - }, - "ld2_dup_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U64x1, &::U64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v1i64.p0i64") - }, - "ld2_dup_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v2f32.p0f32") - }, - "ld2_dup_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::F64x1, &::F64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v1f64.p0f64") - }, - "ld2q_dup_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v16i8.p0i8") - }, - "ld2q_dup_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v16i8.p0i8") - }, - "ld2q_dup_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I16, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v8i16.p0i16") - }, - "ld2q_dup_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U16, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v8i16.p0i16") - }, - "ld2q_dup_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v4i32.p0i32") - }, - "ld2q_dup_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v4i32.p0i32") - }, - "ld2q_dup_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v2i64.p0i64") - }, - "ld2q_dup_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v2i64.p0i64") - }, - "ld2q_dup_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v4f32.p0f32") - }, - "ld2q_dup_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld2.v2f64.p0f64") - }, - "ld3_dup_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I8x8, &::I8x8, &::I8x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v8i8.p0i8") - }, - "ld3_dup_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U8x8, &::U8x8, &::U8x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v8i8.p0i8") - }, - "ld3_dup_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I16, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I16x4, &::I16x4, &::I16x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v4i16.p0i16") - }, - "ld3_dup_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U16, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U16x4, &::U16x4, &::U16x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v4i16.p0i16") - }, - "ld3_dup_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I32x2, &::I32x2, &::I32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v2i32.p0i32") - }, - "ld3_dup_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U32x2, &::U32x2, &::U32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v2i32.p0i32") - }, - "ld3_dup_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I64x1, &::I64x1, &::I64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v1i64.p0i64") - }, - "ld3_dup_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U64x1, &::U64x1, &::U64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v1i64.p0i64") - }, - "ld3_dup_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::F32x2, &::F32x2, &::F32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v2f32.p0f32") - }, - "ld3_dup_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::F64x1, &::F64x1, &::F64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v1f64.p0f64") - }, - "ld3q_dup_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I8x16]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v16i8.p0i8") - }, - "ld3q_dup_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U8x16, &::U8x16, &::U8x16]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v16i8.p0i8") - }, - "ld3q_dup_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I16, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I16x8, &::I16x8, &::I16x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v8i16.p0i16") - }, - "ld3q_dup_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U16, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U16x8, &::U16x8, &::U16x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v8i16.p0i16") - }, - "ld3q_dup_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I32x4, &::I32x4, &::I32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v4i32.p0i32") - }, - "ld3q_dup_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U32x4, &::U32x4, &::U32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v4i32.p0i32") - }, - "ld3q_dup_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::I64x2, &::I64x2, &::I64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v2i64.p0i64") - }, - "ld3q_dup_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::U64x2, &::U64x2, &::U64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v2i64.p0i64") - }, - "ld3q_dup_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::F32x4, &::F32x4, &::F32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v4f32.p0f32") - }, - "ld3q_dup_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 3] = [&::F64x2, &::F64x2, &::F64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld3.v2f64.p0f64") - }, - "ld4_dup_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I8x8, &::I8x8, &::I8x8, &::I8x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v8i8.p0i8") - }, - "ld4_dup_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U8x8, &::U8x8, &::U8x8, &::U8x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v8i8.p0i8") - }, - "ld4_dup_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I16, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I16x4, &::I16x4, &::I16x4, &::I16x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v4i16.p0i16") - }, - "ld4_dup_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U16, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U16x4, &::U16x4, &::U16x4, &::U16x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v4i16.p0i16") - }, - "ld4_dup_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I32x2, &::I32x2, &::I32x2, &::I32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v2i32.p0i32") - }, - "ld4_dup_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U32x2, &::U32x2, &::U32x2, &::U32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v2i32.p0i32") - }, - "ld4_dup_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I64x1, &::I64x1, &::I64x1, &::I64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v1i64.p0i64") - }, - "ld4_dup_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U64x1, &::U64x1, &::U64x1, &::U64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v1i64.p0i64") - }, - "ld4_dup_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::F32x2, &::F32x2, &::F32x2, &::F32x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v2f32.p0f32") - }, - "ld4_dup_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::F64x1, &::F64x1, &::F64x1, &::F64x1]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v1f64.p0f64") - }, - "ld4q_dup_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I8x16, &::I8x16, &::I8x16, &::I8x16]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v16i8.p0i8") - }, - "ld4q_dup_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U8x16, &::U8x16, &::U8x16, &::U8x16]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v16i8.p0i8") - }, - "ld4q_dup_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I16, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I16x8, &::I16x8, &::I16x8, &::I16x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v8i16.p0i16") - }, - "ld4q_dup_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U16, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U16x8, &::U16x8, &::U16x8, &::U16x8]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v8i16.p0i16") - }, - "ld4q_dup_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I32x4, &::I32x4, &::I32x4, &::I32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v4i32.p0i32") - }, - "ld4q_dup_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U32x4, &::U32x4, &::U32x4, &::U32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v4i32.p0i32") - }, - "ld4q_dup_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::I64x2, &::I64x2, &::I64x2, &::I64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v2i64.p0i64") - }, - "ld4q_dup_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::U64x2, &::U64x2, &::U64x2, &::U64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v2i64.p0i64") - }, - "ld4q_dup_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F32, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::F32x4, &::F32x4, &::F32x4, &::F32x4]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v4f32.p0f32") - }, - "ld4q_dup_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::F64, None, true); &PTR }]; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 4] = [&::F64x2, &::F64x2, &::F64x2, &::F64x2]; &PARTS }); &AGG }, - definition: Named("llvm.aarch64.neon.ld4.v2f64.p0f64") - }, - "padd_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.addp.v8i8") - }, - "padd_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.addp.v8i8") - }, - "padd_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.addp.v4i16") - }, - "padd_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.addp.v4i16") - }, - "padd_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.addp.v2i32") - }, - "padd_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.addp.v2i32") - }, - "padd_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.addp.v2f32") - }, - "paddq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.addp.v16i8") - }, - "paddq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.addp.v16i8") - }, - "paddq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.addp.v8i16") - }, - "paddq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.addp.v8i16") - }, - "paddq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.addp.v4i32") - }, - "paddq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.addp.v4i32") - }, - "paddq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.addp.v4f32") - }, - "paddq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.addp.v2i64") - }, - "paddq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.addp.v2i64") - }, - "paddq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.addp.v2f64") - }, - "paddl_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.saddlp.v4i16.v8i8") - }, - "paddl_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.uaddlp.v4i16.v8i8") - }, - "paddl_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.saddlp.v2i32.v4i16") - }, - "paddl_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x4]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.uaddlp.v2i32.v4i16") - }, - "paddl_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.aarch64.neon.saddlp.v1i64.v2i32") - }, - "paddl_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.aarch64.neon.uaddlp.v1i64.v2i32") - }, - "paddlq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.saddlp.v8i16.v16i8") - }, - "paddlq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.uaddlp.v8i16.v16i8") - }, - "paddlq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.saddlp.v4i32.v8i16") - }, - "paddlq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.uaddlp.v4i32.v8i16") - }, - "paddlq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.saddlp.v2i64.v4i32") - }, - "paddlq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.uaddlp.v2i64.v4i32") - }, - "pmax_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.smaxp.v8i8") - }, - "pmax_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.umaxp.v8i8") - }, - "pmax_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.smaxp.v4i16") - }, - "pmax_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.umaxp.v4i16") - }, - "pmax_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.smaxp.v2i32") - }, - "pmax_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.umaxp.v2i32") - }, - "pmax_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.fmaxp.v2f32") - }, - "pmaxq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.smaxp.v16i8") - }, - "pmaxq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.umaxp.v16i8") - }, - "pmaxq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.smaxp.v8i16") - }, - "pmaxq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.umaxp.v8i16") - }, - "pmaxq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.smaxp.v4i32") - }, - "pmaxq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.umaxp.v4i32") - }, - "pmaxq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.fmaxp.v4f32") - }, - "pmaxq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.smaxp.v2i64") - }, - "pmaxq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.umaxp.v2i64") - }, - "pmaxq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.fmaxp.v2f64") - }, - "pmin_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.sminp.v8i8") - }, - "pmin_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.uminp.v8i8") - }, - "pmin_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.sminp.v4i16") - }, - "pmin_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.uminp.v4i16") - }, - "pmin_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.sminp.v2i32") - }, - "pmin_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.uminp.v2i32") - }, - "pmin_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.fminp.v2f32") - }, - "pminq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.sminp.v16i8") - }, - "pminq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.uminp.v16i8") - }, - "pminq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.sminp.v8i16") - }, - "pminq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.uminp.v8i16") - }, - "pminq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.sminp.v4i32") - }, - "pminq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.uminp.v4i32") - }, - "pminq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.fminp.v4f32") - }, - "pminq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.sminp.v2i64") - }, - "pminq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.uminp.v2i64") - }, - "pminq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.fminp.v2f64") - }, - "pmaxnm_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.smaxnmp.v8i8") - }, - "pmaxnm_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.umaxnmp.v8i8") - }, - "pmaxnm_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.aarch64.neon.smaxnmp.v4i16") - }, - "pmaxnm_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.aarch64.neon.umaxnmp.v4i16") - }, - "pmaxnm_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.aarch64.neon.smaxnmp.v2i32") - }, - "pmaxnm_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.aarch64.neon.umaxnmp.v2i32") - }, - "pmaxnm_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.fmaxnmp.v2f32") - }, - "pmaxnmq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.smaxnmp.v16i8") - }, - "pmaxnmq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.umaxnmp.v16i8") - }, - "pmaxnmq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.aarch64.neon.smaxnmp.v8i16") - }, - "pmaxnmq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.aarch64.neon.umaxnmp.v8i16") - }, - "pmaxnmq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.aarch64.neon.smaxnmp.v4i32") - }, - "pmaxnmq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.aarch64.neon.umaxnmp.v4i32") - }, - "pmaxnmq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.fmaxnmp.v4f32") - }, - "pmaxnmq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.aarch64.neon.smaxnmp.v2i64") - }, - "pmaxnmq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.aarch64.neon.umaxnmp.v2i64") - }, - "pmaxnmq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.fmaxnmp.v2f64") - }, - "pminnm_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.aarch64.neon.fminnmp.v2f32") - }, - "pminnmq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.aarch64.neon.fminnmp.v4f32") - }, - "pminnmq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.aarch64.neon.fminnmp.v2f64") - }, - "addv_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8, - definition: Named("llvm.aarch64.neon.saddv.i8.v8i8") - }, - "addv_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U8, - definition: Named("llvm.aarch64.neon.uaddv.i8.v8i8") - }, - "addv_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16, - definition: Named("llvm.aarch64.neon.saddv.i16.v4i16") - }, - "addv_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x4]; &INPUTS }, - output: &::U16, - definition: Named("llvm.aarch64.neon.uaddv.i16.v4i16") - }, - "addv_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32, - definition: Named("llvm.aarch64.neon.saddv.i32.v2i32") - }, - "addv_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U32, - definition: Named("llvm.aarch64.neon.uaddv.i32.v2i32") - }, - "addv_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32, - definition: Named("llvm.aarch64.neon.faddv.f32.v2f32") - }, - "addvq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8, - definition: Named("llvm.aarch64.neon.saddv.i8.v16i8") - }, - "addvq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U8, - definition: Named("llvm.aarch64.neon.uaddv.i8.v16i8") - }, - "addvq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16, - definition: Named("llvm.aarch64.neon.saddv.i16.v8i16") - }, - "addvq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U16, - definition: Named("llvm.aarch64.neon.uaddv.i16.v8i16") - }, - "addvq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.aarch64.neon.saddv.i32.v4i32") - }, - "addvq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U32, - definition: Named("llvm.aarch64.neon.uaddv.i32.v4i32") - }, - "addvq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32, - definition: Named("llvm.aarch64.neon.faddv.f32.v4f32") - }, - "addvq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I64x2]; &INPUTS }, - output: &::I64, - definition: Named("llvm.aarch64.neon.saddv.i64.v2i64") - }, - "addvq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U64x2]; &INPUTS }, - output: &::U64, - definition: Named("llvm.aarch64.neon.uaddv.i64.v2i64") - }, - "addvq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x2]; &INPUTS }, - output: &::F64, - definition: Named("llvm.aarch64.neon.faddv.f64.v2f64") - }, - "addlv_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I16, - definition: Named("llvm.aarch64.neon.saddlv.i16.v8i8") - }, - "addlv_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U16, - definition: Named("llvm.aarch64.neon.uaddlv.i16.v8i8") - }, - "addlv_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.aarch64.neon.saddlv.i32.v4i16") - }, - "addlv_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x4]; &INPUTS }, - output: &::U32, - definition: Named("llvm.aarch64.neon.uaddlv.i32.v4i16") - }, - "addlv_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I64, - definition: Named("llvm.aarch64.neon.saddlv.i64.v2i32") - }, - "addlv_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U64, - definition: Named("llvm.aarch64.neon.uaddlv.i64.v2i32") - }, - "addlvq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I16, - definition: Named("llvm.aarch64.neon.saddlv.i16.v16i8") - }, - "addlvq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U16, - definition: Named("llvm.aarch64.neon.uaddlv.i16.v16i8") - }, - "addlvq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.aarch64.neon.saddlv.i32.v8i16") - }, - "addlvq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U32, - definition: Named("llvm.aarch64.neon.uaddlv.i32.v8i16") - }, - "addlvq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I64, - definition: Named("llvm.aarch64.neon.saddlv.i64.v4i32") - }, - "addlvq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U64, - definition: Named("llvm.aarch64.neon.uaddlv.i64.v4i32") - }, - "maxv_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8, - definition: Named("llvm.aarch64.neon.smaxv.i8.v8i8") - }, - "maxv_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U8, - definition: Named("llvm.aarch64.neon.umaxv.i8.v8i8") - }, - "maxv_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16, - definition: Named("llvm.aarch64.neon.smaxv.i16.v4i16") - }, - "maxv_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x4]; &INPUTS }, - output: &::U16, - definition: Named("llvm.aarch64.neon.umaxv.i16.v4i16") - }, - "maxv_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32, - definition: Named("llvm.aarch64.neon.smaxv.i32.v2i32") - }, - "maxv_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U32, - definition: Named("llvm.aarch64.neon.umaxv.i32.v2i32") - }, - "maxv_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32, - definition: Named("llvm.aarch64.neon.fmaxv.f32.v2f32") - }, - "maxvq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8, - definition: Named("llvm.aarch64.neon.smaxv.i8.v16i8") - }, - "maxvq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U8, - definition: Named("llvm.aarch64.neon.umaxv.i8.v16i8") - }, - "maxvq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16, - definition: Named("llvm.aarch64.neon.smaxv.i16.v8i16") - }, - "maxvq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U16, - definition: Named("llvm.aarch64.neon.umaxv.i16.v8i16") - }, - "maxvq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.aarch64.neon.smaxv.i32.v4i32") - }, - "maxvq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U32, - definition: Named("llvm.aarch64.neon.umaxv.i32.v4i32") - }, - "maxvq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32, - definition: Named("llvm.aarch64.neon.fmaxv.f32.v4f32") - }, - "maxvq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x2]; &INPUTS }, - output: &::F64, - definition: Named("llvm.aarch64.neon.fmaxv.f64.v2f64") - }, - "minv_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8, - definition: Named("llvm.aarch64.neon.sminv.i8.v8i8") - }, - "minv_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U8, - definition: Named("llvm.aarch64.neon.uminv.i8.v8i8") - }, - "minv_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16, - definition: Named("llvm.aarch64.neon.sminv.i16.v4i16") - }, - "minv_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x4]; &INPUTS }, - output: &::U16, - definition: Named("llvm.aarch64.neon.uminv.i16.v4i16") - }, - "minv_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32, - definition: Named("llvm.aarch64.neon.sminv.i32.v2i32") - }, - "minv_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U32, - definition: Named("llvm.aarch64.neon.uminv.i32.v2i32") - }, - "minv_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32, - definition: Named("llvm.aarch64.neon.fminv.f32.v2f32") - }, - "minvq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8, - definition: Named("llvm.aarch64.neon.sminv.i8.v16i8") - }, - "minvq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U8, - definition: Named("llvm.aarch64.neon.uminv.i8.v16i8") - }, - "minvq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16, - definition: Named("llvm.aarch64.neon.sminv.i16.v8i16") - }, - "minvq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U16, - definition: Named("llvm.aarch64.neon.uminv.i16.v8i16") - }, - "minvq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.aarch64.neon.sminv.i32.v4i32") - }, - "minvq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U32, - definition: Named("llvm.aarch64.neon.uminv.i32.v4i32") - }, - "minvq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32, - definition: Named("llvm.aarch64.neon.fminv.f32.v4f32") - }, - "minvq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x2]; &INPUTS }, - output: &::F64, - definition: Named("llvm.aarch64.neon.fminv.f64.v2f64") - }, - "maxnmv_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32, - definition: Named("llvm.aarch64.neon.fmaxnmv.f32.v2f32") - }, - "maxnmvq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32, - definition: Named("llvm.aarch64.neon.fmaxnmv.f32.v4f32") - }, - "maxnmvq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x2]; &INPUTS }, - output: &::F64, - definition: Named("llvm.aarch64.neon.fmaxnmv.f64.v2f64") - }, - "minnmv_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32, - definition: Named("llvm.aarch64.neon.fminnmv.f32.v2f32") - }, - "minnmvq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32, - definition: Named("llvm.aarch64.neon.fminnmv.f32.v4f32") - }, - "minnmvq_f64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x2]; &INPUTS }, - output: &::F64, - definition: Named("llvm.aarch64.neon.fminnmv.f64.v2f64") - }, - "qtbl1_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.tbl1.v8i8") - }, - "qtbl1_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.tbl1.v8i8") - }, - "qtbl1q_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::U8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.tbl1.v16i8") - }, - "qtbl1q_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.tbl1.v16i8") - }, - "qtbx1_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x8, &::I8x16, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.tbx1.v8i8") - }, - "qtbx1_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x8, &::U8x16, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.tbx1.v8i8") - }, - "qtbx1q_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::U8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.tbx1.v16i8") - }, - "qtbx1q_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x16, &::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.tbx1.v16i8") - }, - "qtbl2_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.tbl2.v8i8") - }, - "qtbl2_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.tbl2.v8i8") - }, - "qtbl2q_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &PARTS }); &AGG }, &::U8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.tbl2.v16i8") - }, - "qtbl2q_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &PARTS }); &AGG }, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.tbl2.v16i8") - }, - "qtbx2_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.tbx2.v8i8") - }, - "qtbx2_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.tbx2.v8i8") - }, - "qtbx2q_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &PARTS }); &AGG }, &::U8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.tbx2.v16i8") - }, - "qtbx2q_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &PARTS }); &AGG }, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.tbx2.v16i8") - }, - "qtbl3_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I8x16]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.tbl3.v8i8") - }, - "qtbl3_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 3] = [&::U8x16, &::U8x16, &::U8x16]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.tbl3.v8i8") - }, - "qtbl3q_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I8x16]; &PARTS }); &AGG }, &::U8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.tbl3.v16i8") - }, - "qtbl3q_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 3] = [&::U8x16, &::U8x16, &::U8x16]; &PARTS }); &AGG }, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.tbl3.v16i8") - }, - "qtbx3_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x8, { static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I8x16]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.tbx3.v8i8") - }, - "qtbx3_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x8, { static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 3] = [&::U8x16, &::U8x16, &::U8x16]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.tbx3.v8i8") - }, - "qtbx3q_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x16, { static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I8x16]; &PARTS }); &AGG }, &::U8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.tbx3.v16i8") - }, - "qtbx3q_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x16, { static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 3] = [&::U8x16, &::U8x16, &::U8x16]; &PARTS }); &AGG }, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.tbx3.v16i8") - }, - "qtbl4_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 4] = [&::I8x16, &::I8x16, &::I8x16, &::I8x16]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.tbl4.v8i8") - }, - "qtbl4_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 4] = [&::U8x16, &::U8x16, &::U8x16, &::U8x16]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.tbl4.v8i8") - }, - "qtbl4q_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 4] = [&::I8x16, &::I8x16, &::I8x16, &::I8x16]; &PARTS }); &AGG }, &::U8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.tbl4.v16i8") - }, - "qtbl4q_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 4] = [&::U8x16, &::U8x16, &::U8x16, &::U8x16]; &PARTS }); &AGG }, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.tbl4.v16i8") - }, - "qtbx4_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x8, { static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 4] = [&::I8x16, &::I8x16, &::I8x16, &::I8x16]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.aarch64.neon.tbx4.v8i8") - }, - "qtbx4_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x8, { static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 4] = [&::U8x16, &::U8x16, &::U8x16, &::U8x16]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.aarch64.neon.tbx4.v8i8") - }, - "qtbx4q_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x16, { static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 4] = [&::I8x16, &::I8x16, &::I8x16, &::I8x16]; &PARTS }); &AGG }, &::U8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.aarch64.neon.tbx4.v16i8") - }, - "qtbx4q_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x16, { static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 4] = [&::U8x16, &::U8x16, &::U8x16, &::U8x16]; &PARTS }); &AGG }, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.aarch64.neon.tbx4.v16i8") - }, - _ => return None, - }) -} diff --git a/src/librustc_platform_intrinsics/arm.rs b/src/librustc_platform_intrinsics/arm.rs deleted file mode 100644 index 8b320d90fac..00000000000 --- a/src/librustc_platform_intrinsics/arm.rs +++ /dev/null @@ -1,2084 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// DO NOT EDIT: autogenerated by etc/platform-intrinsics/generator.py -// ignore-tidy-linelength - -#![allow(unused_imports)] - -use {Intrinsic, Type}; -use IntrinsicDef::Named; - -pub fn find(name: &str) -> Option { - if !name.starts_with("arm_v") { return None } - Some(match &name["arm_v".len()..] { - "hadd_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vhadds.v8i8") - }, - "hadd_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vhaddu.v8i8") - }, - "hadd_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vhadds.v4i16") - }, - "hadd_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vhaddu.v4i16") - }, - "hadd_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vhadds.v2i32") - }, - "hadd_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vhaddu.v2i32") - }, - "haddq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vhadds.v16i8") - }, - "haddq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vhaddu.v16i8") - }, - "haddq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vhadds.v8i16") - }, - "haddq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vhaddu.v8i16") - }, - "haddq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vhadds.v4i32") - }, - "haddq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vhaddu.v4i32") - }, - "rhadd_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vrhadds.v8i8") - }, - "rhadd_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vrhaddu.v8i8") - }, - "rhadd_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vrhadds.v4i16") - }, - "rhadd_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vrhaddu.v4i16") - }, - "rhadd_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vrhadds.v2i32") - }, - "rhadd_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vrhaddu.v2i32") - }, - "rhaddq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vrhadds.v16i8") - }, - "rhaddq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vrhaddu.v16i8") - }, - "rhaddq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vrhadds.v8i16") - }, - "rhaddq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vrhaddu.v8i16") - }, - "rhaddq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vrhadds.v4i32") - }, - "rhaddq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vrhaddu.v4i32") - }, - "qadd_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vqadds.v8i8") - }, - "qadd_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vqaddu.v8i8") - }, - "qadd_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vqadds.v4i16") - }, - "qadd_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vqaddu.v4i16") - }, - "qadd_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vqadds.v2i32") - }, - "qadd_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vqaddu.v2i32") - }, - "qadd_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.arm.neon.vqadds.v1i64") - }, - "qadd_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::U64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.arm.neon.vqaddu.v1i64") - }, - "qaddq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vqadds.v16i8") - }, - "qaddq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vqaddu.v16i8") - }, - "qaddq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vqadds.v8i16") - }, - "qaddq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vqaddu.v8i16") - }, - "qaddq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vqadds.v4i32") - }, - "qaddq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vqaddu.v4i32") - }, - "qaddq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.arm.neon.vqadds.v2i64") - }, - "qaddq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.arm.neon.vqaddu.v2i64") - }, - "raddhn_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vraddhn.v8i8") - }, - "raddhn_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vraddhn.v8i8") - }, - "raddhn_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vraddhn.v4i16") - }, - "raddhn_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vraddhn.v4i16") - }, - "raddhn_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vraddhn.v2i32") - }, - "raddhn_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vraddhn.v2i32") - }, - "fma_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.fma.v2f32") - }, - "fmaq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.fma.v4f32") - }, - "qdmulh_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vsqdmulh.v4i16") - }, - "qdmulh_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vsqdmulh.v2i32") - }, - "qdmulhq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vsqdmulh.v8i16") - }, - "qdmulhq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vsqdmulh.v4i32") - }, - "qrdmulh_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vsqrdmulh.v4i16") - }, - "qrdmulh_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vsqrdmulh.v2i32") - }, - "qrdmulhq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vsqrdmulh.v8i16") - }, - "qrdmulhq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vsqrdmulh.v4i32") - }, - "mull_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vmulls.v8i16") - }, - "mull_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vmullu.v8i16") - }, - "mull_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vmulls.v4i32") - }, - "mull_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vmullu.v4i32") - }, - "mull_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.arm.neon.vmulls.v2i64") - }, - "mull_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.arm.neon.vmullu.v2i64") - }, - "qdmullq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vsqdmull.v8i16") - }, - "qdmullq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vsqdmull.v4i32") - }, - "hsub_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vhsubs.v8i8") - }, - "hsub_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vhsubu.v8i8") - }, - "hsub_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vhsubs.v4i16") - }, - "hsub_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vhsubu.v4i16") - }, - "hsub_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vhsubs.v2i32") - }, - "hsub_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vhsubu.v2i32") - }, - "hsubq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vhsubs.v16i8") - }, - "hsubq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vhsubu.v16i8") - }, - "hsubq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vhsubs.v8i16") - }, - "hsubq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vhsubu.v8i16") - }, - "hsubq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vhsubs.v4i32") - }, - "hsubq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vhsubu.v4i32") - }, - "qsub_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vqsubs.v8i8") - }, - "qsub_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vqsubu.v8i8") - }, - "qsub_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vqsubs.v4i16") - }, - "qsub_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vqsubu.v4i16") - }, - "qsub_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vqsubs.v2i32") - }, - "qsub_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vqsubu.v2i32") - }, - "qsub_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.arm.neon.vqsubs.v1i64") - }, - "qsub_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::U64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.arm.neon.vqsubu.v1i64") - }, - "qsubq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vqsubs.v16i8") - }, - "qsubq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vqsubu.v16i8") - }, - "qsubq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vqsubs.v8i16") - }, - "qsubq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vqsubu.v8i16") - }, - "qsubq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vqsubs.v4i32") - }, - "qsubq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vqsubu.v4i32") - }, - "qsubq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.arm.neon.vqsubs.v2i64") - }, - "qsubq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.arm.neon.vqsubu.v2i64") - }, - "rsubhn_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vrsubhn.v8i8") - }, - "rsubhn_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vrsubhn.v8i8") - }, - "rsubhn_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vrsubhn.v4i16") - }, - "rsubhn_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vrsubhn.v4i16") - }, - "rsubhn_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vrsubhn.v2i32") - }, - "rsubhn_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vrsubhn.v2i32") - }, - "abd_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vabds.v8i8") - }, - "abd_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vabdu.v8i8") - }, - "abd_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vabds.v4i16") - }, - "abd_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vabdu.v4i16") - }, - "abd_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vabds.v2i32") - }, - "abd_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vabdu.v2i32") - }, - "abd_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.arm.neon.vabdf.v2f32") - }, - "abdq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vabds.v16i8") - }, - "abdq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vabdu.v16i8") - }, - "abdq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vabds.v8i16") - }, - "abdq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vabdu.v8i16") - }, - "abdq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vabds.v4i32") - }, - "abdq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vabdu.v4i32") - }, - "abdq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.arm.neon.vabdf.v4f32") - }, - "max_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vmaxs.v8i8") - }, - "max_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vmaxu.v8i8") - }, - "max_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vmaxs.v4i16") - }, - "max_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vmaxu.v4i16") - }, - "max_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vmaxs.v2i32") - }, - "max_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vmaxu.v2i32") - }, - "max_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.arm.neon.vmaxf.v2f32") - }, - "maxq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vmaxs.v16i8") - }, - "maxq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vmaxu.v16i8") - }, - "maxq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vmaxs.v8i16") - }, - "maxq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vmaxu.v8i16") - }, - "maxq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vmaxs.v4i32") - }, - "maxq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vmaxu.v4i32") - }, - "maxq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.arm.neon.vmaxf.v4f32") - }, - "min_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vmins.v8i8") - }, - "min_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vminu.v8i8") - }, - "min_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vmins.v4i16") - }, - "min_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vminu.v4i16") - }, - "min_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vmins.v2i32") - }, - "min_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vminu.v2i32") - }, - "min_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.arm.neon.vminf.v2f32") - }, - "minq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vmins.v16i8") - }, - "minq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vminu.v16i8") - }, - "minq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vmins.v8i16") - }, - "minq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vminu.v8i16") - }, - "minq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vmins.v4i32") - }, - "minq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vminu.v4i32") - }, - "minq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.arm.neon.vminf.v4f32") - }, - "shl_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vshls.v8i8") - }, - "shl_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::I8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vshlu.v8i8") - }, - "shl_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vshls.v4i16") - }, - "shl_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::I16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vshlu.v4i16") - }, - "shl_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vshls.v2i32") - }, - "shl_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::I32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vshlu.v2i32") - }, - "shl_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.arm.neon.vshls.v1i64") - }, - "shl_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::I64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.arm.neon.vshlu.v1i64") - }, - "shlq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vshls.v16i8") - }, - "shlq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::I8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vshlu.v16i8") - }, - "shlq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vshls.v8i16") - }, - "shlq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::I16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vshlu.v8i16") - }, - "shlq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vshls.v4i32") - }, - "shlq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::I32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vshlu.v4i32") - }, - "shlq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.arm.neon.vshls.v2i64") - }, - "shlq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::I64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.arm.neon.vshlu.v2i64") - }, - "qshl_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vqshls.v8i8") - }, - "qshl_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::I8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vqshlu.v8i8") - }, - "qshl_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vqshls.v4i16") - }, - "qshl_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::I16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vqshlu.v4i16") - }, - "qshl_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vqshls.v2i32") - }, - "qshl_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::I32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vqshlu.v2i32") - }, - "qshl_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.arm.neon.vqshls.v1i64") - }, - "qshl_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::I64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.arm.neon.vqshlu.v1i64") - }, - "qshlq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vqshls.v16i8") - }, - "qshlq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::I8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vqshlu.v16i8") - }, - "qshlq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vqshls.v8i16") - }, - "qshlq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::I16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vqshlu.v8i16") - }, - "qshlq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vqshls.v4i32") - }, - "qshlq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::I32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vqshlu.v4i32") - }, - "qshlq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.arm.neon.vqshls.v2i64") - }, - "qshlq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::I64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.arm.neon.vqshlu.v2i64") - }, - "rshl_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vrshls.v8i8") - }, - "rshl_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::I8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vrshlu.v8i8") - }, - "rshl_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vrshls.v4i16") - }, - "rshl_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::I16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vrshlu.v4i16") - }, - "rshl_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vrshls.v2i32") - }, - "rshl_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::I32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vrshlu.v2i32") - }, - "rshl_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.arm.neon.vrshls.v1i64") - }, - "rshl_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::I64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.arm.neon.vrshlu.v1i64") - }, - "rshlq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vrshls.v16i8") - }, - "rshlq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::I8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vrshlu.v16i8") - }, - "rshlq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vrshls.v8i16") - }, - "rshlq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::I16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vrshlu.v8i16") - }, - "rshlq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vrshls.v4i32") - }, - "rshlq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::I32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vrshlu.v4i32") - }, - "rshlq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.arm.neon.vrshls.v2i64") - }, - "rshlq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::I64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.arm.neon.vrshlu.v2i64") - }, - "qrshl_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vqrshls.v8i8") - }, - "qrshl_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::I8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vqrshlu.v8i8") - }, - "qrshl_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vqrshls.v4i16") - }, - "qrshl_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::I16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vqrshlu.v4i16") - }, - "qrshl_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vqrshls.v2i32") - }, - "qrshl_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::I32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vqrshlu.v2i32") - }, - "qrshl_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.arm.neon.vqrshls.v1i64") - }, - "qrshl_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::I64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.arm.neon.vqrshlu.v1i64") - }, - "qrshlq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vqrshls.v16i8") - }, - "qrshlq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::I8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vqrshlu.v16i8") - }, - "qrshlq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vqrshls.v8i16") - }, - "qrshlq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::I16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vqrshlu.v8i16") - }, - "qrshlq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vqrshls.v4i32") - }, - "qrshlq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::I32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vqrshlu.v4i32") - }, - "qrshlq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.arm.neon.vqrshls.v2i64") - }, - "qrshlq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::I64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.arm.neon.vqrshlu.v2i64") - }, - "qshrun_n_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::U32]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vsqshrun.v8i8") - }, - "qshrun_n_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::U32]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vsqshrun.v4i16") - }, - "qshrun_n_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::U32]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vsqshrun.v2i32") - }, - "qrshrun_n_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::U32]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vsqrshrun.v8i8") - }, - "qrshrun_n_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::U32]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vsqrshrun.v4i16") - }, - "qrshrun_n_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::U32]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vsqrshrun.v2i32") - }, - "qshrn_n_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::U32]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vqshrns.v8i8") - }, - "qshrn_n_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U32]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vqshrnu.v8i8") - }, - "qshrn_n_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::U32]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vqshrns.v4i16") - }, - "qshrn_n_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vqshrnu.v4i16") - }, - "qshrn_n_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::U32]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vqshrns.v2i32") - }, - "qshrn_n_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vqshrnu.v2i32") - }, - "rshrn_n_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::U32]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vrshrn.v8i8") - }, - "rshrn_n_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U32]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vrshrn.v8i8") - }, - "rshrn_n_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::U32]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vrshrn.v4i16") - }, - "rshrn_n_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vrshrn.v4i16") - }, - "rshrn_n_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::U32]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vrshrn.v2i32") - }, - "rshrn_n_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vrshrn.v2i32") - }, - "qrshrn_n_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::U32]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vqrshrns.v8i8") - }, - "qrshrn_n_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U32]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vqrshrnu.v8i8") - }, - "qrshrn_n_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::U32]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vqrshrns.v4i16") - }, - "qrshrn_n_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vqrshrnu.v4i16") - }, - "qrshrn_n_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::U32]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vqrshrns.v2i32") - }, - "qrshrn_n_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vqrshrnu.v2i32") - }, - "sri_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vvsri.v8i8") - }, - "sri_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vvsri.v8i8") - }, - "sri_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vvsri.v4i16") - }, - "sri_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vvsri.v4i16") - }, - "sri_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vvsri.v2i32") - }, - "sri_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vvsri.v2i32") - }, - "sri_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.arm.neon.vvsri.v1i64") - }, - "sri_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::U64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.arm.neon.vvsri.v1i64") - }, - "sriq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vvsri.v16i8") - }, - "sriq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vvsri.v16i8") - }, - "sriq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vvsri.v8i16") - }, - "sriq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vvsri.v8i16") - }, - "sriq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vvsri.v4i32") - }, - "sriq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vvsri.v4i32") - }, - "sriq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.arm.neon.vvsri.v2i64") - }, - "sriq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.arm.neon.vvsri.v2i64") - }, - "sli_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vvsli.v8i8") - }, - "sli_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vvsli.v8i8") - }, - "sli_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vvsli.v4i16") - }, - "sli_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vvsli.v4i16") - }, - "sli_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vvsli.v2i32") - }, - "sli_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vvsli.v2i32") - }, - "sli_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.arm.neon.vvsli.v1i64") - }, - "sli_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::U64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.arm.neon.vvsli.v1i64") - }, - "sliq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vvsli.v16i8") - }, - "sliq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vvsli.v16i8") - }, - "sliq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vvsli.v8i16") - }, - "sliq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vvsli.v8i16") - }, - "sliq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vvsli.v4i32") - }, - "sliq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vvsli.v4i32") - }, - "sliq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.arm.neon.vvsli.v2i64") - }, - "sliq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.arm.neon.vvsli.v2i64") - }, - "vqmovn_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vqxtns.v8i8") - }, - "vqmovn_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vqxtnu.v8i8") - }, - "vqmovn_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vqxtns.v4i16") - }, - "vqmovn_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vqxtnu.v4i16") - }, - "vqmovn_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I64x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vqxtns.v2i32") - }, - "vqmovn_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U64x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vqxtnu.v2i32") - }, - "abs_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vabs.v8i8") - }, - "abs_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vabs.v4i16") - }, - "abs_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vabs.v2i32") - }, - "absq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vabs.v16i8") - }, - "absq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vabs.v8i16") - }, - "absq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vabs.v4i32") - }, - "abs_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.fabs.v2f32") - }, - "absq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.fabs.v4f32") - }, - "qabs_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vsqabs.v8i8") - }, - "qabs_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vsqabs.v4i16") - }, - "qabs_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vsqabs.v2i32") - }, - "qabsq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vsqabs.v16i8") - }, - "qabsq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vsqabs.v8i16") - }, - "qabsq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vsqabs.v4i32") - }, - "qneg_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vsqneg.v8i8") - }, - "qneg_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vsqneg.v4i16") - }, - "qneg_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vsqneg.v2i32") - }, - "qnegq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vsqneg.v16i8") - }, - "qnegq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vsqneg.v8i16") - }, - "qnegq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vsqneg.v4i32") - }, - "clz_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.ctlz.v8i8") - }, - "clz_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.ctlz.v8i8") - }, - "clz_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.ctlz.v4i16") - }, - "clz_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.ctlz.v4i16") - }, - "clz_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.ctlz.v2i32") - }, - "clz_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.ctlz.v2i32") - }, - "clzq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ctlz.v16i8") - }, - "clzq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.ctlz.v16i8") - }, - "clzq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ctlz.v8i16") - }, - "clzq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.ctlz.v8i16") - }, - "clzq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ctlz.v4i32") - }, - "clzq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ctlz.v4i32") - }, - "cls_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vcls.v8i8") - }, - "cls_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vcls.v8i8") - }, - "cls_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vcls.v4i16") - }, - "cls_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vcls.v4i16") - }, - "cls_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vcls.v2i32") - }, - "cls_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vcls.v2i32") - }, - "clsq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vcls.v16i8") - }, - "clsq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vcls.v16i8") - }, - "clsq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vcls.v8i16") - }, - "clsq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vcls.v8i16") - }, - "clsq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vcls.v4i32") - }, - "clsq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vcls.v4i32") - }, - "cnt_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.ctpop.v8i8") - }, - "cnt_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.ctpop.v8i8") - }, - "cntq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ctpop.v16i8") - }, - "cntq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.ctpop.v16i8") - }, - "recpe_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vrecpe.v2i32") - }, - "recpe_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.arm.neon.vrecpe.v2f32") - }, - "recpeq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vrecpe.v4i32") - }, - "recpeq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.arm.neon.vrecpe.v4f32") - }, - "recps_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.arm.neon.vfrecps.v2f32") - }, - "recpsq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.arm.neon.vfrecps.v4f32") - }, - "sqrt_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.sqrt.v2f32") - }, - "sqrtq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.sqrt.v4f32") - }, - "rsqrte_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vrsqrte.v2i32") - }, - "rsqrte_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.arm.neon.vrsqrte.v2f32") - }, - "rsqrteq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vrsqrte.v4i32") - }, - "rsqrteq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.arm.neon.vrsqrte.v4f32") - }, - "rsqrts_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.arm.neon.vrsqrts.v2f32") - }, - "rsqrtsq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.arm.neon.vrsqrts.v4f32") - }, - "bsl_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vbsl.v8i8") - }, - "bsl_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vbsl.v8i8") - }, - "bsl_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vbsl.v4i16") - }, - "bsl_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vbsl.v4i16") - }, - "bsl_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vbsl.v2i32") - }, - "bsl_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vbsl.v2i32") - }, - "bsl_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::I64x1]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.arm.neon.vbsl.v1i64") - }, - "bsl_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::U64x1]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.arm.neon.vbsl.v1i64") - }, - "bslq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vbsl.v16i8") - }, - "bslq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vbsl.v16i8") - }, - "bslq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vbsl.v8i16") - }, - "bslq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vbsl.v8i16") - }, - "bslq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vbsl.v4i32") - }, - "bslq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vbsl.v4i32") - }, - "bslq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.arm.neon.vbsl.v2i64") - }, - "bslq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.arm.neon.vbsl.v2i64") - }, - "padd_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vpadd.v8i8") - }, - "padd_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vpadd.v8i8") - }, - "padd_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vpadd.v4i16") - }, - "padd_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vpadd.v4i16") - }, - "padd_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vpadd.v2i32") - }, - "padd_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vpadd.v2i32") - }, - "padd_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.arm.neon.vpadd.v2f32") - }, - "paddl_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x8]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vpaddls.v4i16.v8i8") - }, - "paddl_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x8]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vpaddlu.v4i16.v8i8") - }, - "paddl_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x4]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vpaddls.v2i32.v4i16") - }, - "paddl_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x4]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vpaddlu.v2i32.v4i16") - }, - "paddl_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x2]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.arm.neon.vpaddls.v1i64.v2i32") - }, - "paddl_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.arm.neon.vpaddlu.v1i64.v2i32") - }, - "paddlq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vpaddls.v8i16.v16i8") - }, - "paddlq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x16]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vpaddlu.v8i16.v16i8") - }, - "paddlq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vpaddls.v4i32.v8i16") - }, - "paddlq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vpaddlu.v4i32.v8i16") - }, - "paddlq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.arm.neon.vpaddls.v2i64.v4i32") - }, - "paddlq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.arm.neon.vpaddlu.v2i64.v4i32") - }, - "padal_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I8x8]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vpadals.v4i16.v4i16") - }, - "padal_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U8x8]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vpadalu.v4i16.v4i16") - }, - "padal_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I16x4]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vpadals.v2i32.v2i32") - }, - "padal_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U16x4]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vpadalu.v2i32.v2i32") - }, - "padal_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x1, &::I32x2]; &INPUTS }, - output: &::I64x1, - definition: Named("llvm.arm.neon.vpadals.v1i64.v1i64") - }, - "padal_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x1, &::U32x2]; &INPUTS }, - output: &::U64x1, - definition: Named("llvm.arm.neon.vpadalu.v1i64.v1i64") - }, - "padalq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I8x16]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vpadals.v8i16.v8i16") - }, - "padalq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U8x16]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vpadalu.v8i16.v8i16") - }, - "padalq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I16x8]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vpadals.v4i32.v4i32") - }, - "padalq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U16x8]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vpadalu.v4i32.v4i32") - }, - "padalq_s64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I64x2, &::I32x4]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.arm.neon.vpadals.v2i64.v2i64") - }, - "padalq_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U32x4]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.arm.neon.vpadalu.v2i64.v2i64") - }, - "pmax_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vpmaxs.v8i8") - }, - "pmax_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vpmaxu.v8i8") - }, - "pmax_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vpmaxs.v4i16") - }, - "pmax_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vpmaxu.v4i16") - }, - "pmax_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vpmaxs.v2i32") - }, - "pmax_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vpmaxu.v2i32") - }, - "pmax_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.arm.neon.vpmaxf.v2f32") - }, - "pmin_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vpmins.v8i8") - }, - "pmin_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vpminu.v8i8") - }, - "pmin_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x4, &::I16x4]; &INPUTS }, - output: &::I16x4, - definition: Named("llvm.arm.neon.vpmins.v4i16") - }, - "pmin_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x4, &::U16x4]; &INPUTS }, - output: &::U16x4, - definition: Named("llvm.arm.neon.vpminu.v4i16") - }, - "pmin_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x2, &::I32x2]; &INPUTS }, - output: &::I32x2, - definition: Named("llvm.arm.neon.vpmins.v2i32") - }, - "pmin_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.arm.neon.vpminu.v2i32") - }, - "pmin_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x2, &::F32x2]; &INPUTS }, - output: &::F32x2, - definition: Named("llvm.arm.neon.vpminf.v2f32") - }, - "pminq_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.arm.neon.vpmins.v16i8") - }, - "pminq_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.arm.neon.vpminu.v16i8") - }, - "pminq_s16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.arm.neon.vpmins.v8i16") - }, - "pminq_u16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.arm.neon.vpminu.v8i16") - }, - "pminq_s32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.arm.neon.vpmins.v4i32") - }, - "pminq_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.arm.neon.vpminu.v4i32") - }, - "pminq_f32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.arm.neon.vpminf.v4f32") - }, - "tbl1_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x8, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vtbl1") - }, - "tbl1_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vtbl1") - }, - "tbx1_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x8, &::I8x8, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vtbx1") - }, - "tbx1_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x8, &::U8x8, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vtbx1") - }, - "tbl2_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vtbl2") - }, - "tbl2_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vtbl2") - }, - "tbx2_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 2] = [&::I8x8, &::I8x8]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vtbx2") - }, - "tbx2_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 2] = [&::U8x8, &::U8x8]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vtbx2") - }, - "tbl3_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 3] = [&::I8x8, &::I8x8, &::I8x8]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vtbl3") - }, - "tbl3_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 3] = [&::U8x8, &::U8x8, &::U8x8]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vtbl3") - }, - "tbx3_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x8, { static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 3] = [&::I8x8, &::I8x8, &::I8x8]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vtbx3") - }, - "tbx3_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x8, { static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 3] = [&::U8x8, &::U8x8, &::U8x8]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vtbx3") - }, - "tbl4_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 4] = [&::I8x8, &::I8x8, &::I8x8, &::I8x8]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vtbl4") - }, - "tbl4_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 4] = [&::U8x8, &::U8x8, &::U8x8, &::U8x8]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vtbl4") - }, - "tbx4_s8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x8, { static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 4] = [&::I8x8, &::I8x8, &::I8x8, &::I8x8]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::I8x8, - definition: Named("llvm.arm.neon.vtbx4") - }, - "tbx4_u8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x8, { static AGG: Type = Type::Aggregate(true, { static PARTS: [&'static Type; 4] = [&::U8x8, &::U8x8, &::U8x8, &::U8x8]; &PARTS }); &AGG }, &::U8x8]; &INPUTS }, - output: &::U8x8, - definition: Named("llvm.arm.neon.vtbx4") - }, - _ => return None, - }) -} diff --git a/src/librustc_platform_intrinsics/hexagon.rs b/src/librustc_platform_intrinsics/hexagon.rs deleted file mode 100644 index 65460cfb8bd..00000000000 --- a/src/librustc_platform_intrinsics/hexagon.rs +++ /dev/null @@ -1,2934 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// DO NOT EDIT: autogenerated by etc/platform-intrinsics/generator.py -// ignore-tidy-linelength - -#![allow(unused_imports)] - -use {Intrinsic, Type}; -use IntrinsicDef::Named; - -pub fn find(name: &str) -> Option { - if !name.starts_with("Q6_") { return None } - Some(match &name["Q6_".len()..] { - "R_vextract64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x16, &::U32]; &INPUTS }, - output: &::U32, - definition: Named("llvm.hexagon.V6.extractw") - }, - "R_vextract128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x32, &::U32]; &INPUTS }, - output: &::U32, - definition: Named("llvm.hexagon.V6.extractw.128B") - }, - "V_lo64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x32]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.lo") - }, - "V_lo128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x64]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.lo.128B") - }, - "V_hi64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x32]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.hi") - }, - "V_hi128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x64]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.hi.128B") - }, - "V_vsplat_R64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.lvsplatuw") - }, - "V_vsplat_R128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.lvsplatuw.128B") - }, - "Q_and_QQ64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.pred.and") - }, - "Q_and_QQ128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.pred.and.128B") - }, - "Q_not_Q64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.pred.not") - }, - "Q_not_Q128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.pred.not.128B") - }, - "Q_or_QQ64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.pred.or") - }, - "Q_or_QQ128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.pred.or.128B") - }, - "Q_xor_QQ64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32x2]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.pred.xor") - }, - "Q_xor_QQ128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.pred.xor.128B") - }, - "Vub_vabsdiff_VubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vabsdiffub") - }, - "Vuh_vabsdiff_VuhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vabsdiffuh") - }, - "Vub_vabsdiff_VubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vabsdiffub.128B") - }, - "Vuh_vabsdiff_VuhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vabsdiffuh.128B") - }, - "Vuh_vabsdiff_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vabsdiffh") - }, - "Vuw_vabsdiff_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.vabsdiffw") - }, - "Vuh_vabsdiff_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vabsdiffh.128B") - }, - "Vuw_vabsdiff_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vabsdiffw.128B") - }, - "Vh_vabs_Vh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vabsh") - }, - "Vw_vabs_Vw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vabsw") - }, - "Vh_vabs_Vh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vabsh.128B") - }, - "Vw_vabs_Vw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vabsw.128B") - }, - "Vh_vabs_Vh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vabsh.sat") - }, - "Vw_vabs_Vw_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vabsw.sat") - }, - "Vh_vabs_Vh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vabsh.sat.128B") - }, - "Vw_vabs_Vw_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vabsw.sat.128B") - }, - "Vb_vadd_VbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vaddb") - }, - "Vh_vadd_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vaddh") - }, - "Vw_vadd_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vaddw") - }, - "Vb_vadd_VbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vaddb.128B") - }, - "Vh_vadd_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vaddh.128B") - }, - "Vw_vadd_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vaddw.128B") - }, - "Vh_vadd_VhVh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vaddhsat") - }, - "Vw_vadd_VwVw_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vaddwsat") - }, - "Vh_vadd_VhVh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vaddhsat.128B") - }, - "Vw_vadd_VwVw_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vaddwsat.128B") - }, - "Vub_vadd_VubVub_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vaddubsat") - }, - "Vuh_vadd_VuhVuh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vadduhsat") - }, - "Vub_vadd_VubVub_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vaddubsat.128B") - }, - "Vuh_vadd_VuhVuh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vadduhsat.128B") - }, - "Wb_vadd_WbWb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vaddb.dv") - }, - "Wh_vadd_WhWh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vaddh.dv") - }, - "Ww_vadd_WwWw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vaddw.dv") - }, - "Wb_vadd_WbWb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x256, &::I8x256]; &INPUTS }, - output: &::I8x256, - definition: Named("llvm.hexagon.V6.vaddb.dv.128B") - }, - "Wh_vadd_WhWh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::I16x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vaddh.dv.128B") - }, - "Ww_vadd_WwWw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x64, &::I32x64]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vaddw.dv.128B") - }, - "Wh_vadd_WhWh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vaddhsat.dv") - }, - "Ww_vadd_WwWw_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vaddwsat.dv") - }, - "Wh_vadd_WhWh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::I16x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vaddhsat.dv.128B") - }, - "Ww_vadd_WwWw_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x64, &::I32x64]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vaddwsat.dv.128B") - }, - "Wub_vadd_WubWub_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vaddubsat.dv") - }, - "Wuh_vadd_WuhWuh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vadduhsat.dv") - }, - "Wub_vadd_WubWub_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U8x256]; &INPUTS }, - output: &::U8x256, - definition: Named("llvm.hexagon.V6.vaddubsat.dv.128B") - }, - "Wuh_vadd_WuhWuh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x128, &::U16x128]; &INPUTS }, - output: &::U16x128, - definition: Named("llvm.hexagon.V6.vadduhsat.dv.128B") - }, - "V_valign_VVR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U8x64, &::U32]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.valignb") - }, - "V_valign_VVR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U8x128, &::U32]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.valignb.128B") - }, - "V_valign_VVI64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U8x64, &::U32]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.valignbi") - }, - "V_valign_VVI128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U8x128, &::U32]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.valignbi.128B") - }, - "V_vlalign_VVR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U8x64, &::U32]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vlalignb") - }, - "V_vlalign_VVR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U8x128, &::U32]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vlalignb.128B") - }, - "V_vlalign_VVI64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U8x64, &::U32]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vlalignbi") - }, - "V_vlalign_VVI128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U8x128, &::U32]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vlalignbi.128B") - }, - "V_vand_VV64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vand") - }, - "V_vand_VV128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vand.128B") - }, - "V_vand_QR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x2, &::U32]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vandqrt") - }, - "V_vand_QR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vandqrt.128B") - }, - "V_vandor_VQR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U32x2, &::U32]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vandqrt.acc") - }, - "V_vandor_VQR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U32x4, &::U32]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vandqrt.acc.128B") - }, - "Q_vand_VR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vandvrt") - }, - "Q_vand_VR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vandvrt.128B") - }, - "Q_vandor_QVR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U8x64, &::U32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vandvrt") - }, - "Q_vandor_QVR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U8x128, &::U32]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vandvrt.128B") - }, - "Vh_vasl_VhR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vaslh") - }, - "Vw_vasl_VwR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vaslw") - }, - "Vh_vasl_VhR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vaslh.128B") - }, - "Vw_vasl_VwR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vaslw.128B") - }, - "Vh_vasl_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vaslhv") - }, - "Vw_vasl_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vaslwv") - }, - "Vh_vasl_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vaslhv.128B") - }, - "Vw_vasl_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vaslwv.128B") - }, - "Vw_vaslacc_VwVwR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vaslw.acc") - }, - "Vw_vaslacc_VwVwR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vaslw.acc.128B") - }, - "Vh_vasr_VhR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vasrh") - }, - "Vw_vasr_VwR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vasrw") - }, - "Vh_vasr_VhR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vasrh.128B") - }, - "Vw_vasr_VwR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vasrw.128B") - }, - "Vh_vasr_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vasrhv") - }, - "Vw_vasr_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vasrwv") - }, - "Vh_vasr_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vasrhv.128B") - }, - "Vw_vasr_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vasrwv.128B") - }, - "Vw_vasracc_VwVwR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vasrw.acc") - }, - "Vw_vasracc_VwVwR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vasrw.acc.128B") - }, - "Vh_vasr_VwVwR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vasrhw") - }, - "Vh_vasr_VwVwR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vasrhw.128B") - }, - "Vb_vasr_VhVhR_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::I16x32, &::U32]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vasrhbsat") - }, - "Vub_vasr_VhVhR_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::I16x32, &::U32]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vasrhbsat") - }, - "Vh_vasr_VwVwR_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vasrwhsat") - }, - "Vuh_vasr_VwVwR_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vasrwhsat") - }, - "Vb_vasr_VhVhR_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I16x64, &::U32]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vasrhbsat.128B") - }, - "Vub_vasr_VhVhR_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I16x64, &::U32]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vasrhbsat.128B") - }, - "Vh_vasr_VwVwR_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vasrwhsat.128B") - }, - "Vuh_vasr_VwVwR_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vasrwhsat.128B") - }, - "Vb_vasr_VhVhR_rnd_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::I16x32, &::U32]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vasrhbrndsat") - }, - "Vub_vasr_VhVhR_rnd_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::I16x32, &::U32]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vasrhbrndsat") - }, - "Vh_vasr_VwVwR_rnd_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vasrwhrndsat") - }, - "Vuh_vasr_VwVwR_rnd_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vasrwhrndsat") - }, - "Vb_vasr_VhVhR_rnd_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I16x64, &::U32]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vasrhbrndsat.128B") - }, - "Vub_vasr_VhVhR_rnd_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I16x64, &::U32]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vasrhbrndsat.128B") - }, - "Vh_vasr_VwVwR_rnd_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vasrwhrndsat.128B") - }, - "Vuh_vasr_VwVwR_rnd_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vasrwhrndsat.128B") - }, - "V_equals_V64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x16]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.vassign") - }, - "V_equals_V128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vassign.128B") - }, - "W_equals_W64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vassignp") - }, - "W_equals_W128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x64]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vassignp.128B") - }, - "Vh_vavg_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vavgh") - }, - "Vw_vavg_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vavgw") - }, - "Vh_vavg_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vavgh.128B") - }, - "Vw_vavg_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vavgw.128B") - }, - "Vub_vavg_VubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vavgub") - }, - "Vuh_vavg_VuhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vavguh") - }, - "Vub_vavg_VubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vavgub.128B") - }, - "Vuh_vavg_VuhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vavguh.128B") - }, - "Vh_vavg_VhVh_rnd64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vavgrndh") - }, - "Vw_vavg_VwVw_rnd64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vavgrndw") - }, - "Vh_vavg_VhVh_rnd128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vavgrndh.128B") - }, - "Vw_vavg_VwVw_rnd128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vavgrndw.128B") - }, - "Vub_vavg_VubVub_rnd64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vavgrndub") - }, - "Vuh_vavg_VuhVuh_rnd64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vavgrnduh") - }, - "Vub_vavg_VubVub_rnd128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vavgrndub.128B") - }, - "Vuh_vavg_VuhVuh_rnd128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vavgrnduh.128B") - }, - "Vuh_vcl0_Vuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vcl0h") - }, - "Vuw_vcl0_Vuw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x16]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.vcl0w") - }, - "Vuh_vcl0_Vuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vcl0h.128B") - }, - "Vuw_vcl0_Vuw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U32x32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vcl0w.128B") - }, - "W_vcombine_VV64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vcombine") - }, - "W_vcombine_VV128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x256, - definition: Named("llvm.hexagon.V6.vcombine.128B") - }, - "V_vzero64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.vd0") - }, - "V_vzero128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vd0.128B") - }, - "Vb_vdeal_Vb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x64]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vdealb") - }, - "Vh_vdeal_Vh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vdealh") - }, - "Vb_vdeal_Vb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vdealb.128B") - }, - "Vh_vdeal_Vh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vdealh.128B") - }, - "Vb_vdeale_VbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vdealb4w") - }, - "Vb_vdeale_VbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vdealb4w.128B") - }, - "W_vdeal_VVR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U8x64, &::U32]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vdealvdd") - }, - "W_vdeal_VVR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U8x128, &::U32]; &INPUTS }, - output: &::U8x256, - definition: Named("llvm.hexagon.V6.vdealvdd.128B") - }, - "V_vdelta_VV64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vdelta") - }, - "V_vdelta_VV128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vdelta.128B") - }, - "Vh_vdmpy_VubRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vdmpybus") - }, - "Vh_vdmpy_VubRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vdmpybus.128B") - }, - "Vh_vdmpyacc_VhVubRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::U8x64, &::U32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vdmpybus.acc") - }, - "Vh_vdmpyacc_VhVubRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::U8x128, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vdmpybus.acc.128B") - }, - "Wh_vdmpy_WubRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vdmpybus.dv") - }, - "Wh_vdmpy_WubRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U32]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vdmpybus.dv.128B") - }, - "Wh_vdmpyacc_WhWubRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::U8x128, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vdmpybus.dv.acc") - }, - "Wh_vdmpyacc_WhWubRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::U8x256, &::U32]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vdmpybus.dv.acc.128B") - }, - "Vw_vdmpy_VhRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vdmpyhb") - }, - "Vw_vdmpy_VhRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhb.128B") - }, - "Vw_vdmpyacc_VwVhRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I16x32, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vdmpyhb.acc") - }, - "Vw_vdmpyacc_VwVhRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhb.acc.128B") - }, - "Ww_vdmpy_WhRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhb.dv") - }, - "Ww_vdmpy_WhRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::U32]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vdmpyhb.dv.128B") - }, - "Ww_vdmpyacc_WwWhRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhb.dv.acc") - }, - "Ww_vdmpyacc_WwWhRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::I16x128, &::U32]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vdmpyhb.dv.acc.128B") - }, - "Vw_vdmpy_WwRh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vdmpyhisat") - }, - "Vw_vdmpy_WwRh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhisat.128B") - }, - "Vw_vdmpy_VhRh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vdmpyhsat") - }, - "Vw_vdmpy_VhRh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhsat.128B") - }, - "Vw_vdmpy_WhRuh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vdmpyhsuisat") - }, - "Vw_vdmpy_WhRuh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhsuisat.128B") - }, - "Vw_vdmpy_VhRuh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vdmpyhsusat") - }, - "Vw_vdmpy_VhRuh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhsusat.128B") - }, - "Vw_vdmpy_VhVh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vdmpyhvsat") - }, - "Vw_vdmpy_VhVh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhvsat.128B") - }, - "Vw_vdmpyacc_VwWwRh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x32, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vdmpyhisat_acc") - }, - "Vw_vdmpyacc_VwWwRh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhisat_acc.128B") - }, - "Wuw_vdsad_WuhRuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vdsaduh") - }, - "Wuw_vdsad_WuhRuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x128, &::U32]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vdsaduh.128B") - }, - "Wuw_vdsadacc_WuwWuhRuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U16x64, &::U32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vdsaduh.acc") - }, - "Wuw_vdsadacc_WuwWuhRuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x64, &::U16x128, &::U32]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vdsaduh.acc.128B") - }, - "Vw_vdmpyacc_VwVhRh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I16x32, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vdmpyhsat_acc") - }, - "Vw_vdmpyacc_VwVhRh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhsat_acc.128B") - }, - "Vw_vdmpyacc_VwWhRuh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I16x64, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vdmpyhsuisat_acc") - }, - "Vw_vdmpyacc_VwWhRuh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x128, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhsuisat_acc.128B") - }, - "Vw_vdmpyacc_VwVhRuh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I16x32, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vdmpyhsusat_acc") - }, - "Vw_vdmpyacc_VwVhRuh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhsusat_acc.128B") - }, - "Vw_vdmpyacc_VwVhVh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I16x32, &::I16x32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vdmpyhvsat_acc") - }, - "Vw_vdmpyacc_VwVhVh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::I16x64]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vdmpyhvsat_acc.128B") - }, - "Q_vcmp_eq_VbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.veqb") - }, - "Q_vcmp_eq_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.veqh") - }, - "Q_vcmp_eq_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.veqw") - }, - "Q_vcmp_eq_VbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.veqb.128B") - }, - "Q_vcmp_eq_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.veqh.128B") - }, - "Q_vcmp_eq_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.veqw.128B") - }, - "Q_vcmp_eqand_QVbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.veqb.and") - }, - "Q_vcmp_eqand_QVhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.veqh.and") - }, - "Q_vcmp_eqand_QVwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.veqw.and") - }, - "Q_vcmp_eqand_QVbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.veqb.and.128B") - }, - "Q_vcmp_eqand_QVhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.veqh.and.128B") - }, - "Q_vcmp_eqand_QVwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.veqw.and.128B") - }, - "Q_vcmp_eqor_QVbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.veqb.or") - }, - "Q_vcmp_eqor_QVhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.veqh.or") - }, - "Q_vcmp_eqor_QVwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.veqw.or") - }, - "Q_vcmp_eqor_QVbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.veqb.or.128B") - }, - "Q_vcmp_eqor_QVhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.veqh.or.128B") - }, - "Q_vcmp_eqor_QVwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.veqw.or.128B") - }, - "Q_vcmp_eqxacc_QVbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.veqb.xor") - }, - "Q_vcmp_eqxacc_QVhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.veqh.xor") - }, - "Q_vcmp_eqxacc_QVwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.veqw.xor") - }, - "Q_vcmp_eqxacc_QVbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.veqb.xor.128B") - }, - "Q_vcmp_eqxacc_QVhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.veqh.xor.128B") - }, - "Q_vcmp_eqxacc_QVwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.veqw.xor.128B") - }, - "Q_vcmp_gt_VbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtb") - }, - "Q_vcmp_gt_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgth") - }, - "Q_vcmp_gt_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtw") - }, - "Q_vcmp_gt_VbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtb.128B") - }, - "Q_vcmp_gt_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgth.128B") - }, - "Q_vcmp_gt_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtw.128B") - }, - "Q_vcmp_gt_VubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtub") - }, - "Q_vcmp_gt_VuhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtuh") - }, - "Q_vcmp_gt_VubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtub.128B") - }, - "Q_vcmp_gt_VuhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtuh.128B") - }, - "Q_vcmp_gtand_QVbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtb.and") - }, - "Q_vcmp_gtand_QVhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgth.and") - }, - "Q_vcmp_gtand_QVwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtw.and") - }, - "Q_vcmp_gtand_QVbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtb.and.128B") - }, - "Q_vcmp_gtand_QVhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgth.and.128B") - }, - "Q_vcmp_gtand_QVwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtw.and.128B") - }, - "Q_vcmp_gtand_QVubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U8x64, &::U8x64]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtub.and") - }, - "Q_vcmp_gtand_QVuhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U16x32, &::U16x32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtuh.and") - }, - "Q_vcmp_gtand_QVubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U8x128, &::U8x128]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtub.and.128B") - }, - "Q_vcmp_gtand_QVuhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U16x64, &::U16x64]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtuh.and.128B") - }, - "Q_vcmp_gtor_QVbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtb.or") - }, - "Q_vcmp_gtor_QVhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgth.or") - }, - "Q_vcmp_gtor_QVwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtw.or") - }, - "Q_vcmp_gtor_QVbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtb.or.128B") - }, - "Q_vcmp_gtor_QVhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgth.or.128B") - }, - "Q_vcmp_gtor_QVwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtw.or.128B") - }, - "Q_vcmp_gtor_QVubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U8x64, &::U8x64]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtub.or") - }, - "Q_vcmp_gtor_QVuhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U16x32, &::U16x32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtuh.or") - }, - "Q_vcmp_gtor_QVubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U8x128, &::U8x128]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtub.or.128B") - }, - "Q_vcmp_gtor_QVuhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U16x64, &::U16x64]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtuh.or.128B") - }, - "Q_vcmp_gtxacc_QVbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtb.xor") - }, - "Q_vcmp_gtxacc_QVhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgth.xor") - }, - "Q_vcmp_gtxacc_QVwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtw.xor") - }, - "Q_vcmp_gtxacc_QVbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtb.xor.128B") - }, - "Q_vcmp_gtxacc_QVhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgth.xor.128B") - }, - "Q_vcmp_gtxacc_QVwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtw.xor.128B") - }, - "Q_vcmp_gtxacc_QVubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U8x64, &::U8x64]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtub.xor") - }, - "Q_vcmp_gtxacc_QVuhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U16x32, &::U16x32]; &INPUTS }, - output: &::U32x2, - definition: Named("llvm.hexagon.V6.vgtuh.xor") - }, - "Q_vcmp_gtxacc_QVubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U8x128, &::U8x128]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtub.xor.128B") - }, - "Q_vcmp_gtxacc_QVuhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U16x64, &::U16x64]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.hexagon.V6.vgtuh.xor.128B") - }, - "Vw_vinsert_VwR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vinsertwr") - }, - "Vw_vinsert_VwR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vinsertwr.128B") - }, - "Vuh_vlsr_VuhR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vlsrh") - }, - "Vuw_vlsr_VuwR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x16, &::U32]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.vlsrw") - }, - "Vuh_vlsr_VuhR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U32]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vlsrh.128B") - }, - "Vuw_vlsr_VuwR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x32, &::U32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vlsrw.128B") - }, - "Vh_vlsr_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vlsrhv") - }, - "Vw_vlsr_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vlsrwv") - }, - "Vh_vlsr_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vlsrhv.128B") - }, - "Vw_vlsr_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vlsrwv.128B") - }, - "Vb_vlut32_VbVbR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x64, &::I8x64, &::U32]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vlutvvb") - }, - "Vb_vlut32_VbVbR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x128, &::I8x128, &::U32]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vlutvvb.128B") - }, - "Wh_vlut16_VbVhR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x64, &::I16x32, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vlutvwh") - }, - "Wh_vlut16_VbVhR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x128, &::I16x64, &::U32]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vlutvwh.128B") - }, - "Vb_vlut32or_VbVbVbR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 4] = [&::I8x64, &::I8x64, &::I8x64, &::U32]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vlutvvb.oracc") - }, - "Vb_vlut32or_VbVbVbR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 4] = [&::I8x128, &::I8x128, &::I8x128, &::U32]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vlutvvb.oracc.128B") - }, - "Wh_vlut16or_WhVbVhR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 4] = [&::I16x64, &::I8x64, &::I16x32, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vlutvwh.oracc") - }, - "Wh_vlut16or_WhVbVhR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 4] = [&::I16x128, &::I8x128, &::I16x64, &::U32]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vlutvwh.oracc.128B") - }, - "Vh_vmax_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vmaxh") - }, - "Vw_vmax_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmaxw") - }, - "Vh_vmax_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmaxh.128B") - }, - "Vw_vmax_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmaxw.128B") - }, - "Vub_vmax_VubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vmaxub") - }, - "Vuh_vmax_VuhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vmaxuh") - }, - "Vub_vmax_VubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vmaxub.128B") - }, - "Vuh_vmax_VuhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vmaxuh.128B") - }, - "Vh_vmin_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vminh") - }, - "Vw_vmin_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vminw") - }, - "Vh_vmin_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vminh.128B") - }, - "Vw_vmin_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vminw.128B") - }, - "Vub_vmin_VubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vminub") - }, - "Vuh_vmin_VuhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vminuh") - }, - "Vub_vmin_VubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vminub.128B") - }, - "Vuh_vmin_VuhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vminuh.128B") - }, - "Wh_vmpa_WubRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpabus") - }, - "Wh_vmpa_WubRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U32]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vmpabus.128B") - }, - "Wh_vmpaacc_WhWubRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::U8x128, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpabus.acc") - }, - "Wh_vmpaacc_WhWubRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::U8x256, &::U32]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vmpabus.acc.128B") - }, - "Wh_vmpa_WubWb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::I8x128]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpabusv") - }, - "Wh_vmpa_WubWub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpabuuv") - }, - "Wh_vmpa_WubWb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::I8x256]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vmpabusv.128B") - }, - "Wh_vmpa_WubWub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U8x256]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vmpabuuv.128B") - }, - "Ww_vmpa_WhRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpahb") - }, - "Ww_vmpa_WhRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::U32]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vmpahb.128B") - }, - "Ww_vmpaacc_WwWhRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpahb.acc") - }, - "Ww_vmpaacc_WwWhRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::I16x128, &::U32]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vmpahb.acc.128B") - }, - "Wh_vmpy_VbVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::U8x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpybus") - }, - "Ww_vmpy_VhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U16x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyhus") - }, - "Wh_vmpy_VbVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::U8x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vmpybus.128B") - }, - "Ww_vmpy_VhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U16x64]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vmpyhus.128B") - }, - "Wh_vmpyacc_WhVbVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I8x64, &::U8x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpybus.acc") - }, - "Ww_vmpyacc_WwVhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x32, &::U16x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyhus.acc") - }, - "Wh_vmpyacc_WhVbVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::I8x128, &::U8x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vmpybus.acc.128B") - }, - "Ww_vmpyacc_WwVhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::I16x64, &::U16x64]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vmpyhus.acc.128B") - }, - "Wh_vmpy_VubVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::I8x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpybusv") - }, - "Wh_vmpy_VubVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::I8x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vmpybusv.128B") - }, - "Wh_vmpyacc_WhVubVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::U8x64, &::I8x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpybusv.acc") - }, - "Wh_vmpyacc_WhVubVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::U8x128, &::I8x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vmpybusv.acc.128B") - }, - "Wh_vmpy_VbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpybv") - }, - "Wuh_vmpy_VubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vmpyubv") - }, - "Ww_vmpy_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyhv") - }, - "Wuw_vmpy_VuhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vmpyuhv") - }, - "Wh_vmpy_VbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vmpybv.128B") - }, - "Wuh_vmpy_VubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U16x128, - definition: Named("llvm.hexagon.V6.vmpyubv.128B") - }, - "Ww_vmpy_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vmpyhv.128B") - }, - "Wuw_vmpy_VuhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vmpyuhv.128B") - }, - "Wh_vmpyacc_WhVbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I8x64, &::I8x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpybv.acc") - }, - "Wuh_vmpyacc_WuhVubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U16x64, &::U8x64, &::U8x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vmpyubv.acc") - }, - "Ww_vmpyacc_WwVhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x32, &::I16x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyhv.acc") - }, - "Wuw_vmpyacc_WuwVuhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U16x32, &::U16x32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vmpyuhv.acc") - }, - "Wh_vmpyacc_WhVbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::I8x128, &::I8x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vmpybv.acc.128B") - }, - "Wuh_vmpyacc_WuhVubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U16x128, &::U8x128, &::U8x128]; &INPUTS }, - output: &::U16x128, - definition: Named("llvm.hexagon.V6.vmpyubv.acc.128B") - }, - "Ww_vmpyacc_WwVhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::I16x64, &::I16x64]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vmpyhv.acc.128B") - }, - "Wuw_vmpyacc_WuwVuhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x64, &::U16x64, &::U16x64]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vmpyuhv.acc.128B") - }, - "Vw_vmpye_VwVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U16x32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyewuh") - }, - "Vw_vmpye_VwVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U16x64]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyewuh.128B") - }, - "Ww_vmpy_VhRh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyh") - }, - "Wuw_vmpy_VuhRuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vmpyuh") - }, - "Ww_vmpy_VhRh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vmpyh.128B") - }, - "Wuw_vmpy_VuhRuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U32]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vmpyuh.128B") - }, - "Ww_vmpyacc_WwVhRh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x32, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyhsat.acc") - }, - "Ww_vmpyacc_WwVhRh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::I16x64, &::U32]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vmpyhsat.acc.128B") - }, - "Vw_vmpy_VhRh_s1_rnd_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyhsrs") - }, - "Vw_vmpy_VhRh_s1_rnd_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyhsrs.128B") - }, - "Vw_vmpy_VhRh_s1_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyhss") - }, - "Vw_vmpy_VhRh_s1_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyhss.128B") - }, - "Vh_vmpy_VhVh_s1_rnd_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vmpyhvsrs") - }, - "Vh_vmpy_VhVh_s1_rnd_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpyhvsrs.128B") - }, - "Vw_vmpyieo_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyieoh") - }, - "Vw_vmpyieo_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyieoh.128B") - }, - "Vw_vmpyieacc_VwVwVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::I16x32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyiewh.acc") - }, - "Vw_vmpyieacc_VwVwVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U16x32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyiewuh.acc") - }, - "Vw_vmpyieacc_VwVwVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::I16x64]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyiewh.acc.128B") - }, - "Vw_vmpyieacc_VwVwVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U16x64]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyiewuh.acc.128B") - }, - "Vw_vmpyie_VwVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U16x32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyiewuh") - }, - "Vw_vmpyie_VwVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U16x64]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyiewuh.128B") - }, - "Vh_vmpyi_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vmpyih") - }, - "Vh_vmpyi_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpyih.128B") - }, - "Vh_vmpyiacc_VhVhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vmpyih.acc") - }, - "Vh_vmpyiacc_VhVhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpyih.acc.128B") - }, - "Vh_vmpyi_VhRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::U32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vmpyihb") - }, - "Vw_vmpyi_VwRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyiwb") - }, - "Vh_vmpyi_VhRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpyihb.128B") - }, - "Vw_vmpyi_VwRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyiwb.128B") - }, - "Vh_vmpyiacc_VhVhRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x32, &::I16x32, &::U32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vmpyihb.acc") - }, - "Vw_vmpyiacc_VwVwRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyiwb.acc") - }, - "Vh_vmpyiacc_VhVhRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I16x64, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vmpyihb.acc.128B") - }, - "Vw_vmpyiacc_VwVwRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyiwb.acc.128B") - }, - "Vw_vmpyi_VwRh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyiwh") - }, - "Vw_vmpyi_VwRh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyiwh.128B") - }, - "Vw_vmpyiacc_VwVwRh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyiwh.acc") - }, - "Vw_vmpyiacc_VwVwRh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyiwh.acc.128B") - }, - "Vw_vmpyi_VwRub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyiwub") - }, - "Vw_vmpyi_VwRub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyiwub.128B") - }, - "Vw_vmpyiacc_VwVwRub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I32x16, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyiwub.acc") - }, - "Vw_vmpyiacc_VwVwRub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I32x32, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyiwub.acc.128B") - }, - "Vw_vmpyo_VwVh_s1_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I16x32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyowh") - }, - "Vw_vmpyo_VwVh_s1_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I16x64]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyowh.128B") - }, - "Vw_vmpyo_VwVh_s1_rnd_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I16x32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyowh.rnd") - }, - "Vw_vmpyo_VwVh_s1_rnd_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I16x64]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyowh.rnd.128B") - }, - "Vw_vmpyo_VwVh_s1_rnd_sat_shift64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I16x32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyowh.rnd.sacc") - }, - "Vw_vmpyo_VwVh_s1_rnd_sat_shift128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I16x64]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyowh.rnd.sacc.128B") - }, - "Vw_vmpyo_VwVh_s1_sat_shift64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I16x32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyowh.sacc") - }, - "Vw_vmpyo_VwVh_s1_sat_shift128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I16x64]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyowh.sacc.128B") - }, - "Vw_vmpyio_VwVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I16x32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vmpyiowh") - }, - "Vw_vmpyio_VwVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I16x64]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vmpyiowh.128B") - }, - "Wuh_vmpy_VubRub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U32]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vmpyub") - }, - "Wuh_vmpy_VubRub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS }, - output: &::U16x128, - definition: Named("llvm.hexagon.V6.vmpyub.128B") - }, - "Wuh_vmpyacc_WuhVubRub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U16x64, &::U8x64, &::U32]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vmpyub.acc") - }, - "Wuw_vmpyacc_WuwVuhRuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U16x32, &::U32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vmpyuh.acc") - }, - "Wuh_vmpyacc_WuhVubRub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U16x128, &::U8x128, &::U32]; &INPUTS }, - output: &::U16x128, - definition: Named("llvm.hexagon.V6.vmpyub.acc.128B") - }, - "Wuw_vmpyacc_WuwVuhRuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x64, &::U16x64, &::U32]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vmpyuh.acc.128B") - }, - "Vuw_vmux_QVV64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U32x16, &::U32x16]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.vmux") - }, - "Vuw_vmux_QVV128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U32x32, &::U32x32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vmux.128B") - }, - "Vh_vnavg_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vnavgh") - }, - "Vuh_vnavg_VuhVuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vnavguh") - }, - "Vw_vnavg_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vnavgw") - }, - "Vuw_vnavg_VuwVuw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x16, &::U32x16]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.vnavguw") - }, - "Vh_vnavg_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vnavgh.128B") - }, - "Vuh_vnavg_VuhVuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vnavguh.128B") - }, - "Vw_vnavg_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vnavgw.128B") - }, - "Vuw_vnavg_VuwVuw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x32, &::U32x32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vnavguw.128B") - }, - "Vub_vnavg_VubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vnavgub") - }, - "Vub_vnavg_VubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vnavgub.128B") - }, - "Vh_vnormamt_Vh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vnormamth") - }, - "Vw_vnormamt_Vw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vnormamtw") - }, - "Vh_vnormamt_Vh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vnormamth.128B") - }, - "Vw_vnormamt_Vw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vnormamtw.128B") - }, - "V_vnot_VV64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vnot") - }, - "V_vnot_VV128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vnot.128B") - }, - "V_vor_VV64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vor") - }, - "V_vor_VV128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vor.128B") - }, - "Vb_vpacke_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vpackhe") - }, - "Vh_vpacke_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vpackwe") - }, - "Vb_vpacke_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vpackhe.128B") - }, - "Vh_vpacke_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vpackwe.128B") - }, - "Vb_vpacko_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vpackho") - }, - "Vh_vpacko_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vpackwo") - }, - "Vb_vpacko_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vpackho.128B") - }, - "Vh_vpacko_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vpackwo.128B") - }, - "Vb_vpack_VhVh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vpackhb.sat") - }, - "Vub_vpack_VhVh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vpackhub.sat") - }, - "Vh_vpack_VwVw_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vpackwh.sat") - }, - "Vuh_vpack_VwVw_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vpackwuh.sat") - }, - "Vb_vpack_VhVh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vpackhb.sat.128B") - }, - "Vub_vpack_VhVh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vpackhub.sat.128B") - }, - "Vh_vpack_VwVw_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vpackwh.sat.128B") - }, - "Vuh_vpack_VwVw_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vpackwuh.sat.128B") - }, - "Vh_vpopcount_Vh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vpopcounth") - }, - "Vh_vpopcount_Vh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vpopcounth.128B") - }, - "V_vrdelta_VV64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vrdelta") - }, - "V_vrdelta_VV128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vrdelta.128B") - }, - "Vw_vrmpy_VubRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vrmpybus") - }, - "Vw_vrmpy_VubRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vrmpybus.128B") - }, - "Vw_vrmpyacc_VwVubRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::U8x64, &::U32]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vrmpybus.acc") - }, - "Vw_vrmpyacc_VwVubRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::U8x128, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vrmpybus.acc.128B") - }, - "Ww_vrmpy_WubRbI64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vrmpybusi") - }, - "Ww_vrmpy_WubRbI128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U32]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vrmpybusi.128B") - }, - "Ww_vrmpyacc_WwWubRbI64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::U8x128, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vrmpybusi.acc") - }, - "Ww_vrmpyacc_WwWubRbI128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::U8x256, &::U32]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vrmpybusi.acc.128B") - }, - "Vw_vrmpy_VubVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::I8x64]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vrmpybusv") - }, - "Vw_vrmpy_VubVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::I8x128]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vrmpybusv.128B") - }, - "Vw_vrmpyacc_VwVubVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::U8x64, &::I8x64]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vrmpybusv.acc") - }, - "Vw_vrmpyacc_VwVubVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::U8x128, &::I8x128]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vrmpybusv.acc.128B") - }, - "Vw_vrmpy_VbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vrmpybv") - }, - "Vuw_vrmpy_VubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.vrmpyubv") - }, - "Vw_vrmpy_VbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vrmpybv.128B") - }, - "Vuw_vrmpy_VubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vrmpyubv.128B") - }, - "Vw_vrmpyacc_VwVbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x16, &::I8x64, &::I8x64]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vrmpywv.acc") - }, - "Vuw_vrmpyacc_VuwVubVub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x16, &::U8x64, &::U8x64]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.vrmpyuwv.acc") - }, - "Vw_vrmpyacc_VwVbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I8x128, &::I8x128]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vrmpywv.acc.128B") - }, - "Vuw_vrmpyacc_VuwVubVub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U8x128, &::U8x128]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vrmpyuwv.acc.128B") - }, - "Vuw_vrmpy_VubRub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U32]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.vrmpyub") - }, - "Vuw_vrmpy_VubRub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vrmpyub.128B") - }, - "Vuw_vrmpyacc_VuwVubRub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x16, &::U8x64, &::U32]; &INPUTS }, - output: &::U32x16, - definition: Named("llvm.hexagon.V6.vrmpyub.acc") - }, - "Vuw_vrmpyacc_VuwVubRub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U8x128, &::U32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vrmpyub.acc.128B") - }, - "Wuw_vrmpy_WubRubI64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vrmpyubi") - }, - "Wuw_vrmpy_WubRubI128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U32]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vrmpyubi.128B") - }, - "Wuw_vrmpyacc_WuwWubRubI64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U8x128, &::U32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vrmpyubi.acc") - }, - "Wuw_vrmpyacc_WuwWubRubI128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x64, &::U8x256, &::U32]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vrmpyubi.acc.128B") - }, - "V_vror_VR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U32]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vror") - }, - "V_vror_VR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vror.128B") - }, - "Vb_vround_VhVh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vroundhb") - }, - "Vub_vround_VhVh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vroundhub") - }, - "Vh_vround_VwVw_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vroundwh") - }, - "Vuh_vround_VwVw_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vroundwuh") - }, - "Vb_vround_VhVh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vroundhb.128B") - }, - "Vub_vround_VhVh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vroundhub.128B") - }, - "Vh_vround_VwVw_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vroundwh.128B") - }, - "Vuh_vround_VwVw_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vroundwuh.128B") - }, - "Wuw_vrsad_WubRubI64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vrsadubi") - }, - "Wuw_vrsad_WubRubI128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U32]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vrsadubi.128B") - }, - "Wuw_vrsadacc_WuwWubRubI64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x32, &::U8x128, &::U32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vrsadubi.acc") - }, - "Wuw_vrsadacc_WuwWubRubI128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x64, &::U8x256, &::U32]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vrsadubi.acc.128B") - }, - "Vub_vsat_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vsathub") - }, - "Vub_vsat_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vsathub.128B") - }, - "Vh_vsat_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vsatwh") - }, - "Vh_vsat_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vsatwh.128B") - }, - "Wh_vsxt_Vb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vsb") - }, - "Ww_vsxt_Vh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vsh") - }, - "Wh_vsxt_Vb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vsb.128B") - }, - "Ww_vsxt_Vh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vsh.128B") - }, - "Wuh_vzxt_Vub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vzb") - }, - "Wuw_vzxt_Vuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vzh") - }, - "Wuh_vzxt_Vub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x128]; &INPUTS }, - output: &::U16x128, - definition: Named("llvm.hexagon.V6.vzb.128B") - }, - "Wuw_vzxt_Vuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x64]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vzh.128B") - }, - "Vb_condacc_QVbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vaddbq") - }, - "Vh_condacc_QVhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vaddhq") - }, - "Vw_condacc_QVwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vaddwq") - }, - "Vb_condacc_QVbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vaddbq.128B") - }, - "Vh_condacc_QVhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vaddhq.128B") - }, - "Vw_condacc_QVwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vaddwq.128B") - }, - "Vb_condacc_QnVbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vaddbnq") - }, - "Vh_condacc_QnVhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vaddhnq") - }, - "Vw_condacc_QnVwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vaddwnq") - }, - "Vb_condacc_QnVbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vaddbnq.128B") - }, - "Vh_condacc_QnVhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vaddhnq.128B") - }, - "Vw_condacc_QnVwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vaddwnq.128B") - }, - "Vb_condnac_QVbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vsubbq") - }, - "Vh_condnac_QVhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vsubhq") - }, - "Vw_condnac_QVwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vsubwq") - }, - "Vb_condnac_QVbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vsubbq.128B") - }, - "Vh_condnac_QVhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vsubhq.128B") - }, - "Vw_condnac_QVwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vsubwq.128B") - }, - "Vb_condnac_QnVbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I8x64, &::I8x64]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vsubbnq") - }, - "Vh_condnac_QnVhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vsubhnq") - }, - "Vw_condnac_QnVwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vsubwnq") - }, - "Vb_condnac_QnVbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I8x128, &::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vsubbnq.128B") - }, - "Vh_condnac_QnVhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vsubhnq.128B") - }, - "Vw_condnac_QnVwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vsubwnq.128B") - }, - "Vh_vshuffe_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vshufeh") - }, - "Vh_vshuffe_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vshufeh.128B") - }, - "Vh_vshuffo_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vshufoh") - }, - "Vh_vshuffo_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vshufoh.128B") - }, - "Vb_vshuff_Vb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x64]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vshuffb") - }, - "Vh_vshuff_Vh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vshuffh") - }, - "Vb_vshuff_Vb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vshuffb.128B") - }, - "Vh_vshuff_Vh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vshuffh.128B") - }, - "Vb_vshuffe_VbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vshuffeb") - }, - "Vb_vshuffe_VbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vshuffeb.128B") - }, - "Vb_vshuffo_VbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vshuffob") - }, - "Vb_vshuffo_VbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vshuffob.128B") - }, - "Vb_vshuffoe_VbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vshuffoeb") - }, - "Vh_vshuffoe_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vshuffoeh") - }, - "Vb_vshuffoe_VbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vshuffoeb.128B") - }, - "Vh_vshuffoe_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vshuffoeh.128B") - }, - "W_vshuff_VVR64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x64, &::U8x64, &::U32]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vshufvvd") - }, - "W_vshuff_VVR128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x128, &::U8x128, &::U32]; &INPUTS }, - output: &::U8x256, - definition: Named("llvm.hexagon.V6.vshufvvd.128B") - }, - "Vb_vsub_VbVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x64, &::I8x64]; &INPUTS }, - output: &::I8x64, - definition: Named("llvm.hexagon.V6.vsubb") - }, - "Vh_vsub_VhVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vsubh") - }, - "Vw_vsub_VwVw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vsubw") - }, - "Vb_vsub_VbVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vsubb.128B") - }, - "Vh_vsub_VhVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vsubh.128B") - }, - "Vw_vsub_VwVw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vsubw.128B") - }, - "Vh_vsub_VhVh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x32, &::I16x32]; &INPUTS }, - output: &::I16x32, - definition: Named("llvm.hexagon.V6.vsubhsat") - }, - "Vw_vsub_VwVw_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x16, &::I32x16]; &INPUTS }, - output: &::I32x16, - definition: Named("llvm.hexagon.V6.vsubwsat") - }, - "Vh_vsub_VhVh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vsubhsat.128B") - }, - "Vw_vsub_VwVw_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vsubwsat.128B") - }, - "Vub_vsub_VubVub_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x64, &::U8x64]; &INPUTS }, - output: &::U8x64, - definition: Named("llvm.hexagon.V6.vsububsat") - }, - "Vuh_vsub_VuhVuh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vsubuhsat") - }, - "Vub_vsub_VubVub_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vsububsat.128B") - }, - "Vuh_vsub_VuhVuh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vsubuhsat.128B") - }, - "Wb_vsub_WbWb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::I8x128]; &INPUTS }, - output: &::I8x128, - definition: Named("llvm.hexagon.V6.vsubb.dv") - }, - "Wh_vsub_WhWh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vsubh.dv") - }, - "Ww_vsub_WwWw64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vsubw.dv") - }, - "Wb_vsub_WbWb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x256, &::I8x256]; &INPUTS }, - output: &::I8x256, - definition: Named("llvm.hexagon.V6.vsubb.dv.128B") - }, - "Wh_vsub_WhWh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::I16x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vsubh.dv.128B") - }, - "Ww_vsub_WwWw128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x64, &::I32x64]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vsubw.dv.128B") - }, - "Wh_vsub_WhWh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I16x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vsubhsat.dv") - }, - "Ww_vsub_WwWw_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I32x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vsubwsat.dv") - }, - "Wh_vsub_WhWh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::I16x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vsubhsat.dv.128B") - }, - "Ww_vsub_WwWw_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x64, &::I32x64]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vsubwsat.dv.128B") - }, - "Wub_vsub_WubWub_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vsububsat.dv") - }, - "Wuh_vsub_WuhWuh_sat64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vsubuhsat.dv") - }, - "Wub_vsub_WubWub_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U8x256]; &INPUTS }, - output: &::U8x256, - definition: Named("llvm.hexagon.V6.vsububsat.dv.128B") - }, - "Wuh_vsub_WuhWuh_sat128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x128, &::U16x128]; &INPUTS }, - output: &::U16x128, - definition: Named("llvm.hexagon.V6.vsubuhsat.dv.128B") - }, - "W_vswap_QVV64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x2, &::U8x64, &::U8x64]; &INPUTS }, - output: &::U8x128, - definition: Named("llvm.hexagon.V6.vswap") - }, - "W_vswap_QVV128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U32x4, &::U8x128, &::U8x128]; &INPUTS }, - output: &::U8x256, - definition: Named("llvm.hexagon.V6.vswap.128B") - }, - "Wh_vtmpy_WbRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x128, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vtmpyb") - }, - "Wh_vtmpy_WbRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x256, &::U32]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vtmpyb.128B") - }, - "Wh_vtmpyacc_WhWbRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::I8x128, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vtmpyb.acc") - }, - "Wh_vtmpyacc_WhWbRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::I8x256, &::U32]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vtmpyb.acc.128B") - }, - "Wh_vtmpy_WubRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x128, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vtmpybus") - }, - "Wh_vtmpy_WubRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x256, &::U32]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vtmpybus.128B") - }, - "Wh_vtmpyacc_WhWubRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x64, &::U8x128, &::U32]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vtmpybus.acc") - }, - "Wh_vtmpyacc_WhWubRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x128, &::U8x256, &::U32]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vtmpybus.acc.128B") - }, - "Ww_vtmpy_WhRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vtmpyhb") - }, - "Ww_vtmpy_WhRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::U32]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vtmpyhb.128B") - }, - "Wh_vunpack_Vb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vunpackb") - }, - "Wuh_vunpack_Vub64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vunpackub") - }, - "Ww_vunpack_Vh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vunpackh") - }, - "Wuw_vunpack_Vuh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x32]; &INPUTS }, - output: &::U32x32, - definition: Named("llvm.hexagon.V6.vunpackuh") - }, - "Wh_vunpack_Vb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vunpackb.128B") - }, - "Wuh_vunpack_Vub128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U8x128]; &INPUTS }, - output: &::U16x128, - definition: Named("llvm.hexagon.V6.vunpackub.128B") - }, - "Ww_vunpack_Vh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x64]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vunpackh.128B") - }, - "Wuw_vunpack_Vuh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x64]; &INPUTS }, - output: &::U32x64, - definition: Named("llvm.hexagon.V6.vunpackuh.128B") - }, - "Wh_vunpackoor_WhVb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x64, &::I8x64]; &INPUTS }, - output: &::I16x64, - definition: Named("llvm.hexagon.V6.vunpackob") - }, - "Ww_vunpackoor_WwVh64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x32, &::I16x32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vunpackoh") - }, - "Wh_vunpackoor_WhVb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x128, &::I8x128]; &INPUTS }, - output: &::I16x128, - definition: Named("llvm.hexagon.V6.vunpackob.128B") - }, - "Ww_vunpackoor_WwVh128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x64, &::I16x64]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vunpackoh.128B") - }, - "Ww_vtmpyacc_WwWhRb64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x32, &::I16x64, &::U32]; &INPUTS }, - output: &::I32x32, - definition: Named("llvm.hexagon.V6.vtmpyhb.acc") - }, - "Ww_vtmpyacc_WwWhRb128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x64, &::I16x128, &::U32]; &INPUTS }, - output: &::I32x64, - definition: Named("llvm.hexagon.V6.vtmpyhb.acc.128B") - }, - "V_vxor_VV64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x32, &::U16x32]; &INPUTS }, - output: &::U16x32, - definition: Named("llvm.hexagon.V6.vxor") - }, - "V_vxor_VV128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x64, &::U16x64]; &INPUTS }, - output: &::U16x64, - definition: Named("llvm.hexagon.V6.vxor.128B") - }, - _ => return None, - }) -} diff --git a/src/librustc_platform_intrinsics/lib.rs b/src/librustc_platform_intrinsics/lib.rs deleted file mode 100644 index ca262807817..00000000000 --- a/src/librustc_platform_intrinsics/lib.rs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(nonstandard_style)] - -#![feature(nll)] - -pub struct Intrinsic { - pub inputs: &'static [&'static Type], - pub output: &'static Type, - - pub definition: IntrinsicDef, -} - -#[derive(Clone, Hash, Eq, PartialEq)] -pub enum Type { - Void, - Integer(/* signed */ bool, u8, /* llvm width */ u8), - Float(u8), - Pointer(&'static Type, Option<&'static Type>, /* const */ bool), - Vector(&'static Type, Option<&'static Type>, u16), - Aggregate(bool, &'static [&'static Type]), -} - -pub enum IntrinsicDef { - Named(&'static str), -} - -static I8: Type = Type::Integer(true, 8, 8); -static I16: Type = Type::Integer(true, 16, 16); -static I32: Type = Type::Integer(true, 32, 32); -static I64: Type = Type::Integer(true, 64, 64); -static U8: Type = Type::Integer(false, 8, 8); -static U16: Type = Type::Integer(false, 16, 16); -static U32: Type = Type::Integer(false, 32, 32); -static U64: Type = Type::Integer(false, 64, 64); -static F32: Type = Type::Float(32); -static F64: Type = Type::Float(64); - -static I32_8: Type = Type::Integer(true, 32, 8); - -static I8x8: Type = Type::Vector(&I8, None, 8); -static U8x8: Type = Type::Vector(&U8, None, 8); -static I8x16: Type = Type::Vector(&I8, None, 16); -static U8x16: Type = Type::Vector(&U8, None, 16); -static I8x32: Type = Type::Vector(&I8, None, 32); -static U8x32: Type = Type::Vector(&U8, None, 32); -static I8x64: Type = Type::Vector(&I8, None, 64); -static U8x64: Type = Type::Vector(&U8, None, 64); -static I8x128: Type = Type::Vector(&I8, None, 128); -static U8x128: Type = Type::Vector(&U8, None, 128); -static I8x256: Type = Type::Vector(&I8, None, 256); -static U8x256: Type = Type::Vector(&U8, None, 256); - -static I16x4: Type = Type::Vector(&I16, None, 4); -static U16x4: Type = Type::Vector(&U16, None, 4); -static I16x8: Type = Type::Vector(&I16, None, 8); -static U16x8: Type = Type::Vector(&U16, None, 8); -static I16x16: Type = Type::Vector(&I16, None, 16); -static U16x16: Type = Type::Vector(&U16, None, 16); -static I16x32: Type = Type::Vector(&I16, None, 32); -static U16x32: Type = Type::Vector(&U16, None, 32); -static I16x64: Type = Type::Vector(&I16, None, 64); -static U16x64: Type = Type::Vector(&U16, None, 64); -static I16x128: Type = Type::Vector(&I16, None, 128); -static U16x128: Type = Type::Vector(&U16, None, 128); - -static I32x2: Type = Type::Vector(&I32, None, 2); -static U32x2: Type = Type::Vector(&U32, None, 2); -static I32x4: Type = Type::Vector(&I32, None, 4); -static U32x4: Type = Type::Vector(&U32, None, 4); -static I32x8: Type = Type::Vector(&I32, None, 8); -static U32x8: Type = Type::Vector(&U32, None, 8); -static I32x16: Type = Type::Vector(&I32, None, 16); -static U32x16: Type = Type::Vector(&U32, None, 16); -static I32x32: Type = Type::Vector(&I32, None, 32); -static U32x32: Type = Type::Vector(&U32, None, 32); -static I32x64: Type = Type::Vector(&I32, None, 64); -static U32x64: Type = Type::Vector(&U32, None, 64); - -static I64x1: Type = Type::Vector(&I64, None, 1); -static U64x1: Type = Type::Vector(&U64, None, 1); -static I64x2: Type = Type::Vector(&I64, None, 2); -static U64x2: Type = Type::Vector(&U64, None, 2); -static I64x4: Type = Type::Vector(&I64, None, 4); -static U64x4: Type = Type::Vector(&U64, None, 4); - -static F32x2: Type = Type::Vector(&F32, None, 2); -static F32x4: Type = Type::Vector(&F32, None, 4); -static F32x8: Type = Type::Vector(&F32, None, 8); -static F64x1: Type = Type::Vector(&F64, None, 1); -static F64x2: Type = Type::Vector(&F64, None, 2); -static F64x4: Type = Type::Vector(&F64, None, 4); - -static I32x4_F32: Type = Type::Vector(&I32, Some(&F32), 4); -static I32x8_F32: Type = Type::Vector(&I32, Some(&F32), 8); -static I64x2_F64: Type = Type::Vector(&I64, Some(&F64), 2); -static I64x4_F64: Type = Type::Vector(&I64, Some(&F64), 4); - -static VOID: Type = Type::Void; - -mod x86; -mod arm; -mod aarch64; -mod nvptx; -mod hexagon; -mod powerpc; - -impl Intrinsic { - pub fn find(name: &str) -> Option { - if name.starts_with("x86_") { - x86::find(name) - } else if name.starts_with("arm_") { - arm::find(name) - } else if name.starts_with("aarch64_") { - aarch64::find(name) - } else if name.starts_with("nvptx_") { - nvptx::find(name) - } else if name.starts_with("Q6_") { - hexagon::find(name) - } else if name.starts_with("powerpc_") { - powerpc::find(name) - } else { - None - } - } -} diff --git a/src/librustc_platform_intrinsics/nvptx.rs b/src/librustc_platform_intrinsics/nvptx.rs deleted file mode 100644 index 0c0ee429d0c..00000000000 --- a/src/librustc_platform_intrinsics/nvptx.rs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// DO NOT EDIT: autogenerated by etc/platform-intrinsics/generator.py -// ignore-tidy-linelength - -#![allow(unused_imports)] - -use {Intrinsic, Type}; -use IntrinsicDef::Named; - -pub fn find(name: &str) -> Option { - if !name.starts_with("nvptx") { return None } - Some(match &name["nvptx".len()..] { - "_syncthreads" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::VOID, - definition: Named("llvm.cuda.syncthreads") - }, - "_block_dim_x" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::I32, - definition: Named("llvm.nvvm.read.ptx.sreg.ntid.x") - }, - "_block_dim_y" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::I32, - definition: Named("llvm.nvvm.read.ptx.sreg.ntid.y") - }, - "_block_dim_z" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::I32, - definition: Named("llvm.nvvm.read.ptx.sreg.ntid.z") - }, - "_block_idx_x" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::I32, - definition: Named("llvm.nvvm.read.ptx.sreg.ctaid.x") - }, - "_block_idx_y" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::I32, - definition: Named("llvm.nvvm.read.ptx.sreg.ctaid.y") - }, - "_block_idx_z" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::I32, - definition: Named("llvm.nvvm.read.ptx.sreg.ctaid.z") - }, - "_grid_dim_x" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::I32, - definition: Named("llvm.nvvm.read.ptx.sreg.nctaid.x") - }, - "_grid_dim_y" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::I32, - definition: Named("llvm.nvvm.read.ptx.sreg.nctaid.y") - }, - "_grid_dim_z" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::I32, - definition: Named("llvm.nvvm.read.ptx.sreg.nctaid.z") - }, - "_thread_idx_x" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::I32, - definition: Named("llvm.nvvm.read.ptx.sreg.tid.x") - }, - "_thread_idx_y" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::I32, - definition: Named("llvm.nvvm.read.ptx.sreg.tid.y") - }, - "_thread_idx_z" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::I32, - definition: Named("llvm.nvvm.read.ptx.sreg.tid.z") - }, - _ => return None, - }) -} diff --git a/src/librustc_platform_intrinsics/powerpc.rs b/src/librustc_platform_intrinsics/powerpc.rs deleted file mode 100644 index 5c062c0ecec..00000000000 --- a/src/librustc_platform_intrinsics/powerpc.rs +++ /dev/null @@ -1,449 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// DO NOT EDIT: autogenerated by etc/platform-intrinsics/generator.py -// ignore-tidy-linelength - -#![allow(unused_imports)] - -use {Intrinsic, Type}; -use IntrinsicDef::Named; - -pub fn find(name: &str) -> Option { - if !name.starts_with("powerpc") { return None } - Some(match &name["powerpc".len()..] { - "_vec_perm" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I32x4, &::I32x4, &::I8x16]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vperm") - }, - "_vec_mradds" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x8, &::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vmhraddshs") - }, - "_vec_cmpb" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vcmpbfp") - }, - "_vec_cmpeqb" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ppc.altivec.vcmpequb") - }, - "_vec_cmpeqh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vcmpequh") - }, - "_vec_cmpeqw" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vcmpequw") - }, - "_vec_cmpgtub" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ppc.altivec.vcmpgtub") - }, - "_vec_cmpgtuh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vcmpgtuh") - }, - "_vec_cmpgtuw" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vcmpgtuw") - }, - "_vec_cmpgtsb" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ppc.altivec.vcmpgtsb") - }, - "_vec_cmpgtsh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vcmpgtsh") - }, - "_vec_cmpgtsw" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vcmpgtsw") - }, - "_vec_maxsb" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ppc.altivec.vmaxsb") - }, - "_vec_maxub" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.ppc.altivec.vmaxub") - }, - "_vec_maxsh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vmaxsh") - }, - "_vec_maxuh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.ppc.altivec.vmaxuh") - }, - "_vec_maxsw" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vmaxsw") - }, - "_vec_maxuw" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vmaxuw") - }, - "_vec_minsb" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ppc.altivec.vminsb") - }, - "_vec_minub" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.ppc.altivec.vminub") - }, - "_vec_minsh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vminsh") - }, - "_vec_minuh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.ppc.altivec.vminuh") - }, - "_vec_minsw" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vminsw") - }, - "_vec_minuw" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vminuw") - }, - "_vec_subsbs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ppc.altivec.vsubsbs") - }, - "_vec_sububs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.ppc.altivec.vsububs") - }, - "_vec_subshs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vsubshs") - }, - "_vec_subuhs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.ppc.altivec.vsubuhs") - }, - "_vec_subsws" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vsubsws") - }, - "_vec_subuws" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vsubuws") - }, - "_vec_subc" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vsubcuw") - }, - "_vec_addsbs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ppc.altivec.vaddsbs") - }, - "_vec_addubs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.ppc.altivec.vaddubs") - }, - "_vec_addshs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vaddshs") - }, - "_vec_adduhs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.ppc.altivec.vadduhs") - }, - "_vec_addsws" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vaddsws") - }, - "_vec_adduws" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vadduws") - }, - "_vec_addc" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vaddcuw") - }, - "_vec_mulesb" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vmulesb") - }, - "_vec_muleub" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.ppc.altivec.vmuleub") - }, - "_vec_mulesh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vmulesh") - }, - "_vec_muleuh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vmuleuh") - }, - "_vec_mulosb" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vmulosb") - }, - "_vec_muloub" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.ppc.altivec.vmuloub") - }, - "_vec_mulosh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vmulosh") - }, - "_vec_mulouh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vmulouh") - }, - "_vec_avgsb" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ppc.altivec.vavgsb") - }, - "_vec_avgub" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.ppc.altivec.vavgub") - }, - "_vec_avgsh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vavgsh") - }, - "_vec_avguh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.ppc.altivec.vavguh") - }, - "_vec_avgsw" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vavgsw") - }, - "_vec_avguw" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vavguw") - }, - "_vec_packssh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.ppc.altivec.vpkshss") - }, - "_vec_packsuh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.ppc.altivec.vpkuhus") - }, - "_vec_packssw" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vpkswss") - }, - "_vec_packsuw" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.ppc.altivec.vpkuwus") - }, - "_vec_packsush" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.ppc.altivec.vpkshus") - }, - "_vec_packsusw" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.ppc.altivec.vpkswus") - }, - "_vec_packpx" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vpkpx") - }, - "_vec_unpacklsb" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vupklsb") - }, - "_vec_unpacklsh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vupklsh") - }, - "_vec_unpackhsb" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vupkhsb") - }, - "_vec_unpackhsh" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vupkhsh") - }, - "_vec_madds" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x8, &::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.ppc.altivec.vmhaddshs") - }, - "_vec_msumubm" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x16, &::U8x16, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vmsumubm") - }, - "_vec_msumuhm" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U16x8, &::U16x8, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vmsumuhm") - }, - "_vec_msummbm" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x16, &::U8x16, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vmsummbm") - }, - "_vec_msumshm" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x8, &::I16x8, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vmsumshm") - }, - "_vec_msumshs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I16x8, &::I16x8, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vmsumshs") - }, - "_vec_msumuhs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U16x8, &::U16x8, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vmsumuhs") - }, - "_vec_sum2s" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vsum2sws") - }, - "_vec_sum4sbs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vsum4sbs") - }, - "_vec_sum4ubs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.ppc.altivec.vsum4ubs") - }, - "_vec_sum4shs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vsum4shs") - }, - "_vec_sums" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.ppc.altivec.vsumsws") - }, - "_vec_madd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x4, &::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.ppc.altivec.vmaddfp") - }, - "_vec_nmsub" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x4, &::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.ppc.altivec.vnmsubfp") - }, - "_vec_expte" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.ppc.altivec.vexptefp") - }, - "_vec_floor" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.ppc.altivec.vrfim") - }, - "_vec_ceil" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.ppc.altivec.vrfip") - }, - "_vec_round" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.ppc.altivec.vrfin") - }, - "_vec_trunc" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.ppc.altivec.vrfiz") - }, - "_vec_loge" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.ppc.altivec.vlogefp") - }, - "_vec_re" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.ppc.altivec.vrefp") - }, - "_vec_rsqrte" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.ppc.altivec.vrsqrtefp") - }, - _ => return None, - }) -} diff --git a/src/librustc_platform_intrinsics/x86.rs b/src/librustc_platform_intrinsics/x86.rs deleted file mode 100644 index 5c01c3a118d..00000000000 --- a/src/librustc_platform_intrinsics/x86.rs +++ /dev/null @@ -1,1379 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// DO NOT EDIT: autogenerated by etc/platform-intrinsics/generator.py -// ignore-tidy-linelength - -#![allow(unused_imports)] - -use {Intrinsic, Type}; -use IntrinsicDef::Named; - -pub fn find(name: &str) -> Option { - if !name.starts_with("x86") { return None } - Some(match &name["x86".len()..] { - "_mm256_abs_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x32]; &INPUTS }, - output: &::I8x32, - definition: Named("llvm.x86.avx2.pabs.b") - }, - "_mm256_abs_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x16]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.pabs.w") - }, - "_mm256_abs_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x8]; &INPUTS }, - output: &::I32x8, - definition: Named("llvm.x86.avx2.pabs.d") - }, - "_mm256_adds_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x32, &::I8x32]; &INPUTS }, - output: &::I8x32, - definition: Named("llvm.x86.avx2.padds.b") - }, - "_mm256_adds_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x32, &::U8x32]; &INPUTS }, - output: &::U8x32, - definition: Named("llvm.x86.avx2.paddus.b") - }, - "_mm256_adds_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.padds.w") - }, - "_mm256_adds_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x16, &::U16x16]; &INPUTS }, - output: &::U16x16, - definition: Named("llvm.x86.avx2.paddus.w") - }, - "_mm256_avg_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x32, &::U8x32]; &INPUTS }, - output: &::U8x32, - definition: Named("llvm.x86.avx2.pavg.b") - }, - "_mm256_avg_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x16, &::U16x16]; &INPUTS }, - output: &::U16x16, - definition: Named("llvm.x86.avx2.pavg.w") - }, - "_mm256_hadd_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.phadd.w") - }, - "_mm256_hadd_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x8, &::I32x8]; &INPUTS }, - output: &::I32x8, - definition: Named("llvm.x86.avx2.phadd.d") - }, - "_mm256_hadds_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.phadd.sw") - }, - "_mm256_hsub_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.phsub.w") - }, - "_mm256_hsub_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x8, &::I32x8]; &INPUTS }, - output: &::I32x8, - definition: Named("llvm.x86.avx2.phsub.d") - }, - "_mm256_hsubs_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.phsub.sw") - }, - "_mm256_madd_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I32x8, - definition: Named("llvm.x86.avx2.pmadd.wd") - }, - "_mm256_maddubs_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x32, &::I8x32]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.pmadd.ub.sw") - }, - "_mm_mask_i32gather_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I32x4, { static PTR: Type = Type::Pointer(&::I32, Some(&::I8), true); &PTR }, &::I32x4, &::I32x4, &::I32_8]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.avx2.gather.d.d") - }, - "_mm_mask_i32gather_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::F32x4, { static PTR: Type = Type::Pointer(&::F32, Some(&::I8), true); &PTR }, &::I32x4, &::I32x4_F32, &::I32_8]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.avx2.gather.d.ps") - }, - "_mm256_mask_i32gather_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I32x8, { static PTR: Type = Type::Pointer(&::I32, Some(&::I8), true); &PTR }, &::I32x8, &::I32x8, &::I32_8]; &INPUTS }, - output: &::I32x8, - definition: Named("llvm.x86.avx2.gather.d.d.256") - }, - "_mm256_mask_i32gather_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::F32x8, { static PTR: Type = Type::Pointer(&::F32, Some(&::I8), true); &PTR }, &::I32x8, &::I32x8_F32, &::I32_8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx2.gather.d.ps.256") - }, - "_mm_mask_i32gather_epi64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I64x2, { static PTR: Type = Type::Pointer(&::I64, Some(&::I8), true); &PTR }, &::I32x4, &::I64x2, &::I32_8]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.x86.avx2.gather.d.q") - }, - "_mm_mask_i32gather_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::F64x2, { static PTR: Type = Type::Pointer(&::F64, Some(&::I8), true); &PTR }, &::I32x4, &::I64x2_F64, &::I32_8]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.avx2.gather.d.pd") - }, - "_mm256_mask_i32gather_epi64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I64x4, { static PTR: Type = Type::Pointer(&::I64, Some(&::I8), true); &PTR }, &::I32x4, &::I64x4, &::I32_8]; &INPUTS }, - output: &::I64x4, - definition: Named("llvm.x86.avx2.gather.d.q.256") - }, - "_mm256_mask_i32gather_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::F64x4, { static PTR: Type = Type::Pointer(&::F64, Some(&::I8), true); &PTR }, &::I32x4, &::I64x4_F64, &::I32_8]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx2.gather.d.pd.256") - }, - "_mm_mask_i64gather_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I32x4, { static PTR: Type = Type::Pointer(&::I32, Some(&::I8), true); &PTR }, &::I64x2, &::I32x4, &::I32_8]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.avx2.gather.q.d") - }, - "_mm_mask_i64gather_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::F32x4, { static PTR: Type = Type::Pointer(&::F32, Some(&::I8), true); &PTR }, &::I64x2, &::I32x4_F32, &::I32_8]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.avx2.gather.q.ps") - }, - "_mm256_mask_i64gather_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I32x4, { static PTR: Type = Type::Pointer(&::I32, Some(&::I8), true); &PTR }, &::I64x4, &::I32x4, &::I32_8]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.avx2.gather.q.d") - }, - "_mm256_mask_i64gather_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::F32x4, { static PTR: Type = Type::Pointer(&::F32, Some(&::I8), true); &PTR }, &::I64x4, &::I32x4_F32, &::I32_8]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.avx2.gather.q.ps") - }, - "_mm_mask_i64gather_epi64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I64x2, { static PTR: Type = Type::Pointer(&::I64, Some(&::I8), true); &PTR }, &::I64x2, &::I64x2, &::I32_8]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.x86.avx2.gather.q.q") - }, - "_mm_mask_i64gather_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::F64x2, { static PTR: Type = Type::Pointer(&::F64, Some(&::I8), true); &PTR }, &::I64x2, &::I64x2_F64, &::I32_8]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.avx2.gather.q.pd") - }, - "_mm256_mask_i64gather_epi64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I64x4, { static PTR: Type = Type::Pointer(&::I64, Some(&::I8), true); &PTR }, &::I64x4, &::I64x4, &::I32_8]; &INPUTS }, - output: &::I64x4, - definition: Named("llvm.x86.avx2.gather.q.q.256") - }, - "_mm256_mask_i64gather_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::F64x4, { static PTR: Type = Type::Pointer(&::F64, Some(&::I8), true); &PTR }, &::I64x4, &::I64x4_F64, &::I32_8]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx2.gather.q.pd.256") - }, - "_mm_maskload_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::I32x4, Some(&::I8), true); &PTR }, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.avx2.maskload.d") - }, - "_mm_maskload_epi64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::I64x2, Some(&::I8), true); &PTR }, &::I64x2]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.x86.avx2.maskload.q") - }, - "_mm256_maskload_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::I32x8, Some(&::I8), true); &PTR }, &::I32x8]; &INPUTS }, - output: &::I32x8, - definition: Named("llvm.x86.avx2.maskload.d.256") - }, - "_mm256_maskload_epi64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::I64x4, Some(&::I8), true); &PTR }, &::I64x4]; &INPUTS }, - output: &::I64x4, - definition: Named("llvm.x86.avx2.maskload.q.256") - }, - "_mm_maskstore_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [{ static PTR: Type = Type::Pointer(&::I32, Some(&::I8), false); &PTR }, &::I32x4, &::I32x4]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx2.maskstore.d") - }, - "_mm_maskstore_epi64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [{ static PTR: Type = Type::Pointer(&::I64, Some(&::I8), false); &PTR }, &::I64x2, &::I64x2]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx2.maskstore.q") - }, - "_mm256_maskstore_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [{ static PTR: Type = Type::Pointer(&::I32, Some(&::I8), false); &PTR }, &::I32x8, &::I32x8]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx2.maskstore.d.256") - }, - "_mm256_maskstore_epi64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [{ static PTR: Type = Type::Pointer(&::I64, Some(&::I8), false); &PTR }, &::I64x4, &::I64x4]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx2.maskstore.q.256") - }, - "_mm256_max_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x32, &::I8x32]; &INPUTS }, - output: &::I8x32, - definition: Named("llvm.x86.avx2.pmaxs.b") - }, - "_mm256_max_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x32, &::U8x32]; &INPUTS }, - output: &::U8x32, - definition: Named("llvm.x86.avx2.pmaxu.b") - }, - "_mm256_max_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.pmaxs.w") - }, - "_mm256_max_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x16, &::U16x16]; &INPUTS }, - output: &::U16x16, - definition: Named("llvm.x86.avx2.pmaxu.w") - }, - "_mm256_max_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x8, &::I32x8]; &INPUTS }, - output: &::I32x8, - definition: Named("llvm.x86.avx2.pmaxs.d") - }, - "_mm256_max_epu32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x8, &::U32x8]; &INPUTS }, - output: &::U32x8, - definition: Named("llvm.x86.avx2.pmaxu.d") - }, - "_mm256_min_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x32, &::I8x32]; &INPUTS }, - output: &::I8x32, - definition: Named("llvm.x86.avx2.pmins.b") - }, - "_mm256_min_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x32, &::U8x32]; &INPUTS }, - output: &::U8x32, - definition: Named("llvm.x86.avx2.pminu.b") - }, - "_mm256_min_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.pmins.w") - }, - "_mm256_min_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x16, &::U16x16]; &INPUTS }, - output: &::U16x16, - definition: Named("llvm.x86.avx2.pminu.w") - }, - "_mm256_min_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x8, &::I32x8]; &INPUTS }, - output: &::I32x8, - definition: Named("llvm.x86.avx2.pmins.d") - }, - "_mm256_min_epu32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x8, &::U32x8]; &INPUTS }, - output: &::U32x8, - definition: Named("llvm.x86.avx2.pminu.d") - }, - "_mm256_movemask_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x32]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx2.pmovmskb") - }, - "_mm256_mpsadbw_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x32, &::U8x32, &::I32_8]; &INPUTS }, - output: &::U16x16, - definition: Named("llvm.x86.avx2.mpsadbw") - }, - "_mm256_mul_epi64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x8, &::I32x8]; &INPUTS }, - output: &::I64x4, - definition: Named("llvm.x86.avx2.pmulq.dq") - }, - "_mm256_mul_epu64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x8, &::U32x8]; &INPUTS }, - output: &::U64x4, - definition: Named("llvm.x86.avx2.pmulq.dq") - }, - "_mm256_mulhi_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.pmulhw.w") - }, - "_mm256_mulhi_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x16, &::U16x16]; &INPUTS }, - output: &::U16x16, - definition: Named("llvm.x86.avx2.pmulhw.w") - }, - "_mm256_mulhrs_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.pmul.hr.sw") - }, - "_mm256_packs_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I8x32, - definition: Named("llvm.x86.avx2.packsswb") - }, - "_mm256_packus_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::U8x32, - definition: Named("llvm.x86.avx2.packuswb") - }, - "_mm256_packs_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x8, &::I32x8]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.packssdw") - }, - "_mm256_packus_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x8, &::I32x8]; &INPUTS }, - output: &::U16x16, - definition: Named("llvm.x86.avx2.packusdw") - }, - "_mm256_permutevar8x32_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x8, &::I32x8]; &INPUTS }, - output: &::I32x8, - definition: Named("llvm.x86.avx2.permd") - }, - "_mm256_permutevar8x32_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x8, &::I32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx2.permps") - }, - "_mm256_sad_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x32, &::U8x32]; &INPUTS }, - output: &::U64x4, - definition: Named("llvm.x86.avx2.psad.bw") - }, - "_mm256_shuffle_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x32, &::I8x32]; &INPUTS }, - output: &::I8x32, - definition: Named("llvm.x86.avx2.pshuf.b") - }, - "_mm256_sign_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x32, &::I8x32]; &INPUTS }, - output: &::I8x32, - definition: Named("llvm.x86.avx2.psign.b") - }, - "_mm256_sign_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.psign.w") - }, - "_mm256_sign_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x8, &::I32x8]; &INPUTS }, - output: &::I32x8, - definition: Named("llvm.x86.avx2.psign.d") - }, - "_mm256_subs_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x32, &::I8x32]; &INPUTS }, - output: &::I8x32, - definition: Named("llvm.x86.avx2.psubs.b") - }, - "_mm256_subs_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x32, &::U8x32]; &INPUTS }, - output: &::U8x32, - definition: Named("llvm.x86.avx2.psubus.b") - }, - "_mm256_subs_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x16, &::I16x16]; &INPUTS }, - output: &::I16x16, - definition: Named("llvm.x86.avx2.psubs.w") - }, - "_mm256_subs_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x16, &::U16x16]; &INPUTS }, - output: &::U16x16, - definition: Named("llvm.x86.avx2.psubus.w") - }, - "_mm256_addsub_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x8, &::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.addsub.ps.256") - }, - "_mm256_addsub_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x4, &::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx.addsub.pd.256") - }, - "_mm256_blendv_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x8, &::F32x8, &::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.blendv.ps.256") - }, - "_mm256_blendv_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x4, &::F64x4, &::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx.blendv.pd.256") - }, - "_mm256_broadcast_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, None, true); &PTR }]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.vbroadcastf128.ps.256") - }, - "_mm256_broadcast_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::I8, None, true); &PTR }]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx.vbroadcastf128.pd.256") - }, - "_mm256_cmp_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x8, &::F32x8, &::I8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.cmp.ps.256") - }, - "_mm256_cmp_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x4, &::F64x4, &::I8]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx.cmp.pd.256") - }, - "_mm256_cvtepi32_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx.cvtdq2.pd.256") - }, - "_mm256_cvtepi32_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.cvtdq2.ps.256") - }, - "_mm256_cvtpd_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.avx.cvt.pd2dq.256") - }, - "_mm256_cvtpd_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.avx.cvt.pd2.ps.256") - }, - "_mm256_cvtps_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x8]; &INPUTS }, - output: &::I32x8, - definition: Named("llvm.x86.avx.cvt.ps2dq.256") - }, - "_mm256_cvtps_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx.cvt.ps2.pd.256") - }, - "_mm256_cvttpd_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.avx.cvtt.pd2dq.256") - }, - "_mm256_cvttps_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x8]; &INPUTS }, - output: &::I32x8, - definition: Named("llvm.x86.avx.cvtt.ps2dq.256") - }, - "_mm256_dp_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x8, &::F32x8, &::I32_8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.dp.ps.256") - }, - "_mm256_hadd_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x8, &::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.hadd.ps.256") - }, - "_mm256_hadd_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x4, &::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx.hadd.pd.256") - }, - "_mm256_hsub_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x8, &::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.hsub.ps.256") - }, - "_mm256_hsub_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x4, &::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx.hsub.pd.256") - }, - "_mm256_max_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x8, &::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.max.ps.256") - }, - "_mm256_max_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x4, &::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx.max.pd.256") - }, - "_mm_maskload_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::F32, Some(&::I8), true); &PTR }, &::I32x4_F32]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.avx.maskload.ps") - }, - "_mm_maskload_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::F64, Some(&::I8), true); &PTR }, &::I64x2_F64]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.avx.maskload.pd") - }, - "_mm256_maskload_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::F32, Some(&::I8), true); &PTR }, &::I32x8_F32]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.maskload.ps.256") - }, - "_mm256_maskload_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::F64, Some(&::I8), true); &PTR }, &::I64x4_F64]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx.maskload.pd.256") - }, - "_mm_maskstore_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [{ static PTR: Type = Type::Pointer(&::F32, Some(&::I8), false); &PTR }, &::I32x4_F32, &::F32x4]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx.maskstore.ps") - }, - "_mm_maskstore_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [{ static PTR: Type = Type::Pointer(&::F64, Some(&::I8), false); &PTR }, &::I64x2_F64, &::F64x2]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx.maskstore.pd") - }, - "_mm256_maskstore_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [{ static PTR: Type = Type::Pointer(&::F32, Some(&::I8), false); &PTR }, &::I32x8_F32, &::F32x8]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx.maskstore.ps.256") - }, - "_mm256_maskstore_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [{ static PTR: Type = Type::Pointer(&::F64, Some(&::I8), false); &PTR }, &::I64x4_F64, &::F64x4]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx.maskstore.pd.256") - }, - "_mm256_min_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x8, &::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.min.ps.256") - }, - "_mm256_min_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x4, &::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx.min.pd.256") - }, - "_mm256_movemask_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.movmsk.ps.256") - }, - "_mm256_movemask_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.movmsk.pd.256") - }, - "_mm_permutevar_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::I32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.avx.vpermilvar.ps") - }, - "_mm_permutevar_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::I64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.avx.vpermilvar.pd") - }, - "_mm256_permutevar_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x8, &::I32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.vpermilvar.ps.256") - }, - "_mm256_permutevar_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x4, &::I64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.avx.vpermilvar.pd.256") - }, - "_mm256_rcp_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.rcp.ps.256") - }, - "_mm256_rsqrt_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.avx.rsqrt.ps.256") - }, - "_mm256_storeu_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::F32x8, Some(&::U8), false); &PTR }, &::F32x8]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx.storeu.ps.256") - }, - "_mm256_storeu_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::F64x4, Some(&::U8), false); &PTR }, &::F64x4]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx.storeu.ps.256") - }, - "_mm256_storeu_si256" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::U8x32, Some(&::U8), false); &PTR }, &::U8x32]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx.storeu.dq.256") - }, - "_mm256_sqrt_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.sqrt.v8f32") - }, - "_mm256_sqrt_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.sqrt.v4f64") - }, - "_mm_testc_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.vtestc.ps") - }, - "_mm256_testc_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x8, &::F32x8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.vtestc.ps.256") - }, - "_mm_testc_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.vtestc.pd") - }, - "_mm256_testc_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x4, &::F64x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.vtestc.pd.256") - }, - "_mm256_testc_si256" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x4, &::U64x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.ptestc.256") - }, - "_mm_testnzc_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.vtestnzc.ps") - }, - "_mm256_testnzc_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x8, &::F32x8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.vtestnzc.ps.256") - }, - "_mm_testnzc_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.vtestnzc.pd") - }, - "_mm256_testnzc_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x4, &::F64x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.vtestnzc.pd.256") - }, - "_mm256_testnzc_si256" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x4, &::U64x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.ptestnzc.256") - }, - "_mm_testz_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.vtestz.ps") - }, - "_mm256_testz_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x8, &::F32x8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.vtestz.ps.256") - }, - "_mm_testz_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.vtestz.pd") - }, - "_mm256_testz_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x4, &::F64x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.vtestz.pd.256") - }, - "_mm256_testz_si256" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x4, &::U64x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.avx.ptestz.256") - }, - "_mm256_zeroall" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx.vzeroall") - }, - "_mm256_zeroupper" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.avx.vzeroupper") - }, - "_bmi2_bzhi_32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32, &::U32]; &INPUTS }, - output: &::U32, - definition: Named("llvm.x86.bmi.bzhi.32") - }, - "_bmi2_bzhi_64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64, &::U64]; &INPUTS }, - output: &::U64, - definition: Named("llvm.x86.bmi.bzhi.64") - }, - "_bmi2_pdep_32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32, &::U32]; &INPUTS }, - output: &::U32, - definition: Named("llvm.x86.bmi.pdep.32") - }, - "_bmi2_pdep_64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64, &::U64]; &INPUTS }, - output: &::U64, - definition: Named("llvm.x86.bmi.pdep.64") - }, - "_bmi2_pext_32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32, &::U32]; &INPUTS }, - output: &::U32, - definition: Named("llvm.x86.bmi.pext.32") - }, - "_bmi2_pext_64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64, &::U64]; &INPUTS }, - output: &::U64, - definition: Named("llvm.x86.bmi.pext.64") - }, - "_bmi_bextr_32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32, &::U32]; &INPUTS }, - output: &::U32, - definition: Named("llvm.x86.bmi.bextr.32") - }, - "_bmi_bextr_64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64, &::U64]; &INPUTS }, - output: &::U64, - definition: Named("llvm.x86.bmi.bextr.64") - }, - "_mm_fmadd_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x4, &::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.fma.vfmadd.ps") - }, - "_mm_fmadd_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x2, &::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.fma.vfmadd.pd") - }, - "_mm256_fmadd_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x8, &::F32x8, &::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.fma.vfmadd.ps.256") - }, - "_mm256_fmadd_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x4, &::F64x4, &::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.fma.vfmadd.pd.256") - }, - "_mm_fmaddsub_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x4, &::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.fma.vfmaddsub.ps") - }, - "_mm_fmaddsub_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x2, &::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.fma.vfmaddsub.pd") - }, - "_mm256_fmaddsub_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x8, &::F32x8, &::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.fma.vfmaddsub.ps.256") - }, - "_mm256_fmaddsub_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x4, &::F64x4, &::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.fma.vfmaddsub.pd.256") - }, - "_mm_fmsub_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x4, &::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.fma.vfmsub.ps") - }, - "_mm_fmsub_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x2, &::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.fma.vfmsub.pd") - }, - "_mm256_fmsub_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x8, &::F32x8, &::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.fma.vfmsub.ps.256") - }, - "_mm256_fmsub_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x4, &::F64x4, &::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.fma.vfmsub.pd.256") - }, - "_mm_fmsubadd_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x4, &::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.fma.vfmsubadd.ps") - }, - "_mm_fmsubadd_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x2, &::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.fma.vfmsubadd.pd") - }, - "_mm256_fmsubadd_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x8, &::F32x8, &::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.fma.vfmsubadd.ps.256") - }, - "_mm256_fmsubadd_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x4, &::F64x4, &::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.fma.vfmsubadd.pd.256") - }, - "_mm_fnmadd_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x4, &::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.fma.vfnmadd.ps") - }, - "_mm_fnmadd_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x2, &::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.fma.vfnmadd.pd") - }, - "_mm256_fnmadd_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x8, &::F32x8, &::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.fma.vfnmadd.ps.256") - }, - "_mm256_fnmadd_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x4, &::F64x4, &::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.fma.vfnmadd.pd.256") - }, - "_mm_fnmsub_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x4, &::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.fma.vfnmsub.ps") - }, - "_mm_fnmsub_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x2, &::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.fma.vfnmsub.pd") - }, - "_mm256_fnmsub_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x8, &::F32x8, &::F32x8]; &INPUTS }, - output: &::F32x8, - definition: Named("llvm.x86.fma.vfnmsub.ps.256") - }, - "_mm256_fnmsub_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x4, &::F64x4, &::F64x4]; &INPUTS }, - output: &::F64x4, - definition: Named("llvm.x86.fma.vfnmsub.pd.256") - }, - "_rdrand16_step" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U16, &::I32]; &PARTS }); &AGG }, - definition: Named("llvm.x86.rdrand.16") - }, - "_rdrand32_step" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U32, &::I32]; &PARTS }); &AGG }, - definition: Named("llvm.x86.rdrand.32") - }, - "_rdrand64_step" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U64, &::I32]; &PARTS }); &AGG }, - definition: Named("llvm.x86.rdrand.64") - }, - "_rdseed16_step" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U16, &::I32]; &PARTS }); &AGG }, - definition: Named("llvm.x86.rdseed.16") - }, - "_rdseed32_step" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U32, &::I32]; &PARTS }); &AGG }, - definition: Named("llvm.x86.rdseed.32") - }, - "_rdseed64_step" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: { static AGG: Type = Type::Aggregate(false, { static PARTS: [&'static Type; 2] = [&::U64, &::I32]; &PARTS }); &AGG }, - definition: Named("llvm.x86.rdseed.64") - }, - "_mm_adds_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.x86.sse2.padds.b") - }, - "_mm_adds_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.x86.sse2.paddus.b") - }, - "_mm_adds_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.sse2.padds.w") - }, - "_mm_adds_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.x86.sse2.paddus.w") - }, - "_mm_avg_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.x86.sse2.pavg.b") - }, - "_mm_avg_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.x86.sse2.pavg.w") - }, - "_mm_lfence" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.sse2.lfence") - }, - "_mm_madd_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.sse2.pmadd.wd") - }, - "_mm_maskmoveu_si128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x16, &::U8x16, { static PTR: Type = Type::Pointer(&::U8, None, false); &PTR }]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.sse2.maskmov.dqu") - }, - "_mm_max_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.sse2.pmaxs.w") - }, - "_mm_max_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.x86.sse2.pmaxu.b") - }, - "_mm_max_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.sse2.max.pd") - }, - "_mm_mfence" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.sse2.fence") - }, - "_mm_min_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.sse2.pmins.w") - }, - "_mm_min_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.x86.sse2.pminu.b") - }, - "_mm_min_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.sse2.min.pd") - }, - "_mm_movemask_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x2]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse2.movmsk.pd") - }, - "_mm_movemask_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse2.pmovmskb.128") - }, - "_mm_mul_epu32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.x86.sse2.pmulu.dq") - }, - "_mm_mulhi_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.sse2.pmulh.w") - }, - "_mm_mulhi_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.x86.sse2.pmulhu.w") - }, - "_mm_packs_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.x86.sse2.packsswb.128") - }, - "_mm_packs_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.sse2.packssdw.128") - }, - "_mm_packus_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.x86.sse2.packuswb.128") - }, - "_mm_sad_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U64x2, - definition: Named("llvm.x86.sse2.psad.bw") - }, - "_mm_sfence" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 0] = []; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.sse2.sfence") - }, - "_mm_sqrt_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.sqrt.v2f64") - }, - "_mm_storeu_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::F64, Some(&::U8), false); &PTR }, &::F64x2]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.sse2.storeu.pd") - }, - "_mm_storeu_si128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::U8x16, Some(&::U8), false); &PTR }, &::U8x16]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.sse2.storeu.dq") - }, - "_mm_subs_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.x86.sse2.psubs.b") - }, - "_mm_subs_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::U8x16]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.x86.sse2.psubus.b") - }, - "_mm_subs_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.sse2.psubs.w") - }, - "_mm_subs_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.x86.sse2.psubus.w") - }, - "_mm_addsub_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.sse3.addsub.ps") - }, - "_mm_addsub_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.sse3.addsub.pd") - }, - "_mm_hadd_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.sse3.hadd.ps") - }, - "_mm_hadd_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.sse3.hadd.pd") - }, - "_mm_hsub_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.sse3.hsub.ps") - }, - "_mm_hsub_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F64x2, &::F64x2]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.sse3.hsub.pd") - }, - "_mm_lddqu_si128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [{ static PTR: Type = Type::Pointer(&::U8x16, Some(&::I8), true); &PTR }]; &INPUTS }, - output: &::U8x16, - definition: Named("llvm.x86.sse3.ldu.dq") - }, - "_mm_dp_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F32x4, &::F32x4, &::I32_8]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.sse41.dpps") - }, - "_mm_dp_pd" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::F64x2, &::F64x2, &::I32_8]; &INPUTS }, - output: &::F64x2, - definition: Named("llvm.x86.sse41.dppd") - }, - "_mm_max_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.x86.sse41.pmaxsb") - }, - "_mm_max_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.x86.sse41.pmaxuw") - }, - "_mm_max_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.sse41.pmaxsd") - }, - "_mm_max_epu32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.x86.sse41.pmaxud") - }, - "_mm_min_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.x86.sse41.pminsb") - }, - "_mm_min_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U16x8, &::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.x86.sse41.pminuw") - }, - "_mm_min_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.sse41.pminsd") - }, - "_mm_min_epu32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32x4, &::U32x4]; &INPUTS }, - output: &::U32x4, - definition: Named("llvm.x86.sse41.pminud") - }, - "_mm_minpos_epu16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::U16x8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.x86.sse41.phminposuw") - }, - "_mm_mpsadbw_epu8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::U8x16, &::U8x16, &::I32_8]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.x86.sse41.mpsadbw") - }, - "_mm_mul_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I64x2, - definition: Named("llvm.x86.sse41.pmuldq") - }, - "_mm_packus_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::U16x8, - definition: Named("llvm.x86.sse41.packusdw") - }, - "_mm_testc_si128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse41.ptestc") - }, - "_mm_testnzc_si128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse41.ptestnzc") - }, - "_mm_testz_si128" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64x2, &::U64x2]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse41.ptestz") - }, - "_mm_cmpestra" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I8x16, &::I32, &::I8x16, &::I32, &::I32_8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse42.pcmpestria128") - }, - "_mm_cmpestrc" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I8x16, &::I32, &::I8x16, &::I32, &::I32_8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse42.pcmpestric128") - }, - "_mm_cmpestri" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I8x16, &::I32, &::I8x16, &::I32, &::I32_8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse42.pcmpestri128") - }, - "_mm_cmpestrm" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I8x16, &::I32, &::I8x16, &::I32, &::I32_8]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.x86.sse42.pcmpestrm128") - }, - "_mm_cmpestro" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I8x16, &::I32, &::I8x16, &::I32, &::I32_8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse42.pcmpestrio128") - }, - "_mm_cmpestrs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I8x16, &::I32, &::I8x16, &::I32, &::I32_8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse42.pcmpestris128") - }, - "_mm_cmpestrz" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 5] = [&::I8x16, &::I32, &::I8x16, &::I32, &::I32_8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse42.pcmpestriz128") - }, - "_mm_cmpistra" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I32_8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse42.pcmpistria128") - }, - "_mm_cmpistrc" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I32_8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse42.pcmpistric128") - }, - "_mm_cmpistri" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I32_8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse42.pcmpistri128") - }, - "_mm_cmpistrm" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I32_8]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.x86.sse42.pcmpistrm128") - }, - "_mm_cmpistro" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I32_8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse42.pcmpistrio128") - }, - "_mm_cmpistrs" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I32_8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse42.pcmpistris128") - }, - "_mm_cmpistrz" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 3] = [&::I8x16, &::I8x16, &::I32_8]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse42.pcmpistriz128") - }, - "_mm_movemask_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::I32, - definition: Named("llvm.x86.sse.movmsk.ps") - }, - "_mm_max_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.sse.max.ps") - }, - "_mm_min_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::F32x4, &::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.sse.min.ps") - }, - "_mm_rsqrt_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.sse.rsqrt.ps") - }, - "_mm_rcp_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.x86.sse.rcp.ps") - }, - "_mm_sqrt_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::F32x4]; &INPUTS }, - output: &::F32x4, - definition: Named("llvm.sqrt.v4f32") - }, - "_mm_storeu_ps" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [{ static PTR: Type = Type::Pointer(&::F32, Some(&::I8), false); &PTR }, &::F32x4]; &INPUTS }, - output: &::VOID, - definition: Named("llvm.x86.sse.storeu.ps") - }, - "_mm_abs_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.x86.ssse3.pabs.b.128") - }, - "_mm_abs_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.ssse3.pabs.w.128") - }, - "_mm_abs_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 1] = [&::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.ssse3.pabs.d.128") - }, - "_mm_hadd_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.ssse3.phadd.w.128") - }, - "_mm_hadd_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.ssse3.phadd.d.128") - }, - "_mm_hadds_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.ssse3.phadd.sw.128") - }, - "_mm_hsub_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.ssse3.phsub.w.128") - }, - "_mm_hsub_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.ssse3.phsub.d.128") - }, - "_mm_hsubs_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.ssse3.phsub.sw.128") - }, - "_mm_maddubs_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U8x16, &::I8x16]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.ssse3.pmadd.ub.sw.128") - }, - "_mm_mulhrs_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.ssse3.pmul.hr.sw.128") - }, - "_mm_shuffle_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.x86.ssse3.pshuf.b.128") - }, - "_mm_sign_epi8" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I8x16, &::I8x16]; &INPUTS }, - output: &::I8x16, - definition: Named("llvm.x86.ssse3.psign.b.128") - }, - "_mm_sign_epi16" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I16x8, &::I16x8]; &INPUTS }, - output: &::I16x8, - definition: Named("llvm.x86.ssse3.psign.w.128") - }, - "_mm_sign_epi32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::I32x4, &::I32x4]; &INPUTS }, - output: &::I32x4, - definition: Named("llvm.x86.ssse3.psign.d.128") - }, - "_tbm_bextri_u32" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U32, &::U32]; &INPUTS }, - output: &::U32, - definition: Named("llvm.x86.tbm.bextri.u32") - }, - "_tbm_bextri_u64" => Intrinsic { - inputs: { static INPUTS: [&'static Type; 2] = [&::U64, &::U64]; &INPUTS }, - output: &::U64, - definition: Named("llvm.x86.tbm.bextri.u64") - }, - _ => return None, - }) -} diff --git a/src/librustc_plugin/build.rs b/src/librustc_plugin/build.rs index f2728593db4..46c452668c3 100644 --- a/src/librustc_plugin/build.rs +++ b/src/librustc_plugin/build.rs @@ -1,22 +1,13 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Used by `rustc` when compiling a plugin crate. use syntax::ast; use syntax::attr; -use errors; use syntax_pos::Span; -use rustc::hir::map::Map; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir; +use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; +use rustc::ty::TyCtxt; +use rustc::ty::query::Providers; struct RegistrarFinder { registrars: Vec<(ast::NodeId, Span)> , @@ -40,21 +31,27 @@ impl<'v> ItemLikeVisitor<'v> for RegistrarFinder { } /// Find the function marked with `#[plugin_registrar]`, if any. -pub fn find_plugin_registrar(diagnostic: &errors::Handler, - hir_map: &Map) - -> Option { - let krate = hir_map.krate(); +pub fn find_plugin_registrar<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> Option { + tcx.plugin_registrar_fn(LOCAL_CRATE) +} + +fn plugin_registrar_fn<'tcx>( + tcx: TyCtxt<'_, 'tcx, 'tcx>, + cnum: CrateNum, +) -> Option { + assert_eq!(cnum, LOCAL_CRATE); let mut finder = RegistrarFinder { registrars: Vec::new() }; - krate.visit_all_item_likes(&mut finder); + tcx.hir().krate().visit_all_item_likes(&mut finder); match finder.registrars.len() { 0 => None, 1 => { let (node_id, _) = finder.registrars.pop().unwrap(); - Some(node_id) + Some(tcx.hir().local_def_id(node_id)) }, _ => { + let diagnostic = tcx.sess.diagnostic(); let mut e = diagnostic.struct_err("multiple plugin registration functions found"); for &(_, span) in &finder.registrars { e.span_note(span, "one is here"); @@ -65,3 +62,11 @@ pub fn find_plugin_registrar(diagnostic: &errors::Handler, } } } + + +pub fn provide(providers: &mut Providers<'_>) { + *providers = Providers { + plugin_registrar_fn, + ..*providers + }; +} diff --git a/src/librustc_plugin/diagnostics.rs b/src/librustc_plugin/diagnostics.rs index 100c1db1439..382a1edb43c 100644 --- a/src/librustc_plugin/diagnostics.rs +++ b/src/librustc_plugin/diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] register_long_diagnostics! { diff --git a/src/librustc_plugin/lib.rs b/src/librustc_plugin/lib.rs index 2cc3f1efcb5..7bdeae3e978 100644 --- a/src/librustc_plugin/lib.rs +++ b/src/librustc_plugin/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Infrastructure for compiler plugins. //! //! Plugins are Rust libraries which extend the behavior of `rustc` @@ -67,6 +57,8 @@ #![feature(nll)] #![feature(rustc_diagnostic_macros)] +#![recursion_limit="256"] + #[macro_use] extern crate syntax; extern crate rustc; diff --git a/src/librustc_plugin/load.rs b/src/librustc_plugin/load.rs index bf59165a9c4..39f580420cf 100644 --- a/src/librustc_plugin/load.rs +++ b/src/librustc_plugin/load.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Used by `rustc` when loading a plugin. use rustc::session::Session; @@ -60,10 +50,7 @@ pub fn load_plugins(sess: &Session, let plugins = match attr.meta_item_list() { Some(xs) => xs, - None => { - call_malformed_plugin_attribute(sess, attr.span); - continue; - } + None => continue, }; for plugin in plugins { @@ -144,7 +131,7 @@ impl<'a> PluginLoader<'a> { // Intentionally leak the dynamic library. We can't ever unload it // since the library can make things that will live arbitrarily long - // (e.g. an @-box cycle or a thread). + // (e.g., an @-box cycle or a thread). mem::forget(lib); registrar diff --git a/src/librustc_plugin/registry.rs b/src/librustc_plugin/registry.rs index 6c10ac7ea5c..b53d956a9c0 100644 --- a/src/librustc_plugin/registry.rs +++ b/src/librustc_plugin/registry.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Used by plugin crates to tell `rustc` about the plugins they provide. use rustc::lint::{EarlyLintPassObject, LateLintPassObject, LintId, Lint}; @@ -60,8 +50,6 @@ pub struct Registry<'a> { #[doc(hidden)] pub attributes: Vec<(String, AttributeType)>, - - whitelisted_custom_derives: Vec, } impl<'a> Registry<'a> { @@ -77,7 +65,6 @@ impl<'a> Registry<'a> { lint_groups: FxHashMap::default(), llvm_passes: vec![], attributes: vec![], - whitelisted_custom_derives: Vec::new(), } } @@ -130,19 +117,6 @@ impl<'a> Registry<'a> { })); } - /// This can be used in place of `register_syntax_extension` to register legacy custom derives - /// (i.e. attribute syntax extensions whose name begins with `derive_`). Legacy custom - /// derives defined by this function do not trigger deprecation warnings when used. - pub fn register_custom_derive(&mut self, name: ast::Name, extension: SyntaxExtension) { - assert!(name.as_str().starts_with("derive_")); - self.whitelisted_custom_derives.push(name); - self.register_syntax_extension(name, extension); - } - - pub fn take_whitelisted_custom_derives(&mut self) -> Vec { - ::std::mem::replace(&mut self.whitelisted_custom_derives, Vec::new()) - } - /// Register a macro of the usual kind. /// /// This is a convenience wrapper for `register_syntax_extension`. diff --git a/src/librustc_privacy/diagnostics.rs b/src/librustc_privacy/diagnostics.rs index f8559954db1..fa4df53e47b 100644 --- a/src/librustc_privacy/diagnostics.rs +++ b/src/librustc_privacy/diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] register_long_diagnostics! { diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index fbd6f6edd31..dcbb9ff4a75 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] @@ -23,30 +13,297 @@ extern crate rustc_typeck; extern crate syntax_pos; extern crate rustc_data_structures; -use rustc::hir::{self, PatKind}; -use hir::Node; +use rustc::hir::{self, Node, PatKind, AssociatedItemKind}; use rustc::hir::def::Def; use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, CrateNum, DefId}; use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; use rustc::hir::itemlikevisit::DeepVisitor; use rustc::lint; use rustc::middle::privacy::{AccessLevel, AccessLevels}; -use rustc::ty::{self, TyCtxt, Ty, TypeFoldable, GenericParamDefKind}; +use rustc::ty::{self, TyCtxt, Ty, TraitRef, TypeFoldable, GenericParamDefKind}; use rustc::ty::fold::TypeVisitor; -use rustc::ty::query::Providers; -use rustc::ty::subst::UnpackedKind; +use rustc::ty::query::{Providers, queries}; +use rustc::ty::subst::Substs; use rustc::util::nodemap::NodeSet; -use syntax::ast::{self, CRATE_NODE_ID, Ident}; +use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::sync::Lrc; +use syntax::ast::{self, DUMMY_NODE_ID, Ident}; +use syntax::attr; use syntax::symbol::keywords; use syntax_pos::Span; -use std::cmp; -use std::mem::replace; -use rustc_data_structures::fx::FxHashSet; -use rustc_data_structures::sync::Lrc; +use std::{cmp, fmt, mem}; +use std::marker::PhantomData; mod diagnostics; +//////////////////////////////////////////////////////////////////////////////// +/// Generic infrastructure used to implement specific visitors below. +//////////////////////////////////////////////////////////////////////////////// + +/// Implemented to visit all `DefId`s in a type. +/// Visiting `DefId`s is useful because visibilities and reachabilities are attached to them. +/// The idea is to visit "all components of a type", as documented in +/// https://github.com/rust-lang/rfcs/blob/master/text/2145-type-privacy.md#how-to-determine-visibility-of-a-type +/// Default type visitor (`TypeVisitor`) does most of the job, but it has some shortcomings. +/// First, it doesn't have overridable `fn visit_trait_ref`, so we have to catch trait def-ids +/// manually. Second, it doesn't visit some type components like signatures of fn types, or traits +/// in `impl Trait`, see individual comments in `DefIdVisitorSkeleton::visit_ty`. +trait DefIdVisitor<'a, 'tcx: 'a> { + fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx>; + fn shallow(&self) -> bool { false } + fn skip_assoc_tys(&self) -> bool { false } + fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool; + + /// Not overridden, but used to actually visit types and traits. + fn skeleton(&mut self) -> DefIdVisitorSkeleton<'_, 'a, 'tcx, Self> { + DefIdVisitorSkeleton { + def_id_visitor: self, + visited_opaque_tys: Default::default(), + dummy: Default::default(), + } + } + fn visit(&mut self, ty_fragment: impl TypeFoldable<'tcx>) -> bool { + ty_fragment.visit_with(&mut self.skeleton()) + } + fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> bool { + self.skeleton().visit_trait(trait_ref) + } + fn visit_predicates(&mut self, predicates: Lrc>) -> bool { + self.skeleton().visit_predicates(predicates) + } +} + +struct DefIdVisitorSkeleton<'v, 'a, 'tcx, V> + where V: DefIdVisitor<'a, 'tcx> + ?Sized +{ + def_id_visitor: &'v mut V, + visited_opaque_tys: FxHashSet, + dummy: PhantomData>, +} + +impl<'a, 'tcx, V> DefIdVisitorSkeleton<'_, 'a, 'tcx, V> + where V: DefIdVisitor<'a, 'tcx> + ?Sized +{ + fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> bool { + let TraitRef { def_id, substs } = trait_ref; + self.def_id_visitor.visit_def_id(def_id, "trait", &trait_ref) || + (!self.def_id_visitor.shallow() && substs.visit_with(self)) + } + + fn visit_predicates(&mut self, predicates: Lrc>) -> bool { + let ty::GenericPredicates { parent: _, predicates } = &*predicates; + for (predicate, _span) in predicates { + match predicate { + ty::Predicate::Trait(poly_predicate) => { + let ty::TraitPredicate { trait_ref } = *poly_predicate.skip_binder(); + if self.visit_trait(trait_ref) { + return true; + } + } + ty::Predicate::Projection(poly_predicate) => { + let ty::ProjectionPredicate { projection_ty, ty } = + *poly_predicate.skip_binder(); + if ty.visit_with(self) { + return true; + } + if self.visit_trait(projection_ty.trait_ref(self.def_id_visitor.tcx())) { + return true; + } + } + ty::Predicate::TypeOutlives(poly_predicate) => { + let ty::OutlivesPredicate(ty, _region) = *poly_predicate.skip_binder(); + if ty.visit_with(self) { + return true; + } + } + ty::Predicate::RegionOutlives(..) => {}, + _ => bug!("unexpected predicate: {:?}", predicate), + } + } + false + } +} + +impl<'a, 'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'a, 'tcx, V> + where V: DefIdVisitor<'a, 'tcx> + ?Sized +{ + fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { + let tcx = self.def_id_visitor.tcx(); + // Substs are not visited here because they are visited below in `super_visit_with`. + match ty.sty { + ty::Adt(&ty::AdtDef { did: def_id, .. }, ..) | + ty::Foreign(def_id) | + ty::FnDef(def_id, ..) | + ty::Closure(def_id, ..) | + ty::Generator(def_id, ..) => { + if self.def_id_visitor.visit_def_id(def_id, "type", ty) { + return true; + } + if self.def_id_visitor.shallow() { + return false; + } + // Default type visitor doesn't visit signatures of fn types. + // Something like `fn() -> Priv {my_func}` is considered a private type even if + // `my_func` is public, so we need to visit signatures. + if let ty::FnDef(..) = ty.sty { + if tcx.fn_sig(def_id).visit_with(self) { + return true; + } + } + // Inherent static methods don't have self type in substs. + // Something like `fn() {my_method}` type of the method + // `impl Pub { pub fn my_method() {} }` is considered a private type, + // so we need to visit the self type additionally. + if let Some(assoc_item) = tcx.opt_associated_item(def_id) { + if let ty::ImplContainer(impl_def_id) = assoc_item.container { + if tcx.type_of(impl_def_id).visit_with(self) { + return true; + } + } + } + } + ty::Projection(proj) | ty::UnnormalizedProjection(proj) => { + if self.def_id_visitor.skip_assoc_tys() { + // Visitors searching for minimal visibility/reachability want to + // conservatively approximate associated types like `::Alias` + // as visible/reachable even if both `Type` and `Trait` are private. + // Ideally, associated types should be substituted in the same way as + // free type aliases, but this isn't done yet. + return false; + } + // This will also visit substs if necessary, so we don't need to recurse. + return self.visit_trait(proj.trait_ref(tcx)); + } + ty::Dynamic(predicates, ..) => { + // All traits in the list are considered the "primary" part of the type + // and are visited by shallow visitors. + for predicate in *predicates.skip_binder() { + let trait_ref = match *predicate { + ty::ExistentialPredicate::Trait(trait_ref) => trait_ref, + ty::ExistentialPredicate::Projection(proj) => proj.trait_ref(tcx), + ty::ExistentialPredicate::AutoTrait(def_id) => + ty::ExistentialTraitRef { def_id, substs: Substs::empty() }, + }; + let ty::ExistentialTraitRef { def_id, substs: _ } = trait_ref; + if self.def_id_visitor.visit_def_id(def_id, "trait", &trait_ref) { + return true; + } + } + } + ty::Opaque(def_id, ..) => { + // Skip repeated `Opaque`s to avoid infinite recursion. + if self.visited_opaque_tys.insert(def_id) { + // The intent is to treat `impl Trait1 + Trait2` identically to + // `dyn Trait1 + Trait2`. Therefore we ignore def-id of the opaque type itself + // (it either has no visibility, or its visibility is insignificant, like + // visibilities of type aliases) and recurse into predicates instead to go + // through the trait list (default type visitor doesn't visit those traits). + // All traits in the list are considered the "primary" part of the type + // and are visited by shallow visitors. + if self.visit_predicates(tcx.predicates_of(def_id)) { + return true; + } + } + } + // These types don't have their own def-ids (but may have subcomponents + // with def-ids that should be visited recursively). + ty::Bool | ty::Char | ty::Int(..) | ty::Uint(..) | + ty::Float(..) | ty::Str | ty::Never | + ty::Array(..) | ty::Slice(..) | ty::Tuple(..) | + ty::RawPtr(..) | ty::Ref(..) | ty::FnPtr(..) | + ty::Param(..) | ty::Error | ty::GeneratorWitness(..) => {} + ty::Bound(..) | ty::Placeholder(..) | ty::Infer(..) => + bug!("unexpected type: {:?}", ty), + } + + !self.def_id_visitor.shallow() && ty.super_visit_with(self) + } +} + +fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) + -> (ty::Visibility, Span, &'static str) { + match tcx.hir().as_local_node_id(def_id) { + Some(node_id) => { + let vis = match tcx.hir().get(node_id) { + Node::Item(item) => &item.vis, + Node::ForeignItem(foreign_item) => &foreign_item.vis, + Node::TraitItem(..) | Node::Variant(..) => { + return def_id_visibility(tcx, tcx.hir().get_parent_did(node_id)); + } + Node::ImplItem(impl_item) => { + match tcx.hir().get(tcx.hir().get_parent(node_id)) { + Node::Item(item) => match &item.node { + hir::ItemKind::Impl(.., None, _, _) => &impl_item.vis, + hir::ItemKind::Impl(.., Some(trait_ref), _, _) + => return def_id_visibility(tcx, trait_ref.path.def.def_id()), + kind => bug!("unexpected item kind: {:?}", kind), + } + node => bug!("unexpected node kind: {:?}", node), + } + } + Node::StructCtor(vdata) => { + let struct_node_id = tcx.hir().get_parent(node_id); + let item = match tcx.hir().get(struct_node_id) { + Node::Item(item) => item, + node => bug!("unexpected node kind: {:?}", node), + }; + let (mut ctor_vis, mut span, mut descr) = + (ty::Visibility::from_hir(&item.vis, struct_node_id, tcx), + item.vis.span, item.vis.node.descr()); + for field in vdata.fields() { + let field_vis = ty::Visibility::from_hir(&field.vis, node_id, tcx); + if ctor_vis.is_at_least(field_vis, tcx) { + ctor_vis = field_vis; + span = field.vis.span; + descr = field.vis.node.descr(); + } + } + + // If the structure is marked as non_exhaustive then lower the + // visibility to within the crate. + if ctor_vis == ty::Visibility::Public { + let adt_def = tcx.adt_def(tcx.hir().get_parent_did(node_id)); + if adt_def.non_enum_variant().is_field_list_non_exhaustive() { + ctor_vis = ty::Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)); + span = attr::find_by_name(&item.attrs, "non_exhaustive").unwrap().span; + descr = "crate-visible"; + } + } + + return (ctor_vis, span, descr); + } + Node::Expr(expr) => { + return (ty::Visibility::Restricted(tcx.hir().get_module_parent(expr.id)), + expr.span, "private") + } + node => bug!("unexpected node kind: {:?}", node) + }; + (ty::Visibility::from_hir(vis, node_id, tcx), vis.span, vis.node.descr()) + } + None => { + let vis = tcx.visibility(def_id); + let descr = if vis == ty::Visibility::Public { "public" } else { "private" }; + (vis, tcx.def_span(def_id), descr) + } + } +} + +// Set the correct `TypeckTables` for the given `item_id` (or an empty table if +// there is no `TypeckTables` for the item). +fn item_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + node_id: ast::NodeId, + empty_tables: &'a ty::TypeckTables<'tcx>) + -> &'a ty::TypeckTables<'tcx> { + let def_id = tcx.hir().local_def_id(node_id); + if tcx.has_typeck_tables(def_id) { tcx.typeck_tables_of(def_id) } else { empty_tables } +} + +fn min<'a, 'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'a, 'tcx, 'tcx>) + -> ty::Visibility { + if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 } +} + //////////////////////////////////////////////////////////////////////////////// /// Visitor used to determine if pub(restricted) is used anywhere in the crate. /// @@ -60,13 +317,78 @@ struct PubRestrictedVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx> Visitor<'tcx> for PubRestrictedVisitor<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::All(&self.tcx.hir) + NestedVisitorMap::All(&self.tcx.hir()) } fn visit_vis(&mut self, vis: &'tcx hir::Visibility) { self.has_pub_restricted = self.has_pub_restricted || vis.node.is_pub_restricted(); } } +//////////////////////////////////////////////////////////////////////////////// +/// Visitor used to determine impl visibility and reachability. +//////////////////////////////////////////////////////////////////////////////// + +struct FindMin<'a, 'tcx, VL: VisibilityLike> { + tcx: TyCtxt<'a, 'tcx, 'tcx>, + access_levels: &'a AccessLevels, + min: VL, +} + +impl<'a, 'tcx, VL: VisibilityLike> DefIdVisitor<'a, 'tcx> for FindMin<'a, 'tcx, VL> { + fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } + fn shallow(&self) -> bool { VL::SHALLOW } + fn skip_assoc_tys(&self) -> bool { true } + fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool { + self.min = VL::new_min(self, def_id); + false + } +} + +trait VisibilityLike: Sized { + const MAX: Self; + const SHALLOW: bool = false; + fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self; + + // Returns an over-approximation (`skip_assoc_tys` = true) of visibility due to + // associated types for which we can't determine visibility precisely. + fn of_impl<'a, 'tcx>(node_id: ast::NodeId, tcx: TyCtxt<'a, 'tcx, 'tcx>, + access_levels: &'a AccessLevels) -> Self { + let mut find = FindMin { tcx, access_levels, min: Self::MAX }; + let def_id = tcx.hir().local_def_id(node_id); + find.visit(tcx.type_of(def_id)); + if let Some(trait_ref) = tcx.impl_trait_ref(def_id) { + find.visit_trait(trait_ref); + } + find.min + } +} +impl VisibilityLike for ty::Visibility { + const MAX: Self = ty::Visibility::Public; + fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self { + min(def_id_visibility(find.tcx, def_id).0, find.min, find.tcx) + } +} +impl VisibilityLike for Option { + const MAX: Self = Some(AccessLevel::Public); + // Type inference is very smart sometimes. + // It can make an impl reachable even some components of its type or trait are unreachable. + // E.g. methods of `impl ReachableTrait for ReachableTy { ... }` + // can be usable from other crates (#57264). So we skip substs when calculating reachability + // and consider an impl reachable if its "shallow" type and trait are reachable. + // + // The assumption we make here is that type-inference won't let you use an impl without knowing + // both "shallow" version of its self type and "shallow" version of its trait if it exists + // (which require reaching the `DefId`s in them). + const SHALLOW: bool = true; + fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self { + cmp::min(if let Some(node_id) = find.tcx.hir().as_local_node_id(def_id) { + find.access_levels.map.get(&node_id).cloned() + } else { + Self::MAX + }, find.min) + } +} + //////////////////////////////////////////////////////////////////////////////// /// The embargo visitor, used to determine the exports of the ast //////////////////////////////////////////////////////////////////////////////// @@ -74,11 +396,11 @@ impl<'a, 'tcx> Visitor<'tcx> for PubRestrictedVisitor<'a, 'tcx> { struct EmbargoVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, - // Accessibility levels for reachable nodes + // Accessibility levels for reachable nodes. access_levels: AccessLevels, - // Previous accessibility level, None means unreachable + // Previous accessibility level; `None` means unreachable. prev_level: Option, - // Have something changed in the level map? + // Has something changed in the level map? changed: bool, } @@ -89,38 +411,14 @@ struct ReachEverythingInTheInterfaceVisitor<'b, 'a: 'b, 'tcx: 'a> { } impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { - fn item_ty_level(&self, item_def_id: DefId) -> Option { - let ty_def_id = match self.tcx.type_of(item_def_id).sty { - ty::Adt(adt, _) => adt.did, - ty::Foreign(did) => did, - ty::Dynamic(ref obj, ..) => obj.principal().def_id(), - ty::Projection(ref proj) => proj.trait_ref(self.tcx).def_id, - _ => return Some(AccessLevel::Public) - }; - if let Some(node_id) = self.tcx.hir.as_local_node_id(ty_def_id) { - self.get(node_id) - } else { - Some(AccessLevel::Public) - } - } - - fn impl_trait_level(&self, impl_def_id: DefId) -> Option { - if let Some(trait_ref) = self.tcx.impl_trait_ref(impl_def_id) { - if let Some(node_id) = self.tcx.hir.as_local_node_id(trait_ref.def_id) { - return self.get(node_id); - } - } - Some(AccessLevel::Public) - } - fn get(&self, id: ast::NodeId) -> Option { self.access_levels.map.get(&id).cloned() } - // Updates node level and returns the updated level + // Updates node level and returns the updated level. fn update(&mut self, id: ast::NodeId, level: Option) -> Option { let old_level = self.get(id); - // Accessibility levels can only grow + // Accessibility levels can only grow. if level > old_level { self.access_levels.map.insert(id, level.unwrap()); self.changed = true; @@ -130,11 +428,11 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { } } - fn reach<'b>(&'b mut self, item_id: ast::NodeId) - -> ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> { + fn reach(&mut self, item_id: ast::NodeId, access_level: Option) + -> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { ReachEverythingInTheInterfaceVisitor { - access_level: self.prev_level.map(|l| l.min(AccessLevel::Reachable)), - item_def_id: self.tcx.hir.local_def_id(item_id), + access_level: cmp::min(access_level, Some(AccessLevel::Reachable)), + item_def_id: self.tcx.hir().local_def_id(item_id), ev: self, } } @@ -144,21 +442,16 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { /// We want to visit items in the context of their containing /// module and so forth, so supply a crate for doing a deep walk. fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::All(&self.tcx.hir) + NestedVisitorMap::All(&self.tcx.hir()) } fn visit_item(&mut self, item: &'tcx hir::Item) { let inherited_item_level = match item.node { - // Impls inherit level from their types and traits - hir::ItemKind::Impl(..) => { - let def_id = self.tcx.hir.local_def_id(item.id); - cmp::min(self.item_ty_level(def_id), self.impl_trait_level(def_id)) - } - // Foreign mods inherit level from parents - hir::ItemKind::ForeignMod(..) => { - self.prev_level - } - // Other `pub` items inherit levels from parents + hir::ItemKind::Impl(..) => + Option::::of_impl(item.id, self.tcx, &self.access_levels), + // Foreign modules inherit level from parents. + hir::ItemKind::ForeignMod(..) => self.prev_level, + // Other `pub` items inherit levels from parents. hir::ItemKind::Const(..) | hir::ItemKind::Enum(..) | hir::ItemKind::ExternCrate(..) | hir::ItemKind::GlobalAsm(..) | hir::ItemKind::Fn(..) | hir::ItemKind::Mod(..) | hir::ItemKind::Static(..) | hir::ItemKind::Struct(..) | @@ -169,10 +462,10 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } }; - // Update level of the item itself + // Update level of the item itself. let item_level = self.update(item.id, inherited_item_level); - // Update levels of nested things + // Update levels of nested things. match item.node { hir::ItemKind::Enum(ref def, _) => { for variant in &def.variants { @@ -182,18 +475,13 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } } } - hir::ItemKind::Impl(.., None, _, ref impl_item_refs) => { + hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => { for impl_item_ref in impl_item_refs { - if impl_item_ref.vis.node.is_pub() { + if trait_ref.is_some() || impl_item_ref.vis.node.is_pub() { self.update(impl_item_ref.id.node_id, item_level); } } } - hir::ItemKind::Impl(.., Some(_), _, ref impl_item_refs) => { - for impl_item_ref in impl_item_refs { - self.update(impl_item_ref.id.node_id, item_level); - } - } hir::ItemKind::Trait(.., ref trait_item_refs) => { for trait_item_ref in trait_item_refs { self.update(trait_item_ref.id.node_id, item_level); @@ -216,15 +504,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } } } - // Impl trait return types mark their parent function. - // It (and its children) are revisited if the change applies. - hir::ItemKind::Existential(ref ty_data) => { - if let Some(impl_trait_fn) = ty_data.impl_trait_fn { - if let Some(node_id) = self.tcx.hir.as_local_node_id(impl_trait_fn) { - self.update(node_id, Some(AccessLevel::ReachableFromImplTrait)); - } - } - } + hir::ItemKind::Existential(..) | hir::ItemKind::Use(..) | hir::ItemKind::Static(..) | hir::ItemKind::Const(..) | @@ -236,43 +516,39 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { hir::ItemKind::ExternCrate(..) => {} } - // Store this node's access level here to propagate the correct - // reachability level through interfaces and children. - let orig_level = replace(&mut self.prev_level, item_level); - - // Mark all items in interfaces of reachable items as reachable + // Mark all items in interfaces of reachable items as reachable. match item.node { - // The interface is empty + // The interface is empty. hir::ItemKind::ExternCrate(..) => {} - // All nested items are checked by visit_item + // All nested items are checked by `visit_item`. hir::ItemKind::Mod(..) => {} - // Re-exports are handled in visit_mod + // Re-exports are handled in `visit_mod`. hir::ItemKind::Use(..) => {} - // The interface is empty + // The interface is empty. hir::ItemKind::GlobalAsm(..) => {} - hir::ItemKind::Existential(hir::ExistTy { impl_trait_fn: Some(_), .. }) => { - if item_level.is_some() { - // Reach the (potentially private) type and the API being exposed - self.reach(item.id).ty().predicates(); - } - } - // Visit everything + hir::ItemKind::Existential(..) => { + // FIXME: This is some serious pessimization intended to workaround deficiencies + // in the reachability pass (`middle/reachable.rs`). Types are marked as link-time + // reachable if they are returned via `impl Trait`, even from private functions. + let exist_level = cmp::max(item_level, Some(AccessLevel::ReachableFromImplTrait)); + self.reach(item.id, exist_level).generics().predicates().ty(); + } + // Visit everything. hir::ItemKind::Const(..) | hir::ItemKind::Static(..) | - hir::ItemKind::Existential(..) | hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) => { if item_level.is_some() { - self.reach(item.id).generics().predicates().ty(); + self.reach(item.id, item_level).generics().predicates().ty(); } } hir::ItemKind::Trait(.., ref trait_item_refs) => { if item_level.is_some() { - self.reach(item.id).generics().predicates(); + self.reach(item.id, item_level).generics().predicates(); for trait_item_ref in trait_item_refs { - let mut reach = self.reach(trait_item_ref.id.node_id); + let mut reach = self.reach(trait_item_ref.id.node_id, item_level); reach.generics().predicates(); - if trait_item_ref.kind == hir::AssociatedItemKind::Type && + if trait_item_ref.kind == AssociatedItemKind::Type && !trait_item_ref.defaultness.has_value() { // No type to visit. } else { @@ -283,74 +559,77 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } hir::ItemKind::TraitAlias(..) => { if item_level.is_some() { - self.reach(item.id).generics().predicates(); + self.reach(item.id, item_level).generics().predicates(); } } - // Visit everything except for private impl items - hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => { + // Visit everything except for private impl items. + hir::ItemKind::Impl(.., ref impl_item_refs) => { if item_level.is_some() { - self.reach(item.id).generics().predicates().impl_trait_ref(); + self.reach(item.id, item_level).generics().predicates().ty().trait_ref(); for impl_item_ref in impl_item_refs { - let id = impl_item_ref.id.node_id; - if trait_ref.is_some() || self.get(id).is_some() { - self.reach(id).generics().predicates().ty(); + let impl_item_level = self.get(impl_item_ref.id.node_id); + if impl_item_level.is_some() { + self.reach(impl_item_ref.id.node_id, impl_item_level) + .generics().predicates().ty(); } } } } - // Visit everything, but enum variants have their own levels + // Visit everything, but enum variants have their own levels. hir::ItemKind::Enum(ref def, _) => { if item_level.is_some() { - self.reach(item.id).generics().predicates(); + self.reach(item.id, item_level).generics().predicates(); } for variant in &def.variants { - if self.get(variant.node.data.id()).is_some() { + let variant_level = self.get(variant.node.data.id()); + if variant_level.is_some() { for field in variant.node.data.fields() { - self.reach(field.id).ty(); + self.reach(field.id, variant_level).ty(); } // Corner case: if the variant is reachable, but its // enum is not, make the enum reachable as well. - self.update(item.id, Some(AccessLevel::Reachable)); + self.update(item.id, variant_level); } } } - // Visit everything, but foreign items have their own levels + // Visit everything, but foreign items have their own levels. hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { - if self.get(foreign_item.id).is_some() { - self.reach(foreign_item.id).generics().predicates().ty(); + let foreign_item_level = self.get(foreign_item.id); + if foreign_item_level.is_some() { + self.reach(foreign_item.id, foreign_item_level) + .generics().predicates().ty(); } } } - // Visit everything except for private fields + // Visit everything except for private fields. hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { if item_level.is_some() { - self.reach(item.id).generics().predicates(); + self.reach(item.id, item_level).generics().predicates(); for field in struct_def.fields() { - if self.get(field.id).is_some() { - self.reach(field.id).ty(); + let field_level = self.get(field.id); + if field_level.is_some() { + self.reach(field.id, field_level).ty(); } } } } } + let orig_level = mem::replace(&mut self.prev_level, item_level); intravisit::walk_item(self, item); - self.prev_level = orig_level; } fn visit_block(&mut self, b: &'tcx hir::Block) { - let orig_level = replace(&mut self.prev_level, None); - // Blocks can have public items, for example impls, but they always // start as completely private regardless of publicity of a function, - // constant, type, field, etc. in which this block resides + // constant, type, field, etc., in which this block resides. + let orig_level = mem::replace(&mut self.prev_level, None); intravisit::walk_block(self, b); - self.prev_level = orig_level; } @@ -358,12 +637,12 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { // This code is here instead of in visit_item so that the // crate module gets processed as well. if self.prev_level.is_some() { - let def_id = self.tcx.hir.local_def_id(id); + let def_id = self.tcx.hir().local_def_id(id); if let Some(exports) = self.tcx.module_exports(def_id) { for export in exports.iter() { if export.vis == ty::Visibility::Public { if let Some(def_id) = export.def.opt_def_id() { - if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) { + if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) { self.update(node_id, Some(AccessLevel::Exported)); } } @@ -381,8 +660,11 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { return } - let module_did = ty::DefIdTree::parent(self.tcx, self.tcx.hir.local_def_id(md.id)).unwrap(); - let mut module_id = self.tcx.hir.as_local_node_id(module_did).unwrap(); + let module_did = ty::DefIdTree::parent( + self.tcx, + self.tcx.hir().local_def_id(md.id) + ).unwrap(); + let mut module_id = self.tcx.hir().as_local_node_id(module_did).unwrap(); let level = if md.vis.node.is_pub() { self.get(module_id) } else { None }; let level = self.update(md.id, level); if level.is_none() { @@ -391,9 +673,9 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { loop { let module = if module_id == ast::CRATE_NODE_ID { - &self.tcx.hir.krate().module - } else if let hir::ItemKind::Mod(ref module) = self.tcx.hir.expect_item(module_id).node - { + &self.tcx.hir().krate().module + } else if let hir::ItemKind::Mod(ref module) = + self.tcx.hir().expect_item(module_id).node { module } else { unreachable!() @@ -401,10 +683,10 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { for id in &module.item_ids { self.update(id.id, level); } - let def_id = self.tcx.hir.local_def_id(module_id); + let def_id = self.tcx.hir().local_def_id(module_id); if let Some(exports) = self.tcx.module_exports(def_id) { for export in exports.iter() { - if let Some(node_id) = self.tcx.hir.as_local_node_id(export.def.def_id()) { + if let Some(node_id) = self.tcx.hir().as_local_node_id(export.def.def_id()) { self.update(node_id, level); } } @@ -413,18 +695,18 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { if module_id == ast::CRATE_NODE_ID { break } - module_id = self.tcx.hir.get_parent_node(module_id); + module_id = self.tcx.hir().get_parent_node(module_id); } } } -impl<'b, 'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> { +impl<'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { fn generics(&mut self) -> &mut Self { for param in &self.ev.tcx.generics_of(self.item_def_id).params { match param.kind { GenericParamDefKind::Type { has_default, .. } => { if has_default { - self.ev.tcx.type_of(param.def_id).visit_with(self); + self.visit(self.ev.tcx.type_of(param.def_id)); } } GenericParamDefKind::Lifetime => {} @@ -434,73 +716,30 @@ impl<'b, 'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> { } fn predicates(&mut self) -> &mut Self { - let predicates = self.ev.tcx.predicates_of(self.item_def_id); - for (predicate, _) in &predicates.predicates { - predicate.visit_with(self); - match predicate { - &ty::Predicate::Trait(poly_predicate) => { - self.check_trait_ref(poly_predicate.skip_binder().trait_ref); - }, - &ty::Predicate::Projection(poly_predicate) => { - let tcx = self.ev.tcx; - self.check_trait_ref( - poly_predicate.skip_binder().projection_ty.trait_ref(tcx) - ); - }, - _ => (), - }; - } + self.visit_predicates(self.ev.tcx.predicates_of(self.item_def_id)); self } fn ty(&mut self) -> &mut Self { - let ty = self.ev.tcx.type_of(self.item_def_id); - ty.visit_with(self); - if let ty::FnDef(def_id, _) = ty.sty { - if def_id == self.item_def_id { - self.ev.tcx.fn_sig(def_id).visit_with(self); - } - } + self.visit(self.ev.tcx.type_of(self.item_def_id)); self } - fn impl_trait_ref(&mut self) -> &mut Self { - if let Some(impl_trait_ref) = self.ev.tcx.impl_trait_ref(self.item_def_id) { - self.check_trait_ref(impl_trait_ref); - impl_trait_ref.super_visit_with(self); + fn trait_ref(&mut self) -> &mut Self { + if let Some(trait_ref) = self.ev.tcx.impl_trait_ref(self.item_def_id) { + self.visit_trait(trait_ref); } self } - - fn check_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>) { - if let Some(node_id) = self.ev.tcx.hir.as_local_node_id(trait_ref.def_id) { - let item = self.ev.tcx.hir.expect_item(node_id); - self.ev.update(item.id, self.access_level); - } - } } -impl<'b, 'a, 'tcx> TypeVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> { - fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { - let ty_def_id = match ty.sty { - ty::Adt(adt, _) => Some(adt.did), - ty::Foreign(did) => Some(did), - ty::Dynamic(ref obj, ..) => Some(obj.principal().def_id()), - ty::Projection(ref proj) => Some(proj.item_def_id), - ty::FnDef(def_id, ..) | - ty::Closure(def_id, ..) | - ty::Generator(def_id, ..) | - ty::Opaque(def_id, _) => Some(def_id), - _ => None - }; - - if let Some(def_id) = ty_def_id { - if let Some(node_id) = self.ev.tcx.hir.as_local_node_id(def_id) { - self.ev.update(node_id, self.access_level); - } +impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { + fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.ev.tcx } + fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool { + if let Some(node_id) = self.ev.tcx.hir().as_local_node_id(def_id) { + self.ev.update(node_id, self.access_level); } - - ty.super_visit_with(self) + false } } @@ -521,10 +760,10 @@ struct NamePrivacyVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx> NamePrivacyVisitor<'a, 'tcx> { // Checks that a field in a struct constructor (expression or pattern) is accessible. fn check_field(&mut self, - use_ctxt: Span, // Syntax context of the field name at the use site - span: Span, // Span of the field pattern, e.g. `x: 0` - def: &'tcx ty::AdtDef, // Definition of the struct or enum - field: &'tcx ty::FieldDef) { // Definition of the field + use_ctxt: Span, // syntax context of the field name at the use site + span: Span, // span of the field pattern, e.g., `x: 0` + def: &'tcx ty::AdtDef, // definition of the struct or enum + field: &'tcx ty::FieldDef) { // definition of the field let ident = Ident::new(keywords::Invalid.name(), use_ctxt); let def_id = self.tcx.adjust_ident(ident, def.did, self.current_item).1; if !def.is_enum() && !field.vis.is_accessible_from(def_id, self.tcx) { @@ -536,52 +775,44 @@ impl<'a, 'tcx> NamePrivacyVisitor<'a, 'tcx> { } } -// Set the correct TypeckTables for the given `item_id` (or an empty table if -// there is no TypeckTables for the item). -fn update_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - item_id: ast::NodeId, - tables: &mut &'a ty::TypeckTables<'tcx>, - empty_tables: &'a ty::TypeckTables<'tcx>) - -> &'a ty::TypeckTables<'tcx> { - let def_id = tcx.hir.local_def_id(item_id); - - if tcx.has_typeck_tables(def_id) { - replace(tables, tcx.typeck_tables_of(def_id)) - } else { - replace(tables, empty_tables) - } -} - impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { /// We want to visit items in the context of their containing /// module and so forth, so supply a crate for doing a deep walk. fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::All(&self.tcx.hir) + NestedVisitorMap::All(&self.tcx.hir()) + } + + fn visit_mod(&mut self, _m: &'tcx hir::Mod, _s: Span, _n: ast::NodeId) { + // Don't visit nested modules, since we run a separate visitor walk + // for each module in `privacy_access_levels` } fn visit_nested_body(&mut self, body: hir::BodyId) { - let orig_tables = replace(&mut self.tables, self.tcx.body_tables(body)); - let body = self.tcx.hir.body(body); + let orig_tables = mem::replace(&mut self.tables, self.tcx.body_tables(body)); + let body = self.tcx.hir().body(body); self.visit_body(body); self.tables = orig_tables; } fn visit_item(&mut self, item: &'tcx hir::Item) { - let orig_current_item = replace(&mut self.current_item, item.id); - let orig_tables = update_tables(self.tcx, item.id, &mut self.tables, self.empty_tables); + let orig_current_item = mem::replace(&mut self.current_item, item.id); + let orig_tables = + mem::replace(&mut self.tables, item_tables(self.tcx, item.id, self.empty_tables)); intravisit::walk_item(self, item); self.current_item = orig_current_item; self.tables = orig_tables; } fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) { - let orig_tables = update_tables(self.tcx, ti.id, &mut self.tables, self.empty_tables); + let orig_tables = + mem::replace(&mut self.tables, item_tables(self.tcx, ti.id, self.empty_tables)); intravisit::walk_trait_item(self, ti); self.tables = orig_tables; } fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) { - let orig_tables = update_tables(self.tcx, ii.id, &mut self.tables, self.empty_tables); + let orig_tables = + mem::replace(&mut self.tables, item_tables(self.tcx, ii.id, self.empty_tables)); intravisit::walk_impl_item(self, ii); self.tables = orig_tables; } @@ -652,73 +883,22 @@ struct TypePrivacyVisitor<'a, 'tcx: 'a> { in_body: bool, span: Span, empty_tables: &'a ty::TypeckTables<'tcx>, - visited_opaque_tys: FxHashSet } impl<'a, 'tcx> TypePrivacyVisitor<'a, 'tcx> { - fn def_id_visibility(&self, did: DefId) -> ty::Visibility { - match self.tcx.hir.as_local_node_id(did) { - Some(node_id) => { - let vis = match self.tcx.hir.get(node_id) { - Node::Item(item) => &item.vis, - Node::ForeignItem(foreign_item) => &foreign_item.vis, - Node::ImplItem(impl_item) => &impl_item.vis, - Node::TraitItem(..) | - Node::Variant(..) => { - return self.def_id_visibility(self.tcx.hir.get_parent_did(node_id)); - } - Node::StructCtor(vdata) => { - let struct_node_id = self.tcx.hir.get_parent(node_id); - let struct_vis = match self.tcx.hir.get(struct_node_id) { - Node::Item(item) => &item.vis, - node => bug!("unexpected node kind: {:?}", node), - }; - let mut ctor_vis - = ty::Visibility::from_hir(struct_vis, struct_node_id, self.tcx); - for field in vdata.fields() { - let field_vis = ty::Visibility::from_hir(&field.vis, node_id, self.tcx); - if ctor_vis.is_at_least(field_vis, self.tcx) { - ctor_vis = field_vis; - } - } - - // If the structure is marked as non_exhaustive then lower the - // visibility to within the crate. - let struct_def_id = self.tcx.hir.get_parent_did(node_id); - let adt_def = self.tcx.adt_def(struct_def_id); - if adt_def.non_enum_variant().is_field_list_non_exhaustive() - && ctor_vis == ty::Visibility::Public - { - ctor_vis = ty::Visibility::Restricted( - DefId::local(CRATE_DEF_INDEX)); - } - - return ctor_vis; - } - node => bug!("unexpected node kind: {:?}", node) - }; - ty::Visibility::from_hir(vis, node_id, self.tcx) - } - None => self.tcx.visibility(did), - } - } - fn item_is_accessible(&self, did: DefId) -> bool { - self.def_id_visibility(did).is_accessible_from(self.current_item, self.tcx) + def_id_visibility(self.tcx, did).0.is_accessible_from(self.current_item, self.tcx) } - // Take node ID of an expression or pattern and check its type for privacy. + // Take node-id of an expression or pattern and check its type for privacy. fn check_expr_pat_type(&mut self, id: hir::HirId, span: Span) -> bool { self.span = span; - if self.tables.node_id_to_type(id).visit_with(self) { - return true; - } - if self.tables.node_substs(id).visit_with(self) { + if self.visit(self.tables.node_id_to_type(id)) || self.visit(self.tables.node_substs(id)) { return true; } if let Some(adjustments) = self.tables.adjustments().get(id) { for adjustment in adjustments { - if adjustment.target.visit_with(self) { + if self.visit(adjustment.target) { return true; } } @@ -726,14 +906,12 @@ impl<'a, 'tcx> TypePrivacyVisitor<'a, 'tcx> { false } - fn check_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>) -> bool { - if !self.item_is_accessible(trait_ref.def_id) { - let msg = format!("trait `{}` is private", trait_ref); - self.tcx.sess.span_err(self.span, &msg); - return true; + fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { + let is_error = !self.item_is_accessible(def_id); + if is_error { + self.tcx.sess.span_err(self.span, &format!("{} `{}` is private", kind, descr)); } - - trait_ref.super_visit_with(self) + is_error } } @@ -741,13 +919,18 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { /// We want to visit items in the context of their containing /// module and so forth, so supply a crate for doing a deep walk. fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::All(&self.tcx.hir) + NestedVisitorMap::All(&self.tcx.hir()) + } + + fn visit_mod(&mut self, _m: &'tcx hir::Mod, _s: Span, _n: ast::NodeId) { + // Don't visit nested modules, since we run a separate visitor walk + // for each module in `privacy_access_levels` } fn visit_nested_body(&mut self, body: hir::BodyId) { - let orig_tables = replace(&mut self.tables, self.tcx.body_tables(body)); - let orig_in_body = replace(&mut self.in_body, true); - let body = self.tcx.hir.body(body); + let orig_tables = mem::replace(&mut self.tables, self.tcx.body_tables(body)); + let orig_in_body = mem::replace(&mut self.in_body, true); + let body = self.tcx.hir().body(body); self.visit_body(body); self.tables = orig_tables; self.in_body = orig_in_body; @@ -757,14 +940,14 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { self.span = hir_ty.span; if self.in_body { // Types in bodies. - if self.tables.node_id_to_type(hir_ty.hir_id).visit_with(self) { + if self.visit(self.tables.node_id_to_type(hir_ty.hir_id)) { return; } } else { // Types in signatures. // FIXME: This is very ineffective. Ideally each HIR type should be converted // into a semantic type only once and the result should be cached somehow. - if rustc_typeck::hir_ty_to_ty(self.tcx, hir_ty).visit_with(self) { + if self.visit(rustc_typeck::hir_ty_to_ty(self.tcx, hir_ty)) { return; } } @@ -779,12 +962,13 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { // The traits' privacy in bodies is already checked as a part of trait object types. let (principal, projections) = rustc_typeck::hir_trait_to_predicates(self.tcx, trait_ref); - if self.check_trait_ref(*principal.skip_binder()) { + if self.visit_trait(*principal.skip_binder()) { return; } for (poly_predicate, _) in projections { let tcx = self.tcx; - if self.check_trait_ref(poly_predicate.skip_binder().projection_ty.trait_ref(tcx)) { + if self.visit(poly_predicate.skip_binder().ty) || + self.visit_trait(poly_predicate.skip_binder().projection_ty.trait_ref(tcx)) { return; } } @@ -810,8 +994,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { // Method calls have to be checked specially. self.span = span; if let Some(def) = self.tables.type_dependent_defs().get(expr.hir_id) { - let def_id = def.def_id(); - if self.tcx.type_of(def_id).visit_with(self) { + if self.visit(self.tcx.type_of(def.def_id())) { return; } } else { @@ -835,7 +1018,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { let def = match *qpath { hir::QPath::Resolved(_, ref path) => match path.def { Def::Method(..) | Def::AssociatedConst(..) | - Def::AssociatedTy(..) | Def::Static(..) => Some(path.def), + Def::AssociatedTy(..) | Def::AssociatedExistential(..) | + Def::Static(..) => Some(path.def), _ => None, } hir::QPath::TypeRelative(..) => { @@ -859,7 +1043,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { intravisit::walk_qpath(self, qpath, id, span); } - // Check types of patterns + // Check types of patterns. fn visit_pat(&mut self, pattern: &'tcx hir::Pat) { if self.check_expr_pat_type(pattern.hir_id, pattern.span) { // Do not check nested patterns if the error already happened. @@ -880,15 +1064,13 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { intravisit::walk_local(self, local); } - // Check types in item interfaces + // Check types in item interfaces. fn visit_item(&mut self, item: &'tcx hir::Item) { - let orig_current_item = self.current_item; - let orig_tables = update_tables(self.tcx, - item.id, - &mut self.tables, - self.empty_tables); - let orig_in_body = replace(&mut self.in_body, false); - self.current_item = self.tcx.hir.local_def_id(item.id); + let orig_current_item = + mem::replace(&mut self.current_item, self.tcx.hir().local_def_id(item.id)); + let orig_in_body = mem::replace(&mut self.in_body, false); + let orig_tables = + mem::replace(&mut self.tables, item_tables(self.tcx, item.id, self.empty_tables)); intravisit::walk_item(self, item); self.tables = orig_tables; self.in_body = orig_in_body; @@ -896,108 +1078,24 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { } fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) { - let orig_tables = update_tables(self.tcx, ti.id, &mut self.tables, self.empty_tables); + let orig_tables = + mem::replace(&mut self.tables, item_tables(self.tcx, ti.id, self.empty_tables)); intravisit::walk_trait_item(self, ti); self.tables = orig_tables; } fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) { - let orig_tables = update_tables(self.tcx, ii.id, &mut self.tables, self.empty_tables); + let orig_tables = + mem::replace(&mut self.tables, item_tables(self.tcx, ii.id, self.empty_tables)); intravisit::walk_impl_item(self, ii); self.tables = orig_tables; } } -impl<'a, 'tcx> TypeVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { - fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { - match ty.sty { - ty::Adt(&ty::AdtDef { did: def_id, .. }, ..) | - ty::FnDef(def_id, ..) | - ty::Foreign(def_id) => { - if !self.item_is_accessible(def_id) { - let msg = format!("type `{}` is private", ty); - self.tcx.sess.span_err(self.span, &msg); - return true; - } - if let ty::FnDef(..) = ty.sty { - if self.tcx.fn_sig(def_id).visit_with(self) { - return true; - } - } - // Inherent static methods don't have self type in substs, - // we have to check it additionally. - if let Some(assoc_item) = self.tcx.opt_associated_item(def_id) { - if let ty::ImplContainer(impl_def_id) = assoc_item.container { - if self.tcx.type_of(impl_def_id).visit_with(self) { - return true; - } - } - } - } - ty::Dynamic(ref predicates, ..) => { - let is_private = predicates.skip_binder().iter().any(|predicate| { - let def_id = match *predicate { - ty::ExistentialPredicate::Trait(trait_ref) => trait_ref.def_id, - ty::ExistentialPredicate::Projection(proj) => - proj.trait_ref(self.tcx).def_id, - ty::ExistentialPredicate::AutoTrait(def_id) => def_id, - }; - !self.item_is_accessible(def_id) - }); - if is_private { - let msg = format!("type `{}` is private", ty); - self.tcx.sess.span_err(self.span, &msg); - return true; - } - } - ty::Projection(ref proj) => { - let tcx = self.tcx; - if self.check_trait_ref(proj.trait_ref(tcx)) { - return true; - } - } - ty::Opaque(def_id, ..) => { - for (predicate, _) in &self.tcx.predicates_of(def_id).predicates { - let trait_ref = match *predicate { - ty::Predicate::Trait(ref poly_trait_predicate) => { - Some(poly_trait_predicate.skip_binder().trait_ref) - } - ty::Predicate::Projection(ref poly_projection_predicate) => { - if poly_projection_predicate.skip_binder().ty.visit_with(self) { - return true; - } - Some(poly_projection_predicate.skip_binder() - .projection_ty.trait_ref(self.tcx)) - } - ty::Predicate::TypeOutlives(..) => None, - _ => bug!("unexpected predicate: {:?}", predicate), - }; - if let Some(trait_ref) = trait_ref { - if !self.item_is_accessible(trait_ref.def_id) { - let msg = format!("trait `{}` is private", trait_ref); - self.tcx.sess.span_err(self.span, &msg); - return true; - } - for subst in trait_ref.substs.iter() { - // Skip repeated `Opaque`s to avoid infinite recursion. - if let UnpackedKind::Type(ty) = subst.unpack() { - if let ty::Opaque(def_id, ..) = ty.sty { - if !self.visited_opaque_tys.insert(def_id) { - continue; - } - } - } - if subst.visit_with(self) { - return true; - } - } - } - } - } - _ => {} - } - - ty.super_visit_with(self) +impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for TypePrivacyVisitor<'a, 'tcx> { + fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } + fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { + self.check_def_id(def_id, kind, descr) } } @@ -1012,18 +1110,18 @@ struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, access_levels: &'a AccessLevels, in_variant: bool, - // set of errors produced by this obsolete visitor + // Set of errors produced by this obsolete visitor. old_error_set: NodeSet, } struct ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b: 'a, 'tcx: 'b> { inner: &'a ObsoleteVisiblePrivateTypesVisitor<'b, 'tcx>, - /// whether the type refers to private types. + /// Whether the type refers to private types. contains_private: bool, - /// whether we've recurred at all (i.e. if we're pointing at the - /// first type on which visit_ty was called). + /// Whether we've recurred at all (i.e., if we're pointing at the + /// first type on which `visit_ty` was called). at_outer_type: bool, - // whether that first type is a public path. + /// Whether that first type is a public path. outer_type_is_public_path: bool, } @@ -1036,10 +1134,10 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // A path can only be private if: // it's in this crate... - if let Some(node_id) = self.tcx.hir.as_local_node_id(did) { + if let Some(node_id) = self.tcx.hir().as_local_node_id(did) { // .. and it corresponds to a private type in the AST (this returns - // None for type parameters) - match self.tcx.hir.find(node_id) { + // `None` for type parameters). + match self.tcx.hir().find(node_id) { Some(Node::Item(ref item)) => !item.vis.node.is_pub(), Some(_) | None => false, } @@ -1050,7 +1148,7 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { fn trait_is_public(&self, trait_id: ast::NodeId) -> bool { // FIXME: this would preferably be using `exported_items`, but all - // traits are exported currently (see `EmbargoVisitor.exported_trait`) + // traits are exported currently (see `EmbargoVisitor.exported_trait`). self.access_levels.is_public(trait_id) } @@ -1076,8 +1174,7 @@ impl<'a, 'b, 'tcx, 'v> Visitor<'v> for ObsoleteCheckTypeForPrivatenessVisitor<'a if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = ty.node { if self.inner.path_is_private_type(path) { self.contains_private = true; - // found what we're looking for so let's stop - // working. + // Found what we're looking for, so let's stop working. return } } @@ -1090,7 +1187,7 @@ impl<'a, 'b, 'tcx, 'v> Visitor<'v> for ObsoleteCheckTypeForPrivatenessVisitor<'a intravisit::walk_ty(self, ty) } - // don't want to recurse into [, .. expr] + // Don't want to recurse into `[, .. expr]`. fn visit_expr(&mut self, _: &hir::Expr) {} } @@ -1098,12 +1195,12 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { /// We want to visit items in the context of their containing /// module and so forth, so supply a crate for doing a deep walk. fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::All(&self.tcx.hir) + NestedVisitorMap::All(&self.tcx.hir()) } fn visit_item(&mut self, item: &'tcx hir::Item) { match item.node { - // contents of a private mod can be re-exported, so we need + // Contents of a private mod can be re-exported, so we need // to check internals. hir::ItemKind::Mod(_) => {} @@ -1121,19 +1218,19 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { } } - // impls need some special handling to try to offer useful + // Impls need some special handling to try to offer useful // error messages without (too many) false positives - // (i.e. we could just return here to not check them at + // (i.e., we could just return here to not check them at // all, or some worse estimation of whether an impl is // publicly visible). hir::ItemKind::Impl(.., ref g, ref trait_ref, ref self_, ref impl_item_refs) => { // `impl [... for] Private` is never visible. let self_contains_private; - // impl [... for] Public<...>, but not `impl [... for] - // Vec` or `(Public,)` etc. + // `impl [... for] Public<...>`, but not `impl [... for] + // Vec` or `(Public,)`, etc. let self_is_public_path; - // check the properties of the Self type: + // Check the properties of the `Self` type: { let mut visitor = ObsoleteCheckTypeForPrivatenessVisitor { inner: self, @@ -1146,7 +1243,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { self_is_public_path = visitor.outer_type_is_public_path; } - // miscellaneous info about the impl + // Miscellaneous info about the impl: // `true` iff this is `impl Private for ...`. let not_private_trait = @@ -1154,7 +1251,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { |tr| { let did = tr.path.def.def_id(); - if let Some(node_id) = self.tcx.hir.as_local_node_id(did) { + if let Some(node_id) = self.tcx.hir().as_local_node_id(did) { self.trait_is_public(node_id) } else { true // external traits must be public @@ -1173,7 +1270,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { trait_ref.is_some() || impl_item_refs.iter() .any(|impl_item_ref| { - let impl_item = self.tcx.hir.impl_item(impl_item_ref.id); + let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); match impl_item.node { hir::ImplItemKind::Const(..) | hir::ImplItemKind::Method(..) => { @@ -1198,7 +1295,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // should only walk into public items so that we // don't erroneously report errors for private // types in private items. - let impl_item = self.tcx.hir.impl_item(impl_item_ref.id); + let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); match impl_item.node { hir::ImplItemKind::Const(..) | hir::ImplItemKind::Method(..) @@ -1231,7 +1328,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // Those in 3. are warned with this call. for impl_item_ref in impl_item_refs { - let impl_item = self.tcx.hir.impl_item(impl_item_ref.id); + let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); if let hir::ImplItemKind::Type(ref ty) = impl_item.node { self.visit_ty(ty); } @@ -1239,18 +1336,18 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { } } } else if trait_ref.is_none() && self_is_public_path { - // impl Public { ... }. Any public static + // `impl Public { ... }`. Any public static // methods will be visible as `Public::foo`. let mut found_pub_static = false; for impl_item_ref in impl_item_refs { if self.item_is_public(&impl_item_ref.id.node_id, &impl_item_ref.vis) { - let impl_item = self.tcx.hir.impl_item(impl_item_ref.id); + let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); match impl_item_ref.kind { - hir::AssociatedItemKind::Const => { + AssociatedItemKind::Const => { found_pub_static = true; intravisit::walk_impl_item(self, impl_item); } - hir::AssociatedItemKind::Method { has_self: false } => { + AssociatedItemKind::Method { has_self: false } => { found_pub_static = true; intravisit::walk_impl_item(self, impl_item); } @@ -1269,7 +1366,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // we're introducing a new name. hir::ItemKind::Ty(..) => return, - // not at all public, so we don't care + // Not at all public, so we don't care. _ if !self.item_is_public(&item.id, &item.vis) => { return; } @@ -1279,7 +1376,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // We've carefully constructed it so that if we're here, then // any `visit_ty`'s will be called on things that are in - // public signatures, i.e. things that we're interested in for + // public signatures, i.e., things that we're interested in for // this visitor. intravisit::walk_item(self, item); } @@ -1292,13 +1389,13 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { } for predicate in &generics.where_clause.predicates { match predicate { - &hir::WherePredicate::BoundPredicate(ref bound_pred) => { + hir::WherePredicate::BoundPredicate(bound_pred) => { for bound in bound_pred.bounds.iter() { self.check_generic_bound(bound) } } - &hir::WherePredicate::RegionPredicate(_) => {} - &hir::WherePredicate::EqPredicate(ref eq_pred) => { + hir::WherePredicate::RegionPredicate(_) => {} + hir::WherePredicate::EqPredicate(eq_pred) => { self.visit_ty(&eq_pred.rhs_ty); } } @@ -1337,7 +1434,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { } } - // we don't need to introspect into these at all: an + // We don't need to introspect into these at all: an // expression/block context can't possibly contain exported things. // (Making them no-ops stops us from traversing the whole AST without // having to be super careful about our `walk_...` calls above.) @@ -1356,10 +1453,8 @@ struct SearchInterfaceForPrivateItemsVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, item_def_id: DefId, span: Span, - /// The visitor checks that each component type is at least this visible + /// The visitor checks that each component type is at least this visible. required_visibility: ty::Visibility, - /// The visibility of the least visible component that has been visited - min_visibility: ty::Visibility, has_pub_restricted: bool, has_old_errors: bool, in_assoc_ty: bool, @@ -1371,7 +1466,7 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { match param.kind { GenericParamDefKind::Type { has_default, .. } => { if has_default { - self.tcx.type_of(param.def_id).visit_with(self); + self.visit(self.tcx.type_of(param.def_id)); } } GenericParamDefKind::Lifetime => {} @@ -1381,138 +1476,53 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { } fn predicates(&mut self) -> &mut Self { - // NB: We use `explicit_predicates_of` and not `predicates_of` + // N.B., we use `explicit_predicates_of` and not `predicates_of` // because we don't want to report privacy errors due to where // clauses that the compiler inferred. We only want to // consider the ones that the user wrote. This is important // for the inferred outlives rules; see // `src/test/ui/rfc-2093-infer-outlives/privacy.rs`. - let predicates = self.tcx.explicit_predicates_of(self.item_def_id); - for (predicate, _) in &predicates.predicates { - predicate.visit_with(self); - match predicate { - &ty::Predicate::Trait(poly_predicate) => { - self.check_trait_ref(poly_predicate.skip_binder().trait_ref); - }, - &ty::Predicate::Projection(poly_predicate) => { - let tcx = self.tcx; - self.check_trait_ref( - poly_predicate.skip_binder().projection_ty.trait_ref(tcx) - ); - }, - _ => (), - }; - } + self.visit_predicates(self.tcx.explicit_predicates_of(self.item_def_id)); self } fn ty(&mut self) -> &mut Self { - let ty = self.tcx.type_of(self.item_def_id); - ty.visit_with(self); - if let ty::FnDef(def_id, _) = ty.sty { - if def_id == self.item_def_id { - self.tcx.fn_sig(def_id).visit_with(self); - } - } + self.visit(self.tcx.type_of(self.item_def_id)); self } - fn impl_trait_ref(&mut self) -> &mut Self { - if let Some(impl_trait_ref) = self.tcx.impl_trait_ref(self.item_def_id) { - self.check_trait_ref(impl_trait_ref); - impl_trait_ref.super_visit_with(self); - } - self - } + fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { + let node_id = match self.tcx.hir().as_local_node_id(def_id) { + Some(node_id) => node_id, + None => return false, + }; - fn check_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>) { - // Non-local means public (private items can't leave their crate, modulo bugs) - if let Some(node_id) = self.tcx.hir.as_local_node_id(trait_ref.def_id) { - let item = self.tcx.hir.expect_item(node_id); - let vis = ty::Visibility::from_hir(&item.vis, node_id, self.tcx); - if !vis.is_at_least(self.min_visibility, self.tcx) { - self.min_visibility = vis; - } - if !vis.is_at_least(self.required_visibility, self.tcx) { - if self.has_pub_restricted || self.has_old_errors || self.in_assoc_ty { - struct_span_err!(self.tcx.sess, self.span, E0445, - "private trait `{}` in public interface", trait_ref) - .span_label(self.span, format!( - "can't leak private trait")) - .emit(); + let (vis, vis_span, vis_descr) = def_id_visibility(self.tcx, def_id); + if !vis.is_at_least(self.required_visibility, self.tcx) { + let msg = format!("{} {} `{}` in public interface", vis_descr, kind, descr); + if self.has_pub_restricted || self.has_old_errors || self.in_assoc_ty { + let mut err = if kind == "trait" { + struct_span_err!(self.tcx.sess, self.span, E0445, "{}", msg) } else { - self.tcx.lint_node(lint::builtin::PRIVATE_IN_PUBLIC, - node_id, - self.span, - &format!("private trait `{}` in public \ - interface (error E0445)", trait_ref)); - } + struct_span_err!(self.tcx.sess, self.span, E0446, "{}", msg) + }; + err.span_label(self.span, format!("can't leak {} {}", vis_descr, kind)); + err.span_label(vis_span, format!("`{}` declared as {}", descr, vis_descr)); + err.emit(); + } else { + let err_code = if kind == "trait" { "E0445" } else { "E0446" }; + self.tcx.lint_node(lint::builtin::PRIVATE_IN_PUBLIC, node_id, self.span, + &format!("{} (error {})", msg, err_code)); } } + false } } -impl<'a, 'tcx: 'a> TypeVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { - fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { - let ty_def_id = match ty.sty { - ty::Adt(adt, _) => Some(adt.did), - ty::Foreign(did) => Some(did), - ty::Dynamic(ref obj, ..) => Some(obj.principal().def_id()), - ty::Projection(ref proj) => { - if self.required_visibility == ty::Visibility::Invisible { - // Conservatively approximate the whole type alias as public without - // recursing into its components when determining impl publicity. - // For example, `impl ::Alias {...}` may be a public impl - // even if both `Type` and `Trait` are private. - // Ideally, associated types should be substituted in the same way as - // free type aliases, but this isn't done yet. - return false; - } - let trait_ref = proj.trait_ref(self.tcx); - Some(trait_ref.def_id) - } - _ => None - }; - - if let Some(def_id) = ty_def_id { - // Non-local means public (private items can't leave their crate, modulo bugs) - if let Some(node_id) = self.tcx.hir.as_local_node_id(def_id) { - let hir_vis = match self.tcx.hir.find(node_id) { - Some(Node::Item(item)) => &item.vis, - Some(Node::ForeignItem(item)) => &item.vis, - _ => bug!("expected item of foreign item"), - }; - - let vis = ty::Visibility::from_hir(hir_vis, node_id, self.tcx); - - if !vis.is_at_least(self.min_visibility, self.tcx) { - self.min_visibility = vis; - } - if !vis.is_at_least(self.required_visibility, self.tcx) { - let vis_adj = match hir_vis.node { - hir::VisibilityKind::Crate(_) => "crate-visible", - hir::VisibilityKind::Restricted { .. } => "restricted", - _ => "private" - }; - - if self.has_pub_restricted || self.has_old_errors || self.in_assoc_ty { - let mut err = struct_span_err!(self.tcx.sess, self.span, E0446, - "{} type `{}` in public interface", vis_adj, ty); - err.span_label(self.span, format!("can't leak {} type", vis_adj)); - err.span_label(hir_vis.span, format!("`{}` declared as {}", ty, vis_adj)); - err.emit(); - } else { - self.tcx.lint_node(lint::builtin::PRIVATE_IN_PUBLIC, - node_id, - self.span, - &format!("{} type `{}` in public \ - interface (error E0446)", vis_adj, ty)); - } - } - } - } - - ty.super_visit_with(self) +impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { + fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } + fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { + self.check_def_id(def_id, kind, descr) } } @@ -1520,7 +1530,6 @@ struct PrivateItemsInPublicInterfacesVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, has_pub_restricted: bool, old_error_set: &'a NodeSet, - inner_visibility: ty::Visibility, } impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { @@ -1537,7 +1546,7 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { has_old_errors = true; break; } - let parent = self.tcx.hir.get_parent_node(id); + let parent = self.tcx.hir().get_parent_node(id); if parent == id { break; } @@ -1551,72 +1560,68 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { SearchInterfaceForPrivateItemsVisitor { tcx: self.tcx, - item_def_id: self.tcx.hir.local_def_id(item_id), - span: self.tcx.hir.span(item_id), - min_visibility: ty::Visibility::Public, + item_def_id: self.tcx.hir().local_def_id(item_id), + span: self.tcx.hir().span(item_id), required_visibility, has_pub_restricted: self.has_pub_restricted, has_old_errors, in_assoc_ty: false, } } + + fn check_trait_or_impl_item(&self, node_id: ast::NodeId, assoc_item_kind: AssociatedItemKind, + defaultness: hir::Defaultness, vis: ty::Visibility) { + let mut check = self.check(node_id, vis); + + let (check_ty, is_assoc_ty) = match assoc_item_kind { + AssociatedItemKind::Const | AssociatedItemKind::Method { .. } => (true, false), + AssociatedItemKind::Type => (defaultness.has_value(), true), + // `ty()` for existential types is the underlying type, + // it's not a part of interface, so we skip it. + AssociatedItemKind::Existential => (false, true), + }; + check.in_assoc_ty = is_assoc_ty; + check.generics().predicates(); + if check_ty { + check.ty(); + } + } } impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::OnlyBodies(&self.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } fn visit_item(&mut self, item: &'tcx hir::Item) { let tcx = self.tcx; - let min = |vis1: ty::Visibility, vis2| { - if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 } - }; - let item_visibility = ty::Visibility::from_hir(&item.vis, item.id, tcx); match item.node { - // Crates are always public + // Crates are always public. hir::ItemKind::ExternCrate(..) => {} - // All nested items are checked by visit_item + // All nested items are checked by `visit_item`. hir::ItemKind::Mod(..) => {} - // Checked in resolve + // Checked in resolve. hir::ItemKind::Use(..) => {} - // No subitems + // No subitems. hir::ItemKind::GlobalAsm(..) => {} - hir::ItemKind::Existential(hir::ExistTy { impl_trait_fn: Some(_), .. }) => { - // Check the traits being exposed, as they're separate, - // e.g. `impl Iterator` has two predicates, - // `X: Iterator` and `::Item == T`, - // where `X` is the `impl Iterator` itself, - // stored in `predicates_of`, not in the `Ty` itself. - - self.check(item.id, item_visibility).predicates(); - } - // Subitems of these items have inherited publicity - hir::ItemKind::Const(..) | hir::ItemKind::Static(..) | hir::ItemKind::Fn(..) | - hir::ItemKind::Existential(..) | - hir::ItemKind::Ty(..) => { + // Subitems of these items have inherited publicity. + hir::ItemKind::Const(..) | hir::ItemKind::Static(..) | + hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) => { self.check(item.id, item_visibility).generics().predicates().ty(); - - // Recurse for e.g. `impl Trait` (see `visit_ty`). - self.inner_visibility = item_visibility; - intravisit::walk_item(self, item); + } + hir::ItemKind::Existential(..) => { + // `ty()` for existential types is the underlying type, + // it's not a part of interface, so we skip it. + self.check(item.id, item_visibility).generics().predicates(); } hir::ItemKind::Trait(.., ref trait_item_refs) => { self.check(item.id, item_visibility).generics().predicates(); for trait_item_ref in trait_item_refs { - let mut check = self.check(trait_item_ref.id.node_id, item_visibility); - check.in_assoc_ty = trait_item_ref.kind == hir::AssociatedItemKind::Type; - check.generics().predicates(); - - if trait_item_ref.kind == hir::AssociatedItemKind::Type && - !trait_item_ref.defaultness.has_value() { - // No type to visit. - } else { - check.ty(); - } + self.check_trait_or_impl_item(trait_item_ref.id.node_id, trait_item_ref.kind, + trait_item_ref.defaultness, item_visibility); } } hir::ItemKind::TraitAlias(..) => { @@ -1631,75 +1636,49 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> } } } - // Subitems of foreign modules have their own publicity + // Subitems of foreign modules have their own publicity. hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { let vis = ty::Visibility::from_hir(&foreign_item.vis, item.id, tcx); self.check(foreign_item.id, vis).generics().predicates().ty(); } } - // Subitems of structs and unions have their own publicity + // Subitems of structs and unions have their own publicity. hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { self.check(item.id, item_visibility).generics().predicates(); for field in struct_def.fields() { let field_visibility = ty::Visibility::from_hir(&field.vis, item.id, tcx); - self.check(field.id, min(item_visibility, field_visibility)).ty(); + self.check(field.id, min(item_visibility, field_visibility, tcx)).ty(); } } // An inherent impl is public when its type is public - // Subitems of inherent impls have their own publicity - hir::ItemKind::Impl(.., None, _, ref impl_item_refs) => { - let ty_vis = - self.check(item.id, ty::Visibility::Invisible).ty().min_visibility; - self.check(item.id, ty_vis).generics().predicates(); - - for impl_item_ref in impl_item_refs { - let impl_item = self.tcx.hir.impl_item(impl_item_ref.id); - let impl_item_vis = ty::Visibility::from_hir(&impl_item.vis, item.id, tcx); - let mut check = self.check(impl_item.id, min(impl_item_vis, ty_vis)); - check.in_assoc_ty = impl_item_ref.kind == hir::AssociatedItemKind::Type; - check.generics().predicates().ty(); - - // Recurse for e.g. `impl Trait` (see `visit_ty`). - self.inner_visibility = impl_item_vis; - intravisit::walk_impl_item(self, impl_item); - } - } + // Subitems of inherent impls have their own publicity. // A trait impl is public when both its type and its trait are public - // Subitems of trait impls have inherited publicity - hir::ItemKind::Impl(.., Some(_), _, ref impl_item_refs) => { - let vis = self.check(item.id, ty::Visibility::Invisible) - .ty().impl_trait_ref().min_visibility; - self.check(item.id, vis).generics().predicates(); + // Subitems of trait impls have inherited publicity. + hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => { + let impl_vis = ty::Visibility::of_impl(item.id, tcx, &Default::default()); + self.check(item.id, impl_vis).generics().predicates(); for impl_item_ref in impl_item_refs { - let impl_item = self.tcx.hir.impl_item(impl_item_ref.id); - let mut check = self.check(impl_item.id, vis); - check.in_assoc_ty = impl_item_ref.kind == hir::AssociatedItemKind::Type; - check.generics().predicates().ty(); - - // Recurse for e.g. `impl Trait` (see `visit_ty`). - self.inner_visibility = vis; - intravisit::walk_impl_item(self, impl_item); + let impl_item = tcx.hir().impl_item(impl_item_ref.id); + let impl_item_vis = if trait_ref.is_none() { + min(ty::Visibility::from_hir(&impl_item.vis, item.id, tcx), impl_vis, tcx) + } else { + impl_vis + }; + self.check_trait_or_impl_item(impl_item_ref.id.node_id, impl_item_ref.kind, + impl_item_ref.defaultness, impl_item_vis); } } } } - - fn visit_impl_item(&mut self, _impl_item: &'tcx hir::ImplItem) { - // handled in `visit_item` above - } - - // Don't recurse into expressions in array sizes or const initializers - fn visit_expr(&mut self, _: &'tcx hir::Expr) {} - // Don't recurse into patterns in function arguments - fn visit_pat(&mut self, _: &'tcx hir::Pat) {} } pub fn provide(providers: &mut Providers) { *providers = Providers { privacy_access_levels, + check_mod_privacy, ..*providers }; } @@ -1708,35 +1687,43 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Lrc { tcx.privacy_access_levels(LOCAL_CRATE) } -fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - krate: CrateNum) - -> Lrc { - assert_eq!(krate, LOCAL_CRATE); - - let krate = tcx.hir.krate(); +fn check_mod_privacy<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { let empty_tables = ty::TypeckTables::empty(None); // Check privacy of names not checked in previous compilation stages. let mut visitor = NamePrivacyVisitor { tcx, tables: &empty_tables, - current_item: CRATE_NODE_ID, + current_item: DUMMY_NODE_ID, empty_tables: &empty_tables, }; - intravisit::walk_crate(&mut visitor, krate); + let (module, span, node_id) = tcx.hir().get_module(module_def_id); + intravisit::walk_mod(&mut visitor, module, node_id); // Check privacy of explicitly written types and traits as well as // inferred types of expressions and patterns. let mut visitor = TypePrivacyVisitor { tcx, tables: &empty_tables, - current_item: DefId::local(CRATE_DEF_INDEX), + current_item: module_def_id, in_body: false, - span: krate.span, + span, empty_tables: &empty_tables, - visited_opaque_tys: FxHashSet::default() }; - intravisit::walk_crate(&mut visitor, krate); + intravisit::walk_mod(&mut visitor, module, node_id); +} + +fn privacy_access_levels<'tcx>( + tcx: TyCtxt<'_, 'tcx, 'tcx>, + krate: CrateNum, +) -> Lrc { + assert_eq!(krate, LOCAL_CRATE); + + let krate = tcx.hir().krate(); + + for &module in krate.modules.keys() { + queries::check_mod_privacy::ensure(tcx, tcx.hir().local_def_id(module)); + } // Build up a set of all exported items in the AST. This is a set of all // items which are reachable from external crates based on visibility. @@ -1775,12 +1762,11 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, pub_restricted_visitor.has_pub_restricted }; - // Check for private types and traits in public interfaces + // Check for private types and traits in public interfaces. let mut visitor = PrivateItemsInPublicInterfacesVisitor { tcx, has_pub_restricted, old_error_set: &visitor.old_error_set, - inner_visibility: ty::Visibility::Public, }; krate.visit_all_item_likes(&mut DeepVisitor::new(&mut visitor)); } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 72fe7355e4c..3752d953f8a 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Reduced graph building //! //! Here we build the "reduced graph": the graph of the module tree without @@ -31,6 +21,8 @@ use std::cell::Cell; use std::ptr; use rustc_data_structures::sync::Lrc; +use errors::Applicability; + use syntax::ast::{Name, Ident}; use syntax::attr; @@ -52,6 +44,7 @@ impl<'a> ToNameBinding<'a> for (Module<'a>, ty::Visibility, Span, Mark) { fn to_name_binding(self, arenas: &'a ResolverArenas<'a>) -> &'a NameBinding<'a> { arenas.alloc_name_binding(NameBinding { kind: NameBindingKind::Module(self.0), + ambiguity: None, vis: self.1, span: self.2, expansion: self.3, @@ -63,6 +56,7 @@ impl<'a> ToNameBinding<'a> for (Def, ty::Visibility, Span, Mark) { fn to_name_binding(self, arenas: &'a ResolverArenas<'a>) -> &'a NameBinding<'a> { arenas.alloc_name_binding(NameBinding { kind: NameBindingKind::Def(self.0, false), + ambiguity: None, vis: self.1, span: self.2, expansion: self.3, @@ -76,6 +70,7 @@ impl<'a> ToNameBinding<'a> for (Def, ty::Visibility, Span, Mark, IsMacroExport) fn to_name_binding(self, arenas: &'a ResolverArenas<'a>) -> &'a NameBinding<'a> { arenas.alloc_name_binding(NameBinding { kind: NameBindingKind::Def(self.0, true), + ambiguity: None, vis: self.1, span: self.2, expansion: self.3, @@ -83,7 +78,7 @@ impl<'a> ToNameBinding<'a> for (Def, ty::Visibility, Span, Mark, IsMacroExport) } } -impl<'a, 'cl> Resolver<'a, 'cl> { +impl<'a> Resolver<'a> { /// Defines `name` in namespace `ns` of module `parent` to be `def` if it is not yet defined; /// otherwise, reports an error. pub fn define(&mut self, parent: Module<'a>, ident: Ident, ns: Namespace, def: T) @@ -132,33 +127,39 @@ impl<'a, 'cl> Resolver<'a, 'cl> { // so prefixes are prepended with crate root segment if necessary. // The root is prepended lazily, when the first non-empty prefix or terminating glob // appears, so imports in braced groups can have roots prepended independently. + // 2015 identifiers used on global 2018 edition enter special "virtual 2015 mode", don't + // get crate root prepended, but get special treatment during in-scope resolution instead. let is_glob = if let ast::UseTreeKind::Glob = use_tree.kind { true } else { false }; - let crate_root = if !self.session.rust_2018() && - prefix_iter.peek().map_or(is_glob, |seg| !seg.ident.is_path_segment_keyword()) { - Some(Segment::from_ident(Ident::new( - keywords::CrateRoot.name(), use_tree.prefix.span.shrink_to_lo() - ))) - } else { - None - }; + let crate_root = match prefix_iter.peek() { + Some(seg) if !seg.ident.is_path_segment_keyword() && + seg.ident.span.rust_2015() && self.session.rust_2015() => { + Some(seg.ident.span.ctxt()) + } + None if is_glob && use_tree.span.rust_2015() => { + Some(use_tree.span.ctxt()) + } + _ => None, + }.map(|ctxt| Segment::from_ident(Ident::new( + keywords::PathRoot.name(), use_tree.prefix.span.shrink_to_lo().with_ctxt(ctxt) + ))); let prefix = crate_root.into_iter().chain(prefix_iter).collect::>(); debug!("build_reduced_graph_for_use_tree: prefix={:?}", prefix); let empty_for_self = |prefix: &[Segment]| { prefix.is_empty() || - prefix.len() == 1 && prefix[0].ident.name == keywords::CrateRoot.name() + prefix.len() == 1 && prefix[0].ident.name == keywords::PathRoot.name() }; match use_tree.kind { ast::UseTreeKind::Simple(rename, ..) => { - let mut ident = use_tree.ident(); + let mut ident = use_tree.ident().gensym_if_underscore(); let mut module_path = prefix; let mut source = module_path.pop().unwrap(); let mut type_ns_only = false; if nested { // Correctly handle `self` - if source.ident.name == keywords::SelfValue.name() { + if source.ident.name == keywords::SelfLower.name() { type_ns_only = true; if empty_for_self(&module_path) { @@ -179,7 +180,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { } } else { // Disallow `self` - if source.ident.name == keywords::SelfValue.name() { + if source.ident.name == keywords::SelfLower.name() { resolve_error(self, use_tree.span, ResolutionError::SelfImportsOnlyAllowedWithin); @@ -199,7 +200,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { // `crate_name` should not be interpreted as relative. module_path.push(Segment { ident: Ident { - name: keywords::CrateRoot.name(), + name: keywords::PathRoot.name(), span: source.ident.span, }, id: Some(self.session.next_node_id()), @@ -224,13 +225,18 @@ impl<'a, 'cl> Resolver<'a, 'cl> { } let subclass = SingleImport { - target: ident, source: source.ident, - result: PerNS { + target: ident, + source_bindings: PerNS { type_ns: Cell::new(Err(Undetermined)), value_ns: Cell::new(Err(Undetermined)), macro_ns: Cell::new(Err(Undetermined)), }, + target_bindings: PerNS { + type_ns: Cell::new(None), + value_ns: Cell::new(None), + macro_ns: Cell::new(None), + }, type_ns_only, }; self.add_import_directive( @@ -264,7 +270,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { // Ensure there is at most one `self` in the list let self_spans = items.iter().filter_map(|&(ref use_tree, _)| { if let ast::UseTreeKind::Simple(..) = use_tree.kind { - if use_tree.ident().name == keywords::SelfValue.name() { + if use_tree.ident().name == keywords::SelfLower.name() { return Some(use_tree.span); } } @@ -299,7 +305,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { let new_span = prefix[prefix.len() - 1].ident.span; let tree = ast::UseTree { prefix: ast::Path::from_ident( - Ident::new(keywords::SelfValue.name(), new_span) + Ident::new(keywords::SelfLower.name(), new_span) ), kind: ast::UseTreeKind::Simple( Some(Ident::new(keywords::Underscore.name().gensymed(), new_span)), @@ -312,7 +318,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { // This particular use tree &tree, id, &prefix, true, // The whole `use` item - parent_scope.clone(), item, ty::Visibility::Invisible, root_span, + parent_scope, item, ty::Visibility::Invisible, root_span, ); } } @@ -323,7 +329,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { fn build_reduced_graph_for_item(&mut self, item: &Item, parent_scope: ParentScope<'a>) { let parent = parent_scope.module; let expansion = parent_scope.expansion; - let ident = item.ident; + let ident = item.ident.gensym_if_underscore(); let sp = item.span; let vis = self.resolve_visibility(&item.vis); @@ -338,9 +344,24 @@ impl<'a, 'cl> Resolver<'a, 'cl> { } ItemKind::ExternCrate(orig_name) => { - let crate_id = self.crate_loader.process_extern_crate(item, &self.definitions); - let module = - self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX }); + let module = if orig_name.is_none() && ident.name == keywords::SelfLower.name() { + self.session + .struct_span_err(item.span, "`extern crate self;` requires renaming") + .span_suggestion( + item.span, + "try", + "extern crate self as name;".into(), + Applicability::HasPlaceholders, + ) + .emit(); + return; + } else if orig_name == Some(keywords::SelfLower.name()) { + self.graph_root + } else { + let crate_id = self.crate_loader.process_extern_crate(item, &self.definitions); + self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX }) + }; + self.populate_module_if_necessary(module); if injected_crate_name().map_or(false, |name| ident.name == name) { self.injected_crate = Some(module); @@ -603,7 +624,11 @@ impl<'a, 'cl> Resolver<'a, 'cl> { /// Builds the reduced graph for a single item in an external crate. fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'a>, child: Export) { - let Export { ident, def, vis, span, .. } = child; + let Export { ident, def, vis, span } = child; + // FIXME: We shouldn't create the gensym here, it should come from metadata, + // but metadata cannot encode gensyms currently, so we create it here. + // This is only a guess, two equivalent idents may incorrectly get different gensyms here. + let ident = ident.gensym_if_underscore(); let def_id = def.def_id(); let expansion = Mark::root(); // FIXME(jseyfried) intercrate hygiene match def { @@ -651,6 +676,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> { } module.populated.set(true); } + Def::Existential(..) | + Def::TraitAlias(..) => { + self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, expansion)); + } Def::Struct(..) | Def::Union(..) => { self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, expansion)); @@ -762,6 +791,12 @@ impl<'a, 'cl> Resolver<'a, 'cl> { span_err!(self.session, item.span, E0468, "an `extern crate` loading macros must be at the crate root"); } + if let ItemKind::ExternCrate(Some(orig_name)) = item.node { + if orig_name == keywords::SelfLower.name() { + self.session.span_err(attr.span, + "`macro_use` is not supported on `extern crate self`"); + } + } let ill_formed = |span| span_err!(self.session, span, E0466, "bad macro import"); match attr.meta() { Some(meta) => match meta.node { @@ -853,13 +888,13 @@ impl<'a, 'cl> Resolver<'a, 'cl> { } } -pub struct BuildReducedGraphVisitor<'a, 'b: 'a, 'c: 'b> { - pub resolver: &'a mut Resolver<'b, 'c>, +pub struct BuildReducedGraphVisitor<'a, 'b: 'a> { + pub resolver: &'a mut Resolver<'b>, pub current_legacy_scope: LegacyScope<'b>, pub expansion: Mark, } -impl<'a, 'b, 'cl> BuildReducedGraphVisitor<'a, 'b, 'cl> { +impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { fn visit_invoc(&mut self, id: ast::NodeId) -> &'b InvocationData<'b> { let mark = id.placeholder_to_mark(); self.resolver.current_module.unresolved_invocations.borrow_mut().insert(mark); @@ -882,7 +917,7 @@ macro_rules! method { } } -impl<'a, 'b, 'cl> Visitor<'a> for BuildReducedGraphVisitor<'a, 'b, 'cl> { +impl<'a, 'b> Visitor<'a> for BuildReducedGraphVisitor<'a, 'b> { method!(visit_impl_item: ast::ImplItem, ast::ImplItemKind::Macro, walk_impl_item); method!(visit_expr: ast::Expr, ast::ExprKind::Mac, walk_expr); method!(visit_pat: ast::Pat, ast::PatKind::Mac, walk_pat); diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs index 659ca1f5b9f..16d8a95c003 100644 --- a/src/librustc_resolve/check_unused.rs +++ b/src/librustc_resolve/check_unused.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // // Unused import checking // @@ -31,8 +20,8 @@ use syntax::visit::{self, Visitor}; use syntax_pos::{Span, MultiSpan, DUMMY_SP}; -struct UnusedImportCheckVisitor<'a, 'b: 'a, 'd: 'b> { - resolver: &'a mut Resolver<'b, 'd>, +struct UnusedImportCheckVisitor<'a, 'b: 'a> { + resolver: &'a mut Resolver<'b>, /// All the (so far) unused imports, grouped path list unused_imports: NodeMap>, base_id: ast::NodeId, @@ -40,21 +29,21 @@ struct UnusedImportCheckVisitor<'a, 'b: 'a, 'd: 'b> { } // Deref and DerefMut impls allow treating UnusedImportCheckVisitor as Resolver. -impl<'a, 'b, 'd> Deref for UnusedImportCheckVisitor<'a, 'b, 'd> { - type Target = Resolver<'b, 'd>; +impl<'a, 'b> Deref for UnusedImportCheckVisitor<'a, 'b> { + type Target = Resolver<'b>; - fn deref<'c>(&'c self) -> &'c Resolver<'b, 'd> { + fn deref<'c>(&'c self) -> &'c Resolver<'b> { &*self.resolver } } -impl<'a, 'b, 'd> DerefMut for UnusedImportCheckVisitor<'a, 'b, 'd> { - fn deref_mut<'c>(&'c mut self) -> &'c mut Resolver<'b, 'd> { +impl<'a, 'b> DerefMut for UnusedImportCheckVisitor<'a, 'b> { + fn deref_mut<'c>(&'c mut self) -> &'c mut Resolver<'b> { &mut *self.resolver } } -impl<'a, 'b, 'd> UnusedImportCheckVisitor<'a, 'b, 'd> { +impl<'a, 'b> UnusedImportCheckVisitor<'a, 'b> { // We have information about whether `use` (import) directives are actually // used now. If an import is not used at all, we signal a lint error. fn check_import(&mut self, item_id: ast::NodeId, id: ast::NodeId, span: Span) { @@ -77,7 +66,7 @@ impl<'a, 'b, 'd> UnusedImportCheckVisitor<'a, 'b, 'd> { } } -impl<'a, 'b, 'cl> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'cl> { +impl<'a, 'b> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b> { fn visit_item(&mut self, item: &'a ast::Item) { self.item_span = item.span; diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 2681295cf9b..3f9c5f4fd27 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] // Error messages for EXXXX errors. Each message should start and end with a @@ -202,7 +192,7 @@ use foo::core; // error: an extern crate named `core` has already fn main() {} ``` -To fix issue issue, you have to rename at least one of the two imports. +To fix this issue, you have to rename at least one of the two imports. Example: ``` @@ -295,9 +285,8 @@ that has been imported into the current module. Erroneous code example: ```compile_fail,E0259 -# #![feature(libc)] extern crate core; -extern crate libc as core; +extern crate std as core; fn main() {} ``` @@ -308,9 +297,8 @@ external crate imported into the current module. Correct example: ``` -# #![feature(libc)] extern crate core; -extern crate libc as other_name; +extern crate std as other_name; fn main() {} ``` diff --git a/src/librustc_resolve/error_reporting.rs b/src/librustc_resolve/error_reporting.rs index 263d23d133e..2a8e95536b8 100644 --- a/src/librustc_resolve/error_reporting.rs +++ b/src/librustc_resolve/error_reporting.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use {CrateLint, PathResult, Segment}; use macros::ParentScope; @@ -17,7 +7,7 @@ use syntax_pos::Span; use resolve_imports::ImportResolver; use std::cmp::Reverse; -impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { +impl<'a, 'b:'a> ImportResolver<'a, 'b> { /// Add suggestions for a path that cannot be resolved. pub(crate) fn make_path_suggestion( &mut self, @@ -30,10 +20,11 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { match (path.get(0), path.get(1)) { // `{{root}}::ident::...` on both editions. // On 2015 `{{root}}` is usually added implicitly. - (Some(fst), Some(snd)) if fst.ident.name == keywords::CrateRoot.name() && + (Some(fst), Some(snd)) if fst.ident.name == keywords::PathRoot.name() && !snd.ident.is_path_segment_keyword() => {} // `ident::...` on 2018 - (Some(fst), _) if self.session.rust_2018() && !fst.ident.is_path_segment_keyword() => { + (Some(fst), _) if fst.ident.span.rust_2018() && + !fst.ident.is_path_segment_keyword() => { // Insert a placeholder that's later replaced by `self`/`super`/etc. path.insert(0, Segment::from_ident(keywords::Invalid.ident())); } @@ -60,7 +51,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { parent_scope: &ParentScope<'b>, ) -> Option<(Vec, Option)> { // Replace first ident with `self` and check if that is valid. - path[0].ident.name = keywords::SelfValue.name(); + path[0].ident.name = keywords::SelfLower.name(); let result = self.resolve_path(&path, None, parent_scope, false, span, CrateLint::No); debug!("make_missing_self_suggestion: path={:?} result={:?}", path, result); if let PathResult::Module(..) = result { @@ -141,7 +132,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { mut path: Vec, parent_scope: &ParentScope<'b>, ) -> Option<(Vec, Option)> { - if !self.session.rust_2018() { + if path[1].ident.span.rust_2015() { return None; } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 12dabd2a31d..55d5cdedd6d 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1,22 +1,15 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] #![feature(crate_visibility_modifier)] +#![feature(label_break_value)] #![feature(nll)] #![feature(rustc_diagnostic_macros)] #![feature(slice_sort_by_cached_key)] +#![recursion_limit="256"] + #[macro_use] extern crate bitflags; #[macro_use] @@ -74,7 +67,7 @@ use syntax_pos::{Span, DUMMY_SP, MultiSpan}; use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; use std::cell::{Cell, RefCell}; -use std::{cmp, fmt, iter, ptr}; +use std::{cmp, fmt, iter, mem, ptr}; use std::collections::BTreeSet; use std::mem::replace; use rustc_data_structures::ptr_key::PtrKey; @@ -83,7 +76,7 @@ use rustc_data_structures::sync::Lrc; use resolve_imports::{ImportDirective, ImportDirectiveSubclass, NameResolution, ImportResolver}; use macros::{InvocationData, LegacyBinding, ParentScope}; -// NB: This module needs to be declared first so diagnostics are +// N.B., this module needs to be declared first so diagnostics are // registered before they are used. mod diagnostics; mod error_reporting; @@ -101,6 +94,13 @@ enum Weak { No, } +enum ScopeSet { + Import(Namespace), + AbsolutePath(Namespace), + Macro(MacroKind), + Module, +} + /// A free importable items suggested in case of resolution failure. struct ImportSuggestion { path: Path, @@ -120,6 +120,16 @@ struct BindingError { target: BTreeSet, } +struct TypoSuggestion { + candidate: Symbol, + + /// The kind of the binding ("crate", "module", etc.) + kind: &'static str, + + /// An appropriate article to refer to the binding ("a", "an", etc.) + article: &'static str, +} + impl PartialOrd for BindingError { fn partial_cmp(&self, other: &BindingError) -> Option { Some(self.cmp(other)) @@ -237,7 +247,7 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver, let sugg_msg = "try using a local type parameter instead"; if let Some((sugg_span, new_snippet)) = cm.generate_local_type_param_snippet(span) { // Suggest the modification to the user - err.span_suggestion_with_applicability( + err.span_suggestion( sugg_span, sugg_msg, new_snippet, @@ -630,7 +640,7 @@ impl<'a> PathSource<'a> { // A minimal representation of a path segment. We use this in resolve because // we synthesize 'path segments' which don't have the rest of an AST or HIR -// PathSegment. +// `PathSegment`. #[derive(Clone, Copy, Debug)] pub struct Segment { ident: Ident, @@ -734,7 +744,7 @@ impl<'tcx> Visitor<'tcx> for UsePlacementFinder { } /// This thing walks the whole crate in DFS manner, visiting each item, resolving names as it goes. -impl<'a, 'tcx, 'cl> Visitor<'tcx> for Resolver<'a, 'cl> { +impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> { fn visit_item(&mut self, item: &'tcx Item) { self.resolve_item(item); } @@ -761,7 +771,7 @@ impl<'a, 'tcx, 'cl> Visitor<'tcx> for Resolver<'a, 'cl> { self.smart_resolve_path(ty.id, qself.as_ref(), path, PathSource::Type); } TyKind::ImplicitSelf => { - let self_ty = keywords::SelfType.ident(); + let self_ty = keywords::SelfUpper.ident(); let def = self.resolve_ident_in_lexical_scope(self_ty, TypeNS, Some(ty.id), ty.span) .map_or(Def::Err, |d| d.def()); self.record_def(ty.id, PathResolution::new(def)); @@ -996,31 +1006,33 @@ impl<'a> LexicalScopeBinding<'a> { } } - -#[derive(Clone, Copy, PartialEq, Debug)] -enum UniformRootKind { - CurrentScope, - ExternPrelude, -} - #[derive(Copy, Clone, Debug)] enum ModuleOrUniformRoot<'a> { /// Regular module. Module(Module<'a>), - /// This "virtual module" denotes either resolution in extern prelude - /// for paths starting with `::` on 2018 edition or `extern::`, - /// or resolution in current scope for single-segment imports. - UniformRoot(UniformRootKind), + /// Virtual module that denotes resolution in crate root with fallback to extern prelude. + CrateRootAndExternPrelude, + + /// Virtual module that denotes resolution in extern prelude. + /// Used for paths starting with `::` on 2018 edition. + ExternPrelude, + + /// Virtual module that denotes resolution in current scope. + /// Used only for resolving single-segment imports. The reason it exists is that import paths + /// are always split into two parts, the first of which should be some kind of module. + CurrentScope, } -impl<'a> PartialEq for ModuleOrUniformRoot<'a> { - fn eq(&self, other: &Self) -> bool { - match (*self, *other) { - (ModuleOrUniformRoot::Module(lhs), ModuleOrUniformRoot::Module(rhs)) => - ptr::eq(lhs, rhs), - (ModuleOrUniformRoot::UniformRoot(lhs), ModuleOrUniformRoot::UniformRoot(rhs)) => - lhs == rhs, +impl ModuleOrUniformRoot<'_> { + fn same_def(lhs: Self, rhs: Self) -> bool { + match (lhs, rhs) { + (ModuleOrUniformRoot::Module(lhs), + ModuleOrUniformRoot::Module(rhs)) => lhs.def() == rhs.def(), + (ModuleOrUniformRoot::CrateRootAndExternPrelude, + ModuleOrUniformRoot::CrateRootAndExternPrelude) | + (ModuleOrUniformRoot::ExternPrelude, ModuleOrUniformRoot::ExternPrelude) | + (ModuleOrUniformRoot::CurrentScope, ModuleOrUniformRoot::CurrentScope) => true, _ => false, } } @@ -1163,10 +1175,6 @@ impl<'a> ModuleData<'a> { } } - fn is_local(&self) -> bool { - self.normal_ancestor_id.is_local() - } - fn nearest_item_scope(&'a self) -> Module<'a> { if self.is_trait() { self.parent.unwrap() } else { self } } @@ -1193,6 +1201,7 @@ impl<'a> fmt::Debug for ModuleData<'a> { #[derive(Clone, Debug)] pub struct NameBinding<'a> { kind: NameBindingKind<'a>, + ambiguity: Option<(&'a NameBinding<'a>, AmbiguityKind)>, expansion: Mark, span: Span, vis: ty::Visibility, @@ -1217,11 +1226,6 @@ enum NameBindingKind<'a> { directive: &'a ImportDirective<'a>, used: Cell, }, - Ambiguity { - kind: AmbiguityKind, - b1: &'a NameBinding<'a>, - b2: &'a NameBinding<'a>, - } } struct PrivacyError<'a>(Span, Ident, &'a NameBinding<'a>); @@ -1239,6 +1243,7 @@ struct UseError<'a> { #[derive(Clone, Copy, PartialEq, Debug)] enum AmbiguityKind { Import, + AbsolutePath, BuiltinAttr, DeriveHelper, LegacyHelperVsPrelude, @@ -1254,6 +1259,8 @@ impl AmbiguityKind { match self { AmbiguityKind::Import => "name vs any other name during import resolution", + AmbiguityKind::AbsolutePath => + "name in the crate root vs extern crate during absolute path resolution", AmbiguityKind::BuiltinAttr => "built-in attribute vs any other name", AmbiguityKind::DeriveHelper => @@ -1279,6 +1286,7 @@ impl AmbiguityKind { /// Miscellaneous bits of metadata for better ambiguity error reporting. #[derive(Clone, Copy, PartialEq)] enum AmbiguityErrorMisc { + SuggestCrate, SuggestSelf, FromPrelude, None, @@ -1307,15 +1315,13 @@ impl<'a> NameBinding<'a> { NameBindingKind::Def(def, _) => def, NameBindingKind::Module(module) => module.def().unwrap(), NameBindingKind::Import { binding, .. } => binding.def(), - NameBindingKind::Ambiguity { .. } => Def::Err, } } - fn def_ignoring_ambiguity(&self) -> Def { - match self.kind { - NameBindingKind::Import { binding, .. } => binding.def_ignoring_ambiguity(), - NameBindingKind::Ambiguity { b1, .. } => b1.def_ignoring_ambiguity(), - _ => self.def(), + fn is_ambiguity(&self) -> bool { + self.ambiguity.is_some() || match self.kind { + NameBindingKind::Import { binding, .. } => binding.is_ambiguity(), + _ => false, } } @@ -1360,7 +1366,6 @@ impl<'a> NameBinding<'a> { fn is_glob_import(&self) -> bool { match self.kind { NameBindingKind::Import { directive, .. } => directive.is_glob(), - NameBindingKind::Ambiguity { b1, .. } => b1.is_glob_import(), _ => false, } } @@ -1380,7 +1385,7 @@ impl<'a> NameBinding<'a> { } fn macro_kind(&self) -> Option { - match self.def_ignoring_ambiguity() { + match self.def() { Def::Macro(_, kind) => Some(kind), Def::NonMacroAttr(..) => Some(MacroKind::Attr), _ => None, @@ -1453,7 +1458,7 @@ impl PrimitiveTypeTable { } } -#[derive(Default, Clone)] +#[derive(Debug, Default, Clone)] pub struct ExternPreludeEntry<'a> { extern_crate_item: Option<&'a NameBinding<'a>>, pub introduced_by_item: bool, @@ -1462,7 +1467,7 @@ pub struct ExternPreludeEntry<'a> { /// The main resolver class. /// /// This is the visitor that walks the whole crate. -pub struct Resolver<'a, 'b: 'a> { +pub struct Resolver<'a> { session: &'a Session, cstore: &'a CStore, @@ -1505,8 +1510,12 @@ pub struct Resolver<'a, 'b: 'a> { /// The current self item if inside an ADT (used for better errors). current_self_item: Option, - /// FIXME: Refactor things so that this is passed through arguments and not resolver. + /// FIXME: Refactor things so that these fields are passed through arguments and not resolver. + /// We are resolving a last import segment during import validation. last_import_segment: bool, + /// This binding should be ignored during in-module resolution, so that we don't get + /// "self-confirming" import resolutions during import validation. + blacklisted_binding: Option<&'a NameBinding<'a>>, /// The idents for the primitive types. primitive_type_table: PrimitiveTypeTable, @@ -1537,9 +1546,7 @@ pub struct Resolver<'a, 'b: 'a> { extern_module_map: FxHashMap<(DefId, bool /* MacrosOnly? */), Module<'a>>, binding_parent_modules: FxHashMap>, Module<'a>>, - pub make_glob_map: bool, - /// Maps imports to the names of items actually imported (this actually maps - /// all imports, but only glob imports are actually interesting). + /// Maps glob imports to the names of items actually imported. pub glob_map: GlobMap, used_imports: FxHashSet<(NodeId, Namespace)>, @@ -1562,7 +1569,7 @@ pub struct Resolver<'a, 'b: 'a> { arenas: &'a ResolverArenas<'a>, dummy_binding: &'a NameBinding<'a>, - crate_loader: &'a mut CrateLoader<'b>, + crate_loader: &'a mut CrateLoader<'a>, macro_names: FxHashSet, builtin_macros: FxHashMap>, macro_use_prelude: FxHashMap>, @@ -1570,8 +1577,6 @@ pub struct Resolver<'a, 'b: 'a> { macro_map: FxHashMap>, macro_defs: FxHashMap, local_macro_def_scopes: FxHashMap>, - pub whitelisted_legacy_custom_derives: Vec, - pub found_unresolved_macro: bool, /// List of crate local macros that we need to warn about as being unused. /// Right now this only includes macro_rules! macros, and macros 2.0. @@ -1637,7 +1642,7 @@ impl<'a> ResolverArenas<'a> { } } -impl<'a, 'b: 'a, 'cl: 'b> ty::DefIdTree for &'a Resolver<'b, 'cl> { +impl<'a, 'b: 'a> ty::DefIdTree for &'a Resolver<'b> { fn parent(self, id: DefId) -> Option { match id.krate { LOCAL_CRATE => self.definitions.def_key(id.index).parent, @@ -1648,7 +1653,7 @@ impl<'a, 'b: 'a, 'cl: 'b> ty::DefIdTree for &'a Resolver<'b, 'cl> { /// This interface is used through the AST→HIR step, to embed full paths into the HIR. After that /// the resolver is no longer needed as all the relevant information is inline. -impl<'a, 'cl> hir::lowering::Resolver for Resolver<'a, 'cl> { +impl<'a> hir::lowering::Resolver for Resolver<'a> { fn resolve_hir_path( &mut self, path: &ast::Path, @@ -1665,7 +1670,7 @@ impl<'a, 'cl> hir::lowering::Resolver for Resolver<'a, 'cl> { components: &[&str], is_value: bool ) -> hir::Path { - let segments = iter::once(keywords::CrateRoot.ident()) + let segments = iter::once(keywords::PathRoot.ident()) .chain( crate_root.into_iter() .chain(components.iter().cloned()) @@ -1694,7 +1699,7 @@ impl<'a, 'cl> hir::lowering::Resolver for Resolver<'a, 'cl> { } } -impl<'a, 'crateloader> Resolver<'a, 'crateloader> { +impl<'a> Resolver<'a> { /// Rustdoc uses this to resolve things in a recoverable way. ResolutionError<'a> /// isn't something that can be returned because it can't be made to live that long, /// and also it's a private type. Fortunately rustdoc doesn't need to know the error, @@ -1707,7 +1712,7 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { let path = if path_str.starts_with("::") { ast::Path { span, - segments: iter::once(keywords::CrateRoot.ident()) + segments: iter::once(keywords::PathRoot.ident()) .chain({ path_str.split("::").skip(1).map(Ident::from_str) }) @@ -1757,8 +1762,7 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { error_callback(self, span, ResolutionError::FailedToResolve(msg)); Def::Err } - PathResult::Module(ModuleOrUniformRoot::UniformRoot(_)) | - PathResult::Indeterminate => unreachable!(), + PathResult::Module(..) | PathResult::Indeterminate => unreachable!(), PathResult::Failed(span, msg, _) => { error_callback(self, span, ResolutionError::FailedToResolve(&msg)); Def::Err @@ -1784,15 +1788,14 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { } } -impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { +impl<'a> Resolver<'a> { pub fn new(session: &'a Session, cstore: &'a CStore, krate: &Crate, crate_name: &str, - make_glob_map: MakeGlobMap, - crate_loader: &'a mut CrateLoader<'crateloader>, + crate_loader: &'a mut CrateLoader<'a>, arenas: &'a ResolverArenas<'a>) - -> Resolver<'a, 'crateloader> { + -> Resolver<'a> { let root_def_id = DefId::local(CRATE_DEF_INDEX); let root_module_kind = ModuleKind::Def(Def::Mod(root_def_id), keywords::Invalid.name()); let graph_root = arenas.alloc_module(ModuleData { @@ -1858,6 +1861,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { current_self_type: None, current_self_item: None, last_import_segment: false, + blacklisted_binding: None, primitive_type_table: PrimitiveTypeTable::new(), @@ -1872,7 +1876,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { extern_module_map: FxHashMap::default(), binding_parent_modules: FxHashMap::default(), - make_glob_map: make_glob_map == MakeGlobMap::Yes, glob_map: Default::default(), used_imports: FxHashSet::default(), @@ -1889,6 +1892,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { arenas, dummy_binding: arenas.alloc_name_binding(NameBinding { kind: NameBindingKind::Def(Def::Err, false), + ambiguity: None, expansion: Mark::root(), span: DUMMY_SP, vis: ty::Visibility::Public, @@ -1904,10 +1908,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { macro_defs, local_macro_def_scopes: FxHashMap::default(), name_already_seen: FxHashMap::default(), - whitelisted_legacy_custom_derives: Vec::new(), potentially_unused_imports: Vec::new(), struct_constructors: Default::default(), - found_unresolved_macro: false, unused_macros: FxHashSet::default(), current_type_ascription: Vec::new(), injected_crate: None, @@ -1961,39 +1963,37 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { fn record_use(&mut self, ident: Ident, ns: Namespace, used_binding: &'a NameBinding<'a>, is_lexical_scope: bool) { - match used_binding.kind { - NameBindingKind::Import { directive, binding, ref used } if !used.get() => { - // Avoid marking `extern crate` items that refer to a name from extern prelude, - // but not introduce it, as used if they are accessed from lexical scope. - if is_lexical_scope { - if let Some(entry) = self.extern_prelude.get(&ident.modern()) { - if let Some(crate_item) = entry.extern_crate_item { - if ptr::eq(used_binding, crate_item) && !entry.introduced_by_item { - return; - } + if let Some((b2, kind)) = used_binding.ambiguity { + self.ambiguity_errors.push(AmbiguityError { + kind, ident, b1: used_binding, b2, + misc1: AmbiguityErrorMisc::None, + misc2: AmbiguityErrorMisc::None, + }); + } + if let NameBindingKind::Import { directive, binding, ref used } = used_binding.kind { + // Avoid marking `extern crate` items that refer to a name from extern prelude, + // but not introduce it, as used if they are accessed from lexical scope. + if is_lexical_scope { + if let Some(entry) = self.extern_prelude.get(&ident.modern()) { + if let Some(crate_item) = entry.extern_crate_item { + if ptr::eq(used_binding, crate_item) && !entry.introduced_by_item { + return; } } } - used.set(true); - directive.used.set(true); - self.used_imports.insert((directive.id, ns)); - self.add_to_glob_map(directive.id, ident); - self.record_use(ident, ns, binding, false); } - NameBindingKind::Ambiguity { kind, b1, b2 } => { - self.ambiguity_errors.push(AmbiguityError { - kind, ident, b1, b2, - misc1: AmbiguityErrorMisc::None, - misc2: AmbiguityErrorMisc::None, - }); - } - _ => {} + used.set(true); + directive.used.set(true); + self.used_imports.insert((directive.id, ns)); + self.add_to_glob_map(&directive, ident); + self.record_use(ident, ns, binding, false); } } - fn add_to_glob_map(&mut self, id: NodeId, ident: Ident) { - if self.make_glob_map { - self.glob_map.entry(id).or_default().insert(ident.name); + #[inline] + fn add_to_glob_map(&mut self, directive: &ImportDirective<'_>, ident: Ident) { + if directive.is_glob() { + self.glob_map.entry(directive.id).or_default().insert(ident.name); } } @@ -2020,20 +2020,21 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { record_used_id: Option, path_span: Span) -> Option> { - let record_used = record_used_id.is_some(); assert!(ns == TypeNS || ns == ValueNS); - if ns == TypeNS { - ident.span = if ident.name == keywords::SelfType.name() { - // FIXME(jseyfried) improve `Self` hygiene - ident.span.with_ctxt(SyntaxContext::empty()) - } else { - ident.span.modern() - } + if ident.name == keywords::Invalid.name() { + return Some(LexicalScopeBinding::Def(Def::Err)); + } + ident.span = if ident.name == keywords::SelfUpper.name() { + // FIXME(jseyfried) improve `Self` hygiene + ident.span.with_ctxt(SyntaxContext::empty()) + } else if ns == TypeNS { + ident.span.modern() } else { - ident = ident.modern_and_legacy(); - } + ident.span.modern_and_legacy() + }; // Walk backwards up the ribs in scope. + let record_used = record_used_id.is_some(); let mut module = self.graph_root; for i in (0 .. self.ribs[ns].len()).rev() { if let Some(def) = self.ribs[ns][i].bindings.get(&ident).cloned() { @@ -2191,28 +2192,46 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { fn resolve_ident_in_module( &mut self, module: ModuleOrUniformRoot<'a>, - mut ident: Ident, + ident: Ident, ns: Namespace, parent_scope: Option<&ParentScope<'a>>, record_used: bool, path_span: Span ) -> Result<&'a NameBinding<'a>, Determinacy> { - ident.span = ident.span.modern(); + self.resolve_ident_in_module_ext( + module, ident, ns, parent_scope, record_used, path_span + ).map_err(|(determinacy, _)| determinacy) + } + + fn resolve_ident_in_module_ext( + &mut self, + module: ModuleOrUniformRoot<'a>, + mut ident: Ident, + ns: Namespace, + parent_scope: Option<&ParentScope<'a>>, + record_used: bool, + path_span: Span + ) -> Result<&'a NameBinding<'a>, (Determinacy, Weak)> { let orig_current_module = self.current_module; match module { ModuleOrUniformRoot::Module(module) => { + ident.span = ident.span.modern(); if let Some(def) = ident.span.adjust(module.expansion) { self.current_module = self.macro_def_scope(def); } } - ModuleOrUniformRoot::UniformRoot(UniformRootKind::ExternPrelude) => { + ModuleOrUniformRoot::ExternPrelude => { + ident.span = ident.span.modern(); ident.span.adjust(Mark::root()); } - _ => {} + ModuleOrUniformRoot::CrateRootAndExternPrelude | + ModuleOrUniformRoot::CurrentScope => { + // No adjustments + } } let result = self.resolve_ident_in_module_unadjusted_ext( module, ident, ns, parent_scope, false, record_used, path_span, - ).map_err(|(determinacy, _)| determinacy); + ); self.current_module = orig_current_module; result } @@ -2342,26 +2361,18 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { self.with_current_self_item(item, |this| { this.with_type_parameter_rib(HasTypeParameters(generics, ItemRibKind), |this| { let item_def_id = this.definitions.local_def_id(item.id); - if this.session.features_untracked().self_in_typedefs { - this.with_self_rib(Def::SelfTy(None, Some(item_def_id)), |this| { - visit::walk_item(this, item); - }); - } else { + this.with_self_rib(Def::SelfTy(None, Some(item_def_id)), |this| { visit::walk_item(this, item); - } + }); }); }); } fn future_proof_import(&mut self, use_tree: &ast::UseTree) { - if !self.session.rust_2018() { - return; - } - let segments = &use_tree.prefix.segments; if !segments.is_empty() { let ident = segments[0].ident; - if ident.is_path_segment_keyword() { + if ident.is_path_segment_keyword() || ident.span.rust_2015() { return; } @@ -2369,11 +2380,27 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { ast::UseTreeKind::Simple(..) if segments.len() == 1 => &[TypeNS, ValueNS][..], _ => &[TypeNS], }; + let report_error = |this: &Self, ns| { + let what = if ns == TypeNS { "type parameters" } else { "local variables" }; + this.session.span_err(ident.span, &format!("imports cannot refer to {}", what)); + }; + for &ns in nss { - if let Some(LexicalScopeBinding::Def(..)) = - self.resolve_ident_in_lexical_scope(ident, ns, None, use_tree.prefix.span) { - let what = if ns == TypeNS { "type parameters" } else { "local variables" }; - self.session.span_err(ident.span, &format!("imports cannot refer to {}", what)); + match self.resolve_ident_in_lexical_scope(ident, ns, None, use_tree.prefix.span) { + Some(LexicalScopeBinding::Def(..)) => { + report_error(self, ns); + } + Some(LexicalScopeBinding::Item(binding)) => { + let orig_blacklisted_binding = + mem::replace(&mut self.blacklisted_binding, Some(binding)); + if let Some(LexicalScopeBinding::Def(..)) = + self.resolve_ident_in_lexical_scope(ident, ns, None, + use_tree.prefix.span) { + report_error(self, ns); + } + self.blacklisted_binding = orig_blacklisted_binding; + } + None => {} } } } else if let ast::UseTreeKind::Nested(use_trees) = &use_tree.kind { @@ -2582,7 +2609,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { result } - /// This is called to resolve a trait reference from an `impl` (i.e. `impl Trait for Foo`) + /// This is called to resolve a trait reference from an `impl` (i.e., `impl Trait for Foo`) fn with_optional_trait_ref(&mut self, opt_trait_ref: Option<&TraitRef>, f: F) -> T where F: FnOnce(&mut Resolver, Option) -> T { @@ -2626,7 +2653,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { let mut self_type_rib = Rib::new(NormalRibKind); // plain insert (no renaming, types are not currently hygienic....) - self_type_rib.bindings.insert(keywords::SelfType.ident(), self_def); + self_type_rib.bindings.insert(keywords::SelfUpper.ident(), self_def); self.ribs[TypeNS].push(self_type_rib); f(self); self.ribs[TypeNS].pop(); @@ -2637,7 +2664,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { { let self_def = Def::SelfCtor(impl_id); let mut self_type_rib = Rib::new(NormalRibKind); - self_type_rib.bindings.insert(keywords::SelfType.ident(), self_def); + self_type_rib.bindings.insert(keywords::SelfUpper.ident(), self_def); self.ribs[ValueNS].push(self_type_rib); f(self); self.ribs[ValueNS].pop(); @@ -2864,7 +2891,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { self.resolve_pattern(&pattern, PatternSource::Match, &mut bindings_list); } - // This has to happen *after* we determine which pat_idents are variants + // This has to happen *after* we determine which pat_idents are variants. self.check_consistent_bindings(&arm.pats); if let Some(ast::Guard::If(ref expr)) = arm.guard { @@ -2984,6 +3011,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { // Visit all direct subpatterns of this pattern. let outer_pat_id = pat.id; pat.walk(&mut |pat| { + debug!("resolve_pattern pat={:?} node={:?}", pat, pat.node); match pat.node { PatKind::Ident(bmode, ident, ref opt_pat) => { // First try to resolve the identifier as some existing @@ -3006,8 +3034,8 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { Def::StructCtor(..) | Def::VariantCtor(..) | Def::Const(..) | Def::Static(..) => { // This is unambiguously a fresh binding, either syntactically - // (e.g. `IDENT @ PAT` or `ref IDENT`) or because `IDENT` resolves - // to something unusable as a pattern (e.g. constructor function), + // (e.g., `IDENT @ PAT` or `ref IDENT`) or because `IDENT` resolves + // to something unusable as a pattern (e.g., constructor function), // but we still conservatively report an error, see // issues/33118#issuecomment-233962221 for one reason why. resolve_error( @@ -3123,7 +3151,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { let item_span = path.last().unwrap().ident.span; let (mod_prefix, mod_str) = if path.len() == 1 { (String::new(), "this scope".to_string()) - } else if path.len() == 2 && path[0].ident.name == keywords::CrateRoot.name() { + } else if path.len() == 2 && path[0].ident.name == keywords::PathRoot.name() { (String::new(), "the crate root".to_string()) } else { let mod_path = &path[..path.len() - 1]; @@ -3140,13 +3168,14 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { format!("not found in {}", mod_str), item_span) }; + let code = DiagnosticId::Error(code.into()); let mut err = this.session.struct_span_err_with_code(base_span, &base_msg, code); // Emit help message for fake-self from other languages like `this`(javascript) if ["this", "my"].contains(&&*item_str.as_str()) && this.self_value_is_available(path[0].ident.span, span) { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "did you mean", "self".to_string(), @@ -3158,51 +3187,74 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { if is_self_type(path, ns) { __diagnostic_used!(E0411); err.code(DiagnosticId::Error("E0411".into())); - let available_in = if this.session.features_untracked().self_in_typedefs { - "impls, traits, and type definitions" - } else { - "traits and impls" - }; - err.span_label(span, format!("`Self` is only available in {}", available_in)); - if this.current_self_item.is_some() && nightly_options::is_nightly_build() { - err.help("add #![feature(self_in_typedefs)] to the crate attributes \ - to enable"); - } + err.span_label(span, format!("`Self` is only available in impls, traits, \ + and type definitions")); return (err, Vec::new()); } if is_self_value(path, ns) { + debug!("smart_resolve_path_fragment E0424 source:{:?}", source); + __diagnostic_used!(E0424); err.code(DiagnosticId::Error("E0424".into())); - err.span_label(span, format!("`self` value is a keyword \ - only available in \ - methods with `self` parameter")); + err.span_label(span, match source { + PathSource::Pat => { + format!("`self` value is a keyword \ + and may not be bound to \ + variables or shadowed") + } + _ => { + format!("`self` value is a keyword \ + only available in methods \ + with `self` parameter") + } + }); return (err, Vec::new()); } // Try to lookup the name in more relaxed fashion for better error reporting. let ident = path.last().unwrap().ident; - let candidates = this.lookup_import_candidates(ident.name, ns, is_expected); + let candidates = this.lookup_import_candidates(ident, ns, is_expected); if candidates.is_empty() && is_expected(Def::Enum(DefId::local(CRATE_DEF_INDEX))) { let enum_candidates = - this.lookup_import_candidates(ident.name, ns, is_enum_variant); + this.lookup_import_candidates(ident, ns, is_enum_variant); let mut enum_candidates = enum_candidates.iter() - .map(|suggestion| import_candidate_to_paths(&suggestion)).collect::>(); + .map(|suggestion| { + import_candidate_to_enum_paths(&suggestion) + }).collect::>(); enum_candidates.sort(); - for (sp, variant_path, enum_path) in enum_candidates { - if sp.is_dummy() { - let msg = format!("there is an enum variant `{}`, \ - try using `{}`?", - variant_path, - enum_path); - err.help(&msg); + + if !enum_candidates.is_empty() { + // contextualize for E0412 "cannot find type", but don't belabor the point + // (that it's a variant) for E0573 "expected type, found variant" + let preamble = if def.is_none() { + let others = match enum_candidates.len() { + 1 => String::new(), + 2 => " and 1 other".to_owned(), + n => format!(" and {} others", n) + }; + format!("there is an enum variant `{}`{}; ", + enum_candidates[0].0, others) } else { - err.span_suggestion_with_applicability( - span, - "you can try using the variant's enum", - enum_path, - Applicability::MachineApplicable, - ); - } + String::new() + }; + let msg = format!("{}try using the variant's enum", preamble); + + err.span_suggestions( + span, + &msg, + enum_candidates.into_iter() + .map(|(_variant_path, enum_ty_path)| enum_ty_path) + // variants reëxported in prelude doesn't mean `prelude::v1` is the + // type name! FIXME: is there a more principled way to do this that + // would work for other reëxports? + .filter(|enum_ty_path| enum_ty_path != "std::prelude::v1") + // also say `Option` rather than `std::prelude::v1::Option` + .map(|enum_ty_path| { + // FIXME #56861: DRYer prelude filtering + enum_ty_path.trim_start_matches("std::prelude::v1::").to_owned() + }), + Applicability::MachineApplicable, + ); } } if path.len() == 1 && this.self_type_is_available(span) { @@ -3210,7 +3262,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { let self_is_available = this.self_value_is_available(path[0].ident.span, span); match candidate { AssocSuggestion::Field => { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "try", format!("self.{}", path_str), @@ -3223,7 +3275,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { } } AssocSuggestion::MethodWithSelf if self_is_available => { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "try", format!("self.{}", path_str), @@ -3231,7 +3283,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { ); } AssocSuggestion::MethodWithSelf | AssocSuggestion::AssocItem => { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "try", format!("Self::{}", path_str), @@ -3245,9 +3297,20 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { let mut levenshtein_worked = false; - // Try Levenshtein. - if let Some(candidate) = this.lookup_typo_candidate(path, ns, is_expected, span) { - err.span_label(ident_span, format!("did you mean `{}`?", candidate)); + // Try Levenshtein algorithm. + let suggestion = this.lookup_typo_candidate(path, ns, is_expected, span); + if let Some(suggestion) = suggestion { + let msg = format!( + "{} {} with a similar name exists", + suggestion.article, suggestion.kind + ); + err.span_suggestion( + ident_span, + &msg, + suggestion.candidate.to_string(), + Applicability::MaybeIncorrect, + ); + levenshtein_worked = true; } @@ -3255,7 +3318,12 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { if let Some(def) = def { match (def, source) { (Def::Macro(..), _) => { - err.span_label(span, format!("did you mean `{}!(...)`?", path_str)); + err.span_suggestion( + span, + "use `!` to invoke the macro", + format!("{}!", path_str), + Applicability::MaybeIncorrect, + ); return (err, candidates); } (Def::TyAlias(..), PathSource::Trait(_)) => { @@ -3267,13 +3335,22 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { } (Def::Mod(..), PathSource::Expr(Some(parent))) => match parent.node { ExprKind::Field(_, ident) => { - err.span_label(parent.span, format!("did you mean `{}::{}`?", - path_str, ident)); + err.span_suggestion( + parent.span, + "use the path separator to refer to an item", + format!("{}::{}", path_str, ident), + Applicability::MaybeIncorrect, + ); return (err, candidates); } ExprKind::MethodCall(ref segment, ..) => { - err.span_label(parent.span, format!("did you mean `{}::{}(...)`?", - path_str, segment.ident)); + let span = parent.span.with_hi(segment.ident.span.hi()); + err.span_suggestion( + span, + "use the path separator to refer to an item", + format!("{}::{}", path_str, segment.ident), + Applicability::MaybeIncorrect, + ); return (err, candidates); } _ => {} @@ -3324,11 +3401,34 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { Ok(ref snippet) if snippet == "{" => true, _ => false, }; + // In case this could be a struct literal that needs to be surrounded + // by parenthesis, find the appropriate span. + let mut i = 0; + let mut closing_brace = None; + loop { + sp = sm.next_point(sp); + match sm.span_to_snippet(sp) { + Ok(ref snippet) => { + if snippet == "}" { + let sp = span.to(sp); + if let Ok(snippet) = sm.span_to_snippet(sp) { + closing_brace = Some((sp, snippet)); + } + break; + } + } + _ => break, + } + i += 1; + if i > 100 { // The bigger the span the more likely we're + break; // incorrect. Bound it to 100 chars long. + } + } match source { PathSource::Expr(Some(parent)) => { match parent.node { ExprKind::MethodCall(ref path_assignment, _) => { - err.span_suggestion_with_applicability( + err.span_suggestion( sm.start_point(parent.span) .to(path_assignment.ident.span), "use `::` to access an associated function", @@ -3350,11 +3450,20 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { } }, PathSource::Expr(None) if followed_by_brace == true => { - err.span_label( - span, - format!("did you mean `({} {{ /* fields */ }})`?", - path_str), - ); + if let Some((sp, snippet)) = closing_brace { + err.span_suggestion( + sp, + "surround the struct literal with parenthesis", + format!("({})", snippet), + Applicability::MaybeIncorrect, + ); + } else { + err.span_label( + span, + format!("did you mean `({} {{ /* fields */ }})`?", + path_str), + ); + } return (err, candidates); }, _ => { @@ -3480,7 +3589,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { err.span_label(base_span, "expecting a type here because of type ascription"); if line_sp != line_base_sp { - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( sp, "did you mean to use `;` here instead?", ";".to_string(), @@ -3500,13 +3609,13 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { } fn self_type_is_available(&mut self, span: Span) -> bool { - let binding = self.resolve_ident_in_lexical_scope(keywords::SelfType.ident(), + let binding = self.resolve_ident_in_lexical_scope(keywords::SelfUpper.ident(), TypeNS, None, span); if let Some(LexicalScopeBinding::Def(def)) = binding { def != Def::Err } else { false } } fn self_value_is_available(&mut self, self_span: Span, path_span: Span) -> bool { - let ident = Ident::new(keywords::SelfValue.name(), self_span); + let ident = Ident::new(keywords::SelfLower.name(), self_span); let binding = self.resolve_ident_in_lexical_scope(ident, ValueNS, None, path_span); if let Some(LexicalScopeBinding::Def(def)) = binding { def != Def::Err } else { false } } @@ -3599,7 +3708,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { let res = self.smart_resolve_path_fragment( id, None, - &path[..qself.position + 1], + &path[..=qself.position], span, PathSource::TraitItem(ns), CrateLint::QPathTrait { @@ -3653,13 +3762,12 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { resolve_error(self, span, ResolutionError::FailedToResolve(&msg)); err_path_resolution() } - PathResult::Module(ModuleOrUniformRoot::UniformRoot(_)) | - PathResult::Failed(..) => return None, + PathResult::Module(..) | PathResult::Failed(..) => return None, PathResult::Indeterminate => bug!("indetermined path result in resolve_qpath"), }; if path.len() > 1 && !global_by_default && result.base_def() != Def::Err && - path[0].ident.name != keywords::CrateRoot.name() && + path[0].ident.name != keywords::PathRoot.name() && path[0].ident.name != keywords::DollarCrate.name() { let unqualified_result = { match self.resolve_path_without_parent_scope( @@ -3741,7 +3849,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { let name = ident.name; allow_super &= ns == TypeNS && - (name == keywords::SelfValue.name() || + (name == keywords::SelfLower.name() || name == keywords::Super.name()); if ns == TypeNS { @@ -3765,19 +3873,23 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { return PathResult::Failed(ident.span, msg, false); } if i == 0 { - if name == keywords::SelfValue.name() { + if name == keywords::SelfLower.name() { let mut ctxt = ident.span.ctxt().modern(); module = Some(ModuleOrUniformRoot::Module( self.resolve_self(&mut ctxt, self.current_module))); continue; } - if name == keywords::Extern.name() || - name == keywords::CrateRoot.name() && self.session.rust_2018() { - module = - Some(ModuleOrUniformRoot::UniformRoot(UniformRootKind::ExternPrelude)); + if name == keywords::PathRoot.name() && ident.span.rust_2018() { + module = Some(ModuleOrUniformRoot::ExternPrelude); + continue; + } + if name == keywords::PathRoot.name() && + ident.span.rust_2015() && self.session.rust_2018() { + // `::a::b` from 2015 macro on 2018 global edition + module = Some(ModuleOrUniformRoot::CrateRootAndExternPrelude); continue; } - if name == keywords::CrateRoot.name() || + if name == keywords::PathRoot.name() || name == keywords::Crate.name() || name == keywords::DollarCrate.name() { // `::a::b`, `crate::a::b` or `$crate::a::b` @@ -3790,12 +3902,12 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { // Report special messages for path segment keywords in wrong positions. if ident.is_path_segment_keyword() && i != 0 { - let name_str = if name == keywords::CrateRoot.name() { + let name_str = if name == keywords::PathRoot.name() { "crate root".to_string() } else { format!("`{}`", name) }; - let msg = if i == 1 && path[0].ident.name == keywords::CrateRoot.name() { + let msg = if i == 1 && path[0].ident.name == keywords::PathRoot.name() { format!("global paths cannot start with {}", name_str) } else { format!("{} in paths can only be used in start position", name_str) @@ -3807,9 +3919,9 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { self.resolve_ident_in_module(module, ident, ns, None, record_used, path_span) } else if opt_ns.is_none() || opt_ns == Some(MacroNS) { assert!(ns == TypeNS); - self.early_resolve_ident_in_lexical_scope(ident, ns, None, opt_ns.is_none(), - parent_scope, record_used, record_used, - path_span) + let scopes = if opt_ns.is_none() { ScopeSet::Import(ns) } else { ScopeSet::Module }; + self.early_resolve_ident_in_lexical_scope(ident, scopes, parent_scope, record_used, + record_used, path_span) } else { let record_used_id = if record_used { crate_lint.node_id().or(Some(CRATE_NODE_ID)) } else { None }; @@ -3839,6 +3951,13 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { module = Some(ModuleOrUniformRoot::Module(next_module)); record_segment_def(self, def); } else if def == Def::ToolMod && i + 1 != path.len() { + if binding.is_import() { + self.session.struct_span_err( + ident.span, "cannot use a tool module through an import" + ).span_note( + binding.span, "the tool module imported here" + ).emit(); + } let def = Def::NonMacroAttr(NonMacroAttrKind::Tool); return PathResult::NonModule(PathResolution::new(def)); } else if def == Def::Err { @@ -3875,14 +3994,17 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { let msg = if module_def == self.graph_root.def() { let is_mod = |def| match def { Def::Mod(..) => true, _ => false }; let mut candidates = - self.lookup_import_candidates(name, TypeNS, is_mod); + self.lookup_import_candidates(ident, TypeNS, is_mod); candidates.sort_by_cached_key(|c| { (c.path.segments.len(), c.path.to_string()) }); if let Some(candidate) = candidates.get(0) { format!("did you mean `{}`?", candidate.path) - } else { + } else if !ident.is_reserved() { format!("maybe a missing `extern crate {};`?", ident) + } else { + // the parser will already have complained about the keyword being used + return PathResult::NonModule(err_path_resolution()); } } else if i == 0 { format!("use of undeclared type or module `{}`", ident) @@ -3898,8 +4020,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { PathResult::Module(match module { Some(module) => module, - None if path.is_empty() => - ModuleOrUniformRoot::UniformRoot(UniformRootKind::CurrentScope), + None if path.is_empty() => ModuleOrUniformRoot::CurrentScope, _ => span_bug!(path_span, "resolve_path: non-empty path `{:?}` has no module", path), }) } @@ -3911,11 +4032,6 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { path_span: Span, second_binding: Option<&NameBinding>, ) { - // In the 2018 edition this lint is a hard error, so nothing to do - if self.session.rust_2018() { - return - } - let (diag_id, diag_span) = match crate_lint { CrateLint::No => return, CrateLint::SimplePath(id) => (id, path_span), @@ -3924,13 +4040,14 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { }; let first_name = match path.get(0) { - Some(ident) => ident.ident.name, - None => return, + // In the 2018 edition this lint is a hard error, so nothing to do + Some(seg) if seg.ident.span.rust_2015() && self.session.rust_2015() => seg.ident.name, + _ => return, }; // We're only interested in `use` paths which should start with - // `{{root}}` or `extern` currently. - if first_name != keywords::Extern.name() && first_name != keywords::CrateRoot.name() { + // `{{root}}` currently. + if first_name != keywords::PathRoot.name() { return } @@ -3939,7 +4056,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { Some(Segment { ident, .. }) if ident.name == keywords::Crate.name() => return, // Otherwise go below to see if it's an extern crate Some(_) => {} - // If the path has length one (and it's `CrateRoot` most likely) + // If the path has length one (and it's `PathRoot` most likely) // then we don't know whether we're gonna be importing a crate or an // item in our crate. Defer this lint to elsewhere None => return, @@ -4129,19 +4246,25 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { None } - fn lookup_typo_candidate(&mut self, - path: &[Segment], - ns: Namespace, - filter_fn: FilterFn, - span: Span) - -> Option - where FilterFn: Fn(Def) -> bool + fn lookup_typo_candidate( + &mut self, + path: &[Segment], + ns: Namespace, + filter_fn: FilterFn, + span: Span, + ) -> Option + where + FilterFn: Fn(Def) -> bool, { - let add_module_candidates = |module: Module, names: &mut Vec| { + let add_module_candidates = |module: Module, names: &mut Vec| { for (&(ident, _), resolution) in module.resolutions.borrow().iter() { if let Some(binding) = resolution.borrow().binding { if filter_fn(binding.def()) { - names.push(ident.name); + names.push(TypoSuggestion { + candidate: ident.name, + article: binding.def().article(), + kind: binding.def().kind_name(), + }); } } } @@ -4155,7 +4278,11 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { // Locals and type parameters for (ident, def) in &rib.bindings { if filter_fn(*def) { - names.push(ident.name); + names.push(TypoSuggestion { + candidate: ident.name, + article: def.article(), + kind: def.kind_name(), + }); } } // Items in scope @@ -4168,7 +4295,13 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { } else { // Items from the prelude if !module.no_implicit_prelude { - names.extend(self.extern_prelude.iter().map(|(ident, _)| ident.name)); + names.extend(self.extern_prelude.iter().map(|(ident, _)| { + TypoSuggestion { + candidate: ident.name, + article: "a", + kind: "crate", + } + })); if let Some(prelude) = self.prelude { add_module_candidates(prelude, &mut names); } @@ -4180,7 +4313,13 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { // Add primitive types to the mix if filter_fn(Def::PrimTy(Bool)) { names.extend( - self.primitive_type_table.primitive_types.iter().map(|(name, _)| name) + self.primitive_type_table.primitive_types.iter().map(|(name, _)| { + TypoSuggestion { + candidate: *name, + article: "a", + kind: "primitive type", + } + }) ) } } else { @@ -4197,9 +4336,16 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { let name = path[path.len() - 1].ident.name; // Make sure error reporting is deterministic. - names.sort_by_cached_key(|name| name.as_str()); - match find_best_match_for_name(names.iter(), &name.as_str(), None) { - Some(found) if found != name => Some(found), + names.sort_by_cached_key(|suggestion| suggestion.candidate.as_str()); + + match find_best_match_for_name( + names.iter().map(|suggestion| &suggestion.candidate), + &name.as_str(), + None, + ) { + Some(found) if found != name => names + .into_iter() + .find(|suggestion| suggestion.candidate == found), _ => None, } } @@ -4308,7 +4454,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { for pat in pats { this.resolve_pattern(pat, PatternSource::WhileLet, &mut bindings_list); } - // This has to happen *after* we determine which pat_idents are variants + // This has to happen *after* we determine which pat_idents are variants. this.check_consistent_bindings(pats); this.visit_block(block); this.ribs[ValueNS].pop(); @@ -4495,7 +4641,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { let import_id = match binding.kind { NameBindingKind::Import { directive, .. } => { self.maybe_unused_trait_imports.insert(directive.id); - self.add_to_glob_map(directive.id, trait_name); + self.add_to_glob_map(&directive, trait_name); Some(directive.id) } _ => None, @@ -4507,7 +4653,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { } fn lookup_import_candidates_from_module(&mut self, - lookup_name: Name, + lookup_ident: Ident, namespace: Namespace, start_module: &'a ModuleData<'a>, crate_name: Ident, @@ -4534,11 +4680,11 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { if !name_binding.is_importable() { return; } // collect results based on the filter function - if ident.name == lookup_name && ns == namespace { + if ident.name == lookup_ident.name && ns == namespace { if filter_fn(name_binding.def()) { // create the path let mut segms = path_segments.clone(); - if self.session.rust_2018() { + if lookup_ident.span.rust_2018() { // crate-local absolute paths start with `crate::` in edition 2018 // FIXME: may also be stabilized for Rust 2015 (Issues #45477, #44660) segms.insert( @@ -4572,7 +4718,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { let is_extern_crate_that_also_appears_in_prelude = name_binding.is_extern_crate() && - self.session.rust_2018(); + lookup_ident.span.rust_2018(); let is_visible_to_user = !in_module_is_extern || name_binding.vis == ty::Visibility::Public; @@ -4594,21 +4740,21 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { /// When name resolution fails, this method can be used to look up candidate /// entities with the expected name. It allows filtering them using the /// supplied predicate (which should be used to only accept the types of - /// definitions expected e.g. traits). The lookup spans across all crates. + /// definitions expected e.g., traits). The lookup spans across all crates. /// /// NOTE: The method does not look into imports, but this is not a problem, /// since we report the definitions (thus, the de-aliased imports). fn lookup_import_candidates(&mut self, - lookup_name: Name, + lookup_ident: Ident, namespace: Namespace, filter_fn: FilterFn) -> Vec where FilterFn: Fn(Def) -> bool { let mut suggestions = self.lookup_import_candidates_from_module( - lookup_name, namespace, self.graph_root, keywords::Crate.ident(), &filter_fn); + lookup_ident, namespace, self.graph_root, keywords::Crate.ident(), &filter_fn); - if self.session.rust_2018() { + if lookup_ident.span.rust_2018() { let extern_prelude_names = self.extern_prelude.clone(); for (ident, _) in extern_prelude_names.into_iter() { if let Some(crate_id) = self.crate_loader.maybe_process_path_extern(ident.name, @@ -4620,7 +4766,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { self.populate_module_if_necessary(&crate_root); suggestions.extend(self.lookup_import_candidates_from_module( - lookup_name, namespace, crate_root, ident, &filter_fn)); + lookup_ident, namespace, crate_root, ident, &filter_fn)); } } } @@ -4710,10 +4856,33 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { ty::Visibility::Restricted(self.current_module.normal_ancestor_id) } ast::VisibilityKind::Restricted { ref path, id, .. } => { - // Visibilities are resolved as global by default, add starting root segment. - let segments = path.make_root().iter().chain(path.segments.iter()) - .map(|seg| Segment { ident: seg.ident, id: Some(seg.id) }) - .collect::>(); + // For visibilities we are not ready to provide correct implementation of "uniform + // paths" right now, so on 2018 edition we only allow module-relative paths for now. + // On 2015 edition visibilities are resolved as crate-relative by default, + // so we are prepending a root segment if necessary. + let ident = path.segments.get(0).expect("empty path in visibility").ident; + let crate_root = if ident.is_path_segment_keyword() { + None + } else if ident.span.rust_2018() { + let msg = "relative paths are not supported in visibilities on 2018 edition"; + self.session.struct_span_err(ident.span, msg) + .span_suggestion( + path.span, + "try", + format!("crate::{}", path), + Applicability::MaybeIncorrect, + ) + .emit(); + return ty::Visibility::Public; + } else { + let ctxt = ident.span.ctxt(); + Some(Segment::from_ident(Ident::new( + keywords::PathRoot.name(), path.span.shrink_to_lo().with_ctxt(ctxt) + ))) + }; + + let segments = crate_root.into_iter() + .chain(path.segments.iter().map(|seg| seg.into())).collect::>(); let def = self.smart_resolve_path_fragment( id, None, @@ -4826,20 +4995,25 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { help_msgs.push(format!("consider adding an explicit import of \ `{ident}` to disambiguate", ident = ident)) } - if b.is_extern_crate() && self.session.rust_2018() { - help_msgs.push(format!("use `::{ident}` to refer to this {thing} unambiguously", - ident = ident, thing = b.descr())) - } - if misc == AmbiguityErrorMisc::SuggestSelf { - help_msgs.push(format!("use `self::{ident}` to refer to this {thing} unambiguously", - ident = ident, thing = b.descr())) - } - - if b.span.is_dummy() { - err.note(¬e_msg); - } else { - err.span_note(b.span, ¬e_msg); - } + if b.is_extern_crate() && ident.span.rust_2018() { + help_msgs.push(format!( + "use `::{ident}` to refer to this {thing} unambiguously", + ident = ident, thing = b.descr(), + )) + } + if misc == AmbiguityErrorMisc::SuggestCrate { + help_msgs.push(format!( + "use `crate::{ident}` to refer to this {thing} unambiguously", + ident = ident, thing = b.descr(), + )) + } else if misc == AmbiguityErrorMisc::SuggestSelf { + help_msgs.push(format!( + "use `self::{ident}` to refer to this {thing} unambiguously", + ident = ident, thing = b.descr(), + )) + } + + err.span_note(b.span, ¬e_msg); for (i, help_msg) in help_msgs.iter().enumerate() { let or = if i == 0 { "" } else { "or " }; err.help(&format!("{}{}", or, help_msg)); @@ -4954,66 +5128,65 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { container)); err.span_label(span, format!("`{}` re{} here", name, new_participle)); - if !old_binding.span.is_dummy() { - err.span_label(self.session.source_map().def_span(old_binding.span), - format!("previous {} of the {} `{}` here", old_noun, old_kind, name)); - } + err.span_label( + self.session.source_map().def_span(old_binding.span), + format!("previous {} of the {} `{}` here", old_noun, old_kind, name), + ); // See https://github.com/rust-lang/rust/issues/32354 - if old_binding.is_import() || new_binding.is_import() { - let binding = if new_binding.is_import() && !new_binding.span.is_dummy() { - new_binding + let directive = match (&new_binding.kind, &old_binding.kind) { + (NameBindingKind::Import { directive, .. }, _) if !new_binding.span.is_dummy() => + Some((directive, new_binding.span)), + (_, NameBindingKind::Import { directive, .. }) if !old_binding.span.is_dummy() => + Some((directive, old_binding.span)), + _ => None, + }; + if let Some((directive, binding_span)) = directive { + let suggested_name = if name.as_str().chars().next().unwrap().is_uppercase() { + format!("Other{}", name) } else { - old_binding + format!("other_{}", name) }; - let cm = self.session.source_map(); - let rename_msg = "you can use `as` to change the binding name of the import"; - - if let ( - Ok(snippet), - NameBindingKind::Import { directive, ..}, - _dummy @ false, - ) = ( - cm.span_to_snippet(binding.span), - binding.kind.clone(), - binding.span.is_dummy(), - ) { - let suggested_name = if name.as_str().chars().next().unwrap().is_uppercase() { - format!("Other{}", name) - } else { - format!("other_{}", name) - }; + let mut suggestion = None; + match directive.subclass { + ImportDirectiveSubclass::SingleImport { type_ns_only: true, .. } => + suggestion = Some(format!("self as {}", suggested_name)), + ImportDirectiveSubclass::SingleImport { source, .. } => { + if let Some(pos) = source.span.hi().0.checked_sub(binding_span.lo().0) + .map(|pos| pos as usize) { + if let Ok(snippet) = self.session.source_map() + .span_to_snippet(binding_span) { + if pos <= snippet.len() { + suggestion = Some(format!( + "{} as {}{}", + &snippet[..pos], + suggested_name, + if snippet.ends_with(";") { ";" } else { "" } + )) + } + } + } + } + ImportDirectiveSubclass::ExternCrate { source, target, .. } => + suggestion = Some(format!( + "extern crate {} as {};", + source.unwrap_or(target.name), + suggested_name, + )), + _ => unreachable!(), + } - err.span_suggestion_with_applicability( - binding.span, - &rename_msg, - match (&directive.subclass, snippet.as_ref()) { - (ImportDirectiveSubclass::SingleImport { .. }, "self") => - format!("self as {}", suggested_name), - (ImportDirectiveSubclass::SingleImport { source, .. }, _) => - format!( - "{} as {}{}", - &snippet[..((source.span.hi().0 - binding.span.lo().0) as usize)], - suggested_name, - if snippet.ends_with(";") { - ";" - } else { - "" - } - ), - (ImportDirectiveSubclass::ExternCrate { source, target, .. }, _) => - format!( - "extern crate {} as {};", - source.unwrap_or(target.name), - suggested_name, - ), - (_, _) => unreachable!(), - }, + let rename_msg = "you can use `as` to change the binding name of the import"; + if let Some(suggestion) = suggestion { + err.span_suggestion( + binding_span, + rename_msg, + suggestion, Applicability::MaybeIncorrect, ); } else { - err.span_label(binding.span, rename_msg); + err.span_label(binding_span, rename_msg); } } @@ -5029,6 +5202,9 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { } self.extern_prelude.get(&ident.modern()).cloned().and_then(|entry| { if let Some(binding) = entry.extern_crate_item { + if !speculative && entry.introduced_by_item { + self.record_use(ident, TypeNS, binding, false); + } Some(binding) } else { let crate_id = if !speculative { @@ -5049,17 +5225,17 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { } fn is_self_type(path: &[Segment], namespace: Namespace) -> bool { - namespace == TypeNS && path.len() == 1 && path[0].ident.name == keywords::SelfType.name() + namespace == TypeNS && path.len() == 1 && path[0].ident.name == keywords::SelfUpper.name() } fn is_self_value(path: &[Segment], namespace: Namespace) -> bool { - namespace == ValueNS && path.len() == 1 && path[0].ident.name == keywords::SelfValue.name() + namespace == ValueNS && path.len() == 1 && path[0].ident.name == keywords::SelfLower.name() } fn names_to_string(idents: &[Ident]) -> String { let mut result = String::new(); for (i, ident) in idents.iter() - .filter(|ident| ident.name != keywords::CrateRoot.name()) + .filter(|ident| ident.name != keywords::PathRoot.name()) .enumerate() { if i > 0 { result.push_str("::"); @@ -5075,8 +5251,8 @@ fn path_names_to_string(path: &Path) -> String { .collect::>()) } -/// Get the path for an enum and the variant from an `ImportSuggestion` for an enum variant. -fn import_candidate_to_paths(suggestion: &ImportSuggestion) -> (Span, String, String) { +/// Get the stringified path for an enum from an `ImportSuggestion` for an enum variant. +fn import_candidate_to_enum_paths(suggestion: &ImportSuggestion) -> (String, String) { let variant_path = &suggestion.path; let variant_path_string = path_names_to_string(variant_path); @@ -5087,7 +5263,7 @@ fn import_candidate_to_paths(suggestion: &ImportSuggestion) -> (Span, String, St }; let enum_path_string = path_names_to_string(&enum_path); - (suggestion.path.span, variant_path_string, enum_path_string) + (variant_path_string, enum_path_string) } @@ -5126,7 +5302,7 @@ fn show_candidates(err: &mut DiagnosticBuilder, *candidate = format!("use {};\n{}", candidate, additional_newline); } - err.span_suggestions_with_applicability( + err.span_suggestions( span, &msg, path_strings.into_iter(), @@ -5172,12 +5348,6 @@ fn err_path_resolution() -> PathResolution { PathResolution::new(Def::Err) } -#[derive(PartialEq,Copy, Clone)] -pub enum MakeGlobMap { - Yes, - No, -} - #[derive(Copy, Clone, Debug)] enum CrateLint { /// Do not issue the lint diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 581756dc6bf..abf575aed67 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -1,19 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use {AmbiguityError, AmbiguityKind, AmbiguityErrorMisc}; -use {CrateLint, Resolver, ResolutionError, Segment, Weak}; -use {Module, ModuleKind, NameBinding, NameBindingKind, PathResult, ToNameBinding}; +use {CrateLint, Resolver, ResolutionError, ScopeSet, Weak}; +use {Module, ModuleKind, NameBinding, NameBindingKind, PathResult, Segment, ToNameBinding}; use {is_known_tool, resolve_error}; use ModuleOrUniformRoot; -use Namespace::{self, *}; +use Namespace::*; use build_reduced_graph::{BuildReducedGraphVisitor, IsMacroExport}; use resolve_imports::ImportResolver; use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX, DefIndex, @@ -21,28 +11,25 @@ use rustc::hir::def_id::{DefId, CRATE_DEF_INDEX, DefIndex, use rustc::hir::def::{Def, NonMacroAttrKind}; use rustc::hir::map::{self, DefCollector}; use rustc::{ty, lint}; -use syntax::ast::{self, Name, Ident}; +use syntax::ast::{self, Ident}; use syntax::attr; use syntax::errors::DiagnosticBuilder; use syntax::ext::base::{self, Determinacy}; -use syntax::ext::base::{MacroKind, SyntaxExtension, Resolver as SyntaxResolver}; +use syntax::ext::base::{MacroKind, SyntaxExtension}; use syntax::ext::expand::{AstFragment, Invocation, InvocationKind}; use syntax::ext::hygiene::{self, Mark}; use syntax::ext::tt::macro_rules; -use syntax::feature_gate::{self, feature_err, emit_feature_err, is_builtin_attr_name, GateIssue}; -use syntax::feature_gate::EXPLAIN_DERIVE_UNDERSCORE; -use syntax::fold::{self, Folder}; -use syntax::parse::parser::PathStyle; -use syntax::parse::token::{self, Token}; -use syntax::ptr::P; +use syntax::feature_gate::{ + feature_err, is_builtin_attr_name, AttributeGate, GateIssue, Stability, BUILTIN_ATTRIBUTES, +}; use syntax::symbol::{Symbol, keywords}; -use syntax::tokenstream::{TokenStream, TokenTree, Delimited, DelimSpan}; +use syntax::visit::Visitor; use syntax::util::lev_distance::find_best_match_for_name; use syntax_pos::{Span, DUMMY_SP}; use errors::Applicability; use std::cell::Cell; -use std::mem; +use std::{mem, ptr}; use rustc_data_structures::sync::Lrc; #[derive(Clone, Debug)] @@ -125,7 +112,7 @@ fn sub_namespace_match(candidate: Option, requirement: Option base::Resolver for Resolver<'a, 'crateloader> { +impl<'a> base::Resolver for Resolver<'a> { fn next_node_id(&mut self) -> ast::NodeId { self.session.next_node_id() } @@ -142,60 +129,24 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> { mark } - fn eliminate_crate_var(&mut self, item: P) -> P { - struct EliminateCrateVar<'b, 'a: 'b, 'crateloader: 'a>( - &'b mut Resolver<'a, 'crateloader>, Span - ); - - impl<'a, 'b, 'crateloader> Folder for EliminateCrateVar<'a, 'b, 'crateloader> { - fn fold_path(&mut self, path: ast::Path) -> ast::Path { - match self.fold_qpath(None, path) { - (None, path) => path, - _ => unreachable!(), - } - } - - fn fold_qpath(&mut self, mut qself: Option, mut path: ast::Path) - -> (Option, ast::Path) { - qself = qself.map(|ast::QSelf { ty, path_span, position }| { - ast::QSelf { - ty: self.fold_ty(ty), - path_span: self.new_span(path_span), - position, - } - }); - - if path.segments[0].ident.name == keywords::DollarCrate.name() { - let module = self.0.resolve_crate_root(path.segments[0].ident); - path.segments[0].ident.name = keywords::CrateRoot.name(); - if !module.is_local() { - let span = path.segments[0].ident.span; - path.segments.insert(1, match module.kind { - ModuleKind::Def(_, name) => ast::PathSegment::from_ident( - ast::Ident::with_empty_ctxt(name).with_span_pos(span) - ), - _ => unreachable!(), - }); - if let Some(qself) = &mut qself { - qself.position += 1; - } - } + fn resolve_dollar_crates(&mut self, fragment: &AstFragment) { + struct ResolveDollarCrates<'a, 'b: 'a> { + resolver: &'a mut Resolver<'b> + } + impl<'a> Visitor<'a> for ResolveDollarCrates<'a, '_> { + fn visit_ident(&mut self, ident: Ident) { + if ident.name == keywords::DollarCrate.name() { + let name = match self.resolver.resolve_crate_root(ident).kind { + ModuleKind::Def(_, name) if name != keywords::Invalid.name() => name, + _ => keywords::Crate.name(), + }; + ident.span.ctxt().set_dollar_crate_name(name); } - (qself, path) - } - - fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { - fold::noop_fold_mac(mac, self) } + fn visit_mac(&mut self, _: &ast::Mac) {} } - let ret = EliminateCrateVar(self, item.span).fold_item(item); - assert!(ret.len() == 1); - ret.into_iter().next().unwrap() - } - - fn is_whitelisted_legacy_custom_derive(&self, name: Name) -> bool { - self.whitelisted_legacy_custom_derives.contains(&name) + fragment.visit_with(&mut ResolveDollarCrates { resolver: self }); } fn visit_ast_fragment_with_placeholders(&mut self, mark: Mark, fragment: &AstFragment, @@ -226,6 +177,7 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> { self.macro_map.insert(def_id, ext); let binding = self.arenas.alloc_name_binding(NameBinding { kind: NameBindingKind::Def(Def::Macro(def_id, kind), false), + ambiguity: None, span: DUMMY_SP, vis: ty::Visibility::Public, expansion: Mark::root(), @@ -240,79 +192,6 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> { ImportResolver { resolver: self }.resolve_imports() } - // Resolves attribute and derive legacy macros from `#![plugin(..)]`. - fn find_legacy_attr_invoc(&mut self, attrs: &mut Vec, allow_derive: bool) - -> Option { - if !allow_derive { - return None; - } - - // Check for legacy derives - for i in 0..attrs.len() { - let name = attrs[i].name(); - - if name == "derive" { - let result = attrs[i].parse_list(&self.session.parse_sess, |parser| { - parser.parse_path_allowing_meta(PathStyle::Mod) - }); - - let mut traits = match result { - Ok(traits) => traits, - Err(mut e) => { - e.cancel(); - continue - } - }; - - for j in 0..traits.len() { - if traits[j].segments.len() > 1 { - continue - } - let trait_name = traits[j].segments[0].ident.name; - let legacy_name = Symbol::intern(&format!("derive_{}", trait_name)); - if !self.builtin_macros.contains_key(&legacy_name) { - continue - } - let span = traits.remove(j).span; - self.gate_legacy_custom_derive(legacy_name, span); - if traits.is_empty() { - attrs.remove(i); - } else { - let mut tokens = Vec::with_capacity(traits.len() - 1); - for (j, path) in traits.iter().enumerate() { - if j > 0 { - tokens.push(TokenTree::Token(attrs[i].span, Token::Comma).into()); - } - tokens.reserve((path.segments.len() * 2).saturating_sub(1)); - for (k, segment) in path.segments.iter().enumerate() { - if k > 0 { - tokens.push(TokenTree::Token(path.span, Token::ModSep).into()); - } - let tok = Token::from_ast_ident(segment.ident); - tokens.push(TokenTree::Token(path.span, tok).into()); - } - } - let delim_span = DelimSpan::from_single(attrs[i].span); - attrs[i].tokens = TokenTree::Delimited(delim_span, Delimited { - delim: token::Paren, - tts: TokenStream::concat(tokens).into(), - }).into(); - } - return Some(ast::Attribute { - path: ast::Path::from_ident(Ident::new(legacy_name, span)), - tokens: TokenStream::empty(), - id: attr::mk_attr_id(), - style: ast::AttrStyle::Outer, - is_sugared_doc: false, - span, - }); - } - } - } - - None - } - fn resolve_macro_invocation(&mut self, invoc: &Invocation, invoc_id: Mark, force: bool) -> Result>, Determinacy> { let (path, kind, derives_in_scope, after_derive) = match invoc.kind { @@ -327,7 +206,14 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> { }; let parent_scope = self.invoc_parent_scope(invoc_id, derives_in_scope); - let (def, ext) = self.resolve_macro_to_def(path, kind, &parent_scope, true, force)?; + let (def, ext) = match self.resolve_macro_to_def(path, kind, &parent_scope, true, force) { + Ok((def, ext)) => (def, ext), + Err(Determinacy::Determined) if kind == MacroKind::Attr => { + // Replace unresolved attributes with used inert attributes for better recovery. + return Ok(Some(Lrc::new(SyntaxExtension::NonMacroAttr { mark_used: true }))); + } + Err(determinacy) => return Err(determinacy), + }; if let Def::Macro(def_id, _) = def { if after_derive { @@ -340,7 +226,6 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> { self.definitions.add_parent_module_of_macro_def(invoc.expansion_data.mark, normal_module_def_id); invoc.expansion_data.mark.set_default_transparency(ext.default_transparency()); - invoc.expansion_data.mark.set_is_builtin(def_id.krate == CrateNum::BuiltinMacros); } Ok(Some(ext)) @@ -371,7 +256,7 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> { } } -impl<'a, 'cl> Resolver<'a, 'cl> { +impl<'a> Resolver<'a> { pub fn dummy_parent_scope(&self) -> ParentScope<'a> { self.invoc_parent_scope(Mark::root(), Vec::new()) } @@ -422,30 +307,28 @@ impl<'a, 'cl> Resolver<'a, 'cl> { let features = self.session.features_untracked(); if attr_kind == NonMacroAttrKind::Custom { assert!(path.segments.len() == 1); - let name = path.segments[0].ident.name.as_str(); + let name = path.segments[0].ident.as_str(); if name.starts_with("rustc_") { if !features.rustc_attrs { let msg = "unless otherwise specified, attributes with the prefix \ `rustc_` are reserved for internal compiler diagnostics"; - feature_err(&self.session.parse_sess, "rustc_attrs", path.span, - GateIssue::Language, &msg).emit(); - } - } else if name.starts_with("derive_") { - if !features.custom_derive { - feature_err(&self.session.parse_sess, "custom_derive", path.span, - GateIssue::Language, EXPLAIN_DERIVE_UNDERSCORE).emit(); + self.report_unknown_attribute(path.span, &name, msg, "rustc_attrs"); } } else if !features.custom_attribute { let msg = format!("The attribute `{}` is currently unknown to the \ compiler and may have meaning added to it in the \ future", path); - feature_err(&self.session.parse_sess, "custom_attribute", path.span, - GateIssue::Language, &msg).emit(); + self.report_unknown_attribute( + path.span, + &name, + &msg, + "custom_attribute", + ); } } } else { // Not only attributes, but anything in macro namespace can result in - // `Def::NonMacroAttr` definition (e.g. `inline!()`), so we must report + // `Def::NonMacroAttr` definition (e.g., `inline!()`), so we must report // an error for those cases. let msg = format!("expected a macro, found {}", def.kind_name()); self.session.span_err(path.span, &msg); @@ -461,6 +344,61 @@ impl<'a, 'cl> Resolver<'a, 'cl> { Ok((def, self.get_macro(def))) } + fn report_unknown_attribute(&self, span: Span, name: &str, msg: &str, feature: &str) { + let mut err = feature_err( + &self.session.parse_sess, + feature, + span, + GateIssue::Language, + &msg, + ); + + let features = self.session.features_untracked(); + + let attr_candidates = BUILTIN_ATTRIBUTES + .iter() + .filter_map(|(name, _, _, gate)| { + if name.starts_with("rustc_") && !features.rustc_attrs { + return None; + } + + match gate { + AttributeGate::Gated(Stability::Unstable, ..) + if self.session.opts.unstable_features.is_nightly_build() => + { + Some(name) + } + AttributeGate::Gated(Stability::Deprecated(..), ..) => Some(name), + AttributeGate::Ungated => Some(name), + _ => None, + } + }) + .map(|name| Symbol::intern(name)) + .chain( + // Add built-in macro attributes as well. + self.builtin_macros.iter().filter_map(|(name, binding)| { + match binding.macro_kind() { + Some(MacroKind::Attr) => Some(*name), + _ => None, + } + }), + ) + .collect::>(); + + let lev_suggestion = find_best_match_for_name(attr_candidates.iter(), &name, None); + + if let Some(suggestion) = lev_suggestion { + err.span_suggestion( + span, + "a built-in attribute with a similar name exists", + suggestion.to_string(), + Applicability::MaybeIncorrect, + ); + } + + err.emit(); + } + pub fn resolve_macro_to_def_inner( &mut self, path: &ast::Path, @@ -488,7 +426,6 @@ impl<'a, 'cl> Resolver<'a, 'cl> { } PathResult::Indeterminate if !force => return Err(Determinacy::Undetermined), PathResult::NonModule(..) | PathResult::Indeterminate | PathResult::Failed(..) => { - self.found_unresolved_macro = true; Err(Determinacy::Determined) } PathResult::Module(..) => unreachable!(), @@ -499,15 +436,14 @@ impl<'a, 'cl> Resolver<'a, 'cl> { .push((path, path_span, kind, parent_scope.clone(), def.ok())); } + self.prohibit_imported_non_macro_attrs(None, def.ok(), path_span); def } else { let binding = self.early_resolve_ident_in_lexical_scope( - path[0].ident, MacroNS, Some(kind), false, parent_scope, false, force, path_span + path[0].ident, ScopeSet::Macro(kind), parent_scope, false, force, path_span ); - match binding { - Ok(..) => {} - Err(Determinacy::Determined) => self.found_unresolved_macro = true, - Err(Determinacy::Undetermined) => return Err(Determinacy::Undetermined), + if let Err(Determinacy::Undetermined) = binding { + return Err(Determinacy::Undetermined); } if trace { @@ -515,21 +451,21 @@ impl<'a, 'cl> Resolver<'a, 'cl> { .push((path[0].ident, kind, parent_scope.clone(), binding.ok())); } - binding.map(|binding| binding.def_ignoring_ambiguity()) + let def = binding.map(|binding| binding.def()); + self.prohibit_imported_non_macro_attrs(binding.ok(), def.ok(), path_span); + def } } // Resolve an identifier in lexical scope. // This is a variation of `fn resolve_ident_in_lexical_scope` that can be run during // expansion and import resolution (perhaps they can be merged in the future). - // The function is used for resolving initial segments of macro paths (e.g. `foo` in + // The function is used for resolving initial segments of macro paths (e.g., `foo` in // `foo::bar!(); or `foo!();`) and also for import paths on 2018 edition. crate fn early_resolve_ident_in_lexical_scope( &mut self, - mut ident: Ident, - ns: Namespace, - macro_kind: Option, - is_import: bool, + orig_ident: Ident, + scope_set: ScopeSet, parent_scope: &ParentScope<'a>, record_used: bool, force: bool, @@ -582,6 +518,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { enum WhereToResolve<'a> { DeriveHelpers, MacroRules(LegacyScope<'a>), + CrateRoot, Module(Module<'a>), MacroUsePrelude, BuiltinMacros, @@ -595,17 +532,17 @@ impl<'a, 'cl> Resolver<'a, 'cl> { bitflags! { struct Flags: u8 { - const MACRO_RULES = 1 << 0; - const MODULE = 1 << 1; - const PRELUDE = 1 << 2; - const MISC_SUGGEST_SELF = 1 << 3; - const MISC_FROM_PRELUDE = 1 << 4; + const MACRO_RULES = 1 << 0; + const MODULE = 1 << 1; + const PRELUDE = 1 << 2; + const MISC_SUGGEST_CRATE = 1 << 3; + const MISC_SUGGEST_SELF = 1 << 4; + const MISC_FROM_PRELUDE = 1 << 5; } } assert!(force || !record_used); // `record_used` implies `force` - assert!(macro_kind.is_none() || !is_import); // `is_import` implies no macro kind - ident = ident.modern(); + let mut ident = orig_ident.modern(); // Make sure `self`, `super` etc produce an error when passed to here. if ident.is_path_segment_keyword() { @@ -626,10 +563,17 @@ impl<'a, 'cl> Resolver<'a, 'cl> { let mut innermost_result: Option<(&NameBinding, Flags)> = None; // Go through all the scopes and try to resolve the name. - let mut where_to_resolve = if ns == MacroNS { - WhereToResolve::DeriveHelpers - } else { - WhereToResolve::Module(parent_scope.module) + let rust_2015 = orig_ident.span.rust_2015(); + let (ns, macro_kind, is_import, is_absolute_path) = match scope_set { + ScopeSet::Import(ns) => (ns, None, true, false), + ScopeSet::AbsolutePath(ns) => (ns, None, false, true), + ScopeSet::Macro(macro_kind) => (MacroNS, Some(macro_kind), false, false), + ScopeSet::Module => (TypeNS, None, false, false), + }; + let mut where_to_resolve = match ns { + _ if is_absolute_path || is_import && rust_2015 => WhereToResolve::CrateRoot, + TypeNS | ValueNS => WhereToResolve::Module(parent_scope.module), + MacroNS => WhereToResolve::DeriveHelpers, }; let mut use_prelude = !parent_scope.module.no_implicit_prelude; let mut determinacy = Determinacy::Determined; @@ -667,6 +611,26 @@ impl<'a, 'cl> Resolver<'a, 'cl> { Err(Determinacy::Undetermined), _ => Err(Determinacy::Determined), } + WhereToResolve::CrateRoot => { + let root_ident = Ident::new(keywords::PathRoot.name(), orig_ident.span); + let root_module = self.resolve_crate_root(root_ident); + let binding = self.resolve_ident_in_module_ext( + ModuleOrUniformRoot::Module(root_module), + orig_ident, + ns, + None, + record_used, + path_span, + ); + match binding { + Ok(binding) => Ok((binding, Flags::MODULE | Flags::MISC_SUGGEST_CRATE)), + Err((Determinacy::Undetermined, Weak::No)) => + return Err(Determinacy::determined(force)), + Err((Determinacy::Undetermined, Weak::Yes)) => + Err(Determinacy::Undetermined), + Err((Determinacy::Determined, _)) => Err(Determinacy::Determined), + } + } WhereToResolve::Module(module) => { let orig_current_module = mem::replace(&mut self.current_module, module); let binding = self.resolve_ident_in_module_unadjusted_ext( @@ -681,7 +645,9 @@ impl<'a, 'cl> Resolver<'a, 'cl> { self.current_module = orig_current_module; match binding { Ok(binding) => { - let misc_flags = if module.is_normal() { + let misc_flags = if ptr::eq(module, self.graph_root) { + Flags::MISC_SUGGEST_CRATE + } else if module.is_normal() { Flags::MISC_SUGGEST_SELF } else { Flags::empty() @@ -696,7 +662,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { } } WhereToResolve::MacroUsePrelude => { - if use_prelude || self.session.rust_2015() { + if use_prelude || rust_2015 { match self.macro_use_prelude.get(&ident.name).cloned() { Some(binding) => Ok((binding, Flags::PRELUDE | Flags::MISC_FROM_PRELUDE)), @@ -725,7 +691,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { } } WhereToResolve::LegacyPluginHelpers => { - if (use_prelude || self.session.rust_2015()) && + if (use_prelude || rust_2015) && self.session.plugin_attributes.borrow().iter() .any(|(name, _)| ident.name == &**name) { let binding = (Def::NonMacroAttr(NonMacroAttrKind::LegacyPluginHelper), @@ -737,7 +703,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { } } WhereToResolve::ExternPrelude => { - if use_prelude { + if use_prelude || is_absolute_path { match self.extern_prelude_get(ident, !record_used) { Some(binding) => Ok((binding, Flags::PRELUDE)), None => Err(Determinacy::determined( @@ -803,6 +769,8 @@ impl<'a, 'cl> Resolver<'a, 'cl> { let ambiguity_error_kind = if is_import { Some(AmbiguityKind::Import) + } else if is_absolute_path { + Some(AmbiguityKind::AbsolutePath) } else if innermost_def == builtin || def == builtin { Some(AmbiguityKind::BuiltinAttr) } else if innermost_def == derive_helper || def == derive_helper { @@ -815,7 +783,11 @@ impl<'a, 'cl> Resolver<'a, 'cl> { } else if innermost_flags.contains(Flags::MACRO_RULES) && flags.contains(Flags::MODULE) && !self.disambiguate_legacy_vs_modern(innermost_binding, - binding) { + binding) || + flags.contains(Flags::MACRO_RULES) && + innermost_flags.contains(Flags::MODULE) && + !self.disambiguate_legacy_vs_modern(binding, + innermost_binding) { Some(AmbiguityKind::LegacyVsModern) } else if innermost_binding.is_glob_import() { Some(AmbiguityKind::GlobVsOuter) @@ -826,7 +798,9 @@ impl<'a, 'cl> Resolver<'a, 'cl> { None }; if let Some(kind) = ambiguity_error_kind { - let misc = |f: Flags| if f.contains(Flags::MISC_SUGGEST_SELF) { + let misc = |f: Flags| if f.contains(Flags::MISC_SUGGEST_CRATE) { + AmbiguityErrorMisc::SuggestCrate + } else if f.contains(Flags::MISC_SUGGEST_SELF) { AmbiguityErrorMisc::SuggestSelf } else if f.contains(Flags::MISC_FROM_PRELUDE) { AmbiguityErrorMisc::FromPrelude @@ -835,7 +809,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { }; self.ambiguity_errors.push(AmbiguityError { kind, - ident, + ident: orig_ident, b1: innermost_binding, b2: binding, misc1: misc(innermost_flags), @@ -866,6 +840,18 @@ impl<'a, 'cl> Resolver<'a, 'cl> { LegacyScope::Empty => WhereToResolve::Module(parent_scope.module), LegacyScope::Uninitialized => unreachable!(), } + WhereToResolve::CrateRoot if is_import => match ns { + TypeNS | ValueNS => WhereToResolve::Module(parent_scope.module), + MacroNS => WhereToResolve::DeriveHelpers, + } + WhereToResolve::CrateRoot if is_absolute_path => match ns { + TypeNS => { + ident.span.adjust(Mark::root()); + WhereToResolve::ExternPrelude + } + ValueNS | MacroNS => break, + } + WhereToResolve::CrateRoot => unreachable!(), WhereToResolve::Module(module) => { match self.hygienic_lexical_parent(module, &mut ident.span) { Some(parent_module) => WhereToResolve::Module(parent_module), @@ -883,6 +869,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { WhereToResolve::BuiltinMacros => WhereToResolve::BuiltinAttrs, WhereToResolve::BuiltinAttrs => WhereToResolve::LegacyPluginHelpers, WhereToResolve::LegacyPluginHelpers => break, // nowhere else to search + WhereToResolve::ExternPrelude if is_absolute_path => break, WhereToResolve::ExternPrelude => WhereToResolve::ToolPrelude, WhereToResolve::ToolPrelude => WhereToResolve::StdLibPrelude, WhereToResolve::StdLibPrelude => match ns { @@ -898,30 +885,41 @@ impl<'a, 'cl> Resolver<'a, 'cl> { // The first found solution was the only one, return it. if let Some((binding, flags)) = innermost_result { - if is_import && !self.session.features_untracked().uniform_paths { - // We get to here only if there's no ambiguity, in ambiguous cases an error will - // be reported anyway, so there's no reason to report an additional feature error. - // The `binding` can actually be introduced by something other than `--extern`, - // but its `Def` should coincide with a crate passed with `--extern` - // (otherwise there would be ambiguity) and we can skip feature error in this case. - if ns != TypeNS || !use_prelude || - self.extern_prelude_get(ident, true).is_none() { - let msg = "imports can only refer to extern crate names \ - passed with `--extern` on stable channel"; - let mut err = feature_err(&self.session.parse_sess, "uniform_paths", - ident.span, GateIssue::Language, msg); - - let what = self.binding_description(binding, ident, - flags.contains(Flags::MISC_FROM_PRELUDE)); - let note_msg = format!("this import refers to {what}", what = what); - if binding.span.is_dummy() { - err.note(¬e_msg); - } else { - err.span_note(binding.span, ¬e_msg); - err.span_label(binding.span, "not an extern crate passed with `--extern`"); - } - err.emit(); + // We get to here only if there's no ambiguity, in ambiguous cases an error will + // be reported anyway, so there's no reason to report an additional feature error. + // The `binding` can actually be introduced by something other than `--extern`, + // but its `Def` should coincide with a crate passed with `--extern` + // (otherwise there would be ambiguity) and we can skip feature error in this case. + 'ok: { + if !is_import || !rust_2015 { + break 'ok; } + if ns == TypeNS && use_prelude && self.extern_prelude_get(ident, true).is_some() { + break 'ok; + } + let root_ident = Ident::new(keywords::PathRoot.name(), orig_ident.span); + let root_module = self.resolve_crate_root(root_ident); + if self.resolve_ident_in_module_ext(ModuleOrUniformRoot::Module(root_module), + orig_ident, ns, None, false, path_span) + .is_ok() { + break 'ok; + } + + let msg = "imports can only refer to extern crate names passed with \ + `--extern` in macros originating from 2015 edition"; + let mut err = self.session.struct_span_err(ident.span, msg); + let what = self.binding_description(binding, ident, + flags.contains(Flags::MISC_FROM_PRELUDE)); + let note_msg = format!("this import refers to {what}", what = what); + let label_span = if binding.span.is_dummy() { + err.note(¬e_msg); + ident.span + } else { + err.span_note(binding.span, ¬e_msg); + binding.span + }; + err.span_label(label_span, "not an extern crate passed with `--extern`"); + err.emit(); } return Ok(binding); @@ -945,14 +943,23 @@ impl<'a, 'cl> Resolver<'a, 'cl> { pub fn finalize_current_module_macro_resolutions(&mut self) { let module = self.current_module; - let check_consistency = |this: &mut Self, path: &[Segment], span, - kind: MacroKind, initial_def, def| { + let check_consistency = |this: &mut Self, path: &[Segment], span, kind: MacroKind, + initial_def: Option, def: Def| { if let Some(initial_def) = initial_def { if def != initial_def && def != Def::Err && this.ambiguity_errors.is_empty() { // Make sure compilation does not succeed if preferred macro resolution // has changed after the macro had been expanded. In theory all such // situations should be reported as ambiguity errors, so this is a bug. - span_bug!(span, "inconsistent resolution for a macro"); + if initial_def == Def::NonMacroAttr(NonMacroAttrKind::Custom) { + // Yeah, legacy custom attributes are implemented using forced resolution + // (which is a best effort error recovery tool, basically), so we can't + // promise their resolution won't change later. + let msg = format!("inconsistent resolution for a macro: first {}, then {}", + initial_def.kind_name(), def.kind_name()); + this.session.span_err(span, &msg); + } else { + span_bug!(span, "inconsistent resolution for a macro"); + } } } else { // It's possible that the macro was unresolved (indeterminate) and silently @@ -982,7 +989,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> { let def = path_res.base_def(); check_consistency(self, &path, path_span, kind, initial_def, def); } - path_res @ PathResult::NonModule(..) | path_res @ PathResult::Failed(..) => { + path_res @ PathResult::NonModule(..) | path_res @ PathResult::Failed(..) => { let (span, msg) = if let PathResult::Failed(span, msg, ..) = path_res { (span, msg) } else { @@ -998,14 +1005,14 @@ impl<'a, 'cl> Resolver<'a, 'cl> { let macro_resolutions = mem::replace(&mut *module.single_segment_macro_resolutions.borrow_mut(), Vec::new()); for (ident, kind, parent_scope, initial_binding) in macro_resolutions { - match self.early_resolve_ident_in_lexical_scope(ident, MacroNS, Some(kind), false, + match self.early_resolve_ident_in_lexical_scope(ident, ScopeSet::Macro(kind), &parent_scope, true, true, ident.span) { Ok(binding) => { let initial_def = initial_binding.map(|initial_binding| { self.record_use(ident, MacroNS, initial_binding, false); - initial_binding.def_ignoring_ambiguity() + initial_binding.def() }); - let def = binding.def_ignoring_ambiguity(); + let def = binding.def(); let seg = Segment::from_ident(ident); check_consistency(self, &[seg], ident.span, kind, initial_def, def); } @@ -1024,11 +1031,25 @@ impl<'a, 'cl> Resolver<'a, 'cl> { let builtin_attrs = mem::replace(&mut *module.builtin_attrs.borrow_mut(), Vec::new()); for (ident, parent_scope) in builtin_attrs { let _ = self.early_resolve_ident_in_lexical_scope( - ident, MacroNS, Some(MacroKind::Attr), false, &parent_scope, true, true, ident.span + ident, ScopeSet::Macro(MacroKind::Attr), &parent_scope, true, true, ident.span ); } } + fn prohibit_imported_non_macro_attrs(&self, binding: Option<&'a NameBinding<'a>>, + def: Option, span: Span) { + if let Some(Def::NonMacroAttr(kind)) = def { + if kind != NonMacroAttrKind::Tool && binding.map_or(true, |b| b.is_import()) { + let msg = format!("cannot use a {} through an import", kind.descr()); + let mut err = self.session.struct_span_err(span, &msg); + if let Some(binding) = binding { + err.span_note(binding.span, &format!("the {} imported here", kind.descr())); + } + err.emit(); + } + } + } + fn suggest_macro_name(&mut self, name: &str, kind: MacroKind, err: &mut DiagnosticBuilder<'a>, span: Span) { // First check if this is a locally-defined bang macro. @@ -1054,19 +1075,20 @@ impl<'a, 'cl> Resolver<'a, 'cl> { }; let ident = Ident::new(Symbol::intern(name), span); self.lookup_typo_candidate(&[Segment::from_ident(ident)], MacroNS, is_macro, span) + .map(|suggestion| suggestion.candidate) }); if let Some(suggestion) = suggestion { if suggestion != name { if let MacroKind::Bang = kind { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "you could try the macro", suggestion.to_string(), Applicability::MaybeIncorrect ); } else { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "try", suggestion.to_string(), @@ -1125,7 +1147,12 @@ impl<'a, 'cl> Resolver<'a, 'cl> { let ident = ident.modern(); self.macro_names.insert(ident); let def = Def::Macro(def_id, MacroKind::Bang); - let vis = ty::Visibility::Invisible; // Doesn't matter for legacy bindings + let is_macro_export = attr::contains_name(&item.attrs, "macro_export"); + let vis = if is_macro_export { + ty::Visibility::Public + } else { + ty::Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)) + }; let binding = (def, vis, item.span, expansion).to_name_binding(self.arenas); self.set_binding_parent_module(binding, self.current_module); let legacy_binding = self.arenas.alloc_legacy_binding(LegacyBinding { @@ -1133,9 +1160,8 @@ impl<'a, 'cl> Resolver<'a, 'cl> { }); *current_legacy_scope = LegacyScope::Binding(legacy_binding); self.all_macros.insert(ident.name, def); - if attr::contains_name(&item.attrs, "macro_export") { + if is_macro_export { let module = self.graph_root; - let vis = ty::Visibility::Public; self.define(module, ident, MacroNS, (def, vis, item.span, expansion, IsMacroExport)); } else { @@ -1154,14 +1180,4 @@ impl<'a, 'cl> Resolver<'a, 'cl> { self.define(module, ident, MacroNS, (def, vis, item.span, expansion)); } } - - fn gate_legacy_custom_derive(&mut self, name: Symbol, span: Span) { - if !self.session.features_untracked().custom_derive { - let sess = &self.session.parse_sess; - let explain = feature_gate::EXPLAIN_CUSTOM_DERIVE; - emit_feature_err(sess, "custom_derive", span, GateIssue::Language, explain); - } else if !self.is_whitelisted_legacy_custom_derive(name) { - self.session.span_warn(span, feature_gate::EXPLAIN_DEPR_CUSTOM_DERIVE); - } - } } diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 422ae677d6a..9a04c9d60b8 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use self::ImportDirectiveSubclass::*; use {AmbiguityError, AmbiguityKind, AmbiguityErrorMisc}; -use {CrateLint, Module, ModuleOrUniformRoot, PerNS, UniformRootKind, Weak}; +use {CrateLint, Module, ModuleOrUniformRoot, PerNS, ScopeSet, Weak}; use Namespace::{self, TypeNS, MacroNS}; use {NameBinding, NameBindingKind, ToNameBinding, PathResult, PrivacyError}; use {Resolver, Segment}; @@ -42,9 +32,15 @@ use std::{mem, ptr}; #[derive(Clone, Debug)] pub enum ImportDirectiveSubclass<'a> { SingleImport { - target: Ident, + /// `source` in `use prefix::source as target`. source: Ident, - result: PerNS, Determinacy>>>, + /// `target` in `use prefix::source as target`. + target: Ident, + /// Bindings to which `source` refers to. + source_bindings: PerNS, Determinacy>>>, + /// Bindings introduced by `target`. + target_bindings: PerNS>>>, + /// `true` for `...::{self [as target]}` imports, `false` otherwise. type_ns_only: bool, }, GlobImport { @@ -128,7 +124,7 @@ impl<'a> NameResolution<'a> { } } -impl<'a, 'crateloader> Resolver<'a, 'crateloader> { +impl<'a> Resolver<'a> { fn resolution(&self, module: Module<'a>, ident: Ident, ns: Namespace) -> &'a RefCell> { *module.resolutions.borrow_mut().entry((ident.modern(), ns)) @@ -162,45 +158,53 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { ) -> Result<&'a NameBinding<'a>, (Determinacy, Weak)> { let module = match module { ModuleOrUniformRoot::Module(module) => module, - ModuleOrUniformRoot::UniformRoot(uniform_root_kind) => { + ModuleOrUniformRoot::CrateRootAndExternPrelude => { assert!(!restricted_shadowing); - match uniform_root_kind { - UniformRootKind::ExternPrelude => { - return if let Some(binding) = self.extern_prelude_get(ident, !record_used) { - Ok(binding) - } else if !self.graph_root.unresolved_invocations.borrow().is_empty() { - // Macro-expanded `extern crate` items can add names to extern prelude. - Err((Undetermined, Weak::No)) - } else { - Err((Determined, Weak::No)) - } - } - UniformRootKind::CurrentScope => { - let parent_scope = - parent_scope.expect("no parent scope for a single-segment import"); - - if ns == TypeNS { - if ident.name == keywords::Crate.name() || - ident.name == keywords::DollarCrate.name() { - let module = self.resolve_crate_root(ident); - let binding = (module, ty::Visibility::Public, - module.span, Mark::root()) - .to_name_binding(self.arenas); - return Ok(binding); - } else if ident.name == keywords::Super.name() || - ident.name == keywords::SelfValue.name() { - // FIXME: Implement these with renaming requirements so that e.g. - // `use super;` doesn't work, but `use super as name;` does. - // Fall through here to get an error from `early_resolve_...`. - } - } - - let binding = self.early_resolve_ident_in_lexical_scope( - ident, ns, None, true, parent_scope, record_used, record_used, path_span - ); - return binding.map_err(|determinacy| (determinacy, Weak::No)); + let parent_scope = self.dummy_parent_scope(); + let binding = self.early_resolve_ident_in_lexical_scope( + ident, ScopeSet::AbsolutePath(ns), &parent_scope, + record_used, record_used, path_span, + ); + return binding.map_err(|determinacy| (determinacy, Weak::No)); + } + ModuleOrUniformRoot::ExternPrelude => { + assert!(!restricted_shadowing); + return if ns != TypeNS { + Err((Determined, Weak::No)) + } else if let Some(binding) = self.extern_prelude_get(ident, !record_used) { + Ok(binding) + } else if !self.graph_root.unresolved_invocations.borrow().is_empty() { + // Macro-expanded `extern crate` items can add names to extern prelude. + Err((Undetermined, Weak::No)) + } else { + Err((Determined, Weak::No)) + } + } + ModuleOrUniformRoot::CurrentScope => { + assert!(!restricted_shadowing); + let parent_scope = + parent_scope.expect("no parent scope for a single-segment import"); + + if ns == TypeNS { + if ident.name == keywords::Crate.name() || + ident.name == keywords::DollarCrate.name() { + let module = self.resolve_crate_root(ident); + let binding = (module, ty::Visibility::Public, + module.span, Mark::root()) + .to_name_binding(self.arenas); + return Ok(binding); + } else if ident.name == keywords::Super.name() || + ident.name == keywords::SelfLower.name() { + // FIXME: Implement these with renaming requirements so that e.g. + // `use super;` doesn't work, but `use super as name;` does. + // Fall through here to get an error from `early_resolve_...`. } } + + let binding = self.early_resolve_ident_in_lexical_scope( + ident, ScopeSet::Import(ns), parent_scope, record_used, record_used, path_span + ); + return binding.map_err(|determinacy| (determinacy, Weak::No)); } }; @@ -219,6 +223,11 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { } let check_usable = |this: &mut Self, binding: &'a NameBinding<'a>| { + if let Some(blacklisted_binding) = this.blacklisted_binding { + if ptr::eq(binding, blacklisted_binding) { + return Err((Determined, Weak::No)); + } + } // `extern crate` are always usable for backwards compatibility, see issue #37020, // remove this together with `PUB_USE_OF_PRIVATE_EXTERN_CRATE`. let usable = this.is_accessible(binding.vis) || binding.is_extern_crate(); @@ -226,7 +235,18 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { }; if record_used { - return resolution.binding.ok_or((Determined, Weak::No)).and_then(|binding| { + return resolution.binding.and_then(|binding| { + // If the primary binding is blacklisted, search further and return the shadowed + // glob binding if it exists. What we really want here is having two separate + // scopes in a module - one for non-globs and one for globs, but until that's done + // use this hack to avoid inconsistent resolution ICEs during import validation. + if let Some(blacklisted_binding) = self.blacklisted_binding { + if ptr::eq(binding, blacklisted_binding) { + return resolution.shadowed_glob; + } + } + Some(binding) + }).ok_or((Determined, Weak::No)).and_then(|binding| { if self.last_import_segment && check_usable(self, binding).is_err() { Err((Determined, Weak::No)) } else { @@ -333,7 +353,7 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { } let module = match glob_import.imported_module.get() { Some(ModuleOrUniformRoot::Module(module)) => module, - Some(ModuleOrUniformRoot::UniformRoot(_)) => continue, + Some(_) => continue, None => return Err((Undetermined, Weak::Yes)), }; let (orig_current_module, mut ident) = (self.current_module, ident.modern()); @@ -411,7 +431,7 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { crate fn import(&self, binding: &'a NameBinding<'a>, directive: &'a ImportDirective<'a>) -> &'a NameBinding<'a> { let vis = if binding.pseudo_vis().is_at_least(directive.vis.get(), self) || - // c.f. `PUB_USE_OF_PRIVATE_EXTERN_CRATE` + // cf. `PUB_USE_OF_PRIVATE_EXTERN_CRATE` !directive.is_glob() && binding.is_extern_crate() { directive.vis.get() } else { @@ -430,6 +450,7 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { directive, used: Cell::new(false), }, + ambiguity: None, span: directive.span, vis, expansion: directive.parent_scope.expansion, @@ -457,6 +478,10 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { self.set_binding_parent_module(binding, module); self.update_resolution(module, ident, ns, |this, resolution| { if let Some(old_binding) = resolution.binding { + if binding.def() == Def::Err { + // Do not override real bindings with `Def::Err`s from error recovery. + return Ok(()); + } match (old_binding.is_glob_import(), binding.is_glob_import()) { (true, true) => { if binding.def() != old_binding.def() { @@ -479,8 +504,8 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { nonglob_binding, glob_binding)); } else { resolution.binding = Some(nonglob_binding); - resolution.shadowed_glob = Some(glob_binding); } + resolution.shadowed_glob = Some(glob_binding); } (false, false) => { if let (&NameBindingKind::Def(_, true), &NameBindingKind::Def(_, true)) = @@ -508,13 +533,12 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { }) } - fn ambiguity(&self, kind: AmbiguityKind, b1: &'a NameBinding<'a>, b2: &'a NameBinding<'a>) - -> &'a NameBinding<'a> { + fn ambiguity(&self, kind: AmbiguityKind, + primary_binding: &'a NameBinding<'a>, secondary_binding: &'a NameBinding<'a>) + -> &'a NameBinding<'a> { self.arenas.alloc_name_binding(NameBinding { - kind: NameBindingKind::Ambiguity { kind, b1, b2 }, - vis: if b1.vis.is_at_least(b2.vis, self) { b1.vis } else { b2.vis }, - span: b1.span, - expansion: Mark::root(), + ambiguity: Some((secondary_binding, kind)), + ..primary_binding.clone() }) } @@ -522,7 +546,7 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { // If the resolution becomes a success, define it in the module's glob importers. fn update_resolution(&mut self, module: Module<'a>, ident: Ident, ns: Namespace, f: F) -> T - where F: FnOnce(&mut Resolver<'a, 'crateloader>, &mut NameResolution<'a>) -> T + where F: FnOnce(&mut Resolver<'a>, &mut NameResolution<'a>) -> T { // Ensure that `resolution` isn't borrowed when defining in the module's glob importers, // during which the resolution might end up getting re-defined via a glob cycle. @@ -573,30 +597,30 @@ impl<'a, 'crateloader> Resolver<'a, 'crateloader> { } } -pub struct ImportResolver<'a, 'b: 'a, 'c: 'a + 'b> { - pub resolver: &'a mut Resolver<'b, 'c>, +pub struct ImportResolver<'a, 'b: 'a> { + pub resolver: &'a mut Resolver<'b>, } -impl<'a, 'b: 'a, 'c: 'a + 'b> ::std::ops::Deref for ImportResolver<'a, 'b, 'c> { - type Target = Resolver<'b, 'c>; - fn deref(&self) -> &Resolver<'b, 'c> { +impl<'a, 'b: 'a> ::std::ops::Deref for ImportResolver<'a, 'b> { + type Target = Resolver<'b>; + fn deref(&self) -> &Resolver<'b> { self.resolver } } -impl<'a, 'b: 'a, 'c: 'a + 'b> ::std::ops::DerefMut for ImportResolver<'a, 'b, 'c> { - fn deref_mut(&mut self) -> &mut Resolver<'b, 'c> { +impl<'a, 'b: 'a> ::std::ops::DerefMut for ImportResolver<'a, 'b> { + fn deref_mut(&mut self) -> &mut Resolver<'b> { self.resolver } } -impl<'a, 'b: 'a, 'c: 'a + 'b> ty::DefIdTree for &'a ImportResolver<'a, 'b, 'c> { +impl<'a, 'b: 'a> ty::DefIdTree for &'a ImportResolver<'a, 'b> { fn parent(self, id: DefId) -> Option { self.resolver.parent(id) } } -impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { +impl<'a, 'b:'a> ImportResolver<'a, 'b> { // Import resolution // // This is a fixed-point algorithm. We resolve imports until our efforts @@ -634,10 +658,10 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { if let Some((span, err, note)) = self.finalize_import(import) { errors = true; - if let SingleImport { source, ref result, .. } = import.subclass { + if let SingleImport { source, ref source_bindings, .. } = import.subclass { if source.name == "self" { // Silence `unresolved import` error if E0429 is already emitted - if let Err(Determined) = result.value_ns.get() { + if let Err(Determined) = source_bindings.value_ns.get() { continue; } } @@ -757,9 +781,11 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { }; directive.imported_module.set(Some(module)); - let (source, target, result, type_ns_only) = match directive.subclass { - SingleImport { source, target, ref result, type_ns_only } => - (source, target, result, type_ns_only), + let (source, target, source_bindings, target_bindings, type_ns_only) = + match directive.subclass { + SingleImport { source, target, ref source_bindings, + ref target_bindings, type_ns_only } => + (source, target, source_bindings, target_bindings, type_ns_only), GlobImport { .. } => { self.resolve_glob_import(directive); return true; @@ -769,7 +795,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { let mut indeterminate = false; self.per_ns(|this, ns| if !type_ns_only || ns == TypeNS { - if let Err(Undetermined) = result[ns].get() { + if let Err(Undetermined) = source_bindings[ns].get() { // For better failure detection, pretend that the import will // not define any names while resolving its module path. let orig_vis = directive.vis.replace(ty::Visibility::Invisible); @@ -778,13 +804,13 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { ); directive.vis.set(orig_vis); - result[ns].set(binding); + source_bindings[ns].set(binding); } else { return }; let parent = directive.parent_scope.module; - match result[ns].get() { + match source_bindings[ns].get() { Err(Undetermined) => indeterminate = true, Err(Determined) => { this.update_resolution(parent, target, ns, |_, resolution| { @@ -802,6 +828,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { } Ok(binding) => { let imported_binding = this.import(binding, directive); + target_bindings[ns].set(Some(imported_binding)); let conflict = this.try_define(parent, target, ns, imported_binding); if let Err(old_binding) = conflict { this.report_conflict(parent, target, ns, imported_binding, old_binding); @@ -821,14 +848,16 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { self.current_module = directive.parent_scope.module; let orig_vis = directive.vis.replace(ty::Visibility::Invisible); + let prev_ambiguity_errors_len = self.ambiguity_errors.len(); let path_res = self.resolve_path(&directive.module_path, None, &directive.parent_scope, true, directive.span, directive.crate_lint()); + let no_ambiguity = self.ambiguity_errors.len() == prev_ambiguity_errors_len; directive.vis.set(orig_vis); let module = match path_res { PathResult::Module(module) => { // Consistency checks, analogous to `finalize_current_module_macro_resolutions`. if let Some(initial_module) = directive.imported_module.get() { - if module != initial_module && self.ambiguity_errors.is_empty() { + if !ModuleOrUniformRoot::same_def(module, initial_module) && no_ambiguity { span_bug!(directive.span, "inconsistent resolution for an import"); } } else { @@ -842,34 +871,42 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { module } PathResult::Failed(span, msg, false) => { - assert!(directive.imported_module.get().is_none()); - resolve_error(self, span, ResolutionError::FailedToResolve(&msg)); + if no_ambiguity { + assert!(directive.imported_module.get().is_none()); + resolve_error(self, span, ResolutionError::FailedToResolve(&msg)); + } return None; } PathResult::Failed(span, msg, true) => { - assert!(directive.imported_module.get().is_none()); - return if let Some((suggested_path, note)) = self.make_path_suggestion( - span, directive.module_path.clone(), &directive.parent_scope - ) { - Some(( - span, - format!("did you mean `{}`?", Segment::names_to_string(&suggested_path)), - note, - )) - } else { - Some((span, msg, None)) - }; + if no_ambiguity { + assert!(directive.imported_module.get().is_none()); + return Some(match self.make_path_suggestion(span, directive.module_path.clone(), + &directive.parent_scope) { + Some((suggestion, note)) => ( + span, + format!("did you mean `{}`?", Segment::names_to_string(&suggestion)), + note, + ), + None => (span, msg, None), + }); + } + return None; } PathResult::NonModule(path_res) if path_res.base_def() == Def::Err => { + if no_ambiguity { + assert!(directive.imported_module.get().is_none()); + } // The error was already reported earlier. - assert!(directive.imported_module.get().is_none()); return None; } PathResult::Indeterminate | PathResult::NonModule(..) => unreachable!(), }; - let (ident, result, type_ns_only) = match directive.subclass { - SingleImport { source, ref result, type_ns_only, .. } => (source, result, type_ns_only), + let (ident, target, source_bindings, target_bindings, type_ns_only) = + match directive.subclass { + SingleImport { source, target, ref source_bindings, + ref target_bindings, type_ns_only } => + (source, target, source_bindings, target_bindings, type_ns_only), GlobImport { is_prelude, ref max_vis } => { if directive.module_path.len() <= 1 { // HACK(eddyb) `lint_if_path_starts_with_module` needs at least @@ -908,23 +945,31 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { let mut all_ns_err = true; self.per_ns(|this, ns| if !type_ns_only || ns == TypeNS { let orig_vis = directive.vis.replace(ty::Visibility::Invisible); + let orig_blacklisted_binding = + mem::replace(&mut this.blacklisted_binding, target_bindings[ns].get()); let orig_last_import_segment = mem::replace(&mut this.last_import_segment, true); let binding = this.resolve_ident_in_module( module, ident, ns, Some(&directive.parent_scope), true, directive.span ); this.last_import_segment = orig_last_import_segment; + this.blacklisted_binding = orig_blacklisted_binding; directive.vis.set(orig_vis); match binding { Ok(binding) => { // Consistency checks, analogous to `finalize_current_module_macro_resolutions`. - let initial_def = result[ns].get().map(|initial_binding| { + let initial_def = source_bindings[ns].get().map(|initial_binding| { all_ns_err = false; - this.record_use(ident, ns, initial_binding, - directive.module_path.is_empty()); - initial_binding.def_ignoring_ambiguity() + if let Some(target_binding) = target_bindings[ns].get() { + if target.name == "_" && + initial_binding.is_extern_crate() && !initial_binding.is_import() { + this.record_use(ident, ns, target_binding, + directive.module_path.is_empty()); + } + } + initial_binding.def() }); - let def = binding.def_ignoring_ambiguity(); + let def = binding.def(); if let Ok(initial_def) = initial_def { if def != initial_def && this.ambiguity_errors.is_empty() { span_bug!(directive.span, "inconsistent resolution for an import"); @@ -963,9 +1008,8 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { return if all_ns_failed { let resolutions = match module { - ModuleOrUniformRoot::Module(module) => - Some(module.resolutions.borrow()), - ModuleOrUniformRoot::UniformRoot(_) => None, + ModuleOrUniformRoot::Module(module) => Some(module.resolutions.borrow()), + _ => None, }; let resolutions = resolutions.as_ref().into_iter().flat_map(|r| r.iter()); let names = resolutions.filter_map(|(&(ref i, _), resolution)| { @@ -976,7 +1020,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { NameBindingKind::Import { binding, .. } => { match binding.kind { // Never suggest the name that has binding error - // i.e. the name that cannot be previously resolved + // i.e., the name that cannot be previously resolved NameBindingKind::Def(Def::Err, _) => return None, _ => Some(&i.name), } @@ -1003,7 +1047,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { format!("no `{}` in the root{}", ident, lev_suggestion) } } - ModuleOrUniformRoot::UniformRoot(_) => { + _ => { if !ident.is_path_segment_keyword() { format!("no `{}` external crate{}", ident, lev_suggestion) } else { @@ -1024,7 +1068,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { let mut reexport_error = None; let mut any_successful_reexport = false; self.per_ns(|this, ns| { - if let Ok(binding) = result[ns].get() { + if let Ok(binding) = source_bindings[ns].get() { let vis = directive.vis.get(); if !binding.pseudo_vis().is_at_least(vis, &*this) { reexport_error = Some((ns, binding)); @@ -1068,7 +1112,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { let mut full_path = directive.module_path.clone(); full_path.push(Segment::from_ident(ident)); self.per_ns(|this, ns| { - if let Ok(binding) = result[ns].get() { + if let Ok(binding) = source_bindings[ns].get() { this.lint_if_path_starts_with_module( directive.crate_lint(), &full_path, @@ -1082,7 +1126,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { // Record what this import resolves to for later uses in documentation, // this may resolve to either a value or a type, but for documentation // purposes it's good enough to just favor one over the other. - self.per_ns(|this, ns| if let Some(binding) = result[ns].get().ok() { + self.per_ns(|this, ns| if let Some(binding) = source_bindings[ns].get().ok() { let mut def = binding.def(); if let Def::Macro(def_id, _) = def { // `DefId`s from the "built-in macro crate" should not leak from resolve because @@ -1104,9 +1148,8 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { fn resolve_glob_import(&mut self, directive: &'b ImportDirective<'b>) { let module = match directive.imported_module.get().unwrap() { ModuleOrUniformRoot::Module(module) => module, - ModuleOrUniformRoot::UniformRoot(_) => { - self.session.span_err(directive.span, - "cannot glob-import all possible crates"); + _ => { + self.session.span_err(directive.span, "cannot glob-import all possible crates"); return; } }; @@ -1163,7 +1206,10 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> { None => continue, }; - if binding.is_import() || binding.is_macro_def() { + // Filter away "empty import canaries" and ambiguous imports. + let is_good_import = binding.is_import() && !binding.is_ambiguity() && + binding.vis != ty::Visibility::Invisible; + if is_good_import || binding.is_macro_def() { let def = binding.def(); if def != Def::Err { if let Some(def_id) = def.opt_def_id() { @@ -1251,8 +1297,8 @@ fn import_path_to_string(names: &[Ident], subclass: &ImportDirectiveSubclass, span: Span) -> String { let pos = names.iter() - .position(|p| span == p.span && p.name != keywords::CrateRoot.name()); - let global = !names.is_empty() && names[0].name == keywords::CrateRoot.name(); + .position(|p| span == p.span && p.name != keywords::PathRoot.name()); + let global = !names.is_empty() && names[0].name == keywords::PathRoot.name(); if let Some(pos) = pos { let names = if global { &names[1..pos + 1] } else { &names[..pos + 1] }; names_to_string(names) diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 15c8861eb3f..995df3802aa 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Write the output of rustc's analysis to an implementor of Dump. //! //! Dumping the analysis is implemented by walking the AST and getting a bunch of @@ -66,14 +56,14 @@ macro_rules! access_from { ($save_ctxt:expr, $vis:expr, $id:expr) => { Access { public: $vis.node.is_pub(), - reachable: $save_ctxt.analysis.access_levels.is_reachable($id), + reachable: $save_ctxt.access_levels.is_reachable($id), } }; ($save_ctxt:expr, $item:expr) => { Access { public: $item.vis.node.is_pub(), - reachable: $save_ctxt.analysis.access_levels.is_reachable($item.id), + reachable: $save_ctxt.access_levels.is_reachable($item.id), } }; } @@ -126,7 +116,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { where F: FnOnce(&mut DumpVisitor<'l, 'tcx, 'll, O>), { - let item_def_id = self.tcx.hir.local_def_id(item_id); + let item_def_id = self.tcx.hir().local_def_id(item_id); if self.tcx.has_typeck_tables(item_def_id) { let tables = self.tcx.typeck_tables_of(item_def_id); let old_tables = self.save_ctxt.tables; @@ -249,7 +239,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { collector.visit_pat(&arg.pat); for (id, ident, ..) in collector.collected_idents { - let hir_id = self.tcx.hir.node_to_hir_id(id); + let hir_id = self.tcx.hir().node_to_hir_id(id); let typ = match self.save_ctxt.tables.node_id_to_type_opt(hir_id) { Some(s) => s.to_string(), None => continue, @@ -673,7 +663,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { } self.process_generic_params(type_parameters, "", item.id); for impl_item in impl_items { - let map = &self.tcx.hir; + let map = &self.tcx.hir(); self.process_impl_item(impl_item, map.local_def_id(item.id)); } } @@ -752,7 +742,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { // walk generics and methods self.process_generic_params(generics, &qualname, item.id); for method in methods { - let map = &self.tcx.hir; + let map = &self.tcx.hir(); self.process_trait_item(method, map.local_def_id(item.id)) } } @@ -866,7 +856,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { match p.node { PatKind::Struct(ref _path, ref fields, _) => { // FIXME do something with _path? - let hir_id = self.tcx.hir.node_to_hir_id(p.id); + let hir_id = self.tcx.hir().node_to_hir_id(p.id); let adt = match self.save_ctxt.tables.node_id_to_type_opt(hir_id) { Some(ty) => ty.ty_adt_def().unwrap(), None => { @@ -911,7 +901,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { } else { "".to_owned() }; - let hir_id = self.tcx.hir.node_to_hir_id(id); + let hir_id = self.tcx.hir().node_to_hir_id(id); let typ = self.save_ctxt .tables .node_id_to_type_opt(hir_id) @@ -982,7 +972,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { ast::Mutability::Immutable => value.to_string(), _ => String::new(), }; - let hir_id = self.tcx.hir.node_to_hir_id(id); + let hir_id = self.tcx.hir().node_to_hir_id(id); let typ = match self.save_ctxt.tables.node_id_to_type_opt(hir_id) { Some(typ) => { let typ = typ.to_string(); @@ -1204,7 +1194,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { let access = access_from!(self.save_ctxt, root_item.vis, id); // The parent def id of a given use tree is always the enclosing item. - let parent = self.save_ctxt.tcx.hir.opt_local_def_id(id) + let parent = self.save_ctxt.tcx.hir().opt_local_def_id(id) .and_then(|id| self.save_ctxt.tcx.parent_def_id(id)) .map(::id_from_def_id); @@ -1248,13 +1238,9 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { }; // Make a comma-separated list of names of imported modules. - let glob_map = &self.save_ctxt.analysis.glob_map; - let glob_map = glob_map.as_ref().unwrap(); - let names = if glob_map.contains_key(&id) { - glob_map.get(&id).unwrap().iter().map(|n| n.to_string()).collect() - } else { - Vec::new() - }; + let def_id = self.tcx.hir().local_def_id(id); + let names = self.tcx.names_imported_by_glob_use(def_id); + let names: Vec<_> = names.iter().map(|n| n.to_string()).collect(); // Otherwise it's a span with wrong macro expansion info, which // we don't want to track anyway, since it's probably macro-internal `use` @@ -1357,7 +1343,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc let name_span = item.ident.span; if !self.span.filter_generated(name_span) { let span = self.span_from_span(name_span); - let parent = self.save_ctxt.tcx.hir.opt_local_def_id(item.id) + let parent = self.save_ctxt.tcx.hir().opt_local_def_id(item.id) .and_then(|id| self.save_ctxt.tcx.parent_def_id(id)) .map(::id_from_def_id); self.dumper.import( @@ -1510,7 +1496,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc self.process_macro_use(ex.span); match ex.node { ast::ExprKind::Struct(ref path, ref fields, ref base) => { - let hir_expr = self.save_ctxt.tcx.hir.expect_expr(ex.id); + let hir_expr = self.save_ctxt.tcx.hir().expect_expr(ex.id); let adt = match self.save_ctxt.tables.expr_ty_opt(&hir_expr) { Some(ty) if ty.ty_adt_def().is_some() => ty.ty_adt_def().unwrap(), _ => { diff --git a/src/librustc_save_analysis/json_dumper.rs b/src/librustc_save_analysis/json_dumper.rs index ca336ceb381..3627c5577a6 100644 --- a/src/librustc_save_analysis/json_dumper.rs +++ b/src/librustc_save_analysis/json_dumper.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::io::Write; use rustc_serialize::json::as_json; diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 82c4795a29d..73eb5de5c76 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] @@ -45,11 +35,13 @@ use rustc::hir; use rustc::hir::def::Def as HirDef; use rustc::hir::Node; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; +use rustc::middle::privacy::AccessLevels; use rustc::middle::cstore::ExternCrate; use rustc::session::config::{CrateType, Input, OutputType}; use rustc::ty::{self, TyCtxt}; use rustc_typeck::hir_ty_to_ty; use rustc_codegen_utils::link::{filename_for_metadata, out_filename}; +use rustc_data_structures::sync::Lrc; use std::cell::Cell; use std::default::Default; @@ -78,7 +70,7 @@ use rls_data::config::Config; pub struct SaveContext<'l, 'tcx: 'l> { tcx: TyCtxt<'l, 'tcx, 'tcx>, tables: &'l ty::TypeckTables<'tcx>, - analysis: &'l ty::CrateAnalysis, + access_levels: &'l AccessLevels, span_utils: SpanUtils<'tcx>, config: Config, impl_counter: Cell, @@ -110,7 +102,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { } } - // Returns path to the compilation output (e.g. libfoo-12345678.rmeta) + // Returns path to the compilation output (e.g., libfoo-12345678.rmeta) pub fn compilation_output(&self, crate_name: &str) -> PathBuf { let sess = &self.tcx.sess; // Save-analysis is emitted per whole session, not per each crate type @@ -383,7 +375,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { let name = ident.to_string(); let qualname = format!("::{}::{}", self.tcx.node_path_str(scope), ident); filter!(self.span_utils, ident.span); - let def_id = self.tcx.hir.local_def_id(field.id); + let def_id = self.tcx.hir().local_def_id(field.id); let typ = self.tcx.type_of(def_id).to_string(); @@ -415,18 +407,18 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { // The qualname for a method is the trait name or name of the struct in an impl in // which the method is declared in, followed by the method's name. let (qualname, parent_scope, decl_id, docs, attributes) = - match self.tcx.impl_of_method(self.tcx.hir.local_def_id(id)) { - Some(impl_id) => match self.tcx.hir.get_if_local(impl_id) { + match self.tcx.impl_of_method(self.tcx.hir().local_def_id(id)) { + Some(impl_id) => match self.tcx.hir().get_if_local(impl_id) { Some(Node::Item(item)) => match item.node { hir::ItemKind::Impl(.., ref ty, _) => { let mut qualname = String::from("<"); - qualname.push_str(&self.tcx.hir.node_to_pretty_string(ty.id)); + qualname.push_str(&self.tcx.hir().node_to_pretty_string(ty.id)); let trait_id = self.tcx.trait_id_of_impl(impl_id); let mut decl_id = None; let mut docs = String::new(); let mut attrs = vec![]; - if let Some(Node::ImplItem(item)) = self.tcx.hir.find(id) { + if let Some(Node::ImplItem(item)) = self.tcx.hir().find(id) { docs = self.docs_for_attrs(&item.attrs); attrs = item.attrs.to_vec(); } @@ -463,12 +455,12 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { ); } }, - None => match self.tcx.trait_of_item(self.tcx.hir.local_def_id(id)) { + None => match self.tcx.trait_of_item(self.tcx.hir().local_def_id(id)) { Some(def_id) => { let mut docs = String::new(); let mut attrs = vec![]; - if let Some(Node::TraitItem(item)) = self.tcx.hir.find(id) { + if let Some(Node::TraitItem(item)) = self.tcx.hir().find(id) { docs = self.docs_for_attrs(&item.attrs); attrs = item.attrs.to_vec(); } @@ -529,14 +521,14 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { } pub fn get_expr_data(&self, expr: &ast::Expr) -> Option { - let hir_node = self.tcx.hir.expect_expr(expr.id); + let hir_node = self.tcx.hir().expect_expr(expr.id); let ty = self.tables.expr_ty_adjusted_opt(&hir_node); if ty.is_none() || ty.unwrap().sty == ty::Error { return None; } match expr.node { ast::ExprKind::Field(ref sub_ex, ident) => { - let hir_node = match self.tcx.hir.find(sub_ex.id) { + let hir_node = match self.tcx.hir().find(sub_ex.id) { Some(Node::Expr(expr)) => expr, _ => { debug!( @@ -587,7 +579,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { } } ast::ExprKind::MethodCall(ref seg, ..) => { - let expr_hir_id = self.tcx.hir.definitions().node_to_hir_id(expr.id); + let expr_hir_id = self.tcx.hir().definitions().node_to_hir_id(expr.id); let method_id = match self.tables.type_dependent_defs().get(expr_hir_id) { Some(id) => id.def_id(), None => { @@ -622,7 +614,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { } pub fn get_path_def(&self, id: NodeId) -> HirDef { - match self.tcx.hir.get(id) { + match self.tcx.hir().get(id) { Node::TraitRef(tr) => tr.path.def, Node::Item(&hir::Item { @@ -632,9 +624,11 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { Node::Visibility(&Spanned { node: hir::VisibilityKind::Restricted { ref path, .. }, .. }) => path.def, - Node::PathSegment(seg) => match seg.def { - Some(def) => def, - None => HirDef::Err, + Node::PathSegment(seg) => { + match seg.def { + Some(def) if def != HirDef::Err => def, + _ => self.get_path_def(self.tcx.hir().get_parent_node(id)), + } }, Node::Expr(&hir::Expr { node: hir::ExprKind::Struct(ref qpath, ..), @@ -656,7 +650,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { node: hir::PatKind::TupleStruct(ref qpath, ..), .. }) => { - let hir_id = self.tcx.hir.node_to_hir_id(id); + let hir_id = self.tcx.hir().node_to_hir_id(id); self.tables.qpath_def(qpath, hir_id) } @@ -1125,21 +1119,25 @@ impl<'b> SaveHandler for CallbackHandler<'b> { pub fn process_crate<'l, 'tcx, H: SaveHandler>( tcx: TyCtxt<'l, 'tcx, 'tcx>, krate: &ast::Crate, - analysis: &'l ty::CrateAnalysis, cratename: &str, input: &'l Input, config: Option, mut handler: H, ) { tcx.dep_graph.with_ignore(|| { - assert!(analysis.glob_map.is_some()); - info!("Dumping crate {}", cratename); + // Privacy checking requires and is done after type checking; use a + // fallback in case the access levels couldn't have been correctly computed. + let access_levels = match tcx.sess.compile_status() { + Ok(..) => tcx.privacy_access_levels(LOCAL_CRATE), + Err(..) => Lrc::new(AccessLevels::default()), + }; + let save_ctxt = SaveContext { tcx, tables: &ty::TypeckTables::empty(None), - analysis, + access_levels: &access_levels, span_utils: SpanUtils::new(&tcx.sess), config: find_config(config), impl_counter: Cell::new(0), @@ -1183,7 +1181,7 @@ fn id_from_def_id(id: DefId) -> rls_data::Id { } fn id_from_node_id(id: NodeId, scx: &SaveContext) -> rls_data::Id { - let def_id = scx.tcx.hir.opt_local_def_id(id); + let def_id = scx.tcx.hir().opt_local_def_id(id); def_id.map(|id| id_from_def_id(id)).unwrap_or_else(|| { // Create a *fake* `DefId` out of a `NodeId` by subtracting the `NodeId` // out of the maximum u32 value. This will work unless you have *billions* diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs index 9cf64a9d1ca..7d4c0d0f9f5 100644 --- a/src/librustc_save_analysis/sig.rs +++ b/src/librustc_save_analysis/sig.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A signature is a string representation of an item's type signature, excluding // any body. It also includes ids for any defs or refs in the signature. For // example: diff --git a/src/librustc_save_analysis/span_utils.rs b/src/librustc_save_analysis/span_utils.rs index 06b4f33b5db..88c6012f71f 100644 --- a/src/librustc_save_analysis/span_utils.rs +++ b/src/librustc_save_analysis/span_utils.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::session::Session; use generated_code; diff --git a/src/librustc_target/README.md b/src/librustc_target/README.md index f5b1acb1921..a22000ea9d2 100644 --- a/src/librustc_target/README.md +++ b/src/librustc_target/README.md @@ -3,4 +3,4 @@ specific to different compilation targets and so forth. For more information about how rustc works, see the [rustc guide]. -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/ +[rustc guide]: https://rust-lang.github.io/rustc-guide/ diff --git a/src/librustc_target/abi/call/aarch64.rs b/src/librustc_target/abi/call/aarch64.rs index b4d393749c4..9f9bba14b96 100644 --- a/src/librustc_target/abi/call/aarch64.rs +++ b/src/librustc_target/abi/call/aarch64.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::call::{FnType, ArgType, Reg, RegKind, Uniform}; use abi::{HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods}; @@ -16,7 +6,7 @@ fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgType<'a, Ty>) where Ty: TyLayoutMethods<'a, C> + Copy, C: LayoutOf> + HasDataLayout { - arg.layout.homogeneous_aggregate(cx).and_then(|unit| { + arg.layout.homogeneous_aggregate(cx).unit().and_then(|unit| { let size = arg.layout.size; // Ensure we have at most four uniquely addressable members. diff --git a/src/librustc_target/abi/call/amdgpu.rs b/src/librustc_target/abi/call/amdgpu.rs index 85789d7d4d7..ea9d4172cbc 100644 --- a/src/librustc_target/abi/call/amdgpu.rs +++ b/src/librustc_target/abi/call/amdgpu.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::call::{ArgType, FnType, }; use abi::{HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods}; diff --git a/src/librustc_target/abi/call/arm.rs b/src/librustc_target/abi/call/arm.rs index b4ffae7385a..228dd362161 100644 --- a/src/librustc_target/abi/call/arm.rs +++ b/src/librustc_target/abi/call/arm.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::call::{Conv, FnType, ArgType, Reg, RegKind, Uniform}; use abi::{HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods}; use spec::HasTargetSpec; @@ -17,7 +7,7 @@ fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgType<'a, Ty>) where Ty: TyLayoutMethods<'a, C> + Copy, C: LayoutOf> + HasDataLayout { - arg.layout.homogeneous_aggregate(cx).and_then(|unit| { + arg.layout.homogeneous_aggregate(cx).unit().and_then(|unit| { let size = arg.layout.size; // Ensure we have at most four uniquely addressable members. @@ -93,7 +83,7 @@ fn classify_arg_ty<'a, Ty, C>(cx: &C, arg: &mut ArgType<'a, Ty>, vfp: bool) } } - let align = arg.layout.align.abi(); + let align = arg.layout.align.abi.bytes(); let total = arg.layout.size; arg.cast_to(Uniform { unit: if align <= 4 { Reg::i32() } else { Reg::i64() }, diff --git a/src/librustc_target/abi/call/asmjs.rs b/src/librustc_target/abi/call/asmjs.rs index 3bd2594bdb9..85444500c5e 100644 --- a/src/librustc_target/abi/call/asmjs.rs +++ b/src/librustc_target/abi/call/asmjs.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::call::{FnType, ArgType, Uniform}; use abi::{HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods}; @@ -21,7 +11,7 @@ fn classify_ret_ty<'a, Ty, C>(cx: &C, ret: &mut ArgType<'a, Ty>) C: LayoutOf> + HasDataLayout { if ret.layout.is_aggregate() { - if let Some(unit) = ret.layout.homogeneous_aggregate(cx) { + if let Some(unit) = ret.layout.homogeneous_aggregate(cx).unit() { let size = ret.layout.size; if unit.size == size { ret.cast_to(Uniform { diff --git a/src/librustc_target/abi/call/hexagon.rs b/src/librustc_target/abi/call/hexagon.rs index d37d5584591..d538a8068ac 100644 --- a/src/librustc_target/abi/call/hexagon.rs +++ b/src/librustc_target/abi/call/hexagon.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals)] use abi::call::{FnType, ArgType}; diff --git a/src/librustc_target/abi/call/mips.rs b/src/librustc_target/abi/call/mips.rs index a40cb6c76f0..2335bfbb5b8 100644 --- a/src/librustc_target/abi/call/mips.rs +++ b/src/librustc_target/abi/call/mips.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::call::{ArgType, FnType, Reg, Uniform}; use abi::{HasDataLayout, LayoutOf, Size, TyLayoutMethods}; @@ -27,21 +17,21 @@ fn classify_arg_ty<'a, Ty, C>(cx: &C, arg: &mut ArgType, offset: &mut Size) { let dl = cx.data_layout(); let size = arg.layout.size; - let align = arg.layout.align.max(dl.i32_align).min(dl.i64_align); + let align = arg.layout.align.max(dl.i32_align).min(dl.i64_align).abi; if arg.layout.is_aggregate() { arg.cast_to(Uniform { unit: Reg::i32(), total: size }); - if !offset.is_abi_aligned(align) { + if !offset.is_aligned(align) { arg.pad_with(Reg::i32()); } } else { arg.extend_integer_width_to(32); } - *offset = offset.abi_align(align) + size.abi_align(align); + *offset = offset.align_to(align) + size.align_to(align); } pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType) diff --git a/src/librustc_target/abi/call/mips64.rs b/src/librustc_target/abi/call/mips64.rs index adf5a3c94ea..6f3e6494a4a 100644 --- a/src/librustc_target/abi/call/mips64.rs +++ b/src/librustc_target/abi/call/mips64.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::call::{ArgAttribute, ArgType, CastTarget, FnType, PassMode, Reg, RegKind, Uniform}; use abi::{self, HasDataLayout, LayoutOf, Size, TyLayout, TyLayoutMethods}; @@ -118,9 +108,9 @@ fn classify_arg_ty<'a, Ty, C>(cx: &C, arg: &mut ArgType<'a, Ty>) // We only care about aligned doubles if let abi::Abi::Scalar(ref scalar) = field.abi { if let abi::Float(abi::FloatTy::F64) = scalar.value { - if offset.is_abi_aligned(dl.f64_align) { + if offset.is_aligned(dl.f64_align.abi) { // Insert enough integers to cover [last_offset, offset) - assert!(last_offset.is_abi_aligned(dl.f64_align)); + assert!(last_offset.is_aligned(dl.f64_align.abi)); for _ in 0..((offset - last_offset).bits() / 64) .min((prefix.len() - prefix_index) as u64) { diff --git a/src/librustc_target/abi/call/mod.rs b/src/librustc_target/abi/call/mod.rs index 8f9ef2544e6..0d50439c67e 100644 --- a/src/librustc_target/abi/call/mod.rs +++ b/src/librustc_target/abi/call/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::{self, Abi, Align, FieldPlacement, Size}; use abi::{HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods}; use spec::HasTargetSpec; @@ -142,29 +132,29 @@ impl Reg { match self.kind { RegKind::Integer => { match self.size.bits() { - 1 => dl.i1_align, - 2..=8 => dl.i8_align, - 9..=16 => dl.i16_align, - 17..=32 => dl.i32_align, - 33..=64 => dl.i64_align, - 65..=128 => dl.i128_align, + 1 => dl.i1_align.abi, + 2..=8 => dl.i8_align.abi, + 9..=16 => dl.i16_align.abi, + 17..=32 => dl.i32_align.abi, + 33..=64 => dl.i64_align.abi, + 65..=128 => dl.i128_align.abi, _ => panic!("unsupported integer: {:?}", self) } } RegKind::Float => { match self.size.bits() { - 32 => dl.f32_align, - 64 => dl.f64_align, + 32 => dl.f32_align.abi, + 64 => dl.f64_align.abi, _ => panic!("unsupported float: {:?}", self) } } - RegKind::Vector => dl.vector_align(self.size) + RegKind::Vector => dl.vector_align(self.size).abi, } } } /// An argument passed entirely registers with the -/// same kind (e.g. HFA / HVA on PPC64 and AArch64). +/// same kind (e.g., HFA / HVA on PPC64 and AArch64). #[derive(Clone, Copy, PartialEq, Eq, Debug)] pub struct Uniform { pub unit: Reg, @@ -173,7 +163,7 @@ pub struct Uniform { /// * equal to `unit.size` (one scalar/vector) /// * a multiple of `unit.size` (an array of scalar/vectors) /// * if `unit.kind` is `Integer`, the last element - /// can be shorter, i.e. `{ i64, i64, i32 }` for + /// can be shorter, i.e., `{ i64, i64, i32 }` for /// 64-bit integers with a total size of 20 bytes pub total: Size, } @@ -227,17 +217,44 @@ impl CastTarget { pub fn size(&self, cx: &C) -> Size { (self.prefix_chunk * self.prefix.iter().filter(|x| x.is_some()).count() as u64) - .abi_align(self.rest.align(cx)) + self.rest.total + .align_to(self.rest.align(cx)) + self.rest.total } pub fn align(&self, cx: &C) -> Align { self.prefix.iter() .filter_map(|x| x.map(|kind| Reg { kind, size: self.prefix_chunk }.align(cx))) - .fold(cx.data_layout().aggregate_align.max(self.rest.align(cx)), + .fold(cx.data_layout().aggregate_align.abi.max(self.rest.align(cx)), |acc, align| acc.max(align)) } } +/// Return value from the `homogeneous_aggregate` test function. +#[derive(Copy, Clone, Debug)] +pub enum HomogeneousAggregate { + /// Yes, all the "leaf fields" of this struct are passed in the + /// same way (specified in the `Reg` value). + Homogeneous(Reg), + + /// There are distinct leaf fields passed in different ways, + /// or this is uninhabited. + Heterogeneous, + + /// There are no leaf fields at all. + NoData, +} + +impl HomogeneousAggregate { + /// If this is a homogeneous aggregate, returns the homogeneous + /// unit, else `None`. + pub fn unit(self) -> Option { + if let HomogeneousAggregate::Homogeneous(r) = self { + Some(r) + } else { + None + } + } +} + impl<'a, Ty> TyLayout<'a, Ty> { fn is_aggregate(&self) -> bool { match self.abi { @@ -249,11 +266,21 @@ impl<'a, Ty> TyLayout<'a, Ty> { } } - fn homogeneous_aggregate(&self, cx: &C) -> Option + /// True if this layout is an aggregate containing fields of only + /// a single type (e.g., `(u32, u32)`). Such aggregates are often + /// special-cased in ABIs. + /// + /// Note: We generally ignore fields of zero-sized type when computing + /// this value (cc #56877). + /// + /// This is public so that it can be used in unit tests, but + /// should generally only be relevant to the ABI details of + /// specific targets. + pub fn homogeneous_aggregate(&self, cx: &C) -> HomogeneousAggregate where Ty: TyLayoutMethods<'a, C> + Copy, C: LayoutOf { match self.abi { - Abi::Uninhabited => None, + Abi::Uninhabited => HomogeneousAggregate::Heterogeneous, // The primitive for this algorithm. Abi::Scalar(ref scalar) => { @@ -262,14 +289,15 @@ impl<'a, Ty> TyLayout<'a, Ty> { abi::Pointer => RegKind::Integer, abi::Float(_) => RegKind::Float, }; - Some(Reg { + HomogeneousAggregate::Homogeneous(Reg { kind, size: self.size }) } Abi::Vector { .. } => { - Some(Reg { + assert!(!self.is_zst()); + HomogeneousAggregate::Homogeneous(Reg { kind: RegKind::Vector, size: self.size }) @@ -285,7 +313,7 @@ impl<'a, Ty> TyLayout<'a, Ty> { if count > 0 { return self.field(cx, 0).homogeneous_aggregate(cx); } else { - return None; + return HomogeneousAggregate::NoData; } } FieldPlacement::Union(_) => true, @@ -294,21 +322,27 @@ impl<'a, Ty> TyLayout<'a, Ty> { for i in 0..self.fields.count() { if !is_union && total != self.fields.offset(i) { - return None; + return HomogeneousAggregate::Heterogeneous; } let field = self.field(cx, i); + match (result, field.homogeneous_aggregate(cx)) { - // The field itself must be a homogeneous aggregate. - (_, None) => return None, + (_, HomogeneousAggregate::NoData) => { + // Ignore fields that have no data + } + (_, HomogeneousAggregate::Heterogeneous) => { + // The field itself must be a homogeneous aggregate. + return HomogeneousAggregate::Heterogeneous; + } // If this is the first field, record the unit. - (None, Some(unit)) => { + (None, HomogeneousAggregate::Homogeneous(unit)) => { result = Some(unit); } // For all following fields, the unit must be the same. - (Some(prev_unit), Some(unit)) => { + (Some(prev_unit), HomogeneousAggregate::Homogeneous(unit)) => { if prev_unit != unit { - return None; + return HomogeneousAggregate::Heterogeneous; } } } @@ -324,9 +358,18 @@ impl<'a, Ty> TyLayout<'a, Ty> { // There needs to be no padding. if total != self.size { - None + HomogeneousAggregate::Heterogeneous } else { - result + match result { + Some(reg) => { + assert_ne!(total, Size::ZERO); + HomogeneousAggregate::Homogeneous(reg) + } + None => { + assert_eq!(total, Size::ZERO); + HomogeneousAggregate::NoData + } + } } } } @@ -369,7 +412,7 @@ impl<'a, Ty> ArgType<'a, Ty> { attrs.pointee_size = self.layout.size; // FIXME(eddyb) We should be doing this, but at least on // i686-pc-windows-msvc, it results in wrong stack offsets. - // attrs.pointee_align = Some(self.layout.align); + // attrs.pointee_align = Some(self.layout.align.abi); let extra_attrs = if self.layout.is_unsized() { Some(ArgAttributes::new()) diff --git a/src/librustc_target/abi/call/msp430.rs b/src/librustc_target/abi/call/msp430.rs index e57ca03da60..d8ba37db53d 100644 --- a/src/librustc_target/abi/call/msp430.rs +++ b/src/librustc_target/abi/call/msp430.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Reference: MSP430 Embedded Application Binary Interface // http://www.ti.com/lit/an/slaa534/slaa534.pdf diff --git a/src/librustc_target/abi/call/nvptx.rs b/src/librustc_target/abi/call/nvptx.rs index f23f7ddf2ab..4cf0f11eb1e 100644 --- a/src/librustc_target/abi/call/nvptx.rs +++ b/src/librustc_target/abi/call/nvptx.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Reference: PTX Writer's Guide to Interoperability // http://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability diff --git a/src/librustc_target/abi/call/nvptx64.rs b/src/librustc_target/abi/call/nvptx64.rs index 4399a2fec6c..8ccc77598c9 100644 --- a/src/librustc_target/abi/call/nvptx64.rs +++ b/src/librustc_target/abi/call/nvptx64.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Reference: PTX Writer's Guide to Interoperability // http://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability diff --git a/src/librustc_target/abi/call/powerpc.rs b/src/librustc_target/abi/call/powerpc.rs index b9b012020b7..2335bfbb5b8 100644 --- a/src/librustc_target/abi/call/powerpc.rs +++ b/src/librustc_target/abi/call/powerpc.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::call::{ArgType, FnType, Reg, Uniform}; use abi::{HasDataLayout, LayoutOf, Size, TyLayoutMethods}; @@ -27,21 +17,21 @@ fn classify_arg_ty<'a, Ty, C>(cx: &C, arg: &mut ArgType, offset: &mut Size) { let dl = cx.data_layout(); let size = arg.layout.size; - let align = arg.layout.align.max(dl.i32_align).min(dl.i64_align); + let align = arg.layout.align.max(dl.i32_align).min(dl.i64_align).abi; if arg.layout.is_aggregate() { arg.cast_to(Uniform { unit: Reg::i32(), total: size }); - if !offset.is_abi_aligned(align) { + if !offset.is_aligned(align) { arg.pad_with(Reg::i32()); } } else { arg.extend_integer_width_to(32); } - *offset = offset.abi_align(align) + size.abi_align(align); + *offset = offset.align_to(align) + size.align_to(align); } pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType) diff --git a/src/librustc_target/abi/call/powerpc64.rs b/src/librustc_target/abi/call/powerpc64.rs index f7ef1390f14..305a2d42250 100644 --- a/src/librustc_target/abi/call/powerpc64.rs +++ b/src/librustc_target/abi/call/powerpc64.rs @@ -1,19 +1,9 @@ -// Copyright 2014-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // FIXME: // Alignment of 128 bit types is not currently handled, this will // need to be fixed when PowerPC vector support is added. use abi::call::{FnType, ArgType, Reg, RegKind, Uniform}; -use abi::{Align, Endian, HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods}; +use abi::{Endian, HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods}; use spec::HasTargetSpec; #[derive(Debug, Clone, Copy, PartialEq)] @@ -28,7 +18,7 @@ fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgType<'a, Ty>, abi: A where Ty: TyLayoutMethods<'a, C> + Copy, C: LayoutOf> + HasDataLayout { - arg.layout.homogeneous_aggregate(cx).and_then(|unit| { + arg.layout.homogeneous_aggregate(cx).unit().and_then(|unit| { // ELFv1 only passes one-member aggregates transparently. // ELFv2 passes up to eight uniquely addressable members. if (abi == ELFv1 && arg.layout.size > unit.size) @@ -120,8 +110,8 @@ fn classify_arg_ty<'a, Ty, C>(cx: &C, arg: &mut ArgType<'a, Ty>, abi: ABI) } else { // Aggregates larger than a doubleword should be padded // at the tail to fill out a whole number of doublewords. - let align = Align::from_bits(64, 64).unwrap(); - (Reg::i64(), size.abi_align(align)) + let reg_i64 = Reg::i64(); + (reg_i64, size.align_to(reg_i64.align(cx))) }; arg.cast_to(Uniform { diff --git a/src/librustc_target/abi/call/riscv.rs b/src/librustc_target/abi/call/riscv.rs index fe0d7485c15..4950bcd3330 100644 --- a/src/librustc_target/abi/call/riscv.rs +++ b/src/librustc_target/abi/call/riscv.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Reference: RISC-V ELF psABI specification // https://github.com/riscv/riscv-elf-psabi-doc diff --git a/src/librustc_target/abi/call/s390x.rs b/src/librustc_target/abi/call/s390x.rs index d6d8ea71918..954c37fee42 100644 --- a/src/librustc_target/abi/call/s390x.rs +++ b/src/librustc_target/abi/call/s390x.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// FIXME: The assumes we're using the non-vector ABI, i.e. compiling +// FIXME: The assumes we're using the non-vector ABI, i.e., compiling // for a pre-z13 machine or using -mno-vx. use abi::call::{FnType, ArgType, Reg}; diff --git a/src/librustc_target/abi/call/sparc.rs b/src/librustc_target/abi/call/sparc.rs index a40cb6c76f0..2335bfbb5b8 100644 --- a/src/librustc_target/abi/call/sparc.rs +++ b/src/librustc_target/abi/call/sparc.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::call::{ArgType, FnType, Reg, Uniform}; use abi::{HasDataLayout, LayoutOf, Size, TyLayoutMethods}; @@ -27,21 +17,21 @@ fn classify_arg_ty<'a, Ty, C>(cx: &C, arg: &mut ArgType, offset: &mut Size) { let dl = cx.data_layout(); let size = arg.layout.size; - let align = arg.layout.align.max(dl.i32_align).min(dl.i64_align); + let align = arg.layout.align.max(dl.i32_align).min(dl.i64_align).abi; if arg.layout.is_aggregate() { arg.cast_to(Uniform { unit: Reg::i32(), total: size }); - if !offset.is_abi_aligned(align) { + if !offset.is_aligned(align) { arg.pad_with(Reg::i32()); } } else { arg.extend_integer_width_to(32); } - *offset = offset.abi_align(align) + size.abi_align(align); + *offset = offset.align_to(align) + size.align_to(align); } pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType) diff --git a/src/librustc_target/abi/call/sparc64.rs b/src/librustc_target/abi/call/sparc64.rs index a609feb3f57..150b48a8d02 100644 --- a/src/librustc_target/abi/call/sparc64.rs +++ b/src/librustc_target/abi/call/sparc64.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // FIXME: This needs an audit for correctness and completeness. use abi::call::{FnType, ArgType, Reg, RegKind, Uniform}; @@ -18,7 +8,7 @@ fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgType<'a, Ty>) where Ty: TyLayoutMethods<'a, C> + Copy, C: LayoutOf> + HasDataLayout { - arg.layout.homogeneous_aggregate(cx).and_then(|unit| { + arg.layout.homogeneous_aggregate(cx).unit().and_then(|unit| { // Ensure we have at most eight uniquely addressable members. if arg.layout.size > unit.size.checked_mul(8, cx).unwrap() { return None; diff --git a/src/librustc_target/abi/call/wasm32.rs b/src/librustc_target/abi/call/wasm32.rs index 7109eea535d..78f43f8b508 100644 --- a/src/librustc_target/abi/call/wasm32.rs +++ b/src/librustc_target/abi/call/wasm32.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::call::{FnType, ArgType}; fn classify_ret_ty(ret: &mut ArgType) { diff --git a/src/librustc_target/abi/call/x86.rs b/src/librustc_target/abi/call/x86.rs index 9a95e5b192b..648a4b5bb9d 100644 --- a/src/librustc_target/abi/call/x86.rs +++ b/src/librustc_target/abi/call/x86.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::call::{ArgAttribute, FnType, PassMode, Reg, RegKind}; use abi::{self, HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods}; use spec::HasTargetSpec; @@ -109,7 +99,7 @@ pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType<'a, Ty>, flavor: Fla }; // At this point we know this must be a primitive of sorts. - let unit = arg.layout.homogeneous_aggregate(cx).unwrap(); + let unit = arg.layout.homogeneous_aggregate(cx).unit().unwrap(); assert_eq!(unit.size, arg.layout.size); if unit.kind == RegKind::Float { continue; diff --git a/src/librustc_target/abi/call/x86_64.rs b/src/librustc_target/abi/call/x86_64.rs index 4c944650893..9d8cc19aac5 100644 --- a/src/librustc_target/abi/call/x86_64.rs +++ b/src/librustc_target/abi/call/x86_64.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The classification code for the x86_64 ABI is taken from the clay language // https://github.com/jckarter/clay/blob/master/compiler/src/externals.cpp @@ -15,7 +5,7 @@ use abi::call::{ArgType, CastTarget, FnType, Reg, RegKind}; use abi::{self, Abi, HasDataLayout, LayoutOf, Size, TyLayout, TyLayoutMethods}; /// Classification of "eightbyte" components. -// NB: the order of the variants is from general to specific, +// N.B., the order of the variants is from general to specific, // such that `unify(a, b)` is the "smaller" of `a` and `b`. #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)] enum Class { @@ -41,7 +31,7 @@ fn classify_arg<'a, Ty, C>(cx: &C, arg: &ArgType<'a, Ty>) where Ty: TyLayoutMethods<'a, C> + Copy, C: LayoutOf> + HasDataLayout { - if !off.is_abi_aligned(layout.align) { + if !off.is_aligned(layout.align.abi) { if !layout.is_zst() { return Err(Memory); } diff --git a/src/librustc_target/abi/call/x86_win64.rs b/src/librustc_target/abi/call/x86_win64.rs index 1ee069e2bbb..c583f7a0a2a 100644 --- a/src/librustc_target/abi/call/x86_win64.rs +++ b/src/librustc_target/abi/call/x86_win64.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use abi::call::{ArgType, FnType, Reg}; use abi::Abi; diff --git a/src/librustc_target/abi/mod.rs b/src/librustc_target/abi/mod.rs index 22afb0da05b..3f95e666535 100644 --- a/src/librustc_target/abi/mod.rs +++ b/src/librustc_target/abi/mod.rs @@ -1,19 +1,9 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use self::Integer::*; pub use self::Primitive::*; use spec::Target; -use std::{cmp, fmt}; +use std::fmt; use std::ops::{Add, Deref, Sub, Mul, AddAssign, Range, RangeInclusive}; use rustc_data_structures::indexed_vec::{Idx, IndexVec}; @@ -24,42 +14,44 @@ pub mod call; /// for a target, which contains everything needed to compute layouts. pub struct TargetDataLayout { pub endian: Endian, - pub i1_align: Align, - pub i8_align: Align, - pub i16_align: Align, - pub i32_align: Align, - pub i64_align: Align, - pub i128_align: Align, - pub f32_align: Align, - pub f64_align: Align, + pub i1_align: AbiAndPrefAlign, + pub i8_align: AbiAndPrefAlign, + pub i16_align: AbiAndPrefAlign, + pub i32_align: AbiAndPrefAlign, + pub i64_align: AbiAndPrefAlign, + pub i128_align: AbiAndPrefAlign, + pub f32_align: AbiAndPrefAlign, + pub f64_align: AbiAndPrefAlign, pub pointer_size: Size, - pub pointer_align: Align, - pub aggregate_align: Align, + pub pointer_align: AbiAndPrefAlign, + pub aggregate_align: AbiAndPrefAlign, /// Alignments for vector types. - pub vector_align: Vec<(Size, Align)>, + pub vector_align: Vec<(Size, AbiAndPrefAlign)>, + pub instruction_address_space: u32, } impl Default for TargetDataLayout { /// Creates an instance of `TargetDataLayout`. fn default() -> TargetDataLayout { + let align = |bits| Align::from_bits(bits).unwrap(); TargetDataLayout { endian: Endian::Big, - i1_align: Align::from_bits(8, 8).unwrap(), - i8_align: Align::from_bits(8, 8).unwrap(), - i16_align: Align::from_bits(16, 16).unwrap(), - i32_align: Align::from_bits(32, 32).unwrap(), - i64_align: Align::from_bits(32, 64).unwrap(), - i128_align: Align::from_bits(32, 64).unwrap(), - f32_align: Align::from_bits(32, 32).unwrap(), - f64_align: Align::from_bits(64, 64).unwrap(), + i1_align: AbiAndPrefAlign::new(align(8)), + i8_align: AbiAndPrefAlign::new(align(8)), + i16_align: AbiAndPrefAlign::new(align(16)), + i32_align: AbiAndPrefAlign::new(align(32)), + i64_align: AbiAndPrefAlign { abi: align(32), pref: align(64) }, + i128_align: AbiAndPrefAlign { abi: align(32), pref: align(64) }, + f32_align: AbiAndPrefAlign::new(align(32)), + f64_align: AbiAndPrefAlign::new(align(64)), pointer_size: Size::from_bits(64), - pointer_align: Align::from_bits(64, 64).unwrap(), - aggregate_align: Align::from_bits(0, 64).unwrap(), + pointer_align: AbiAndPrefAlign::new(align(64)), + aggregate_align: AbiAndPrefAlign { abi: align(0), pref: align(64) }, vector_align: vec![ - (Size::from_bits(64), Align::from_bits(64, 64).unwrap()), - (Size::from_bits(128), Align::from_bits(128, 128).unwrap()) + (Size::from_bits(64), AbiAndPrefAlign::new(align(64))), + (Size::from_bits(128), AbiAndPrefAlign::new(align(128))), ], instruction_address_space: 0, } @@ -94,11 +86,17 @@ impl TargetDataLayout { if s.is_empty() { return Err(format!("missing alignment for `{}` in \"data-layout\"", cause)); } + let align_from_bits = |bits| { + Align::from_bits(bits).map_err(|err| { + format!("invalid alignment for `{}` in \"data-layout\": {}", + cause, err) + }) + }; let abi = parse_bits(s[0], "alignment", cause)?; let pref = s.get(1).map_or(Ok(abi), |pref| parse_bits(pref, "alignment", cause))?; - Align::from_bits(abi, pref).map_err(|err| { - format!("invalid alignment for `{}` in \"data-layout\": {}", - cause, err) + Ok(AbiAndPrefAlign { + abi: align_from_bits(abi)?, + pref: align_from_bits(pref)?, }) }; @@ -205,7 +203,7 @@ impl TargetDataLayout { } } - pub fn vector_align(&self, vec_size: Size) -> Align { + pub fn vector_align(&self, vec_size: Size) -> AbiAndPrefAlign { for &(size, align) in &self.vector_align { if size == vec_size { return align; @@ -213,8 +211,7 @@ impl TargetDataLayout { } // Default to natural alignment, which is what LLVM does. // That is, use the size, rounded up to a power of 2. - let align = vec_size.bytes().next_power_of_two(); - Align::from_bytes(align, align).unwrap() + AbiAndPrefAlign::new(Align::from_bytes(vec_size.bytes().next_power_of_two()).unwrap()) } } @@ -270,14 +267,14 @@ impl Size { } #[inline] - pub fn abi_align(self, align: Align) -> Size { - let mask = align.abi() - 1; + pub fn align_to(self, align: Align) -> Size { + let mask = align.bytes() - 1; Size::from_bytes((self.bytes() + mask) & !mask) } #[inline] - pub fn is_abi_aligned(self, align: Align) -> bool { - let mask = align.abi() - 1; + pub fn is_aligned(self, align: Align) -> bool { + let mask = align.bytes() - 1; self.bytes() & mask == 0 } @@ -358,89 +355,54 @@ impl AddAssign for Size { } } -/// Alignment of a type in bytes, both ABI-mandated and preferred. -/// Each field is a power of two, giving the alignment a maximum value -/// of 2(28 - 1), which is limited by LLVM to a -/// maximum capacity of 229 or 536870912. -#[derive(Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Debug, RustcEncodable, RustcDecodable)] +/// Alignment of a type in bytes (always a power of two). +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct Align { - abi_pow2: u8, - pref_pow2: u8, + pow2: u8, } impl Align { - pub fn from_bits(abi: u64, pref: u64) -> Result { - Align::from_bytes(Size::from_bits(abi).bytes(), - Size::from_bits(pref).bytes()) + pub fn from_bits(bits: u64) -> Result { + Align::from_bytes(Size::from_bits(bits).bytes()) } - pub fn from_bytes(abi: u64, pref: u64) -> Result { - let log2 = |align: u64| { - // Treat an alignment of 0 bytes like 1-byte alignment. - if align == 0 { - return Ok(0); - } - - let mut bytes = align; - let mut pow: u8 = 0; - while (bytes & 1) == 0 { - pow += 1; - bytes >>= 1; - } - if bytes != 1 { - Err(format!("`{}` is not a power of 2", align)) - } else if pow > 29 { - Err(format!("`{}` is too large", align)) - } else { - Ok(pow) - } - }; - - Ok(Align { - abi_pow2: log2(abi)?, - pref_pow2: log2(pref)?, - }) - } - - pub fn abi(self) -> u64 { - 1 << self.abi_pow2 - } - - pub fn pref(self) -> u64 { - 1 << self.pref_pow2 - } + pub fn from_bytes(align: u64) -> Result { + // Treat an alignment of 0 bytes like 1-byte alignment. + if align == 0 { + return Ok(Align { pow2: 0 }); + } - pub fn abi_bits(self) -> u64 { - self.abi() * 8 - } + let mut bytes = align; + let mut pow2: u8 = 0; + while (bytes & 1) == 0 { + pow2 += 1; + bytes >>= 1; + } + if bytes != 1 { + return Err(format!("`{}` is not a power of 2", align)); + } + if pow2 > 29 { + return Err(format!("`{}` is too large", align)); + } - pub fn pref_bits(self) -> u64 { - self.pref() * 8 + Ok(Align { pow2 }) } - pub fn min(self, other: Align) -> Align { - Align { - abi_pow2: cmp::min(self.abi_pow2, other.abi_pow2), - pref_pow2: cmp::min(self.pref_pow2, other.pref_pow2), - } + pub fn bytes(self) -> u64 { + 1 << self.pow2 } - pub fn max(self, other: Align) -> Align { - Align { - abi_pow2: cmp::max(self.abi_pow2, other.abi_pow2), - pref_pow2: cmp::max(self.pref_pow2, other.pref_pow2), - } + pub fn bits(self) -> u64 { + self.bytes() * 8 } /// Compute the best alignment possible for the given offset /// (the largest power of two that the offset is a multiple of). /// - /// NB: for an offset of `0`, this happens to return `2^64`. + /// N.B., for an offset of `0`, this happens to return `2^64`. pub fn max_for_offset(offset: Size) -> Align { - let pow2 = offset.bytes().trailing_zeros() as u8; Align { - abi_pow2: pow2, - pref_pow2: pow2, + pow2: offset.bytes().trailing_zeros() as u8, } } @@ -451,6 +413,36 @@ impl Align { } } +/// A pair of aligments, ABI-mandated and preferred. +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)] +pub struct AbiAndPrefAlign { + pub abi: Align, + pub pref: Align, +} + +impl AbiAndPrefAlign { + pub fn new(align: Align) -> AbiAndPrefAlign { + AbiAndPrefAlign { + abi: align, + pref: align, + } + } + + pub fn min(self, other: AbiAndPrefAlign) -> AbiAndPrefAlign { + AbiAndPrefAlign { + abi: self.abi.min(other.abi), + pref: self.pref.min(other.pref), + } + } + + pub fn max(self, other: AbiAndPrefAlign) -> AbiAndPrefAlign { + AbiAndPrefAlign { + abi: self.abi.max(other.abi), + pref: self.pref.max(other.pref), + } + } +} + /// Integers, also used for enum discriminants. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub enum Integer { @@ -472,7 +464,7 @@ impl Integer { } } - pub fn align(self, cx: &C) -> Align { + pub fn align(self, cx: &C) -> AbiAndPrefAlign { let dl = cx.data_layout(); match self { @@ -507,12 +499,11 @@ impl Integer { } /// Find the smallest integer with the given alignment. - pub fn for_abi_align(cx: &C, align: Align) -> Option { + pub fn for_align(cx: &C, wanted: Align) -> Option { let dl = cx.data_layout(); - let wanted = align.abi(); for &candidate in &[I8, I16, I32, I64, I128] { - if wanted == candidate.align(dl).abi() && wanted == candidate.size().bytes() { + if wanted == candidate.align(dl).abi && wanted.bytes() == candidate.size().bytes() { return Some(candidate); } } @@ -520,13 +511,12 @@ impl Integer { } /// Find the largest integer with the given alignment or less. - pub fn approximate_abi_align(cx: &C, align: Align) -> Integer { + pub fn approximate_align(cx: &C, wanted: Align) -> Integer { let dl = cx.data_layout(); - let wanted = align.abi(); // FIXME(eddyb) maybe include I128 in the future, when it works everywhere. for &candidate in &[I64, I32, I16] { - if wanted >= candidate.align(dl).abi() && wanted >= candidate.size().bytes() { + if wanted >= candidate.align(dl).abi && wanted.bytes() >= candidate.size().bytes() { return candidate; } } @@ -597,7 +587,7 @@ impl<'a, 'tcx> Primitive { } } - pub fn align(self, cx: &C) -> Align { + pub fn align(self, cx: &C) -> AbiAndPrefAlign { let dl = cx.data_layout(); match self { @@ -639,7 +629,7 @@ pub struct Scalar { /// /// This is intended specifically to mirror LLVM’s `!range` metadata, /// semantics. - // FIXME(eddyb) always use the shortest range, e.g. by finding + // FIXME(eddyb) always use the shortest range, e.g., by finding // the largest space between two consecutive valid values and // taking everything else as the (shortest) valid range. pub valid_range: RangeInclusive, @@ -868,7 +858,7 @@ pub struct LayoutDetails { pub variants: Variants, pub fields: FieldPlacement, pub abi: Abi, - pub align: Align, + pub align: AbiAndPrefAlign, pub size: Size } @@ -887,12 +877,12 @@ impl LayoutDetails { } /// The details of the layout of a type, alongside the type itself. -/// Provides various type traversal APIs (e.g. recursing into fields). +/// Provides various type traversal APIs (e.g., recursing into fields). /// /// Note that the details are NOT guaranteed to always be identical /// to those obtained from `layout_of(ty)`, as we need to produce /// layouts for which Rust types do not exist, such as enum variants -/// or synthetic fields of enums (i.e. discriminants) and fat pointers. +/// or synthetic fields of enums (i.e., discriminants) and fat pointers. #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub struct TyLayout<'a, Ty> { pub ty: Ty, @@ -949,8 +939,4 @@ impl<'a, Ty> TyLayout<'a, Ty> { Abi::Aggregate { sized } => sized && self.size.bytes() == 0 } } - - pub fn size_and_align(&self) -> (Size, Align) { - (self.size, self.align) - } } diff --git a/src/librustc_target/build.rs b/src/librustc_target/build.rs index 6f6fde1e9e7..368200b776d 100644 --- a/src/librustc_target/build.rs +++ b/src/librustc_target/build.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-env-changed=CFG_DEFAULT_LINKER"); diff --git a/src/librustc_target/lib.rs b/src/librustc_target/lib.rs index 813b39de064..0df0027c171 100644 --- a/src/librustc_target/lib.rs +++ b/src/librustc_target/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Some stuff used by rustc that doesn't have many dependencies //! //! Originally extracted from rustc::back, which was nominally the diff --git a/src/librustc_target/spec/aarch64_apple_ios.rs b/src/librustc_target/spec/aarch64_apple_ios.rs index 16dd27887fa..2210fd1e9e7 100644 --- a/src/librustc_target/spec/aarch64_apple_ios.rs +++ b/src/librustc_target/spec/aarch64_apple_ios.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use super::apple_ios_base::{opts, Arch}; diff --git a/src/librustc_target/spec/aarch64_fuchsia.rs b/src/librustc_target/spec/aarch64_fuchsia.rs index 9ef4fe3b3af..e39a1c2e106 100644 --- a/src/librustc_target/spec/aarch64_fuchsia.rs +++ b/src/librustc_target/spec/aarch64_fuchsia.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LldFlavor, LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/aarch64_linux_android.rs b/src/librustc_target/spec/aarch64_linux_android.rs index 540aac2c338..c05964295d3 100644 --- a/src/librustc_target/spec/aarch64_linux_android.rs +++ b/src/librustc_target/spec/aarch64_linux_android.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; // See https://developer.android.com/ndk/guides/abis.html#arm64-v8a diff --git a/src/librustc_target/spec/aarch64_pc_windows_msvc.rs b/src/librustc_target/spec/aarch64_pc_windows_msvc.rs index c71ad5ff21d..b33430b59e8 100644 --- a/src/librustc_target/spec/aarch64_pc_windows_msvc.rs +++ b/src/librustc_target/spec/aarch64_pc_windows_msvc.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult, PanicStrategy}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/aarch64_unknown_cloudabi.rs b/src/librustc_target/spec/aarch64_unknown_cloudabi.rs index 087b0fa543f..ac3345ce3f2 100644 --- a/src/librustc_target/spec/aarch64_unknown_cloudabi.rs +++ b/src/librustc_target/spec/aarch64_unknown_cloudabi.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/aarch64_unknown_freebsd.rs b/src/librustc_target/spec/aarch64_unknown_freebsd.rs index b120f57192b..1fb0a2bcf7c 100644 --- a/src/librustc_target/spec/aarch64_unknown_freebsd.rs +++ b/src/librustc_target/spec/aarch64_unknown_freebsd.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/aarch64_unknown_hermit.rs b/src/librustc_target/spec/aarch64_unknown_hermit.rs index 32fb7002026..26006d0060d 100644 --- a/src/librustc_target/spec/aarch64_unknown_hermit.rs +++ b/src/librustc_target/spec/aarch64_unknown_hermit.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/aarch64_unknown_linux_gnu.rs b/src/librustc_target/spec/aarch64_unknown_linux_gnu.rs index af7ec6a1787..d30d927b6dd 100644 --- a/src/librustc_target/spec/aarch64_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/aarch64_unknown_linux_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/aarch64_unknown_linux_musl.rs b/src/librustc_target/spec/aarch64_unknown_linux_musl.rs index e5ca91aabe5..258725fed15 100644 --- a/src/librustc_target/spec/aarch64_unknown_linux_musl.rs +++ b/src/librustc_target/spec/aarch64_unknown_linux_musl.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/aarch64_unknown_netbsd.rs b/src/librustc_target/spec/aarch64_unknown_netbsd.rs index c4afd1143fc..10aef8f923d 100644 --- a/src/librustc_target/spec/aarch64_unknown_netbsd.rs +++ b/src/librustc_target/spec/aarch64_unknown_netbsd.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/aarch64_unknown_none.rs b/src/librustc_target/spec/aarch64_unknown_none.rs index 1cf214d09cc..3440a4f8752 100644 --- a/src/librustc_target/spec/aarch64_unknown_none.rs +++ b/src/librustc_target/spec/aarch64_unknown_none.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Generic AArch64 target for bare-metal code // // Can be used in conjunction with the `target-feature` and diff --git a/src/librustc_target/spec/aarch64_unknown_openbsd.rs b/src/librustc_target/spec/aarch64_unknown_openbsd.rs index 81c24fa10fa..815e11a919c 100644 --- a/src/librustc_target/spec/aarch64_unknown_openbsd.rs +++ b/src/librustc_target/spec/aarch64_unknown_openbsd.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/abi.rs b/src/librustc_target/spec/abi.rs index 6d8c8eb19f0..46606e707d7 100644 --- a/src/librustc_target/spec/abi.rs +++ b/src/librustc_target/spec/abi.rs @@ -1,18 +1,8 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Clone, Copy, Debug)] pub enum Abi { - // NB: This ordering MUST match the AbiDatas array below. + // N.B., this ordering MUST match the AbiDatas array below. // (This is ensured by the test indices_are_correct().) // Single platform ABIs diff --git a/src/librustc_target/spec/android_base.rs b/src/librustc_target/spec/android_base.rs index 7e27e8aa9a7..a8f8ad3185f 100644 --- a/src/librustc_target/spec/android_base.rs +++ b/src/librustc_target/spec/android_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, TargetOptions}; pub fn opts() -> TargetOptions { diff --git a/src/librustc_target/spec/apple_base.rs b/src/librustc_target/spec/apple_base.rs index 8774c15ff01..a80d1904a74 100644 --- a/src/librustc_target/spec/apple_base.rs +++ b/src/librustc_target/spec/apple_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::env; use spec::{LinkArgs, TargetOptions}; diff --git a/src/librustc_target/spec/apple_ios_base.rs b/src/librustc_target/spec/apple_ios_base.rs index e926e4913d6..72346ab1f34 100644 --- a/src/librustc_target/spec/apple_ios_base.rs +++ b/src/librustc_target/spec/apple_ios_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::io; use std::process::Command; use spec::{LinkArgs, LinkerFlavor, TargetOptions}; @@ -74,6 +64,8 @@ fn build_pre_link_args(arch: Arch) -> Result { args.insert(LinkerFlavor::Gcc, vec!["-arch".to_string(), arch_name.to_string(), + "-isysroot".to_string(), + sdk_root.clone(), "-Wl,-syslibroot".to_string(), sdk_root]); diff --git a/src/librustc_target/spec/arm_base.rs b/src/librustc_target/spec/arm_base.rs index 635b8ae7388..1d51d60c8f2 100644 --- a/src/librustc_target/spec/arm_base.rs +++ b/src/librustc_target/spec/arm_base.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::abi::Abi; // All the calling conventions trigger an assertion(Unsupported calling convention) in llvm on arm diff --git a/src/librustc_target/spec/arm_linux_androideabi.rs b/src/librustc_target/spec/arm_linux_androideabi.rs index 055bca6c348..5e4bebfa1c1 100644 --- a/src/librustc_target/spec/arm_linux_androideabi.rs +++ b/src/librustc_target/spec/arm_linux_androideabi.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs b/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs index c67a25e8bc2..0f891dacc6d 100644 --- a/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs +++ b/src/librustc_target/spec/arm_unknown_linux_gnueabi.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs b/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs index ed0049a932e..5503bf326cd 100644 --- a/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs +++ b/src/librustc_target/spec/arm_unknown_linux_gnueabihf.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/arm_unknown_linux_musleabi.rs b/src/librustc_target/spec/arm_unknown_linux_musleabi.rs index c34093fbab9..c2162beba26 100644 --- a/src/librustc_target/spec/arm_unknown_linux_musleabi.rs +++ b/src/librustc_target/spec/arm_unknown_linux_musleabi.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs b/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs index 967873b3201..b3f00331b3c 100644 --- a/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs +++ b/src/librustc_target/spec/arm_unknown_linux_musleabihf.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/armebv7r_none_eabi.rs b/src/librustc_target/spec/armebv7r_none_eabi.rs index 8d3ff1b800f..cd41ffbab4d 100644 --- a/src/librustc_target/spec/armebv7r_none_eabi.rs +++ b/src/librustc_target/spec/armebv7r_none_eabi.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Targets the Big endian Cortex-R4/R5 processor (ARMv7-R) use std::default::Default; diff --git a/src/librustc_target/spec/armebv7r_none_eabihf.rs b/src/librustc_target/spec/armebv7r_none_eabihf.rs index 0343ea7bd17..05b12dd28ba 100644 --- a/src/librustc_target/spec/armebv7r_none_eabihf.rs +++ b/src/librustc_target/spec/armebv7r_none_eabihf.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Targets the Cortex-R4F/R5F processor (ARMv7-R) use std::default::Default; diff --git a/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs b/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs index fb99dffeddd..7fe021e5327 100644 --- a/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs +++ b/src/librustc_target/spec/armv4t_unknown_linux_gnueabi.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs b/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs index 810f0912472..c85a80f6e8a 100644 --- a/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs +++ b/src/librustc_target/spec/armv5te_unknown_linux_gnueabi.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs b/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs index 2d4e95ab01d..dce767898c0 100644 --- a/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs +++ b/src/librustc_target/spec/armv5te_unknown_linux_musleabi.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs b/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs index 38f0f34211d..95cc41e6c98 100644 --- a/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs +++ b/src/librustc_target/spec/armv6_unknown_netbsd_eabihf.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/armv7_apple_ios.rs b/src/librustc_target/spec/armv7_apple_ios.rs index 0f7b2ad7630..98018215c80 100644 --- a/src/librustc_target/spec/armv7_apple_ios.rs +++ b/src/librustc_target/spec/armv7_apple_ios.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use super::apple_ios_base::{opts, Arch}; diff --git a/src/librustc_target/spec/armv7_linux_androideabi.rs b/src/librustc_target/spec/armv7_linux_androideabi.rs index 06abe0b2c9e..65c3c7f7057 100644 --- a/src/librustc_target/spec/armv7_linux_androideabi.rs +++ b/src/librustc_target/spec/armv7_linux_androideabi.rs @@ -1,15 +1,10 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +// This target if is for the baseline of the Android v7a ABI +// in thumb mode. It's named armv7-* instead of thumbv7-* +// for historical reasons. See the thumbv7neon variant for +// enabling NEON. + // See https://developer.android.com/ndk/guides/abis.html#v7a // for target ABI requirements. diff --git a/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs b/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs index 44e611f04b4..fa43879dcca 100644 --- a/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_cloudabi_eabihf.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs b/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs index 14e8fa9dc02..864c59b8184 100644 --- a/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_linux_gnueabihf.rs @@ -1,15 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +// This target is for glibc Linux on ARMv7 without NEON or +// thumb-mode. See the thumbv7neon variant for enabling both. + pub fn target() -> TargetResult { let base = super::linux_base::opts(); Ok(Target { diff --git a/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs b/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs index 6e71cb307b9..ae0cb2c08b4 100644 --- a/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_linux_musleabihf.rs @@ -1,15 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +// This target is for musl Linux on ARMv7 without thumb-mode or NEON. + pub fn target() -> TargetResult { let base = super::linux_musl_base::opts(); Ok(Target { diff --git a/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs b/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs index 412c3546115..f9e416fd06e 100644 --- a/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs +++ b/src/librustc_target/spec/armv7_unknown_netbsd_eabihf.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/armv7r_none_eabi.rs b/src/librustc_target/spec/armv7r_none_eabi.rs index 43148d593f1..38d115bc85e 100644 --- a/src/librustc_target/spec/armv7r_none_eabi.rs +++ b/src/librustc_target/spec/armv7r_none_eabi.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R) use std::default::Default; diff --git a/src/librustc_target/spec/armv7r_none_eabihf.rs b/src/librustc_target/spec/armv7r_none_eabihf.rs index 036b0544c52..cb707f7183a 100644 --- a/src/librustc_target/spec/armv7r_none_eabihf.rs +++ b/src/librustc_target/spec/armv7r_none_eabihf.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R) use std::default::Default; diff --git a/src/librustc_target/spec/armv7s_apple_ios.rs b/src/librustc_target/spec/armv7s_apple_ios.rs index a5f35d0a773..6d9635b308e 100644 --- a/src/librustc_target/spec/armv7s_apple_ios.rs +++ b/src/librustc_target/spec/armv7s_apple_ios.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use super::apple_ios_base::{opts, Arch}; diff --git a/src/librustc_target/spec/asmjs_unknown_emscripten.rs b/src/librustc_target/spec/asmjs_unknown_emscripten.rs index da70a3ad04d..6dc140cf160 100644 --- a/src/librustc_target/spec/asmjs_unknown_emscripten.rs +++ b/src/librustc_target/spec/asmjs_unknown_emscripten.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::{LinkArgs, LinkerFlavor, Target, TargetOptions}; pub fn target() -> Result { diff --git a/src/librustc_target/spec/bitrig_base.rs b/src/librustc_target/spec/bitrig_base.rs index e0cbfcdcef0..3b6985fa4c8 100644 --- a/src/librustc_target/spec/bitrig_base.rs +++ b/src/librustc_target/spec/bitrig_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{TargetOptions, RelroLevel}; use std::default::Default; diff --git a/src/librustc_target/spec/cloudabi_base.rs b/src/librustc_target/spec/cloudabi_base.rs index fb78cf495e2..145de0ebe69 100644 --- a/src/librustc_target/spec/cloudabi_base.rs +++ b/src/librustc_target/spec/cloudabi_base.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkArgs, LinkerFlavor, TargetOptions, RelroLevel}; pub fn opts() -> TargetOptions { diff --git a/src/librustc_target/spec/dragonfly_base.rs b/src/librustc_target/spec/dragonfly_base.rs index a9e317b7cb8..6ce2912da75 100644 --- a/src/librustc_target/spec/dragonfly_base.rs +++ b/src/librustc_target/spec/dragonfly_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkArgs, LinkerFlavor, TargetOptions, RelroLevel}; use std::default::Default; diff --git a/src/librustc_target/spec/freebsd_base.rs b/src/librustc_target/spec/freebsd_base.rs index c8a2946da50..47316f77e63 100644 --- a/src/librustc_target/spec/freebsd_base.rs +++ b/src/librustc_target/spec/freebsd_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkArgs, LinkerFlavor, TargetOptions, RelroLevel}; use std::default::Default; diff --git a/src/librustc_target/spec/fuchsia_base.rs b/src/librustc_target/spec/fuchsia_base.rs index 8c20755492e..5d94f308410 100644 --- a/src/librustc_target/spec/fuchsia_base.rs +++ b/src/librustc_target/spec/fuchsia_base.rs @@ -1,20 +1,12 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LldFlavor, LinkArgs, LinkerFlavor, TargetOptions}; use std::default::Default; pub fn opts() -> TargetOptions { - let mut args = LinkArgs::new(); - args.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec![ - "--build-id".to_string(), "--hash-style=gnu".to_string(), + let mut pre_link_args = LinkArgs::new(); + pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Ld), vec![ + "--build-id".to_string(), + "--eh-frame-hdr".to_string(), + "--hash-style=gnu".to_string(), "-z".to_string(), "rodynamic".to_string(), ]); @@ -24,9 +16,13 @@ pub fn opts() -> TargetOptions { dynamic_linking: true, executables: true, target_family: Some("unix".to_string()), + is_like_fuchsia: true, linker_is_gnu: true, has_rpath: false, - pre_link_args: args, + pre_link_args: pre_link_args, + pre_link_objects_exe: vec![ + "Scrt1.o".to_string() + ], position_independent_executables: true, has_elf_tls: true, .. Default::default() diff --git a/src/librustc_target/spec/haiku_base.rs b/src/librustc_target/spec/haiku_base.rs index bf62b49f914..00c6bd40dc5 100644 --- a/src/librustc_target/spec/haiku_base.rs +++ b/src/librustc_target/spec/haiku_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{TargetOptions, RelroLevel}; use std::default::Default; diff --git a/src/librustc_target/spec/hermit_base.rs b/src/librustc_target/spec/hermit_base.rs index 168eac685e4..d7d8562e055 100644 --- a/src/librustc_target/spec/hermit_base.rs +++ b/src/librustc_target/spec/hermit_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkArgs, LinkerFlavor, PanicStrategy, TargetOptions}; use std::default::Default; diff --git a/src/librustc_target/spec/i386_apple_ios.rs b/src/librustc_target/spec/i386_apple_ios.rs index 15fd384f9ce..d0e31763001 100644 --- a/src/librustc_target/spec/i386_apple_ios.rs +++ b/src/librustc_target/spec/i386_apple_ios.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use super::apple_ios_base::{opts, Arch}; diff --git a/src/librustc_target/spec/i586_pc_windows_msvc.rs b/src/librustc_target/spec/i586_pc_windows_msvc.rs index 9a20b854e0f..12a7f98beff 100644 --- a/src/librustc_target/spec/i586_pc_windows_msvc.rs +++ b/src/librustc_target/spec/i586_pc_windows_msvc.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::TargetResult; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i586_unknown_linux_gnu.rs b/src/librustc_target/spec/i586_unknown_linux_gnu.rs index 35bca76af47..76f6a4eba38 100644 --- a/src/librustc_target/spec/i586_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/i586_unknown_linux_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::TargetResult; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i586_unknown_linux_musl.rs b/src/librustc_target/spec/i586_unknown_linux_musl.rs index ba23e1d6860..2b56fd7a7e3 100644 --- a/src/librustc_target/spec/i586_unknown_linux_musl.rs +++ b/src/librustc_target/spec/i586_unknown_linux_musl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::TargetResult; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i686_apple_darwin.rs b/src/librustc_target/spec/i686_apple_darwin.rs index a298b550fea..40d9588e463 100644 --- a/src/librustc_target/spec/i686_apple_darwin.rs +++ b/src/librustc_target/spec/i686_apple_darwin.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i686_linux_android.rs b/src/librustc_target/spec/i686_linux_android.rs index 6aa139893eb..5b8cb7ac55d 100644 --- a/src/librustc_target/spec/i686_linux_android.rs +++ b/src/librustc_target/spec/i686_linux_android.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; // See https://developer.android.com/ndk/guides/abis.html#x86 diff --git a/src/librustc_target/spec/i686_pc_windows_gnu.rs b/src/librustc_target/spec/i686_pc_windows_gnu.rs index 867d04ec3f2..d7bc38ca172 100644 --- a/src/librustc_target/spec/i686_pc_windows_gnu.rs +++ b/src/librustc_target/spec/i686_pc_windows_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i686_pc_windows_msvc.rs b/src/librustc_target/spec/i686_pc_windows_msvc.rs index 3570f379c30..f0d75ae4e9b 100644 --- a/src/librustc_target/spec/i686_pc_windows_msvc.rs +++ b/src/librustc_target/spec/i686_pc_windows_msvc.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i686_unknown_cloudabi.rs b/src/librustc_target/spec/i686_unknown_cloudabi.rs index 637bca71add..3a9e4246981 100644 --- a/src/librustc_target/spec/i686_unknown_cloudabi.rs +++ b/src/librustc_target/spec/i686_unknown_cloudabi.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i686_unknown_dragonfly.rs b/src/librustc_target/spec/i686_unknown_dragonfly.rs index fa02f0dd634..9d71c5a8233 100644 --- a/src/librustc_target/spec/i686_unknown_dragonfly.rs +++ b/src/librustc_target/spec/i686_unknown_dragonfly.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i686_unknown_freebsd.rs b/src/librustc_target/spec/i686_unknown_freebsd.rs index e11a455911d..627dffa89d2 100644 --- a/src/librustc_target/spec/i686_unknown_freebsd.rs +++ b/src/librustc_target/spec/i686_unknown_freebsd.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i686_unknown_haiku.rs b/src/librustc_target/spec/i686_unknown_haiku.rs index 775d80b0cfd..86c64ce684b 100644 --- a/src/librustc_target/spec/i686_unknown_haiku.rs +++ b/src/librustc_target/spec/i686_unknown_haiku.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i686_unknown_linux_gnu.rs b/src/librustc_target/spec/i686_unknown_linux_gnu.rs index c3ff347882d..ab388328311 100644 --- a/src/librustc_target/spec/i686_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/i686_unknown_linux_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i686_unknown_linux_musl.rs b/src/librustc_target/spec/i686_unknown_linux_musl.rs index c02076c071a..81cbf57e577 100644 --- a/src/librustc_target/spec/i686_unknown_linux_musl.rs +++ b/src/librustc_target/spec/i686_unknown_linux_musl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i686_unknown_netbsd.rs b/src/librustc_target/spec/i686_unknown_netbsd.rs index a9c0c11aab5..1027e240224 100644 --- a/src/librustc_target/spec/i686_unknown_netbsd.rs +++ b/src/librustc_target/spec/i686_unknown_netbsd.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/i686_unknown_openbsd.rs b/src/librustc_target/spec/i686_unknown_openbsd.rs index 471d6bd4756..d2bbc6bb2db 100644 --- a/src/librustc_target/spec/i686_unknown_openbsd.rs +++ b/src/librustc_target/spec/i686_unknown_openbsd.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/l4re_base.rs b/src/librustc_target/spec/l4re_base.rs index 7932adf3b10..951005998be 100644 --- a/src/librustc_target/spec/l4re_base.rs +++ b/src/librustc_target/spec/l4re_base.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkArgs, LinkerFlavor, PanicStrategy, TargetOptions}; use std::default::Default; //use std::process::Command; diff --git a/src/librustc_target/spec/linux_base.rs b/src/librustc_target/spec/linux_base.rs index 01f65d57363..b036bf81a75 100644 --- a/src/librustc_target/spec/linux_base.rs +++ b/src/librustc_target/spec/linux_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkArgs, LinkerFlavor, TargetOptions, RelroLevel}; use std::default::Default; diff --git a/src/librustc_target/spec/linux_musl_base.rs b/src/librustc_target/spec/linux_musl_base.rs index c87f14977cb..1bc90d1a732 100644 --- a/src/librustc_target/spec/linux_musl_base.rs +++ b/src/librustc_target/spec/linux_musl_base.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, TargetOptions}; pub fn opts() -> TargetOptions { diff --git a/src/librustc_target/spec/mips64_unknown_linux_gnuabi64.rs b/src/librustc_target/spec/mips64_unknown_linux_gnuabi64.rs index b80b6b561cd..650f38702b6 100644 --- a/src/librustc_target/spec/mips64_unknown_linux_gnuabi64.rs +++ b/src/librustc_target/spec/mips64_unknown_linux_gnuabi64.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/mips64el_unknown_linux_gnuabi64.rs b/src/librustc_target/spec/mips64el_unknown_linux_gnuabi64.rs index 1c835af6e41..cb348d49479 100644 --- a/src/librustc_target/spec/mips64el_unknown_linux_gnuabi64.rs +++ b/src/librustc_target/spec/mips64el_unknown_linux_gnuabi64.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/mips_unknown_linux_gnu.rs b/src/librustc_target/spec/mips_unknown_linux_gnu.rs index 6331031c9a2..6cc3d30be1f 100644 --- a/src/librustc_target/spec/mips_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/mips_unknown_linux_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/mips_unknown_linux_musl.rs b/src/librustc_target/spec/mips_unknown_linux_musl.rs index 0b20765172a..152b11b4aee 100644 --- a/src/librustc_target/spec/mips_unknown_linux_musl.rs +++ b/src/librustc_target/spec/mips_unknown_linux_musl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/mips_unknown_linux_uclibc.rs b/src/librustc_target/spec/mips_unknown_linux_uclibc.rs index d3f614c982a..99cd20e9a52 100644 --- a/src/librustc_target/spec/mips_unknown_linux_uclibc.rs +++ b/src/librustc_target/spec/mips_unknown_linux_uclibc.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/mipsel_unknown_linux_gnu.rs b/src/librustc_target/spec/mipsel_unknown_linux_gnu.rs index 79ebefa79a3..476cf152706 100644 --- a/src/librustc_target/spec/mipsel_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/mipsel_unknown_linux_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/mipsel_unknown_linux_musl.rs b/src/librustc_target/spec/mipsel_unknown_linux_musl.rs index 042e2b71c32..9df131dbe25 100644 --- a/src/librustc_target/spec/mipsel_unknown_linux_musl.rs +++ b/src/librustc_target/spec/mipsel_unknown_linux_musl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/mipsel_unknown_linux_uclibc.rs b/src/librustc_target/spec/mipsel_unknown_linux_uclibc.rs index 8cb5cd3f03a..37c55d11f25 100644 --- a/src/librustc_target/spec/mipsel_unknown_linux_uclibc.rs +++ b/src/librustc_target/spec/mipsel_unknown_linux_uclibc.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index f67152ee90b..e47da3cff95 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! [Flexible target specification.](https://github.com/rust-lang/rfcs/pull/131) //! //! Rust targets a wide variety of usecases, and in the interest of flexibility, @@ -68,6 +58,7 @@ mod linux_musl_base; mod openbsd_base; mod netbsd_base; mod solaris_base; +mod uefi_base; mod windows_base; mod windows_msvc_base; mod thumb_base; @@ -226,6 +217,46 @@ impl ToJson for RelroLevel { } } +#[derive(Clone, Copy, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)] +pub enum MergeFunctions { + Disabled, + Trampolines, + Aliases +} + +impl MergeFunctions { + pub fn desc(&self) -> &str { + match *self { + MergeFunctions::Disabled => "disabled", + MergeFunctions::Trampolines => "trampolines", + MergeFunctions::Aliases => "aliases", + } + } +} + +impl FromStr for MergeFunctions { + type Err = (); + + fn from_str(s: &str) -> Result { + match s { + "disabled" => Ok(MergeFunctions::Disabled), + "trampolines" => Ok(MergeFunctions::Trampolines), + "aliases" => Ok(MergeFunctions::Aliases), + _ => Err(()), + } + } +} + +impl ToJson for MergeFunctions { + fn to_json(&self) -> Json { + match *self { + MergeFunctions::Disabled => "disabled".to_json(), + MergeFunctions::Trampolines => "trampolines".to_json(), + MergeFunctions::Aliases => "aliases".to_json(), + } + } +} + pub type LinkArgs = BTreeMap>; pub type TargetResult = Result; @@ -234,7 +265,7 @@ macro_rules! supported_targets { $(mod $module;)* /// List of supported targets - const TARGETS: &'static [&'static str] = &[$($triple),*]; + const TARGETS: &[&str] = &[$($triple),*]; fn load_specific(target: &str) -> TargetResult { match target { @@ -254,12 +285,12 @@ macro_rules! supported_targets { } } - pub fn get_targets() -> Box> { - Box::new(TARGETS.iter().filter_map(|t| -> Option { + pub fn get_targets() -> impl Iterator { + TARGETS.iter().filter_map(|t| -> Option { load_specific(t) .and(Ok(t.to_string())) .ok() - })) + }) } #[cfg(test)] @@ -313,6 +344,7 @@ supported_targets! { ("armv5te-unknown-linux-gnueabi", armv5te_unknown_linux_gnueabi), ("armv5te-unknown-linux-musleabi", armv5te_unknown_linux_musleabi), ("armv7-unknown-linux-gnueabihf", armv7_unknown_linux_gnueabihf), + ("thumbv7neon-unknown-linux-gnueabihf", thumbv7neon_unknown_linux_gnueabihf), ("armv7-unknown-linux-musleabihf", armv7_unknown_linux_musleabihf), ("aarch64-unknown-linux-gnu", aarch64_unknown_linux_gnu), @@ -330,10 +362,12 @@ supported_targets! { ("x86_64-linux-android", x86_64_linux_android), ("arm-linux-androideabi", arm_linux_androideabi), ("armv7-linux-androideabi", armv7_linux_androideabi), + ("thumbv7neon-linux-androideabi", thumbv7neon_linux_androideabi), ("aarch64-linux-android", aarch64_linux_android), ("aarch64-unknown-freebsd", aarch64_unknown_freebsd), ("i686-unknown-freebsd", i686_unknown_freebsd), + ("powerpc64-unknown-freebsd", powerpc64_unknown_freebsd), ("x86_64-unknown-freebsd", x86_64_unknown_freebsd), ("i686-unknown-dragonfly", i686_unknown_dragonfly), @@ -399,6 +433,9 @@ supported_targets! { ("thumbv7m-none-eabi", thumbv7m_none_eabi), ("thumbv7em-none-eabi", thumbv7em_none_eabi), ("thumbv7em-none-eabihf", thumbv7em_none_eabihf), + ("thumbv8m.base-none-eabi", thumbv8m_base_none_eabi), + ("thumbv8m.main-none-eabi", thumbv8m_main_none_eabi), + ("thumbv8m.main-none-eabihf", thumbv8m_main_none_eabihf), ("msp430-none-elf", msp430_none_elf), @@ -414,6 +451,10 @@ supported_targets! { ("riscv32imac-unknown-none-elf", riscv32imac_unknown_none_elf), ("aarch64-unknown-none", aarch64_unknown_none), + + ("x86_64-fortanix-unknown-sgx", x86_64_fortanix_unknown_sgx), + + ("x86_64-unknown-uefi", x86_64_unknown_uefi), } /// Everything `rustc` knows about how to compile for a specific target. @@ -558,6 +599,8 @@ pub struct TargetOptions { /// Emscripten toolchain. /// Defaults to false. pub is_like_emscripten: bool, + /// Whether the target toolchain is like Fuchsia's. + pub is_like_fuchsia: bool, /// Whether the linker support GNU-like arguments such as -O. Defaults to false. pub linker_is_gnu: bool, /// The MinGW toolchain has a known issue that prevents it from correctly @@ -598,7 +641,7 @@ pub struct TargetOptions { /// `eh_unwind_resume` lang item. pub custom_unwind_resume: bool, - /// Flag indicating whether ELF TLS (e.g. #[thread_local]) is available for + /// Flag indicating whether ELF TLS (e.g., #[thread_local]) is available for /// this target. pub has_elf_tls: bool, // This is mainly for easy compatibility with emscripten. @@ -685,6 +728,18 @@ pub struct TargetOptions { /// target features. This is `true` by default, and `false` for targets like /// wasm32 where the whole program either has simd or not. pub simd_types_indirect: bool, + + /// If set, have the linker export exactly these symbols, instead of using + /// the usual logic to figure this out from the crate itself. + pub override_export_symbols: Option>, + + /// Determines how or whether the MergeFunctions LLVM pass should run for + /// this target. Either "disabled", "trampolines", or "aliases". + /// The MergeFunctions pass is generally useful, but some targets may need + /// to opt out. The default is "aliases". + /// + /// Workaround for: https://github.com/rust-lang/rust/issues/57356 + pub merge_functions: MergeFunctions } impl Default for TargetOptions { @@ -723,6 +778,7 @@ impl Default for TargetOptions { is_like_android: false, is_like_emscripten: false, is_like_msvc: false, + is_like_fuchsia: false, linker_is_gnu: false, allows_weak_linkage: true, has_rpath: false, @@ -765,6 +821,8 @@ impl Default for TargetOptions { emit_debug_gdb_scripts: true, requires_uwtable: false, simd_types_indirect: true, + override_export_symbols: None, + merge_functions: MergeFunctions::Aliases, } } } @@ -867,6 +925,19 @@ impl Target { .map(|o| o.as_u64() .map(|s| base.options.$key_name = Some(s))); } ); + ($key_name:ident, MergeFunctions) => ( { + let name = (stringify!($key_name)).replace("_", "-"); + obj.find(&name[..]).and_then(|o| o.as_string().and_then(|s| { + match s.parse::() { + Ok(mergefunc) => base.options.$key_name = mergefunc, + _ => return Some(Err(format!("'{}' is not a valid value for \ + merge-functions. Use 'disabled', \ + 'trampolines', or 'aliases'.", + s))), + } + Some(Ok(())) + })).unwrap_or(Ok(())) + } ); ($key_name:ident, PanicStrategy) => ( { let name = (stringify!($key_name)).replace("_", "-"); obj.find(&name[..]).and_then(|o| o.as_string().and_then(|s| { @@ -900,6 +971,14 @@ impl Target { ) ); } ); + ($key_name:ident, opt_list) => ( { + let name = (stringify!($key_name)).replace("_", "-"); + obj.find(&name[..]).map(|o| o.as_array() + .map(|v| base.options.$key_name = Some(v.iter() + .map(|a| a.as_string().unwrap().to_string()).collect()) + ) + ); + } ); ($key_name:ident, optional) => ( { let name = (stringify!($key_name)).replace("_", "-"); if let Some(o) = obj.find(&name[..]) { @@ -977,7 +1056,7 @@ impl Target { key!(is_builtin, bool); key!(linker, optional); - try!(key!(lld_flavor, LldFlavor)); + key!(lld_flavor, LldFlavor)?; key!(pre_link_args, link_args); key!(pre_link_args_crt, link_args); key!(pre_link_objects_exe, list); @@ -1013,13 +1092,14 @@ impl Target { key!(is_like_msvc, bool); key!(is_like_emscripten, bool); key!(is_like_android, bool); + key!(is_like_fuchsia, bool); key!(linker_is_gnu, bool); key!(allows_weak_linkage, bool); key!(has_rpath, bool); key!(no_default_libraries, bool); key!(position_independent_executables, bool); key!(needs_plt, bool); - try!(key!(relro_level, RelroLevel)); + key!(relro_level, RelroLevel)?; key!(archive_format); key!(allow_asm, bool); key!(custom_unwind_resume, bool); @@ -1029,7 +1109,7 @@ impl Target { key!(max_atomic_width, Option); key!(min_atomic_width, Option); key!(atomic_cas, bool); - try!(key!(panic_strategy, PanicStrategy)); + key!(panic_strategy, PanicStrategy)?; key!(crt_static_allows_dylibs, bool); key!(crt_static_default, bool); key!(crt_static_respected, bool); @@ -1046,6 +1126,8 @@ impl Target { key!(emit_debug_gdb_scripts, bool); key!(requires_uwtable, bool); key!(simd_types_indirect, bool); + key!(override_export_symbols, opt_list); + key!(merge_functions, MergeFunctions)?; if let Some(array) = obj.find("abi-blacklist").and_then(Json::as_array) { for name in array.iter().filter_map(|abi| abi.as_string()) { @@ -1222,6 +1304,7 @@ impl ToJson for Target { target_option_val!(is_like_msvc); target_option_val!(is_like_emscripten); target_option_val!(is_like_android); + target_option_val!(is_like_fuchsia); target_option_val!(linker_is_gnu); target_option_val!(allows_weak_linkage); target_option_val!(has_rpath); @@ -1255,6 +1338,8 @@ impl ToJson for Target { target_option_val!(emit_debug_gdb_scripts); target_option_val!(requires_uwtable); target_option_val!(simd_types_indirect); + target_option_val!(override_export_symbols); + target_option_val!(merge_functions); if default.abi_blacklist != self.options.abi_blacklist { d.insert("abi-blacklist".to_string(), self.options.abi_blacklist.iter() diff --git a/src/librustc_target/spec/msp430_none_elf.rs b/src/librustc_target/spec/msp430_none_elf.rs index d9ab2384491..df564bc924b 100644 --- a/src/librustc_target/spec/msp430_none_elf.rs +++ b/src/librustc_target/spec/msp430_none_elf.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/netbsd_base.rs b/src/librustc_target/spec/netbsd_base.rs index 8cb5a33cdb5..b88d360dd37 100644 --- a/src/librustc_target/spec/netbsd_base.rs +++ b/src/librustc_target/spec/netbsd_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkArgs, LinkerFlavor, TargetOptions, RelroLevel}; use std::default::Default; diff --git a/src/librustc_target/spec/openbsd_base.rs b/src/librustc_target/spec/openbsd_base.rs index 90ab1135c54..4bdf73fc922 100644 --- a/src/librustc_target/spec/openbsd_base.rs +++ b/src/librustc_target/spec/openbsd_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkArgs, LinkerFlavor, TargetOptions, RelroLevel}; use std::default::Default; diff --git a/src/librustc_target/spec/powerpc64_unknown_freebsd.rs b/src/librustc_target/spec/powerpc64_unknown_freebsd.rs new file mode 100644 index 00000000000..cc7b87bfdeb --- /dev/null +++ b/src/librustc_target/spec/powerpc64_unknown_freebsd.rs @@ -0,0 +1,22 @@ +use spec::{LinkerFlavor, Target, TargetResult}; + +pub fn target() -> TargetResult { + let mut base = super::freebsd_base::opts(); + base.cpu = "ppc64".to_string(); + base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); + base.max_atomic_width = Some(64); + + Ok(Target { + llvm_target: "powerpc64-unknown-freebsd".to_string(), + target_endian: "big".to_string(), + target_pointer_width: "64".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "E-m:e-i64:64-n32:64".to_string(), + arch: "powerpc64".to_string(), + target_os: "freebsd".to_string(), + target_env: String::new(), + target_vendor: "unknown".to_string(), + linker_flavor: LinkerFlavor::Gcc, + options: base, + }) +} diff --git a/src/librustc_target/spec/powerpc64_unknown_linux_gnu.rs b/src/librustc_target/spec/powerpc64_unknown_linux_gnu.rs index 1d0afcd5e0c..1f7ae933ced 100644 --- a/src/librustc_target/spec/powerpc64_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/powerpc64_unknown_linux_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult, RelroLevel}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/powerpc64_unknown_linux_musl.rs b/src/librustc_target/spec/powerpc64_unknown_linux_musl.rs index 95e95510e1f..6fc8be8a5c4 100644 --- a/src/librustc_target/spec/powerpc64_unknown_linux_musl.rs +++ b/src/librustc_target/spec/powerpc64_unknown_linux_musl.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/powerpc64le_unknown_linux_gnu.rs b/src/librustc_target/spec/powerpc64le_unknown_linux_gnu.rs index 01811c5a0c3..21791a75d2a 100644 --- a/src/librustc_target/spec/powerpc64le_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/powerpc64le_unknown_linux_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/powerpc64le_unknown_linux_musl.rs b/src/librustc_target/spec/powerpc64le_unknown_linux_musl.rs index 590c5ba8d54..38f7fe887f5 100644 --- a/src/librustc_target/spec/powerpc64le_unknown_linux_musl.rs +++ b/src/librustc_target/spec/powerpc64le_unknown_linux_musl.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/powerpc_unknown_linux_gnu.rs b/src/librustc_target/spec/powerpc_unknown_linux_gnu.rs index 99d8d99fbb2..286d177c864 100644 --- a/src/librustc_target/spec/powerpc_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/powerpc_unknown_linux_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/powerpc_unknown_linux_gnuspe.rs b/src/librustc_target/spec/powerpc_unknown_linux_gnuspe.rs index 9b15b0a5dc4..ae144af0472 100644 --- a/src/librustc_target/spec/powerpc_unknown_linux_gnuspe.rs +++ b/src/librustc_target/spec/powerpc_unknown_linux_gnuspe.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/powerpc_unknown_linux_musl.rs b/src/librustc_target/spec/powerpc_unknown_linux_musl.rs index 1a4d0cb323f..3b61889163b 100644 --- a/src/librustc_target/spec/powerpc_unknown_linux_musl.rs +++ b/src/librustc_target/spec/powerpc_unknown_linux_musl.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/powerpc_unknown_netbsd.rs b/src/librustc_target/spec/powerpc_unknown_netbsd.rs index 98625a63f52..e8662a78519 100644 --- a/src/librustc_target/spec/powerpc_unknown_netbsd.rs +++ b/src/librustc_target/spec/powerpc_unknown_netbsd.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/redox_base.rs b/src/librustc_target/spec/redox_base.rs index c28746a9363..dd32f02e340 100644 --- a/src/librustc_target/spec/redox_base.rs +++ b/src/librustc_target/spec/redox_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkArgs, LinkerFlavor, TargetOptions}; use std::default::Default; diff --git a/src/librustc_target/spec/riscv32imac_unknown_none_elf.rs b/src/librustc_target/spec/riscv32imac_unknown_none_elf.rs index b199a50f0ca..8adf562ca7e 100644 --- a/src/librustc_target/spec/riscv32imac_unknown_none_elf.rs +++ b/src/librustc_target/spec/riscv32imac_unknown_none_elf.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; @@ -28,7 +18,7 @@ pub fn target() -> TargetResult { linker: Some("rust-lld".to_string()), cpu: "generic-rv32".to_string(), max_atomic_width: Some(32), - atomic_cas: false, // incomplete +a extension + atomic_cas: true, features: "+m,+a,+c".to_string(), executables: true, panic_strategy: PanicStrategy::Abort, diff --git a/src/librustc_target/spec/riscv32imc_unknown_none_elf.rs b/src/librustc_target/spec/riscv32imc_unknown_none_elf.rs index 68da1b61adf..5d8157ee59a 100644 --- a/src/librustc_target/spec/riscv32imc_unknown_none_elf.rs +++ b/src/librustc_target/spec/riscv32imc_unknown_none_elf.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; diff --git a/src/librustc_target/spec/riscv_base.rs b/src/librustc_target/spec/riscv_base.rs index 701ddf57b32..ea7fdc39a9a 100644 --- a/src/librustc_target/spec/riscv_base.rs +++ b/src/librustc_target/spec/riscv_base.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::abi::Abi; // All the calling conventions trigger an assertion(Unsupported calling diff --git a/src/librustc_target/spec/s390x_unknown_linux_gnu.rs b/src/librustc_target/spec/s390x_unknown_linux_gnu.rs index bd8b7e435d3..c18c94511f8 100644 --- a/src/librustc_target/spec/s390x_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/s390x_unknown_linux_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/solaris_base.rs b/src/librustc_target/spec/solaris_base.rs index 93b889d5d39..f5f85092105 100644 --- a/src/librustc_target/spec/solaris_base.rs +++ b/src/librustc_target/spec/solaris_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::TargetOptions; use std::default::Default; diff --git a/src/librustc_target/spec/sparc64_unknown_linux_gnu.rs b/src/librustc_target/spec/sparc64_unknown_linux_gnu.rs index f2b99aa46d2..e5e3752be7f 100644 --- a/src/librustc_target/spec/sparc64_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/sparc64_unknown_linux_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/sparc64_unknown_netbsd.rs b/src/librustc_target/spec/sparc64_unknown_netbsd.rs index c663aa344da..62efd41dbb8 100644 --- a/src/librustc_target/spec/sparc64_unknown_netbsd.rs +++ b/src/librustc_target/spec/sparc64_unknown_netbsd.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/sparc_unknown_linux_gnu.rs b/src/librustc_target/spec/sparc_unknown_linux_gnu.rs index 81db39cd23f..b6468993790 100644 --- a/src/librustc_target/spec/sparc_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/sparc_unknown_linux_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/sparcv9_sun_solaris.rs b/src/librustc_target/spec/sparcv9_sun_solaris.rs index 5029e857eb5..f1c5c5ac44f 100644 --- a/src/librustc_target/spec/sparcv9_sun_solaris.rs +++ b/src/librustc_target/spec/sparcv9_sun_solaris.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/thumb_base.rs b/src/librustc_target/spec/thumb_base.rs index 4c9a4764eff..06cb6a8d823 100644 --- a/src/librustc_target/spec/thumb_base.rs +++ b/src/librustc_target/spec/thumb_base.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// These 4 `thumbv*` targets cover the ARM Cortex-M family of processors which are widely used in +// These `thumbv*` targets cover the ARM Cortex-M family of processors which are widely used in // microcontrollers. Namely, all these processors: // // - Cortex-M0 @@ -17,8 +7,10 @@ // - Cortex-M3 // - Cortex-M4(F) // - Cortex-M7(F) +// - Cortex-M23 +// - Cortex-M33 // -// We have opted for 4 targets instead of one target per processor (e.g. `cortex-m0`, `cortex-m3`, +// We have opted for these instead of one target per processor (e.g., `cortex-m0`, `cortex-m3`, // etc) because the differences between some processors like the cortex-m0 and cortex-m1 are almost // non-existent from the POV of codegen so it doesn't make sense to have separate targets for them. // And if differences exist between two processors under the same target, rustc flags can be used to diff --git a/src/librustc_target/spec/thumbv6m_none_eabi.rs b/src/librustc_target/spec/thumbv6m_none_eabi.rs index 99034277abd..98c46e9c600 100644 --- a/src/librustc_target/spec/thumbv6m_none_eabi.rs +++ b/src/librustc_target/spec/thumbv6m_none_eabi.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Targets the Cortex-M0, Cortex-M0+ and Cortex-M1 processors (ARMv6-M architecture) use spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; diff --git a/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs b/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs index dab10ca241e..eaa08fadbc0 100644 --- a/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs +++ b/src/librustc_target/spec/thumbv7a_pc_windows_msvc.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult, PanicStrategy}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/thumbv7em_none_eabi.rs b/src/librustc_target/spec/thumbv7em_none_eabi.rs index 17fad29dd29..8a1fe09cdb0 100644 --- a/src/librustc_target/spec/thumbv7em_none_eabi.rs +++ b/src/librustc_target/spec/thumbv7em_none_eabi.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Targets the Cortex-M4 and Cortex-M7 processors (ARMv7E-M) // // This target assumes that the device doesn't have a FPU (Floating Point Unit) and lowers all the diff --git a/src/librustc_target/spec/thumbv7em_none_eabihf.rs b/src/librustc_target/spec/thumbv7em_none_eabihf.rs index 02ede112ed3..0c9aa1c5149 100644 --- a/src/librustc_target/spec/thumbv7em_none_eabihf.rs +++ b/src/librustc_target/spec/thumbv7em_none_eabihf.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Targets the Cortex-M4F and Cortex-M7F processors (ARMv7E-M) // // This target assumes that the device does have a FPU (Floating Point Unit) and lowers all (single diff --git a/src/librustc_target/spec/thumbv7m_none_eabi.rs b/src/librustc_target/spec/thumbv7m_none_eabi.rs index f4fffade163..9bff3473c58 100644 --- a/src/librustc_target/spec/thumbv7m_none_eabi.rs +++ b/src/librustc_target/spec/thumbv7m_none_eabi.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Targets the Cortex-M3 processor (ARMv7-M) use spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; diff --git a/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs b/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs new file mode 100644 index 00000000000..2d92e29c09d --- /dev/null +++ b/src/librustc_target/spec/thumbv7neon_linux_androideabi.rs @@ -0,0 +1,34 @@ +use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; + +// This target if is for the Android v7a ABI in thumb mode with +// NEON unconditionally enabled and, therefore, with 32 FPU registers +// enabled as well. See section A2.6.2 on page A2-56 in +// https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf + +// See https://developer.android.com/ndk/guides/abis.html#v7a +// for target ABI requirements. + +pub fn target() -> TargetResult { + let mut base = super::android_base::opts(); + base.features = "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(); + base.max_atomic_width = Some(64); + base.pre_link_args + .get_mut(&LinkerFlavor::Gcc).unwrap().push("-march=armv7-a".to_string()); + + Ok(Target { + llvm_target: "armv7-none-linux-android".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "android".to_string(), + target_env: "".to_string(), + target_vendor: "unknown".to_string(), + linker_flavor: LinkerFlavor::Gcc, + options: TargetOptions { + abi_blacklist: super::arm_base::abi_blacklist(), + .. base + }, + }) +} diff --git a/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs b/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs new file mode 100644 index 00000000000..bdf57969154 --- /dev/null +++ b/src/librustc_target/spec/thumbv7neon_unknown_linux_gnueabihf.rs @@ -0,0 +1,32 @@ +use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; + +// This target is for glibc Linux on ARMv7 with thumb mode enabled +// (for consistency with Android and Debian-based distributions) +// and with NEON unconditionally enabled and, therefore, with 32 FPU +// registers enabled as well. See section A2.6.2 on page A2-56 in +// https://static.docs.arm.com/ddi0406/cd/DDI0406C_d_armv7ar_arm.pdf + +pub fn target() -> TargetResult { + let base = super::linux_base::opts(); + Ok(Target { + llvm_target: "armv7-unknown-linux-gnueabihf".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "linux".to_string(), + target_env: "gnu".to_string(), + target_vendor: "unknown".to_string(), + linker_flavor: LinkerFlavor::Gcc, + + options: TargetOptions { + // Info about features at https://wiki.debian.org/ArmHardFloatPort + features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".to_string(), + cpu: "generic".to_string(), + max_atomic_width: Some(64), + abi_blacklist: super::arm_base::abi_blacklist(), + .. base + } + }) +} diff --git a/src/librustc_target/spec/thumbv8m_base_none_eabi.rs b/src/librustc_target/spec/thumbv8m_base_none_eabi.rs new file mode 100644 index 00000000000..0e0e73efd45 --- /dev/null +++ b/src/librustc_target/spec/thumbv8m_base_none_eabi.rs @@ -0,0 +1,26 @@ +// Targets the Cortex-M23 processor (Baseline ARMv8-M) + +use spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; + +pub fn target() -> TargetResult { + Ok(Target { + llvm_target: "thumbv8m.base-none-eabi".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "none".to_string(), + target_env: String::new(), + target_vendor: String::new(), + linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), + + options: TargetOptions { + // ARMv8-M baseline doesn't support unaligned loads/stores so we disable them + // with +strict-align. + features: "+strict-align".to_string(), + max_atomic_width: Some(32), + .. super::thumb_base::opts() + }, + }) +} diff --git a/src/librustc_target/spec/thumbv8m_main_none_eabi.rs b/src/librustc_target/spec/thumbv8m_main_none_eabi.rs new file mode 100644 index 00000000000..dc2454d7497 --- /dev/null +++ b/src/librustc_target/spec/thumbv8m_main_none_eabi.rs @@ -0,0 +1,24 @@ +// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile), +// without the Floating Point extension. + +use spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; + +pub fn target() -> TargetResult { + Ok(Target { + llvm_target: "thumbv8m.main-none-eabi".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "none".to_string(), + target_env: String::new(), + target_vendor: String::new(), + linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), + + options: TargetOptions { + max_atomic_width: Some(32), + .. super::thumb_base::opts() + }, + }) +} diff --git a/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs b/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs new file mode 100644 index 00000000000..5fa1f42288d --- /dev/null +++ b/src/librustc_target/spec/thumbv8m_main_none_eabihf.rs @@ -0,0 +1,30 @@ +// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile), +// with the Floating Point extension. + +use spec::{LinkerFlavor, LldFlavor, Target, TargetOptions, TargetResult}; + +pub fn target() -> TargetResult { + Ok(Target { + llvm_target: "thumbv8m.main-none-eabihf".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "none".to_string(), + target_env: String::new(), + target_vendor: String::new(), + linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), + + options: TargetOptions { + // If the Floating Point extension is implemented in the Cortex-M33 + // processor, the Cortex-M33 Technical Reference Manual states that + // the FPU uses the FPv5 architecture, single-precision instructions + // and 16 D registers. + // These parameters map to the following LLVM features. + features: "+fp-armv8,+fp-only-sp,+d16".to_string(), + max_atomic_width: Some(32), + .. super::thumb_base::opts() + }, + }) +} diff --git a/src/librustc_target/spec/uefi_base.rs b/src/librustc_target/spec/uefi_base.rs new file mode 100644 index 00000000000..4628089ffe1 --- /dev/null +++ b/src/librustc_target/spec/uefi_base.rs @@ -0,0 +1,65 @@ +// This defines a base target-configuration for native UEFI systems. The UEFI specification has +// quite detailed sections on the ABI of all the supported target architectures. In almost all +// cases it simply follows what Microsoft Windows does. Hence, whenever in doubt, see the MSDN +// documentation. +// UEFI uses COFF/PE32+ format for binaries. All binaries must be statically linked. No dynamic +// linker is supported. As native to COFF, binaries are position-dependent, but will be relocated +// by the loader if the pre-chosen memory location is already in use. +// UEFI forbids running code on anything but the boot-CPU. Not interrupts are allowed other than +// the timer-interrupt. Device-drivers are required to use polling-based models. Furthermore, all +// code runs in the same environment, no process separation is supported. + +use spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions}; +use std::default::Default; + +pub fn opts() -> TargetOptions { + let mut pre_link_args = LinkArgs::new(); + + pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Link), vec![ + // Suppress the verbose logo and authorship debugging output, which would needlessly + // clog any log files. + "/NOLOGO".to_string(), + + // UEFI is fully compatible to non-executable data pages. Tell the compiler that + // non-code sections can be marked as non-executable, including stack pages. + "/NXCOMPAT".to_string(), + + // There is no runtime for UEFI targets, prevent them from being linked. UEFI targets + // must be freestanding. + "/nodefaultlib".to_string(), + + // Non-standard subsystems have no default entry-point in PE+ files. We have to define + // one. "efi_main" seems to be a common choice amongst other implementations and the + // spec. + "/entry:efi_main".to_string(), + + // COFF images have a "Subsystem" field in their header, which defines what kind of + // program it is. UEFI has 3 fields reserved, which are EFI_APPLICATION, + // EFI_BOOT_SERVICE_DRIVER, and EFI_RUNTIME_DRIVER. We default to EFI_APPLICATION, + // which is very likely the most common option. Individual projects can override this + // with custom linker flags. + // The subsystem-type only has minor effects on the application. It defines the memory + // regions the application is loaded into (runtime-drivers need to be put into + // reserved areas), as well as whether a return from the entry-point is treated as + // exit (default for applications). + "/subsystem:efi_application".to_string(), + ]); + + TargetOptions { + dynamic_linking: false, + executables: true, + disable_redzone: true, + exe_suffix: ".efi".to_string(), + allows_weak_linkage: false, + panic_strategy: PanicStrategy::Abort, + stack_probes: true, + singlethread: true, + emit_debug_gdb_scripts: false, + + linker: Some("lld-link".to_string()), + lld_flavor: LldFlavor::Link, + pre_link_args, + + .. Default::default() + } +} diff --git a/src/librustc_target/spec/wasm32_experimental_emscripten.rs b/src/librustc_target/spec/wasm32_experimental_emscripten.rs index 60ad2d23249..5ecd66306d0 100644 --- a/src/librustc_target/spec/wasm32_experimental_emscripten.rs +++ b/src/librustc_target/spec/wasm32_experimental_emscripten.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::{LinkArgs, LinkerFlavor, Target, TargetOptions}; pub fn target() -> Result { diff --git a/src/librustc_target/spec/wasm32_unknown_emscripten.rs b/src/librustc_target/spec/wasm32_unknown_emscripten.rs index 2c80f3b4b3b..a6e9340ce28 100644 --- a/src/librustc_target/spec/wasm32_unknown_emscripten.rs +++ b/src/librustc_target/spec/wasm32_unknown_emscripten.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::{LinkArgs, LinkerFlavor, Target, TargetOptions}; pub fn target() -> Result { diff --git a/src/librustc_target/spec/wasm32_unknown_unknown.rs b/src/librustc_target/spec/wasm32_unknown_unknown.rs index 46353068bd0..ee2160c4720 100644 --- a/src/librustc_target/spec/wasm32_unknown_unknown.rs +++ b/src/librustc_target/spec/wasm32_unknown_unknown.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The wasm32-unknown-unknown target is currently an experimental version of a // wasm-based target which does *not* use the Emscripten toolchain. Instead // this toolchain is based purely on LLVM's own toolchain, using LLVM's native diff --git a/src/librustc_target/spec/windows_base.rs b/src/librustc_target/spec/windows_base.rs index 29049b14275..65d618232a2 100644 --- a/src/librustc_target/spec/windows_base.rs +++ b/src/librustc_target/spec/windows_base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkArgs, LinkerFlavor, TargetOptions}; use std::default::Default; diff --git a/src/librustc_target/spec/windows_msvc_base.rs b/src/librustc_target/spec/windows_msvc_base.rs index 27879de9ab5..89f6b1bcc71 100644 --- a/src/librustc_target/spec/windows_msvc_base.rs +++ b/src/librustc_target/spec/windows_msvc_base.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkArgs, LinkerFlavor, TargetOptions}; use std::default::Default; diff --git a/src/librustc_target/spec/x86_64_apple_darwin.rs b/src/librustc_target/spec/x86_64_apple_darwin.rs index 150590ba68d..7de33fe8ac5 100644 --- a/src/librustc_target/spec/x86_64_apple_darwin.rs +++ b/src/librustc_target/spec/x86_64_apple_darwin.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_apple_ios.rs b/src/librustc_target/spec/x86_64_apple_ios.rs index e184ec24358..286a73d4804 100644 --- a/src/librustc_target/spec/x86_64_apple_ios.rs +++ b/src/librustc_target/spec/x86_64_apple_ios.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; use super::apple_ios_base::{opts, Arch}; diff --git a/src/librustc_target/spec/x86_64_fortanix_unknown_sgx.rs b/src/librustc_target/spec/x86_64_fortanix_unknown_sgx.rs new file mode 100644 index 00000000000..7c369daa2a8 --- /dev/null +++ b/src/librustc_target/spec/x86_64_fortanix_unknown_sgx.rs @@ -0,0 +1,71 @@ +use std::iter; + +use super::{LinkerFlavor, PanicStrategy, Target, TargetOptions}; + +pub fn target() -> Result { + const PRE_LINK_ARGS: &[&str] = &[ + "-Wl,--as-needed", + "-Wl,-z,noexecstack", + "-m64", + "-fuse-ld=gold", + "-nostdlib", + "-shared", + "-Wl,-e,sgx_entry", + "-Wl,-Bstatic", + "-Wl,--gc-sections", + "-Wl,-z,text", + "-Wl,-z,norelro", + "-Wl,--rosegment", + "-Wl,--no-undefined", + "-Wl,--error-unresolved-symbols", + "-Wl,--no-undefined-version", + "-Wl,-Bsymbolic", + "-Wl,--export-dynamic", + ]; + + const EXPORT_SYMBOLS: &[&str] = &[ + "sgx_entry", + "HEAP_BASE", + "HEAP_SIZE", + "RELA", + "RELACOUNT", + "ENCLAVE_SIZE", + "CFGDATA_BASE", + "DEBUG", + "EH_FRM_HDR_BASE", + "EH_FRM_HDR_SIZE", + "TEXT_BASE", + "TEXT_SIZE", + ]; + let opts = TargetOptions { + dynamic_linking: false, + executables: true, + linker_is_gnu: true, + max_atomic_width: Some(64), + panic_strategy: PanicStrategy::Unwind, + cpu: "x86-64".into(), + features: "+rdrnd,+rdseed".into(), + position_independent_executables: true, + pre_link_args: iter::once(( + LinkerFlavor::Gcc, + PRE_LINK_ARGS.iter().cloned().map(String::from).collect(), + )) + .collect(), + post_link_objects: vec!["libunwind.a".into()], + override_export_symbols: Some(EXPORT_SYMBOLS.iter().cloned().map(String::from).collect()), + ..Default::default() + }; + Ok(Target { + llvm_target: "x86_64-unknown-linux-gnu".into(), + target_endian: "little".into(), + target_pointer_width: "64".into(), + target_c_int_width: "32".into(), + target_os: "unknown".into(), + target_env: "sgx".into(), + target_vendor: "fortanix".into(), + data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".into(), + arch: "x86_64".into(), + linker_flavor: LinkerFlavor::Gcc, + options: opts, + }) +} diff --git a/src/librustc_target/spec/x86_64_fuchsia.rs b/src/librustc_target/spec/x86_64_fuchsia.rs index 08df78d0db0..00fb7066ca2 100644 --- a/src/librustc_target/spec/x86_64_fuchsia.rs +++ b/src/librustc_target/spec/x86_64_fuchsia.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LldFlavor, LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_linux_android.rs b/src/librustc_target/spec/x86_64_linux_android.rs index ea67dc6bdef..29d5dfa5790 100644 --- a/src/librustc_target/spec/x86_64_linux_android.rs +++ b/src/librustc_target/spec/x86_64_linux_android.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_pc_windows_gnu.rs b/src/librustc_target/spec/x86_64_pc_windows_gnu.rs index 8d2f702bc4a..c3c36d22cef 100644 --- a/src/librustc_target/spec/x86_64_pc_windows_gnu.rs +++ b/src/librustc_target/spec/x86_64_pc_windows_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_pc_windows_msvc.rs b/src/librustc_target/spec/x86_64_pc_windows_msvc.rs index ab610ea94ae..178d67784e6 100644 --- a/src/librustc_target/spec/x86_64_pc_windows_msvc.rs +++ b/src/librustc_target/spec/x86_64_pc_windows_msvc.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_rumprun_netbsd.rs b/src/librustc_target/spec/x86_64_rumprun_netbsd.rs index e7570cd2da6..37c7925c698 100644 --- a/src/librustc_target/spec/x86_64_rumprun_netbsd.rs +++ b/src/librustc_target/spec/x86_64_rumprun_netbsd.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_sun_solaris.rs b/src/librustc_target/spec/x86_64_sun_solaris.rs index beb23dce062..3534f9e6436 100644 --- a/src/librustc_target/spec/x86_64_sun_solaris.rs +++ b/src/librustc_target/spec/x86_64_sun_solaris.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_bitrig.rs b/src/librustc_target/spec/x86_64_unknown_bitrig.rs index a98fc80716b..fa539217560 100644 --- a/src/librustc_target/spec/x86_64_unknown_bitrig.rs +++ b/src/librustc_target/spec/x86_64_unknown_bitrig.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_cloudabi.rs b/src/librustc_target/spec/x86_64_unknown_cloudabi.rs index 16df9000683..c1253a3b272 100644 --- a/src/librustc_target/spec/x86_64_unknown_cloudabi.rs +++ b/src/librustc_target/spec/x86_64_unknown_cloudabi.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_dragonfly.rs b/src/librustc_target/spec/x86_64_unknown_dragonfly.rs index 4c14a321feb..815aa572525 100644 --- a/src/librustc_target/spec/x86_64_unknown_dragonfly.rs +++ b/src/librustc_target/spec/x86_64_unknown_dragonfly.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_freebsd.rs b/src/librustc_target/spec/x86_64_unknown_freebsd.rs index 4515b330871..8d43883f33b 100644 --- a/src/librustc_target/spec/x86_64_unknown_freebsd.rs +++ b/src/librustc_target/spec/x86_64_unknown_freebsd.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_haiku.rs b/src/librustc_target/spec/x86_64_unknown_haiku.rs index 7e6b56866e4..608354732d9 100644 --- a/src/librustc_target/spec/x86_64_unknown_haiku.rs +++ b/src/librustc_target/spec/x86_64_unknown_haiku.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_hermit.rs b/src/librustc_target/spec/x86_64_unknown_hermit.rs index c879e94e6e6..de5992cbf5e 100644 --- a/src/librustc_target/spec/x86_64_unknown_hermit.rs +++ b/src/librustc_target/spec/x86_64_unknown_hermit.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_l4re_uclibc.rs b/src/librustc_target/spec/x86_64_unknown_l4re_uclibc.rs index f1179c18294..cf04cc1bdc2 100644 --- a/src/librustc_target/spec/x86_64_unknown_l4re_uclibc.rs +++ b/src/librustc_target/spec/x86_64_unknown_l4re_uclibc.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_linux_gnu.rs b/src/librustc_target/spec/x86_64_unknown_linux_gnu.rs index 56559661b03..c6ec8de5b73 100644 --- a/src/librustc_target/spec/x86_64_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/x86_64_unknown_linux_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_linux_gnux32.rs b/src/librustc_target/spec/x86_64_unknown_linux_gnux32.rs index fd61067ba51..e4dfb8d05cd 100644 --- a/src/librustc_target/spec/x86_64_unknown_linux_gnux32.rs +++ b/src/librustc_target/spec/x86_64_unknown_linux_gnux32.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_linux_musl.rs b/src/librustc_target/spec/x86_64_unknown_linux_musl.rs index f1924efcf98..95321fe2f78 100644 --- a/src/librustc_target/spec/x86_64_unknown_linux_musl.rs +++ b/src/librustc_target/spec/x86_64_unknown_linux_musl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_netbsd.rs b/src/librustc_target/spec/x86_64_unknown_netbsd.rs index de53c9e99ed..fbd07ecce1a 100644 --- a/src/librustc_target/spec/x86_64_unknown_netbsd.rs +++ b/src/librustc_target/spec/x86_64_unknown_netbsd.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_openbsd.rs b/src/librustc_target/spec/x86_64_unknown_openbsd.rs index de22c77d1e0..68496247b15 100644 --- a/src/librustc_target/spec/x86_64_unknown_openbsd.rs +++ b/src/librustc_target/spec/x86_64_unknown_openbsd.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_redox.rs b/src/librustc_target/spec/x86_64_unknown_redox.rs index 12a354b499e..d04bc5cc6ec 100644 --- a/src/librustc_target/spec/x86_64_unknown_redox.rs +++ b/src/librustc_target/spec/x86_64_unknown_redox.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spec::{LinkerFlavor, Target, TargetResult}; pub fn target() -> TargetResult { diff --git a/src/librustc_target/spec/x86_64_unknown_uefi.rs b/src/librustc_target/spec/x86_64_unknown_uefi.rs new file mode 100644 index 00000000000..0d7b4fc060b --- /dev/null +++ b/src/librustc_target/spec/x86_64_unknown_uefi.rs @@ -0,0 +1,48 @@ +// This defines the amd64 target for UEFI systems as described in the UEFI specification. See the +// uefi-base module for generic UEFI options. On x86_64 systems (mostly called "x64" in the spec) +// UEFI systems always run in long-mode, have the interrupt-controller pre-configured and force a +// single-CPU execution. +// The win64 ABI is used. It differs from the sysv64 ABI, so we must use a windows target with +// LLVM. "x86_64-unknown-windows" is used to get the minimal subset of windows-specific features. + +use spec::{LinkerFlavor, LldFlavor, Target, TargetResult}; + +pub fn target() -> TargetResult { + let mut base = super::uefi_base::opts(); + base.cpu = "x86-64".to_string(); + base.max_atomic_width = Some(64); + + // We disable MMX and SSE for now. UEFI does not prevent these from being used, but there have + // been reports to GRUB that some firmware does not initialize the FP exception handlers + // properly. Therefore, using FP coprocessors will end you up at random memory locations when + // you throw FP exceptions. + // To be safe, we disable them for now and force soft-float. This can be revisited when we + // have more test coverage. Disabling FP served GRUB well so far, so it should be good for us + // as well. + base.features = "-mmx,-sse,+soft-float".to_string(); + + // UEFI systems run without a host OS, hence we cannot assume any code locality. We must tell + // LLVM to expect code to reference any address in the address-space. The "large" code-model + // places no locality-restrictions, so it fits well here. + base.code_model = Some("large".to_string()); + + // UEFI mostly mirrors the calling-conventions used on windows. In case of x86-64 this means + // small structs will be returned as int. This shouldn't matter much, since the restrictions + // placed by the UEFI specifications forbid any ABI to return structures. + base.abi_return_struct_as_int = true; + + Ok(Target { + llvm_target: "x86_64-unknown-windows".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "64".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:w-i64:64-f80:128-n8:16:32:64-S128".to_string(), + target_os: "uefi".to_string(), + target_env: "".to_string(), + target_vendor: "unknown".to_string(), + arch: "x86_64".to_string(), + linker_flavor: LinkerFlavor::Lld(LldFlavor::Link), + + options: base, + }) +} diff --git a/src/librustc_traits/Cargo.toml b/src/librustc_traits/Cargo.toml index f057cbb5033..bf946d39806 100644 --- a/src/librustc_traits/Cargo.toml +++ b/src/librustc_traits/Cargo.toml @@ -17,5 +17,5 @@ rustc_data_structures = { path = "../librustc_data_structures" } rustc_target = { path = "../librustc_target" } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } -chalk-engine = { version = "0.8.0", default-features=false } -smallvec = { version = "0.6.5", features = ["union"] } +chalk-engine = { version = "0.9.0", default-features=false } +smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index 0fd9f607a54..303920b5842 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -1,40 +1,48 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod program_clauses; - -use chalk_engine::fallible::Fallible as ChalkEngineFallible; -use chalk_engine::{context, hh::HhGoal, DelayedLiteral, ExClause}; +mod resolvent_ops; +mod unify; + +use chalk_engine::fallible::Fallible; +use chalk_engine::{ + context, + hh::HhGoal, + DelayedLiteral, + Literal, + ExClause, +}; +use chalk_engine::forest::Forest; +use rustc::infer::{InferCtxt, LateBoundRegionConversionTime}; use rustc::infer::canonical::{ - Canonical, CanonicalVarValues, OriginalQueryValues, QueryRegionConstraint, QueryResponse, + Canonical, + CanonicalVarValues, + OriginalQueryValues, + QueryResponse, + Certainty, }; -use rustc::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime}; use rustc::traits::{ + self, DomainGoal, ExClauseFold, - ExClauseLift, + ChalkContextLift, Goal, GoalKind, Clause, QuantifierKind, Environment, InEnvironment, + ChalkCanonicalGoal, }; -use rustc::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; -use rustc::ty::subst::Kind; use rustc::ty::{self, TyCtxt}; +use rustc::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; +use rustc::ty::query::Providers; +use rustc::ty::subst::{Kind, UnpackedKind}; +use rustc_data_structures::sync::Lrc; +use syntax_pos::DUMMY_SP; use std::fmt::{self, Debug}; use std::marker::PhantomData; -use syntax_pos::DUMMY_SP; +use self::unify::*; #[derive(Copy, Clone, Debug)] crate struct ChalkArenas<'gcx> { @@ -44,7 +52,7 @@ crate struct ChalkArenas<'gcx> { #[derive(Copy, Clone)] crate struct ChalkContext<'cx, 'gcx: 'cx> { _arenas: ChalkArenas<'gcx>, - _tcx: TyCtxt<'cx, 'gcx, 'gcx>, + tcx: TyCtxt<'cx, 'gcx, 'gcx>, } #[derive(Copy, Clone)] @@ -55,10 +63,12 @@ crate struct ChalkInferenceContext<'cx, 'gcx: 'tcx, 'tcx: 'cx> { #[derive(Copy, Clone, Debug)] crate struct UniverseMap; +crate type RegionConstraint<'tcx> = ty::OutlivesPredicate, ty::Region<'tcx>>; + #[derive(Clone, Debug, PartialEq, Eq, Hash)] crate struct ConstrainedSubst<'tcx> { subst: CanonicalVarValues<'tcx>, - constraints: Vec>, + constraints: Vec>, } BraceStructTypeFoldableImpl! { @@ -68,7 +78,7 @@ BraceStructTypeFoldableImpl! { } impl context::Context for ChalkArenas<'tcx> { - type CanonicalExClause = Canonical<'tcx, ExClause>; + type CanonicalExClause = Canonical<'tcx, ChalkExClause<'tcx>>; type CanonicalGoalInEnvironment = Canonical<'tcx, InEnvironment<'tcx, Goal<'tcx>>>; @@ -86,7 +96,7 @@ impl context::Context for ChalkArenas<'tcx> { type GoalInEnvironment = InEnvironment<'tcx, Goal<'tcx>>; - type RegionConstraint = QueryRegionConstraint<'tcx>; + type RegionConstraint = RegionConstraint<'tcx>; type Substitution = CanonicalVarValues<'tcx>; @@ -104,7 +114,9 @@ impl context::Context for ChalkArenas<'tcx> { type ProgramClauses = Vec>; - type UnificationResult = InferOk<'tcx, ()>; + type UnificationResult = UnificationResult<'tcx>; + + type Variance = ty::Variance; fn goal_in_environment( env: &Environment<'tcx>, @@ -117,20 +129,77 @@ impl context::Context for ChalkArenas<'tcx> { impl context::AggregateOps> for ChalkContext<'cx, 'gcx> { fn make_solution( &self, - _root_goal: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>, - _simplified_answers: impl context::AnswerStream>, + root_goal: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>, + mut simplified_answers: impl context::AnswerStream>, ) -> Option>> { - unimplemented!() + use chalk_engine::SimplifiedAnswer; + + debug!("make_solution(root_goal = {:?})", root_goal); + + if simplified_answers.peek_answer().is_none() { + return None; + } + + let SimplifiedAnswer { subst: constrained_subst, ambiguous } = simplified_answers + .next_answer() + .unwrap(); + + debug!("make_solution: ambiguous flag = {}", ambiguous); + + let ambiguous = simplified_answers.peek_answer().is_some() || ambiguous; + + let solution = constrained_subst.unchecked_map(|cs| match ambiguous { + true => QueryResponse { + var_values: cs.subst.make_identity(self.tcx), + region_constraints: Vec::new(), + certainty: Certainty::Ambiguous, + value: (), + }, + + false => QueryResponse { + var_values: cs.subst, + region_constraints: Vec::new(), + + // FIXME: restore this later once we get better at handling regions + // region_constraints: cs.constraints + // .into_iter() + // .map(|c| ty::Binder::bind(c)) + // .collect(), + certainty: Certainty::Proven, + value: (), + }, + }); + + debug!("make_solution: solution = {:?}", solution); + + Some(solution) } } impl context::ContextOps> for ChalkContext<'cx, 'gcx> { - /// True if this is a coinductive goal -- e.g., proving an auto trait. + /// True if this is a coinductive goal: basically proving that an auto trait + /// is implemented or proving that a trait reference is well-formed. fn is_coinductive( &self, - _goal: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>> + goal: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>> ) -> bool { - unimplemented!() + use rustc::traits::{WellFormed, WhereClause}; + + let mut goal = goal.value.goal; + loop { + match goal { + GoalKind::DomainGoal(domain_goal) => match domain_goal { + DomainGoal::WellFormed(WellFormed::Trait(..)) => return true, + DomainGoal::Holds(WhereClause::Implemented(trait_predicate)) => { + return self.tcx.trait_is_auto(trait_predicate.def_id()); + } + _ => return false, + } + + GoalKind::Quantified(_, bound_goal) => goal = *bound_goal.skip_binder(), + _ => return false, + } + } } /// Create an inference table for processing a new goal and instantiate that goal @@ -147,19 +216,29 @@ impl context::ContextOps> for ChalkContext<'cx, 'gcx> { /// - the environment and goal found by substitution `S` into `arg` fn instantiate_ucanonical_goal( &self, - _arg: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>, - _op: impl context::WithInstantiatedUCanonicalGoal, Output = R>, + arg: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>, + op: impl context::WithInstantiatedUCanonicalGoal, Output = R>, ) -> R { - unimplemented!() + self.tcx.infer_ctxt().enter_with_canonical(DUMMY_SP, arg, |ref infcx, arg, subst| { + let chalk_infcx = &mut ChalkInferenceContext { + infcx, + }; + op.with(chalk_infcx, subst, arg.environment, arg.goal) + }) } fn instantiate_ex_clause( &self, _num_universes: usize, - _canonical_ex_clause: &Canonical<'gcx, ChalkExClause<'gcx>>, - _op: impl context::WithInstantiatedExClause, Output = R>, + arg: &Canonical<'gcx, ChalkExClause<'gcx>>, + op: impl context::WithInstantiatedExClause, Output = R>, ) -> R { - unimplemented!() + self.tcx.infer_ctxt().enter_with_canonical(DUMMY_SP, &arg.upcast(), |ref infcx, arg, _| { + let chalk_infcx = &mut ChalkInferenceContext { + infcx, + }; + op.with(chalk_infcx,arg) + }) } /// True if this solution has no region constraints. @@ -186,14 +265,33 @@ impl context::ContextOps> for ChalkContext<'cx, 'gcx> { } fn is_trivial_substitution( - _u_canon: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>, - _canonical_subst: &Canonical<'gcx, ConstrainedSubst<'gcx>>, + u_canon: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>, + canonical_subst: &Canonical<'gcx, ConstrainedSubst<'gcx>>, ) -> bool { - unimplemented!() - } - - fn num_universes(_: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>) -> usize { - 0 // FIXME + let subst = &canonical_subst.value.subst; + assert_eq!(u_canon.variables.len(), subst.var_values.len()); + subst.var_values + .iter_enumerated() + .all(|(cvar, kind)| match kind.unpack() { + UnpackedKind::Lifetime(r) => match r { + &ty::ReLateBound(debruijn, br) => { + debug_assert_eq!(debruijn, ty::INNERMOST); + cvar == br.assert_bound_var() + } + _ => false, + }, + UnpackedKind::Type(ty) => match ty.sty { + ty::Bound(debruijn, bound_ty) => { + debug_assert_eq!(debruijn, ty::INNERMOST); + cvar == bound_ty.var + } + _ => false, + }, + }) + } + + fn num_universes(canon: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>) -> usize { + canon.max_universe.index() + 1 } /// Convert a goal G *from* the canonical universes *into* our @@ -214,39 +312,6 @@ impl context::ContextOps> for ChalkContext<'cx, 'gcx> { } } -//impl context::UCanonicalGoalInEnvironment> -// for Canonical<'gcx, ty::ParamEnvAnd<'gcx, Goal<'gcx>>> -//{ -// fn canonical(&self) -> &Canonical<'gcx, ty::ParamEnvAnd<'gcx, Goal<'gcx>>> { -// self -// } -// -// fn is_trivial_substitution( -// &self, -// canonical_subst: &Canonical<'tcx, ConstrainedSubst<'tcx>>, -// ) -> bool { -// let subst = &canonical_subst.value.subst; -// assert_eq!(self.canonical.variables.len(), subst.var_values.len()); -// subst -// .var_values -// .iter_enumerated() -// .all(|(cvar, kind)| match kind.unpack() { -// Kind::Lifetime(r) => match r { -// ty::ReCanonical(cvar1) => cvar == cvar1, -// _ => false, -// }, -// Kind::Type(ty) => match ty.sty { -// ty::Infer(ty::InferTy::CanonicalTy(cvar1)) => cvar == cvar1, -// _ => false, -// }, -// }) -// } -// -// fn num_universes(&self) -> usize { -// 0 // FIXME -// } -//} - impl context::InferenceTable, ChalkArenas<'tcx>> for ChalkInferenceContext<'cx, 'gcx, 'tcx> { @@ -260,12 +325,20 @@ impl context::InferenceTable, ChalkArenas<'tcx>> fn into_hh_goal(&mut self, goal: Goal<'tcx>) -> ChalkHhGoal<'tcx> { match *goal { - GoalKind::Implies(..) => panic!("FIXME rust-lang-nursery/chalk#94"), + GoalKind::Implies(hypotheses, goal) => HhGoal::Implies( + hypotheses.iter().cloned().collect(), + goal + ), GoalKind::And(left, right) => HhGoal::And(left, right), GoalKind::Not(subgoal) => HhGoal::Not(subgoal), GoalKind::DomainGoal(d) => HhGoal::DomainGoal(d), GoalKind::Quantified(QuantifierKind::Universal, binder) => HhGoal::ForAll(binder), GoalKind::Quantified(QuantifierKind::Existential, binder) => HhGoal::Exists(binder), + GoalKind::Subtype(a, b) => HhGoal::Unify( + ty::Variance::Covariant, + a.into(), + b.into() + ), GoalKind::CannotProve => HhGoal::CannotProve, } } @@ -283,45 +356,21 @@ impl context::InferenceTable, ChalkArenas<'tcx>> } } -impl context::ResolventOps, ChalkArenas<'tcx>> - for ChalkInferenceContext<'cx, 'gcx, 'tcx> -{ - fn resolvent_clause( - &mut self, - _environment: &Environment<'tcx>, - _goal: &DomainGoal<'tcx>, - _subst: &CanonicalVarValues<'tcx>, - _clause: &Clause<'tcx>, - ) -> chalk_engine::fallible::Fallible>> { - panic!() - } - - fn apply_answer_subst( - &mut self, - _ex_clause: ChalkExClause<'tcx>, - _selected_goal: &InEnvironment<'tcx, Goal<'tcx>>, - _answer_table_goal: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>, - _canonical_answer_subst: &Canonical<'gcx, ConstrainedSubst<'gcx>>, - ) -> chalk_engine::fallible::Fallible> { - panic!() - } -} - impl context::TruncateOps, ChalkArenas<'tcx>> for ChalkInferenceContext<'cx, 'gcx, 'tcx> { fn truncate_goal( &mut self, - subgoal: &InEnvironment<'tcx, Goal<'tcx>>, + _subgoal: &InEnvironment<'tcx, Goal<'tcx>>, ) -> Option>> { - Some(*subgoal) // FIXME we should truncate at some point! + None // FIXME we should truncate at some point! } fn truncate_answer( &mut self, - subst: &CanonicalVarValues<'tcx>, + _subst: &CanonicalVarValues<'tcx>, ) -> Option> { - Some(subst.clone()) // FIXME we should truncate at some point! + None // FIXME we should truncate at some point! } } @@ -338,9 +387,9 @@ impl context::UnificationOps, ChalkArenas<'tcx>> fn instantiate_binders_universally( &mut self, - _arg: &ty::Binder>, + arg: &ty::Binder>, ) -> Goal<'tcx> { - panic!("FIXME -- universal instantiation needs sgrif's branch") + self.infcx.replace_bound_vars_with_placeholders(arg).0 } fn instantiate_binders_existentially( @@ -377,7 +426,7 @@ impl context::UnificationOps, ChalkArenas<'tcx>> fn canonicalize_constrained_subst( &mut self, subst: CanonicalVarValues<'tcx>, - constraints: Vec>, + constraints: Vec>, ) -> Canonical<'gcx, ConstrainedSubst<'gcx>> { self.infcx.canonicalize_response(&ConstrainedSubst { subst, constraints }) } @@ -401,11 +450,15 @@ impl context::UnificationOps, ChalkArenas<'tcx>> fn unify_parameters( &mut self, - _environment: &Environment<'tcx>, - _a: &Kind<'tcx>, - _b: &Kind<'tcx>, - ) -> ChalkEngineFallible> { - panic!() + environment: &Environment<'tcx>, + variance: ty::Variance, + a: &Kind<'tcx>, + b: &Kind<'tcx>, + ) -> Fallible> { + self.infcx.commit_if_ok(|_| { + unify(self.infcx, *environment, variance, a, b) + .map_err(|_| chalk_engine::fallible::NoSolution) + }) } fn sink_answer_subset( @@ -417,16 +470,33 @@ impl context::UnificationOps, ChalkArenas<'tcx>> fn lift_delayed_literal( &self, - _value: DelayedLiteral>, + value: DelayedLiteral>, ) -> DelayedLiteral> { - panic!("lift") + match self.infcx.tcx.lift_to_global(&value) { + Some(literal) => literal, + None => bug!("cannot lift {:?}", value), + } } - fn into_ex_clause(&mut self, _result: InferOk<'tcx, ()>, _ex_clause: &mut ChalkExClause<'tcx>) { - panic!("TBD") + fn into_ex_clause( + &mut self, + result: UnificationResult<'tcx>, + ex_clause: &mut ChalkExClause<'tcx> + ) { + into_ex_clause(result, ex_clause); } } +crate fn into_ex_clause(result: UnificationResult<'tcx>, ex_clause: &mut ChalkExClause<'tcx>) { + ex_clause.subgoals.extend( + result.goals.into_iter().map(Literal::Positive) + ); + + // FIXME: restore this later once we get better at handling regions + let _ = result.constraints.len(); // trick `-D dead-code` + // ex_clause.constraints.extend(result.constraints); +} + type ChalkHhGoal<'tcx> = HhGoal>; type ChalkExClause<'tcx> = ExClause>; @@ -443,14 +513,45 @@ impl Debug for ChalkInferenceContext<'cx, 'gcx, 'tcx> { } } -impl ExClauseLift<'gcx> for ChalkArenas<'a> { - type LiftedExClause = ChalkExClause<'gcx>; +impl ChalkContextLift<'tcx> for ChalkArenas<'a> { + type LiftedExClause = ChalkExClause<'tcx>; + type LiftedDelayedLiteral = DelayedLiteral>; + type LiftedLiteral = Literal>; fn lift_ex_clause_to_tcx( - _ex_clause: &ChalkExClause<'a>, - _tcx: TyCtxt<'_, '_, 'tcx>, + ex_clause: &ChalkExClause<'a>, + tcx: TyCtxt<'_, 'gcx, 'tcx> ) -> Option { - panic!() + Some(ChalkExClause { + subst: tcx.lift(&ex_clause.subst)?, + delayed_literals: tcx.lift(&ex_clause.delayed_literals)?, + constraints: tcx.lift(&ex_clause.constraints)?, + subgoals: tcx.lift(&ex_clause.subgoals)?, + }) + } + + fn lift_delayed_literal_to_tcx( + literal: &DelayedLiteral>, + tcx: TyCtxt<'_, 'gcx, 'tcx> + ) -> Option { + Some(match literal { + DelayedLiteral::CannotProve(()) => DelayedLiteral::CannotProve(()), + DelayedLiteral::Negative(index) => DelayedLiteral::Negative(*index), + DelayedLiteral::Positive(index, subst) => DelayedLiteral::Positive( + *index, + tcx.lift(subst)? + ) + }) + } + + fn lift_literal_to_tcx( + literal: &Literal>, + tcx: TyCtxt<'_, 'gcx, 'tcx>, + ) -> Option { + Some(match literal { + Literal::Negative(goal) => Literal::Negative(tcx.lift(goal)?), + Literal::Positive(goal) => Literal::Positive(tcx.lift(goal)?), + }) } } @@ -478,9 +579,9 @@ impl ExClauseFold<'tcx> for ChalkArenas<'tcx> { subgoals, } = ex_clause; subst.visit_with(visitor) - && delayed_literals.visit_with(visitor) - && constraints.visit_with(visitor) - && subgoals.visit_with(visitor) + || delayed_literals.visit_with(visitor) + || constraints.visit_with(visitor) + || subgoals.visit_with(visitor) } } @@ -491,3 +592,124 @@ BraceStructLiftImpl! { subst, constraints } } + +trait Upcast<'tcx, 'gcx: 'tcx>: 'gcx { + type Upcasted: 'tcx; + + fn upcast(&self) -> Self::Upcasted; +} + +impl<'tcx, 'gcx: 'tcx> Upcast<'tcx, 'gcx> for DelayedLiteral> { + type Upcasted = DelayedLiteral>; + + fn upcast(&self) -> Self::Upcasted { + match self { + &DelayedLiteral::CannotProve(..) => DelayedLiteral::CannotProve(()), + &DelayedLiteral::Negative(index) => DelayedLiteral::Negative(index), + DelayedLiteral::Positive(index, subst) => DelayedLiteral::Positive( + *index, + subst.clone() + ), + } + } +} + +impl<'tcx, 'gcx: 'tcx> Upcast<'tcx, 'gcx> for Literal> { + type Upcasted = Literal>; + + fn upcast(&self) -> Self::Upcasted { + match self { + &Literal::Negative(goal) => Literal::Negative(goal), + &Literal::Positive(goal) => Literal::Positive(goal), + } + } +} + +impl<'tcx, 'gcx: 'tcx> Upcast<'tcx, 'gcx> for ExClause> { + type Upcasted = ExClause>; + + fn upcast(&self) -> Self::Upcasted { + ExClause { + subst: self.subst.clone(), + delayed_literals: self.delayed_literals + .iter() + .map(|l| l.upcast()) + .collect(), + constraints: self.constraints.clone(), + subgoals: self.subgoals + .iter() + .map(|g| g.upcast()) + .collect(), + } + } +} + +impl<'tcx, 'gcx: 'tcx, T> Upcast<'tcx, 'gcx> for Canonical<'gcx, T> + where T: Upcast<'tcx, 'gcx> +{ + type Upcasted = Canonical<'tcx, T::Upcasted>; + + fn upcast(&self) -> Self::Upcasted { + Canonical { + max_universe: self.max_universe, + value: self.value.upcast(), + variables: self.variables, + } + } +} + +crate fn provide(p: &mut Providers) { + *p = Providers { + evaluate_goal, + ..*p + }; +} + +crate fn evaluate_goal<'a, 'tcx>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + goal: ChalkCanonicalGoal<'tcx> +) -> Result< + Lrc>>, + traits::query::NoSolution +> { + use crate::lowering::Lower; + use rustc::traits::WellFormed; + + let goal = goal.unchecked_map(|goal| InEnvironment { + environment: goal.environment, + goal: match goal.goal { + ty::Predicate::WellFormed(ty) => tcx.mk_goal( + GoalKind::DomainGoal(DomainGoal::WellFormed(WellFormed::Ty(ty))) + ), + + ty::Predicate::Subtype(predicate) => tcx.mk_goal( + GoalKind::Quantified( + QuantifierKind::Universal, + predicate.map_bound(|pred| tcx.mk_goal(GoalKind::Subtype(pred.a, pred.b))) + ) + ), + + other => tcx.mk_goal( + GoalKind::from_poly_domain_goal(other.lower(), tcx) + ), + }, + }); + + + debug!("evaluate_goal(goal = {:?})", goal); + + let context = ChalkContext { + _arenas: ChalkArenas { + _phantom: PhantomData, + }, + tcx, + }; + + let mut forest = Forest::new(context); + let solution = forest.solve(&goal); + + debug!("evaluate_goal: solution = {:?}", solution); + + solution.map(|ok| Ok(Lrc::new(ok))) + .unwrap_or(Err(traits::query::NoSolution)) +} diff --git a/src/librustc_traits/chalk_context/program_clauses.rs b/src/librustc_traits/chalk_context/program_clauses.rs index 31f97b72e19..71f4945fd64 100644 --- a/src/librustc_traits/chalk_context/program_clauses.rs +++ b/src/librustc_traits/chalk_context/program_clauses.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::traits::{ WellFormed, FromEnv, @@ -20,11 +10,13 @@ use rustc::traits::{ Environment, }; use rustc::ty; +use rustc::ty::subst::{Substs, Subst}; use rustc::hir; use rustc::hir::def_id::DefId; use rustc_target::spec::abi; use super::ChalkInferenceContext; use crate::lowering::Lower; +use crate::generic_types; use std::iter; fn assemble_clauses_from_impls<'tcx>( @@ -57,49 +49,152 @@ fn assemble_clauses_from_assoc_ty_values<'tcx>( }); } -fn program_clauses_for_raw_ptr<'tcx>(tcx: ty::TyCtxt<'_, '_, 'tcx>) -> Clauses<'tcx> { - let ty = ty::Bound( - ty::BoundTy::new(ty::INNERMOST, ty::BoundVar::from_u32(0)) - ); - let ty = tcx.mk_ty(ty); +fn assemble_builtin_sized_impls<'tcx>( + tcx: ty::TyCtxt<'_, '_, 'tcx>, + sized_def_id: DefId, + ty: ty::Ty<'tcx>, + clauses: &mut Vec> +) { + let mut push_builtin_impl = |ty: ty::Ty<'tcx>, nested: &[ty::Ty<'tcx>]| { + let clause = ProgramClause { + goal: ty::TraitPredicate { + trait_ref: ty::TraitRef { + def_id: sized_def_id, + substs: tcx.mk_substs_trait(ty, &[]), + }, + }.lower(), + hypotheses: tcx.mk_goals( + nested.iter() + .cloned() + .map(|nested_ty| ty::TraitRef { + def_id: sized_def_id, + substs: tcx.mk_substs_trait(nested_ty, &[]), + }) + .map(|trait_ref| ty::TraitPredicate { trait_ref }) + .map(|pred| GoalKind::DomainGoal(pred.lower())) + .map(|goal_kind| tcx.mk_goal(goal_kind)) + ), + category: ProgramClauseCategory::Other, + }; + // Bind innermost bound vars that may exist in `ty` and `nested`. + clauses.push(Clause::ForAll(ty::Binder::bind(clause))); + }; - let ptr_ty = tcx.mk_ptr(ty::TypeAndMut { - ty, - mutbl: hir::Mutability::MutImmutable, - }); + match &ty.sty { + // Non parametric primitive types. + ty::Bool | + ty::Char | + ty::Int(..) | + ty::Uint(..) | + ty::Float(..) | + ty::Error | + ty::Never => push_builtin_impl(ty, &[]), + + // These ones are always `Sized`. + &ty::Array(_, length) => { + push_builtin_impl(tcx.mk_ty(ty::Array(generic_types::bound(tcx, 0), length)), &[]); + } + ty::RawPtr(ptr) => { + push_builtin_impl(generic_types::raw_ptr(tcx, ptr.mutbl), &[]); + } + &ty::Ref(_, _, mutbl) => { + push_builtin_impl(generic_types::ref_ty(tcx, mutbl), &[]); + } + ty::FnPtr(fn_ptr) => { + let fn_ptr = fn_ptr.skip_binder(); + let fn_ptr = generic_types::fn_ptr( + tcx, + fn_ptr.inputs_and_output.len(), + fn_ptr.variadic, + fn_ptr.unsafety, + fn_ptr.abi + ); + push_builtin_impl(fn_ptr, &[]); + } + &ty::FnDef(def_id, ..) => { + push_builtin_impl(generic_types::fn_def(tcx, def_id), &[]); + } + &ty::Closure(def_id, ..) => { + push_builtin_impl(generic_types::closure(tcx, def_id), &[]); + } + &ty::Generator(def_id, ..) => { + push_builtin_impl(generic_types::generator(tcx, def_id), &[]); + } + + // `Sized` if the last type is `Sized` (because else we will get a WF error anyway). + &ty::Tuple(type_list) => { + let type_list = generic_types::type_list(tcx, type_list.len()); + push_builtin_impl(tcx.mk_ty(ty::Tuple(type_list)), &**type_list); + } + + // Struct def + ty::Adt(adt_def, _) => { + let substs = Substs::bound_vars_for_item(tcx, adt_def.did); + let adt = tcx.mk_ty(ty::Adt(adt_def, substs)); + let sized_constraint = adt_def.sized_constraint(tcx) + .iter() + .map(|ty| ty.subst(tcx, substs)) + .collect::>(); + push_builtin_impl(adt, &sized_constraint); + } + + // Artificially trigger an ambiguity. + ty::Infer(..) => { + // Everybody can find at least two types to unify against: + // general ty vars, int vars and float vars. + push_builtin_impl(tcx.types.i32, &[]); + push_builtin_impl(tcx.types.u32, &[]); + push_builtin_impl(tcx.types.f32, &[]); + push_builtin_impl(tcx.types.f64, &[]); + } + + ty::Projection(_projection_ty) => { + // FIXME: add builtin impls from the associated type values found in + // trait impls of `projection_ty.trait_ref(tcx)`. + } + + // The `Sized` bound can only come from the environment. + ty::Param(..) | + ty::Placeholder(..) | + ty::UnnormalizedProjection(..) => (), + + // Definitely not `Sized`. + ty::Foreign(..) | + ty::Str | + ty::Slice(..) | + ty::Dynamic(..) | + ty::Opaque(..) => (), + + ty::Bound(..) | + ty::GeneratorWitness(..) => bug!("unexpected type {:?}", ty), + } +} + +fn wf_clause_for_raw_ptr<'tcx>( + tcx: ty::TyCtxt<'_, '_, 'tcx>, + mutbl: hir::Mutability +) -> Clauses<'tcx> { + let ptr_ty = generic_types::raw_ptr(tcx, mutbl); let wf_clause = ProgramClause { goal: DomainGoal::WellFormed(WellFormed::Ty(ptr_ty)), hypotheses: ty::List::empty(), category: ProgramClauseCategory::WellFormed, }; - let wf_clause = Clause::ForAll(ty::Binder::bind(wf_clause)); + let wf_clause = Clause::Implies(wf_clause); // `forall { WellFormed(*const T). }` tcx.mk_clauses(iter::once(wf_clause)) } -fn program_clauses_for_fn_ptr<'tcx>( +fn wf_clause_for_fn_ptr<'tcx>( tcx: ty::TyCtxt<'_, '_, 'tcx>, arity_and_output: usize, variadic: bool, unsafety: hir::Unsafety, abi: abi::Abi ) -> Clauses<'tcx> { - let inputs_and_output = tcx.mk_type_list( - (0..arity_and_output).into_iter() - // DebruijnIndex(1) because we are going to inject these in a `PolyFnSig` - .map(|i| ty::BoundTy::new(ty::DebruijnIndex::from(1usize), ty::BoundVar::from(i))) - .map(|t| tcx.mk_ty(ty::Bound(t))) - ); - - let fn_sig = ty::Binder::bind(ty::FnSig { - inputs_and_output, - variadic, - unsafety, - abi, - }); - let fn_ptr = tcx.mk_fn_ptr(fn_sig); + let fn_ptr = generic_types::fn_ptr(tcx, arity_and_output, variadic, unsafety, abi); let wf_clause = ProgramClause { goal: DomainGoal::WellFormed(WellFormed::Ty(fn_ptr)), @@ -113,12 +208,8 @@ fn program_clauses_for_fn_ptr<'tcx>( tcx.mk_clauses(iter::once(wf_clause)) } -fn program_clauses_for_slice<'tcx>(tcx: ty::TyCtxt<'_, '_, 'tcx>) -> Clauses<'tcx> { - let ty = ty::Bound( - ty::BoundTy::new(ty::INNERMOST, ty::BoundVar::from_u32(0)) - ); - let ty = tcx.mk_ty(ty); - +fn wf_clause_for_slice<'tcx>(tcx: ty::TyCtxt<'_, '_, 'tcx>) -> Clauses<'tcx> { + let ty = generic_types::bound(tcx, 0); let slice_ty = tcx.mk_slice(ty); let sized_trait = match tcx.lang_items().sized_trait() { @@ -146,15 +237,11 @@ fn program_clauses_for_slice<'tcx>(tcx: ty::TyCtxt<'_, '_, 'tcx>) -> Clauses<'tc tcx.mk_clauses(iter::once(wf_clause)) } -fn program_clauses_for_array<'tcx>( +fn wf_clause_for_array<'tcx>( tcx: ty::TyCtxt<'_, '_, 'tcx>, - length: &'tcx ty::Const<'tcx> + length: &'tcx ty::LazyConst<'tcx> ) -> Clauses<'tcx> { - let ty = ty::Bound( - ty::BoundTy::new(ty::INNERMOST, ty::BoundVar::from_u32(0)) - ); - let ty = tcx.mk_ty(ty); - + let ty = generic_types::bound(tcx, 0); let array_ty = tcx.mk_ty(ty::Array(ty, length)); let sized_trait = match tcx.lang_items().sized_trait() { @@ -182,23 +269,21 @@ fn program_clauses_for_array<'tcx>( tcx.mk_clauses(iter::once(wf_clause)) } -fn program_clauses_for_tuple<'tcx>( +fn wf_clause_for_tuple<'tcx>( tcx: ty::TyCtxt<'_, '_, 'tcx>, arity: usize ) -> Clauses<'tcx> { - let type_list = tcx.mk_type_list( - (0..arity).into_iter() - .map(|i| ty::BoundTy::new(ty::INNERMOST, ty::BoundVar::from(i))) - .map(|t| tcx.mk_ty(ty::Bound(t))) - ); - + let type_list = generic_types::type_list(tcx, arity); let tuple_ty = tcx.mk_ty(ty::Tuple(type_list)); let sized_trait = match tcx.lang_items().sized_trait() { Some(def_id) => def_id, None => return ty::List::empty(), }; - let sized_implemented = type_list[0..arity - 1].iter() + + // If `arity == 0` (i.e. the unit type) or `arity == 1`, this list of + // hypotheses is actually empty. + let sized_implemented = type_list[0 .. std::cmp::max(arity, 1) - 1].iter() .map(|ty| ty::TraitRef { def_id: sized_trait, substs: tcx.mk_substs_trait(*ty, ty::List::empty()), @@ -228,26 +313,29 @@ fn program_clauses_for_tuple<'tcx>( tcx.mk_clauses(iter::once(wf_clause)) } -fn program_clauses_for_ref<'tcx>(tcx: ty::TyCtxt<'_, '_, 'tcx>) -> Clauses<'tcx> { +fn wf_clause_for_ref<'tcx>( + tcx: ty::TyCtxt<'_, '_, 'tcx>, + mutbl: hir::Mutability +) -> Clauses<'tcx> { let region = tcx.mk_region( ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(0)) ); - let ty = tcx.mk_ty( - ty::Bound(ty::BoundTy::new(ty::INNERMOST, ty::BoundVar::from_u32(1))) - ); - + let ty = generic_types::bound(tcx, 1); let ref_ty = tcx.mk_ref(region, ty::TypeAndMut { ty, - mutbl: hir::Mutability::MutImmutable, + mutbl, }); - let outlives: DomainGoal = ty::OutlivesPredicate(ty, region).lower(); + let _outlives: DomainGoal = ty::OutlivesPredicate(ty, region).lower(); let wf_clause = ProgramClause { goal: DomainGoal::WellFormed(WellFormed::Ty(ref_ty)), - hypotheses: tcx.mk_goals( - iter::once(tcx.mk_goal(outlives.into_goal())) - ), - category: ProgramClauseCategory::ImpliedBound, + hypotheses: ty::List::empty(), + + // FIXME: restore this later once we get better at handling regions + // hypotheses: tcx.mk_goals( + // iter::once(tcx.mk_goal(outlives.into_goal())) + // ), + category: ProgramClauseCategory::WellFormed, }; let wf_clause = Clause::ForAll(ty::Binder::bind(wf_clause)); @@ -255,6 +343,24 @@ fn program_clauses_for_ref<'tcx>(tcx: ty::TyCtxt<'_, '_, 'tcx>) -> Clauses<'tcx> tcx.mk_clauses(iter::once(wf_clause)) } +fn wf_clause_for_fn_def<'tcx>( + tcx: ty::TyCtxt<'_, '_, 'tcx>, + def_id: DefId +) -> Clauses<'tcx> { + let fn_def = generic_types::fn_def(tcx, def_id); + + let wf_clause = ProgramClause { + goal: DomainGoal::WellFormed(WellFormed::Ty(fn_def)), + hypotheses: ty::List::empty(), + category: ProgramClauseCategory::WellFormed, + }; + let wf_clause = Clause::ForAll(ty::Binder::bind(wf_clause)); + + // `forall { WellFormed(fn some_fn(T1, ..., Tn) -> Tn+1). }` + // where `def_id` maps to the `some_fn` function definition + tcx.mk_clauses(iter::once(wf_clause)) +} + impl ChalkInferenceContext<'cx, 'gcx, 'tcx> { pub(super) fn program_clauses_impl( &self, @@ -262,6 +368,11 @@ impl ChalkInferenceContext<'cx, 'gcx, 'tcx> { goal: &DomainGoal<'tcx>, ) -> Vec> { use rustc::traits::WhereClause::*; + use rustc::infer::canonical::OriginalQueryValues; + + let goal = self.infcx.resolve_type_vars_if_possible(goal); + + debug!("program_clauses(goal = {:?})", goal); let mut clauses = match goal { DomainGoal::Holds(Implemented(trait_predicate)) => { @@ -270,12 +381,22 @@ impl ChalkInferenceContext<'cx, 'gcx, 'tcx> { // * the trait decl (rule `Implemented-From-Env`) let mut clauses = vec![]; + assemble_clauses_from_impls( self.infcx.tcx, trait_predicate.def_id(), &mut clauses ); + if Some(trait_predicate.def_id()) == self.infcx.tcx.lang_items().sized_trait() { + assemble_builtin_sized_impls( + self.infcx.tcx, + trait_predicate.def_id(), + trait_predicate.self_ty(), + &mut clauses + ); + } + // FIXME: we need to add special rules for builtin impls: // * `Copy` / `Clone` // * `Sized` @@ -352,31 +473,34 @@ impl ChalkInferenceContext<'cx, 'gcx, 'tcx> { self.infcx.tcx.program_clauses_for(data.item_def_id) } - // These types are always WF and non-parametric. + // These types are always WF. ty::Bool | ty::Char | ty::Int(..) | ty::Uint(..) | ty::Float(..) | ty::Str | + ty::Param(..) | + ty::Placeholder(..) | + ty::Error | ty::Never => { let wf_clause = ProgramClause { goal: DomainGoal::WellFormed(WellFormed::Ty(ty)), hypotheses: ty::List::empty(), category: ProgramClauseCategory::WellFormed, }; - let wf_clause = Clause::ForAll(ty::Binder::dummy(wf_clause)); + let wf_clause = Clause::Implies(wf_clause); self.infcx.tcx.mk_clauses(iter::once(wf_clause)) } // Always WF (recall that we do not check for parameters to be WF). - ty::RawPtr(..) => program_clauses_for_raw_ptr(self.infcx.tcx), + ty::RawPtr(ptr) => wf_clause_for_raw_ptr(self.infcx.tcx, ptr.mutbl), // Always WF (recall that we do not check for parameters to be WF). ty::FnPtr(fn_ptr) => { let fn_ptr = fn_ptr.skip_binder(); - program_clauses_for_fn_ptr( + wf_clause_for_fn_ptr( self.infcx.tcx, fn_ptr.inputs_and_output.len(), fn_ptr.variadic, @@ -386,19 +510,21 @@ impl ChalkInferenceContext<'cx, 'gcx, 'tcx> { } // WF if inner type is `Sized`. - ty::Slice(..) => program_clauses_for_slice(self.infcx.tcx), + ty::Slice(..) => wf_clause_for_slice(self.infcx.tcx), // WF if inner type is `Sized`. - ty::Array(_, length) => program_clauses_for_array(self.infcx.tcx, length), + ty::Array(_, length) => wf_clause_for_array(self.infcx.tcx, length), // WF if all types but the last one are `Sized`. - ty::Tuple(types) => program_clauses_for_tuple( + ty::Tuple(types) => wf_clause_for_tuple( self.infcx.tcx, types.len() ), // WF if `sub_ty` outlives `region`. - ty::Ref(..) => program_clauses_for_ref(self.infcx.tcx), + ty::Ref(_, _, mutbl) => wf_clause_for_ref(self.infcx.tcx, mutbl), + + ty::FnDef(def_id, ..) => wf_clause_for_fn_def(self.infcx.tcx, def_id), ty::Dynamic(..) => { // FIXME: no rules yet for trait objects @@ -409,20 +535,32 @@ impl ChalkInferenceContext<'cx, 'gcx, 'tcx> { self.infcx.tcx.program_clauses_for(def.did) } + // FIXME: these are probably wrong ty::Foreign(def_id) | - ty::FnDef(def_id, ..) | ty::Closure(def_id, ..) | ty::Generator(def_id, ..) | ty::Opaque(def_id, ..) => { self.infcx.tcx.program_clauses_for(def_id) } + // Artificially trigger an ambiguity. + ty::Infer(..) => { + let tcx = self.infcx.tcx; + let types = [tcx.types.i32, tcx.types.u32, tcx.types.f32, tcx.types.f64]; + let clauses = types.iter() + .cloned() + .map(|ty| ProgramClause { + goal: DomainGoal::WellFormed(WellFormed::Ty(ty)), + hypotheses: ty::List::empty(), + category: ProgramClauseCategory::WellFormed, + }) + .map(|clause| Clause::Implies(clause)); + tcx.mk_clauses(clauses) + } + ty::GeneratorWitness(..) | ty::UnnormalizedProjection(..) | - ty::Infer(..) | - ty::Bound(..) | - ty::Param(..) | - ty::Error => { + ty::Bound(..) => { bug!("unexpected type {:?}", ty) } }; @@ -464,13 +602,20 @@ impl ChalkInferenceContext<'cx, 'gcx, 'tcx> { } }; - let environment = self.infcx.tcx.lift_to_global(environment) - .expect("environment is not global"); - clauses.extend( - self.infcx.tcx.program_clauses_for_env(environment) - .into_iter() - .cloned() - ); + debug!("program_clauses: clauses = {:?}", clauses); + debug!("program_clauses: adding clauses from environment = {:?}", environment); + + let mut _orig_query_values = OriginalQueryValues::default(); + let canonical_environment = self.infcx.canonicalize_query( + environment, + &mut _orig_query_values + ).value; + let env_clauses = self.infcx.tcx.program_clauses_for_env(canonical_environment); + + debug!("program_clauses: env_clauses = {:?}", env_clauses); + + clauses.extend(env_clauses.into_iter().cloned()); + clauses.extend(environment.clauses.iter().cloned()); clauses } } diff --git a/src/librustc_traits/chalk_context/resolvent_ops.rs b/src/librustc_traits/chalk_context/resolvent_ops.rs new file mode 100644 index 00000000000..932501cc04f --- /dev/null +++ b/src/librustc_traits/chalk_context/resolvent_ops.rs @@ -0,0 +1,262 @@ +use chalk_engine::fallible::{Fallible, NoSolution}; +use chalk_engine::{ + context, + Literal, + ExClause +}; +use rustc::infer::{InferCtxt, LateBoundRegionConversionTime}; +use rustc::infer::canonical::{Canonical, CanonicalVarValues}; +use rustc::traits::{ + DomainGoal, + Goal, + GoalKind, + Clause, + ProgramClause, + Environment, + InEnvironment, +}; +use rustc::ty::{self, Ty}; +use rustc::ty::subst::Kind; +use rustc::ty::relate::{Relate, RelateResult, TypeRelation}; +use syntax_pos::DUMMY_SP; + +use super::{ChalkInferenceContext, ChalkArenas, ChalkExClause, ConstrainedSubst}; +use super::unify::*; + +impl context::ResolventOps, ChalkArenas<'tcx>> + for ChalkInferenceContext<'cx, 'gcx, 'tcx> +{ + fn resolvent_clause( + &mut self, + environment: &Environment<'tcx>, + goal: &DomainGoal<'tcx>, + subst: &CanonicalVarValues<'tcx>, + clause: &Clause<'tcx>, + ) -> Fallible>> { + use chalk_engine::context::UnificationOps; + + debug!("resolvent_clause(goal = {:?}, clause = {:?})", goal, clause); + + let result = self.infcx.probe(|_| { + let ProgramClause { + goal: consequence, + hypotheses, + .. + } = match clause { + Clause::Implies(program_clause) => *program_clause, + Clause::ForAll(program_clause) => self.infcx.replace_bound_vars_with_fresh_vars( + DUMMY_SP, + LateBoundRegionConversionTime::HigherRankedType, + program_clause + ).0, + }; + + let result = unify( + self.infcx, + *environment, + ty::Variance::Invariant, + goal, + &consequence + ).map_err(|_| NoSolution)?; + + let mut ex_clause = ExClause { + subst: subst.clone(), + delayed_literals: vec![], + constraints: vec![], + subgoals: vec![], + }; + + self.into_ex_clause(result, &mut ex_clause); + + ex_clause.subgoals.extend( + hypotheses.iter().map(|g| match g { + GoalKind::Not(g) => Literal::Negative(environment.with(*g)), + g => Literal::Positive(environment.with(*g)), + }) + ); + + let canonical_ex_clause = self.canonicalize_ex_clause(&ex_clause); + Ok(canonical_ex_clause) + }); + + debug!("resolvent_clause: result = {:?}", result); + result + } + + fn apply_answer_subst( + &mut self, + ex_clause: ChalkExClause<'tcx>, + selected_goal: &InEnvironment<'tcx, Goal<'tcx>>, + answer_table_goal: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>, + canonical_answer_subst: &Canonical<'gcx, ConstrainedSubst<'gcx>>, + ) -> Fallible> { + debug!( + "apply_answer_subst(ex_clause = {:?}, selected_goal = {:?})", + self.infcx.resolve_type_vars_if_possible(&ex_clause), + self.infcx.resolve_type_vars_if_possible(selected_goal) + ); + + let (answer_subst, _) = self.infcx.instantiate_canonical_with_fresh_inference_vars( + DUMMY_SP, + canonical_answer_subst + ); + + let mut substitutor = AnswerSubstitutor { + infcx: self.infcx, + environment: selected_goal.environment, + answer_subst: answer_subst.subst, + binder_index: ty::INNERMOST, + ex_clause, + }; + + substitutor.relate(&answer_table_goal.value, &selected_goal) + .map_err(|_| NoSolution)?; + + let ex_clause = substitutor.ex_clause; + + // FIXME: restore this later once we get better at handling regions + // ex_clause.constraints.extend(answer_subst.constraints); + + debug!("apply_answer_subst: ex_clause = {:?}", ex_clause); + Ok(ex_clause) + } +} + +struct AnswerSubstitutor<'cx, 'gcx: 'tcx, 'tcx: 'cx> { + infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>, + environment: Environment<'tcx>, + answer_subst: CanonicalVarValues<'tcx>, + binder_index: ty::DebruijnIndex, + ex_clause: ChalkExClause<'tcx>, +} + +impl AnswerSubstitutor<'cx, 'gcx, 'tcx> { + fn unify_free_answer_var( + &mut self, + answer_var: ty::BoundVar, + pending: Kind<'tcx> + ) -> RelateResult<'tcx, ()> { + let answer_param = &self.answer_subst.var_values[answer_var]; + let pending = &ty::fold::shift_out_vars( + self.infcx.tcx, + &pending, + self.binder_index.as_u32() + ); + + super::into_ex_clause( + unify(self.infcx, self.environment, ty::Variance::Invariant, answer_param, pending)?, + &mut self.ex_clause + ); + + Ok(()) + } +} + +impl TypeRelation<'cx, 'gcx, 'tcx> for AnswerSubstitutor<'cx, 'gcx, 'tcx> { + fn tcx(&self) -> ty::TyCtxt<'cx, 'gcx, 'tcx> { + self.infcx.tcx + } + + fn tag(&self) -> &'static str { + "chalk_context::answer_substitutor" + } + + fn a_is_expected(&self) -> bool { + true + } + + fn relate_with_variance>( + &mut self, + _variance: ty::Variance, + a: &T, + b: &T, + ) -> RelateResult<'tcx, T> { + // We don't care about variance. + self.relate(a, b) + } + + fn binders>( + &mut self, + a: &ty::Binder, + b: &ty::Binder, + ) -> RelateResult<'tcx, ty::Binder> { + self.binder_index.shift_in(1); + let result = self.relate(a.skip_binder(), b.skip_binder())?; + self.binder_index.shift_out(1); + Ok(ty::Binder::bind(result)) + } + + fn tys(&mut self, a: Ty<'tcx>, b: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { + let b = self.infcx.shallow_resolve(b); + debug!("AnswerSubstitutor::tys(a = {:?}, b = {:?})", a, b); + + if let &ty::Bound(debruijn, bound_ty) = &a.sty { + // Free bound var + if debruijn == self.binder_index { + self.unify_free_answer_var(bound_ty.var, b.into())?; + return Ok(b); + } + } + + match (&a.sty, &b.sty) { + (&ty::Bound(a_debruijn, a_bound), &ty::Bound(b_debruijn, b_bound)) => { + assert_eq!(a_debruijn, b_debruijn); + assert_eq!(a_bound.var, b_bound.var); + Ok(a) + } + + // Those should have been canonicalized away. + (ty::Placeholder(..), _) => { + bug!("unexpected placeholder ty in `AnswerSubstitutor`: {:?} ", a); + } + + // Everything else should just be a perfect match as well, + // and we forbid inference variables. + _ => match ty::relate::super_relate_tys(self, a, b) { + Ok(ty) => Ok(ty), + Err(err) => bug!("type mismatch in `AnswerSubstitutor`: {}", err), + } + } + } + + fn regions( + &mut self, + a: ty::Region<'tcx>, + b: ty::Region<'tcx>, + ) -> RelateResult<'tcx, ty::Region<'tcx>> { + let b = match b { + &ty::ReVar(vid) => self.infcx + .borrow_region_constraints() + .opportunistic_resolve_var(self.infcx.tcx, vid), + + other => other, + }; + + if let &ty::ReLateBound(debruijn, bound) = a { + // Free bound region + if debruijn == self.binder_index { + self.unify_free_answer_var(bound.assert_bound_var(), b.into())?; + return Ok(b); + } + } + + match (a, b) { + (&ty::ReLateBound(a_debruijn, a_bound), &ty::ReLateBound(b_debruijn, b_bound)) => { + assert_eq!(a_debruijn, b_debruijn); + assert_eq!(a_bound.assert_bound_var(), b_bound.assert_bound_var()); + } + + (ty::ReStatic, ty::ReStatic) | + (ty::ReErased, ty::ReErased) | + (ty::ReEmpty, ty::ReEmpty) => (), + + (&ty::ReFree(a_free), &ty::ReFree(b_free)) => { + assert_eq!(a_free, b_free); + } + + _ => bug!("unexpected regions in `AnswerSubstitutor`: {:?}, {:?}", a, b), + } + + Ok(a) + } +} diff --git a/src/librustc_traits/chalk_context/unify.rs b/src/librustc_traits/chalk_context/unify.rs new file mode 100644 index 00000000000..abb48127341 --- /dev/null +++ b/src/librustc_traits/chalk_context/unify.rs @@ -0,0 +1,107 @@ +use rustc::infer::nll_relate::{TypeRelating, TypeRelatingDelegate, NormalizationStrategy}; +use rustc::infer::{InferCtxt, RegionVariableOrigin}; +use rustc::traits::{DomainGoal, Goal, Environment, InEnvironment}; +use rustc::ty::relate::{Relate, TypeRelation, RelateResult}; +use rustc::ty; +use syntax_pos::DUMMY_SP; + +crate struct UnificationResult<'tcx> { + crate goals: Vec>>, + crate constraints: Vec>, +} + +crate fn unify<'me, 'gcx, 'tcx, T: Relate<'tcx>>( + infcx: &'me InferCtxt<'me, 'gcx, 'tcx>, + environment: Environment<'tcx>, + variance: ty::Variance, + a: &T, + b: &T +) -> RelateResult<'tcx, UnificationResult<'tcx>> { + debug!("unify( + a = {:?}, + b = {:?}, + environment = {:?}, + )", a, b, environment); + + let mut delegate = ChalkTypeRelatingDelegate::new( + infcx, + environment + ); + + TypeRelating::new( + infcx, + &mut delegate, + variance + ).relate(a, b)?; + + debug!("unify: goals = {:?}, constraints = {:?}", delegate.goals, delegate.constraints); + + Ok(UnificationResult { + goals: delegate.goals, + constraints: delegate.constraints, + }) +} + +struct ChalkTypeRelatingDelegate<'me, 'gcx: 'tcx, 'tcx: 'me> { + infcx: &'me InferCtxt<'me, 'gcx, 'tcx>, + environment: Environment<'tcx>, + goals: Vec>>, + constraints: Vec>, +} + +impl ChalkTypeRelatingDelegate<'me, 'gcx, 'tcx> { + fn new( + infcx: &'me InferCtxt<'me, 'gcx, 'tcx>, + environment: Environment<'tcx>, + ) -> Self { + Self { + infcx, + environment, + goals: Vec::new(), + constraints: Vec::new(), + } + } +} + +impl TypeRelatingDelegate<'tcx> for &mut ChalkTypeRelatingDelegate<'_, '_, 'tcx> { + fn create_next_universe(&mut self) -> ty::UniverseIndex { + self.infcx.create_next_universe() + } + + fn next_existential_region_var(&mut self) -> ty::Region<'tcx> { + self.infcx.next_region_var(RegionVariableOrigin::MiscVariable(DUMMY_SP)) + } + + fn next_placeholder_region( + &mut self, + placeholder: ty::PlaceholderRegion + ) -> ty::Region<'tcx> { + self.infcx.tcx.mk_region(ty::RePlaceholder(placeholder)) + } + + fn generalize_existential(&mut self, universe: ty::UniverseIndex) -> ty::Region<'tcx> { + self.infcx.next_region_var_in_universe( + RegionVariableOrigin::MiscVariable(DUMMY_SP), + universe + ) + } + + fn push_outlives(&mut self, sup: ty::Region<'tcx>, sub: ty::Region<'tcx>) { + self.constraints.push(ty::OutlivesPredicate(sup.into(), sub)); + } + + fn push_domain_goal(&mut self, domain_goal: DomainGoal<'tcx>) { + let goal = self.environment.with( + self.infcx.tcx.mk_goal(domain_goal.into_goal()) + ); + self.goals.push(goal); + } + + fn normalization() -> NormalizationStrategy { + NormalizationStrategy::Lazy + } + + fn forbid_inference_vars() -> bool { + false + } +} diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs index af64522f183..7979fe4a750 100644 --- a/src/librustc_traits/dropck_outlives.rs +++ b/src/librustc_traits/dropck_outlives.rs @@ -1,18 +1,8 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir::def_id::DefId; use rustc::infer::canonical::{Canonical, QueryResponse}; use rustc::traits::query::dropck_outlives::{DropckOutlivesResult, DtorckConstraint}; use rustc::traits::query::{CanonicalTyGoal, NoSolution}; -use rustc::traits::{FulfillmentContext, Normalized, ObligationCause, TraitEngineExt}; +use rustc::traits::{TraitEngine, Normalized, ObligationCause, TraitEngineExt}; use rustc::ty::query::Providers; use rustc::ty::subst::{Subst, Substs}; use rustc::ty::{self, ParamEnvAnd, Ty, TyCtxt}; @@ -88,7 +78,7 @@ fn dropck_outlives<'tcx>( // Set used to detect infinite recursion. let mut ty_set = FxHashSet::default(); - let fulfill_cx = &mut FulfillmentContext::new(); + let mut fulfill_cx = TraitEngine::new(infcx.tcx); let cause = ObligationCause::dummy(); while let Some((ty, depth)) = ty_stack.pop() { @@ -146,7 +136,11 @@ fn dropck_outlives<'tcx>( debug!("dropck_outlives: result = {:#?}", result); - infcx.make_canonicalized_query_response(canonical_inference_vars, result, fulfill_cx) + infcx.make_canonicalized_query_response( + canonical_inference_vars, + result, + &mut *fulfill_cx + ) }, ) } @@ -274,7 +268,7 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>( ty::UnnormalizedProjection(..) => bug!("only used with chalk-engine"), - ty::Bound(..) | ty::Infer(..) | ty::Error => { + ty::Placeholder(..) | ty::Bound(..) | ty::Infer(..) | ty::Error => { // By the time this code runs, all type variables ought to // be fully resolved. Err(NoSolution) diff --git a/src/librustc_traits/evaluate_obligation.rs b/src/librustc_traits/evaluate_obligation.rs index 15ef1106311..c5b6de27935 100644 --- a/src/librustc_traits/evaluate_obligation.rs +++ b/src/librustc_traits/evaluate_obligation.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::traits::query::CanonicalPredicateGoal; use rustc::traits::{ EvaluationResult, Obligation, ObligationCause, OverflowError, SelectionContext, TraitQueryMode, diff --git a/src/librustc_traits/generic_types.rs b/src/librustc_traits/generic_types.rs new file mode 100644 index 00000000000..03511e1d76d --- /dev/null +++ b/src/librustc_traits/generic_types.rs @@ -0,0 +1,80 @@ +//! Utilities for creating generic types with bound vars in place of parameter values. + +use rustc::ty::{self, Ty, TyCtxt}; +use rustc::ty::subst::Substs; +use rustc::hir; +use rustc::hir::def_id::DefId; +use rustc_target::spec::abi; + +crate fn bound(tcx: ty::TyCtxt<'_, '_, 'tcx>, index: u32) -> Ty<'tcx> { + let ty = ty::Bound( + ty::INNERMOST, + ty::BoundVar::from_u32(index).into() + ); + tcx.mk_ty(ty) +} + +crate fn raw_ptr(tcx: TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { + tcx.mk_ptr(ty::TypeAndMut { + ty: bound(tcx, 0), + mutbl, + }) +} + +crate fn fn_ptr( + tcx: ty::TyCtxt<'_, '_, 'tcx>, + arity_and_output: usize, + variadic: bool, + unsafety: hir::Unsafety, + abi: abi::Abi +) -> Ty<'tcx> { + let inputs_and_output = tcx.mk_type_list( + (0..arity_and_output).into_iter() + .map(|i| ty::BoundVar::from(i)) + // DebruijnIndex(1) because we are going to inject these in a `PolyFnSig` + .map(|var| tcx.mk_ty(ty::Bound(ty::DebruijnIndex::from(1usize), var.into()))) + ); + + let fn_sig = ty::Binder::bind(ty::FnSig { + inputs_and_output, + variadic, + unsafety, + abi, + }); + tcx.mk_fn_ptr(fn_sig) +} + +crate fn type_list(tcx: ty::TyCtxt<'_, '_, 'tcx>, arity: usize) -> &'tcx ty::List> { + tcx.mk_type_list( + (0..arity).into_iter() + .map(|i| ty::BoundVar::from(i)) + .map(|var| tcx.mk_ty(ty::Bound(ty::INNERMOST, var.into()))) + ) +} + +crate fn ref_ty(tcx: ty::TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { + let region = tcx.mk_region( + ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(0)) + ); + + tcx.mk_ref(region, ty::TypeAndMut { + ty: bound(tcx, 1), + mutbl, + }) +} + +crate fn fn_def(tcx: ty::TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { + tcx.mk_ty(ty::FnDef(def_id, Substs::bound_vars_for_item(tcx, def_id))) +} + +crate fn closure(tcx: ty::TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { + tcx.mk_closure(def_id, ty::ClosureSubsts { + substs: Substs::bound_vars_for_item(tcx, def_id), + }) +} + +crate fn generator(tcx: ty::TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { + tcx.mk_generator(def_id, ty::GeneratorSubsts { + substs: Substs::bound_vars_for_item(tcx, def_id), + }, hir::GeneratorMovability::Movable) +} diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs index 7514c2c18e7..a3fb9699054 100644 --- a/src/librustc_traits/implied_outlives_bounds.rs +++ b/src/librustc_traits/implied_outlives_bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Provider for the `implied_outlives_bounds` query. //! Do not call this query directory. See [`rustc::traits::query::implied_outlives_bounds`]. @@ -77,7 +67,7 @@ fn compute_implied_outlives_bounds<'tcx>( let obligations = wf::obligations(infcx, param_env, DUMMY_NODE_ID, ty, DUMMY_SP).unwrap_or(vec![]); - // NB: All of these predicates *ought* to be easily proven + // N.B., all of these predicates *ought* to be easily proven // true. In fact, their correctness is (mostly) implied by // other parts of the program. However, in #42552, we had // an annoying scenario where: diff --git a/src/librustc_traits/lib.rs b/src/librustc_traits/lib.rs index 4a3806d6cb6..a220b921913 100644 --- a/src/librustc_traits/lib.rs +++ b/src/librustc_traits/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! New recursive solver modeled on Chalk's recursive solver. Most of //! the guts are broken up into modules; see the comments in those modules. @@ -35,6 +25,7 @@ mod implied_outlives_bounds; mod normalize_projection_ty; mod normalize_erasing_regions; pub mod lowering; +mod generic_types; mod type_op; use rustc::ty::query::Providers; @@ -44,6 +35,7 @@ pub fn provide(p: &mut Providers) { evaluate_obligation::provide(p); implied_outlives_bounds::provide(p); lowering::provide(p); + chalk_context::provide(p); normalize_projection_ty::provide(p); normalize_erasing_regions::provide(p); type_op::provide(p); diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index 54f0c6e8da7..962a145814c 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::traits::{ Clause, Clauses, @@ -21,6 +11,7 @@ use rustc::ty::{self, TyCtxt, Ty}; use rustc::hir::def_id::DefId; use rustc_data_structures::fx::FxHashSet; use super::Lower; +use crate::generic_types; use std::iter; struct ClauseVisitor<'set, 'a, 'tcx: 'a + 'set> { @@ -48,20 +39,16 @@ impl ClauseVisitor<'set, 'a, 'tcx> { } // forall<'a, T> { `Outlives(T: 'a) :- FromEnv(&'a T)` } - ty::Ref(..) => { - use rustc::hir; - + ty::Ref(_, _, mutbl) => { let region = self.tcx.mk_region( ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(0)) ); - let ty = self.tcx.mk_ty( - ty::Bound(ty::BoundTy::new(ty::INNERMOST, ty::BoundVar::from_u32(1))) - ); - + let ty = generic_types::bound(self.tcx, 1); let ref_ty = self.tcx.mk_ref(region, ty::TypeAndMut { ty, - mutbl: hir::Mutability::MutImmutable, + mutbl, }); + let from_env = DomainGoal::FromEnv(FromEnv::Ty(ref_ty)); let clause = ProgramClause { @@ -114,11 +101,12 @@ impl ClauseVisitor<'set, 'a, 'tcx> { ty::Tuple(..) | ty::Never | ty::Infer(..) | + ty::Placeholder(..) | + ty::Param(..) | ty::Bound(..) => (), ty::GeneratorWitness(..) | ty::UnnormalizedProjection(..) | - ty::Param(..) | ty::Error => { bug!("unexpected type {:?}", ty); } @@ -201,25 +189,23 @@ crate fn program_clauses_for_env<'a, 'tcx>( crate fn environment<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId -) -> ty::Binder> { +) -> Environment<'tcx> { use super::{Lower, IntoFromEnvGoal}; use rustc::hir::{Node, TraitItemKind, ImplItemKind, ItemKind, ForeignItemKind}; - use rustc::ty::subst::{Subst, Substs}; + + debug!("environment(def_id = {:?})", def_id); // The environment of an impl Trait type is its defining function's environment. if let Some(parent) = ty::is_impl_trait_defn(tcx, def_id) { return environment(tcx, parent); } - let bound_vars = Substs::bound_vars_for_item(tcx, def_id); - // Compute the bounds on `Self` and the type parameters. let ty::InstantiatedPredicates { predicates } = tcx.predicates_of(def_id) .instantiate_identity(tcx); let clauses = predicates.into_iter() .map(|predicate| predicate.lower()) - .map(|predicate| predicate.subst(tcx, bound_vars)) .map(|domain_goal| domain_goal.map_bound(|bound| bound.into_from_env_goal())) .map(|domain_goal| domain_goal.map_bound(|bound| bound.into_program_clause())) @@ -227,76 +213,88 @@ crate fn environment<'a, 'tcx>( // could bound lifetimes. .map(Clause::ForAll); - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let node = tcx.hir.get(node_id); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let node = tcx.hir().get(node_id); - let mut is_fn = false; - let mut is_impl = false; - match node { + enum NodeKind { + TraitImpl, + InherentImpl, + Fn, + Other, + }; + + let node_kind = match node { Node::TraitItem(item) => match item.node { - TraitItemKind::Method(..) => is_fn = true, - _ => (), + TraitItemKind::Method(..) => NodeKind::Fn, + _ => NodeKind::Other, } Node::ImplItem(item) => match item.node { - ImplItemKind::Method(..) => is_fn = true, - _ => (), + ImplItemKind::Method(..) => NodeKind::Fn, + _ => NodeKind::Other, } Node::Item(item) => match item.node { - ItemKind::Impl(..) => is_impl = true, - ItemKind::Fn(..) => is_fn = true, - _ => (), + ItemKind::Impl(.., Some(..), _, _) => NodeKind::TraitImpl, + ItemKind::Impl(.., None, _, _) => NodeKind::InherentImpl, + ItemKind::Fn(..) => NodeKind::Fn, + _ => NodeKind::Other, } Node::ForeignItem(item) => match item.node { - ForeignItemKind::Fn(..) => is_fn = true, - _ => (), + ForeignItemKind::Fn(..) => NodeKind::Fn, + _ => NodeKind::Other, } // FIXME: closures? - _ => (), - } + _ => NodeKind::Other, + }; let mut input_tys = FxHashSet::default(); - // In an impl, we assume that the header trait ref and all its constituents - // are well-formed. - if is_impl { - let trait_ref = tcx.impl_trait_ref(def_id) - .expect("not an impl") - .subst(tcx, bound_vars); + match node_kind { + // In a trait impl, we assume that the header trait ref and all its + // constituents are well-formed. + NodeKind::TraitImpl => { + let trait_ref = tcx.impl_trait_ref(def_id) + .expect("not an impl"); - input_tys.extend( - trait_ref.substs.types().flat_map(|ty| ty.walk()) - ); - } + input_tys.extend( + trait_ref.input_types().flat_map(|ty| ty.walk()) + ); + } - // In an fn, we assume that the arguments and all their constituents are - // well-formed. - if is_fn { - // `skip_binder` because we move region parameters to the root binder, - // restored in the return type of this query - let fn_sig = tcx.fn_sig(def_id).skip_binder().subst(tcx, bound_vars); + // In an inherent impl, we assume that the receiver type and all its + // constituents are well-formed. + NodeKind::InherentImpl => { + let self_ty = tcx.type_of(def_id); + input_tys.extend(self_ty.walk()); + } - input_tys.extend( - fn_sig.inputs().iter().flat_map(|ty| ty.walk()) - ); + // In an fn, we assume that the arguments and all their constituents are + // well-formed. + NodeKind::Fn => { + let fn_sig = tcx.fn_sig(def_id); + let fn_sig = tcx.liberate_late_bound_regions(def_id, &fn_sig); + + input_tys.extend( + fn_sig.inputs().iter().flat_map(|ty| ty.walk()) + ); + } + + NodeKind::Other => (), } let clauses = clauses.chain( input_tys.into_iter() - // Filter out type parameters - .filter(|ty| match ty.sty { - ty::Bound(..) => false, - _ => true, - }) .map(|ty| DomainGoal::FromEnv(FromEnv::Ty(ty))) .map(|domain_goal| domain_goal.into_program_clause()) .map(Clause::Implies) ); - ty::Binder::bind(Environment { + debug!("environment: clauses = {:?}", clauses); + + Environment { clauses: tcx.mk_clauses(clauses), - }) + } } diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index cf1bc04dd4e..9bdef3051e5 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod environment; use rustc::hir::def_id::DefId; @@ -43,7 +33,7 @@ crate fn provide(p: &mut Providers) { } crate trait Lower { - /// Lower a rustc construct (e.g. `ty::TraitPredicate`) to a chalk-like type. + /// Lower a rustc construct (e.g., `ty::TraitPredicate`) to a chalk-like type. fn lower(&self) -> T; } @@ -90,9 +80,9 @@ where } /// `ty::Binder` is used for wrapping a rustc construction possibly containing generic -/// lifetimes, e.g. `for<'a> T: Fn(&'a i32)`. Instead of representing higher-ranked things -/// in that leaf-form (i.e. `Holds(Implemented(Binder))` in the previous -/// example), we model them with quantified domain goals, e.g. as for the previous example: +/// lifetimes, e.g., `for<'a> T: Fn(&'a i32)`. Instead of representing higher-ranked things +/// in that leaf-form (i.e., `Holds(Implemented(Binder))` in the previous +/// example), we model them with quantified domain goals, e.g., as for the previous example: /// `forall<'a> { T: Fn(&'a i32) }` which corresponds to something like /// `Binder`. impl<'tcx, T> Lower> for ty::Binder @@ -168,7 +158,8 @@ crate fn program_clauses_for<'a, 'tcx>( def_id: DefId, ) -> Clauses<'tcx> { match tcx.def_key(def_id).disambiguated_data.data { - DefPathData::Trait(_) => program_clauses_for_trait(tcx, def_id), + DefPathData::Trait(_) | + DefPathData::TraitAlias(_) => program_clauses_for_trait(tcx, def_id), DefPathData::Impl => program_clauses_for_impl(tcx, def_id), DefPathData::AssocTypeInImpl(..) => program_clauses_for_associated_type_value(tcx, def_id), DefPathData::AssocTypeInTrait(..) => program_clauses_for_associated_type_def(tcx, def_id), @@ -221,7 +212,6 @@ fn program_clauses_for_trait<'a, 'tcx>( let where_clauses = &predicates .iter() .map(|(wc, _)| wc.lower()) - .map(|wc| wc.subst(tcx, bound_vars)) .collect::>(); // Rule Implied-Bound-From-Trait @@ -242,14 +232,13 @@ fn program_clauses_for_trait<'a, 'tcx>( .map(|wc| { // we move binders to the left wc.map_bound(|goal| ProgramClause { - goal: goal.into_from_env_goal(), - - // FIXME: As where clauses can only bind lifetimes for now, - // and that named bound regions have a def-id, it is safe - // to just inject `hypotheses` (which contains named vars bound at index `0`) - // into this binding level. This may change if we ever allow where clauses - // to bind types (e.g. for GATs things), because bound types only use a `BoundVar` + // FIXME: As where clauses can only bind lifetimes for now, and that named + // bound regions have a def-id, it is safe to just inject `bound_vars` and + // `hypotheses` (which contain named vars bound at index `0`) into this + // binding level. This may change if we ever allow where clauses to bind + // types (e.g. for GATs things), because bound types only use a `BoundVar` // index (no def-id). + goal: goal.subst(tcx, bound_vars).into_from_env_goal(), hypotheses, category: ProgramClauseCategory::ImpliedBound, @@ -356,7 +345,6 @@ pub fn program_clauses_for_type_def<'a, 'tcx>( let where_clauses = tcx.predicates_of(def_id).predicates .iter() .map(|(wc, _)| wc.lower()) - .map(|wc| wc.subst(tcx, bound_vars)) .collect::>(); // `WellFormed(Ty<...>) :- WC1, ..., WCm` @@ -365,7 +353,7 @@ pub fn program_clauses_for_type_def<'a, 'tcx>( hypotheses: tcx.mk_goals( where_clauses .iter() - .cloned() + .map(|wc| wc.subst(tcx, bound_vars)) .map(|wc| tcx.mk_goal(GoalKind::from_poly_domain_goal(wc, tcx))), ), category: ProgramClauseCategory::WellFormed, @@ -393,11 +381,10 @@ pub fn program_clauses_for_type_def<'a, 'tcx>( .map(|wc| { // move the binders to the left wc.map_bound(|goal| ProgramClause { - goal: goal.into_from_env_goal(), - - // FIXME: we inject `hypotheses` into this binding level, - // which may be incorrect in the future: see the FIXME in - // `program_clauses_for_trait` + // FIXME: we inject `bound_vars` and `hypotheses` into this binding + // level, which may be incorrect in the future: see the FIXME in + // `program_clauses_for_trait`. + goal: goal.subst(tcx, bound_vars).into_from_env_goal(), hypotheses, category: ProgramClauseCategory::ImpliedBound, @@ -515,7 +502,8 @@ pub fn program_clauses_for_associated_type_def<'a, 'tcx>( .unwrap_or(0); // Add a new type param after the existing ones (`U` in the comment above). let ty_var = ty::Bound( - ty::BoundTy::new(ty::INNERMOST, ty::BoundVar::from_u32(offset + 1)) + ty::INNERMOST, + ty::BoundVar::from_u32(offset + 1).into() ); // `ProjectionEq(>::AssocType = U)` @@ -559,7 +547,7 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>( // ``` // // FIXME: For the moment, we don't account for where clauses written on the associated - // ty definition (i.e. in the trait def, as in `type AssocType where T: Sized`). + // ty definition (i.e., in the trait def, as in `type AssocType where T: Sized`). // ``` // forall { // forall { @@ -614,7 +602,7 @@ pub fn dump_program_clauses<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { } let mut visitor = ClauseDumper { tcx }; - tcx.hir + tcx.hir() .krate() .visit_all_item_likes(&mut visitor.as_deep_visitor()); } @@ -625,7 +613,7 @@ struct ClauseDumper<'a, 'tcx: 'a> { impl<'a, 'tcx> ClauseDumper<'a, 'tcx> { fn process_attrs(&mut self, node_id: ast::NodeId, attrs: &[ast::Attribute]) { - let def_id = self.tcx.hir.local_def_id(node_id); + let def_id = self.tcx.hir().local_def_id(node_id); for attr in attrs { let mut clauses = None; @@ -635,7 +623,7 @@ impl<'a, 'tcx> ClauseDumper<'a, 'tcx> { if attr.check_name("rustc_dump_env_program_clauses") { let environment = self.tcx.environment(def_id); - clauses = Some(self.tcx.program_clauses_for_env(*environment.skip_binder())); + clauses = Some(self.tcx.program_clauses_for_env(environment)); } if let Some(clauses) = clauses { @@ -663,7 +651,7 @@ impl<'a, 'tcx> ClauseDumper<'a, 'tcx> { impl<'a, 'tcx> Visitor<'tcx> for ClauseDumper<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::OnlyBodies(&self.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } fn visit_item(&mut self, item: &'tcx hir::Item) { diff --git a/src/librustc_traits/normalize_erasing_regions.rs b/src/librustc_traits/normalize_erasing_regions.rs index a85983d0e9a..c06cdbd0928 100644 --- a/src/librustc_traits/normalize_erasing_regions.rs +++ b/src/librustc_traits/normalize_erasing_regions.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::traits::{Normalized, ObligationCause}; use rustc::traits::query::NoSolution; use rustc::ty::query::Providers; diff --git a/src/librustc_traits/normalize_projection_ty.rs b/src/librustc_traits/normalize_projection_ty.rs index 637a50728f3..b31e9c15d03 100644 --- a/src/librustc_traits/normalize_projection_ty.rs +++ b/src/librustc_traits/normalize_projection_ty.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::infer::canonical::{Canonical, QueryResponse}; use rustc::traits::query::{normalize::NormalizationResult, CanonicalProjectionGoal, NoSolution}; use rustc::traits::{self, ObligationCause, SelectionContext, TraitEngineExt}; diff --git a/src/librustc_traits/type_op.rs b/src/librustc_traits/type_op.rs index e635bc9efc4..526637e108d 100644 --- a/src/librustc_traits/type_op.rs +++ b/src/librustc_traits/type_op.rs @@ -1,19 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::infer::at::ToTrace; use rustc::infer::canonical::{Canonical, QueryResponse}; use rustc::infer::InferCtxt; use rustc::hir::def_id::DefId; -use rustc::mir::ProjectionKind; -use rustc::mir::tcx::PlaceTy; use rustc::traits::query::type_op::ascribe_user_type::AscribeUserType; use rustc::traits::query::type_op::eq::Eq; use rustc::traits::query::type_op::normalize::Normalize; @@ -21,10 +9,10 @@ use rustc::traits::query::type_op::prove_predicate::ProvePredicate; use rustc::traits::query::type_op::subtype::Subtype; use rustc::traits::query::{Fallible, NoSolution}; use rustc::traits::{ - FulfillmentContext, Normalized, Obligation, ObligationCause, TraitEngine, TraitEngineExt, + Normalized, Obligation, ObligationCause, TraitEngine, TraitEngineExt, }; use rustc::ty::query::Providers; -use rustc::ty::subst::{Kind, Subst, UserSelfTy, UserSubsts}; +use rustc::ty::subst::{Kind, Subst, UserSubsts, UserSelfTy}; use rustc::ty::{ FnSig, Lift, ParamEnv, ParamEnvAnd, PolyFnSig, Predicate, Ty, TyCtxt, TypeFoldable, Variance, }; @@ -54,29 +42,16 @@ fn type_op_ascribe_user_type<'tcx>( tcx.infer_ctxt() .enter_canonical_trait_query(&canonicalized, |infcx, fulfill_cx, key| { let ( - param_env, - AscribeUserType { - mir_ty, - variance, - def_id, - user_substs, - projs, - }, + param_env, AscribeUserType { mir_ty, def_id, user_substs } ) = key.into_parts(); debug!( - "type_op_ascribe_user_type(\ - mir_ty={:?}, variance={:?}, def_id={:?}, user_substs={:?}, projs={:?}\ - )", - mir_ty, variance, def_id, user_substs, projs, + "type_op_ascribe_user_type: mir_ty={:?} def_id={:?} user_substs={:?}", + mir_ty, def_id, user_substs ); - let mut cx = AscribeUserTypeCx { - infcx, - param_env, - fulfill_cx, - }; - cx.relate_mir_and_user_ty(mir_ty, variance, def_id, user_substs, projs)?; + let mut cx = AscribeUserTypeCx { infcx, param_env, fulfill_cx }; + cx.relate_mir_and_user_ty(mir_ty, def_id, user_substs)?; Ok(()) }) @@ -85,7 +60,7 @@ fn type_op_ascribe_user_type<'tcx>( struct AscribeUserTypeCx<'me, 'gcx: 'tcx, 'tcx: 'me> { infcx: &'me InferCtxt<'me, 'gcx, 'tcx>, param_env: ParamEnv<'tcx>, - fulfill_cx: &'me mut FulfillmentContext<'tcx>, + fulfill_cx: &'me mut dyn TraitEngine<'tcx>, } impl AscribeUserTypeCx<'me, 'gcx, 'tcx> { @@ -134,16 +109,13 @@ impl AscribeUserTypeCx<'me, 'gcx, 'tcx> { fn relate_mir_and_user_ty( &mut self, mir_ty: Ty<'tcx>, - variance: Variance, def_id: DefId, user_substs: UserSubsts<'tcx>, - projs: &[ProjectionKind<'tcx>], ) -> Result<(), NoSolution> { let UserSubsts { - substs, user_self_ty, + substs, } = user_substs; - let tcx = self.tcx(); let ty = tcx.type_of(def_id); @@ -151,41 +123,25 @@ impl AscribeUserTypeCx<'me, 'gcx, 'tcx> { debug!("relate_type_and_user_type: ty of def-id is {:?}", ty); let ty = self.normalize(ty); - // We need to follow any provided projetions into the type. - // - // if we hit a ty var as we descend, then just skip the - // attempt to relate the mir local with any type. - - struct HitTyVar; - let mut curr_projected_ty: Result; - curr_projected_ty = Ok(PlaceTy::from_ty(ty)); - for proj in projs { - let projected_ty = if let Ok(projected_ty) = curr_projected_ty { - projected_ty - } else { - break; - }; - curr_projected_ty = projected_ty.projection_ty_core( - tcx, proj, |this, field, &()| { - if this.to_ty(tcx).is_ty_var() { - Err(HitTyVar) - } else { - let ty = this.field_ty(tcx, field); - Ok(self.normalize(ty)) - } - }); - } + self.relate(mir_ty, Variance::Invariant, ty)?; - if let Ok(projected_ty) = curr_projected_ty { - let ty = projected_ty.to_ty(tcx); - self.relate(mir_ty, variance, ty)?; + // Prove the predicates coming along with `def_id`. + // + // Also, normalize the `instantiated_predicates` + // because otherwise we wind up with duplicate "type + // outlives" error messages. + let instantiated_predicates = self.tcx() + .predicates_of(def_id) + .instantiate(self.tcx(), substs); + for instantiated_predicate in instantiated_predicates.predicates { + let instantiated_predicate = self.normalize(instantiated_predicate); + self.prove_predicate(instantiated_predicate); } if let Some(UserSelfTy { impl_def_id, self_ty, - }) = user_self_ty - { + }) = user_self_ty { let impl_self_ty = self.tcx().type_of(impl_def_id); let impl_self_ty = self.subst(impl_self_ty, &substs); let impl_self_ty = self.normalize(impl_self_ty); @@ -195,19 +151,6 @@ impl AscribeUserTypeCx<'me, 'gcx, 'tcx> { self.prove_predicate(Predicate::WellFormed(impl_self_ty)); } - // Prove the predicates coming along with `def_id`. - // - // Also, normalize the `instantiated_predicates` - // because otherwise we wind up with duplicate "type - // outlives" error messages. - let instantiated_predicates = self.tcx() - .predicates_of(def_id) - .instantiate(self.tcx(), substs); - for instantiated_predicate in instantiated_predicates.predicates { - let instantiated_predicate = self.normalize(instantiated_predicate); - self.prove_predicate(instantiated_predicate); - } - // In addition to proving the predicates, we have to // prove that `ty` is well-formed -- this is because // the WF of `ty` is predicated on the substs being @@ -220,7 +163,6 @@ impl AscribeUserTypeCx<'me, 'gcx, 'tcx> { // type were ill-formed but did not appear in `ty`, // which...could happen with normalization... self.prove_predicate(Predicate::WellFormed(ty)); - Ok(()) } } @@ -241,7 +183,7 @@ fn type_op_eq<'tcx>( fn type_op_normalize( infcx: &InferCtxt<'_, 'gcx, 'tcx>, - fulfill_cx: &mut FulfillmentContext<'tcx>, + fulfill_cx: &mut dyn TraitEngine<'tcx>, key: ParamEnvAnd<'tcx, Normalize>, ) -> Fallible where diff --git a/src/librustc_tsan/Cargo.toml b/src/librustc_tsan/Cargo.toml index baadb64511a..f0618275f2f 100644 --- a/src/librustc_tsan/Cargo.toml +++ b/src/librustc_tsan/Cargo.toml @@ -16,4 +16,4 @@ cmake = "0.1.18" [dependencies] alloc = { path = "../liballoc" } core = { path = "../libcore" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +compiler_builtins = "0.1.0" diff --git a/src/librustc_tsan/build.rs b/src/librustc_tsan/build.rs index d23c71e2c12..0db3db392dd 100644 --- a/src/librustc_tsan/build.rs +++ b/src/librustc_tsan/build.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate build_helper; extern crate cmake; @@ -18,6 +8,8 @@ use cmake::Config; fn main() { if let Some(llvm_config) = env::var_os("LLVM_CONFIG") { + build_helper::restore_library_path(); + let (native, target) = match sanitizer_lib_boilerplate("tsan") { Ok(native) => native, _ => return, diff --git a/src/librustc_tsan/lib.rs b/src/librustc_tsan/lib.rs index 47f917e40c1..d6c8e54c18d 100644 --- a/src/librustc_tsan/lib.rs +++ b/src/librustc_tsan/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![sanitizer_runtime] #![feature(nll)] #![feature(sanitizer_runtime)] diff --git a/src/librustc_typeck/Cargo.toml b/src/librustc_typeck/Cargo.toml index 881fa2604bc..68b28a60fdf 100644 --- a/src/librustc_typeck/Cargo.toml +++ b/src/librustc_typeck/Cargo.toml @@ -15,8 +15,7 @@ log = "0.4" rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_errors = { path = "../librustc_errors" } -rustc_platform_intrinsics = { path = "../librustc_platform_intrinsics" } rustc_target = { path = "../librustc_target" } -smallvec = { version = "0.6.5", features = ["union"] } +smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } diff --git a/src/librustc_typeck/README.md b/src/librustc_typeck/README.md index f00597cb27f..fdcbd935524 100644 --- a/src/librustc_typeck/README.md +++ b/src/librustc_typeck/README.md @@ -1,5 +1,5 @@ For high-level intro to how type checking works in rustc, see the [type checking] chapter of the [rustc guide]. -[type checking]: https://rust-lang-nursery.github.io/rustc-guide/type-checking.html -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/ +[type checking]: https://rust-lang.github.io/rustc-guide/type-checking.html +[rustc guide]: https://rust-lang.github.io/rustc-guide/ diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index d388d756438..61674070fbc 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1,44 +1,42 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Conversion from AST representation of types to the `ty.rs` -//! representation. The main routine here is `ast_ty_to_ty()`: each use -//! is parameterized by an instance of `AstConv`. +//! Conversion from AST representation of types to the `ty.rs` representation. +//! The main routine here is `ast_ty_to_ty()`; each use is parameterized by an +//! instance of `AstConv`. -use smallvec::SmallVec; +use errors::{Applicability, DiagnosticId}; use hir::{self, GenericArg, GenericArgs}; use hir::def::Def; use hir::def_id::DefId; use hir::HirVec; +use lint; use middle::resolve_lifetime as rl; use namespace::Namespace; -use rustc::ty::subst::{Kind, Subst, Substs}; +use rustc::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS; use rustc::traits; use rustc::ty::{self, Ty, TyCtxt, ToPredicate, TypeFoldable}; use rustc::ty::{GenericParamDef, GenericParamDefKind}; +use rustc::ty::subst::{Kind, Subst, Substs}; use rustc::ty::wf::object_region_bounds; use rustc_data_structures::sync::Lrc; use rustc_target::spec::abi; -use std::collections::BTreeSet; -use std::slice; use require_c_abi_if_variadic; +use smallvec::SmallVec; +use syntax::ast; +use syntax::feature_gate::{GateIssue, emit_feature_err}; +use syntax::ptr::P; +use syntax::util::lev_distance::find_best_match_for_name; +use syntax_pos::{DUMMY_SP, Span, MultiSpan}; use util::common::ErrorReported; use util::nodemap::FxHashMap; -use errors::{Applicability, FatalError, DiagnosticId}; -use lint; +use std::collections::BTreeSet; use std::iter; -use syntax::ast; -use syntax::ptr::P; -use syntax::feature_gate::{GateIssue, emit_feature_err}; -use syntax_pos::{DUMMY_SP, Span, MultiSpan}; +use std::slice; + +use super::{check_type_alias_enum_variants_enabled}; +use rustc_data_structures::fx::FxHashSet; + +#[derive(Debug)] +pub struct PathSeg(pub DefId, pub usize); pub trait AstConv<'gcx, 'tcx> { fn tcx<'a>(&'a self) -> TyCtxt<'a, 'gcx, 'tcx>; @@ -79,7 +77,7 @@ pub trait AstConv<'gcx, 'tcx> { fn normalize_ty(&self, span: Span, ty: Ty<'tcx>) -> Ty<'tcx>; /// Invoked when we encounter an error from some prior pass - /// (e.g. resolve) that is translated into a ty-error. This is + /// (e.g., resolve) that is translated into a ty-error. This is /// used to help suppress derived errors typeck might otherwise /// report. fn set_tainted_by_errors(&self); @@ -96,7 +94,7 @@ struct ConvertedBinding<'tcx> { #[derive(PartialEq)] enum GenericArgPosition { Type, - Value, // e.g. functions + Value, // e.g., functions MethodCall, } @@ -105,7 +103,7 @@ enum GenericArgPosition { /// This type must not appear anywhere in other converted types. const TRAIT_OBJECT_DUMMY_SELF: ty::TyKind<'static> = ty::Infer(ty::FreshTy(0)); -impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { +impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { pub fn ast_region_to_region(&self, lifetime: &hir::Lifetime, def: Option<&ty::GenericParamDef>) @@ -113,10 +111,10 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { { let tcx = self.tcx(); let lifetime_name = |def_id| { - tcx.hir.name(tcx.hir.as_local_node_id(def_id).unwrap()).as_interned_str() + tcx.hir().name(tcx.hir().as_local_node_id(def_id).unwrap()).as_interned_str() }; - let hir_id = tcx.hir.node_to_hir_id(lifetime.id); + let hir_id = tcx.hir().node_to_hir_id(lifetime.id); let r = match tcx.named_region(hir_id) { Some(rl::Region::Static) => { tcx.types.re_static @@ -182,7 +180,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { item_segment: &hir::PathSegment) -> &'tcx Substs<'tcx> { - let (substs, assoc_bindings) = item_segment.with_generic_args(|generic_args| { + let (substs, assoc_bindings, _) = item_segment.with_generic_args(|generic_args| { self.create_substs_for_ast_path( span, def_id, @@ -256,7 +254,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { }, def.parent.is_none() && def.has_self, // `has_self` seg.infer_types || suppress_mismatch, // `infer_types` - ) + ).0 } /// Check that the correct number of generic arguments have been provided. @@ -269,7 +267,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { position: GenericArgPosition, has_self: bool, infer_types: bool, - ) -> bool { + ) -> (bool, Option>) { // At this stage we are guaranteed that the generic arguments are in the correct order, e.g. // that lifetimes will proceed types. So it suffices to check the number of each generic // arguments in order to validate them with respect to the generic parameters. @@ -303,13 +301,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { let mut err = tcx.sess.struct_span_err(span, msg); err.span_note(span_late, note); err.emit(); - return true; + return (true, None); } else { let mut multispan = MultiSpan::from_span(span); multispan.push_span_label(span_late, note.to_string()); tcx.lint_node(lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS, args.args[0].id(), multispan, msg); - return false; + return (false, None); } } } @@ -320,10 +318,10 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { provided, offset| { // We enforce the following: `required` <= `provided` <= `permitted`. - // For kinds without defaults (i.e. lifetimes), `required == permitted`. - // For other kinds (i.e. types), `permitted` may be greater than `required`. + // For kinds without defaults (i.e., lifetimes), `required == permitted`. + // For other kinds (i.e., types), `permitted` may be greater than `required`. if required <= provided && provided <= permitted { - return false; + return (false, None); } // Unfortunately lifetime and type parameter mismatches are typically styled @@ -338,33 +336,28 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { (required, "") }; - let mut span = span; - let label = if required == permitted && provided > permitted { - let diff = provided - permitted; - if diff == 1 { - // In the case when the user has provided too many arguments, - // we want to point to the first unexpected argument. - let first_superfluous_arg: &GenericArg = &args.args[offset + permitted]; - span = first_superfluous_arg.span(); - } - format!( - "{}unexpected {} argument{}", - if diff != 1 { format!("{} ", diff) } else { String::new() }, - kind, - if diff != 1 { "s" } else { "" }, - ) + let mut potential_assoc_types: Option> = None; + let (spans, label) = if required == permitted && provided > permitted { + // In the case when the user has provided too many arguments, + // we want to point to the unexpected arguments. + let spans: Vec = args.args[offset+permitted .. offset+provided] + .iter() + .map(|arg| arg.span()) + .collect(); + potential_assoc_types = Some(spans.clone()); + (spans, format!( "unexpected {} argument", kind)) } else { - format!( + (vec![span], format!( "expected {}{} {} argument{}", quantifier, bound, kind, if bound != 1 { "s" } else { "" }, - ) + )) }; - tcx.sess.struct_span_err_with_code( - span, + let mut err = tcx.sess.struct_span_err_with_code( + spans.clone(), &format!( "wrong number of {} arguments: expected {}{}, found {}", kind, @@ -373,9 +366,14 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { provided, ), DiagnosticId::Error("E0107".into()) - ).span_label(span, label).emit(); + ); + for span in spans { + err.span_label(span, label.as_str()); + } + err.emit(); - provided > required // `suppress_error` + (provided > required, // `suppress_error` + potential_assoc_types) }; if !infer_lifetimes || arg_counts.lifetimes > param_counts.lifetimes { @@ -397,7 +395,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { arg_counts.lifetimes, ) } else { - false + (false, None) } } @@ -410,24 +408,24 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { /// creating the substitutions for, and a partial set of /// substitutions `parent_substs`. In general, the substitutions /// for an item begin with substitutions for all the "parents" of - /// that item -- so e.g. for a method it might include the + /// that item -- e.g., for a method it might include the /// parameters from the impl. /// /// Therefore, the method begins by walking down these parents, /// starting with the outermost parent and proceed inwards until - /// it reaches `def_id`. For each parent P, it will check `parent_substs` + /// it reaches `def_id`. For each parent `P`, it will check `parent_substs` /// first to see if the parent's substitutions are listed in there. If so, /// we can append those and move on. Otherwise, it invokes the /// three callback functions: /// - /// - `args_for_def_id`: given the def-id P, supplies back the + /// - `args_for_def_id`: given the def-id `P`, supplies back the /// generic arguments that were given to that parent from within - /// the path; so e.g. if you have `::Bar`, the def-id + /// the path; so e.g., if you have `::Bar`, the def-id /// might refer to the trait `Foo`, and the arguments might be /// `[T]`. The boolean value indicates whether to infer values /// for arguments whose values were not explicitly provided. /// - `provided_kind`: given the generic parameter and the value from `args_for_def_id`, - /// instantiate a `Kind` + /// instantiate a `Kind`. /// - `inferred_kind`: if no parameter was provided, and inference is enabled, then /// creates a suitable inference variable. pub fn create_substs_for_generic_args<'a, 'b>( @@ -440,7 +438,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { provided_kind: impl Fn(&GenericParamDef, &GenericArg) -> Kind<'tcx>, inferred_kind: impl Fn(Option<&[Kind<'tcx>]>, &GenericParamDef, bool) -> Kind<'tcx>, ) -> &'tcx Substs<'tcx> { - // Collect the segments of the path: we need to substitute arguments + // Collect the segments of the path; we need to substitute arguments // for parameters throughout the entire path (wherever there are // generic parameters). let mut parent_defs = tcx.generics_of(def_id); @@ -452,8 +450,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { } // We manually build up the substitution, rather than using convenience - // methods in `subst.rs` so that we can iterate over the arguments and - // parameters in lock-step linearly, rather than trying to match each pair. + // methods in `subst.rs`, so that we can iterate over the arguments and + // parameters in lock-step linearly, instead of trying to match each pair. let mut substs: SmallVec<[Kind<'tcx>; 8]> = SmallVec::with_capacity(count); // Iterate over each segment of the path. @@ -555,7 +553,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { generic_args: &hir::GenericArgs, infer_types: bool, self_ty: Option>) - -> (&'tcx Substs<'tcx>, Vec>) + -> (&'tcx Substs<'tcx>, Vec>, Option>) { // If the type is parameterized by this region, then replace this // region with the current anon region binding (in other words, @@ -571,8 +569,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { assert_eq!(generic_params.has_self, self_ty.is_some()); let has_self = generic_params.has_self; - Self::check_generic_arg_count( - self.tcx(), + let (_, potential_assoc_types) = Self::check_generic_arg_count( + tcx, span, &generic_params, &generic_args, @@ -597,7 +595,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { }; let substs = Self::create_substs_for_generic_args( - self.tcx(), + tcx, def_id, &[][..], self_ty.is_some(), @@ -676,7 +674,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { debug!("create_substs_for_ast_path(generic_params={:?}, self_ty={:?}) -> {:?}", generic_params, self_ty, substs); - (substs, assoc_bindings) + (substs, assoc_bindings, potential_assoc_types) } /// Instantiates the path for the given trait reference, assuming that it's @@ -692,45 +690,32 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { { self.prohibit_generics(trait_ref.path.segments.split_last().unwrap().1); - let trait_def_id = self.trait_def_id(trait_ref); self.ast_path_to_mono_trait_ref(trait_ref.path.span, - trait_def_id, + trait_ref.trait_def_id(), self_ty, trait_ref.path.segments.last().unwrap()) } - /// Get the `DefId` of the given trait ref. It _must_ actually be a trait. - fn trait_def_id(&self, trait_ref: &hir::TraitRef) -> DefId { - let path = &trait_ref.path; - match path.def { - Def::Trait(trait_def_id) => trait_def_id, - Def::TraitAlias(alias_def_id) => alias_def_id, - Def::Err => { - FatalError.raise(); - } - _ => unreachable!(), - } - } - - /// The given trait ref must actually be a trait. + /// The given trait-ref must actually be a trait. pub(super) fn instantiate_poly_trait_ref_inner(&self, trait_ref: &hir::TraitRef, self_ty: Ty<'tcx>, poly_projections: &mut Vec<(ty::PolyProjectionPredicate<'tcx>, Span)>, speculative: bool) - -> ty::PolyTraitRef<'tcx> + -> (ty::PolyTraitRef<'tcx>, Option>) { - let trait_def_id = self.trait_def_id(trait_ref); + let trait_def_id = trait_ref.trait_def_id(); debug!("instantiate_poly_trait_ref({:?}, def_id={:?})", trait_ref, trait_def_id); self.prohibit_generics(trait_ref.path.segments.split_last().unwrap().1); - let (substs, assoc_bindings) = - self.create_substs_for_ast_trait_ref(trait_ref.path.span, - trait_def_id, - self_ty, - trait_ref.path.segments.last().unwrap()); + let (substs, assoc_bindings, potential_assoc_types) = self.create_substs_for_ast_trait_ref( + trait_ref.path.span, + trait_def_id, + self_ty, + trait_ref.path.segments.last().unwrap(), + ); let poly_trait_ref = ty::Binder::bind(ty::TraitRef::new(trait_def_id, substs)); let mut dup_bindings = FxHashMap::default(); @@ -745,14 +730,14 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { debug!("instantiate_poly_trait_ref({:?}, projections={:?}) -> {:?}", trait_ref, poly_projections, poly_trait_ref); - poly_trait_ref + (poly_trait_ref, potential_assoc_types) } pub fn instantiate_poly_trait_ref(&self, poly_trait_ref: &hir::PolyTraitRef, self_ty: Ty<'tcx>, poly_projections: &mut Vec<(ty::PolyProjectionPredicate<'tcx>, Span)>) - -> ty::PolyTraitRef<'tcx> + -> (ty::PolyTraitRef<'tcx>, Option>) { self.instantiate_poly_trait_ref_inner(&poly_trait_ref.trait_ref, self_ty, poly_projections, false) @@ -765,7 +750,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { trait_segment: &hir::PathSegment) -> ty::TraitRef<'tcx> { - let (substs, assoc_bindings) = + let (substs, assoc_bindings, _) = self.create_substs_for_ast_trait_ref(span, trait_def_id, self_ty, @@ -774,13 +759,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { ty::TraitRef::new(trait_def_id, substs) } - fn create_substs_for_ast_trait_ref(&self, - span: Span, - trait_def_id: DefId, - self_ty: Ty<'tcx>, - trait_segment: &hir::PathSegment) - -> (&'tcx Substs<'tcx>, Vec>) - { + fn create_substs_for_ast_trait_ref( + &self, + span: Span, + trait_def_id: DefId, + self_ty: Ty<'tcx>, + trait_segment: &hir::PathSegment, + ) -> (&'tcx Substs<'tcx>, Vec>, Option>) { debug!("create_substs_for_ast_trait_ref(trait_segment={:?})", trait_segment); @@ -970,9 +955,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { let mut projection_bounds = Vec::new(); let dummy_self = tcx.mk_ty(TRAIT_OBJECT_DUMMY_SELF); - let principal = self.instantiate_poly_trait_ref(&trait_bounds[0], - dummy_self, - &mut projection_bounds); + let (principal, potential_assoc_types) = self.instantiate_poly_trait_ref( + &trait_bounds[0], + dummy_self, + &mut projection_bounds, + ); debug!("principal: {:?}", principal); for trait_bound in trait_bounds[1..].iter() { @@ -1009,6 +996,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { let mut associated_types = BTreeSet::default(); for tr in traits::elaborate_trait_ref(tcx, principal) { + debug!("conv_object_ty_poly_trait_ref: observing object predicate `{:?}`", tr); match tr { ty::Predicate::Trait(pred) => { associated_types.extend(tcx.associated_items(pred.def_id()) @@ -1016,8 +1004,31 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { .map(|item| item.def_id)); } ty::Predicate::Projection(pred) => { - // Include projections defined on supertraits. - projection_bounds.push((pred, DUMMY_SP)) + // A `Self` within the original bound will be substituted with a + // `TRAIT_OBJECT_DUMMY_SELF`, so check for that. + let references_self = + pred.skip_binder().ty.walk().any(|t| t == dummy_self); + + // If the projection output contains `Self`, force the user to + // elaborate it explicitly to avoid a bunch of complexity. + // + // The "classicaly useful" case is the following: + // ``` + // trait MyTrait: FnMut() -> ::MyOutput { + // type MyOutput; + // } + // ``` + // + // Here, the user could theoretically write `dyn MyTrait`, + // but actually supporting that would "expand" to an infinitely-long type + // `fix $ τ → dyn MyTrait::MyOutput`. + // + // Instead, we force the user to write `dyn MyTrait`, + // which is uglier but works. See the discussion in #56288 for alternatives. + if !references_self { + // Include projections defined on supertraits, + projection_bounds.push((pred, DUMMY_SP)) + } } _ => () } @@ -1027,16 +1038,71 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { associated_types.remove(&projection_bound.projection_def_id()); } - for item_def_id in associated_types { - let assoc_item = tcx.associated_item(item_def_id); - let trait_def_id = assoc_item.container.id(); - struct_span_err!(tcx.sess, span, E0191, "the value of the associated type `{}` \ - (from the trait `{}`) must be specified", - assoc_item.ident, - tcx.item_path_str(trait_def_id)) - .span_label(span, format!("missing associated type `{}` value", - assoc_item.ident)) - .emit(); + if !associated_types.is_empty() { + let names = associated_types.iter().map(|item_def_id| { + let assoc_item = tcx.associated_item(*item_def_id); + let trait_def_id = assoc_item.container.id(); + format!( + "`{}` (from the trait `{}`)", + assoc_item.ident, + tcx.item_path_str(trait_def_id), + ) + }).collect::>().join(", "); + let mut err = struct_span_err!( + tcx.sess, + span, + E0191, + "the value of the associated type{} {} must be specified", + if associated_types.len() == 1 { "" } else { "s" }, + names, + ); + let mut suggest = false; + let mut potential_assoc_types_spans = vec![]; + if let Some(potential_assoc_types) = potential_assoc_types { + if potential_assoc_types.len() == associated_types.len() { + // Only suggest when the amount of missing associated types is equals to the + // extra type arguments present, as that gives us a relatively high confidence + // that the user forgot to give the associtated type's name. The canonical + // example would be trying to use `Iterator` instead of + // `Iterator`. + suggest = true; + potential_assoc_types_spans = potential_assoc_types; + } + } + let mut suggestions = vec![]; + for (i, item_def_id) in associated_types.iter().enumerate() { + let assoc_item = tcx.associated_item(*item_def_id); + err.span_label( + span, + format!("associated type `{}` must be specified", assoc_item.ident), + ); + if item_def_id.is_local() { + err.span_label( + tcx.def_span(*item_def_id), + format!("`{}` defined here", assoc_item.ident), + ); + } + if suggest { + if let Ok(snippet) = tcx.sess.source_map().span_to_snippet( + potential_assoc_types_spans[i], + ) { + suggestions.push(( + potential_assoc_types_spans[i], + format!("{} = {}", assoc_item.ident, snippet), + )); + } + } + } + if !suggestions.is_empty() { + let msg = format!("if you meant to specify the associated {}, write", + if suggestions.len() == 1 { "type" } else { "types" }); + err.multipart_suggestion( + &msg, + suggestions, + Applicability::MaybeIncorrect, + ); + } + err.emit(); } // Erase the `dummy_self` (`TRAIT_OBJECT_DUMMY_SELF`) used above. @@ -1059,13 +1125,19 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { auto_traits.dedup(); // Calling `skip_binder` is okay, because the predicates are re-bound. + let principal = if tcx.trait_is_auto(existential_principal.def_id()) { + ty::ExistentialPredicate::AutoTrait(existential_principal.def_id()) + } else { + ty::ExistentialPredicate::Trait(*existential_principal.skip_binder()) + }; let mut v = - iter::once(ty::ExistentialPredicate::Trait(*existential_principal.skip_binder())) + iter::once(principal) .chain(auto_traits.into_iter().map(ty::ExistentialPredicate::AutoTrait)) .chain(existential_projections .map(|x| ty::ExistentialPredicate::Projection(*x.skip_binder()))) .collect::>(); v.sort_by(|a, b| a.stable_cmp(tcx, b)); + v.dedup(); let existential_predicates = ty::Binder::bind(tcx.mk_existential_predicates(v.into_iter())); // Use explicitly-specified region bound. @@ -1073,7 +1145,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { self.ast_region_to_region(lifetime, None) } else { self.compute_object_lifetime_bound(span, existential_predicates).unwrap_or_else(|| { - let hir_id = tcx.hir.node_to_hir_id(lifetime.id); + let hir_id = tcx.hir().node_to_hir_id(lifetime.id); if tcx.named_region(hir_id).is_some() { self.ast_region_to_region(lifetime, None) } else { @@ -1100,7 +1172,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { trait_str: &str, name: &str) { struct_span_err!(self.tcx().sess, span, E0223, "ambiguous associated type") - .span_suggestion_with_applicability( + .span_suggestion( span, "use fully-qualified syntax", format!("<{} as {}>::{}", type_str, trait_str, name), @@ -1128,8 +1200,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { let suitable_bounds = traits::transitive_bounds(tcx, bounds) .filter(|b| self.trait_defines_associated_type_named(b.def_id(), assoc_name)); - let param_node_id = tcx.hir.as_local_node_id(ty_param_def_id).unwrap(); - let param_name = tcx.hir.ty_param_name(param_node_id); + let param_node_id = tcx.hir().as_local_node_id(ty_param_def_id).unwrap(); + let param_name = tcx.hir().ty_param_name(param_node_id); self.one_bound_for_assoc_type(suitable_bounds, ¶m_name.as_str(), assoc_name, @@ -1173,7 +1245,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { item.kind == ty::AssociatedKind::Type && self.tcx().hygienic_eq(assoc_name, item.ident, bound.def_id()) }) - .and_then(|item| self.tcx().hir.span_if_local(item.def_id)); + .and_then(|item| self.tcx().hir().span_if_local(item.def_id)); if let Some(span) = bound_span { err.span_label(span, format!("ambiguous `{}` from `{}`", @@ -1193,31 +1265,52 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { } // Create a type from a path to an associated type. - // For a path `A::B::C::D`, `ty` and `ty_path_def` are the type and def for `A::B::C` + // For a path `A::B::C::D`, `qself_ty` and `qself_def` are the type and def for `A::B::C` // and item_segment is the path segment for `D`. We return a type and a def for // the whole path. - // Will fail except for `T::A` and `Self::A`; i.e., if `ty`/`ty_path_def` are not a type + // Will fail except for `T::A` and `Self::A`; i.e., if `qself_ty`/`qself_def` are not a type // parameter or `Self`. - pub fn associated_path_def_to_ty(&self, - ref_id: ast::NodeId, - span: Span, - ty: Ty<'tcx>, - ty_path_def: Def, - item_segment: &hir::PathSegment) - -> (Ty<'tcx>, Def) - { + pub fn associated_path_to_ty( + &self, + ref_id: ast::NodeId, + span: Span, + qself_ty: Ty<'tcx>, + qself_def: Def, + assoc_segment: &hir::PathSegment, + permit_variants: bool, + ) -> (Ty<'tcx>, Def) { let tcx = self.tcx(); - let assoc_name = item_segment.ident; + let assoc_ident = assoc_segment.ident; - debug!("associated_path_def_to_ty: {:?}::{}", ty, assoc_name); + debug!("associated_path_to_ty: {:?}::{}", qself_ty, assoc_ident); - self.prohibit_generics(slice::from_ref(item_segment)); + self.prohibit_generics(slice::from_ref(assoc_segment)); + + // Check if we have an enum variant. + let mut variant_resolution = None; + if let ty::Adt(adt_def, _) = qself_ty.sty { + if adt_def.is_enum() { + let variant_def = adt_def.variants.iter().find(|vd| { + tcx.hygienic_eq(assoc_ident, vd.ident, adt_def.did) + }); + if let Some(variant_def) = variant_def { + let def = Def::Variant(variant_def.did); + if permit_variants { + check_type_alias_enum_variants_enabled(tcx, span); + tcx.check_stability(variant_def.did, Some(ref_id), span); + return (qself_ty, def); + } else { + variant_resolution = Some(def); + } + } + } + } // Find the type of the associated item, and the trait where the associated // item is declared. - let bound = match (&ty.sty, ty_path_def) { + let bound = match (&qself_ty.sty, qself_def) { (_, Def::SelfTy(Some(_), Some(impl_def_id))) => { - // `Self` in an impl of a trait - we have a concrete `self` type and a + // `Self` in an impl of a trait -- we have a concrete self type and a // trait reference. let trait_ref = match tcx.impl_trait_ref(impl_def_id) { Some(trait_ref) => trait_ref, @@ -1228,50 +1321,100 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { }; let candidates = traits::supertraits(tcx, ty::Binder::bind(trait_ref)) - .filter(|r| self.trait_defines_associated_type_named(r.def_id(), assoc_name)); + .filter(|r| self.trait_defines_associated_type_named(r.def_id(), assoc_ident)); - match self.one_bound_for_assoc_type(candidates, "Self", assoc_name, span) { + match self.one_bound_for_assoc_type(candidates, "Self", assoc_ident, span) { Ok(bound) => bound, Err(ErrorReported) => return (tcx.types.err, Def::Err), } } (&ty::Param(_), Def::SelfTy(Some(param_did), None)) | (&ty::Param(_), Def::TyParam(param_did)) => { - match self.find_bound_for_assoc_item(param_did, assoc_name, span) { + match self.find_bound_for_assoc_item(param_did, assoc_ident, span) { Ok(bound) => bound, Err(ErrorReported) => return (tcx.types.err, Def::Err), } } _ => { - // Don't print TyErr to the user. - if !ty.references_error() { + if variant_resolution.is_some() { + // Variant in type position + let msg = format!("expected type, found variant `{}`", assoc_ident); + tcx.sess.span_err(span, &msg); + } else if qself_ty.is_enum() { + // Report as incorrect enum variant rather than ambiguous type. + let mut err = tcx.sess.struct_span_err( + span, + &format!("no variant `{}` on enum `{}`", &assoc_ident.as_str(), qself_ty), + ); + // Check if it was a typo. + let adt_def = qself_ty.ty_adt_def().expect("enum is not an ADT"); + if let Some(suggested_name) = find_best_match_for_name( + adt_def.variants.iter().map(|variant| &variant.ident.name), + &assoc_ident.as_str(), + None, + ) { + err.span_suggestion( + span, + "did you mean", + format!("{}::{}", qself_ty, suggested_name), + Applicability::MaybeIncorrect, + ); + } else { + err.span_label(span, "unknown variant"); + } + err.emit(); + } else if !qself_ty.references_error() { + // Don't print `TyErr` to the user. self.report_ambiguous_associated_type(span, - &ty.to_string(), + &qself_ty.to_string(), "Trait", - &assoc_name.as_str()); + &assoc_ident.as_str()); } return (tcx.types.err, Def::Err); } }; let trait_did = bound.def_id(); - let (assoc_ident, def_scope) = tcx.adjust_ident(assoc_name, trait_did, ref_id); + let (assoc_ident, def_scope) = tcx.adjust_ident(assoc_ident, trait_did, ref_id); let item = tcx.associated_items(trait_did).find(|i| { Namespace::from(i.kind) == Namespace::Type && i.ident.modern() == assoc_ident - }) - .expect("missing associated type"); + }).expect("missing associated type"); let ty = self.projected_ty_from_poly_trait_ref(span, item.def_id, bound); let ty = self.normalize_ty(span, ty); let def = Def::AssociatedTy(item.def_id); if !item.vis.is_accessible_from(def_scope, tcx) { - let msg = format!("{} `{}` is private", def.kind_name(), assoc_name); + let msg = format!("{} `{}` is private", def.kind_name(), assoc_ident); tcx.sess.span_err(span, &msg); } tcx.check_stability(item.def_id, Some(ref_id), span); + if let Some(variant_def) = variant_resolution { + let mut err = tcx.struct_span_lint_node( + AMBIGUOUS_ASSOCIATED_ITEMS, + ref_id, + span, + "ambiguous associated item", + ); + + let mut could_refer_to = |def: Def, also| { + let note_msg = format!("`{}` could{} refer to {} defined here", + assoc_ident, also, def.kind_name()); + err.span_note(tcx.def_span(def.def_id()), ¬e_msg); + }; + could_refer_to(variant_def, ""); + could_refer_to(def, " also"); + + err.span_suggestion( + span, + "use fully-qualified syntax", + format!("<{} as {}>::{}", qself_ty, "Trait", assoc_ident), + Applicability::HasPlaceholders, + ).emit(); + } + (ty, def) } @@ -1311,7 +1454,9 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { self.normalize_ty(span, tcx.mk_projection(item_def_id, trait_ref.substs)) } - pub fn prohibit_generics<'a, T: IntoIterator>(&self, segments: T) { + pub fn prohibit_generics<'a, T: IntoIterator>( + &self, segments: T) -> bool { + let mut has_err = false; for segment in segments { segment.with_generic_args(|generic_args| { let (mut err_for_lt, mut err_for_ty) = (false, false); @@ -1320,32 +1465,36 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { hir::GenericArg::Lifetime(lt) => { if err_for_lt { continue } err_for_lt = true; + has_err = true; (struct_span_err!(self.tcx().sess, lt.span, E0110, - "lifetime parameters are not allowed on this type"), + "lifetime arguments are not allowed on this entity"), lt.span, "lifetime") } hir::GenericArg::Type(ty) => { if err_for_ty { continue } err_for_ty = true; + has_err = true; (struct_span_err!(self.tcx().sess, ty.span, E0109, - "type parameters are not allowed on this type"), + "type arguments are not allowed on this entity"), ty.span, "type") } }; - span_err.span_label(span, format!("{} parameter not allowed", kind)) + span_err.span_label(span, format!("{} argument not allowed", kind)) .emit(); if err_for_lt && err_for_ty { break; } } for binding in &generic_args.bindings { + has_err = true; Self::prohibit_assoc_ty_binding(self.tcx(), binding.span); break; } }) } + has_err } pub fn prohibit_assoc_ty_binding(tcx: TyCtxt, span: Span) { @@ -1354,6 +1503,134 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { err.span_label(span, "associated type not allowed here").emit(); } + pub fn def_ids_for_path_segments(&self, + segments: &[hir::PathSegment], + self_ty: Option>, + def: Def) + -> Vec { + // We need to extract the type parameters supplied by the user in + // the path `path`. Due to the current setup, this is a bit of a + // tricky-process; the problem is that resolve only tells us the + // end-point of the path resolution, and not the intermediate steps. + // Luckily, we can (at least for now) deduce the intermediate steps + // just from the end-point. + // + // There are basically five cases to consider: + // + // 1. Reference to a constructor of a struct: + // + // struct Foo(...) + // + // In this case, the parameters are declared in the type space. + // + // 2. Reference to a constructor of an enum variant: + // + // enum E { Foo(...) } + // + // In this case, the parameters are defined in the type space, + // but may be specified either on the type or the variant. + // + // 3. Reference to a fn item or a free constant: + // + // fn foo() { } + // + // In this case, the path will again always have the form + // `a::b::foo::` where only the final segment should have + // type parameters. However, in this case, those parameters are + // declared on a value, and hence are in the `FnSpace`. + // + // 4. Reference to a method or an associated constant: + // + // impl SomeStruct { + // fn foo(...) + // } + // + // Here we can have a path like + // `a::b::SomeStruct::::foo::`, in which case parameters + // may appear in two places. The penultimate segment, + // `SomeStruct::`, contains parameters in TypeSpace, and the + // final segment, `foo::` contains parameters in fn space. + // + // 5. Reference to a local variable + // + // Local variables can't have any type parameters. + // + // The first step then is to categorize the segments appropriately. + + let tcx = self.tcx(); + + assert!(!segments.is_empty()); + let last = segments.len() - 1; + + let mut path_segs = vec![]; + + match def { + // Case 1. Reference to a struct constructor. + Def::StructCtor(def_id, ..) | + Def::SelfCtor(.., def_id) => { + // Everything but the final segment should have no + // parameters at all. + let generics = tcx.generics_of(def_id); + // Variant and struct constructors use the + // generics of their parent type definition. + let generics_def_id = generics.parent.unwrap_or(def_id); + path_segs.push(PathSeg(generics_def_id, last)); + } + + // Case 2. Reference to a variant constructor. + Def::Variant(def_id) | + Def::VariantCtor(def_id, ..) => { + let adt_def = self_ty.map(|t| t.ty_adt_def().unwrap()); + let (generics_def_id, index) = if let Some(adt_def) = adt_def { + debug_assert!(adt_def.is_enum()); + (adt_def.did, last) + } else if last >= 1 && segments[last - 1].args.is_some() { + // Everything but the penultimate segment should have no + // parameters at all. + let enum_def_id = tcx.parent_def_id(def_id).unwrap(); + (enum_def_id, last - 1) + } else { + // FIXME: lint here recommending `Enum::<...>::Variant` form + // instead of `Enum::Variant::<...>` form. + + // Everything but the final segment should have no + // parameters at all. + let generics = tcx.generics_of(def_id); + // Variant and struct constructors use the + // generics of their parent type definition. + (generics.parent.unwrap_or(def_id), last) + }; + path_segs.push(PathSeg(generics_def_id, index)); + } + + // Case 3. Reference to a top-level value. + Def::Fn(def_id) | + Def::Const(def_id) | + Def::Static(def_id, _) => { + path_segs.push(PathSeg(def_id, last)); + } + + // Case 4. Reference to a method or associated const. + Def::Method(def_id) | + Def::AssociatedConst(def_id) => { + if segments.len() >= 2 { + let generics = tcx.generics_of(def_id); + path_segs.push(PathSeg(generics.parent.unwrap(), last - 1)); + } + path_segs.push(PathSeg(def_id, last)); + } + + // Case 5. Local variable, no generics. + Def::Local(..) | Def::Upvar(..) => {} + + _ => bug!("unexpected definition: {:?}", def), + } + + debug!("path_segs = {:?}", path_segs); + + path_segs + } + // Check a type `Path` and convert it to a `Ty`. pub fn def_to_ty(&self, opt_self_ty: Option>, @@ -1384,46 +1661,55 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { self.prohibit_generics(path.segments.split_last().unwrap().1); self.ast_path_to_ty(span, did, path.segments.last().unwrap()) } - Def::Variant(did) if permit_variants => { + Def::Variant(_) if permit_variants => { // Convert "variant type" as if it were a real type. // The resulting `Ty` is type of the variant's enum for now. assert_eq!(opt_self_ty, None); - self.prohibit_generics(path.segments.split_last().unwrap().1); - self.ast_path_to_ty(span, - tcx.parent_def_id(did).unwrap(), - path.segments.last().unwrap()) + + let path_segs = self.def_ids_for_path_segments(&path.segments, None, path.def); + let generic_segs: FxHashSet<_> = + path_segs.iter().map(|PathSeg(_, index)| index).collect(); + self.prohibit_generics(path.segments.iter().enumerate().filter_map(|(index, seg)| { + if !generic_segs.contains(&index) { + Some(seg) + } else { + None + } + })); + + let PathSeg(def_id, index) = path_segs.last().unwrap(); + self.ast_path_to_ty(span, *def_id, &path.segments[*index]) } Def::TyParam(did) => { assert_eq!(opt_self_ty, None); self.prohibit_generics(&path.segments); - let node_id = tcx.hir.as_local_node_id(did).unwrap(); - let item_id = tcx.hir.get_parent_node(node_id); - let item_def_id = tcx.hir.local_def_id(item_id); + let node_id = tcx.hir().as_local_node_id(did).unwrap(); + let item_id = tcx.hir().get_parent_node(node_id); + let item_def_id = tcx.hir().local_def_id(item_id); let generics = tcx.generics_of(item_def_id); - let index = generics.param_def_id_to_index[&tcx.hir.local_def_id(node_id)]; - tcx.mk_ty_param(index, tcx.hir.name(node_id).as_interned_str()) + let index = generics.param_def_id_to_index[&tcx.hir().local_def_id(node_id)]; + tcx.mk_ty_param(index, tcx.hir().name(node_id).as_interned_str()) } Def::SelfTy(_, Some(def_id)) => { - // `Self` in impl (we know the concrete type) - + // `Self` in impl (we know the concrete type). assert_eq!(opt_self_ty, None); self.prohibit_generics(&path.segments); - tcx.at(span).type_of(def_id) } Def::SelfTy(Some(_), None) => { - // `Self` in trait + // `Self` in trait. assert_eq!(opt_self_ty, None); self.prohibit_generics(&path.segments); tcx.mk_self_type() } Def::AssociatedTy(def_id) => { - self.prohibit_generics(&path.segments[..path.segments.len()-2]); + debug_assert!(path.segments.len() >= 2); + self.prohibit_generics(&path.segments[..path.segments.len() - 2]); self.qpath_to_ty(span, opt_self_ty, def_id, - &path.segments[path.segments.len()-2], + &path.segments[path.segments.len() - 2], path.segments.last().unwrap()) } Def::PrimTy(prim_ty) => { @@ -1491,7 +1777,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { self.def_to_ty(opt_self_ty, path, false) } hir::TyKind::Def(item_id, ref lifetimes) => { - let did = tcx.hir.local_def_id(item_id.id); + let did = tcx.hir().local_def_id(item_id.id); self.impl_trait_ty_to_ty(did, lifetimes) }, hir::TyKind::Path(hir::QPath::TypeRelative(ref qself, ref segment)) => { @@ -1503,12 +1789,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { } else { Def::Err }; - self.associated_path_def_to_ty(ast_ty.id, ast_ty.span, ty, def, segment).0 + self.associated_path_to_ty(ast_ty.id, ast_ty.span, ty, def, segment, false).0 } hir::TyKind::Array(ref ty, ref length) => { - let length_def_id = tcx.hir.local_def_id(length.id); + let length_def_id = tcx.hir().local_def_id(length.id); let substs = Substs::identity_for_item(tcx, length_def_id); - let length = ty::Const::unevaluated(tcx, length_def_id, substs, tcx.types.usize); + let length = ty::LazyConst::Unevaluated(length_def_id, substs); + let length = tcx.intern_lazy_const(length); let array_ty = tcx.mk_ty(ty::Array(self.ast_ty_to_ty(&ty), length)); self.normalize_ty(ast_ty.span, array_ty) } @@ -1699,8 +1986,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { } } -/// Divides a list of general trait bounds into two groups: auto traits (e.g. Sync and Send) and the -/// remaining general trait bounds. +/// Divides a list of general trait bounds into two groups: auto traits (e.g., Sync and Send) and +/// the remaining general trait bounds. fn split_auto_traits<'a, 'b, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, trait_bounds: &'b [hir::PolyTraitRef]) -> (Vec, Vec<&'b hir::PolyTraitRef>) @@ -1740,7 +2027,7 @@ impl<'a, 'gcx, 'tcx> Bounds<'tcx> { pub fn predicates(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, param_ty: Ty<'tcx>) -> Vec<(ty::Predicate<'tcx>, Span)> { - // If it could be sized, and is, add the sized predicate + // If it could be sized, and is, add the sized predicate. let sized_predicate = self.implicitly_sized.and_then(|span| { tcx.lang_items().sized_trait().map(|sized| { let trait_ref = ty::TraitRef { @@ -1753,8 +2040,8 @@ impl<'a, 'gcx, 'tcx> Bounds<'tcx> { sized_predicate.into_iter().chain( self.region_bounds.iter().map(|&(region_bound, span)| { - // account for the binder being introduced below; no need to shift `param_ty` - // because, at present at least, it can only refer to early-bound regions + // Account for the binder being introduced below; no need to shift `param_ty` + // because, at present at least, it can only refer to early-bound regions. let region_bound = ty::fold::shift_region(tcx, region_bound, 1); let outlives = ty::OutlivesPredicate(param_ty, region_bound); (ty::Binder::dummy(outlives).to_predicate(), span) diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index a477df6ae2d..4203c71a00a 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -1,13 +1,6 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +use check::{FnCtxt, Expectation, Diverges, Needs}; +use check::coercion::CoerceMany; +use errors::Applicability; use rustc::hir::{self, PatKind}; use rustc::hir::def::{Def, CtorKind}; use rustc::hir::pat_util::EnumerateAndAdjustIterator; @@ -15,34 +8,46 @@ use rustc::infer; use rustc::infer::type_variable::TypeVariableOrigin; use rustc::traits::ObligationCauseCode; use rustc::ty::{self, Ty, TypeFoldable}; -use check::{FnCtxt, Expectation, Diverges, Needs}; -use check::coercion::CoerceMany; -use util::nodemap::FxHashMap; - -use std::collections::hash_map::Entry::{Occupied, Vacant}; -use std::cmp; use syntax::ast; use syntax::source_map::Spanned; use syntax::ptr::P; use syntax::util::lev_distance::find_best_match_for_name; use syntax_pos::Span; +use util::nodemap::FxHashMap; + +use std::collections::hash_map::Entry::{Occupied, Vacant}; +use std::cmp; + +use super::report_unexpected_variant_def; impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { - /// The `is_arg` argument indicates whether this pattern is the - /// *outermost* pattern in an argument (e.g., in `fn foo(&x: - /// &u32)`, it is true for the `&x` pattern but not `x`). This is - /// used to tailor error reporting. + /// `match_discrim_span` argument having a `Span` indicates that this pattern is part of + /// a match expression arm guard, and it points to the match discriminant to add context + /// in type errors. In the folloowing example, `match_discrim_span` corresponds to the + /// `a + b` expression: + /// + /// ```text + /// error[E0308]: mismatched types + /// --> src/main.rs:5:9 + /// | + /// 4 | let temp: usize = match a + b { + /// | ----- this expression has type `usize` + /// 5 | Ok(num) => num, + /// | ^^^^^^^ expected usize, found enum `std::result::Result` + /// | + /// = note: expected type `usize` + /// found type `std::result::Result<_, _>` + /// ``` pub fn check_pat_walk( &self, pat: &'gcx hir::Pat, mut expected: Ty<'tcx>, mut def_bm: ty::BindingMode, - is_arg: bool) - { + match_discrim_span: Option, + ) { let tcx = self.tcx; - debug!("check_pat_walk(pat={:?},expected={:?},def_bm={:?},is_arg={})", - pat, expected, def_bm, is_arg); + debug!("check_pat_walk(pat={:?},expected={:?},def_bm={:?})", pat, expected, def_bm); let is_non_ref_pat = match pat.node { PatKind::Struct(..) | @@ -218,8 +223,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let common_type = self.resolve_type_vars_if_possible(&lhs_ty); // subtyping doesn't matter here, as the value is some kind of scalar - self.demand_eqtype(pat.span, expected, lhs_ty); - self.demand_eqtype(pat.span, expected, rhs_ty); + self.demand_eqtype_pat(pat.span, expected, lhs_ty, match_discrim_span); + self.demand_eqtype_pat(pat.span, expected, rhs_ty, match_discrim_span); common_type } PatKind::Binding(ba, var_id, _, ref sub) => { @@ -248,13 +253,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // `x` is assigned a value of type `&M T`, hence `&M T <: typeof(x)` is // required. However, we use equality, which is stronger. See (*) for // an explanation. - self.demand_eqtype(pat.span, region_ty, local_ty); + self.demand_eqtype_pat(pat.span, region_ty, local_ty, match_discrim_span); } // otherwise the type of x is the expected type T ty::BindByValue(_) => { // As above, `T <: typeof(x)` is required but we // use equality, see (*) below. - self.demand_eqtype(pat.span, expected, local_ty); + self.demand_eqtype_pat(pat.span, expected, local_ty, match_discrim_span); } } @@ -262,28 +267,36 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // what the type of the binding `x` ought to be if var_id != pat.id { let vt = self.local_ty(pat.span, var_id).decl_ty; - self.demand_eqtype(pat.span, vt, local_ty); + self.demand_eqtype_pat(pat.span, vt, local_ty, match_discrim_span); } if let Some(ref p) = *sub { - self.check_pat_walk(&p, expected, def_bm, true); + self.check_pat_walk(&p, expected, def_bm, match_discrim_span); } local_ty } PatKind::TupleStruct(ref qpath, ref subpats, ddpos) => { - self.check_pat_tuple_struct(pat, qpath, &subpats, ddpos, expected, def_bm) + self.check_pat_tuple_struct( + pat, + qpath, + &subpats, + ddpos, + expected, + def_bm, + match_discrim_span, + ) } PatKind::Path(ref qpath) => { self.check_pat_path(pat, qpath, expected) } PatKind::Struct(ref qpath, ref fields, etc) => { - self.check_pat_struct(pat, qpath, fields, etc, expected, def_bm) + self.check_pat_struct(pat, qpath, fields, etc, expected, def_bm, match_discrim_span) } PatKind::Tuple(ref elements, ddpos) => { let mut expected_len = elements.len(); if ddpos.is_some() { - // Require known type only when `..` is present + // Require known type only when `..` is present. if let ty::Tuple(ref tys) = self.structurally_resolved_type(pat.span, expected).sty { expected_len = tys.len(); @@ -292,8 +305,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let max_len = cmp::max(expected_len, elements.len()); let element_tys_iter = (0..max_len).map(|_| self.next_ty_var( - // FIXME: MiscVariable for now, obtaining the span and name information - // from all tuple elements isn't trivial. + // FIXME: `MiscVariable` for now -- obtaining the span and name information + // from all tuple elements isn't trivial. TypeVariableOrigin::TypeInference(pat.span))); let element_tys = tcx.mk_type_list(element_tys_iter); let pat_ty = tcx.mk_ty(ty::Tuple(element_tys)); @@ -303,12 +316,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // further errors being emitted when using the bindings. #50333 let element_tys_iter = (0..max_len).map(|_| tcx.types.err); for (_, elem) in elements.iter().enumerate_and_adjust(max_len, ddpos) { - self.check_pat_walk(elem, &tcx.types.err, def_bm, true); + self.check_pat_walk(elem, &tcx.types.err, def_bm, match_discrim_span); } tcx.mk_tup(element_tys_iter) } else { for (i, elem) in elements.iter().enumerate_and_adjust(max_len, ddpos) { - self.check_pat_walk(elem, &element_tys[i], def_bm, true); + self.check_pat_walk(elem, &element_tys[i], def_bm, match_discrim_span); } pat_ty } @@ -321,11 +334,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Here, `demand::subtype` is good enough, but I don't // think any errors can be introduced by using // `demand::eqtype`. - self.demand_eqtype(pat.span, expected, uniq_ty); - self.check_pat_walk(&inner, inner_ty, def_bm, true); + self.demand_eqtype_pat(pat.span, expected, uniq_ty, match_discrim_span); + self.check_pat_walk(&inner, inner_ty, def_bm, match_discrim_span); uniq_ty } else { - self.check_pat_walk(&inner, tcx.types.err, def_bm, true); + self.check_pat_walk(&inner, tcx.types.err, def_bm, match_discrim_span); tcx.types.err } } @@ -357,15 +370,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Look for a case like `fn foo(&foo: u32)` and suggest // `fn foo(foo: &u32)` if let Some(mut err) = err { - if is_arg { - if let PatKind::Binding(..) = inner.node { - if let Ok(snippet) = tcx.sess.source_map() - .span_to_snippet(pat.span) - { - err.help(&format!("did you mean `{}: &{}`?", - &snippet[1..], - expected)); - } + if let PatKind::Binding(..) = inner.node { + if let Ok(snippet) = tcx.sess.source_map() + .span_to_snippet(pat.span) + { + err.help(&format!("did you mean `{}: &{}`?", + &snippet[1..], + expected)); } } err.emit(); @@ -374,10 +385,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } }; - self.check_pat_walk(&inner, inner_ty, def_bm, true); + self.check_pat_walk(&inner, inner_ty, def_bm, match_discrim_span); rptr_ty } else { - self.check_pat_walk(&inner, tcx.types.err, def_bm, true); + self.check_pat_walk(&inner, tcx.types.err, def_bm, match_discrim_span); tcx.types.err } } @@ -435,13 +446,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }; for elt in before { - self.check_pat_walk(&elt, inner_ty, def_bm, true); + self.check_pat_walk(&elt, inner_ty, def_bm, match_discrim_span); } if let Some(ref slice) = *slice { - self.check_pat_walk(&slice, slice_ty, def_bm, true); + self.check_pat_walk(&slice, slice_ty, def_bm, match_discrim_span); } for elt in after { - self.check_pat_walk(&elt, inner_ty, def_bm, true); + self.check_pat_walk(&elt, inner_ty, def_bm, match_discrim_span); } expected_ty } @@ -532,12 +543,14 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); true } - pub fn check_match(&self, - expr: &'gcx hir::Expr, - discrim: &'gcx hir::Expr, - arms: &'gcx [hir::Arm], - expected: Expectation<'tcx>, - match_src: hir::MatchSource) -> Ty<'tcx> { + pub fn check_match( + &self, + expr: &'gcx hir::Expr, + discrim: &'gcx hir::Expr, + arms: &'gcx [hir::Arm], + expected: Expectation<'tcx>, + match_src: hir::MatchSource, + ) -> Ty<'tcx> { let tcx = self.tcx; // Not entirely obvious: if matches may create ref bindings, we want to @@ -545,7 +558,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); // the "discriminant type" (issue #23116). // // arielb1 [writes here in this comment thread][c] that there - // is certainly *some* potential danger, e.g. for an example + // is certainly *some* potential danger, e.g., for an example // like: // // [c]: https://github.com/rust-lang/rust/pull/43399#discussion_r130223956 @@ -632,8 +645,12 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); let mut all_pats_diverge = Diverges::WarnedAlways; for p in &arm.pats { self.diverges.set(Diverges::Maybe); - self.check_pat_walk(&p, discrim_ty, - ty::BindingMode::BindByValue(hir::Mutability::MutImmutable), true); + self.check_pat_walk( + &p, + discrim_ty, + ty::BindingMode::BindByValue(hir::Mutability::MutImmutable), + Some(discrim.span), + ); all_pats_diverge &= self.diverges.get(); } @@ -711,28 +728,36 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); coercion.complete(self) } - fn check_pat_struct(&self, - pat: &'gcx hir::Pat, - qpath: &hir::QPath, - fields: &'gcx [Spanned], - etc: bool, - expected: Ty<'tcx>, - def_bm: ty::BindingMode) -> Ty<'tcx> + fn check_pat_struct( + &self, + pat: &'gcx hir::Pat, + qpath: &hir::QPath, + fields: &'gcx [Spanned], + etc: bool, + expected: Ty<'tcx>, + def_bm: ty::BindingMode, + match_discrim_span: Option, + ) -> Ty<'tcx> { // Resolve the path and check the definition for errors. let (variant, pat_ty) = if let Some(variant_ty) = self.check_struct_path(qpath, pat.id) { variant_ty } else { for field in fields { - self.check_pat_walk(&field.node.pat, self.tcx.types.err, def_bm, true); + self.check_pat_walk( + &field.node.pat, + self.tcx.types.err, + def_bm, + match_discrim_span, + ); } return self.tcx.types.err; }; - // Type check the path. - self.demand_eqtype(pat.span, expected, pat_ty); + // Type-check the path. + self.demand_eqtype_pat(pat.span, expected, pat_ty, match_discrim_span); - // Type check subpatterns. + // Type-check subpatterns. if self.check_struct_pat_fields(pat_ty, pat.id, pat.span, variant, fields, etc, def_bm) { pat_ty } else { @@ -740,18 +765,13 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); } } - fn check_pat_path(&self, - pat: &hir::Pat, - qpath: &hir::QPath, - expected: Ty<'tcx>) -> Ty<'tcx> - { + fn check_pat_path( + &self, + pat: &hir::Pat, + qpath: &hir::QPath, + expected: Ty<'tcx>, + ) -> Ty<'tcx> { let tcx = self.tcx; - let report_unexpected_def = |def: Def| { - span_err!(tcx.sess, pat.span, E0533, - "expected unit struct/variant or constant, found {} `{}`", - def.kind_name(), - hir::print::to_string(&tcx.hir, |s| s.print_qpath(qpath, false))); - }; // Resolve the path and check the definition for errors. let (def, opt_ty, segments) = self.resolve_ty_and_def_ufcs(qpath, pat.id, pat.span); @@ -761,7 +781,12 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); return tcx.types.err; } Def::Method(..) => { - report_unexpected_def(def); + report_unexpected_variant_def(tcx, &def, pat.span, qpath); + return tcx.types.err; + } + Def::VariantCtor(_, CtorKind::Fictive) | + Def::VariantCtor(_, CtorKind::Fn) => { + report_unexpected_variant_def(tcx, &def, pat.span, qpath); return tcx.types.err; } Def::VariantCtor(_, CtorKind::Const) | @@ -771,30 +796,32 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); _ => bug!("unexpected pattern definition: {:?}", def) } - // Type check the path. + // Type-check the path. let pat_ty = self.instantiate_value_path(segments, opt_ty, def, pat.span, pat.id).0; self.demand_suptype(pat.span, expected, pat_ty); pat_ty } - fn check_pat_tuple_struct(&self, - pat: &hir::Pat, - qpath: &hir::QPath, - subpats: &'gcx [P], - ddpos: Option, - expected: Ty<'tcx>, - def_bm: ty::BindingMode) -> Ty<'tcx> - { + fn check_pat_tuple_struct( + &self, + pat: &hir::Pat, + qpath: &hir::QPath, + subpats: &'gcx [P], + ddpos: Option, + expected: Ty<'tcx>, + def_bm: ty::BindingMode, + match_arm_pat_span: Option, + ) -> Ty<'tcx> { let tcx = self.tcx; let on_error = || { for pat in subpats { - self.check_pat_walk(&pat, tcx.types.err, def_bm, true); + self.check_pat_walk(&pat, tcx.types.err, def_bm, match_arm_pat_span); } }; let report_unexpected_def = |def: Def| { let msg = format!("expected tuple struct/variant, found {} `{}`", def.kind_name(), - hir::print::to_string(&tcx.hir, |s| s.print_qpath(qpath, false))); + hir::print::to_string(tcx.hir(), |s| s.print_qpath(qpath, false))); struct_span_err!(tcx.sess, pat.span, E0164, "{}", msg) .span_label(pat.span, "not a tuple variant or struct").emit(); on_error(); @@ -808,7 +835,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); return self.tcx.types.err; } - // Type check the path. + // Type-check the path. let (pat_ty, def) = self.instantiate_value_path(segments, opt_ty, def, pat.span, pat.id); if !pat_ty.is_fn() { report_unexpected_def(def); @@ -836,9 +863,9 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); let pat_ty = pat_ty.fn_sig(tcx).output(); let pat_ty = pat_ty.no_bound_vars().expect("expected fn type"); - self.demand_eqtype(pat.span, expected, pat_ty); + self.demand_eqtype_pat(pat.span, expected, pat_ty, match_arm_pat_span); - // Type check subpatterns. + // Type-check subpatterns. if subpats.len() == variant.fields.len() || subpats.len() < variant.fields.len() && ddpos.is_some() { let substs = match pat_ty.sty { @@ -847,7 +874,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); }; for (i, subpat) in subpats.iter().enumerate_and_adjust(variant.fields.len(), ddpos) { let field_ty = self.field_ty(subpat.span, &variant.fields[i], substs); - self.check_pat_walk(&subpat, field_ty, def_bm, true); + self.check_pat_walk(&subpat, field_ty, def_bm, match_arm_pat_span); self.tcx.check_stability(variant.fields[i].did, Some(pat.id), subpat.span); } @@ -927,7 +954,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); } }; - self.check_pat_walk(&field.pat, field_ty, def_bm, true); + self.check_pat_walk(&field.pat, field_ty, def_bm, None); } let mut unmentioned_fields = variant.fields .iter() @@ -962,9 +989,15 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); if plural == "" { let input = unmentioned_fields.iter().map(|field| &field.name); let suggested_name = - find_best_match_for_name(input, &ident.name.as_str(), None); + find_best_match_for_name(input, &ident.as_str(), None); if let Some(suggested_name) = suggested_name { - err.span_suggestion(*span, "did you mean", suggested_name.to_string()); + err.span_suggestion( + *span, + "did you mean", + suggested_name.to_string(), + Applicability::MaybeIncorrect, + ); + // we don't want to throw `E0027` in case we have thrown `E0026` for them unmentioned_fields.retain(|&x| x.as_str() != suggested_name.as_str()); } diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 73489309d07..35ac4f3957e 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -1,27 +1,15 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use astconv::AstConv; - use super::{FnCtxt, PlaceOp, Needs}; use super::method::MethodCallee; -use rustc::infer::InferOk; +use rustc::infer::{InferCtxt, InferOk}; use rustc::session::DiagnosticMessageId; -use rustc::traits; -use rustc::ty::{self, Ty, TraitRef}; +use rustc::traits::{self, TraitEngine}; +use rustc::ty::{self, Ty, TyCtxt, TraitRef}; use rustc::ty::{ToPredicate, TypeFoldable}; use rustc::ty::adjustment::{Adjustment, Adjust, OverloadedDeref}; use syntax_pos::Span; -use syntax::ast::Ident; +use syntax::ast::{self, Ident}; use std::iter; @@ -32,20 +20,24 @@ enum AutoderefKind { } pub struct Autoderef<'a, 'gcx: 'tcx, 'tcx: 'a> { - fcx: &'a FnCtxt<'a, 'gcx, 'tcx>, + infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, + body_id: ast::NodeId, + param_env: ty::ParamEnv<'tcx>, steps: Vec<(Ty<'tcx>, AutoderefKind)>, cur_ty: Ty<'tcx>, obligations: Vec>, at_start: bool, include_raw_pointers: bool, span: Span, + silence_errors: bool, + reached_recursion_limit: bool } impl<'a, 'gcx, 'tcx> Iterator for Autoderef<'a, 'gcx, 'tcx> { type Item = (Ty<'tcx>, usize); fn next(&mut self) -> Option { - let tcx = self.fcx.tcx; + let tcx = self.infcx.tcx; debug!("autoderef: steps={:?}, cur_ty={:?}", self.steps, @@ -57,24 +49,10 @@ impl<'a, 'gcx, 'tcx> Iterator for Autoderef<'a, 'gcx, 'tcx> { } if self.steps.len() >= *tcx.sess.recursion_limit.get() { - // We've reached the recursion limit, error gracefully. - let suggested_limit = *tcx.sess.recursion_limit.get() * 2; - let msg = format!("reached the recursion limit while auto-dereferencing {:?}", - self.cur_ty); - let error_id = (DiagnosticMessageId::ErrorId(55), Some(self.span), msg); - let fresh = tcx.sess.one_time_diagnostics.borrow_mut().insert(error_id); - if fresh { - struct_span_err!(tcx.sess, - self.span, - E0055, - "reached the recursion limit while auto-dereferencing {:?}", - self.cur_ty) - .span_label(self.span, "deref recursion limit reached") - .help(&format!( - "consider adding a `#![recursion_limit=\"{}\"]` attribute to your crate", - suggested_limit)) - .emit(); + if !self.silence_errors { + report_autoderef_recursion_limit_error(tcx, self.span, self.cur_ty); } + self.reached_recursion_limit = true; return None; } @@ -107,10 +85,32 @@ impl<'a, 'gcx, 'tcx> Iterator for Autoderef<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { + pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + body_id: ast::NodeId, + span: Span, + base_ty: Ty<'tcx>) + -> Autoderef<'a, 'gcx, 'tcx> + { + Autoderef { + infcx, + body_id, + param_env, + steps: vec![], + cur_ty: infcx.resolve_type_vars_if_possible(&base_ty), + obligations: vec![], + at_start: true, + include_raw_pointers: false, + silence_errors: false, + reached_recursion_limit: false, + span, + } + } + fn overloaded_deref_ty(&mut self, ty: Ty<'tcx>) -> Option> { debug!("overloaded_deref_ty({:?})", ty); - let tcx = self.fcx.tcx(); + let tcx = self.infcx.tcx; // let trait_ref = TraitRef { @@ -118,43 +118,52 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { substs: tcx.mk_substs_trait(self.cur_ty, &[]), }; - let cause = traits::ObligationCause::misc(self.span, self.fcx.body_id); + let cause = traits::ObligationCause::misc(self.span, self.body_id); let obligation = traits::Obligation::new(cause.clone(), - self.fcx.param_env, + self.param_env, trait_ref.to_predicate()); - if !self.fcx.predicate_may_hold(&obligation) { + if !self.infcx.predicate_may_hold(&obligation) { debug!("overloaded_deref_ty: cannot match obligation"); return None; } - let mut selcx = traits::SelectionContext::new(self.fcx); - let normalized_ty = traits::normalize_projection_type(&mut selcx, - self.fcx.param_env, - ty::ProjectionTy::from_ref_and_name( - tcx, - trait_ref, - Ident::from_str("Target"), - ), - cause, - 0, - &mut self.obligations); - - debug!("overloaded_deref_ty({:?}) = {:?}", ty, normalized_ty); + let mut fulfillcx = traits::FulfillmentContext::new_in_snapshot(); + let normalized_ty = fulfillcx.normalize_projection_type( + &self.infcx, + self.param_env, + ty::ProjectionTy::from_ref_and_name( + tcx, + trait_ref, + Ident::from_str("Target"), + ), + cause); + if let Err(e) = fulfillcx.select_where_possible(&self.infcx) { + // This shouldn't happen, except for evaluate/fulfill mismatches, + // but that's not a reason for an ICE (`predicate_may_hold` is conservative + // by design). + debug!("overloaded_deref_ty: encountered errors {:?} while fulfilling", + e); + return None; + } + let obligations = fulfillcx.pending_obligations(); + debug!("overloaded_deref_ty({:?}) = ({:?}, {:?})", + ty, normalized_ty, obligations); + self.obligations.extend(obligations); - Some(self.fcx.resolve_type_vars_if_possible(&normalized_ty)) + Some(self.infcx.resolve_type_vars_if_possible(&normalized_ty)) } /// Returns the final type, generating an error if it is an /// unresolved inference variable. - pub fn unambiguous_final_ty(&self) -> Ty<'tcx> { - self.fcx.structurally_resolved_type(self.span, self.cur_ty) + pub fn unambiguous_final_ty(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { + fcx.structurally_resolved_type(self.span, self.cur_ty) } /// Returns the final type we ended up with, which may well be an /// inference variable (we will resolve it first, if possible). pub fn maybe_ambiguous_final_ty(&self) -> Ty<'tcx> { - self.fcx.resolve_type_vars_if_possible(&self.cur_ty) + self.infcx.resolve_type_vars_if_possible(&self.cur_ty) } pub fn step_count(&self) -> usize { @@ -162,19 +171,19 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { } /// Returns the adjustment steps. - pub fn adjust_steps(&self, needs: Needs) + pub fn adjust_steps(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>, needs: Needs) -> Vec> { - self.fcx.register_infer_ok_obligations(self.adjust_steps_as_infer_ok(needs)) + fcx.register_infer_ok_obligations(self.adjust_steps_as_infer_ok(fcx, needs)) } - pub fn adjust_steps_as_infer_ok(&self, needs: Needs) + pub fn adjust_steps_as_infer_ok(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>, needs: Needs) -> InferOk<'tcx, Vec>> { let mut obligations = vec![]; let targets = self.steps.iter().skip(1).map(|&(ty, _)| ty) .chain(iter::once(self.cur_ty)); let steps: Vec<_> = self.steps.iter().map(|&(source, kind)| { if let AutoderefKind::Overloaded = kind { - self.fcx.try_overloaded_deref(self.span, source, needs) + fcx.try_overloaded_deref(self.span, source, needs) .and_then(|InferOk { value: method, obligations: o }| { obligations.extend(o); if let ty::Ref(region, _, mutbl) = method.sig.output().sty { @@ -203,7 +212,7 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { } /// also dereference through raw pointer types - /// e.g. assuming ptr_to_Foo is the type `*const Foo` + /// e.g., assuming ptr_to_Foo is the type `*const Foo` /// fcx.autoderef(span, ptr_to_Foo) => [*const Foo] /// fcx.autoderef(span, ptr_to_Foo).include_raw_ptrs() => [*const Foo, Foo] pub fn include_raw_pointers(mut self) -> Self { @@ -211,8 +220,16 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { self } - pub fn finalize(self) { - let fcx = self.fcx; + pub fn silence_errors(mut self) -> Self { + self.silence_errors = true; + self + } + + pub fn reached_recursion_limit(&self) -> bool { + self.reached_recursion_limit + } + + pub fn finalize(self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) { fcx.register_predicates(self.into_obligations()); } @@ -221,17 +238,32 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { } } +pub fn report_autoderef_recursion_limit_error<'a, 'gcx, 'tcx>( + tcx: TyCtxt<'a, 'gcx, 'tcx>, span: Span, ty: Ty<'tcx>) +{ + // We've reached the recursion limit, error gracefully. + let suggested_limit = *tcx.sess.recursion_limit.get() * 2; + let msg = format!("reached the recursion limit while auto-dereferencing `{:?}`", + ty); + let error_id = (DiagnosticMessageId::ErrorId(55), Some(span), msg); + let fresh = tcx.sess.one_time_diagnostics.borrow_mut().insert(error_id); + if fresh { + struct_span_err!(tcx.sess, + span, + E0055, + "reached the recursion limit while auto-dereferencing `{:?}`", + ty) + .span_label(span, "deref recursion limit reached") + .help(&format!( + "consider adding a `#![recursion_limit=\"{}\"]` attribute to your crate", + suggested_limit)) + .emit(); + } +} + impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn autoderef(&'a self, span: Span, base_ty: Ty<'tcx>) -> Autoderef<'a, 'gcx, 'tcx> { - Autoderef { - fcx: self, - steps: vec![], - cur_ty: self.resolve_type_vars_if_possible(&base_ty), - obligations: vec![], - at_start: true, - include_raw_pointers: false, - span, - } + Autoderef::new(self, self.param_env, self.body_id, span, base_ty) } pub fn try_overloaded_deref(&self, diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index 7a71cf57a2f..0afc1697d31 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -1,26 +1,17 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use super::{Expectation, FnCtxt, Needs, TupleArgumentsFlag}; use super::autoderef::Autoderef; use super::method::MethodCallee; +use super::{Expectation, FnCtxt, Needs, TupleArgumentsFlag}; +use errors::Applicability; use hir::def::Def; use hir::def_id::{DefId, LOCAL_CRATE}; +use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; +use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc::{infer, traits}; -use rustc::ty::{self, TyCtxt, TypeFoldable, Ty}; -use rustc::ty::adjustment::{Adjustment, Adjust, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; +use rustc::infer::type_variable::TypeVariableOrigin; use rustc_target::spec::abi; use syntax::ast::Ident; use syntax_pos::Span; -use errors::Applicability; use rustc::hir; @@ -38,26 +29,27 @@ pub fn check_legal_trait_for_method_call(tcx: TyCtxt, span: Span, trait_id: DefI enum CallStep<'tcx> { Builtin(Ty<'tcx>), DeferredClosure(ty::FnSig<'tcx>), - /// e.g. enum variant constructors + /// e.g., enum variant constructors Overloaded(MethodCallee<'tcx>), } impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { - pub fn check_call(&self, - call_expr: &'gcx hir::Expr, - callee_expr: &'gcx hir::Expr, - arg_exprs: &'gcx [hir::Expr], - expected: Expectation<'tcx>) - -> Ty<'tcx> { + pub fn check_call( + &self, + call_expr: &'gcx hir::Expr, + callee_expr: &'gcx hir::Expr, + arg_exprs: &'gcx [hir::Expr], + expected: Expectation<'tcx>, + ) -> Ty<'tcx> { let original_callee_ty = self.check_expr(callee_expr); let expr_ty = self.structurally_resolved_type(call_expr.span, original_callee_ty); let mut autoderef = self.autoderef(callee_expr.span, expr_ty); let mut result = None; while result.is_none() && autoderef.next().is_some() { - result = self.try_overloaded_call_step(call_expr, callee_expr, &autoderef); + result = self.try_overloaded_call_step(call_expr, callee_expr, arg_exprs, &autoderef); } - autoderef.finalize(); + autoderef.finalize(self); let output = match result { None => { @@ -84,20 +76,23 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { output } - fn try_overloaded_call_step(&self, - call_expr: &'gcx hir::Expr, - callee_expr: &'gcx hir::Expr, - autoderef: &Autoderef<'a, 'gcx, 'tcx>) - -> Option> { - let adjusted_ty = autoderef.unambiguous_final_ty(); - debug!("try_overloaded_call_step(call_expr={:?}, adjusted_ty={:?})", - call_expr, - adjusted_ty); + fn try_overloaded_call_step( + &self, + call_expr: &'gcx hir::Expr, + callee_expr: &'gcx hir::Expr, + arg_exprs: &'gcx [hir::Expr], + autoderef: &Autoderef<'a, 'gcx, 'tcx>, + ) -> Option> { + let adjusted_ty = autoderef.unambiguous_final_ty(self); + debug!( + "try_overloaded_call_step(call_expr={:?}, adjusted_ty={:?})", + call_expr, adjusted_ty + ); // If the callee is a bare function or a closure, then we're all set. match adjusted_ty.sty { ty::FnDef(..) | ty::FnPtr(_) => { - let adjustments = autoderef.adjust_steps(Needs::None); + let adjustments = autoderef.adjust_steps(self, Needs::None); self.apply_adjustments(callee_expr, adjustments); return Some(CallStep::Builtin(adjusted_ty)); } @@ -110,21 +105,26 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // fnmut vs fnonce. If so, we have to defer further processing. if self.closure_kind(def_id, substs).is_none() { let closure_ty = self.closure_sig(def_id, substs); - let fn_sig = self.replace_bound_vars_with_fresh_vars( - call_expr.span, - infer::FnCall, - &closure_ty - ).0; - let adjustments = autoderef.adjust_steps(Needs::None); - self.record_deferred_call_resolution(def_id, DeferredCallResolution { - call_expr, - callee_expr, - adjusted_ty, - adjustments, - fn_sig, - closure_def_id: def_id, - closure_substs: substs, - }); + let fn_sig = self + .replace_bound_vars_with_fresh_vars( + call_expr.span, + infer::FnCall, + &closure_ty, + ) + .0; + let adjustments = autoderef.adjust_steps(self, Needs::None); + self.record_deferred_call_resolution( + def_id, + DeferredCallResolution { + call_expr, + callee_expr, + adjusted_ty, + adjustments, + fn_sig, + closure_def_id: def_id, + closure_substs: substs, + }, + ); return Some(CallStep::DeferredClosure(fn_sig)); } } @@ -144,34 +144,68 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { _ => {} } - self.try_overloaded_call_traits(call_expr, adjusted_ty).map(|(autoref, method)| { - let mut adjustments = autoderef.adjust_steps(Needs::None); - adjustments.extend(autoref); - self.apply_adjustments(callee_expr, adjustments); - CallStep::Overloaded(method) - }) + // Now, we look for the implementation of a Fn trait on the object's type. + // We first do it with the explicit instruction to look for an impl of + // `Fn`, with the tuple `Tuple` having an arity corresponding + // to the number of call parameters. + // If that fails (or_else branch), we try again without specifying the + // shape of the tuple (hence the None). This allows to detect an Fn trait + // is implemented, and use this information for diagnostic. + self.try_overloaded_call_traits(call_expr, adjusted_ty, Some(arg_exprs)) + .or_else(|| self.try_overloaded_call_traits(call_expr, adjusted_ty, None)) + .map(|(autoref, method)| { + let mut adjustments = autoderef.adjust_steps(self, Needs::None); + adjustments.extend(autoref); + self.apply_adjustments(callee_expr, adjustments); + CallStep::Overloaded(method) + }) } - fn try_overloaded_call_traits(&self, - call_expr: &hir::Expr, - adjusted_ty: Ty<'tcx>) - -> Option<(Option>, - MethodCallee<'tcx>)> { + fn try_overloaded_call_traits( + &self, + call_expr: &hir::Expr, + adjusted_ty: Ty<'tcx>, + opt_arg_exprs: Option<&'gcx [hir::Expr]>, + ) -> Option<(Option>, MethodCallee<'tcx>)> { // Try the options that are least restrictive on the caller first. - for &(opt_trait_def_id, method_name, borrow) in - &[(self.tcx.lang_items().fn_trait(), Ident::from_str("call"), true), - (self.tcx.lang_items().fn_mut_trait(), Ident::from_str("call_mut"), true), - (self.tcx.lang_items().fn_once_trait(), Ident::from_str("call_once"), false)] { + for &(opt_trait_def_id, method_name, borrow) in &[ + ( + self.tcx.lang_items().fn_trait(), + Ident::from_str("call"), + true, + ), + ( + self.tcx.lang_items().fn_mut_trait(), + Ident::from_str("call_mut"), + true, + ), + ( + self.tcx.lang_items().fn_once_trait(), + Ident::from_str("call_once"), + false, + ), + ] { let trait_def_id = match opt_trait_def_id { Some(def_id) => def_id, None => continue, }; - if let Some(ok) = self.lookup_method_in_trait(call_expr.span, - method_name, - trait_def_id, - adjusted_ty, - None) { + let opt_input_types = opt_arg_exprs.map(|arg_exprs| [self.tcx.mk_tup( + arg_exprs + .iter() + .map(|e| self.next_ty_var( + TypeVariableOrigin::TypeInference(e.span) + )) + )]); + let opt_input_types = opt_input_types.as_ref().map(AsRef::as_ref); + + if let Some(ok) = self.lookup_method_in_trait( + call_expr.span, + method_name, + trait_def_id, + adjusted_ty, + opt_input_types, + ) { let method = self.register_infer_ok_obligations(ok); let mut autoref = None; if borrow { @@ -183,11 +217,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // deployment, conservatively omit // overloaded function call ops. allow_two_phase_borrow: AllowTwoPhase::No, - } + }, }; autoref = Some(Adjustment { kind: Adjust::Borrow(AutoBorrow::Ref(region, mutbl)), - target: method.sig.inputs()[0] + target: method.sig.inputs()[0], }); } } @@ -198,23 +232,25 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { None } - fn confirm_builtin_call(&self, - call_expr: &hir::Expr, - callee_ty: Ty<'tcx>, - arg_exprs: &'gcx [hir::Expr], - expected: Expectation<'tcx>) - -> Ty<'tcx> { + fn confirm_builtin_call( + &self, + call_expr: &hir::Expr, + callee_ty: Ty<'tcx>, + arg_exprs: &'gcx [hir::Expr], + expected: Expectation<'tcx>, + ) -> Ty<'tcx> { let (fn_sig, def_span) = match callee_ty.sty { - ty::FnDef(def_id, _) => { - (callee_ty.fn_sig(self.tcx), self.tcx.hir.span_if_local(def_id)) - } + ty::FnDef(def_id, _) => ( + callee_ty.fn_sig(self.tcx), + self.tcx.hir().span_if_local(def_id), + ), ty::FnPtr(sig) => (sig, None), ref t => { let mut unit_variant = None; if let &ty::Adt(adt_def, ..) = t { if adt_def.is_enum() { if let hir::ExprKind::Call(ref expr, _) = call_expr.node { - unit_variant = Some(self.tcx.hir.node_to_pretty_string(expr.id)) + unit_variant = Some(self.tcx.hir().node_to_pretty_string(expr.id)) } } } @@ -229,15 +265,19 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { match unit_variant { Some(ref path) => format!("enum variant `{}`", path), None => format!("`{}`", callee_ty), - }); + } + ); if let Some(ref path) = unit_variant { - err.span_suggestion_with_applicability( + err.span_suggestion( call_expr.span, - &format!("`{}` is a unit variant, you need to write it \ - without the parenthesis", path), + &format!( + "`{}` is a unit variant, you need to write it \ + without the parenthesis", + path + ), path.to_string(), - Applicability::MachineApplicable + Applicability::MachineApplicable, ); } @@ -245,48 +285,50 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let def = match callee.node { hir::ExprKind::Path(ref qpath) => { self.tables.borrow().qpath_def(qpath, callee.hir_id) - }, + } hir::ExprKind::Call(ref inner_callee, _) => { // If the call spans more than one line and the callee kind is // itself another `ExprCall`, that's a clue that we might just be // missing a semicolon (Issue #51055) - let call_is_multiline = self.tcx.sess.source_map() - .is_multiline(call_expr.span); + let call_is_multiline = + self.tcx.sess.source_map().is_multiline(call_expr.span); if call_is_multiline { let span = self.tcx.sess.source_map().next_point(callee.span); - err.span_suggestion_with_applicability( + err.span_suggestion( span, "try adding a semicolon", ";".to_owned(), - Applicability::MaybeIncorrect + Applicability::MaybeIncorrect, ); } if let hir::ExprKind::Path(ref inner_qpath) = inner_callee.node { inner_callee_path = Some(inner_qpath); - self.tables.borrow().qpath_def(inner_qpath, inner_callee.hir_id) + self.tables + .borrow() + .qpath_def(inner_qpath, inner_callee.hir_id) } else { Def::Err } - }, - _ => { - Def::Err } + _ => Def::Err, }; err.span_label(call_expr.span, "call expression requires function"); let def_span = match def { Def::Err => None, - Def::Local(id) | Def::Upvar(id, ..) => { - Some(self.tcx.hir.span(id)) - } - _ => self.tcx.hir.span_if_local(def.def_id()) + Def::Local(id) | Def::Upvar(id, ..) => Some(self.tcx.hir().span(id)), + _ => def + .opt_def_id() + .and_then(|did| self.tcx.hir().span_if_local(did)), }; if let Some(span) = def_span { let label = match (unit_variant, inner_callee_path) { (Some(path), _) => format!("`{}` defined here", path), (_, Some(hir::QPath::Resolved(_, path))) => format!( - "`{}` defined here returns `{}`", path, callee_ty.to_string() + "`{}` defined here returns `{}`", + path, + callee_ty.to_string() ), _ => format!("`{}` defined here", callee_ty.to_string()), }; @@ -294,19 +336,25 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } err.emit(); } else { - bug!("call_expr.node should be an ExprKind::Call, got {:?}", call_expr.node); + bug!( + "call_expr.node should be an ExprKind::Call, got {:?}", + call_expr.node + ); } // This is the "default" function signature, used in case of error. // In that case, we check each argument against "error" in order to // set up all the node type bindings. - (ty::Binder::bind(self.tcx.mk_fn_sig( - self.err_args(arg_exprs.len()).into_iter(), - self.tcx.types.err, - false, - hir::Unsafety::Normal, - abi::Abi::Rust - )), None) + ( + ty::Binder::bind(self.tcx.mk_fn_sig( + self.err_args(arg_exprs.len()).into_iter(), + self.tcx.types.err, + false, + hir::Unsafety::Normal, + abi::Abi::Rust, + )), + None, + ) } }; @@ -315,69 +363,80 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // renormalize the associated types at this point, since they // previously appeared within a `Binder<>` and hence would not // have been normalized before. - let fn_sig = - self.replace_bound_vars_with_fresh_vars(call_expr.span, infer::FnCall, &fn_sig) - .0; + let fn_sig = self + .replace_bound_vars_with_fresh_vars(call_expr.span, infer::FnCall, &fn_sig) + .0; let fn_sig = self.normalize_associated_types_in(call_expr.span, &fn_sig); // Call the generic checker. - let expected_arg_tys = - self.expected_inputs_for_expected_output(call_expr.span, - expected, - fn_sig.output(), - fn_sig.inputs()); - self.check_argument_types(call_expr.span, - call_expr.span, - fn_sig.inputs(), - &expected_arg_tys[..], - arg_exprs, - fn_sig.variadic, - TupleArgumentsFlag::DontTupleArguments, - def_span); + let expected_arg_tys = self.expected_inputs_for_expected_output( + call_expr.span, + expected, + fn_sig.output(), + fn_sig.inputs(), + ); + self.check_argument_types( + call_expr.span, + call_expr.span, + fn_sig.inputs(), + &expected_arg_tys[..], + arg_exprs, + fn_sig.variadic, + TupleArgumentsFlag::DontTupleArguments, + def_span, + ); fn_sig.output() } - fn confirm_deferred_closure_call(&self, - call_expr: &hir::Expr, - arg_exprs: &'gcx [hir::Expr], - expected: Expectation<'tcx>, - fn_sig: ty::FnSig<'tcx>) - -> Ty<'tcx> { + fn confirm_deferred_closure_call( + &self, + call_expr: &hir::Expr, + arg_exprs: &'gcx [hir::Expr], + expected: Expectation<'tcx>, + fn_sig: ty::FnSig<'tcx>, + ) -> Ty<'tcx> { // `fn_sig` is the *signature* of the cosure being called. We // don't know the full details yet (`Fn` vs `FnMut` etc), but we // do know the types expected for each argument and the return // type. - let expected_arg_tys = self.expected_inputs_for_expected_output(call_expr.span, - expected, - fn_sig.output().clone(), - fn_sig.inputs()); - - self.check_argument_types(call_expr.span, - call_expr.span, - fn_sig.inputs(), - &expected_arg_tys, - arg_exprs, - fn_sig.variadic, - TupleArgumentsFlag::TupleArguments, - None); + let expected_arg_tys = self.expected_inputs_for_expected_output( + call_expr.span, + expected, + fn_sig.output().clone(), + fn_sig.inputs(), + ); + + self.check_argument_types( + call_expr.span, + call_expr.span, + fn_sig.inputs(), + &expected_arg_tys, + arg_exprs, + fn_sig.variadic, + TupleArgumentsFlag::TupleArguments, + None, + ); fn_sig.output() } - fn confirm_overloaded_call(&self, - call_expr: &hir::Expr, - arg_exprs: &'gcx [hir::Expr], - expected: Expectation<'tcx>, - method_callee: MethodCallee<'tcx>) - -> Ty<'tcx> { - let output_type = self.check_method_argument_types(call_expr.span, - call_expr.span, - Ok(method_callee), - arg_exprs, - TupleArgumentsFlag::TupleArguments, - expected); + fn confirm_overloaded_call( + &self, + call_expr: &hir::Expr, + arg_exprs: &'gcx [hir::Expr], + expected: Expectation<'tcx>, + method_callee: MethodCallee<'tcx>, + ) -> Ty<'tcx> { + let output_type = self.check_method_argument_types( + call_expr.span, + call_expr.span, + Ok(method_callee), + arg_exprs, + TupleArgumentsFlag::TupleArguments, + expected, + ); self.write_method_call(call_expr.hir_id, method_callee); output_type @@ -401,11 +460,12 @@ impl<'a, 'gcx, 'tcx> DeferredCallResolution<'gcx, 'tcx> { // we should not be invoked until the closure kind has been // determined by upvar inference - assert!(fcx.closure_kind(self.closure_def_id, self.closure_substs).is_some()); + assert!(fcx + .closure_kind(self.closure_def_id, self.closure_substs) + .is_some()); // We may now know enough to figure out fn vs fnmut etc. - match fcx.try_overloaded_call_traits(self.call_expr, - self.adjusted_ty) { + match fcx.try_overloaded_call_traits(self.call_expr, self.adjusted_ty, None) { Some((autoref, method_callee)) => { // One problem is that when we get here, we are going // to have a newly instantiated function signature @@ -420,22 +480,28 @@ impl<'a, 'gcx, 'tcx> DeferredCallResolution<'gcx, 'tcx> { debug!("attempt_resolution: method_callee={:?}", method_callee); for (method_arg_ty, self_arg_ty) in - method_sig.inputs().iter().skip(1).zip(self.fn_sig.inputs()) { + method_sig.inputs().iter().skip(1).zip(self.fn_sig.inputs()) + { fcx.demand_eqtype(self.call_expr.span, &self_arg_ty, &method_arg_ty); } - fcx.demand_eqtype(self.call_expr.span, method_sig.output(), self.fn_sig.output()); + fcx.demand_eqtype( + self.call_expr.span, + method_sig.output(), + self.fn_sig.output(), + ); let mut adjustments = self.adjustments; adjustments.extend(autoref); fcx.apply_adjustments(self.callee_expr, adjustments); - fcx.write_method_call(self.call_expr.hir_id, - method_callee); + fcx.write_method_call(self.call_expr.hir_id, method_callee); } None => { - span_bug!(self.call_expr.span, - "failed to find an overloaded call trait for closure call"); + span_bug!( + self.call_expr.span, + "failed to find an overloaded call trait for closure call" + ); } } } diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index 3f0a3531244..85cae17fd85 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Code for type-checking cast expressions. //! //! A cast `e as U` is valid if one of the following holds: @@ -27,7 +17,7 @@ //! //! where `&.T` and `*T` are references of either mutability, //! and where pointer_kind(`T`) is the kind of the unsize info -//! in `T` - the vtable for a trait definition (e.g. `fmt::Display` or +//! in `T` - the vtable for a trait definition (e.g., `fmt::Display` or //! `Iterator`, not `Iterator`) or a length (or `()` if `T: Sized`). //! //! Note that lengths are not adjusted when casting raw slices - @@ -73,7 +63,7 @@ enum PointerKind<'tcx> { /// No metadata attached, ie pointer to sized type or foreign type Thin, /// A trait object - Vtable(DefId), + Vtable(Option), /// Slice Length, /// The unsize info of this projection @@ -98,14 +88,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { return Err(ErrorReported); } - if self.type_is_known_to_be_sized(t, span) { + if self.type_is_known_to_be_sized_modulo_regions(t, span) { return Ok(Some(PointerKind::Thin)); } Ok(match t.sty { ty::Slice(_) | ty::Str => Some(PointerKind::Length), ty::Dynamic(ref tty, ..) => - Some(PointerKind::Vtable(tty.principal().def_id())), + Some(PointerKind::Vtable(tty.principal_def_id())), ty::Adt(def, substs) if def.is_struct() => { match def.non_enum_variant().fields.last() { None => Some(PointerKind::Thin), @@ -128,7 +118,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty::Opaque(def_id, substs) => Some(PointerKind::OfOpaque(def_id, substs)), ty::Param(ref p) => Some(PointerKind::OfParam(p)), // Insufficient type information. - ty::Bound(..) | ty::Infer(_) => None, + ty::Placeholder(..) | ty::Bound(..) | ty::Infer(_) => None, ty::Bool | ty::Char | ty::Int(..) | ty::Uint(..) | ty::Float(_) | ty::Array(..) | ty::GeneratorWitness(..) | @@ -223,8 +213,14 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { fcx.ty_to_string(self.expr_ty), cast_ty)); if let Ok(snippet) = fcx.sess().source_map().span_to_snippet(self.expr.span) { - err.span_help(self.expr.span, - &format!("did you mean `*{}`?", snippet)); + err.span_suggestion( + self.expr.span, + "dereference the expression", + format!("*{}", snippet), + Applicability::MaybeIncorrect, + ); + } else { + err.span_help(self.expr.span, "dereference the expression with `*`"); } err.emit(); } @@ -261,10 +257,28 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { .emit(); } CastError::CastToBool => { - struct_span_err!(fcx.tcx.sess, self.span, E0054, "cannot cast as `bool`") - .span_label(self.span, "unsupported cast") - .help("compare with zero instead") - .emit(); + let mut err = + struct_span_err!(fcx.tcx.sess, self.span, E0054, "cannot cast as `bool`"); + + if self.expr_ty.is_numeric() { + match fcx.tcx.sess.source_map().span_to_snippet(self.expr.span) { + Ok(snippet) => { + err.span_suggestion( + self.span, + "compare with zero instead", + format!("{} != 0", snippet), + Applicability::MachineApplicable, + ); + } + Err(_) => { + err.span_help(self.span, "compare with zero instead"); + } + } + } else { + err.span_label(self.span, "unsupported cast"); + } + + err.emit(); } CastError::CastToChar => { type_error_struct!(fcx.tcx.sess, self.span, self.expr_ty, E0604, @@ -300,7 +314,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { err.note("The type information given here is insufficient to check whether \ the pointer cast is valid"); if unknown_cast_to { - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( self.cast_span, "consider giving more type information", String::new(), @@ -331,7 +345,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { if self.cast_ty.is_trait() { match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) { Ok(s) => { - err.span_suggestion_with_applicability( + err.span_suggestion( self.cast_span, "try casting to a reference instead", format!("&{}{}", mtstr, s), @@ -353,7 +367,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { ty::Adt(def, ..) if def.is_box() => { match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) { Ok(s) => { - err.span_suggestion_with_applicability( + err.span_suggestion( self.cast_span, "try casting to a `Box` instead", format!("Box<{}>", s), @@ -407,7 +421,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { self.expr_ty, self.cast_ty); - if !fcx.type_is_known_to_be_sized(self.cast_ty, self.span) { + if !fcx.type_is_known_to_be_sized_modulo_regions(self.cast_ty, self.span) { self.report_cast_to_unsized_type(fcx); } else if self.expr_ty.references_error() || self.cast_ty.references_error() { // No sense in giving duplicate error messages @@ -628,8 +642,8 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { } impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { - fn type_is_known_to_be_sized(&self, ty: Ty<'tcx>, span: Span) -> bool { + fn type_is_known_to_be_sized_modulo_regions(&self, ty: Ty<'tcx>, span: Span) -> bool { let lang_item = self.tcx.require_lang_item(lang_items::SizedTraitLangItem); - traits::type_known_to_meet_bound(self, self.param_env, ty, lang_item, span) + traits::type_known_to_meet_bound_modulo_regions(self, self.param_env, ty, lang_item, span) } } diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index 10ac2448d00..df83c92fde5 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Code for type-checking closure expressions. use super::{check_fn, Expectation, FnCtxt, GeneratorTypes}; @@ -20,7 +10,7 @@ use rustc::infer::LateBoundRegionConversionTime; use rustc::infer::type_variable::TypeVariableOrigin; use rustc::traits::Obligation; use rustc::traits::error_reporting::ArgKind; -use rustc::ty::{self, ToPolyTraitRef, Ty, GenericParamDefKind}; +use rustc::ty::{self, Ty, GenericParamDefKind}; use rustc::ty::fold::TypeFoldable; use rustc::ty::subst::Substs; use std::cmp; @@ -64,7 +54,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Some(ty) => self.deduce_expectations_from_expected_type(ty), None => (None, None), }; - let body = self.tcx.hir.body(body_id); + let body = self.tcx.hir().body(body_id); self.check_closure(expr, expected_kind, decl, body, gen, expected_sig) } @@ -82,7 +72,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { opt_kind, expected_sig ); - let expr_def_id = self.tcx.hir.local_def_id(expr.id); + let expr_def_id = self.tcx.hir().local_def_id(expr.id); let ClosureSignatures { bound_sig, @@ -200,7 +190,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.deduce_sig_from_projection(None, &pb) }) .next(); - let kind = self.tcx.lang_items().fn_trait_kind(object_type.principal().def_id()); + let kind = object_type.principal_def_id().and_then(|did| { + self.tcx.lang_items().fn_trait_kind(did) + }); (sig, kind) } ty::Infer(ty::TyVar(vid)) => self.deduce_expectations_from_obligations(vid), @@ -219,13 +211,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { &self, expected_vid: ty::TyVid, ) -> (Option>, Option) { - let fulfillment_cx = self.fulfillment_cx.borrow(); - // Here `expected_ty` is known to be a type inference variable. - - let expected_sig = fulfillment_cx - .pending_obligations() - .iter() - .filter_map(|obligation| { + let expected_sig = self.obligations_for_self_ty(expected_vid) + .find_map(|(_, obligation)| { debug!( "deduce_expectations_from_obligations: obligation.predicate={:?}", obligation.predicate @@ -234,52 +221,21 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let ty::Predicate::Projection(ref proj_predicate) = obligation.predicate { // Given a Projection predicate, we can potentially infer // the complete signature. - let trait_ref = proj_predicate.to_poly_trait_ref(self.tcx); - self.self_type_matches_expected_vid(trait_ref, expected_vid) - .and_then(|_| { - self.deduce_sig_from_projection( - Some(obligation.cause.span), - proj_predicate - ) - }) + self.deduce_sig_from_projection( + Some(obligation.cause.span), + proj_predicate + ) } else { None } - }) - .next(); + }); // Even if we can't infer the full signature, we may be able to // infer the kind. This can occur if there is a trait-reference // like `F : Fn`. Note that due to subtyping we could encounter // many viable options, so pick the most restrictive. - let expected_kind = fulfillment_cx - .pending_obligations() - .iter() - .filter_map(|obligation| { - let opt_trait_ref = match obligation.predicate { - ty::Predicate::Projection(ref data) => Some(data.to_poly_trait_ref(self.tcx)), - ty::Predicate::Trait(ref data) => Some(data.to_poly_trait_ref()), - ty::Predicate::Subtype(..) => None, - ty::Predicate::RegionOutlives(..) => None, - ty::Predicate::TypeOutlives(..) => None, - ty::Predicate::WellFormed(..) => None, - ty::Predicate::ObjectSafe(..) => None, - ty::Predicate::ConstEvaluatable(..) => None, - - // NB: This predicate is created by breaking down a - // `ClosureType: FnFoo()` predicate, where - // `ClosureType` represents some `Closure`. It can't - // possibly be referring to the current closure, - // because we haven't produced the `Closure` for - // this closure yet; this is exactly why the other - // code is looking for a self type of a unresolved - // inference variable. - ty::Predicate::ClosureKind(..) => None, - }; - opt_trait_ref - .and_then(|tr| self.self_type_matches_expected_vid(tr, expected_vid)) - .and_then(|tr| self.tcx.lang_items().fn_trait_kind(tr.def_id())) - }) + let expected_kind = self.obligations_for_self_ty(expected_vid) + .filter_map(|(tr, _)| self.tcx.lang_items().fn_trait_kind(tr.def_id())) .fold(None, |best, cur| { Some(best.map_or(cur, |best| cmp::min(best, cur))) }); @@ -339,22 +295,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Some(ExpectedSig { cause_span, sig }) } - fn self_type_matches_expected_vid( - &self, - trait_ref: ty::PolyTraitRef<'tcx>, - expected_vid: ty::TyVid, - ) -> Option> { - let self_ty = self.shallow_resolve(trait_ref.self_ty()); - debug!( - "self_type_matches_expected_vid(trait_ref={:?}, self_ty={:?})", - trait_ref, self_ty - ); - match self_ty.sty { - ty::Infer(ty::TyVar(v)) if expected_vid == v => Some(trait_ref), - _ => None, - } - } - fn sig_of_closure( &self, expr_def_id: DefId, @@ -496,7 +436,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { body: &hir::Body, expected_sig: ExpectedSig<'tcx>, ) -> ClosureSignatures<'tcx> { - let expr_map_node = self.tcx.hir.get_if_local(expr_def_id).unwrap(); + let expr_map_node = self.tcx.hir().get_if_local(expr_def_id).unwrap(); let expected_args: Vec<_> = expected_sig .sig .inputs() @@ -556,7 +496,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.infcx.commit_if_ok(|_| { let mut all_obligations = vec![]; - // The liberated version of this signature should be be a subtype + // The liberated version of this signature should be a subtype // of the liberated form of the expectation. for ((hir_ty, &supplied_ty), expected_ty) in decl.inputs.iter() .zip(*supplied_sig.inputs().skip_binder()) // binder moved to (*) below diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 3bdd038bff1..d1dfe9469fb 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! # Type Coercion //! //! Under certain circumstances we will coerce from one type to another, @@ -336,7 +326,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { // the decision to region inference (and regionck, which will add // some more edges to this variable). However, this can wind up // creating a crippling number of variables in some cases -- - // e.g. #32278 -- so we optimize one particular case [3]. + // e.g., #32278 -- so we optimize one particular case [3]. // Let me try to explain with some examples: // - The "running example" above represents the simple case, // where we have one `&` reference at the outer level and @@ -419,7 +409,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { let needs = Needs::maybe_mut_place(mt_b.mutbl); let InferOk { value: mut adjustments, obligations: o } - = autoderef.adjust_steps_as_infer_ok(needs); + = autoderef.adjust_steps_as_infer_ok(self, needs); obligations.extend(o); obligations.extend(autoderef.into_obligations()); @@ -579,7 +569,33 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { }; match selcx.select(&obligation.with(trait_ref)) { // Uncertain or unimplemented. - Ok(None) | + Ok(None) => { + if trait_ref.def_id() == unsize_did { + let trait_ref = self.resolve_type_vars_if_possible(&trait_ref); + let self_ty = trait_ref.skip_binder().self_ty(); + let unsize_ty = trait_ref.skip_binder().input_types().nth(1).unwrap(); + debug!("coerce_unsized: ambiguous unsize case for {:?}", trait_ref); + match (&self_ty.sty, &unsize_ty.sty) { + (ty::Infer(ty::TyVar(v)), + ty::Dynamic(..)) if self.type_var_is_sized(*v) => { + debug!("coerce_unsized: have sized infer {:?}", v); + coercion.obligations.push(obligation); + // `$0: Unsize` where we know that `$0: Sized`, try going + // for unsizing. + } + _ => { + // Some other case for `$0: Unsize`. Note that we + // hit this case even if `Something` is a sized type, so just + // don't do the coercion. + debug!("coerce_unsized: ambiguous unsize"); + return Err(TypeError::Mismatch); + } + } + } else { + debug!("coerce_unsized: early return - ambiguous"); + return Err(TypeError::Mismatch); + } + } Err(traits::Unimplemented) => { debug!("coerce_unsized: early return - can't prove obligation"); return Err(TypeError::Mismatch); @@ -696,7 +712,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { let b = self.shallow_resolve(b); - let node_id_a = self.tcx.hir.as_local_node_id(def_id_a).unwrap(); + let node_id_a = self.tcx.hir().as_local_node_id(def_id_a).unwrap(); match b.sty { ty::FnPtr(_) if self.tcx.with_freevars(node_id_a, |v| v.is_empty()) => { // We coerce the closure, which has fn type @@ -809,7 +825,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Special-case that coercion alone cannot handle: // Two function item types of differing IDs or Substs. if let (&ty::FnDef(..), &ty::FnDef(..)) = (&prev_ty.sty, &new_ty.sty) { - // Don't reify if the function types have a LUB, i.e. they + // Don't reify if the function types have a LUB, i.e., they // are the same function and their parameters have a LUB. let lub_ty = self.commit_if_ok(|_| { self.at(cause, self.param_env) @@ -1143,7 +1159,6 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> // `expression_ty` will be unit). // // Another example is `break` with no argument expression. - assert!(expression_ty.is_unit()); assert!(expression_ty.is_unit(), "if let hack without unit type"); fcx.at(cause, fcx.param_env) .eq_exp(label_expression_as_expected, expression_ty, self.merged_ty()) @@ -1190,25 +1205,24 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> db = struct_span_err!( fcx.tcx.sess, cause.span, E0069, "`return;` in a function whose return type is not `()`"); - db.span_label(cause.span, "return type is not ()"); + db.span_label(cause.span, "return type is not `()`"); } ObligationCauseCode::BlockTailExpression(blk_id) => { - db = fcx.report_mismatched_types(cause, expected, found, err); - - let expr = expression.unwrap_or_else(|| { - span_bug!(cause.span, - "supposed to be part of a block tail expression, but the \ - expression is empty"); - }); - fcx.suggest_mismatched_types_on_tail( - &mut db, - expr, + let parent_id = fcx.tcx.hir().get_parent_node(blk_id); + db = self.report_return_mismatched_types( + cause, expected, found, - cause.span, - blk_id, + err, + fcx, + parent_id, + expression.map(|expr| (expr, blk_id)), ); } + ObligationCauseCode::ReturnType(id) => { + db = self.report_return_mismatched_types( + cause, expected, found, err, fcx, id, None); + } _ => { db = fcx.report_mismatched_types(cause, expected, found, err); } @@ -1225,6 +1239,59 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> } } + fn report_return_mismatched_types<'a>( + &self, + cause: &ObligationCause<'tcx>, + expected: Ty<'tcx>, + found: Ty<'tcx>, + err: TypeError<'tcx>, + fcx: &FnCtxt<'a, 'gcx, 'tcx>, + id: syntax::ast::NodeId, + expression: Option<(&'gcx hir::Expr, syntax::ast::NodeId)>, + ) -> DiagnosticBuilder<'a> { + let mut db = fcx.report_mismatched_types(cause, expected, found, err); + + let mut pointing_at_return_type = false; + let mut return_sp = None; + + // Verify that this is a tail expression of a function, otherwise the + // label pointing out the cause for the type coercion will be wrong + // as prior return coercions would not be relevant (#57664). + let parent_id = fcx.tcx.hir().get_parent_node(id); + let fn_decl = if let Some((expr, blk_id)) = expression { + pointing_at_return_type = fcx.suggest_mismatched_types_on_tail( + &mut db, + expr, + expected, + found, + cause.span, + blk_id, + ); + let parent = fcx.tcx.hir().get(parent_id); + fcx.get_node_fn_decl(parent).map(|(fn_decl, _, is_main)| (fn_decl, is_main)) + } else { + fcx.get_fn_decl(parent_id) + }; + + if let (Some((fn_decl, can_suggest)), _) = (fn_decl, pointing_at_return_type) { + if expression.is_none() { + pointing_at_return_type |= fcx.suggest_missing_return_type( + &mut db, &fn_decl, expected, found, can_suggest); + } + if !pointing_at_return_type { + return_sp = Some(fn_decl.output.span()); // `impl Trait` return type + } + } + if let (Some(sp), Some(return_sp)) = (fcx.ret_coercion_span.borrow().as_ref(), return_sp) { + db.span_label(return_sp, "expected because this return type..."); + db.span_label( *sp, format!( + "...is found to be `{}` here", + fcx.resolve_type_vars_with_obligations(expected), + )); + } + db + } + pub fn complete<'a>(self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> { if let Some(final_ty) = self.final_ty { final_ty diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index e30ebe07e54..0eb8d7d06b1 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir::{self, GenericParamKind, ImplItemKind, TraitItemKind}; use rustc::infer::{self, InferOk}; use rustc::ty::{self, TyCtxt, GenericParamDefKind}; @@ -93,7 +83,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // This node-id should be used for the `body_id` field on each // `ObligationCause` (and the `FnCtxt`). This is what // `regionck_item` expects. - let impl_m_node_id = tcx.hir.as_local_node_id(impl_m.def_id).unwrap(); + let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); let cause = ObligationCause { span: impl_m_span, @@ -216,8 +206,11 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // The key step here is to update the caller_bounds's predicates to be // the new hybrid bounds we computed. let normalize_cause = traits::ObligationCause::misc(impl_m_span, impl_m_node_id); - let param_env = ty::ParamEnv::new(tcx.intern_predicates(&hybrid_preds.predicates), - Reveal::UserFacing); + let param_env = ty::ParamEnv::new( + tcx.intern_predicates(&hybrid_preds.predicates), + Reveal::UserFacing, + None + ); let param_env = traits::normalize_param_env_or_error(tcx, impl_m.def_id, param_env, @@ -323,7 +316,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Some(trait_err_span) = trait_err_span { if let Ok(trait_err_str) = tcx.sess.source_map() .span_to_snippet(trait_err_span) { - diag.span_suggestion_with_applicability( + diag.span_suggestion( impl_err_span, "consider change the type to match the mutability in trait", trait_err_str, @@ -391,7 +384,7 @@ fn check_region_bounds_on_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // the moment, give a kind of vague error message. if trait_params != impl_params { let def_span = tcx.sess.source_map().def_span(span); - let span = tcx.hir.get_generics_span(impl_m.def_id).unwrap_or(def_span); + let span = tcx.hir().get_generics_span(impl_m.def_id).unwrap_or(def_span); let mut err = struct_span_err!( tcx.sess, span, @@ -400,9 +393,9 @@ fn check_region_bounds_on_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_m.ident, ); err.span_label(span, "lifetimes do not match method in trait"); - if let Some(sp) = tcx.hir.span_if_local(trait_m.def_id) { + if let Some(sp) = tcx.hir().span_if_local(trait_m.def_id) { let def_sp = tcx.sess.source_map().def_span(sp); - let sp = tcx.hir.get_generics_span(trait_m.def_id).unwrap_or(def_sp); + let sp = tcx.hir().get_generics_span(trait_m.def_id).unwrap_or(def_sp); err.span_label(sp, "lifetimes in impl do not match this method in trait"); } err.emit(); @@ -422,8 +415,8 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a trait_sig: ty::FnSig<'tcx>) -> (Span, Option) { let tcx = infcx.tcx; - let impl_m_node_id = tcx.hir.as_local_node_id(impl_m.def_id).unwrap(); - let (impl_m_output, impl_m_iter) = match tcx.hir.expect_impl_item(impl_m_node_id).node { + let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); + let (impl_m_output, impl_m_iter) = match tcx.hir().expect_impl_item(impl_m_node_id).node { ImplItemKind::Method(ref impl_m_sig, _) => { (&impl_m_sig.decl.output, impl_m_sig.decl.inputs.iter()) } @@ -432,8 +425,8 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a match *terr { TypeError::Mutability => { - if let Some(trait_m_node_id) = tcx.hir.as_local_node_id(trait_m.def_id) { - let trait_m_iter = match tcx.hir.expect_trait_item(trait_m_node_id).node { + if let Some(trait_m_node_id) = tcx.hir().as_local_node_id(trait_m.def_id) { + let trait_m_iter = match tcx.hir().expect_trait_item(trait_m_node_id).node { TraitItemKind::Method(ref trait_m_sig, _) => { trait_m_sig.decl.inputs.iter() } @@ -451,15 +444,15 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a }).map(|(ref impl_arg, ref trait_arg)| { (impl_arg.span, Some(trait_arg.span)) }) - .unwrap_or_else(|| (cause.span(&tcx), tcx.hir.span_if_local(trait_m.def_id))) + .unwrap_or_else(|| (cause.span(&tcx), tcx.hir().span_if_local(trait_m.def_id))) } else { - (cause.span(&tcx), tcx.hir.span_if_local(trait_m.def_id)) + (cause.span(&tcx), tcx.hir().span_if_local(trait_m.def_id)) } } TypeError::Sorts(ExpectedFound { .. }) => { - if let Some(trait_m_node_id) = tcx.hir.as_local_node_id(trait_m.def_id) { + if let Some(trait_m_node_id) = tcx.hir().as_local_node_id(trait_m.def_id) { let (trait_m_output, trait_m_iter) = - match tcx.hir.expect_trait_item(trait_m_node_id).node { + match tcx.hir().expect_trait_item(trait_m_node_id).node { TraitItemKind::Method(ref trait_m_sig, _) => { (&trait_m_sig.decl.output, trait_m_sig.decl.inputs.iter()) } @@ -486,14 +479,14 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a { (impl_m_output.span(), Some(trait_m_output.span())) } else { - (cause.span(&tcx), tcx.hir.span_if_local(trait_m.def_id)) + (cause.span(&tcx), tcx.hir().span_if_local(trait_m.def_id)) } ) } else { - (cause.span(&tcx), tcx.hir.span_if_local(trait_m.def_id)) + (cause.span(&tcx), tcx.hir().span_if_local(trait_m.def_id)) } } - _ => (cause.span(&tcx), tcx.hir.span_if_local(trait_m.def_id)), + _ => (cause.span(&tcx), tcx.hir().span_if_local(trait_m.def_id)), } } @@ -548,7 +541,7 @@ fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_m.ident, self_descr); err.span_label(impl_m_span, format!("`{}` used in impl", self_descr)); - if let Some(span) = tcx.hir.span_if_local(trait_m.def_id) { + if let Some(span) = tcx.hir().span_if_local(trait_m.def_id) { err.span_label(span, format!("trait method declared without `{}`", self_descr)); } else { err.note_trait_signature(trait_m.ident.to_string(), @@ -568,7 +561,7 @@ fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_m.ident, self_descr); err.span_label(impl_m_span, format!("expected `{}` in impl", self_descr)); - if let Some(span) = tcx.hir.span_if_local(trait_m.def_id) { + if let Some(span) = tcx.hir().span_if_local(trait_m.def_id) { err.span_label(span, format!("`{}` used in trait", self_descr)); } else { err.note_trait_signature(trait_m.ident.to_string(), @@ -594,8 +587,8 @@ fn compare_number_of_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let num_trait_m_type_params = trait_m_generics.own_counts().types; if num_impl_m_type_params != num_trait_m_type_params { - let impl_m_node_id = tcx.hir.as_local_node_id(impl_m.def_id).unwrap(); - let impl_m_item = tcx.hir.expect_impl_item(impl_m_node_id); + let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); + let impl_m_item = tcx.hir().expect_impl_item(impl_m_node_id); let span = if impl_m_item.generics.params.is_empty() || impl_m_item.generics.span.is_dummy() // impl Trait in argument position (#55374) { @@ -644,16 +637,23 @@ fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let trait_number_args = trait_m_fty.inputs().skip_binder().len(); let impl_number_args = impl_m_fty.inputs().skip_binder().len(); if trait_number_args != impl_number_args { - let trait_m_node_id = tcx.hir.as_local_node_id(trait_m.def_id); + let trait_m_node_id = tcx.hir().as_local_node_id(trait_m.def_id); let trait_span = if let Some(trait_id) = trait_m_node_id { - match tcx.hir.expect_trait_item(trait_id).node { + match tcx.hir().expect_trait_item(trait_id).node { TraitItemKind::Method(ref trait_m_sig, _) => { - if let Some(arg) = trait_m_sig.decl.inputs.get(if trait_number_args > 0 { + let pos = if trait_number_args > 0 { trait_number_args - 1 } else { 0 - }) { - Some(arg.span) + }; + if let Some(arg) = trait_m_sig.decl.inputs.get(pos) { + Some(if pos == 0 { + arg.span + } else { + Span::new(trait_m_sig.decl.inputs[0].span.lo(), + arg.span.hi(), + arg.span.ctxt()) + }) } else { trait_item_span } @@ -663,15 +663,22 @@ fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } else { trait_item_span }; - let impl_m_node_id = tcx.hir.as_local_node_id(impl_m.def_id).unwrap(); - let impl_span = match tcx.hir.expect_impl_item(impl_m_node_id).node { + let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); + let impl_span = match tcx.hir().expect_impl_item(impl_m_node_id).node { ImplItemKind::Method(ref impl_m_sig, _) => { - if let Some(arg) = impl_m_sig.decl.inputs.get(if impl_number_args > 0 { + let pos = if impl_number_args > 0 { impl_number_args - 1 } else { 0 - }) { - arg.span + }; + if let Some(arg) = impl_m_sig.decl.inputs.get(pos) { + if pos == 0 { + arg.span + } else { + Span::new(impl_m_sig.decl.inputs[0].span.lo(), + arg.span.hi(), + arg.span.ctxt()) + } } else { impl_m_span } @@ -729,8 +736,8 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, in impl_m_type_params.zip(trait_m_type_params) { if impl_synthetic != trait_synthetic { - let impl_node_id = tcx.hir.as_local_node_id(impl_def_id).unwrap(); - let impl_span = tcx.hir.span(impl_node_id); + let impl_node_id = tcx.hir().as_local_node_id(impl_def_id).unwrap(); + let impl_span = tcx.hir().span(impl_node_id); let trait_span = tcx.def_span(trait_def_id); let mut err = struct_span_err!(tcx.sess, impl_span, @@ -752,11 +759,11 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, .source_map() .span_to_snippet(trait_span) .ok()?; - let trait_m = tcx.hir.as_local_node_id(trait_m.def_id)?; - let trait_m = tcx.hir.trait_item(hir::TraitItemId { node_id: trait_m }); + let trait_m = tcx.hir().as_local_node_id(trait_m.def_id)?; + let trait_m = tcx.hir().trait_item(hir::TraitItemId { node_id: trait_m }); - let impl_m = tcx.hir.as_local_node_id(impl_m.def_id)?; - let impl_m = tcx.hir.impl_item(hir::ImplItemId { node_id: impl_m }); + let impl_m = tcx.hir().as_local_node_id(impl_m.def_id)?; + let impl_m = tcx.hir().impl_item(hir::ImplItemId { node_id: impl_m }); // in case there are no generics, take the spot between the function name // and the opening paren of the argument list @@ -777,7 +784,7 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, .span_to_snippet(trait_m.generics.span) .ok()?; - err.multipart_suggestion_with_applicability( + err.multipart_suggestion( "try changing the `impl Trait` argument to a generic parameter", vec![ // replace `impl Trait` with `T` @@ -797,8 +804,8 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, (None, Some(hir::SyntheticTyParamKind::ImplTrait)) => { err.span_label(impl_span, "expected `impl Trait`, found generic parameter"); (|| { - let impl_m = tcx.hir.as_local_node_id(impl_m.def_id)?; - let impl_m = tcx.hir.impl_item(hir::ImplItemId { node_id: impl_m }); + let impl_m = tcx.hir().as_local_node_id(impl_m.def_id)?; + let impl_m = tcx.hir().impl_item(hir::ImplItemId { node_id: impl_m }); let input_tys = match impl_m.node { hir::ImplItemKind::Method(ref sig, _) => &sig.decl.inputs, _ => unreachable!(), @@ -848,7 +855,7 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, .span_to_snippet(bounds) .ok()?; - err.multipart_suggestion_with_applicability( + err.multipart_suggestion( "try removing the generic parameter and using `impl Trait` instead", vec![ // delete generic parameters @@ -895,7 +902,7 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Create a parameter environment that represents the implementation's // method. - let impl_c_node_id = tcx.hir.as_local_node_id(impl_c.def_id).unwrap(); + let impl_c_node_id = tcx.hir().as_local_node_id(impl_c.def_id).unwrap(); // Compute placeholder form of impl and trait const tys. let impl_ty = tcx.type_of(impl_c.def_id); @@ -927,7 +934,7 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_ty); // Locate the Span containing just the type of the offending impl - match tcx.hir.expect_impl_item(impl_c_node_id).node { + match tcx.hir().expect_impl_item(impl_c_node_id).node { ImplItemKind::Const(ref ty, _) => cause.span = ty.span, _ => bug!("{:?} is not a impl const", impl_c), } @@ -939,10 +946,10 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait", trait_c.ident); - let trait_c_node_id = tcx.hir.as_local_node_id(trait_c.def_id); + let trait_c_node_id = tcx.hir().as_local_node_id(trait_c.def_id); let trait_c_span = trait_c_node_id.map(|trait_c_node_id| { // Add a label to the Span containing just the type of the const - match tcx.hir.expect_trait_item(trait_c_node_id).node { + match tcx.hir().expect_trait_item(trait_c_node_id).node { TraitItemKind::Const(ref ty, _) => ty.span, _ => bug!("{:?} is not a trait const", trait_c), } diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 0a196834cb4..0d4690c8317 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use check::FnCtxt; use rustc::infer::InferOk; -use rustc::traits::ObligationCause; +use rustc::traits::{ObligationCause, ObligationCauseCode}; use syntax::ast; use syntax::util::parser::PREC_POSTFIX; @@ -76,6 +66,25 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } + pub fn demand_eqtype_pat( + &self, + cause_span: Span, + expected: Ty<'tcx>, + actual: Ty<'tcx>, + match_expr_span: Option, + ) { + let cause = if let Some(span) = match_expr_span { + self.cause( + cause_span, + ObligationCauseCode::MatchExpressionArmPattern { span, ty: expected }, + ) + } else { + self.misc(cause_span) + }; + self.demand_eqtype_with_origin(&cause, expected, actual).map(|mut err| err.emit()); + } + + pub fn demand_coerce(&self, expr: &hir::Expr, checked_ty: Ty<'tcx>, @@ -91,7 +100,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Checks that the type of `expr` can be coerced to `expected`. // - // NB: This code relies on `self.diverges` to be accurate. In + // N.B., this code relies on `self.diverges` to be accurate. In // particular, assignments to `!` will be permitted if the // diverges flag is currently "always". pub fn demand_coerce_diag(&self, @@ -123,7 +132,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let sole_field_ty = sole_field.ty(self.tcx, substs); if self.can_coerce(expr_ty, sole_field_ty) { let variant_path = self.tcx.item_path_str(variant.did); - Some(variant_path.trim_left_matches("std::prelude::v1::").to_string()) + // FIXME #56861: DRYer prelude filtering + Some(variant_path.trim_start_matches("std::prelude::v1::").to_string()) } else { None } @@ -133,7 +143,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let expr_text = print::to_string(print::NO_ANN, |s| s.print_expr(expr)); let suggestions = compatible_variants .map(|v| format!("{}({})", v, expr_text)); - err.span_suggestions_with_applicability( + err.span_suggestions( expr.span, "try using a variant of the expected type", suggestions, @@ -203,17 +213,17 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn can_use_as_ref(&self, expr: &hir::Expr) -> Option<(Span, &'static str, String)> { if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = expr.node { if let hir::def::Def::Local(id) = path.def { - let parent = self.tcx.hir.get_parent_node(id); + let parent = self.tcx.hir().get_parent_node(id); if let Some(Node::Expr(hir::Expr { id, node: hir::ExprKind::Closure(_, decl, ..), .. - })) = self.tcx.hir.find(parent) { - let parent = self.tcx.hir.get_parent_node(*id); + })) = self.tcx.hir().find(parent) { + let parent = self.tcx.hir().get_parent_node(*id); if let (Some(Node::Expr(hir::Expr { node: hir::ExprKind::MethodCall(path, span, expr), .. - })), 1) = (self.tcx.hir.find(parent), decl.inputs.len()) { + })), 1) = (self.tcx.hir().find(parent), decl.inputs.len()) { let self_ty = self.tables.borrow().node_id_to_type(expr[0].hir_id); let self_ty = format!("{:?}", self_ty); let name = path.ident.as_str(); @@ -344,7 +354,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // we may want to suggest adding a `*`, or removing // a `&`. // - // (But, also check check the `expn_info()` to see if this is + // (But, also check the `expn_info()` to see if this is // a macro; if so, it's hard to extract the text and make a good // suggestion, so don't bother.) if self.infcx.can_sub(self.param_env, checked, &expected).is_ok() && @@ -362,9 +372,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Maybe add `*`? Only if `T: Copy`. _ => { - if !self.infcx.type_moves_by_default(self.param_env, - checked, - sp) { + if self.infcx.type_is_copy_modulo_regions(self.param_env, + checked, + sp) { // do not suggest if the span comes from a macro (#52783) if let (Ok(code), true) = (cm.span_to_snippet(sp), sp == expr.span) { @@ -444,14 +454,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { false } - pub fn check_for_cast(&self, - err: &mut DiagnosticBuilder<'tcx>, - expr: &hir::Expr, - checked_ty: Ty<'tcx>, - expected_ty: Ty<'tcx>) - -> bool { - let parent_id = self.tcx.hir.get_parent_node(expr.id); - if let Some(parent) = self.tcx.hir.find(parent_id) { + pub fn check_for_cast( + &self, + err: &mut DiagnosticBuilder<'tcx>, + expr: &hir::Expr, + checked_ty: Ty<'tcx>, + expected_ty: Ty<'tcx>, + ) -> bool { + let parent_id = self.tcx.hir().get_parent_node(expr.id); + if let Some(parent) = self.tcx.hir().find(parent_id) { // Shouldn't suggest `.into()` on `const`s. if let Node::Item(Item { node: ItemKind::Const(_, _), .. }) = parent { // FIXME(estebank): modify once we decide to suggest `as` casts @@ -477,17 +488,40 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // For now, don't suggest casting with `as`. let can_cast = false; + let mut prefix = String::new(); + if let Some(hir::Node::Expr(hir::Expr { + node: hir::ExprKind::Struct(_, fields, _), + .. + })) = self.tcx.hir().find(self.tcx.hir().get_parent_node(expr.id)) { + // `expr` is a literal field for a struct, only suggest if appropriate + for field in fields { + if field.expr.id == expr.id && field.is_shorthand { + // This is a field literal + prefix = format!("{}: ", field.ident); + break; + } + } + if &prefix == "" { + // Likely a field was meant, but this field wasn't found. Do not suggest anything. + return false; + } + } + let needs_paren = expr.precedence().order() < (PREC_POSTFIX as i8); if let Ok(src) = self.tcx.sess.source_map().span_to_snippet(expr.span) { let msg = format!("you can cast an `{}` to `{}`", checked_ty, expected_ty); - let cast_suggestion = format!("{}{}{} as {}", - if needs_paren { "(" } else { "" }, - src, - if needs_paren { ")" } else { "" }, - expected_ty); + let cast_suggestion = format!( + "{}{}{}{} as {}", + prefix, + if needs_paren { "(" } else { "" }, + src, + if needs_paren { ")" } else { "" }, + expected_ty, + ); let into_suggestion = format!( - "{}{}{}.into()", + "{}{}{}{}.into()", + prefix, if needs_paren { "(" } else { "" }, src, if needs_paren { ")" } else { "" }, @@ -519,12 +553,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let suffix_suggestion = format!( "{}{}{}{}", if needs_paren { "(" } else { "" }, - src.trim_right_matches(&checked_ty.to_string()), + src.trim_end_matches(&checked_ty.to_string()), expected_ty, if needs_paren { ")" } else { "" }, ); - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &suggest_msg, if literal_is_ty_suffixed(expr) { @@ -541,7 +575,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { match (found.bit_width(), exp.bit_width()) { (Some(found), Some(exp)) if found > exp => { if can_cast { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, will_truncate), cast_suggestion, @@ -551,7 +585,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } (None, _) | (_, None) => { if can_cast { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, depending_on_isize), cast_suggestion, @@ -572,7 +606,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { match (found.bit_width(), exp.bit_width()) { (Some(found), Some(exp)) if found > exp => { if can_cast { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, will_truncate), cast_suggestion, @@ -582,7 +616,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } (None, _) | (_, None) => { if can_cast { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, depending_on_usize), cast_suggestion, @@ -603,7 +637,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if can_cast { match (found.bit_width(), exp.bit_width()) { (Some(found), Some(exp)) if found > exp - 1 => { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, will_truncate), cast_suggestion, @@ -611,7 +645,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); } (None, None) => { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, will_truncate), cast_suggestion, @@ -619,7 +653,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); } (None, _) => { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, depending_on_isize), cast_suggestion, @@ -627,7 +661,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); } (_, None) => { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, depending_on_usize), cast_suggestion, @@ -635,7 +669,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); } _ => { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, will_zero_extend), cast_suggestion, @@ -650,7 +684,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if can_cast { match (found.bit_width(), exp.bit_width()) { (Some(found), Some(exp)) if found - 1 > exp => { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, will_truncate), cast_suggestion, @@ -658,7 +692,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); } (None, None) => { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, will_sign_extend), cast_suggestion, @@ -666,7 +700,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); } (None, _) => { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, depending_on_usize), cast_suggestion, @@ -674,7 +708,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); } (_, None) => { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, depending_on_isize), cast_suggestion, @@ -682,7 +716,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); } _ => { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, which {}", msg, will_sign_extend), cast_suggestion, @@ -700,7 +734,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { None, ); } else if can_cast { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, producing the closest possible value", msg), cast_suggestion, @@ -711,7 +745,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } (&ty::Uint(_), &ty::Float(_)) | (&ty::Int(_), &ty::Float(_)) => { if can_cast { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, rounding the float towards zero", msg), cast_suggestion, @@ -726,7 +760,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { (&ty::Float(ref exp), &ty::Uint(ref found)) => { // if `found` is `None` (meaning found is `usize`), don't suggest `.into()` if exp.bit_width() > found.bit_width().unwrap_or(256) { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, producing the floating point representation of the \ integer", @@ -735,7 +769,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Applicability::MachineApplicable ); } else if can_cast { - err.span_suggestion_with_applicability(expr.span, + err.span_suggestion( + expr.span, &format!("{}, producing the floating point representation of the \ integer, rounded if necessary", msg), @@ -748,7 +783,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { (&ty::Float(ref exp), &ty::Int(ref found)) => { // if `found` is `None` (meaning found is `isize`), don't suggest `.into()` if exp.bit_width() > found.bit_width().unwrap_or(256) { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, producing the floating point representation of the \ integer", @@ -757,7 +792,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Applicability::MachineApplicable ); } else if can_cast { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("{}, producing the floating point representation of the \ integer, rounded if necessary", diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index b8544177bbb..60b5db0d12c 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use check::regionck::RegionCtxt; use hir::def_id::DefId; @@ -32,7 +22,7 @@ use syntax_pos::Span; /// coherence), /// /// 2. The generic region/type parameters of the impl's self-type must -/// all be parameters of the Drop impl itself (i.e. no +/// all be parameters of the Drop impl itself (i.e., no /// specialization like `impl Drop for Foo`), and, /// /// 3. Any bounds on the generic parameters must be reflected in the @@ -80,7 +70,7 @@ fn ensure_drop_params_and_item_params_correspond<'a, 'tcx>( drop_impl_ty: Ty<'tcx>, self_type_did: DefId, ) -> Result<(), ErrorReported> { - let drop_impl_node_id = tcx.hir.as_local_node_id(drop_impl_did).unwrap(); + let drop_impl_node_id = tcx.hir().as_local_node_id(drop_impl_did).unwrap(); // check that the impl type can be made to match the trait type. @@ -180,7 +170,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>( // // self_to_impl_substs = {'c => 'z, 'b => 'y, 'a => 'x} // - // Applying this to the predicates (i.e. assumptions) provided by the item + // Applying this to the predicates (i.e., assumptions) provided by the item // definition yields the instantiated assumptions: // // ['y : 'z] @@ -194,7 +184,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>( // absent. So we report an error that the Drop impl injected a // predicate that is not present on the struct definition. - let self_type_node_id = tcx.hir.as_local_node_id(self_type_did).unwrap(); + let self_type_node_id = tcx.hir().as_local_node_id(self_type_did).unwrap(); let drop_impl_span = tcx.def_span(drop_impl_did); @@ -226,7 +216,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>( // repeated `contains` calls. if !assumptions_in_impl_context.contains(&predicate) { - let item_span = tcx.hir.span(self_type_node_id); + let item_span = tcx.hir().span(self_type_node_id); struct_span_err!( tcx.sess, drop_impl_span, diff --git a/src/librustc_typeck/check/generator_interior.rs b/src/librustc_typeck/check/generator_interior.rs index b4ad9cfbc6d..225fa1dc4f4 100644 --- a/src/librustc_typeck/check/generator_interior.rs +++ b/src/librustc_typeck/check/generator_interior.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This calculates the types which has storage which lives across a suspension point in a //! generator from the perspective of typeck. The actual types used at runtime //! is calculated in `rustc_mir::transform::generator` and may be a subset of the @@ -86,7 +76,7 @@ pub fn resolve_interior<'a, 'gcx, 'tcx>(fcx: &'a FnCtxt<'a, 'gcx, 'tcx>, def_id: DefId, body_id: hir::BodyId, interior: Ty<'tcx>) { - let body = fcx.tcx.hir.body(body_id); + let body = fcx.tcx.hir().body(body_id); let mut visitor = InteriorVisitor { fcx, types: FxHashMap::default(), diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 9aad17626f9..82d4300d996 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -1,26 +1,13 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Type-checking for the rust-intrinsic and platform-intrinsic //! intrinsics that the compiler exposes. -use intrinsics; use rustc::traits::{ObligationCause, ObligationCauseCode}; use rustc::ty::{self, TyCtxt, Ty}; -use rustc::util::nodemap::FxHashMap; +use rustc::ty::subst::Subst; use require_same_types; use rustc_target::spec::abi::Abi; -use syntax::ast; use syntax::symbol::Symbol; -use syntax_pos::Span; use rustc::hir; @@ -35,7 +22,7 @@ fn equate_intrinsic_type<'a, 'tcx>( inputs: Vec>, output: Ty<'tcx>, ) { - let def_id = tcx.hir.local_def_id(it.id); + let def_id = tcx.hir().local_def_id(it.id); match it.node { hir::ForeignItemKind::Fn(..) => {} @@ -75,12 +62,36 @@ fn equate_intrinsic_type<'a, 'tcx>( require_same_types(tcx, &cause, tcx.mk_fn_ptr(tcx.fn_sig(def_id)), fty); } +/// Returns whether the given intrinsic is unsafe to call or not. +pub fn intrisic_operation_unsafety(intrinsic: &str) -> hir::Unsafety { + match intrinsic { + "size_of" | "min_align_of" | "needs_drop" | + "add_with_overflow" | "sub_with_overflow" | "mul_with_overflow" | + "overflowing_add" | "overflowing_sub" | "overflowing_mul" | + "saturating_add" | "saturating_sub" | + "rotate_left" | "rotate_right" | + "ctpop" | "ctlz" | "cttz" | "bswap" | "bitreverse" + => hir::Unsafety::Normal, + _ => hir::Unsafety::Unsafe, + } +} + /// Remember to add all intrinsics here, in librustc_codegen_llvm/intrinsic.rs, /// and in libcore/intrinsics.rs pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &hir::ForeignItem) { let param = |n| tcx.mk_ty_param(n, Symbol::intern(&format!("P{}", n)).as_interned_str()); - let name = it.name.as_str(); + let name = it.ident.as_str(); + + let mk_va_list_ty = || { + tcx.lang_items().va_list().map(|did| { + let region = tcx.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BrAnon(0))); + let env_region = ty::ReLateBound(ty::INNERMOST, ty::BrEnv); + let va_list_ty = tcx.type_of(did).subst(tcx, &[region.into()]); + tcx.mk_mut_ref(tcx.mk_region(env_region), va_list_ty) + }) + }; + let (n_tps, inputs, output, unsafety) = if name.starts_with("atomic_") { let split : Vec<&str> = name.split('_').collect(); assert!(split.len() >= 2, "Atomic intrinsic in an incorrect format"); @@ -116,10 +127,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } else if &name[..] == "abort" || &name[..] == "unreachable" { (0, Vec::new(), tcx.types.never, hir::Unsafety::Unsafe) } else { - let unsafety = match &name[..] { - "size_of" | "min_align_of" | "needs_drop" => hir::Unsafety::Normal, - _ => hir::Unsafety::Unsafe, - }; + let unsafety = intrisic_operation_unsafety(&name[..]); let (n_tps, inputs, output) = match &name[..] { "breakpoint" => (0, Vec::new(), tcx.mk_unit()), "size_of" | @@ -132,6 +140,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ], tcx.types.usize) } "rustc_peek" => (1, vec![param(0)], param(0)), + "panic_if_uninhabited" => (1, Vec::new(), tcx.mk_unit()), "init" => (1, Vec::new(), param(0)), "uninit" => (1, Vec::new(), param(0)), "forget" => (1, vec![param(0)], tcx.mk_unit()), @@ -299,6 +308,8 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, "overflowing_add" | "overflowing_sub" | "overflowing_mul" => (1, vec![param(0), param(0)], param(0)), + "saturating_add" | "saturating_sub" => + (1, vec![param(0), param(0)], param(0)), "fadd_fast" | "fsub_fast" | "fmul_fast" | "fdiv_fast" | "frem_fast" => (1, vec![param(0), param(0)], param(0)), @@ -323,6 +334,47 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, (0, vec![tcx.mk_fn_ptr(fn_ty), mut_u8, mut_u8], tcx.types.i32) } + "va_start" | "va_end" => { + match mk_va_list_ty() { + Some(va_list_ty) => (0, vec![va_list_ty], tcx.mk_unit()), + None => bug!("va_list lang_item must be defined to use va_list intrinsics") + } + } + + "va_copy" => { + match tcx.lang_items().va_list() { + Some(did) => { + let region = tcx.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BrAnon(0))); + let env_region = ty::ReLateBound(ty::INNERMOST, ty::BrEnv); + let va_list_ty = tcx.type_of(did).subst(tcx, &[region.into()]); + let ret_ty = match va_list_ty.sty { + ty::Adt(def, _) if def.is_struct() => { + let fields = &def.non_enum_variant().fields; + match tcx.type_of(fields[0].did).subst(tcx, &[region.into()]).sty { + ty::Ref(_, element_ty, _) => match element_ty.sty { + ty::Adt(..) => element_ty, + _ => va_list_ty + } + _ => bug!("va_list structure is invalid") + } + } + _ => { + bug!("va_list structure is invalid") + } + }; + (0, vec![tcx.mk_imm_ref(tcx.mk_region(env_region), va_list_ty)], ret_ty) + } + None => bug!("va_list lang_item must be defined to use va_list intrinsics") + } + } + + "va_arg" => { + match mk_va_list_ty() { + Some(va_list_ty) => (1, vec![va_list_ty], param(0)), + None => bug!("va_list lang_item must be defined to use va_list intrinsics") + } + } + "nontemporal_store" => { (1, vec![ tcx.mk_mut_ptr(param(0)), param(0) ], tcx.mk_unit()) } @@ -349,9 +401,7 @@ pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tcx.mk_ty_param(n, name) }; - let def_id = tcx.hir.local_def_id(it.id); - let i_n_tps = tcx.generics_of(def_id).own_counts().types; - let name = it.name.as_str(); + let name = it.ident.as_str(); let (n_tps, inputs, output) = match &*name { "simd_eq" | "simd_ne" | "simd_lt" | "simd_le" | "simd_gt" | "simd_ge" => { @@ -383,7 +433,9 @@ pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, "simd_insert" => (2, vec![param(0), tcx.types.u32, param(1)], param(0)), "simd_extract" => (2, vec![param(0), tcx.types.u32], param(1)), "simd_cast" => (2, vec![param(0)], param(1)), - "simd_select" => (2, vec![param(0), param(1), param(1)], param(1)), + "simd_bitmask" => (2, vec![param(0)], param(1)), + "simd_select" | + "simd_select_bitmask" => (2, vec![param(0), param(1), param(1)], param(1)), "simd_reduce_all" | "simd_reduce_any" => (1, vec![param(0)], tcx.types.bool), "simd_reduce_add_ordered" | "simd_reduce_mul_ordered" => (2, vec![param(0), param(1)], param(1)), @@ -407,159 +459,12 @@ pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } _ => { - match intrinsics::Intrinsic::find(&name) { - Some(intr) => { - // this function is a platform specific intrinsic - if i_n_tps != 0 { - span_err!(tcx.sess, it.span, E0440, - "platform-specific intrinsic has wrong number of type \ - parameters: found {}, expected 0", - i_n_tps); - return - } - - let mut structural_to_nomimal = FxHashMap::default(); - - let sig = tcx.fn_sig(def_id); - let sig = sig.no_bound_vars().unwrap(); - if intr.inputs.len() != sig.inputs().len() { - span_err!(tcx.sess, it.span, E0444, - "platform-specific intrinsic has invalid number of \ - arguments: found {}, expected {}", - sig.inputs().len(), intr.inputs.len()); - return - } - let input_pairs = intr.inputs.iter().zip(sig.inputs()); - for (i, (expected_arg, arg)) in input_pairs.enumerate() { - match_intrinsic_type_to_type(tcx, &format!("argument {}", i + 1), it.span, - &mut structural_to_nomimal, expected_arg, arg); - } - match_intrinsic_type_to_type(tcx, "return value", it.span, - &mut structural_to_nomimal, - &intr.output, sig.output()); - return - } - None => { - span_err!(tcx.sess, it.span, E0441, - "unrecognized platform-specific intrinsic function: `{}`", name); - return; - } - } + let msg = format!("unrecognized platform-specific intrinsic function: `{}`", name); + tcx.sess.span_err(it.span, &msg); + return; } }; equate_intrinsic_type(tcx, it, n_tps, Abi::PlatformIntrinsic, hir::Unsafety::Unsafe, inputs, output) } - -// walk the expected type and the actual type in lock step, checking they're -// the same, in a kinda-structural way, i.e. `Vector`s have to be simd structs with -// exactly the right element type -fn match_intrinsic_type_to_type<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, - position: &str, - span: Span, - structural_to_nominal: &mut FxHashMap<&'a intrinsics::Type, Ty<'tcx>>, - expected: &'a intrinsics::Type, t: Ty<'tcx>) -{ - use intrinsics::Type::*; - - let simple_error = |real: &str, expected: &str| { - span_err!(tcx.sess, span, E0442, - "intrinsic {} has wrong type: found {}, expected {}", - position, real, expected) - }; - - match *expected { - Void => match t.sty { - ty::Tuple(ref v) if v.is_empty() => {}, - _ => simple_error(&format!("`{}`", t), "()"), - }, - // (The width we pass to LLVM doesn't concern the type checker.) - Integer(signed, bits, _llvm_width) => match (signed, bits, &t.sty) { - (true, 8, &ty::Int(ast::IntTy::I8)) | - (false, 8, &ty::Uint(ast::UintTy::U8)) | - (true, 16, &ty::Int(ast::IntTy::I16)) | - (false, 16, &ty::Uint(ast::UintTy::U16)) | - (true, 32, &ty::Int(ast::IntTy::I32)) | - (false, 32, &ty::Uint(ast::UintTy::U32)) | - (true, 64, &ty::Int(ast::IntTy::I64)) | - (false, 64, &ty::Uint(ast::UintTy::U64)) | - (true, 128, &ty::Int(ast::IntTy::I128)) | - (false, 128, &ty::Uint(ast::UintTy::U128)) => {}, - _ => simple_error(&format!("`{}`", t), - &format!("`{}{n}`", - if signed {"i"} else {"u"}, - n = bits)), - }, - Float(bits) => match (bits, &t.sty) { - (32, &ty::Float(ast::FloatTy::F32)) | - (64, &ty::Float(ast::FloatTy::F64)) => {}, - _ => simple_error(&format!("`{}`", t), - &format!("`f{n}`", n = bits)), - }, - Pointer(ref inner_expected, ref _llvm_type, const_) => { - match t.sty { - ty::RawPtr(ty::TypeAndMut { ty, mutbl }) => { - if (mutbl == hir::MutImmutable) != const_ { - simple_error(&format!("`{}`", t), - if const_ {"const pointer"} else {"mut pointer"}) - } - match_intrinsic_type_to_type(tcx, position, span, structural_to_nominal, - inner_expected, ty) - } - _ => simple_error(&format!("`{}`", t), "raw pointer"), - } - } - Vector(ref inner_expected, ref _llvm_type, len) => { - if !t.is_simd() { - simple_error(&format!("non-simd type `{}`", t), "simd type"); - return; - } - let t_len = t.simd_size(tcx); - if len as usize != t_len { - simple_error(&format!("vector with length {}", t_len), - &format!("length {}", len)); - return; - } - let t_ty = t.simd_type(tcx); - { - // check that a given structural type always has the same an intrinsic definition - let previous = structural_to_nominal.entry(expected).or_insert(t); - if *previous != t { - // this gets its own error code because it is non-trivial - span_err!(tcx.sess, span, E0443, - "intrinsic {} has wrong type: found `{}`, expected `{}` which \ - was used for this vector type previously in this signature", - position, - t, - *previous); - return; - } - } - match_intrinsic_type_to_type(tcx, - position, - span, - structural_to_nominal, - inner_expected, - t_ty) - } - Aggregate(_flatten, ref expected_contents) => { - match t.sty { - ty::Tuple(contents) => { - if contents.len() != expected_contents.len() { - simple_error(&format!("tuple with length {}", contents.len()), - &format!("tuple with length {}", expected_contents.len())); - return - } - for (e, c) in expected_contents.iter().zip(contents) { - match_intrinsic_type_to_type(tcx, position, span, structural_to_nominal, - e, c) - } - } - _ => simple_error(&format!("`{}`", t), - "tuple"), - } - } - } -} diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 5144f3e41d4..2cf2974a45a 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::{probe, MethodCallee}; use astconv::AstConv; @@ -161,9 +151,9 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { let (_, n) = autoderef.nth(pick.autoderefs).unwrap(); assert_eq!(n, pick.autoderefs); - let mut adjustments = autoderef.adjust_steps(Needs::None); + let mut adjustments = autoderef.adjust_steps(self, Needs::None); - let mut target = autoderef.unambiguous_final_ty(); + let mut target = autoderef.unambiguous_final_ty(self); if let Some(mutbl) = pick.autoref { let region = self.next_region_var(infer::Autoref(self.span)); @@ -202,7 +192,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { assert!(pick.unsize.is_none()); } - autoderef.finalize(); + autoderef.finalize(self); // Write out the final adjustments. self.apply_adjustments(self.self_expr, adjustments); @@ -290,7 +280,11 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { .include_raw_pointers() .filter_map(|(ty, _)| match ty.sty { - ty::Dynamic(ref data, ..) => Some(closure(self, ty, data.principal())), + ty::Dynamic(ref data, ..) => { + Some(closure(self, ty, data.principal().unwrap_or_else(|| { + span_bug!(self.span, "calling trait method on empty object?") + }))) + }, _ => None, } ) @@ -395,7 +389,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { // Instantiate late-bound regions and substitute the trait // parameters into the method type to get the actual method type. // - // NB: Instantiate late-bound regions first so that + // N.B., instantiate late-bound regions first so that // `instantiate_type_scheme` can normalize associated types that // may reference those regions. let method_sig = self.replace_bound_vars_with_fresh_vars(&sig); diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index ac338ba6678..b7d015729b4 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -1,47 +1,37 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Method lookup: the secret sauce of Rust. See the [rustc guide] chapter. +//! Method lookup: the secret sauce of Rust. See the [rustc guide] for more information. //! -//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/method-lookup.html +//! [rustc guide]: https://rust-lang.github.io/rustc-guide/method-lookup.html + +mod confirm; +pub mod probe; +mod suggest; + +pub use self::MethodError::*; +pub use self::CandidateSource::*; +pub use self::suggest::{SelfSource, TraitInfo}; use check::FnCtxt; -use hir::def::Def; -use hir::def_id::DefId; +use errors::{Applicability, DiagnosticBuilder}; use namespace::Namespace; -use rustc::ty::subst::Substs; +use rustc_data_structures::sync::Lrc; +use rustc::hir; +use rustc::hir::def::Def; +use rustc::hir::def_id::DefId; use rustc::traits; +use rustc::ty::subst::Substs; use rustc::ty::{self, Ty, ToPredicate, ToPolyTraitRef, TraitRef, TypeFoldable}; use rustc::ty::GenericParamDefKind; use rustc::ty::subst::Subst; use rustc::infer::{self, InferOk}; - use syntax::ast; use syntax_pos::Span; -use rustc::hir; - -use rustc_data_structures::sync::Lrc; - -pub use self::MethodError::*; -pub use self::CandidateSource::*; -pub use self::suggest::TraitInfo; - -mod confirm; -pub mod probe; -mod suggest; - +use crate::{check_type_alias_enum_variants_enabled}; use self::probe::{IsSuggestion, ProbeScope}; pub fn provide(providers: &mut ty::query::Providers) { suggest::provide(providers); + probe::provide(providers); } #[derive(Clone, Copy, Debug)] @@ -50,7 +40,7 @@ pub struct MethodCallee<'tcx> { pub def_id: DefId, pub substs: &'tcx Substs<'tcx>, - /// Instantiated method signature, i.e. it has been + /// Instantiated method signature, i.e., it has been /// substituted, normalized, and has had late-bound /// lifetimes replaced with inference variables. pub sig: ty::FnSig<'tcx>, @@ -107,8 +97,7 @@ impl<'tcx> NoMatchData<'tcx> { #[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] pub enum CandidateSource { ImplSource(DefId), - TraitSource(// trait id - DefId), + TraitSource(DefId /* trait id */), } impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { @@ -135,6 +124,42 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } + /// Add a suggestion to call the given method to the provided diagnostic. + crate fn suggest_method_call( + &self, + err: &mut DiagnosticBuilder<'a>, + msg: &str, + method_name: ast::Ident, + self_ty: Ty<'tcx>, + call_expr_id: ast::NodeId, + ) { + let has_params = self + .probe_for_name( + method_name.span, + probe::Mode::MethodCall, + method_name, + IsSuggestion(false), + self_ty, + call_expr_id, + ProbeScope::TraitsInScope, + ) + .and_then(|pick| { + let sig = self.tcx.fn_sig(pick.item.def_id); + Ok(sig.inputs().skip_binder().len() > 1) + }); + + let (suggestion, applicability) = if has_params.unwrap_or_default() { + ( + format!("{}(...)", method_name), + Applicability::HasPlaceholders, + ) + } else { + (format!("{}()", method_name), Applicability::MaybeIncorrect) + }; + + err.span_suggestion(method_name.span, msg, suggestion, applicability); + } + /// Performs method lookup. If lookup is successful, it will return the callee /// and store an appropriate adjustment for the self-expr. In some cases it may /// report an error (e.g., invoking the `drop` method). @@ -171,10 +196,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { )?; if let Some(import_id) = pick.import_id { - let import_def_id = self.tcx.hir.local_def_id(import_id); + let import_def_id = self.tcx.hir().local_def_id(import_id); debug!("used_trait_import: {:?}", import_def_id); Lrc::get_mut(&mut self.tables.borrow_mut().used_trait_imports) - .unwrap().insert(import_def_id); + .unwrap().insert(import_def_id); } self.tcx.check_stability(pick.item.def_id, Some(call_expr.id), span); @@ -239,7 +264,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// an obligation for a particular trait with the given self-type and checks /// whether that trait is implemented. /// - /// FIXME(#18741) -- It seems likely that we can consolidate some of this + /// FIXME(#18741): it seems likely that we can consolidate some of this /// code with the other method-lookup code. In particular, the second half /// of this method is basically the same as confirmation. pub fn lookup_method_in_trait(&self, @@ -307,7 +332,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Instantiate late-bound regions and substitute the trait // parameters into the method type to get the actual method type. // - // NB: Instantiate late-bound regions first so that + // N.B., instantiate late-bound regions first so that // `instantiate_type_scheme` can normalize associated types that // may reference those regions. let fn_sig = tcx.fn_sig(def_id); @@ -324,7 +349,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } }; - // Register obligations for the parameters. This will include the + // Register obligations for the parameters. This will include the // `Self` parameter, which in turn has a bound of the main trait, // so this also effectively registers `obligation` as well. (We // used to register `obligation` explicitly, but that resulted in @@ -369,26 +394,49 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }) } - pub fn resolve_ufcs(&self, - span: Span, - method_name: ast::Ident, - self_ty: Ty<'tcx>, - expr_id: ast::NodeId) - -> Result> { - let mode = probe::Mode::Path; - let pick = self.probe_for_name(span, mode, method_name, IsSuggestion(false), - self_ty, expr_id, ProbeScope::TraitsInScope)?; + pub fn resolve_ufcs( + &self, + span: Span, + method_name: ast::Ident, + self_ty: Ty<'tcx>, + expr_id: ast::NodeId + ) -> Result> { + debug!( + "resolve_ufcs: method_name={:?} self_ty={:?} expr_id={:?}", + method_name, self_ty, expr_id, + ); + let tcx = self.tcx; + + // Check if we have an enum variant. + if let ty::Adt(adt_def, _) = self_ty.sty { + if adt_def.is_enum() { + let variant_def = adt_def.variants.iter().find(|vd| { + tcx.hygienic_eq(method_name, vd.ident, adt_def.did) + }); + if let Some(variant_def) = variant_def { + check_type_alias_enum_variants_enabled(tcx, span); + + let def = Def::VariantCtor(variant_def.did, variant_def.ctor_kind); + tcx.check_stability(def.def_id(), Some(expr_id), span); + return Ok(def); + } + } + } + + let pick = self.probe_for_name(span, probe::Mode::Path, method_name, IsSuggestion(false), + self_ty, expr_id, ProbeScope::TraitsInScope)?; + debug!("resolve_ufcs: pick={:?}", pick); if let Some(import_id) = pick.import_id { - let import_def_id = self.tcx.hir.local_def_id(import_id); - debug!("used_trait_import: {:?}", import_def_id); + let import_def_id = tcx.hir().local_def_id(import_id); + debug!("resolve_ufcs: used_trait_import: {:?}", import_def_id); Lrc::get_mut(&mut self.tables.borrow_mut().used_trait_imports) - .unwrap().insert(import_def_id); + .unwrap().insert(import_def_id); } let def = pick.item.def(); - self.tcx.check_stability(def.def_id(), Some(expr_id), span); - + debug!("resolve_ufcs: def={:?}", def); + tcx.check_stability(def.def_id(), Some(expr_id), span); Ok(def) } diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 0373bf4e752..623677482db 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -1,47 +1,44 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::MethodError; use super::NoMatchData; use super::{CandidateSource, ImplSource, TraitSource}; use super::suggest; +use check::autoderef::{self, Autoderef}; use check::FnCtxt; use hir::def_id::DefId; use hir::def::Def; use namespace::Namespace; + +use rustc_data_structures::sync::Lrc; use rustc::hir; use rustc::lint; use rustc::session::config::nightly_options; use rustc::ty::subst::{Subst, Substs}; use rustc::traits::{self, ObligationCause}; -use rustc::ty::{self, Ty, ToPolyTraitRef, ToPredicate, TraitRef, TypeFoldable}; +use rustc::traits::query::{CanonicalTyGoal}; +use rustc::traits::query::method_autoderef::{CandidateStep, MethodAutoderefStepsResult}; +use rustc::traits::query::method_autoderef::{MethodAutoderefBadTy}; +use rustc::ty::{self, ParamEnvAnd, Ty, TyCtxt, ToPolyTraitRef, ToPredicate, TraitRef, TypeFoldable}; use rustc::ty::GenericParamDefKind; use rustc::infer::type_variable::TypeVariableOrigin; use rustc::util::nodemap::FxHashSet; use rustc::infer::{self, InferOk}; +use rustc::infer::canonical::{Canonical, QueryResponse}; +use rustc::infer::canonical::{OriginalQueryValues}; use rustc::middle::stability; use syntax::ast; use syntax::util::lev_distance::{lev_distance, find_best_match_for_name}; -use syntax_pos::{Span, symbol::Symbol}; +use syntax_pos::{DUMMY_SP, Span, symbol::Symbol}; use std::iter; use std::mem; use std::ops::Deref; -use std::rc::Rc; use std::cmp::max; use self::CandidateKind::*; pub use self::PickKind::*; /// Boolean flag used to indicate if this search is for a suggestion -/// or not. If true, we can allow ambiguity and so forth. +/// or not. If true, we can allow ambiguity and so forth. #[derive(Clone, Copy)] pub struct IsSuggestion(pub bool); @@ -51,7 +48,12 @@ struct ProbeContext<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { mode: Mode, method_name: Option, return_type: Option>, - steps: Rc>>, + + /// This is the OriginalQueryValues for the steps queries + /// that are answered in steps. + orig_steps_var_values: OriginalQueryValues<'tcx>, + steps: Lrc>>, + inherent_candidates: Vec>, extension_candidates: Vec>, impl_dups: FxHashSet, @@ -81,19 +83,6 @@ impl<'a, 'gcx, 'tcx> Deref for ProbeContext<'a, 'gcx, 'tcx> { } } -#[derive(Debug)] -struct CandidateStep<'tcx> { - self_ty: Ty<'tcx>, - autoderefs: usize, - // true if the type results from a dereference of a raw pointer. - // when assembling candidates, we include these steps, but not when - // picking methods. This so that if we have `foo: *const Foo` and `Foo` has methods - // `fn by_raw_ptr(self: *const Self)` and `fn by_ref(&self)`, then - // `foo.by_raw_ptr()` will work and `foo.by_ref()` won't. - from_unsafe_deref: bool, - unsize: bool, -} - #[derive(Debug)] struct Candidate<'tcx> { xform_self_ty: Ty<'tcx>, @@ -249,42 +238,111 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { -> Result> where OP: FnOnce(ProbeContext<'a, 'gcx, 'tcx>) -> Result> { - // FIXME(#18741) -- right now, creating the steps involves evaluating the - // `*` operator, which registers obligations that then escape into - // the global fulfillment context and thus has global - // side-effects. This is a bit of a pain to refactor. So just let - // it ride, although it's really not great, and in fact could I - // think cause spurious errors. Really though this part should - // take place in the `self.probe` below. + let mut orig_values = OriginalQueryValues::default(); + let param_env_and_self_ty = + self.infcx.canonicalize_query( + &ParamEnvAnd { + param_env: self.param_env, + value: self_ty + }, &mut orig_values); + let steps = if mode == Mode::MethodCall { - match self.create_steps(span, scope_expr_id, self_ty, is_suggestion) { - Some(steps) => steps, - None => { - return Err(MethodError::NoMatch(NoMatchData::new(Vec::new(), - Vec::new(), - Vec::new(), - None, - mode))) - } - } + self.tcx.method_autoderef_steps(param_env_and_self_ty) } else { - vec![CandidateStep { - self_ty, - autoderefs: 0, - from_unsafe_deref: false, - unsize: false, - }] + self.infcx.probe(|_| { + // Mode::Path - the deref steps is "trivial". This turns + // our CanonicalQuery into a "trivial" QueryResponse. This + // is a bit inefficient, but I don't think that writing + // special handling for this "trivial case" is a good idea. + + let infcx = &self.infcx; + let (ParamEnvAnd { + param_env: _, + value: self_ty + }, canonical_inference_vars) = + infcx.instantiate_canonical_with_fresh_inference_vars( + span, ¶m_env_and_self_ty); + debug!("probe_op: Mode::Path, param_env_and_self_ty={:?} self_ty={:?}", + param_env_and_self_ty, self_ty); + MethodAutoderefStepsResult { + steps: Lrc::new(vec![CandidateStep { + self_ty: self.make_query_response_ignoring_pending_obligations( + canonical_inference_vars, self_ty), + autoderefs: 0, + from_unsafe_deref: false, + unsize: false, + }]), + opt_bad_ty: None, + reached_recursion_limit: false + } + }) }; + // If our autoderef loop had reached the recursion limit, + // report an overflow error, but continue going on with + // the truncated autoderef list. + if steps.reached_recursion_limit { + self.probe(|_| { + let ty = &steps.steps.last().unwrap_or_else(|| { + span_bug!(span, "reached the recursion limit in 0 steps?") + }).self_ty; + let ty = self.probe_instantiate_query_response(span, &orig_values, ty) + .unwrap_or_else(|_| span_bug!(span, "instantiating {:?} failed?", ty)); + autoderef::report_autoderef_recursion_limit_error(self.tcx, span, + ty.value); + }); + } + + + // If we encountered an `_` type or an error type during autoderef, this is + // ambiguous. + if let Some(bad_ty) = &steps.opt_bad_ty { + if is_suggestion.0 { + // Ambiguity was encountered during a suggestion. Just keep going. + debug!("ProbeContext: encountered ambiguity in suggestion"); + } else if bad_ty.reached_raw_pointer && !self.tcx.features().arbitrary_self_types { + // this case used to be allowed by the compiler, + // so we do a future-compat lint here for the 2015 edition + // (see https://github.com/rust-lang/rust/issues/46906) + if self.tcx.sess.rust_2018() { + span_err!(self.tcx.sess, span, E0699, + "the type of this value must be known \ + to call a method on a raw pointer on it"); + } else { + self.tcx.lint_node( + lint::builtin::TYVAR_BEHIND_RAW_POINTER, + scope_expr_id, + span, + "type annotations needed"); + } + } else { + // Encountered a real ambiguity, so abort the lookup. If `ty` is not + // an `Err`, report the right "type annotations needed" error pointing + // to it. + let ty = &bad_ty.ty; + let ty = self.probe_instantiate_query_response(span, &orig_values, ty) + .unwrap_or_else(|_| span_bug!(span, "instantiating {:?} failed?", ty)); + let ty = self.structurally_resolved_type(span, ty.value); + assert_eq!(ty, self.tcx.types.err); + return Err(MethodError::NoMatch(NoMatchData::new(Vec::new(), + Vec::new(), + Vec::new(), + None, + mode))); + } + } + debug!("ProbeContext: steps for self_ty={:?} are {:?}", self_ty, steps); + // this creates one big transaction so that all type variables etc // that we create during the probe process are removed later self.probe(|_| { let mut probe_cx = ProbeContext::new( - self, span, mode, method_name, return_type, Rc::new(steps), is_suggestion, + self, span, mode, method_name, return_type, orig_values, + steps.steps, is_suggestion, ); probe_cx.assemble_inherent_candidates(); @@ -297,21 +355,30 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { op(probe_cx) }) } +} + +pub fn provide(providers: &mut ty::query::Providers) { + providers.method_autoderef_steps = method_autoderef_steps; +} + +fn method_autoderef_steps<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, + goal: CanonicalTyGoal<'tcx>) + -> MethodAutoderefStepsResult<'gcx> +{ + debug!("method_autoderef_steps({:?})", goal); - fn create_steps(&self, - span: Span, - scope_expr_id: ast::NodeId, - self_ty: Ty<'tcx>, - is_suggestion: IsSuggestion) - -> Option>> { - // FIXME: we don't need to create the entire steps in one pass + tcx.infer_ctxt().enter_with_canonical(DUMMY_SP, &goal, |ref infcx, goal, inference_vars| { + let ParamEnvAnd { param_env, value: self_ty } = goal; - let mut autoderef = self.autoderef(span, self_ty).include_raw_pointers(); + let mut autoderef = Autoderef::new(infcx, param_env, ast::DUMMY_NODE_ID, DUMMY_SP, self_ty) + .include_raw_pointers() + .silence_errors(); let mut reached_raw_pointer = false; let mut steps: Vec<_> = autoderef.by_ref() .map(|(ty, d)| { let step = CandidateStep { - self_ty: ty, + self_ty: infcx.make_query_response_ignoring_pending_obligations( + inference_vars.clone(), ty), autoderefs: d, from_unsafe_deref: reached_raw_pointer, unsize: false, @@ -325,68 +392,52 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .collect(); let final_ty = autoderef.maybe_ambiguous_final_ty(); - match final_ty.sty { - ty::Infer(ty::TyVar(_)) => { - // Ended in an inference variable. If we are doing - // a real method lookup, this is a hard error because it's - // possible that there will be multiple applicable methods. - if !is_suggestion.0 { - if reached_raw_pointer - && !self.tcx.features().arbitrary_self_types { - // this case used to be allowed by the compiler, - // so we do a future-compat lint here for the 2015 edition - // (see https://github.com/rust-lang/rust/issues/46906) - if self.tcx.sess.rust_2018() { - span_err!(self.tcx.sess, span, E0699, - "the type of this value must be known \ - to call a method on a raw pointer on it"); - } else { - self.tcx.lint_node( - lint::builtin::TYVAR_BEHIND_RAW_POINTER, - scope_expr_id, - span, - "type annotations needed"); - } - } else { - let t = self.structurally_resolved_type(span, final_ty); - assert_eq!(t, self.tcx.types.err); - return None - } - } else { - // If we're just looking for suggestions, - // though, ambiguity is no big thing, we can - // just ignore it. - } + let opt_bad_ty = match final_ty.sty { + ty::Infer(ty::TyVar(_)) | + ty::Error => { + Some(MethodAutoderefBadTy { + reached_raw_pointer, + ty: infcx.make_query_response_ignoring_pending_obligations( + inference_vars, final_ty) + }) } ty::Array(elem_ty, _) => { let dereferences = steps.len() - 1; steps.push(CandidateStep { - self_ty: self.tcx.mk_slice(elem_ty), + self_ty: infcx.make_query_response_ignoring_pending_obligations( + inference_vars, infcx.tcx.mk_slice(elem_ty)), autoderefs: dereferences, // this could be from an unsafe deref if we had // a *mut/const [T; N] from_unsafe_deref: reached_raw_pointer, unsize: true, }); + + None } - ty::Error => return None, - _ => (), - } + _ => None + }; - debug!("create_steps: steps={:?}", steps); + debug!("method_autoderef_steps: steps={:?} opt_bad_ty={:?}", steps, opt_bad_ty); - Some(steps) - } + MethodAutoderefStepsResult { + steps: Lrc::new(steps), + opt_bad_ty: opt_bad_ty.map(Lrc::new), + reached_recursion_limit: autoderef.reached_recursion_limit() + } + }) } + impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { fn new(fcx: &'a FnCtxt<'a, 'gcx, 'tcx>, span: Span, mode: Mode, method_name: Option, return_type: Option>, - steps: Rc>>, + orig_steps_var_values: OriginalQueryValues<'tcx>, + steps: Lrc>>, is_suggestion: IsSuggestion) -> ProbeContext<'a, 'gcx, 'tcx> { ProbeContext { @@ -398,7 +449,8 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { inherent_candidates: Vec::new(), extension_candidates: Vec::new(), impl_dups: FxHashSet::default(), - steps: steps, + orig_steps_var_values, + steps, static_candidates: Vec::new(), allow_similar_names: false, private_candidate: None, @@ -443,19 +495,26 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { fn assemble_inherent_candidates(&mut self) { let steps = self.steps.clone(); for step in steps.iter() { - self.assemble_probe(step.self_ty); + self.assemble_probe(&step.self_ty); } } - fn assemble_probe(&mut self, self_ty: Ty<'tcx>) { + fn assemble_probe(&mut self, self_ty: &Canonical<'gcx, QueryResponse<'gcx, Ty<'gcx>>>) { debug!("assemble_probe: self_ty={:?}", self_ty); let lang_items = self.tcx.lang_items(); - match self_ty.sty { + match self_ty.value.value.sty { ty::Dynamic(ref data, ..) => { - let p = data.principal(); - self.assemble_inherent_candidates_from_object(self_ty, p); - self.assemble_inherent_impl_candidates_for_type(p.def_id()); + if let Some(p) = data.principal() { + let InferOk { value: instantiated_self_ty, obligations: _ } = + self.fcx.probe_instantiate_query_response( + self.span, &self.orig_steps_var_values, self_ty) + .unwrap_or_else(|_| { + span_bug!(self.span, "{:?} was applicable but now isn't?", self_ty) + }); + self.assemble_inherent_candidates_from_object(instantiated_self_ty); + self.assemble_inherent_impl_candidates_for_type(p.def_id()); + } } ty::Adt(def, _) => { self.assemble_inherent_impl_candidates_for_type(def.did); @@ -464,7 +523,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { self.assemble_inherent_impl_candidates_for_type(did); } ty::Param(p) => { - self.assemble_inherent_candidates_from_param(self_ty, p); + self.assemble_inherent_candidates_from_param(p); } ty::Char => { let lang_def_id = lang_items.char_impl(); @@ -615,11 +674,18 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { } fn assemble_inherent_candidates_from_object(&mut self, - self_ty: Ty<'tcx>, - principal: ty::PolyExistentialTraitRef<'tcx>) { + self_ty: Ty<'tcx>) { debug!("assemble_inherent_candidates_from_object(self_ty={:?})", self_ty); + let principal = match self_ty.sty { + ty::Dynamic(ref data, ..) => Some(data), + _ => None + }.and_then(|data| data.principal()).unwrap_or_else(|| { + span_bug!(self.span, "non-object {:?} in assemble_inherent_candidates_from_object", + self_ty) + }); + // It is illegal to invoke a method on a trait instance that // refers to the `Self` type. An error will be reported by // `enforce_object_limitations()` if the method refers to the @@ -642,7 +708,6 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { } fn assemble_inherent_candidates_from_param(&mut self, - _rcvr_ty: Ty<'tcx>, param_ty: ty::ParamTy) { // FIXME -- Do we want to commit to this behavior for param bounds? @@ -720,7 +785,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { return Ok(()) } let mut duplicates = FxHashSet::default(); - let expr_hir_id = self.tcx.hir.node_to_hir_id(expr_id); + let expr_hir_id = self.tcx.hir().node_to_hir_id(expr_id); let opt_applicable_traits = self.tcx.in_scope_traits(expr_hir_id); if let Some(applicable_traits) = opt_applicable_traits { for trait_candidate in applicable_traits.iter() { @@ -898,14 +963,22 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { // a raw pointer !step.self_ty.references_error() && !step.from_unsafe_deref }).flat_map(|step| { - self.pick_by_value_method(step).or_else(|| { - self.pick_autorefd_method(step, hir::MutImmutable).or_else(|| { - self.pick_autorefd_method(step, hir::MutMutable) + let InferOk { value: self_ty, obligations: _ } = + self.fcx.probe_instantiate_query_response( + self.span, &self.orig_steps_var_values, &step.self_ty + ).unwrap_or_else(|_| { + span_bug!(self.span, "{:?} was applicable but now isn't?", step.self_ty) + }); + self.pick_by_value_method(step, self_ty).or_else(|| { + self.pick_autorefd_method(step, self_ty, hir::MutImmutable).or_else(|| { + self.pick_autorefd_method(step, self_ty, hir::MutMutable) })})}) .next() } - fn pick_by_value_method(&mut self, step: &CandidateStep<'tcx>) -> Option> { + fn pick_by_value_method(&mut self, step: &CandidateStep<'gcx>, self_ty: Ty<'tcx>) + -> Option> + { //! For each type `T` in the step list, this attempts to find a //! method where the (transformed) self type is exactly `T`. We //! do however do one transformation on the adjustment: if we @@ -918,12 +991,12 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { return None; } - self.pick_method(step.self_ty).map(|r| { + self.pick_method(self_ty).map(|r| { r.map(|mut pick| { pick.autoderefs = step.autoderefs; // Insert a `&*` or `&mut *` if this is a reference type: - if let ty::Ref(_, _, mutbl) = step.self_ty.sty { + if let ty::Ref(_, _, mutbl) = step.self_ty.value.value.sty { pick.autoderefs += 1; pick.autoref = Some(mutbl); } @@ -933,7 +1006,10 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { }) } - fn pick_autorefd_method(&mut self, step: &CandidateStep<'tcx>, mutbl: hir::Mutability) + fn pick_autorefd_method(&mut self, + step: &CandidateStep<'gcx>, + self_ty: Ty<'tcx>, + mutbl: hir::Mutability) -> Option> { let tcx = self.tcx; @@ -943,14 +1019,14 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { let autoref_ty = tcx.mk_ref(region, ty::TypeAndMut { - ty: step.self_ty, mutbl + ty: self_ty, mutbl }); self.pick_method(autoref_ty).map(|r| { r.map(|mut pick| { pick.autoderefs = step.autoderefs; pick.autoref = Some(mutbl); pick.unsize = if step.unsize { - Some(step.self_ty) + Some(self_ty) } else { None }; @@ -1068,7 +1144,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { "a method with this name may be added to the standard library in the future", ); - // FIXME: This should be a `span_suggestion_with_applicability` instead of `help` + // FIXME: This should be a `span_suggestion` instead of `help` // However `self.span` only // highlights the method name, so we can't use it. Also consider reusing the code from // `report_method_error()`. @@ -1288,7 +1364,9 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { let steps = self.steps.clone(); self.probe(|_| { let mut pcx = ProbeContext::new(self.fcx, self.span, self.mode, self.method_name, - self.return_type, steps, IsSuggestion(true)); + self.return_type, + self.orig_steps_var_values.clone(), + steps, IsSuggestion(true)); pcx.allow_similar_names = true; pcx.assemble_inherent_candidates(); pcx.assemble_extension_candidates_for_traits_in_scope(ast::DUMMY_NODE_ID)?; @@ -1494,7 +1572,7 @@ impl<'tcx> Candidate<'tcx> { // `WhereClausePick`. assert!( !trait_ref.skip_binder().substs.needs_infer() - && !trait_ref.skip_binder().substs.has_skol() + && !trait_ref.skip_binder().substs.has_placeholders() ); WhereClausePick(trait_ref.clone()) diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index cd243d41443..55b6e8f099e 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -1,40 +1,24 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Give useful errors and suggestions to users when an item can't be //! found or is otherwise invalid. use check::FnCtxt; -use rustc::hir::map as hir_map; -use hir::Node; -use rustc_data_structures::sync::Lrc; -use rustc::ty::{self, Ty, TyCtxt, ToPolyTraitRef, ToPredicate, TypeFoldable}; -use rustc::ty::item_path::with_crate_prefix; -use hir::def::Def; -use hir::def_id::{CRATE_DEF_INDEX, DefId}; +use errors::{Applicability, DiagnosticBuilder}; use middle::lang_items::FnOnceTraitLangItem; use namespace::Namespace; +use rustc_data_structures::sync::Lrc; +use rustc::hir::{self, ExprKind, Node, QPath}; +use rustc::hir::def::Def; +use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId}; +use rustc::hir::map as hir_map; +use rustc::hir::print; +use rustc::infer::type_variable::TypeVariableOrigin; use rustc::traits::Obligation; +use rustc::ty::{self, Adt, Ty, TyCtxt, ToPolyTraitRef, ToPredicate, TypeFoldable}; +use rustc::ty::item_path::with_crate_prefix; use util::nodemap::FxHashSet; - +use syntax_pos::{Span, FileName}; use syntax::ast; use syntax::util::lev_distance::find_best_match_for_name; -use errors::{Applicability, DiagnosticBuilder}; -use syntax_pos::{Span, FileName}; - - -use rustc::hir::def_id::LOCAL_CRATE; -use rustc::hir; -use rustc::hir::print; -use rustc::infer::type_variable::TypeVariableOrigin; -use rustc::ty::Adt; use std::cmp::Ordering; @@ -45,12 +29,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn is_fn_ty(&self, ty: &Ty<'tcx>, span: Span) -> bool { let tcx = self.tcx; match ty.sty { - // Not all of these (e.g. unsafe fns) implement FnOnce - // so we look for these beforehand + // Not all of these (e.g., unsafe fns) implement `FnOnce`, + // so we look for these beforehand. ty::Closure(..) | ty::FnDef(..) | ty::FnPtr(_) => true, - // If it's not a simple function, look for things which implement FnOnce + // If it's not a simple function, look for things which implement `FnOnce`. _ => { let fn_once = match tcx.lang_items().require(FnOnceTraitLangItem) { Ok(fn_once) => fn_once, @@ -76,14 +60,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - pub fn report_method_error(&self, - span: Span, - rcvr_ty: Ty<'tcx>, - item_name: ast::Ident, - rcvr_expr: Option<&hir::Expr>, - error: MethodError<'tcx>, - args: Option<&'gcx [hir::Expr]>) { - // avoid suggestions when we don't know what's going on. + pub fn report_method_error<'b>(&self, + span: Span, + rcvr_ty: Ty<'tcx>, + item_name: ast::Ident, + source: SelfSource<'b>, + error: MethodError<'tcx>, + args: Option<&'gcx [hir::Expr]>) { + // Avoid suggestions when we don't know what's going on. if rcvr_ty.references_error() { return; } @@ -107,8 +91,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Namespace::Value, ) }).unwrap(); - let note_span = self.tcx.hir.span_if_local(item.def_id).or_else(|| { - self.tcx.hir.span_if_local(impl_did) + let note_span = self.tcx.hir().span_if_local(item.def_id).or_else(|| { + self.tcx.hir().span_if_local(impl_did) }); let impl_ty = self.impl_self_ty(span, impl_did).ty; @@ -194,14 +178,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let tcx = self.tcx; let actual = self.resolve_type_vars_if_possible(&rcvr_ty); - let ty_string = self.ty_to_string(actual); + let ty_str = self.ty_to_string(actual); let is_method = mode == Mode::MethodCall; let mut suggestion = None; let item_kind = if is_method { "method" } else if actual.is_enum() { if let Adt(ref adt_def, _) = actual.sty { - let names = adt_def.variants.iter().map(|s| &s.name); + let names = adt_def.variants.iter().map(|s| &s.ident.name); suggestion = find_best_match_for_name(names, &item_name.as_str(), None); @@ -228,10 +212,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .filter_map(|info| self.associated_item(info.def_id, item_name, Namespace::Value) ); - if let (true, false, Some(expr), Some(_)) = (actual.is_numeric(), - actual.has_concrete_skeleton(), - rcvr_expr, - candidates.next()) { + if let (true, false, SelfSource::MethodCall(expr), Some(_)) = + (actual.is_numeric(), + actual.has_concrete_skeleton(), + source, + candidates.next()) { let mut err = struct_span_err!( tcx.sess, span, @@ -239,7 +224,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { "can't call {} `{}` on ambiguous numeric type `{}`", item_kind, item_name, - ty_string + ty_str ); let concrete_type = if actual.is_integral() { "i32" @@ -247,31 +232,30 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { "f32" }; match expr.node { - hir::ExprKind::Lit(ref lit) => { // numeric literal + ExprKind::Lit(ref lit) => { + // numeric literal let snippet = tcx.sess.source_map().span_to_snippet(lit.span) .unwrap_or_else(|_| "".to_owned()); - err.span_suggestion_with_applicability( - lit.span, - &format!("you must specify a concrete type for \ - this numeric value, like `{}`", - concrete_type), - format!("{}_{}", - snippet, - concrete_type), - Applicability::MaybeIncorrect, + err.span_suggestion( + lit.span, + &format!("you must specify a concrete type for \ + this numeric value, like `{}`", concrete_type), + format!("{}_{}", snippet, concrete_type), + Applicability::MaybeIncorrect, ); } - hir::ExprKind::Path(ref qpath) => { // local binding - if let &hir::QPath::Resolved(_, ref path) = &qpath { + ExprKind::Path(ref qpath) => { + // local binding + if let &QPath::Resolved(_, ref path) = &qpath { if let hir::def::Def::Local(node_id) = path.def { - let span = tcx.hir.span(node_id); + let span = tcx.hir().span(node_id); let snippet = tcx.sess.source_map().span_to_snippet(span) .unwrap(); let filename = tcx.sess.source_map().span_to_filename(span); - let parent_node = self.tcx.hir.get( - self.tcx.hir.get_parent_node(node_id), + let parent_node = self.tcx.hir().get( + self.tcx.hir().get_parent_node(node_id), ); let msg = format!( "you must specify a type for this binding, like `{}`", @@ -284,7 +268,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty, .. })) => { - err.span_suggestion_with_applicability( + err.span_suggestion( // account for `let x: _ = 42;` // ^^^^ span.to(ty.as_ref().map(|ty| ty.span) @@ -308,15 +292,21 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } else { let mut err = struct_span_err!( tcx.sess, - span, + item_name.span, E0599, "no {} named `{}` found for type `{}` in the current scope", item_kind, item_name, - ty_string + ty_str ); if let Some(suggestion) = suggestion { - err.note(&format!("did you mean `{}::{}`?", ty_string, suggestion)); + // enum variant + err.span_suggestion( + item_name.span, + "did you mean", + suggestion.to_string(), + Applicability::MaybeIncorrect, + ); } err } @@ -325,7 +315,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }; if let Some(def) = actual.ty_adt_def() { - if let Some(full_sp) = tcx.hir.span_if_local(def.did) { + if let Some(full_sp) = tcx.hir().span_if_local(def.did) { let def_sp = tcx.sess.source_map().def_span(full_sp); err.span_label(def_sp, format!("{} `{}` not found {}", item_kind, @@ -339,8 +329,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } // If the method name is the name of a field with a function or closure type, - // give a helping note that it has to be called as (x.f)(...). - if let Some(expr) = rcvr_expr { + // give a helping note that it has to be called as `(x.f)(...)`. + if let SelfSource::MethodCall(expr) = source { for (ty, _) in self.autoderef(span, rcvr_ty) { if let ty::Adt(def, substs) = ty.sty { if !def.is_enum() { @@ -351,12 +341,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let expr_string = match snippet { Ok(expr_string) => expr_string, _ => "s".into(), // Default to a generic placeholder for the - // expression when we can't generate a - // string snippet + // expression when we can't generate a + // string snippet. }; let field_ty = field.ty(tcx, substs); - let scope = self.tcx.hir.get_module_parent(self.body_id); + let scope = self.tcx.hir().get_module_parent(self.body_id); if field.vis.is_accessible_from(scope, self.tcx) { if self.is_fn_ty(&field_ty, span) { err.help(&format!("use `({0}.{1})(...)` if you \ @@ -380,7 +370,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } } else { - err.span_label(span, format!("{} not found in `{}`", item_kind, ty_string)); + err.span_label(span, format!("{} not found in `{}`", item_kind, ty_str)); } if self.is_fn_ty(&rcvr_ty, span) { @@ -391,10 +381,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - if let Some(expr) = rcvr_expr { + if let SelfSource::MethodCall(expr) = source { if let Ok(expr_string) = tcx.sess.source_map().span_to_snippet(expr.span) { report_function!(expr.span, expr_string); - } else if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = + } else if let ExprKind::Path(QPath::Resolved(_, ref path)) = expr.node { if let Some(segment) = path.segments.last() { @@ -410,8 +400,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { err.span_label(span, "this is an associated function, not a method"); } if static_sources.len() == 1 { - if let Some(expr) = rcvr_expr { - err.span_suggestion_with_applicability(expr.span.to(span), + if let SelfSource::MethodCall(expr) = source { + err.span_suggestion(expr.span.to(span), "use associated function syntax instead", format!("{}::{}", self.ty_to_string(actual), @@ -424,15 +414,16 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { report_candidates(&mut err, static_sources); } else if static_sources.len() > 1 { - report_candidates(&mut err, static_sources); } if !unsatisfied_predicates.is_empty() { - let bound_list = unsatisfied_predicates.iter() + let mut bound_list = unsatisfied_predicates.iter() .map(|p| format!("`{} : {}`", p.self_ty(), p)) - .collect::>() - .join("\n"); + .collect::>(); + bound_list.sort(); + bound_list.dedup(); // #35677 + let bound_list = bound_list.join("\n"); err.note(&format!("the method `{}` exists but the following trait bounds \ were not satisfied:\n{}", item_name, @@ -446,12 +437,17 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { span, rcvr_ty, item_name, - rcvr_expr, + source, out_of_scope_traits); } if let Some(lev_candidate) = lev_candidate { - err.help(&format!("did you mean `{}`?", lev_candidate.ident)); + err.span_suggestion( + span, + "did you mean", + lev_candidate.ident.to_string(), + Applicability::MaybeIncorrect, + ); } err.emit(); } @@ -503,13 +499,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { err: &mut DiagnosticBuilder, mut msg: String, candidates: Vec) { - let module_did = self.tcx.hir.get_module_parent(self.body_id); - let module_id = self.tcx.hir.as_local_node_id(module_did).unwrap(); - let krate = self.tcx.hir.krate(); + let module_did = self.tcx.hir().get_module_parent(self.body_id); + let module_id = self.tcx.hir().as_local_node_id(module_did).unwrap(); + let krate = self.tcx.hir().krate(); let (span, found_use) = UsePlacementFinder::check(self.tcx, krate, module_id); if let Some(span) = span { let path_strings = candidates.iter().map(|did| { - // produce an additional newline to separate the new use statement + // Produce an additional newline to separate the new use statement // from the directly following item. let additional_newline = if found_use { "" @@ -523,12 +519,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ) }); - err.span_suggestions_with_applicability( - span, - &msg, - path_strings, - Applicability::MaybeIncorrect, - ); + err.span_suggestions(span, &msg, path_strings, Applicability::MaybeIncorrect); } else { let limit = if candidates.len() == 5 { 5 } else { 4 }; for (i, trait_did) in candidates.iter().take(limit).enumerate() { @@ -584,28 +575,28 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - fn suggest_traits_to_import(&self, - err: &mut DiagnosticBuilder, - span: Span, - rcvr_ty: Ty<'tcx>, - item_name: ast::Ident, - rcvr_expr: Option<&hir::Expr>, - valid_out_of_scope_traits: Vec) { + fn suggest_traits_to_import<'b>(&self, + err: &mut DiagnosticBuilder, + span: Span, + rcvr_ty: Ty<'tcx>, + item_name: ast::Ident, + source: SelfSource<'b>, + valid_out_of_scope_traits: Vec) { if self.suggest_valid_traits(err, valid_out_of_scope_traits) { return; } - let type_is_local = self.type_derefs_to_local(span, rcvr_ty, rcvr_expr); + let type_is_local = self.type_derefs_to_local(span, rcvr_ty, source); - // there's no implemented traits, so lets suggest some traits to + // There are no traits implemented, so lets suggest some traits to // implement, by finding ones that have the item name, and are // legal to implement. let mut candidates = all_traits(self.tcx) .into_iter() .filter(|info| { - // we approximate the coherence rules to only suggest + // We approximate the coherence rules to only suggest // traits that are legal to implement by requiring that - // either the type or trait is local. Multidispatch means + // either the type or trait is local. Multi-dispatch means // this isn't perfect (that is, there are cases when // implementing a trait would be legal but is rejected // here). @@ -620,11 +611,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .collect::>(); if !candidates.is_empty() { - // sort from most relevant to least relevant + // Sort from most relevant to least relevant. candidates.sort_by(|a, b| a.cmp(b).reverse()); candidates.dedup(); - // FIXME #21673 this help message could be tuned to the case + // FIXME #21673: this help message could be tuned to the case // of a type parameter: suggest adding a trait bound rather // than implementing. err.help("items from traits can only be used if the trait is implemented and in scope"); @@ -656,19 +647,19 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn type_derefs_to_local(&self, span: Span, rcvr_ty: Ty<'tcx>, - rcvr_expr: Option<&hir::Expr>) - -> bool { + source: SelfSource) -> bool { fn is_local(ty: Ty) -> bool { match ty.sty { ty::Adt(def, _) => def.did.is_local(), ty::Foreign(did) => did.is_local(), - ty::Dynamic(ref tr, ..) => tr.principal().def_id().is_local(), + ty::Dynamic(ref tr, ..) => + tr.principal().map(|d| d.def_id().is_local()).unwrap_or(false), ty::Param(_) => true, - // everything else (primitive types etc.) is effectively - // non-local (there are "edge" cases, e.g. (LocalType,), but + // Everything else (primitive types, etc.) is effectively + // non-local (there are "edge" cases, e.g., `(LocalType,)`, but // the noise from these sort of types is usually just really // annoying, rather than any sort of help). _ => false, @@ -677,7 +668,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // This occurs for UFCS desugaring of `T::method`, where there is no // receiver expression for the method call, and thus no autoderef. - if rcvr_expr.is_none() { + if let SelfSource::QPath(_) = source { return is_local(self.resolve_type_vars_with_obligations(rcvr_ty)); } @@ -685,6 +676,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } +#[derive(Copy, Clone)] +pub enum SelfSource<'a> { + QPath(&'a hir::Ty), + MethodCall(&'a hir::Expr /* rcvr */), +} + #[derive(Copy, Clone)] pub struct TraitInfo { pub def_id: DefId, @@ -703,8 +700,8 @@ impl PartialOrd for TraitInfo { } impl Ord for TraitInfo { fn cmp(&self, other: &TraitInfo) -> Ordering { - // local crates are more important than remote ones (local: - // cnum == 0), and otherwise we throw in the defid for totality + // Local crates are more important than remote ones (local: + // `cnum == 0`), and otherwise we throw in the defid for totality. let lhs = (other.def_id.krate, other.def_id); let rhs = (self.def_id.krate, self.def_id); @@ -719,65 +716,65 @@ pub fn all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec /// Compute all traits in this crate and any dependent crates. fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec { - use rustc::hir::itemlikevisit; + use hir::itemlikevisit; - let mut traits = vec![]; + let mut traits = vec![]; - // Crate-local: - // - // meh. - struct Visitor<'a, 'tcx: 'a> { - map: &'a hir_map::Map<'tcx>, - traits: &'a mut Vec, - } - impl<'v, 'a, 'tcx> itemlikevisit::ItemLikeVisitor<'v> for Visitor<'a, 'tcx> { - fn visit_item(&mut self, i: &'v hir::Item) { - if let hir::ItemKind::Trait(..) = i.node { - let def_id = self.map.local_def_id(i.id); - self.traits.push(def_id); - } - } + // Crate-local: - fn visit_trait_item(&mut self, _trait_item: &hir::TraitItem) { - } + struct Visitor<'a, 'tcx: 'a> { + map: &'a hir_map::Map<'tcx>, + traits: &'a mut Vec, + } - fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) { + impl<'v, 'a, 'tcx> itemlikevisit::ItemLikeVisitor<'v> for Visitor<'a, 'tcx> { + fn visit_item(&mut self, i: &'v hir::Item) { + if let hir::ItemKind::Trait(..) = i.node { + let def_id = self.map.local_def_id(i.id); + self.traits.push(def_id); } } - tcx.hir.krate().visit_all_item_likes(&mut Visitor { - map: &tcx.hir, - traits: &mut traits, - }); - - // Cross-crate: - let mut external_mods = FxHashSet::default(); - fn handle_external_def(tcx: TyCtxt, - traits: &mut Vec, - external_mods: &mut FxHashSet, - def: Def) { - let def_id = def.def_id(); - match def { - Def::Trait(..) => { - traits.push(def_id); + + fn visit_trait_item(&mut self, _trait_item: &hir::TraitItem) {} + + fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) {} + } + + tcx.hir().krate().visit_all_item_likes(&mut Visitor { + map: &tcx.hir(), + traits: &mut traits, + }); + + // Cross-crate: + + let mut external_mods = FxHashSet::default(); + fn handle_external_def(tcx: TyCtxt, + traits: &mut Vec, + external_mods: &mut FxHashSet, + def: Def) { + let def_id = def.def_id(); + match def { + Def::Trait(..) => { + traits.push(def_id); + } + Def::Mod(..) => { + if !external_mods.insert(def_id) { + return; } - Def::Mod(..) => { - if !external_mods.insert(def_id) { - return; - } - for child in tcx.item_children(def_id).iter() { - handle_external_def(tcx, traits, external_mods, child.def) - } + for child in tcx.item_children(def_id).iter() { + handle_external_def(tcx, traits, external_mods, child.def) } - _ => {} } + _ => {} } - for &cnum in tcx.crates().iter() { - let def_id = DefId { - krate: cnum, - index: CRATE_DEF_INDEX, - }; - handle_external_def(tcx, &mut traits, &mut external_mods, Def::Mod(def_id)); - } + } + for &cnum in tcx.crates().iter() { + let def_id = DefId { + krate: cnum, + index: CRATE_DEF_INDEX, + }; + handle_external_def(tcx, &mut traits, &mut external_mods, Def::Mod(def_id)); + } traits } @@ -827,29 +824,29 @@ impl<'a, 'tcx, 'gcx> hir::intravisit::Visitor<'tcx> for UsePlacementFinder<'a, ' hir::intravisit::walk_mod(self, module, node_id); return; } - // find a use statement + // Find a `use` statement. for item_id in &module.item_ids { - let item = self.tcx.hir.expect_item(item_id.id); + let item = self.tcx.hir().expect_item(item_id.id); match item.node { hir::ItemKind::Use(..) => { - // don't suggest placing a use before the prelude - // import or other generated ones + // Don't suggest placing a `use` before the prelude + // import or other generated ones. if item.span.ctxt().outer().expn_info().is_none() { self.span = Some(item.span.shrink_to_lo()); self.found_use = true; return; } }, - // don't place use before extern crate + // Don't place `use` before `extern crate`... hir::ItemKind::ExternCrate(_) => {} - // but place them before the first other item + // ...but do place them before the first other item. _ => if self.span.map_or(true, |span| item.span < span ) { if item.span.ctxt().outer().expn_info().is_none() { - // don't insert between attributes and an item + // Don't insert between attributes and an item. if item.attrs.is_empty() { self.span = Some(item.span.shrink_to_lo()); } else { - // find the first attribute on the item + // Find the first attribute on the item. for attr in &item.attrs { if self.span.map_or(true, |span| attr.span < span) { self.span = Some(attr.span.shrink_to_lo()); @@ -861,6 +858,7 @@ impl<'a, 'tcx, 'gcx> hir::intravisit::Visitor<'tcx> for UsePlacementFinder<'a, ' } } } + fn nested_visit_map<'this>( &'this mut self ) -> hir::intravisit::NestedVisitorMap<'this, 'tcx> { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index aabef5c3234..c94713980d8 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1,21 +1,10 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -/* +/*! # check.rs Within the check phase of type check, we check each item one at a time (bodies of function expressions are checked as part of the containing -function). Inference is used to supply types wherever they are -unknown. +function). Inference is used to supply types wherever they are unknown. By far the most complex case is checking the body of a function. This can be broken down into several distinct phases: @@ -65,7 +54,7 @@ nodes within the function. The types of top-level items, which never contain unbound type variables, are stored directly into the `tcx` tables. -N.B.: A type variable is not the same thing as a type parameter. A +N.B., a type variable is not the same thing as a type parameter. A type variable is rather an "instance" of a type parameter: that is, given a generic function `fn foo(t: T)`: while checking the function `foo`, the type `ty_param(0)` refers to the type `T`, which @@ -76,86 +65,88 @@ type parameter). */ -pub use self::Expectation::*; -use self::autoderef::Autoderef; -use self::callee::DeferredCallResolution; -use self::coercion::{CoerceMany, DynamicCoerceMany}; -pub use self::compare_method::{compare_impl_method, compare_const_impl}; -use self::method::MethodCallee; -use self::TupleArgumentsFlag::*; +mod autoderef; +pub mod dropck; +pub mod _match; +pub mod writeback; +mod regionck; +pub mod coercion; +pub mod demand; +pub mod method; +mod upvar; +mod wfcheck; +mod cast; +mod closure; +mod callee; +mod compare_method; +mod generator_interior; +pub mod intrinsic; +mod op; -use astconv::AstConv; -use hir::GenericArg; -use hir::def::Def; -use hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; -use std::slice; +use astconv::{AstConv, PathSeg}; +use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; +use rustc::hir::{self, ExprKind, GenericArg, ItemKind, Node, PatKind, QPath}; +use rustc::hir::def::{CtorKind, Def}; +use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; +use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; +use rustc::hir::itemlikevisit::ItemLikeVisitor; +use middle::lang_items; use namespace::Namespace; -use rustc::infer::{self, InferCtxt, InferOk, RegionVariableOrigin}; +use rustc::infer::{self, InferCtxt, InferOk, InferResult, RegionVariableOrigin}; +use rustc::infer::canonical::{Canonical, OriginalQueryValues, QueryResponse}; +use rustc_data_structures::indexed_vec::Idx; +use rustc_data_structures::sync::Lrc; +use rustc_target::spec::abi::Abi; use rustc::infer::opaque_types::OpaqueTypeDecl; use rustc::infer::type_variable::{TypeVariableOrigin}; use rustc::middle::region; use rustc::mir::interpret::{ConstValue, GlobalId}; -use rustc::ty::subst::{CanonicalUserSubsts, UnpackedKind, Subst, Substs, - UserSelfTy, UserSubsts}; use rustc::traits::{self, ObligationCause, ObligationCauseCode, TraitEngine}; -use rustc::ty::{self, Ty, TyCtxt, GenericParamDefKind, Visibility, ToPredicate, RegionKind}; +use rustc::ty::{ + self, AdtKind, CanonicalUserType, Ty, TyCtxt, GenericParamDefKind, Visibility, + ToPolyTraitRef, ToPredicate, RegionKind, UserType +}; use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::fold::TypeFoldable; use rustc::ty::query::Providers; +use rustc::ty::query::queries; +use rustc::ty::subst::{UnpackedKind, Subst, Substs, UserSelfTy, UserSubsts}; use rustc::ty::util::{Representability, IntTypeExt, Discr}; use rustc::ty::layout::VariantIdx; -use rustc_data_structures::indexed_vec::Idx; -use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; - -use require_c_abi_if_variadic; -use session::{CompileIncomplete, config, Session}; -use TypeAndSubsts; -use lint; -use util::common::{ErrorReported, indenter}; -use util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, NodeMap}; +use syntax_pos::{self, BytePos, Span, MultiSpan}; +use syntax::ast; +use syntax::attr; +use syntax::feature_gate::{GateIssue, emit_feature_err}; +use syntax::ptr::P; +use syntax::source_map::{DUMMY_SP, original_sp}; +use syntax::symbol::{Symbol, LocalInternedString, keywords}; +use syntax::util::lev_distance::find_best_match_for_name; use std::cell::{Cell, RefCell, Ref, RefMut}; -use rustc_data_structures::sync::Lrc; use std::collections::hash_map::Entry; use std::cmp; use std::fmt::Display; use std::iter; use std::mem::replace; use std::ops::{self, Deref}; -use rustc_target::spec::abi::Abi; -use syntax::ast; -use syntax::attr; -use syntax::source_map::DUMMY_SP; -use syntax::source_map::original_sp; -use syntax::feature_gate::{GateIssue, emit_feature_err}; -use syntax::ptr::P; -use syntax::symbol::{Symbol, LocalInternedString, keywords}; -use syntax::util::lev_distance::find_best_match_for_name; -use syntax_pos::{self, BytePos, Span, MultiSpan}; +use std::slice; -use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; -use rustc::hir::Node; -use rustc::hir::{self, PatKind, ItemKind}; -use rustc::middle::lang_items; +use require_c_abi_if_variadic; +use session::{CompileIncomplete, Session}; +use session::config::EntryFnType; +use TypeAndSubsts; +use lint; +use util::captures::Captures; +use util::common::{ErrorReported, indenter}; +use util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, NodeMap}; -mod autoderef; -pub mod dropck; -pub mod _match; -pub mod writeback; -mod regionck; -pub mod coercion; -pub mod demand; -pub mod method; -mod upvar; -mod wfcheck; -mod cast; -mod closure; -mod callee; -mod compare_method; -mod generator_interior; -mod intrinsic; -mod op; +pub use self::Expectation::*; +use self::autoderef::Autoderef; +use self::callee::DeferredCallResolution; +use self::coercion::{CoerceMany, DynamicCoerceMany}; +pub use self::compare_method::{compare_impl_method, compare_const_impl}; +use self::method::{MethodCallee, SelfSource}; +use self::TupleArgumentsFlag::*; /// The type of a local binding, including the revealed type for anon types. #[derive(Copy, Clone)] @@ -208,6 +199,10 @@ pub struct Inherited<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { fulfillment_cx: RefCell>>, + // Some additional `Sized` obligations badly affect type inference. + // These obligations are added in a later stage of typeck. + deferred_sized_obligations: RefCell, Span, traits::ObligationCauseCode<'tcx>)>>, + // When we process a call like `c()` where `c` is a closure type, // we may not have decided yet whether `c` is a `Fn`, `FnMut`, or // `FnOnce` closure. In that case, we defer full resolution of the @@ -515,9 +510,6 @@ impl<'gcx, 'tcx> EnclosingBreakables<'gcx, 'tcx> { } } -#[derive(Debug)] -struct PathSeg(DefId, usize); - pub struct FnCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { body_id: ast::NodeId, @@ -536,6 +528,7 @@ pub struct FnCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { err_count_on_creation: usize, ret_coercion: Option>>, + ret_coercion_span: RefCell>, yield_ty: Option>, @@ -601,8 +594,8 @@ impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> { pub fn build(tcx: TyCtxt<'a, 'gcx, 'gcx>, def_id: DefId) -> InheritedBuilder<'a, 'gcx, 'tcx> { let hir_id_root = if def_id.is_local() { - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let hir_id = tcx.hir.definitions().node_to_hir_id(node_id); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = tcx.hir().definitions().node_to_hir_id(node_id); DefId::local(hir_id.owner) } else { def_id @@ -627,10 +620,10 @@ impl<'a, 'gcx, 'tcx> InheritedBuilder<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> { fn new(infcx: InferCtxt<'a, 'gcx, 'tcx>, def_id: DefId) -> Self { let tcx = infcx.tcx; - let item_id = tcx.hir.as_local_node_id(def_id); - let body_id = item_id.and_then(|id| tcx.hir.maybe_body_owned_by(id)); + let item_id = tcx.hir().as_local_node_id(def_id); + let body_id = item_id.and_then(|id| tcx.hir().maybe_body_owned_by(id)); let implicit_region_bound = body_id.map(|body_id| { - let body = tcx.hir.body(body_id); + let body = tcx.hir().body(body_id); tcx.mk_region(ty::ReScope(region::Scope { id: body.value.hir_id.local_id, data: region::ScopeData::CallSite @@ -644,6 +637,7 @@ impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> { infcx, fulfillment_cx: RefCell::new(TraitEngine::new(tcx)), locals: RefCell::new(Default::default()), + deferred_sized_obligations: RefCell::new(Vec::new()), deferred_call_resolutions: RefCell::new(Default::default()), deferred_cast_checks: RefCell::new(Vec::new()), deferred_generator_interiors: RefCell::new(Vec::new()), @@ -702,16 +696,22 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'a, 'tcx> { pub fn check_wf_new<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.track_errors(|| { let mut visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx); - tcx.hir.krate().visit_all_item_likes(&mut visit.as_deep_visitor()); + tcx.hir().krate().visit_all_item_likes(&mut visit.as_deep_visitor()); }) } pub fn check_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.track_errors(|| { - tcx.hir.krate().visit_all_item_likes(&mut CheckItemTypesVisitor { tcx }); + for &module in tcx.hir().krate().modules.keys() { + queries::check_mod_item_types::ensure(tcx, tcx.hir().local_def_id(module)); + } }) } +fn check_mod_item_types<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { + tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx }); +} + pub fn check_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), CompileIncomplete> { tcx.typeck_item_bodies(LOCAL_CRATE) } @@ -750,6 +750,7 @@ pub fn provide(providers: &mut Providers) { check_item_well_formed, check_trait_item_well_formed, check_impl_item_well_formed, + check_mod_item_types, ..*providers }; } @@ -773,7 +774,7 @@ fn primary_body_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: ast::NodeId) -> Option<(hir::BodyId, Option<&'tcx hir::FnDecl>)> { - match tcx.hir.get(id) { + match tcx.hir().get(id) { Node::Item(item) => { match item.node { hir::ItemKind::Const(_, body) | @@ -820,7 +821,7 @@ fn has_typeck_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, return tcx.has_typeck_tables(outer_def_id); } - let id = tcx.hir.as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_node_id(def_id).unwrap(); primary_body_of(tcx, id).is_some() } @@ -840,14 +841,14 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, return tcx.typeck_tables_of(outer_def_id); } - let id = tcx.hir.as_local_node_id(def_id).unwrap(); - let span = tcx.hir.span(id); + let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let span = tcx.hir().span(id); // Figure out what primary body this item has. let (body_id, fn_decl) = primary_body_of(tcx, id).unwrap_or_else(|| { span_bug!(span, "can't type-check body of {:?}", def_id); }); - let body = tcx.hir.body(body_id); + let body = tcx.hir().body(body_id); let tables = Inherited::build(tcx, def_id).enter(|inh| { let param_env = tcx.param_env(def_id); @@ -907,6 +908,11 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fcx.closure_analyze(body); assert!(fcx.deferred_call_resolutions.borrow().is_empty()); fcx.resolve_generator_interiors(def_id); + + for (ty, span, code) in fcx.deferred_sized_obligations.borrow_mut().drain(..) { + let ty = fcx.normalize_ty(span, ty); + fcx.require_type_is_sized(ty, span, code); + } fcx.select_all_obligations_or_error(); if fn_decl.is_some() { @@ -921,7 +927,7 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Consistency check our TypeckTables instance can hold all ItemLocalIds // it will need to hold. assert_eq!(tables.local_id_root, - Some(DefId::local(tcx.hir.definitions().node_to_hir_id(id).owner))); + Some(DefId::local(tcx.hir().definitions().node_to_hir_id(id).owner))); tables } @@ -978,10 +984,12 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for GatherLocalsVisitor<'a, 'gcx, 'tcx> { o_ty }; - let c_ty = self.fcx.inh.infcx.canonicalize_user_type_annotation(&revealed_ty); + let c_ty = self.fcx.inh.infcx.canonicalize_user_type_annotation( + &UserType::Ty(revealed_ty) + ); debug!("visit_local: ty.hir_id={:?} o_ty={:?} revealed_ty={:?} c_ty={:?}", ty.hir_id, o_ty, revealed_ty, c_ty); - self.fcx.tables.borrow_mut().user_provided_tys_mut().insert(ty.hir_id, c_ty); + self.fcx.tables.borrow_mut().user_provided_types_mut().insert(ty.hir_id, c_ty); Some(LocalTy { decl_ty: o_ty, revealed_ty }) }, @@ -1078,15 +1086,19 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, fcx.yield_ty = Some(yield_ty); } - let outer_def_id = fcx.tcx.closure_base_def_id(fcx.tcx.hir.local_def_id(fn_id)); - let outer_node_id = fcx.tcx.hir.as_local_node_id(outer_def_id).unwrap(); + let outer_def_id = fcx.tcx.closure_base_def_id(fcx.tcx.hir().local_def_id(fn_id)); + let outer_node_id = fcx.tcx.hir().as_local_node_id(outer_def_id).unwrap(); GatherLocalsVisitor { fcx: &fcx, parent_id: outer_node_id, }.visit_body(body); // Add formal parameters. for (arg_ty, arg) in fn_sig.inputs().iter().zip(&body.arguments) { // Check the pattern. - fcx.check_pat_walk(&arg.pat, arg_ty, - ty::BindingMode::BindByValue(hir::Mutability::MutImmutable), true); + fcx.check_pat_walk( + &arg.pat, + arg_ty, + ty::BindingMode::BindByValue(hir::Mutability::MutImmutable), + None, + ); // Check that argument is Sized. // The check for a non-trivial pattern is a hack to avoid duplicate warnings @@ -1099,7 +1111,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, fcx.write_ty(arg.hir_id, arg_ty); } - let fn_hir_id = fcx.tcx.hir.node_to_hir_id(fn_id); + let fn_hir_id = fcx.tcx.hir().node_to_hir_id(fn_id); inherited.tables.borrow_mut().liberated_fn_sigs_mut().insert(fn_hir_id, fn_sig); fcx.check_return_expr(&body.value); @@ -1152,26 +1164,25 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, // Check that the main return type implements the termination trait. if let Some(term_id) = fcx.tcx.lang_items().termination() { - if let Some((id, _, entry_type)) = *fcx.tcx.sess.entry_fn.borrow() { - if id == fn_id { - if let config::EntryFnType::Main = entry_type { - let substs = fcx.tcx.mk_substs_trait(declared_ret_ty, &[]); - let trait_ref = ty::TraitRef::new(term_id, substs); - let return_ty_span = decl.output.span(); - let cause = traits::ObligationCause::new( - return_ty_span, fn_id, ObligationCauseCode::MainFunctionType); - - inherited.register_predicate( - traits::Obligation::new( - cause, param_env, trait_ref.to_predicate())); - } + if let Some((def_id, EntryFnType::Main)) = fcx.tcx.entry_fn(LOCAL_CRATE) { + let main_id = fcx.tcx.hir().as_local_node_id(def_id).unwrap(); + if main_id == fn_id { + let substs = fcx.tcx.mk_substs_trait(declared_ret_ty, &[]); + let trait_ref = ty::TraitRef::new(term_id, substs); + let return_ty_span = decl.output.span(); + let cause = traits::ObligationCause::new( + return_ty_span, fn_id, ObligationCauseCode::MainFunctionType); + + inherited.register_predicate( + traits::Obligation::new( + cause, param_env, trait_ref.to_predicate())); } } } // Check that a function marked as `#[panic_handler]` has signature `fn(&PanicInfo) -> !` if let Some(panic_impl_did) = fcx.tcx.lang_items().panic_impl() { - if panic_impl_did == fcx.tcx.hir.local_def_id(fn_id) { + if panic_impl_did == fcx.tcx.hir().local_def_id(fn_id) { if let Some(panic_info_did) = fcx.tcx.lang_items().panic_info() { // at this point we don't care if there are duplicate handlers or if the handler has // the wrong signature as this value we'll be used when writing metadata and that @@ -1186,7 +1197,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, } let inputs = fn_sig.inputs(); - let span = fcx.tcx.hir.span(fn_id); + let span = fcx.tcx.hir().span(fn_id); if inputs.len() == 1 { let arg_is_panic_info = match inputs[0].sty { ty::Ref(region, ty, mutbl) => match ty.sty { @@ -1207,7 +1218,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, ); } - if let Node::Item(item) = fcx.tcx.hir.get(fn_id) { + if let Node::Item(item) = fcx.tcx.hir().get(fn_id) { if let ItemKind::Fn(_, _, ref generics, _) = item.node { if !generics.params.is_empty() { fcx.tcx.sess.span_err( @@ -1229,7 +1240,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, // Check that a function marked as `#[alloc_error_handler]` has signature `fn(Layout) -> !` if let Some(alloc_error_handler_did) = fcx.tcx.lang_items().oom() { - if alloc_error_handler_did == fcx.tcx.hir.local_def_id(fn_id) { + if alloc_error_handler_did == fcx.tcx.hir().local_def_id(fn_id) { if let Some(alloc_layout_did) = fcx.tcx.lang_items().alloc_layout() { if declared_ret_ty.sty != ty::Never { fcx.tcx.sess.span_err( @@ -1239,7 +1250,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, } let inputs = fn_sig.inputs(); - let span = fcx.tcx.hir.span(fn_id); + let span = fcx.tcx.hir().span(fn_id); if inputs.len() == 1 { let arg_is_alloc_layout = match inputs[0].sty { ty::Adt(ref adt, _) => { @@ -1255,7 +1266,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, ); } - if let Node::Item(item) = fcx.tcx.hir.get(fn_id) { + if let Node::Item(item) = fcx.tcx.hir().get(fn_id) { if let ItemKind::Fn(_, _, ref generics, _) = item.node { if !generics.params.is_empty() { fcx.tcx.sess.span_err( @@ -1282,7 +1293,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, fn check_struct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: ast::NodeId, span: Span) { - let def_id = tcx.hir.local_def_id(id); + let def_id = tcx.hir().local_def_id(id); let def = tcx.adt_def(def_id); def.destructor(tcx); // force the destructor to be evaluated check_representable(tcx, span, def_id); @@ -1298,7 +1309,7 @@ fn check_struct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn check_union<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: ast::NodeId, span: Span) { - let def_id = tcx.hir.local_def_id(id); + let def_id = tcx.hir().local_def_id(id); let def = tcx.adt_def(def_id); def.destructor(tcx); // force the destructor to be evaluated check_representable(tcx, span, def_id); @@ -1306,30 +1317,51 @@ fn check_union<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, check_packed(tcx, span, def_id); } +fn check_opaque<'a, 'tcx>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + def_id: DefId, + substs: &'tcx Substs<'tcx>, + span: Span, +) { + if let Err(partially_expanded_type) = tcx.try_expand_impl_trait_type(def_id, substs) { + let mut err = struct_span_err!( + tcx.sess, span, E0720, + "opaque type expands to a recursive type", + ); + err.span_label(span, "expands to self-referential type"); + if let ty::Opaque(..) = partially_expanded_type.sty { + err.note("type resolves to itself"); + } else { + err.note(&format!("expanded type is `{}`", partially_expanded_type)); + } + err.emit(); + } +} + pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Item) { debug!( "check_item_type(it.id={}, it.name={})", it.id, - tcx.item_path_str(tcx.hir.local_def_id(it.id)) + tcx.item_path_str(tcx.hir().local_def_id(it.id)) ); let _indenter = indenter(); match it.node { // Consts can play a role in type-checking, so they are included here. hir::ItemKind::Static(..) => { - let def_id = tcx.hir.local_def_id(it.id); + let def_id = tcx.hir().local_def_id(it.id); tcx.typeck_tables_of(def_id); maybe_check_static_with_link_section(tcx, def_id, it.span); } hir::ItemKind::Const(..) => { - tcx.typeck_tables_of(tcx.hir.local_def_id(it.id)); + tcx.typeck_tables_of(tcx.hir().local_def_id(it.id)); } hir::ItemKind::Enum(ref enum_definition, _) => { check_enum(tcx, it.span, &enum_definition.variants, it.id); } hir::ItemKind::Fn(..) => {} // entirely within check_item_body hir::ItemKind::Impl(.., ref impl_item_refs) => { - debug!("ItemKind::Impl {} with id {}", it.name, it.id); - let impl_def_id = tcx.hir.local_def_id(it.id); + debug!("ItemKind::Impl {} with id {}", it.ident, it.id); + let impl_def_id = tcx.hir().local_def_id(it.id); if let Some(impl_trait_ref) = tcx.impl_trait_ref(impl_def_id) { check_impl_items_against_trait( tcx, @@ -1343,7 +1375,7 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite } } hir::ItemKind::Trait(..) => { - let def_id = tcx.hir.local_def_id(it.id); + let def_id = tcx.hir().local_def_id(it.id); check_on_unimplemented(tcx, def_id, it); } hir::ItemKind::Struct(..) => { @@ -1352,8 +1384,17 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite hir::ItemKind::Union(..) => { check_union(tcx, it.id, it.span); } - hir::ItemKind::Existential(..) | hir::ItemKind::Ty(..) => { - let def_id = tcx.hir.local_def_id(it.id); + hir::ItemKind::Existential(..) => { + let def_id = tcx.hir().local_def_id(it.id); + let pty_ty = tcx.type_of(def_id); + let generics = tcx.generics_of(def_id); + + check_bounds_are_used(tcx, &generics, pty_ty); + let substs = Substs::identity_for_item(tcx, def_id); + check_opaque(tcx, def_id, substs, it.span); + } + hir::ItemKind::Ty(..) => { + let def_id = tcx.hir().local_def_id(it.id); let pty_ty = tcx.type_of(def_id); let generics = tcx.generics_of(def_id); check_bounds_are_used(tcx, &generics, pty_ty); @@ -1371,7 +1412,7 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite } } else { for item in &m.items { - let generics = tcx.generics_of(tcx.hir.local_def_id(item.id)); + let generics = tcx.generics_of(tcx.hir().local_def_id(item.id)); if generics.params.len() - generics.own_counts().lifetimes != 0 { let mut err = struct_span_err!( tcx.sess, @@ -1440,7 +1481,7 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt, id: DefId, span: Span) { fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_def_id: DefId, item: &hir::Item) { - let item_def_id = tcx.hir.local_def_id(item.id); + let item_def_id = tcx.hir().local_def_id(item.id); // an error would be reported if this fails. let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id); } @@ -1513,12 +1554,12 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let trait_def = tcx.trait_def(impl_trait_ref.def_id); let mut overridden_associated_type = None; - let impl_items = || impl_item_refs.iter().map(|iiref| tcx.hir.impl_item(iiref.id)); + let impl_items = || impl_item_refs.iter().map(|iiref| tcx.hir().impl_item(iiref.id)); // Check existing impl methods to see if they are both present in trait // and compatible with trait signature for impl_item in impl_items() { - let ty_impl_item = tcx.associated_item(tcx.hir.local_def_id(impl_item.id)); + let ty_impl_item = tcx.associated_item(tcx.hir().local_def_id(impl_item.id)); let ty_trait_item = tcx.associated_items(impl_trait_ref.def_id) .find(|ac| Namespace::from(&impl_item.node) == Namespace::from(ac.kind) && tcx.hygienic_eq(ty_impl_item.ident, ac.ident, impl_trait_ref.def_id)) @@ -1548,14 +1589,14 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, err.span_label(impl_item.span, "does not match trait"); // We can only get the spans from local trait definition // Same for E0324 and E0325 - if let Some(trait_span) = tcx.hir.span_if_local(ty_trait_item.def_id) { + if let Some(trait_span) = tcx.hir().span_if_local(ty_trait_item.def_id) { err.span_label(trait_span, "item in trait"); } err.emit() } } hir::ImplItemKind::Method(..) => { - let trait_span = tcx.hir.span_if_local(ty_trait_item.def_id); + let trait_span = tcx.hir().span_if_local(ty_trait_item.def_id); if ty_trait_item.kind == ty::AssociatedKind::Method { compare_impl_method(tcx, &ty_impl_item, @@ -1570,7 +1611,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty_impl_item.ident, impl_trait_ref); err.span_label(impl_item.span, "does not match trait"); - if let Some(trait_span) = tcx.hir.span_if_local(ty_trait_item.def_id) { + if let Some(trait_span) = tcx.hir().span_if_local(ty_trait_item.def_id) { err.span_label(trait_span, "item in trait"); } err.emit() @@ -1589,7 +1630,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty_impl_item.ident, impl_trait_ref); err.span_label(impl_item.span, "does not match trait"); - if let Some(trait_span) = tcx.hir.span_if_local(ty_trait_item.def_id) { + if let Some(trait_span) = tcx.hir().span_if_local(ty_trait_item.def_id) { err.span_label(trait_span, "item in trait"); } err.emit() @@ -1632,7 +1673,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, .map(|trait_item| trait_item.ident.to_string()) .collect::>().join("`, `"))); for trait_item in missing_items { - if let Some(span) = tcx.hir.span_if_local(trait_item.def_id) { + if let Some(span) = tcx.hir().span_if_local(trait_item.def_id) { err.span_label(span, format!("`{}` from trait", trait_item.ident)); } else { err.note_trait_signature(trait_item.ident.to_string(), @@ -1777,9 +1818,9 @@ fn check_transparent<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: De let param_env = tcx.param_env(field.did); let layout = tcx.layout_of(param_env.and(ty)); // We are currently checking the type this field came from, so it must be local - let span = tcx.hir.span_if_local(field.did).unwrap(); + let span = tcx.hir().span_if_local(field.did).unwrap(); let zst = layout.map(|layout| layout.is_zst()).unwrap_or(false); - let align1 = layout.map(|layout| layout.align.abi() == 1).unwrap_or(false); + let align1 = layout.map(|layout| layout.align.abi.bytes() == 1).unwrap_or(false); (span, zst, align1) }); @@ -1806,7 +1847,7 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, vs: &'tcx [hir::Variant], id: ast::NodeId) { - let def_id = tcx.hir.local_def_id(id); + let def_id = tcx.hir().local_def_id(id); let def = tcx.adt_def(def_id); def.destructor(tcx); // force the destructor to be evaluated @@ -1834,7 +1875,7 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, for v in vs { if let Some(ref e) = v.node.disr_expr { - tcx.typeck_tables_of(tcx.hir.local_def_id(e.id)); + tcx.typeck_tables_of(tcx.hir().local_def_id(e.id)); } } @@ -1843,14 +1884,14 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Check for duplicate discriminant values if let Some(i) = disr_vals.iter().position(|&x| x.val == discr.val) { let variant_did = def.variants[VariantIdx::new(i)].did; - let variant_i_node_id = tcx.hir.as_local_node_id(variant_did).unwrap(); - let variant_i = tcx.hir.expect_variant(variant_i_node_id); + let variant_i_node_id = tcx.hir().as_local_node_id(variant_did).unwrap(); + let variant_i = tcx.hir().expect_variant(variant_i_node_id); let i_span = match variant_i.node.disr_expr { - Some(ref expr) => tcx.hir.span(expr.id), - None => tcx.hir.span(variant_i_node_id) + Some(ref expr) => tcx.hir().span(expr.id), + None => tcx.hir().span(variant_i_node_id) }; let span = match v.node.disr_expr { - Some(ref expr) => tcx.hir.span(expr.id), + Some(ref expr) => tcx.hir().span(expr.id), None => v.span }; struct_span_err!(tcx.sess, span, E0081, @@ -1865,6 +1906,16 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, check_representable(tcx, sp, def_id); } +fn report_unexpected_variant_def<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, + def: &Def, + span: Span, + qpath: &QPath) { + span_err!(tcx.sess, span, E0533, + "expected unit struct/variant or constant, found {} `{}`", + def.kind_name(), + hir::print::to_string(tcx.hir(), |s| s.print_qpath(qpath, false))); +} + impl<'a, 'gcx, 'tcx> AstConv<'gcx, 'tcx> for FnCtxt<'a, 'gcx, 'tcx> { fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx } @@ -1872,9 +1923,9 @@ impl<'a, 'gcx, 'tcx> AstConv<'gcx, 'tcx> for FnCtxt<'a, 'gcx, 'tcx> { -> Lrc> { let tcx = self.tcx; - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let item_id = tcx.hir.ty_param_owner(node_id); - let item_def_id = tcx.hir.local_def_id(item_id); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let item_id = tcx.hir().ty_param_owner(node_id); + let item_def_id = tcx.hir().local_def_id(item_id); let generics = tcx.generics_of(item_def_id); let index = generics.param_def_id_to_index[&def_id]; Lrc::new(ty::GenericPredicates { @@ -1979,6 +2030,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { param_env, err_count_on_creation: inh.tcx.sess.err_count(), ret_coercion: None, + ret_coercion_span: RefCell::new(None), yield_ty: None, ps: RefCell::new(UnsafetyState::function(hir::Unsafety::Normal, ast::CRATE_NODE_ID)), @@ -2080,7 +2132,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> LocalTy<'tcx> { self.locals.borrow().get(&nid).cloned().unwrap_or_else(|| span_bug!(span, "no type for local variable {}", - self.tcx.hir.node_to_string(nid)) + self.tcx.hir().node_to_string(nid)) ) } @@ -2097,12 +2149,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } pub fn write_field_index(&self, node_id: ast::NodeId, index: usize) { - let hir_id = self.tcx.hir.node_to_hir_id(node_id); + let hir_id = self.tcx.hir().node_to_hir_id(node_id); self.tables.borrow_mut().field_indices_mut().insert(hir_id, index); } - // The NodeId and the ItemLocalId must identify the same item. We just pass - // both of them for consistency checking. pub fn write_method_call(&self, hir_id: hir::HirId, method: MethodCallee<'tcx>) { @@ -2131,23 +2181,27 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if !method.substs.is_noop() { let method_generics = self.tcx.generics_of(method.def_id); if !method_generics.params.is_empty() { - let user_substs = self.infcx.probe(|_| { - let just_method_substs = Substs::for_item(self.tcx, method.def_id, |param, _| { - let i = param.index as usize; - if i < method_generics.parent_count { - self.infcx.var_for_def(DUMMY_SP, param) - } else { - method.substs[i] - } - }); - self.infcx.canonicalize_user_type_annotation(&UserSubsts { - substs: just_method_substs, + let user_type_annotation = self.infcx.probe(|_| { + let user_substs = UserSubsts { + substs: Substs::for_item(self.tcx, method.def_id, |param, _| { + let i = param.index as usize; + if i < method_generics.parent_count { + self.infcx.var_for_def(DUMMY_SP, param) + } else { + method.substs[i] + } + }), user_self_ty: None, // not relevant here - }) + }; + + self.infcx.canonicalize_user_type_annotation(&UserType::TypeOf( + method.def_id, + user_substs, + )) }); - debug!("write_method_call: user_substs = {:?}", user_substs); - self.write_user_substs(hir_id, user_substs); + debug!("write_method_call: user_type_annotation={:?}", user_type_annotation); + self.write_user_type_annotation(hir_id, user_type_annotation); } } } @@ -2170,41 +2224,47 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// This should be invoked **before any unifications have /// occurred**, so that annotations like `Vec<_>` are preserved /// properly. - pub fn write_user_substs_from_substs( + pub fn write_user_type_annotation_from_substs( &self, hir_id: hir::HirId, + def_id: DefId, substs: &'tcx Substs<'tcx>, user_self_ty: Option>, ) { debug!( - "write_user_substs_from_substs({:?}, {:?}) in fcx {}", - hir_id, - substs, - self.tag(), + "write_user_type_annotation_from_substs: hir_id={:?} def_id={:?} substs={:?} \ + user_self_ty={:?} in fcx {}", + hir_id, def_id, substs, user_self_ty, self.tag(), ); if !substs.is_noop() { - let user_substs = self.infcx.canonicalize_user_type_annotation(&UserSubsts { - substs, - user_self_ty, - }); - debug!("instantiate_value_path: user_substs = {:?}", user_substs); - self.write_user_substs(hir_id, user_substs); + let canonicalized = self.infcx.canonicalize_user_type_annotation( + &UserType::TypeOf(def_id, UserSubsts { + substs, + user_self_ty, + }) + ); + debug!("write_user_type_annotation_from_substs: canonicalized={:?}", canonicalized); + self.write_user_type_annotation(hir_id, canonicalized); } } - pub fn write_user_substs(&self, hir_id: hir::HirId, substs: CanonicalUserSubsts<'tcx>) { + pub fn write_user_type_annotation( + &self, + hir_id: hir::HirId, + canonical_user_type_annotation: CanonicalUserType<'tcx>, + ) { debug!( - "write_user_substs({:?}, {:?}) in fcx {}", - hir_id, - substs, - self.tag(), + "write_user_type_annotation: hir_id={:?} canonical_user_type_annotation={:?} tag={}", + hir_id, canonical_user_type_annotation, self.tag(), ); - if !substs.is_identity() { - self.tables.borrow_mut().user_substs_mut().insert(hir_id, substs); + if !canonical_user_type_annotation.is_identity() { + self.tables.borrow_mut().user_provided_types_mut().insert( + hir_id, canonical_user_type_annotation + ); } else { - debug!("write_user_substs: skipping identity substs"); + debug!("write_user_type_annotation: skipping identity substs"); } } @@ -2285,7 +2345,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { parent_id: ast::NodeId, value: &T, ) -> T { - let parent_def_id = self.tcx.hir.local_def_id(parent_id); + let parent_def_id = self.tcx.hir().local_def_id(parent_id); debug!("instantiate_opaque_types_from_value(parent_def_id={:?}, value={:?})", parent_def_id, value); @@ -2345,6 +2405,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.require_type_meets(ty, span, code, lang_item); } + pub fn require_type_is_sized_deferred(&self, + ty: Ty<'tcx>, + span: Span, + code: traits::ObligationCauseCode<'tcx>) + { + self.deferred_sized_obligations.borrow_mut().push((ty, span, code)); + } + pub fn register_bound(&self, ty: Ty<'tcx>, def_id: DefId, @@ -2362,17 +2430,20 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn to_ty_saving_user_provided_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> { let ty = self.to_ty(ast_ty); + debug!("to_ty_saving_user_provided_ty: ty={:?}", ty); // If the type given by the user has free regions, save it for // later, since NLL would like to enforce those. Also pass in // types that involve projections, since those can resolve to // `'static` bounds (modulo #54940, which hopefully will be // fixed by the time you see this comment, dear reader, - // although I have my doubts). Other sorts of things are - // already sufficiently enforced with erased regions. =) - if ty.has_free_regions() || ty.has_projections() { - let c_ty = self.infcx.canonicalize_response(&ty); - self.tables.borrow_mut().user_provided_tys_mut().insert(ast_ty.hir_id, c_ty); + // although I have my doubts). Also pass in types with inference + // types, because they may be repeated. Other sorts of things + // are already sufficiently enforced with erased regions. =) + if ty.has_free_regions() || ty.has_projections() || ty.has_infer_types() { + let c_ty = self.infcx.canonicalize_response(&UserType::Ty(ty)); + debug!("to_ty_saving_user_provided_ty: c_ty={:?}", c_ty); + self.tables.borrow_mut().user_provided_types_mut().insert(ast_ty.hir_id, c_ty); } ty @@ -2383,9 +2454,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Some(&t) => t, None if self.is_tainted_by_errors() => self.tcx.types.err, None => { - let node_id = self.tcx.hir.hir_to_node_id(id); + let node_id = self.tcx.hir().hir_to_node_id(id); bug!("no type for node {}: {} in fcx {}", - node_id, self.tcx.hir.node_to_string(node_id), + node_id, self.tcx.hir().node_to_string(node_id), self.tag()); } } @@ -2541,7 +2612,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { while result.is_none() && autoderef.next().is_some() { result = self.try_index_step(expr, base_expr, &autoderef, needs, idx_ty); } - autoderef.finalize(); + autoderef.finalize(self); result } @@ -2558,7 +2629,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { index_ty: Ty<'tcx>) -> Option<(/*index type*/ Ty<'tcx>, /*element type*/ Ty<'tcx>)> { - let adjusted_ty = autoderef.unambiguous_final_ty(); + let adjusted_ty = autoderef.unambiguous_final_ty(self); debug!("try_index_step(expr={:?}, base_expr={:?}, adjusted_ty={:?}, \ index_ty={:?})", expr, @@ -2588,7 +2659,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { debug!("try_index_step: success, using overloaded indexing"); let method = self.register_infer_ok_obligations(ok); - let mut adjustments = autoderef.adjust_steps(needs); + let mut adjustments = autoderef.adjust_steps(self, needs); if let ty::Ref(region, _, r_mutbl) = method.sig.inputs()[0].sty { let mutbl = match r_mutbl { hir::MutImmutable => AutoBorrowMutability::Immutable, @@ -2713,10 +2784,76 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); self.check_argument_types(sp, expr_sp, &method.sig.inputs()[1..], &expected_arg_tys[..], args_no_rcvr, method.sig.variadic, tuple_arguments, - self.tcx.hir.span_if_local(method.def_id)); + self.tcx.hir().span_if_local(method.def_id)); method.sig.output() } + fn self_type_matches_expected_vid( + &self, + trait_ref: ty::PolyTraitRef<'tcx>, + expected_vid: ty::TyVid, + ) -> bool { + let self_ty = self.shallow_resolve(trait_ref.self_ty()); + debug!( + "self_type_matches_expected_vid(trait_ref={:?}, self_ty={:?}, expected_vid={:?})", + trait_ref, self_ty, expected_vid + ); + match self_ty.sty { + ty::Infer(ty::TyVar(found_vid)) => { + // FIXME: consider using `sub_root_var` here so we + // can see through subtyping. + let found_vid = self.root_var(found_vid); + debug!("self_type_matches_expected_vid - found_vid={:?}", found_vid); + expected_vid == found_vid + } + _ => false + } + } + + fn obligations_for_self_ty<'b>(&'b self, self_ty: ty::TyVid) + -> impl Iterator, traits::PredicateObligation<'tcx>)> + + Captures<'gcx> + 'b + { + // FIXME: consider using `sub_root_var` here so we + // can see through subtyping. + let ty_var_root = self.root_var(self_ty); + debug!("obligations_for_self_ty: self_ty={:?} ty_var_root={:?} pending_obligations={:?}", + self_ty, ty_var_root, + self.fulfillment_cx.borrow().pending_obligations()); + + self.fulfillment_cx + .borrow() + .pending_obligations() + .into_iter() + .filter_map(move |obligation| match obligation.predicate { + ty::Predicate::Projection(ref data) => + Some((data.to_poly_trait_ref(self.tcx), obligation)), + ty::Predicate::Trait(ref data) => + Some((data.to_poly_trait_ref(), obligation)), + ty::Predicate::Subtype(..) => None, + ty::Predicate::RegionOutlives(..) => None, + ty::Predicate::TypeOutlives(..) => None, + ty::Predicate::WellFormed(..) => None, + ty::Predicate::ObjectSafe(..) => None, + ty::Predicate::ConstEvaluatable(..) => None, + // N.B., this predicate is created by breaking down a + // `ClosureType: FnFoo()` predicate, where + // `ClosureType` represents some `Closure`. It can't + // possibly be referring to the current closure, + // because we haven't produced the `Closure` for + // this closure yet; this is exactly why the other + // code is looking for a self type of a unresolved + // inference variable. + ty::Predicate::ClosureKind(..) => None, + }).filter(move |(tr, _)| self.self_type_matches_expected_vid(*tr, ty_var_root)) + } + + fn type_var_is_sized(&self, self_ty: ty::TyVid) -> bool { + self.obligations_for_self_ty(self_ty).any(|(tr, _)| { + Some(tr.def_id()) == self.tcx.lang_items().sized_trait() + }) + } + /// Generic function that factors out common logic from function calls, /// method calls and overloaded operators. fn check_argument_types(&self, @@ -2766,7 +2903,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let sugg_span = tcx.sess.source_map().end_point(expr_sp); // remove closing `)` from the span let sugg_span = sugg_span.shrink_to_lo(); - err.span_suggestion_with_applicability( + err.span_suggestion( sugg_span, "expected the unit value `()`; create it with empty parentheses", String::from("()"), @@ -2840,10 +2977,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { formal_tys.iter().map(|t| self.ty_to_string(*t)).collect::>()); // Check the arguments. - // We do this in a pretty awful way: first we typecheck any arguments - // that are not closures, then we typecheck the closures. This is so + // We do this in a pretty awful way: first we type-check any arguments + // that are not closures, then we type-check the closures. This is so // that we have more information about the types of arguments when we - // typecheck the functions. This isn't really the right way to do this. + // type-check the functions. This isn't really the right way to do this. for &check_closures in &[false, true] { debug!("check_closures={}", check_closures); @@ -2867,13 +3004,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { for (i, arg) in args.iter().take(t).enumerate() { // Warn only for the first loop (the "no closures" one). // Closure arguments themselves can't be diverging, but - // a previous argument can, e.g. `foo(panic!(), || {})`. + // a previous argument can, e.g., `foo(panic!(), || {})`. if !check_closures { self.warn_if_unreachable(arg.id, arg.span, "expression"); } let is_closure = match arg.node { - hir::ExprKind::Closure(..) => true, + ExprKind::Closure(..) => true, _ => false }; @@ -2985,7 +3122,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { opt_ty.unwrap_or_else( || tcx.mk_float_var(self.next_float_var_id())) } - ast::LitKind::Bool(_) => tcx.types.bool + ast::LitKind::Bool(_) => tcx.types.bool, + ast::LitKind::Err(_) => tcx.types.err, } } @@ -3023,8 +3161,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } if let Some(mut err) = self.demand_suptype_diag(expr.span, expected_ty, ty) { - // Add help to type error if this is an `if` condition with an assignment - if let (ExpectIfCondition, &hir::ExprKind::Assign(ref lhs, ref rhs)) + // Add help to type error if this is an `if` condition with an assignment. + if let (ExpectIfCondition, &ExprKind::Assign(ref lhs, ref rhs)) = (expected, &expr.node) { let msg = "try comparing for equality"; @@ -3032,7 +3170,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.tcx.sess.source_map().span_to_snippet(lhs.span), self.tcx.sess.source_map().span_to_snippet(rhs.span)) { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, msg, format!("{} == {}", left, right), @@ -3074,9 +3212,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.check_expr_with_expectation_and_needs(expr, NoExpectation, needs) } - // determine the `self` type, using fresh variables for all variables + // Determine the `Self` type, using fresh variables for all variables // declared on the impl declaration e.g., `impl for Vec<(A,B)>` - // would return ($0, $1) where $0 and $1 are freshly instantiated type + // would return `($0, $1)` where `$0` and `$1` are freshly instantiated type // variables. pub fn impl_self_ty(&self, span: Span, // (potential) receiver for this impl @@ -3170,7 +3308,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.report_method_error(span, rcvr_t, segment.ident, - Some(rcvr), + SelfSource::MethodCall(rcvr), error, Some(args)); } @@ -3204,8 +3342,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { return_expr_ty); } - // A generic function for checking the then and else in an if - // or if-else. + // A generic function for checking the 'then' and 'else' clauses in an 'if' + // or 'if-else' expression. fn check_then_else(&self, cond_expr: &'gcx hir::Expr, then_expr: &'gcx hir::Expr, @@ -3230,13 +3368,103 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let coerce_to_ty = expected.coercion_target_type(self, sp); let mut coerce: DynamicCoerceMany = CoerceMany::new(coerce_to_ty); - let if_cause = self.cause(sp, ObligationCauseCode::IfExpression); - coerce.coerce(self, &if_cause, then_expr, then_ty); + coerce.coerce(self, &self.misc(sp), then_expr, then_ty); if let Some(else_expr) = opt_else_expr { let else_ty = self.check_expr_with_expectation(else_expr, expected); let else_diverges = self.diverges.get(); + let mut outer_sp = if self.tcx.sess.source_map().is_multiline(sp) { + // The `if`/`else` isn't in one line in the output, include some context to make it + // clear it is an if/else expression: + // ``` + // LL | let x = if true { + // | _____________- + // LL || 10i32 + // || ----- expected because of this + // LL || } else { + // LL || 10u32 + // || ^^^^^ expected i32, found u32 + // LL || }; + // ||_____- if and else have incompatible types + // ``` + Some(sp) + } else { + // The entire expression is in one line, only point at the arms + // ``` + // LL | let x = if true { 10i32 } else { 10u32 }; + // | ----- ^^^^^ expected i32, found u32 + // | | + // | expected because of this + // ``` + None + }; + let mut remove_semicolon = None; + let error_sp = if let ExprKind::Block(block, _) = &else_expr.node { + if let Some(expr) = &block.expr { + expr.span + } else if let Some(stmt) = block.stmts.last() { + // possibly incorrect trailing `;` in the else arm + remove_semicolon = self.could_remove_semicolon(block, then_ty); + stmt.span + } else { // empty block, point at its entirety + // Avoid overlapping spans that aren't as readable: + // ``` + // 2 | let x = if true { + // | _____________- + // 3 | | 3 + // | | - expected because of this + // 4 | | } else { + // | |____________^ + // 5 | || + // 6 | || }; + // | || ^ + // | ||_____| + // | |______if and else have incompatible types + // | expected integer, found () + // ``` + // by not pointing at the entire expression: + // ``` + // 2 | let x = if true { + // | ------- if and else have incompatible types + // 3 | 3 + // | - expected because of this + // 4 | } else { + // | ____________^ + // 5 | | + // 6 | | }; + // | |_____^ expected integer, found () + // ``` + if outer_sp.is_some() { + outer_sp = Some(self.tcx.sess.source_map().def_span(sp)); + } + else_expr.span + } + } else { // shouldn't happen unless the parser has done something weird + else_expr.span + }; + let then_sp = if let ExprKind::Block(block, _) = &then_expr.node { + if let Some(expr) = &block.expr { + expr.span + } else if let Some(stmt) = block.stmts.last() { + // possibly incorrect trailing `;` in the else arm + remove_semicolon = remove_semicolon.or( + self.could_remove_semicolon(block, else_ty)); + stmt.span + } else { // empty block, point at its entirety + outer_sp = None; // same as in `error_sp`, cleanup output + then_expr.span + } + } else { // shouldn't happen unless the parser has done something weird + then_expr.span + }; + + let if_cause = self.cause(error_sp, ObligationCauseCode::IfExpression { + then: then_sp, + outer: outer_sp, + semicolon: remove_semicolon, + }); + coerce.coerce(self, &if_cause, else_expr, else_ty); // We won't diverge unless both branches do (or the condition does). @@ -3282,9 +3510,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // of error recovery. self.write_field_index(expr.id, index); if field.vis.is_accessible_from(def_scope, self.tcx) { - let adjustments = autoderef.adjust_steps(needs); + let adjustments = autoderef.adjust_steps(self, needs); self.apply_adjustments(base, adjustments); - autoderef.finalize(); + autoderef.finalize(self); self.tcx.check_stability(field.did, Some(expr.id), expr.span); return field_ty; @@ -3297,9 +3525,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Ok(index) = fstr.parse::() { if fstr == index.to_string() { if let Some(field_ty) = tys.get(index) { - let adjustments = autoderef.adjust_steps(needs); + let adjustments = autoderef.adjust_steps(self, needs); self.apply_adjustments(base, adjustments); - autoderef.finalize(); + autoderef.finalize(self); self.write_field_index(expr.id, index); return field_ty; @@ -3310,7 +3538,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { _ => {} } } - autoderef.unambiguous_final_ty(); + autoderef.unambiguous_final_ty(self); if let Some((did, field_ty)) = private_candidate { let struct_path = self.tcx().item_path_str(did); @@ -3318,19 +3546,37 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { "field `{}` of struct `{}` is private", field, struct_path); // Also check if an accessible method exists, which is often what is meant. - if self.method_exists(field, expr_t, expr.id, false) { - err.note(&format!("a method `{}` also exists, perhaps you wish to call it", field)); + if self.method_exists(field, expr_t, expr.id, false) && !self.expr_in_place(expr.id) { + self.suggest_method_call( + &mut err, + &format!("a method `{}` also exists, call it with parentheses", field), + field, + expr_t, + expr.id, + ); } err.emit(); field_ty } else if field.name == keywords::Invalid.name() { self.tcx().types.err } else if self.method_exists(field, expr_t, expr.id, true) { - type_error_struct!(self.tcx().sess, field.span, expr_t, E0615, + let mut err = type_error_struct!(self.tcx().sess, field.span, expr_t, E0615, "attempted to take value of method `{}` on type `{}`", - field, expr_t) - .help("maybe a `()` to call it is missing?") - .emit(); + field, expr_t); + + if !self.expr_in_place(expr.id) { + self.suggest_method_call( + &mut err, + "use parentheses to call the method", + field, + expr_t, + expr.id + ); + } else { + err.help("methods are immutable and cannot be assigned to"); + } + + err.emit(); self.tcx().types.err } else { if !expr_t.is_primitive_ty() { @@ -3341,8 +3587,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some(suggested_field_name) = Self::suggest_field_name(def.non_enum_variant(), &field.as_str(), vec![]) { - err.span_label(field.span, - format!("did you mean `{}`?", suggested_field_name)); + err.span_suggestion( + field.span, + "a field with a similar name exists", + suggested_field_name.to_string(), + Applicability::MaybeIncorrect, + ); } else { err.span_label(field.span, "unknown field"); let struct_variant_def = def.non_enum_variant(); @@ -3358,7 +3608,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { len.assert_usize(self.tcx), field.as_str().parse::() ) { - let base = self.tcx.hir.node_to_pretty_string(base.id); + let base = self.tcx.sess.source_map() + .span_to_snippet(base.span) + .unwrap_or_else(|_| self.tcx.hir().node_to_pretty_string(base.id)); let help = "instead of using tuple indexing, use array indexing"; let suggestion = format!("{}[{}]", base, field); let applicability = if len < user_index { @@ -3366,17 +3618,19 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } else { Applicability::MaybeIncorrect }; - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, help, suggestion, applicability ); } } ty::RawPtr(..) => { - let base = self.tcx.hir.node_to_pretty_string(base.id); - let msg = format!("`{}` is a native pointer; try dereferencing it", base); + let base = self.tcx.sess.source_map() + .span_to_snippet(base.span) + .unwrap_or_else(|_| self.tcx.hir().node_to_pretty_string(base.id)); + let msg = format!("`{}` is a raw pointer; try dereferencing it", base); let suggestion = format!("(*{}).{}", base, field); - err.span_suggestion_with_applicability( - field.span, + err.span_suggestion( + expr.span, &msg, suggestion, Applicability::MaybeIncorrect, @@ -3451,7 +3705,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty::Adt(adt, ..) if adt.is_enum() => { struct_span_err!(self.tcx.sess, field.ident.span, E0559, "{} `{}::{}` has no field named `{}`", - kind_name, actual, variant.name, field.ident) + kind_name, actual, variant.ident, field.ident) } _ => { struct_span_err!(self.tcx.sess, field.ident.span, E0560, @@ -3465,15 +3719,19 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some(field_name) = Self::suggest_field_name(variant, &field.ident.as_str(), skip_fields.collect()) { - err.span_label(field.ident.span, - format!("field does not exist - did you mean `{}`?", field_name)); + err.span_suggestion( + field.ident.span, + "a field with a similar name exists", + field_name.to_string(), + Applicability::MaybeIncorrect, + ); } else { match ty.sty { ty::Adt(adt, ..) => { if adt.is_enum() { err.span_label(field.ident.span, format!("`{}::{}` does not have this field", - ty, variant.name)); + ty, variant.ident)); } else { err.span_label(field.ident.span, format!("`{}` does not have this field", ty)); @@ -3521,17 +3779,17 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let mut error_happened = false; - // Typecheck each field. + // Type-check each field. for field in ast_fields { let ident = tcx.adjust_ident(field.ident, variant.did, self.body_id).0; let field_type = if let Some((i, v_field)) = remaining_fields.remove(&ident) { seen_fields.insert(ident, field.span); self.write_field_index(field.id, i); - // we don't look at stability attributes on + // We don't look at stability attributes on // struct-like enums (yet...), but it's definitely not - // a bug to have construct one. - if adt_kind != ty::AdtKind::Enum { + // a bug to have constructed one. + if adt_kind != AdtKind::Enum { tcx.check_stability(v_field.did, Some(expr_id), field.span); } @@ -3557,7 +3815,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }; // Make sure to give a type to the field even if there's - // an error, so we can continue typechecking + // an error, so we can continue type-checking. self.check_expr_coercable_to_type(&field.expr, field_type); } @@ -3613,12 +3871,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } pub fn check_struct_path(&self, - qpath: &hir::QPath, + qpath: &QPath, node_id: ast::NodeId) -> Option<(&'tcx ty::VariantDef, Ty<'tcx>)> { let path_span = match *qpath { - hir::QPath::Resolved(_, ref path) => path.span, - hir::QPath::TypeRelative(ref qself, _) => qself.span + QPath::Resolved(_, ref path) => path.span, + QPath::TypeRelative(ref qself, _) => qself.span }; let (def, ty) = self.finish_resolving_struct_path(qpath, path_span, node_id); let variant = match def { @@ -3648,8 +3906,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some((variant, did, substs)) = variant { debug!("check_struct_path: did={:?} substs={:?}", did, substs); - let hir_id = self.tcx.hir.node_to_hir_id(node_id); - self.write_user_substs_from_substs(hir_id, substs, None); + let hir_id = self.tcx.hir().node_to_hir_id(node_id); + self.write_user_type_annotation_from_substs(hir_id, did, substs, None); // Check bounds on type arguments used in the path. let bounds = self.instantiate_bounds(path_span, did, substs); @@ -3671,7 +3929,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn check_expr_struct(&self, expr: &hir::Expr, expected: Expectation<'tcx>, - qpath: &hir::QPath, + qpath: &QPath, fields: &'gcx [hir::Field], base_expr: &'gcx Option>) -> Ty<'tcx> { @@ -3685,11 +3943,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }; let path_span = match *qpath { - hir::QPath::Resolved(_, ref path) => path.span, - hir::QPath::TypeRelative(ref qself, _) => qself.span + QPath::Resolved(_, ref path) => path.span, + QPath::TypeRelative(ref qself, _) => qself.span }; - // Prohibit struct expressions when non exhaustive flag is set. + // Prohibit struct expressions when non-exhaustive flag is set. let adt = adt_ty.ty_adt_def().expect("`check_struct_path` returned non-ADT type"); if !adt.did.is_local() && variant.is_field_list_non_exhaustive() { span_err!(self.tcx.sess, expr.span, E0639, @@ -3742,7 +4000,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expr: &'gcx hir::Expr, expected: Expectation<'tcx>, needs: Needs) -> Ty<'tcx> { - debug!(">> typechecking: expr={:?} expected={:?}", + debug!(">> type-checking: expr={:?} expected={:?}", expr, expected); // Warn for expressions after diverging siblings. @@ -3758,9 +4016,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Warn for non-block expressions with diverging children. match expr.node { - hir::ExprKind::Block(..) | - hir::ExprKind::Loop(..) | hir::ExprKind::While(..) | - hir::ExprKind::If(..) | hir::ExprKind::Match(..) => {} + ExprKind::Block(..) | + ExprKind::Loop(..) | ExprKind::While(..) | + ExprKind::If(..) | ExprKind::Match(..) => {} _ => self.warn_if_unreachable(expr.id, expr.span, "expression") } @@ -3779,7 +4037,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.diverges.set(self.diverges.get() | old_diverges); self.has_errors.set(self.has_errors.get() | old_has_errors); - debug!("type of {} is...", self.tcx.hir.node_to_string(expr.id)); + debug!("type of {} is...", self.tcx.hir().node_to_string(expr.id)); debug!("... {:?}, expected is {:?}", ty, expected); ty @@ -3801,7 +4059,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let tcx = self.tcx; let id = expr.id; match expr.node { - hir::ExprKind::Box(ref subexpr) => { + ExprKind::Box(ref subexpr) => { let expected_inner = expected.to_option(self).map_or(NoExpectation, |ty| { match ty.sty { ty::Adt(def, _) if def.is_box() @@ -3813,16 +4071,16 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { tcx.mk_box(referent_ty) } - hir::ExprKind::Lit(ref lit) => { + ExprKind::Lit(ref lit) => { self.check_lit(&lit, expected) } - hir::ExprKind::Binary(op, ref lhs, ref rhs) => { + ExprKind::Binary(op, ref lhs, ref rhs) => { self.check_binop(expr, op, lhs, rhs) } - hir::ExprKind::AssignOp(op, ref lhs, ref rhs) => { + ExprKind::AssignOp(op, ref lhs, ref rhs) => { self.check_binop_assign(expr, op, lhs, rhs) } - hir::ExprKind::Unary(unop, ref oprnd) => { + ExprKind::Unary(unop, ref oprnd) => { let expected_inner = match unop { hir::UnNot | hir::UnNeg => { expected @@ -3890,7 +4148,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } oprnd_t } - hir::ExprKind::AddrOf(mutbl, ref oprnd) => { + ExprKind::AddrOf(mutbl, ref oprnd) => { let hint = expected.only_has_type(self).map_or(NoExpectation, |ty| { match ty.sty { ty::Ref(_, ty, _) | ty::RawPtr(ty::TypeAndMut { ty, .. }) => { @@ -3930,15 +4188,57 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { tcx.mk_ref(region, tm) } } - hir::ExprKind::Path(ref qpath) => { + ExprKind::Path(ref qpath) => { let (def, opt_ty, segs) = self.resolve_ty_and_def_ufcs(qpath, expr.id, expr.span); - let ty = if def != Def::Err { - self.instantiate_value_path(segs, opt_ty, def, expr.span, id).0 - } else { - self.set_tainted_by_errors(); - tcx.types.err + let ty = match def { + Def::Err => { + self.set_tainted_by_errors(); + tcx.types.err + } + Def::VariantCtor(_, CtorKind::Fictive) => { + report_unexpected_variant_def(tcx, &def, expr.span, qpath); + tcx.types.err + } + _ => self.instantiate_value_path(segs, opt_ty, def, expr.span, id).0, }; + if let ty::FnDef(..) = ty.sty { + let fn_sig = ty.fn_sig(tcx); + if !tcx.features().unsized_locals { + // We want to remove some Sized bounds from std functions, + // but don't want to expose the removal to stable Rust. + // i.e., we don't want to allow + // + // ```rust + // drop as fn(str); + // ``` + // + // to work in stable even if the Sized bound on `drop` is relaxed. + for i in 0..fn_sig.inputs().skip_binder().len() { + // We just want to check sizedness, so instead of introducing + // placeholder lifetimes with probing, we just replace higher lifetimes + // with fresh vars. + let input = self.replace_bound_vars_with_fresh_vars( + expr.span, + infer::LateBoundRegionConversionTime::FnCall, + &fn_sig.input(i)).0; + self.require_type_is_sized_deferred(input, expr.span, + traits::SizedArgumentType); + } + } + // Here we want to prevent struct constructors from returning unsized types. + // There were two cases this happened: fn pointer coercion in stable + // and usual function call in presense of unsized_locals. + // Also, as we just want to check sizedness, instead of introducing + // placeholder lifetimes with probing, we just replace higher lifetimes + // with fresh vars. + let output = self.replace_bound_vars_with_fresh_vars( + expr.span, + infer::LateBoundRegionConversionTime::FnCall, + &fn_sig.output()).0; + self.require_type_is_sized_deferred(output, expr.span, traits::SizedReturnType); + } + // We always require that the type provided as the value for // a type parameter outlives the moment of instantiation. let substs = self.tables.borrow().node_substs(expr.hir_id); @@ -3946,13 +4246,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty } - hir::ExprKind::InlineAsm(_, ref outputs, ref inputs) => { + ExprKind::InlineAsm(_, ref outputs, ref inputs) => { for expr in outputs.iter().chain(inputs.iter()) { self.check_expr(expr); } tcx.mk_unit() } - hir::ExprKind::Break(destination, ref expr_opt) => { + ExprKind::Break(destination, ref expr_opt) => { if let Ok(target_id) = destination.target_id { let (e_ty, cause); if let Some(ref e) = *expr_opt { @@ -4025,39 +4325,62 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // ... except when we try to 'break rust;'. // ICE this expression in particular (see #43162). - if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = e.node { + if let ExprKind::Path(QPath::Resolved(_, ref path)) = e.node { if path.segments.len() == 1 && path.segments[0].ident.name == "rust" { fatally_break_rust(self.tcx.sess); } } } - // There was an error, make typecheck fail + // There was an error; make type-check fail. tcx.types.err } } - hir::ExprKind::Continue(destination) => { + ExprKind::Continue(destination) => { if destination.target_id.is_ok() { tcx.types.never } else { - // There was an error, make typecheck fail + // There was an error; make type-check fail. tcx.types.err } } - hir::ExprKind::Ret(ref expr_opt) => { + ExprKind::Ret(ref expr_opt) => { if self.ret_coercion.is_none() { struct_span_err!(self.tcx.sess, expr.span, E0572, "return statement outside of function body").emit(); } else if let Some(ref e) = *expr_opt { + if self.ret_coercion_span.borrow().is_none() { + *self.ret_coercion_span.borrow_mut() = Some(e.span); + } self.check_return_expr(e); } else { let mut coercion = self.ret_coercion.as_ref().unwrap().borrow_mut(); + if self.ret_coercion_span.borrow().is_none() { + *self.ret_coercion_span.borrow_mut() = Some(expr.span); + } let cause = self.cause(expr.span, ObligationCauseCode::ReturnNoExpression); - coercion.coerce_forced_unit(self, &cause, &mut |_| (), true); + if let Some((fn_decl, _)) = self.get_fn_decl(expr.id) { + coercion.coerce_forced_unit( + self, + &cause, + &mut |db| { + db.span_label( + fn_decl.output.span(), + format!( + "expected `{}` because of this return type", + fn_decl.output, + ), + ); + }, + true, + ); + } else { + coercion.coerce_forced_unit(self, &cause, &mut |_| (), true); + } } tcx.types.never } - hir::ExprKind::Assign(ref lhs, ref rhs) => { + ExprKind::Assign(ref lhs, ref rhs) => { let lhs_ty = self.check_expr_with_needs(&lhs, Needs::MutPlace); let rhs_ty = self.check_expr_coercable_to_type(&rhs, lhs_ty); @@ -4087,11 +4410,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { tcx.mk_unit() } } - hir::ExprKind::If(ref cond, ref then_expr, ref opt_else_expr) => { + ExprKind::If(ref cond, ref then_expr, ref opt_else_expr) => { self.check_then_else(&cond, then_expr, opt_else_expr.as_ref().map(|e| &**e), expr.span, expected) } - hir::ExprKind::While(ref cond, ref body, _) => { + ExprKind::While(ref cond, ref body, _) => { let ctxt = BreakableCtxt { // cannot use break with a value from a while loop coerce: None, @@ -4115,7 +4438,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.tcx.mk_unit() } - hir::ExprKind::Loop(ref body, _, source) => { + ExprKind::Loop(ref body, _, source) => { let coerce = match source { // you can only use break with a value from a normal `loop { }` hir::LoopSource::Loop => { @@ -4155,22 +4478,22 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } ctxt.coerce.map(|c| c.complete(self)).unwrap_or_else(|| self.tcx.mk_unit()) } - hir::ExprKind::Match(ref discrim, ref arms, match_src) => { + ExprKind::Match(ref discrim, ref arms, match_src) => { self.check_match(expr, &discrim, arms, expected, match_src) } - hir::ExprKind::Closure(capture, ref decl, body_id, _, gen) => { + ExprKind::Closure(capture, ref decl, body_id, _, gen) => { self.check_expr_closure(expr, capture, &decl, body_id, gen, expected) } - hir::ExprKind::Block(ref body, _) => { + ExprKind::Block(ref body, _) => { self.check_block_with_expected(&body, expected) } - hir::ExprKind::Call(ref callee, ref args) => { + ExprKind::Call(ref callee, ref args) => { self.check_call(expr, &callee, args, expected) } - hir::ExprKind::MethodCall(ref segment, span, ref args) => { + ExprKind::MethodCall(ref segment, span, ref args) => { self.check_method_call(expr, segment, span, args, expected, needs) } - hir::ExprKind::Cast(ref e, ref t) => { + ExprKind::Cast(ref e, ref t) => { // Find the type of `e`. Supply hints based on the type we are casting to, // if appropriate. let t_cast = self.to_ty_saving_user_provided_ty(t); @@ -4195,12 +4518,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } } - hir::ExprKind::Type(ref e, ref t) => { + ExprKind::Type(ref e, ref t) => { let ty = self.to_ty_saving_user_provided_ty(&t); self.check_expr_eq_type(&e, ty); ty } - hir::ExprKind::Array(ref args) => { + ExprKind::Array(ref args) => { let uty = expected.to_option(self).and_then(|uty| { match uty.sty { ty::Array(ty, _) | ty::Slice(ty) => Some(ty), @@ -4224,8 +4547,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }; tcx.mk_array(element_ty, args.len() as u64) } - hir::ExprKind::Repeat(ref element, ref count) => { - let count_def_id = tcx.hir.local_def_id(count.id); + ExprKind::Repeat(ref element, ref count) => { + let count_def_id = tcx.hir().local_def_id(count.id); let param_env = ty::ParamEnv::empty(); let substs = Substs::identity_for_item(tcx.global_tcx(), count_def_id); let instance = ty::Instance::resolve( @@ -4275,12 +4598,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if element_ty.references_error() { tcx.types.err } else if let Ok(count) = count { - tcx.mk_ty(ty::Array(t, count)) + tcx.mk_ty(ty::Array(t, tcx.intern_lazy_const(ty::LazyConst::Evaluated(count)))) } else { tcx.types.err } } - hir::ExprKind::Tup(ref elts) => { + ExprKind::Tup(ref elts) => { let flds = expected.only_has_type(self).and_then(|ty| { let ty = self.resolve_type_vars_with_obligations(ty); match ty.sty { @@ -4310,13 +4633,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { tuple } } - hir::ExprKind::Struct(ref qpath, ref fields, ref base_expr) => { + ExprKind::Struct(ref qpath, ref fields, ref base_expr) => { self.check_expr_struct(expr, expected, qpath, fields, base_expr) } - hir::ExprKind::Field(ref base, field) => { + ExprKind::Field(ref base, field) => { self.check_field(expr, needs, &base, field) } - hir::ExprKind::Index(ref base, ref idx) => { + ExprKind::Index(ref base, ref idx) => { let base_t = self.check_expr_with_needs(&base, needs); let idx_t = self.check_expr(&idx); @@ -4342,23 +4665,24 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let mut needs_note = true; // If the index is an integer, we can show the actual // fixed expression: - if let hir::ExprKind::Lit(ref lit) = idx.node { + if let ExprKind::Lit(ref lit) = idx.node { if let ast::LitKind::Int(i, ast::LitIntType::Unsuffixed) = lit.node { let snip = tcx.sess.source_map().span_to_snippet(base.span); if let Ok(snip) = snip { - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, "to access tuple elements, use", format!("{}.{}", snip, i), - Applicability::MachineApplicable); + Applicability::MachineApplicable, + ); needs_note = false; } } } if needs_note { err.help("to access tuple elements, use tuple indexing \ - syntax (e.g. `tuple.0`)"); + syntax (e.g., `tuple.0`)"); } } err.emit(); @@ -4367,7 +4691,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } } - hir::ExprKind::Yield(ref value) => { + ExprKind::Yield(ref value) => { match self.yield_ty { Some(ty) => { self.check_expr_coercable_to_type(&value, ty); @@ -4379,36 +4703,39 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } tcx.mk_unit() } + hir::ExprKind::Err => { + tcx.types.err + } } } // Finish resolving a path in a struct expression or pattern `S::A { .. }` if necessary. // The newly resolved definition is written into `type_dependent_defs`. fn finish_resolving_struct_path(&self, - qpath: &hir::QPath, + qpath: &QPath, path_span: Span, node_id: ast::NodeId) -> (Def, Ty<'tcx>) { match *qpath { - hir::QPath::Resolved(ref maybe_qself, ref path) => { + QPath::Resolved(ref maybe_qself, ref path) => { let self_ty = maybe_qself.as_ref().map(|qself| self.to_ty(qself)); let ty = AstConv::def_to_ty(self, self_ty, path, true); (path.def, ty) } - hir::QPath::TypeRelative(ref qself, ref segment) => { + QPath::TypeRelative(ref qself, ref segment) => { let ty = self.to_ty(qself); - let def = if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = qself.node { + let def = if let hir::TyKind::Path(QPath::Resolved(_, ref path)) = qself.node { path.def } else { Def::Err }; - let (ty, def) = AstConv::associated_path_def_to_ty(self, node_id, path_span, - ty, def, segment); + let (ty, def) = AstConv::associated_path_to_ty(self, node_id, path_span, + ty, def, segment, true); // Write back the new resolution. - let hir_id = self.tcx.hir.node_to_hir_id(node_id); + let hir_id = self.tcx.hir().node_to_hir_id(node_id); self.tables.borrow_mut().type_dependent_defs_mut().insert(hir_id, def); (def, ty) @@ -4419,22 +4746,23 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Resolve associated value path into a base type and associated constant or method definition. // The newly resolved definition is written into `type_dependent_defs`. pub fn resolve_ty_and_def_ufcs<'b>(&self, - qpath: &'b hir::QPath, + qpath: &'b QPath, node_id: ast::NodeId, span: Span) -> (Def, Option>, &'b [hir::PathSegment]) { - let (ty, item_segment) = match *qpath { - hir::QPath::Resolved(ref opt_qself, ref path) => { + debug!("resolve_ty_and_def_ufcs: qpath={:?} node_id={:?} span={:?}", qpath, node_id, span); + let (ty, qself, item_segment) = match *qpath { + QPath::Resolved(ref opt_qself, ref path) => { return (path.def, opt_qself.as_ref().map(|qself| self.to_ty(qself)), &path.segments[..]); } - hir::QPath::TypeRelative(ref qself, ref segment) => { - (self.to_ty(qself), segment) + QPath::TypeRelative(ref qself, ref segment) => { + (self.to_ty(qself), qself, segment) } }; - let hir_id = self.tcx.hir.node_to_hir_id(node_id); + let hir_id = self.tcx.hir().node_to_hir_id(node_id); if let Some(cached_def) = self.tables.borrow().type_dependent_defs().get(hir_id) { // Return directly on cache hit. This is useful to avoid doubly reporting // errors with default match binding modes. See #44614. @@ -4449,7 +4777,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { _ => Def::Err, }; if item_name.name != keywords::Invalid.name() { - self.report_method_error(span, ty, item_name, None, error, None); + self.report_method_error(span, + ty, + item_name, + SelfSource::QPath(qself), + error, + None); } def } @@ -4464,7 +4797,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { local: &'gcx hir::Local, init: &'gcx hir::Expr) -> Ty<'tcx> { - // FIXME(tschottdorf): contains_explicit_ref_binding() must be removed + // FIXME(tschottdorf): `contains_explicit_ref_binding()` must be removed // for #42640 (default match binding modes). // // See #44848. @@ -4499,9 +4832,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - self.check_pat_walk(&local.pat, t, - ty::BindingMode::BindByValue(hir::Mutability::MutImmutable), - true); + self.check_pat_walk( + &local.pat, + t, + ty::BindingMode::BindByValue(hir::Mutability::MutImmutable), + None, + ); let pat_ty = self.node_ty(local.pat.hir_id); if pat_ty.references_error() { self.write_ty(local.hir_id, pat_ty); @@ -4509,43 +4845,36 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } pub fn check_stmt(&self, stmt: &'gcx hir::Stmt) { - // Don't do all the complex logic below for DeclItem. + // Don't do all the complex logic below for `DeclItem`. match stmt.node { - hir::StmtKind::Decl(ref decl, _) => { - if let hir::DeclKind::Item(_) = decl.node { - return - } - } - hir::StmtKind::Expr(..) | hir::StmtKind::Semi(..) => {} + hir::StmtKind::Item(..) => return, + hir::StmtKind::Local(..) | hir::StmtKind::Expr(..) | hir::StmtKind::Semi(..) => {} } - self.warn_if_unreachable(stmt.node.id(), stmt.span, "statement"); + self.warn_if_unreachable(stmt.id, stmt.span, "statement"); - // Hide the outer diverging and has_errors flags. + // Hide the outer diverging and `has_errors` flags. let old_diverges = self.diverges.get(); let old_has_errors = self.has_errors.get(); self.diverges.set(Diverges::Maybe); self.has_errors.set(false); match stmt.node { - hir::StmtKind::Decl(ref decl, _) => { - match decl.node { - hir::DeclKind::Local(ref l) => { - self.check_decl_local(&l); - } - hir::DeclKind::Item(_) => {/* ignore for now */} - } + hir::StmtKind::Local(ref l) => { + self.check_decl_local(&l); } - hir::StmtKind::Expr(ref expr, _) => { - // Check with expected type of () + // Ignore for now. + hir::StmtKind::Item(_) => {} + hir::StmtKind::Expr(ref expr) => { + // Check with expected type of `()`. self.check_expr_has_type_or_error(&expr, self.tcx.mk_unit()); } - hir::StmtKind::Semi(ref expr, _) => { + hir::StmtKind::Semi(ref expr) => { self.check_expr(&expr); } } - // Combine the diverging and has_error flags. + // Combine the diverging and `has_error` flags. self.diverges.set(self.diverges.get() | old_diverges); self.has_errors.set(self.has_errors.get() | old_has_errors); } @@ -4635,17 +4964,32 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // // #41425 -- label the implicit `()` as being the // "found type" here, rather than the "expected type". - // - // #44579 -- if the block was recovered during parsing, - // the type would be nonsensical and it is not worth it - // to perform the type check, so we avoid generating the - // diagnostic output. - if !self.diverges.get().always() && !blk.recovered { - coerce.coerce_forced_unit(self, &self.misc(blk.span), &mut |err| { + if !self.diverges.get().always() { + // #50009 -- Do not point at the entire fn block span, point at the return type + // span, as it is the cause of the requirement, and + // `consider_hint_about_removing_semicolon` will point at the last expression + // if it were a relevant part of the error. This improves usability in editors + // that highlight errors inline. + let mut sp = blk.span; + let mut fn_span = None; + if let Some((decl, ident)) = self.get_parent_fn_decl(blk.id) { + let ret_sp = decl.output.span(); + if let Some(block_sp) = self.parent_item_span(blk.id) { + // HACK: on some cases (`ui/liveness/liveness-issue-2163.rs`) the + // output would otherwise be incorrect and even misleading. Make sure + // the span we're aiming at correspond to a `fn` body. + if block_sp == blk.span { + sp = ret_sp; + fn_span = Some(ident.span); + } + } + } + coerce.coerce_forced_unit(self, &self.misc(sp), &mut |err| { if let Some(expected_ty) = expected.only_has_type(self) { - self.consider_hint_about_removing_semicolon(blk, - expected_ty, - err); + self.consider_hint_about_removing_semicolon(blk, expected_ty, err); + } + if let Some(fn_span) = fn_span { + err.span_label(fn_span, "this function's body doesn't return"); } }, false); } @@ -4670,64 +5014,89 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty } - /// Given a `NodeId`, return the `FnDecl` of the method it is enclosed by and whether a - /// suggestion can be made, `None` otherwise. - pub fn get_fn_decl(&self, blk_id: ast::NodeId) -> Option<(hir::FnDecl, bool)> { - // Get enclosing Fn, if it is a function or a trait method, unless there's a `loop` or - // `while` before reaching it, as block tail returns are not available in them. - if let Some(fn_id) = self.tcx.hir.get_return_block(blk_id) { - let parent = self.tcx.hir.get(fn_id); - - if let Node::Item(&hir::Item { - name, node: hir::ItemKind::Fn(ref decl, ..), .. - }) = parent { - decl.clone().and_then(|decl| { - // This is less than ideal, it will not suggest a return type span on any - // method called `main`, regardless of whether it is actually the entry point, - // but it will still present it as the reason for the expected type. - Some((decl, name != Symbol::intern("main"))) - }) - } else if let Node::TraitItem(&hir::TraitItem { - node: hir::TraitItemKind::Method(hir::MethodSig { + fn parent_item_span(&self, id: ast::NodeId) -> Option { + let node = self.tcx.hir().get(self.tcx.hir().get_parent(id)); + match node { + Node::Item(&hir::Item { + node: hir::ItemKind::Fn(_, _, _, body_id), .. + }) | + Node::ImplItem(&hir::ImplItem { + node: hir::ImplItemKind::Method(_, body_id), .. + }) => { + let body = self.tcx.hir().body(body_id); + if let ExprKind::Block(block, _) = &body.value.node { + return Some(block.span); + } + } + _ => {} + } + None + } + + /// Given a function block's `NodeId`, return its `FnDecl` if it exists, or `None` otherwise. + fn get_parent_fn_decl(&self, blk_id: ast::NodeId) -> Option<(hir::FnDecl, ast::Ident)> { + let parent = self.tcx.hir().get(self.tcx.hir().get_parent(blk_id)); + self.get_node_fn_decl(parent).map(|(fn_decl, ident, _)| (fn_decl, ident)) + } + + /// Given a function `Node`, return its `FnDecl` if it exists, or `None` otherwise. + fn get_node_fn_decl(&self, node: Node) -> Option<(hir::FnDecl, ast::Ident, bool)> { + match node { + Node::Item(&hir::Item { + ident, node: hir::ItemKind::Fn(ref decl, ..), .. + }) => decl.clone().and_then(|decl| { + // This is less than ideal, it will not suggest a return type span on any + // method called `main`, regardless of whether it is actually the entry point, + // but it will still present it as the reason for the expected type. + Some((decl, ident, ident.name != Symbol::intern("main"))) + }), + Node::TraitItem(&hir::TraitItem { + ident, node: hir::TraitItemKind::Method(hir::MethodSig { ref decl, .. }, ..), .. - }) = parent { - decl.clone().and_then(|decl| { - Some((decl, true)) - }) - } else if let Node::ImplItem(&hir::ImplItem { - node: hir::ImplItemKind::Method(hir::MethodSig { + }) => decl.clone().and_then(|decl| Some((decl, ident, true))), + Node::ImplItem(&hir::ImplItem { + ident, node: hir::ImplItemKind::Method(hir::MethodSig { ref decl, .. }, ..), .. - }) = parent { - decl.clone().and_then(|decl| { - Some((decl, false)) - }) - } else { - None - } - } else { - None + }) => decl.clone().and_then(|decl| Some((decl, ident, false))), + _ => None, } } + /// Given a `NodeId`, return the `FnDecl` of the method it is enclosed by and whether a + /// suggestion can be made, `None` otherwise. + pub fn get_fn_decl(&self, blk_id: ast::NodeId) -> Option<(hir::FnDecl, bool)> { + // Get enclosing Fn, if it is a function or a trait method, unless there's a `loop` or + // `while` before reaching it, as block tail returns are not available in them. + self.tcx.hir().get_return_block(blk_id).and_then(|blk_id| { + let parent = self.tcx.hir().get(blk_id); + self.get_node_fn_decl(parent).map(|(fn_decl, _, is_main)| (fn_decl, is_main)) + }) + } + /// On implicit return expressions with mismatched types, provide the following suggestions: /// /// - Point out the method's return type as the reason for the expected type /// - Possible missing semicolon /// - Possible missing return type if the return type is the default, and not `fn main()` - pub fn suggest_mismatched_types_on_tail(&self, - err: &mut DiagnosticBuilder<'tcx>, - expression: &'gcx hir::Expr, - expected: Ty<'tcx>, - found: Ty<'tcx>, - cause_span: Span, - blk_id: ast::NodeId) { + pub fn suggest_mismatched_types_on_tail( + &self, + err: &mut DiagnosticBuilder<'tcx>, + expression: &'gcx hir::Expr, + expected: Ty<'tcx>, + found: Ty<'tcx>, + cause_span: Span, + blk_id: ast::NodeId, + ) -> bool { self.suggest_missing_semicolon(err, expression, expected, cause_span); + let mut pointing_at_return_type = false; if let Some((fn_decl, can_suggest)) = self.get_fn_decl(blk_id) { - self.suggest_missing_return_type(err, &fn_decl, expected, found, can_suggest); + pointing_at_return_type = self.suggest_missing_return_type( + err, &fn_decl, expected, found, can_suggest); } self.suggest_ref_or_into(err, expression, expected, found); + pointing_at_return_type } pub fn suggest_ref_or_into( @@ -4738,7 +5107,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { found: Ty<'tcx>, ) { if let Some((sp, msg, suggestion)) = self.check_ref(expr, found, expected) { - err.span_suggestion_with_applicability( + err.span_suggestion( sp, msg, suggestion, @@ -4765,7 +5134,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } }).peekable(); if suggestions.peek().is_some() { - err.span_suggestions_with_applicability( + err.span_suggestions( expr.span, "try using a conversion method", suggestions, @@ -4796,15 +5165,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // `BlockTailExpression` only relevant if the tail expr would be // useful on its own. match expression.node { - hir::ExprKind::Call(..) | - hir::ExprKind::MethodCall(..) | - hir::ExprKind::If(..) | - hir::ExprKind::While(..) | - hir::ExprKind::Loop(..) | - hir::ExprKind::Match(..) | - hir::ExprKind::Block(..) => { + ExprKind::Call(..) | + ExprKind::MethodCall(..) | + ExprKind::If(..) | + ExprKind::While(..) | + ExprKind::Loop(..) | + ExprKind::Match(..) | + ExprKind::Block(..) => { let sp = self.tcx.sess.source_map().next_point(cause_span); - err.span_suggestion_with_applicability( + err.span_suggestion( sp, "try adding a semicolon", ";".to_string(), @@ -4826,31 +5195,36 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// This routine checks if the return type is left as default, the method is not part of an /// `impl` block and that it isn't the `main` method. If so, it suggests setting the return /// type. - fn suggest_missing_return_type(&self, - err: &mut DiagnosticBuilder<'tcx>, - fn_decl: &hir::FnDecl, - expected: Ty<'tcx>, - found: Ty<'tcx>, - can_suggest: bool) { + fn suggest_missing_return_type( + &self, + err: &mut DiagnosticBuilder<'tcx>, + fn_decl: &hir::FnDecl, + expected: Ty<'tcx>, + found: Ty<'tcx>, + can_suggest: bool, + ) -> bool { // Only suggest changing the return type for methods that // haven't set a return type at all (and aren't `fn main()` or an impl). match (&fn_decl.output, found.is_suggestable(), can_suggest, expected.is_unit()) { (&hir::FunctionRetTy::DefaultReturn(span), true, true, true) => { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "try adding a return type", format!("-> {} ", self.resolve_type_vars_with_obligations(found)), Applicability::MachineApplicable); + true } (&hir::FunctionRetTy::DefaultReturn(span), false, true, true) => { err.span_label(span, "possibly return type missing here?"); + true } (&hir::FunctionRetTy::DefaultReturn(span), _, false, true) => { // `fn main()` must return `()`, do not suggest changing return type err.span_label(span, "expected `()` because of default return type"); + true } // expectation was caused by something else, not the default return - (&hir::FunctionRetTy::DefaultReturn(_), _, _, false) => {} + (&hir::FunctionRetTy::DefaultReturn(_), _, _, false) => false, (&hir::FunctionRetTy::Return(ref ty), _, _, _) => { // Only point to return type if the expected type is the return type, as if they // are not, the expectation must have been caused by something else. @@ -4862,12 +5236,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if ty.sty == expected.sty { err.span_label(sp, format!("expected `{}` because of return type", expected)); + return true; } + false } } } - /// A common error is to add an extra semicolon: /// /// ``` @@ -4879,126 +5254,43 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// This routine checks if the final statement in a block is an /// expression with an explicit semicolon whose type is compatible /// with `expected_ty`. If so, it suggests removing the semicolon. - fn consider_hint_about_removing_semicolon(&self, - blk: &'gcx hir::Block, - expected_ty: Ty<'tcx>, - err: &mut DiagnosticBuilder) { + fn consider_hint_about_removing_semicolon( + &self, + blk: &'gcx hir::Block, + expected_ty: Ty<'tcx>, + err: &mut DiagnosticBuilder, + ) { + if let Some(span_semi) = self.could_remove_semicolon(blk, expected_ty) { + err.span_suggestion( + span_semi, + "consider removing this semicolon", + String::new(), + Applicability::MachineApplicable, + ); + } + } + + fn could_remove_semicolon( + &self, + blk: &'gcx hir::Block, + expected_ty: Ty<'tcx>, + ) -> Option { // Be helpful when the user wrote `{... expr;}` and // taking the `;` off is enough to fix the error. let last_stmt = match blk.stmts.last() { Some(s) => s, - None => return, + None => return None, }; let last_expr = match last_stmt.node { - hir::StmtKind::Semi(ref e, _) => e, - _ => return, + hir::StmtKind::Semi(ref e) => e, + _ => return None, }; let last_expr_ty = self.node_ty(last_expr.hir_id); if self.can_sub(self.param_env, last_expr_ty, expected_ty).is_err() { - return; + return None; } let original_span = original_sp(last_stmt.span, blk.span); - let span_semi = original_span.with_lo(original_span.hi() - BytePos(1)); - err.span_suggestion_with_applicability( - span_semi, - "consider removing this semicolon", - String::new(), - Applicability::MachineApplicable); - } - - fn def_ids_for_path_segments(&self, - segments: &[hir::PathSegment], - def: Def) - -> Vec { - // We need to extract the type parameters supplied by the user in - // the path `path`. Due to the current setup, this is a bit of a - // tricky-process; the problem is that resolve only tells us the - // end-point of the path resolution, and not the intermediate steps. - // Luckily, we can (at least for now) deduce the intermediate steps - // just from the end-point. - // - // There are basically four cases to consider: - // - // 1. Reference to a constructor of enum variant or struct: - // - // struct Foo(...) - // enum E { Foo(...) } - // - // In these cases, the parameters are declared in the type - // space. - // - // 2. Reference to a fn item or a free constant: - // - // fn foo() { } - // - // In this case, the path will again always have the form - // `a::b::foo::` where only the final segment should have - // type parameters. However, in this case, those parameters are - // declared on a value, and hence are in the `FnSpace`. - // - // 3. Reference to a method or an associated constant: - // - // impl SomeStruct { - // fn foo(...) - // } - // - // Here we can have a path like - // `a::b::SomeStruct::::foo::`, in which case parameters - // may appear in two places. The penultimate segment, - // `SomeStruct::`, contains parameters in TypeSpace, and the - // final segment, `foo::` contains parameters in fn space. - // - // 4. Reference to a local variable - // - // Local variables can't have any type parameters. - // - // The first step then is to categorize the segments appropriately. - - assert!(!segments.is_empty()); - let last = segments.len() - 1; - - let mut path_segs = vec![]; - - match def { - // Case 1. Reference to a struct/variant constructor. - Def::StructCtor(def_id, ..) | - Def::VariantCtor(def_id, ..) | - Def::SelfCtor(.., def_id) => { - // Everything but the final segment should have no - // parameters at all. - let generics = self.tcx.generics_of(def_id); - // Variant and struct constructors use the - // generics of their parent type definition. - let generics_def_id = generics.parent.unwrap_or(def_id); - path_segs.push(PathSeg(generics_def_id, last)); - } - - // Case 2. Reference to a top-level value. - Def::Fn(def_id) | - Def::Const(def_id) | - Def::Static(def_id, _) => { - path_segs.push(PathSeg(def_id, last)); - } - - // Case 3. Reference to a method or associated const. - Def::Method(def_id) | - Def::AssociatedConst(def_id) => { - if segments.len() >= 2 { - let generics = self.tcx.generics_of(def_id); - path_segs.push(PathSeg(generics.parent.unwrap(), last - 1)); - } - path_segs.push(PathSeg(def_id, last)); - } - - // Case 4. Local variable, no generics. - Def::Local(..) | Def::Upvar(..) => {} - - _ => bug!("unexpected definition: {:?}", def), - } - - debug!("path_segs = {:?}", path_segs); - - path_segs + Some(original_span.with_lo(original_span.hi() - BytePos(1))) } // Instantiates the given path, which must refer to an item with the given @@ -5018,16 +5310,30 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { node_id, ); - let path_segs = self.def_ids_for_path_segments(segments, def); + let tcx = self.tcx; + + let path_segs = AstConv::def_ids_for_path_segments(self, segments, self_ty, def); let mut user_self_ty = None; + let mut is_alias_variant_ctor = false; match def { + Def::VariantCtor(_, _) => { + if let Some(self_ty) = self_ty { + let adt_def = self_ty.ty_adt_def().unwrap(); + user_self_ty = Some(UserSelfTy { + impl_def_id: adt_def.did, + self_ty, + }); + is_alias_variant_ctor = true; + } + } Def::Method(def_id) | Def::AssociatedConst(def_id) => { - let container = self.tcx.associated_item(def_id).container; + let container = tcx.associated_item(def_id).container; + debug!("instantiate_value_path: def={:?} container={:?}", def, container); match container { ty::TraitContainer(trait_did) => { - callee::check_legal_trait_for_method_call(self.tcx, span, trait_did) + callee::check_legal_trait_for_method_call(tcx, span, trait_did) } ty::ImplContainer(impl_def_id) => { if segments.len() == 1 { @@ -5053,21 +5359,25 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // provided (if any) into their appropriate spaces. We'll also report // errors if type parameters are provided in an inappropriate place. - let generic_segs = path_segs.iter().map(|PathSeg(_, index)| index) - .collect::>(); - AstConv::prohibit_generics(self, segments.iter().enumerate().filter_map(|(index, seg)| { - if !generic_segs.contains(&index) { + let generic_segs: FxHashSet<_> = path_segs.iter().map(|PathSeg(_, index)| index).collect(); + let generics_has_err = AstConv::prohibit_generics( + self, segments.iter().enumerate().filter_map(|(index, seg)| { + if !generic_segs.contains(&index) || is_alias_variant_ctor { Some(seg) } else { None } })); + if generics_has_err { + // Don't try to infer type parameters when prohibited generic arguments were given. + user_self_ty = None; + } match def { Def::Local(nid) | Def::Upvar(nid, ..) => { let ty = self.local_ty(span, nid).decl_ty; let ty = self.normalize_associated_types_in(span, &ty); - self.write_ty(self.tcx.hir.node_to_hir_id(node_id), ty); + self.write_ty(tcx.hir().node_to_hir_id(node_id), ty); return (ty, def); } _ => {} @@ -5083,13 +5393,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let mut infer_args_for_err = FxHashSet::default(); for &PathSeg(def_id, index) in &path_segs { let seg = &segments[index]; - let generics = self.tcx.generics_of(def_id); + let generics = tcx.generics_of(def_id); // Argument-position `impl Trait` is treated as a normal generic // parameter internally, but we don't allow users to specify the // parameter's value explicitly, so we have to do some error- // checking here. let suppress_errors = AstConv::check_generic_arg_count_for_call( - self.tcx, + tcx, span, &generics, &seg, @@ -5102,34 +5412,58 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } let has_self = path_segs.last().map(|PathSeg(def_id, _)| { - self.tcx.generics_of(*def_id).has_self + tcx.generics_of(*def_id).has_self }).unwrap_or(false); let mut new_def = def; - let (def_id, ty) = if let Def::SelfCtor(impl_def_id) = def { - let ty = self.impl_self_ty(span, impl_def_id).ty; - - match ty.ty_adt_def() { - Some(adt_def) if adt_def.is_struct() => { - let variant = adt_def.non_enum_variant(); - new_def = Def::StructCtor(variant.did, variant.ctor_kind); - (variant.did, self.tcx.type_of(variant.did)) - } - _ => { - (impl_def_id, self.tcx.types.err) + let (def_id, ty) = match def { + Def::SelfCtor(impl_def_id) => { + let ty = self.impl_self_ty(span, impl_def_id).ty; + let adt_def = ty.ty_adt_def(); + + match adt_def { + Some(adt_def) if adt_def.has_ctor() => { + let variant = adt_def.non_enum_variant(); + new_def = Def::StructCtor(variant.did, variant.ctor_kind); + (variant.did, tcx.type_of(variant.did)) + } + _ => { + let mut err = tcx.sess.struct_span_err(span, + "the `Self` constructor can only be used with tuple or unit structs"); + if let Some(adt_def) = adt_def { + match adt_def.adt_kind() { + AdtKind::Enum => { + err.help("did you mean to use one of the enum's variants?"); + }, + AdtKind::Struct | + AdtKind::Union => { + err.span_suggestion( + span, + "use curly brackets", + String::from("Self { /* fields */ }"), + Applicability::HasPlaceholders, + ); + } + } + } + err.emit(); + + (impl_def_id, tcx.types.err) + } } } - } else { - let def_id = def.def_id(); + _ => { + let def_id = def.def_id(); - // The things we are substituting into the type should not contain - // escaping late-bound regions, and nor should the base type scheme. - let ty = self.tcx.type_of(def_id); - (def_id, ty) + // The things we are substituting into the type should not contain + // escaping late-bound regions, and nor should the base type scheme. + let ty = tcx.type_of(def_id); + (def_id, ty) + } }; let substs = AstConv::create_substs_for_generic_args( - self.tcx, + tcx, def_id, &[][..], has_self, @@ -5175,10 +5509,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // If we have a default, then we it doesn't matter that we're not // inferring the type arguments: we provide the default where any // is missing. - let default = self.tcx.type_of(param.def_id); + let default = tcx.type_of(param.def_id); self.normalize_ty( span, - default.subst_spanned(self.tcx, substs.unwrap(), Some(span)) + default.subst_spanned(tcx, substs.unwrap(), Some(span)) ).into() } else { // If no type arguments were provided, we have to infer them. @@ -5194,9 +5528,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { assert!(!substs.has_escaping_bound_vars()); assert!(!ty.has_escaping_bound_vars()); - // Write the "user substs" down first thing for later. - let hir_id = self.tcx.hir.node_to_hir_id(node_id); - self.write_user_substs_from_substs(hir_id, substs, user_self_ty); + // First, store the "user substs" for later. + let hir_id = tcx.hir().node_to_hir_id(node_id); + self.write_user_type_annotation_from_substs(hir_id, def_id, substs, user_self_ty); // Add all the obligations that are required, substituting and // normalized appropriately. @@ -5211,10 +5545,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some(UserSelfTy { impl_def_id, self_ty }) = user_self_ty { // In the case of `Foo::method` and `>::method`, if `method` - // is inherent, there is no `Self` parameter, instead, the impl needs + // is inherent, there is no `Self` parameter; instead, the impl needs // type parameters, which we can infer by unifying the provided `Self` // with the substituted impl type. - let ty = self.tcx.type_of(impl_def_id); + // This also occurs for an enum variant on a type alias. + let ty = tcx.type_of(impl_def_id); let impl_ty = self.instantiate_type_scheme(span, &substs, &ty); match self.at(&self.misc(span), self.param_env).sup(impl_ty, self_ty) { @@ -5250,8 +5585,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // If our calling expression is indeed the function itself, we're good! // If not, generate an error that this can only be called directly. - if let Node::Expr(expr) = self.tcx.hir.get(self.tcx.hir.get_parent_node(node_id)) { - if let hir::ExprKind::Call(ref callee, ..) = expr.node { + if let Node::Expr(expr) = self.tcx.hir().get(self.tcx.hir().get_parent_node(node_id)) { + if let ExprKind::Call(ref callee, ..) = expr.node { if callee.id == node_id { return } @@ -5299,6 +5634,44 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }; (ctxt, result) } + + /// Instantiate a QueryResponse in a probe context, without a + /// good ObligationCause. + fn probe_instantiate_query_response( + &self, + span: Span, + original_values: &OriginalQueryValues<'tcx>, + query_result: &Canonical<'tcx, QueryResponse<'tcx, Ty<'tcx>>>, + ) -> InferResult<'tcx, Ty<'tcx>> + { + self.instantiate_query_response_and_region_obligations( + &traits::ObligationCause::misc(span, self.body_id), + self.param_env, + original_values, + query_result) + } + + /// Returns whether an expression is contained inside the LHS of an assignment expression. + fn expr_in_place(&self, mut expr_id: ast::NodeId) -> bool { + let mut contained_in_place = false; + + while let hir::Node::Expr(parent_expr) = + self.tcx.hir().get(self.tcx.hir().get_parent_node(expr_id)) + { + match &parent_expr.node { + hir::ExprKind::Assign(lhs, ..) | hir::ExprKind::AssignOp(_, lhs, ..) => { + if lhs.id == expr_id { + contained_in_place = true; + break; + } + } + _ => (), + } + expr_id = parent_expr.id; + } + + contained_in_place + } } pub fn check_bounds_are_used<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -5331,8 +5704,8 @@ pub fn check_bounds_are_used<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }); for (&used, param) in types_used.iter().zip(types) { if !used { - let id = tcx.hir.as_local_node_id(param.def_id).unwrap(); - let span = tcx.hir.span(id); + let id = tcx.hir().as_local_node_id(param.def_id).unwrap(); + let span = tcx.hir().span(id); struct_span_err!(tcx.sess, span, E0091, "type parameter `{}` is unused", param.name) .span_label(span, "unused type parameter") .emit(); diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index 54f4406b4af..5efa9f08404 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Code related to processing overloaded binary and unary operators. use super::{FnCtxt, Needs}; @@ -170,7 +160,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Find a suitable supertype of the LHS expression's type, by coercing to // a type variable, to pass as the `Self` to the trait, avoiding invariant // trait matching creating lifetime constraints that are too strict. - // E.g. adding `&'a T` and `&'b T`, given `&'x T: Add<&'x T>`, will result + // e.g., adding `&'a T` and `&'b T`, given `&'x T: Add<&'x T>`, will result // in `&'a T <: &'x T` and `&'b T <: &'x T`, instead of `'a = 'b = 'x`. let lhs_ty = self.check_expr_with_needs(lhs_expr, Needs::None); let fresh_var = self.next_ty_var(TypeVariableOrigin::MiscVariable(lhs_expr.span)); @@ -186,7 +176,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }; let lhs_ty = self.resolve_type_vars_with_obligations(lhs_ty); - // NB: As we have not yet type-checked the RHS, we don't have the + // N.B., as we have not yet type-checked the RHS, we don't have the // type at hand. Make a variable to represent it. The whole reason // for this indirection is so that, below, we can check the expr // using this variable as the expected type, which sometimes lets @@ -272,9 +262,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let mut suggested_deref = false; if let Ref(_, mut rty, _) = lhs_ty.sty { if { - !self.infcx.type_moves_by_default(self.param_env, - rty, - lhs_expr.span) && + self.infcx.type_is_copy_modulo_regions(self.param_env, + rty, + lhs_expr.span) && self.lookup_op_method(rty, &[rhs_ty], Op::Binary(op, is_assign)) @@ -290,7 +280,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { rty, lstring, ); - err.span_suggestion_with_applicability( + err.span_suggestion( lhs_expr.span, msg, format!("*{}", lstring), @@ -318,7 +308,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.check_str_addition(expr, lhs_expr, rhs_expr, lhs_ty, rhs_ty, &mut err, true) { // This has nothing here because it means we did string - // concatenation (e.g. "Hello " += "World!"). This means + // concatenation (e.g., "Hello " += "World!"). This means // we don't want the note in the else clause to be emitted } else if let ty::Param(_) = lhs_ty.sty { // FIXME: point to span of param @@ -344,9 +334,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let mut suggested_deref = false; if let Ref(_, mut rty, _) = lhs_ty.sty { if { - !self.infcx.type_moves_by_default(self.param_env, - rty, - lhs_expr.span) && + self.infcx.type_is_copy_modulo_regions(self.param_env, + rty, + lhs_expr.span) && self.lookup_op_method(rty, &[rhs_ty], Op::Binary(op, is_assign)) @@ -392,7 +382,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.check_str_addition(expr, lhs_expr, rhs_expr, lhs_ty, rhs_ty, &mut err, false) { // This has nothing here because it means we did string - // concatenation (e.g. "Hello " + "World!"). This means + // concatenation (e.g., "Hello " + "World!"). This means // we don't want the note in the else clause to be emitted } else if let ty::Param(_) = lhs_ty.sty { // FIXME: point to span of param @@ -444,7 +434,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { err.span_label(expr.span, "`+` can't be used to concatenate two `&str` strings"); match source_map.span_to_snippet(lhs_expr.span) { - Ok(lstring) => err.span_suggestion_with_applicability( + Ok(lstring) => err.span_suggestion( lhs_expr.span, msg, format!("{}.to_owned()", lstring), @@ -465,7 +455,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { is_assign, ) { (Ok(l), Ok(r), false) => { - err.multipart_suggestion_with_applicability( + err.multipart_suggestion( msg, vec![ (lhs_expr.span, format!("{}.to_owned()", l)), @@ -682,7 +672,7 @@ enum Op { Unary(hir::UnOp, Span), } -/// Returns true if this is a built-in arithmetic operation (e.g. u32 +/// Returns true if this is a built-in arithmetic operation (e.g., u32 /// + u32, i16x4 == i16x4) and false if these types would have to be /// overloaded to be legal. There are two reasons that we distinguish /// builtin operations from overloaded ones (vs trying to drive diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index 212ee2698e0..b90c18eb41c 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The region check is a final pass that runs over the AST after we have //! inferred the type constraints but before we have actually finalized //! the types. Its purpose is to embed a variety of region constraints. @@ -121,7 +111,7 @@ macro_rules! ignore_err { impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn regionck_expr(&self, body: &'gcx hir::Body) { - let subject = self.tcx.hir.body_owner_def_id(body.id()); + let subject = self.tcx.hir().body_owner_def_id(body.id()); let id = body.value.id; let mut rcx = RegionCtxt::new( self, @@ -150,7 +140,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// types from which we should derive implied bounds, if any. pub fn regionck_item(&self, item_id: ast::NodeId, span: Span, wf_tys: &[Ty<'tcx>]) { debug!("regionck_item(item.id={:?}, wf_tys={:?})", item_id, wf_tys); - let subject = self.tcx.hir.local_def_id(item_id); + let subject = self.tcx.hir().local_def_id(item_id); let mut rcx = RegionCtxt::new( self, RepeatingScope(item_id), @@ -175,7 +165,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// constraints to add. pub fn regionck_fn(&self, fn_id: ast::NodeId, body: &'gcx hir::Body) { debug!("regionck_fn(id={})", fn_id); - let subject = self.tcx.hir.body_owner_def_id(body.id()); + let subject = self.tcx.hir().body_owner_def_id(body.id()); let node_id = body.value.id; let mut rcx = RegionCtxt::new( self, @@ -187,7 +177,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if self.err_count_since_creation() == 0 { // regionck assumes typeck succeeded - rcx.visit_fn_body(fn_id, body, self.tcx.hir.span(fn_id)); + rcx.visit_fn_body(fn_id, body, self.tcx.hir().span(fn_id)); } rcx.resolve_regions_and_report_errors(SuppressRegionErrors::when_nll_is_enabled(self.tcx)); @@ -328,7 +318,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { self.call_site_scope = Some(call_site); let fn_sig = { - let fn_hir_id = self.tcx.hir.node_to_hir_id(id); + let fn_hir_id = self.tcx.hir().node_to_hir_id(id); match self.tables.borrow().liberated_fn_sigs().get(fn_hir_id) { Some(f) => f.clone(), None => { @@ -375,7 +365,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { ); let call_site_region = self.tcx.mk_region(ty::ReScope(call_site_scope)); - let body_hir_id = self.tcx.hir.node_to_hir_id(body_id.node_id); + let body_hir_id = self.tcx.hir().node_to_hir_id(body_id.node_id); self.type_of_node_must_outlive(infer::CallReturn(span), body_hir_id, call_site_region); self.constrain_opaque_types( @@ -483,7 +473,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for RegionCtxt<'a, 'gcx, 'tcx> { let old_call_site_scope = self.call_site_scope; let env_snapshot = self.outlives_environment.push_snapshot_pre_closure(); - let body = self.tcx.hir.body(body_id); + let body = self.tcx.hir().body(body_id); self.visit_fn_body(id, body, span); // Restore state from previous function. diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index 312ce402775..ffd7c2114e5 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! ### Inferring borrow kinds for upvars //! //! Whenever there is a closure expression, we need to determine how each @@ -74,7 +64,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for InferBorrowKindVisitor<'a, 'gcx, 'tcx> { fn visit_expr(&mut self, expr: &'gcx hir::Expr) { if let hir::ExprKind::Closure(cc, _, body_id, _, _) = expr.node { - let body = self.fcx.tcx.hir.body(body_id); + let body = self.fcx.tcx.hir().body(body_id); self.visit_body(body); self.fcx .analyze_closure(expr.id, expr.hir_id, expr.span, body, cc); @@ -132,14 +122,18 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }; self.tcx.with_freevars(closure_node_id, |freevars| { + let mut freevar_list: Vec = Vec::with_capacity(freevars.len()); for freevar in freevars { let upvar_id = ty::UpvarId { var_path: ty::UpvarPath { - hir_id : self.tcx.hir.node_to_hir_id(freevar.var_id()), + hir_id: self.tcx.hir().node_to_hir_id(freevar.var_id()), }, closure_expr_id: LocalDefId::from_def_id(closure_def_id), }; debug!("seed upvar_id {:?}", upvar_id); + // Adding the upvar Id to the list of Upvars, which will be added + // to the map for the closure at the end of the for loop. + freevar_list.push(upvar_id); let capture_kind = match capture_clause { hir::CaptureByValue => ty::UpvarCapture::ByValue, @@ -159,9 +153,18 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .upvar_capture_map .insert(upvar_id, capture_kind); } + // Add the vector of freevars to the map keyed with the closure id. + // This gives us an easier access to them without having to call + // with_freevars again.. + if !freevar_list.is_empty() { + self.tables + .borrow_mut() + .upvar_list + .insert(closure_def_id, freevar_list); + } }); - let body_owner_def_id = self.tcx.hir.body_owner_def_id(body.id()); + let body_owner_def_id = self.tcx.hir().body_owner_def_id(body.id()); let region_scope_tree = &self.tcx.region_scope_tree(body_owner_def_id); let mut delegate = InferBorrowKind { fcx: self, @@ -176,7 +179,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.param_env, region_scope_tree, &self.tables.borrow(), - ).consume_body(body); + ) + .consume_body(body); if let Some(closure_substs) = infer_kind { // Unify the (as yet unbound) type variable in the closure @@ -240,19 +244,17 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // This may change if abstract return types of some sort are // implemented. let tcx = self.tcx; - let closure_def_index = tcx.hir.local_def_id(closure_id); + let closure_def_index = tcx.hir().local_def_id(closure_id); tcx.with_freevars(closure_id, |freevars| { freevars .iter() .map(|freevar| { let var_node_id = freevar.var_id(); - let var_hir_id = tcx.hir.node_to_hir_id(var_node_id); + let var_hir_id = tcx.hir().node_to_hir_id(var_node_id); let freevar_ty = self.node_ty(var_hir_id); let upvar_id = ty::UpvarId { - var_path: ty::UpvarPath { - hir_id: var_hir_id, - }, + var_path: ty::UpvarPath { hir_id: var_hir_id }, closure_expr_id: LocalDefId::from_def_id(closure_def_index), }; let capture = self.tables.borrow().upvar_capture(upvar_id); @@ -272,7 +274,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }, ), } - }).collect() + }) + .collect() }) } } @@ -647,6 +650,6 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> { } fn var_name(tcx: TyCtxt, var_hir_id: hir::HirId) -> ast::Name { - let var_node_id = tcx.hir.hir_to_node_id(var_hir_id); - tcx.hir.name(var_node_id) + let var_node_id = tcx.hir().hir_to_node_id(var_hir_id); + tcx.hir().name(var_node_id) } diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index b5addbd18d2..6cae8d6fc5b 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -1,21 +1,10 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use check::{Inherited, FnCtxt}; use constrained_type_params::{identify_constrained_type_params, Parameter}; use hir::def_id::DefId; use rustc::traits::{self, ObligationCauseCode}; -use rustc::ty::{self, Lift, Ty, TyCtxt, TyKind, GenericParamDefKind, TypeFoldable}; +use rustc::ty::{self, Lift, Ty, TyCtxt, TyKind, GenericParamDefKind, TypeFoldable, ToPredicate}; use rustc::ty::subst::{Subst, Substs}; -use rustc::ty::util::ExplicitSelf; use rustc::util::nodemap::{FxHashSet, FxHashMap}; use rustc::middle::lang_items; use rustc::infer::opaque_types::may_define_existential_type; @@ -73,8 +62,8 @@ impl<'a, 'gcx, 'tcx> CheckWfFcxBuilder<'a, 'gcx, 'tcx> { /// not included it frequently leads to confusing errors in fn bodies. So it's better to check /// the types first. pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let item = tcx.hir.expect_item(node_id); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let item = tcx.hir().expect_item(node_id); debug!("check_item_well_formed(it.id={}, it.name={})", item.id, @@ -99,7 +88,7 @@ pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: Def // won't be allowed unless there's an *explicit* implementation of `Send` // for `T` hir::ItemKind::Impl(_, polarity, defaultness, _, ref trait_ref, ref self_ty, _) => { - let is_auto = tcx.impl_trait_ref(tcx.hir.local_def_id(item.id)) + let is_auto = tcx.impl_trait_ref(tcx.hir().local_def_id(item.id)) .map_or(false, |trait_ref| tcx.trait_is_auto(trait_ref.def_id)); if let (hir::Defaultness::Default { .. }, true) = (defaultness, is_auto) { tcx.sess.span_err(item.span, "impls of auto traits cannot be default"); @@ -161,8 +150,8 @@ pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: Def } pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let trait_item = tcx.hir.expect_trait_item(node_id); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let trait_item = tcx.hir().expect_trait_item(node_id); let method_sig = match trait_item.node { hir::TraitItemKind::Method(ref sig, _) => Some(sig), @@ -172,8 +161,8 @@ pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { } pub fn check_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let impl_item = tcx.hir.expect_impl_item(node_id); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let impl_item = tcx.hir().expect_impl_item(node_id); let method_sig = match impl_item.node { hir::ImplItemKind::Method(ref sig, _) => Some(sig), @@ -190,7 +179,7 @@ fn check_associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let code = ObligationCauseCode::MiscObligation; for_id(tcx, item_id, span).with_fcx(|fcx, tcx| { - let item = fcx.tcx.associated_item(fcx.tcx.hir.local_def_id(item_id)); + let item = fcx.tcx.associated_item(fcx.tcx.hir().local_def_id(item_id)); let (mut implied_bounds, self_ty) = match item.container { ty::TraitContainer(_) => (vec![], fcx.tcx.mk_self_type()), @@ -236,7 +225,7 @@ fn for_item<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, item: &hir::Item) fn for_id<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, id: ast::NodeId, span: Span) -> CheckWfFcxBuilder<'a, 'gcx, 'tcx> { - let def_id = tcx.hir.local_def_id(id); + let def_id = tcx.hir().local_def_id(id); CheckWfFcxBuilder { inherited: Inherited::build(tcx, def_id), id, @@ -252,7 +241,7 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>, { for_item(tcx, item).with_fcx(|fcx, fcx_tcx| { let variants = lookup_fields(fcx); - let def_id = fcx.tcx.hir.local_def_id(item.id); + let def_id = fcx.tcx.hir().local_def_id(item.id); let packed = fcx.tcx.adt_def(def_id).repr.packed(); for variant in &variants { @@ -315,7 +304,7 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn check_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { debug!("check_trait: {:?}", item.id); - let trait_def_id = tcx.hir.local_def_id(item.id); + let trait_def_id = tcx.hir().local_def_id(item.id); let trait_def = tcx.trait_def(trait_def_id); if trait_def.is_marker { @@ -337,7 +326,7 @@ fn check_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { for_item(tcx, item).with_fcx(|fcx, tcx| { - let def_id = fcx.tcx.hir.local_def_id(item.id); + let def_id = fcx.tcx.hir().local_def_id(item.id); let sig = fcx.tcx.fn_sig(def_id); let sig = fcx.normalize_associated_types_in(item.span, &sig); let mut implied_bounds = vec![]; @@ -355,13 +344,13 @@ fn check_item_type<'a, 'tcx>( ) { debug!("check_item_type: {:?}", item_id); - for_id(tcx, item_id, ty_span).with_fcx(|fcx, _this| { - let ty = fcx.tcx.type_of(fcx.tcx.hir.local_def_id(item_id)); + for_id(tcx, item_id, ty_span).with_fcx(|fcx, gcx| { + let ty = gcx.type_of(gcx.hir().local_def_id(item_id)); let item_ty = fcx.normalize_associated_types_in(ty_span, &ty); let mut forbid_unsized = true; if allow_foreign_ty { - if let TyKind::Foreign(_) = tcx.struct_tail(item_ty).sty { + if let TyKind::Foreign(_) = fcx.tcx.struct_tail(item_ty).sty { forbid_unsized = false; } } @@ -387,7 +376,7 @@ fn check_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, debug!("check_impl: {:?}", item); for_item(tcx, item).with_fcx(|fcx, tcx| { - let item_def_id = fcx.tcx.hir.local_def_id(item.id); + let item_def_id = fcx.tcx.hir().local_def_id(item.id); match *ast_trait_ref { Some(ref ast_trait_ref) => { @@ -619,9 +608,9 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>( if let ty::Opaque(def_id, substs) = ty.sty { trace!("check_existential_types: opaque_ty, {:?}, {:?}", def_id, substs); let generics = tcx.generics_of(def_id); - // only check named existential types - if generics.parent.is_none() { - let opaque_node_id = tcx.hir.as_local_node_id(def_id).unwrap(); + // only check named existential types defined in this crate + if generics.parent.is_none() && def_id.is_local() { + let opaque_node_id = tcx.hir().as_local_node_id(def_id).unwrap(); if may_define_existential_type(tcx, fn_def_id, opaque_node_id) { trace!("check_existential_types may define. Generics: {:#?}", generics); let mut seen: FxHashMap<_, Vec<_>> = FxHashMap::default(); @@ -749,79 +738,156 @@ fn check_method_receiver<'fcx, 'gcx, 'tcx>(fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, &ty::Binder::bind(self_ty) ); - let self_arg_ty = sig.inputs()[0]; + let receiver_ty = sig.inputs()[0]; - let cause = fcx.cause(span, ObligationCauseCode::MethodReceiver); - let self_arg_ty = fcx.normalize_associated_types_in(span, &self_arg_ty); - let self_arg_ty = fcx.tcx.liberate_late_bound_regions( + let receiver_ty = fcx.normalize_associated_types_in(span, &receiver_ty); + let receiver_ty = fcx.tcx.liberate_late_bound_regions( method.def_id, - &ty::Binder::bind(self_arg_ty) + &ty::Binder::bind(receiver_ty) ); - let mut autoderef = fcx.autoderef(span, self_arg_ty).include_raw_pointers(); + if fcx.tcx.features().arbitrary_self_types { + if !receiver_is_valid(fcx, span, receiver_ty, self_ty, true) { + // report error, arbitrary_self_types was enabled + fcx.tcx.sess.diagnostic().mut_span_err( + span, &format!("invalid method receiver type: {:?}", receiver_ty) + ).note("type of `self` must be `Self` or a type that dereferences to it") + .help("consider changing to `self`, `&self`, `&mut self`, or `self: Box`") + .code(DiagnosticId::Error("E0307".into())) + .emit(); + } + } else { + if !receiver_is_valid(fcx, span, receiver_ty, self_ty, false) { + if receiver_is_valid(fcx, span, receiver_ty, self_ty, true) { + // report error, would have worked with arbitrary_self_types + feature_gate::feature_err( + &fcx.tcx.sess.parse_sess, + "arbitrary_self_types", + span, + GateIssue::Language, + &format!( + "`{}` cannot be used as the type of `self` without \ + the `arbitrary_self_types` feature", + receiver_ty, + ), + ).help("consider changing to `self`, `&self`, `&mut self`, or `self: Box`") + .emit(); + } else { + // report error, would not have worked with arbitrary_self_types + fcx.tcx.sess.diagnostic().mut_span_err( + span, &format!("invalid method receiver type: {:?}", receiver_ty) + ).note("type must be `Self` or a type that dereferences to it") + .help("consider changing to `self`, `&self`, `&mut self`, or `self: Box`") + .code(DiagnosticId::Error("E0307".into())) + .emit(); + } + } + } +} + +/// returns true if `receiver_ty` would be considered a valid receiver type for `self_ty`. If +/// `arbitrary_self_types` is enabled, `receiver_ty` must transitively deref to `self_ty`, possibly +/// through a `*const/mut T` raw pointer. If the feature is not enabled, the requirements are more +/// strict: `receiver_ty` must implement `Receiver` and directly implement `Deref`. +/// +/// NB: there are cases this function returns `true` but causes an error to be emitted, +/// particularly when `receiver_ty` derefs to a type that is the same as `self_ty` but has the +/// wrong lifetime. Be careful of this if you are calling this function speculatively. +fn receiver_is_valid<'fcx, 'tcx, 'gcx>( + fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, + span: Span, + receiver_ty: Ty<'tcx>, + self_ty: Ty<'tcx>, + arbitrary_self_types_enabled: bool, +) -> bool { + let cause = fcx.cause(span, traits::ObligationCauseCode::MethodReceiver); + + let can_eq_self = |ty| fcx.infcx.can_eq(fcx.param_env, self_ty, ty).is_ok(); + + // `self: Self` is always valid + if can_eq_self(receiver_ty) { + if let Some(mut err) = fcx.demand_eqtype_with_origin(&cause, self_ty, receiver_ty) { + err.emit(); + } + return true + } + + let mut autoderef = fcx.autoderef(span, receiver_ty); + + // the `arbitrary_self_types` feature allows raw pointer receivers like `self: *const Self` + if arbitrary_self_types_enabled { + autoderef = autoderef.include_raw_pointers(); + } + + // the first type is `receiver_ty`, which we know its not equal to `self_ty`. skip it. + autoderef.next(); + // keep dereferencing `receiver_ty` until we get to `self_ty` loop { if let Some((potential_self_ty, _)) = autoderef.next() { - debug!("check_method_receiver: potential self type `{:?}` to match `{:?}`", + debug!("receiver_is_valid: potential self type `{:?}` to match `{:?}`", potential_self_ty, self_ty); - if fcx.infcx.can_eq(fcx.param_env, self_ty, potential_self_ty).is_ok() { - autoderef.finalize(); + if can_eq_self(potential_self_ty) { + autoderef.finalize(fcx); + if let Some(mut err) = fcx.demand_eqtype_with_origin( - &cause, self_ty, potential_self_ty) { + &cause, self_ty, potential_self_ty + ) { err.emit(); } + break } } else { - fcx.tcx.sess.diagnostic().mut_span_err( - span, &format!("invalid `self` type: {:?}", self_arg_ty)) - .note(&format!("type must be `{:?}` or a type that dereferences to it", self_ty)) - .help("consider changing to `self`, `&self`, `&mut self`, or `self: Box`") - .code(DiagnosticId::Error("E0307".into())) - .emit(); - return + debug!("receiver_is_valid: type `{:?}` does not deref to `{:?}`", + receiver_ty, self_ty); + return false + } + + // without the `arbitrary_self_types` feature, `receiver_ty` must directly deref to + // `self_ty`. Enforce this by only doing one iteration of the loop + if !arbitrary_self_types_enabled { + return false } } - let is_self_ty = |ty| fcx.infcx.can_eq(fcx.param_env, self_ty, ty).is_ok(); - let self_kind = ExplicitSelf::determine(self_arg_ty, is_self_ty); + // without `feature(arbitrary_self_types)`, we require that `receiver_ty` implements `Receiver` + if !arbitrary_self_types_enabled { + let trait_def_id = match fcx.tcx.lang_items().receiver_trait() { + Some(did) => did, + None => { + debug!("receiver_is_valid: missing Receiver trait"); + return false + } + }; - if !fcx.tcx.features().arbitrary_self_types { - match self_kind { - ExplicitSelf::ByValue | - ExplicitSelf::ByReference(_, _) | - ExplicitSelf::ByBox => (), + let trait_ref = ty::TraitRef{ + def_id: trait_def_id, + substs: fcx.tcx.mk_substs_trait(receiver_ty, &[]), + }; - ExplicitSelf::ByRawPointer(_) => { - feature_gate::feature_err( - &fcx.tcx.sess.parse_sess, - "arbitrary_self_types", - span, - GateIssue::Language, - "raw pointer `self` is unstable") - .help("consider changing to `self`, `&self`, `&mut self`, or `self: Box`") - .emit(); - } + let obligation = traits::Obligation::new( + cause.clone(), + fcx.param_env, + trait_ref.to_predicate() + ); - ExplicitSelf::Other => { - feature_gate::feature_err( - &fcx.tcx.sess.parse_sess, - "arbitrary_self_types", - span, - GateIssue::Language,"arbitrary `self` types are unstable") - .help("consider changing to `self`, `&self`, `&mut self`, or `self: Box`") - .emit(); - } + if !fcx.predicate_must_hold_modulo_regions(&obligation) { + debug!("receiver_is_valid: type `{:?}` does not implement `Receiver` trait", + receiver_ty); + return false } } + + true } fn check_variances_for_type_defn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item, hir_generics: &hir::Generics) { - let item_def_id = tcx.hir.local_def_id(item.id); + let item_def_id = tcx.hir().local_def_id(item.id); let ty = tcx.type_of(item_def_id); if tcx.has_error_field(ty) { return; @@ -908,7 +974,7 @@ fn check_false_global_bounds<'a, 'gcx, 'tcx>( let empty_env = ty::ParamEnv::empty(); - let def_id = fcx.tcx.hir.local_def_id(id); + let def_id = fcx.tcx.hir().local_def_id(id); let predicates = fcx.tcx.predicates_of(def_id).predicates .iter() .map(|(p, _)| *p) @@ -956,21 +1022,21 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckTypeWellFormedVisitor<'a, 'tcx> { fn visit_item(&mut self, i: &hir::Item) { debug!("visit_item: {:?}", i); - let def_id = self.tcx.hir.local_def_id(i.id); + let def_id = self.tcx.hir().local_def_id(i.id); ty::query::queries::check_item_well_formed::ensure(self.tcx, def_id); intravisit::walk_item(self, i); } fn visit_trait_item(&mut self, trait_item: &'v hir::TraitItem) { debug!("visit_trait_item: {:?}", trait_item); - let def_id = self.tcx.hir.local_def_id(trait_item.id); + let def_id = self.tcx.hir().local_def_id(trait_item.id); ty::query::queries::check_trait_item_well_formed::ensure(self.tcx, def_id); intravisit::walk_trait_item(self, trait_item) } fn visit_impl_item(&mut self, impl_item: &'v hir::ImplItem) { debug!("visit_impl_item: {:?}", impl_item); - let def_id = self.tcx.hir.local_def_id(impl_item.id); + let def_id = self.tcx.hir().local_def_id(impl_item.id); ty::query::queries::check_impl_item_well_formed::ensure(self.tcx, def_id); intravisit::walk_impl_item(self, impl_item) } @@ -991,7 +1057,7 @@ struct AdtField<'tcx> { impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn non_enum_variant(&self, struct_def: &hir::VariantData) -> AdtVariant<'tcx> { let fields = struct_def.fields().iter().map(|field| { - let field_ty = self.tcx.type_of(self.tcx.hir.local_def_id(field.id)); + let field_ty = self.tcx.type_of(self.tcx.hir().local_def_id(field.id)); let field_ty = self.normalize_associated_types_in(field.span, &field_ty); AdtField { ty: field_ty, span: field.span } diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 50f54bba3fd..238b087fe32 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -1,18 +1,9 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Type resolution: the phase that finds all the types in the AST with // unresolved type variables and replaces "ty_var" types with their // substitutions. use check::FnCtxt; +use errors::DiagnosticBuilder; use rustc::hir; use rustc::hir::def_id::{DefId, DefIndex}; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; @@ -30,10 +21,19 @@ use syntax_pos::Span; /////////////////////////////////////////////////////////////////////////// // Entry point +// During type inference, partially inferred types are +// represented using Type variables (ty::Infer). These don't appear in +// the final TypeckTables since all of the types should have been +// inferred once typeck_tables_of is done. +// When type inference is running however, having to update the typeck +// tables every time a new type is inferred would be unreasonably slow, +// so instead all of the replacement happens at the end in +// resolve_type_vars_in_body, which creates a new TypeTables which +// doesn't contain any inference types. impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn resolve_type_vars_in_body(&self, body: &'gcx hir::Body) -> &'gcx ty::TypeckTables<'gcx> { - let item_id = self.tcx.hir.body_owner(body.id()); - let item_def_id = self.tcx.hir.local_def_id(item_id); + let item_id = self.tcx.hir().body_owner(body.id()); + let item_def_id = self.tcx.hir().local_def_id(item_id); // This attribute causes us to dump some writeback information // in the form of errors, which is used for unit tests. @@ -44,7 +44,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { wbcx.visit_node_id(arg.pat.span, arg.hir_id); } wbcx.visit_body(body); - wbcx.visit_upvar_borrow_map(); + wbcx.visit_upvar_capture_map(); + wbcx.visit_upvar_list_map(); wbcx.visit_closures(); wbcx.visit_liberated_fn_sigs(); wbcx.visit_fru_field_types(); @@ -99,7 +100,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { body: &'gcx hir::Body, rustc_dump_user_substs: bool, ) -> WritebackCx<'cx, 'gcx, 'tcx> { - let owner = fcx.tcx.hir.definitions().node_to_hir_id(body.id().node_id); + let owner = fcx.tcx.hir().definitions().node_to_hir_id(body.id().node_id); WritebackCx { fcx, @@ -115,7 +116,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { fn write_ty_to_tables(&mut self, hir_id: hir::HirId, ty: Ty<'gcx>) { debug!("write_ty_to_tables({:?}, {:?})", hir_id, ty); - assert!(!ty.needs_infer() && !ty.has_skol()); + assert!(!ty.needs_infer() && !ty.has_placeholders()); self.tables.node_types_mut().insert(hir_id, ty); } @@ -233,7 +234,7 @@ impl<'cx, 'gcx, 'tcx> Visitor<'gcx> for WritebackCx<'cx, 'gcx, 'tcx> { match e.node { hir::ExprKind::Closure(_, _, body, _, _) => { - let body = self.fcx.tcx.hir.body(body); + let body = self.fcx.tcx.hir().body(body); for arg in &body.arguments { self.visit_node_id(e.span, arg.hir_id); } @@ -300,7 +301,7 @@ impl<'cx, 'gcx, 'tcx> Visitor<'gcx> for WritebackCx<'cx, 'gcx, 'tcx> { } impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { - fn visit_upvar_borrow_map(&mut self) { + fn visit_upvar_capture_map(&mut self) { for (upvar_id, upvar_capture) in self.fcx.tables.borrow().upvar_capture_map.iter() { let new_upvar_capture = match *upvar_capture { ty::UpvarCapture::ByValue => ty::UpvarCapture::ByValue, @@ -323,6 +324,21 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { } } + /// Runs through the function context's upvar list map and adds the same to + /// the TypeckTables. upvarlist is a hashmap of the list of upvars referred + /// to in a closure.. + fn visit_upvar_list_map(&mut self) { + for (closure_def_id, upvar_list) in self.fcx.tables.borrow().upvar_list.iter() { + debug!( + "UpvarIDs captured by closure {:?} are: {:?}", + closure_def_id, upvar_list + ); + self.tables + .upvar_list + .insert(*closure_def_id, upvar_list.to_vec()); + } + } + fn visit_closures(&mut self) { let fcx_tables = self.fcx.tables.borrow(); debug_assert_eq!(fcx_tables.local_id_root, self.tables.local_id_root); @@ -367,7 +383,8 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { debug_assert_eq!(fcx_tables.local_id_root, self.tables.local_id_root); let common_local_id_root = fcx_tables.local_id_root.unwrap(); - for (&local_id, c_ty) in fcx_tables.user_provided_tys().iter() { + let mut errors_buffer = Vec::new(); + for (&local_id, c_ty) in fcx_tables.user_provided_types().iter() { let hir_id = hir::HirId { owner: common_local_id_root.index, local_id, @@ -384,8 +401,30 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { }; self.tables - .user_provided_tys_mut() + .user_provided_types_mut() .insert(hir_id, c_ty.clone()); + + if let ty::UserType::TypeOf(_, user_substs) = c_ty.value { + if self.rustc_dump_user_substs { + // This is a unit-testing mechanism. + let node_id = self.tcx().hir().hir_to_node_id(hir_id); + let span = self.tcx().hir().span(node_id); + // We need to buffer the errors in order to guarantee a consistent + // order when emitting them. + let err = self.tcx().sess.struct_span_err( + span, + &format!("user substs: {:?}", user_substs) + ); + err.buffer(&mut errors_buffer); + } + } + } + + if !errors_buffer.is_empty() { + errors_buffer.sort_by_key(|diag| diag.span.primary_span()); + for diag in errors_buffer.drain(..) { + DiagnosticBuilder::new_diagnostic(self.tcx().sess.diagnostic(), diag).emit(); + } } } @@ -398,7 +437,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { c_sig } else { span_bug!( - self.fcx.tcx.hir.span_if_local(def_id).unwrap(), + self.fcx.tcx.hir().span_if_local(def_id).unwrap(), "writeback: `{:?}` missing from the global type context", c_sig ); @@ -412,7 +451,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { fn visit_opaque_types(&mut self, span: Span) { for (&def_id, opaque_defn) in self.fcx.opaque_types.borrow().iter() { - let node_id = self.tcx().hir.as_local_node_id(def_id).unwrap(); + let node_id = self.tcx().hir().as_local_node_id(def_id).unwrap(); let instantiated_ty = self.resolve(&opaque_defn.concrete_ty, &node_id); let generics = self.tcx().generics_of(def_id); @@ -545,7 +584,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { } fn visit_field_id(&mut self, node_id: ast::NodeId) { - let hir_id = self.tcx().hir.node_to_hir_id(node_id); + let hir_id = self.tcx().hir().node_to_hir_id(node_id); if let Some(index) = self.fcx .tables .borrow_mut() @@ -580,25 +619,9 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { if let Some(substs) = self.fcx.tables.borrow().node_substs_opt(hir_id) { let substs = self.resolve(&substs, &span); debug!("write_substs_to_tcx({:?}, {:?})", hir_id, substs); - assert!(!substs.needs_infer() && !substs.has_skol()); + assert!(!substs.needs_infer() && !substs.has_placeholders()); self.tables.node_substs_mut().insert(hir_id, substs); } - - // Copy over any user-substs - if let Some(user_substs) = self.fcx.tables.borrow().user_substs(hir_id) { - let user_substs = self.tcx().lift_to_global(&user_substs).unwrap(); - self.tables.user_substs_mut().insert(hir_id, user_substs); - - // Unit-testing mechanism: - if self.rustc_dump_user_substs { - let node_id = self.tcx().hir.hir_to_node_id(hir_id); - let span = self.tcx().hir.span(node_id); - self.tcx().sess.span_err( - span, - &format!("user substs: {:?}", user_substs), - ); - } - } } fn visit_adjustments(&mut self, span: Span, hir_id: hir::HirId) { @@ -710,21 +733,21 @@ impl Locatable for Span { impl Locatable for ast::NodeId { fn to_span(&self, tcx: &TyCtxt) -> Span { - tcx.hir.span(*self) + tcx.hir().span(*self) } } impl Locatable for DefIndex { fn to_span(&self, tcx: &TyCtxt) -> Span { - let node_id = tcx.hir.def_index_to_node_id(*self); - tcx.hir.span(node_id) + let node_id = tcx.hir().def_index_to_node_id(*self); + tcx.hir().span(node_id) } } impl Locatable for hir::HirId { fn to_span(&self, tcx: &TyCtxt) -> Span { - let node_id = tcx.hir.hir_to_node_id(*self); - tcx.hir.span(node_id) + let node_id = tcx.hir().hir_to_node_id(*self); + tcx.hir().span(node_id) } } diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index 22a96d4e908..a7e19fc4237 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use lint; use rustc::ty::TyCtxt; @@ -25,15 +15,15 @@ use rustc_data_structures::fx::FxHashMap; pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { let mut used_trait_imports = DefIdSet::default(); - for &body_id in tcx.hir.krate().bodies.keys() { - let item_def_id = tcx.hir.body_owner_def_id(body_id); + for &body_id in tcx.hir().krate().bodies.keys() { + let item_def_id = tcx.hir().body_owner_def_id(body_id); let imports = tcx.used_trait_imports(item_def_id); debug!("GatherVisitor: item_def_id={:?} with imports {:#?}", item_def_id, imports); used_trait_imports.extend(imports.iter()); } let mut visitor = CheckVisitor { tcx, used_trait_imports }; - tcx.hir.krate().visit_all_item_likes(&mut visitor); + tcx.hir().krate().visit_all_item_likes(&mut visitor); unused_crates_lint(tcx); } @@ -62,12 +52,12 @@ struct CheckVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx> CheckVisitor<'a, 'tcx> { fn check_import(&self, id: ast::NodeId, span: Span) { - let def_id = self.tcx.hir.local_def_id(id); + let def_id = self.tcx.hir().local_def_id(id); if !self.tcx.maybe_unused_trait_import(def_id) { return; } - let import_def_id = self.tcx.hir.local_def_id(id); + let import_def_id = self.tcx.hir().local_def_id(id); if self.used_trait_imports.contains(&import_def_id) { return; } @@ -105,33 +95,34 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { // Note that if we carry through to the `extern_mod_stmt_cnum` query // below it'll cause a panic because `def_id` is actually bogus at this // point in time otherwise. - if let Some(id) = tcx.hir.as_local_node_id(def_id) { - if tcx.hir.find(id).is_none() { + if let Some(id) = tcx.hir().as_local_node_id(def_id) { + if tcx.hir().find(id).is_none() { return false; } } true }) .filter(|&&(def_id, _)| { - let cnum = tcx.extern_mod_stmt_cnum(def_id).unwrap(); - !tcx.is_compiler_builtins(cnum) - && !tcx.is_panic_runtime(cnum) - && !tcx.has_global_allocator(cnum) - && !tcx.has_panic_handler(cnum) + tcx.extern_mod_stmt_cnum(def_id).map_or(true, |cnum| { + !tcx.is_compiler_builtins(cnum) && + !tcx.is_panic_runtime(cnum) && + !tcx.has_global_allocator(cnum) && + !tcx.has_panic_handler(cnum) + }) }) .cloned() .collect(); // Collect all the extern crates (in a reliable order). let mut crates_to_lint = vec![]; - tcx.hir.krate().visit_all_item_likes(&mut CollectExternCrateVisitor { + tcx.hir().krate().visit_all_item_likes(&mut CollectExternCrateVisitor { tcx, crates_to_lint: &mut crates_to_lint, }); for extern_crate in &crates_to_lint { - let id = tcx.hir.as_local_node_id(extern_crate.def_id).unwrap(); - let item = tcx.hir.expect_item(id); + let id = tcx.hir().as_local_node_id(extern_crate.def_id).unwrap(); + let item = tcx.hir().expect_item(id); // If the crate is fully unused, we suggest removing it altogether. // We do this in any edition. @@ -145,7 +136,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { .fold(span, |acc, attr_span| acc.to(attr_span)); tcx.struct_span_lint_node(lint, id, span, msg) - .span_suggestion_short_with_applicability( + .span_suggestion_short( span_with_attrs, "remove it", String::new(), @@ -163,7 +154,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { // If the extern crate isn't in the extern prelude, // there is no way it can be written as an `use`. - let orig_name = extern_crate.orig_name.unwrap_or(item.name); + let orig_name = extern_crate.orig_name.unwrap_or(item.ident.name); if !tcx.extern_prelude.get(&orig_name).map_or(false, |from_item| !from_item) { continue; } @@ -182,12 +173,12 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { visibility_qualified(&item.vis, "use") ); let base_replacement = match extern_crate.orig_name { - Some(orig_name) => format!("use {} as {};", orig_name, item.name), - None => format!("use {};", item.name), + Some(orig_name) => format!("use {} as {};", orig_name, item.ident.name), + None => format!("use {};", item.ident.name), }; - let replacement = visibility_qualified(&item.vis, &base_replacement); + let replacement = visibility_qualified(&item.vis, base_replacement); tcx.struct_span_lint_node(lint, id, extern_crate.span, msg) - .span_suggestion_short_with_applicability( + .span_suggestion_short( extern_crate.span, &help, replacement, @@ -222,13 +213,13 @@ struct ExternCrateToLint { impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CollectExternCrateVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { if let hir::ItemKind::ExternCrate(orig_name) = item.node { - let extern_crate_def_id = self.tcx.hir.local_def_id(item.id); + let extern_crate_def_id = self.tcx.hir().local_def_id(item.id); self.crates_to_lint.push( ExternCrateToLint { def_id: extern_crate_def_id, span: item.span, orig_name, - warn_if_unused: !item.name.as_str().starts_with('_'), + warn_if_unused: !item.ident.as_str().starts_with('_'), } ); } diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index a5ad31e0b6b..bd2373d1659 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Check properties that are required by built-in traits and set //! up data structures required by type-checking/codegen. @@ -46,8 +36,8 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { where F: FnMut(TyCtxt<'a, 'tcx, 'tcx>, DefId) { if Some(self.trait_def_id) == trait_def_id { - for &impl_id in self.tcx.hir.trait_impls(self.trait_def_id) { - let impl_def_id = self.tcx.hir.local_def_id(impl_id); + for &impl_id in self.tcx.hir().trait_impls(self.trait_def_id) { + let impl_def_id = self.tcx.hir().local_def_id(impl_id); f(self.tcx, impl_def_id); } } @@ -60,8 +50,8 @@ fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: /* do nothing */ } else { // Destructors only work on nominal types. - if let Some(impl_node_id) = tcx.hir.as_local_node_id(impl_did) { - if let Some(Node::Item(item)) = tcx.hir.find(impl_node_id) { + if let Some(impl_node_id) = tcx.hir().as_local_node_id(impl_did) { + if let Some(Node::Item(item)) = tcx.hir().find(impl_node_id) { let span = match item.node { ItemKind::Impl(.., ref ty, _) => ty.span, _ => item.span, @@ -86,7 +76,7 @@ fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) { debug!("visit_implementation_of_copy: impl_did={:?}", impl_did); - let impl_node_id = if let Some(n) = tcx.hir.as_local_node_id(impl_did) { + let impl_node_id = if let Some(n) = tcx.hir().as_local_node_id(impl_did) { n } else { debug!("visit_implementation_of_copy(): impl not in this crate"); @@ -97,7 +87,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: debug!("visit_implementation_of_copy: self_type={:?} (bound)", self_type); - let span = tcx.hir.span(impl_node_id); + let span = tcx.hir().span(impl_node_id); let param_env = tcx.param_env(impl_did); assert!(!self_type.has_escaping_bound_vars()); @@ -107,7 +97,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: match param_env.can_type_implement_copy(tcx, self_type) { Ok(()) => {} Err(CopyImplementationError::InfrigingFields(fields)) => { - let item = tcx.hir.expect_item(impl_node_id); + let item = tcx.hir().expect_item(impl_node_id); let span = if let ItemKind::Impl(.., Some(ref tr), _, _) = item.node { tr.path.span } else { @@ -124,7 +114,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: err.emit() } Err(CopyImplementationError::NotAnAdt) => { - let item = tcx.hir.expect_item(impl_node_id); + let item = tcx.hir().expect_item(impl_node_id); let span = if let ItemKind::Impl(.., ref ty, _) = item.node { ty.span } else { @@ -172,8 +162,8 @@ fn visit_implementation_of_dispatch_from_dyn<'a, 'tcx>( if impl_did.is_local() { let dispatch_from_dyn_trait = tcx.lang_items().dispatch_from_dyn_trait().unwrap(); - let impl_node_id = tcx.hir.as_local_node_id(impl_did).unwrap(); - let span = tcx.hir.span(impl_node_id); + let impl_node_id = tcx.hir().as_local_node_id(impl_did).unwrap(); + let span = tcx.hir().span(impl_node_id); let source = tcx.type_of(impl_did); assert!(!source.has_escaping_bound_vars()); @@ -342,7 +332,7 @@ pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>, }); // this provider should only get invoked for local def-ids - let impl_node_id = gcx.hir.as_local_node_id(impl_did).unwrap_or_else(|| { + let impl_node_id = gcx.hir().as_local_node_id(impl_did).unwrap_or_else(|| { bug!("coerce_unsized_info: invoked for non-local def-id {:?}", impl_did) }); @@ -354,7 +344,7 @@ pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>, source, target); - let span = gcx.hir.span(impl_node_id); + let span = gcx.hir().span(impl_node_id); let param_env = gcx.param_env(impl_did); assert!(!source.has_escaping_bound_vars()); @@ -469,7 +459,7 @@ pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>, // variance where possible. (This is because // we may have to evaluate constraint // expressions in the course of execution.) - // See e.g. #41936. + // See e.g., #41936. if let Ok(ok) = infcx.at(&cause, param_env).eq(a, b) { if ok.obligations.is_empty() { return None; @@ -477,7 +467,7 @@ pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>, } // Collect up all fields that were significantly changed - // i.e. those that contain T in coerce_unsized T -> U + // i.e., those that contain T in coerce_unsized T -> U Some((i, a, b)) }) .collect::>(); @@ -491,11 +481,11 @@ pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>, being coerced, none found"); return err_info; } else if diff_fields.len() > 1 { - let item = gcx.hir.expect_item(impl_node_id); + let item = gcx.hir().expect_item(impl_node_id); let span = if let ItemKind::Impl(.., Some(ref t), _, _) = item.node { t.path.span } else { - gcx.hir.span(impl_node_id) + gcx.hir().span(impl_node_id) }; let mut err = struct_span_err!(gcx.sess, diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index d9dff144129..93cc86423ac 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The code in this module gathers up all of the inherent impls in //! the current crate and organizes them in a map. It winds up //! touching the whole crate and thus must be recomputed completely @@ -33,7 +23,7 @@ pub fn crate_inherent_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, -> Lrc { assert_eq!(crate_num, LOCAL_CRATE); - let krate = tcx.hir.krate(); + let krate = tcx.hir().krate(); let mut collect = InherentCollect { tcx, impls_map: Default::default(), @@ -95,7 +85,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> { _ => return }; - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); let self_ty = self.tcx.type_of(def_id); let lang_items = self.tcx.lang_items(); match self_ty.sty { @@ -105,8 +95,8 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> { ty::Foreign(did) => { self.check_def_id(item, did); } - ty::Dynamic(ref data, ..) => { - self.check_def_id(item, data.principal().def_id()); + ty::Dynamic(ref data, ..) if data.principal_def_id().is_some() => { + self.check_def_id(item, data.principal_def_id().unwrap()); } ty::Char => { self.check_primitive_impl(def_id, @@ -298,7 +288,7 @@ impl<'a, 'tcx> InherentCollect<'a, 'tcx> { // Add the implementation to the mapping from implementation to base // type def ID, if there is a base type for this implementation and // the implementation does not have any associated traits. - let impl_def_id = self.tcx.hir.local_def_id(item.id); + let impl_def_id = self.tcx.hir().local_def_id(item.id); let mut rc_vec = self.impls_map.inherent_impls .entry(def_id) .or_default(); diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs index c0260d6714d..52dee29294c 100644 --- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs +++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use namespace::Namespace; use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; use rustc::hir; @@ -20,7 +10,7 @@ use lint; pub fn crate_inherent_impls_overlap_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) { assert_eq!(crate_num, LOCAL_CRATE); - let krate = tcx.hir.krate(); + let krate = tcx.hir().krate(); krate.visit_all_item_likes(&mut InherentOverlapChecker { tcx }); } @@ -46,7 +36,7 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> { for &item2 in &impl_items2[..] { if (name, namespace) == name_and_namespace(item2) { - let node_id = self.tcx.hir.as_local_node_id(impl1); + let node_id = self.tcx.hir().as_local_node_id(impl1); let mut err = if used_to_be_allowed && node_id.is_some() { self.tcx.struct_span_lint_node( lint::builtin::INCOHERENT_FUNDAMENTAL_IMPLS, @@ -71,6 +61,10 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> { cause.add_intercrate_ambiguity_hint(&mut err); } + if overlap.involves_placeholder { + traits::add_placeholder_note(&mut err); + } + err.emit(); } } @@ -126,7 +120,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentOverlapChecker<'a, 'tcx> { hir::ItemKind::Struct(..) | hir::ItemKind::Trait(..) | hir::ItemKind::Union(..) => { - let type_def_id = self.tcx.hir.local_def_id(item.id); + let type_def_id = self.tcx.hir().local_def_id(item.id); self.check_for_overlapping_inherent_impls(type_def_id); } _ => {} diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 9b17654d469..8053ed130e9 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Coherence phase // // The job of the coherence phase of typechecking is to ensure that @@ -29,7 +19,7 @@ mod orphan; mod unsafety; fn check_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, node_id: ast::NodeId) { - let impl_def_id = tcx.hir.local_def_id(node_id); + let impl_def_id = tcx.hir().local_def_id(node_id); // If there are no traits, then this implementation must have a // base type. @@ -40,7 +30,7 @@ fn check_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, node_id: ast::NodeId) { tcx.item_path_str(impl_def_id)); // Skip impls where one of the self type is an error type. - // This occurs with e.g. resolve failures (#30589). + // This occurs with e.g., resolve failures (#30589). if trait_ref.references_error() { return; } @@ -135,7 +125,7 @@ pub fn provide(providers: &mut Providers) { } fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { - let impls = tcx.hir.trait_impls(def_id); + let impls = tcx.hir().trait_impls(def_id); for &impl_id in impls { check_impl(tcx, impl_id); } @@ -146,7 +136,7 @@ fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { } pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &trait_def_id in tcx.hir.krate().trait_impls.keys() { + for &trait_def_id in tcx.hir().krate().trait_impls.keys() { ty::query::queries::coherent_trait::ensure(tcx, trait_def_id); } @@ -162,7 +152,7 @@ pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { /// same type. Likewise, no two inherent impls for a given type /// constructor provide a method with the same name. fn check_impl_overlap<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, node_id: ast::NodeId) { - let impl_def_id = tcx.hir.local_def_id(node_id); + let impl_def_id = tcx.hir().local_def_id(node_id); let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); let trait_def_id = trait_ref.def_id; @@ -181,24 +171,36 @@ fn check_impl_overlap<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, node_id: ast::NodeI // This is something like impl Trait1 for Trait2. Illegal // if Trait1 is a supertrait of Trait2 or Trait2 is not object safe. - if !tcx.is_object_safe(data.principal().def_id()) { - // This is an error, but it will be reported by wfcheck. Ignore it here. - // This is tested by `coherence-impl-trait-for-trait-object-safe.rs`. - } else { - let mut supertrait_def_ids = - traits::supertrait_def_ids(tcx, data.principal().def_id()); - if supertrait_def_ids.any(|d| d == trait_def_id) { - let sp = tcx.sess.source_map().def_span(tcx.span_of_impl(impl_def_id).unwrap()); - struct_span_err!(tcx.sess, - sp, - E0371, - "the object type `{}` automatically implements the trait `{}`", - trait_ref.self_ty(), - tcx.item_path_str(trait_def_id)) - .span_label(sp, format!("`{}` automatically implements trait `{}`", - trait_ref.self_ty(), - tcx.item_path_str(trait_def_id))) - .emit(); + let component_def_ids = data.iter().flat_map(|predicate| { + match predicate.skip_binder() { + ty::ExistentialPredicate::Trait(tr) => Some(tr.def_id), + ty::ExistentialPredicate::AutoTrait(def_id) => Some(*def_id), + // An associated type projection necessarily comes with + // an additional `Trait` requirement. + ty::ExistentialPredicate::Projection(..) => None, + } + }); + + for component_def_id in component_def_ids { + if !tcx.is_object_safe(component_def_id) { + // This is an error, but it will be reported by wfcheck. Ignore it here. + // This is tested by `coherence-impl-trait-for-trait-object-safe.rs`. + } else { + let mut supertrait_def_ids = + traits::supertrait_def_ids(tcx, component_def_id); + if supertrait_def_ids.any(|d| d == trait_def_id) { + let sp = tcx.sess.source_map().def_span(tcx.span_of_impl(impl_def_id).unwrap()); + struct_span_err!(tcx.sess, + sp, + E0371, + "the object type `{}` automatically implements the trait `{}`", + trait_ref.self_ty(), + tcx.item_path_str(trait_def_id)) + .span_label(sp, format!("`{}` automatically implements trait `{}`", + trait_ref.self_ty(), + tcx.item_path_str(trait_def_id))) + .emit(); + } } } } diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index 14c6864434f..2df137c3f50 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Orphan checker: every impl either implements a trait defined in this //! crate or pertains to a type defined in this crate. @@ -18,7 +8,7 @@ use rustc::hir; pub fn check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { let mut orphan = OrphanChecker { tcx }; - tcx.hir.krate().visit_all_item_likes(&mut orphan); + tcx.hir().krate().visit_all_item_likes(&mut orphan); } struct OrphanChecker<'cx, 'tcx: 'cx> { @@ -32,11 +22,11 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> { /// to prevent inundating the user with a bunch of similar error /// reports. fn visit_item(&mut self, item: &hir::Item) { - let def_id = self.tcx.hir.local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id(item.id); // "Trait" impl if let hir::ItemKind::Impl(.., Some(_), _, _) = item.node { debug!("coherence2::orphan check: trait impl {}", - self.tcx.hir.node_to_string(item.id)); + self.tcx.hir().node_to_string(item.id)); let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap(); let trait_def_id = trait_ref.def_id; let cm = self.tcx.sess.source_map(); @@ -50,7 +40,7 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> { "only traits defined in the current crate can be \ implemented for arbitrary types") .span_label(sp, "impl doesn't use types inside crate") - .note("the impl does not reference any types defined in this crate") + .note("the impl does not reference only types defined in this crate") .note("define and implement a trait or new type instead") .emit(); return; @@ -60,7 +50,7 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> { sp, E0210, "type parameter `{}` must be used as the type parameter \ - for some local type (e.g. `MyStruct<{}>`)", + for some local type (e.g., `MyStruct<{}>`)", param_ty, param_ty) .span_label(sp, diff --git a/src/librustc_typeck/coherence/unsafety.rs b/src/librustc_typeck/coherence/unsafety.rs index 0894c1d49e8..81ef4de3d80 100644 --- a/src/librustc_typeck/coherence/unsafety.rs +++ b/src/librustc_typeck/coherence/unsafety.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Unsafety checker: every impl either implements a trait defined in this //! crate or pertains to a type defined in this crate. @@ -17,7 +7,7 @@ use rustc::hir::{self, Unsafety}; pub fn check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { let mut unsafety = UnsafetyChecker { tcx }; - tcx.hir.krate().visit_all_item_likes(&mut unsafety); + tcx.hir().krate().visit_all_item_likes(&mut unsafety); } struct UnsafetyChecker<'cx, 'tcx: 'cx> { @@ -31,7 +21,7 @@ impl<'cx, 'tcx, 'v> UnsafetyChecker<'cx, 'tcx> { unsafety: hir::Unsafety, polarity: hir::ImplPolarity) { - if let Some(trait_ref) = self.tcx.impl_trait_ref(self.tcx.hir.local_def_id(item.id)) { + if let Some(trait_ref) = self.tcx.impl_trait_ref(self.tcx.hir().local_def_id(item.id)) { let trait_def = self.tcx.trait_def(trait_ref.def_id); let unsafe_attr = impl_generics.and_then(|generics| { generics.params.iter().find(|p| p.pure_wrt_drop).map(|_| "may_dangle") diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index f3c570e8400..4275022c4f6 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! "Collection" is the process of determining the type and other external //! details of each item in Rust. Collection is specifically concerned //! with *interprocedural* things -- for example, for a function @@ -26,12 +16,14 @@ use astconv::{AstConv, Bounds}; use constrained_type_params as ctp; +use check::intrinsic::intrisic_operation_unsafety; use lint; use middle::lang_items::SizedTraitLangItem; use middle::resolve_lifetime as rl; use middle::weak_lang_items; use rustc::mir::mono::Linkage; use rustc::ty::query::Providers; +use rustc::ty::query::queries; use rustc::ty::subst::Substs; use rustc::ty::util::Discr; use rustc::ty::util::IntTypeExt; @@ -43,8 +35,8 @@ use rustc_data_structures::sync::Lrc; use rustc_target::spec::abi; use syntax::ast; -use syntax::ast::MetaItemKind; -use syntax::attr::{InlineAttr, list_contains_name, mark_used}; +use syntax::ast::{Ident, MetaItemKind}; +use syntax::attr::{InlineAttr, OptimizeAttr, list_contains_name, mark_used}; use syntax::source_map::Spanned; use syntax::feature_gate; use syntax::symbol::{keywords, Symbol}; @@ -65,10 +57,16 @@ struct OnlySelfBounds(bool); // Main entry point pub fn collect_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - let mut visitor = CollectItemTypesVisitor { tcx }; - tcx.hir - .krate() - .visit_all_item_likes(&mut visitor.as_deep_visitor()); + for &module in tcx.hir().krate().modules.keys() { + queries::collect_mod_item_types::ensure(tcx, tcx.hir().local_def_id(module)); + } +} + +fn collect_mod_item_types<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { + tcx.hir().visit_item_likes_in_module( + module_def_id, + &mut CollectItemTypesVisitor { tcx }.as_deep_visitor() + ); } pub fn provide(providers: &mut Providers) { @@ -87,6 +85,7 @@ pub fn provide(providers: &mut Providers) { impl_polarity, is_foreign_item, codegen_fn_attrs, + collect_mod_item_types, ..*providers }; } @@ -97,7 +96,7 @@ pub fn provide(providers: &mut Providers) { /// AstConv. It has information about the predicates that are defined /// on the trait. Unfortunately, this predicate information is /// available in various different forms at various points in the -/// process. So we can't just store a pointer to e.g. the AST or the +/// process. So we can't just store a pointer to e.g., the AST or the /// parsed ty form, we have to be more flexible. To this end, the /// `ItemCtxt` is parameterized by a `DefId` that it uses to satisfy /// `get_type_parameter_bounds` requests, drawing the information from @@ -115,7 +114,7 @@ struct CollectItemTypesVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { - NestedVisitorMap::OnlyBodies(&self.tcx.hir) + NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } fn visit_item(&mut self, item: &'tcx hir::Item) { @@ -130,7 +129,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { hir::GenericParamKind::Type { default: Some(_), .. } => { - let def_id = self.tcx.hir.local_def_id(param.id); + let def_id = self.tcx.hir().local_def_id(param.id); self.tcx.type_of(def_id); } hir::GenericParamKind::Type { .. } => {} @@ -141,7 +140,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { fn visit_expr(&mut self, expr: &'tcx hir::Expr) { if let hir::ExprKind::Closure(..) = expr.node { - let def_id = self.tcx.hir.local_def_id(expr.id); + let def_id = self.tcx.hir().local_def_id(expr.id); self.tcx.generics_of(def_id); self.tcx.type_of(def_id); } @@ -252,12 +251,12 @@ fn type_param_predicates<'a, 'tcx>( // written inline like `` or in a where clause like // `where T : Foo`. - let param_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let param_owner = tcx.hir.ty_param_owner(param_id); - let param_owner_def_id = tcx.hir.local_def_id(param_owner); + let param_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let param_owner = tcx.hir().ty_param_owner(param_id); + let param_owner_def_id = tcx.hir().local_def_id(param_owner); let generics = tcx.generics_of(param_owner_def_id); let index = generics.param_def_id_to_index[&def_id]; - let ty = tcx.mk_ty_param(index, tcx.hir.ty_param_name(param_id).as_interned_str()); + let ty = tcx.mk_ty_param(index, tcx.hir().ty_param_name(param_id).as_interned_str()); // Don't look for bounds where the type parameter isn't in scope. let parent = if item_def_id == param_owner_def_id { @@ -277,8 +276,8 @@ fn type_param_predicates<'a, 'tcx>( }, ); - let item_node_id = tcx.hir.as_local_node_id(item_def_id).unwrap(); - let ast_generics = match tcx.hir.get(item_node_id) { + let item_node_id = tcx.hir().as_local_node_id(item_def_id).unwrap(); + let ast_generics = match tcx.hir().get(item_node_id) { Node::TraitItem(item) => &item.generics, Node::ImplItem(item) => &item.generics, @@ -384,7 +383,7 @@ fn is_param<'a, 'tcx>( if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node { match path.def { Def::SelfTy(Some(def_id), None) | Def::TyParam(def_id) => { - def_id == tcx.hir.local_def_id(param_id) + def_id == tcx.hir().local_def_id(param_id) } _ => false, } @@ -394,9 +393,9 @@ fn is_param<'a, 'tcx>( } fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { - let it = tcx.hir.expect_item(item_id); - debug!("convert: item {} with id {}", it.name, it.id); - let def_id = tcx.hir.local_def_id(item_id); + let it = tcx.hir().expect_item(item_id); + debug!("convert: item {} with id {}", it.ident, it.id); + let def_id = tcx.hir().local_def_id(item_id); match it.node { // These don't define types. hir::ItemKind::ExternCrate(_) @@ -405,7 +404,7 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { | hir::ItemKind::GlobalAsm(_) => {} hir::ItemKind::ForeignMod(ref foreign_mod) => { for item in &foreign_mod.items { - let def_id = tcx.hir.local_def_id(item.id); + let def_id = tcx.hir().local_def_id(item.id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); @@ -443,7 +442,7 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { tcx.predicates_of(def_id); for f in struct_def.fields() { - let def_id = tcx.hir.local_def_id(f.id); + let def_id = tcx.hir().local_def_id(f.id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); @@ -476,8 +475,8 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { } fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_id: ast::NodeId) { - let trait_item = tcx.hir.expect_trait_item(trait_item_id); - let def_id = tcx.hir.local_def_id(trait_item.id); + let trait_item = tcx.hir().expect_trait_item(trait_item_id); + let def_id = tcx.hir().local_def_id(trait_item.id); tcx.generics_of(def_id); match trait_item.node { @@ -497,17 +496,17 @@ fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_id: ast: } fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item_id: ast::NodeId) { - let def_id = tcx.hir.local_def_id(impl_item_id); + let def_id = tcx.hir().local_def_id(impl_item_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); - if let hir::ImplItemKind::Method(..) = tcx.hir.expect_impl_item(impl_item_id).node { + if let hir::ImplItemKind::Method(..) = tcx.hir().expect_impl_item(impl_item_id).node { tcx.fn_sig(def_id); } } fn convert_variant_ctor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ctor_id: ast::NodeId) { - let def_id = tcx.hir.local_def_id(ctor_id); + let def_id = tcx.hir().local_def_id(ctor_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); @@ -528,7 +527,7 @@ fn convert_enum_variant_types<'a, 'tcx>( let wrapped_discr = prev_discr.map_or(initial, |d| d.wrap_incr(tcx)); prev_discr = Some( if let Some(ref e) = variant.node.disr_expr { - let expr_did = tcx.hir.local_def_id(e.id); + let expr_did = tcx.hir().local_def_id(e.id); def.eval_explicit_discr(tcx, expr_did) } else if let Some(discr) = repr_type.disr_incr(tcx, prev_discr) { Some(discr) @@ -543,7 +542,7 @@ fn convert_enum_variant_types<'a, 'tcx>( format!("overflowed on value after {}", prev_discr.unwrap()), ).note(&format!( "explicitly set `{} = {}` if that is desired outcome", - variant.node.name, wrapped_discr + variant.node.ident, wrapped_discr )) .emit(); None @@ -551,7 +550,7 @@ fn convert_enum_variant_types<'a, 'tcx>( ); for f in variant.node.data.fields() { - let def_id = tcx.hir.local_def_id(f.id); + let def_id = tcx.hir().local_def_id(f.id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); @@ -566,19 +565,19 @@ fn convert_enum_variant_types<'a, 'tcx>( fn convert_variant<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, did: DefId, - name: ast::Name, + ident: Ident, discr: ty::VariantDiscr, def: &hir::VariantData, adt_kind: ty::AdtKind, attribute_def_id: DefId ) -> ty::VariantDef { let mut seen_fields: FxHashMap = Default::default(); - let node_id = tcx.hir.as_local_node_id(did).unwrap(); + let node_id = tcx.hir().as_local_node_id(did).unwrap(); let fields = def .fields() .iter() .map(|f| { - let fid = tcx.hir.local_def_id(f.id); + let fid = tcx.hir().local_def_id(f.id); let dup_span = seen_fields.get(&f.ident.modern()).cloned(); if let Some(prev_span) = dup_span { struct_span_err!( @@ -603,19 +602,20 @@ fn convert_variant<'a, 'tcx>( .collect(); ty::VariantDef::new(tcx, did, - name, + ident, discr, fields, adt_kind, CtorKind::from_hir(def), - attribute_def_id) + attribute_def_id + ) } fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtDef { use rustc::hir::*; - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let item = match tcx.hir.get(node_id) { + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let item = match tcx.hir().get(node_id) { Node::Item(item) => item, _ => bug!(), }; @@ -629,16 +629,16 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad def.variants .iter() .map(|v| { - let did = tcx.hir.local_def_id(v.node.data.id()); + let did = tcx.hir().local_def_id(v.node.data.id()); let discr = if let Some(ref e) = v.node.disr_expr { distance_from_explicit = 0; - ty::VariantDiscr::Explicit(tcx.hir.local_def_id(e.id)) + ty::VariantDiscr::Explicit(tcx.hir().local_def_id(e.id)) } else { ty::VariantDiscr::Relative(distance_from_explicit) }; distance_from_explicit += 1; - convert_variant(tcx, did, v.node.name, discr, &v.node.data, AdtKind::Enum, + convert_variant(tcx, did, v.node.ident, discr, &v.node.data, AdtKind::Enum, did) }) .collect(), @@ -647,7 +647,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad ItemKind::Struct(ref def, _) => { // Use separate constructor id for unit/tuple structs and reuse did for braced structs. let ctor_id = if !def.is_struct() { - Some(tcx.hir.local_def_id(def.id())) + Some(tcx.hir().local_def_id(def.id())) } else { None }; @@ -656,7 +656,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad std::iter::once(convert_variant( tcx, ctor_id.unwrap_or(def_id), - item.name, + item.ident, ty::VariantDiscr::Relative(0), def, AdtKind::Struct, @@ -669,7 +669,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad std::iter::once(convert_variant( tcx, def_id, - item.name, + item.ident, ty::VariantDiscr::Relative(0), def, AdtKind::Union, @@ -689,9 +689,9 @@ fn super_predicates_of<'a, 'tcx>( trait_def_id: DefId, ) -> Lrc> { debug!("super_predicates(trait_def_id={:?})", trait_def_id); - let trait_node_id = tcx.hir.as_local_node_id(trait_def_id).unwrap(); + let trait_node_id = tcx.hir().as_local_node_id(trait_def_id).unwrap(); - let item = match tcx.hir.get(trait_node_id) { + let item = match tcx.hir().get(trait_node_id) { Node::Item(item) => item, _ => bug!("trait_node_id {} is not an item", trait_node_id), }; @@ -704,18 +704,18 @@ fn super_predicates_of<'a, 'tcx>( let icx = ItemCtxt::new(tcx, trait_def_id); - // Convert the bounds that follow the colon, e.g. `Bar + Zed` in `trait Foo : Bar + Zed`. + // Convert the bounds that follow the colon, e.g., `Bar + Zed` in `trait Foo : Bar + Zed`. let self_param_ty = tcx.mk_self_type(); let superbounds1 = compute_bounds(&icx, self_param_ty, bounds, SizedByDefault::No, item.span); let superbounds1 = superbounds1.predicates(tcx, self_param_ty); // Convert any explicit superbounds in the where clause, - // e.g. `trait Foo where Self : Bar`. + // e.g., `trait Foo where Self : Bar`. // In the case of trait aliases, however, we include all bounds in the where clause, - // so e.g. `trait Foo = where u32: PartialEq` would include `u32: PartialEq` + // so e.g., `trait Foo = where u32: PartialEq` would include `u32: PartialEq` // as one of its "superpredicates". - let is_trait_alias = ty::is_trait_alias(tcx, trait_def_id); + let is_trait_alias = tcx.is_trait_alias(trait_def_id); let superbounds2 = icx.type_parameter_bounds_in_generics( generics, item.id, self_param_ty, OnlySelfBounds(!is_trait_alias)); @@ -738,8 +738,8 @@ fn super_predicates_of<'a, 'tcx>( } fn trait_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TraitDef { - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let item = tcx.hir.expect_item(node_id); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let item = tcx.hir().expect_item(node_id); let (is_auto, unsafety) = match item.node { hir::ItemKind::Trait(is_auto, unsafety, ..) => (is_auto == hir::IsAuto::Yes, unsafety), @@ -815,7 +815,7 @@ fn has_late_bound_regions<'a, 'tcx>( return; } - let hir_id = self.tcx.hir.node_to_hir_id(lt.id); + let hir_id = self.tcx.hir().node_to_hir_id(lt.id); match self.tcx.named_region(hir_id) { Some(rl::Region::Static) | Some(rl::Region::EarlyBound(..)) => {} Some(rl::Region::LateBound(debruijn, _, _)) @@ -842,7 +842,7 @@ fn has_late_bound_regions<'a, 'tcx>( }; for param in &generics.params { if let GenericParamKind::Lifetime { .. } = param.kind { - let hir_id = tcx.hir.node_to_hir_id(param.id); + let hir_id = tcx.hir().node_to_hir_id(param.id); if tcx.is_late_bound(hir_id) { return Some(param.span); } @@ -884,14 +884,14 @@ fn has_late_bound_regions<'a, 'tcx>( fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Generics { use rustc::hir::*; - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let node = tcx.hir.get(node_id); + let node = tcx.hir().get(node_id); let parent_def_id = match node { Node::ImplItem(_) | Node::TraitItem(_) | Node::Variant(_) | Node::StructCtor(_) | Node::Field(_) => { - let parent_id = tcx.hir.get_parent(node_id); - Some(tcx.hir.local_def_id(parent_id)) + let parent_id = tcx.hir().get_parent(node_id); + Some(tcx.hir().local_def_id(parent_id)) } Node::Expr(&hir::Expr { node: hir::ExprKind::Closure(..), @@ -938,8 +938,8 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty opt_self = Some(ty::GenericParamDef { index: 0, - name: keywords::SelfType.name().as_interned_str(), - def_id: tcx.hir.local_def_id(param_id), + name: keywords::SelfUpper.name().as_interned_str(), + def_id: tcx.hir().local_def_id(param_id), pure_wrt_drop: false, kind: ty::GenericParamDefKind::Type { has_default: false, @@ -985,13 +985,13 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty .map(|(i, param)| ty::GenericParamDef { name: param.name.ident().as_interned_str(), index: own_start + i as u32, - def_id: tcx.hir.local_def_id(param.id), + def_id: tcx.hir().local_def_id(param.id), pure_wrt_drop: param.pure_wrt_drop, kind: ty::GenericParamDefKind::Lifetime, }), ); - let hir_id = tcx.hir.node_to_hir_id(node_id); + let hir_id = tcx.hir().node_to_hir_id(node_id); let object_lifetime_defaults = tcx.object_lifetime_defaults(hir_id); // Now create the real type parameters. @@ -1007,7 +1007,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty synthetic, .. } => { - if param.name.ident().name == keywords::SelfType.name() { + if param.name.ident().name == keywords::SelfUpper.name() { span_bug!( param.span, "`Self` should not be the name of a regular parameter" @@ -1031,7 +1031,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty let ty_param = ty::GenericParamDef { index: type_start + i as u32, name: param.name.ident().as_interned_str(), - def_id: tcx.hir.local_def_id(param.id), + def_id: tcx.hir().local_def_id(param.id), pure_wrt_drop: param.pure_wrt_drop, kind: ty::GenericParamDefKind::Type { has_default: default.is_some(), @@ -1116,18 +1116,18 @@ fn report_assoc_ty_on_inherent_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: tcx.sess, span, E0202, - "associated types are not allowed in inherent impls" + "associated types are not yet supported in inherent impls (see #8995)" ); } fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { use rustc::hir::*; - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); let icx = ItemCtxt::new(tcx, def_id); - match tcx.hir.get(node_id) { + match tcx.hir().get(node_id) { Node::TraitItem(item) => match item.node { TraitItemKind::Method(..) => { let substs = Substs::identity_for_item(tcx, def_id); @@ -1147,7 +1147,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { ImplItemKind::Const(ref ty, _) => icx.to_ty(ty), ImplItemKind::Existential(_) => { if tcx - .impl_trait_ref(tcx.hir.get_parent_did(node_id)) + .impl_trait_ref(tcx.hir().get_parent_did(node_id)) .is_none() { report_assoc_ty_on_inherent_impl(tcx, item.span); @@ -1157,7 +1157,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { } ImplItemKind::Type(ref ty) => { if tcx - .impl_trait_ref(tcx.hir.get_parent_did(node_id)) + .impl_trait_ref(tcx.hir().get_parent_did(node_id)) .is_none() { report_assoc_ty_on_inherent_impl(tcx, item.span); @@ -1240,7 +1240,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { .. }) => match *def { VariantData::Unit(..) | VariantData::Struct(..) => { - tcx.type_of(tcx.hir.get_parent_did(node_id)) + tcx.type_of(tcx.hir().get_parent_did(node_id)) } VariantData::Tuple(..) => { let substs = Substs::identity_for_item(tcx, def_id); @@ -1255,7 +1255,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { .. }) => { if gen.is_some() { - let hir_id = tcx.hir.node_to_hir_id(node_id); + let hir_id = tcx.hir().node_to_hir_id(node_id); return tcx.typeck_tables_of(def_id).node_id_to_type(hir_id); } @@ -1266,7 +1266,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_closure(def_id, substs) } - Node::AnonConst(_) => match tcx.hir.get(tcx.hir.get_parent_node(node_id)) { + Node::AnonConst(_) => match tcx.hir().get(tcx.hir().get_parent_node(node_id)) { Node::Ty(&hir::Ty { node: hir::TyKind::Array(_, ref constant), .. @@ -1292,7 +1292,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { .. }) if e.id == node_id => { - tcx.adt_def(tcx.hir.get_parent_did(node_id)) + tcx.adt_def(tcx.hir().get_parent_did(node_id)) .repr .discr_type() .to_ty(tcx) @@ -1303,12 +1303,12 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { } }, - Node::GenericParam(param) => match param.kind { + Node::GenericParam(param) => match ¶m.kind { hir::GenericParamKind::Type { default: Some(ref ty), .. } => icx.to_ty(ty), - _ => bug!("unexpected non-type NodeGenericParam"), + x => bug!("unexpected non-type Node::GenericParam: {:?}", x), }, x => { @@ -1365,10 +1365,10 @@ fn find_existential_constraints<'a, 'tcx>( impl<'a, 'tcx> intravisit::Visitor<'tcx> for ConstraintLocator<'a, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'tcx> { - intravisit::NestedVisitorMap::All(&self.tcx.hir) + intravisit::NestedVisitorMap::All(&self.tcx.hir()) } fn visit_item(&mut self, it: &'tcx Item) { - let def_id = self.tcx.hir.local_def_id(it.id); + let def_id = self.tcx.hir().local_def_id(it.id); // the existential type itself or its children are not within its reveal scope if def_id != self.def_id { self.check(def_id); @@ -1376,7 +1376,7 @@ fn find_existential_constraints<'a, 'tcx>( } } fn visit_impl_item(&mut self, it: &'tcx ImplItem) { - let def_id = self.tcx.hir.local_def_id(it.id); + let def_id = self.tcx.hir().local_def_id(it.id); // the existential type itself or its children are not within its reveal scope if def_id != self.def_id { self.check(def_id); @@ -1384,7 +1384,7 @@ fn find_existential_constraints<'a, 'tcx>( } } fn visit_trait_item(&mut self, it: &'tcx TraitItem) { - let def_id = self.tcx.hir.local_def_id(it.id); + let def_id = self.tcx.hir().local_def_id(it.id); self.check(def_id); intravisit::walk_trait_item(self, it); } @@ -1395,16 +1395,16 @@ fn find_existential_constraints<'a, 'tcx>( tcx, found: None, }; - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let parent = tcx.hir.get_parent(node_id); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let parent = tcx.hir().get_parent(node_id); trace!("parent_id: {:?}", parent); if parent == ast::CRATE_NODE_ID { - intravisit::walk_crate(&mut locator, tcx.hir.krate()); + intravisit::walk_crate(&mut locator, tcx.hir().krate()); } else { - trace!("parent: {:?}", tcx.hir.get(parent)); - match tcx.hir.get(parent) { + trace!("parent: {:?}", tcx.hir().get(parent)); + match tcx.hir().get(parent) { Node::Item(ref it) => intravisit::walk_item(&mut locator, it), Node::ImplItem(ref it) => intravisit::walk_impl_item(&mut locator, it), Node::TraitItem(ref it) => intravisit::walk_trait_item(&mut locator, it), @@ -1429,11 +1429,11 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig use rustc::hir::*; use rustc::hir::Node::*; - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); let icx = ItemCtxt::new(tcx, def_id); - match tcx.hir.get(node_id) { + match tcx.hir().get(node_id) { TraitItem(hir::TraitItem { node: TraitItemKind::Method(sig, _), .. @@ -1452,7 +1452,7 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig node: ForeignItemKind::Fn(ref fn_decl, _, _), .. }) => { - let abi = tcx.hir.get_foreign_abi(node_id); + let abi = tcx.hir().get_foreign_abi(node_id); compute_sig_of_foreign_fn_decl(tcx, def_id, fn_decl, abi) } @@ -1465,10 +1465,10 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig }, .. }) => { - let ty = tcx.type_of(tcx.hir.get_parent_did(node_id)); + let ty = tcx.type_of(tcx.hir().get_parent_did(node_id)); let inputs = fields .iter() - .map(|f| tcx.type_of(tcx.hir.local_def_id(f.id))); + .map(|f| tcx.type_of(tcx.hir().local_def_id(f.id))); ty::Binder::bind(tcx.mk_fn_sig( inputs, ty, @@ -1512,8 +1512,8 @@ fn impl_trait_ref<'a, 'tcx>( ) -> Option> { let icx = ItemCtxt::new(tcx, def_id); - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - match tcx.hir.expect_item(node_id).node { + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + match tcx.hir().expect_item(node_id).node { hir::ItemKind::Impl(.., ref opt_trait_ref, _, _) => { opt_trait_ref.as_ref().map(|ast_trait_ref| { let selfty = tcx.type_of(def_id); @@ -1525,8 +1525,8 @@ fn impl_trait_ref<'a, 'tcx>( } fn impl_polarity<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> hir::ImplPolarity { - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - match tcx.hir.expect_item(node_id).node { + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + match tcx.hir().expect_item(node_id).node { hir::ItemKind::Impl(_, polarity, ..) => polarity, ref item => bug!("impl_polarity: {:?} not an impl", item), } @@ -1597,7 +1597,7 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx>( .iter() .filter(move |param| match param.kind { GenericParamKind::Lifetime { .. } => { - let hir_id = tcx.hir.node_to_hir_id(param.id); + let hir_id = tcx.hir().node_to_hir_id(param.id); !tcx.is_late_bound(hir_id) } _ => false, @@ -1627,6 +1627,7 @@ fn predicates_defined_on<'a, 'tcx>( .predicates .extend(inferred_outlives.iter().map(|&p| (p, span))); } + debug!("predicates_defined_on({:?}) = {:?}", def_id, result); result } @@ -1654,6 +1655,7 @@ fn predicates_of<'a, 'tcx>( .predicates .push((ty::TraitRef::identity(tcx, def_id).to_predicate(), span)); } + debug!("predicates_of(def_id={:?}) = {:?}", def_id, result); result } @@ -1695,8 +1697,8 @@ fn explicit_predicates_of<'a, 'tcx>( } } - let node_id = tcx.hir.as_local_node_id(def_id).unwrap(); - let node = tcx.hir.get(node_id); + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let node = tcx.hir().get(node_id); let mut is_trait = None; let mut is_default_impl_trait = None; @@ -1715,7 +1717,7 @@ fn explicit_predicates_of<'a, 'tcx>( let substs = Substs::identity_for_item(tcx, def_id); let opaque_ty = tcx.mk_opaque(def_id, substs); - // Collect the bounds, i.e. the `A+B+'c` in `impl A+B+'c`. + // Collect the bounds, i.e., the `A+B+'c` in `impl A+B+'c`. let bounds = compute_bounds( &icx, opaque_ty, @@ -1760,7 +1762,7 @@ fn explicit_predicates_of<'a, 'tcx>( let substs = Substs::identity_for_item(tcx, def_id); let opaque_ty = tcx.mk_opaque(def_id, substs); - // Collect the bounds, i.e. the `A+B+'c` in `impl A+B+'c`. + // Collect the bounds, i.e., the `A+B+'c` in `impl A+B+'c`. let bounds = compute_bounds( &icx, opaque_ty, @@ -1825,7 +1827,7 @@ fn explicit_predicates_of<'a, 'tcx>( let mut index = parent_count + has_own_self as u32; for param in early_bound_lifetimes_from_generics(tcx, ast_generics) { let region = tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { - def_id: tcx.hir.local_def_id(param.id), + def_id: tcx.hir().local_def_id(param.id), index, name: param.name.ident().as_interned_str(), })); @@ -1892,7 +1894,7 @@ fn explicit_predicates_of<'a, 'tcx>( &hir::GenericBound::Trait(ref poly_trait_ref, _) => { let mut projections = Vec::new(); - let trait_ref = AstConv::instantiate_poly_trait_ref( + let (trait_ref, _) = AstConv::instantiate_poly_trait_ref( &icx, poly_trait_ref, ty, @@ -1938,14 +1940,14 @@ fn explicit_predicates_of<'a, 'tcx>( // Add predicates from associated type bounds. if let Some((self_trait_ref, trait_items)) = is_trait { predicates.extend(trait_items.iter().flat_map(|trait_item_ref| { - let trait_item = tcx.hir.trait_item(trait_item_ref.id); + let trait_item = tcx.hir().trait_item(trait_item_ref.id); let bounds = match trait_item.node { hir::TraitItemKind::Type(ref bounds, _) => bounds, _ => return vec![].into_iter() }; let assoc_ty = - tcx.mk_projection(tcx.hir.local_def_id(trait_item.id), self_trait_ref.substs); + tcx.mk_projection(tcx.hir().local_def_id(trait_item.id), self_trait_ref.substs); let bounds = compute_bounds( &ItemCtxt::new(tcx, def_id), @@ -1981,10 +1983,12 @@ fn explicit_predicates_of<'a, 'tcx>( ); } - Lrc::new(ty::GenericPredicates { + let result = Lrc::new(ty::GenericPredicates { parent: generics.parent, predicates, - }) + }); + debug!("explicit_predicates_of(def_id={:?}) = {:?}", def_id, result); + result } pub enum SizedByDefault { @@ -2016,7 +2020,12 @@ pub fn compute_bounds<'gcx: 'tcx, 'tcx>( let mut projection_bounds = Vec::new(); let mut trait_bounds: Vec<_> = trait_bounds.iter().map(|&bound| { - (astconv.instantiate_poly_trait_ref(bound, param_ty, &mut projection_bounds), bound.span) + let (poly_trait_ref, _) = astconv.instantiate_poly_trait_ref( + bound, + param_ty, + &mut projection_bounds, + ); + (poly_trait_ref, bound.span) }).collect(); let region_bounds = region_bounds @@ -2057,7 +2066,7 @@ fn predicates_from_bound<'tcx>( match *bound { hir::GenericBound::Trait(ref tr, hir::TraitBoundModifier::None) => { let mut projections = Vec::new(); - let pred = astconv.instantiate_poly_trait_ref(tr, param_ty, &mut projections); + let (pred, _) = astconv.instantiate_poly_trait_ref(tr, param_ty, &mut projections); iter::once((pred.to_predicate(), tr.span)).chain( projections .into_iter() @@ -2080,10 +2089,7 @@ fn compute_sig_of_foreign_fn_decl<'a, 'tcx>( abi: abi::Abi, ) -> ty::PolyFnSig<'tcx> { let unsafety = if abi == abi::Abi::RustIntrinsic { - match &*tcx.item_name(def_id).as_str() { - "size_of" | "min_align_of" | "needs_drop" => hir::Unsafety::Normal, - _ => hir::Unsafety::Unsafe, - } + intrisic_operation_unsafety(&*tcx.item_name(def_id).as_str()) } else { hir::Unsafety::Unsafe }; @@ -2103,7 +2109,7 @@ fn compute_sig_of_foreign_fn_decl<'a, 'tcx>( &format!( "use of SIMD type `{}` in FFI is highly experimental and \ may result in invalid code", - tcx.hir.node_to_pretty_string(ast_ty.id) + tcx.hir().node_to_pretty_string(ast_ty.id) ), ) .help("add #![feature(simd_ffi)] to the crate attributes to enable") @@ -2122,7 +2128,7 @@ fn compute_sig_of_foreign_fn_decl<'a, 'tcx>( } fn is_foreign_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { - match tcx.hir.get_if_local(def_id) { + match tcx.hir().get_if_local(def_id) { Some(Node::ForeignItem(..)) => true, Some(_) => false, _ => bug!("is_foreign_item applied to non-local def-id {:?}", def_id), @@ -2138,12 +2144,7 @@ fn from_target_feature( ) { let list = match attr.meta_item_list() { Some(list) => list, - None => { - let msg = "#[target_feature] attribute must be of the form \ - #[target_feature(..)]"; - tcx.sess.span_err(attr.span, &msg); - return; - } + None => return, }; let rust_features = tcx.features(); for item in list { @@ -2202,6 +2203,9 @@ fn from_target_feature( Some("sse4a_target_feature") => rust_features.sse4a_target_feature, Some("tbm_target_feature") => rust_features.tbm_target_feature, Some("wasm_target_feature") => rust_features.wasm_target_feature, + Some("cmpxchg16b_target_feature") => rust_features.cmpxchg16b_target_feature, + Some("adx_target_feature") => rust_features.adx_target_feature, + Some("movbe_target_feature") => rust_features.movbe_target_feature, Some(name) => bug!("unknown target feature gate {}", name), None => true, }; @@ -2213,7 +2217,6 @@ fn from_target_feature( feature_gate::GateIssue::Language, &format!("the target feature `{}` is currently unstable", feature), ); - return None; } Some(Symbol::intern(feature)) })); @@ -2244,7 +2247,7 @@ fn linkage_by_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, name: & "weak" => WeakAny, "weak_odr" => WeakODR, _ => { - let span = tcx.hir.span_if_local(def_id); + let span = tcx.hir().span_if_local(def_id); if let Some(span) = span { tcx.sess.span_fatal(span, "invalid linkage specified") } else { @@ -2284,49 +2287,6 @@ fn codegen_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> Codegen codegen_fn_attrs.flags |= CodegenFnAttrFlags::USED; } else if attr.check_name("thread_local") { codegen_fn_attrs.flags |= CodegenFnAttrFlags::THREAD_LOCAL; - } else if attr.check_name("inline") { - codegen_fn_attrs.inline = attrs.iter().fold(InlineAttr::None, |ia, attr| { - if attr.path != "inline" { - return ia; - } - let meta = match attr.meta() { - Some(meta) => meta.node, - None => return ia, - }; - match meta { - MetaItemKind::Word => { - mark_used(attr); - InlineAttr::Hint - } - MetaItemKind::List(ref items) => { - mark_used(attr); - inline_span = Some(attr.span); - if items.len() != 1 { - span_err!( - tcx.sess.diagnostic(), - attr.span, - E0534, - "expected one argument" - ); - InlineAttr::None - } else if list_contains_name(&items[..], "always") { - InlineAttr::Always - } else if list_contains_name(&items[..], "never") { - InlineAttr::Never - } else { - span_err!( - tcx.sess.diagnostic(), - items[0].span, - E0535, - "invalid argument" - ); - - InlineAttr::None - } - } - _ => ia, - } - }); } else if attr.check_name("export_name") { if let Some(s) = attr.value_str() { if s.as_str().contains("\0") { @@ -2340,14 +2300,6 @@ fn codegen_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> Codegen ).emit(); } codegen_fn_attrs.export_name = Some(s); - } else { - struct_span_err!( - tcx.sess, - attr.span, - E0558, - "`export_name` attribute has invalid format" - ).span_label(attr.span, "did you mean #[export_name=\"*\"]?") - .emit(); } } else if attr.check_name("target_feature") { if tcx.fn_sig(id).unsafety() == Unsafety::Normal { @@ -2384,6 +2336,76 @@ fn codegen_fn_attrs<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: DefId) -> Codegen } } + codegen_fn_attrs.inline = attrs.iter().fold(InlineAttr::None, |ia, attr| { + if attr.path != "inline" { + return ia; + } + match attr.meta().map(|i| i.node) { + Some(MetaItemKind::Word) => { + mark_used(attr); + InlineAttr::Hint + } + Some(MetaItemKind::List(ref items)) => { + mark_used(attr); + inline_span = Some(attr.span); + if items.len() != 1 { + span_err!( + tcx.sess.diagnostic(), + attr.span, + E0534, + "expected one argument" + ); + InlineAttr::None + } else if list_contains_name(&items[..], "always") { + InlineAttr::Always + } else if list_contains_name(&items[..], "never") { + InlineAttr::Never + } else { + span_err!( + tcx.sess.diagnostic(), + items[0].span, + E0535, + "invalid argument" + ); + + InlineAttr::None + } + } + Some(MetaItemKind::NameValue(_)) => ia, + None => ia, + } + }); + + codegen_fn_attrs.optimize = attrs.iter().fold(OptimizeAttr::None, |ia, attr| { + if attr.path != "optimize" { + return ia; + } + let err = |sp, s| span_err!(tcx.sess.diagnostic(), sp, E0722, "{}", s); + match attr.meta().map(|i| i.node) { + Some(MetaItemKind::Word) => { + err(attr.span, "expected one argument"); + ia + } + Some(MetaItemKind::List(ref items)) => { + mark_used(attr); + inline_span = Some(attr.span); + if items.len() != 1 { + err(attr.span, "expected one argument"); + OptimizeAttr::None + } else if list_contains_name(&items[..], "size") { + OptimizeAttr::Size + } else if list_contains_name(&items[..], "speed") { + OptimizeAttr::Speed + } else { + err(items[0].span, "invalid argument"); + OptimizeAttr::None + } + } + Some(MetaItemKind::NameValue(_)) => ia, + None => ia, + } + }); + // If a function uses #[target_feature] it can't be inlined into general // purpose functions as they wouldn't have the right target features // enabled. For that reason we also forbid #[inline(always)] as it can't be diff --git a/src/librustc_typeck/constrained_type_params.rs b/src/librustc_typeck/constrained_type_params.rs index 9299e9b7b8f..199ea315896 100644 --- a/src/librustc_typeck/constrained_type_params.rs +++ b/src/librustc_typeck/constrained_type_params.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::fold::{TypeFoldable, TypeVisitor}; use rustc::util::nodemap::FxHashSet; @@ -37,7 +27,7 @@ pub fn parameters_for_impl<'tcx>(impl_self_ty: Ty<'tcx>, } /// If `include_projections` is false, returns the list of parameters that are -/// constrained by `t` - i.e. the value of each parameter in the list is +/// constrained by `t` - i.e., the value of each parameter in the list is /// uniquely determined by `t` (see RFC 447). If it is true, return the list /// of parameters whose values are needed in order to constrain `ty` - these /// differ, with the latter being a superset, in the presence of projections. diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index a985c3e9fdf..3ed09dfe992 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] register_long_diagnostics! { @@ -526,7 +516,7 @@ recursion limit (which can be set via the `recursion_limit` attribute). For a somewhat artificial example: ```compile_fail,E0055 -#![recursion_limit="2"] +#![recursion_limit="5"] struct Foo; @@ -536,9 +526,9 @@ impl Foo { fn main() { let foo = Foo; - let ref_foo = &&Foo; + let ref_foo = &&&&&Foo; - // error, reached the recursion limit while auto-dereferencing &&Foo + // error, reached the recursion limit while auto-dereferencing `&&&&&Foo` ref_foo.foo(); } ``` @@ -655,7 +645,7 @@ For example, a function like: fn f(a: u16, b: &str) {} ``` -Must always be called with exactly two arguments, e.g. `f(2, "test")`. +Must always be called with exactly two arguments, e.g., `f(2, "test")`. Note that Rust does not have a notion of optional function arguments or variadic functions (except for its C-FFI). @@ -773,7 +763,7 @@ function's return type and the value being returned. "##, E0070: r##" -The left-hand side of an assignment operator must be a place expression. An +The left-hand side of an assignment operator must be a place expression. A place expression represents a memory location and can be a variable (with optional namespacing), a dereference, an indexing expression or a field reference. @@ -1301,7 +1291,7 @@ You tried to give a type parameter to a type which doesn't need it. Erroneous code example: ```compile_fail,E0109 -type X = u32; // error: type parameters are not allowed on this type +type X = u32; // error: type arguments are not allowed on this entity ``` Please check that you used the correct type and recheck its definition. Perhaps @@ -1610,7 +1600,7 @@ it has been disabled for now. E0185: r##" An associated function for a trait was defined to be static, but an -implementation of the trait declared the same function to be a method (i.e. to +implementation of the trait declared the same function to be a method (i.e., to take a `self` parameter). Here's an example of this error: @@ -1631,7 +1621,7 @@ impl Foo for Bar { "##, E0186: r##" -An associated function for a trait was defined to be a method (i.e. to take a +An associated function for a trait was defined to be a method (i.e., to take a `self` parameter), but an implementation of the trait declared the same function to be static. @@ -3379,180 +3369,6 @@ extern "platform-intrinsic" { ``` "##, -E0440: r##" -A platform-specific intrinsic function has the wrong number of type -parameters. Erroneous code example: - -```compile_fail,E0440 -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct f64x2(f64, f64); - -extern "platform-intrinsic" { - fn x86_mm_movemask_pd(x: f64x2) -> i32; - // error: platform-specific intrinsic has wrong number of type - // parameters -} -``` - -Please refer to the function declaration to see if it corresponds -with yours. Example: - -``` -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct f64x2(f64, f64); - -extern "platform-intrinsic" { - fn x86_mm_movemask_pd(x: f64x2) -> i32; -} -``` -"##, - -E0441: r##" -An unknown platform-specific intrinsic function was used. Erroneous -code example: - -```compile_fail,E0441 -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); - -extern "platform-intrinsic" { - fn x86_mm_adds_ep16(x: i16x8, y: i16x8) -> i16x8; - // error: unrecognized platform-specific intrinsic function -} -``` - -Please verify that the function name wasn't misspelled, and ensure -that it is declared in the rust source code (in the file -src/librustc_platform_intrinsics/x86.rs). Example: - -``` -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); - -extern "platform-intrinsic" { - fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i16x8; // ok! -} -``` -"##, - -E0442: r##" -Intrinsic argument(s) and/or return value have the wrong type. -Erroneous code example: - -```compile_fail,E0442 -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8, - i8, i8, i8, i8, i8, i8, i8, i8); -#[repr(simd)] -struct i32x4(i32, i32, i32, i32); -#[repr(simd)] -struct i64x2(i64, i64); - -extern "platform-intrinsic" { - fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2; - // error: intrinsic arguments/return value have wrong type -} -``` - -To fix this error, please refer to the function declaration to give -it the awaited types. Example: - -``` -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); - -extern "platform-intrinsic" { - fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i16x8; // ok! -} -``` -"##, - -E0443: r##" -Intrinsic argument(s) and/or return value have the wrong type. -Erroneous code example: - -```compile_fail,E0443 -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); -#[repr(simd)] -struct i64x8(i64, i64, i64, i64, i64, i64, i64, i64); - -extern "platform-intrinsic" { - fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i64x8; - // error: intrinsic argument/return value has wrong type -} -``` - -To fix this error, please refer to the function declaration to give -it the awaited types. Example: - -``` -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); - -extern "platform-intrinsic" { - fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i16x8; // ok! -} -``` -"##, - -E0444: r##" -A platform-specific intrinsic function has wrong number of arguments. -Erroneous code example: - -```compile_fail,E0444 -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct f64x2(f64, f64); - -extern "platform-intrinsic" { - fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; - // error: platform-specific intrinsic has invalid number of arguments -} -``` - -Please refer to the function declaration to see if it corresponds -with yours. Example: - -``` -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct f64x2(f64, f64); - -extern "platform-intrinsic" { - fn x86_mm_movemask_pd(x: f64x2) -> i32; // ok! -} -``` -"##, - E0516: r##" The `typeof` keyword is currently reserved but unimplemented. Erroneous code example: @@ -3795,29 +3611,6 @@ For more information about the inline attribute, https: read://doc.rust-lang.org/reference.html#inline-attributes "##, -E0558: r##" -The `export_name` attribute was malformed. - -Erroneous code example: - -```ignore (error-emitted-at-codegen-which-cannot-be-handled-by-compile_fail) -#[export_name] // error: `export_name` attribute has invalid format -pub fn something() {} - -fn main() {} -``` - -The `export_name` attribute expects a string in order to determine the name of -the exported symbol. Example: - -``` -#[export_name = "some_function"] // ok! -pub fn something() {} - -fn main() {} -``` -"##, - E0559: r##" An unknown field was specified into an enum's structure variant. @@ -4826,6 +4619,21 @@ type, it's not allowed to override anything in those implementations, as it would be ambiguous which override should actually be used. "##, + +E0720: r##" +An `impl Trait` type expands to a recursive type. + +An `impl Trait` type must be expandable to a concrete type that contains no +`impl Trait` types. For example the following example tries to create an +`impl Trait` type `T` that is equal to `[T, T]`: + +```compile_fail,E0720 +fn make_recursive_type() -> impl Sized { + [make_recursive_type(), make_recursive_type()] +} +``` +"##, + } register_diagnostics! { @@ -4891,6 +4699,7 @@ register_diagnostics! { // E0372, // coherence not object safe E0377, // the trait `CoerceUnsized` may only be implemented for a coercion // between structures with the same definition +// E0558, // replaced with a generic attribute input check E0533, // `{}` does not name a unit variant, unit struct or a constant // E0563, // cannot determine a type for this `impl Trait`: {} // removed in 6383de15 E0564, // only named lifetimes are allowed in `impl Trait`, @@ -4910,4 +4719,5 @@ register_diagnostics! { E0645, // trait aliases not finished E0698, // type inside generator must be known in this context E0719, // duplicate values for associated type binding + E0722, // Malformed #[optimize] attribute } diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 74a53f7fca2..d5e15b28fb0 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This pass enforces various "well-formedness constraints" on impls. //! Logically, it is part of wfcheck -- but we do it early so that we //! can stop compilation afterwards, since part of the trait matching @@ -62,7 +52,7 @@ pub fn impl_wf_check<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { // We will tag this as part of the WF check -- logically, it is, // but it's one that we must perform earlier than the rest of // WfCheck. - tcx.hir.krate().visit_all_item_likes(&mut ImplWfCheck { tcx }); + tcx.hir().krate().visit_all_item_likes(&mut ImplWfCheck { tcx }); } struct ImplWfCheck<'a, 'tcx: 'a> { @@ -72,7 +62,7 @@ struct ImplWfCheck<'a, 'tcx: 'a> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for ImplWfCheck<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { if let hir::ItemKind::Impl(.., ref impl_item_refs) = item.node { - let impl_def_id = self.tcx.hir.local_def_id(item.id); + let impl_def_id = self.tcx.hir().local_def_id(item.id); enforce_impl_params_are_constrained(self.tcx, impl_def_id, impl_item_refs); @@ -101,7 +91,7 @@ fn enforce_impl_params_are_constrained<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Disallow unconstrained lifetimes, but only if they appear in assoc types. let lifetimes_in_associated_types: FxHashSet<_> = impl_item_refs.iter() - .map(|item_ref| tcx.hir.local_def_id(item_ref.id.node_id)) + .map(|item_ref| tcx.hir().local_def_id(item_ref.id.node_id)) .filter(|&def_id| { let item = tcx.associated_item(def_id); item.kind == ty::AssociatedKind::Type && item.defaultness.has_value() @@ -176,7 +166,7 @@ fn enforce_impl_items_are_distinct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let mut seen_type_items = FxHashMap::default(); let mut seen_value_items = FxHashMap::default(); for impl_item_ref in impl_item_refs { - let impl_item = tcx.hir.impl_item(impl_item_ref.id); + let impl_item = tcx.hir().impl_item(impl_item_ref.id); let seen_items = match impl_item.node { hir::ImplItemKind::Type(_) => &mut seen_type_items, _ => &mut seen_value_items, diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 1f5998d8ca3..5149f460bac 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -1,33 +1,23 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /*! -typeck.rs, an introduction +# typeck.rs The type checker is responsible for: -1. Determining the type of each expression -2. Resolving methods and traits -3. Guaranteeing that most type rules are met ("most?", you say, "why most?" +1. Determining the type of each expression. +2. Resolving methods and traits. +3. Guaranteeing that most type rules are met. ("Most?", you say, "why most?" Well, dear reader, read on) -The main entry point is `check_crate()`. Type checking operates in +The main entry point is `check_crate()`. Type checking operates in several major phases: 1. The collect phase first passes over all items and determines their type, without examining their "innards". -2. Variance inference then runs to compute the variance of each parameter +2. Variance inference then runs to compute the variance of each parameter. -3. Coherence checks for overlapping or orphaned impls +3. Coherence checks for overlapping or orphaned impls. 4. Finally, the check phase then checks function bodies and so forth. Within the check phase, we check each function body one at a time @@ -41,12 +31,12 @@ The type checker is defined into various submodules which are documented independently: - astconv: converts the AST representation of types - into the `ty` representation + into the `ty` representation. - collect: computes the types of each top-level item and enters them into - the `tcx.types` table for later use + the `tcx.types` table for later use. -- coherence: enforces coherence rules, builds some tables +- coherence: enforces coherence rules, builds some tables. - variance: variance inference @@ -59,7 +49,7 @@ independently: all subtyping and assignment constraints are met. In essence, the check module specifies the constraints, and the infer module solves them. -# Note +## Note This API is completely unstable and subject to change. @@ -76,7 +66,6 @@ This API is completely unstable and subject to change. #![feature(crate_visibility_modifier)] #![feature(exhaustive_patterns)] #![feature(nll)] -#![feature(quote)] #![feature(refcell_replace_swap)] #![feature(rustc_diagnostic_macros)] #![feature(slice_patterns)] @@ -90,36 +79,14 @@ This API is completely unstable and subject to change. extern crate syntax_pos; extern crate arena; + #[macro_use] extern crate rustc; -extern crate rustc_platform_intrinsics as intrinsics; extern crate rustc_data_structures; extern crate rustc_errors as errors; extern crate rustc_target; extern crate smallvec; -use rustc::hir; -use rustc::lint; -use rustc::middle; -use rustc::session; -use rustc::util; - -use hir::Node; -use rustc::infer::InferOk; -use rustc::ty::subst::Substs; -use rustc::ty::{self, Ty, TyCtxt}; -use rustc::ty::query::Providers; -use rustc::traits::{ObligationCause, ObligationCauseCode, TraitEngine, TraitEngineExt}; -use rustc::util::profiling::ProfileCategory; -use session::{CompileIncomplete, config}; -use util::common::time; - -use syntax::ast; -use rustc_target::spec::abi::Abi; -use syntax_pos::Span; - -use std::iter; - -// NB: This module needs to be declared first so diagnostics are +// N.B., this module needs to be declared first so diagnostics are // registered before they are used. mod diagnostics; @@ -135,11 +102,47 @@ mod namespace; mod outlives; mod variance; +use rustc_target::spec::abi::Abi; +use rustc::hir::{self, Node}; +use rustc::hir::def_id::{DefId, LOCAL_CRATE}; +use rustc::infer::InferOk; +use rustc::lint; +use rustc::middle; +use rustc::session; +use rustc::session::CompileIncomplete; +use rustc::session::config::{EntryFnType, nightly_options}; +use rustc::traits::{ObligationCause, ObligationCauseCode, TraitEngine, TraitEngineExt}; +use rustc::ty::subst::Substs; +use rustc::ty::{self, Ty, TyCtxt}; +use rustc::ty::query::Providers; +use rustc::util; +use rustc::util::profiling::ProfileCategory; +use syntax_pos::Span; +use util::common::time; + +use std::iter; + pub struct TypeAndSubsts<'tcx> { substs: &'tcx Substs<'tcx>, ty: Ty<'tcx>, } +fn check_type_alias_enum_variants_enabled<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, + span: Span) { + if !tcx.features().type_alias_enum_variants { + let mut err = tcx.sess.struct_span_err( + span, + "enum variants on type aliases are experimental" + ); + if nightly_options::is_nightly_build() { + help!(&mut err, + "add `#![feature(type_alias_enum_variants)]` to the \ + crate attributes to enable"); + } + err.emit(); + } +} + fn require_c_abi_if_variadic(tcx: TyCtxt, decl: &hir::FnDecl, abi: Abi, @@ -179,14 +182,13 @@ fn require_same_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }) } -fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - main_id: ast::NodeId, - main_span: Span) { - let main_def_id = tcx.hir.local_def_id(main_id); +fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, main_def_id: DefId) { + let main_id = tcx.hir().as_local_node_id(main_def_id).unwrap(); + let main_span = tcx.def_span(main_def_id); let main_t = tcx.type_of(main_def_id); match main_t.sty { ty::FnDef(..) => { - if let Some(Node::Item(it)) = tcx.hir.find(main_id) { + if let Some(Node::Item(it)) = tcx.hir().find(main_id) { if let hir::ItemKind::Fn(.., ref generics, _) = it.node { let mut error = false; if !generics.params.is_empty() { @@ -245,14 +247,13 @@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - start_id: ast::NodeId, - start_span: Span) { - let start_def_id = tcx.hir.local_def_id(start_id); +fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, start_def_id: DefId) { + let start_id = tcx.hir().as_local_node_id(start_def_id).unwrap(); + let start_span = tcx.def_span(start_def_id); let start_t = tcx.type_of(start_def_id); match start_t.sty { ty::FnDef(..) => { - if let Some(Node::Item(it)) = tcx.hir.find(start_id) { + if let Some(Node::Item(it)) = tcx.hir().find(start_id) { if let hir::ItemKind::Fn(.., ref generics, _) = it.node { let mut error = false; if !generics.params.is_empty() { @@ -304,11 +305,10 @@ fn check_start_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn check_for_entry_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - if let Some((id, sp, entry_type)) = *tcx.sess.entry_fn.borrow() { - match entry_type { - config::EntryFnType::Main => check_main_fn_ty(tcx, id, sp), - config::EntryFnType::Start => check_start_fn_ty(tcx, id, sp), - } + match tcx.entry_fn(LOCAL_CRATE) { + Some((def_id, EntryFnType::Main)) => check_main_fn_ty(tcx, def_id), + Some((def_id, EntryFnType::Start)) => check_start_fn_ty(tcx, def_id), + _ => {} } } @@ -373,8 +373,8 @@ pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> // In case there are any projections etc, find the "environment" // def-id that will be used to determine the traits/predicates in // scope. This is derived from the enclosing item-like thing. - let env_node_id = tcx.hir.get_parent(hir_ty.id); - let env_def_id = tcx.hir.local_def_id(env_node_id); + let env_node_id = tcx.hir().get_parent(hir_ty.id); + let env_def_id = tcx.hir().local_def_id(env_node_id); let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id); astconv::AstConv::ast_ty_to_ty(&item_cx, hir_ty) @@ -385,11 +385,11 @@ pub fn hir_trait_to_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_trait: // In case there are any projections etc, find the "environment" // def-id that will be used to determine the traits/predicates in // scope. This is derived from the enclosing item-like thing. - let env_node_id = tcx.hir.get_parent(hir_trait.ref_id); - let env_def_id = tcx.hir.local_def_id(env_node_id); + let env_node_id = tcx.hir().get_parent(hir_trait.ref_id); + let env_def_id = tcx.hir().local_def_id(env_node_id); let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id); let mut projections = Vec::new(); - let principal = astconv::AstConv::instantiate_poly_trait_ref_inner( + let (principal, _) = astconv::AstConv::instantiate_poly_trait_ref_inner( &item_cx, hir_trait, tcx.types.err, &mut projections, true ); diff --git a/src/librustc_typeck/namespace.rs b/src/librustc_typeck/namespace.rs index 690bf1c550c..e8f6272810a 100644 --- a/src/librustc_typeck/namespace.rs +++ b/src/librustc_typeck/namespace.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir; use rustc::ty; diff --git a/src/librustc_typeck/outlives/explicit.rs b/src/librustc_typeck/outlives/explicit.rs index 9b374cf932f..38f4b37b292 100644 --- a/src/librustc_typeck/outlives/explicit.rs +++ b/src/librustc_typeck/outlives/explicit.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir::def_id::DefId; use rustc::ty::{self, OutlivesPredicate, TyCtxt}; use util::nodemap::FxHashMap; diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index 30e304375fe..e388a3e0d0c 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir; use hir::Node; use rustc::hir::def_id::DefId; @@ -48,7 +38,7 @@ pub fn infer_predicates<'tcx>( }; // Visit all the crates and infer predicates - tcx.hir.krate().visit_all_item_likes(&mut visitor); + tcx.hir().krate().visit_all_item_likes(&mut visitor); } global_inferred_outlives @@ -63,16 +53,16 @@ pub struct InferVisitor<'cx, 'tcx: 'cx> { impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { - let item_did = self.tcx.hir.local_def_id(item.id); + let item_did = self.tcx.hir().local_def_id(item.id); debug!("InferVisitor::visit_item(item={:?})", item_did); let node_id = self .tcx - .hir + .hir() .as_local_node_id(item_did) .expect("expected local def-id"); - let item = match self.tcx.hir.get(node_id) { + let item = match self.tcx.hir().get(node_id) { Node::Item(item) => item, _ => bug!(), }; @@ -204,27 +194,28 @@ fn insert_required_predicates_to_be_wf<'tcx>( debug!("Dynamic"); debug!("field_ty = {}", &field_ty); debug!("ty in field = {}", &ty); - let ex_trait_ref = obj.principal(); - // Here, we are passing the type `usize` as a - // placeholder value with the function - // `with_self_ty`, since there is no concrete type - // `Self` for a `dyn Trait` at this - // stage. Therefore when checking explicit - // predicates in `check_explicit_predicates` we - // need to ignore checking the explicit_map for - // Self type. - let substs = ex_trait_ref - .with_self_ty(tcx, tcx.types.usize) - .skip_binder() - .substs; - check_explicit_predicates( - tcx, - &ex_trait_ref.skip_binder().def_id, - substs, - required_predicates, - explicit_map, - IgnoreSelfTy(true), - ); + if let Some(ex_trait_ref) = obj.principal() { + // Here, we are passing the type `usize` as a + // placeholder value with the function + // `with_self_ty`, since there is no concrete type + // `Self` for a `dyn Trait` at this + // stage. Therefore when checking explicit + // predicates in `check_explicit_predicates` we + // need to ignore checking the explicit_map for + // Self type. + let substs = ex_trait_ref + .with_self_ty(tcx, tcx.types.usize) + .skip_binder() + .substs; + check_explicit_predicates( + tcx, + &ex_trait_ref.skip_binder().def_id, + substs, + required_predicates, + explicit_map, + IgnoreSelfTy(true), + ); + } } ty::Projection(obj) => { @@ -314,7 +305,7 @@ pub fn check_explicit_predicates<'tcx>( // case that `substs` come from a `dyn Trait` type, our caller will have // included `Self = usize` as the value for `Self`. If we were // to apply the substs, and not filter this predicate, we might then falsely - // conclude that e.g. `X: 'x` was a reasonable inferred requirement. + // conclude that e.g., `X: 'x` was a reasonable inferred requirement. // // Another similar case is where we have a inferred // requirement like `::Foo: 'b`. We presently diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index 1eb53ffc730..f0310f250a9 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use hir::Node; use rustc::hir; use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; @@ -35,11 +25,11 @@ fn inferred_outlives_of<'a, 'tcx>( item_def_id: DefId, ) -> Lrc>> { let id = tcx - .hir + .hir() .as_local_node_id(item_def_id) .expect("expected local def-id"); - match tcx.hir.get(id) { + match tcx.hir().get(id) { Node::Item(item) => match item.node { hir::ItemKind::Struct(..) | hir::ItemKind::Enum(..) | hir::ItemKind::Union(..) => { let crate_map = tcx.inferred_outlives_crate(LOCAL_CRATE); diff --git a/src/librustc_typeck/outlives/test.rs b/src/librustc_typeck/outlives/test.rs index 48c495e1c93..cbeb7f7b691 100644 --- a/src/librustc_typeck/outlives/test.rs +++ b/src/librustc_typeck/outlives/test.rs @@ -1,19 +1,9 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; pub fn test_inferred_outlives<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - tcx.hir + tcx.hir() .krate() .visit_all_item_likes(&mut OutlivesTest { tcx }); } @@ -24,7 +14,7 @@ struct OutlivesTest<'a, 'tcx: 'a> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for OutlivesTest<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { - let item_def_id = self.tcx.hir.local_def_id(item.id); + let item_def_id = self.tcx.hir().local_def_id(item.id); // For unit testing: check for a special "rustc_outlives" // attribute and report an error with various results if found. diff --git a/src/librustc_typeck/outlives/utils.rs b/src/librustc_typeck/outlives/utils.rs index 6ed59837eb4..c886c7a4ffc 100644 --- a/src/librustc_typeck/outlives/utils.rs +++ b/src/librustc_typeck/outlives/utils.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty::outlives::Component; use rustc::ty::subst::{Kind, UnpackedKind}; use rustc::ty::{self, Region, RegionKind, Ty, TyCtxt}; diff --git a/src/librustc_typeck/structured_errors.rs b/src/librustc_typeck/structured_errors.rs index 12863cc66a0..f75ab47e1ab 100644 --- a/src/librustc_typeck/structured_errors.rs +++ b/src/librustc_typeck/structured_errors.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::session::Session; use syntax_pos::Span; use errors::{Applicability, DiagnosticId, DiagnosticBuilder}; @@ -73,7 +63,7 @@ impl<'tcx> StructuredDiagnostic<'tcx> for VariadicError<'tcx> { ) }; if let Ok(snippet) = self.sess.source_map().span_to_snippet(self.span) { - err.span_suggestion_with_applicability( + err.span_suggestion( self.span, &format!("cast the value to `{}`", self.cast_ty), format!("{} as {}", snippet, self.cast_ty), diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 47d34c90996..868c1132e44 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Constraint construction and representation //! //! The second pass over the AST determines the set of constraints. @@ -44,7 +34,7 @@ pub struct Constraint<'a> { } /// To build constraints, we visit one item (type, trait) at a time -/// and look at its contents. So e.g. if we have +/// and look at its contents. So e.g., if we have /// /// struct Foo { /// b: Bar @@ -72,7 +62,7 @@ pub fn add_constraints_from_crate<'a, 'tcx>(terms_cx: TermsContext<'a, 'tcx>) constraints: Vec::new(), }; - tcx.hir.krate().visit_all_item_likes(&mut constraint_cx); + tcx.hir().krate().visit_all_item_likes(&mut constraint_cx); constraint_cx } @@ -131,7 +121,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ConstraintContext<'a, 'tcx> { impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { fn visit_node_helper(&mut self, id: ast::NodeId) { let tcx = self.terms_cx.tcx; - let def_id = tcx.hir.local_def_id(id); + let def_id = tcx.hir().local_def_id(id); self.build_constraints_for_item(def_id); } @@ -148,7 +138,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { return; } - let id = tcx.hir.as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_node_id(def_id).unwrap(); let inferred_start = self.terms_cx.inferred_starts[&id]; let current_item = &CurrentItem { inferred_start }; match tcx.type_of(def_id).sty { @@ -311,11 +301,12 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { let contra = self.contravariant(variance); self.add_constraints_from_region(current, r, contra); - let poly_trait_ref = data - .principal() - .with_self_ty(self.tcx(), self.tcx().types.err); - self.add_constraints_from_trait_ref( - current, *poly_trait_ref.skip_binder(), variance); + if let Some(poly_trait_ref) = data.principal() { + let poly_trait_ref = + poly_trait_ref.with_self_ty(self.tcx(), self.tcx().types.err); + self.add_constraints_from_trait_ref( + current, *poly_trait_ref.skip_binder(), variance); + } for projection in data.projection_bounds() { self.add_constraints_from_ty( @@ -336,6 +327,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { // types, where we use Error as the Self type } + ty::Placeholder(..) | ty::UnnormalizedProjection(..) | ty::GeneratorWitness(..) | ty::Bound(..) | @@ -364,7 +356,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { return; } - let (local, remote) = if let Some(id) = self.tcx().hir.as_local_node_id(def_id) { + let (local, remote) = if let Some(id) = self.tcx().hir().as_local_node_id(def_id) { (Some(self.terms_cx.inferred_starts[&id]), None) } else { (None, Some(self.tcx().variances_of(def_id))) diff --git a/src/librustc_typeck/variance/mod.rs b/src/librustc_typeck/variance/mod.rs index 7cc56bc192b..afb6a684820 100644 --- a/src/librustc_typeck/variance/mod.rs +++ b/src/librustc_typeck/variance/mod.rs @@ -1,17 +1,7 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Module for inferring the variance of type and lifetime parameters. See the [rustc guide] //! chapter for more info. //! -//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/variance.html +//! [rustc guide]: https://rust-lang.github.io/rustc-guide/variance.html use arena; use rustc::hir; @@ -56,12 +46,12 @@ fn crate_variances<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) fn variances_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_def_id: DefId) -> Lrc> { - let id = tcx.hir.as_local_node_id(item_def_id).expect("expected local def-id"); + let id = tcx.hir().as_local_node_id(item_def_id).expect("expected local def-id"); let unsupported = || { // Variance not relevant. - span_bug!(tcx.hir.span(id), "asked to compute variance for wrong kind of item") + span_bug!(tcx.hir().span(id), "asked to compute variance for wrong kind of item") }; - match tcx.hir.get(id) { + match tcx.hir().get(id) { Node::Item(item) => match item.node { hir::ItemKind::Enum(..) | hir::ItemKind::Struct(..) | diff --git a/src/librustc_typeck/variance/solve.rs b/src/librustc_typeck/variance/solve.rs index 7116a42cead..550c1b1d68b 100644 --- a/src/librustc_typeck/variance/solve.rs +++ b/src/librustc_typeck/variance/solve.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Constraint solving //! //! The final phase iterates over the constraints, refining the variance @@ -93,7 +83,7 @@ impl<'a, 'tcx> SolveContext<'a, 'tcx> { let solutions = &self.solutions; self.terms_cx.inferred_starts.iter().map(|(&id, &InferredIndex(start))| { - let def_id = tcx.hir.local_def_id(id); + let def_id = tcx.hir().local_def_id(id); let generics = tcx.generics_of(def_id); let mut variances = solutions[start..start+generics.count()].to_vec(); diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index 087d53b92d4..d53e2d2ad78 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Representing terms // // Terms are structured as a straightforward tree. Rather than rely on @@ -89,9 +79,9 @@ pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx> // See the following for a discussion on dep-graph management. // - // - https://rust-lang-nursery.github.io/rustc-guide/query.html - // - https://rust-lang-nursery.github.io/rustc-guide/variance.html - tcx.hir.krate().visit_all_item_likes(&mut terms_cx); + // - https://rust-lang.github.io/rustc-guide/query.html + // - https://rust-lang.github.io/rustc-guide/variance.html + tcx.hir().krate().visit_all_item_likes(&mut terms_cx); terms_cx } @@ -106,14 +96,14 @@ fn lang_items(tcx: TyCtxt) -> Vec<(ast::NodeId, Vec)> { all.into_iter() // iterating over (Option, Variance) .filter(|&(ref d,_)| d.is_some()) .map(|(d, v)| (d.unwrap(), v)) // (DefId, Variance) - .filter_map(|(d, v)| tcx.hir.as_local_node_id(d).map(|n| (n, v))) // (NodeId, Variance) + .filter_map(|(d, v)| tcx.hir().as_local_node_id(d).map(|n| (n, v))) // (NodeId, Variance) .collect() } impl<'a, 'tcx> TermsContext<'a, 'tcx> { fn add_inferreds_for_item(&mut self, id: ast::NodeId) { let tcx = self.tcx; - let def_id = tcx.hir.local_def_id(id); + let def_id = tcx.hir().local_def_id(id); let count = tcx.generics_of(def_id).count(); if count == 0 { @@ -125,7 +115,7 @@ impl<'a, 'tcx> TermsContext<'a, 'tcx> { let newly_added = self.inferred_starts.insert(id, InferredIndex(start)).is_none(); assert!(newly_added); - // NB: In the code below for writing the results back into the + // N.B., in the code below for writing the results back into the // `CrateVariancesMap`, we rely on the fact that all inferreds // for a particular item are assigned continuous indices. @@ -139,7 +129,7 @@ impl<'a, 'tcx> TermsContext<'a, 'tcx> { impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for TermsContext<'a, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { debug!("add_inferreds for item {}", - self.tcx.hir.node_to_string(item.id)); + self.tcx.hir().node_to_string(item.id)); match item.node { hir::ItemKind::Struct(ref struct_def, _) | diff --git a/src/librustc_typeck/variance/test.rs b/src/librustc_typeck/variance/test.rs index 1acadb7e772..0f566e6ded9 100644 --- a/src/librustc_typeck/variance/test.rs +++ b/src/librustc_typeck/variance/test.rs @@ -1,19 +1,9 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; pub fn test_variance<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - tcx.hir.krate().visit_all_item_likes(&mut VarianceTest { tcx }); + tcx.hir().krate().visit_all_item_likes(&mut VarianceTest { tcx }); } struct VarianceTest<'a, 'tcx: 'a> { @@ -22,7 +12,7 @@ struct VarianceTest<'a, 'tcx: 'a> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { - let item_def_id = self.tcx.hir.local_def_id(item.id); + let item_def_id = self.tcx.hir().local_def_id(item.id); // For unit testing: check for a special "rustc_variance" // attribute and report an error with various results if found. diff --git a/src/librustc_typeck/variance/xform.rs b/src/librustc_typeck/variance/xform.rs index 7106ca4d420..969463d8e7c 100644 --- a/src/librustc_typeck/variance/xform.rs +++ b/src/librustc_typeck/variance/xform.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::ty; pub fn glb(v1: ty::Variance, v2: ty::Variance) -> ty::Variance { diff --git a/src/librustc_yk_sections/mir_cfg.rs b/src/librustc_yk_sections/mir_cfg.rs index 0f0f13b065b..9ef512f9ff7 100644 --- a/src/librustc_yk_sections/mir_cfg.rs +++ b/src/librustc_yk_sections/mir_cfg.rs @@ -15,7 +15,7 @@ use rustc::ty::TyCtxt; use rustc::hir::def_id::DefId; use rustc::mir::{Mir, TerminatorKind, Operand, Constant, BasicBlock}; -use rustc::ty::{TyS, TyKind, Const}; +use rustc::ty::{TyS, TyKind, Const, LazyConst}; use rustc::util::nodemap::DefIdSet; use std::path::PathBuf; use std::fs::File; @@ -140,11 +140,11 @@ fn process_mir(fh: &mut File, tcx: &TyCtxt, def_id: &DefId, mir: &Mir) { }, TerminatorKind::Call{ref func, cleanup: opt_cleanup_bb, ..} => { if let Operand::Constant(box Constant { - literal: Const { + literal: LazyConst::Evaluated(Const { ty: &TyS { sty: TyKind::FnDef(target_def_id, _substs), .. }, .. - }, .. + }), .. }, ..) = func { // A statically known call target. if opt_cleanup_bb.is_some() { diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml index 8bac007b748..4b421881db4 100644 --- a/src/librustdoc/Cargo.toml +++ b/src/librustdoc/Cargo.toml @@ -9,6 +9,6 @@ path = "lib.rs" [dependencies] pulldown-cmark = { version = "0.1.2", default-features = false } -minifier = "0.0.20" +minifier = "0.0.26" tempfile = "3" parking_lot = "0.6.4" diff --git a/src/librustdoc/README.md b/src/librustdoc/README.md index 2cfe43a8389..e4f7bc30e3f 100644 --- a/src/librustdoc/README.md +++ b/src/librustdoc/README.md @@ -1,3 +1,3 @@ For more information about how `librustdoc` works, see the [rustc guide]. -[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/rustdoc.html +[rustc guide]: https://rust-lang.github.io/rustc-guide/rustdoc.html diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index fde8648c0c4..27ca205720d 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir; use rustc::traits::auto_trait as auto; use rustc::ty::{self, TypeFoldable}; @@ -17,13 +7,13 @@ use self::def_ctor::{get_def_from_def_id, get_def_from_node_id}; use super::*; -pub struct AutoTraitFinder<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> { - pub cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>, +pub struct AutoTraitFinder<'a, 'tcx: 'a, 'rcx: 'a> { + pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>, pub f: auto::AutoTraitFinder<'a, 'tcx>, } -impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> { - pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self { +impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> { + pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> Self { let f = auto::AutoTraitFinder::new(&cx.tcx); AutoTraitFinder { cx, f } @@ -37,7 +27,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> { pub fn get_with_node_id(&self, id: ast::NodeId, name: String) -> Vec { get_def_from_node_id(&self.cx, id, name, &|def_ctor, name| { - let did = self.cx.tcx.hir.local_def_id(id); + let did = self.cx.tcx.hir().local_def_id(id); self.get_auto_trait_impls(did, &def_ctor, Some(name)) }) } @@ -255,7 +245,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> { // handle_lifetimes determines what *needs be* true in order for an impl to hold. // lexical_region_resolve, along with much of the rest of the compiler, is concerned // with determining if a given set up constraints/predicates *are* met, given some - // starting conditions (e.g. user-provided code). For this reason, it's easier + // starting conditions (e.g., user-provided code). For this reason, it's easier // to perform the calculations we need on our own, rather than trying to make // existing inference/solver code do what we want. fn handle_lifetimes<'cx>( @@ -274,7 +264,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> { // Flattening is done in two parts. First, we insert all of the constraints // into a map. Each RegionTarget (either a RegionVid or a Region) maps // to its smaller and larger regions. Note that 'larger' regions correspond - // to sub-regions in Rust code (e.g. in 'a: 'b, 'a is the larger region). + // to sub-regions in Rust code (e.g., in 'a: 'b, 'a is the larger region). for constraint in regions.constraints.keys() { match constraint { &Constraint::VarSubVar(r1, r2) => { @@ -524,7 +514,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> { // display on the docs page. Cleaning the Predicates produces sub-optimal WherePredicate's, // so we fix them up: // - // * Multiple bounds for the same type are coalesced into one: e.g. 'T: Copy', 'T: Debug' + // * Multiple bounds for the same type are coalesced into one: e.g., 'T: Copy', 'T: Debug' // becomes 'T: Copy + Debug' // * Fn bounds are handled specially - instead of leaving it as 'T: Fn(), = // K', we use the dedicated syntax 'T: Fn() -> K' @@ -544,8 +534,8 @@ impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> { did, param_env, type_generics, existing_predicates ); - // The `Sized` trait must be handled specially, since we only only display it when - // it is *not* required (i.e. '?Sized') + // The `Sized` trait must be handled specially, since we only display it when + // it is *not* required (i.e., '?Sized') let sized_trait = self.cx .tcx .require_lang_item(lang_items::SizedTraitLangItem); @@ -629,7 +619,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> { let is_fn = match &mut b { &mut GenericBound::TraitBound(ref mut p, _) => { // Insert regions into the for_generics hash map first, to ensure - // that we don't end up with duplicate bounds (e.g. for<'b, 'b>) + // that we don't end up with duplicate bounds (e.g., for<'b, 'b>) for_generics.extend(p.generic_params.clone()); p.generic_params = for_generics.into_iter().collect(); self.is_fn_ty(&tcx, &p.trait_) @@ -737,7 +727,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> { hir::TraitBoundModifier::None, )); - // Remove any existing 'plain' bound (e.g. 'T: Iterator`) so + // Remove any existing 'plain' bound (e.g., 'T: Iterator`) so // that we don't see a // duplicate bound like `T: Iterator + Iterator` // on the docs page. @@ -837,7 +827,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> AutoTraitFinder<'a, 'tcx, 'rcx, 'cstore> { // auto-trait impls always render in exactly the same way. // // Using the Debug implementation for sorting prevents us from needing to - // write quite a bit of almost entirely useless code (e.g. how should two + // write quite a bit of almost entirely useless code (e.g., how should two // Types be sorted relative to each other). It also allows us to solve the // problem for both WherePredicates and GenericBounds at the same time. This // approach is probably somewhat slower, but the small number of items diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index 8246c7bab27..ab8656fa47c 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc::hir; use rustc::traits; use rustc::ty::ToPredicate; @@ -21,12 +11,12 @@ use super::*; use self::def_ctor::{get_def_from_def_id, get_def_from_node_id}; -pub struct BlanketImplFinder<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> { - pub cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>, +pub struct BlanketImplFinder<'a, 'tcx: 'a, 'rcx: 'a> { + pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>, } -impl<'a, 'tcx, 'rcx, 'cstore> BlanketImplFinder <'a, 'tcx, 'rcx, 'cstore> { - pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self { +impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> { + pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> Self { BlanketImplFinder { cx } } @@ -38,7 +28,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> BlanketImplFinder <'a, 'tcx, 'rcx, 'cstore> { pub fn get_with_node_id(&self, id: ast::NodeId, name: String) -> Vec { get_def_from_node_id(&self.cx, id, name, &|def_ctor, name| { - let did = self.cx.tcx.hir.local_def_id(id); + let did = self.cx.tcx.hir().local_def_id(id); self.get_blanket_impls(did, &def_ctor, Some(name)) }) } diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index f90f1e54da2..c74a561e5a0 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -1,16 +1,7 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Representation of a `#[doc(cfg(...))]` attribute. -// FIXME: Once RFC #1868 is implemented, switch to use those structures instead. +// FIXME: Once the portability lint RFC is implemented (see tracking issue #41619), +// switch to use those structures instead. use std::mem; use std::fmt::{self, Write}; @@ -31,13 +22,13 @@ pub enum Cfg { True, /// Denies all configurations. False, - /// A generic configuration option, e.g. `test` or `target_os = "linux"`. + /// A generic configuration option, e.g., `test` or `target_os = "linux"`. Cfg(Symbol, Option), - /// Negate a configuration requirement, i.e. `not(x)`. + /// Negate a configuration requirement, i.e., `not(x)`. Not(Box), - /// Union of a list of configuration requirements, i.e. `any(...)`. + /// Union of a list of configuration requirements, i.e., `any(...)`. Any(Vec), - /// Intersection of a list of configuration requirements, i.e. `all(...)`. + /// Intersection of a list of configuration requirements, i.e., `all(...)`. All(Vec), } @@ -61,7 +52,7 @@ impl Cfg { /// Parses a `MetaItem` into a `Cfg`. /// - /// The `MetaItem` should be the content of the `#[cfg(...)]`, e.g. `unix` or + /// The `MetaItem` should be the content of the `#[cfg(...)]`, e.g., `unix` or /// `target_os = "redox"`. /// /// If the content is not properly formatted, it will return an error indicating what and where @@ -379,6 +370,7 @@ impl<'a> fmt::Display for Html<'a> { "pc" => "PC", "rumprun" => "Rumprun", "sun" => "Sun", + "fortanix" => "Fortanix", _ => "" }, ("target_env", Some(env)) => match &*env.as_str() { @@ -387,6 +379,7 @@ impl<'a> fmt::Display for Html<'a> { "musl" => "musl", "newlib" => "Newlib", "uclibc" => "uClibc", + "sgx" => "SGX", _ => "", }, ("target_endian", Some(endian)) => return write!(fmt, "{}-endian", endian), diff --git a/src/librustdoc/clean/def_ctor.rs b/src/librustdoc/clean/def_ctor.rs index cd9f4eb42df..fa480dcb932 100644 --- a/src/librustdoc/clean/def_ctor.rs +++ b/src/librustdoc/clean/def_ctor.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::DocContext; use super::*; @@ -54,7 +44,7 @@ pub fn get_def_from_node_id(cx: &DocContext, callback: &F, ) -> Vec where F: Fn(& dyn Fn(DefId) -> Def, String) -> Vec { - let item = &cx.tcx.hir.expect_item(id).node; + let item = &cx.tcx.hir().expect_item(id).node; callback(&match *item { hir::ItemKind::Struct(_, _) => Def::Struct, diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 49cecd5b04b..9cb21df713e 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Support for inlining external documentation into the current AST. use std::iter::once; @@ -207,7 +197,7 @@ pub fn build_external_trait(cx: &DocContext, did: DefId) -> clean::Trait { fn build_external_function(cx: &DocContext, did: DefId) -> clean::Function { let sig = cx.tcx.fn_sig(did); - let constness = if cx.tcx.is_const_fn(did) { + let constness = if cx.tcx.is_min_const_fn(did) { hir::Constness::Const } else { hir::Constness::NotConst @@ -303,8 +293,8 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec) { } } - let for_ = if let Some(nodeid) = tcx.hir.as_local_node_id(did) { - match tcx.hir.expect_item(nodeid).node { + let for_ = if let Some(nodeid) = tcx.hir().as_local_node_id(did) { + match tcx.hir().expect_item(nodeid).node { hir::ItemKind::Impl(.., ref t, _) => { t.clean(cx) } @@ -325,12 +315,12 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec) { } let predicates = tcx.predicates_of(did); - let (trait_items, generics) = if let Some(nodeid) = tcx.hir.as_local_node_id(did) { - match tcx.hir.expect_item(nodeid).node { + let (trait_items, generics) = if let Some(nodeid) = tcx.hir().as_local_node_id(did) { + match tcx.hir().expect_item(nodeid).node { hir::ItemKind::Impl(.., ref gen, _, _, ref item_ids) => { ( item_ids.iter() - .map(|ii| tcx.hir.impl_item(ii.id).clean(cx)) + .map(|ii| tcx.hir().impl_item(ii.id).clean(cx)) .collect::>(), gen.clean(cx), ) @@ -420,8 +410,8 @@ fn build_module(cx: &DocContext, did: DefId, visited: &mut FxHashSet) -> } pub fn print_inlined_const(cx: &DocContext, did: DefId) -> String { - if let Some(node_id) = cx.tcx.hir.as_local_node_id(did) { - cx.tcx.hir.node_to_pretty_string(node_id) + if let Some(node_id) = cx.tcx.hir().as_local_node_id(did) { + cx.tcx.hir().node_to_pretty_string(node_id) } else { cx.tcx.rendered_const(did) } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 0518d73e1e3..6eea95b61c9 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1,49 +1,38 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains the "cleaned" pieces of the AST, and the functions //! that clean them. -pub use self::Type::*; -pub use self::Mutability::*; -pub use self::ItemEnum::*; -pub use self::SelfTy::*; -pub use self::FunctionRetTy::*; -pub use self::Visibility::{Public, Inherited}; +pub mod inline; +pub mod cfg; +mod simplify; +mod auto_trait; +mod blanket_impl; +pub mod def_ctor; +use rustc_data_structures::indexed_vec::{IndexVec, Idx}; +use rustc_data_structures::sync::Lrc; use rustc_target::spec::abi::Abi; -use syntax::ast::{self, AttrStyle, Ident}; -use syntax::attr; -use syntax::ext::base::MacroKind; -use syntax::source_map::{dummy_spanned, Spanned}; -use syntax::ptr::P; -use syntax::symbol::keywords::{self, Keyword}; -use syntax::symbol::InternedString; -use syntax_pos::{self, DUMMY_SP, Pos, FileName}; - -use rustc::mir::interpret::ConstValue; +use rustc_typeck::hir_ty_to_ty; +use rustc::infer::region_constraints::{RegionConstraintData, Constraint}; use rustc::middle::resolve_lifetime as rl; -use rustc::ty::fold::TypeFolder; use rustc::middle::lang_items; +use rustc::middle::stability; use rustc::mir::interpret::GlobalId; use rustc::hir::{self, GenericArg, HirVec}; use rustc::hir::def::{self, Def, CtorKind}; use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::ty::subst::Substs; use rustc::ty::{self, TyCtxt, Region, RegionVid, Ty, AdtKind}; +use rustc::ty::fold::TypeFolder; use rustc::ty::layout::VariantIdx; -use rustc::middle::stability; use rustc::util::nodemap::{FxHashMap, FxHashSet}; -use rustc_typeck::hir_ty_to_ty; -use rustc::infer::region_constraints::{RegionConstraintData, Constraint}; -use rustc_data_structures::indexed_vec::{IndexVec, Idx}; +use syntax::ast::{self, AttrStyle, Ident}; +use syntax::attr; +use syntax::ext::base::MacroKind; +use syntax::source_map::{dummy_spanned, Spanned}; +use syntax::ptr::P; +use syntax::symbol::keywords::{self, Keyword}; +use syntax::symbol::InternedString; +use syntax_pos::{self, DUMMY_SP, Pos, FileName}; use std::collections::hash_map::Entry; use std::fmt; @@ -51,7 +40,6 @@ use std::hash::{Hash, Hasher}; use std::default::Default; use std::{mem, slice, vec}; use std::iter::{FromIterator, once}; -use rustc_data_structures::sync::Lrc; use std::rc::Rc; use std::str::FromStr; use std::cell::RefCell; @@ -66,17 +54,17 @@ use visit_ast; use html::render::{cache, ExternalLocation}; use html::item_type::ItemType; -pub mod inline; -pub mod cfg; -mod simplify; -mod auto_trait; -mod blanket_impl; -pub mod def_ctor; - use self::cfg::Cfg; use self::auto_trait::AutoTraitFinder; use self::blanket_impl::BlanketImplFinder; +pub use self::Type::*; +pub use self::Mutability::*; +pub use self::ItemEnum::*; +pub use self::SelfTy::*; +pub use self::FunctionRetTy::*; +pub use self::Visibility::{Public, Inherited}; + thread_local!(pub static MAX_DEF_ID: RefCell> = Default::default()); const FN_OUTPUT_NAME: &'static str = "Output"; @@ -150,7 +138,7 @@ pub struct Crate { pub masked_crates: FxHashSet, } -impl<'a, 'tcx, 'rcx, 'cstore> Clean for visit_ast::RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> { +impl<'a, 'tcx, 'rcx> Clean for visit_ast::RustdocVisitor<'a, 'tcx, 'rcx> { fn clean(&self, cx: &DocContext) -> Crate { use ::visit_lib::LibEmbargoVisitor; @@ -282,17 +270,17 @@ impl Clean for CrateNum { None }; let primitives = if root.is_local() { - cx.tcx.hir.krate().module.item_ids.iter().filter_map(|&id| { - let item = cx.tcx.hir.expect_item(id.id); + cx.tcx.hir().krate().module.item_ids.iter().filter_map(|&id| { + let item = cx.tcx.hir().expect_item(id.id); match item.node { hir::ItemKind::Mod(_) => { - as_primitive(Def::Mod(cx.tcx.hir.local_def_id(id.id))) + as_primitive(Def::Mod(cx.tcx.hir().local_def_id(id.id))) } hir::ItemKind::Use(ref path, hir::UseKind::Single) if item.vis.node.is_pub() => { as_primitive(path.def).map(|(_, prim, attrs)| { // Pretend the primitive is local. - (cx.tcx.hir.local_def_id(id.id), prim, attrs) + (cx.tcx.hir().local_def_id(id.id), prim, attrs) }) } _ => None @@ -324,16 +312,16 @@ impl Clean for CrateNum { None }; let keywords = if root.is_local() { - cx.tcx.hir.krate().module.item_ids.iter().filter_map(|&id| { - let item = cx.tcx.hir.expect_item(id.id); + cx.tcx.hir().krate().module.item_ids.iter().filter_map(|&id| { + let item = cx.tcx.hir().expect_item(id.id); match item.node { hir::ItemKind::Mod(_) => { - as_keyword(Def::Mod(cx.tcx.hir.local_def_id(id.id))) + as_keyword(Def::Mod(cx.tcx.hir().local_def_id(id.id))) } hir::ItemKind::Use(ref path, hir::UseKind::Single) if item.vis.node.is_pub() => { as_keyword(path.def).map(|(_, prim, attrs)| { - (cx.tcx.hir.local_def_id(id.id), prim, attrs) + (cx.tcx.hir().local_def_id(id.id), prim, attrs) }) } _ => None @@ -479,7 +467,7 @@ impl Item { classes.push("unstable"); } - if !s.deprecated_since.is_empty() { + if s.deprecation.is_some() { classes.push("deprecated"); } @@ -504,6 +492,15 @@ impl Item { pub fn type_(&self) -> ItemType { ItemType::from(self) } + + /// Returns the info in the item's `#[deprecated]` or `#[rustc_deprecated]` attributes. + /// + /// If the item is not deprecated, returns `None`. + pub fn deprecation(&self) -> Option<&Deprecation> { + self.deprecation + .as_ref() + .or_else(|| self.stability.as_ref().and_then(|s| s.deprecation.as_ref())) + } } #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] @@ -590,7 +587,7 @@ impl Clean for doctree::Module { let attrs = self.attrs.clean(cx); let mut items: Vec = vec![]; - items.extend(self.extern_crates.iter().map(|x| x.clean(cx))); + items.extend(self.extern_crates.iter().flat_map(|x| x.clean(cx))); items.extend(self.imports.iter().flat_map(|x| x.clean(cx))); items.extend(self.structs.iter().map(|x| x.clean(cx))); items.extend(self.unions.iter().map(|x| x.clean(cx))); @@ -629,7 +626,7 @@ impl Clean for doctree::Module { visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id(self.id), inner: ModuleItem(Module { is_crate: self.is_crate, items, @@ -708,8 +705,6 @@ impl> NestedAttributesExt for I { /// kept separate because of issue #42760. #[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Debug, Hash)] pub enum DocFragment { - // FIXME #44229 (misdreavus): sugared and raw doc comments can be brought back together once - // hoedown is completely removed from rustdoc. /// A doc fragment created from a `///` or `//!` doc comment. SugaredDoc(usize, syntax_pos::Span, String), /// A doc fragment created from a "raw" `#[doc=""]` attribute. @@ -1215,7 +1210,7 @@ impl Lifetime { impl Clean for hir::Lifetime { fn clean(&self, cx: &DocContext) -> Lifetime { if self.id != ast::DUMMY_NODE_ID { - let hir_id = cx.tcx.hir.node_to_hir_id(self.id); + let hir_id = cx.tcx.hir().node_to_hir_id(self.id); let def = cx.tcx.named_region(hir_id); match def { Some(rl::Region::EarlyBound(_, node_id, _)) | @@ -1473,7 +1468,7 @@ impl Clean for hir::GenericParam { } hir::GenericParamKind::Type { ref default, synthetic, .. } => { (self.name.ident().name.clean(cx), GenericParamDefKind::Type { - did: cx.tcx.hir.local_def_id(self.id), + did: cx.tcx.hir().local_def_id(self.id), bounds: self.bounds.clean(cx), default: default.clean(cx), synthetic: synthetic, @@ -1575,7 +1570,7 @@ impl<'a, 'tcx> Clean for (&'a ty::Generics, let stripped_typarams = gens.params.iter().filter_map(|param| match param.kind { ty::GenericParamDefKind::Lifetime => None, ty::GenericParamDefKind::Type { .. } => { - if param.name == keywords::SelfType.name().as_str() { + if param.name == keywords::SelfUpper.name().as_str() { assert_eq!(param.index, 0); return None; } @@ -1621,7 +1616,7 @@ impl<'a, 'tcx> Clean for (&'a ty::Generics, } // It would be nice to collect all of the bounds on a type and recombine - // them if possible, to avoid e.g. `where T: Foo, T: Bar, T: Sized, T: 'a` + // them if possible, to avoid e.g., `where T: Foo, T: Bar, T: Sized, T: 'a` // and instead see `where T: Foo + Bar + Sized + 'a` Generics { @@ -1677,6 +1672,12 @@ impl Clean for doctree::Function { (self.generics.clean(cx), (&self.decl, self.body).clean(cx)) }); + let did = cx.tcx.hir().local_def_id(self.id); + let constness = if cx.tcx.is_min_const_fn(did) { + hir::Constness::Const + } else { + hir::Constness::NotConst + }; Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -1684,11 +1685,11 @@ impl Clean for doctree::Function { visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: did, inner: FunctionItem(Function { decl, generics, - header: self.header, + header: hir::FnHeader { constness, ..self.header }, }), } } @@ -1733,7 +1734,7 @@ impl<'a> Clean for (&'a [hir::Ty], &'a [ast::Ident]) { impl<'a> Clean for (&'a [hir::Ty], hir::BodyId) { fn clean(&self, cx: &DocContext) -> Arguments { - let body = cx.tcx.hir.body(self.1); + let body = cx.tcx.hir().body(self.1); Arguments { values: self.0.iter().enumerate().map(|(i, ty)| { @@ -1762,7 +1763,7 @@ impl<'a, A: Copy> Clean for (&'a hir::FnDecl, A) impl<'a, 'tcx> Clean for (DefId, ty::PolyFnSig<'tcx>) { fn clean(&self, cx: &DocContext) -> FnDecl { let (did, sig) = *self; - let mut names = if cx.tcx.hir.as_local_node_id(did).is_some() { + let mut names = if cx.tcx.hir().as_local_node_id(did).is_some() { vec![].into_iter() } else { cx.tcx.fn_arg_names(did).into_iter() @@ -1857,7 +1858,7 @@ impl Clean for doctree::Trait { name: Some(self.name.clean(cx)), attrs: attrs, source: self.whence.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -1926,10 +1927,10 @@ impl Clean for hir::TraitItem { name: Some(self.ident.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.span.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id(self.id), visibility: None, - stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)), - deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)), + stability: get_stability(cx, cx.tcx.hir().local_def_id(self.id)), + deprecation: get_deprecation(cx, cx.tcx.hir().local_def_id(self.id)), inner, } } @@ -1958,10 +1959,10 @@ impl Clean for hir::ImplItem { name: Some(self.ident.name.clean(cx)), source: self.span.clean(cx), attrs: self.attrs.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id(self.id), visibility: self.vis.clean(cx), - stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)), - deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)), + stability: get_stability(cx, cx.tcx.hir().local_def_id(self.id)), + deprecation: get_deprecation(cx, cx.tcx.hir().local_def_id(self.id)), inner, } } @@ -2012,7 +2013,7 @@ impl<'tcx> Clean for ty::AssociatedItem { ty::TraitContainer(_) => self.defaultness.has_value() }; if provided { - let constness = if cx.tcx.is_const_fn(self.def_id) { + let constness = if cx.tcx.is_min_const_fn(self.def_id) { hir::Constness::Const } else { hir::Constness::NotConst @@ -2411,22 +2412,22 @@ impl Clean for hir::Ty { } TyKind::Slice(ref ty) => Slice(box ty.clean(cx)), TyKind::Array(ref ty, ref length) => { - let def_id = cx.tcx.hir.local_def_id(length.id); + let def_id = cx.tcx.hir().local_def_id(length.id); let param_env = cx.tcx.param_env(def_id); let substs = Substs::identity_for_item(cx.tcx, def_id); let cid = GlobalId { instance: ty::Instance::new(def_id, substs), promoted: None }; - let length = cx.tcx.const_eval(param_env.and(cid)).unwrap_or_else(|_| { - ty::Const::unevaluated(cx.tcx, def_id, substs, cx.tcx.types.usize) - }); - let length = print_const(cx, length); + let length = match cx.tcx.const_eval(param_env.and(cid)) { + Ok(length) => print_const(cx, ty::LazyConst::Evaluated(length)), + Err(_) => "_".to_string(), + }; Array(box ty.clean(cx), length) }, TyKind::Tup(ref tys) => Tuple(tys.clean(cx)), TyKind::Def(item_id, _) => { - let item = cx.tcx.hir.expect_item(item_id.id); + let item = cx.tcx.hir().expect_item(item_id.id); if let hir::ItemKind::Existential(ref ty) = item.node { ImplTrait(ty.bounds.clean(cx)) } else { @@ -2447,9 +2448,9 @@ impl Clean for hir::Ty { let mut alias = None; if let Def::TyAlias(def_id) = path.def { // Substitute private type aliases - if let Some(node_id) = cx.tcx.hir.as_local_node_id(def_id) { + if let Some(node_id) = cx.tcx.hir().as_local_node_id(def_id) { if !cx.renderinfo.borrow().access_levels.is_exported(def_id) { - alias = Some(&cx.tcx.hir.expect_item(node_id).node); + alias = Some(&cx.tcx.hir().expect_item(node_id).node); } } }; @@ -2479,7 +2480,7 @@ impl Clean for hir::Ty { if let Some(lt) = lifetime.cloned() { if !lt.is_elided() { let lt_def_id = - cx.tcx.hir.local_def_id(param.id); + cx.tcx.hir().local_def_id(param.id); lt_substs.insert(lt_def_id, lt.clean(cx)); } } @@ -2487,7 +2488,7 @@ impl Clean for hir::Ty { } hir::GenericParamKind::Type { ref default, .. } => { let ty_param_def = - Def::TyParam(cx.tcx.hir.local_def_id(param.id)); + Def::TyParam(cx.tcx.hir().local_def_id(param.id)); let mut j = 0; let type_ = generic_args.args.iter().find_map(|arg| { match arg { @@ -2581,15 +2582,15 @@ impl<'tcx> Clean for Ty<'tcx> { ty::Str => Primitive(PrimitiveType::Str), ty::Slice(ty) => Slice(box ty.clean(cx)), ty::Array(ty, n) => { - let mut n = cx.tcx.lift(&n).expect("array lift failed"); - if let ConstValue::Unevaluated(def_id, substs) = n.val { + let mut n = *cx.tcx.lift(&n).expect("array lift failed"); + if let ty::LazyConst::Unevaluated(def_id, substs) = n { let param_env = cx.tcx.param_env(def_id); let cid = GlobalId { instance: ty::Instance::new(def_id, substs), promoted: None }; if let Ok(new_n) = cx.tcx.const_eval(param_env.and(cid)) { - n = new_n; + n = ty::LazyConst::Evaluated(new_n); } }; let n = print_const(cx, n); @@ -2608,7 +2609,7 @@ impl<'tcx> Clean for Ty<'tcx> { BareFunction(box BareFunctionDecl { unsafety: sig.unsafety(), generic_params: Vec::new(), - decl: (cx.tcx.hir.local_def_id(ast::CRATE_NODE_ID), sig).clean(cx), + decl: (cx.tcx.hir().local_def_id(ast::CRATE_NODE_ID), sig).clean(cx), abi: sig.abi(), }) } @@ -2641,13 +2642,24 @@ impl<'tcx> Clean for Ty<'tcx> { } } ty::Dynamic(ref obj, ref reg) => { - let principal = obj.principal(); - let did = principal.def_id(); + // HACK: pick the first `did` as the `did` of the trait object. Someone + // might want to implement "native" support for marker-trait-only + // trait objects. + let mut dids = obj.principal_def_id().into_iter().chain(obj.auto_traits()); + let did = dids.next().unwrap_or_else(|| { + panic!("found trait object `{:?}` with no traits?", self) + }); + let substs = match obj.principal() { + Some(principal) => principal.skip_binder().substs, + // marker traits have no substs. + _ => cx.tcx.intern_substs(&[]) + }; + inline::record_extern_fqn(cx, did, TypeKind::Trait); let mut typarams = vec![]; reg.clean(cx).map(|b| typarams.push(GenericBound::Outlives(b))); - for did in obj.auto_traits() { + for did in dids { let empty = cx.tcx.intern_substs(&[]); let path = external_path(cx, &cx.tcx.item_name(did).as_str(), Some(did), false, vec![], empty); @@ -2673,7 +2685,7 @@ impl<'tcx> Clean for Ty<'tcx> { } let path = external_path(cx, &cx.tcx.item_name(did).as_str(), Some(did), - false, bindings, principal.skip_binder().substs); + false, bindings, substs); ResolvedPath { path, typarams: Some(typarams), @@ -2744,6 +2756,7 @@ impl<'tcx> Clean for Ty<'tcx> { ty::Closure(..) | ty::Generator(..) => Tuple(vec![]), // FIXME(pcwalton) ty::Bound(..) => panic!("Bound"), + ty::Placeholder(..) => panic!("Placeholder"), ty::UnnormalizedProjection(..) => panic!("UnnormalizedProjection"), ty::GeneratorWitness(..) => panic!("GeneratorWitness"), ty::Infer(..) => panic!("Infer"), @@ -2759,9 +2772,9 @@ impl Clean for hir::StructField { attrs: self.attrs.clean(cx), source: self.span.clean(cx), visibility: self.vis.clean(cx), - stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)), - deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)), - def_id: cx.tcx.hir.local_def_id(self.id), + stability: get_stability(cx, cx.tcx.hir().local_def_id(self.id)), + deprecation: get_deprecation(cx, cx.tcx.hir().local_def_id(self.id)), + def_id: cx.tcx.hir().local_def_id(self.id), inner: StructFieldItem(self.ty.clean(cx)), } } @@ -2833,7 +2846,7 @@ impl Clean for doctree::Struct { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -2853,7 +2866,7 @@ impl Clean for doctree::Union { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -2900,7 +2913,7 @@ impl Clean for doctree::Enum { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -2927,7 +2940,7 @@ impl Clean for doctree::Variant { visibility: None, stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.def.id()), + def_id: cx.tcx.hir().local_def_id(self.def.id()), inner: VariantItem(Variant { kind: self.def.clean(cx), }), @@ -2964,7 +2977,7 @@ impl<'tcx> Clean for ty::VariantDef { } }; Item { - name: Some(self.name.clean(cx)), + name: Some(self.ident.clean(cx)), attrs: inline::load_attrs(cx, self.did), source: cx.tcx.def_span(self.did).clean(cx), visibility: Some(Inherited), @@ -3007,7 +3020,7 @@ pub struct Span { impl Span { pub fn empty() -> Span { Span { - filename: FileName::Anon, + filename: FileName::Anon(0), loline: 0, locol: 0, hiline: 0, hicol: 0, } @@ -3173,20 +3186,29 @@ fn qpath_to_string(p: &hir::QPath) -> String { if i > 0 { s.push_str("::"); } - if seg.ident.name != keywords::CrateRoot.name() { + if seg.ident.name != keywords::PathRoot.name() { s.push_str(&*seg.ident.as_str()); } } s } +impl Clean for Ident { + #[inline] + fn clean(&self, cx: &DocContext) -> String { + self.name.clean(cx) + } +} + impl Clean for ast::Name { + #[inline] fn clean(&self, _: &DocContext) -> String { self.to_string() } } impl Clean for InternedString { + #[inline] fn clean(&self, _: &DocContext) -> String { self.to_string() } @@ -3204,7 +3226,7 @@ impl Clean for doctree::Typedef { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id.clone()), + def_id: cx.tcx.hir().local_def_id(self.id.clone()), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3228,7 +3250,7 @@ impl Clean for doctree::Existential { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id.clone()), + def_id: cx.tcx.hir().local_def_id(self.id.clone()), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3279,7 +3301,7 @@ impl Clean for doctree::Static { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3304,7 +3326,7 @@ impl Clean for doctree::Constant { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3404,7 +3426,7 @@ impl Clean> for doctree::Impl { name: None, attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3481,9 +3503,30 @@ fn build_deref_target_impls(cx: &DocContext, } } -impl Clean for doctree::ExternCrate { - fn clean(&self, cx: &DocContext) -> Item { - Item { +impl Clean> for doctree::ExternCrate { + fn clean(&self, cx: &DocContext) -> Vec { + + let please_inline = self.vis.node.is_pub() && self.attrs.iter().any(|a| { + a.name() == "doc" && match a.meta_item_list() { + Some(l) => attr::list_contains_name(&l, "inline"), + None => false, + } + }); + + if please_inline { + let mut visited = FxHashSet::default(); + + let def = Def::Mod(DefId { + krate: self.cnum, + index: CRATE_DEF_INDEX, + }); + + if let Some(items) = inline::try_inline(cx, def, self.name, &mut visited) { + return items; + } + } + + vec![Item { name: None, attrs: self.attrs.clean(cx), source: self.whence.clean(cx), @@ -3492,7 +3535,7 @@ impl Clean for doctree::ExternCrate { stability: None, deprecation: None, inner: ExternCrateItem(self.name.clean(cx), self.path.clone()) - } + }] } } @@ -3547,7 +3590,7 @@ impl Clean> for doctree::Import { name: None, attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir.local_def_id(ast::CRATE_NODE_ID), + def_id: cx.tcx.hir().local_def_id(ast::CRATE_NODE_ID), visibility: self.vis.clean(cx), stability: None, deprecation: None, @@ -3613,13 +3656,13 @@ impl Clean for hir::ForeignItem { }; Item { - name: Some(self.name.clean(cx)), + name: Some(self.ident.clean(cx)), attrs: self.attrs.clean(cx), source: self.span.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id(self.id), visibility: self.vis.clean(cx), - stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)), - deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)), + stability: get_stability(cx, cx.tcx.hir().local_def_id(self.id)), + deprecation: get_deprecation(cx, cx.tcx.hir().local_def_id(self.id)), inner, } } @@ -3679,16 +3722,16 @@ fn name_from_pat(p: &hir::Pat) -> String { } } -fn print_const(cx: &DocContext, n: &ty::Const) -> String { - match n.val { - ConstValue::Unevaluated(def_id, _) => { - if let Some(node_id) = cx.tcx.hir.as_local_node_id(def_id) { - print_const_expr(cx, cx.tcx.hir.body_owned_by(node_id)) +fn print_const(cx: &DocContext, n: ty::LazyConst) -> String { + match n { + ty::LazyConst::Unevaluated(def_id, _) => { + if let Some(node_id) = cx.tcx.hir().as_local_node_id(def_id) { + print_const_expr(cx, cx.tcx.hir().body_owned_by(node_id)) } else { inline::print_inlined_const(cx, def_id) } }, - _ => { + ty::LazyConst::Evaluated(n) => { let mut s = String::new(); ::rustc::mir::fmt_const_val(&mut s, n).expect("fmt_const_val failed"); // array lengths are obviously usize @@ -3702,7 +3745,7 @@ fn print_const(cx: &DocContext, n: &ty::Const) -> String { } fn print_const_expr(cx: &DocContext, body: hir::BodyId) -> String { - cx.tcx.hir.node_to_pretty_string(body.node_id) + cx.tcx.hir().node_to_pretty_string(body.node_id) } /// Given a type Path, resolve it to a Type using the TyCtxt @@ -3725,7 +3768,7 @@ fn resolve_type(cx: &DocContext, hir::Float(float_ty) => return Primitive(float_ty.into()), }, Def::SelfTy(..) if path.segments.len() == 1 => { - return Generic(keywords::SelfType.name().to_string()); + return Generic(keywords::SelfUpper.name().to_string()); } Def::TyParam(..) if path.segments.len() == 1 => { return Generic(format!("{:#}", path)); @@ -3828,7 +3871,7 @@ impl Clean for doctree::ProcMacro { visibility: Some(Public), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), - def_id: cx.tcx.hir.local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id(self.id), inner: ProcMacroItem(ProcMacro { kind: self.kind, helpers: self.helpers.clean(cx), @@ -3840,40 +3883,37 @@ impl Clean for doctree::ProcMacro { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Stability { pub level: stability::StabilityLevel, - pub feature: String, + pub feature: Option, pub since: String, - pub deprecated_since: String, - pub deprecated_reason: String, - pub unstable_reason: String, - pub issue: Option + pub deprecation: Option, + pub unstable_reason: Option, + pub issue: Option, } #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Deprecation { - pub since: String, - pub note: String, + pub since: Option, + pub note: Option, } impl Clean for attr::Stability { fn clean(&self, _: &DocContext) -> Stability { Stability { level: stability::StabilityLevel::from_attr_level(&self.level), - feature: self.feature.to_string(), + feature: Some(self.feature.to_string()).filter(|f| !f.is_empty()), since: match self.level { attr::Stable {ref since} => since.to_string(), _ => String::new(), }, - deprecated_since: match self.rustc_depr { - Some(attr::RustcDeprecation {ref since, ..}) => since.to_string(), - _=> String::new(), - }, - deprecated_reason: match self.rustc_depr { - Some(ref depr) => depr.reason.to_string(), - _ => String::new(), - }, + deprecation: self.rustc_depr.as_ref().map(|d| { + Deprecation { + note: Some(d.reason.to_string()).filter(|r| !r.is_empty()), + since: Some(d.since.to_string()).filter(|d| !d.is_empty()), + } + }), unstable_reason: match self.level { - attr::Unstable { reason: Some(ref reason), .. } => reason.to_string(), - _ => String::new(), + attr::Unstable { reason: Some(ref reason), .. } => Some(reason.to_string()), + _ => None, }, issue: match self.level { attr::Unstable {issue, ..} => Some(issue), @@ -3892,13 +3932,13 @@ impl<'a> Clean for &'a attr::Stability { impl Clean for attr::Deprecation { fn clean(&self, _: &DocContext) -> Deprecation { Deprecation { - since: self.since.as_ref().map_or(String::new(), |s| s.to_string()), - note: self.note.as_ref().map_or(String::new(), |s| s.to_string()), + since: self.since.map(|s| s.to_string()).filter(|s| !s.is_empty()), + note: self.note.map(|n| n.to_string()).filter(|n| !n.is_empty()), } } } -/// An equality constraint on an associated type, e.g. `A=Bar` in `Foo` +/// An equality constraint on an associated type, e.g., `A=Bar` in `Foo` #[derive(Clone, PartialEq, Eq, RustcDecodable, RustcEncodable, Debug, Hash)] pub struct TypeBinding { pub name: String, @@ -3942,21 +3982,18 @@ where // Start of code copied from rust-clippy pub fn path_to_def_local(tcx: &TyCtxt, path: &[&str]) -> Option { - let krate = tcx.hir.krate(); + let krate = tcx.hir().krate(); let mut items = krate.module.item_ids.clone(); let mut path_it = path.iter().peekable(); loop { - let segment = match path_it.next() { - Some(segment) => segment, - None => return None, - }; + let segment = path_it.next()?; for item_id in mem::replace(&mut items, HirVec::new()).iter() { - let item = tcx.hir.expect_item(item_id.id); - if item.name == *segment { + let item = tcx.hir().expect_item(item_id.id); + if item.ident.name == *segment { if path_it.peek().is_none() { - return Some(tcx.hir.local_def_id(item_id.id)) + return Some(tcx.hir().local_def_id(item_id.id)) } items = match &item.node { @@ -3985,10 +4022,7 @@ pub fn path_to_def(tcx: &TyCtxt, path: &[&str]) -> Option { let mut path_it = path.iter().skip(1).peekable(); loop { - let segment = match path_it.next() { - Some(segment) => segment, - None => return None, - }; + let segment = path_it.next()?; for item in mem::replace(&mut items, Lrc::new(vec![])).iter() { if item.ident.name == *segment { diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs index 635608d140d..31e842b3389 100644 --- a/src/librustdoc/clean/simplify.rs +++ b/src/librustdoc/clean/simplify.rs @@ -1,18 +1,8 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Simplification of where clauses and parameter bounds into a prettier and //! more canonical form. //! //! Currently all cross-crate-inlined function use `rustc::ty` to reconstruct -//! the AST (e.g. see all of `clean::inline`), but this is not always a +//! the AST (e.g., see all of `clean::inline`), but this is not always a //! non-lossy transformation. The current format of storage for where clauses //! for functions and such is simply a list of predicates. One example of this //! is that the AST predicate of: `where T: Trait` is encoded as: diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index f4d05c6dbd6..635d071b8e0 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::{BTreeMap, BTreeSet}; use std::fmt; use std::path::PathBuf; @@ -20,7 +10,7 @@ use rustc::session::early_error; use rustc::session::config::{CodegenOptions, DebuggingOptions, ErrorOutputType, Externs}; use rustc::session::config::{nightly_options, build_codegen_options, build_debugging_options, get_cmd_lint_options}; -use rustc::session::search_paths::SearchPaths; +use rustc::session::search_paths::SearchPath; use rustc_driver; use rustc_target::spec::TargetTriple; use syntax::edition::Edition; @@ -46,7 +36,7 @@ pub struct Options { /// How to format errors and warnings. pub error_format: ErrorOutputType, /// Library search paths to hand to the compiler. - pub libs: SearchPaths, + pub libs: Vec, /// The list of external crates to link against. pub externs: Externs, /// List of `cfg` flags to hand to the compiler. Always includes `rustdoc`. @@ -78,6 +68,9 @@ pub struct Options { pub should_test: bool, /// List of arguments to pass to the test harness, if running tests. pub test_args: Vec, + /// Optional path to persist the doctest executables to, defaults to a + /// temporary directory if not set. + pub persist_doctests: Option, // Options that affect the documentation process @@ -131,6 +124,7 @@ impl fmt::Debug for Options { .field("lint_cap", &self.lint_cap) .field("should_test", &self.should_test) .field("test_args", &self.test_args) + .field("persist_doctests", &self.persist_doctests) .field("default_passes", &self.default_passes) .field("manual_passes", &self.manual_passes) .field("display_warnings", &self.display_warnings) @@ -181,6 +175,9 @@ pub struct RenderOptions { /// A file to use as the index page at the root of the output directory. Overrides /// `enable_index_page` to be true if set. pub index_page: Option, + /// An optional path to use as the location of static files. If not set, uses combinations of + /// `../` to reach the documentation root. + pub static_root_path: Option, // Options specific to reading standalone Markdown files @@ -192,6 +189,9 @@ pub struct RenderOptions { /// If present, playground URL to use in the "Run" button added to code samples generated from /// standalone Markdown files. If not present, `playground_url` is used. pub markdown_playground_url: Option, + /// If false, the `select` element to have search filtering by crates on rendered docs + /// won't be generated. + pub generate_search_filter: bool, } impl Options { @@ -295,10 +295,9 @@ impl Options { } let input = PathBuf::from(&matches.free[0]); - let mut libs = SearchPaths::new(); - for s in &matches.opt_strs("L") { - libs.add_path(s, error_format); - } + let libs = matches.opt_strs("L").iter() + .map(|s| SearchPath::from_cli_opt(s, error_format)) + .collect(); let externs = match parse_externs(&matches) { Ok(ex) => ex, Err(err) => { @@ -434,6 +433,9 @@ impl Options { let markdown_playground_url = matches.opt_str("markdown-playground-url"); let crate_version = matches.opt_str("crate-version"); let enable_index_page = matches.opt_present("enable-index-page") || index_page.is_some(); + let static_root_path = matches.opt_str("static-root-path"); + let generate_search_filter = !matches.opt_present("disable-per-crate-search"); + let persist_doctests = matches.opt_str("persist-doctests").map(PathBuf::from); let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format); @@ -459,6 +461,7 @@ impl Options { manual_passes, display_warnings, crate_version, + persist_doctests, render_options: RenderOptions { output, external_html, @@ -472,9 +475,11 @@ impl Options { enable_minification, enable_index_page, index_page, + static_root_path, markdown_no_toc, markdown_css, markdown_playground_url, + generate_search_filter, } }) } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 0bd6f6bf8a2..7069f04fe18 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_lint; use rustc_driver::{self, driver, target_features, abort_on_err}; use rustc::session::{self, config}; @@ -33,7 +23,7 @@ use syntax::json::JsonEmitter; use syntax::ptr::P; use syntax::symbol::keywords; use syntax_pos::DUMMY_SP; -use errors; +use errors::{self, FatalError}; use errors::emitter::{Emitter, EmitterWriter}; use parking_lot::ReentrantMutex; @@ -51,19 +41,16 @@ use html::render::RenderInfo; use passes; pub use rustc::session::config::{Input, Options, CodegenOptions}; -pub use rustc::session::search_paths::SearchPaths; +pub use rustc::session::search_paths::SearchPath; pub type ExternalPaths = FxHashMap, clean::TypeKind)>; -pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> { +pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a> { pub tcx: TyCtxt<'a, 'tcx, 'tcx>, - pub resolver: &'a RefCell>, + pub resolver: &'a RefCell>, /// The stack of module NodeIds up till this point pub crate_name: Option, pub cstore: Rc, - // Note that external items for which `doc(hidden)` applies to are shown as - // non-reachable while local items aren't. This is because we're reusing - // the access levels from crateanalysis. /// Later on moved into `html::render::CACHE_KEY` pub renderinfo: RefCell, /// Later on moved through `clean::Crate` into `html::render::CACHE_KEY` @@ -88,7 +75,7 @@ pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> { pub all_traits: Vec, } -impl<'a, 'tcx, 'rcx, 'cstore> DocContext<'a, 'tcx, 'rcx, 'cstore> { +impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { pub fn sess(&self) -> &session::Session { &self.tcx.sess } @@ -121,7 +108,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> DocContext<'a, 'tcx, 'rcx, 'cstore> { let start_def_id = { let next_id = if crate_num == LOCAL_CRATE { self.tcx - .hir + .hir() .definitions() .def_path_table() .next_id(DefIndexAddressSpace::Low) @@ -168,7 +155,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> DocContext<'a, 'tcx, 'rcx, 'cstore> { if self.all_fake_def_ids.borrow().contains(&def_id) { None } else { - self.tcx.hir.as_local_node_id(def_id) + self.tcx.hir().as_local_node_id(def_id) } } @@ -351,13 +338,15 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt let warnings_lint_name = lint::builtin::WARNINGS.name; let missing_docs = rustc_lint::builtin::MISSING_DOCS.name; let missing_doc_example = rustc_lint::builtin::MISSING_DOC_CODE_EXAMPLES.name; + let private_doc_tests = rustc_lint::builtin::PRIVATE_DOC_TESTS.name; // In addition to those specific lints, we also need to whitelist those given through // command line, otherwise they'll get ignored and we don't want that. let mut whitelisted_lints = vec![warnings_lint_name.to_owned(), intra_link_resolution_failure_name.to_owned(), missing_docs.to_owned(), - missing_doc_example.to_owned()]; + missing_doc_example.to_owned(), + private_doc_tests.to_owned()]; whitelisted_lints.extend(lint_opts.iter().map(|(lint, _)| lint).cloned()); @@ -437,7 +426,13 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt let control = &driver::CompileController::basic(); - let krate = panictry!(driver::phase_1_parse_input(control, &sess, &input)); + let krate = match driver::phase_1_parse_input(control, &sess, &input) { + Ok(krate) => krate, + Err(mut e) => { + e.emit(); + FatalError.raise(); + } + }; let name = match crate_name { Some(ref crate_name) => crate_name.clone(), @@ -453,7 +448,6 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt None, &name, None, - resolve::MakeGlobMap::No, &resolver_arenas, &mut crate_loader, |_| Ok(())); @@ -471,19 +465,15 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt freevars: resolver.freevars.clone(), export_map: resolver.export_map.clone(), trait_map: resolver.trait_map.clone(), + glob_map: resolver.glob_map.clone(), maybe_unused_trait_imports: resolver.maybe_unused_trait_imports.clone(), maybe_unused_extern_crates: resolver.maybe_unused_extern_crates.clone(), extern_prelude: resolver.extern_prelude.iter().map(|(ident, entry)| { (ident.name, entry.introduced_by_item) }).collect(), }; - let analysis = ty::CrateAnalysis { - access_levels: Lrc::new(AccessLevels::default()), - name: name.to_string(), - glob_map: if resolver.make_glob_map { Some(resolver.glob_map.clone()) } else { None }, - }; - let arenas = AllArenas::new(); + let mut arenas = AllArenas::new(); let hir_map = hir_map::map_crate(&sess, &*cstore, &mut hir_forest, &defs); let output_filenames = driver::build_output_filenames(&input, &None, @@ -497,23 +487,22 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt &sess, &*cstore, hir_map, - analysis, resolutions, - &arenas, + &mut arenas, &name, &output_filenames, - |tcx, analysis, _, result| { + |tcx, _, result| { if result.is_err() { sess.fatal("Compilation failed, aborting rustdoc"); } - let ty::CrateAnalysis { access_levels, .. } = analysis; + let access_levels = tcx.privacy_access_levels(LOCAL_CRATE); // Convert from a NodeId set to a DefId set since we don't always have easy access // to the map from defid -> nodeid let access_levels = AccessLevels { map: access_levels.map.iter() - .map(|(&k, &v)| (tcx.hir.local_def_id(k), v)) + .map(|(&k, &v)| (tcx.hir().local_def_id(k), v)) .collect() }; @@ -543,11 +532,11 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt generated_synthetics: Default::default(), all_traits: tcx.all_traits(LOCAL_CRATE).to_vec(), }; - debug!("crate: {:?}", tcx.hir.krate()); + debug!("crate: {:?}", tcx.hir().krate()); let mut krate = { let mut v = RustdocVisitor::new(&ctxt); - v.visit(tcx.hir.krate()); + v.visit(tcx.hir().krate()); v.clean(&ctxt) }; diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index 4a6a4ee09ea..cc27da70b16 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module is used to store stuff from Rust's AST in a more convenient //! manner (and with prettier names) before cleaning. pub use self::StructType::*; diff --git a/src/librustdoc/externalfiles.rs b/src/librustdoc/externalfiles.rs index c7a2dd6da3f..19d3f09af1a 100644 --- a/src/librustdoc/externalfiles.rs +++ b/src/librustdoc/externalfiles.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fs; use std::path::Path; use std::str; diff --git a/src/librustdoc/fold.rs b/src/librustdoc/fold.rs index b8e27c53170..da8c822c5d8 100644 --- a/src/librustdoc/fold.rs +++ b/src/librustdoc/fold.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use clean::*; pub struct StripItem(pub Item); diff --git a/src/librustdoc/html/escape.rs b/src/librustdoc/html/escape.rs index 1173e6447f5..690bcd8c070 100644 --- a/src/librustdoc/html/escape.rs +++ b/src/librustdoc/html/escape.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! HTML Escaping //! //! This module contains one unit-struct which can be used to HTML-escape a diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 445fc2e833a..5a3e6984859 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! HTML formatting module //! //! This module contains a large number of `fmt::Display` implementations for diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 6522261fe1e..e43251b7d5f 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Basic syntax highlighting functionality. //! //! This module uses libsyntax's lexer to provide token-based highlighting for @@ -35,40 +25,51 @@ pub fn render_with_highlighting( tooltip: Option<(&str, &str)>, ) -> String { debug!("highlighting: ================\n{}\n==============", src); - let sess = parse::ParseSess::new(FilePathMapping::empty()); - let fm = sess.source_map().new_source_file(FileName::Custom("stdin".to_string()), - src.to_string()); - let mut out = Vec::new(); if let Some((tooltip, class)) = tooltip { write!(out, "

", class, tooltip).unwrap(); } - write_header(class, &mut out).unwrap(); - - let lexer = match lexer::StringReader::new_without_err(&sess, fm, None, "Output from rustc:") { - Ok(l) => l, - Err(_) => { - let first_line = src.lines().next().unwrap_or_else(|| ""); - let mut err = sess.span_diagnostic - .struct_warn(&format!("Invalid doc comment starting with: `{}`\n\ - (Ignoring this codeblock)", - first_line)); - err.emit(); - return String::new(); + + let sess = parse::ParseSess::new(FilePathMapping::empty()); + let fm = sess.source_map().new_source_file( + FileName::Custom(String::from("rustdoc-highlighting")), + src.to_owned(), + ); + let highlight_result = + lexer::StringReader::new_or_buffered_errs(&sess, fm, None).and_then(|lexer| { + let mut classifier = Classifier::new(lexer, sess.source_map()); + + let mut highlighted_source = vec![]; + if classifier.write_source(&mut highlighted_source).is_err() { + Err(classifier.lexer.buffer_fatal_errors()) + } else { + Ok(String::from_utf8_lossy(&highlighted_source).into_owned()) + } + }); + + match highlight_result { + Ok(highlighted_source) => { + write_header(class, &mut out).unwrap(); + write!(out, "{}", highlighted_source).unwrap(); + if let Some(extension) = extension { + write!(out, "{}", extension).unwrap(); + } + write_footer(&mut out).unwrap(); } - }; - let mut classifier = Classifier::new(lexer, sess.source_map()); - if classifier.write_source(&mut out).is_err() { - classifier.lexer.emit_fatal_errors(); - return format!("
{}
", src); - } + Err(errors) => { + // If errors are encountered while trying to highlight, cancel the errors and just emit + // the unhighlighted source. The errors will have already been reported in the + // `check-code-block-syntax` pass. + for mut error in errors { + error.cancel(); + } - if let Some(extension) = extension { - write!(out, "{}", extension).unwrap(); + write!(out, "
{}
", src).unwrap(); + } } - write_footer(&mut out).unwrap(); + String::from_utf8_lossy(&out[..]).into_owned() } @@ -161,6 +162,17 @@ impl Writer for U { } } +enum HighlightError { + LexError, + IoError(io::Error), +} + +impl From for HighlightError { + fn from(err: io::Error) -> Self { + HighlightError::IoError(err) + } +} + impl<'a> Classifier<'a> { fn new(lexer: lexer::StringReader<'a>, source_map: &'a SourceMap) -> Classifier<'a> { Classifier { @@ -172,17 +184,11 @@ impl<'a> Classifier<'a> { } } - /// Gets the next token out of the lexer, emitting fatal errors if lexing fails. - fn try_next_token(&mut self) -> io::Result { + /// Gets the next token out of the lexer. + fn try_next_token(&mut self) -> Result { match self.lexer.try_next_token() { Ok(tas) => Ok(tas), - Err(_) => { - let mut err = self.lexer.sess.span_diagnostic - .struct_warn("Backing out of syntax highlighting"); - err.note("You probably did not intend to render this as a rust code-block"); - err.emit(); - Err(io::Error::new(io::ErrorKind::Other, "")) - } + Err(_) => Err(HighlightError::LexError), } } @@ -195,7 +201,7 @@ impl<'a> Classifier<'a> { /// source. fn write_source(&mut self, out: &mut W) - -> io::Result<()> { + -> Result<(), HighlightError> { loop { let next = self.try_next_token()?; if next.tok == token::Eof { @@ -212,7 +218,7 @@ impl<'a> Classifier<'a> { fn write_token(&mut self, out: &mut W, tas: TokenAndSpan) - -> io::Result<()> { + -> Result<(), HighlightError> { let klass = match tas.tok { token::Shebang(s) => { out.string(Escape(&s.as_str()), Class::None)?; @@ -306,7 +312,7 @@ impl<'a> Classifier<'a> { token::Literal(lit, _suf) => { match lit { // Text literals. - token::Byte(..) | token::Char(..) | + token::Byte(..) | token::Char(..) | token::Err(..) | token::ByteStr(..) | token::ByteStrRaw(..) | token::Str_(..) | token::StrRaw(..) => Class::String, @@ -346,12 +352,14 @@ impl<'a> Classifier<'a> { token::Lifetime(..) => Class::Lifetime, token::Eof | token::Interpolated(..) | - token::Tilde | token::At | token::DotEq | token::SingleQuote => Class::None, + token::Tilde | token::At| token::SingleQuote => Class::None, }; // Anything that didn't return above is the simple case where we the // class just spans a single token, so we can use the `string` method. - out.string(Escape(&self.snip(tas.sp)), klass) + out.string(Escape(&self.snip(tas.sp)), klass)?; + + Ok(()) } // Helper function to get a snippet from the source_map. diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs index acb8f6a66df..e20d385c487 100644 --- a/src/librustdoc/html/item_type.rs +++ b/src/librustdoc/html/item_type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Item types. use std::fmt; diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index 6868c7707ad..c34dcbbb672 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; use std::io; use std::path::PathBuf; @@ -26,16 +16,25 @@ pub struct Page<'a> { pub title: &'a str, pub css_class: &'a str, pub root_path: &'a str, + pub static_root_path: Option<&'a str>, pub description: &'a str, pub keywords: &'a str, pub resource_suffix: &'a str, + pub extra_scripts: &'a [&'a str], + pub static_extra_scripts: &'a [&'a str], } pub fn render( - dst: &mut dyn io::Write, layout: &Layout, page: &Page, sidebar: &S, t: &T, - css_file_extension: bool, themes: &[PathBuf]) - -> io::Result<()> -{ + dst: &mut dyn io::Write, + layout: &Layout, + page: &Page, + sidebar: &S, + t: &T, + css_file_extension: bool, + themes: &[PathBuf], + generate_search_filter: bool, +) -> io::Result<()> { + let static_root_path = page.static_root_path.unwrap_or(page.root_path); write!(dst, "\ \ @@ -46,17 +45,21 @@ pub fn render( \ \ {title}\ - \ - \ + \ {themes}\ - \ - \ + \ - \ + \ + \ {css_extension}\ {favicon}\ {in_header}\ + \ \ \ /---------\ next ---, + // | |head_tail| | + // `--- prev \---------/ <-------` + assert_eq!(self.head_tail.as_ref().prev, first); + true + } else { + false + } + } else { + true + } + } + } + + /// Pushes an entry onto the back of the list. + /// + /// # Safety + /// + /// The entry must remain allocated until the entry is removed from the + /// list AND the caller who popped is done using the entry. + pub unsafe fn push<'a>(&mut self, entry: &'a mut UnsafeListEntry) -> &'a T { + self.init(); + + // BEFORE: + // /---------\ next ---> /---------\ + // ... |prev_tail| |head_tail| ... + // \---------/ <--- prev \---------/ + // + // AFTER: + // /---------\ next ---> /-----\ next ---> /---------\ + // ... |prev_tail| |entry| |head_tail| ... + // \---------/ <--- prev \-----/ <--- prev \---------/ + let mut entry = NonNull::new_unchecked(entry); + let mut prev_tail = mem::replace(&mut self.head_tail.as_mut().prev, entry); + entry.as_mut().prev = prev_tail; + entry.as_mut().next = self.head_tail; + prev_tail.as_mut().next = entry; + (*entry.as_ptr()).value.as_ref().unwrap() + } + + /// Pops an entry from the front of the list. + /// + /// # Safety + /// + /// The caller must make sure to synchronize ending the borrow of the + /// return value and deallocation of the containing entry. + pub unsafe fn pop<'a>(&mut self) -> Option<&'a T> { + self.init(); + + if self.is_empty() { + None + } else { + // BEFORE: + // /---------\ next ---> /-----\ next ---> /------\ + // ... |head_tail| |first| |second| ... + // \---------/ <--- prev \-----/ <--- prev \------/ + // + // AFTER: + // /---------\ next ---> /------\ + // ... |head_tail| |second| ... + // \---------/ <--- prev \------/ + let mut first = self.head_tail.as_mut().next; + let mut second = first.as_mut().next; + self.head_tail.as_mut().next = second; + second.as_mut().prev = self.head_tail; + first.as_mut().next = NonNull::dangling(); + first.as_mut().prev = NonNull::dangling(); + Some((*first.as_ptr()).value.as_ref().unwrap()) + } + } + } + + #[cfg(test)] + mod tests { + use super::*; + use cell::Cell; + + unsafe fn assert_empty(list: &mut UnsafeList) { + assert!(list.pop().is_none(), "assertion failed: list is not empty"); + } + + #[test] + fn init_empty() { + unsafe { + assert_empty(&mut UnsafeList::::new()); + } + } + + #[test] + fn push_pop() { + unsafe { + let mut node = UnsafeListEntry::new(1234); + let mut list = UnsafeList::new(); + assert_eq!(list.push(&mut node), &1234); + assert_eq!(list.pop().unwrap(), &1234); + assert_empty(&mut list); + } + } + + #[test] + fn complex_pushes_pops() { + unsafe { + let mut node1 = UnsafeListEntry::new(1234); + let mut node2 = UnsafeListEntry::new(4567); + let mut node3 = UnsafeListEntry::new(9999); + let mut node4 = UnsafeListEntry::new(8642); + let mut list = UnsafeList::new(); + list.push(&mut node1); + list.push(&mut node2); + assert_eq!(list.pop().unwrap(), &1234); + list.push(&mut node3); + assert_eq!(list.pop().unwrap(), &4567); + assert_eq!(list.pop().unwrap(), &9999); + assert_empty(&mut list); + list.push(&mut node4); + assert_eq!(list.pop().unwrap(), &8642); + assert_empty(&mut list); + } + } + + #[test] + fn cell() { + unsafe { + let mut node = UnsafeListEntry::new(Cell::new(0)); + let mut list = UnsafeList::new(); + let noderef = list.push(&mut node); + assert_eq!(noderef.get(), 0); + list.pop().unwrap().set(1); + assert_empty(&mut list); + assert_eq!(noderef.get(), 1); + } + } + } +} + +/// Trivial spinlock-based implementation of `sync::Mutex`. +// FIXME: Perhaps use Intel TSX to avoid locking? +mod spin_mutex { + use cell::UnsafeCell; + use sync::atomic::{AtomicBool, Ordering, spin_loop_hint}; + use ops::{Deref, DerefMut}; + + #[derive(Default)] + pub struct SpinMutex { + value: UnsafeCell, + lock: AtomicBool, + } + + unsafe impl Send for SpinMutex {} + unsafe impl Sync for SpinMutex {} + + pub struct SpinMutexGuard<'a, T: 'a> { + mutex: &'a SpinMutex, + } + + impl<'a, T> !Send for SpinMutexGuard<'a, T> {} + unsafe impl<'a, T: Sync> Sync for SpinMutexGuard<'a, T> {} + + impl SpinMutex { + pub const fn new(value: T) -> Self { + SpinMutex { + value: UnsafeCell::new(value), + lock: AtomicBool::new(false) + } + } + + #[inline(always)] + pub fn lock(&self) -> SpinMutexGuard { + loop { + match self.try_lock() { + None => while self.lock.load(Ordering::Relaxed) { + spin_loop_hint() + }, + Some(guard) => return guard + } + } + } + + #[inline(always)] + pub fn try_lock(&self) -> Option> { + if !self.lock.compare_and_swap(false, true, Ordering::Acquire) { + Some(SpinMutexGuard { + mutex: self, + }) + } else { + None + } + } + } + + /// Lock the Mutex or return false. + pub macro try_lock_or_false { + ($e:expr) => { + if let Some(v) = $e.try_lock() { + v + } else { + return false + } + } + } + + impl<'a, T> Deref for SpinMutexGuard<'a, T> { + type Target = T; + + fn deref(&self) -> &T { + unsafe { + &*self.mutex.value.get() + } + } + } + + impl<'a, T> DerefMut for SpinMutexGuard<'a, T> { + fn deref_mut(&mut self) -> &mut T { + unsafe { + &mut*self.mutex.value.get() + } + } + } + + impl<'a, T> Drop for SpinMutexGuard<'a, T> { + fn drop(&mut self) { + self.mutex.lock.store(false, Ordering::Release) + } + } + + #[cfg(test)] + mod tests { + #![allow(deprecated)] + + use super::*; + use sync::Arc; + use thread; + + #[test] + fn sleep() { + let mutex = Arc::new(SpinMutex::::default()); + let mutex2 = mutex.clone(); + let guard = mutex.lock(); + let t1 = thread::spawn(move || { + *mutex2.lock() = 1; + }); + thread::sleep_ms(50); + assert_eq!(*guard, 0); + drop(guard); + t1.join().unwrap(); + assert_eq!(*mutex.lock(), 1); + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use sync::Arc; + use thread; + + #[test] + fn queue() { + let wq = Arc::new(SpinMutex::>::default()); + let wq2 = wq.clone(); + + let locked = wq.lock(); + + let t1 = thread::spawn(move || { + assert!(WaitQueue::notify_one(wq2.lock()).is_none()) + }); + + WaitQueue::wait(locked); + + t1.join().unwrap(); + } +} diff --git a/src/libstd/sys/unix/alloc.rs b/src/libstd/sys/unix/alloc.rs index 2a7f1934518..93e8e0e6696 100644 --- a/src/libstd/sys/unix/alloc.rs +++ b/src/libstd/sys/unix/alloc.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ptr; use libc; use sys_common::alloc::{MIN_ALIGN, realloc_fallback}; diff --git a/src/libstd/sys/unix/android.rs b/src/libstd/sys/unix/android.rs index 10436723a81..986fa27ede6 100644 --- a/src/libstd/sys/unix/android.rs +++ b/src/libstd/sys/unix/android.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Android ABI-compatibility module //! //! The ABI of Android has changed quite a bit over time, and libstd attempts to @@ -15,7 +5,7 @@ //! always work with the most recent version of Android, but we also want to //! work with older versions of Android for whenever projects need to. //! -//! Our current minimum supported Android version is `android-9`, e.g. Android +//! Our current minimum supported Android version is `android-9`, e.g., Android //! with API level 9. We then in theory want to work on that and all future //! versions of Android! //! diff --git a/src/libstd/sys/unix/args.rs b/src/libstd/sys/unix/args.rs index c3c033dfbc7..db1c5f4fea5 100644 --- a/src/libstd/sys/unix/args.rs +++ b/src/libstd/sys/unix/args.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Global initialization and retrieval of command line arguments. //! //! On some platforms these are stored during runtime startup, diff --git a/src/libstd/sys/unix/backtrace/mod.rs b/src/libstd/sys/unix/backtrace/mod.rs index b5bf20c747b..79c3e39d8f8 100644 --- a/src/libstd/sys/unix/backtrace/mod.rs +++ b/src/libstd/sys/unix/backtrace/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Backtrace support built on libgcc with some extra OS-specific support /// /// Some methods of getting a backtrace: diff --git a/src/libstd/sys/unix/backtrace/printing/dladdr.rs b/src/libstd/sys/unix/backtrace/printing/dladdr.rs index bc56fd6594e..09715db8c1a 100644 --- a/src/libstd/sys/unix/backtrace/printing/dladdr.rs +++ b/src/libstd/sys/unix/backtrace/printing/dladdr.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use io; use intrinsics; use ffi::CStr; diff --git a/src/libstd/sys/unix/backtrace/printing/mod.rs b/src/libstd/sys/unix/backtrace/printing/mod.rs index caa60712b1d..d0303e6995f 100644 --- a/src/libstd/sys/unix/backtrace/printing/mod.rs +++ b/src/libstd/sys/unix/backtrace/printing/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod dladdr; use sys::backtrace::BacktraceContext; diff --git a/src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs b/src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs index 6293eeb4ed6..236762c5eb5 100644 --- a/src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs +++ b/src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// As always - iOS on arm uses SjLj exceptions and /// _Unwind_Backtrace is even not available there. Still, /// backtraces could be extracted using a backtrace function, diff --git a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs index 6e841568679..72a7968c514 100644 --- a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs +++ b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use error::Error; use io; use libc; diff --git a/src/libstd/sys/unix/backtrace/tracing/mod.rs b/src/libstd/sys/unix/backtrace/tracing/mod.rs index c9c8e260d2f..11863e64545 100644 --- a/src/libstd/sys/unix/backtrace/tracing/mod.rs +++ b/src/libstd/sys/unix/backtrace/tracing/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use self::imp::*; #[cfg(not(all(target_os = "ios", target_arch = "arm")))] diff --git a/src/libstd/sys/unix/cmath.rs b/src/libstd/sys/unix/cmath.rs index 2bc96651b0c..f6bb58934fc 100644 --- a/src/libstd/sys/unix/cmath.rs +++ b/src/libstd/sys/unix/cmath.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![cfg(not(test))] use libc::{c_float, c_double}; diff --git a/src/libstd/sys/unix/condvar.rs b/src/libstd/sys/unix/condvar.rs index 2007da7b1f6..3e048d5c6e4 100644 --- a/src/libstd/sys/unix/condvar.rs +++ b/src/libstd/sys/unix/condvar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cell::UnsafeCell; use libc; use sys::mutex::{self, Mutex}; diff --git a/src/libstd/sys/unix/env.rs b/src/libstd/sys/unix/env.rs index ad116c57f55..f9592d5c45f 100644 --- a/src/libstd/sys/unix/env.rs +++ b/src/libstd/sys/unix/env.rs @@ -1,185 +1,175 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[cfg(target_os = "linux")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "linux"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "linux"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(target_os = "macos")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "macos"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".dylib"; - pub const DLL_EXTENSION: &'static str = "dylib"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "macos"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".dylib"; + pub const DLL_EXTENSION: &str = "dylib"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(target_os = "ios")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "ios"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".dylib"; - pub const DLL_EXTENSION: &'static str = "dylib"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "ios"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".dylib"; + pub const DLL_EXTENSION: &str = "dylib"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(target_os = "freebsd")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "freebsd"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "freebsd"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(target_os = "dragonfly")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "dragonfly"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "dragonfly"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(target_os = "bitrig")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "bitrig"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "bitrig"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(target_os = "netbsd")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "netbsd"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "netbsd"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(target_os = "openbsd")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "openbsd"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "openbsd"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(target_os = "android")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "android"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "android"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(target_os = "solaris")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "solaris"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "solaris"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(target_os = "haiku")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "haiku"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "haiku"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(all(target_os = "emscripten", target_arch = "asmjs"))] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "emscripten"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ".js"; - pub const EXE_EXTENSION: &'static str = "js"; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "emscripten"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ".js"; + pub const EXE_EXTENSION: &str = "js"; } #[cfg(all(target_os = "emscripten", target_arch = "wasm32"))] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "emscripten"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ".js"; - pub const EXE_EXTENSION: &'static str = "js"; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "emscripten"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ".js"; + pub const EXE_EXTENSION: &str = "js"; } #[cfg(target_os = "fuchsia")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "fuchsia"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "fuchsia"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(target_os = "l4re")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "l4re"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "l4re"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } #[cfg(target_os = "hermit")] pub mod os { - pub const FAMILY: &'static str = "unix"; - pub const OS: &'static str = "hermit"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const DLL_EXTENSION: &'static str = "so"; - pub const EXE_SUFFIX: &'static str = ""; - pub const EXE_EXTENSION: &'static str = ""; + pub const FAMILY: &str = "unix"; + pub const OS: &str = "hermit"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ""; + pub const EXE_EXTENSION: &str = ""; } diff --git a/src/libstd/sys/unix/ext/ffi.rs b/src/libstd/sys/unix/ext/ffi.rs index 8347145db5a..d1c3cd82ac5 100644 --- a/src/libstd/sys/unix/ext/ffi.rs +++ b/src/libstd/sys/unix/ext/ffi.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Unix-specific extension to the primitives in the `std::ffi` module #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index 507e9d88171..e962d09e274 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Unix-specific extensions to primitives in the `std::fs` module. #![stable(feature = "rust1", since = "1.0.0")] @@ -94,7 +84,6 @@ pub trait FileExt { /// # Examples /// /// ```no_run - /// #![feature(rw_exact_all_at)] /// use std::io; /// use std::fs::File; /// use std::os::unix::prelude::FileExt; @@ -109,7 +98,7 @@ pub trait FileExt { /// Ok(()) /// } /// ``` - #[unstable(feature = "rw_exact_all_at", issue = "51984")] + #[stable(feature = "rw_exact_all_at", since = "1.33.0")] fn read_exact_at(&self, mut buf: &mut [u8], mut offset: u64) -> io::Result<()> { while !buf.is_empty() { match self.read_at(buf, offset) { @@ -191,7 +180,6 @@ pub trait FileExt { /// # Examples /// /// ```no_run - /// #![feature(rw_exact_all_at)] /// use std::fs::File; /// use std::io; /// use std::os::unix::prelude::FileExt; @@ -204,7 +192,7 @@ pub trait FileExt { /// Ok(()) /// } /// ``` - #[unstable(feature = "rw_exact_all_at", issue = "51984")] + #[stable(feature = "rw_exact_all_at", since = "1.33.0")] fn write_all_at(&self, mut buf: &[u8], mut offset: u64) -> io::Result<()> { while !buf.is_empty() { match self.write_at(buf, offset) { @@ -348,7 +336,7 @@ pub trait OpenOptionsExt { /// # Examples /// /// ```no_run - /// # #![feature(libc)] + /// # #![feature(rustc_private)] /// extern crate libc; /// use std::fs::OpenOptions; /// use std::os::unix::fs::OpenOptionsExt; @@ -522,7 +510,7 @@ pub trait MetadataExt { /// ``` #[stable(feature = "metadata_ext", since = "1.1.0")] fn size(&self) -> u64; - /// Returns the time of the last access to the file. + /// Returns the last access time of the file, in seconds since Unix Epoch. /// /// # Examples /// @@ -539,7 +527,9 @@ pub trait MetadataExt { /// ``` #[stable(feature = "metadata_ext", since = "1.1.0")] fn atime(&self) -> i64; - /// Returns the time of the last access to the file in nanoseconds. + /// Returns the last access time of the file, in nanoseconds since [`atime`]. + /// + /// [`atime`]: #tymethod.atime /// /// # Examples /// @@ -556,7 +546,7 @@ pub trait MetadataExt { /// ``` #[stable(feature = "metadata_ext", since = "1.1.0")] fn atime_nsec(&self) -> i64; - /// Returns the time of the last modification of the file. + /// Returns the last modification time of the file, in seconds since Unix Epoch. /// /// # Examples /// @@ -573,7 +563,9 @@ pub trait MetadataExt { /// ``` #[stable(feature = "metadata_ext", since = "1.1.0")] fn mtime(&self) -> i64; - /// Returns the time of the last modification of the file in nanoseconds. + /// Returns the last modification time of the file, in nanoseconds since [`mtime`]. + /// + /// [`mtime`]: #tymethod.mtime /// /// # Examples /// @@ -590,7 +582,7 @@ pub trait MetadataExt { /// ``` #[stable(feature = "metadata_ext", since = "1.1.0")] fn mtime_nsec(&self) -> i64; - /// Returns the time of the last status change of the file. + /// Returns the last status change time of the file, in seconds since Unix Epoch. /// /// # Examples /// @@ -607,7 +599,9 @@ pub trait MetadataExt { /// ``` #[stable(feature = "metadata_ext", since = "1.1.0")] fn ctime(&self) -> i64; - /// Returns the time of the last status change of the file in nanoseconds. + /// Returns the last status change time of the file, in nanoseconds since [`ctime`]. + /// + /// [`ctime`]: #tymethod.ctime /// /// # Examples /// diff --git a/src/libstd/sys/unix/ext/io.rs b/src/libstd/sys/unix/ext/io.rs index c9fe3590a64..73f4879e4e4 100644 --- a/src/libstd/sys/unix/ext/io.rs +++ b/src/libstd/sys/unix/ext/io.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Unix-specific extensions to general I/O primitives #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/sys/unix/ext/mod.rs b/src/libstd/sys/unix/ext/mod.rs index 88e4237f8e2..36e9370b713 100644 --- a/src/libstd/sys/unix/ext/mod.rs +++ b/src/libstd/sys/unix/ext/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Experimental extensions to `std` for Unix platforms. //! //! Provides access to platform-level information on Unix platforms, and diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs index 55f43ccd7db..a3ae5943f60 100644 --- a/src/libstd/sys/unix/ext/net.rs +++ b/src/libstd/sys/unix/ext/net.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![stable(feature = "unix_socket", since = "1.10.0")] //! Unix-specific networking functionality @@ -132,7 +122,7 @@ impl SocketAddr { if len == 0 { // When there is a datagram from unnamed unix socket // linux returns zero bytes of address - len = sun_path_offset() as libc::socklen_t; // i.e. zero-length address + len = sun_path_offset() as libc::socklen_t; // i.e., zero-length address } else if addr.sun_family != libc::AF_UNIX as libc::sa_family_t { return Err(io::Error::new(io::ErrorKind::InvalidInput, "file descriptor did not correspond to a Unix socket")); @@ -1654,8 +1644,9 @@ mod test { or_panic!(stream.set_read_timeout(Some(Duration::from_millis(1000)))); let mut buf = [0; 10]; - let kind = stream.read(&mut buf).err().expect("expected error").kind(); - assert!(kind == io::ErrorKind::WouldBlock || kind == io::ErrorKind::TimedOut); + let kind = stream.read_exact(&mut buf).err().expect("expected error").kind(); + assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut, + "unexpected_error: {:?}", kind); } #[test] @@ -1675,8 +1666,9 @@ mod test { or_panic!(stream.read(&mut buf)); assert_eq!(b"hello world", &buf[..]); - let kind = stream.read(&mut buf).err().expect("expected error").kind(); - assert!(kind == io::ErrorKind::WouldBlock || kind == io::ErrorKind::TimedOut); + let kind = stream.read_exact(&mut buf).err().expect("expected error").kind(); + assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut, + "unexpected_error: {:?}", kind); } // Ensure the `set_read_timeout` and `set_write_timeout` calls return errors diff --git a/src/libstd/sys/unix/ext/process.rs b/src/libstd/sys/unix/ext/process.rs index 21630ae9746..0282aaae909 100644 --- a/src/libstd/sys/unix/ext/process.rs +++ b/src/libstd/sys/unix/ext/process.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Unix-specific extensions to primitives in the `std::process` module. #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/sys/unix/ext/raw.rs b/src/libstd/sys/unix/ext/raw.rs index 7972990e67d..eabb4b02503 100644 --- a/src/libstd/sys/unix/ext/raw.rs +++ b/src/libstd/sys/unix/ext/raw.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Unix-specific primitives available on all unix platforms #![stable(feature = "raw_ext", since = "1.1.0")] diff --git a/src/libstd/sys/unix/ext/thread.rs b/src/libstd/sys/unix/ext/thread.rs index 8dadf29945c..4b3d5e31848 100644 --- a/src/libstd/sys/unix/ext/thread.rs +++ b/src/libstd/sys/unix/ext/thread.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Unix-specific extensions to primitives in the `std::thread` module. #![stable(feature = "thread_extensions", since = "1.9.0")] diff --git a/src/libstd/sys/unix/fast_thread_local.rs b/src/libstd/sys/unix/fast_thread_local.rs index c13a0fea1e0..742ffd12b88 100644 --- a/src/libstd/sys/unix/fast_thread_local.rs +++ b/src/libstd/sys/unix/fast_thread_local.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![cfg(target_thread_local)] #![unstable(feature = "thread_local_internals", issue = "0")] @@ -43,30 +33,57 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { register_dtor_fallback(t, dtor); } -// macOS's analog of the above linux function is this _tlv_atexit function. -// The disassembly of thread_local globals in C++ (at least produced by -// clang) will have this show up in the output. +// This implementation is very similar to register_dtor_fallback in +// sys_common/thread_local.rs. The main difference is that we want to hook into +// macOS's analog of the above linux function, _tlv_atexit. OSX will run the +// registered dtors before any TLS slots get freed, and when the main thread +// exits. +// +// Unfortunately, calling _tlv_atexit while tls dtors are running is UB. The +// workaround below is to register, via _tlv_atexit, a custom DTOR list once per +// thread. thread_local dtors are pushed to the DTOR list without calling +// _tlv_atexit. #[cfg(target_os = "macos")] pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { + use cell::Cell; + use ptr; + + #[thread_local] + static REGISTERED: Cell = Cell::new(false); + if !REGISTERED.get() { + _tlv_atexit(run_dtors, ptr::null_mut()); + REGISTERED.set(true); + } + + type List = Vec<(*mut u8, unsafe extern fn(*mut u8))>; + + #[thread_local] + static DTORS: Cell<*mut List> = Cell::new(ptr::null_mut()); + if DTORS.get().is_null() { + let v: Box = box Vec::new(); + DTORS.set(Box::into_raw(v)); + } + extern { fn _tlv_atexit(dtor: unsafe extern fn(*mut u8), arg: *mut u8); } - _tlv_atexit(dtor, t); + + let list: &mut List = &mut *DTORS.get(); + list.push((t, dtor)); + + unsafe extern fn run_dtors(_: *mut u8) { + let mut ptr = DTORS.replace(ptr::null_mut()); + while !ptr.is_null() { + let list = Box::from_raw(ptr); + for (ptr, dtor) in list.into_iter() { + dtor(ptr); + } + ptr = DTORS.replace(ptr::null_mut()); + } + } } pub fn requires_move_before_drop() -> bool { - // The macOS implementation of TLS apparently had an odd aspect to it - // where the pointer we have may be overwritten while this destructor - // is running. Specifically if a TLS destructor re-accesses TLS it may - // trigger a re-initialization of all TLS variables, paving over at - // least some destroyed ones with initial values. - // - // This means that if we drop a TLS value in place on macOS that we could - // revert the value to its original state halfway through the - // destructor, which would be bad! - // - // Hence, we use `ptr::read` on macOS (to move to a "safe" location) - // instead of drop_in_place. - cfg!(target_os = "macos") + false } diff --git a/src/libstd/sys/unix/fd.rs b/src/libstd/sys/unix/fd.rs index 5a81d6dfb67..2cbd9536f4d 100644 --- a/src/libstd/sys/unix/fd.rs +++ b/src/libstd/sys/unix/fd.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(reason = "not public", issue = "0", feature = "fd")] use cmp; diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index add06aec11b..5183d6fadd2 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use os::unix::prelude::*; use ffi::{CString, CStr, OsString, OsStr}; diff --git a/src/libstd/sys/unix/l4re.rs b/src/libstd/sys/unix/l4re.rs index 21218489679..48037310c8d 100644 --- a/src/libstd/sys/unix/l4re.rs +++ b/src/libstd/sys/unix/l4re.rs @@ -1,13 +1,3 @@ -// Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! unimpl { () => (return Err(io::Error::new(io::ErrorKind::Other, "No networking available on L4Re."));) } @@ -21,7 +11,7 @@ pub mod net { use sys_common::{AsInner, FromInner, IntoInner}; use sys::fd::FileDesc; use time::Duration; - + use convert::TryFrom; pub extern crate libc as netc; @@ -118,7 +108,7 @@ pub mod net { } impl TcpStream { - pub fn connect(_: &SocketAddr) -> io::Result { + pub fn connect(_: io::Result<&SocketAddr>) -> io::Result { unimpl!(); } @@ -216,7 +206,7 @@ pub mod net { } impl TcpListener { - pub fn bind(_: &SocketAddr) -> io::Result { + pub fn bind(_: io::Result<&SocketAddr>) -> io::Result { unimpl!(); } @@ -278,7 +268,7 @@ pub mod net { } impl UdpSocket { - pub fn bind(_: &SocketAddr) -> io::Result { + pub fn bind(_: io::Result<&SocketAddr>) -> io::Result { unimpl!(); } @@ -402,7 +392,7 @@ pub mod net { unimpl!(); } - pub fn connect(&self, _: &SocketAddr) -> io::Result<()> { + pub fn connect(&self, _: io::Result<&SocketAddr>) -> io::Result<()> { unimpl!(); } } @@ -431,11 +421,30 @@ pub mod net { } } + impl LookupHost { + pub fn port(&self) -> u16 { + unimpl!(); + } + } + unsafe impl Sync for LookupHost {} unsafe impl Send for LookupHost {} - pub fn lookup_host(_: &str) -> io::Result { - unimpl!(); + + impl<'a> TryFrom<&'a str> for LookupHost { + type Error = io::Error; + + fn try_from(_v: &'a str) -> io::Result { + unimpl!(); + } + } + + impl<'a> TryFrom<(&'a str, u16)> for LookupHost { + type Error = io::Error; + + fn try_from(_v: (&'a str, u16)) -> io::Result { + unimpl!(); + } } } diff --git a/src/libstd/sys/unix/memchr.rs b/src/libstd/sys/unix/memchr.rs index f49adc24163..ec04a22a0d2 100644 --- a/src/libstd/sys/unix/memchr.rs +++ b/src/libstd/sys/unix/memchr.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -// Original implementation taken from rust-memchr +// Original implementation taken from rust-memchr. // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch pub fn memchr(needle: u8, haystack: &[u8]) -> Option { diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index e8101bd0bc9..b36c117fd09 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(missing_docs, nonstandard_style)] use io::{self, ErrorKind}; diff --git a/src/libstd/sys/unix/mutex.rs b/src/libstd/sys/unix/mutex.rs index 1d447de1134..54429dc84b6 100644 --- a/src/libstd/sys/unix/mutex.rs +++ b/src/libstd/sys/unix/mutex.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cell::UnsafeCell; use libc; use mem; diff --git a/src/libstd/sys/unix/net.rs b/src/libstd/sys/unix/net.rs index 2d10541752c..d780d71c376 100644 --- a/src/libstd/sys/unix/net.rs +++ b/src/libstd/sys/unix/net.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ffi::CStr; use io; use libc::{self, c_int, c_void, size_t, sockaddr, socklen_t, EAI_SYSTEM, MSG_PEEK}; @@ -26,7 +16,7 @@ pub extern crate libc as netc; pub type wrlen_t = size_t; // See below for the usage of SOCK_CLOEXEC, but this constant is only defined on -// Linux currently (e.g. support doesn't exist on other platforms). In order to +// Linux currently (e.g., support doesn't exist on other platforms). In order to // get name resolution to work and things to compile we just define a dummy // SOCK_CLOEXEC here for other platforms. Note that the dummy constant isn't // actually ever used (the blocks below are wrapped in `if cfg!` as well. @@ -203,18 +193,21 @@ impl Socket { // Linux. This was added in 2.6.28, however, and because we support // 2.6.18 we must detect this support dynamically. if cfg!(target_os = "linux") { - weak! { - fn accept4(c_int, *mut sockaddr, *mut socklen_t, c_int) -> c_int + syscall! { + fn accept4( + fd: c_int, + addr: *mut sockaddr, + addr_len: *mut socklen_t, + flags: c_int + ) -> c_int } - if let Some(accept) = accept4.get() { - let res = cvt_r(|| unsafe { - accept(self.0.raw(), storage, len, SOCK_CLOEXEC) - }); - match res { - Ok(fd) => return Ok(Socket(FileDesc::new(fd))), - Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => {} - Err(e) => return Err(e), - } + let res = cvt_r(|| unsafe { + accept4(self.0.raw(), storage, len, SOCK_CLOEXEC) + }); + match res { + Ok(fd) => return Ok(Socket(FileDesc::new(fd))), + Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => {} + Err(e) => return Err(e), } } diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index b387a8d59a5..58ea190fcc0 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of `std::os` functionality for unix systems #![allow(unused_imports)] // lots of cfg code here @@ -67,7 +57,8 @@ pub fn errno() -> i32 { } /// Sets the platform-specific value of errno -#[cfg(any(target_os = "solaris", target_os = "fuchsia"))] // only needed for readdir so far +#[cfg(all(not(target_os = "linux"), + not(target_os = "dragonfly")))] // needed for readdir and syscall! pub fn set_errno(e: i32) { unsafe { *errno_location() = e as c_int @@ -84,6 +75,18 @@ pub fn errno() -> i32 { unsafe { errno as i32 } } +#[cfg(target_os = "dragonfly")] +pub fn set_errno(e: i32) { + extern { + #[thread_local] + static mut errno: c_int; + } + + unsafe { + errno = e; + } +} + /// Gets a detailed string description for the given error number. pub fn error_string(errno: i32) -> String { extern { @@ -283,11 +286,14 @@ pub fn current_exe() -> io::Result { #[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))] pub fn current_exe() -> io::Result { - let selfexe = PathBuf::from("/proc/self/exe"); - if selfexe.exists() { - ::fs::read_link(selfexe) - } else { - Err(io::Error::new(io::ErrorKind::Other, "no /proc/self/exe available. Is /proc mounted?")) + match ::fs::read_link("/proc/self/exe") { + Err(ref e) if e.kind() == io::ErrorKind::NotFound => { + Err(io::Error::new( + io::ErrorKind::Other, + "no /proc/self/exe available. Is /proc mounted?" + )) + }, + other => other, } } diff --git a/src/libstd/sys/unix/os_str.rs b/src/libstd/sys/unix/os_str.rs index 01c0fb830aa..9d5e084feb2 100644 --- a/src/libstd/sys/unix/os_str.rs +++ b/src/libstd/sys/unix/os_str.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// The underlying OsString/OsStr implementation on Unix systems: just /// a `Vec`/`[u8]`. diff --git a/src/libstd/sys/unix/path.rs b/src/libstd/sys/unix/path.rs index bf9af7a4353..2ef78fb2f86 100644 --- a/src/libstd/sys/unix/path.rs +++ b/src/libstd/sys/unix/path.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use path::Prefix; use ffi::OsStr; @@ -25,5 +15,5 @@ pub fn parse_prefix(_: &OsStr) -> Option { None } -pub const MAIN_SEP_STR: &'static str = "/"; +pub const MAIN_SEP_STR: &str = "/"; pub const MAIN_SEP: char = '/'; diff --git a/src/libstd/sys/unix/pipe.rs b/src/libstd/sys/unix/pipe.rs index 0a5dccdddda..a746d982c6c 100644 --- a/src/libstd/sys/unix/pipe.rs +++ b/src/libstd/sys/unix/pipe.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use io; use libc::{self, c_int}; use mem; -use sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; +use sync::atomic::{AtomicBool, Ordering}; use sys::fd::FileDesc; use sys::{cvt, cvt_r}; @@ -22,8 +12,8 @@ use sys::{cvt, cvt_r}; pub struct AnonPipe(FileDesc); pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> { - weak! { fn pipe2(*mut c_int, c_int) -> c_int } - static INVALID: AtomicBool = ATOMIC_BOOL_INIT; + syscall! { fn pipe2(fds: *mut c_int, flags: c_int) -> c_int } + static INVALID: AtomicBool = AtomicBool::new(false); let mut fds = [0; 2]; @@ -39,22 +29,20 @@ pub fn anon_pipe() -> io::Result<(AnonPipe, AnonPipe)> { !INVALID.load(Ordering::SeqCst) { - if let Some(pipe) = pipe2.get() { - // Note that despite calling a glibc function here we may still - // get ENOSYS. Glibc has `pipe2` since 2.9 and doesn't try to - // emulate on older kernels, so if you happen to be running on - // an older kernel you may see `pipe2` as a symbol but still not - // see the syscall. - match cvt(unsafe { pipe(fds.as_mut_ptr(), libc::O_CLOEXEC) }) { - Ok(_) => { - return Ok((AnonPipe(FileDesc::new(fds[0])), - AnonPipe(FileDesc::new(fds[1])))); - } - Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => { - INVALID.store(true, Ordering::SeqCst); - } - Err(e) => return Err(e), + // Note that despite calling a glibc function here we may still + // get ENOSYS. Glibc has `pipe2` since 2.9 and doesn't try to + // emulate on older kernels, so if you happen to be running on + // an older kernel you may see `pipe2` as a symbol but still not + // see the syscall. + match cvt(unsafe { pipe2(fds.as_mut_ptr(), libc::O_CLOEXEC) }) { + Ok(_) => { + return Ok((AnonPipe(FileDesc::new(fds[0])), + AnonPipe(FileDesc::new(fds[1])))); + } + Err(ref e) if e.raw_os_error() == Some(libc::ENOSYS) => { + INVALID.store(true, Ordering::SeqCst); } + Err(e) => return Err(e), } } cvt(unsafe { libc::pipe(fds.as_mut_ptr()) })?; diff --git a/src/libstd/sys/unix/process/mod.rs b/src/libstd/sys/unix/process/mod.rs index d8ac26c45b1..bba4b21c462 100644 --- a/src/libstd/sys/unix/process/mod.rs +++ b/src/libstd/sys/unix/process/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use self::process_common::{Command, ExitStatus, ExitCode, Stdio, StdioPipes}; pub use self::process_inner::Process; diff --git a/src/libstd/sys/unix/process/process_common.rs b/src/libstd/sys/unix/process/process_common.rs index 77f125f3c5b..2c55813c5cd 100644 --- a/src/libstd/sys/unix/process/process_common.rs +++ b/src/libstd/sys/unix/process/process_common.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use os::unix::prelude::*; use ffi::{OsString, OsStr, CString, CStr}; diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs index fa48001179e..5582310adbf 100644 --- a/src/libstd/sys/unix/process/process_fuchsia.rs +++ b/src/libstd/sys/unix/process/process_fuchsia.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use io; use libc::{self, size_t}; use mem; diff --git a/src/libstd/sys/unix/process/process_unix.rs b/src/libstd/sys/unix/process/process_unix.rs index bfbf12f34ee..f0f8032b4b5 100644 --- a/src/libstd/sys/unix/process/process_unix.rs +++ b/src/libstd/sys/unix/process/process_unix.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use io::{self, Error, ErrorKind}; use libc::{self, c_int, gid_t, pid_t, uid_t}; use ptr; @@ -22,7 +12,7 @@ use sys; impl Command { pub fn spawn(&mut self, default: Stdio, needs_stdin: bool) -> io::Result<(Process, StdioPipes)> { - const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX"; + const CLOEXEC_MSG_FOOTER: &[u8] = b"NOEX"; let envp = self.capture_env(); diff --git a/src/libstd/sys/unix/process/zircon.rs b/src/libstd/sys/unix/process/zircon.rs index a06c73ee263..690c745218b 100644 --- a/src/libstd/sys/unix/process/zircon.rs +++ b/src/libstd/sys/unix/process/zircon.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types, unused)] use convert::TryInto; @@ -215,7 +205,7 @@ pub const FDIO_SPAWN_ACTION_TRANSFER_FD: u32 = 0x0002; // and has a closed remote end will return ERR_REMOTE_CLOSED. #[allow(unused)] pub const ERR_SHOULD_WAIT: zx_status_t = -22; -// ERR_CANCELED: The in-progress operation (e.g. a wait) has been +// ERR_CANCELED: The in-progress operation (e.g., a wait) has been // // canceled. #[allow(unused)] pub const ERR_CANCELED: zx_status_t = -23; diff --git a/src/libstd/sys/unix/rand.rs b/src/libstd/sys/unix/rand.rs index 371e58a20c4..f2e17c36738 100644 --- a/src/libstd/sys/unix/rand.rs +++ b/src/libstd/sys/unix/rand.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use mem; use slice; diff --git a/src/libstd/sys/unix/rwlock.rs b/src/libstd/sys/unix/rwlock.rs index fcd6f7a27b6..a068a11993e 100644 --- a/src/libstd/sys/unix/rwlock.rs +++ b/src/libstd/sys/unix/rwlock.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use libc; use cell::UnsafeCell; use sync::atomic::{AtomicUsize, Ordering}; diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index a4ed53d1c0a..8253efb7823 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![cfg_attr(test, allow(dead_code))] use libc; diff --git a/src/libstd/sys/unix/stdio.rs b/src/libstd/sys/unix/stdio.rs index 87ba2aef4f1..8a6b7b5f876 100644 --- a/src/libstd/sys/unix/stdio.rs +++ b/src/libstd/sys/unix/stdio.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use io; use libc; use sys::fd::FileDesc; @@ -76,6 +66,6 @@ pub fn is_ebadf(err: &io::Error) -> bool { pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; -pub fn stderr_prints_nothing() -> bool { - false +pub fn panic_output() -> Option { + Stderr::new().ok() } diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index f3a45d24657..e29557f1ba2 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use boxed::FnBox; use cmp; use ffi::CStr; @@ -49,7 +39,8 @@ unsafe fn pthread_attr_setstacksize(_attr: *mut libc::pthread_attr_t, } impl Thread { - pub unsafe fn new<'a>(stack: usize, p: Box) + // unsafe: see thread::Builder::spawn_unchecked for safety requirements + pub unsafe fn new(stack: usize, p: Box) -> io::Result { let p = box p; let mut native: libc::pthread_t = mem::zeroed(); @@ -210,7 +201,6 @@ pub mod guard { pub type Guard = Range; pub unsafe fn current() -> Option { None } pub unsafe fn init() -> Option { None } - pub unsafe fn deinit() {} } @@ -354,26 +344,6 @@ pub mod guard { } } - pub unsafe fn deinit() { - if !cfg!(target_os = "linux") { - if let Some(stackaddr) = get_stack_start_aligned() { - // Remove the protection on the guard page. - // FIXME: we cannot unmap the page, because when we mmap() - // above it may be already mapped by the OS, which we can't - // detect from mmap()'s return value. If we unmap this page, - // it will lead to failure growing stack size on platforms like - // macOS. Instead, just restore the page to a writable state. - // This ain't Linux, so we probably don't need to care about - // execstack. - let result = mprotect(stackaddr, PAGE_SIZE, PROT_READ | PROT_WRITE); - - if result != 0 { - panic!("unable to reset the guard page"); - } - } - } - } - #[cfg(any(target_os = "macos", target_os = "bitrig", target_os = "openbsd", diff --git a/src/libstd/sys/unix/thread_local.rs b/src/libstd/sys/unix/thread_local.rs index 2487f6bcaf7..c171fbce237 100644 --- a/src/libstd/sys/unix/thread_local.rs +++ b/src/libstd/sys/unix/thread_local.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // not used on all platforms use mem; diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index af51f8a8e25..4a655714f99 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cmp::Ordering; use libc; use time::Duration; @@ -24,6 +14,12 @@ struct Timespec { } impl Timespec { + const fn zero() -> Timespec { + Timespec { + t: libc::timespec { tv_sec: 0, tv_nsec: 0 }, + } + } + fn sub_timespec(&self, other: &Timespec) -> Result { if self >= other { Ok(if self.t.tv_nsec >= other.t.tv_nsec { @@ -42,51 +38,47 @@ impl Timespec { } } - fn add_duration(&self, other: &Duration) -> Timespec { + fn checked_add_duration(&self, other: &Duration) -> Option { let mut secs = other .as_secs() .try_into() // <- target type would be `libc::time_t` .ok() - .and_then(|secs| self.t.tv_sec.checked_add(secs)) - .expect("overflow when adding duration to time"); + .and_then(|secs| self.t.tv_sec.checked_add(secs))?; // Nano calculations can't overflow because nanos are <1B which fit // in a u32. let mut nsec = other.subsec_nanos() + self.t.tv_nsec as u32; if nsec >= NSEC_PER_SEC as u32 { nsec -= NSEC_PER_SEC as u32; - secs = secs.checked_add(1).expect("overflow when adding \ - duration to time"); + secs = secs.checked_add(1)?; } - Timespec { + Some(Timespec { t: libc::timespec { tv_sec: secs, tv_nsec: nsec as _, }, - } + }) } - fn sub_duration(&self, other: &Duration) -> Timespec { + fn checked_sub_duration(&self, other: &Duration) -> Option { let mut secs = other .as_secs() .try_into() // <- target type would be `libc::time_t` .ok() - .and_then(|secs| self.t.tv_sec.checked_sub(secs)) - .expect("overflow when subtracting duration from time"); + .and_then(|secs| self.t.tv_sec.checked_sub(secs))?; // Similar to above, nanos can't overflow. let mut nsec = self.t.tv_nsec as i32 - other.subsec_nanos() as i32; if nsec < 0 { nsec += NSEC_PER_SEC as i32; - secs = secs.checked_sub(1).expect("overflow when subtracting \ - duration from time"); + secs = secs.checked_sub(1)?; } - Timespec { + Some(Timespec { t: libc::timespec { tv_sec: secs, tv_nsec: nsec as _, }, - } + }) } } @@ -142,12 +134,7 @@ mod inner { } pub const UNIX_EPOCH: SystemTime = SystemTime { - t: Timespec { - t: libc::timespec { - tv_sec: 0, - tv_nsec: 0, - }, - }, + t: Timespec::zero(), }; impl Instant { @@ -155,6 +142,14 @@ mod inner { Instant { t: unsafe { libc::mach_absolute_time() } } } + pub const fn zero() -> Instant { + Instant { t: 0 } + } + + pub fn actually_monotonic() -> bool { + true + } + pub fn sub_instant(&self, other: &Instant) -> Duration { let info = info(); let diff = self.t.checked_sub(other.t) @@ -163,18 +158,16 @@ mod inner { Duration::new(nanos / NSEC_PER_SEC, (nanos % NSEC_PER_SEC) as u32) } - pub fn add_duration(&self, other: &Duration) -> Instant { - Instant { - t: self.t.checked_add(dur2intervals(other)) - .expect("overflow when adding duration to instant"), - } + pub fn checked_add_duration(&self, other: &Duration) -> Option { + Some(Instant { + t: self.t.checked_add(checked_dur2intervals(other)?)?, + }) } - pub fn sub_duration(&self, other: &Duration) -> Instant { - Instant { - t: self.t.checked_sub(dur2intervals(other)) - .expect("overflow when subtracting duration from instant"), - } + pub fn checked_sub_duration(&self, other: &Duration) -> Option { + Some(Instant { + t: self.t.checked_sub(checked_dur2intervals(other)?)?, + }) } } @@ -197,12 +190,12 @@ mod inner { self.t.sub_timespec(&other.t) } - pub fn add_duration(&self, other: &Duration) -> SystemTime { - SystemTime { t: self.t.add_duration(other) } + pub fn checked_add_duration(&self, other: &Duration) -> Option { + Some(SystemTime { t: self.t.checked_add_duration(other)? }) } - pub fn sub_duration(&self, other: &Duration) -> SystemTime { - SystemTime { t: self.t.sub_duration(other) } + pub fn checked_sub_duration(&self, other: &Duration) -> Option { + Some(SystemTime { t: self.t.checked_sub_duration(other)? }) } } @@ -230,12 +223,12 @@ mod inner { } } - fn dur2intervals(dur: &Duration) -> u64 { + fn checked_dur2intervals(dur: &Duration) -> Option { + let nanos = dur.as_secs() + .checked_mul(NSEC_PER_SEC)? + .checked_add(dur.subsec_nanos() as u64)?; let info = info(); - let nanos = dur.as_secs().checked_mul(NSEC_PER_SEC).and_then(|nanos| { - nanos.checked_add(dur.subsec_nanos() as u64) - }).expect("overflow converting duration to nanoseconds"); - mul_div_u64(nanos, info.denom as u64, info.numer as u64) + Some(mul_div_u64(nanos, info.denom as u64, info.numer as u64)) } fn info() -> &'static libc::mach_timebase_info { @@ -274,12 +267,7 @@ mod inner { } pub const UNIX_EPOCH: SystemTime = SystemTime { - t: Timespec { - t: libc::timespec { - tv_sec: 0, - tv_nsec: 0, - }, - }, + t: Timespec::zero(), }; impl Instant { @@ -287,18 +275,30 @@ mod inner { Instant { t: now(libc::CLOCK_MONOTONIC) } } + pub const fn zero() -> Instant { + Instant { + t: Timespec::zero(), + } + } + + pub fn actually_monotonic() -> bool { + (cfg!(target_os = "linux") && cfg!(target_arch = "x86_64")) || + (cfg!(target_os = "linux") && cfg!(target_arch = "x86")) || + false // last clause, used so `||` is always trailing above + } + pub fn sub_instant(&self, other: &Instant) -> Duration { self.t.sub_timespec(&other.t).unwrap_or_else(|_| { panic!("specified instant was later than self") }) } - pub fn add_duration(&self, other: &Duration) -> Instant { - Instant { t: self.t.add_duration(other) } + pub fn checked_add_duration(&self, other: &Duration) -> Option { + Some(Instant { t: self.t.checked_add_duration(other)? }) } - pub fn sub_duration(&self, other: &Duration) -> Instant { - Instant { t: self.t.sub_duration(other) } + pub fn checked_sub_duration(&self, other: &Duration) -> Option { + Some(Instant { t: self.t.checked_sub_duration(other)? }) } } @@ -321,12 +321,12 @@ mod inner { self.t.sub_timespec(&other.t) } - pub fn add_duration(&self, other: &Duration) -> SystemTime { - SystemTime { t: self.t.add_duration(other) } + pub fn checked_add_duration(&self, other: &Duration) -> Option { + Some(SystemTime { t: self.t.checked_add_duration(other)? }) } - pub fn sub_duration(&self, other: &Duration) -> SystemTime { - SystemTime { t: self.t.sub_duration(other) } + pub fn checked_sub_duration(&self, other: &Duration) -> Option { + Some(SystemTime { t: self.t.checked_sub_duration(other)? }) } } diff --git a/src/libstd/sys/unix/weak.rs b/src/libstd/sys/unix/weak.rs index 18944be58ee..d0242ca7422 100644 --- a/src/libstd/sys/unix/weak.rs +++ b/src/libstd/sys/unix/weak.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Support for "weak linkage" to symbols on Unix //! //! Some I/O operations we do in libstd require newer versions of OSes but we @@ -77,3 +67,38 @@ unsafe fn fetch(name: &str) -> usize { }; libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr()) as usize } + +#[cfg(not(target_os = "linux"))] +macro_rules! syscall { + (fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => ( + unsafe fn $name($($arg_name: $t),*) -> $ret { + use libc; + use super::os; + + weak! { fn $name($($t),*) -> $ret } + + if let Some(fun) = $name.get() { + fun($($arg_name),*) + } else { + os::set_errno(libc::ENOSYS); + -1 + } + } + ) +} + +#[cfg(target_os = "linux")] +macro_rules! syscall { + (fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => ( + unsafe fn $name($($arg_name:$t),*) -> $ret { + // This looks like a hack, but concat_idents only accepts idents + // (not paths). + use libc::*; + + syscall( + concat_idents!(SYS_, $name), + $($arg_name as c_long),* + ) as $ret + } + ) +} diff --git a/src/libstd/sys/wasm/alloc.rs b/src/libstd/sys/wasm/alloc.rs index 0faa3c9a740..f082887ce20 100644 --- a/src/libstd/sys/wasm/alloc.rs +++ b/src/libstd/sys/wasm/alloc.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This is an implementation of a global allocator on the wasm32 platform when //! emscripten is not in use. In that situation there's no actual runtime for us //! to lean on for allocation, so instead we provide our own! @@ -74,7 +64,7 @@ mod lock { return DropLock } unsafe { - let r = wasm32::atomic::wait_i32( + let r = wasm32::i32_atomic_wait( &LOCKED as *const AtomicI32 as *mut i32, 1, // expected value -1, // timeout @@ -89,7 +79,7 @@ mod lock { let r = LOCKED.swap(0, SeqCst); debug_assert_eq!(r, 1); unsafe { - wasm32::atomic::wake( + wasm32::atomic_notify( &LOCKED as *const AtomicI32 as *mut i32, 1, // only one thread ); diff --git a/src/libstd/sys/wasm/args.rs b/src/libstd/sys/wasm/args.rs index b3c6b671e80..cea56091adc 100644 --- a/src/libstd/sys/wasm/args.rs +++ b/src/libstd/sys/wasm/args.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ffi::OsString; use marker::PhantomData; use vec; diff --git a/src/libstd/sys/wasm/backtrace.rs b/src/libstd/sys/wasm/backtrace.rs index 9a8c48ff29f..52d4a63bb63 100644 --- a/src/libstd/sys/wasm/backtrace.rs +++ b/src/libstd/sys/wasm/backtrace.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use io; use sys::unsupported; use sys_common::backtrace::Frame; diff --git a/src/libstd/sys/wasm/cmath.rs b/src/libstd/sys/wasm/cmath.rs index 64fc14d42d9..fa7783122c2 100644 --- a/src/libstd/sys/wasm/cmath.rs +++ b/src/libstd/sys/wasm/cmath.rs @@ -1,92 +1,29 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[inline] -pub unsafe fn cbrtf(n: f32) -> f32 { - f64::cbrt(n as f64) as f32 -} - -#[inline] -pub unsafe fn expm1f(n: f32) -> f32 { - f64::exp_m1(n as f64) as f32 -} - -#[inline] -#[allow(deprecated)] -pub unsafe fn fdimf(a: f32, b: f32) -> f32 { - f64::abs_sub(a as f64, b as f64) as f32 -} - -#[inline] -pub unsafe fn log1pf(n: f32) -> f32 { - f64::ln_1p(n as f64) as f32 -} - -#[inline] -pub unsafe fn hypotf(x: f32, y: f32) -> f32 { - f64::hypot(x as f64, y as f64) as f32 -} - -#[inline] -pub unsafe fn acosf(n: f32) -> f32 { - f64::acos(n as f64) as f32 -} - -#[inline] -pub unsafe fn asinf(n: f32) -> f32 { - f64::asin(n as f64) as f32 -} - -#[inline] -pub unsafe fn atan2f(n: f32, b: f32) -> f32 { - f64::atan2(n as f64, b as f64) as f32 -} - -#[inline] -pub unsafe fn atanf(n: f32) -> f32 { - f64::atan(n as f64) as f32 -} - -#[inline] -pub unsafe fn coshf(n: f32) -> f32 { - f64::cosh(n as f64) as f32 -} - -#[inline] -pub unsafe fn sinhf(n: f32) -> f32 { - f64::sinh(n as f64) as f32 -} - -#[inline] -pub unsafe fn tanf(n: f32) -> f32 { - f64::tan(n as f64) as f32 -} - -#[inline] -pub unsafe fn tanhf(n: f32) -> f32 { - f64::tanh(n as f64) as f32 -} - // These symbols are all defined in `compiler-builtins` extern { pub fn acos(n: f64) -> f64; + pub fn acosf(n: f32) -> f32; pub fn asin(n: f64) -> f64; + pub fn asinf(n: f32) -> f32; pub fn atan(n: f64) -> f64; pub fn atan2(a: f64, b: f64) -> f64; + pub fn atan2f(a: f32, b: f32) -> f32; + pub fn atanf(n: f32) -> f32; pub fn cbrt(n: f64) -> f64; + pub fn cbrtf(n: f32) -> f32; pub fn cosh(n: f64) -> f64; + pub fn coshf(n: f32) -> f32; pub fn expm1(n: f64) -> f64; + pub fn expm1f(n: f32) -> f32; pub fn fdim(a: f64, b: f64) -> f64; + pub fn fdimf(a: f32, b: f32) -> f32; + pub fn hypot(x: f64, y: f64) -> f64; + pub fn hypotf(x: f32, y: f32) -> f32; pub fn log1p(n: f64) -> f64; + pub fn log1pf(n: f32) -> f32; pub fn sinh(n: f64) -> f64; + pub fn sinhf(n: f32) -> f32; pub fn tan(n: f64) -> f64; + pub fn tanf(n: f32) -> f32; pub fn tanh(n: f64) -> f64; - pub fn hypot(x: f64, y: f64) -> f64; + pub fn tanhf(n: f32) -> f32; } diff --git a/src/libstd/sys/wasm/condvar.rs b/src/libstd/sys/wasm/condvar.rs index afa7afeef59..22df0f60db5 100644 --- a/src/libstd/sys/wasm/condvar.rs +++ b/src/libstd/sys/wasm/condvar.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use sys::mutex::Mutex; use time::Duration; diff --git a/src/libstd/sys/wasm/condvar_atomics.rs b/src/libstd/sys/wasm/condvar_atomics.rs index 5c55fd0a618..099404c75d4 100644 --- a/src/libstd/sys/wasm/condvar_atomics.rs +++ b/src/libstd/sys/wasm/condvar_atomics.rs @@ -1,14 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use arch::wasm32::atomic; +use arch::wasm32; use cmp; use mem; use sync::atomic::{AtomicUsize, Ordering::SeqCst}; @@ -52,13 +42,13 @@ impl Condvar { pub unsafe fn notify_one(&self) { self.cnt.fetch_add(1, SeqCst); - atomic::wake(self.ptr(), 1); + wasm32::atomic_notify(self.ptr(), 1); } #[inline] pub unsafe fn notify_all(&self) { self.cnt.fetch_add(1, SeqCst); - atomic::wake(self.ptr(), -1); // -1 == "wake everyone" + wasm32::atomic_notify(self.ptr(), u32::max_value()); // -1 == "wake everyone" } pub unsafe fn wait(&self, mutex: &Mutex) { @@ -72,7 +62,7 @@ impl Condvar { // wake us up once we're asleep. let ticket = self.cnt.load(SeqCst) as i32; mutex.unlock(); - let val = atomic::wait_i32(self.ptr(), ticket, -1); + let val = wasm32::i32_atomic_wait(self.ptr(), ticket, -1); // 0 == woken, 1 == not equal to `ticket`, 2 == timeout (shouldn't happen) debug_assert!(val == 0 || val == 1); mutex.lock(); @@ -86,7 +76,7 @@ impl Condvar { // If the return value is 2 then a timeout happened, so we return // `false` as we weren't actually notified. - let ret = atomic::wait_i32(self.ptr(), ticket, nanos as i64) != 2; + let ret = wasm32::i32_atomic_wait(self.ptr(), ticket, nanos as i64) != 2; mutex.lock(); return ret } diff --git a/src/libstd/sys/wasm/env.rs b/src/libstd/sys/wasm/env.rs index 1422042bd02..730e356d7fe 100644 --- a/src/libstd/sys/wasm/env.rs +++ b/src/libstd/sys/wasm/env.rs @@ -1,19 +1,9 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod os { - pub const FAMILY: &'static str = ""; - pub const OS: &'static str = ""; - pub const DLL_PREFIX: &'static str = ""; - pub const DLL_SUFFIX: &'static str = ".wasm"; - pub const DLL_EXTENSION: &'static str = "wasm"; - pub const EXE_SUFFIX: &'static str = ".wasm"; - pub const EXE_EXTENSION: &'static str = "wasm"; + pub const FAMILY: &str = ""; + pub const OS: &str = ""; + pub const DLL_PREFIX: &str = ""; + pub const DLL_SUFFIX: &str = ".wasm"; + pub const DLL_EXTENSION: &str = "wasm"; + pub const EXE_SUFFIX: &str = ".wasm"; + pub const EXE_EXTENSION: &str = "wasm"; } diff --git a/src/libstd/sys/wasm/fs.rs b/src/libstd/sys/wasm/fs.rs index b3c70a6685a..8b1c4476bc4 100644 --- a/src/libstd/sys/wasm/fs.rs +++ b/src/libstd/sys/wasm/fs.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ffi::OsString; use fmt; use hash::{Hash, Hasher}; diff --git a/src/libstd/sys/wasm/memchr.rs b/src/libstd/sys/wasm/memchr.rs index 964e3599413..9967482197e 100644 --- a/src/libstd/sys/wasm/memchr.rs +++ b/src/libstd/sys/wasm/memchr.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use core::slice::memchr::{memchr, memrchr}; diff --git a/src/libstd/sys/wasm/mod.rs b/src/libstd/sys/wasm/mod.rs index e8f7e32ac91..e21455ec6da 100644 --- a/src/libstd/sys/wasm/mod.rs +++ b/src/libstd/sys/wasm/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! System bindings for the wasm/web platform //! //! This module contains the facade (aka platform-specific) implementations of diff --git a/src/libstd/sys/wasm/mutex.rs b/src/libstd/sys/wasm/mutex.rs index 4197bdcc808..cf0a0a8638b 100644 --- a/src/libstd/sys/wasm/mutex.rs +++ b/src/libstd/sys/wasm/mutex.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cell::UnsafeCell; pub struct Mutex { diff --git a/src/libstd/sys/wasm/mutex_atomics.rs b/src/libstd/sys/wasm/mutex_atomics.rs index 762e807096f..da03e8fa23f 100644 --- a/src/libstd/sys/wasm/mutex_atomics.rs +++ b/src/libstd/sys/wasm/mutex_atomics.rs @@ -1,14 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use arch::wasm32::atomic; +use arch::wasm32; use cell::UnsafeCell; use mem; use sync::atomic::{AtomicUsize, AtomicU32, Ordering::SeqCst}; @@ -36,7 +26,7 @@ impl Mutex { pub unsafe fn lock(&self) { while !self.try_lock() { - let val = atomic::wait_i32( + let val = wasm32::i32_atomic_wait( self.ptr(), 1, // we expect our mutex is locked -1, // wait infinitely @@ -50,7 +40,7 @@ impl Mutex { pub unsafe fn unlock(&self) { let prev = self.locked.swap(0, SeqCst); debug_assert_eq!(prev, 1); - atomic::wake(self.ptr(), 1); // wake up one waiter, if any + wasm32::atomic_notify(self.ptr(), 1); // wake up one waiter, if any } #[inline] @@ -104,7 +94,7 @@ impl ReentrantMutex { pub unsafe fn lock(&self) { let me = thread::my_id(); while let Err(owner) = self._try_lock(me) { - let val = atomic::wait_i32(self.ptr(), owner as i32, -1); + let val = wasm32::i32_atomic_wait(self.ptr(), owner as i32, -1); debug_assert!(val == 0 || val == 1); } } @@ -143,7 +133,7 @@ impl ReentrantMutex { match *self.recursions.get() { 0 => { self.owner.swap(0, SeqCst); - atomic::wake(self.ptr() as *mut i32, 1); // wake up one waiter, if any + wasm32::atomic_notify(self.ptr() as *mut i32, 1); // wake up one waiter, if any } ref mut n => *n -= 1, } diff --git a/src/libstd/sys/wasm/net.rs b/src/libstd/sys/wasm/net.rs index 03a5b2d779e..81e4e8255bf 100644 --- a/src/libstd/sys/wasm/net.rs +++ b/src/libstd/sys/wasm/net.rs @@ -1,23 +1,14 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use fmt; use io; use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; use time::Duration; use sys::{unsupported, Void}; +use convert::TryFrom; pub struct TcpStream(Void); impl TcpStream { - pub fn connect(_: &SocketAddr) -> io::Result { + pub fn connect(_: io::Result<&SocketAddr>) -> io::Result { unsupported() } @@ -103,7 +94,7 @@ impl fmt::Debug for TcpStream { pub struct TcpListener(Void); impl TcpListener { - pub fn bind(_: &SocketAddr) -> io::Result { + pub fn bind(_: io::Result<&SocketAddr>) -> io::Result { unsupported() } @@ -153,7 +144,7 @@ impl fmt::Debug for TcpListener { pub struct UdpSocket(Void); impl UdpSocket { - pub fn bind(_: &SocketAddr) -> io::Result { + pub fn bind(_: io::Result<&SocketAddr>) -> io::Result { unsupported() } @@ -273,7 +264,7 @@ impl UdpSocket { match self.0 {} } - pub fn connect(&self, _: &SocketAddr) -> io::Result<()> { + pub fn connect(&self, _: io::Result<&SocketAddr>) -> io::Result<()> { match self.0 {} } } @@ -286,6 +277,12 @@ impl fmt::Debug for UdpSocket { pub struct LookupHost(Void); +impl LookupHost { + pub fn port(&self) -> u16 { + match self.0 {} + } +} + impl Iterator for LookupHost { type Item = SocketAddr; fn next(&mut self) -> Option { @@ -293,8 +290,20 @@ impl Iterator for LookupHost { } } -pub fn lookup_host(_: &str) -> io::Result { - unsupported() +impl<'a> TryFrom<&'a str> for LookupHost { + type Error = io::Error; + + fn try_from(_v: &'a str) -> io::Result { + unsupported() + } +} + +impl<'a> TryFrom<(&'a str, u16)> for LookupHost { + type Error = io::Error; + + fn try_from(_v: (&'a str, u16)) -> io::Result { + unsupported() + } } #[allow(nonstandard_style)] diff --git a/src/libstd/sys/wasm/os.rs b/src/libstd/sys/wasm/os.rs index 0cb991e19b0..9b278dfb9f8 100644 --- a/src/libstd/sys/wasm/os.rs +++ b/src/libstd/sys/wasm/os.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use error::Error as StdError; use ffi::{OsString, OsStr}; use fmt; diff --git a/src/libstd/sys/wasm/os_str.rs b/src/libstd/sys/wasm/os_str.rs index e0da5bdf36c..9d5e084feb2 100644 --- a/src/libstd/sys/wasm/os_str.rs +++ b/src/libstd/sys/wasm/os_str.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// The underlying OsString/OsStr implementation on Unix systems: just /// a `Vec`/`[u8]`. diff --git a/src/libstd/sys/wasm/path.rs b/src/libstd/sys/wasm/path.rs index 395b8c1e40e..2ef78fb2f86 100644 --- a/src/libstd/sys/wasm/path.rs +++ b/src/libstd/sys/wasm/path.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use path::Prefix; use ffi::OsStr; @@ -25,5 +15,5 @@ pub fn parse_prefix(_: &OsStr) -> Option { None } -pub const MAIN_SEP_STR: &'static str = "/"; +pub const MAIN_SEP_STR: &str = "/"; pub const MAIN_SEP: char = '/'; diff --git a/src/libstd/sys/wasm/pipe.rs b/src/libstd/sys/wasm/pipe.rs index 992e1ac409c..ac48a6dc033 100644 --- a/src/libstd/sys/wasm/pipe.rs +++ b/src/libstd/sys/wasm/pipe.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use io; use sys::Void; diff --git a/src/libstd/sys/wasm/process.rs b/src/libstd/sys/wasm/process.rs index 433e9cec7c8..5357d931c73 100644 --- a/src/libstd/sys/wasm/process.rs +++ b/src/libstd/sys/wasm/process.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ffi::OsStr; use fmt; use io; diff --git a/src/libstd/sys/wasm/rwlock.rs b/src/libstd/sys/wasm/rwlock.rs index 6516010af47..9f172859b7e 100644 --- a/src/libstd/sys/wasm/rwlock.rs +++ b/src/libstd/sys/wasm/rwlock.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cell::UnsafeCell; pub struct RWLock { diff --git a/src/libstd/sys/wasm/rwlock_atomics.rs b/src/libstd/sys/wasm/rwlock_atomics.rs index 3623333cc86..404b33bca41 100644 --- a/src/libstd/sys/wasm/rwlock_atomics.rs +++ b/src/libstd/sys/wasm/rwlock_atomics.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cell::UnsafeCell; use sys::mutex::Mutex; use sys::condvar::Condvar; diff --git a/src/libstd/sys/wasm/stack_overflow.rs b/src/libstd/sys/wasm/stack_overflow.rs index bed274142f1..c0e7c824615 100644 --- a/src/libstd/sys/wasm/stack_overflow.rs +++ b/src/libstd/sys/wasm/stack_overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Handler; impl Handler { diff --git a/src/libstd/sys/wasm/stdio.rs b/src/libstd/sys/wasm/stdio.rs index 023f29576a2..201619b2fb1 100644 --- a/src/libstd/sys/wasm/stdio.rs +++ b/src/libstd/sys/wasm/stdio.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use io; use sys::{ReadSysCall, WriteSysCall}; @@ -70,6 +60,10 @@ pub fn is_ebadf(_err: &io::Error) -> bool { true } -pub fn stderr_prints_nothing() -> bool { - !cfg!(feature = "wasm_syscall") +pub fn panic_output() -> Option { + if cfg!(feature = "wasm_syscall") { + Stderr::new().ok() + } else { + None + } } diff --git a/src/libstd/sys/wasm/thread.rs b/src/libstd/sys/wasm/thread.rs index 4ad89c42b92..c2322088e8e 100644 --- a/src/libstd/sys/wasm/thread.rs +++ b/src/libstd/sys/wasm/thread.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use boxed::FnBox; use ffi::CStr; use io; @@ -19,7 +9,8 @@ pub struct Thread(Void); pub const DEFAULT_MIN_STACK_SIZE: usize = 4096; impl Thread { - pub unsafe fn new<'a>(_stack: usize, _p: Box) + // unsafe: see thread::Builder::spawn_unchecked for safety requirements + pub unsafe fn new(_stack: usize, _p: Box) -> io::Result { unsupported() @@ -40,7 +31,7 @@ impl Thread { #[cfg(target_feature = "atomics")] pub fn sleep(dur: Duration) { - use arch::wasm32::atomic; + use arch::wasm32; use cmp; // Use an atomic wait to block the current thread artificially with a @@ -52,7 +43,7 @@ impl Thread { while nanos > 0 { let amt = cmp::min(i64::max_value() as u128, nanos); let mut x = 0; - let val = unsafe { atomic::wait_i32(&mut x, 0, amt as i64) }; + let val = unsafe { wasm32::i32_atomic_wait(&mut x, 0, amt as i64) }; debug_assert_eq!(val, 2); nanos -= amt; } @@ -67,7 +58,6 @@ pub mod guard { pub type Guard = !; pub unsafe fn current() -> Option { None } pub unsafe fn init() -> Option { None } - pub unsafe fn deinit() {} } cfg_if! { @@ -107,7 +97,7 @@ cfg_if! { panic!("thread local data not implemented on wasm with atomics yet") } - pub fn tcb_set(ptr: *mut u8) { + pub fn tcb_set(_ptr: *mut u8) { panic!("thread local data not implemented on wasm with atomics yet") } } else { diff --git a/src/libstd/sys/wasm/thread_local.rs b/src/libstd/sys/wasm/thread_local.rs index 442dd3302a0..c7c385da8c3 100644 --- a/src/libstd/sys/wasm/thread_local.rs +++ b/src/libstd/sys/wasm/thread_local.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use boxed::Box; use ptr; diff --git a/src/libstd/sys/wasm/thread_local_atomics.rs b/src/libstd/sys/wasm/thread_local_atomics.rs index acfe60719f2..d1d0af252c8 100644 --- a/src/libstd/sys/wasm/thread_local_atomics.rs +++ b/src/libstd/sys/wasm/thread_local_atomics.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use sys::thread; use sync::atomic::{AtomicUsize, Ordering::SeqCst}; diff --git a/src/libstd/sys/wasm/time.rs b/src/libstd/sys/wasm/time.rs index e52435e6339..31798466fed 100644 --- a/src/libstd/sys/wasm/time.rs +++ b/src/libstd/sys/wasm/time.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use time::Duration; use sys::{TimeSysCall, TimeClock}; @@ -24,16 +14,24 @@ impl Instant { Instant(TimeSysCall::perform(TimeClock::Monotonic)) } + pub const fn zero() -> Instant { + Instant(Duration::from_secs(0)) + } + + pub fn actually_monotonic() -> bool { + false + } + pub fn sub_instant(&self, other: &Instant) -> Duration { self.0 - other.0 } - pub fn add_duration(&self, other: &Duration) -> Instant { - Instant(self.0 + *other) + pub fn checked_add_duration(&self, other: &Duration) -> Option { + Some(Instant(self.0.checked_add(*other)?)) } - pub fn sub_duration(&self, other: &Duration) -> Instant { - Instant(self.0 - *other) + pub fn checked_sub_duration(&self, other: &Duration) -> Option { + Some(Instant(self.0.checked_sub(*other)?)) } } @@ -47,11 +45,11 @@ impl SystemTime { self.0.checked_sub(other.0).ok_or_else(|| other.0 - self.0) } - pub fn add_duration(&self, other: &Duration) -> SystemTime { - SystemTime(self.0 + *other) + pub fn checked_add_duration(&self, other: &Duration) -> Option { + Some(SystemTime(self.0.checked_add(*other)?)) } - pub fn sub_duration(&self, other: &Duration) -> SystemTime { - SystemTime(self.0 - *other) + pub fn checked_sub_duration(&self, other: &Duration) -> Option { + Some(SystemTime(self.0.checked_sub(*other)?)) } } diff --git a/src/libstd/sys/windows/alloc.rs b/src/libstd/sys/windows/alloc.rs index e5de3e016c9..0d7f803c7ee 100644 --- a/src/libstd/sys/windows/alloc.rs +++ b/src/libstd/sys/windows/alloc.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use alloc::{GlobalAlloc, Layout, System}; use sys::c; use sys_common::alloc::{MIN_ALIGN, realloc_fallback}; diff --git a/src/libstd/sys/windows/args.rs b/src/libstd/sys/windows/args.rs index 4784633edc1..f6728069109 100644 --- a/src/libstd/sys/windows/args.rs +++ b/src/libstd/sys/windows/args.rs @@ -1,22 +1,14 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // runtime init functions not used during testing use os::windows::prelude::*; +use sys::windows::os::current_exe; use sys::c; -use slice; -use ops::Range; use ffi::OsString; -use libc::{c_int, c_void}; use fmt; +use vec; +use core::iter; +use slice; +use path::PathBuf; pub unsafe fn init(_argc: isize, _argv: *const *const u8) { } @@ -24,20 +16,146 @@ pub unsafe fn cleanup() { } pub fn args() -> Args { unsafe { - let mut nArgs: c_int = 0; - let lpCmdLine = c::GetCommandLineW(); - let szArgList = c::CommandLineToArgvW(lpCmdLine, &mut nArgs); - - // szArcList can be NULL if CommandLinToArgvW failed, - // but in that case nArgs is 0 so we won't actually - // try to read a null pointer - Args { cur: szArgList, range: 0..(nArgs as isize) } + let lp_cmd_line = c::GetCommandLineW(); + let parsed_args_list = parse_lp_cmd_line( + lp_cmd_line as *const u16, + || current_exe().map(PathBuf::into_os_string).unwrap_or_else(|_| OsString::new())); + + Args { parsed_args_list: parsed_args_list.into_iter() } + } +} + +/// Implements the Windows command-line argument parsing algorithm. +/// +/// Microsoft's documentation for the Windows CLI argument format can be found at +/// . +/// +/// Windows includes a function to do this in shell32.dll, +/// but linking with that DLL causes the process to be registered as a GUI application. +/// GUI applications add a bunch of overhead, even if no windows are drawn. See +/// . +/// +/// This function was tested for equivalence to the shell32.dll implementation in +/// Windows 10 Pro v1803, using an exhaustive test suite available at +/// or +/// . +unsafe fn parse_lp_cmd_line OsString>(lp_cmd_line: *const u16, exe_name: F) + -> Vec { + const BACKSLASH: u16 = '\\' as u16; + const QUOTE: u16 = '"' as u16; + const TAB: u16 = '\t' as u16; + const SPACE: u16 = ' ' as u16; + let mut ret_val = Vec::new(); + if lp_cmd_line.is_null() || *lp_cmd_line == 0 { + ret_val.push(exe_name()); + return ret_val; + } + let mut cmd_line = { + let mut end = 0; + while *lp_cmd_line.offset(end) != 0 { + end += 1; + } + slice::from_raw_parts(lp_cmd_line, end as usize) + }; + // The executable name at the beginning is special. + cmd_line = match cmd_line[0] { + // The executable name ends at the next quote mark, + // no matter what. + QUOTE => { + let args = { + let mut cut = cmd_line[1..].splitn(2, |&c| c == QUOTE); + if let Some(exe) = cut.next() { + ret_val.push(OsString::from_wide(exe)); + } + cut.next() + }; + if let Some(args) = args { + args + } else { + return ret_val; + } + } + // Implement quirk: when they say whitespace here, + // they include the entire ASCII control plane: + // "However, if lpCmdLine starts with any amount of whitespace, CommandLineToArgvW + // will consider the first argument to be an empty string. Excess whitespace at the + // end of lpCmdLine is ignored." + 0...SPACE => { + ret_val.push(OsString::new()); + &cmd_line[1..] + }, + // The executable name ends at the next whitespace, + // no matter what. + _ => { + let args = { + let mut cut = cmd_line.splitn(2, |&c| c > 0 && c <= SPACE); + if let Some(exe) = cut.next() { + ret_val.push(OsString::from_wide(exe)); + } + cut.next() + }; + if let Some(args) = args { + args + } else { + return ret_val; + } + } + }; + let mut cur = Vec::new(); + let mut in_quotes = false; + let mut was_in_quotes = false; + let mut backslash_count: usize = 0; + for &c in cmd_line { + match c { + // backslash + BACKSLASH => { + backslash_count += 1; + was_in_quotes = false; + }, + QUOTE if backslash_count % 2 == 0 => { + cur.extend(iter::repeat(b'\\' as u16).take(backslash_count / 2)); + backslash_count = 0; + if was_in_quotes { + cur.push('"' as u16); + was_in_quotes = false; + } else { + was_in_quotes = in_quotes; + in_quotes = !in_quotes; + } + } + QUOTE if backslash_count % 2 != 0 => { + cur.extend(iter::repeat(b'\\' as u16).take(backslash_count / 2)); + backslash_count = 0; + was_in_quotes = false; + cur.push(b'"' as u16); + } + SPACE | TAB if !in_quotes => { + cur.extend(iter::repeat(b'\\' as u16).take(backslash_count)); + if !cur.is_empty() || was_in_quotes { + ret_val.push(OsString::from_wide(&cur[..])); + cur.truncate(0); + } + backslash_count = 0; + was_in_quotes = false; + } + _ => { + cur.extend(iter::repeat(b'\\' as u16).take(backslash_count)); + backslash_count = 0; + was_in_quotes = false; + cur.push(c); + } + } + } + cur.extend(iter::repeat(b'\\' as u16).take(backslash_count)); + // include empty quoted strings at the end of the arguments list + if !cur.is_empty() || was_in_quotes || in_quotes { + ret_val.push(OsString::from_wide(&cur[..])); } + ret_val } pub struct Args { - range: Range, - cur: *mut *mut u16, + parsed_args_list: vec::IntoIter, } pub struct ArgsInnerDebug<'a> { @@ -46,19 +164,7 @@ pub struct ArgsInnerDebug<'a> { impl<'a> fmt::Debug for ArgsInnerDebug<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str("[")?; - let mut first = true; - for i in self.args.range.clone() { - if !first { - f.write_str(", ")?; - } - first = false; - - // Here we do allocation which could be avoided. - fmt::Debug::fmt(&unsafe { os_string_from_ptr(*self.args.cur.offset(i)) }, f)?; - } - f.write_str("]")?; - Ok(()) + self.args.parsed_args_list.as_slice().fmt(f) } } @@ -70,38 +176,82 @@ impl Args { } } -unsafe fn os_string_from_ptr(ptr: *mut u16) -> OsString { - let mut len = 0; - while *ptr.offset(len) != 0 { len += 1; } - - // Push it onto the list. - let ptr = ptr as *const u16; - let buf = slice::from_raw_parts(ptr, len as usize); - OsStringExt::from_wide(buf) -} - impl Iterator for Args { type Item = OsString; - fn next(&mut self) -> Option { - self.range.next().map(|i| unsafe { os_string_from_ptr(*self.cur.offset(i)) } ) - } - fn size_hint(&self) -> (usize, Option) { self.range.size_hint() } + fn next(&mut self) -> Option { self.parsed_args_list.next() } + fn size_hint(&self) -> (usize, Option) { self.parsed_args_list.size_hint() } } impl DoubleEndedIterator for Args { - fn next_back(&mut self) -> Option { - self.range.next_back().map(|i| unsafe { os_string_from_ptr(*self.cur.offset(i)) } ) - } + fn next_back(&mut self) -> Option { self.parsed_args_list.next_back() } } impl ExactSizeIterator for Args { - fn len(&self) -> usize { self.range.len() } + fn len(&self) -> usize { self.parsed_args_list.len() } } -impl Drop for Args { - fn drop(&mut self) { - // self.cur can be null if CommandLineToArgvW previously failed, - // but LocalFree ignores NULL pointers - unsafe { c::LocalFree(self.cur as *mut c_void); } +#[cfg(test)] +mod tests { + use sys::windows::args::*; + use ffi::OsString; + + fn chk(string: &str, parts: &[&str]) { + let mut wide: Vec = OsString::from(string).encode_wide().collect(); + wide.push(0); + let parsed = unsafe { + parse_lp_cmd_line(wide.as_ptr() as *const u16, || OsString::from("TEST.EXE")) + }; + let expected: Vec = parts.iter().map(|k| OsString::from(k)).collect(); + assert_eq!(parsed.as_slice(), expected.as_slice()); + } + + #[test] + fn empty() { + chk("", &["TEST.EXE"]); + chk("\0", &["TEST.EXE"]); + } + + #[test] + fn single_words() { + chk("EXE one_word", &["EXE", "one_word"]); + chk("EXE a", &["EXE", "a"]); + chk("EXE 😅", &["EXE", "😅"]); + chk("EXE 😅🤦", &["EXE", "😅🤦"]); + } + + #[test] + fn official_examples() { + chk(r#"EXE "abc" d e"#, &["EXE", "abc", "d", "e"]); + chk(r#"EXE a\\\b d"e f"g h"#, &["EXE", r#"a\\\b"#, "de fg", "h"]); + chk(r#"EXE a\\\"b c d"#, &["EXE", r#"a\"b"#, "c", "d"]); + chk(r#"EXE a\\\\"b c" d e"#, &["EXE", r#"a\\b c"#, "d", "e"]); + } + + #[test] + fn whitespace_behavior() { + chk(r#" test"#, &["", "test"]); + chk(r#" test"#, &["", "test"]); + chk(r#" test test2"#, &["", "test", "test2"]); + chk(r#" test test2"#, &["", "test", "test2"]); + chk(r#"test test2 "#, &["test", "test2"]); + chk(r#"test test2 "#, &["test", "test2"]); + chk(r#"test "#, &["test"]); + } + + #[test] + fn genius_quotes() { + chk(r#"EXE "" """#, &["EXE", "", ""]); + chk(r#"EXE "" """"#, &["EXE", "", "\""]); + chk( + r#"EXE "this is """all""" in the same argument""#, + &["EXE", "this is \"all\" in the same argument"] + ); + chk(r#"EXE "a"""#, &["EXE", "a\""]); + chk(r#"EXE "a"" a"#, &["EXE", "a\"", "a"]); + // quotes cannot be escaped in command names + chk(r#""EXE" check"#, &["EXE", "check"]); + chk(r#""EXE check""#, &["EXE check"]); + chk(r#""EXE """for""" check"#, &["EXE ", r#"for""#, "check"]); + chk(r#""EXE \"for\" check"#, &[r#"EXE \"#, r#"for""#, "check"]); } } diff --git a/src/libstd/sys/windows/backtrace/backtrace_gnu.rs b/src/libstd/sys/windows/backtrace/backtrace_gnu.rs index f0d29dd4178..e8aa9399742 100644 --- a/src/libstd/sys/windows/backtrace/backtrace_gnu.rs +++ b/src/libstd/sys/windows/backtrace/backtrace_gnu.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use io; use sys::c; use libc::c_char; diff --git a/src/libstd/sys/windows/backtrace/mod.rs b/src/libstd/sys/windows/backtrace/mod.rs index cfa9e7b7c25..4bda8ac91da 100644 --- a/src/libstd/sys/windows/backtrace/mod.rs +++ b/src/libstd/sys/windows/backtrace/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! As always, windows has something very different than unix, we mainly want //! to avoid having to depend too much on libunwind for windows. //! @@ -113,7 +103,7 @@ fn set_frames(StackWalk: W, frames: &mut [Frame]) -> io::Result< frames[i] = Frame { symbol_addr: addr, exact_position: addr, - inline_context: 0, + inline_context: frame.get_inline_context(), }; i += 1 @@ -219,6 +209,7 @@ trait StackFrame { fn new() -> Self; fn init(&mut self, ctx: &c::CONTEXT) -> c::DWORD; fn get_addr(&self) -> *const u8; + fn get_inline_context(&self) -> u32; } impl StackFrame for c::STACKFRAME_EX { @@ -273,6 +264,10 @@ impl StackFrame for c::STACKFRAME_EX { fn get_addr(&self) -> *const u8 { (self.AddrPC.Offset - 1) as *const u8 } + + fn get_inline_context(&self) -> u32 { + self.InlineFrameContext + } } impl StackFrame for c::STACKFRAME64 { @@ -327,6 +322,10 @@ impl StackFrame for c::STACKFRAME64 { fn get_addr(&self) -> *const u8 { (self.AddrPC.Offset - 1) as *const u8 } + + fn get_inline_context(&self) -> u32 { + 0 + } } enum StackWalkVariant { diff --git a/src/libstd/sys/windows/backtrace/printing/mod.rs b/src/libstd/sys/windows/backtrace/printing/mod.rs index 251d5028aea..d44df7e5f24 100644 --- a/src/libstd/sys/windows/backtrace/printing/mod.rs +++ b/src/libstd/sys/windows/backtrace/printing/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[cfg(target_env = "msvc")] #[path = "msvc.rs"] mod printing; diff --git a/src/libstd/sys/windows/backtrace/printing/msvc.rs b/src/libstd/sys/windows/backtrace/printing/msvc.rs index c8b946bf13a..b186bb42334 100644 --- a/src/libstd/sys/windows/backtrace/printing/msvc.rs +++ b/src/libstd/sys/windows/backtrace/printing/msvc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ffi::CStr; use io; use libc::{c_char, c_ulong}; diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index c84874a3e88..28fd4df386e 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! C definitions used by libnative that don't belong in liblibc #![allow(nonstandard_style)] @@ -1035,9 +1025,6 @@ extern "system" { pub fn SetLastError(dwErrCode: DWORD); pub fn GetCommandLineW() -> *mut LPCWSTR; - pub fn LocalFree(ptr: *mut c_void); - pub fn CommandLineToArgvW(lpCmdLine: *mut LPCWSTR, - pNumArgs: *mut c_int) -> *mut *mut u16; pub fn GetTempPathW(nBufferLength: DWORD, lpBuffer: LPCWSTR) -> DWORD; pub fn OpenProcessToken(ProcessHandle: HANDLE, diff --git a/src/libstd/sys/windows/cmath.rs b/src/libstd/sys/windows/cmath.rs index b665a2c9ba4..e744cb219a8 100644 --- a/src/libstd/sys/windows/cmath.rs +++ b/src/libstd/sys/windows/cmath.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![cfg(not(test))] use libc::{c_float, c_double}; diff --git a/src/libstd/sys/windows/compat.rs b/src/libstd/sys/windows/compat.rs index cd42b7d05ee..b6c55344c62 100644 --- a/src/libstd/sys/windows/compat.rs +++ b/src/libstd/sys/windows/compat.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A "compatibility layer" for spanning XP and Windows 7 //! //! The standard library currently binds many functions that are not available diff --git a/src/libstd/sys/windows/condvar.rs b/src/libstd/sys/windows/condvar.rs index d708b327c55..48d8af73913 100644 --- a/src/libstd/sys/windows/condvar.rs +++ b/src/libstd/sys/windows/condvar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cell::UnsafeCell; use sys::c; use sys::mutex::{self, Mutex}; diff --git a/src/libstd/sys/windows/dynamic_lib.rs b/src/libstd/sys/windows/dynamic_lib.rs index 5227280808f..fa3c5ecb977 100644 --- a/src/libstd/sys/windows/dynamic_lib.rs +++ b/src/libstd/sys/windows/dynamic_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use os::windows::prelude::*; use ffi::{CString, OsStr}; diff --git a/src/libstd/sys/windows/env.rs b/src/libstd/sys/windows/env.rs index e6d74895774..f0a99d6200c 100644 --- a/src/libstd/sys/windows/env.rs +++ b/src/libstd/sys/windows/env.rs @@ -1,19 +1,9 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod os { - pub const FAMILY: &'static str = "windows"; - pub const OS: &'static str = "windows"; - pub const DLL_PREFIX: &'static str = ""; - pub const DLL_SUFFIX: &'static str = ".dll"; - pub const DLL_EXTENSION: &'static str = "dll"; - pub const EXE_SUFFIX: &'static str = ".exe"; - pub const EXE_EXTENSION: &'static str = "exe"; + pub const FAMILY: &str = "windows"; + pub const OS: &str = "windows"; + pub const DLL_PREFIX: &str = ""; + pub const DLL_SUFFIX: &str = ".dll"; + pub const DLL_EXTENSION: &str = "dll"; + pub const EXE_SUFFIX: &str = ".exe"; + pub const EXE_EXTENSION: &str = "exe"; } diff --git a/src/libstd/sys/windows/ext/ffi.rs b/src/libstd/sys/windows/ext/ffi.rs index bae0d02786a..eb278919307 100644 --- a/src/libstd/sys/windows/ext/ffi.rs +++ b/src/libstd/sys/windows/ext/ffi.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Windows-specific extensions to the primitives in the `std::ffi` module. //! //! # Overview @@ -117,7 +107,7 @@ impl OsStringExt for OsString { /// [`OsStr`]: ../../../../std/ffi/struct.OsStr.html #[stable(feature = "rust1", since = "1.0.0")] pub trait OsStrExt { - /// Re-encodes an `OsStr` as a wide character sequence, i.e. potentially + /// Re-encodes an `OsStr` as a wide character sequence, i.e., potentially /// ill-formed UTF-16. /// /// This is lossless: calling [`OsString::from_wide`] and then diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs index 78c9e95a055..6342af46daf 100644 --- a/src/libstd/sys/windows/ext/fs.rs +++ b/src/libstd/sys/windows/ext/fs.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Windows-specific extensions for the primitives in the `std::fs` module. #![stable(feature = "rust1", since = "1.0.0")] @@ -136,7 +126,7 @@ pub trait OpenOptionsExt { /// /// By default `share_mode` is set to /// `FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE`. This allows - /// other processes to to read, write, and delete/rename the same file + /// other processes to read, write, and delete/rename the same file /// while it is open. Removing any of the flags will prevent other /// processes from performing the corresponding operation until the file /// handle is closed. diff --git a/src/libstd/sys/windows/ext/io.rs b/src/libstd/sys/windows/ext/io.rs index 90128dda088..76143dee464 100644 --- a/src/libstd/sys/windows/ext/io.rs +++ b/src/libstd/sys/windows/ext/io.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![stable(feature = "rust1", since = "1.0.0")] use fs; diff --git a/src/libstd/sys/windows/ext/mod.rs b/src/libstd/sys/windows/ext/mod.rs index 1f10609f32c..0a6d435d329 100644 --- a/src/libstd/sys/windows/ext/mod.rs +++ b/src/libstd/sys/windows/ext/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Platform-specific extensions to `std` for Windows. //! //! Provides access to platform-level information for Windows, and exposes diff --git a/src/libstd/sys/windows/ext/process.rs b/src/libstd/sys/windows/ext/process.rs index a02bcbe0c87..15f0fd4e11f 100644 --- a/src/libstd/sys/windows/ext/process.rs +++ b/src/libstd/sys/windows/ext/process.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Extensions to `std::process` for Windows. #![stable(feature = "process_extensions", since = "1.2.0")] diff --git a/src/libstd/sys/windows/ext/raw.rs b/src/libstd/sys/windows/ext/raw.rs index 92d53e2e428..77428d9e774 100644 --- a/src/libstd/sys/windows/ext/raw.rs +++ b/src/libstd/sys/windows/ext/raw.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Windows-specific primitives #![stable(feature = "raw_ext", since = "1.1.0")] diff --git a/src/libstd/sys/windows/ext/thread.rs b/src/libstd/sys/windows/ext/thread.rs index 36b3a3d4bde..29d612fedc0 100644 --- a/src/libstd/sys/windows/ext/thread.rs +++ b/src/libstd/sys/windows/ext/thread.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Extensions to `std::thread` for Windows. #![stable(feature = "thread_extensions", since = "1.9.0")] diff --git a/src/libstd/sys/windows/fast_thread_local.rs b/src/libstd/sys/windows/fast_thread_local.rs index 9fee9bd93b4..f8b936b4810 100644 --- a/src/libstd/sys/windows/fast_thread_local.rs +++ b/src/libstd/sys/windows/fast_thread_local.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(feature = "thread_local_internals", issue = "0")] #![cfg(target_thread_local)] diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index 082d4689c7b..533b8ae9ba2 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use os::windows::prelude::*; use ffi::OsString; @@ -443,7 +433,7 @@ impl FromInner for File { impl fmt::Debug for File { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - // FIXME(#24570): add more info here (e.g. mode) + // FIXME(#24570): add more info here (e.g., mode) let mut b = f.debug_struct("File"); b.field("handle", &self.handle.raw()); if let Ok(path) = get_path(&self) { diff --git a/src/libstd/sys/windows/handle.rs b/src/libstd/sys/windows/handle.rs index 3729d6d6534..855efbd3eb5 100644 --- a/src/libstd/sys/windows/handle.rs +++ b/src/libstd/sys/windows/handle.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(issue = "0", feature = "windows_handle")] use cmp; @@ -170,11 +160,6 @@ impl RawHandle { } } - pub fn read_to_end(&self, buf: &mut Vec) -> io::Result { - let mut me = self; - (&mut me).read_to_end(buf) - } - pub fn write(&self, buf: &[u8]) -> io::Result { let mut amt = 0; let len = cmp::min(buf.len(), ::max_value() as usize) as c::DWORD; diff --git a/src/libstd/sys/windows/memchr.rs b/src/libstd/sys/windows/memchr.rs index fa7c816fd02..b9e5bcc1b4b 100644 --- a/src/libstd/sys/windows/memchr.rs +++ b/src/libstd/sys/windows/memchr.rs @@ -1,15 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -// Original implementation taken from rust-memchr +// Original implementation taken from rust-memchr. // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch -// Fallback memchr is fastest on windows +// Fallback memchr is fastest on Windows. pub use core::slice::memchr::{memchr, memrchr}; diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index f880bc8c050..e97e436efbf 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(missing_docs, nonstandard_style)] use ptr; diff --git a/src/libstd/sys/windows/mutex.rs b/src/libstd/sys/windows/mutex.rs index b0e7331e2b6..f690580ae38 100644 --- a/src/libstd/sys/windows/mutex.rs +++ b/src/libstd/sys/windows/mutex.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! System Mutexes //! //! The Windows implementation of mutexes is a little odd and it may not be @@ -30,7 +20,7 @@ //! detect recursive locks. use cell::UnsafeCell; -use mem; +use mem::{self, MaybeUninit}; use sync::atomic::{AtomicUsize, Ordering}; use sys::c; use sys::compat; @@ -157,34 +147,34 @@ fn kind() -> Kind { return ret; } -pub struct ReentrantMutex { inner: UnsafeCell } +pub struct ReentrantMutex { inner: UnsafeCell> } unsafe impl Send for ReentrantMutex {} unsafe impl Sync for ReentrantMutex {} impl ReentrantMutex { - pub unsafe fn uninitialized() -> ReentrantMutex { - mem::uninitialized() + pub fn uninitialized() -> ReentrantMutex { + ReentrantMutex { inner: UnsafeCell::new(MaybeUninit::uninitialized()) } } pub unsafe fn init(&mut self) { - c::InitializeCriticalSection(self.inner.get()); + c::InitializeCriticalSection((&mut *self.inner.get()).as_mut_ptr()); } pub unsafe fn lock(&self) { - c::EnterCriticalSection(self.inner.get()); + c::EnterCriticalSection((&mut *self.inner.get()).as_mut_ptr()); } #[inline] pub unsafe fn try_lock(&self) -> bool { - c::TryEnterCriticalSection(self.inner.get()) != 0 + c::TryEnterCriticalSection((&mut *self.inner.get()).as_mut_ptr()) != 0 } pub unsafe fn unlock(&self) { - c::LeaveCriticalSection(self.inner.get()); + c::LeaveCriticalSection((&mut *self.inner.get()).as_mut_ptr()); } pub unsafe fn destroy(&self) { - c::DeleteCriticalSection(self.inner.get()); + c::DeleteCriticalSection((&mut *self.inner.get()).as_mut_ptr()); } } diff --git a/src/libstd/sys/windows/net.rs b/src/libstd/sys/windows/net.rs index cd8acff6b0c..acda81dcde5 100644 --- a/src/libstd/sys/windows/net.rs +++ b/src/libstd/sys/windows/net.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(issue = "0", feature = "windows_net")] use cmp; diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index 29ea82c2053..5f478827b43 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of `std::os` functionality for Windows #![allow(nonstandard_style)] @@ -48,8 +38,8 @@ pub fn error_string(mut errnum: i32) -> String { // `[MS-ERREF]`: https://msdn.microsoft.com/en-us/library/cc231198.aspx if (errnum & c::FACILITY_NT_BIT as i32) != 0 { // format according to https://support.microsoft.com/en-us/help/259693 - const NTDLL_DLL: &'static [u16] = &['N' as _, 'T' as _, 'D' as _, 'L' as _, 'L' as _, - '.' as _, 'D' as _, 'L' as _, 'L' as _, 0]; + const NTDLL_DLL: &[u16] = &['N' as _, 'T' as _, 'D' as _, 'L' as _, 'L' as _, + '.' as _, 'D' as _, 'L' as _, 'L' as _, 0]; module = c::GetModuleHandleW(NTDLL_DLL.as_ptr()); if module != ptr::null_mut() { @@ -67,7 +57,7 @@ pub fn error_string(mut errnum: i32) -> String { buf.len() as c::DWORD, ptr::null()) as usize; if res == 0 { - // Sometimes FormatMessageW can fail e.g. system doesn't like langId, + // Sometimes FormatMessageW can fail e.g., system doesn't like langId, let fm_err = errno(); return format!("OS Error {} (FormatMessageW() returned error {})", errnum, fm_err); @@ -76,7 +66,7 @@ pub fn error_string(mut errnum: i32) -> String { match String::from_utf16(&buf[..res]) { Ok(mut msg) => { // Trim trailing CRLF inserted by FormatMessageW - let len = msg.trim_right().len(); + let len = msg.trim_end().len(); msg.truncate(len); msg }, diff --git a/src/libstd/sys/windows/os_str.rs b/src/libstd/sys/windows/os_str.rs index bcc66b9954b..7e4bcd990b1 100644 --- a/src/libstd/sys/windows/os_str.rs +++ b/src/libstd/sys/windows/os_str.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// The underlying OsString/OsStr implementation on Windows is a /// wrapper around the "WTF-8" encoding; see the `wtf8` module for more. diff --git a/src/libstd/sys/windows/path.rs b/src/libstd/sys/windows/path.rs index 98d62a0c953..ad1759e84c3 100644 --- a/src/libstd/sys/windows/path.rs +++ b/src/libstd/sys/windows/path.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use path::Prefix; use ffi::OsStr; use mem; @@ -91,10 +81,7 @@ pub fn parse_prefix<'a>(path: &'a OsStr) -> Option { } fn parse_two_comps(mut path: &[u8], f: fn(u8) -> bool) -> Option<(&[u8], &[u8])> { - let first = match path.iter().position(|x| f(*x)) { - None => return None, - Some(x) => &path[..x], - }; + let first = &path[..path.iter().position(|x| f(*x))?]; path = &path[(first.len() + 1)..]; let idx = path.iter().position(|x| f(*x)); let second = &path[..idx.unwrap_or(path.len())]; @@ -102,5 +89,5 @@ pub fn parse_prefix<'a>(path: &'a OsStr) -> Option { } } -pub const MAIN_SEP_STR: &'static str = "\\"; +pub const MAIN_SEP_STR: &str = "\\"; pub const MAIN_SEP: char = '\\'; diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs index 4b19519a57a..0d9195a5c97 100644 --- a/src/libstd/sys/windows/pipe.rs +++ b/src/libstd/sys/windows/pipe.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use os::windows::prelude::*; use ffi::OsStr; @@ -17,7 +7,7 @@ use path::Path; use ptr; use slice; use sync::atomic::Ordering::SeqCst; -use sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT}; +use sync::atomic::AtomicUsize; use sys::c; use sys::fs::{File, OpenOptions}; use sys::handle::Handle; @@ -100,23 +90,23 @@ pub fn anon_pipe(ours_readable: bool) -> io::Result { 0, ptr::null_mut()); - // We pass the FILE_FLAG_FIRST_PIPE_INSTANCE flag above, and we're + // We pass the `FILE_FLAG_FIRST_PIPE_INSTANCE` flag above, and we're // also just doing a best effort at selecting a unique name. If - // ERROR_ACCESS_DENIED is returned then it could mean that we + // `ERROR_ACCESS_DENIED` is returned then it could mean that we // accidentally conflicted with an already existing pipe, so we try // again. // // Don't try again too much though as this could also perhaps be a // legit error. - // If ERROR_INVALID_PARAMETER is returned, this probably means we're - // running on pre-Vista version where PIPE_REJECT_REMOTE_CLIENTS is + // If `ERROR_INVALID_PARAMETER` is returned, this probably means we're + // running on pre-Vista version where `PIPE_REJECT_REMOTE_CLIENTS` is // not supported, so we continue retrying without it. This implies // reduced security on Windows versions older than Vista by allowing // connections to this pipe from remote machines. // Proper fix would increase the number of FFI imports and introduce // significant amount of Windows XP specific code with no clean // testing strategy - // for more info see https://github.com/rust-lang/rust/pull/37677 + // For more info, see https://github.com/rust-lang/rust/pull/37677. if handle == c::INVALID_HANDLE_VALUE { let err = io::Error::last_os_error(); let raw_os_err = err.raw_os_error(); @@ -158,7 +148,7 @@ pub fn anon_pipe(ours_readable: bool) -> io::Result { } fn random_number() -> usize { - static N: AtomicUsize = ATOMIC_USIZE_INIT; + static N: AtomicUsize = AtomicUsize::new(0); loop { if N.load(SeqCst) != 0 { return N.fetch_add(1, SeqCst) diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index ff1ee0d26fe..08a166bd8c5 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(feature = "process_internals", issue = "0")] use collections::BTreeMap; @@ -403,7 +393,16 @@ impl From for ExitStatus { impl fmt::Display for ExitStatus { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "exit code: {}", self.0) + // Windows exit codes with the high bit set typically mean some form of + // unhandled exception or warning. In this scenario printing the exit + // code in decimal doesn't always make sense because it's a very large + // and somewhat gibberish number. The hex code is a bit more + // recognizable and easier to search for, so print that. + if self.0 & 0x80000000 != 0 { + write!(f, "exit code: {:#x}", self.0) + } else { + write!(f, "exit code: {}", self.0) + } } } @@ -487,7 +486,7 @@ fn make_command_line(prog: &OsStr, args: &[OsString]) -> io::Result> { } else { if x == '"' as u16 { // Add n+1 backslashes to total 2n+1 before internal '"'. - cmd.extend((0..(backslashes + 1)).map(|_| '\\' as u16)); + cmd.extend((0..=backslashes).map(|_| '\\' as u16)); } backslashes = 0; } diff --git a/src/libstd/sys/windows/rand.rs b/src/libstd/sys/windows/rand.rs index 262323656aa..4f000dceb2f 100644 --- a/src/libstd/sys/windows/rand.rs +++ b/src/libstd/sys/windows/rand.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use io; use mem; use sys::c; diff --git a/src/libstd/sys/windows/rwlock.rs b/src/libstd/sys/windows/rwlock.rs index 3e81ebfcedf..3cd19470101 100644 --- a/src/libstd/sys/windows/rwlock.rs +++ b/src/libstd/sys/windows/rwlock.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cell::UnsafeCell; use sys::c; diff --git a/src/libstd/sys/windows/stack_overflow.rs b/src/libstd/sys/windows/stack_overflow.rs index 4a406d70e63..0c7de0bc9e8 100644 --- a/src/libstd/sys/windows/stack_overflow.rs +++ b/src/libstd/sys/windows/stack_overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![cfg_attr(test, allow(dead_code))] use sys_common::util::report_overflow; diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs index 81b89da21d3..a4f4bd22cd9 100644 --- a/src/libstd/sys/windows/stdio.rs +++ b/src/libstd/sys/windows/stdio.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(issue = "0", feature = "windows_stdio")] use io::prelude::*; @@ -48,7 +38,7 @@ pub fn get(handle: c::DWORD) -> io::Result { } fn write(handle: c::DWORD, data: &[u8]) -> io::Result { - let handle = match try!(get(handle)) { + let handle = match get(handle)? { Output::Console(c) => c, Output::Pipe(p) => { let handle = Handle::new(p); @@ -99,7 +89,7 @@ impl Stdin { } pub fn read(&self, buf: &mut [u8]) -> io::Result { - let handle = match try!(get(c::STD_INPUT_HANDLE)) { + let handle = match get(c::STD_INPUT_HANDLE)? { Output::Console(c) => c, Output::Pipe(p) => { let handle = Handle::new(p); @@ -138,11 +128,6 @@ impl Stdin { // MemReader shouldn't error here since we just filled it utf8.read(buf) } - - pub fn read_to_end(&self, buf: &mut Vec) -> io::Result { - let mut me = self; - (&mut me).read_to_end(buf) - } } #[unstable(reason = "not public", issue = "0", feature = "fd_read")] @@ -228,6 +213,6 @@ pub fn is_ebadf(err: &io::Error) -> bool { // been seen to be acceptable. pub const STDIN_BUF_SIZE: usize = 8 * 1024; -pub fn stderr_prints_nothing() -> bool { - false +pub fn panic_output() -> Option { + Stderr::new().ok() } diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index 85588cc6c8e..bd7cb673a0d 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use boxed::FnBox; use io; use ffi::CStr; @@ -28,7 +18,8 @@ pub struct Thread { } impl Thread { - pub unsafe fn new<'a>(stack: usize, p: Box) + // unsafe: see thread::Builder::spawn_unchecked for safety requirements + pub unsafe fn new(stack: usize, p: Box) -> io::Result { let p = box p; @@ -97,5 +88,4 @@ pub mod guard { pub type Guard = !; pub unsafe fn current() -> Option { None } pub unsafe fn init() -> Option { None } - pub unsafe fn deinit() {} } diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index cdad320e122..50bbd5476b3 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use mem; use ptr; use sync::atomic::AtomicPtr; diff --git a/src/libstd/sys/windows/time.rs b/src/libstd/sys/windows/time.rs index 54bcbc76b1a..8a8159af2f1 100644 --- a/src/libstd/sys/windows/time.rs +++ b/src/libstd/sys/windows/time.rs @@ -1,20 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cmp::Ordering; use fmt; use mem; -use sync::Once; use sys::c; -use sys::cvt; -use sys_common::mul_div_u64; use time::Duration; use convert::TryInto; use core::hash::{Hash, Hasher}; @@ -24,7 +11,9 @@ const INTERVALS_PER_SEC: u64 = NANOS_PER_SEC / 100; #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Debug, Hash)] pub struct Instant { - t: c::LARGE_INTEGER, + // This duration is relative to an arbitrary microsecond epoch + // from the winapi QueryPerformanceCounter function. + t: Duration, } #[derive(Copy, Clone)] @@ -43,55 +32,45 @@ pub const UNIX_EPOCH: SystemTime = SystemTime { impl Instant { pub fn now() -> Instant { - let mut t = Instant { t: 0 }; - cvt(unsafe { - c::QueryPerformanceCounter(&mut t.t) - }).unwrap(); - t + // High precision timing on windows operates in "Performance Counter" + // units, as returned by the WINAPI QueryPerformanceCounter function. + // These relate to seconds by a factor of QueryPerformanceFrequency. + // In order to keep unit conversions out of normal interval math, we + // measure in QPC units and immediately convert to nanoseconds. + perf_counter::PerformanceCounterInstant::now().into() + } + + pub fn actually_monotonic() -> bool { + false + } + + pub const fn zero() -> Instant { + Instant { t: Duration::from_secs(0) } } pub fn sub_instant(&self, other: &Instant) -> Duration { - // Values which are +- 1 need to be considered as basically the same - // units in time due to various measurement oddities, according to - // Windows [1] - // - // [1]: - // https://msdn.microsoft.com/en-us/library/windows/desktop - // /dn553408%28v=vs.85%29.aspx#guidance - if other.t > self.t && other.t - self.t == 1 { + // On windows there's a threshold below which we consider two timestamps + // equivalent due to measurement error. For more details + doc link, + // check the docs on epsilon. + let epsilon = + perf_counter::PerformanceCounterInstant::epsilon(); + if other.t > self.t && other.t - self.t <= epsilon { return Duration::new(0, 0) } - let diff = (self.t as u64).checked_sub(other.t as u64) - .expect("specified instant was later than \ - self"); - let nanos = mul_div_u64(diff, NANOS_PER_SEC, frequency() as u64); - Duration::new(nanos / NANOS_PER_SEC, (nanos % NANOS_PER_SEC) as u32) - } - - pub fn add_duration(&self, other: &Duration) -> Instant { - let freq = frequency() as u64; - let t = other.as_secs().checked_mul(freq).and_then(|i| { - (self.t as u64).checked_add(i) - }).and_then(|i| { - i.checked_add(mul_div_u64(other.subsec_nanos() as u64, freq, - NANOS_PER_SEC)) - }).expect("overflow when adding duration to time"); - Instant { - t: t as c::LARGE_INTEGER, - } + self.t.checked_sub(other.t) + .expect("specified instant was later than self") } - pub fn sub_duration(&self, other: &Duration) -> Instant { - let freq = frequency() as u64; - let t = other.as_secs().checked_mul(freq).and_then(|i| { - (self.t as u64).checked_sub(i) - }).and_then(|i| { - i.checked_sub(mul_div_u64(other.subsec_nanos() as u64, freq, - NANOS_PER_SEC)) - }).expect("overflow when subtracting duration from time"); - Instant { - t: t as c::LARGE_INTEGER, - } + pub fn checked_add_duration(&self, other: &Duration) -> Option { + Some(Instant { + t: self.t.checked_add(*other)? + }) + } + + pub fn checked_sub_duration(&self, other: &Duration) -> Option { + Some(Instant { + t: self.t.checked_sub(*other)? + }) } } @@ -127,16 +106,14 @@ impl SystemTime { } } - pub fn add_duration(&self, other: &Duration) -> SystemTime { - let intervals = self.intervals().checked_add(dur2intervals(other)) - .expect("overflow when adding duration to time"); - SystemTime::from_intervals(intervals) + pub fn checked_add_duration(&self, other: &Duration) -> Option { + let intervals = self.intervals().checked_add(checked_dur2intervals(other)?)?; + Some(SystemTime::from_intervals(intervals)) } - pub fn sub_duration(&self, other: &Duration) -> SystemTime { - let intervals = self.intervals().checked_sub(dur2intervals(other)) - .expect("overflow when subtracting from time"); - SystemTime::from_intervals(intervals) + pub fn checked_sub_duration(&self, other: &Duration) -> Option { + let intervals = self.intervals().checked_sub(checked_dur2intervals(other)?)?; + Some(SystemTime::from_intervals(intervals)) } } @@ -180,12 +157,12 @@ impl Hash for SystemTime { } } -fn dur2intervals(d: &Duration) -> i64 { - d.as_secs() - .checked_mul(INTERVALS_PER_SEC) - .and_then(|i| i.checked_add(d.subsec_nanos() as u64 / 100)) - .and_then(|i| i.try_into().ok()) - .expect("overflow when converting duration to intervals") +fn checked_dur2intervals(dur: &Duration) -> Option { + dur.as_secs() + .checked_mul(INTERVALS_PER_SEC)? + .checked_add(dur.subsec_nanos() as u64 / 100)? + .try_into() + .ok() } fn intervals2dur(intervals: u64) -> Duration { @@ -193,14 +170,60 @@ fn intervals2dur(intervals: u64) -> Duration { ((intervals % INTERVALS_PER_SEC) * 100) as u32) } -fn frequency() -> c::LARGE_INTEGER { - static mut FREQUENCY: c::LARGE_INTEGER = 0; - static ONCE: Once = Once::new(); +mod perf_counter { + use super::{NANOS_PER_SEC}; + use sync::Once; + use sys_common::mul_div_u64; + use sys::c; + use sys::cvt; + use time::Duration; + + pub struct PerformanceCounterInstant { + ts: c::LARGE_INTEGER + } + impl PerformanceCounterInstant { + pub fn now() -> Self { + Self { + ts: query() + } + } + + // Per microsoft docs, the margin of error for cross-thread time comparisons + // using QueryPerformanceCounter is 1 "tick" -- defined as 1/frequency(). + // Reference: https://docs.microsoft.com/en-us/windows/desktop/SysInfo + // /acquiring-high-resolution-time-stamps + pub fn epsilon() -> Duration { + let epsilon = NANOS_PER_SEC / (frequency() as u64); + Duration::from_nanos(epsilon) + } + } + impl From for super::Instant { + fn from(other: PerformanceCounterInstant) -> Self { + let freq = frequency() as u64; + let instant_nsec = mul_div_u64(other.ts as u64, NANOS_PER_SEC, freq); + Self { + t: Duration::from_nanos(instant_nsec) + } + } + } + + fn frequency() -> c::LARGE_INTEGER { + static mut FREQUENCY: c::LARGE_INTEGER = 0; + static ONCE: Once = Once::new(); - unsafe { - ONCE.call_once(|| { - cvt(c::QueryPerformanceFrequency(&mut FREQUENCY)).unwrap(); - }); - FREQUENCY + unsafe { + ONCE.call_once(|| { + cvt(c::QueryPerformanceFrequency(&mut FREQUENCY)).unwrap(); + }); + FREQUENCY + } + } + + fn query() -> c::LARGE_INTEGER { + let mut qpc_value: c::LARGE_INTEGER = 0; + cvt(unsafe { + c::QueryPerformanceCounter(&mut qpc_value) + }).unwrap(); + qpc_value } } diff --git a/src/libstd/sys_common/alloc.rs b/src/libstd/sys_common/alloc.rs index 439a9dfb3fd..eac6bb454c0 100644 --- a/src/libstd/sys_common/alloc.rs +++ b/src/libstd/sys_common/alloc.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] use alloc::{GlobalAlloc, Layout, System}; diff --git a/src/libstd/sys_common/at_exit_imp.rs b/src/libstd/sys_common/at_exit_imp.rs index 76e5df2c865..cd2d176c2a5 100644 --- a/src/libstd/sys_common/at_exit_imp.rs +++ b/src/libstd/sys_common/at_exit_imp.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of running at_exit routines //! //! Documentation can be found on the `rt::at_exit` function. diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs index 77371782977..57f31cb726c 100644 --- a/src/libstd/sys_common/backtrace.rs +++ b/src/libstd/sys_common/backtrace.rs @@ -1,24 +1,15 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Common code for printing the backtrace in the same way across the different /// supported platforms. use env; use io::prelude::*; use io; +use path::{self, Path}; +use ptr; +use rustc_demangle::demangle; use str; use sync::atomic::{self, Ordering}; -use path::{self, Path}; use sys::mutex::Mutex; -use ptr; pub use sys::backtrace::{ unwind_backtrace, @@ -52,6 +43,14 @@ const MAX_NB_FRAMES: usize = 100; pub fn print(w: &mut dyn Write, format: PrintFormat) -> io::Result<()> { static LOCK: Mutex = Mutex::new(); + // There are issues currently linking libbacktrace into tests, and in + // general during libstd's own unit tests we're not testing this path. In + // test mode immediately return here to optimize away any references to the + // libbacktrace symbols + if cfg!(test) { + return Ok(()) + } + // Use a lock to prevent mixed output in multithreading context. // Some platforms also requires it, like `SymFromAddr` on Windows. unsafe { @@ -191,7 +190,14 @@ fn output(w: &mut dyn Write, idx: usize, frame: Frame, PrintFormat::Short => write!(w, " {:2}: ", idx)?, } match s { - Some(string) => demangle(w, string, format)?, + Some(string) => { + let symbol = demangle(string); + match format { + PrintFormat::Full => write!(w, "{}", symbol)?, + // strip the trailing hash if short mode + PrintFormat::Short => write!(w, "{:#}", symbol)?, + } + } None => w.write_all(b"")?, } w.write_all(b"\n") @@ -235,228 +241,3 @@ fn output_fileline(w: &mut dyn Write, w.write_all(b"\n") } - -// All rust symbols are in theory lists of "::"-separated identifiers. Some -// assemblers, however, can't handle these characters in symbol names. To get -// around this, we use C++-style mangling. The mangling method is: -// -// 1. Prefix the symbol with "_ZN" -// 2. For each element of the path, emit the length plus the element -// 3. End the path with "E" -// -// For example, "_ZN4testE" => "test" and "_ZN3foo3barE" => "foo::bar". -// -// We're the ones printing our backtraces, so we can't rely on anything else to -// demangle our symbols. It's *much* nicer to look at demangled symbols, so -// this function is implemented to give us nice pretty output. -// -// Note that this demangler isn't quite as fancy as it could be. We have lots -// of other information in our symbols like hashes, version, type information, -// etc. Additionally, this doesn't handle glue symbols at all. -pub fn demangle(writer: &mut dyn Write, mut s: &str, format: PrintFormat) -> io::Result<()> { - // During ThinLTO LLVM may import and rename internal symbols, so strip out - // those endings first as they're one of the last manglings applied to - // symbol names. - let llvm = ".llvm."; - if let Some(i) = s.find(llvm) { - let candidate = &s[i + llvm.len()..]; - let all_hex = candidate.chars().all(|c| { - match c { - 'A' ..= 'F' | '0' ..= '9' => true, - _ => false, - } - }); - - if all_hex { - s = &s[..i]; - } - } - - // Validate the symbol. If it doesn't look like anything we're - // expecting, we just print it literally. Note that we must handle non-rust - // symbols because we could have any function in the backtrace. - let mut valid = true; - let mut inner = s; - if s.len() > 4 && s.starts_with("_ZN") && s.ends_with("E") { - inner = &s[3 .. s.len() - 1]; - // On Windows, dbghelp strips leading underscores, so we accept "ZN...E" form too. - } else if s.len() > 3 && s.starts_with("ZN") && s.ends_with("E") { - inner = &s[2 .. s.len() - 1]; - } else { - valid = false; - } - - if valid { - let mut chars = inner.chars(); - while valid { - let mut i = 0; - for c in chars.by_ref() { - if c.is_numeric() { - i = i * 10 + c as usize - '0' as usize; - } else { - break - } - } - if i == 0 { - valid = chars.next().is_none(); - break - } else if chars.by_ref().take(i - 1).count() != i - 1 { - valid = false; - } - } - } - - // Alright, let's do this. - if !valid { - writer.write_all(s.as_bytes())?; - } else { - // remove the `::hfc2edb670e5eda97` part at the end of the symbol. - if format == PrintFormat::Short { - // The symbol in still mangled. - let mut split = inner.rsplitn(2, "17h"); - match (split.next(), split.next()) { - (Some(addr), rest) => { - if addr.len() == 16 && - addr.chars().all(|c| c.is_digit(16)) - { - inner = rest.unwrap_or(""); - } - } - _ => (), - } - } - - let mut first = true; - while !inner.is_empty() { - if !first { - writer.write_all(b"::")?; - } else { - first = false; - } - let mut rest = inner; - while rest.chars().next().unwrap().is_numeric() { - rest = &rest[1..]; - } - let i: usize = inner[.. (inner.len() - rest.len())].parse().unwrap(); - inner = &rest[i..]; - rest = &rest[..i]; - if rest.starts_with("_$") { - rest = &rest[1..]; - } - while !rest.is_empty() { - if rest.starts_with(".") { - if let Some('.') = rest[1..].chars().next() { - writer.write_all(b"::")?; - rest = &rest[2..]; - } else { - writer.write_all(b".")?; - rest = &rest[1..]; - } - } else if rest.starts_with("$") { - macro_rules! demangle { - ($($pat:expr => $demangled:expr),*) => ({ - $(if rest.starts_with($pat) { - writer.write_all($demangled)?; - rest = &rest[$pat.len()..]; - } else)* - { - writer.write_all(rest.as_bytes())?; - break; - } - - }) - } - - // see src/librustc/back/link.rs for these mappings - demangle! ( - "$SP$" => b"@", - "$BP$" => b"*", - "$RF$" => b"&", - "$LT$" => b"<", - "$GT$" => b">", - "$LP$" => b"(", - "$RP$" => b")", - "$C$" => b",", - - // in theory we can demangle any Unicode code point, but - // for simplicity we just catch the common ones. - "$u7e$" => b"~", - "$u20$" => b" ", - "$u27$" => b"'", - "$u5b$" => b"[", - "$u5d$" => b"]", - "$u7b$" => b"{", - "$u7d$" => b"}", - "$u3b$" => b";", - "$u2b$" => b"+", - "$u22$" => b"\"" - ) - } else { - let idx = match rest.char_indices().find(|&(_, c)| c == '$' || c == '.') { - None => rest.len(), - Some((i, _)) => i, - }; - writer.write_all(rest[..idx].as_bytes())?; - rest = &rest[idx..]; - } - } - } - } - - Ok(()) -} - -#[cfg(test)] -mod tests { - use sys_common; - macro_rules! t { ($a:expr, $b:expr) => ({ - let mut m = Vec::new(); - sys_common::backtrace::demangle(&mut m, - $a, - super::PrintFormat::Full).unwrap(); - assert_eq!(String::from_utf8(m).unwrap(), $b); - }) } - - #[test] - fn demangle() { - t!("test", "test"); - t!("_ZN4testE", "test"); - t!("_ZN4test", "_ZN4test"); - t!("_ZN4test1a2bcE", "test::a::bc"); - } - - #[test] - fn demangle_dollars() { - t!("_ZN4$RP$E", ")"); - t!("_ZN8$RF$testE", "&test"); - t!("_ZN8$BP$test4foobE", "*test::foob"); - t!("_ZN9$u20$test4foobE", " test::foob"); - t!("_ZN35Bar$LT$$u5b$u32$u3b$$u20$4$u5d$$GT$E", "Bar<[u32; 4]>"); - } - - #[test] - fn demangle_many_dollars() { - t!("_ZN13test$u20$test4foobE", "test test::foob"); - t!("_ZN12test$BP$test4foobE", "test*test::foob"); - } - - #[test] - fn demangle_windows() { - t!("ZN4testE", "test"); - t!("ZN13test$u20$test4foobE", "test test::foob"); - t!("ZN12test$RF$test4foobE", "test&test::foob"); - } - - #[test] - fn demangle_elements_beginning_with_underscore() { - t!("_ZN13_$LT$test$GT$E", ""); - t!("_ZN28_$u7b$$u7b$closure$u7d$$u7d$E", "{{closure}}"); - t!("_ZN15__STATIC_FMTSTRE", "__STATIC_FMTSTR"); - } - - #[test] - fn demangle_trait_impls() { - t!("_ZN71_$LT$Test$u20$$u2b$$u20$$u27$static$u20$as$u20$foo..Bar$LT$Test$GT$$GT$3barE", - ">::bar"); - } -} diff --git a/src/libstd/sys_common/bytestring.rs b/src/libstd/sys_common/bytestring.rs index 971b83938c1..df57fae4281 100644 --- a/src/libstd/sys_common/bytestring.rs +++ b/src/libstd/sys_common/bytestring.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] use fmt::{Formatter, Result, Write}; diff --git a/src/libstd/sys_common/condvar.rs b/src/libstd/sys_common/condvar.rs index b6f29dd5fc3..ad95879f073 100644 --- a/src/libstd/sys_common/condvar.rs +++ b/src/libstd/sys_common/condvar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use time::Duration; use sys_common::mutex::{self, Mutex}; use sys::condvar as imp; diff --git a/src/libstd/sys_common/gnu/libbacktrace.rs b/src/libstd/sys_common/gnu/libbacktrace.rs index 6ad3af6aee1..188eb4e4b86 100644 --- a/src/libstd/sys_common/gnu/libbacktrace.rs +++ b/src/libstd/sys_common/gnu/libbacktrace.rs @@ -1,14 +1,5 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use libc; +use backtrace_sys::{self, backtrace_state}; use ffi::CStr; use io; @@ -23,7 +14,7 @@ pub fn foreach_symbol_fileline(frame: Frame, where F: FnMut(&[u8], u32) -> io::Result<()> { // pcinfo may return an arbitrary number of file:line pairs, - // in the order of stack trace (i.e. inlined calls first). + // in the order of stack trace (i.e., inlined calls first). // in order to avoid allocation, we stack-allocate a fixed size of entries. const FILELINE_SIZE: usize = 32; let mut fileline_buf = [(ptr::null(), !0); FILELINE_SIZE]; @@ -39,11 +30,13 @@ where F: FnMut(&[u8], u32) -> io::Result<()> let mut fileline_win: &mut [FileLine] = &mut fileline_buf; let fileline_addr = &mut fileline_win as *mut &mut [FileLine]; ret = unsafe { - backtrace_pcinfo(state, - frame.exact_position as libc::uintptr_t, - pcinfo_cb, - error_cb, - fileline_addr as *mut libc::c_void) + backtrace_sys::backtrace_pcinfo( + state, + frame.exact_position as libc::uintptr_t, + pcinfo_cb, + error_cb, + fileline_addr as *mut libc::c_void, + ) }; FILELINE_SIZE - fileline_win.len() }; @@ -76,11 +69,13 @@ pub fn resolve_symname(frame: Frame, let mut data: *const libc::c_char = ptr::null(); let data_addr = &mut data as *mut *const libc::c_char; let ret = unsafe { - backtrace_syminfo(state, - frame.symbol_addr as libc::uintptr_t, - syminfo_cb, - error_cb, - data_addr as *mut libc::c_void) + backtrace_sys::backtrace_syminfo( + state, + frame.symbol_addr as libc::uintptr_t, + syminfo_cb, + error_cb, + data_addr as *mut libc::c_void, + ) }; if ret == 0 || data.is_null() { None @@ -93,45 +88,6 @@ pub fn resolve_symname(frame: Frame, callback(symname) } -//////////////////////////////////////////////////////////////////////// -// libbacktrace.h API -//////////////////////////////////////////////////////////////////////// -type backtrace_syminfo_callback = -extern "C" fn(data: *mut libc::c_void, - pc: libc::uintptr_t, - symname: *const libc::c_char, - symval: libc::uintptr_t, - symsize: libc::uintptr_t); -type backtrace_full_callback = -extern "C" fn(data: *mut libc::c_void, - pc: libc::uintptr_t, - filename: *const libc::c_char, - lineno: libc::c_int, - function: *const libc::c_char) -> libc::c_int; -type backtrace_error_callback = -extern "C" fn(data: *mut libc::c_void, - msg: *const libc::c_char, - errnum: libc::c_int); -enum backtrace_state {} - -extern { - fn backtrace_create_state(filename: *const libc::c_char, - threaded: libc::c_int, - error: backtrace_error_callback, - data: *mut libc::c_void) - -> *mut backtrace_state; - fn backtrace_syminfo(state: *mut backtrace_state, - addr: libc::uintptr_t, - cb: backtrace_syminfo_callback, - error: backtrace_error_callback, - data: *mut libc::c_void) -> libc::c_int; - fn backtrace_pcinfo(state: *mut backtrace_state, - addr: libc::uintptr_t, - cb: backtrace_full_callback, - error: backtrace_error_callback, - data: *mut libc::c_void) -> libc::c_int; -} - //////////////////////////////////////////////////////////////////////// // helper callbacks //////////////////////////////////////////////////////////////////////// @@ -210,7 +166,11 @@ unsafe fn init_state() -> *mut backtrace_state { Err(_) => ptr::null(), }; - STATE = backtrace_create_state(filename, 0, error_cb, - ptr::null_mut()); + STATE = backtrace_sys::backtrace_create_state( + filename, + 0, + error_cb, + ptr::null_mut(), + ); STATE } diff --git a/src/libstd/sys_common/gnu/mod.rs b/src/libstd/sys_common/gnu/mod.rs index 3a8cf2d8425..d6959697f2a 100644 --- a/src/libstd/sys_common/gnu/mod.rs +++ b/src/libstd/sys_common/gnu/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(missing_docs)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] diff --git a/src/libstd/sys_common/io.rs b/src/libstd/sys_common/io.rs index a96fb192139..b9071c69b7c 100644 --- a/src/libstd/sys_common/io.rs +++ b/src/libstd/sys_common/io.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. pub const DEFAULT_BUF_SIZE: usize = 8 * 1024; #[cfg(test)] diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs index 4b8cde3d1f4..c18b603a635 100644 --- a/src/libstd/sys_common/mod.rs +++ b/src/libstd/sys_common/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Platform-independent platform abstraction //! //! This is the platform-independent portion of the standard library's @@ -57,9 +47,11 @@ pub mod bytestring; pub mod process; cfg_if! { - if #[cfg(any(target_os = "cloudabi", target_os = "l4re", target_os = "redox"))] { - pub use sys::net; - } else if #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] { + if #[cfg(any(target_os = "cloudabi", + target_os = "l4re", + target_os = "redox", + all(target_arch = "wasm32", not(target_os = "emscripten")), + all(target_vendor = "fortanix", target_env = "sgx")))] { pub use sys::net; } else { pub mod net; diff --git a/src/libstd/sys_common/mutex.rs b/src/libstd/sys_common/mutex.rs index c6d531c7a1a..536f1c70db2 100644 --- a/src/libstd/sys_common/mutex.rs +++ b/src/libstd/sys_common/mutex.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use sys::mutex as imp; /// An OS-based mutual exclusion lock. diff --git a/src/libstd/sys_common/net.rs b/src/libstd/sys_common/net.rs index d09a233ed89..f75df3ea695 100644 --- a/src/libstd/sys_common/net.rs +++ b/src/libstd/sys_common/net.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use cmp; use ffi::CString; use fmt; @@ -20,6 +10,7 @@ use sys::net::{cvt, cvt_r, cvt_gai, Socket, init, wrlen_t}; use sys::net::netc as c; use sys_common::{AsInner, FromInner, IntoInner}; use time::Duration; +use convert::{TryFrom, TryInto}; #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", @@ -129,6 +120,13 @@ fn to_ipv6mr_interface(value: u32) -> ::libc::c_uint { pub struct LookupHost { original: *mut c::addrinfo, cur: *mut c::addrinfo, + port: u16 +} + +impl LookupHost { + pub fn port(&self) -> u16 { + self.port + } } impl Iterator for LookupHost { @@ -158,17 +156,45 @@ impl Drop for LookupHost { } } -pub fn lookup_host(host: &str) -> io::Result { - init(); +impl<'a> TryFrom<&'a str> for LookupHost { + type Error = io::Error; - let c_host = CString::new(host)?; - let mut hints: c::addrinfo = unsafe { mem::zeroed() }; - hints.ai_socktype = c::SOCK_STREAM; - let mut res = ptr::null_mut(); - unsafe { - cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), &hints, &mut res)).map(|_| { - LookupHost { original: res, cur: res } - }) + fn try_from(s: &str) -> io::Result { + macro_rules! try_opt { + ($e:expr, $msg:expr) => ( + match $e { + Some(r) => r, + None => return Err(io::Error::new(io::ErrorKind::InvalidInput, + $msg)), + } + ) + } + + // split the string by ':' and convert the second part to u16 + let mut parts_iter = s.rsplitn(2, ':'); + let port_str = try_opt!(parts_iter.next(), "invalid socket address"); + let host = try_opt!(parts_iter.next(), "invalid socket address"); + let port: u16 = try_opt!(port_str.parse().ok(), "invalid port value"); + + (host, port).try_into() + } +} + +impl<'a> TryFrom<(&'a str, u16)> for LookupHost { + type Error = io::Error; + + fn try_from((host, port): (&'a str, u16)) -> io::Result { + init(); + + let c_host = CString::new(host)?; + let mut hints: c::addrinfo = unsafe { mem::zeroed() }; + hints.ai_socktype = c::SOCK_STREAM; + let mut res = ptr::null_mut(); + unsafe { + cvt_gai(c::getaddrinfo(c_host.as_ptr(), ptr::null(), &hints, &mut res)).map(|_| { + LookupHost { original: res, cur: res, port } + }) + } } } @@ -181,7 +207,9 @@ pub struct TcpStream { } impl TcpStream { - pub fn connect(addr: &SocketAddr) -> io::Result { + pub fn connect(addr: io::Result<&SocketAddr>) -> io::Result { + let addr = addr?; + init(); let sock = Socket::new(addr, c::SOCK_STREAM)?; @@ -317,7 +345,9 @@ pub struct TcpListener { } impl TcpListener { - pub fn bind(addr: &SocketAddr) -> io::Result { + pub fn bind(addr: io::Result<&SocketAddr>) -> io::Result { + let addr = addr?; + init(); let sock = Socket::new(addr, c::SOCK_STREAM)?; @@ -418,7 +448,9 @@ pub struct UdpSocket { } impl UdpSocket { - pub fn bind(addr: &SocketAddr) -> io::Result { + pub fn bind(addr: io::Result<&SocketAddr>) -> io::Result { + let addr = addr?; + init(); let sock = Socket::new(addr, c::SOCK_DGRAM)?; @@ -584,8 +616,8 @@ impl UdpSocket { Ok(ret as usize) } - pub fn connect(&self, addr: &SocketAddr) -> io::Result<()> { - let (addrp, len) = addr.into_inner(); + pub fn connect(&self, addr: io::Result<&SocketAddr>) -> io::Result<()> { + let (addrp, len) = addr?.into_inner(); cvt_r(|| unsafe { c::connect(*self.inner.as_inner(), addrp, len) }).map(|_| ()) } } @@ -618,7 +650,7 @@ mod tests { #[test] fn no_lookup_host_duplicates() { let mut addrs = HashMap::new(); - let lh = match lookup_host("localhost") { + let lh = match LookupHost::try_from(("localhost", 0)) { Ok(lh) => lh, Err(e) => panic!("couldn't resolve `localhost': {}", e) }; diff --git a/src/libstd/sys_common/poison.rs b/src/libstd/sys_common/poison.rs index af93571a604..1358916ef99 100644 --- a/src/libstd/sys_common/poison.rs +++ b/src/libstd/sys_common/poison.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use error::{Error}; use fmt; use sync::atomic::{AtomicBool, Ordering}; diff --git a/src/libstd/sys_common/process.rs b/src/libstd/sys_common/process.rs index ddf0ebe603e..3384ffeb64e 100644 --- a/src/libstd/sys_common/process.rs +++ b/src/libstd/sys_common/process.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![unstable(feature = "process_internals", issue = "0")] diff --git a/src/libstd/sys_common/remutex.rs b/src/libstd/sys_common/remutex.rs index 071a3a25c7a..9ef24433f13 100644 --- a/src/libstd/sys_common/remutex.rs +++ b/src/libstd/sys_common/remutex.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use fmt; use marker; use ops::Deref; diff --git a/src/libstd/sys_common/rwlock.rs b/src/libstd/sys_common/rwlock.rs index 71a4f01ec4c..0aa0284539a 100644 --- a/src/libstd/sys_common/rwlock.rs +++ b/src/libstd/sys_common/rwlock.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use sys::rwlock as imp; /// An OS-based reader-writer lock. diff --git a/src/libstd/sys_common/thread.rs b/src/libstd/sys_common/thread.rs index 86a5e2b8694..fe9ad7623b7 100644 --- a/src/libstd/sys_common/thread.rs +++ b/src/libstd/sys_common/thread.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use boxed::FnBox; use env; use sync::atomic::{self, Ordering}; diff --git a/src/libstd/sys_common/thread_info.rs b/src/libstd/sys_common/thread_info.rs index d75cbded734..b4bca72b09d 100644 --- a/src/libstd/sys_common/thread_info.rs +++ b/src/libstd/sys_common/thread_info.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // stack_guard isn't used right now on all platforms use cell::RefCell; diff --git a/src/libstd/sys_common/thread_local.rs b/src/libstd/sys_common/thread_local.rs index bb72cb0930a..874e58dcfee 100644 --- a/src/libstd/sys_common/thread_local.rs +++ b/src/libstd/sys_common/thread_local.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! OS-based thread local storage //! //! This module provides an implementation of OS-based thread local storage, diff --git a/src/libstd/sys_common/util.rs b/src/libstd/sys_common/util.rs index a373e980b97..7dec22be978 100644 --- a/src/libstd/sys_common/util.rs +++ b/src/libstd/sys_common/util.rs @@ -1,23 +1,12 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use fmt; use io::prelude::*; -use sys::stdio::{Stderr, stderr_prints_nothing}; +use sys::stdio::panic_output; use thread; pub fn dumb_print(args: fmt::Arguments) { - if stderr_prints_nothing() { - return + if let Some(mut out) = panic_output() { + let _ = out.write_fmt(args); } - let _ = Stderr::new().map(|mut stderr| stderr.write_fmt(args)); } // Other platforms should use the appropriate platform-specific mechanism for diff --git a/src/libstd/sys_common/wtf8.rs b/src/libstd/sys_common/wtf8.rs index 19ce932aa12..7f355fa7ec2 100644 --- a/src/libstd/sys_common/wtf8.rs +++ b/src/libstd/sys_common/wtf8.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Implementation of [the WTF-8 encoding](https://simonsapin.github.io/wtf-8/). //! //! This library uses Rust’s type system to maintain @@ -40,7 +30,7 @@ use str; use sync::Arc; use sys_common::AsInner; -const UTF8_REPLACEMENT_CHARACTER: &'static str = "\u{FFFD}"; +const UTF8_REPLACEMENT_CHARACTER: &str = "\u{FFFD}"; /// A Unicode code point: from U+0000 to U+10FFFF. /// diff --git a/src/libstd/tests/env.rs b/src/libstd/tests/env.rs index 7302a794480..e985c3899af 100644 --- a/src/libstd/tests/env.rs +++ b/src/libstd/tests/env.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate rand; use std::env::*; diff --git a/src/libstd/tests/run-time-detect.rs b/src/libstd/tests/run-time-detect.rs new file mode 100644 index 00000000000..eacce1e5682 --- /dev/null +++ b/src/libstd/tests/run-time-detect.rs @@ -0,0 +1,100 @@ +//! These tests just check that the macros are available in libstd. + +#![cfg_attr( + any( + all(target_arch = "arm", any(target_os = "linux", target_os = "android")), + all(target_arch = "aarch64", any(target_os = "linux", target_os = "android")), + all(target_arch = "powerpc", target_os = "linux"), + all(target_arch = "powerpc64", target_os = "linux"), + ), + feature(stdsimd) +)] + +#[test] +#[cfg(all(target_arch = "arm", + any(target_os = "linux", target_os = "android")))] +fn arm_linux() { + println!("neon: {}", is_arm_feature_detected!("neon")); + println!("pmull: {}", is_arm_feature_detected!("pmull")); +} + +#[test] +#[cfg(all( + target_arch = "aarch64", + any(target_os = "linux", target_os = "android") +))] +fn aarch64_linux() { + println!("fp: {}", is_aarch64_feature_detected!("fp")); + println!("fp16: {}", is_aarch64_feature_detected!("fp16")); + println!("neon: {}", is_aarch64_feature_detected!("neon")); + println!("asimd: {}", is_aarch64_feature_detected!("asimd")); + println!("sve: {}", is_aarch64_feature_detected!("sve")); + println!("crc: {}", is_aarch64_feature_detected!("crc")); + println!("crypto: {}", is_aarch64_feature_detected!("crypto")); + println!("lse: {}", is_aarch64_feature_detected!("lse")); + println!("rdm: {}", is_aarch64_feature_detected!("rdm")); + println!("rcpc: {}", is_aarch64_feature_detected!("rcpc")); + println!("dotprod: {}", is_aarch64_feature_detected!("dotprod")); +} + +#[test] +#[cfg(all(target_arch = "powerpc", target_os = "linux"))] +fn powerpc_linux() { + println!("altivec: {}", is_powerpc_feature_detected!("altivec")); + println!("vsx: {}", is_powerpc_feature_detected!("vsx")); + println!("power8: {}", is_powerpc_feature_detected!("power8")); +} + +#[test] +#[cfg(all(target_arch = "powerpc64", target_os = "linux"))] +fn powerpc64_linux() { + println!("altivec: {}", is_powerpc64_feature_detected!("altivec")); + println!("vsx: {}", is_powerpc64_feature_detected!("vsx")); + println!("power8: {}", is_powerpc64_feature_detected!("power8")); +} + +#[test] +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +fn x86_all() { + println!("aes: {:?}", is_x86_feature_detected!("aes")); + println!("pcmulqdq: {:?}", is_x86_feature_detected!("pclmulqdq")); + println!("rdrand: {:?}", is_x86_feature_detected!("rdrand")); + println!("rdseed: {:?}", is_x86_feature_detected!("rdseed")); + println!("tsc: {:?}", is_x86_feature_detected!("tsc")); + println!("mmx: {:?}", is_x86_feature_detected!("mmx")); + println!("sse: {:?}", is_x86_feature_detected!("sse")); + println!("sse2: {:?}", is_x86_feature_detected!("sse2")); + println!("sse3: {:?}", is_x86_feature_detected!("sse3")); + println!("ssse3: {:?}", is_x86_feature_detected!("ssse3")); + println!("sse4.1: {:?}", is_x86_feature_detected!("sse4.1")); + println!("sse4.2: {:?}", is_x86_feature_detected!("sse4.2")); + println!("sse4a: {:?}", is_x86_feature_detected!("sse4a")); + println!("sha: {:?}", is_x86_feature_detected!("sha")); + println!("avx: {:?}", is_x86_feature_detected!("avx")); + println!("avx2: {:?}", is_x86_feature_detected!("avx2")); + println!("avx512f {:?}", is_x86_feature_detected!("avx512f")); + println!("avx512cd {:?}", is_x86_feature_detected!("avx512cd")); + println!("avx512er {:?}", is_x86_feature_detected!("avx512er")); + println!("avx512pf {:?}", is_x86_feature_detected!("avx512pf")); + println!("avx512bw {:?}", is_x86_feature_detected!("avx512bw")); + println!("avx512dq {:?}", is_x86_feature_detected!("avx512dq")); + println!("avx512vl {:?}", is_x86_feature_detected!("avx512vl")); + println!("avx512_ifma {:?}", is_x86_feature_detected!("avx512ifma")); + println!("avx512_vbmi {:?}", is_x86_feature_detected!("avx512vbmi")); + println!( + "avx512_vpopcntdq {:?}", + is_x86_feature_detected!("avx512vpopcntdq") + ); + println!("fma: {:?}", is_x86_feature_detected!("fma")); + println!("bmi1: {:?}", is_x86_feature_detected!("bmi1")); + println!("bmi2: {:?}", is_x86_feature_detected!("bmi2")); + println!("abm: {:?}", is_x86_feature_detected!("abm")); + println!("lzcnt: {:?}", is_x86_feature_detected!("lzcnt")); + println!("tbm: {:?}", is_x86_feature_detected!("tbm")); + println!("popcnt: {:?}", is_x86_feature_detected!("popcnt")); + println!("fxsr: {:?}", is_x86_feature_detected!("fxsr")); + println!("xsave: {:?}", is_x86_feature_detected!("xsave")); + println!("xsaveopt: {:?}", is_x86_feature_detected!("xsaveopt")); + println!("xsaves: {:?}", is_x86_feature_detected!("xsaves")); + println!("xsavec: {:?}", is_x86_feature_detected!("xsavec")); +} diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 4df47511172..5d2eb5f8e73 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Thread local storage #![unstable(feature = "thread_local_internals", issue = "0")] @@ -79,9 +69,6 @@ use mem; /// destroyed, but not all platforms have this guard. Those platforms that do /// not guard typically have a synthetic limit after which point no more /// destructors are run. -/// 3. On macOS, initializing TLS during destruction of other TLS slots can -/// sometimes cancel *all* destructors for the current thread, whether or not -/// the slots have already had their destructors run or not. /// /// [`with`]: ../../std/thread/struct.LocalKey.html#method.with /// [`thread_local!`]: ../../std/macro.thread_local.html @@ -269,7 +256,7 @@ impl LocalKey { // ptr::write(ptr, Some(value)) // // Due to this pattern it's possible for the destructor of the value in - // `ptr` (e.g. if this is being recursively initialized) to re-access + // `ptr` (e.g., if this is being recursively initialized) to re-access // TLS, in which case there will be a `&` and `&mut` pointer to the same // value (an aliasing violation). To avoid setting the "I'm running a // destructor" flag we just use `mem::replace` which should sequence the @@ -614,11 +601,8 @@ mod tests { } // Note that this test will deadlock if TLS destructors aren't run (this - // requires the destructor to be run to pass the test). macOS has a known bug - // where dtors-in-dtors may cancel other destructors, so we just ignore this - // test on macOS. + // requires the destructor to be run to pass the test). #[test] - #[cfg_attr(target_os = "macos", ignore)] fn dtors_in_dtors_in_dtors() { struct S1(Sender<()>); thread_local!(static K1: UnsafeCell> = UnsafeCell::new(None)); diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 8a845efd413..eb8e0c1c8ac 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Native threads. //! //! ## The threading model @@ -93,7 +83,7 @@ //! Threads are represented via the [`Thread`] type, which you can get in one of //! two ways: //! -//! * By spawning a new thread, e.g. using the [`thread::spawn`][`spawn`] +//! * By spawning a new thread, e.g., using the [`thread::spawn`][`spawn`] //! function, and calling [`thread`][`JoinHandle::thread`] on the [`JoinHandle`]. //! * By requesting the current thread, using the [`thread::current`] function. //! @@ -124,7 +114,7 @@ //! thread, use [`Thread::name`]. A couple examples of where the name of a thread gets used: //! //! * If a panic occurs in a named thread, the thread name will be printed in the panic message. -//! * The thread name is provided to the OS where applicable (e.g. `pthread_setname_np` in +//! * The thread name is provided to the OS where applicable (e.g., `pthread_setname_np` in //! unix-like platforms). //! //! ## Stack size @@ -167,10 +157,12 @@ #![stable(feature = "rust1", since = "1.0.0")] use any::Any; +use boxed::FnBox; use cell::UnsafeCell; use ffi::{CStr, CString}; use fmt; use io; +use mem; use panic; use panicking; use str; @@ -326,7 +318,7 @@ impl Builder { /// Sets the size of the stack (in bytes) for the new thread. /// /// The actual stack size may be greater than this value if - /// the platform specifies minimal stack size. + /// the platform specifies a minimal stack size. /// /// For more information about the stack size for threads, see /// [this module-level documentation][stack-size]. @@ -420,7 +412,7 @@ impl Builder { /// /// - ensure that [`join`][`JoinHandle::join`] is called before any referenced /// data is dropped - /// - use only types with `'static` lifetime bounds, i.e. those with no or only + /// - use only types with `'static` lifetime bounds, i.e., those with no or only /// `'static` references (both [`thread::Builder::spawn`][`Builder::spawn`] /// and [`thread::spawn`][`spawn`] enforce this property statically) /// @@ -452,8 +444,8 @@ impl Builder { /// [`io::Result`]: ../../std/io/type.Result.html /// [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html #[unstable(feature = "thread_spawn_unchecked", issue = "55132")] - pub unsafe fn spawn_unchecked(self, f: F) -> io::Result> where - F: FnOnce() -> T, F: Send, T: Send + pub unsafe fn spawn_unchecked<'a, F, T>(self, f: F) -> io::Result> where + F: FnOnce() -> T, F: Send + 'a, T: Send + 'a { let Builder { name, stack_size } = self; @@ -482,7 +474,21 @@ impl Builder { }; Ok(JoinHandle(JoinInner { - native: Some(imp::Thread::new(stack_size, Box::new(main))?), + // `imp::Thread::new` takes a closure with a `'static` lifetime, since it's passed + // through FFI or otherwise used with low-level threading primitives that have no + // notion of or way to enforce lifetimes. + // + // As mentioned in the `Safety` section of this function's documentation, the caller of + // this function needs to guarantee that the passed-in lifetime is sufficiently long + // for the lifetime of the thread. + // + // Similarly, the `sys` implementation must guarantee that no references to the closure + // exist after the thread has terminated, which is signaled by `Thread::join` + // returning. + native: Some(imp::Thread::new( + stack_size, + mem::transmute::, Box>(Box::new(main)) + )?), thread: my_thread, packet: Packet(my_packet), })) @@ -601,7 +607,7 @@ impl Builder { pub fn spawn(f: F) -> JoinHandle where F: FnOnce() -> T, F: Send + 'static, T: Send + 'static { - Builder::new().spawn(f).unwrap() + Builder::new().spawn(f).expect("failed to spawn thread") } /// Gets a handle to the thread that invokes it. @@ -676,7 +682,7 @@ pub fn yield_now() { /// already poison themselves when a thread panics while holding the lock. /// /// This can also be used in multithreaded applications, in order to send a -/// message to other threads warning that a thread has panicked (e.g. for +/// message to other threads warning that a thread has panicked (e.g., for /// monitoring purposes). /// /// # Examples @@ -806,9 +812,14 @@ const NOTIFIED: usize = 2; /// In other words, each [`Thread`] acts a bit like a spinlock that can be /// locked and unlocked using `park` and `unpark`. /// +/// Notice that being unblocked does not imply any synchronization with someone +/// that unparked this thread, it could also be spurious. +/// For example, it would be a valid, but inefficient, implementation to make both [`park`] and +/// [`unpark`] return immediately without doing anything. +/// /// The API is typically used by acquiring a handle to the current thread, /// placing that handle in a shared data structure so that other threads can -/// find it, and then `park`ing. When some desired condition is met, another +/// find it, and then `park`ing in a loop. When some desired condition is met, another /// thread calls [`unpark`] on the handle. /// /// The motivation for this design is twofold: @@ -823,21 +834,33 @@ const NOTIFIED: usize = 2; /// /// ``` /// use std::thread; +/// use std::sync::{Arc, atomic::{Ordering, AtomicBool}}; /// use std::time::Duration; /// -/// let parked_thread = thread::Builder::new() -/// .spawn(|| { +/// let flag = Arc::new(AtomicBool::new(false)); +/// let flag2 = Arc::clone(&flag); +/// +/// let parked_thread = thread::spawn(move || { +/// // We want to wait until the flag is set. We *could* just spin, but using +/// // park/unpark is more efficient. +/// while !flag2.load(Ordering::Acquire) { /// println!("Parking thread"); /// thread::park(); +/// // We *could* get here spuriously, i.e., way before the 10ms below are over! +/// // But that is no problem, we are in a loop until the flag is set anyway. /// println!("Thread unparked"); -/// }) -/// .unwrap(); +/// } +/// println!("Flag received"); +/// }); /// /// // Let some time pass for the thread to be spawned. /// thread::sleep(Duration::from_millis(10)); /// +/// // Set the flag, and let the thread wake up. /// // There is no race condition here, if `unpark` /// // happens first, `park` will return immediately. +/// // Hence there is no risk of a deadlock. +/// flag.store(true, Ordering::Release); /// println!("Unpark the thread"); /// parked_thread.thread().unpark(); /// @@ -1062,7 +1085,7 @@ struct Inner { /// Threads are represented via the `Thread` type, which you can get in one of /// two ways: /// -/// * By spawning a new thread, e.g. using the [`thread::spawn`][`spawn`] +/// * By spawning a new thread, e.g., using the [`thread::spawn`][`spawn`] /// function, and calling [`thread`][`JoinHandle::thread`] on the /// [`JoinHandle`]. /// * By requesting the current thread, using the [`thread::current`] function. diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 58be1972a81..23924559fcc 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Temporal quantification. //! //! Example: @@ -22,15 +12,20 @@ #![stable(feature = "time", since = "1.3.0")] +use cmp; use error::Error; use fmt; use ops::{Add, Sub, AddAssign, SubAssign}; use sys::time; use sys_common::FromInner; +use sys_common::mutex::Mutex; #[stable(feature = "time", since = "1.3.0")] pub use core::time::Duration; +#[unstable(feature = "duration_constants", issue = "57391")] +pub use core::time::{SECOND, MILLISECOND, MICROSECOND, NANOSECOND}; + /// A measurement of a monotonically nondecreasing clock. /// Opaque and useful only with `Duration`. /// @@ -160,7 +155,45 @@ impl Instant { /// ``` #[stable(feature = "time2", since = "1.8.0")] pub fn now() -> Instant { - Instant(time::Instant::now()) + let os_now = time::Instant::now(); + + // And here we come upon a sad state of affairs. The whole point of + // `Instant` is that it's monotonically increasing. We've found in the + // wild, however, that it's not actually monotonically increasing for + // one reason or another. These appear to be OS and hardware level bugs, + // and there's not really a whole lot we can do about them. Here's a + // taste of what we've found: + // + // * #48514 - OpenBSD, x86_64 + // * #49281 - linux arm64 and s390x + // * #51648 - windows, x86 + // * #56560 - windows, x86_64, AWS + // * #56612 - windows, x86, vm (?) + // * #56940 - linux, arm64 + // * https://bugzilla.mozilla.org/show_bug.cgi?id=1487778 - a similar + // Firefox bug + // + // It simply seems that this it just happens so that a lot in the wild + // we're seeing panics across various platforms where consecutive calls + // to `Instant::now`, such as via the `elapsed` function, are panicking + // as they're going backwards. Placed here is a last-ditch effort to try + // to fix things up. We keep a global "latest now" instance which is + // returned instead of what the OS says if the OS goes backwards. + // + // To hopefully mitigate the impact of this though a few platforms are + // whitelisted as "these at least haven't gone backwards yet". + if time::Instant::actually_monotonic() { + return Instant(os_now) + } + + static LOCK: Mutex = Mutex::new(); + static mut LAST_NOW: time::Instant = time::Instant::zero(); + unsafe { + let _lock = LOCK.lock(); + let now = cmp::max(LAST_NOW, os_now); + LAST_NOW = now; + Instant(now) + } } /// Returns the amount of time elapsed from another instant to this one. @@ -208,14 +241,37 @@ impl Instant { pub fn elapsed(&self) -> Duration { Instant::now() - *self } + + /// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as + /// `Instant` (which means it's inside the bounds of the underlying data structure), `None` + /// otherwise. + #[unstable(feature = "time_checked_add", issue = "55940")] + pub fn checked_add(&self, duration: Duration) -> Option { + self.0.checked_add_duration(&duration).map(|t| Instant(t)) + } + + /// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as + /// `Instant` (which means it's inside the bounds of the underlying data structure), `None` + /// otherwise. + #[unstable(feature = "time_checked_add", issue = "55940")] + pub fn checked_sub(&self, duration: Duration) -> Option { + self.0.checked_sub_duration(&duration).map(|t| Instant(t)) + } } #[stable(feature = "time2", since = "1.8.0")] impl Add for Instant { type Output = Instant; + /// # Panics + /// + /// This function may panic if the resulting point in time cannot be represented by the + /// underlying data structure. See [`checked_add`] for a version without panic. + /// + /// [`checked_add`]: ../../std/time/struct.Instant.html#method.checked_add fn add(self, other: Duration) -> Instant { - Instant(self.0.add_duration(&other)) + self.checked_add(other) + .expect("overflow when adding duration to instant") } } @@ -231,7 +287,8 @@ impl Sub for Instant { type Output = Instant; fn sub(self, other: Duration) -> Instant { - Instant(self.0.sub_duration(&other)) + self.checked_sub(other) + .expect("overflow when subtracting duration from instant") } } @@ -330,7 +387,7 @@ impl SystemTime { /// Returns the amount of time elapsed since this system time was created. /// /// This function may fail as the underlying system clock is susceptible to - /// drift and updates (e.g. the system clock could go backwards), so this + /// drift and updates (e.g., the system clock could go backwards), so this /// function may not always succeed. If successful, [`Ok`]`(`[`Duration`]`)` is /// returned where the duration represents the amount of time elapsed from /// this time measurement to the current time. @@ -357,14 +414,37 @@ impl SystemTime { pub fn elapsed(&self) -> Result { SystemTime::now().duration_since(*self) } + + /// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as + /// `SystemTime` (which means it's inside the bounds of the underlying data structure), `None` + /// otherwise. + #[unstable(feature = "time_checked_add", issue = "55940")] + pub fn checked_add(&self, duration: Duration) -> Option { + self.0.checked_add_duration(&duration).map(|t| SystemTime(t)) + } + + /// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as + /// `SystemTime` (which means it's inside the bounds of the underlying data structure), `None` + /// otherwise. + #[unstable(feature = "time_checked_add", issue = "55940")] + pub fn checked_sub(&self, duration: Duration) -> Option { + self.0.checked_sub_duration(&duration).map(|t| SystemTime(t)) + } } #[stable(feature = "time2", since = "1.8.0")] impl Add for SystemTime { type Output = SystemTime; + /// # Panics + /// + /// This function may panic if the resulting point in time cannot be represented by the + /// underlying data structure. See [`checked_add`] for a version without panic. + /// + /// [`checked_add`]: ../../std/time/struct.SystemTime.html#method.checked_add fn add(self, dur: Duration) -> SystemTime { - SystemTime(self.0.add_duration(&dur)) + self.checked_add(dur) + .expect("overflow when adding duration to instant") } } @@ -380,7 +460,8 @@ impl Sub for SystemTime { type Output = SystemTime; fn sub(self, dur: Duration) -> SystemTime { - SystemTime(self.0.sub_duration(&dur)) + self.checked_sub(dur) + .expect("overflow when subtracting duration from instant") } } @@ -513,6 +594,29 @@ mod tests { let second = Duration::new(1, 0); assert_almost_eq!(a - second + second, a); + assert_almost_eq!(a.checked_sub(second).unwrap().checked_add(second).unwrap(), a); + + // checked_add_duration will not panic on overflow + let mut maybe_t = Some(Instant::now()); + let max_duration = Duration::from_secs(u64::max_value()); + // in case `Instant` can store `>= now + max_duration`. + for _ in 0..2 { + maybe_t = maybe_t.and_then(|t| t.checked_add(max_duration)); + } + assert_eq!(maybe_t, None); + + // checked_add_duration calculates the right time and will work for another year + let year = Duration::from_secs(60 * 60 * 24 * 365); + assert_eq!(a + year, a.checked_add(year).unwrap()); + } + + #[test] + fn instant_math_is_associative() { + let now = Instant::now(); + let offset = Duration::from_millis(5); + // Changing the order of instant math shouldn't change the results, + // especially when the expression reduces to X + identity. + assert_eq!((now + offset) - now, (now - now) + offset); } #[test] @@ -549,6 +653,7 @@ mod tests { .duration(), second); assert_almost_eq!(a - second + second, a); + assert_almost_eq!(a.checked_sub(second).unwrap().checked_add(second).unwrap(), a); // A difference of 80 and 800 years cannot fit inside a 32-bit time_t if !(cfg!(unix) && ::mem::size_of::<::libc::time_t>() <= 4) { @@ -561,6 +666,19 @@ mod tests { let one_second_from_epoch2 = UNIX_EPOCH + Duration::new(0, 500_000_000) + Duration::new(0, 500_000_000); assert_eq!(one_second_from_epoch, one_second_from_epoch2); + + // checked_add_duration will not panic on overflow + let mut maybe_t = Some(SystemTime::UNIX_EPOCH); + let max_duration = Duration::from_secs(u64::max_value()); + // in case `SystemTime` can store `>= UNIX_EPOCH + max_duration`. + for _ in 0..2 { + maybe_t = maybe_t.and_then(|t| t.checked_add(max_duration)); + } + assert_eq!(maybe_t, None); + + // checked_add_duration calculates the right time and will work for another year + let year = Duration::from_secs(60 * 60 * 24 * 365); + assert_eq!(a + year, a.checked_add(year).unwrap()); } #[test] diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml index 519cc7aa92c..fba2623e005 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/libsyntax/Cargo.toml @@ -17,4 +17,4 @@ syntax_pos = { path = "../libsyntax_pos" } rustc_errors = { path = "../librustc_errors" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_target = { path = "../librustc_target" } -smallvec = { version = "0.6.5", features = ["union"] } +smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } diff --git a/src/libsyntax/README.md b/src/libsyntax/README.md index 7214203830e..daa252ef455 100644 --- a/src/libsyntax/README.md +++ b/src/libsyntax/README.md @@ -5,5 +5,5 @@ lexer, macro expander, and utilities for traversing ASTs. For more information about how these things work in rustc, see the rustc guide: -- [Parsing](https://rust-lang-nursery.github.io/rustc-guide/the-parser.html) -- [Macro Expansion](https://rust-lang-nursery.github.io/rustc-guide/macro-expansion.html) +- [Parsing](https://rust-lang.github.io/rustc-guide/the-parser.html) +- [Macro Expansion](https://rust-lang.github.io/rustc-guide/macro-expansion.html) diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 227017a9073..af521848e90 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The Rust abstract syntax tree. pub use self::GenericArgs::*; @@ -25,7 +15,7 @@ use rustc_target::spec::abi::Abi; use source_map::{dummy_spanned, respan, Spanned}; use symbol::{keywords, Symbol}; use syntax_pos::{Span, DUMMY_SP}; -use tokenstream::{ThinTokenStream, TokenStream}; +use tokenstream::TokenStream; use ThinVec; use rustc_data_structures::fx::FxHashSet; @@ -68,12 +58,12 @@ impl fmt::Debug for Lifetime { /// It's represented as a sequence of identifiers, /// along with a bunch of supporting information. /// -/// E.g. `std::cmp::PartialEq` +/// E.g., `std::cmp::PartialEq`. #[derive(Clone, RustcEncodable, RustcDecodable)] pub struct Path { pub span: Span, /// The segments in the path: the things separated by `::`. - /// Global paths begin with `keywords::CrateRoot`. + /// Global paths begin with `keywords::PathRoot`. pub segments: Vec, } @@ -96,8 +86,8 @@ impl fmt::Display for Path { } impl Path { - // convert a span and an identifier to the corresponding - // 1-segment path + // Convert a span and an identifier to the corresponding + // one-segment path. pub fn from_ident(ident: Ident) -> Path { Path { segments: vec![PathSegment::from_ident(ident)], @@ -105,25 +95,14 @@ impl Path { } } - // Make a "crate root" segment for this path unless it already has it - // or starts with something like `self`/`super`/`$crate`/etc. - pub fn make_root(&self) -> Option { - if let Some(ident) = self.segments.get(0).map(|seg| seg.ident) { - if ident.is_path_segment_keyword() { - return None; - } - } - Some(PathSegment::crate_root(self.span.shrink_to_lo())) - } - pub fn is_global(&self) -> bool { - !self.segments.is_empty() && self.segments[0].ident.name == keywords::CrateRoot.name() + !self.segments.is_empty() && self.segments[0].ident.name == keywords::PathRoot.name() } } /// A segment of a path: an identifier, an optional lifetime, and a set of types. /// -/// E.g. `std`, `String` or `Box` +/// E.g., `std`, `String` or `Box`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct PathSegment { /// The identifier portion of this path segment. @@ -144,23 +123,37 @@ impl PathSegment { pub fn from_ident(ident: Ident) -> Self { PathSegment { ident, id: DUMMY_NODE_ID, args: None } } - pub fn crate_root(span: Span) -> Self { - PathSegment::from_ident(Ident::new(keywords::CrateRoot.name(), span)) + pub fn path_root(span: Span) -> Self { + PathSegment::from_ident(Ident::new(keywords::PathRoot.name(), span)) } } /// Arguments of a path segment. /// -/// E.g. `` as in `Foo` or `(A, B)` as in `Foo(A, B)` +/// E.g., `` as in `Foo` or `(A, B)` as in `Foo(A, B)`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum GenericArgs { /// The `<'a, A,B,C>` in `foo::bar::baz::<'a, A,B,C>` AngleBracketed(AngleBracketedArgs), /// The `(A,B)` and `C` in `Foo(A,B) -> C` - Parenthesized(ParenthesisedArgs), + Parenthesized(ParenthesizedArgs), } impl GenericArgs { + pub fn is_parenthesized(&self) -> bool { + match *self { + Parenthesized(..) => true, + _ => false, + } + } + + pub fn is_angle_bracketed(&self) -> bool { + match *self { + AngleBracketed(..) => true, + _ => false, + } + } + pub fn span(&self) -> Span { match *self { AngleBracketed(ref data) => data.span, @@ -194,7 +187,7 @@ impl Into>> for AngleBracketedArgs { } } -impl Into>> for ParenthesisedArgs { +impl Into>> for ParenthesizedArgs { fn into(self) -> Option> { Some(P(GenericArgs::Parenthesized(self))) } @@ -202,7 +195,7 @@ impl Into>> for ParenthesisedArgs { /// A path like `Foo(A,B) -> C` #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] -pub struct ParenthesisedArgs { +pub struct ParenthesizedArgs { /// Overall span pub span: Span, @@ -213,6 +206,16 @@ pub struct ParenthesisedArgs { pub output: Option>, } +impl ParenthesizedArgs { + pub fn as_angle_bracketed_args(&self) -> AngleBracketedArgs { + AngleBracketedArgs { + span: self.span, + args: self.inputs.iter().cloned().map(|input| GenericArg::Type(input)).collect(), + bindings: vec![], + } + } +} + // hack to ensure that we don't try to access the private parts of `NodeId` in this module mod node_id_inner { use rustc_data_structures::indexed_vec::Idx; @@ -293,7 +296,7 @@ pub type GenericBounds = Vec; #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum GenericParamKind { - /// A lifetime definition, e.g. `'a: 'b+'c+'d`. + /// A lifetime definition (e.g., `'a: 'b + 'c + 'd`). Lifetime, Type { default: Option>, @@ -345,11 +348,11 @@ pub struct WhereClause { /// A single predicate in a `where` clause #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum WherePredicate { - /// A type binding, e.g. `for<'c> Foo: Send+Clone+'c` + /// A type binding (e.g., `for<'c> Foo: Send + Clone + 'c`). BoundPredicate(WhereBoundPredicate), - /// A lifetime predicate, e.g. `'a: 'b+'c` + /// A lifetime predicate (e.g., `'a: 'b + 'c`). RegionPredicate(WhereRegionPredicate), - /// An equality predicate (unsupported) + /// An equality predicate (unsupported). EqPredicate(WhereEqPredicate), } @@ -365,7 +368,7 @@ impl WherePredicate { /// A type bound. /// -/// E.g. `for<'c> Foo: Send+Clone+'c` +/// E.g., `for<'c> Foo: Send + Clone + 'c`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct WhereBoundPredicate { pub span: Span, @@ -379,7 +382,7 @@ pub struct WhereBoundPredicate { /// A lifetime predicate. /// -/// E.g. `'a: 'b+'c` +/// E.g., `'a: 'b + 'c`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct WhereRegionPredicate { pub span: Span, @@ -389,7 +392,7 @@ pub struct WhereRegionPredicate { /// An equality predicate (unsupported). /// -/// E.g. `T=int` +/// E.g., `T = int`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct WhereEqPredicate { pub id: NodeId, @@ -398,8 +401,8 @@ pub struct WhereEqPredicate { pub rhs_ty: P, } -/// The set of MetaItems that define the compilation environment of the crate, -/// used to drive conditional compilation +/// The set of `MetaItem`s that define the compilation environment of the crate, +/// used to drive conditional compilation. pub type CrateConfig = FxHashSet<(Name, Option)>; #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] @@ -414,20 +417,20 @@ pub type NestedMetaItem = Spanned; /// Possible values inside of compile-time attribute lists. /// -/// E.g. the '..' in `#[name(..)]`. +/// E.g., the '..' in `#[name(..)]`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum NestedMetaItemKind { /// A full MetaItem, for recursive meta items. MetaItem(MetaItem), /// A literal. /// - /// E.g. "foo", 64, true + /// E.g., `"foo"`, `64`, `true`. Literal(Lit), } /// A spanned compile-time attribute item. /// -/// E.g. `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]` +/// E.g., `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct MetaItem { pub ident: Path, @@ -437,26 +440,26 @@ pub struct MetaItem { /// A compile-time attribute item. /// -/// E.g. `#[test]`, `#[derive(..)]` or `#[feature = "foo"]` +/// E.g., `#[test]`, `#[derive(..)]` or `#[feature = "foo"]`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum MetaItemKind { /// Word meta item. /// - /// E.g. `test` as in `#[test]` + /// E.g., `test` as in `#[test]`. Word, /// List meta item. /// - /// E.g. `derive(..)` as in `#[derive(..)]` + /// E.g., `derive(..)` as in `#[derive(..)]`. List(Vec), /// Name value meta item. /// - /// E.g. `feature = "foo"` as in `#[feature = "foo"]` + /// E.g., `feature = "foo"` as in `#[feature = "foo"]`. NameValue(Lit), } /// A Block (`{ .. }`). /// -/// E.g. `{ .. }` as in `fn foo() { .. }` +/// E.g., `{ .. }` as in `fn foo() { .. }`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Block { /// Statements in a block @@ -465,7 +468,6 @@ pub struct Block { /// Distinguishes between `unsafe { ... }` and `{ ... }` pub rules: BlockCheckMode, pub span: Span, - pub recovered: bool, } #[derive(Clone, RustcEncodable, RustcDecodable)] @@ -579,7 +581,7 @@ pub enum RangeSyntax { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum PatKind { - /// Represents a wildcard pattern (`_`) + /// Represents a wildcard pattern (`_`). Wild, /// A `PatKind::Ident` may either be a new bound variable (`ref mut binding @ OPT_SUBPATTERN`), @@ -588,13 +590,13 @@ pub enum PatKind { /// during name resolution. Ident(BindingMode, Ident, Option>), - /// A struct or struct variant pattern, e.g. `Variant {x, y, ..}`. + /// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`). /// The `bool` is `true` in the presence of a `..`. Struct(Path, Vec>, bool), - /// A tuple struct/variant pattern `Variant(x, y, .., z)`. + /// A tuple struct/variant pattern (`Variant(x, y, .., z)`). /// If the `..` pattern fragment is present, then `Option` denotes its position. - /// 0 <= position <= subpats.len() + /// `0 <= position <= subpats.len()`. TupleStruct(Path, Vec>, Option), /// A possibly qualified path pattern. @@ -603,24 +605,24 @@ pub enum PatKind { /// only legally refer to associated constants. Path(Option, Path), - /// A tuple pattern `(a, b)`. + /// A tuple pattern (`(a, b)`). /// If the `..` pattern fragment is present, then `Option` denotes its position. - /// 0 <= position <= subpats.len() + /// `0 <= position <= subpats.len()`. Tuple(Vec>, Option), - /// A `box` pattern + /// A `box` pattern. Box(P), - /// A reference pattern, e.g. `&mut (a, b)` + /// A reference pattern (e.g., `&mut (a, b)`). Ref(P, Mutability), - /// A literal + /// A literal. Lit(P), - /// A range pattern, e.g. `1...2`, `1..=2` or `1..2` + /// A range pattern (e.g., `1...2`, `1..=2` or `1..2`). Range(P, P, Spanned), /// `[a, b, ..i, y, z]` is represented as: /// `PatKind::Slice(box [a, b], Some(i), box [y, z])` Slice(Vec>, Option>, Vec>), - /// Parentheses in patterns used for grouping, i.e. `(PAT)`. + /// Parentheses in patterns used for grouping (i.e., `(PAT)`). Paren(P), - /// A macro pattern; pre-expansion + /// A macro pattern; pre-expansion. Mac(Mac), } @@ -818,23 +820,23 @@ pub enum StmtKind { #[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug)] pub enum MacStmtStyle { - /// The macro statement had a trailing semicolon, e.g. `foo! { ... };` - /// `foo!(...);`, `foo![...];` + /// The macro statement had a trailing semicolon (e.g., `foo! { ... };` + /// `foo!(...);`, `foo![...];`). Semicolon, - /// The macro statement had braces; e.g. foo! { ... } + /// The macro statement had braces (e.g., `foo! { ... }`). Braces, - /// The macro statement had parentheses or brackets and no semicolon; e.g. - /// `foo!(...)`. All of these will end up being converted into macro + /// The macro statement had parentheses or brackets and no semicolon (e.g., + /// `foo!(...)`). All of these will end up being converted into macro /// expressions. NoBraces, } -/// Local represents a `let` statement, e.g., `let : = ;` +/// Local represents a `let` statement, e.g., `let : = ;`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Local { pub pat: P, pub ty: Option>, - /// Initializer expression to set the value, if any + /// Initializer expression to set the value, if any. pub init: Option>, pub id: NodeId, pub span: Span, @@ -843,7 +845,7 @@ pub struct Local { /// An arm of a 'match'. /// -/// E.g. `0..=10 => { println!("match!") }` as in +/// E.g., `0..=10 => { println!("match!") }` as in /// /// ``` /// match 123 { @@ -875,13 +877,13 @@ pub struct Field { pub type SpannedIdent = Spanned; -#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)] pub enum BlockCheckMode { Default, Unsafe(UnsafeSource), } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)] pub enum UnsafeSource { CompilerGenerated, UserProvided, @@ -889,8 +891,8 @@ pub enum UnsafeSource { /// A constant (expression) that's not an item or associated item, /// but needs its own `DefId` for type-checking, const-eval, etc. -/// These are usually found nested inside types (e.g. array lengths) -/// or expressions (e.g. repeat counts), and also used to define +/// These are usually found nested inside types (e.g., array lengths) +/// or expressions (e.g., repeat counts), and also used to define /// explicit discriminant values for enum variants. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct AnonConst { @@ -912,7 +914,7 @@ pub struct Expr { static_assert!(MEM_SIZE_OF_EXPR: std::mem::size_of::() == 88); impl Expr { - /// Whether this expression would be valid somewhere that expects a value, for example, an `if` + /// Whether this expression would be valid somewhere that expects a value; for example, an `if` /// condition. pub fn returns(&self) -> bool { if let ExprKind::Block(ref block, _) = self.node { @@ -1022,6 +1024,7 @@ impl Expr { ExprKind::Paren(..) => ExprPrecedence::Paren, ExprKind::Try(..) => ExprPrecedence::Try, ExprKind::Yield(..) => ExprPrecedence::Yield, + ExprKind::Err => ExprPrecedence::Err, } } } @@ -1060,24 +1063,24 @@ pub enum ExprKind { /// /// The `PathSegment` represents the method name and its generic arguments /// (within the angle brackets). - /// The first element of the vector of `Expr`s is the expression that evaluates + /// The first element of the vector of an `Expr` is the expression that evaluates /// to the object on which the method is being called on (the receiver), /// and the remaining elements are the rest of the arguments. /// Thus, `x.foo::(a, b, c, d)` is represented as /// `ExprKind::MethodCall(PathSegment { foo, [Bar, Baz] }, [x, a, b, c, d])`. MethodCall(PathSegment, Vec>), - /// A tuple (`(a, b, c ,d)`) + /// A tuple (e.g., `(a, b, c, d)`). Tup(Vec>), - /// A binary operation (For example: `a + b`, `a * b`) + /// A binary operation (e.g., `a + b`, `a * b`). Binary(BinOp, P, P), - /// A unary operation (For example: `!x`, `*x`) + /// A unary operation (e.g., `!x`, `*x`). Unary(UnOp, P), - /// A literal (For example: `1`, `"foo"`) + /// A literal (e.g., `1`, `"foo"`). Lit(Lit), - /// A cast (`foo as f64`) + /// A cast (e.g., `foo as f64`). Cast(P, P), Type(P, P), - /// An `if` block, with an optional else block + /// An `if` block, with an optional `else` block. /// /// `if expr { block } else { expr }` If(P, P, Option>), @@ -1091,31 +1094,31 @@ pub enum ExprKind { /// /// `'label: while expr { block }` While(P, P, Option
, D }` + /// E.g., `enum Foo { C, D }`. Enum(EnumDef, Generics), /// A struct definition (`struct` or `pub struct`). /// - /// E.g. `struct Foo { x: A }` + /// E.g., `struct Foo { x: A }`. Struct(VariantData, Generics), /// A union definition (`union` or `pub union`). /// - /// E.g. `union Foo { x: A, y: B }` + /// E.g., `union Foo { x: A, y: B }`. Union(VariantData, Generics), /// A Trait declaration (`trait` or `pub trait`). /// - /// E.g. `trait Foo { .. }`, `trait Foo { .. }` or `auto trait Foo {}` + /// E.g., `trait Foo { .. }`, `trait Foo { .. }` or `auto trait Foo {}`. Trait(IsAuto, Unsafety, Generics, GenericBounds, Vec), /// Trait alias /// - /// E.g. `trait Foo = Bar + Quux;` + /// E.g., `trait Foo = Bar + Quux;`. TraitAlias(Generics, GenericBounds), /// An implementation. /// - /// E.g. `impl Foo { .. }` or `impl Trait for Foo { .. }` + /// E.g., `impl Foo { .. }` or `impl Trait for Foo { .. }`. Impl( Unsafety, ImplPolarity, @@ -2253,7 +2261,7 @@ pub enum ItemKind { ), /// A macro invocation. /// - /// E.g. `macro_rules! foo { .. }` or `foo!(..)` + /// E.g., `macro_rules! foo { .. }` or `foo!(..)`. Mac(Mac), /// A macro definition. @@ -2293,17 +2301,17 @@ pub struct ForeignItem { pub vis: Visibility, } -/// An item within an `extern` block +/// An item within an `extern` block. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum ForeignItemKind { - /// A foreign function + /// A foreign function. Fn(P, Generics), - /// A foreign static item (`static ext: u8`), with optional mutability - /// (the boolean is true when mutable) + /// A foreign static item (`static ext: u8`), with optional mutability. + /// (The boolean is `true` for mutable items). Static(P, bool), - /// A foreign type + /// A foreign type. Ty, - /// A macro invocation + /// A macro invocation. Macro(Mac), } @@ -2323,7 +2331,7 @@ mod tests { use super::*; use serialize; - // are ASTs encodable? + // Are ASTs encodable? #[test] fn check_asts_encodable() { fn assert_encodable() {} diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index 1bbc1accc07..7fe6f4a2316 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Parsing and validation of builtin attributes use ast::{self, Attribute, MetaItem, Name, NestedMetaItemKind}; @@ -52,7 +42,7 @@ fn handle_errors(sess: &ParseSess, span: Span, error: AttrError) { let mut err = struct_span_err!(diag, span, E0565, "{}", msg); if is_bytestr { if let Ok(lint_str) = sess.source_map().span_to_snippet(span) { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "consider removing the prefix", format!("{}", &lint_str[1..]), @@ -73,6 +63,13 @@ pub enum InlineAttr { Never, } +#[derive(Copy, Clone, Hash, PartialEq, RustcEncodable, RustcDecodable)] +pub enum OptimizeAttr { + None, + Speed, + Size, +} + #[derive(Copy, Clone, PartialEq)] pub enum UnwindAttr { Allowed, @@ -161,6 +158,8 @@ impl StabilityLevel { pub struct RustcDeprecation { pub since: Symbol, pub reason: Symbol, + /// A text snippet used to completely replace any use of the deprecated item in an expression. + pub suggestion: Option, } /// Check if `attrs` contains an attribute like `#![feature(feature_name)]`. @@ -277,13 +276,14 @@ fn find_stability_generic<'a, I>(sess: &ParseSess, continue 'outer } - get_meta!(since, reason); + get_meta!(since, reason, suggestion); match (since, reason) { (Some(since), Some(reason)) => { rustc_depr = Some(RustcDeprecation { since, reason, + suggestion, }) } (None, _) => { @@ -446,9 +446,6 @@ fn find_stability_generic<'a, I>(sess: &ParseSess, } _ => unreachable!() } - } else { - span_err!(diagnostic, attr.span(), E0548, "incorrect stability attribute type"); - continue } } @@ -800,7 +797,7 @@ pub fn find_repr_attrs(sess: &ParseSess, attr: &Attribute) -> Vec { "incorrect `repr(align)` attribute format"); match value.node { ast::LitKind::Int(int, ast::LitIntType::Unsuffixed) => { - err.span_suggestion_with_applicability( + err.span_suggestion( item.span, "use parentheses instead", format!("align({})", int), @@ -808,7 +805,7 @@ pub fn find_repr_attrs(sess: &ParseSess, attr: &Attribute) -> Vec { ); } ast::LitKind::Str(s, _) => { - err.span_suggestion_with_applicability( + err.span_suggestion( item.span, "use parentheses instead", format!("align({})", s), diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index 64876659477..58be7c3e085 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -1,21 +1,11 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Functions dealing with attributes and meta items mod builtin; pub use self::builtin::{ cfg_matches, contains_feature_attr, eval_condition, find_crate_name, find_deprecation, - find_repr_attrs, find_stability, find_unwind_attr, Deprecation, InlineAttr, IntType, ReprAttr, - RustcDeprecation, Stability, StabilityLevel, UnwindAttr, + find_repr_attrs, find_stability, find_unwind_attr, Deprecation, InlineAttr, OptimizeAttr, + IntType, ReprAttr, RustcDeprecation, Stability, StabilityLevel, UnwindAttr, }; pub use self::IntType::*; pub use self::ReprAttr::*; @@ -34,7 +24,7 @@ use parse::token::{self, Token}; use ptr::P; use symbol::Symbol; use ThinVec; -use tokenstream::{TokenStream, TokenTree, Delimited, DelimSpan}; +use tokenstream::{TokenStream, TokenTree, DelimSpan}; use GLOBALS; use std::iter; @@ -96,7 +86,7 @@ impl NestedMetaItem { self.meta_item().map_or(false, |meta_item| meta_item.check_name(name)) } - /// Returns the name of the meta item, e.g. `foo` in `#[foo]`, + /// Returns the name of the meta item, e.g., `foo` in `#[foo]`, /// `#[foo="bar"]` and `#[foo(bar)]`, if self is a MetaItem pub fn name(&self) -> Option { self.meta_item().and_then(|meta_item| Some(meta_item.name())) @@ -180,7 +170,7 @@ impl Attribute { } /// Returns the **last** segment of the name of this attribute. - /// E.g. `foo` for `#[foo]`, `skip` for `#[rustfmt::skip]`. + /// e.g., `foo` for `#[foo]`, `skip` for `#[rustfmt::skip]`. pub fn name(&self) -> Name { name_from_path(&self.path) } @@ -482,8 +472,8 @@ impl MetaItem { Token::from_ast_ident(segment.ident)).into()); last_pos = segment.ident.span.hi(); } - idents.push(self.node.tokens(self.span)); - TokenStream::concat(idents) + self.node.tokens(self.span).append_to_tree_and_joint_vec(&mut idents); + TokenStream::new(idents) } fn from_tokens(tokens: &mut iter::Peekable) -> Option @@ -491,28 +481,33 @@ impl MetaItem { { // FIXME: Share code with `parse_path`. let ident = match tokens.next() { - Some(TokenTree::Token(span, Token::Ident(ident, _))) => { - if let Some(TokenTree::Token(_, Token::ModSep)) = tokens.peek() { - let mut segments = vec![PathSegment::from_ident(ident.with_span_pos(span))]; - tokens.next(); - loop { - if let Some(TokenTree::Token(span, - Token::Ident(ident, _))) = tokens.next() { - segments.push(PathSegment::from_ident(ident.with_span_pos(span))); - } else { - return None; - } - if let Some(TokenTree::Token(_, Token::ModSep)) = tokens.peek() { - tokens.next(); - } else { - break; - } + Some(TokenTree::Token(span, token @ Token::Ident(..))) | + Some(TokenTree::Token(span, token @ Token::ModSep)) => 'arm: { + let mut segments = if let Token::Ident(ident, _) = token { + if let Some(TokenTree::Token(_, Token::ModSep)) = tokens.peek() { + tokens.next(); + vec![PathSegment::from_ident(ident.with_span_pos(span))] + } else { + break 'arm Path::from_ident(ident.with_span_pos(span)); } - let span = span.with_hi(segments.last().unwrap().ident.span.hi()); - Path { span, segments } } else { - Path::from_ident(ident.with_span_pos(span)) + vec![PathSegment::path_root(span)] + }; + loop { + if let Some(TokenTree::Token(span, + Token::Ident(ident, _))) = tokens.next() { + segments.push(PathSegment::from_ident(ident.with_span_pos(span))); + } else { + return None; + } + if let Some(TokenTree::Token(_, Token::ModSep)) = tokens.peek() { + tokens.next(); + } else { + break; + } } + let span = span.with_hi(segments.last().unwrap().ident.span.hi()); + Path { span, segments } } Some(TokenTree::Token(_, Token::Interpolated(ref nt))) => match nt.0 { token::Nonterminal::NtIdent(ident, _) => Path::from_ident(ident), @@ -539,7 +534,9 @@ impl MetaItemKind { match *self { MetaItemKind::Word => TokenStream::empty(), MetaItemKind::NameValue(ref lit) => { - TokenStream::concat(vec![TokenTree::Token(span, Token::Eq).into(), lit.tokens()]) + let mut vec = vec![TokenTree::Token(span, Token::Eq).into()]; + lit.tokens().append_to_tree_and_joint_vec(&mut vec); + TokenStream::new(vec) } MetaItemKind::List(ref list) => { let mut tokens = Vec::new(); @@ -547,12 +544,13 @@ impl MetaItemKind { if i > 0 { tokens.push(TokenTree::Token(span, Token::Comma).into()); } - tokens.push(item.node.tokens()); + item.node.tokens().append_to_tree_and_joint_vec(&mut tokens); } - TokenTree::Delimited(DelimSpan::from_single(span), Delimited { - delim: token::Paren, - tts: TokenStream::concat(tokens).into(), - }).into() + TokenTree::Delimited( + DelimSpan::from_single(span), + token::Paren, + TokenStream::new(tokens).into(), + ).into() } } } @@ -570,9 +568,9 @@ impl MetaItemKind { None }; } - Some(TokenTree::Delimited(_, ref delimited)) if delimited.delim == token::Paren => { + Some(TokenTree::Delimited(_, delim, ref tts)) if delim == token::Paren => { tokens.next(); - delimited.stream() + tts.clone() } _ => return Some(MetaItemKind::Word), }; @@ -668,6 +666,7 @@ impl LitKind { } else { "false" })), false), + LitKind::Err(val) => Token::Literal(token::Lit::Err(val), None), } } @@ -803,7 +802,7 @@ pub fn inject(mut krate: ast::Crate, parse_sess: &ParseSess, attrs: &[String]) - for raw_attr in attrs { let mut parser = parse::new_parser_from_source_str( parse_sess, - FileName::CliCrateAttr, + FileName::cli_crate_attr_source_code(&raw_attr), raw_attr.clone(), ); diff --git a/src/libsyntax/build.rs b/src/libsyntax/build.rs index d39340c3326..9b861f96409 100644 --- a/src/libsyntax/build.rs +++ b/src/libsyntax/build.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-env-changed=CFG_RELEASE_CHANNEL"); diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs index d8fb20d4250..2930ce079c8 100644 --- a/src/libsyntax/config.rs +++ b/src/libsyntax/config.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use attr::HasAttrs; use feature_gate::{ feature_err, @@ -15,7 +5,6 @@ use feature_gate::{ Features, get_features, GateIssue, - emit_feature_err, }; use {fold, attr}; use ast; @@ -104,13 +93,6 @@ impl<'a> StripUnconfigured<'a> { return vec![attr]; } - let gate_cfg_attr_multi = if let Some(ref features) = self.features { - !features.cfg_attr_multi - } else { - false - }; - let cfg_attr_span = attr.span; - let (cfg_predicate, expanded_attrs) = match attr.parse(self.sess, |parser| { parser.expect(&token::OpenDelim(token::Paren))?; @@ -140,21 +122,8 @@ impl<'a> StripUnconfigured<'a> { // Check feature gate and lint on zero attributes in source. Even if the feature is gated, // we still compute as if it wasn't, since the emitted error will stop compilation further // along the compilation. - match (expanded_attrs.len(), gate_cfg_attr_multi) { - (0, false) => { - // FIXME: Emit unused attribute lint here. - }, - (1, _) => {}, - (_, true) => { - emit_feature_err( - self.sess, - "cfg_attr_multi", - cfg_attr_span, - GateIssue::Language, - "cfg_attr with zero or more than one attributes is experimental", - ); - }, - (_, false) => {} + if expanded_attrs.len() == 0 { + // FIXME: Emit unused attribute lint here. } if attr::cfg_matches(&cfg_predicate, self.sess, self.features) { @@ -186,7 +155,7 @@ impl<'a> StripUnconfigured<'a> { let error = |span, msg, suggestion: &str| { let mut err = self.sess.span_diagnostic.struct_span_err(span, msg); if !suggestion.is_empty() { - err.span_suggestion_with_applicability( + err.span_suggestion( span, "expected syntax is", suggestion.into(), @@ -197,12 +166,9 @@ impl<'a> StripUnconfigured<'a> { true }; - let meta_item = if let Some(meta_item) = attr.meta() { - meta_item - } else { - // Not a well-formed meta-item. Why? We don't know. - return error(attr.span, "`cfg` is not a well-formed meta-item", - "#[cfg(/* predicate */)]"); + let meta_item = match attr.parse_meta(self.sess) { + Ok(meta_item) => meta_item, + Err(mut err) => { err.emit(); return true; } }; let nested_meta_items = if let Some(nested_meta_items) = meta_item.meta_item_list() { nested_meta_items @@ -328,7 +294,7 @@ impl<'a> StripUnconfigured<'a> { // Anything else is always required, and thus has to error out // in case of a cfg attr. // - // NB: This is intentionally not part of the fold_expr() function + // N.B., this is intentionally not part of the fold_expr() function // in order for fold_opt_expr() to be able to avoid this check if let Some(attr) = expr.attrs().iter().find(|a| is_cfg(a)) { let msg = "removing an expression is not supported in this position"; @@ -421,7 +387,7 @@ impl<'a> fold::Folder for StripUnconfigured<'a> { } fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { - // Don't configure interpolated AST (c.f. #34171). + // Don't configure interpolated AST (cf. issue #34171). // Interpolated AST will get configured once the surrounding tokens are parsed. mac } diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index cd421de5f1d..2c367f1f402 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] // Error messages for EXXXX errors. @@ -399,12 +389,12 @@ register_diagnostics! { E0545, // incorrect 'issue' E0546, // missing 'feature' E0547, // missing 'issue' - E0548, // incorrect stability attribute type +// E0548, // replaced with a generic attribute input check E0549, // rustc_deprecated attribute must be paired with either stable or unstable attribute E0550, // multiple deprecated attributes E0551, // incorrect meta item E0553, // multiple rustc_const_unstable attributes - E0555, // malformed feature attribute, expected #![feature(...)] +// E0555, // replaced with a generic attribute input check E0556, // malformed feature, expected just one word E0584, // file for module `..` found at both .. and .. E0629, // missing 'feature' (rustc_const_unstable) diff --git a/src/libsyntax/diagnostics/macros.rs b/src/libsyntax/diagnostics/macros.rs index 61f3e7046f1..6f7493ad597 100644 --- a/src/libsyntax/diagnostics/macros.rs +++ b/src/libsyntax/diagnostics/macros.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! register_diagnostic { ($code:tt, $description:tt) => (__register_diagnostic! { $code, $description }); diff --git a/src/libsyntax/diagnostics/metadata.rs b/src/libsyntax/diagnostics/metadata.rs index 1438299d375..abde3dca0f6 100644 --- a/src/libsyntax/diagnostics/metadata.rs +++ b/src/libsyntax/diagnostics/metadata.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This module contains utilities for outputting metadata for diagnostic errors. //! //! Each set of errors is mapped to a metadata file by a name, which is diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 1229db9b0e0..fa6b825f2a2 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::BTreeMap; use std::env; @@ -127,20 +117,23 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt, )); } }); - let sym = Ident::with_empty_ctxt(Symbol::gensym(&format!( - "__register_diagnostic_{}", code - ))); + + let span = span.apply_mark(ecx.current_expansion.mark); + + let sym = Ident::new(Symbol::gensym(&format!("__register_diagnostic_{}", code)), span); + MacEager::items(smallvec![ ecx.item_mod( span, span, sym, - Vec::new(), - Vec::new() + vec![], + vec![], ) ]) } +#[allow(deprecated)] pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, span: Span, token_tree: &[TokenTree]) diff --git a/src/libsyntax/early_buffered_lints.rs b/src/libsyntax/early_buffered_lints.rs index a976af1435d..cf9671a14b3 100644 --- a/src/libsyntax/early_buffered_lints.rs +++ b/src/libsyntax/early_buffered_lints.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Allows the buffering of lints for later. //! //! Since we cannot have a dependency on `librustc`, we implement some types here that are somewhat @@ -21,6 +11,7 @@ use syntax_pos::MultiSpan; pub enum BufferedEarlyLintId { /// Usage of `?` as a macro separator is deprecated. QuestionMarkMacroSep, + IllFormedAttributeInput, } /// Stores buffered lint info which can later be passed to `librustc`. diff --git a/src/libsyntax/entry.rs b/src/libsyntax/entry.rs index 93ca1948ed8..72a550a05d5 100644 --- a/src/libsyntax/entry.rs +++ b/src/libsyntax/entry.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use attr; use ast::{Item, ItemKind}; diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index bb927b62a18..09e7e57f78c 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -1,18 +1,8 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use self::SyntaxExtension::*; use ast::{self, Attribute, Name, PatKind, MetaItem}; use attr::HasAttrs; -use source_map::{self, SourceMap, Spanned, respan}; +use source_map::{SourceMap, Spanned, respan}; use syntax_pos::{Span, MultiSpan, DUMMY_SP}; use edition::Edition; use errors::{DiagnosticBuilder, DiagnosticId}; @@ -466,7 +456,8 @@ impl MacResult for MacEager { #[derive(Copy, Clone)] pub struct DummyResult { expr_only: bool, - span: Span + is_error: bool, + span: Span, } impl DummyResult { @@ -474,8 +465,13 @@ impl DummyResult { /// /// Use this as a return value after hitting any errors and /// calling `span_err`. - pub fn any(sp: Span) -> Box { - Box::new(DummyResult { expr_only: false, span: sp }) + pub fn any(span: Span) -> Box { + Box::new(DummyResult { expr_only: false, is_error: true, span }) + } + + /// Same as `any`, but must be a valid fragment, not error. + pub fn any_valid(span: Span) -> Box { + Box::new(DummyResult { expr_only: false, is_error: false, span }) } /// Create a default MacResult that can only be an expression. @@ -483,15 +479,15 @@ impl DummyResult { /// Use this for macros that must expand to an expression, so even /// if an error is encountered internally, the user will receive /// an error that they also used it in the wrong place. - pub fn expr(sp: Span) -> Box { - Box::new(DummyResult { expr_only: true, span: sp }) + pub fn expr(span: Span) -> Box { + Box::new(DummyResult { expr_only: true, is_error: true, span }) } /// A plain dummy expression. - pub fn raw_expr(sp: Span) -> P { + pub fn raw_expr(sp: Span, is_error: bool) -> P { P(ast::Expr { id: ast::DUMMY_NODE_ID, - node: ast::ExprKind::Lit(source_map::respan(sp, ast::LitKind::Bool(false))), + node: if is_error { ast::ExprKind::Err } else { ast::ExprKind::Tup(Vec::new()) }, span: sp, attrs: ThinVec::new(), }) @@ -506,10 +502,11 @@ impl DummyResult { } } - pub fn raw_ty(sp: Span) -> P { + /// A plain dummy type. + pub fn raw_ty(sp: Span, is_error: bool) -> P { P(ast::Ty { id: ast::DUMMY_NODE_ID, - node: ast::TyKind::Infer, + node: if is_error { ast::TyKind::Err } else { ast::TyKind::Tup(Vec::new()) }, span: sp }) } @@ -517,7 +514,7 @@ impl DummyResult { impl MacResult for DummyResult { fn make_expr(self: Box) -> Option> { - Some(DummyResult::raw_expr(self.span)) + Some(DummyResult::raw_expr(self.span, self.is_error)) } fn make_pat(self: Box) -> Option> { @@ -560,13 +557,13 @@ impl MacResult for DummyResult { fn make_stmts(self: Box) -> Option> { Some(smallvec![ast::Stmt { id: ast::DUMMY_NODE_ID, - node: ast::StmtKind::Expr(DummyResult::raw_expr(self.span)), + node: ast::StmtKind::Expr(DummyResult::raw_expr(self.span, self.is_error)), span: self.span, }]) } fn make_ty(self: Box) -> Option> { - Some(DummyResult::raw_ty(self.span)) + Some(DummyResult::raw_ty(self.span, self.is_error)) } } @@ -670,7 +667,7 @@ pub enum SyntaxExtension { /// An attribute-like procedural macro that derives a builtin trait. BuiltinDerive(BuiltinDeriveFn), - /// A declarative macro, e.g. `macro m() {}`. + /// A declarative macro, e.g., `macro m() {}`. DeclMacro { expander: Box, def_info: Option<(ast::NodeId, Span)>, @@ -732,17 +729,13 @@ pub type NamedSyntaxExtension = (Name, SyntaxExtension); pub trait Resolver { fn next_node_id(&mut self) -> ast::NodeId; fn get_module_scope(&mut self, id: ast::NodeId) -> Mark; - fn eliminate_crate_var(&mut self, item: P) -> P; - fn is_whitelisted_legacy_custom_derive(&self, name: Name) -> bool; + fn resolve_dollar_crates(&mut self, fragment: &AstFragment); fn visit_ast_fragment_with_placeholders(&mut self, mark: Mark, fragment: &AstFragment, derives: &[Mark]); fn add_builtin(&mut self, ident: ast::Ident, ext: Lrc); fn resolve_imports(&mut self); - // Resolves attribute and derive legacy macros from `#![plugin(..)]`. - fn find_legacy_attr_invoc(&mut self, attrs: &mut Vec, allow_derive: bool) - -> Option; fn resolve_macro_invocation(&mut self, invoc: &Invocation, invoc_id: Mark, force: bool) -> Result>, Determinacy>; @@ -770,16 +763,13 @@ pub struct DummyResolver; impl Resolver for DummyResolver { fn next_node_id(&mut self) -> ast::NodeId { ast::DUMMY_NODE_ID } fn get_module_scope(&mut self, _id: ast::NodeId) -> Mark { Mark::root() } - fn eliminate_crate_var(&mut self, item: P) -> P { item } - fn is_whitelisted_legacy_custom_derive(&self, _name: Name) -> bool { false } + fn resolve_dollar_crates(&mut self, _fragment: &AstFragment) {} fn visit_ast_fragment_with_placeholders(&mut self, _invoc: Mark, _fragment: &AstFragment, _derives: &[Mark]) {} fn add_builtin(&mut self, _ident: ast::Ident, _ext: Lrc) {} fn resolve_imports(&mut self) {} - fn find_legacy_attr_invoc(&mut self, _attrs: &mut Vec, _allow_derive: bool) - -> Option { None } fn resolve_macro_invocation(&mut self, _invoc: &Invocation, _invoc_id: Mark, _force: bool) -> Result>, Determinacy> { Err(Determinacy::Determined) @@ -815,7 +805,6 @@ pub struct ExtCtxt<'a> { pub ecfg: expand::ExpansionConfig<'a>, pub root_path: PathBuf, pub resolver: &'a mut dyn Resolver, - pub resolve_err_count: usize, pub current_expansion: ExpansionData, pub expansions: FxHashMap>, } @@ -830,7 +819,6 @@ impl<'a> ExtCtxt<'a> { ecfg, root_path: PathBuf::new(), resolver, - resolve_err_count: 0, current_expansion: ExpansionData { mark: Mark::root(), depth: 0, @@ -915,7 +903,7 @@ impl<'a> ExtCtxt<'a> { /// `span_err` should be strongly preferred where-ever possible: /// this should *only* be used when: /// - /// - continuing has a high risk of flow-on errors (e.g. errors in + /// - continuing has a high risk of flow-on errors (e.g., errors in /// declaring a macro would cause all uses of that macro to /// complain about "undefined macro"), or /// - there is literally nothing else that can be done (however, @@ -995,28 +983,29 @@ pub fn expr_to_spanned_string<'a>( cx: &'a mut ExtCtxt, expr: P, err_msg: &str, -) -> Result, DiagnosticBuilder<'a>> { +) -> Result, Option>> { // Update `expr.span`'s ctxt now in case expr is an `include!` macro invocation. let expr = expr.map(|mut expr| { expr.span = expr.span.apply_mark(cx.current_expansion.mark); expr }); - // we want to be able to handle e.g. `concat!("foo", "bar")` + // we want to be able to handle e.g., `concat!("foo", "bar")` let expr = cx.expander().fold_expr(expr); Err(match expr.node { ast::ExprKind::Lit(ref l) => match l.node { ast::LitKind::Str(s, style) => return Ok(respan(expr.span, (s, style))), - _ => cx.struct_span_err(l.span, err_msg) + _ => Some(cx.struct_span_err(l.span, err_msg)) }, - _ => cx.struct_span_err(expr.span, err_msg) + ast::ExprKind::Err => None, + _ => Some(cx.struct_span_err(expr.span, err_msg)) }) } pub fn expr_to_string(cx: &mut ExtCtxt, expr: P, err_msg: &str) -> Option<(Symbol, ast::StrStyle)> { expr_to_spanned_string(cx, expr, err_msg) - .map_err(|mut err| err.emit()) + .map_err(|err| err.map(|mut err| err.emit())) .ok() .map(|s| s.node) } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index cacec867cf1..a8eec1a74dd 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_target::spec::abi::Abi; use ast::{self, Ident, Generics, Expr, BlockCheckMode, UnOp, PatKind}; use attr; @@ -318,9 +308,13 @@ impl<'a> AstBuilder for ExtCtxt<'a> { args: Vec, bindings: Vec ) -> ast::Path { + assert!(!idents.is_empty()); + let add_root = global && !idents[0].is_path_segment_keyword(); + let mut segments = Vec::with_capacity(idents.len() + add_root as usize); + if add_root { + segments.push(ast::PathSegment::path_root(span)); + } let last_ident = idents.pop().unwrap(); - let mut segments: Vec = vec![]; - segments.extend(idents.into_iter().map(|ident| { ast::PathSegment::from_ident(ident.with_span_pos(span)) })); @@ -334,13 +328,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { id: ast::DUMMY_NODE_ID, args, }); - let mut path = ast::Path { span, segments }; - if global { - if let Some(seg) = path.make_root() { - path.segments.insert(0, seg); - } - } - path + ast::Path { span, segments } } /// Constructs a qualified path. @@ -599,7 +587,6 @@ impl<'a> AstBuilder for ExtCtxt<'a> { id: ast::DUMMY_NODE_ID, rules: BlockCheckMode::Default, span, - recovered: false, }) } @@ -625,7 +612,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { self.expr_path(self.path_ident(span, id)) } fn expr_self(&self, span: Span) -> P { - self.expr_ident(span, keywords::SelfValue.ident()) + self.expr_ident(span, keywords::SelfLower.ident()) } fn expr_binary(&self, sp: Span, op: ast::BinOpKind, diff --git a/src/libsyntax/ext/derive.rs b/src/libsyntax/ext/derive.rs index 684cee38874..7ef09ce5fbd 100644 --- a/src/libsyntax/ext/derive.rs +++ b/src/libsyntax/ext/derive.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use attr::HasAttrs; use ast; use source_map::{hygiene, ExpnInfo, ExpnFormat}; @@ -25,6 +15,11 @@ pub fn collect_derives(cx: &mut ExtCtxt, attrs: &mut Vec) -> Vec if attr.path != "derive" { return true; } + if !attr.is_meta_item_list() { + cx.span_err(attr.span, + "attribute must be of the form `#[derive(Trait1, Trait2, ...)]`"); + return false; + } match attr.parse_list(cx.parse_sess, |parser| parser.parse_path_allowing_meta(PathStyle::Mod)) { diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index cc8af70a050..1b4b44270ad 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1,14 +1,4 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use ast::{self, Block, Ident, NodeId, PatKind, Path}; +use ast::{self, Block, Ident, LitKind, NodeId, PatKind, Path}; use ast::{MacStmtStyle, StmtKind, ItemKind}; use attr::{self, HasAttrs}; use source_map::{ExpnInfo, MacroBang, MacroAttribute, dummy_spanned, respan}; @@ -34,8 +24,8 @@ use tokenstream::{TokenStream, TokenTree}; use visit::{self, Visitor}; use rustc_data_structures::fx::FxHashMap; -use std::fs::File; -use std::io::Read; +use std::fs; +use std::io::ErrorKind; use std::{iter, mem}; use std::rc::Rc; use std::path::PathBuf; @@ -203,10 +193,7 @@ fn macro_bang_format(path: &ast::Path) -> ExpnFormat { if i != 0 { path_str.push_str("::"); } - - if segment.ident.name != keywords::CrateRoot.name() && - segment.ident.name != keywords::DollarCrate.name() - { + if segment.ident.name != keywords::PathRoot.name() { path_str.push_str(&segment.ident.as_str()) } } @@ -357,8 +344,10 @@ impl<'a, 'b> MacroExpander<'a, 'b> { // FIXME(jseyfried): Refactor out the following logic let (expanded_fragment, new_invocations) = if let Some(ext) = ext { if let Some(ext) = ext { - let dummy = invoc.fragment_kind.dummy(invoc.span()).unwrap(); - let fragment = self.expand_invoc(invoc, &*ext).unwrap_or(dummy); + let (invoc_fragment_kind, invoc_span) = (invoc.fragment_kind, invoc.span()); + let fragment = self.expand_invoc(invoc, &*ext).unwrap_or_else(|| { + invoc_fragment_kind.dummy(invoc_span).unwrap() + }); self.collect_invocations(fragment, &[]) } else if let InvocationKind::Attr { attr: None, traits, item, .. } = invoc.kind { if !item.derive_allowed() { @@ -372,7 +361,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { let trait_list = traits.iter() .map(|t| t.to_string()).collect::>(); let suggestion = format!("#[derive({})]", trait_list.join(", ")); - err.span_suggestion_with_applicability( + err.span_suggestion( span, "try an outer attribute", suggestion, // We don't 𝑘𝑛𝑜𝑤 that the following item is an ADT Applicability::MaybeIncorrect @@ -444,9 +433,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { fn resolve_imports(&mut self) { if self.monotonic { - let err_count = self.cx.parse_sess.span_diagnostic.err_count(); self.cx.resolver.resolve_imports(); - self.cx.resolve_err_count += self.cx.parse_sess.span_diagnostic.err_count() - err_count; } } @@ -456,6 +443,9 @@ impl<'a, 'b> MacroExpander<'a, 'b> { /// prepares data for resolving paths of macro invocations. fn collect_invocations(&mut self, fragment: AstFragment, derives: &[Mark]) -> (AstFragment, Vec) { + // Resolve `$crate`s in the fragment for pretty-printing. + self.cx.resolver.resolve_dollar_crates(&fragment); + let (fragment_with_placeholders, invocations) = { let mut collector = InvocationCollector { cfg: StripUnconfigured { @@ -470,11 +460,9 @@ impl<'a, 'b> MacroExpander<'a, 'b> { }; if self.monotonic { - let err_count = self.cx.parse_sess.span_diagnostic.err_count(); - let mark = self.cx.current_expansion.mark; - self.cx.resolver.visit_ast_fragment_with_placeholders(mark, &fragment_with_placeholders, - derives); - self.cx.resolve_err_count += self.cx.parse_sess.span_diagnostic.err_count() - err_count; + self.cx.resolver.visit_ast_fragment_with_placeholders( + self.cx.current_expansion.mark, &fragment_with_placeholders, derives + ); } (fragment_with_placeholders, invocations) @@ -622,9 +610,9 @@ impl<'a, 'b> MacroExpander<'a, 'b> { fn extract_proc_macro_attr_input(&self, tokens: TokenStream, span: Span) -> TokenStream { let mut trees = tokens.trees(); match trees.next() { - Some(TokenTree::Delimited(_, delim)) => { + Some(TokenTree::Delimited(_, _, tts)) => { if trees.next().is_none() { - return delim.tts.into() + return tts.into() } } Some(TokenTree::Token(..)) => {} @@ -737,7 +725,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> { emit_feature_err(this.cx.parse_sess, &*feature.as_str(), span, GateIssue::Library(Some(issue)), &explain); this.cx.trace_macros_diag(); - return Err(kind.dummy(span)); } } @@ -1055,7 +1042,7 @@ impl<'a> Parser<'a> { let semi_full_span = semi_span.to(self.sess.source_map().next_point(semi_span)); match self.sess.source_map().span_to_snippet(semi_full_span) { Ok(ref snippet) if &snippet[..] != ";" && kind_name == "expression" => { - err.span_suggestion_with_applicability( + err.span_suggestion( semi_span, "you might be missing a semicolon here", ";".to_owned(), @@ -1134,12 +1121,6 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { let (mut attr, mut traits, mut after_derive) = (None, Vec::new(), false); item = item.map_attrs(|mut attrs| { - if let Some(legacy_attr_invoc) = self.cx.resolver.find_legacy_attr_invoc(&mut attrs, - true) { - attr = Some(legacy_attr_invoc); - return attrs; - } - attr = self.find_attr_invoc(&mut attrs, &mut after_derive); traits = collect_derives(&mut self.cx, &mut attrs); attrs @@ -1156,12 +1137,6 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { let (mut attr, mut after_derive) = (None, false); item = item.map_attrs(|mut attrs| { - if let Some(legacy_attr_invoc) = self.cx.resolver.find_legacy_attr_invoc(&mut attrs, - false) { - attr = Some(legacy_attr_invoc); - return attrs; - } - attr = self.find_attr_invoc(&mut attrs, &mut after_derive); attrs }); @@ -1201,50 +1176,62 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { fn fold_expr(&mut self, expr: P) -> P { - let mut expr = self.cfg.configure_expr(expr).into_inner(); - expr.node = self.cfg.configure_expr_kind(expr.node); - - // ignore derives so they remain unused - let (attr, expr, after_derive) = self.classify_nonitem(expr); - - if attr.is_some() { - // collect the invoc regardless of whether or not attributes are permitted here - // expansion will eat the attribute so it won't error later - attr.as_ref().map(|a| self.cfg.maybe_emit_expr_attr_err(a)); - - // AstFragmentKind::Expr requires the macro to emit an expression - return self.collect_attr(attr, vec![], Annotatable::Expr(P(expr)), - AstFragmentKind::Expr, after_derive).make_expr(); - } + let expr = self.cfg.configure_expr(expr); + expr.map(|mut expr| { + expr.node = self.cfg.configure_expr_kind(expr.node); + + // ignore derives so they remain unused + let (attr, expr, after_derive) = self.classify_nonitem(expr); + + if attr.is_some() { + // Collect the invoc regardless of whether or not attributes are permitted here + // expansion will eat the attribute so it won't error later. + attr.as_ref().map(|a| self.cfg.maybe_emit_expr_attr_err(a)); + + // AstFragmentKind::Expr requires the macro to emit an expression. + return self.collect_attr(attr, vec![], Annotatable::Expr(P(expr)), + AstFragmentKind::Expr, after_derive) + .make_expr() + .into_inner() + } - if let ast::ExprKind::Mac(mac) = expr.node { - self.check_attributes(&expr.attrs); - self.collect_bang(mac, expr.span, AstFragmentKind::Expr).make_expr() - } else { - P(noop_fold_expr(expr, self)) - } + if let ast::ExprKind::Mac(mac) = expr.node { + self.check_attributes(&expr.attrs); + self.collect_bang(mac, expr.span, AstFragmentKind::Expr) + .make_expr() + .into_inner() + } else { + noop_fold_expr(expr, self) + } + }) } fn fold_opt_expr(&mut self, expr: P) -> Option> { - let mut expr = configure!(self, expr).into_inner(); - expr.node = self.cfg.configure_expr_kind(expr.node); + let expr = configure!(self, expr); + expr.filter_map(|mut expr| { + expr.node = self.cfg.configure_expr_kind(expr.node); - // ignore derives so they remain unused - let (attr, expr, after_derive) = self.classify_nonitem(expr); + // Ignore derives so they remain unused. + let (attr, expr, after_derive) = self.classify_nonitem(expr); - if attr.is_some() { - attr.as_ref().map(|a| self.cfg.maybe_emit_expr_attr_err(a)); + if attr.is_some() { + attr.as_ref().map(|a| self.cfg.maybe_emit_expr_attr_err(a)); - return self.collect_attr(attr, vec![], Annotatable::Expr(P(expr)), - AstFragmentKind::OptExpr, after_derive).make_opt_expr(); - } + return self.collect_attr(attr, vec![], Annotatable::Expr(P(expr)), + AstFragmentKind::OptExpr, after_derive) + .make_opt_expr() + .map(|expr| expr.into_inner()) + } - if let ast::ExprKind::Mac(mac) = expr.node { - self.check_attributes(&expr.attrs); - self.collect_bang(mac, expr.span, AstFragmentKind::OptExpr).make_opt_expr() - } else { - Some(P(noop_fold_expr(expr, self))) - } + if let ast::ExprKind::Mac(mac) = expr.node { + self.check_attributes(&expr.attrs); + self.collect_bang(mac, expr.span, AstFragmentKind::OptExpr) + .make_opt_expr() + .map(|expr| expr.into_inner()) + } else { + Some(noop_fold_expr(expr, self)) + } + }) } fn fold_pat(&mut self, pat: P) -> P { @@ -1351,7 +1338,7 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { module.mod_path.push(item.ident); // Detect if this is an inline module (`mod m { ... }` as opposed to `mod m;`). - // In the non-inline case, `inner` is never the dummy span (c.f. `parse_item_mod`). + // In the non-inline case, `inner` is never the dummy span (cf. `parse_item_mod`). // Thus, if `inner` is the dummy span, we know the module is inline. let inline_module = item.span.contains(inner) || inner.is_dummy(); @@ -1507,20 +1494,8 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { return noop_fold_attribute(at, self); } - let mut buf = vec![]; let filename = self.cx.root_path.join(file.to_string()); - - match File::open(&filename).and_then(|mut f| f.read_to_end(&mut buf)) { - Ok(..) => {} - Err(e) => { - self.cx.span_err(at.span, - &format!("couldn't read {}: {}", - filename.display(), - e)); - } - } - - match String::from_utf8(buf) { + match fs::read_to_string(&filename) { Ok(src) => { let src_interned = Symbol::intern(&src); @@ -1530,25 +1505,82 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { let include_info = vec![ dummy_spanned(ast::NestedMetaItemKind::MetaItem( - attr::mk_name_value_item_str(Ident::from_str("file"), - dummy_spanned(file)))), + attr::mk_name_value_item_str( + Ident::from_str("file"), + dummy_spanned(file), + ), + )), dummy_spanned(ast::NestedMetaItemKind::MetaItem( - attr::mk_name_value_item_str(Ident::from_str("contents"), - dummy_spanned(src_interned)))), + attr::mk_name_value_item_str( + Ident::from_str("contents"), + dummy_spanned(src_interned), + ), + )), ]; let include_ident = Ident::from_str("include"); let item = attr::mk_list_item(DUMMY_SP, include_ident, include_info); items.push(dummy_spanned(ast::NestedMetaItemKind::MetaItem(item))); } - Err(_) => { - self.cx.span_err(at.span, - &format!("{} wasn't a utf-8 file", - filename.display())); + Err(e) => { + let lit = it + .meta_item() + .and_then(|item| item.name_value_literal()) + .unwrap(); + + if e.kind() == ErrorKind::InvalidData { + self.cx + .struct_span_err( + lit.span, + &format!("{} wasn't a utf-8 file", filename.display()), + ) + .span_label(lit.span, "contains invalid utf-8") + .emit(); + } else { + let mut err = self.cx.struct_span_err( + lit.span, + &format!("couldn't read {}: {}", filename.display(), e), + ); + err.span_label(lit.span, "couldn't read file"); + + if e.kind() == ErrorKind::NotFound { + err.help("external doc paths are relative to the crate root"); + } + + err.emit(); + } } } } else { - items.push(noop_fold_meta_list_item(it, self)); + let mut err = self.cx.struct_span_err( + it.span, + &format!("expected path to external documentation"), + ); + + // Check if the user erroneously used `doc(include(...))` syntax. + let literal = it.meta_item_list().and_then(|list| { + if list.len() == 1 { + list[0].literal().map(|literal| &literal.node) + } else { + None + } + }); + + let (path, applicability) = match &literal { + Some(LitKind::Str(path, ..)) => { + (path.to_string(), Applicability::MachineApplicable) + } + _ => (String::from(""), Applicability::HasPlaceholders), + }; + + err.span_suggestion( + it.span, + "provide a file path with `=`", + format!("include = \"{}\"", path), + applicability, + ); + + err.emit(); } } @@ -1611,7 +1643,6 @@ impl<'feat> ExpansionConfig<'feat> { } feature_tests! { - fn enable_quotes = quote, fn enable_asm = asm, fn enable_custom_test_frameworks = custom_test_frameworks, fn enable_global_asm = global_asm, @@ -1619,7 +1650,6 @@ impl<'feat> ExpansionConfig<'feat> { fn enable_concat_idents = concat_idents, fn enable_trace_macros = trace_macros, fn enable_allow_internal_unstable = allow_internal_unstable, - fn enable_custom_derive = custom_derive, fn enable_format_args_nl = format_args_nl, fn macros_in_extern_enabled = macros_in_extern, fn proc_macro_hygiene = proc_macro_hygiene, diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs index 7f31b04ef9c..3b0402d910a 100644 --- a/src/libsyntax/ext/placeholders.rs +++ b/src/libsyntax/ext/placeholders.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ast::{self, NodeId}; use source_map::{DUMMY_SP, dummy_spanned}; use ext::base::ExtCtxt; diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs deleted file mode 100644 index c6e0adbb5a4..00000000000 --- a/src/libsyntax/ext/quote.rs +++ /dev/null @@ -1,905 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use ast::{self, Arg, Arm, Block, Expr, Item, Pat, Stmt, Ty}; -use source_map::respan; -use syntax_pos::{Span, DUMMY_SP}; -use ext::base::ExtCtxt; -use ext::base; -use ext::build::AstBuilder; -use parse::parser::{Parser, PathStyle}; -use parse::token; -use ptr::P; -use tokenstream::{DelimSpan, TokenStream, TokenTree}; - -/// Quasiquoting works via token trees. -/// -/// This is registered as a set of expression syntax extension called quote! -/// that lifts its argument token-tree to an AST representing the -/// construction of the same token tree, with `token::SubstNt` interpreted -/// as antiquotes (splices). - -pub mod rt { - use ast; - use source_map::Spanned; - use ext::base::ExtCtxt; - use parse::{self, classify}; - use parse::token::{self, Token}; - use ptr::P; - use symbol::Symbol; - use ThinVec; - - use tokenstream::{self, DelimSpan, TokenTree, TokenStream}; - - pub use parse::new_parser_from_tts; - pub use syntax_pos::{BytePos, Span, DUMMY_SP, FileName}; - pub use source_map::{dummy_spanned}; - - pub trait ToTokens { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec; - } - - impl ToTokens for TokenTree { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - vec![self.clone()] - } - } - - impl ToTokens for Vec { - fn to_tokens(&self, cx: &ExtCtxt) -> Vec { - self.iter().flat_map(|t| t.to_tokens(cx)).collect() - } - } - - impl ToTokens for Spanned { - fn to_tokens(&self, cx: &ExtCtxt) -> Vec { - // FIXME: use the span? - self.node.to_tokens(cx) - } - } - - impl ToTokens for Option { - fn to_tokens(&self, cx: &ExtCtxt) -> Vec { - match *self { - Some(ref t) => t.to_tokens(cx), - None => Vec::new(), - } - } - } - - impl ToTokens for ast::Ident { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - vec![TokenTree::Token(self.span, Token::from_ast_ident(*self))] - } - } - - impl ToTokens for ast::Path { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtPath(self.clone()); - vec![TokenTree::Token(DUMMY_SP, Token::interpolated(nt))] - } - } - - impl ToTokens for ast::Ty { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtTy(P(self.clone())); - vec![TokenTree::Token(self.span, Token::interpolated(nt))] - } - } - - impl ToTokens for ast::Block { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtBlock(P(self.clone())); - vec![TokenTree::Token(self.span, Token::interpolated(nt))] - } - } - - impl ToTokens for ast::Generics { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtGenerics(self.clone()); - vec![TokenTree::Token(DUMMY_SP, Token::interpolated(nt))] - } - } - - impl ToTokens for ast::WhereClause { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtWhereClause(self.clone()); - vec![TokenTree::Token(DUMMY_SP, Token::interpolated(nt))] - } - } - - impl ToTokens for P { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtItem(self.clone()); - vec![TokenTree::Token(self.span, Token::interpolated(nt))] - } - } - - impl ToTokens for ast::ImplItem { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtImplItem(self.clone()); - vec![TokenTree::Token(self.span, Token::interpolated(nt))] - } - } - - impl ToTokens for P { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtImplItem((**self).clone()); - vec![TokenTree::Token(self.span, Token::interpolated(nt))] - } - } - - impl ToTokens for ast::TraitItem { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtTraitItem(self.clone()); - vec![TokenTree::Token(self.span, Token::interpolated(nt))] - } - } - - impl ToTokens for ast::Stmt { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtStmt(self.clone()); - let mut tts = vec![TokenTree::Token(self.span, Token::interpolated(nt))]; - - // Some statements require a trailing semicolon. - if classify::stmt_ends_with_semi(&self.node) { - tts.push(TokenTree::Token(self.span, token::Semi)); - } - - tts - } - } - - impl ToTokens for P { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtExpr(self.clone()); - vec![TokenTree::Token(self.span, Token::interpolated(nt))] - } - } - - impl ToTokens for P { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtPat(self.clone()); - vec![TokenTree::Token(self.span, Token::interpolated(nt))] - } - } - - impl ToTokens for ast::Arm { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtArm(self.clone()); - vec![TokenTree::Token(DUMMY_SP, Token::interpolated(nt))] - } - } - - impl ToTokens for ast::Arg { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtArg(self.clone()); - vec![TokenTree::Token(DUMMY_SP, Token::interpolated(nt))] - } - } - - impl ToTokens for P { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtBlock(self.clone()); - vec![TokenTree::Token(DUMMY_SP, Token::interpolated(nt))] - } - } - - impl ToTokens for ast::Lifetime { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - vec![TokenTree::Token(self.ident.span, token::Lifetime(self.ident))] - } - } - - macro_rules! impl_to_tokens_slice { - ($t: ty, $sep: expr) => { - impl ToTokens for [$t] { - fn to_tokens(&self, cx: &ExtCtxt) -> Vec { - let mut v = vec![]; - for (i, x) in self.iter().enumerate() { - if i > 0 { - v.extend_from_slice(&$sep); - } - v.extend(x.to_tokens(cx)); - } - v - } - } - }; - } - - impl_to_tokens_slice! { ast::Ty, [TokenTree::Token(DUMMY_SP, token::Comma)] } - impl_to_tokens_slice! { P, [] } - impl_to_tokens_slice! { ast::Arg, [TokenTree::Token(DUMMY_SP, token::Comma)] } - - impl ToTokens for ast::MetaItem { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let nt = token::NtMeta(self.clone()); - vec![TokenTree::Token(DUMMY_SP, Token::interpolated(nt))] - } - } - - impl ToTokens for ast::Attribute { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - let mut r = vec![]; - // FIXME: The spans could be better - r.push(TokenTree::Token(self.span, token::Pound)); - if self.style == ast::AttrStyle::Inner { - r.push(TokenTree::Token(self.span, token::Not)); - } - let mut inner = Vec::new(); - for (i, segment) in self.path.segments.iter().enumerate() { - if i > 0 { - inner.push(TokenTree::Token(self.span, token::Colon).into()); - } - inner.push(TokenTree::Token( - self.span, token::Token::from_ast_ident(segment.ident) - ).into()); - } - inner.push(self.tokens.clone()); - - let delim_span = DelimSpan::from_single(self.span); - r.push(TokenTree::Delimited(delim_span, tokenstream::Delimited { - delim: token::Bracket, tts: TokenStream::concat(inner).into() - })); - r - } - } - - impl ToTokens for str { - fn to_tokens(&self, cx: &ExtCtxt) -> Vec { - let lit = ast::LitKind::Str(Symbol::intern(self), ast::StrStyle::Cooked); - dummy_spanned(lit).to_tokens(cx) - } - } - - impl ToTokens for () { - fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { - vec![TokenTree::Delimited(DelimSpan::dummy(), tokenstream::Delimited { - delim: token::Paren, - tts: TokenStream::empty().into(), - })] - } - } - - impl ToTokens for ast::Lit { - fn to_tokens(&self, cx: &ExtCtxt) -> Vec { - // FIXME: This is wrong - P(ast::Expr { - id: ast::DUMMY_NODE_ID, - node: ast::ExprKind::Lit(self.clone()), - span: DUMMY_SP, - attrs: ThinVec::new(), - }).to_tokens(cx) - } - } - - impl ToTokens for bool { - fn to_tokens(&self, cx: &ExtCtxt) -> Vec { - dummy_spanned(ast::LitKind::Bool(*self)).to_tokens(cx) - } - } - - impl ToTokens for char { - fn to_tokens(&self, cx: &ExtCtxt) -> Vec { - dummy_spanned(ast::LitKind::Char(*self)).to_tokens(cx) - } - } - - macro_rules! impl_to_tokens_int { - (signed, $t:ty, $tag:expr) => ( - impl ToTokens for $t { - fn to_tokens(&self, cx: &ExtCtxt) -> Vec { - let val = if *self < 0 { - -self - } else { - *self - }; - let lit = ast::LitKind::Int(val as u128, ast::LitIntType::Signed($tag)); - let lit = P(ast::Expr { - id: ast::DUMMY_NODE_ID, - node: ast::ExprKind::Lit(dummy_spanned(lit)), - span: DUMMY_SP, - attrs: ThinVec::new(), - }); - if *self >= 0 { - return lit.to_tokens(cx); - } - P(ast::Expr { - id: ast::DUMMY_NODE_ID, - node: ast::ExprKind::Unary(ast::UnOp::Neg, lit), - span: DUMMY_SP, - attrs: ThinVec::new(), - }).to_tokens(cx) - } - } - ); - (unsigned, $t:ty, $tag:expr) => ( - impl ToTokens for $t { - fn to_tokens(&self, cx: &ExtCtxt) -> Vec { - let lit = ast::LitKind::Int(*self as u128, ast::LitIntType::Unsigned($tag)); - dummy_spanned(lit).to_tokens(cx) - } - } - ); - } - - impl_to_tokens_int! { signed, isize, ast::IntTy::Isize } - impl_to_tokens_int! { signed, i8, ast::IntTy::I8 } - impl_to_tokens_int! { signed, i16, ast::IntTy::I16 } - impl_to_tokens_int! { signed, i32, ast::IntTy::I32 } - impl_to_tokens_int! { signed, i64, ast::IntTy::I64 } - - impl_to_tokens_int! { unsigned, usize, ast::UintTy::Usize } - impl_to_tokens_int! { unsigned, u8, ast::UintTy::U8 } - impl_to_tokens_int! { unsigned, u16, ast::UintTy::U16 } - impl_to_tokens_int! { unsigned, u32, ast::UintTy::U32 } - impl_to_tokens_int! { unsigned, u64, ast::UintTy::U64 } - - pub trait ExtParseUtils { - fn parse_item(&self, s: String) -> P; - fn parse_expr(&self, s: String) -> P; - fn parse_stmt(&self, s: String) -> ast::Stmt; - fn parse_tts(&self, s: String) -> Vec; - } - - impl<'a> ExtParseUtils for ExtCtxt<'a> { - fn parse_item(&self, s: String) -> P { - panictry!(parse::parse_item_from_source_str( - FileName::QuoteExpansion, - s, - self.parse_sess())).expect("parse error") - } - - fn parse_stmt(&self, s: String) -> ast::Stmt { - panictry!(parse::parse_stmt_from_source_str( - FileName::QuoteExpansion, - s, - self.parse_sess())).expect("parse error") - } - - fn parse_expr(&self, s: String) -> P { - panictry!(parse::parse_expr_from_source_str( - FileName::QuoteExpansion, - s, - self.parse_sess())) - } - - fn parse_tts(&self, s: String) -> Vec { - let source_name = FileName::QuoteExpansion; - parse::parse_stream_from_source_str(source_name, s, self.parse_sess(), None) - .into_trees().collect() - } - } -} - -// Replaces `Token::OpenDelim .. Token::CloseDelim` with `TokenTree::Delimited(..)`. -pub fn unflatten(tts: Vec) -> Vec { - use tokenstream::Delimited; - - let mut results = Vec::new(); - let mut result = Vec::new(); - let mut open_span = DUMMY_SP; - for tree in tts { - match tree { - TokenTree::Token(span, token::OpenDelim(..)) => { - open_span = span; - results.push(::std::mem::replace(&mut result, Vec::new())); - } - TokenTree::Token(span, token::CloseDelim(delim)) => { - let delim_span = DelimSpan::from_pair(open_span, span); - let tree = TokenTree::Delimited(delim_span, Delimited { - delim, - tts: result.into_iter().map(TokenStream::from).collect::().into(), - }); - result = results.pop().unwrap(); - result.push(tree); - } - tree => result.push(tree), - } - } - result -} - -// These panicking parsing functions are used by the quote_*!() syntax extensions, -// but shouldn't be used otherwise. -pub fn parse_expr_panic(parser: &mut Parser) -> P { - panictry!(parser.parse_expr()) -} - -pub fn parse_item_panic(parser: &mut Parser) -> Option> { - panictry!(parser.parse_item()) -} - -pub fn parse_pat_panic(parser: &mut Parser) -> P { - panictry!(parser.parse_pat(None)) -} - -pub fn parse_arm_panic(parser: &mut Parser) -> Arm { - panictry!(parser.parse_arm()) -} - -pub fn parse_ty_panic(parser: &mut Parser) -> P { - panictry!(parser.parse_ty()) -} - -pub fn parse_stmt_panic(parser: &mut Parser) -> Option { - panictry!(parser.parse_stmt()) -} - -pub fn parse_attribute_panic(parser: &mut Parser, permit_inner: bool) -> ast::Attribute { - panictry!(parser.parse_attribute(permit_inner)) -} - -pub fn parse_arg_panic(parser: &mut Parser) -> Arg { - panictry!(parser.parse_arg()) -} - -pub fn parse_block_panic(parser: &mut Parser) -> P { - panictry!(parser.parse_block()) -} - -pub fn parse_meta_item_panic(parser: &mut Parser) -> ast::MetaItem { - panictry!(parser.parse_meta_item()) -} - -pub fn parse_path_panic(parser: &mut Parser, mode: PathStyle) -> ast::Path { - panictry!(parser.parse_path(mode)) -} - -pub fn expand_quote_tokens<'cx>(cx: &'cx mut ExtCtxt, - sp: Span, - tts: &[TokenTree]) - -> Box { - let (cx_expr, expr) = expand_tts(cx, sp, tts); - let expanded = expand_wrapper(cx, sp, cx_expr, expr, &[&["syntax", "ext", "quote", "rt"]]); - base::MacEager::expr(expanded) -} - -pub fn expand_quote_expr<'cx>(cx: &'cx mut ExtCtxt, - sp: Span, - tts: &[TokenTree]) - -> Box { - let expanded = expand_parse_call(cx, sp, "parse_expr_panic", vec![], tts); - base::MacEager::expr(expanded) -} - -pub fn expand_quote_item<'cx>(cx: &'cx mut ExtCtxt, - sp: Span, - tts: &[TokenTree]) - -> Box { - let expanded = expand_parse_call(cx, sp, "parse_item_panic", vec![], tts); - base::MacEager::expr(expanded) -} - -pub fn expand_quote_pat<'cx>(cx: &'cx mut ExtCtxt, - sp: Span, - tts: &[TokenTree]) - -> Box { - let expanded = expand_parse_call(cx, sp, "parse_pat_panic", vec![], tts); - base::MacEager::expr(expanded) -} - -pub fn expand_quote_arm(cx: &mut ExtCtxt, - sp: Span, - tts: &[TokenTree]) - -> Box { - let expanded = expand_parse_call(cx, sp, "parse_arm_panic", vec![], tts); - base::MacEager::expr(expanded) -} - -pub fn expand_quote_ty(cx: &mut ExtCtxt, - sp: Span, - tts: &[TokenTree]) - -> Box { - let expanded = expand_parse_call(cx, sp, "parse_ty_panic", vec![], tts); - base::MacEager::expr(expanded) -} - -pub fn expand_quote_stmt(cx: &mut ExtCtxt, - sp: Span, - tts: &[TokenTree]) - -> Box { - let expanded = expand_parse_call(cx, sp, "parse_stmt_panic", vec![], tts); - base::MacEager::expr(expanded) -} - -pub fn expand_quote_attr(cx: &mut ExtCtxt, - sp: Span, - tts: &[TokenTree]) - -> Box { - let expanded = expand_parse_call(cx, sp, "parse_attribute_panic", - vec![cx.expr_bool(sp, true)], tts); - - base::MacEager::expr(expanded) -} - -pub fn expand_quote_arg(cx: &mut ExtCtxt, - sp: Span, - tts: &[TokenTree]) - -> Box { - let expanded = expand_parse_call(cx, sp, "parse_arg_panic", vec![], tts); - base::MacEager::expr(expanded) -} - -pub fn expand_quote_block(cx: &mut ExtCtxt, - sp: Span, - tts: &[TokenTree]) - -> Box { - let expanded = expand_parse_call(cx, sp, "parse_block_panic", vec![], tts); - base::MacEager::expr(expanded) -} - -pub fn expand_quote_meta_item(cx: &mut ExtCtxt, - sp: Span, - tts: &[TokenTree]) - -> Box { - let expanded = expand_parse_call(cx, sp, "parse_meta_item_panic", vec![], tts); - base::MacEager::expr(expanded) -} - -pub fn expand_quote_path(cx: &mut ExtCtxt, - sp: Span, - tts: &[TokenTree]) - -> Box { - let mode = mk_parser_path(cx, sp, &["PathStyle", "Type"]); - let expanded = expand_parse_call(cx, sp, "parse_path_panic", vec![mode], tts); - base::MacEager::expr(expanded) -} - -fn ids_ext(strs: Vec) -> Vec { - strs.iter().map(|s| ast::Ident::from_str(s)).collect() -} - -fn id_ext(s: &str) -> ast::Ident { - ast::Ident::from_str(s) -} - -// Lift an ident to the expr that evaluates to that ident. -fn mk_ident(cx: &ExtCtxt, sp: Span, ident: ast::Ident) -> P { - let e_str = cx.expr_str(sp, ident.name); - cx.expr_method_call(sp, - cx.expr_ident(sp, id_ext("ext_cx")), - id_ext("ident_of"), - vec![e_str]) -} - -// Lift a name to the expr that evaluates to that name -fn mk_name(cx: &ExtCtxt, sp: Span, ident: ast::Ident) -> P { - let e_str = cx.expr_str(sp, ident.name); - cx.expr_method_call(sp, - cx.expr_ident(sp, id_ext("ext_cx")), - id_ext("name_of"), - vec![e_str]) -} - -fn mk_tt_path(cx: &ExtCtxt, sp: Span, name: &str) -> P { - let idents = vec![id_ext("syntax"), id_ext("tokenstream"), id_ext("TokenTree"), id_ext(name)]; - cx.expr_path(cx.path_global(sp, idents)) -} - -fn mk_token_path(cx: &ExtCtxt, sp: Span, name: &str) -> P { - let idents = vec![id_ext("syntax"), id_ext("parse"), id_ext("token"), id_ext(name)]; - cx.expr_path(cx.path_global(sp, idents)) -} - -fn mk_parser_path(cx: &ExtCtxt, sp: Span, names: &[&str]) -> P { - let mut idents = vec![id_ext("syntax"), id_ext("parse"), id_ext("parser")]; - idents.extend(names.iter().cloned().map(id_ext)); - cx.expr_path(cx.path_global(sp, idents)) -} - -fn mk_binop(cx: &ExtCtxt, sp: Span, bop: token::BinOpToken) -> P { - let name = match bop { - token::Plus => "Plus", - token::Minus => "Minus", - token::Star => "Star", - token::Slash => "Slash", - token::Percent => "Percent", - token::Caret => "Caret", - token::And => "And", - token::Or => "Or", - token::Shl => "Shl", - token::Shr => "Shr" - }; - mk_token_path(cx, sp, name) -} - -fn mk_delim(cx: &ExtCtxt, sp: Span, delim: token::DelimToken) -> P { - let name = match delim { - token::Paren => "Paren", - token::Bracket => "Bracket", - token::Brace => "Brace", - token::NoDelim => "NoDelim", - }; - mk_token_path(cx, sp, name) -} - -#[allow(non_upper_case_globals)] -fn expr_mk_token(cx: &ExtCtxt, sp: Span, tok: &token::Token) -> P { - macro_rules! mk_lit { - ($name: expr, $suffix: expr, $content: expr $(, $count: expr)*) => {{ - let name = mk_name(cx, sp, ast::Ident::with_empty_ctxt($content)); - let inner = cx.expr_call(sp, mk_token_path(cx, sp, $name), vec![ - name $(, cx.expr_u16(sp, $count))* - ]); - let suffix = match $suffix { - Some(name) => cx.expr_some(sp, mk_name(cx, sp, ast::Ident::with_empty_ctxt(name))), - None => cx.expr_none(sp) - }; - cx.expr_call(sp, mk_token_path(cx, sp, "Literal"), vec![inner, suffix]) - }} - } - - let name = match *tok { - token::BinOp(binop) => { - return cx.expr_call(sp, mk_token_path(cx, sp, "BinOp"), vec![mk_binop(cx, sp, binop)]); - } - token::BinOpEq(binop) => { - return cx.expr_call(sp, mk_token_path(cx, sp, "BinOpEq"), - vec![mk_binop(cx, sp, binop)]); - } - - token::OpenDelim(delim) => { - return cx.expr_call(sp, mk_token_path(cx, sp, "OpenDelim"), - vec![mk_delim(cx, sp, delim)]); - } - token::CloseDelim(delim) => { - return cx.expr_call(sp, mk_token_path(cx, sp, "CloseDelim"), - vec![mk_delim(cx, sp, delim)]); - } - - token::Literal(token::Byte(i), suf) => return mk_lit!("Byte", suf, i), - token::Literal(token::Char(i), suf) => return mk_lit!("Char", suf, i), - token::Literal(token::Integer(i), suf) => return mk_lit!("Integer", suf, i), - token::Literal(token::Float(i), suf) => return mk_lit!("Float", suf, i), - token::Literal(token::Str_(i), suf) => return mk_lit!("Str_", suf, i), - token::Literal(token::StrRaw(i, n), suf) => return mk_lit!("StrRaw", suf, i, n), - token::Literal(token::ByteStr(i), suf) => return mk_lit!("ByteStr", suf, i), - token::Literal(token::ByteStrRaw(i, n), suf) => return mk_lit!("ByteStrRaw", suf, i, n), - - token::Ident(ident, is_raw) => { - return cx.expr_call(sp, - mk_token_path(cx, sp, "Ident"), - vec![mk_ident(cx, sp, ident), cx.expr_bool(sp, is_raw)]); - } - - token::Lifetime(ident) => { - return cx.expr_call(sp, - mk_token_path(cx, sp, "Lifetime"), - vec![mk_ident(cx, sp, ident)]); - } - - token::DocComment(ident) => { - return cx.expr_call(sp, - mk_token_path(cx, sp, "DocComment"), - vec![mk_name(cx, sp, ast::Ident::with_empty_ctxt(ident))]); - } - - token::Interpolated(_) => { - cx.span_err(sp, "quote! with interpolated token"); - // Use dummy name. - "Interpolated" - } - - token::Eq => "Eq", - token::Lt => "Lt", - token::Le => "Le", - token::EqEq => "EqEq", - token::Ne => "Ne", - token::Ge => "Ge", - token::Gt => "Gt", - token::AndAnd => "AndAnd", - token::OrOr => "OrOr", - token::Not => "Not", - token::Tilde => "Tilde", - token::At => "At", - token::Dot => "Dot", - token::DotDot => "DotDot", - token::DotEq => "DotEq", - token::DotDotDot => "DotDotDot", - token::DotDotEq => "DotDotEq", - token::Comma => "Comma", - token::Semi => "Semi", - token::Colon => "Colon", - token::ModSep => "ModSep", - token::RArrow => "RArrow", - token::LArrow => "LArrow", - token::FatArrow => "FatArrow", - token::Pound => "Pound", - token::Dollar => "Dollar", - token::Question => "Question", - token::SingleQuote => "SingleQuote", - token::Eof => "Eof", - - token::Whitespace | token::Comment | token::Shebang(_) => { - panic!("unhandled token in quote!"); - } - }; - mk_token_path(cx, sp, name) -} - -fn statements_mk_tt(cx: &ExtCtxt, tt: &TokenTree, quoted: bool) -> Vec { - match *tt { - TokenTree::Token(sp, token::Ident(ident, _)) if quoted => { - // tt.extend($ident.to_tokens(ext_cx)) - - let e_to_toks = - cx.expr_method_call(sp, - cx.expr_ident(sp, ident), - id_ext("to_tokens"), - vec![cx.expr_ident(sp, id_ext("ext_cx"))]); - let e_to_toks = - cx.expr_method_call(sp, e_to_toks, id_ext("into_iter"), vec![]); - - let e_push = - cx.expr_method_call(sp, - cx.expr_ident(sp, id_ext("tt")), - id_ext("extend"), - vec![e_to_toks]); - - vec![cx.stmt_expr(e_push)] - } - TokenTree::Token(sp, ref tok) => { - let e_sp = cx.expr_ident(sp, id_ext("_sp")); - let e_tok = cx.expr_call(sp, - mk_tt_path(cx, sp, "Token"), - vec![e_sp, expr_mk_token(cx, sp, tok)]); - let e_push = - cx.expr_method_call(sp, - cx.expr_ident(sp, id_ext("tt")), - id_ext("push"), - vec![e_tok]); - vec![cx.stmt_expr(e_push)] - }, - TokenTree::Delimited(span, ref delimed) => { - let mut stmts = statements_mk_tt(cx, &delimed.open_tt(span.open), false); - stmts.extend(statements_mk_tts(cx, delimed.stream())); - stmts.extend(statements_mk_tt(cx, &delimed.close_tt(span.close), false)); - stmts - } - } -} - -fn parse_arguments_to_quote(cx: &ExtCtxt, tts: &[TokenTree]) - -> (P, Vec) { - let mut p = cx.new_parser_from_tts(tts); - - let cx_expr = panictry!(p.parse_expr()); - if !p.eat(&token::Comma) { - let _ = p.diagnostic().fatal("expected token `,`"); - } - - let tts = panictry!(p.parse_all_token_trees()); - p.abort_if_errors(); - - (cx_expr, tts) -} - -fn mk_stmts_let(cx: &ExtCtxt, sp: Span) -> Vec { - // We also bind a single value, sp, to ext_cx.call_site() - // - // This causes every span in a token-tree quote to be attributed to the - // call site of the extension using the quote. We can't really do much - // better since the source of the quote may well be in a library that - // was not even parsed by this compilation run, that the user has no - // source code for (eg. in libsyntax, which they're just _using_). - // - // The old quasiquoter had an elaborate mechanism for denoting input - // file locations from which quotes originated; unfortunately this - // relied on feeding the source string of the quote back into the - // compiler (which we don't really want to do) and, in any case, only - // pushed the problem a very small step further back: an error - // resulting from a parse of the resulting quote is still attributed to - // the site the string literal occurred, which was in a source file - // _other_ than the one the user has control over. For example, an - // error in a quote from the protocol compiler, invoked in user code - // using macro_rules! for example, will be attributed to the macro_rules.rs - // file in libsyntax, which the user might not even have source to (unless - // they happen to have a compiler on hand). Over all, the phase distinction - // just makes quotes "hard to attribute". Possibly this could be fixed - // by recreating some of the original qq machinery in the tt regime - // (pushing fake SourceFiles onto the parser to account for original sites - // of quotes, for example) but at this point it seems not likely to be - // worth the hassle. - - let e_sp = cx.expr_method_call(sp, - cx.expr_ident(sp, id_ext("ext_cx")), - id_ext("call_site"), - Vec::new()); - - let stmt_let_sp = cx.stmt_let(sp, false, - id_ext("_sp"), - e_sp); - - let stmt_let_tt = cx.stmt_let(sp, true, id_ext("tt"), cx.expr_vec_ng(sp)); - - vec![stmt_let_sp, stmt_let_tt] -} - -fn statements_mk_tts(cx: &ExtCtxt, tts: TokenStream) -> Vec { - let mut ss = Vec::new(); - let mut quoted = false; - for tt in tts.into_trees() { - quoted = match tt { - TokenTree::Token(_, token::Dollar) if !quoted => true, - _ => { - ss.extend(statements_mk_tt(cx, &tt, quoted)); - false - } - } - } - ss -} - -fn expand_tts(cx: &ExtCtxt, sp: Span, tts: &[TokenTree]) -> (P, P) { - let (cx_expr, tts) = parse_arguments_to_quote(cx, tts); - - let mut vector = mk_stmts_let(cx, sp); - vector.extend(statements_mk_tts(cx, tts.iter().cloned().collect())); - vector.push(cx.stmt_expr(cx.expr_ident(sp, id_ext("tt")))); - let block = cx.expr_block(cx.block(sp, vector)); - let unflatten = vec![id_ext("syntax"), id_ext("ext"), id_ext("quote"), id_ext("unflatten")]; - - (cx_expr, cx.expr_call_global(sp, unflatten, vec![block])) -} - -fn expand_wrapper(cx: &ExtCtxt, - sp: Span, - cx_expr: P, - expr: P, - imports: &[&[&str]]) -> P { - // Explicitly borrow to avoid moving from the invoker (#16992) - let cx_expr_borrow = cx.expr_addr_of(sp, cx.expr_deref(sp, cx_expr)); - let stmt_let_ext_cx = cx.stmt_let(sp, false, id_ext("ext_cx"), cx_expr_borrow); - - let mut stmts = imports.iter().map(|path| { - // make item: `use ...;` - let path = path.iter().map(|s| s.to_string()).collect(); - let use_item = cx.item_use_glob( - sp, - respan(sp.shrink_to_lo(), ast::VisibilityKind::Inherited), - ids_ext(path), - ); - cx.stmt_item(sp, use_item) - }).chain(Some(stmt_let_ext_cx)).collect::>(); - stmts.push(cx.stmt_expr(expr)); - - cx.expr_block(cx.block(sp, stmts)) -} - -fn expand_parse_call(cx: &ExtCtxt, - sp: Span, - parse_method: &str, - arg_exprs: Vec> , - tts: &[TokenTree]) -> P { - let (cx_expr, tts_expr) = expand_tts(cx, sp, tts); - - let parse_sess_call = || cx.expr_method_call( - sp, cx.expr_ident(sp, id_ext("ext_cx")), - id_ext("parse_sess"), Vec::new()); - - let new_parser_call = - cx.expr_call(sp, - cx.expr_ident(sp, id_ext("new_parser_from_tts")), - vec![parse_sess_call(), tts_expr]); - - let path = vec![id_ext("syntax"), id_ext("ext"), id_ext("quote"), id_ext(parse_method)]; - let mut args = vec![cx.expr_mut_addr_of(sp, new_parser_call)]; - args.extend(arg_exprs); - let expr = cx.expr_call_global(sp, path, args); - - if parse_method == "parse_attribute" { - expand_wrapper(cx, sp, cx_expr, expr, &[&["syntax", "ext", "quote", "rt"], - &["syntax", "parse", "attr"]]) - } else { - expand_wrapper(cx, sp, cx_expr, expr, &[&["syntax", "ext", "quote", "rt"]]) - } -} diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index e1ba8897a47..e63042a4208 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ast; use syntax_pos::{self, Pos, Span, FileName}; use ext::base::*; @@ -21,8 +11,8 @@ use smallvec::SmallVec; use symbol::Symbol; use tokenstream; -use std::fs::File; -use std::io::prelude::*; +use std::fs; +use std::io::ErrorKind; use std::path::PathBuf; use rustc_data_structures::sync::Lrc; @@ -96,7 +86,7 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::T -> Box { let file = match get_single_str_from_tts(cx, sp, tts, "include!") { Some(f) => f, - None => return DummyResult::expr(sp), + None => return DummyResult::any(sp), }; // The file will be added to the code map by the parser let path = res_rel_file(cx, sp, file); @@ -137,18 +127,7 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenT None => return DummyResult::expr(sp) }; let file = res_rel_file(cx, sp, file); - let mut bytes = Vec::new(); - match File::open(&file).and_then(|mut f| f.read_to_end(&mut bytes)) { - Ok(..) => {} - Err(e) => { - cx.span_err(sp, - &format!("couldn't read {}: {}", - file.display(), - e)); - return DummyResult::expr(sp); - } - }; - match String::from_utf8(bytes) { + match fs::read_to_string(&file) { Ok(src) => { let interned_src = Symbol::intern(&src); @@ -157,11 +136,13 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenT cx.source_map().new_source_file(file.into(), src); base::MacEager::expr(cx.expr_str(sp, interned_src)) + }, + Err(ref e) if e.kind() == ErrorKind::InvalidData => { + cx.span_err(sp, &format!("{} wasn't a utf-8 file", file.display())); + DummyResult::expr(sp) } - Err(_) => { - cx.span_err(sp, - &format!("{} wasn't a utf-8 file", - file.display())); + Err(e) => { + cx.span_err(sp, &format!("couldn't read {}: {}", file.display(), e)); DummyResult::expr(sp) } } @@ -174,19 +155,23 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::Toke None => return DummyResult::expr(sp) }; let file = res_rel_file(cx, sp, file); - let mut bytes = Vec::new(); - match File::open(&file).and_then(|mut f| f.read_to_end(&mut bytes)) { - Err(e) => { - cx.span_err(sp, - &format!("couldn't read {}: {}", file.display(), e)); - DummyResult::expr(sp) - } - Ok(..) => { - // Add this input file to the code map to make it available as - // dependency information, but don't enter it's contents - cx.source_map().new_source_file(file.into(), String::new()); + match fs::read(&file) { + Ok(bytes) => { + // Add the contents to the source map if it contains UTF-8. + let (contents, bytes) = match String::from_utf8(bytes) { + Ok(s) => { + let bytes = s.as_bytes().to_owned(); + (s, bytes) + }, + Err(e) => (String::new(), e.into_bytes()), + }; + cx.source_map().new_source_file(file.into(), contents); base::MacEager::expr(cx.expr_lit(sp, ast::LitKind::ByteStr(Lrc::new(bytes)))) + }, + Err(e) => { + cx.span_err(sp, &format!("couldn't read {}: {}", file.display(), e)); + DummyResult::expr(sp) } } } @@ -201,6 +186,7 @@ fn res_rel_file(cx: &mut ExtCtxt, sp: syntax_pos::Span, arg: String) -> PathBuf let callsite = sp.source_callsite(); let mut path = match cx.source_map().span_to_unmapped_path(callsite) { FileName::Real(path) => path, + FileName::DocTest(path, _) => path, other => panic!("cannot resolve relative path in non-file source `{}`", other), }; path.pop(); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index f31d80acbfa..b4003ac729a 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This is an NFA-based parser, which calls out to the main rust parser for named nonterminals //! (which it commits to fully when it hits one in a grammar). There's a set of current NFA threads //! and a set of next ones. Instead of NTs, we have a special case for Kleene star. The big-O, in @@ -171,7 +161,7 @@ struct MatcherPos<'root, 'tt: 'root> { /// The position of the "dot" in this matcher idx: usize, - /// The first span of source source that the beginning of this matcher corresponds to. In other + /// The first span of source that the beginning of this matcher corresponds to. In other /// words, the token in the source whose span is `sp_open` is matched against the first token of /// the matcher. sp_open: Span, @@ -214,10 +204,10 @@ struct MatcherPos<'root, 'tt: 'root> { up: Option>, /// Specifically used to "unzip" token trees. By "unzip", we mean to unwrap the delimiters from - /// a delimited token tree (e.g. something wrapped in `(` `)`) or to get the contents of a doc + /// a delimited token tree (e.g., something wrapped in `(` `)`) or to get the contents of a doc /// comment... /// - /// When matching against matchers with nested delimited submatchers (e.g. `pat ( pat ( .. ) + /// When matching against matchers with nested delimited submatchers (e.g., `pat ( pat ( .. ) /// pat ) pat`), we need to keep track of the matchers we are descending into. This stack does /// that where the bottom of the stack is the outermost matcher. /// Also, throughout the comments, this "descent" is often referred to as "unzipping"... @@ -281,7 +271,7 @@ pub enum ParseResult { Success(T), /// Arm failed to match. If the second parameter is `token::Eof`, it indicates an unexpected /// end of macro invocation. Otherwise, it indicates that no rules expected the given token. - Failure(syntax_pos::Span, Token), + Failure(syntax_pos::Span, Token, &'static str), /// Fatal error (malformed macro?). Abort compilation. Error(syntax_pos::Span, String), } @@ -309,7 +299,7 @@ fn create_matches(len: usize) -> Box<[Rc]> { vec![] } else { let empty_matches = Rc::new(SmallVec::new()); - vec![empty_matches.clone(); len] + vec![empty_matches; len] }.into_boxed_slice() } @@ -373,7 +363,7 @@ fn nameize>( ms: &[TokenTree], mut res: I, ) -> NamedParseResult { - // Recursively descend into each type of matcher (e.g. sequences, delimited, metavars) and make + // Recursively descend into each type of matcher (e.g., sequences, delimited, metavars) and make // sure that each metavar has _exactly one_ binding. If a metavar does not have exactly one // binding, then there is an error. If it does, then we insert the binding into the // `NamedParseResult`. @@ -698,7 +688,7 @@ pub fn parse( parser.span, ) { Success(_) => {} - Failure(sp, tok) => return Failure(sp, tok), + Failure(sp, tok, t) => return Failure(sp, tok, t), Error(sp, msg) => return Error(sp, msg), } @@ -710,7 +700,7 @@ pub fn parse( // Error messages here could be improved with links to original rules. // If we reached the EOF, check that there is EXACTLY ONE possible matcher. Otherwise, - // either the parse is ambiguous (which should never happen) or their is a syntax error. + // either the parse is ambiguous (which should never happen) or there is a syntax error. if token_name_eq(&parser.token, &token::Eof) { if eof_items.len() == 1 { let matches = eof_items[0] @@ -724,7 +714,15 @@ pub fn parse( "ambiguity: multiple successful parses".to_string(), ); } else { - return Failure(parser.span, token::Eof); + return Failure( + if parser.span.is_dummy() { + parser.span + } else { + sess.source_map().next_point(parser.span) + }, + token::Eof, + "missing tokens in macro arguments", + ); } } // Performance hack: eof_items may share matchers via Rc with other things that we want @@ -757,9 +755,13 @@ pub fn parse( ); } // If there are no possible next positions AND we aren't waiting for the black-box parser, - // then their is a syntax error. + // then there is a syntax error. else if bb_items.is_empty() && next_items.is_empty() { - return Failure(parser.span, parser.token); + return Failure( + parser.span, + parser.token, + "no rules expected this token in macro call", + ); } // Dump all possible `next_items` into `cur_items` for the next iteration. else if !next_items.is_empty() { @@ -883,7 +885,7 @@ fn may_begin_with(name: &str, token: &Token) -> bool { /// /// - `p`: the "black-box" parser to use /// - `sp`: the `Span` we want to parse -/// - `name`: the name of the metavar _matcher_ we want to match (e.g. `tt`, `ident`, `block`, +/// - `name`: the name of the metavar _matcher_ we want to match (e.g., `tt`, `ident`, `block`, /// etc...) /// /// # Returns diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 6bba891278a..176575b67ea 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -1,16 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use {ast, attr}; use syntax_pos::{Span, DUMMY_SP}; use edition::Edition; +use errors::FatalError; use ext::base::{DummyResult, ExtCtxt, MacResult, SyntaxExtension}; use ext::base::{NormalTT, TTMacroExpander}; use ext::expand::{AstFragment, AstFragmentKind}; @@ -19,7 +10,7 @@ use ext::tt::macro_parser::{MatchedSeq, MatchedNonterminal}; use ext::tt::macro_parser::{parse, parse_failure_msg}; use ext::tt::quoted; use ext::tt::transcribe::transcribe; -use feature_gate::{self, emit_feature_err, Features, GateIssue}; +use feature_gate::Features; use parse::{Directory, ParseSess}; use parse::parser::Parser; use parse::token::{self, NtTT}; @@ -44,22 +35,41 @@ pub struct ParserAnyMacro<'a> { /// Span of the expansion site of the macro this parser is for site_span: Span, /// The ident of the macro we're parsing - macro_ident: ast::Ident + macro_ident: ast::Ident, + arm_span: Span, } impl<'a> ParserAnyMacro<'a> { pub fn make(mut self: Box>, kind: AstFragmentKind) -> AstFragment { - let ParserAnyMacro { site_span, macro_ident, ref mut parser } = *self; + let ParserAnyMacro { site_span, macro_ident, ref mut parser, arm_span } = *self; let fragment = panictry!(parser.parse_ast_fragment(kind, true).map_err(|mut e| { + if parser.token == token::Eof && e.message().ends_with(", found ``") { + if !e.span.is_dummy() { // early end of macro arm (#52866) + e.replace_span_with(parser.sess.source_map().next_point(parser.span)); + } + let msg = &e.message[0]; + e.message[0] = ( + format!( + "macro expansion ends with an incomplete expression: {}", + msg.0.replace(", found ``", ""), + ), + msg.1, + ); + } if e.span.is_dummy() { // Get around lack of span in error (#30128) - e.set_span(site_span); + e.replace_span_with(site_span); + if parser.sess.source_map().span_to_filename(arm_span).is_real() { + e.span_label(arm_span, "in this macro arm"); + } + } else if !parser.sess.source_map().span_to_filename(parser.span).is_real() { + e.span_label(site_span, "in this macro invocation"); } e })); - // We allow semicolons at the end of expressions -- e.g. the semicolon in + // We allow semicolons at the end of expressions -- e.g., the semicolon in // `macro_rules! m { () => { panic!(); } }` isn't parsed by `.parse_expr()`, - // but `m!()` is allowed in expression positions (c.f. issue #34706). + // but `m!()` is allowed in expression positions (cf. issue #34706). if kind == AstFragmentKind::Expr && parser.token == token::Semi { parser.bump(); } @@ -120,6 +130,7 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt, // Which arm's failure should we report? (the one furthest along) let mut best_fail_spot = DUMMY_SP; let mut best_fail_tok = None; + let mut best_fail_text = None; for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers let lhs_tt = match *lhs { @@ -134,6 +145,7 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt, quoted::TokenTree::Delimited(_, ref delimed) => delimed.tts.clone(), _ => cx.span_bug(sp, "malformed macro rhs"), }; + let arm_span = rhses[i].span(); let rhs_spans = rhs.iter().map(|t| t.span()).collect::>(); // rhs has holes ( `$id` and `$(...)` that need filled) @@ -172,12 +184,14 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt, // so we can print a useful error message if the parse of the expanded // macro leaves unparsed tokens. site_span: sp, - macro_ident: name + macro_ident: name, + arm_span, }) } - Failure(sp, tok) => if sp.lo() >= best_fail_spot.lo() { + Failure(sp, tok, t) => if sp.lo() >= best_fail_spot.lo() { best_fail_spot = sp; best_fail_tok = Some(tok); + best_fail_text = Some(t); }, Error(err_sp, ref msg) => { cx.span_fatal(err_sp.substitute_dummy(sp), &msg[..]) @@ -188,7 +202,7 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt, let best_fail_msg = parse_failure_msg(best_fail_tok.expect("ran no matchers")); let span = best_fail_spot.substitute_dummy(sp); let mut err = cx.struct_span_err(span, &best_fail_msg); - err.span_label(span, best_fail_msg); + err.span_label(span, best_fail_text.unwrap_or(&best_fail_msg)); if let Some(sp) = def_span { if cx.source_map().span_to_filename(sp).is_real() && !sp.is_dummy() { err.span_label(cx.source_map().def_span(sp), "when calling this macro"); @@ -207,7 +221,7 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt, if comma_span.is_dummy() { err.note("you might be missing a comma"); } else { - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( comma_span, "missing comma here", ", ".to_string(), @@ -268,9 +282,13 @@ pub fn compile(sess: &ParseSess, features: &Features, def: &ast::Item, edition: let argument_map = match parse(sess, body.stream(), &argument_gram, None, true) { Success(m) => m, - Failure(sp, tok) => { + Failure(sp, tok, t) => { let s = parse_failure_msg(tok); - sess.span_diagnostic.span_fatal(sp.substitute_dummy(def.span), &s).raise(); + let sp = sp.substitute_dummy(def.span); + let mut err = sess.span_diagnostic.struct_span_fatal(sp, &s); + err.span_label(sp, t); + err.emit(); + FatalError.raise(); } Error(sp, s) => { sess.span_diagnostic.span_fatal(sp.substitute_dummy(def.span), &s).raise(); @@ -417,7 +435,8 @@ fn check_lhs_no_empty_seq(sess: &ParseSess, tts: &[quoted::TokenTree]) -> bool { match *seq_tt { TokenTree::MetaVarDecl(_, _, id) => id.name == "vis", TokenTree::Sequence(_, ref sub_seq) => - sub_seq.op == quoted::KleeneOp::ZeroOrMore, + sub_seq.op == quoted::KleeneOp::ZeroOrMore + || sub_seq.op == quoted::KleeneOp::ZeroOrOne, _ => false, } }) { @@ -454,15 +473,15 @@ fn check_matcher(sess: &ParseSess, err == sess.span_diagnostic.err_count() } -// The FirstSets for a matcher is a mapping from subsequences in the +// `The FirstSets` for a matcher is a mapping from subsequences in the // matcher to the FIRST set for that subsequence. // // This mapping is partially precomputed via a backwards scan over the // token trees of the matcher, which provides a mapping from each -// repetition sequence to its FIRST set. +// repetition sequence to its *first* set. // -// (Hypothetically sequences should be uniquely identifiable via their -// spans, though perhaps that is false e.g. for macro-generated macros +// (Hypothetically, sequences should be uniquely identifiable via their +// spans, though perhaps that is false, e.g., for macro-generated macros // that do not try to inject artificial span information. My plan is // to try to catch such cases ahead of time and not include them in // the precomputed mapping.) @@ -525,7 +544,10 @@ impl FirstSets { } // Reverse scan: Sequence comes before `first`. - if subfirst.maybe_empty || seq_rep.op == quoted::KleeneOp::ZeroOrMore { + if subfirst.maybe_empty + || seq_rep.op == quoted::KleeneOp::ZeroOrMore + || seq_rep.op == quoted::KleeneOp::ZeroOrOne + { // If sequence is potentially empty, then // union them (preserving first emptiness). first.add_all(&TokenSet { maybe_empty: true, ..subfirst }); @@ -573,8 +595,10 @@ impl FirstSets { assert!(first.maybe_empty); first.add_all(subfirst); - if subfirst.maybe_empty || - seq_rep.op == quoted::KleeneOp::ZeroOrMore { + if subfirst.maybe_empty + || seq_rep.op == quoted::KleeneOp::ZeroOrMore + || seq_rep.op == quoted::KleeneOp::ZeroOrOne + { // continue scanning for more first // tokens, but also make sure we // restore empty-tracking state @@ -1027,26 +1051,21 @@ fn has_legal_fragment_specifier(sess: &ParseSess, Ok(()) } -fn is_legal_fragment_specifier(sess: &ParseSess, - features: &Features, - attrs: &[ast::Attribute], +fn is_legal_fragment_specifier(_sess: &ParseSess, + _features: &Features, + _attrs: &[ast::Attribute], frag_name: &str, - frag_span: Span) -> bool { + _frag_span: Span) -> bool { + /* + * If new fragment specifiers are invented in nightly, `_sess`, + * `_features`, `_attrs`, and `_frag_span` will be useful here + * for checking against feature gates. See past versions of + * this function. + */ match frag_name { "item" | "block" | "stmt" | "expr" | "pat" | "lifetime" | - "path" | "ty" | "ident" | "meta" | "tt" | "vis" | "" => true, - "literal" => { - if !features.macro_literal_matcher && - !attr::contains_name(attrs, "allow_internal_unstable") { - let explain = feature_gate::EXPLAIN_LITERAL_MATCHER; - emit_feature_err(sess, - "macro_literal_matcher", - frag_span, - GateIssue::Language, - explain); - } - true - }, + "path" | "ty" | "ident" | "meta" | "tt" | "vis" | "literal" | + "" => true, _ => false, } } diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs index 21848674831..b56871a1885 100644 --- a/src/libsyntax/ext/tt/quoted.rs +++ b/src/libsyntax/ext/tt/quoted.rs @@ -1,23 +1,13 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ast::NodeId; use early_buffered_lints::BufferedEarlyLintId; use ext::tt::macro_parser; -use feature_gate::{self, emit_feature_err, Features, GateIssue}; +use feature_gate::Features; use parse::{token, ParseSess}; use print::pprust; use symbol::keywords; use syntax_pos::{edition::Edition, BytePos, Span}; use tokenstream::{self, DelimSpan}; -use {ast, attr}; +use ast; use rustc_data_structures::sync::Lrc; use std::iter::Peekable; @@ -93,9 +83,9 @@ pub enum TokenTree { Delimited(DelimSpan, Lrc), /// A kleene-style repetition sequence Sequence(DelimSpan, Lrc), - /// E.g. `$var` + /// e.g., `$var` MetaVar(Span, ast::Ident), - /// E.g. `$var:expr`. This is only used in the left hand side of MBE macros. + /// e.g., `$var:expr`. This is only used in the left hand side of MBE macros. MetaVarDecl( Span, ast::Ident, /* name to bind */ @@ -199,7 +189,7 @@ pub fn parse( let mut trees = input.trees().peekable(); while let Some(tree) = trees.next() { // Given the parsed tree, if there is a metavar and we are expecting matchers, actually - // parse out the matcher (i.e. in `$id:ident` this would parse the `:` and `ident`). + // parse out the matcher (i.e., in `$id:ident` this would parse the `:` and `ident`). let tree = parse_tree( tree, &mut trees, @@ -281,16 +271,16 @@ where tokenstream::TokenTree::Token(span, token::Dollar) => match trees.next() { // `tree` is followed by a delimited set of token trees. This indicates the beginning // of a repetition sequence in the macro (e.g. `$(pat)*`). - Some(tokenstream::TokenTree::Delimited(span, delimited)) => { + Some(tokenstream::TokenTree::Delimited(span, delim, tts)) => { // Must have `(` not `{` or `[` - if delimited.delim != token::Paren { - let tok = pprust::token_to_string(&token::OpenDelim(delimited.delim)); + if delim != token::Paren { + let tok = pprust::token_to_string(&token::OpenDelim(delim)); let msg = format!("expected `(`, found `{}`", tok); sess.span_diagnostic.span_err(span.entire(), &msg); } // Parse the contents of the sequence itself let sequence = parse( - delimited.tts.into(), + tts.into(), expect_matchers, sess, features, @@ -309,7 +299,7 @@ where edition, macro_node_id, ); - // Count the number of captured "names" (i.e. named metavars) + // Count the number of captured "names" (i.e., named metavars) let name_captures = macro_parser::count_names(&sequence); TokenTree::Sequence( span, @@ -352,14 +342,14 @@ where // `tree` is an arbitrary token. Keep it. tokenstream::TokenTree::Token(span, tok) => TokenTree::Token(span, tok), - // `tree` is the beginning of a delimited set of tokens (e.g. `(` or `{`). We need to + // `tree` is the beginning of a delimited set of tokens (e.g., `(` or `{`). We need to // descend into the delimited set and further parse it. - tokenstream::TokenTree::Delimited(span, delimited) => TokenTree::Delimited( + tokenstream::TokenTree::Delimited(span, delim, tts) => TokenTree::Delimited( span, Lrc::new(Delimited { - delim: delimited.delim, + delim: delim, tts: parse( - delimited.tts.into(), + tts.into(), expect_matchers, sess, features, @@ -444,7 +434,6 @@ where macro_node_id, ), Edition::Edition2018 => parse_sep_and_kleene_op_2018(input, span, sess, features, attrs), - _ => unimplemented!(), } } @@ -566,8 +555,8 @@ fn parse_sep_and_kleene_op_2018( input: &mut Peekable, span: Span, sess: &ParseSess, - features: &Features, - attrs: &[ast::Attribute], + _features: &Features, + _attrs: &[ast::Attribute], ) -> (Option, KleeneOp) where I: Iterator, @@ -575,23 +564,8 @@ where // We basically look at two token trees here, denoted as #1 and #2 below let span = match parse_kleene_op(input, span) { // #1 is a `?` (needs feature gate) - Ok(Ok((op, op1_span))) if op == KleeneOp::ZeroOrOne => { - if !features.macro_at_most_once_rep - && !attr::contains_name(attrs, "allow_internal_unstable") - { - let explain = feature_gate::EXPLAIN_MACRO_AT_MOST_ONCE_REP; - emit_feature_err( - sess, - "macro_at_most_once_rep", - op1_span, - GateIssue::Language, - explain, - ); - - op1_span - } else { - return (None, op); - } + Ok(Ok((op, _op1_span))) if op == KleeneOp::ZeroOrOne => { + return (None, op); } // #1 is a `+` or `*` KleeneOp @@ -600,24 +574,12 @@ where // #1 is a separator followed by #2, a KleeneOp Ok(Err((tok, span))) => match parse_kleene_op(input, span) { // #2 is the `?` Kleene op, which does not take a separator (error) - Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => { + Ok(Ok((op, _op2_span))) if op == KleeneOp::ZeroOrOne => { // Error! - - if !features.macro_at_most_once_rep - && !attr::contains_name(attrs, "allow_internal_unstable") - { - // FIXME: when `?` as a Kleene op is stabilized, we only need the "does not - // take a macro separator" error (i.e. the `else` case). - sess.span_diagnostic - .struct_span_err(op2_span, "expected `*` or `+`") - .note("`?` is not a macro repetition operator") - .emit(); - } else { - sess.span_diagnostic.span_err( - span, - "the `?` macro repetition operator does not take a separator", - ); - } + sess.span_diagnostic.span_err( + span, + "the `?` macro repetition operator does not take a separator", + ); // Return a dummy return (None, KleeneOp::ZeroOrMore); @@ -638,13 +600,8 @@ where }; // If we ever get to this point, we have experienced an "unexpected token" error - - if !features.macro_at_most_once_rep && !attr::contains_name(attrs, "allow_internal_unstable") { - sess.span_diagnostic.span_err(span, "expected `*` or `+`"); - } else { - sess.span_diagnostic - .span_err(span, "expected one of: `*`, `+`, or `?`"); - } + sess.span_diagnostic + .span_err(span, "expected one of: `*`, `+`, or `?`"); // Return a dummy (None, KleeneOp::ZeroOrMore) diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 3d897d17e0b..0ef2d3b749d 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ast::Ident; use ext::base::ExtCtxt; use ext::expand::Marker; @@ -17,7 +7,7 @@ use fold::noop_fold_tt; use parse::token::{self, Token, NtTT}; use smallvec::SmallVec; use syntax_pos::DUMMY_SP; -use tokenstream::{TokenStream, TokenTree, Delimited, DelimSpan}; +use tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndJoint}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; @@ -73,7 +63,7 @@ pub fn transcribe(cx: &ExtCtxt, let mut stack: SmallVec<[Frame; 1]> = smallvec![Frame::new(src)]; let interpolations = interp.unwrap_or_else(FxHashMap::default); /* just a convenience */ let mut repeats = Vec::new(); - let mut result: Vec = Vec::new(); + let mut result: Vec = Vec::new(); let mut result_stack = Vec::new(); loop { @@ -88,7 +78,7 @@ pub fn transcribe(cx: &ExtCtxt, if let Some(sep) = sep.clone() { // repeat same span, I guess let prev_span = match result.last() { - Some(stream) => stream.trees().next().unwrap().span(), + Some((tt, _)) => tt.span(), None => DUMMY_SP, }; result.push(TokenTree::Token(prev_span, sep).into()); @@ -103,12 +93,13 @@ pub fn transcribe(cx: &ExtCtxt, } Frame::Delimited { forest, span, .. } => { if result_stack.is_empty() { - return TokenStream::concat(result); + return TokenStream::new(result); } - let tree = TokenTree::Delimited(span, Delimited { - delim: forest.delim, - tts: TokenStream::concat(result).into(), - }); + let tree = TokenTree::Delimited( + span, + forest.delim, + TokenStream::new(result).into(), + ); result = result_stack.pop().unwrap(); result.push(tree.into()); } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index b918c81dda6..847b1ad2d7c 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1,14 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Feature gating +//! # Feature gating //! //! This module implements the gating necessary for preventing certain compiler //! features from being used by default. This module will crawl a pre-expanded @@ -29,15 +19,16 @@ use rustc_data_structures::fx::FxHashMap; use rustc_target::spec::abi::Abi; use ast::{self, NodeId, PatKind, RangeEnd}; use attr; +use early_buffered_lints::BufferedEarlyLintId; use source_map::Spanned; use edition::{ALL_EDITIONS, Edition}; use syntax_pos::{Span, DUMMY_SP}; use errors::{DiagnosticBuilder, Handler}; use visit::{self, FnKind, Visitor}; use parse::ParseSess; -use symbol::{keywords, Symbol}; +use symbol::Symbol; -use std::{env}; +use std::env; macro_rules! set { ($field: ident) => {{ @@ -53,8 +44,7 @@ macro_rules! declare_features { /// Represents active features that are currently being implemented or /// currently being considered for addition/removal. const ACTIVE_FEATURES: - &'static [(&'static str, &'static str, Option, - Option, fn(&mut Features, Span))] = + &[(&str, &str, Option, Option, fn(&mut Features, Span))] = &[$((stringify!($feature), $ver, $issue, $edition, set!($feature))),+]; /// A set of features to be used by later passes. @@ -106,7 +96,7 @@ macro_rules! declare_features { } } -// If you change this, please modify src/doc/unstable-book as well. +// If you change this, please modify `src/doc/unstable-book` as well. // // Don't ever remove anything from this list; set them to 'Removed'. // @@ -114,7 +104,7 @@ macro_rules! declare_features { // was set. This is most important for knowing when a particular feature became // stable (active). // -// NB: tools/tidy/src/features.rs parses this information directly out of the +// N.B., `tools/tidy/src/features.rs` parses this information directly out of the // source, so take care when modifying it. declare_features! ( @@ -122,7 +112,7 @@ declare_features! ( (active, concat_idents, "1.0.0", Some(29599), None), (active, link_args, "1.0.0", Some(29596), None), (active, log_syntax, "1.0.0", Some(29598), None), - (active, non_ascii_idents, "1.0.0", Some(28979), None), + (active, non_ascii_idents, "1.0.0", Some(55467), None), (active, plugin_registrar, "1.0.0", Some(29597), None), (active, thread_local, "1.0.0", Some(29594), None), (active, trace_macros, "1.0.0", Some(29598), None), @@ -134,7 +124,6 @@ declare_features! ( (active, link_llvm_intrinsics, "1.0.0", Some(29602), None), (active, linkage, "1.0.0", Some(29603), None), - (active, quote, "1.0.0", Some(29601), None), // rustc internal (active, rustc_diagnostic_macros, "1.0.0", None, None), @@ -153,66 +142,58 @@ declare_features! ( (active, panic_runtime, "1.10.0", Some(32837), None), (active, needs_panic_runtime, "1.10.0", Some(32837), None), - // OIBIT specific features + // Features specific to OIBIT (auto traits) (active, optin_builtin_traits, "1.0.0", Some(13231), None), - // Allows use of #[staged_api] + // Allows `#[staged_api]`. // // rustc internal (active, staged_api, "1.0.0", None, None), - // Allows using #![no_core] + // Allows `#![no_core]`. (active, no_core, "1.3.0", Some(29639), None), - // Allows using `box` in patterns; RFC 469 + // Allows the use of `box` in patterns (RFC 469). (active, box_patterns, "1.0.0", Some(29641), None), - // Allows using the unsafe_destructor_blind_to_params attribute; - // RFC 1238 + // Allows the use of the `unsafe_destructor_blind_to_params` attribute (RFC 1238). (active, dropck_parametricity, "1.3.0", Some(28498), None), - // Allows using the may_dangle attribute; RFC 1327 + // Allows using the `may_dangle` attribute (RFC 1327). (active, dropck_eyepatch, "1.10.0", Some(34761), None), - // Allows the use of custom attributes; RFC 572 + // Allows the use of custom attributes (RFC 572). (active, custom_attribute, "1.0.0", Some(29642), None), - // Allows the use of #[derive(Anything)] as sugar for - // #[derive_Anything]. - (active, custom_derive, "1.0.0", Some(29644), None), - - // Allows the use of rustc_* attributes; RFC 572 + // Allows the use of `rustc_*` attributes (RFC 572). (active, rustc_attrs, "1.0.0", Some(29642), None), - // Allows the use of non lexical lifetimes; RFC 2094 + // Allows the use of non lexical lifetimes (RFC 2094). (active, nll, "1.0.0", Some(43234), None), - // Allows the use of #[allow_internal_unstable]. This is an - // attribute on macro_rules! and can't use the attribute handling + // Allows the use of `#[allow_internal_unstable]`. This is an + // attribute on `macro_rules!` and can't use the attribute handling // below (it has to be checked before expansion possibly makes // macros disappear). // // rustc internal (active, allow_internal_unstable, "1.0.0", None, None), - // Allows the use of #[allow_internal_unsafe]. This is an - // attribute on macro_rules! and can't use the attribute handling + // Allows the use of `#[allow_internal_unsafe]`. This is an + // attribute on `macro_rules!` and can't use the attribute handling // below (it has to be checked before expansion possibly makes // macros disappear). // // rustc internal (active, allow_internal_unsafe, "1.0.0", None, None), - // #23121. Array patterns have some hazards yet. + // Allows the use of slice patterns (issue #23121). (active, slice_patterns, "1.0.0", Some(23121), None), - // Allows the definition of `const fn` functions with some advanced features. - (active, const_fn, "1.2.0", Some(24111), None), + // Allows the definition of `const` functions with some advanced features. + (active, const_fn, "1.2.0", Some(57563), None), - // Allows let bindings and destructuring in `const fn` functions and constants. - (active, const_let, "1.22.1", Some(48821), None), - - // Allows accessing fields of unions inside const fn. + // Allows accessing fields of unions inside `const` functions. (active, const_fn_union, "1.27.0", Some(51909), None), // Allows casting raw pointers to `usize` during const eval. @@ -227,10 +208,10 @@ declare_features! ( // Allows comparing raw pointers during const eval. (active, const_compare_raw_pointers, "1.27.0", Some(53020), None), - // Allows panicking during const eval (produces compile-time errors) + // Allows panicking during const eval (producing compile-time errors). (active, const_panic, "1.30.0", Some(51999), None), - // Allows using #[prelude_import] on glob `use` items. + // Allows using `#[prelude_import]` on glob `use` items. // // rustc internal (active, prelude_import, "1.2.0", None, None), @@ -238,117 +219,118 @@ declare_features! ( // Allows default type parameters to influence type inference. (active, default_type_parameter_fallback, "1.3.0", Some(27336), None), - // Allows associated type defaults + // Allows associated type defaults. (active, associated_type_defaults, "1.2.0", Some(29661), None), - // Allows `repr(simd)`, and importing the various simd intrinsics + // Allows `repr(simd)` and importing the various simd intrinsics. (active, repr_simd, "1.4.0", Some(27731), None), - // Allows `extern "platform-intrinsic" { ... }` + // Allows `extern "platform-intrinsic" { ... }`. (active, platform_intrinsics, "1.4.0", Some(27731), None), - // Allows `#[unwind(..)]` + // Allows `#[unwind(..)]`. + // // rustc internal for rust runtime (active, unwind_attributes, "1.4.0", None, None), // Allows the use of `#[naked]` on functions. (active, naked_functions, "1.9.0", Some(32408), None), - // Allows `#[no_debug]` + // Allows `#[no_debug]`. (active, no_debug, "1.5.0", Some(29721), None), - // Allows `#[omit_gdb_pretty_printer_section]` + // Allows `#[omit_gdb_pretty_printer_section]`. // // rustc internal (active, omit_gdb_pretty_printer_section, "1.5.0", None, None), - // Allows cfg(target_vendor = "..."). - (active, cfg_target_vendor, "1.5.0", Some(29718), None), - - // Allow attributes on expressions and non-item statements + // Allows attributes on expressions and non-item statements. (active, stmt_expr_attributes, "1.6.0", Some(15701), None), - // allow using type ascription in expressions + // Allows the use of type ascription in expressions. (active, type_ascription, "1.6.0", Some(23416), None), - // Allows cfg(target_thread_local) + // Allows `cfg(target_thread_local)`. (active, cfg_target_thread_local, "1.7.0", Some(29594), None), // rustc internal (active, abi_vectorcall, "1.7.0", None, None), - // X..Y patterns + // Allows `X..Y` patterns. (active, exclusive_range_pattern, "1.11.0", Some(37854), None), // impl specialization (RFC 1210) (active, specialization, "1.7.0", Some(31844), None), - // Allows cfg(target_has_atomic = "..."). + // Allows `cfg(target_has_atomic = "...")`. (active, cfg_target_has_atomic, "1.9.0", Some(32976), None), - // The `!` type. Does not imply exhaustive_patterns (below) any more. + // The `!` type. Does not imply 'exhaustive_patterns' (below) any more. (active, never_type, "1.13.0", Some(35121), None), - // Allows exhaustive pattern matching on types that contain uninhabited types + // Allows exhaustive pattern matching on types that contain uninhabited types. (active, exhaustive_patterns, "1.13.0", Some(51085), None), - // Allows untagged unions `union U { ... }` + // Allows untagged unions `union U { ... }`. (active, untagged_unions, "1.13.0", Some(32836), None), - // Used to identify the `compiler_builtins` crate - // rustc internal + // Used to identify the `compiler_builtins` crate. + // + // rustc internal. (active, compiler_builtins, "1.13.0", None, None), - // Allows #[link(..., cfg(..))] + // Allows `#[link(..., cfg(..))]`. (active, link_cfg, "1.14.0", Some(37406), None), - // `extern "ptx-*" fn()` + // Allows `extern "ptx-*" fn()`. (active, abi_ptx, "1.15.0", Some(38788), None), - // The `repr(i128)` annotation for enums + // The `repr(i128)` annotation for enums. (active, repr128, "1.16.0", Some(35118), None), - // The `unadjusted` ABI. Perma unstable. + // The `unadjusted` ABI; perma-unstable. + // // rustc internal (active, abi_unadjusted, "1.16.0", None, None), // Declarative macros 2.0 (`macro`). (active, decl_macro, "1.17.0", Some(39412), None), - // Allows #[link(kind="static-nobundle"...)] + // Allows `#[link(kind="static-nobundle"...)]`. (active, static_nobundle, "1.16.0", Some(37403), None), - // `extern "msp430-interrupt" fn()` + // Allows `extern "msp430-interrupt" fn()`. (active, abi_msp430_interrupt, "1.16.0", Some(38487), None), - // Used to identify crates that contain sanitizer runtimes + // Used to identify crates that contain sanitizer runtimes. + // // rustc internal (active, sanitizer_runtime, "1.17.0", None, None), - // Used to identify crates that contain the profiler runtime + // Used to identify crates that contain the profiler runtime. // // rustc internal (active, profiler_runtime, "1.18.0", None, None), - // `extern "x86-interrupt" fn()` + // Allows `extern "x86-interrupt" fn()`. (active, abi_x86_interrupt, "1.17.0", Some(40180), None), - // Allows the `try {...}` expression + // Allows the `try {...}` expression. (active, try_blocks, "1.29.0", Some(31436), None), - // Allows module-level inline assembly by way of global_asm!() + // Allows module-level inline assembly by way of `global_asm!()`. (active, global_asm, "1.18.0", Some(35119), None), - // Allows overlapping impls of marker traits + // Allows overlapping impls of marker traits. (active, overlapping_marker_traits, "1.18.0", Some(29864), None), - // Trait attribute to allow overlapping impls + // Trait attribute to allow overlapping impls. (active, marker_trait_attr, "1.30.0", Some(29864), None), // rustc internal (active, abi_thiscall, "1.19.0", None, None), - // Allows a test to fail without failing the whole suite + // Allows a test to fail without failing the whole suite. (active, allow_fail, "1.19.0", Some(46488), None), // Allows unsized tuple coercion. @@ -363,58 +345,43 @@ declare_features! ( // rustc internal (active, allocator_internals, "1.20.0", None, None), - // #[doc(cfg(...))] + // `#[doc(cfg(...))]` (active, doc_cfg, "1.21.0", Some(43781), None), - // #[doc(masked)] + // `#[doc(masked)]` (active, doc_masked, "1.21.0", Some(44027), None), - // #[doc(spotlight)] + // `#[doc(spotlight)]` (active, doc_spotlight, "1.22.0", Some(45040), None), - // #[doc(include="some-file")] + // `#[doc(include = "some-file")]` (active, external_doc, "1.22.0", Some(44732), None), - // Future-proofing enums/structs with #[non_exhaustive] attribute (RFC 2008) + // Future-proofing enums/structs with `#[non_exhaustive]` attribute (RFC 2008). (active, non_exhaustive, "1.22.0", Some(44109), None), - // `crate` as visibility modifier, synonymous to `pub(crate)` + // Adds `crate` as visibility modifier, synonymous with `pub(crate)`. (active, crate_visibility_modifier, "1.23.0", Some(53120), None), // extern types (active, extern_types, "1.23.0", Some(43467), None), - // Allows trait methods with arbitrary self types + // Allows trait methods with arbitrary self types. (active, arbitrary_self_types, "1.23.0", Some(44874), None), - // In-band lifetime bindings (e.g. `fn foo(x: &'a u8) -> &'a u8`) + // In-band lifetime bindings (e.g., `fn foo(x: &'a u8) -> &'a u8`). (active, in_band_lifetimes, "1.23.0", Some(44524), None), // Generic associated types (RFC 1598) (active, generic_associated_types, "1.23.0", Some(44265), None), - // `extern` in paths - (active, extern_in_paths, "1.23.0", Some(55600), None), - - // Use `?` as the Kleene "at most one" operator - (active, macro_at_most_once_rep, "1.25.0", Some(48075), None), - - // Infer static outlives requirements; RFC 2093 + // Infer static outlives requirements (RFC 2093). (active, infer_static_outlives_requirements, "1.26.0", Some(54185), None), - // Multiple patterns with `|` in `if let` and `while let` - (active, if_while_or_patterns, "1.26.0", Some(48215), None), - - // Allows `#[repr(packed)]` attribute on structs - (active, repr_packed, "1.26.0", Some(33158), None), - - // `use path as _;` and `extern crate c as _;` - (active, underscore_imports, "1.26.0", Some(48216), None), - - // Allows macro invocations in `extern {}` blocks + // Allows macro invocations in `extern {}` blocks. (active, macros_in_extern, "1.27.0", Some(49476), None), // `existential type` (active, existential_type, "1.28.0", Some(34511), None), - // unstable #[target_feature] directives + // unstable `#[target_feature]` directives (active, arm_target_feature, "1.27.0", Some(44839), None), (active, aarch64_target_feature, "1.27.0", Some(44839), None), (active, hexagon_target_feature, "1.27.0", Some(44839), None), @@ -425,88 +392,82 @@ declare_features! ( (active, sse4a_target_feature, "1.27.0", Some(44839), None), (active, tbm_target_feature, "1.27.0", Some(44839), None), (active, wasm_target_feature, "1.30.0", Some(44839), None), + (active, adx_target_feature, "1.32.0", Some(44839), None), + (active, cmpxchg16b_target_feature, "1.32.0", Some(44839), None), + (active, movbe_target_feature, "1.34.0", Some(44839), None), // Allows macro invocations on modules expressions and statements and // procedural macros to expand to non-items. (active, proc_macro_hygiene, "1.30.0", Some(54727), None), - // #[doc(alias = "...")] + // `#[doc(alias = "...")]` (active, doc_alias, "1.27.0", Some(50146), None), - // Allows irrefutable patterns in if-let and while-let statements (RFC 2086) - (active, irrefutable_let_patterns, "1.27.0", Some(44495), None), - - // Allows use of the :literal macro fragment specifier (RFC 1576) - (active, macro_literal_matcher, "1.27.0", Some(35625), None), - // inconsistent bounds in where clauses (active, trivial_bounds, "1.28.0", Some(48214), None), - // 'a: { break 'a; } + // `'a: { break 'a; }` (active, label_break_value, "1.28.0", Some(48594), None), - // Integer match exhaustiveness checking - (active, exhaustive_integer_patterns, "1.30.0", Some(50907), None), + // Exhaustive pattern matching on `usize` and `isize`. + (active, precise_pointer_size_matching, "1.32.0", Some(56354), None), - // #[doc(keyword = "...")] + // `#[doc(keyword = "...")]` (active, doc_keyword, "1.28.0", Some(51315), None), - // Allows async and await syntax + // Allows async and await syntax. (active, async_await, "1.28.0", Some(50547), None), - // #[alloc_error_handler] + // `#[alloc_error_handler]` (active, alloc_error_handler, "1.29.0", Some(51540), None), (active, abi_amdgpu_kernel, "1.29.0", Some(51575), None), - // Perma-unstable; added for testing E0705 + // Added for testing E0705; perma-unstable. (active, test_2018_feature, "1.31.0", Some(0), Some(Edition::Edition2018)), - // Support for arbitrary delimited token streams in non-macro attributes + // support for arbitrary delimited token streams in non-macro attributes (active, unrestricted_attribute_tokens, "1.30.0", Some(55208), None), - // Allows `use x::y;` to resolve through `self::x`, not just `::x` - (active, uniform_paths, "1.30.0", Some(53130), None), - - // Allows `Self` in type definitions - (active, self_in_typedefs, "1.30.0", Some(49303), None), - - // Allows unsized rvalues at arguments and parameters + // Allows unsized rvalues at arguments and parameters. (active, unsized_locals, "1.30.0", Some(48055), None), - // #![test_runner] - // #[test_case] + // `#![test_runner]` + // `#[test_case]` (active, custom_test_frameworks, "1.30.0", Some(50297), None), - // Non-builtin attributes in inner attribute position + // non-builtin attributes in inner attribute position (active, custom_inner_attributes, "1.30.0", Some(54726), None), - // Self struct constructor (RFC 2302) - (active, self_struct_ctor, "1.30.0", Some(51994), None), - - // allow mixing of bind-by-move in patterns and references to + // Allow mixing of bind-by-move in patterns and references to // those identifiers in guards, *if* we are using MIR-borrowck - // (aka NLL). Essentially this means you need to be on - // edition:2018 or later. + // (aka NLL). Essentially this means you need to be using the + // 2018 edition or later. (active, bind_by_move_pattern_guards, "1.30.0", Some(15287), None), - // Allows `impl Trait` in bindings (`let`, `const`, `static`) + // Allows `impl Trait` in bindings (`let`, `const`, `static`). (active, impl_trait_in_bindings, "1.30.0", Some(34511), None), - // #[cfg_attr(predicate, multiple, attributes, here)] - (active, cfg_attr_multi, "1.31.0", Some(54881), None), - - // Allows `const _: TYPE = VALUE` + // Allows `const _: TYPE = VALUE`. (active, underscore_const_names, "1.31.0", Some(54912), None), - // `reason = ` in lint attributes and `expect` lint attribute + // Adds `reason` and `expect` lint attributes. (active, lint_reasons, "1.31.0", Some(54503), None), + + // Allows paths to enum variants on type aliases. + (active, type_alias_enum_variants, "1.31.0", Some(49683), None), + + // Re-Rebalance coherence + (active, re_rebalance_coherence, "1.32.0", Some(55437), None), + + // #[optimize(X)] + (active, optimize_attribute, "1.34.0", Some(54882), None), ); declare_features! ( (removed, import_shadowing, "1.0.0", None, None, None), (removed, managed_boxes, "1.0.0", None, None, None), - // Allows use of unary negate on unsigned integers, e.g. -e for e: u8 + // Allows use of unary negate on unsigned integers, e.g., -e for e: u8 (removed, negate_unsigned, "1.0.0", Some(29645), None, None), (removed, reflect, "1.0.0", Some(27749), None, None), // A way to temporarily opt out of opt in copy. This will *never* be accepted. @@ -537,6 +498,13 @@ declare_features! ( Some("subsumed by `#![feature(proc_macro_hygiene)]`")), (removed, panic_implementation, "1.28.0", Some(44489), None, Some("subsumed by `#[panic_handler]`")), + // Allows the use of `#[derive(Anything)]` as sugar for `#[derive_Anything]`. + (removed, custom_derive, "1.0.0", Some(29644), None, + Some("subsumed by `#[proc_macro_derive]`")), + // Paths of the form: `extern::foo::bar` + (removed, extern_in_paths, "1.33.0", Some(55600), None, + Some("subsumed by `::foo::bar` paths")), + (removed, quote, "1.0.0", Some(29601), None, None), ); declare_features! ( @@ -545,9 +513,9 @@ declare_features! ( declare_features! ( (accepted, associated_types, "1.0.0", None, None), - // allow overloading augmented assignment operations like `a += b` + // Allows overloading augmented assignment operations like `a += b`. (accepted, augmented_assignments, "1.8.0", Some(28235), None), - // allow empty structs and enum variants with braces + // Allows empty structs and enum variants with braces. (accepted, braced_empty_structs, "1.8.0", Some(29720), None), // Allows indexing into constant arrays. (accepted, const_indexing, "1.26.0", Some(29947), None), @@ -558,69 +526,68 @@ declare_features! ( // to bootstrap fix for #5723. (accepted, issue_5723_bootstrap, "1.0.0", None, None), (accepted, macro_rules, "1.0.0", None, None), - // Allows using #![no_std] + // Allows using `#![no_std]`. (accepted, no_std, "1.6.0", None, None), (accepted, slicing_syntax, "1.0.0", None, None), (accepted, struct_variant, "1.0.0", None, None), // These are used to test this portion of the compiler, they don't actually - // mean anything + // mean anything. (accepted, test_accepted_feature, "1.0.0", None, None), (accepted, tuple_indexing, "1.0.0", None, None), // Allows macros to appear in the type position. (accepted, type_macros, "1.13.0", Some(27245), None), (accepted, while_let, "1.0.0", None, None), - // Allows `#[deprecated]` attribute + // Allows `#[deprecated]` attribute. (accepted, deprecated, "1.9.0", Some(29935), None), // `expr?` (accepted, question_mark, "1.13.0", Some(31436), None), - // Allows `..` in tuple (struct) patterns + // Allows `..` in tuple (struct) patterns. (accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627), None), (accepted, item_like_imports, "1.15.0", Some(35120), None), // Allows using `Self` and associated types in struct expressions and patterns. (accepted, more_struct_aliases, "1.16.0", Some(37544), None), - // elide `'static` lifetimes in `static`s and `const`s + // elide `'static` lifetimes in `static`s and `const`s. (accepted, static_in_const, "1.17.0", Some(35897), None), // Allows field shorthands (`x` meaning `x: x`) in struct literal expressions. (accepted, field_init_shorthand, "1.17.0", Some(37340), None), // Allows the definition recursive static items. (accepted, static_recursion, "1.17.0", Some(29719), None), - // pub(restricted) visibilities (RFC 1422) + // `pub(restricted)` visibilities (RFC 1422) (accepted, pub_restricted, "1.18.0", Some(32409), None), - // The #![windows_subsystem] attribute + // `#![windows_subsystem]` (accepted, windows_subsystem, "1.18.0", Some(37499), None), // Allows `break {expr}` with a value inside `loop`s. (accepted, loop_break_value, "1.19.0", Some(37339), None), // Permits numeric fields in struct expressions and patterns. (accepted, relaxed_adts, "1.19.0", Some(35626), None), - // Coerces non capturing closures to function pointers + // Coerces non capturing closures to function pointers. (accepted, closure_to_fn_coercion, "1.19.0", Some(39817), None), // Allows attributes on struct literal fields. (accepted, struct_field_attributes, "1.20.0", Some(38814), None), - // Allows the definition of associated constants in `trait` or `impl` - // blocks. + // Allows the definition of associated constants in `trait` or `impl` blocks. (accepted, associated_consts, "1.20.0", Some(29646), None), - // Usage of the `compile_error!` macro + // Usage of the `compile_error!` macro. (accepted, compile_error, "1.20.0", Some(40872), None), // See rust-lang/rfcs#1414. Allows code like `let x: &'static u32 = &42` to work. (accepted, rvalue_static_promotion, "1.21.0", Some(38865), None), - // Allow Drop types in constants (RFC 1440) + // Allows `Drop` types in constants (RFC 1440). (accepted, drop_types_in_const, "1.22.0", Some(33156), None), // Allows the sysV64 ABI to be specified on all platforms - // instead of just the platforms on which it is the C ABI + // instead of just the platforms on which it is the C ABI. (accepted, abi_sysv64, "1.24.0", Some(36167), None), - // Allows `repr(align(16))` struct attribute (RFC 1358) + // Allows `repr(align(16))` struct attribute (RFC 1358). (accepted, repr_align, "1.25.0", Some(33626), None), - // allow '|' at beginning of match arms (RFC 1925) + // Allows '|' at beginning of match arms (RFC 1925). (accepted, match_beginning_vert, "1.25.0", Some(44101), None), // Nested groups in `use` (RFC 2128) (accepted, use_nested_groups, "1.25.0", Some(44494), None), - // a..=b and ..=b + // `a..=b` and `..=b` (accepted, inclusive_range_syntax, "1.26.0", Some(28237), None), - // allow `..=` in patterns (RFC 1192) + // Allows `..=` in patterns (RFC 1192). (accepted, dotdoteq_in_patterns, "1.26.0", Some(28237), None), // Termination trait in main (RFC 1937) (accepted, termination_trait, "1.26.0", Some(43301), None), - // Copy/Clone closures (RFC 2132) + // `Copy`/`Clone` closures (RFC 2132). (accepted, clone_closures, "1.26.0", Some(44490), None), (accepted, copy_closures, "1.26.0", Some(44490), None), // Allows `impl Trait` in function arguments. @@ -631,53 +598,53 @@ declare_features! ( (accepted, i128_type, "1.26.0", Some(35118), None), // Default match binding modes (RFC 2005) (accepted, match_default_bindings, "1.26.0", Some(42640), None), - // allow `'_` placeholder lifetimes + // Allows `'_` placeholder lifetimes. (accepted, underscore_lifetimes, "1.26.0", Some(44524), None), - // Allows attributes on lifetime/type formal parameters in generics (RFC 1327) + // Allows attributes on lifetime/type formal parameters in generics (RFC 1327). (accepted, generic_param_attrs, "1.27.0", Some(48848), None), - // Allows cfg(target_feature = "..."). + // Allows `cfg(target_feature = "...")`. (accepted, cfg_target_feature, "1.27.0", Some(29717), None), - // Allows #[target_feature(...)] + // Allows `#[target_feature(...)]`. (accepted, target_feature, "1.27.0", None, None), // Trait object syntax with `dyn` prefix (accepted, dyn_trait, "1.27.0", Some(44662), None), - // allow `#[must_use]` on functions; and, must-use operators (RFC 1940) + // Allows `#[must_use]` on functions, and introduces must-use operators (RFC 1940). (accepted, fn_must_use, "1.27.0", Some(43302), None), - // Allows use of the :lifetime macro fragment specifier + // Allows use of the `:lifetime` macro fragment specifier. (accepted, macro_lifetime_matcher, "1.27.0", Some(34303), None), // Termination trait in tests (RFC 1937) (accepted, termination_trait_test, "1.27.0", Some(48854), None), - // The #[global_allocator] attribute + // The `#[global_allocator]` attribute (accepted, global_allocator, "1.28.0", Some(27389), None), - // Allows `#[repr(transparent)]` attribute on newtype structs + // Allows `#[repr(transparent)]` attribute on newtype structs. (accepted, repr_transparent, "1.28.0", Some(43036), None), - // Defining procedural macros in `proc-macro` crates + // Procedural macros in `proc-macro` crates (accepted, proc_macro, "1.29.0", Some(38356), None), // `foo.rs` as an alternative to `foo/mod.rs` (accepted, non_modrs_mods, "1.30.0", Some(44660), None), - // Allows use of the :vis macro fragment specifier + // Allows use of the `:vis` macro fragment specifier (accepted, macro_vis_matcher, "1.30.0", Some(41022), None), // Allows importing and reexporting macros with `use`, // enables macro modularization in general. (accepted, use_extern_macros, "1.30.0", Some(35896), None), - // Allows keywords to be escaped for use as identifiers + // Allows keywords to be escaped for use as identifiers. (accepted, raw_identifiers, "1.30.0", Some(48589), None), - // Attributes scoped to tools + // Attributes scoped to tools. (accepted, tool_attributes, "1.30.0", Some(44690), None), - // Allows multi-segment paths in attributes and derives + // Allows multi-segment paths in attributes and derives. (accepted, proc_macro_path_invoc, "1.30.0", Some(38356), None), // Allows all literals in attribute lists and values of key-value pairs. (accepted, attr_literals, "1.30.0", Some(34981), None), - // Infer outlives requirements; RFC 2093 + // Infer outlives requirements (RFC 2093). (accepted, infer_outlives_requirements, "1.30.0", Some(44493), None), (accepted, panic_handler, "1.30.0", Some(44489), None), - // Used to preserve symbols (see llvm.used) + // Used to preserve symbols (see llvm.used). (accepted, used, "1.30.0", Some(40289), None), // `crate` in paths (accepted, crate_in_paths, "1.30.0", Some(45477), None), - // Resolve absolute paths as paths from other crates + // Resolve absolute paths as paths from other crates. (accepted, extern_absolute_paths, "1.30.0", Some(44660), None), - // Access to crate names passed via `--extern` through prelude + // Access to crate names passed via `--extern` through prelude. (accepted, extern_prelude, "1.30.0", Some(44660), None), // Parentheses in patterns (accepted, pattern_parentheses, "1.31.0", Some(51087), None), @@ -685,14 +652,46 @@ declare_features! ( (accepted, min_const_fn, "1.31.0", Some(53555), None), // Scoped lints (accepted, tool_lints, "1.31.0", Some(44690), None), - // impl Iterator for &mut Iterator - // impl Debug for Foo<'_> + // `impl Iterator for &mut Iterator` + // `impl Debug for Foo<'_>` (accepted, impl_header_lifetime_elision, "1.31.0", Some(15872), None), // `extern crate foo as bar;` puts `bar` into extern prelude. (accepted, extern_crate_item_prelude, "1.31.0", Some(55599), None), + // Allows use of the `:literal` macro fragment specifier (RFC 1576). + (accepted, macro_literal_matcher, "1.32.0", Some(35625), None), + // Use `?` as the Kleene "at most one" operator. + (accepted, macro_at_most_once_rep, "1.32.0", Some(48075), None), + // `Self` struct constructor (RFC 2302) + (accepted, self_struct_ctor, "1.32.0", Some(51994), None), + // `Self` in type definitions (RFC 2300) + (accepted, self_in_typedefs, "1.32.0", Some(49303), None), + // Integer match exhaustiveness checking (RFC 2591) + (accepted, exhaustive_integer_patterns, "1.33.0", Some(50907), None), + // `use path as _;` and `extern crate c as _;` + (accepted, underscore_imports, "1.33.0", Some(48216), None), + // Allows `#[repr(packed(N))]` attribute on structs. + (accepted, repr_packed, "1.33.0", Some(33158), None), + // Allows irrefutable patterns in `if let` and `while let` statements (RFC 2086). + (accepted, irrefutable_let_patterns, "1.33.0", Some(44495), None), + // Allows calling `const unsafe fn` inside `unsafe` blocks in `const fn` functions. + (accepted, min_const_unsafe_fn, "1.33.0", Some(55607), None), + // Allows let bindings, assignments and destructuring in `const` functions and constants. + // As long as control flow is not implemented in const eval, `&&` and `||` may not be used + // at the same time as let bindings. + (accepted, const_let, "1.33.0", Some(48821), None), + // `#[cfg_attr(predicate, multiple, attributes, here)]` + (accepted, cfg_attr_multi, "1.33.0", Some(54881), None), + // Top level or-patterns (`p | q`) in `if let` and `while let`. + (accepted, if_while_or_patterns, "1.33.0", Some(48215), None), + // Allows `use x::y;` to search `x` in the current scope. + (accepted, uniform_paths, "1.32.0", Some(53130), None), + // Allows `cfg(target_vendor = "...")`. + (accepted, cfg_target_vendor, "1.33.0", Some(29718), None), + // `extern crate self as foo;` puts local crate root into extern prelude under name `foo`. + (accepted, extern_crate_self, "1.34.0", Some(56409), None), ); -// If you change this, please modify src/doc/unstable-book as well. You must +// If you change this, please modify `src/doc/unstable-book` as well. You must // move that documentation into the relevant place in the other docs, and // remove the chapter on the flag. @@ -720,6 +719,47 @@ pub enum AttributeGate { Ungated, } +/// A template that the attribute input must match. +/// Only top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is considered now. +#[derive(Clone, Copy)] +pub struct AttributeTemplate { + word: bool, + list: Option<&'static str>, + name_value_str: Option<&'static str>, +} + +impl AttributeTemplate { + /// Check that the given meta-item is compatible with this template. + fn compatible(&self, meta_item_kind: &ast::MetaItemKind) -> bool { + match meta_item_kind { + ast::MetaItemKind::Word => self.word, + ast::MetaItemKind::List(..) => self.list.is_some(), + ast::MetaItemKind::NameValue(lit) if lit.node.is_str() => self.name_value_str.is_some(), + ast::MetaItemKind::NameValue(..) => false, + } + } +} + +/// A convenience macro for constructing attribute templates. +/// E.g. `template!(Word, List: "description")` means that the attribute +/// supports forms `#[attr]` and `#[attr(description)]`. +macro_rules! template { + (Word) => { template!(@ true, None, None) }; + (List: $descr: expr) => { template!(@ false, Some($descr), None) }; + (NameValueStr: $descr: expr) => { template!(@ false, None, Some($descr)) }; + (Word, List: $descr: expr) => { template!(@ true, Some($descr), None) }; + (Word, NameValueStr: $descr: expr) => { template!(@ true, None, Some($descr)) }; + (List: $descr1: expr, NameValueStr: $descr2: expr) => { + template!(@ false, Some($descr1), Some($descr2)) + }; + (Word, List: $descr1: expr, NameValueStr: $descr2: expr) => { + template!(@ true, Some($descr1), Some($descr2)) + }; + (@ $word: expr, $list: expr, $name_value_str: expr) => { AttributeTemplate { + word: $word, list: $list, name_value_str: $name_value_str + } }; +} + impl AttributeGate { fn is_deprecated(&self) -> bool { match *self { @@ -757,227 +797,250 @@ macro_rules! cfg_fn { }} } -pub fn deprecated_attributes() -> Vec<&'static (&'static str, AttributeType, AttributeGate)> { - BUILTIN_ATTRIBUTES.iter().filter(|a| a.2.is_deprecated()).collect() +pub fn deprecated_attributes() -> Vec<&'static (&'static str, AttributeType, + AttributeTemplate, AttributeGate)> { + BUILTIN_ATTRIBUTES.iter().filter(|(.., gate)| gate.is_deprecated()).collect() } pub fn is_builtin_attr_name(name: ast::Name) -> bool { - BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| name == builtin_name) + BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, ..)| name == builtin_name) } pub fn is_builtin_attr(attr: &ast::Attribute) -> bool { - BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| attr.path == builtin_name) + BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, ..)| attr.path == builtin_name) } // Attributes that have a special meaning to rustc or rustdoc -pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGate)] = &[ +pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeTemplate, AttributeGate)] = &[ // Normal attributes - ("warn", Normal, Ungated), - ("allow", Normal, Ungated), - ("forbid", Normal, Ungated), - ("deny", Normal, Ungated), - - ("macro_use", Normal, Ungated), - ("macro_export", Normal, Ungated), - ("plugin_registrar", Normal, Ungated), - - ("cfg", Normal, Ungated), - ("cfg_attr", Normal, Ungated), - ("main", Normal, Ungated), - ("start", Normal, Ungated), - ("repr", Normal, Ungated), - ("path", Normal, Ungated), - ("abi", Normal, Ungated), - ("automatically_derived", Normal, Ungated), - ("no_mangle", Normal, Ungated), + ("warn", Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), Ungated), + ("allow", Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), Ungated), + ("forbid", Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), Ungated), + ("deny", Normal, template!(List: r#"lint1, lint2, ..., /*opt*/ reason = "...""#), Ungated), + + ("macro_use", Normal, template!(Word, List: "name1, name2, ..."), Ungated), + ("macro_export", Normal, template!(Word, List: "local_inner_macros"), Ungated), + ("plugin_registrar", Normal, template!(Word), Ungated), + + ("cfg", Normal, template!(List: "predicate"), Ungated), + ("cfg_attr", Normal, template!(List: "predicate, attr1, attr2, ..."), Ungated), + ("main", Normal, template!(Word), Ungated), + ("start", Normal, template!(Word), Ungated), + ("repr", Normal, template!(List: "C, packed, ..."), Ungated), + ("path", Normal, template!(NameValueStr: "file"), Ungated), + ("automatically_derived", Normal, template!(Word), Ungated), + ("no_mangle", Normal, template!(Word), Ungated), // Don't trace this. Disables the `AddYkSWTCalls` MIR transform. - ("no_trace", Whitelisted, Ungated), - ("no_link", Normal, Ungated), - ("derive", Normal, Ungated), - ("should_panic", Normal, Ungated), - ("ignore", Normal, Ungated), - ("no_implicit_prelude", Normal, Ungated), - ("reexport_test_harness_main", Normal, Ungated), - ("link_args", Normal, Gated(Stability::Unstable, + ("no_trace", Whitelisted, template!(Word), Ungated), + ("no_link", Normal, template!(Word), Ungated), + ("derive", Normal, template!(List: "Trait1, Trait2, ..."), Ungated), + ("should_panic", Normal, template!(Word, List: r#"expected = "reason"#, NameValueStr: "reason"), + Ungated), + ("ignore", Normal, template!(Word, NameValueStr: "reason"), Ungated), + ("no_implicit_prelude", Normal, template!(Word), Ungated), + ("reexport_test_harness_main", Normal, template!(NameValueStr: "name"), Ungated), + ("link_args", Normal, template!(NameValueStr: "args"), Gated(Stability::Unstable, "link_args", "the `link_args` attribute is experimental and not \ portable across platforms, it is recommended to \ use `#[link(name = \"foo\")] instead", cfg_fn!(link_args))), - ("macro_escape", Normal, Ungated), + ("macro_escape", Normal, template!(Word), Ungated), // RFC #1445. - ("structural_match", Whitelisted, Gated(Stability::Unstable, + ("structural_match", Whitelisted, template!(Word), Gated(Stability::Unstable, "structural_match", "the semantics of constant patterns is \ not yet settled", cfg_fn!(structural_match))), // RFC #2008 - ("non_exhaustive", Whitelisted, Gated(Stability::Unstable, + ("non_exhaustive", Whitelisted, template!(Word), Gated(Stability::Unstable, "non_exhaustive", "non exhaustive is an experimental feature", cfg_fn!(non_exhaustive))), // RFC #1268 - ("marker", Normal, Gated(Stability::Unstable, + ("marker", Normal, template!(Word), Gated(Stability::Unstable, "marker_trait_attr", "marker traits is an experimental feature", cfg_fn!(marker_trait_attr))), - ("plugin", CrateLevel, Gated(Stability::Unstable, + ("plugin", CrateLevel, template!(List: "name|name(args)"), Gated(Stability::Unstable, "plugin", "compiler plugins are experimental \ and possibly buggy", cfg_fn!(plugin))), - ("no_std", CrateLevel, Ungated), - ("no_core", CrateLevel, Gated(Stability::Unstable, + ("no_std", CrateLevel, template!(Word), Ungated), + ("no_core", CrateLevel, template!(Word), Gated(Stability::Unstable, "no_core", "no_core is experimental", cfg_fn!(no_core))), - ("lang", Normal, Gated(Stability::Unstable, + ("lang", Normal, template!(NameValueStr: "name"), Gated(Stability::Unstable, "lang_items", "language items are subject to change", cfg_fn!(lang_items))), - ("linkage", Whitelisted, Gated(Stability::Unstable, + ("linkage", Whitelisted, template!(NameValueStr: "external|internal|..."), + Gated(Stability::Unstable, "linkage", "the `linkage` attribute is experimental \ and not portable across platforms", cfg_fn!(linkage))), - ("thread_local", Whitelisted, Gated(Stability::Unstable, + ("thread_local", Whitelisted, template!(Word), Gated(Stability::Unstable, "thread_local", "`#[thread_local]` is an experimental feature, and does \ not currently handle destructors.", cfg_fn!(thread_local))), - ("rustc_on_unimplemented", Normal, Gated(Stability::Unstable, + ("rustc_on_unimplemented", Normal, template!(List: + r#"/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...""#, + NameValueStr: "message"), + Gated(Stability::Unstable, "on_unimplemented", "the `#[rustc_on_unimplemented]` attribute \ is an experimental feature", cfg_fn!(on_unimplemented))), - ("rustc_const_unstable", Normal, Gated(Stability::Unstable, + ("rustc_const_unstable", Normal, template!(List: r#"feature = "name""#), + Gated(Stability::Unstable, "rustc_const_unstable", "the `#[rustc_const_unstable]` attribute \ is an internal feature", cfg_fn!(rustc_const_unstable))), - ("global_allocator", Normal, Ungated), - ("default_lib_allocator", Whitelisted, Gated(Stability::Unstable, + ("global_allocator", Normal, template!(Word), Ungated), + ("default_lib_allocator", Whitelisted, template!(Word), Gated(Stability::Unstable, "allocator_internals", "the `#[default_lib_allocator]` \ attribute is an experimental feature", cfg_fn!(allocator_internals))), - ("needs_allocator", Normal, Gated(Stability::Unstable, + ("needs_allocator", Normal, template!(Word), Gated(Stability::Unstable, "allocator_internals", "the `#[needs_allocator]` \ attribute is an experimental \ feature", cfg_fn!(allocator_internals))), - ("panic_runtime", Whitelisted, Gated(Stability::Unstable, + ("panic_runtime", Whitelisted, template!(Word), Gated(Stability::Unstable, "panic_runtime", "the `#[panic_runtime]` attribute is \ an experimental feature", cfg_fn!(panic_runtime))), - ("needs_panic_runtime", Whitelisted, Gated(Stability::Unstable, + ("needs_panic_runtime", Whitelisted, template!(Word), Gated(Stability::Unstable, "needs_panic_runtime", "the `#[needs_panic_runtime]` \ attribute is an experimental \ feature", cfg_fn!(needs_panic_runtime))), - ("rustc_outlives", Normal, Gated(Stability::Unstable, + ("rustc_outlives", Normal, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_outlives]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_variance", Normal, Gated(Stability::Unstable, + ("rustc_variance", Normal, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_variance]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_regions", Normal, Gated(Stability::Unstable, + ("rustc_layout", Normal, template!(List: "field1, field2, ..."), + Gated(Stability::Unstable, + "rustc_attrs", + "the `#[rustc_layout]` attribute \ + is just used for rustc unit tests \ + and will never be stable", + cfg_fn!(rustc_attrs))), + ("rustc_regions", Normal, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_regions]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_error", Whitelisted, Gated(Stability::Unstable, + ("rustc_error", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_error]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_dump_user_substs", Whitelisted, Gated(Stability::Unstable, + ("rustc_dump_user_substs", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "this attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_if_this_changed", Whitelisted, Gated(Stability::Unstable, + ("rustc_if_this_changed", Whitelisted, template!(Word, List: "DepNode"), + Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_if_this_changed]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_then_this_would_need", Whitelisted, Gated(Stability::Unstable, + ("rustc_then_this_would_need", Whitelisted, template!(List: "DepNode"), + Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_if_this_changed]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_dirty", Whitelisted, Gated(Stability::Unstable, + ("rustc_dirty", Whitelisted, template!(List: r#"cfg = "...", /*opt*/ label = "...", + /*opt*/ except = "...""#), + Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_dirty]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_clean", Whitelisted, Gated(Stability::Unstable, + ("rustc_clean", Whitelisted, template!(List: r#"cfg = "...", /*opt*/ label = "...", + /*opt*/ except = "...""#), + Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_clean]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_partition_reused", Whitelisted, Gated(Stability::Unstable, + ("rustc_partition_reused", Whitelisted, template!(List: r#"cfg = "...", module = "...""#), + Gated(Stability::Unstable, "rustc_attrs", "this attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_partition_codegened", Whitelisted, Gated(Stability::Unstable, + ("rustc_partition_codegened", Whitelisted, template!(List: r#"cfg = "...", module = "...""#), + Gated(Stability::Unstable, "rustc_attrs", "this attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_expected_cgu_reuse", Whitelisted, Gated(Stability::Unstable, + ("rustc_expected_cgu_reuse", Whitelisted, template!(List: r#"cfg = "...", module = "...", + kind = "...""#), + Gated(Stability::Unstable, "rustc_attrs", "this attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_synthetic", Whitelisted, Gated(Stability::Unstable, + ("rustc_synthetic", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "this attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_symbol_name", Whitelisted, Gated(Stability::Unstable, + ("rustc_symbol_name", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "internal rustc attributes will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_item_path", Whitelisted, Gated(Stability::Unstable, + ("rustc_item_path", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "internal rustc attributes will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_mir", Whitelisted, Gated(Stability::Unstable, + ("rustc_mir", Whitelisted, template!(List: "arg1, arg2, ..."), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_mir]` attribute \ is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_inherit_overflow_checks", Whitelisted, Gated(Stability::Unstable, + ("rustc_inherit_overflow_checks", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_inherit_overflow_checks]` \ attribute is just used to control \ @@ -986,41 +1049,35 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG across crates and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_dump_program_clauses", Whitelisted, Gated(Stability::Unstable, + ("rustc_dump_program_clauses", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_dump_program_clauses]` \ attribute is just used for rustc unit \ tests and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_test_marker", Normal, Gated(Stability::Unstable, + ("rustc_test_marker", Normal, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "the `#[rustc_test_marker]` attribute \ is used internally to track tests", cfg_fn!(rustc_attrs))), - ("rustc_transparent_macro", Whitelisted, Gated(Stability::Unstable, + ("rustc_transparent_macro", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "used internally for testing macro hygiene", cfg_fn!(rustc_attrs))), - - // RFC #2094 - ("nll", Whitelisted, Gated(Stability::Unstable, - "nll", - "Non lexical lifetimes", - cfg_fn!(nll))), - ("compiler_builtins", Whitelisted, Gated(Stability::Unstable, + ("compiler_builtins", Whitelisted, template!(Word), Gated(Stability::Unstable, "compiler_builtins", "the `#[compiler_builtins]` attribute is used to \ identify the `compiler_builtins` crate which \ contains compiler-rt intrinsics and will never be \ stable", cfg_fn!(compiler_builtins))), - ("sanitizer_runtime", Whitelisted, Gated(Stability::Unstable, + ("sanitizer_runtime", Whitelisted, template!(Word), Gated(Stability::Unstable, "sanitizer_runtime", "the `#[sanitizer_runtime]` attribute is used to \ identify crates that contain the runtime of a \ sanitizer and will never be stable", cfg_fn!(sanitizer_runtime))), - ("profiler_runtime", Whitelisted, Gated(Stability::Unstable, + ("profiler_runtime", Whitelisted, template!(Word), Gated(Stability::Unstable, "profiler_runtime", "the `#[profiler_runtime]` attribute is used to \ identify the `profiler_builtins` crate which \ @@ -1028,55 +1085,58 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG stable", cfg_fn!(profiler_runtime))), - ("allow_internal_unstable", Normal, Gated(Stability::Unstable, + ("allow_internal_unstable", Normal, template!(Word), Gated(Stability::Unstable, "allow_internal_unstable", EXPLAIN_ALLOW_INTERNAL_UNSTABLE, cfg_fn!(allow_internal_unstable))), - ("allow_internal_unsafe", Normal, Gated(Stability::Unstable, + ("allow_internal_unsafe", Normal, template!(Word), Gated(Stability::Unstable, "allow_internal_unsafe", EXPLAIN_ALLOW_INTERNAL_UNSAFE, cfg_fn!(allow_internal_unsafe))), - ("fundamental", Whitelisted, Gated(Stability::Unstable, + ("fundamental", Whitelisted, template!(Word), Gated(Stability::Unstable, "fundamental", "the `#[fundamental]` attribute \ is an experimental feature", cfg_fn!(fundamental))), - ("proc_macro_derive", Normal, Ungated), + ("proc_macro_derive", Normal, template!(List: "TraitName, \ + /*opt*/ attributes(name1, name2, ...)"), + Ungated), - ("rustc_copy_clone_marker", Whitelisted, Gated(Stability::Unstable, + ("rustc_copy_clone_marker", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "internal implementation detail", cfg_fn!(rustc_attrs))), // FIXME: #14408 whitelist docs since rustdoc looks at them - ("doc", Whitelisted, Ungated), + ("doc", Whitelisted, template!(List: "hidden|inline|...", NameValueStr: "string"), Ungated), // FIXME: #14406 these are processed in codegen, which happens after the // lint pass - ("cold", Whitelisted, Ungated), - ("naked", Whitelisted, Gated(Stability::Unstable, + ("cold", Whitelisted, template!(Word), Ungated), + ("naked", Whitelisted, template!(Word), Gated(Stability::Unstable, "naked_functions", "the `#[naked]` attribute \ is an experimental feature", cfg_fn!(naked_functions))), - ("target_feature", Whitelisted, Ungated), - ("export_name", Whitelisted, Ungated), - ("inline", Whitelisted, Ungated), - ("link", Whitelisted, Ungated), - ("link_name", Whitelisted, Ungated), - ("link_section", Whitelisted, Ungated), - ("no_builtins", Whitelisted, Ungated), - ("no_mangle", Whitelisted, Ungated), - ("no_debug", Whitelisted, Gated( + ("target_feature", Whitelisted, template!(List: r#"enable = "name""#), Ungated), + ("export_name", Whitelisted, template!(NameValueStr: "name"), Ungated), + ("inline", Whitelisted, template!(Word, List: "always|never"), Ungated), + ("link", Whitelisted, template!(List: r#"name = "...", /*opt*/ kind = "dylib|static|...", + /*opt*/ cfg = "...""#), Ungated), + ("link_name", Whitelisted, template!(NameValueStr: "name"), Ungated), + ("link_section", Whitelisted, template!(NameValueStr: "name"), Ungated), + ("no_builtins", Whitelisted, template!(Word), Ungated), + ("no_mangle", Whitelisted, template!(Word), Ungated), + ("no_debug", Whitelisted, template!(Word), Gated( Stability::Deprecated("https://github.com/rust-lang/rust/issues/29721", None), "no_debug", "the `#[no_debug]` attribute was an experimental feature that has been \ deprecated due to lack of demand", cfg_fn!(no_debug))), - ("omit_gdb_pretty_printer_section", Whitelisted, Gated(Stability::Unstable, + ("omit_gdb_pretty_printer_section", Whitelisted, template!(Word), Gated(Stability::Unstable, "omit_gdb_pretty_printer_section", "the `#[omit_gdb_pretty_printer_section]` \ attribute is just used for the Rust test \ @@ -1084,6 +1144,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG cfg_fn!(omit_gdb_pretty_printer_section))), ("unsafe_destructor_blind_to_params", Normal, + template!(Word), Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/34761", Some("replace this attribute with `#[may_dangle]`")), "dropck_parametricity", @@ -1092,93 +1153,97 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG cfg_fn!(dropck_parametricity))), ("may_dangle", Normal, + template!(Word), Gated(Stability::Unstable, "dropck_eyepatch", "may_dangle has unstable semantics and may be removed in the future", cfg_fn!(dropck_eyepatch))), - ("unwind", Whitelisted, Gated(Stability::Unstable, + ("unwind", Whitelisted, template!(List: "allowed"), Gated(Stability::Unstable, "unwind_attributes", "#[unwind] is experimental", cfg_fn!(unwind_attributes))), - ("used", Whitelisted, Ungated), + ("used", Whitelisted, template!(Word), Ungated), // used in resolve - ("prelude_import", Whitelisted, Gated(Stability::Unstable, + ("prelude_import", Whitelisted, template!(Word), Gated(Stability::Unstable, "prelude_import", "`#[prelude_import]` is for use by rustc only", cfg_fn!(prelude_import))), // FIXME: #14407 these are only looked at on-demand so we can't // guarantee they'll have already been checked - ("rustc_deprecated", Whitelisted, Ungated), - ("must_use", Whitelisted, Ungated), - ("stable", Whitelisted, Ungated), - ("unstable", Whitelisted, Ungated), - ("deprecated", Normal, Ungated), - - ("rustc_paren_sugar", Normal, Gated(Stability::Unstable, + ("rustc_deprecated", Whitelisted, template!(List: r#"since = "version", reason = "...""#), + Ungated), + ("must_use", Whitelisted, template!(Word, NameValueStr: "reason"), Ungated), + ("stable", Whitelisted, template!(List: r#"feature = "name", since = "version""#), Ungated), + ("unstable", Whitelisted, template!(List: r#"feature = "name", reason = "...", issue = "N""#), + Ungated), + ("deprecated", Normal, template!(Word, List: r#"/*opt*/ since = "version", + /*opt*/ note = "reason"#, + NameValueStr: "reason"), Ungated), + + ("rustc_paren_sugar", Normal, template!(Word), Gated(Stability::Unstable, "unboxed_closures", "unboxed_closures are still evolving", cfg_fn!(unboxed_closures))), - ("windows_subsystem", Whitelisted, Ungated), + ("windows_subsystem", Whitelisted, template!(NameValueStr: "windows|console"), Ungated), - ("proc_macro_attribute", Normal, Ungated), - ("proc_macro", Normal, Ungated), + ("proc_macro_attribute", Normal, template!(Word), Ungated), + ("proc_macro", Normal, template!(Word), Ungated), - ("rustc_derive_registrar", Normal, Gated(Stability::Unstable, - "rustc_derive_registrar", + ("rustc_proc_macro_decls", Normal, template!(Word), Gated(Stability::Unstable, + "rustc_proc_macro_decls", "used internally by rustc", cfg_fn!(rustc_attrs))), - ("allow_fail", Normal, Gated(Stability::Unstable, + ("allow_fail", Normal, template!(Word), Gated(Stability::Unstable, "allow_fail", "allow_fail attribute is currently unstable", cfg_fn!(allow_fail))), - ("rustc_std_internal_symbol", Whitelisted, Gated(Stability::Unstable, + ("rustc_std_internal_symbol", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "this is an internal attribute that will \ never be stable", cfg_fn!(rustc_attrs))), // whitelists "identity-like" conversion methods to suggest on type mismatch - ("rustc_conversion_suggestion", Whitelisted, Gated(Stability::Unstable, + ("rustc_conversion_suggestion", Whitelisted, template!(Word), Gated(Stability::Unstable, "rustc_attrs", "this is an internal attribute that will \ never be stable", cfg_fn!(rustc_attrs))), - ("rustc_args_required_const", Whitelisted, Gated(Stability::Unstable, + ("rustc_args_required_const", Whitelisted, template!(List: "N"), Gated(Stability::Unstable, "rustc_attrs", "never will be stable", cfg_fn!(rustc_attrs))), - - // RFC #2093 - ("infer_static_outlives_requirements", Normal, Gated(Stability::Unstable, - "infer_static_outlives_requirements", - "infer 'static lifetime requirements", - cfg_fn!(infer_static_outlives_requirements))), - // RFC 2070 - ("panic_handler", Normal, Ungated), + ("panic_handler", Normal, template!(Word), Ungated), - ("alloc_error_handler", Normal, Gated(Stability::Unstable, + ("alloc_error_handler", Normal, template!(Word), Gated(Stability::Unstable, "alloc_error_handler", "#[alloc_error_handler] is an unstable feature", cfg_fn!(alloc_error_handler))), + // RFC 2412 + ("optimize", Whitelisted, template!(List: "size|speed"), Gated(Stability::Unstable, + "optimize_attribute", + "#[optimize] attribute is an unstable feature", + cfg_fn!(optimize_attribute))), + // Crate level attributes - ("crate_name", CrateLevel, Ungated), - ("crate_type", CrateLevel, Ungated), - ("crate_id", CrateLevel, Ungated), - ("feature", CrateLevel, Ungated), - ("no_start", CrateLevel, Ungated), - ("no_main", CrateLevel, Ungated), - ("no_builtins", CrateLevel, Ungated), - ("recursion_limit", CrateLevel, Ungated), - ("type_length_limit", CrateLevel, Ungated), - ("test_runner", CrateLevel, Gated(Stability::Unstable, + ("crate_name", CrateLevel, template!(NameValueStr: "name"), Ungated), + ("crate_type", CrateLevel, template!(NameValueStr: "bin|lib|..."), Ungated), + ("crate_id", CrateLevel, template!(NameValueStr: "ignored"), Ungated), + ("feature", CrateLevel, template!(List: "name1, name1, ..."), Ungated), + ("no_start", CrateLevel, template!(Word), Ungated), + ("no_main", CrateLevel, template!(Word), Ungated), + ("no_builtins", CrateLevel, template!(Word), Ungated), + ("recursion_limit", CrateLevel, template!(NameValueStr: "N"), Ungated), + ("type_length_limit", CrateLevel, template!(NameValueStr: "N"), Ungated), + ("test_runner", CrateLevel, template!(List: "path"), Gated(Stability::Unstable, "custom_test_frameworks", EXPLAIN_CUSTOM_TEST_FRAMEWORKS, cfg_fn!(custom_test_frameworks))), @@ -1187,7 +1252,6 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG // cfg(...)'s that are feature gated const GATED_CFGS: &[(&str, &str, fn(&Features) -> bool)] = &[ // (name in cfg, feature, function to check if the feature is enabled) - ("target_vendor", "cfg_target_vendor", cfg_fn!(cfg_target_vendor)), ("target_thread_local", "cfg_target_thread_local", cfg_fn!(cfg_target_thread_local)), ("target_has_atomic", "cfg_target_has_atomic", cfg_fn!(cfg_target_has_atomic)), ("rustdoc", "doc_cfg", cfg_fn!(doc_cfg)), @@ -1255,7 +1319,7 @@ impl<'a> Context<'a> { fn check_attribute(&self, attr: &ast::Attribute, is_macro: bool) { debug!("check_attribute(attr = {:?})", attr); let name = attr.name().as_str(); - for &(n, ty, ref gateage) in BUILTIN_ATTRIBUTES { + for &(n, ty, _template, ref gateage) in BUILTIN_ATTRIBUTES { if name == n { if let Gated(_, name, desc, ref has_feature) = *gateage { gate_feature_fn!(self, has_feature, attr.span, name, desc, GateStrength::Hard); @@ -1276,24 +1340,20 @@ impl<'a> Context<'a> { if attr.path == &**n { // Plugins can't gate attributes, so we don't check for it // unlike the code above; we only use this loop to - // short-circuit to avoid the checks below + // short-circuit to avoid the checks below. debug!("check_attribute: {:?} is registered by a plugin, {:?}", attr.path, ty); return; } } - if name.starts_with("rustc_") { - gate_feature!(self, rustc_attrs, attr.span, - "unless otherwise specified, attributes \ - with the prefix `rustc_` \ - are reserved for internal compiler diagnostics"); - } else if name.starts_with("derive_") { - gate_feature!(self, custom_derive, attr.span, EXPLAIN_DERIVE_UNDERSCORE); - } else if !attr::is_known(attr) { - // Only run the custom attribute lint during regular - // feature gate checking. Macro gating runs - // before the plugin attributes are registered - // so we skip this then - if !is_macro { + if !attr::is_known(attr) { + if name.starts_with("rustc_") { + let msg = "unless otherwise specified, attributes with the prefix `rustc_` \ + are reserved for internal compiler diagnostics"; + gate_feature!(self, rustc_attrs, attr.span, msg); + } else if !is_macro { + // Only run the custom attribute lint during regular feature gate + // checking. Macro gating runs before the plugin attributes are + // registered, so we skip this in that case. let msg = format!("The attribute `{}` is currently unknown to the compiler and \ may have meaning added to it in the future", attr.path); gate_feature!(self, custom_attribute, attr.span, &msg); @@ -1386,56 +1446,40 @@ fn leveled_feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue } -const EXPLAIN_BOX_SYNTAX: &'static str = +const EXPLAIN_BOX_SYNTAX: &str = "box expression syntax is experimental; you can call `Box::new` instead."; -pub const EXPLAIN_STMT_ATTR_SYNTAX: &'static str = +pub const EXPLAIN_STMT_ATTR_SYNTAX: &str = "attributes on expressions are experimental."; -pub const EXPLAIN_ASM: &'static str = +pub const EXPLAIN_ASM: &str = "inline assembly is not stable enough for use and is subject to change"; -pub const EXPLAIN_GLOBAL_ASM: &'static str = +pub const EXPLAIN_GLOBAL_ASM: &str = "`global_asm!` is not stable enough for use and is subject to change"; -pub const EXPLAIN_CUSTOM_TEST_FRAMEWORKS: &'static str = +pub const EXPLAIN_CUSTOM_TEST_FRAMEWORKS: &str = "custom test frameworks are an unstable feature"; -pub const EXPLAIN_LOG_SYNTAX: &'static str = +pub const EXPLAIN_LOG_SYNTAX: &str = "`log_syntax!` is not stable enough for use and is subject to change"; -pub const EXPLAIN_CONCAT_IDENTS: &'static str = +pub const EXPLAIN_CONCAT_IDENTS: &str = "`concat_idents` is not stable enough for use and is subject to change"; -pub const EXPLAIN_FORMAT_ARGS_NL: &'static str = +pub const EXPLAIN_FORMAT_ARGS_NL: &str = "`format_args_nl` is only for internal language use and is subject to change"; -pub const EXPLAIN_TRACE_MACROS: &'static str = +pub const EXPLAIN_TRACE_MACROS: &str = "`trace_macros` is not stable enough for use and is subject to change"; -pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &'static str = +pub const EXPLAIN_ALLOW_INTERNAL_UNSTABLE: &str = "allow_internal_unstable side-steps feature gating and stability checks"; -pub const EXPLAIN_ALLOW_INTERNAL_UNSAFE: &'static str = +pub const EXPLAIN_ALLOW_INTERNAL_UNSAFE: &str = "allow_internal_unsafe side-steps the unsafe_code lint"; -pub const EXPLAIN_CUSTOM_DERIVE: &'static str = - "`#[derive]` for custom traits is deprecated and will be removed in the future."; - -pub const EXPLAIN_DEPR_CUSTOM_DERIVE: &'static str = - "`#[derive]` for custom traits is deprecated and will be removed in the future. \ - Prefer using procedural macro custom derive."; - -pub const EXPLAIN_DERIVE_UNDERSCORE: &'static str = - "attributes of the form `#[derive_*]` are reserved for the compiler"; - -pub const EXPLAIN_LITERAL_MATCHER: &'static str = - ":literal fragment specifier is experimental and subject to change"; - -pub const EXPLAIN_UNSIZED_TUPLE_COERCION: &'static str = +pub const EXPLAIN_UNSIZED_TUPLE_COERCION: &str = "unsized tuple coercion is not stable enough for use and is subject to change"; -pub const EXPLAIN_MACRO_AT_MOST_ONCE_REP: &'static str = - "using the `?` macro Kleene operator for \"at most one\" repetition is unstable"; - struct PostExpansionVisitor<'a> { context: &'a Context<'a>, } @@ -1510,6 +1554,52 @@ impl<'a> PostExpansionVisitor<'a> { Abi::System => {} } } + + fn check_builtin_attribute(&mut self, attr: &ast::Attribute, name: &str, + template: AttributeTemplate) { + // Some special attributes like `cfg` must be checked + // before the generic check, so we skip them here. + let should_skip = |name| name == "cfg"; + // Some of previously accepted forms were used in practice, + // report them as warnings for now. + let should_warn = |name| name == "doc" || name == "ignore" || + name == "inline" || name == "link"; + + match attr.parse_meta(self.context.parse_sess) { + Ok(meta) => if !should_skip(name) && !template.compatible(&meta.node) { + let mut msg = "attribute must be of the form ".to_owned(); + let mut first = true; + if template.word { + first = false; + msg.push_str(&format!("`#[{}{}]`", name, "")); + } + if let Some(descr) = template.list { + if !first { + msg.push_str(" or "); + } + first = false; + msg.push_str(&format!("`#[{}({})]`", name, descr)); + } + if let Some(descr) = template.name_value_str { + if !first { + msg.push_str(" or "); + } + msg.push_str(&format!("`#[{} = \"{}\"]`", name, descr)); + } + if should_warn(name) { + self.context.parse_sess.buffer_lint( + BufferedEarlyLintId::IllFormedAttributeInput, + meta.span, + ast::CRATE_NODE_ID, + &msg, + ); + } else { + self.context.parse_sess.span_diagnostic.span_err(meta.span, &msg); + } + } + Err(mut err) => err.emit(), + } + } } impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { @@ -1545,12 +1635,15 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } } - if !self.context.features.unrestricted_attribute_tokens { - // Unfortunately, `parse_meta` cannot be called speculatively - // because it can report errors by itself, so we have to call it - // only if the feature is disabled. - if let Err(mut err) = attr.parse_meta(self.context.parse_sess) { - err.help("try enabling `#![feature(unrestricted_attribute_tokens)]`").emit() + match BUILTIN_ATTRIBUTES.iter().find(|(name, ..)| attr.path == name) { + Some(&(name, _, template, _)) => self.check_builtin_attribute(attr, name, template), + None => if !self.context.features.unrestricted_attribute_tokens { + // Unfortunately, `parse_meta` cannot be called speculatively + // because it can report errors by itself, so we have to call it + // only if the feature is disabled. + if let Err(mut err) = attr.parse_meta(self.context.parse_sess) { + err.help("try enabling `#![feature(unrestricted_attribute_tokens)]`").emit() + } } } } @@ -1564,27 +1657,8 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } } - fn visit_use_tree(&mut self, use_tree: &'a ast::UseTree, id: NodeId, _nested: bool) { - if let ast::UseTreeKind::Simple(Some(ident), ..) = use_tree.kind { - if ident.name == "_" { - gate_feature_post!(&self, underscore_imports, use_tree.span, - "renaming imports with `_` is unstable"); - } - } - - visit::walk_use_tree(self, use_tree, id); - } - fn visit_item(&mut self, i: &'a ast::Item) { match i.node { - ast::ItemKind::ExternCrate(_) => { - if i.ident.name == "_" { - gate_feature_post!(&self, underscore_imports, i.span, - "renaming extern crates with `_` is unstable"); - } - } - - ast::ItemKind::Static(..) | ast::ItemKind::Const(_,_) => { if i.ident.name == "_" { gate_feature_post!(&self, underscore_const_names, i.span, @@ -1622,13 +1696,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { gate_feature_post!(&self, repr_simd, attr.span, "SIMD types are experimental and possibly buggy"); } - if let Some((name, _)) = item.name_value_literal() { - if name == "packed" { - gate_feature_post!(&self, repr_packed, attr.span, - "the `#[repr(packed(n))]` attribute \ - is experimental"); - } - } } } } @@ -1751,12 +1818,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { ast::ExprKind::TryBlock(_) => { gate_feature_post!(&self, try_blocks, e.span, "`try` expression is experimental"); } - ast::ExprKind::IfLet(ref pats, ..) | ast::ExprKind::WhileLet(ref pats, ..) => { - if pats.len() > 1 { - gate_feature_post!(&self, if_while_or_patterns, e.span, - "multiple patterns in `if let` and `while let` are unstable"); - } - } ast::ExprKind::Block(_, opt_label) => { if let Some(label) = opt_label { gate_feature_post!(&self, label_break_value, label.ident.span, @@ -1806,14 +1867,13 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { _node_id: NodeId) { match fn_kind { FnKind::ItemFn(_, header, _, _) => { - // check for const fn and async fn declarations + // Check for const fn and async fn declarations. if header.asyncness.is_async() { gate_feature_post!(&self, async_await, span, "async fn is unstable"); } - // stability of const fn methods are covered in - // visit_trait_item and visit_impl_item below; this is - // because default methods don't pass through this - // point. + // Stability of const fn methods are covered in + // `visit_trait_item` and `visit_impl_item` below; this is + // because default methods don't pass through this point. self.check_abi(header.abi, span); } @@ -1888,25 +1948,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { visit::walk_impl_item(self, ii); } - fn visit_path(&mut self, path: &'a ast::Path, _id: NodeId) { - for segment in &path.segments { - // Identifiers we are going to check could come from a legacy macro (e.g. `#[test]`). - // For such macros identifiers must have empty context, because this context is - // used during name resolution and produced names must be unhygienic for compatibility. - // On the other hand, we need the actual non-empty context for feature gate checking - // because it's hygienic even for legacy macros. As previously stated, such context - // cannot be kept in identifiers, so it's kept in paths instead and we take it from - // there while keeping location info from the ident span. - let span = segment.ident.span.with_ctxt(path.span.ctxt()); - if segment.ident.name == keywords::Extern.name() { - gate_feature_post!(&self, extern_in_paths, span, - "`extern` in paths is experimental"); - } - } - - visit::walk_path(self, path); - } - fn visit_vis(&mut self, vis: &'a ast::Visibility) { if let ast::VisibilityKind::Crate(ast::CrateSugar::JustCrate) = vis.node { gate_feature_post!(&self, crate_visibility_modifier, vis.span, @@ -1937,7 +1978,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute], for &edition in ALL_EDITIONS { if edition <= crate_edition { // The `crate_edition` implies its respective umbrella feature-gate - // (i.e. `#![feature(rust_20XX_preview)]` isn't needed on edition 20XX). + // (i.e., `#![feature(rust_20XX_preview)]` isn't needed on edition 20XX). edition_enabled_features.insert(Symbol::intern(edition.feature_name()), edition); } } @@ -2006,11 +2047,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute], let list = match attr.meta_item_list() { Some(list) => list, - None => { - span_err!(span_handler, attr.span, E0555, - "malformed feature attribute, expected #![feature(...)]"); - continue - } + None => continue, }; for mi in list { @@ -2097,7 +2134,7 @@ pub enum UnstableFeatures { impl UnstableFeatures { pub fn from_environment() -> UnstableFeatures { - // Whether this is a feature-staged build, i.e. on the beta or stable channel + // Whether this is a feature-staged build, i.e., on the beta or stable channel let disable_unstable_features = option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some(); // Whether we should enable unstable features for bootstrapping let bootstrap = env::var("RUSTC_BOOTSTRAP").is_ok(); diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 0e6e2f90693..fdcbbb939a6 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A Folder represents an AST->AST fold; it accepts an AST piece, //! and returns a piece of the same type. So, for instance, macro //! expansion is a Folder that walks over an AST and produces another @@ -217,8 +207,8 @@ pub trait Folder : Sized { noop_fold_angle_bracketed_parameter_data(p, self) } - fn fold_parenthesized_parameter_data(&mut self, p: ParenthesisedArgs) - -> ParenthesisedArgs + fn fold_parenthesized_parameter_data(&mut self, p: ParenthesizedArgs) + -> ParenthesizedArgs { noop_fold_parenthesized_parameter_data(p, self) } @@ -229,7 +219,7 @@ pub trait Folder : Sized { fn fold_mac(&mut self, _mac: Mac) -> Mac { panic!("fold_mac disabled by default"); - // NB: see note about macros above. + // N.B., see note about macros above. // if you really want a folder that // works on macros, use this // definition in your trait impl: @@ -514,12 +504,12 @@ pub fn noop_fold_angle_bracketed_parameter_data(data: AngleBracketedA } } -pub fn noop_fold_parenthesized_parameter_data(data: ParenthesisedArgs, +pub fn noop_fold_parenthesized_parameter_data(data: ParenthesizedArgs, fld: &mut T) - -> ParenthesisedArgs + -> ParenthesizedArgs { - let ParenthesisedArgs { inputs, output, span } = data; - ParenthesisedArgs { + let ParenthesizedArgs { inputs, output, span } = data; + ParenthesizedArgs { inputs: inputs.move_map(|ty| fld.fold_ty(ty)), output: output.map(|ty| fld.fold_ty(ty)), span: fld.new_span(span) @@ -605,12 +595,10 @@ pub fn noop_fold_tt(tt: TokenTree, fld: &mut T) -> TokenTree { match tt { TokenTree::Token(span, tok) => TokenTree::Token(fld.new_span(span), fld.fold_token(tok)), - TokenTree::Delimited(span, delimed) => TokenTree::Delimited( + TokenTree::Delimited(span, delim, tts) => TokenTree::Delimited( DelimSpan::from_pair(fld.new_span(span.open), fld.new_span(span.close)), - Delimited { - tts: fld.fold_tts(delimed.stream()).into(), - delim: delimed.delim, - } + delim, + fld.fold_tts(tts).into(), ), } } @@ -637,7 +625,7 @@ pub fn noop_fold_token(t: token::Token, fld: &mut T) -> token::Token /// apply folder to elements of interpolated nodes // -// NB: this can occur only when applying a fold to partially expanded code, where +// N.B., this can occur only when applying a fold to partially expanded code, where // parsed pieces have gotten implanted ito *other* macro invocations. This is relevant // for macro hygiene, but possibly not elsewhere. // @@ -904,12 +892,11 @@ fn noop_fold_bounds(bounds: GenericBounds, folder: &mut T) } pub fn noop_fold_block(b: P, folder: &mut T) -> P { - b.map(|Block {id, stmts, rules, span, recovered}| Block { + b.map(|Block {id, stmts, rules, span}| Block { id: folder.new_id(id), stmts: stmts.move_flat_map(|s| folder.fold_stmt(s).into_iter()), rules, span: folder.new_span(span), - recovered, }) } @@ -1379,6 +1366,7 @@ pub fn noop_fold_expr(Expr {id, node, span, attrs}: Expr, folder: &mu ExprKind::Yield(ex) => ExprKind::Yield(ex.map(|x| folder.fold_expr(x))), ExprKind::Try(ex) => ExprKind::Try(folder.fold_expr(ex)), ExprKind::TryBlock(body) => ExprKind::TryBlock(folder.fold_block(body)), + ExprKind::Err => ExprKind::Err, }, id: folder.new_id(id), span: folder.new_span(span), diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs index a32682967c7..cf11ac550b7 100644 --- a/src/libsyntax/json.rs +++ b/src/libsyntax/json.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A JSON emitter for errors. //! //! This works by converting errors to a simplified structural format (see the @@ -17,7 +7,7 @@ //! The format of the JSON output should be considered *unstable*. For now the //! structs at the end of this file (Diagnostic*) specify the error format. -// FIXME spec the JSON output properly. +// FIXME: spec the JSON output properly. use source_map::{SourceMap, FilePathMapping}; use syntax_pos::{self, MacroBacktrace, Span, SpanLabel, MultiSpan}; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 9bbd59e09be..b2a3ae7f9d9 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The Rust parser and macro expander. //! //! # Note @@ -20,7 +10,7 @@ test(attr(deny(warnings))))] #![feature(crate_visibility_modifier)] -#![feature(macro_at_most_once_rep)] +#![feature(label_break_value)] #![feature(nll)] #![feature(rustc_attrs)] #![feature(rustc_diagnostic_macros)] @@ -55,8 +45,6 @@ use ast::AttrId; // way towards a non-panic!-prone parser. It should be used for fatal parsing // errors; eventually we plan to convert all code using panictry to just use // normal try. -// Exported for syntax_ext, not meant for general use. -#[macro_export] macro_rules! panictry { ($e:expr) => ({ use std::result::Result::{Ok, Err}; @@ -135,7 +123,7 @@ pub mod diagnostics { pub mod metadata; } -// NB: This module needs to be declared first so diagnostics are +// N.B., this module needs to be declared first so diagnostics are // registered before they are used. pub mod diagnostic_list; @@ -146,12 +134,6 @@ pub mod util { #[cfg(test)] pub mod parser_testing; pub mod move_map; - - mod rc_slice; - pub use self::rc_slice::RcSlice; - - mod rc_vec; - pub use self::rc_vec::RcVec; } pub mod json; @@ -174,7 +156,6 @@ pub mod parse; pub mod ptr; pub mod show_span; pub mod std_inject; -pub mod str; pub use syntax_pos::edition; pub use syntax_pos::symbol; pub mod test; @@ -193,7 +174,6 @@ pub mod ext { pub mod derive; pub mod expand; pub mod placeholders; - pub mod quote; pub mod source_util; pub mod tt { diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index a240604bfe0..914a0667ebf 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use attr; use ast; use source_map::respan; @@ -22,8 +12,8 @@ enum InnerAttributeParsePolicy<'a> { NotPermitted { reason: &'a str }, } -const DEFAULT_UNEXPECTED_INNER_ATTR_ERR_MSG: &'static str = "an inner attribute is not \ - permitted in this context"; +const DEFAULT_UNEXPECTED_INNER_ATTR_ERR_MSG: &str = "an inner attribute is not \ + permitted in this context"; impl<'a> Parser<'a> { /// Parse attributes that appear before an item @@ -170,7 +160,7 @@ impl<'a> Parser<'a> { token::CloseDelim(_) | token::Eof => self.unexpected()?, _ => self.parse_token_tree(), }; - TokenStream::concat(vec![eq.into(), tree.into()]) + TokenStream::new(vec![eq.into(), tree.into()]) } else { TokenStream::empty() }; diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs index 99f9d0511fe..a1cdfd9146a 100644 --- a/src/libsyntax/parse/classify.rs +++ b/src/libsyntax/parse/classify.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Routines the parser uses to classify AST nodes // Predicates on exprs and stmts that the pretty-printer and parser use diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs index 172a48ddba2..ffc480d829d 100644 --- a/src/libsyntax/parse/lexer/comments.rs +++ b/src/libsyntax/parse/lexer/comments.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use self::CommentStyle::*; use ast; @@ -16,7 +6,6 @@ use syntax_pos::{BytePos, CharPos, Pos, FileName}; use parse::lexer::{is_block_doc_comment, is_pattern_whitespace}; use parse::lexer::{self, ParseSess, StringReader, TokenAndSpan}; use print::pprust; -use str::char_at; use std::io::Read; use std::usize; @@ -207,20 +196,14 @@ fn read_line_comments(rdr: &mut StringReader, /// Otherwise returns Some(k) where k is first char offset after that leading /// whitespace. Note k may be outside bounds of s. fn all_whitespace(s: &str, col: CharPos) -> Option { - let len = s.len(); - let mut col = col.to_usize(); - let mut cursor: usize = 0; - - while col > 0 && cursor < len { - let ch = char_at(s, cursor); + let mut idx = 0; + for (i, ch) in s.char_indices().take(col.to_usize()) { if !ch.is_whitespace() { return None; } - cursor += ch.len_utf8(); - col -= 1; + idx = i + ch.len_utf8(); } - - Some(cursor) + Some(idx) } fn trim_whitespace_prefix_and_push_line(lines: &mut Vec, s: String, col: CharPos) { @@ -228,7 +211,7 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut Vec, s: String, col: let s1 = match all_whitespace(&s[..], col) { Some(col) => { if col < len { - (&s[col..len]).to_string() + s[col..len].to_string() } else { String::new() } @@ -247,20 +230,13 @@ fn read_block_comment(rdr: &mut StringReader, let mut lines: Vec = Vec::new(); // Count the number of chars since the start of the line by rescanning. - let mut src_index = rdr.src_index(rdr.source_file.line_begin_pos(rdr.pos)); + let src_index = rdr.src_index(rdr.source_file.line_begin_pos(rdr.pos)); let end_src_index = rdr.src_index(rdr.pos); assert!(src_index <= end_src_index, "src_index={}, end_src_index={}, line_begin_pos={}", src_index, end_src_index, rdr.source_file.line_begin_pos(rdr.pos).to_u32()); - let mut n = 0; - - while src_index < end_src_index { - let c = char_at(&rdr.src, src_index); - src_index += c.len_utf8(); - n += 1; - } - let col = CharPos(n); + let col = CharPos(rdr.src[src_index..end_src_index].chars().count()); rdr.bump(); rdr.bump(); diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 0584cd5a3df..06f9162a400 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1,24 +1,14 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ast::{self, Ident}; use syntax_pos::{self, BytePos, CharPos, Pos, Span, NO_EXPANSION}; use source_map::{SourceMap, FilePathMapping}; use errors::{Applicability, FatalError, Diagnostic, DiagnosticBuilder}; use parse::{token, ParseSess}; -use str::char_at; use symbol::{Symbol, keywords}; use core::unicode::property::Pattern_White_Space; use std::borrow::Cow; use std::char; +use std::iter; use std::mem::replace; use rustc_data_structures::sync::Lrc; @@ -60,11 +50,11 @@ pub struct StringReader<'a> { // cache a direct reference to the source text, so that we don't have to // retrieve it via `self.source_file.src.as_ref().unwrap()` all the time. src: Lrc, - /// Stack of open delimiters and their spans. Used for error message. token: token::Token, span: Span, /// The raw source span which *does not* take `override_span` into account span_src_raw: Span, + /// Stack of open delimiters and their spans. Used for error message. open_braces: Vec<(token::DelimToken, Span)>, /// The type and spans for all braces /// @@ -248,19 +238,6 @@ impl<'a> StringReader<'a> { sr } - pub fn new_without_err(sess: &'a ParseSess, - source_file: Lrc, - override_span: Option, - prepend_error_text: &str) -> Result { - let mut sr = StringReader::new_raw(sess, source_file, override_span); - if sr.advance_token().is_err() { - eprintln!("{}", prepend_error_text); - sr.emit_fatal_errors(); - return Err(()); - } - Ok(sr) - } - pub fn new_or_buffered_errs(sess: &'a ParseSess, source_file: Lrc, override_span: Option) -> Result> { @@ -309,7 +286,7 @@ impl<'a> StringReader<'a> { /// Report a lexical error with a given span. fn err_span(&self, sp: Span, m: &str) { - self.sess.span_diagnostic.span_err(sp, m) + self.sess.span_diagnostic.struct_span_err(sp, m).emit(); } @@ -459,45 +436,42 @@ impl<'a> StringReader<'a> { /// Converts CRLF to LF in the given string, raising an error on bare CR. fn translate_crlf<'b>(&self, start: BytePos, s: &'b str, errmsg: &'b str) -> Cow<'b, str> { - let mut i = 0; - while i < s.len() { - let ch = char_at(s, i); - let next = i + ch.len_utf8(); + let mut chars = s.char_indices().peekable(); + while let Some((i, ch)) = chars.next() { if ch == '\r' { - if next < s.len() && char_at(s, next) == '\n' { - return translate_crlf_(self, start, s, errmsg, i).into(); + if let Some((lf_idx, '\n')) = chars.peek() { + return translate_crlf_(self, start, s, *lf_idx, chars, errmsg).into(); } let pos = start + BytePos(i as u32); - let end_pos = start + BytePos(next as u32); + let end_pos = start + BytePos((i + ch.len_utf8()) as u32); self.err_span_(pos, end_pos, errmsg); } - i = next; } return s.into(); fn translate_crlf_(rdr: &StringReader, start: BytePos, s: &str, - errmsg: &str, - mut i: usize) + mut j: usize, + mut chars: iter::Peekable>, + errmsg: &str) -> String { let mut buf = String::with_capacity(s.len()); - let mut j = 0; - while i < s.len() { - let ch = char_at(s, i); - let next = i + ch.len_utf8(); + // Skip first CR + buf.push_str(&s[.. j - 1]); + while let Some((i, ch)) = chars.next() { if ch == '\r' { if j < i { buf.push_str(&s[j..i]); } + let next = i + ch.len_utf8(); j = next; - if next >= s.len() || char_at(s, next) != '\n' { + if chars.peek().map(|(_, ch)| *ch) != Some('\n') { let pos = start + BytePos(i as u32); let end_pos = start + BytePos(next as u32); rdr.err_span_(pos, end_pos, errmsg); } } - i = next; } if j < s.len() { buf.push_str(&s[j..]); @@ -506,8 +480,7 @@ impl<'a> StringReader<'a> { } } - /// Advance the StringReader by one character. If a newline is - /// discovered, add it to the SourceFile's list of line start offsets. + /// Advance the StringReader by one character. crate fn bump(&mut self) { let next_src_index = self.src_index(self.next_pos); if next_src_index < self.end_src_index { @@ -959,12 +932,36 @@ impl<'a> StringReader<'a> { self.scan_unicode_escape(delim) && !ascii_only } else { let span = self.mk_sp(start, self.pos); - self.sess.span_diagnostic - .struct_span_err(span, "incorrect unicode escape sequence") - .span_help(span, - "format of unicode escape sequences is \ - `\\u{…}`") - .emit(); + let mut suggestion = "\\u{".to_owned(); + let mut err = self.sess.span_diagnostic.struct_span_err( + span, + "incorrect unicode escape sequence", + ); + let mut i = 0; + while let (Some(ch), true) = (self.ch, i < 6) { + if ch.is_digit(16) { + suggestion.push(ch); + self.bump(); + i += 1; + } else { + break; + } + } + if i != 0 { + suggestion.push('}'); + err.span_suggestion( + self.mk_sp(start, self.pos), + "format of unicode escape sequences uses braces", + suggestion, + Applicability::MaybeIncorrect, + ); + } else { + err.span_help( + span, + "format of unicode escape sequences is `\\u{...}`", + ); + } + err.emit(); false }; if ascii_only { @@ -1131,7 +1128,7 @@ impl<'a> StringReader<'a> { "expected at least one digit in exponent" ); if let Some(ch) = self.ch { - // check for e.g. Unicode minus '−' (Issue #49746) + // check for e.g., Unicode minus '−' (Issue #49746) if unicode_chars::check_for_substitution(self, ch, &mut err) { self.bump(); self.scan_digits(10, 10); @@ -1398,9 +1395,10 @@ impl<'a> StringReader<'a> { // lifetimes shouldn't end with a single quote // if we find one, then this is an invalid character literal if self.ch_is('\'') { - self.fatal_span_verbose(start_with_quote, self.next_pos, - String::from("character literal may only contain one codepoint")) - .raise(); + self.err_span_(start_with_quote, self.next_pos, + "character literal may only contain one codepoint"); + self.bump(); + return Ok(token::Literal(token::Err(Symbol::intern("??")), None)) } @@ -1429,13 +1427,13 @@ impl<'a> StringReader<'a> { self.sess.span_diagnostic .struct_span_err(span, "character literal may only contain one codepoint") - .span_suggestion_with_applicability( + .span_suggestion( span, "if you meant to write a `str` literal, use double quotes", format!("\"{}\"", &self.src[start..end]), Applicability::MachineApplicable ).emit(); - return Ok(token::Literal(token::Str_(Symbol::intern("??")), None)) + return Ok(token::Literal(token::Err(Symbol::intern("??")), None)) } if self.ch_is('\n') || self.is_eof() || self.ch_is('/') { // Only attempt to infer single line string literals. If we encounter @@ -1859,6 +1857,11 @@ fn ident_continue(c: Option) -> bool { (c > '\x7f' && c.is_xid_continue()) } +#[inline] +fn char_at(s: &str, byte: usize) -> char { + s[byte..].chars().next().unwrap() +} + #[cfg(test)] mod tests { use super::*; @@ -1899,7 +1902,7 @@ mod tests { sess: &'a ParseSess, teststr: String) -> StringReader<'a> { - let sf = sm.new_source_file(PathBuf::from("zebra.rs").into(), teststr); + let sf = sm.new_source_file(PathBuf::from(teststr.clone()).into(), teststr); StringReader::new(sess, sf, None) } diff --git a/src/libsyntax/parse/lexer/tokentrees.rs b/src/libsyntax/parse/lexer/tokentrees.rs index 8047ab01465..d219f29f06c 100644 --- a/src/libsyntax/parse/lexer/tokentrees.rs +++ b/src/libsyntax/parse/lexer/tokentrees.rs @@ -1,17 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use print::pprust::token_to_string; use parse::lexer::StringReader; use parse::{token, PResult}; -use tokenstream::{Delimited, DelimSpan, TokenStream, TokenTree}; +use tokenstream::{DelimSpan, IsJoint::*, TokenStream, TokenTree, TreeAndJoint}; impl<'a> StringReader<'a> { // Parse a stream of tokens into a list of `TokenTree`s, up to an `Eof`. @@ -22,7 +12,7 @@ impl<'a> StringReader<'a> { tts.push(self.parse_token_tree()?); } - Ok(TokenStream::concat(tts)) + Ok(TokenStream::new(tts)) } // Parse a stream of tokens into a list of `TokenTree`s, up to a `CloseDelim`. @@ -30,20 +20,20 @@ impl<'a> StringReader<'a> { let mut tts = vec![]; loop { if let token::CloseDelim(..) = self.token { - return TokenStream::concat(tts); + return TokenStream::new(tts); } match self.parse_token_tree() { Ok(tree) => tts.push(tree), Err(mut e) => { e.emit(); - return TokenStream::concat(tts); + return TokenStream::new(tts); } } } } - fn parse_token_tree(&mut self) -> PResult<'a, TokenStream> { + fn parse_token_tree(&mut self) -> PResult<'a, TreeAndJoint> { let sm = self.sess.source_map(); match self.token { token::Eof => { @@ -97,7 +87,15 @@ impl<'a> StringReader<'a> { // Correct delimiter. token::CloseDelim(d) if d == delim => { let (open_brace, open_brace_span) = self.open_braces.pop().unwrap(); - self.matching_delim_spans.push((open_brace, open_brace_span, self.span)); + if self.open_braces.len() == 0 { + // Clear up these spans to avoid suggesting them as we've found + // properly matched delimiters so far for an entire block. + self.matching_delim_spans.clear(); + } else { + self.matching_delim_spans.push( + (open_brace, open_brace_span, self.span), + ); + } // Parse the close delimiter. self.real_token(); } @@ -155,10 +153,11 @@ impl<'a> StringReader<'a> { _ => {} } - Ok(TokenTree::Delimited(delim_span, Delimited { + Ok(TokenTree::Delimited( + delim_span, delim, - tts: tts.into(), - }).into()) + tts.into() + ).into()) }, token::CloseDelim(_) => { // An unexpected closing delimiter (i.e., there is no @@ -177,8 +176,7 @@ impl<'a> StringReader<'a> { let raw = self.span_src_raw; self.real_token(); let is_joint = raw.hi() == self.span_src_raw.lo() && token::is_op(&self.token); - - Ok(if is_joint { tt.joint() } else { tt.into() }) + Ok((tt, if is_joint { Joint } else { NonJoint })) } } } diff --git a/src/libsyntax/parse/lexer/unicode_chars.rs b/src/libsyntax/parse/lexer/unicode_chars.rs index 03bf1b5a4e1..7da4284c0e4 100644 --- a/src/libsyntax/parse/lexer/unicode_chars.rs +++ b/src/libsyntax/parse/lexer/unicode_chars.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Characters and their corresponding confusables were collected from // http://www.unicode.org/Public/security/10.0.0/confusables.txt @@ -306,7 +296,7 @@ const UNICODE_ARRAY: &[(char, &str, char)] = &[ ('>', "Fullwidth Greater-Than Sign", '>'), ]; -const ASCII_ARRAY: &'static [(char, &'static str)] = &[ +const ASCII_ARRAY: &[(char, &str)] = &[ (' ', "Space"), ('_', "Underscore"), ('-', "Minus/Hyphen"), @@ -346,7 +336,7 @@ crate fn check_for_substitution<'a>(reader: &StringReader<'a>, let msg = format!("Unicode character '{}' ({}) looks like '{}' ({}), but it is not", ch, u_name, ascii_char, ascii_name); - err.span_suggestion_with_applicability( + err.span_suggestion( span, &msg, ascii_char.to_string(), diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index ac972f20f94..c7330004d6d 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The main parser interface use rustc_data_structures::sync::{Lrc, Lock}; @@ -15,11 +5,9 @@ use ast::{self, CrateConfig, NodeId}; use early_buffered_lints::{BufferedEarlyLint, BufferedEarlyLintId}; use source_map::{SourceMap, FilePathMapping}; use syntax_pos::{Span, SourceFile, FileName, MultiSpan}; -use errors::{Handler, ColorConfig, Diagnostic, DiagnosticBuilder}; +use errors::{FatalError, Level, Handler, ColorConfig, Diagnostic, DiagnosticBuilder}; use feature_gate::UnstableFeatures; use parse::parser::Parser; -use ptr::P; -use str::char_at; use symbol::Symbol; use tokenstream::{TokenStream, TokenTree}; use diagnostics::plugin::ErrorMap; @@ -82,6 +70,7 @@ impl ParseSess { } } + #[inline] pub fn source_map(&self) -> &SourceMap { &self.source_map } @@ -145,25 +134,6 @@ pub fn parse_crate_attrs_from_source_str(name: FileName, source: String, sess: & new_parser_from_source_str(sess, name, source).parse_inner_attributes() } -crate fn parse_expr_from_source_str(name: FileName, source: String, sess: &ParseSess) - -> PResult> { - new_parser_from_source_str(sess, name, source).parse_expr() -} - -/// Parses an item. -/// -/// Returns `Ok(Some(item))` when successful, `Ok(None)` when no item was found, and `Err` -/// when a syntax error occurred. -crate fn parse_item_from_source_str(name: FileName, source: String, sess: &ParseSess) - -> PResult>> { - new_parser_from_source_str(sess, name, source).parse_item() -} - -crate fn parse_stmt_from_source_str(name: FileName, source: String, sess: &ParseSess) - -> PResult> { - new_parser_from_source_str(sess, name, source).parse_stmt() -} - pub fn parse_stream_from_source_str(name: FileName, source: String, sess: &ParseSess, override_span: Option) -> TokenStream { @@ -193,6 +163,14 @@ pub fn new_parser_from_file<'a>(sess: &'a ParseSess, path: &Path) -> Parser<'a> source_file_to_parser(sess, file_to_source_file(sess, path, None)) } +/// Create a new parser, returning buffered diagnostics if the file doesn't +/// exist or from lexing the initial token stream. +pub fn maybe_new_parser_from_file<'a>(sess: &'a ParseSess, path: &Path) + -> Result, Vec> { + let file = try_file_to_source_file(sess, path, None).map_err(|db| vec![db])?; + maybe_source_file_to_parser(sess, file) +} + /// Given a session, a crate config, a path, and a span, add /// the file at the given path to the source_map, and return a parser. /// On an error, use the given span as the source of the problem. @@ -237,18 +215,31 @@ pub fn new_parser_from_tts(sess: &ParseSess, tts: Vec) -> Parser { // base abstractions +/// Given a session and a path and an optional span (for error reporting), +/// add the path to the session's source_map and return the new source_file or +/// error when a file can't be read. +fn try_file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option) + -> Result, Diagnostic> { + sess.source_map().load_file(path) + .map_err(|e| { + let msg = format!("couldn't read {}: {}", path.display(), e); + let mut diag = Diagnostic::new(Level::Fatal, &msg); + if let Some(sp) = spanopt { + diag.set_span(sp); + } + diag + }) +} + /// Given a session and a path and an optional span (for error reporting), /// add the path to the session's source_map and return the new source_file. fn file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option) -> Lrc { - match sess.source_map().load_file(path) { + match try_file_to_source_file(sess, path, spanopt) { Ok(source_file) => source_file, - Err(e) => { - let msg = format!("couldn't read {}: {}", path.display(), e); - match spanopt { - Some(sp) => sess.span_diagnostic.span_fatal(sp, &msg).raise(), - None => sess.span_diagnostic.fatal(&msg).raise() - } + Err(d) => { + DiagnosticBuilder::new_diagnostic(&sess.span_diagnostic, d).emit(); + FatalError.raise(); } } } @@ -436,9 +427,7 @@ fn raw_str_lit(lit: &str) -> String { // check if `s` looks like i32 or u1234 etc. fn looks_like_width_suffix(first_chars: &[char], s: &str) -> bool { - s.len() > 1 && - first_chars.contains(&char_at(s, 0)) && - s[1..].chars().all(|c| '0' <= c && c <= '9') + s.starts_with(first_chars) && s[1..].chars().all(|c| c.is_ascii_digit()) } macro_rules! err { @@ -457,6 +446,7 @@ crate fn lit_token(lit: token::Lit, suf: Option, diag: Option<(Span, &Ha match lit { token::Byte(i) => (true, Some(LitKind::Byte(byte_lit(&i.as_str()).0))), token::Char(i) => (true, Some(LitKind::Char(char_lit(&i.as_str(), diag).0))), + token::Err(i) => (true, Some(LitKind::Err(i))), // There are some valid suffixes for integer and float literals, // so all the handling is done internally. @@ -511,6 +501,7 @@ fn filtered_float_lit(data: Symbol, suffix: Option, diag: Option<(Span, } else { let msg = format!("invalid suffix `{}` for float literal", suf); diag.struct_span_err(span, &msg) + .span_label(span, format!("invalid suffix `{}`", suf)) .help("valid suffixes are `f32` and `f64`") .emit(); } @@ -645,11 +636,11 @@ fn integer_lit(s: &str, suffix: Option, diag: Option<(Span, &Handler)>) let orig = s; let mut ty = ast::LitIntType::Unsuffixed; - if char_at(s, 0) == '0' && s.len() > 1 { - match char_at(s, 1) { - 'x' => base = 16, - 'o' => base = 8, - 'b' => base = 2, + if s.starts_with('0') && s.len() > 1 { + match s.as_bytes()[1] { + b'x' => base = 16, + b'o' => base = 8, + b'b' => base = 2, _ => { } } } @@ -664,7 +655,11 @@ fn integer_lit(s: &str, suffix: Option, diag: Option<(Span, &Handler)>) _ => None, }; if let Some(err) = err { - err!(diag, |span, diag| diag.span_err(span, err)); + err!(diag, |span, diag| { + diag.struct_span_err(span, err) + .span_label(span, "not supported") + .emit(); + }); } return filtered_float_lit(Symbol::intern(s), Some(suf), diag) } @@ -703,6 +698,7 @@ fn integer_lit(s: &str, suffix: Option, diag: Option<(Span, &Handler)>) } else { let msg = format!("invalid suffix `{}` for numeric literal", suf); diag.struct_span_err(span, &msg) + .span_label(span, format!("invalid suffix `{}`", suf)) .help("the suffix must be one of the integral types \ (`u32`, `isize`, etc)") .emit(); @@ -765,13 +761,22 @@ mod tests { use syntax_pos::{Span, BytePos, Pos, NO_EXPANSION}; use ast::{self, Ident, PatKind}; use attr::first_attr_value_str_by_name; - use parse; + use ptr::P; use print::pprust::item_to_string; - use tokenstream::{self, DelimSpan, TokenTree}; + use tokenstream::{DelimSpan, TokenTree}; use util::parser_testing::string_to_stream; use util::parser_testing::{string_to_expr, string_to_item}; use with_globals; + /// Parses an item. + /// + /// Returns `Ok(Some(item))` when successful, `Ok(None)` when no item was found, and `Err` + /// when a syntax error occurred. + fn parse_item_from_source_str(name: FileName, source: String, sess: &ParseSess) + -> PResult>> { + new_parser_from_source_str(sess, name, source).parse_item() + } + // produce a syntax_pos::span fn sp(a: u32, b: u32) -> Span { Span::new(BytePos(a), BytePos(b), NO_EXPANSION) @@ -798,42 +803,41 @@ mod tests { Some(&TokenTree::Token(_, token::Ident(name_macro_rules, false))), Some(&TokenTree::Token(_, token::Not)), Some(&TokenTree::Token(_, token::Ident(name_zip, false))), - Some(&TokenTree::Delimited(_, ref macro_delimed)), + Some(&TokenTree::Delimited(_, macro_delim, ref macro_tts)), ) if name_macro_rules.name == "macro_rules" && name_zip.name == "zip" => { - let tts = ¯o_delimed.stream().trees().collect::>(); + let tts = ¯o_tts.trees().collect::>(); match (tts.len(), tts.get(0), tts.get(1), tts.get(2)) { ( 3, - Some(&TokenTree::Delimited(_, ref first_delimed)), + Some(&TokenTree::Delimited(_, first_delim, ref first_tts)), Some(&TokenTree::Token(_, token::FatArrow)), - Some(&TokenTree::Delimited(_, ref second_delimed)), + Some(&TokenTree::Delimited(_, second_delim, ref second_tts)), ) - if macro_delimed.delim == token::Paren => { - let tts = &first_delimed.stream().trees().collect::>(); + if macro_delim == token::Paren => { + let tts = &first_tts.trees().collect::>(); match (tts.len(), tts.get(0), tts.get(1)) { ( 2, Some(&TokenTree::Token(_, token::Dollar)), Some(&TokenTree::Token(_, token::Ident(ident, false))), ) - if first_delimed.delim == token::Paren && ident.name == "a" => {}, - _ => panic!("value 3: {:?}", *first_delimed), + if first_delim == token::Paren && ident.name == "a" => {}, + _ => panic!("value 3: {:?} {:?}", first_delim, first_tts), } - let tts = &second_delimed.stream().trees().collect::>(); + let tts = &second_tts.trees().collect::>(); match (tts.len(), tts.get(0), tts.get(1)) { ( 2, Some(&TokenTree::Token(_, token::Dollar)), Some(&TokenTree::Token(_, token::Ident(ident, false))), ) - if second_delimed.delim == token::Paren - && ident.name == "a" => {}, - _ => panic!("value 4: {:?}", *second_delimed), + if second_delim == token::Paren && ident.name == "a" => {}, + _ => panic!("value 4: {:?} {:?}", second_delim, second_tts), } }, - _ => panic!("value 2: {:?}", *macro_delimed), + _ => panic!("value 2: {:?} {:?}", macro_delim, macro_tts), } }, _ => panic!("value: {:?}",tts), @@ -846,31 +850,29 @@ mod tests { with_globals(|| { let tts = string_to_stream("fn a (b : i32) { b; }".to_string()); - let expected = TokenStream::concat(vec![ + let expected = TokenStream::new(vec![ TokenTree::Token(sp(0, 2), token::Ident(Ident::from_str("fn"), false)).into(), TokenTree::Token(sp(3, 4), token::Ident(Ident::from_str("a"), false)).into(), TokenTree::Delimited( DelimSpan::from_pair(sp(5, 6), sp(13, 14)), - tokenstream::Delimited { - delim: token::DelimToken::Paren, - tts: TokenStream::concat(vec![ - TokenTree::Token(sp(6, 7), - token::Ident(Ident::from_str("b"), false)).into(), - TokenTree::Token(sp(8, 9), token::Colon).into(), - TokenTree::Token(sp(10, 13), - token::Ident(Ident::from_str("i32"), false)).into(), - ]).into(), - }).into(), + token::DelimToken::Paren, + TokenStream::new(vec![ + TokenTree::Token(sp(6, 7), + token::Ident(Ident::from_str("b"), false)).into(), + TokenTree::Token(sp(8, 9), token::Colon).into(), + TokenTree::Token(sp(10, 13), + token::Ident(Ident::from_str("i32"), false)).into(), + ]).into(), + ).into(), TokenTree::Delimited( DelimSpan::from_pair(sp(15, 16), sp(20, 21)), - tokenstream::Delimited { - delim: token::DelimToken::Brace, - tts: TokenStream::concat(vec![ - TokenTree::Token(sp(17, 18), - token::Ident(Ident::from_str("b"), false)).into(), - TokenTree::Token(sp(18, 19), token::Semi).into(), - ]).into(), - }).into() + token::DelimToken::Brace, + TokenStream::new(vec![ + TokenTree::Token(sp(17, 18), + token::Ident(Ident::from_str("b"), false)).into(), + TokenTree::Token(sp(18, 19), token::Semi).into(), + ]).into(), + ).into() ]); assert_eq!(tts, expected); @@ -977,23 +979,25 @@ mod tests { with_globals(|| { let sess = ParseSess::new(FilePathMapping::empty()); - let name = FileName::Custom("source".to_string()); + let name_1 = FileName::Custom("crlf_source_1".to_string()); let source = "/// doc comment\r\nfn foo() {}".to_string(); - let item = parse_item_from_source_str(name.clone(), source, &sess) + let item = parse_item_from_source_str(name_1, source, &sess) .unwrap().unwrap(); let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap(); assert_eq!(doc, "/// doc comment"); + let name_2 = FileName::Custom("crlf_source_2".to_string()); let source = "/// doc comment\r\n/// line 2\r\nfn foo() {}".to_string(); - let item = parse_item_from_source_str(name.clone(), source, &sess) + let item = parse_item_from_source_str(name_2, source, &sess) .unwrap().unwrap(); let docs = item.attrs.iter().filter(|a| a.path == "doc") .map(|a| a.value_str().unwrap().to_string()).collect::>(); let b: &[_] = &["/// doc comment".to_string(), "/// line 2".to_string()]; assert_eq!(&docs[..], b); + let name_3 = FileName::Custom("clrf_source_3".to_string()); let source = "/** doc comment\r\n * with CRLF */\r\nfn foo() {}".to_string(); - let item = parse_item_from_source_str(name, source, &sess).unwrap().unwrap(); + let item = parse_item_from_source_str(name_3, source, &sess).unwrap().unwrap(); let doc = first_attr_value_str_by_name(&item.attrs, "doc").unwrap(); assert_eq!(doc, "/** doc comment\n * with CRLF */"); }); @@ -1001,9 +1005,15 @@ mod tests { #[test] fn ttdelim_span() { + fn parse_expr_from_source_str( + name: FileName, source: String, sess: &ParseSess + ) -> PResult> { + new_parser_from_source_str(sess, name, source).parse_expr() + } + with_globals(|| { let sess = ParseSess::new(FilePathMapping::empty()); - let expr = parse::parse_expr_from_source_str(PathBuf::from("foo").into(), + let expr = parse_expr_from_source_str(PathBuf::from("foo").into(), "foo!( fn main() { body } )".to_string(), &sess).unwrap(); let tts: Vec<_> = match expr.node { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b4fc9c2c6fc..514b2952c50 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1,15 +1,5 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_target::spec::abi::{self, Abi}; -use ast::{AngleBracketedArgs, ParenthesisedArgs, AttrStyle, BareFnTy}; +use ast::{AngleBracketedArgs, ParenthesizedArgs, AttrStyle, BareFnTy}; use ast::{GenericBound, TraitBoundModifier}; use ast::Unsafety; use ast::{Mod, AnonConst, Arg, Arm, Guard, Attribute, BindingMode, TraitItemKind}; @@ -42,19 +32,21 @@ use ast::{UseTree, UseTreeKind}; use ast::{BinOpKind, UnOp}; use ast::{RangeEnd, RangeSyntax}; use {ast, attr}; +use ext::base::DummyResult; use source_map::{self, SourceMap, Spanned, respan}; -use syntax_pos::{self, Span, MultiSpan, BytePos, FileName, edition::Edition}; +use syntax_pos::{self, Span, MultiSpan, BytePos, FileName}; use errors::{self, Applicability, DiagnosticBuilder, DiagnosticId}; use parse::{self, SeqSep, classify, token}; use parse::lexer::TokenAndSpan; use parse::lexer::comments::{doc_comment_style, strip_doc_comment_decoration}; +use parse::token::DelimToken; use parse::{new_sub_parser_from_file, ParseSess, Directory, DirectoryOwnership}; use util::parser::{AssocOp, Fixity}; use print::pprust; use ptr::P; use parse::PResult; use ThinVec; -use tokenstream::{self, Delimited, DelimSpan, ThinTokenStream, TokenTree, TokenStream}; +use tokenstream::{self, DelimSpan, TokenTree, TokenStream, TreeAndJoint}; use symbol::{Symbol, keywords}; use std::borrow::Cow; @@ -92,12 +84,12 @@ pub enum PathStyle { /// `x` - comparisons, `x::` - unambiguously a path. Expr, /// In other contexts, notably in types, no ambiguity exists and paths can be written - /// without the disambiguator, e.g. `x` - unambiguously a path. + /// without the disambiguator, e.g., `x` - unambiguously a path. /// Paths with disambiguators are still accepted, `x::` - unambiguously a path too. Type, - /// A path with generic arguments disallowed, e.g. `foo::bar::Baz`, used in imports, + /// A path with generic arguments disallowed, e.g., `foo::bar::Baz`, used in imports, /// visibilities or attributes. - /// Technically, this variant is unnecessary and e.g. `Expr` can be used instead + /// Technically, this variant is unnecessary and e.g., `Expr` can be used instead /// (paths in "mod" contexts have to be checked later for absence of generic arguments /// anyway, due to macros), but it is used to avoid weird suggestions about expected /// tokens when something goes wrong. @@ -108,6 +100,7 @@ pub enum PathStyle { enum SemiColonMode { Break, Ignore, + Comma, } #[derive(Clone, Copy, PartialEq, Debug)] @@ -250,6 +243,12 @@ pub struct Parser<'a> { desugar_doc_comments: bool, /// Whether we should configure out of line modules as we parse. pub cfg_mods: bool, + /// This field is used to keep track of how many left angle brackets we have seen. This is + /// required in order to detect extra leading left angle brackets (`<` characters) and error + /// appropriately. + /// + /// See the comments in the `parse_path_segment` function for more details. + crate unmatched_angle_bracket_count: u32, } @@ -288,18 +287,18 @@ struct TokenCursorFrame { /// on the parser. #[derive(Clone)] enum LastToken { - Collecting(Vec), - Was(Option), + Collecting(Vec), + Was(Option), } impl TokenCursorFrame { - fn new(sp: DelimSpan, delimited: &Delimited) -> Self { + fn new(sp: DelimSpan, delim: DelimToken, tts: &TokenStream) -> Self { TokenCursorFrame { - delim: delimited.delim, + delim: delim, span: sp, - open_delim: delimited.delim == token::NoDelim, - tree_cursor: delimited.stream().into_trees(), - close_delim: delimited.delim == token::NoDelim, + open_delim: delim == token::NoDelim, + tree_cursor: tts.clone().into_trees(), + close_delim: delim == token::NoDelim, last_token: LastToken::Was(None), } } @@ -310,14 +309,12 @@ impl TokenCursor { loop { let tree = if !self.frame.open_delim { self.frame.open_delim = true; - Delimited { delim: self.frame.delim, tts: TokenStream::empty().into() } - .open_tt(self.frame.span.open) + TokenTree::open_tt(self.frame.span.open, self.frame.delim) } else if let Some(tree) = self.frame.tree_cursor.next() { tree } else if !self.frame.close_delim { self.frame.close_delim = true; - Delimited { delim: self.frame.delim, tts: TokenStream::empty().into() } - .close_tt(self.frame.span.close) + TokenTree::close_tt(self.frame.span.close, self.frame.delim) } else if let Some(frame) = self.stack.pop() { self.frame = frame; continue @@ -332,8 +329,8 @@ impl TokenCursor { match tree { TokenTree::Token(sp, tok) => return TokenAndSpan { tok: tok, sp: sp }, - TokenTree::Delimited(sp, ref delimited) => { - let frame = TokenCursorFrame::new(sp, delimited); + TokenTree::Delimited(sp, delim, tts) => { + let frame = TokenCursorFrame::new(sp, delim, &tts); self.stack.push(mem::replace(&mut self.frame, frame)); } } @@ -362,25 +359,28 @@ impl TokenCursor { } let delim_span = DelimSpan::from_single(sp); - let body = TokenTree::Delimited(delim_span, Delimited { - delim: token::Bracket, - tts: [TokenTree::Token(sp, token::Ident(ast::Ident::from_str("doc"), false)), - TokenTree::Token(sp, token::Eq), - TokenTree::Token(sp, token::Literal( - token::StrRaw(Symbol::intern(&stripped), num_of_hashes), None))] - .iter().cloned().collect::().into(), - }); + let body = TokenTree::Delimited( + delim_span, + token::Bracket, + [TokenTree::Token(sp, token::Ident(ast::Ident::from_str("doc"), false)), + TokenTree::Token(sp, token::Eq), + TokenTree::Token(sp, token::Literal( + token::StrRaw(Symbol::intern(&stripped), num_of_hashes), None)) + ] + .iter().cloned().collect::().into(), + ); - self.stack.push(mem::replace(&mut self.frame, TokenCursorFrame::new(delim_span, &Delimited { - delim: token::NoDelim, - tts: if doc_comment_style(&name.as_str()) == AttrStyle::Inner { + self.stack.push(mem::replace(&mut self.frame, TokenCursorFrame::new( + delim_span, + token::NoDelim, + &if doc_comment_style(&name.as_str()) == AttrStyle::Inner { [TokenTree::Token(sp, token::Pound), TokenTree::Token(sp, token::Not), body] .iter().cloned().collect::().into() } else { [TokenTree::Token(sp, token::Pound), body] .iter().cloned().collect::().into() }, - }))); + ))); self.next() } @@ -561,14 +561,16 @@ impl<'a> Parser<'a> { root_module_name: None, expected_tokens: Vec::new(), token_cursor: TokenCursor { - frame: TokenCursorFrame::new(DelimSpan::dummy(), &Delimited { - delim: token::NoDelim, - tts: tokens.into(), - }), + frame: TokenCursorFrame::new( + DelimSpan::dummy(), + token::NoDelim, + &tokens.into(), + ), stack: Vec::new(), }, desugar_doc_comments, cfg_mods: true, + unmatched_angle_bracket_count: 0, }; let tok = parser.next_tok(); @@ -734,7 +736,7 @@ impl<'a> Parser<'a> { }; let mut err = self.fatal(&msg_exp); if self.token.is_ident_named("and") { - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( self.span, "use `&&` instead of `and` for the boolean operator", "&&".to_string(), @@ -742,7 +744,7 @@ impl<'a> Parser<'a> { ); } if self.token.is_ident_named("or") { - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( self.span, "use `||` instead of `or` for the boolean operator", "||".to_string(), @@ -804,12 +806,24 @@ impl<'a> Parser<'a> { let mut err = self.struct_span_err(self.span, &format!("expected identifier, found {}", self.this_token_descr())); + if let token::Ident(ident, false) = &self.token { + if ident.is_reserved() && !ident.is_path_segment_keyword() && + ident.name != keywords::Underscore.name() + { + err.span_suggestion( + self.span, + "you can escape reserved keywords to use them as identifiers", + format!("r#{}", ident), + Applicability::MaybeIncorrect, + ); + } + } if let Some(token_descr) = self.token_descr() { err.span_label(self.span, format!("expected identifier, found {}", token_descr)); } else { err.span_label(self.span, "expected identifier"); if self.token == token::Comma && self.look_ahead(1, |t| t.is_ident()) { - err.span_suggestion_with_applicability( + err.span_suggestion( self.span, "remove this comma", String::new(), @@ -1006,7 +1020,10 @@ impl<'a> Parser<'a> { if text.is_empty() { self.span_bug(sp, "found empty literal suffix in Some") } - self.span_err(sp, &format!("{} with a suffix is invalid", kind)); + let msg = format!("{} with a suffix is invalid", kind); + self.struct_span_err(sp, &msg) + .span_label(sp, msg) + .emit(); } } } @@ -1018,7 +1035,7 @@ impl<'a> Parser<'a> { /// starting token. fn eat_lt(&mut self) -> bool { self.expected_tokens.push(TokenType::Token(token::Lt)); - match self.token { + let ate = match self.token { token::Lt => { self.bump(); true @@ -1029,7 +1046,15 @@ impl<'a> Parser<'a> { true } _ => false, + }; + + if ate { + // See doc comment for `unmatched_angle_bracket_count`. + self.unmatched_angle_bracket_count += 1; + debug!("eat_lt: (increment) count={:?}", self.unmatched_angle_bracket_count); } + + ate } fn expect_lt(&mut self) -> PResult<'a, ()> { @@ -1045,24 +1070,35 @@ impl<'a> Parser<'a> { /// signal an error. fn expect_gt(&mut self) -> PResult<'a, ()> { self.expected_tokens.push(TokenType::Token(token::Gt)); - match self.token { + let ate = match self.token { token::Gt => { self.bump(); - Ok(()) + Some(()) } token::BinOp(token::Shr) => { let span = self.span.with_lo(self.span.lo() + BytePos(1)); - Ok(self.bump_with(token::Gt, span)) + Some(self.bump_with(token::Gt, span)) } token::BinOpEq(token::Shr) => { let span = self.span.with_lo(self.span.lo() + BytePos(1)); - Ok(self.bump_with(token::Ge, span)) + Some(self.bump_with(token::Ge, span)) } token::Ge => { let span = self.span.with_lo(self.span.lo() + BytePos(1)); - Ok(self.bump_with(token::Eq, span)) + Some(self.bump_with(token::Eq, span)) } - _ => self.unexpected() + _ => None, + }; + + match ate { + Some(x) => { + // See doc comment for `unmatched_angle_bracket_count`. + self.unmatched_angle_bracket_count -= 1; + debug!("expect_gt: (decrement) count={:?}", self.unmatched_angle_bracket_count); + + Ok(x) + }, + None => self.unexpected(), } } @@ -1238,7 +1274,7 @@ impl<'a> Parser<'a> { f(&match self.token_cursor.frame.tree_cursor.look_ahead(dist - 1) { Some(tree) => match tree { TokenTree::Token(_, tok) => tok, - TokenTree::Delimited(_, delimited) => token::OpenDelim(delimited.delim), + TokenTree::Delimited(_, delim, _) => token::OpenDelim(delim), }, None => token::CloseDelim(self.token_cursor.frame.delim), }) @@ -1251,7 +1287,7 @@ impl<'a> Parser<'a> { match self.token_cursor.frame.tree_cursor.look_ahead(dist - 1) { Some(TokenTree::Token(span, _)) => span, - Some(TokenTree::Delimited(span, _)) => span.entire(), + Some(TokenTree::Delimited(span, ..)) => span.entire(), None => self.look_ahead_span(dist - 1), } } @@ -1276,9 +1312,6 @@ impl<'a> Parser<'a> { crate fn span_bug>(&self, sp: S, m: &str) -> ! { self.sess.span_diagnostic.span_bug(sp, m) } - crate fn abort_if_errors(&self) { - self.sess.span_diagnostic.abort_if_errors(); - } fn cancel(&self, err: &mut DiagnosticBuilder) { self.sess.span_diagnostic.cancel(err) @@ -1293,7 +1326,7 @@ impl<'a> Parser<'a> { fn token_is_bare_fn_keyword(&mut self) -> bool { self.check_keyword(keywords::Fn) || self.check_keyword(keywords::Unsafe) || - self.check_keyword(keywords::Extern) && self.is_extern_non_path() + self.check_keyword(keywords::Extern) } /// parse a `TyKind::BareFn` type: @@ -1404,11 +1437,7 @@ impl<'a> Parser<'a> { // definition... // We don't allow argument names to be left off in edition 2018. - if p.span.edition() >= Edition::Edition2018 { - p.parse_arg_general(true) - } else { - p.parse_arg_general(false) - } + p.parse_arg_general(p.span.rust_2018(), true) })?; generics.where_clause = self.parse_where_clause()?; @@ -1601,9 +1630,9 @@ impl<'a> Parser<'a> { impl_dyn_multi = bounds.len() > 1 || self.prev_token_kind == PrevTokenKind::Plus; TyKind::ImplTrait(ast::DUMMY_NODE_ID, bounds) } else if self.check_keyword(keywords::Dyn) && - (self.span.edition() == Edition::Edition2018 || + (self.span.rust_2018() || self.look_ahead(1, |t| t.can_begin_bound() && - !can_continue_type_after_non_fn_ident(t))) { + !can_continue_type_after_non_fn_ident(t))) { self.bump(); // `dyn` // Always parse bounds greedily for better error recovery. let bounds = self.parse_generic_bounds()?; @@ -1667,7 +1696,7 @@ impl<'a> Parser<'a> { if !allow_plus && impl_dyn_multi { let sum_with_parens = format!("({})", pprust::ty_to_string(&ty)); self.struct_span_err(ty.span, "ambiguous `+` in a type") - .span_suggestion_with_applicability( + .span_suggestion( ty.span, "use parentheses to disambiguate", sum_with_parens, @@ -1702,7 +1731,7 @@ impl<'a> Parser<'a> { s.print_type_bounds(" +", &bounds)?; s.pclose() }); - err.span_suggestion_with_applicability( + err.span_suggestion( sum_span, "try adding parentheses", sum_with_parens, @@ -1745,7 +1774,7 @@ impl<'a> Parser<'a> { self.diagnostic() .struct_span_err(span, "missing angle brackets in associated item path") - .span_suggestion_with_applicability( // this is a best-effort recovery + .span_suggestion( // this is a best-effort recovery span, "try", recovered.to_string(), Applicability::MaybeIncorrect ).emit(); @@ -1766,9 +1795,11 @@ impl<'a> Parser<'a> { Mutability::Immutable } else { let span = self.prev_span; - self.span_err(span, - "expected mut or const in raw pointer type (use \ - `*mut T` or `*const T` as appropriate)"); + let msg = "expected mut or const in raw pointer type"; + self.struct_span_err(span, msg) + .span_label(span, msg) + .help("use `*mut T` or `*const T` as appropriate") + .emit(); Mutability::Immutable }; let t = self.parse_ty_no_plus()?; @@ -1821,9 +1852,17 @@ impl<'a> Parser<'a> { /// This version of parse arg doesn't necessarily require /// identifier names. - fn parse_arg_general(&mut self, require_name: bool) -> PResult<'a, Arg> { + fn parse_arg_general(&mut self, require_name: bool, is_trait_item: bool) -> PResult<'a, Arg> { maybe_whole!(self, NtArg, |x| x); + if let Ok(Some(_)) = self.parse_self_arg() { + let mut err = self.struct_span_err(self.prev_span, + "unexpected `self` argument in function"); + err.span_label(self.prev_span, + "`self` is only valid as the first argument of an associated function"); + return Err(err); + } + let (pat, ty) = if require_name || self.is_named_argument() { debug!("parse_arg_general parse_pat (require_name:{})", require_name); @@ -1839,12 +1878,23 @@ impl<'a> Parser<'a> { let ident = self.parse_ident().unwrap(); let span = pat.span.with_hi(ident.span.hi()); - err.span_suggestion_with_applicability( + err.span_suggestion( span, "declare the type after the parameter binding", String::from(": "), Applicability::HasPlaceholders, ); + } else if require_name && is_trait_item { + if let PatKind::Ident(_, ident, _) = pat.node { + err.span_suggestion( + pat.span, + "explicitly ignore parameter", + format!("_: {}", ident), + Applicability::MachineApplicable, + ); + } + + err.note("anonymous parameters are removed in the 2018 edition (see RFC 1685)"); } return Err(err); @@ -1857,7 +1907,8 @@ impl<'a> Parser<'a> { let parser_snapshot_before_ty = self.clone(); self.eat_incorrect_doc_comment("a method argument's type"); let mut ty = self.parse_ty(); - if ty.is_ok() && self.token == token::Colon { + if ty.is_ok() && self.token != token::Comma && + self.token != token::CloseDelim(token::Paren) { // This wasn't actually a type, but a pattern looking like a type, // so we are going to rollback and re-parse for recovery. ty = self.unexpected(); @@ -1886,7 +1937,7 @@ impl<'a> Parser<'a> { "patterns aren't allowed in methods without bodies", DiagnosticId::Error("E0642".into()), ); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( pat.span, "give this argument a name or use an underscore to ignore it", "_".to_owned(), @@ -1910,10 +1961,10 @@ impl<'a> Parser<'a> { /// Parse a single function argument crate fn parse_arg(&mut self) -> PResult<'a, Arg> { - self.parse_arg_general(true) + self.parse_arg_general(true, false) } - /// Parse an argument in a lambda header e.g. |arg, arg| + /// Parse an argument in a lambda header e.g., |arg, arg| fn parse_fn_block_arg(&mut self) -> PResult<'a, Arg> { let pat = self.parse_pat(Some("argument name"))?; let t = if self.eat(&token::Colon) { @@ -1961,6 +2012,44 @@ impl<'a> Parser<'a> { result.unwrap() } + token::Dot if self.look_ahead(1, |t| match t { + token::Literal(parse::token::Lit::Integer(_) , _) => true, + _ => false, + }) => { // recover from `let x = .4;` + let lo = self.span; + self.bump(); + if let token::Literal( + parse::token::Lit::Integer(val), + suffix, + ) = self.token { + let suffix = suffix.and_then(|s| { + let s = s.as_str().get(); + if ["f32", "f64"].contains(&s) { + Some(s) + } else { + None + } + }).unwrap_or(""); + self.bump(); + let sp = lo.to(self.prev_span); + let mut err = self.diagnostic() + .struct_span_err(sp, "float literals must have an integer part"); + err.span_suggestion( + sp, + "must have an integer part", + format!("0.{}{}", val, suffix), + Applicability::MachineApplicable, + ); + err.emit(); + return Ok(match suffix { + "f32" => ast::LitKind::Float(val, ast::FloatTy::F32), + "f64" => ast::LitKind::Float(val, ast::FloatTy::F64), + _ => ast::LitKind::FloatUnsuffixed(val), + }); + } else { + unreachable!(); + }; + } _ => { return self.unexpected_last(&self.token); } }; @@ -2013,6 +2102,17 @@ impl<'a> Parser<'a> { } } + fn parse_ident_or_underscore(&mut self) -> PResult<'a, ast::Ident> { + match self.token { + token::Ident(ident, false) if ident.name == keywords::Underscore.name() => { + let span = self.span; + self.bump(); + Ok(Ident::new(ident.name, span)) + } + _ => self.parse_ident(), + } + } + /// Parses qualified path. /// Assumes that the leading `<` has been parsed already. /// @@ -2041,7 +2141,11 @@ impl<'a> Parser<'a> { path_span = self.span.to(self.span); } + // See doc comment for `unmatched_angle_bracket_count`. self.expect(&token::Gt)?; + self.unmatched_angle_bracket_count -= 1; + debug!("parse_qpath: (decrement) count={:?}", self.unmatched_angle_bracket_count); + self.expect(&token::ModSep)?; let qself = QSelf { ty, path_span, position: path.segments.len() }; @@ -2076,8 +2180,9 @@ impl<'a> Parser<'a> { let lo = self.meta_var_span.unwrap_or(self.span); let mut segments = Vec::new(); + let mod_sep_ctxt = self.span.ctxt(); if self.eat(&token::ModSep) { - segments.push(PathSegment::crate_root(lo.shrink_to_lo())); + segments.push(PathSegment::path_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt))); } self.parse_path_segments(&mut segments, style, enable_warning)?; @@ -2110,7 +2215,27 @@ impl<'a> Parser<'a> { enable_warning: bool) -> PResult<'a, ()> { loop { - segments.push(self.parse_path_segment(style, enable_warning)?); + let segment = self.parse_path_segment(style, enable_warning)?; + if style == PathStyle::Expr { + // In order to check for trailing angle brackets, we must have finished + // recursing (`parse_path_segment` can indirectly call this function), + // that is, the next token must be the highlighted part of the below example: + // + // `Foo::>::Qux` + // ^ here + // + // As opposed to the below highlight (if we had only finished the first + // recursion): + // + // `Foo::>::Qux` + // ^ here + // + // `PathStyle::Expr` is only provided at the root invocation and never in + // `parse_path_segment` to recurse and therefore can be checked to maintain + // this invariant. + self.check_trailing_angle_brackets(&segment, token::ModSep); + } + segments.push(segment); if self.is_import_coupler() || !self.eat(&token::ModSep) { return Ok(()); @@ -2137,15 +2262,21 @@ impl<'a> Parser<'a> { style != PathStyle::Mod && self.check(&token::ModSep) && self.look_ahead(1, |t| is_args_start(t)) { // Generic arguments are found - `<`, `(`, `::<` or `::(`. - let lo = self.span; if self.eat(&token::ModSep) && style == PathStyle::Type && enable_warning { self.diagnostic().struct_span_warn(self.prev_span, "unnecessary path disambiguator") .span_label(self.prev_span, "try removing `::`").emit(); } + let lo = self.span; + + // We use `style == PathStyle::Expr` to check if this is in a recursion or not. If + // it isn't, then we reset the unmatched angle bracket count as we're about to start + // parsing a new path. + if style == PathStyle::Expr { self.unmatched_angle_bracket_count = 0; } let args = if self.eat_lt() { // `<'a, T, A = U>` - let (args, bindings) = self.parse_generic_args()?; + let (args, bindings) = + self.parse_generic_args_with_leaning_angle_bracket_recovery(style, lo)?; self.expect_gt()?; let span = lo.to(self.prev_span); AngleBracketedArgs { args, bindings, span }.into() @@ -2164,7 +2295,7 @@ impl<'a> Parser<'a> { } else { None }; - ParenthesisedArgs { inputs, output, span }.into() + ParenthesizedArgs { inputs, output, span }.into() }; PathSegment { ident, args, id: ast::DUMMY_NODE_ID } @@ -2224,8 +2355,24 @@ impl<'a> Parser<'a> { let lo = self.span; // Check if a colon exists one ahead. This means we're parsing a fieldname. - let (fieldname, expr, is_shorthand) = if self.look_ahead(1, |t| t == &token::Colon) { + let (fieldname, expr, is_shorthand) = if self.look_ahead(1, |t| { + t == &token::Colon || t == &token::Eq + }) { let fieldname = self.parse_field_name()?; + + // Check for an equals token. This means the source incorrectly attempts to + // initialize a field with an eq rather than a colon. + if self.token == token::Eq { + self.diagnostic() + .struct_span_err(self.span, "expected `:`, found `=`") + .span_suggestion( + fieldname.span.shrink_to_hi().to(self.span), + "replace equals symbol with a colon", + ":".to_string(), + Applicability::MachineApplicable, + ) + .emit(); + } self.bump(); // `:` (fieldname, self.parse_expr()?, false) } else { @@ -2291,7 +2438,7 @@ impl<'a> Parser<'a> { }) } - fn expect_delimited_token_tree(&mut self) -> PResult<'a, (MacDelimiter, ThinTokenStream)> { + fn expect_delimited_token_tree(&mut self) -> PResult<'a, (MacDelimiter, TokenStream)> { let delim = match self.token { token::OpenDelim(delim) => delim, _ => { @@ -2301,8 +2448,8 @@ impl<'a> Parser<'a> { return Err(err) } }; - let delimited = match self.parse_token_tree() { - TokenTree::Delimited(_, delimited) => delimited, + let tts = match self.parse_token_tree() { + TokenTree::Delimited(_, _, tts) => tts, _ => unreachable!(), }; let delim = match delim { @@ -2311,14 +2458,14 @@ impl<'a> Parser<'a> { token::Brace => MacDelimiter::Brace, token::NoDelim => self.bug("unexpected no delimiter"), }; - Ok((delim, delimited.stream().into())) + Ok((delim, tts.into())) } /// At the bottom (top?) of the precedence hierarchy, /// parse things like parenthesized exprs, /// macros, return, etc. /// - /// NB: This does not parse outer attributes, + /// N.B., this does not parse outer attributes, /// and is private because it only works /// correctly if called from parse_dot_or_call_expr(). fn parse_bottom_expr(&mut self) -> PResult<'a, P> { @@ -2415,8 +2562,7 @@ impl<'a> Parser<'a> { hi = path.span; return Ok(self.mk_expr(lo.to(hi), ExprKind::Path(Some(qself), path), attrs)); } - if self.span.edition() >= Edition::Edition2018 && - self.check_keyword(keywords::Async) + if self.span.rust_2018() && self.check_keyword(keywords::Async) { if self.is_async_block() { // check for `async {` and `async move {` return self.parse_async_block(attrs); @@ -2605,7 +2751,7 @@ impl<'a> Parser<'a> { exp_span.to(self.prev_span), "cannot use a comma after the base struct", ); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( self.span, "remove this comma", String::new(), @@ -2618,8 +2764,24 @@ impl<'a> Parser<'a> { break; } + let mut recovery_field = None; + if let token::Ident(ident, _) = self.token { + if !self.token.is_reserved_ident() && self.look_ahead(1, |t| *t == token::Colon) { + // Use in case of error after field-looking code: `S { foo: () with a }` + let mut ident = ident.clone(); + ident.span = self.span; + recovery_field = Some(ast::Field { + ident, + span: self.span, + expr: self.mk_expr(self.span, ExprKind::Err, ThinVec::new()), + is_shorthand: false, + attrs: ThinVec::new(), + }); + } + } + let mut parsed_field = None; match self.parse_field() { - Ok(f) => fields.push(f), + Ok(f) => parsed_field = Some(f), Err(mut e) => { e.span_label(struct_sp, "while parsing this struct"); e.emit(); @@ -2628,19 +2790,28 @@ impl<'a> Parser<'a> { // what comes next as additional fields, rather than // bailing out until next `}`. if self.token != token::Comma { - self.recover_stmt(); - break; + self.recover_stmt_(SemiColonMode::Comma, BlockMode::Ignore); + if self.token != token::Comma { + break; + } } } } match self.expect_one_of(&[token::Comma], &[token::CloseDelim(token::Brace)]) { - Ok(()) => {} + Ok(()) => if let Some(f) = parsed_field.or(recovery_field) { + // only include the field if there's no parse error for the field name + fields.push(f); + } Err(mut e) => { + if let Some(f) = recovery_field { + fields.push(f); + } + e.span_label(struct_sp, "while parsing this struct"); e.emit(); - self.recover_stmt(); - break; + self.recover_stmt_(SemiColonMode::Comma, BlockMode::Ignore); + self.eat(&token::Comma); } } } @@ -2719,6 +2890,8 @@ impl<'a> Parser<'a> { // Assuming we have just parsed `.`, continue parsing into an expression. fn parse_dot_suffix(&mut self, self_arg: P, lo: Span) -> PResult<'a, P> { let segment = self.parse_path_segment(PathStyle::Expr, true)?; + self.check_trailing_angle_brackets(&segment, token::OpenDelim(token::Paren)); + Ok(match self.token { token::OpenDelim(token::Paren) => { // Method call `expr.f()` @@ -2746,6 +2919,116 @@ impl<'a> Parser<'a> { }) } + /// This function checks if there are trailing angle brackets and produces + /// a diagnostic to suggest removing them. + /// + /// ```ignore (diagnostic) + /// let _ = vec![1, 2, 3].into_iter().collect::>>>(); + /// ^^ help: remove extra angle brackets + /// ``` + fn check_trailing_angle_brackets(&mut self, segment: &PathSegment, end: token::Token) { + // This function is intended to be invoked after parsing a path segment where there are two + // cases: + // + // 1. A specific token is expected after the path segment. + // eg. `x.foo(`, `x.foo::(` (parenthesis - method call), + // `Foo::`, or `Foo::::` (mod sep - continued path). + // 2. No specific token is expected after the path segment. + // eg. `x.foo` (field access) + // + // This function is called after parsing `.foo` and before parsing the token `end` (if + // present). This includes any angle bracket arguments, such as `.foo::` or + // `Foo::`. + + // We only care about trailing angle brackets if we previously parsed angle bracket + // arguments. This helps stop us incorrectly suggesting that extra angle brackets be + // removed in this case: + // + // `x.foo >> (3)` (where `x.foo` is a `u32` for example) + // + // This case is particularly tricky as we won't notice it just looking at the tokens - + // it will appear the same (in terms of upcoming tokens) as below (since the `::` will + // have already been parsed): + // + // `x.foo::>>(3)` + let parsed_angle_bracket_args = segment.args + .as_ref() + .map(|args| args.is_angle_bracketed()) + .unwrap_or(false); + + debug!( + "check_trailing_angle_brackets: parsed_angle_bracket_args={:?}", + parsed_angle_bracket_args, + ); + if !parsed_angle_bracket_args { + return; + } + + // Keep the span at the start so we can highlight the sequence of `>` characters to be + // removed. + let lo = self.span; + + // We need to look-ahead to see if we have `>` characters without moving the cursor forward + // (since we might have the field access case and the characters we're eating are + // actual operators and not trailing characters - ie `x.foo >> 3`). + let mut position = 0; + + // We can encounter `>` or `>>` tokens in any order, so we need to keep track of how + // many of each (so we can correctly pluralize our error messages) and continue to + // advance. + let mut number_of_shr = 0; + let mut number_of_gt = 0; + while self.look_ahead(position, |t| { + trace!("check_trailing_angle_brackets: t={:?}", t); + if *t == token::BinOp(token::BinOpToken::Shr) { + number_of_shr += 1; + true + } else if *t == token::Gt { + number_of_gt += 1; + true + } else { + false + } + }) { + position += 1; + } + + // If we didn't find any trailing `>` characters, then we have nothing to error about. + debug!( + "check_trailing_angle_brackets: number_of_gt={:?} number_of_shr={:?}", + number_of_gt, number_of_shr, + ); + if number_of_gt < 1 && number_of_shr < 1 { + return; + } + + // Finally, double check that we have our end token as otherwise this is the + // second case. + if self.look_ahead(position, |t| { + trace!("check_trailing_angle_brackets: t={:?}", t); + *t == end + }) { + // Eat from where we started until the end token so that parsing can continue + // as if we didn't have those extra angle brackets. + self.eat_to_tokens(&[&end]); + let span = lo.until(self.span); + + let plural = number_of_gt > 1 || number_of_shr >= 1; + self.diagnostic() + .struct_span_err( + span, + &format!("unmatched angle bracket{}", if plural { "s" } else { "" }), + ) + .span_suggestion( + span, + &format!("remove extra angle bracket{}", if plural { "s" } else { "" }), + String::new(), + Applicability::MachineApplicable, + ) + .emit(); + } + } + fn parse_dot_or_call_expr_with_(&mut self, e0: P, lo: Span) -> PResult<'a, P> { let mut e = e0; let mut hi; @@ -2787,9 +3070,9 @@ impl<'a> Parser<'a> { s.print_usize(float.trunc() as usize)?; s.pclose()?; s.s.word(".")?; - s.s.word(fstr.splitn(2, ".").last().unwrap()) + s.s.word(fstr.splitn(2, ".").last().unwrap().to_string()) }); - err.span_suggestion_with_applicability( + err.span_suggestion( lo.to(self.prev_span), "try parenthesizing the first index", sugg, @@ -2851,6 +3134,7 @@ impl<'a> Parser<'a> { let mut err = self.fatal(&format!("unknown macro variable `{}`", name)); err.span_label(self.span, "unknown macro variable"); err.emit(); + self.bump(); return } token::Interpolated(ref nt) => { @@ -2877,10 +3161,11 @@ impl<'a> Parser<'a> { self.token_cursor.stack.pop().unwrap()); self.span = frame.span.entire(); self.bump(); - TokenTree::Delimited(frame.span, Delimited { - delim: frame.delim, - tts: frame.tree_cursor.original_stream().into(), - }) + TokenTree::Delimited( + frame.span, + frame.delim, + frame.tree_cursor.stream.into(), + ) }, token::CloseDelim(_) | token::Eof => unreachable!(), _ => { @@ -2909,7 +3194,7 @@ impl<'a> Parser<'a> { _ => result.push(self.parse_token_tree().into()), } } - TokenStream::concat(result) + TokenStream::new(result) } /// Parse a prefix-unary-operator expr @@ -2934,7 +3219,7 @@ impl<'a> Parser<'a> { let span_of_tilde = lo; let mut err = self.diagnostic() .struct_span_err(span_of_tilde, "`~` cannot be used as a unary operator"); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( span_of_tilde, "use `!` to perform bitwise negation", "!".to_owned(), @@ -3007,7 +3292,7 @@ impl<'a> Parser<'a> { // trailing whitespace after the `!` in our suggestion let to_replace = self.sess.source_map() .span_until_non_whitespace(lo.to(self.span)); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( to_replace, "use `!` to perform logical negation", "!".to_owned(), @@ -3032,6 +3317,7 @@ impl<'a> Parser<'a> { /// /// This parses an expression accounting for associativity and precedence of the operators in /// the expression. + #[inline] fn parse_assoc_expr(&mut self, already_parsed_attrs: Option>) -> PResult<'a, P> { @@ -3107,7 +3393,7 @@ impl<'a> Parser<'a> { let cur_pos = cm.lookup_char_pos(self.span.lo()); let op_pos = cm.lookup_char_pos(cur_op_span.hi()); if cur_pos.line != op_pos.line { - err.span_suggestion_with_applicability( + err.span_suggestion( cur_op_span, "try using a semicolon", ";".to_string(), @@ -3141,7 +3427,7 @@ impl<'a> Parser<'a> { RangeLimits::Closed }; - let r = try!(self.mk_range(Some(lhs), rhs, limits)); + let r = self.mk_range(Some(lhs), rhs, limits)?; lhs = self.mk_expr(lhs_span.to(rhs_span), r, ThinVec::new()); break } @@ -3266,7 +3552,7 @@ impl<'a> Parser<'a> { let expr_str = self.sess.source_map().span_to_snippet(expr.span) .unwrap_or_else(|_| pprust::expr_to_string(&expr)); - err.span_suggestion_with_applicability( + err.span_suggestion( expr.span, &format!("try {} the cast value", op_verb), format!("({})", expr_str), @@ -3349,9 +3635,7 @@ impl<'a> Parser<'a> { RangeLimits::Closed }; - let r = try!(self.mk_range(None, - opt_end, - limits)); + let r = self.mk_range(None, opt_end, limits)?; Ok(self.mk_expr(lo.to(hi), r, attrs)) } @@ -3432,7 +3716,7 @@ impl<'a> Parser<'a> { } else { Movability::Movable }; - let asyncness = if self.span.edition() >= Edition::Edition2018 { + let asyncness = if self.span.rust_2018() { self.parse_asyncness() } else { IsAsync::NotAsync @@ -3484,7 +3768,7 @@ impl<'a> Parser<'a> { let in_span = self.prev_span.between(self.span); let mut err = self.sess.span_diagnostic .struct_span_err(in_span, "missing `in` in `for` loop"); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( in_span, "try adding `in` here", " in ".into(), // has been misleading, at least in the past (closed Issue #48492) Applicability::MaybeIncorrect @@ -3498,7 +3782,7 @@ impl<'a> Parser<'a> { self.prev_span, "expected iterable, found keyword `in`", ); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( in_span.until(self.prev_span), "remove the duplicated `in`", String::new(), @@ -3590,7 +3874,7 @@ impl<'a> Parser<'a> { None)?; if let Err(mut e) = self.expect(&token::OpenDelim(token::Brace)) { if self.token == token::Token::Semi { - e.span_suggestion_short_with_applicability( + e.span_suggestion_short( match_span, "try removing this `match`", String::new(), @@ -3626,8 +3910,6 @@ impl<'a> Parser<'a> { maybe_whole!(self, NtArm, |x| x); let attrs = self.parse_outer_attributes()?; - // Allow a '|' before the pats (RFC 1925) - self.eat(&token::BinOp(token::Or)); let pats = self.parse_pats()?; let guard = if self.eat_keyword(keywords::If) { Some(Guard::If(self.parse_expr()?)) @@ -3667,7 +3949,7 @@ impl<'a> Parser<'a> { // | - ^^ self.span // | | // | parsed until here as `"y" & X` - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( cm.next_point(arm_start_span), "missing a comma here to end this `match` arm", ",".to_owned(), @@ -3694,6 +3976,7 @@ impl<'a> Parser<'a> { } /// Parse an expression + #[inline] pub fn parse_expr(&mut self) -> PResult<'a, P> { self.parse_expr_res(Restrictions::empty(), None) } @@ -3713,13 +3996,14 @@ impl<'a> Parser<'a> { } /// Parse an expression, subject to the given restrictions + #[inline] fn parse_expr_res(&mut self, r: Restrictions, already_parsed_attrs: Option>) -> PResult<'a, P> { self.with_res(r, |this| this.parse_assoc_expr(already_parsed_attrs)) } - /// Parse the RHS of a local variable declaration (e.g. '= 14;') + /// Parse the RHS of a local variable declaration (e.g., '= 14;') fn parse_initializer(&mut self, skip_eq: bool) -> PResult<'a, Option>> { if self.eat(&token::Eq) { Ok(Some(self.parse_expr()?)) @@ -3732,6 +4016,9 @@ impl<'a> Parser<'a> { /// Parse patterns, separated by '|' s fn parse_pats(&mut self) -> PResult<'a, Vec>> { + // Allow a '|' before the pats (RFC 1925 + RFC 2530) + self.eat(&token::BinOp(token::Or)); + let mut pats = Vec::new(); loop { pats.push(self.parse_top_level_pat()?); @@ -3739,7 +4026,7 @@ impl<'a> Parser<'a> { if self.token == token::OrOr { let mut err = self.struct_span_err(self.span, "unexpected token `||` after pattern"); - err.span_suggestion_with_applicability( + err.span_suggestion( self.span, "use a single `|` to specify multiple patterns", "|".to_owned(), @@ -3778,8 +4065,12 @@ impl<'a> Parser<'a> { ddpos = Some(fields.len()); } else { // Emit a friendly error, ignore `..` and continue parsing - self.span_err(self.prev_span, - "`..` can only be used once per tuple or tuple struct pattern"); + self.struct_span_err( + self.prev_span, + "`..` can only be used once per tuple or tuple struct pattern", + ) + .span_label(self.prev_span, "can only be used once per pattern") + .emit(); } } else if !self.check(&token::CloseDelim(token::Paren)) { fields.push(self.parse_pat(None)?); @@ -3795,7 +4086,10 @@ impl<'a> Parser<'a> { if ddpos == Some(fields.len()) && trailing_comma { // `..` needs to be followed by `)` or `, pat`, `..,)` is disallowed. - self.span_err(self.prev_span, "trailing comma is not permitted after `..`"); + let msg = "trailing comma is not permitted after `..`"; + self.struct_span_err(self.prev_span, msg) + .span_label(self.prev_span, msg) + .emit(); } Ok((fields, ddpos, trailing_comma)) @@ -3940,7 +4234,7 @@ impl<'a> Parser<'a> { // Accept `...` as if it were `..` to avoid further errors let mut err = self.struct_span_err(self.span, "expected field pattern, found `...`"); - err.span_suggestion_with_applicability( + err.span_suggestion( self.span, "to omit remaining fields, use one fewer `.`", "..".to_owned(), @@ -3948,7 +4242,7 @@ impl<'a> Parser<'a> { ); err.emit(); } - self.bump(); // `..` || `...`:w + self.bump(); // `..` || `...` if self.token == token::CloseDelim(token::Brace) { etc_span = Some(etc_sp); @@ -3968,11 +4262,11 @@ impl<'a> Parser<'a> { ate_comma = true; } - etc_span = Some(etc_sp); + etc_span = Some(etc_sp.until(self.span)); if self.token == token::CloseDelim(token::Brace) { // If the struct looks otherwise well formed, recover and continue. if let Some(sp) = comma_sp { - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( sp, "remove this comma", String::new(), @@ -4020,6 +4314,7 @@ impl<'a> Parser<'a> { (etc_span, String::new()), (self.span, format!("{}.. }}", if ate_comma { "" } else { ", " })), ], + Applicability::MachineApplicable, ); } err.emit(); @@ -4084,11 +4379,16 @@ impl<'a> Parser<'a> { let mut err = self.struct_span_err(comma_span, "unexpected `,` in pattern"); if let Ok(seq_snippet) = self.sess.source_map().span_to_snippet(seq_span) { - err.span_suggestion_with_applicability( + err.span_suggestion( seq_span, - "try adding parentheses", + "try adding parentheses to match on a tuple..", format!("({})", seq_snippet), Applicability::MachineApplicable + ).span_suggestion( + seq_span, + "..or a vertical bar to match on multiple alternatives", + format!("{}", seq_snippet.replace(",", " |")), + Applicability::MachineApplicable ); } return Err(err); @@ -4101,7 +4401,7 @@ impl<'a> Parser<'a> { self.parse_pat_with_range_pat(true, expected) } - /// Parse a pattern, with a setting whether modern range patterns e.g. `a..=b`, `a..b` are + /// Parse a pattern, with a setting whether modern range patterns e.g., `a..=b`, `a..b` are /// allowed. fn parse_pat_with_range_pat( &mut self, @@ -4152,7 +4452,7 @@ impl<'a> Parser<'a> { let binding_mode = if self.eat_keyword(keywords::Ref) { self.diagnostic() .struct_span_err(mutref_span, "the order of `mut` and `ref` is incorrect") - .span_suggestion_with_applicability( + .span_suggestion( mutref_span, "try switching the order", "ref mut".into(), @@ -4296,7 +4596,7 @@ impl<'a> Parser<'a> { pat.span, "the range pattern here has ambiguous interpretation", ); - err.span_suggestion_with_applicability( + err.span_suggestion( pat.span, "add parentheses to clarify the precedence", format!("({})", pprust::pat_to_string(&pat)), @@ -4372,7 +4672,7 @@ impl<'a> Parser<'a> { (Ok(init), Some((_, colon_sp, mut err))) => { // init parsed, ty error // Could parse the type as if it were the initializer, it is likely there was a // typo in the code: `:` instead of `=`. Add suggestion and emit the error. - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( colon_sp, "use `=` if you meant to assign", "=".to_string(), @@ -4433,17 +4733,21 @@ impl<'a> Parser<'a> { } /// Emit an expected item after attributes error. - fn expected_item_err(&self, attrs: &[Attribute]) { + fn expected_item_err(&mut self, attrs: &[Attribute]) -> PResult<'a, ()> { let message = match attrs.last() { Some(&Attribute { is_sugared_doc: true, .. }) => "expected item after doc comment", _ => "expected item after attributes", }; - self.span_err(self.prev_span, message); + let mut err = self.diagnostic().struct_span_err(self.prev_span, message); + if attrs.last().unwrap().is_sugared_doc { + err.span_label(self.prev_span, "this doc comment doesn't document anything"); + } + Err(err) } /// Parse a statement. This stops just before trailing semicolons on everything but items. - /// e.g. a `StmtKind::Semi` parses to a `StmtKind::Expr`, leaving the trailing `;` unconsumed. + /// e.g., a `StmtKind::Semi` parses to a `StmtKind::Expr`, leaving the trailing `;` unconsumed. pub fn parse_stmt(&mut self) -> PResult<'a, Option> { Ok(self.parse_stmt_(true)) } @@ -4488,13 +4792,13 @@ impl<'a> Parser<'a> { token::CloseDelim(token::DelimToken::Brace) => { if brace_depth == 0 { debug!("recover_stmt_ return - close delim {:?}", self.token); - return; + break; } brace_depth -= 1; self.bump(); if in_block && bracket_depth == 0 && brace_depth == 0 { debug!("recover_stmt_ return - block end {:?}", self.token); - return; + break; } } token::CloseDelim(token::DelimToken::Bracket) => { @@ -4506,7 +4810,7 @@ impl<'a> Parser<'a> { } token::Eof => { debug!("recover_stmt_ return - Eof"); - return; + break; } token::Semi => { self.bump(); @@ -4514,7 +4818,17 @@ impl<'a> Parser<'a> { brace_depth == 0 && bracket_depth == 0 { debug!("recover_stmt_ return - Semi"); - return; + break; + } + } + token::Comma => { + if break_on_semi == SemiColonMode::Comma && + brace_depth == 0 && + bracket_depth == 0 { + debug!("recover_stmt_ return - Semi"); + break; + } else { + self.bump(); } } _ => { @@ -4554,9 +4868,7 @@ impl<'a> Parser<'a> { fn is_try_block(&mut self) -> bool { self.token.is_keyword(keywords::Try) && self.look_ahead(1, |t| *t == token::OpenDelim(token::Brace)) && - - self.span.edition() >= Edition::Edition2018 && - + self.span.rust_2018() && // prevent `while try {} {}`, `if try {} {} else {}`, etc. !self.restrictions.contains(Restrictions::NO_STRUCT_LITERAL) } @@ -4570,10 +4882,6 @@ impl<'a> Parser<'a> { self.token.is_keyword(keywords::Crate) && self.look_ahead(1, |t| t != &token::ModSep) } - fn is_extern_non_path(&self) -> bool { - self.token.is_keyword(keywords::Extern) && self.look_ahead(1, |t| t != &token::ModSep) - } - fn is_existential_type_decl(&self) -> bool { self.token.is_keyword(keywords::Existential) && self.look_ahead(1, |t| t.is_keyword(keywords::Type)) @@ -4598,7 +4906,7 @@ impl<'a> Parser<'a> { let ident = self.parse_ident()?; let tokens = if self.check(&token::OpenDelim(token::Brace)) { match self.parse_token_tree() { - TokenTree::Delimited(_, ref delimited) => delimited.stream(), + TokenTree::Delimited(_, _, tts) => tts, _ => unreachable!(), } } else if self.check(&token::OpenDelim(token::Paren)) { @@ -4609,7 +4917,7 @@ impl<'a> Parser<'a> { self.unexpected()?; unreachable!() }; - TokenStream::concat(vec![ + TokenStream::new(vec![ args.into(), TokenTree::Token(token_lo.to(self.prev_span), token::FatArrow).into(), body.into(), @@ -4677,12 +4985,10 @@ impl<'a> Parser<'a> { // like a path (1 token), but it fact not a path. // `union::b::c` - path, `union U { ... }` - not a path. // `crate::b::c` - path, `crate struct S;` - not a path. - // `extern::b::c` - path, `extern crate c;` - not a path. } else if self.token.is_path_start() && !self.token.is_qpath_start() && !self.is_union_item() && !self.is_crate_vis() && - !self.is_extern_non_path() && !self.is_existential_type_decl() && !self.is_auto_trait_item() { let pth = self.parse_path(PathStyle::Expr)?; @@ -4869,7 +5175,7 @@ impl<'a> Parser<'a> { self.token.is_keyword(keywords::In) || self.token == token::Colon; if self.token.is_ident_named("and") { - e.span_suggestion_short_with_applicability( + e.span_suggestion_short( self.span, "use `&&` instead of `and` for the boolean operator", "&&".to_string(), @@ -4877,7 +5183,7 @@ impl<'a> Parser<'a> { ); } if self.token.is_ident_named("or") { - e.span_suggestion_short_with_applicability( + e.span_suggestion_short( self.span, "use `||` instead of `or` for the boolean operator", "||".to_string(), @@ -4912,7 +5218,7 @@ impl<'a> Parser<'a> { s.print_stmt(&stmt)?; s.bclose_maybe_open(stmt.span, INDENT_UNIT, false) }); - e.span_suggestion_with_applicability( + e.span_suggestion( stmt_span, "try placing this code inside a block", sugg, @@ -4947,16 +5253,16 @@ impl<'a> Parser<'a> { /// Precondition: already parsed the '{'. fn parse_block_tail(&mut self, lo: Span, s: BlockCheckMode) -> PResult<'a, P> { let mut stmts = vec![]; - let mut recovered = false; - while !self.eat(&token::CloseDelim(token::Brace)) { let stmt = match self.parse_full_stmt(false) { Err(mut err) => { err.emit(); self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore); - self.eat(&token::CloseDelim(token::Brace)); - recovered = true; - break; + Some(Stmt { + id: ast::DUMMY_NODE_ID, + node: StmtKind::Expr(DummyResult::raw_expr(self.span, true)), + span: self.span, + }) } Ok(stmt) => stmt, }; @@ -4974,7 +5280,6 @@ impl<'a> Parser<'a> { id: ast::DUMMY_NODE_ID, rules: s, span: lo.to(self.prev_span), - recovered, })) } @@ -5031,10 +5336,10 @@ impl<'a> Parser<'a> { fn err_dotdotdot_syntax(&self, span: Span) { self.diagnostic().struct_span_err(span, { "unexpected token: `...`" - }).span_suggestion_with_applicability( + }).span_suggestion( span, "use `..` for an exclusive range", "..".to_owned(), Applicability::MaybeIncorrect - ).span_suggestion_with_applicability( + ).span_suggestion( span, "or `..=` for an inclusive range", "..=".to_owned(), Applicability::MaybeIncorrect ).emit(); @@ -5042,9 +5347,9 @@ impl<'a> Parser<'a> { // Parse bounds of a type parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`. // BOUND = TY_BOUND | LT_BOUND - // LT_BOUND = LIFETIME (e.g. `'a`) + // LT_BOUND = LIFETIME (e.g., `'a`) // TY_BOUND = TY_BOUND_NOPAREN | (TY_BOUND_NOPAREN) - // TY_BOUND_NOPAREN = [?] [for] SIMPLE_PATH (e.g. `?for<'a: 'b> m::Trait<'a>`) + // TY_BOUND_NOPAREN = [?] [for] SIMPLE_PATH (e.g., `?for<'a: 'b> m::Trait<'a>`) fn parse_generic_bounds_common(&mut self, allow_plus: bool) -> PResult<'a, GenericBounds> { let mut bounds = Vec::new(); loop { @@ -5099,7 +5404,7 @@ impl<'a> Parser<'a> { } // Parse bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`. - // BOUND = LT_BOUND (e.g. `'a`) + // BOUND = LT_BOUND (e.g., `'a`) fn parse_lt_param_bounds(&mut self) -> GenericBounds { let mut lifetimes = Vec::new(); while self.check_lifetime() { @@ -5170,8 +5475,12 @@ impl<'a> Parser<'a> { /// Parses (possibly empty) list of lifetime and type parameters, possibly including /// trailing comma and erroneous trailing attributes. crate fn parse_generic_params(&mut self) -> PResult<'a, Vec> { + let mut lifetimes = Vec::new(); let mut params = Vec::new(); - let mut seen_ty_param = false; + let mut seen_ty_param: Option = None; + let mut last_comma_span = None; + let mut bad_lifetime_pos = vec![]; + let mut suggestions = vec![]; loop { let attrs = self.parse_outer_attributes()?; if self.check_lifetime() { @@ -5182,27 +5491,39 @@ impl<'a> Parser<'a> { } else { Vec::new() }; - params.push(ast::GenericParam { + lifetimes.push(ast::GenericParam { ident: lifetime.ident, id: lifetime.id, attrs: attrs.into(), bounds, kind: ast::GenericParamKind::Lifetime, }); - if seen_ty_param { - self.span_err(self.prev_span, - "lifetime parameters must be declared prior to type parameters"); + if let Some(sp) = seen_ty_param { + let remove_sp = last_comma_span.unwrap_or(self.prev_span).to(self.prev_span); + bad_lifetime_pos.push(self.prev_span); + if let Ok(snippet) = self.sess.source_map().span_to_snippet(self.prev_span) { + suggestions.push((remove_sp, String::new())); + suggestions.push(( + sp.shrink_to_lo(), + format!("{}, ", snippet))); + } } } else if self.check_ident() { // Parse type parameter. params.push(self.parse_ty_param(attrs)?); - seen_ty_param = true; + if seen_ty_param.is_none() { + seen_ty_param = Some(self.prev_span); + } } else { // Check for trailing attributes and stop parsing. if !attrs.is_empty() { - let param_kind = if seen_ty_param { "type" } else { "lifetime" }; - self.span_err(attrs[0].span, - &format!("trailing attribute after {} parameters", param_kind)); + let param_kind = if seen_ty_param.is_some() { "type" } else { "lifetime" }; + self.struct_span_err( + attrs[0].span, + &format!("trailing attribute after {} parameters", param_kind), + ) + .span_label(attrs[0].span, "attributes must go before parameters") + .emit(); } break } @@ -5210,8 +5531,24 @@ impl<'a> Parser<'a> { if !self.eat(&token::Comma) { break } + last_comma_span = Some(self.prev_span); + } + if !bad_lifetime_pos.is_empty() { + let mut err = self.struct_span_err( + bad_lifetime_pos, + "lifetime parameters must be declared prior to type parameters", + ); + if !suggestions.is_empty() { + err.multipart_suggestion( + "move the lifetime parameter prior to the first type parameter", + suggestions, + Applicability::MachineApplicable, + ); + } + err.emit(); } - Ok(params) + lifetimes.extend(params); // ensure the correct order of lifetimes and type params + Ok(lifetimes) } /// Parse a set of optional generic type parameter declarations. Where @@ -5242,21 +5579,185 @@ impl<'a> Parser<'a> { } } + /// Parse generic args (within a path segment) with recovery for extra leading angle brackets. + /// For the purposes of understanding the parsing logic of generic arguments, this function + /// can be thought of being the same as just calling `self.parse_generic_args()` if the source + /// had the correct amount of leading angle brackets. + /// + /// ```ignore (diagnostics) + /// bar::<<<::Output>(); + /// ^^ help: remove extra angle brackets + /// ``` + fn parse_generic_args_with_leaning_angle_bracket_recovery( + &mut self, + style: PathStyle, + lo: Span, + ) -> PResult<'a, (Vec, Vec)> { + // We need to detect whether there are extra leading left angle brackets and produce an + // appropriate error and suggestion. This cannot be implemented by looking ahead at + // upcoming tokens for a matching `>` character - if there are unmatched `<` tokens + // then there won't be matching `>` tokens to find. + // + // To explain how this detection works, consider the following example: + // + // ```ignore (diagnostics) + // bar::<<<::Output>(); + // ^^ help: remove extra angle brackets + // ``` + // + // Parsing of the left angle brackets starts in this function. We start by parsing the + // `<` token (incrementing the counter of unmatched angle brackets on `Parser` via + // `eat_lt`): + // + // *Upcoming tokens:* `<<<::Output>;` + // *Unmatched count:* 1 + // *`parse_path_segment` calls deep:* 0 + // + // This has the effect of recursing as this function is called if a `<` character + // is found within the expected generic arguments: + // + // *Upcoming tokens:* `<<::Output>;` + // *Unmatched count:* 2 + // *`parse_path_segment` calls deep:* 1 + // + // Eventually we will have recursed until having consumed all of the `<` tokens and + // this will be reflected in the count: + // + // *Upcoming tokens:* `T as Foo>::Output>;` + // *Unmatched count:* 4 + // `parse_path_segment` calls deep:* 3 + // + // The parser will continue until reaching the first `>` - this will decrement the + // unmatched angle bracket count and return to the parent invocation of this function + // having succeeded in parsing: + // + // *Upcoming tokens:* `::Output>;` + // *Unmatched count:* 3 + // *`parse_path_segment` calls deep:* 2 + // + // This will continue until the next `>` character which will also return successfully + // to the parent invocation of this function and decrement the count: + // + // *Upcoming tokens:* `;` + // *Unmatched count:* 2 + // *`parse_path_segment` calls deep:* 1 + // + // At this point, this function will expect to find another matching `>` character but + // won't be able to and will return an error. This will continue all the way up the + // call stack until the first invocation: + // + // *Upcoming tokens:* `;` + // *Unmatched count:* 2 + // *`parse_path_segment` calls deep:* 0 + // + // In doing this, we have managed to work out how many unmatched leading left angle + // brackets there are, but we cannot recover as the unmatched angle brackets have + // already been consumed. To remedy this, we keep a snapshot of the parser state + // before we do the above. We can then inspect whether we ended up with a parsing error + // and unmatched left angle brackets and if so, restore the parser state before we + // consumed any `<` characters to emit an error and consume the erroneous tokens to + // recover by attempting to parse again. + // + // In practice, the recursion of this function is indirect and there will be other + // locations that consume some `<` characters - as long as we update the count when + // this happens, it isn't an issue. + + let is_first_invocation = style == PathStyle::Expr; + // Take a snapshot before attempting to parse - we can restore this later. + let snapshot = if is_first_invocation { + Some(self.clone()) + } else { + None + }; + + debug!("parse_generic_args_with_leading_angle_bracket_recovery: (snapshotting)"); + match self.parse_generic_args() { + Ok(value) => Ok(value), + Err(ref mut e) if is_first_invocation && self.unmatched_angle_bracket_count > 0 => { + // Cancel error from being unable to find `>`. We know the error + // must have been this due to a non-zero unmatched angle bracket + // count. + e.cancel(); + + // Swap `self` with our backup of the parser state before attempting to parse + // generic arguments. + let snapshot = mem::replace(self, snapshot.unwrap()); + + debug!( + "parse_generic_args_with_leading_angle_bracket_recovery: (snapshot failure) \ + snapshot.count={:?}", + snapshot.unmatched_angle_bracket_count, + ); + + // Eat the unmatched angle brackets. + for _ in 0..snapshot.unmatched_angle_bracket_count { + self.eat_lt(); + } + + // Make a span over ${unmatched angle bracket count} characters. + let span = lo.with_hi( + lo.lo() + BytePos(snapshot.unmatched_angle_bracket_count) + ); + let plural = snapshot.unmatched_angle_bracket_count > 1; + self.diagnostic() + .struct_span_err( + span, + &format!( + "unmatched angle bracket{}", + if plural { "s" } else { "" } + ), + ) + .span_suggestion( + span, + &format!( + "remove extra angle bracket{}", + if plural { "s" } else { "" } + ), + String::new(), + Applicability::MachineApplicable, + ) + .emit(); + + // Try again without unmatched angle bracket characters. + self.parse_generic_args() + }, + Err(e) => Err(e), + } + } + /// Parses (possibly empty) list of lifetime and type arguments and associated type bindings, /// possibly including trailing comma. - fn parse_generic_args(&mut self) - -> PResult<'a, (Vec, Vec)> { + fn parse_generic_args(&mut self) -> PResult<'a, (Vec, Vec)> { let mut args = Vec::new(); let mut bindings = Vec::new(); + let mut seen_type = false; let mut seen_binding = false; + + let mut last_comma_span = None; + let mut first_type_or_binding_span: Option = None; + let mut first_binding_span: Option = None; + + let mut bad_lifetime_pos = vec![]; + let mut bad_type_pos = vec![]; + + let mut lifetime_suggestions = vec![]; + let mut type_suggestions = vec![]; loop { if self.check_lifetime() && self.look_ahead(1, |t| !t.is_like_plus()) { // Parse lifetime argument. args.push(GenericArg::Lifetime(self.expect_lifetime())); + if seen_type || seen_binding { - self.span_err(self.prev_span, - "lifetime parameters must be declared prior to type parameters"); + let remove_sp = last_comma_span.unwrap_or(self.prev_span).to(self.prev_span); + bad_lifetime_pos.push(self.prev_span); + + if let Ok(snippet) = self.sess.source_map().span_to_snippet(self.prev_span) { + lifetime_suggestions.push((remove_sp, String::new())); + lifetime_suggestions.push(( + first_type_or_binding_span.unwrap().shrink_to_lo(), + format!("{}, ", snippet))); + } } } else if self.check_ident() && self.look_ahead(1, |t| t == &token::Eq) { // Parse associated type binding. @@ -5264,19 +5765,38 @@ impl<'a> Parser<'a> { let ident = self.parse_ident()?; self.bump(); let ty = self.parse_ty()?; + let span = lo.to(self.prev_span); bindings.push(TypeBinding { id: ast::DUMMY_NODE_ID, ident, ty, - span: lo.to(self.prev_span), + span, }); + seen_binding = true; + if first_type_or_binding_span.is_none() { + first_type_or_binding_span = Some(span); + } + if first_binding_span.is_none() { + first_binding_span = Some(span); + } } else if self.check_type() { // Parse type argument. let ty_param = self.parse_ty()?; if seen_binding { - self.span_err(ty_param.span, - "type parameters must be declared prior to associated type bindings"); + let remove_sp = last_comma_span.unwrap_or(self.prev_span).to(self.prev_span); + bad_type_pos.push(self.prev_span); + + if let Ok(snippet) = self.sess.source_map().span_to_snippet(self.prev_span) { + type_suggestions.push((remove_sp, String::new())); + type_suggestions.push(( + first_binding_span.unwrap().shrink_to_lo(), + format!("{}, ", snippet))); + } + } + + if first_type_or_binding_span.is_none() { + first_type_or_binding_span = Some(ty_param.span); } args.push(GenericArg::Type(ty_param)); seen_type = true; @@ -5286,11 +5806,99 @@ impl<'a> Parser<'a> { if !self.eat(&token::Comma) { break + } else { + last_comma_span = Some(self.prev_span); } } + + self.maybe_report_incorrect_generic_argument_order( + bad_lifetime_pos, bad_type_pos, lifetime_suggestions, type_suggestions + ); + Ok((args, bindings)) } + /// Maybe report an error about incorrect generic argument order - "lifetime parameters + /// must be declared before type parameters", "type parameters must be declared before + /// associated type bindings" or both. + fn maybe_report_incorrect_generic_argument_order( + &self, + bad_lifetime_pos: Vec, + bad_type_pos: Vec, + lifetime_suggestions: Vec<(Span, String)>, + type_suggestions: Vec<(Span, String)>, + ) { + let mut err = if !bad_lifetime_pos.is_empty() && !bad_type_pos.is_empty() { + let mut positions = bad_lifetime_pos.clone(); + positions.extend_from_slice(&bad_type_pos); + + self.struct_span_err( + positions, + "generic arguments must declare lifetimes, types and associated type bindings in \ + that order", + ) + } else if !bad_lifetime_pos.is_empty() { + self.struct_span_err( + bad_lifetime_pos.clone(), + "lifetime parameters must be declared prior to type parameters" + ) + } else if !bad_type_pos.is_empty() { + self.struct_span_err( + bad_type_pos.clone(), + "type parameters must be declared prior to associated type bindings" + ) + } else { + return; + }; + + if !bad_lifetime_pos.is_empty() { + for sp in &bad_lifetime_pos { + err.span_label(*sp, "must be declared prior to type parameters"); + } + } + + if !bad_type_pos.is_empty() { + for sp in &bad_type_pos { + err.span_label(*sp, "must be declared prior to associated type bindings"); + } + } + + if !lifetime_suggestions.is_empty() && !type_suggestions.is_empty() { + let mut suggestions = lifetime_suggestions; + suggestions.extend_from_slice(&type_suggestions); + + let plural = bad_lifetime_pos.len() + bad_type_pos.len() > 1; + err.multipart_suggestion( + &format!( + "move the parameter{}", + if plural { "s" } else { "" }, + ), + suggestions, + Applicability::MachineApplicable, + ); + } else if !lifetime_suggestions.is_empty() { + err.multipart_suggestion( + &format!( + "move the lifetime parameter{} prior to the first type parameter", + if bad_lifetime_pos.len() > 1 { "s" } else { "" }, + ), + lifetime_suggestions, + Applicability::MachineApplicable, + ); + } else if !type_suggestions.is_empty() { + err.multipart_suggestion( + &format!( + "move the type parameter{} prior to the first associated type binding", + if bad_type_pos.len() > 1 { "s" } else { "" }, + ), + type_suggestions, + Applicability::MachineApplicable, + ); + } + + err.emit(); + } + /// Parses an optional `where` clause and places it in `generics`. /// /// ```ignore (only-for-syntax-highlight) @@ -5315,8 +5923,12 @@ impl<'a> Parser<'a> { // change we parse those generics now, but report an error. if self.choose_generics_over_qpath() { let generics = self.parse_generics()?; - self.span_err(generics.span, - "generic parameters on `where` clauses are reserved for future use"); + self.struct_span_err( + generics.span, + "generic parameters on `where` clauses are reserved for future use", + ) + .span_label(generics.span, "currently unsupported") + .emit(); } loop { @@ -5385,11 +5997,12 @@ impl<'a> Parser<'a> { fn parse_fn_args(&mut self, named_args: bool, allow_variadic: bool) -> PResult<'a, (Vec , bool)> { + self.expect(&token::OpenDelim(token::Paren))?; + let sp = self.span; let mut variadic = false; let args: Vec> = - self.parse_unspanned_seq( - &token::OpenDelim(token::Paren), + self.parse_seq_to_before_end( &token::CloseDelim(token::Paren), SeqSep::trailing_allowed(token::Comma), |p| { @@ -5420,7 +6033,7 @@ impl<'a> Parser<'a> { } } } else { - match p.parse_arg_general(named_args) { + match p.parse_arg_general(named_args, false) { Ok(arg) => Ok(Some(arg)), Err(mut e) => { e.emit(); @@ -5436,6 +6049,8 @@ impl<'a> Parser<'a> { } )?; + self.eat(&token::CloseDelim(token::Paren)); + let args: Vec<_> = args.into_iter().filter_map(|x| x).collect(); if variadic && args.is_empty() { @@ -5468,7 +6083,7 @@ impl<'a> Parser<'a> { _ => unreachable!() }; let isolated_self = |this: &mut Self, n| { - this.look_ahead(n, |t| t.is_keyword(keywords::SelfValue)) && + this.look_ahead(n, |t| t.is_keyword(keywords::SelfLower)) && this.look_ahead(n + 1, |t| t != &token::ModSep) }; @@ -5513,15 +6128,20 @@ impl<'a> Parser<'a> { // *mut self // *not_self // Emit special error for `self` cases. + let msg = "cannot pass `self` by raw pointer"; (if isolated_self(self, 1) { self.bump(); - self.span_err(self.span, "cannot pass `self` by raw pointer"); + self.struct_span_err(self.span, msg) + .span_label(self.span, msg) + .emit(); SelfKind::Value(Mutability::Immutable) } else if self.look_ahead(1, |t| t.is_mutability()) && isolated_self(self, 2) { self.bump(); self.bump(); - self.span_err(self.span, "cannot pass `self` by raw pointer"); + self.struct_span_err(self.span, msg) + .span_label(self.span, msg) + .emit(); SelfKind::Value(Mutability::Immutable) } else { return Ok(None); @@ -5760,35 +6380,30 @@ impl<'a> Parser<'a> { } fn complain_if_pub_macro(&mut self, vis: &VisibilityKind, sp: Span) { - if let Err(mut err) = self.complain_if_pub_macro_diag(vis, sp) { - err.emit(); - } - } - - fn complain_if_pub_macro_diag(&mut self, vis: &VisibilityKind, sp: Span) -> PResult<'a, ()> { match *vis { - VisibilityKind::Inherited => Ok(()), + VisibilityKind::Inherited => {} _ => { let is_macro_rules: bool = match self.token { token::Ident(sid, _) => sid.name == Symbol::intern("macro_rules"), _ => false, }; - if is_macro_rules { + let mut err = if is_macro_rules { let mut err = self.diagnostic() .struct_span_err(sp, "can't qualify macro_rules invocation with `pub`"); - err.span_suggestion_with_applicability( + err.span_suggestion( sp, "try exporting the macro", "#[macro_export]".to_owned(), Applicability::MaybeIncorrect // speculative ); - Err(err) + err } else { let mut err = self.diagnostic() .struct_span_err(sp, "can't qualify macro invocation with `pub`"); err.help("try adjusting the macro to put `pub` inside the invocation"); - Err(err) - } + err + }; + err.emit(); } } } @@ -5863,7 +6478,10 @@ impl<'a> Parser<'a> { tps.where_clause = self.parse_where_clause()?; self.expect(&token::Semi)?; if unsafety != Unsafety::Normal { - self.span_err(self.prev_span, "trait aliases cannot be unsafe"); + let msg = "trait aliases cannot be unsafe"; + self.struct_span_err(self.prev_span, msg) + .span_label(self.prev_span, msg) + .emit(); } Ok((ident, ItemKind::TraitAlias(tps, bounds), None)) } else { @@ -5979,7 +6597,13 @@ impl<'a> Parser<'a> { Some(ty_second) => { // impl Trait for Type if !has_for { - self.span_err(missing_for_span, "missing `for` in a trait impl"); + self.struct_span_err(missing_for_span, "missing `for` in a trait impl") + .span_suggestion_short( + missing_for_span, + "add `for` here", + " for ".to_string(), + Applicability::MachineApplicable, + ).emit(); } let ty_first = ty_first.into_inner(); @@ -6097,9 +6721,6 @@ impl<'a> Parser<'a> { fn consume_block(&mut self, delim: token::DelimToken) { let mut brace_depth = 0; - if !self.eat(&token::OpenDelim(delim)) { - return; - } loop { if self.eat(&token::OpenDelim(delim)) { brace_depth += 1; @@ -6110,7 +6731,7 @@ impl<'a> Parser<'a> { brace_depth -= 1; continue; } - } else if self.eat(&token::Eof) || self.eat(&token::CloseDelim(token::NoDelim)) { + } else if self.token == token::Eof || self.eat(&token::CloseDelim(token::NoDelim)) { return; } else { self.bump(); @@ -6201,7 +6822,7 @@ impl<'a> Parser<'a> { } else { if seen_comma == false { let sp = self.sess.source_map().next_point(previous_span); - err.span_suggestion_with_applicability( + err.span_suggestion( sp, "missing comma here", ",".into(), @@ -6217,7 +6838,7 @@ impl<'a> Parser<'a> { self.this_token_descr())); if self.token.is_ident() { // This is likely another field; emit the diagnostic and keep going - err.span_suggestion_with_applicability( + err.span_suggestion( sp, "try adding a comma", ",".into(), @@ -6240,9 +6861,10 @@ impl<'a> Parser<'a> { self.parse_single_struct_field(lo, vis, attrs) } - /// Parse `pub`, `pub(crate)` and `pub(in path)` plus shortcuts `pub(self)` for `pub(in self)` - /// and `pub(super)` for `pub(in super)`. If the following element can't be a tuple (i.e. it's - /// a function definition, it's not a tuple struct field) and the contents within the parens + /// Parse `pub`, `pub(crate)` and `pub(in path)` plus shortcuts `crate` for `pub(crate)`, + /// `pub(self)` for `pub(in self)` and `pub(super)` for `pub(in super)`. + /// If the following element can't be a tuple (i.e., it's a function definition, + /// it's not a tuple struct field) and the contents within the parens /// isn't valid, emit a proper diagnostic. pub fn parse_visibility(&mut self, can_take_tuple: bool) -> PResult<'a, Visibility> { maybe_whole!(self, NtVis, |x| x); @@ -6289,7 +6911,7 @@ impl<'a> Parser<'a> { return Ok(vis) } else if self.look_ahead(2, |t| t == &token::CloseDelim(token::Paren)) && self.look_ahead(1, |t| t.is_keyword(keywords::Super) || - t.is_keyword(keywords::SelfValue)) + t.is_keyword(keywords::SelfLower)) { // `pub(self)` or `pub(super)` self.bump(); // `(` @@ -6314,7 +6936,7 @@ impl<'a> Parser<'a> { self.expect(&token::CloseDelim(token::Paren))?; // `)` let mut err = struct_span_err!(self.sess.span_diagnostic, sp, E0704, "{}", msg); err.help(suggestion); - err.span_suggestion_with_applicability( + err.span_suggestion( sp, &help_msg, format!("in {}", path), Applicability::MachineApplicable ); err.emit(); // emit diagnostic, but continue with public visibility @@ -6342,41 +6964,52 @@ impl<'a> Parser<'a> { } } + fn maybe_consume_incorrect_semicolon(&mut self, items: &[P]) -> bool { + if self.eat(&token::Semi) { + let mut err = self.struct_span_err(self.prev_span, "expected item, found `;`"); + err.span_suggestion_short( + self.prev_span, + "remove this semicolon", + String::new(), + Applicability::MachineApplicable, + ); + if !items.is_empty() { + let previous_item = &items[items.len()-1]; + let previous_item_kind_name = match previous_item.node { + // say "braced struct" because tuple-structs and + // braceless-empty-struct declarations do take a semicolon + ItemKind::Struct(..) => Some("braced struct"), + ItemKind::Enum(..) => Some("enum"), + ItemKind::Trait(..) => Some("trait"), + ItemKind::Union(..) => Some("union"), + _ => None, + }; + if let Some(name) = previous_item_kind_name { + err.help(&format!("{} declarations are not followed by a semicolon", name)); + } + } + err.emit(); + true + } else { + false + } + } + /// Given a termination token, parse all of the items in a module fn parse_mod_items(&mut self, term: &token::Token, inner_lo: Span) -> PResult<'a, Mod> { let mut items = vec![]; while let Some(item) = self.parse_item()? { items.push(item); + self.maybe_consume_incorrect_semicolon(&items); } if !self.eat(term) { let token_str = self.this_token_descr(); - let mut err = self.fatal(&format!("expected item, found {}", token_str)); - if self.token == token::Semi { - let msg = "consider removing this semicolon"; - err.span_suggestion_short_with_applicability( - self.span, msg, String::new(), Applicability::MachineApplicable - ); - if !items.is_empty() { // Issue #51603 - let previous_item = &items[items.len()-1]; - let previous_item_kind_name = match previous_item.node { - // say "braced struct" because tuple-structs and - // braceless-empty-struct declarations do take a semicolon - ItemKind::Struct(..) => Some("braced struct"), - ItemKind::Enum(..) => Some("enum"), - ItemKind::Trait(..) => Some("trait"), - ItemKind::Union(..) => Some("union"), - _ => None, - }; - if let Some(name) = previous_item_kind_name { - err.help(&format!("{} declarations are not followed by a semicolon", - name)); - } - } - } else { + if !self.maybe_consume_incorrect_semicolon(&items) { + let mut err = self.fatal(&format!("expected item, found {}", token_str)); err.span_label(self.span, "expected item"); + return Err(err); } - return Err(err); } let hi = if self.span.is_dummy() { @@ -6393,13 +7026,7 @@ impl<'a> Parser<'a> { } fn parse_item_const(&mut self, m: Option) -> PResult<'a, ItemInfo> { - let id = match self.token { - token::Ident(ident, false) if ident.name == keywords::Underscore.name() => { - self.bump(); // `_` - ident.gensym() - }, - _ => self.parse_ident()?, - }; + let id = if m.is_none() { self.parse_ident_or_underscore() } else { self.parse_ident() }?; self.expect(&token::Colon)?; let ty = self.parse_ty()?; self.expect(&token::Eq)?; @@ -6741,7 +7368,11 @@ impl<'a> Parser<'a> { let error_msg = "crate name using dashes are not valid in `extern crate` statements"; let suggestion_msg = "if the original crate name uses dashes you need to use underscores \ in the code"; - let mut ident = self.parse_ident()?; + let mut ident = if self.token.is_keyword(keywords::SelfLower) { + self.parse_path_segment_ident() + } else { + self.parse_ident() + }?; let mut idents = vec![]; let mut replacement = vec![]; let mut fixed_crate_name = false; @@ -6764,7 +7395,11 @@ impl<'a> Parser<'a> { let mut err = self.struct_span_err(fixed_name_sp, error_msg); err.span_label(fixed_name_sp, "dash-separated idents are not valid"); - err.multipart_suggestion(suggestion_msg, replacement); + err.multipart_suggestion( + suggestion_msg, + replacement, + Applicability::MachineApplicable, + ); err.emit(); } Ok(ident) @@ -6874,7 +7509,7 @@ impl<'a> Parser<'a> { fn parse_enum_def(&mut self, _generics: &ast::Generics) -> PResult<'a, EnumDef> { let mut variants = Vec::new(); let mut all_nullary = true; - let mut any_disr = None; + let mut any_disr = vec![]; while self.token != token::CloseDelim(token::Brace) { let variant_attrs = self.parse_outer_attributes()?; let vlo = self.span; @@ -6896,7 +7531,9 @@ impl<'a> Parser<'a> { id: ast::DUMMY_NODE_ID, value: self.parse_expr()?, }); - any_disr = disr_expr.as_ref().map(|c| c.value.span); + if let Some(sp) = disr_expr.as_ref().map(|c| c.value.span) { + any_disr.push(sp); + } struct_def = VariantData::Unit(ast::DUMMY_NODE_ID); } else { struct_def = VariantData::Unit(ast::DUMMY_NODE_ID); @@ -6913,11 +7550,15 @@ impl<'a> Parser<'a> { if !self.eat(&token::Comma) { break; } } self.expect(&token::CloseDelim(token::Brace))?; - match any_disr { - Some(disr_span) if !all_nullary => - self.span_err(disr_span, - "discriminator values can only be used with a field-less enum"), - _ => () + if !any_disr.is_empty() && !all_nullary { + let mut err =self.struct_span_err( + any_disr.clone(), + "discriminator values can only be used with a field-less enum", + ); + for sp in any_disr { + err.span_label(sp, "only valid in field-less enums"); + } + err.emit(); } Ok(ast::EnumDef { variants }) @@ -7048,8 +7689,7 @@ impl<'a> Parser<'a> { return Ok(Some(item)); } - if self.check_keyword(keywords::Extern) && self.is_extern_non_path() { - self.bump(); // `extern` + if self.eat_keyword(keywords::Extern) { if self.eat_keyword(keywords::Crate) { return Ok(Some(self.parse_item_extern_crate(lo, visibility, attrs)?)); } @@ -7121,9 +7761,16 @@ impl<'a> Parser<'a> { // CONST ITEM if self.eat_keyword(keywords::Mut) { let prev_span = self.prev_span; - self.diagnostic().struct_span_err(prev_span, "const globals cannot be mutable") - .help("did you mean to declare a static?") - .emit(); + let mut err = self.diagnostic() + .struct_span_err(prev_span, "const globals cannot be mutable"); + err.span_label(prev_span, "cannot be mutable"); + err.span_suggestion( + const_span, + "you might want to declare a static instead", + "static".to_owned(), + Applicability::MaybeIncorrect, + ); + err.emit(); } let (ident, item_, extra_attrs) = self.parse_item_const(None)?; let prev_span = self.prev_span; @@ -7354,23 +8001,33 @@ impl<'a> Parser<'a> { ident); let mut err = self.diagnostic() .struct_span_err(sp, "missing `struct` for struct definition"); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( sp, &msg, " struct ".into(), Applicability::MaybeIncorrect // speculative ); return Err(err); } else if self.look_ahead(1, |t| *t == token::OpenDelim(token::Paren)) { let ident = self.parse_ident().unwrap(); + self.bump(); // `(` + let kw_name = if let Ok(Some(_)) = self.parse_self_arg() { + "method" + } else { + "function" + }; self.consume_block(token::Paren); - let (kw, kw_name, ambiguous) = if self.check(&token::RArrow) || - self.check(&token::OpenDelim(token::Brace)) - { - ("fn", "method", false) + let (kw, kw_name, ambiguous) = if self.check(&token::RArrow) { + self.eat_to_tokens(&[&token::OpenDelim(token::Brace)]); + self.bump(); // `{` + ("fn", kw_name, false) + } else if self.check(&token::OpenDelim(token::Brace)) { + self.bump(); // `{` + ("fn", kw_name, false) } else if self.check(&token::Colon) { let kw = "struct"; (kw, kw, false) } else { - ("fn` or `struct", "method or struct", true) + ("fn` or `struct", "function or struct", true) }; + self.consume_block(token::Brace); let msg = format!("missing `{}` for {} definition", kw, kw_name); let mut err = self.diagnostic().struct_span_err(sp, &msg); @@ -7379,12 +8036,12 @@ impl<'a> Parser<'a> { kw, ident, kw_name); - err.span_suggestion_short_with_applicability( + err.span_suggestion_short( sp, &suggestion, format!(" {} ", kw), Applicability::MachineApplicable ); } else { if let Ok(snippet) = self.sess.source_map().span_to_snippet(ident_sp) { - err.span_suggestion_with_applicability( + err.span_suggestion( full_sp, "if you meant to call a macro, try", format!("{}!", snippet), @@ -7397,6 +8054,32 @@ impl<'a> Parser<'a> { } } return Err(err); + } else if self.look_ahead(1, |t| *t == token::Lt) { + let ident = self.parse_ident().unwrap(); + self.eat_to_tokens(&[&token::Gt]); + self.bump(); // `>` + let (kw, kw_name, ambiguous) = if self.eat(&token::OpenDelim(token::Paren)) { + if let Ok(Some(_)) = self.parse_self_arg() { + ("fn", "method", false) + } else { + ("fn", "function", false) + } + } else if self.check(&token::OpenDelim(token::Brace)) { + ("struct", "struct", false) + } else { + ("fn` or `struct", "function or struct", true) + }; + let msg = format!("missing `{}` for {} definition", kw, kw_name); + let mut err = self.diagnostic().struct_span_err(sp, &msg); + if !ambiguous { + err.span_suggestion_short( + sp, + &format!("add `{}` here to parse `{}` as a public {}", kw, ident, kw_name), + format!(" {} ", kw), + Applicability::MachineApplicable, + ); + } + return Err(err); } } self.parse_macro_use_or_failure(attrs, macros_allowed, attributes_allowed, lo, visibility) @@ -7416,7 +8099,7 @@ impl<'a> Parser<'a> { if self.token.is_keyword(keywords::Const) { self.diagnostic() .struct_span_err(self.span, "extern items cannot be `const`") - .span_suggestion_with_applicability( + .span_suggestion( self.span, "try using a static value", "static".to_owned(), @@ -7450,7 +8133,7 @@ impl<'a> Parser<'a> { } None => { if !attrs.is_empty() { - self.expected_item_err(&attrs); + self.expected_item_err(&attrs)?; } self.unexpected() @@ -7513,7 +8196,7 @@ impl<'a> Parser<'a> { } if !attributes_allowed && !attrs.is_empty() { - self.expected_item_err(&attrs); + self.expected_item_err(&attrs)?; } Ok(None) } @@ -7522,7 +8205,7 @@ impl<'a> Parser<'a> { fn parse_assoc_macro_invoc(&mut self, item_kind: &str, vis: Option<&Visibility>, at_end: &mut bool) -> PResult<'a, Option> { - if self.token.is_path_start() && !self.is_extern_non_path() { + if self.token.is_path_start() { let prev_span = self.prev_span; let lo = self.span; let pth = self.parse_path(PathStyle::Mod)?; @@ -7576,7 +8259,7 @@ impl<'a> Parser<'a> { &mut self.token_cursor.stack[prev].last_token }; - // Pull our the toekns that we've collected from the call to `f` above + // Pull out the tokens that we've collected from the call to `f` above. let mut collected_tokens = match *last_token { LastToken::Collecting(ref mut v) => mem::replace(v, Vec::new()), LastToken::Was(_) => panic!("our vector went away?"), @@ -7595,10 +8278,9 @@ impl<'a> Parser<'a> { // call. In that case we need to record all the tokens we collected in // our parent list as well. To do that we push a clone of our stream // onto the previous list. - let stream = collected_tokens.into_iter().collect::(); match prev_collecting { Some(mut list) => { - list.push(stream.clone()); + list.extend(collected_tokens.iter().cloned()); list.extend(extra_token); *last_token = LastToken::Collecting(list); } @@ -7607,7 +8289,7 @@ impl<'a> Parser<'a> { } } - Ok((ret?, stream)) + Ok((ret?, TokenStream::new(collected_tokens))) } pub fn parse_item(&mut self) -> PResult<'a, Option>> { @@ -7637,8 +8319,11 @@ impl<'a> Parser<'a> { self.check(&token::BinOp(token::Star)) || self.is_import_coupler() { // `use *;` or `use ::*;` or `use {...};` or `use ::{...};` + let mod_sep_ctxt = self.span.ctxt(); if self.eat(&token::ModSep) { - prefix.segments.push(PathSegment::crate_root(lo.shrink_to_lo())); + prefix.segments.push( + PathSegment::path_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt)) + ); } if self.eat(&token::BinOp(token::Star)) { @@ -7677,13 +8362,7 @@ impl<'a> Parser<'a> { fn parse_rename(&mut self) -> PResult<'a, Option> { if self.eat_keyword(keywords::As) { - match self.token { - token::Ident(ident, false) if ident.name == keywords::Underscore.name() => { - self.bump(); // `_` - Ok(Some(ident.gensym())) - } - _ => self.parse_ident().map(Some), - } + self.parse_ident_or_underscore().map(Some) } else { Ok(None) } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 46fc6454d1c..f06e975a6d9 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use self::BinOpToken::*; pub use self::Nonterminal::*; pub use self::DelimToken::*; @@ -70,6 +60,7 @@ impl DelimToken { pub enum Lit { Byte(ast::Name), Char(ast::Name), + Err(ast::Name), Integer(ast::Name), Float(ast::Name), Str_(ast::Name), @@ -83,6 +74,7 @@ impl Lit { match *self { Byte(_) => "byte literal", Char(_) => "char literal", + Err(_) => "invalid literal", Integer(_) => "integer literal", Float(_) => "float literal", Str_(_) | StrRaw(..) => "string literal", @@ -163,7 +155,6 @@ pub enum Token { DotDot, DotDotDot, DotDotEq, - DotEq, // HACK(durka42) never produced by the parser, only used for libproc_macro Comma, Semi, Colon, @@ -208,6 +199,10 @@ pub enum Token { Eof, } +// `Token` is used a lot. Make sure it doesn't unintentionally get bigger. +#[cfg(target_arch = "x86_64")] +static_assert!(MEM_SIZE_OF_STATEMENT: mem::size_of::() == 16); + impl Token { pub fn interpolated(nt: Nonterminal) -> Token { Token::Interpolated(Lrc::new((nt, LazyTokenStream::new()))) @@ -454,7 +449,6 @@ impl Token { Dot => match joint { Dot => DotDot, DotDot => DotDotDot, - DotEq => DotDotEq, _ => return None, }, DotDot => match joint { @@ -477,10 +471,9 @@ impl Token { _ => return None, }, - Le | EqEq | Ne | Ge | AndAnd | OrOr | Tilde | BinOpEq(..) | At | DotDotDot | DotEq | + Le | EqEq | Ne | Ge | AndAnd | OrOr | Tilde | BinOpEq(..) | At | DotDotDot | DotDotEq | Comma | Semi | ModSep | RArrow | LArrow | FatArrow | Pound | Dollar | - Question | OpenDelim(..) | CloseDelim(..) => return None, - + Question | OpenDelim(..) | CloseDelim(..) | Literal(..) | Ident(..) | Lifetime(..) | Interpolated(..) | DocComment(..) | Whitespace | Comment | Shebang(..) | Eof => return None, }) @@ -547,11 +540,12 @@ impl Token { let tokens_for_real = nt.1.force(|| { // FIXME(#43081): Avoid this pretty-print + reparse hack let source = pprust::token_to_string(self); - parse_stream_from_source_str(FileName::MacroExpansion, source, sess, Some(span)) + let filename = FileName::macro_expansion_source_code(&source); + parse_stream_from_source_str(filename, source, sess, Some(span)) }); // During early phases of the compiler the AST could get modified - // directly (e.g. attributes added or removed) and the internal cache + // directly (e.g., attributes added or removed) and the internal cache // of tokens my not be invalidated or updated. Consequently if the // "lossless" token stream disagrees with our actual stringification // (which has historically been much more battle-tested) then we go @@ -606,7 +600,6 @@ impl Token { (&DotDot, &DotDot) | (&DotDotDot, &DotDotDot) | (&DotDotEq, &DotDotEq) | - (&DotEq, &DotEq) | (&Comma, &Comma) | (&Semi, &Semi) | (&Colon, &Colon) | @@ -631,7 +624,9 @@ impl Token { (&Shebang(a), &Shebang(b)) => a == b, (&Lifetime(a), &Lifetime(b)) => a.name == b.name, - (&Ident(a, b), &Ident(c, d)) => a.name == c.name && b == d, + (&Ident(a, b), &Ident(c, d)) => b == d && (a.name == c.name || + a.name == keywords::DollarCrate.name() || + c.name == keywords::DollarCrate.name()), (&Literal(ref a, b), &Literal(ref c, d)) => { b == d && a.probably_equal_for_proc_macro(c) @@ -784,10 +779,12 @@ fn prepend_attrs(sess: &ParseSess, assert_eq!(attr.style, ast::AttrStyle::Outer, "inner attributes should prevent cached tokens from existing"); + let source = pprust::attr_to_string(attr); + let macro_filename = FileName::macro_expansion_source_code(&source); if attr.is_sugared_doc { let stream = parse_stream_from_source_str( - FileName::MacroExpansion, - pprust::attr_to_string(attr), + macro_filename, + source, sess, Some(span), ); @@ -808,8 +805,8 @@ fn prepend_attrs(sess: &ParseSess, // should eventually be removed. } else { let stream = parse_stream_from_source_str( - FileName::MacroExpansion, - pprust::path_to_string(&attr.path), + macro_filename, + source, sess, Some(span), ); @@ -818,16 +815,13 @@ fn prepend_attrs(sess: &ParseSess, brackets.push(attr.tokens.clone()); - let tokens = tokenstream::Delimited { - delim: DelimToken::Bracket, - tts: brackets.build().into(), - }; // The span we list here for `#` and for `[ ... ]` are both wrong in // that it encompasses more than each token, but it hopefully is "good // enough" for now at least. builder.push(tokenstream::TokenTree::Token(attr.span, Pound)); let delim_span = DelimSpan::from_single(attr.span); - builder.push(tokenstream::TokenTree::Delimited(delim_span, tokens)); + builder.push(tokenstream::TokenTree::Delimited( + delim_span, DelimToken::Bracket, brackets.build().into())); } builder.push(tokens.clone()); Some(builder.build()) diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 086de35d531..5232b8333e6 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This pretty-printer is a direct reimplementation of Philip Karlton's //! Mesa pretty-printer, as described in appendix A of //! @@ -109,7 +99,7 @@ //! The buffered tokens go through a ring-buffer, 'tokens'. The 'left' and //! 'right' indices denote the active portion of the ring buffer as well as //! describing hypothetical points-in-the-infinite-stream at most 3N tokens -//! apart (i.e. "not wrapped to ring-buffer boundaries"). The paper will switch +//! apart (i.e., "not wrapped to ring-buffer boundaries"). The paper will switch //! between using 'left' and 'right' terms to denote the wrapped-to-ring-buffer //! and point-in-infinite-stream senses freely. //! @@ -140,13 +130,14 @@ //! calculation, SCAN will write "infinity" to the size and let PRINT consume //! it. //! -//! In this implementation (following the paper, again) the SCAN process is -//! the method called `Printer::pretty_print`, and the 'PRINT' process is the method -//! called `Printer::print`. +//! In this implementation (following the paper, again) the SCAN process is the +//! methods called `Printer::pretty_print_*`, and the 'PRINT' process is the +//! method called `Printer::print`. use std::collections::VecDeque; use std::fmt; use std::io; +use std::borrow::Cow; /// How to break. Described in more detail in the module docs. #[derive(Clone, Copy, PartialEq)] @@ -169,7 +160,10 @@ pub struct BeginToken { #[derive(Clone)] pub enum Token { - String(String, isize), + // In practice a string token contains either a `&'static str` or a + // `String`. `Cow` is overkill for this because we never modify the data, + // but it's more convenient than rolling our own more specialized type. + String(Cow<'static, str>, isize), Break(BreakToken), Begin(BeginToken), End, @@ -309,84 +303,86 @@ impl<'a> Printer<'a> { pub fn last_token(&mut self) -> Token { self.buf[self.right].token.clone() } - /// be very careful with this! + + /// Be very careful with this! pub fn replace_last_token(&mut self, t: Token) { self.buf[self.right].token = t; } - pub fn pretty_print(&mut self, token: Token) -> io::Result<()> { - debug!("pp Vec<{},{}>", self.left, self.right); - match token { - Token::Eof => { - if !self.scan_stack.is_empty() { - self.check_stack(0); - self.advance_left()?; - } - self.indent(0); - Ok(()) - } - Token::Begin(b) => { - if self.scan_stack.is_empty() { - self.left_total = 1; - self.right_total = 1; - self.left = 0; - self.right = 0; - } else { - self.advance_right(); - } - debug!("pp Begin({})/buffer Vec<{},{}>", - b.offset, self.left, self.right); - self.buf[self.right] = BufEntry { token: token, size: -self.right_total }; - let right = self.right; - self.scan_push(right); - Ok(()) - } - Token::End => { - if self.scan_stack.is_empty() { - debug!("pp End/print Vec<{},{}>", self.left, self.right); - self.print(token, 0) - } else { - debug!("pp End/buffer Vec<{},{}>", self.left, self.right); - self.advance_right(); - self.buf[self.right] = BufEntry { token: token, size: -1 }; - let right = self.right; - self.scan_push(right); - Ok(()) - } - } - Token::Break(b) => { - if self.scan_stack.is_empty() { - self.left_total = 1; - self.right_total = 1; - self.left = 0; - self.right = 0; - } else { - self.advance_right(); - } - debug!("pp Break({})/buffer Vec<{},{}>", - b.offset, self.left, self.right); + + fn pretty_print_eof(&mut self) -> io::Result<()> { + if !self.scan_stack.is_empty() { self.check_stack(0); + self.advance_left()?; + } + self.indent(0); + Ok(()) + } + + fn pretty_print_begin(&mut self, b: BeginToken) -> io::Result<()> { + if self.scan_stack.is_empty() { + self.left_total = 1; + self.right_total = 1; + self.left = 0; + self.right = 0; + } else { + self.advance_right(); + } + debug!("pp Begin({})/buffer Vec<{},{}>", + b.offset, self.left, self.right); + self.buf[self.right] = BufEntry { token: Token::Begin(b), size: -self.right_total }; + let right = self.right; + self.scan_push(right); + Ok(()) + } + + fn pretty_print_end(&mut self) -> io::Result<()> { + if self.scan_stack.is_empty() { + debug!("pp End/print Vec<{},{}>", self.left, self.right); + self.print_end() + } else { + debug!("pp End/buffer Vec<{},{}>", self.left, self.right); + self.advance_right(); + self.buf[self.right] = BufEntry { token: Token::End, size: -1 }; let right = self.right; self.scan_push(right); - self.buf[self.right] = BufEntry { token: token, size: -self.right_total }; - self.right_total += b.blank_space; Ok(()) - } - Token::String(s, len) => { - if self.scan_stack.is_empty() { - debug!("pp String('{}')/print Vec<{},{}>", - s, self.left, self.right); - self.print(Token::String(s, len), len) - } else { - debug!("pp String('{}')/buffer Vec<{},{}>", - s, self.left, self.right); - self.advance_right(); - self.buf[self.right] = BufEntry { token: Token::String(s, len), size: len }; - self.right_total += len; - self.check_stream() - } - } } } + + fn pretty_print_break(&mut self, b: BreakToken) -> io::Result<()> { + if self.scan_stack.is_empty() { + self.left_total = 1; + self.right_total = 1; + self.left = 0; + self.right = 0; + } else { + self.advance_right(); + } + debug!("pp Break({})/buffer Vec<{},{}>", + b.offset, self.left, self.right); + self.check_stack(0); + let right = self.right; + self.scan_push(right); + self.buf[self.right] = BufEntry { token: Token::Break(b), size: -self.right_total }; + self.right_total += b.blank_space; + Ok(()) + } + + fn pretty_print_string(&mut self, s: Cow<'static, str>, len: isize) -> io::Result<()> { + if self.scan_stack.is_empty() { + debug!("pp String('{}')/print Vec<{},{}>", + s, self.left, self.right); + self.print_string(s, len) + } else { + debug!("pp String('{}')/buffer Vec<{},{}>", + s, self.left, self.right); + self.advance_right(); + self.buf[self.right] = BufEntry { token: Token::String(s, len), size: len }; + self.right_total += len; + self.check_stream() + } + } + pub fn check_stream(&mut self) -> io::Result<()> { debug!("check_stream Vec<{}, {}> with left_total={}, right_total={}", self.left, self.right, self.left_total, self.right_total); @@ -405,19 +401,24 @@ impl<'a> Printer<'a> { } Ok(()) } + pub fn scan_push(&mut self, x: usize) { debug!("scan_push {}", x); self.scan_stack.push_front(x); } + pub fn scan_pop(&mut self) -> usize { self.scan_stack.pop_front().unwrap() } + pub fn scan_top(&mut self) -> usize { *self.scan_stack.front().unwrap() } + pub fn scan_pop_bottom(&mut self) -> usize { self.scan_stack.pop_back().unwrap() } + pub fn advance_right(&mut self) { self.right += 1; self.right %= self.buf_max_len; @@ -427,6 +428,7 @@ impl<'a> Printer<'a> { } assert_ne!(self.right, self.left); } + pub fn advance_left(&mut self) -> io::Result<()> { debug!("advance_left Vec<{},{}>, sizeof({})={}", self.left, self.right, self.left, self.buf[self.left].size); @@ -461,6 +463,7 @@ impl<'a> Printer<'a> { Ok(()) } + pub fn check_stack(&mut self, k: isize) { if !self.scan_stack.is_empty() { let x = self.scan_top(); @@ -488,6 +491,7 @@ impl<'a> Printer<'a> { } } } + pub fn print_newline(&mut self, amount: isize) -> io::Result<()> { debug!("NEWLINE {}", amount); let ret = write!(self.out, "\n"); @@ -495,10 +499,12 @@ impl<'a> Printer<'a> { self.indent(amount); ret } + pub fn indent(&mut self, amount: isize) { debug!("INDENT {}", amount); self.pending_indentation += amount; } + pub fn get_top(&mut self) -> PrintStackElem { match self.print_stack.last() { Some(el) => *el, @@ -508,62 +514,50 @@ impl<'a> Printer<'a> { } } } - pub fn print_str(&mut self, s: &str) -> io::Result<()> { - while self.pending_indentation > 0 { - write!(self.out, " ")?; - self.pending_indentation -= 1; + + pub fn print_begin(&mut self, b: BeginToken, l: isize) -> io::Result<()> { + if l > self.space { + let col = self.margin - self.space + b.offset; + debug!("print Begin -> push broken block at col {}", col); + self.print_stack.push(PrintStackElem { + offset: col, + pbreak: PrintStackBreak::Broken(b.breaks) + }); + } else { + debug!("print Begin -> push fitting block"); + self.print_stack.push(PrintStackElem { + offset: 0, + pbreak: PrintStackBreak::Fits + }); } - write!(self.out, "{}", s) + Ok(()) } - pub fn print(&mut self, token: Token, l: isize) -> io::Result<()> { - debug!("print {} {} (remaining line space={})", token, l, - self.space); - debug!("{}", buf_str(&self.buf, - self.left, - self.right, - 6)); - match token { - Token::Begin(b) => { - if l > self.space { - let col = self.margin - self.space + b.offset; - debug!("print Begin -> push broken block at col {}", col); - self.print_stack.push(PrintStackElem { - offset: col, - pbreak: PrintStackBreak::Broken(b.breaks) - }); - } else { - debug!("print Begin -> push fitting block"); - self.print_stack.push(PrintStackElem { - offset: 0, - pbreak: PrintStackBreak::Fits - }); - } - Ok(()) - } - Token::End => { - debug!("print End -> pop End"); - let print_stack = &mut self.print_stack; - assert!(!print_stack.is_empty()); - print_stack.pop().unwrap(); - Ok(()) - } - Token::Break(b) => { - let top = self.get_top(); - match top.pbreak { - PrintStackBreak::Fits => { + + pub fn print_end(&mut self) -> io::Result<()> { + debug!("print End -> pop End"); + let print_stack = &mut self.print_stack; + assert!(!print_stack.is_empty()); + print_stack.pop().unwrap(); + Ok(()) + } + + pub fn print_break(&mut self, b: BreakToken, l: isize) -> io::Result<()> { + let top = self.get_top(); + match top.pbreak { + PrintStackBreak::Fits => { debug!("print Break({}) in fitting block", b.blank_space); self.space -= b.blank_space; self.indent(b.blank_space); Ok(()) - } - PrintStackBreak::Broken(Breaks::Consistent) => { + } + PrintStackBreak::Broken(Breaks::Consistent) => { debug!("print Break({}+{}) in consistent block", top.offset, b.offset); let ret = self.print_newline(top.offset + b.offset); self.space = self.margin - (top.offset + b.offset); ret - } - PrintStackBreak::Broken(Breaks::Inconsistent) => { + } + PrintStackBreak::Broken(Breaks::Inconsistent) => { if l > self.space { debug!("print Break({}+{}) w/ newline in inconsistent", top.offset, b.offset); @@ -577,20 +571,37 @@ impl<'a> Printer<'a> { self.space -= b.blank_space; Ok(()) } - } } - } - Token::String(ref s, len) => { - debug!("print String({})", s); - assert_eq!(l, len); - // assert!(l <= space); - self.space -= len; - self.print_str(s) - } - Token::Eof => { - // Eof should never get here. - panic!(); - } + } + } + + pub fn print_string(&mut self, s: Cow<'static, str>, len: isize) -> io::Result<()> { + debug!("print String({})", s); + // assert!(len <= space); + self.space -= len; + while self.pending_indentation > 0 { + write!(self.out, " ")?; + self.pending_indentation -= 1; + } + write!(self.out, "{}", s) + } + + pub fn print(&mut self, token: Token, l: isize) -> io::Result<()> { + debug!("print {} {} (remaining line space={})", token, l, + self.space); + debug!("{}", buf_str(&self.buf, + self.left, + self.right, + 6)); + match token { + Token::Begin(b) => self.print_begin(b, l), + Token::End => self.print_end(), + Token::Break(b) => self.print_break(b, l), + Token::String(s, len) => { + assert_eq!(len, l); + self.print_string(s, len) + } + Token::Eof => panic!(), // Eof should never get here. } } @@ -598,10 +609,10 @@ impl<'a> Printer<'a> { /// "raw box" pub fn rbox(&mut self, indent: usize, b: Breaks) -> io::Result<()> { - self.pretty_print(Token::Begin(BeginToken { + self.pretty_print_begin(BeginToken { offset: indent as isize, breaks: b - })) + }) } /// Inconsistent breaking box @@ -615,30 +626,24 @@ impl<'a> Printer<'a> { } pub fn break_offset(&mut self, n: usize, off: isize) -> io::Result<()> { - self.pretty_print(Token::Break(BreakToken { + self.pretty_print_break(BreakToken { offset: off, blank_space: n as isize - })) + }) } pub fn end(&mut self) -> io::Result<()> { - self.pretty_print(Token::End) + self.pretty_print_end() } pub fn eof(&mut self) -> io::Result<()> { - self.pretty_print(Token::Eof) - } - - pub fn word(&mut self, wrd: &str) -> io::Result<()> { - self.pretty_print(Token::String(wrd.to_string(), wrd.len() as isize)) - } - - pub fn huge_word(&mut self, wrd: &str) -> io::Result<()> { - self.pretty_print(Token::String(wrd.to_string(), SIZE_INFINITY)) + self.pretty_print_eof() } - pub fn zero_word(&mut self, wrd: &str) -> io::Result<()> { - self.pretty_print(Token::String(wrd.to_string(), 0)) + pub fn word>>(&mut self, wrd: S) -> io::Result<()> { + let s = wrd.into(); + let len = s.len() as isize; + self.pretty_print_string(s, len) } fn spaces(&mut self, n: usize) -> io::Result<()> { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index ce7708cc42e..7cecf4b9af7 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_target::spec::abi::{self, Abi}; use ast::{self, BlockCheckMode, PatKind, RangeEnd, RangeSyntax}; use ast::{SelfKind, GenericBound, TraitBoundModifier}; @@ -16,7 +6,6 @@ use util::parser::{self, AssocOp, Fixity}; use attr; use source_map::{self, SourceMap, Spanned}; use syntax_pos::{self, BytePos}; -use syntax_pos::hygiene::{Mark, SyntaxContext}; use parse::token::{self, BinOpToken, Token}; use parse::lexer::comments; use parse::{self, ParseSess}; @@ -29,6 +18,7 @@ use syntax_pos::{DUMMY_SP, FileName}; use tokenstream::{self, TokenStream, TokenTree}; use std::ascii; +use std::borrow::Cow; use std::io::{self, Write, Read}; use std::iter::Peekable; use std::vec; @@ -209,7 +199,6 @@ pub fn token_to_string(tok: &Token) -> String { token::DotDot => "..".to_string(), token::DotDotDot => "...".to_string(), token::DotDotEq => "..=".to_string(), - token::DotEq => ".=".to_string(), token::Comma => ",".to_string(), token::Semi => ";".to_string(), token::Colon => ":".to_string(), @@ -235,6 +224,7 @@ pub fn token_to_string(tok: &Token) -> String { let mut out = match lit { token::Byte(b) => format!("b'{}'", b), token::Char(c) => format!("'{}'", c), + token::Err(c) => format!("'{}'", c), token::Float(c) | token::Integer(c) => c.to_string(), token::Str_(s) => format!("\"{}\"", s), @@ -444,7 +434,7 @@ pub trait PrintState<'a> { fn cur_lit(&mut self) -> Option<&comments::Literal>; fn bump_lit(&mut self) -> Option; - fn word_space(&mut self, w: &str) -> io::Result<()> { + fn word_space>>(&mut self, w: S) -> io::Result<()> { self.writer().word(w)?; self.writer().space() } @@ -539,7 +529,7 @@ pub trait PrintState<'a> { comments::Mixed => { assert_eq!(cmnt.lines.len(), 1); self.writer().zerobreak()?; - self.writer().word(&cmnt.lines[0])?; + self.writer().word(cmnt.lines[0].clone())?; self.writer().zerobreak() } comments::Isolated => { @@ -548,7 +538,7 @@ pub trait PrintState<'a> { // Don't print empty lines because they will end up as trailing // whitespace if !line.is_empty() { - self.writer().word(&line[..])?; + self.writer().word(line.clone())?; } self.writer().hardbreak()?; } @@ -559,13 +549,13 @@ pub trait PrintState<'a> { self.writer().word(" ")?; } if cmnt.lines.len() == 1 { - self.writer().word(&cmnt.lines[0])?; + self.writer().word(cmnt.lines[0].clone())?; self.writer().hardbreak() } else { self.ibox(0)?; for line in &cmnt.lines { if !line.is_empty() { - self.writer().word(&line[..])?; + self.writer().word(line.clone())?; } self.writer().hardbreak()?; } @@ -610,39 +600,47 @@ pub trait PrintState<'a> { fn print_literal(&mut self, lit: &ast::Lit) -> io::Result<()> { self.maybe_print_comment(lit.span.lo())?; if let Some(ltrl) = self.next_lit(lit.span.lo()) { - return self.writer().word(<rl.lit); + return self.writer().word(ltrl.lit.clone()); } match lit.node { ast::LitKind::Str(st, style) => self.print_string(&st.as_str(), style), + ast::LitKind::Err(st) => { + let st = st.as_str().escape_debug(); + let mut res = String::with_capacity(st.len() + 2); + res.push('\''); + res.push_str(&st); + res.push('\''); + self.writer().word(res) + } ast::LitKind::Byte(byte) => { let mut res = String::from("b'"); res.extend(ascii::escape_default(byte).map(|c| c as char)); res.push('\''); - self.writer().word(&res[..]) + self.writer().word(res) } ast::LitKind::Char(ch) => { let mut res = String::from("'"); res.extend(ch.escape_default()); res.push('\''); - self.writer().word(&res[..]) + self.writer().word(res) } ast::LitKind::Int(i, t) => { match t { ast::LitIntType::Signed(st) => { - self.writer().word(&st.val_to_string(i as i128)) + self.writer().word(st.val_to_string(i as i128)) } ast::LitIntType::Unsigned(ut) => { - self.writer().word(&ut.val_to_string(i)) + self.writer().word(ut.val_to_string(i)) } ast::LitIntType::Unsuffixed => { - self.writer().word(&i.to_string()) + self.writer().word(i.to_string()) } } } ast::LitKind::Float(ref f, t) => { - self.writer().word(&format!("{}{}", &f, t.ty_to_string())) + self.writer().word(format!("{}{}", &f, t.ty_to_string())) } - ast::LitKind::FloatUnsuffixed(ref f) => self.writer().word(&f.as_str()), + ast::LitKind::FloatUnsuffixed(ref f) => self.writer().word(f.as_str().get()), ast::LitKind::Bool(val) => { if val { self.writer().word("true") } else { self.writer().word("false") } } @@ -652,7 +650,7 @@ pub trait PrintState<'a> { escaped.extend(ascii::escape_default(ch) .map(|c| c as char)); } - self.writer().word(&format!("b\"{}\"", escaped)) + self.writer().word(format!("b\"{}\"", escaped)) } } } @@ -669,7 +667,7 @@ pub trait PrintState<'a> { string=st)) } }; - self.writer().word(&st[..]) + self.writer().word(st) } fn print_inner_attributes(&mut self, @@ -724,12 +722,12 @@ pub trait PrintState<'a> { if i > 0 { self.writer().word("::")? } - if segment.ident.name != keywords::CrateRoot.name() && - segment.ident.name != keywords::DollarCrate.name() - { - self.writer().word(&segment.ident.as_str())?; - } else if segment.ident.name == keywords::DollarCrate.name() { - self.print_dollar_crate(segment.ident.span.ctxt())?; + if segment.ident.name != keywords::PathRoot.name() { + if segment.ident.name == keywords::DollarCrate.name() { + self.print_dollar_crate(segment.ident)?; + } else { + self.writer().word(segment.ident.as_str().get())?; + } } } Ok(()) @@ -746,7 +744,7 @@ pub trait PrintState<'a> { } self.maybe_print_comment(attr.span.lo())?; if attr.is_sugared_doc { - self.writer().word(&attr.value_str().unwrap().as_str())?; + self.writer().word(attr.value_str().unwrap().as_str().get())?; self.writer().hardbreak() } else { match attr.style { @@ -807,7 +805,7 @@ pub trait PrintState<'a> { fn print_tt(&mut self, tt: tokenstream::TokenTree) -> io::Result<()> { match tt { TokenTree::Token(_, ref tk) => { - self.writer().word(&token_to_string(tk))?; + self.writer().word(token_to_string(tk))?; match *tk { parse::token::DocComment(..) => { self.writer().hardbreak() @@ -815,12 +813,12 @@ pub trait PrintState<'a> { _ => Ok(()) } } - TokenTree::Delimited(_, ref delimed) => { - self.writer().word(&token_to_string(&delimed.open_token()))?; + TokenTree::Delimited(_, delim, tts) => { + self.writer().word(token_to_string(&token::OpenDelim(delim)))?; self.writer().space()?; - self.print_tts(delimed.stream())?; + self.print_tts(tts)?; self.writer().space()?; - self.writer().word(&token_to_string(&delimed.close_token())) + self.writer().word(token_to_string(&token::CloseDelim(delim))) }, } } @@ -843,17 +841,19 @@ pub trait PrintState<'a> { fn nbsp(&mut self) -> io::Result<()> { self.writer().word(" ") } - fn print_dollar_crate(&mut self, mut ctxt: SyntaxContext) -> io::Result<()> { - if let Some(mark) = ctxt.adjust(Mark::root()) { - // Make a best effort to print something that complies - if mark.is_builtin() { - if let Some(name) = std_inject::injected_crate_name() { - self.writer().word("::")?; - self.writer().word(name)?; - } - } + // AST pretty-printer is used as a fallback for turning AST structures into token streams for + // proc macros. Additionally, proc macros may stringify their input and expect it survive the + // stringification (especially true for proc macro derives written between Rust 1.15 and 1.30). + // So we need to somehow pretty-print `$crate` in paths in a way preserving at least some of + // its hygiene data, most importantly name of the crate it refers to. + // As a result we print `$crate` as `crate` if it refers to the local crate + // and as `::other_crate_name` if it refers to some other crate. + fn print_dollar_crate(&mut self, ident: ast::Ident) -> io::Result<()> { + let name = ident.span.ctxt().dollar_crate_name(); + if !ast::Ident::with_empty_ctxt(name).is_path_segment_keyword() { + self.writer().word("::")?; } - Ok(()) + self.writer().word(name.as_str().get()) } } @@ -889,12 +889,13 @@ impl<'a> State<'a> { self.s.cbox(u) } - pub fn word_nbsp(&mut self, w: &str) -> io::Result<()> { + pub fn word_nbsp>>(&mut self, w: S) -> io::Result<()> { self.s.word(w)?; self.nbsp() } - pub fn head(&mut self, w: &str) -> io::Result<()> { + pub fn head>>(&mut self, w: S) -> io::Result<()> { + let w = w.into(); // outer-box is consistent self.cbox(INDENT_UNIT)?; // head-box is inconsistent @@ -956,7 +957,7 @@ impl<'a> State<'a> { pub fn synth_comment(&mut self, text: String) -> io::Result<()> { self.s.word("/*")?; self.s.space()?; - self.s.word(&text[..])?; + self.s.word(text)?; self.s.space()?; self.s.word("*/") } @@ -1101,7 +1102,9 @@ impl<'a> State<'a> { self.s.word("_")?; } ast::TyKind::Err => { - self.s.word("?")?; + self.popen()?; + self.s.word("/*ERROR*/")?; + self.pclose()?; } ast::TyKind::ImplicitSelf => { self.s.word("Self")?; @@ -1129,7 +1132,7 @@ impl<'a> State<'a> { self.end() // end the outer fn box } ast::ForeignItemKind::Static(ref t, m) => { - self.head(&visibility_qualified(&item.vis, "static"))?; + self.head(visibility_qualified(&item.vis, "static"))?; if m { self.word_space("mut")?; } @@ -1141,7 +1144,7 @@ impl<'a> State<'a> { self.end() // end the outer cbox } ast::ForeignItemKind::Ty => { - self.head(&visibility_qualified(&item.vis, "type"))?; + self.head(visibility_qualified(&item.vis, "type"))?; self.print_ident(item.ident)?; self.s.word(";")?; self.end()?; // end the head-ibox @@ -1164,7 +1167,7 @@ impl<'a> State<'a> { vis: &ast::Visibility) -> io::Result<()> { - self.s.word(&visibility_qualified(vis, ""))?; + self.s.word(visibility_qualified(vis, ""))?; self.word_space("const")?; self.print_ident(ident)?; self.word_space(":")?; @@ -1203,7 +1206,7 @@ impl<'a> State<'a> { self.ann.pre(self, AnnNode::Item(item))?; match item.node { ast::ItemKind::ExternCrate(orig_name) => { - self.head(&visibility_qualified(&item.vis, "extern crate"))?; + self.head(visibility_qualified(&item.vis, "extern crate"))?; if let Some(orig_name) = orig_name { self.print_name(orig_name)?; self.s.space()?; @@ -1216,14 +1219,14 @@ impl<'a> State<'a> { self.end()?; // end outer head-block } ast::ItemKind::Use(ref tree) => { - self.head(&visibility_qualified(&item.vis, "use"))?; + self.head(visibility_qualified(&item.vis, "use"))?; self.print_use_tree(tree)?; self.s.word(";")?; self.end()?; // end inner head-block self.end()?; // end outer head-block } ast::ItemKind::Static(ref ty, m, ref expr) => { - self.head(&visibility_qualified(&item.vis, "static"))?; + self.head(visibility_qualified(&item.vis, "static"))?; if m == ast::Mutability::Mutable { self.word_space("mut")?; } @@ -1239,7 +1242,7 @@ impl<'a> State<'a> { self.end()?; // end the outer cbox } ast::ItemKind::Const(ref ty, ref expr) => { - self.head(&visibility_qualified(&item.vis, "const"))?; + self.head(visibility_qualified(&item.vis, "const"))?; self.print_ident(item.ident)?; self.word_space(":")?; self.print_type(ty)?; @@ -1264,7 +1267,7 @@ impl<'a> State<'a> { self.print_block_with_attrs(body, &item.attrs)?; } ast::ItemKind::Mod(ref _mod) => { - self.head(&visibility_qualified(&item.vis, "mod"))?; + self.head(visibility_qualified(&item.vis, "mod"))?; self.print_ident(item.ident)?; if _mod.inline || self.is_expanded { @@ -1281,18 +1284,18 @@ impl<'a> State<'a> { } ast::ItemKind::ForeignMod(ref nmod) => { self.head("extern")?; - self.word_nbsp(&nmod.abi.to_string())?; + self.word_nbsp(nmod.abi.to_string())?; self.bopen()?; self.print_foreign_mod(nmod, &item.attrs)?; self.bclose(item.span)?; } ast::ItemKind::GlobalAsm(ref ga) => { - self.head(&visibility_qualified(&item.vis, "global_asm!"))?; - self.s.word(&ga.asm.as_str())?; + self.head(visibility_qualified(&item.vis, "global_asm!"))?; + self.s.word(ga.asm.as_str().get())?; self.end()?; } ast::ItemKind::Ty(ref ty, ref generics) => { - self.head(&visibility_qualified(&item.vis, "type"))?; + self.head(visibility_qualified(&item.vis, "type"))?; self.print_ident(item.ident)?; self.print_generic_params(&generics.params)?; self.end()?; // end the inner ibox @@ -1305,7 +1308,7 @@ impl<'a> State<'a> { self.end()?; // end the outer ibox } ast::ItemKind::Existential(ref bounds, ref generics) => { - self.head(&visibility_qualified(&item.vis, "existential type"))?; + self.head(visibility_qualified(&item.vis, "existential type"))?; self.print_ident(item.ident)?; self.print_generic_params(&generics.params)?; self.end()?; // end the inner ibox @@ -1326,11 +1329,11 @@ impl<'a> State<'a> { )?; } ast::ItemKind::Struct(ref struct_def, ref generics) => { - self.head(&visibility_qualified(&item.vis, "struct"))?; + self.head(visibility_qualified(&item.vis, "struct"))?; self.print_struct(struct_def, generics, item.ident, item.span, true)?; } ast::ItemKind::Union(ref struct_def, ref generics) => { - self.head(&visibility_qualified(&item.vis, "union"))?; + self.head(visibility_qualified(&item.vis, "union"))?; self.print_struct(struct_def, generics, item.ident, item.span, true)?; } ast::ItemKind::Impl(unsafety, @@ -1479,7 +1482,7 @@ impl<'a> State<'a> { generics: &ast::Generics, ident: ast::Ident, span: syntax_pos::Span, visibility: &ast::Visibility) -> io::Result<()> { - self.head(&visibility_qualified(visibility, "enum"))?; + self.head(visibility_qualified(visibility, "enum"))?; self.print_ident(ident)?; self.print_generic_params(&generics.params)?; self.print_where_clause(&generics.where_clause)?; @@ -1514,9 +1517,9 @@ impl<'a> State<'a> { ast::VisibilityKind::Restricted { ref path, .. } => { let path = to_string(|s| s.print_path(path, false, 0)); if path == "self" || path == "super" { - self.word_nbsp(&format!("pub({})", path)) + self.word_nbsp(format!("pub({})", path)) } else { - self.word_nbsp(&format!("pub(in {})", path)) + self.word_nbsp(format!("pub(in {})", path)) } } ast::VisibilityKind::Inherited => Ok(()) @@ -1525,7 +1528,7 @@ impl<'a> State<'a> { pub fn print_defaultness(&mut self, defaultness: ast::Defaultness) -> io::Result<()> { if let ast::Defaultness::Default = defaultness { - try!(self.word_nbsp("default")); + self.word_nbsp("default")?; } Ok(()) } @@ -2399,6 +2402,11 @@ impl<'a> State<'a> { self.s.space()?; self.print_block_with_attrs(blk, attrs)? } + ast::ExprKind::Err => { + self.popen()?; + self.s.word("/*ERROR*/")?; + self.pclose()? + } } self.ann.post(self, AnnNode::Expr(expr))?; self.end() @@ -2415,19 +2423,19 @@ impl<'a> State<'a> { pub fn print_ident(&mut self, ident: ast::Ident) -> io::Result<()> { if ident.is_raw_guess() { - self.s.word(&format!("r#{}", ident))?; + self.s.word(format!("r#{}", ident))?; } else { - self.s.word(&ident.as_str())?; + self.s.word(ident.as_str().get())?; } self.ann.post(self, AnnNode::Ident(&ident)) } pub fn print_usize(&mut self, i: usize) -> io::Result<()> { - self.s.word(&i.to_string()) + self.s.word(i.to_string()) } pub fn print_name(&mut self, name: ast::Name) -> io::Result<()> { - self.s.word(&name.as_str())?; + self.s.word(name.as_str().get())?; self.ann.post(self, AnnNode::Name(&name)) } @@ -2462,14 +2470,15 @@ impl<'a> State<'a> { colons_before_params: bool) -> io::Result<()> { - if segment.ident.name != keywords::CrateRoot.name() && - segment.ident.name != keywords::DollarCrate.name() { - self.print_ident(segment.ident)?; + if segment.ident.name != keywords::PathRoot.name() { + if segment.ident.name == keywords::DollarCrate.name() { + self.print_dollar_crate(segment.ident)?; + } else { + self.print_ident(segment.ident)?; + } if let Some(ref args) = segment.args { self.print_generic_args(args, colons_before_params)?; } - } else if segment.ident.name == keywords::DollarCrate.name() { - self.print_dollar_crate(segment.ident.span.ctxt())?; } Ok(()) } @@ -2851,10 +2860,8 @@ impl<'a> State<'a> { } } - pub fn print_type_bounds(&mut self, - prefix: &str, - bounds: &[ast::GenericBound]) - -> io::Result<()> { + pub fn print_type_bounds(&mut self, prefix: &'static str, bounds: &[ast::GenericBound]) + -> io::Result<()> { if !bounds.is_empty() { self.s.word(prefix)?; let mut first = true; @@ -3146,7 +3153,7 @@ impl<'a> State<'a> { Some(Abi::Rust) => Ok(()), Some(abi) => { self.word_nbsp("extern")?; - self.word_nbsp(&abi.to_string()) + self.word_nbsp(abi.to_string()) } None => Ok(()) } @@ -3157,7 +3164,7 @@ impl<'a> State<'a> { match opt_abi { Some(abi) => { self.word_nbsp("extern")?; - self.word_nbsp(&abi.to_string()) + self.word_nbsp(abi.to_string()) } None => Ok(()) } @@ -3166,7 +3173,7 @@ impl<'a> State<'a> { pub fn print_fn_header_info(&mut self, header: ast::FnHeader, vis: &ast::Visibility) -> io::Result<()> { - self.s.word(&visibility_qualified(vis, ""))?; + self.s.word(visibility_qualified(vis, ""))?; match header.constness.node { ast::Constness::NotConst => {} @@ -3178,7 +3185,7 @@ impl<'a> State<'a> { if header.abi != Abi::Rust { self.word_nbsp("extern")?; - self.word_nbsp(&header.abi.to_string())?; + self.word_nbsp(header.abi.to_string())?; } self.s.word("fn") diff --git a/src/libsyntax/ptr.rs b/src/libsyntax/ptr.rs index bb47d9b535b..3effe53cd29 100644 --- a/src/libsyntax/ptr.rs +++ b/src/libsyntax/ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The AST pointer //! //! Provides `P`, a frozen owned smart pointer, as a replacement for `@T` in @@ -16,11 +6,11 @@ //! # Motivations and benefits //! //! * **Identity**: sharing AST nodes is problematic for the various analysis -//! passes (e.g. one may be able to bypass the borrow checker with a shared +//! passes (e.g., one may be able to bypass the borrow checker with a shared //! `ExprKind::AddrOf` node taking a mutable borrow). The only reason `@T` in the //! AST hasn't caused issues is because of inefficient folding passes which //! would always deduplicate any such shared nodes. Even if the AST were to -//! switch to an arena, this would still hold, i.e. it couldn't use `&'a T`, +//! switch to an arena, this would still hold, i.e., it couldn't use `&'a T`, //! but rather a wrapper like `P<'a, T>`. //! //! * **Immutability**: `P` disallows mutating its inner `T`, unlike `Box` @@ -34,7 +24,7 @@ //! * **Maintainability**: `P` provides a fixed interface - `Deref`, //! `and_then` and `map` - which can remain fully functional even if the //! implementation changes (using a special thread-local heap, for example). -//! Moreover, a switch to, e.g. `P<'a, T>` would be easy and mostly automated. +//! Moreover, a switch to, e.g., `P<'a, T>` would be easy and mostly automated. use std::fmt::{self, Display, Debug}; use std::iter::FromIterator; @@ -72,7 +62,7 @@ impl P { *self.ptr } - /// Transform the inner value, consuming `self` and producing a new `P`. + /// Produce a new `P` from `self` without reallocating. pub fn map(mut self, f: F) -> P where F: FnOnce(T) -> T, { @@ -88,8 +78,31 @@ impl P { ptr::write(p, f(ptr::read(p))); // Recreate self from the raw pointer. - P { - ptr: Box::from_raw(p) + P { ptr: Box::from_raw(p) } + } + } + + /// Optionally produce a new `P` from `self` without reallocating. + pub fn filter_map(mut self, f: F) -> Option> where + F: FnOnce(T) -> Option, + { + let p: *mut T = &mut *self.ptr; + + // Leak self in case of panic. + // FIXME(eddyb) Use some sort of "free guard" that + // only deallocates, without dropping the pointee, + // in case the call the `f` below ends in a panic. + mem::forget(self); + + unsafe { + if let Some(v) = f(ptr::read(p)) { + ptr::write(p, v); + + // Recreate self from the raw pointer. + Some(P { ptr: Box::from_raw(p) }) + } else { + drop(Box::from_raw(p)); + None } } } diff --git a/src/libsyntax/show_span.rs b/src/libsyntax/show_span.rs index 8ab2ba71ec1..4228e0c87ce 100644 --- a/src/libsyntax/show_span.rs +++ b/src/libsyntax/show_span.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Span debugger //! //! This module shows spans for all expressions in the crate diff --git a/src/libsyntax/source_map.rs b/src/libsyntax/source_map.rs index e8cacc3b5af..0a46d034558 100644 --- a/src/libsyntax/source_map.rs +++ b/src/libsyntax/source_map.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The SourceMap tracks all the source code used within a single crate, mapping //! from integer byte positions to the original source code location. Each bit //! of source parsed during crate parsing (typically files, in-memory strings, @@ -31,7 +21,7 @@ use std::path::{Path, PathBuf}; use std::env; use std::fs; -use std::io::{self, Read}; +use std::io; use errors::SourceMapper; /// Return the span itself if it doesn't come from a macro expansion, @@ -96,9 +86,7 @@ impl FileLoader for RealFileLoader { } fn read_file(&self, path: &Path) -> io::Result { - let mut src = String::new(); - fs::File::open(path)?.read_to_string(&mut src)?; - Ok(src) + fs::read_to_string(path) } } @@ -110,11 +98,19 @@ pub struct StableSourceFileId(u128); impl StableSourceFileId { pub fn new(source_file: &SourceFile) -> StableSourceFileId { + StableSourceFileId::new_from_pieces(&source_file.name, + source_file.name_was_remapped, + source_file.unmapped_path.as_ref()) + } + + pub fn new_from_pieces(name: &FileName, + name_was_remapped: bool, + unmapped_path: Option<&FileName>) -> StableSourceFileId { let mut hasher = StableHasher::new(); - source_file.name.hash(&mut hasher); - source_file.name_was_remapped.hash(&mut hasher); - source_file.unmapped_path.hash(&mut hasher); + name.hash(&mut hasher); + name_was_remapped.hash(&mut hasher); + unmapped_path.hash(&mut hasher); StableSourceFileId(hasher.finish()) } @@ -136,9 +132,6 @@ pub struct SourceMap { // This is used to apply the file path remapping as specified via // --remap-path-prefix to all SourceFiles allocated within this SourceMap. path_mapping: FilePathMapping, - /// In case we are in a doctest, replace all file names with the PathBuf, - /// and add the given offsets to the line info - doctest_offset: Option<(FileName, isize)>, } impl SourceMap { @@ -147,19 +140,9 @@ impl SourceMap { files: Default::default(), file_loader: Box::new(RealFileLoader), path_mapping, - doctest_offset: None, } } - pub fn new_doctest(path_mapping: FilePathMapping, - file: FileName, line: isize) -> SourceMap { - SourceMap { - doctest_offset: Some((file, line)), - ..SourceMap::new(path_mapping) - } - - } - pub fn with_file_loader(file_loader: Box, path_mapping: FilePathMapping) -> SourceMap { @@ -167,7 +150,6 @@ impl SourceMap { files: Default::default(), file_loader: file_loader, path_mapping, - doctest_offset: None, } } @@ -181,11 +163,7 @@ impl SourceMap { pub fn load_file(&self, path: &Path) -> io::Result> { let src = self.file_loader.read_file(path)?; - let filename = if let Some((ref name, _)) = self.doctest_offset { - name.clone() - } else { - path.to_owned().into() - }; + let filename = path.to_owned().into(); Ok(self.new_source_file(filename, src)) } @@ -208,7 +186,8 @@ impl SourceMap { } /// Creates a new source_file. - /// This does not ensure that only one SourceFile exists per file name. + /// If a file already exists in the source_map with the same id, that file is returned + /// unmodified pub fn new_source_file(&self, filename: FileName, src: String) -> Lrc { let start_pos = self.next_start_pos(); @@ -226,21 +205,30 @@ impl SourceMap { }, other => (other, false), }; - let source_file = Lrc::new(SourceFile::new( - filename, - was_remapped, - unmapped_path, - src, - Pos::from_usize(start_pos), - )); - let mut files = self.files.borrow_mut(); + let file_id = StableSourceFileId::new_from_pieces(&filename, + was_remapped, + Some(&unmapped_path)); - files.source_files.push(source_file.clone()); - files.stable_id_to_source_file.insert(StableSourceFileId::new(&source_file), - source_file.clone()); + return match self.source_file_by_stable_id(file_id) { + Some(lrc_sf) => lrc_sf, + None => { + let source_file = Lrc::new(SourceFile::new( + filename, + was_remapped, + unmapped_path, + src, + Pos::from_usize(start_pos), + )); - source_file + let mut files = self.files.borrow_mut(); + + files.source_files.push(source_file.clone()); + files.stable_id_to_source_file.insert(file_id, source_file.clone()); + + source_file + } + } } /// Allocates a new SourceFile representing a source file from an external @@ -310,15 +298,17 @@ impl SourceMap { } // If there is a doctest_offset, apply it to the line - pub fn doctest_offset_line(&self, mut orig: usize) -> usize { - if let Some((_, line)) = self.doctest_offset { - if line >= 0 { - orig = orig + line as usize; - } else { - orig = orig - (-line) as usize; - } + pub fn doctest_offset_line(&self, file: &FileName, orig: usize) -> usize { + return match file { + FileName::DocTest(_, offset) => { + return if *offset >= 0 { + orig + *offset as usize + } else { + orig - (-(*offset)) as usize + } + }, + _ => orig } - orig } /// Lookup source information about a BytePos @@ -579,7 +569,7 @@ impl SourceMap { match self.span_to_prev_source(sp) { Err(_) => None, Ok(source) => source.split('\n').last().map(|last_line| { - last_line.len() - last_line.trim_left().len() + last_line.len() - last_line.trim_start().len() }) } } @@ -593,7 +583,7 @@ impl SourceMap { /// if no character could be found or if an error occurred while retrieving the code snippet. pub fn span_extend_to_prev_char(&self, sp: Span, c: char) -> Span { if let Ok(prev_source) = self.span_to_prev_source(sp) { - let prev_source = prev_source.rsplit(c).nth(0).unwrap_or("").trim_left(); + let prev_source = prev_source.rsplit(c).nth(0).unwrap_or("").trim_start(); if !prev_source.is_empty() && !prev_source.contains('\n') { return sp.with_lo(BytePos(sp.lo().0 - prev_source.len() as u32)); } @@ -613,7 +603,7 @@ impl SourceMap { for ws in &[" ", "\t", "\n"] { let pat = pat.to_owned() + ws; if let Ok(prev_source) = self.span_to_prev_source(sp) { - let prev_source = prev_source.rsplit(&pat).nth(0).unwrap_or("").trim_left(); + let prev_source = prev_source.rsplit(&pat).nth(0).unwrap_or("").trim_start(); if !prev_source.is_empty() && (!prev_source.contains('\n') || accept_newlines) { return sp.with_lo(BytePos(sp.lo().0 - prev_source.len() as u32)); } @@ -627,7 +617,7 @@ impl SourceMap { pub fn span_until_char(&self, sp: Span, c: char) -> Span { match self.span_to_snippet(sp) { Ok(snippet) => { - let snippet = snippet.split(c).nth(0).unwrap_or("").trim_right(); + let snippet = snippet.split(c).nth(0).unwrap_or("").trim_end(); if !snippet.is_empty() && !snippet.contains('\n') { sp.with_hi(BytePos(sp.lo().0 + snippet.len() as u32)) } else { @@ -983,8 +973,8 @@ impl SourceMapper for SourceMap { } ) } - fn doctest_offset_line(&self, line: usize) -> usize { - self.doctest_offset_line(line) + fn doctest_offset_line(&self, file: &FileName, line: usize) -> usize { + self.doctest_offset_line(file, line) } } diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs index 1210f331b28..e0770834421 100644 --- a/src/libsyntax/std_inject.rs +++ b/src/libsyntax/std_inject.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ast; use attr; use std::cell::Cell; @@ -112,7 +102,7 @@ pub fn maybe_inject_crates_ref( vis: respan(span.shrink_to_lo(), ast::VisibilityKind::Inherited), node: ast::ItemKind::Use(P(ast::UseTree { prefix: ast::Path { - segments: iter::once(keywords::CrateRoot.ident()) + segments: iter::once(keywords::PathRoot.ident()) .chain( [name, "prelude", "v1"].iter().cloned() .map(ast::Ident::from_str) diff --git a/src/libsyntax/str.rs b/src/libsyntax/str.rs deleted file mode 100644 index 281861918fd..00000000000 --- a/src/libsyntax/str.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[inline] -pub fn char_at(s: &str, byte: usize) -> char { - s[byte..].chars().next().unwrap() -} diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 8ff4b0d025c..b352486e39a 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Code that generates a test runner to run all the tests in a crate #![allow(dead_code)] @@ -281,7 +271,7 @@ fn generate_test_harness(sess: &ParseSess, path: Vec::new(), test_cases: Vec::new(), reexport_test_harness_main, - // NB: doesn't consider the value of `--crate-name` passed on the command line. + // N.B., doesn't consider the value of `--crate-name` passed on the command line. is_libtest: attr::find_crate_name(&krate.attrs).map(|s| s == "test").unwrap_or(false), toplevel_reexport: None, ctxt: SyntaxContext::empty().apply_mark(mark), @@ -438,14 +428,11 @@ fn is_test_case(i: &ast::Item) -> bool { fn get_test_runner(sd: &errors::Handler, krate: &ast::Crate) -> Option { let test_attr = attr::find_by_name(&krate.attrs, "test_runner")?; - if let Some(meta_list) = test_attr.meta_item_list() { + test_attr.meta_item_list().map(|meta_list| { if meta_list.len() != 1 { sd.span_fatal(test_attr.span(), "#![test_runner(..)] accepts exactly 1 argument").raise() } - Some(meta_list[0].word().as_ref().unwrap().ident.clone()) - } else { - sd.span_fatal(test_attr.span(), - "test_runner must be of the form #[test_runner(..)]").raise() - } + meta_list[0].word().as_ref().unwrap().ident.clone() + }) } diff --git a/src/libsyntax/test_snippet.rs b/src/libsyntax/test_snippet.rs index 799489ba42c..26b4762aaf3 100644 --- a/src/libsyntax/test_snippet.rs +++ b/src/libsyntax/test_snippet.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use source_map::{SourceMap, FilePathMapping}; use errors::Handler; use errors::emitter::EmitterWriter; diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs index 242299f1b1f..f5d2d6f18ee 100644 --- a/src/libsyntax/tokenstream.rs +++ b/src/libsyntax/tokenstream.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! # Token Streams //! //! `TokenStream`s represent syntactic objects before they are converted into ASTs. @@ -28,58 +18,12 @@ use ext::tt::{macro_parser, quoted}; use parse::Directory; use parse::token::{self, DelimToken, Token}; use print::pprust; +use rustc_data_structures::sync::Lrc; use serialize::{Decoder, Decodable, Encoder, Encodable}; -use util::RcVec; use std::borrow::Cow; use std::{fmt, iter, mem}; -/// A delimited sequence of token trees -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)] -pub struct Delimited { - /// The type of delimiter - pub delim: DelimToken, - /// The delimited sequence of token trees - pub tts: ThinTokenStream, -} - -impl Delimited { - /// Returns the opening delimiter as a token. - pub fn open_token(&self) -> token::Token { - token::OpenDelim(self.delim) - } - - /// Returns the closing delimiter as a token. - pub fn close_token(&self) -> token::Token { - token::CloseDelim(self.delim) - } - - /// Returns the opening delimiter as a token tree. - pub fn open_tt(&self, span: Span) -> TokenTree { - let open_span = if span.is_dummy() { - span - } else { - span.with_hi(span.lo() + BytePos(self.delim.len() as u32)) - }; - TokenTree::Token(open_span, self.open_token()) - } - - /// Returns the closing delimiter as a token tree. - pub fn close_tt(&self, span: Span) -> TokenTree { - let close_span = if span.is_dummy() { - span - } else { - span.with_lo(span.hi() - BytePos(self.delim.len() as u32)) - }; - TokenTree::Token(close_span, self.close_token()) - } - - /// Returns the token trees inside the delimiters. - pub fn stream(&self) -> TokenStream { - self.tts.clone().into() - } -} - /// When the main rust parser encounters a syntax-extension invocation, it /// parses the arguments to the invocation as a token-tree. This is a very /// loose structure, such that all sorts of different AST-fragments can @@ -97,7 +41,7 @@ pub enum TokenTree { /// A single token Token(Span, token::Token), /// A delimited sequence of token trees - Delimited(DelimSpan, Delimited), + Delimited(DelimSpan, DelimToken, TokenStream), } impl TokenTree { @@ -116,9 +60,9 @@ impl TokenTree { pub fn eq_unspanned(&self, other: &TokenTree) -> bool { match (self, other) { (&TokenTree::Token(_, ref tk), &TokenTree::Token(_, ref tk2)) => tk == tk2, - (&TokenTree::Delimited(_, ref dl), &TokenTree::Delimited(_, ref dl2)) => { - dl.delim == dl2.delim && - dl.stream().eq_unspanned(&dl2.stream()) + (&TokenTree::Delimited(_, delim, ref tts), + &TokenTree::Delimited(_, delim2, ref tts2)) => { + delim == delim2 && tts.eq_unspanned(&tts2) } (_, _) => false, } @@ -134,9 +78,9 @@ impl TokenTree { (&TokenTree::Token(_, ref tk), &TokenTree::Token(_, ref tk2)) => { tk.probably_equal_for_proc_macro(tk2) } - (&TokenTree::Delimited(_, ref dl), &TokenTree::Delimited(_, ref dl2)) => { - dl.delim == dl2.delim && - dl.stream().probably_equal_for_proc_macro(&dl2.stream()) + (&TokenTree::Delimited(_, delim, ref tts), + &TokenTree::Delimited(_, delim2, ref tts2)) => { + delim == delim2 && tts.probably_equal_for_proc_macro(&tts2) } (_, _) => false, } @@ -146,7 +90,7 @@ impl TokenTree { pub fn span(&self) -> Span { match *self { TokenTree::Token(sp, _) => sp, - TokenTree::Delimited(sp, _) => sp.entire(), + TokenTree::Delimited(sp, ..) => sp.entire(), } } @@ -154,7 +98,7 @@ impl TokenTree { pub fn set_span(&mut self, span: Span) { match *self { TokenTree::Token(ref mut sp, _) => *sp = span, - TokenTree::Delimited(ref mut sp, _) => *sp = DelimSpan::from_single(span), + TokenTree::Delimited(ref mut sp, ..) => *sp = DelimSpan::from_single(span), } } @@ -167,7 +111,27 @@ impl TokenTree { } pub fn joint(self) -> TokenStream { - TokenStream { kind: TokenStreamKind::JointTree(self) } + TokenStream::new(vec![(self, Joint)]) + } + + /// Returns the opening delimiter as a token tree. + pub fn open_tt(span: Span, delim: DelimToken) -> TokenTree { + let open_span = if span.is_dummy() { + span + } else { + span.with_hi(span.lo() + BytePos(delim.len() as u32)) + }; + TokenTree::Token(open_span, token::OpenDelim(delim)) + } + + /// Returns the closing delimiter as a token tree. + pub fn close_tt(span: Span, delim: DelimToken) -> TokenTree { + let close_span = if span.is_dummy() { + span + } else { + span.with_lo(span.hi() - BytePos(delim.len() as u32)) + }; + TokenTree::Token(close_span, token::CloseDelim(delim)) } } @@ -177,62 +141,72 @@ impl TokenTree { /// The goal is for procedural macros to work with `TokenStream`s and `TokenTree`s /// instead of a representation of the abstract syntax tree. /// Today's `TokenTree`s can still contain AST via `Token::Interpolated` for back-compat. +/// +/// The use of `Option` is an optimization that avoids the need for an +/// allocation when the stream is empty. However, it is not guaranteed that an +/// empty stream is represented with `None`; it may be represented as a `Some` +/// around an empty `Vec`. #[derive(Clone, Debug)] -pub struct TokenStream { - kind: TokenStreamKind, +pub struct TokenStream(Option>>); + +pub type TreeAndJoint = (TokenTree, IsJoint); + +// `TokenStream` is used a lot. Make sure it doesn't unintentionally get bigger. +#[cfg(target_arch = "x86_64")] +static_assert!(MEM_SIZE_OF_TOKEN_STREAM: mem::size_of::() == 8); + +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum IsJoint { + Joint, + NonJoint } +use self::IsJoint::*; + impl TokenStream { /// Given a `TokenStream` with a `Stream` of only two arguments, return a new `TokenStream` /// separating the two arguments with a comma for diagnostic suggestions. pub(crate) fn add_comma(&self) -> Option<(TokenStream, Span)> { // Used to suggest if a user writes `foo!(a b);` - if let TokenStreamKind::Stream(ref slice) = self.kind { + if let Some(ref stream) = self.0 { let mut suggestion = None; - let mut iter = slice.iter().enumerate().peekable(); + let mut iter = stream.iter().enumerate().peekable(); while let Some((pos, ts)) = iter.next() { if let Some((_, next)) = iter.peek() { - let sp = match (&ts.kind, &next.kind) { - (TokenStreamKind::Tree(TokenTree::Token(_, token::Token::Comma)), _) | - (_, TokenStreamKind::Tree(TokenTree::Token(_, token::Token::Comma))) => { - continue; - } - (TokenStreamKind::Tree(TokenTree::Token(sp, _)), _) => *sp, - (TokenStreamKind::Tree(TokenTree::Delimited(sp, _)), _) => sp.entire(), + let sp = match (&ts, &next) { + ((TokenTree::Token(_, token::Token::Comma), NonJoint), _) | + (_, (TokenTree::Token(_, token::Token::Comma), NonJoint)) => continue, + ((TokenTree::Token(sp, _), NonJoint), _) => *sp, + ((TokenTree::Delimited(sp, ..), NonJoint), _) => sp.entire(), _ => continue, }; let sp = sp.shrink_to_hi(); - let comma = TokenStream { - kind: TokenStreamKind::Tree(TokenTree::Token(sp, token::Comma)), - }; + let comma = (TokenTree::Token(sp, token::Comma), NonJoint); suggestion = Some((pos, comma, sp)); } } if let Some((pos, comma, sp)) = suggestion { - let mut new_slice = vec![]; - let parts = slice.split_at(pos + 1); - new_slice.extend_from_slice(parts.0); - new_slice.push(comma); - new_slice.extend_from_slice(parts.1); - let slice = RcVec::new(new_slice); - return Some((TokenStream { kind: TokenStreamKind::Stream(slice) }, sp)); + let mut new_stream = vec![]; + let parts = stream.split_at(pos + 1); + new_stream.extend_from_slice(parts.0); + new_stream.push(comma); + new_stream.extend_from_slice(parts.1); + return Some((TokenStream::new(new_stream), sp)); } } None } } -#[derive(Clone, Debug)] -enum TokenStreamKind { - Empty, - Tree(TokenTree), - JointTree(TokenTree), - Stream(RcVec), +impl From for TokenStream { + fn from(tree: TokenTree) -> TokenStream { + TokenStream::new(vec![(tree, NonJoint)]) + } } -impl From for TokenStream { - fn from(tt: TokenTree) -> TokenStream { - TokenStream { kind: TokenStreamKind::Tree(tt) } +impl From for TreeAndJoint { + fn from(tree: TokenTree) -> TreeAndJoint { + (tree, NonJoint) } } @@ -244,61 +218,7 @@ impl From for TokenStream { impl> iter::FromIterator for TokenStream { fn from_iter>(iter: I) -> Self { - TokenStream::concat(iter.into_iter().map(Into::into).collect::>()) - } -} - -impl Extend for TokenStream { - fn extend>(&mut self, iter: I) { - let iter = iter.into_iter(); - let kind = mem::replace(&mut self.kind, TokenStreamKind::Empty); - - // Vector of token streams originally in self. - let tts: Vec = match kind { - TokenStreamKind::Empty => { - let mut vec = Vec::new(); - vec.reserve(iter.size_hint().0); - vec - } - TokenStreamKind::Tree(_) | TokenStreamKind::JointTree(_) => { - let mut vec = Vec::new(); - vec.reserve(1 + iter.size_hint().0); - vec.push(TokenStream { kind }); - vec - } - TokenStreamKind::Stream(rc_vec) => match RcVec::try_unwrap(rc_vec) { - Ok(mut vec) => { - // Extend in place using the existing capacity if possible. - // This is the fast path for libraries like `quote` that - // build a token stream. - vec.reserve(iter.size_hint().0); - vec - } - Err(rc_vec) => { - // Self is shared so we need to copy and extend that. - let mut vec = Vec::new(); - vec.reserve(rc_vec.len() + iter.size_hint().0); - vec.extend_from_slice(&rc_vec); - vec - } - } - }; - - // Perform the extend, joining tokens as needed along the way. - let mut builder = TokenStreamBuilder(tts); - for stream in iter { - builder.push(stream); - } - - // Build the resulting token stream. If it contains more than one token, - // preserve capacity in the vector in anticipation of the caller - // performing additional calls to extend. - let mut tts = builder.0; - *self = match tts.len() { - 0 => TokenStream::empty(), - 1 => tts.pop().unwrap(), - _ => TokenStream::concat_rc_vec(RcVec::new_preserving_capacity(tts)), - }; + TokenStream::from_streams(iter.into_iter().map(Into::into).collect::>()) } } @@ -312,7 +232,7 @@ impl PartialEq for TokenStream { impl TokenStream { pub fn len(&self) -> usize { - if let TokenStreamKind::Stream(ref slice) = self.kind { + if let Some(ref slice) = self.0 { slice.len() } else { 0 @@ -320,26 +240,44 @@ impl TokenStream { } pub fn empty() -> TokenStream { - TokenStream { kind: TokenStreamKind::Empty } + TokenStream(None) } pub fn is_empty(&self) -> bool { - match self.kind { - TokenStreamKind::Empty => true, - _ => false, + match self.0 { + None => true, + Some(ref stream) => stream.is_empty(), } } - pub fn concat(mut streams: Vec) -> TokenStream { + fn from_streams(mut streams: Vec) -> TokenStream { match streams.len() { 0 => TokenStream::empty(), 1 => streams.pop().unwrap(), - _ => TokenStream::concat_rc_vec(RcVec::new(streams)), + _ => { + let mut vec = vec![]; + for stream in streams { + match stream.0 { + None => {}, + Some(stream2) => vec.extend(stream2.iter().cloned()), + } + } + TokenStream::new(vec) + } + } + } + + pub fn new(streams: Vec) -> TokenStream { + match streams.len() { + 0 => TokenStream(None), + _ => TokenStream(Some(Lrc::new(streams))), } } - fn concat_rc_vec(streams: RcVec) -> TokenStream { - TokenStream { kind: TokenStreamKind::Stream(streams) } + pub fn append_to_tree_and_joint_vec(self, vec: &mut Vec) { + if let Some(stream) = self.0 { + vec.extend(stream.iter().cloned()); + } } pub fn trees(&self) -> Cursor { @@ -385,7 +323,9 @@ impl TokenStream { | TokenTree::Token(_, Token::Semi) // The pretty printer collapses whitespace arbitrarily and can // introduce whitespace from `NoDelim`. - | TokenTree::Token(_, Token::Whitespace) => false, + | TokenTree::Token(_, Token::Whitespace) + // The pretty printer can turn `$crate` into `::crate_name` + | TokenTree::Token(_, Token::ModSep) => false, _ => true } } @@ -400,58 +340,43 @@ impl TokenStream { t1.next().is_none() && t2.next().is_none() } - /// Precondition: `self` consists of a single token tree. - /// Returns true if the token tree is a joint operation w.r.t. `proc_macro::TokenNode`. - pub fn as_tree(self) -> (TokenTree, bool /* joint? */) { - match self.kind { - TokenStreamKind::Tree(tree) => (tree, false), - TokenStreamKind::JointTree(tree) => (tree, true), - _ => unreachable!(), - } - } - pub fn map_enumerated TokenTree>(self, mut f: F) -> TokenStream { - let mut trees = self.into_trees(); - let mut result = Vec::new(); - let mut i = 0; - while let Some(stream) = trees.next_as_stream() { - result.push(match stream.kind { - TokenStreamKind::Tree(tree) => f(i, tree).into(), - TokenStreamKind::JointTree(tree) => f(i, tree).joint(), - _ => unreachable!() - }); - i += 1; - } - TokenStream::concat(result) + TokenStream(self.0.map(|stream| { + Lrc::new( + stream + .iter() + .enumerate() + .map(|(i, (tree, is_joint))| (f(i, tree.clone()), *is_joint)) + .collect()) + })) } pub fn map TokenTree>(self, mut f: F) -> TokenStream { - let mut trees = self.into_trees(); - let mut result = Vec::new(); - while let Some(stream) = trees.next_as_stream() { - result.push(match stream.kind { - TokenStreamKind::Tree(tree) => f(tree).into(), - TokenStreamKind::JointTree(tree) => f(tree).joint(), - _ => unreachable!() - }); - } - TokenStream::concat(result) - } - - fn first_tree_and_joint(&self) -> Option<(TokenTree, bool)> { - match self.kind { - TokenStreamKind::Empty => None, - TokenStreamKind::Tree(ref tree) => Some((tree.clone(), false)), - TokenStreamKind::JointTree(ref tree) => Some((tree.clone(), true)), - TokenStreamKind::Stream(ref stream) => stream.first().unwrap().first_tree_and_joint(), - } + TokenStream(self.0.map(|stream| { + Lrc::new( + stream + .iter() + .map(|(tree, is_joint)| (f(tree.clone()), *is_joint)) + .collect()) + })) + } + + fn first_tree_and_joint(&self) -> Option { + self.0.as_ref().map(|stream| { + stream.first().unwrap().clone() + }) } fn last_tree_if_joint(&self) -> Option { - match self.kind { - TokenStreamKind::Empty | TokenStreamKind::Tree(..) => None, - TokenStreamKind::JointTree(ref tree) => Some(tree.clone()), - TokenStreamKind::Stream(ref stream) => stream.last().unwrap().last_tree_if_joint(), + match self.0 { + None => None, + Some(ref stream) => { + if let (tree, Joint) = stream.last().unwrap() { + Some(tree.clone()) + } else { + None + } + } } } } @@ -474,11 +399,7 @@ impl TokenStreamBuilder { self.push_all_but_last_tree(&last_stream); let glued_span = last_span.to(span); let glued_tt = TokenTree::Token(glued_span, glued_tok); - let glued_tokenstream = if is_joint { - glued_tt.joint() - } else { - glued_tt.into() - }; + let glued_tokenstream = TokenStream::new(vec![(glued_tt, is_joint)]); self.0.push(glued_tokenstream); self.push_all_but_first_tree(&stream); return @@ -488,218 +409,79 @@ impl TokenStreamBuilder { self.0.push(stream); } - pub fn add>(mut self, stream: T) -> Self { - self.push(stream); - self - } - pub fn build(self) -> TokenStream { - TokenStream::concat(self.0) + TokenStream::from_streams(self.0) } fn push_all_but_last_tree(&mut self, stream: &TokenStream) { - if let TokenStreamKind::Stream(ref streams) = stream.kind { + if let Some(ref streams) = stream.0 { let len = streams.len(); match len { 1 => {} - 2 => self.0.push(streams[0].clone().into()), - _ => self.0.push(TokenStream::concat_rc_vec(streams.sub_slice(0 .. len - 1))), + _ => self.0.push(TokenStream(Some(Lrc::new(streams[0 .. len - 1].to_vec())))), } - self.push_all_but_last_tree(&streams[len - 1]) } } fn push_all_but_first_tree(&mut self, stream: &TokenStream) { - if let TokenStreamKind::Stream(ref streams) = stream.kind { + if let Some(ref streams) = stream.0 { let len = streams.len(); match len { 1 => {} - 2 => self.0.push(streams[1].clone().into()), - _ => self.0.push(TokenStream::concat_rc_vec(streams.sub_slice(1 .. len))), + _ => self.0.push(TokenStream(Some(Lrc::new(streams[1 .. len].to_vec())))), } - self.push_all_but_first_tree(&streams[0]) } } } #[derive(Clone)] -pub struct Cursor(CursorKind); - -#[derive(Clone)] -enum CursorKind { - Empty, - Tree(TokenTree, bool /* consumed? */), - JointTree(TokenTree, bool /* consumed? */), - Stream(StreamCursor), -} - -#[derive(Clone)] -struct StreamCursor { - stream: RcVec, +pub struct Cursor { + pub stream: TokenStream, index: usize, - stack: Vec<(RcVec, usize)>, -} - -impl StreamCursor { - fn new(stream: RcVec) -> Self { - StreamCursor { stream: stream, index: 0, stack: Vec::new() } - } - - fn next_as_stream(&mut self) -> Option { - loop { - if self.index < self.stream.len() { - self.index += 1; - let next = self.stream[self.index - 1].clone(); - match next.kind { - TokenStreamKind::Tree(..) | TokenStreamKind::JointTree(..) => return Some(next), - TokenStreamKind::Stream(stream) => self.insert(stream), - TokenStreamKind::Empty => {} - } - } else if let Some((stream, index)) = self.stack.pop() { - self.stream = stream; - self.index = index; - } else { - return None; - } - } - } - - fn insert(&mut self, stream: RcVec) { - self.stack.push((mem::replace(&mut self.stream, stream), - mem::replace(&mut self.index, 0))); - } } impl Iterator for Cursor { type Item = TokenTree; fn next(&mut self) -> Option { - self.next_as_stream().map(|stream| match stream.kind { - TokenStreamKind::Tree(tree) | TokenStreamKind::JointTree(tree) => tree, - _ => unreachable!() - }) + self.next_with_joint().map(|(tree, _)| tree) } } impl Cursor { fn new(stream: TokenStream) -> Self { - Cursor(match stream.kind { - TokenStreamKind::Empty => CursorKind::Empty, - TokenStreamKind::Tree(tree) => CursorKind::Tree(tree, false), - TokenStreamKind::JointTree(tree) => CursorKind::JointTree(tree, false), - TokenStreamKind::Stream(stream) => CursorKind::Stream(StreamCursor::new(stream)), - }) - } - - pub fn next_as_stream(&mut self) -> Option { - let (stream, consumed) = match self.0 { - CursorKind::Tree(ref tree, ref mut consumed @ false) => - (tree.clone().into(), consumed), - CursorKind::JointTree(ref tree, ref mut consumed @ false) => - (tree.clone().joint(), consumed), - CursorKind::Stream(ref mut cursor) => return cursor.next_as_stream(), - _ => return None, - }; - - *consumed = true; - Some(stream) - } - - pub fn insert(&mut self, stream: TokenStream) { - match self.0 { - _ if stream.is_empty() => return, - CursorKind::Empty => *self = stream.trees(), - CursorKind::Tree(_, consumed) | CursorKind::JointTree(_, consumed) => { - *self = TokenStream::concat(vec![self.original_stream(), stream]).trees(); - if consumed { - self.next(); + Cursor { stream, index: 0 } + } + + pub fn next_with_joint(&mut self) -> Option { + match self.stream.0 { + None => None, + Some(ref stream) => { + if self.index < stream.len() { + self.index += 1; + Some(stream[self.index - 1].clone()) + } else { + None } } - CursorKind::Stream(ref mut cursor) => { - cursor.insert(ThinTokenStream::from(stream).0.unwrap()); - } } } - pub fn original_stream(&self) -> TokenStream { - match self.0 { - CursorKind::Empty => TokenStream::empty(), - CursorKind::Tree(ref tree, _) => tree.clone().into(), - CursorKind::JointTree(ref tree, _) => tree.clone().joint(), - CursorKind::Stream(ref cursor) => TokenStream::concat_rc_vec({ - cursor.stack.get(0).cloned().map(|(stream, _)| stream) - .unwrap_or_else(|| cursor.stream.clone()) - }), + pub fn append(&mut self, new_stream: TokenStream) { + if new_stream.is_empty() { + return; } + let index = self.index; + let stream = mem::replace(&mut self.stream, TokenStream(None)); + *self = TokenStream::from_streams(vec![stream, new_stream]).into_trees(); + self.index = index; } pub fn look_ahead(&self, n: usize) -> Option { - fn look_ahead(streams: &[TokenStream], mut n: usize) -> Result { - for stream in streams { - n = match stream.kind { - TokenStreamKind::Tree(ref tree) | TokenStreamKind::JointTree(ref tree) - if n == 0 => return Ok(tree.clone()), - TokenStreamKind::Tree(..) | TokenStreamKind::JointTree(..) => n - 1, - TokenStreamKind::Stream(ref stream) => match look_ahead(stream, n) { - Ok(tree) => return Ok(tree), - Err(n) => n, - }, - _ => n, - }; - } - Err(n) + match self.stream.0 { + None => None, + Some(ref stream) => stream[self.index ..].get(n).map(|(tree, _)| tree.clone()), } - - match self.0 { - CursorKind::Empty | - CursorKind::Tree(_, true) | - CursorKind::JointTree(_, true) => Err(n), - CursorKind::Tree(ref tree, false) | - CursorKind::JointTree(ref tree, false) => look_ahead(&[tree.clone().into()], n), - CursorKind::Stream(ref cursor) => { - look_ahead(&cursor.stream[cursor.index ..], n).or_else(|mut n| { - for &(ref stream, index) in cursor.stack.iter().rev() { - n = match look_ahead(&stream[index..], n) { - Ok(tree) => return Ok(tree), - Err(n) => n, - } - } - - Err(n) - }) - } - }.ok() - } -} - -/// The `TokenStream` type is large enough to represent a single `TokenTree` without allocation. -/// `ThinTokenStream` is smaller, but needs to allocate to represent a single `TokenTree`. -/// We must use `ThinTokenStream` in `TokenTree::Delimited` to avoid infinite size due to recursion. -#[derive(Debug, Clone)] -pub struct ThinTokenStream(Option>); - -impl From for ThinTokenStream { - fn from(stream: TokenStream) -> ThinTokenStream { - ThinTokenStream(match stream.kind { - TokenStreamKind::Empty => None, - TokenStreamKind::Tree(tree) => Some(RcVec::new(vec![tree.into()])), - TokenStreamKind::JointTree(tree) => Some(RcVec::new(vec![tree.joint()])), - TokenStreamKind::Stream(stream) => Some(stream), - }) - } -} - -impl From for TokenStream { - fn from(stream: ThinTokenStream) -> TokenStream { - stream.0.map(TokenStream::concat_rc_vec).unwrap_or_else(TokenStream::empty) - } -} - -impl Eq for ThinTokenStream {} - -impl PartialEq for ThinTokenStream { - fn eq(&self, other: &ThinTokenStream) -> bool { - TokenStream::from(self.clone()) == TokenStream::from(other.clone()) } } @@ -721,18 +503,6 @@ impl Decodable for TokenStream { } } -impl Encodable for ThinTokenStream { - fn encode(&self, encoder: &mut E) -> Result<(), E::Error> { - TokenStream::from(self.clone()).encode(encoder) - } -} - -impl Decodable for ThinTokenStream { - fn decode(decoder: &mut D) -> Result { - TokenStream::decode(decoder).map(Into::into) - } -} - #[derive(Debug, Copy, Clone, PartialEq, RustcEncodable, RustcDecodable)] pub struct DelimSpan { pub open: Span, @@ -790,7 +560,7 @@ mod tests { let test_res = string_to_ts("foo::bar::baz"); let test_fst = string_to_ts("foo::bar"); let test_snd = string_to_ts("::baz"); - let eq_res = TokenStream::concat(vec![test_fst, test_snd]); + let eq_res = TokenStream::from_streams(vec![test_fst, test_snd]); assert_eq!(test_res.trees().count(), 5); assert_eq!(eq_res.trees().count(), 5); assert_eq!(test_res.eq_unspanned(&eq_res), true); @@ -875,107 +645,4 @@ mod tests { assert!(stream.eq_unspanned(&string_to_ts("..."))); assert_eq!(stream.trees().count(), 1); } - - #[test] - fn test_extend_empty() { - with_globals(|| { - // Append a token onto an empty token stream. - let mut stream = TokenStream::empty(); - stream.extend(vec![string_to_ts("t")]); - - let expected = string_to_ts("t"); - assert!(stream.eq_unspanned(&expected)); - }); - } - - #[test] - fn test_extend_nothing() { - with_globals(|| { - // Append nothing onto a token stream containing one token. - let mut stream = string_to_ts("t"); - stream.extend(vec![]); - - let expected = string_to_ts("t"); - assert!(stream.eq_unspanned(&expected)); - }); - } - - #[test] - fn test_extend_single() { - with_globals(|| { - // Append a token onto token stream containing a single token. - let mut stream = string_to_ts("t1"); - stream.extend(vec![string_to_ts("t2")]); - - let expected = string_to_ts("t1 t2"); - assert!(stream.eq_unspanned(&expected)); - }); - } - - #[test] - fn test_extend_in_place() { - with_globals(|| { - // Append a token onto token stream containing a reference counted - // vec of tokens. The token stream has a reference count of 1 so - // this can happen in place. - let mut stream = string_to_ts("t1 t2"); - stream.extend(vec![string_to_ts("t3")]); - - let expected = string_to_ts("t1 t2 t3"); - assert!(stream.eq_unspanned(&expected)); - }); - } - - #[test] - fn test_extend_copy() { - with_globals(|| { - // Append a token onto token stream containing a reference counted - // vec of tokens. The token stream is shared so the extend takes - // place on a copy. - let mut stream = string_to_ts("t1 t2"); - let _incref = stream.clone(); - stream.extend(vec![string_to_ts("t3")]); - - let expected = string_to_ts("t1 t2 t3"); - assert!(stream.eq_unspanned(&expected)); - }); - } - - #[test] - fn test_extend_no_join() { - with_globals(|| { - let first = TokenTree::Token(DUMMY_SP, Token::Dot); - let second = TokenTree::Token(DUMMY_SP, Token::Dot); - - // Append a dot onto a token stream containing a dot, but do not - // join them. - let mut stream = TokenStream::from(first); - stream.extend(vec![TokenStream::from(second)]); - - let expected = string_to_ts(". ."); - assert!(stream.eq_unspanned(&expected)); - - let unexpected = string_to_ts(".."); - assert!(!stream.eq_unspanned(&unexpected)); - }); - } - - #[test] - fn test_extend_join() { - with_globals(|| { - let first = TokenTree::Token(DUMMY_SP, Token::Dot).joint(); - let second = TokenTree::Token(DUMMY_SP, Token::Dot); - - // Append a dot onto a token stream containing a dot, forming a - // dotdot. - let mut stream = first; - stream.extend(vec![TokenStream::from(second)]); - - let expected = string_to_ts(".."); - assert!(stream.eq_unspanned(&expected)); - - let unexpected = string_to_ts(". ."); - assert!(!stream.eq_unspanned(&unexpected)); - }); - } } diff --git a/src/libsyntax/util/lev_distance.rs b/src/libsyntax/util/lev_distance.rs index feee2422cb6..d6d2251b5bc 100644 --- a/src/libsyntax/util/lev_distance.rs +++ b/src/libsyntax/util/lev_distance.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cmp; use symbol::Symbol; @@ -20,7 +10,7 @@ pub fn lev_distance(a: &str, b: &str) -> usize { return a.chars().count(); } - let mut dcol: Vec<_> = (0..b.len() + 1).collect(); + let mut dcol: Vec<_> = (0..=b.len()).collect(); let mut t_last = 0; for (i, sc) in a.chars().enumerate() { @@ -38,7 +28,8 @@ pub fn lev_distance(a: &str, b: &str) -> usize { current = next; t_last = j; } - } dcol[t_last + 1] + } + dcol[t_last + 1] } /// Find the best match for a given word in the given iterator diff --git a/src/libsyntax/util/move_map.rs b/src/libsyntax/util/move_map.rs index 51cae1b5d84..a0f9d39ce89 100644 --- a/src/libsyntax/util/move_map.rs +++ b/src/libsyntax/util/move_map.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ptr; use smallvec::{Array, SmallVec}; diff --git a/src/libsyntax/util/node_count.rs b/src/libsyntax/util/node_count.rs index ebb3081c1fd..7dd213ae38b 100644 --- a/src/libsyntax/util/node_count.rs +++ b/src/libsyntax/util/node_count.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Simply gives a rought count of the number of nodes in an AST. use visit::*; diff --git a/src/libsyntax/util/parser.rs b/src/libsyntax/util/parser.rs index 6866806cd7c..89d4e53b8d1 100644 --- a/src/libsyntax/util/parser.rs +++ b/src/libsyntax/util/parser.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. use parse::token::{Token, BinOpToken}; use symbol::keywords; use ast::{self, BinOpKind}; @@ -276,6 +267,7 @@ pub enum ExprPrecedence { TryBlock, Struct, Async, + Err, } impl ExprPrecedence { @@ -334,14 +326,15 @@ impl ExprPrecedence { ExprPrecedence::Block | ExprPrecedence::TryBlock | ExprPrecedence::Async | - ExprPrecedence::Struct => PREC_PAREN, + ExprPrecedence::Struct | + ExprPrecedence::Err => PREC_PAREN, } } } -/// Expressions that syntactically contain an "exterior" struct literal i.e. not surrounded by any -/// parens or other delimiters, e.g. `X { y: 1 }`, `X { y: 1 }.method()`, `foo == X { y: 1 }` and +/// Expressions that syntactically contain an "exterior" struct literal i.e., not surrounded by any +/// parens or other delimiters, e.g., `X { y: 1 }`, `X { y: 1 }.method()`, `foo == X { y: 1 }` and /// `X { y: 1 } == foo` all do, but `(X { y: 1 }) == foo` does not. pub fn contains_exterior_struct_lit(value: &ast::Expr) -> bool { match value.node { diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index 98e9272e6d8..d0b3cd865ce 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use ast::{self, Ident}; use source_map::FilePathMapping; use parse::{ParseSess, PResult, source_file_to_stream}; @@ -35,7 +25,7 @@ fn with_error_checking_parse<'a, T, F>(s: String, ps: &'a ParseSess, f: F) -> T { let mut p = string_to_parser(&ps, s); let x = panictry!(f(&mut p)); - p.abort_if_errors(); + p.sess.span_diagnostic.abort_if_errors(); x } diff --git a/src/libsyntax/util/rc_slice.rs b/src/libsyntax/util/rc_slice.rs deleted file mode 100644 index 520b7a48e30..00000000000 --- a/src/libsyntax/util/rc_slice.rs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::fmt; -use std::ops::{Deref, Range}; -use rustc_data_structures::sync::Lrc; - -use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult, - HashStable}; - -#[derive(Clone)] -pub struct RcSlice { - data: Lrc>, - offset: u32, - len: u32, -} - -impl RcSlice { - pub fn new(vec: Vec) -> Self { - RcSlice { - offset: 0, - len: vec.len() as u32, - data: Lrc::new(vec.into_boxed_slice()), - } - } - - pub fn sub_slice(&self, range: Range) -> Self { - RcSlice { - data: self.data.clone(), - offset: self.offset + range.start as u32, - len: (range.end - range.start) as u32, - } - } -} - -impl Deref for RcSlice { - type Target = [T]; - fn deref(&self) -> &[T] { - &self.data[self.offset as usize .. (self.offset + self.len) as usize] - } -} - -impl fmt::Debug for RcSlice { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Debug::fmt(self.deref(), f) - } -} - -impl HashStable for RcSlice - where T: HashStable -{ - fn hash_stable(&self, - hcx: &mut CTX, - hasher: &mut StableHasher) { - (**self).hash_stable(hcx, hasher); - } -} diff --git a/src/libsyntax/util/rc_vec.rs b/src/libsyntax/util/rc_vec.rs deleted file mode 100644 index 99fbce1ad91..00000000000 --- a/src/libsyntax/util/rc_vec.rs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::fmt; -use std::ops::{Deref, Range}; - -use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult}; -use rustc_data_structures::sync::Lrc; - -#[derive(Clone)] -pub struct RcVec { - data: Lrc>, - offset: u32, - len: u32, -} - -impl RcVec { - pub fn new(mut vec: Vec) -> Self { - // By default, constructing RcVec from Vec gives it just enough capacity - // to hold the initial elements. Callers that anticipate needing to - // extend the vector may prefer RcVec::new_preserving_capacity. - vec.shrink_to_fit(); - Self::new_preserving_capacity(vec) - } - - pub fn new_preserving_capacity(vec: Vec) -> Self { - RcVec { - offset: 0, - len: vec.len() as u32, - data: Lrc::new(vec), - } - } - - pub fn sub_slice(&self, range: Range) -> Self { - RcVec { - data: self.data.clone(), - offset: self.offset + range.start as u32, - len: (range.end - range.start) as u32, - } - } - - /// If this RcVec has exactly one strong reference, returns ownership of the - /// underlying vector. Otherwise returns self unmodified. - pub fn try_unwrap(self) -> Result, Self> { - match Lrc::try_unwrap(self.data) { - // If no other RcVec shares ownership of this data. - Ok(mut vec) => { - // Drop any elements after our view of the data. - vec.truncate(self.offset as usize + self.len as usize); - // Drop any elements before our view of the data. Do this after - // the `truncate` so that elements past the end of our view do - // not need to be copied around. - vec.drain(..self.offset as usize); - Ok(vec) - } - - // If the data is shared. - Err(data) => Err(RcVec { data, ..self }), - } - } -} - -impl Deref for RcVec { - type Target = [T]; - fn deref(&self) -> &[T] { - &self.data[self.offset as usize..(self.offset + self.len) as usize] - } -} - -impl fmt::Debug for RcVec { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Debug::fmt(self.deref(), f) - } -} - -impl HashStable for RcVec -where - T: HashStable, -{ - fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) { - (**self).hash_stable(hcx, hasher); - } -} diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 77311bf53fd..8cbd47ca70f 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! AST walker. Each overridden visit method has full control over what //! happens with its node, it can do its own traversal of the node's children, //! call `visit::walk_*` to apply the default traversal algorithm, or prevent @@ -43,7 +33,7 @@ pub enum FnKind<'a> { /// Each method of the Visitor trait is a hook to be potentially /// overridden. Each method's default implementation recursively visits /// the substructure of the input via the corresponding `walk` method; -/// e.g. the `visit_mod` method by default calls `visit::walk_mod`. +/// e.g., the `visit_mod` method by default calls `visit::walk_mod`. /// /// If you want to ensure that your code handles every variant /// explicitly, you need to override each method. (And you also need @@ -110,7 +100,7 @@ pub trait Visitor<'ast>: Sized { } fn visit_mac(&mut self, _mac: &'ast Mac) { panic!("visit_mac disabled by default"); - // NB: see note about macros above. + // N.B., see note about macros above. // if you really want a visitor that // works on macros, use this // definition in your trait impl: @@ -812,6 +802,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) { ExprKind::TryBlock(ref body) => { visitor.visit_block(body) } + ExprKind::Err => {} } visitor.visit_expr_post(expression) @@ -841,7 +832,7 @@ pub fn walk_attribute<'a, V: Visitor<'a>>(visitor: &mut V, attr: &'a Attribute) pub fn walk_tt<'a, V: Visitor<'a>>(visitor: &mut V, tt: TokenTree) { match tt { TokenTree::Token(_, tok) => visitor.visit_token(tok), - TokenTree::Delimited(_, delimed) => visitor.visit_tts(delimed.stream()), + TokenTree::Delimited(_, _, tts) => visitor.visit_tts(tts), } } diff --git a/src/libsyntax_ext/Cargo.toml b/src/libsyntax_ext/Cargo.toml index 5a691bde3ec..7ad08f75e8b 100644 --- a/src/libsyntax_ext/Cargo.toml +++ b/src/libsyntax_ext/Cargo.toml @@ -10,11 +10,10 @@ crate-type = ["dylib"] [dependencies] fmt_macros = { path = "../libfmt_macros" } -proc_macro = { path = "../libproc_macro" } rustc_errors = { path = "../librustc_errors" } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_target = { path = "../librustc_target" } -smallvec = { version = "0.6.5", features = ["union"] } +smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } log = "0.4" diff --git a/src/libsyntax_ext/asm.rs b/src/libsyntax_ext/asm.rs index 026ddccd7be..41ee6e91b3d 100644 --- a/src/libsyntax_ext/asm.rs +++ b/src/libsyntax_ext/asm.rs @@ -1,19 +1,10 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Inline assembly support. // use self::State::*; use rustc_data_structures::thin_vec::ThinVec; +use errors::DiagnosticBuilder; use syntax::ast; use syntax::ext::base; use syntax::ext::base::*; @@ -47,7 +38,7 @@ impl State { } } -const OPTIONS: &'static [&'static str] = &["volatile", "alignstack", "intel"]; +const OPTIONS: &[&str] = &["volatile", "alignstack", "intel"]; pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, @@ -59,9 +50,36 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, sp, feature_gate::GateIssue::Language, feature_gate::EXPLAIN_ASM); - return DummyResult::expr(sp); } + let mut inline_asm = match parse_inline_asm(cx, sp, tts) { + Ok(Some(inline_asm)) => inline_asm, + Ok(None) => return DummyResult::expr(sp), + Err(mut err) => { + err.emit(); + return DummyResult::expr(sp); + } + }; + + // If there are no outputs, the inline assembly is executed just for its side effects, + // so ensure that it is volatile + if inline_asm.outputs.is_empty() { + inline_asm.volatile = true; + } + + MacEager::expr(P(ast::Expr { + id: ast::DUMMY_NODE_ID, + node: ast::ExprKind::InlineAsm(P(inline_asm)), + span: sp, + attrs: ThinVec::new(), + })) +} + +fn parse_inline_asm<'a>( + cx: &mut ExtCtxt<'a>, + sp: Span, + tts: &[tokenstream::TokenTree], +) -> Result, DiagnosticBuilder<'a>> { // Split the tts before the first colon, to avoid `asm!("x": y)` being // parsed as `asm!(z)` with `z = "x": y` which is type ascription. let first_colon = tts.iter() @@ -91,22 +109,33 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, if asm_str_style.is_some() { // If we already have a string with instructions, // ending up in Asm state again is an error. - span_err!(cx, sp, E0660, "malformed inline assembly"); - return DummyResult::expr(sp); + return Err(struct_span_err!( + cx.parse_sess.span_diagnostic, + sp, + E0660, + "malformed inline assembly" + )); } // Nested parser, stop before the first colon (see above). let mut p2 = cx.new_parser_from_tts(&tts[..first_colon]); - let (s, style) = match expr_to_string(cx, - panictry!(p2.parse_expr()), - "inline assembly must be a string literal") { - Some((s, st)) => (s, st), - // let compilation continue - None => return DummyResult::expr(sp), - }; + + if p2.token == token::Eof { + let mut err = + cx.struct_span_err(sp, "macro requires a string literal as an argument"); + err.span_label(sp, "string literal required"); + return Err(err); + } + + let expr = p2.parse_expr()?; + let (s, style) = + match expr_to_string(cx, expr, "inline assembly must be a string literal") { + Some((s, st)) => (s, st), + None => return Ok(None), + }; // This is most likely malformed. if p2.token != token::Eof { - let mut extra_tts = panictry!(p2.parse_all_token_trees()); + let mut extra_tts = p2.parse_all_token_trees()?; extra_tts.extend(tts[first_colon..].iter().cloned()); p = parse::stream_to_parser(cx.parse_sess, extra_tts.into_iter().collect()); } @@ -116,18 +145,17 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, } Outputs => { while p.token != token::Eof && p.token != token::Colon && p.token != token::ModSep { - if !outputs.is_empty() { p.eat(&token::Comma); } - let (constraint, _str_style) = panictry!(p.parse_str()); + let (constraint, _) = p.parse_str()?; let span = p.prev_span; - panictry!(p.expect(&token::OpenDelim(token::Paren))); - let out = panictry!(p.parse_expr()); - panictry!(p.expect(&token::CloseDelim(token::Paren))); + p.expect(&token::OpenDelim(token::Paren))?; + let expr = p.parse_expr()?; + p.expect(&token::CloseDelim(token::Paren))?; // Expands a read+write operand into two operands. // @@ -154,7 +182,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, let is_indirect = constraint_str.contains("*"); outputs.push(ast::InlineAsmOutput { constraint: output.unwrap_or(constraint), - expr: out, + expr, is_rw, is_indirect, }); @@ -162,12 +190,11 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, } Inputs => { while p.token != token::Eof && p.token != token::Colon && p.token != token::ModSep { - if !inputs.is_empty() { p.eat(&token::Comma); } - let (constraint, _str_style) = panictry!(p.parse_str()); + let (constraint, _) = p.parse_str()?; if constraint.as_str().starts_with("=") { span_err!(cx, p.prev_span, E0662, @@ -177,21 +204,20 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, "input operand constraint contains '+'"); } - panictry!(p.expect(&token::OpenDelim(token::Paren))); - let input = panictry!(p.parse_expr()); - panictry!(p.expect(&token::CloseDelim(token::Paren))); + p.expect(&token::OpenDelim(token::Paren))?; + let input = p.parse_expr()?; + p.expect(&token::CloseDelim(token::Paren))?; inputs.push((constraint, input)); } } Clobbers => { while p.token != token::Eof && p.token != token::Colon && p.token != token::ModSep { - if !clobs.is_empty() { p.eat(&token::Comma); } - let (s, _str_style) = panictry!(p.parse_str()); + let (s, _) = p.parse_str()?; if OPTIONS.iter().any(|&opt| s == opt) { cx.span_warn(p.prev_span, "expected a clobber, found an option"); @@ -204,7 +230,7 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, } } Options => { - let (option, _str_style) = panictry!(p.parse_str()); + let (option, _) = p.parse_str()?; if option == "volatile" { // Indicates that the inline assembly has side effects @@ -245,26 +271,15 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, } } - // If there are no outputs, the inline assembly is executed just for its side effects, - // so ensure that it is volatile - if outputs.is_empty() { - volatile = true; - } - - MacEager::expr(P(ast::Expr { - id: ast::DUMMY_NODE_ID, - node: ast::ExprKind::InlineAsm(P(ast::InlineAsm { - asm, - asm_str_style: asm_str_style.unwrap(), - outputs, - inputs, - clobbers: clobs, - volatile, - alignstack, - dialect, - ctxt: cx.backtrace(), - })), - span: sp, - attrs: ThinVec::new(), + Ok(Some(ast::InlineAsm { + asm, + asm_str_style: asm_str_style.unwrap(), + outputs, + inputs, + clobbers: clobs, + volatile, + alignstack, + dialect, + ctxt: cx.backtrace(), })) } diff --git a/src/libsyntax_ext/assert.rs b/src/libsyntax_ext/assert.rs index e3bd2ca0131..b27f495322a 100644 --- a/src/libsyntax_ext/assert.rs +++ b/src/libsyntax_ext/assert.rs @@ -1,19 +1,11 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use syntax::ast::*; +use errors::DiagnosticBuilder; +use syntax::ast::{self, *}; use syntax::source_map::Spanned; use syntax::ext::base::*; use syntax::ext::build::AstBuilder; use syntax::parse::token; use syntax::print::pprust; +use syntax::ptr::P; use syntax::symbol::Symbol; use syntax::tokenstream::{TokenStream, TokenTree}; use syntax_pos::{Span, DUMMY_SP}; @@ -23,25 +15,18 @@ pub fn expand_assert<'cx>( sp: Span, tts: &[TokenTree], ) -> Box { - let mut parser = cx.new_parser_from_tts(tts); - let cond_expr = panictry!(parser.parse_expr()); - let custom_msg_args = if parser.eat(&token::Comma) { - let ts = parser.parse_tokens(); - if !ts.is_empty() { - Some(ts) - } else { - None + let Assert { cond_expr, custom_message } = match parse_assert(cx, sp, tts) { + Ok(assert) => assert, + Err(mut err) => { + err.emit(); + return DummyResult::expr(sp); } - } else { - None }; let sp = sp.apply_mark(cx.current_expansion.mark); let panic_call = Mac_ { path: Path::from_ident(Ident::new(Symbol::intern("panic"), sp)), - tts: if let Some(ts) = custom_msg_args { - ts.into() - } else { + tts: custom_message.unwrap_or_else(|| { TokenStream::from(TokenTree::Token( DUMMY_SP, token::Literal( @@ -51,8 +36,8 @@ pub fn expand_assert<'cx>( ))), None, ), - )).into() - }, + )) + }).into(), delim: MacDelimiter::Parenthesis, }; let if_expr = cx.expr_if( @@ -69,3 +54,36 @@ pub fn expand_assert<'cx>( ); MacEager::expr(if_expr) } + +struct Assert { + cond_expr: P, + custom_message: Option, +} + +fn parse_assert<'a>( + cx: &mut ExtCtxt<'a>, + sp: Span, + tts: &[TokenTree] +) -> Result> { + let mut parser = cx.new_parser_from_tts(tts); + + if parser.token == token::Eof { + let mut err = cx.struct_span_err(sp, "macro requires a boolean expression as an argument"); + err.span_label(sp, "boolean expression required"); + return Err(err); + } + + Ok(Assert { + cond_expr: parser.parse_expr()?, + custom_message: if parser.eat(&token::Comma) { + let ts = parser.parse_tokens(); + if !ts.is_empty() { + Some(ts) + } else { + None + } + } else { + None + }, + }) +} diff --git a/src/libsyntax_ext/cfg.rs b/src/libsyntax_ext/cfg.rs index 2384b6a796e..3b47b03cbe8 100644 --- a/src/libsyntax_ext/cfg.rs +++ b/src/libsyntax_ext/cfg.rs @@ -1,17 +1,9 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// The compiler code necessary to support the cfg! extension, which expands to /// a literal `true` or `false` based on whether the given cfg matches the /// current compilation environment. +use errors::DiagnosticBuilder; +use syntax::ast; use syntax::ext::base::*; use syntax::ext::base; use syntax::ext::build::AstBuilder; @@ -25,16 +17,39 @@ pub fn expand_cfg<'cx>(cx: &mut ExtCtxt, tts: &[tokenstream::TokenTree]) -> Box { let sp = sp.apply_mark(cx.current_expansion.mark); + + match parse_cfg(cx, sp, tts) { + Ok(cfg) => { + let matches_cfg = attr::cfg_matches(&cfg, cx.parse_sess, cx.ecfg.features); + MacEager::expr(cx.expr_bool(sp, matches_cfg)) + } + Err(mut err) => { + err.emit(); + DummyResult::expr(sp) + } + } +} + +fn parse_cfg<'a>( + cx: &mut ExtCtxt<'a>, + sp: Span, + tts: &[tokenstream::TokenTree], +) -> Result> { let mut p = cx.new_parser_from_tts(tts); - let cfg = panictry!(p.parse_meta_item()); + + if p.token == token::Eof { + let mut err = cx.struct_span_err(sp, "macro requires a cfg-pattern as an argument"); + err.span_label(sp, "cfg-pattern required"); + return Err(err); + } + + let cfg = p.parse_meta_item()?; let _ = p.eat(&token::Comma); if !p.eat(&token::Eof) { - cx.span_err(sp, "expected 1 cfg-pattern"); - return DummyResult::expr(sp); + return Err(cx.struct_span_err(sp, "expected 1 cfg-pattern")); } - let matches_cfg = attr::cfg_matches(&cfg, cx.parse_sess, cx.ecfg.features); - MacEager::expr(cx.expr_bool(sp, matches_cfg)) + Ok(cfg) } diff --git a/src/libsyntax_ext/compile_error.rs b/src/libsyntax_ext/compile_error.rs index ce7fb400bd5..8f7f5deb091 100644 --- a/src/libsyntax_ext/compile_error.rs +++ b/src/libsyntax_ext/compile_error.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The compiler code necessary to support the compile_error! extension. use syntax::ext::base::*; @@ -20,7 +10,7 @@ pub fn expand_compile_error<'cx>(cx: &'cx mut ExtCtxt, tts: &[tokenstream::TokenTree]) -> Box { let var = match get_single_str_from_tts(cx, sp, tts, "compile_error!") { - None => return DummyResult::expr(sp), + None => return DummyResult::any(sp), Some(v) => v, }; diff --git a/src/libsyntax_ext/concat.rs b/src/libsyntax_ext/concat.rs index dcdd2c590e0..f148f8e003d 100644 --- a/src/libsyntax_ext/concat.rs +++ b/src/libsyntax_ext/concat.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use syntax::ast; use syntax::ext::base; use syntax::ext::build::AstBuilder; @@ -28,10 +18,12 @@ pub fn expand_syntax_ext( }; let mut accumulator = String::new(); let mut missing_literal = vec![]; + let mut has_errors = false; for e in es { match e.node { ast::ExprKind::Lit(ref lit) => match lit.node { ast::LitKind::Str(ref s, _) + | ast::LitKind::Err(ref s) | ast::LitKind::Float(ref s, _) | ast::LitKind::FloatUnsuffixed(ref s) => { accumulator.push_str(&s.as_str()); @@ -51,6 +43,9 @@ pub fn expand_syntax_ext( cx.span_err(e.span, "cannot concatenate a byte string literal"); } }, + ast::ExprKind::Err => { + has_errors = true; + } _ => { missing_literal.push(e.span); } @@ -60,6 +55,9 @@ pub fn expand_syntax_ext( let mut err = cx.struct_span_err(missing_literal, "expected a literal"); err.note("only literals (like `\"foo\"`, `42` and `3.14`) can be passed to `concat!()`"); err.emit(); + return base::DummyResult::expr(sp); + } else if has_errors { + return base::DummyResult::expr(sp); } let sp = sp.apply_mark(cx.current_expansion.mark); base::MacEager::expr(cx.expr_str(sp, Symbol::intern(&accumulator))) diff --git a/src/libsyntax_ext/concat_idents.rs b/src/libsyntax_ext/concat_idents.rs index c8cc11e4354..de96de4bdc2 100644 --- a/src/libsyntax_ext/concat_idents.rs +++ b/src/libsyntax_ext/concat_idents.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use rustc_data_structures::thin_vec::ThinVec; use syntax::ast; @@ -30,12 +20,11 @@ pub fn expand_syntax_ext<'cx>(cx: &'cx mut ExtCtxt, sp, feature_gate::GateIssue::Language, feature_gate::EXPLAIN_CONCAT_IDENTS); - return base::DummyResult::expr(sp); } if tts.is_empty() { cx.span_err(sp, "concat_idents! takes 1 or more arguments."); - return DummyResult::expr(sp); + return DummyResult::any(sp); } let mut res_str = String::new(); @@ -45,7 +34,7 @@ pub fn expand_syntax_ext<'cx>(cx: &'cx mut ExtCtxt, TokenTree::Token(_, token::Comma) => {} _ => { cx.span_err(sp, "concat_idents! expecting comma."); - return DummyResult::expr(sp); + return DummyResult::any(sp); } } } else { @@ -54,7 +43,7 @@ pub fn expand_syntax_ext<'cx>(cx: &'cx mut ExtCtxt, res_str.push_str(&ident.as_str()), _ => { cx.span_err(sp, "concat_idents! requires ident args."); - return DummyResult::expr(sp); + return DummyResult::any(sp); } } } diff --git a/src/libsyntax_ext/deriving/bounds.rs b/src/libsyntax_ext/deriving/bounds.rs index 41e980b3346..dcfc6ab0391 100644 --- a/src/libsyntax_ext/deriving/bounds.rs +++ b/src/libsyntax_ext/deriving/bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use deriving::path_std; use deriving::generic::*; use deriving::generic::ty::*; diff --git a/src/libsyntax_ext/deriving/clone.rs b/src/libsyntax_ext/deriving/clone.rs index ec935b3e72f..38d433e842c 100644 --- a/src/libsyntax_ext/deriving/clone.rs +++ b/src/libsyntax_ext/deriving/clone.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use deriving::path_std; use deriving::generic::*; use deriving::generic::ty::*; @@ -140,7 +130,7 @@ fn cs_clone_shallow(name: &str, let mut stmts = Vec::new(); if is_union { // let _: AssertParamIsCopy; - let self_ty = cx.ty_path(cx.path_ident(trait_span, keywords::SelfType.ident())); + let self_ty = cx.ty_path(cx.path_ident(trait_span, keywords::SelfUpper.ident())); assert_ty_bounds(cx, &mut stmts, self_ty, trait_span, "AssertParamIsCopy"); } else { match *substr.fields { diff --git a/src/libsyntax_ext/deriving/cmp/eq.rs b/src/libsyntax_ext/deriving/cmp/eq.rs index f202bc4e524..dbba8c3b7a0 100644 --- a/src/libsyntax_ext/deriving/cmp/eq.rs +++ b/src/libsyntax_ext/deriving/cmp/eq.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use deriving::path_std; use deriving::generic::*; use deriving::generic::ty::*; diff --git a/src/libsyntax_ext/deriving/cmp/ord.rs b/src/libsyntax_ext/deriving/cmp/ord.rs index 117bedf453e..21bd56710ac 100644 --- a/src/libsyntax_ext/deriving/cmp/ord.rs +++ b/src/libsyntax_ext/deriving/cmp/ord.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use deriving::path_std; use deriving::generic::*; use deriving::generic::ty::*; diff --git a/src/libsyntax_ext/deriving/cmp/partial_eq.rs b/src/libsyntax_ext/deriving/cmp/partial_eq.rs index 24a3a7542fb..4ec24bce4cd 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_eq.rs +++ b/src/libsyntax_ext/deriving/cmp/partial_eq.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use deriving::{path_local, path_std}; use deriving::generic::*; use deriving::generic::ty::*; diff --git a/src/libsyntax_ext/deriving/cmp/partial_ord.rs b/src/libsyntax_ext/deriving/cmp/partial_ord.rs index 32a58de3529..9ef481edf51 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_ord.rs +++ b/src/libsyntax_ext/deriving/cmp/partial_ord.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use self::OrderingOp::*; use deriving::{path_local, pathvec_std, path_std}; @@ -227,7 +217,7 @@ fn cs_op(less: bool, let fold = cs_fold1(false, // need foldr |cx, span, subexpr, self_f, other_fs| { // build up a series of `partial_cmp`s from the inside - // out (hence foldr) to get lexical ordering, i.e. for op == + // out (hence foldr) to get lexical ordering, i.e., for op == // `ast::lt` // // ``` diff --git a/src/libsyntax_ext/deriving/custom.rs b/src/libsyntax_ext/deriving/custom.rs index 55b3928d68e..2f20814ef3e 100644 --- a/src/libsyntax_ext/deriving/custom.rs +++ b/src/libsyntax_ext/deriving/custom.rs @@ -1,22 +1,15 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::panic; - use errors::FatalError; -use proc_macro::{TokenStream, __internal}; use syntax::ast::{self, ItemKind, Attribute, Mac}; use syntax::attr::{mark_used, mark_known}; use syntax::source_map::Span; use syntax::ext::base::*; +use syntax::parse; +use syntax::parse::token::{self, Token}; +use syntax::tokenstream; use syntax::visit::Visitor; +use syntax_pos::DUMMY_SP; + +use proc_macro_impl::EXEC_STRATEGY; struct MarkAttrs<'a>(&'a [ast::Name]); @@ -32,14 +25,10 @@ impl<'a> Visitor<'a> for MarkAttrs<'a> { } pub struct ProcMacroDerive { - inner: fn(TokenStream) -> TokenStream, - attrs: Vec, -} - -impl ProcMacroDerive { - pub fn new(inner: fn(TokenStream) -> TokenStream, attrs: Vec) -> ProcMacroDerive { - ProcMacroDerive { inner: inner, attrs: attrs } - } + pub client: ::proc_macro::bridge::client::Client< + fn(::proc_macro::TokenStream) -> ::proc_macro::TokenStream, + >, + pub attrs: Vec, } impl MultiItemModifier for ProcMacroDerive { @@ -75,21 +64,16 @@ impl MultiItemModifier for ProcMacroDerive { // Mark attributes as known, and used. MarkAttrs(&self.attrs).visit_item(&item); - let input = __internal::new_token_stream(ecx.resolver.eliminate_crate_var(item)); - let res = __internal::set_sess(ecx, || { - let inner = self.inner; - panic::catch_unwind(panic::AssertUnwindSafe(|| inner(input))) - }); + let token = Token::interpolated(token::NtItem(item)); + let input = tokenstream::TokenTree::Token(DUMMY_SP, token).into(); - let stream = match res { + let server = ::proc_macro_server::Rustc::new(ecx); + let stream = match self.client.run(&EXEC_STRATEGY, server, input) { Ok(stream) => stream, Err(e) => { let msg = "proc-macro derive panicked"; let mut err = ecx.struct_span_fatal(span, msg); - if let Some(s) = e.downcast_ref::() { - err.help(&format!("message: {}", s)); - } - if let Some(s) = e.downcast_ref::<&'static str>() { + if let Some(s) = e.as_str() { err.help(&format!("message: {}", s)); } @@ -99,21 +83,33 @@ impl MultiItemModifier for ProcMacroDerive { }; let error_count_before = ecx.parse_sess.span_diagnostic.err_count(); - __internal::set_sess(ecx, || { - let msg = "proc-macro derive produced unparseable tokens"; - match __internal::token_stream_parse_items(stream) { - // fail if there have been errors emitted - Ok(_) if ecx.parse_sess.span_diagnostic.err_count() > error_count_before => { - ecx.struct_span_fatal(span, msg).emit(); - FatalError.raise(); + let msg = "proc-macro derive produced unparseable tokens"; + + let mut parser = parse::stream_to_parser(ecx.parse_sess, stream); + let mut items = vec![]; + + loop { + match parser.parse_item() { + Ok(None) => break, + Ok(Some(item)) => { + items.push(Annotatable::Item(item)) } - Ok(new_items) => new_items.into_iter().map(Annotatable::Item).collect(), - Err(_) => { + Err(mut err) => { // FIXME: handle this better + err.cancel(); ecx.struct_span_fatal(span, msg).emit(); FatalError.raise(); } } - }) + } + + + // fail if there have been errors emitted + if ecx.parse_sess.span_diagnostic.err_count() > error_count_before { + ecx.struct_span_fatal(span, msg).emit(); + FatalError.raise(); + } + + items } } diff --git a/src/libsyntax_ext/deriving/debug.rs b/src/libsyntax_ext/deriving/debug.rs index df9c351ef1c..b3e5bd9283e 100644 --- a/src/libsyntax_ext/deriving/debug.rs +++ b/src/libsyntax_ext/deriving/debug.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use deriving::path_std; use deriving::generic::*; use deriving::generic::ty::*; diff --git a/src/libsyntax_ext/deriving/decodable.rs b/src/libsyntax_ext/deriving/decodable.rs index c2b92944999..89c630e9915 100644 --- a/src/libsyntax_ext/deriving/decodable.rs +++ b/src/libsyntax_ext/deriving/decodable.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The compiler code necessary for `#[derive(Decodable)]`. See encodable.rs for more. use deriving::{self, pathvec_std}; diff --git a/src/libsyntax_ext/deriving/default.rs b/src/libsyntax_ext/deriving/default.rs index adbc5828b8f..32d02bec798 100644 --- a/src/libsyntax_ext/deriving/default.rs +++ b/src/libsyntax_ext/deriving/default.rs @@ -1,19 +1,9 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use deriving::path_std; use deriving::generic::*; use deriving::generic::ty::*; use syntax::ast::{Expr, MetaItem}; -use syntax::ext::base::{Annotatable, ExtCtxt}; +use syntax::ext::base::{Annotatable, DummyResult, ExtCtxt}; use syntax::ext::build::AstBuilder; use syntax::ptr::P; use syntax::symbol::Symbol; @@ -79,7 +69,7 @@ fn default_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructur span_err!(cx, trait_span, E0665, "`Default` cannot be derived for enums, only structs"); // let compilation continue - cx.expr_usize(trait_span, 0) + DummyResult::raw_expr(trait_span, true) } _ => cx.span_bug(trait_span, "Non-static method in `derive(Default)`"), }; diff --git a/src/libsyntax_ext/deriving/encodable.rs b/src/libsyntax_ext/deriving/encodable.rs index 5438c8b52af..c8935874158 100644 --- a/src/libsyntax_ext/deriving/encodable.rs +++ b/src/libsyntax_ext/deriving/encodable.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The compiler code necessary to implement the `#[derive(Encodable)]` //! (and `Decodable`, in decodable.rs) extension. The idea here is that //! type-defining items may be tagged with `#[derive(Encodable, Decodable)]`. diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index a5b12ce4c4d..22643db5016 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Some code that abstracts away much of the boilerplate of writing //! `derive` instances for traits. Among other things it manages getting //! access to the fields of the 4 different sorts of structs and enum @@ -18,7 +8,7 @@ //! - Methods taking any number of parameters of any type, and returning //! any type, other than vectors, bottom and closures. //! - Generating `impl`s for types with type parameters and lifetimes -//! (e.g. `Option`), the parameters are automatically given the +//! (e.g., `Option`), the parameters are automatically given the //! current trait as a bound. (This includes separate type parameters //! and lifetimes for methods.) //! - Additional bounds on the type parameters (`TraitDef.additional_bounds`) @@ -30,9 +20,9 @@ //! - `Struct`, when `Self` is a struct (including tuple structs, e.g //! `struct T(i32, char)`). //! - `EnumMatching`, when `Self` is an enum and all the arguments are the -//! same variant of the enum (e.g. `Some(1)`, `Some(3)` and `Some(4)`) +//! same variant of the enum (e.g., `Some(1)`, `Some(3)` and `Some(4)`) //! - `EnumNonMatchingCollapsed` when `Self` is an enum and the arguments -//! are not the same variant (e.g. `None`, `Some(1)` and `None`). +//! are not the same variant (e.g., `None`, `Some(1)` and `None`). //! - `StaticEnum` and `StaticStruct` for static methods, where the type //! being derived upon is either an enum or struct respectively. (Any //! argument with type Self is just grouped among the non-self @@ -224,7 +214,7 @@ pub struct TraitDef<'a> { /// other than the current trait pub additional_bounds: Vec>, - /// Any extra lifetimes and/or bounds, e.g. `D: serialize::Decoder` + /// Any extra lifetimes and/or bounds, e.g., `D: serialize::Decoder` pub generics: LifetimeBounds<'a>, /// Is it an `unsafe` trait? @@ -242,10 +232,10 @@ pub struct TraitDef<'a> { pub struct MethodDef<'a> { /// name of the method pub name: &'a str, - /// List of generics, e.g. `R: rand::Rng` + /// List of generics, e.g., `R: rand::Rng` pub generics: LifetimeBounds<'a>, - /// Whether there is a self argument (outer Option) i.e. whether + /// Whether there is a self argument (outer Option) i.e., whether /// this is a static function, and whether it is a pointer (inner /// Option) pub explicit_self: Option>>, @@ -938,7 +928,7 @@ impl<'a> MethodDef<'a> { let args = { let self_args = explicit_self.map(|explicit_self| { ast::Arg::from_self(explicit_self, - keywords::SelfValue.ident().with_span_pos(trait_.span)) + keywords::SelfLower.ident().with_span_pos(trait_.span)) }); let nonself_args = arg_types.into_iter() .map(|(name, ty)| cx.arg(trait_.span, name, ty)); @@ -1371,7 +1361,7 @@ impl<'a> MethodDef<'a> { // that type. Otherwise casts to `i32` (the default repr // type). // - // i.e. for `enum E { A, B(1), C(T, T) }`, and a deriving + // i.e., for `enum E { A, B(1), C(T, T) }`, and a deriving // with three Self args, builds three statements: // // ``` @@ -1489,8 +1479,8 @@ impl<'a> MethodDef<'a> { // // (See also #4499 and #12609; note that some of the // discussions there influence what choice we make here; - // e.g. if we feature-gate `match x { ... }` when x refers - // to an uninhabited type (e.g. a zero-variant enum or a + // e.g., if we feature-gate `match x { ... }` when x refers + // to an uninhabited type (e.g., a zero-variant enum or a // type holding such an enum), but do not feature-gate // zero-variant enums themselves, then attempting to // derive Debug on such a type could here generate code diff --git a/src/libsyntax_ext/deriving/generic/ty.rs b/src/libsyntax_ext/deriving/generic/ty.rs index fa284f4ab0e..83ec99b3573 100644 --- a/src/libsyntax_ext/deriving/generic/ty.rs +++ b/src/libsyntax_ext/deriving/generic/ty.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A mini version of ast::Ty, which is easier to use, and features an explicit `Self` type to use //! when specifying impls to be derived. @@ -32,7 +22,7 @@ pub enum PtrTy<'a> { Raw(ast::Mutability), } -/// A path, e.g. `::std::option::Option::` (global). Has support +/// A path, e.g., `::std::option::Option::` (global). Has support /// for type parameters and a lifetime. #[derive(Clone)] pub struct Path<'a> { diff --git a/src/libsyntax_ext/deriving/hash.rs b/src/libsyntax_ext/deriving/hash.rs index 950e8c84f17..4af2bd57b00 100644 --- a/src/libsyntax_ext/deriving/hash.rs +++ b/src/libsyntax_ext/deriving/hash.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use deriving::{self, pathvec_std, path_std}; use deriving::generic::*; use deriving::generic::ty::*; diff --git a/src/libsyntax_ext/deriving/mod.rs b/src/libsyntax_ext/deriving/mod.rs index ae47a028bc3..7548d43f184 100644 --- a/src/libsyntax_ext/deriving/mod.rs +++ b/src/libsyntax_ext/deriving/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The compiler code necessary to implement the `#[derive]` extensions. use rustc_data_structures::sync::Lrc; @@ -163,6 +153,5 @@ fn call_intrinsic(cx: &ExtCtxt, id: ast::DUMMY_NODE_ID, rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated), span, - recovered: false, })) } diff --git a/src/libsyntax_ext/diagnostics.rs b/src/libsyntax_ext/diagnostics.rs index f99a6c3c216..e8ad4af6850 100644 --- a/src/libsyntax_ext/diagnostics.rs +++ b/src/libsyntax_ext/diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] // Error messages for EXXXX errors. diff --git a/src/libsyntax_ext/env.rs b/src/libsyntax_ext/env.rs index 8f26b2402aa..16fb64a5f39 100644 --- a/src/libsyntax_ext/env.rs +++ b/src/libsyntax_ext/env.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The compiler code necessary to support the env! extension. Eventually this // should all get sucked into either the compiler syntax extension plugin // interface. @@ -89,7 +79,7 @@ pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt, let e = match env::var(&*var.as_str()) { Err(_) => { cx.span_err(sp, &msg.as_str()); - cx.expr_usize(sp, 0) + return DummyResult::expr(sp); } Ok(s) => cx.expr_str(sp, Symbol::intern(&s)), }; diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 31e608de1f8..4c473fe7612 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -1,18 +1,9 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use self::ArgumentType::*; use self::Position::*; use fmt_macros as parse; +use errors::DiagnosticBuilder; use syntax::ast; use syntax::ext::base::{self, *}; use syntax::ext::build::AstBuilder; @@ -122,7 +113,7 @@ struct Context<'a, 'b: 'a> { is_literal: bool, } -/// Parses the arguments from the given list of tokens, returning None +/// Parses the arguments from the given list of tokens, returning the diagnostic /// if there's a parse error so we can continue parsing other format! /// expressions. /// @@ -131,60 +122,45 @@ struct Context<'a, 'b: 'a> { /// ```text /// Some((fmtstr, parsed arguments, index map for named arguments)) /// ``` -fn parse_args(ecx: &mut ExtCtxt, - sp: Span, - tts: &[tokenstream::TokenTree]) - -> Option<(P, Vec>, FxHashMap)> { +fn parse_args<'a>( + ecx: &mut ExtCtxt<'a>, + sp: Span, + tts: &[tokenstream::TokenTree] +) -> Result<(P, Vec>, FxHashMap), DiagnosticBuilder<'a>> { let mut args = Vec::>::new(); let mut names = FxHashMap::::default(); let mut p = ecx.new_parser_from_tts(tts); if p.token == token::Eof { - ecx.span_err(sp, "requires at least a format string argument"); - return None; + return Err(ecx.struct_span_err(sp, "requires at least a format string argument")); } - let fmtstr = panictry!(p.parse_expr()); + let fmtstr = p.parse_expr()?; let mut named = false; while p.token != token::Eof { if !p.eat(&token::Comma) { - ecx.span_err(p.span, "expected token: `,`"); - return None; + return Err(ecx.struct_span_err(p.span, "expected token: `,`")); } if p.token == token::Eof { break; } // accept trailing commas if named || (p.token.is_ident() && p.look_ahead(1, |t| *t == token::Eq)) { named = true; - let ident = match p.token { - token::Ident(i, _) => { - p.bump(); - i - } - _ if named => { - ecx.span_err( - p.span, - "expected ident, positional arguments cannot follow named arguments", - ); - return None; - } - _ => { - ecx.span_err( - p.span, - &format!( - "expected ident for named argument, found `{}`", - p.this_token_to_string() - ), - ); - return None; - } + let ident = if let token::Ident(i, _) = p.token { + p.bump(); + i + } else { + return Err(ecx.struct_span_err( + p.span, + "expected ident, positional arguments cannot follow named arguments", + )); }; let name: &str = &ident.as_str(); - panictry!(p.expect(&token::Eq)); - let e = panictry!(p.parse_expr()); + p.expect(&token::Eq)?; + let e = p.parse_expr()?; if let Some(prev) = names.get(name) { ecx.struct_span_err(e.span, &format!("duplicate argument named `{}`", name)) .span_note(args[*prev].span, "previously here") @@ -200,16 +176,17 @@ fn parse_args(ecx: &mut ExtCtxt, names.insert(name.to_string(), slot); args.push(e); } else { - args.push(panictry!(p.parse_expr())); + let e = p.parse_expr()?; + args.push(e); } } - Some((fmtstr, args, names)) + Ok((fmtstr, args, names)) } impl<'a, 'b> Context<'a, 'b> { fn resolve_name_inplace(&self, p: &mut parse::Piece) { // NOTE: the `unwrap_or` branch is needed in case of invalid format - // arguments, e.g. `format_args!("{foo}")`. + // arguments, e.g., `format_args!("{foo}")`. let lookup = |s| *self.names.get(s).unwrap_or(&0); match *p { @@ -286,11 +263,11 @@ impl<'a, 'b> Context<'a, 'b> { } else { MultiSpan::from_span(self.fmtsp) }; - let mut refs: Vec<_> = self + let refs_len = self.invalid_refs.len(); + let mut refs = self .invalid_refs .iter() - .map(|(r, pos)| (r.to_string(), self.arg_spans.get(*pos))) - .collect(); + .map(|(r, pos)| (r.to_string(), self.arg_spans.get(*pos))); if self.names.is_empty() && !numbered_position_args { e = self.ecx.mut_span_err( @@ -303,28 +280,24 @@ impl<'a, 'b> Context<'a, 'b> { ), ); } else { - let (arg_list, mut sp) = match refs.len() { - 1 => { - let (reg, pos) = refs.pop().unwrap(); - ( - format!("argument {}", reg), - MultiSpan::from_span(*pos.unwrap_or(&self.fmtsp)), - ) - } - _ => { - let pos = - MultiSpan::from_spans(refs.iter().map(|(_, p)| *p.unwrap()).collect()); - let mut refs: Vec = refs.iter().map(|(s, _)| s.to_owned()).collect(); - let reg = refs.pop().unwrap(); - ( - format!( - "arguments {head} and {tail}", - tail = reg, - head = refs.join(", ") - ), - pos, - ) - } + let (arg_list, mut sp) = if refs_len == 1 { + let (reg, pos) = refs.next().unwrap(); + ( + format!("argument {}", reg), + MultiSpan::from_span(*pos.unwrap_or(&self.fmtsp)), + ) + } else { + let (mut refs, spans): (Vec<_>, Vec<_>) = refs.unzip(); + let pos = MultiSpan::from_spans(spans.into_iter().map(|s| *s.unwrap()).collect()); + let reg = refs.pop().unwrap(); + ( + format!( + "arguments {head} and {tail}", + head = refs.join(", "), + tail = reg, + ), + pos, + ) }; if !self.is_literal { sp = MultiSpan::from_span(self.fmtsp); @@ -353,33 +326,30 @@ impl<'a, 'b> Context<'a, 'b> { Placeholder(_) => { // record every (position, type) combination only once let ref mut seen_ty = self.arg_unique_types[arg]; - let i = match seen_ty.iter().position(|x| *x == ty) { - Some(i) => i, - None => { - let i = seen_ty.len(); - seen_ty.push(ty); - i - } - }; + let i = seen_ty.iter().position(|x| *x == ty).unwrap_or_else(|| { + let i = seen_ty.len(); + seen_ty.push(ty); + i + }); self.arg_types[arg].push(i); } Count => { - match self.count_positions.entry(arg) { - Entry::Vacant(e) => { - let i = self.count_positions_count; - e.insert(i); - self.count_args.push(Exact(arg)); - self.count_positions_count += 1; - } - Entry::Occupied(_) => {} + if let Entry::Vacant(e) = self.count_positions.entry(arg) { + let i = self.count_positions_count; + e.insert(i); + self.count_args.push(Exact(arg)); + self.count_positions_count += 1; } } } } Named(name) => { - let idx = match self.names.get(&name) { - Some(e) => *e, + match self.names.get(&name) { + Some(idx) => { + // Treat as positional arg. + self.verify_arg_type(Exact(*idx), ty) + } None => { let msg = format!("there is no argument named `{}`", name); let sp = if self.is_literal { @@ -389,11 +359,8 @@ impl<'a, 'b> Context<'a, 'b> { }; let mut err = self.ecx.struct_span_err(sp, &msg[..]); err.emit(); - return; } - }; - // Treat as positional arg. - self.verify_arg_type(Exact(idx), ty) + } } } } @@ -436,12 +403,10 @@ impl<'a, 'b> Context<'a, 'b> { parse::CountIs(i) => count("Is", Some(self.ecx.expr_usize(sp, i))), parse::CountIsParam(i) => { // This needs mapping too, as `i` is referring to a macro - // argument. - let i = match self.count_positions.get(&i) { - Some(&i) => i, - None => 0, // error already emitted elsewhere - }; - let i = i + self.count_args_index_offset; + // argument. If `i` is not found in `count_positions` then + // the error had already been emitted elsewhere. + let i = self.count_positions.get(&i).cloned().unwrap_or(0) + + self.count_args_index_offset; count("Param", Some(self.ecx.expr_usize(sp, i))) } parse::CountImplied => count("Implied", None), @@ -526,12 +491,12 @@ impl<'a, 'b> Context<'a, 'b> { }, }; - let fill = match arg.format.fill { - Some(c) => c, - None => ' ', - }; + let fill = arg.format.fill.unwrap_or(' '); + + let pos_simple = + arg.position.index() == simple_arg.position.index(); - if *arg != simple_arg || fill != ' ' { + if !pos_simple || arg.format != simple_arg.format || fill != ' ' { self.all_pieces_simple = false; } @@ -704,7 +669,7 @@ impl<'a, 'b> Context<'a, 'b> { "X" => "UpperHex", _ => { ecx.span_err(sp, &format!("unknown format trait `{}`", *tyname)); - "Dummy" + return DummyResult::raw_expr(sp, true); } } } @@ -727,10 +692,13 @@ pub fn expand_format_args<'cx>(ecx: &'cx mut ExtCtxt, -> Box { sp = sp.apply_mark(ecx.current_expansion.mark); match parse_args(ecx, sp, tts) { - Some((efmt, args, names)) => { + Ok((efmt, args, names)) => { MacEager::expr(expand_preparsed_format_args(ecx, sp, efmt, args, names, false)) } - None => DummyResult::expr(sp), + Err(mut err) => { + err.emit(); + DummyResult::expr(sp) + } } } @@ -751,14 +719,16 @@ pub fn expand_format_args_nl<'cx>( sp, feature_gate::GateIssue::Language, feature_gate::EXPLAIN_FORMAT_ARGS_NL); - return base::DummyResult::expr(sp); } sp = sp.apply_mark(ecx.current_expansion.mark); match parse_args(ecx, sp, tts) { - Some((efmt, args, names)) => { + Ok((efmt, args, names)) => { MacEager::expr(expand_preparsed_format_args(ecx, sp, efmt, args, names, true)) } - None => DummyResult::expr(sp), + Err(mut err) => { + err.emit(); + DummyResult::expr(sp) + } } } @@ -787,34 +757,137 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, fmt } Ok(fmt) => fmt, - Err(mut err) => { - let sugg_fmt = match args.len() { - 0 => "{}".to_string(), - _ => format!("{}{{}}", "{} ".repeat(args.len())), - }; - err.span_suggestion_with_applicability( - fmt_sp.shrink_to_lo(), - "you might be missing a string literal to format with", - format!("\"{}\", ", sugg_fmt), - Applicability::MaybeIncorrect, - ); - err.emit(); - return DummyResult::raw_expr(sp); + Err(err) => { + if let Some(mut err) = err { + let sugg_fmt = match args.len() { + 0 => "{}".to_string(), + _ => format!("{}{{}}", "{} ".repeat(args.len())), + }; + err.span_suggestion( + fmt_sp.shrink_to_lo(), + "you might be missing a string literal to format with", + format!("\"{}\", ", sugg_fmt), + Applicability::MaybeIncorrect, + ); + err.emit(); + } + return DummyResult::raw_expr(sp, true); } }; - let is_literal = match ecx.source_map().span_to_snippet(fmt_sp) { - Ok(ref s) if s.starts_with("\"") || s.starts_with("r#") => true, - _ => false, + let (is_literal, fmt_snippet) = match ecx.source_map().span_to_snippet(fmt_sp) { + Ok(s) => (s.starts_with("\"") || s.starts_with("r#"), Some(s)), + _ => (false, None), }; - let fmt_str = &*fmt.node.0.as_str(); let str_style = match fmt.node.1 { ast::StrStyle::Cooked => None, - ast::StrStyle::Raw(raw) => Some(raw as usize), + ast::StrStyle::Raw(raw) => { + Some(raw as usize) + }, }; - let mut parser = parse::Parser::new(fmt_str, str_style); + /// Find the indices of all characters that have been processed and differ between the actual + /// written code (code snippet) and the `InternedString` that get's processed in the `Parser` + /// in order to properly synthethise the intra-string `Span`s for error diagnostics. + fn find_skips(snippet: &str, is_raw: bool) -> Vec { + let mut eat_ws = false; + let mut s = snippet.chars().enumerate().peekable(); + let mut skips = vec![]; + while let Some((pos, c)) = s.next() { + match (c, s.peek()) { + // skip whitespace and empty lines ending in '\\' + ('\\', Some((next_pos, '\n'))) if !is_raw => { + eat_ws = true; + skips.push(pos); + skips.push(*next_pos); + let _ = s.next(); + } + ('\\', Some((next_pos, '\n'))) | + ('\\', Some((next_pos, 'n'))) | + ('\\', Some((next_pos, 't'))) if eat_ws => { + skips.push(pos); + skips.push(*next_pos); + let _ = s.next(); + } + (' ', _) | + ('\n', _) | + ('\t', _) if eat_ws => { + skips.push(pos); + } + ('\\', Some((next_pos, 'n'))) | + ('\\', Some((next_pos, 't'))) | + ('\\', Some((next_pos, '0'))) | + ('\\', Some((next_pos, '\\'))) | + ('\\', Some((next_pos, '\''))) | + ('\\', Some((next_pos, '\"'))) => { + skips.push(*next_pos); + let _ = s.next(); + } + ('\\', Some((_, 'x'))) if !is_raw => { + for _ in 0..3 { // consume `\xAB` literal + if let Some((pos, _)) = s.next() { + skips.push(pos); + } else { + break; + } + } + } + ('\\', Some((_, 'u'))) if !is_raw => { + if let Some((pos, _)) = s.next() { + skips.push(pos); + } + if let Some((next_pos, next_c)) = s.next() { + if next_c == '{' { + skips.push(next_pos); + let mut i = 0; // consume up to 6 hexanumeric chars + closing `}` + while let (Some((next_pos, c)), true) = (s.next(), i < 7) { + if c.is_digit(16) { + skips.push(next_pos); + } else if c == '}' { + skips.push(next_pos); + break; + } else { + break; + } + i += 1; + } + } else if next_c.is_digit(16) { + skips.push(next_pos); + // We suggest adding `{` and `}` when appropriate, accept it here as if + // it were correct + let mut i = 0; // consume up to 6 hexanumeric chars + while let (Some((next_pos, c)), _) = (s.next(), i < 6) { + if c.is_digit(16) { + skips.push(next_pos); + } else { + break; + } + i += 1; + } + } + } + } + _ if eat_ws => { // `take_while(|c| c.is_whitespace())` + eat_ws = false; + } + _ => {} + } + } + skips + } + + let skips = if let (true, Some(ref snippet)) = (is_literal, fmt_snippet.as_ref()) { + let r_start = str_style.map(|r| r + 1).unwrap_or(0); + let r_end = str_style.map(|r| r).unwrap_or(0); + let s = &snippet[r_start + 1..snippet.len() - r_end - 1]; + find_skips(s, str_style.is_some()) + } else { + vec![] + }; + + let fmt_str = &*fmt.node.0.as_str(); // for the suggestions below + let mut parser = parse::Parser::new(fmt_str, str_style, skips.clone(), append_newline); let mut unverified_pieces = Vec::new(); while let Some(piece) = parser.next() { @@ -827,19 +900,25 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, if !parser.errors.is_empty() { let err = parser.errors.remove(0); - let sp = fmt.span.from_inner_byte_pos(err.start, err.end); + let sp = fmt.span.from_inner_byte_pos(err.start.unwrap(), err.end.unwrap()); let mut e = ecx.struct_span_err(sp, &format!("invalid format string: {}", - err.description)); + err.description)); e.span_label(sp, err.label + " in format string"); if let Some(note) = err.note { e.note(¬e); } + if let Some((label, start, end)) = err.secondary_label { + let sp = fmt.span.from_inner_byte_pos(start.unwrap(), end.unwrap()); + e.span_label(sp, label); + } e.emit(); - return DummyResult::raw_expr(sp); + return DummyResult::raw_expr(sp, true); } let arg_spans = parser.arg_places.iter() - .map(|&(start, end)| fmt.span.from_inner_byte_pos(start, end)) + .map(|&(parse::SpanIndex(start), parse::SpanIndex(end))| { + fmt.span.from_inner_byte_pos(start, end) + }) .collect(); let mut cx = Context { @@ -933,13 +1012,18 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, let mut diag = { if errs_len == 1 { let (sp, msg) = errs.into_iter().next().unwrap(); - cx.ecx.struct_span_err(sp, msg) + let mut diag = cx.ecx.struct_span_err(sp, msg); + diag.span_label(sp, msg); + diag } else { let mut diag = cx.ecx.struct_span_err( errs.iter().map(|&(sp, _)| sp).collect::>(), "multiple unused formatting arguments", ); diag.span_label(cx.fmtsp, "multiple missing formatting specifiers"); + for (sp, msg) in errs { + diag.span_label(sp, msg); + } diag } }; @@ -996,7 +1080,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, )); } if suggestions.len() > 0 { - diag.multipart_suggestion_with_applicability( + diag.multipart_suggestion( "format specifiers use curly braces", suggestions, Applicability::MachineApplicable, diff --git a/src/libsyntax_ext/format_foreign.rs b/src/libsyntax_ext/format_foreign.rs index 6eba3c4f2bb..8ac6d460ec3 100644 --- a/src/libsyntax_ext/format_foreign.rs +++ b/src/libsyntax_ext/format_foreign.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod printf { use super::strcursor::StrCursor as Cur; @@ -264,7 +254,7 @@ pub mod printf { match *self { Num::Num(n) => write!(s, "{}", n), Num::Arg(n) => { - let n = try!(n.checked_sub(1).ok_or(::std::fmt::Error)); + let n = n.checked_sub(1).ok_or(::std::fmt::Error)?; write!(s, "{}$", n) }, Num::Next => write!(s, "*"), diff --git a/src/libsyntax_ext/global_asm.rs b/src/libsyntax_ext/global_asm.rs index 1130a50537d..0a12e27c4fc 100644 --- a/src/libsyntax_ext/global_asm.rs +++ b/src/libsyntax_ext/global_asm.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Module-level assembly support. /// /// The macro defined here allows you to specify "top-level", @@ -18,17 +8,19 @@ /// LLVM's `module asm "some assembly here"`. All of LLVM's caveats /// therefore apply. +use errors::DiagnosticBuilder; use syntax::ast; use syntax::source_map::respan; use syntax::ext::base; use syntax::ext::base::*; use syntax::feature_gate; +use syntax::parse::token; use syntax::ptr::P; use syntax::symbol::Symbol; use syntax_pos::Span; use syntax::tokenstream; -pub const MACRO: &'static str = "global_asm"; +pub const MACRO: &str = "global_asm"; pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt, sp: Span, @@ -39,27 +31,49 @@ pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt, sp, feature_gate::GateIssue::Language, feature_gate::EXPLAIN_GLOBAL_ASM); - return DummyResult::any(sp); } + match parse_global_asm(cx, sp, tts) { + Ok(Some(global_asm)) => { + MacEager::items(smallvec![P(ast::Item { + ident: ast::Ident::with_empty_ctxt(Symbol::intern("")), + attrs: Vec::new(), + id: ast::DUMMY_NODE_ID, + node: ast::ItemKind::GlobalAsm(P(global_asm)), + vis: respan(sp.shrink_to_lo(), ast::VisibilityKind::Inherited), + span: sp, + tokens: None, + })]) + } + Ok(None) => DummyResult::any(sp), + Err(mut err) => { + err.emit(); + DummyResult::any(sp) + } + } +} + +fn parse_global_asm<'a>( + cx: &mut ExtCtxt<'a>, + sp: Span, + tts: &[tokenstream::TokenTree] +) -> Result, DiagnosticBuilder<'a>> { let mut p = cx.new_parser_from_tts(tts); - let (asm, _) = match expr_to_string(cx, - panictry!(p.parse_expr()), - "inline assembly must be a string literal") { + + if p.token == token::Eof { + let mut err = cx.struct_span_err(sp, "macro requires a string literal as an argument"); + err.span_label(sp, "string literal required"); + return Err(err); + } + + let expr = p.parse_expr()?; + let (asm, _) = match expr_to_string(cx, expr, "inline assembly must be a string literal") { Some((s, st)) => (s, st), - None => return DummyResult::any(sp), + None => return Ok(None), }; - MacEager::items(smallvec![P(ast::Item { - ident: ast::Ident::with_empty_ctxt(Symbol::intern("")), - attrs: Vec::new(), - id: ast::DUMMY_NODE_ID, - node: ast::ItemKind::GlobalAsm(P(ast::GlobalAsm { - asm, - ctxt: cx.backtrace(), - })), - vis: respan(sp.shrink_to_lo(), ast::VisibilityKind::Inherited), - span: sp, - tokens: None, - })]) + Ok(Some(ast::GlobalAsm { + asm, + ctxt: cx.backtrace(), + })) } diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index 7c023fc5c9c..5e767d237cc 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -1,26 +1,20 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Syntax extensions in the Rust compiler. #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] +#![feature(in_band_lifetimes)] +#![feature(proc_macro_diagnostic)] #![feature(proc_macro_internals)] +#![feature(proc_macro_span)] #![feature(decl_macro)] #![feature(nll)] #![feature(str_escape)] -#![feature(quote)] #![feature(rustc_diagnostic_macros)] +#![recursion_limit="256"] + extern crate fmt_macros; #[macro_use] extern crate syntax; @@ -36,10 +30,6 @@ extern crate log; mod diagnostics; -#[macro_use] -// for custom_derive -pub mod deriving; - mod asm; mod assert; mod cfg; @@ -51,13 +41,13 @@ mod format; mod format_foreign; mod global_asm; mod log_syntax; -mod trace_macros; +mod proc_macro_server; mod test; mod test_case; +mod trace_macros; -pub mod proc_macro_registrar; - - +pub mod deriving; +pub mod proc_macro_decls; pub mod proc_macro_impl; use rustc_data_structures::sync::Lrc; @@ -67,8 +57,7 @@ use syntax::ext::hygiene; use syntax::symbol::Symbol; pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver, - user_exts: Vec, - enable_quotes: bool) { + user_exts: Vec) { deriving::register_builtin_derives(resolver); let mut register = |name, ext| { @@ -90,24 +79,6 @@ pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver, )* } } - if enable_quotes { - use syntax::ext::quote::*; - register! { - quote_tokens: expand_quote_tokens, - quote_expr: expand_quote_expr, - quote_ty: expand_quote_ty, - quote_item: expand_quote_item, - quote_pat: expand_quote_pat, - quote_arm: expand_quote_arm, - quote_stmt: expand_quote_stmt, - quote_attr: expand_quote_attr, - quote_arg: expand_quote_arg, - quote_block: expand_quote_block, - quote_meta_item: expand_quote_meta_item, - quote_path: expand_quote_path, - } - } - use syntax::ext::source_util::*; register! { line: expand_line, diff --git a/src/libsyntax_ext/log_syntax.rs b/src/libsyntax_ext/log_syntax.rs index 7b76b1e8914..a143186b945 100644 --- a/src/libsyntax_ext/log_syntax.rs +++ b/src/libsyntax_ext/log_syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use syntax::ext::base; use syntax::feature_gate; use syntax::print; @@ -24,11 +14,10 @@ pub fn expand_syntax_ext<'cx>(cx: &'cx mut base::ExtCtxt, sp, feature_gate::GateIssue::Language, feature_gate::EXPLAIN_LOG_SYNTAX); - return base::DummyResult::any(sp); } println!("{}", print::pprust::tts_to_string(tts)); // any so that `log_syntax` can be invoked as an expression and item. - base::DummyResult::any(sp) + base::DummyResult::any_valid(sp) } diff --git a/src/libsyntax_ext/proc_macro_decls.rs b/src/libsyntax_ext/proc_macro_decls.rs new file mode 100644 index 00000000000..46c502965ee --- /dev/null +++ b/src/libsyntax_ext/proc_macro_decls.rs @@ -0,0 +1,416 @@ +use std::mem; + +use errors; + +use syntax::ast::{self, Ident}; +use syntax::attr; +use syntax::source_map::{ExpnInfo, MacroAttribute, hygiene, respan}; +use syntax::ext::base::ExtCtxt; +use syntax::ext::build::AstBuilder; +use syntax::ext::expand::ExpansionConfig; +use syntax::ext::hygiene::Mark; +use syntax::fold::Folder; +use syntax::parse::ParseSess; +use syntax::ptr::P; +use syntax::symbol::Symbol; +use syntax::symbol::keywords; +use syntax::visit::{self, Visitor}; + +use syntax_pos::{Span, DUMMY_SP}; + +use deriving; + +const PROC_MACRO_KINDS: [&str; 3] = ["proc_macro_derive", "proc_macro_attribute", "proc_macro"]; + +struct ProcMacroDerive { + trait_name: ast::Name, + function_name: Ident, + span: Span, + attrs: Vec, +} + +struct ProcMacroDef { + function_name: Ident, + span: Span, +} + +struct CollectProcMacros<'a> { + derives: Vec, + attr_macros: Vec, + bang_macros: Vec, + in_root: bool, + handler: &'a errors::Handler, + is_proc_macro_crate: bool, + is_test_crate: bool, +} + +pub fn modify(sess: &ParseSess, + resolver: &mut dyn (::syntax::ext::base::Resolver), + mut krate: ast::Crate, + is_proc_macro_crate: bool, + has_proc_macro_decls: bool, + is_test_crate: bool, + num_crate_types: usize, + handler: &errors::Handler) -> ast::Crate { + let ecfg = ExpansionConfig::default("proc_macro".to_string()); + let mut cx = ExtCtxt::new(sess, ecfg, resolver); + + let (derives, attr_macros, bang_macros) = { + let mut collect = CollectProcMacros { + derives: Vec::new(), + attr_macros: Vec::new(), + bang_macros: Vec::new(), + in_root: true, + handler, + is_proc_macro_crate, + is_test_crate, + }; + if has_proc_macro_decls || is_proc_macro_crate { + visit::walk_crate(&mut collect, &krate); + } + (collect.derives, collect.attr_macros, collect.bang_macros) + }; + + if !is_proc_macro_crate { + return krate + } + + if num_crate_types > 1 { + handler.err("cannot mix `proc-macro` crate type with others"); + } + + if is_test_crate { + return krate; + } + + krate.module.items.push(mk_decls(&mut cx, &derives, &attr_macros, &bang_macros)); + + krate +} + +pub fn is_proc_macro_attr(attr: &ast::Attribute) -> bool { + PROC_MACRO_KINDS.iter().any(|kind| attr.check_name(kind)) +} + +impl<'a> CollectProcMacros<'a> { + fn check_not_pub_in_root(&self, vis: &ast::Visibility, sp: Span) { + if self.is_proc_macro_crate && self.in_root && vis.node.is_pub() { + self.handler.span_err(sp, + "`proc-macro` crate types cannot \ + export any items other than functions \ + tagged with `#[proc_macro_derive]` currently"); + } + } + + fn collect_custom_derive(&mut self, item: &'a ast::Item, attr: &'a ast::Attribute) { + // Once we've located the `#[proc_macro_derive]` attribute, verify + // that it's of the form `#[proc_macro_derive(Foo)]` or + // `#[proc_macro_derive(Foo, attributes(A, ..))]` + let list = match attr.meta_item_list() { + Some(list) => list, + None => return, + }; + if list.len() != 1 && list.len() != 2 { + self.handler.span_err(attr.span(), + "attribute must have either one or two arguments"); + return + } + let trait_attr = &list[0]; + let attributes_attr = list.get(1); + let trait_name = match trait_attr.name() { + Some(name) => name, + _ => { + self.handler.span_err(trait_attr.span(), "not a meta item"); + return + } + }; + if !trait_attr.is_word() { + self.handler.span_err(trait_attr.span(), "must only be one word"); + } + + if deriving::is_builtin_trait(trait_name) { + self.handler.span_err(trait_attr.span(), + "cannot override a built-in #[derive] mode"); + } + + let proc_attrs: Vec<_> = if let Some(attr) = attributes_attr { + if !attr.check_name("attributes") { + self.handler.span_err(attr.span(), "second argument must be `attributes`") + } + attr.meta_item_list().unwrap_or_else(|| { + self.handler.span_err(attr.span(), + "attribute must be of form: \ + `attributes(foo, bar)`"); + &[] + }).into_iter().filter_map(|attr| { + let name = match attr.name() { + Some(name) => name, + _ => { + self.handler.span_err(attr.span(), "not a meta item"); + return None; + }, + }; + + if !attr.is_word() { + self.handler.span_err(attr.span(), "must only be one word"); + return None; + } + + Some(name) + }).collect() + } else { + Vec::new() + }; + + if self.in_root && item.vis.node.is_pub() { + self.derives.push(ProcMacroDerive { + span: item.span, + trait_name, + function_name: item.ident, + attrs: proc_attrs, + }); + } else { + let msg = if !self.in_root { + "functions tagged with `#[proc_macro_derive]` must \ + currently reside in the root of the crate" + } else { + "functions tagged with `#[proc_macro_derive]` must be `pub`" + }; + self.handler.span_err(item.span, msg); + } + } + + fn collect_attr_proc_macro(&mut self, item: &'a ast::Item) { + if self.in_root && item.vis.node.is_pub() { + self.attr_macros.push(ProcMacroDef { + span: item.span, + function_name: item.ident, + }); + } else { + let msg = if !self.in_root { + "functions tagged with `#[proc_macro_attribute]` must \ + currently reside in the root of the crate" + } else { + "functions tagged with `#[proc_macro_attribute]` must be `pub`" + }; + self.handler.span_err(item.span, msg); + } + } + + fn collect_bang_proc_macro(&mut self, item: &'a ast::Item) { + if self.in_root && item.vis.node.is_pub() { + self.bang_macros.push(ProcMacroDef { + span: item.span, + function_name: item.ident, + }); + } else { + let msg = if !self.in_root { + "functions tagged with `#[proc_macro]` must \ + currently reside in the root of the crate" + } else { + "functions tagged with `#[proc_macro]` must be `pub`" + }; + self.handler.span_err(item.span, msg); + } + } +} + +impl<'a> Visitor<'a> for CollectProcMacros<'a> { + fn visit_item(&mut self, item: &'a ast::Item) { + if let ast::ItemKind::MacroDef(..) = item.node { + if self.is_proc_macro_crate && attr::contains_name(&item.attrs, "macro_export") { + let msg = + "cannot export macro_rules! macros from a `proc-macro` crate type currently"; + self.handler.span_err(item.span, msg); + } + } + + // First up, make sure we're checking a bare function. If we're not then + // we're just not interested in this item. + // + // If we find one, try to locate a `#[proc_macro_derive]` attribute on + // it. + let is_fn = match item.node { + ast::ItemKind::Fn(..) => true, + _ => false, + }; + + let mut found_attr: Option<&'a ast::Attribute> = None; + + for attr in &item.attrs { + if is_proc_macro_attr(&attr) { + if let Some(prev_attr) = found_attr { + let msg = if attr.path.segments[0].ident.name == + prev_attr.path.segments[0].ident.name { + format!("Only one `#[{}]` attribute is allowed on any given function", + attr.path) + } else { + format!("`#[{}]` and `#[{}]` attributes cannot both be applied \ + to the same function", attr.path, prev_attr.path) + }; + + self.handler.struct_span_err(attr.span(), &msg) + .span_note(prev_attr.span(), "Previous attribute here") + .emit(); + + return; + } + + found_attr = Some(attr); + } + } + + let attr = match found_attr { + None => { + self.check_not_pub_in_root(&item.vis, item.span); + let prev_in_root = mem::replace(&mut self.in_root, false); + visit::walk_item(self, item); + self.in_root = prev_in_root; + return; + }, + Some(attr) => attr, + }; + + if !is_fn { + let msg = format!("the `#[{}]` attribute may only be used on bare functions", + attr.path); + + self.handler.span_err(attr.span(), &msg); + return; + } + + if self.is_test_crate { + return; + } + + if !self.is_proc_macro_crate { + let msg = format!("the `#[{}]` attribute is only usable with crates of the \ + `proc-macro` crate type", attr.path); + + self.handler.span_err(attr.span(), &msg); + return; + } + + if attr.check_name("proc_macro_derive") { + self.collect_custom_derive(item, attr); + } else if attr.check_name("proc_macro_attribute") { + self.collect_attr_proc_macro(item); + } else if attr.check_name("proc_macro") { + self.collect_bang_proc_macro(item); + }; + + let prev_in_root = mem::replace(&mut self.in_root, false); + visit::walk_item(self, item); + self.in_root = prev_in_root; + } + + fn visit_mac(&mut self, mac: &ast::Mac) { + visit::walk_mac(self, mac) + } +} + +// Creates a new module which looks like: +// +// mod $gensym { +// extern crate proc_macro; +// +// use proc_macro::bridge::client::ProcMacro; +// +// #[rustc_proc_macro_decls] +// static DECLS: &[ProcMacro] = &[ +// ProcMacro::custom_derive($name_trait1, &[], ::$name1); +// ProcMacro::custom_derive($name_trait2, &["attribute_name"], ::$name2); +// // ... +// ]; +// } +fn mk_decls( + cx: &mut ExtCtxt, + custom_derives: &[ProcMacroDerive], + custom_attrs: &[ProcMacroDef], + custom_macros: &[ProcMacroDef], +) -> P { + let mark = Mark::fresh(Mark::root()); + mark.set_expn_info(ExpnInfo { + call_site: DUMMY_SP, + def_site: None, + format: MacroAttribute(Symbol::intern("proc_macro")), + allow_internal_unstable: true, + allow_internal_unsafe: false, + local_inner_macros: false, + edition: hygiene::default_edition(), + }); + let span = DUMMY_SP.apply_mark(mark); + + let proc_macro = Ident::from_str("proc_macro"); + let krate = cx.item(span, + proc_macro, + Vec::new(), + ast::ItemKind::ExternCrate(None)); + + let bridge = Ident::from_str("bridge"); + let client = Ident::from_str("client"); + let proc_macro_ty = Ident::from_str("ProcMacro"); + let custom_derive = Ident::from_str("custom_derive"); + let attr = Ident::from_str("attr"); + let bang = Ident::from_str("bang"); + let crate_kw = Ident::with_empty_ctxt(keywords::Crate.name()); + + let decls = { + let local_path = |sp: Span, name| { + cx.expr_path(cx.path(sp.with_ctxt(span.ctxt()), vec![crate_kw, name])) + }; + let proc_macro_ty_method_path = |method| cx.expr_path(cx.path(span, vec![ + proc_macro, bridge, client, proc_macro_ty, method, + ])); + custom_derives.iter().map(|cd| { + cx.expr_call(span, proc_macro_ty_method_path(custom_derive), vec![ + cx.expr_str(cd.span, cd.trait_name), + cx.expr_vec_slice( + span, + cd.attrs.iter().map(|&s| cx.expr_str(cd.span, s)).collect::>() + ), + local_path(cd.span, cd.function_name), + ]) + }).chain(custom_attrs.iter().map(|ca| { + cx.expr_call(span, proc_macro_ty_method_path(attr), vec![ + cx.expr_str(ca.span, ca.function_name.name), + local_path(ca.span, ca.function_name), + ]) + })).chain(custom_macros.iter().map(|cm| { + cx.expr_call(span, proc_macro_ty_method_path(bang), vec![ + cx.expr_str(cm.span, cm.function_name.name), + local_path(cm.span, cm.function_name), + ]) + })).collect() + }; + + let decls_static = cx.item_static( + span, + Ident::from_str("_DECLS"), + cx.ty_rptr(span, + cx.ty(span, ast::TyKind::Slice( + cx.ty_path(cx.path(span, + vec![proc_macro, bridge, client, proc_macro_ty])))), + None, ast::Mutability::Immutable), + ast::Mutability::Immutable, + cx.expr_vec_slice(span, decls), + ).map(|mut i| { + let attr = cx.meta_word(span, Symbol::intern("rustc_proc_macro_decls")); + i.attrs.push(cx.attribute(span, attr)); + i.vis = respan(span, ast::VisibilityKind::Public); + i + }); + + let module = cx.item_mod( + span, + span, + ast::Ident::with_empty_ctxt(Symbol::gensym("decls")), + vec![], + vec![krate, decls_static], + ).map(|mut i| { + i.vis = respan(span, ast::VisibilityKind::Public); + i + }); + + cx.monotonic_expander().fold_item(module).pop().unwrap() +} diff --git a/src/libsyntax_ext/proc_macro_impl.rs b/src/libsyntax_ext/proc_macro_impl.rs index ff60262055b..60d167d01ee 100644 --- a/src/libsyntax_ext/proc_macro_impl.rs +++ b/src/libsyntax_ext/proc_macro_impl.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::panic; - use errors::FatalError; use syntax::source_map::Span; @@ -17,11 +5,13 @@ use syntax::ext::base::*; use syntax::tokenstream::TokenStream; use syntax::ext::base; -use proc_macro::TokenStream as TsShim; -use proc_macro::__internal; +pub const EXEC_STRATEGY: ::proc_macro::bridge::server::SameThread = + ::proc_macro::bridge::server::SameThread; pub struct AttrProcMacro { - pub inner: fn(TsShim, TsShim) -> TsShim, + pub client: ::proc_macro::bridge::client::Client< + fn(::proc_macro::TokenStream, ::proc_macro::TokenStream) -> ::proc_macro::TokenStream, + >, } impl base::AttrProcMacro for AttrProcMacro { @@ -31,22 +21,13 @@ impl base::AttrProcMacro for AttrProcMacro { annotation: TokenStream, annotated: TokenStream) -> TokenStream { - let annotation = __internal::token_stream_wrap(annotation); - let annotated = __internal::token_stream_wrap(annotated); - - let res = __internal::set_sess(ecx, || { - panic::catch_unwind(panic::AssertUnwindSafe(|| (self.inner)(annotation, annotated))) - }); - - match res { - Ok(stream) => __internal::token_stream_inner(stream), + let server = ::proc_macro_server::Rustc::new(ecx); + match self.client.run(&EXEC_STRATEGY, server, annotation, annotated) { + Ok(stream) => stream, Err(e) => { let msg = "custom attribute panicked"; let mut err = ecx.struct_span_fatal(span, msg); - if let Some(s) = e.downcast_ref::() { - err.help(&format!("message: {}", s)); - } - if let Some(s) = e.downcast_ref::<&'static str>() { + if let Some(s) = e.as_str() { err.help(&format!("message: {}", s)); } @@ -58,7 +39,9 @@ impl base::AttrProcMacro for AttrProcMacro { } pub struct BangProcMacro { - pub inner: fn(TsShim) -> TsShim, + pub client: ::proc_macro::bridge::client::Client< + fn(::proc_macro::TokenStream) -> ::proc_macro::TokenStream, + >, } impl base::ProcMacro for BangProcMacro { @@ -67,21 +50,13 @@ impl base::ProcMacro for BangProcMacro { span: Span, input: TokenStream) -> TokenStream { - let input = __internal::token_stream_wrap(input); - - let res = __internal::set_sess(ecx, || { - panic::catch_unwind(panic::AssertUnwindSafe(|| (self.inner)(input))) - }); - - match res { - Ok(stream) => __internal::token_stream_inner(stream), + let server = ::proc_macro_server::Rustc::new(ecx); + match self.client.run(&EXEC_STRATEGY, server, input) { + Ok(stream) => stream, Err(e) => { let msg = "proc macro panicked"; let mut err = ecx.struct_span_fatal(span, msg); - if let Some(s) = e.downcast_ref::() { - err.help(&format!("message: {}", s)); - } - if let Some(s) = e.downcast_ref::<&'static str>() { + if let Some(s) = e.as_str() { err.help(&format!("message: {}", s)); } diff --git a/src/libsyntax_ext/proc_macro_registrar.rs b/src/libsyntax_ext/proc_macro_registrar.rs deleted file mode 100644 index 65e175f95df..00000000000 --- a/src/libsyntax_ext/proc_macro_registrar.rs +++ /dev/null @@ -1,447 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::mem; - -use errors; - -use syntax::ast::{self, Ident}; -use syntax::attr; -use syntax::source_map::{ExpnInfo, MacroAttribute, hygiene, respan}; -use syntax::ext::base::ExtCtxt; -use syntax::ext::build::AstBuilder; -use syntax::ext::expand::ExpansionConfig; -use syntax::ext::hygiene::Mark; -use syntax::fold::Folder; -use syntax::parse::ParseSess; -use syntax::ptr::P; -use syntax::symbol::Symbol; -use syntax::symbol::keywords; -use syntax::visit::{self, Visitor}; - -use syntax_pos::{Span, DUMMY_SP}; - -use deriving; - -const PROC_MACRO_KINDS: [&'static str; 3] = - ["proc_macro_derive", "proc_macro_attribute", "proc_macro"]; - -struct ProcMacroDerive { - trait_name: ast::Name, - function_name: Ident, - span: Span, - attrs: Vec, -} - -struct ProcMacroDef { - function_name: Ident, - span: Span, -} - -struct CollectProcMacros<'a> { - derives: Vec, - attr_macros: Vec, - bang_macros: Vec, - in_root: bool, - handler: &'a errors::Handler, - is_proc_macro_crate: bool, - is_test_crate: bool, -} - -pub fn modify(sess: &ParseSess, - resolver: &mut dyn (::syntax::ext::base::Resolver), - mut krate: ast::Crate, - is_proc_macro_crate: bool, - is_test_crate: bool, - num_crate_types: usize, - handler: &errors::Handler) -> ast::Crate { - let ecfg = ExpansionConfig::default("proc_macro".to_string()); - let mut cx = ExtCtxt::new(sess, ecfg, resolver); - - let (derives, attr_macros, bang_macros) = { - let mut collect = CollectProcMacros { - derives: Vec::new(), - attr_macros: Vec::new(), - bang_macros: Vec::new(), - in_root: true, - handler, - is_proc_macro_crate, - is_test_crate, - }; - visit::walk_crate(&mut collect, &krate); - (collect.derives, collect.attr_macros, collect.bang_macros) - }; - - if !is_proc_macro_crate { - return krate - } - - if num_crate_types > 1 { - handler.err("cannot mix `proc-macro` crate type with others"); - } - - if is_test_crate { - return krate; - } - - krate.module.items.push(mk_registrar(&mut cx, &derives, &attr_macros, &bang_macros)); - - krate -} - -fn is_proc_macro_attr(attr: &ast::Attribute) -> bool { - PROC_MACRO_KINDS.iter().any(|kind| attr.check_name(kind)) -} - -impl<'a> CollectProcMacros<'a> { - fn check_not_pub_in_root(&self, vis: &ast::Visibility, sp: Span) { - if self.is_proc_macro_crate && self.in_root && vis.node.is_pub() { - self.handler.span_err(sp, - "`proc-macro` crate types cannot \ - export any items other than functions \ - tagged with `#[proc_macro_derive]` currently"); - } - } - - fn collect_custom_derive(&mut self, item: &'a ast::Item, attr: &'a ast::Attribute) { - // Once we've located the `#[proc_macro_derive]` attribute, verify - // that it's of the form `#[proc_macro_derive(Foo)]` or - // `#[proc_macro_derive(Foo, attributes(A, ..))]` - let list = match attr.meta_item_list() { - Some(list) => list, - None => { - self.handler.span_err(attr.span(), - "attribute must be of form: \ - #[proc_macro_derive(TraitName)]"); - return - } - }; - if list.len() != 1 && list.len() != 2 { - self.handler.span_err(attr.span(), - "attribute must have either one or two arguments"); - return - } - let trait_attr = &list[0]; - let attributes_attr = list.get(1); - let trait_name = match trait_attr.name() { - Some(name) => name, - _ => { - self.handler.span_err(trait_attr.span(), "not a meta item"); - return - } - }; - if !trait_attr.is_word() { - self.handler.span_err(trait_attr.span(), "must only be one word"); - } - - if deriving::is_builtin_trait(trait_name) { - self.handler.span_err(trait_attr.span(), - "cannot override a built-in #[derive] mode"); - } - - let proc_attrs: Vec<_> = if let Some(attr) = attributes_attr { - if !attr.check_name("attributes") { - self.handler.span_err(attr.span(), "second argument must be `attributes`") - } - attr.meta_item_list().unwrap_or_else(|| { - self.handler.span_err(attr.span(), - "attribute must be of form: \ - `attributes(foo, bar)`"); - &[] - }).into_iter().filter_map(|attr| { - let name = match attr.name() { - Some(name) => name, - _ => { - self.handler.span_err(attr.span(), "not a meta item"); - return None; - }, - }; - - if !attr.is_word() { - self.handler.span_err(attr.span(), "must only be one word"); - return None; - } - - Some(name) - }).collect() - } else { - Vec::new() - }; - - if self.in_root && item.vis.node.is_pub() { - self.derives.push(ProcMacroDerive { - span: item.span, - trait_name, - function_name: item.ident, - attrs: proc_attrs, - }); - } else { - let msg = if !self.in_root { - "functions tagged with `#[proc_macro_derive]` must \ - currently reside in the root of the crate" - } else { - "functions tagged with `#[proc_macro_derive]` must be `pub`" - }; - self.handler.span_err(item.span, msg); - } - } - - fn collect_attr_proc_macro(&mut self, item: &'a ast::Item, attr: &'a ast::Attribute) { - if !attr.is_word() { - self.handler.span_err(attr.span, "`#[proc_macro_attribute]` attribute \ - does not take any arguments"); - return; - } - - if self.in_root && item.vis.node.is_pub() { - self.attr_macros.push(ProcMacroDef { - span: item.span, - function_name: item.ident, - }); - } else { - let msg = if !self.in_root { - "functions tagged with `#[proc_macro_attribute]` must \ - currently reside in the root of the crate" - } else { - "functions tagged with `#[proc_macro_attribute]` must be `pub`" - }; - self.handler.span_err(item.span, msg); - } - } - - fn collect_bang_proc_macro(&mut self, item: &'a ast::Item, attr: &'a ast::Attribute) { - if !attr.is_word() { - self.handler.span_err(attr.span, "`#[proc_macro]` attribute \ - does not take any arguments"); - return; - } - - if self.in_root && item.vis.node.is_pub() { - self.bang_macros.push(ProcMacroDef { - span: item.span, - function_name: item.ident, - }); - } else { - let msg = if !self.in_root { - "functions tagged with `#[proc_macro]` must \ - currently reside in the root of the crate" - } else { - "functions tagged with `#[proc_macro]` must be `pub`" - }; - self.handler.span_err(item.span, msg); - } - } -} - -impl<'a> Visitor<'a> for CollectProcMacros<'a> { - fn visit_item(&mut self, item: &'a ast::Item) { - if let ast::ItemKind::MacroDef(..) = item.node { - if self.is_proc_macro_crate && attr::contains_name(&item.attrs, "macro_export") { - let msg = - "cannot export macro_rules! macros from a `proc-macro` crate type currently"; - self.handler.span_err(item.span, msg); - } - } - - // First up, make sure we're checking a bare function. If we're not then - // we're just not interested in this item. - // - // If we find one, try to locate a `#[proc_macro_derive]` attribute on - // it. - let is_fn = match item.node { - ast::ItemKind::Fn(..) => true, - _ => false, - }; - - let mut found_attr: Option<&'a ast::Attribute> = None; - - for attr in &item.attrs { - if is_proc_macro_attr(&attr) { - if let Some(prev_attr) = found_attr { - let msg = if attr.path.segments[0].ident.name == - prev_attr.path.segments[0].ident.name { - format!("Only one `#[{}]` attribute is allowed on any given function", - attr.path) - } else { - format!("`#[{}]` and `#[{}]` attributes cannot both be applied \ - to the same function", attr.path, prev_attr.path) - }; - - self.handler.struct_span_err(attr.span(), &msg) - .span_note(prev_attr.span(), "Previous attribute here") - .emit(); - - return; - } - - found_attr = Some(attr); - } - } - - let attr = match found_attr { - None => { - self.check_not_pub_in_root(&item.vis, item.span); - let prev_in_root = mem::replace(&mut self.in_root, false); - visit::walk_item(self, item); - self.in_root = prev_in_root; - return; - }, - Some(attr) => attr, - }; - - if !is_fn { - let msg = format!("the `#[{}]` attribute may only be used on bare functions", - attr.path); - - self.handler.span_err(attr.span(), &msg); - return; - } - - if self.is_test_crate { - return; - } - - if !self.is_proc_macro_crate { - let msg = format!("the `#[{}]` attribute is only usable with crates of the \ - `proc-macro` crate type", attr.path); - - self.handler.span_err(attr.span(), &msg); - return; - } - - if attr.check_name("proc_macro_derive") { - self.collect_custom_derive(item, attr); - } else if attr.check_name("proc_macro_attribute") { - self.collect_attr_proc_macro(item, attr); - } else if attr.check_name("proc_macro") { - self.collect_bang_proc_macro(item, attr); - }; - - let prev_in_root = mem::replace(&mut self.in_root, false); - visit::walk_item(self, item); - self.in_root = prev_in_root; - } - - fn visit_mac(&mut self, mac: &ast::Mac) { - visit::walk_mac(self, mac) - } -} - -// Creates a new module which looks like: -// -// mod $gensym { -// extern crate proc_macro; -// -// use proc_macro::__internal::Registry; -// -// #[plugin_registrar] -// fn registrar(registrar: &mut Registry) { -// registrar.register_custom_derive($name_trait1, ::$name1, &[]); -// registrar.register_custom_derive($name_trait2, ::$name2, &["attribute_name"]); -// // ... -// } -// } -fn mk_registrar(cx: &mut ExtCtxt, - custom_derives: &[ProcMacroDerive], - custom_attrs: &[ProcMacroDef], - custom_macros: &[ProcMacroDef]) -> P { - let mark = Mark::fresh(Mark::root()); - mark.set_expn_info(ExpnInfo { - call_site: DUMMY_SP, - def_site: None, - format: MacroAttribute(Symbol::intern("proc_macro")), - allow_internal_unstable: true, - allow_internal_unsafe: false, - local_inner_macros: false, - edition: hygiene::default_edition(), - }); - let span = DUMMY_SP.apply_mark(mark); - - let proc_macro = Ident::from_str("proc_macro"); - let krate = cx.item(span, - proc_macro, - Vec::new(), - ast::ItemKind::ExternCrate(None)); - - let __internal = Ident::from_str("__internal"); - let registry = Ident::from_str("Registry"); - let registrar = Ident::from_str("_registrar"); - let register_custom_derive = Ident::from_str("register_custom_derive"); - let register_attr_proc_macro = Ident::from_str("register_attr_proc_macro"); - let register_bang_proc_macro = Ident::from_str("register_bang_proc_macro"); - let crate_kw = Ident::with_empty_ctxt(keywords::Crate.name()); - let local_path = |cx: &mut ExtCtxt, sp: Span, name: Ident| { - cx.path(sp.with_ctxt(span.ctxt()), vec![crate_kw, name]) - }; - - let mut stmts = custom_derives.iter().map(|cd| { - let path = local_path(cx, cd.span, cd.function_name); - let trait_name = cx.expr_str(cd.span, cd.trait_name); - let attrs = cx.expr_vec_slice( - span, - cd.attrs.iter().map(|&s| cx.expr_str(cd.span, s)).collect::>() - ); - let registrar = cx.expr_ident(span, registrar); - let ufcs_path = cx.path(span, vec![proc_macro, __internal, registry, - register_custom_derive]); - - cx.stmt_expr(cx.expr_call(span, cx.expr_path(ufcs_path), - vec![registrar, trait_name, cx.expr_path(path), attrs])) - - }).collect::>(); - - stmts.extend(custom_attrs.iter().map(|ca| { - let name = cx.expr_str(ca.span, ca.function_name.name); - let path = local_path(cx, ca.span, ca.function_name); - let registrar = cx.expr_ident(ca.span, registrar); - - let ufcs_path = cx.path(span, - vec![proc_macro, __internal, registry, register_attr_proc_macro]); - - cx.stmt_expr(cx.expr_call(span, cx.expr_path(ufcs_path), - vec![registrar, name, cx.expr_path(path)])) - })); - - stmts.extend(custom_macros.iter().map(|cm| { - let name = cx.expr_str(cm.span, cm.function_name.name); - let path = local_path(cx, cm.span, cm.function_name); - let registrar = cx.expr_ident(cm.span, registrar); - - let ufcs_path = cx.path(span, - vec![proc_macro, __internal, registry, register_bang_proc_macro]); - - cx.stmt_expr(cx.expr_call(span, cx.expr_path(ufcs_path), - vec![registrar, name, cx.expr_path(path)])) - })); - - let path = cx.path(span, vec![proc_macro, __internal, registry]); - let registrar_path = cx.ty_path(path); - let arg_ty = cx.ty_rptr(span, registrar_path, None, ast::Mutability::Mutable); - let func = cx.item_fn(span, - registrar, - vec![cx.arg(span, registrar, arg_ty)], - cx.ty(span, ast::TyKind::Tup(Vec::new())), - cx.block(span, stmts)); - - let derive_registrar = cx.meta_word(span, Symbol::intern("rustc_derive_registrar")); - let derive_registrar = cx.attribute(span, derive_registrar); - let func = func.map(|mut i| { - i.attrs.push(derive_registrar); - i.vis = respan(span, ast::VisibilityKind::Public); - i - }); - let ident = ast::Ident::with_empty_ctxt(Symbol::gensym("registrar")); - let module = cx.item_mod(span, span, ident, Vec::new(), vec![krate, func]).map(|mut i| { - i.vis = respan(span, ast::VisibilityKind::Public); - i - }); - - cx.monotonic_expander().fold_item(module).pop().unwrap() -} diff --git a/src/libsyntax_ext/proc_macro_server.rs b/src/libsyntax_ext/proc_macro_server.rs new file mode 100644 index 00000000000..7de9b9343a8 --- /dev/null +++ b/src/libsyntax_ext/proc_macro_server.rs @@ -0,0 +1,746 @@ +use errors::{self, Diagnostic, DiagnosticBuilder}; +use std::panic; + +use proc_macro::bridge::{server, TokenTree}; +use proc_macro::{Delimiter, Level, LineColumn, Spacing}; + +use rustc_data_structures::sync::Lrc; +use std::ascii; +use std::ops::Bound; +use syntax::ast; +use syntax::ext::base::ExtCtxt; +use syntax::parse::lexer::comments; +use syntax::parse::{self, token, ParseSess}; +use syntax::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream, TreeAndJoint}; +use syntax_pos::hygiene::{SyntaxContext, Transparency}; +use syntax_pos::symbol::{keywords, Symbol}; +use syntax_pos::{BytePos, FileName, MultiSpan, Pos, SourceFile, Span}; + +trait FromInternal { + fn from_internal(x: T) -> Self; +} + +trait ToInternal { + fn to_internal(self) -> T; +} + +impl FromInternal for Delimiter { + fn from_internal(delim: token::DelimToken) -> Delimiter { + match delim { + token::Paren => Delimiter::Parenthesis, + token::Brace => Delimiter::Brace, + token::Bracket => Delimiter::Bracket, + token::NoDelim => Delimiter::None, + } + } +} + +impl ToInternal for Delimiter { + fn to_internal(self) -> token::DelimToken { + match self { + Delimiter::Parenthesis => token::Paren, + Delimiter::Brace => token::Brace, + Delimiter::Bracket => token::Bracket, + Delimiter::None => token::NoDelim, + } + } +} + +impl FromInternal<(TreeAndJoint, &'_ ParseSess, &'_ mut Vec)> + for TokenTree +{ + fn from_internal(((tree, is_joint), sess, stack): (TreeAndJoint, &ParseSess, &mut Vec)) + -> Self { + use syntax::parse::token::*; + + let joint = is_joint == Joint; + let (span, token) = match tree { + tokenstream::TokenTree::Delimited(span, delim, tts) => { + let delimiter = Delimiter::from_internal(delim); + return TokenTree::Group(Group { + delimiter, + stream: tts.into(), + span, + }); + } + tokenstream::TokenTree::Token(span, token) => (span, token), + }; + + macro_rules! tt { + ($ty:ident { $($field:ident $(: $value:expr)*),+ $(,)* }) => ( + TokenTree::$ty(self::$ty { + $($field $(: $value)*,)* + span, + }) + ); + ($ty:ident::$method:ident($($value:expr),*)) => ( + TokenTree::$ty(self::$ty::$method($($value,)* span)) + ); + } + macro_rules! op { + ($a:expr) => { + tt!(Punct::new($a, joint)) + }; + ($a:expr, $b:expr) => {{ + stack.push(tt!(Punct::new($b, joint))); + tt!(Punct::new($a, true)) + }}; + ($a:expr, $b:expr, $c:expr) => {{ + stack.push(tt!(Punct::new($c, joint))); + stack.push(tt!(Punct::new($b, true))); + tt!(Punct::new($a, true)) + }}; + } + + match token { + Eq => op!('='), + Lt => op!('<'), + Le => op!('<', '='), + EqEq => op!('=', '='), + Ne => op!('!', '='), + Ge => op!('>', '='), + Gt => op!('>'), + AndAnd => op!('&', '&'), + OrOr => op!('|', '|'), + Not => op!('!'), + Tilde => op!('~'), + BinOp(Plus) => op!('+'), + BinOp(Minus) => op!('-'), + BinOp(Star) => op!('*'), + BinOp(Slash) => op!('/'), + BinOp(Percent) => op!('%'), + BinOp(Caret) => op!('^'), + BinOp(And) => op!('&'), + BinOp(Or) => op!('|'), + BinOp(Shl) => op!('<', '<'), + BinOp(Shr) => op!('>', '>'), + BinOpEq(Plus) => op!('+', '='), + BinOpEq(Minus) => op!('-', '='), + BinOpEq(Star) => op!('*', '='), + BinOpEq(Slash) => op!('/', '='), + BinOpEq(Percent) => op!('%', '='), + BinOpEq(Caret) => op!('^', '='), + BinOpEq(And) => op!('&', '='), + BinOpEq(Or) => op!('|', '='), + BinOpEq(Shl) => op!('<', '<', '='), + BinOpEq(Shr) => op!('>', '>', '='), + At => op!('@'), + Dot => op!('.'), + DotDot => op!('.', '.'), + DotDotDot => op!('.', '.', '.'), + DotDotEq => op!('.', '.', '='), + Comma => op!(','), + Semi => op!(';'), + Colon => op!(':'), + ModSep => op!(':', ':'), + RArrow => op!('-', '>'), + LArrow => op!('<', '-'), + FatArrow => op!('=', '>'), + Pound => op!('#'), + Dollar => op!('$'), + Question => op!('?'), + SingleQuote => op!('\''), + + Ident(ident, false) if ident.name == keywords::DollarCrate.name() => + tt!(Ident::dollar_crate()), + Ident(ident, is_raw) => tt!(Ident::new(ident.name, is_raw)), + Lifetime(ident) => { + let ident = ident.without_first_quote(); + stack.push(tt!(Ident::new(ident.name, false))); + tt!(Punct::new('\'', true)) + } + Literal(lit, suffix) => tt!(Literal { lit, suffix }), + DocComment(c) => { + let style = comments::doc_comment_style(&c.as_str()); + let stripped = comments::strip_doc_comment_decoration(&c.as_str()); + let mut escaped = String::new(); + for ch in stripped.chars() { + escaped.extend(ch.escape_debug()); + } + let stream = vec![ + Ident(ast::Ident::new(Symbol::intern("doc"), span), false), + Eq, + Literal(Lit::Str_(Symbol::intern(&escaped)), None), + ] + .into_iter() + .map(|token| tokenstream::TokenTree::Token(span, token)) + .collect(); + stack.push(TokenTree::Group(Group { + delimiter: Delimiter::Bracket, + stream, + span: DelimSpan::from_single(span), + })); + if style == ast::AttrStyle::Inner { + stack.push(tt!(Punct::new('!', false))); + } + tt!(Punct::new('#', false)) + } + + Interpolated(_) => { + let stream = token.interpolated_to_tokenstream(sess, span); + TokenTree::Group(Group { + delimiter: Delimiter::None, + stream, + span: DelimSpan::from_single(span), + }) + } + + OpenDelim(..) | CloseDelim(..) => unreachable!(), + Whitespace | Comment | Shebang(..) | Eof => unreachable!(), + } + } +} + +impl ToInternal for TokenTree { + fn to_internal(self) -> TokenStream { + use syntax::parse::token::*; + + let (ch, joint, span) = match self { + TokenTree::Punct(Punct { ch, joint, span }) => (ch, joint, span), + TokenTree::Group(Group { + delimiter, + stream, + span, + }) => { + return tokenstream::TokenTree::Delimited( + span, + delimiter.to_internal(), + stream.into(), + ) + .into(); + } + TokenTree::Ident(self::Ident { sym, is_raw, span }) => { + let token = Ident(ast::Ident::new(sym, span), is_raw); + return tokenstream::TokenTree::Token(span, token).into(); + } + TokenTree::Literal(self::Literal { + lit: Lit::Integer(ref a), + suffix, + span, + }) if a.as_str().starts_with("-") => { + let minus = BinOp(BinOpToken::Minus); + let integer = Symbol::intern(&a.as_str()[1..]); + let integer = Literal(Lit::Integer(integer), suffix); + let a = tokenstream::TokenTree::Token(span, minus); + let b = tokenstream::TokenTree::Token(span, integer); + return vec![a, b].into_iter().collect(); + } + TokenTree::Literal(self::Literal { + lit: Lit::Float(ref a), + suffix, + span, + }) if a.as_str().starts_with("-") => { + let minus = BinOp(BinOpToken::Minus); + let float = Symbol::intern(&a.as_str()[1..]); + let float = Literal(Lit::Float(float), suffix); + let a = tokenstream::TokenTree::Token(span, minus); + let b = tokenstream::TokenTree::Token(span, float); + return vec![a, b].into_iter().collect(); + } + TokenTree::Literal(self::Literal { lit, suffix, span }) => { + return tokenstream::TokenTree::Token(span, Literal(lit, suffix)).into() + } + }; + + let token = match ch { + '=' => Eq, + '<' => Lt, + '>' => Gt, + '!' => Not, + '~' => Tilde, + '+' => BinOp(Plus), + '-' => BinOp(Minus), + '*' => BinOp(Star), + '/' => BinOp(Slash), + '%' => BinOp(Percent), + '^' => BinOp(Caret), + '&' => BinOp(And), + '|' => BinOp(Or), + '@' => At, + '.' => Dot, + ',' => Comma, + ';' => Semi, + ':' => Colon, + '#' => Pound, + '$' => Dollar, + '?' => Question, + '\'' => SingleQuote, + _ => unreachable!(), + }; + + let tree = tokenstream::TokenTree::Token(span, token); + TokenStream::new(vec![(tree, if joint { Joint } else { NonJoint })]) + } +} + +impl ToInternal for Level { + fn to_internal(self) -> errors::Level { + match self { + Level::Error => errors::Level::Error, + Level::Warning => errors::Level::Warning, + Level::Note => errors::Level::Note, + Level::Help => errors::Level::Help, + _ => unreachable!("unknown proc_macro::Level variant: {:?}", self), + } + } +} + +#[derive(Clone)] +pub struct TokenStreamIter { + cursor: tokenstream::Cursor, + stack: Vec>, +} + +#[derive(Clone)] +pub struct Group { + delimiter: Delimiter, + stream: TokenStream, + span: DelimSpan, +} + +#[derive(Copy, Clone, PartialEq, Eq, Hash)] +pub struct Punct { + ch: char, + // NB. not using `Spacing` here because it doesn't implement `Hash`. + joint: bool, + span: Span, +} + +impl Punct { + fn new(ch: char, joint: bool, span: Span) -> Punct { + const LEGAL_CHARS: &[char] = &['=', '<', '>', '!', '~', '+', '-', '*', '/', '%', '^', + '&', '|', '@', '.', ',', ';', ':', '#', '$', '?', '\'']; + if !LEGAL_CHARS.contains(&ch) { + panic!("unsupported character `{:?}`", ch) + } + Punct { ch, joint, span } + } +} + +#[derive(Copy, Clone, PartialEq, Eq, Hash)] +pub struct Ident { + sym: Symbol, + is_raw: bool, + span: Span, +} + +impl Ident { + fn is_valid(string: &str) -> bool { + let mut chars = string.chars(); + if let Some(start) = chars.next() { + (start == '_' || start.is_xid_start()) + && chars.all(|cont| cont == '_' || cont.is_xid_continue()) + } else { + false + } + } + fn new(sym: Symbol, is_raw: bool, span: Span) -> Ident { + let string = sym.as_str().get(); + if !Self::is_valid(string) { + panic!("`{:?}` is not a valid identifier", string) + } + if is_raw { + let normalized_sym = Symbol::intern(string); + if normalized_sym == keywords::Underscore.name() || + ast::Ident::with_empty_ctxt(normalized_sym).is_path_segment_keyword() { + panic!("`{:?}` is not a valid raw identifier", string) + } + } + Ident { sym, is_raw, span } + } + fn dollar_crate(span: Span) -> Ident { + // `$crate` is accepted as an ident only if it comes from the compiler. + Ident { sym: keywords::DollarCrate.name(), is_raw: false, span } + } +} + +// FIXME(eddyb) `Literal` should not expose internal `Debug` impls. +#[derive(Clone, Debug)] +pub struct Literal { + lit: token::Lit, + suffix: Option, + span: Span, +} + +pub(crate) struct Rustc<'a> { + sess: &'a ParseSess, + def_site: Span, + call_site: Span, +} + +impl<'a> Rustc<'a> { + pub fn new(cx: &'a ExtCtxt) -> Self { + // No way to determine def location for a proc macro right now, so use call location. + let location = cx.current_expansion.mark.expn_info().unwrap().call_site; + let to_span = |transparency| { + location.with_ctxt( + SyntaxContext::empty() + .apply_mark_with_transparency(cx.current_expansion.mark, transparency), + ) + }; + Rustc { + sess: cx.parse_sess, + def_site: to_span(Transparency::Opaque), + call_site: to_span(Transparency::Transparent), + } + } +} + +impl server::Types for Rustc<'_> { + type TokenStream = TokenStream; + type TokenStreamBuilder = tokenstream::TokenStreamBuilder; + type TokenStreamIter = TokenStreamIter; + type Group = Group; + type Punct = Punct; + type Ident = Ident; + type Literal = Literal; + type SourceFile = Lrc; + type MultiSpan = Vec; + type Diagnostic = Diagnostic; + type Span = Span; +} + +impl server::TokenStream for Rustc<'_> { + fn new(&mut self) -> Self::TokenStream { + TokenStream::empty() + } + fn is_empty(&mut self, stream: &Self::TokenStream) -> bool { + stream.is_empty() + } + fn from_str(&mut self, src: &str) -> Self::TokenStream { + parse::parse_stream_from_source_str( + FileName::proc_macro_source_code(src.clone()), + src.to_string(), + self.sess, + Some(self.call_site), + ) + } + fn to_string(&mut self, stream: &Self::TokenStream) -> String { + stream.to_string() + } + fn from_token_tree( + &mut self, + tree: TokenTree, + ) -> Self::TokenStream { + tree.to_internal() + } + fn into_iter(&mut self, stream: Self::TokenStream) -> Self::TokenStreamIter { + TokenStreamIter { + cursor: stream.trees(), + stack: vec![], + } + } +} + +impl server::TokenStreamBuilder for Rustc<'_> { + fn new(&mut self) -> Self::TokenStreamBuilder { + tokenstream::TokenStreamBuilder::new() + } + fn push(&mut self, builder: &mut Self::TokenStreamBuilder, stream: Self::TokenStream) { + builder.push(stream); + } + fn build(&mut self, builder: Self::TokenStreamBuilder) -> Self::TokenStream { + builder.build() + } +} + +impl server::TokenStreamIter for Rustc<'_> { + fn next( + &mut self, + iter: &mut Self::TokenStreamIter, + ) -> Option> { + loop { + let tree = iter.stack.pop().or_else(|| { + let next = iter.cursor.next_with_joint()?; + Some(TokenTree::from_internal((next, self.sess, &mut iter.stack))) + })?; + // HACK: The condition "dummy span + group with empty delimiter" represents an AST + // fragment approximately converted into a token stream. This may happen, for + // example, with inputs to proc macro attributes, including derives. Such "groups" + // need to flattened during iteration over stream's token trees. + // Eventually this needs to be removed in favor of keeping original token trees + // and not doing the roundtrip through AST. + if let TokenTree::Group(ref group) = tree { + if group.delimiter == Delimiter::None && group.span.entire().is_dummy() { + iter.cursor.append(group.stream.clone()); + continue; + } + } + return Some(tree); + } + } +} + +impl server::Group for Rustc<'_> { + fn new(&mut self, delimiter: Delimiter, stream: Self::TokenStream) -> Self::Group { + Group { + delimiter, + stream, + span: DelimSpan::from_single(server::Span::call_site(self)), + } + } + fn delimiter(&mut self, group: &Self::Group) -> Delimiter { + group.delimiter + } + fn stream(&mut self, group: &Self::Group) -> Self::TokenStream { + group.stream.clone() + } + fn span(&mut self, group: &Self::Group) -> Self::Span { + group.span.entire() + } + fn span_open(&mut self, group: &Self::Group) -> Self::Span { + group.span.open + } + fn span_close(&mut self, group: &Self::Group) -> Self::Span { + group.span.close + } + fn set_span(&mut self, group: &mut Self::Group, span: Self::Span) { + group.span = DelimSpan::from_single(span); + } +} + +impl server::Punct for Rustc<'_> { + fn new(&mut self, ch: char, spacing: Spacing) -> Self::Punct { + Punct::new(ch, spacing == Spacing::Joint, server::Span::call_site(self)) + } + fn as_char(&mut self, punct: Self::Punct) -> char { + punct.ch + } + fn spacing(&mut self, punct: Self::Punct) -> Spacing { + if punct.joint { + Spacing::Joint + } else { + Spacing::Alone + } + } + fn span(&mut self, punct: Self::Punct) -> Self::Span { + punct.span + } + fn with_span(&mut self, punct: Self::Punct, span: Self::Span) -> Self::Punct { + Punct { span, ..punct } + } +} + +impl server::Ident for Rustc<'_> { + fn new(&mut self, string: &str, span: Self::Span, is_raw: bool) -> Self::Ident { + Ident::new(Symbol::intern(string), is_raw, span) + } + fn span(&mut self, ident: Self::Ident) -> Self::Span { + ident.span + } + fn with_span(&mut self, ident: Self::Ident, span: Self::Span) -> Self::Ident { + Ident { span, ..ident } + } +} + +impl server::Literal for Rustc<'_> { + // FIXME(eddyb) `Literal` should not expose internal `Debug` impls. + fn debug(&mut self, literal: &Self::Literal) -> String { + format!("{:?}", literal) + } + fn integer(&mut self, n: &str) -> Self::Literal { + Literal { + lit: token::Lit::Integer(Symbol::intern(n)), + suffix: None, + span: server::Span::call_site(self), + } + } + fn typed_integer(&mut self, n: &str, kind: &str) -> Self::Literal { + Literal { + lit: token::Lit::Integer(Symbol::intern(n)), + suffix: Some(Symbol::intern(kind)), + span: server::Span::call_site(self), + } + } + fn float(&mut self, n: &str) -> Self::Literal { + Literal { + lit: token::Lit::Float(Symbol::intern(n)), + suffix: None, + span: server::Span::call_site(self), + } + } + fn f32(&mut self, n: &str) -> Self::Literal { + Literal { + lit: token::Lit::Float(Symbol::intern(n)), + suffix: Some(Symbol::intern("f32")), + span: server::Span::call_site(self), + } + } + fn f64(&mut self, n: &str) -> Self::Literal { + Literal { + lit: token::Lit::Float(Symbol::intern(n)), + suffix: Some(Symbol::intern("f64")), + span: server::Span::call_site(self), + } + } + fn string(&mut self, string: &str) -> Self::Literal { + let mut escaped = String::new(); + for ch in string.chars() { + escaped.extend(ch.escape_debug()); + } + Literal { + lit: token::Lit::Str_(Symbol::intern(&escaped)), + suffix: None, + span: server::Span::call_site(self), + } + } + fn character(&mut self, ch: char) -> Self::Literal { + let mut escaped = String::new(); + escaped.extend(ch.escape_unicode()); + Literal { + lit: token::Lit::Char(Symbol::intern(&escaped)), + suffix: None, + span: server::Span::call_site(self), + } + } + fn byte_string(&mut self, bytes: &[u8]) -> Self::Literal { + let string = bytes + .iter() + .cloned() + .flat_map(ascii::escape_default) + .map(Into::::into) + .collect::(); + Literal { + lit: token::Lit::ByteStr(Symbol::intern(&string)), + suffix: None, + span: server::Span::call_site(self), + } + } + fn span(&mut self, literal: &Self::Literal) -> Self::Span { + literal.span + } + fn set_span(&mut self, literal: &mut Self::Literal, span: Self::Span) { + literal.span = span; + } + fn subspan( + &mut self, + literal: &Self::Literal, + start: Bound, + end: Bound, + ) -> Option { + let span = literal.span; + let length = span.hi().to_usize() - span.lo().to_usize(); + + let start = match start { + Bound::Included(lo) => lo, + Bound::Excluded(lo) => lo + 1, + Bound::Unbounded => 0, + }; + + let end = match end { + Bound::Included(hi) => hi + 1, + Bound::Excluded(hi) => hi, + Bound::Unbounded => length, + }; + + // Bounds check the values, preventing addition overflow and OOB spans. + if start > u32::max_value() as usize + || end > u32::max_value() as usize + || (u32::max_value() - start as u32) < span.lo().to_u32() + || (u32::max_value() - end as u32) < span.lo().to_u32() + || start >= end + || end > length + { + return None; + } + + let new_lo = span.lo() + BytePos::from_usize(start); + let new_hi = span.lo() + BytePos::from_usize(end); + Some(span.with_lo(new_lo).with_hi(new_hi)) + } +} + +impl<'a> server::SourceFile for Rustc<'a> { + fn eq(&mut self, file1: &Self::SourceFile, file2: &Self::SourceFile) -> bool { + Lrc::ptr_eq(file1, file2) + } + fn path(&mut self, file: &Self::SourceFile) -> String { + match file.name { + FileName::Real(ref path) => path + .to_str() + .expect("non-UTF8 file path in `proc_macro::SourceFile::path`") + .to_string(), + _ => file.name.to_string(), + } + } + fn is_real(&mut self, file: &Self::SourceFile) -> bool { + file.is_real_file() + } +} + +impl server::MultiSpan for Rustc<'_> { + fn new(&mut self) -> Self::MultiSpan { + vec![] + } + fn push(&mut self, spans: &mut Self::MultiSpan, span: Self::Span) { + spans.push(span) + } +} + +impl server::Diagnostic for Rustc<'_> { + fn new(&mut self, level: Level, msg: &str, spans: Self::MultiSpan) -> Self::Diagnostic { + let mut diag = Diagnostic::new(level.to_internal(), msg); + diag.set_span(MultiSpan::from_spans(spans)); + diag + } + fn sub( + &mut self, + diag: &mut Self::Diagnostic, + level: Level, + msg: &str, + spans: Self::MultiSpan, + ) { + diag.sub(level.to_internal(), msg, MultiSpan::from_spans(spans), None); + } + fn emit(&mut self, diag: Self::Diagnostic) { + DiagnosticBuilder::new_diagnostic(&self.sess.span_diagnostic, diag).emit() + } +} + +impl server::Span for Rustc<'_> { + fn debug(&mut self, span: Self::Span) -> String { + format!("{:?} bytes({}..{})", span.ctxt(), span.lo().0, span.hi().0) + } + fn def_site(&mut self) -> Self::Span { + self.def_site + } + fn call_site(&mut self) -> Self::Span { + self.call_site + } + fn source_file(&mut self, span: Self::Span) -> Self::SourceFile { + self.sess.source_map().lookup_char_pos(span.lo()).file + } + fn parent(&mut self, span: Self::Span) -> Option { + span.ctxt().outer().expn_info().map(|i| i.call_site) + } + fn source(&mut self, span: Self::Span) -> Self::Span { + span.source_callsite() + } + fn start(&mut self, span: Self::Span) -> LineColumn { + let loc = self.sess.source_map().lookup_char_pos(span.lo()); + LineColumn { + line: loc.line, + column: loc.col.to_usize(), + } + } + fn end(&mut self, span: Self::Span) -> LineColumn { + let loc = self.sess.source_map().lookup_char_pos(span.hi()); + LineColumn { + line: loc.line, + column: loc.col.to_usize(), + } + } + fn join(&mut self, first: Self::Span, second: Self::Span) -> Option { + let self_loc = self.sess.source_map().lookup_char_pos(first.lo()); + let other_loc = self.sess.source_map().lookup_char_pos(second.lo()); + + if self_loc.file.name != other_loc.file.name { + return None; + } + + Some(first.to(second)) + } + fn resolved_at(&mut self, span: Self::Span, at: Self::Span) -> Self::Span { + span.with_ctxt(at.ctxt()) + } +} diff --git a/src/libsyntax_ext/test.rs b/src/libsyntax_ext/test.rs index b8a171b52ad..11c734b299c 100644 --- a/src/libsyntax_ext/test.rs +++ b/src/libsyntax_ext/test.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// The expansion from a test function to the appropriate test struct for libtest /// Ideally, this code would be in libtest but for efficiency and error messages it lives here. @@ -134,14 +124,14 @@ pub fn expand_test_or_bench( ]) }; - let mut test_const = cx.item(sp, item.ident.gensym(), + let mut test_const = cx.item(sp, ast::Ident::new(item.ident.name.gensymed(), sp), vec![ // #[cfg(test)] cx.attribute(attr_sp, cx.meta_list(attr_sp, Symbol::intern("cfg"), vec![ cx.meta_list_item_word(attr_sp, Symbol::intern("test")) ])), // #[rustc_test_marker] - cx.attribute(attr_sp, cx.meta_word(attr_sp, Symbol::intern("rustc_test_marker"))) + cx.attribute(attr_sp, cx.meta_word(attr_sp, Symbol::intern("rustc_test_marker"))), ], // const $ident: test::TestDescAndFn = ast::ItemKind::Const(cx.ty(sp, ast::TyKind::Path(None, test_path("TestDescAndFn"))), @@ -224,20 +214,8 @@ fn should_panic(cx: &ExtCtxt, i: &ast::Item) -> ShouldPanic { match attr::find_by_name(&i.attrs, "should_panic") { Some(attr) => { let ref sd = cx.parse_sess.span_diagnostic; - if attr.is_value_str() { - sd.struct_span_warn( - attr.span(), - "attribute must be of the form: \ - `#[should_panic]` or \ - `#[should_panic(expected = \"error message\")]`" - ).note("Errors in this attribute were erroneously allowed \ - and will become a hard error in a future release.") - .emit(); - return ShouldPanic::Yes(None); - } + match attr.meta_item_list() { - // Handle #[should_panic] - None => ShouldPanic::Yes(None), // Handle #[should_panic(expected = "foo")] Some(list) => { let msg = list.iter() @@ -257,6 +235,8 @@ fn should_panic(cx: &ExtCtxt, i: &ast::Item) -> ShouldPanic { ShouldPanic::Yes(msg) } }, + // Handle #[should_panic] and #[should_panic = "expected"] + None => ShouldPanic::Yes(attr.value_str()) } } None => ShouldPanic::No, @@ -318,7 +298,7 @@ fn has_test_signature(cx: &ExtCtxt, i: &ast::Item) -> bool { fn has_bench_signature(cx: &ExtCtxt, i: &ast::Item) -> bool { let has_sig = if let ast::ItemKind::Fn(ref decl, _, _, _) = i.node { - // NB: inadequate check, but we're running + // N.B., inadequate check, but we're running // well before resolve, can't get too deep. decl.inputs.len() == 1 } else { diff --git a/src/libsyntax_ext/test_case.rs b/src/libsyntax_ext/test_case.rs index 0128db7dd78..04e33671872 100644 --- a/src/libsyntax_ext/test_case.rs +++ b/src/libsyntax_ext/test_case.rs @@ -1,13 +1,5 @@ - -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // #[test_case] is used by custom test authors to mark tests // When building for test, it needs to make the item public and gensym the name @@ -39,8 +31,6 @@ pub fn expand( attr_sp, feature_gate::GateIssue::Language, feature_gate::EXPLAIN_CUSTOM_TEST_FRAMEWORKS); - - return vec![anno_item]; } if !ecx.ecfg.should_test { return vec![]; } diff --git a/src/libsyntax_ext/trace_macros.rs b/src/libsyntax_ext/trace_macros.rs index 256b525b8be..638d7b5568b 100644 --- a/src/libsyntax_ext/trace_macros.rs +++ b/src/libsyntax_ext/trace_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use syntax::ext::base::ExtCtxt; use syntax::ext::base; use syntax::feature_gate; @@ -25,7 +15,6 @@ pub fn expand_trace_macros(cx: &mut ExtCtxt, sp, feature_gate::GateIssue::Language, feature_gate::EXPLAIN_TRACE_MACROS); - return base::DummyResult::any(sp); } match (tt.len(), tt.first()) { @@ -38,5 +27,5 @@ pub fn expand_trace_macros(cx: &mut ExtCtxt, _ => cx.span_err(sp, "trace_macros! accepts only `true` or `false`"), } - base::DummyResult::any(sp) + base::DummyResult::any_valid(sp) } diff --git a/src/libsyntax_pos/analyze_source_file.rs b/src/libsyntax_pos/analyze_source_file.rs index 7bc9a1af62c..3abd260ac6f 100644 --- a/src/libsyntax_pos/analyze_source_file.rs +++ b/src/libsyntax_pos/analyze_source_file.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use unicode_width::UnicodeWidthChar; use super::*; @@ -47,8 +37,7 @@ pub fn analyze_source_file( } cfg_if! { - if #[cfg(all(any(target_arch = "x86", target_arch = "x86_64"), - not(stage0)))] { + if #[cfg(all(any(target_arch = "x86", target_arch = "x86_64")))] { fn analyze_source_file_dispatch(src: &str, source_file_start_pos: BytePos, lines: &mut Vec, diff --git a/src/libsyntax_pos/edition.rs b/src/libsyntax_pos/edition.rs index 5819cd7f480..f5a745a9cd5 100644 --- a/src/libsyntax_pos/edition.rs +++ b/src/libsyntax_pos/edition.rs @@ -1,19 +1,8 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; use std::str::FromStr; /// The edition of the compiler (RFC 2052) #[derive(Clone, Copy, Hash, PartialEq, PartialOrd, Debug, RustcEncodable, RustcDecodable, Eq)] -#[non_exhaustive] pub enum Edition { // editions must be kept in order, oldest to newest @@ -33,7 +22,7 @@ pub enum Edition { // must be in order from oldest to newest pub const ALL_EDITIONS: &[Edition] = &[Edition::Edition2015, Edition::Edition2018]; -pub const EDITION_NAME_LIST: &'static str = "2015|2018"; +pub const EDITION_NAME_LIST: &str = "2015|2018"; pub const DEFAULT_EDITION: Edition = Edition::Edition2015; diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs index bc52a3e1c7c..6e32a05dee3 100644 --- a/src/libsyntax_pos/hygiene.rs +++ b/src/libsyntax_pos/hygiene.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Machinery for hygienic macros, inspired by the `MTWT[1]` paper. //! //! `[1]` Matthew Flatt, Ryan Culpepper, David Darais, and Robert Bruce Findler. 2012. @@ -17,12 +7,12 @@ use GLOBALS; use Span; -use edition::Edition; -use symbol::Symbol; +use edition::{Edition, DEFAULT_EDITION}; +use symbol::{keywords, Symbol}; use serialize::{Encodable, Decodable, Encoder, Decoder}; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use std::fmt; +use std::{fmt, mem}; /// A SyntaxContext represents a chain of macro expansions (represented by marks). #[derive(Clone, Copy, PartialEq, Eq, Default, PartialOrd, Ord, Hash)] @@ -37,6 +27,8 @@ struct SyntaxContextData { opaque: SyntaxContext, // This context, but with all transparent marks filtered away. opaque_and_semitransparent: SyntaxContext, + // Name of the crate to which `$crate` with this context would resolve. + dollar_crate_name: Symbol, } /// A mark is a unique id associated with a macro expansion. @@ -47,7 +39,6 @@ pub struct Mark(u32); struct MarkData { parent: Mark, default_transparency: Transparency, - is_builtin: bool, expn_info: Option, } @@ -77,7 +68,6 @@ impl Mark { parent, // By default expansions behave like `macro_rules`. default_transparency: Transparency::SemiTransparent, - is_builtin: false, expn_info: None, }); Mark(data.marks.len() as u32 - 1) @@ -121,18 +111,6 @@ impl Mark { HygieneData::with(|data| data.marks[self.0 as usize].default_transparency = transparency) } - #[inline] - pub fn is_builtin(self) -> bool { - assert_ne!(self, Mark::root()); - HygieneData::with(|data| data.marks[self.0 as usize].is_builtin) - } - - #[inline] - pub fn set_is_builtin(self, is_builtin: bool) { - assert_ne!(self, Mark::root()); - HygieneData::with(|data| data.marks[self.0 as usize].is_builtin = is_builtin) - } - pub fn is_descendant_of(mut self, ancestor: Mark) -> bool { HygieneData::with(|data| { while self != ancestor { @@ -206,7 +184,6 @@ impl HygieneData { // If the root is opaque, then loops searching for an opaque mark // will automatically stop after reaching it. default_transparency: Transparency::Opaque, - is_builtin: true, expn_info: None, }], syntax_contexts: vec![SyntaxContextData { @@ -215,9 +192,10 @@ impl HygieneData { prev_ctxt: SyntaxContext(0), opaque: SyntaxContext(0), opaque_and_semitransparent: SyntaxContext(0), + dollar_crate_name: keywords::DollarCrate.name(), }], markings: FxHashMap::default(), - default_edition: Edition::Edition2015, + default_edition: DEFAULT_EDITION, } } @@ -262,7 +240,6 @@ impl SyntaxContext { data.marks.push(MarkData { parent: Mark::root(), default_transparency: Transparency::SemiTransparent, - is_builtin: false, expn_info: Some(expansion_info), }); @@ -274,6 +251,7 @@ impl SyntaxContext { prev_ctxt: SyntaxContext::empty(), opaque: SyntaxContext::empty(), opaque_and_semitransparent: SyntaxContext::empty(), + dollar_crate_name: keywords::DollarCrate.name(), }); SyntaxContext(data.syntax_contexts.len() as u32 - 1) }) @@ -308,11 +286,11 @@ impl SyntaxContext { } // Otherwise, `mark` is a macros 1.0 definition and the call site is in a - // macros 2.0 expansion, i.e. a macros 1.0 invocation is in a macros 2.0 definition. + // macros 2.0 expansion, i.e., a macros 1.0 invocation is in a macros 2.0 definition. // // In this case, the tokens from the macros 1.0 definition inherit the hygiene // at their invocation. That is, we pretend that the macros 1.0 definition - // was defined at its invocation (i.e. inside the macros 2.0 definition) + // was defined at its invocation (i.e., inside the macros 2.0 definition) // so that the macros 2.0 definition remains hygienic. // // See the example at `test/run-pass/hygiene/legacy_interaction.rs`. @@ -340,6 +318,7 @@ impl SyntaxContext { prev_ctxt, opaque: new_opaque, opaque_and_semitransparent: new_opaque, + dollar_crate_name: keywords::DollarCrate.name(), }); new_opaque }); @@ -357,6 +336,7 @@ impl SyntaxContext { prev_ctxt, opaque, opaque_and_semitransparent: new_opaque_and_semitransparent, + dollar_crate_name: keywords::DollarCrate.name(), }); new_opaque_and_semitransparent }); @@ -372,6 +352,7 @@ impl SyntaxContext { prev_ctxt, opaque, opaque_and_semitransparent, + dollar_crate_name: keywords::DollarCrate.name(), }); new_opaque_and_semitransparent_and_transparent }) @@ -438,7 +419,7 @@ impl SyntaxContext { /// } /// ``` /// This returns the expansion whose definition scope we use to privacy check the resolution, - /// or `None` if we privacy check as usual (i.e. not w.r.t. a macro definition scope). + /// or `None` if we privacy check as usual (i.e., not w.r.t. a macro definition scope). pub fn adjust(&mut self, expansion: Mark) -> Option { let mut scope = None; while !expansion.is_descendant_of(self.outer()) { @@ -526,6 +507,21 @@ impl SyntaxContext { pub fn outer(self) -> Mark { HygieneData::with(|data| data.syntax_contexts[self.0 as usize].outer_mark) } + + pub fn dollar_crate_name(self) -> Symbol { + HygieneData::with(|data| data.syntax_contexts[self.0 as usize].dollar_crate_name) + } + + pub fn set_dollar_crate_name(self, dollar_crate_name: Symbol) { + HygieneData::with(|data| { + let prev_dollar_crate_name = mem::replace( + &mut data.syntax_contexts[self.0 as usize].dollar_crate_name, dollar_crate_name + ); + assert!(dollar_crate_name == prev_dollar_crate_name || + prev_dollar_crate_name == keywords::DollarCrate.name(), + "$crate name is reset for a syntax context"); + }) + } } impl fmt::Debug for SyntaxContext { @@ -540,7 +536,7 @@ pub struct ExpnInfo { /// The location of the actual macro invocation or syntax sugar , e.g. /// `let x = foo!();` or `if let Some(y) = x {}` /// - /// This may recursively refer to other macro invocations, e.g. if + /// This may recursively refer to other macro invocations, e.g., if /// `foo!()` invoked `bar!()` internally, and there was an /// expression inside `bar!`; the call_site of the expression in /// the expansion would point to the `bar!` invocation; that @@ -548,7 +544,7 @@ pub struct ExpnInfo { /// pointing to the `foo!` invocation. pub call_site: Span, /// The span of the macro definition itself. The macro may not - /// have a sensible definition span (e.g. something defined + /// have a sensible definition span (e.g., something defined /// completely inside libsyntax) in which case this is None. /// This span serves only informational purpose and is not used for resolution. pub def_site: Option, @@ -571,9 +567,9 @@ pub struct ExpnInfo { /// The source of expansion. #[derive(Clone, Hash, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)] pub enum ExpnFormat { - /// e.g. #[derive(...)] + /// e.g., #[derive(...)] MacroAttribute(Symbol), - /// e.g. `format!()` + /// e.g., `format!()` MacroBang(Symbol), /// Desugaring done by the compiler during HIR lowering. CompilerDesugaring(CompilerDesugaringKind) diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index a780a38ff96..2a857792396 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -1,16 +1,6 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! The source positions and related helper functions +//! The source positions and related helper functions. //! -//! # Note +//! ## Note //! //! This API is completely unstable and subject to change. @@ -24,21 +14,13 @@ #![feature(nll)] #![feature(non_exhaustive)] #![feature(optin_builtin_traits)] +#![feature(rustc_attrs)] #![feature(specialization)] +#![feature(step_trait)] #![cfg_attr(not(stage0), feature(stdsimd))] -use std::borrow::Cow; -use std::cell::Cell; -use std::cmp::{self, Ordering}; -use std::fmt; -use std::hash::{Hasher, Hash}; -use std::ops::{Add, Sub}; -use std::path::PathBuf; - -use rustc_data_structures::stable_hasher::StableHasher; -use rustc_data_structures::sync::{Lrc, Lock}; - extern crate arena; +#[macro_use] extern crate rustc_data_structures; #[macro_use] @@ -65,6 +47,17 @@ pub mod symbol; mod analyze_source_file; +use rustc_data_structures::stable_hasher::StableHasher; +use rustc_data_structures::sync::{Lrc, Lock}; + +use std::borrow::Cow; +use std::cell::Cell; +use std::cmp::{self, Ordering}; +use std::fmt; +use std::hash::{Hasher, Hash}; +use std::ops::{Add, Sub}; +use std::path::PathBuf; + pub struct Globals { symbol_interner: Lock, span_interner: Lock, @@ -83,26 +76,27 @@ impl Globals { scoped_thread_local!(pub static GLOBALS: Globals); -/// Differentiates between real files and common virtual files +/// Differentiates between real files and common virtual files. #[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash, RustcDecodable, RustcEncodable)] pub enum FileName { Real(PathBuf), /// A macro. This includes the full name of the macro, so that there are no clashes. Macros(String), - /// call to `quote!` - QuoteExpansion, - /// Command line - Anon, - /// Hack in src/libsyntax/parse.rs - /// FIXME(jseyfried) - MacroExpansion, - ProcMacroSourceCode, - /// Strings provided as --cfg [cfgspec] stored in a crate_cfg - CfgSpec, - /// Strings provided as crate attributes in the CLI - CliCrateAttr, - /// Custom sources for explicit parser calls from plugins and drivers + /// Call to `quote!`. + QuoteExpansion(u64), + /// Command line. + Anon(u64), + /// Hack in `src/libsyntax/parse.rs`. + // FIXME(jseyfried) + MacroExpansion(u64), + ProcMacroSourceCode(u64), + /// Strings provided as `--cfg [cfgspec]` stored in a `crate_cfg`. + CfgSpec(u64), + /// Strings provided as crate attributes in the CLI. + CliCrateAttr(u64), + /// Custom sources for explicit parser calls from plugins and drivers. Custom(String), + DocTest(PathBuf, isize), } impl std::fmt::Display for FileName { @@ -111,13 +105,15 @@ impl std::fmt::Display for FileName { match *self { Real(ref path) => write!(fmt, "{}", path.display()), Macros(ref name) => write!(fmt, "<{} macros>", name), - QuoteExpansion => write!(fmt, ""), - MacroExpansion => write!(fmt, ""), - Anon => write!(fmt, ""), - ProcMacroSourceCode => write!(fmt, ""), - CfgSpec => write!(fmt, "cfgspec"), - CliCrateAttr => write!(fmt, ""), + QuoteExpansion(_) => write!(fmt, ""), + MacroExpansion(_) => write!(fmt, ""), + Anon(_) => write!(fmt, ""), + ProcMacroSourceCode(_) => + write!(fmt, ""), + CfgSpec(_) => write!(fmt, ""), + CliCrateAttr(_) => write!(fmt, ""), Custom(ref s) => write!(fmt, "<{}>", s), + DocTest(ref path, _) => write!(fmt, "{}", path.display()), } } } @@ -135,13 +131,14 @@ impl FileName { match *self { Real(_) => true, Macros(_) | - Anon | - MacroExpansion | - ProcMacroSourceCode | - CfgSpec | - CliCrateAttr | + Anon(_) | + MacroExpansion(_) | + ProcMacroSourceCode(_) | + CfgSpec(_) | + CliCrateAttr(_) | Custom(_) | - QuoteExpansion => false, + QuoteExpansion(_) | + DocTest(_, _) => false, } } @@ -149,25 +146,66 @@ impl FileName { use self::FileName::*; match *self { Real(_) | - Anon | - MacroExpansion | - ProcMacroSourceCode | - CfgSpec | - CliCrateAttr | + Anon(_) | + MacroExpansion(_) | + ProcMacroSourceCode(_) | + CfgSpec(_) | + CliCrateAttr(_) | Custom(_) | - QuoteExpansion => false, + QuoteExpansion(_) | + DocTest(_, _) => false, Macros(_) => true, } } + + pub fn quote_expansion_source_code(src: &str) -> FileName { + let mut hasher = StableHasher::new(); + src.hash(&mut hasher); + FileName::QuoteExpansion(hasher.finish()) + } + + pub fn macro_expansion_source_code(src: &str) -> FileName { + let mut hasher = StableHasher::new(); + src.hash(&mut hasher); + FileName::MacroExpansion(hasher.finish()) + } + + pub fn anon_source_code(src: &str) -> FileName { + let mut hasher = StableHasher::new(); + src.hash(&mut hasher); + FileName::Anon(hasher.finish()) + } + + pub fn proc_macro_source_code(src: &str) -> FileName { + let mut hasher = StableHasher::new(); + src.hash(&mut hasher); + FileName::ProcMacroSourceCode(hasher.finish()) + } + + pub fn cfg_spec_source_code(src: &str) -> FileName { + let mut hasher = StableHasher::new(); + src.hash(&mut hasher); + FileName::QuoteExpansion(hasher.finish()) + } + + pub fn cli_crate_attr_source_code(src: &str) -> FileName { + let mut hasher = StableHasher::new(); + src.hash(&mut hasher); + FileName::CliCrateAttr(hasher.finish()) + } + + pub fn doc_test_source_code(path: PathBuf, line: isize) -> FileName{ + FileName::DocTest(path, line) + } } /// Spans represent a region of code, used for error reporting. Positions in spans /// are *absolute* positions from the beginning of the source_map, not positions -/// relative to SourceFiles. Methods on the SourceMap can be used to relate spans back +/// relative to `SourceFile`s. Methods on the `SourceMap` can be used to relate spans back /// to the original source. /// You must be careful if the span crosses more than one file - you will not be /// able to use many of the functions on spans in source_map and you cannot assume -/// that the length of the span = hi - lo; there may be space in the BytePos +/// that the length of the `span = hi - lo`; there may be space in the `BytePos` /// range between files. /// /// `SpanData` is public because `Span` uses a thread-local interner and can't be @@ -198,11 +236,11 @@ impl SpanData { } // The interner is pointed to by a thread local value which is only set on the main thread -// with parallelization is disabled. So we don't allow Span to transfer between threads +// with parallelization is disabled. So we don't allow `Span` to transfer between threads // to avoid panics and other errors, even though it would be memory safe to do so. -#[cfg(not(parallel_queries))] +#[cfg(not(parallel_compiler))] impl !Send for Span {} -#[cfg(not(parallel_queries))] +#[cfg(not(parallel_compiler))] impl !Sync for Span {} impl PartialOrd for Span { @@ -218,9 +256,9 @@ impl Ord for Span { /// A collection of spans. Spans have two orthogonal attributes: /// -/// - they can be *primary spans*. In this case they are the locus of +/// - They can be *primary spans*. In this case they are the locus of /// the error, and would be rendered with `^^^`. -/// - they can have a *label*. In this case, the label is written next +/// - They can have a *label*. In this case, the label is written next /// to the mark in the snippet when we render. #[derive(Clone, Debug, Hash, PartialEq, Eq, RustcEncodable, RustcDecodable)] pub struct MultiSpan { @@ -267,7 +305,7 @@ impl Span { let span = self.data(); span.with_hi(span.lo) } - /// Returns a new span representing an empty span at the end of this span + /// Returns a new span representing an empty span at the end of this span. #[inline] pub fn shrink_to_hi(self) -> Span { let span = self.data(); @@ -279,13 +317,20 @@ impl Span { if self.is_dummy() { other } else { self } } - /// Return true if `self` fully encloses `other`. + /// Return `true` if `self` fully encloses `other`. pub fn contains(self, other: Span) -> bool { let span = self.data(); let other = other.data(); span.lo <= other.lo && other.hi <= span.hi } + /// Return `true` if `self` touches `other`. + pub fn overlaps(self, other: Span) -> bool { + let span = self.data(); + let other = other.data(); + span.lo < other.hi && other.lo < span.hi + } + /// Return true if the spans are equal with regards to the source text. /// /// Use this instead of `==` when either span could be generated code, @@ -296,7 +341,7 @@ impl Span { span.lo == other.lo && span.hi == other.hi } - /// Returns `Some(span)`, where the start is trimmed by the end of `other` + /// Returns `Some(span)`, where the start is trimmed by the end of `other`. pub fn trim_start(self, other: Span) -> Option { let span = self.data(); let other = other.data(); @@ -307,14 +352,14 @@ impl Span { } } - /// Return the source span - this is either the supplied span, or the span for + /// Return the source span -- this is either the supplied span, or the span for /// the macro callsite that expanded to it. pub fn source_callsite(self) -> Span { self.ctxt().outer().expn_info().map(|info| info.call_site.source_callsite()).unwrap_or(self) } /// The `Span` for the tokens in the previous macro expansion from which `self` was generated, - /// if any + /// if any. pub fn parent(self) -> Option { self.ctxt().outer().expn_info().map(|i| i.call_site) } @@ -325,6 +370,16 @@ impl Span { |einfo| einfo.edition) } + #[inline] + pub fn rust_2015(&self) -> bool { + self.edition() == edition::Edition::Edition2015 + } + + #[inline] + pub fn rust_2018(&self) -> bool { + self.edition() >= edition::Edition::Edition2018 + } + /// Return the source callee. /// /// Returns `None` if the supplied span has no expansion trace, @@ -340,7 +395,7 @@ impl Span { self.ctxt().outer().expn_info().map(source_callee) } - /// Check if a span is "internal" to a macro in which #[unstable] + /// Check if a span is "internal" to a macro in which `#[unstable]` /// items can be used (that is, a macro marked with /// `#[allow_internal_unstable]`). pub fn allows_unstable(&self) -> bool { @@ -361,7 +416,7 @@ impl Span { } } - /// Return the compiler desugaring that created this span, or None + /// Return the compiler desugaring that created this span, or `None` /// if this span is not from a desugaring. pub fn compiler_desugaring_kind(&self) -> Option { match self.ctxt().outer().expn_info() { @@ -387,7 +442,7 @@ impl Span { let mut prev_span = DUMMY_SP; let mut result = vec![]; while let Some(info) = self.ctxt().outer().expn_info() { - // Don't print recursive invocations + // Don't print recursive invocations. if !info.call_site.source_equal(&prev_span) { let (pre, post) = match info.format { ExpnFormat::MacroAttribute(..) => ("#[", "]"), @@ -411,7 +466,7 @@ impl Span { pub fn to(self, end: Span) -> Span { let span_data = self.data(); let end_data = end.data(); - // FIXME(jseyfried): self.ctxt should always equal end.ctxt here (c.f. issue #23480) + // FIXME(jseyfried): `self.ctxt` should always equal `end.ctxt` here (cf. issue #23480). // Return the macro span on its own to avoid weird diagnostic output. It is preferable to // have an incomplete span than a completely nonsensical one. if span_data.ctxt != end_data.ctxt { @@ -420,8 +475,8 @@ impl Span { } else if end_data.ctxt == SyntaxContext::empty() { return self; } - // both span fall within a macro - // FIXME(estebank) check if it is the *same* macro + // Both spans fall within a macro. + // FIXME(estebank): check if it is the *same* macro. } Span::new( cmp::min(span_data.lo, end_data.lo), @@ -556,7 +611,7 @@ impl serialize::UseSpecializedDecodable for Span { } } -fn default_span_debug(span: Span, f: &mut fmt::Formatter) -> fmt::Result { +pub fn default_span_debug(span: Span, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Span") .field("lo", &span.lo()) .field("hi", &span.hi()) @@ -577,6 +632,7 @@ impl fmt::Debug for SpanData { } impl MultiSpan { + #[inline] pub fn new() -> MultiSpan { MultiSpan { primary_spans: vec![], @@ -602,7 +658,7 @@ impl MultiSpan { self.span_labels.push((span, label)); } - /// Selects the first primary span (if any) + /// Selects the first primary span (if any). pub fn primary_span(&self) -> Option { self.primary_spans.first().cloned() } @@ -612,6 +668,11 @@ impl MultiSpan { &self.primary_spans } + /// Returns whether any of the primary spans is displayable. + pub fn has_primary_spans(&self) -> bool { + self.primary_spans.iter().any(|sp| !sp.is_dummy()) + } + /// Returns `true` if this contains only a dummy primary span with any hygienic context. pub fn is_dummy(&self) -> bool { let mut is_dummy = true; @@ -623,7 +684,7 @@ impl MultiSpan { is_dummy } - /// Replaces all occurrences of one Span with another. Used to move Spans in areas that don't + /// Replaces all occurrences of one Span with another. Used to move `Span`s in areas that don't /// display well (like std macros). Returns true if replacements occurred. pub fn replace(&mut self, before: Span, after: Span) -> bool { let mut replacements_occurred = false; @@ -644,7 +705,7 @@ impl MultiSpan { /// Returns the strings to highlight. We always ensure that there /// is an entry for each of the primary spans -- for each primary - /// span P, if there is at least one label with span P, we return + /// span `P`, if there is at least one label with span `P`, we return /// those labels (marked as primary). But otherwise we return /// `SpanLabel` instances with empty labels. pub fn span_labels(&self) -> Vec { @@ -670,6 +731,11 @@ impl MultiSpan { span_labels } + + /// Returns whether any of the span labels is displayable. + pub fn has_span_labels(&self) -> bool { + self.span_labels.iter().any(|(sp, _)| !sp.is_dummy()) + } } impl From for MultiSpan { @@ -686,23 +752,23 @@ impl From> for MultiSpan { pub const NO_EXPANSION: SyntaxContext = SyntaxContext::empty(); -/// Identifies an offset of a multi-byte character in a SourceFile +/// Identifies an offset of a multi-byte character in a `SourceFile`. #[derive(Copy, Clone, RustcEncodable, RustcDecodable, Eq, PartialEq, Debug)] pub struct MultiByteChar { - /// The absolute offset of the character in the SourceMap + /// The absolute offset of the character in the `SourceMap`. pub pos: BytePos, - /// The number of bytes, >=2 + /// The number of bytes, `>= 2`. pub bytes: u8, } -/// Identifies an offset of a non-narrow character in a SourceFile +/// Identifies an offset of a non-narrow character in a `SourceFile`. #[derive(Copy, Clone, RustcEncodable, RustcDecodable, Eq, PartialEq, Debug)] pub enum NonNarrowChar { - /// Represents a zero-width character + /// Represents a zero-width character. ZeroWidth(BytePos), - /// Represents a wide (fullwidth) character + /// Represents a wide (full-width) character. Wide(BytePos), - /// Represents a tab character, represented visually with a width of 4 characters + /// Represents a tab character, represented visually with a width of 4 characters. Tab(BytePos), } @@ -716,7 +782,7 @@ impl NonNarrowChar { } } - /// Returns the absolute offset of the character in the SourceMap + /// Returns the absolute offset of the character in the `SourceMap`. pub fn pos(&self) -> BytePos { match *self { NonNarrowChar::ZeroWidth(p) | @@ -725,7 +791,7 @@ impl NonNarrowChar { } } - /// Returns the width of the character, 0 (zero-width) or 2 (wide) + /// Returns the width of the character, 0 (zero-width) or 2 (wide). pub fn width(&self) -> usize { match *self { NonNarrowChar::ZeroWidth(_) => 0, @@ -759,7 +825,7 @@ impl Sub for NonNarrowChar { } } -/// The state of the lazy external source loading mechanism of a SourceFile. +/// The state of the lazy external source loading mechanism of a `SourceFile`. #[derive(PartialEq, Eq, Clone)] pub enum ExternalSource { /// The external source has been loaded already. @@ -768,7 +834,7 @@ pub enum ExternalSource { AbsentOk, /// A failed attempt has been made to load the external source. AbsentErr, - /// No external source has to be loaded, since the SourceFile represents a local crate. + /// No external source has to be loaded, since the `SourceFile` represents a local crate. Unneeded, } @@ -788,38 +854,38 @@ impl ExternalSource { } } -/// A single source in the SourceMap. +/// A single source in the `SourceMap`. #[derive(Clone)] pub struct SourceFile { /// The name of the file that the source came from, source that doesn't - /// originate from files has names between angle brackets by convention, - /// e.g. `` + /// originate from files has names between angle brackets by convention + /// (e.g., ``). pub name: FileName, - /// True if the `name` field above has been modified by --remap-path-prefix + /// True if the `name` field above has been modified by `--remap-path-prefix`. pub name_was_remapped: bool, /// The unmapped path of the file that the source came from. - /// Set to `None` if the SourceFile was imported from an external crate. + /// Set to `None` if the `SourceFile` was imported from an external crate. pub unmapped_path: Option, - /// Indicates which crate this SourceFile was imported from. + /// Indicates which crate this `SourceFile` was imported from. pub crate_of_origin: u32, - /// The complete source code + /// The complete source code. pub src: Option>, - /// The source code's hash + /// The source code's hash. pub src_hash: u128, /// The external source code (used for external crates, which will have a `None` /// value as `self.src`. pub external_src: Lock, - /// The start position of this source in the SourceMap + /// The start position of this source in the `SourceMap`. pub start_pos: BytePos, - /// The end position of this source in the SourceMap + /// The end position of this source in the `SourceMap`. pub end_pos: BytePos, - /// Locations of lines beginnings in the source code + /// Locations of lines beginnings in the source code. pub lines: Vec, - /// Locations of multi-byte characters in the source code + /// Locations of multi-byte characters in the source code. pub multibyte_chars: Vec, - /// Width of characters that are not narrow in the source code + /// Width of characters that are not narrow in the source code. pub non_narrow_chars: Vec, - /// A hash of the filename, used for speeding up the incr. comp. hashing. + /// A hash of the filename, used for speeding up hashing in incremental compilation. pub name_hash: u128, } @@ -833,7 +899,7 @@ impl Encodable for SourceFile { s.emit_struct_field("end_pos", 5, |s| self.end_pos.encode(s))?; s.emit_struct_field("lines", 6, |s| { let lines = &self.lines[..]; - // store the length + // Store the length. s.emit_u32(lines.len() as u32)?; if !lines.is_empty() { @@ -1004,7 +1070,7 @@ impl SourceFile { } } - /// Return the BytePos of the beginning of the current line. + /// Return the `BytePos` of the beginning of the current line. pub fn line_begin_pos(&self, pos: BytePos) -> BytePos { let line_index = self.lookup_line(pos).unwrap(); self.lines[line_index] @@ -1092,9 +1158,9 @@ impl SourceFile { } /// Find the line containing the given position. The return value is the - /// index into the `lines` array of this SourceFile, not the 1-based line + /// index into the `lines` array of this `SourceFile`, not the 1-based line /// number. If the source_file is empty or the position is located before the - /// first line, None is returned. + /// first line, `None` is returned. pub fn lookup_line(&self, pos: BytePos) -> Option { if self.lines.len() == 0 { return None; @@ -1151,14 +1217,14 @@ pub trait Pos { #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)] pub struct BytePos(pub u32); -/// A character offset. Because of multibyte utf8 characters, a byte offset -/// is not equivalent to a character offset. The SourceMap will convert BytePos -/// values to CharPos values as necessary. +/// A character offset. Because of multibyte UTF-8 characters, a byte offset +/// is not equivalent to a character offset. The `SourceMap` will convert `BytePos` +/// values to `CharPos` values as necessary. #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)] pub struct CharPos(pub usize); -// FIXME: Lots of boilerplate in these impls, but so far my attempts to fix -// have been unsuccessful +// FIXME: lots of boilerplate in these impls, but so far my attempts to fix +// have been unsuccessful. impl Pos for BytePos { #[inline(always)] @@ -1240,20 +1306,20 @@ impl Sub for CharPos { // Loc, LocWithOpt, SourceFileAndLine, SourceFileAndBytePos // -/// A source code location used for error reporting +/// A source code location used for error reporting. #[derive(Debug, Clone)] pub struct Loc { - /// Information about the original source + /// Information about the original source. pub file: Lrc, - /// The (1-based) line number + /// The (1-based) line number. pub line: usize, - /// The (0-based) column offset + /// The (0-based) column offset. pub col: CharPos, - /// The (0-based) column offset when displayed + /// The (0-based) column offset when displayed. pub col_display: usize, } -/// A source code location used as the result of lookup_char_pos_adj +/// A source code location used as the result of `lookup_char_pos_adj`. // Actually, *none* of the clients use the filename *or* file field; // perhaps they should just be removed. #[derive(Debug)] @@ -1264,7 +1330,7 @@ pub struct LocWithOpt { pub file: Option>, } -// used to be structural records. Better names, anyone? +// Used to be structural records. #[derive(Debug)] pub struct SourceFileAndLine { pub sf: Lrc, pub line: usize } #[derive(Debug)] diff --git a/src/libsyntax_pos/span_encoding.rs b/src/libsyntax_pos/span_encoding.rs index 473aa1bd1b8..8cb3bc2144d 100644 --- a/src/libsyntax_pos/span_encoding.rs +++ b/src/libsyntax_pos/span_encoding.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Spans are encoded using 1-bit tag and 2 different encoding formats (one for each tag value). // One format is used for keeping span data inline, // another contains index into an out-of-line span interner. diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 361353c82e2..7097f332b8b 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -1,29 +1,20 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! An "interner" is a data structure that associates values with usize tags and -//! allows bidirectional lookup; i.e. given a value, one can easily find the +//! allows bidirectional lookup; i.e., given a value, one can easily find the //! type, and vice versa. -use edition::Edition; -use hygiene::SyntaxContext; -use {Span, DUMMY_SP, GLOBALS}; - -use rustc_data_structures::fx::FxHashMap; use arena::DroplessArena; +use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::indexed_vec::Idx; use serialize::{Decodable, Decoder, Encodable, Encoder}; + use std::fmt; use std::str; use std::cmp::{PartialEq, Ordering, PartialOrd, Ord}; use std::hash::{Hash, Hasher}; +use hygiene::SyntaxContext; +use {Span, DUMMY_SP, GLOBALS}; + #[derive(Copy, Clone, Eq)] pub struct Ident { pub name: Symbol, @@ -35,6 +26,7 @@ impl Ident { pub const fn new(name: Symbol, span: Span) -> Ident { Ident { name, span } } + #[inline] pub const fn with_empty_ctxt(name: Symbol) -> Ident { Ident::new(name, DUMMY_SP) @@ -56,12 +48,12 @@ impl Ident { } pub fn without_first_quote(self) -> Ident { - Ident::new(Symbol::intern(self.as_str().trim_left_matches('\'')), self.span) + Ident::new(Symbol::intern(self.as_str().trim_start_matches('\'')), self.span) } /// "Normalize" ident for use in comparisons using "item hygiene". /// Identifiers with same string value become same if they came from the same "modern" macro - /// (e.g. `macro` item, but not `macro_rules` item) and stay different if they came from + /// (e.g., `macro` item, but not `macro_rules` item) and stay different if they came from /// different "modern" macros. /// Technically, this operation strips all non-opaque marks from ident's syntactic context. pub fn modern(self) -> Ident { @@ -70,7 +62,7 @@ impl Ident { /// "Normalize" ident for use in comparisons using "local variable hygiene". /// Identifiers with same string value become same if they came from the same non-transparent - /// macro (e.g. `macro` or `macro_rules!` items) and stay different if they came from different + /// macro (e.g., `macro` or `macro_rules!` items) and stay different if they came from different /// non-transparent macros. /// Technically, this operation strips all transparent marks from ident's syntactic context. pub fn modern_and_legacy(self) -> Ident { @@ -81,6 +73,10 @@ impl Ident { Ident::new(self.name.gensymed(), self.span) } + pub fn gensym_if_underscore(self) -> Ident { + if self.name == keywords::Underscore.name() { self.gensym() } else { self } + } + pub fn as_str(self) -> LocalInternedString { self.name.as_str() } @@ -119,7 +115,7 @@ impl Encodable for Ident { fn encode(&self, s: &mut S) -> Result<(), S::Error> { if self.span.ctxt().modern() == SyntaxContext::empty() { s.emit_str(&self.as_str()) - } else { // FIXME(jseyfried) intercrate hygiene + } else { // FIXME(jseyfried): intercrate hygiene let mut string = "#".to_owned(); string.push_str(&self.as_str()); s.emit_str(&string) @@ -132,25 +128,38 @@ impl Decodable for Ident { let string = d.read_str()?; Ok(if !string.starts_with('#') { Ident::from_str(&string) - } else { // FIXME(jseyfried) intercrate hygiene + } else { // FIXME(jseyfried): intercrate hygiene Ident::with_empty_ctxt(Symbol::gensym(&string[1..])) }) } } -/// A symbol is an interned or gensymed string. +/// A symbol is an interned or gensymed string. The use of newtype_index! means +/// that Option only takes up 4 bytes, because newtype_index! reserves +/// the last 256 values for tagging purposes. +/// +/// Note that Symbol cannot be a newtype_index! directly because it implements +/// fmt::Debug, Encodable, and Decodable in special ways. #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct Symbol(u32); +pub struct Symbol(SymbolIndex); + +newtype_index! { + pub struct SymbolIndex { .. } +} // The interner is pointed to by a thread local value which is only set on the main thread -// with parallelization is disabled. So we don't allow Symbol to transfer between threads +// with parallelization is disabled. So we don't allow `Symbol` to transfer between threads // to avoid panics and other errors, even though it would be memory safe to do so. -#[cfg(not(parallel_queries))] +#[cfg(not(parallel_compiler))] impl !Send for Symbol { } -#[cfg(not(parallel_queries))] +#[cfg(not(parallel_compiler))] impl !Sync for Symbol { } impl Symbol { + const fn new(n: u32) -> Self { + Symbol(SymbolIndex::from_u32_const(n)) + } + /// Maps a string to its interned representation. pub fn intern(string: &str) -> Self { with_interner(|interner| interner.intern(string)) @@ -160,7 +169,7 @@ impl Symbol { with_interner(|interner| interner.interned(self)) } - /// gensym's a new usize, using the current interner. + /// Gensyms a new usize, using the current interner. pub fn gensym(string: &str) -> Self { with_interner(|interner| interner.gensym(string)) } @@ -184,7 +193,7 @@ impl Symbol { } pub fn as_u32(self) -> u32 { - self.0 + self.0.as_u32() } } @@ -192,7 +201,7 @@ impl fmt::Debug for Symbol { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let is_gensymed = with_interner(|interner| interner.is_gensymed(*self)); if is_gensymed { - write!(f, "{}({})", self, self.0) + write!(f, "{}({:?})", self, self.0) } else { write!(f, "{}", self) } @@ -223,7 +232,10 @@ impl> PartialEq for Symbol { } } -// The &'static strs in this type actually point into the arena +// The `&'static str`s in this type actually point into the arena. +// +// Note that normal symbols are indexed upward from 0, and gensyms are indexed +// downward from SymbolIndex::MAX_AS_U32. #[derive(Default)] pub struct Interner { arena: DroplessArena, @@ -237,8 +249,8 @@ impl Interner { let mut this = Interner::default(); for &string in init { if string == "" { - // We can't allocate empty strings in the arena, so handle this here - let name = Symbol(this.strings.len() as u32); + // We can't allocate empty strings in the arena, so handle this here. + let name = Symbol::new(this.strings.len() as u32); this.names.insert("", name); this.strings.push(""); } else { @@ -253,14 +265,15 @@ impl Interner { return name; } - let name = Symbol(self.strings.len() as u32); + let name = Symbol::new(self.strings.len() as u32); - // from_utf8_unchecked is safe since we just allocated a &str which is known to be utf8 + // `from_utf8_unchecked` is safe since we just allocated a `&str` which is known to be + // UTF-8. let string: &str = unsafe { str::from_utf8_unchecked(self.arena.alloc_slice(string.as_bytes())) }; - // It is safe to extend the arena allocation to 'static because we only access - // these while the arena is still alive + // It is safe to extend the arena allocation to `'static` because we only access + // these while the arena is still alive. let string: &'static str = unsafe { &*(string as *const str) }; @@ -270,10 +283,10 @@ impl Interner { } pub fn interned(&self, symbol: Symbol) -> Symbol { - if (symbol.0 as usize) < self.strings.len() { + if (symbol.0.as_usize()) < self.strings.len() { symbol } else { - self.interned(self.gensyms[(!0 - symbol.0) as usize]) + self.interned(self.gensyms[(SymbolIndex::MAX_AS_U32 - symbol.0.as_u32()) as usize]) } } @@ -284,17 +297,17 @@ impl Interner { fn gensymed(&mut self, symbol: Symbol) -> Symbol { self.gensyms.push(symbol); - Symbol(!0 - self.gensyms.len() as u32 + 1) + Symbol::new(SymbolIndex::MAX_AS_U32 - self.gensyms.len() as u32 + 1) } fn is_gensymed(&mut self, symbol: Symbol) -> bool { - symbol.0 as usize >= self.strings.len() + symbol.0.as_usize() >= self.strings.len() } pub fn get(&self, symbol: Symbol) -> &str { - match self.strings.get(symbol.0 as usize) { + match self.strings.get(symbol.0.as_usize()) { Some(string) => string, - None => self.get(self.gensyms[(!0 - symbol.0) as usize]), + None => self.get(self.gensyms[(SymbolIndex::MAX_AS_U32 - symbol.0.as_u32()) as usize]), } } } @@ -318,7 +331,7 @@ macro_rules! declare_keywords {( $( #[allow(non_upper_case_globals)] pub const $konst: Keyword = Keyword { - ident: Ident::with_empty_ctxt(super::Symbol($index)) + ident: Ident::with_empty_ctxt(super::Symbol::new($index)) }; )* @@ -341,7 +354,7 @@ macro_rules! declare_keywords {( } }} -// NB: leaving holes in the ident table is bad! a different ident will get +// N.B., leaving holes in the ident table is bad! a different ident will get // interned with the id from the hole, but it will be between the min and max // of the reserved words, and thus tagged as "reserved". // After modifying this list adjust `is_special`, `is_used_keyword`/`is_unused_keyword`, @@ -350,11 +363,11 @@ declare_keywords! { // Special reserved identifiers used internally for elided lifetimes, // unnamed method parameters, crate root module, error recovery etc. (0, Invalid, "") - (1, CrateRoot, "{{root}}") + (1, PathRoot, "{{root}}") (2, DollarCrate, "$crate") (3, Underscore, "_") - // Keywords used in the language. + // Keywords that are used in stable Rust. (4, As, "as") (5, Box, "box") (6, Break, "break") @@ -379,8 +392,8 @@ declare_keywords! { (25, Pub, "pub") (26, Ref, "ref") (27, Return, "return") - (28, SelfValue, "self") - (29, SelfType, "Self") + (28, SelfLower, "self") + (29, SelfUpper, "Self") (30, Static, "static") (31, Struct, "struct") (32, Super, "super") @@ -392,7 +405,7 @@ declare_keywords! { (38, Where, "where") (39, While, "while") - // Keywords reserved for future use. + // Keywords that are used in unstable Rust or reserved for future use. (40, Abstract, "abstract") (41, Become, "become") (42, Do, "do") @@ -405,9 +418,11 @@ declare_keywords! { (49, Virtual, "virtual") (50, Yield, "yield") - // Edition-specific keywords reserved for future use. - (51, Async, "async") // >= 2018 Edition only - (52, Dyn, "dyn") // >= 2018 Edition only + // Edition-specific keywords that are used in stable Rust. + (51, Dyn, "dyn") // >= 2018 Edition only + + // Edition-specific keywords that are used in unstable Rust or reserved for future use. + (52, Async, "async") // >= 2018 Edition only (53, Try, "try") // >= 2018 Edition only // Special lifetime names @@ -418,18 +433,22 @@ declare_keywords! { (56, Auto, "auto") (57, Catch, "catch") (58, Default, "default") - (59, Union, "union") - (60, Existential, "existential") + (59, Existential, "existential") + (60, Union, "union") } impl Symbol { + fn is_used_keyword_2018(self) -> bool { + self == keywords::Dyn.name() + } + fn is_unused_keyword_2018(self) -> bool { self >= keywords::Async.name() && self <= keywords::Try.name() } } impl Ident { - // Returns true for reserved identifiers used internally for elided lifetimes, + // Returns `true` for reserved identifiers used internally for elided lifetimes, // unnamed method parameters, crate root module, error recovery etc. pub fn is_special(self) -> bool { self.name <= keywords::Underscore.name() @@ -437,14 +456,16 @@ impl Ident { /// Returns `true` if the token is a keyword used in the language. pub fn is_used_keyword(self) -> bool { - self.name >= keywords::As.name() && self.name <= keywords::While.name() + // Note: `span.edition()` is relatively expensive, don't call it unless necessary. + self.name >= keywords::As.name() && self.name <= keywords::While.name() || + self.name.is_used_keyword_2018() && self.span.rust_2018() } /// Returns `true` if the token is a keyword reserved for possible future use. pub fn is_unused_keyword(self) -> bool { // Note: `span.edition()` is relatively expensive, don't call it unless necessary. self.name >= keywords::Abstract.name() && self.name <= keywords::Yield.name() || - self.name.is_unused_keyword_2018() && self.span.edition() == Edition::Edition2018 + self.name.is_unused_keyword_2018() && self.span.rust_2018() } /// Returns `true` if the token is either a special identifier or a keyword. @@ -455,18 +476,17 @@ impl Ident { /// A keyword or reserved identifier that can be used as a path segment. pub fn is_path_segment_keyword(self) -> bool { self.name == keywords::Super.name() || - self.name == keywords::SelfValue.name() || - self.name == keywords::SelfType.name() || - self.name == keywords::Extern.name() || + self.name == keywords::SelfLower.name() || + self.name == keywords::SelfUpper.name() || self.name == keywords::Crate.name() || - self.name == keywords::CrateRoot.name() || + self.name == keywords::PathRoot.name() || self.name == keywords::DollarCrate.name() } // We see this identifier in a normal identifier position, like variable name or a type. // How was it written originally? Did it use the raw form? Let's try to guess. pub fn is_raw_guess(self) -> bool { - self.name != keywords::Invalid.name() && + self.name != keywords::Invalid.name() && self.name != keywords::Underscore.name() && self.is_reserved() && !self.is_path_segment_keyword() } } @@ -480,8 +500,8 @@ fn with_interner T>(f: F) -> T { /// Represents a string stored in the interner. Because the interner outlives any thread /// which uses this type, we can safely treat `string` which points to interner data, /// as an immortal string, as long as this type never crosses between threads. -// FIXME: Ensure that the interner outlives any thread which uses LocalInternedString, -// by creating a new thread right after constructing the interner +// FIXME: ensure that the interner outlives any thread which uses `LocalInternedString`, +// by creating a new thread right after constructing the interner. #[derive(Clone, Copy, Hash, PartialOrd, Eq, Ord)] pub struct LocalInternedString { string: &'static str, @@ -493,6 +513,10 @@ impl LocalInternedString { symbol: Symbol::intern(self.string) } } + + pub fn get(&self) -> &'static str { + self.string + } } impl ::std::convert::AsRef for LocalInternedString @@ -566,7 +590,7 @@ impl Encodable for LocalInternedString { } } -/// Represents a string stored in the string interner +/// Represents a string stored in the string interner. #[derive(Clone, Copy, Eq)] pub struct InternedString { symbol: Symbol, @@ -691,19 +715,19 @@ mod tests { fn interner_tests() { let mut i: Interner = Interner::default(); // first one is zero: - assert_eq!(i.intern("dog"), Symbol(0)); + assert_eq!(i.intern("dog"), Symbol::new(0)); // re-use gets the same entry: - assert_eq!(i.intern("dog"), Symbol(0)); + assert_eq!(i.intern("dog"), Symbol::new(0)); // different string gets a different #: - assert_eq!(i.intern("cat"), Symbol(1)); - assert_eq!(i.intern("cat"), Symbol(1)); + assert_eq!(i.intern("cat"), Symbol::new(1)); + assert_eq!(i.intern("cat"), Symbol::new(1)); // dog is still at zero - assert_eq!(i.intern("dog"), Symbol(0)); - assert_eq!(i.gensym("zebra"), Symbol(4294967295)); - // gensym of same string gets new number : - assert_eq!(i.gensym("zebra"), Symbol(4294967294)); + assert_eq!(i.intern("dog"), Symbol::new(0)); + assert_eq!(i.gensym("zebra"), Symbol::new(SymbolIndex::MAX_AS_U32)); + // gensym of same string gets new number: + assert_eq!(i.gensym("zebra"), Symbol::new(SymbolIndex::MAX_AS_U32 - 1)); // gensym of *existing* string gets new number: - assert_eq!(i.gensym("dog"), Symbol(4294967293)); + assert_eq!(i.gensym("dog"), Symbol::new(SymbolIndex::MAX_AS_U32 - 2)); } #[test] diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 5ac46c2c5eb..115dffa5799 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Terminal formatting library. //! //! This crate provides the `Terminal` trait, which abstracts over an [ANSI @@ -198,7 +188,7 @@ pub trait Terminal: Write { /// *Note: This does not flush.* /// /// That means the reset command may get buffered so, if you aren't planning on doing anything - /// else that might flush stdout's buffer (e.g. writing a line of text), you should flush after + /// else that might flush stdout's buffer (e.g., writing a line of text), you should flush after /// calling reset. fn reset(&mut self) -> io::Result; diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs index adfc7078eba..eaa96df3f3b 100644 --- a/src/libterm/terminfo/mod.rs +++ b/src/libterm/terminfo/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Terminfo database interface. use std::collections::HashMap; diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 31e1b18485c..434dd4a9fbc 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Parameterized string expansion use self::Param::*; diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index 57dcfb0d906..63d01831269 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals, missing_docs)] //! ncurses-compatible compiled terminfo format parsing (term(5)) diff --git a/src/libterm/terminfo/searcher.rs b/src/libterm/terminfo/searcher.rs index 492d26e625c..a9e2626a57e 100644 --- a/src/libterm/terminfo/searcher.rs +++ b/src/libterm/terminfo/searcher.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! ncurses-compatible database discovery //! //! Does not support hashed database, only filesystem! @@ -64,7 +54,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option { p.pop(); // on some installations the dir is named after the hex of the char - // (e.g. macOS) + // (e.g., macOS) p.push(&format!("{:x}", first_char as usize)); p.push(term); if fs::metadata(&p).is_ok() { @@ -76,10 +66,10 @@ pub fn get_dbpath_for_term(term: &str) -> Option { } #[test] -#[ignore(reason = "buildbots don't have ncurses installed and I can't mock everything I need")] +#[ignore = "buildbots don't have ncurses installed and I can't mock everything I need"] fn test_get_dbpath_for_term() { // woefully inadequate test coverage - // note: current tests won't work with non-standard terminfo hierarchies (e.g. macOS's) + // note: current tests won't work with non-standard terminfo hierarchies (e.g., macOS's) use std::env; // FIXME (#9639): This needs to handle non-utf8 paths fn x(t: &str) -> String { diff --git a/src/libterm/win.rs b/src/libterm/win.rs index e0b60eead49..25b03ba59ac 100644 --- a/src/libterm/win.rs +++ b/src/libterm/win.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Windows console handling // FIXME (#13400): this is only a tiny fraction of the Windows console api diff --git a/src/libtest/Cargo.toml b/src/libtest/Cargo.toml index ec77f953380..aade10ed6c3 100644 --- a/src/libtest/Cargo.toml +++ b/src/libtest/Cargo.toml @@ -11,3 +11,6 @@ crate-type = ["dylib", "rlib"] [dependencies] getopts = "0.2" term = { path = "../libterm" } + +# not actually used but needed to always have proc_macro in the sysroot +proc_macro = { path = "../libproc_macro" } diff --git a/src/libtest/formatters/json.rs b/src/libtest/formatters/json.rs index 3c803ad8233..cc1568265c0 100644 --- a/src/libtest/formatters/json.rs +++ b/src/libtest/formatters/json.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::*; pub(crate) struct JsonFormatter { diff --git a/src/libtest/formatters/mod.rs b/src/libtest/formatters/mod.rs index 24c7929076c..be5f6a65039 100644 --- a/src/libtest/formatters/mod.rs +++ b/src/libtest/formatters/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::*; mod pretty; diff --git a/src/libtest/formatters/pretty.rs b/src/libtest/formatters/pretty.rs index f94780682a0..4af00428ca8 100644 --- a/src/libtest/formatters/pretty.rs +++ b/src/libtest/formatters/pretty.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::*; pub(crate) struct PrettyFormatter { diff --git a/src/libtest/formatters/terse.rs b/src/libtest/formatters/terse.rs index 6f7dfee53fa..1400fba5d60 100644 --- a/src/libtest/formatters/terse.rs +++ b/src/libtest/formatters/terse.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::*; pub(crate) struct TerseFormatter { @@ -66,7 +56,7 @@ impl TerseFormatter { self.write_pretty(result, color)?; if self.test_count % QUIET_MODE_MAX_COLUMN == QUIET_MODE_MAX_COLUMN - 1 { // we insert a new line every 100 dots in order to flush the - // screen when dealing with line-buffered output (e.g. piping to + // screen when dealing with line-buffered output (e.g., piping to // `stamp` in the rust CI). let out = format!(" {}/{}\n", self.test_count+1, self.total_test_count); self.write_plain(&out)?; diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 7c26d042a7c..c8eceeeaa5a 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Support code for rustc's built in unit-test and micro-benchmarking //! framework. //! @@ -23,7 +13,7 @@ // running tests while providing a base that other test frameworks may // build off of. -// NB: this is also specified in this crate's Cargo.toml, but libsyntax contains logic specific to +// N.B., this is also specified in this crate's Cargo.toml, but libsyntax contains logic specific to // this crate, which relies on this attribute (rather than the value of `--crate-name` passed by // cargo) to detect this crate. @@ -34,7 +24,7 @@ html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))] #![feature(asm)] #![feature(fnbox)] -#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))] +#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc, rustc_private))] #![feature(nll)] #![feature(set_stdio)] #![feature(panic_unwind)] @@ -99,8 +89,12 @@ mod formatters; use formatters::{JsonFormatter, OutputFormatter, PrettyFormatter, TerseFormatter}; +/// Whether to execute tests concurrently or not +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub enum Concurrent { Yes, No } + // The name of a test. By convention this follows the rules for rust -// paths; i.e. it should be a series of identifiers separated by double +// paths; i.e., it should be a series of identifiers separated by double // colons. This way if some test runner wants to arrange the tests // hierarchically it may. @@ -515,7 +509,7 @@ Test Attributes: // FIXME: Copied from libsyntax until linkage errors are resolved. Issue #47566 fn is_nightly() -> bool { - // Whether this is a feature-staged build, i.e. on the beta or stable channel + // Whether this is a feature-staged build, i.e., on the beta or stable channel let disable_unstable_features = option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some(); // Whether we should enable unstable features for bootstrapping let bootstrap = env::var("RUSTC_BOOTSTRAP").is_ok(); @@ -1018,10 +1012,12 @@ fn use_color(opts: &TestOpts) -> bool { } } -#[cfg(any(target_os = "cloudabi", target_os = "redox", - all(target_arch = "wasm32", not(target_os = "emscripten"))))] +#[cfg(any(target_os = "cloudabi", + target_os = "redox", + all(target_arch = "wasm32", not(target_os = "emscripten")), + all(target_vendor = "fortanix", target_env = "sgx")))] fn stdout_isatty() -> bool { - // FIXME: Implement isatty on Redox + // FIXME: Implement isatty on Redox and SGX false } #[cfg(unix)] @@ -1071,8 +1067,12 @@ pub fn run_tests(opts: &TestOpts, tests: Vec, mut callback: F) where F: FnMut(TestEvent) -> io::Result<()>, { - use std::collections::HashMap; + use std::collections::{self, HashMap}; + use std::hash::BuildHasherDefault; use std::sync::mpsc::RecvTimeoutError; + // Use a deterministic hasher + type TestMap = + HashMap>; let tests_len = tests.len(); @@ -1111,9 +1111,9 @@ where let (tx, rx) = channel::(); - let mut running_tests: HashMap = HashMap::new(); + let mut running_tests: TestMap = HashMap::default(); - fn get_timed_out_tests(running_tests: &mut HashMap) -> Vec { + fn get_timed_out_tests(running_tests: &mut TestMap) -> Vec { let now = Instant::now(); let timed_out = running_tests .iter() @@ -1131,7 +1131,7 @@ where timed_out }; - fn calc_timeout(running_tests: &HashMap) -> Option { + fn calc_timeout(running_tests: &TestMap) -> Option { running_tests.values().min().map(|next_timeout| { let now = Instant::now(); if *next_timeout >= now { @@ -1146,7 +1146,7 @@ where while !remaining.is_empty() { let test = remaining.pop().unwrap(); callback(TeWait(test.desc.clone()))?; - run_test(opts, !opts.run_tests, test, tx.clone()); + run_test(opts, !opts.run_tests, test, tx.clone(), Concurrent::No); let (test, result, stdout) = rx.recv().unwrap(); callback(TeResult(test, result, stdout))?; } @@ -1157,7 +1157,7 @@ where let timeout = Instant::now() + Duration::from_secs(TEST_WARN_TIMEOUT_S); running_tests.insert(test.desc.clone(), timeout); callback(TeWait(test.desc.clone()))?; //here no pad - run_test(opts, !opts.run_tests, test, tx.clone()); + run_test(opts, !opts.run_tests, test, tx.clone(), Concurrent::Yes); pending += 1; } @@ -1189,7 +1189,7 @@ where // All benchmarks run at the end, in serial. for b in filtered_benchs { callback(TeWait(b.desc.clone()))?; - run_test(opts, false, b, tx.clone()); + run_test(opts, false, b, tx.clone(), Concurrent::No); let (test, result, stdout) = rx.recv().unwrap(); callback(TeResult(test, result, stdout))?; } @@ -1246,7 +1246,8 @@ fn get_concurrency() -> usize { 1 } - #[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))] + #[cfg(any(all(target_arch = "wasm32", not(target_os = "emscripten")), + all(target_vendor = "fortanix", target_env = "sgx")))] fn num_cpus() -> usize { 1 } @@ -1391,6 +1392,7 @@ pub fn run_test( force_ignore: bool, test: TestDescAndFn, monitor_ch: Sender, + concurrency: Concurrent, ) { let TestDescAndFn { desc, testfn } = test; @@ -1407,6 +1409,7 @@ pub fn run_test( monitor_ch: Sender, nocapture: bool, testfn: Box, + concurrency: Concurrent, ) { // Buffer for capturing standard I/O let data = Arc::new(Mutex::new(Vec::new())); @@ -1441,7 +1444,7 @@ pub fn run_test( // the test synchronously, regardless of the concurrency // level. let supports_threads = !cfg!(target_os = "emscripten") && !cfg!(target_arch = "wasm32"); - if supports_threads { + if concurrency == Concurrent::Yes && supports_threads { let cfg = thread::Builder::new().name(name.as_slice().to_owned()); cfg.spawn(runtest).unwrap(); } else { @@ -1462,13 +1465,14 @@ pub fn run_test( } DynTestFn(f) => { let cb = move || __rust_begin_short_backtrace(f); - run_test_inner(desc, monitor_ch, opts.nocapture, Box::new(cb)) + run_test_inner(desc, monitor_ch, opts.nocapture, Box::new(cb), concurrency) } StaticTestFn(f) => run_test_inner( desc, monitor_ch, opts.nocapture, Box::new(move || __rust_begin_short_backtrace(f)), + concurrency, ), } } @@ -1612,7 +1616,7 @@ where // be left doing 0 iterations on every loop. The unfortunate // side effect of not being able to do as many runs is // automatically handled by the statistical analysis below - // (i.e. larger error bars). + // (i.e., larger error bars). n = cmp::max(1, n); let mut total_run = Duration::new(0, 0); @@ -1751,6 +1755,7 @@ mod tests { use std::sync::mpsc::channel; use bench; use Bencher; + use Concurrent; fn one_ignored_one_unignored_test() -> Vec { @@ -1791,7 +1796,7 @@ mod tests { testfn: DynTestFn(Box::new(f)), }; let (tx, rx) = channel(); - run_test(&TestOpts::new(), false, desc, tx); + run_test(&TestOpts::new(), false, desc, tx, Concurrent::No); let (_, res, _) = rx.recv().unwrap(); assert!(res != TrOk); } @@ -1809,7 +1814,7 @@ mod tests { testfn: DynTestFn(Box::new(f)), }; let (tx, rx) = channel(); - run_test(&TestOpts::new(), false, desc, tx); + run_test(&TestOpts::new(), false, desc, tx, Concurrent::No); let (_, res, _) = rx.recv().unwrap(); assert!(res == TrIgnored); } @@ -1829,7 +1834,7 @@ mod tests { testfn: DynTestFn(Box::new(f)), }; let (tx, rx) = channel(); - run_test(&TestOpts::new(), false, desc, tx); + run_test(&TestOpts::new(), false, desc, tx, Concurrent::No); let (_, res, _) = rx.recv().unwrap(); assert!(res == TrOk); } @@ -1849,7 +1854,7 @@ mod tests { testfn: DynTestFn(Box::new(f)), }; let (tx, rx) = channel(); - run_test(&TestOpts::new(), false, desc, tx); + run_test(&TestOpts::new(), false, desc, tx, Concurrent::No); let (_, res, _) = rx.recv().unwrap(); assert!(res == TrOk); } @@ -1871,7 +1876,7 @@ mod tests { testfn: DynTestFn(Box::new(f)), }; let (tx, rx) = channel(); - run_test(&TestOpts::new(), false, desc, tx); + run_test(&TestOpts::new(), false, desc, tx, Concurrent::No); let (_, res, _) = rx.recv().unwrap(); assert!(res == TrFailedMsg(format!("{} '{}'", failed_msg, expected))); } @@ -1889,7 +1894,7 @@ mod tests { testfn: DynTestFn(Box::new(f)), }; let (tx, rx) = channel(); - run_test(&TestOpts::new(), false, desc, tx); + run_test(&TestOpts::new(), false, desc, tx, Concurrent::No); let (_, res, _) = rx.recv().unwrap(); assert!(res == TrFailed); } diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index 9a8749712c3..9fc5f09ba6c 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(missing_docs)] #![allow(deprecated)] // Float @@ -224,7 +214,7 @@ impl Stats for [f64] { let x = *s - mean; v = v + x * x; } - // NB: this is _supposed to be_ len-1, not len. If you + // N.B., this is _supposed to be_ len-1, not len. If you // change it back to len, you will be calculating a // population variance, not a sample variance. let denom = (self.len() - 1) as f64; diff --git a/src/libunwind/Cargo.toml b/src/libunwind/Cargo.toml index 4760461df64..2577d6dd31d 100644 --- a/src/libunwind/Cargo.toml +++ b/src/libunwind/Cargo.toml @@ -13,5 +13,5 @@ doc = false [dependencies] core = { path = "../libcore" } -libc = { path = "../rustc/libc_shim" } -compiler_builtins = { path = "../rustc/compiler_builtins_shim" } +libc = { version = "0.2.43", features = ['rustc-dep-of-std'], default-features = false } +compiler_builtins = "0.1.0" diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index 11c4c2faf13..b50a11fa03a 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::env; fn main() { diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs index 954eb9d6d03..5f9c82431b7 100644 --- a/src/libunwind/lib.rs +++ b/src/libunwind/lib.rs @@ -1,17 +1,6 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] #![unstable(feature = "panic_unwind", issue = "32837")] -#![feature(cfg_target_vendor)] #![feature(link_cfg)] #![feature(nll)] #![feature(staged_api)] diff --git a/src/libunwind/libunwind.rs b/src/libunwind/libunwind.rs index 43c3e1e7666..31e806c8fb6 100644 --- a/src/libunwind/libunwind.rs +++ b/src/libunwind/libunwind.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(nonstandard_style)] macro_rules! cfg_if { diff --git a/src/libunwind/macros.rs b/src/libunwind/macros.rs index a962d5fc415..659e977285e 100644 --- a/src/libunwind/macros.rs +++ b/src/libunwind/macros.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// A macro for defining `#[cfg]` if-else statements. /// /// This is similar to the `if/elif` C preprocessor macro by allowing definition diff --git a/src/llvm b/src/llvm deleted file mode 160000 index 7051ead40a5..00000000000 --- a/src/llvm +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7051ead40a5f825878b59bf08d4e768be9e99a4a diff --git a/src/llvm-project b/src/llvm-project new file mode 160000 index 00000000000..683d3522690 --- /dev/null +++ b/src/llvm-project @@ -0,0 +1 @@ +Subproject commit 683d3522690b7a9d0163e7e7e6586f2b1364ed02 diff --git a/src/rtstartup/rsbegin.rs b/src/rtstartup/rsbegin.rs index 8ff401164c1..52ec601fedd 100644 --- a/src/rtstartup/rsbegin.rs +++ b/src/rtstartup/rsbegin.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // rsbegin.o and rsend.o are the so called "compiler runtime startup objects". // They contain code needed to correctly initialize the compiler runtime. // @@ -96,7 +86,7 @@ pub mod eh_frames { pub mod ms_init { // .CRT$X?? sections are roughly analogous to ELF's .init_array and .fini_array, // except that they exploit the fact that linker will sort them alphabitically, - // so e.g. sections with names between .CRT$XIA and .CRT$XIZ are guaranteed to be + // so e.g., sections with names between .CRT$XIA and .CRT$XIZ are guaranteed to be // placed between those two, without requiring any ordering of objects on the linker // command line. // Note that ordering of same-named sections from different objects is not guaranteed. diff --git a/src/rtstartup/rsend.rs b/src/rtstartup/rsend.rs index f487f1d410e..4023c2fe23d 100644 --- a/src/rtstartup/rsend.rs +++ b/src/rtstartup/rsend.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // See rsbegin.rs for details. #![feature(no_core, lang_items, optin_builtin_traits)] diff --git a/src/rustc/Cargo.toml b/src/rustc/Cargo.toml index ec822fddef3..e601a1f8237 100644 --- a/src/rustc/Cargo.toml +++ b/src/rustc/Cargo.toml @@ -2,6 +2,7 @@ authors = ["The Rust Project Developers"] name = "rustc-main" version = "0.0.0" +edition = '2018' [[bin]] name = "rustc_binary" @@ -11,5 +12,14 @@ path = "rustc.rs" rustc_target = { path = "../librustc_target" } rustc_driver = { path = "../librustc_driver" } +# Make sure rustc_codegen_ssa ends up in the sysroot, because this +# crate is intended to be used by codegen backends, which may not be in-tree. +rustc_codegen_ssa = { path = "../librustc_codegen_ssa" } + +[dependencies.jemalloc-sys] +version = '0.1.8' +optional = true +features = ['unprefixed_malloc_on_supported_platforms'] + [features] -jemalloc = ['rustc_driver/jemalloc-sys'] +jemalloc = ['jemalloc-sys'] diff --git a/src/rustc/compiler_builtins_shim/Cargo.toml b/src/rustc/compiler_builtins_shim/Cargo.toml deleted file mode 100644 index 7d8423ca84e..00000000000 --- a/src/rustc/compiler_builtins_shim/Cargo.toml +++ /dev/null @@ -1,40 +0,0 @@ -[package] -name = "compiler_builtins" -authors = ["The Rust Project Developers"] -version = "0.0.0" -build = "../../libcompiler_builtins/build.rs" - -[lib] -path = "../../libcompiler_builtins/src/lib.rs" -test = false -doctest = false - -[dependencies] -# Specify the path to libcore; at the time of writing, removing this shim in -# favor of using compiler-builtins from git results in a compilation failure: -# -# Building stage0 std artifacts (x86_64-apple-darwin -> x86_64-apple-darwin) -# Compiling compiler_builtins v0.1.0 (https://github.com/rust-lang-nursery/compiler-builtins.git#23f14d3f) -# error[E0463]: can't find crate for `core` -# -# error: aborting due to previous error -# -# error: Could not compile `compiler_builtins`. -# -# Caused by: -# process didn't exit successfully: `/Users/tamird/src/rust/build/bootstrap/debug/rustc --crate-name compiler_builtins /Users/tamird/.cargo/git/checkouts/compiler-builtins-ec094dc45a0179c8/23f14d3/src/lib.rs --error-format json --crate-type lib --emit=dep-info,link -C opt-level=2 --cfg feature="c" --cfg feature="compiler-builtins" --cfg feature="default" --cfg feature="gcc" -C metadata=876d429e8d7eae1f -C extra-filename=-876d429e8d7eae1f --out-dir /Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/x86_64-apple-darwin/release/deps --target x86_64-apple-darwin -L dependency=/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/x86_64-apple-darwin/release/deps -L dependency=/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/release/deps --cap-lints allow -L native=/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/x86_64-apple-darwin/release/build/compiler_builtins-f18fab55928102ad/out -l static=compiler-rt` (exit code: 101) -# thread 'main' panicked at 'command did not execute successfully: "/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0/bin/cargo" "build" "-j" "4" "--target" "x86_64-apple-darwin" "--release" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/Users/tamird/src/rust/src/libstd/Cargo.toml" "--message-format" "json" -# expected success, got: exit code: 101', src/bootstrap/compile.rs:883:8 -# -# See https://github.com/rust-lang/rfcs/pull/1133. -core = { path = "../../libcore" } - -[build-dependencies] -cc = "1.0.1" - -[features] -c = [] -default = ["c", "rustbuild", "compiler-builtins"] -mem = [] -rustbuild = [] -compiler-builtins = [] diff --git a/src/rustc/compiler_builtins_shim/build.rs b/src/rustc/compiler_builtins_shim/build.rs deleted file mode 100644 index b37543e5f67..00000000000 --- a/src/rustc/compiler_builtins_shim/build.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// This file is left intentionally empty (and not removed) to avoid an issue -// where this crate is always considered dirty due to compiler-builtins' -// `cargo:rerun-if-changed=build.rs` directive; since the path is relative, it -// refers to this file when this shim crate is being built, and the absence of -// this file is considered by cargo to be equivalent to it having changed. diff --git a/src/rustc/dlmalloc_shim/Cargo.toml b/src/rustc/dlmalloc_shim/Cargo.toml deleted file mode 100644 index b6f8550829f..00000000000 --- a/src/rustc/dlmalloc_shim/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "dlmalloc" -version = "0.0.0" -authors = ["The Rust Project Developers"] - -[lib] -path = "../../dlmalloc/src/lib.rs" -test = false -bench = false -doc = false - -[dependencies] -core = { path = "../../libcore" } -compiler_builtins = { path = "../../rustc/compiler_builtins_shim" } diff --git a/src/rustc/libc_shim/Cargo.toml b/src/rustc/libc_shim/Cargo.toml deleted file mode 100644 index ee037ac68c5..00000000000 --- a/src/rustc/libc_shim/Cargo.toml +++ /dev/null @@ -1,40 +0,0 @@ -[package] -name = "libc" -version = "0.0.0" -authors = ["The Rust Project Developers"] - -[lib] -name = "libc" -path = "../../liblibc/src/lib.rs" -test = false -bench = false -doc = false - -[dependencies] -# Specify the path to libcore; at the time of writing, removing this shim in -# favor of using libc from git results in a compilation failure: -# -# Building stage0 std artifacts (x86_64-apple-darwin -> x86_64-apple-darwin) -# Compiling libc v0.0.0 (file:///Users/tamird/src/rust/src/rustc/libc_shim) -# error[E0463]: can't find crate for `core` -# -# error: aborting due to previous error -# -# error: Could not compile `libc`. -# -# Caused by: -# process didn't exit successfully: `/Users/tamird/src/rust/build/bootstrap/debug/rustc --crate-name libc src/rustc/libc_shim/../../liblibc/src/lib.rs --error-format json --crate-type lib --emit=dep-info,link -C opt-level=2 --cfg feature="default" --cfg feature="no_std" --cfg feature="stdbuild" -C metadata=d758f87058112d7d -C extra-filename=-d758f87058112d7d --out-dir /Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/x86_64-apple-darwin/release/deps --target x86_64-apple-darwin -L dependency=/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/x86_64-apple-darwin/release/deps -L dependency=/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0-std/release/deps` (exit code: 101) -# thread 'main' panicked at 'command did not execute successfully: "/Users/tamird/src/rust/build/x86_64-apple-darwin/stage0/bin/cargo" "build" "-j" "4" "--target" "x86_64-apple-darwin" "--release" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/Users/tamird/src/rust/src/libstd/Cargo.toml" "--message-format" "json" -# expected success, got: exit code: 101', src/bootstrap/compile.rs:883:8 -# -# See https://github.com/rust-lang/rfcs/pull/1133. -core = { path = "../../libcore" } -compiler_builtins = { path = "../compiler_builtins_shim" } - - -[features] -# Certain parts of libc are conditionally compiled differently than when used -# outside rustc. See https://github.com/rust-lang/libc/search?l=Rust&q=stdbuild&type=&utf8=%E2%9C%93. -stdbuild = [] -default = ["stdbuild", "align"] -align = [] diff --git a/src/rustc/rustc.rs b/src/rustc/rustc.rs index ab5a7c3f747..fef6b830040 100644 --- a/src/rustc/rustc.rs +++ b/src/rustc/rustc.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(rustc_private)] #![feature(link_args)] // Set the stack size at link time on Windows. See rustc_driver::in_rustc_thread @@ -21,9 +10,39 @@ // Also, don't forget to set this for rustdoc. extern {} -extern crate rustc_driver; - fn main() { + // Pull in jemalloc when enabled. + // + // Note that we're pulling in a static copy of jemalloc which means that to + // pull it in we need to actually reference its symbols for it to get + // linked. The two crates we link to here, std and rustc_driver, are both + // dynamic libraries. That means to pull in jemalloc we need to actually + // reference allocation symbols one way or another (as this file is the only + // object code in the rustc executable). + #[cfg(feature = "jemalloc-sys")] + { + use std::os::raw::{c_void, c_int}; + + #[used] + static _F1: unsafe extern fn(usize, usize) -> *mut c_void = + jemalloc_sys::calloc; + #[used] + static _F2: unsafe extern fn(*mut *mut c_void, usize, usize) -> c_int = + jemalloc_sys::posix_memalign; + #[used] + static _F3: unsafe extern fn(usize, usize) -> *mut c_void = + jemalloc_sys::aligned_alloc; + #[used] + static _F4: unsafe extern fn(usize) -> *mut c_void = + jemalloc_sys::malloc; + #[used] + static _F5: unsafe extern fn(*mut c_void, usize) -> *mut c_void = + jemalloc_sys::realloc; + #[used] + static _F6: unsafe extern fn(*mut c_void) = + jemalloc_sys::free; + } + rustc_driver::set_sigpipe_handler(); rustc_driver::main() } diff --git a/src/rustllvm/ArchiveWrapper.cpp b/src/rustllvm/ArchiveWrapper.cpp index 1355c0377ce..65975ec574c 100644 --- a/src/rustllvm/ArchiveWrapper.cpp +++ b/src/rustllvm/ArchiveWrapper.cpp @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #include "rustllvm.h" #include "llvm/Object/Archive.h" @@ -216,16 +206,11 @@ LLVMRustWriteArchive(char *Dst, size_t NumMembers, Members.push_back(std::move(*MOrErr)); } } + auto Result = writeArchive(Dst, Members, WriteSymbtab, Kind, true, false); -#if LLVM_VERSION_GE(6, 0) if (!Result) return LLVMRustResult::Success; LLVMRustSetLastError(toString(std::move(Result)).c_str()); -#else - if (!Result.second) - return LLVMRustResult::Success; - LLVMRustSetLastError(Result.second.message().c_str()); -#endif return LLVMRustResult::Failure; } diff --git a/src/rustllvm/Linker.cpp b/src/rustllvm/Linker.cpp index 59f0b23361e..7916721943a 100644 --- a/src/rustllvm/Linker.cpp +++ b/src/rustllvm/Linker.cpp @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #include "llvm/Linker/Linker.h" #include "rustllvm.h" diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index 3b0046222a9..18d277be21a 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #include #include @@ -17,21 +7,15 @@ #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" +#include "llvm/CodeGen/TargetSubtargetInfo.h" #include "llvm/IR/AutoUpgrade.h" #include "llvm/IR/AssemblyAnnotationWriter.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/Support/CBindingWrapping.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Host.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h" - -#if LLVM_VERSION_GE(6, 0) -#include "llvm/CodeGen/TargetSubtargetInfo.h" -#include "llvm/IR/IntrinsicInst.h" -#else -#include "llvm/Target/TargetSubtargetInfo.h" -#endif - #include "llvm/Transforms/IPO/AlwaysInliner.h" #include "llvm/Transforms/IPO/FunctionImport.h" #include "llvm/Transforms/Utils/FunctionImportUtils.h" @@ -198,13 +182,9 @@ GEN_SUBTARGETS extern "C" bool LLVMRustHasFeature(LLVMTargetMachineRef TM, const char *Feature) { -#if LLVM_VERSION_GE(6, 0) TargetMachine *Target = unwrap(TM); const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo(); return MCInfo->checkFeatures(std::string("+") + Feature); -#else - return false; -#endif } enum class LLVMRustCodeModel { @@ -284,7 +264,7 @@ static Optional fromRust(LLVMRustRelocMode RustReloc) { report_fatal_error("Bad RelocModel."); } -#if LLVM_RUSTLLVM +#ifdef LLVM_RUSTLLVM /// getLongestEntryLength - Return the length of the longest entry in the table. /// static size_t getLongestEntryLength(ArrayRef Table) { @@ -392,13 +372,9 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( Options.ThreadModel = ThreadModel::Single; } -#if LLVM_VERSION_GE(6, 0) Options.EmitStackSizeSection = EmitStackSizeSection; Optional CM; -#else - CodeModel::Model CM = CodeModel::Model::Default; -#endif if (RustCM != LLVMRustCodeModel::None) CM = fromRust(RustCM); TargetMachine *TM = TheTarget->createTargetMachine( @@ -813,7 +789,7 @@ struct LLVMRustThinLTOData { StringMap ModuleToDefinedGVSummaries; #if LLVM_VERSION_GE(7, 0) - LLVMRustThinLTOData() : Index(/* isPerformingAnalysis = */ false) {} + LLVMRustThinLTOData() : Index(/* HaveGVs = */ false) {} #endif }; @@ -889,7 +865,12 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, auto deadIsPrevailing = [&](GlobalValue::GUID G) { return PrevailingType::Unknown; }; +#if LLVM_VERSION_GE(8, 0) + computeDeadSymbolsWithConstProp(Ret->Index, Ret->GUIDPreservedSymbols, + deadIsPrevailing, /* ImportEnabled = */ true); +#else computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols, deadIsPrevailing); +#endif #else computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols); #endif @@ -922,7 +903,11 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules, GlobalValue::LinkageTypes NewLinkage) { ResolvedODR[ModuleIdentifier][GUID] = NewLinkage; }; +#if LLVM_VERSION_GE(8, 0) + thinLTOResolvePrevailingInIndex(Ret->Index, isPrevailing, recordNewLinkage); +#else thinLTOResolveWeakForLinkerInIndex(Ret->Index, isPrevailing, recordNewLinkage); +#endif // Here we calculate an `ExportedGUIDs` set for use in the `isExported` // callback below. This callback below will dictate the linkage for all @@ -977,7 +962,11 @@ extern "C" bool LLVMRustPrepareThinLTOResolveWeak(const LLVMRustThinLTOData *Data, LLVMModuleRef M) { Module &Mod = *unwrap(M); const auto &DefinedGlobals = Data->ModuleToDefinedGVSummaries.lookup(Mod.getModuleIdentifier()); +#if LLVM_VERSION_GE(8, 0) + thinLTOResolvePrevailingInModule(Mod, DefinedGlobals); +#else thinLTOResolveWeakForLinkerModule(Mod, DefinedGlobals); +#endif return true; } diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index f423503e19f..b33165b8463 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #include "rustllvm.h" #include "llvm/IR/CallSite.h" #include "llvm/IR/DebugInfoMetadata.h" @@ -198,6 +188,8 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) { return Attribute::SanitizeMemory; case NonLazyBind: return Attribute::NonLazyBind; + case OptimizeNone: + return Attribute::OptimizeNone; } report_fatal_error("bad AttributeKind"); } @@ -297,18 +289,14 @@ extern "C" void LLVMRustRemoveFunctionAttributes(LLVMValueRef Fn, // enable fpmath flag UnsafeAlgebra extern "C" void LLVMRustSetHasUnsafeAlgebra(LLVMValueRef V) { if (auto I = dyn_cast(unwrap(V))) { -#if LLVM_VERSION_GE(6, 0) I->setFast(true); -#else - I->setHasUnsafeAlgebra(true); -#endif } } extern "C" LLVMValueRef LLVMRustBuildAtomicLoad(LLVMBuilderRef B, LLVMValueRef Source, const char *Name, LLVMAtomicOrdering Order) { - LoadInst *LI = new LoadInst(unwrap(Source), 0); + LoadInst *LI = new LoadInst(unwrap(Source)); LI->setAtomic(fromRust(Order)); return wrap(unwrap(B)->Insert(LI, Name)); } @@ -525,6 +513,90 @@ static DINode::DIFlags fromRust(LLVMRustDIFlags Flags) { return Result; } +// These values **must** match debuginfo::DISPFlags! They also *happen* +// to match LLVM, but that isn't required as we do giant sets of +// matching below. The value shouldn't be directly passed to LLVM. +enum class LLVMRustDISPFlags : uint32_t { + SPFlagZero = 0, + SPFlagVirtual = 1, + SPFlagPureVirtual = 2, + SPFlagLocalToUnit = (1 << 2), + SPFlagDefinition = (1 << 3), + SPFlagOptimized = (1 << 4), + // Do not add values that are not supported by the minimum LLVM + // version we support! see llvm/include/llvm/IR/DebugInfoFlags.def + // (In LLVM < 8, createFunction supported these as separate bool arguments.) +}; + +inline LLVMRustDISPFlags operator&(LLVMRustDISPFlags A, LLVMRustDISPFlags B) { + return static_cast(static_cast(A) & + static_cast(B)); +} + +inline LLVMRustDISPFlags operator|(LLVMRustDISPFlags A, LLVMRustDISPFlags B) { + return static_cast(static_cast(A) | + static_cast(B)); +} + +inline LLVMRustDISPFlags &operator|=(LLVMRustDISPFlags &A, LLVMRustDISPFlags B) { + return A = A | B; +} + +inline bool isSet(LLVMRustDISPFlags F) { return F != LLVMRustDISPFlags::SPFlagZero; } + +inline LLVMRustDISPFlags virtuality(LLVMRustDISPFlags F) { + return static_cast(static_cast(F) & 0x3); +} + +#if LLVM_VERSION_GE(8, 0) +static DISubprogram::DISPFlags fromRust(LLVMRustDISPFlags SPFlags) { + DISubprogram::DISPFlags Result = DISubprogram::DISPFlags::SPFlagZero; + + switch (virtuality(SPFlags)) { + case LLVMRustDISPFlags::SPFlagVirtual: + Result |= DISubprogram::DISPFlags::SPFlagVirtual; + break; + case LLVMRustDISPFlags::SPFlagPureVirtual: + Result |= DISubprogram::DISPFlags::SPFlagPureVirtual; + break; + default: + // The rest are handled below + break; + } + + if (isSet(SPFlags & LLVMRustDISPFlags::SPFlagLocalToUnit)) { + Result |= DISubprogram::DISPFlags::SPFlagLocalToUnit; + } + if (isSet(SPFlags & LLVMRustDISPFlags::SPFlagDefinition)) { + Result |= DISubprogram::DISPFlags::SPFlagDefinition; + } + if (isSet(SPFlags & LLVMRustDISPFlags::SPFlagOptimized)) { + Result |= DISubprogram::DISPFlags::SPFlagOptimized; + } + + return Result; +} +#endif + +enum class LLVMRustDebugEmissionKind { + NoDebug, + FullDebug, + LineTablesOnly, +}; + +static DICompileUnit::DebugEmissionKind fromRust(LLVMRustDebugEmissionKind Kind) { + switch (Kind) { + case LLVMRustDebugEmissionKind::NoDebug: + return DICompileUnit::DebugEmissionKind::NoDebug; + case LLVMRustDebugEmissionKind::FullDebug: + return DICompileUnit::DebugEmissionKind::FullDebug; + case LLVMRustDebugEmissionKind::LineTablesOnly: + return DICompileUnit::DebugEmissionKind::LineTablesOnly; + default: + report_fatal_error("bad DebugEmissionKind."); + } +} + extern "C" uint32_t LLVMRustDebugMetadataVersion() { return DEBUG_METADATA_VERSION; } @@ -533,6 +605,14 @@ extern "C" uint32_t LLVMRustVersionMinor() { return LLVM_VERSION_MINOR; } extern "C" uint32_t LLVMRustVersionMajor() { return LLVM_VERSION_MAJOR; } +extern "C" bool LLVMRustIsRustLLVM() { +#ifdef LLVM_RUSTLLVM + return 1; +#else + return 0; +#endif +} + extern "C" void LLVMRustAddModuleFlag(LLVMModuleRef M, const char *Name, uint32_t Value) { unwrap(M)->addModuleFlag(Module::Warning, Name, Value); @@ -557,11 +637,13 @@ extern "C" void LLVMRustDIBuilderFinalize(LLVMRustDIBuilderRef Builder) { extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateCompileUnit( LLVMRustDIBuilderRef Builder, unsigned Lang, LLVMMetadataRef FileRef, const char *Producer, bool isOptimized, const char *Flags, - unsigned RuntimeVer, const char *SplitName) { + unsigned RuntimeVer, const char *SplitName, + LLVMRustDebugEmissionKind Kind) { auto *File = unwrapDI(FileRef); return wrap(Builder->createCompileUnit(Lang, File, Producer, isOptimized, - Flags, RuntimeVer, SplitName)); + Flags, RuntimeVer, SplitName, + fromRust(Kind))); } extern "C" LLVMMetadataRef @@ -581,16 +663,26 @@ LLVMRustDIBuilderCreateSubroutineType(LLVMRustDIBuilderRef Builder, extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction( LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, const char *LinkageName, LLVMMetadataRef File, unsigned LineNo, - LLVMMetadataRef Ty, bool IsLocalToUnit, bool IsDefinition, - unsigned ScopeLine, LLVMRustDIFlags Flags, bool IsOptimized, - LLVMValueRef Fn, LLVMMetadataRef TParam, LLVMMetadataRef Decl) { + LLVMMetadataRef Ty, unsigned ScopeLine, LLVMRustDIFlags Flags, + LLVMRustDISPFlags SPFlags, LLVMValueRef Fn, LLVMMetadataRef TParam, + LLVMMetadataRef Decl) { DITemplateParameterArray TParams = DITemplateParameterArray(unwrap(TParam)); +#if LLVM_VERSION_GE(8, 0) + DISubprogram *Sub = Builder->createFunction( + unwrapDI(Scope), Name, LinkageName, unwrapDI(File), + LineNo, unwrapDI(Ty), ScopeLine, fromRust(Flags), + fromRust(SPFlags), TParams, unwrapDIPtr(Decl)); +#else + bool IsLocalToUnit = isSet(SPFlags & LLVMRustDISPFlags::SPFlagLocalToUnit); + bool IsDefinition = isSet(SPFlags & LLVMRustDISPFlags::SPFlagDefinition); + bool IsOptimized = isSet(SPFlags & LLVMRustDISPFlags::SPFlagOptimized); DISubprogram *Sub = Builder->createFunction( unwrapDI(Scope), Name, LinkageName, unwrapDI(File), LineNo, unwrapDI(Ty), IsLocalToUnit, IsDefinition, ScopeLine, fromRust(Flags), IsOptimized, TParams, unwrapDIPtr(Decl)); +#endif unwrap(Fn)->setSubprogram(Sub); return wrap(Sub); } @@ -708,7 +800,11 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateStaticVariable( llvm::DIGlobalVariableExpression *VarExpr = Builder->createGlobalVariableExpression( unwrapDI(Context), Name, LinkageName, unwrapDI(File), LineNo, unwrapDI(Ty), IsLocalToUnit, - InitExpr, unwrapDIPtr(Decl), AlignInBits); + InitExpr, unwrapDIPtr(Decl), +#if LLVM_VERSION_GE(8, 0) + /* templateParams */ nullptr, +#endif + AlignInBits); InitVal->setMetadata("dbg", VarExpr); @@ -775,14 +871,14 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerationType( LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name, LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef Elements, - LLVMMetadataRef ClassTy, bool IsFixed) { + LLVMMetadataRef ClassTy, bool IsScoped) { #if LLVM_VERSION_GE(7, 0) return wrap(Builder->createEnumerationType( unwrapDI(Scope), Name, unwrapDI(File), LineNumber, SizeInBits, AlignInBits, DINodeArray(unwrapDI(Elements)), - unwrapDI(ClassTy), "", IsFixed)); + unwrapDI(ClassTy), "", IsScoped)); #else - // Ignore IsFixed on older LLVM. + // Ignore IsScoped on older LLVM. return wrap(Builder->createEnumerationType( unwrapDI(Scope), Name, unwrapDI(File), LineNumber, SizeInBits, AlignInBits, DINodeArray(unwrapDI(Elements)), @@ -820,11 +916,13 @@ LLVMRustDIBuilderCreateNameSpace(LLVMRustDIBuilderRef Builder, } extern "C" void -LLVMRustDICompositeTypeSetTypeArray(LLVMRustDIBuilderRef Builder, - LLVMMetadataRef CompositeTy, - LLVMMetadataRef TyArray) { +LLVMRustDICompositeTypeReplaceArrays(LLVMRustDIBuilderRef Builder, + LLVMMetadataRef CompositeTy, + LLVMMetadataRef Elements, + LLVMMetadataRef Params) { DICompositeType *Tmp = unwrapDI(CompositeTy); - Builder->replaceArrays(Tmp, DINodeArray(unwrap(TyArray))); + Builder->replaceArrays(Tmp, DINodeArray(unwrap(Elements)), + DINodeArray(unwrap(Params))); } extern "C" LLVMValueRef @@ -920,7 +1018,11 @@ extern "C" void LLVMRustUnpackOptimizationDiagnostic( if (loc.isValid()) { *Line = loc.getLine(); *Column = loc.getColumn(); +#if LLVM_VERSION_GE(8, 0) + FilenameOS << loc.getAbsolutePath(); +#else FilenameOS << loc.getFilename(); +#endif } RawRustStringOstream MessageOS(MessageOut); @@ -1423,7 +1525,6 @@ LLVMRustBuildVectorReduceFMax(LLVMBuilderRef B, LLVMValueRef Src, bool NoNaN) { return wrap(unwrap(B)->CreateFPMaxReduce(unwrap(Src), NoNaN)); } -#if LLVM_VERSION_GE(6, 0) extern "C" LLVMValueRef LLVMRustBuildMinNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) { return wrap(unwrap(B)->CreateMinNum(unwrap(LHS),unwrap(RHS))); @@ -1432,13 +1533,3 @@ extern "C" LLVMValueRef LLVMRustBuildMaxNum(LLVMBuilderRef B, LLVMValueRef LHS, LLVMValueRef RHS) { return wrap(unwrap(B)->CreateMaxNum(unwrap(LHS),unwrap(RHS))); } -#else -extern "C" LLVMValueRef -LLVMRustBuildMinNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) { - return nullptr; -} -extern "C" LLVMValueRef -LLVMRustBuildMaxNum(LLVMBuilderRef, LLVMValueRef, LLVMValueRef) { - return nullptr; -} -#endif diff --git a/src/rustllvm/llvm-rebuild-trigger b/src/rustllvm/llvm-rebuild-trigger index f8ff3d37fd2..9ee1bceb632 100644 --- a/src/rustllvm/llvm-rebuild-trigger +++ b/src/rustllvm/llvm-rebuild-trigger @@ -1,4 +1,4 @@ # If this file is modified, then llvm will be (optionally) cleaned and then rebuilt. # The actual contents of this file do not matter, but to trigger a change on the # build bots then the contents should be changed so git updates the mtime. -2018-09-16 +2019-01-16 diff --git a/src/rustllvm/rustllvm.h b/src/rustllvm/rustllvm.h index 2fd72fa749a..933266b4025 100644 --- a/src/rustllvm/rustllvm.h +++ b/src/rustllvm/rustllvm.h @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #include "llvm-c/BitReader.h" #include "llvm-c/Core.h" #include "llvm-c/ExecutionEngine.h" @@ -94,6 +84,7 @@ enum LLVMRustAttribute { SanitizeAddress = 21, SanitizeMemory = 22, NonLazyBind = 23, + OptimizeNone = 24, }; typedef struct OpaqueRustString *RustStringRef; diff --git a/src/stage0.txt b/src/stage0.txt index 9326e22090c..36d30b7d273 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -12,7 +12,7 @@ # source tarball for a stable release you'll likely see `1.x.0` for rustc and # `0.x.0` for Cargo where they were released on `date`. -date: 2018-10-30 +date: 2019-01-18 rustc: beta cargo: beta diff --git a/src/stdsimd b/src/stdsimd index 0309be1ade6..b23541340b5 160000 --- a/src/stdsimd +++ b/src/stdsimd @@ -1 +1 @@ -Subproject commit 0309be1ade6bf61066f2c69f77ac3567b7dc31b5 +Subproject commit b23541340b5941749e5fbb1930e666bbd1375244 diff --git a/src/test/COMPILER_TESTS.md b/src/test/COMPILER_TESTS.md index 81a46ea0fe7..c4ca4781343 100644 --- a/src/test/COMPILER_TESTS.md +++ b/src/test/COMPILER_TESTS.md @@ -1,4 +1,4 @@ # Compiler Test Documentation Documentation the compiler testing framework has moved to -[the rustc guide](https://rust-lang-nursery.github.io/rustc-guide/tests/intro.html). +[the rustc guide](https://rust-lang.github.io/rustc-guide/tests/intro.html). diff --git a/src/test/auxiliary/rust_test_helpers.c b/src/test/auxiliary/rust_test_helpers.c index 2a14b3da7b7..27a26d244c2 100644 --- a/src/test/auxiliary/rust_test_helpers.c +++ b/src/test/auxiliary/rust_test_helpers.c @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Helper functions used only in tests #include @@ -163,11 +153,7 @@ rust_get_null_ptr() { return 0; } -/* Debug helpers strictly to verify ABI conformance. - * - * FIXME (#2665): move these into a testcase when the testsuite - * understands how to have explicit C files included. - */ +// Debug helpers strictly to verify ABI conformance. struct quad { uint64_t a; diff --git a/src/test/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs b/src/test/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs index 49b8e43836e..ecea26dc4be 100644 --- a/src/test/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs +++ b/src/test/codegen-units/item-collection/auxiliary/cgu_export_trait_method.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub trait Trait : Sized { diff --git a/src/test/codegen-units/item-collection/auxiliary/cgu_extern_closures.rs b/src/test/codegen-units/item-collection/auxiliary/cgu_extern_closures.rs index 944d85db508..05ea0a89ff2 100644 --- a/src/test/codegen-units/item-collection/auxiliary/cgu_extern_closures.rs +++ b/src/test/codegen-units/item-collection/auxiliary/cgu_extern_closures.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #[inline] diff --git a/src/test/codegen-units/item-collection/auxiliary/cgu_generic_function.rs b/src/test/codegen-units/item-collection/auxiliary/cgu_generic_function.rs index 04c68748eca..976cbb2b44b 100644 --- a/src/test/codegen-units/item-collection/auxiliary/cgu_generic_function.rs +++ b/src/test/codegen-units/item-collection/auxiliary/cgu_generic_function.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] struct Struct(u32); diff --git a/src/test/codegen-units/item-collection/cross-crate-closures.rs b/src/test/codegen-units/item-collection/cross-crate-closures.rs index a26604d3ce9..bd04422c39f 100644 --- a/src/test/codegen-units/item-collection/cross-crate-closures.rs +++ b/src/test/codegen-units/item-collection/cross-crate-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // In the current version of the collector that still has to support // legacy-codegen, closures do not generate their own MonoItems, so we are // ignoring this test until MIR codegen has taken over completely diff --git a/src/test/codegen-units/item-collection/cross-crate-generic-functions.rs b/src/test/codegen-units/item-collection/cross-crate-generic-functions.rs index aa33c25da9a..cf7bde4a091 100644 --- a/src/test/codegen-units/item-collection/cross-crate-generic-functions.rs +++ b/src/test/codegen-units/item-collection/cross-crate-generic-functions.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/cross-crate-trait-method.rs b/src/test/codegen-units/item-collection/cross-crate-trait-method.rs index 2951ee4f6c9..8a19a7bd9f8 100644 --- a/src/test/codegen-units/item-collection/cross-crate-trait-method.rs +++ b/src/test/codegen-units/item-collection/cross-crate-trait-method.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs b/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs index cec88f1c6a2..d5ddfb5e1c2 100644 --- a/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs +++ b/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs @@ -1,20 +1,10 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus #![feature(start)] -//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ drop_in_place_intrinsic-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ drop_in_place_intrinsic-cgu.0[Internal] struct StructWithDtor(u32); impl Drop for StructWithDtor { @@ -26,7 +16,7 @@ impl Drop for StructWithDtor { #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic-cgu.0[Internal] let x = [StructWithDtor(0), StructWithDtor(1)]; drop_slice_in_place(&x); @@ -41,6 +31,7 @@ fn drop_slice_in_place(x: &[StructWithDtor]) { // not have drop-glue for the unsized [StructWithDtor]. This has to be // generated though when the drop_in_place() intrinsic is used. //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic-cgu.0[Internal] ::std::ptr::drop_in_place(x as *const _ as *mut [StructWithDtor]); } } diff --git a/src/test/codegen-units/item-collection/function-as-argument.rs b/src/test/codegen-units/item-collection/function-as-argument.rs index 9a88336d1e5..bdf6826f21a 100644 --- a/src/test/codegen-units/item-collection/function-as-argument.rs +++ b/src/test/codegen-units/item-collection/function-as-argument.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/generic-drop-glue.rs b/src/test/codegen-units/item-collection/generic-drop-glue.rs index 5afa519bc59..94e79f0b320 100644 --- a/src/test/codegen-units/item-collection/generic-drop-glue.rs +++ b/src/test/codegen-units/item-collection/generic-drop-glue.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus @@ -47,7 +37,7 @@ enum EnumNoDrop { struct NonGenericNoDrop(i32); struct NonGenericWithDrop(i32); -//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ generic_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ generic_drop_glue-cgu.0[Internal] impl Drop for NonGenericWithDrop { //~ MONO_ITEM fn generic_drop_glue::{{impl}}[2]::drop[0] @@ -57,11 +47,11 @@ impl Drop for NonGenericWithDrop { //~ MONO_ITEM fn generic_drop_glue::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0] let _ = StructWithDrop { x: 0i8, y: 'a' }.x; - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]> let _ = StructWithDrop { x: "&str", y: NonGenericNoDrop(0) }.y; @@ -70,17 +60,17 @@ fn start(_: isize, _: *const *const u8) -> isize { // This is supposed to generate drop-glue because it contains a field that // needs to be dropped. - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] let _ = StructNoDrop { x: NonGenericWithDrop(0), y: 0f64 }.y; - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0] let _ = match EnumWithDrop::A::(0) { EnumWithDrop::A(x) => x, EnumWithDrop::B(x) => x as i32 }; - //~MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] + //~MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ generic_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0] let _ = match EnumWithDrop::B::(1.0) { EnumWithDrop::A(x) => x, diff --git a/src/test/codegen-units/item-collection/generic-functions.rs b/src/test/codegen-units/item-collection/generic-functions.rs index 402d19f9996..f879724c9a1 100644 --- a/src/test/codegen-units/item-collection/generic-functions.rs +++ b/src/test/codegen-units/item-collection/generic-functions.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/generic-impl.rs b/src/test/codegen-units/item-collection/generic-impl.rs index 07e51a1e947..01b4e530183 100644 --- a/src/test/codegen-units/item-collection/generic-impl.rs +++ b/src/test/codegen-units/item-collection/generic-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs b/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs index 6d65c0d3aa8..702ecba321e 100644 --- a/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs +++ b/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/instantiation-through-vtable.rs b/src/test/codegen-units/item-collection/instantiation-through-vtable.rs index d09d343a845..e79b069b25c 100644 --- a/src/test/codegen-units/item-collection/instantiation-through-vtable.rs +++ b/src/test/codegen-units/item-collection/instantiation-through-vtable.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus @@ -34,13 +24,13 @@ impl Trait for Struct { fn start(_: isize, _: *const *const u8) -> isize { let s1 = Struct { _a: 0u32 }; - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ instantiation_through_vtable-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ instantiation_through_vtable-cgu.0[Internal] //~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0] //~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0] let _ = &s1 as &Trait; let s1 = Struct { _a: 0u64 }; - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ instantiation_through_vtable-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ instantiation_through_vtable-cgu.0[Internal] //~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0] //~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0] let _ = &s1 as &Trait; diff --git a/src/test/codegen-units/item-collection/items-within-generic-items.rs b/src/test/codegen-units/item-collection/items-within-generic-items.rs index f9813063831..748b6094a2a 100644 --- a/src/test/codegen-units/item-collection/items-within-generic-items.rs +++ b/src/test/codegen-units/item-collection/items-within-generic-items.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/non-generic-closures.rs b/src/test/codegen-units/item-collection/non-generic-closures.rs index 77ada23de71..affdda39043 100644 --- a/src/test/codegen-units/item-collection/non-generic-closures.rs +++ b/src/test/codegen-units/item-collection/non-generic-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // In the current version of the collector that still has to support // legacy-codegen, closures do not generate their own MonoItems, so we are // ignoring this test until MIR codegen has taken over completely diff --git a/src/test/codegen-units/item-collection/non-generic-drop-glue.rs b/src/test/codegen-units/item-collection/non-generic-drop-glue.rs index a939dd56cda..f13952bb781 100644 --- a/src/test/codegen-units/item-collection/non-generic-drop-glue.rs +++ b/src/test/codegen-units/item-collection/non-generic-drop-glue.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus @@ -15,7 +5,7 @@ #![deny(dead_code)] #![feature(start)] -//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ non_generic_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ non_generic_drop_glue-cgu.0[Internal] struct StructWithDrop { x: i32 } @@ -29,7 +19,7 @@ struct StructNoDrop { x: i32 } -//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ non_generic_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ non_generic_drop_glue-cgu.0[Internal] enum EnumWithDrop { A(i32) } diff --git a/src/test/codegen-units/item-collection/non-generic-functions.rs b/src/test/codegen-units/item-collection/non-generic-functions.rs index 38d08c8a6ed..e147b54fdaf 100644 --- a/src/test/codegen-units/item-collection/non-generic-functions.rs +++ b/src/test/codegen-units/item-collection/non-generic-functions.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/overloaded-operators.rs b/src/test/codegen-units/item-collection/overloaded-operators.rs index dae6ef83551..db91486012d 100644 --- a/src/test/codegen-units/item-collection/overloaded-operators.rs +++ b/src/test/codegen-units/item-collection/overloaded-operators.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/static-init.rs b/src/test/codegen-units/item-collection/static-init.rs index f36c4903458..397bccc4bf8 100644 --- a/src/test/codegen-units/item-collection/static-init.rs +++ b/src/test/codegen-units/item-collection/static-init.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zprint-mono-items=eager // ignore-tidy-linelength diff --git a/src/test/codegen-units/item-collection/statics-and-consts.rs b/src/test/codegen-units/item-collection/statics-and-consts.rs index 883809ff059..db2d83aeefa 100644 --- a/src/test/codegen-units/item-collection/statics-and-consts.rs +++ b/src/test/codegen-units/item-collection/statics-and-consts.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/trait-implementations.rs b/src/test/codegen-units/item-collection/trait-implementations.rs index f85486b5d34..004198a624e 100644 --- a/src/test/codegen-units/item-collection/trait-implementations.rs +++ b/src/test/codegen-units/item-collection/trait-implementations.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/trait-method-as-argument.rs b/src/test/codegen-units/item-collection/trait-method-as-argument.rs index 1f08f0f8060..cab4a709134 100644 --- a/src/test/codegen-units/item-collection/trait-method-as-argument.rs +++ b/src/test/codegen-units/item-collection/trait-method-as-argument.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/trait-method-default-impl.rs b/src/test/codegen-units/item-collection/trait-method-default-impl.rs index b130747972e..ba99d430acc 100644 --- a/src/test/codegen-units/item-collection/trait-method-default-impl.rs +++ b/src/test/codegen-units/item-collection/trait-method-default-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/item-collection/transitive-drop-glue.rs b/src/test/codegen-units/item-collection/transitive-drop-glue.rs index 7bbc9b6d0fb..14545a33b59 100644 --- a/src/test/codegen-units/item-collection/transitive-drop-glue.rs +++ b/src/test/codegen-units/item-collection/transitive-drop-glue.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus @@ -15,11 +5,11 @@ #![deny(dead_code)] #![feature(start)] -//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ transitive_drop_glue-cgu.0[Internal] struct Root(Intermediate); -//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ transitive_drop_glue-cgu.0[Internal] struct Intermediate(Leaf); -//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ transitive_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ transitive_drop_glue-cgu.0[Internal] struct Leaf; impl Drop for Leaf { @@ -40,15 +30,15 @@ impl Drop for LeafGen { fn start(_: isize, _: *const *const u8) -> isize { let _ = Root(Intermediate(Leaf)); - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0] let _ = RootGen(IntermediateGen(LeafGen(0u32))); - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]> @@ transitive_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0] let _ = RootGen(IntermediateGen(LeafGen(0i16))); diff --git a/src/test/codegen-units/item-collection/tuple-drop-glue.rs b/src/test/codegen-units/item-collection/tuple-drop-glue.rs index 865570ccfa5..54aff575f91 100644 --- a/src/test/codegen-units/item-collection/tuple-drop-glue.rs +++ b/src/test/codegen-units/item-collection/tuple-drop-glue.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus @@ -15,7 +5,7 @@ #![deny(dead_code)] #![feature(start)] -//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ tuple_drop_glue-cgu.0[Internal] +//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ tuple_drop_glue-cgu.0[Internal] struct Dropped; impl Drop for Dropped { @@ -26,11 +16,11 @@ impl Drop for Dropped { //~ MONO_ITEM fn tuple_drop_glue::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue-cgu.0[Internal] let x = (0u32, Dropped); - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue-cgu.0[Internal] - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue-cgu.0[Internal] let x = (0i16, (Dropped, true)); 0 diff --git a/src/test/codegen-units/item-collection/unreferenced-const-fn.rs b/src/test/codegen-units/item-collection/unreferenced-const-fn.rs index c4a49fd4ec4..5fae72f711d 100644 --- a/src/test/codegen-units/item-collection/unreferenced-const-fn.rs +++ b/src/test/codegen-units/item-collection/unreferenced-const-fn.rs @@ -1,21 +1,10 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=lazy -// NB: We do not expect *any* monomorphization to be generated here. - #![deny(dead_code)] #![crate_type = "rlib"] +//~ MONO_ITEM fn unreferenced_const_fn::foo[0] @@ unreferenced_const_fn-cgu.0[External] pub const fn foo(x: u32) -> u32 { x + 0xf00 } diff --git a/src/test/codegen-units/item-collection/unreferenced-inline-function.rs b/src/test/codegen-units/item-collection/unreferenced-inline-function.rs index 829b4fbf3c9..4c8d1215c04 100644 --- a/src/test/codegen-units/item-collection/unreferenced-inline-function.rs +++ b/src/test/codegen-units/item-collection/unreferenced-inline-function.rs @@ -1,17 +1,7 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=lazy -// NB: We do not expect *any* monomorphization to be generated here. +// N.B., we do not expect *any* monomorphization to be generated here. #![deny(dead_code)] #![crate_type = "rlib"] diff --git a/src/test/codegen-units/item-collection/unsizing.rs b/src/test/codegen-units/item-collection/unsizing.rs index 5e9a3258c7a..6b2acab7f7b 100644 --- a/src/test/codegen-units/item-collection/unsizing.rs +++ b/src/test/codegen-units/item-collection/unsizing.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager // compile-flags:-Zinline-in-all-cgus @@ -59,13 +49,13 @@ impl, U: ?Sized> CoerceUnsized> for Wrapper fn start(_: isize, _: *const *const u8) -> isize { // simple case let bool_sized = &true; - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ unsizing-cgu.0[Internal] //~ MONO_ITEM fn unsizing::{{impl}}[0]::foo[0] let _bool_unsized = bool_sized as &Trait; let char_sized = &'a'; - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ unsizing-cgu.0[Internal] //~ MONO_ITEM fn unsizing::{{impl}}[1]::foo[0] let _char_unsized = char_sized as &Trait; @@ -75,13 +65,13 @@ fn start(_: isize, _: *const *const u8) -> isize { _b: 2, _c: 3.0f64 }; - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ unsizing-cgu.0[Internal] //~ MONO_ITEM fn unsizing::{{impl}}[2]::foo[0] let _struct_unsized = struct_sized as &Struct; // custom coercion let wrapper_sized = Wrapper(&0u32); - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ unsizing-cgu.0[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ unsizing-cgu.0[Internal] //~ MONO_ITEM fn unsizing::{{impl}}[3]::foo[0] let _wrapper_sized = wrapper_sized as Wrapper; diff --git a/src/test/codegen-units/item-collection/unused-traits-and-generics.rs b/src/test/codegen-units/item-collection/unused-traits-and-generics.rs index 2edc7b211a1..598efdbdad1 100644 --- a/src/test/codegen-units/item-collection/unused-traits-and-generics.rs +++ b/src/test/codegen-units/item-collection/unused-traits-and-generics.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager diff --git a/src/test/codegen-units/partitioning/auxiliary/cgu_explicit_inlining.rs b/src/test/codegen-units/partitioning/auxiliary/cgu_explicit_inlining.rs index e4ba9fae412..4a3a63cc1b4 100644 --- a/src/test/codegen-units/partitioning/auxiliary/cgu_explicit_inlining.rs +++ b/src/test/codegen-units/partitioning/auxiliary/cgu_explicit_inlining.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #[inline] diff --git a/src/test/codegen-units/partitioning/auxiliary/cgu_extern_drop_glue.rs b/src/test/codegen-units/partitioning/auxiliary/cgu_extern_drop_glue.rs index 049bdb46579..b5fec23375a 100644 --- a/src/test/codegen-units/partitioning/auxiliary/cgu_extern_drop_glue.rs +++ b/src/test/codegen-units/partitioning/auxiliary/cgu_extern_drop_glue.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub struct Struct(pub u32); diff --git a/src/test/codegen-units/partitioning/auxiliary/cgu_generic_function.rs b/src/test/codegen-units/partitioning/auxiliary/cgu_generic_function.rs index 04c68748eca..976cbb2b44b 100644 --- a/src/test/codegen-units/partitioning/auxiliary/cgu_generic_function.rs +++ b/src/test/codegen-units/partitioning/auxiliary/cgu_generic_function.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] struct Struct(u32); diff --git a/src/test/codegen-units/partitioning/auxiliary/shared_generics_aux.rs b/src/test/codegen-units/partitioning/auxiliary/shared_generics_aux.rs index b742da8a900..d50a7910fe0 100644 --- a/src/test/codegen-units/partitioning/auxiliary/shared_generics_aux.rs +++ b/src/test/codegen-units/partitioning/auxiliary/shared_generics_aux.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zshare-generics=yes #![crate_type="rlib"] diff --git a/src/test/codegen-units/partitioning/extern-drop-glue.rs b/src/test/codegen-units/partitioning/extern-drop-glue.rs index cbad3a63884..0f3d72d16a9 100644 --- a/src/test/codegen-units/partitioning/extern-drop-glue.rs +++ b/src/test/codegen-units/partitioning/extern-drop-glue.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for @@ -21,14 +11,14 @@ // aux-build:cgu_extern_drop_glue.rs extern crate cgu_extern_drop_glue; -//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ extern_drop_glue[Internal] extern_drop_glue-mod1[Internal] +//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ extern_drop_glue[Internal] extern_drop_glue-mod1[Internal] struct LocalStruct(cgu_extern_drop_glue::Struct); //~ MONO_ITEM fn extern_drop_glue::user[0] @@ extern_drop_glue[External] pub fn user() { - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ extern_drop_glue[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ extern_drop_glue[Internal] let _ = LocalStruct(cgu_extern_drop_glue::Struct(0)); } @@ -40,7 +30,7 @@ pub mod mod1 { //~ MONO_ITEM fn extern_drop_glue::mod1[0]::user[0] @@ extern_drop_glue-mod1[External] pub fn user() { - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ extern_drop_glue-mod1[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ extern_drop_glue-mod1[Internal] let _ = LocalStruct(cgu_extern_drop_glue::Struct(0)); } } diff --git a/src/test/codegen-units/partitioning/extern-generic.rs b/src/test/codegen-units/partitioning/extern-generic.rs index e604d6a92c2..c96c54312fb 100644 --- a/src/test/codegen-units/partitioning/extern-generic.rs +++ b/src/test/codegen-units/partitioning/extern-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation diff --git a/src/test/codegen-units/partitioning/inlining-from-extern-crate.rs b/src/test/codegen-units/partitioning/inlining-from-extern-crate.rs index 4136557d800..e943f54a406 100644 --- a/src/test/codegen-units/partitioning/inlining-from-extern-crate.rs +++ b/src/test/codegen-units/partitioning/inlining-from-extern-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation diff --git a/src/test/codegen-units/partitioning/local-drop-glue.rs b/src/test/codegen-units/partitioning/local-drop-glue.rs index 98729d99ea9..938d4ffb693 100644 --- a/src/test/codegen-units/partitioning/local-drop-glue.rs +++ b/src/test/codegen-units/partitioning/local-drop-glue.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation @@ -17,7 +7,7 @@ #![allow(dead_code)] #![crate_type="rlib"] -//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ local_drop_glue[Internal] local_drop_glue-mod1[Internal] +//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ local_drop_glue[Internal] local_drop_glue-mod1[Internal] struct Struct { _a: u32 } @@ -27,7 +17,7 @@ impl Drop for Struct { fn drop(&mut self) {} } -//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ local_drop_glue[Internal] +//~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ local_drop_glue[Internal] struct Outer { _a: Struct } @@ -46,10 +36,10 @@ pub mod mod1 { use super::Struct; - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ local_drop_glue-mod1[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ local_drop_glue-mod1[Internal] struct Struct2 { _a: Struct, - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, local_drop_glue::Struct[0])> @@ local_drop_glue-mod1[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0]<(u32, local_drop_glue::Struct[0])> @@ local_drop_glue-mod1[Internal] _b: (u32, Struct), } diff --git a/src/test/codegen-units/partitioning/local-generic.rs b/src/test/codegen-units/partitioning/local-generic.rs index 7c8ca20e1e3..dcff638b0b1 100644 --- a/src/test/codegen-units/partitioning/local-generic.rs +++ b/src/test/codegen-units/partitioning/local-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation diff --git a/src/test/codegen-units/partitioning/local-inlining-but-not-all.rs b/src/test/codegen-units/partitioning/local-inlining-but-not-all.rs index 747f768c11f..18211fad31e 100644 --- a/src/test/codegen-units/partitioning/local-inlining-but-not-all.rs +++ b/src/test/codegen-units/partitioning/local-inlining-but-not-all.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation diff --git a/src/test/codegen-units/partitioning/local-inlining.rs b/src/test/codegen-units/partitioning/local-inlining.rs index f144f0d992b..7aa83e4bf41 100644 --- a/src/test/codegen-units/partitioning/local-inlining.rs +++ b/src/test/codegen-units/partitioning/local-inlining.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation diff --git a/src/test/codegen-units/partitioning/local-transitive-inlining.rs b/src/test/codegen-units/partitioning/local-transitive-inlining.rs index 8637844a83d..5bc56146794 100644 --- a/src/test/codegen-units/partitioning/local-transitive-inlining.rs +++ b/src/test/codegen-units/partitioning/local-transitive-inlining.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation diff --git a/src/test/codegen-units/partitioning/methods-are-with-self-type.rs b/src/test/codegen-units/partitioning/methods-are-with-self-type.rs index ff25a7194e0..c2961ed9322 100644 --- a/src/test/codegen-units/partitioning/methods-are-with-self-type.rs +++ b/src/test/codegen-units/partitioning/methods-are-with-self-type.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Currently, all generic functions are instantiated in each codegen unit that // uses them, even those not marked with #[inline], so this test does not make // much sense at the moment. diff --git a/src/test/codegen-units/partitioning/regular-modules.rs b/src/test/codegen-units/partitioning/regular-modules.rs index e1ec6f51b30..f42dc3dfc17 100644 --- a/src/test/codegen-units/partitioning/regular-modules.rs +++ b/src/test/codegen-units/partitioning/regular-modules.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation diff --git a/src/test/codegen-units/partitioning/shared-generics.rs b/src/test/codegen-units/partitioning/shared-generics.rs index 8c261f967ca..010412b8bae 100644 --- a/src/test/codegen-units/partitioning/shared-generics.rs +++ b/src/test/codegen-units/partitioning/shared-generics.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Zprint-mono-items=eager -Zshare-generics=yes -Zincremental=tmp/partitioning-tests/shared-generics-exe diff --git a/src/test/codegen-units/partitioning/statics.rs b/src/test/codegen-units/partitioning/statics.rs index b6c1e5210da..40483318795 100644 --- a/src/test/codegen-units/partitioning/statics.rs +++ b/src/test/codegen-units/partitioning/statics.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for // incremental compilation diff --git a/src/test/codegen-units/partitioning/vtable-through-const.rs b/src/test/codegen-units/partitioning/vtable-through-const.rs index ebda08a29f6..5d23a4e13cb 100644 --- a/src/test/codegen-units/partitioning/vtable-through-const.rs +++ b/src/test/codegen-units/partitioning/vtable-through-const.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // We specify -Z incremental here because we want to test the partitioning for @@ -76,7 +66,7 @@ mod mod1 { //~ MONO_ITEM fn vtable_through_const::start[0] #[start] fn start(_: isize, _: *const *const u8) -> isize { - //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0] @@ vtable_through_const[Internal] + //~ MONO_ITEM fn core::ptr[0]::real_drop_in_place[0] @@ vtable_through_const[Internal] // Since Trait1::do_something() is instantiated via its default implementation, // it is considered a generic and is instantiated here only because it is diff --git a/src/test/codegen/abi-main-signature-16bit-c-int.rs b/src/test/codegen/abi-main-signature-16bit-c-int.rs index df5cba1c244..d7b8c48c33e 100644 --- a/src/test/codegen/abi-main-signature-16bit-c-int.rs +++ b/src/test/codegen/abi-main-signature-16bit-c-int.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks the signature of the implicitly generated native main() // entry point. It must match C's `int main(int, char **)`. diff --git a/src/test/codegen/abi-main-signature-32bit-c-int.rs b/src/test/codegen/abi-main-signature-32bit-c-int.rs index 3139749dfcb..c7aab09edec 100644 --- a/src/test/codegen/abi-main-signature-32bit-c-int.rs +++ b/src/test/codegen/abi-main-signature-32bit-c-int.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks the signature of the implicitly generated native main() // entry point. It must match C's `int main(int, char **)`. diff --git a/src/test/codegen/abi-sysv64.rs b/src/test/codegen/abi-sysv64.rs index 920f5cbcca3..6456ad47615 100644 --- a/src/test/codegen/abi-sysv64.rs +++ b/src/test/codegen/abi-sysv64.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks if the correct annotation for the sysv64 ABI is passed to // llvm. Also checks that the abi-sysv64 feature gate allows usage // of the sysv64 abi. diff --git a/src/test/codegen/abi-x86-interrupt.rs b/src/test/codegen/abi-x86-interrupt.rs index e0b37cb2f32..db215860f20 100644 --- a/src/test/codegen/abi-x86-interrupt.rs +++ b/src/test/codegen/abi-x86-interrupt.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks if the correct annotation for the x86-interrupt ABI is passed to // llvm. Also checks that the abi_x86_interrupt feature gate allows usage // of the x86-interrupt abi. diff --git a/src/test/codegen/abi-x86_64_sysv.rs b/src/test/codegen/abi-x86_64_sysv.rs index 88666e9c1fd..84e06023e9c 100644 --- a/src/test/codegen/abi-x86_64_sysv.rs +++ b/src/test/codegen/abi-x86_64_sysv.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // only-x86_64 // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/adjustments.rs b/src/test/codegen/adjustments.rs index 2b35d454739..b8398f6ac84 100644 --- a/src/test/codegen/adjustments.rs +++ b/src/test/codegen/adjustments.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes // ignore-tidy-linelength diff --git a/src/test/codegen/align-struct.rs b/src/test/codegen/align-struct.rs index 887c43c6761..c0d6a0c80e1 100644 --- a/src/test/codegen/align-struct.rs +++ b/src/test/codegen/align-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes // ignore-tidy-linelength // min-llvm-version 7.0 diff --git a/src/test/codegen/alloc-optimisation.rs b/src/test/codegen/alloc-optimisation.rs index 6705bbd5b9e..64cc7776a2a 100644 --- a/src/test/codegen/alloc-optimisation.rs +++ b/src/test/codegen/alloc-optimisation.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // no-system-llvm // compile-flags: -O diff --git a/src/test/codegen/auxiliary/nounwind.rs b/src/test/codegen/auxiliary/nounwind.rs index 5e40e8ede15..73c5aee3387 100644 --- a/src/test/codegen/auxiliary/nounwind.rs +++ b/src/test/codegen/auxiliary/nounwind.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub fn bar() { } diff --git a/src/test/codegen/box-maybe-uninit.rs b/src/test/codegen/box-maybe-uninit.rs index 168e1a3eba0..a7fb74c0473 100644 --- a/src/test/codegen/box-maybe-uninit.rs +++ b/src/test/codegen/box-maybe-uninit.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O #![crate_type="lib"] #![feature(maybe_uninit)] diff --git a/src/test/codegen/call-metadata.rs b/src/test/codegen/call-metadata.rs index 1b92ff60226..030a58441e3 100644 --- a/src/test/codegen/call-metadata.rs +++ b/src/test/codegen/call-metadata.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks that range metadata gets emitted on calls to functions returning a // scalar value. diff --git a/src/test/codegen/coercions.rs b/src/test/codegen/coercions.rs index c8c9f5b407c..d645ca6b13a 100644 --- a/src/test/codegen/coercions.rs +++ b/src/test/codegen/coercions.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/consts.rs b/src/test/codegen/consts.rs index 301f5544486..e0843f5ff08 100644 --- a/src/test/codegen/consts.rs +++ b/src/test/codegen/consts.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes // ignore-tidy-linelength // min-llvm-version 7.0 diff --git a/src/test/codegen/dealloc-no-unwind.rs b/src/test/codegen/dealloc-no-unwind.rs index 12d1bed0cba..0496fb1dbff 100644 --- a/src/test/codegen/dealloc-no-unwind.rs +++ b/src/test/codegen/dealloc-no-unwind.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // no-system-llvm // compile-flags: -O diff --git a/src/test/codegen/dllimports/auxiliary/dummy.rs b/src/test/codegen/dllimports/auxiliary/dummy.rs index 06001c6b014..113a164f145 100644 --- a/src/test/codegen/dllimports/auxiliary/dummy.rs +++ b/src/test/codegen/dllimports/auxiliary/dummy.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "staticlib"] diff --git a/src/test/codegen/dllimports/auxiliary/wrapper.rs b/src/test/codegen/dllimports/auxiliary/wrapper.rs index c03f88092e5..7aa90920a3e 100644 --- a/src/test/codegen/dllimports/auxiliary/wrapper.rs +++ b/src/test/codegen/dllimports/auxiliary/wrapper.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/codegen/dllimports/main.rs b/src/test/codegen/dllimports/main.rs index d0fafbdd044..40bbd2821ef 100644 --- a/src/test/codegen/dllimports/main.rs +++ b/src/test/codegen/dllimports/main.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test is for *-windows-msvc only. // ignore-android // ignore-bitrig diff --git a/src/test/codegen/drop.rs b/src/test/codegen/drop.rs index 1961060c2c2..7e6f8eaaa30 100644 --- a/src/test/codegen/drop.rs +++ b/src/test/codegen/drop.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/enum-bounds-check.rs b/src/test/codegen/enum-bounds-check.rs index 4cfb5a752df..21a27c9f35d 100644 --- a/src/test/codegen/enum-bounds-check.rs +++ b/src/test/codegen/enum-bounds-check.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O #![crate_type = "lib"] diff --git a/src/test/codegen/enum-debug-clike.rs b/src/test/codegen/enum-debug-clike.rs index 528e84b298c..62cfef5a845 100644 --- a/src/test/codegen/enum-debug-clike.rs +++ b/src/test/codegen/enum-debug-clike.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test depends on a patch that was committed to upstream LLVM // before 7.0, then backported to the Rust LLVM fork. It tests that // debug info for "c-like" enums is properly emitted. @@ -18,8 +8,11 @@ // compile-flags: -g -C no-prepopulate-passes +// DIFlagFixedEnum was deprecated in 8.0, renamed to DIFlagEnumClass. +// We match either for compatibility. + // CHECK-LABEL: @main -// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_enumeration_type,{{.*}}name: "E",{{.*}}flags: DIFlagFixedEnum,{{.*}} +// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_enumeration_type,{{.*}}name: "E",{{.*}}flags: {{(DIFlagEnumClass|DIFlagFixedEnum)}},{{.*}} // CHECK: {{.*}}DIEnumerator{{.*}}name: "A",{{.*}}value: {{[0-9].*}} // CHECK: {{.*}}DIEnumerator{{.*}}name: "B",{{.*}}value: {{[0-9].*}} // CHECK: {{.*}}DIEnumerator{{.*}}name: "C",{{.*}}value: {{[0-9].*}} diff --git a/src/test/codegen/enum-debug-niche-2.rs b/src/test/codegen/enum-debug-niche-2.rs index c0ee05110fc..369fa1fcfda 100644 --- a/src/test/codegen/enum-debug-niche-2.rs +++ b/src/test/codegen/enum-debug-niche-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test depends on a patch that was committed to upstream LLVM // before 7.0, then backported to the Rust LLVM fork. It tests that // optimized enum debug info accurately reflects the enum layout. diff --git a/src/test/codegen/enum-debug-niche.rs b/src/test/codegen/enum-debug-niche.rs index 6326ba93266..1273a785ba4 100644 --- a/src/test/codegen/enum-debug-niche.rs +++ b/src/test/codegen/enum-debug-niche.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test depends on a patch that was committed to upstream LLVM // before 7.0, then backported to the Rust LLVM fork. It tests that // optimized enum debug info accurately reflects the enum layout. diff --git a/src/test/codegen/enum-debug-tagged.rs b/src/test/codegen/enum-debug-tagged.rs index e862d29c940..5c37e40c270 100644 --- a/src/test/codegen/enum-debug-tagged.rs +++ b/src/test/codegen/enum-debug-tagged.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test depends on a patch that was committed to upstream LLVM // before 7.0, then backported to the Rust LLVM fork. It tests that // debug info for tagged (ordinary) enums is properly emitted. diff --git a/src/test/codegen/exact_div.rs b/src/test/codegen/exact_div.rs index 9ba6c0c0006..6a55b492cb1 100644 --- a/src/test/codegen/exact_div.rs +++ b/src/test/codegen/exact_div.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/export-no-mangle.rs b/src/test/codegen/export-no-mangle.rs index 3546284f9a3..78d41e4be0a 100644 --- a/src/test/codegen/export-no-mangle.rs +++ b/src/test/codegen/export-no-mangle.rs @@ -1,12 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/extern-functions.rs b/src/test/codegen/extern-functions.rs index 90ee0c75680..a935d886522 100644 --- a/src/test/codegen/extern-functions.rs +++ b/src/test/codegen/extern-functions.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/external-no-mangle-fns.rs b/src/test/codegen/external-no-mangle-fns.rs index 3f092b802f9..79d5dc2400c 100644 --- a/src/test/codegen/external-no-mangle-fns.rs +++ b/src/test/codegen/external-no-mangle-fns.rs @@ -1,15 +1,5 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -O -// `#[no_mangle]`d functions always have external linkage, i.e. no `internal` in their `define`s +// compile-flags: -C no-prepopulate-passes +// `#[no_mangle]`d functions always have external linkage, i.e., no `internal` in their `define`s #![crate_type = "lib"] #![no_std] @@ -43,7 +33,7 @@ const HIDDEN: () = { }; // The surrounding item should not accidentally become external -// CHECK: define internal {{.*}} void @_ZN22external_no_mangle_fns1x +// CHECK: define internal{{.*}} void @_ZN22external_no_mangle_fns1x #[inline(never)] fn x() { // CHECK: define void @g() diff --git a/src/test/codegen/external-no-mangle-statics.rs b/src/test/codegen/external-no-mangle-statics.rs index 59d829633e5..2998000180e 100644 --- a/src/test/codegen/external-no-mangle-statics.rs +++ b/src/test/codegen/external-no-mangle-statics.rs @@ -1,15 +1,5 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O -// `#[no_mangle]`d static variables always have external linkage, i.e. no `internal` in their +// `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their // definitions #![crate_type = "lib"] diff --git a/src/test/codegen/fastcall-inreg.rs b/src/test/codegen/fastcall-inreg.rs index 77e3781961f..e152e6e9d13 100644 --- a/src/test/codegen/fastcall-inreg.rs +++ b/src/test/codegen/fastcall-inreg.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks if the "fastcall" calling convention marks function arguments // as "inreg" like the C/C++ compilers for the platforms. // x86 only. diff --git a/src/test/codegen/fatptr.rs b/src/test/codegen/fatptr.rs index b9e6508dfff..1c49b5714ef 100644 --- a/src/test/codegen/fatptr.rs +++ b/src/test/codegen/fatptr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/float_math.rs b/src/test/codegen/float_math.rs index 6a6d6f90b2e..592e09452df 100644 --- a/src/test/codegen/float_math.rs +++ b/src/test/codegen/float_math.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/force-frame-pointers.rs b/src/test/codegen/force-frame-pointers.rs index f70e3667198..c6c1da2c1b0 100644 --- a/src/test/codegen/force-frame-pointers.rs +++ b/src/test/codegen/force-frame-pointers.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // compile-flags: -C no-prepopulate-passes -C force-frame-pointers=y diff --git a/src/test/codegen/function-arguments.rs b/src/test/codegen/function-arguments.rs index 5061d9a915e..c2d697fd046 100644 --- a/src/test/codegen/function-arguments.rs +++ b/src/test/codegen/function-arguments.rs @@ -1,16 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes // ignore-tidy-linelength -// min-llvm-version 6.0 #![crate_type = "lib"] #![feature(custom_attribute)] @@ -29,37 +18,37 @@ pub fn boolean(x: bool) -> bool { x } -// CHECK: @readonly_borrow(i32* noalias readonly dereferenceable(4) %arg0) +// CHECK: @readonly_borrow(i32* noalias readonly align 4 dereferenceable(4) %arg0) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn readonly_borrow(_: &i32) { } -// CHECK: @static_borrow(i32* noalias readonly dereferenceable(4) %arg0) +// CHECK: @static_borrow(i32* noalias readonly align 4 dereferenceable(4) %arg0) // static borrow may be captured #[no_mangle] pub fn static_borrow(_: &'static i32) { } -// CHECK: @named_borrow(i32* noalias readonly dereferenceable(4) %arg0) +// CHECK: @named_borrow(i32* noalias readonly align 4 dereferenceable(4) %arg0) // borrow with named lifetime may be captured #[no_mangle] pub fn named_borrow<'r>(_: &'r i32) { } -// CHECK: @unsafe_borrow(i16* dereferenceable(2) %arg0) +// CHECK: @unsafe_borrow(i16* align 2 dereferenceable(2) %arg0) // unsafe interior means this isn't actually readonly and there may be aliases ... #[no_mangle] pub fn unsafe_borrow(_: &UnsafeInner) { } -// CHECK: @mutable_unsafe_borrow(i16* dereferenceable(2) %arg0) +// CHECK: @mutable_unsafe_borrow(i16* align 2 dereferenceable(2) %arg0) // ... unless this is a mutable borrow, those never alias #[no_mangle] pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) { } -// CHECK: @mutable_borrow(i32* dereferenceable(4) %arg0) +// CHECK: @mutable_borrow(i32* align 4 dereferenceable(4) %arg0) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn mutable_borrow(_: &mut i32) { @@ -70,13 +59,13 @@ pub fn mutable_borrow(_: &mut i32) { pub fn indirect_struct(_: S) { } -// CHECK: @borrowed_struct(%S* noalias readonly dereferenceable(32) %arg0) +// CHECK: @borrowed_struct(%S* noalias readonly align 4 dereferenceable(32) %arg0) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn borrowed_struct(_: &S) { } -// CHECK: noalias align 4 dereferenceable(4) i32* @_box(i32* noalias dereferenceable(4) %x) +// CHECK: noalias align 4 dereferenceable(4) i32* @_box(i32* noalias align 4 dereferenceable(4) %x) #[no_mangle] pub fn _box(x: Box) -> Box { x @@ -96,48 +85,48 @@ pub fn struct_return() -> S { pub fn helper(_: usize) { } -// CHECK: @slice([0 x i8]* noalias nonnull readonly %arg0.0, [[USIZE]] %arg0.1) +// CHECK: @slice([0 x i8]* noalias nonnull readonly align 1 %arg0.0, [[USIZE]] %arg0.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn slice(_: &[u8]) { } -// CHECK: @mutable_slice([0 x i8]* nonnull %arg0.0, [[USIZE]] %arg0.1) +// CHECK: @mutable_slice([0 x i8]* nonnull align 1 %arg0.0, [[USIZE]] %arg0.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn mutable_slice(_: &mut [u8]) { } -// CHECK: @unsafe_slice([0 x i16]* nonnull %arg0.0, [[USIZE]] %arg0.1) +// CHECK: @unsafe_slice([0 x i16]* nonnull align 2 %arg0.0, [[USIZE]] %arg0.1) // unsafe interior means this isn't actually readonly and there may be aliases ... #[no_mangle] pub fn unsafe_slice(_: &[UnsafeInner]) { } -// CHECK: @str([0 x i8]* noalias nonnull readonly %arg0.0, [[USIZE]] %arg0.1) +// CHECK: @str([0 x i8]* noalias nonnull readonly align 1 %arg0.0, [[USIZE]] %arg0.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn str(_: &[u8]) { } -// CHECK: @trait_borrow({}* nonnull %arg0.0, [3 x [[USIZE]]]* noalias readonly dereferenceable({{.*}}) %arg0.1) +// CHECK: @trait_borrow({}* nonnull align 1 %arg0.0, [3 x [[USIZE]]]* noalias readonly align {{.*}} dereferenceable({{.*}}) %arg0.1) // FIXME #25759 This should also have `nocapture` #[no_mangle] pub fn trait_borrow(_: &Drop) { } -// CHECK: @trait_box({}* noalias nonnull, [3 x [[USIZE]]]* noalias readonly dereferenceable({{.*}})) +// CHECK: @trait_box({}* noalias nonnull align 1, [3 x [[USIZE]]]* noalias readonly align {{.*}} dereferenceable({{.*}})) #[no_mangle] pub fn trait_box(_: Box) { } -// CHECK: { i8*, i8* } @trait_option(i8* noalias %x.0, i8* %x.1) +// CHECK: { i8*, i8* } @trait_option(i8* noalias align 1 %x.0, i8* %x.1) #[no_mangle] pub fn trait_option(x: Option>) -> Option> { x } -// CHECK: { [0 x i16]*, [[USIZE]] } @return_slice([0 x i16]* noalias nonnull readonly %x.0, [[USIZE]] %x.1) +// CHECK: { [0 x i16]*, [[USIZE]] } @return_slice([0 x i16]* noalias nonnull readonly align 2 %x.0, [[USIZE]] %x.1) #[no_mangle] pub fn return_slice(x: &[u16]) -> &[u16] { x diff --git a/src/test/codegen/gdb_debug_script_load.rs b/src/test/codegen/gdb_debug_script_load.rs index efaca29752b..2e8dc7b6f36 100644 --- a/src/test/codegen/gdb_debug_script_load.rs +++ b/src/test/codegen/gdb_debug_script_load.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // ignore-windows // ignore-macos diff --git a/src/test/codegen/generic-debug.rs b/src/test/codegen/generic-debug.rs new file mode 100644 index 00000000000..0bee2a1a868 --- /dev/null +++ b/src/test/codegen/generic-debug.rs @@ -0,0 +1,18 @@ +// ignore-tidy-linelength +// ignore-windows + +// compile-flags: -g -C no-prepopulate-passes + +// CHECK-LABEL: @main +// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_structure_type,{{.*}}name: "Generic",{{.*}} +// CHECK: {{.*}}DITemplateTypeParameter{{.*}}name: "Type",{{.*}} + +#![allow(dead_code)] +#![allow(unused_variables)] +#![allow(unused_assignments)] + +pub struct Generic(Type); + +fn main () { + let generic = Generic(10); +} diff --git a/src/test/codegen/global_asm.rs b/src/test/codegen/global_asm.rs index 6b79e79fa00..57d8aeb165b 100644 --- a/src/test/codegen/global_asm.rs +++ b/src/test/codegen/global_asm.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-aarch64 // ignore-aarch64_be // ignore-arm diff --git a/src/test/codegen/global_asm_include.rs b/src/test/codegen/global_asm_include.rs index 3f73a1cabbf..44402619c43 100644 --- a/src/test/codegen/global_asm_include.rs +++ b/src/test/codegen/global_asm_include.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-aarch64 // ignore-aarch64_be // ignore-arm diff --git a/src/test/codegen/global_asm_x2.rs b/src/test/codegen/global_asm_x2.rs index 3e118a50d45..d632d0dde00 100644 --- a/src/test/codegen/global_asm_x2.rs +++ b/src/test/codegen/global_asm_x2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-aarch64 // ignore-aarch64_be // ignore-arm diff --git a/src/test/codegen/inline-always-works-always.rs b/src/test/codegen/inline-always-works-always.rs new file mode 100644 index 00000000000..912af782a8f --- /dev/null +++ b/src/test/codegen/inline-always-works-always.rs @@ -0,0 +1,21 @@ +// revisions: NO-OPT SIZE-OPT SPEED-OPT +//[NO-OPT] compile-flags: -Copt-level=0 +//[SIZE-OPT] compile-flags: -Copt-level=s +//[SPEED-OPT] compile-flags: -Copt-level=3 + +#![crate_type="rlib"] + +#[no_mangle] +#[inline(always)] +pub extern "C" fn callee() -> u32 { + 4 + 4 +} + +// CHECK-LABEL: caller +// SIZE-OPT: ret i32 8 +// SPEED-OPT: ret i32 8 +// NO-OPT: ret i32 8 +#[no_mangle] +pub extern "C" fn caller() -> u32 { + callee() +} diff --git a/src/test/codegen/internalize-closures.rs b/src/test/codegen/internalize-closures.rs index 90aafd6a3bb..3434820aa8a 100644 --- a/src/test/codegen/internalize-closures.rs +++ b/src/test/codegen/internalize-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes pub fn main() { diff --git a/src/test/codegen/intrinsic-no-unnamed-attr.rs b/src/test/codegen/intrinsic-no-unnamed-attr.rs index 0f239c84265..c8a8e0b3e7a 100644 --- a/src/test/codegen/intrinsic-no-unnamed-attr.rs +++ b/src/test/codegen/intrinsic-no-unnamed-attr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![feature(intrinsics)] diff --git a/src/test/codegen/issue-13018.rs b/src/test/codegen/issue-13018.rs index ad8ef3329c1..e30662c8df6 100644 --- a/src/test/codegen/issue-13018.rs +++ b/src/test/codegen/issue-13018.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test FIXME swt_ignore // compile-flags: -O diff --git a/src/test/codegen/issue-15953.rs b/src/test/codegen/issue-15953.rs index 320ea6b5cc4..28d28428904 100644 --- a/src/test/codegen/issue-15953.rs +++ b/src/test/codegen/issue-15953.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that llvm generates `memcpy` for moving a value // inside a function and moving an argument. diff --git a/src/test/codegen/issue-32031.rs b/src/test/codegen/issue-32031.rs index e5ec1738545..cf672266bc7 100644 --- a/src/test/codegen/issue-32031.rs +++ b/src/test/codegen/issue-32031.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/issue-32364.rs b/src/test/codegen/issue-32364.rs index 8feb10b5757..85493a4bb73 100644 --- a/src/test/codegen/issue-32364.rs +++ b/src/test/codegen/issue-32364.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `extern "stdcall"` is properly translated. // only-x86 diff --git a/src/test/codegen/issue-34947-pow-i32.rs b/src/test/codegen/issue-34947-pow-i32.rs index 03538a8ee77..403d09a184b 100644 --- a/src/test/codegen/issue-34947-pow-i32.rs +++ b/src/test/codegen/issue-34947-pow-i32.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O #![crate_type = "lib"] diff --git a/src/test/codegen/issue-37945.rs b/src/test/codegen/issue-37945.rs index a36a50415ad..0ca42b7ec83 100644 --- a/src/test/codegen/issue-37945.rs +++ b/src/test/codegen/issue-37945.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O // ignore-x86 // ignore-arm diff --git a/src/test/codegen/issue-44056-macos-tls-align.rs b/src/test/codegen/issue-44056-macos-tls-align.rs index b146e106aa1..eee59be629b 100644 --- a/src/test/codegen/issue-44056-macos-tls-align.rs +++ b/src/test/codegen/issue-44056-macos-tls-align.rs @@ -1,17 +1,6 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // only-macos // no-system-llvm -// min-llvm-version 6.0 // compile-flags: -O #![crate_type = "rlib"] diff --git a/src/test/codegen/issue-45222.rs b/src/test/codegen/issue-45222.rs index 63b34abf9e3..8ef0aaa0db0 100644 --- a/src/test/codegen/issue-45222.rs +++ b/src/test/codegen/issue-45222.rs @@ -1,15 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O -// min-llvm-version 6.0 #![crate_type = "lib"] #![no_trace] @@ -70,6 +59,6 @@ fn foo3r(n: u64) -> u64 { // CHECK-LABEL: @check_foo3r #[no_mangle] pub fn check_foo3r() -> u64 { - // CHECK: ret i64 500005000000000 - foo3r(100000) + // CHECK: ret i64 500050000000 + foo3r(10000) } diff --git a/src/test/codegen/issue-45466.rs b/src/test/codegen/issue-45466.rs index 2d39ed57ca7..8fa1d35da37 100644 --- a/src/test/codegen/issue-45466.rs +++ b/src/test/codegen/issue-45466.rs @@ -1,15 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O -// min-llvm-version 6.0 #![crate_type="rlib"] #![no_trace] diff --git a/src/test/codegen/issue-47278.rs b/src/test/codegen/issue-47278.rs index 21858b434bf..590e8ea8502 100644 --- a/src/test/codegen/issue-47278.rs +++ b/src/test/codegen/issue-47278.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // -C no-prepopulate-passes #![crate_type="staticlib"] diff --git a/src/test/codegen/issue-47442.rs b/src/test/codegen/issue-47442.rs index d0c9932e4e2..6944336d335 100644 --- a/src/test/codegen/issue-47442.rs +++ b/src/test/codegen/issue-47442.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that we don't emit unneeded `resume` cleanup blocks for every // destructor. diff --git a/src/test/codegen/issue-56267-2.rs b/src/test/codegen/issue-56267-2.rs new file mode 100644 index 00000000000..53b83f4a530 --- /dev/null +++ b/src/test/codegen/issue-56267-2.rs @@ -0,0 +1,18 @@ +// compile-flags: -C no-prepopulate-passes + +#![crate_type="rlib"] + +#[allow(dead_code)] +pub struct Foo { + foo: u64, + bar: T, +} + +// The load from bar.1 should have alignment 4. Not checking +// other loads here, as the alignment will be platform-dependent. + +// CHECK: %{{.+}} = load i32, i32* %{{.+}}, align 4 +#[no_mangle] +pub fn test(x: Foo<(i32, i32)>) -> (i32, i32) { + x.bar +} diff --git a/src/test/codegen/issue-56267.rs b/src/test/codegen/issue-56267.rs new file mode 100644 index 00000000000..2c33f558931 --- /dev/null +++ b/src/test/codegen/issue-56267.rs @@ -0,0 +1,18 @@ +// compile-flags: -C no-prepopulate-passes + +#![crate_type="rlib"] + +#[allow(dead_code)] +pub struct Foo { + foo: u64, + bar: T, +} + +// The store writing to bar.1 should have alignment 4. Not checking +// other stores here, as the alignment will be platform-dependent. + +// CHECK: store i32 [[TMP1:%.+]], i32* [[TMP2:%.+]], align 4 +#[no_mangle] +pub fn test(x: (i32, i32)) -> Foo<(i32, i32)> { + Foo { foo: 0, bar: x } +} diff --git a/src/test/codegen/issue-56927.rs b/src/test/codegen/issue-56927.rs new file mode 100644 index 00000000000..0544ff86aac --- /dev/null +++ b/src/test/codegen/issue-56927.rs @@ -0,0 +1,44 @@ +// compile-flags: -C no-prepopulate-passes + +#![crate_type="rlib"] +use std::usize; + +#[repr(align(16))] +pub struct S { + arr: [u32; 4], +} + +// CHECK-LABEL: @test1 +// CHECK: store i32 0, i32* %{{.+}}, align 16 +// CHECK: store i32 1, i32* %{{.+}}, align 4 +// CHECK: store i32 2, i32* %{{.+}}, align 8 +// CHECK: store i32 3, i32* %{{.+}}, align 4 +#[no_mangle] +pub fn test1(s: &mut S) { + s.arr[0] = 0; + s.arr[1] = 1; + s.arr[2] = 2; + s.arr[3] = 3; +} + +// CHECK-LABEL: @test2 +// CHECK: store i32 4, i32* %{{.+}}, align 4 +#[allow(const_err)] +#[no_mangle] +pub fn test2(s: &mut S) { + s.arr[usize::MAX / 4 + 1] = 4; +} + +// CHECK-LABEL: @test3 +// CHECK: store i32 5, i32* %{{.+}}, align 4 +#[no_mangle] +pub fn test3(s: &mut S, i: usize) { + s.arr[i] = 5; +} + +// CHECK-LABEL: @test4 +// CHECK: store i32 6, i32* %{{.+}}, align 4 +#[no_mangle] +pub fn test4(s: &mut S) { + s.arr = [6; 4]; +} diff --git a/src/test/codegen/lifetime_start_end.rs b/src/test/codegen/lifetime_start_end.rs index 9f5170cc89e..9df46bb3dd1 100644 --- a/src/test/codegen/lifetime_start_end.rs +++ b/src/test/codegen/lifetime_start_end.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/likely.rs b/src/test/codegen/likely.rs index acaec0350bf..c56cf718f98 100644 --- a/src/test/codegen/likely.rs +++ b/src/test/codegen/likely.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/link-dead-code.rs b/src/test/codegen/link-dead-code.rs index 4492ad52083..cb3dd07a2a7 100644 --- a/src/test/codegen/link-dead-code.rs +++ b/src/test/codegen/link-dead-code.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Clink-dead-code #![crate_type = "rlib"] diff --git a/src/test/codegen/link_section.rs b/src/test/codegen/link_section.rs index 415ee6eb7ea..86c1365fdb7 100644 --- a/src/test/codegen/link_section.rs +++ b/src/test/codegen/link_section.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/loads.rs b/src/test/codegen/loads.rs index def5269e07a..e164f5115ff 100644 --- a/src/test/codegen/loads.rs +++ b/src/test/codegen/loads.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/local-generics-in-exe-internalized.rs b/src/test/codegen/local-generics-in-exe-internalized.rs index 162a025c302..6bdbf929193 100644 --- a/src/test/codegen/local-generics-in-exe-internalized.rs +++ b/src/test/codegen/local-generics-in-exe-internalized.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes -Zshare-generics=yes // Check that local generics are internalized if they are in the same CGU diff --git a/src/test/codegen/lto-removes-invokes.rs b/src/test/codegen/lto-removes-invokes.rs index 5ddca476326..b8f9f36c8e7 100644 --- a/src/test/codegen/lto-removes-invokes.rs +++ b/src/test/codegen/lto-removes-invokes.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C lto -C panic=abort -O // no-prefer-dynamic diff --git a/src/test/codegen/mainsubprogram.rs b/src/test/codegen/mainsubprogram.rs index 2cfc20e30ca..d886cb88004 100644 --- a/src/test/codegen/mainsubprogram.rs +++ b/src/test/codegen/mainsubprogram.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test depends on a patch that was committed to upstream LLVM // before 4.0, formerly backported to the Rust LLVM fork. diff --git a/src/test/codegen/mainsubprogramstart.rs b/src/test/codegen/mainsubprogramstart.rs index 62a996316c4..d91f91ee7ab 100644 --- a/src/test/codegen/mainsubprogramstart.rs +++ b/src/test/codegen/mainsubprogramstart.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // ignore-windows // ignore-macos diff --git a/src/test/codegen/match-optimizes-away.rs b/src/test/codegen/match-optimizes-away.rs index 96aa51dca92..70c07d4389a 100644 --- a/src/test/codegen/match-optimizes-away.rs +++ b/src/test/codegen/match-optimizes-away.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // no-system-llvm // compile-flags: -O @@ -15,6 +6,7 @@ pub enum Three { A, B, C } +#[repr(u16)] pub enum Four { A, B, C, D } #[no_mangle] @@ -33,7 +25,7 @@ pub fn three_valued(x: Three) -> Three { pub fn four_valued(x: Four) -> Four { // CHECK-LABEL: @four_valued // CHECK-NEXT: {{^.*:$}} - // CHECK-NEXT: ret i8 %0 + // CHECK-NEXT: ret i16 %0 match x { Four::A => Four::A, Four::B => Four::B, diff --git a/src/test/codegen/match.rs b/src/test/codegen/match.rs index 04d3e3c4cc3..53f34feb849 100644 --- a/src/test/codegen/match.rs +++ b/src/test/codegen/match.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/mir_zst_stores.rs b/src/test/codegen/mir_zst_stores.rs index 884cf59c1c1..17e7ba3093b 100644 --- a/src/test/codegen/mir_zst_stores.rs +++ b/src/test/codegen/mir_zst_stores.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/move-val-init.rs b/src/test/codegen/move-val-init.rs index e2371d61487..6222536b506 100644 --- a/src/test/codegen/move-val-init.rs +++ b/src/test/codegen/move-val-init.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![feature(core_intrinsics)] diff --git a/src/test/codegen/naked-functions.rs b/src/test/codegen/naked-functions.rs index 2cf8ce00bfb..2050193b61b 100644 --- a/src/test/codegen/naked-functions.rs +++ b/src/test/codegen/naked-functions.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/no-assumes-on-casts.rs b/src/test/codegen/no-assumes-on-casts.rs index a5a7d94a553..b5cfa2775ab 100644 --- a/src/test/codegen/no-assumes-on-casts.rs +++ b/src/test/codegen/no-assumes-on-casts.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] // compile-flags: -Cno-prepopulate-passes diff --git a/src/test/codegen/no-dllimport-w-cross-lang-lto.rs b/src/test/codegen/no-dllimport-w-cross-lang-lto.rs index 0d5d02206a6..c1c1ef6ede2 100644 --- a/src/test/codegen/no-dllimport-w-cross-lang-lto.rs +++ b/src/test/codegen/no-dllimport-w-cross-lang-lto.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test makes sure that functions get annotated with the proper // "target-cpu" attribute in LLVM. diff --git a/src/test/codegen/no-output-asm-is-volatile.rs b/src/test/codegen/no-output-asm-is-volatile.rs index 457d706a8ff..ad497b25a9e 100644 --- a/src/test/codegen/no-output-asm-is-volatile.rs +++ b/src/test/codegen/no-output-asm-is-volatile.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O // ignore-asmjs diff --git a/src/test/codegen/no-plt.rs b/src/test/codegen/no-plt.rs index 8f302e57902..f09770af2cb 100644 --- a/src/test/codegen/no-plt.rs +++ b/src/test/codegen/no-plt.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C relocation-model=pic -Z plt=no #![crate_type = "lib"] diff --git a/src/test/codegen/nontemporal.rs b/src/test/codegen/nontemporal.rs index 28ec534b97a..3a41fb4fab3 100644 --- a/src/test/codegen/nontemporal.rs +++ b/src/test/codegen/nontemporal.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O #![feature(core_intrinsics)] diff --git a/src/test/codegen/noreturnflag.rs b/src/test/codegen/noreturnflag.rs index f66369782e5..fc288eb0cf1 100644 --- a/src/test/codegen/noreturnflag.rs +++ b/src/test/codegen/noreturnflag.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -g -C no-prepopulate-passes // ignore-tidy-linelength diff --git a/src/test/codegen/nounwind-extern.rs b/src/test/codegen/nounwind-extern.rs new file mode 100644 index 00000000000..87e334621e3 --- /dev/null +++ b/src/test/codegen/nounwind-extern.rs @@ -0,0 +1,7 @@ +// compile-flags: -O + +#![crate_type = "lib"] +#![no_trace] + +// CHECK: Function Attrs: norecurse nounwind +pub extern fn foo() {} diff --git a/src/test/codegen/nounwind.rs b/src/test/codegen/nounwind.rs index 6863b1f2792..49a74ef7ab4 100644 --- a/src/test/codegen/nounwind.rs +++ b/src/test/codegen/nounwind.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:nounwind.rs // compile-flags: -C no-prepopulate-passes -C panic=abort -C metadata=a // ignore-windows diff --git a/src/test/codegen/optimize-attr-1.rs b/src/test/codegen/optimize-attr-1.rs new file mode 100644 index 00000000000..376447e5b5d --- /dev/null +++ b/src/test/codegen/optimize-attr-1.rs @@ -0,0 +1,50 @@ +// revisions: NO-OPT SIZE-OPT SPEED-OPT +//[NO-OPT] compile-flags: -Copt-level=0 -Ccodegen-units=1 +//[SIZE-OPT] compile-flags: -Copt-level=s -Ccodegen-units=1 +//[SPEED-OPT] compile-flags: -Copt-level=3 -Ccodegen-units=1 + +#![feature(optimize_attribute)] +#![crate_type="rlib"] + +// CHECK-LABEL: define i32 @nothing +// CHECK-SAME: [[NOTHING_ATTRS:#[0-9]+]] +// NO-OPT: ret i32 %1 +// SIZE-OPT: ret i32 4 +// SPEEC-OPT: ret i32 4 +#[no_mangle] +pub fn nothing() -> i32 { + 2 + 2 +} + +// CHECK-LABEL: define i32 @size +// CHECK-SAME: [[SIZE_ATTRS:#[0-9]+]] +// NO-OPT: ret i32 %1 +// SIZE-OPT: ret i32 6 +// SPEED-OPT: ret i32 6 +#[optimize(size)] +#[no_mangle] +pub fn size() -> i32 { + 3 + 3 +} + +// CHECK-LABEL: define i32 @speed +// NO-OPT-SAME: [[NOTHING_ATTRS]] +// SPEED-OPT-SAME: [[NOTHING_ATTRS]] +// SIZE-OPT-SAME: [[SPEED_ATTRS:#[0-9]+]] +// NO-OPT: ret i32 %1 +// SIZE-OPT: ret i32 8 +// SPEED-OPT: ret i32 8 +#[optimize(speed)] +#[no_mangle] +pub fn speed() -> i32 { + 4 + 4 +} + +// NO-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}} +// SPEED-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}} +// SIZE-OPT-DAG: attributes [[NOTHING_ATTRS]] = {{.*}}optsize{{.*}} +// SIZE-OPT-DAG: attributes [[SIZE_ATTRS]] = {{.*}}minsize{{.*}}optsize{{.*}} + +// SIZE-OPT: attributes [[SPEED_ATTRS]] +// SIZE-OPT-NOT: minsize +// SIZE-OPT-NOT: optsize diff --git a/src/test/codegen/packed.rs b/src/test/codegen/packed.rs index b50f5b6f16f..b42161db98a 100644 --- a/src/test/codegen/packed.rs +++ b/src/test/codegen/packed.rs @@ -1,19 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags: -C no-prepopulate-passes // min-llvm-version 7.0 #![crate_type = "lib"] -#![feature(repr_packed)] #[repr(packed)] pub struct Packed1 { @@ -84,6 +73,42 @@ pub fn call_pkd2(f: fn() -> Array) -> BigPacked2 { BigPacked2 { dealign: 0, data: f() } } +// CHECK-LABEL: @write_packed_array1 +// CHECK: store i32 0, i32* %{{.+}}, align 1 +// CHECK: store i32 1, i32* %{{.+}}, align 1 +// CHECK: store i32 2, i32* %{{.+}}, align 1 +#[no_mangle] +pub fn write_packed_array1(p: &mut BigPacked1) { + p.data.0[0] = 0; + p.data.0[1] = 1; + p.data.0[2] = 2; +} + +// CHECK-LABEL: @write_packed_array2 +// CHECK: store i32 0, i32* %{{.+}}, align 2 +// CHECK: store i32 1, i32* %{{.+}}, align 2 +// CHECK: store i32 2, i32* %{{.+}}, align 2 +#[no_mangle] +pub fn write_packed_array2(p: &mut BigPacked2) { + p.data.0[0] = 0; + p.data.0[1] = 1; + p.data.0[2] = 2; +} + +// CHECK-LABEL: @repeat_packed_array1 +// CHECK: store i32 42, i32* %{{.+}}, align 1 +#[no_mangle] +pub fn repeat_packed_array1(p: &mut BigPacked1) { + p.data.0 = [42; 8]; +} + +// CHECK-LABEL: @repeat_packed_array2 +// CHECK: store i32 42, i32* %{{.+}}, align 2 +#[no_mangle] +pub fn repeat_packed_array2(p: &mut BigPacked2) { + p.data.0 = [42; 8]; +} + #[repr(packed)] #[derive(Copy, Clone)] pub struct Packed1Pair(u8, u32); diff --git a/src/test/codegen/panic-abort-windows.rs b/src/test/codegen/panic-abort-windows.rs index f1affcc1248..e2d942e8699 100644 --- a/src/test/codegen/panic-abort-windows.rs +++ b/src/test/codegen/panic-abort-windows.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // This test is for *-windows-msvc only. diff --git a/src/test/codegen/personality_lifetimes.rs b/src/test/codegen/personality_lifetimes.rs index 9fd600b32e6..0d3d537a272 100644 --- a/src/test/codegen/personality_lifetimes.rs +++ b/src/test/codegen/personality_lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-msvc // compile-flags: -O -C no-prepopulate-passes diff --git a/src/test/codegen/prefetch.rs b/src/test/codegen/prefetch.rs index 3a23c16d521..4cd38e14282 100644 --- a/src/test/codegen/prefetch.rs +++ b/src/test/codegen/prefetch.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/refs.rs b/src/test/codegen/refs.rs index 6c00ffa754b..9583730e9dd 100644 --- a/src/test/codegen/refs.rs +++ b/src/test/codegen/refs.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes // ignore-tidy-linelength diff --git a/src/test/codegen/remap_path_prefix/aux_mod.rs b/src/test/codegen/remap_path_prefix/aux_mod.rs index 2a7019957af..44cc4bb722d 100644 --- a/src/test/codegen/remap_path_prefix/aux_mod.rs +++ b/src/test/codegen/remap_path_prefix/aux_mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test: this is not a test #[inline] diff --git a/src/test/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs b/src/test/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs index 3ef0ff9ef06..b87a20e75f4 100644 --- a/src/test/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs +++ b/src/test/codegen/remap_path_prefix/auxiliary/remap_path_prefix_aux.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags: -g --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{src-base}}/remap_path_prefix/auxiliary=/the/aux-src diff --git a/src/test/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs b/src/test/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs index 6c477a40781..57e877ef0d0 100644 --- a/src/test/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs +++ b/src/test/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags: -g --remap-path-prefix={{cwd}}=/the/aux-cwd --remap-path-prefix={{src-base}}/remap_path_prefix/auxiliary=/the/aux-src diff --git a/src/test/codegen/remap_path_prefix/main.rs b/src/test/codegen/remap_path_prefix/main.rs index dd0f89c931d..52ffb97a5b2 100644 --- a/src/test/codegen/remap_path_prefix/main.rs +++ b/src/test/codegen/remap_path_prefix/main.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows // ignore-tidy-linelength diff --git a/src/test/codegen/remap_path_prefix/xcrate-generic.rs b/src/test/codegen/remap_path_prefix/xcrate-generic.rs index f206df98131..70d29577b2f 100644 --- a/src/test/codegen/remap_path_prefix/xcrate-generic.rs +++ b/src/test/codegen/remap_path_prefix/xcrate-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows // ignore-tidy-linelength // compile-flags: -g -C metadata=foo -C no-prepopulate-passes diff --git a/src/test/codegen/repeat-trusted-len.rs b/src/test/codegen/repeat-trusted-len.rs index d42f1b35b5b..9b0c3b3c192 100644 --- a/src/test/codegen/repeat-trusted-len.rs +++ b/src/test/codegen/repeat-trusted-len.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test FIXME swt_ignore // compile-flags: -O // ignore-tidy-linelength diff --git a/src/test/codegen/repr-transparent-aggregates-1.rs b/src/test/codegen/repr-transparent-aggregates-1.rs index a1185cc1e2e..fb88f2a69ca 100644 --- a/src/test/codegen/repr-transparent-aggregates-1.rs +++ b/src/test/codegen/repr-transparent-aggregates-1.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes // ignore-arm diff --git a/src/test/codegen/repr-transparent-aggregates-2.rs b/src/test/codegen/repr-transparent-aggregates-2.rs index b4623eb4913..6c628ac035f 100644 --- a/src/test/codegen/repr-transparent-aggregates-2.rs +++ b/src/test/codegen/repr-transparent-aggregates-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes // ignore-aarch64 diff --git a/src/test/codegen/repr-transparent-aggregates-3.rs b/src/test/codegen/repr-transparent-aggregates-3.rs index a292f1d70f3..cd740dc9b82 100644 --- a/src/test/codegen/repr-transparent-aggregates-3.rs +++ b/src/test/codegen/repr-transparent-aggregates-3.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes // only-mips64 diff --git a/src/test/codegen/repr-transparent-sysv64.rs b/src/test/codegen/repr-transparent-sysv64.rs index 2e4665e22e3..b71cb14a4ff 100644 --- a/src/test/codegen/repr-transparent-sysv64.rs +++ b/src/test/codegen/repr-transparent-sysv64.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // only-x86_64 // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/repr-transparent.rs b/src/test/codegen/repr-transparent.rs index 64a62fd7e88..fd655261ab8 100644 --- a/src/test/codegen/repr-transparent.rs +++ b/src/test/codegen/repr-transparent.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type="lib"] diff --git a/src/test/codegen/scalar-pair-bool.rs b/src/test/codegen/scalar-pair-bool.rs index b7b7080b665..bc86c6c60b1 100644 --- a/src/test/codegen/scalar-pair-bool.rs +++ b/src/test/codegen/scalar-pair-bool.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O #![crate_type = "lib"] diff --git a/src/test/codegen/simd-intrinsic-float-abs.rs b/src/test/codegen/simd-intrinsic-float-abs.rs index 49f1f3e8565..acb993d51fb 100644 --- a/src/test/codegen/simd-intrinsic-float-abs.rs +++ b/src/test/codegen/simd-intrinsic-float-abs.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-ceil.rs b/src/test/codegen/simd-intrinsic-float-ceil.rs index 4a6f162e16b..58667af7e50 100644 --- a/src/test/codegen/simd-intrinsic-float-ceil.rs +++ b/src/test/codegen/simd-intrinsic-float-ceil.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-cos.rs b/src/test/codegen/simd-intrinsic-float-cos.rs index 6304c6c644f..affbe17d334 100644 --- a/src/test/codegen/simd-intrinsic-float-cos.rs +++ b/src/test/codegen/simd-intrinsic-float-cos.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-exp.rs b/src/test/codegen/simd-intrinsic-float-exp.rs index 110031c6451..43472d9dece 100644 --- a/src/test/codegen/simd-intrinsic-float-exp.rs +++ b/src/test/codegen/simd-intrinsic-float-exp.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-exp2.rs b/src/test/codegen/simd-intrinsic-float-exp2.rs index dc62c90822f..471d49b7841 100644 --- a/src/test/codegen/simd-intrinsic-float-exp2.rs +++ b/src/test/codegen/simd-intrinsic-float-exp2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-floor.rs b/src/test/codegen/simd-intrinsic-float-floor.rs index 9bc8ca0d152..bd8ba8b6cd7 100644 --- a/src/test/codegen/simd-intrinsic-float-floor.rs +++ b/src/test/codegen/simd-intrinsic-float-floor.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-fma.rs b/src/test/codegen/simd-intrinsic-float-fma.rs index acd7f717214..8ad9e9004c2 100644 --- a/src/test/codegen/simd-intrinsic-float-fma.rs +++ b/src/test/codegen/simd-intrinsic-float-fma.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-fsqrt.rs b/src/test/codegen/simd-intrinsic-float-fsqrt.rs index 2bad0bba48a..ecffca960da 100644 --- a/src/test/codegen/simd-intrinsic-float-fsqrt.rs +++ b/src/test/codegen/simd-intrinsic-float-fsqrt.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-log.rs b/src/test/codegen/simd-intrinsic-float-log.rs index d3829efe09b..79e6ed54690 100644 --- a/src/test/codegen/simd-intrinsic-float-log.rs +++ b/src/test/codegen/simd-intrinsic-float-log.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-log10.rs b/src/test/codegen/simd-intrinsic-float-log10.rs index 47f19e499fa..db92a94fca8 100644 --- a/src/test/codegen/simd-intrinsic-float-log10.rs +++ b/src/test/codegen/simd-intrinsic-float-log10.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-log2.rs b/src/test/codegen/simd-intrinsic-float-log2.rs index e36a5887b61..90d9ec3cedd 100644 --- a/src/test/codegen/simd-intrinsic-float-log2.rs +++ b/src/test/codegen/simd-intrinsic-float-log2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-minmax.rs b/src/test/codegen/simd-intrinsic-float-minmax.rs index 16f86735c2e..2761392e6a9 100644 --- a/src/test/codegen/simd-intrinsic-float-minmax.rs +++ b/src/test/codegen/simd-intrinsic-float-minmax.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // min-llvm-version 7.0 diff --git a/src/test/codegen/simd-intrinsic-float-pow.rs b/src/test/codegen/simd-intrinsic-float-pow.rs index bb2ac362203..1dd2c2ccb83 100644 --- a/src/test/codegen/simd-intrinsic-float-pow.rs +++ b/src/test/codegen/simd-intrinsic-float-pow.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-powi.rs b/src/test/codegen/simd-intrinsic-float-powi.rs index 6e28af262ac..09f31bdd6bb 100644 --- a/src/test/codegen/simd-intrinsic-float-powi.rs +++ b/src/test/codegen/simd-intrinsic-float-powi.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-float-sin.rs b/src/test/codegen/simd-intrinsic-float-sin.rs index 26100ed5c3f..dc87651c2aa 100644 --- a/src/test/codegen/simd-intrinsic-float-sin.rs +++ b/src/test/codegen/simd-intrinsic-float-sin.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-generic-bitmask.rs b/src/test/codegen/simd-intrinsic-generic-bitmask.rs new file mode 100644 index 00000000000..cd8130f9231 --- /dev/null +++ b/src/test/codegen/simd-intrinsic-generic-bitmask.rs @@ -0,0 +1,57 @@ +// compile-flags: -C no-prepopulate-passes +// ignore-tidy-linelength + +#![crate_type = "lib"] + +#![feature(repr_simd, platform_intrinsics)] +#![allow(non_camel_case_types)] + +#[repr(simd)] +#[derive(Copy, Clone)] +pub struct u32x2(u32, u32); + +#[repr(simd)] +#[derive(Copy, Clone)] +pub struct i32x2(i32, i32); + +#[repr(simd)] +#[derive(Copy, Clone)] +pub struct i8x16( + i8, i8, i8, i8, i8, i8, i8, i8, + i8, i8, i8, i8, i8, i8, i8, i8, +); + + +extern "platform-intrinsic" { + fn simd_bitmask(x: T) -> U; +} + +// CHECK-LABEL: @bitmask_int +#[no_mangle] +pub unsafe fn bitmask_int(x: i32x2) -> u8 { + // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> %{{[0-9]+}}, + // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> + // CHECK: [[C:%[0-9]+]] = bitcast <2 x i1> [[B]] to i2 + // CHECK: %{{[0-9]+}} = zext i2 [[C]] to i8 + simd_bitmask(x) +} + +// CHECK-LABEL: @bitmask_uint +#[no_mangle] +pub unsafe fn bitmask_uint(x: u32x2) -> u8 { + // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> %{{[0-9]+}}, + // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> + // CHECK: [[C:%[0-9]+]] = bitcast <2 x i1> [[B]] to i2 + // CHECK: %{{[0-9]+}} = zext i2 [[C]] to i8 + simd_bitmask(x) +} + +// CHECK-LABEL: @bitmask_int16 +#[no_mangle] +pub unsafe fn bitmask_int16(x: i8x16) -> u16 { + // CHECK: [[A:%[0-9]+]] = lshr <16 x i8> %{{[0-9]+}}, + // CHECK: [[B:%[0-9]+]] = trunc <16 x i8> [[A]] to <16 x i1> + // CHECK: %{{[0-9]+}} = bitcast <16 x i1> [[B]] to i16 + // CHECK-NOT: zext + simd_bitmask(x) +} diff --git a/src/test/codegen/simd-intrinsic-generic-gather.rs b/src/test/codegen/simd-intrinsic-generic-gather.rs index 6c47bf3e321..3389104219d 100644 --- a/src/test/codegen/simd-intrinsic-generic-gather.rs +++ b/src/test/codegen/simd-intrinsic-generic-gather.rs @@ -1,16 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // ignore-tidy-linelength -// min-llvm-version 6.0 // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-generic-scatter.rs b/src/test/codegen/simd-intrinsic-generic-scatter.rs index 7b5b2e55e29..dd0a9801bc5 100644 --- a/src/test/codegen/simd-intrinsic-generic-scatter.rs +++ b/src/test/codegen/simd-intrinsic-generic-scatter.rs @@ -1,16 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // ignore-tidy-linelength -// min-llvm-version 6.0 // compile-flags: -C no-prepopulate-passes diff --git a/src/test/codegen/simd-intrinsic-generic-select.rs b/src/test/codegen/simd-intrinsic-generic-select.rs index 8a64d7437d8..03bb2265526 100644 --- a/src/test/codegen/simd-intrinsic-generic-select.rs +++ b/src/test/codegen/simd-intrinsic-generic-select.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] @@ -19,12 +9,17 @@ #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x4(pub f32, pub f32, pub f32, pub f32); +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +pub struct f32x8(f32, f32, f32, f32, f32, f32, f32, f32); + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct b8x4(pub i8, pub i8, pub i8, pub i8); extern "platform-intrinsic" { fn simd_select(x: T, a: U, b: U) -> U; + fn simd_select_bitmask(x: T, a: U, b: U) -> U; } // CHECK-LABEL: @select @@ -33,3 +28,10 @@ pub unsafe fn select(m: b8x4, a: f32x4, b: f32x4) -> f32x4 { // CHECK: select <4 x i1> simd_select(m, a, b) } + +// CHECK-LABEL: @select_bitmask +#[no_mangle] +pub unsafe fn select_bitmask(m: i8, a: f32x8, b: f32x8) -> f32x8 { + // CHECK: select <8 x i1> + simd_select_bitmask(m, a, b) +} diff --git a/src/test/codegen/slice-init.rs b/src/test/codegen/slice-init.rs index 915db493fc2..6c79ddb0a7a 100644 --- a/src/test/codegen/slice-init.rs +++ b/src/test/codegen/slice-init.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] diff --git a/src/test/codegen/slice-position-bounds-check.rs b/src/test/codegen/slice-position-bounds-check.rs index ab6b09237c8..a75a58405bd 100644 --- a/src/test/codegen/slice-position-bounds-check.rs +++ b/src/test/codegen/slice-position-bounds-check.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-system-llvm // compile-flags: -O -C panic=abort #![crate_type = "lib"] diff --git a/src/test/codegen/sparc-struct-abi.rs b/src/test/codegen/sparc-struct-abi.rs index 56c4364d598..78e5b14a212 100644 --- a/src/test/codegen/sparc-struct-abi.rs +++ b/src/test/codegen/sparc-struct-abi.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // Checks that we correctly codegen extern "C" functions returning structs. // See issue #52638. diff --git a/src/test/codegen/stack-probes.rs b/src/test/codegen/stack-probes.rs index b8c2e62abef..b8ebf338cbf 100644 --- a/src/test/codegen/stack-probes.rs +++ b/src/test/codegen/stack-probes.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-arm // ignore-aarch64 // ignore-mips diff --git a/src/test/codegen/stores.rs b/src/test/codegen/stores.rs index 871bee13b19..64143aee669 100644 --- a/src/test/codegen/stores.rs +++ b/src/test/codegen/stores.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes // ignore-tidy-linelength // min-llvm-version 7.0 diff --git a/src/test/codegen/swap-small-types.rs b/src/test/codegen/swap-small-types.rs index 46406ee5182..c8466fed7d1 100644 --- a/src/test/codegen/swap-small-types.rs +++ b/src/test/codegen/swap-small-types.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O // only-x86_64 diff --git a/src/test/codegen/target-cpu-on-functions.rs b/src/test/codegen/target-cpu-on-functions.rs index cd7d061c0de..5692dca1df5 100644 --- a/src/test/codegen/target-cpu-on-functions.rs +++ b/src/test/codegen/target-cpu-on-functions.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test makes sure that functions get annotated with the proper // "target-cpu" attribute in LLVM. diff --git a/src/test/codegen/target-feature-on-functions.rs b/src/test/codegen/target-feature-on-functions.rs index e3cc2c753e5..d4d39d08b1e 100644 --- a/src/test/codegen/target-feature-on-functions.rs +++ b/src/test/codegen/target-feature-on-functions.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // only-x86_64 // compile-flags: -C target-feature=+avx diff --git a/src/test/codegen/unchecked-float-casts.rs b/src/test/codegen/unchecked-float-casts.rs index 87ebaaeec32..34e96122223 100644 --- a/src/test/codegen/unchecked-float-casts.rs +++ b/src/test/codegen/unchecked-float-casts.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes // This file tests that we don't generate any code for saturation if diff --git a/src/test/codegen/union-abi.rs b/src/test/codegen/union-abi.rs index 786968128ec..03b55eb52a2 100644 --- a/src/test/codegen/union-abi.rs +++ b/src/test/codegen/union-abi.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes // This test that using union forward the abi of the inner type, as @@ -78,3 +68,9 @@ pub union CUnionU128{a:u128} #[no_mangle] pub fn test_CUnionU128(_: CUnionU128) { loop {} } +pub union UnionBool { b:bool } +// CHECK: define zeroext i1 @test_UnionBool(i8 %b) +#[no_mangle] +pub fn test_UnionBool(b: UnionBool) -> bool { unsafe { b.b } } +// CHECK: %0 = trunc i8 %b to i1 + diff --git a/src/test/codegen/vec-clear.rs b/src/test/codegen/vec-clear.rs index c44637376d7..db1494e422a 100644 --- a/src/test/codegen/vec-clear.rs +++ b/src/test/codegen/vec-clear.rs @@ -1,15 +1,6 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-debug: the debug assertions get in the way // compile-flags: -O +// ignore-test FIXME swt_ignore #![crate_type = "lib"] diff --git a/src/test/codegen/vec-iter-collect-len.rs b/src/test/codegen/vec-iter-collect-len.rs index 05cbf053444..6a322ed82f4 100644 --- a/src/test/codegen/vec-iter-collect-len.rs +++ b/src/test/codegen/vec-iter-collect-len.rs @@ -1,16 +1,7 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-debug: the debug assertions get in the way // no-system-llvm // compile-flags: -O +// ignore-test FIXME swt_ignore #![crate_type="lib"] #[no_mangle] diff --git a/src/test/codegen/vec-optimizes-away.rs b/src/test/codegen/vec-optimizes-away.rs index 6bef01fd4ea..657cf90ae7d 100644 --- a/src/test/codegen/vec-optimizes-away.rs +++ b/src/test/codegen/vec-optimizes-away.rs @@ -1,16 +1,8 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // ignore-debug: the debug assertions get in the way // no-system-llvm // compile-flags: -O +// ignore-test FIXME swt_ignore #![crate_type="lib"] #[no_mangle] diff --git a/src/test/codegen/vtabletype.rs b/src/test/codegen/vtabletype.rs index abd1eb3e2cc..70b97a67bbc 100644 --- a/src/test/codegen/vtabletype.rs +++ b/src/test/codegen/vtabletype.rs @@ -1,20 +1,9 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test depends on a patch that was committed to upstream LLVM // after 5.0, then backported to the Rust LLVM fork. // ignore-tidy-linelength // ignore-windows // ignore-macos -// min-llvm-version 6.0 // compile-flags: -g -C no-prepopulate-passes diff --git a/src/test/codegen/x86_mmx.rs b/src/test/codegen/x86_mmx.rs index 4424c30e0f8..a08ba361740 100644 --- a/src/test/codegen/x86_mmx.rs +++ b/src/test/codegen/x86_mmx.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-arm // ignore-aarch64 // ignore-emscripten @@ -18,6 +8,7 @@ // ignore-powerpc64le // ignore-sparc // ignore-sparc64 +// ignore-s390x // compile-flags: -O #![feature(repr_simd)] diff --git a/src/test/codegen/zip.rs b/src/test/codegen/zip.rs index d0051c5165f..e55f4f1a2de 100644 --- a/src/test/codegen/zip.rs +++ b/src/test/codegen/zip.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes -O #![crate_type = "lib"] diff --git a/src/test/compile-fail-fulldeps/auxiliary/attr_plugin_test.rs b/src/test/compile-fail-fulldeps/auxiliary/attr_plugin_test.rs deleted file mode 100644 index bab3721a313..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/attr_plugin_test.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host - -#![feature(plugin_registrar)] -#![feature(rustc_private)] - -extern crate syntax; - -extern crate rustc; -extern crate rustc_plugin; - -use syntax::feature_gate::AttributeType; -use rustc_plugin::Registry; - - - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_attribute("foo".to_owned(), AttributeType::Normal); - reg.register_attribute("bar".to_owned(), AttributeType::CrateLevel); - reg.register_attribute("baz".to_owned(), AttributeType::Whitelisted); -} diff --git a/src/test/compile-fail-fulldeps/auxiliary/lint_for_crate.rs b/src/test/compile-fail-fulldeps/auxiliary/lint_for_crate.rs deleted file mode 100644 index 460e28fc794..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/lint_for_crate.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host - -#![feature(plugin_registrar, rustc_private)] -#![feature(box_syntax)] -#![feature(macro_at_most_once_rep)] - -#[macro_use] extern crate rustc; -extern crate rustc_plugin; -extern crate syntax; - -use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; -use rustc_plugin::Registry; -use rustc::hir; -use syntax::attr; - -declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); - -struct Pass; - -impl LintPass for Pass { - fn get_lints(&self) -> LintArray { - lint_array!(CRATE_NOT_OKAY) - } -} - -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { - fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { - if !attr::contains_name(&krate.attrs, "crate_okay") { - cx.span_lint(CRATE_NOT_OKAY, krate.span, - "crate is not marked with #![crate_okay]"); - } - } -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_late_lint_pass(box Pass); -} diff --git a/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs b/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs index 1057649d969..16630e2b312 100644 --- a/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs +++ b/src/test/compile-fail-fulldeps/auxiliary/lint_group_plugin_test.rs @@ -1,20 +1,9 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -#![feature(macro_at_most_once_rep)] -// Load rustc as a plugin to get macros +// Load rustc as a plugin to get macros. #[macro_use] extern crate rustc; extern crate rustc_plugin; @@ -30,6 +19,10 @@ declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'"); struct Pass; impl LintPass for Pass { + fn name(&self) -> &'static str { + "Pass" + } + fn get_lints(&self) -> LintArray { lint_array!(TEST_LINT, PLEASE_LINT) } @@ -37,7 +30,7 @@ impl LintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { - match &*it.name.as_str() { + match &*it.ident.as_str() { "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"), "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"), _ => {} diff --git a/src/test/compile-fail-fulldeps/auxiliary/lint_plugin_test.rs b/src/test/compile-fail-fulldeps/auxiliary/lint_plugin_test.rs deleted file mode 100644 index b0183a3c56b..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/lint_plugin_test.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host - -#![feature(plugin_registrar)] -#![feature(box_syntax, rustc_private)] -#![feature(macro_at_most_once_rep)] - -extern crate syntax; - -// Load rustc as a plugin to get macros -#[macro_use] -extern crate rustc; -extern crate rustc_plugin; - -use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, - EarlyLintPassObject, LintArray}; -use rustc_plugin::Registry; -use syntax::ast; -declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); - -struct Pass; - -impl LintPass for Pass { - fn get_lints(&self) -> LintArray { - lint_array!(TEST_LINT) - } -} - -impl EarlyLintPass for Pass { - fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) { - if it.ident.name == "lintme" { - cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"); - } - } -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_early_lint_pass(box Pass as EarlyLintPassObject); -} diff --git a/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs b/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs deleted file mode 100644 index fb0f9105b0d..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/macro_crate_test.rs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host - -#![feature(plugin_registrar, quote, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; -extern crate rustc; -extern crate rustc_plugin; - -use syntax::ast::{self, Item, MetaItem, ItemKind}; -use syntax::ext::base::*; -use syntax::parse; -use syntax::ptr::P; -use syntax::symbol::Symbol; -use syntax::tokenstream::TokenTree; -use syntax_pos::Span; -use rustc_plugin::Registry; - -#[macro_export] -macro_rules! exported_macro { () => (2) } -macro_rules! unexported_macro { () => (3) } - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_macro("make_a_1", expand_make_a_1); - reg.register_macro("identity", expand_identity); - reg.register_syntax_extension( - Symbol::intern("into_multi_foo"), - MultiModifier(Box::new(expand_into_foo_multi))); - reg.register_syntax_extension( - Symbol::intern("noop_attribute"), - MultiModifier(Box::new(expand_noop_attribute))); - reg.register_syntax_extension( - Symbol::intern("duplicate"), - MultiDecorator(Box::new(expand_duplicate))); -} - -fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) - -> Box { - if !tts.is_empty() { - cx.span_fatal(sp, "make_a_1 takes no arguments"); - } - MacEager::expr(quote_expr!(cx, 1)) -} - -// See Issue #15750 -fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree]) - -> Box { - // Parse an expression and emit it unchanged. - let mut parser = parse::new_parser_from_tts(cx.parse_sess(), tts.to_vec()); - let expr = parser.parse_expr().unwrap(); - MacEager::expr(quote_expr!(&mut *cx, $expr)) -} - -fn expand_into_foo_multi(cx: &mut ExtCtxt, - _sp: Span, - _attr: &MetaItem, - it: Annotatable) -> Annotatable { - match it { - Annotatable::Item(it) => { - Annotatable::Item(P(Item { - attrs: it.attrs.clone(), - ..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone() - })) - } - Annotatable::ImplItem(_) => { - quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| { - match i.node { - ItemKind::Impl(.., mut items) => { - Annotatable::ImplItem(P(items.pop().expect("impl method not found"))) - } - _ => unreachable!("impl parsed to something other than impl") - } - }) - } - Annotatable::TraitItem(_) => { - quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| { - match i.node { - ItemKind::Trait(.., mut items) => { - Annotatable::TraitItem(P(items.pop().expect("trait method not found"))) - } - _ => unreachable!("trait parsed to something other than trait") - } - }) - } - // covered in proc_macro/macros-in-extern.rs - Annotatable::ForeignItem(_) => unimplemented!(), - // covered in proc_macro/attr-stmt-expr.rs - Annotatable::Stmt(_) | Annotatable::Expr(_) => panic!("expected item") - } -} - -fn expand_noop_attribute(_cx: &mut ExtCtxt, - _sp: Span, - _attr: &MetaItem, - it: Annotatable) -> Annotatable { - it -} - -// Create a duplicate of the annotatable, based on the MetaItem -fn expand_duplicate(cx: &mut ExtCtxt, - _sp: Span, - mi: &MetaItem, - it: &Annotatable, - push: &mut FnMut(Annotatable)) -{ - let copy_name = match mi.node { - ast::MetaItemKind::List(ref xs) => { - if let Some(word) = xs[0].word() { - word.ident.segments.last().unwrap().ident - } else { - cx.span_err(mi.span, "Expected word"); - return; - } - } - _ => { - cx.span_err(mi.span, "Expected list"); - return; - } - }; - - // Duplicate the item but replace its ident by the MetaItem - match it.clone() { - Annotatable::Item(it) => { - let mut new_it = (*it).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::Item(P(new_it))); - } - Annotatable::ImplItem(it) => { - let mut new_it = (*it).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::ImplItem(P(new_it))); - } - Annotatable::TraitItem(tt) => { - let mut new_it = (*tt).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::TraitItem(P(new_it))); - } - // covered in proc_macro/macros-in-extern.rs - Annotatable::ForeignItem(_) => unimplemented!(), - // covered in proc_macro/attr-stmt-expr.rs - Annotatable::Stmt(_) | Annotatable::Expr(_) => panic!("expected item") - } -} - -pub fn foo() {} diff --git a/src/test/compile-fail-fulldeps/auxiliary/macro_reexport_1.rs b/src/test/compile-fail-fulldeps/auxiliary/macro_reexport_1.rs deleted file mode 100644 index aaeccc6e898..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/macro_reexport_1.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "dylib"] -#[macro_export] -macro_rules! reexported { - () => ( 3 ) -} diff --git a/src/test/compile-fail-fulldeps/auxiliary/rlib_crate_test.rs b/src/test/compile-fail-fulldeps/auxiliary/rlib_crate_test.rs deleted file mode 100644 index ae1568b2f88..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/rlib_crate_test.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "rlib"] -#![feature(plugin_registrar, rustc_private)] - -extern crate rustc; -extern crate rustc_plugin; - -use rustc_plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(_: &mut Registry) {} diff --git a/src/test/compile-fail-fulldeps/auxiliary/use_from_trait_xc.rs b/src/test/compile-fail-fulldeps/auxiliary/use_from_trait_xc.rs deleted file mode 100644 index 9a6d176d088..00000000000 --- a/src/test/compile-fail-fulldeps/auxiliary/use_from_trait_xc.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -pub use self::sub::{Bar, Baz}; - -pub trait Trait { - fn foo(&self); - type Assoc; - const CONST: u32; -} - -struct Foo; - -impl Foo { - pub fn new() {} - - pub const C: u32 = 0; -} - -mod sub { - pub struct Bar; - - impl Bar { - pub fn new() {} - } - - pub enum Baz {} - - impl Baz { - pub fn new() {} - } -} diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs b/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs deleted file mode 100644 index e2231b0814f..00000000000 --- a/src/test/compile-fail-fulldeps/dropck_tarena_unsound_drop.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Check that an arena (TypedArena) cannot carry elements whose drop -// methods might access borrowed data of lifetime that does not -// strictly outlive the arena itself. -// -// Compare against run-pass/dropck_tarena_sound_drop.rs, which shows a -// similar setup, but loosens `f` so that the struct `C<'a>` can be -// fed a lifetime longer than that of the arena. -// -// (Also compare against dropck_tarena_cycle_checked.rs, from which -// this was reduced to better understand its error message.) - -#![feature(rustc_private)] - -extern crate arena; - -use arena::TypedArena; - -trait HasId { fn count(&self) -> usize; } - -struct CheckId { v: T } - -// In the code below, the impl of HasId for `&'a usize` does not -// actually access the borrowed data, but the point is that the -// interface to CheckId does not (and cannot) know that, and therefore -// when encountering a value V of type CheckId, we must -// conservatively force the type S to strictly outlive V. -impl Drop for CheckId { - fn drop(&mut self) { - assert!(self.v.count() > 0); - } -} - -struct C<'a> { v: CheckId<&'a usize>, } - -impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } } - -fn f<'a>(_arena: &'a TypedArena>) {} - -fn main() { - let arena: TypedArena = TypedArena::default(); - f(&arena); -} //~^ ERROR `arena` does not live long enough - diff --git a/src/test/compile-fail-fulldeps/gated-plugin.rs b/src/test/compile-fail-fulldeps/gated-plugin.rs deleted file mode 100644 index 4e80ca46c0a..00000000000 --- a/src/test/compile-fail-fulldeps/gated-plugin.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:macro_crate_test.rs - -#![plugin(macro_crate_test)] -//~^ ERROR compiler plugins are experimental and possibly buggy - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/gated-quote.rs b/src/test/compile-fail-fulldeps/gated-quote.rs deleted file mode 100644 index 63e1c6f16b3..00000000000 --- a/src/test/compile-fail-fulldeps/gated-quote.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that `quote`-related macro are gated by `quote` feature gate. - -// (To sanity-check the code, uncomment this.) -// #![feature(quote)] - -// FIXME the error message that is current emitted seems pretty bad. - -// gate-test-quote - -#![feature(rustc_private)] -#![allow(dead_code, unused_imports, unused_variables)] - -#[macro_use] -extern crate syntax; - -use syntax::ast; -use syntax::parse; - -struct ParseSess; - -impl ParseSess { - fn cfg(&self) -> ast::CrateConfig { loop { } } - fn parse_sess<'a>(&'a self) -> &'a parse::ParseSess { loop { } } - fn call_site(&self) -> () { loop { } } - fn ident_of(&self, st: &str) -> ast::Ident { loop { } } - fn name_of(&self, st: &str) -> ast::Name { loop { } } -} - -pub fn main() { - let ecx = &ParseSess; - let x = quote_tokens!(ecx, 3); - //~^ ERROR cannot find macro `quote_tokens!` in this scope - let x = quote_expr!(ecx, 3); - //~^ ERROR cannot find macro `quote_expr!` in this scope - let x = quote_ty!(ecx, 3); - //~^ ERROR cannot find macro `quote_ty!` in this scope - let x = quote_method!(ecx, 3); - //~^ ERROR cannot find macro `quote_method!` in this scope - let x = quote_item!(ecx, 3); - //~^ ERROR cannot find macro `quote_item!` in this scope - let x = quote_pat!(ecx, 3); - //~^ ERROR cannot find macro `quote_pat!` in this scope - let x = quote_arm!(ecx, 3); - //~^ ERROR cannot find macro `quote_arm!` in this scope - let x = quote_stmt!(ecx, 3); - //~^ ERROR cannot find macro `quote_stmt!` in this scope - let x = quote_attr!(ecx, 3); - //~^ ERROR cannot find macro `quote_attr!` in this scope - let x = quote_arg!(ecx, 3); - //~^ ERROR cannot find macro `quote_arg!` in this scope - let x = quote_block!(ecx, 3); - //~^ ERROR cannot find macro `quote_block!` in this scope - let x = quote_meta_item!(ecx, 3); - //~^ ERROR cannot find macro `quote_meta_item!` in this scope - let x = quote_path!(ecx, 3); - //~^ ERROR cannot find macro `quote_path!` in this scope -} diff --git a/src/test/compile-fail-fulldeps/issue-15778-fail.rs b/src/test/compile-fail-fulldeps/issue-15778-fail.rs deleted file mode 100644 index d56571ee1ac..00000000000 --- a/src/test/compile-fail-fulldeps/issue-15778-fail.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:lint_for_crate.rs -// ignore-stage1 -// compile-flags: -D crate-not-okay - -#![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay] -#![plugin(lint_for_crate)] - -pub fn main() { } diff --git a/src/test/compile-fail-fulldeps/issue-18986.rs b/src/test/compile-fail-fulldeps/issue-18986.rs deleted file mode 100644 index 95af3760544..00000000000 --- a/src/test/compile-fail-fulldeps/issue-18986.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:use_from_trait_xc.rs - -extern crate use_from_trait_xc; -pub use use_from_trait_xc::Trait; - -fn main() { - match () { - Trait { x: 42 } => () //~ ERROR expected struct, variant or union type, found trait `Trait` - } -} diff --git a/src/test/compile-fail-fulldeps/issue-48941.rs b/src/test/compile-fail-fulldeps/issue-48941.rs deleted file mode 100644 index baeb019df1c..00000000000 --- a/src/test/compile-fail-fulldeps/issue-48941.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// This is a regression test against an ICE that used to occur -// on malformed attributes for a custom MultiModifier. - -// aux-build:macro_crate_test.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(macro_crate_test)] - -#[noop_attribute("hi", rank = a)] //~ ERROR expected unsuffixed literal or identifier, found a -fn knight() { } - -#[noop_attribute("/user", data= = " or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:lint_group_plugin_test.rs -// ignore-stage1 -// compile-flags: -D lint-me - -#![feature(plugin)] -#![plugin(lint_group_plugin_test)] - -fn lintme() { } //~ ERROR item is named 'lintme' - -fn pleaselintme() { } //~ ERROR item is named 'pleaselintme' - -pub fn main() { - lintme(); - pleaselintme(); -} diff --git a/src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs b/src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs deleted file mode 100644 index e3dbdc331a7..00000000000 --- a/src/test/compile-fail-fulldeps/lint-plugin-deny-attr.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:lint_plugin_test.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(lint_plugin_test)] -#![deny(test_lint)] - -fn lintme() { } //~ ERROR item is named 'lintme' - -pub fn main() { - lintme(); -} diff --git a/src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs b/src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs deleted file mode 100644 index 41d25becd84..00000000000 --- a/src/test/compile-fail-fulldeps/lint-plugin-deny-cmdline.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:lint_plugin_test.rs -// ignore-stage1 -// compile-flags: -D test-lint - -#![feature(plugin)] -#![plugin(lint_plugin_test)] - -fn lintme() { } //~ ERROR item is named 'lintme' - -pub fn main() { - lintme(); -} diff --git a/src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs b/src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs deleted file mode 100644 index 155294f8026..00000000000 --- a/src/test/compile-fail-fulldeps/lint-plugin-forbid-cmdline.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:lint_plugin_test.rs -// ignore-stage1 -// compile-flags: -F test-lint - -#![feature(plugin)] -#![plugin(lint_plugin_test)] - -fn lintme() { } //~ ERROR item is named 'lintme' - -#[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(test_lint) -pub fn main() { - lintme(); -} diff --git a/src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs b/src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs deleted file mode 100644 index c676076aef3..00000000000 --- a/src/test/compile-fail-fulldeps/macro-crate-doesnt-resolve.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:macro_crate_test.rs - -#[macro_use] #[no_link] -extern crate macro_crate_test; - -fn main() { - macro_crate_test::foo(); //~ ERROR cannot find function `foo` in module `macro_crate_test` -} diff --git a/src/test/compile-fail-fulldeps/macro-crate-rlib.rs b/src/test/compile-fail-fulldeps/macro-crate-rlib.rs deleted file mode 100644 index 5b34d8e3adb..00000000000 --- a/src/test/compile-fail-fulldeps/macro-crate-rlib.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:rlib_crate_test.rs -// ignore-tidy-linelength -// ignore-cross-compile gives a different error message - -#![feature(plugin)] -#![plugin(rlib_crate_test)] -//~^ ERROR: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs b/src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs deleted file mode 100644 index 886b6247c0a..00000000000 --- a/src/test/compile-fail-fulldeps/macro-crate-unexported-macro.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:macro_crate_test.rs - -#[macro_use] #[no_link] -extern crate macro_crate_test; - -fn main() { - unexported_macro!(); - //~^ ERROR cannot find macro `unexported_macro!` in this scope -} diff --git a/src/test/compile-fail-fulldeps/no-link-unknown-crate.rs b/src/test/compile-fail-fulldeps/no-link-unknown-crate.rs deleted file mode 100644 index 8e4692bdee1..00000000000 --- a/src/test/compile-fail-fulldeps/no-link-unknown-crate.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[no_link] -extern crate doesnt_exist; //~ ERROR can't find crate - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs b/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs deleted file mode 100644 index bb292e2e52a..00000000000 --- a/src/test/compile-fail-fulldeps/plugin-as-extern-crate.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:macro_crate_test.rs -// ignore-cross-compile -// -// macro_crate_test will not compile on a cross-compiled target because -// libsyntax is not compiled for it. - -#![deny(plugin_as_library)] -#![allow(unused_extern_crates)] - -extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library - -fn main() { } diff --git a/src/test/compile-fail-fulldeps/plugin-attr-register-deny.rs b/src/test/compile-fail-fulldeps/plugin-attr-register-deny.rs deleted file mode 100644 index 0d2a5a30c10..00000000000 --- a/src/test/compile-fail-fulldeps/plugin-attr-register-deny.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:attr_plugin_test.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(attr_plugin_test)] -#![deny(unused_attributes)] - -#[baz] -fn baz() { } // no error - -#[foo] -pub fn main() { - //~^^ ERROR unused - #[bar] - fn inner() {} - //~^^ ERROR crate - //~^^^ ERROR unused - baz(); - inner(); -} diff --git a/src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs b/src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs deleted file mode 100644 index 3dfd8838ebe..00000000000 --- a/src/test/compile-fail-fulldeps/plugin-plus-extern-crate.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:macro_crate_test.rs -// ignore-stage1 -// ignore-cross-compile -// -// macro_crate_test will not compile on a cross-compiled target because -// libsyntax is not compiled for it. - -#![deny(plugin_as_library)] -#![feature(plugin)] -#![plugin(macro_crate_test)] - -extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library - -fn main() { - assert_eq!(1, make_a_1!()); - macro_crate_test::foo(); -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs b/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs deleted file mode 100644 index f52c251c14d..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:attr-stmt-expr.rs -// ignore-stage1 - -//! Attributes producing expressions in invalid locations - -#![feature(stmt_expr_attributes, proc_macro_hygiene)] - -extern crate attr_stmt_expr; -use attr_stmt_expr::{duplicate, no_output}; - -fn main() { - let _ = #[no_output] "Hello, world!"; - //~^ ERROR expected expression, found `` - - let _ = #[duplicate] "Hello, world!"; - //~^ ERROR macro expansion ignores token `,` and any following - - let _ = { - #[no_output] - "Hello, world!" - }; - - let _ = { - #[duplicate] - //~^ ERROR macro expansion ignores token `,` and any following - "Hello, world!" - }; -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs b/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs deleted file mode 100644 index 1344156b305..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:attr-stmt-expr.rs -// ignore-stage1 - -#![feature(proc_macro_hygiene)] - -extern crate attr_stmt_expr; -use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr}; - -fn print_str(string: &'static str) { - // macros are handled a bit differently - #[expect_print_expr] - //~^ ERROR attributes on expressions are experimental - //~| HELP add #![feature(stmt_expr_attributes)] to the crate attributes to enable - println!("{}", string) -} - -fn main() { - #[expect_let] - let string = "Hello, world!"; - - #[expect_print_stmt] - println!("{}", string); - - #[expect_expr] - //~^ ERROR attributes on expressions are experimental - //~| HELP add #![feature(stmt_expr_attributes)] to the crate attributes to enable - print_str("string") -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs b/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs deleted file mode 100644 index cf2522be922..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:attribute-with-error.rs -// ignore-stage1 - -#![feature(custom_inner_attributes)] - -extern crate attribute_with_error; - -use attribute_with_error::foo; - -#[foo] -fn test1() { - let a: i32 = "foo"; - //~^ ERROR: mismatched types - let b: i32 = "f'oo"; - //~^ ERROR: mismatched types -} - -fn test2() { - #![foo] - - // FIXME: should have a type error here and assert it works but it doesn't -} - -trait A { - // FIXME: should have a #[foo] attribute here and assert that it works - fn foo(&self) { - let a: i32 = "foo"; - //~^ ERROR: mismatched types - } -} - -struct B; - -impl A for B { - #[foo] - fn foo(&self) { - let a: i32 = "foo"; - //~^ ERROR: mismatched types - } -} - -#[foo] -fn main() { -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/attribute.rs b/src/test/compile-fail-fulldeps/proc-macro/attribute.rs deleted file mode 100644 index 5d5e61270b6..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/attribute.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -#[proc_macro_derive] -//~^ ERROR: attribute must be of form: #[proc_macro_derive(TraitName)] -pub fn foo1(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - input -} - -#[proc_macro_derive = "foo"] -//~^ ERROR: attribute must be of form: #[proc_macro_derive(TraitName)] -pub fn foo2(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - input -} - -#[proc_macro_derive( - a = "b" -)] -//~^^ ERROR: must only be one word -pub fn foo3(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - input -} - -#[proc_macro_derive(b, c, d)] -//~^ ERROR: attribute must have either one or two arguments -pub fn foo4(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - input -} - -#[proc_macro_derive(d(e))] -//~^ ERROR: must only be one word -pub fn foo5(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - input -} - -#[proc_macro_derive(f, attributes(g = "h"))] -//~^ ERROR: must only be one word -pub fn foo6(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - input -} - -#[proc_macro_derive(i, attributes(j(k)))] -//~^ ERROR: must only be one word -pub fn foo7(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - input -} - -#[proc_macro_derive(l, attributes(m), n)] -//~^ ERROR: attribute must have either one or two arguments -pub fn foo8(input: proc_macro::TokenStream) -> proc_macro::TokenStream { - input -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs b/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs deleted file mode 100644 index e941367b08d..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:attributes-included.rs -// ignore-stage1 -// compile-pass - -#![warn(unused)] - -extern crate attributes_included; - -use attributes_included::*; - -#[bar] -#[inline] -/// doc -#[foo] -#[inline] -/// doc -fn foo() { - let a: i32 = "foo"; //~ WARN: unused variable -} - -fn main() { - foo() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attr-stmt-expr.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attr-stmt-expr.rs deleted file mode 100644 index 22ddc913995..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attr-stmt-expr.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn expect_let(attr: TokenStream, item: TokenStream) -> TokenStream { - assert!(attr.to_string().is_empty()); - assert_eq!(item.to_string(), "let string = \"Hello, world!\";"); - item -} - -#[proc_macro_attribute] -pub fn expect_print_stmt(attr: TokenStream, item: TokenStream) -> TokenStream { - assert!(attr.to_string().is_empty()); - assert_eq!(item.to_string(), "println!(\"{}\" , string);"); - item -} - -#[proc_macro_attribute] -pub fn expect_expr(attr: TokenStream, item: TokenStream) -> TokenStream { - assert!(attr.to_string().is_empty()); - assert_eq!(item.to_string(), "print_str(\"string\")"); - item -} - -#[proc_macro_attribute] -pub fn expect_print_expr(attr: TokenStream, item: TokenStream) -> TokenStream { - assert!(attr.to_string().is_empty()); - assert_eq!(item.to_string(), "println!(\"{}\" , string)"); - item -} - -#[proc_macro_attribute] -pub fn duplicate(attr: TokenStream, item: TokenStream) -> TokenStream { - assert!(attr.to_string().is_empty()); - format!("{}, {}", item, item).parse().unwrap() -} - -#[proc_macro_attribute] -pub fn no_output(attr: TokenStream, item: TokenStream) -> TokenStream { - assert!(attr.to_string().is_empty()); - assert!(!item.to_string().is_empty()); - "".parse().unwrap() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attribute-with-error.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attribute-with-error.rs deleted file mode 100644 index 14284092669..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attribute-with-error.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn foo(_attr: TokenStream, input: TokenStream) -> TokenStream { - input.into_iter().collect() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attributes-included.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attributes-included.rs deleted file mode 100644 index a1f4209662d..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/attributes-included.rs +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::{TokenStream, TokenTree, Delimiter, Literal, Spacing, Group}; - -#[proc_macro_attribute] -pub fn foo(attr: TokenStream, input: TokenStream) -> TokenStream { - assert!(attr.is_empty()); - let input = input.into_iter().collect::>(); - { - let mut cursor = &input[..]; - assert_inline(&mut cursor); - assert_doc(&mut cursor); - assert_inline(&mut cursor); - assert_doc(&mut cursor); - assert_foo(&mut cursor); - assert!(cursor.is_empty()); - } - fold_stream(input.into_iter().collect()) -} - -#[proc_macro_attribute] -pub fn bar(attr: TokenStream, input: TokenStream) -> TokenStream { - assert!(attr.is_empty()); - let input = input.into_iter().collect::>(); - { - let mut cursor = &input[..]; - assert_inline(&mut cursor); - assert_doc(&mut cursor); - assert_invoc(&mut cursor); - assert_inline(&mut cursor); - assert_doc(&mut cursor); - assert_foo(&mut cursor); - assert!(cursor.is_empty()); - } - input.into_iter().collect() -} - -fn assert_inline(slice: &mut &[TokenTree]) { - match &slice[0] { - TokenTree::Punct(tt) => assert_eq!(tt.as_char(), '#'), - _ => panic!("expected '#' char"), - } - match &slice[1] { - TokenTree::Group(tt) => assert_eq!(tt.delimiter(), Delimiter::Bracket), - _ => panic!("expected brackets"), - } - *slice = &slice[2..]; -} - -fn assert_doc(slice: &mut &[TokenTree]) { - match &slice[0] { - TokenTree::Punct(tt) => { - assert_eq!(tt.as_char(), '#'); - assert_eq!(tt.spacing(), Spacing::Alone); - } - _ => panic!("expected #"), - } - let inner = match &slice[1] { - TokenTree::Group(tt) => { - assert_eq!(tt.delimiter(), Delimiter::Bracket); - tt.stream() - } - _ => panic!("expected brackets"), - }; - let tokens = inner.into_iter().collect::>(); - let tokens = &tokens[..]; - - if tokens.len() != 3 { - panic!("expected three tokens in doc") - } - - match &tokens[0] { - TokenTree::Ident(tt) => assert_eq!("doc", &*tt.to_string()), - _ => panic!("expected `doc`"), - } - match &tokens[1] { - TokenTree::Punct(tt) => { - assert_eq!(tt.as_char(), '='); - assert_eq!(tt.spacing(), Spacing::Alone); - } - _ => panic!("expected equals"), - } - match tokens[2] { - TokenTree::Literal(_) => {} - _ => panic!("expected literal"), - } - - *slice = &slice[2..]; -} - -fn assert_invoc(slice: &mut &[TokenTree]) { - match &slice[0] { - TokenTree::Punct(tt) => assert_eq!(tt.as_char(), '#'), - _ => panic!("expected '#' char"), - } - match &slice[1] { - TokenTree::Group(tt) => assert_eq!(tt.delimiter(), Delimiter::Bracket), - _ => panic!("expected brackets"), - } - *slice = &slice[2..]; -} - -fn assert_foo(slice: &mut &[TokenTree]) { - match &slice[0] { - TokenTree::Ident(tt) => assert_eq!(&*tt.to_string(), "fn"), - _ => panic!("expected fn"), - } - match &slice[1] { - TokenTree::Ident(tt) => assert_eq!(&*tt.to_string(), "foo"), - _ => panic!("expected foo"), - } - match &slice[2] { - TokenTree::Group(tt) => { - assert_eq!(tt.delimiter(), Delimiter::Parenthesis); - assert!(tt.stream().is_empty()); - } - _ => panic!("expected parens"), - } - match &slice[3] { - TokenTree::Group(tt) => assert_eq!(tt.delimiter(), Delimiter::Brace), - _ => panic!("expected braces"), - } - *slice = &slice[4..]; -} - -fn fold_stream(input: TokenStream) -> TokenStream { - input.into_iter().map(fold_tree).collect() -} - -fn fold_tree(input: TokenTree) -> TokenTree { - match input { - TokenTree::Group(b) => { - TokenTree::Group(Group::new(b.delimiter(), fold_stream(b.stream()))) - } - TokenTree::Punct(b) => TokenTree::Punct(b), - TokenTree::Ident(a) => TokenTree::Ident(a), - TokenTree::Literal(a) => { - if a.to_string() != "\"foo\"" { - TokenTree::Literal(a) - } else { - TokenTree::Literal(Literal::i32_unsuffixed(3)) - } - } - } -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/bang_proc_macro2.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/bang_proc_macro2.rs deleted file mode 100644 index 3f0a4574367..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/bang_proc_macro2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro] -pub fn bang_proc_macro2(_: TokenStream) -> TokenStream { - "let x = foobar2;".parse().unwrap() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a-b.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a-b.rs deleted file mode 100644 index cd8750bc89c..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a-b.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::TokenStream; - -#[proc_macro_derive(A)] -pub fn derive_a(_: TokenStream) -> TokenStream { - "".parse().unwrap() -} - -#[proc_macro_derive(B)] -pub fn derive_b(_: TokenStream) -> TokenStream { - "".parse().unwrap() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a.rs deleted file mode 100644 index 53b2c23e5d7..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-a.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(A)] -pub fn derive_a(input: TokenStream) -> TokenStream { - "".parse().unwrap() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-b.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-b.rs deleted file mode 100644 index 5787546fb1e..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-b.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(B, attributes(B))] -pub fn derive_b(input: TokenStream) -> TokenStream { - "".parse().unwrap() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-bad.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-bad.rs deleted file mode 100644 index 841b39eaed0..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-bad.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic -// force-host - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(A)] -pub fn derive_a(_input: TokenStream) -> TokenStream { - "struct A { inner }".parse().unwrap() -} - diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-clona.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-clona.rs deleted file mode 100644 index 719fbdb15ef..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-clona.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(Clona)] -pub fn derive_clonea(input: TokenStream) -> TokenStream { - "".parse().unwrap() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-foo.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-foo.rs deleted file mode 100644 index 64dcf72ba20..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-foo.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(FooWithLongName)] -pub fn derive_foo(input: TokenStream) -> TokenStream { - "".parse().unwrap() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-unstable-2.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-unstable-2.rs deleted file mode 100644 index 2d492d341eb..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-unstable-2.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(Unstable)] -pub fn derive(_input: TokenStream) -> TokenStream { - - " - #[rustc_foo] - fn foo() {} - ".parse().unwrap() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-unstable.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-unstable.rs deleted file mode 100644 index a7b5d1e3e54..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/derive-unstable.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(Unstable)] -pub fn derive(_input: TokenStream) -> TokenStream { - - "unsafe fn foo() -> u32 { ::std::intrinsics::init() }".parse().unwrap() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue-41211.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue-41211.rs deleted file mode 100644 index 5365e8238e9..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue-41211.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn emit_unchanged(_args: TokenStream, input: TokenStream) -> TokenStream { - input -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue_38586.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue_38586.rs deleted file mode 100644 index e1a7ffaa26c..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue_38586.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -#[proc_macro_derive(A)] -pub fn derive_a(_: proc_macro::TokenStream) -> proc_macro::TokenStream { - "fn f() { println!(\"{}\", foo); }".parse().unwrap() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue_50493.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue_50493.rs deleted file mode 100644 index e71b792a48a..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/issue_50493.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::TokenStream; - -#[proc_macro_derive(Derive)] -pub fn derive(_: TokenStream) -> TokenStream { - let code = " - fn one(r: Restricted) { - r.field; - } - fn two(r: Restricted) { - r.field; - } - "; - - code.parse().unwrap() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/more-gates.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/more-gates.rs deleted file mode 100644 index 67fe93058aa..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/more-gates.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro_attribute] -pub fn attr2mac1(_: TokenStream, _: TokenStream) -> TokenStream { - "macro_rules! foo1 { (a) => (a) }".parse().unwrap() -} - -#[proc_macro_attribute] -pub fn attr2mac2(_: TokenStream, _: TokenStream) -> TokenStream { - "macro foo2(a) { a }".parse().unwrap() -} - -#[proc_macro] -pub fn mac2mac1(_: TokenStream) -> TokenStream { - "macro_rules! foo3 { (a) => (a) }".parse().unwrap() -} - -#[proc_macro] -pub fn mac2mac2(_: TokenStream) -> TokenStream { - "macro foo4(a) { a }".parse().unwrap() -} - -#[proc_macro] -pub fn tricky(_: TokenStream) -> TokenStream { - "fn foo() { - macro_rules! foo { (a) => (a) } - }".parse().unwrap() -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/proc-macro-gates.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/proc-macro-gates.rs deleted file mode 100644 index 0f8fd5b5709..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/proc-macro-gates.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic -// force-host - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro] -pub fn m(a: TokenStream) -> TokenStream { - a -} - -#[proc_macro_attribute] -pub fn a(_a: TokenStream, b: TokenStream) -> TokenStream { - b -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/test-macros.rs b/src/test/compile-fail-fulldeps/proc-macro/auxiliary/test-macros.rs deleted file mode 100644 index 581c7cb15a5..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/auxiliary/test-macros.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn nop_attr(_attr: TokenStream, input: TokenStream) -> TokenStream { - assert!(_attr.to_string().is_empty()); - input -} - -#[proc_macro_attribute] -pub fn no_output(_attr: TokenStream, _input: TokenStream) -> TokenStream { - assert!(_attr.to_string().is_empty()); - assert!(!_input.to_string().is_empty()); - "".parse().unwrap() -} - -#[proc_macro] -pub fn emit_input(input: TokenStream) -> TokenStream { - input -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/define-two.rs b/src/test/compile-fail-fulldeps/proc-macro/define-two.rs deleted file mode 100644 index 8321c471b2a..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/define-two.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(A)] -pub fn foo(input: TokenStream) -> TokenStream { - input -} - -#[proc_macro_derive(A)] //~ ERROR the name `A` is defined multiple times -pub fn bar(input: TokenStream) -> TokenStream { - input -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs b/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs deleted file mode 100644 index 93790f59372..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-bad.rs -// ignore-stage1 - -#[macro_use] -extern crate derive_bad; - -#[derive( - A -)] -//~^^ ERROR proc-macro derive produced unparseable tokens -//~| ERROR expected `:`, found `}` -struct A; - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/proc-macro/derive-still-gated.rs b/src/test/compile-fail-fulldeps/proc-macro/derive-still-gated.rs deleted file mode 100644 index f36236c5356..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/derive-still-gated.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-a.rs - -#![allow(warnings)] - -#[macro_use] -extern crate derive_a; - -#[derive_A] //~ ERROR: attributes of the form `#[derive_*]` are reserved for the compiler -struct A; - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable-2.rs b/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable-2.rs deleted file mode 100644 index 6f254dcbdb1..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable-2.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-unstable-2.rs -// ignore-stage1 - -#![allow(warnings)] - -#[macro_use] -extern crate derive_unstable_2; - -#[derive(Unstable)] -//~^ ERROR: reserved for internal compiler -struct A; - -fn main() { - foo(); -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable.rs b/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable.rs deleted file mode 100644 index ca0f0e382ed..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-unstable.rs -// ignore-stage1 - -#![allow(warnings)] - -#[macro_use] -extern crate derive_unstable; - -#[derive(Unstable)] -//~^ ERROR: use of unstable library feature -struct A; - -fn main() { - unsafe { foo(); } -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/export-macro.rs b/src/test/compile-fail-fulldeps/proc-macro/export-macro.rs deleted file mode 100644 index 477039bd7a2..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/export-macro.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern: cannot export macro_rules! macros from a `proc-macro` crate - -#![crate_type = "proc-macro"] - -#[macro_export] -macro_rules! foo { - ($e:expr) => ($e) -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/exports.rs b/src/test/compile-fail-fulldeps/proc-macro/exports.rs deleted file mode 100644 index 41b94d04e8c..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/exports.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "proc-macro"] -#![allow(warnings)] - -pub fn a() {} //~ ERROR: cannot export any items -pub struct B; //~ ERROR: cannot export any items -pub enum C {} //~ ERROR: cannot export any items -pub mod d {} //~ ERROR: cannot export any items - -mod e {} -struct F; -enum G {} -fn h() {} diff --git a/src/test/compile-fail-fulldeps/proc-macro/illegal-proc-macro-derive-use.rs b/src/test/compile-fail-fulldeps/proc-macro/illegal-proc-macro-derive-use.rs deleted file mode 100644 index f37980c5e0f..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/illegal-proc-macro-derive-use.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern crate proc_macro; - -#[proc_macro_derive(Foo)] -//~^ ERROR: only usable with crates of the `proc-macro` crate type -pub fn foo(a: proc_macro::TokenStream) -> proc_macro::TokenStream { - a -} - -// Issue #37590 -#[proc_macro_derive(Foo)] -//~^ ERROR: the `#[proc_macro_derive]` attribute may only be used on bare functions -pub struct Foo { -} - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/proc-macro/import.rs b/src/test/compile-fail-fulldeps/proc-macro/import.rs deleted file mode 100644 index fae2439344f..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/import.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-a.rs - -#![allow(warnings)] - -#[macro_use] -extern crate derive_a; - -use derive_a::derive_a; -//~^ ERROR: unresolved import `derive_a::derive_a` - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-37788.rs b/src/test/compile-fail-fulldeps/proc-macro/issue-37788.rs deleted file mode 100644 index 691c2805801..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/issue-37788.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-a-b.rs - -#[macro_use] -extern crate derive_a_b; - -fn main() { - // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE. - std::cell::Cell::new(0) //~ ERROR mismatched types -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-38586.rs b/src/test/compile-fail-fulldeps/proc-macro/issue-38586.rs deleted file mode 100644 index 2d843d0e466..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/issue-38586.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:issue_38586.rs -// ignore-stage1 - -#[macro_use] -extern crate issue_38586; - -#[derive(A)] //~ ERROR `foo` -struct A; - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs b/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs deleted file mode 100644 index e0922c452b5..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:issue-41211.rs - -// FIXME: https://github.com/rust-lang/rust/issues/41430 -// This is a temporary regression test for the ICE reported in #41211 - -#![feature(custom_inner_attributes)] - -#![emit_unchanged] -//~^ ERROR attribute `emit_unchanged` is currently unknown to the compiler -extern crate issue_41211; -use issue_41211::emit_unchanged; - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs b/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs deleted file mode 100644 index eaa64c6ba36..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:issue_50493.rs -// ignore-stage1 - -#[macro_use] -extern crate issue_50493; - -#[derive(Derive)] //~ ERROR field `field` of struct `Restricted` is private -struct Restricted { - pub(in restricted) field: usize, //~ visibilities can only be restricted to ancestor modules -} - -mod restricted {} - -fn main() {} - diff --git a/src/test/compile-fail-fulldeps/proc-macro/item-error.rs b/src/test/compile-fail-fulldeps/proc-macro/item-error.rs deleted file mode 100644 index c0d4d71a6ec..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/item-error.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-b.rs -// ignore-stage1 - -#![allow(warnings)] - -#[macro_use] -extern crate derive_b; - -#[derive(B)] -struct A { - a: &u64 -//~^ ERROR: missing lifetime specifier -} - -fn main() { -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs b/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs deleted file mode 100644 index 60e533d3ea8..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:bang_proc_macro2.rs -// ignore-stage1 - -#![feature(proc_macro_hygiene)] -#![allow(unused_macros)] - -extern crate bang_proc_macro2; - -use bang_proc_macro2::bang_proc_macro2; - -fn main() { - let foobar = 42; - bang_proc_macro2!(); - //~^ ERROR cannot find value `foobar2` in this scope - //~^^ did you mean `foobar`? - println!("{}", x); -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs b/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs deleted file mode 100644 index f280e74fc90..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:test-macros.rs -// ignore-stage1 -// ignore-wasm32 - -extern crate test_macros; - -use test_macros::{nop_attr, no_output, emit_input}; - -fn main() { - assert_eq!(unsafe { rust_get_test_int() }, 0isize); - assert_eq!(unsafe { rust_dbg_extern_identity_u32(0xDEADBEEF) }, 0xDEADBEEF); -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - #[no_output] - //~^ ERROR macro invocations in `extern {}` blocks are experimental - fn some_definitely_unknown_symbol_which_should_be_removed(); - - #[nop_attr] - //~^ ERROR macro invocations in `extern {}` blocks are experimental - fn rust_get_test_int() -> isize; - - emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;); - //~^ ERROR macro invocations in `extern {}` blocks are experimental -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/more-gates.rs b/src/test/compile-fail-fulldeps/proc-macro/more-gates.rs deleted file mode 100644 index 4c038179544..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/more-gates.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:more-gates.rs - -extern crate more_gates as foo; - -use foo::*; - -#[attr2mac1] -//~^ ERROR: cannot expand to macro definitions -pub fn a() {} -#[attr2mac2] -//~^ ERROR: cannot expand to macro definitions -pub fn a() {} - -mac2mac1!(); //~ ERROR: cannot expand to macro definitions -mac2mac2!(); //~ ERROR: cannot expand to macro definitions - -tricky!(); -//~^ ERROR: cannot expand to macro definitions - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/proc-macro/no-macro-use-attr.rs b/src/test/compile-fail-fulldeps/proc-macro/no-macro-use-attr.rs deleted file mode 100644 index ab05ca28386..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/no-macro-use-attr.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-a.rs - -#![feature(rustc_attrs)] -#![warn(unused_extern_crates)] - -extern crate derive_a; -//~^ WARN unused extern crate - -#[rustc_error] -fn main() {} //~ ERROR compilation successful diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs deleted file mode 100644 index d0aed8b1624..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-b.rs -// ignore-stage1 - -#[macro_use] -extern crate derive_b; - -#[B] -#[C] //~ ERROR attribute `C` is currently unknown to the compiler -#[B(D)] -#[B(E = "foo")] -#[B(arbitrary tokens)] -#[derive(B)] -struct B; - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs deleted file mode 100644 index 5049a474dd2..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:proc-macro-gates.rs -// gate-test-proc_macro_hygiene - -#![feature(stmt_expr_attributes)] - -extern crate proc_macro_gates as foo; - -use foo::*; - -fn _test_inner() { - #![a] //~ ERROR: non-builtin inner attributes are unstable -} - -#[a] //~ ERROR: custom attributes cannot be applied to modules -mod _test2 {} - -mod _test2_inner { - #![a] //~ ERROR: custom attributes cannot be applied to modules - //~| ERROR: non-builtin inner attributes are unstable -} - -#[a = y] //~ ERROR: must only be followed by a delimiter token -fn _test3() {} - -fn attrs() { - // Statement, item - #[a] // OK - struct S; - - // Statement, macro - #[a] //~ ERROR: custom attributes cannot be applied to statements - println!(); - - // Statement, semi - #[a] //~ ERROR: custom attributes cannot be applied to statements - S; - - // Statement, local - #[a] //~ ERROR: custom attributes cannot be applied to statements - let _x = 2; - - // Expr - let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expressions - - // Opt expr - let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to expressions - - // Expr macro - let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applied to expressions -} - -fn main() { - let _x: m!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to types - if let m!(Some(_x)) = Some(3) {} //~ ERROR: procedural macros cannot be expanded to patterns - - m!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements - m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements - - let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expressions - let _x = [m!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs deleted file mode 100644 index dc182414a1d..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:proc-macro-gates.rs - -#![feature(stmt_expr_attributes)] - -extern crate proc_macro_gates as foo; - -use foo::*; - -// NB. these errors aren't the best errors right now, but they're definitely -// intended to be errors. Somehow using a custom attribute in these positions -// should either require a feature gate or not be allowed on stable. - -fn _test6<#[a] T>() {} -//~^ ERROR: unknown to the compiler - -fn _test7() { - match 1 { - #[a] //~ ERROR: unknown to the compiler - 0 => {} - _ => {} - } -} - -fn main() { -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/pub-at-crate-root.rs b/src/test/compile-fail-fulldeps/proc-macro/pub-at-crate-root.rs deleted file mode 100644 index 238dde5160c..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/pub-at-crate-root.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -pub mod a { //~ `proc-macro` crate types cannot export any items - use proc_macro::TokenStream; - - #[proc_macro_derive(B)] - pub fn bar(a: TokenStream) -> TokenStream { - //~^ ERROR: must currently reside in the root of the crate - a - } -} - -#[proc_macro_derive(B)] -fn bar(a: proc_macro::TokenStream) -> proc_macro::TokenStream { -//~^ ERROR: functions tagged with `#[proc_macro_derive]` must be `pub` - a -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/shadow-builtin.rs b/src/test/compile-fail-fulldeps/proc-macro/shadow-builtin.rs deleted file mode 100644 index 8c5affb7b5a..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/shadow-builtin.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(PartialEq)] -//~^ ERROR: cannot override a built-in #[derive] mode -pub fn foo(input: TokenStream) -> TokenStream { - input -} diff --git a/src/test/compile-fail-fulldeps/proc-macro/shadow.rs b/src/test/compile-fail-fulldeps/proc-macro/shadow.rs deleted file mode 100644 index 9bff1c57ae4..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/shadow.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-a.rs - -#[macro_use] -extern crate derive_a; -#[macro_use] -extern crate derive_a; //~ ERROR the name `derive_a` is defined multiple times - -fn main() {} diff --git a/src/test/compile-fail-fulldeps/proc-macro/two-crate-types-1.rs b/src/test/compile-fail-fulldeps/proc-macro/two-crate-types-1.rs deleted file mode 100644 index db646fb7815..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/two-crate-types-1.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern: cannot mix `proc-macro` crate type with others - -#![crate_type = "proc-macro"] -#![crate_type = "rlib"] diff --git a/src/test/compile-fail-fulldeps/proc-macro/two-crate-types-2.rs b/src/test/compile-fail-fulldeps/proc-macro/two-crate-types-2.rs deleted file mode 100644 index 97b0f844604..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/two-crate-types-2.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern: cannot mix `proc-macro` crate type with others -// compile-flags: --crate-type rlib --crate-type proc-macro diff --git a/src/test/compile-fail-fulldeps/qquote.rs b/src/test/compile-fail-fulldeps/qquote.rs deleted file mode 100644 index 4b0bc8f02b4..00000000000 --- a/src/test/compile-fail-fulldeps/qquote.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-cross-compile - -#![feature(quote, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; - -use syntax::ast; -use syntax::source_map::FilePathMapping; -use syntax::print::pprust; -use syntax::symbol::Symbol; -use syntax_pos::DUMMY_SP; - -fn main() { - let ps = syntax::parse::ParseSess::new(FilePathMapping::empty()); - let mut resolver = syntax::ext::base::DummyResolver; - let mut cx = syntax::ext::base::ExtCtxt::new( - &ps, - syntax::ext::expand::ExpansionConfig::default("qquote".to_string()), - &mut resolver); - let cx = &mut cx; - - assert_eq!(pprust::expr_to_string(&*quote_expr!(&cx, 23)), "23"); - - let expr = quote_expr!(&cx, 2 - $abcd + 7); //~ ERROR cannot find value `abcd` in this scope - assert_eq!(pprust::expr_to_string(&*expr), "2 - $abcd + 7"); -} diff --git a/src/test/compile-fail/asm-src-loc-codegen-units.rs b/src/test/compile-fail/asm-src-loc-codegen-units.rs index 6c5c5b00776..798eb32181c 100644 --- a/src/test/compile-fail/asm-src-loc-codegen-units.rs +++ b/src/test/compile-fail/asm-src-loc-codegen-units.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // WONTFIX(#20184) Needs landing pads (not present in stage1) or the compiler hangs. // ignore-stage1 // compile-flags: -C codegen-units=2 diff --git a/src/test/compile-fail/asm-src-loc.rs b/src/test/compile-fail/asm-src-loc.rs index 59b47c2408d..0b60256e7fd 100644 --- a/src/test/compile-fail/asm-src-loc.rs +++ b/src/test/compile-fail/asm-src-loc.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten #![feature(asm)] diff --git a/src/test/compile-fail/auxiliary/crateresolve1-1.rs b/src/test/compile-fail/auxiliary/crateresolve1-1.rs index 050f2fe7329..a00a19e46d5 100644 --- a/src/test/compile-fail/auxiliary/crateresolve1-1.rs +++ b/src/test/compile-fail/auxiliary/crateresolve1-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C extra-filename=-1 #![crate_name = "crateresolve1"] #![crate_type = "lib"] diff --git a/src/test/compile-fail/auxiliary/crateresolve1-2.rs b/src/test/compile-fail/auxiliary/crateresolve1-2.rs index d19b3bafba5..71cc0a12ea3 100644 --- a/src/test/compile-fail/auxiliary/crateresolve1-2.rs +++ b/src/test/compile-fail/auxiliary/crateresolve1-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C extra-filename=-2 #![crate_name = "crateresolve1"] #![crate_type = "lib"] diff --git a/src/test/compile-fail/auxiliary/crateresolve1-3.rs b/src/test/compile-fail/auxiliary/crateresolve1-3.rs index c5096ac49a8..921687d4c3b 100644 --- a/src/test/compile-fail/auxiliary/crateresolve1-3.rs +++ b/src/test/compile-fail/auxiliary/crateresolve1-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C extra-filename=-3 #![crate_name = "crateresolve1"] #![crate_type = "lib"] diff --git a/src/test/compile-fail/auxiliary/depends.rs b/src/test/compile-fail/auxiliary/depends.rs new file mode 100644 index 00000000000..e9bc2f4893e --- /dev/null +++ b/src/test/compile-fail/auxiliary/depends.rs @@ -0,0 +1,8 @@ +// no-prefer-dynamic + +#![feature(panic_runtime)] +#![crate_type = "rlib"] +#![panic_runtime] +#![no_std] + +extern crate needs_panic_runtime; diff --git a/src/test/compile-fail/auxiliary/needs-panic-runtime.rs b/src/test/compile-fail/auxiliary/needs-panic-runtime.rs new file mode 100644 index 00000000000..3f030c169f6 --- /dev/null +++ b/src/test/compile-fail/auxiliary/needs-panic-runtime.rs @@ -0,0 +1,6 @@ +// no-prefer-dynamic + +#![feature(needs_panic_runtime)] +#![crate_type = "rlib"] +#![needs_panic_runtime] +#![no_std] diff --git a/src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs b/src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs index d9848a554ab..abe34a39caf 100644 --- a/src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs +++ b/src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/compile-fail/auxiliary/panic-runtime-unwind.rs b/src/test/compile-fail/auxiliary/panic-runtime-unwind.rs index 4bb36839d98..97452a342ab 100644 --- a/src/test/compile-fail/auxiliary/panic-runtime-unwind.rs +++ b/src/test/compile-fail/auxiliary/panic-runtime-unwind.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=unwind // no-prefer-dynamic diff --git a/src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs b/src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs index 4bb36839d98..97452a342ab 100644 --- a/src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs +++ b/src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=unwind // no-prefer-dynamic diff --git a/src/test/compile-fail/auxiliary/some-panic-impl.rs b/src/test/compile-fail/auxiliary/some-panic-impl.rs index 090123198d1..0348b3a2d76 100644 --- a/src/test/compile-fail/auxiliary/some-panic-impl.rs +++ b/src/test/compile-fail/auxiliary/some-panic-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs b/src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs index 2183338b249..d5f0102196f 100644 --- a/src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs +++ b/src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/compile-fail/auxiliary/weak-lang-items.rs b/src/test/compile-fail/auxiliary/weak-lang-items.rs index 6434e62b6f7..7a698cf76ae 100644 --- a/src/test/compile-fail/auxiliary/weak-lang-items.rs +++ b/src/test/compile-fail/auxiliary/weak-lang-items.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // This aux-file will require the eh_personality function to be codegen'd, but diff --git a/src/test/compile-fail/chalkify/chalk_initial_program.rs b/src/test/compile-fail/chalkify/chalk_initial_program.rs new file mode 100644 index 00000000000..df25bad622b --- /dev/null +++ b/src/test/compile-fail/chalkify/chalk_initial_program.rs @@ -0,0 +1,16 @@ +// compile-flags: -Z chalk + +trait Foo { } + +impl Foo for i32 { } + +impl Foo for u32 { } + +fn gimme() { } + +// Note: this also tests that `std::process::Termination` is implemented for `()`. +fn main() { + gimme::(); + gimme::(); + gimme::(); //~ERROR the trait bound `f32: Foo` is not satisfied +} diff --git a/src/test/compile-fail/chalkify/generic_impls.rs b/src/test/compile-fail/chalkify/generic_impls.rs new file mode 100644 index 00000000000..d70c6f8055d --- /dev/null +++ b/src/test/compile-fail/chalkify/generic_impls.rs @@ -0,0 +1,18 @@ +// compile-flags: -Z chalk + +trait Foo { } + +impl Foo for (T, u32) { } + +fn gimme() { } + +fn foo() { + gimme::<(T, u32)>(); + gimme::<(Option, u32)>(); + gimme::<(Option, f32)>(); //~ ERROR +} + +fn main() { + gimme::<(i32, u32)>(); + gimme::<(i32, f32)>(); //~ ERROR +} diff --git a/src/test/compile-fail/chalkify/impl_wf.rs b/src/test/compile-fail/chalkify/impl_wf.rs new file mode 100644 index 00000000000..96b1b253371 --- /dev/null +++ b/src/test/compile-fail/chalkify/impl_wf.rs @@ -0,0 +1,38 @@ +// compile-flags: -Z chalk + +trait Foo: Sized { } + +trait Bar { + type Item: Foo; +} + +impl Foo for i32 { } + +impl Foo for str { } +//~^ ERROR the size for values of type `str` cannot be known at compilation time + +// Implicit `T: Sized` bound. +impl Foo for Option { } + +impl Bar for () { + type Item = i32; +} + +impl Bar for Option { + type Item = Option; +} + +impl Bar for f32 { +//~^ ERROR the trait bound `f32: Foo` is not satisfied + type Item = f32; +} + +trait Baz where U: Foo { } + +impl Baz for i32 { } + +impl Baz for f32 { } +//~^ ERROR the trait bound `f32: Foo` is not satisfied + +fn main() { +} diff --git a/src/test/compile-fail/chalkify/type_wf.rs b/src/test/compile-fail/chalkify/type_wf.rs new file mode 100644 index 00000000000..d1aa975ddc2 --- /dev/null +++ b/src/test/compile-fail/chalkify/type_wf.rs @@ -0,0 +1,24 @@ +// compile-flags: -Z chalk + +trait Foo { } + +struct S { + x: T, +} + +impl Foo for i32 { } +impl Foo for Option { } + +fn main() { + let s = S { + x: 5, + }; + + let s = S { //~ ERROR the trait bound `{float}: Foo` is not satisfied + x: 5.0, + }; + + let s = S { + x: Some(5.0), + }; +} diff --git a/src/test/compile-fail/coerce-unsafe-to-closure.rs b/src/test/compile-fail/coerce-unsafe-to-closure.rs index 90cbbf242aa..78bdd36f9cc 100644 --- a/src/test/compile-fail/coerce-unsafe-to-closure.rs +++ b/src/test/compile-fail/coerce-unsafe-to-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: Option<&[u8]> = Some("foo").map(std::mem::transmute); //~^ ERROR E0277 diff --git a/src/test/compile-fail/const-err3.rs b/src/test/compile-fail/const-err3.rs index f5e43b57e77..fc10824f0c0 100644 --- a/src/test/compile-fail/const-err3.rs +++ b/src/test/compile-fail/const-err3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #![deny(const_err)] diff --git a/src/test/compile-fail/const-fn-error.rs b/src/test/compile-fail/const-fn-error.rs index 17dc9f94fe1..da6036a04a5 100644 --- a/src/test/compile-fail/const-fn-error.rs +++ b/src/test/compile-fail/const-fn-error.rs @@ -1,21 +1,9 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_fn)] const X : usize = 2; const fn f(x: usize) -> usize { let mut sum = 0; - //~^ let bindings in constant functions are unstable - //~| statements in constant functions are unstable for i in 0..x { //~^ ERROR E0015 //~| ERROR E0019 diff --git a/src/test/compile-fail/crateresolve1.rs b/src/test/compile-fail/crateresolve1.rs index 8c3dbda6802..453c8d97622 100644 --- a/src/test/compile-fail/crateresolve1.rs +++ b/src/test/compile-fail/crateresolve1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:crateresolve1-1.rs // aux-build:crateresolve1-2.rs // aux-build:crateresolve1-3.rs diff --git a/src/test/compile-fail/empty-extern-arg.rs b/src/test/compile-fail/empty-extern-arg.rs index 8791481d9e7..ae28fcad903 100644 --- a/src/test/compile-fail/empty-extern-arg.rs +++ b/src/test/compile-fail/empty-extern-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --extern std= // error-pattern: can't find crate for `std` diff --git a/src/test/compile-fail/invalid-link-args.rs b/src/test/compile-fail/invalid-link-args.rs new file mode 100644 index 00000000000..1e68b4f8b70 --- /dev/null +++ b/src/test/compile-fail/invalid-link-args.rs @@ -0,0 +1,12 @@ +// ignore-msvc due to linker-flavor=ld +// error-pattern:aFdEfSeVEEE +// compile-flags: -C linker-flavor=ld + +/* Make sure invalid link_args are printed to stderr. */ + +#![feature(link_args)] + +#[link_args = "aFdEfSeVEEE"] +extern {} + +fn main() { } diff --git a/src/test/compile-fail/issue-10755.rs b/src/test/compile-fail/issue-10755.rs index 57915bce456..3c6fcddc0d2 100644 --- a/src/test/compile-fail/issue-10755.rs +++ b/src/test/compile-fail/issue-10755.rs @@ -1,14 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -C linker=llllll -Z linker-flavor=ld +// compile-flags: -C linker=llllll -C linker-flavor=ld // error-pattern: linker `llllll` not found fn main() { diff --git a/src/test/compile-fail/issue-23595-1.rs b/src/test/compile-fail/issue-23595-1.rs index a3422d859c6..b8a0c4846ab 100644 --- a/src/test/compile-fail/issue-23595-1.rs +++ b/src/test/compile-fail/issue-23595-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_type_defaults)] use std::ops::{Index}; @@ -16,9 +6,7 @@ trait Hierarchy { type Value; type ChildKey; type Children = Index; - //~^ ERROR: the value of the associated type `ChildKey` - //~^^ ERROR: the value of the associated type `Children` - //~^^^ ERROR: the value of the associated type `Value` + //~^ ERROR: the value of the associated types `Value` (from the trait `Hierarchy`), `ChildKey` fn data(&self) -> Option<(Self::Value, Self::Children)>; } diff --git a/src/test/compile-fail/issue-43733-2.rs b/src/test/compile-fail/issue-43733-2.rs index 86ae3e2113c..2943089674d 100644 --- a/src/test/compile-fail/issue-43733-2.rs +++ b/src/test/compile-fail/issue-43733-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(cfg_target_thread_local, thread_local_internals)] // On platforms *without* `#[thread_local]`, use diff --git a/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs b/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs index f5a20dd96dc..d54c9931479 100644 --- a/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs +++ b/src/test/compile-fail/issue-46209-private-enum-variant-reexport.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(crate_visibility_modifier)] mod rank { diff --git a/src/test/compile-fail/issue-52443.rs b/src/test/compile-fail/issue-52443.rs index 1ed513033fd..e1f07ff96be 100644 --- a/src/test/compile-fail/issue-52443.rs +++ b/src/test/compile-fail/issue-52443.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { [(); & { loop { continue } } ]; //~ ERROR mismatched types [(); loop { break }]; //~ ERROR mismatched types diff --git a/src/test/compile-fail/meta-expected-error-wrong-rev.rs b/src/test/compile-fail/meta-expected-error-wrong-rev.rs index 8869e950b3a..7e49434142b 100644 --- a/src/test/compile-fail/meta-expected-error-wrong-rev.rs +++ b/src/test/compile-fail/meta-expected-error-wrong-rev.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-compare-mode-nll // revisions: a diff --git a/src/test/compile-fail/must_use-in-stdlib-traits.rs b/src/test/compile-fail/must_use-in-stdlib-traits.rs new file mode 100644 index 00000000000..7e446fdaeaf --- /dev/null +++ b/src/test/compile-fail/must_use-in-stdlib-traits.rs @@ -0,0 +1,47 @@ +#![deny(unused_must_use)] +#![feature(arbitrary_self_types, futures_api)] + +use std::iter::Iterator; +use std::future::Future; + +use std::task::{Poll, LocalWaker}; +use std::pin::Pin; +use std::unimplemented; + +struct MyFuture; + +impl Future for MyFuture { + type Output = u32; + + fn poll(self: Pin<&mut Self>, lw: &LocalWaker) -> Poll { + Poll::Pending + } +} + +fn iterator() -> impl Iterator { + std::iter::empty::() +} + +fn future() -> impl Future { + MyFuture +} + +fn square_fn_once() -> impl FnOnce(u32) -> u32 { + |x| x * x +} + +fn square_fn_mut() -> impl FnMut(u32) -> u32 { + |x| x * x +} + +fn square_fn() -> impl Fn(u32) -> u32 { + |x| x * x +} + +fn main() { + iterator(); //~ ERROR unused implementer of `std::iter::Iterator` that must be used + future(); //~ ERROR unused implementer of `std::future::Future` that must be used + square_fn_once(); //~ ERROR unused implementer of `std::ops::FnOnce` that must be used + square_fn_mut(); //~ ERROR unused implementer of `std::ops::FnMut` that must be used + square_fn(); //~ ERROR unused implementer of `std::ops::Fn` that must be used +} diff --git a/src/test/compile-fail/nolink-with-link-args.rs b/src/test/compile-fail/nolink-with-link-args.rs deleted file mode 100644 index 6dfd74f541e..00000000000 --- a/src/test/compile-fail/nolink-with-link-args.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:aFdEfSeVEE -// compile-flags: -Z linker-flavor=ld - -/* We're testing that link_args are indeed passed when nolink is specified. -So we try to compile with junk link_args and make sure they are visible in -the compiler output. */ - -#![feature(link_args)] - -#[link_args = "aFdEfSeVEEE"] -extern {} - -fn main() { } diff --git a/src/test/compile-fail/not-utf8.rs b/src/test/compile-fail/not-utf8.rs index 5331062d9b6..1cb1fdcb8c9 100644 --- a/src/test/compile-fail/not-utf8.rs +++ b/src/test/compile-fail/not-utf8.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: did not contain valid UTF-8 fn foo() { diff --git a/src/test/compile-fail/panic-handler-missing.rs b/src/test/compile-fail/panic-handler-missing.rs index d17c19b4c13..1c380c99c18 100644 --- a/src/test/compile-fail/panic-handler-missing.rs +++ b/src/test/compile-fail/panic-handler-missing.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: `#[panic_handler]` function required, but not found #![feature(lang_items)] diff --git a/src/test/compile-fail/panic-handler-twice.rs b/src/test/compile-fail/panic-handler-twice.rs index 10e0453cf5e..c0f2c51397e 100644 --- a/src/test/compile-fail/panic-handler-twice.rs +++ b/src/test/compile-fail/panic-handler-twice.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:some-panic-impl.rs #![feature(lang_items)] diff --git a/src/test/compile-fail/runtime-depend-on-needs-runtime.rs b/src/test/compile-fail/runtime-depend-on-needs-runtime.rs new file mode 100644 index 00000000000..866c5b2e34b --- /dev/null +++ b/src/test/compile-fail/runtime-depend-on-needs-runtime.rs @@ -0,0 +1,7 @@ +// aux-build:needs-panic-runtime.rs +// aux-build:depends.rs +// error-pattern:cannot depend on a crate that needs a panic runtime + +extern crate depends; + +fn main() {} diff --git a/src/test/compile-fail/runtime-depend-on-needs-runtime.stderr b/src/test/compile-fail/runtime-depend-on-needs-runtime.stderr new file mode 100644 index 00000000000..27e27dda5ef --- /dev/null +++ b/src/test/compile-fail/runtime-depend-on-needs-runtime.stderr @@ -0,0 +1,4 @@ +error: the crate `depends` cannot depend on a crate that needs a panic runtime, but it depends on `needs_panic_runtime` + +error: aborting due to previous error + diff --git a/src/test/compile-fail/specialization/issue-50452.rs b/src/test/compile-fail/specialization/issue-50452.rs index 4a8d01d0de2..d9e5280c7e1 100644 --- a/src/test/compile-fail/specialization/issue-50452.rs +++ b/src/test/compile-fail/specialization/issue-50452.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-fail #![feature(specialization)] diff --git a/src/test/compile-fail/two-panic-runtimes.rs b/src/test/compile-fail/two-panic-runtimes.rs index 36ed000e344..0c42cda775c 100644 --- a/src/test/compile-fail/two-panic-runtimes.rs +++ b/src/test/compile-fail/two-panic-runtimes.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:cannot link together two panic runtimes: panic_runtime_unwind and panic_runtime_unwind2 // ignore-tidy-linelength // aux-build:panic-runtime-unwind.rs diff --git a/src/test/compile-fail/want-abort-got-unwind.rs b/src/test/compile-fail/want-abort-got-unwind.rs index b178006411b..30782e18229 100644 --- a/src/test/compile-fail/want-abort-got-unwind.rs +++ b/src/test/compile-fail/want-abort-got-unwind.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:is not compiled with this crate's panic strategy `abort` // aux-build:panic-runtime-unwind.rs // compile-flags:-C panic=abort diff --git a/src/test/compile-fail/want-abort-got-unwind2.rs b/src/test/compile-fail/want-abort-got-unwind2.rs index de8e010c3cb..35d8d46b55e 100644 --- a/src/test/compile-fail/want-abort-got-unwind2.rs +++ b/src/test/compile-fail/want-abort-got-unwind2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:is not compiled with this crate's panic strategy `abort` // aux-build:panic-runtime-unwind.rs // aux-build:wants-panic-runtime-unwind.rs diff --git a/src/test/compile-fail/weak-lang-item.rs b/src/test/compile-fail/weak-lang-item.rs index 493c7080181..768b936dc27 100644 --- a/src/test/compile-fail/weak-lang-item.rs +++ b/src/test/compile-fail/weak-lang-item.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:weak-lang-items.rs // error-pattern: `#[panic_handler]` function required, but not found // error-pattern: language item required, but not found: `eh_personality` diff --git a/src/test/debuginfo/associated-types.rs b/src/test/debuginfo/associated-types.rs index db816a9ca29..caf07389dd8 100644 --- a/src/test/debuginfo/associated-types.rs +++ b/src/test/debuginfo/associated-types.rs @@ -1,14 +1,6 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// min-lldb-version: 310 +// Some versions of the non-rust-enabled LLDB print the wrong generic +// parameter type names in this test. +// rust-lldb // compile-flags:-g diff --git a/src/test/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs b/src/test/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs index f4bc72305a0..b9bb3ba7209 100644 --- a/src/test/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs +++ b/src/test/debuginfo/auxiliary/cross_crate_debuginfo_type_uniquing.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] // compile-flags:-g diff --git a/src/test/debuginfo/auxiliary/cross_crate_spans.rs b/src/test/debuginfo/auxiliary/cross_crate_spans.rs index 9b6b6221bda..efe5e419542 100644 --- a/src/test/debuginfo/auxiliary/cross_crate_spans.rs +++ b/src/test/debuginfo/auxiliary/cross_crate_spans.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![allow(unused_variables)] diff --git a/src/test/debuginfo/auxiliary/issue13213aux.rs b/src/test/debuginfo/auxiliary/issue13213aux.rs index d0566a1e091..bde98b44544 100644 --- a/src/test/debuginfo/auxiliary/issue13213aux.rs +++ b/src/test/debuginfo/auxiliary/issue13213aux.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] // compile-flags:-g diff --git a/src/test/debuginfo/auxiliary/macro-stepping.rs b/src/test/debuginfo/auxiliary/macro-stepping.rs index 1006b684a8c..4447dd22ddb 100644 --- a/src/test/debuginfo/auxiliary/macro-stepping.rs +++ b/src/test/debuginfo/auxiliary/macro-stepping.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-g #![crate_type = "rlib"] diff --git a/src/test/debuginfo/basic-types-globals-metadata.rs b/src/test/debuginfo/basic-types-globals-metadata.rs index b699eface3f..3934d3c7a68 100644 --- a/src/test/debuginfo/basic-types-globals-metadata.rs +++ b/src/test/debuginfo/basic-types-globals-metadata.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 diff --git a/src/test/debuginfo/basic-types-globals.rs b/src/test/debuginfo/basic-types-globals.rs index 51c36f8f1c1..389b2cf015c 100644 --- a/src/test/debuginfo/basic-types-globals.rs +++ b/src/test/debuginfo/basic-types-globals.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values) // as its numerical value along with its associated ASCII char, there // doesn't seem to be any way around this. Also, gdb doesn't know diff --git a/src/test/debuginfo/basic-types-metadata.rs b/src/test/debuginfo/basic-types-metadata.rs index 3dbfdea3c22..ca0a6e23202 100644 --- a/src/test/debuginfo/basic-types-metadata.rs +++ b/src/test/debuginfo/basic-types-metadata.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 diff --git a/src/test/debuginfo/basic-types-mut-globals.rs b/src/test/debuginfo/basic-types-mut-globals.rs index 2d4b4d61aa8..9b0c46fa478 100644 --- a/src/test/debuginfo/basic-types-mut-globals.rs +++ b/src/test/debuginfo/basic-types-mut-globals.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Caveats - gdb prints any 8-bit value (meaning rust I8 and u8 values) // as its numerical value along with its associated ASCII char, there // doesn't seem to be any way around this. Also, gdb doesn't know diff --git a/src/test/debuginfo/basic-types.rs b/src/test/debuginfo/basic-types.rs index dcd4588af76..3721b87678d 100644 --- a/src/test/debuginfo/basic-types.rs +++ b/src/test/debuginfo/basic-types.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Caveats - gdb prints any 8-bit value (meaning rust i8 and u8 values) // as its numerical value along with its associated ASCII char, there // doesn't seem to be any way around this. Also, gdb doesn't know diff --git a/src/test/debuginfo/borrowed-basic.rs b/src/test/debuginfo/borrowed-basic.rs index 1442082a7d8..6047177a501 100644 --- a/src/test/debuginfo/borrowed-basic.rs +++ b/src/test/debuginfo/borrowed-basic.rs @@ -1,14 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // Gdb doesn't know about UTF-32 character encoding and will print a rust char as only // its numerical value. diff --git a/src/test/debuginfo/borrowed-c-style-enum.rs b/src/test/debuginfo/borrowed-c-style-enum.rs index 366d3654832..ccd8d3b92ae 100644 --- a/src/test/debuginfo/borrowed-c-style-enum.rs +++ b/src/test/debuginfo/borrowed-c-style-enum.rs @@ -1,14 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // compile-flags:-g // min-lldb-version: 310 diff --git a/src/test/debuginfo/borrowed-enum-legacy.rs b/src/test/debuginfo/borrowed-enum-legacy.rs index a04f7d6dd8a..9a973ed74e8 100644 --- a/src/test/debuginfo/borrowed-enum-legacy.rs +++ b/src/test/debuginfo/borrowed-enum-legacy.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/borrowed-enum.rs b/src/test/debuginfo/borrowed-enum.rs index 20a97807fcc..e58819802ad 100644 --- a/src/test/debuginfo/borrowed-enum.rs +++ b/src/test/debuginfo/borrowed-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // Require LLVM with DW_TAG_variant_part and a gdb or lldb that can read it. diff --git a/src/test/debuginfo/borrowed-struct.rs b/src/test/debuginfo/borrowed-struct.rs index 71a1abdaa48..8162b3aa5db 100644 --- a/src/test/debuginfo/borrowed-struct.rs +++ b/src/test/debuginfo/borrowed-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-g // min-lldb-version: 310 diff --git a/src/test/debuginfo/borrowed-tuple.rs b/src/test/debuginfo/borrowed-tuple.rs index 8720ebbe89a..584284ce7dd 100644 --- a/src/test/debuginfo/borrowed-tuple.rs +++ b/src/test/debuginfo/borrowed-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/borrowed-unique-basic.rs b/src/test/debuginfo/borrowed-unique-basic.rs index b073bc5ee6b..789eb0f346a 100644 --- a/src/test/debuginfo/borrowed-unique-basic.rs +++ b/src/test/debuginfo/borrowed-unique-basic.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // Gdb doesn't know about UTF-32 character encoding and will print a rust char as only diff --git a/src/test/debuginfo/box.rs b/src/test/debuginfo/box.rs index 6bb883a2109..969e1d7a575 100644 --- a/src/test/debuginfo/box.rs +++ b/src/test/debuginfo/box.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/boxed-struct.rs b/src/test/debuginfo/boxed-struct.rs index 72bf9fcaff9..db0f942a079 100644 --- a/src/test/debuginfo/boxed-struct.rs +++ b/src/test/debuginfo/boxed-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/by-value-non-immediate-argument.rs b/src/test/debuginfo/by-value-non-immediate-argument.rs index 9007b44296b..11a115e2393 100644 --- a/src/test/debuginfo/by-value-non-immediate-argument.rs +++ b/src/test/debuginfo/by-value-non-immediate-argument.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 // min-lldb-version: 310 diff --git a/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs b/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs index c0fb2dbdda2..deba18cc44a 100644 --- a/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs +++ b/src/test/debuginfo/by-value-self-argument-in-trait-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/c-style-enum-in-composite.rs b/src/test/debuginfo/c-style-enum-in-composite.rs index 32517f82cf1..b3165f70590 100644 --- a/src/test/debuginfo/c-style-enum-in-composite.rs +++ b/src/test/debuginfo/c-style-enum-in-composite.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/c-style-enum.rs b/src/test/debuginfo/c-style-enum.rs index a756d4fdf6c..5706d5c4cc6 100644 --- a/src/test/debuginfo/c-style-enum.rs +++ b/src/test/debuginfo/c-style-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // ignore-aarch64 diff --git a/src/test/debuginfo/closure-in-generic-function.rs b/src/test/debuginfo/closure-in-generic-function.rs index bb61b394a9c..239055b3a78 100644 --- a/src/test/debuginfo/closure-in-generic-function.rs +++ b/src/test/debuginfo/closure-in-generic-function.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/constant-debug-locs.rs b/src/test/debuginfo/constant-debug-locs.rs index f5dab5a55b4..bf85fdca421 100644 --- a/src/test/debuginfo/constant-debug-locs.rs +++ b/src/test/debuginfo/constant-debug-locs.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/constant-in-match-pattern.rs b/src/test/debuginfo/constant-in-match-pattern.rs index 6974238ac72..e1b533b723b 100644 --- a/src/test/debuginfo/constant-in-match-pattern.rs +++ b/src/test/debuginfo/constant-in-match-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/cross-crate-spans.rs b/src/test/debuginfo/cross-crate-spans.rs index 715024a2ef9..96ddfd2a39e 100644 --- a/src/test/debuginfo/cross-crate-spans.rs +++ b/src/test/debuginfo/cross-crate-spans.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -25,7 +15,7 @@ extern crate cross_crate_spans; // === GDB TESTS =================================================================================== -// gdb-command:break cross_crate_spans.rs:24 +// gdb-command:break cross_crate_spans.rs:14 // gdb-command:run // gdb-command:print result @@ -50,7 +40,7 @@ extern crate cross_crate_spans; // === LLDB TESTS ================================================================================== -// lldb-command:b cross_crate_spans.rs:24 +// lldb-command:b cross_crate_spans.rs:14 // lldb-command:run // lldb-command:print result diff --git a/src/test/debuginfo/cross-crate-type-uniquing.rs b/src/test/debuginfo/cross-crate-type-uniquing.rs index 47365b2b9a0..5974ddb3a17 100644 --- a/src/test/debuginfo/cross-crate-type-uniquing.rs +++ b/src/test/debuginfo/cross-crate-type-uniquing.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // aux-build:cross_crate_debuginfo_type_uniquing.rs diff --git a/src/test/debuginfo/destructured-fn-argument.rs b/src/test/debuginfo/destructured-fn-argument.rs index 5eaf601d4c8..6d383dbfe80 100644 --- a/src/test/debuginfo/destructured-fn-argument.rs +++ b/src/test/debuginfo/destructured-fn-argument.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/destructured-for-loop-variable.rs b/src/test/debuginfo/destructured-for-loop-variable.rs index 77583ab1037..dbb98322317 100644 --- a/src/test/debuginfo/destructured-for-loop-variable.rs +++ b/src/test/debuginfo/destructured-for-loop-variable.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/destructured-local.rs b/src/test/debuginfo/destructured-local.rs index d9d628c7377..0911f1ba080 100644 --- a/src/test/debuginfo/destructured-local.rs +++ b/src/test/debuginfo/destructured-local.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/drop-locations.rs b/src/test/debuginfo/drop-locations.rs index 76c2826ee8c..c195f46208a 100644 --- a/src/test/debuginfo/drop-locations.rs +++ b/src/test/debuginfo/drop-locations.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows // ignore-android // ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 diff --git a/src/test/debuginfo/evec-in-struct.rs b/src/test/debuginfo/evec-in-struct.rs index b21759b70c0..74a6c19a152 100644 --- a/src/test/debuginfo/evec-in-struct.rs +++ b/src/test/debuginfo/evec-in-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/extern-c-fn.rs b/src/test/debuginfo/extern-c-fn.rs index d6ddd82ff05..742eeb85d63 100644 --- a/src/test/debuginfo/extern-c-fn.rs +++ b/src/test/debuginfo/extern-c-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/function-arg-initialization.rs b/src/test/debuginfo/function-arg-initialization.rs index 90088a0297a..fef62534b30 100644 --- a/src/test/debuginfo/function-arg-initialization.rs +++ b/src/test/debuginfo/function-arg-initialization.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 // min-lldb-version: 310 diff --git a/src/test/debuginfo/function-arguments.rs b/src/test/debuginfo/function-arguments.rs index 9fc03feec9b..5cfd7d1f8f1 100644 --- a/src/test/debuginfo/function-arguments.rs +++ b/src/test/debuginfo/function-arguments.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/function-call.rs b/src/test/debuginfo/function-call.rs new file mode 100644 index 00000000000..98ad8983a60 --- /dev/null +++ b/src/test/debuginfo/function-call.rs @@ -0,0 +1,42 @@ +// This test does not passed with gdb < 8.0. See #53497. +// min-gdb-version 8.0 + +// compile-flags:-g + +// === GDB TESTS =================================================================================== + +// gdb-command:run + +// gdb-command:print fun(45, true) +// gdb-check:$1 = true +// gdb-command:print fun(444, false) +// gdb-check:$2 = false + +// gdb-command:print r.get_x() +// gdb-check:$3 = 4 + +#![allow(dead_code, unused_variables)] + +struct RegularStruct { + x: i32 +} + +impl RegularStruct { + fn get_x(&self) -> i32 { + self.x + } +} + +fn main() { + let _ = fun(4, true); + let r = RegularStruct{x: 4}; + let _ = r.get_x(); + + zzz(); // #break +} + +fn fun(x: isize, y: bool) -> bool { + y +} + +fn zzz() { () } diff --git a/src/test/debuginfo/function-prologue-stepping-regular.rs b/src/test/debuginfo/function-prologue-stepping-regular.rs index d50d105e009..46901030f65 100644 --- a/src/test/debuginfo/function-prologue-stepping-regular.rs +++ b/src/test/debuginfo/function-prologue-stepping-regular.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test case checks if function arguments already have the correct value when breaking at the // beginning of a function. diff --git a/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs b/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs deleted file mode 100644 index 46f925f7ca5..00000000000 --- a/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-bitrig -// ignore-solaris -// ignore-windows failing on win32 bot -// ignore-freebsd: gdb package too new -// ignore-tidy-linelength -// ignore-lldb -// ignore-android: FIXME(#10381) -// compile-flags:-g - -// gdb-command: run - -// gdb-command: print regular_struct -// gdb-check:$1 = RegularStruct = {the_first_field = 101, the_second_field = 102.5, the_third_field = false} - -// gdb-command: print empty_struct -// gdb-check:$2 = EmptyStruct - -// gdb-command: print c_style_enum1 -// gdbg-check:$3 = CStyleEnumVar1 -// gdbr-check:$3 = gdb_pretty_struct_and_enums_pre_gdb_7_7::CStyleEnum::CStyleEnumVar1 - -// gdb-command: print c_style_enum2 -// gdbg-check:$4 = CStyleEnumVar2 -// gdbr-check:$4 = gdb_pretty_struct_and_enums_pre_gdb_7_7::CStyleEnum::CStyleEnumVar2 - -// gdb-command: print c_style_enum3 -// gdbg-check:$5 = CStyleEnumVar3 -// gdbr-check:$5 = gdb_pretty_struct_and_enums_pre_gdb_7_7::CStyleEnum::CStyleEnumVar3 - -#![allow(dead_code, unused_variables)] -#![no_trace] - -struct RegularStruct { - the_first_field: isize, - the_second_field: f64, - the_third_field: bool, -} - -struct EmptyStruct; - -enum CStyleEnum { - CStyleEnumVar1, - CStyleEnumVar2, - CStyleEnumVar3, -} - -fn main() { - - let regular_struct = RegularStruct { - the_first_field: 101, - the_second_field: 102.5, - the_third_field: false - }; - - let empty_struct = EmptyStruct; - - let c_style_enum1 = CStyleEnum::CStyleEnumVar1; - let c_style_enum2 = CStyleEnum::CStyleEnumVar2; - let c_style_enum3 = CStyleEnum::CStyleEnumVar3; - - zzz(); // #break -} - -fn zzz() { () } diff --git a/src/test/debuginfo/gdb-pretty-struct-and-enums.rs b/src/test/debuginfo/gdb-pretty-struct-and-enums.rs new file mode 100644 index 00000000000..9b41462bcee --- /dev/null +++ b/src/test/debuginfo/gdb-pretty-struct-and-enums.rs @@ -0,0 +1,64 @@ +// ignore-tidy-linelength +// ignore-lldb +// ignore-android: FIXME(#10381) +// min-gdb-version: 7.11 + +// compile-flags:-g + +// gdb-command: run + +// gdb-command: print regular_struct +// gdbg-check:$1 = RegularStruct = {the_first_field = 101, the_second_field = 102.5, the_third_field = false} +// gdbr-check:$1 = gdb_pretty_struct_and_enums::RegularStruct {the_first_field: 101, the_second_field: 102.5, the_third_field: false} + +// gdb-command: print empty_struct +// gdbg-check:$2 = EmptyStruct +// gdbr-check:$2 = gdb_pretty_struct_and_enums::EmptyStruct + +// gdb-command: print c_style_enum1 +// gdbg-check:$3 = CStyleEnumVar1 +// gdbr-check:$3 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar1 + +// gdb-command: print c_style_enum2 +// gdbg-check:$4 = CStyleEnumVar2 +// gdbr-check:$4 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar2 + +// gdb-command: print c_style_enum3 +// gdbg-check:$5 = CStyleEnumVar3 +// gdbr-check:$5 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar3 + +#![allow(dead_code, unused_variables)] +#![no_trace] + +struct RegularStruct { + the_first_field: isize, + the_second_field: f64, + the_third_field: bool, +} + +struct EmptyStruct; + +enum CStyleEnum { + CStyleEnumVar1, + CStyleEnumVar2, + CStyleEnumVar3, +} + +fn main() { + + let regular_struct = RegularStruct { + the_first_field: 101, + the_second_field: 102.5, + the_third_field: false + }; + + let empty_struct = EmptyStruct; + + let c_style_enum1 = CStyleEnum::CStyleEnumVar1; + let c_style_enum2 = CStyleEnum::CStyleEnumVar2; + let c_style_enum3 = CStyleEnum::CStyleEnumVar3; + + zzz(); // #break +} + +fn zzz() { () } diff --git a/src/test/debuginfo/generators.rs b/src/test/debuginfo/generators.rs new file mode 100644 index 00000000000..b56d222e0e0 --- /dev/null +++ b/src/test/debuginfo/generators.rs @@ -0,0 +1,36 @@ +// min-lldb-version: 310 + +// compile-flags:-g + +// === GDB TESTS =================================================================================== + +// gdb-command:run +// gdb-command:print a +// gdb-check:$1 = 5 + +// === LLDB TESTS ================================================================================== + +// lldb-command:run +// lldb-command:print a +// lldbg-check:(int) $0 = 5 +// lldbr-check:(int) a = 5 + +#![feature(omit_gdb_pretty_printer_section, generators, generator_trait, pin)] +#![omit_gdb_pretty_printer_section] + +use std::ops::Generator; +use std::pin::Pin; + +fn main() { + let mut a = 5; + let mut b = || { + yield; + _zzz(); // #break + a = 6; + }; + Pin::new(&mut b).resume(); + Pin::new(&mut b).resume(); + _zzz(); // #break +} + +fn _zzz() {()} diff --git a/src/test/debuginfo/generic-enum-with-different-disr-sizes-legacy.rs b/src/test/debuginfo/generic-enum-with-different-disr-sizes-legacy.rs index 092b31b7c30..4f17e48c6a4 100644 --- a/src/test/debuginfo/generic-enum-with-different-disr-sizes-legacy.rs +++ b/src/test/debuginfo/generic-enum-with-different-disr-sizes-legacy.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // ignore-lldb: FIXME(#27089) // min-lldb-version: 310 diff --git a/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs b/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs index 70c0ff3e0c6..abe722981cf 100644 --- a/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs +++ b/src/test/debuginfo/generic-enum-with-different-disr-sizes.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // ignore-lldb: FIXME(#27089) // min-lldb-version: 310 diff --git a/src/test/debuginfo/generic-function.rs b/src/test/debuginfo/generic-function.rs index 9216da19bd1..db998d1b1cf 100644 --- a/src/test/debuginfo/generic-function.rs +++ b/src/test/debuginfo/generic-function.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/generic-functions-nested.rs b/src/test/debuginfo/generic-functions-nested.rs index ea6dc62eca9..4c4297f942a 100644 --- a/src/test/debuginfo/generic-functions-nested.rs +++ b/src/test/debuginfo/generic-functions-nested.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/generic-method-on-generic-struct.rs b/src/test/debuginfo/generic-method-on-generic-struct.rs index 97bb9aa98e8..7d151cfaa4a 100644 --- a/src/test/debuginfo/generic-method-on-generic-struct.rs +++ b/src/test/debuginfo/generic-method-on-generic-struct.rs @@ -1,17 +1,10 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-g -// min-lldb-version: 310 + +// Some versions of the non-rust-enabled LLDB print the wrong generic +// parameter type names in this test. +// rust-lldb // === GDB TESTS =================================================================================== diff --git a/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs b/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs index 603365089ec..b0ac8ae8577 100644 --- a/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs +++ b/src/test/debuginfo/generic-static-method-on-struct-and-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/generic-struct-style-enum-legacy.rs b/src/test/debuginfo/generic-struct-style-enum-legacy.rs index 47c4ea77e44..37a875a4188 100644 --- a/src/test/debuginfo/generic-struct-style-enum-legacy.rs +++ b/src/test/debuginfo/generic-struct-style-enum-legacy.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 // ignore-gdb-version: 7.11.90 - 7.12.9 diff --git a/src/test/debuginfo/generic-struct-style-enum.rs b/src/test/debuginfo/generic-struct-style-enum.rs index 27f1a184fd8..c0f32ada4cc 100644 --- a/src/test/debuginfo/generic-struct-style-enum.rs +++ b/src/test/debuginfo/generic-struct-style-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/generic-struct.rs b/src/test/debuginfo/generic-struct.rs index 04588958869..0e9fce42cf6 100644 --- a/src/test/debuginfo/generic-struct.rs +++ b/src/test/debuginfo/generic-struct.rs @@ -1,15 +1,8 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength -// min-lldb-version: 310 + +// Some versions of the non-rust-enabled LLDB print the wrong generic +// parameter type names in this test. +// rust-lldb // compile-flags:-g diff --git a/src/test/debuginfo/generic-tuple-style-enum-legacy.rs b/src/test/debuginfo/generic-tuple-style-enum-legacy.rs index ee28968619d..452e90008ea 100644 --- a/src/test/debuginfo/generic-tuple-style-enum-legacy.rs +++ b/src/test/debuginfo/generic-tuple-style-enum-legacy.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 // ignore-gdb-version: 7.11.90 - 7.12.9 diff --git a/src/test/debuginfo/generic-tuple-style-enum.rs b/src/test/debuginfo/generic-tuple-style-enum.rs index 069ffe358ed..20f0e800cd3 100644 --- a/src/test/debuginfo/generic-tuple-style-enum.rs +++ b/src/test/debuginfo/generic-tuple-style-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // Require LLVM with DW_TAG_variant_part and a gdb and lldb that can @@ -41,7 +31,7 @@ // lldb-command:run // lldb-command:print case1 -// lldbr-check:(generic_tuple_style_enum::Regular::Case1) case1 = { = 0 = 31868 = 31868 = 31868 = 31868 } +// lldbr-check:(generic_tuple_style_enum::Regular::Case1) case1 = { __0 = 0 __1 = 31868 __2 = 31868 __3 = 31868 __4 = 31868 } // lldb-command:print case2 // lldbr-check:(generic_tuple_style_enum::Regular::Case2) case2 = Regular::Case2 { Case1: 0, Case2: 286331153, Case3: 286331153 } @@ -50,7 +40,7 @@ // lldbr-check:(generic_tuple_style_enum::Regular::Case3) case3 = Regular::Case3 { Case1: 0, Case2: 6438275382588823897 } // lldb-command:print univariant -// lldbr-check:(generic_tuple_style_enum::Univariant) univariant = { TheOnlyCase = { = -1 } } +// lldbr-check:(generic_tuple_style_enum::Univariant) univariant = Univariant { TheOnlyCase: Univariant::TheOnlyCase(-1) } #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] diff --git a/src/test/debuginfo/include_string.rs b/src/test/debuginfo/include_string.rs index 20027f6f833..b6604dc6867 100644 --- a/src/test/debuginfo/include_string.rs +++ b/src/test/debuginfo/include_string.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/issue-12886.rs b/src/test/debuginfo/issue-12886.rs index b0b691068c2..59f69315e1d 100644 --- a/src/test/debuginfo/issue-12886.rs +++ b/src/test/debuginfo/issue-12886.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows failing on 64-bit bots FIXME #17638 // ignore-lldb // ignore-aarch64 @@ -16,7 +6,7 @@ // gdb-command:run // gdb-command:next -// gdb-check:[...]36[...]s +// gdb-check:[...]26[...]s // gdb-command:continue #![feature(omit_gdb_pretty_printer_section)] diff --git a/src/test/debuginfo/issue-13213.rs b/src/test/debuginfo/issue-13213.rs index 67975d02b19..898ebe547b3 100644 --- a/src/test/debuginfo/issue-13213.rs +++ b/src/test/debuginfo/issue-13213.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // aux-build:issue13213aux.rs diff --git a/src/test/debuginfo/issue-14411.rs b/src/test/debuginfo/issue-14411.rs index d334e33f887..19609f42846 100644 --- a/src/test/debuginfo/issue-14411.rs +++ b/src/test/debuginfo/issue-14411.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/issue-22656.rs b/src/test/debuginfo/issue-22656.rs index 6c3988b127e..86d31909a0b 100644 --- a/src/test/debuginfo/issue-22656.rs +++ b/src/test/debuginfo/issue-22656.rs @@ -1,14 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test makes sure that the LLDB pretty printer does not throw an exception // when trying to handle a Vec<> or anything else that contains zero-sized // fields. diff --git a/src/test/debuginfo/issue-7712.rs b/src/test/debuginfo/issue-7712.rs index 124cdfb436c..3a7565f559a 100644 --- a/src/test/debuginfo/issue-7712.rs +++ b/src/test/debuginfo/issue-7712.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C debuginfo=1 // min-lldb-version: 310 diff --git a/src/test/debuginfo/lexical-scope-in-for-loop.rs b/src/test/debuginfo/lexical-scope-in-for-loop.rs index 2a88c0f90da..05ecf82ed1f 100644 --- a/src/test/debuginfo/lexical-scope-in-for-loop.rs +++ b/src/test/debuginfo/lexical-scope-in-for-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/lexical-scope-in-if.rs b/src/test/debuginfo/lexical-scope-in-if.rs index 97200df9133..6de0d97beed 100644 --- a/src/test/debuginfo/lexical-scope-in-if.rs +++ b/src/test/debuginfo/lexical-scope-in-if.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/lexical-scope-in-match.rs b/src/test/debuginfo/lexical-scope-in-match.rs index c02a184fe1f..e46a5daafc7 100644 --- a/src/test/debuginfo/lexical-scope-in-match.rs +++ b/src/test/debuginfo/lexical-scope-in-match.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs index 59935e55b33..d6b947fad8e 100644 --- a/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-parameterless-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-C debuginfo=1 diff --git a/src/test/debuginfo/lexical-scope-in-stack-closure.rs b/src/test/debuginfo/lexical-scope-in-stack-closure.rs index 2bd48e515ec..ad4fc24858e 100644 --- a/src/test/debuginfo/lexical-scope-in-stack-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-stack-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs b/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs index 213b4a6b276..904ecc604d2 100644 --- a/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs +++ b/src/test/debuginfo/lexical-scope-in-unconditional-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/lexical-scope-in-unique-closure.rs b/src/test/debuginfo/lexical-scope-in-unique-closure.rs index af4f16aac6d..7f141d7d7cd 100644 --- a/src/test/debuginfo/lexical-scope-in-unique-closure.rs +++ b/src/test/debuginfo/lexical-scope-in-unique-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/lexical-scope-in-while.rs b/src/test/debuginfo/lexical-scope-in-while.rs index ec9b8a2f5ef..0eae52807c5 100644 --- a/src/test/debuginfo/lexical-scope-in-while.rs +++ b/src/test/debuginfo/lexical-scope-in-while.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/lexical-scope-with-macro.rs b/src/test/debuginfo/lexical-scope-with-macro.rs index ba3d664b536..006cdae0859 100644 --- a/src/test/debuginfo/lexical-scope-with-macro.rs +++ b/src/test/debuginfo/lexical-scope-with-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // ignore-lldb FIXME #48807 diff --git a/src/test/debuginfo/lexical-scopes-in-block-expression.rs b/src/test/debuginfo/lexical-scopes-in-block-expression.rs index 9cb2a4c546e..72621ffc742 100644 --- a/src/test/debuginfo/lexical-scopes-in-block-expression.rs +++ b/src/test/debuginfo/lexical-scopes-in-block-expression.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 diff --git a/src/test/debuginfo/limited-debuginfo.rs b/src/test/debuginfo/limited-debuginfo.rs index d840f38b2aa..bd381cd0e22 100644 --- a/src/test/debuginfo/limited-debuginfo.rs +++ b/src/test/debuginfo/limited-debuginfo.rs @@ -1,14 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // ignore-lldb // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 diff --git a/src/test/debuginfo/macro-stepping.inc b/src/test/debuginfo/macro-stepping.inc index 6aaf7ed421e..1bcbcfd6c59 100644 --- a/src/test/debuginfo/macro-stepping.inc +++ b/src/test/debuginfo/macro-stepping.inc @@ -1,13 +1,3 @@ -// Copyright 2013-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn included() { foo!(); // #inc-loc1 diff --git a/src/test/debuginfo/macro-stepping.rs b/src/test/debuginfo/macro-stepping.rs index 204dd8c1e73..e4b2b7b79bc 100644 --- a/src/test/debuginfo/macro-stepping.rs +++ b/src/test/debuginfo/macro-stepping.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows // ignore-android // ignore-aarch64 diff --git a/src/test/debuginfo/method-on-enum.rs b/src/test/debuginfo/method-on-enum.rs index ddfff0f7d76..94ca0289b78 100644 --- a/src/test/debuginfo/method-on-enum.rs +++ b/src/test/debuginfo/method-on-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 // ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 diff --git a/src/test/debuginfo/method-on-generic-struct.rs b/src/test/debuginfo/method-on-generic-struct.rs index 57238961e3f..80cbf7430ca 100644 --- a/src/test/debuginfo/method-on-generic-struct.rs +++ b/src/test/debuginfo/method-on-generic-struct.rs @@ -1,14 +1,6 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// min-lldb-version: 310 +// Some versions of the non-rust-enabled LLDB print the wrong generic +// parameter type names in this test. +// rust-lldb // compile-flags:-g diff --git a/src/test/debuginfo/method-on-struct.rs b/src/test/debuginfo/method-on-struct.rs index e64962593df..cf8ed13e814 100644 --- a/src/test/debuginfo/method-on-struct.rs +++ b/src/test/debuginfo/method-on-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/method-on-trait.rs b/src/test/debuginfo/method-on-trait.rs index 4c1e111d3b8..9b321a8fad2 100644 --- a/src/test/debuginfo/method-on-trait.rs +++ b/src/test/debuginfo/method-on-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/method-on-tuple-struct.rs b/src/test/debuginfo/method-on-tuple-struct.rs index ffd402ec936..dc32edd07a4 100644 --- a/src/test/debuginfo/method-on-tuple-struct.rs +++ b/src/test/debuginfo/method-on-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/multi-byte-chars.rs b/src/test/debuginfo/multi-byte-chars.rs index f02e3f2a22b..5382dd1a323 100644 --- a/src/test/debuginfo/multi-byte-chars.rs +++ b/src/test/debuginfo/multi-byte-chars.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/multi-cgu.rs b/src/test/debuginfo/multi-cgu.rs index 7f370954b90..0ca7ce60e49 100644 --- a/src/test/debuginfo/multi-cgu.rs +++ b/src/test/debuginfo/multi-cgu.rs @@ -1,14 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case makes sure that we get proper break points for binaries // compiled with multiple codegen units. (see #39160) diff --git a/src/test/debuginfo/multiple-functions-equal-var-names.rs b/src/test/debuginfo/multiple-functions-equal-var-names.rs index f03ec9cdd4c..65a461c8558 100644 --- a/src/test/debuginfo/multiple-functions-equal-var-names.rs +++ b/src/test/debuginfo/multiple-functions-equal-var-names.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/multiple-functions.rs b/src/test/debuginfo/multiple-functions.rs index 956ee6cf0a1..8b448475bc9 100644 --- a/src/test/debuginfo/multiple-functions.rs +++ b/src/test/debuginfo/multiple-functions.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/name-shadowing-and-scope-nesting.rs b/src/test/debuginfo/name-shadowing-and-scope-nesting.rs index f8bbc2cf5ec..0d6cd919f45 100644 --- a/src/test/debuginfo/name-shadowing-and-scope-nesting.rs +++ b/src/test/debuginfo/name-shadowing-and-scope-nesting.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/nil-enum.rs b/src/test/debuginfo/nil-enum.rs deleted file mode 100644 index ab42b2eff99..00000000000 --- a/src/test/debuginfo/nil-enum.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// NOTE Instantiating an empty enum is UB. This test may break in the future. - -// LLDB can't handle zero-sized values -// ignore-lldb - - -// Require LLVM with DW_TAG_variant_part and a gdb that can read it. -// gdb 8.2.0 crashes on this test case, see -// https://sourceware.org/bugzilla/show_bug.cgi?id=23626 -// This will be fixed in the next release, which will be >= 8.2.1. -// min-system-llvm-version: 7.0 -// min-gdb-version: 8.2.1 - -// compile-flags:-g -// gdb-command:run - -// gdb-command:print first -// gdbr-check:$1 = nil_enum::ANilEnum {} - -// gdb-command:print second -// gdbr-check:$2 = nil_enum::AnotherNilEnum {} - -#![allow(unused_variables)] -#![feature(omit_gdb_pretty_printer_section)] -#![feature(maybe_uninit)] -#![omit_gdb_pretty_printer_section] - -use std::mem::MaybeUninit; - -enum ANilEnum {} -enum AnotherNilEnum {} - -// This test relies on gdbg printing the string "{}" for empty -// structs (which may change some time) -// The error from gdbr is expected since nil enums are not supposed to exist. -fn main() { - unsafe { - let first: ANilEnum = MaybeUninit::uninitialized().into_inner(); - let second: AnotherNilEnum = MaybeUninit::uninitialized().into_inner(); - - zzz(); // #break - } -} - -fn zzz() {()} diff --git a/src/test/debuginfo/no-debug-attribute.rs b/src/test/debuginfo/no-debug-attribute.rs index 671335e1955..37e8178d229 100644 --- a/src/test/debuginfo/no-debug-attribute.rs +++ b/src/test/debuginfo/no-debug-attribute.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-lldb // compile-flags:-g diff --git a/src/test/debuginfo/option-like-enum.rs b/src/test/debuginfo/option-like-enum.rs index 618587e4219..67a3d133ed3 100644 --- a/src/test/debuginfo/option-like-enum.rs +++ b/src/test/debuginfo/option-like-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 diff --git a/src/test/debuginfo/packed-struct-with-destructor.rs b/src/test/debuginfo/packed-struct-with-destructor.rs index 116d67050a4..86d284774db 100644 --- a/src/test/debuginfo/packed-struct-with-destructor.rs +++ b/src/test/debuginfo/packed-struct-with-destructor.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/packed-struct.rs b/src/test/debuginfo/packed-struct.rs index 64004c1e681..b838e6f0755 100644 --- a/src/test/debuginfo/packed-struct.rs +++ b/src/test/debuginfo/packed-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 // ignore-gdb-version: 7.11.90 - 7.12.9 diff --git a/src/test/debuginfo/pretty-huge-vec.rs b/src/test/debuginfo/pretty-huge-vec.rs index 3171e051b3b..4f47bdcad78 100644 --- a/src/test/debuginfo/pretty-huge-vec.rs +++ b/src/test/debuginfo/pretty-huge-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows failing on win32 bot // ignore-freebsd: gdb package too new // ignore-android: FIXME(#10381) diff --git a/src/test/debuginfo/pretty-std-collections.rs b/src/test/debuginfo/pretty-std-collections.rs index 8e37a884b34..f8997fad9a5 100644 --- a/src/test/debuginfo/pretty-std-collections.rs +++ b/src/test/debuginfo/pretty-std-collections.rs @@ -1,18 +1,13 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +// ignore-tidy-linelength // ignore-windows failing on win32 bot // ignore-freebsd: gdb package too new // ignore-android: FIXME(#10381) // compile-flags:-g -// min-gdb-version 7.7 + +// The pretty printers being tested here require the patch from +// https://sourceware.org/bugzilla/show_bug.cgi?id=21763 +// min-gdb-version 8.1 + // min-lldb-version: 310 // === GDB TESTS =================================================================================== @@ -20,14 +15,17 @@ // gdb-command: run // gdb-command: print btree_set -// gdb-check:$1 = BTreeSet(len: 3) = {3, 5, 7} +// gdb-check:$1 = BTreeSet(len: 15) = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14} // gdb-command: print btree_map -// gdb-check:$2 = BTreeMap(len: 3) = {[3] = 3, [5] = 7, [7] = 4} +// gdb-check:$2 = BTreeMap(len: 15) = {[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 5, [6] = 6, [7] = 7, [8] = 8, [9] = 9, [10] = 10, [11] = 11, [12] = 12, [13] = 13, [14] = 14} // gdb-command: print vec_deque // gdb-check:$3 = VecDeque(len: 3, cap: 8) = {5, 3, 7} +// gdb-command: print vec_deque2 +// gdb-check:$4 = VecDeque(len: 7, cap: 8) = {2, 3, 4, 5, 6, 7, 8} + #![allow(unused_variables)] use std::collections::BTreeSet; use std::collections::BTreeMap; @@ -38,15 +36,15 @@ fn main() { // BTreeSet let mut btree_set = BTreeSet::new(); - btree_set.insert(5); - btree_set.insert(3); - btree_set.insert(7); + for i in 0..15 { + btree_set.insert(i); + } // BTreeMap let mut btree_map = BTreeMap::new(); - btree_map.insert(5, 7); - btree_map.insert(3, 3); - btree_map.insert(7, 4); + for i in 0..15 { + btree_map.insert(i, i); + } // VecDeque let mut vec_deque = VecDeque::new(); @@ -54,6 +52,14 @@ fn main() { vec_deque.push_back(3); vec_deque.push_back(7); + // VecDeque where an element was popped. + let mut vec_deque2 = VecDeque::new(); + for i in 1..8 { + vec_deque2.push_back(i) + } + vec_deque2.pop_front(); + vec_deque2.push_back(8); + zzz(); // #break } diff --git a/src/test/debuginfo/pretty-std.rs b/src/test/debuginfo/pretty-std.rs index 7bc566480e7..82802eff08a 100644 --- a/src/test/debuginfo/pretty-std.rs +++ b/src/test/debuginfo/pretty-std.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows failing on win32 bot // ignore-freebsd: gdb package too new // ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 diff --git a/src/test/debuginfo/pretty-uninitialized-vec.rs b/src/test/debuginfo/pretty-uninitialized-vec.rs index 75169658fe6..37aae65d42b 100644 --- a/src/test/debuginfo/pretty-uninitialized-vec.rs +++ b/src/test/debuginfo/pretty-uninitialized-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows failing on win32 bot // ignore-freebsd: gdb package too new // ignore-android: FIXME(#10381) diff --git a/src/test/debuginfo/recursive-enum.rs b/src/test/debuginfo/recursive-enum.rs index 3094bdeac8b..a62d4807a6c 100644 --- a/src/test/debuginfo/recursive-enum.rs +++ b/src/test/debuginfo/recursive-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-lldb // compile-flags:-g diff --git a/src/test/debuginfo/recursive-struct-legacy.rs b/src/test/debuginfo/recursive-struct-legacy.rs index ac407ced527..99286708ae2 100644 --- a/src/test/debuginfo/recursive-struct-legacy.rs +++ b/src/test/debuginfo/recursive-struct-legacy.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // ignore-lldb diff --git a/src/test/debuginfo/recursive-struct.rs b/src/test/debuginfo/recursive-struct.rs index 8e01bc3c85a..e753b64c006 100644 --- a/src/test/debuginfo/recursive-struct.rs +++ b/src/test/debuginfo/recursive-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // ignore-lldb diff --git a/src/test/debuginfo/self-in-default-method.rs b/src/test/debuginfo/self-in-default-method.rs index a9acaab7dfc..bc150e33789 100644 --- a/src/test/debuginfo/self-in-default-method.rs +++ b/src/test/debuginfo/self-in-default-method.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/self-in-generic-default-method.rs b/src/test/debuginfo/self-in-generic-default-method.rs index 2613300b8d9..6c156230e53 100644 --- a/src/test/debuginfo/self-in-generic-default-method.rs +++ b/src/test/debuginfo/self-in-generic-default-method.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/shadowed-argument.rs b/src/test/debuginfo/shadowed-argument.rs index eba70a2cafb..bd91e439ab1 100644 --- a/src/test/debuginfo/shadowed-argument.rs +++ b/src/test/debuginfo/shadowed-argument.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/shadowed-variable.rs b/src/test/debuginfo/shadowed-variable.rs index 83fb9b6491a..d4794614dc7 100644 --- a/src/test/debuginfo/shadowed-variable.rs +++ b/src/test/debuginfo/shadowed-variable.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/should-fail.rs b/src/test/debuginfo/should-fail.rs index 1f8acb53101..441be56b5b4 100644 --- a/src/test/debuginfo/should-fail.rs +++ b/src/test/debuginfo/should-fail.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // == Test [gdb|lldb]-[command|check] are parsed correctly === diff --git a/src/test/debuginfo/simd.rs b/src/test/debuginfo/simd.rs index 8fad3e81530..1a4b0673cc5 100644 --- a/src/test/debuginfo/simd.rs +++ b/src/test/debuginfo/simd.rs @@ -1,20 +1,10 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Need a fix for LLDB first... // ignore-lldb // ignore-tidy-linelength // FIXME: LLVM generates invalid debug info for variables requiring // dynamic stack realignment, which is the case on s390x for vector -// types with with non-vector ABI. +// types with non-vector ABI. // ignore-s390x // compile-flags:-g diff --git a/src/test/debuginfo/simple-lexical-scope.rs b/src/test/debuginfo/simple-lexical-scope.rs index 9552a2965ea..1a725ae6dce 100644 --- a/src/test/debuginfo/simple-lexical-scope.rs +++ b/src/test/debuginfo/simple-lexical-scope.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/simple-struct.rs b/src/test/debuginfo/simple-struct.rs index e27324fe330..b9475d5429a 100644 --- a/src/test/debuginfo/simple-struct.rs +++ b/src/test/debuginfo/simple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/simple-tuple.rs b/src/test/debuginfo/simple-tuple.rs index ea0fd4e37fd..f7e5b5c982a 100644 --- a/src/test/debuginfo/simple-tuple.rs +++ b/src/test/debuginfo/simple-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 diff --git a/src/test/debuginfo/static-method-on-struct-and-enum.rs b/src/test/debuginfo/static-method-on-struct-and-enum.rs index 75a67c6b84b..864c61c15d1 100644 --- a/src/test/debuginfo/static-method-on-struct-and-enum.rs +++ b/src/test/debuginfo/static-method-on-struct-and-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/struct-in-enum.rs b/src/test/debuginfo/struct-in-enum.rs index 14aaf67d5ae..db20e9d3e45 100644 --- a/src/test/debuginfo/struct-in-enum.rs +++ b/src/test/debuginfo/struct-in-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 // ignore-gdb-version: 7.11.90 - 7.12.9 diff --git a/src/test/debuginfo/struct-in-struct.rs b/src/test/debuginfo/struct-in-struct.rs index 3f5f2e31baf..d28a0ee857e 100644 --- a/src/test/debuginfo/struct-in-struct.rs +++ b/src/test/debuginfo/struct-in-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/struct-namespace.rs b/src/test/debuginfo/struct-namespace.rs index efa415c7100..81752c26980 100644 --- a/src/test/debuginfo/struct-namespace.rs +++ b/src/test/debuginfo/struct-namespace.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-gdb // compile-flags:-g // min-lldb-version: 310 diff --git a/src/test/debuginfo/struct-style-enum-legacy.rs b/src/test/debuginfo/struct-style-enum-legacy.rs index fd2c6fa8171..1433493fd5d 100644 --- a/src/test/debuginfo/struct-style-enum-legacy.rs +++ b/src/test/debuginfo/struct-style-enum-legacy.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/struct-style-enum.rs b/src/test/debuginfo/struct-style-enum.rs index e5c224c9133..67458741603 100644 --- a/src/test/debuginfo/struct-style-enum.rs +++ b/src/test/debuginfo/struct-style-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // Require LLVM with DW_TAG_variant_part and a gdb and lldb that can diff --git a/src/test/debuginfo/struct-with-destructor.rs b/src/test/debuginfo/struct-with-destructor.rs index b5ccab5dbe0..f13fe714b68 100644 --- a/src/test/debuginfo/struct-with-destructor.rs +++ b/src/test/debuginfo/struct-with-destructor.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/trait-pointers.rs b/src/test/debuginfo/trait-pointers.rs index 193cd419bab..a44f30abd68 100644 --- a/src/test/debuginfo/trait-pointers.rs +++ b/src/test/debuginfo/trait-pointers.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/tuple-in-struct.rs b/src/test/debuginfo/tuple-in-struct.rs index f1c86b7b00c..d13492effd4 100644 --- a/src/test/debuginfo/tuple-in-struct.rs +++ b/src/test/debuginfo/tuple-in-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/tuple-in-tuple.rs b/src/test/debuginfo/tuple-in-tuple.rs index 60ecd601c7d..456adda7905 100644 --- a/src/test/debuginfo/tuple-in-tuple.rs +++ b/src/test/debuginfo/tuple-in-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/tuple-struct.rs b/src/test/debuginfo/tuple-struct.rs index ded48d44ff3..a80bbefeb6f 100644 --- a/src/test/debuginfo/tuple-struct.rs +++ b/src/test/debuginfo/tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/tuple-style-enum-legacy.rs b/src/test/debuginfo/tuple-style-enum-legacy.rs index e33f6db534f..ebc8e034438 100644 --- a/src/test/debuginfo/tuple-style-enum-legacy.rs +++ b/src/test/debuginfo/tuple-style-enum-legacy.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/tuple-style-enum.rs b/src/test/debuginfo/tuple-style-enum.rs index 6cb754c93b2..1fc23e62947 100644 --- a/src/test/debuginfo/tuple-style-enum.rs +++ b/src/test/debuginfo/tuple-style-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // Require LLVM with DW_TAG_variant_part and a gdb and lldb that can diff --git a/src/test/debuginfo/type-names.rs b/src/test/debuginfo/type-names.rs index 3ec8b048b12..1e0e8beb10f 100644 --- a/src/test/debuginfo/type-names.rs +++ b/src/test/debuginfo/type-names.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // ignore-lldb // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 @@ -280,7 +270,7 @@ extern { } // In many of the cases below, the type that is actually under test is wrapped -// in a tuple, e.g. Box, references, raw pointers, fixed-size vectors, ... +// in a tuple, e.g., Box, references, raw pointers, fixed-size vectors, ... // This is because GDB will not print the type name from DWARF debuginfo for // some kinds of types (pointers, arrays, functions, ...) // Since tuples are structs as far as GDB is concerned, their name will be diff --git a/src/test/debuginfo/union-smoke.rs b/src/test/debuginfo/union-smoke.rs index 7772127bad2..79b4030ee34 100644 --- a/src/test/debuginfo/union-smoke.rs +++ b/src/test/debuginfo/union-smoke.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 diff --git a/src/test/debuginfo/unique-enum-legacy.rs b/src/test/debuginfo/unique-enum-legacy.rs index 91fece334b2..e7c93577528 100644 --- a/src/test/debuginfo/unique-enum-legacy.rs +++ b/src/test/debuginfo/unique-enum-legacy.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // min-lldb-version: 310 diff --git a/src/test/debuginfo/unique-enum.rs b/src/test/debuginfo/unique-enum.rs index e1e16450e44..36b71b37fbe 100644 --- a/src/test/debuginfo/unique-enum.rs +++ b/src/test/debuginfo/unique-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // Require LLVM with DW_TAG_variant_part and a gdb and lldb that can diff --git a/src/test/debuginfo/unreachable-locals.rs b/src/test/debuginfo/unreachable-locals.rs index 4c4210ea132..b6971f353a5 100644 --- a/src/test/debuginfo/unreachable-locals.rs +++ b/src/test/debuginfo/unreachable-locals.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/unsized.rs b/src/test/debuginfo/unsized.rs index b0ce335a8d9..c27fe61dc8b 100644 --- a/src/test/debuginfo/unsized.rs +++ b/src/test/debuginfo/unsized.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-g // === GDB TESTS =================================================================================== diff --git a/src/test/debuginfo/var-captured-in-nested-closure.rs b/src/test/debuginfo/var-captured-in-nested-closure.rs index ca2c56877c3..9159ef67535 100644 --- a/src/test/debuginfo/var-captured-in-nested-closure.rs +++ b/src/test/debuginfo/var-captured-in-nested-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/var-captured-in-sendable-closure.rs b/src/test/debuginfo/var-captured-in-sendable-closure.rs index a562584dfd0..b6a3c32ac47 100644 --- a/src/test/debuginfo/var-captured-in-sendable-closure.rs +++ b/src/test/debuginfo/var-captured-in-sendable-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/var-captured-in-stack-closure.rs b/src/test/debuginfo/var-captured-in-stack-closure.rs index cf4eaf393e9..2402b5f6851 100644 --- a/src/test/debuginfo/var-captured-in-stack-closure.rs +++ b/src/test/debuginfo/var-captured-in-stack-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // compile-flags:-g diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs index dba3972a3df..8d9fc498882 100644 --- a/src/test/debuginfo/vec-slices.rs +++ b/src/test/debuginfo/vec-slices.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // ignore-windows diff --git a/src/test/debuginfo/vec.rs b/src/test/debuginfo/vec.rs index 752f3f1cba1..b0ee521c145 100644 --- a/src/test/debuginfo/vec.rs +++ b/src/test/debuginfo/vec.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // min-lldb-version: 310 // ignore-gdb // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155 diff --git a/src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs b/src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs deleted file mode 100644 index e9f9ba86f23..00000000000 --- a/src/test/incremental-fulldeps/auxiliary/incremental_proc_macro_aux.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -// Add a function to shift DefIndex of registrar function -#[cfg(cfail2)] -fn foo() {} - -#[proc_macro_derive(IncrementalMacro)] -pub fn derive(input: TokenStream) -> TokenStream { - #[cfg(cfail2)] - { - foo(); - } - - "".parse().unwrap() -} diff --git a/src/test/incremental-fulldeps/auxiliary/issue_49482_macro_def.rs b/src/test/incremental-fulldeps/auxiliary/issue_49482_macro_def.rs deleted file mode 100644 index 763c9eb138e..00000000000 --- a/src/test/incremental-fulldeps/auxiliary/issue_49482_macro_def.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type="proc-macro"] -#![allow(non_snake_case)] - -extern crate proc_macro; - -macro_rules! proc_macro_expr_impl { - ($( - $( #[$attr:meta] )* - pub fn $func:ident($input:ident: &str) -> String; - )+) => { - $( - $( #[$attr] )* - #[proc_macro_derive($func)] - pub fn $func(_input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStream { - panic!() - } - )+ - }; -} - -proc_macro_expr_impl! { - pub fn f1(input: &str) -> String; - pub fn f2(input: &str) -> String; - pub fn f3(input: &str) -> String; - pub fn f4(input: &str) -> String; - pub fn f5(input: &str) -> String; - pub fn f6(input: &str) -> String; - pub fn f7(input: &str) -> String; - pub fn f8(input: &str) -> String; - pub fn f9(input: &str) -> String; - pub fn fA(input: &str) -> String; - pub fn fB(input: &str) -> String; - pub fn fC(input: &str) -> String; - pub fn fD(input: &str) -> String; - pub fn fE(input: &str) -> String; - pub fn fF(input: &str) -> String; -} diff --git a/src/test/incremental-fulldeps/auxiliary/issue_49482_reexport.rs b/src/test/incremental-fulldeps/auxiliary/issue_49482_reexport.rs deleted file mode 100644 index aa9aa3b58b9..00000000000 --- a/src/test/incremental-fulldeps/auxiliary/issue_49482_reexport.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[macro_use] -extern crate issue_49482_macro_def; - -pub use issue_49482_macro_def::*; - -pub fn foo() {} diff --git a/src/test/incremental-fulldeps/auxiliary/issue_54059.rs b/src/test/incremental-fulldeps/auxiliary/issue_54059.rs deleted file mode 100644 index ec0d044d4bf..00000000000 --- a/src/test/incremental-fulldeps/auxiliary/issue_54059.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -// check that having extern "C" functions in a proc macro doesn't crash. - -#![crate_type="proc-macro"] -#![allow(non_snake_case)] - -extern crate proc_macro; - -macro_rules! proc_macro_tokenstream { - () => { - ::proc_macro::TokenStream - }; -} - -macro_rules! proc_macro_expr_impl { - ($( - $( #[$attr:meta] )* - pub fn $func:ident($input:ident: &str) -> String $body:block - )+) => { - $( - // Parses an input that looks like: - // - // ``` - // #[allow(unused)] - // enum ProcMacroHack { - // Input = (stringify!(ARGS), 0).1, - // } - // ``` - $( #[$attr] )* - #[proc_macro_derive($func)] - pub fn $func(input: proc_macro_tokenstream!()) -> proc_macro_tokenstream!() { - unsafe { rust_dbg_extern_identity_u64(0); } - panic!() - } - )+ - }; -} - -proc_macro_expr_impl! { - pub fn base2_impl(input: &str) -> String { - panic!() - } -} - -#[link(name="rust_test_helpers")] -extern "C" { - pub fn rust_dbg_extern_identity_u64(v: u64) -> u64; -} diff --git a/src/test/incremental-fulldeps/incremental_proc_macro.rs b/src/test/incremental-fulldeps/incremental_proc_macro.rs deleted file mode 100644 index 103ee30baba..00000000000 --- a/src/test/incremental-fulldeps/incremental_proc_macro.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:incremental_proc_macro_aux.rs -// ignore-stage1 -// revisions: cfail1 cfail2 -// compile-pass - -// This test makes sure that we still find the proc-macro registrar function -// when we compile proc-macros incrementally (see #47292). - -#![crate_type = "rlib"] - -#[macro_use] -extern crate incremental_proc_macro_aux; - -#[derive(IncrementalMacro)] -pub struct Foo { - x: u32 -} diff --git a/src/test/incremental-fulldeps/issue-49482.rs b/src/test/incremental-fulldeps/issue-49482.rs deleted file mode 100644 index 3261b5ae092..00000000000 --- a/src/test/incremental-fulldeps/issue-49482.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:issue_49482_macro_def.rs -// aux-build:issue_49482_reexport.rs -// ignore-stage1 -// revisions: rpass1 - -extern crate issue_49482_reexport; - -pub trait KvStorage -{ - fn get(&self); -} - -impl KvStorage for Box -where - K: KvStorage + ?Sized, -{ - fn get(&self) { - (**self).get() - } -} - -impl KvStorage for u32 { - fn get(&self) {} -} - -fn main() { - /* force issue_49482_reexport to be loaded */ - issue_49482_reexport::foo(); - - Box::new(2).get(); -} diff --git a/src/test/incremental-fulldeps/issue-54059.rs b/src/test/incremental-fulldeps/issue-54059.rs deleted file mode 100644 index dee1e0abf61..00000000000 --- a/src/test/incremental-fulldeps/issue-54059.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:issue_54059.rs -// ignore-stage1 -// ignore-wasm32-bare no libc for ffi testing -// ignore-windows - dealing with weird symbols issues on dylibs isn't worth it -// revisions: rpass1 - -extern crate issue_54059; - -fn main() {} diff --git a/src/test/incremental/add_private_fn_at_krate_root_cc/auxiliary/point.rs b/src/test/incremental/add_private_fn_at_krate_root_cc/auxiliary/point.rs index adc2b23441e..16aaad348a8 100644 --- a/src/test/incremental/add_private_fn_at_krate_root_cc/auxiliary/point.rs +++ b/src/test/incremental/add_private_fn_at_krate_root_cc/auxiliary/point.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Point { pub x: f32, pub y: f32, diff --git a/src/test/incremental/add_private_fn_at_krate_root_cc/struct_point.rs b/src/test/incremental/add_private_fn_at_krate_root_cc/struct_point.rs index 90a532a6cd6..0e17a29dea0 100644 --- a/src/test/incremental/add_private_fn_at_krate_root_cc/struct_point.rs +++ b/src/test/incremental/add_private_fn_at_krate_root_cc/struct_point.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test where we add a private item into the root of an external. // crate. This should not cause anything we use to be invalidated. // Regression test for #36168. diff --git a/src/test/incremental/auxiliary/incremental_proc_macro_aux.rs b/src/test/incremental/auxiliary/incremental_proc_macro_aux.rs new file mode 100644 index 00000000000..6961450b434 --- /dev/null +++ b/src/test/incremental/auxiliary/incremental_proc_macro_aux.rs @@ -0,0 +1,22 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +// Add a function to shift DefIndex of registrar function +#[cfg(cfail2)] +fn foo() {} + +#[proc_macro_derive(IncrementalMacro)] +pub fn derive(input: TokenStream) -> TokenStream { + #[cfg(cfail2)] + { + foo(); + } + + "".parse().unwrap() +} diff --git a/src/test/incremental/auxiliary/issue_49482_macro_def.rs b/src/test/incremental/auxiliary/issue_49482_macro_def.rs new file mode 100644 index 00000000000..bfa7abb1a9d --- /dev/null +++ b/src/test/incremental/auxiliary/issue_49482_macro_def.rs @@ -0,0 +1,40 @@ +// force-host +// no-prefer-dynamic + +#![crate_type="proc-macro"] +#![allow(non_snake_case)] + +extern crate proc_macro; + +macro_rules! proc_macro_expr_impl { + ($( + $( #[$attr:meta] )* + pub fn $func:ident($input:ident: &str) -> String; + )+) => { + $( + $( #[$attr] )* + #[proc_macro_derive($func)] + pub fn $func(_input: ::proc_macro::TokenStream) -> ::proc_macro::TokenStream { + panic!() + } + )+ + }; +} + +proc_macro_expr_impl! { + pub fn f1(input: &str) -> String; + pub fn f2(input: &str) -> String; + pub fn f3(input: &str) -> String; + pub fn f4(input: &str) -> String; + pub fn f5(input: &str) -> String; + pub fn f6(input: &str) -> String; + pub fn f7(input: &str) -> String; + pub fn f8(input: &str) -> String; + pub fn f9(input: &str) -> String; + pub fn fA(input: &str) -> String; + pub fn fB(input: &str) -> String; + pub fn fC(input: &str) -> String; + pub fn fD(input: &str) -> String; + pub fn fE(input: &str) -> String; + pub fn fF(input: &str) -> String; +} diff --git a/src/test/incremental/auxiliary/issue_49482_reexport.rs b/src/test/incremental/auxiliary/issue_49482_reexport.rs new file mode 100644 index 00000000000..39f19e3f15f --- /dev/null +++ b/src/test/incremental/auxiliary/issue_49482_reexport.rs @@ -0,0 +1,6 @@ +#[macro_use] +extern crate issue_49482_macro_def; + +pub use issue_49482_macro_def::*; + +pub fn foo() {} diff --git a/src/test/incremental/auxiliary/issue_54059.rs b/src/test/incremental/auxiliary/issue_54059.rs new file mode 100644 index 00000000000..fa2814a77f2 --- /dev/null +++ b/src/test/incremental/auxiliary/issue_54059.rs @@ -0,0 +1,50 @@ +// force-host +// no-prefer-dynamic + +// check that having extern "C" functions in a proc macro doesn't crash. + +#![crate_type="proc-macro"] +#![allow(non_snake_case)] + +extern crate proc_macro; + +macro_rules! proc_macro_tokenstream { + () => { + ::proc_macro::TokenStream + }; +} + +macro_rules! proc_macro_expr_impl { + ($( + $( #[$attr:meta] )* + pub fn $func:ident($input:ident: &str) -> String $body:block + )+) => { + $( + // Parses an input that looks like: + // + // ``` + // #[allow(unused)] + // enum ProcMacroHack { + // Input = (stringify!(ARGS), 0).1, + // } + // ``` + $( #[$attr] )* + #[proc_macro_derive($func)] + pub fn $func(input: proc_macro_tokenstream!()) -> proc_macro_tokenstream!() { + unsafe { rust_dbg_extern_identity_u64(0); } + panic!() + } + )+ + }; +} + +proc_macro_expr_impl! { + pub fn base2_impl(input: &str) -> String { + panic!() + } +} + +#[link(name="rust_test_helpers")] +extern "C" { + pub fn rust_dbg_extern_identity_u64(v: u64) -> u64; +} diff --git a/src/test/incremental/cache_file_headers.rs b/src/test/incremental/cache_file_headers.rs index 02ee06b4cf4..7f1ef886ac8 100644 --- a/src/test/incremental/cache_file_headers.rs +++ b/src/test/incremental/cache_file_headers.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test case makes sure that the compiler does not try to re-use anything // from the incremental compilation cache if the cache was produced by a // different compiler version. This is tested by artificially forcing the diff --git a/src/test/incremental/callee_caller_cross_crate/auxiliary/a.rs b/src/test/incremental/callee_caller_cross_crate/auxiliary/a.rs index d802c9a8352..6445f87f7fa 100644 --- a/src/test/incremental/callee_caller_cross_crate/auxiliary/a.rs +++ b/src/test/incremental/callee_caller_cross_crate/auxiliary/a.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="rlib"] #[cfg(rpass1)] diff --git a/src/test/incremental/callee_caller_cross_crate/b.rs b/src/test/incremental/callee_caller_cross_crate/b.rs index 9e56d34636f..95285b7a03c 100644 --- a/src/test/incremental/callee_caller_cross_crate/b.rs +++ b/src/test/incremental/callee_caller_cross_crate/b.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:a.rs // revisions:rpass1 rpass2 // compile-flags:-Z query-dep-graph diff --git a/src/test/incremental/change_add_field/struct_point.rs b/src/test/incremental/change_add_field/struct_point.rs index c772493c8a3..c9f0426dee7 100644 --- a/src/test/incremental/change_add_field/struct_point.rs +++ b/src/test/incremental/change_add_field/struct_point.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test where we change a type definition by adding a field. Fns with // this type in their signature are recompiled, as are their callers. // Fns with that type used only in their body are also recompiled, but diff --git a/src/test/incremental/change_crate_dep_kind.rs b/src/test/incremental/change_crate_dep_kind.rs index 2e418cc5048..04a41d71cc9 100644 --- a/src/test/incremental/change_crate_dep_kind.rs +++ b/src/test/incremental/change_crate_dep_kind.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we detect changes to the `dep_kind` query. If the change is not // detected then -Zincremental-verify-ich will trigger an assertion. diff --git a/src/test/incremental/change_crate_order/auxiliary/a.rs b/src/test/incremental/change_crate_order/auxiliary/a.rs index 69b4acd3e30..5948f38cf1b 100644 --- a/src/test/incremental/change_crate_order/auxiliary/a.rs +++ b/src/test/incremental/change_crate_order/auxiliary/a.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="rlib"] pub static A : u32 = 32; diff --git a/src/test/incremental/change_crate_order/auxiliary/b.rs b/src/test/incremental/change_crate_order/auxiliary/b.rs index 1ab97a312c1..12e31039851 100644 --- a/src/test/incremental/change_crate_order/auxiliary/b.rs +++ b/src/test/incremental/change_crate_order/auxiliary/b.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="rlib"] pub static B: u32 = 32; diff --git a/src/test/incremental/change_crate_order/main.rs b/src/test/incremental/change_crate_order/main.rs index 5ee75d44f1d..e514c8519f8 100644 --- a/src/test/incremental/change_crate_order/main.rs +++ b/src/test/incremental/change_crate_order/main.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:a.rs // aux-build:b.rs // revisions:rpass1 rpass2 diff --git a/src/test/incremental/change_name_of_static_in_fn.rs b/src/test/incremental/change_name_of_static_in_fn.rs new file mode 100644 index 00000000000..5b27b6808ea --- /dev/null +++ b/src/test/incremental/change_name_of_static_in_fn.rs @@ -0,0 +1,17 @@ + +// revisions:rpass1 rpass2 rpass3 + +// See issue #57692. + +#![allow(warnings)] + +fn main() { + #[cfg(rpass1)] + { + static map: u64 = 0; + } + #[cfg(not(rpass1))] + { + static MAP: u64 = 0; + } +} diff --git a/src/test/incremental/change_private_fn/struct_point.rs b/src/test/incremental/change_private_fn/struct_point.rs index 962dd0f0ee0..87b9892143c 100644 --- a/src/test/incremental/change_private_fn/struct_point.rs +++ b/src/test/incremental/change_private_fn/struct_point.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test where we change the body of a private method in an impl. // We then test what sort of functions must be rebuilt as a result. diff --git a/src/test/incremental/change_private_fn_cc/auxiliary/point.rs b/src/test/incremental/change_private_fn_cc/auxiliary/point.rs index af20336806f..483f205720c 100644 --- a/src/test/incremental/change_private_fn_cc/auxiliary/point.rs +++ b/src/test/incremental/change_private_fn_cc/auxiliary/point.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Point { pub x: f32, pub y: f32, diff --git a/src/test/incremental/change_private_fn_cc/struct_point.rs b/src/test/incremental/change_private_fn_cc/struct_point.rs index 77b613440ba..f73408f8dca 100644 --- a/src/test/incremental/change_private_fn_cc/struct_point.rs +++ b/src/test/incremental/change_private_fn_cc/struct_point.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test where we change the body of a private method in an impl. // We then test what sort of functions must be rebuilt as a result. diff --git a/src/test/incremental/change_private_impl_method/struct_point.rs b/src/test/incremental/change_private_impl_method/struct_point.rs index f11a54344e9..239872b0da4 100644 --- a/src/test/incremental/change_private_impl_method/struct_point.rs +++ b/src/test/incremental/change_private_impl_method/struct_point.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test where we change the body of a private method in an impl. // We then test what sort of functions must be rebuilt as a result. diff --git a/src/test/incremental/change_private_impl_method_cc/auxiliary/point.rs b/src/test/incremental/change_private_impl_method_cc/auxiliary/point.rs index f5e3a06051c..2441da06bc8 100644 --- a/src/test/incremental/change_private_impl_method_cc/auxiliary/point.rs +++ b/src/test/incremental/change_private_impl_method_cc/auxiliary/point.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Point { pub x: f32, pub y: f32, diff --git a/src/test/incremental/change_private_impl_method_cc/struct_point.rs b/src/test/incremental/change_private_impl_method_cc/struct_point.rs index d2a709d0a3d..dbbc8c0b906 100644 --- a/src/test/incremental/change_private_impl_method_cc/struct_point.rs +++ b/src/test/incremental/change_private_impl_method_cc/struct_point.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test where we change the body of a private method in an impl. // We then test what sort of functions must be rebuilt as a result. diff --git a/src/test/incremental/change_pub_inherent_method_body/struct_point.rs b/src/test/incremental/change_pub_inherent_method_body/struct_point.rs index 288582589f3..68f6e999107 100644 --- a/src/test/incremental/change_pub_inherent_method_body/struct_point.rs +++ b/src/test/incremental/change_pub_inherent_method_body/struct_point.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test where we change the body of a public, inherent method. // revisions:cfail1 cfail2 diff --git a/src/test/incremental/change_pub_inherent_method_sig/struct_point.rs b/src/test/incremental/change_pub_inherent_method_sig/struct_point.rs index 72483600f79..ae22717d38c 100644 --- a/src/test/incremental/change_pub_inherent_method_sig/struct_point.rs +++ b/src/test/incremental/change_pub_inherent_method_sig/struct_point.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test where we change the *signature* of a public, inherent method. // revisions:cfail1 cfail2 diff --git a/src/test/incremental/change_symbol_export_status.rs b/src/test/incremental/change_symbol_export_status.rs index 85b490741e2..c844e6a4009 100644 --- a/src/test/incremental/change_symbol_export_status.rs +++ b/src/test/incremental/change_symbol_export_status.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: rpass1 rpass2 // compile-flags: -Zquery-dep-graph diff --git a/src/test/incremental/commandline-args.rs b/src/test/incremental/commandline-args.rs index bb2f385e9c5..e5b84267b29 100644 --- a/src/test/incremental/commandline-args.rs +++ b/src/test/incremental/commandline-args.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that changing a tracked commandline argument invalidates // the cache while changing an untracked one doesn't. diff --git a/src/test/incremental/crate_hash_reorder.rs b/src/test/incremental/crate_hash_reorder.rs index 3f1bdb7e3c6..5aba2a67037 100644 --- a/src/test/incremental/crate_hash_reorder.rs +++ b/src/test/incremental/crate_hash_reorder.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the crate hash is not affected by reordering items. // revisions:rpass1 rpass2 rpass3 diff --git a/src/test/incremental/dirty_clean.rs b/src/test/incremental/dirty_clean.rs index 6d54cf53660..f4248dbdd6d 100644 --- a/src/test/incremental/dirty_clean.rs +++ b/src/test/incremental/dirty_clean.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: rpass1 cfail2 // compile-flags: -Z query-dep-graph diff --git a/src/test/incremental/extern_static/issue-49153.rs b/src/test/incremental/extern_static/issue-49153.rs index e0538e09c64..f1dbac28885 100644 --- a/src/test/incremental/extern_static/issue-49153.rs +++ b/src/test/incremental/extern_static/issue-49153.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // https://github.com/rust-lang/rust/issues/49153 // revisions:rpass1 rpass2 diff --git a/src/test/incremental/feature_gate.rs b/src/test/incremental/feature_gate.rs index de2f9ab52f6..d36044ec92b 100644 --- a/src/test/incremental/feature_gate.rs +++ b/src/test/incremental/feature_gate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test makes sure that we detect changed feature gates. // revisions:rpass1 cfail2 diff --git a/src/test/incremental/foreign.rs b/src/test/incremental/foreign.rs index dbdebefaf31..0581cd79975 100644 --- a/src/test/incremental/foreign.rs +++ b/src/test/incremental/foreign.rs @@ -1,19 +1,9 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test what happens we save incremental compilation state that makes // use of foreign items. This used to ICE (#34991). // revisions: rpass1 -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/incremental/hashes/call_expressions.rs b/src/test/incremental/hashes/call_expressions.rs index 3416669dbfa..52de0655989 100644 --- a/src/test/incremental/hashes/call_expressions.rs +++ b/src/test/incremental/hashes/call_expressions.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for function and method call expressions. diff --git a/src/test/incremental/hashes/closure_expressions.rs b/src/test/incremental/hashes/closure_expressions.rs index 3065265373d..c54f1680165 100644 --- a/src/test/incremental/hashes/closure_expressions.rs +++ b/src/test/incremental/hashes/closure_expressions.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for closure expression. diff --git a/src/test/incremental/hashes/consts.rs b/src/test/incremental/hashes/consts.rs index d523752c091..0ab0915d4d0 100644 --- a/src/test/incremental/hashes/consts.rs +++ b/src/test/incremental/hashes/consts.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for consts. diff --git a/src/test/incremental/hashes/enum_constructors.rs b/src/test/incremental/hashes/enum_constructors.rs index 6dc1b2d0fe7..394d6df8f4b 100644 --- a/src/test/incremental/hashes/enum_constructors.rs +++ b/src/test/incremental/hashes/enum_constructors.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for struct constructor expressions. diff --git a/src/test/incremental/hashes/enum_defs.rs b/src/test/incremental/hashes/enum_defs.rs index 0181ac3a24b..294476258ab 100644 --- a/src/test/incremental/hashes/enum_defs.rs +++ b/src/test/incremental/hashes/enum_defs.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for enum definitions. diff --git a/src/test/incremental/hashes/exported_vs_not.rs b/src/test/incremental/hashes/exported_vs_not.rs index f04f24a2ec7..1880dd2fb0d 100644 --- a/src/test/incremental/hashes/exported_vs_not.rs +++ b/src/test/incremental/hashes/exported_vs_not.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // revisions: cfail1 cfail2 cfail3 // compile-flags: -Z query-dep-graph -Zincremental-ignore-spans diff --git a/src/test/incremental/hashes/extern_mods.rs b/src/test/incremental/hashes/extern_mods.rs index 0e92c717643..e6423ebad12 100644 --- a/src/test/incremental/hashes/extern_mods.rs +++ b/src/test/incremental/hashes/extern_mods.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for `extern` modules. diff --git a/src/test/incremental/hashes/for_loops.rs b/src/test/incremental/hashes/for_loops.rs index b1cdef56b54..a63cb2dc630 100644 --- a/src/test/incremental/hashes/for_loops.rs +++ b/src/test/incremental/hashes/for_loops.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for `for` loops. diff --git a/src/test/incremental/hashes/function_interfaces.rs b/src/test/incremental/hashes/function_interfaces.rs index 372399e5520..5dfccba6d92 100644 --- a/src/test/incremental/hashes/function_interfaces.rs +++ b/src/test/incremental/hashes/function_interfaces.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for function interfaces. diff --git a/src/test/incremental/hashes/if_expressions.rs b/src/test/incremental/hashes/if_expressions.rs index 6b7e0b6dcd4..6faf969ad28 100644 --- a/src/test/incremental/hashes/if_expressions.rs +++ b/src/test/incremental/hashes/if_expressions.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for if expressions. diff --git a/src/test/incremental/hashes/indexing_expressions.rs b/src/test/incremental/hashes/indexing_expressions.rs index fa2d707c8a1..eb0c33f7766 100644 --- a/src/test/incremental/hashes/indexing_expressions.rs +++ b/src/test/incremental/hashes/indexing_expressions.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for indexing expression. diff --git a/src/test/incremental/hashes/inherent_impls.rs b/src/test/incremental/hashes/inherent_impls.rs index f8b47b3201e..4105fd5c400 100644 --- a/src/test/incremental/hashes/inherent_impls.rs +++ b/src/test/incremental/hashes/inherent_impls.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for let expressions. diff --git a/src/test/incremental/hashes/inline_asm.rs b/src/test/incremental/hashes/inline_asm.rs index cc427f35858..e73aa89a837 100644 --- a/src/test/incremental/hashes/inline_asm.rs +++ b/src/test/incremental/hashes/inline_asm.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for inline asm. diff --git a/src/test/incremental/hashes/let_expressions.rs b/src/test/incremental/hashes/let_expressions.rs index 8b2a4d77cc4..92e8ad91f4e 100644 --- a/src/test/incremental/hashes/let_expressions.rs +++ b/src/test/incremental/hashes/let_expressions.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for let expressions. @@ -82,7 +71,7 @@ pub fn change_mutability_of_reference_type() { #[cfg(not(cfail1))] #[rustc_clean(cfg="cfail2", - except="HirBody,TypeckTables,MirValidated")] + except="HirBody,TypeckTables,MirValidated,MirOptimized")] #[rustc_clean(cfg="cfail3")] pub fn change_mutability_of_reference_type() { let _x: &mut u64; diff --git a/src/test/incremental/hashes/loop_expressions.rs b/src/test/incremental/hashes/loop_expressions.rs index e56291f152f..ea473bcc4ad 100644 --- a/src/test/incremental/hashes/loop_expressions.rs +++ b/src/test/incremental/hashes/loop_expressions.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for `loop` loops. diff --git a/src/test/incremental/hashes/match_expressions.rs b/src/test/incremental/hashes/match_expressions.rs index f21b1f31eef..b6b934eb7d5 100644 --- a/src/test/incremental/hashes/match_expressions.rs +++ b/src/test/incremental/hashes/match_expressions.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for match expressions. diff --git a/src/test/incremental/hashes/panic_exprs.rs b/src/test/incremental/hashes/panic_exprs.rs index ffb66c29219..3ae2c396d82 100644 --- a/src/test/incremental/hashes/panic_exprs.rs +++ b/src/test/incremental/hashes/panic_exprs.rs @@ -1,15 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test case tests the incremental compilation hash (ICH) implementation -// for exprs that can panic at runtime (e.g. because of bounds checking). For +// for exprs that can panic at runtime (e.g., because of bounds checking). For // these expressions an error message containing their source location is // generated, so their hash must always depend on their location in the source // code, not just when debuginfo is enabled. diff --git a/src/test/incremental/hashes/statics.rs b/src/test/incremental/hashes/statics.rs index 95cec734f20..c3db4369b7d 100644 --- a/src/test/incremental/hashes/statics.rs +++ b/src/test/incremental/hashes/statics.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for statics. diff --git a/src/test/incremental/hashes/struct_constructors.rs b/src/test/incremental/hashes/struct_constructors.rs index 6010409b43f..dedb35406c3 100644 --- a/src/test/incremental/hashes/struct_constructors.rs +++ b/src/test/incremental/hashes/struct_constructors.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for struct constructor expressions. diff --git a/src/test/incremental/hashes/struct_defs.rs b/src/test/incremental/hashes/struct_defs.rs index 10b1beb0413..9fca1ce1c46 100644 --- a/src/test/incremental/hashes/struct_defs.rs +++ b/src/test/incremental/hashes/struct_defs.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for struct definitions. @@ -340,7 +329,7 @@ struct AddTypeParameterBoundWhereClause( // Empty struct ---------------------------------------------------------------- // Since we cannot change anything in this case, we just make sure that the -// fingerprint is stable (i.e. that there are no random influences like memory +// fingerprint is stable (i.e., that there are no random influences like memory // addresses taken into account by the hashing algorithm). // Note: there is no #[cfg(...)], so this is ALWAYS compiled #[rustc_clean(label="Hir", cfg="cfail2")] diff --git a/src/test/incremental/hashes/trait_defs.rs b/src/test/incremental/hashes/trait_defs.rs index e7d25d07d12..da57b485beb 100644 --- a/src/test/incremental/hashes/trait_defs.rs +++ b/src/test/incremental/hashes/trait_defs.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for trait definitions. diff --git a/src/test/incremental/hashes/trait_impls.rs b/src/test/incremental/hashes/trait_impls.rs index 346d14f9392..1487129d09e 100644 --- a/src/test/incremental/hashes/trait_impls.rs +++ b/src/test/incremental/hashes/trait_impls.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for let expressions. diff --git a/src/test/incremental/hashes/type_defs.rs b/src/test/incremental/hashes/type_defs.rs index 4dffaa42425..4ffa0d9bb7b 100644 --- a/src/test/incremental/hashes/type_defs.rs +++ b/src/test/incremental/hashes/type_defs.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for `type` definitions. diff --git a/src/test/incremental/hashes/unary_and_binary_exprs.rs b/src/test/incremental/hashes/unary_and_binary_exprs.rs index be995a86b0a..26cc41fd818 100644 --- a/src/test/incremental/hashes/unary_and_binary_exprs.rs +++ b/src/test/incremental/hashes/unary_and_binary_exprs.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for unary and binary expressions. diff --git a/src/test/incremental/hashes/while_let_loops.rs b/src/test/incremental/hashes/while_let_loops.rs index f99686462aa..7f2a7064d89 100644 --- a/src/test/incremental/hashes/while_let_loops.rs +++ b/src/test/incremental/hashes/while_let_loops.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for `while let` loops. diff --git a/src/test/incremental/hashes/while_loops.rs b/src/test/incremental/hashes/while_loops.rs index 48acd4140b3..bdf9f9088fa 100644 --- a/src/test/incremental/hashes/while_loops.rs +++ b/src/test/incremental/hashes/while_loops.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test case tests the incremental compilation hash (ICH) implementation // for `while` loops. diff --git a/src/test/incremental/hello_world.rs b/src/test/incremental/hello_world.rs index 2d65e0aa657..e2e15eb958f 100644 --- a/src/test/incremental/hello_world.rs +++ b/src/test/incremental/hello_world.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: rpass1 rpass2 // compile-flags: -Z query-dep-graph diff --git a/src/test/incremental/ich_method_call_trait_scope.rs b/src/test/incremental/ich_method_call_trait_scope.rs index 996c9ed21cf..d4b170bd277 100644 --- a/src/test/incremental/ich_method_call_trait_scope.rs +++ b/src/test/incremental/ich_method_call_trait_scope.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that the hash for a method call is sensitive to the traits in // scope. diff --git a/src/test/incremental/ich_nested_items.rs b/src/test/incremental/ich_nested_items.rs index 47369e95dce..3c2ce765c48 100644 --- a/src/test/incremental/ich_nested_items.rs +++ b/src/test/incremental/ich_nested_items.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that the hash of `foo` doesn't change just because we ordered // the nested items (or even added new ones). diff --git a/src/test/incremental/ich_resolve_results.rs b/src/test/incremental/ich_resolve_results.rs index 9e5b51f3e7a..0e4ab6b78e2 100644 --- a/src/test/incremental/ich_resolve_results.rs +++ b/src/test/incremental/ich_resolve_results.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that the hash for `mod3::bar` changes when we change the // `use` to something different. diff --git a/src/test/incremental/incremental_proc_macro.rs b/src/test/incremental/incremental_proc_macro.rs new file mode 100644 index 00000000000..b0e9b1f9180 --- /dev/null +++ b/src/test/incremental/incremental_proc_macro.rs @@ -0,0 +1,16 @@ +// aux-build:incremental_proc_macro_aux.rs +// revisions: cfail1 cfail2 +// compile-pass + +// This test makes sure that we still find the proc-macro registrar function +// when we compile proc-macros incrementally (see #47292). + +#![crate_type = "rlib"] + +#[macro_use] +extern crate incremental_proc_macro_aux; + +#[derive(IncrementalMacro)] +pub struct Foo { + x: u32 +} diff --git a/src/test/incremental/inlined_hir_34991/main.rs b/src/test/incremental/inlined_hir_34991/main.rs index baf4ae73932..819b8434b08 100644 --- a/src/test/incremental/inlined_hir_34991/main.rs +++ b/src/test/incremental/inlined_hir_34991/main.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #34991: an ICE occurred here because we inline // some of the vector routines and give them a local def-id `X`. This // got hashed after codegen (`Hir(X)`). When we load back up, we get an diff --git a/src/test/incremental/issue-35593.rs b/src/test/incremental/issue-35593.rs index 52a601ac1e8..009e37d17c3 100644 --- a/src/test/incremental/issue-35593.rs +++ b/src/test/incremental/issue-35593.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #35593. Check that we can reuse this trivially // equal example. diff --git a/src/test/incremental/issue-38222.rs b/src/test/incremental/issue-38222.rs index b2983e86925..85dbac5a3c4 100644 --- a/src/test/incremental/issue-38222.rs +++ b/src/test/incremental/issue-38222.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that debuginfo does not introduce a dependency edge to the Krate // dep-node. diff --git a/src/test/incremental/issue-39569.rs b/src/test/incremental/issue-39569.rs index 5b53e948253..06e3cf0a293 100644 --- a/src/test/incremental/issue-39569.rs +++ b/src/test/incremental/issue-39569.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for a weird corner case in our dep-graph reduction // code. When we solve `CoerceUnsized`, we find no impls, so we // don't end up with an edge to any HIR nodes, but it still gets diff --git a/src/test/incremental/issue-39828/auxiliary/generic.rs b/src/test/incremental/issue-39828/auxiliary/generic.rs index 5491827af8a..a5bb0d65f1b 100644 --- a/src/test/incremental/issue-39828/auxiliary/generic.rs +++ b/src/test/incremental/issue-39828/auxiliary/generic.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions:rpass1 rpass2 // compile-flags: -Z query-dep-graph diff --git a/src/test/incremental/issue-39828/issue-39828.rs b/src/test/incremental/issue-39828/issue-39828.rs index c729380bd5a..8cef916ff54 100644 --- a/src/test/incremental/issue-39828/issue-39828.rs +++ b/src/test/incremental/issue-39828/issue-39828.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #39828. If you make use of a module that // consists only of generics, no code is generated, just a dummy // module. The reduced graph consists of a single node (for that diff --git a/src/test/incremental/issue-42602.rs b/src/test/incremental/issue-42602.rs index 32a4ef4c4b3..5df095dce15 100644 --- a/src/test/incremental/issue-42602.rs +++ b/src/test/incremental/issue-42602.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #42602. It used to be that we had // a dep-graph like // diff --git a/src/test/incremental/issue-49043.rs b/src/test/incremental/issue-49043.rs index 118027b190e..50d8fb86930 100644 --- a/src/test/incremental/issue-49043.rs +++ b/src/test/incremental/issue-49043.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for hashing involving canonical variables. In this // test -- which has an intensional error -- the type of the value // being dropped winds up including a type variable. Canonicalization diff --git a/src/test/incremental/issue-49482.rs b/src/test/incremental/issue-49482.rs new file mode 100644 index 00000000000..67d2c3876d7 --- /dev/null +++ b/src/test/incremental/issue-49482.rs @@ -0,0 +1,30 @@ +// aux-build:issue_49482_macro_def.rs +// aux-build:issue_49482_reexport.rs +// revisions: rpass1 + +extern crate issue_49482_reexport; + +pub trait KvStorage +{ + fn get(&self); +} + +impl KvStorage for Box +where + K: KvStorage + ?Sized, +{ + fn get(&self) { + (**self).get() + } +} + +impl KvStorage for u32 { + fn get(&self) {} +} + +fn main() { + /* force issue_49482_reexport to be loaded */ + issue_49482_reexport::foo(); + + Box::new(2).get(); +} diff --git a/src/test/incremental/issue-49595/auxiliary/lit_a.rs b/src/test/incremental/issue-49595/auxiliary/lit_a.rs index f36baa05483..295a0b48139 100644 --- a/src/test/incremental/issue-49595/auxiliary/lit_a.rs +++ b/src/test/incremental/issue-49595/auxiliary/lit_a.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub const A: &str = "hello"; diff --git a/src/test/incremental/issue-49595/auxiliary/lit_b.rs b/src/test/incremental/issue-49595/auxiliary/lit_b.rs index 2252437e459..5d377edfb02 100644 --- a/src/test/incremental/issue-49595/auxiliary/lit_b.rs +++ b/src/test/incremental/issue-49595/auxiliary/lit_b.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub const A: &str = "xxxxx"; diff --git a/src/test/incremental/issue-49595/issue_49595.rs b/src/test/incremental/issue-49595/issue_49595.rs index 7067e725072..ada93f79b26 100644 --- a/src/test/incremental/issue-49595/issue_49595.rs +++ b/src/test/incremental/issue-49595/issue_49595.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions:cfail1 cfail2 cfail3 // compile-flags: -Z query-dep-graph --test // compile-pass diff --git a/src/test/incremental/issue-51409.rs b/src/test/incremental/issue-51409.rs index 8aa75e6315d..280094ec04a 100644 --- a/src/test/incremental/issue-51409.rs +++ b/src/test/incremental/issue-51409.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: rpass1 // Regression test that `infer_outlives_predicates` can be diff --git a/src/test/incremental/issue-54059.rs b/src/test/incremental/issue-54059.rs new file mode 100644 index 00000000000..d78bbccf1bc --- /dev/null +++ b/src/test/incremental/issue-54059.rs @@ -0,0 +1,8 @@ +// aux-build:issue_54059.rs +// ignore-wasm32-bare no libc for ffi testing +// ignore-windows - dealing with weird symbols issues on dylibs isn't worth it +// revisions: rpass1 + +extern crate issue_54059; + +fn main() {} diff --git a/src/test/incremental/krate-inherent.rs b/src/test/incremental/krate-inherent.rs index 79321e918c7..932b2aada9d 100644 --- a/src/test/incremental/krate-inherent.rs +++ b/src/test/incremental/krate-inherent.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: cfail1 cfail2 // compile-flags: -Z query-dep-graph // compile-pass diff --git a/src/test/incremental/krate-inlined.rs b/src/test/incremental/krate-inlined.rs index e8096df1758..b87876c3746 100644 --- a/src/test/incremental/krate-inlined.rs +++ b/src/test/incremental/krate-inlined.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regr. test that using HIR inlined from another krate does *not* add // a dependency from the local Krate node. We can't easily test that // directly anymore, so now we test that we get reuse. diff --git a/src/test/incremental/krate_reassign_34991/auxiliary/a.rs b/src/test/incremental/krate_reassign_34991/auxiliary/a.rs index 865156095a4..33fa789fcae 100644 --- a/src/test/incremental/krate_reassign_34991/auxiliary/a.rs +++ b/src/test/incremental/krate_reassign_34991/auxiliary/a.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="rlib"] pub type X = u32; diff --git a/src/test/incremental/krate_reassign_34991/main.rs b/src/test/incremental/krate_reassign_34991/main.rs index 1c807059ddb..c4ae19ac942 100644 --- a/src/test/incremental/krate_reassign_34991/main.rs +++ b/src/test/incremental/krate_reassign_34991/main.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:a.rs // revisions:rpass1 rpass2 diff --git a/src/test/incremental/macro_export.rs b/src/test/incremental/macro_export.rs index 7c1a5c5c2e6..d1966646867 100644 --- a/src/test/incremental/macro_export.rs +++ b/src/test/incremental/macro_export.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: cfail1 cfail2 cfail3 // compile-pass diff --git a/src/test/incremental/remapped_paths_cc/auxiliary/extern_crate.rs b/src/test/incremental/remapped_paths_cc/auxiliary/extern_crate.rs index c80b334623b..52e7f4bd7c7 100644 --- a/src/test/incremental/remapped_paths_cc/auxiliary/extern_crate.rs +++ b/src/test/incremental/remapped_paths_cc/auxiliary/extern_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength //[rpass1] compile-flags: -g diff --git a/src/test/incremental/remapped_paths_cc/main.rs b/src/test/incremental/remapped_paths_cc/main.rs index c27bc9d0247..2a8a73b9c20 100644 --- a/src/test/incremental/remapped_paths_cc/main.rs +++ b/src/test/incremental/remapped_paths_cc/main.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions:rpass1 rpass2 rpass3 // compile-flags: -Z query-dep-graph -g // aux-build:extern_crate.rs diff --git a/src/test/incremental/remove-private-item-cross-crate/auxiliary/a.rs b/src/test/incremental/remove-private-item-cross-crate/auxiliary/a.rs index 4d84e844ded..279a6f078d1 100644 --- a/src/test/incremental/remove-private-item-cross-crate/auxiliary/a.rs +++ b/src/test/incremental/remove-private-item-cross-crate/auxiliary/a.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![crate_name = "a"] #![crate_type = "rlib"] diff --git a/src/test/incremental/remove-private-item-cross-crate/main.rs b/src/test/incremental/remove-private-item-cross-crate/main.rs index 7adefa8554d..9b5c1d661f2 100644 --- a/src/test/incremental/remove-private-item-cross-crate/main.rs +++ b/src/test/incremental/remove-private-item-cross-crate/main.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to reuse `main` even though a private // item was removed from the root module of crate`a`. diff --git a/src/test/incremental/remove_crate/auxiliary/extern_crate.rs b/src/test/incremental/remove_crate/auxiliary/extern_crate.rs index 39543cd829d..1cafdf49d74 100644 --- a/src/test/incremental/remove_crate/auxiliary/extern_crate.rs +++ b/src/test/incremental/remove_crate/auxiliary/extern_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo(_: u8) { } diff --git a/src/test/incremental/remove_crate/main.rs b/src/test/incremental/remove_crate/main.rs index fafcb8bb0c8..14b80df0d38 100644 --- a/src/test/incremental/remove_crate/main.rs +++ b/src/test/incremental/remove_crate/main.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that removing an upstream crate does not cause any trouble. // revisions:rpass1 rpass2 diff --git a/src/test/incremental/remove_source_file/auxiliary/mod.rs b/src/test/incremental/remove_source_file/auxiliary/mod.rs index a2cea65a309..96a366d9633 100644 --- a/src/test/incremental/remove_source_file/auxiliary/mod.rs +++ b/src/test/incremental/remove_source_file/auxiliary/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn print_hello() { println!("hello"); } diff --git a/src/test/incremental/remove_source_file/main.rs b/src/test/incremental/remove_source_file/main.rs index 75fe6d9511c..3af9c051892 100644 --- a/src/test/incremental/remove_source_file/main.rs +++ b/src/test/incremental/remove_source_file/main.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test case makes sure that the compiler doesn't crash due to a failing // table lookup when a source file is removed. diff --git a/src/test/incremental/rlib_cross_crate/auxiliary/a.rs b/src/test/incremental/rlib_cross_crate/auxiliary/a.rs index 1099aeb9217..5a26df9ae50 100644 --- a/src/test/incremental/rlib_cross_crate/auxiliary/a.rs +++ b/src/test/incremental/rlib_cross_crate/auxiliary/a.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // compile-flags: -Z query-dep-graph diff --git a/src/test/incremental/rlib_cross_crate/b.rs b/src/test/incremental/rlib_cross_crate/b.rs index 9849e93d3ff..7c3dcf3a815 100644 --- a/src/test/incremental/rlib_cross_crate/b.rs +++ b/src/test/incremental/rlib_cross_crate/b.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Same test as `type_alias_cross_crate`, but with // `no-prefer-dynamic`, ensuring that we test what happens when we // build rlibs (before we were only testing dylibs, which meant we diff --git a/src/test/incremental/source_loc_macros.rs b/src/test/incremental/source_loc_macros.rs index 3f669ae3fc8..51ea7d6d447 100644 --- a/src/test/incremental/source_loc_macros.rs +++ b/src/test/incremental/source_loc_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test makes sure that different expansions of the file!(), line!(), // column!() macros get picked up by the incr. comp. hash. diff --git a/src/test/incremental/span_hash_stable/auxiliary/mod.rs b/src/test/incremental/span_hash_stable/auxiliary/mod.rs index dfd2a6610f2..f3824db4c42 100644 --- a/src/test/incremental/span_hash_stable/auxiliary/mod.rs +++ b/src/test/incremental/span_hash_stable/auxiliary/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[cfg(rpass1)] pub mod sub2; diff --git a/src/test/incremental/span_hash_stable/auxiliary/sub1.rs b/src/test/incremental/span_hash_stable/auxiliary/sub1.rs index 2d042c31683..54fbe4465e3 100644 --- a/src/test/incremental/span_hash_stable/auxiliary/sub1.rs +++ b/src/test/incremental/span_hash_stable/auxiliary/sub1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[rustc_clean(label="Hir", cfg="rpass2")] pub struct SomeType { pub x: u32, diff --git a/src/test/incremental/span_hash_stable/auxiliary/sub2.rs b/src/test/incremental/span_hash_stable/auxiliary/sub2.rs index df7d2f0267d..34957616856 100644 --- a/src/test/incremental/span_hash_stable/auxiliary/sub2.rs +++ b/src/test/incremental/span_hash_stable/auxiliary/sub2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[rustc_clean(label="Hir", cfg="rpass2")] pub struct SomeOtherType { pub a: i32, diff --git a/src/test/incremental/span_hash_stable/main.rs b/src/test/incremental/span_hash_stable/main.rs index 646a388c877..f19c99e1986 100644 --- a/src/test/incremental/span_hash_stable/main.rs +++ b/src/test/incremental/span_hash_stable/main.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test makes sure that it doesn't make a difference in which order we are // adding source files to the source_map. The order affects the BytePos values of // the spans and this test makes sure that we handle them correctly by hashing diff --git a/src/test/incremental/spans_in_type_debuginfo.rs b/src/test/incremental/spans_in_type_debuginfo.rs index 8d8b5d93a26..29da0ffb873 100644 --- a/src/test/incremental/spans_in_type_debuginfo.rs +++ b/src/test/incremental/spans_in_type_debuginfo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that moving a type definition within a source file does not affect // re-compilation. diff --git a/src/test/incremental/spans_significant_w_debuginfo.rs b/src/test/incremental/spans_significant_w_debuginfo.rs index cdab8de9828..87c97ba06c4 100644 --- a/src/test/incremental/spans_significant_w_debuginfo.rs +++ b/src/test/incremental/spans_significant_w_debuginfo.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test makes sure that just changing a definition's location in the // source file also changes its incr. comp. hash, if debuginfo is enabled. diff --git a/src/test/incremental/spans_significant_w_panic.rs b/src/test/incremental/spans_significant_w_panic.rs index 1fefec7a0a7..ecda56f7e94 100644 --- a/src/test/incremental/spans_significant_w_panic.rs +++ b/src/test/incremental/spans_significant_w_panic.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test makes sure that just changing a definition's location in the // source file also changes its incr. comp. hash, if debuginfo is enabled. diff --git a/src/test/incremental/spike-neg1.rs b/src/test/incremental/spike-neg1.rs index d4701b9a66e..97812ffe3be 100644 --- a/src/test/incremental/spike-neg1.rs +++ b/src/test/incremental/spike-neg1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A variant of the first "spike" test that serves to test the // `rustc_partition_reused` and `rustc_partition_codegened` tests. // Here we change and say that the `x` module will be reused (when in diff --git a/src/test/incremental/spike-neg2.rs b/src/test/incremental/spike-neg2.rs index da79237b1a6..3bb1914fd6a 100644 --- a/src/test/incremental/spike-neg2.rs +++ b/src/test/incremental/spike-neg2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A variant of the first "spike" test that serves to test the // `rustc_partition_reused` and `rustc_partition_codegened` tests. // Here we change and say that the `y` module will be codegened (when diff --git a/src/test/incremental/spike.rs b/src/test/incremental/spike.rs index 77470467b49..3e4b16542aa 100644 --- a/src/test/incremental/spike.rs +++ b/src/test/incremental/spike.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A first "spike" for incremental compilation: here, we change the // content of the `make` function, and we find that we can reuse the // `y` module entirely (but not the `x` module). diff --git a/src/test/incremental/static_cycle/b.rs b/src/test/incremental/static_cycle/b.rs index b659703bef0..064213fbabb 100644 --- a/src/test/incremental/static_cycle/b.rs +++ b/src/test/incremental/static_cycle/b.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions:rpass1 rpass2 #![cfg_attr(rpass2, warn(dead_code))] diff --git a/src/test/incremental/static_refering_to_other_static/issue-49081.rs b/src/test/incremental/static_refering_to_other_static/issue-49081.rs index 6345b456523..8e3715d1d83 100644 --- a/src/test/incremental/static_refering_to_other_static/issue-49081.rs +++ b/src/test/incremental/static_refering_to_other_static/issue-49081.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // https://github.com/rust-lang/rust/issues/49081 // revisions:rpass1 rpass2 diff --git a/src/test/incremental/static_refering_to_other_static2/issue.rs b/src/test/incremental/static_refering_to_other_static2/issue.rs index 55847866895..720bb1e222b 100644 --- a/src/test/incremental/static_refering_to_other_static2/issue.rs +++ b/src/test/incremental/static_refering_to_other_static2/issue.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions:rpass1 rpass2 #[cfg(rpass1)] diff --git a/src/test/incremental/static_refering_to_other_static3/issue.rs b/src/test/incremental/static_refering_to_other_static3/issue.rs index f19ae9e0e8d..80999813dc5 100644 --- a/src/test/incremental/static_refering_to_other_static3/issue.rs +++ b/src/test/incremental/static_refering_to_other_static3/issue.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions:rpass1 rpass2 #[cfg(rpass1)] diff --git a/src/test/incremental/static_stable_hash/issue-49301.rs b/src/test/incremental/static_stable_hash/issue-49301.rs index 3e421b27c11..fdd05c72ca3 100644 --- a/src/test/incremental/static_stable_hash/issue-49301.rs +++ b/src/test/incremental/static_stable_hash/issue-49301.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // https://github.com/rust-lang/rust/issues/49081 // revisions:rpass1 rpass2 diff --git a/src/test/incremental/string_constant.rs b/src/test/incremental/string_constant.rs index f492f61739e..ea0ed11141f 100644 --- a/src/test/incremental/string_constant.rs +++ b/src/test/incremental/string_constant.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: cfail1 cfail2 // compile-flags: -Z query-dep-graph // compile-pass diff --git a/src/test/incremental/struct_add_field.rs b/src/test/incremental/struct_add_field.rs index 42681eb2be4..d019a3d2ab8 100644 --- a/src/test/incremental/struct_add_field.rs +++ b/src/test/incremental/struct_add_field.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test incremental compilation tracking where we change field names // in between revisions (hashing should be stable). diff --git a/src/test/incremental/struct_change_field_name.rs b/src/test/incremental/struct_change_field_name.rs index 63df407d5c0..28011efed9c 100644 --- a/src/test/incremental/struct_change_field_name.rs +++ b/src/test/incremental/struct_change_field_name.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test incremental compilation tracking where we change field names // in between revisions (hashing should be stable). diff --git a/src/test/incremental/struct_change_field_type.rs b/src/test/incremental/struct_change_field_type.rs index 67b34163979..cb4a83c2f9a 100644 --- a/src/test/incremental/struct_change_field_type.rs +++ b/src/test/incremental/struct_change_field_type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test incremental compilation tracking where we change nothing // in between revisions (hashing should be stable). diff --git a/src/test/incremental/struct_change_field_type_cross_crate/auxiliary/a.rs b/src/test/incremental/struct_change_field_type_cross_crate/auxiliary/a.rs index 2ddcaf15721..d3ddb32c338 100644 --- a/src/test/incremental/struct_change_field_type_cross_crate/auxiliary/a.rs +++ b/src/test/incremental/struct_change_field_type_cross_crate/auxiliary/a.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="rlib"] #[cfg(rpass1)] diff --git a/src/test/incremental/struct_change_field_type_cross_crate/b.rs b/src/test/incremental/struct_change_field_type_cross_crate/b.rs index 9660f47da35..ecfd24cbaf4 100644 --- a/src/test/incremental/struct_change_field_type_cross_crate/b.rs +++ b/src/test/incremental/struct_change_field_type_cross_crate/b.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:a.rs // revisions:rpass1 rpass2 // compile-flags: -Z query-dep-graph diff --git a/src/test/incremental/struct_change_nothing.rs b/src/test/incremental/struct_change_nothing.rs index e2d40458744..e62c004a83d 100644 --- a/src/test/incremental/struct_change_nothing.rs +++ b/src/test/incremental/struct_change_nothing.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test incremental compilation tracking where we change nothing // in between revisions (hashing should be stable). diff --git a/src/test/incremental/struct_remove_field.rs b/src/test/incremental/struct_remove_field.rs index fba965ff5a0..572a2c640e6 100644 --- a/src/test/incremental/struct_remove_field.rs +++ b/src/test/incremental/struct_remove_field.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test incremental compilation tracking where we change field names // in between revisions (hashing should be stable). diff --git a/src/test/incremental/thinlto/cgu_invalidated_via_import.rs b/src/test/incremental/thinlto/cgu_invalidated_via_import.rs index d5c34c53f6f..92cf19eac46 100644 --- a/src/test/incremental/thinlto/cgu_invalidated_via_import.rs +++ b/src/test/incremental/thinlto/cgu_invalidated_via_import.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test checks that the LTO phase is re-done for CGUs that import something // via ThinLTO and that imported thing changes while the definition of the CGU // stays untouched. diff --git a/src/test/incremental/thinlto/independent_cgus_dont_affect_each_other.rs b/src/test/incremental/thinlto/independent_cgus_dont_affect_each_other.rs index 557b362bafd..aeee1f005b6 100644 --- a/src/test/incremental/thinlto/independent_cgus_dont_affect_each_other.rs +++ b/src/test/incremental/thinlto/independent_cgus_dont_affect_each_other.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // This test checks that a change in a CGU does not invalidate an unrelated CGU // during incremental ThinLTO. diff --git a/src/test/incremental/type_alias_cross_crate/auxiliary/a.rs b/src/test/incremental/type_alias_cross_crate/auxiliary/a.rs index 2ae434071f2..61fe297d73d 100644 --- a/src/test/incremental/type_alias_cross_crate/auxiliary/a.rs +++ b/src/test/incremental/type_alias_cross_crate/auxiliary/a.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z query-dep-graph #![crate_type="rlib"] diff --git a/src/test/incremental/type_alias_cross_crate/b.rs b/src/test/incremental/type_alias_cross_crate/b.rs index ee35a4d9b9c..9261a0fb290 100644 --- a/src/test/incremental/type_alias_cross_crate/b.rs +++ b/src/test/incremental/type_alias_cross_crate/b.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:a.rs // revisions:rpass1 rpass2 rpass3 // compile-flags: -Z query-dep-graph diff --git a/src/test/incremental/unchecked_dirty_clean.rs b/src/test/incremental/unchecked_dirty_clean.rs index a81e884f39e..9ea9431e20a 100644 --- a/src/test/incremental/unchecked_dirty_clean.rs +++ b/src/test/incremental/unchecked_dirty_clean.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: rpass1 cfail2 // compile-flags: -Z query-dep-graph diff --git a/src/test/incremental/warnings-reemitted.rs b/src/test/incremental/warnings-reemitted.rs index 1ea436d8ad1..f2acaa0121b 100644 --- a/src/test/incremental/warnings-reemitted.rs +++ b/src/test/incremental/warnings-reemitted.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: cfail1 cfail2 cfail3 // compile-flags: -Coverflow-checks=on // compile-pass diff --git a/src/test/mir-opt/basic_assignment.rs b/src/test/mir-opt/basic_assignment.rs index 75f19d133e0..1bbbe67a12c 100644 --- a/src/test/mir-opt/basic_assignment.rs +++ b/src/test/mir-opt/basic_assignment.rs @@ -1,23 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // this tests move up progration, which is not yet implemented -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // Check codegen for assignments (`a = b`) where the left-hand-side is // not yet initialized. Assignments tend to be absent in simple code, @@ -56,7 +37,7 @@ fn main() { // StorageLive(_4); // _4 = std::option::Option>::None; // FakeRead(ForLet, _4); -// AscribeUserType(_4, o, UserTypeProjection { base: Ty(Canonical { max_universe: U0, variables: [], value: std::option::Option> }), projs: [] }); +// AscribeUserType(_4, o, UserTypeProjection { base: UserType(1), projs: [] }); // StorageLive(_5); // StorageLive(_6); // _6 = move _4; diff --git a/src/test/mir-opt/box_expr.rs b/src/test/mir-opt/box_expr.rs index 8390a0d19ae..ad5cf42029e 100644 --- a/src/test/mir-opt/box_expr.rs +++ b/src/test/mir-opt/box_expr.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare compiled with panic=abort by default #![feature(box_syntax)] diff --git a/src/test/mir-opt/combine_array_len.rs b/src/test/mir-opt/combine_array_len.rs index 440ad3518ae..9a046202cd0 100644 --- a/src/test/mir-opt/combine_array_len.rs +++ b/src/test/mir-opt/combine_array_len.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn norm2(x: [f32; 2]) -> f32 { let a = x[0]; let b = x[1]; diff --git a/src/test/mir-opt/copy_propagation.rs b/src/test/mir-opt/copy_propagation.rs index 067a937b0b3..a86caf04b04 100644 --- a/src/test/mir-opt/copy_propagation.rs +++ b/src/test/mir-opt/copy_propagation.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn test(x: u32) -> u32 { let y = x; y diff --git a/src/test/mir-opt/copy_propagation_arg.rs b/src/test/mir-opt/copy_propagation_arg.rs index dacaff8f2d9..4e05484a80c 100644 --- a/src/test/mir-opt/copy_propagation_arg.rs +++ b/src/test/mir-opt/copy_propagation_arg.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that CopyPropagation does not propagate an assignment to a function argument // (doing so can break usages of the original argument value) diff --git a/src/test/mir-opt/deaggregator_test.rs b/src/test/mir-opt/deaggregator_test.rs index c918bef129a..44c2319bc7e 100644 --- a/src/test/mir-opt/deaggregator_test.rs +++ b/src/test/mir-opt/deaggregator_test.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Baz { x: usize, y: f32, diff --git a/src/test/mir-opt/deaggregator_test_enum.rs b/src/test/mir-opt/deaggregator_test_enum.rs index 8af56b7c011..fed16271590 100644 --- a/src/test/mir-opt/deaggregator_test_enum.rs +++ b/src/test/mir-opt/deaggregator_test_enum.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Baz { Empty, Foo { x: usize }, diff --git a/src/test/mir-opt/deaggregator_test_enum_2.rs b/src/test/mir-opt/deaggregator_test_enum_2.rs index b6505de22f3..59c75739d81 100644 --- a/src/test/mir-opt/deaggregator_test_enum_2.rs +++ b/src/test/mir-opt/deaggregator_test_enum_2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that deaggregate fires in more than one basic block enum Foo { diff --git a/src/test/mir-opt/deaggregator_test_multiple.rs b/src/test/mir-opt/deaggregator_test_multiple.rs index 3a9a458fd46..34c41af273f 100644 --- a/src/test/mir-opt/deaggregator_test_multiple.rs +++ b/src/test/mir-opt/deaggregator_test_multiple.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that deaggregate fires more than once per block enum Foo { diff --git a/src/test/mir-opt/end_region_1.rs b/src/test/mir-opt/end_region_1.rs deleted file mode 100644 index dd1c2bd5126..00000000000 --- a/src/test/mir-opt/end_region_1.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z emit-end-regions -// ignore-tidy-linelength - -// This is just about the simplest program that exhibits an EndRegion. - -fn main() { - let a = 3; - let b = &a; -} - -// END RUST SOURCE -// START rustc.main.SimplifyCfg-qualify-consts.after.mir -// let mut _0: (); -// ... -// let _2: &'11_1rs i32; -// ... -// let _1: i32; -// ... -// bb0: { -// StorageLive(_1); -// _1 = const 3i32; -// FakeRead(ForLet, _1); -// StorageLive(_2); -// _2 = &'11_1rs _1; -// FakeRead(ForLet, _2); -// _0 = (); -// EndRegion('11_1rs); -// StorageDead(_2); -// StorageDead(_1); -// return; -// } -// END rustc.main.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_2.rs b/src/test/mir-opt/end_region_2.rs deleted file mode 100644 index 6b0a28b8110..00000000000 --- a/src/test/mir-opt/end_region_2.rs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z emit-end-regions -// ignore-tidy-linelength - -// We will EndRegion for borrows in a loop that occur before break but -// not those after break. - -fn main() { - loop { - let a = true; - let b = &a; - if a { break; } - let c = &a; - } -} - -// END RUST SOURCE -// START rustc.main.SimplifyCfg-qualify-consts.after.mir -// let mut _0: (); -// ... -// let _7: &'26_3rs bool; -// ... -// let _3: &'26_1rs bool; -// ... -// let _2: bool; -// ... -// let mut _4: (); -// let mut _5: bool; -// ... -// bb0: { -// goto -> bb1; -// } -// bb1: { -// falseUnwind -> [real: bb2, cleanup: bb3]; -// } -// bb2: { -// StorageLive(_2); -// _2 = const true; -// FakeRead(ForLet, _2); -// StorageLive(_3); -// _3 = &'26_1rs _2; -// FakeRead(ForLet, _3); -// StorageLive(_5); -// _5 = _2; -// switchInt(move _5) -> [false: bb5, otherwise: bb4]; -// } -// bb3: { -// ... -// } -// bb4: { -// _0 = (); -// StorageDead(_5); -// EndRegion('26_1rs); -// StorageDead(_3); -// StorageDead(_2); -// return; -// } -// bb5: { -// _4 = (); -// StorageDead(_5); -// StorageLive(_7); -// _7 = &'26_3rs _2; -// FakeRead(ForLet, _7); -// _1 = (); -// EndRegion('26_3rs); -// StorageDead(_7); -// EndRegion('26_1rs); -// StorageDead(_3); -// StorageDead(_2); -// goto -> bb1; -// } -// END rustc.main.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_3.rs b/src/test/mir-opt/end_region_3.rs deleted file mode 100644 index d8d48358e53..00000000000 --- a/src/test/mir-opt/end_region_3.rs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z emit-end-regions -// ignore-tidy-linelength - -// Binding the borrow's subject outside the loop does not increase the -// scope of the borrow. - -fn main() { - let mut a; - loop { - a = true; - let b = &a; - if a { break; } - let c = &a; - } -} - -// END RUST SOURCE -// START rustc.main.SimplifyCfg-qualify-consts.after.mir -// let mut _0: (); -// ... -// let _7: &'30_3rs bool; -// ... -// let _3: &'30_1rs bool; -// ... -// let mut _1: bool; -// ... -// let mut _2: (); -// let mut _4: (); -// let mut _5: bool; -// let mut _6: !; -// bb0: { -// StorageLive(_1); -// goto -> bb1; -// } -// bb1: { -// falseUnwind -> [real: bb2, cleanup: bb3]; -// } -// bb2: { -// _1 = const true; -// StorageLive(_3); -// _3 = &'30_1rs _1; -// FakeRead(ForLet, _3); -// StorageLive(_5); -// _5 = _1; -// switchInt(move _5) -> [false: bb5, otherwise: bb4]; -// } -// bb3: { -// ... -// } -// bb4: { -// _0 = (); -// StorageDead(_5); -// EndRegion('30_1rs); -// StorageDead(_3); -// StorageDead(_1); -// return; -// } -// bb5: { -// _4 = (); -// StorageDead(_5); -// StorageLive(_7); -// _7 = &'30_3rs _1; -// FakeRead(ForLet, _7); -// _2 = (); -// EndRegion('30_3rs); -// StorageDead(_7); -// EndRegion('30_1rs); -// StorageDead(_3); -// goto -> bb1; -// } -// END rustc.main.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_4.rs b/src/test/mir-opt/end_region_4.rs deleted file mode 100644 index 3d15f20bd05..00000000000 --- a/src/test/mir-opt/end_region_4.rs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z emit-end-regions -// ignore-tidy-linelength - -// Unwinding should EndRegion for in-scope borrows: Direct borrows. - -fn main() { - let d = D(0); - let a = 0; - let b = &a; - foo(*b); - let c = &a; -} - -struct D(i32); -impl Drop for D { fn drop(&mut self) { println!("dropping D({})", self.0); } } - -fn foo(i: i32) { - if i > 0 { panic!("im positive"); } -} - -// END RUST SOURCE -// START rustc.main.SimplifyCfg-qualify-consts.after.mir -// let mut _0: (); -// ... -// let _6: &'31_4rs i32; -// ... -// let _3: &'31_2rs i32; -// ... -// let _2: i32; -// ... -// let _1: D; -// ... -// let mut _4: (); -// let mut _5: i32; -// bb0: { -// StorageLive(_1); -// _1 = D(const 0i32,); -// FakeRead(ForLet, _1); -// StorageLive(_2); -// _2 = const 0i32; -// FakeRead(ForLet, _2); -// StorageLive(_3); -// _3 = &'31_2rs _2; -// FakeRead(ForLet, _3); -// StorageLive(_5); -// _5 = (*_3); -// _4 = const foo(move _5) -> [return: bb2, unwind: bb3]; -// } -// bb1: { -// resume; -// } -// bb2: { -// StorageDead(_5); -// StorageLive(_6); -// _6 = &'31_4rs _2; -// FakeRead(ForLet, _6); -// _0 = (); -// EndRegion('31_4rs); -// StorageDead(_6); -// EndRegion('31_2rs); -// StorageDead(_3); -// StorageDead(_2); -// drop(_1) -> [return: bb4, unwind: bb1]; -// } -// bb3: { -// EndRegion('31_2rs); -// drop(_1) -> bb1; -// } -// bb4: { -// StorageDead(_1); -// return; -// } -// END rustc.main.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_5.rs b/src/test/mir-opt/end_region_5.rs deleted file mode 100644 index 06d1fbabe16..00000000000 --- a/src/test/mir-opt/end_region_5.rs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z span_free_formats -Z emit-end-regions - -// Unwinding should EndRegion for in-scope borrows: Borrowing via by-ref closure. - -fn main() { - let d = D(0); - foo(|| -> i32 { d.0 }); -} - -struct D(i32); -impl Drop for D { fn drop(&mut self) { println!("dropping D({})", self.0); } } - -fn foo(f: F) where F: FnOnce() -> i32 { - if f() > 0 { panic!("im positive"); } -} - -// END RUST SOURCE -// START rustc.main.SimplifyCfg-qualify-consts.after.mir -// fn main() -> () { -// ... -// let mut _0: (); -// ... -// let _1: D; -// ... -// let mut _2: (); -// let mut _3: [closure@NodeId(28) d:&'18s D]; -// let mut _4: &'18s D; -// bb0: { -// StorageLive(_1); -// _1 = D(const 0i32,); -// FakeRead(ForLet, _1); -// StorageLive(_3); -// StorageLive(_4); -// _4 = &'18s _1; -// _3 = [closure@NodeId(28)] { d: move _4 }; -// StorageDead(_4); -// _2 = const foo(move _3) -> [return: bb2, unwind: bb3]; -// } -// bb1: { -// resume; -// } -// bb2: { -// EndRegion('18s); -// StorageDead(_3); -// _0 = (); -// drop(_1) -> [return: bb4, unwind: bb1]; -// } -// bb3: { -// EndRegion('18s); -// drop(_1) -> bb1; -// } -// bb4: { -// StorageDead(_1); -// return; -// } -// } -// END rustc.main.SimplifyCfg-qualify-consts.after.mir - -// START rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir -// fn main::{{closure}}(_1: [closure@NodeId(28) d:&'18s D]) -> i32 { -// let mut _0: i32; -// -// bb0: { -// _0 = ((*(_1.0: &'18s D)).0: i32); -// return; -// } -// END rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_6.rs b/src/test/mir-opt/end_region_6.rs deleted file mode 100644 index d0db23e6de0..00000000000 --- a/src/test/mir-opt/end_region_6.rs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z span_free_formats -Z emit-end-regions -// ignore-tidy-linelength - -// Unwinding should EndRegion for in-scope borrows: 2nd borrow within by-ref closure. - -fn main() { - let d = D(0); - foo(|| -> i32 { let r = &d; r.0 }); -} - -struct D(i32); -impl Drop for D { fn drop(&mut self) { println!("dropping D({})", self.0); } } - -fn foo(f: F) where F: FnOnce() -> i32 { - if f() > 0 { panic!("im positive"); } -} - -// END RUST SOURCE -// START rustc.main.SimplifyCfg-qualify-consts.after.mir -// fn main() -> () { -// let mut _0: (); -// ... -// let _1: D; -// ... -// let mut _2: (); -// let mut _3: [closure@NodeId(33) d:&'24s D]; -// let mut _4: &'24s D; -// bb0: { -// StorageLive(_1); -// _1 = D(const 0i32,); -// FakeRead(ForLet, _1); -// StorageLive(_3); -// StorageLive(_4); -// _4 = &'24s _1; -// _3 = [closure@NodeId(33)] { d: move _4 }; -// StorageDead(_4); -// _2 = const foo(move _3) -> [return: bb2, unwind: bb3]; -// } -// bb1: { -// resume; -// } -// bb2: { -// EndRegion('24s); -// StorageDead(_3); -// _0 = (); -// drop(_1) -> [return: bb4, unwind: bb1]; -// } -// bb3: { -// EndRegion('24s); -// drop(_1) -> bb1; -// } -// bb4: { -// StorageDead(_1); -// return; -// } -// END rustc.main.SimplifyCfg-qualify-consts.after.mir - -// START rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir -// fn main::{{closure}}(_1: [closure@NodeId(33) d:&'24s D]) -> i32 { -// let mut _0: i32; -// ... -// let _2: &'21_0rs D; -// ... -// bb0: { -// StorageLive(_2); -// _2 = &'21_0rs (*(_1.0: &'24s D)); -// FakeRead(ForLet, _2); -// _0 = ((*_2).0: i32); -// EndRegion('21_0rs); -// StorageDead(_2); -// return; -// } -// END rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_7.rs b/src/test/mir-opt/end_region_7.rs deleted file mode 100644 index c7df440ebe2..00000000000 --- a/src/test/mir-opt/end_region_7.rs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z span_free_formats -Z emit-end-regions -// ignore-tidy-linelength - -// Unwinding should EndRegion for in-scope borrows: Borrow of moved data. - -fn main() { - let d = D(0); - foo(move || -> i32 { let r = &d; r.0 }); -} - -struct D(i32); -impl Drop for D { fn drop(&mut self) { println!("dropping D({})", self.0); } } - -fn foo(f: F) where F: FnOnce() -> i32 { - if f() > 0 { panic!("im positive"); } -} - -// END RUST SOURCE -// START rustc.main.SimplifyCfg-qualify-consts.after.mir -// fn main() -> () { -// let mut _0: (); -// ... -// let _1: D; -// ... -// let mut _2: (); -// let mut _3: [closure@NodeId(33) d:D]; -// bb0: { -// StorageLive(_1); -// _1 = D(const 0i32,); -// FakeRead(ForLet, _1); -// StorageLive(_3); -// _3 = [closure@NodeId(33)] { d: move _1 }; -// _2 = const foo(move _3) -> [return: bb2, unwind: bb4]; -// } -// bb1: { -// resume; -// } -// bb2: { -// drop(_3) -> [return: bb5, unwind: bb3]; -// } -// bb3: { -// drop(_1) -> bb1; -// } -// bb4: { -// drop(_3) -> bb3; -// } -// bb5: { -// StorageDead(_3); -// _0 = (); -// drop(_1) -> [return: bb6, unwind: bb1]; -// } -// bb6: { -// StorageDead(_1); -// return; -// } -// } -// END rustc.main.SimplifyCfg-qualify-consts.after.mir - -// START rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir -// fn main::{{closure}}(_1: [closure@NodeId(33) d:D]) -> i32 { -// let mut _0: i32; -// ... -// let _2: &'21_0rs D; -// ... -// bb0: { -// StorageLive(_2); -// _2 = &'21_0rs (_1.0: D); -// FakeRead(ForLet, _2); -// _0 = ((*_2).0: i32); -// EndRegion('21_0rs); -// StorageDead(_2); -// drop(_1) -> [return: bb2, unwind: bb1]; -// } -// bb1: { -// resume; -// } -// bb2: { -// return; -// } -// } -// END rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_8.rs b/src/test/mir-opt/end_region_8.rs deleted file mode 100644 index 9f2a9c3b72e..00000000000 --- a/src/test/mir-opt/end_region_8.rs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z span_free_formats -Z emit-end-regions -// ignore-tidy-linelength - -// Unwinding should EndRegion for in-scope borrows: Move of borrow into closure. - -fn main() { - let d = D(0); - let r = &d; - foo(move || -> i32 { r.0 }); -} - -struct D(i32); -impl Drop for D { fn drop(&mut self) { println!("dropping D({})", self.0); } } - -fn foo(f: F) where F: FnOnce() -> i32 { - if f() > 0 { panic!("im positive"); } -} - -// END RUST SOURCE -// START rustc.main.SimplifyCfg-qualify-consts.after.mir -// fn main() -> () { -// let mut _0: (); -// ... -// let _2: &'26_1rs D; -// ... -// let _1: D; -// ... -// let mut _3: (); -// let mut _4: [closure@NodeId(33) r:&'24s D]; -// bb0: { -// StorageLive(_1); -// _1 = D(const 0i32,); -// FakeRead(ForLet, _1); -// StorageLive(_2); -// _2 = &'26_1rs _1; -// FakeRead(ForLet, _2); -// StorageLive(_4); -// _4 = [closure@NodeId(33)] { r: _2 }; -// _3 = const foo(move _4) -> [return: bb2, unwind: bb3]; -// } -// bb1: { -// resume; -// } -// bb2: { -// EndRegion('24s); -// StorageDead(_4); -// _0 = (); -// EndRegion('26_1rs); -// StorageDead(_2); -// drop(_1) -> [return: bb4, unwind: bb1]; -// } -// bb3: { -// EndRegion('24s); -// EndRegion('26_1rs); -// drop(_1) -> bb1; -// } -// bb4: { -// StorageDead(_1); -// return; -// } -// } -// END rustc.main.SimplifyCfg-qualify-consts.after.mir - -// START rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir -// fn main::{{closure}}(_1: [closure@NodeId(33) r:&'24s D]) -> i32 { -// let mut _0: i32; -// -// bb0: { -// _0 = ((*(_1.0: &'26_1rs D)).0: i32); -// return; -// } -// } -// END rustc.main-{{closure}}.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_9.rs b/src/test/mir-opt/end_region_9.rs deleted file mode 100644 index ef2d949d307..00000000000 --- a/src/test/mir-opt/end_region_9.rs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z span_free_formats -Z emit-end-regions -// ignore-tidy-linelength - -// This test models a scenario that arielb1 found during review. -// Namely, any filtering of EndRegions must ensure to continue to emit -// any necessary EndRegions that occur earlier in the source than the -// first borrow involving that region. -// -// It is tricky to actually construct examples of this, which is the -// main reason that I am keeping this test even though I have now -// removed the pre-filter that motivated the test in the first place. - -fn main() { - let mut second_iter = false; - let x = 3; - 'a: loop { - let mut y; - loop { - if second_iter { - break 'a; // want to generate `EndRegion('a)` here - } else { - y = &/*'a*/ x; - } - second_iter = true; - } - } -} - -// END RUST SOURCE -// START rustc.main.SimplifyCfg-qualify-consts.after.mir -// fn main() -> () { -// let mut _0: (); -// ... -// let mut _4: &'37_0rs i32; -// ... -// let _2: i32; -// ... -// let mut _1: bool; -// ... -// let mut _3: (); -// let mut _5: !; -// let mut _6: (); -// let mut _7: bool; -// let mut _8: !; -// bb0: { -// StorageLive(_1); -// _1 = const false; -// FakeRead(ForLet, _1); -// StorageLive(_2); -// _2 = const 3i32; -// FakeRead(ForLet, _2); -// falseUnwind -> [real: bb2, cleanup: bb1]; -// } -// bb1: { -// ... -// } -// bb2: { -// StorageLive(_4); -// goto -> bb3; -// } -// bb3: { -// falseUnwind -> [real: bb4, cleanup: bb1]; -// } -// bb4: { -// StorageLive(_7); -// _7 = _1; -// switchInt(move _7) -> [false: bb6, otherwise: bb5]; -// } -// bb5: { -// _0 = (); -// StorageDead(_7); -// EndRegion('37_0rs); -// StorageDead(_4); -// StorageDead(_2); -// StorageDead(_1); -// return; -// } -// bb6: { -// _4 = &'37_0rs _2; -// _6 = (); -// StorageDead(_7); -// _1 = const true; -// _3 = (); -// goto -> bb3; -// } -// } -// END rustc.main.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_cyclic.rs b/src/test/mir-opt/end_region_cyclic.rs deleted file mode 100644 index 3dbc73caf65..00000000000 --- a/src/test/mir-opt/end_region_cyclic.rs +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z span_free_formats -Z emit-end-regions -// ignore-tidy-linelength - -// This test models a scenario with a cyclic reference. Rust obviously -// needs to handle such cases. -// -// The interesting part about this test is that such case shows that -// one cannot generally force all references to be dead before you hit -// their EndRegion; at least, not without breaking the more important -// property that all borrowed storage locations have their regions -// ended strictly before their StorageDeads. (This test was inspired -// by discussion on Issue #43481.) - -use std::cell::Cell; - -struct S<'a> { - r: Cell>>, -} - -fn main() { - loop { - let x = S { r: Cell::new(None) }; - x.r.set(Some(&x)); - if query() { break; } - x.r.set(Some(&x)); - } -} - -fn query() -> bool { true } - -// END RUST SOURCE -// START rustc.main.SimplifyCfg-qualify-consts.after.mir -// fn main() -> (){ -// let mut _0: (); -// scope 1 { -// } -// scope 2 { -// let _2: S<'49_0rs>; -// } -// let mut _1: (); -// let mut _3: std::cell::Cell>>; -// let mut _4: std::option::Option<&'49_0rs S<'49_0rs>>; -// let mut _5: (); -// let mut _6: &'25s std::cell::Cell>>; -// let mut _7: std::option::Option<&'49_0rs S<'49_0rs>>; -// let mut _8: &'49_0rs S<'49_0rs>; -// let mut _9: &'49_0rs S<'49_0rs>; -// let mut _10: (); -// let mut _11: bool; -// let mut _12: !; -// let mut _13: (); -// let mut _14: &'47s std::cell::Cell>>; -// let mut _15: std::option::Option<&'49_0rs S<'49_0rs>>; -// let mut _16: &'49_0rs S<'49_0rs>; -// let mut _17: &'49_0rs S<'49_0rs>; -// bb0: { -// goto -> bb1; -// } -// bb1: { -// falseUnwind -> [real: bb2, cleanup: bb3]; -// } -// bb2: { -// StorageLive(_2); -// StorageLive(_3); -// StorageLive(_4); -// _4 = std::option::Option<&'49_0rs S<'49_0rs>>::None; -// _3 = const >::new(move _4) -> [return: bb4, unwind: bb3]; -// } -// bb3: { -// resume; -// } -// bb4: { -// StorageDead(_4); -// _2 = S<'49_0rs> { r: move _3 }; -// StorageDead(_3); -// FakeRead(ForLet, _2); -// StorageLive(_6); -// _6 = &'25s (_2.0: std::cell::Cell>>); -// StorageLive(_7); -// StorageLive(_8); -// StorageLive(_9); -// _9 = &'49_0rs _2; -// _8 = &'49_0rs (*_9); -// _7 = std::option::Option<&'49_0rs S<'49_0rs>>::Some(move _8,); -// StorageDead(_8); -// _5 = const >::set(move _6, move _7) -> [return: bb5, unwind: bb3]; -// } -// bb5: { -// EndRegion('25s); -// StorageDead(_7); -// StorageDead(_6); -// StorageDead(_9); -// StorageLive(_11); -// _11 = const query() -> [return: bb6, unwind: bb3]; -// } -// bb6: { -// switchInt(move _11) -> [false: bb8, otherwise: bb7]; -// } -// bb7: { -// _0 = (); -// StorageDead(_11); -// EndRegion('49_0rs); -// StorageDead(_2); -// return; -// } -// bb8: { -// _10 = (); -// StorageDead(_11); -// StorageLive(_14); -// _14 = &'47s (_2.0: std::cell::Cell>>); -// StorageLive(_15); -// StorageLive(_16); -// StorageLive(_17); -// _17 = &'49_0rs _2; -// _16 = &'49_0rs (*_17); -// _15 = std::option::Option<&'49_0rs S<'49_0rs>>::Some(move _16,); -// StorageDead(_16); -// _13 = const >::set(move _14, move _15) -> [return: bb9, unwind: bb3]; -// } -// bb9: { -// EndRegion('47s); -// StorageDead(_15); -// StorageDead(_14); -// StorageDead(_17); -// _1 = (); -// EndRegion('49_0rs); -// StorageDead(_2); -// goto -> bb1; -// } -// } -// END rustc.main.SimplifyCfg-qualify-consts.after.mir diff --git a/src/test/mir-opt/end_region_destruction_extents_1.rs b/src/test/mir-opt/end_region_destruction_extents_1.rs deleted file mode 100644 index eb381dfc552..00000000000 --- a/src/test/mir-opt/end_region_destruction_extents_1.rs +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z span_free_formats -Z emit-end-regions -// ignore-tidy-linelength - -// A scenario with significant destruction code extents (which have -// suffix "dce" in current `-Z identify_regions` rendering). - -#![feature(dropck_eyepatch)] - -fn main() { - // Since the second param to `D1` is may_dangle, it is legal for - // the region of that parameter to end before the drop code for D1 - // is executed. - (D1(&S1("ex1"), &S1("dang1"))).0; -} - -#[derive(Debug)] -struct S1(&'static str); - -#[derive(Debug)] -struct D1<'a, 'b>(&'a S1, &'b S1); - -// The `#[may_dangle]` means that references of type `&'b _` may be -// invalid during the execution of this destructor; i.e. in this case -// the destructor code is not allowed to read or write `*self.1`, while -// it can read/write `*self.0`. -unsafe impl<'a, #[may_dangle] 'b> Drop for D1<'a, 'b> { - fn drop(&mut self) { - println!("D1({:?}, _)", self.0); - } -} - -// Notes on the MIR output below: -// -// 1. The `EndRegion('13s)` is allowed to precede the `drop(_3)` -// solely because of the #[may_dangle] mentioned above. -// -// 2. Regarding the occurrence of `EndRegion('15ds)` *after* `StorageDead(_6)` -// (where we have borrows `&'15ds _6`): Eventually: -// -// i. this code should be rejected (by mir-borrowck), or -// -// ii. the MIR code generation should be changed so that the -// EndRegion('15ds)` precedes `StorageDead(_6)` in the -// control-flow. (Note: arielb1 views drop+storagedead as one -// unit, and does not see this option as a useful avenue to -// explore.), or -// -// iii. the presence of EndRegion should be made irrelevant by a -// transformation encoding the effects of rvalue-promotion. -// This may be the simplest and most-likely option; note in -// particular that `StorageDead(_6)` goes away below in -// rustc.main.QualifyAndPromoteConstants.after.mir - -// END RUST SOURCE - -// START rustc.main.QualifyAndPromoteConstants.before.mir -// fn main() -> () { -// let mut _0: (); -// let mut _1: &'15ds S1; -// let mut _2: D1<'15ds, '13s>; -// let mut _3: &'15ds S1; -// let mut _4: &'15ds S1; -// let _5: S1; -// let mut _6: &'13s S1; -// let mut _7: &'13s S1; -// let _8: S1; -// bb0: { -// StorageLive(_2); -// StorageLive(_3); -// StorageLive(_4); -// StorageLive(_5); -// _5 = S1(const "ex1",); -// _4 = &'15ds _5; -// _3 = &'15ds (*_4); -// StorageLive(_6); -// StorageLive(_7); -// StorageLive(_8); -// _8 = S1(const "dang1",); -// _7 = &'13s _8; -// _6 = &'13s (*_7); -// _2 = D1<'15ds, '13s>(move _3, move _6); -// EndRegion('13s); -// StorageDead(_6); -// StorageDead(_3); -// _1 = (_2.0: &'15ds S1); -// drop(_2) -> [return: bb2, unwind: bb1]; -// } -// bb1: { -// resume; -// } -// bb2: { -// StorageDead(_2); -// StorageDead(_7); -// StorageDead(_8); -// StorageDead(_4); -// StorageDead(_5); -// EndRegion('15ds); -// _0 = (); -// return; -// } -// } -// END rustc.main.QualifyAndPromoteConstants.before.mir - -// START rustc.main.QualifyAndPromoteConstants.after.mir -// fn main() -> (){ -// let mut _0: (); -// let mut _1: &'15ds S1; -// let mut _2: D1<'15ds, '13s>; -// let mut _3: &'15ds S1; -// let mut _4: &'15ds S1; -// let _5: S1; -// let mut _6: &'13s S1; -// let mut _7: &'13s S1; -// let _8: S1; -// bb0: { -// StorageLive(_2); -// StorageLive(_3); -// StorageLive(_4); -// _4 = &'15ds (promoted[1]: S1); -// _3 = &'15ds (*_4); -// StorageLive(_6); -// StorageLive(_7); -// _7 = &'13s (promoted[0]: S1); -// _6 = &'13s (*_7); -// _2 = D1<'15ds, '13s>(move _3, move _6); -// EndRegion('13s); -// StorageDead(_6); -// StorageDead(_3); -// _1 = (_2.0: &'15ds S1); -// drop(_2) -> [return: bb2, unwind: bb1]; -// } -// bb1: { -// resume; -// } -// bb2: { -// StorageDead(_2); -// StorageDead(_7); -// StorageDead(_4); -// EndRegion('15ds); -// _0 = (); -// return; -// } -// } -// END rustc.main.QualifyAndPromoteConstants.after.mir diff --git a/src/test/mir-opt/inline-any-operand.rs b/src/test/mir-opt/inline-any-operand.rs index f0c0c8dd382..037e874fff9 100644 --- a/src/test/mir-opt/inline-any-operand.rs +++ b/src/test/mir-opt/inline-any-operand.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z span_free_formats // Tests that MIR inliner works for any operand diff --git a/src/test/mir-opt/inline-closure-borrows-arg.rs b/src/test/mir-opt/inline-closure-borrows-arg.rs index a8e30669f6d..61bfc967b19 100644 --- a/src/test/mir-opt/inline-closure-borrows-arg.rs +++ b/src/test/mir-opt/inline-closure-borrows-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z span_free_formats // ignore-test FIXME swt_ignore diff --git a/src/test/mir-opt/inline-closure.rs b/src/test/mir-opt/inline-closure.rs index 127755981ee..793a91a5aba 100644 --- a/src/test/mir-opt/inline-closure.rs +++ b/src/test/mir-opt/inline-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z span_free_formats // ignore-test FIXME swt_ignore diff --git a/src/test/mir-opt/inline-retag.rs b/src/test/mir-opt/inline-retag.rs index 1e5e1ad5ed1..e91a5c22351 100644 --- a/src/test/mir-opt/inline-retag.rs +++ b/src/test/mir-opt/inline-retag.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z span_free_formats -Z mir-emit-retag // Tests that MIR inliner fixes up `Retag`'s `fn_entry` flag diff --git a/src/test/mir-opt/issue-38669.rs b/src/test/mir-opt/issue-38669.rs index 78820d7a6f5..618ee2f7407 100644 --- a/src/test/mir-opt/issue-38669.rs +++ b/src/test/mir-opt/issue-38669.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that we don't StorageDead booleans before they are used fn main() { diff --git a/src/test/mir-opt/issue-41110.rs b/src/test/mir-opt/issue-41110.rs index e43b4052e07..31ad1ebd9ff 100644 --- a/src/test/mir-opt/issue-41110.rs +++ b/src/test/mir-opt/issue-41110.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare compiled with panic=abort by default // check that we don't emit multiple drop flags when they are not needed. diff --git a/src/test/mir-opt/issue-41697.rs b/src/test/mir-opt/issue-41697.rs index 4d2ba5e2b12..9db25b15f68 100644 --- a/src/test/mir-opt/issue-41697.rs +++ b/src/test/mir-opt/issue-41697.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #41697. Using dump-mir was triggering // artificial cycles: during type-checking, we had to get the MIR for // the constant expressions in `[u8; 2]`, which in turn would trigger diff --git a/src/test/mir-opt/issue-41888.rs b/src/test/mir-opt/issue-41888.rs index ea4d7d3165d..58f321d6df1 100644 --- a/src/test/mir-opt/issue-41888.rs +++ b/src/test/mir-opt/issue-41888.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that we clear the "ADT master drop flag" even when there are // no fields to be dropped. diff --git a/src/test/mir-opt/issue-43457.rs b/src/test/mir-opt/issue-43457.rs deleted file mode 100644 index 85cecc5070c..00000000000 --- a/src/test/mir-opt/issue-43457.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z span_free_formats -Z emit-end-regions -// ignore-tidy-linelength - -// Regression test for #43457: an `EndRegion` was missing from output -// because compiler was using a faulty means for region map lookup. - -use std::cell::RefCell; - -fn rc_refcell_test(r: RefCell) { - r.borrow_mut(); -} - -fn main() { } - -// END RUST SOURCE -// START rustc.rc_refcell_test.SimplifyCfg-qualify-consts.after.mir -// -// fn rc_refcell_test(_1: std::cell::RefCell) -> () { -// let mut _0: (); -// scope 1 { -// let _2: std::cell::RefCell; -// } -// let mut _3: std::cell::RefMut<'17ds, i32>; -// let mut _4: &'17ds std::cell::RefCell; -// -// bb0: { -// StorageLive(_2); -// _2 = _1; -// StorageLive(_4); -// _4 = &'17ds _2; -// _3 = const >::borrow_mut(_4) -> bb1; -// } -// -// bb1: { -// drop(_3) -> bb2; -// } -// -// bb2: { -// StorageDead(_4); -// EndRegion('17ds); -// _0 = (); -// StorageDead(_2); -// return; -// } -// } diff --git a/src/test/mir-opt/issue-49232.rs b/src/test/mir-opt/issue-49232.rs index f9024b67063..8417c2cfd13 100644 --- a/src/test/mir-opt/issue-49232.rs +++ b/src/test/mir-opt/issue-49232.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We must mark a variable whose initialization fails due to an // abort statement as StorageDead. @@ -44,7 +34,7 @@ fn main() { // falseUnwind -> [real: bb3, cleanup: bb4]; // } // bb2: { -// goto -> bb29; +// goto -> bb20; // } // bb3: { // StorageLive(_2); @@ -90,58 +80,31 @@ fn main() { // StorageDead(_3); // StorageLive(_6); // _6 = &_2; -// _5 = const std::mem::drop(move _6) -> [return: bb28, unwind: bb4]; +// _5 = const std::mem::drop(move _6) -> [return: bb19, unwind: bb4]; // } // bb15: { +// StorageDead(_3); // goto -> bb16; // } // bb16: { -// goto -> bb17; -// } -// bb17: { -// goto -> bb18; -// } -// bb18: { -// goto -> bb19; -// } -// bb19: { -// goto -> bb20; -// } -// bb20: { -// StorageDead(_3); -// goto -> bb21; -// } -// bb21: { -// goto -> bb22; -// } -// bb22: { // StorageDead(_2); -// goto -> bb23; -// } -// bb23: { -// goto -> bb24; -// } -// bb24: { -// goto -> bb25; -// } -// bb25: { // goto -> bb2; // } -// bb26: { +// bb17: { // _4 = (); // unreachable; // } -// bb27: { +// bb18: { // StorageDead(_4); // goto -> bb14; // } -// bb28: { +// bb19: { // StorageDead(_6); // _1 = (); // StorageDead(_2); // goto -> bb1; // } -// bb29: { +// bb20: { // return; // } // } diff --git a/src/test/mir-opt/loop_test.rs b/src/test/mir-opt/loop_test.rs index 2e526a221cc..e44743aa4b7 100644 --- a/src/test/mir-opt/loop_test.rs +++ b/src/test/mir-opt/loop_test.rs @@ -1,14 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z identify_regions -Z emit-end-regions +// compile-flags: -Z identify_regions // Tests to make sure we correctly generate falseUnwind edges in loops diff --git a/src/test/mir-opt/lower_128bit_debug_test.rs b/src/test/mir-opt/lower_128bit_debug_test.rs index a51498797e4..1d23bac4ee2 100644 --- a/src/test/mir-opt/lower_128bit_debug_test.rs +++ b/src/test/mir-opt/lower_128bit_debug_test.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // asmjs can't even pass i128 as arguments or return values, so ignore it. // this will hopefully be fixed by the LLVM 5 upgrade (#43370) // ignore-asmjs diff --git a/src/test/mir-opt/lower_128bit_test.rs b/src/test/mir-opt/lower_128bit_test.rs index f64981525b8..7528330b030 100644 --- a/src/test/mir-opt/lower_128bit_test.rs +++ b/src/test/mir-opt/lower_128bit_test.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-flags: -Z lower_128bit_ops=yes -C debug_assertions=no -O diff --git a/src/test/mir-opt/match_false_edges.rs b/src/test/mir-opt/match_false_edges.rs index 9ccf0371399..b512172de64 100644 --- a/src/test/mir-opt/match_false_edges.rs +++ b/src/test/mir-opt/match_false_edges.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z borrowck=mir fn guard() -> bool { diff --git a/src/test/mir-opt/match_test.rs b/src/test/mir-opt/match_test.rs new file mode 100644 index 00000000000..9bfb728e134 --- /dev/null +++ b/src/test/mir-opt/match_test.rs @@ -0,0 +1,85 @@ +// Make sure redundant testing paths in `match` expressions are sorted out. + +#![feature(exclusive_range_pattern)] + +fn main() { + let x = 3; + let b = true; + + // When `(0..=10).contains(x) && !b`, we should jump to the last arm + // without testing two other candidates. + match x { + 0..10 if b => 0, + 10..=20 => 1, + -1 => 2, + _ => 3, + }; +} + +// END RUST SOURCE +// START rustc.main.SimplifyCfg-initial.after.mir +// bb0: { +// ... +// _4 = Le(const 0i32, _1); +// switchInt(move _4) -> [false: bb10, otherwise: bb11]; +// } +// bb1: { +// _3 = const 0i32; +// goto -> bb16; +// } +// bb2: { +// _3 = const 1i32; +// goto -> bb16; +// } +// bb3: { +// _3 = const 2i32; +// goto -> bb16; +// } +// bb4: { +// _3 = const 3i32; +// goto -> bb16; +// } +// bb5: { +// falseEdges -> [real: bb12, imaginary: bb6]; +// } +// bb6: { +// falseEdges -> [real: bb2, imaginary: bb7]; +// } +// bb7: { +// falseEdges -> [real: bb3, imaginary: bb8]; +// } +// bb8: { +// falseEdges -> [real: bb4, imaginary: bb9]; +// } +// bb9: { +// unreachable; +// } +// bb10: { +// _7 = Le(const 10i32, _1); +// switchInt(move _7) -> [false: bb14, otherwise: bb15]; +// } +// bb11: { +// _5 = Lt(_1, const 10i32); +// switchInt(move _5) -> [false: bb10, otherwise: bb5]; +// } +// bb12: { +// StorageLive(_6); +// _6 = _2; +// switchInt(move _6) -> [false: bb13, otherwise: bb1]; +// } +// bb13: { +// falseEdges -> [real: bb8, imaginary: bb6]; +// } +// bb14: { +// switchInt(_1) -> [-1i32: bb7, otherwise: bb8]; +// } +// bb15: { +// _8 = Le(_1, const 20i32); +// switchInt(move _8) -> [false: bb14, otherwise: bb6]; +// } +// bb16: { +// StorageDead(_6); +// ... +// return; +// } +// END rustc.main.SimplifyCfg-initial.after.mir diff --git a/src/test/mir-opt/nll/named-lifetimes-basic.rs b/src/test/mir-opt/nll/named-lifetimes-basic.rs index c7fa7973a2d..4833ba19554 100644 --- a/src/test/mir-opt/nll/named-lifetimes-basic.rs +++ b/src/test/mir-opt/nll/named-lifetimes-basic.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for named lifetime translation. Check that we // instantiate the types that appear in function arguments with // suitable variables and that we setup the outlives relationship diff --git a/src/test/mir-opt/nll/region-subtyping-basic.rs b/src/test/mir-opt/nll/region-subtyping-basic.rs index 2b926422b00..c2dda680b73 100644 --- a/src/test/mir-opt/nll/region-subtyping-basic.rs +++ b/src/test/mir-opt/nll/region-subtyping-basic.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for liveness constraints: the region (`R1`) that appears // in the type of `p` includes the points after `&v[0]` up to (but not // including) the call to `use_x`. The `else` branch is not included. diff --git a/src/test/mir-opt/packed-struct-drop-aligned.rs b/src/test/mir-opt/packed-struct-drop-aligned.rs index 1fe29a29e23..01402f26156 100644 --- a/src/test/mir-opt/packed-struct-drop-aligned.rs +++ b/src/test/mir-opt/packed-struct-drop-aligned.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare compiled with panic=abort by default fn main() { diff --git a/src/test/mir-opt/retag.rs b/src/test/mir-opt/retag.rs index 7da55c0868c..bb794409ae0 100644 --- a/src/test/mir-opt/retag.rs +++ b/src/test/mir-opt/retag.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags: -Z mir-emit-retag -Z mir-opt-level=0 -Z span_free_formats @@ -85,18 +75,18 @@ fn main() { // _10 = move _8; // Retag(_10); // ... -// _14 = &mut (*_10); -// Retag(_14); -// EscapeToRaw(move _14); -// _13 = move _14 as *mut i32 (Misc); +// _15 = &mut (*_10); +// Retag(_15); +// _14 = move _15 as *mut i32 (Misc); +// Retag([raw] _14); // ... -// _17 = move _18(move _19) -> bb2; +// _18 = move _19(move _20) -> bb2; // } // // bb2: { -// Retag(_17); +// Retag(_18); // ... -// _21 = const Test::foo_shr(move _22, move _24) -> bb3; +// _22 = const Test::foo_shr(move _23, move _25) -> bb3; // } // // bb3: { diff --git a/src/test/mir-opt/return_an_array.rs b/src/test/mir-opt/return_an_array.rs index bfae5b94389..bea3c317c89 100644 --- a/src/test/mir-opt/return_an_array.rs +++ b/src/test/mir-opt/return_an_array.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // this tests move up progration, which is not yet implemented fn foo() -> [u8; 1024] { diff --git a/src/test/mir-opt/simplify_cfg.rs b/src/test/mir-opt/simplify_cfg.rs new file mode 100644 index 00000000000..ef843f71581 --- /dev/null +++ b/src/test/mir-opt/simplify_cfg.rs @@ -0,0 +1,54 @@ +// Test that the goto chain starting from bb0 is collapsed. + +fn main() { + loop { + if bar() { + break; + } + } +} + +#[inline(never)] +fn bar() -> bool { + true +} + +// END RUST SOURCE +// START rustc.main.SimplifyCfg-initial.before.mir +// bb0: { +// goto -> bb1; +// } +// bb1: { +// falseUnwind -> [real: bb3, cleanup: bb4]; +// } +// ... +// bb11: { +// ... +// goto -> bb1; +// } +// END rustc.main.SimplifyCfg-initial.before.mir +// START rustc.main.SimplifyCfg-initial.after.mir +// bb0: { +// falseUnwind -> [real: bb1, cleanup: bb2]; +// } +// ... +// bb5: { +// ... +// goto -> bb0; +// } +// END rustc.main.SimplifyCfg-initial.after.mir +// START rustc.main.SimplifyCfg-early-opt.before.mir +// bb0: { +// goto -> bb1; +// } +// bb1: { +// StorageLive(_2); +// _2 = const bar() -> bb3; +// } +// END rustc.main.SimplifyCfg-early-opt.before.mir +// START rustc.main.SimplifyCfg-early-opt.after.mir +// bb0: { +// StorageLive(_2); +// _2 = const bar() -> bb1; +// } +// END rustc.main.SimplifyCfg-early-opt.after.mir diff --git a/src/test/mir-opt/simplify_if.rs b/src/test/mir-opt/simplify_if.rs index 52d5892e656..f6e6c6baf7a 100644 --- a/src/test/mir-opt/simplify_if.rs +++ b/src/test/mir-opt/simplify_if.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { if false { println!("hello world!"); diff --git a/src/test/mir-opt/storage_live_dead_in_statics.rs b/src/test/mir-opt/storage_live_dead_in_statics.rs index e39b7df8a7a..e8ef1d9d3c3 100644 --- a/src/test/mir-opt/storage_live_dead_in_statics.rs +++ b/src/test/mir-opt/storage_live_dead_in_statics.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that when we compile the static `XXX` into MIR, we do not // generate `StorageStart` or `StorageEnd` statements. diff --git a/src/test/mir-opt/storage_ranges.rs b/src/test/mir-opt/storage_ranges.rs index 203814ce949..a5d6ced2b17 100644 --- a/src/test/mir-opt/storage_ranges.rs +++ b/src/test/mir-opt/storage_ranges.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength fn main() { diff --git a/src/test/mir-opt/uniform_array_move_out.rs b/src/test/mir-opt/uniform_array_move_out.rs index fa5f62f89f6..fac5ef3b03c 100644 --- a/src/test/mir-opt/uniform_array_move_out.rs +++ b/src/test/mir-opt/uniform_array_move_out.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] #![feature(slice_patterns)] diff --git a/src/test/mir-opt/uninhabited-enum.rs b/src/test/mir-opt/uninhabited-enum.rs new file mode 100644 index 00000000000..904a9c43c1b --- /dev/null +++ b/src/test/mir-opt/uninhabited-enum.rs @@ -0,0 +1,37 @@ +#![feature(never_type)] + +pub enum Void {} + +#[no_mangle] +pub fn process_never(input: *const !) { + let _input = unsafe { &*input }; +} + +#[no_mangle] +pub fn process_void(input: *const Void) { + let _input = unsafe { &*input }; + // In the future, this should end with `unreachable`, but we currently only do + // unreachability analysis for `!`. +} + +fn main() {} + +// END RUST SOURCE +// +// START rustc.process_never.SimplifyLocals.after.mir +// bb0: { +// StorageLive(_2); +// _2 = &(*_1); +// StorageDead(_2); +// unreachable; +// } +// END rustc.process_never.SimplifyLocals.after.mir +// +// START rustc.process_void.SimplifyLocals.after.mir +// bb0: { +// StorageLive(_2); +// _2 = &(*_1); +// StorageDead(_2); +// return; +// } +// END rustc.process_void.SimplifyLocals.after.mir diff --git a/src/test/pretty/asm-clobbers.rs b/src/test/pretty/asm-clobbers.rs index c72add8d3d6..1bc9f008bbb 100644 --- a/src/test/pretty/asm-clobbers.rs +++ b/src/test/pretty/asm-clobbers.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(asm)] pub fn main() { unsafe { asm!("" : : : "hello", "world") }; } diff --git a/src/test/pretty/asm-options.rs b/src/test/pretty/asm-options.rs index bc9f89a3d15..5c2bbd9edd9 100644 --- a/src/test/pretty/asm-options.rs +++ b/src/test/pretty/asm-options.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(asm)] // pp-exact diff --git a/src/test/pretty/attr-derive.rs b/src/test/pretty/attr-derive.rs index a1c581a1868..4ce6d2fbf17 100644 --- a/src/test/pretty/attr-derive.rs +++ b/src/test/pretty/attr-derive.rs @@ -1,15 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:derive-foo.rs -// ignore-stage1 // pp-exact // Testing that both the inner item and next outer item are // preserved, and that the first outer item parsed in main is not diff --git a/src/test/pretty/attr-fn-inner.rs b/src/test/pretty/attr-fn-inner.rs index 79964d2a7ba..f13339e334c 100644 --- a/src/test/pretty/attr-fn-inner.rs +++ b/src/test/pretty/attr-fn-inner.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact // Testing that both the inner item and next outer item are // preserved, and that the first outer item parsed in main is not diff --git a/src/test/pretty/attr-literals.rs b/src/test/pretty/attr-literals.rs index 73aa3169963..355f3d5a3cf 100644 --- a/src/test/pretty/attr-literals.rs +++ b/src/test/pretty/attr-literals.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact // Tests literals in attributes. diff --git a/src/test/pretty/auto-trait.rs b/src/test/pretty/auto-trait.rs index 842af49e8a7..2eb4d3390be 100644 --- a/src/test/pretty/auto-trait.rs +++ b/src/test/pretty/auto-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] // pp-exact diff --git a/src/test/pretty/auxiliary/derive-foo.rs b/src/test/pretty/auxiliary/derive-foo.rs index bd81d3e5a3b..675a93b3dad 100644 --- a/src/test/pretty/auxiliary/derive-foo.rs +++ b/src/test/pretty/auxiliary/derive-foo.rs @@ -1,13 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +// force-host // no-prefer-dynamic #![crate_type = "proc-macro"] diff --git a/src/test/pretty/blank-lines.rs b/src/test/pretty/blank-lines.rs index e78f8f5fc9f..b9153d0482c 100644 --- a/src/test/pretty/blank-lines.rs +++ b/src/test/pretty/blank-lines.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type=lib // pp-exact diff --git a/src/test/pretty/block-comment-multiple-asterisks.rs b/src/test/pretty/block-comment-multiple-asterisks.rs index fbdafef29d8..bb090b74636 100644 --- a/src/test/pretty/block-comment-multiple-asterisks.rs +++ b/src/test/pretty/block-comment-multiple-asterisks.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type=lib // pp-exact diff --git a/src/test/pretty/block-comment-trailing-whitespace.rs b/src/test/pretty/block-comment-trailing-whitespace.rs index 50f1b035bb2..4d502f603d1 100644 --- a/src/test/pretty/block-comment-trailing-whitespace.rs +++ b/src/test/pretty/block-comment-trailing-whitespace.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type=lib // pp-exact diff --git a/src/test/pretty/block-comment-trailing-whitespace2.rs b/src/test/pretty/block-comment-trailing-whitespace2.rs index 99c6ca43294..b7c42e39557 100644 --- a/src/test/pretty/block-comment-trailing-whitespace2.rs +++ b/src/test/pretty/block-comment-trailing-whitespace2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type=lib // pp-exact diff --git a/src/test/pretty/block-comment-wchar.pp b/src/test/pretty/block-comment-wchar.pp index 2dc7e8f9525..f15d7cdc44c 100644 --- a/src/test/pretty/block-comment-wchar.pp +++ b/src/test/pretty/block-comment-wchar.pp @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is meant as a test case for Issue 3961. // // Test via: rustc --pretty normal src/test/pretty/block-comment-wchar.rs diff --git a/src/test/pretty/block-comment-wchar.rs b/src/test/pretty/block-comment-wchar.rs index 6f4a95e7c9b..93373c5da65 100644 --- a/src/test/pretty/block-comment-wchar.rs +++ b/src/test/pretty/block-comment-wchar.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is meant as a test case for Issue 3961. // // Test via: rustc --pretty normal src/test/pretty/block-comment-wchar.rs diff --git a/src/test/pretty/block-disambig.rs b/src/test/pretty/block-disambig.rs index c645a66b70e..ac9b84a5d7e 100644 --- a/src/test/pretty/block-disambig.rs +++ b/src/test/pretty/block-disambig.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type=lib // A bunch of tests for syntactic forms involving blocks that were -// previously ambiguous (e.g. 'if true { } *val;' gets parsed as a +// previously ambiguous (e.g., 'if true { } *val;' gets parsed as a // binop) diff --git a/src/test/pretty/cast-lt.pp b/src/test/pretty/cast-lt.pp index b8d920754ad..351889da245 100644 --- a/src/test/pretty/cast-lt.pp +++ b/src/test/pretty/cast-lt.pp @@ -4,16 +4,6 @@ use ::std::prelude::v1::*; #[macro_use] extern crate std; -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-compare-only // pretty-mode:expanded // pp-exact:cast-lt.pp diff --git a/src/test/pretty/cast-lt.rs b/src/test/pretty/cast-lt.rs index ca4c364c631..e14bdd1f3b3 100644 --- a/src/test/pretty/cast-lt.rs +++ b/src/test/pretty/cast-lt.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-compare-only // pretty-mode:expanded // pp-exact:cast-lt.pp diff --git a/src/test/pretty/closure-reform-pretty.rs b/src/test/pretty/closure-reform-pretty.rs index a1fdebf6fa1..ef5189fa13e 100644 --- a/src/test/pretty/closure-reform-pretty.rs +++ b/src/test/pretty/closure-reform-pretty.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Any copyright is dedicated to the Public Domain. // http://creativecommons.org/publicdomain/zero/1.0/ diff --git a/src/test/pretty/disamb-stmt-expr.rs b/src/test/pretty/disamb-stmt-expr.rs index 610d9a7782d..601ca7bb6de 100644 --- a/src/test/pretty/disamb-stmt-expr.rs +++ b/src/test/pretty/disamb-stmt-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact // Here we check that the parentheses around the body of `wsucc()` are diff --git a/src/test/pretty/do1.rs b/src/test/pretty/do1.rs index c9501e8166f..7be835cb22f 100644 --- a/src/test/pretty/do1.rs +++ b/src/test/pretty/do1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact fn f(f: F) where F: Fn(isize) { f(10) } diff --git a/src/test/pretty/doc-comments.rs b/src/test/pretty/doc-comments.rs index 62cadd7cc3e..2a98c9fc058 100644 --- a/src/test/pretty/doc-comments.rs +++ b/src/test/pretty/doc-comments.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type=lib // pp-exact diff --git a/src/test/pretty/dollar-crate.pp b/src/test/pretty/dollar-crate.pp new file mode 100644 index 00000000000..3d2d949be2b --- /dev/null +++ b/src/test/pretty/dollar-crate.pp @@ -0,0 +1,18 @@ +#![feature(prelude_import)] +#![no_std] +#[prelude_import] +use ::std::prelude::v1::*; +#[macro_use] +extern crate std; +// pretty-compare-only +// pretty-mode:expanded +// pp-exact:dollar-crate.pp + +fn main() { + { + ::std::io::_print(::std::fmt::Arguments::new_v1(&["rust\n"], + &match () { + () => [], + })); + }; +} diff --git a/src/test/pretty/dollar-crate.rs b/src/test/pretty/dollar-crate.rs new file mode 100644 index 00000000000..e46bc7f4859 --- /dev/null +++ b/src/test/pretty/dollar-crate.rs @@ -0,0 +1,7 @@ +// pretty-compare-only +// pretty-mode:expanded +// pp-exact:dollar-crate.pp + +fn main() { + println!("rust"); +} diff --git a/src/test/pretty/empty-impl.rs b/src/test/pretty/empty-impl.rs index 74445c9432d..d570933592a 100644 --- a/src/test/pretty/empty-impl.rs +++ b/src/test/pretty/empty-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type=lib trait X { fn dummy(&self) { } } diff --git a/src/test/pretty/empty-lines.rs b/src/test/pretty/empty-lines.rs index cc5f5a83a46..15d7625d4e7 100644 --- a/src/test/pretty/empty-lines.rs +++ b/src/test/pretty/empty-lines.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type=lib // Issue #759 diff --git a/src/test/pretty/example1.rs b/src/test/pretty/example1.rs index 394fd64bcc4..4f7d5e7e71e 100644 --- a/src/test/pretty/example1.rs +++ b/src/test/pretty/example1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact fn main() { } diff --git a/src/test/pretty/example2.pp b/src/test/pretty/example2.pp index 94f62d8647e..852b9f316ce 100644 --- a/src/test/pretty/example2.pp +++ b/src/test/pretty/example2.pp @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact:example2.pp fn main() { } diff --git a/src/test/pretty/example2.rs b/src/test/pretty/example2.rs index 94f62d8647e..852b9f316ce 100644 --- a/src/test/pretty/example2.rs +++ b/src/test/pretty/example2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact:example2.pp fn main() { } diff --git a/src/test/pretty/fn-return.rs b/src/test/pretty/fn-return.rs index 8a223296e54..142d852cd6a 100644 --- a/src/test/pretty/fn-return.rs +++ b/src/test/pretty/fn-return.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact // Check that `fn f() -> () { }` does not print as `fn f() { }`. diff --git a/src/test/pretty/fn-types.rs b/src/test/pretty/fn-types.rs index 31efb0c9ab1..842138e28c3 100644 --- a/src/test/pretty/fn-types.rs +++ b/src/test/pretty/fn-types.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact fn from_foreign_fn(_x: fn()) { } diff --git a/src/test/pretty/for-comment.rs b/src/test/pretty/for-comment.rs index 32837fbcf87..447e7f918c2 100644 --- a/src/test/pretty/for-comment.rs +++ b/src/test/pretty/for-comment.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type=lib // pp-exact diff --git a/src/test/pretty/import-renames.rs b/src/test/pretty/import-renames.rs index 311835eba1b..ce6b5058ba6 100644 --- a/src/test/pretty/import-renames.rs +++ b/src/test/pretty/import-renames.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type=lib // pp-exact diff --git a/src/test/pretty/issue-19077.rs b/src/test/pretty/issue-19077.rs index 61274385857..b4279111305 100644 --- a/src/test/pretty/issue-19077.rs +++ b/src/test/pretty/issue-19077.rs @@ -1,12 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // Testing that unsafe blocks in match arms are followed by a comma // pp-exact diff --git a/src/test/pretty/issue-25031.rs b/src/test/pretty/issue-25031.rs index 6c5a847869e..d91494891d4 100644 --- a/src/test/pretty/issue-25031.rs +++ b/src/test/pretty/issue-25031.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // Testing that type items with where clauses output correctly. diff --git a/src/test/pretty/issue-30731.rs b/src/test/pretty/issue-30731.rs index cd72ae98433..ee81cce8641 100644 --- a/src/test/pretty/issue-30731.rs +++ b/src/test/pretty/issue-30731.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // Test pretty printing of macro with braces but without terminating semicolon, // this used to panic before fix. diff --git a/src/test/pretty/issue-31073.pp b/src/test/pretty/issue-31073.pp index 872923f8caf..75795f6d568 100644 --- a/src/test/pretty/issue-31073.pp +++ b/src/test/pretty/issue-31073.pp @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact:issue-31073.pp fn main() { diff --git a/src/test/pretty/issue-31073.rs b/src/test/pretty/issue-31073.rs index 872923f8caf..75795f6d568 100644 --- a/src/test/pretty/issue-31073.rs +++ b/src/test/pretty/issue-31073.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact:issue-31073.pp fn main() { diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp index 5f42b86c82a..b529beba783 100644 --- a/src/test/pretty/issue-4264.pp +++ b/src/test/pretty/issue-4264.pp @@ -2,16 +2,6 @@ use ::std::prelude::v1::*; #[macro_use] extern crate std; -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-compare-only // pretty-mode:hir,typed // pp-exact:issue-4264.pp @@ -39,8 +29,8 @@ - ((::fmt::format as - for<'r> fn(std::fmt::Arguments<'r>) -> std::string::String {std::fmt::format})(((<::fmt::Arguments>::new_v1 + (($crate::fmt::format as + for<'r> fn(std::fmt::Arguments<'r>) -> std::string::String {std::fmt::format})(((<$crate::fmt::Arguments>::new_v1 as fn(&[&str], &[std::fmt::ArgumentV1<'_>]) -> std::fmt::Arguments<'_> {std::fmt::Arguments<'_>::new_v1})((&([("test" as diff --git a/src/test/pretty/issue-4264.rs b/src/test/pretty/issue-4264.rs index 6d52ad3ff1e..3dea8112981 100644 --- a/src/test/pretty/issue-4264.rs +++ b/src/test/pretty/issue-4264.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-compare-only // pretty-mode:hir,typed // pp-exact:issue-4264.pp diff --git a/src/test/pretty/issue_12590_a.rs b/src/test/pretty/issue_12590_a.rs index 0087c3c4558..1ddd3c04263 100644 --- a/src/test/pretty/issue_12590_a.rs +++ b/src/test/pretty/issue_12590_a.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact // The next line should not be expanded diff --git a/src/test/pretty/issue_12590_b.rs b/src/test/pretty/issue_12590_b.rs index ebb6310b047..f188f7bca69 100644 --- a/src/test/pretty/issue_12590_b.rs +++ b/src/test/pretty/issue_12590_b.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Second part of two file test fn b() { } diff --git a/src/test/pretty/issue_12590_c.pp b/src/test/pretty/issue_12590_c.pp index 7e057406d83..24182835303 100644 --- a/src/test/pretty/issue_12590_c.pp +++ b/src/test/pretty/issue_12590_c.pp @@ -4,16 +4,6 @@ use ::std::prelude::v1::*; #[macro_use] extern crate std; -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-compare-only // pretty-mode:expanded // pp-exact:issue_12590_c.pp diff --git a/src/test/pretty/issue_12590_c.rs b/src/test/pretty/issue_12590_c.rs index e3db870ae4f..c0da36c2100 100644 --- a/src/test/pretty/issue_12590_c.rs +++ b/src/test/pretty/issue_12590_c.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-compare-only // pretty-mode:expanded // pp-exact:issue_12590_c.pp diff --git a/src/test/pretty/let.rs b/src/test/pretty/let.rs index 736ea3a0d10..20ffb757818 100644 --- a/src/test/pretty/let.rs +++ b/src/test/pretty/let.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact // Check that `let x: _ = 0;` does not print as `let x = 0;`. diff --git a/src/test/pretty/lifetime.rs b/src/test/pretty/lifetime.rs index 2cc7153b7f5..bfef51202db 100644 --- a/src/test/pretty/lifetime.rs +++ b/src/test/pretty/lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact fn f1<'a, 'b, 'c>(_x: &'a u32, _y: &'b u32, _z: &'c u32) where 'c: 'a + 'b { } diff --git a/src/test/pretty/match-block-expr.rs b/src/test/pretty/match-block-expr.rs index 7751f155da4..0db6574b073 100644 --- a/src/test/pretty/match-block-expr.rs +++ b/src/test/pretty/match-block-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact fn main() { diff --git a/src/test/pretty/match-naked-expr-medium.rs b/src/test/pretty/match-naked-expr-medium.rs index 39af19dbf6f..a124fdff390 100644 --- a/src/test/pretty/match-naked-expr-medium.rs +++ b/src/test/pretty/match-naked-expr-medium.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact fn main() { diff --git a/src/test/pretty/match-naked-expr.rs b/src/test/pretty/match-naked-expr.rs index 02bbf667d96..7c16bbefe3c 100644 --- a/src/test/pretty/match-naked-expr.rs +++ b/src/test/pretty/match-naked-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact fn main() { diff --git a/src/test/pretty/path-type-bounds.rs b/src/test/pretty/path-type-bounds.rs index ae6a0fc3142..3072e416cbe 100644 --- a/src/test/pretty/path-type-bounds.rs +++ b/src/test/pretty/path-type-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact diff --git a/src/test/pretty/raw-str-nonexpr.rs b/src/test/pretty/raw-str-nonexpr.rs index bce78e4f4c1..cb23124f210 100644 --- a/src/test/pretty/raw-str-nonexpr.rs +++ b/src/test/pretty/raw-str-nonexpr.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact #![feature(asm)] diff --git a/src/test/pretty/stmt_expr_attributes.rs b/src/test/pretty/stmt_expr_attributes.rs index b34e1852079..eb1768683e6 100644 --- a/src/test/pretty/stmt_expr_attributes.rs +++ b/src/test/pretty/stmt_expr_attributes.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact #![feature(custom_attribute)] diff --git a/src/test/pretty/struct-pattern.rs b/src/test/pretty/struct-pattern.rs index b0795bb08f3..6acb2e27f4f 100644 --- a/src/test/pretty/struct-pattern.rs +++ b/src/test/pretty/struct-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact // pretty-compare-only // Testing that shorthand struct patterns are preserved diff --git a/src/test/pretty/struct-tuple.rs b/src/test/pretty/struct-tuple.rs index 82d430b2701..77e064b4fa4 100644 --- a/src/test/pretty/struct-tuple.rs +++ b/src/test/pretty/struct-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact struct Foo; struct Bar(isize, isize); diff --git a/src/test/pretty/tag-blank-lines.rs b/src/test/pretty/tag-blank-lines.rs index 29a3b965251..28ed4fccaf2 100644 --- a/src/test/pretty/tag-blank-lines.rs +++ b/src/test/pretty/tag-blank-lines.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact enum foo { diff --git a/src/test/pretty/top-level-doc-comments.rs b/src/test/pretty/top-level-doc-comments.rs index 59c7f0fe0de..16f95d334cb 100644 --- a/src/test/pretty/top-level-doc-comments.rs +++ b/src/test/pretty/top-level-doc-comments.rs @@ -3,15 +3,8 @@ struct X; // ignore-license -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // pp-exact diff --git a/src/test/pretty/trait-polarity.rs b/src/test/pretty/trait-polarity.rs index 7d3a921301e..3aab99bf6a0 100644 --- a/src/test/pretty/trait-polarity.rs +++ b/src/test/pretty/trait-polarity.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] // pp-exact diff --git a/src/test/pretty/trait-safety.rs b/src/test/pretty/trait-safety.rs index 95dfc751ff5..b2f2d610c31 100644 --- a/src/test/pretty/trait-safety.rs +++ b/src/test/pretty/trait-safety.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact unsafe trait UnsafeTrait { diff --git a/src/test/pretty/unary-op-disambig.rs b/src/test/pretty/unary-op-disambig.rs index 133c567a74a..0c57e0a3371 100644 --- a/src/test/pretty/unary-op-disambig.rs +++ b/src/test/pretty/unary-op-disambig.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type=lib // Preserve semicolons that disambiguate unops diff --git a/src/test/pretty/vec-comments.pp b/src/test/pretty/vec-comments.pp index dc2dae1044d..a150cf0b8ea 100644 --- a/src/test/pretty/vec-comments.pp +++ b/src/test/pretty/vec-comments.pp @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #679 // Testing that comments are correctly interleaved // pp-exact:vec-comments.pp diff --git a/src/test/pretty/vec-comments.rs b/src/test/pretty/vec-comments.rs index dc2dae1044d..a150cf0b8ea 100644 --- a/src/test/pretty/vec-comments.rs +++ b/src/test/pretty/vec-comments.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #679 // Testing that comments are correctly interleaved // pp-exact:vec-comments.pp diff --git a/src/test/pretty/where-clauses.rs b/src/test/pretty/where-clauses.rs index 388064a8be8..3d6e431a11a 100644 --- a/src/test/pretty/where-clauses.rs +++ b/src/test/pretty/where-clauses.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pp-exact fn f<'a, 'b, T>(t: T) -> isize where T: 'a, 'a: 'b, T: Eq { 0 } diff --git a/src/test/run-fail-fulldeps/qquote.rs b/src/test/run-fail-fulldeps/qquote.rs deleted file mode 100644 index d757dd97e94..00000000000 --- a/src/test/run-fail-fulldeps/qquote.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-cross-compile - -// error-pattern:expected expression, found statement (`let`) - -#![feature(quote, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; - -use syntax::ast; -use syntax::source_map; -use syntax::print::pprust; -use syntax::symbol::Symbol; -use syntax_pos::DUMMY_SP; - -fn main() { - syntax::with_globals(|| run()); -} - -fn run() { - let ps = syntax::parse::ParseSess::new(source_map::FilePathMapping::empty()); - let mut resolver = syntax::ext::base::DummyResolver; - let mut cx = syntax::ext::base::ExtCtxt::new( - &ps, - syntax::ext::expand::ExpansionConfig::default("qquote".to_string()), - &mut resolver); - let cx = &mut cx; - - println!("{}", pprust::expr_to_string(&*quote_expr!(&cx, 23))); - assert_eq!(pprust::expr_to_string(&*quote_expr!(&cx, 23)), "23"); - - let expr = quote_expr!(&cx, let x isize = 20;); - println!("{}", pprust::expr_to_string(&*expr)); - assert_eq!(pprust::expr_to_string(&*expr), "let x isize = 20;"); -} diff --git a/src/test/run-fail/adjust_never.rs b/src/test/run-fail/adjust_never.rs index da68dc39f85..8661a2f80a7 100644 --- a/src/test/run-fail/adjust_never.rs +++ b/src/test/run-fail/adjust_never.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a variable of type ! can coerce to another type. // error-pattern:explicit diff --git a/src/test/run-fail/args-panic.rs b/src/test/run-fail/args-panic.rs index 3eca89fbed3..9a62652dde1 100644 --- a/src/test/run-fail/args-panic.rs +++ b/src/test/run-fail/args-panic.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // error-pattern:meep #![feature(box_syntax)] diff --git a/src/test/run-fail/assert-as-macro.rs b/src/test/run-fail/assert-as-macro.rs index c52c11b1b91..f715e21f781 100644 --- a/src/test/run-fail/assert-as-macro.rs +++ b/src/test/run-fail/assert-as-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:assertion failed: 1 == 2 fn main() { diff --git a/src/test/run-fail/assert-eq-macro-panic.rs b/src/test/run-fail/assert-eq-macro-panic.rs index fed2ee0beab..863fec12d74 100644 --- a/src/test/run-fail/assert-eq-macro-panic.rs +++ b/src/test/run-fail/assert-eq-macro-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:assertion failed: `(left == right)` // error-pattern: left: `14` // error-pattern:right: `15` diff --git a/src/test/run-fail/assert-macro-explicit.rs b/src/test/run-fail/assert-macro-explicit.rs index 197ed59c07f..3689323c999 100644 --- a/src/test/run-fail/assert-macro-explicit.rs +++ b/src/test/run-fail/assert-macro-explicit.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panicked at 'assertion failed: false' fn main() { diff --git a/src/test/run-fail/assert-macro-fmt.rs b/src/test/run-fail/assert-macro-fmt.rs index 78239a2217e..9fbfb085c2f 100644 --- a/src/test/run-fail/assert-macro-fmt.rs +++ b/src/test/run-fail/assert-macro-fmt.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panicked at 'test-assert-fmt 42 rust' fn main() { diff --git a/src/test/run-fail/assert-macro-owned.rs b/src/test/run-fail/assert-macro-owned.rs index e68aef10de8..bd58d35eb71 100644 --- a/src/test/run-fail/assert-macro-owned.rs +++ b/src/test/run-fail/assert-macro-owned.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panicked at 'test-assert-owned' fn main() { diff --git a/src/test/run-fail/assert-macro-static.rs b/src/test/run-fail/assert-macro-static.rs index 59be468e0cb..650aaeab4f6 100644 --- a/src/test/run-fail/assert-macro-static.rs +++ b/src/test/run-fail/assert-macro-static.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panicked at 'test-assert-static' fn main() { diff --git a/src/test/run-fail/assert-ne-macro-panic.rs b/src/test/run-fail/assert-ne-macro-panic.rs index d57bb0fb67f..f55ef2b3ff5 100644 --- a/src/test/run-fail/assert-ne-macro-panic.rs +++ b/src/test/run-fail/assert-ne-macro-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:assertion failed: `(left != right)` // error-pattern: left: `14` // error-pattern:right: `14` diff --git a/src/test/run-fail/binop-fail-3.rs b/src/test/run-fail/binop-fail-3.rs index efbc49fbece..a7696fffda0 100644 --- a/src/test/run-fail/binop-fail-3.rs +++ b/src/test/run-fail/binop-fail-3.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:quux fn foo() -> ! { panic!("quux"); diff --git a/src/test/run-fail/binop-panic.rs b/src/test/run-fail/binop-panic.rs index fb2db7ea998..dba5cecc67e 100644 --- a/src/test/run-fail/binop-panic.rs +++ b/src/test/run-fail/binop-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:quux fn my_err(s: String) -> ! { println!("{}", s); diff --git a/src/test/run-fail/borrowck-local-borrow.rs b/src/test/run-fail/borrowck-local-borrow.rs index daee3903d77..cb17a630562 100644 --- a/src/test/run-fail/borrowck-local-borrow.rs +++ b/src/test/run-fail/borrowck-local-borrow.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // error-pattern:panic 1 // revisions: ast mir diff --git a/src/test/run-fail/bounds-check-no-overflow.rs b/src/test/run-fail/bounds-check-no-overflow.rs index 3d1cbb446e8..3943f87f7fe 100644 --- a/src/test/run-fail/bounds-check-no-overflow.rs +++ b/src/test/run-fail/bounds-check-no-overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:index out of bounds use std::usize; diff --git a/src/test/run-fail/bug-2470-bounds-check-overflow.rs b/src/test/run-fail/bug-2470-bounds-check-overflow.rs index 4a294d8fabc..b4e3f246991 100644 --- a/src/test/run-fail/bug-2470-bounds-check-overflow.rs +++ b/src/test/run-fail/bug-2470-bounds-check-overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:index out of bounds use std::mem; diff --git a/src/test/run-fail/bug-811.rs b/src/test/run-fail/bug-811.rs index c0e02ccd61b..e36ec0f5901 100644 --- a/src/test/run-fail/bug-811.rs +++ b/src/test/run-fail/bug-811.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:quux use std::marker::PhantomData; diff --git a/src/test/run-fail/call-fn-never-arg.rs b/src/test/run-fail/call-fn-never-arg.rs index 95101e70db9..d21a43ec5c5 100644 --- a/src/test/run-fail/call-fn-never-arg.rs +++ b/src/test/run-fail/call-fn-never-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can use a ! for an argument of type ! // error-pattern:wowzers! diff --git a/src/test/run-fail/cast-never.rs b/src/test/run-fail/cast-never.rs index 8f7b0c40538..3620ddee478 100644 --- a/src/test/run-fail/cast-never.rs +++ b/src/test/run-fail/cast-never.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can explicitly cast ! to another type // error-pattern:explicit diff --git a/src/test/run-fail/die-macro-expr.rs b/src/test/run-fail/die-macro-expr.rs index 16aa4d48d91..70413f97896 100644 --- a/src/test/run-fail/die-macro-expr.rs +++ b/src/test/run-fail/die-macro-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:test fn main() { diff --git a/src/test/run-fail/die-macro-pure.rs b/src/test/run-fail/die-macro-pure.rs index b54bf1c0c68..cec0742d503 100644 --- a/src/test/run-fail/die-macro-pure.rs +++ b/src/test/run-fail/die-macro-pure.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:test fn f() { diff --git a/src/test/run-fail/die-macro.rs b/src/test/run-fail/die-macro.rs index 811bd6e037d..846b9ea24d3 100644 --- a/src/test/run-fail/die-macro.rs +++ b/src/test/run-fail/die-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:test fn main() { diff --git a/src/test/run-fail/diverging-closure.rs b/src/test/run-fail/diverging-closure.rs index 6b98e0397b5..a92e07a21fe 100644 --- a/src/test/run-fail/diverging-closure.rs +++ b/src/test/run-fail/diverging-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:oops fn main() { diff --git a/src/test/run-fail/divide-by-zero.rs b/src/test/run-fail/divide-by-zero.rs index 1f9e069526c..fdb3f4842e5 100644 --- a/src/test/run-fail/divide-by-zero.rs +++ b/src/test/run-fail/divide-by-zero.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:attempt to divide by zero fn main() { diff --git a/src/test/run-fail/doublepanic.rs b/src/test/run-fail/doublepanic.rs index 936ebd96897..10d303e491e 100644 --- a/src/test/run-fail/doublepanic.rs +++ b/src/test/run-fail/doublepanic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unreachable_code)] // error-pattern:One diff --git a/src/test/run-fail/dst-raw-slice.rs b/src/test/run-fail/dst-raw-slice.rs index 77cec8b6327..561b1fb42ed 100644 --- a/src/test/run-fail/dst-raw-slice.rs +++ b/src/test/run-fail/dst-raw-slice.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test bounds checking for DST raw slices // error-pattern:index out of bounds diff --git a/src/test/run-fail/explicit-panic-msg.rs b/src/test/run-fail/explicit-panic-msg.rs index 907fae02b41..35e0518b9be 100644 --- a/src/test/run-fail/explicit-panic-msg.rs +++ b/src/test/run-fail/explicit-panic-msg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/src/test/run-fail/explicit-panic.rs b/src/test/run-fail/explicit-panic.rs index 928e7326b66..11ea6b41221 100644 --- a/src/test/run-fail/explicit-panic.rs +++ b/src/test/run-fail/explicit-panic.rs @@ -1,16 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - // error-pattern:explicit fn main() { panic!(); diff --git a/src/test/run-fail/expr-fn-panic.rs b/src/test/run-fail/expr-fn-panic.rs index f7a88975425..0532c32ec70 100644 --- a/src/test/run-fail/expr-fn-panic.rs +++ b/src/test/run-fail/expr-fn-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:explicit panic fn f() -> ! { diff --git a/src/test/run-fail/expr-if-panic-fn.rs b/src/test/run-fail/expr-if-panic-fn.rs index a8ec8f3f414..660b1396e38 100644 --- a/src/test/run-fail/expr-if-panic-fn.rs +++ b/src/test/run-fail/expr-if-panic-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:explicit panic fn f() -> ! { diff --git a/src/test/run-fail/expr-if-panic.rs b/src/test/run-fail/expr-if-panic.rs index 25bf43751f0..36aaf459a56 100644 --- a/src/test/run-fail/expr-if-panic.rs +++ b/src/test/run-fail/expr-if-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:explicit panic fn main() { diff --git a/src/test/run-fail/expr-match-panic-fn.rs b/src/test/run-fail/expr-match-panic-fn.rs index 6758ac6c4d4..120df61b4bf 100644 --- a/src/test/run-fail/expr-match-panic-fn.rs +++ b/src/test/run-fail/expr-match-panic-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:explicit panic fn f() -> ! { diff --git a/src/test/run-fail/expr-match-panic.rs b/src/test/run-fail/expr-match-panic.rs index 8876fb1f49b..b2f0179a083 100644 --- a/src/test/run-fail/expr-match-panic.rs +++ b/src/test/run-fail/expr-match-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:explicit panic fn main() { diff --git a/src/test/run-fail/fmt-panic.rs b/src/test/run-fail/fmt-panic.rs index 22e81480867..5749991914c 100644 --- a/src/test/run-fail/fmt-panic.rs +++ b/src/test/run-fail/fmt-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:meh fn main() { diff --git a/src/test/run-fail/for-each-loop-panic.rs b/src/test/run-fail/for-each-loop-panic.rs index a462d836019..d24e81e152c 100644 --- a/src/test/run-fail/for-each-loop-panic.rs +++ b/src/test/run-fail/for-each-loop-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:moop fn main() { diff --git a/src/test/run-fail/glob-use-std.rs b/src/test/run-fail/glob-use-std.rs index a7ba283b25a..d19a782986b 100644 --- a/src/test/run-fail/glob-use-std.rs +++ b/src/test/run-fail/glob-use-std.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #7580 // error-pattern:panic works diff --git a/src/test/run-fail/hashmap-capacity-overflow.rs b/src/test/run-fail/hashmap-capacity-overflow.rs index 2c7c0875227..038f2756ff3 100644 --- a/src/test/run-fail/hashmap-capacity-overflow.rs +++ b/src/test/run-fail/hashmap-capacity-overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:capacity overflow use std::collections::hash_map::HashMap; diff --git a/src/test/run-fail/if-check-panic.rs b/src/test/run-fail/if-check-panic.rs index f8b2d11cb64..f9a4b8fcb38 100644 --- a/src/test/run-fail/if-check-panic.rs +++ b/src/test/run-fail/if-check-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:Number is odd fn even(x: usize) -> bool { if x < 2 { diff --git a/src/test/run-fail/if-cond-bot.rs b/src/test/run-fail/if-cond-bot.rs index 203bc8fc65f..c680cad258f 100644 --- a/src/test/run-fail/if-cond-bot.rs +++ b/src/test/run-fail/if-cond-bot.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:quux fn my_err(s: String) -> ! { println!("{}", s); diff --git a/src/test/run-fail/issue-12920.rs b/src/test/run-fail/issue-12920.rs index 39a819f3d52..0819e992d13 100644 --- a/src/test/run-fail/issue-12920.rs +++ b/src/test/run-fail/issue-12920.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:explicit panic pub fn main() { diff --git a/src/test/run-fail/issue-13202.rs b/src/test/run-fail/issue-13202.rs index 57b7dfc1eec..cf3a6b3d986 100644 --- a/src/test/run-fail/issue-13202.rs +++ b/src/test/run-fail/issue-13202.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:bad input fn main() { diff --git a/src/test/run-fail/issue-18576.rs b/src/test/run-fail/issue-18576.rs index 88fb8f1b0c4..ca9d1e5f5e7 100644 --- a/src/test/run-fail/issue-18576.rs +++ b/src/test/run-fail/issue-18576.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:stop // #18576 diff --git a/src/test/run-fail/issue-20971.rs b/src/test/run-fail/issue-20971.rs index e433a45731f..6c2de783c01 100644 --- a/src/test/run-fail/issue-20971.rs +++ b/src/test/run-fail/issue-20971.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for Issue #20971. // error-pattern:Hello, world! diff --git a/src/test/run-fail/issue-23354-2.rs b/src/test/run-fail/issue-23354-2.rs index b120d3222fa..8f7baff56dc 100644 --- a/src/test/run-fail/issue-23354-2.rs +++ b/src/test/run-fail/issue-23354-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panic evaluated #[allow(unused_variables)] diff --git a/src/test/run-fail/issue-23354.rs b/src/test/run-fail/issue-23354.rs index f6b937c8259..4c2fb022a6b 100644 --- a/src/test/run-fail/issue-23354.rs +++ b/src/test/run-fail/issue-23354.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panic evaluated #[allow(unused_variables)] diff --git a/src/test/run-fail/issue-2444.rs b/src/test/run-fail/issue-2444.rs index f55b1ba03de..17f89e4d20d 100644 --- a/src/test/run-fail/issue-2444.rs +++ b/src/test/run-fail/issue-2444.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:explicit panic use std::sync::Arc; diff --git a/src/test/run-fail/issue-2761.rs b/src/test/run-fail/issue-2761.rs index 95050a4dcf1..84d90930d2d 100644 --- a/src/test/run-fail/issue-2761.rs +++ b/src/test/run-fail/issue-2761.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:custom message fn main() { diff --git a/src/test/run-fail/issue-28934.rs b/src/test/run-fail/issue-28934.rs index b32a504cb6b..5915372b692 100644 --- a/src/test/run-fail/issue-28934.rs +++ b/src/test/run-fail/issue-28934.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test: issue had to do with "givens" in region inference, // which were not being considered during the contraction phase. diff --git a/src/test/run-fail/issue-29798.rs b/src/test/run-fail/issue-29798.rs index 16b71f676e1..b06aa5fc728 100644 --- a/src/test/run-fail/issue-29798.rs +++ b/src/test/run-fail/issue-29798.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:index out of bounds: the len is 5 but the index is 5 const fn test(x: usize) -> i32 { diff --git a/src/test/run-fail/issue-3029.rs b/src/test/run-fail/issue-3029.rs index 1ada7771cd6..face808b68f 100644 --- a/src/test/run-fail/issue-3029.rs +++ b/src/test/run-fail/issue-3029.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_allocation)] #![allow(unreachable_code)] #![allow(unused_variables)] diff --git a/src/test/run-fail/issue-30380.rs b/src/test/run-fail/issue-30380.rs index 7bd9adcba9b..036071a89c7 100644 --- a/src/test/run-fail/issue-30380.rs +++ b/src/test/run-fail/issue-30380.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that panics in destructors during assignment do not leave // destroyed values lying around for other destructors to observe. diff --git a/src/test/run-fail/issue-44216-add-instant.rs b/src/test/run-fail/issue-44216-add-instant.rs index e17d23d925a..76ad0a3d41b 100644 --- a/src/test/run-fail/issue-44216-add-instant.rs +++ b/src/test/run-fail/issue-44216-add-instant.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:overflow use std::time::{Instant, Duration}; diff --git a/src/test/run-fail/issue-44216-add-system-time.rs b/src/test/run-fail/issue-44216-add-system-time.rs index 4a0c9c7d65e..aa861f7d599 100644 --- a/src/test/run-fail/issue-44216-add-system-time.rs +++ b/src/test/run-fail/issue-44216-add-system-time.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:overflow use std::time::{Duration, SystemTime}; diff --git a/src/test/run-fail/issue-44216-sub-instant.rs b/src/test/run-fail/issue-44216-sub-instant.rs index 6cc38cfec83..8bc1f47ae2d 100644 --- a/src/test/run-fail/issue-44216-sub-instant.rs +++ b/src/test/run-fail/issue-44216-sub-instant.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:overflow use std::time::{Instant, Duration}; diff --git a/src/test/run-fail/issue-44216-sub-system-time.rs b/src/test/run-fail/issue-44216-sub-system-time.rs index bcf60126f0f..37ab0e7c3f9 100644 --- a/src/test/run-fail/issue-44216-sub-system-time.rs +++ b/src/test/run-fail/issue-44216-sub-system-time.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:overflow use std::time::{Duration, SystemTime}; diff --git a/src/test/run-fail/issue-51345.rs b/src/test/run-fail/issue-51345.rs index 9efd08195a1..3c7f6a68db5 100644 --- a/src/test/run-fail/issue-51345.rs +++ b/src/test/run-fail/issue-51345.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: thread 'main' panicked at 'explicit panic' #![feature(nll)] diff --git a/src/test/run-fail/issue-6458-1.rs b/src/test/run-fail/issue-6458-1.rs index 7da27bd15f2..550bb2b832f 100644 --- a/src/test/run-fail/issue-6458-1.rs +++ b/src/test/run-fail/issue-6458-1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:explicit panic fn foo(t: T) {} diff --git a/src/test/run-fail/issue-948.rs b/src/test/run-fail/issue-948.rs index 4a1bc856a39..8f1c6587f03 100644 --- a/src/test/run-fail/issue-948.rs +++ b/src/test/run-fail/issue-948.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:beep boop #![allow(unused_variables)] diff --git a/src/test/run-fail/main-panic.rs b/src/test/run-fail/main-panic.rs index 87f77681fa0..3a9409562db 100644 --- a/src/test/run-fail/main-panic.rs +++ b/src/test/run-fail/main-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at fn main() { diff --git a/src/test/run-fail/match-bot-panic.rs b/src/test/run-fail/match-bot-panic.rs index 5a6eedb4863..f4da8c4e43f 100644 --- a/src/test/run-fail/match-bot-panic.rs +++ b/src/test/run-fail/match-bot-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:explicit panic #![allow(unreachable_code)] diff --git a/src/test/run-fail/match-disc-bot.rs b/src/test/run-fail/match-disc-bot.rs index a369a9889cc..a9312fbb1fb 100644 --- a/src/test/run-fail/match-disc-bot.rs +++ b/src/test/run-fail/match-disc-bot.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:quux fn f() -> ! { panic!("quux") diff --git a/src/test/run-fail/match-wildcards.rs b/src/test/run-fail/match-wildcards.rs index 61bfd38c5f4..7a65ad52558 100644 --- a/src/test/run-fail/match-wildcards.rs +++ b/src/test/run-fail/match-wildcards.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:squirrelcupcake fn cmp() -> isize { match (Some('a'), None::) { diff --git a/src/test/run-fail/meta-revision-bad.rs b/src/test/run-fail/meta-revision-bad.rs index 0b7c464800a..17f6398b735 100644 --- a/src/test/run-fail/meta-revision-bad.rs +++ b/src/test/run-fail/meta-revision-bad.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Meta test for compiletest: check that when we give the wrong error // patterns, the test fails. diff --git a/src/test/run-fail/meta-revision-ok.rs b/src/test/run-fail/meta-revision-ok.rs index 99dd332c558..8693ee5f4ef 100644 --- a/src/test/run-fail/meta-revision-ok.rs +++ b/src/test/run-fail/meta-revision-ok.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Meta test for compiletest: check that when we give the right error // patterns, the test passes. See all `meta-revision-bad.rs`. diff --git a/src/test/run-fail/mir_codegen_calls_converging_drops.rs b/src/test/run-fail/mir_codegen_calls_converging_drops.rs index 9c851eb7346..ee0dc98ce68 100644 --- a/src/test/run-fail/mir_codegen_calls_converging_drops.rs +++ b/src/test/run-fail/mir_codegen_calls_converging_drops.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:converging_fn called // error-pattern:0 dropped // error-pattern:exit diff --git a/src/test/run-fail/mir_codegen_calls_converging_drops_2.rs b/src/test/run-fail/mir_codegen_calls_converging_drops_2.rs index 6f105211556..ee2c25ce856 100644 --- a/src/test/run-fail/mir_codegen_calls_converging_drops_2.rs +++ b/src/test/run-fail/mir_codegen_calls_converging_drops_2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:complex called // error-pattern:dropped // error-pattern:exit diff --git a/src/test/run-fail/mir_codegen_calls_diverging.rs b/src/test/run-fail/mir_codegen_calls_diverging.rs index 9dbf7de0d2d..dceae0a4e4a 100644 --- a/src/test/run-fail/mir_codegen_calls_diverging.rs +++ b/src/test/run-fail/mir_codegen_calls_diverging.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:diverging_fn called fn diverging_fn() -> ! { diff --git a/src/test/run-fail/mir_codegen_calls_diverging_drops.rs b/src/test/run-fail/mir_codegen_calls_diverging_drops.rs index f8fbe8f79cc..187e526f7c0 100644 --- a/src/test/run-fail/mir_codegen_calls_diverging_drops.rs +++ b/src/test/run-fail/mir_codegen_calls_diverging_drops.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:diverging_fn called // error-pattern:0 dropped diff --git a/src/test/run-fail/mir_codegen_no_landing_pads.rs b/src/test/run-fail/mir_codegen_no_landing_pads.rs index aded2739b10..f3384dc45f3 100644 --- a/src/test/run-fail/mir_codegen_no_landing_pads.rs +++ b/src/test/run-fail/mir_codegen_no_landing_pads.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z no-landing-pads -C codegen-units=1 // error-pattern:converging_fn called // ignore-cloudabi no std::process diff --git a/src/test/run-fail/mir_codegen_no_landing_pads_diverging.rs b/src/test/run-fail/mir_codegen_no_landing_pads_diverging.rs index d3a8613bbc4..08f6d578bb2 100644 --- a/src/test/run-fail/mir_codegen_no_landing_pads_diverging.rs +++ b/src/test/run-fail/mir_codegen_no_landing_pads_diverging.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z no-landing-pads -C codegen-units=1 // error-pattern:diverging_fn called // ignore-cloudabi no std::process diff --git a/src/test/run-fail/mir_drop_panics.rs b/src/test/run-fail/mir_drop_panics.rs index b3980f32d27..bda555b9262 100644 --- a/src/test/run-fail/mir_drop_panics.rs +++ b/src/test/run-fail/mir_drop_panics.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panic 1 // error-pattern:drop 2 diff --git a/src/test/run-fail/mir_dynamic_drops_1.rs b/src/test/run-fail/mir_dynamic_drops_1.rs index 856fc50a0f8..db8d0af29db 100644 --- a/src/test/run-fail/mir_dynamic_drops_1.rs +++ b/src/test/run-fail/mir_dynamic_drops_1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:drop 1 // error-pattern:drop 2 // ignore-cloudabi no std::process diff --git a/src/test/run-fail/mir_dynamic_drops_2.rs b/src/test/run-fail/mir_dynamic_drops_2.rs index 964562322bd..21d3a042b1e 100644 --- a/src/test/run-fail/mir_dynamic_drops_2.rs +++ b/src/test/run-fail/mir_dynamic_drops_2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:drop 1 // ignore-cloudabi no std::process diff --git a/src/test/run-fail/mir_dynamic_drops_3.rs b/src/test/run-fail/mir_dynamic_drops_3.rs index 4c070314555..b9049968682 100644 --- a/src/test/run-fail/mir_dynamic_drops_3.rs +++ b/src/test/run-fail/mir_dynamic_drops_3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:unwind happens // error-pattern:drop 3 // error-pattern:drop 2 diff --git a/src/test/run-fail/mir_indexing_oob_1.rs b/src/test/run-fail/mir_indexing_oob_1.rs index cf342ad94f9..0ae0320b124 100644 --- a/src/test/run-fail/mir_indexing_oob_1.rs +++ b/src/test/run-fail/mir_indexing_oob_1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:index out of bounds: the len is 5 but the index is 10 const C: [u32; 5] = [0; 5]; diff --git a/src/test/run-fail/mir_indexing_oob_2.rs b/src/test/run-fail/mir_indexing_oob_2.rs index 3eb94682b20..a7a1177260c 100644 --- a/src/test/run-fail/mir_indexing_oob_2.rs +++ b/src/test/run-fail/mir_indexing_oob_2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:index out of bounds: the len is 5 but the index is 10 const C: &'static [u8; 5] = b"hello"; diff --git a/src/test/run-fail/mir_indexing_oob_3.rs b/src/test/run-fail/mir_indexing_oob_3.rs index 06bb6d4d287..188460fff78 100644 --- a/src/test/run-fail/mir_indexing_oob_3.rs +++ b/src/test/run-fail/mir_indexing_oob_3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:index out of bounds: the len is 5 but the index is 10 const C: &'static [u8; 5] = b"hello"; diff --git a/src/test/run-fail/mod-zero.rs b/src/test/run-fail/mod-zero.rs index 641d39e2324..ac2959fcd38 100644 --- a/src/test/run-fail/mod-zero.rs +++ b/src/test/run-fail/mod-zero.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:attempt to calculate the remainder with a divisor of zero fn main() { diff --git a/src/test/run-fail/never-associated-type.rs b/src/test/run-fail/never-associated-type.rs index fdd21e08c20..ba30b9ea0fe 100644 --- a/src/test/run-fail/never-associated-type.rs +++ b/src/test/run-fail/never-associated-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can use ! as an associated type. // error-pattern:kapow! diff --git a/src/test/run-fail/never-type-arg.rs b/src/test/run-fail/never-type-arg.rs index 826ca3a08c0..fc7f2fc90d7 100644 --- a/src/test/run-fail/never-type-arg.rs +++ b/src/test/run-fail/never-type-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can use ! as an argument to a trait impl. // error-pattern:oh no! diff --git a/src/test/run-fail/overflowing-add.rs b/src/test/run-fail/overflowing-add.rs index 584701410ef..24602aced9e 100644 --- a/src/test/run-fail/overflowing-add.rs +++ b/src/test/run-fail/overflowing-add.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to add with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-lsh-1.rs b/src/test/run-fail/overflowing-lsh-1.rs index baa1e05d559..c69da0f49ad 100644 --- a/src/test/run-fail/overflowing-lsh-1.rs +++ b/src/test/run-fail/overflowing-lsh-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to shift left with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-lsh-2.rs b/src/test/run-fail/overflowing-lsh-2.rs index 3438ed2c77c..21659bd5239 100644 --- a/src/test/run-fail/overflowing-lsh-2.rs +++ b/src/test/run-fail/overflowing-lsh-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to shift left with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-lsh-3.rs b/src/test/run-fail/overflowing-lsh-3.rs index ef5c43db6e2..8f06cd11533 100644 --- a/src/test/run-fail/overflowing-lsh-3.rs +++ b/src/test/run-fail/overflowing-lsh-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to shift left with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-lsh-4.rs b/src/test/run-fail/overflowing-lsh-4.rs index 226ece6020d..084c147094d 100644 --- a/src/test/run-fail/overflowing-lsh-4.rs +++ b/src/test/run-fail/overflowing-lsh-4.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to shift left with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-mul.rs b/src/test/run-fail/overflowing-mul.rs index 5d6f59e0229..48110365a81 100644 --- a/src/test/run-fail/overflowing-mul.rs +++ b/src/test/run-fail/overflowing-mul.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to multiply with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-neg.rs b/src/test/run-fail/overflowing-neg.rs index e7c518f1286..c4afd74241e 100644 --- a/src/test/run-fail/overflowing-neg.rs +++ b/src/test/run-fail/overflowing-neg.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to negate with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-pow-signed.rs b/src/test/run-fail/overflowing-pow-signed.rs index b0ff0df5577..c539c685faf 100644 --- a/src/test/run-fail/overflowing-pow-signed.rs +++ b/src/test/run-fail/overflowing-pow-signed.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to multiply with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-pow-unsigned.rs b/src/test/run-fail/overflowing-pow-unsigned.rs index d3e7035279f..1d4fa3b5c7e 100644 --- a/src/test/run-fail/overflowing-pow-unsigned.rs +++ b/src/test/run-fail/overflowing-pow-unsigned.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to multiply with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-rsh-1.rs b/src/test/run-fail/overflowing-rsh-1.rs index 8f198c887e4..24a77da896d 100644 --- a/src/test/run-fail/overflowing-rsh-1.rs +++ b/src/test/run-fail/overflowing-rsh-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to shift right with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-rsh-2.rs b/src/test/run-fail/overflowing-rsh-2.rs index e4f260b2bbb..b5615cacc20 100644 --- a/src/test/run-fail/overflowing-rsh-2.rs +++ b/src/test/run-fail/overflowing-rsh-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to shift right with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-rsh-3.rs b/src/test/run-fail/overflowing-rsh-3.rs index 11aa98a0c3c..7598e026d81 100644 --- a/src/test/run-fail/overflowing-rsh-3.rs +++ b/src/test/run-fail/overflowing-rsh-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to shift right with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-rsh-4.rs b/src/test/run-fail/overflowing-rsh-4.rs index 742720e83c1..a8d3b69392a 100644 --- a/src/test/run-fail/overflowing-rsh-4.rs +++ b/src/test/run-fail/overflowing-rsh-4.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to shift right with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-rsh-5.rs b/src/test/run-fail/overflowing-rsh-5.rs index 6106fdcb16a..793f495240d 100644 --- a/src/test/run-fail/overflowing-rsh-5.rs +++ b/src/test/run-fail/overflowing-rsh-5.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to shift right with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-rsh-6.rs b/src/test/run-fail/overflowing-rsh-6.rs index d419550fcc5..d6b2f8dc9f9 100644 --- a/src/test/run-fail/overflowing-rsh-6.rs +++ b/src/test/run-fail/overflowing-rsh-6.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to shift right with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/overflowing-sub.rs b/src/test/run-fail/overflowing-sub.rs index 404921a1af5..e3b111dd2bb 100644 --- a/src/test/run-fail/overflowing-sub.rs +++ b/src/test/run-fail/overflowing-sub.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'attempt to subtract with overflow' // compile-flags: -C debug-assertions diff --git a/src/test/run-fail/panic-arg.rs b/src/test/run-fail/panic-arg.rs index 9023784050f..c164ff94630 100644 --- a/src/test/run-fail/panic-arg.rs +++ b/src/test/run-fail/panic-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:woe fn f(a: isize) { println!("{}", a); diff --git a/src/test/run-fail/panic-macro-any-wrapped.rs b/src/test/run-fail/panic-macro-any-wrapped.rs index 4d0f7c29cb9..83eb39a538f 100644 --- a/src/test/run-fail/panic-macro-any-wrapped.rs +++ b/src/test/run-fail/panic-macro-any-wrapped.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panicked at 'Box' fn main() { diff --git a/src/test/run-fail/panic-macro-any.rs b/src/test/run-fail/panic-macro-any.rs index c8f851be556..72d42e5b799 100644 --- a/src/test/run-fail/panic-macro-any.rs +++ b/src/test/run-fail/panic-macro-any.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panicked at 'Box' #![feature(box_syntax)] diff --git a/src/test/run-fail/panic-macro-explicit.rs b/src/test/run-fail/panic-macro-explicit.rs index a8565549a03..f632034807c 100644 --- a/src/test/run-fail/panic-macro-explicit.rs +++ b/src/test/run-fail/panic-macro-explicit.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panicked at 'explicit panic' fn main() { diff --git a/src/test/run-fail/panic-macro-fmt.rs b/src/test/run-fail/panic-macro-fmt.rs index 50ad99c6747..658ae56e7e4 100644 --- a/src/test/run-fail/panic-macro-fmt.rs +++ b/src/test/run-fail/panic-macro-fmt.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panicked at 'test-fail-fmt 42 rust' fn main() { diff --git a/src/test/run-fail/panic-macro-owned.rs b/src/test/run-fail/panic-macro-owned.rs index 2f695c4e4b7..9b935717638 100644 --- a/src/test/run-fail/panic-macro-owned.rs +++ b/src/test/run-fail/panic-macro-owned.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panicked at 'test-fail-owned' fn main() { diff --git a/src/test/run-fail/panic-macro-static.rs b/src/test/run-fail/panic-macro-static.rs index c62162da09b..31ac488beb2 100644 --- a/src/test/run-fail/panic-macro-static.rs +++ b/src/test/run-fail/panic-macro-static.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:panicked at 'test-fail-static' fn main() { diff --git a/src/test/run-fail/panic-main.rs b/src/test/run-fail/panic-main.rs index fd2919bfe12..881eb7b5823 100644 --- a/src/test/run-fail/panic-main.rs +++ b/src/test/run-fail/panic-main.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:moop fn main() { panic!("moop"); diff --git a/src/test/run-fail/panic-parens.rs b/src/test/run-fail/panic-parens.rs index 1917a7e2a7f..e7f98e58c4f 100644 --- a/src/test/run-fail/panic-parens.rs +++ b/src/test/run-fail/panic-parens.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Fail macros without arguments need to be disambiguated in // certain positions // error-pattern:oops diff --git a/src/test/run-fail/panic-set-handler.rs b/src/test/run-fail/panic-set-handler.rs index 2fa933d513a..ea2b152c6c4 100644 --- a/src/test/run-fail/panic-set-handler.rs +++ b/src/test/run-fail/panic-set-handler.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:greetings from the panic handler use std::panic; diff --git a/src/test/run-fail/panic-set-unset-handler.rs b/src/test/run-fail/panic-set-unset-handler.rs index e7659d0bd88..f8809c2f388 100644 --- a/src/test/run-fail/panic-set-unset-handler.rs +++ b/src/test/run-fail/panic-set-unset-handler.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'foobar' use std::panic; diff --git a/src/test/run-fail/panic-take-handler-nop.rs b/src/test/run-fail/panic-take-handler-nop.rs index 46e937c5d9b..bb191a38f84 100644 --- a/src/test/run-fail/panic-take-handler-nop.rs +++ b/src/test/run-fail/panic-take-handler-nop.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'main' panicked at 'foobar' use std::panic; diff --git a/src/test/run-fail/panic-task-name-none.rs b/src/test/run-fail/panic-task-name-none.rs index 36e2a4b86aa..c7f504046ba 100644 --- a/src/test/run-fail/panic-task-name-none.rs +++ b/src/test/run-fail/panic-task-name-none.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread '' panicked at 'test' // ignore-emscripten Needs threads diff --git a/src/test/run-fail/panic-task-name-owned.rs b/src/test/run-fail/panic-task-name-owned.rs index 4da40c3158b..58f76ff787f 100644 --- a/src/test/run-fail/panic-task-name-owned.rs +++ b/src/test/run-fail/panic-task-name-owned.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:thread 'owned name' panicked at 'test' // ignore-emscripten Needs threads. diff --git a/src/test/run-fail/panic.rs b/src/test/run-fail/panic.rs index f59e6001794..95f20dedad2 100644 --- a/src/test/run-fail/panic.rs +++ b/src/test/run-fail/panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:1 == 2 fn main() { assert!(1 == 2); diff --git a/src/test/run-fail/promoted_div_by_zero.rs b/src/test/run-fail/promoted_div_by_zero.rs index 385fd509232..3fe51a19c20 100644 --- a/src/test/run-fail/promoted_div_by_zero.rs +++ b/src/test/run-fail/promoted_div_by_zero.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(const_err)] // error-pattern: attempt to divide by zero diff --git a/src/test/run-fail/promoted_overflow.rs b/src/test/run-fail/promoted_overflow.rs index 0e1b0117a8c..139bf540959 100644 --- a/src/test/run-fail/promoted_overflow.rs +++ b/src/test/run-fail/promoted_overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(const_err)] // error-pattern: overflow diff --git a/src/test/run-fail/result-get-panic.rs b/src/test/run-fail/result-get-panic.rs index 6378b4ec795..cddf20ee49d 100644 --- a/src/test/run-fail/result-get-panic.rs +++ b/src/test/run-fail/result-get-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:called `Result::unwrap()` on an `Err` value use std::result::Result::Err; diff --git a/src/test/run-fail/return-never-coerce.rs b/src/test/run-fail/return-never-coerce.rs index ddcecd97ba5..18182ff0f9d 100644 --- a/src/test/run-fail/return-never-coerce.rs +++ b/src/test/run-fail/return-never-coerce.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that ! coerces to other types. // error-pattern:aah! diff --git a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs index 66a6e6afed3..5f76caabc79 100644 --- a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs +++ b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // failure-status: 1 diff --git a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-never.rs b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-never.rs index 863de85af88..cb37b8e0670 100644 --- a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-never.rs +++ b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-never.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:oh, dear fn main() -> ! { diff --git a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs index 4fb7ae9c10c..bd47a9768f9 100644 --- a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs +++ b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-result-box-error_err.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // failure-status: 1 diff --git a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-str.rs b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-str.rs index 9f01b0bff89..bd6fa8af935 100644 --- a/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-str.rs +++ b/src/test/run-fail/rfc-1937-termination-trait/termination-trait-for-str.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: An error message for you // failure-status: 1 diff --git a/src/test/run-fail/rhs-type.rs b/src/test/run-fail/rhs-type.rs index 572b56d02ae..6efbeadd704 100644 --- a/src/test/run-fail/rhs-type.rs +++ b/src/test/run-fail/rhs-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that codegen treats the rhs of pth's decl // as a _|_-typed thing, not a str-typed thing // error-pattern:bye diff --git a/src/test/run-fail/run-unexported-tests.rs b/src/test/run-fail/run-unexported-tests.rs index c7d5574f909..11e100e716e 100644 --- a/src/test/run-fail/run-unexported-tests.rs +++ b/src/test/run-fail/run-unexported-tests.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:ran an unexported test // compile-flags:--test // check-stdout diff --git a/src/test/run-fail/str-overrun.rs b/src/test/run-fail/str-overrun.rs index a9c0030feca..e566308a087 100644 --- a/src/test/run-fail/str-overrun.rs +++ b/src/test/run-fail/str-overrun.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // error-pattern:index out of bounds: the len is 5 but the index is 5 fn main() { let s: String = "hello".to_string(); diff --git a/src/test/run-fail/task-spawn-barefn.rs b/src/test/run-fail/task-spawn-barefn.rs index 108430848b9..497c5ea7180 100644 --- a/src/test/run-fail/task-spawn-barefn.rs +++ b/src/test/run-fail/task-spawn-barefn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:Ensure that the child thread runs by panicking // ignore-emscripten Needs threads. diff --git a/src/test/run-fail/test-panic.rs b/src/test/run-fail/test-panic.rs index bb6f4abe1fc..92f5146b710 100644 --- a/src/test/run-fail/test-panic.rs +++ b/src/test/run-fail/test-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check-stdout // error-pattern:thread 'test_foo' panicked at // compile-flags: --test diff --git a/src/test/run-fail/test-should-fail-bad-message.rs b/src/test/run-fail/test-should-fail-bad-message.rs index eac9813f180..3c69bb07d3b 100644 --- a/src/test/run-fail/test-should-fail-bad-message.rs +++ b/src/test/run-fail/test-should-fail-bad-message.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check-stdout // error-pattern:thread 'test_foo' panicked at // compile-flags: --test diff --git a/src/test/run-fail/test-should-panic-bad-message.rs b/src/test/run-fail/test-should-panic-bad-message.rs index 7186672b404..b73d4d7377a 100644 --- a/src/test/run-fail/test-should-panic-bad-message.rs +++ b/src/test/run-fail/test-should-panic-bad-message.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test // error-pattern:panicked at 'bar' diff --git a/src/test/run-fail/test-should-panic-no-message.rs b/src/test/run-fail/test-should-panic-no-message.rs index 50dc2aed8e9..b18389ec744 100644 --- a/src/test/run-fail/test-should-panic-no-message.rs +++ b/src/test/run-fail/test-should-panic-no-message.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test // error-pattern:panicked at 'explicit panic' diff --git a/src/test/run-fail/test-tasks-invalid-value.rs b/src/test/run-fail/test-tasks-invalid-value.rs index fcf3559e7da..2dae1b4592c 100644 --- a/src/test/run-fail/test-tasks-invalid-value.rs +++ b/src/test/run-fail/test-tasks-invalid-value.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This checks that RUST_TEST_THREADS not being 1, 2, ... is detected // properly. diff --git a/src/test/run-fail/tls-exit-status.rs b/src/test/run-fail/tls-exit-status.rs index d9b81c5d4b6..f15fd4f6894 100644 --- a/src/test/run-fail/tls-exit-status.rs +++ b/src/test/run-fail/tls-exit-status.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:nonzero // exec-env:RUST_NEWRT=1 // ignore-cloudabi no std::env diff --git a/src/test/run-fail/unimplemented-macro-panic.rs b/src/test/run-fail/unimplemented-macro-panic.rs index e3d8aa2e460..2a848281e4f 100644 --- a/src/test/run-fail/unimplemented-macro-panic.rs +++ b/src/test/run-fail/unimplemented-macro-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:not yet implemented fn main() { unimplemented!() diff --git a/src/test/run-fail/unique-panic.rs b/src/test/run-fail/unique-panic.rs index 3dc3d0afda1..adefd796af4 100644 --- a/src/test/run-fail/unique-panic.rs +++ b/src/test/run-fail/unique-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: panic fn main() { diff --git a/src/test/run-fail/unreachable-fmt-msg.rs b/src/test/run-fail/unreachable-fmt-msg.rs index f005fa4476c..ac2a52163b4 100644 --- a/src/test/run-fail/unreachable-fmt-msg.rs +++ b/src/test/run-fail/unreachable-fmt-msg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:internal error: entered unreachable code: 6 is not prime fn main() { unreachable!("{} is not {}", 6u32, "prime"); diff --git a/src/test/run-fail/unreachable-macro-panic.rs b/src/test/run-fail/unreachable-macro-panic.rs index 493fe7ee4f8..597a0144722 100644 --- a/src/test/run-fail/unreachable-macro-panic.rs +++ b/src/test/run-fail/unreachable-macro-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:internal error: entered unreachable code fn main() { unreachable!() diff --git a/src/test/run-fail/unreachable-static-msg.rs b/src/test/run-fail/unreachable-static-msg.rs index 0a9dee3d0b9..40a2881cc57 100644 --- a/src/test/run-fail/unreachable-static-msg.rs +++ b/src/test/run-fail/unreachable-static-msg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:internal error: entered unreachable code: uhoh fn main() { unreachable!("uhoh") diff --git a/src/test/run-fail/unreachable.rs b/src/test/run-fail/unreachable.rs index 493fe7ee4f8..597a0144722 100644 --- a/src/test/run-fail/unreachable.rs +++ b/src/test/run-fail/unreachable.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:internal error: entered unreachable code fn main() { unreachable!() diff --git a/src/test/run-fail/unwind-interleaved.rs b/src/test/run-fail/unwind-interleaved.rs index 0a7be154d5d..c163678ae98 100644 --- a/src/test/run-fail/unwind-interleaved.rs +++ b/src/test/run-fail/unwind-interleaved.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:fail fn a() {} diff --git a/src/test/run-fail/unwind-rec.rs b/src/test/run-fail/unwind-rec.rs index 5177b4091d7..83ac19ff4a5 100644 --- a/src/test/run-fail/unwind-rec.rs +++ b/src/test/run-fail/unwind-rec.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:fail diff --git a/src/test/run-fail/unwind-rec2.rs b/src/test/run-fail/unwind-rec2.rs index 3be5036b216..4dfc282b6c0 100644 --- a/src/test/run-fail/unwind-rec2.rs +++ b/src/test/run-fail/unwind-rec2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:fail diff --git a/src/test/run-fail/unwind-unique.rs b/src/test/run-fail/unwind-unique.rs index f4ba789d6bf..7b761faad95 100644 --- a/src/test/run-fail/unwind-unique.rs +++ b/src/test/run-fail/unwind-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:fail fn failfn() { diff --git a/src/test/run-fail/vec-overrun.rs b/src/test/run-fail/vec-overrun.rs index 457ae75a451..2be945f736c 100644 --- a/src/test/run-fail/vec-overrun.rs +++ b/src/test/run-fail/vec-overrun.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:index out of bounds: the len is 1 but the index is 2 diff --git a/src/test/run-fail/while-body-panics.rs b/src/test/run-fail/while-body-panics.rs index 29482612c24..76acb4ba42d 100644 --- a/src/test/run-fail/while-body-panics.rs +++ b/src/test/run-fail/while-body-panics.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(while_true)] // error-pattern:quux diff --git a/src/test/run-fail/while-panic.rs b/src/test/run-fail/while-panic.rs index e410684cd34..a0827591729 100644 --- a/src/test/run-fail/while-panic.rs +++ b/src/test/run-fail/while-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(while_true)] // error-pattern:giraffe diff --git a/src/test/run-make-fulldeps/a-b-a-linker-guard/a.rs b/src/test/run-make-fulldeps/a-b-a-linker-guard/a.rs index c6680a78819..aa07b1e7160 100644 --- a/src/test/run-make-fulldeps/a-b-a-linker-guard/a.rs +++ b/src/test/run-make-fulldeps/a-b-a-linker-guard/a.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "a"] #![crate_type = "dylib"] diff --git a/src/test/run-make-fulldeps/a-b-a-linker-guard/b.rs b/src/test/run-make-fulldeps/a-b-a-linker-guard/b.rs index 89fd48de5bb..f30df120a3b 100644 --- a/src/test/run-make-fulldeps/a-b-a-linker-guard/b.rs +++ b/src/test/run-make-fulldeps/a-b-a-linker-guard/b.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "b"] extern crate a; diff --git a/src/test/run-make-fulldeps/alloc-extern-crates/fakealloc.rs b/src/test/run-make-fulldeps/alloc-extern-crates/fakealloc.rs index 43f97489314..625c3afab92 100644 --- a/src/test/run-make-fulldeps/alloc-extern-crates/fakealloc.rs +++ b/src/test/run-make-fulldeps/alloc-extern-crates/fakealloc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![no_std] diff --git a/src/test/run-make-fulldeps/allow-non-lint-warnings-cmdline/foo.rs b/src/test/run-make-fulldeps/allow-non-lint-warnings-cmdline/foo.rs index a9e18f5a8f1..46e72da2de9 100644 --- a/src/test/run-make-fulldeps/allow-non-lint-warnings-cmdline/foo.rs +++ b/src/test/run-make-fulldeps/allow-non-lint-warnings-cmdline/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive()] #[derive(Copy, Clone)] pub struct Foo; diff --git a/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs b/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs index 1dad2ed9052..2a977ed63b1 100644 --- a/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs +++ b/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #![feature(staged_api)] #![unstable(feature = "unstable_test_feature", issue = "0")] diff --git a/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs b/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs index b728136a89e..869b5435416 100644 --- a/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs +++ b/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unstable_test_feature)] extern crate bar; diff --git a/src/test/run-make-fulldeps/archive-duplicate-names/bar.c b/src/test/run-make-fulldeps/archive-duplicate-names/bar.c index a25fa10f4d3..e4259998678 100644 --- a/src/test/run-make-fulldeps/archive-duplicate-names/bar.c +++ b/src/test/run-make-fulldeps/archive-duplicate-names/bar.c @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - void bar() {} diff --git a/src/test/run-make-fulldeps/archive-duplicate-names/bar.rs b/src/test/run-make-fulldeps/archive-duplicate-names/bar.rs index 1200a6de8e2..994a98c2cd8 100644 --- a/src/test/run-make-fulldeps/archive-duplicate-names/bar.rs +++ b/src/test/run-make-fulldeps/archive-duplicate-names/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() { diff --git a/src/test/run-make-fulldeps/archive-duplicate-names/foo.c b/src/test/run-make-fulldeps/archive-duplicate-names/foo.c index 61d5d154078..85e6cd8c390 100644 --- a/src/test/run-make-fulldeps/archive-duplicate-names/foo.c +++ b/src/test/run-make-fulldeps/archive-duplicate-names/foo.c @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - void foo() {} diff --git a/src/test/run-make-fulldeps/archive-duplicate-names/foo.rs b/src/test/run-make-fulldeps/archive-duplicate-names/foo.rs index 24b4734f2cd..5f5ed424ba9 100644 --- a/src/test/run-make-fulldeps/archive-duplicate-names/foo.rs +++ b/src/test/run-make-fulldeps/archive-duplicate-names/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #[link(name = "foo", kind = "static")] diff --git a/src/test/run-make-fulldeps/atomic-lock-free/Makefile b/src/test/run-make-fulldeps/atomic-lock-free/Makefile index a7df821f92d..9e8b4fabf17 100644 --- a/src/test/run-make-fulldeps/atomic-lock-free/Makefile +++ b/src/test/run-make-fulldeps/atomic-lock-free/Makefile @@ -18,6 +18,8 @@ ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm) nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add $(RUSTC) --target=armv7-unknown-linux-gnueabihf atomic_lock_free.rs nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add + $(RUSTC) --target=thumbv7neon-unknown-linux-gnueabihf atomic_lock_free.rs + nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add endif ifeq ($(filter aarch64,$(LLVM_COMPONENTS)),aarch64) $(RUSTC) --target=aarch64-unknown-linux-gnu atomic_lock_free.rs diff --git a/src/test/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs b/src/test/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs index 2c8128b1907..bc7951a04da 100644 --- a/src/test/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs +++ b/src/test/run-make-fulldeps/atomic-lock-free/atomic_lock_free.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(cfg_target_has_atomic, no_core, intrinsics, lang_items)] #![crate_type="rlib"] #![no_core] diff --git a/src/test/run-make-fulldeps/bare-outfile/foo.rs b/src/test/run-make-fulldeps/bare-outfile/foo.rs index 63e747901ae..f79c691f085 100644 --- a/src/test/run-make-fulldeps/bare-outfile/foo.rs +++ b/src/test/run-make-fulldeps/bare-outfile/foo.rs @@ -1,12 +1,2 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { } diff --git a/src/test/run-make-fulldeps/c-dynamic-dylib/bar.rs b/src/test/run-make-fulldeps/c-dynamic-dylib/bar.rs index 37b120decd1..b8c798ffdb4 100644 --- a/src/test/run-make-fulldeps/c-dynamic-dylib/bar.rs +++ b/src/test/run-make-fulldeps/c-dynamic-dylib/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() { diff --git a/src/test/run-make-fulldeps/c-dynamic-dylib/foo.rs b/src/test/run-make-fulldeps/c-dynamic-dylib/foo.rs index 04253be71d4..14f67017a3b 100644 --- a/src/test/run-make-fulldeps/c-dynamic-dylib/foo.rs +++ b/src/test/run-make-fulldeps/c-dynamic-dylib/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] #[link(name = "cfoo")] diff --git a/src/test/run-make-fulldeps/c-dynamic-rlib/bar.rs b/src/test/run-make-fulldeps/c-dynamic-rlib/bar.rs index 37b120decd1..b8c798ffdb4 100644 --- a/src/test/run-make-fulldeps/c-dynamic-rlib/bar.rs +++ b/src/test/run-make-fulldeps/c-dynamic-rlib/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() { diff --git a/src/test/run-make-fulldeps/c-dynamic-rlib/foo.rs b/src/test/run-make-fulldeps/c-dynamic-rlib/foo.rs index a1f01bd2b62..9bf3689cd36 100644 --- a/src/test/run-make-fulldeps/c-dynamic-rlib/foo.rs +++ b/src/test/run-make-fulldeps/c-dynamic-rlib/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #[link(name = "cfoo")] diff --git a/src/test/run-make-fulldeps/c-link-to-rust-dylib/foo.rs b/src/test/run-make-fulldeps/c-link-to-rust-dylib/foo.rs index 32675bcba1e..f197fa51334 100644 --- a/src/test/run-make-fulldeps/c-link-to-rust-dylib/foo.rs +++ b/src/test/run-make-fulldeps/c-link-to-rust-dylib/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] #[no_mangle] diff --git a/src/test/run-make-fulldeps/c-link-to-rust-staticlib/foo.rs b/src/test/run-make-fulldeps/c-link-to-rust-staticlib/foo.rs index 1bb19016700..2e59432cdb1 100644 --- a/src/test/run-make-fulldeps/c-link-to-rust-staticlib/foo.rs +++ b/src/test/run-make-fulldeps/c-link-to-rust-staticlib/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "staticlib"] #[no_mangle] diff --git a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile new file mode 100644 index 00000000000..f124ca2ab61 --- /dev/null +++ b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/Makefile @@ -0,0 +1,6 @@ +-include ../tools.mk + +all: + $(RUSTC) checkrust.rs + $(CC) test.c $(call STATICLIB,checkrust) $(call OUT_EXE,test) $(EXTRACFLAGS) + $(call RUN,test) diff --git a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs new file mode 100644 index 00000000000..d55aac1e40f --- /dev/null +++ b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs @@ -0,0 +1,70 @@ +#![crate_type = "staticlib"] +#![feature(c_variadic)] +#![feature(rustc_private)] + +extern crate libc; + +use libc::{c_char, c_double, c_int, c_long, c_longlong}; +use std::ffi::VaList; +use std::ffi::{CString, CStr}; + +macro_rules! continue_if { + ($cond:expr) => { + if !($cond) { + return 0xff; + } + } +} + +unsafe fn compare_c_str(ptr: *const c_char, val: &str) -> bool { + let cstr0 = CStr::from_ptr(ptr); + let cstr1 = CString::new(val).unwrap(); + &*cstr1 == cstr0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_list_0(mut ap: VaList) -> usize { + continue_if!(ap.arg::() == 1); + continue_if!(ap.arg::() == 2); + continue_if!(ap.arg::() == 3); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_list_1(mut ap: VaList) -> usize { + continue_if!(ap.arg::() == -1); + continue_if!(ap.arg::() == 'A' as c_char); + continue_if!(ap.arg::() == '4' as c_char); + continue_if!(ap.arg::() == ';' as c_char); + continue_if!(ap.arg::() == 0x32); + continue_if!(ap.arg::() == 0x10000001); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Valid!")); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_list_2(mut ap: VaList) -> usize { + continue_if!(ap.arg::().floor() == 3.14f64.floor()); + continue_if!(ap.arg::() == 12); + continue_if!(ap.arg::() == 'a' as c_char); + continue_if!(ap.arg::().floor() == 6.18f64.floor()); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello")); + continue_if!(ap.arg::() == 42); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "World")); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_list_copy_0(mut ap: VaList) -> usize { + continue_if!(ap.arg::().floor() == 6.28f64.floor()); + continue_if!(ap.arg::() == 16); + continue_if!(ap.arg::() == 'A' as c_char); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Skip Me!")); + ap.copy(|mut ap| { + if compare_c_str(ap.arg::<*const c_char>(), "Correct") { + 0 + } else { + 0xff + } + }) +} diff --git a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c new file mode 100644 index 00000000000..95cf0ef46ca --- /dev/null +++ b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c @@ -0,0 +1,30 @@ +#include +#include +#include +#include +#include + +extern size_t check_list_0(va_list ap); +extern size_t check_list_1(va_list ap); +extern size_t check_list_2(va_list ap); +extern size_t check_list_copy_0(va_list ap); + +int test_rust(size_t (*fn)(va_list), ...) { + size_t ret = 0; + va_list ap; + va_start(ap, fn); + ret = fn(ap); + va_end(ap); + return ret; +} + +int main(int argc, char* argv[]) { + assert(test_rust(check_list_0, 0x01LL, 0x02, 0x03LL) == 0); + + assert(test_rust(check_list_1, -1, 'A', '4', ';', 0x32, 0x10000001, "Valid!") == 0); + + assert(test_rust(check_list_2, 3.14, 12l, 'a', 6.28, "Hello", 42, "World") == 0); + + assert(test_rust(check_list_copy_0, 6.28, 16, 'A', "Skip Me!", "Correct") == 0); + return 0; +} diff --git a/src/test/run-make-fulldeps/c-static-dylib/bar.rs b/src/test/run-make-fulldeps/c-static-dylib/bar.rs index 37b120decd1..b8c798ffdb4 100644 --- a/src/test/run-make-fulldeps/c-static-dylib/bar.rs +++ b/src/test/run-make-fulldeps/c-static-dylib/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() { diff --git a/src/test/run-make-fulldeps/c-static-dylib/foo.rs b/src/test/run-make-fulldeps/c-static-dylib/foo.rs index 44be5ac890d..25e1ed2a9d3 100644 --- a/src/test/run-make-fulldeps/c-static-dylib/foo.rs +++ b/src/test/run-make-fulldeps/c-static-dylib/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] #[link(name = "cfoo", kind = "static")] diff --git a/src/test/run-make-fulldeps/c-static-rlib/bar.rs b/src/test/run-make-fulldeps/c-static-rlib/bar.rs index 37b120decd1..b8c798ffdb4 100644 --- a/src/test/run-make-fulldeps/c-static-rlib/bar.rs +++ b/src/test/run-make-fulldeps/c-static-rlib/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() { diff --git a/src/test/run-make-fulldeps/c-static-rlib/foo.rs b/src/test/run-make-fulldeps/c-static-rlib/foo.rs index cbd7b020bd8..d434ecfa8bb 100644 --- a/src/test/run-make-fulldeps/c-static-rlib/foo.rs +++ b/src/test/run-make-fulldeps/c-static-rlib/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #[link(name = "cfoo", kind = "static")] diff --git a/src/test/run-make-fulldeps/cdylib-fewer-symbols/foo.rs b/src/test/run-make-fulldeps/cdylib-fewer-symbols/foo.rs index 4ec8d4ee860..5a6f7c45bd2 100644 --- a/src/test/run-make-fulldeps/cdylib-fewer-symbols/foo.rs +++ b/src/test/run-make-fulldeps/cdylib-fewer-symbols/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "cdylib"] #[no_mangle] diff --git a/src/test/run-make-fulldeps/cdylib/bar.rs b/src/test/run-make-fulldeps/cdylib/bar.rs index 2c97298604c..fe665abc7c1 100644 --- a/src/test/run-make-fulldeps/cdylib/bar.rs +++ b/src/test/run-make-fulldeps/cdylib/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub fn bar() { diff --git a/src/test/run-make-fulldeps/cdylib/foo.c b/src/test/run-make-fulldeps/cdylib/foo.c index 1c950427c65..154f9682ef8 100644 --- a/src/test/run-make-fulldeps/cdylib/foo.c +++ b/src/test/run-make-fulldeps/cdylib/foo.c @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #include extern void foo(); diff --git a/src/test/run-make-fulldeps/cdylib/foo.rs b/src/test/run-make-fulldeps/cdylib/foo.rs index cdac6d19035..c2cc3afcc13 100644 --- a/src/test/run-make-fulldeps/cdylib/foo.rs +++ b/src/test/run-make-fulldeps/cdylib/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "cdylib"] extern crate bar; diff --git a/src/test/run-make-fulldeps/codegen-options-parsing/dummy.rs b/src/test/run-make-fulldeps/codegen-options-parsing/dummy.rs index 8ae3d072362..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/codegen-options-parsing/dummy.rs +++ b/src/test/run-make-fulldeps/codegen-options-parsing/dummy.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/compiler-lookup-paths-2/a.rs b/src/test/run-make-fulldeps/compiler-lookup-paths-2/a.rs index e7572a5f615..83be6e807e0 100644 --- a/src/test/run-make-fulldeps/compiler-lookup-paths-2/a.rs +++ b/src/test/run-make-fulldeps/compiler-lookup-paths-2/a.rs @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] diff --git a/src/test/run-make-fulldeps/compiler-lookup-paths-2/b.rs b/src/test/run-make-fulldeps/compiler-lookup-paths-2/b.rs index fee0da9b4c1..1be6cbc919d 100644 --- a/src/test/run-make-fulldeps/compiler-lookup-paths-2/b.rs +++ b/src/test/run-make-fulldeps/compiler-lookup-paths-2/b.rs @@ -1,12 +1,2 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] extern crate a; diff --git a/src/test/run-make-fulldeps/compiler-lookup-paths-2/c.rs b/src/test/run-make-fulldeps/compiler-lookup-paths-2/c.rs index 66fe51d1099..e37bc2e1dce 100644 --- a/src/test/run-make-fulldeps/compiler-lookup-paths-2/c.rs +++ b/src/test/run-make-fulldeps/compiler-lookup-paths-2/c.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] extern crate b; extern crate a; diff --git a/src/test/run-make-fulldeps/compiler-lookup-paths/a.rs b/src/test/run-make-fulldeps/compiler-lookup-paths/a.rs index 4ddf231fba2..83be6e807e0 100644 --- a/src/test/run-make-fulldeps/compiler-lookup-paths/a.rs +++ b/src/test/run-make-fulldeps/compiler-lookup-paths/a.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] diff --git a/src/test/run-make-fulldeps/compiler-lookup-paths/b.rs b/src/test/run-make-fulldeps/compiler-lookup-paths/b.rs index c38300f976e..1be6cbc919d 100644 --- a/src/test/run-make-fulldeps/compiler-lookup-paths/b.rs +++ b/src/test/run-make-fulldeps/compiler-lookup-paths/b.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] extern crate a; diff --git a/src/test/run-make-fulldeps/compiler-lookup-paths/c.rs b/src/test/run-make-fulldeps/compiler-lookup-paths/c.rs index b5c54558a4f..4c7ce01b6a0 100644 --- a/src/test/run-make-fulldeps/compiler-lookup-paths/c.rs +++ b/src/test/run-make-fulldeps/compiler-lookup-paths/c.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] extern crate b; diff --git a/src/test/run-make-fulldeps/compiler-lookup-paths/d.rs b/src/test/run-make-fulldeps/compiler-lookup-paths/d.rs index 295b6e00e41..ca2676cf67d 100644 --- a/src/test/run-make-fulldeps/compiler-lookup-paths/d.rs +++ b/src/test/run-make-fulldeps/compiler-lookup-paths/d.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #[link(name = "native", kind = "static")] diff --git a/src/test/run-make-fulldeps/compiler-lookup-paths/e.rs b/src/test/run-make-fulldeps/compiler-lookup-paths/e.rs index c0407aba7c9..18eb60aca97 100644 --- a/src/test/run-make-fulldeps/compiler-lookup-paths/e.rs +++ b/src/test/run-make-fulldeps/compiler-lookup-paths/e.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "e"] #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/compiler-lookup-paths/e2.rs b/src/test/run-make-fulldeps/compiler-lookup-paths/e2.rs index f8c8c029c0b..cbf08b98e7e 100644 --- a/src/test/run-make-fulldeps/compiler-lookup-paths/e2.rs +++ b/src/test/run-make-fulldeps/compiler-lookup-paths/e2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "e"] #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/compiler-lookup-paths/f.rs b/src/test/run-make-fulldeps/compiler-lookup-paths/f.rs index e6160422576..483deaaea49 100644 --- a/src/test/run-make-fulldeps/compiler-lookup-paths/f.rs +++ b/src/test/run-make-fulldeps/compiler-lookup-paths/f.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] extern crate e; diff --git a/src/test/run-make-fulldeps/compiler-lookup-paths/native.c b/src/test/run-make-fulldeps/compiler-lookup-paths/native.c index 30669470522..d11c69f812a 100644 --- a/src/test/run-make-fulldeps/compiler-lookup-paths/native.c +++ b/src/test/run-make-fulldeps/compiler-lookup-paths/native.c @@ -1,9 +1 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// intentionally empty diff --git a/src/test/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs b/src/test/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs index 293f9d58294..7b5c740cb49 100644 --- a/src/test/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs +++ b/src/test/run-make-fulldeps/compiler-rt-works-on-mingw/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { fn foo(); } pub fn main() { diff --git a/src/test/run-make-fulldeps/crate-data-smoke/crate.rs b/src/test/run-make-fulldeps/crate-data-smoke/crate.rs index 305b3dc70a6..a48a6f51c42 100644 --- a/src/test/run-make-fulldeps/crate-data-smoke/crate.rs +++ b/src/test/run-make-fulldeps/crate-data-smoke/crate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // Querying about the crate metadata should *not* parse the entire crate, it diff --git a/src/test/run-make-fulldeps/crate-data-smoke/lib.rs b/src/test/run-make-fulldeps/crate-data-smoke/lib.rs index 639a5d0387b..8002f11ec87 100644 --- a/src/test/run-make-fulldeps/crate-data-smoke/lib.rs +++ b/src/test/run-make-fulldeps/crate-data-smoke/lib.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "mylib"] #![crate_type = "lib"] diff --git a/src/test/run-make-fulldeps/crate-data-smoke/rlib.rs b/src/test/run-make-fulldeps/crate-data-smoke/rlib.rs index 4e093748600..47fcce4a7f6 100644 --- a/src/test/run-make-fulldeps/crate-data-smoke/rlib.rs +++ b/src/test/run-make-fulldeps/crate-data-smoke/rlib.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "mylib"] #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/crate-name-priority/foo.rs b/src/test/run-make-fulldeps/crate-name-priority/foo.rs index 8ae3d072362..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/crate-name-priority/foo.rs +++ b/src/test/run-make-fulldeps/crate-name-priority/foo.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/crate-name-priority/foo1.rs b/src/test/run-make-fulldeps/crate-name-priority/foo1.rs index a397d6bc749..4ff3bd9516b 100644 --- a/src/test/run-make-fulldeps/crate-name-priority/foo1.rs +++ b/src/test/run-make-fulldeps/crate-name-priority/foo1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] fn main() {} diff --git a/src/test/run-make-fulldeps/cross-lang-lto-clang/Makefile b/src/test/run-make-fulldeps/cross-lang-lto-clang/Makefile new file mode 100644 index 00000000000..cf687070bc2 --- /dev/null +++ b/src/test/run-make-fulldeps/cross-lang-lto-clang/Makefile @@ -0,0 +1,25 @@ +# needs-matching-clang + +# This test makes sure that cross-language inlining actually works by checking +# the generated machine code. + +-include ../tools.mk + +all: cpp-executable rust-executable + +cpp-executable: + $(RUSTC) -Zcross-lang-lto=on -o $(TMPDIR)/librustlib-xlto.a -Copt-level=2 -Ccodegen-units=1 ./rustlib.rs + $(CLANG) -flto=thin -fuse-ld=lld -L $(TMPDIR) -lrustlib-xlto -o $(TMPDIR)/cmain ./cmain.c -O3 + # Make sure we don't find a call instruction to the function we expect to + # always be inlined. + llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -v -e "call.*rust_always_inlined" + # As a sanity check, make sure we do find a call instruction to a + # non-inlined function + llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -e "call.*rust_never_inlined" + +rust-executable: + $(CLANG) ./clib.c -flto=thin -c -o $(TMPDIR)/clib.o -O2 + (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) + $(RUSTC) -Zcross-lang-lto=on -L$(TMPDIR) -Copt-level=2 -Clinker=$(CLANG) -Clink-arg=-fuse-ld=lld ./main.rs -o $(TMPDIR)/rsmain + llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -e "call.*c_never_inlined" + llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -v -e "call.*c_always_inlined" diff --git a/src/test/run-make-fulldeps/cross-lang-lto-clang/clib.c b/src/test/run-make-fulldeps/cross-lang-lto-clang/clib.c new file mode 100644 index 00000000000..90f33f24dc4 --- /dev/null +++ b/src/test/run-make-fulldeps/cross-lang-lto-clang/clib.c @@ -0,0 +1,9 @@ +#include + +uint32_t c_always_inlined() { + return 1234; +} + +__attribute__((noinline)) uint32_t c_never_inlined() { + return 12345; +} diff --git a/src/test/run-make-fulldeps/cross-lang-lto-clang/cmain.c b/src/test/run-make-fulldeps/cross-lang-lto-clang/cmain.c new file mode 100644 index 00000000000..e62a40117ce --- /dev/null +++ b/src/test/run-make-fulldeps/cross-lang-lto-clang/cmain.c @@ -0,0 +1,12 @@ +#include + +// A trivial function defined in Rust, returning a constant value. This should +// always be inlined. +uint32_t rust_always_inlined(); + + +uint32_t rust_never_inlined(); + +int main(int argc, char** argv) { + return rust_never_inlined() + rust_always_inlined(); +} diff --git a/src/test/run-make-fulldeps/cross-lang-lto-clang/main.rs b/src/test/run-make-fulldeps/cross-lang-lto-clang/main.rs new file mode 100644 index 00000000000..8129dcb85d9 --- /dev/null +++ b/src/test/run-make-fulldeps/cross-lang-lto-clang/main.rs @@ -0,0 +1,11 @@ +#[link(name = "xyz")] +extern "C" { + fn c_always_inlined() -> u32; + fn c_never_inlined() -> u32; +} + +fn main() { + unsafe { + println!("blub: {}", c_always_inlined() + c_never_inlined()); + } +} diff --git a/src/test/run-make-fulldeps/cross-lang-lto-clang/rustlib.rs b/src/test/run-make-fulldeps/cross-lang-lto-clang/rustlib.rs new file mode 100644 index 00000000000..8a74d74a420 --- /dev/null +++ b/src/test/run-make-fulldeps/cross-lang-lto-clang/rustlib.rs @@ -0,0 +1,12 @@ +#![crate_type="staticlib"] + +#[no_mangle] +pub extern "C" fn rust_always_inlined() -> u32 { + 42 +} + +#[no_mangle] +#[inline(never)] +pub extern "C" fn rust_never_inlined() -> u32 { + 421 +} diff --git a/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs/Makefile b/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs/Makefile index 0a6f226a027..4f33b1c59e0 100644 --- a/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs/Makefile +++ b/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs/Makefile @@ -1,6 +1,9 @@ - -include ../tools.mk +# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same +# (so fixing it is harder). See #57765 for context +ifndef IS_WINDOWS + # This test makes sure that we don't loose upstream object files when compiling # staticlibs with -Zcross-lang-lto @@ -9,7 +12,7 @@ all: staticlib.rs upstream.rs # Check No LTO $(RUSTC) staticlib.rs -Z cross-lang-lto -Ccodegen-units=1 -L. -o $(TMPDIR)/staticlib.a - (cd $(TMPDIR); llvm-ar x ./staticlib.a) + (cd $(TMPDIR); $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-ar x ./staticlib.a) # Make sure the upstream object file was included ls $(TMPDIR)/upstream.*.rcgu.o @@ -19,5 +22,11 @@ all: staticlib.rs upstream.rs # Check ThinLTO $(RUSTC) upstream.rs -Z cross-lang-lto -Ccodegen-units=1 -Clto=thin $(RUSTC) staticlib.rs -Z cross-lang-lto -Ccodegen-units=1 -Clto=thin -L. -o $(TMPDIR)/staticlib.a - (cd $(TMPDIR); llvm-ar x ./staticlib.a) + (cd $(TMPDIR); $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-ar x ./staticlib.a) ls $(TMPDIR)/upstream.*.rcgu.o + +else + +all: + +endif diff --git a/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs/staticlib.rs b/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs/staticlib.rs index b370b7b859d..b24522e7f0e 100644 --- a/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs/staticlib.rs +++ b/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs/staticlib.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="staticlib"] extern crate upstream; diff --git a/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs/upstream.rs b/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs/upstream.rs index a79b9bf08fc..bd6820098ee 100644 --- a/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs/upstream.rs +++ b/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs/upstream.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub fn foo() {} diff --git a/src/test/run-make-fulldeps/cross-lang-lto/Makefile b/src/test/run-make-fulldeps/cross-lang-lto/Makefile index 1d072e03de3..57a19a0ccb0 100644 --- a/src/test/run-make-fulldeps/cross-lang-lto/Makefile +++ b/src/test/run-make-fulldeps/cross-lang-lto/Makefile @@ -1,12 +1,17 @@ -include ../tools.mk +# ignore windows due to libLLVM being present in PATH and the PATH and library path being the same +# (so fixing it is harder). See #57765 for context +ifndef IS_WINDOWS + # This test makes sure that the object files we generate are actually # LLVM bitcode files (as used by linker LTO plugins) when compiling with # -Z cross-lang-lto. -ASSERT_IS_BITCODE_OBJ=llvm-bcanalyzer # this only succeeds for bitcode files -EXTRACT_OBJS=(cd $(TMPDIR); rm -f ./*.o; llvm-ar x $(1)) +# this only succeeds for bitcode files +ASSERT_IS_BITCODE_OBJ=($(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-bcanalyzer $(1)) +EXTRACT_OBJS=(cd $(TMPDIR); rm -f ./*.o; $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-ar x $(1)) BUILD_LIB=$(RUSTC) lib.rs -Copt-level=2 -Z cross-lang-lto=on -Ccodegen-units=1 BUILD_EXE=$(RUSTC) main.rs -Copt-level=2 -Z cross-lang-lto=on -Ccodegen-units=1 --emit=obj @@ -16,31 +21,37 @@ all: staticlib staticlib-fat-lto staticlib-thin-lto rlib exe cdylib rdylib staticlib: lib.rs $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib.a $(call EXTRACT_OBJS, liblib.a) - for file in $(TMPDIR)/liblib.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done + for file in $(TMPDIR)/liblib.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done staticlib-fat-lto: lib.rs $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-fat-lto.a -Clto=fat $(call EXTRACT_OBJS, liblib-fat-lto.a) - for file in $(TMPDIR)/liblib-fat-lto.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done + for file in $(TMPDIR)/liblib-fat-lto.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done staticlib-thin-lto: lib.rs $(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-thin-lto.a -Clto=thin $(call EXTRACT_OBJS, liblib-thin-lto.a) - for file in $(TMPDIR)/liblib-thin-lto.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done + for file in $(TMPDIR)/liblib-thin-lto.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done rlib: lib.rs $(BUILD_LIB) --crate-type=rlib -o $(TMPDIR)/liblib.rlib $(call EXTRACT_OBJS, liblib.rlib) - for file in $(TMPDIR)/liblib.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done + for file in $(TMPDIR)/liblib.*.rcgu.o; do $(call ASSERT_IS_BITCODE_OBJ, $$file); done cdylib: lib.rs $(BUILD_LIB) --crate-type=cdylib --emit=obj -o $(TMPDIR)/cdylib.o - $(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/cdylib.o + $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/cdylib.o) rdylib: lib.rs $(BUILD_LIB) --crate-type=dylib --emit=obj -o $(TMPDIR)/rdylib.o - $(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/rdylib.o + $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/rdylib.o) exe: lib.rs $(BUILD_EXE) -o $(TMPDIR)/exe.o - $(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/exe.o + $(call ASSERT_IS_BITCODE_OBJ, $(TMPDIR)/exe.o) + +else + +all: + +endif diff --git a/src/test/run-make-fulldeps/cross-lang-lto/lib.rs b/src/test/run-make-fulldeps/cross-lang-lto/lib.rs index b2a5b946160..94cfef6ada5 100644 --- a/src/test/run-make-fulldeps/cross-lang-lto/lib.rs +++ b/src/test/run-make-fulldeps/cross-lang-lto/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub extern "C" fn foo() { println!("abc"); diff --git a/src/test/run-make-fulldeps/cross-lang-lto/main.rs b/src/test/run-make-fulldeps/cross-lang-lto/main.rs index ccd34c9e4db..f6320bcb04a 100644 --- a/src/test/run-make-fulldeps/cross-lang-lto/main.rs +++ b/src/test/run-make-fulldeps/cross-lang-lto/main.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("Hello World"); } diff --git a/src/test/run-make-fulldeps/debug-assertions/debug.rs b/src/test/run-make-fulldeps/debug-assertions/debug.rs index 65682cb86c3..76ca60a71c8 100644 --- a/src/test/run-make-fulldeps/debug-assertions/debug.rs +++ b/src/test/run-make-fulldeps/debug-assertions/debug.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #![deny(warnings)] diff --git a/src/test/run-make-fulldeps/dep-info-doesnt-run-much/foo.rs b/src/test/run-make-fulldeps/dep-info-doesnt-run-much/foo.rs index 35911821044..316e681293e 100644 --- a/src/test/run-make-fulldeps/dep-info-doesnt-run-much/foo.rs +++ b/src/test/run-make-fulldeps/dep-info-doesnt-run-much/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We're only emitting dep info, so we shouldn't be running static analysis to // figure out that this program is erroneous. fn main() { diff --git a/src/test/run-make-fulldeps/dep-info-spaces/bar.rs b/src/test/run-make-fulldeps/dep-info-spaces/bar.rs index 4c79f7e2855..c5c0bc606cd 100644 --- a/src/test/run-make-fulldeps/dep-info-spaces/bar.rs +++ b/src/test/run-make-fulldeps/dep-info-spaces/bar.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn bar() {} diff --git a/src/test/run-make-fulldeps/dep-info-spaces/foo foo.rs b/src/test/run-make-fulldeps/dep-info-spaces/foo foo.rs index 2661b1f4eb4..b76b4321d62 100644 --- a/src/test/run-make-fulldeps/dep-info-spaces/foo foo.rs +++ b/src/test/run-make-fulldeps/dep-info-spaces/foo foo.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} diff --git a/src/test/run-make-fulldeps/dep-info-spaces/lib.rs b/src/test/run-make-fulldeps/dep-info-spaces/lib.rs index bfbe41baeac..6264e7b67ec 100644 --- a/src/test/run-make-fulldeps/dep-info-spaces/lib.rs +++ b/src/test/run-make-fulldeps/dep-info-spaces/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[path="foo foo.rs"] pub mod foo; diff --git a/src/test/run-make-fulldeps/dep-info/bar.rs b/src/test/run-make-fulldeps/dep-info/bar.rs index 4c79f7e2855..c5c0bc606cd 100644 --- a/src/test/run-make-fulldeps/dep-info/bar.rs +++ b/src/test/run-make-fulldeps/dep-info/bar.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn bar() {} diff --git a/src/test/run-make-fulldeps/dep-info/foo.rs b/src/test/run-make-fulldeps/dep-info/foo.rs index 2661b1f4eb4..b76b4321d62 100644 --- a/src/test/run-make-fulldeps/dep-info/foo.rs +++ b/src/test/run-make-fulldeps/dep-info/foo.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} diff --git a/src/test/run-make-fulldeps/dep-info/lib.rs b/src/test/run-make-fulldeps/dep-info/lib.rs index 7c15785bbb2..eb8631259d4 100644 --- a/src/test/run-make-fulldeps/dep-info/lib.rs +++ b/src/test/run-make-fulldeps/dep-info/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub mod foo; diff --git a/src/test/run-make-fulldeps/dep-info/lib2.rs b/src/test/run-make-fulldeps/dep-info/lib2.rs index 1b70fb4eb4b..f4fda9c93c5 100644 --- a/src/test/run-make-fulldeps/dep-info/lib2.rs +++ b/src/test/run-make-fulldeps/dep-info/lib2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub mod foo; diff --git a/src/test/run-make-fulldeps/duplicate-output-flavors/foo.rs b/src/test/run-make-fulldeps/duplicate-output-flavors/foo.rs index 04d3ae67207..c1bfaa6cab5 100644 --- a/src/test/run-make-fulldeps/duplicate-output-flavors/foo.rs +++ b/src/test/run-make-fulldeps/duplicate-output-flavors/foo.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/dylib-chain/m1.rs b/src/test/run-make-fulldeps/dylib-chain/m1.rs index 5437c935c4e..08c3f37522c 100644 --- a/src/test/run-make-fulldeps/dylib-chain/m1.rs +++ b/src/test/run-make-fulldeps/dylib-chain/m1.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] pub fn m1() {} diff --git a/src/test/run-make-fulldeps/dylib-chain/m2.rs b/src/test/run-make-fulldeps/dylib-chain/m2.rs index b464f32eae2..62176ddc9f3 100644 --- a/src/test/run-make-fulldeps/dylib-chain/m2.rs +++ b/src/test/run-make-fulldeps/dylib-chain/m2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] extern crate m1; diff --git a/src/test/run-make-fulldeps/dylib-chain/m3.rs b/src/test/run-make-fulldeps/dylib-chain/m3.rs index bf431cc827b..d213aeda9ac 100644 --- a/src/test/run-make-fulldeps/dylib-chain/m3.rs +++ b/src/test/run-make-fulldeps/dylib-chain/m3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] extern crate m2; diff --git a/src/test/run-make-fulldeps/dylib-chain/m4.rs b/src/test/run-make-fulldeps/dylib-chain/m4.rs index 6c2a6685802..fa8ec6079de 100644 --- a/src/test/run-make-fulldeps/dylib-chain/m4.rs +++ b/src/test/run-make-fulldeps/dylib-chain/m4.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate m3; fn main() { m3::m3() } diff --git a/src/test/run-make-fulldeps/emit-stack-sizes/foo.rs b/src/test/run-make-fulldeps/emit-stack-sizes/foo.rs index 6c81b63963a..ee51ae32886 100644 --- a/src/test/run-make-fulldeps/emit-stack-sizes/foo.rs +++ b/src/test/run-make-fulldeps/emit-stack-sizes/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub fn foo() {} diff --git a/src/test/run-make-fulldeps/emit/test-24876.rs b/src/test/run-make-fulldeps/emit/test-24876.rs index ab69decbf00..734e2ee4bd4 100644 --- a/src/test/run-make-fulldeps/emit/test-24876.rs +++ b/src/test/run-make-fulldeps/emit/test-24876.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks for issue #24876 fn main() { diff --git a/src/test/run-make-fulldeps/emit/test-26235.rs b/src/test/run-make-fulldeps/emit/test-26235.rs index 97b58a3671b..07d975f3317 100644 --- a/src/test/run-make-fulldeps/emit/test-26235.rs +++ b/src/test/run-make-fulldeps/emit/test-26235.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks for issue #26235 fn main() { diff --git a/src/test/run-make-fulldeps/error-found-staticlib-instead-crate/bar.rs b/src/test/run-make-fulldeps/error-found-staticlib-instead-crate/bar.rs index 5ab3e5ee99d..fe35f1f8e2e 100644 --- a/src/test/run-make-fulldeps/error-found-staticlib-instead-crate/bar.rs +++ b/src/test/run-make-fulldeps/error-found-staticlib-instead-crate/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() { diff --git a/src/test/run-make-fulldeps/error-found-staticlib-instead-crate/foo.rs b/src/test/run-make-fulldeps/error-found-staticlib-instead-crate/foo.rs index 222d98a12de..b76b4321d62 100644 --- a/src/test/run-make-fulldeps/error-found-staticlib-instead-crate/foo.rs +++ b/src/test/run-make-fulldeps/error-found-staticlib-instead-crate/foo.rs @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} diff --git a/src/test/run-make-fulldeps/error-writing-dependencies/foo.rs b/src/test/run-make-fulldeps/error-writing-dependencies/foo.rs index 8ae3d072362..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/error-writing-dependencies/foo.rs +++ b/src/test/run-make-fulldeps/error-writing-dependencies/foo.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/exit-code/compile-error.rs b/src/test/run-make-fulldeps/exit-code/compile-error.rs index 8c05318a508..a96c197606c 100644 --- a/src/test/run-make-fulldeps/exit-code/compile-error.rs +++ b/src/test/run-make-fulldeps/exit-code/compile-error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { compile_error!("kaboom"); } diff --git a/src/test/run-make-fulldeps/exit-code/lint-failure.rs b/src/test/run-make-fulldeps/exit-code/lint-failure.rs index 910abfd5d7e..70bdddc6246 100644 --- a/src/test/run-make-fulldeps/exit-code/lint-failure.rs +++ b/src/test/run-make-fulldeps/exit-code/lint-failure.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(intra_doc_link_resolution_failure)] /// [intradoc::failure] diff --git a/src/test/run-make-fulldeps/exit-code/success.rs b/src/test/run-make-fulldeps/exit-code/success.rs index 9f6c5734a30..55b8e42b6e2 100644 --- a/src/test/run-make-fulldeps/exit-code/success.rs +++ b/src/test/run-make-fulldeps/exit-code/success.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Main function fn main() { println!("Hello, world!"); diff --git a/src/test/run-make-fulldeps/extern-diff-internal-name/lib.rs b/src/test/run-make-fulldeps/extern-diff-internal-name/lib.rs index e8779bba13c..ad96f70866e 100644 --- a/src/test/run-make-fulldeps/extern-diff-internal-name/lib.rs +++ b/src/test/run-make-fulldeps/extern-diff-internal-name/lib.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "bar"] #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/extern-diff-internal-name/test.rs b/src/test/run-make-fulldeps/extern-diff-internal-name/test.rs index 11e042c8c4a..4c53dc28a80 100644 --- a/src/test/run-make-fulldeps/extern-diff-internal-name/test.rs +++ b/src/test/run-make-fulldeps/extern-diff-internal-name/test.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_use] extern crate foo; diff --git a/src/test/run-make-fulldeps/extern-flag-disambiguates/a.rs b/src/test/run-make-fulldeps/extern-flag-disambiguates/a.rs index ac92aede789..2b1a3190150 100644 --- a/src/test/run-make-fulldeps/extern-flag-disambiguates/a.rs +++ b/src/test/run-make-fulldeps/extern-flag-disambiguates/a.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "a"] #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/extern-flag-disambiguates/b.rs b/src/test/run-make-fulldeps/extern-flag-disambiguates/b.rs index 8ae238f5a48..1d7a7339ce2 100644 --- a/src/test/run-make-fulldeps/extern-flag-disambiguates/b.rs +++ b/src/test/run-make-fulldeps/extern-flag-disambiguates/b.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "b"] #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/extern-flag-disambiguates/c.rs b/src/test/run-make-fulldeps/extern-flag-disambiguates/c.rs index 6eccdf7e5c8..3f9d143ed2d 100644 --- a/src/test/run-make-fulldeps/extern-flag-disambiguates/c.rs +++ b/src/test/run-make-fulldeps/extern-flag-disambiguates/c.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "c"] #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/extern-flag-disambiguates/d.rs b/src/test/run-make-fulldeps/extern-flag-disambiguates/d.rs index 9923ff83a91..249c6a107ff 100644 --- a/src/test/run-make-fulldeps/extern-flag-disambiguates/d.rs +++ b/src/test/run-make-fulldeps/extern-flag-disambiguates/d.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[cfg(before)] extern crate a; extern crate b; extern crate c; diff --git a/src/test/run-make-fulldeps/extern-flag-fun/bar-alt.rs b/src/test/run-make-fulldeps/extern-flag-fun/bar-alt.rs index d6ebd9d896f..cdc6c27d800 100644 --- a/src/test/run-make-fulldeps/extern-flag-fun/bar-alt.rs +++ b/src/test/run-make-fulldeps/extern-flag-fun/bar-alt.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn f() {} diff --git a/src/test/run-make-fulldeps/extern-flag-fun/bar.rs b/src/test/run-make-fulldeps/extern-flag-fun/bar.rs index e6c76025738..d11c69f812a 100644 --- a/src/test/run-make-fulldeps/extern-flag-fun/bar.rs +++ b/src/test/run-make-fulldeps/extern-flag-fun/bar.rs @@ -1,9 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// intentionally empty diff --git a/src/test/run-make-fulldeps/extern-flag-fun/foo.rs b/src/test/run-make-fulldeps/extern-flag-fun/foo.rs index 52741668640..0edda7d7b88 100644 --- a/src/test/run-make-fulldeps/extern-flag-fun/foo.rs +++ b/src/test/run-make-fulldeps/extern-flag-fun/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate bar; fn main() {} diff --git a/src/test/run-make-fulldeps/extern-flag-rename-transitive/bar.rs b/src/test/run-make-fulldeps/extern-flag-rename-transitive/bar.rs index a14f3ba05b0..94446a07d6c 100644 --- a/src/test/run-make-fulldeps/extern-flag-rename-transitive/bar.rs +++ b/src/test/run-make-fulldeps/extern-flag-rename-transitive/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] extern crate foo; diff --git a/src/test/run-make-fulldeps/extern-flag-rename-transitive/baz.rs b/src/test/run-make-fulldeps/extern-flag-rename-transitive/baz.rs index a96c9f61c66..c3908db3429 100644 --- a/src/test/run-make-fulldeps/extern-flag-rename-transitive/baz.rs +++ b/src/test/run-make-fulldeps/extern-flag-rename-transitive/baz.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] extern crate a; diff --git a/src/test/run-make-fulldeps/extern-flag-rename-transitive/foo.rs b/src/test/run-make-fulldeps/extern-flag-rename-transitive/foo.rs index b18ce024718..c1bfaa6cab5 100644 --- a/src/test/run-make-fulldeps/extern-flag-rename-transitive/foo.rs +++ b/src/test/run-make-fulldeps/extern-flag-rename-transitive/foo.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/extern-fn-generic/test.rs b/src/test/run-make-fulldeps/extern-fn-generic/test.rs index 8f5ff091b3b..0666bf4262d 100644 --- a/src/test/run-make-fulldeps/extern-fn-generic/test.rs +++ b/src/test/run-make-fulldeps/extern-fn-generic/test.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate testcrate; extern "C" fn bar(ts: testcrate::TestStruct) -> T { ts.y } diff --git a/src/test/run-make-fulldeps/extern-fn-generic/testcrate.rs b/src/test/run-make-fulldeps/extern-fn-generic/testcrate.rs index d02c05047c0..f0a721d35e2 100644 --- a/src/test/run-make-fulldeps/extern-fn-generic/testcrate.rs +++ b/src/test/run-make-fulldeps/extern-fn-generic/testcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #[repr(C)] diff --git a/src/test/run-make-fulldeps/extern-fn-mangle/test.rs b/src/test/run-make-fulldeps/extern-fn-mangle/test.rs index 35b5a9278a4..b213534c958 100644 --- a/src/test/run-make-fulldeps/extern-fn-mangle/test.rs +++ b/src/test/run-make-fulldeps/extern-fn-mangle/test.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub extern "C" fn foo() -> i32 { 3 } diff --git a/src/test/run-make-fulldeps/extern-fn-reachable/dylib.rs b/src/test/run-make-fulldeps/extern-fn-reachable/dylib.rs index f24265e7a52..cd017934870 100644 --- a/src/test/run-make-fulldeps/extern-fn-reachable/dylib.rs +++ b/src/test/run-make-fulldeps/extern-fn-reachable/dylib.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] #![allow(dead_code)] diff --git a/src/test/run-make-fulldeps/extern-fn-reachable/main.rs b/src/test/run-make-fulldeps/extern-fn-reachable/main.rs index f0a9e95ed5a..a9d28d1bebe 100644 --- a/src/test/run-make-fulldeps/extern-fn-reachable/main.rs +++ b/src/test/run-make-fulldeps/extern-fn-reachable/main.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_private)] extern crate rustc_metadata; diff --git a/src/test/run-make-fulldeps/extern-fn-struct-passing-abi/test.c b/src/test/run-make-fulldeps/extern-fn-struct-passing-abi/test.c index 25cd6da10b8..136b07129e1 100644 --- a/src/test/run-make-fulldeps/extern-fn-struct-passing-abi/test.c +++ b/src/test/run-make-fulldeps/extern-fn-struct-passing-abi/test.c @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #include #include diff --git a/src/test/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs b/src/test/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs index 54a4f868eb4..615163d9ad2 100644 --- a/src/test/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs +++ b/src/test/run-make-fulldeps/extern-fn-struct-passing-abi/test.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Passing structs via FFI should work regardless of whether // they get passed in multiple registers, byval pointers or the stack diff --git a/src/test/run-make-fulldeps/extern-fn-with-extern-types/test.rs b/src/test/run-make-fulldeps/extern-fn-with-extern-types/test.rs index 9d6c87885b1..6c027cc8f57 100644 --- a/src/test/run-make-fulldeps/extern-fn-with-extern-types/test.rs +++ b/src/test/run-make-fulldeps/extern-fn-with-extern-types/test.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(extern_types)] #[link(name = "ctest", kind = "static")] diff --git a/src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.rs b/src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.rs index d2540ad6154..7d7658ceeb3 100644 --- a/src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.rs +++ b/src/test/run-make-fulldeps/extern-fn-with-packed-struct/test.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[repr(C, packed)] #[derive(Copy, Clone, Debug, PartialEq)] struct Foo { diff --git a/src/test/run-make-fulldeps/extern-fn-with-union/test.rs b/src/test/run-make-fulldeps/extern-fn-with-union/test.rs index f9277ba11f4..007dfdb5e10 100644 --- a/src/test/run-make-fulldeps/extern-fn-with-union/test.rs +++ b/src/test/run-make-fulldeps/extern-fn-with-union/test.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate testcrate; use std::mem; diff --git a/src/test/run-make-fulldeps/extern-fn-with-union/testcrate.rs b/src/test/run-make-fulldeps/extern-fn-with-union/testcrate.rs index 66978c38511..b51526dfcee 100644 --- a/src/test/run-make-fulldeps/extern-fn-with-union/testcrate.rs +++ b/src/test/run-make-fulldeps/extern-fn-with-union/testcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #[repr(C)] diff --git a/src/test/run-make-fulldeps/extern-multiple-copies/bar.rs b/src/test/run-make-fulldeps/extern-multiple-copies/bar.rs index a50f5de384c..c6b3595f677 100644 --- a/src/test/run-make-fulldeps/extern-multiple-copies/bar.rs +++ b/src/test/run-make-fulldeps/extern-multiple-copies/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo2; // foo2 first to exhibit the bug extern crate foo1; diff --git a/src/test/run-make-fulldeps/extern-multiple-copies/foo1.rs b/src/test/run-make-fulldeps/extern-multiple-copies/foo1.rs index 0be200ddcd2..c1bfaa6cab5 100644 --- a/src/test/run-make-fulldeps/extern-multiple-copies/foo1.rs +++ b/src/test/run-make-fulldeps/extern-multiple-copies/foo1.rs @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/extern-multiple-copies/foo2.rs b/src/test/run-make-fulldeps/extern-multiple-copies/foo2.rs index 0be200ddcd2..c1bfaa6cab5 100644 --- a/src/test/run-make-fulldeps/extern-multiple-copies/foo2.rs +++ b/src/test/run-make-fulldeps/extern-multiple-copies/foo2.rs @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/extern-multiple-copies2/bar.rs b/src/test/run-make-fulldeps/extern-multiple-copies2/bar.rs index b8ac34aa53e..b3088152d6a 100644 --- a/src/test/run-make-fulldeps/extern-multiple-copies2/bar.rs +++ b/src/test/run-make-fulldeps/extern-multiple-copies2/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_use] extern crate foo2; // foo2 first to exhibit the bug #[macro_use] diff --git a/src/test/run-make-fulldeps/extern-multiple-copies2/foo1.rs b/src/test/run-make-fulldeps/extern-multiple-copies2/foo1.rs index 1787772053b..4c778e52ff4 100644 --- a/src/test/run-make-fulldeps/extern-multiple-copies2/foo1.rs +++ b/src/test/run-make-fulldeps/extern-multiple-copies2/foo1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub struct A; diff --git a/src/test/run-make-fulldeps/extern-multiple-copies2/foo2.rs b/src/test/run-make-fulldeps/extern-multiple-copies2/foo2.rs index bad10304387..2be103507df 100644 --- a/src/test/run-make-fulldeps/extern-multiple-copies2/foo2.rs +++ b/src/test/run-make-fulldeps/extern-multiple-copies2/foo2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #[macro_use] diff --git a/src/test/run-make-fulldeps/extern-overrides-distribution/libc.rs b/src/test/run-make-fulldeps/extern-overrides-distribution/libc.rs index a489d834a92..ee51ae32886 100644 --- a/src/test/run-make-fulldeps/extern-overrides-distribution/libc.rs +++ b/src/test/run-make-fulldeps/extern-overrides-distribution/libc.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub fn foo() {} diff --git a/src/test/run-make-fulldeps/extern-overrides-distribution/main.rs b/src/test/run-make-fulldeps/extern-overrides-distribution/main.rs index 451841e7368..1290a8c5670 100644 --- a/src/test/run-make-fulldeps/extern-overrides-distribution/main.rs +++ b/src/test/run-make-fulldeps/extern-overrides-distribution/main.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate libc; fn main() { diff --git a/src/test/run-make-fulldeps/extern-prelude/basic.rs b/src/test/run-make-fulldeps/extern-prelude/basic.rs index b8d6a772e2a..dc7cc1f27b6 100644 --- a/src/test/run-make-fulldeps/extern-prelude/basic.rs +++ b/src/test/run-make-fulldeps/extern-prelude/basic.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(extern_prelude)] fn main() { diff --git a/src/test/run-make-fulldeps/extern-prelude/ep-lib.rs b/src/test/run-make-fulldeps/extern-prelude/ep-lib.rs index dac0a3ce760..f5e129eca66 100644 --- a/src/test/run-make-fulldeps/extern-prelude/ep-lib.rs +++ b/src/test/run-make-fulldeps/extern-prelude/ep-lib.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub struct S; diff --git a/src/test/run-make-fulldeps/extern-prelude/ep-vec.rs b/src/test/run-make-fulldeps/extern-prelude/ep-vec.rs index f750a26f9e6..148a4a98726 100644 --- a/src/test/run-make-fulldeps/extern-prelude/ep-vec.rs +++ b/src/test/run-make-fulldeps/extern-prelude/ep-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub fn new(arg1: f32, arg2: ()) {} diff --git a/src/test/run-make-fulldeps/extern-prelude/relative-only.rs b/src/test/run-make-fulldeps/extern-prelude/relative-only.rs index 0cd56b93de6..0fdf3b49d96 100644 --- a/src/test/run-make-fulldeps/extern-prelude/relative-only.rs +++ b/src/test/run-make-fulldeps/extern-prelude/relative-only.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Extern prelude names are not available by absolute paths #![feature(extern_prelude)] diff --git a/src/test/run-make-fulldeps/extern-prelude/shadow-mod.rs b/src/test/run-make-fulldeps/extern-prelude/shadow-mod.rs index 52213c8d4f9..69411aaf57c 100644 --- a/src/test/run-make-fulldeps/extern-prelude/shadow-mod.rs +++ b/src/test/run-make-fulldeps/extern-prelude/shadow-mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Local module shadows `ep_lib` from extern prelude mod ep_lib { diff --git a/src/test/run-make-fulldeps/extern-prelude/shadow-prelude.rs b/src/test/run-make-fulldeps/extern-prelude/shadow-prelude.rs index de1c4d16d39..6c6ce12708d 100644 --- a/src/test/run-make-fulldeps/extern-prelude/shadow-prelude.rs +++ b/src/test/run-make-fulldeps/extern-prelude/shadow-prelude.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Extern prelude shadows standard library prelude #![feature(extern_prelude)] diff --git a/src/test/run-make-fulldeps/extra-filename-with-temp-outputs/foo.rs b/src/test/run-make-fulldeps/extra-filename-with-temp-outputs/foo.rs index 8ae3d072362..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/extra-filename-with-temp-outputs/foo.rs +++ b/src/test/run-make-fulldeps/extra-filename-with-temp-outputs/foo.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/fpic/hello.rs b/src/test/run-make-fulldeps/fpic/hello.rs index a9e231b0ea8..45590d86ba6 100644 --- a/src/test/run-make-fulldeps/fpic/hello.rs +++ b/src/test/run-make-fulldeps/fpic/hello.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { } diff --git a/src/test/run-make-fulldeps/hir-tree/input.rs b/src/test/run-make-fulldeps/hir-tree/input.rs index 12adc083bcd..9d1a4e9e47d 100644 --- a/src/test/run-make-fulldeps/hir-tree/input.rs +++ b/src/test/run-make-fulldeps/hir-tree/input.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("Hello, Rustaceans!"); } diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/some_crate.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/some_crate.rs index bfa8b6b3ef6..da27b7f3463 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/some_crate.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/some_crate.rs @@ -1,12 +1,2 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(no_core)] #![no_core] diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index 1fd3ce5ae36..20c599293f2 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_private)] extern crate syntax; @@ -79,5 +69,5 @@ impl CodegenBackend for TheBackend { /// This is the entrypoint for a hot plugged rustc_codegen_llvm #[no_mangle] pub fn __rustc_codegen_backend() -> Box { - Box::new(TheBackend(MetadataOnlyCodegenBackend::new())) + Box::new(TheBackend(MetadataOnlyCodegenBackend::boxed())) } diff --git a/src/test/run-make-fulldeps/include_bytes_deps/main.rs b/src/test/run-make-fulldeps/include_bytes_deps/main.rs index 27ca1a46a50..00ad0eb8d50 100644 --- a/src/test/run-make-fulldeps/include_bytes_deps/main.rs +++ b/src/test/run-make-fulldeps/include_bytes_deps/main.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(external_doc)] #[doc(include="input.md")] diff --git a/src/test/run-make-fulldeps/inline-always-many-cgu/foo.rs b/src/test/run-make-fulldeps/inline-always-many-cgu/foo.rs index 9d17473b2b6..76bdb4ab252 100644 --- a/src/test/run-make-fulldeps/inline-always-many-cgu/foo.rs +++ b/src/test/run-make-fulldeps/inline-always-many-cgu/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #![no_trace] diff --git a/src/test/run-make-fulldeps/interdependent-c-libraries/bar.rs b/src/test/run-make-fulldeps/interdependent-c-libraries/bar.rs index 1963976b4b0..2794be53ce4 100644 --- a/src/test/run-make-fulldeps/interdependent-c-libraries/bar.rs +++ b/src/test/run-make-fulldeps/interdependent-c-libraries/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] extern crate foo; diff --git a/src/test/run-make-fulldeps/interdependent-c-libraries/foo.rs b/src/test/run-make-fulldeps/interdependent-c-libraries/foo.rs index 7a0fe6bb18f..891c47d61de 100644 --- a/src/test/run-make-fulldeps/interdependent-c-libraries/foo.rs +++ b/src/test/run-make-fulldeps/interdependent-c-libraries/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #[link(name = "foo", kind = "static")] diff --git a/src/test/run-make-fulldeps/interdependent-c-libraries/main.rs b/src/test/run-make-fulldeps/interdependent-c-libraries/main.rs index f42e3dd44a9..2aba427df47 100644 --- a/src/test/run-make-fulldeps/interdependent-c-libraries/main.rs +++ b/src/test/run-make-fulldeps/interdependent-c-libraries/main.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; extern crate bar; diff --git a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs index 1b8b644dd78..936001c43a4 100644 --- a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs +++ b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(asm)] #![crate_type="lib"] diff --git a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs index de63809ab66..00b09cb9460 100644 --- a/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs +++ b/src/test/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(asm, core_intrinsics)] #![crate_type="lib"] diff --git a/src/test/run-make-fulldeps/invalid-library/foo.rs b/src/test/run-make-fulldeps/invalid-library/foo.rs index 6316cfa3bba..bb7b36c496e 100644 --- a/src/test/run-make-fulldeps/invalid-library/foo.rs +++ b/src/test/run-make-fulldeps/invalid-library/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() {} diff --git a/src/test/run-make-fulldeps/issue-11908/bar.rs b/src/test/run-make-fulldeps/issue-11908/bar.rs index 6316cfa3bba..bb7b36c496e 100644 --- a/src/test/run-make-fulldeps/issue-11908/bar.rs +++ b/src/test/run-make-fulldeps/issue-11908/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() {} diff --git a/src/test/run-make-fulldeps/issue-11908/foo.rs b/src/test/run-make-fulldeps/issue-11908/foo.rs index 0858d3c4e47..82b2dfe9fdb 100644 --- a/src/test/run-make-fulldeps/issue-11908/foo.rs +++ b/src/test/run-make-fulldeps/issue-11908/foo.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] diff --git a/src/test/run-make-fulldeps/issue-14500/bar.rs b/src/test/run-make-fulldeps/issue-14500/bar.rs index 4b4916fe96d..49af74e1b74 100644 --- a/src/test/run-make-fulldeps/issue-14500/bar.rs +++ b/src/test/run-make-fulldeps/issue-14500/bar.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; diff --git a/src/test/run-make-fulldeps/issue-14500/foo.c b/src/test/run-make-fulldeps/issue-14500/foo.c index e84b5509c50..2353d400df3 100644 --- a/src/test/run-make-fulldeps/issue-14500/foo.c +++ b/src/test/run-make-fulldeps/issue-14500/foo.c @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern void foo(); extern char FOO_STATIC; diff --git a/src/test/run-make-fulldeps/issue-14500/foo.rs b/src/test/run-make-fulldeps/issue-14500/foo.rs index a91d8d6a21d..feebef1a6d0 100644 --- a/src/test/run-make-fulldeps/issue-14500/foo.rs +++ b/src/test/run-make-fulldeps/issue-14500/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub extern fn foo() {} diff --git a/src/test/run-make-fulldeps/issue-14698/foo.rs b/src/test/run-make-fulldeps/issue-14698/foo.rs index 7dc79f2043b..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/issue-14698/foo.rs +++ b/src/test/run-make-fulldeps/issue-14698/foo.rs @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/issue-15460/bar.rs b/src/test/run-make-fulldeps/issue-15460/bar.rs index 46777f7fbd2..e66aeb6bd39 100644 --- a/src/test/run-make-fulldeps/issue-15460/bar.rs +++ b/src/test/run-make-fulldeps/issue-15460/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() { unsafe { foo::foo() } diff --git a/src/test/run-make-fulldeps/issue-15460/foo.rs b/src/test/run-make-fulldeps/issue-15460/foo.rs index 6917fa55579..9beafd9ff35 100644 --- a/src/test/run-make-fulldeps/issue-15460/foo.rs +++ b/src/test/run-make-fulldeps/issue-15460/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] #[link(name = "foo", kind = "static")] diff --git a/src/test/run-make-fulldeps/issue-18943/foo.rs b/src/test/run-make-fulldeps/issue-18943/foo.rs index aadf0f593e7..0b29c871280 100644 --- a/src/test/run-make-fulldeps/issue-18943/foo.rs +++ b/src/test/run-make-fulldeps/issue-18943/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { } trait Bar { } diff --git a/src/test/run-make-fulldeps/issue-19371/foo.rs b/src/test/run-make-fulldeps/issue-19371/foo.rs index 4dfecb33c14..b8461c568c8 100644 --- a/src/test/run-make-fulldeps/issue-19371/foo.rs +++ b/src/test/run-make-fulldeps/issue-19371/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_private)] extern crate rustc; @@ -72,7 +62,8 @@ fn compile(code: String, output: PathBuf, sysroot: PathBuf) { driver::spawn_thread_pool(opts, |opts| { let (sess, cstore, codegen_backend) = basic_sess(opts); let control = CompileController::basic(); - let input = Input::Str { name: FileName::Anon, input: code }; + let name = FileName::anon_source_code(&code); + let input = Input::Str { name, input: code }; let _ = compile_input( codegen_backend, &sess, diff --git a/src/test/run-make-fulldeps/issue-20626/foo.rs b/src/test/run-make-fulldeps/issue-20626/foo.rs index 9f727607e4e..a474e234e72 100644 --- a/src/test/run-make-fulldeps/issue-20626/foo.rs +++ b/src/test/run-make-fulldeps/issue-20626/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn identity(a: &u32) -> &u32 { a } fn print_foo(f: &fn(&u32) -> &u32, x: &u32) { diff --git a/src/test/run-make-fulldeps/issue-22131/Makefile b/src/test/run-make-fulldeps/issue-22131/Makefile index 6db737a9e72..d76aaf5c146 100644 --- a/src/test/run-make-fulldeps/issue-22131/Makefile +++ b/src/test/run-make-fulldeps/issue-22131/Makefile @@ -4,4 +4,4 @@ all: foo.rs $(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs $(RUSTDOC) --test --cfg 'feature="bar"' \ -L $(TMPDIR) foo.rs |\ - $(CGREP) 'foo.rs - foo (line 11) ... ok' + $(CGREP) 'foo.rs - foo (line 1) ... ok' diff --git a/src/test/run-make-fulldeps/issue-22131/foo.rs b/src/test/run-make-fulldeps/issue-22131/foo.rs index 50c63abc0d4..33255d76879 100644 --- a/src/test/run-make-fulldeps/issue-22131/foo.rs +++ b/src/test/run-make-fulldeps/issue-22131/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// ```rust /// assert_eq!(foo::foo(), 1); /// ``` diff --git a/src/test/run-make-fulldeps/issue-24445/foo.c b/src/test/run-make-fulldeps/issue-24445/foo.c index 775e151f236..bb4036b06e1 100644 --- a/src/test/run-make-fulldeps/issue-24445/foo.c +++ b/src/test/run-make-fulldeps/issue-24445/foo.c @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - void foo(); int main() { diff --git a/src/test/run-make-fulldeps/issue-24445/foo.rs b/src/test/run-make-fulldeps/issue-24445/foo.rs index 65e505df5ef..b67f3847cd4 100644 --- a/src/test/run-make-fulldeps/issue-24445/foo.rs +++ b/src/test/run-make-fulldeps/issue-24445/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "staticlib"] struct Destroy; diff --git a/src/test/run-make-fulldeps/issue-25581/test.rs b/src/test/run-make-fulldeps/issue-25581/test.rs index 6717d16cb7c..5dfa6bb7b69 100644 --- a/src/test/run-make-fulldeps/issue-25581/test.rs +++ b/src/test/run-make-fulldeps/issue-25581/test.rs @@ -1,21 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(libc)] - -extern crate libc; - #[link(name = "test", kind = "static")] extern { - fn slice_len(s: &[u8]) -> libc::size_t; - fn slice_elem(s: &[u8], idx: libc::size_t) -> u8; + fn slice_len(s: &[u8]) -> usize; + fn slice_elem(s: &[u8], idx: usize) -> u8; } fn main() { diff --git a/src/test/run-make-fulldeps/issue-26006/in/libc/lib.rs b/src/test/run-make-fulldeps/issue-26006/in/libc/lib.rs index 177ffdce062..23f2bf51800 100644 --- a/src/test/run-make-fulldeps/issue-26006/in/libc/lib.rs +++ b/src/test/run-make-fulldeps/issue-26006/in/libc/lib.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![crate_type="rlib"] pub fn something(){} diff --git a/src/test/run-make-fulldeps/issue-26006/in/time/lib.rs b/src/test/run-make-fulldeps/issue-26006/in/time/lib.rs index b1d07d57337..87f2f824a36 100644 --- a/src/test/run-make-fulldeps/issue-26006/in/time/lib.rs +++ b/src/test/run-make-fulldeps/issue-26006/in/time/lib.rs @@ -1,13 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; fn main(){} diff --git a/src/test/run-make-fulldeps/issue-26092/blank.rs b/src/test/run-make-fulldeps/issue-26092/blank.rs index 8ae3d072362..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/issue-26092/blank.rs +++ b/src/test/run-make-fulldeps/issue-26092/blank.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/issue-28595/a.c b/src/test/run-make-fulldeps/issue-28595/a.c index feacd7bc313..7bfd83cca21 100644 --- a/src/test/run-make-fulldeps/issue-28595/a.c +++ b/src/test/run-make-fulldeps/issue-28595/a.c @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - void a(void) {} diff --git a/src/test/run-make-fulldeps/issue-28595/a.rs b/src/test/run-make-fulldeps/issue-28595/a.rs index 7377a9f3416..44836415186 100644 --- a/src/test/run-make-fulldeps/issue-28595/a.rs +++ b/src/test/run-make-fulldeps/issue-28595/a.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #[link(name = "a", kind = "static")] diff --git a/src/test/run-make-fulldeps/issue-28595/b.c b/src/test/run-make-fulldeps/issue-28595/b.c index de81fbcaa60..8343f5b229e 100644 --- a/src/test/run-make-fulldeps/issue-28595/b.c +++ b/src/test/run-make-fulldeps/issue-28595/b.c @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern void a(void); void b(void) { diff --git a/src/test/run-make-fulldeps/issue-28595/b.rs b/src/test/run-make-fulldeps/issue-28595/b.rs index 37ff346c3f3..24ab412284d 100644 --- a/src/test/run-make-fulldeps/issue-28595/b.rs +++ b/src/test/run-make-fulldeps/issue-28595/b.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate a; #[link(name = "b", kind = "static")] diff --git a/src/test/run-make-fulldeps/issue-28766/foo.rs b/src/test/run-make-fulldeps/issue-28766/foo.rs index 3ed0a6bfc74..1dcabe42dc1 100644 --- a/src/test/run-make-fulldeps/issue-28766/foo.rs +++ b/src/test/run-make-fulldeps/issue-28766/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub struct Foo(()); diff --git a/src/test/run-make-fulldeps/issue-28766/main.rs b/src/test/run-make-fulldeps/issue-28766/main.rs index d1dadbdc7ad..de12b1fd9dc 100644 --- a/src/test/run-make-fulldeps/issue-28766/main.rs +++ b/src/test/run-make-fulldeps/issue-28766/main.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] extern crate foo; use foo::Foo; diff --git a/src/test/run-make-fulldeps/issue-30063/foo.rs b/src/test/run-make-fulldeps/issue-30063/foo.rs index 45f7a2c2aa6..45590d86ba6 100644 --- a/src/test/run-make-fulldeps/issue-30063/foo.rs +++ b/src/test/run-make-fulldeps/issue-30063/foo.rs @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { } diff --git a/src/test/run-make-fulldeps/issue-33329/main.rs b/src/test/run-make-fulldeps/issue-33329/main.rs index e06c0a5ec2a..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/issue-33329/main.rs +++ b/src/test/run-make-fulldeps/issue-33329/main.rs @@ -1,11 +1 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/issue-35164/Makefile b/src/test/run-make-fulldeps/issue-35164/Makefile index 6a451656dcb..a95125c566e 100644 --- a/src/test/run-make-fulldeps/issue-35164/Makefile +++ b/src/test/run-make-fulldeps/issue-35164/Makefile @@ -1,4 +1,4 @@ -include ../tools.mk all: - $(RUSTC) main.rs --error-format json 2>&1 | $(CGREP) -e '"byte_start":490\b' '"byte_end":496\b' + $(RUSTC) main.rs --error-format json 2>&1 | $(CGREP) -e '"byte_start":23\b' '"byte_end":29\b' diff --git a/src/test/run-make-fulldeps/issue-35164/main.rs b/src/test/run-make-fulldeps/issue-35164/main.rs index 24322a2484f..1333d63224c 100644 --- a/src/test/run-make-fulldeps/issue-35164/main.rs +++ b/src/test/run-make-fulldeps/issue-35164/main.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod submodule; fn main() { diff --git a/src/test/run-make-fulldeps/issue-35164/submodule/mod.rs b/src/test/run-make-fulldeps/issue-35164/submodule/mod.rs index 7847c13af78..a9045b242fb 100644 --- a/src/test/run-make-fulldeps/issue-35164/submodule/mod.rs +++ b/src/test/run-make-fulldeps/issue-35164/submodule/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() { let _MyFoo = 2; } diff --git a/src/test/run-make-fulldeps/issue-36710/foo.cpp b/src/test/run-make-fulldeps/issue-36710/foo.cpp index fbd0ead7a50..8f878c2c272 100644 --- a/src/test/run-make-fulldeps/issue-36710/foo.cpp +++ b/src/test/run-make-fulldeps/issue-36710/foo.cpp @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #include struct A { diff --git a/src/test/run-make-fulldeps/issue-36710/foo.rs b/src/test/run-make-fulldeps/issue-36710/foo.rs index 6e50566ddfd..a9d3effbd18 100644 --- a/src/test/run-make-fulldeps/issue-36710/foo.rs +++ b/src/test/run-make-fulldeps/issue-36710/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that linking to C++ code with global destructors works. extern { fn get() -> u32; } diff --git a/src/test/run-make-fulldeps/issue-37839/a.rs b/src/test/run-make-fulldeps/issue-37839/a.rs index 052317438c2..b5dffac3ff6 100644 --- a/src/test/run-make-fulldeps/issue-37839/a.rs +++ b/src/test/run-make-fulldeps/issue-37839/a.rs @@ -1,12 +1,2 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] #![crate_type = "proc-macro"] diff --git a/src/test/run-make-fulldeps/issue-37839/b.rs b/src/test/run-make-fulldeps/issue-37839/b.rs index 82f48f6d8d6..355d2b16527 100644 --- a/src/test/run-make-fulldeps/issue-37839/b.rs +++ b/src/test/run-make-fulldeps/issue-37839/b.rs @@ -1,12 +1,2 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #[macro_use] extern crate a; diff --git a/src/test/run-make-fulldeps/issue-37839/c.rs b/src/test/run-make-fulldeps/issue-37839/c.rs index 85bece51427..4c7ce01b6a0 100644 --- a/src/test/run-make-fulldeps/issue-37839/c.rs +++ b/src/test/run-make-fulldeps/issue-37839/c.rs @@ -1,12 +1,2 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] extern crate b; diff --git a/src/test/run-make-fulldeps/issue-37893/a.rs b/src/test/run-make-fulldeps/issue-37893/a.rs index 052317438c2..b5dffac3ff6 100644 --- a/src/test/run-make-fulldeps/issue-37893/a.rs +++ b/src/test/run-make-fulldeps/issue-37893/a.rs @@ -1,12 +1,2 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] #![crate_type = "proc-macro"] diff --git a/src/test/run-make-fulldeps/issue-37893/b.rs b/src/test/run-make-fulldeps/issue-37893/b.rs index 82f48f6d8d6..355d2b16527 100644 --- a/src/test/run-make-fulldeps/issue-37893/b.rs +++ b/src/test/run-make-fulldeps/issue-37893/b.rs @@ -1,12 +1,2 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #[macro_use] extern crate a; diff --git a/src/test/run-make-fulldeps/issue-37893/c.rs b/src/test/run-make-fulldeps/issue-37893/c.rs index eee55cc2369..b9c2155728c 100644 --- a/src/test/run-make-fulldeps/issue-37893/c.rs +++ b/src/test/run-make-fulldeps/issue-37893/c.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "staticlib"] extern crate b; extern crate a; diff --git a/src/test/run-make-fulldeps/issue-38237/Makefile b/src/test/run-make-fulldeps/issue-38237/Makefile index 855d958b344..0a681401b1a 100644 --- a/src/test/run-make-fulldeps/issue-38237/Makefile +++ b/src/test/run-make-fulldeps/issue-38237/Makefile @@ -1,11 +1,5 @@ -include ../tools.mk -ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1) -# ignore stage1 -all: - -else all: $(RUSTC) foo.rs; $(RUSTC) bar.rs $(RUSTDOC) baz.rs -L $(TMPDIR) -o $(TMPDIR) -endif diff --git a/src/test/run-make-fulldeps/issue-38237/bar.rs b/src/test/run-make-fulldeps/issue-38237/bar.rs index 794e08c2fe3..2b839f3a3b3 100644 --- a/src/test/run-make-fulldeps/issue-38237/bar.rs +++ b/src/test/run-make-fulldeps/issue-38237/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #[derive(Debug)] diff --git a/src/test/run-make-fulldeps/issue-38237/baz.rs b/src/test/run-make-fulldeps/issue-38237/baz.rs index c2a2c89db01..cd2425f9b69 100644 --- a/src/test/run-make-fulldeps/issue-38237/baz.rs +++ b/src/test/run-make-fulldeps/issue-38237/baz.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; extern crate bar; diff --git a/src/test/run-make-fulldeps/issue-38237/foo.rs b/src/test/run-make-fulldeps/issue-38237/foo.rs index 6fb315731de..a106e4fde5c 100644 --- a/src/test/run-make-fulldeps/issue-38237/foo.rs +++ b/src/test/run-make-fulldeps/issue-38237/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/run-make-fulldeps/issue-40535/bar.rs b/src/test/run-make-fulldeps/issue-40535/bar.rs index 4c22f181975..b02b28f59d9 100644 --- a/src/test/run-make-fulldeps/issue-40535/bar.rs +++ b/src/test/run-make-fulldeps/issue-40535/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] extern crate baz; diff --git a/src/test/run-make-fulldeps/issue-40535/baz.rs b/src/test/run-make-fulldeps/issue-40535/baz.rs index 737a918a039..83be6e807e0 100644 --- a/src/test/run-make-fulldeps/issue-40535/baz.rs +++ b/src/test/run-make-fulldeps/issue-40535/baz.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] diff --git a/src/test/run-make-fulldeps/issue-40535/foo.rs b/src/test/run-make-fulldeps/issue-40535/foo.rs index 53a8c8636b1..27020266425 100644 --- a/src/test/run-make-fulldeps/issue-40535/foo.rs +++ b/src/test/run-make-fulldeps/issue-40535/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] extern crate bar; diff --git a/src/test/run-make-fulldeps/issue-46239/main.rs b/src/test/run-make-fulldeps/issue-46239/main.rs index 3b3289168ab..b7df5cf4d81 100644 --- a/src/test/run-make-fulldeps/issue-46239/main.rs +++ b/src/test/run-make-fulldeps/issue-46239/main.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn project(x: &(T,)) -> &T { &x.0 } fn dummy() {} diff --git a/src/test/run-make-fulldeps/issue-51671/app.rs b/src/test/run-make-fulldeps/issue-51671/app.rs index 4066214f4b4..c13937dcfbe 100644 --- a/src/test/run-make-fulldeps/issue-51671/app.rs +++ b/src/test/run-make-fulldeps/issue-51671/app.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "bin"] #![feature(lang_items)] #![no_main] diff --git a/src/test/run-make-fulldeps/issue-53964/panic.rs b/src/test/run-make-fulldeps/issue-53964/panic.rs index 87c7b218822..a8781205071 100644 --- a/src/test/run-make-fulldeps/issue-53964/panic.rs +++ b/src/test/run-make-fulldeps/issue-53964/panic.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #![feature(panic_handler)] #![no_std] diff --git a/src/test/run-make-fulldeps/issue-7349/foo.rs b/src/test/run-make-fulldeps/issue-7349/foo.rs index b75c82afb53..246a1259580 100644 --- a/src/test/run-make-fulldeps/issue-7349/foo.rs +++ b/src/test/run-make-fulldeps/issue-7349/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn outer() { #[allow(dead_code)] fn inner() -> u32 { diff --git a/src/test/run-make-fulldeps/issues-41478-43796/a.rs b/src/test/run-make-fulldeps/issues-41478-43796/a.rs index 9d95f8b2585..fd67221144a 100644 --- a/src/test/run-make-fulldeps/issues-41478-43796/a.rs +++ b/src/test/run-make-fulldeps/issues-41478-43796/a.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub struct V(S); pub trait An { diff --git a/src/test/run-make-fulldeps/libs-and-bins/foo.rs b/src/test/run-make-fulldeps/libs-and-bins/foo.rs index 2ebe63928ca..ae166b17840 100644 --- a/src/test/run-make-fulldeps/libs-and-bins/foo.rs +++ b/src/test/run-make-fulldeps/libs-and-bins/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] #![crate_type = "bin"] diff --git a/src/test/run-make-fulldeps/libs-search-path/Makefile b/src/test/run-make-fulldeps/libs-search-path/Makefile new file mode 100644 index 00000000000..db0a069c3f5 --- /dev/null +++ b/src/test/run-make-fulldeps/libs-search-path/Makefile @@ -0,0 +1,16 @@ +-include ../tools.mk + +ifeq ($(if $(IS_WINDOWS),$(IS_MSVC),no),) + +all: empty.rs + cp -r $(shell cygpath -u $(shell $(RUSTC) --print sysroot)) $(TMPDIR)/sysroot + $(RUSTC) --target $(TARGET) --sysroot $(TMPDIR)/sysroot -L$(TMPDIR)/obj -Z print-link-args empty.rs | $(CGREP) 'lib\\crt2.o' + mkdir -p $(TMPDIR)/obj + mv $(TMPDIR)/sysroot/lib/rustlib/$(TARGET)/lib/crt2.o $(TMPDIR)/obj/crt2.o + $(RUSTC) --target $(TARGET) --sysroot $(TMPDIR)/sysroot -L$(TMPDIR)/obj -Z print-link-args empty.rs | $(CGREP) 'obj\\crt2.o' + +else + +all: + +endif diff --git a/src/test/run-make-fulldeps/libs-search-path/empty.rs b/src/test/run-make-fulldeps/libs-search-path/empty.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/src/test/run-make-fulldeps/libs-search-path/empty.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/src/test/run-make-fulldeps/libs-through-symlinks/bar.rs b/src/test/run-make-fulldeps/libs-through-symlinks/bar.rs index 6316cfa3bba..bb7b36c496e 100644 --- a/src/test/run-make-fulldeps/libs-through-symlinks/bar.rs +++ b/src/test/run-make-fulldeps/libs-through-symlinks/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() {} diff --git a/src/test/run-make-fulldeps/libs-through-symlinks/foo.rs b/src/test/run-make-fulldeps/libs-through-symlinks/foo.rs index dd818cf8798..8e3df2c6d4e 100644 --- a/src/test/run-make-fulldeps/libs-through-symlinks/foo.rs +++ b/src/test/run-make-fulldeps/libs-through-symlinks/foo.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![crate_name = "foo"] diff --git a/src/test/run-make-fulldeps/libtest-json/f.rs b/src/test/run-make-fulldeps/libtest-json/f.rs index 5cff1f1a5b1..29d52ee9654 100644 --- a/src/test/run-make-fulldeps/libtest-json/f.rs +++ b/src/test/run-make-fulldeps/libtest-json/f.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[test] fn a() { // Should pass diff --git a/src/test/run-make-fulldeps/libtest-json/output.json b/src/test/run-make-fulldeps/libtest-json/output.json index d8169ece89b..c8b3d081869 100644 --- a/src/test/run-make-fulldeps/libtest-json/output.json +++ b/src/test/run-make-fulldeps/libtest-json/output.json @@ -2,7 +2,7 @@ { "type": "test", "event": "started", "name": "a" } { "type": "test", "name": "a", "event": "ok" } { "type": "test", "event": "started", "name": "b" } -{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at 'assertion failed: false', f.rs:18:5\nnote: Run with `RUST_BACKTRACE=1` for a backtrace.\n" } +{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'main' panicked at 'assertion failed: false', f.rs:8:5\nnote: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.\n" } { "type": "test", "event": "started", "name": "c" } { "type": "test", "name": "c", "event": "ok" } { "type": "test", "event": "started", "name": "d" } diff --git a/src/test/run-make-fulldeps/libtest-json/validate_json.py b/src/test/run-make-fulldeps/libtest-json/validate_json.py index 1e97639b524..657f732f2bf 100755 --- a/src/test/run-make-fulldeps/libtest-json/validate_json.py +++ b/src/test/run-make-fulldeps/libtest-json/validate_json.py @@ -1,15 +1,5 @@ #!/usr/bin/env python -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - import sys import json diff --git a/src/test/run-make-fulldeps/link-arg/empty.rs b/src/test/run-make-fulldeps/link-arg/empty.rs index 2b76fb24e5f..45590d86ba6 100644 --- a/src/test/run-make-fulldeps/link-arg/empty.rs +++ b/src/test/run-make-fulldeps/link-arg/empty.rs @@ -1,11 +1 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { } diff --git a/src/test/run-make-fulldeps/link-cfg/dep-with-staticlib.rs b/src/test/run-make-fulldeps/link-cfg/dep-with-staticlib.rs index ecc2365ddb0..55c96df7b58 100644 --- a/src/test/run-make-fulldeps/link-cfg/dep-with-staticlib.rs +++ b/src/test/run-make-fulldeps/link-cfg/dep-with-staticlib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(link_cfg)] #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/link-cfg/dep.rs b/src/test/run-make-fulldeps/link-cfg/dep.rs index 7da879c2bfa..149ae61bf88 100644 --- a/src/test/run-make-fulldeps/link-cfg/dep.rs +++ b/src/test/run-make-fulldeps/link-cfg/dep.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(link_cfg)] #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/link-cfg/no-deps.rs b/src/test/run-make-fulldeps/link-cfg/no-deps.rs index 6b114106744..6dba7fe218e 100644 --- a/src/test/run-make-fulldeps/link-cfg/no-deps.rs +++ b/src/test/run-make-fulldeps/link-cfg/no-deps.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(link_cfg)] #[link(name = "return1", cfg(foo))] diff --git a/src/test/run-make-fulldeps/link-cfg/return1.c b/src/test/run-make-fulldeps/link-cfg/return1.c index a2a3d051dd1..41c2809ade3 100644 --- a/src/test/run-make-fulldeps/link-cfg/return1.c +++ b/src/test/run-make-fulldeps/link-cfg/return1.c @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #ifdef _WIN32 __declspec(dllexport) #endif diff --git a/src/test/run-make-fulldeps/link-cfg/return2.c b/src/test/run-make-fulldeps/link-cfg/return2.c index d6ddcccf2fb..622aeaa294c 100644 --- a/src/test/run-make-fulldeps/link-cfg/return2.c +++ b/src/test/run-make-fulldeps/link-cfg/return2.c @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #ifdef _WIN32 __declspec(dllexport) #endif diff --git a/src/test/run-make-fulldeps/link-cfg/return3.c b/src/test/run-make-fulldeps/link-cfg/return3.c index 6a3b695f208..f29dc60d5e8 100644 --- a/src/test/run-make-fulldeps/link-cfg/return3.c +++ b/src/test/run-make-fulldeps/link-cfg/return3.c @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #ifdef _WIN32 __declspec(dllexport) #endif diff --git a/src/test/run-make-fulldeps/link-cfg/with-deps.rs b/src/test/run-make-fulldeps/link-cfg/with-deps.rs index 799555c500a..48b7828152e 100644 --- a/src/test/run-make-fulldeps/link-cfg/with-deps.rs +++ b/src/test/run-make-fulldeps/link-cfg/with-deps.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate dep; fn main() { diff --git a/src/test/run-make-fulldeps/link-cfg/with-staticlib-deps.rs b/src/test/run-make-fulldeps/link-cfg/with-staticlib-deps.rs index 33a9c7720e2..23e5926a73c 100644 --- a/src/test/run-make-fulldeps/link-cfg/with-staticlib-deps.rs +++ b/src/test/run-make-fulldeps/link-cfg/with-staticlib-deps.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate dep_with_staticlib; fn main() { diff --git a/src/test/run-make-fulldeps/link-path-order/main.rs b/src/test/run-make-fulldeps/link-path-order/main.rs index f3502e8bcd4..10f12823bd3 100644 --- a/src/test/run-make-fulldeps/link-path-order/main.rs +++ b/src/test/run-make-fulldeps/link-path-order/main.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-make-fulldeps/linkage-attr-on-static/bar.rs b/src/test/run-make-fulldeps/linkage-attr-on-static/bar.rs index 274401c448b..b827532e889 100644 --- a/src/test/run-make-fulldeps/linkage-attr-on-static/bar.rs +++ b/src/test/run-make-fulldeps/linkage-attr-on-static/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(linkage)] #[no_mangle] diff --git a/src/test/run-make-fulldeps/linker-output-non-utf8/exec.rs b/src/test/run-make-fulldeps/linker-output-non-utf8/exec.rs index 1c03eb479fd..6864018d64e 100644 --- a/src/test/run-make-fulldeps/linker-output-non-utf8/exec.rs +++ b/src/test/run-make-fulldeps/linker-output-non-utf8/exec.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link(name="library")] extern "C" { fn foo(); diff --git a/src/test/run-make-fulldeps/linker-output-non-utf8/library.rs b/src/test/run-make-fulldeps/linker-output-non-utf8/library.rs index 194be26424a..6689a82fa2c 100644 --- a/src/test/run-make-fulldeps/linker-output-non-utf8/library.rs +++ b/src/test/run-make-fulldeps/linker-output-non-utf8/library.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "staticlib"] extern "C" { diff --git a/src/test/run-make-fulldeps/llvm-pass/Makefile b/src/test/run-make-fulldeps/llvm-pass/Makefile deleted file mode 100644 index 8a18aadf36a..00000000000 --- a/src/test/run-make-fulldeps/llvm-pass/Makefile +++ /dev/null @@ -1,28 +0,0 @@ --include ../tools.mk - -ifeq ($(UNAME),Darwin) -PLUGIN_FLAGS := -C link-args=-Wl,-undefined,dynamic_lookup -endif - -ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1) -# ignore stage1 -all: - -else -# Windows doesn't correctly handle include statements with escaping paths, -# so this test will not get run on Windows. -ifdef IS_WINDOWS -all: -else -all: $(call NATIVE_STATICLIB,llvm-function-pass) $(call NATIVE_STATICLIB,llvm-module-pass) - $(RUSTC) plugin.rs -C prefer-dynamic $(PLUGIN_FLAGS) - $(RUSTC) main.rs - -$(TMPDIR)/libllvm-function-pass.o: - $(CXX) $(CFLAGS) $(LLVM_CXXFLAGS) -c llvm-function-pass.so.cc -o $(TMPDIR)/libllvm-function-pass.o - -$(TMPDIR)/libllvm-module-pass.o: - $(CXX) $(CFLAGS) $(LLVM_CXXFLAGS) -c llvm-module-pass.so.cc -o $(TMPDIR)/libllvm-module-pass.o -endif - -endif diff --git a/src/test/run-make-fulldeps/llvm-pass/llvm-function-pass.so.cc b/src/test/run-make-fulldeps/llvm-pass/llvm-function-pass.so.cc deleted file mode 100644 index c0a17d920cf..00000000000 --- a/src/test/run-make-fulldeps/llvm-pass/llvm-function-pass.so.cc +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#include -#include -#include - -#include "llvm/Pass.h" -#include "llvm/IR/Function.h" - -using namespace llvm; - -namespace { - - class TestLLVMPass : public FunctionPass { - - public: - - static char ID; - TestLLVMPass() : FunctionPass(ID) { } - - bool runOnFunction(Function &F) override; - - StringRef getPassName() const override { - return "Some LLVM pass"; - } - - }; - -} - -bool TestLLVMPass::runOnFunction(Function &F) { - // A couple examples of operations that previously caused segmentation faults - // https://github.com/rust-lang/rust/issues/31067 - - for (auto N = F.begin(); N != F.end(); ++N) { - /* code */ - } - - LLVMContext &C = F.getContext(); - IntegerType *Int8Ty = IntegerType::getInt8Ty(C); - PointerType::get(Int8Ty, 0); - return true; -} - -char TestLLVMPass::ID = 0; - -static RegisterPass RegisterAFLPass( - "some-llvm-function-pass", "Some LLVM pass"); diff --git a/src/test/run-make-fulldeps/llvm-pass/llvm-module-pass.so.cc b/src/test/run-make-fulldeps/llvm-pass/llvm-module-pass.so.cc deleted file mode 100644 index 70051681ab0..00000000000 --- a/src/test/run-make-fulldeps/llvm-pass/llvm-module-pass.so.cc +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#include -#include -#include - -#include "llvm/IR/Module.h" - -using namespace llvm; - -namespace { - - class TestLLVMPass : public ModulePass { - - public: - - static char ID; - TestLLVMPass() : ModulePass(ID) { } - - bool runOnModule(Module &M) override; - - StringRef getPassName() const override { - return "Some LLVM pass"; - } - - }; - -} - -bool TestLLVMPass::runOnModule(Module &M) { - // A couple examples of operations that previously caused segmentation faults - // https://github.com/rust-lang/rust/issues/31067 - - for (auto F = M.begin(); F != M.end(); ++F) { - /* code */ - } - - LLVMContext &C = M.getContext(); - IntegerType *Int8Ty = IntegerType::getInt8Ty(C); - PointerType::get(Int8Ty, 0); - return true; -} - -char TestLLVMPass::ID = 0; - -static RegisterPass RegisterAFLPass( - "some-llvm-module-pass", "Some LLVM pass"); diff --git a/src/test/run-make-fulldeps/llvm-pass/main.rs b/src/test/run-make-fulldeps/llvm-pass/main.rs deleted file mode 100644 index 5b5ab94bcef..00000000000 --- a/src/test/run-make-fulldeps/llvm-pass/main.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(plugin)] -#![plugin(some_plugin)] - -fn main() {} diff --git a/src/test/run-make-fulldeps/llvm-pass/plugin.rs b/src/test/run-make-fulldeps/llvm-pass/plugin.rs deleted file mode 100644 index f77b2fca857..00000000000 --- a/src/test/run-make-fulldeps/llvm-pass/plugin.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(plugin_registrar, rustc_private)] -#![crate_type = "dylib"] -#![crate_name = "some_plugin"] - -extern crate rustc; -extern crate rustc_plugin; - -#[link(name = "llvm-function-pass", kind = "static")] -#[link(name = "llvm-module-pass", kind = "static")] -extern {} - -use rustc_plugin::registry::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_llvm_pass("some-llvm-function-pass"); - reg.register_llvm_pass("some-llvm-module-pass"); -} diff --git a/src/test/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.rs b/src/test/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.rs index 67d8ad0b672..74d7b9b07f6 100644 --- a/src/test/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.rs +++ b/src/test/run-make-fulldeps/long-linker-command-lines-cmd-exe/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Like the `long-linker-command-lines` test this test attempts to blow // a command line limit for running the linker. Unlike that test, however, // this test is testing `cmd.exe` specifically rather than the OS. diff --git a/src/test/run-make-fulldeps/long-linker-command-lines/foo.rs b/src/test/run-make-fulldeps/long-linker-command-lines/foo.rs index 2ac240982af..ac42141365e 100644 --- a/src/test/run-make-fulldeps/long-linker-command-lines/foo.rs +++ b/src/test/run-make-fulldeps/long-linker-command-lines/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is a test which attempts to blow out the system limit with how many // arguments can be passed to a process. This'll successively call rustc with // larger and larger argument lists in an attempt to find one that's way too diff --git a/src/test/run-make-fulldeps/longjmp-across-rust/foo.c b/src/test/run-make-fulldeps/longjmp-across-rust/foo.c index eb993957674..bd71cc4d777 100644 --- a/src/test/run-make-fulldeps/longjmp-across-rust/foo.c +++ b/src/test/run-make-fulldeps/longjmp-across-rust/foo.c @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #include #include diff --git a/src/test/run-make-fulldeps/longjmp-across-rust/main.rs b/src/test/run-make-fulldeps/longjmp-across-rust/main.rs index c420473a560..5b43c1cc3b7 100644 --- a/src/test/run-make-fulldeps/longjmp-across-rust/main.rs +++ b/src/test/run-make-fulldeps/longjmp-across-rust/main.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link(name = "foo", kind = "static")] extern { fn test_start(f: extern fn()); diff --git a/src/test/run-make-fulldeps/ls-metadata/foo.rs b/src/test/run-make-fulldeps/ls-metadata/foo.rs index 8ae3d072362..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/ls-metadata/foo.rs +++ b/src/test/run-make-fulldeps/ls-metadata/foo.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/Makefile b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/Makefile index 1d45cb413c5..25afad92adb 100644 --- a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/Makefile +++ b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/Makefile @@ -1,13 +1,3 @@ -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -include ../tools.mk all: $(call NATIVE_STATICLIB,foo) $(call NATIVE_STATICLIB,bar) diff --git a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/bar.c b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/bar.c index 716d1abcf34..b2501193029 100644 --- a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/bar.c +++ b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/bar.c @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - int foo() { return 2; } diff --git a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/foo.c b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/foo.c index 1b36874581a..75010458ece 100644 --- a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/foo.c +++ b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/foo.c @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - int foo() { return 1; } diff --git a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs index 0a87c8e4725..4b43b86600c 100644 --- a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs +++ b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #[link(name = "foo", kind = "static")] diff --git a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs index 6e3f382b3fd..50b7882a05a 100644 --- a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs +++ b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/lib2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] extern crate lib1; diff --git a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/main.rs b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/main.rs index 8417af63be9..0c658808e6e 100644 --- a/src/test/run-make-fulldeps/lto-no-link-whole-rlib/main.rs +++ b/src/test/run-make-fulldeps/lto-no-link-whole-rlib/main.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate lib1; extern crate lib2; diff --git a/src/test/run-make-fulldeps/lto-readonly-lib/lib.rs b/src/test/run-make-fulldeps/lto-readonly-lib/lib.rs index 04d3ae67207..c1bfaa6cab5 100644 --- a/src/test/run-make-fulldeps/lto-readonly-lib/lib.rs +++ b/src/test/run-make-fulldeps/lto-readonly-lib/lib.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/lto-readonly-lib/main.rs b/src/test/run-make-fulldeps/lto-readonly-lib/main.rs index e12ac9e01dc..69da798b3eb 100644 --- a/src/test/run-make-fulldeps/lto-readonly-lib/main.rs +++ b/src/test/run-make-fulldeps/lto-readonly-lib/main.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate lib; fn main() {} diff --git a/src/test/run-make-fulldeps/lto-smoke-c/foo.rs b/src/test/run-make-fulldeps/lto-smoke-c/foo.rs index 1bb19016700..2e59432cdb1 100644 --- a/src/test/run-make-fulldeps/lto-smoke-c/foo.rs +++ b/src/test/run-make-fulldeps/lto-smoke-c/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "staticlib"] #[no_mangle] diff --git a/src/test/run-make-fulldeps/lto-smoke/lib.rs b/src/test/run-make-fulldeps/lto-smoke/lib.rs index 04d3ae67207..c1bfaa6cab5 100644 --- a/src/test/run-make-fulldeps/lto-smoke/lib.rs +++ b/src/test/run-make-fulldeps/lto-smoke/lib.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/lto-smoke/main.rs b/src/test/run-make-fulldeps/lto-smoke/main.rs index e12ac9e01dc..69da798b3eb 100644 --- a/src/test/run-make-fulldeps/lto-smoke/main.rs +++ b/src/test/run-make-fulldeps/lto-smoke/main.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate lib; fn main() {} diff --git a/src/test/run-make-fulldeps/manual-crate-name/bar.rs b/src/test/run-make-fulldeps/manual-crate-name/bar.rs index 04d3ae67207..c1bfaa6cab5 100644 --- a/src/test/run-make-fulldeps/manual-crate-name/bar.rs +++ b/src/test/run-make-fulldeps/manual-crate-name/bar.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/manual-link/foo.rs b/src/test/run-make-fulldeps/manual-link/foo.rs index d67a4057afb..f5cd598abc6 100644 --- a/src/test/run-make-fulldeps/manual-link/foo.rs +++ b/src/test/run-make-fulldeps/manual-link/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] extern { diff --git a/src/test/run-make-fulldeps/manual-link/main.rs b/src/test/run-make-fulldeps/manual-link/main.rs index 756a47f386a..fe35f1f8e2e 100644 --- a/src/test/run-make-fulldeps/manual-link/main.rs +++ b/src/test/run-make-fulldeps/manual-link/main.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() { diff --git a/src/test/run-make-fulldeps/many-crates-but-no-match/crateA1.rs b/src/test/run-make-fulldeps/many-crates-but-no-match/crateA1.rs index dbfe920c85b..3fed5a38e2c 100644 --- a/src/test/run-make-fulldeps/many-crates-but-no-match/crateA1.rs +++ b/src/test/run-make-fulldeps/many-crates-but-no-match/crateA1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="crateA"] // Base crate diff --git a/src/test/run-make-fulldeps/many-crates-but-no-match/crateA2.rs b/src/test/run-make-fulldeps/many-crates-but-no-match/crateA2.rs index 857c36aee60..8db07a015ff 100644 --- a/src/test/run-make-fulldeps/many-crates-but-no-match/crateA2.rs +++ b/src/test/run-make-fulldeps/many-crates-but-no-match/crateA2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="crateA"] // Base crate diff --git a/src/test/run-make-fulldeps/many-crates-but-no-match/crateA3.rs b/src/test/run-make-fulldeps/many-crates-but-no-match/crateA3.rs index 8b8dac5e862..a1e8e40a38c 100644 --- a/src/test/run-make-fulldeps/many-crates-but-no-match/crateA3.rs +++ b/src/test/run-make-fulldeps/many-crates-but-no-match/crateA3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="crateA"] // Base crate diff --git a/src/test/run-make-fulldeps/many-crates-but-no-match/crateB.rs b/src/test/run-make-fulldeps/many-crates-but-no-match/crateB.rs index bf55017c646..4ccd65d653e 100644 --- a/src/test/run-make-fulldeps/many-crates-but-no-match/crateB.rs +++ b/src/test/run-make-fulldeps/many-crates-but-no-match/crateB.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate crateA; diff --git a/src/test/run-make-fulldeps/many-crates-but-no-match/crateC.rs b/src/test/run-make-fulldeps/many-crates-but-no-match/crateC.rs index 174d9382b76..a8b817ec681 100644 --- a/src/test/run-make-fulldeps/many-crates-but-no-match/crateC.rs +++ b/src/test/run-make-fulldeps/many-crates-but-no-match/crateC.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate crateB; fn main() {} diff --git a/src/test/run-make-fulldeps/metadata-flag-frobs-symbols/bar.rs b/src/test/run-make-fulldeps/metadata-flag-frobs-symbols/bar.rs index 44b9e2f874a..1e6957a3694 100644 --- a/src/test/run-make-fulldeps/metadata-flag-frobs-symbols/bar.rs +++ b/src/test/run-make-fulldeps/metadata-flag-frobs-symbols/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo1; extern crate foo2; diff --git a/src/test/run-make-fulldeps/metadata-flag-frobs-symbols/foo.rs b/src/test/run-make-fulldeps/metadata-flag-frobs-symbols/foo.rs index baabdc9ad7b..696aed2fa1d 100644 --- a/src/test/run-make-fulldeps/metadata-flag-frobs-symbols/foo.rs +++ b/src/test/run-make-fulldeps/metadata-flag-frobs-symbols/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/min-global-align/min_global_align.rs b/src/test/run-make-fulldeps/min-global-align/min_global_align.rs index 3d4f9001a74..ce86d202c62 100644 --- a/src/test/run-make-fulldeps/min-global-align/min_global_align.rs +++ b/src/test/run-make-fulldeps/min-global-align/min_global_align.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(no_core, lang_items)] #![crate_type="rlib"] #![no_core] diff --git a/src/test/run-make-fulldeps/mismatching-target-triples/bar.rs b/src/test/run-make-fulldeps/mismatching-target-triples/bar.rs index 0dc5c0a3a8e..b2c2fc1c410 100644 --- a/src/test/run-make-fulldeps/mismatching-target-triples/bar.rs +++ b/src/test/run-make-fulldeps/mismatching-target-triples/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(no_core)] #![no_core] extern crate foo; diff --git a/src/test/run-make-fulldeps/mismatching-target-triples/foo.rs b/src/test/run-make-fulldeps/mismatching-target-triples/foo.rs index a2169d0c631..6fa05491448 100644 --- a/src/test/run-make-fulldeps/mismatching-target-triples/foo.rs +++ b/src/test/run-make-fulldeps/mismatching-target-triples/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(no_core)] #![no_core] #![crate_type = "lib"] diff --git a/src/test/run-make-fulldeps/missing-crate-dependency/crateA.rs b/src/test/run-make-fulldeps/missing-crate-dependency/crateA.rs index 4e111f29e8a..31433cb60b8 100644 --- a/src/test/run-make-fulldeps/missing-crate-dependency/crateA.rs +++ b/src/test/run-make-fulldeps/missing-crate-dependency/crateA.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Base crate pub fn func() {} diff --git a/src/test/run-make-fulldeps/missing-crate-dependency/crateB.rs b/src/test/run-make-fulldeps/missing-crate-dependency/crateB.rs index bf55017c646..4ccd65d653e 100644 --- a/src/test/run-make-fulldeps/missing-crate-dependency/crateB.rs +++ b/src/test/run-make-fulldeps/missing-crate-dependency/crateB.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate crateA; diff --git a/src/test/run-make-fulldeps/missing-crate-dependency/crateC.rs b/src/test/run-make-fulldeps/missing-crate-dependency/crateC.rs index 174d9382b76..a8b817ec681 100644 --- a/src/test/run-make-fulldeps/missing-crate-dependency/crateC.rs +++ b/src/test/run-make-fulldeps/missing-crate-dependency/crateC.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate crateB; fn main() {} diff --git a/src/test/run-make-fulldeps/mixing-deps/both.rs b/src/test/run-make-fulldeps/mixing-deps/both.rs index c44335e2bbc..6a58187633f 100644 --- a/src/test/run-make-fulldeps/mixing-deps/both.rs +++ b/src/test/run-make-fulldeps/mixing-deps/both.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/test/run-make-fulldeps/mixing-deps/dylib.rs b/src/test/run-make-fulldeps/mixing-deps/dylib.rs index 78af525f386..88976d5b663 100644 --- a/src/test/run-make-fulldeps/mixing-deps/dylib.rs +++ b/src/test/run-make-fulldeps/mixing-deps/dylib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] extern crate both; diff --git a/src/test/run-make-fulldeps/mixing-deps/prog.rs b/src/test/run-make-fulldeps/mixing-deps/prog.rs index c3d88016fda..188981dc1a3 100644 --- a/src/test/run-make-fulldeps/mixing-deps/prog.rs +++ b/src/test/run-make-fulldeps/mixing-deps/prog.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate dylib; extern crate both; diff --git a/src/test/run-make-fulldeps/mixing-formats/bar1.rs b/src/test/run-make-fulldeps/mixing-formats/bar1.rs index 4b4916fe96d..49af74e1b74 100644 --- a/src/test/run-make-fulldeps/mixing-formats/bar1.rs +++ b/src/test/run-make-fulldeps/mixing-formats/bar1.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; diff --git a/src/test/run-make-fulldeps/mixing-formats/bar2.rs b/src/test/run-make-fulldeps/mixing-formats/bar2.rs index 4b4916fe96d..49af74e1b74 100644 --- a/src/test/run-make-fulldeps/mixing-formats/bar2.rs +++ b/src/test/run-make-fulldeps/mixing-formats/bar2.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; diff --git a/src/test/run-make-fulldeps/mixing-formats/baz.rs b/src/test/run-make-fulldeps/mixing-formats/baz.rs index 3fb90f6a854..99a73159ea4 100644 --- a/src/test/run-make-fulldeps/mixing-formats/baz.rs +++ b/src/test/run-make-fulldeps/mixing-formats/baz.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate bar1; fn main() {} diff --git a/src/test/run-make-fulldeps/mixing-formats/baz2.rs b/src/test/run-make-fulldeps/mixing-formats/baz2.rs index c5066ccd656..d0fab1e4cdf 100644 --- a/src/test/run-make-fulldeps/mixing-formats/baz2.rs +++ b/src/test/run-make-fulldeps/mixing-formats/baz2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate bar1; extern crate bar2; diff --git a/src/test/run-make-fulldeps/mixing-formats/foo.rs b/src/test/run-make-fulldeps/mixing-formats/foo.rs index e6c76025738..d11c69f812a 100644 --- a/src/test/run-make-fulldeps/mixing-formats/foo.rs +++ b/src/test/run-make-fulldeps/mixing-formats/foo.rs @@ -1,9 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// intentionally empty diff --git a/src/test/run-make-fulldeps/mixing-libs/dylib.rs b/src/test/run-make-fulldeps/mixing-libs/dylib.rs index 1a5bd658cd9..6856887501c 100644 --- a/src/test/run-make-fulldeps/mixing-libs/dylib.rs +++ b/src/test/run-make-fulldeps/mixing-libs/dylib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] extern crate rlib; diff --git a/src/test/run-make-fulldeps/mixing-libs/prog.rs b/src/test/run-make-fulldeps/mixing-libs/prog.rs index 5e1a4274756..14ce5c951a7 100644 --- a/src/test/run-make-fulldeps/mixing-libs/prog.rs +++ b/src/test/run-make-fulldeps/mixing-libs/prog.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate dylib; extern crate rlib; diff --git a/src/test/run-make-fulldeps/mixing-libs/rlib.rs b/src/test/run-make-fulldeps/mixing-libs/rlib.rs index ad0ea67b9ab..96dcd16bb93 100644 --- a/src/test/run-make-fulldeps/mixing-libs/rlib.rs +++ b/src/test/run-make-fulldeps/mixing-libs/rlib.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub fn rlib() {} diff --git a/src/test/run-make-fulldeps/msvc-opt-minsize/foo.rs b/src/test/run-make-fulldeps/msvc-opt-minsize/foo.rs index 30b12691afe..3f5496c08ee 100644 --- a/src/test/run-make-fulldeps/msvc-opt-minsize/foo.rs +++ b/src/test/run-make-fulldeps/msvc-opt-minsize/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(test)] extern crate test; diff --git a/src/test/run-make-fulldeps/multiple-emits/foo.rs b/src/test/run-make-fulldeps/multiple-emits/foo.rs index 8ae3d072362..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/multiple-emits/foo.rs +++ b/src/test/run-make-fulldeps/multiple-emits/foo.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/no-builtins-lto/main.rs b/src/test/run-make-fulldeps/no-builtins-lto/main.rs index e960c726a98..890c999c8cc 100644 --- a/src/test/run-make-fulldeps/no-builtins-lto/main.rs +++ b/src/test/run-make-fulldeps/no-builtins-lto/main.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate no_builtins; fn main() {} diff --git a/src/test/run-make-fulldeps/no-builtins-lto/no_builtins.rs b/src/test/run-make-fulldeps/no-builtins-lto/no_builtins.rs index be95e7c5521..5d001031a57 100644 --- a/src/test/run-make-fulldeps/no-builtins-lto/no_builtins.rs +++ b/src/test/run-make-fulldeps/no-builtins-lto/no_builtins.rs @@ -1,12 +1,2 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #![no_builtins] diff --git a/src/test/run-make-fulldeps/no-duplicate-libs/bar.c b/src/test/run-make-fulldeps/no-duplicate-libs/bar.c index b9dcd0f5e5e..e369526572d 100644 --- a/src/test/run-make-fulldeps/no-duplicate-libs/bar.c +++ b/src/test/run-make-fulldeps/no-duplicate-libs/bar.c @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern void foo(); void bar() { diff --git a/src/test/run-make-fulldeps/no-duplicate-libs/foo.c b/src/test/run-make-fulldeps/no-duplicate-libs/foo.c index 906cd5682b8..85e6cd8c390 100644 --- a/src/test/run-make-fulldeps/no-duplicate-libs/foo.c +++ b/src/test/run-make-fulldeps/no-duplicate-libs/foo.c @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - void foo() {} diff --git a/src/test/run-make-fulldeps/no-duplicate-libs/main.rs b/src/test/run-make-fulldeps/no-duplicate-libs/main.rs index 824946fe9c2..298018ca718 100644 --- a/src/test/run-make-fulldeps/no-duplicate-libs/main.rs +++ b/src/test/run-make-fulldeps/no-duplicate-libs/main.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link(name = "foo")] // linker should drop this library, no symbols used #[link(name = "bar")] // symbol comes from this library #[link(name = "foo")] // now linker picks up `foo` b/c `bar` library needs it diff --git a/src/test/run-make-fulldeps/no-integrated-as/hello.rs b/src/test/run-make-fulldeps/no-integrated-as/hello.rs index 68e7f6d94d1..e7a11a969c0 100644 --- a/src/test/run-make-fulldeps/no-integrated-as/hello.rs +++ b/src/test/run-make-fulldeps/no-integrated-as/hello.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("Hello, world!"); } diff --git a/src/test/run-make-fulldeps/no-intermediate-extras/foo.rs b/src/test/run-make-fulldeps/no-intermediate-extras/foo.rs index e6c76025738..d11c69f812a 100644 --- a/src/test/run-make-fulldeps/no-intermediate-extras/foo.rs +++ b/src/test/run-make-fulldeps/no-intermediate-extras/foo.rs @@ -1,9 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// intentionally empty diff --git a/src/test/run-make-fulldeps/obey-crate-type-flag/test.rs b/src/test/run-make-fulldeps/obey-crate-type-flag/test.rs index e6c8b8eb179..8a768f9de90 100644 --- a/src/test/run-make-fulldeps/obey-crate-type-flag/test.rs +++ b/src/test/run-make-fulldeps/obey-crate-type-flag/test.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/test/run-make-fulldeps/output-filename-conflicts-with-directory/foo.rs b/src/test/run-make-fulldeps/output-filename-conflicts-with-directory/foo.rs index 3f07b46791d..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/output-filename-conflicts-with-directory/foo.rs +++ b/src/test/run-make-fulldeps/output-filename-conflicts-with-directory/foo.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/output-filename-overwrites-input/bar.rs b/src/test/run-make-fulldeps/output-filename-overwrites-input/bar.rs index 8e4e35fdee6..83be6e807e0 100644 --- a/src/test/run-make-fulldeps/output-filename-overwrites-input/bar.rs +++ b/src/test/run-make-fulldeps/output-filename-overwrites-input/bar.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] diff --git a/src/test/run-make-fulldeps/output-filename-overwrites-input/foo.rs b/src/test/run-make-fulldeps/output-filename-overwrites-input/foo.rs index 3f07b46791d..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/output-filename-overwrites-input/foo.rs +++ b/src/test/run-make-fulldeps/output-filename-overwrites-input/foo.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/output-type-permutations/foo.rs b/src/test/run-make-fulldeps/output-type-permutations/foo.rs index bb5796bd873..f0a2cc6ad75 100644 --- a/src/test/run-make-fulldeps/output-type-permutations/foo.rs +++ b/src/test/run-make-fulldeps/output-type-permutations/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "bar"] fn main() {} diff --git a/src/test/run-make-fulldeps/output-with-hyphens/foo-bar.rs b/src/test/run-make-fulldeps/output-with-hyphens/foo-bar.rs index 2f93b2d1ead..3f1a70458e3 100644 --- a/src/test/run-make-fulldeps/output-with-hyphens/foo-bar.rs +++ b/src/test/run-make-fulldeps/output-with-hyphens/foo-bar.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #![crate_type = "bin"] diff --git a/src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-consumer.rs b/src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-consumer.rs index 592fab8be85..82a98b12d04 100644 --- a/src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-consumer.rs +++ b/src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-consumer.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] #![no_main] diff --git a/src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs b/src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs index 0b11df6347c..78d33281cd7 100644 --- a/src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs +++ b/src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![no_std] #![feature(lang_items)] diff --git a/src/test/run-make-fulldeps/pgo-gen-lto/test.rs b/src/test/run-make-fulldeps/pgo-gen-lto/test.rs index 3f07b46791d..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/pgo-gen-lto/test.rs +++ b/src/test/run-make-fulldeps/pgo-gen-lto/test.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/pgo-gen/test.rs b/src/test/run-make-fulldeps/pgo-gen/test.rs index 3f07b46791d..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/pgo-gen/test.rs +++ b/src/test/run-make-fulldeps/pgo-gen/test.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/prefer-dylib/bar.rs b/src/test/run-make-fulldeps/prefer-dylib/bar.rs index 4c79f7e2855..c5c0bc606cd 100644 --- a/src/test/run-make-fulldeps/prefer-dylib/bar.rs +++ b/src/test/run-make-fulldeps/prefer-dylib/bar.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn bar() {} diff --git a/src/test/run-make-fulldeps/prefer-dylib/foo.rs b/src/test/run-make-fulldeps/prefer-dylib/foo.rs index 858ef492ace..8d68535e3b6 100644 --- a/src/test/run-make-fulldeps/prefer-dylib/foo.rs +++ b/src/test/run-make-fulldeps/prefer-dylib/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate bar; fn main() { diff --git a/src/test/run-make-fulldeps/prefer-rlib/bar.rs b/src/test/run-make-fulldeps/prefer-rlib/bar.rs index 4c79f7e2855..c5c0bc606cd 100644 --- a/src/test/run-make-fulldeps/prefer-rlib/bar.rs +++ b/src/test/run-make-fulldeps/prefer-rlib/bar.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn bar() {} diff --git a/src/test/run-make-fulldeps/prefer-rlib/foo.rs b/src/test/run-make-fulldeps/prefer-rlib/foo.rs index 858ef492ace..8d68535e3b6 100644 --- a/src/test/run-make-fulldeps/prefer-rlib/foo.rs +++ b/src/test/run-make-fulldeps/prefer-rlib/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate bar; fn main() { diff --git a/src/test/run-make-fulldeps/pretty-expanded-hygiene/input.pp.rs b/src/test/run-make-fulldeps/pretty-expanded-hygiene/input.pp.rs index 3d2dd380e48..b835bf8782c 100644 --- a/src/test/run-make-fulldeps/pretty-expanded-hygiene/input.pp.rs +++ b/src/test/run-make-fulldeps/pretty-expanded-hygiene/input.pp.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // minimal junk #![feature(no_core)] #![no_core] diff --git a/src/test/run-make-fulldeps/pretty-expanded-hygiene/input.rs b/src/test/run-make-fulldeps/pretty-expanded-hygiene/input.rs index 422fbdb0884..ed3b48dbdc1 100644 --- a/src/test/run-make-fulldeps/pretty-expanded-hygiene/input.rs +++ b/src/test/run-make-fulldeps/pretty-expanded-hygiene/input.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // minimal junk #![feature(no_core)] #![no_core] diff --git a/src/test/run-make-fulldeps/pretty-expanded/input.rs b/src/test/run-make-fulldeps/pretty-expanded/input.rs index 04bf17dc28a..8b8fadb89c1 100644 --- a/src/test/run-make-fulldeps/pretty-expanded/input.rs +++ b/src/test/run-make-fulldeps/pretty-expanded/input.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[crate_type="lib"] // #13544 diff --git a/src/test/run-make-fulldeps/pretty-print-path-suffix/foo.pp b/src/test/run-make-fulldeps/pretty-print-path-suffix/foo.pp index f3130a8044a..fa754af9560 100644 --- a/src/test/run-make-fulldeps/pretty-print-path-suffix/foo.pp +++ b/src/test/run-make-fulldeps/pretty-print-path-suffix/foo.pp @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() -> i32 { 45 } /* foo */ diff --git a/src/test/run-make-fulldeps/pretty-print-path-suffix/foo_method.pp b/src/test/run-make-fulldeps/pretty-print-path-suffix/foo_method.pp index fae13498687..2408c3a208f 100644 --- a/src/test/run-make-fulldeps/pretty-print-path-suffix/foo_method.pp +++ b/src/test/run-make-fulldeps/pretty-print-path-suffix/foo_method.pp @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - diff --git a/src/test/run-make-fulldeps/pretty-print-path-suffix/input.rs b/src/test/run-make-fulldeps/pretty-print-path-suffix/input.rs index 8ea86a94f93..d075c46d8b0 100644 --- a/src/test/run-make-fulldeps/pretty-print-path-suffix/input.rs +++ b/src/test/run-make-fulldeps/pretty-print-path-suffix/input.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub fn diff --git a/src/test/run-make-fulldeps/pretty-print-path-suffix/nest_foo.pp b/src/test/run-make-fulldeps/pretty-print-path-suffix/nest_foo.pp index 88eaa062b03..0be392976da 100644 --- a/src/test/run-make-fulldeps/pretty-print-path-suffix/nest_foo.pp +++ b/src/test/run-make-fulldeps/pretty-print-path-suffix/nest_foo.pp @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - diff --git a/src/test/run-make-fulldeps/pretty-print-to-file/input.pp b/src/test/run-make-fulldeps/pretty-print-to-file/input.pp index a6dd6b6778e..e3f03242a6e 100644 --- a/src/test/run-make-fulldeps/pretty-print-to-file/input.pp +++ b/src/test/run-make-fulldeps/pretty-print-to-file/input.pp @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[crate_type = "lib"] pub fn foo() -> i32 { 45 } diff --git a/src/test/run-make-fulldeps/pretty-print-to-file/input.rs b/src/test/run-make-fulldeps/pretty-print-to-file/input.rs index 8e3ec363187..aa828155b20 100644 --- a/src/test/run-make-fulldeps/pretty-print-to-file/input.rs +++ b/src/test/run-make-fulldeps/pretty-print-to-file/input.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[crate_type="lib"] pub fn diff --git a/src/test/run-make-fulldeps/profile/test.rs b/src/test/run-make-fulldeps/profile/test.rs index 046d27a9f0f..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/profile/test.rs +++ b/src/test/run-make-fulldeps/profile/test.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/prune-link-args/empty.rs b/src/test/run-make-fulldeps/prune-link-args/empty.rs index a9e231b0ea8..45590d86ba6 100644 --- a/src/test/run-make-fulldeps/prune-link-args/empty.rs +++ b/src/test/run-make-fulldeps/prune-link-args/empty.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { } diff --git a/src/test/run-make-fulldeps/relocation-model/foo.rs b/src/test/run-make-fulldeps/relocation-model/foo.rs index e06d81cd60b..da0f5d925d1 100644 --- a/src/test/run-make-fulldeps/relocation-model/foo.rs +++ b/src/test/run-make-fulldeps/relocation-model/foo.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() {} diff --git a/src/test/run-make-fulldeps/relro-levels/Makefile b/src/test/run-make-fulldeps/relro-levels/Makefile index 673ba9a9a02..78ac2f6a82d 100644 --- a/src/test/run-make-fulldeps/relro-levels/Makefile +++ b/src/test/run-make-fulldeps/relro-levels/Makefile @@ -1,6 +1,6 @@ -include ../tools.mk -# This tests the different -Zrelro-level values, and makes sure that they they work properly. +# This tests the different -Zrelro-level values, and makes sure that they work properly. all: ifeq ($(UNAME),Linux) diff --git a/src/test/run-make-fulldeps/relro-levels/hello.rs b/src/test/run-make-fulldeps/relro-levels/hello.rs index 41782851a1a..e7a11a969c0 100644 --- a/src/test/run-make-fulldeps/relro-levels/hello.rs +++ b/src/test/run-make-fulldeps/relro-levels/hello.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("Hello, world!"); } diff --git a/src/test/run-make-fulldeps/reproducible-build/linker.rs b/src/test/run-make-fulldeps/reproducible-build/linker.rs index fd8946708bf..998d1f32859 100644 --- a/src/test/run-make-fulldeps/reproducible-build/linker.rs +++ b/src/test/run-make-fulldeps/reproducible-build/linker.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::env; use std::path::Path; use std::fs::File; diff --git a/src/test/run-make-fulldeps/reproducible-build/reproducible-build-aux.rs b/src/test/run-make-fulldeps/reproducible-build/reproducible-build-aux.rs index 9ef853e7996..8105b3d2bda 100644 --- a/src/test/run-make-fulldeps/reproducible-build/reproducible-build-aux.rs +++ b/src/test/run-make-fulldeps/reproducible-build/reproducible-build-aux.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub static STATIC: i32 = 1234; diff --git a/src/test/run-make-fulldeps/reproducible-build/reproducible-build.rs b/src/test/run-make-fulldeps/reproducible-build/reproducible-build.rs index a040c0f858d..a6c04774c86 100644 --- a/src/test/run-make-fulldeps/reproducible-build/reproducible-build.rs +++ b/src/test/run-make-fulldeps/reproducible-build/reproducible-build.rs @@ -1,15 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test case makes sure that two identical invocations of the compiler -// (i.e. same code base, same compile-flags, same compiler-versions, etc.) +// (i.e., same code base, same compile-flags, same compiler-versions, etc.) // produce the same output. In the past, symbol names of monomorphized functions // were not deterministic (which we want to avoid). // diff --git a/src/test/run-make-fulldeps/resolve-rename/bar.rs b/src/test/run-make-fulldeps/resolve-rename/bar.rs index 1552b45f2fc..4a09ce355e6 100644 --- a/src/test/run-make-fulldeps/resolve-rename/bar.rs +++ b/src/test/run-make-fulldeps/resolve-rename/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] extern crate foo; diff --git a/src/test/run-make-fulldeps/resolve-rename/baz.rs b/src/test/run-make-fulldeps/resolve-rename/baz.rs index 27d801490e4..9176073ef97 100644 --- a/src/test/run-make-fulldeps/resolve-rename/baz.rs +++ b/src/test/run-make-fulldeps/resolve-rename/baz.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] extern crate bar; diff --git a/src/test/run-make-fulldeps/resolve-rename/foo.rs b/src/test/run-make-fulldeps/resolve-rename/foo.rs index 830c289b65f..bd6820098ee 100644 --- a/src/test/run-make-fulldeps/resolve-rename/foo.rs +++ b/src/test/run-make-fulldeps/resolve-rename/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub fn foo() {} diff --git a/src/test/run-make-fulldeps/rlib-chain/m1.rs b/src/test/run-make-fulldeps/rlib-chain/m1.rs index e3afa352938..665b206ccf1 100644 --- a/src/test/run-make-fulldeps/rlib-chain/m1.rs +++ b/src/test/run-make-fulldeps/rlib-chain/m1.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub fn m1() {} diff --git a/src/test/run-make-fulldeps/rlib-chain/m2.rs b/src/test/run-make-fulldeps/rlib-chain/m2.rs index 2b4c181134b..eba12fe1218 100644 --- a/src/test/run-make-fulldeps/rlib-chain/m2.rs +++ b/src/test/run-make-fulldeps/rlib-chain/m2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] extern crate m1; diff --git a/src/test/run-make-fulldeps/rlib-chain/m3.rs b/src/test/run-make-fulldeps/rlib-chain/m3.rs index 6323a9e65aa..ade191db49c 100644 --- a/src/test/run-make-fulldeps/rlib-chain/m3.rs +++ b/src/test/run-make-fulldeps/rlib-chain/m3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] extern crate m2; diff --git a/src/test/run-make-fulldeps/rlib-chain/m4.rs b/src/test/run-make-fulldeps/rlib-chain/m4.rs index 6c2a6685802..fa8ec6079de 100644 --- a/src/test/run-make-fulldeps/rlib-chain/m4.rs +++ b/src/test/run-make-fulldeps/rlib-chain/m4.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate m3; fn main() { m3::m3() } diff --git a/src/test/run-make-fulldeps/rustc-macro-dep-files/Makefile b/src/test/run-make-fulldeps/rustc-macro-dep-files/Makefile deleted file mode 100644 index d2c8e7fd043..00000000000 --- a/src/test/run-make-fulldeps/rustc-macro-dep-files/Makefile +++ /dev/null @@ -1,12 +0,0 @@ --include ../tools.mk - -ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1) -# ignore stage1 -all: - -else -all: - $(RUSTC) foo.rs - $(RUSTC) bar.rs --emit dep-info - $(CGREP) -v "proc-macro source" < $(TMPDIR)/bar.d -endif diff --git a/src/test/run-make-fulldeps/rustc-macro-dep-files/bar.rs b/src/test/run-make-fulldeps/rustc-macro-dep-files/bar.rs deleted file mode 100644 index 03330c3d170..00000000000 --- a/src/test/run-make-fulldeps/rustc-macro-dep-files/bar.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[macro_use] -extern crate foo; - -#[derive(A)] -struct A; - -fn main() { - let _b = B; -} diff --git a/src/test/run-make-fulldeps/rustc-macro-dep-files/foo.rs b/src/test/run-make-fulldeps/rustc-macro-dep-files/foo.rs deleted file mode 100644 index 2f2524f6ef1..00000000000 --- a/src/test/run-make-fulldeps/rustc-macro-dep-files/foo.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(A)] -pub fn derive(input: TokenStream) -> TokenStream { - let input = input.to_string(); - assert!(input.contains("struct A;")); - "struct B;".parse().unwrap() -} diff --git a/src/test/run-make-fulldeps/rustdoc-error-lines/Makefile b/src/test/run-make-fulldeps/rustdoc-error-lines/Makefile index b669f9cedc1..e09343aa937 100644 --- a/src/test/run-make-fulldeps/rustdoc-error-lines/Makefile +++ b/src/test/run-make-fulldeps/rustdoc-error-lines/Makefile @@ -5,4 +5,4 @@ all: $(RUSTDOC) --test input.rs > $(TMPDIR)/output || true - $(CGREP) 'input.rs:17:15' < $(TMPDIR)/output + $(CGREP) 'input.rs:7:15' < $(TMPDIR)/output diff --git a/src/test/run-make-fulldeps/rustdoc-error-lines/input.rs b/src/test/run-make-fulldeps/rustdoc-error-lines/input.rs index 6dc7060bc48..7b07f38f259 100644 --- a/src/test/run-make-fulldeps/rustdoc-error-lines/input.rs +++ b/src/test/run-make-fulldeps/rustdoc-error-lines/input.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for #45868 // random #![feature] to ensure that crate attrs diff --git a/src/test/run-make-fulldeps/rustdoc-io-error/Makefile b/src/test/run-make-fulldeps/rustdoc-io-error/Makefile new file mode 100644 index 00000000000..2055c9cbf2d --- /dev/null +++ b/src/test/run-make-fulldeps/rustdoc-io-error/Makefile @@ -0,0 +1,25 @@ +-include ../tools.mk + +# This test verifies that rustdoc doesn't ICE when it encounters an IO error +# while generating files. Ideally this would be a rustdoc-ui test, so we could +# verify the error message as well. + +OUTPUT_DIR := "$(TMPDIR)/rustdoc-io-error" + +# Ignore Windows: the test uses `chmod`. +ifndef IS_WINDOWS + +# This test operates by creating a temporary directory and modifying its +# permissions so that it is not writable. We have to take special care to set +# the permissions back to normal so that it's able to be deleted later. +all: + mkdir -p $(OUTPUT_DIR) + chmod u-w $(OUTPUT_DIR) + -$(shell $(RUSTDOC) -o $(OUTPUT_DIR) foo.rs) + chmod u+w $(OUTPUT_DIR) + exit $($(.SHELLSTATUS) -eq 1) + +else +all: + +endif diff --git a/src/test/run-make-fulldeps/rustdoc-io-error/foo.rs b/src/test/run-make-fulldeps/rustdoc-io-error/foo.rs new file mode 100644 index 00000000000..4a835673a59 --- /dev/null +++ b/src/test/run-make-fulldeps/rustdoc-io-error/foo.rs @@ -0,0 +1 @@ +pub struct Foo; diff --git a/src/test/run-make-fulldeps/rustdoc-output-path/foo.rs b/src/test/run-make-fulldeps/rustdoc-output-path/foo.rs index 11fc2cd2b8d..4a835673a59 100644 --- a/src/test/run-make-fulldeps/rustdoc-output-path/foo.rs +++ b/src/test/run-make-fulldeps/rustdoc-output-path/foo.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo; diff --git a/src/test/run-make-fulldeps/sanitizer-address/overflow.rs b/src/test/run-make-fulldeps/sanitizer-address/overflow.rs index 1f3c64c8c32..b997a74cc3e 100644 --- a/src/test/run-make-fulldeps/sanitizer-address/overflow.rs +++ b/src/test/run-make-fulldeps/sanitizer-address/overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let xs = [0, 1, 2, 3]; let _y = unsafe { *xs.as_ptr().offset(4) }; diff --git a/src/test/run-make-fulldeps/sanitizer-cdylib-link/library.rs b/src/test/run-make-fulldeps/sanitizer-cdylib-link/library.rs index 4ceef5d3f52..bf11553ea6b 100644 --- a/src/test/run-make-fulldeps/sanitizer-cdylib-link/library.rs +++ b/src/test/run-make-fulldeps/sanitizer-cdylib-link/library.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub extern fn overflow() { let xs = [0, 1, 2, 3]; diff --git a/src/test/run-make-fulldeps/sanitizer-cdylib-link/program.rs b/src/test/run-make-fulldeps/sanitizer-cdylib-link/program.rs index 9f52817c851..3bbbcd9c6f8 100644 --- a/src/test/run-make-fulldeps/sanitizer-cdylib-link/program.rs +++ b/src/test/run-make-fulldeps/sanitizer-cdylib-link/program.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { fn overflow(); } diff --git a/src/test/run-make-fulldeps/sanitizer-dylib-link/library.rs b/src/test/run-make-fulldeps/sanitizer-dylib-link/library.rs index 4ceef5d3f52..bf11553ea6b 100644 --- a/src/test/run-make-fulldeps/sanitizer-dylib-link/library.rs +++ b/src/test/run-make-fulldeps/sanitizer-dylib-link/library.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub extern fn overflow() { let xs = [0, 1, 2, 3]; diff --git a/src/test/run-make-fulldeps/sanitizer-dylib-link/program.rs b/src/test/run-make-fulldeps/sanitizer-dylib-link/program.rs index 9f52817c851..3bbbcd9c6f8 100644 --- a/src/test/run-make-fulldeps/sanitizer-dylib-link/program.rs +++ b/src/test/run-make-fulldeps/sanitizer-dylib-link/program.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { fn overflow(); } diff --git a/src/test/run-make-fulldeps/sanitizer-invalid-cratetype/hello.rs b/src/test/run-make-fulldeps/sanitizer-invalid-cratetype/hello.rs index 41782851a1a..e7a11a969c0 100644 --- a/src/test/run-make-fulldeps/sanitizer-invalid-cratetype/hello.rs +++ b/src/test/run-make-fulldeps/sanitizer-invalid-cratetype/hello.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("Hello, world!"); } diff --git a/src/test/run-make-fulldeps/sanitizer-invalid-target/hello.rs b/src/test/run-make-fulldeps/sanitizer-invalid-target/hello.rs index e9e46b7702a..d3dd5ed03d9 100644 --- a/src/test/run-make-fulldeps/sanitizer-invalid-target/hello.rs +++ b/src/test/run-make-fulldeps/sanitizer-invalid-target/hello.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(no_core)] #![no_core] #![no_main] diff --git a/src/test/run-make-fulldeps/sanitizer-leak/leak.rs b/src/test/run-make-fulldeps/sanitizer-leak/leak.rs index 279da6aaae7..ab8df5c7bfd 100644 --- a/src/test/run-make-fulldeps/sanitizer-leak/leak.rs +++ b/src/test/run-make-fulldeps/sanitizer-leak/leak.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem; fn main() { diff --git a/src/test/run-make-fulldeps/sanitizer-memory/uninit.rs b/src/test/run-make-fulldeps/sanitizer-memory/uninit.rs index 8350c7de3ac..163e2c5a462 100644 --- a/src/test/run-make-fulldeps/sanitizer-memory/uninit.rs +++ b/src/test/run-make-fulldeps/sanitizer-memory/uninit.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem; fn main() { diff --git a/src/test/run-make-fulldeps/sanitizer-staticlib-link/library.rs b/src/test/run-make-fulldeps/sanitizer-staticlib-link/library.rs index 4ceef5d3f52..bf11553ea6b 100644 --- a/src/test/run-make-fulldeps/sanitizer-staticlib-link/library.rs +++ b/src/test/run-make-fulldeps/sanitizer-staticlib-link/library.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub extern fn overflow() { let xs = [0, 1, 2, 3]; diff --git a/src/test/run-make-fulldeps/save-analysis-fail/SameDir.rs b/src/test/run-make-fulldeps/save-analysis-fail/SameDir.rs index fe70ac1edef..2c690d5f759 100644 --- a/src/test/run-make-fulldeps/save-analysis-fail/SameDir.rs +++ b/src/test/run-make-fulldeps/save-analysis-fail/SameDir.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // sub-module in the same directory as the main crate file pub struct SameStruct { diff --git a/src/test/run-make-fulldeps/save-analysis-fail/SameDir3.rs b/src/test/run-make-fulldeps/save-analysis-fail/SameDir3.rs index 315f900868b..fab03ee2e3d 100644 --- a/src/test/run-make-fulldeps/save-analysis-fail/SameDir3.rs +++ b/src/test/run-make-fulldeps/save-analysis-fail/SameDir3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn hello(x: isize) { println!("macro {} :-(", x); } diff --git a/src/test/run-make-fulldeps/save-analysis-fail/SubDir/mod.rs b/src/test/run-make-fulldeps/save-analysis-fail/SubDir/mod.rs index fe84db08da9..511721d92a3 100644 --- a/src/test/run-make-fulldeps/save-analysis-fail/SubDir/mod.rs +++ b/src/test/run-make-fulldeps/save-analysis-fail/SubDir/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // sub-module in a sub-directory use sub::sub2 as msalias; diff --git a/src/test/run-make-fulldeps/save-analysis-fail/foo.rs b/src/test/run-make-fulldeps/save-analysis-fail/foo.rs index b844f2e49e7..e042210ac79 100644 --- a/src/test/run-make-fulldeps/save-analysis-fail/foo.rs +++ b/src/test/run-make-fulldeps/save-analysis-fail/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![ crate_name = "test" ] #![feature(box_syntax)] #![feature(rustc_private)] diff --git a/src/test/run-make-fulldeps/save-analysis-fail/krate2.rs b/src/test/run-make-fulldeps/save-analysis-fail/krate2.rs index 2c6f517ff38..7d787e0c987 100644 --- a/src/test/run-make-fulldeps/save-analysis-fail/krate2.rs +++ b/src/test/run-make-fulldeps/save-analysis-fail/krate2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![ crate_name = "krate2" ] #![ crate_type = "lib" ] diff --git a/src/test/run-make-fulldeps/save-analysis-rfc2126/Makefile b/src/test/run-make-fulldeps/save-analysis-rfc2126/Makefile index 2b931d89f1f..bf98fcd10cf 100644 --- a/src/test/run-make-fulldeps/save-analysis-rfc2126/Makefile +++ b/src/test/run-make-fulldeps/save-analysis-rfc2126/Makefile @@ -1,12 +1,9 @@ -include ../tools.mk -all: extern_absolute_paths.rs extern_in_paths.rs krate2 +all: extern_absolute_paths.rs krate2 $(RUSTC) extern_absolute_paths.rs -Zsave-analysis --edition=2018 \ -Z unstable-options --extern krate2 cat $(TMPDIR)/save-analysis/extern_absolute_paths.json | "$(PYTHON)" validate_json.py - $(RUSTC) extern_in_paths.rs -Zsave-analysis --edition=2018 \ - -Z unstable-options --extern krate2 - cat $(TMPDIR)/save-analysis/extern_in_paths.json | "$(PYTHON)" validate_json.py krate2: krate2.rs $(RUSTC) $< diff --git a/src/test/run-make-fulldeps/save-analysis-rfc2126/extern_absolute_paths.rs b/src/test/run-make-fulldeps/save-analysis-rfc2126/extern_absolute_paths.rs index 7e5343df841..7a8e3fff098 100644 --- a/src/test/run-make-fulldeps/save-analysis-rfc2126/extern_absolute_paths.rs +++ b/src/test/run-make-fulldeps/save-analysis-rfc2126/extern_absolute_paths.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use krate2::hello; fn main() { diff --git a/src/test/run-make-fulldeps/save-analysis-rfc2126/extern_in_paths.rs b/src/test/run-make-fulldeps/save-analysis-rfc2126/extern_in_paths.rs deleted file mode 100644 index e48627e86ba..00000000000 --- a/src/test/run-make-fulldeps/save-analysis-rfc2126/extern_in_paths.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(extern_in_paths)] - -use extern::krate2; - -fn main() { - extern::krate2::hello(); -} diff --git a/src/test/run-make-fulldeps/save-analysis-rfc2126/krate2.rs b/src/test/run-make-fulldeps/save-analysis-rfc2126/krate2.rs index 21fc57ccdf2..d24c68862b0 100644 --- a/src/test/run-make-fulldeps/save-analysis-rfc2126/krate2.rs +++ b/src/test/run-make-fulldeps/save-analysis-rfc2126/krate2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "krate2"] #![crate_type = "lib"] diff --git a/src/test/run-make-fulldeps/save-analysis-rfc2126/validate_json.py b/src/test/run-make-fulldeps/save-analysis-rfc2126/validate_json.py index caab8d0d626..882d29a8beb 100644 --- a/src/test/run-make-fulldeps/save-analysis-rfc2126/validate_json.py +++ b/src/test/run-make-fulldeps/save-analysis-rfc2126/validate_json.py @@ -1,15 +1,5 @@ #!/usr/bin/env python -# Copyright 2018 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - import sys import json diff --git a/src/test/run-make-fulldeps/save-analysis/SameDir.rs b/src/test/run-make-fulldeps/save-analysis/SameDir.rs index fe70ac1edef..2c690d5f759 100644 --- a/src/test/run-make-fulldeps/save-analysis/SameDir.rs +++ b/src/test/run-make-fulldeps/save-analysis/SameDir.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // sub-module in the same directory as the main crate file pub struct SameStruct { diff --git a/src/test/run-make-fulldeps/save-analysis/SameDir3.rs b/src/test/run-make-fulldeps/save-analysis/SameDir3.rs index 315f900868b..fab03ee2e3d 100644 --- a/src/test/run-make-fulldeps/save-analysis/SameDir3.rs +++ b/src/test/run-make-fulldeps/save-analysis/SameDir3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn hello(x: isize) { println!("macro {} :-(", x); } diff --git a/src/test/run-make-fulldeps/save-analysis/SubDir/mod.rs b/src/test/run-make-fulldeps/save-analysis/SubDir/mod.rs index fe84db08da9..511721d92a3 100644 --- a/src/test/run-make-fulldeps/save-analysis/SubDir/mod.rs +++ b/src/test/run-make-fulldeps/save-analysis/SubDir/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // sub-module in a sub-directory use sub::sub2 as msalias; diff --git a/src/test/run-make-fulldeps/save-analysis/foo.rs b/src/test/run-make-fulldeps/save-analysis/foo.rs index 5b4e4802957..90c67231e18 100644 --- a/src/test/run-make-fulldeps/save-analysis/foo.rs +++ b/src/test/run-make-fulldeps/save-analysis/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![ crate_name = "test" ] #![feature(box_syntax)] #![feature(rustc_private)] diff --git a/src/test/run-make-fulldeps/save-analysis/krate2.rs b/src/test/run-make-fulldeps/save-analysis/krate2.rs index 2c6f517ff38..7d787e0c987 100644 --- a/src/test/run-make-fulldeps/save-analysis/krate2.rs +++ b/src/test/run-make-fulldeps/save-analysis/krate2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![ crate_name = "krate2" ] #![ crate_type = "lib" ] diff --git a/src/test/run-make-fulldeps/sepcomp-cci-copies/cci_lib.rs b/src/test/run-make-fulldeps/sepcomp-cci-copies/cci_lib.rs index 62bc3294286..869d4a6cd3e 100644 --- a/src/test/run-make-fulldeps/sepcomp-cci-copies/cci_lib.rs +++ b/src/test/run-make-fulldeps/sepcomp-cci-copies/cci_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #[inline] diff --git a/src/test/run-make-fulldeps/sepcomp-cci-copies/foo.rs b/src/test/run-make-fulldeps/sepcomp-cci-copies/foo.rs index e00cab20f6b..ba251fcb0ac 100644 --- a/src/test/run-make-fulldeps/sepcomp-cci-copies/foo.rs +++ b/src/test/run-make-fulldeps/sepcomp-cci-copies/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate cci_lib; use cci_lib::cci_fn; diff --git a/src/test/run-make-fulldeps/sepcomp-inlining/foo.rs b/src/test/run-make-fulldeps/sepcomp-inlining/foo.rs index 5b62c1b0626..2fe5f9cb726 100644 --- a/src/test/run-make-fulldeps/sepcomp-inlining/foo.rs +++ b/src/test/run-make-fulldeps/sepcomp-inlining/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(start)] #[inline] diff --git a/src/test/run-make-fulldeps/sepcomp-separate/foo.rs b/src/test/run-make-fulldeps/sepcomp-separate/foo.rs index 64a76e9e0ed..169bafa9b3a 100644 --- a/src/test/run-make-fulldeps/sepcomp-separate/foo.rs +++ b/src/test/run-make-fulldeps/sepcomp-separate/foo.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - fn magic_fn() -> usize { 1234 } diff --git a/src/test/run-make-fulldeps/simd-ffi/simd.rs b/src/test/run-make-fulldeps/simd-ffi/simd.rs index 21411a35e3c..b834e5cc463 100644 --- a/src/test/run-make-fulldeps/simd-ffi/simd.rs +++ b/src/test/run-make-fulldeps/simd-ffi/simd.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ensures that public symbols are not removed completely #![crate_type = "lib"] // we can compile to a variety of platforms, because we don't need diff --git a/src/test/run-make-fulldeps/simple-dylib/bar.rs b/src/test/run-make-fulldeps/simple-dylib/bar.rs index 4c79f7e2855..c5c0bc606cd 100644 --- a/src/test/run-make-fulldeps/simple-dylib/bar.rs +++ b/src/test/run-make-fulldeps/simple-dylib/bar.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn bar() {} diff --git a/src/test/run-make-fulldeps/simple-dylib/foo.rs b/src/test/run-make-fulldeps/simple-dylib/foo.rs index 858ef492ace..8d68535e3b6 100644 --- a/src/test/run-make-fulldeps/simple-dylib/foo.rs +++ b/src/test/run-make-fulldeps/simple-dylib/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate bar; fn main() { diff --git a/src/test/run-make-fulldeps/simple-rlib/bar.rs b/src/test/run-make-fulldeps/simple-rlib/bar.rs index 4c79f7e2855..c5c0bc606cd 100644 --- a/src/test/run-make-fulldeps/simple-rlib/bar.rs +++ b/src/test/run-make-fulldeps/simple-rlib/bar.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn bar() {} diff --git a/src/test/run-make-fulldeps/simple-rlib/foo.rs b/src/test/run-make-fulldeps/simple-rlib/foo.rs index 858ef492ace..8d68535e3b6 100644 --- a/src/test/run-make-fulldeps/simple-rlib/foo.rs +++ b/src/test/run-make-fulldeps/simple-rlib/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate bar; fn main() { diff --git a/src/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names1.rs b/src/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names1.rs index 7344bdf49f6..b85a428278c 100644 --- a/src/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names1.rs +++ b/src/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="rlib"] pub trait Foo { diff --git a/src/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names2.rs b/src/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names2.rs index eacba4ddb25..6df74d2491b 100644 --- a/src/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names2.rs +++ b/src/test/run-make-fulldeps/stable-symbol-names/stable-symbol-names2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="rlib"] extern crate stable_symbol_names1; diff --git a/src/test/run-make-fulldeps/static-dylib-by-default/bar.rs b/src/test/run-make-fulldeps/static-dylib-by-default/bar.rs index 63da277dece..5381e7f24bc 100644 --- a/src/test/run-make-fulldeps/static-dylib-by-default/bar.rs +++ b/src/test/run-make-fulldeps/static-dylib-by-default/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] extern crate foo; diff --git a/src/test/run-make-fulldeps/static-dylib-by-default/foo.rs b/src/test/run-make-fulldeps/static-dylib-by-default/foo.rs index 341040e653c..7ebec872055 100644 --- a/src/test/run-make-fulldeps/static-dylib-by-default/foo.rs +++ b/src/test/run-make-fulldeps/static-dylib-by-default/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![crate_type = "dylib"] diff --git a/src/test/run-make-fulldeps/static-dylib-by-default/main.c b/src/test/run-make-fulldeps/static-dylib-by-default/main.c index 30bb0783edf..5f7f2c27cd3 100644 --- a/src/test/run-make-fulldeps/static-dylib-by-default/main.c +++ b/src/test/run-make-fulldeps/static-dylib-by-default/main.c @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern void bar(); int main() { diff --git a/src/test/run-make-fulldeps/static-nobundle/aaa.c b/src/test/run-make-fulldeps/static-nobundle/aaa.c index 806ef878c70..d300fdf1c17 100644 --- a/src/test/run-make-fulldeps/static-nobundle/aaa.c +++ b/src/test/run-make-fulldeps/static-nobundle/aaa.c @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - void native_func() {} diff --git a/src/test/run-make-fulldeps/static-nobundle/bbb.rs b/src/test/run-make-fulldeps/static-nobundle/bbb.rs index 2bd69c99327..0e10fc3dd3a 100644 --- a/src/test/run-make-fulldeps/static-nobundle/bbb.rs +++ b/src/test/run-make-fulldeps/static-nobundle/bbb.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![feature(static_nobundle)] diff --git a/src/test/run-make-fulldeps/static-nobundle/ccc.rs b/src/test/run-make-fulldeps/static-nobundle/ccc.rs index bd34753a00d..a1f875a52d5 100644 --- a/src/test/run-make-fulldeps/static-nobundle/ccc.rs +++ b/src/test/run-make-fulldeps/static-nobundle/ccc.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] extern crate bbb; diff --git a/src/test/run-make-fulldeps/static-nobundle/ddd.rs b/src/test/run-make-fulldeps/static-nobundle/ddd.rs index f7d23a899f7..50b41211ff0 100644 --- a/src/test/run-make-fulldeps/static-nobundle/ddd.rs +++ b/src/test/run-make-fulldeps/static-nobundle/ddd.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate ccc; fn main() { diff --git a/src/test/run-make-fulldeps/static-unwinding/lib.rs b/src/test/run-make-fulldeps/static-unwinding/lib.rs index 12c72d54c09..3fb1117a110 100644 --- a/src/test/run-make-fulldeps/static-unwinding/lib.rs +++ b/src/test/run-make-fulldeps/static-unwinding/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub static mut statik: isize = 0; diff --git a/src/test/run-make-fulldeps/static-unwinding/main.rs b/src/test/run-make-fulldeps/static-unwinding/main.rs index 1cd785334f6..0c66ea1aa07 100644 --- a/src/test/run-make-fulldeps/static-unwinding/main.rs +++ b/src/test/run-make-fulldeps/static-unwinding/main.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate lib; use std::thread; diff --git a/src/test/run-make-fulldeps/staticlib-blank-lib/foo.rs b/src/test/run-make-fulldeps/staticlib-blank-lib/foo.rs index 6010e60e95c..48ba8b7f1b7 100644 --- a/src/test/run-make-fulldeps/staticlib-blank-lib/foo.rs +++ b/src/test/run-make-fulldeps/staticlib-blank-lib/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "staticlib"] #[link(name = "foo", kind = "static")] diff --git a/src/test/run-make-fulldeps/std-core-cycle/bar.rs b/src/test/run-make-fulldeps/std-core-cycle/bar.rs index 4b885e5e2bb..9f5e7c29bdd 100644 --- a/src/test/run-make-fulldeps/std-core-cycle/bar.rs +++ b/src/test/run-make-fulldeps/std-core-cycle/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(allocator_api)] #![crate_type = "rlib"] diff --git a/src/test/run-make-fulldeps/std-core-cycle/foo.rs b/src/test/run-make-fulldeps/std-core-cycle/foo.rs index 46047fb835d..3c80bc45a5b 100644 --- a/src/test/run-make-fulldeps/std-core-cycle/foo.rs +++ b/src/test/run-make-fulldeps/std-core-cycle/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "cdylib"] extern crate bar; diff --git a/src/test/run-make-fulldeps/suspicious-library/bar.rs b/src/test/run-make-fulldeps/suspicious-library/bar.rs index ed0e8a7e23e..550c94cd0c6 100644 --- a/src/test/run-make-fulldeps/suspicious-library/bar.rs +++ b/src/test/run-make-fulldeps/suspicious-library/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() { foo::foo() } diff --git a/src/test/run-make-fulldeps/suspicious-library/foo.rs b/src/test/run-make-fulldeps/suspicious-library/foo.rs index 2ec6e3834a1..a382d8f2c7f 100644 --- a/src/test/run-make-fulldeps/suspicious-library/foo.rs +++ b/src/test/run-make-fulldeps/suspicious-library/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] pub fn foo() {} diff --git a/src/test/run-make-fulldeps/symbol-visibility/a_cdylib.rs b/src/test/run-make-fulldeps/symbol-visibility/a_cdylib.rs index 9a70542c06c..d4fbff85bfe 100644 --- a/src/test/run-make-fulldeps/symbol-visibility/a_cdylib.rs +++ b/src/test/run-make-fulldeps/symbol-visibility/a_cdylib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="cdylib"] extern crate an_rlib; diff --git a/src/test/run-make-fulldeps/symbol-visibility/a_rust_dylib.rs b/src/test/run-make-fulldeps/symbol-visibility/a_rust_dylib.rs index 99e748ec2ef..a47df0ab7ee 100644 --- a/src/test/run-make-fulldeps/symbol-visibility/a_rust_dylib.rs +++ b/src/test/run-make-fulldeps/symbol-visibility/a_rust_dylib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="dylib"] extern crate an_rlib; diff --git a/src/test/run-make-fulldeps/symbol-visibility/an_executable.rs b/src/test/run-make-fulldeps/symbol-visibility/an_executable.rs index 73059c5e374..3f5e125ad19 100644 --- a/src/test/run-make-fulldeps/symbol-visibility/an_executable.rs +++ b/src/test/run-make-fulldeps/symbol-visibility/an_executable.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="bin"] extern crate an_rlib; diff --git a/src/test/run-make-fulldeps/symbol-visibility/an_rlib.rs b/src/test/run-make-fulldeps/symbol-visibility/an_rlib.rs index a1d73afd30b..3696422b11e 100644 --- a/src/test/run-make-fulldeps/symbol-visibility/an_rlib.rs +++ b/src/test/run-make-fulldeps/symbol-visibility/an_rlib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="rlib"] pub fn public_rust_function_from_rlib() {} diff --git a/src/test/run-make-fulldeps/symbols-include-type-name/lib.rs b/src/test/run-make-fulldeps/symbols-include-type-name/lib.rs index d84f1617db5..37d44591767 100644 --- a/src/test/run-make-fulldeps/symbols-include-type-name/lib.rs +++ b/src/test/run-make-fulldeps/symbols-include-type-name/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Def { pub id: i32, } diff --git a/src/test/run-make-fulldeps/symlinked-extern/bar.rs b/src/test/run-make-fulldeps/symlinked-extern/bar.rs index 79103f24017..cd9c959d5e6 100644 --- a/src/test/run-make-fulldeps/symlinked-extern/bar.rs +++ b/src/test/run-make-fulldeps/symlinked-extern/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] extern crate foo; diff --git a/src/test/run-make-fulldeps/symlinked-extern/baz.rs b/src/test/run-make-fulldeps/symlinked-extern/baz.rs index 0f6ba254368..cd433a3ac7a 100644 --- a/src/test/run-make-fulldeps/symlinked-extern/baz.rs +++ b/src/test/run-make-fulldeps/symlinked-extern/baz.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate bar; extern crate foo; diff --git a/src/test/run-make-fulldeps/symlinked-extern/foo.rs b/src/test/run-make-fulldeps/symlinked-extern/foo.rs index 0b8bb64d375..c00700b8cf8 100644 --- a/src/test/run-make-fulldeps/symlinked-extern/foo.rs +++ b/src/test/run-make-fulldeps/symlinked-extern/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub struct S; diff --git a/src/test/run-make-fulldeps/symlinked-libraries/bar.rs b/src/test/run-make-fulldeps/symlinked-libraries/bar.rs index 73596f93f56..fde0d746634 100644 --- a/src/test/run-make-fulldeps/symlinked-libraries/bar.rs +++ b/src/test/run-make-fulldeps/symlinked-libraries/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() { diff --git a/src/test/run-make-fulldeps/symlinked-libraries/foo.rs b/src/test/run-make-fulldeps/symlinked-libraries/foo.rs index fdb29974cd8..cde9e291b45 100644 --- a/src/test/run-make-fulldeps/symlinked-libraries/foo.rs +++ b/src/test/run-make-fulldeps/symlinked-libraries/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] pub fn bar() {} diff --git a/src/test/run-make-fulldeps/symlinked-rlib/bar.rs b/src/test/run-make-fulldeps/symlinked-rlib/bar.rs index e8f06680862..fde0d746634 100644 --- a/src/test/run-make-fulldeps/symlinked-rlib/bar.rs +++ b/src/test/run-make-fulldeps/symlinked-rlib/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate foo; fn main() { diff --git a/src/test/run-make-fulldeps/symlinked-rlib/foo.rs b/src/test/run-make-fulldeps/symlinked-rlib/foo.rs index 5abbb1dcbce..c5c0bc606cd 100644 --- a/src/test/run-make-fulldeps/symlinked-rlib/foo.rs +++ b/src/test/run-make-fulldeps/symlinked-rlib/foo.rs @@ -1,11 +1 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn bar() {} diff --git a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py index 210059e1010..e0fa4e8f5de 100644 --- a/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py +++ b/src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py @@ -1,13 +1,3 @@ -# Copyright 2015 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - import sys import os from os import listdir diff --git a/src/test/run-make-fulldeps/target-cpu-native/foo.rs b/src/test/run-make-fulldeps/target-cpu-native/foo.rs index f7a9f969060..f79c691f085 100644 --- a/src/test/run-make-fulldeps/target-cpu-native/foo.rs +++ b/src/test/run-make-fulldeps/target-cpu-native/foo.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { } diff --git a/src/test/run-make-fulldeps/target-specs/foo.rs b/src/test/run-make-fulldeps/target-specs/foo.rs index bbd1c5d900f..42130068695 100644 --- a/src/test/run-make-fulldeps/target-specs/foo.rs +++ b/src/test/run-make-fulldeps/target-specs/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(lang_items, no_core, optin_builtin_traits)] #![no_core] diff --git a/src/test/run-make-fulldeps/test-harness/test-ignore-cfg.rs b/src/test/run-make-fulldeps/test-harness/test-ignore-cfg.rs index 990d3d10485..31ef131f2ad 100644 --- a/src/test/run-make-fulldeps/test-harness/test-ignore-cfg.rs +++ b/src/test/run-make-fulldeps/test-harness/test-ignore-cfg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[test] #[cfg_attr(ignorecfg, ignore)] fn shouldignore() { diff --git a/src/test/run-make-fulldeps/tools.mk b/src/test/run-make-fulldeps/tools.mk index 3de358fa500..79399281804 100644 --- a/src/test/run-make-fulldeps/tools.mk +++ b/src/test/run-make-fulldeps/tools.mk @@ -76,7 +76,7 @@ endif # Extra flags needed to compile a working executable with the standard library ifdef IS_WINDOWS ifdef IS_MSVC - EXTRACFLAGS := ws2_32.lib userenv.lib shell32.lib advapi32.lib + EXTRACFLAGS := ws2_32.lib userenv.lib advapi32.lib else EXTRACFLAGS := -lws2_32 -luserenv endif diff --git a/src/test/run-make-fulldeps/treat-err-as-bug/err.rs b/src/test/run-make-fulldeps/treat-err-as-bug/err.rs index 078495663ac..136b2f30702 100644 --- a/src/test/run-make-fulldeps/treat-err-as-bug/err.rs +++ b/src/test/run-make-fulldeps/treat-err-as-bug/err.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="rlib"] pub static C: u32 = 0-1; diff --git a/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateA.rs b/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateA.rs index e40266bb4cd..4871c8c2e9c 100644 --- a/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateA.rs +++ b/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateA.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub struct Foo; } diff --git a/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateB.rs b/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateB.rs index da4ea1c9387..24fcc7cadc1 100644 --- a/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateB.rs +++ b/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateB.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate crateA; pub fn try_foo(x: crateA::Foo){} diff --git a/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs b/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs index 210bc4c8320..12898aa5c74 100644 --- a/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs +++ b/src/test/run-make-fulldeps/type-mismatch-same-crate-name/crateC.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This tests the extra note reported when a type error deals with // seemingly identical types. // The main use case of this error is when there are two crates diff --git a/src/test/run-make-fulldeps/use-extern-for-plugins/bar.rs b/src/test/run-make-fulldeps/use-extern-for-plugins/bar.rs index 3e99ed60c62..704d2120362 100644 --- a/src/test/run-make-fulldeps/use-extern-for-plugins/bar.rs +++ b/src/test/run-make-fulldeps/use-extern-for-plugins/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(no_core)] #![no_core] #![crate_type = "lib"] diff --git a/src/test/run-make-fulldeps/use-extern-for-plugins/baz.rs b/src/test/run-make-fulldeps/use-extern-for-plugins/baz.rs index 3f15d0e6e05..49a96a0c80b 100644 --- a/src/test/run-make-fulldeps/use-extern-for-plugins/baz.rs +++ b/src/test/run-make-fulldeps/use-extern-for-plugins/baz.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(no_core)] #![no_core] #![crate_type = "lib"] diff --git a/src/test/run-make-fulldeps/use-extern-for-plugins/foo.rs b/src/test/run-make-fulldeps/use-extern-for-plugins/foo.rs index 0afd3be466d..dffdc079887 100644 --- a/src/test/run-make-fulldeps/use-extern-for-plugins/foo.rs +++ b/src/test/run-make-fulldeps/use-extern-for-plugins/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] #![crate_type = "lib"] #![crate_name = "a"] diff --git a/src/test/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs b/src/test/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs index c0bce6e3371..62a0a9d8f1b 100644 --- a/src/test/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs +++ b/src/test/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub mod foo { diff --git a/src/test/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs b/src/test/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs index 62730a5653f..d262d6f9877 100644 --- a/src/test/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs +++ b/src/test/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = Baz{}; } diff --git a/src/test/run-make-fulldeps/used/used.rs b/src/test/run-make-fulldeps/used/used.rs index 6992dd94af3..dca0a5e1167 100644 --- a/src/test/run-make-fulldeps/used/used.rs +++ b/src/test/run-make-fulldeps/used/used.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #[used] diff --git a/src/test/run-make-fulldeps/volatile-intrinsics/main.rs b/src/test/run-make-fulldeps/volatile-intrinsics/main.rs index d214a20139c..4295d95f3f3 100644 --- a/src/test/run-make-fulldeps/volatile-intrinsics/main.rs +++ b/src/test/run-make-fulldeps/volatile-intrinsics/main.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(core_intrinsics, volatile)] use std::intrinsics::{ diff --git a/src/test/run-make-fulldeps/weird-output-filenames/foo.rs b/src/test/run-make-fulldeps/weird-output-filenames/foo.rs index 8ae3d072362..f328e4d9d04 100644 --- a/src/test/run-make-fulldeps/weird-output-filenames/foo.rs +++ b/src/test/run-make-fulldeps/weird-output-filenames/foo.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/run-make-fulldeps/windows-spawn/hello.rs b/src/test/run-make-fulldeps/windows-spawn/hello.rs index b177f41941d..47ad8c63411 100644 --- a/src/test/run-make-fulldeps/windows-spawn/hello.rs +++ b/src/test/run-make-fulldeps/windows-spawn/hello.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("Hello World!"); } diff --git a/src/test/run-make-fulldeps/windows-spawn/spawn.rs b/src/test/run-make-fulldeps/windows-spawn/spawn.rs index 2913cbe2260..c34da3d5fde 100644 --- a/src/test/run-make-fulldeps/windows-spawn/spawn.rs +++ b/src/test/run-make-fulldeps/windows-spawn/spawn.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::io::ErrorKind; use std::process::Command; diff --git a/src/test/run-make-fulldeps/windows-subsystem/console.rs b/src/test/run-make-fulldeps/windows-subsystem/console.rs index ffad1e35ee6..4a2e9bb3c5c 100644 --- a/src/test/run-make-fulldeps/windows-subsystem/console.rs +++ b/src/test/run-make-fulldeps/windows-subsystem/console.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![windows_subsystem = "console"] fn main() {} diff --git a/src/test/run-make-fulldeps/windows-subsystem/windows.rs b/src/test/run-make-fulldeps/windows-subsystem/windows.rs index 33cbe320591..1138248f07d 100644 --- a/src/test/run-make-fulldeps/windows-subsystem/windows.rs +++ b/src/test/run-make-fulldeps/windows-subsystem/windows.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![windows_subsystem = "windows"] fn main() {} diff --git a/src/test/run-make/git_clone_sha1.sh b/src/test/run-make/git_clone_sha1.sh index efcc93c73a5..626e4e42761 100644 --- a/src/test/run-make/git_clone_sha1.sh +++ b/src/test/run-make/git_clone_sha1.sh @@ -1,15 +1,5 @@ #!/bin/bash -x -# Copyright 2018 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - # Usage: $0 project_name url sha1 # Get the crate with the specified sha1. # diff --git a/src/test/run-make/llvm-outputs/Makefile b/src/test/run-make/llvm-outputs/Makefile new file mode 100644 index 00000000000..d7f67577b04 --- /dev/null +++ b/src/test/run-make/llvm-outputs/Makefile @@ -0,0 +1,5 @@ +-include ../../run-make-fulldeps/tools.mk + +all: + echo 'fn main() {}' | $(BARE_RUSTC) - --out-dir=$(TMPDIR)/random_directory_that_does_not_exist_ir/ --emit=llvm-ir + echo 'fn main() {}' | $(BARE_RUSTC) - --out-dir=$(TMPDIR)/random_directory_that_does_not_exist_bc/ --emit=llvm-bc diff --git a/src/test/run-make/rustc-macro-dep-files/Makefile b/src/test/run-make/rustc-macro-dep-files/Makefile new file mode 100644 index 00000000000..0420a389168 --- /dev/null +++ b/src/test/run-make/rustc-macro-dep-files/Makefile @@ -0,0 +1,8 @@ +-include ../../run-make-fulldeps/tools.mk + +# FIXME(eddyb) provide `HOST_RUSTC` and `TARGET_RUSTC` +# instead of hardcoding them everywhere they're needed. +all: + $(BARE_RUSTC) foo.rs --out-dir $(TMPDIR) + $(RUSTC) bar.rs --target $(TARGET) --emit dep-info + $(CGREP) -v "proc-macro source" < $(TMPDIR)/bar.d diff --git a/src/test/run-make/rustc-macro-dep-files/bar.rs b/src/test/run-make/rustc-macro-dep-files/bar.rs new file mode 100644 index 00000000000..4a3b3364bf0 --- /dev/null +++ b/src/test/run-make/rustc-macro-dep-files/bar.rs @@ -0,0 +1,8 @@ +#![no_std] +#![crate_type = "lib"] + +#[macro_use] +extern crate foo; + +#[derive(A)] +struct A; diff --git a/src/test/run-make/rustc-macro-dep-files/foo.rs b/src/test/run-make/rustc-macro-dep-files/foo.rs new file mode 100644 index 00000000000..00b1c26d43f --- /dev/null +++ b/src/test/run-make/rustc-macro-dep-files/foo.rs @@ -0,0 +1,12 @@ +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(A)] +pub fn derive(input: TokenStream) -> TokenStream { + let input = input.to_string(); + assert!(input.contains("struct A;")); + "struct B;".parse().unwrap() +} diff --git a/src/test/run-make/thumb-none-cortex-m/Makefile b/src/test/run-make/thumb-none-cortex-m/Makefile index 741bce921e6..819439069ea 100644 --- a/src/test/run-make/thumb-none-cortex-m/Makefile +++ b/src/test/run-make/thumb-none-cortex-m/Makefile @@ -32,7 +32,10 @@ all: mkdir -p $(WORK_DIR) -cd $(WORK_DIR) && rm -rf $(CRATE) cd $(WORK_DIR) && bash -x $(HERE)/../git_clone_sha1.sh $(CRATE) $(CRATE_URL) $(CRATE_SHA1) - cd $(WORK_DIR) && cd $(CRATE) && $(CARGO) build --target $(TARGET) -v + # HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features. + # These come from the top-level Rust workspace, that this crate is not a + # member of, but Cargo tries to load the workspace `Cargo.toml` anyway. + cd $(WORK_DIR) && cd $(CRATE) && env RUSTC_BOOTSTRAP=1 $(CARGO) build --target $(TARGET) -v else all: diff --git a/src/test/run-make/thumb-none-qemu/script.sh b/src/test/run-make/thumb-none-qemu/script.sh index 0f1c49f3a71..c5cbff5c3c3 100644 --- a/src/test/run-make/thumb-none-qemu/script.sh +++ b/src/test/run-make/thumb-none-qemu/script.sh @@ -8,9 +8,12 @@ pushd $WORK_DIR rm -rf $CRATE || echo OK cp -a $HERE/example . pushd $CRATE - env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" \ + # HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features. + # These come from the top-level Rust workspace, that this crate is not a + # member of, but Cargo tries to load the workspace `Cargo.toml` anyway. + env RUSTC_BOOTSTRAP=1 RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" \ $CARGO run --target $TARGET | grep "x = 42" - env RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" \ + env RUSTC_BOOTSTRAP=1 RUSTFLAGS="-C linker=arm-none-eabi-ld -C link-arg=-Tlink.x" \ $CARGO run --target $TARGET --release | grep "x = 42" popd popd diff --git a/src/test/run-make/wasm-custom-section/bar.rs b/src/test/run-make/wasm-custom-section/bar.rs index 6b165f1f700..c95f3e1438b 100644 --- a/src/test/run-make/wasm-custom-section/bar.rs +++ b/src/test/run-make/wasm-custom-section/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "cdylib"] #![deny(warnings)] diff --git a/src/test/run-make/wasm-custom-section/foo.js b/src/test/run-make/wasm-custom-section/foo.js index e7a4cfc344e..57a0f50732d 100644 --- a/src/test/run-make/wasm-custom-section/foo.js +++ b/src/test/run-make/wasm-custom-section/foo.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const fs = require('fs'); const process = require('process'); const assert = require('assert'); diff --git a/src/test/run-make/wasm-custom-section/foo.rs b/src/test/run-make/wasm-custom-section/foo.rs index 6a35d743710..61f81f024b5 100644 --- a/src/test/run-make/wasm-custom-section/foo.rs +++ b/src/test/run-make/wasm-custom-section/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![deny(warnings)] diff --git a/src/test/run-make/wasm-custom-sections-opt/foo.js b/src/test/run-make/wasm-custom-sections-opt/foo.js index 1d1a9bd13ee..9663f377ef4 100644 --- a/src/test/run-make/wasm-custom-sections-opt/foo.js +++ b/src/test/run-make/wasm-custom-sections-opt/foo.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const fs = require('fs'); const process = require('process'); const assert = require('assert'); diff --git a/src/test/run-make/wasm-custom-sections-opt/foo.rs b/src/test/run-make/wasm-custom-sections-opt/foo.rs index 4d983514a23..9af7728b7f3 100644 --- a/src/test/run-make/wasm-custom-sections-opt/foo.rs +++ b/src/test/run-make/wasm-custom-sections-opt/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "cdylib"] #![deny(warnings)] diff --git a/src/test/run-make/wasm-export-all-symbols/bar.rs b/src/test/run-make/wasm-export-all-symbols/bar.rs index 5d4ce06a978..c5de87e8e72 100644 --- a/src/test/run-make/wasm-export-all-symbols/bar.rs +++ b/src/test/run-make/wasm-export-all-symbols/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #[no_mangle] diff --git a/src/test/run-make/wasm-export-all-symbols/foo.rs b/src/test/run-make/wasm-export-all-symbols/foo.rs index fc1ed31771a..4811b24bc6b 100644 --- a/src/test/run-make/wasm-export-all-symbols/foo.rs +++ b/src/test/run-make/wasm-export-all-symbols/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "cdylib"] extern crate bar; diff --git a/src/test/run-make/wasm-export-all-symbols/verify.js b/src/test/run-make/wasm-export-all-symbols/verify.js index 5a505ea30c8..0f56fa45c22 100644 --- a/src/test/run-make/wasm-export-all-symbols/verify.js +++ b/src/test/run-make/wasm-export-all-symbols/verify.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const fs = require('fs'); const process = require('process'); const assert = require('assert'); diff --git a/src/test/run-make/wasm-import-module/bar.rs b/src/test/run-make/wasm-import-module/bar.rs index bd27be32b21..206f7c63e03 100644 --- a/src/test/run-make/wasm-import-module/bar.rs +++ b/src/test/run-make/wasm-import-module/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "cdylib"] #![deny(warnings)] diff --git a/src/test/run-make/wasm-import-module/foo.js b/src/test/run-make/wasm-import-module/foo.js index 369962e55b1..3ea47fcc930 100644 --- a/src/test/run-make/wasm-import-module/foo.js +++ b/src/test/run-make/wasm-import-module/foo.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const fs = require('fs'); const process = require('process'); const assert = require('assert'); diff --git a/src/test/run-make/wasm-import-module/foo.rs b/src/test/run-make/wasm-import-module/foo.rs index e4009253fd2..b9f87f18d0a 100644 --- a/src/test/run-make/wasm-import-module/foo.rs +++ b/src/test/run-make/wasm-import-module/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![deny(warnings)] diff --git a/src/test/run-make/wasm-panic-small/foo.rs b/src/test/run-make/wasm-panic-small/foo.rs index 441e92976a3..fd3dddb18eb 100644 --- a/src/test/run-make/wasm-panic-small/foo.rs +++ b/src/test/run-make/wasm-panic-small/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "cdylib"] #[no_mangle] diff --git a/src/test/run-make/wasm-symbols-not-exported/bar.rs b/src/test/run-make/wasm-symbols-not-exported/bar.rs index 061280779b0..6ffbd3ec690 100644 --- a/src/test/run-make/wasm-symbols-not-exported/bar.rs +++ b/src/test/run-make/wasm-symbols-not-exported/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(panic_handler, alloc_error_handler)] #![crate_type = "cdylib"] #![no_std] diff --git a/src/test/run-make/wasm-symbols-not-exported/foo.rs b/src/test/run-make/wasm-symbols-not-exported/foo.rs index cd8c7cb205d..d46baee01b9 100644 --- a/src/test/run-make/wasm-symbols-not-exported/foo.rs +++ b/src/test/run-make/wasm-symbols-not-exported/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "cdylib"] #[no_mangle] diff --git a/src/test/run-make/wasm-symbols-not-exported/verify-exported-symbols.js b/src/test/run-make/wasm-symbols-not-exported/verify-exported-symbols.js index 060830eb01a..afc8a7241f5 100644 --- a/src/test/run-make/wasm-symbols-not-exported/verify-exported-symbols.js +++ b/src/test/run-make/wasm-symbols-not-exported/verify-exported-symbols.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const fs = require('fs'); const process = require('process'); const assert = require('assert'); diff --git a/src/test/run-make/wasm-symbols-not-imported/foo.rs b/src/test/run-make/wasm-symbols-not-imported/foo.rs index dcc2f4f5223..b25bdc9800d 100644 --- a/src/test/run-make/wasm-symbols-not-imported/foo.rs +++ b/src/test/run-make/wasm-symbols-not-imported/foo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "cdylib"] #![no_std] diff --git a/src/test/run-make/wasm-symbols-not-imported/verify-no-imports.js b/src/test/run-make/wasm-symbols-not-imported/verify-no-imports.js index 28a98b5f2c2..90e3df1d98d 100644 --- a/src/test/run-make/wasm-symbols-not-imported/verify-no-imports.js +++ b/src/test/run-make/wasm-symbols-not-imported/verify-no-imports.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const fs = require('fs'); const process = require('process'); const assert = require('assert'); diff --git a/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs b/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs index 8f54f2e2dc3..d32fafd215c 100644 --- a/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs +++ b/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] // ignore-cross-compile @@ -25,7 +15,6 @@ use syntax::parse::new_parser_from_source_str; use syntax::parse::parser::Parser; use syntax::parse::token; use syntax::ptr::P; -use syntax::str::char_at; use syntax::parse::attr::*; use syntax::print::pprust; use std::fmt; @@ -33,7 +22,7 @@ use std::fmt; // Copied out of syntax::util::parser_testing pub fn string_to_parser<'a>(ps: &'a ParseSess, source_str: String) -> Parser<'a> { - new_parser_from_source_str(ps, FileName::Custom("bogofile".to_owned()), source_str) + new_parser_from_source_str(ps, FileName::Custom(source_str.clone()), source_str) } fn with_error_checking_parse<'a, T, F>(s: String, ps: &'a ParseSess, f: F) -> PResult<'a, T> where diff --git a/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs b/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs deleted file mode 100644 index e7545f954da..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] -#![feature(proc_macro_hygiene)] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro] -pub fn cond(input: TokenStream) -> TokenStream { - let mut conds = Vec::new(); - let mut input = input.into_iter().peekable(); - while let Some(tree) = input.next() { - let cond = match tree { - TokenTree::Group(tt) => tt.stream(), - _ => panic!("Invalid input"), - }; - let mut cond_trees = cond.clone().into_iter(); - let test = cond_trees.next().expect("Unexpected empty condition in `cond!`"); - let rhs = cond_trees.collect::(); - if rhs.is_empty() { - panic!("Invalid macro usage in cond: {}", cond); - } - let is_else = match test { - TokenTree::Ident(ref word) => &*word.to_string() == "else", - _ => false, - }; - conds.push(if is_else || input.peek().is_none() { - quote!({ $rhs }) - } else { - quote!(if $test { $rhs } else) - }); - } - - conds.into_iter().flat_map(|x| x.into_iter()).collect() -} diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs index 985f31296fb..4d6ff47a3ee 100644 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs +++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![feature(plugin_registrar, rustc_private)] diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs index 449cd29ada3..874a0ec7c13 100644 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs +++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![feature(plugin_registrar)] @@ -31,11 +21,11 @@ use rustc_plugin::Registry; #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { - reg.register_custom_derive( + reg.register_syntax_extension( Symbol::intern("derive_TotalSum"), MultiDecorator(box expand)); - reg.register_custom_derive( + reg.register_syntax_extension( Symbol::intern("derive_Nothing"), MultiDecorator(box noop)); } diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs index 7eafd834c49..699972c9a85 100644 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs +++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![feature(plugin_registrar)] diff --git a/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs b/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs deleted file mode 100644 index caf56dabf79..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] -#![feature(proc_macro_hygiene, proc_macro_quote)] - -extern crate proc_macro; - -use proc_macro::{TokenStream, quote}; - -// This macro is not very interesting, but it does contain delimited tokens with -// no content - `()` and `{}` - which has caused problems in the past. -// Also, it tests that we can escape `$` via `$$`. -#[proc_macro] -pub fn hello(_: TokenStream) -> TokenStream { - quote!({ - fn hello() {} - macro_rules! m { ($$($$t:tt)*) => { $$($$t)* } } - m!(hello()); - }) -} diff --git a/src/test/run-pass-fulldeps/auxiliary/issue-13560-1.rs b/src/test/run-pass-fulldeps/auxiliary/issue-13560-1.rs index 858d7269cd8..c3a2ae679bf 100644 --- a/src/test/run-pass-fulldeps/auxiliary/issue-13560-1.rs +++ b/src/test/run-pass-fulldeps/auxiliary/issue-13560-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "dylib"] diff --git a/src/test/run-pass-fulldeps/auxiliary/issue-13560-2.rs b/src/test/run-pass-fulldeps/auxiliary/issue-13560-2.rs index 8e46acca124..39c261e1162 100644 --- a/src/test/run-pass-fulldeps/auxiliary/issue-13560-2.rs +++ b/src/test/run-pass-fulldeps/auxiliary/issue-13560-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass-fulldeps/auxiliary/issue-13560-3.rs b/src/test/run-pass-fulldeps/auxiliary/issue-13560-3.rs index c0539aa1b6e..e991bcc1a02 100644 --- a/src/test/run-pass-fulldeps/auxiliary/issue-13560-3.rs +++ b/src/test/run-pass-fulldeps/auxiliary/issue-13560-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass-fulldeps/auxiliary/issue-16723.rs b/src/test/run-pass-fulldeps/auxiliary/issue-16723.rs deleted file mode 100644 index 7b7092c7e22..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/issue-16723.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host - -#![feature(plugin_registrar, quote, rustc_private)] -#![crate_type = "dylib"] - -extern crate syntax; -extern crate rustc; -extern crate rustc_data_structures; -extern crate rustc_plugin; -#[macro_use] extern crate smallvec; -extern crate syntax_pos; - -use smallvec::SmallVec; -use syntax::ext::base::{ExtCtxt, MacResult, MacEager}; -use syntax::tokenstream; -use rustc_plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_macro("multiple_items", expand) -} - -fn expand(cx: &mut ExtCtxt, _: syntax_pos::Span, _: &[tokenstream::TokenTree]) - -> Box { - MacEager::items(smallvec![ - quote_item!(cx, struct Struct1;).unwrap(), - quote_item!(cx, struct Struct2;).unwrap() - ]) -} diff --git a/src/test/run-pass-fulldeps/auxiliary/issue-16822.rs b/src/test/run-pass-fulldeps/auxiliary/issue-16822.rs index 0e3041c1174..9042dd39117 100644 --- a/src/test/run-pass-fulldeps/auxiliary/issue-16822.rs +++ b/src/test/run-pass-fulldeps/auxiliary/issue-16822.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] use std::cell::RefCell; diff --git a/src/test/run-pass-fulldeps/auxiliary/issue-18502.rs b/src/test/run-pass-fulldeps/auxiliary/issue-18502.rs index 718b046e1e4..4d4230607aa 100644 --- a/src/test/run-pass-fulldeps/auxiliary/issue-18502.rs +++ b/src/test/run-pass-fulldeps/auxiliary/issue-18502.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] struct Foo; diff --git a/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs b/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs new file mode 100644 index 00000000000..efa3de9a686 --- /dev/null +++ b/src/test/run-pass-fulldeps/auxiliary/issue-40001-plugin.rs @@ -0,0 +1,63 @@ +#![feature(box_syntax, plugin, plugin_registrar, rustc_private)] +#![crate_type = "dylib"] + +#[macro_use] +extern crate rustc; +extern crate rustc_plugin; +extern crate syntax; + +use rustc_plugin::Registry; +use syntax::attr; +use syntax::ext::base::*; +use syntax::feature_gate::AttributeType::Whitelisted; +use syntax::symbol::Symbol; + +use rustc::hir; +use rustc::hir::intravisit; +use rustc::hir::map as hir_map; +use hir::Node; +use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext}; +use rustc::ty; +use syntax::{ast, source_map}; + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_late_lint_pass(box MissingWhitelistedAttrPass); + reg.register_attribute("whitelisted_attr".to_string(), Whitelisted); +} + +declare_lint!(MISSING_WHITELISTED_ATTR, Deny, + "Checks for missing `whitelisted_attr` attribute"); + +struct MissingWhitelistedAttrPass; + +impl LintPass for MissingWhitelistedAttrPass { + fn name(&self) -> &'static str { + "MissingWhitelistedAttrPass" + } + + fn get_lints(&self) -> LintArray { + lint_array!(MISSING_WHITELISTED_ATTR) + } +} + +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingWhitelistedAttrPass { + fn check_fn(&mut self, + cx: &LateContext<'a, 'tcx>, + _: intravisit::FnKind<'tcx>, + _: &'tcx hir::FnDecl, + _: &'tcx hir::Body, + span: source_map::Span, + id: ast::NodeId) { + + let item = match cx.tcx.hir().get(id) { + Node::Item(item) => item, + _ => cx.tcx.hir().expect_item(cx.tcx.hir().get_parent(id)), + }; + + if !attr::contains_name(&item.attrs, "whitelisted_attr") { + cx.span_lint(MISSING_WHITELISTED_ATTR, span, + "Missing 'whitelisted_attr' attribute"); + } + } +} diff --git a/src/test/run-pass-fulldeps/auxiliary/issue_24106.rs b/src/test/run-pass-fulldeps/auxiliary/issue_24106.rs index 745fbbe769e..2c6a6034806 100644 --- a/src/test/run-pass-fulldeps/auxiliary/issue_24106.rs +++ b/src/test/run-pass-fulldeps/auxiliary/issue_24106.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] enum E { E0 = 0, E1 = 1 } diff --git a/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs b/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs index 2aaa28341ad..8917693d45e 100644 --- a/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs +++ b/src/test/run-pass-fulldeps/auxiliary/linkage-visibility.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-musl - dlsym doesn't see symbols without "-C link-arg=-Wl,--export-dynamic" #![feature(rustc_private)] diff --git a/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs b/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs index 00c419a8d09..f34e10218d4 100644 --- a/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs +++ b/src/test/run-pass-fulldeps/auxiliary/lint_for_crate.rs @@ -1,18 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![feature(plugin_registrar, rustc_private)] #![feature(box_syntax)] -#![feature(macro_at_most_once_rep)] #[macro_use] extern crate rustc; extern crate rustc_plugin; @@ -28,6 +17,10 @@ macro_rules! fake_lint_pass { struct $struct; impl LintPass for $struct { + fn name(&self) -> &'static str { + stringify!($struct) + } + fn get_lints(&self) -> LintArray { $lints } diff --git a/src/test/run-pass-fulldeps/auxiliary/llvm_pass_plugin.rs b/src/test/run-pass-fulldeps/auxiliary/llvm_pass_plugin.rs index 59cfdd1e04a..b5307446bca 100644 --- a/src/test/run-pass-fulldeps/auxiliary/llvm_pass_plugin.rs +++ b/src/test/run-pass-fulldeps/auxiliary/llvm_pass_plugin.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![feature(plugin_registrar)] diff --git a/src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-lib.rs b/src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-lib.rs index 78c03bac33f..954a1e554da 100644 --- a/src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-lib.rs +++ b/src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-lib.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-plugin.rs b/src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-plugin.rs index 9cf0d756f40..bd504425419 100644 --- a/src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-plugin.rs +++ b/src/test/run-pass-fulldeps/auxiliary/lto-syntax-extension-plugin.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![feature(plugin_registrar)] diff --git a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs index 14e9dbf3a37..a2b1d6976d0 100644 --- a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs +++ b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs @@ -1,219 +1,34 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host +// no-prefer-dynamic -#![feature(plugin_registrar, quote, rustc_private)] +#![crate_type = "proc-macro"] +#![feature(rustc_private)] extern crate syntax; extern crate rustc; extern crate rustc_plugin; extern crate syntax_pos; - -use syntax::ast::{self, Item, MetaItem, ItemKind}; -use syntax::source_map::DUMMY_SP; -use syntax::ext::base::*; -use syntax::ext::quote::rt::ToTokens; -use syntax::parse::{self, token}; -use syntax::ptr::P; -use syntax::symbol::Symbol; -use syntax::tokenstream::TokenTree; -use syntax_pos::Span; -use rustc_plugin::Registry; - -#[macro_export] -macro_rules! exported_macro { () => (2) } -macro_rules! unexported_macro { () => (3) } - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_macro("make_a_1", expand_make_a_1); - reg.register_macro("identity", expand_identity); - reg.register_syntax_extension( - Symbol::intern("rustc_into_multi_foo"), - MultiModifier(Box::new(expand_into_foo_multi))); - reg.register_syntax_extension( - Symbol::intern("rustc_duplicate"), - MultiDecorator(Box::new(expand_duplicate))); - reg.register_syntax_extension( - Symbol::intern("rustc_caller"), - MultiDecorator(Box::new(expand_caller))); -} - -fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box { - if !tts.is_empty() { - cx.span_fatal(sp, "make_a_1 takes no arguments"); - } - MacEager::expr(quote_expr!(cx, 1)) -} - -// See Issue #15750 -fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree]) -> Box { - // Parse an expression and emit it unchanged. - let mut parser = parse::new_parser_from_tts(cx.parse_sess(), tts.to_vec()); - let expr = parser.parse_expr().unwrap(); - MacEager::expr(quote_expr!(&mut *cx, $expr)) -} - -fn expand_into_foo_multi(cx: &mut ExtCtxt, - _sp: Span, - _attr: &MetaItem, - it: Annotatable) - -> Vec { - match it { - Annotatable::Item(it) => vec![ - Annotatable::Item(P(Item { - attrs: it.attrs.clone(), - ..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone() - })), - Annotatable::Item(quote_item!(cx, enum Foo3 { Bar }).unwrap()), - Annotatable::Item(quote_item!(cx, #[cfg(any())] fn foo2() {}).unwrap()), - ], - Annotatable::ImplItem(_it) => vec![ - quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| { - match i.node { - ItemKind::Impl(.., mut items) => { - Annotatable::ImplItem(P(items.pop().expect("impl method not found"))) - } - _ => unreachable!("impl parsed to something other than impl") - } - }) - ], - Annotatable::TraitItem(_it) => vec![ - quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| { - match i.node { - ItemKind::Trait(.., mut items) => { - Annotatable::TraitItem(P(items.pop().expect("trait method not found"))) - } - _ => unreachable!("trait parsed to something other than trait") - } - }) - ], - // covered in proc_macro/macros-in-extern.rs - Annotatable::ForeignItem(..) => unimplemented!(), - // covered in proc_macro/attr-stmt-expr.rs - Annotatable::Stmt(_) | Annotatable::Expr(_) => panic!("expected item"), - } -} - -// Create a duplicate of the annotatable, based on the MetaItem -fn expand_duplicate(cx: &mut ExtCtxt, - _sp: Span, - mi: &MetaItem, - it: &Annotatable, - push: &mut FnMut(Annotatable)) { - let copy_name = match mi.node { - ast::MetaItemKind::List(ref xs) => { - if let Some(word) = xs[0].word() { - word.ident.segments.last().unwrap().ident - } else { - cx.span_err(mi.span, "Expected word"); - return; - } - } - _ => { - cx.span_err(mi.span, "Expected list"); - return; - } - }; - - // Duplicate the item but replace its ident by the MetaItem - match it.clone() { - Annotatable::Item(it) => { - let mut new_it = (*it).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::Item(P(new_it))); - } - Annotatable::ImplItem(it) => { - let mut new_it = (*it).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::ImplItem(P(new_it))); - } - Annotatable::TraitItem(tt) => { - let mut new_it = (*tt).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::TraitItem(P(new_it))); - } - // covered in proc_macro/macros-in-extern.rs - Annotatable::ForeignItem(..) => unimplemented!(), - // covered in proc_macro/attr-stmt-expr.rs - Annotatable::Stmt(_) | Annotatable::Expr(_) => panic!("expected item") - } -} - -pub fn token_separate(ecx: &ExtCtxt, things: &[T], - token: token::Token) -> Vec { - let mut output: Vec = vec![]; - for (i, thing) in things.iter().enumerate() { - output.extend(thing.to_tokens(ecx)); - if i < things.len() - 1 { - output.push(TokenTree::Token(DUMMY_SP, token.clone())); - } - } - - output -} - -fn expand_caller(cx: &mut ExtCtxt, - sp: Span, - mi: &MetaItem, - it: &Annotatable, - push: &mut FnMut(Annotatable)) { - let (orig_fn_name, ret_type) = match *it { - Annotatable::Item(ref item) => match item.node { - ItemKind::Fn(ref decl, ..) => { - (item.ident, &decl.output) - } - _ => cx.span_fatal(item.span, "Only functions with return types can be annotated.") - }, - _ => cx.span_fatal(sp, "Only functions can be annotated.") - }; - - let (caller_name, arguments) = if let Some(list) = mi.meta_item_list() { - if list.len() < 2 { - cx.span_fatal(mi.span(), "Need a function name and at least one parameter."); - } - - let fn_name = match list[0].name() { - Some(name) => ast::Ident::with_empty_ctxt(name), - None => cx.span_fatal(list[0].span(), "First parameter must be an ident.") - }; - - (fn_name, &list[1..]) - } else { - cx.span_fatal(mi.span, "Expected list."); - }; - - let literals: Vec = arguments.iter().map(|arg| { - if let Some(lit) = arg.literal() { - lit.clone() - } else { - cx.span_fatal(arg.span(), "Expected literal."); - } - }).collect(); - - let arguments = token_separate(cx, literals.as_slice(), token::Comma); - if let ast::FunctionRetTy::Ty(ref rt) = *ret_type { - push(Annotatable::Item(quote_item!(cx, - fn $caller_name() -> $rt { - $orig_fn_name($arguments) - }).unwrap())) - } else { - push(Annotatable::Item(quote_item!(cx, - fn $caller_name() { - $orig_fn_name($arguments) - }).unwrap())) - } +extern crate proc_macro; + +use proc_macro::{TokenTree, TokenStream}; + +#[proc_macro_attribute] +pub fn rustc_duplicate(attr: TokenStream, item: TokenStream) -> TokenStream { + let mut new_name = Some(attr.into_iter().nth(0).unwrap()); + let mut encountered_idents = 0; + let input = item.to_string(); + let ret = item.into_iter().map(move |token| match token { + TokenTree::Ident(_) if encountered_idents == 1 => { + encountered_idents += 1; + new_name.take().unwrap() + } + TokenTree::Ident(_) => { + encountered_idents += 1; + token + } + _ => token + }).collect::(); + let mut input_again = input.parse::().unwrap(); + input_again.extend(ret); + input_again } - -pub fn foo() {} diff --git a/src/test/run-pass-fulldeps/auxiliary/outlive-expansion-phase.rs b/src/test/run-pass-fulldeps/auxiliary/outlive-expansion-phase.rs index f56983c14b1..25ad8caa37f 100644 --- a/src/test/run-pass-fulldeps/auxiliary/outlive-expansion-phase.rs +++ b/src/test/run-pass-fulldeps/auxiliary/outlive-expansion-phase.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![feature(plugin_registrar)] diff --git a/src/test/run-pass-fulldeps/auxiliary/plugin_args.rs b/src/test/run-pass-fulldeps/auxiliary/plugin_args.rs index 27169299c8a..eab612c5dfb 100644 --- a/src/test/run-pass-fulldeps/auxiliary/plugin_args.rs +++ b/src/test/run-pass-fulldeps/auxiliary/plugin_args.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![feature(plugin_registrar)] diff --git a/src/test/run-pass-fulldeps/auxiliary/plugin_with_plugin_lib.rs b/src/test/run-pass-fulldeps/auxiliary/plugin_with_plugin_lib.rs deleted file mode 100644 index 8b5ff7cf07c..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/plugin_with_plugin_lib.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host - -#![feature(plugin_registrar, rustc_private)] -#![deny(plugin_as_library)] // should have no effect in a plugin crate - -extern crate macro_crate_test; -extern crate rustc; -extern crate rustc_plugin; - -use rustc_plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(_: &mut Registry) { } diff --git a/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs b/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs deleted file mode 100644 index 847db0098ff..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] -#![feature(proc_macro_hygiene)] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro_attribute] -pub fn attr_tru(_attr: TokenStream, item: TokenStream) -> TokenStream { - let name = item.into_iter().nth(1).unwrap(); - quote!(fn $name() -> bool { true }) -} - -#[proc_macro_attribute] -pub fn attr_identity(_attr: TokenStream, item: TokenStream) -> TokenStream { - quote!($item) -} - -#[proc_macro] -pub fn tru(_ts: TokenStream) -> TokenStream { - quote!(true) -} - -#[proc_macro] -pub fn ret_tru(_ts: TokenStream) -> TokenStream { - quote!(return true;) -} - -#[proc_macro] -pub fn identity(ts: TokenStream) -> TokenStream { - quote!($ts) -} diff --git a/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs b/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs deleted file mode 100644 index 2c5de332327..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host - -#![crate_type="dylib"] -#![feature(plugin_registrar, quote, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; -extern crate rustc; -extern crate rustc_plugin; - -use syntax::feature_gate::Features; -use syntax::parse::token::{NtExpr, NtPat}; -use syntax::ast::{Ident, Pat, NodeId}; -use syntax::tokenstream::{TokenTree}; -use syntax::ext::base::{ExtCtxt, MacResult, MacEager}; -use syntax::ext::build::AstBuilder; -use syntax::ext::tt::quoted; -use syntax::ext::tt::macro_parser::{MatchedSeq, MatchedNonterminal}; -use syntax::ext::tt::macro_parser::{Success, Failure, Error}; -use syntax::ext::tt::macro_parser::parse_failure_msg; -use syntax::ptr::P; -use syntax_pos::{Span, edition::Edition}; -use rustc_plugin::Registry; - -fn expand_mbe_matches(cx: &mut ExtCtxt, _: Span, args: &[TokenTree]) - -> Box { - - let mbe_matcher = quote_tokens!(cx, $$matched:expr, $$($$pat:pat)|+); - let mbe_matcher = quoted::parse(mbe_matcher.into_iter().collect(), - true, - cx.parse_sess, - &Features::new(), - &[], - Edition::Edition2015, - // not used... - NodeId::from_u32(0)); - let map = match TokenTree::parse(cx, &mbe_matcher, args.iter().cloned().collect()) { - Success(map) => map, - Failure(_, tok) => { - panic!("expected Success, but got Failure: {}", parse_failure_msg(tok)); - } - Error(_, s) => { - panic!("expected Success, but got Error: {}", s); - } - }; - - let matched_nt = match *map[&Ident::from_str("matched")] { - MatchedNonterminal(ref nt) => nt.clone(), - _ => unreachable!(), - }; - - let mac_expr = match (&*matched_nt, &*map[&Ident::from_str("pat")]) { - (&NtExpr(ref matched_expr), &MatchedSeq(ref pats, seq_sp)) => { - let pats: Vec> = pats.iter().map(|pat_nt| { - match *pat_nt { - MatchedNonterminal(ref nt) => match **nt { - NtPat(ref pat) => pat.clone(), - _ => unreachable!(), - }, - _ => unreachable!(), - } - }).collect(); - let span = seq_sp.entire(); - let arm = cx.arm(span, pats, cx.expr_bool(span, true)); - - quote_expr!(cx, - match $matched_expr { - $arm - _ => false - } - ) - } - _ => unreachable!() - }; - - MacEager::expr(mac_expr) -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_macro("matches", expand_mbe_matches); -} diff --git a/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs b/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs index dc6f33bad99..216c81ca34c 100644 --- a/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs +++ b/src/test/run-pass-fulldeps/auxiliary/roman_numerals.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![crate_type="dylib"] diff --git a/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_1.rs b/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_1.rs index fadeb024405..8b00fb81cd2 100644 --- a/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_1.rs +++ b/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![crate_type = "dylib"] diff --git a/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_2.rs b/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_2.rs deleted file mode 100644 index 72d26285355..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_2.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host - -#![crate_type = "dylib"] -#![feature(plugin_registrar, quote, rustc_private)] - -extern crate syntax_extension_with_dll_deps_1 as other; -extern crate syntax; -extern crate syntax_pos; -extern crate rustc; -extern crate rustc_plugin; - -use syntax::ast::{Item, MetaItem}; -use syntax::ext::base::*; -use syntax::tokenstream::TokenTree; -use syntax_pos::Span; -use rustc_plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_macro("foo", expand_foo); -} - -fn expand_foo(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) - -> Box { - let answer = other::the_answer(); - MacEager::expr(quote_expr!(cx, $answer)) -} diff --git a/src/test/run-pass-fulldeps/compiler-calls.rs b/src/test/run-pass-fulldeps/compiler-calls.rs index 6283d054373..d3a328300ba 100644 --- a/src/test/run-pass-fulldeps/compiler-calls.rs +++ b/src/test/run-pass-fulldeps/compiler-calls.rs @@ -1,16 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the CompilerCalls interface to the compiler works. // ignore-cross-compile +// ignore-stage1 #![feature(rustc_private)] diff --git a/src/test/run-pass-fulldeps/create-dir-all-bare.rs b/src/test/run-pass-fulldeps/create-dir-all-bare.rs index a35eed1f72d..da4cde447eb 100644 --- a/src/test/run-pass-fulldeps/create-dir-all-bare.rs +++ b/src/test/run-pass-fulldeps/create-dir-all-bare.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::env; use std::fs; use std::path::PathBuf; diff --git a/src/test/run-pass-fulldeps/custom-derive-partial-eq.rs b/src/test/run-pass-fulldeps/custom-derive-partial-eq.rs index 47f5f8397d1..21b8ec7be98 100644 --- a/src/test/run-pass-fulldeps/custom-derive-partial-eq.rs +++ b/src/test/run-pass-fulldeps/custom-derive-partial-eq.rs @@ -1,20 +1,10 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:custom_derive_partial_eq.rs // ignore-stage1 -#![feature(plugin, custom_derive)] +#![feature(plugin)] #![plugin(custom_derive_partial_eq)] #![allow(unused)] -#[derive(CustomPartialEq)] // Check that this is not a stability error. +#[derive_CustomPartialEq] // Check that this is not a stability error. enum E { V1, V2 } fn main() {} diff --git a/src/test/run-pass-fulldeps/custom-derive-partial-eq.stderr b/src/test/run-pass-fulldeps/custom-derive-partial-eq.stderr deleted file mode 100644 index ba956e4c132..00000000000 --- a/src/test/run-pass-fulldeps/custom-derive-partial-eq.stderr +++ /dev/null @@ -1,6 +0,0 @@ -warning: `#[derive]` for custom traits is deprecated and will be removed in the future. Prefer using procedural macro custom derive. - --> $DIR/custom-derive-partial-eq.rs:17:10 - | -LL | #[derive(CustomPartialEq)] // Check that this is not a stability error. - | ^^^^^^^^^^^^^^^ - diff --git a/src/test/run-pass-fulldeps/derive-no-std-not-supported.rs b/src/test/run-pass-fulldeps/derive-no-std-not-supported.rs index 1e42355f834..0111043994e 100644 --- a/src/test/run-pass-fulldeps/derive-no-std-not-supported.rs +++ b/src/test/run-pass-fulldeps/derive-no-std-not-supported.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![feature(rustc_private)] #![no_std] diff --git a/src/test/run-pass-fulldeps/derive-totalsum-attr.rs b/src/test/run-pass-fulldeps/derive-totalsum-attr.rs index e088f5e4262..769861e7c94 100644 --- a/src/test/run-pass-fulldeps/derive-totalsum-attr.rs +++ b/src/test/run-pass-fulldeps/derive-totalsum-attr.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:custom_derive_plugin_attr.rs // ignore-stage1 -#![feature(plugin, custom_derive, rustc_attrs)] +#![feature(plugin, rustc_attrs)] #![plugin(custom_derive_plugin_attr)] trait TotalSum { diff --git a/src/test/run-pass-fulldeps/derive-totalsum.rs b/src/test/run-pass-fulldeps/derive-totalsum.rs index 848b2425e44..be26943b6dc 100644 --- a/src/test/run-pass-fulldeps/derive-totalsum.rs +++ b/src/test/run-pass-fulldeps/derive-totalsum.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:custom_derive_plugin.rs // ignore-stage1 -#![feature(plugin, custom_derive)] +#![feature(plugin)] #![plugin(custom_derive_plugin)] trait TotalSum { @@ -32,14 +22,14 @@ impl TotalSum for Seven { } } -#[derive(TotalSum)] +#[derive_TotalSum] struct Foo { seven: Seven, bar: Bar, baz: isize, } -#[derive(TotalSum)] +#[derive_TotalSum] struct Bar { quux: isize, bleh: isize, diff --git a/src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs b/src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs index 8b56ade21f9..4c00c97edf3 100644 --- a/src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs +++ b/src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] #![feature(box_syntax)] diff --git a/src/test/run-pass-fulldeps/deriving-encodable-decodable-cell-refcell.rs b/src/test/run-pass-fulldeps/deriving-encodable-decodable-cell-refcell.rs index 15edd4d4950..63e9d738179 100644 --- a/src/test/run-pass-fulldeps/deriving-encodable-decodable-cell-refcell.rs +++ b/src/test/run-pass-fulldeps/deriving-encodable-decodable-cell-refcell.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] // This briefly tests the capability of `Cell` and `RefCell` to implement the // `Encodable` and `Decodable` traits via `#[derive(Encodable, Decodable)]` diff --git a/src/test/run-pass-fulldeps/deriving-global.rs b/src/test/run-pass-fulldeps/deriving-global.rs index b95c947d215..5283cab7bde 100644 --- a/src/test/run-pass-fulldeps/deriving-global.rs +++ b/src/test/run-pass-fulldeps/deriving-global.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_private)] extern crate serialize; diff --git a/src/test/run-pass-fulldeps/deriving-hygiene.rs b/src/test/run-pass-fulldeps/deriving-hygiene.rs index 1deeb242437..6fd99931bf6 100644 --- a/src/test/run-pass-fulldeps/deriving-hygiene.rs +++ b/src/test/run-pass-fulldeps/deriving-hygiene.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals)] #![feature(rustc_private)] extern crate serialize; diff --git a/src/test/run-pass-fulldeps/dropck_tarena_sound_drop.rs b/src/test/run-pass-fulldeps/dropck_tarena_sound_drop.rs index e519d48ac1d..27eb70160ba 100644 --- a/src/test/run-pass-fulldeps/dropck_tarena_sound_drop.rs +++ b/src/test/run-pass-fulldeps/dropck_tarena_sound_drop.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unknown_lints)] // Check that an arena (TypedArena) can carry elements whose drop // methods might access borrowed data, as long as the borrowed data diff --git a/src/test/run-pass-fulldeps/empty-struct-braces-derive.rs b/src/test/run-pass-fulldeps/empty-struct-braces-derive.rs index 79ce3cb68d4..d80bbca95df 100644 --- a/src/test/run-pass-fulldeps/empty-struct-braces-derive.rs +++ b/src/test/run-pass-fulldeps/empty-struct-braces-derive.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // `#[derive(Trait)]` works for empty structs/variants with braces or parens. #![feature(rustc_private)] diff --git a/src/test/run-pass-fulldeps/extern-mod-syntax.rs b/src/test/run-pass-fulldeps/extern-mod-syntax.rs index 37404ee7e69..12373acc365 100644 --- a/src/test/run-pass-fulldeps/extern-mod-syntax.rs +++ b/src/test/run-pass-fulldeps/extern-mod-syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] #![feature(rustc_private)] diff --git a/src/test/run-pass-fulldeps/issue-11881.rs b/src/test/run-pass-fulldeps/issue-11881.rs index 5121ecd6cf3..b44be1e90c5 100644 --- a/src/test/run-pass-fulldeps/issue-11881.rs +++ b/src/test/run-pass-fulldeps/issue-11881.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/test/run-pass-fulldeps/issue-13560.rs b/src/test/run-pass-fulldeps/issue-13560.rs index 0ceb5ed5e75..de2ecbdc988 100644 --- a/src/test/run-pass-fulldeps/issue-13560.rs +++ b/src/test/run-pass-fulldeps/issue-13560.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-13560-1.rs // aux-build:issue-13560-2.rs // aux-build:issue-13560-3.rs diff --git a/src/test/run-pass-fulldeps/issue-14021.rs b/src/test/run-pass-fulldeps/issue-14021.rs index 5426dd94637..b7ba842e001 100644 --- a/src/test/run-pass-fulldeps/issue-14021.rs +++ b/src/test/run-pass-fulldeps/issue-14021.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_mut)] #![allow(unused_imports)] #![feature(rustc_private)] diff --git a/src/test/run-pass-fulldeps/issue-15149.rs b/src/test/run-pass-fulldeps/issue-15149.rs index 362aeabd60e..2a62fabf53d 100644 --- a/src/test/run-pass-fulldeps/issue-15149.rs +++ b/src/test/run-pass-fulldeps/issue-15149.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] // no-prefer-dynamic // ignore-cross-compile diff --git a/src/test/run-pass-fulldeps/issue-15778-pass.rs b/src/test/run-pass-fulldeps/issue-15778-pass.rs index 6fcf0a0450c..50e9b14b268 100644 --- a/src/test/run-pass-fulldeps/issue-15778-pass.rs +++ b/src/test/run-pass-fulldeps/issue-15778-pass.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lint_for_crate.rs // ignore-stage1 // compile-flags: -D crate-not-okay diff --git a/src/test/run-pass-fulldeps/issue-15924.rs b/src/test/run-pass-fulldeps/issue-15924.rs index 717a35707b4..9d807533f42 100644 --- a/src/test/run-pass-fulldeps/issue-15924.rs +++ b/src/test/run-pass-fulldeps/issue-15924.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] #![allow(unused_must_use)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass-fulldeps/issue-16723.rs b/src/test/run-pass-fulldeps/issue-16723.rs deleted file mode 100644 index bacfa8d1ead..00000000000 --- a/src/test/run-pass-fulldeps/issue-16723.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-stage1 -// aux-build:issue-16723.rs -#![feature(plugin)] -#![plugin(issue_16723)] - -multiple_items!(); - -impl Struct1 { - fn foo() {} -} -impl Struct2 { - fn foo() {} -} - -fn main() { - Struct1::foo(); - Struct2::foo(); - println!("hallo"); -} diff --git a/src/test/run-pass-fulldeps/issue-16822.rs b/src/test/run-pass-fulldeps/issue-16822.rs index 172d3e31d45..bcc10d16412 100644 --- a/src/test/run-pass-fulldeps/issue-16822.rs +++ b/src/test/run-pass-fulldeps/issue-16822.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-16822.rs extern crate issue_16822 as lib; diff --git a/src/test/run-pass-fulldeps/issue-16992.rs b/src/test/run-pass-fulldeps/issue-16992.rs deleted file mode 100644 index 3ab7f8429e6..00000000000 --- a/src/test/run-pass-fulldeps/issue-16992.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-cross-compile - -#![feature(quote, rustc_private)] - -extern crate syntax; - -use syntax::ext::base::ExtCtxt; - -#[allow(dead_code)] -fn foobar(cx: &mut ExtCtxt) { - quote_expr!(cx, 1); - quote_expr!(cx, 2); -} - -fn main() { } diff --git a/src/test/run-pass-fulldeps/issue-18502.rs b/src/test/run-pass-fulldeps/issue-18502.rs index 8367fc110e1..a6e1fc84932 100644 --- a/src/test/run-pass-fulldeps/issue-18502.rs +++ b/src/test/run-pass-fulldeps/issue-18502.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-18502.rs extern crate issue_18502 as fmt; diff --git a/src/test/run-pass-fulldeps/issue-18763-quote-token-tree.rs b/src/test/run-pass-fulldeps/issue-18763-quote-token-tree.rs deleted file mode 100644 index 016f6139529..00000000000 --- a/src/test/run-pass-fulldeps/issue-18763-quote-token-tree.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] -#![allow(unused_imports)] -// ignore-cross-compile -#![feature(quote, rustc_private)] - -extern crate syntax; - -use syntax::ext::base::ExtCtxt; - -fn syntax_extension(cx: &ExtCtxt) { - let _toks_1 = vec![quote_tokens!(cx, /** comment */ fn foo() {})]; - let name = quote_tokens!(cx, bar); - let _toks_2 = vec![quote_item!(cx, static $name:isize = 2;)]; - let _toks_4 = quote_tokens!(cx, $name:static $name:sizeof); - let _toks_3 = vec![quote_item!(cx, - /// comment - fn foo() { let $name:isize = 3; } - )]; -} - -fn main() { -} diff --git a/src/test/run-pass-fulldeps/issue-24972.rs b/src/test/run-pass-fulldeps/issue-24972.rs index 6abdf98bb38..ef4efb6218d 100644 --- a/src/test/run-pass-fulldeps/issue-24972.rs +++ b/src/test/run-pass-fulldeps/issue-24972.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![feature(rustc_private)] diff --git a/src/test/run-pass-fulldeps/issue-2804.rs b/src/test/run-pass-fulldeps/issue-2804.rs index 2e1104afae0..d10f72791a2 100644 --- a/src/test/run-pass-fulldeps/issue-2804.rs +++ b/src/test/run-pass-fulldeps/issue-2804.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] #![feature(rustc_private)] diff --git a/src/test/run-pass-fulldeps/issue-40001.rs b/src/test/run-pass-fulldeps/issue-40001.rs new file mode 100644 index 00000000000..1e546e14423 --- /dev/null +++ b/src/test/run-pass-fulldeps/issue-40001.rs @@ -0,0 +1,8 @@ +// aux-build:issue-40001-plugin.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(issue_40001_plugin)] + +#[whitelisted_attr] +fn main() {} diff --git a/src/test/run-pass-fulldeps/issue-4016.rs b/src/test/run-pass-fulldeps/issue-4016.rs index 2d72b42a5bd..3de7a7cd936 100644 --- a/src/test/run-pass-fulldeps/issue-4016.rs +++ b/src/test/run-pass-fulldeps/issue-4016.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![feature(rustc_private)] diff --git a/src/test/run-pass-fulldeps/issue-4036.rs b/src/test/run-pass-fulldeps/issue-4036.rs index ae7bb8a6842..0cbd8adf977 100644 --- a/src/test/run-pass-fulldeps/issue-4036.rs +++ b/src/test/run-pass-fulldeps/issue-4036.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // Issue #4036: Test for an issue that arose around fixing up type inference // byproducts in vtable records. diff --git a/src/test/run-pass-fulldeps/issue-40663.rs b/src/test/run-pass-fulldeps/issue-40663.rs index 8633e906082..cb01eddd7e4 100644 --- a/src/test/run-pass-fulldeps/issue-40663.rs +++ b/src/test/run-pass-fulldeps/issue-40663.rs @@ -1,21 +1,13 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // aux-build:custom_derive_plugin.rs // ignore-stage1 -#![feature(plugin, custom_derive)] +#![feature(plugin)] #![plugin(custom_derive_plugin)] -#[derive(Nothing, Nothing, Nothing)] +#[derive_Nothing] +#[derive_Nothing] +#[derive_Nothing] struct S; fn main() {} diff --git a/src/test/run-pass-fulldeps/issue_24106.rs b/src/test/run-pass-fulldeps/issue_24106.rs index 7cfd11537f4..a497d9f33ae 100644 --- a/src/test/run-pass-fulldeps/issue_24106.rs +++ b/src/test/run-pass-fulldeps/issue_24106.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue_24106.rs extern crate issue_24106; diff --git a/src/test/run-pass-fulldeps/linkage-visibility.rs b/src/test/run-pass-fulldeps/linkage-visibility.rs index 9839a2c7041..5315a219d6d 100644 --- a/src/test/run-pass-fulldeps/linkage-visibility.rs +++ b/src/test/run-pass-fulldeps/linkage-visibility.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:linkage-visibility.rs // ignore-android: FIXME(#10356) // ignore-windows: std::dynamic_lib does not work on Windows well diff --git a/src/test/run-pass-fulldeps/llvm-pass-plugin.rs b/src/test/run-pass-fulldeps/llvm-pass-plugin.rs index 5dfef636f9f..3aad40ecfe8 100644 --- a/src/test/run-pass-fulldeps/llvm-pass-plugin.rs +++ b/src/test/run-pass-fulldeps/llvm-pass-plugin.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:llvm_pass_plugin.rs // ignore-stage1 diff --git a/src/test/run-pass-fulldeps/lto-syntax-extension.rs b/src/test/run-pass-fulldeps/lto-syntax-extension.rs index e32f0852ad7..05ce9e0a8df 100644 --- a/src/test/run-pass-fulldeps/lto-syntax-extension.rs +++ b/src/test/run-pass-fulldeps/lto-syntax-extension.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lto-syntax-extension-lib.rs // aux-build:lto-syntax-extension-plugin.rs // compile-flags:-C lto diff --git a/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs b/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs deleted file mode 100644 index 8ed47fe1f6f..00000000000 --- a/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:macro_crate_test.rs -// ignore-stage1 - -// Issue #15750: a macro that internally parses its input and then -// uses `quote_expr!` to rearrange it should be hygiene-preserving. - -#![feature(plugin)] -#![plugin(macro_crate_test)] - -fn main() { - let x = 3; - assert_eq!(3, identity!(x)); - assert_eq!(6, identity!(x+x)); - let x = 4; - assert_eq!(4, identity!(x)); -} diff --git a/src/test/run-pass-fulldeps/macro-crate-multi-decorator-literals.rs b/src/test/run-pass-fulldeps/macro-crate-multi-decorator-literals.rs deleted file mode 100644 index 5d00b594434..00000000000 --- a/src/test/run-pass-fulldeps/macro-crate-multi-decorator-literals.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(plugin_as_library)] -#![allow(unused_imports)] -// aux-build:macro_crate_test.rs -// ignore-stage1 - -#![feature(plugin, rustc_attrs)] -#![plugin(macro_crate_test)] - -#[macro_use] -#[no_link] -extern crate macro_crate_test; - -// The `caller(name, args...)` attribute emits a new nullary function named -// `name` that calls the annotated function with `args`. As an example, consider -// the following: -// -// #[caller(simple, 1, "hello", 3.14)] -// fn f(num: isize, string: &'static str, float: f32) -> (isize, &'static str, float) { -// (num, string, float) -// } -// -// This results in a function named `simple` that calls `f(1, "hello", 3.14)`. -// As a result, the expression `simple()` evaluates to `(1, "helllo", 3.14)`. - -#[rustc_caller(simple, 1, "hello", 3.14)] -#[rustc_caller(simple1, 2, "bye", 6.28)] -#[rustc_caller(simple2, 3, "hi", 1.01)] -fn f(num: isize, string: &'static str, float: f32) -> (isize, &'static str, f32) { - (num, string, float) -} - -#[rustc_caller(complex, true, 10)] -#[rustc_caller(complex1, false, 15)] -#[rustc_caller(complex2, true, 20)] -fn g(emit: bool, num: i32) -> Option { - match emit { - true => Some(num), - false => None - } -} - -fn main() { - assert_eq!(simple(), (1, "hello", 3.14)); - assert_eq!(simple1(), (2, "bye", 6.28)); - assert_eq!(simple2(), (3, "hi", 1.01)); - - assert_eq!(complex(), Some(10)); - assert_eq!(complex1(), None); - assert_eq!(complex2(), Some(20)); -} diff --git a/src/test/run-pass-fulldeps/macro-crate-multi-decorator.rs b/src/test/run-pass-fulldeps/macro-crate-multi-decorator.rs index 6e8314b9680..dcac160c4c9 100644 --- a/src/test/run-pass-fulldeps/macro-crate-multi-decorator.rs +++ b/src/test/run-pass-fulldeps/macro-crate-multi-decorator.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(plugin_as_library)] #![allow(dead_code)] #![allow(unused_variables)] @@ -15,11 +5,9 @@ // aux-build:macro_crate_test.rs // ignore-stage1 -#![feature(plugin, rustc_attrs)] -#![plugin(macro_crate_test)] +#![feature(rustc_attrs)] #[macro_use] -#[no_link] extern crate macro_crate_test; // The duplicate macro will create a copy of the item with the given identifier. diff --git a/src/test/run-pass-fulldeps/macro-crate.rs b/src/test/run-pass-fulldeps/macro-crate.rs deleted file mode 100644 index f51a6aae068..00000000000 --- a/src/test/run-pass-fulldeps/macro-crate.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(plugin_as_library)] -#![allow(dead_code)] -// aux-build:macro_crate_test.rs -// ignore-stage1 - -#![feature(plugin, rustc_attrs)] -#![plugin(macro_crate_test)] - -#[macro_use] #[no_link] -extern crate macro_crate_test; - -#[rustc_into_multi_foo] -#[derive(PartialEq, Clone, Debug)] -fn foo() -> AnotherFakeTypeThatHadBetterGoAway {} - -// Check that the `#[into_multi_foo]`-generated `foo2` is configured away -fn foo2() {} - -trait Qux { - #[rustc_into_multi_foo] - fn bar(); -} - -impl Qux for i32 { - #[rustc_into_multi_foo] - fn bar() {} -} - -impl Qux for u8 {} - -pub fn main() { - assert_eq!(1, make_a_1!()); - assert_eq!(2, exported_macro!()); - - assert_eq!(Foo2::Bar2, Foo2::Bar2); - test(None::); - - let _ = Foo3::Bar; - - let x = 10i32; - assert_eq!(x.foo(), 42); - let x = 10u8; - assert_eq!(x.foo(), 0); -} - -fn test(_: Option) {} diff --git a/src/test/run-pass-fulldeps/macro-quote-cond.rs b/src/test/run-pass-fulldeps/macro-quote-cond.rs deleted file mode 100644 index d438adda151..00000000000 --- a/src/test/run-pass-fulldeps/macro-quote-cond.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(unused_parens)] -// aux-build:cond_plugin.rs -// ignore-stage1 - -#![feature(proc_macro_hygiene)] - -extern crate cond_plugin; - -use cond_plugin::cond; - -fn fact(n : i64) -> i64 { - if n == 0 { - 1 - } else { - n * fact(n - 1) - } -} - -fn fact_cond(n : i64) -> i64 { - cond!( - ((n == 0) 1) - (else (n * fact_cond(n-1))) - ) -} - -fn fib(n : i64) -> i64 { - if n == 0 || n == 1 { - 1 - } else { - fib(n-1) + fib(n-2) - } -} - -fn fib_cond(n : i64) -> i64 { - cond!( - ((n == 0) 1) - ((n == 1) 1) - (else (fib_cond(n-1) + fib_cond(n-2))) - ) -} - -fn main() { - assert_eq!(fact(3), fact_cond(3)); - assert_eq!(fact(5), fact_cond(5)); - assert_eq!(fib(5), fib_cond(5)); - assert_eq!(fib(8), fib_cond(8)); -} diff --git a/src/test/run-pass-fulldeps/macro-quote-test.rs b/src/test/run-pass-fulldeps/macro-quote-test.rs deleted file mode 100644 index f967ef56bb8..00000000000 --- a/src/test/run-pass-fulldeps/macro-quote-test.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that a macro can emit delimiters with nothing inside - `()`, `{}` - -// aux-build:hello_macro.rs -// ignore-stage1 - -#![feature(proc_macro_hygiene)] - -extern crate hello_macro; - -fn main() { - hello_macro::hello!(); -} diff --git a/src/test/run-pass-fulldeps/mbe_matching_test_macro.rs b/src/test/run-pass-fulldeps/mbe_matching_test_macro.rs deleted file mode 100644 index 822b2c9b93b..00000000000 --- a/src/test/run-pass-fulldeps/mbe_matching_test_macro.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:procedural_mbe_matching.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(procedural_mbe_matching)] - -pub fn main() { - assert_eq!(matches!(Some(123), None | Some(0)), false); - assert_eq!(matches!(Some(123), None | Some(123)), true); - assert_eq!(matches!(true, true), true); -} diff --git a/src/test/run-pass-fulldeps/mod_dir_path_canonicalized.rs b/src/test/run-pass-fulldeps/mod_dir_path_canonicalized.rs index ee424b31636..22a76a3d968 100644 --- a/src/test/run-pass-fulldeps/mod_dir_path_canonicalized.rs +++ b/src/test/run-pass-fulldeps/mod_dir_path_canonicalized.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Testing that a libsyntax can parse modules with canonicalized base path // ignore-cross-compile diff --git a/src/test/run-pass-fulldeps/mod_dir_simple/test.rs b/src/test/run-pass-fulldeps/mod_dir_simple/test.rs index 58c1beee3be..a5e27a3a43c 100644 --- a/src/test/run-pass-fulldeps/mod_dir_simple/test.rs +++ b/src/test/run-pass-fulldeps/mod_dir_simple/test.rs @@ -1,11 +1 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() -> isize { 10 } diff --git a/src/test/run-pass-fulldeps/myriad-closures.rs b/src/test/run-pass-fulldeps/myriad-closures.rs index baf27d6f57c..a1ea0e685d6 100644 --- a/src/test/run-pass-fulldeps/myriad-closures.rs +++ b/src/test/run-pass-fulldeps/myriad-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test case tests whether we can handle code bases that contain a high // number of closures, something that needs special handling in the MingGW // toolchain. diff --git a/src/test/run-pass-fulldeps/outlive-expansion-phase.rs b/src/test/run-pass-fulldeps/outlive-expansion-phase.rs index 6eb3e510724..86aed2511ce 100644 --- a/src/test/run-pass-fulldeps/outlive-expansion-phase.rs +++ b/src/test/run-pass-fulldeps/outlive-expansion-phase.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:outlive-expansion-phase.rs // ignore-stage1 diff --git a/src/test/run-pass-fulldeps/plugin-args-1.rs b/src/test/run-pass-fulldeps/plugin-args-1.rs index 4d4f9092bc8..0111af1c768 100644 --- a/src/test/run-pass-fulldeps/plugin-args-1.rs +++ b/src/test/run-pass-fulldeps/plugin-args-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:plugin_args.rs // ignore-stage1 diff --git a/src/test/run-pass-fulldeps/plugin-args-2.rs b/src/test/run-pass-fulldeps/plugin-args-2.rs index 4da566aec42..e4a3dfab566 100644 --- a/src/test/run-pass-fulldeps/plugin-args-2.rs +++ b/src/test/run-pass-fulldeps/plugin-args-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:plugin_args.rs // ignore-stage1 diff --git a/src/test/run-pass-fulldeps/plugin-args-3.rs b/src/test/run-pass-fulldeps/plugin-args-3.rs index 0a064933aec..4696233f281 100644 --- a/src/test/run-pass-fulldeps/plugin-args-3.rs +++ b/src/test/run-pass-fulldeps/plugin-args-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:plugin_args.rs // ignore-stage1 diff --git a/src/test/run-pass-fulldeps/plugin-lib-ok-in-plugin.rs b/src/test/run-pass-fulldeps/plugin-lib-ok-in-plugin.rs deleted file mode 100644 index c612ee75651..00000000000 --- a/src/test/run-pass-fulldeps/plugin-lib-ok-in-plugin.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:macro_crate_test.rs -// aux-build:plugin_with_plugin_lib.rs -// ignore-stage1 -// ignore-cross-compile -// -// macro_crate_test will not compile on a cross-compiled target because -// libsyntax is not compiled for it. - -#![deny(plugin_as_library)] -#![feature(plugin)] -#![plugin(macro_crate_test)] -#![plugin(plugin_with_plugin_lib)] - -fn main() { - assert_eq!(1, make_a_1!()); -} diff --git a/src/test/run-pass-fulldeps/plugin-plus-extern-crate.rs b/src/test/run-pass-fulldeps/plugin-plus-extern-crate.rs deleted file mode 100644 index d1ce83f2677..00000000000 --- a/src/test/run-pass-fulldeps/plugin-plus-extern-crate.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:macro_crate_test.rs -// ignore-stage1 -// ignore-cross-compile -// -// macro_crate_test will not compile on a cross-compiled target because -// libsyntax is not compiled for it. - -#![allow(plugin_as_library)] -#![feature(plugin)] -#![plugin(macro_crate_test)] - -extern crate macro_crate_test; - -fn main() { - assert_eq!(1, make_a_1!()); - macro_crate_test::foo(); -} diff --git a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs index e944ef2b620..ce3b03efd26 100644 --- a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cross-compile @@ -44,9 +34,11 @@ use syntax::ptr::P; fn parse_expr(ps: &ParseSess, src: &str) -> P { + let src_as_string = src.to_string(); + let mut p = parse::new_parser_from_source_str(ps, - FileName::Custom("expr".to_owned()), - src.to_owned()); + FileName::Custom(src_as_string.clone()), + src_as_string); p.parse_expr().unwrap() } @@ -113,7 +105,6 @@ fn iter_exprs(depth: usize, f: &mut FnMut(P)) { id: DUMMY_NODE_ID, rules: BlockCheckMode::Default, span: DUMMY_SP, - recovered: false, }); iter_exprs(depth - 1, &mut |e| g(ExprKind::If(e, block.clone(), None))); }, diff --git a/src/test/run-pass-fulldeps/proc-macro/add-impl.rs b/src/test/run-pass-fulldeps/proc-macro/add-impl.rs deleted file mode 100644 index 5175fe174a9..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/add-impl.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:add-impl.rs -// ignore-stage1 - -#[macro_use] -extern crate add_impl; - -#[derive(AddImpl)] -struct B; - -fn main() { - B.foo(); - foo(); - bar::foo(); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/append-impl.rs b/src/test/run-pass-fulldeps/proc-macro/append-impl.rs deleted file mode 100644 index 37aef7ef131..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/append-impl.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:append-impl.rs -// ignore-stage1 - -#![allow(warnings)] - -#[macro_use] -extern crate append_impl; - -trait Append { - fn foo(&self); -} - -#[derive(PartialEq, - Append, - Eq)] -struct A { - inner: u32, -} - -fn main() { - A { inner: 3 }.foo(); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-args.rs b/src/test/run-pass-fulldeps/proc-macro/attr-args.rs deleted file mode 100644 index effb3ad5189..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/attr-args.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:attr-args.rs -// ignore-stage1 - -#![allow(warnings)] - -extern crate attr_args; -use attr_args::{attr_with_args, identity}; - -#[attr_with_args(text = "Hello, world!")] -fn foo() {} - -#[identity(fn main() { assert_eq!(foo(), "Hello, world!"); })] -struct Dummy; diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-cfg.rs b/src/test/run-pass-fulldeps/proc-macro/attr-cfg.rs deleted file mode 100644 index 1a9d9b9ee62..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/attr-cfg.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:attr-cfg.rs -// ignore-stage1 -// revisions: foo bar - -extern crate attr_cfg; -use attr_cfg::attr_cfg; - -#[attr_cfg] -fn outer() -> u8 { - #[cfg(foo)] - fn inner() -> u8 { 1 } - - #[cfg(bar)] - fn inner() -> u8 { 2 } - - inner() -} - -#[cfg(foo)] -fn main() { - assert_eq!(outer(), 1); -} - -#[cfg(bar)] -fn main() { - assert_eq!(outer(), 2); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs b/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs deleted file mode 100644 index 698a0eca173..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:attr-on-trait.rs -// ignore-stage1 - -extern crate attr_on_trait; - -use attr_on_trait::foo; - -trait Foo { - #[foo] - fn foo() {} -} - -impl Foo for i32 { - fn foo(&self) {} -} - -fn main() { - 3i32.foo(); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs b/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs deleted file mode 100644 index 8a3452f24d2..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:attr-stmt-expr.rs -// ignore-stage1 - -#![feature(stmt_expr_attributes, proc_macro_hygiene)] - -extern crate attr_stmt_expr; -use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr, - no_output, noop}; - -fn print_str(string: &'static str) { - // macros are handled a bit differently - #[expect_print_expr] - println!("{}", string) -} - -fn main() { - #[expect_let] - let string = "Hello, world!"; - - #[expect_print_stmt] - println!("{}", string); - - let _: () = { - #[no_output] - "Hello, world!" - }; - - let _: &'static str = #[noop] "Hello, world!"; - - let _: &'static str = { - #[noop] "Hello, world!" - }; - - #[expect_expr] - print_str("string") -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/add-impl.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/add-impl.rs deleted file mode 100644 index 3959eccd81e..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/add-impl.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(AddImpl)] -// #[cfg(proc_macro)] -pub fn derive(input: TokenStream) -> TokenStream { - "impl B { - fn foo(&self) {} - } - - fn foo() {} - - mod bar { pub fn foo() {} } - ".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/append-impl.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/append-impl.rs deleted file mode 100644 index fdce709e5ba..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/append-impl.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(Append)] -pub fn derive_a(input: TokenStream) -> TokenStream { - "impl Append for A { - fn foo(&self) {} - } - ".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-args.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-args.rs deleted file mode 100644 index 655bfa3ff63..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-args.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn attr_with_args(args: TokenStream, input: TokenStream) -> TokenStream { - let args = args.to_string(); - - assert_eq!(args, r#"text = "Hello, world!""#); - - let input = input.to_string(); - - assert_eq!(input, "fn foo() { }"); - - r#" - fn foo() -> &'static str { "Hello, world!" } - "#.parse().unwrap() -} - -#[proc_macro_attribute] -pub fn identity(attr_args: TokenStream, _: TokenStream) -> TokenStream { - attr_args -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-cfg.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-cfg.rs deleted file mode 100644 index f9037aa8bf9..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-cfg.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn attr_cfg(args: TokenStream, input: TokenStream) -> TokenStream { - let input_str = input.to_string(); - - assert_eq!(input_str, "fn outer() -> u8 { - #[cfg(foo)] - fn inner() -> u8 { 1 } - #[cfg(bar)] - fn inner() -> u8 { 2 } - inner() -}"); - - input -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-on-trait.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-on-trait.rs deleted file mode 100644 index 5e5c775b1ff..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-on-trait.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn foo(attr: TokenStream, item: TokenStream) -> TokenStream { - drop(attr); - assert_eq!(item.to_string(), "fn foo() { }"); - "fn foo(&self);".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-stmt-expr.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-stmt-expr.rs deleted file mode 100644 index 4d5e22b4eb6..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/attr-stmt-expr.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn expect_let(attr: TokenStream, item: TokenStream) -> TokenStream { - assert!(attr.to_string().is_empty()); - assert_eq!(item.to_string(), "let string = \"Hello, world!\";"); - item -} - -#[proc_macro_attribute] -pub fn expect_print_stmt(attr: TokenStream, item: TokenStream) -> TokenStream { - assert!(attr.to_string().is_empty()); - assert_eq!(item.to_string(), "println!(\"{}\" , string);"); - item -} - -#[proc_macro_attribute] -pub fn expect_expr(attr: TokenStream, item: TokenStream) -> TokenStream { - assert!(attr.to_string().is_empty()); - assert_eq!(item.to_string(), "print_str(\"string\")"); - item -} - -#[proc_macro_attribute] -pub fn expect_print_expr(attr: TokenStream, item: TokenStream) -> TokenStream { - assert!(attr.to_string().is_empty()); - assert_eq!(item.to_string(), "println!(\"{}\" , string)"); - item -} - -#[proc_macro_attribute] -pub fn no_output(attr: TokenStream, item: TokenStream) -> TokenStream { - assert!(attr.to_string().is_empty()); - assert!(!item.to_string().is_empty()); - "".parse().unwrap() - -} - -#[proc_macro_attribute] -pub fn noop(attr: TokenStream, item: TokenStream) -> TokenStream { - assert!(attr.to_string().is_empty()); - assert!(!item.to_string().is_empty()); - item -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/bang-macro.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/bang-macro.rs deleted file mode 100644 index 8b7c6cd10b8..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/bang-macro.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro] -pub fn rewrite(input: TokenStream) -> TokenStream { - let input = input.to_string(); - - assert_eq!(input, r#""Hello, world!""#); - - r#""NOT Hello, world!""#.parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/call-site.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/call-site.rs deleted file mode 100644 index 65eb8f4bec2..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/call-site.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::*; - -#[proc_macro] -pub fn check(input: TokenStream) -> TokenStream { - // Parsed `x2` can refer to `x2` from `input` - let parsed1: TokenStream = "let x3 = x2;".parse().unwrap(); - // `x3` parsed from one string can refer to `x3` parsed from another string. - let parsed2: TokenStream = "let x4 = x3;".parse().unwrap(); - // Manually assembled `x4` can refer to parsed `x4`. - let manual: Vec = vec![ - Ident::new("let", Span::call_site()).into(), - Ident::new("x5", Span::call_site()).into(), - Punct::new('=', Spacing::Alone).into(), - Ident::new("x4", Span::call_site()).into(), - Punct::new(';', Spacing::Alone).into(), - ]; - input.into_iter().chain(parsed1.into_iter()) - .chain(parsed2.into_iter()) - .chain(manual.into_iter()) - .collect() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs deleted file mode 100644 index 77d0d9339fe..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![feature(proc_macro_hygiene, proc_macro_quote)] -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::{TokenStream, TokenTree, Spacing, Literal, quote}; - -#[proc_macro] -pub fn count_compound_ops(input: TokenStream) -> TokenStream { - assert_eq!(count_compound_ops_helper(quote!(++ (&&) 4@a)), 3); - let l = Literal::u32_suffixed(count_compound_ops_helper(input)); - TokenTree::from(l).into() -} - -fn count_compound_ops_helper(input: TokenStream) -> u32 { - let mut count = 0; - for token in input { - match &token { - TokenTree::Punct(tt) if tt.spacing() == Spacing::Alone => { - count += 1; - } - TokenTree::Group(tt) => { - count += count_compound_ops_helper(tt.stream()); - } - _ => {} - } - } - count -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/custom-attr-only-one-derive.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/custom-attr-only-one-derive.rs deleted file mode 100644 index 4609f57bddf..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/custom-attr-only-one-derive.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(Foo)] -pub fn foo(a: TokenStream) -> TokenStream { - "".parse().unwrap() -} - -#[proc_macro_derive(Bar, attributes(custom))] -pub fn bar(a: TokenStream) -> TokenStream { - "".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-a.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-a.rs deleted file mode 100644 index b7374a07e42..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-a.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(A)] -pub fn derive(input: TokenStream) -> TokenStream { - let input = input.to_string(); - assert!(input.contains("struct A;")); - "".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-atob.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-atob.rs deleted file mode 100644 index 67d828d92a7..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-atob.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(AToB)] -pub fn derive(input: TokenStream) -> TokenStream { - let input = input.to_string(); - assert_eq!(input, "struct A;"); - "struct B;".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-attr-cfg.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-attr-cfg.rs deleted file mode 100644 index 2b413579a9a..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-attr-cfg.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(Foo, attributes(foo))] -pub fn derive(input: TokenStream) -> TokenStream { - assert!(!input.to_string().contains("#[cfg(any())]")); - "".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-b.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-b.rs deleted file mode 100644 index e1aabad4142..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-b.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(B, attributes(B, C))] -pub fn derive(input: TokenStream) -> TokenStream { - let input = input.to_string(); - assert!(input.contains("#[B [ arbitrary tokens ]]")); - assert!(input.contains("struct B {")); - assert!(input.contains("#[C]")); - "".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-ctod.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-ctod.rs deleted file mode 100644 index 550ffe9400d..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-ctod.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(CToD)] -pub fn derive(input: TokenStream) -> TokenStream { - let input = input.to_string(); - assert_eq!(input, "struct C;"); - "struct D;".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-nothing.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-nothing.rs deleted file mode 100644 index cfe428bf5f3..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-nothing.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(Nothing)] -pub fn nothing(input: TokenStream) -> TokenStream { - "".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-same-struct.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-same-struct.rs deleted file mode 100644 index cf96f52823f..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-same-struct.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic -// compile-flags:--crate-type proc-macro - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(AToB)] -pub fn derive1(input: TokenStream) -> TokenStream { - println!("input1: {:?}", input.to_string()); - assert_eq!(input.to_string(), "struct A;"); - "#[derive(BToC)] struct B;".parse().unwrap() -} - -#[proc_macro_derive(BToC)] -pub fn derive2(input: TokenStream) -> TokenStream { - assert_eq!(input.to_string(), "struct B;"); - "struct C;".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-two-attrs.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-two-attrs.rs deleted file mode 100644 index d02edb50fb2..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-two-attrs.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro_derive(A, attributes(b))] -pub fn foo(_x: TokenStream) -> TokenStream { - TokenStream::new() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-union.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-union.rs deleted file mode 100644 index 41bb88a0a92..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-union.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(UnionTest)] -pub fn derive(input: TokenStream) -> TokenStream { - let input = input.to_string(); - assert!(input.contains("#[repr(C)]")); - assert!(input.contains("union Test {")); - assert!(input.contains("a: u8,")); - assert!(input.contains("}")); - "".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/double.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/double.rs deleted file mode 100644 index a6c9817f247..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/double.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -// Outputs another copy of the struct. Useful for testing the tokens -// seen by the proc_macro. -#[proc_macro_derive(Double)] -pub fn derive(input: TokenStream) -> TokenStream { - format!("mod foo {{ {} }}", input.to_string()).parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/empty-crate.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/empty-crate.rs deleted file mode 100644 index b45d4bf41d6..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/empty-crate.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] -#![deny(unused_variables)] diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/expand-with-a-macro.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/expand-with-a-macro.rs deleted file mode 100644 index e6831b6bfdf..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/expand-with-a-macro.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] -#![deny(warnings)] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(A)] -pub fn derive(input: TokenStream) -> TokenStream { - let input = input.to_string(); - assert!(input.contains("struct A;")); - r#" - impl A { - fn a(&self) { - panic!("hello"); - } - } - "#.parse().unwrap() -} - diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/external-crate-var.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/external-crate-var.rs deleted file mode 100644 index 030c53b3e6f..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/external-crate-var.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct ExternFoo; - -pub trait ExternTrait { - const CONST: u32; - type Assoc; -} - -impl ExternTrait for ExternFoo { - const CONST: u32 = 0; - type Assoc = ExternFoo; -} - -#[macro_export] -macro_rules! external { () => { - mod bar { - #[derive(Double)] - struct Bar($crate::ExternFoo); - } - - mod qself { - #[derive(Double)] - struct QSelf(<$crate::ExternFoo as $crate::ExternTrait>::Assoc); - } - - mod qself_recurse { - #[derive(Double)] - struct QSelfRecurse(< - <$crate::ExternFoo as $crate::ExternTrait>::Assoc - as $crate::ExternTrait>::Assoc - ); - } - - mod qself_in_const { - #[derive(Double)] - #[repr(u32)] - enum QSelfInConst { - Variant = <$crate::ExternFoo as $crate::ExternTrait>::CONST, - } - } -} } - diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/gen-lifetime-token.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/gen-lifetime-token.rs deleted file mode 100644 index 978de27b70a..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/gen-lifetime-token.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro] -pub fn bar(_input: TokenStream) -> TokenStream { - let mut ret = Vec::::new(); - ret.push(Ident::new("static", Span::call_site()).into()); - ret.push(Ident::new("FOO", Span::call_site()).into()); - ret.push(Punct::new(':', Spacing::Alone).into()); - ret.push(Punct::new('&', Spacing::Alone).into()); - ret.push(Punct::new('\'', Spacing::Joint).into()); - ret.push(Ident::new("static", Span::call_site()).into()); - ret.push(Ident::new("i32", Span::call_site()).into()); - ret.push(Punct::new('=', Spacing::Alone).into()); - ret.push(Punct::new('&', Spacing::Alone).into()); - ret.push(Literal::i32_unsuffixed(1).into()); - ret.push(Punct::new(';', Spacing::Alone).into()); - ret.into_iter().collect() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example.rs deleted file mode 100644 index ca88482064b..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern crate hygiene_example_codegen; - -pub use hygiene_example_codegen::hello; - -pub fn print(string: &str) { - println!("{}", string); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs deleted file mode 100644 index 551ac3863e1..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![feature(proc_macro_quote, proc_macro_hygiene)] -#![crate_type = "proc-macro"] - -extern crate proc_macro as proc_macro_renamed; // This does not break `quote!` - -use proc_macro_renamed::{TokenStream, quote}; - -#[proc_macro] -pub fn hello(input: TokenStream) -> TokenStream { - quote!(hello_helper!($input)) - //^ `hello_helper!` always resolves to the following proc macro, - //| no matter where `hello!` is used. -} - -#[proc_macro] -pub fn hello_helper(input: TokenStream) -> TokenStream { - quote! { - extern crate hygiene_example; // This is never a conflict error - let string = format!("hello {}", $input); - //^ `format!` always resolves to the prelude macro, - //| even if a different `format!` is in scope where `hello!` is used. - hygiene_example::print(&string) - } -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-39889.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-39889.rs deleted file mode 100644 index 9094310fb3e..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-39889.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::TokenStream; - -#[proc_macro_derive(Issue39889)] -pub fn f(_input: TokenStream) -> TokenStream { - let rules = r#" - macro_rules! id { - ($($tt:tt)*) => { $($tt)* }; - } - "#; - rules.parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs deleted file mode 100644 index e0acf340a79..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(box_syntax, plugin, plugin_registrar, rustc_private)] -#![feature(macro_at_most_once_rep)] -#![crate_type = "dylib"] - -#[macro_use] -extern crate rustc; -extern crate rustc_plugin; -extern crate syntax; - -use rustc_plugin::Registry; -use syntax::attr; -use syntax::ext::base::*; -use syntax::feature_gate::AttributeType::Whitelisted; -use syntax::symbol::Symbol; - -use rustc::hir; -use rustc::hir::intravisit; -use rustc::hir::map as hir_map; -use hir::Node; -use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext}; -use rustc::ty; -use syntax::{ast, source_map}; - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_late_lint_pass(box MissingWhitelistedAttrPass); - reg.register_attribute("whitelisted_attr".to_string(), Whitelisted); -} - -declare_lint!(MISSING_WHITELISTED_ATTR, Deny, - "Checks for missing `whitelisted_attr` attribute"); - -struct MissingWhitelistedAttrPass; - -impl LintPass for MissingWhitelistedAttrPass { - fn get_lints(&self) -> LintArray { - lint_array!(MISSING_WHITELISTED_ATTR) - } -} - -impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingWhitelistedAttrPass { - fn check_fn(&mut self, - cx: &LateContext<'a, 'tcx>, - _: intravisit::FnKind<'tcx>, - _: &'tcx hir::FnDecl, - _: &'tcx hir::Body, - span: source_map::Span, - id: ast::NodeId) { - - let item = match cx.tcx.hir.get(id) { - Node::Item(item) => item, - _ => cx.tcx.hir.expect_item(cx.tcx.hir.get_parent(id)), - }; - - if !attr::contains_name(&item.attrs, "whitelisted_attr") { - cx.span_lint(MISSING_WHITELISTED_ATTR, span, - "Missing 'whitelisted_attr' attribute"); - } - } -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-42708.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-42708.rs deleted file mode 100644 index 906caceb869..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-42708.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(Test)] -pub fn derive(_input: TokenStream) -> TokenStream { - "fn f(s: S) { s.x }".parse().unwrap() -} - -#[proc_macro_attribute] -pub fn attr_test(_attr: TokenStream, input: TokenStream) -> TokenStream { - input -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-50061.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-50061.rs deleted file mode 100644 index 6de17522fc9..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-50061.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn check(_a: TokenStream, b: TokenStream) -> TokenStream { - b.into_iter().collect() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/lifetimes.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/lifetimes.rs deleted file mode 100644 index 0ee26b6a1b9..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/lifetimes.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro] -pub fn lifetimes_bang(input: TokenStream) -> TokenStream { - // Roundtrip through token trees - input.into_iter().collect() -} - -#[proc_macro_attribute] -pub fn lifetimes_attr(_: TokenStream, input: TokenStream) -> TokenStream { - // Roundtrip through AST - input -} - -#[proc_macro_derive(Lifetimes)] -pub fn lifetimes_derive(input: TokenStream) -> TokenStream { - // Roundtrip through a string - format!("mod m {{ {} }}", input).parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/modify-ast.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/modify-ast.rs deleted file mode 100644 index 498c6811d9c..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/modify-ast.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro_attribute] -pub fn assert1(_a: TokenStream, b: TokenStream) -> TokenStream { - assert_eq(b.clone(), "pub fn foo() {}".parse().unwrap()); - b -} - -#[proc_macro_derive(Foo, attributes(foo))] -pub fn assert2(a: TokenStream) -> TokenStream { - assert_eq(a, "pub struct MyStructc { _a: i32, }".parse().unwrap()); - TokenStream::new() -} - -fn assert_eq(a: TokenStream, b: TokenStream) { - let mut a = a.into_iter(); - let mut b = b.into_iter(); - for (a, b) in a.by_ref().zip(&mut b) { - match (a, b) { - (TokenTree::Group(a), TokenTree::Group(b)) => { - assert_eq!(a.delimiter(), b.delimiter()); - assert_eq(a.stream(), b.stream()); - } - (TokenTree::Punct(a), TokenTree::Punct(b)) => { - assert_eq!(a.as_char(), b.as_char()); - assert_eq!(a.spacing(), b.spacing()); - } - (TokenTree::Literal(a), TokenTree::Literal(b)) => { - assert_eq!(a.to_string(), b.to_string()); - } - (TokenTree::Ident(a), TokenTree::Ident(b)) => { - assert_eq!(a.to_string(), b.to_string()); - } - (a, b) => panic!("{:?} != {:?}", a, b), - } - } - - assert!(a.next().is_none()); - assert!(b.next().is_none()); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/negative-token.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/negative-token.rs deleted file mode 100644 index fd639696991..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/negative-token.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro] -pub fn neg_one(_input: TokenStream) -> TokenStream { - TokenTree::Literal(Literal::i32_suffixed(-1)).into() -} - -#[proc_macro] -pub fn neg_one_float(_input: TokenStream) -> TokenStream { - TokenTree::Literal(Literal::f32_suffixed(-1.0)).into() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/not-joint.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/not-joint.rs deleted file mode 100644 index e00a4d89e8d..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/not-joint.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro] -pub fn tokens(input: TokenStream) -> TokenStream { - assert_nothing_joint(input); - TokenStream::new() -} - -#[proc_macro_attribute] -pub fn nothing(_: TokenStream, input: TokenStream) -> TokenStream { - assert_nothing_joint(input); - TokenStream::new() -} - -fn assert_nothing_joint(s: TokenStream) { - for tt in s { - match tt { - TokenTree::Group(g) => assert_nothing_joint(g.stream()), - TokenTree::Punct(p) => assert_eq!(p.spacing(), Spacing::Alone), - _ => {} - } - } -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/span-api-tests.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/span-api-tests.rs deleted file mode 100644 index 8e2c5c0a088..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/span-api-tests.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] -#![feature(proc_macro_span)] - -extern crate proc_macro; - -use proc_macro::*; - -// Re-emits the input tokens by parsing them from strings -#[proc_macro] -pub fn reemit(input: TokenStream) -> TokenStream { - input.to_string().parse().unwrap() -} - -#[proc_macro] -pub fn assert_fake_source_file(input: TokenStream) -> TokenStream { - for tk in input { - let source_file = tk.span().source_file(); - assert!(!source_file.is_real(), "Source file is real: {:?}", source_file); - } - - "".parse().unwrap() -} - -#[proc_macro] -pub fn assert_source_file(input: TokenStream) -> TokenStream { - for tk in input { - let source_file = tk.span().source_file(); - assert!(source_file.is_real(), "Source file is not real: {:?}", source_file); - } - - "".parse().unwrap() -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/span-test-macros.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/span-test-macros.rs deleted file mode 100644 index b4666e2cb61..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/span-test-macros.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[macro_export] -macro_rules! reemit_legacy { - ($($tok:tt)*) => ($($tok)*) -} - -#[macro_export] -macro_rules! say_hello_extern { - ($macname:ident) => ( $macname! { "Hello, world!" }) -} diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/test-macros.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/test-macros.rs deleted file mode 100644 index 581c7cb15a5..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/test-macros.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn nop_attr(_attr: TokenStream, input: TokenStream) -> TokenStream { - assert!(_attr.to_string().is_empty()); - input -} - -#[proc_macro_attribute] -pub fn no_output(_attr: TokenStream, _input: TokenStream) -> TokenStream { - assert!(_attr.to_string().is_empty()); - assert!(!_input.to_string().is_empty()); - "".parse().unwrap() -} - -#[proc_macro] -pub fn emit_input(input: TokenStream) -> TokenStream { - input -} diff --git a/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs b/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs deleted file mode 100644 index 10fe0155555..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:bang-macro.rs -// ignore-stage1 - -#![feature(proc_macro_hygiene)] - -extern crate bang_macro; -use bang_macro::rewrite; - -fn main() { - assert_eq!(rewrite!("Hello, world!"), "NOT Hello, world!"); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/call-site.rs b/src/test/run-pass-fulldeps/proc-macro/call-site.rs deleted file mode 100644 index b27c806f047..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/call-site.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(unused_variables)] -#![allow(unused_imports)] -// aux-build:call-site.rs -// ignore-stage1 - -#![feature(proc_macro_hygiene)] - -extern crate call_site; -use call_site::*; - -fn main() { - let x1 = 10; - call_site::check!(let x2 = x1;); - let x6 = x5; -} diff --git a/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs b/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs deleted file mode 100644 index 07ad4f288d8..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:count_compound_ops.rs -// ignore-stage1 - -#![feature(proc_macro_hygiene)] - -extern crate count_compound_ops; -use count_compound_ops::count_compound_ops; - -fn main() { - assert_eq!(count_compound_ops!(foo<=>bar << or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:double.rs -// aux-build:external-crate-var.rs -// ignore-stage1 - -#![allow(unused)] - -#[macro_use] -extern crate double; -#[macro_use] -extern crate external_crate_var; - -struct Foo; - -trait Trait { - const CONST: u32; - type Assoc; -} - -impl Trait for Foo { - const CONST: u32 = 0; - type Assoc = Foo; -} - -macro_rules! local { () => { - // derive_Double outputs secondary copies of each definition - // to test what the proc_macro sees. - mod bar { - #[derive(Double)] - struct Bar($crate::Foo); - } - - mod qself { - #[derive(Double)] - struct QSelf(<::Foo as $crate::Trait>::Assoc); - } - - mod qself_recurse { - #[derive(Double)] - struct QSelfRecurse(<<$crate::Foo as $crate::Trait>::Assoc as $crate::Trait>::Assoc); - } - - mod qself_in_const { - #[derive(Double)] - #[repr(u32)] - enum QSelfInConst { - Variant = <::Foo as $crate::Trait>::CONST, - } - } -} } - -mod local { - local!(); -} - -// and now repeat the above tests, using a macro defined in another crate - -mod external { - external!{} -} - -fn main() {} diff --git a/src/test/run-pass-fulldeps/proc-macro/custom-attr-only-one-derive.rs b/src/test/run-pass-fulldeps/proc-macro/custom-attr-only-one-derive.rs deleted file mode 100644 index 3b2833a4bcf..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/custom-attr-only-one-derive.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:custom-attr-only-one-derive.rs - -#![feature(rust_2018_preview)] - -#[macro_use] -extern crate custom_attr_only_one_derive; - -#[derive(Bar, Foo)] -#[custom = "test"] -pub enum A { - B, - C, -} - -fn main() {} diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-attr-cfg.rs b/src/test/run-pass-fulldeps/proc-macro/derive-attr-cfg.rs deleted file mode 100644 index e7e8b3d665e..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/derive-attr-cfg.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] -// aux-build:derive-attr-cfg.rs -// ignore-stage1 - -extern crate derive_attr_cfg; -use derive_attr_cfg::Foo; - -#[derive(Foo)] -#[foo] -struct S { - #[cfg(any())] - x: i32 -} - -fn main() { -} diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-b.rs b/src/test/run-pass-fulldeps/proc-macro/derive-b.rs deleted file mode 100644 index ac9eca38226..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/derive-b.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-b.rs -// ignore-stage1 - -#![feature(unrestricted_attribute_tokens)] - -extern crate derive_b; - -#[derive(Debug, PartialEq, derive_b::B, Eq, Copy, Clone)] -#[cfg_attr(all(), B[arbitrary tokens])] -struct B { - #[C] - a: u64 -} - -fn main() { - B { a: 3 }; - assert_eq!(B { a: 3 }, B { a: 3 }); - let b = B { a: 3 }; - let _d = b; - let _e = b; -} diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-same-struct.rs b/src/test/run-pass-fulldeps/proc-macro/derive-same-struct.rs deleted file mode 100644 index 64ad57107c7..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/derive-same-struct.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(path_statements)] -#![allow(dead_code)] -// aux-build:derive-same-struct.rs -// ignore-stage1 - -#[macro_use] -extern crate derive_same_struct; - -#[derive(AToB)] -struct A; - -fn main() { - C; -} diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-test.rs b/src/test/run-pass-fulldeps/proc-macro/derive-test.rs deleted file mode 100644 index 5a53a4e8db3..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/derive-test.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic -// compile-flags: --test - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -// ``` -// assert!(true); -// ``` -#[proc_macro_derive(Foo)] -pub fn derive_foo(_input: TokenStream) -> TokenStream { - "".parse().unwrap() -} - -#[test] -pub fn test_derive() { - assert!(true); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-two-attrs.rs b/src/test/run-pass-fulldeps/proc-macro/derive-two-attrs.rs deleted file mode 100644 index 9c2ba481f5e..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/derive-two-attrs.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] -// aux-build:derive-two-attrs.rs - -extern crate derive_two_attrs as foo; - -use foo::A; - -#[derive(A)] -#[b] -#[b] -struct B; - -fn main() {} diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-union.rs b/src/test/run-pass-fulldeps/proc-macro/derive-union.rs deleted file mode 100644 index 298a652aacc..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/derive-union.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(unused_variables)] -// aux-build:derive-union.rs -// ignore-stage1 - -#[macro_use] -extern crate derive_union; - -#[repr(C)] -#[derive(UnionTest)] -union Test { - a: u8, -} - -fn main() { - let t = Test { a: 0 }; -} diff --git a/src/test/run-pass-fulldeps/proc-macro/empty-crate.rs b/src/test/run-pass-fulldeps/proc-macro/empty-crate.rs deleted file mode 100644 index 2b0a57dafef..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/empty-crate.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(unused_imports)] -// aux-build:empty-crate.rs -// ignore-stage1 - -#[macro_use] -extern crate empty_crate; - -fn main() {} diff --git a/src/test/run-pass-fulldeps/proc-macro/expand-with-a-macro.rs b/src/test/run-pass-fulldeps/proc-macro/expand-with-a-macro.rs deleted file mode 100644 index 4ccd4615fb6..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/expand-with-a-macro.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:expand-with-a-macro.rs -// ignore-stage1 - -#![deny(warnings)] - -#[macro_use] -extern crate expand_with_a_macro; - -use std::panic; - -#[derive(A)] -struct A; - -fn main() { - assert!(panic::catch_unwind(|| { - A.a(); - }).is_err()); -} - diff --git a/src/test/run-pass-fulldeps/proc-macro/gen-lifetime-token.rs b/src/test/run-pass-fulldeps/proc-macro/gen-lifetime-token.rs deleted file mode 100644 index ce2fed86e46..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/gen-lifetime-token.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:gen-lifetime-token.rs - -extern crate gen_lifetime_token as bar; - -bar::bar!(); - -fn main() { - let x: &'static i32 = FOO; - assert_eq!(*x, 1); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs b/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs deleted file mode 100644 index cf18bb247c7..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(unused_macros)] -// aux-build:hygiene_example_codegen.rs -// aux-build:hygiene_example.rs -// ignore-stage1 - -#![feature(proc_macro_hygiene)] - -extern crate hygiene_example; -use hygiene_example::hello; - -fn main() { - mod hygiene_example {} // no conflict with `extern crate hygiene_example;` from the proc macro - macro_rules! format { () => {} } // does not interfere with `format!` from the proc macro - macro_rules! hello_helper { () => {} } // similarly does not intefere with the proc macro - - let string = "world"; // no conflict with `string` from the proc macro - hello!(string); - hello!(string); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs b/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs deleted file mode 100644 index f7221092601..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] -// aux-build:issue-39889.rs -// ignore-stage1 - -extern crate issue_39889; -use issue_39889::Issue39889; - -#[derive(Issue39889)] -struct S; - -fn main() {} diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-40001.rs b/src/test/run-pass-fulldeps/proc-macro/issue-40001.rs deleted file mode 100644 index b828199883f..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/issue-40001.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:issue-40001-plugin.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(issue_40001_plugin)] - -#[whitelisted_attr] -fn main() {} diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-42708.rs b/src/test/run-pass-fulldeps/proc-macro/issue-42708.rs deleted file mode 100644 index 7bbdbc6505d..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/issue-42708.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:issue-42708.rs -// ignore-stage1 - -#![feature(decl_macro)] -#![allow(unused)] - -extern crate issue_42708; - -macro m() { - #[derive(issue_42708::Test)] - struct S { x: () } - - #[issue_42708::attr_test] - struct S2 { x: () } - - #[derive(Clone)] - struct S3 { x: () } - - fn g(s: S, s2: S2, s3: S3) { - (s.x, s2.x, s3.x); - } -} - -m!(); - -fn main() {} diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-50061.rs b/src/test/run-pass-fulldeps/proc-macro/issue-50061.rs deleted file mode 100644 index 04659166575..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/issue-50061.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(path_statements)] -// aux-build:issue-50061.rs -// ignore-stage1 - -#![feature(decl_macro)] - -extern crate issue_50061; - -macro inner(any_token $v: tt) { - $v -} - -macro outer($v: tt) { - inner!(any_token $v) -} - -#[issue_50061::check] -fn main() { - //! this doc comment forces roundtrip through a string - let checkit = 0; - outer!(checkit); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/lifetimes.rs b/src/test/run-pass-fulldeps/proc-macro/lifetimes.rs deleted file mode 100644 index 79d6d27dc59..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/lifetimes.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(unused_variables)] -// aux-build:lifetimes.rs -// ignore-stage1 - -extern crate lifetimes; -use lifetimes::*; - -lifetimes_bang! { - fn bang<'a>() -> &'a u8 { &0 } -} - -#[lifetimes_attr] -fn attr<'a>() -> &'a u8 { &1 } - -#[derive(Lifetimes)] -pub struct Lifetimes<'a> { - pub field: &'a u8, -} - -fn main() { - assert_eq!(bang::<'static>(), &0); - assert_eq!(attr::<'static>(), &1); - let l1 = Lifetimes { field: &0 }; - let l2 = m::Lifetimes { field: &1 }; -} diff --git a/src/test/run-pass-fulldeps/proc-macro/load-two.rs b/src/test/run-pass-fulldeps/proc-macro/load-two.rs deleted file mode 100644 index cf1e076f270..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/load-two.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(path_statements)] -#![allow(dead_code)] -// aux-build:derive-atob.rs -// aux-build:derive-ctod.rs -// ignore-stage1 - -#[macro_use] -extern crate derive_atob; -#[macro_use] -extern crate derive_ctod; - -#[derive(Copy, Clone)] -#[derive(AToB)] -struct A; - -#[derive(CToD)] -struct C; - -fn main() { - B; - D; -} diff --git a/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs b/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs deleted file mode 100644 index bd76cc38054..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:test-macros.rs -// ignore-stage1 -// ignore-wasm32 - -#![feature(macros_in_extern)] - -extern crate test_macros; - -use test_macros::{nop_attr, no_output, emit_input}; - -fn main() { - assert_eq!(unsafe { rust_get_test_int() }, 1isize); - assert_eq!(unsafe { rust_dbg_extern_identity_u32(0xDEADBEEF) }, 0xDEADBEEF); -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - #[no_output] - fn some_definitely_unknown_symbol_which_should_be_removed(); - - #[nop_attr] - fn rust_get_test_int() -> isize; - - emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/modify-ast.rs b/src/test/run-pass-fulldeps/proc-macro/modify-ast.rs deleted file mode 100644 index d6f7cc4699a..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/modify-ast.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:modify-ast.rs - -extern crate modify_ast; - -use modify_ast::*; - -#[derive(Foo)] -pub struct MyStructc { - #[cfg_attr(my_cfg, foo)] - _a: i32, -} - -macro_rules! a { - ($i:item) => ($i) -} - -a! { - #[assert1] - pub fn foo() {} -} - -fn main() { - let _a = MyStructc { _a: 0 }; - foo(); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/negative-token.rs b/src/test/run-pass-fulldeps/proc-macro/negative-token.rs deleted file mode 100644 index ccd729badeb..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/negative-token.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:negative-token.rs -// ignore-stage1 - -#![feature(proc_macro_hygiene)] - -extern crate negative_token; - -use negative_token::*; - -fn main() { - assert_eq!(-1, neg_one!()); - assert_eq!(-1.0, neg_one_float!()); -} diff --git a/src/test/run-pass-fulldeps/proc-macro/not-joint.rs b/src/test/run-pass-fulldeps/proc-macro/not-joint.rs deleted file mode 100644 index 7a53348f963..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/not-joint.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:not-joint.rs - -extern crate not_joint as bar; -use bar::{tokens, nothing}; - -tokens![< -]; - -#[nothing] -a![< -]; - -#[nothing] -b!{< -} - -#[nothing] -c!(< -); - -#[nothing] -fn foo() { - //! dox - let x = 2 < - 3; -} - -fn main() {} diff --git a/src/test/run-pass-fulldeps/proc-macro/smoke.rs b/src/test/run-pass-fulldeps/proc-macro/smoke.rs deleted file mode 100644 index 49011e19a51..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/smoke.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(unused_must_use)] -#![allow(path_statements)] -// aux-build:derive-a.rs -// ignore-stage1 - -#[macro_use] -extern crate derive_a; - -#[derive(Debug, PartialEq, A, Eq, Copy, Clone)] -struct A; - -fn main() { - A; - assert_eq!(A, A); - A.clone(); - let a = A; - let _c = a; - let _d = a; -} diff --git a/src/test/run-pass-fulldeps/proc-macro/span-api-tests.rs b/src/test/run-pass-fulldeps/proc-macro/span-api-tests.rs deleted file mode 100644 index 415cada265e..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/span-api-tests.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:span-api-tests.rs -// aux-build:span-test-macros.rs - -// ignore-pretty - -#[macro_use] -extern crate span_test_macros; - -extern crate span_api_tests; - -use span_api_tests::{reemit, assert_fake_source_file, assert_source_file}; - -macro_rules! say_hello { - ($macname:ident) => ( $macname! { "Hello, world!" }) -} - -assert_source_file! { "Hello, world!" } - -say_hello! { assert_source_file } - -reemit_legacy! { - assert_source_file! { "Hello, world!" } -} - -say_hello_extern! { assert_fake_source_file } - -reemit! { - assert_source_file! { "Hello, world!" } -} - -fn main() {} diff --git a/src/test/run-pass-fulldeps/proc-macro/struct-field-macro.rs b/src/test/run-pass-fulldeps/proc-macro/struct-field-macro.rs deleted file mode 100644 index db52aa5d3a6..00000000000 --- a/src/test/run-pass-fulldeps/proc-macro/struct-field-macro.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] -// aux-build:derive-nothing.rs -// ignore-stage1 - -#[macro_use] -extern crate derive_nothing; - -macro_rules! int { - () => { i32 } -} - -#[derive(Nothing)] -struct S { - x: int!(), -} - -fn main() {} diff --git a/src/test/run-pass-fulldeps/proc_macro.rs b/src/test/run-pass-fulldeps/proc_macro.rs deleted file mode 100644 index 27e0c23561f..00000000000 --- a/src/test/run-pass-fulldeps/proc_macro.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:proc_macro_def.rs -// ignore-stage1 -// ignore-cross-compile - -#![feature(proc_macro_hygiene)] - -extern crate proc_macro_def; - -use proc_macro_def::{attr_tru, attr_identity, identity, ret_tru, tru}; - -#[attr_tru] -fn f1() -> bool { - return false; -} - -#[attr_identity] -fn f2() -> bool { - return identity!(true); -} - -fn f3() -> identity!(bool) { - ret_tru!(); -} - -fn f4(x: bool) -> bool { - match x { - identity!(true) => false, - identity!(false) => true, - } -} - -fn main() { - assert!(f1()); - assert!(f2()); - assert!(tru!()); - assert!(f3()); - assert!(identity!(5 == 5)); - assert!(f4(false)); -} diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs deleted file mode 100644 index ec12ad17e8f..00000000000 --- a/src/test/run-pass-fulldeps/qquote.rs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(unused_imports)] -// ignore-cross-compile - -#![feature(quote, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; - -use syntax::source_map::FilePathMapping; -use syntax::print::pprust::*; -use syntax::symbol::Symbol; -use syntax_pos::DUMMY_SP; - -fn main() { - syntax::with_globals(|| run()); -} - -fn run() { - let ps = syntax::parse::ParseSess::new(FilePathMapping::empty()); - let mut resolver = syntax::ext::base::DummyResolver; - let mut cx = syntax::ext::base::ExtCtxt::new( - &ps, - syntax::ext::expand::ExpansionConfig::default("qquote".to_string()), - &mut resolver); - let cx = &mut cx; - - macro_rules! check { - ($f: ident, $($e: expr),+; $expect: expr) => ({ - $(assert_eq!($f(&$e), $expect);)+ - }); - } - - let abc = quote_expr!(cx, 23); - check!(expr_to_string, abc, *quote_expr!(cx, $abc); "23"); - - let ty = quote_ty!(cx, isize); - check!(ty_to_string, ty, *quote_ty!(cx, $ty); "isize"); - - let item = quote_item!(cx, static x: $ty = 10;).unwrap(); - check!(item_to_string, item, quote_item!(cx, $item).unwrap(); "static x: isize = 10;"); - - let twenty: u16 = 20; - let stmt = quote_stmt!(cx, let x = $twenty;).unwrap(); - check!(stmt_to_string, stmt, quote_stmt!(cx, $stmt).unwrap(); "let x = 20u16;"); - - let pat = quote_pat!(cx, Some(_)); - check!(pat_to_string, pat, *quote_pat!(cx, $pat); "Some(_)"); - - let expr = quote_expr!(cx, (x, y)); - let arm = quote_arm!(cx, (ref x, ref y) => $expr,); - check!(arm_to_string, arm, quote_arm!(cx, $arm); " (ref x, ref y) => (x, y),"); - - let attr = quote_attr!(cx, #![cfg(foo = "bar")]); - check!(attribute_to_string, attr, quote_attr!(cx, $attr); r#"#![cfg(foo = "bar")]"#); - - // quote_arg! - - let arg = quote_arg!(cx, foo: i32); - check!(arg_to_string, arg, quote_arg!(cx, $arg); "foo: i32"); - - let function = quote_item!(cx, fn f($arg) { }).unwrap(); - check!(item_to_string, function; "fn f(foo: i32) { }"); - - let args = vec![arg, quote_arg!(cx, bar: u32)]; - let args = &args[..]; - let function = quote_item!(cx, fn f($args) { }).unwrap(); - check!(item_to_string, function; "fn f(foo: i32, bar: u32) { }"); - - // quote_block! - - let block = quote_block!(cx, { $stmt let y = 40u32; }); - check!(block_to_string, block, *quote_block!(cx, $block); "{ let x = 20u16; let y = 40u32; }"); - - let function = quote_item!(cx, fn f() $block).unwrap(); - check!(item_to_string, function; "fn f() { let x = 20u16; let y = 40u32; }"); - - // quote_path! - - let path = quote_path!(cx, ::syntax::ptr::P); - check!(path_to_string, path, quote_path!(cx, $path); "::syntax::ptr::P"); - - let ty = quote_ty!(cx, $path); - check!(ty_to_string, ty; "::syntax::ptr::P"); - - // quote_meta_item! - - let meta = quote_meta_item!(cx, cfg(foo = "bar")); - check!(meta_item_to_string, meta, quote_meta_item!(cx, $meta); r#"cfg(foo = "bar")"#); - - let attr = quote_attr!(cx, #![$meta]); - check!(attribute_to_string, attr; r#"#![cfg(foo = "bar")]"#); -} diff --git a/src/test/run-pass-fulldeps/quote-tokens.rs b/src/test/run-pass-fulldeps/quote-tokens.rs deleted file mode 100644 index 7f46e0928a2..00000000000 --- a/src/test/run-pass-fulldeps/quote-tokens.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] -#![allow(unused_variables)] -#![allow(unused_imports)] -// ignore-cross-compile -#![feature(quote, rustc_private)] - -extern crate syntax; - -use syntax::ext::base::ExtCtxt; -use syntax::ptr::P; -use syntax::parse::PResult; - -fn syntax_extension(cx: &ExtCtxt) { - let e_toks : Vec = quote_tokens!(cx, 1 + 2); - let p_toks : Vec = quote_tokens!(cx, (x, 1 .. 4, *)); - - let a: P = quote_expr!(cx, 1 + 2); - let _b: Option> = quote_item!(cx, static foo : isize = $e_toks; ); - let _c: P = quote_pat!(cx, (x, 1 .. 4, *) ); - let _d: Option = quote_stmt!(cx, let x = $a; ); - let _d: syntax::ast::Arm = quote_arm!(cx, (ref x, ref y) = (x, y) ); - let _e: P = quote_expr!(cx, match foo { $p_toks => 10 } ); - - let _f: P = quote_expr!(cx, ()); - let _g: P = quote_expr!(cx, true); - let _h: P = quote_expr!(cx, 'a'); - - let i: Option> = quote_item!(cx, #[derive(Eq)] struct Foo; ); - assert!(i.is_some()); - - let _l: P = quote_ty!(cx, &isize); - - let _n: syntax::ast::Attribute = quote_attr!(cx, #![cfg(foo, bar = "baz")]); - - let _o: Option> = quote_item!(cx, fn foo() {}); - - let stmts = vec![ - quote_stmt!(cx, let x = 1;).unwrap(), - quote_stmt!(cx, let y = 2;).unwrap(), - ]; - let expr: P = quote_expr!(cx, x + y); -} - -fn main() { -} diff --git a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs b/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs deleted file mode 100644 index 7e85becfc3c..00000000000 --- a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] -// ignore-cross-compile -#![feature(quote, rustc_private)] -#![deny(unused_variables)] - -extern crate syntax; - -use syntax::ext::base::ExtCtxt; - -fn test(cx: &mut ExtCtxt) { - let foo = 10; - let _e = quote_expr!(cx, $foo); -} - -pub fn main() { } diff --git a/src/test/run-pass-fulldeps/regions-mock-tcx.rs b/src/test/run-pass-fulldeps/regions-mock-tcx.rs index 70c19df9788..8e4e6d1c058 100644 --- a/src/test/run-pass-fulldeps/regions-mock-tcx.rs +++ b/src/test/run-pass-fulldeps/regions-mock-tcx.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/test/run-pass-fulldeps/rename-directory.rs b/src/test/run-pass-fulldeps/rename-directory.rs index 099f3e58c6c..1f2545ddcf2 100644 --- a/src/test/run-pass-fulldeps/rename-directory.rs +++ b/src/test/run-pass-fulldeps/rename-directory.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] #![allow(unused_imports)] // This test can't be a unit test in std, diff --git a/src/test/run-pass-fulldeps/roman-numerals-macro.rs b/src/test/run-pass-fulldeps/roman-numerals-macro.rs index 81f5c649626..59a2d132cdc 100644 --- a/src/test/run-pass-fulldeps/roman-numerals-macro.rs +++ b/src/test/run-pass-fulldeps/roman-numerals-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:roman_numerals.rs // ignore-stage1 diff --git a/src/test/run-pass-fulldeps/rustc_encodable_hygiene.rs b/src/test/run-pass-fulldeps/rustc_encodable_hygiene.rs index 655b08225ab..ae232c602cb 100644 --- a/src/test/run-pass-fulldeps/rustc_encodable_hygiene.rs +++ b/src/test/run-pass-fulldeps/rustc_encodable_hygiene.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_private)] #[allow(dead_code)] diff --git a/src/test/run-pass-fulldeps/stdio-from.rs b/src/test/run-pass-fulldeps/stdio-from.rs index 5b28ce0f0c6..70e53936b70 100644 --- a/src/test/run-pass-fulldeps/stdio-from.rs +++ b/src/test/run-pass-fulldeps/stdio-from.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cross-compile use std::env; diff --git a/src/test/run-pass-fulldeps/switch-stdout.rs b/src/test/run-pass-fulldeps/switch-stdout.rs index 316b97f17ef..6b16f955902 100644 --- a/src/test/run-pass-fulldeps/switch-stdout.rs +++ b/src/test/run-pass-fulldeps/switch-stdout.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::env; use std::fs::File; use std::io::{Read, Write}; diff --git a/src/test/run-pass-fulldeps/syntax-extension-with-dll-deps.rs b/src/test/run-pass-fulldeps/syntax-extension-with-dll-deps.rs deleted file mode 100644 index 23096828c4b..00000000000 --- a/src/test/run-pass-fulldeps/syntax-extension-with-dll-deps.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:syntax_extension_with_dll_deps_1.rs -// aux-build:syntax_extension_with_dll_deps_2.rs -// ignore-stage1 - -#![feature(plugin, rustc_private)] -#![plugin(syntax_extension_with_dll_deps_2)] - -fn main() { - foo!(); -} diff --git a/src/test/run-pass-valgrind/cast-enum-with-dtor.rs b/src/test/run-pass-valgrind/cast-enum-with-dtor.rs index 4466a95cb39..42445b9056f 100644 --- a/src/test/run-pass-valgrind/cast-enum-with-dtor.rs +++ b/src/test/run-pass-valgrind/cast-enum-with-dtor.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![allow(dead_code)] diff --git a/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs b/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs index 220968529de..925ffe75fe7 100644 --- a/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs +++ b/src/test/run-pass-valgrind/cleanup-auto-borrow-obj.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // This would previously leak the Box because we wouldn't diff --git a/src/test/run-pass-valgrind/cleanup-stdin.rs b/src/test/run-pass-valgrind/cleanup-stdin.rs index b7c94ed6944..35050742932 100644 --- a/src/test/run-pass-valgrind/cleanup-stdin.rs +++ b/src/test/run-pass-valgrind/cleanup-stdin.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic fn main() { diff --git a/src/test/run-pass-valgrind/coerce-match-calls.rs b/src/test/run-pass-valgrind/coerce-match-calls.rs index c2f6b4c4ac4..60943aad80d 100644 --- a/src/test/run-pass-valgrind/coerce-match-calls.rs +++ b/src/test/run-pass-valgrind/coerce-match-calls.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that coercions are propagated through match and if expressions. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass-valgrind/coerce-match.rs b/src/test/run-pass-valgrind/coerce-match.rs index 360e8c9cc4f..a4ba5427d4b 100644 --- a/src/test/run-pass-valgrind/coerce-match.rs +++ b/src/test/run-pass-valgrind/coerce-match.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that coercions are propagated through match and if expressions. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass-valgrind/down-with-thread-dtors.rs b/src/test/run-pass-valgrind/down-with-thread-dtors.rs index 90c20444842..c3567a9b200 100644 --- a/src/test/run-pass-valgrind/down-with-thread-dtors.rs +++ b/src/test/run-pass-valgrind/down-with-thread-dtors.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // ignore-emscripten diff --git a/src/test/run-pass-valgrind/dst-dtor-1.rs b/src/test/run-pass-valgrind/dst-dtor-1.rs index 4af642a106c..7533a7bd235 100644 --- a/src/test/run-pass-valgrind/dst-dtor-1.rs +++ b/src/test/run-pass-valgrind/dst-dtor-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic static mut DROP_RAN: bool = false; diff --git a/src/test/run-pass-valgrind/dst-dtor-2.rs b/src/test/run-pass-valgrind/dst-dtor-2.rs index 283b8202b35..ebf0c17fecb 100644 --- a/src/test/run-pass-valgrind/dst-dtor-2.rs +++ b/src/test/run-pass-valgrind/dst-dtor-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic static mut DROP_RAN: isize = 0; diff --git a/src/test/run-pass-valgrind/dst-dtor-3.rs b/src/test/run-pass-valgrind/dst-dtor-3.rs index 1ae66a28a84..e15908dfcc3 100644 --- a/src/test/run-pass-valgrind/dst-dtor-3.rs +++ b/src/test/run-pass-valgrind/dst-dtor-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![feature(unsized_tuple_coercion)] diff --git a/src/test/run-pass-valgrind/dst-dtor-4.rs b/src/test/run-pass-valgrind/dst-dtor-4.rs index e416f25bc03..52bf0c364b2 100644 --- a/src/test/run-pass-valgrind/dst-dtor-4.rs +++ b/src/test/run-pass-valgrind/dst-dtor-4.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![feature(unsized_tuple_coercion)] diff --git a/src/test/run-pass-valgrind/exit-flushes.rs b/src/test/run-pass-valgrind/exit-flushes.rs index bb0d5644d38..c4d23c2938d 100644 --- a/src/test/run-pass-valgrind/exit-flushes.rs +++ b/src/test/run-pass-valgrind/exit-flushes.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // ignore-cloudabi // ignore-emscripten diff --git a/src/test/run-pass-valgrind/issue-44800.rs b/src/test/run-pass-valgrind/issue-44800.rs index 29cfae16929..f76657ca752 100644 --- a/src/test/run-pass-valgrind/issue-44800.rs +++ b/src/test/run-pass-valgrind/issue-44800.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::alloc::System; use std::collections::VecDeque; diff --git a/src/test/run-pass-valgrind/osx-frameworks.rs b/src/test/run-pass-valgrind/osx-frameworks.rs index 468a20db6f7..4ea804a1844 100644 --- a/src/test/run-pass-valgrind/osx-frameworks.rs +++ b/src/test/run-pass-valgrind/osx-frameworks.rs @@ -1,17 +1,7 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // pretty-expanded FIXME #23616 -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/abi-sysv64-arg-passing.rs b/src/test/run-pass/abi-sysv64-arg-passing.rs index 4ec3f16f7af..0b9f9934fa9 100644 --- a/src/test/run-pass/abi-sysv64-arg-passing.rs +++ b/src/test/run-pass/abi-sysv64-arg-passing.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks if the "sysv64" calling convention behaves the same as the // "C" calling convention on platforms where both should be the same diff --git a/src/test/run-pass/abi-sysv64-register-usage.rs b/src/test/run-pass/abi-sysv64-register-usage.rs index e7013291275..a0d6e968252 100644 --- a/src/test/run-pass/abi-sysv64-register-usage.rs +++ b/src/test/run-pass/abi-sysv64-register-usage.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks if the correct registers are being used to pass arguments // when the sysv64 ABI is specified. diff --git a/src/test/run-pass/abort-on-c-abi.rs b/src/test/run-pass/abort-on-c-abi.rs index 17b2ee39c88..df94cd57186 100644 --- a/src/test/run-pass/abort-on-c-abi.rs +++ b/src/test/run-pass/abort-on-c-abi.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] // Since we mark some ABIs as "nounwind" to LLVM, we must make sure that // we never unwind through them. @@ -15,14 +5,11 @@ // ignore-cloudabi no env and process // ignore-emscripten no processes -#![feature(unwind_attributes)] - use std::{env, panic}; use std::io::prelude::*; use std::io; use std::process::{Command, Stdio}; -#[unwind(aborts)] extern "C" fn panic_in_ffi() { panic!("Test"); } diff --git a/src/test/run-pass/alias-uninit-value.rs b/src/test/run-pass/alias-uninit-value.rs index 5c87840fe1e..c0fd09cbd40 100644 --- a/src/test/run-pass/alias-uninit-value.rs +++ b/src/test/run-pass/alias-uninit-value.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] diff --git a/src/test/run-pass/align-with-extern-c-fn.rs b/src/test/run-pass/align-with-extern-c-fn.rs index 92ae68fb6a3..dca633de3ce 100644 --- a/src/test/run-pass/align-with-extern-c-fn.rs +++ b/src/test/run-pass/align-with-extern-c-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] #![allow(unused_variables)] diff --git a/src/test/run-pass/alignment-gep-tup-like-1.rs b/src/test/run-pass/alignment-gep-tup-like-1.rs index 7188496dab9..badd095d0ae 100644 --- a/src/test/run-pass/alignment-gep-tup-like-1.rs +++ b/src/test/run-pass/alignment-gep-tup-like-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] diff --git a/src/test/run-pass/alloca-from-derived-tydesc.rs b/src/test/run-pass/alloca-from-derived-tydesc.rs index 7895e89d586..55f65806ab0 100644 --- a/src/test/run-pass/alloca-from-derived-tydesc.rs +++ b/src/test/run-pass/alloca-from-derived-tydesc.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] diff --git a/src/test/run-pass/allocator-alloc-one.rs b/src/test/run-pass/allocator-alloc-one.rs index a62bd67a5ac..90114261723 100644 --- a/src/test/run-pass/allocator-alloc-one.rs +++ b/src/test/run-pass/allocator-alloc-one.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] #![feature(allocator_api, nonnull)] diff --git a/src/test/run-pass/allocator/auxiliary/custom-as-global.rs b/src/test/run-pass/allocator/auxiliary/custom-as-global.rs index a3f05a01c5a..a5e96e77501 100644 --- a/src/test/run-pass/allocator/auxiliary/custom-as-global.rs +++ b/src/test/run-pass/allocator/auxiliary/custom-as-global.rs @@ -1,25 +1,15 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] extern crate custom; -use std::sync::atomic::{ATOMIC_USIZE_INIT, Ordering}; +use std::sync::atomic::{AtomicUsize, Ordering}; use custom::A; #[global_allocator] -static ALLOCATOR: A = A(ATOMIC_USIZE_INIT); +static ALLOCATOR: A = A(AtomicUsize::new(0)); pub fn get() -> usize { ALLOCATOR.0.load(Ordering::SeqCst) diff --git a/src/test/run-pass/allocator/auxiliary/custom.rs b/src/test/run-pass/allocator/auxiliary/custom.rs index b17464e0419..b0ec9ab0929 100644 --- a/src/test/run-pass/allocator/auxiliary/custom.rs +++ b/src/test/run-pass/allocator/auxiliary/custom.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![feature(allocator_api)] diff --git a/src/test/run-pass/allocator/auxiliary/helper.rs b/src/test/run-pass/allocator/auxiliary/helper.rs index e75a432710d..7f6770c226a 100644 --- a/src/test/run-pass/allocator/auxiliary/helper.rs +++ b/src/test/run-pass/allocator/auxiliary/helper.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass/allocator/custom.rs b/src/test/run-pass/allocator/custom.rs index 9617f7d4685..71f72ae46c2 100644 --- a/src/test/run-pass/allocator/custom.rs +++ b/src/test/run-pass/allocator/custom.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:helper.rs @@ -18,9 +8,9 @@ extern crate helper; use std::alloc::{self, Global, Alloc, System, Layout}; -use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use std::sync::atomic::{AtomicUsize, Ordering}; -static HITS: AtomicUsize = ATOMIC_USIZE_INIT; +static HITS: AtomicUsize = AtomicUsize::new(0); struct A; diff --git a/src/test/run-pass/allocator/xcrate-use.rs b/src/test/run-pass/allocator/xcrate-use.rs index 8b9e1e329f7..039c70e77be 100644 --- a/src/test/run-pass/allocator/xcrate-use.rs +++ b/src/test/run-pass/allocator/xcrate-use.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:custom.rs @@ -20,10 +10,10 @@ extern crate custom; extern crate helper; use std::alloc::{Global, Alloc, System, Layout}; -use std::sync::atomic::{Ordering, ATOMIC_USIZE_INIT}; +use std::sync::atomic::{Ordering, AtomicUsize}; #[global_allocator] -static GLOBAL: custom::A = custom::A(ATOMIC_USIZE_INIT); +static GLOBAL: custom::A = custom::A(AtomicUsize::new(0)); fn main() { unsafe { diff --git a/src/test/run-pass/allocator/xcrate-use2.rs b/src/test/run-pass/allocator/xcrate-use2.rs index 2e52f28d311..d8478fb5eaa 100644 --- a/src/test/run-pass/allocator/xcrate-use2.rs +++ b/src/test/run-pass/allocator/xcrate-use2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:custom.rs @@ -22,9 +12,9 @@ extern crate custom_as_global; extern crate helper; use std::alloc::{alloc, dealloc, GlobalAlloc, System, Layout}; -use std::sync::atomic::{Ordering, ATOMIC_USIZE_INIT}; +use std::sync::atomic::{AtomicUsize, Ordering}; -static GLOBAL: custom::A = custom::A(ATOMIC_USIZE_INIT); +static GLOBAL: custom::A = custom::A(AtomicUsize::new(0)); fn main() { unsafe { @@ -55,4 +45,3 @@ fn main() { assert_eq!(GLOBAL.0.load(Ordering::SeqCst), 2); } } - diff --git a/src/test/run-pass/anon-extern-mod.rs b/src/test/run-pass/anon-extern-mod.rs index 16ca7bce95b..6d7e3f3cd5c 100644 --- a/src/test/run-pass/anon-extern-mod.rs +++ b/src/test/run-pass/anon-extern-mod.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs b/src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs index e1663563cec..6904c29111e 100644 --- a/src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs +++ b/src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(arbitrary_self_types, unsize, coerce_unsized, dispatch_from_dyn)] #![feature(rustc_attrs)] diff --git a/src/test/run-pass/arbitrary_self_types_stdlib_pointers.rs b/src/test/run-pass/arbitrary_self_types_stdlib_pointers.rs index 80a7ce96911..9f6a647a07b 100644 --- a/src/test/run-pass/arbitrary_self_types_stdlib_pointers.rs +++ b/src/test/run-pass/arbitrary_self_types_stdlib_pointers.rs @@ -1,15 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(arbitrary_self_types)] -#![feature(pin)] #![feature(rustc_attrs)] use std::{ @@ -23,6 +12,7 @@ trait Trait { fn by_arc(self: Arc) -> i64; fn by_pin_mut(self: Pin<&mut Self>) -> i64; fn by_pin_box(self: Pin>) -> i64; + fn by_pin_pin_pin_ref(self: Pin>>) -> i64; } impl Trait for i64 { @@ -38,6 +28,9 @@ impl Trait for i64 { fn by_pin_box(self: Pin>) -> i64 { *self } + fn by_pin_pin_pin_ref(self: Pin>>) -> i64 { + *self + } } fn main() { @@ -53,4 +46,8 @@ fn main() { let pin_box = Into::>>::into(Box::new(4i64)) as Pin>; assert_eq!(4, pin_box.by_pin_box()); + + let value = 5i64; + let pin_pin_pin_ref = Pin::new(Pin::new(Pin::new(&value))) as Pin>>; + assert_eq!(5, pin_pin_pin_ref.by_pin_pin_pin_ref()); } diff --git a/src/test/run-pass/argument-passing.rs b/src/test/run-pass/argument-passing.rs index d2a595804a4..ea18ffe0155 100644 --- a/src/test/run-pass/argument-passing.rs +++ b/src/test/run-pass/argument-passing.rs @@ -1,15 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - struct X { x: isize } diff --git a/src/test/run-pass/array-slice-vec/arr_cycle.rs b/src/test/run-pass/array-slice-vec/arr_cycle.rs index 4029a270c8d..c262b5a1ff0 100644 --- a/src/test/run-pass/array-slice-vec/arr_cycle.rs +++ b/src/test/run-pass/array-slice-vec/arr_cycle.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::cell::Cell; diff --git a/src/test/run-pass/array-slice-vec/array_const_index-1.rs b/src/test/run-pass/array-slice-vec/array_const_index-1.rs index 2bc8bf9796e..8ee225f5cdf 100644 --- a/src/test/run-pass/array-slice-vec/array_const_index-1.rs +++ b/src/test/run-pass/array-slice-vec/array_const_index-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(stable_features)] diff --git a/src/test/run-pass/array-slice-vec/box-of-array-of-drop-1.rs b/src/test/run-pass/array-slice-vec/box-of-array-of-drop-1.rs index 5d6cc5f686e..d4858932815 100644 --- a/src/test/run-pass/array-slice-vec/box-of-array-of-drop-1.rs +++ b/src/test/run-pass/array-slice-vec/box-of-array-of-drop-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(overflowing_literals)] diff --git a/src/test/run-pass/array-slice-vec/box-of-array-of-drop-2.rs b/src/test/run-pass/array-slice-vec/box-of-array-of-drop-2.rs index d2dedc4602a..e8a5b00a55b 100644 --- a/src/test/run-pass/array-slice-vec/box-of-array-of-drop-2.rs +++ b/src/test/run-pass/array-slice-vec/box-of-array-of-drop-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(overflowing_literals)] diff --git a/src/test/run-pass/array-slice-vec/cast-in-array-size.rs b/src/test/run-pass/array-slice-vec/cast-in-array-size.rs index d78bc0b0072..b112dcaef3e 100644 --- a/src/test/run-pass/array-slice-vec/cast-in-array-size.rs +++ b/src/test/run-pass/array-slice-vec/cast-in-array-size.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/check-static-mut-slices.rs b/src/test/run-pass/array-slice-vec/check-static-mut-slices.rs index 998a1d9ee27..b89c634036e 100644 --- a/src/test/run-pass/array-slice-vec/check-static-mut-slices.rs +++ b/src/test/run-pass/array-slice-vec/check-static-mut-slices.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/array-slice-vec/check-static-slice.rs b/src/test/run-pass/array-slice-vec/check-static-slice.rs index 6627095c32b..1c607d13426 100644 --- a/src/test/run-pass/array-slice-vec/check-static-slice.rs +++ b/src/test/run-pass/array-slice-vec/check-static-slice.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that the various ways of getting to a reference to a vec (both sized diff --git a/src/test/run-pass/array-slice-vec/copy-out-of-array-1.rs b/src/test/run-pass/array-slice-vec/copy-out-of-array-1.rs index 917683e4eeb..e64985ae3f6 100644 --- a/src/test/run-pass/array-slice-vec/copy-out-of-array-1.rs +++ b/src/test/run-pass/array-slice-vec/copy-out-of-array-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Ensure that we can copy out of a fixed-size array. diff --git a/src/test/run-pass/array-slice-vec/destructure-array-1.rs b/src/test/run-pass/array-slice-vec/destructure-array-1.rs index 17620f62be6..74d893ee5b2 100644 --- a/src/test/run-pass/array-slice-vec/destructure-array-1.rs +++ b/src/test/run-pass/array-slice-vec/destructure-array-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Ensure that we can do a destructuring bind of a fixed-size array, diff --git a/src/test/run-pass/array-slice-vec/empty-mutable-vec.rs b/src/test/run-pass/array-slice-vec/empty-mutable-vec.rs index 7411d574321..91ab280b9c7 100644 --- a/src/test/run-pass/array-slice-vec/empty-mutable-vec.rs +++ b/src/test/run-pass/array-slice-vec/empty-mutable-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/array-slice-vec/estr-slice.rs b/src/test/run-pass/array-slice-vec/estr-slice.rs index 768229aafbf..02b88f6a7ab 100644 --- a/src/test/run-pass/array-slice-vec/estr-slice.rs +++ b/src/test/run-pass/array-slice-vec/estr-slice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/evec-slice.rs b/src/test/run-pass/array-slice-vec/evec-slice.rs index b1a55a04a24..4bdf2dbdd6e 100644 --- a/src/test/run-pass/array-slice-vec/evec-slice.rs +++ b/src/test/run-pass/array-slice-vec/evec-slice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] diff --git a/src/test/run-pass/array-slice-vec/fixed_length_copy.rs b/src/test/run-pass/array-slice-vec/fixed_length_copy.rs index 09492e37e28..f73173e8484 100644 --- a/src/test/run-pass/array-slice-vec/fixed_length_copy.rs +++ b/src/test/run-pass/array-slice-vec/fixed_length_copy.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/huge-largest-array.rs b/src/test/run-pass/array-slice-vec/huge-largest-array.rs index 27b4e68e771..9e78162c813 100644 --- a/src/test/run-pass/array-slice-vec/huge-largest-array.rs +++ b/src/test/run-pass/array-slice-vec/huge-largest-array.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/ivec-pass-by-value.rs b/src/test/run-pass/array-slice-vec/ivec-pass-by-value.rs index 2f3efef5636..e22aef96330 100644 --- a/src/test/run-pass/array-slice-vec/ivec-pass-by-value.rs +++ b/src/test/run-pass/array-slice-vec/ivec-pass-by-value.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn f(_a: Vec ) { } diff --git a/src/test/run-pass/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs b/src/test/run-pass/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs index 49dc348952b..7afb9d8461f 100644 --- a/src/test/run-pass/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs +++ b/src/test/run-pass/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/mutable-alias-vec.rs b/src/test/run-pass/array-slice-vec/mutable-alias-vec.rs index dc2548ad53c..98dd46824fa 100644 --- a/src/test/run-pass/array-slice-vec/mutable-alias-vec.rs +++ b/src/test/run-pass/array-slice-vec/mutable-alias-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn grow(v: &mut Vec ) { diff --git a/src/test/run-pass/array-slice-vec/nested-vec-1.rs b/src/test/run-pass/array-slice-vec/nested-vec-1.rs index 62bcc5f7254..02a3ccf46f2 100644 --- a/src/test/run-pass/array-slice-vec/nested-vec-1.rs +++ b/src/test/run-pass/array-slice-vec/nested-vec-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that using the `vec!` macro nested within itself works diff --git a/src/test/run-pass/array-slice-vec/nested-vec-2.rs b/src/test/run-pass/array-slice-vec/nested-vec-2.rs index 4af2350cc36..d4a704d767e 100644 --- a/src/test/run-pass/array-slice-vec/nested-vec-2.rs +++ b/src/test/run-pass/array-slice-vec/nested-vec-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that using the `vec!` macro nested within itself works diff --git a/src/test/run-pass/array-slice-vec/nested-vec-3.rs b/src/test/run-pass/array-slice-vec/nested-vec-3.rs index dc3146a2b35..52b892dbcdf 100644 --- a/src/test/run-pass/array-slice-vec/nested-vec-3.rs +++ b/src/test/run-pass/array-slice-vec/nested-vec-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(overflowing_literals)] diff --git a/src/test/run-pass/array-slice-vec/new-style-fixed-length-vec.rs b/src/test/run-pass/array-slice-vec/new-style-fixed-length-vec.rs index 268fa5c4b59..454f94be876 100644 --- a/src/test/run-pass/array-slice-vec/new-style-fixed-length-vec.rs +++ b/src/test/run-pass/array-slice-vec/new-style-fixed-length-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass static FOO: [isize; 3] = [1, 2, 3]; diff --git a/src/test/run-pass/array-slice-vec/rcvr-borrowed-to-slice.rs b/src/test/run-pass/array-slice-vec/rcvr-borrowed-to-slice.rs index 76302b92ed0..17cf7e335b9 100644 --- a/src/test/run-pass/array-slice-vec/rcvr-borrowed-to-slice.rs +++ b/src/test/run-pass/array-slice-vec/rcvr-borrowed-to-slice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/array-slice-vec/repeated-vector-syntax.rs b/src/test/run-pass/array-slice-vec/repeated-vector-syntax.rs index d706be4c336..4458eb06dd5 100644 --- a/src/test/run-pass/array-slice-vec/repeated-vector-syntax.rs +++ b/src/test/run-pass/array-slice-vec/repeated-vector-syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/array-slice-vec/show-boxed-slice.rs b/src/test/run-pass/array-slice-vec/show-boxed-slice.rs index dda4ce9f227..dfa4c720bb0 100644 --- a/src/test/run-pass/array-slice-vec/show-boxed-slice.rs +++ b/src/test/run-pass/array-slice-vec/show-boxed-slice.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Debug)] diff --git a/src/test/run-pass/array-slice-vec/slice-2.rs b/src/test/run-pass/array-slice-vec/slice-2.rs index 1f71ceac04f..01733f48234 100644 --- a/src/test/run-pass/array-slice-vec/slice-2.rs +++ b/src/test/run-pass/array-slice-vec/slice-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test slicing expressions on slices and Vecs. diff --git a/src/test/run-pass/array-slice-vec/slice-of-zero-size-elements.rs b/src/test/run-pass/array-slice-vec/slice-of-zero-size-elements.rs index 671246f6a63..83b08a3db4c 100644 --- a/src/test/run-pass/array-slice-vec/slice-of-zero-size-elements.rs +++ b/src/test/run-pass/array-slice-vec/slice-of-zero-size-elements.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] diff --git a/src/test/run-pass/array-slice-vec/slice-panic-1.rs b/src/test/run-pass/array-slice-vec/slice-panic-1.rs index b9d816acaa2..8b27d055e2b 100644 --- a/src/test/run-pass/array-slice-vec/slice-panic-1.rs +++ b/src/test/run-pass/array-slice-vec/slice-panic-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/array-slice-vec/slice-panic-2.rs b/src/test/run-pass/array-slice-vec/slice-panic-2.rs index 787d10b042f..2ee564cadb3 100644 --- a/src/test/run-pass/array-slice-vec/slice-panic-2.rs +++ b/src/test/run-pass/array-slice-vec/slice-panic-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/array-slice-vec/slice.rs b/src/test/run-pass/array-slice-vec/slice.rs index b85cb97b6ba..14e1ddf52eb 100644 --- a/src/test/run-pass/array-slice-vec/slice.rs +++ b/src/test/run-pass/array-slice-vec/slice.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] diff --git a/src/test/run-pass/array-slice-vec/slice_binary_search.rs b/src/test/run-pass/array-slice-vec/slice_binary_search.rs index 081b06bea5c..12236960179 100644 --- a/src/test/run-pass/array-slice-vec/slice_binary_search.rs +++ b/src/test/run-pass/array-slice-vec/slice_binary_search.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test binary_search_by_key lifetime. Issue #34683 diff --git a/src/test/run-pass/array-slice-vec/variance-vec-covariant.rs b/src/test/run-pass/array-slice-vec/variance-vec-covariant.rs index 5cf52006f3c..d7e64132f89 100644 --- a/src/test/run-pass/array-slice-vec/variance-vec-covariant.rs +++ b/src/test/run-pass/array-slice-vec/variance-vec-covariant.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that vec is now covariant in its argument type. diff --git a/src/test/run-pass/array-slice-vec/vec-concat.rs b/src/test/run-pass/array-slice-vec/vec-concat.rs index 7c734d8d6a2..1f493679b79 100644 --- a/src/test/run-pass/array-slice-vec/vec-concat.rs +++ b/src/test/run-pass/array-slice-vec/vec-concat.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::vec; diff --git a/src/test/run-pass/array-slice-vec/vec-dst.rs b/src/test/run-pass/array-slice-vec/vec-dst.rs index 6421b69d22e..e741201652b 100644 --- a/src/test/run-pass/array-slice-vec/vec-dst.rs +++ b/src/test/run-pass/array-slice-vec/vec-dst.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/array-slice-vec/vec-fixed-length.rs b/src/test/run-pass/array-slice-vec/vec-fixed-length.rs index a7b86794132..5db02ee066b 100644 --- a/src/test/run-pass/array-slice-vec/vec-fixed-length.rs +++ b/src/test/run-pass/array-slice-vec/vec-fixed-length.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/vec-growth.rs b/src/test/run-pass/array-slice-vec/vec-growth.rs index e783a799c05..b09f08bb85a 100644 --- a/src/test/run-pass/array-slice-vec/vec-growth.rs +++ b/src/test/run-pass/array-slice-vec/vec-growth.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/vec-late-init.rs b/src/test/run-pass/array-slice-vec/vec-late-init.rs index 234d63672d9..5dee3608256 100644 --- a/src/test/run-pass/array-slice-vec/vec-late-init.rs +++ b/src/test/run-pass/array-slice-vec/vec-late-init.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] diff --git a/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs b/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs index 509167413b6..7f7f1e43315 100644 --- a/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs +++ b/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs @@ -1,18 +1,8 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no no_std executables -#![feature(lang_items, start, libc, alloc)] +#![feature(lang_items, start, rustc_private, alloc)] #![no_std] extern crate std as other; diff --git a/src/test/run-pass/array-slice-vec/vec-macro-repeat.rs b/src/test/run-pass/array-slice-vec/vec-macro-repeat.rs index 36c8b7cffab..7be8dadbe17 100644 --- a/src/test/run-pass/array-slice-vec/vec-macro-repeat.rs +++ b/src/test/run-pass/array-slice-vec/vec-macro-repeat.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/vec-macro-rvalue-scope.rs b/src/test/run-pass/array-slice-vec/vec-macro-rvalue-scope.rs index 8ccf22e6288..bde01037181 100644 --- a/src/test/run-pass/array-slice-vec/vec-macro-rvalue-scope.rs +++ b/src/test/run-pass/array-slice-vec/vec-macro-rvalue-scope.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs b/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs index aa7d96a5e5a..6c95bd50007 100644 --- a/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs +++ b/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] diff --git a/src/test/run-pass/array-slice-vec/vec-macro-with-trailing-comma.rs b/src/test/run-pass/array-slice-vec/vec-macro-with-trailing-comma.rs index 046d634b19d..f7a51f9c456 100644 --- a/src/test/run-pass/array-slice-vec/vec-macro-with-trailing-comma.rs +++ b/src/test/run-pass/array-slice-vec/vec-macro-with-trailing-comma.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/vec-matching-autoslice.rs b/src/test/run-pass/array-slice-vec/vec-matching-autoslice.rs index b5cefb48ce7..8179edf420c 100644 --- a/src/test/run-pass/array-slice-vec/vec-matching-autoslice.rs +++ b/src/test/run-pass/array-slice-vec/vec-matching-autoslice.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 diff --git a/src/test/run-pass/array-slice-vec/vec-matching-fixed.rs b/src/test/run-pass/array-slice-vec/vec-matching-fixed.rs index 7bfecdd2c7f..5253bc1b214 100644 --- a/src/test/run-pass/array-slice-vec/vec-matching-fixed.rs +++ b/src/test/run-pass/array-slice-vec/vec-matching-fixed.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(slice_patterns)] diff --git a/src/test/run-pass/array-slice-vec/vec-matching-fold.rs b/src/test/run-pass/array-slice-vec/vec-matching-fold.rs index b1aa7f1b70c..2b19c49c427 100644 --- a/src/test/run-pass/array-slice-vec/vec-matching-fold.rs +++ b/src/test/run-pass/array-slice-vec/vec-matching-fold.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(slice_patterns)] diff --git a/src/test/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs b/src/test/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs index 3d4a84aa5c3..bce03b3375e 100644 --- a/src/test/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs +++ b/src/test/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] diff --git a/src/test/run-pass/array-slice-vec/vec-matching.rs b/src/test/run-pass/array-slice-vec/vec-matching.rs index 8d1ef6f755a..a37c25160fa 100644 --- a/src/test/run-pass/array-slice-vec/vec-matching.rs +++ b/src/test/run-pass/array-slice-vec/vec-matching.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(slice_patterns)] diff --git a/src/test/run-pass/array-slice-vec/vec-push.rs b/src/test/run-pass/array-slice-vec/vec-push.rs index 360568048c0..466ab3fab1c 100644 --- a/src/test/run-pass/array-slice-vec/vec-push.rs +++ b/src/test/run-pass/array-slice-vec/vec-push.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { let mut v = vec![1, 2, 3]; v.push(1); } diff --git a/src/test/run-pass/array-slice-vec/vec-repeat-with-cast.rs b/src/test/run-pass/array-slice-vec/vec-repeat-with-cast.rs index 650de32fe61..3e0e18873ab 100644 --- a/src/test/run-pass/array-slice-vec/vec-repeat-with-cast.rs +++ b/src/test/run-pass/array-slice-vec/vec-repeat-with-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/array-slice-vec/vec-slice-drop.rs b/src/test/run-pass/array-slice-vec/vec-slice-drop.rs index 189d5a38ae3..3a9ea86af34 100644 --- a/src/test/run-pass/array-slice-vec/vec-slice-drop.rs +++ b/src/test/run-pass/array-slice-vec/vec-slice-drop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/array-slice-vec/vec-slice.rs b/src/test/run-pass/array-slice-vec/vec-slice.rs index 8ad662f0c63..1f090ddd9c9 100644 --- a/src/test/run-pass/array-slice-vec/vec-slice.rs +++ b/src/test/run-pass/array-slice-vec/vec-slice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/vec-tail-matching.rs b/src/test/run-pass/array-slice-vec/vec-tail-matching.rs index 46a882a2ae1..84d246dff82 100644 --- a/src/test/run-pass/array-slice-vec/vec-tail-matching.rs +++ b/src/test/run-pass/array-slice-vec/vec-tail-matching.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(slice_patterns)] diff --git a/src/test/run-pass/array-slice-vec/vec-to_str.rs b/src/test/run-pass/array-slice-vec/vec-to_str.rs index 4facc0e6892..a11cfc8e9b5 100644 --- a/src/test/run-pass/array-slice-vec/vec-to_str.rs +++ b/src/test/run-pass/array-slice-vec/vec-to_str.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/vec.rs b/src/test/run-pass/array-slice-vec/vec.rs index 34a8e125a5c..e76c1ab440e 100644 --- a/src/test/run-pass/array-slice-vec/vec.rs +++ b/src/test/run-pass/array-slice-vec/vec.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/array-slice-vec/vec_cycle.rs b/src/test/run-pass/array-slice-vec/vec_cycle.rs index 3222b0e789d..82bce437282 100644 --- a/src/test/run-pass/array-slice-vec/vec_cycle.rs +++ b/src/test/run-pass/array-slice-vec/vec_cycle.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::cell::Cell; diff --git a/src/test/run-pass/array-slice-vec/vec_cycle_wrapped.rs b/src/test/run-pass/array-slice-vec/vec_cycle_wrapped.rs index 355f9d3e40e..1a3606d5e8d 100644 --- a/src/test/run-pass/array-slice-vec/vec_cycle_wrapped.rs +++ b/src/test/run-pass/array-slice-vec/vec_cycle_wrapped.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::cell::Cell; diff --git a/src/test/run-pass/array-slice-vec/vector-no-ann-2.rs b/src/test/run-pass/array-slice-vec/vector-no-ann-2.rs index 0b09545c0aa..dd8f402f3f6 100644 --- a/src/test/run-pass/array-slice-vec/vector-no-ann-2.rs +++ b/src/test/run-pass/array-slice-vec/vector-no-ann-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/artificial-block.rs b/src/test/run-pass/artificial-block.rs index de946d94d07..dd4d3e57536 100644 --- a/src/test/run-pass/artificial-block.rs +++ b/src/test/run-pass/artificial-block.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn f() -> isize { { return 3; } } pub fn main() { assert_eq!(f(), 3); } diff --git a/src/test/run-pass/as-precedence.rs b/src/test/run-pass/as-precedence.rs index d89607077dc..34ff96ea6da 100644 --- a/src/test/run-pass/as-precedence.rs +++ b/src/test/run-pass/as-precedence.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn main() { assert_eq!(3 as usize * 3, 9); assert_eq!(3 as (usize) * 3, 9); diff --git a/src/test/run-pass/asm-concat-src.rs b/src/test/run-pass/asm-concat-src.rs index 0380ccbdea4..b24586464d6 100644 --- a/src/test/run-pass/asm-concat-src.rs +++ b/src/test/run-pass/asm-concat-src.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 // ignore-emscripten no asm diff --git a/src/test/run-pass/asm-in-moved.rs b/src/test/run-pass/asm-in-moved.rs index debfcc5c552..dc73f83a940 100644 --- a/src/test/run-pass/asm-in-moved.rs +++ b/src/test/run-pass/asm-in-moved.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/run-pass/asm-in-out-operand.rs b/src/test/run-pass/asm-in-out-operand.rs index 243ecf86e9c..148c5b34855 100644 --- a/src/test/run-pass/asm-in-out-operand.rs +++ b/src/test/run-pass/asm-in-out-operand.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] diff --git a/src/test/run-pass/asm-indirect-memory.rs b/src/test/run-pass/asm-indirect-memory.rs index d1873afb3a9..83b773d8604 100644 --- a/src/test/run-pass/asm-indirect-memory.rs +++ b/src/test/run-pass/asm-indirect-memory.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(asm)] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] diff --git a/src/test/run-pass/asm-out-assign.rs b/src/test/run-pass/asm-out-assign.rs index 6acb9054af5..d0978cc8342 100644 --- a/src/test/run-pass/asm-out-assign.rs +++ b/src/test/run-pass/asm-out-assign.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/run-pass/assert-eq-trailing-comma.rs b/src/test/run-pass/assert-eq-trailing-comma.rs index d98baf640a8..77f3ec90da4 100644 --- a/src/test/run-pass/assert-eq-trailing-comma.rs +++ b/src/test/run-pass/assert-eq-trailing-comma.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { assert_eq!(1, 1,); } diff --git a/src/test/run-pass/assert-escape.rs b/src/test/run-pass/assert-escape.rs index d340806c357..01342113bde 100644 --- a/src/test/run-pass/assert-escape.rs +++ b/src/test/run-pass/assert-escape.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { assert!(r#"☃\backslash"#.contains("\\")); } diff --git a/src/test/run-pass/assert-ne-trailing-comma.rs b/src/test/run-pass/assert-ne-trailing-comma.rs index 4d3c29da8b2..f931a04a290 100644 --- a/src/test/run-pass/assert-ne-trailing-comma.rs +++ b/src/test/run-pass/assert-ne-trailing-comma.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { assert_ne!(1, 2,); } diff --git a/src/test/run-pass/assign-assign.rs b/src/test/run-pass/assign-assign.rs index 186f91da07c..ea0337676fc 100644 --- a/src/test/run-pass/assign-assign.rs +++ b/src/test/run-pass/assign-assign.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 483 - Assignment expressions result in nil fn test_assign() { diff --git a/src/test/run-pass/assoc-oddities-3.rs b/src/test/run-pass/assoc-oddities-3.rs index 4913816ffe6..bd381259675 100644 --- a/src/test/run-pass/assoc-oddities-3.rs +++ b/src/test/run-pass/assoc-oddities-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn that_odd_parse(c: bool, n: usize) -> u32 { let x = 2; let a = [1, 2, 3, 4]; diff --git a/src/test/run-pass/associated-consts/associated-const-const-eval.rs b/src/test/run-pass/associated-consts/associated-const-const-eval.rs index 3ef8e6c2478..5a34bb97ca5 100644 --- a/src/test/run-pass/associated-consts/associated-const-const-eval.rs +++ b/src/test/run-pass/associated-consts/associated-const-const-eval.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { diff --git a/src/test/run-pass/associated-consts/associated-const-cross-crate-const-eval.rs b/src/test/run-pass/associated-consts/associated-const-cross-crate-const-eval.rs index c0f1d93c253..611639b84be 100644 --- a/src/test/run-pass/associated-consts/associated-const-cross-crate-const-eval.rs +++ b/src/test/run-pass/associated-consts/associated-const-cross-crate-const-eval.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:associated-const-cc-lib.rs diff --git a/src/test/run-pass/associated-consts/associated-const-cross-crate-defaults.rs b/src/test/run-pass/associated-consts/associated-const-cross-crate-defaults.rs index 7d85c7021ab..92d9cffecdd 100644 --- a/src/test/run-pass/associated-consts/associated-const-cross-crate-defaults.rs +++ b/src/test/run-pass/associated-consts/associated-const-cross-crate-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:associated-const-cc-lib.rs diff --git a/src/test/run-pass/associated-consts/associated-const-cross-crate.rs b/src/test/run-pass/associated-consts/associated-const-cross-crate.rs index 0f1bde4b4db..ecdc112e02d 100644 --- a/src/test/run-pass/associated-consts/associated-const-cross-crate.rs +++ b/src/test/run-pass/associated-consts/associated-const-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:associated-const-cc-lib.rs diff --git a/src/test/run-pass/associated-consts/associated-const-in-global-const.rs b/src/test/run-pass/associated-consts/associated-const-in-global-const.rs index 089bf07b9c7..18d7a121558 100644 --- a/src/test/run-pass/associated-consts/associated-const-in-global-const.rs +++ b/src/test/run-pass/associated-consts/associated-const-in-global-const.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo; diff --git a/src/test/run-pass/associated-consts/associated-const-inherent-impl.rs b/src/test/run-pass/associated-consts/associated-const-inherent-impl.rs index 60b794015f9..c6d956dffe1 100644 --- a/src/test/run-pass/associated-consts/associated-const-inherent-impl.rs +++ b/src/test/run-pass/associated-consts/associated-const-inherent-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo; diff --git a/src/test/run-pass/associated-consts/associated-const-marks-live-code.rs b/src/test/run-pass/associated-consts/associated-const-marks-live-code.rs index de9edfc679e..68eb4e25d33 100644 --- a/src/test/run-pass/associated-consts/associated-const-marks-live-code.rs +++ b/src/test/run-pass/associated-consts/associated-const-marks-live-code.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![deny(dead_code)] diff --git a/src/test/run-pass/associated-consts/associated-const-match-patterns.rs b/src/test/run-pass/associated-consts/associated-const-match-patterns.rs index 9fbce1cebf3..62c1cb983d1 100644 --- a/src/test/run-pass/associated-consts/associated-const-match-patterns.rs +++ b/src/test/run-pass/associated-consts/associated-const-match-patterns.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:empty-struct.rs diff --git a/src/test/run-pass/associated-consts/associated-const-outer-ty-refs.rs b/src/test/run-pass/associated-consts/associated-const-outer-ty-refs.rs index c62e073a6a7..f32ca0cccfc 100644 --- a/src/test/run-pass/associated-consts/associated-const-outer-ty-refs.rs +++ b/src/test/run-pass/associated-consts/associated-const-outer-ty-refs.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Lattice { const BOTTOM: Self; diff --git a/src/test/run-pass/associated-consts/associated-const-overwrite-default.rs b/src/test/run-pass/associated-consts/associated-const-overwrite-default.rs index 0e225d7117e..445135aef2b 100644 --- a/src/test/run-pass/associated-consts/associated-const-overwrite-default.rs +++ b/src/test/run-pass/associated-consts/associated-const-overwrite-default.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { diff --git a/src/test/run-pass/associated-consts/associated-const-public-impl.rs b/src/test/run-pass/associated-consts/associated-const-public-impl.rs index 8c11ae69ded..787bee0ff02 100644 --- a/src/test/run-pass/associated-consts/associated-const-public-impl.rs +++ b/src/test/run-pass/associated-consts/associated-const-public-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass mod bar1 { diff --git a/src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs b/src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs index b425d759b03..4801369cfd1 100644 --- a/src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs +++ b/src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs @@ -1,15 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -#![allow(dead_code)] +#![allow(dead_code, unreachable_patterns)] struct Foo; diff --git a/src/test/run-pass/associated-consts/associated-const-resolution-order.rs b/src/test/run-pass/associated-consts/associated-const-resolution-order.rs index ed02644c6a1..d2ccd30a6e2 100644 --- a/src/test/run-pass/associated-consts/associated-const-resolution-order.rs +++ b/src/test/run-pass/associated-consts/associated-const-resolution-order.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct MyType; diff --git a/src/test/run-pass/associated-consts/associated-const-self-type.rs b/src/test/run-pass/associated-consts/associated-const-self-type.rs index 52d9574edde..36e1e4ecce7 100644 --- a/src/test/run-pass/associated-consts/associated-const-self-type.rs +++ b/src/test/run-pass/associated-consts/associated-const-self-type.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait MyInt { diff --git a/src/test/run-pass/associated-consts/associated-const-type-parameters.rs b/src/test/run-pass/associated-consts/associated-const-type-parameters.rs index 37407b6bf9f..47c3313ec28 100644 --- a/src/test/run-pass/associated-consts/associated-const-type-parameters.rs +++ b/src/test/run-pass/associated-consts/associated-const-type-parameters.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { diff --git a/src/test/run-pass/associated-consts/associated-const-ufcs-infer-trait.rs b/src/test/run-pass/associated-consts/associated-const-ufcs-infer-trait.rs index 6269222fb8e..ca44c9f45fc 100644 --- a/src/test/run-pass/associated-consts/associated-const-ufcs-infer-trait.rs +++ b/src/test/run-pass/associated-consts/associated-const-ufcs-infer-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { diff --git a/src/test/run-pass/associated-consts/associated-const-use-default.rs b/src/test/run-pass/associated-consts/associated-const-use-default.rs index 623949b2418..adf36b1fff2 100644 --- a/src/test/run-pass/associated-consts/associated-const-use-default.rs +++ b/src/test/run-pass/associated-consts/associated-const-use-default.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { diff --git a/src/test/run-pass/associated-consts/associated-const-use-impl-of-same-trait.rs b/src/test/run-pass/associated-consts/associated-const-use-impl-of-same-trait.rs index 80848e5653f..8f01bae4fcf 100644 --- a/src/test/run-pass/associated-consts/associated-const-use-impl-of-same-trait.rs +++ b/src/test/run-pass/associated-consts/associated-const-use-impl-of-same-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // The main purpose of this test is to ensure that different impls of the same diff --git a/src/test/run-pass/associated-consts/associated-const.rs b/src/test/run-pass/associated-consts/associated-const.rs index c20025c385a..e4b1c29f371 100644 --- a/src/test/run-pass/associated-consts/associated-const.rs +++ b/src/test/run-pass/associated-consts/associated-const.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { diff --git a/src/test/run-pass/associated-consts/auxiliary/associated-const-cc-lib.rs b/src/test/run-pass/associated-consts/auxiliary/associated-const-cc-lib.rs index e4cada40db3..4fcefe32cbf 100644 --- a/src/test/run-pass/associated-consts/auxiliary/associated-const-cc-lib.rs +++ b/src/test/run-pass/associated-consts/auxiliary/associated-const-cc-lib.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![crate_type="lib"] // These items are for testing that associated consts work cross-crate. diff --git a/src/test/run-pass/associated-consts/auxiliary/empty-struct.rs b/src/test/run-pass/associated-consts/auxiliary/empty-struct.rs index 734e57a774d..93275e7143e 100644 --- a/src/test/run-pass/associated-consts/auxiliary/empty-struct.rs +++ b/src/test/run-pass/associated-consts/auxiliary/empty-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct XEmpty1 {} pub struct XEmpty2; pub struct XEmpty7(); diff --git a/src/test/run-pass/associated-item-long-paths.rs b/src/test/run-pass/associated-item-long-paths.rs index 4ad0187df7a..f2d151fc54a 100644 --- a/src/test/run-pass/associated-item-long-paths.rs +++ b/src/test/run-pass/associated-item-long-paths.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem::size_of; // The main point of this test is to ensure that we can parse and resolve diff --git a/src/test/run-pass/associated-types/associated-types-basic.rs b/src/test/run-pass/associated-types/associated-types-basic.rs index 3628f9ce183..b7f6721ec4f 100644 --- a/src/test/run-pass/associated-types/associated-types-basic.rs +++ b/src/test/run-pass/associated-types/associated-types-basic.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { type T; diff --git a/src/test/run-pass/associated-types/associated-types-binding-in-trait.rs b/src/test/run-pass/associated-types/associated-types-binding-in-trait.rs index 63ac60e62d9..2e42b3a2a44 100644 --- a/src/test/run-pass/associated-types/associated-types-binding-in-trait.rs +++ b/src/test/run-pass/associated-types/associated-types-binding-in-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test a case where the associated type binding (to `bool`, in this // case) is derived from the trait definition. Issue #21636. diff --git a/src/test/run-pass/associated-types/associated-types-binding-in-where-clause.rs b/src/test/run-pass/associated-types/associated-types-binding-in-where-clause.rs index 7b735520efb..c54bc3cd623 100644 --- a/src/test/run-pass/associated-types/associated-types-binding-in-where-clause.rs +++ b/src/test/run-pass/associated-types/associated-types-binding-in-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test equality constraints on associated types in a where clause. diff --git a/src/test/run-pass/associated-types/associated-types-bound.rs b/src/test/run-pass/associated-types/associated-types-bound.rs index 56ce378da65..0e9a229a5e5 100644 --- a/src/test/run-pass/associated-types/associated-types-bound.rs +++ b/src/test/run-pass/associated-types/associated-types-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test equality constrai32s on associated types in a where clause. diff --git a/src/test/run-pass/associated-types/associated-types-cc.rs b/src/test/run-pass/associated-types/associated-types-cc.rs index 282e44ed42b..13f1d27203a 100644 --- a/src/test/run-pass/associated-types/associated-types-cc.rs +++ b/src/test/run-pass/associated-types/associated-types-cc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // aux-build:associated-types-cc-lib.rs diff --git a/src/test/run-pass/associated-types/associated-types-conditional-dispatch.rs b/src/test/run-pass/associated-types/associated-types-conditional-dispatch.rs index a795ee2c5ef..70ee60517ae 100644 --- a/src/test/run-pass/associated-types/associated-types-conditional-dispatch.rs +++ b/src/test/run-pass/associated-types/associated-types-conditional-dispatch.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we evaluate projection predicates to winnow out // candidates during trait selection and method resolution (#20296). diff --git a/src/test/run-pass/associated-types/associated-types-constant-type.rs b/src/test/run-pass/associated-types/associated-types-constant-type.rs index 3581a6c4388..1e4c113a5fb 100644 --- a/src/test/run-pass/associated-types/associated-types-constant-type.rs +++ b/src/test/run-pass/associated-types/associated-types-constant-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait SignedUnsigned { diff --git a/src/test/run-pass/associated-types/associated-types-doubleendediterator-object.rs b/src/test/run-pass/associated-types/associated-types-doubleendediterator-object.rs index 4b8ceda9b81..5f86888aef0 100644 --- a/src/test/run-pass/associated-types/associated-types-doubleendediterator-object.rs +++ b/src/test/run-pass/associated-types/associated-types-doubleendediterator-object.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs index 53d25b23b48..12ca100435a 100644 --- a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs +++ b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Check that we do not report ambiguities when equivalent predicates diff --git a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs index b04da14795f..9ffccd3d8ff 100644 --- a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs +++ b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Check that we do not report ambiguities when the same predicate diff --git a/src/test/run-pass/associated-types/associated-types-enum-field-named.rs b/src/test/run-pass/associated-types/associated-types-enum-field-named.rs index d21195c3d3a..896d67213e9 100644 --- a/src/test/run-pass/associated-types/associated-types-enum-field-named.rs +++ b/src/test/run-pass/associated-types/associated-types-enum-field-named.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test associated types appearing in struct-like enum variants. diff --git a/src/test/run-pass/associated-types/associated-types-enum-field-numbered.rs b/src/test/run-pass/associated-types/associated-types-enum-field-numbered.rs index 9a91a998201..77ced3c0781 100644 --- a/src/test/run-pass/associated-types/associated-types-enum-field-numbered.rs +++ b/src/test/run-pass/associated-types/associated-types-enum-field-numbered.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test associated types appearing in tuple-like enum variants. diff --git a/src/test/run-pass/associated-types/associated-types-eq-obj.rs b/src/test/run-pass/associated-types/associated-types-eq-obj.rs index 75fe2093da9..0f3dfe338a3 100644 --- a/src/test/run-pass/associated-types/associated-types-eq-obj.rs +++ b/src/test/run-pass/associated-types/associated-types-eq-obj.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test equality constraints on associated types inside of an object type diff --git a/src/test/run-pass/associated-types/associated-types-from-supertrait.rs b/src/test/run-pass/associated-types/associated-types-from-supertrait.rs index e69c0af2be7..c040790188d 100644 --- a/src/test/run-pass/associated-types/associated-types-from-supertrait.rs +++ b/src/test/run-pass/associated-types/associated-types-from-supertrait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo: Iterator {} trait Bar: Foo {} diff --git a/src/test/run-pass/associated-types/associated-types-impl-redirect.rs b/src/test/run-pass/associated-types/associated-types-impl-redirect.rs index fd2fade2f88..8fa20cdf4b7 100644 --- a/src/test/run-pass/associated-types/associated-types-impl-redirect.rs +++ b/src/test/run-pass/associated-types/associated-types-impl-redirect.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_mut)] diff --git a/src/test/run-pass/associated-types/associated-types-in-bound-type-arg.rs b/src/test/run-pass/associated-types/associated-types-in-bound-type-arg.rs index a80350a596e..88bb5fe0afe 100644 --- a/src/test/run-pass/associated-types/associated-types-in-bound-type-arg.rs +++ b/src/test/run-pass/associated-types/associated-types-in-bound-type-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test the case where we resolve `C::Result` and the trait bound // itself includes a `Self::Item` shorthand. diff --git a/src/test/run-pass/associated-types/associated-types-in-default-method.rs b/src/test/run-pass/associated-types/associated-types-in-default-method.rs index 846dfcd2141..80ffbf585fb 100644 --- a/src/test/run-pass/associated-types/associated-types-in-default-method.rs +++ b/src/test/run-pass/associated-types/associated-types-in-default-method.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Get { diff --git a/src/test/run-pass/associated-types/associated-types-in-fn.rs b/src/test/run-pass/associated-types/associated-types-in-fn.rs index 555c74dd70a..9c588a528fe 100644 --- a/src/test/run-pass/associated-types/associated-types-in-fn.rs +++ b/src/test/run-pass/associated-types/associated-types-in-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Get { diff --git a/src/test/run-pass/associated-types/associated-types-in-impl-generics.rs b/src/test/run-pass/associated-types/associated-types-in-impl-generics.rs index d27c1dd296e..0ddd99cbfa8 100644 --- a/src/test/run-pass/associated-types/associated-types-in-impl-generics.rs +++ b/src/test/run-pass/associated-types/associated-types-in-impl-generics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Get { diff --git a/src/test/run-pass/associated-types/associated-types-in-inherent-method.rs b/src/test/run-pass/associated-types/associated-types-in-inherent-method.rs index f68ab8cd610..1f29e966851 100644 --- a/src/test/run-pass/associated-types/associated-types-in-inherent-method.rs +++ b/src/test/run-pass/associated-types/associated-types-in-inherent-method.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Get { diff --git a/src/test/run-pass/associated-types/associated-types-issue-20220.rs b/src/test/run-pass/associated-types/associated-types-issue-20220.rs index e2a87382fba..19fa7a6085a 100644 --- a/src/test/run-pass/associated-types/associated-types-issue-20220.rs +++ b/src/test/run-pass/associated-types/associated-types-issue-20220.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test references to `Self::Item` in the trait. Issue #20220. diff --git a/src/test/run-pass/associated-types/associated-types-issue-20371.rs b/src/test/run-pass/associated-types/associated-types-issue-20371.rs index 54f1d2e8126..ae8a8767d27 100644 --- a/src/test/run-pass/associated-types/associated-types-issue-20371.rs +++ b/src/test/run-pass/associated-types/associated-types-issue-20371.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to have an impl that defines an associated type // before the actual trait. diff --git a/src/test/run-pass/associated-types/associated-types-issue-21212.rs b/src/test/run-pass/associated-types/associated-types-issue-21212.rs index c5baec7be00..ce27eac4d0e 100644 --- a/src/test/run-pass/associated-types/associated-types-issue-21212.rs +++ b/src/test/run-pass/associated-types/associated-types-issue-21212.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Regression test for #21212: an overflow occurred during trait diff --git a/src/test/run-pass/associated-types/associated-types-iterator-binding.rs b/src/test/run-pass/associated-types/associated-types-iterator-binding.rs index eab66a94129..7c5528c986e 100644 --- a/src/test/run-pass/associated-types/associated-types-iterator-binding.rs +++ b/src/test/run-pass/associated-types/associated-types-iterator-binding.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn pairwise_sub>(mut t: T) -> isize { diff --git a/src/test/run-pass/associated-types/associated-types-method.rs b/src/test/run-pass/associated-types/associated-types-method.rs index 73d075313ad..64132cfeed7 100644 --- a/src/test/run-pass/associated-types/associated-types-method.rs +++ b/src/test/run-pass/associated-types/associated-types-method.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that methods whose impl-trait-ref contains associated types // are supported. diff --git a/src/test/run-pass/associated-types/associated-types-nested-projections.rs b/src/test/run-pass/associated-types/associated-types-nested-projections.rs index af6f3da195e..76ba7496250 100644 --- a/src/test/run-pass/associated-types/associated-types-nested-projections.rs +++ b/src/test/run-pass/associated-types/associated-types-nested-projections.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Test that we can resolve nested projection types. Issue #20666. diff --git a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs index 4dd810d1056..7c54efb83c2 100644 --- a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs +++ b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Test that we normalize associated types that appear in a bound that diff --git a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs index d534051267d..e09aa3663c6 100644 --- a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs +++ b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Test that we normalize associated types that appear in bounds; if diff --git a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs index 6651a0b53ac..dcfae0f37e1 100644 --- a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs +++ b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Test that we normalize associated types that appear in bounds; if diff --git a/src/test/run-pass/associated-types/associated-types-normalize-unifield-struct.rs b/src/test/run-pass/associated-types/associated-types-normalize-unifield-struct.rs index 03d712b110d..a04525dcd46 100644 --- a/src/test/run-pass/associated-types/associated-types-normalize-unifield-struct.rs +++ b/src/test/run-pass/associated-types/associated-types-normalize-unifield-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for issue #21010: Normalize associated types in // various special paths in the `type_is_immediate` function. diff --git a/src/test/run-pass/associated-types/associated-types-project-from-type-param-via-bound-in-where.rs b/src/test/run-pass/associated-types/associated-types-project-from-type-param-via-bound-in-where.rs index f21bbddc4dd..fc1dba97dfd 100644 --- a/src/test/run-pass/associated-types/associated-types-project-from-type-param-via-bound-in-where.rs +++ b/src/test/run-pass/associated-types/associated-types-project-from-type-param-via-bound-in-where.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Various uses of `T::Item` syntax where the bound that supplies // `Item` originates in a where-clause, not the declaration of diff --git a/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs b/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs index 2f27cb1cd9e..107e6b4ce0c 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Test that we correctly handle projection bounds appearing in the diff --git a/src/test/run-pass/associated-types/associated-types-projection-from-known-type-in-impl.rs b/src/test/run-pass/associated-types/associated-types-projection-from-known-type-in-impl.rs index 964eb886236..a59c327be21 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-from-known-type-in-impl.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-from-known-type-in-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test where the impl self type uses a projection from a constant type. diff --git a/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs b/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs index c0844e9076e..0dc32f2fd94 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/test/run-pass/associated-types/associated-types-projection-in-supertrait.rs b/src/test/run-pass/associated-types/associated-types-projection-in-supertrait.rs index 23c9fb89f39..ead405fcf01 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-in-supertrait.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-in-supertrait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that we are handle to correctly handle a projection type diff --git a/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs b/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs index 238f98086ce..e9a26e53c3c 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/associated-types/associated-types-projection-to-unrelated-trait.rs b/src/test/run-pass/associated-types/associated-types-projection-to-unrelated-trait.rs index f6951b48ae7..5f06a829600 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-to-unrelated-trait.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-to-unrelated-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that we do not get an error when you use `::Value` in // the trait definition if there is no default method and for every impl, diff --git a/src/test/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs b/src/test/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs index b3d5c353989..3c830d37060 100644 --- a/src/test/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs +++ b/src/test/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/associated-types/associated-types-ref-from-struct.rs b/src/test/run-pass/associated-types/associated-types-ref-from-struct.rs index e45766adc2c..3ccba289e4b 100644 --- a/src/test/run-pass/associated-types/associated-types-ref-from-struct.rs +++ b/src/test/run-pass/associated-types/associated-types-ref-from-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test associated type references in structure fields. diff --git a/src/test/run-pass/associated-types/associated-types-ref-in-struct-literal.rs b/src/test/run-pass/associated-types/associated-types-ref-in-struct-literal.rs index 02e1d74db47..4a490ed0387 100644 --- a/src/test/run-pass/associated-types/associated-types-ref-in-struct-literal.rs +++ b/src/test/run-pass/associated-types/associated-types-ref-in-struct-literal.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test associated type references in a struct literal. Issue #20535. diff --git a/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs b/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs index 40864835d2e..b722506dbbf 100644 --- a/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs +++ b/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Regression test for #20582. This test caused an ICE related to diff --git a/src/test/run-pass/associated-types/associated-types-resolve-lifetime.rs b/src/test/run-pass/associated-types/associated-types-resolve-lifetime.rs index b77f3fcd295..52f2324d72a 100644 --- a/src/test/run-pass/associated-types/associated-types-resolve-lifetime.rs +++ b/src/test/run-pass/associated-types/associated-types-resolve-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/associated-types/associated-types-return.rs b/src/test/run-pass/associated-types/associated-types-return.rs index 18b05987715..997a48b0379 100644 --- a/src/test/run-pass/associated-types/associated-types-return.rs +++ b/src/test/run-pass/associated-types/associated-types-return.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test equality constraints on associated types in a where clause. diff --git a/src/test/run-pass/associated-types/associated-types-simple.rs b/src/test/run-pass/associated-types/associated-types-simple.rs index 8e9b2367fcd..2e2dfd80726 100644 --- a/src/test/run-pass/associated-types/associated-types-simple.rs +++ b/src/test/run-pass/associated-types/associated-types-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Get { diff --git a/src/test/run-pass/associated-types/associated-types-stream.rs b/src/test/run-pass/associated-types/associated-types-stream.rs index c486e346351..96954528aaa 100644 --- a/src/test/run-pass/associated-types/associated-types-stream.rs +++ b/src/test/run-pass/associated-types/associated-types-stream.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test references to the trait `Stream` in the bounds for associated // types defined on `Stream`. Issue #20551. diff --git a/src/test/run-pass/associated-types/associated-types-struct-field-named.rs b/src/test/run-pass/associated-types/associated-types-struct-field-named.rs index 384ec8ef44f..c400bf943e1 100644 --- a/src/test/run-pass/associated-types/associated-types-struct-field-named.rs +++ b/src/test/run-pass/associated-types/associated-types-struct-field-named.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we correctly normalize the type of a struct field // which has an associated type. diff --git a/src/test/run-pass/associated-types/associated-types-struct-field-numbered.rs b/src/test/run-pass/associated-types/associated-types-struct-field-numbered.rs index 54d0c8839a3..fa59060629d 100644 --- a/src/test/run-pass/associated-types/associated-types-struct-field-numbered.rs +++ b/src/test/run-pass/associated-types/associated-types-struct-field-numbered.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we correctly normalize the type of a struct field // which has an associated type. diff --git a/src/test/run-pass/associated-types/associated-types-sugar-path.rs b/src/test/run-pass/associated-types/associated-types-sugar-path.rs index c3c76eb1313..66f7672aa43 100644 --- a/src/test/run-pass/associated-types/associated-types-sugar-path.rs +++ b/src/test/run-pass/associated-types/associated-types-sugar-path.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs b/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs index 5c03a6bbc02..f2a4c6e42a9 100644 --- a/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs +++ b/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/test/run-pass/associated-types/auxiliary/associated-types-cc-lib.rs b/src/test/run-pass/associated-types/auxiliary/associated-types-cc-lib.rs index 175e8730cbc..b6785358706 100644 --- a/src/test/run-pass/associated-types/auxiliary/associated-types-cc-lib.rs +++ b/src/test/run-pass/associated-types/auxiliary/associated-types-cc-lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Helper for test issue-18048, which tests associated types in a // cross-crate scenario. diff --git a/src/test/run-pass/async-await.rs b/src/test/run-pass/async-await.rs index 59da7580354..552f3821573 100644 --- a/src/test/run-pass/async-await.rs +++ b/src/test/run-pass/async-await.rs @@ -1,16 +1,6 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 -#![feature(arbitrary_self_types, async_await, await_macro, futures_api, pin)] +#![feature(arbitrary_self_types, async_await, await_macro, futures_api)] use std::pin::Pin; use std::future::Future; @@ -138,7 +128,7 @@ where F: FnOnce(u8) -> Fut, Fut: Future, { - let mut fut = Box::pinned(f(9)); + let mut fut = Box::pin(f(9)); let counter = Arc::new(Counter { wakes: AtomicUsize::new(0) }); let waker = local_waker_from_nonlocal(counter.clone()); assert_eq!(0, counter.wakes.load(atomic::Ordering::SeqCst)); diff --git a/src/test/run-pass/atomic-access-bool.rs b/src/test/run-pass/atomic-access-bool.rs index 1d8923af479..8522493232f 100644 --- a/src/test/run-pass/atomic-access-bool.rs +++ b/src/test/run-pass/atomic-access-bool.rs @@ -1,19 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] #![feature(atomic_access)] -use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT}; +use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering::*; -static mut ATOMIC: AtomicBool = ATOMIC_BOOL_INIT; +static mut ATOMIC: AtomicBool = AtomicBool::new(false); fn main() { unsafe { diff --git a/src/test/run-pass/atomic-alignment.rs b/src/test/run-pass/atomic-alignment.rs index 8771765de29..ec1dbf42e4a 100644 --- a/src/test/run-pass/atomic-alignment.rs +++ b/src/test/run-pass/atomic-alignment.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(cfg_target_has_atomic)] #![feature(integer_atomics)] diff --git a/src/test/run-pass/atomic-compare_exchange.rs b/src/test/run-pass/atomic-compare_exchange.rs index 5829f764eba..77da820e07c 100644 --- a/src/test/run-pass/atomic-compare_exchange.rs +++ b/src/test/run-pass/atomic-compare_exchange.rs @@ -1,20 +1,10 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] #![feature(extended_compare_and_swap)] -use std::sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT}; +use std::sync::atomic::AtomicIsize; use std::sync::atomic::Ordering::*; -static ATOMIC: AtomicIsize = ATOMIC_ISIZE_INIT; +static ATOMIC: AtomicIsize = AtomicIsize::new(0); fn main() { // Make sure codegen can emit all the intrinsics correctly diff --git a/src/test/run-pass/atomic-print.rs b/src/test/run-pass/atomic-print.rs index 25f4c6fd10b..566aeeb2c39 100644 --- a/src/test/run-pass/atomic-print.rs +++ b/src/test/run-pass/atomic-print.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] #![allow(deprecated)] // ignore-cloudabi no process support diff --git a/src/test/run-pass/attr-before-view-item.rs b/src/test/run-pass/attr-before-view-item.rs index 4ea78d352e3..14b4189684f 100644 --- a/src/test/run-pass/attr-before-view-item.rs +++ b/src/test/run-pass/attr-before-view-item.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_attributes)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/attr-before-view-item2.rs b/src/test/run-pass/attr-before-view-item2.rs index 34a8b62f9fc..6fc1e35d47a 100644 --- a/src/test/run-pass/attr-before-view-item2.rs +++ b/src/test/run-pass/attr-before-view-item2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_attributes)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/attr-main-2.rs b/src/test/run-pass/attr-main-2.rs index b3c9ea541b7..e0bf6ecc8f1 100644 --- a/src/test/run-pass/attr-main-2.rs +++ b/src/test/run-pass/attr-main-2.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(main)] pub fn main() { diff --git a/src/test/run-pass/attr-main.rs b/src/test/run-pass/attr-main.rs index e8a12ee3ac7..645baf32e04 100644 --- a/src/test/run-pass/attr-main.rs +++ b/src/test/run-pass/attr-main.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 #![feature(main)] diff --git a/src/test/run-pass/attr-mix-new.rs b/src/test/run-pass/attr-mix-new.rs index 5b89cec70c0..223a434dbb9 100644 --- a/src/test/run-pass/attr-mix-new.rs +++ b/src/test/run-pass/attr-mix-new.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_attributes)] #![allow(unknown_lints)] diff --git a/src/test/run-pass/attr-on-generic-formals.rs b/src/test/run-pass/attr-on-generic-formals.rs index 827da72bc44..9ebf0fcb1c1 100644 --- a/src/test/run-pass/attr-on-generic-formals.rs +++ b/src/test/run-pass/attr-on-generic-formals.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_attributes)] // This test ensures we can attach attributes to the formals in all diff --git a/src/test/run-pass/attr-start.rs b/src/test/run-pass/attr-start.rs index bfafe04d600..29f86c9b59e 100644 --- a/src/test/run-pass/attr-start.rs +++ b/src/test/run-pass/attr-start.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 #![feature(start)] diff --git a/src/test/run-pass/attr.rs b/src/test/run-pass/attr.rs index 57e1b38c9c1..645baf32e04 100644 --- a/src/test/run-pass/attr.rs +++ b/src/test/run-pass/attr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 #![feature(main)] diff --git a/src/test/run-pass/augmented-assignments-feature-gate-cross.rs b/src/test/run-pass/augmented-assignments-feature-gate-cross.rs index b68e011af15..566d4522808 100644 --- a/src/test/run-pass/augmented-assignments-feature-gate-cross.rs +++ b/src/test/run-pass/augmented-assignments-feature-gate-cross.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:augmented_assignments.rs extern crate augmented_assignments; diff --git a/src/test/run-pass/augmented-assignments-feature-gate.rs b/src/test/run-pass/augmented-assignments-feature-gate.rs index f7e20ee9445..7809ac8ea96 100644 --- a/src/test/run-pass/augmented-assignments-feature-gate.rs +++ b/src/test/run-pass/augmented-assignments-feature-gate.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::AddAssign; struct Int(i32); diff --git a/src/test/run-pass/augmented-assignments.rs b/src/test/run-pass/augmented-assignments.rs index b8bfad8cfcb..c26d0ffce44 100644 --- a/src/test/run-pass/augmented-assignments.rs +++ b/src/test/run-pass/augmented-assignments.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] #![deny(unused_assignments)] diff --git a/src/test/run-pass/auto-instantiate.rs b/src/test/run-pass/auto-instantiate.rs index 0fe347fc43c..ac21409e92c 100644 --- a/src/test/run-pass/auto-instantiate.rs +++ b/src/test/run-pass/auto-instantiate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #[derive(Debug)] struct Pair { a: T, b: U } diff --git a/src/test/run-pass/auto-is-contextual.rs b/src/test/run-pass/auto-is-contextual.rs index efddcaa14d3..3405cc712d7 100644 --- a/src/test/run-pass/auto-is-contextual.rs +++ b/src/test/run-pass/auto-is-contextual.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(path_statements)] #![allow(dead_code)] macro_rules! auto { diff --git a/src/test/run-pass/autobind.rs b/src/test/run-pass/autobind.rs index ed0b9eca0e0..bb38b7afdf6 100644 --- a/src/test/run-pass/autobind.rs +++ b/src/test/run-pass/autobind.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - fn f(x: Vec) -> T { return x.into_iter().next().unwrap(); } fn g(act: F) -> isize where F: FnOnce(Vec) -> isize { return act(vec![1, 2, 3]); } diff --git a/src/test/run-pass/autoref-autoderef/auto-ref-bounded-ty-param.rs b/src/test/run-pass/autoref-autoderef/auto-ref-bounded-ty-param.rs index d984531b8bb..2482e1878f5 100644 --- a/src/test/run-pass/autoref-autoderef/auto-ref-bounded-ty-param.rs +++ b/src/test/run-pass/autoref-autoderef/auto-ref-bounded-ty-param.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { fn f(&self); diff --git a/src/test/run-pass/autoref-autoderef/auto-ref-sliceable.rs b/src/test/run-pass/autoref-autoderef/auto-ref-sliceable.rs index 6e665b07656..e5f79d78051 100644 --- a/src/test/run-pass/autoref-autoderef/auto-ref-sliceable.rs +++ b/src/test/run-pass/autoref-autoderef/auto-ref-sliceable.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/autoref-autoderef/auto-ref.rs b/src/test/run-pass/autoref-autoderef/auto-ref.rs index afc79cce35e..b77f9c34213 100644 --- a/src/test/run-pass/autoref-autoderef/auto-ref.rs +++ b/src/test/run-pass/autoref-autoderef/auto-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo { x: isize, diff --git a/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs b/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs index 8ab2bf2f9b8..874f4228277 100644 --- a/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs +++ b/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/autoref-autoderef/autoderef-method-on-trait.rs b/src/test/run-pass/autoref-autoderef/autoderef-method-on-trait.rs index 8116a311eb4..0a54db7f5cd 100644 --- a/src/test/run-pass/autoref-autoderef/autoderef-method-on-trait.rs +++ b/src/test/run-pass/autoref-autoderef/autoderef-method-on-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/autoref-autoderef/autoderef-method-priority.rs b/src/test/run-pass/autoref-autoderef/autoderef-method-priority.rs index 2b148395003..a218f85eba2 100644 --- a/src/test/run-pass/autoref-autoderef/autoderef-method-priority.rs +++ b/src/test/run-pass/autoref-autoderef/autoderef-method-priority.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs b/src/test/run-pass/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs index 14c57b07519..9fda3b2c099 100644 --- a/src/test/run-pass/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs +++ b/src/test/run-pass/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/autoref-autoderef/autoderef-method-twice.rs b/src/test/run-pass/autoref-autoderef/autoderef-method-twice.rs index 5185d0ee749..f53dc8d1032 100644 --- a/src/test/run-pass/autoref-autoderef/autoderef-method-twice.rs +++ b/src/test/run-pass/autoref-autoderef/autoderef-method-twice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/autoref-autoderef/autoderef-method.rs b/src/test/run-pass/autoref-autoderef/autoderef-method.rs index 398ccde8894..262050fa47b 100644 --- a/src/test/run-pass/autoref-autoderef/autoderef-method.rs +++ b/src/test/run-pass/autoref-autoderef/autoderef-method.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/autoref-autoderef/autoderef-privacy.rs b/src/test/run-pass/autoref-autoderef/autoderef-privacy.rs index cfbc7744a4c..841be930b77 100644 --- a/src/test/run-pass/autoref-autoderef/autoderef-privacy.rs +++ b/src/test/run-pass/autoref-autoderef/autoderef-privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check we do not select a private method or field when computing autoderefs diff --git a/src/test/run-pass/autoref-autoderef/autoref-intermediate-types-issue-3585.rs b/src/test/run-pass/autoref-autoderef/autoref-intermediate-types-issue-3585.rs index e32738e8f15..70ef7ce87ed 100644 --- a/src/test/run-pass/autoref-autoderef/autoref-intermediate-types-issue-3585.rs +++ b/src/test/run-pass/autoref-autoderef/autoref-intermediate-types-issue-3585.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/auxiliary/allocator-dummy.rs b/src/test/run-pass/auxiliary/allocator-dummy.rs index f4a32a93dfb..bedf3020c8b 100644 --- a/src/test/run-pass/auxiliary/allocator-dummy.rs +++ b/src/test/run-pass/auxiliary/allocator-dummy.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![feature(allocator, core_intrinsics, panic_unwind)] diff --git a/src/test/run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs index 741ce351da3..948b5e688eb 100644 --- a/src/test/run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs +++ b/src/test/run-pass/auxiliary/anon-extern-mod-cross-crate-1.rs @@ -1,15 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="anonexternmod"] -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/auxiliary/augmented_assignments.rs b/src/test/run-pass/auxiliary/augmented_assignments.rs index 6601e7240a7..d0d3f57459a 100644 --- a/src/test/run-pass/auxiliary/augmented_assignments.rs +++ b/src/test/run-pass/auxiliary/augmented_assignments.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::AddAssign; pub struct Int(pub i32); diff --git a/src/test/run-pass/auxiliary/blind-item-mixed-crate-use-item-foo.rs b/src/test/run-pass/auxiliary/blind-item-mixed-crate-use-item-foo.rs index f129b4b77bb..cf769f31bf7 100644 --- a/src/test/run-pass/auxiliary/blind-item-mixed-crate-use-item-foo.rs +++ b/src/test/run-pass/auxiliary/blind-item-mixed-crate-use-item-foo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub const X: () = (); diff --git a/src/test/run-pass/auxiliary/blind-item-mixed-crate-use-item-foo2.rs b/src/test/run-pass/auxiliary/blind-item-mixed-crate-use-item-foo2.rs index 91fa9124551..81c16ede909 100644 --- a/src/test/run-pass/auxiliary/blind-item-mixed-crate-use-item-foo2.rs +++ b/src/test/run-pass/auxiliary/blind-item-mixed-crate-use-item-foo2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub const Y: () = (); diff --git a/src/test/run-pass/auxiliary/check_static_recursion_foreign_helper.rs b/src/test/run-pass/auxiliary/check_static_recursion_foreign_helper.rs index cd36a8eedb4..5330b7a92a3 100644 --- a/src/test/run-pass/auxiliary/check_static_recursion_foreign_helper.rs +++ b/src/test/run-pass/auxiliary/check_static_recursion_foreign_helper.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Helper definition for test/run-pass/check-static-recursion-foreign.rs. -#![feature(libc)] +#![feature(rustc_private)] #![crate_name = "check_static_recursion_foreign_helper"] #![crate_type = "lib"] diff --git a/src/test/run-pass/auxiliary/cond_plugin.rs b/src/test/run-pass/auxiliary/cond_plugin.rs new file mode 100644 index 00000000000..1f97b556a07 --- /dev/null +++ b/src/test/run-pass/auxiliary/cond_plugin.rs @@ -0,0 +1,38 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(proc_macro_hygiene)] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro] +pub fn cond(input: TokenStream) -> TokenStream { + let mut conds = Vec::new(); + let mut input = input.into_iter().peekable(); + while let Some(tree) = input.next() { + let cond = match tree { + TokenTree::Group(tt) => tt.stream(), + _ => panic!("Invalid input"), + }; + let mut cond_trees = cond.clone().into_iter(); + let test = cond_trees.next().expect("Unexpected empty condition in `cond!`"); + let rhs = cond_trees.collect::(); + if rhs.is_empty() { + panic!("Invalid macro usage in cond: {}", cond); + } + let is_else = match test { + TokenTree::Ident(ref word) => &*word.to_string() == "else", + _ => false, + }; + conds.push(if is_else || input.peek().is_none() { + quote!({ $rhs }) + } else { + quote!(if $test { $rhs } else) + }); + } + + conds.into_iter().flat_map(|x| x.into_iter()).collect() +} diff --git a/src/test/run-pass/auxiliary/crate-method-reexport-grrrrrrr2.rs b/src/test/run-pass/auxiliary/crate-method-reexport-grrrrrrr2.rs index f3d5bf2d65e..d08504005a5 100644 --- a/src/test/run-pass/auxiliary/crate-method-reexport-grrrrrrr2.rs +++ b/src/test/run-pass/auxiliary/crate-method-reexport-grrrrrrr2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="crate_method_reexport_grrrrrrr2"] pub use name_pool::add; diff --git a/src/test/run-pass/auxiliary/debuginfo-lto-aux.rs b/src/test/run-pass/auxiliary/debuginfo-lto-aux.rs index 88e54d30172..dd471154b4f 100644 --- a/src/test/run-pass/auxiliary/debuginfo-lto-aux.rs +++ b/src/test/run-pass/auxiliary/debuginfo-lto-aux.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -g --crate-type=rlib pub struct StructWithLifetime<'a>(&'a i32); diff --git a/src/test/run-pass/auxiliary/edition-kw-macro-2015.rs b/src/test/run-pass/auxiliary/edition-kw-macro-2015.rs index f8ed2c7f432..553ba69303a 100644 --- a/src/test/run-pass/auxiliary/edition-kw-macro-2015.rs +++ b/src/test/run-pass/auxiliary/edition-kw-macro-2015.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2015 #[macro_export] diff --git a/src/test/run-pass/auxiliary/edition-kw-macro-2018.rs b/src/test/run-pass/auxiliary/edition-kw-macro-2018.rs index 36562fd0049..f1f4ee28093 100644 --- a/src/test/run-pass/auxiliary/edition-kw-macro-2018.rs +++ b/src/test/run-pass/auxiliary/edition-kw-macro-2018.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 #[macro_export] diff --git a/src/test/run-pass/auxiliary/foreign_lib.rs b/src/test/run-pass/auxiliary/foreign_lib.rs index cef36274c62..de6b0e2118a 100644 --- a/src/test/run-pass/auxiliary/foreign_lib.rs +++ b/src/test/run-pass/auxiliary/foreign_lib.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="foreign_lib"] -#![feature(libc)] +#![feature(rustc_private)] pub mod rustrt { extern crate libc; diff --git a/src/test/run-pass/auxiliary/hello_macro.rs b/src/test/run-pass/auxiliary/hello_macro.rs new file mode 100644 index 00000000000..f2e9e0eaa8c --- /dev/null +++ b/src/test/run-pass/auxiliary/hello_macro.rs @@ -0,0 +1,21 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(proc_macro_hygiene, proc_macro_quote)] + +extern crate proc_macro; + +use proc_macro::{TokenStream, quote}; + +// This macro is not very interesting, but it does contain delimited tokens with +// no content - `()` and `{}` - which has caused problems in the past. +// Also, it tests that we can escape `$` via `$$`. +#[proc_macro] +pub fn hello(_: TokenStream) -> TokenStream { + quote!({ + fn hello() {} + macro_rules! m { ($$($$t:tt)*) => { $$($$t)* } } + m!(hello()); + }) +} diff --git a/src/test/run-pass/auxiliary/impl_privacy_xc_1.rs b/src/test/run-pass/auxiliary/impl_privacy_xc_1.rs index ad3cdedf7ea..367b8ec8b88 100644 --- a/src/test/run-pass/auxiliary/impl_privacy_xc_1.rs +++ b/src/test/run-pass/auxiliary/impl_privacy_xc_1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub struct Fish { diff --git a/src/test/run-pass/auxiliary/impl_privacy_xc_2.rs b/src/test/run-pass/auxiliary/impl_privacy_xc_2.rs index c3212b0fc6d..5f9c2268167 100644 --- a/src/test/run-pass/auxiliary/impl_privacy_xc_2.rs +++ b/src/test/run-pass/auxiliary/impl_privacy_xc_2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub struct Fish { diff --git a/src/test/run-pass/auxiliary/inline_dtor.rs b/src/test/run-pass/auxiliary/inline_dtor.rs index dd1fdc2e498..5eee89fdc57 100644 --- a/src/test/run-pass/auxiliary/inline_dtor.rs +++ b/src/test/run-pass/auxiliary/inline_dtor.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="inline_dtor"] pub struct Foo; diff --git a/src/test/run-pass/auxiliary/inner_static.rs b/src/test/run-pass/auxiliary/inner_static.rs index 0d15c13a4ef..42dcd379d41 100644 --- a/src/test/run-pass/auxiliary/inner_static.rs +++ b/src/test/run-pass/auxiliary/inner_static.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct A { pub v: T } pub struct B { pub v: T } diff --git a/src/test/run-pass/auxiliary/issue-31702-1.rs b/src/test/run-pass/auxiliary/issue-31702-1.rs deleted file mode 100644 index 50a31630df3..00000000000 --- a/src/test/run-pass/auxiliary/issue-31702-1.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[derive(Copy)] -pub struct U256(pub [u64; 4]); - -impl Clone for U256 { - fn clone(&self) -> U256 { - *self - } -} - -impl U256 { - pub fn new(value: u64) -> U256 { - let mut ret = [0; 4]; - ret[0] = value; - U256(ret) - } -} diff --git a/src/test/run-pass/auxiliary/issue-31702-2.rs b/src/test/run-pass/auxiliary/issue-31702-2.rs deleted file mode 100644 index c5b1bc6dfb0..00000000000 --- a/src/test/run-pass/auxiliary/issue-31702-2.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -g - -extern crate issue_31702_1; - -use std::collections::HashMap; -use issue_31702_1::U256; - -pub struct Ethash { - engine_params: for<'a> fn() -> Option<&'a Vec>, - u256_params: HashMap, -} - -impl Ethash { - pub fn u256_param(&mut self, name: &str) -> U256 { - let engine = self.engine_params; - *self.u256_params.entry(name.to_owned()).or_insert_with(|| { - engine().map_or(U256::new(0u64), |_a| loop {}) - }) - } -} diff --git a/src/test/run-pass/auxiliary/kinds_in_metadata.rs b/src/test/run-pass/auxiliary/kinds_in_metadata.rs index 82f182c04bd..2a2106ff70a 100644 --- a/src/test/run-pass/auxiliary/kinds_in_metadata.rs +++ b/src/test/run-pass/auxiliary/kinds_in_metadata.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ diff --git a/src/test/run-pass/auxiliary/link-cfg-works-transitive-dylib.rs b/src/test/run-pass/auxiliary/link-cfg-works-transitive-dylib.rs index d41fd490f58..fa4f33bcef6 100644 --- a/src/test/run-pass/auxiliary/link-cfg-works-transitive-dylib.rs +++ b/src/test/run-pass/auxiliary/link-cfg-works-transitive-dylib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(link_cfg)] #[link(name = "foo", cfg(foo))] diff --git a/src/test/run-pass/auxiliary/link-cfg-works-transitive-rlib.rs b/src/test/run-pass/auxiliary/link-cfg-works-transitive-rlib.rs index 9f096c351fb..b365ed91732 100644 --- a/src/test/run-pass/auxiliary/link-cfg-works-transitive-rlib.rs +++ b/src/test/run-pass/auxiliary/link-cfg-works-transitive-rlib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![feature(link_cfg)] diff --git a/src/test/run-pass/auxiliary/linkage1.rs b/src/test/run-pass/auxiliary/linkage1.rs index ca4046d8163..e87ce5e4d31 100644 --- a/src/test/run-pass/auxiliary/linkage1.rs +++ b/src/test/run-pass/auxiliary/linkage1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub static foo: isize = 3; diff --git a/src/test/run-pass/auxiliary/llvm_pr32379.rs b/src/test/run-pass/auxiliary/llvm_pr32379.rs index a7b15bda336..8e429767095 100644 --- a/src/test/run-pass/auxiliary/llvm_pr32379.rs +++ b/src/test/run-pass/auxiliary/llvm_pr32379.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn pr32379(mut data: u64, f1: bool, f2: bool) -> u64 { if f1 { data &= !2; } if f2 { data |= 2; } diff --git a/src/test/run-pass/auxiliary/msvc-data-only-lib.rs b/src/test/run-pass/auxiliary/msvc-data-only-lib.rs index 71fb9a51948..ccaa6d8edcf 100644 --- a/src/test/run-pass/auxiliary/msvc-data-only-lib.rs +++ b/src/test/run-pass/auxiliary/msvc-data-only-lib.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass/auxiliary/nested_item.rs b/src/test/run-pass/auxiliary/nested_item.rs index 63639c4cdb3..9db9d19d6f6 100644 --- a/src/test/run-pass/auxiliary/nested_item.rs +++ b/src/test/run-pass/auxiliary/nested_item.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // original problem pub fn foo() -> isize { { diff --git a/src/test/run-pass/auxiliary/proc_macro_def.rs b/src/test/run-pass/auxiliary/proc_macro_def.rs new file mode 100644 index 00000000000..dfc5a42d19c --- /dev/null +++ b/src/test/run-pass/auxiliary/proc_macro_def.rs @@ -0,0 +1,35 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(proc_macro_hygiene)] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro_attribute] +pub fn attr_tru(_attr: TokenStream, item: TokenStream) -> TokenStream { + let name = item.into_iter().nth(1).unwrap(); + quote!(fn $name() -> bool { true }) +} + +#[proc_macro_attribute] +pub fn attr_identity(_attr: TokenStream, item: TokenStream) -> TokenStream { + quote!($item) +} + +#[proc_macro] +pub fn tru(_ts: TokenStream) -> TokenStream { + quote!(true) +} + +#[proc_macro] +pub fn ret_tru(_ts: TokenStream) -> TokenStream { + quote!(return true;) +} + +#[proc_macro] +pub fn identity(ts: TokenStream) -> TokenStream { + quote!($ts) +} diff --git a/src/test/run-pass/auxiliary/reachable-unnameable-items.rs b/src/test/run-pass/auxiliary/reachable-unnameable-items.rs index 7ec2bb9394c..20f110b1a8c 100644 --- a/src/test/run-pass/auxiliary/reachable-unnameable-items.rs +++ b/src/test/run-pass/auxiliary/reachable-unnameable-items.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use inner_private_module::*; mod inner_private_module { diff --git a/src/test/run-pass/auxiliary/reexport-should-still-link.rs b/src/test/run-pass/auxiliary/reexport-should-still-link.rs index 9d5464e6526..237ea8dfcf3 100644 --- a/src/test/run-pass/auxiliary/reexport-should-still-link.rs +++ b/src/test/run-pass/auxiliary/reexport-should-still-link.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use foo::bar; mod foo { diff --git a/src/test/run-pass/auxiliary/rmeta_rlib.rs b/src/test/run-pass/auxiliary/rmeta_rlib.rs index 28c11315fa1..f5e8c3d2a5c 100644 --- a/src/test/run-pass/auxiliary/rmeta_rlib.rs +++ b/src/test/run-pass/auxiliary/rmeta_rlib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type="rlib"] diff --git a/src/test/run-pass/auxiliary/rmeta_rmeta.rs b/src/test/run-pass/auxiliary/rmeta_rmeta.rs index c3cfe89ee5c..4a6d055a81f 100644 --- a/src/test/run-pass/auxiliary/rmeta_rmeta.rs +++ b/src/test/run-pass/auxiliary/rmeta_rmeta.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // compile-flags: --emit=metadata diff --git a/src/test/run-pass/auxiliary/svh-a-base.rs b/src/test/run-pass/auxiliary/svh-a-base.rs index 31a97f695f0..36b41fc818f 100644 --- a/src/test/run-pass/auxiliary/svh-a-base.rs +++ b/src/test/run-pass/auxiliary/svh-a-base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The `svh-a-*.rs` files are all deviations from the base file //! svh-a-base.rs with some difference (usually in `fn foo`) that //! should not affect the strict version hash (SVH) computation diff --git a/src/test/run-pass/auxiliary/svh-b.rs b/src/test/run-pass/auxiliary/svh-b.rs index b8946fdc995..03869aeb371 100644 --- a/src/test/run-pass/auxiliary/svh-b.rs +++ b/src/test/run-pass/auxiliary/svh-b.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This is a client of the `a` crate defined in "svn-a-base.rs". The //! rpass and cfail tests (such as "run-pass/svh-add-comment.rs") use //! it by swapping in a different object code library crate built from diff --git a/src/test/run-pass/auxiliary/trait_superkinds_in_metadata.rs b/src/test/run-pass/auxiliary/trait_superkinds_in_metadata.rs index 0fa2d3459f4..acfd1e13e93 100644 --- a/src/test/run-pass/auxiliary/trait_superkinds_in_metadata.rs +++ b/src/test/run-pass/auxiliary/trait_superkinds_in_metadata.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test library crate for cross-crate usages of traits inheriting // from the builtin kinds. Mostly tests metadata correctness. diff --git a/src/test/run-pass/auxiliary/typeid-intrinsic-aux1.rs b/src/test/run-pass/auxiliary/typeid-intrinsic-aux1.rs index 0d0f1b3a482..281c079682f 100644 --- a/src/test/run-pass/auxiliary/typeid-intrinsic-aux1.rs +++ b/src/test/run-pass/auxiliary/typeid-intrinsic-aux1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::any::{Any, TypeId}; pub struct A; diff --git a/src/test/run-pass/auxiliary/typeid-intrinsic-aux2.rs b/src/test/run-pass/auxiliary/typeid-intrinsic-aux2.rs index 0d0f1b3a482..281c079682f 100644 --- a/src/test/run-pass/auxiliary/typeid-intrinsic-aux2.rs +++ b/src/test/run-pass/auxiliary/typeid-intrinsic-aux2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::any::{Any, TypeId}; pub struct A; diff --git a/src/test/run-pass/auxiliary/using-target-feature-unstable.rs b/src/test/run-pass/auxiliary/using-target-feature-unstable.rs index 8b7d0332fe9..78645c284f1 100644 --- a/src/test/run-pass/auxiliary/using-target-feature-unstable.rs +++ b/src/test/run-pass/auxiliary/using-target-feature-unstable.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(mmx_target_feature)] #[inline] diff --git a/src/test/run-pass/auxiliary/weak-lang-items.rs b/src/test/run-pass/auxiliary/weak-lang-items.rs index 6434e62b6f7..7a698cf76ae 100644 --- a/src/test/run-pass/auxiliary/weak-lang-items.rs +++ b/src/test/run-pass/auxiliary/weak-lang-items.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // This aux-file will require the eh_personality function to be codegen'd, but diff --git a/src/test/run-pass/backtrace-debuginfo-aux.rs b/src/test/run-pass/backtrace-debuginfo-aux.rs index cb7ef7e3006..781d6eba5ed 100644 --- a/src/test/run-pass/backtrace-debuginfo-aux.rs +++ b/src/test/run-pass/backtrace-debuginfo-aux.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test: not a test, used by backtrace-debuginfo.rs to test file!() #[inline(never)] diff --git a/src/test/run-pass/backtrace-debuginfo.rs b/src/test/run-pass/backtrace-debuginfo.rs index 7bcb4e5ec2d..37c889e9df4 100644 --- a/src/test/run-pass/backtrace-debuginfo.rs +++ b/src/test/run-pass/backtrace-debuginfo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We disable tail merging here because it can't preserve debuginfo and thus // potentially breaks the backtraces. Also, subtle changes can decide whether // tail merging succeeds, so the test might work today but fail tomorrow due to a diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index 3e1ae730e4a..da3871aba09 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-android FIXME #17520 // ignore-cloudabi spawning processes is not supported // ignore-emscripten spawning processes is not supported diff --git a/src/test/run-pass/bare-fn-implements-fn-mut.rs b/src/test/run-pass/bare-fn-implements-fn-mut.rs index 30a11ca2536..c06fc702ca7 100644 --- a/src/test/run-pass/bare-fn-implements-fn-mut.rs +++ b/src/test/run-pass/bare-fn-implements-fn-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::FnMut; fn call_f(mut f: F) { diff --git a/src/test/run-pass/bare-static-string.rs b/src/test/run-pass/bare-static-string.rs index fefb303fc70..8d4782226d5 100644 --- a/src/test/run-pass/bare-static-string.rs +++ b/src/test/run-pass/bare-static-string.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let x: &'static str = "foo"; println!("{}", x); diff --git a/src/test/run-pass/bench/issue-32062.rs b/src/test/run-pass/bench/issue-32062.rs index c21399fd299..dc45061da5b 100644 --- a/src/test/run-pass/bench/issue-32062.rs +++ b/src/test/run-pass/bench/issue-32062.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/big-literals.rs b/src/test/run-pass/big-literals.rs index 56e0039f66d..9b1fa2123f9 100644 --- a/src/test/run-pass/big-literals.rs +++ b/src/test/run-pass/big-literals.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Catch mistakes in the overflowing literals lint. #![deny(overflowing_literals)] diff --git a/src/test/run-pass/binary-minus-without-space.rs b/src/test/run-pass/binary-minus-without-space.rs index 01a9ec80939..60d00e7cf54 100644 --- a/src/test/run-pass/binary-minus-without-space.rs +++ b/src/test/run-pass/binary-minus-without-space.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that issue #954 stays fixed diff --git a/src/test/run-pass/bind-by-move.rs b/src/test/run-pass/bind-by-move.rs index 9be7d63ab95..82db89468d1 100644 --- a/src/test/run-pass/bind-by-move.rs +++ b/src/test/run-pass/bind-by-move.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::sync::Arc; fn dispose(_x: Arc) { } diff --git a/src/test/run-pass/binding/allow_irrefutable_let_patterns.rs b/src/test/run-pass/binding/allow_irrefutable_let_patterns.rs deleted file mode 100644 index 866784e517c..00000000000 --- a/src/test/run-pass/binding/allow_irrefutable_let_patterns.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(irrefutable_let_patterns)] - -// must-compile-successfully-irrefutable_let_patterns_with_gate -#[allow(irrefutable_let_patterns)] -fn main() { - if let _ = 5 {} - - while let _ = 5 { - break; - } -} diff --git a/src/test/run-pass/binding/bind-field-short-with-modifiers.rs b/src/test/run-pass/binding/bind-field-short-with-modifiers.rs index 59fe52f7b59..b271f84e9ce 100644 --- a/src/test/run-pass/binding/bind-field-short-with-modifiers.rs +++ b/src/test/run-pass/binding/bind-field-short-with-modifiers.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/src/test/run-pass/binding/borrowed-ptr-pattern-2.rs b/src/test/run-pass/binding/borrowed-ptr-pattern-2.rs index 6a23d159047..40df85b1479 100644 --- a/src/test/run-pass/binding/borrowed-ptr-pattern-2.rs +++ b/src/test/run-pass/binding/borrowed-ptr-pattern-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn foo(s: &String) -> bool { diff --git a/src/test/run-pass/binding/borrowed-ptr-pattern-3.rs b/src/test/run-pass/binding/borrowed-ptr-pattern-3.rs index cb40b3a0099..f2607eee815 100644 --- a/src/test/run-pass/binding/borrowed-ptr-pattern-3.rs +++ b/src/test/run-pass/binding/borrowed-ptr-pattern-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn foo<'r>(s: &'r usize) -> bool { diff --git a/src/test/run-pass/binding/borrowed-ptr-pattern-infallible.rs b/src/test/run-pass/binding/borrowed-ptr-pattern-infallible.rs index 5f906903ed2..1bbc03e19ba 100644 --- a/src/test/run-pass/binding/borrowed-ptr-pattern-infallible.rs +++ b/src/test/run-pass/binding/borrowed-ptr-pattern-infallible.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/binding/borrowed-ptr-pattern-option.rs b/src/test/run-pass/binding/borrowed-ptr-pattern-option.rs index 1372a7a0789..319b8631e8d 100644 --- a/src/test/run-pass/binding/borrowed-ptr-pattern-option.rs +++ b/src/test/run-pass/binding/borrowed-ptr-pattern-option.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn select<'r>(x: &'r Option, y: &'r Option) -> &'r Option { diff --git a/src/test/run-pass/binding/borrowed-ptr-pattern.rs b/src/test/run-pass/binding/borrowed-ptr-pattern.rs index f363bef36d6..d5f94ab54e3 100644 --- a/src/test/run-pass/binding/borrowed-ptr-pattern.rs +++ b/src/test/run-pass/binding/borrowed-ptr-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn foo(x: &T) -> T{ diff --git a/src/test/run-pass/binding/empty-types-in-patterns.rs b/src/test/run-pass/binding/empty-types-in-patterns.rs index c230442eecc..d9fb176c818 100644 --- a/src/test/run-pass/binding/empty-types-in-patterns.rs +++ b/src/test/run-pass/binding/empty-types-in-patterns.rs @@ -1,19 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(never_type)] #![feature(exhaustive_patterns)] #![feature(slice_patterns)] #![allow(unreachable_patterns)] #![allow(unreachable_code)] +#![allow(unused_variables)] #[allow(dead_code)] fn foo(z: !) { @@ -60,6 +51,7 @@ fn main() { let x: Result = Ok(123); match x { Ok(y) => y, + Err(_) => unimplemented!(), }; bar(&[]); diff --git a/src/test/run-pass/binding/exhaustive-bool-match-sanity.rs b/src/test/run-pass/binding/exhaustive-bool-match-sanity.rs index 26e852eff23..f83def21060 100644 --- a/src/test/run-pass/binding/exhaustive-bool-match-sanity.rs +++ b/src/test/run-pass/binding/exhaustive-bool-match-sanity.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue #33540 // We previously used to generate a 3-armed boolean `SwitchInt` in the diff --git a/src/test/run-pass/binding/expr-match-generic-unique1.rs b/src/test/run-pass/binding/expr-match-generic-unique1.rs index 3325aa7b3df..5a5f75eea36 100644 --- a/src/test/run-pass/binding/expr-match-generic-unique1.rs +++ b/src/test/run-pass/binding/expr-match-generic-unique1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/binding/expr-match-generic-unique2.rs b/src/test/run-pass/binding/expr-match-generic-unique2.rs index 8daa33e6227..1d236135cdb 100644 --- a/src/test/run-pass/binding/expr-match-generic-unique2.rs +++ b/src/test/run-pass/binding/expr-match-generic-unique2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/binding/expr-match-generic.rs b/src/test/run-pass/binding/expr-match-generic.rs index 11c907b9b2d..530fc676f7c 100644 --- a/src/test/run-pass/binding/expr-match-generic.rs +++ b/src/test/run-pass/binding/expr-match-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/expr-match-panic-all.rs b/src/test/run-pass/binding/expr-match-panic-all.rs index f283fdddb6a..ac31b49a1e9 100644 --- a/src/test/run-pass/binding/expr-match-panic-all.rs +++ b/src/test/run-pass/binding/expr-match-panic-all.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/binding/expr-match-panic.rs b/src/test/run-pass/binding/expr-match-panic.rs index c6f8ae7bca6..4b6b6e072c0 100644 --- a/src/test/run-pass/binding/expr-match-panic.rs +++ b/src/test/run-pass/binding/expr-match-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/binding/expr-match-unique.rs b/src/test/run-pass/binding/expr-match-unique.rs index b67b9fa3dda..a999541207d 100644 --- a/src/test/run-pass/binding/expr-match-unique.rs +++ b/src/test/run-pass/binding/expr-match-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/binding/expr-match.rs b/src/test/run-pass/binding/expr-match.rs index 83d44e42b32..575b38fbc95 100644 --- a/src/test/run-pass/binding/expr-match.rs +++ b/src/test/run-pass/binding/expr-match.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/binding/fat-arrow-match.rs b/src/test/run-pass/binding/fat-arrow-match.rs index 678485b324d..aaf5be8cf74 100644 --- a/src/test/run-pass/binding/fat-arrow-match.rs +++ b/src/test/run-pass/binding/fat-arrow-match.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/fn-arg-incomplete-pattern-drop-order.rs b/src/test/run-pass/binding/fn-arg-incomplete-pattern-drop-order.rs new file mode 100644 index 00000000000..4d5a6fbba28 --- /dev/null +++ b/src/test/run-pass/binding/fn-arg-incomplete-pattern-drop-order.rs @@ -0,0 +1,68 @@ +// Check that partially moved from function parameters are dropped after the +// named bindings that move from them. + +// ignore-wasm32-bare compiled with panic=abort by default + +use std::{panic, cell::RefCell}; + +struct LogDrop<'a>(i32, Context<'a>); + +#[derive(Copy, Clone)] +struct Context<'a> { + panic_on: i32, + drops: &'a RefCell>, +} + +impl<'a> Context<'a> { + fn record_drop(self, index: i32) { + self.drops.borrow_mut().push(index); + if index == self.panic_on { + panic!(); + } + } +} + +impl<'a> Drop for LogDrop<'a> { + fn drop(&mut self) { + self.1.record_drop(self.0); + } +} + +fn bindings_in_params((_x, _): (LogDrop, LogDrop), (_, _y): (LogDrop, LogDrop)) {} +fn bindings_with_let(a: (LogDrop, LogDrop), b: (LogDrop, LogDrop)) { + // Drop order in foo is the same as the following bindings. + // _temp2 is declared after _x to avoid a difference between `_: T` and + // `x: T` in function parameters. + let _temp1 = a; + let (_x, _) = _temp1; + + let _temp2 = b; + let (_, _y) = _temp2; +} + +fn test_drop_order(panic_on: i32, fun: fn((LogDrop, LogDrop), (LogDrop, LogDrop))) { + let context = Context { + panic_on, + drops: &RefCell::new(Vec::new()), + }; + let one = LogDrop(1, context); + let two = LogDrop(2, context); + let three = LogDrop(3, context); + let four = LogDrop(4, context); + + let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { + fun((three, four), (two, one)); + })); + if panic_on == 0 { + assert!(res.is_ok(), "should not have panicked"); + } else { + assert!(res.is_err(), "should have panicked"); + } + assert_eq!(*context.drops.borrow(), [1, 2, 3, 4], "incorrect drop order"); +} + +fn main() { + (0..=4).for_each(|i| test_drop_order(i, bindings_in_params)); + (0..=4).for_each(|i| test_drop_order(i, bindings_with_let)); + (0..=4).for_each(|i| test_drop_order(i, |(_x, _), (_, _y)| {})); +} diff --git a/src/test/run-pass/binding/fn-pattern-expected-type-2.rs b/src/test/run-pass/binding/fn-pattern-expected-type-2.rs index 7926234161f..130ff3d4465 100644 --- a/src/test/run-pass/binding/fn-pattern-expected-type-2.rs +++ b/src/test/run-pass/binding/fn-pattern-expected-type-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { let v : &[(isize,isize)] = &[ (1, 2), (3, 4), (5, 6) ]; diff --git a/src/test/run-pass/binding/fn-pattern-expected-type.rs b/src/test/run-pass/binding/fn-pattern-expected-type.rs index a868267f371..faeb7649636 100644 --- a/src/test/run-pass/binding/fn-pattern-expected-type.rs +++ b/src/test/run-pass/binding/fn-pattern-expected-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/binding/func-arg-incomplete-pattern.rs b/src/test/run-pass/binding/func-arg-incomplete-pattern.rs index bc994f0f7fa..98dd51811de 100644 --- a/src/test/run-pass/binding/func-arg-incomplete-pattern.rs +++ b/src/test/run-pass/binding/func-arg-incomplete-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that we do not leak when the arg pattern must drop part of the diff --git a/src/test/run-pass/binding/func-arg-ref-pattern.rs b/src/test/run-pass/binding/func-arg-ref-pattern.rs index 7e87f14e2c5..ebb7a6afa9b 100644 --- a/src/test/run-pass/binding/func-arg-ref-pattern.rs +++ b/src/test/run-pass/binding/func-arg-ref-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // exec-env:RUST_POISON_ON_FREE=1 diff --git a/src/test/run-pass/binding/func-arg-wild-pattern.rs b/src/test/run-pass/binding/func-arg-wild-pattern.rs index 18a1909b51e..bcd82c679a5 100644 --- a/src/test/run-pass/binding/func-arg-wild-pattern.rs +++ b/src/test/run-pass/binding/func-arg-wild-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we can compile code that uses a `_` in function argument // patterns. diff --git a/src/test/run-pass/binding/if-let.rs b/src/test/run-pass/binding/if-let.rs index 933865342c4..3ea8d402a3e 100644 --- a/src/test/run-pass/binding/if-let.rs +++ b/src/test/run-pass/binding/if-let.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs b/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs index fd2764f84d7..87768c28cf4 100644 --- a/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs +++ b/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/binding/inferred-suffix-in-pattern-range.rs b/src/test/run-pass/binding/inferred-suffix-in-pattern-range.rs index 3be0991aea6..079cc0a16db 100644 --- a/src/test/run-pass/binding/inferred-suffix-in-pattern-range.rs +++ b/src/test/run-pass/binding/inferred-suffix-in-pattern-range.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/binding/irrefutable-slice-patterns.rs b/src/test/run-pass/binding/irrefutable-slice-patterns.rs index 9cd62f9a901..733e6b7b57f 100644 --- a/src/test/run-pass/binding/irrefutable-slice-patterns.rs +++ b/src/test/run-pass/binding/irrefutable-slice-patterns.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // #47096 diff --git a/src/test/run-pass/binding/let-assignability.rs b/src/test/run-pass/binding/let-assignability.rs index 99fc172892c..5bb375d285d 100644 --- a/src/test/run-pass/binding/let-assignability.rs +++ b/src/test/run-pass/binding/let-assignability.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/binding/let-destruct-ref.rs b/src/test/run-pass/binding/let-destruct-ref.rs index 1c1b1a39769..28d7294ebc8 100644 --- a/src/test/run-pass/binding/let-destruct-ref.rs +++ b/src/test/run-pass/binding/let-destruct-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/binding/let-var-hygiene.rs b/src/test/run-pass/binding/let-var-hygiene.rs index d432dbe86b9..571207bd7d6 100644 --- a/src/test/run-pass/binding/let-var-hygiene.rs +++ b/src/test/run-pass/binding/let-var-hygiene.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // shouldn't affect evaluation of $ex: diff --git a/src/test/run-pass/binding/match-arm-statics.rs b/src/test/run-pass/binding/match-arm-statics.rs index b6f4cb18d9a..359c3921158 100644 --- a/src/test/run-pass/binding/match-arm-statics.rs +++ b/src/test/run-pass/binding/match-arm-statics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // compile-flags: -g diff --git a/src/test/run-pass/binding/match-beginning-vert.rs b/src/test/run-pass/binding/match-beginning-vert.rs index 16954f85752..79267400b28 100644 --- a/src/test/run-pass/binding/match-beginning-vert.rs +++ b/src/test/run-pass/binding/match-beginning-vert.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass enum Foo { A, diff --git a/src/test/run-pass/binding/match-borrowed_str.rs b/src/test/run-pass/binding/match-borrowed_str.rs index 0871ff836cc..22782032ebf 100644 --- a/src/test/run-pass/binding/match-borrowed_str.rs +++ b/src/test/run-pass/binding/match-borrowed_str.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn f1(ref_string: &str) -> String { diff --git a/src/test/run-pass/binding/match-bot-2.rs b/src/test/run-pass/binding/match-bot-2.rs index f25b423607b..95b3406f0b5 100644 --- a/src/test/run-pass/binding/match-bot-2.rs +++ b/src/test/run-pass/binding/match-bot-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] // n.b. This was only ever failing with optimization disabled. diff --git a/src/test/run-pass/binding/match-bot.rs b/src/test/run-pass/binding/match-bot.rs index d91d95b826a..5c4472c7aea 100644 --- a/src/test/run-pass/binding/match-bot.rs +++ b/src/test/run-pass/binding/match-bot.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/binding/match-byte-array-patterns.rs b/src/test/run-pass/binding/match-byte-array-patterns.rs index 728d4a241fe..e87745705da 100644 --- a/src/test/run-pass/binding/match-byte-array-patterns.rs +++ b/src/test/run-pass/binding/match-byte-array-patterns.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(slice_patterns)] diff --git a/src/test/run-pass/binding/match-enum-struct-0.rs b/src/test/run-pass/binding/match-enum-struct-0.rs index bc364b04aec..e2623ece84c 100644 --- a/src/test/run-pass/binding/match-enum-struct-0.rs +++ b/src/test/run-pass/binding/match-enum-struct-0.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // regression test for issue #5625 diff --git a/src/test/run-pass/binding/match-enum-struct-1.rs b/src/test/run-pass/binding/match-enum-struct-1.rs index 71cacc2f6bf..f035432ec99 100644 --- a/src/test/run-pass/binding/match-enum-struct-1.rs +++ b/src/test/run-pass/binding/match-enum-struct-1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/binding/match-implicit-copy-unique.rs b/src/test/run-pass/binding/match-implicit-copy-unique.rs index 68edbea3471..a7e8109b46c 100644 --- a/src/test/run-pass/binding/match-implicit-copy-unique.rs +++ b/src/test/run-pass/binding/match-implicit-copy-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_shorthand_field_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/binding/match-in-macro.rs b/src/test/run-pass/binding/match-in-macro.rs index 5c4c7c048ef..0840cc4404d 100644 --- a/src/test/run-pass/binding/match-in-macro.rs +++ b/src/test/run-pass/binding/match-in-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass enum Foo { diff --git a/src/test/run-pass/binding/match-join.rs b/src/test/run-pass/binding/match-join.rs index cd7cc87a40b..60f2a458489 100644 --- a/src/test/run-pass/binding/match-join.rs +++ b/src/test/run-pass/binding/match-join.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] fn foo(y: Option) { diff --git a/src/test/run-pass/binding/match-larger-const.rs b/src/test/run-pass/binding/match-larger-const.rs index f649ce0ee0e..6f9a353207f 100644 --- a/src/test/run-pass/binding/match-larger-const.rs +++ b/src/test/run-pass/binding/match-larger-const.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Eq, PartialEq)] pub struct Data([u8; 4]); diff --git a/src/test/run-pass/binding/match-naked-record-expr.rs b/src/test/run-pass/binding/match-naked-record-expr.rs index f016ca8e43c..c23ff8c9495 100644 --- a/src/test/run-pass/binding/match-naked-record-expr.rs +++ b/src/test/run-pass/binding/match-naked-record-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/binding/match-naked-record.rs b/src/test/run-pass/binding/match-naked-record.rs index 9c4c36693b9..f7479152ebc 100644 --- a/src/test/run-pass/binding/match-naked-record.rs +++ b/src/test/run-pass/binding/match-naked-record.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/binding/match-path.rs b/src/test/run-pass/binding/match-path.rs index 385713001a3..286214eb8ac 100644 --- a/src/test/run-pass/binding/match-path.rs +++ b/src/test/run-pass/binding/match-path.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/match-pattern-bindings.rs b/src/test/run-pass/binding/match-pattern-bindings.rs index e6242a0ee58..4ec533677d6 100644 --- a/src/test/run-pass/binding/match-pattern-bindings.rs +++ b/src/test/run-pass/binding/match-pattern-bindings.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { diff --git a/src/test/run-pass/binding/match-pattern-lit.rs b/src/test/run-pass/binding/match-pattern-lit.rs index 8e6129d60b5..c9c6135e2e6 100644 --- a/src/test/run-pass/binding/match-pattern-lit.rs +++ b/src/test/run-pass/binding/match-pattern-lit.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/binding/match-pattern-no-type-params.rs b/src/test/run-pass/binding/match-pattern-no-type-params.rs index e42a24f20b9..1fc7ddda023 100644 --- a/src/test/run-pass/binding/match-pattern-no-type-params.rs +++ b/src/test/run-pass/binding/match-pattern-no-type-params.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/match-pattern-simple.rs b/src/test/run-pass/binding/match-pattern-simple.rs index 3522ba71b6a..3f56cd4796d 100644 --- a/src/test/run-pass/binding/match-pattern-simple.rs +++ b/src/test/run-pass/binding/match-pattern-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/binding/match-phi.rs b/src/test/run-pass/binding/match-phi.rs index 43a55da573b..92a3f6e0f7f 100644 --- a/src/test/run-pass/binding/match-phi.rs +++ b/src/test/run-pass/binding/match-phi.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_assignments)] diff --git a/src/test/run-pass/binding/match-pipe-binding.rs b/src/test/run-pass/binding/match-pipe-binding.rs index 577e5c97e42..40dbd246895 100644 --- a/src/test/run-pass/binding/match-pipe-binding.rs +++ b/src/test/run-pass/binding/match-pipe-binding.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -Z borrowck=compare diff --git a/src/test/run-pass/binding/match-range-infer.rs b/src/test/run-pass/binding/match-range-infer.rs index 7178d1837c7..19d1cb89d4a 100644 --- a/src/test/run-pass/binding/match-range-infer.rs +++ b/src/test/run-pass/binding/match-range-infer.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that type inference for range patterns works correctly (is bi-directional). diff --git a/src/test/run-pass/binding/match-range-static.rs b/src/test/run-pass/binding/match-range-static.rs index 5be8db5fc86..f01a3505ee6 100644 --- a/src/test/run-pass/binding/match-range-static.rs +++ b/src/test/run-pass/binding/match-range-static.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/binding/match-range.rs b/src/test/run-pass/binding/match-range.rs index a9687943e99..1dca84dfd45 100644 --- a/src/test/run-pass/binding/match-range.rs +++ b/src/test/run-pass/binding/match-range.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 #![feature(exclusive_range_pattern)] diff --git a/src/test/run-pass/binding/match-reassign.rs b/src/test/run-pass/binding/match-reassign.rs index 89b12976355..19b48579cb4 100644 --- a/src/test/run-pass/binding/match-reassign.rs +++ b/src/test/run-pass/binding/match-reassign.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for #23698: The reassignment checker only cared // about the last assignment in a match arm body diff --git a/src/test/run-pass/binding/match-ref-binding-in-guard-3256.rs b/src/test/run-pass/binding/match-ref-binding-in-guard-3256.rs index 2da75d941b4..9075a34d410 100644 --- a/src/test/run-pass/binding/match-ref-binding-in-guard-3256.rs +++ b/src/test/run-pass/binding/match-ref-binding-in-guard-3256.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::sync::Mutex; diff --git a/src/test/run-pass/binding/match-ref-binding-mut-option.rs b/src/test/run-pass/binding/match-ref-binding-mut-option.rs index a3d26024732..c25639b7213 100644 --- a/src/test/run-pass/binding/match-ref-binding-mut-option.rs +++ b/src/test/run-pass/binding/match-ref-binding-mut-option.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/binding/match-ref-binding-mut.rs b/src/test/run-pass/binding/match-ref-binding-mut.rs index c1f09502542..d7afd61bc8e 100644 --- a/src/test/run-pass/binding/match-ref-binding-mut.rs +++ b/src/test/run-pass/binding/match-ref-binding-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/binding/match-ref-binding.rs b/src/test/run-pass/binding/match-ref-binding.rs index bc36b8102ce..ac6a07eabe1 100644 --- a/src/test/run-pass/binding/match-ref-binding.rs +++ b/src/test/run-pass/binding/match-ref-binding.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn destructure(x: Option) -> isize { diff --git a/src/test/run-pass/binding/match-ref-unsized.rs b/src/test/run-pass/binding/match-ref-unsized.rs index 7ef19330015..53784ebb9fc 100644 --- a/src/test/run-pass/binding/match-ref-unsized.rs +++ b/src/test/run-pass/binding/match-ref-unsized.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Binding unsized expressions to ref patterns diff --git a/src/test/run-pass/binding/match-static-const-rename.rs b/src/test/run-pass/binding/match-static-const-rename.rs deleted file mode 100644 index 0d75c81b1e6..00000000000 --- a/src/test/run-pass/binding/match-static-const-rename.rs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #7526: lowercase static constants in patterns look like bindings - -// This is similar to compile-fail/match-static-const-lc, except it -// shows the expected usual workaround (choosing a different name for -// the static definition) and also demonstrates that one can work -// around this problem locally by renaming the constant in the `use` -// form to an uppercase identifier that placates the lint. - - -#![deny(non_upper_case_globals)] - -pub const A : isize = 97; - -fn f() { - let r = match (0,0) { - (0, A) => 0, - (x, y) => 1 + x + y, - }; - assert_eq!(r, 1); - let r = match (0,97) { - (0, A) => 0, - (x, y) => 1 + x + y, - }; - assert_eq!(r, 0); -} - -mod m { - #[allow(non_upper_case_globals)] - pub const aha : isize = 7; -} - -fn g() { - use self::m::aha as AHA; - let r = match (0,0) { - (0, AHA) => 0, - (x, y) => 1 + x + y, - }; - assert_eq!(r, 1); - let r = match (0,7) { - (0, AHA) => 0, - (x, y) => 1 + x + y, - }; - assert_eq!(r, 0); -} - -fn h() { - let r = match (0,0) { - (0, self::m::aha) => 0, - (x, y) => 1 + x + y, - }; - assert_eq!(r, 1); - let r = match (0,7) { - (0, self::m::aha) => 0, - (x, y) => 1 + x + y, - }; - assert_eq!(r, 0); -} - -pub fn main () { - f(); - g(); - h(); -} diff --git a/src/test/run-pass/binding/match-str.rs b/src/test/run-pass/binding/match-str.rs index 7b051cfa435..0ee18ea18de 100644 --- a/src/test/run-pass/binding/match-str.rs +++ b/src/test/run-pass/binding/match-str.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Issue #53 diff --git a/src/test/run-pass/binding/match-struct-0.rs b/src/test/run-pass/binding/match-struct-0.rs index facfaae5405..c49f3ed6178 100644 --- a/src/test/run-pass/binding/match-struct-0.rs +++ b/src/test/run-pass/binding/match-struct-0.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo{ diff --git a/src/test/run-pass/binding/match-tag.rs b/src/test/run-pass/binding/match-tag.rs index ca7b7c70afb..eceb6467784 100644 --- a/src/test/run-pass/binding/match-tag.rs +++ b/src/test/run-pass/binding/match-tag.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/match-unique-bind.rs b/src/test/run-pass/binding/match-unique-bind.rs index a543527586f..f5361b118be 100644 --- a/src/test/run-pass/binding/match-unique-bind.rs +++ b/src/test/run-pass/binding/match-unique-bind.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/binding/match-unsized.rs b/src/test/run-pass/binding/match-unsized.rs index 2e2f0f0b7ea..41937a557ef 100644 --- a/src/test/run-pass/binding/match-unsized.rs +++ b/src/test/run-pass/binding/match-unsized.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let data: &'static str = "Hello, World!"; diff --git a/src/test/run-pass/binding/match-value-binding-in-guard-3291.rs b/src/test/run-pass/binding/match-value-binding-in-guard-3291.rs index a24a38af22f..4b209b20a18 100644 --- a/src/test/run-pass/binding/match-value-binding-in-guard-3291.rs +++ b/src/test/run-pass/binding/match-value-binding-in-guard-3291.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/binding/match-var-hygiene.rs b/src/test/run-pass/binding/match-var-hygiene.rs index 5d4347559f7..43740bbcf1d 100644 --- a/src/test/run-pass/binding/match-var-hygiene.rs +++ b/src/test/run-pass/binding/match-var-hygiene.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // shouldn't affect evaluation of $ex. macro_rules! bad_macro { ($ex:expr) => ( diff --git a/src/test/run-pass/binding/match-vec-alternatives.rs b/src/test/run-pass/binding/match-vec-alternatives.rs index 4c728924556..9b06a86a7b9 100644 --- a/src/test/run-pass/binding/match-vec-alternatives.rs +++ b/src/test/run-pass/binding/match-vec-alternatives.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(slice_patterns)] diff --git a/src/test/run-pass/binding/match-vec-rvalue.rs b/src/test/run-pass/binding/match-vec-rvalue.rs index 308a4938b3a..fead2254c75 100644 --- a/src/test/run-pass/binding/match-vec-rvalue.rs +++ b/src/test/run-pass/binding/match-vec-rvalue.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that matching rvalues with drops does not crash. diff --git a/src/test/run-pass/binding/match-with-ret-arm.rs b/src/test/run-pass/binding/match-with-ret-arm.rs index fe7aa288d52..58a90964121 100644 --- a/src/test/run-pass/binding/match-with-ret-arm.rs +++ b/src/test/run-pass/binding/match-with-ret-arm.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { // sometimes we have had trouble finding diff --git a/src/test/run-pass/binding/multi-let.rs b/src/test/run-pass/binding/multi-let.rs index 6ecd84d8c58..064d32a7084 100644 --- a/src/test/run-pass/binding/multi-let.rs +++ b/src/test/run-pass/binding/multi-let.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/binding/mut-in-ident-patterns.rs b/src/test/run-pass/binding/mut-in-ident-patterns.rs index e9f143cfbc9..1d1dd660e51 100644 --- a/src/test/run-pass/binding/mut-in-ident-patterns.rs +++ b/src/test/run-pass/binding/mut-in-ident-patterns.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_assignments)] diff --git a/src/test/run-pass/binding/nested-exhaustive-match.rs b/src/test/run-pass/binding/nested-exhaustive-match.rs index 61bb0e8a468..8b2294f8432 100644 --- a/src/test/run-pass/binding/nested-exhaustive-match.rs +++ b/src/test/run-pass/binding/nested-exhaustive-match.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/binding/nested-matchs.rs b/src/test/run-pass/binding/nested-matchs.rs index 0b37c495074..29490fd4888 100644 --- a/src/test/run-pass/binding/nested-matchs.rs +++ b/src/test/run-pass/binding/nested-matchs.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] // under NLL we get warning about `bar` below fn baz() -> ! { panic!(); } diff --git a/src/test/run-pass/binding/nested-pattern.rs b/src/test/run-pass/binding/nested-pattern.rs index 96bdadc0624..7d14c9ad9b7 100644 --- a/src/test/run-pass/binding/nested-pattern.rs +++ b/src/test/run-pass/binding/nested-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/nil-pattern.rs b/src/test/run-pass/binding/nil-pattern.rs index 39b2f2da624..268af351d08 100644 --- a/src/test/run-pass/binding/nil-pattern.rs +++ b/src/test/run-pass/binding/nil-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/binding/nullary-or-pattern.rs b/src/test/run-pass/binding/nullary-or-pattern.rs index 892464dd1db..7a3d9d60eda 100644 --- a/src/test/run-pass/binding/nullary-or-pattern.rs +++ b/src/test/run-pass/binding/nullary-or-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/optional_comma_in_match_arm.rs b/src/test/run-pass/binding/optional_comma_in_match_arm.rs index 304a0323297..fc268bf2a45 100644 --- a/src/test/run-pass/binding/optional_comma_in_match_arm.rs +++ b/src/test/run-pass/binding/optional_comma_in_match_arm.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_unsafe)] // ignore-pretty issue #37199 diff --git a/src/test/run-pass/binding/or-pattern.rs b/src/test/run-pass/binding/or-pattern.rs index a9b3e278652..2ab44a96c3a 100644 --- a/src/test/run-pass/binding/or-pattern.rs +++ b/src/test/run-pass/binding/or-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/order-drop-with-match.rs b/src/test/run-pass/binding/order-drop-with-match.rs index 7bb929325ad..f50632ede9f 100644 --- a/src/test/run-pass/binding/order-drop-with-match.rs +++ b/src/test/run-pass/binding/order-drop-with-match.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test to make sure the destructors run in the right order. diff --git a/src/test/run-pass/binding/pat-ranges.rs b/src/test/run-pass/binding/pat-ranges.rs index 44666eda3ca..b3729a79615 100644 --- a/src/test/run-pass/binding/pat-ranges.rs +++ b/src/test/run-pass/binding/pat-ranges.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Parsing of range patterns diff --git a/src/test/run-pass/binding/pat-tuple-1.rs b/src/test/run-pass/binding/pat-tuple-1.rs index dc8a7ff7a07..b09d4a22df0 100644 --- a/src/test/run-pass/binding/pat-tuple-1.rs +++ b/src/test/run-pass/binding/pat-tuple-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn tuple() { let x = (1, 2, 3); diff --git a/src/test/run-pass/binding/pat-tuple-2.rs b/src/test/run-pass/binding/pat-tuple-2.rs index 0428e32c43b..810fd264139 100644 --- a/src/test/run-pass/binding/pat-tuple-2.rs +++ b/src/test/run-pass/binding/pat-tuple-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn tuple() { let x = (1,); diff --git a/src/test/run-pass/binding/pat-tuple-3.rs b/src/test/run-pass/binding/pat-tuple-3.rs index 60b933e4ce4..9bec898611e 100644 --- a/src/test/run-pass/binding/pat-tuple-3.rs +++ b/src/test/run-pass/binding/pat-tuple-3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn tuple() { let x = (1, 2, 3); diff --git a/src/test/run-pass/binding/pat-tuple-4.rs b/src/test/run-pass/binding/pat-tuple-4.rs index cd19f2c67a1..71a54850268 100644 --- a/src/test/run-pass/binding/pat-tuple-4.rs +++ b/src/test/run-pass/binding/pat-tuple-4.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn tuple() { let x = (1, 2, 3); diff --git a/src/test/run-pass/binding/pat-tuple-5.rs b/src/test/run-pass/binding/pat-tuple-5.rs index 0ac4c24c4ee..c8cdd37dd85 100644 --- a/src/test/run-pass/binding/pat-tuple-5.rs +++ b/src/test/run-pass/binding/pat-tuple-5.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn tuple() { struct S; diff --git a/src/test/run-pass/binding/pat-tuple-6.rs b/src/test/run-pass/binding/pat-tuple-6.rs index b3cd0e1b543..877f0e4140e 100644 --- a/src/test/run-pass/binding/pat-tuple-6.rs +++ b/src/test/run-pass/binding/pat-tuple-6.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn tuple() { let x = (1, 2, 3, 4, 5); diff --git a/src/test/run-pass/binding/pat-tuple-7.rs b/src/test/run-pass/binding/pat-tuple-7.rs index 06bd14d188e..7835e2c352f 100644 --- a/src/test/run-pass/binding/pat-tuple-7.rs +++ b/src/test/run-pass/binding/pat-tuple-7.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { diff --git a/src/test/run-pass/binding/pattern-bound-var-in-for-each.rs b/src/test/run-pass/binding/pattern-bound-var-in-for-each.rs index 2ee697fe2ff..3f725cddc5b 100644 --- a/src/test/run-pass/binding/pattern-bound-var-in-for-each.rs +++ b/src/test/run-pass/binding/pattern-bound-var-in-for-each.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that codegen_path checks whether a // pattern-bound var is an upvar (when codegenning diff --git a/src/test/run-pass/binding/pattern-in-closure.rs b/src/test/run-pass/binding/pattern-in-closure.rs index 9a5a420a80b..3ac8d57681a 100644 --- a/src/test/run-pass/binding/pattern-in-closure.rs +++ b/src/test/run-pass/binding/pattern-in-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/binding/range-inclusive-pattern-precedence.rs b/src/test/run-pass/binding/range-inclusive-pattern-precedence.rs index d492edb1617..858239bb177 100644 --- a/src/test/run-pass/binding/range-inclusive-pattern-precedence.rs +++ b/src/test/run-pass/binding/range-inclusive-pattern-precedence.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_patterns)] diff --git a/src/test/run-pass/binding/simple-generic-match.rs b/src/test/run-pass/binding/simple-generic-match.rs index 13c16790e09..50cfe19fef4 100644 --- a/src/test/run-pass/binding/simple-generic-match.rs +++ b/src/test/run-pass/binding/simple-generic-match.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/use-uninit-match.rs b/src/test/run-pass/binding/use-uninit-match.rs index 472045fcdb3..9250dbf0c43 100644 --- a/src/test/run-pass/binding/use-uninit-match.rs +++ b/src/test/run-pass/binding/use-uninit-match.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/use-uninit-match2.rs b/src/test/run-pass/binding/use-uninit-match2.rs index 2f8384f9e84..9102730629b 100644 --- a/src/test/run-pass/binding/use-uninit-match2.rs +++ b/src/test/run-pass/binding/use-uninit-match2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_mut)] diff --git a/src/test/run-pass/binding/zero_sized_subslice_match.rs b/src/test/run-pass/binding/zero_sized_subslice_match.rs index db71d97a19d..51e1c024bff 100644 --- a/src/test/run-pass/binding/zero_sized_subslice_match.rs +++ b/src/test/run-pass/binding/zero_sized_subslice_match.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(slice_patterns)] diff --git a/src/test/run-pass/binops-issue-22743.rs b/src/test/run-pass/binops-issue-22743.rs index da7a3ae684c..4e95597b671 100644 --- a/src/test/run-pass/binops-issue-22743.rs +++ b/src/test/run-pass/binops-issue-22743.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Mul; #[derive(Copy, Clone)] diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index 0b2098b0f05..b24f8b723fd 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] // Binop corner cases diff --git a/src/test/run-pass/bitwise.rs b/src/test/run-pass/bitwise.rs index bb4b9cfecf7..309ccae1487 100644 --- a/src/test/run-pass/bitwise.rs +++ b/src/test/run-pass/bitwise.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[cfg(any(target_pointer_width = "32"))] fn target() { assert_eq!(-1000isize as usize >> 3_usize, 536870787_usize); diff --git a/src/test/run-pass/blind-item-local-shadow.rs b/src/test/run-pass/blind-item-local-shadow.rs index 6066bc32b26..d88374a351a 100644 --- a/src/test/run-pass/blind-item-local-shadow.rs +++ b/src/test/run-pass/blind-item-local-shadow.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_imports)] mod bar { diff --git a/src/test/run-pass/blind-item-mixed-crate-use-item.rs b/src/test/run-pass/blind-item-mixed-crate-use-item.rs index 3b6614c18fa..00d171f6e4d 100644 --- a/src/test/run-pass/blind-item-mixed-crate-use-item.rs +++ b/src/test/run-pass/blind-item-mixed-crate-use-item.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:blind-item-mixed-crate-use-item-foo.rs // aux-build:blind-item-mixed-crate-use-item-foo2.rs diff --git a/src/test/run-pass/blind-item-mixed-use-item.rs b/src/test/run-pass/blind-item-mixed-use-item.rs index 6244ba6fccf..e6008206ba8 100644 --- a/src/test/run-pass/blind-item-mixed-use-item.rs +++ b/src/test/run-pass/blind-item-mixed-use-item.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 mod m { diff --git a/src/test/run-pass/block-arg-call-as.rs b/src/test/run-pass/block-arg-call-as.rs index 342f67ae44f..7157cfecf32 100644 --- a/src/test/run-pass/block-arg-call-as.rs +++ b/src/test/run-pass/block-arg-call-as.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] fn asBlock(f: F) -> usize where F: FnOnce() -> usize { diff --git a/src/test/run-pass/block-arg.rs b/src/test/run-pass/block-arg.rs index 7fca4bccab3..8d5840ae9e7 100644 --- a/src/test/run-pass/block-arg.rs +++ b/src/test/run-pass/block-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check usage and precedence of block arguments in expressions: pub fn main() { let v = vec![-1.0f64, 0.0, 1.0, 2.0, 3.0]; diff --git a/src/test/run-pass/block-explicit-types.rs b/src/test/run-pass/block-explicit-types.rs index 835d356d8aa..449a4967580 100644 --- a/src/test/run-pass/block-explicit-types.rs +++ b/src/test/run-pass/block-explicit-types.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { fn as_buf(s: String, f: F) -> T where F: FnOnce(String) -> T { f(s) } as_buf("foo".to_string(), |foo: String| -> () { println!("{}", foo) }); diff --git a/src/test/run-pass/block-expr-precedence.rs b/src/test/run-pass/block-expr-precedence.rs index acb0f2dd298..2be0ac4c44f 100644 --- a/src/test/run-pass/block-expr-precedence.rs +++ b/src/test/run-pass/block-expr-precedence.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] #![allow(unused_parens)] // This test has some extra semis in it that the pretty-printer won't diff --git a/src/test/run-pass/block-fn-coerce.rs b/src/test/run-pass/block-fn-coerce.rs index 3e6109da39a..0fbc1f5178d 100644 --- a/src/test/run-pass/block-fn-coerce.rs +++ b/src/test/run-pass/block-fn-coerce.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn force(f: F) -> isize where F: FnOnce() -> isize { return f(); } pub fn main() { diff --git a/src/test/run-pass/block-iter-1.rs b/src/test/run-pass/block-iter-1.rs index 7cbe8104deb..8b3fc95f5a1 100644 --- a/src/test/run-pass/block-iter-1.rs +++ b/src/test/run-pass/block-iter-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn iter_vec(v: Vec , mut f: F) where F: FnMut(&T) { for x in &v { f(x); } } pub fn main() { diff --git a/src/test/run-pass/block-iter-2.rs b/src/test/run-pass/block-iter-2.rs index 7701f6114ca..0176f6d26d9 100644 --- a/src/test/run-pass/block-iter-2.rs +++ b/src/test/run-pass/block-iter-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn iter_vec(v: Vec, mut f: F) where F: FnMut(&T) { for x in &v { f(x); } } pub fn main() { diff --git a/src/test/run-pass/bool-not.rs b/src/test/run-pass/bool-not.rs index fa0b86d0a02..34865a36762 100644 --- a/src/test/run-pass/bool-not.rs +++ b/src/test/run-pass/bool-not.rs @@ -1,17 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - - pub fn main() { if !false { assert!((true)); } else { assert!((false)); } if !true { assert!((false)); } else { assert!((true)); } diff --git a/src/test/run-pass/bool.rs b/src/test/run-pass/bool.rs index 1152574d069..e6322746f20 100644 --- a/src/test/run-pass/bool.rs +++ b/src/test/run-pass/bool.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic boolean tests diff --git a/src/test/run-pass/borrow-by-val-method-receiver.rs b/src/test/run-pass/borrow-by-val-method-receiver.rs index 44f4a54610a..5907f8238af 100644 --- a/src/test/run-pass/borrow-by-val-method-receiver.rs +++ b/src/test/run-pass/borrow-by-val-method-receiver.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(self); } diff --git a/src/test/run-pass/borrowck/borrowck-assign-to-subfield.rs b/src/test/run-pass/borrowck/borrowck-assign-to-subfield.rs index 248e34bde09..050d702b625 100644 --- a/src/test/run-pass/borrowck/borrowck-assign-to-subfield.rs +++ b/src/test/run-pass/borrowck/borrowck-assign-to-subfield.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs b/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs index ad16027c34d..25ef48d0d5c 100644 --- a/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs +++ b/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test taken from #45641 (https://github.com/rust-lang/rust/issues/45641) diff --git a/src/test/run-pass/borrowck/borrowck-binding-mutbl.rs b/src/test/run-pass/borrowck/borrowck-binding-mutbl.rs index 86875a038da..c2d2e02ec15 100644 --- a/src/test/run-pass/borrowck/borrowck-binding-mutbl.rs +++ b/src/test/run-pass/borrowck/borrowck-binding-mutbl.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct F { f: Vec } diff --git a/src/test/run-pass/borrowck/borrowck-borrow-from-expr-block.rs b/src/test/run-pass/borrowck/borrowck-borrow-from-expr-block.rs index b85a9baf5a0..15c6e8bf210 100644 --- a/src/test/run-pass/borrowck/borrowck-borrow-from-expr-block.rs +++ b/src/test/run-pass/borrowck/borrowck-borrow-from-expr-block.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs b/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs index a3a63482923..2839a9195a0 100644 --- a/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs +++ b/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_mut)] diff --git a/src/test/run-pass/borrowck/borrowck-closures-two-imm.rs b/src/test/run-pass/borrowck/borrowck-closures-two-imm.rs index 8c6d92c9962..ab135194a09 100644 --- a/src/test/run-pass/borrowck/borrowck-closures-two-imm.rs +++ b/src/test/run-pass/borrowck/borrowck-closures-two-imm.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that two closures can simultaneously have immutable // access to the variable, whether that immutable access be used diff --git a/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs b/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs index 782054bb1b1..cb1ba90de89 100644 --- a/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs +++ b/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![allow(unused_variables)] diff --git a/src/test/run-pass/borrowck/borrowck-fixed-length-vecs.rs b/src/test/run-pass/borrowck/borrowck-fixed-length-vecs.rs index baefdf657ea..126323d8d24 100644 --- a/src/test/run-pass/borrowck/borrowck-fixed-length-vecs.rs +++ b/src/test/run-pass/borrowck/borrowck-fixed-length-vecs.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/borrowck/borrowck-freeze-frozen-mut.rs b/src/test/run-pass/borrowck/borrowck-freeze-frozen-mut.rs index 0ddb71d1d15..199931d6d1e 100644 --- a/src/test/run-pass/borrowck/borrowck-freeze-frozen-mut.rs +++ b/src/test/run-pass/borrowck/borrowck-freeze-frozen-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that a `&mut` inside of an `&` is freezable. diff --git a/src/test/run-pass/borrowck/borrowck-lend-args.rs b/src/test/run-pass/borrowck/borrowck-lend-args.rs index 3458ab91f3d..d0ef2dcdd28 100644 --- a/src/test/run-pass/borrowck/borrowck-lend-args.rs +++ b/src/test/run-pass/borrowck/borrowck-lend-args.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs b/src/test/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs index ea47661a1fa..628e49f574c 100644 --- a/src/test/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs +++ b/src/test/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/borrowck/borrowck-move-by-capture-ok.rs b/src/test/run-pass/borrowck/borrowck-move-by-capture-ok.rs index 180a6ad8f87..98e4b881893 100644 --- a/src/test/run-pass/borrowck/borrowck-move-by-capture-ok.rs +++ b/src/test/run-pass/borrowck/borrowck-move-by-capture-ok.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs b/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs index c51a615c963..c953bed26f4 100644 --- a/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs +++ b/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/borrowck/borrowck-mut-uniq.rs b/src/test/run-pass/borrowck/borrowck-mut-uniq.rs index 87dd1f1de53..80b3484e0fb 100644 --- a/src/test/run-pass/borrowck/borrowck-mut-uniq.rs +++ b/src/test/run-pass/borrowck/borrowck-mut-uniq.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/borrowck/borrowck-mut-vec-as-imm-slice.rs b/src/test/run-pass/borrowck/borrowck-mut-vec-as-imm-slice.rs index b616cf25382..d2b0c01545e 100644 --- a/src/test/run-pass/borrowck/borrowck-mut-vec-as-imm-slice.rs +++ b/src/test/run-pass/borrowck/borrowck-mut-vec-as-imm-slice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/borrowck/borrowck-pat-enum.rs b/src/test/run-pass/borrowck/borrowck-pat-enum.rs index 5a184fd0179..7f9c5544d0b 100644 --- a/src/test/run-pass/borrowck/borrowck-pat-enum.rs +++ b/src/test/run-pass/borrowck/borrowck-pat-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // ignore-pretty issue #37199 diff --git a/src/test/run-pass/borrowck/borrowck-pat-reassign-no-binding.rs b/src/test/run-pass/borrowck/borrowck-pat-reassign-no-binding.rs index 1ce7a00d423..1362fd8ce4c 100644 --- a/src/test/run-pass/borrowck/borrowck-pat-reassign-no-binding.rs +++ b/src/test/run-pass/borrowck/borrowck-pat-reassign-no-binding.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/borrowck/borrowck-rvalues-mutable.rs b/src/test/run-pass/borrowck/borrowck-rvalues-mutable.rs index 936e5565eed..c4695c942e1 100644 --- a/src/test/run-pass/borrowck/borrowck-rvalues-mutable.rs +++ b/src/test/run-pass/borrowck/borrowck-rvalues-mutable.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Counter { diff --git a/src/test/run-pass/borrowck/borrowck-scope-of-deref-issue-4666.rs b/src/test/run-pass/borrowck/borrowck-scope-of-deref-issue-4666.rs index dd832b9eee0..e89332ae31a 100644 --- a/src/test/run-pass/borrowck/borrowck-scope-of-deref-issue-4666.rs +++ b/src/test/run-pass/borrowck/borrowck-scope-of-deref-issue-4666.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that the scope of the pointer returned from `get()` is // limited to the deref operation itself, and does not infect the diff --git a/src/test/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs b/src/test/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs index e7c1699f7b4..7675147c8ec 100644 --- a/src/test/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs +++ b/src/test/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass //compile-flags: -Z borrowck=mir diff --git a/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs b/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs index 9bc2a64eea6..5f4379325a5 100644 --- a/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs +++ b/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Regression test for issue #7740 diff --git a/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs b/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs index 78d25117ff2..9721b08233e 100644 --- a/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs +++ b/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // This test verifies that casting from the same lifetime on a value diff --git a/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs b/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs index e9d7f6f3eb3..bdf7cc57a53 100644 --- a/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs +++ b/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/borrowck/borrowck-univariant-enum.rs b/src/test/run-pass/borrowck/borrowck-univariant-enum.rs index 0a8d3075336..c78e9475233 100644 --- a/src/test/run-pass/borrowck/borrowck-univariant-enum.rs +++ b/src/test/run-pass/borrowck/borrowck-univariant-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs b/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs index aba46ad609f..0487c179e36 100644 --- a/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs +++ b/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs b/src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs index 15eaf83b508..8f0434c0e2b 100644 --- a/src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs +++ b/src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(nll)] #![deny(unused_mut)] diff --git a/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs b/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs index 10809c1bb0b..bcd1d3ccd8a 100644 --- a/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs +++ b/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/borrowck/two-phase-baseline.rs b/src/test/run-pass/borrowck/two-phase-baseline.rs index 561a5b3c115..aa8d1831294 100644 --- a/src/test/run-pass/borrowck/two-phase-baseline.rs +++ b/src/test/run-pass/borrowck/two-phase-baseline.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -Z borrowck=mir -Z two-phase-borrows diff --git a/src/test/run-pass/borrowck/two-phase-bin-ops.rs b/src/test/run-pass/borrowck/two-phase-bin-ops.rs index ce601bc9a3c..5e1d436e31b 100644 --- a/src/test/run-pass/borrowck/two-phase-bin-ops.rs +++ b/src/test/run-pass/borrowck/two-phase-bin-ops.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // revisions: lxl nll diff --git a/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs b/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs index 6d06d0c7941..9759223a1ba 100644 --- a/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs +++ b/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // revisions: lxl nll //[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows diff --git a/src/test/run-pass/box-new.rs b/src/test/run-pass/box-new.rs index a2d76d33993..2d177bcf927 100644 --- a/src/test/run-pass/box-new.rs +++ b/src/test/run-pass/box-new.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 fn main() { diff --git a/src/test/run-pass/bug-7183-generics.rs b/src/test/run-pass/bug-7183-generics.rs index 80fd09114fc..72cfe1973a8 100644 --- a/src/test/run-pass/bug-7183-generics.rs +++ b/src/test/run-pass/bug-7183-generics.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Speak : Sized { fn say(&self, s:&str) -> String; fn hi(&self) -> String { hello(self) } diff --git a/src/test/run-pass/bug-7295.rs b/src/test/run-pass/bug-7295.rs index 89fd51bd5f1..b6dea6c82dc 100644 --- a/src/test/run-pass/bug-7295.rs +++ b/src/test/run-pass/bug-7295.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 pub trait Foo { diff --git a/src/test/run-pass/builtin-clone-unwind.rs b/src/test/run-pass/builtin-clone-unwind.rs index 6f8cdd1b4fc..fa278082912 100644 --- a/src/test/run-pass/builtin-clone-unwind.rs +++ b/src/test/run-pass/builtin-clone-unwind.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_imports)] // ignore-wasm32-bare compiled with panic=abort by default diff --git a/src/test/run-pass/builtin-clone.rs b/src/test/run-pass/builtin-clone.rs index 95903610931..2a9b98a6e33 100644 --- a/src/test/run-pass/builtin-clone.rs +++ b/src/test/run-pass/builtin-clone.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `Clone` is correctly implemented for builtin types. // Also test that cloning an array or a tuple is done right, i.e. // each component is cloned. diff --git a/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs b/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs index e028c3b9d4b..8ff70036ed2 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities-transitive.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests "transitivity" of super-builtin-kinds on traits. Here, if // we have a Foo, we know we have a Bar, and if we have a Bar, we // know we have a Send. So if we have a Foo we should know we have diff --git a/src/test/run-pass/builtin-superkinds-capabilities-xc.rs b/src/test/run-pass/builtin-superkinds-capabilities-xc.rs index 1a27eae1943..7af41cbf50b 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities-xc.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities-xc.rs @@ -1,14 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // aux-build:trait_superkinds_in_metadata.rs // Tests "capabilities" granted by traits with super-builtin-kinds, diff --git a/src/test/run-pass/builtin-superkinds-capabilities.rs b/src/test/run-pass/builtin-superkinds-capabilities.rs index 99a68790e76..2a2917b69b0 100644 --- a/src/test/run-pass/builtin-superkinds-capabilities.rs +++ b/src/test/run-pass/builtin-superkinds-capabilities.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests "capabilities" granted by traits that inherit from super- // builtin-kinds, e.g., if a trait requires Send to implement, then // at usage site of that trait, we know we have the Send capability. diff --git a/src/test/run-pass/builtin-superkinds-in-metadata.rs b/src/test/run-pass/builtin-superkinds-in-metadata.rs index 287e6829487..f585d9cc4f8 100644 --- a/src/test/run-pass/builtin-superkinds-in-metadata.rs +++ b/src/test/run-pass/builtin-superkinds-in-metadata.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] // aux-build:trait_superkinds_in_metadata.rs diff --git a/src/test/run-pass/builtin-superkinds-phantom-typaram.rs b/src/test/run-pass/builtin-superkinds-phantom-typaram.rs index 84601f68d16..3899ecf6f3f 100644 --- a/src/test/run-pass/builtin-superkinds-phantom-typaram.rs +++ b/src/test/run-pass/builtin-superkinds-phantom-typaram.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Tests that even when a type parameter doesn't implement a required // super-builtin-kind of a trait, if the type parameter is never used, diff --git a/src/test/run-pass/builtin-superkinds-simple.rs b/src/test/run-pass/builtin-superkinds-simple.rs index 8a954de9d0a..670b8ed0e9b 100644 --- a/src/test/run-pass/builtin-superkinds-simple.rs +++ b/src/test/run-pass/builtin-superkinds-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Simple test case of implementing a trait with super-builtin-kinds. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/builtin-superkinds-typaram.rs b/src/test/run-pass/builtin-superkinds-typaram.rs index 6d41774c05b..c3a456318bc 100644 --- a/src/test/run-pass/builtin-superkinds-typaram.rs +++ b/src/test/run-pass/builtin-superkinds-typaram.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests correct implementation of traits with super-builtin-kinds // using a bounded type parameter. diff --git a/src/test/run-pass/byte-literals.rs b/src/test/run-pass/byte-literals.rs index f5acb72429a..259ac08fd97 100644 --- a/src/test/run-pass/byte-literals.rs +++ b/src/test/run-pass/byte-literals.rs @@ -1,12 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // diff --git a/src/test/run-pass/c-stack-as-value.rs b/src/test/run-pass/c-stack-as-value.rs index df4989d89ab..3b997295c12 100644 --- a/src/test/run-pass/c-stack-as-value.rs +++ b/src/test/run-pass/c-stack-as-value.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] mod rustrt { extern crate libc; diff --git a/src/test/run-pass/c-stack-returning-int64.rs b/src/test/run-pass/c-stack-returning-int64.rs index 56a0437146b..f376bb7fde2 100644 --- a/src/test/run-pass/c-stack-returning-int64.rs +++ b/src/test/run-pass/c-stack-returning-int64.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare no libc to test with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/cabi-int-widening.rs b/src/test/run-pass/cabi-int-widening.rs index 5b1677c184c..f6524c6a3d9 100644 --- a/src/test/run-pass/cabi-int-widening.rs +++ b/src/test/run-pass/cabi-int-widening.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare no libc to test ffi with #[link(name = "rust_test_helpers", kind = "static")] diff --git a/src/test/run-pass/can-copy-pod.rs b/src/test/run-pass/can-copy-pod.rs index 31b27933522..bc10d236b36 100644 --- a/src/test/run-pass/can-copy-pod.rs +++ b/src/test/run-pass/can-copy-pod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 /* Any copyright is dedicated to the Public Domain. diff --git a/src/test/run-pass/cancel-clean-via-immediate-rvalue-ref.rs b/src/test/run-pass/cancel-clean-via-immediate-rvalue-ref.rs index ac309216250..f27803677cc 100644 --- a/src/test/run-pass/cancel-clean-via-immediate-rvalue-ref.rs +++ b/src/test/run-pass/cancel-clean-via-immediate-rvalue-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 #![feature(box_syntax)] diff --git a/src/test/run-pass/cast-does-fallback.rs b/src/test/run-pass/cast-does-fallback.rs index aa6752ffc35..6adf90fc0e6 100644 --- a/src/test/run-pass/cast-does-fallback.rs +++ b/src/test/run-pass/cast-does-fallback.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { // Test that these type check correctly. (&42u8 >> 4) as usize; diff --git a/src/test/run-pass/cast-region-to-uint.rs b/src/test/run-pass/cast-region-to-uint.rs index f5180ea260f..ef2f6f1c492 100644 --- a/src/test/run-pass/cast-region-to-uint.rs +++ b/src/test/run-pass/cast-region-to-uint.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let x: isize = 3; println!("&x={:x}", (&x as *const isize as usize)); diff --git a/src/test/run-pass/cast-rfc0401-vtable-kinds.rs b/src/test/run-pass/cast-rfc0401-vtable-kinds.rs index 32a155c13e6..e53ab791922 100644 --- a/src/test/run-pass/cast-rfc0401-vtable-kinds.rs +++ b/src/test/run-pass/cast-rfc0401-vtable-kinds.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that you can cast between different pointers to trait objects // whose vtable have the same kind (both lengths, or both trait pointers). diff --git a/src/test/run-pass/cast-rfc0401.rs b/src/test/run-pass/cast-rfc0401.rs index 022ed6c28c3..324860e53e1 100644 --- a/src/test/run-pass/cast-rfc0401.rs +++ b/src/test/run-pass/cast-rfc0401.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] use std::vec; diff --git a/src/test/run-pass/cast-to-infer-ty.rs b/src/test/run-pass/cast-to-infer-ty.rs index 2aa0d9c62fb..e29860cbfbf 100644 --- a/src/test/run-pass/cast-to-infer-ty.rs +++ b/src/test/run-pass/cast-to-infer-ty.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we allow a cast to `_` so long as the target type can be // inferred elsewhere. diff --git a/src/test/run-pass/cast.rs b/src/test/run-pass/cast.rs index b88854cd7fa..37add8446f4 100644 --- a/src/test/run-pass/cast.rs +++ b/src/test/run-pass/cast.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/src/test/run-pass/catch-unwind-bang.rs b/src/test/run-pass/catch-unwind-bang.rs index 849132b8ebf..6c6f5a4fcfd 100644 --- a/src/test/run-pass/catch-unwind-bang.rs +++ b/src/test/run-pass/catch-unwind-bang.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare compiled with panic=abort by default fn worker() -> ! { diff --git a/src/test/run-pass/cell-does-not-clone.rs b/src/test/run-pass/cell-does-not-clone.rs index 9f26ee818e6..7ba6419d8a3 100644 --- a/src/test/run-pass/cell-does-not-clone.rs +++ b/src/test/run-pass/cell-does-not-clone.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] use std::cell::Cell; diff --git a/src/test/run-pass/cfg/auxiliary/cfg_inner_static.rs b/src/test/run-pass/cfg/auxiliary/cfg_inner_static.rs index b5b4390657b..6a619a4e768 100644 --- a/src/test/run-pass/cfg/auxiliary/cfg_inner_static.rs +++ b/src/test/run-pass/cfg/auxiliary/cfg_inner_static.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // this used to just ICE on compiling pub fn foo() { if cfg!(foo) { diff --git a/src/test/run-pass/cfg/auxiliary/crate-attributes-using-cfg_attr.rs b/src/test/run-pass/cfg/auxiliary/crate-attributes-using-cfg_attr.rs index 0028b51f9d1..1e0f5d79c0b 100644 --- a/src/test/run-pass/cfg/auxiliary/crate-attributes-using-cfg_attr.rs +++ b/src/test/run-pass/cfg/auxiliary/crate-attributes-using-cfg_attr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // compile-flags: --cfg foo diff --git a/src/test/run-pass/cfg/cfg-attr-cfg.rs b/src/test/run-pass/cfg/cfg-attr-cfg.rs index 6e3d8f2e7f1..61794e0bfa9 100644 --- a/src/test/run-pass/cfg/cfg-attr-cfg.rs +++ b/src/test/run-pass/cfg/cfg-attr-cfg.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // main is conditionally compiled, but the conditional compilation // is conditional too! diff --git a/src/test/run-pass/cfg/cfg-attr-crate.rs b/src/test/run-pass/cfg/cfg-attr-crate.rs index d352e53f231..1d70f2f84f2 100644 --- a/src/test/run-pass/cfg/cfg-attr-crate.rs +++ b/src/test/run-pass/cfg/cfg-attr-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044 diff --git a/src/test/run-pass/cfg/cfg-family.rs b/src/test/run-pass/cfg/cfg-family.rs index 0a1241cccb8..282ac4abcee 100644 --- a/src/test/run-pass/cfg/cfg-family.rs +++ b/src/test/run-pass/cfg/cfg-family.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 // ignore-cloudabi no target_family diff --git a/src/test/run-pass/cfg/cfg-in-crate-1.rs b/src/test/run-pass/cfg/cfg-in-crate-1.rs index e66c8324f36..e84300aa331 100644 --- a/src/test/run-pass/cfg/cfg-in-crate-1.rs +++ b/src/test/run-pass/cfg/cfg-in-crate-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: --cfg bar -D warnings #![cfg(bar)] diff --git a/src/test/run-pass/cfg/cfg-macros-foo.rs b/src/test/run-pass/cfg/cfg-macros-foo.rs index 6729d205410..8b112c7961b 100644 --- a/src/test/run-pass/cfg/cfg-macros-foo.rs +++ b/src/test/run-pass/cfg/cfg-macros-foo.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: --cfg foo diff --git a/src/test/run-pass/cfg/cfg-macros-notfoo.rs b/src/test/run-pass/cfg/cfg-macros-notfoo.rs index 2e9614cf8af..292d97821cd 100644 --- a/src/test/run-pass/cfg/cfg-macros-notfoo.rs +++ b/src/test/run-pass/cfg/cfg-macros-notfoo.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: diff --git a/src/test/run-pass/cfg/cfg-match-arm.rs b/src/test/run-pass/cfg/cfg-match-arm.rs index 8a7271c38ce..071008f9eb6 100644 --- a/src/test/run-pass/cfg/cfg-match-arm.rs +++ b/src/test/run-pass/cfg/cfg-match-arm.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/cfg/cfg-target-family.rs b/src/test/run-pass/cfg/cfg-target-family.rs index 3345df69d87..2cd0ba5bf88 100644 --- a/src/test/run-pass/cfg/cfg-target-family.rs +++ b/src/test/run-pass/cfg/cfg-target-family.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no target_family // ignore-wasm32-bare no target_family diff --git a/src/test/run-pass/cfg/cfg-target-vendor.rs b/src/test/run-pass/cfg/cfg-target-vendor.rs index 08daa67827b..7824585162e 100644 --- a/src/test/run-pass/cfg/cfg-target-vendor.rs +++ b/src/test/run-pass/cfg/cfg-target-vendor.rs @@ -1,16 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -#![feature(cfg_target_vendor)] - #[cfg(target_vendor = "unknown")] pub fn main() { } diff --git a/src/test/run-pass/cfg/cfg_attr.rs b/src/test/run-pass/cfg/cfg_attr.rs index e9f83e1112f..c959e68acf9 100644 --- a/src/test/run-pass/cfg/cfg_attr.rs +++ b/src/test/run-pass/cfg/cfg_attr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags:--cfg set1 --cfg set2 #![allow(dead_code)] diff --git a/src/test/run-pass/cfg/cfg_inner_static.rs b/src/test/run-pass/cfg/cfg_inner_static.rs index e711132e16a..45dbbcc1084 100644 --- a/src/test/run-pass/cfg/cfg_inner_static.rs +++ b/src/test/run-pass/cfg/cfg_inner_static.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cfg_inner_static.rs diff --git a/src/test/run-pass/cfg/cfg_stmt_expr.rs b/src/test/run-pass/cfg/cfg_stmt_expr.rs index 405cc402e59..e466ad69f72 100644 --- a/src/test/run-pass/cfg/cfg_stmt_expr.rs +++ b/src/test/run-pass/cfg/cfg_stmt_expr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_mut)] diff --git a/src/test/run-pass/cfg/cfgs-on-items.rs b/src/test/run-pass/cfg/cfgs-on-items.rs index d8011827f66..9f2fc49423e 100644 --- a/src/test/run-pass/cfg/cfgs-on-items.rs +++ b/src/test/run-pass/cfg/cfgs-on-items.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: --cfg fooA --cfg fooB diff --git a/src/test/run-pass/cfg/conditional-compile-arch.rs b/src/test/run-pass/cfg/conditional-compile-arch.rs index 2eafd8f854d..ea3affee406 100644 --- a/src/test/run-pass/cfg/conditional-compile-arch.rs +++ b/src/test/run-pass/cfg/conditional-compile-arch.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/cfg/conditional-compile.rs b/src/test/run-pass/cfg/conditional-compile.rs index 0328a62588c..de5bd5f07dd 100644 --- a/src/test/run-pass/cfg/conditional-compile.rs +++ b/src/test/run-pass/cfg/conditional-compile.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/cfg/crate-attributes-using-cfg_attr.rs b/src/test/run-pass/cfg/crate-attributes-using-cfg_attr.rs index 0d817df7cdc..43b266b778f 100644 --- a/src/test/run-pass/cfg/crate-attributes-using-cfg_attr.rs +++ b/src/test/run-pass/cfg/crate-attributes-using-cfg_attr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:crate-attributes-using-cfg_attr.rs diff --git a/src/test/run-pass/chalkify/inherent_impl.rs b/src/test/run-pass/chalkify/inherent_impl.rs new file mode 100644 index 00000000000..fbe30f11544 --- /dev/null +++ b/src/test/run-pass/chalkify/inherent_impl.rs @@ -0,0 +1,41 @@ +// compile-flags: -Z chalk + +trait Foo { } + +impl Foo for i32 { } + +struct S { + x: T, +} + +fn only_foo(_x: &T) { } + +impl S { + // Test that we have the correct environment inside an inherent method. + fn dummy_foo(&self) { + only_foo(&self.x) + } +} + +trait Bar { } +impl Bar for u32 { } + +fn only_bar() { } + +impl S { + // Test that the environment of `dummy_bar` adds up with the environment + // of the inherent impl. + fn dummy_bar(&self) { + only_foo(&self.x); + only_bar::(); + } +} + +fn main() { + let s = S { + x: 5, + }; + + s.dummy_foo(); + s.dummy_bar::(); +} diff --git a/src/test/run-pass/chalkify/projection.rs b/src/test/run-pass/chalkify/projection.rs new file mode 100644 index 00000000000..a598f68d3f9 --- /dev/null +++ b/src/test/run-pass/chalkify/projection.rs @@ -0,0 +1,24 @@ +// compile-flags: -Z chalk + +trait Foo { } + +trait Bar { + type Item: Foo; +} + +impl Foo for i32 { } +impl Bar for i32 { + type Item = i32; +} + +fn only_foo() { } + +fn only_bar() { + // `T` implements `Bar` hence `::Item` must also implement `Bar` + only_foo::() +} + +fn main() { + only_bar::(); + only_foo::<::Item>(); +} diff --git a/src/test/run-pass/chalkify/super_trait.rs b/src/test/run-pass/chalkify/super_trait.rs new file mode 100644 index 00000000000..441d61ef248 --- /dev/null +++ b/src/test/run-pass/chalkify/super_trait.rs @@ -0,0 +1,18 @@ +// compile-flags: -Z chalk + +trait Foo { } +trait Bar: Foo { } + +impl Foo for i32 { } +impl Bar for i32 { } + +fn only_foo() { } + +fn only_bar() { + // `T` implements `Bar` hence `T` must also implement `Foo` + only_foo::() +} + +fn main() { + only_bar::() +} diff --git a/src/test/run-pass/chalkify/trait_implied_bound.rs b/src/test/run-pass/chalkify/trait_implied_bound.rs new file mode 100644 index 00000000000..f82453792ff --- /dev/null +++ b/src/test/run-pass/chalkify/trait_implied_bound.rs @@ -0,0 +1,17 @@ +// compile-flags: -Z chalk + +trait Foo { } +trait Bar where U: Foo { } + +impl Foo for i32 { } +impl Bar for i32 { } + +fn only_foo() { } + +fn only_bar>() { + only_foo::() +} + +fn main() { + only_bar::() +} diff --git a/src/test/run-pass/chalkify/type_implied_bound.rs b/src/test/run-pass/chalkify/type_implied_bound.rs new file mode 100644 index 00000000000..94d976d3242 --- /dev/null +++ b/src/test/run-pass/chalkify/type_implied_bound.rs @@ -0,0 +1,28 @@ +// compile-flags: -Z chalk + +trait Eq { } +trait Hash: Eq { } + +impl Eq for i32 { } +impl Hash for i32 { } + +struct Set { + _x: T, +} + +fn only_eq() { } + +fn take_a_set(_: &Set) { + // `Set` is an input type of `take_a_set`, hence we know that + // `T` must implement `Hash`, and we know in turn that `T` must + // implement `Eq`. + only_eq::() +} + +fn main() { + let set = Set { + _x: 5, + }; + + take_a_set(&set); +} diff --git a/src/test/run-pass/char.rs b/src/test/run-pass/char.rs index d63512f8066..1616d666c1b 100644 --- a/src/test/run-pass/char.rs +++ b/src/test/run-pass/char.rs @@ -1,16 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - pub fn main() { let c: char = 'x'; let d: char = 'x'; diff --git a/src/test/run-pass/char_unicode.rs b/src/test/run-pass/char_unicode.rs index bfc7faac06e..90ec26e80bb 100644 --- a/src/test/run-pass/char_unicode.rs +++ b/src/test/run-pass/char_unicode.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unicode_version)] /// Tests access to the internal Unicode Version type and value. diff --git a/src/test/run-pass/check-static-recursion-foreign.rs b/src/test/run-pass/check-static-recursion-foreign.rs index a95870c2b27..c423bf666e5 100644 --- a/src/test/run-pass/check-static-recursion-foreign.rs +++ b/src/test/run-pass/check-static-recursion-foreign.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Static recursion check shouldn't fail when given a foreign item (#18279) @@ -16,7 +6,7 @@ // pretty-expanded FIXME #23616 -#![feature(custom_attribute, libc)] +#![feature(custom_attribute, rustc_private)] extern crate check_static_recursion_foreign_helper; extern crate libc; diff --git a/src/test/run-pass/check_const-feature-gated.rs b/src/test/run-pass/check_const-feature-gated.rs index ae27b76c747..1c816d5d7c3 100644 --- a/src/test/run-pass/check_const-feature-gated.rs +++ b/src/test/run-pass/check_const-feature-gated.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const ARR: [usize; 1] = [2]; fn main() { diff --git a/src/test/run-pass/child-outlives-parent.rs b/src/test/run-pass/child-outlives-parent.rs index 03c80e49741..80e3c81af52 100644 --- a/src/test/run-pass/child-outlives-parent.rs +++ b/src/test/run-pass/child-outlives-parent.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Reported as issue #126, child leaks the string. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/cleanup-arm-conditional.rs b/src/test/run-pass/cleanup-arm-conditional.rs index 6ff3aff45cb..b8b10990520 100644 --- a/src/test/run-pass/cleanup-arm-conditional.rs +++ b/src/test/run-pass/cleanup-arm-conditional.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] #![allow(unused_imports)] // Test that cleanup scope for temporaries created in a match diff --git a/src/test/run-pass/cleanup-rvalue-during-if-and-while.rs b/src/test/run-pass/cleanup-rvalue-during-if-and-while.rs index b117f4abd95..370c95c6668 100644 --- a/src/test/run-pass/cleanup-rvalue-during-if-and-while.rs +++ b/src/test/run-pass/cleanup-rvalue-during-if-and-while.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test verifies that temporaries created for `while`'s and `if` // conditions are dropped after the condition is evaluated. diff --git a/src/test/run-pass/cleanup-rvalue-for-scope.rs b/src/test/run-pass/cleanup-rvalue-for-scope.rs index 4f8ded9012f..488c6e580d1 100644 --- a/src/test/run-pass/cleanup-rvalue-for-scope.rs +++ b/src/test/run-pass/cleanup-rvalue-for-scope.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/cleanup-rvalue-scopes.rs b/src/test/run-pass/cleanup-rvalue-scopes.rs index 8cf014a4d2a..331c93f442e 100644 --- a/src/test/run-pass/cleanup-rvalue-scopes.rs +++ b/src/test/run-pass/cleanup-rvalue-scopes.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] #![allow(unused_variables)] // Test that destructors for rvalue temporaries run either at end of diff --git a/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs b/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs index 90b2031afd4..7b4d66e7571 100644 --- a/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs +++ b/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/cleanup-shortcircuit.rs b/src/test/run-pass/cleanup-shortcircuit.rs index 2460fa92925..118fa0083ab 100644 --- a/src/test/run-pass/cleanup-shortcircuit.rs +++ b/src/test/run-pass/cleanup-shortcircuit.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that cleanups for the RHS of shortcircuiting operators work. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/clone-with-exterior.rs b/src/test/run-pass/clone-with-exterior.rs index 0358eec0d76..1d3b54aa5eb 100644 --- a/src/test/run-pass/clone-with-exterior.rs +++ b/src/test/run-pass/clone-with-exterior.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/close-over-big-then-small-data.rs b/src/test/run-pass/close-over-big-then-small-data.rs index 44778517c44..2ae0b6c7d3d 100644 --- a/src/test/run-pass/close-over-big-then-small-data.rs +++ b/src/test/run-pass/close-over-big-then-small-data.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // If we use GEPi rather than GEP_tup_like when // storing closure data (as we used to do), the u64 would diff --git a/src/test/run-pass/cmp-default.rs b/src/test/run-pass/cmp-default.rs index d4b570a4db6..3be0eb4c5d5 100644 --- a/src/test/run-pass/cmp-default.rs +++ b/src/test/run-pass/cmp-default.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::cmp::Ordering; // Test default methods in PartialOrd and PartialEq diff --git a/src/test/run-pass/codegen-object-shim.rs b/src/test/run-pass/codegen-object-shim.rs index 5fbfef05e10..4e2d7ac6086 100644 --- a/src/test/run-pass/codegen-object-shim.rs +++ b/src/test/run-pass/codegen-object-shim.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { assert_eq!((ToString::to_string as fn(&(ToString+'static)) -> String)(&"foo"), String::from("foo")); diff --git a/src/test/run-pass/coerce/coerce-expect-unsized.rs b/src/test/run-pass/coerce/coerce-expect-unsized.rs index cb0fd0b7504..a7e80afbf76 100644 --- a/src/test/run-pass/coerce/coerce-expect-unsized.rs +++ b/src/test/run-pass/coerce/coerce-expect-unsized.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs b/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs index 9f3ef90f9d9..3fe18103ef8 100644 --- a/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs +++ b/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs index 4c6510f9b9b..f033e1b5d2b 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-rcvr.rs b/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-rcvr.rs index 0b76375fba1..64a365229cb 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-rcvr.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-rcvr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct SpeechMaker { diff --git a/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs index 3d61db475da..c2aaae1c73e 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coerce/coerce-reborrow-imm-vec-rcvr.rs b/src/test/run-pass/coerce/coerce-reborrow-imm-vec-rcvr.rs index 4faf6dadbef..9a5652acf87 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-imm-vec-rcvr.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-imm-vec-rcvr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs index 7d851bb8bd2..76cd6793b3c 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs b/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs index 42f710299ff..e6e7c3a51aa 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coerce/coerce-reborrow-mut-vec-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-mut-vec-arg.rs index 25a73c3d2d6..2635754f14d 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-mut-vec-arg.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-mut-vec-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/coerce/coerce-reborrow-mut-vec-rcvr.rs b/src/test/run-pass/coerce/coerce-reborrow-mut-vec-rcvr.rs index 04b884620b6..c03336ea37a 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-mut-vec-rcvr.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-mut-vec-rcvr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/coerce/coerce-unify-return.rs b/src/test/run-pass/coerce/coerce-unify-return.rs index 2b276f2cfe4..95a7ee8fe0f 100644 --- a/src/test/run-pass/coerce/coerce-unify-return.rs +++ b/src/test/run-pass/coerce/coerce-unify-return.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that coercions unify the expected return type of a polymorphic // function call, instead of leaving the type variables as they were. diff --git a/src/test/run-pass/coerce/coerce-unify.rs b/src/test/run-pass/coerce/coerce-unify.rs index 575d672e092..f1818f9bb5a 100644 --- a/src/test/run-pass/coerce/coerce-unify.rs +++ b/src/test/run-pass/coerce/coerce-unify.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that coercions can unify if-else, match arms and array elements. @@ -47,7 +37,7 @@ macro_rules! check3 { check2!($b, $c); check2!($a, $c); - // Check the remaining cases, i.e. permutations of ($a, $b, $c). + // Check the remaining cases, i.e., permutations of ($a, $b, $c). check!($a, $b, $c); check!($a, $c, $b); check!($b, $a, $c); diff --git a/src/test/run-pass/coerce/coerce-unsize-subtype.rs b/src/test/run-pass/coerce/coerce-unsize-subtype.rs index 068b010da1e..45b53300c5b 100644 --- a/src/test/run-pass/coerce/coerce-unsize-subtype.rs +++ b/src/test/run-pass/coerce/coerce-unsize-subtype.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 @@ -32,7 +22,7 @@ fn long_to_short_rc<'a, T>(xs: Rc<[&'static T; 1]>) -> Rc<[&'a T]> { } // LUB-coercion (if-else/match/array) coerces `xs: &'b [&'static T: N]` -// to a subtype of the LUB of `xs` and `ys` (i.e. `&'b [&'a T]`), +// to a subtype of the LUB of `xs` and `ys` (i.e., `&'b [&'a T]`), // regardless of the order they appear (in if-else/match/array). fn long_and_short_lub1<'a, 'b, T>(xs: &'b [&'static T; 1], ys: &'b [&'a T]) { let _order1 = [xs, ys]; @@ -40,7 +30,7 @@ fn long_and_short_lub1<'a, 'b, T>(xs: &'b [&'static T; 1], ys: &'b [&'a T]) { } // LUB-coercion should also have the exact same effect when `&'b [&'a T; N]` -// needs to be coerced, i.e. the resulting type is not &'b [&'static T], but +// needs to be coerced, i.e., the resulting type is not &'b [&'static T], but // rather the `&'b [&'a T]` LUB. fn long_and_short_lub2<'a, 'b, T>(xs: &'b [&'static T], ys: &'b [&'a T; 1]) { let _order1 = [xs, ys]; diff --git a/src/test/run-pass/coherence/auxiliary/coherence_copy_like_lib.rs b/src/test/run-pass/coherence/auxiliary/coherence_copy_like_lib.rs index d3d389c6a8b..b5b4802c112 100644 --- a/src/test/run-pass/coherence/auxiliary/coherence_copy_like_lib.rs +++ b/src/test/run-pass/coherence/auxiliary/coherence_copy_like_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![feature(fundamental)] diff --git a/src/test/run-pass/coherence/auxiliary/coherence_lib.rs b/src/test/run-pass/coherence/auxiliary/coherence_lib.rs index daa123849e4..9a5ec824306 100644 --- a/src/test/run-pass/coherence/auxiliary/coherence_lib.rs +++ b/src/test/run-pass/coherence/auxiliary/coherence_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub trait Remote { diff --git a/src/test/run-pass/coherence/auxiliary/re_rebalance_coherence_lib.rs b/src/test/run-pass/coherence/auxiliary/re_rebalance_coherence_lib.rs new file mode 100644 index 00000000000..c8d027b25c7 --- /dev/null +++ b/src/test/run-pass/coherence/auxiliary/re_rebalance_coherence_lib.rs @@ -0,0 +1,23 @@ + +pub trait Backend{} +pub trait SupportsDefaultKeyword {} + +impl SupportsDefaultKeyword for Postgres {} + +pub struct Postgres; + +impl Backend for Postgres {} + +pub struct AstPass(::std::marker::PhantomData); + +pub trait QueryFragment {} + + +#[derive(Debug, Clone, Copy)] +pub struct BatchInsert<'a, T: 'a, Tab> { + _marker: ::std::marker::PhantomData<(&'a T, Tab)>, +} + +impl<'a, T:'a, Tab, DB> QueryFragment for BatchInsert<'a, T, Tab> +where DB: SupportsDefaultKeyword + Backend, +{} diff --git a/src/test/run-pass/coherence/coherence-bigint-int.rs b/src/test/run-pass/coherence/coherence-bigint-int.rs index 62736b1f368..0c9abdc15e6 100644 --- a/src/test/run-pass/coherence/coherence-bigint-int.rs +++ b/src/test/run-pass/coherence/coherence-bigint-int.rs @@ -1,15 +1,8 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-bigint-vecint.rs b/src/test/run-pass/coherence/coherence-bigint-vecint.rs index 372f38738e5..38e0be0aa9a 100644 --- a/src/test/run-pass/coherence/coherence-bigint-vecint.rs +++ b/src/test/run-pass/coherence/coherence-bigint-vecint.rs @@ -1,15 +1,8 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-blanket.rs b/src/test/run-pass/coherence/coherence-blanket.rs index 93bfdd2fdd2..5d310cc2c6a 100644 --- a/src/test/run-pass/coherence/coherence-blanket.rs +++ b/src/test/run-pass/coherence/coherence-blanket.rs @@ -1,16 +1,9 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-covered-type-parameter.rs b/src/test/run-pass/coherence/coherence-covered-type-parameter.rs index 8cbafdf7177..1cf039f0831 100644 --- a/src/test/run-pass/coherence/coherence-covered-type-parameter.rs +++ b/src/test/run-pass/coherence/coherence-covered-type-parameter.rs @@ -1,16 +1,9 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-impl-in-fn.rs b/src/test/run-pass/coherence/coherence-impl-in-fn.rs index b6915919acb..09e2c1e5a4e 100644 --- a/src/test/run-pass/coherence/coherence-impl-in-fn.rs +++ b/src/test/run-pass/coherence/coherence-impl-in-fn.rs @@ -1,14 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs b/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs index f56c827b55d..051cc280b2d 100644 --- a/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs +++ b/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs @@ -1,14 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] // aux-build:coherence_lib.rs diff --git a/src/test/run-pass/coherence/coherence-iterator-vec.rs b/src/test/run-pass/coherence/coherence-iterator-vec.rs index 16501553d9f..df6e808f7de 100644 --- a/src/test/run-pass/coherence/coherence-iterator-vec.rs +++ b/src/test/run-pass/coherence/coherence-iterator-vec.rs @@ -1,14 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] // aux-build:coherence_lib.rs diff --git a/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs b/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs index f6d711bd6cd..6a816664c48 100644 --- a/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs +++ b/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs @@ -1,14 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(unused_imports)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-negative-impls-safe.rs b/src/test/run-pass/coherence/coherence-negative-impls-safe.rs index 50b3500ad8d..98b04489ac4 100644 --- a/src/test/run-pass/coherence/coherence-negative-impls-safe.rs +++ b/src/test/run-pass/coherence/coherence-negative-impls-safe.rs @@ -1,14 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-rfc447-constrained.rs b/src/test/run-pass/coherence/coherence-rfc447-constrained.rs index 5db8188e1ff..4da54d386fd 100644 --- a/src/test/run-pass/coherence/coherence-rfc447-constrained.rs +++ b/src/test/run-pass/coherence/coherence-rfc447-constrained.rs @@ -1,14 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // check that trait matching can handle impls whose types are only // constrained by a projection. diff --git a/src/test/run-pass/coherence/coherence-subtyping.rs b/src/test/run-pass/coherence/coherence-subtyping.rs deleted file mode 100644 index 0dcd83f87b8..00000000000 --- a/src/test/run-pass/coherence/coherence-subtyping.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that two distinct impls which match subtypes of one another -// yield coherence errors (or not) depending on the variance. - -trait Contravariant { - fn foo(&self) { } -} - -impl Contravariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { -} - -impl Contravariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { -} - -/////////////////////////////////////////////////////////////////////////// - -trait Covariant { - fn foo(&self) { } -} - -impl Covariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { -} - -impl Covariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { -} - -/////////////////////////////////////////////////////////////////////////// - -trait Invariant { - fn foo(&self) { } -} - -impl Invariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { -} - -impl Invariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { -} - -fn main() { } diff --git a/src/test/run-pass/coherence/coherence-where-clause.rs b/src/test/run-pass/coherence/coherence-where-clause.rs index 9691978466b..28397420385 100644 --- a/src/test/run-pass/coherence/coherence-where-clause.rs +++ b/src/test/run-pass/coherence/coherence-where-clause.rs @@ -1,14 +1,8 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + use std::fmt::Debug; use std::default::Default; diff --git a/src/test/run-pass/coherence/coherence_copy_like.rs b/src/test/run-pass/coherence/coherence_copy_like.rs index f637ac64908..653f76264c1 100644 --- a/src/test/run-pass/coherence/coherence_copy_like.rs +++ b/src/test/run-pass/coherence/coherence_copy_like.rs @@ -1,14 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. diff --git a/src/test/run-pass/coherence/re-rebalance-coherence.rs b/src/test/run-pass/coherence/re-rebalance-coherence.rs new file mode 100644 index 00000000000..bacd3b89fad --- /dev/null +++ b/src/test/run-pass/coherence/re-rebalance-coherence.rs @@ -0,0 +1,14 @@ +#![allow(dead_code)] +#![feature(re_rebalance_coherence)] + +// run-pass +// aux-build:re_rebalance_coherence_lib.rs + +extern crate re_rebalance_coherence_lib as lib; +use lib::*; + +struct Oracle; +impl Backend for Oracle {} +impl<'a, T:'a, Tab> QueryFragment for BatchInsert<'a, T, Tab> {} + +fn main() {} diff --git a/src/test/run-pass/collections-const-new.rs b/src/test/run-pass/collections-const-new.rs index 462dc42dbc2..37ee1a41c0b 100644 --- a/src/test/run-pass/collections-const-new.rs +++ b/src/test/run-pass/collections-const-new.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Test several functions can be used for constants // 1. Vec::new() diff --git a/src/test/run-pass/command-before-exec.rs b/src/test/run-pass/command-before-exec.rs index 5d8bc31c2a3..91d2636b2ae 100644 --- a/src/test/run-pass/command-before-exec.rs +++ b/src/test/run-pass/command-before-exec.rs @@ -1,19 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] // ignore-windows - this is a unix-specific test // ignore-cloudabi no processes // ignore-emscripten no processes -#![feature(process_exec, libc)] +#![feature(process_exec, rustc_private)] extern crate libc; diff --git a/src/test/run-pass/command-exec.rs b/src/test/run-pass/command-exec.rs index f662945c0cf..ab3d3ebbaad 100644 --- a/src/test/run-pass/command-exec.rs +++ b/src/test/run-pass/command-exec.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] // ignore-windows - this is a unix-specific test // ignore-pretty issue #37199 diff --git a/src/test/run-pass/compiletest-skip-codegen.rs b/src/test/run-pass/compiletest-skip-codegen.rs index d318b8fa44b..3c0e2261312 100644 --- a/src/test/run-pass/compiletest-skip-codegen.rs +++ b/src/test/run-pass/compiletest-skip-codegen.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that with the `skip-codegen` option the test isn't executed. // skip-codegen diff --git a/src/test/run-pass/complex.rs b/src/test/run-pass/complex.rs index b31f4d39f82..4c2bb6859dd 100644 --- a/src/test/run-pass/complex.rs +++ b/src/test/run-pass/complex.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unconditional_recursion)] #![allow(non_camel_case_types)] #![allow(dead_code)] diff --git a/src/test/run-pass/concat.rs b/src/test/run-pass/concat.rs index 9a2390a9e68..e89763745be 100644 --- a/src/test/run-pass/concat.rs +++ b/src/test/run-pass/concat.rs @@ -1,14 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub fn main() { assert_eq!(format!(concat!("foo", "bar", "{}"), "baz"), "foobarbaz".to_string()); assert_eq!(format!(concat!()), "".to_string()); diff --git a/src/test/run-pass/const-int-conversion.rs b/src/test/run-pass/const-int-conversion.rs index 790c62288d3..19d65860179 100644 --- a/src/test/run-pass/const-int-conversion.rs +++ b/src/test/run-pass/const-int-conversion.rs @@ -1,14 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(const_int_conversion, const_int_ops, reverse_bits, int_to_from_bytes)] +#![feature(const_int_conversion, reverse_bits)] const REVERSE: u32 = 0x12345678_u32.reverse_bits(); const FROM_BE_BYTES: i32 = i32::from_be_bytes([0x12, 0x34, 0x56, 0x78]); @@ -31,4 +21,3 @@ fn main() { assert_eq!(TO_LE_BYTES, ident([0x78, 0x56, 0x34, 0x12])); assert_eq!(TO_NE_BYTES, ident([0x80, 0, 0, 0])); } - diff --git a/src/test/run-pass/const-int-overflowing.rs b/src/test/run-pass/const-int-overflowing.rs index 0f8f230f456..289b1236cf1 100644 --- a/src/test/run-pass/const-int-overflowing.rs +++ b/src/test/run-pass/const-int-overflowing.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(const_int_overflowing)] - const ADD_A: (u32, bool) = 5u32.overflowing_add(2); const ADD_B: (u32, bool) = u32::max_value().overflowing_add(1); diff --git a/src/test/run-pass/const-int-rotate.rs b/src/test/run-pass/const-int-rotate.rs index ee8e0b0b9dd..c014e97ef19 100644 --- a/src/test/run-pass/const-int-rotate.rs +++ b/src/test/run-pass/const-int-rotate.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(const_int_rotate)] - const LEFT: u32 = 0x10000b3u32.rotate_left(8); const RIGHT: u32 = 0xb301u32.rotate_right(8); diff --git a/src/test/run-pass/const-int-sign.rs b/src/test/run-pass/const-int-sign.rs index e095cfb000c..9d656a02030 100644 --- a/src/test/run-pass/const-int-sign.rs +++ b/src/test/run-pass/const-int-sign.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(const_int_sign)] - const NEGATIVE_A: bool = (-10i32).is_negative(); const NEGATIVE_B: bool = 10i32.is_negative(); const POSITIVE_A: bool= (-10i32).is_positive(); diff --git a/src/test/run-pass/const-int-wrapping.rs b/src/test/run-pass/const-int-wrapping.rs index ab7c98f9824..5ab712015df 100644 --- a/src/test/run-pass/const-int-wrapping.rs +++ b/src/test/run-pass/const-int-wrapping.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(const_int_wrapping)] - const ADD_A: u32 = 200u32.wrapping_add(55); const ADD_B: u32 = 200u32.wrapping_add(u32::max_value()); diff --git a/src/test/run-pass/const-needs_drop.rs b/src/test/run-pass/const-needs_drop.rs index edf3a6b3dcd..9d9dffb5307 100644 --- a/src/test/run-pass/const-needs_drop.rs +++ b/src/test/run-pass/const-needs_drop.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_needs_drop)] use std::mem; diff --git a/src/test/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs index 741ce351da3..948b5e688eb 100644 --- a/src/test/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs +++ b/src/test/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs @@ -1,15 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="anonexternmod"] -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/consts/auxiliary/cci_borrow_lib.rs b/src/test/run-pass/consts/auxiliary/cci_borrow_lib.rs index 9c90510a857..7c57a1c6678 100644 --- a/src/test/run-pass/consts/auxiliary/cci_borrow_lib.rs +++ b/src/test/run-pass/consts/auxiliary/cci_borrow_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo(x: &usize) -> usize { *x } diff --git a/src/test/run-pass/consts/auxiliary/cci_const.rs b/src/test/run-pass/consts/auxiliary/cci_const.rs index ee8290050f9..af6a5ad8ed3 100644 --- a/src/test/run-pass/consts/auxiliary/cci_const.rs +++ b/src/test/run-pass/consts/auxiliary/cci_const.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub extern fn bar() { } diff --git a/src/test/run-pass/consts/auxiliary/cci_const_block.rs b/src/test/run-pass/consts/auxiliary/cci_const_block.rs index 76fe9fe5aa4..ad618aab830 100644 --- a/src/test/run-pass/consts/auxiliary/cci_const_block.rs +++ b/src/test/run-pass/consts/auxiliary/cci_const_block.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub static BLOCK_FN_DEF: fn(usize) -> usize = { fn foo(a: usize) -> usize { a + 10 diff --git a/src/test/run-pass/consts/auxiliary/const_fn_lib.rs b/src/test/run-pass/consts/auxiliary/const_fn_lib.rs index c6ac35bfb10..95440607ae3 100644 --- a/src/test/run-pass/consts/auxiliary/const_fn_lib.rs +++ b/src/test/run-pass/consts/auxiliary/const_fn_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Crate that exports a const fn. Used for testing cross-crate. #![crate_type="rlib"] diff --git a/src/test/run-pass/consts/const-adt-align-mismatch.rs b/src/test/run-pass/consts/const-adt-align-mismatch.rs index 057da22e270..bd51bc9f215 100644 --- a/src/test/run-pass/consts/const-adt-align-mismatch.rs +++ b/src/test/run-pass/consts/const-adt-align-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(deprecated)] diff --git a/src/test/run-pass/consts/const-autoderef.rs b/src/test/run-pass/consts/const-autoderef.rs index 939f7d4441a..1c836318d32 100644 --- a/src/test/run-pass/consts/const-autoderef.rs +++ b/src/test/run-pass/consts/const-autoderef.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const A: [u8; 1] = ['h' as u8]; diff --git a/src/test/run-pass/consts/const-big-enum.rs b/src/test/run-pass/consts/const-big-enum.rs index 1ad46fa4106..2f21e8a6ddd 100644 --- a/src/test/run-pass/consts/const-big-enum.rs +++ b/src/test/run-pass/consts/const-big-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass enum Foo { diff --git a/src/test/run-pass/consts/const-binops.rs b/src/test/run-pass/consts/const-binops.rs index 2e90a458aee..d038dfeb419 100644 --- a/src/test/run-pass/consts/const-binops.rs +++ b/src/test/run-pass/consts/const-binops.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! assert_approx_eq { diff --git a/src/test/run-pass/consts/const-bitshift-rhs-inference.rs b/src/test/run-pass/consts/const-bitshift-rhs-inference.rs index 63b8af77326..cf21c296cf3 100644 --- a/src/test/run-pass/consts/const-bitshift-rhs-inference.rs +++ b/src/test/run-pass/consts/const-bitshift-rhs-inference.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const RHS: u8 = 8; const IRHS: i8 = 8; diff --git a/src/test/run-pass/consts/const-block-cross-crate-fn.rs b/src/test/run-pass/consts/const-block-cross-crate-fn.rs index c7d156fcf19..0ac3830d230 100644 --- a/src/test/run-pass/consts/const-block-cross-crate-fn.rs +++ b/src/test/run-pass/consts/const-block-cross-crate-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_const_block.rs diff --git a/src/test/run-pass/consts/const-block-item-macro-codegen.rs b/src/test/run-pass/consts/const-block-item-macro-codegen.rs index 7a0d0781a1f..7ad883686ae 100644 --- a/src/test/run-pass/consts/const-block-item-macro-codegen.rs +++ b/src/test/run-pass/consts/const-block-item-macro-codegen.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // General test that function items in static blocks diff --git a/src/test/run-pass/consts/const-block-item.rs b/src/test/run-pass/consts/const-block-item.rs index 83e50eba6dc..cf0d4441d4a 100644 --- a/src/test/run-pass/consts/const-block-item.rs +++ b/src/test/run-pass/consts/const-block-item.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] diff --git a/src/test/run-pass/consts/const-block.rs b/src/test/run-pass/consts/const-block.rs index 1b9330a6ebf..012523a61ef 100644 --- a/src/test/run-pass/consts/const-block.rs +++ b/src/test/run-pass/consts/const-block.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-bound.rs b/src/test/run-pass/consts/const-bound.rs index 485b87b4604..735056a0ab0 100644 --- a/src/test/run-pass/consts/const-bound.rs +++ b/src/test/run-pass/consts/const-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Make sure const bounds work on things, and test that a few types diff --git a/src/test/run-pass/consts/const-byte-str-cast.rs b/src/test/run-pass/consts/const-byte-str-cast.rs index 175d48e5c01..65d626c297f 100644 --- a/src/test/run-pass/consts/const-byte-str-cast.rs +++ b/src/test/run-pass/consts/const-byte-str-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[deny(warnings)] diff --git a/src/test/run-pass/consts/const-cast-ptr-int.rs b/src/test/run-pass/consts/const-cast-ptr-int.rs index f12a73f0ea6..987d9616e91 100644 --- a/src/test/run-pass/consts/const-cast-ptr-int.rs +++ b/src/test/run-pass/consts/const-cast-ptr-int.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-cast.rs b/src/test/run-pass/consts/const-cast.rs index 100034ccc30..0d8609e334a 100644 --- a/src/test/run-pass/consts/const-cast.rs +++ b/src/test/run-pass/consts/const-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-const.rs b/src/test/run-pass/consts/const-const.rs index 160d10d3b11..85e4a72e86d 100644 --- a/src/test/run-pass/consts/const-const.rs +++ b/src/test/run-pass/consts/const-const.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-contents.rs b/src/test/run-pass/consts/const-contents.rs index 3d99af9ee66..7ba3d435650 100644 --- a/src/test/run-pass/consts/const-contents.rs +++ b/src/test/run-pass/consts/const-contents.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue #570 #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-cross-crate-const.rs b/src/test/run-pass/consts/const-cross-crate-const.rs index 3e8eb9a422d..92020417ff5 100644 --- a/src/test/run-pass/consts/const-cross-crate-const.rs +++ b/src/test/run-pass/consts/const-cross-crate-const.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_const.rs #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-cross-crate-extern.rs b/src/test/run-pass/consts/const-cross-crate-extern.rs index 504b872782b..3c61afd5bec 100644 --- a/src/test/run-pass/consts/const-cross-crate-extern.rs +++ b/src/test/run-pass/consts/const-cross-crate-extern.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_const.rs #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-deref.rs b/src/test/run-pass/consts/const-deref.rs index 39515c8546a..6060d8e510e 100644 --- a/src/test/run-pass/consts/const-deref.rs +++ b/src/test/run-pass/consts/const-deref.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const C: &'static isize = &1000; diff --git a/src/test/run-pass/consts/const-endianess.rs b/src/test/run-pass/consts/const-endianess.rs index 529c21354e3..cbe6d864c9c 100644 --- a/src/test/run-pass/consts/const-endianess.rs +++ b/src/test/run-pass/consts/const-endianess.rs @@ -1,15 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -#![feature(const_int_ops)] #![feature(test)] extern crate test; @@ -18,7 +7,6 @@ use test::black_box as b; const BE_U32: u32 = 55u32.to_be(); const LE_U32: u32 = 55u32.to_le(); - fn main() { assert_eq!(BE_U32, b(55u32).to_be()); assert_eq!(LE_U32, b(55u32).to_le()); diff --git a/src/test/run-pass/consts/const-enum-byref-self.rs b/src/test/run-pass/consts/const-enum-byref-self.rs index 203ceaddfaa..b7e14bfb765 100644 --- a/src/test/run-pass/consts/const-enum-byref-self.rs +++ b/src/test/run-pass/consts/const-enum-byref-self.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-enum-byref.rs b/src/test/run-pass/consts/const-enum-byref.rs index 29fe20523f5..badf5294654 100644 --- a/src/test/run-pass/consts/const-enum-byref.rs +++ b/src/test/run-pass/consts/const-enum-byref.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-enum-cast.rs b/src/test/run-pass/consts/const-enum-cast.rs index ea28ac36587..3b140d14757 100644 --- a/src/test/run-pass/consts/const-enum-cast.rs +++ b/src/test/run-pass/consts/const-enum-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-enum-ptr.rs b/src/test/run-pass/consts/const-enum-ptr.rs index bc27bff4b9a..84f4eb8406d 100644 --- a/src/test/run-pass/consts/const-enum-ptr.rs +++ b/src/test/run-pass/consts/const-enum-ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-enum-struct.rs b/src/test/run-pass/consts/const-enum-struct.rs index 01ac27b5113..ee88c936188 100644 --- a/src/test/run-pass/consts/const-enum-struct.rs +++ b/src/test/run-pass/consts/const-enum-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-enum-struct2.rs b/src/test/run-pass/consts/const-enum-struct2.rs index d4923238a78..6dfe63d5d00 100644 --- a/src/test/run-pass/consts/const-enum-struct2.rs +++ b/src/test/run-pass/consts/const-enum-struct2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-enum-structlike.rs b/src/test/run-pass/consts/const-enum-structlike.rs index 17fec939116..0ea79aebce6 100644 --- a/src/test/run-pass/consts/const-enum-structlike.rs +++ b/src/test/run-pass/consts/const-enum-structlike.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-enum-tuple.rs b/src/test/run-pass/consts/const-enum-tuple.rs index a318a16c325..e0363166b02 100644 --- a/src/test/run-pass/consts/const-enum-tuple.rs +++ b/src/test/run-pass/consts/const-enum-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-enum-tuple2.rs b/src/test/run-pass/consts/const-enum-tuple2.rs index 916e5c3796b..ef378b5995d 100644 --- a/src/test/run-pass/consts/const-enum-tuple2.rs +++ b/src/test/run-pass/consts/const-enum-tuple2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-enum-tuplestruct.rs b/src/test/run-pass/consts/const-enum-tuplestruct.rs index 343c6014080..f93945c6a68 100644 --- a/src/test/run-pass/consts/const-enum-tuplestruct.rs +++ b/src/test/run-pass/consts/const-enum-tuplestruct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-enum-tuplestruct2.rs b/src/test/run-pass/consts/const-enum-tuplestruct2.rs index 68bfdb56942..b8aa9a3152f 100644 --- a/src/test/run-pass/consts/const-enum-tuplestruct2.rs +++ b/src/test/run-pass/consts/const-enum-tuplestruct2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-enum-vec-index.rs b/src/test/run-pass/consts/const-enum-vec-index.rs index 067cc2bc75f..3f155340ab5 100644 --- a/src/test/run-pass/consts/const-enum-vec-index.rs +++ b/src/test/run-pass/consts/const-enum-vec-index.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Copy, Clone)] enum E { V1(isize), V0 } diff --git a/src/test/run-pass/consts/const-enum-vec-ptr.rs b/src/test/run-pass/consts/const-enum-vec-ptr.rs index a8a3dec5bdc..43ffe6570dc 100644 --- a/src/test/run-pass/consts/const-enum-vec-ptr.rs +++ b/src/test/run-pass/consts/const-enum-vec-ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass enum E { V1(isize), V0 } diff --git a/src/test/run-pass/consts/const-enum-vector.rs b/src/test/run-pass/consts/const-enum-vector.rs index e95742451b4..ee3739f9723 100644 --- a/src/test/run-pass/consts/const-enum-vector.rs +++ b/src/test/run-pass/consts/const-enum-vector.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass enum E { V1(isize), V0 } diff --git a/src/test/run-pass/consts/const-err.rs b/src/test/run-pass/consts/const-err.rs index c23440f991a..9851f1c58be 100644 --- a/src/test/run-pass/consts/const-err.rs +++ b/src/test/run-pass/consts/const-err.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // check for const_err regressions diff --git a/src/test/run-pass/consts/const-expr-in-fixed-length-vec.rs b/src/test/run-pass/consts/const-expr-in-fixed-length-vec.rs index c67946d6fa1..a9960b4552b 100644 --- a/src/test/run-pass/consts/const-expr-in-fixed-length-vec.rs +++ b/src/test/run-pass/consts/const-expr-in-fixed-length-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that constant expressions can be used for declaring the // type of a fixed length vector. diff --git a/src/test/run-pass/consts/const-expr-in-vec-repeat.rs b/src/test/run-pass/consts/const-expr-in-vec-repeat.rs index 150d24b3106..4eaef25059b 100644 --- a/src/test/run-pass/consts/const-expr-in-vec-repeat.rs +++ b/src/test/run-pass/consts/const-expr-in-vec-repeat.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that constant expressions can be used in vec repeat syntax. diff --git a/src/test/run-pass/consts/const-extern-function.rs b/src/test/run-pass/consts/const-extern-function.rs index e7e11e74086..cfcf99b867a 100644 --- a/src/test/run-pass/consts/const-extern-function.rs +++ b/src/test/run-pass/consts/const-extern-function.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-fields-and-indexing.rs b/src/test/run-pass/consts/const-fields-and-indexing.rs index 639f1393114..bb13bebf4e2 100644 --- a/src/test/run-pass/consts/const-fields-and-indexing.rs +++ b/src/test/run-pass/consts/const-fields-and-indexing.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-fn-const-eval.rs b/src/test/run-pass/consts/const-fn-const-eval.rs index 5e05865aa1b..d4da990812e 100644 --- a/src/test/run-pass/consts/const-fn-const-eval.rs +++ b/src/test/run-pass/consts/const-fn-const-eval.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-fn-feature-flags.rs b/src/test/run-pass/consts/const-fn-feature-flags.rs index be529db3c08..83a98f0f8e9 100644 --- a/src/test/run-pass/consts/const-fn-feature-flags.rs +++ b/src/test/run-pass/consts/const-fn-feature-flags.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test use of stabilized const fns in std formerly using individual feature gates. diff --git a/src/test/run-pass/consts/const-fn-method.rs b/src/test/run-pass/consts/const-fn-method.rs index cd136774a02..002646db92a 100644 --- a/src/test/run-pass/consts/const-fn-method.rs +++ b/src/test/run-pass/consts/const-fn-method.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo { value: u32 } diff --git a/src/test/run-pass/consts/const-fn-nested.rs b/src/test/run-pass/consts/const-fn-nested.rs index 8944642d2d6..ef5598bf9e7 100644 --- a/src/test/run-pass/consts/const-fn-nested.rs +++ b/src/test/run-pass/consts/const-fn-nested.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test a call whose argument is the result of another call. diff --git a/src/test/run-pass/consts/const-fn-stability-calls.rs b/src/test/run-pass/consts/const-fn-stability-calls.rs index 7c6b2df0cde..13867904895 100644 --- a/src/test/run-pass/consts/const-fn-stability-calls.rs +++ b/src/test/run-pass/consts/const-fn-stability-calls.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/consts/const-fn-val.rs b/src/test/run-pass/consts/const-fn-val.rs index 4b6b529617f..e5bf4757e3a 100644 --- a/src/test/run-pass/consts/const-fn-val.rs +++ b/src/test/run-pass/consts/const-fn-val.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] #![allow(overflowing_literals)] diff --git a/src/test/run-pass/consts/const-fn.rs b/src/test/run-pass/consts/const-fn.rs index 616429bf1df..7b924aa46aa 100644 --- a/src/test/run-pass/consts/const-fn.rs +++ b/src/test/run-pass/consts/const-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] diff --git a/src/test/run-pass/consts/const-index-feature-gate.rs b/src/test/run-pass/consts/const-index-feature-gate.rs index 83ebaff3249..3537a1790cc 100644 --- a/src/test/run-pass/consts/const-index-feature-gate.rs +++ b/src/test/run-pass/consts/const-index-feature-gate.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] const ARR: [usize; 1] = [2]; diff --git a/src/test/run-pass/consts/const-meth-pattern.rs b/src/test/run-pass/consts/const-meth-pattern.rs index 21e011cb176..1544d760a13 100644 --- a/src/test/run-pass/consts/const-meth-pattern.rs +++ b/src/test/run-pass/consts/const-meth-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct A; diff --git a/src/test/run-pass/consts/const-negation.rs b/src/test/run-pass/consts/const-negation.rs index 048aa1f4e7a..1c8e27ae617 100644 --- a/src/test/run-pass/consts/const-negation.rs +++ b/src/test/run-pass/consts/const-negation.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(overflowing_literals)] diff --git a/src/test/run-pass/consts/const-negative.rs b/src/test/run-pass/consts/const-negative.rs index 9b3c846deac..1cb56093628 100644 --- a/src/test/run-pass/consts/const-negative.rs +++ b/src/test/run-pass/consts/const-negative.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue #358 #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-nullary-enum.rs b/src/test/run-pass/consts/const-nullary-enum.rs index 289717724c9..b6574dce6ca 100644 --- a/src/test/run-pass/consts/const-nullary-enum.rs +++ b/src/test/run-pass/consts/const-nullary-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-nullary-univariant-enum.rs b/src/test/run-pass/consts/const-nullary-univariant-enum.rs index aa255c4fdeb..51349ad3195 100644 --- a/src/test/run-pass/consts/const-nullary-univariant-enum.rs +++ b/src/test/run-pass/consts/const-nullary-univariant-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Copy, Clone)] diff --git a/src/test/run-pass/consts/const-pattern-variant.rs b/src/test/run-pass/consts/const-pattern-variant.rs index 095cdc09e06..80f749ed72d 100644 --- a/src/test/run-pass/consts/const-pattern-variant.rs +++ b/src/test/run-pass/consts/const-pattern-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_patterns)] diff --git a/src/test/run-pass/consts/const-rec-and-tup.rs b/src/test/run-pass/consts/const-rec-and-tup.rs index 768aab29c1f..0bddaf75de8 100644 --- a/src/test/run-pass/consts/const-rec-and-tup.rs +++ b/src/test/run-pass/consts/const-rec-and-tup.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-region-ptrs-noncopy.rs b/src/test/run-pass/consts/const-region-ptrs-noncopy.rs index 96db2c88431..10b9ce896a6 100644 --- a/src/test/run-pass/consts/const-region-ptrs-noncopy.rs +++ b/src/test/run-pass/consts/const-region-ptrs-noncopy.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-region-ptrs.rs b/src/test/run-pass/consts/const-region-ptrs.rs index 00f987c745c..9b94a2b1121 100644 --- a/src/test/run-pass/consts/const-region-ptrs.rs +++ b/src/test/run-pass/consts/const-region-ptrs.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-repeated-values.rs b/src/test/run-pass/consts/const-repeated-values.rs index 15a377c9c25..27efb5ba2a2 100644 --- a/src/test/run-pass/consts/const-repeated-values.rs +++ b/src/test/run-pass/consts/const-repeated-values.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const FOO: isize = 42; diff --git a/src/test/run-pass/consts/const-size_of-align_of.rs b/src/test/run-pass/consts/const-size_of-align_of.rs index d69e5ed930b..0c63dc84a37 100644 --- a/src/test/run-pass/consts/const-size_of-align_of.rs +++ b/src/test/run-pass/consts/const-size_of-align_of.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/consts/const-str-ptr.rs b/src/test/run-pass/consts/const-str-ptr.rs index 91ff3daa94f..56fd9d9f55f 100644 --- a/src/test/run-pass/consts/const-str-ptr.rs +++ b/src/test/run-pass/consts/const-str-ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] use std::{str, string}; diff --git a/src/test/run-pass/consts/const-struct-offsets.rs b/src/test/run-pass/consts/const-struct-offsets.rs index a968e8aa397..26a00832079 100644 --- a/src/test/run-pass/consts/const-struct-offsets.rs +++ b/src/test/run-pass/consts/const-struct-offsets.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/consts/const-struct.rs b/src/test/run-pass/consts/const-struct.rs index 0554356ab8e..db397a891d6 100644 --- a/src/test/run-pass/consts/const-struct.rs +++ b/src/test/run-pass/consts/const-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-trait-to-trait.rs b/src/test/run-pass/consts/const-trait-to-trait.rs index fddfedec393..a324d73a3a9 100644 --- a/src/test/run-pass/consts/const-trait-to-trait.rs +++ b/src/test/run-pass/consts/const-trait-to-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/consts/const-tuple-struct.rs b/src/test/run-pass/consts/const-tuple-struct.rs index bee1c83e3f9..0144afaaceb 100644 --- a/src/test/run-pass/consts/const-tuple-struct.rs +++ b/src/test/run-pass/consts/const-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Bar(isize, isize); diff --git a/src/test/run-pass/consts/const-typeid-of.rs b/src/test/run-pass/consts/const-typeid-of.rs index 153d6eccaab..225acb60ac4 100644 --- a/src/test/run-pass/consts/const-typeid-of.rs +++ b/src/test/run-pass/consts/const-typeid-of.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(core_intrinsics)] #![feature(const_type_id)] diff --git a/src/test/run-pass/consts/const-unit-struct.rs b/src/test/run-pass/consts/const-unit-struct.rs index 6dcf75b5331..1c9e0e8d3c9 100644 --- a/src/test/run-pass/consts/const-unit-struct.rs +++ b/src/test/run-pass/consts/const-unit-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/consts/const-unsafe-fn.rs b/src/test/run-pass/consts/const-unsafe-fn.rs index 8a2f862b5a0..72ce73f745f 100644 --- a/src/test/run-pass/consts/const-unsafe-fn.rs +++ b/src/test/run-pass/consts/const-unsafe-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // A quick test of 'unsafe const fn' functionality diff --git a/src/test/run-pass/consts/const-vec-of-fns.rs b/src/test/run-pass/consts/const-vec-of-fns.rs index 79387b5195b..6d90b066b74 100644 --- a/src/test/run-pass/consts/const-vec-of-fns.rs +++ b/src/test/run-pass/consts/const-vec-of-fns.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-vec-syntax.rs b/src/test/run-pass/consts/const-vec-syntax.rs index ef979ca398e..61246e44eba 100644 --- a/src/test/run-pass/consts/const-vec-syntax.rs +++ b/src/test/run-pass/consts/const-vec-syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/consts/const-vecs-and-slices.rs b/src/test/run-pass/consts/const-vecs-and-slices.rs index 85d227b2d6e..1cdc33b7a34 100644 --- a/src/test/run-pass/consts/const-vecs-and-slices.rs +++ b/src/test/run-pass/consts/const-vecs-and-slices.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const.rs b/src/test/run-pass/consts/const.rs index 7fc5ecb5bd7..71fbadfa828 100644 --- a/src/test/run-pass/consts/const.rs +++ b/src/test/run-pass/consts/const.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/consts-in-patterns.rs b/src/test/run-pass/consts/consts-in-patterns.rs index e2f7faa5955..ac6c5a51506 100644 --- a/src/test/run-pass/consts/consts-in-patterns.rs +++ b/src/test/run-pass/consts/consts-in-patterns.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const FOO: isize = 10; diff --git a/src/test/run-pass/core-run-destroy.rs b/src/test/run-pass/core-run-destroy.rs index aaf017c0ad3..55d389952cc 100644 --- a/src/test/run-pass/core-run-destroy.rs +++ b/src/test/run-pass/core-run-destroy.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] #![allow(stable_features)] #![allow(deprecated)] @@ -16,11 +6,11 @@ // ignore-cloudabi no processes // ignore-emscripten no processes -// NB: These tests kill child processes. Valgrind sees these children as leaking +// N.B., these tests kill child processes. Valgrind sees these children as leaking // memory, which makes for some *confusing* logs. That's why these are here // instead of in std. -#![feature(libc, duration)] +#![feature(rustc_private, duration)] extern crate libc; diff --git a/src/test/run-pass/crate-leading-sep.rs b/src/test/run-pass/crate-leading-sep.rs index ede78ff803d..26d4df433aa 100644 --- a/src/test/run-pass/crate-leading-sep.rs +++ b/src/test/run-pass/crate-leading-sep.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 fn main() { diff --git a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs index c0bc97b1f65..0d243e14b94 100644 --- a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs +++ b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 #![feature(box_syntax)] diff --git a/src/test/run-pass/crate-name-attr-used.rs b/src/test/run-pass/crate-name-attr-used.rs index a108f4dc568..666f80e5662 100644 --- a/src/test/run-pass/crate-name-attr-used.rs +++ b/src/test/run-pass/crate-name-attr-used.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--crate-name crate_name_attr_used -F unused-attributes // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs b/src/test/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs index 52c3b073388..77168be5374 100644 --- a/src/test/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs +++ b/src/test/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:anon-extern-mod-cross-crate-1.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs index 741ce351da3..948b5e688eb 100644 --- a/src/test/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs +++ b/src/test/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs @@ -1,15 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="anonexternmod"] -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/cross-crate/auxiliary/anon_trait_static_method_lib.rs b/src/test/run-pass/cross-crate/auxiliary/anon_trait_static_method_lib.rs index 9d93d9689e7..dceec7e3ec1 100644 --- a/src/test/run-pass/cross-crate/auxiliary/anon_trait_static_method_lib.rs +++ b/src/test/run-pass/cross-crate/auxiliary/anon_trait_static_method_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo { pub x: isize } diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_borrow_lib.rs b/src/test/run-pass/cross-crate/auxiliary/cci_borrow_lib.rs index 9c90510a857..7c57a1c6678 100644 --- a/src/test/run-pass/cross-crate/auxiliary/cci_borrow_lib.rs +++ b/src/test/run-pass/cross-crate/auxiliary/cci_borrow_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo(x: &usize) -> usize { *x } diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_capture_clause.rs b/src/test/run-pass/cross-crate/auxiliary/cci_capture_clause.rs index b38e955231e..4cd001ecc9e 100644 --- a/src/test/run-pass/cross-crate/auxiliary/cci_capture_clause.rs +++ b/src/test/run-pass/cross-crate/auxiliary/cci_capture_clause.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::thread; use std::sync::mpsc::{Receiver, channel}; diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_const.rs b/src/test/run-pass/cross-crate/auxiliary/cci_const.rs index ee8290050f9..af6a5ad8ed3 100644 --- a/src/test/run-pass/cross-crate/auxiliary/cci_const.rs +++ b/src/test/run-pass/cross-crate/auxiliary/cci_const.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub extern fn bar() { } diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_impl_lib.rs b/src/test/run-pass/cross-crate/auxiliary/cci_impl_lib.rs index d8921f4e09a..0db0037b203 100644 --- a/src/test/run-pass/cross-crate/auxiliary/cci_impl_lib.rs +++ b/src/test/run-pass/cross-crate/auxiliary/cci_impl_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="cci_impl_lib"] pub trait uint_helpers { diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_iter_lib.rs b/src/test/run-pass/cross-crate/auxiliary/cci_iter_lib.rs index 07d03b4c759..60c36bc7d05 100644 --- a/src/test/run-pass/cross-crate/auxiliary/cci_iter_lib.rs +++ b/src/test/run-pass/cross-crate/auxiliary/cci_iter_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="cci_iter_lib"] #[inline] diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_nested_lib.rs b/src/test/run-pass/cross-crate/auxiliary/cci_nested_lib.rs index 91de734ec3a..379ed076611 100644 --- a/src/test/run-pass/cross-crate/auxiliary/cci_nested_lib.rs +++ b/src/test/run-pass/cross-crate/auxiliary/cci_nested_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] use std::cell::RefCell; diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_no_inline_lib.rs b/src/test/run-pass/cross-crate/auxiliary/cci_no_inline_lib.rs index 4c6f808c619..177dba2178f 100644 --- a/src/test/run-pass/cross-crate/auxiliary/cci_no_inline_lib.rs +++ b/src/test/run-pass/cross-crate/auxiliary/cci_no_inline_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="cci_no_inline_lib"] diff --git a/src/test/run-pass/cross-crate/auxiliary/moves_based_on_type_lib.rs b/src/test/run-pass/cross-crate/auxiliary/moves_based_on_type_lib.rs index f95be3f4a1d..7e7e3b86024 100644 --- a/src/test/run-pass/cross-crate/auxiliary/moves_based_on_type_lib.rs +++ b/src/test/run-pass/cross-crate/auxiliary/moves_based_on_type_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub struct S { diff --git a/src/test/run-pass/cross-crate/auxiliary/newtype_struct_xc.rs b/src/test/run-pass/cross-crate/auxiliary/newtype_struct_xc.rs index be3414b7ad2..9d1e0742e3c 100644 --- a/src/test/run-pass/cross-crate/auxiliary/newtype_struct_xc.rs +++ b/src/test/run-pass/cross-crate/auxiliary/newtype_struct_xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub struct Au(pub isize); diff --git a/src/test/run-pass/cross-crate/auxiliary/pub_static_array.rs b/src/test/run-pass/cross-crate/auxiliary/pub_static_array.rs index 7248d0e543b..49cb76921ad 100644 --- a/src/test/run-pass/cross-crate/auxiliary/pub_static_array.rs +++ b/src/test/run-pass/cross-crate/auxiliary/pub_static_array.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub static ARRAY: [u8; 1] = [1]; diff --git a/src/test/run-pass/cross-crate/auxiliary/reexported_static_methods.rs b/src/test/run-pass/cross-crate/auxiliary/reexported_static_methods.rs index cc4db1a9581..cc961625f32 100644 --- a/src/test/run-pass/cross-crate/auxiliary/reexported_static_methods.rs +++ b/src/test/run-pass/cross-crate/auxiliary/reexported_static_methods.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use sub_foo::Foo; pub use self::Bar as Baz; pub use sub_foo::Boz; diff --git a/src/test/run-pass/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs b/src/test/run-pass/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs index 66c0300e260..7c1175f7a88 100644 --- a/src/test/run-pass/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs +++ b/src/test/run-pass/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait FromBuf<'a> { fn from_buf(_: &'a [u8]) -> Self; } diff --git a/src/test/run-pass/cross-crate/auxiliary/xcrate_address_insignificant.rs b/src/test/run-pass/cross-crate/auxiliary/xcrate_address_insignificant.rs index 5195839c067..e79e334b53f 100644 --- a/src/test/run-pass/cross-crate/auxiliary/xcrate_address_insignificant.rs +++ b/src/test/run-pass/cross-crate/auxiliary/xcrate_address_insignificant.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() -> isize { static a: isize = 3; a diff --git a/src/test/run-pass/cross-crate/auxiliary/xcrate_associated_type_defaults.rs b/src/test/run-pass/cross-crate/auxiliary/xcrate_associated_type_defaults.rs index 6779438c672..d8a55dd34bc 100644 --- a/src/test/run-pass/cross-crate/auxiliary/xcrate_associated_type_defaults.rs +++ b/src/test/run-pass/cross-crate/auxiliary/xcrate_associated_type_defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_type_defaults)] pub trait Foo { diff --git a/src/test/run-pass/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs b/src/test/run-pass/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs index 48fb05f7779..2ab23b4d7e4 100644 --- a/src/test/run-pass/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs +++ b/src/test/run-pass/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Request { pub id: String, pub arg: String, diff --git a/src/test/run-pass/cross-crate/auxiliary/xcrate_static_addresses.rs b/src/test/run-pass/cross-crate/auxiliary/xcrate_static_addresses.rs index d0da80e31b9..e18d34799ef 100644 --- a/src/test/run-pass/cross-crate/auxiliary/xcrate_static_addresses.rs +++ b/src/test/run-pass/cross-crate/auxiliary/xcrate_static_addresses.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub static global: isize = 3; static global0: isize = 4; diff --git a/src/test/run-pass/cross-crate/auxiliary/xcrate_unit_struct.rs b/src/test/run-pass/cross-crate/auxiliary/xcrate_unit_struct.rs index 7a69be2b06c..69ed498e7e1 100644 --- a/src/test/run-pass/cross-crate/auxiliary/xcrate_unit_struct.rs +++ b/src/test/run-pass/cross-crate/auxiliary/xcrate_unit_struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] // used by the rpass test diff --git a/src/test/run-pass/cross-crate/cci_borrow.rs b/src/test/run-pass/cross-crate/cci_borrow.rs index 6e822d7cb68..605a166ffa3 100644 --- a/src/test/run-pass/cross-crate/cci_borrow.rs +++ b/src/test/run-pass/cross-crate/cci_borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_borrow_lib.rs diff --git a/src/test/run-pass/cross-crate/cci_capture_clause.rs b/src/test/run-pass/cross-crate/cci_capture_clause.rs index ea389d314b5..ea699b5f5ac 100644 --- a/src/test/run-pass/cross-crate/cci_capture_clause.rs +++ b/src/test/run-pass/cross-crate/cci_capture_clause.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_capture_clause.rs diff --git a/src/test/run-pass/cross-crate/cci_impl_exe.rs b/src/test/run-pass/cross-crate/cci_impl_exe.rs index 18378ca63ed..b11fb23ebc8 100644 --- a/src/test/run-pass/cross-crate/cci_impl_exe.rs +++ b/src/test/run-pass/cross-crate/cci_impl_exe.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_impl_lib.rs diff --git a/src/test/run-pass/cross-crate/cci_iter_exe.rs b/src/test/run-pass/cross-crate/cci_iter_exe.rs index 89c01bab3ca..8b58d90fe4e 100644 --- a/src/test/run-pass/cross-crate/cci_iter_exe.rs +++ b/src/test/run-pass/cross-crate/cci_iter_exe.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_iter_lib.rs diff --git a/src/test/run-pass/cross-crate/cci_nested_exe.rs b/src/test/run-pass/cross-crate/cci_nested_exe.rs index 3e88aad55f3..1c001a2a372 100644 --- a/src/test/run-pass/cross-crate/cci_nested_exe.rs +++ b/src/test/run-pass/cross-crate/cci_nested_exe.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_nested_lib.rs diff --git a/src/test/run-pass/cross-crate/cci_no_inline_exe.rs b/src/test/run-pass/cross-crate/cci_no_inline_exe.rs index 79729494009..ffc701678d3 100644 --- a/src/test/run-pass/cross-crate/cci_no_inline_exe.rs +++ b/src/test/run-pass/cross-crate/cci_no_inline_exe.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_no_inline_lib.rs diff --git a/src/test/run-pass/cross-crate/cross-crate-const-pat.rs b/src/test/run-pass/cross-crate/cross-crate-const-pat.rs index 8040f60f947..e8fa8485ab2 100644 --- a/src/test/run-pass/cross-crate/cross-crate-const-pat.rs +++ b/src/test/run-pass/cross-crate/cross-crate-const-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_const.rs diff --git a/src/test/run-pass/cross-crate/cross-crate-newtype-struct-pat.rs b/src/test/run-pass/cross-crate/cross-crate-newtype-struct-pat.rs index e714e1d32ff..eabffc16170 100644 --- a/src/test/run-pass/cross-crate/cross-crate-newtype-struct-pat.rs +++ b/src/test/run-pass/cross-crate/cross-crate-newtype-struct-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:newtype_struct_xc.rs diff --git a/src/test/run-pass/cross-crate/moves-based-on-type-cross-crate.rs b/src/test/run-pass/cross-crate/moves-based-on-type-cross-crate.rs index 8cc84c6c536..3881e335220 100644 --- a/src/test/run-pass/cross-crate/moves-based-on-type-cross-crate.rs +++ b/src/test/run-pass/cross-crate/moves-based-on-type-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:moves_based_on_type_lib.rs diff --git a/src/test/run-pass/cross-crate/reexported-static-methods-cross-crate.rs b/src/test/run-pass/cross-crate/reexported-static-methods-cross-crate.rs index 062e2572399..8c70a1ce477 100644 --- a/src/test/run-pass/cross-crate/reexported-static-methods-cross-crate.rs +++ b/src/test/run-pass/cross-crate/reexported-static-methods-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:reexported_static_methods.rs diff --git a/src/test/run-pass/cross-crate/static-array-across-crate.rs b/src/test/run-pass/cross-crate/static-array-across-crate.rs index b921ce01cfd..0b84e0e6a3f 100644 --- a/src/test/run-pass/cross-crate/static-array-across-crate.rs +++ b/src/test/run-pass/cross-crate/static-array-across-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:pub_static_array.rs diff --git a/src/test/run-pass/cross-crate/xcrate-address-insignificant.rs b/src/test/run-pass/cross-crate/xcrate-address-insignificant.rs index 3ac2a0c8b45..33c70650603 100644 --- a/src/test/run-pass/cross-crate/xcrate-address-insignificant.rs +++ b/src/test/run-pass/cross-crate/xcrate-address-insignificant.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:xcrate_address_insignificant.rs diff --git a/src/test/run-pass/cross-crate/xcrate-associated-type-defaults.rs b/src/test/run-pass/cross-crate/xcrate-associated-type-defaults.rs index 7015732daf6..0f3e077d1de 100644 --- a/src/test/run-pass/cross-crate/xcrate-associated-type-defaults.rs +++ b/src/test/run-pass/cross-crate/xcrate-associated-type-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:xcrate_associated_type_defaults.rs diff --git a/src/test/run-pass/cross-crate/xcrate-static-addresses.rs b/src/test/run-pass/cross-crate/xcrate-static-addresses.rs index cb2a3563c7e..3c33976568e 100644 --- a/src/test/run-pass/cross-crate/xcrate-static-addresses.rs +++ b/src/test/run-pass/cross-crate/xcrate-static-addresses.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:xcrate_static_addresses.rs diff --git a/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs b/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs index 70a6a052af9..1fd7eb878d9 100644 --- a/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs +++ b/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:xcrate-trait-lifetime-param.rs diff --git a/src/test/run-pass/cross-crate/xcrate-unit-struct.rs b/src/test/run-pass/cross-crate/xcrate-unit-struct.rs index 65ce4244f56..7aa3eb0d6c4 100644 --- a/src/test/run-pass/cross-crate/xcrate-unit-struct.rs +++ b/src/test/run-pass/cross-crate/xcrate-unit-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:xcrate_unit_struct.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/cross-crate/xcrate_generic_fn_nested_return.rs b/src/test/run-pass/cross-crate/xcrate_generic_fn_nested_return.rs index 2ed392a3fbb..4593fec5196 100644 --- a/src/test/run-pass/cross-crate/xcrate_generic_fn_nested_return.rs +++ b/src/test/run-pass/cross-crate/xcrate_generic_fn_nested_return.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:xcrate_generic_fn_nested_return.rs diff --git a/src/test/run-pass/crt-static-off-works.rs b/src/test/run-pass/crt-static-off-works.rs index 14f5913e377..64d96709afc 100644 --- a/src/test/run-pass/crt-static-off-works.rs +++ b/src/test/run-pass/crt-static-off-works.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] // compile-flags:-C target-feature=-crt-static -Z unstable-options // ignore-musl - requires changing the linker which is hard diff --git a/src/test/run-pass/crt-static-on-works.rs b/src/test/run-pass/crt-static-on-works.rs index dbc483241ab..272fcfe3b5b 100644 --- a/src/test/run-pass/crt-static-on-works.rs +++ b/src/test/run-pass/crt-static-on-works.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] // compile-flags:-C target-feature=+crt-static -Z unstable-options diff --git a/src/test/run-pass/ctfe/assoc-const.rs b/src/test/run-pass/ctfe/assoc-const.rs index 835365820d7..b70479d255b 100644 --- a/src/test/run-pass/ctfe/assoc-const.rs +++ b/src/test/run-pass/ctfe/assoc-const.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] diff --git a/src/test/run-pass/ctfe/bswap-const.rs b/src/test/run-pass/ctfe/bswap-const.rs index 5fc7609bb68..3145c21acc9 100644 --- a/src/test/run-pass/ctfe/bswap-const.rs +++ b/src/test/run-pass/ctfe/bswap-const.rs @@ -1,22 +1,12 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(core_intrinsics)] use std::intrinsics; -const SWAPPED_U8: u8 = unsafe { intrinsics::bswap(0x12_u8) }; -const SWAPPED_U16: u16 = unsafe { intrinsics::bswap(0x12_34_u16) }; -const SWAPPED_I32: i32 = unsafe { intrinsics::bswap(0x12_34_56_78_i32) }; +const SWAPPED_U8: u8 = intrinsics::bswap(0x12_u8); +const SWAPPED_U16: u16 = intrinsics::bswap(0x12_34_u16); +const SWAPPED_I32: i32 = intrinsics::bswap(0x12_34_56_78_i32); fn main() { assert_eq!(SWAPPED_U8, 0x12); diff --git a/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs b/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs index 94e97d37424..a171567c5d2 100644 --- a/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs +++ b/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // https://github.com/rust-lang/rust/issues/34997 diff --git a/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs b/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs index 0fcf9a5acbd..10a4c31f24e 100644 --- a/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs +++ b/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs @@ -1,18 +1,8 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] -#![feature(const_let)] - type Array = [u32; { let x = 2; 5 }]; -pub fn main() {} +pub fn main() { + let _: Array = [0; 5]; +} diff --git a/src/test/run-pass/ctfe/const-block-non-item-statement.rs b/src/test/run-pass/ctfe/const-block-non-item-statement.rs index b7ed8af35d4..a1b9b586ad0 100644 --- a/src/test/run-pass/ctfe/const-block-non-item-statement.rs +++ b/src/test/run-pass/ctfe/const-block-non-item-statement.rs @@ -1,20 +1,11 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] -#![feature(const_let)] - +#[repr(u8)] enum Foo { Bar = { let x = 1; 3 } } -pub fn main() {} +pub fn main() { + assert_eq!(3, Foo::Bar as u8); +} diff --git a/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs b/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs deleted file mode 100644 index 88f0d0714f9..00000000000 --- a/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -// test that certain things are disallowed in constant functions - -#![feature(const_fn, const_let)] - -// no destructuring -const fn i(( - a, - b - ): (u32, u32)) -> u32 { - a + b -} - -fn main() {} diff --git a/src/test/run-pass/ctfe/deref_in_pattern.rs b/src/test/run-pass/ctfe/deref_in_pattern.rs index 6f4cca624bf..cc47b5b49c0 100644 --- a/src/test/run-pass/ctfe/deref_in_pattern.rs +++ b/src/test/run-pass/ctfe/deref_in_pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // https://github.com/rust-lang/rust/issues/25574 diff --git a/src/test/run-pass/ctfe/ice-48279.rs b/src/test/run-pass/ctfe/ice-48279.rs index 74a8ba64965..d1d90df240c 100644 --- a/src/test/run-pass/ctfe/ice-48279.rs +++ b/src/test/run-pass/ctfe/ice-48279.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_unsafe)] diff --git a/src/test/run-pass/ctfe/issue-37550.rs b/src/test/run-pass/ctfe/issue-37550.rs index 54e0e83efed..04865830df2 100644 --- a/src/test/run-pass/ctfe/issue-37550.rs +++ b/src/test/run-pass/ctfe/issue-37550.rs @@ -1,18 +1,8 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] -#![feature(const_fn, const_let)] +#![feature(const_fn)] const fn x() { let t = true; diff --git a/src/test/run-pass/ctfe/issue-broken-mir.rs b/src/test/run-pass/ctfe/issue-broken-mir.rs index 4810ef75c78..36f0ff92104 100644 --- a/src/test/run-pass/ctfe/issue-broken-mir.rs +++ b/src/test/run-pass/ctfe/issue-broken-mir.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // https://github.com/rust-lang/rust/issues/27918 diff --git a/src/test/run-pass/ctfe/locals-in-const-fn.rs b/src/test/run-pass/ctfe/locals-in-const-fn.rs index d10465b9dcd..95d50171a84 100644 --- a/src/test/run-pass/ctfe/locals-in-const-fn.rs +++ b/src/test/run-pass/ctfe/locals-in-const-fn.rs @@ -1,19 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // https://github.com/rust-lang/rust/issues/48821 -#![feature(const_fn, const_let)] - const fn foo(i: usize) -> usize { let x = i; x diff --git a/src/test/run-pass/ctfe/match-const-fn-structs.rs b/src/test/run-pass/ctfe/match-const-fn-structs.rs index e41ff906fd2..5a68048c477 100644 --- a/src/test/run-pass/ctfe/match-const-fn-structs.rs +++ b/src/test/run-pass/ctfe/match-const-fn-structs.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] diff --git a/src/test/run-pass/ctfe/mozjs-error.rs b/src/test/run-pass/ctfe/mozjs-error.rs index f79fbe72bdf..7edcadbf2cb 100644 --- a/src/test/run-pass/ctfe/mozjs-error.rs +++ b/src/test/run-pass/ctfe/mozjs-error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/ctfe/non-scalar-cast.rs b/src/test/run-pass/ctfe/non-scalar-cast.rs index 9711247b83e..671366c90ec 100644 --- a/src/test/run-pass/ctfe/non-scalar-cast.rs +++ b/src/test/run-pass/ctfe/non-scalar-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // https://github.com/rust-lang/rust/issues/37448 diff --git a/src/test/run-pass/ctfe/promotion.rs b/src/test/run-pass/ctfe/promotion.rs index 5407529f065..3c5401e4212 100644 --- a/src/test/run-pass/ctfe/promotion.rs +++ b/src/test/run-pass/ctfe/promotion.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -O diff --git a/src/test/run-pass/ctfe/references.rs b/src/test/run-pass/ctfe/references.rs index 946ed246bb0..d0af47a8ea8 100644 --- a/src/test/run-pass/ctfe/references.rs +++ b/src/test/run-pass/ctfe/references.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const FOO: &[u8] = b"foo"; @@ -28,6 +18,7 @@ fn main() { _ => panic!("c"), } + #[allow(unreachable_patterns)] match &43 { &42 => panic!(), BOO => panic!(), diff --git a/src/test/run-pass/ctfe/repeat_match.rs b/src/test/run-pass/ctfe/repeat_match.rs index 60a9a916bff..20983184a47 100644 --- a/src/test/run-pass/ctfe/repeat_match.rs +++ b/src/test/run-pass/ctfe/repeat_match.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // https://github.com/rust-lang/rust/issues/45044 diff --git a/src/test/run-pass/ctfe/return-in-const-fn.rs b/src/test/run-pass/ctfe/return-in-const-fn.rs index 933ec588614..077a33c081b 100644 --- a/src/test/run-pass/ctfe/return-in-const-fn.rs +++ b/src/test/run-pass/ctfe/return-in-const-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // https://github.com/rust-lang/rust/issues/43754 diff --git a/src/test/run-pass/ctfe/signed_enum_discr.rs b/src/test/run-pass/ctfe/signed_enum_discr.rs index 9dd2990ab8d..2e4395ccf22 100644 --- a/src/test/run-pass/ctfe/signed_enum_discr.rs +++ b/src/test/run-pass/ctfe/signed_enum_discr.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // https://github.com/rust-lang/rust/issues/49181 diff --git a/src/test/run-pass/ctfe/transmute-const.rs b/src/test/run-pass/ctfe/transmute-const.rs index efd6df5f886..e24f89cdffd 100644 --- a/src/test/run-pass/ctfe/transmute-const.rs +++ b/src/test/run-pass/ctfe/transmute-const.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(const_transmute)] diff --git a/src/test/run-pass/ctfe/tuple-struct-constructors.rs b/src/test/run-pass/ctfe/tuple-struct-constructors.rs index c7000d19813..1655f0eb850 100644 --- a/src/test/run-pass/ctfe/tuple-struct-constructors.rs +++ b/src/test/run-pass/ctfe/tuple-struct-constructors.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // https://github.com/rust-lang/rust/issues/41898 diff --git a/src/test/run-pass/cycle-generic-bound.rs b/src/test/run-pass/cycle-generic-bound.rs index b6d84f9d5a2..56bfa98451f 100644 --- a/src/test/run-pass/cycle-generic-bound.rs +++ b/src/test/run-pass/cycle-generic-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #15477. This test just needs to compile. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/dead-code-alias-in-pat.rs b/src/test/run-pass/dead-code-alias-in-pat.rs index a37d671e5c1..5b6ca26f1ce 100644 --- a/src/test/run-pass/dead-code-alias-in-pat.rs +++ b/src/test/run-pass/dead-code-alias-in-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(dead_code)] fn main() { diff --git a/src/test/run-pass/dead-code-leading-underscore.rs b/src/test/run-pass/dead-code-leading-underscore.rs index 6e3f8a28812..eff40111ac9 100644 --- a/src/test/run-pass/dead-code-leading-underscore.rs +++ b/src/test/run-pass/dead-code-leading-underscore.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 #![deny(dead_code)] diff --git a/src/test/run-pass/debuginfo-lto.rs b/src/test/run-pass/debuginfo-lto.rs index c29cfafe438..680616fee7c 100644 --- a/src/test/run-pass/debuginfo-lto.rs +++ b/src/test/run-pass/debuginfo-lto.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test case makes sure that we don't run into LLVM's dreaded // "possible ODR violation" assertion when compiling with LTO + Debuginfo. // It covers cases that have traditionally been prone to cause this error. diff --git a/src/test/run-pass/deep.rs b/src/test/run-pass/deep.rs index d59fe8d813d..5c3ecd8c22c 100644 --- a/src/test/run-pass/deep.rs +++ b/src/test/run-pass/deep.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten apparently blows the stack fn f(x: isize) -> isize { diff --git a/src/test/run-pass/default-alloc-error-hook.rs b/src/test/run-pass/default-alloc-error-hook.rs index 5f6b60a5a8d..8dcc8ad5433 100644 --- a/src/test/run-pass/default-alloc-error-hook.rs +++ b/src/test/run-pass/default-alloc-error-hook.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/default-associated-types.rs b/src/test/run-pass/default-associated-types.rs index ed55d5c8b17..d7ed943b84e 100644 --- a/src/test/run-pass/default-associated-types.rs +++ b/src/test/run-pass/default-associated-types.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_type_defaults)] trait Foo { diff --git a/src/test/run-pass/default-method-parsing.rs b/src/test/run-pass/default-method-parsing.rs index 5ccb66a76bf..7f66605d7c3 100644 --- a/src/test/run-pass/default-method-parsing.rs +++ b/src/test/run-pass/default-method-parsing.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 trait Foo { diff --git a/src/test/run-pass/default-method-simple.rs b/src/test/run-pass/default-method-simple.rs index d4e25bb5c3c..d046fce9b62 100644 --- a/src/test/run-pass/default-method-simple.rs +++ b/src/test/run-pass/default-method-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] trait Foo { diff --git a/src/test/run-pass/defaults-well-formedness.rs b/src/test/run-pass/defaults-well-formedness.rs index fce5e911c57..cbcdb38fbeb 100644 --- a/src/test/run-pass/defaults-well-formedness.rs +++ b/src/test/run-pass/defaults-well-formedness.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] trait Trait {} struct Foo(U, V) where U: Trait; diff --git a/src/test/run-pass/deprecation-in-force-unstable.rs b/src/test/run-pass/deprecation-in-force-unstable.rs index 542117eca12..b3509734ffc 100644 --- a/src/test/run-pass/deprecation-in-force-unstable.rs +++ b/src/test/run-pass/deprecation-in-force-unstable.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zforce-unstable-if-unmarked #[deprecated] // should work even with -Zforce-unstable-if-unmarked diff --git a/src/test/run-pass/deref-lval.rs b/src/test/run-pass/deref-lval.rs index 0e65e5b43b7..d02adcb0cdc 100644 --- a/src/test/run-pass/deref-lval.rs +++ b/src/test/run-pass/deref-lval.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] use std::cell::Cell; diff --git a/src/test/run-pass/deref-mut-on-ref.rs b/src/test/run-pass/deref-mut-on-ref.rs index 98441d7daaa..119d943026a 100644 --- a/src/test/run-pass/deref-mut-on-ref.rs +++ b/src/test/run-pass/deref-mut-on-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `&mut T` implements `DerefMut` diff --git a/src/test/run-pass/deref-on-ref.rs b/src/test/run-pass/deref-on-ref.rs index 383c8197f94..651ccd5be85 100644 --- a/src/test/run-pass/deref-on-ref.rs +++ b/src/test/run-pass/deref-on-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `&T` and `&mut T` implement `Deref` diff --git a/src/test/run-pass/deref-rc.rs b/src/test/run-pass/deref-rc.rs index fa50e3144ed..ae17608fc56 100644 --- a/src/test/run-pass/deref-rc.rs +++ b/src/test/run-pass/deref-rc.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::rc::Rc; fn main() { diff --git a/src/test/run-pass/deref.rs b/src/test/run-pass/deref.rs index 0e6b3d87d34..08b047f54d9 100644 --- a/src/test/run-pass/deref.rs +++ b/src/test/run-pass/deref.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 #![feature(box_syntax)] diff --git a/src/test/run-pass/deriving/auxiliary/derive-no-std.rs b/src/test/run-pass/deriving/auxiliary/derive-no-std.rs index f083e10bfdb..21bfd5a2909 100644 --- a/src/test/run-pass/deriving/auxiliary/derive-no-std.rs +++ b/src/test/run-pass/deriving/auxiliary/derive-no-std.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass/deriving/derive-no-std.rs b/src/test/run-pass/deriving/derive-no-std.rs index 1122083eb80..22edd3eed59 100644 --- a/src/test/run-pass/deriving/derive-no-std.rs +++ b/src/test/run-pass/deriving/derive-no-std.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:derive-no-std.rs diff --git a/src/test/run-pass/deriving/derive-partialord-correctness.rs b/src/test/run-pass/deriving/derive-partialord-correctness.rs index 4890b1bc76b..36763eda169 100644 --- a/src/test/run-pass/deriving/derive-partialord-correctness.rs +++ b/src/test/run-pass/deriving/derive-partialord-correctness.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Original issue: #49650 diff --git a/src/test/run-pass/deriving/deriving-associated-types.rs b/src/test/run-pass/deriving/deriving-associated-types.rs index 46fb88e05c6..4b1cbe80c50 100644 --- a/src/test/run-pass/deriving/deriving-associated-types.rs +++ b/src/test/run-pass/deriving/deriving-associated-types.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub trait DeclaredTrait { type Type; diff --git a/src/test/run-pass/deriving/deriving-bounds.rs b/src/test/run-pass/deriving/deriving-bounds.rs index 0e30de10e82..f0b921d0e7c 100644 --- a/src/test/run-pass/deriving/deriving-bounds.rs +++ b/src/test/run-pass/deriving/deriving-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Copy, Clone)] struct Test; diff --git a/src/test/run-pass/deriving/deriving-clone-array.rs b/src/test/run-pass/deriving/deriving-clone-array.rs index 916488fcbe9..4569749df42 100644 --- a/src/test/run-pass/deriving/deriving-clone-array.rs +++ b/src/test/run-pass/deriving/deriving-clone-array.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // test for issue #30244 diff --git a/src/test/run-pass/deriving/deriving-clone-enum.rs b/src/test/run-pass/deriving/deriving-clone-enum.rs index 09a0a6fdeae..09e74974072 100644 --- a/src/test/run-pass/deriving/deriving-clone-enum.rs +++ b/src/test/run-pass/deriving/deriving-clone-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/deriving/deriving-clone-generic-enum.rs b/src/test/run-pass/deriving/deriving-clone-generic-enum.rs index 74258411d7f..a344d7fc43a 100644 --- a/src/test/run-pass/deriving/deriving-clone-generic-enum.rs +++ b/src/test/run-pass/deriving/deriving-clone-generic-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/deriving/deriving-clone-generic-struct.rs b/src/test/run-pass/deriving/deriving-clone-generic-struct.rs index dea50871a74..f6e105555fd 100644 --- a/src/test/run-pass/deriving/deriving-clone-generic-struct.rs +++ b/src/test/run-pass/deriving/deriving-clone-generic-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/deriving/deriving-clone-generic-tuple-struct.rs b/src/test/run-pass/deriving/deriving-clone-generic-tuple-struct.rs index 01ef89f81c1..8b9840de172 100644 --- a/src/test/run-pass/deriving/deriving-clone-generic-tuple-struct.rs +++ b/src/test/run-pass/deriving/deriving-clone-generic-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/deriving/deriving-clone-struct.rs b/src/test/run-pass/deriving/deriving-clone-struct.rs index f82a41f8ba0..7b0a1d20260 100644 --- a/src/test/run-pass/deriving/deriving-clone-struct.rs +++ b/src/test/run-pass/deriving/deriving-clone-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/deriving/deriving-clone-tuple-struct.rs b/src/test/run-pass/deriving/deriving-clone-tuple-struct.rs index 49c675de112..166f1be55e0 100644 --- a/src/test/run-pass/deriving/deriving-clone-tuple-struct.rs +++ b/src/test/run-pass/deriving/deriving-clone-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/deriving/deriving-cmp-generic-enum.rs b/src/test/run-pass/deriving/deriving-cmp-generic-enum.rs index 1a6582d9af2..88da4bd066c 100644 --- a/src/test/run-pass/deriving/deriving-cmp-generic-enum.rs +++ b/src/test/run-pass/deriving/deriving-cmp-generic-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Eq, PartialOrd, Ord)] enum E { diff --git a/src/test/run-pass/deriving/deriving-cmp-generic-struct-enum.rs b/src/test/run-pass/deriving/deriving-cmp-generic-struct-enum.rs index 93bda7fbf25..eeaf2ff7efa 100644 --- a/src/test/run-pass/deriving/deriving-cmp-generic-struct-enum.rs +++ b/src/test/run-pass/deriving/deriving-cmp-generic-struct-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Eq, PartialOrd, Ord)] enum ES { diff --git a/src/test/run-pass/deriving/deriving-cmp-generic-struct.rs b/src/test/run-pass/deriving/deriving-cmp-generic-struct.rs index f2e6fcd13fc..538caf439c7 100644 --- a/src/test/run-pass/deriving/deriving-cmp-generic-struct.rs +++ b/src/test/run-pass/deriving/deriving-cmp-generic-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Eq, PartialOrd, Ord)] struct S { diff --git a/src/test/run-pass/deriving/deriving-cmp-generic-tuple-struct.rs b/src/test/run-pass/deriving/deriving-cmp-generic-tuple-struct.rs index 04688ff352d..79f58d4565c 100644 --- a/src/test/run-pass/deriving/deriving-cmp-generic-tuple-struct.rs +++ b/src/test/run-pass/deriving/deriving-cmp-generic-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Eq, PartialOrd, Ord)] struct TS(T,T); diff --git a/src/test/run-pass/deriving/deriving-cmp-shortcircuit.rs b/src/test/run-pass/deriving/deriving-cmp-shortcircuit.rs index e1f301922bd..140373e9526 100644 --- a/src/test/run-pass/deriving/deriving-cmp-shortcircuit.rs +++ b/src/test/run-pass/deriving/deriving-cmp-shortcircuit.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // check that the derived impls for the comparison traits shortcircuit // where possible, by having a type that panics when compared as the diff --git a/src/test/run-pass/deriving/deriving-copyclone.rs b/src/test/run-pass/deriving/deriving-copyclone.rs index e9da90fe6ed..78d74a11ffc 100644 --- a/src/test/run-pass/deriving/deriving-copyclone.rs +++ b/src/test/run-pass/deriving/deriving-copyclone.rs @@ -1,18 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass //! Test that #[derive(Copy, Clone)] produces a shallow copy //! even when a member violates RFC 1521 -use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; +use std::sync::atomic::{AtomicBool, Ordering}; /// A struct that pretends to be Copy, but actually does something /// in its Clone impl @@ -20,7 +10,7 @@ use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; struct Liar; /// Static cooperating with the rogue Clone impl -static CLONED: AtomicBool = ATOMIC_BOOL_INIT; +static CLONED: AtomicBool = AtomicBool::new(false); impl Clone for Liar { fn clone(&self) -> Self { @@ -46,4 +36,3 @@ fn main() { // if Innocent was byte-for-byte copied, CLONED will still be false assert!(!CLONED.load(Ordering::SeqCst)); } - diff --git a/src/test/run-pass/deriving/deriving-default-box.rs b/src/test/run-pass/deriving/deriving-default-box.rs index 55111a4231a..237dbfaa056 100644 --- a/src/test/run-pass/deriving/deriving-default-box.rs +++ b/src/test/run-pass/deriving/deriving-default-box.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/deriving/deriving-enum-single-variant.rs b/src/test/run-pass/deriving/deriving-enum-single-variant.rs index e304f481baa..1c5979c0747 100644 --- a/src/test/run-pass/deriving/deriving-enum-single-variant.rs +++ b/src/test/run-pass/deriving/deriving-enum-single-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/deriving/deriving-eq-ord-boxed-slice.rs b/src/test/run-pass/deriving/deriving-eq-ord-boxed-slice.rs index 7997aa5a7ec..5b4b0983623 100644 --- a/src/test/run-pass/deriving/deriving-eq-ord-boxed-slice.rs +++ b/src/test/run-pass/deriving/deriving-eq-ord-boxed-slice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, PartialOrd, Eq, Ord, Debug)] struct Foo(Box<[u8]>); diff --git a/src/test/run-pass/deriving/deriving-hash.rs b/src/test/run-pass/deriving/deriving-hash.rs index e149e0e1e0e..68c68c235ef 100644 --- a/src/test/run-pass/deriving/deriving-hash.rs +++ b/src/test/run-pass/deriving/deriving-hash.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/test/run-pass/deriving/deriving-in-fn.rs b/src/test/run-pass/deriving/deriving-in-fn.rs index 00100aa1be1..8931e94a4f8 100644 --- a/src/test/run-pass/deriving/deriving-in-fn.rs +++ b/src/test/run-pass/deriving/deriving-in-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { #[derive(Debug)] diff --git a/src/test/run-pass/deriving/deriving-in-macro.rs b/src/test/run-pass/deriving/deriving-in-macro.rs index dc6fda84f1d..46e8e37838d 100644 --- a/src/test/run-pass/deriving/deriving-in-macro.rs +++ b/src/test/run-pass/deriving/deriving-in-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/deriving/deriving-meta-multiple.rs b/src/test/run-pass/deriving/deriving-meta-multiple.rs index 326a95bdf02..ad255be8dab 100644 --- a/src/test/run-pass/deriving/deriving-meta-multiple.rs +++ b/src/test/run-pass/deriving/deriving-meta-multiple.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(unused_imports)] diff --git a/src/test/run-pass/deriving/deriving-meta.rs b/src/test/run-pass/deriving/deriving-meta.rs index cf016f3e0c6..f2ff4f53557 100644 --- a/src/test/run-pass/deriving/deriving-meta.rs +++ b/src/test/run-pass/deriving/deriving-meta.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(unused_imports)] diff --git a/src/test/run-pass/deriving/deriving-self-lifetime-totalord-totaleq.rs b/src/test/run-pass/deriving/deriving-self-lifetime-totalord-totaleq.rs index 64ef03adcaf..e01b5a26fc7 100644 --- a/src/test/run-pass/deriving/deriving-self-lifetime-totalord-totaleq.rs +++ b/src/test/run-pass/deriving/deriving-self-lifetime-totalord-totaleq.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::cmp::Ordering::{Less,Equal,Greater}; diff --git a/src/test/run-pass/deriving/deriving-show-2.rs b/src/test/run-pass/deriving/deriving-show-2.rs index d5f2535cb70..13d124ed4c3 100644 --- a/src/test/run-pass/deriving/deriving-show-2.rs +++ b/src/test/run-pass/deriving/deriving-show-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] use std::fmt; diff --git a/src/test/run-pass/deriving/deriving-show.rs b/src/test/run-pass/deriving/deriving-show.rs index 000cbe9fa09..98c1f3ac027 100644 --- a/src/test/run-pass/deriving/deriving-show.rs +++ b/src/test/run-pass/deriving/deriving-show.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #[derive(Debug)] diff --git a/src/test/run-pass/deriving/deriving-via-extension-c-enum.rs b/src/test/run-pass/deriving/deriving-via-extension-c-enum.rs index a3d4e179731..7fa1a69d7e0 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-c-enum.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-c-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #[derive(PartialEq, Debug)] diff --git a/src/test/run-pass/deriving/deriving-via-extension-enum.rs b/src/test/run-pass/deriving/deriving-via-extension-enum.rs index 8afce9a9e47..6b58fd96622 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-enum.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #[derive(PartialEq, Debug)] diff --git a/src/test/run-pass/deriving/deriving-via-extension-hash-enum.rs b/src/test/run-pass/deriving/deriving-via-extension-hash-enum.rs index be44fc4d057..2d1ca05f4fc 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-hash-enum.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-hash-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #[derive(Hash)] diff --git a/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs b/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs index 17133f69675..c4037dc2714 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/deriving/deriving-via-extension-struct-empty.rs b/src/test/run-pass/deriving/deriving-via-extension-struct-empty.rs index 7753700db18..9fb250e8470 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-struct-empty.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-struct-empty.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Debug)] struct Foo; diff --git a/src/test/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs b/src/test/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs index babe99b3c56..b6e6f136c75 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #[derive(PartialEq, Debug)] diff --git a/src/test/run-pass/deriving/deriving-via-extension-struct-tuple.rs b/src/test/run-pass/deriving/deriving-via-extension-struct-tuple.rs index dd9d9b7707e..e84906c96bb 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-struct-tuple.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-struct-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Debug)] struct Foo(isize, isize, String); diff --git a/src/test/run-pass/deriving/deriving-via-extension-struct.rs b/src/test/run-pass/deriving/deriving-via-extension-struct.rs index 69bca7ce36d..f4d8b16a02f 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-struct.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Debug)] struct Foo { diff --git a/src/test/run-pass/deriving/deriving-via-extension-type-params.rs b/src/test/run-pass/deriving/deriving-via-extension-type-params.rs index 63d2b58804b..a5dec8ee1ab 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-type-params.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-type-params.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Hash, Debug)] struct Foo { diff --git a/src/test/run-pass/deriving/deriving-with-repr-packed.rs b/src/test/run-pass/deriving/deriving-with-repr-packed.rs index fd84d6da29e..8ce444be13f 100644 --- a/src/test/run-pass/deriving/deriving-with-repr-packed.rs +++ b/src/test/run-pass/deriving/deriving-with-repr-packed.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // check that derive on a packed struct does not call field // methods with a misaligned field. diff --git a/src/test/run-pass/discriminant_value-wrapper.rs b/src/test/run-pass/discriminant_value-wrapper.rs index d7a32423710..f014cce9ddd 100644 --- a/src/test/run-pass/discriminant_value-wrapper.rs +++ b/src/test/run-pass/discriminant_value-wrapper.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem; enum ADT { diff --git a/src/test/run-pass/discriminant_value.rs b/src/test/run-pass/discriminant_value.rs index 06d4f16826f..162ab27cdff 100644 --- a/src/test/run-pass/discriminant_value.rs +++ b/src/test/run-pass/discriminant_value.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] #![feature(core, core_intrinsics)] diff --git a/src/test/run-pass/diverging-fallback-control-flow.rs b/src/test/run-pass/diverging-fallback-control-flow.rs index 9f54f50e540..c88ab42d5a8 100644 --- a/src/test/run-pass/diverging-fallback-control-flow.rs +++ b/src/test/run-pass/diverging-fallback-control-flow.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/src/test/run-pass/diverging-fallback-method-chain.rs b/src/test/run-pass/diverging-fallback-method-chain.rs index 195c55d374b..df1a64e3ae6 100644 --- a/src/test/run-pass/diverging-fallback-method-chain.rs +++ b/src/test/run-pass/diverging-fallback-method-chain.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] // Test a regression found when building compiler. The `produce()` // error type `T` winds up getting unified with result of `x.parse()`; diff --git a/src/test/run-pass/diverging-fallback-option.rs b/src/test/run-pass/diverging-fallback-option.rs index 49f90e7c91f..af517178150 100644 --- a/src/test/run-pass/diverging-fallback-option.rs +++ b/src/test/run-pass/diverging-fallback-option.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] // Here the type of `c` is `Option`, where `?T` is unconstrained. diff --git a/src/test/run-pass/double-ref.rs b/src/test/run-pass/double-ref.rs index 9fa3fbca071..16c98da9456 100644 --- a/src/test/run-pass/double-ref.rs +++ b/src/test/run-pass/double-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/drop/auxiliary/dropck_eyepatch_extern_crate.rs b/src/test/run-pass/drop/auxiliary/dropck_eyepatch_extern_crate.rs index d8912943441..270d5de7ac8 100644 --- a/src/test/run-pass/drop/auxiliary/dropck_eyepatch_extern_crate.rs +++ b/src/test/run-pass/drop/auxiliary/dropck_eyepatch_extern_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(dropck_eyepatch)] // The point of this test is to illustrate that the `#[may_dangle]` diff --git a/src/test/run-pass/drop/drop-on-empty-block-exit.rs b/src/test/run-pass/drop/drop-on-empty-block-exit.rs index 9ddf399ed7a..1747bf029aa 100644 --- a/src/test/run-pass/drop/drop-on-empty-block-exit.rs +++ b/src/test/run-pass/drop/drop-on-empty-block-exit.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/drop/drop-on-ret.rs b/src/test/run-pass/drop/drop-on-ret.rs index e56119df20e..290e274f305 100644 --- a/src/test/run-pass/drop/drop-on-ret.rs +++ b/src/test/run-pass/drop/drop-on-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/drop/drop-struct-as-object.rs b/src/test/run-pass/drop/drop-struct-as-object.rs index b171c1c3a06..307b3f1d6dc 100644 --- a/src/test/run-pass/drop/drop-struct-as-object.rs +++ b/src/test/run-pass/drop/drop-struct-as-object.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/drop/drop-trait-enum.rs b/src/test/run-pass/drop/drop-trait-enum.rs index a34e922a606..aec46575f97 100644 --- a/src/test/run-pass/drop/drop-trait-enum.rs +++ b/src/test/run-pass/drop/drop-trait-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_assignments)] diff --git a/src/test/run-pass/drop/drop-trait-generic.rs b/src/test/run-pass/drop/drop-trait-generic.rs index fc1c0baf4b4..cdefb680c75 100644 --- a/src/test/run-pass/drop/drop-trait-generic.rs +++ b/src/test/run-pass/drop/drop-trait-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] struct S { diff --git a/src/test/run-pass/drop/drop-trait.rs b/src/test/run-pass/drop/drop-trait.rs index 61ce68037ce..d93f7718091 100644 --- a/src/test/run-pass/drop/drop-trait.rs +++ b/src/test/run-pass/drop/drop-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] struct Foo { diff --git a/src/test/run-pass/drop/drop-uninhabited-enum.rs b/src/test/run-pass/drop/drop-uninhabited-enum.rs index 6ff17a33d4a..b3566f68533 100644 --- a/src/test/run-pass/drop/drop-uninhabited-enum.rs +++ b/src/test/run-pass/drop/drop-uninhabited-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/drop/drop-with-type-ascription-1.rs b/src/test/run-pass/drop/drop-with-type-ascription-1.rs index 2983508363b..e5a1a48df56 100644 --- a/src/test/run-pass/drop/drop-with-type-ascription-1.rs +++ b/src/test/run-pass/drop/drop-with-type-ascription-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { diff --git a/src/test/run-pass/drop/drop-with-type-ascription-2.rs b/src/test/run-pass/drop/drop-with-type-ascription-2.rs index a2ac470ff11..fb70ad48e88 100644 --- a/src/test/run-pass/drop/drop-with-type-ascription-2.rs +++ b/src/test/run-pass/drop/drop-with-type-ascription-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { diff --git a/src/test/run-pass/drop/dropck-eyepatch-extern-crate.rs b/src/test/run-pass/drop/dropck-eyepatch-extern-crate.rs index 42d54b7be37..fecfd5edffb 100644 --- a/src/test/run-pass/drop/dropck-eyepatch-extern-crate.rs +++ b/src/test/run-pass/drop/dropck-eyepatch-extern-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:dropck_eyepatch_extern_crate.rs diff --git a/src/test/run-pass/drop/dropck-eyepatch-reorder.rs b/src/test/run-pass/drop/dropck-eyepatch-reorder.rs index 6696044a02d..b4605878a54 100644 --- a/src/test/run-pass/drop/dropck-eyepatch-reorder.rs +++ b/src/test/run-pass/drop/dropck-eyepatch-reorder.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(dropck_eyepatch)] diff --git a/src/test/run-pass/drop/dropck-eyepatch.rs b/src/test/run-pass/drop/dropck-eyepatch.rs index fb9af09a7ce..9255391e412 100644 --- a/src/test/run-pass/drop/dropck-eyepatch.rs +++ b/src/test/run-pass/drop/dropck-eyepatch.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(dropck_eyepatch)] @@ -32,7 +22,7 @@ // - D means "I implement Drop" // // - P means "I implement Drop but guarantee my (first) parameter is -// pure, i.e. not accessed from the destructor"; no other parameters +// pure, i.e., not accessed from the destructor"; no other parameters // are pure. // // - S means "I do not implement Drop" diff --git a/src/test/run-pass/drop/dropck_legal_cycles.rs b/src/test/run-pass/drop/dropck_legal_cycles.rs index 2c88cfd5c8f..a4f4c2666ac 100644 --- a/src/test/run-pass/drop/dropck_legal_cycles.rs +++ b/src/test/run-pass/drop/dropck_legal_cycles.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This test exercises cases where cyclic structure is legal, // including when the cycles go through data-structures such @@ -108,7 +98,7 @@ // of all-zeroes. // // 6. assert that the context confirms that it actually saw a cycle (since a traversal -// might have terminated, e.g. on a tree structure that contained no cycles). +// might have terminated, e.g., on a tree structure that contained no cycles). use std::cell::{Cell, RefCell}; use std::cmp::Ordering; diff --git a/src/test/run-pass/drop/dynamic-drop.rs b/src/test/run-pass/drop/dynamic-drop.rs index 8fecaa2a109..97e4cded80b 100644 --- a/src/test/run-pass/drop/dynamic-drop.rs +++ b/src/test/run-pass/drop/dynamic-drop.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] #![allow(unused_variables)] @@ -22,6 +12,7 @@ use std::cell::{Cell, RefCell}; use std::ops::Generator; use std::panic; +use std::pin::Pin; use std::usize; struct InjectedFailure; @@ -182,7 +173,7 @@ fn generator(a: &Allocator, run_count: usize) { ); }; for _ in 0..run_count { - unsafe { gen.resume(); } + Pin::new(&mut gen).resume(); } } diff --git a/src/test/run-pass/drop/no-drop-flag-size.rs b/src/test/run-pass/drop/no-drop-flag-size.rs index a8fa202e3b5..103e70ef6ee 100644 --- a/src/test/run-pass/drop/no-drop-flag-size.rs +++ b/src/test/run-pass/drop/no-drop-flag-size.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] use std::mem::size_of; diff --git a/src/test/run-pass/drop/nondrop-cycle.rs b/src/test/run-pass/drop/nondrop-cycle.rs index 7e2bb38f5bd..29070f917e4 100644 --- a/src/test/run-pass/drop/nondrop-cycle.rs +++ b/src/test/run-pass/drop/nondrop-cycle.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/dupe-first-attr.rc b/src/test/run-pass/dupe-first-attr.rc index d95f1506a9b..cb6a82a15da 100644 --- a/src/test/run-pass/dupe-first-attr.rc +++ b/src/test/run-pass/dupe-first-attr.rc @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for a problem with the first mod attribute // being applied to every mod diff --git a/src/test/run-pass/duplicated-external-mods.rs b/src/test/run-pass/duplicated-external-mods.rs index 4cb3dbe027a..f2c1e1f6540 100644 --- a/src/test/run-pass/duplicated-external-mods.rs +++ b/src/test/run-pass/duplicated-external-mods.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:anon-extern-mod-cross-crate-1.rs // aux-build:anon-extern-mod-cross-crate-1.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/dynamically-sized-types/dst-coerce-custom.rs b/src/test/run-pass/dynamically-sized-types/dst-coerce-custom.rs index affc569c63d..35927bde027 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-coerce-custom.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-coerce-custom.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test a very simple custom DST coercion. diff --git a/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs b/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs index 64ec3143356..bbd0b1f8be1 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(stable_features)] diff --git a/src/test/run-pass/dynamically-sized-types/dst-coercions.rs b/src/test/run-pass/dynamically-sized-types/dst-coercions.rs index 10a59599b40..06c2892b69e 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-coercions.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-coercions.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Test coercions involving DST and/or raw pointers diff --git a/src/test/run-pass/dynamically-sized-types/dst-deref-mut.rs b/src/test/run-pass/dynamically-sized-types/dst-deref-mut.rs index a2c0a8c9beb..1d62f42bd4a 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-deref-mut.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-deref-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that a custom deref with a fat pointer return type does not ICE diff --git a/src/test/run-pass/dynamically-sized-types/dst-deref.rs b/src/test/run-pass/dynamically-sized-types/dst-deref.rs index db9ef399f0e..0a350bac14a 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-deref.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-deref.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that a custom deref with a fat pointer return type does not ICE diff --git a/src/test/run-pass/dynamically-sized-types/dst-field-align.rs b/src/test/run-pass/dynamically-sized-types/dst-field-align.rs index 84f02337110..9c81f5652d1 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-field-align.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-field-align.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] struct Foo { diff --git a/src/test/run-pass/dynamically-sized-types/dst-index.rs b/src/test/run-pass/dynamically-sized-types/dst-index.rs index 7dd5c193795..0728599f323 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-index.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-index.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Test that overloaded index expressions with DST result types diff --git a/src/test/run-pass/dynamically-sized-types/dst-irrefutable-bind.rs b/src/test/run-pass/dynamically-sized-types/dst-irrefutable-bind.rs index 031aa7c04e6..0a6c49111fe 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-irrefutable-bind.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-irrefutable-bind.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(unsized_tuple_coercion)] diff --git a/src/test/run-pass/dynamically-sized-types/dst-raw.rs b/src/test/run-pass/dynamically-sized-types/dst-raw.rs index 96b19b9e4d9..949adbbefce 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-raw.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-raw.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test DST raw pointers diff --git a/src/test/run-pass/dynamically-sized-types/dst-struct-sole.rs b/src/test/run-pass/dynamically-sized-types/dst-struct-sole.rs index 9959b5bf5bb..6ca07fcf8da 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-struct-sole.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-struct-sole.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // As dst-struct.rs, but the unsized field is the only field in the struct. diff --git a/src/test/run-pass/dynamically-sized-types/dst-struct.rs b/src/test/run-pass/dynamically-sized-types/dst-struct.rs index 1853c6a04d8..25ec07b88a6 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-struct.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/dynamically-sized-types/dst-trait-tuple.rs b/src/test/run-pass/dynamically-sized-types/dst-trait-tuple.rs index 4083f0e2b09..ca88605ee3a 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-trait-tuple.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-trait-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(type_alias_bounds)] diff --git a/src/test/run-pass/dynamically-sized-types/dst-trait.rs b/src/test/run-pass/dynamically-sized-types/dst-trait.rs index 3ce2cffbe09..9a9bd12d50f 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-trait.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/dynamically-sized-types/dst-tuple-sole.rs b/src/test/run-pass/dynamically-sized-types/dst-tuple-sole.rs index 43a1bacec31..606689da0c2 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-tuple-sole.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-tuple-sole.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] #![allow(type_alias_bounds)] diff --git a/src/test/run-pass/dynamically-sized-types/dst-tuple.rs b/src/test/run-pass/dynamically-sized-types/dst-tuple.rs index 753203d250d..f70a45a1b35 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-tuple.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(type_alias_bounds)] diff --git a/src/test/run-pass/early-ret-binop-add.rs b/src/test/run-pass/early-ret-binop-add.rs index c4401781f59..158468c572c 100644 --- a/src/test/run-pass/early-ret-binop-add.rs +++ b/src/test/run-pass/early-ret-binop-add.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unreachable_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/early-vtbl-resolution.rs b/src/test/run-pass/early-vtbl-resolution.rs index 985ed08d34d..812771c29b3 100644 --- a/src/test/run-pass/early-vtbl-resolution.rs +++ b/src/test/run-pass/early-vtbl-resolution.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/edition-keywords-2015-2015.rs b/src/test/run-pass/edition-keywords-2015-2015.rs index b805b01ae39..7d25b71422d 100644 --- a/src/test/run-pass/edition-keywords-2015-2015.rs +++ b/src/test/run-pass/edition-keywords-2015-2015.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_mut)] #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/src/test/run-pass/edition-keywords-2015-2018.rs b/src/test/run-pass/edition-keywords-2015-2018.rs index 1e3d0c5f777..92d474629c1 100644 --- a/src/test/run-pass/edition-keywords-2015-2018.rs +++ b/src/test/run-pass/edition-keywords-2015-2018.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_mut)] #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/src/test/run-pass/edition-keywords-2018-2015.rs b/src/test/run-pass/edition-keywords-2018-2015.rs index 9b2e49c5111..e4ed5ffff98 100644 --- a/src/test/run-pass/edition-keywords-2018-2015.rs +++ b/src/test/run-pass/edition-keywords-2018-2015.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_assignments)] // edition:2018 // aux-build:edition-kw-macro-2015.rs diff --git a/src/test/run-pass/edition-keywords-2018-2018.rs b/src/test/run-pass/edition-keywords-2018-2018.rs index be632b11374..e3624ac96ed 100644 --- a/src/test/run-pass/edition-keywords-2018-2018.rs +++ b/src/test/run-pass/edition-keywords-2018-2018.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_assignments)] // edition:2018 // aux-build:edition-kw-macro-2018.rs diff --git a/src/test/run-pass/else-if.rs b/src/test/run-pass/else-if.rs index afc1d200b27..83a6658895a 100644 --- a/src/test/run-pass/else-if.rs +++ b/src/test/run-pass/else-if.rs @@ -1,16 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - pub fn main() { if 1 == 2 { assert!((false)); diff --git a/src/test/run-pass/empty-allocation-non-null.rs b/src/test/run-pass/empty-allocation-non-null.rs index 3dbe7da6ac7..31117936c76 100644 --- a/src/test/run-pass/empty-allocation-non-null.rs +++ b/src/test/run-pass/empty-allocation-non-null.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { assert!(Some(Box::new(())).is_some()); diff --git a/src/test/run-pass/empty-allocation-rvalue-non-null.rs b/src/test/run-pass/empty-allocation-rvalue-non-null.rs index 28bfb368b6e..ac597bcb208 100644 --- a/src/test/run-pass/empty-allocation-rvalue-non-null.rs +++ b/src/test/run-pass/empty-allocation-rvalue-non-null.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/empty-type-parameter-list.rs b/src/test/run-pass/empty-type-parameter-list.rs index 7af2844d564..43275090f2d 100644 --- a/src/test/run-pass/empty-type-parameter-list.rs +++ b/src/test/run-pass/empty-type-parameter-list.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that empty type parameter list (<>) is synonymous with // no type parameters at all diff --git a/src/test/run-pass/empty_global_asm.rs b/src/test/run-pass/empty_global_asm.rs index db73da2747f..5789985a038 100644 --- a/src/test/run-pass/empty_global_asm.rs +++ b/src/test/run-pass/empty_global_asm.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(global_asm)] #[cfg(target_arch = "x86")] diff --git a/src/test/run-pass/env-args-reverse-iterator.rs b/src/test/run-pass/env-args-reverse-iterator.rs index 0645c65d0d6..78548fd9bc5 100644 --- a/src/test/run-pass/env-args-reverse-iterator.rs +++ b/src/test/run-pass/env-args-reverse-iterator.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/env-funky-keys.rs b/src/test/run-pass/env-funky-keys.rs index 12e1cbe97d8..79f32bd6c29 100644 --- a/src/test/run-pass/env-funky-keys.rs +++ b/src/test/run-pass/env-funky-keys.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ignore this test on Android, because it segfaults there. // ignore-android @@ -16,7 +6,7 @@ // ignore-emscripten no execve // no-prefer-dynamic -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/env-home-dir.rs b/src/test/run-pass/env-home-dir.rs index 6bb2fe4b34d..90b75344730 100644 --- a/src/test/run-pass/env-home-dir.rs +++ b/src/test/run-pass/env-home-dir.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(deprecated)] // ignore-cloudabi no environment variables present diff --git a/src/test/run-pass/env-null-vars.rs b/src/test/run-pass/env-null-vars.rs index 9a461991c1e..bdd1d4778cf 100644 --- a/src/test/run-pass/env-null-vars.rs +++ b/src/test/run-pass/env-null-vars.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] // ignore-windows @@ -15,7 +5,7 @@ // issue-53200 -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; use std::env; diff --git a/src/test/run-pass/env-vars.rs b/src/test/run-pass/env-vars.rs index d7b4c81fc7f..6159638745a 100644 --- a/src/test/run-pass/env-vars.rs +++ b/src/test/run-pass/env-vars.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no env vars // ignore-wasm32-bare no env vars diff --git a/src/test/run-pass/epoch-gate-feature.rs b/src/test/run-pass/epoch-gate-feature.rs index 754e30f3adf..6f0b31518c2 100644 --- a/src/test/run-pass/epoch-gate-feature.rs +++ b/src/test/run-pass/epoch-gate-feature.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_variables)] // Checks if the correct registers are being used to pass arguments diff --git a/src/test/run-pass/eq-multidispatch.rs b/src/test/run-pass/eq-multidispatch.rs index ca37ee28bcb..1212f5d17db 100644 --- a/src/test/run-pass/eq-multidispatch.rs +++ b/src/test/run-pass/eq-multidispatch.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #[derive(PartialEq, Debug)] struct Bar; #[derive(Debug)] diff --git a/src/test/run-pass/estr-uniq.rs b/src/test/run-pass/estr-uniq.rs index e8047b3cb7f..6b2607a997b 100644 --- a/src/test/run-pass/estr-uniq.rs +++ b/src/test/run-pass/estr-uniq.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_assignments)] #![allow(unknown_lints)] diff --git a/src/test/run-pass/exec-env.rs b/src/test/run-pass/exec-env.rs index b2d2e70f83b..1327b558fc9 100644 --- a/src/test/run-pass/exec-env.rs +++ b/src/test/run-pass/exec-env.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // exec-env:TEST_EXEC_ENV=22 // ignore-cloudabi no env vars // ignore-emscripten FIXME: issue #31622 diff --git a/src/test/run-pass/existential_type.rs b/src/test/run-pass/existential_type.rs index 0193fe4b833..dfb195ec830 100644 --- a/src/test/run-pass/existential_type.rs +++ b/src/test/run-pass/existential_type.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/src/test/run-pass/explicit-i-suffix.rs b/src/test/run-pass/explicit-i-suffix.rs index b86af5d2fab..119cce3087e 100644 --- a/src/test/run-pass/explicit-i-suffix.rs +++ b/src/test/run-pass/explicit-i-suffix.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/export-glob-imports-target.rs b/src/test/run-pass/export-glob-imports-target.rs index 36724f0b648..0ac80e65798 100644 --- a/src/test/run-pass/export-glob-imports-target.rs +++ b/src/test/run-pass/export-glob-imports-target.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals)] #![allow(dead_code)] // Test that a glob-export functions as an import diff --git a/src/test/run-pass/export-multi.rs b/src/test/run-pass/export-multi.rs index e7c35fcd756..bfa2765d254 100644 --- a/src/test/run-pass/export-multi.rs +++ b/src/test/run-pass/export-multi.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 use m::f; diff --git a/src/test/run-pass/export-non-interference2.rs b/src/test/run-pass/export-non-interference2.rs index 0b9b8fbcfd3..30d5a0d9c05 100644 --- a/src/test/run-pass/export-non-interference2.rs +++ b/src/test/run-pass/export-non-interference2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub mod bar { pub fn y() { super::super::foo::x(); } diff --git a/src/test/run-pass/export-non-interference3.rs b/src/test/run-pass/export-non-interference3.rs index b7ef4df7ed6..a11ea3a0455 100644 --- a/src/test/run-pass/export-non-interference3.rs +++ b/src/test/run-pass/export-non-interference3.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod foo { pub fn x() { ::bar::x(); } } diff --git a/src/test/run-pass/expr-block-fn.rs b/src/test/run-pass/expr-block-fn.rs index 32641c4a3f2..229e2b02bf0 100644 --- a/src/test/run-pass/expr-block-fn.rs +++ b/src/test/run-pass/expr-block-fn.rs @@ -1,16 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - fn test_fn() { fn ten() -> isize { return 10; } let rs = ten; diff --git a/src/test/run-pass/expr-block-generic-unique1.rs b/src/test/run-pass/expr-block-generic-unique1.rs index 304f1c7a2ea..b89f2f9660c 100644 --- a/src/test/run-pass/expr-block-generic-unique1.rs +++ b/src/test/run-pass/expr-block-generic-unique1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn test_generic(expected: Box, eq: F) where T: Clone, F: FnOnce(Box, Box) -> bool { diff --git a/src/test/run-pass/expr-block-generic-unique2.rs b/src/test/run-pass/expr-block-generic-unique2.rs index af3f5547867..4c712abcc3f 100644 --- a/src/test/run-pass/expr-block-generic-unique2.rs +++ b/src/test/run-pass/expr-block-generic-unique2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn test_generic(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> bool { diff --git a/src/test/run-pass/expr-block-generic.rs b/src/test/run-pass/expr-block-generic.rs index 8795962bebd..5665790a84d 100644 --- a/src/test/run-pass/expr-block-generic.rs +++ b/src/test/run-pass/expr-block-generic.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn test_generic(expected: T, eq: F) where F: FnOnce(T, T) -> bool { let actual: T = { expected.clone() }; assert!(eq(expected, actual)); diff --git a/src/test/run-pass/expr-block-slot.rs b/src/test/run-pass/expr-block-slot.rs index d9b4c95bc24..65d58e00bc9 100644 --- a/src/test/run-pass/expr-block-slot.rs +++ b/src/test/run-pass/expr-block-slot.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #377 diff --git a/src/test/run-pass/expr-block-unique.rs b/src/test/run-pass/expr-block-unique.rs index 2426ee5966c..a5b7bacec23 100644 --- a/src/test/run-pass/expr-block-unique.rs +++ b/src/test/run-pass/expr-block-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] pub fn main() { let x: Box<_> = { box 100 }; assert_eq!(*x, 100); } diff --git a/src/test/run-pass/expr-block.rs b/src/test/run-pass/expr-block.rs index 3459b3c84c5..222e5cfbcf6 100644 --- a/src/test/run-pass/expr-block.rs +++ b/src/test/run-pass/expr-block.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] diff --git a/src/test/run-pass/expr-copy.rs b/src/test/run-pass/expr-copy.rs index 99e74a6b856..fdea32f476a 100644 --- a/src/test/run-pass/expr-copy.rs +++ b/src/test/run-pass/expr-copy.rs @@ -1,15 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - fn f(arg: &mut A) { arg.a = 100; } diff --git a/src/test/run-pass/expr-empty-ret.rs b/src/test/run-pass/expr-empty-ret.rs index 9fb0f07b6a0..6bdf4350a99 100644 --- a/src/test/run-pass/expr-empty-ret.rs +++ b/src/test/run-pass/expr-empty-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Issue #521 diff --git a/src/test/run-pass/expr-fn.rs b/src/test/run-pass/expr-fn.rs index cc9a2e60dec..9e0679b959b 100644 --- a/src/test/run-pass/expr-fn.rs +++ b/src/test/run-pass/expr-fn.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - fn test_int() { fn f() -> isize { 10 } assert_eq!(f(), 10); diff --git a/src/test/run-pass/expr-if-generic.rs b/src/test/run-pass/expr-if-generic.rs index 94c6b70bb62..3e3600c4528 100644 --- a/src/test/run-pass/expr-if-generic.rs +++ b/src/test/run-pass/expr-if-generic.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn test_generic(expected: T, not_expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> bool, diff --git a/src/test/run-pass/expr-if-panic-all.rs b/src/test/run-pass/expr-if-panic-all.rs index 43110533b6d..ea7f36f8a3c 100644 --- a/src/test/run-pass/expr-if-panic-all.rs +++ b/src/test/run-pass/expr-if-panic-all.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // When all branches of an if expression result in panic, the entire if // expression results in panic. diff --git a/src/test/run-pass/expr-if-panic.rs b/src/test/run-pass/expr-if-panic.rs index 1bedc2a5a17..ae92e3b125b 100644 --- a/src/test/run-pass/expr-if-panic.rs +++ b/src/test/run-pass/expr-if-panic.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn test_if_panic() { let x = if false { panic!() } else { 10 }; assert_eq!(x, 10); diff --git a/src/test/run-pass/expr-if-unique.rs b/src/test/run-pass/expr-if-unique.rs index a8547536603..ef76fb27e9d 100644 --- a/src/test/run-pass/expr-if-unique.rs +++ b/src/test/run-pass/expr-if-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] // Tests for if as expressions returning boxed types diff --git a/src/test/run-pass/expr-if.rs b/src/test/run-pass/expr-if.rs index e8458e32011..4b8d363b020 100644 --- a/src/test/run-pass/expr-if.rs +++ b/src/test/run-pass/expr-if.rs @@ -1,17 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - - // Tests for if as expressions fn test_if() { let rs: bool = if true { true } else { false }; assert!((rs)); } diff --git a/src/test/run-pass/expr-scope.rs b/src/test/run-pass/expr-scope.rs index a1d86218846..15bb4a2eb0b 100644 --- a/src/test/run-pass/expr-scope.rs +++ b/src/test/run-pass/expr-scope.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #762 // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/ext-expand-inner-exprs.rs b/src/test/run-pass/ext-expand-inner-exprs.rs index 90ca31e80be..a32b3d7f002 100644 --- a/src/test/run-pass/ext-expand-inner-exprs.rs +++ b/src/test/run-pass/ext-expand-inner-exprs.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - static FOO : &'static str = concat!(concat!("hel", "lo"), "world"); pub fn main() { diff --git a/src/test/run-pass/extend-for-unit.rs b/src/test/run-pass/extend-for-unit.rs index d1a0614bd8a..1c1e61239b7 100644 --- a/src/test/run-pass/extend-for-unit.rs +++ b/src/test/run-pass/extend-for-unit.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let mut x = 0; { diff --git a/src/test/run-pass/exterior.rs b/src/test/run-pass/exterior.rs index 938c556038f..01ed7dbac1f 100644 --- a/src/test/run-pass/exterior.rs +++ b/src/test/run-pass/exterior.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] diff --git a/src/test/run-pass/extern/auxiliary/extern-crosscrate-source.rs b/src/test/run-pass/extern/auxiliary/extern-crosscrate-source.rs index 150dffeea88..d4568d38e25 100644 --- a/src/test/run-pass/extern/auxiliary/extern-crosscrate-source.rs +++ b/src/test/run-pass/extern/auxiliary/extern-crosscrate-source.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="externcallback"] #![crate_type = "lib"] -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/extern/auxiliary/extern-take-value.rs b/src/test/run-pass/extern/auxiliary/extern-take-value.rs index 500c455136b..869e794cc8a 100644 --- a/src/test/run-pass/extern/auxiliary/extern-take-value.rs +++ b/src/test/run-pass/extern/auxiliary/extern-take-value.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub extern fn f() -> i32 { 1 } pub extern fn g() -> i32 { 2 } diff --git a/src/test/run-pass/extern/auxiliary/extern_calling_convention.rs b/src/test/run-pass/extern/auxiliary/extern_calling_convention.rs index 55a4226c663..968b1a25510 100644 --- a/src/test/run-pass/extern/auxiliary/extern_calling_convention.rs +++ b/src/test/run-pass/extern/auxiliary/extern_calling_convention.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure Rust generates the correct calling convention for extern // functions. diff --git a/src/test/run-pass/extern/auxiliary/extern_mod_ordering_lib.rs b/src/test/run-pass/extern/auxiliary/extern_mod_ordering_lib.rs index 0fb6adfcda1..7357f59700e 100644 --- a/src/test/run-pass/extern/auxiliary/extern_mod_ordering_lib.rs +++ b/src/test/run-pass/extern/auxiliary/extern_mod_ordering_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub mod extern_mod_ordering_lib { diff --git a/src/test/run-pass/extern/auxiliary/fat_drop.rs b/src/test/run-pass/extern/auxiliary/fat_drop.rs index 1f944b6ed32..768d29876b9 100644 --- a/src/test/run-pass/extern/auxiliary/fat_drop.rs +++ b/src/test/run-pass/extern/auxiliary/fat_drop.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub static mut DROPPED: bool = false; pub struct S { diff --git a/src/test/run-pass/extern/extern-1.rs b/src/test/run-pass/extern/extern-1.rs index f468da4a449..eb9aabc87bc 100644 --- a/src/test/run-pass/extern/extern-1.rs +++ b/src/test/run-pass/extern/extern-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/extern/extern-call-deep.rs b/src/test/run-pass/extern/extern-call-deep.rs index 6e8d94becbd..81f884dada9 100644 --- a/src/test/run-pass/extern/extern-call-deep.rs +++ b/src/test/run-pass/extern/extern-call-deep.rs @@ -1,17 +1,8 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare no libc to test ffi with +// ignore-emscripten blows the JS stack -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/extern/extern-call-deep2.rs b/src/test/run-pass/extern/extern-call-deep2.rs index 28157c5a8d5..b31489b1e10 100644 --- a/src/test/run-pass/extern/extern-call-deep2.rs +++ b/src/test/run-pass/extern/extern-call-deep2.rs @@ -1,18 +1,8 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; use std::thread; diff --git a/src/test/run-pass/extern/extern-call-direct.rs b/src/test/run-pass/extern/extern-call-direct.rs index 55300a44c1b..72041764215 100644 --- a/src/test/run-pass/extern/extern-call-direct.rs +++ b/src/test/run-pass/extern/extern-call-direct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test direct calls to extern fns. diff --git a/src/test/run-pass/extern/extern-call-indirect.rs b/src/test/run-pass/extern/extern-call-indirect.rs index 1badb10364e..158b54e4b8c 100644 --- a/src/test/run-pass/extern/extern-call-indirect.rs +++ b/src/test/run-pass/extern/extern-call-indirect.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/extern/extern-call-scrub.rs b/src/test/run-pass/extern/extern-call-scrub.rs index ea18069fa32..a7b1065c9e1 100644 --- a/src/test/run-pass/extern/extern-call-scrub.rs +++ b/src/test/run-pass/extern/extern-call-scrub.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // This time we're testing repeatedly going up and down both stacks to @@ -16,7 +6,7 @@ // ignore-emscripten no threads support -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; use std::thread; diff --git a/src/test/run-pass/extern/extern-calling-convention-test.rs b/src/test/run-pass/extern/extern-calling-convention-test.rs index ed1657db759..7231a7cde85 100644 --- a/src/test/run-pass/extern/extern-calling-convention-test.rs +++ b/src/test/run-pass/extern/extern-calling-convention-test.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:extern_calling_convention.rs diff --git a/src/test/run-pass/extern/extern-compare-with-return-type.rs b/src/test/run-pass/extern/extern-compare-with-return-type.rs index 451b87f575a..6c9ed3760f6 100644 --- a/src/test/run-pass/extern/extern-compare-with-return-type.rs +++ b/src/test/run-pass/extern/extern-compare-with-return-type.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that we can compare various kinds of extern fn signatures. #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/extern/extern-crosscrate.rs b/src/test/run-pass/extern/extern-crosscrate.rs index c6fccbe003c..123ce20ca26 100644 --- a/src/test/run-pass/extern/extern-crosscrate.rs +++ b/src/test/run-pass/extern/extern-crosscrate.rs @@ -1,18 +1,8 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:extern-crosscrate-source.rs // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate externcallback; extern crate libc; diff --git a/src/test/run-pass/extern/extern-foreign-crate.rs b/src/test/run-pass/extern/extern-foreign-crate.rs index 615b07619c2..7f774c44277 100644 --- a/src/test/run-pass/extern/extern-foreign-crate.rs +++ b/src/test/run-pass/extern/extern-foreign-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/extern/extern-methods.rs b/src/test/run-pass/extern/extern-methods.rs index 872391612ad..b142ec59e88 100644 --- a/src/test/run-pass/extern/extern-methods.rs +++ b/src/test/run-pass/extern/extern-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-arm // ignore-aarch64 diff --git a/src/test/run-pass/extern/extern-mod-abi.rs b/src/test/run-pass/extern/extern-mod-abi.rs index 51b2498b6c7..c543394cca0 100644 --- a/src/test/run-pass/extern/extern-mod-abi.rs +++ b/src/test/run-pass/extern/extern-mod-abi.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/extern/extern-mod-ordering-exe.rs b/src/test/run-pass/extern/extern-mod-ordering-exe.rs index 42b8791f921..d7cc4dffb44 100644 --- a/src/test/run-pass/extern/extern-mod-ordering-exe.rs +++ b/src/test/run-pass/extern/extern-mod-ordering-exe.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:extern_mod_ordering_lib.rs diff --git a/src/test/run-pass/extern/extern-pass-TwoU16s.rs b/src/test/run-pass/extern/extern-pass-TwoU16s.rs index 042c27d0902..285bce2e19c 100644 --- a/src/test/run-pass/extern/extern-pass-TwoU16s.rs +++ b/src/test/run-pass/extern/extern-pass-TwoU16s.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(improper_ctypes)] diff --git a/src/test/run-pass/extern/extern-pass-TwoU32s.rs b/src/test/run-pass/extern/extern-pass-TwoU32s.rs index de1819a1fbd..fb18aa8d22f 100644 --- a/src/test/run-pass/extern/extern-pass-TwoU32s.rs +++ b/src/test/run-pass/extern/extern-pass-TwoU32s.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(improper_ctypes)] diff --git a/src/test/run-pass/extern/extern-pass-TwoU64s.rs b/src/test/run-pass/extern/extern-pass-TwoU64s.rs index 5e4b3823b14..419648263aa 100644 --- a/src/test/run-pass/extern/extern-pass-TwoU64s.rs +++ b/src/test/run-pass/extern/extern-pass-TwoU64s.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(improper_ctypes)] diff --git a/src/test/run-pass/extern/extern-pass-TwoU8s.rs b/src/test/run-pass/extern/extern-pass-TwoU8s.rs index affcf62af70..53a6a0f29f8 100644 --- a/src/test/run-pass/extern/extern-pass-TwoU8s.rs +++ b/src/test/run-pass/extern/extern-pass-TwoU8s.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(improper_ctypes)] diff --git a/src/test/run-pass/extern/extern-pass-char.rs b/src/test/run-pass/extern/extern-pass-char.rs index 95999b8d983..22f841b4552 100644 --- a/src/test/run-pass/extern/extern-pass-char.rs +++ b/src/test/run-pass/extern/extern-pass-char.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare no libc for ffi testing diff --git a/src/test/run-pass/extern/extern-pass-double.rs b/src/test/run-pass/extern/extern-pass-double.rs index ce94790c6d3..dbd0a2dfa48 100644 --- a/src/test/run-pass/extern/extern-pass-double.rs +++ b/src/test/run-pass/extern/extern-pass-double.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare no libc for ffi testing diff --git a/src/test/run-pass/extern/extern-pass-empty.rs b/src/test/run-pass/extern/extern-pass-empty.rs index ff2e4e61a74..07099a24204 100644 --- a/src/test/run-pass/extern/extern-pass-empty.rs +++ b/src/test/run-pass/extern/extern-pass-empty.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(improper_ctypes)] // FIXME: this test is inherently not FFI-safe. diff --git a/src/test/run-pass/extern/extern-pass-u32.rs b/src/test/run-pass/extern/extern-pass-u32.rs index 9500ad391c7..f2efdb7d366 100644 --- a/src/test/run-pass/extern/extern-pass-u32.rs +++ b/src/test/run-pass/extern/extern-pass-u32.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare no libc for ffi testing diff --git a/src/test/run-pass/extern/extern-pass-u64.rs b/src/test/run-pass/extern/extern-pass-u64.rs index bc4cf767087..975446d430c 100644 --- a/src/test/run-pass/extern/extern-pass-u64.rs +++ b/src/test/run-pass/extern/extern-pass-u64.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare no libc for ffi testing diff --git a/src/test/run-pass/extern/extern-prelude-core.rs b/src/test/run-pass/extern/extern-prelude-core.rs index 67579fd9911..a5d31009f9c 100644 --- a/src/test/run-pass/extern/extern-prelude-core.rs +++ b/src/test/run-pass/extern/extern-prelude-core.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(extern_prelude, lang_items, start, alloc)] #![no_std] diff --git a/src/test/run-pass/extern/extern-prelude-core.stderr b/src/test/run-pass/extern/extern-prelude-core.stderr index f7699531857..417483af707 100644 --- a/src/test/run-pass/extern/extern-prelude-core.stderr +++ b/src/test/run-pass/extern/extern-prelude-core.stderr @@ -1,5 +1,5 @@ warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/extern-prelude-core.rs:12:12 + --> $DIR/extern-prelude-core.rs:2:12 | LL | #![feature(extern_prelude, lang_items, start, alloc)] | ^^^^^^^^^^^^^^ diff --git a/src/test/run-pass/extern/extern-prelude-no-speculative.rs b/src/test/run-pass/extern/extern-prelude-no-speculative.rs index 372f34454de..cc00737ab59 100644 --- a/src/test/run-pass/extern/extern-prelude-no-speculative.rs +++ b/src/test/run-pass/extern/extern-prelude-no-speculative.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // compile-flags: --extern LooksLikeExternCrate diff --git a/src/test/run-pass/extern/extern-prelude-std.rs b/src/test/run-pass/extern/extern-prelude-std.rs index 226635dcb7c..3d28448ee86 100644 --- a/src/test/run-pass/extern/extern-prelude-std.rs +++ b/src/test/run-pass/extern/extern-prelude-std.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(extern_prelude)] diff --git a/src/test/run-pass/extern/extern-prelude-std.stderr b/src/test/run-pass/extern/extern-prelude-std.stderr index 8c059b4ebeb..f193c57146d 100644 --- a/src/test/run-pass/extern/extern-prelude-std.stderr +++ b/src/test/run-pass/extern/extern-prelude-std.stderr @@ -1,5 +1,5 @@ warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/extern-prelude-std.rs:12:12 + --> $DIR/extern-prelude-std.rs:2:12 | LL | #![feature(extern_prelude)] | ^^^^^^^^^^^^^^ diff --git a/src/test/run-pass/extern/extern-pub.rs b/src/test/run-pass/extern/extern-pub.rs index dfe017d4c33..c97e04b0755 100644 --- a/src/test/run-pass/extern/extern-pub.rs +++ b/src/test/run-pass/extern/extern-pub.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/extern/extern-return-TwoU16s.rs b/src/test/run-pass/extern/extern-return-TwoU16s.rs index 826b5083676..dd884ee77fe 100644 --- a/src/test/run-pass/extern/extern-return-TwoU16s.rs +++ b/src/test/run-pass/extern/extern-return-TwoU16s.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(improper_ctypes)] diff --git a/src/test/run-pass/extern/extern-return-TwoU32s.rs b/src/test/run-pass/extern/extern-return-TwoU32s.rs index 15584f28d07..d6aaf5c9eaf 100644 --- a/src/test/run-pass/extern/extern-return-TwoU32s.rs +++ b/src/test/run-pass/extern/extern-return-TwoU32s.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(improper_ctypes)] diff --git a/src/test/run-pass/extern/extern-return-TwoU64s.rs b/src/test/run-pass/extern/extern-return-TwoU64s.rs index 94378522a1b..c5e4ebadc18 100644 --- a/src/test/run-pass/extern/extern-return-TwoU64s.rs +++ b/src/test/run-pass/extern/extern-return-TwoU64s.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(improper_ctypes)] diff --git a/src/test/run-pass/extern/extern-return-TwoU8s.rs b/src/test/run-pass/extern/extern-return-TwoU8s.rs index a66098c9774..a7cd21b2073 100644 --- a/src/test/run-pass/extern/extern-return-TwoU8s.rs +++ b/src/test/run-pass/extern/extern-return-TwoU8s.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(improper_ctypes)] diff --git a/src/test/run-pass/extern/extern-rust.rs b/src/test/run-pass/extern/extern-rust.rs index 8446d9c40c2..0cb190257be 100644 --- a/src/test/run-pass/extern/extern-rust.rs +++ b/src/test/run-pass/extern/extern-rust.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/extern/extern-take-value.rs b/src/test/run-pass/extern/extern-take-value.rs index 398a968ac18..c09a774361f 100644 --- a/src/test/run-pass/extern/extern-take-value.rs +++ b/src/test/run-pass/extern/extern-take-value.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:extern-take-value.rs diff --git a/src/test/run-pass/extern/extern-thiscall.rs b/src/test/run-pass/extern/extern-thiscall.rs index 66aa261fecb..e556c0512e9 100644 --- a/src/test/run-pass/extern/extern-thiscall.rs +++ b/src/test/run-pass/extern/extern-thiscall.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-arm // ignore-aarch64 diff --git a/src/test/run-pass/extern/extern-types-inherent-impl.rs b/src/test/run-pass/extern/extern-types-inherent-impl.rs index 955a756ebdc..fc98f55dc07 100644 --- a/src/test/run-pass/extern/extern-types-inherent-impl.rs +++ b/src/test/run-pass/extern/extern-types-inherent-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that inherent impls can be defined for extern types. diff --git a/src/test/run-pass/extern/extern-types-manual-sync-send.rs b/src/test/run-pass/extern/extern-types-manual-sync-send.rs index 707516bd0de..ec63e5d40b9 100644 --- a/src/test/run-pass/extern/extern-types-manual-sync-send.rs +++ b/src/test/run-pass/extern/extern-types-manual-sync-send.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that unsafe impl for Sync/Send can be provided for extern types. diff --git a/src/test/run-pass/extern/extern-types-pointer-cast.rs b/src/test/run-pass/extern/extern-types-pointer-cast.rs index 5110bd42690..a4ebd3cf71e 100644 --- a/src/test/run-pass/extern/extern-types-pointer-cast.rs +++ b/src/test/run-pass/extern/extern-types-pointer-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that pointers to extern types can be cast from/to usize, diff --git a/src/test/run-pass/extern/extern-types-size_of_val.rs b/src/test/run-pass/extern/extern-types-size_of_val.rs index 3f9e603f72e..1c965609758 100644 --- a/src/test/run-pass/extern/extern-types-size_of_val.rs +++ b/src/test/run-pass/extern/extern-types-size_of_val.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(extern_types)] diff --git a/src/test/run-pass/extern/extern-types-thin-pointer.rs b/src/test/run-pass/extern/extern-types-thin-pointer.rs index 9a535fd1931..83c35f7af78 100644 --- a/src/test/run-pass/extern/extern-types-thin-pointer.rs +++ b/src/test/run-pass/extern/extern-types-thin-pointer.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that pointers and references to extern types are thin, ie they have the same size and diff --git a/src/test/run-pass/extern/extern-types-trait-impl.rs b/src/test/run-pass/extern/extern-types-trait-impl.rs index d427e667573..ac4c70a71ce 100644 --- a/src/test/run-pass/extern/extern-types-trait-impl.rs +++ b/src/test/run-pass/extern/extern-types-trait-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that traits can be implemented for extern types. diff --git a/src/test/run-pass/extern/extern-vectorcall.rs b/src/test/run-pass/extern/extern-vectorcall.rs index 00f453c7166..1427a8f55cb 100644 --- a/src/test/run-pass/extern/extern-vectorcall.rs +++ b/src/test/run-pass/extern/extern-vectorcall.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-arm // ignore-aarch64 diff --git a/src/test/run-pass/extern/extern_fat_drop.rs b/src/test/run-pass/extern/extern_fat_drop.rs index 0373abcda72..1cd12c2cab3 100644 --- a/src/test/run-pass/extern/extern_fat_drop.rs +++ b/src/test/run-pass/extern/extern_fat_drop.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:fat_drop.rs diff --git a/src/test/run-pass/extoption_env-not-defined.rs b/src/test/run-pass/extoption_env-not-defined.rs index 352f68da985..7a2a2afad5c 100644 --- a/src/test/run-pass/extoption_env-not-defined.rs +++ b/src/test/run-pass/extoption_env-not-defined.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub fn main() { assert!(option_env!("__HOPEFULLY_DOESNT_EXIST__").is_none()); } diff --git a/src/test/run-pass/fact.rs b/src/test/run-pass/fact.rs index 5cb2abbfb0a..0dd68c991ad 100644 --- a/src/test/run-pass/fact.rs +++ b/src/test/run-pass/fact.rs @@ -1,16 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - fn f(x: isize) -> isize { // println!("in f:"); diff --git a/src/test/run-pass/fat-lto.rs b/src/test/run-pass/fat-lto.rs index 453eede261c..7e50b44430c 100644 --- a/src/test/run-pass/fat-lto.rs +++ b/src/test/run-pass/fat-lto.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Clto=fat // no-prefer-dynamic diff --git a/src/test/run-pass/fat-ptr-cast.rs b/src/test/run-pass/fat-ptr-cast.rs index 58296c3f95e..367b57d5ea0 100644 --- a/src/test/run-pass/fat-ptr-cast.rs +++ b/src/test/run-pass/fat-ptr-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(raw)] use std::mem; diff --git a/src/test/run-pass/fds-are-cloexec.rs b/src/test/run-pass/fds-are-cloexec.rs index a5ae0ae9f31..3bc0ceb5cf2 100644 --- a/src/test/run-pass/fds-are-cloexec.rs +++ b/src/test/run-pass/fds-are-cloexec.rs @@ -1,20 +1,10 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows // ignore-android // ignore-cloudabi no processes // ignore-emscripten no processes // ignore-haiku -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/filter-block-view-items.rs b/src/test/run-pass/filter-block-view-items.rs index fbdf817e9ab..d2b9866504a 100644 --- a/src/test/run-pass/filter-block-view-items.rs +++ b/src/test/run-pass/filter-block-view-items.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 pub fn main() { diff --git a/src/test/run-pass/fixup-deref-mut.rs b/src/test/run-pass/fixup-deref-mut.rs index 903e97b3158..a35412fea3f 100644 --- a/src/test/run-pass/fixup-deref-mut.rs +++ b/src/test/run-pass/fixup-deref-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/for-loop-while/auto-loop.rs b/src/test/run-pass/for-loop-while/auto-loop.rs index 0bc046cbcb7..f02ac43c734 100644 --- a/src/test/run-pass/for-loop-while/auto-loop.rs +++ b/src/test/run-pass/for-loop-while/auto-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/for-loop-while/break-value.rs b/src/test/run-pass/for-loop-while/break-value.rs index 8811d313994..9fc49fa8181 100644 --- a/src/test/run-pass/for-loop-while/break-value.rs +++ b/src/test/run-pass/for-loop-while/break-value.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/for-loop-while/break.rs b/src/test/run-pass/for-loop-while/break.rs index cffec660104..427b1b7a063 100644 --- a/src/test/run-pass/for-loop-while/break.rs +++ b/src/test/run-pass/for-loop-while/break.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/for-loop-while/for-destruct.rs b/src/test/run-pass/for-loop-while/for-destruct.rs index 97fa90530b6..7ca8d4ded25 100644 --- a/src/test/run-pass/for-loop-while/for-destruct.rs +++ b/src/test/run-pass/for-loop-while/for-destruct.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Pair { x: isize, y: isize } diff --git a/src/test/run-pass/for-loop-while/for-loop-goofiness.rs b/src/test/run-pass/for-loop-while/for-loop-goofiness.rs index bcc5ad7b7ad..872ab168bb2 100644 --- a/src/test/run-pass/for-loop-while/for-loop-goofiness.rs +++ b/src/test/run-pass/for-loop-while/for-loop-goofiness.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs b/src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs index a94894a4798..009c59f2fa4 100644 --- a/src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs +++ b/src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { // Check that the tail statement in the body unifies with something diff --git a/src/test/run-pass/for-loop-while/for-loop-into-iterator.rs b/src/test/run-pass/for-loop-while/for-loop-into-iterator.rs index ef116b9f3d7..199d4ddb299 100644 --- a/src/test/run-pass/for-loop-while/for-loop-into-iterator.rs +++ b/src/test/run-pass/for-loop-while/for-loop-into-iterator.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that for loops can do what RFC #235 claims diff --git a/src/test/run-pass/for-loop-while/for-loop-lifetime-of-unbound-values.rs b/src/test/run-pass/for-loop-while/for-loop-lifetime-of-unbound-values.rs index fb12a449a7a..6a38764a131 100644 --- a/src/test/run-pass/for-loop-while/for-loop-lifetime-of-unbound-values.rs +++ b/src/test/run-pass/for-loop-while/for-loop-lifetime-of-unbound-values.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test when destructors run in a for loop. The intention is // that the value for each iteration is dropped *after* the loop diff --git a/src/test/run-pass/for-loop-while/for-loop-macro.rs b/src/test/run-pass/for-loop-while/for-loop-macro.rs index ac29efbb7c8..5abccd2a141 100644 --- a/src/test/run-pass/for-loop-while/for-loop-macro.rs +++ b/src/test/run-pass/for-loop-while/for-loop-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! var { ( $name:ident ) => ( $name ); diff --git a/src/test/run-pass/for-loop-while/for-loop-mut-ref-element.rs b/src/test/run-pass/for-loop-while/for-loop-mut-ref-element.rs index e80f244bd26..a3d82ace9e2 100644 --- a/src/test/run-pass/for-loop-while/for-loop-mut-ref-element.rs +++ b/src/test/run-pass/for-loop-while/for-loop-mut-ref-element.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that for loops can bind elements as mutable references diff --git a/src/test/run-pass/for-loop-while/for-loop-no-std.rs b/src/test/run-pass/for-loop-while/for-loop-no-std.rs index c91cd115dfb..877429f5d39 100644 --- a/src/test/run-pass/for-loop-while/for-loop-no-std.rs +++ b/src/test/run-pass/for-loop-while/for-loop-no-std.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] #![feature(lang_items, start, alloc)] diff --git a/src/test/run-pass/for-loop-while/for-loop-panic.rs b/src/test/run-pass/for-loop-while/for-loop-panic.rs index 18c52237c2e..ac607d6d731 100644 --- a/src/test/run-pass/for-loop-while/for-loop-panic.rs +++ b/src/test/run-pass/for-loop-while/for-loop-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/for-loop-while/for-loop-unconstrained-element-type-i32-fallback.rs b/src/test/run-pass/for-loop-while/for-loop-unconstrained-element-type-i32-fallback.rs index 408900ea706..a1e9b1ed87d 100644 --- a/src/test/run-pass/for-loop-while/for-loop-unconstrained-element-type-i32-fallback.rs +++ b/src/test/run-pass/for-loop-while/for-loop-unconstrained-element-type-i32-fallback.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that the type of `sum` falls back to `i32` here, // and that the for loop desugaring doesn't interfere with diff --git a/src/test/run-pass/for-loop-while/foreach-external-iterators-break.rs b/src/test/run-pass/for-loop-while/foreach-external-iterators-break.rs index 1668031cb89..7de6a4f8acb 100644 --- a/src/test/run-pass/for-loop-while/foreach-external-iterators-break.rs +++ b/src/test/run-pass/for-loop-while/foreach-external-iterators-break.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap-break-restart.rs b/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap-break-restart.rs index 15df3bed030..5d690807e05 100644 --- a/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap-break-restart.rs +++ b/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap-break-restart.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::collections::HashMap; diff --git a/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap.rs b/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap.rs index 1364b4ca97c..9f2ca05cdb6 100644 --- a/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap.rs +++ b/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::collections::HashMap; diff --git a/src/test/run-pass/for-loop-while/foreach-external-iterators-loop.rs b/src/test/run-pass/for-loop-while/foreach-external-iterators-loop.rs index fe96bf1a3b7..78af195bc20 100644 --- a/src/test/run-pass/for-loop-while/foreach-external-iterators-loop.rs +++ b/src/test/run-pass/for-loop-while/foreach-external-iterators-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/for-loop-while/foreach-external-iterators-nested.rs b/src/test/run-pass/for-loop-while/foreach-external-iterators-nested.rs index 0465e321948..8a95f160a1a 100644 --- a/src/test/run-pass/for-loop-while/foreach-external-iterators-nested.rs +++ b/src/test/run-pass/for-loop-while/foreach-external-iterators-nested.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/for-loop-while/foreach-external-iterators.rs b/src/test/run-pass/for-loop-while/foreach-external-iterators.rs index 906156c35f7..24ecfe9b60d 100644 --- a/src/test/run-pass/for-loop-while/foreach-external-iterators.rs +++ b/src/test/run-pass/for-loop-while/foreach-external-iterators.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/for-loop-while/foreach-nested.rs b/src/test/run-pass/for-loop-while/foreach-nested.rs index ca1da10a5df..bb6edbc0797 100644 --- a/src/test/run-pass/for-loop-while/foreach-nested.rs +++ b/src/test/run-pass/for-loop-while/foreach-nested.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/for-loop-while/foreach-put-structured.rs b/src/test/run-pass/for-loop-while/foreach-put-structured.rs index d8ccdd8959f..3a47fcf3415 100644 --- a/src/test/run-pass/for-loop-while/foreach-put-structured.rs +++ b/src/test/run-pass/for-loop-while/foreach-put-structured.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/for-loop-while/foreach-simple-outer-slot.rs b/src/test/run-pass/for-loop-while/foreach-simple-outer-slot.rs index d00b7e9d0fc..a8d42a789ba 100644 --- a/src/test/run-pass/for-loop-while/foreach-simple-outer-slot.rs +++ b/src/test/run-pass/for-loop-while/foreach-simple-outer-slot.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/for-loop-while/label_break_value.rs b/src/test/run-pass/for-loop-while/label_break_value.rs index 687253baa65..eb5be7742e0 100644 --- a/src/test/run-pass/for-loop-while/label_break_value.rs +++ b/src/test/run-pass/for-loop-while/label_break_value.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_assignments)] diff --git a/src/test/run-pass/for-loop-while/labeled-break.rs b/src/test/run-pass/for-loop-while/labeled-break.rs index d00b943313e..4dacc57574f 100644 --- a/src/test/run-pass/for-loop-while/labeled-break.rs +++ b/src/test/run-pass/for-loop-while/labeled-break.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/for-loop-while/linear-for-loop.rs b/src/test/run-pass/for-loop-while/linear-for-loop.rs index e1a70822290..3c573db1d77 100644 --- a/src/test/run-pass/for-loop-while/linear-for-loop.rs +++ b/src/test/run-pass/for-loop-while/linear-for-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { let x = vec![1, 2, 3]; diff --git a/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs b/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs index 57d846d6557..11b6971656f 100644 --- a/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs +++ b/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_assignments)] diff --git a/src/test/run-pass/for-loop-while/liveness-loop-break.rs b/src/test/run-pass/for-loop-while/liveness-loop-break.rs index 7323f9147fa..60a63bccb10 100644 --- a/src/test/run-pass/for-loop-while/liveness-loop-break.rs +++ b/src/test/run-pass/for-loop-while/liveness-loop-break.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn test() { let v; diff --git a/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs b/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs index 4b148eba9d9..ce73d6335cb 100644 --- a/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs +++ b/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/for-loop-while/loop-break-cont-1.rs b/src/test/run-pass/for-loop-while/loop-break-cont-1.rs index f56b2b4ef4d..f207746f085 100644 --- a/src/test/run-pass/for-loop-while/loop-break-cont-1.rs +++ b/src/test/run-pass/for-loop-while/loop-break-cont-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/for-loop-while/loop-break-cont.rs b/src/test/run-pass/for-loop-while/loop-break-cont.rs index fb32132b493..92d5a32c62b 100644 --- a/src/test/run-pass/for-loop-while/loop-break-cont.rs +++ b/src/test/run-pass/for-loop-while/loop-break-cont.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { let mut i = 0_usize; diff --git a/src/test/run-pass/for-loop-while/loop-break-value.rs b/src/test/run-pass/for-loop-while/loop-break-value.rs index 2038df4e2a4..e1edbbb929e 100644 --- a/src/test/run-pass/for-loop-while/loop-break-value.rs +++ b/src/test/run-pass/for-loop-while/loop-break-value.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] #![feature(never_type)] diff --git a/src/test/run-pass/for-loop-while/loop-diverges.rs b/src/test/run-pass/for-loop-while/loop-diverges.rs index 47e5e71c623..f657bf9e0b3 100644 --- a/src/test/run-pass/for-loop-while/loop-diverges.rs +++ b/src/test/run-pass/for-loop-while/loop-diverges.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_parens)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/for-loop-while/loop-label-shadowing.rs b/src/test/run-pass/for-loop-while/loop-label-shadowing.rs index 18cad7541aa..acb53e254bb 100644 --- a/src/test/run-pass/for-loop-while/loop-label-shadowing.rs +++ b/src/test/run-pass/for-loop-while/loop-label-shadowing.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue #12512. diff --git a/src/test/run-pass/for-loop-while/loop-labeled-break-value.rs b/src/test/run-pass/for-loop-while/loop-labeled-break-value.rs index a8fe26abf9a..cc8f826983b 100644 --- a/src/test/run-pass/for-loop-while/loop-labeled-break-value.rs +++ b/src/test/run-pass/for-loop-while/loop-labeled-break-value.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs b/src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs index 95bb8e8aa64..1b5db20129d 100644 --- a/src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs +++ b/src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 @@ -15,7 +5,7 @@ struct S; // Ensure S is moved, not copied, on assignment. impl Drop for S { fn drop(&mut self) { } } -// user-defined function "returning" bottom (i.e. no return at all). +// user-defined function "returning" bottom (i.e., no return at all). fn my_panic() -> ! { loop {} } pub fn step(f: bool) { diff --git a/src/test/run-pass/for-loop-while/loop-scope.rs b/src/test/run-pass/for-loop-while/loop-scope.rs index e8987b1a593..73324a3e1bd 100644 --- a/src/test/run-pass/for-loop-while/loop-scope.rs +++ b/src/test/run-pass/for-loop-while/loop-scope.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/for-loop-while/while-cont.rs b/src/test/run-pass/for-loop-while/while-cont.rs index 23d74f440ba..a864e8ef70a 100644 --- a/src/test/run-pass/for-loop-while/while-cont.rs +++ b/src/test/run-pass/for-loop-while/while-cont.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue #825: Should recheck the loop condition after continuing pub fn main() { diff --git a/src/test/run-pass/for-loop-while/while-flow-graph.rs b/src/test/run-pass/for-loop-while/while-flow-graph.rs index 9abdf45d18d..1748964a7b2 100644 --- a/src/test/run-pass/for-loop-while/while-flow-graph.rs +++ b/src/test/run-pass/for-loop-while/while-flow-graph.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/for-loop-while/while-label.rs b/src/test/run-pass/for-loop-while/while-label.rs index 218aea5ee1d..5abc41daf94 100644 --- a/src/test/run-pass/for-loop-while/while-label.rs +++ b/src/test/run-pass/for-loop-while/while-label.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] diff --git a/src/test/run-pass/for-loop-while/while-let.rs b/src/test/run-pass/for-loop-while/while-let.rs index ea334df54c4..b9d70ff0b9d 100644 --- a/src/test/run-pass/for-loop-while/while-let.rs +++ b/src/test/run-pass/for-loop-while/while-let.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::collections::BinaryHeap; diff --git a/src/test/run-pass/for-loop-while/while-loop-constraints-2.rs b/src/test/run-pass/for-loop-while/while-loop-constraints-2.rs index 2cdf273f3e3..3c5cdf06cd8 100644 --- a/src/test/run-pass/for-loop-while/while-loop-constraints-2.rs +++ b/src/test/run-pass/for-loop-while/while-loop-constraints-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/src/test/run-pass/for-loop-while/while-prelude-drop.rs b/src/test/run-pass/for-loop-while/while-prelude-drop.rs index 8c6c8994398..196b9daf6ec 100644 --- a/src/test/run-pass/for-loop-while/while-prelude-drop.rs +++ b/src/test/run-pass/for-loop-while/while-prelude-drop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/for-loop-while/while-with-break.rs b/src/test/run-pass/for-loop-while/while-with-break.rs index 0981ce91f3c..a9d52dda544 100644 --- a/src/test/run-pass/for-loop-while/while-with-break.rs +++ b/src/test/run-pass/for-loop-while/while-with-break.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/for-loop-while/while.rs b/src/test/run-pass/for-loop-while/while.rs index ba71ba1fd52..90f718a3483 100644 --- a/src/test/run-pass/for-loop-while/while.rs +++ b/src/test/run-pass/for-loop-while/while.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/foreign/auxiliary/fn-abi.rs b/src/test/run-pass/foreign/auxiliary/fn-abi.rs index 5d380ea6a5a..25c9e1b4ca3 100644 --- a/src/test/run-pass/foreign/auxiliary/fn-abi.rs +++ b/src/test/run-pass/foreign/auxiliary/fn-abi.rs @@ -1,12 +1,2 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub extern fn foo() {} diff --git a/src/test/run-pass/foreign/auxiliary/foreign_lib.rs b/src/test/run-pass/foreign/auxiliary/foreign_lib.rs index cef36274c62..de6b0e2118a 100644 --- a/src/test/run-pass/foreign/auxiliary/foreign_lib.rs +++ b/src/test/run-pass/foreign/auxiliary/foreign_lib.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="foreign_lib"] -#![feature(libc)] +#![feature(rustc_private)] pub mod rustrt { extern crate libc; diff --git a/src/test/run-pass/foreign/foreign-call-no-runtime.rs b/src/test/run-pass/foreign/foreign-call-no-runtime.rs index 4837f78ce3b..c6afa07ad05 100644 --- a/src/test/run-pass/foreign/foreign-call-no-runtime.rs +++ b/src/test/run-pass/foreign/foreign-call-no-runtime.rs @@ -1,17 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/foreign/foreign-dupe.rs b/src/test/run-pass/foreign/foreign-dupe.rs index 296459c399f..3c9f0f583d4 100644 --- a/src/test/run-pass/foreign/foreign-dupe.rs +++ b/src/test/run-pass/foreign/foreign-dupe.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:foreign_lib.rs // ignore-wasm32-bare no libc to test ffi with diff --git a/src/test/run-pass/foreign/foreign-fn-linkname.rs b/src/test/run-pass/foreign/foreign-fn-linkname.rs index 75876607603..5ed8d19bc5a 100644 --- a/src/test/run-pass/foreign/foreign-fn-linkname.rs +++ b/src/test/run-pass/foreign/foreign-fn-linkname.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; use std::ffi::CString; diff --git a/src/test/run-pass/foreign/foreign-fn-with-byval.rs b/src/test/run-pass/foreign/foreign-fn-with-byval.rs index 1c8d1bd2566..3a35599aa57 100644 --- a/src/test/run-pass/foreign/foreign-fn-with-byval.rs +++ b/src/test/run-pass/foreign/foreign-fn-with-byval.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(improper_ctypes)] diff --git a/src/test/run-pass/foreign/foreign-int-types.rs b/src/test/run-pass/foreign/foreign-int-types.rs index d7bcf655990..66296574d7d 100644 --- a/src/test/run-pass/foreign/foreign-int-types.rs +++ b/src/test/run-pass/foreign/foreign-int-types.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![forbid(improper_ctypes)] #![allow(dead_code)] diff --git a/src/test/run-pass/foreign/foreign-mod-src/inner.rs b/src/test/run-pass/foreign/foreign-mod-src/inner.rs index 3c5f6ab8064..cf484878b07 100644 --- a/src/test/run-pass/foreign/foreign-mod-src/inner.rs +++ b/src/test/run-pass/foreign/foreign-mod-src/inner.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/foreign/foreign-mod-unused-const.rs b/src/test/run-pass/foreign/foreign-mod-unused-const.rs index 6b7b6d619de..d9efbe00e52 100644 --- a/src/test/run-pass/foreign/foreign-mod-unused-const.rs +++ b/src/test/run-pass/foreign/foreign-mod-unused-const.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/foreign/foreign-no-abi.rs b/src/test/run-pass/foreign/foreign-no-abi.rs index 1d35f08a11f..2f33fb47656 100644 --- a/src/test/run-pass/foreign/foreign-no-abi.rs +++ b/src/test/run-pass/foreign/foreign-no-abi.rs @@ -1,20 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ABI is cdecl by default // ignore-wasm32-bare no libc to test ffi with // pretty-expanded FIXME #23616 -#![feature(libc)] +#![feature(rustc_private)] mod rustrt { extern crate libc; diff --git a/src/test/run-pass/foreign/foreign-src/foreign.rs b/src/test/run-pass/foreign/foreign-src/foreign.rs index 5cf8f5a22dd..47016ad6ce7 100644 --- a/src/test/run-pass/foreign/foreign-src/foreign.rs +++ b/src/test/run-pass/foreign/foreign-src/foreign.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/foreign/foreign-truncated-arguments.rs b/src/test/run-pass/foreign/foreign-truncated-arguments.rs index 5e7d4487382..c61c2b587b6 100644 --- a/src/test/run-pass/foreign/foreign-truncated-arguments.rs +++ b/src/test/run-pass/foreign/foreign-truncated-arguments.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -O // Regression test for https://github.com/rust-lang/rust/issues/33868 diff --git a/src/test/run-pass/foreign/foreign2.rs b/src/test/run-pass/foreign/foreign2.rs index bd6c8e6b53d..c1ab57776f6 100644 --- a/src/test/run-pass/foreign/foreign2.rs +++ b/src/test/run-pass/foreign/foreign2.rs @@ -1,19 +1,9 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // ignore-wasm32-bare no libc to test ffi with // pretty-expanded FIXME #23616 -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/format-hygiene.rs b/src/test/run-pass/format-hygiene.rs index 892fae417ad..4a797d19bad 100644 --- a/src/test/run-pass/format-hygiene.rs +++ b/src/test/run-pass/format-hygiene.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals)] pub const arg0: u8 = 1; diff --git a/src/test/run-pass/format-nan.rs b/src/test/run-pass/format-nan.rs index 9bbd8cdb11d..dbe2c61c494 100644 --- a/src/test/run-pass/format-nan.rs +++ b/src/test/run-pass/format-nan.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub fn main() { use std::f64; let x = "NaN".to_string(); diff --git a/src/test/run-pass/format-no-std.rs b/src/test/run-pass/format-no-std.rs index e23accfcc23..0f3a5c277b4 100644 --- a/src/test/run-pass/format-no-std.rs +++ b/src/test/run-pass/format-no-std.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten no no_std executables #![feature(lang_items, start, alloc)] diff --git a/src/test/run-pass/format-ref-cell.rs b/src/test/run-pass/format-ref-cell.rs index 0f16dfa1e8f..0e7925af78f 100644 --- a/src/test/run-pass/format-ref-cell.rs +++ b/src/test/run-pass/format-ref-cell.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::cell::RefCell; pub fn main() { diff --git a/src/test/run-pass/fsu-moves-and-copies.rs b/src/test/run-pass/fsu-moves-and-copies.rs index 3be15552dc1..f9544ec39a0 100644 --- a/src/test/run-pass/fsu-moves-and-copies.rs +++ b/src/test/run-pass/fsu-moves-and-copies.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(stable_features)] // Issue 4691: Ensure that functional-struct-updates operates diff --git a/src/test/run-pass/fun-call-variants.rs b/src/test/run-pass/fun-call-variants.rs index 3bb6df33f70..e08878accc3 100644 --- a/src/test/run-pass/fun-call-variants.rs +++ b/src/test/run-pass/fun-call-variants.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn ho(f: F) -> isize where F: FnOnce(isize) -> isize { let n: isize = f(3); return n; } fn direct(x: isize) -> isize { return x + 1; } diff --git a/src/test/run-pass/fun-indirect-call.rs b/src/test/run-pass/fun-indirect-call.rs index b28c64d06be..81af4402c11 100644 --- a/src/test/run-pass/fun-indirect-call.rs +++ b/src/test/run-pass/fun-indirect-call.rs @@ -1,17 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - - fn f() -> isize { return 42; } pub fn main() { diff --git a/src/test/run-pass/functions-closures/auxiliary/fn-abi.rs b/src/test/run-pass/functions-closures/auxiliary/fn-abi.rs index 5d380ea6a5a..25c9e1b4ca3 100644 --- a/src/test/run-pass/functions-closures/auxiliary/fn-abi.rs +++ b/src/test/run-pass/functions-closures/auxiliary/fn-abi.rs @@ -1,12 +1,2 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub extern fn foo() {} diff --git a/src/test/run-pass/functions-closures/call-closure-from-overloaded-op.rs b/src/test/run-pass/functions-closures/call-closure-from-overloaded-op.rs index d31420f338d..8e1c68fd77d 100644 --- a/src/test/run-pass/functions-closures/call-closure-from-overloaded-op.rs +++ b/src/test/run-pass/functions-closures/call-closure-from-overloaded-op.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn foo() -> isize { 22 } diff --git a/src/test/run-pass/functions-closures/capture-clauses-boxed-closures.rs b/src/test/run-pass/functions-closures/capture-clauses-boxed-closures.rs index 21b71c9c380..bcde504635d 100644 --- a/src/test/run-pass/functions-closures/capture-clauses-boxed-closures.rs +++ b/src/test/run-pass/functions-closures/capture-clauses-boxed-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn each(x: &[T], mut f: F) where F: FnMut(&T) { diff --git a/src/test/run-pass/functions-closures/capture-clauses-unboxed-closures.rs b/src/test/run-pass/functions-closures/capture-clauses-unboxed-closures.rs index d18d8d37c02..206b3d7b613 100644 --- a/src/test/run-pass/functions-closures/capture-clauses-unboxed-closures.rs +++ b/src/test/run-pass/functions-closures/capture-clauses-unboxed-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) { for val in x { diff --git a/src/test/run-pass/functions-closures/clone-closure.rs b/src/test/run-pass/functions-closures/clone-closure.rs index 49350266a6e..1e725d8056d 100644 --- a/src/test/run-pass/functions-closures/clone-closure.rs +++ b/src/test/run-pass/functions-closures/clone-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that closures implement `Clone`. diff --git a/src/test/run-pass/functions-closures/closure-bounds-can-capture-chan.rs b/src/test/run-pass/functions-closures/closure-bounds-can-capture-chan.rs index 7c1230d4e90..ccb2e201d7d 100644 --- a/src/test/run-pass/functions-closures/closure-bounds-can-capture-chan.rs +++ b/src/test/run-pass/functions-closures/closure-bounds-can-capture-chan.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs b/src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs index af71c95dc67..fb0bc3c436d 100644 --- a/src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs +++ b/src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs b/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs index 2ed3663bb57..96b7a66d075 100644 --- a/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs +++ b/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/functions-closures/closure-expected-type/supply-just-return-type.rs b/src/test/run-pass/functions-closures/closure-expected-type/supply-just-return-type.rs index 30e81746db6..e9964531c3c 100644 --- a/src/test/run-pass/functions-closures/closure-expected-type/supply-just-return-type.rs +++ b/src/test/run-pass/functions-closures/closure-expected-type/supply-just-return-type.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn with_closure(f: F) -> Result where F: FnOnce(&char) -> Result, diff --git a/src/test/run-pass/functions-closures/closure-expected-type/supply-nothing.rs b/src/test/run-pass/functions-closures/closure-expected-type/supply-nothing.rs index 9035bca50b9..8665cfc21a7 100644 --- a/src/test/run-pass/functions-closures/closure-expected-type/supply-nothing.rs +++ b/src/test/run-pass/functions-closures/closure-expected-type/supply-nothing.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn with_closure(f: F) -> u32 where F: FnOnce(&u32, &u32) -> u32 diff --git a/src/test/run-pass/functions-closures/closure-immediate.rs b/src/test/run-pass/functions-closures/closure-immediate.rs index 9a729532eff..428fc6bdef3 100644 --- a/src/test/run-pass/functions-closures/closure-immediate.rs +++ b/src/test/run-pass/functions-closures/closure-immediate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // After the work to reoptimize structs, it became possible for immediate logic to fail. diff --git a/src/test/run-pass/functions-closures/closure-inference.rs b/src/test/run-pass/functions-closures/closure-inference.rs index e8554d27650..96878445245 100644 --- a/src/test/run-pass/functions-closures/closure-inference.rs +++ b/src/test/run-pass/functions-closures/closure-inference.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/functions-closures/closure-inference2.rs b/src/test/run-pass/functions-closures/closure-inference2.rs index 65da36e206b..f2dfa5888aa 100644 --- a/src/test/run-pass/functions-closures/closure-inference2.rs +++ b/src/test/run-pass/functions-closures/closure-inference2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test a rather underspecified example: diff --git a/src/test/run-pass/functions-closures/closure-reform.rs b/src/test/run-pass/functions-closures/closure-reform.rs index 95a9438300d..0bb6159ff4a 100644 --- a/src/test/run-pass/functions-closures/closure-reform.rs +++ b/src/test/run-pass/functions-closures/closure-reform.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] /* Any copyright is dedicated to the Public Domain. diff --git a/src/test/run-pass/functions-closures/closure-returning-closure.rs b/src/test/run-pass/functions-closures/closure-returning-closure.rs index 08e7ebe5588..17db81687ab 100644 --- a/src/test/run-pass/functions-closures/closure-returning-closure.rs +++ b/src/test/run-pass/functions-closures/closure-returning-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let f = |_||x, y| x+y; diff --git a/src/test/run-pass/functions-closures/closure-to-fn-coercion.rs b/src/test/run-pass/functions-closures/closure-to-fn-coercion.rs index 15a46f0eca5..4f43c2bb538 100644 --- a/src/test/run-pass/functions-closures/closure-to-fn-coercion.rs +++ b/src/test/run-pass/functions-closures/closure-to-fn-coercion.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem; diff --git a/src/test/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs b/src/test/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs index 747afc13301..e7a9383950f 100644 --- a/src/test/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs +++ b/src/test/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Ensure that we deduce expected argument types when a `fn()` type is expected (#41755) diff --git a/src/test/run-pass/functions-closures/copy-closure.rs b/src/test/run-pass/functions-closures/copy-closure.rs index 73971431d58..72da02421b7 100644 --- a/src/test/run-pass/functions-closures/copy-closure.rs +++ b/src/test/run-pass/functions-closures/copy-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that closures implement `Copy`. diff --git a/src/test/run-pass/functions-closures/fn-abi.rs b/src/test/run-pass/functions-closures/fn-abi.rs index 4e97dec2189..900af9c1f66 100644 --- a/src/test/run-pass/functions-closures/fn-abi.rs +++ b/src/test/run-pass/functions-closures/fn-abi.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Ensure that declarations and types which use `extern fn` both have the same // ABI (#9309). diff --git a/src/test/run-pass/functions-closures/fn-bare-assign.rs b/src/test/run-pass/functions-closures/fn-bare-assign.rs index 4bf83461ed2..f5dab3c8402 100644 --- a/src/test/run-pass/functions-closures/fn-bare-assign.rs +++ b/src/test/run-pass/functions-closures/fn-bare-assign.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn f(i: isize, called: &mut bool) { diff --git a/src/test/run-pass/functions-closures/fn-bare-coerce-to-block.rs b/src/test/run-pass/functions-closures/fn-bare-coerce-to-block.rs index 4aba898a768..922e016ddc8 100644 --- a/src/test/run-pass/functions-closures/fn-bare-coerce-to-block.rs +++ b/src/test/run-pass/functions-closures/fn-bare-coerce-to-block.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/functions-closures/fn-bare-item.rs b/src/test/run-pass/functions-closures/fn-bare-item.rs index 0a8241d6fce..a6e6495a40a 100644 --- a/src/test/run-pass/functions-closures/fn-bare-item.rs +++ b/src/test/run-pass/functions-closures/fn-bare-item.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn f() { println!("This is a bare function"); diff --git a/src/test/run-pass/functions-closures/fn-bare-size.rs b/src/test/run-pass/functions-closures/fn-bare-size.rs index eff13b7521f..2ba56eaaed4 100644 --- a/src/test/run-pass/functions-closures/fn-bare-size.rs +++ b/src/test/run-pass/functions-closures/fn-bare-size.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem; diff --git a/src/test/run-pass/functions-closures/fn-bare-spawn.rs b/src/test/run-pass/functions-closures/fn-bare-spawn.rs index 50dc51f82e6..0d46fe22087 100644 --- a/src/test/run-pass/functions-closures/fn-bare-spawn.rs +++ b/src/test/run-pass/functions-closures/fn-bare-spawn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This is what the signature to spawn should look like with bare functions diff --git a/src/test/run-pass/functions-closures/fn-coerce-field.rs b/src/test/run-pass/functions-closures/fn-coerce-field.rs index 166f05368be..38bde7b9e8f 100644 --- a/src/test/run-pass/functions-closures/fn-coerce-field.rs +++ b/src/test/run-pass/functions-closures/fn-coerce-field.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/functions-closures/fn-item-type-cast.rs b/src/test/run-pass/functions-closures/fn-item-type-cast.rs index 02b05513ad7..4d50ea97b8b 100644 --- a/src/test/run-pass/functions-closures/fn-item-type-cast.rs +++ b/src/test/run-pass/functions-closures/fn-item-type-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/functions-closures/fn-item-type-coerce.rs b/src/test/run-pass/functions-closures/fn-item-type-coerce.rs index ad931a836b8..7a096764e45 100644 --- a/src/test/run-pass/functions-closures/fn-item-type-coerce.rs +++ b/src/test/run-pass/functions-closures/fn-item-type-coerce.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Test implicit coercions from a fn item type to a fn pointer type. diff --git a/src/test/run-pass/functions-closures/fn-item-type-zero-sized.rs b/src/test/run-pass/functions-closures/fn-item-type-zero-sized.rs index 0e952fe2761..bd9f1ed663d 100644 --- a/src/test/run-pass/functions-closures/fn-item-type-zero-sized.rs +++ b/src/test/run-pass/functions-closures/fn-item-type-zero-sized.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that fn item types are zero-sized. diff --git a/src/test/run-pass/functions-closures/fn-lval.rs b/src/test/run-pass/functions-closures/fn-lval.rs index 806ae182256..01079eea457 100644 --- a/src/test/run-pass/functions-closures/fn-lval.rs +++ b/src/test/run-pass/functions-closures/fn-lval.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/functions-closures/fn-type-infer.rs b/src/test/run-pass/functions-closures/fn-type-infer.rs index 5eea37cdc8c..fe6567f22b5 100644 --- a/src/test/run-pass/functions-closures/fn-type-infer.rs +++ b/src/test/run-pass/functions-closures/fn-type-infer.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/functions-closures/implied-bounds-closure-arg-outlives.rs b/src/test/run-pass/functions-closures/implied-bounds-closure-arg-outlives.rs index 4277dcc149e..4ac07123d9d 100644 --- a/src/test/run-pass/functions-closures/implied-bounds-closure-arg-outlives.rs +++ b/src/test/run-pass/functions-closures/implied-bounds-closure-arg-outlives.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to handle the relationships between free // regions bound in a closure callback. diff --git a/src/test/run-pass/functions-closures/nullable-pointer-opt-closures.rs b/src/test/run-pass/functions-closures/nullable-pointer-opt-closures.rs index 2122bb897a0..87dacfba25b 100644 --- a/src/test/run-pass/functions-closures/nullable-pointer-opt-closures.rs +++ b/src/test/run-pass/functions-closures/nullable-pointer-opt-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem; diff --git a/src/test/run-pass/functions-closures/parallel-codegen-closures.rs b/src/test/run-pass/functions-closures/parallel-codegen-closures.rs index 95592993cb6..921fbaf4942 100644 --- a/src/test/run-pass/functions-closures/parallel-codegen-closures.rs +++ b/src/test/run-pass/functions-closures/parallel-codegen-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/functions-closures/return-from-closure.rs b/src/test/run-pass/functions-closures/return-from-closure.rs index c66bdb5fa8b..656a95f120a 100644 --- a/src/test/run-pass/functions-closures/return-from-closure.rs +++ b/src/test/run-pass/functions-closures/return-from-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] // just to make sure that `return` is only returning from the closure, diff --git a/src/test/run-pass/futures-api.rs b/src/test/run-pass/futures-api.rs index 18865e4a076..e3023521100 100644 --- a/src/test/run-pass/futures-api.rs +++ b/src/test/run-pass/futures-api.rs @@ -1,14 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(arbitrary_self_types, futures_api, pin)] +#![feature(arbitrary_self_types, futures_api)] #![allow(unused)] use std::future::Future; diff --git a/src/test/run-pass/generator/auxiliary/xcrate-reachable.rs b/src/test/run-pass/generator/auxiliary/xcrate-reachable.rs index 91e43537cc2..33337f8038f 100644 --- a/src/test/run-pass/generator/auxiliary/xcrate-reachable.rs +++ b/src/test/run-pass/generator/auxiliary/xcrate-reachable.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators, generator_trait)] use std::ops::Generator; diff --git a/src/test/run-pass/generator/auxiliary/xcrate.rs b/src/test/run-pass/generator/auxiliary/xcrate.rs index fcfe0b754b6..613c495832f 100644 --- a/src/test/run-pass/generator/auxiliary/xcrate.rs +++ b/src/test/run-pass/generator/auxiliary/xcrate.rs @@ -1,15 +1,6 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators, generator_trait)] +use std::marker::Unpin; use std::ops::Generator; pub fn foo() -> impl Generator { @@ -20,7 +11,7 @@ pub fn foo() -> impl Generator { } } -pub fn bar(t: T) -> Box> { +pub fn bar(t: T) -> Box + Unpin> { Box::new(|| { yield t; }) diff --git a/src/test/run-pass/generator/borrow-in-tail-expr.rs b/src/test/run-pass/generator/borrow-in-tail-expr.rs index 3ac501d0117..540f5e3e1dd 100644 --- a/src/test/run-pass/generator/borrow-in-tail-expr.rs +++ b/src/test/run-pass/generator/borrow-in-tail-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(generators)] diff --git a/src/test/run-pass/generator/conditional-drop.rs b/src/test/run-pass/generator/conditional-drop.rs index ca8689ca842..907f7a3c06d 100644 --- a/src/test/run-pass/generator/conditional-drop.rs +++ b/src/test/run-pass/generator/conditional-drop.rs @@ -1,21 +1,12 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(generators, generator_trait)] use std::ops::Generator; -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +use std::pin::Pin; +use std::sync::atomic::{AtomicUsize, Ordering}; -static A: AtomicUsize = ATOMIC_USIZE_INIT; +static A: AtomicUsize = AtomicUsize::new(0); struct B; @@ -44,9 +35,9 @@ fn t1() { }; let n = A.load(Ordering::SeqCst); - unsafe { a.resume() }; + Pin::new(&mut a).resume(); assert_eq!(A.load(Ordering::SeqCst), n + 1); - unsafe { a.resume() }; + Pin::new(&mut a).resume(); assert_eq!(A.load(Ordering::SeqCst), n + 1); } @@ -60,8 +51,8 @@ fn t2() { }; let n = A.load(Ordering::SeqCst); - unsafe { a.resume() }; + Pin::new(&mut a).resume(); assert_eq!(A.load(Ordering::SeqCst), n); - unsafe { a.resume() }; + Pin::new(&mut a).resume(); assert_eq!(A.load(Ordering::SeqCst), n + 1); } diff --git a/src/test/run-pass/generator/control-flow.rs b/src/test/run-pass/generator/control-flow.rs index b1560b83cdc..df70e013bd3 100644 --- a/src/test/run-pass/generator/control-flow.rs +++ b/src/test/run-pass/generator/control-flow.rs @@ -1,24 +1,16 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(generators, generator_trait)] +use std::marker::Unpin; use std::ops::{GeneratorState, Generator}; +use std::pin::Pin; fn finish(mut amt: usize, mut t: T) -> T::Return - where T: Generator + where T: Generator + Unpin, { loop { - match unsafe { t.resume() } { + match Pin::new(&mut t).resume() { GeneratorState::Yielded(()) => amt = amt.checked_sub(1).unwrap(), GeneratorState::Complete(ret) => { assert_eq!(amt, 0); diff --git a/src/test/run-pass/generator/drop-env.rs b/src/test/run-pass/generator/drop-env.rs index 9bdee027097..ac4e0665628 100644 --- a/src/test/run-pass/generator/drop-env.rs +++ b/src/test/run-pass/generator/drop-env.rs @@ -1,21 +1,12 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(generators, generator_trait)] use std::ops::Generator; -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +use std::pin::Pin; +use std::sync::atomic::{AtomicUsize, Ordering}; -static A: AtomicUsize = ATOMIC_USIZE_INIT; +static A: AtomicUsize = AtomicUsize::new(0); struct B; @@ -39,7 +30,7 @@ fn t1() { }; let n = A.load(Ordering::SeqCst); - drop(unsafe { foo.resume() }); + drop(Pin::new(&mut foo).resume()); assert_eq!(A.load(Ordering::SeqCst), n); drop(foo); assert_eq!(A.load(Ordering::SeqCst), n + 1); @@ -52,7 +43,7 @@ fn t2() { }; let n = A.load(Ordering::SeqCst); - drop(unsafe { foo.resume() }); + drop(Pin::new(&mut foo).resume()); assert_eq!(A.load(Ordering::SeqCst), n + 1); drop(foo); assert_eq!(A.load(Ordering::SeqCst), n + 1); diff --git a/src/test/run-pass/generator/issue-44197.rs b/src/test/run-pass/generator/issue-44197.rs index 7ddc3c6e83c..6efaff50c1e 100644 --- a/src/test/run-pass/generator/issue-44197.rs +++ b/src/test/run-pass/generator/issue-44197.rs @@ -1,18 +1,9 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(generators, generator_trait)] use std::ops::{ Generator, GeneratorState }; +use std::pin::Pin; fn foo(_: &str) -> String { String::new() @@ -37,8 +28,6 @@ fn bar2(baz: String) -> impl Generator { } fn main() { - unsafe { - assert_eq!(bar(String::new()).resume(), GeneratorState::Yielded(String::new())); - assert_eq!(bar2(String::new()).resume(), GeneratorState::Complete(())); - } + assert_eq!(Pin::new(&mut bar(String::new())).resume(), GeneratorState::Yielded(String::new())); + assert_eq!(Pin::new(&mut bar2(String::new())).resume(), GeneratorState::Complete(())); } diff --git a/src/test/run-pass/generator/issue-52398.rs b/src/test/run-pass/generator/issue-52398.rs index ff4d3e881f0..54a1912582c 100644 --- a/src/test/run-pass/generator/issue-52398.rs +++ b/src/test/run-pass/generator/issue-52398.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] diff --git a/src/test/run-pass/generator/iterator-count.rs b/src/test/run-pass/generator/iterator-count.rs index b9d877b6498..ac7e122dd58 100644 --- a/src/test/run-pass/generator/iterator-count.rs +++ b/src/test/run-pass/generator/iterator-count.rs @@ -1,35 +1,27 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(generators, generator_trait)] +use std::marker::Unpin; use std::ops::{GeneratorState, Generator}; +use std::pin::Pin; struct W(T); // This impl isn't safe in general, but the generator used in this test is movable // so it won't cause problems. -impl> Iterator for W { +impl + Unpin> Iterator for W { type Item = T::Yield; fn next(&mut self) -> Option { - match unsafe { self.0.resume() } { + match Pin::new(&mut self.0).resume() { GeneratorState::Complete(..) => None, GeneratorState::Yielded(v) => Some(v), } } } -fn test() -> impl Generator { +fn test() -> impl Generator + Unpin { || { for i in 1..6 { yield i diff --git a/src/test/run-pass/generator/live-upvar-across-yield.rs b/src/test/run-pass/generator/live-upvar-across-yield.rs index f560c521533..a1064165b2f 100644 --- a/src/test/run-pass/generator/live-upvar-across-yield.rs +++ b/src/test/run-pass/generator/live-upvar-across-yield.rs @@ -1,23 +1,14 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(generators, generator_trait)] use std::ops::Generator; +use std::pin::Pin; fn main() { let b = |_| 3; let mut a = || { b(yield); }; - unsafe { a.resume() }; + Pin::new(&mut a).resume(); } diff --git a/src/test/run-pass/generator/match-bindings.rs b/src/test/run-pass/generator/match-bindings.rs index 25230df1749..560d8e7103c 100644 --- a/src/test/run-pass/generator/match-bindings.rs +++ b/src/test/run-pass/generator/match-bindings.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/generator/nested_generators.rs b/src/test/run-pass/generator/nested_generators.rs index e73f3f197db..b56cce1dc44 100644 --- a/src/test/run-pass/generator/nested_generators.rs +++ b/src/test/run-pass/generator/nested_generators.rs @@ -1,20 +1,9 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -#![feature(generators)] -#![feature(generator_trait)] +#![feature(generators, generator_trait)] -use std::ops::Generator; -use std::ops::GeneratorState; +use std::ops::{Generator, GeneratorState}; +use std::pin::Pin; fn main() { let _generator = || { @@ -22,7 +11,7 @@ fn main() { yield 2; }; - match unsafe { sub_generator.resume() } { + match Pin::new(&mut sub_generator).resume() { GeneratorState::Yielded(x) => { yield x; } diff --git a/src/test/run-pass/generator/non-static-is-unpin.rs b/src/test/run-pass/generator/non-static-is-unpin.rs new file mode 100644 index 00000000000..96d0a8e2833 --- /dev/null +++ b/src/test/run-pass/generator/non-static-is-unpin.rs @@ -0,0 +1,18 @@ +// run-pass + +#![feature(generators, generator_trait)] + +use std::marker::{PhantomPinned, Unpin}; + +fn assert_unpin(_: G) { +} + +fn main() { + // Even though this generator holds a `PhantomPinned` in its environment, it + // remains `Unpin`. + assert_unpin(|| { + let pinned = PhantomPinned; + yield; + drop(pinned); + }); +} diff --git a/src/test/run-pass/generator/panic-drops.rs b/src/test/run-pass/generator/panic-drops.rs index 34efd43c505..5ac97585f4b 100644 --- a/src/test/run-pass/generator/panic-drops.rs +++ b/src/test/run-pass/generator/panic-drops.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare compiled as panic=abort by default @@ -16,9 +6,10 @@ use std::ops::Generator; use std::panic; -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +use std::pin::Pin; +use std::sync::atomic::{AtomicUsize, Ordering}; -static A: AtomicUsize = ATOMIC_USIZE_INIT; +static A: AtomicUsize = AtomicUsize::new(0); struct B; @@ -44,7 +35,7 @@ fn main() { assert_eq!(A.load(Ordering::SeqCst), 0); let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { - unsafe { foo.resume() } + Pin::new(&mut foo).resume() })); assert!(res.is_err()); assert_eq!(A.load(Ordering::SeqCst), 1); @@ -59,7 +50,7 @@ fn main() { assert_eq!(A.load(Ordering::SeqCst), 1); let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { - unsafe { foo.resume() } + Pin::new(&mut foo).resume() })); assert!(res.is_err()); assert_eq!(A.load(Ordering::SeqCst), 1); diff --git a/src/test/run-pass/generator/panic-safe.rs b/src/test/run-pass/generator/panic-safe.rs index f1aa5de9689..5f6778674dc 100644 --- a/src/test/run-pass/generator/panic-safe.rs +++ b/src/test/run-pass/generator/panic-safe.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare compiled with panic=abort by default @@ -15,6 +5,7 @@ #![feature(generators, generator_trait)] use std::ops::Generator; +use std::pin::Pin; use std::panic; fn main() { @@ -26,13 +17,13 @@ fn main() { }; let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { - unsafe { foo.resume() } + Pin::new(&mut foo).resume() })); assert!(res.is_err()); for _ in 0..10 { let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { - unsafe { foo.resume() } + Pin::new(&mut foo).resume() })); assert!(res.is_err()); } diff --git a/src/test/run-pass/generator/pin-box-generator.rs b/src/test/run-pass/generator/pin-box-generator.rs new file mode 100644 index 00000000000..c3136f5c0ec --- /dev/null +++ b/src/test/run-pass/generator/pin-box-generator.rs @@ -0,0 +1,13 @@ +// run-pass + +#![feature(generators, generator_trait)] + +use std::ops::Generator; + +fn assert_generator(_: G) { +} + +fn main() { + assert_generator(static || yield); + assert_generator(Box::pin(static || yield)); +} diff --git a/src/test/run-pass/generator/reborrow-mut-upvar.rs b/src/test/run-pass/generator/reborrow-mut-upvar.rs index 582b5ad575b..785e38a7eb8 100644 --- a/src/test/run-pass/generator/reborrow-mut-upvar.rs +++ b/src/test/run-pass/generator/reborrow-mut-upvar.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(generators)] diff --git a/src/test/run-pass/generator/resume-after-return.rs b/src/test/run-pass/generator/resume-after-return.rs index 67c653f102d..71a68ff684a 100644 --- a/src/test/run-pass/generator/resume-after-return.rs +++ b/src/test/run-pass/generator/resume-after-return.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare compiled with panic=abort by default @@ -15,6 +5,7 @@ #![feature(generators, generator_trait)] use std::ops::{GeneratorState, Generator}; +use std::pin::Pin; use std::panic; fn main() { @@ -25,12 +16,12 @@ fn main() { yield; }; - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Complete(()) => {} s => panic!("bad state: {:?}", s), } - match panic::catch_unwind(move || unsafe { foo.resume() }) { + match panic::catch_unwind(move || Pin::new(&mut foo).resume()) { Ok(_) => panic!("generator successfully resumed"), Err(_) => {} } diff --git a/src/test/run-pass/generator/smoke.rs b/src/test/run-pass/generator/smoke.rs index 2651000e8b4..533f2399084 100644 --- a/src/test/run-pass/generator/smoke.rs +++ b/src/test/run-pass/generator/smoke.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support @@ -16,6 +6,7 @@ #![feature(generators, generator_trait)] use std::ops::{GeneratorState, Generator}; +use std::pin::Pin; use std::thread; #[test] @@ -26,7 +17,7 @@ fn simple() { } }; - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Complete(()) => {} s => panic!("bad state: {:?}", s), } @@ -42,7 +33,7 @@ fn return_capture() { a }; - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Complete(ref s) if *s == "foo" => {} s => panic!("bad state: {:?}", s), } @@ -54,11 +45,11 @@ fn simple_yield() { yield; }; - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Yielded(()) => {} s => panic!("bad state: {:?}", s), } - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Complete(()) => {} s => panic!("bad state: {:?}", s), } @@ -71,11 +62,11 @@ fn yield_capture() { yield b; }; - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Yielded(ref s) if *s == "foo" => {} s => panic!("bad state: {:?}", s), } - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Complete(()) => {} s => panic!("bad state: {:?}", s), } @@ -88,11 +79,11 @@ fn simple_yield_value() { return String::from("foo") }; - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Yielded(ref s) if *s == "bar" => {} s => panic!("bad state: {:?}", s), } - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Complete(ref s) if *s == "foo" => {} s => panic!("bad state: {:?}", s), } @@ -106,11 +97,11 @@ fn return_after_yield() { return a }; - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Yielded(()) => {} s => panic!("bad state: {:?}", s), } - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Complete(ref s) if *s == "foo" => {} s => panic!("bad state: {:?}", s), } @@ -158,11 +149,11 @@ fn send_and_sync() { fn send_over_threads() { let mut foo = || { yield }; thread::spawn(move || { - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Yielded(()) => {} s => panic!("bad state: {:?}", s), } - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Complete(()) => {} s => panic!("bad state: {:?}", s), } @@ -171,11 +162,11 @@ fn send_over_threads() { let a = String::from("a"); let mut foo = || { yield a }; thread::spawn(move || { - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Yielded(ref s) if *s == "a" => {} s => panic!("bad state: {:?}", s), } - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Complete(()) => {} s => panic!("bad state: {:?}", s), } diff --git a/src/test/run-pass/generator/static-generators.rs b/src/test/run-pass/generator/static-generators.rs index 9c659b53a06..965d3c61c22 100644 --- a/src/test/run-pass/generator/static-generators.rs +++ b/src/test/run-pass/generator/static-generators.rs @@ -1,17 +1,8 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(generators, generator_trait)] +use std::pin::Pin; use std::ops::{Generator, GeneratorState}; fn main() { @@ -21,8 +12,9 @@ fn main() { yield; assert_eq!(b as *const _, &a as *const _); }; - unsafe { - assert_eq!(generator.resume(), GeneratorState::Yielded(())); - assert_eq!(generator.resume(), GeneratorState::Complete(())); - } + // Safety: We shadow the original generator variable so have no safe API to + // move it after this point. + let mut generator = unsafe { Pin::new_unchecked(&mut generator) }; + assert_eq!(generator.as_mut().resume(), GeneratorState::Yielded(())); + assert_eq!(generator.as_mut().resume(), GeneratorState::Complete(())); } diff --git a/src/test/run-pass/generator/too-live-local-in-immovable-gen.rs b/src/test/run-pass/generator/too-live-local-in-immovable-gen.rs index 655ed20ac1f..f299a8aa72b 100644 --- a/src/test/run-pass/generator/too-live-local-in-immovable-gen.rs +++ b/src/test/run-pass/generator/too-live-local-in-immovable-gen.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_unsafe)] diff --git a/src/test/run-pass/generator/xcrate-reachable.rs b/src/test/run-pass/generator/xcrate-reachable.rs index c14b3c3328a..9483ad7395e 100644 --- a/src/test/run-pass/generator/xcrate-reachable.rs +++ b/src/test/run-pass/generator/xcrate-reachable.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:xcrate-reachable.rs @@ -17,7 +7,8 @@ extern crate xcrate_reachable as foo; use std::ops::Generator; +use std::pin::Pin; fn main() { - unsafe { foo::foo().resume(); } + Pin::new(&mut foo::foo()).resume(); } diff --git a/src/test/run-pass/generator/xcrate.rs b/src/test/run-pass/generator/xcrate.rs index af4a84dd1db..febf5c3583f 100644 --- a/src/test/run-pass/generator/xcrate.rs +++ b/src/test/run-pass/generator/xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:xcrate.rs @@ -17,22 +7,23 @@ extern crate xcrate; use std::ops::{GeneratorState, Generator}; +use std::pin::Pin; fn main() { let mut foo = xcrate::foo(); - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Complete(()) => {} s => panic!("bad state: {:?}", s), } let mut foo = xcrate::bar(3); - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Yielded(3) => {} s => panic!("bad state: {:?}", s), } - match unsafe { foo.resume() } { + match Pin::new(&mut foo).resume() { GeneratorState::Complete(()) => {} s => panic!("bad state: {:?}", s), } diff --git a/src/test/run-pass/generator/yield-in-args-rev.rs b/src/test/run-pass/generator/yield-in-args-rev.rs index d74885495ab..f9ab981121a 100644 --- a/src/test/run-pass/generator/yield-in-args-rev.rs +++ b/src/test/run-pass/generator/yield-in-args-rev.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/generator/yield-in-box.rs b/src/test/run-pass/generator/yield-in-box.rs index a5ba3a25e87..d8475715c7c 100644 --- a/src/test/run-pass/generator/yield-in-box.rs +++ b/src/test/run-pass/generator/yield-in-box.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that box-statements with yields in them work. diff --git a/src/test/run-pass/generator/yield-in-initializer.rs b/src/test/run-pass/generator/yield-in-initializer.rs index 00045e6d3f6..8ff35d8ddf1 100644 --- a/src/test/run-pass/generator/yield-in-initializer.rs +++ b/src/test/run-pass/generator/yield-in-initializer.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(generators)] diff --git a/src/test/run-pass/generator/yield-subtype.rs b/src/test/run-pass/generator/yield-subtype.rs index 82804b253a7..c38524857b4 100644 --- a/src/test/run-pass/generator/yield-subtype.rs +++ b/src/test/run-pass/generator/yield-subtype.rs @@ -1,19 +1,8 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(dead_code)] // revisions:lexical nll -//[nll]compile-flags: -Z disable-nll-user-type-assert #![cfg_attr(nll, feature(nll))] #![feature(generators)] diff --git a/src/test/run-pass/generics/auxiliary/default_type_params_xc.rs b/src/test/run-pass/generics/auxiliary/default_type_params_xc.rs index fe852e5d8ea..aacbd672ade 100644 --- a/src/test/run-pass/generics/auxiliary/default_type_params_xc.rs +++ b/src/test/run-pass/generics/auxiliary/default_type_params_xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Heap; pub struct FakeHeap; diff --git a/src/test/run-pass/generics/generic-alias-unique.rs b/src/test/run-pass/generics/generic-alias-unique.rs index a141ae049cc..76a184d8d25 100644 --- a/src/test/run-pass/generics/generic-alias-unique.rs +++ b/src/test/run-pass/generics/generic-alias-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/generics/generic-default-type-params-cross-crate.rs b/src/test/run-pass/generics/generic-default-type-params-cross-crate.rs index 762ea4c6760..9e5eaa72c15 100644 --- a/src/test/run-pass/generics/generic-default-type-params-cross-crate.rs +++ b/src/test/run-pass/generics/generic-default-type-params-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:default_type_params_xc.rs diff --git a/src/test/run-pass/generics/generic-default-type-params.rs b/src/test/run-pass/generics/generic-default-type-params.rs index 6a5ae7b664f..afdd301fde9 100644 --- a/src/test/run-pass/generics/generic-default-type-params.rs +++ b/src/test/run-pass/generics/generic-default-type-params.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo { a: A diff --git a/src/test/run-pass/generics/generic-derived-type.rs b/src/test/run-pass/generics/generic-derived-type.rs index 76f638ca75e..c643496fa7f 100644 --- a/src/test/run-pass/generics/generic-derived-type.rs +++ b/src/test/run-pass/generics/generic-derived-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn g(x: X) -> X { return x; } diff --git a/src/test/run-pass/generics/generic-exterior-unique.rs b/src/test/run-pass/generics/generic-exterior-unique.rs index 960d578138f..9b3e1ee02a2 100644 --- a/src/test/run-pass/generics/generic-exterior-unique.rs +++ b/src/test/run-pass/generics/generic-exterior-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/generics/generic-extern-mangle.rs b/src/test/run-pass/generics/generic-extern-mangle.rs index b935922a0cd..985a6f39cd7 100644 --- a/src/test/run-pass/generics/generic-extern-mangle.rs +++ b/src/test/run-pass/generics/generic-extern-mangle.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::Add; diff --git a/src/test/run-pass/generics/generic-fn-infer.rs b/src/test/run-pass/generics/generic-fn-infer.rs index 5db9228cc3c..9ba4224732b 100644 --- a/src/test/run-pass/generics/generic-fn-infer.rs +++ b/src/test/run-pass/generics/generic-fn-infer.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/generics/generic-fn-twice.rs b/src/test/run-pass/generics/generic-fn-twice.rs index d385a153830..2f25fc24ced 100644 --- a/src/test/run-pass/generics/generic-fn-twice.rs +++ b/src/test/run-pass/generics/generic-fn-twice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/generics/generic-fn-unique.rs b/src/test/run-pass/generics/generic-fn-unique.rs index 0e0ffa63f61..6cda1c3dc15 100644 --- a/src/test/run-pass/generics/generic-fn-unique.rs +++ b/src/test/run-pass/generics/generic-fn-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/generics/generic-fn.rs b/src/test/run-pass/generics/generic-fn.rs index 4cb663bc9ee..8038fabc1ce 100644 --- a/src/test/run-pass/generics/generic-fn.rs +++ b/src/test/run-pass/generics/generic-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_assignments)] diff --git a/src/test/run-pass/generics/generic-ivec-leak.rs b/src/test/run-pass/generics/generic-ivec-leak.rs index 555f5297dde..a8ea1d5069b 100644 --- a/src/test/run-pass/generics/generic-ivec-leak.rs +++ b/src/test/run-pass/generics/generic-ivec-leak.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] enum wrapper { wrapped(T), } diff --git a/src/test/run-pass/generics/generic-newtype-struct.rs b/src/test/run-pass/generics/generic-newtype-struct.rs index fc54a3bab54..570c982cc87 100644 --- a/src/test/run-pass/generics/generic-newtype-struct.rs +++ b/src/test/run-pass/generics/generic-newtype-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/generics/generic-object.rs b/src/test/run-pass/generics/generic-object.rs index 4745b8d2cb8..054425989c3 100644 --- a/src/test/run-pass/generics/generic-object.rs +++ b/src/test/run-pass/generics/generic-object.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/generics/generic-recursive-tag.rs b/src/test/run-pass/generics/generic-recursive-tag.rs index 3830177f0ad..e1875f0abbe 100644 --- a/src/test/run-pass/generics/generic-recursive-tag.rs +++ b/src/test/run-pass/generics/generic-recursive-tag.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/generics/generic-static-methods.rs b/src/test/run-pass/generics/generic-static-methods.rs index 2fe903866c2..b39fa081a65 100644 --- a/src/test/run-pass/generics/generic-static-methods.rs +++ b/src/test/run-pass/generics/generic-static-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/generics/generic-tag-corruption.rs b/src/test/run-pass/generics/generic-tag-corruption.rs index 6f02be5d106..aa26183a0d4 100644 --- a/src/test/run-pass/generics/generic-tag-corruption.rs +++ b/src/test/run-pass/generics/generic-tag-corruption.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/generics/generic-tag-local.rs b/src/test/run-pass/generics/generic-tag-local.rs index a0429693fd9..cc85e6e0f0a 100644 --- a/src/test/run-pass/generics/generic-tag-local.rs +++ b/src/test/run-pass/generics/generic-tag-local.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/generics/generic-tag-match.rs b/src/test/run-pass/generics/generic-tag-match.rs index 798d5dcee2e..09ed6a808e6 100644 --- a/src/test/run-pass/generics/generic-tag-match.rs +++ b/src/test/run-pass/generics/generic-tag-match.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/generics/generic-tag-values.rs b/src/test/run-pass/generics/generic-tag-values.rs index 66a1268e2f8..230f477b6e9 100644 --- a/src/test/run-pass/generics/generic-tag-values.rs +++ b/src/test/run-pass/generics/generic-tag-values.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/generics/generic-tag.rs b/src/test/run-pass/generics/generic-tag.rs index bc7af903b32..74ef4eeba8a 100644 --- a/src/test/run-pass/generics/generic-tag.rs +++ b/src/test/run-pass/generics/generic-tag.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/generics/generic-temporary.rs b/src/test/run-pass/generics/generic-temporary.rs index 32ff16710cf..b63b534d03f 100644 --- a/src/test/run-pass/generics/generic-temporary.rs +++ b/src/test/run-pass/generics/generic-temporary.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn mk() -> isize { return 1; } diff --git a/src/test/run-pass/generics/generic-tup.rs b/src/test/run-pass/generics/generic-tup.rs index 677e2f8349f..79ebd648cd4 100644 --- a/src/test/run-pass/generics/generic-tup.rs +++ b/src/test/run-pass/generics/generic-tup.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn get_third(t: (T, T, T)) -> T { let (_, _, x) = t; return x; } diff --git a/src/test/run-pass/generics/generic-type-synonym.rs b/src/test/run-pass/generics/generic-type-synonym.rs index ccea523c69c..4f181fbcc7e 100644 --- a/src/test/run-pass/generics/generic-type-synonym.rs +++ b/src/test/run-pass/generics/generic-type-synonym.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/generics/generic-type.rs b/src/test/run-pass/generics/generic-type.rs index 4f83d437dc6..aa46db07eee 100644 --- a/src/test/run-pass/generics/generic-type.rs +++ b/src/test/run-pass/generics/generic-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/generics/generic-unique.rs b/src/test/run-pass/generics/generic-unique.rs index 182f516a3c8..d36504c75dd 100644 --- a/src/test/run-pass/generics/generic-unique.rs +++ b/src/test/run-pass/generics/generic-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![feature(box_syntax)] diff --git a/src/test/run-pass/global-scope.rs b/src/test/run-pass/global-scope.rs index 8e155c45996..22fb0f93dbc 100644 --- a/src/test/run-pass/global-scope.rs +++ b/src/test/run-pass/global-scope.rs @@ -1,15 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - pub fn f() -> isize { return 1; } pub mod foo { diff --git a/src/test/run-pass/guards-not-exhaustive.rs b/src/test/run-pass/guards-not-exhaustive.rs index 32f262c5a40..752e4f6be41 100644 --- a/src/test/run-pass/guards-not-exhaustive.rs +++ b/src/test/run-pass/guards-not-exhaustive.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] #[derive(Copy, Clone)] diff --git a/src/test/run-pass/guards.rs b/src/test/run-pass/guards.rs index af4e2efb2ba..94095eac161 100644 --- a/src/test/run-pass/guards.rs +++ b/src/test/run-pass/guards.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_shorthand_field_patterns)] #[derive(Copy, Clone)] diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 2b30b5ca9fc..364661e565e 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] #![allow(unused_mut)] diff --git a/src/test/run-pass/hello.rs b/src/test/run-pass/hello.rs index 61dcbb75b9e..bc8bb23877e 100644 --- a/src/test/run-pass/hello.rs +++ b/src/test/run-pass/hello.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { println!("hello, world"); } diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs index 7d13e64de2f..1591d616cac 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs index 8856c08bee7..09152970fdc 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs index bd61c42dd37..7ef8ea046b8 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // A basic test of using a higher-ranked trait bound. diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait.rs index 24ae5e1f343..afab9986ce2 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // A basic test of using a higher-ranked trait bound. diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-opt-in-copy.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-opt-in-copy.rs index 3eafc5aabda..04519f11600 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-opt-in-copy.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-opt-in-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we handle binder levels correctly when checking whether a // type can implement `Copy`. In particular, we had a bug where we failed to diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs index cdc83b04788..3fb0b3290eb 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we can parse all the various places that a `for` keyword // can appear representing universal quantification. diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs index 337935ad7f0..42247798f66 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs index 4b85b2b4077..5fda4b826e0 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs index cbdead794a9..917f6f96118 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // A basic test of using a higher-ranked trait bound. diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs index 5dc548fd341..0ed8f7ee52a 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // A basic test of using a higher-ranked trait bound. diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs index c9c3dd33136..4cb9242f0ed 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that `&PrinterSupport`, which is really short for `&'a diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs index 1d54594964c..a8f38180cc2 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-unboxed-closure-trait.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-unboxed-closure-trait.rs index 56af5df0105..a4a8a5ac6cc 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-unboxed-closure-trait.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-unboxed-closure-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test HRTB used with the `Fn` trait. diff --git a/src/test/run-pass/html-literals.rs b/src/test/run-pass/html-literals.rs index 1aed2844c96..237c6e1a107 100644 --- a/src/test/run-pass/html-literals.rs +++ b/src/test/run-pass/html-literals.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] // A test of the macro system. Can we do HTML literals? diff --git a/src/test/run-pass/hygiene/auxiliary/legacy_interaction.rs b/src/test/run-pass/hygiene/auxiliary/legacy_interaction.rs index 75f81c56db2..0774fbecac1 100644 --- a/src/test/run-pass/hygiene/auxiliary/legacy_interaction.rs +++ b/src/test/run-pass/hygiene/auxiliary/legacy_interaction.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty pretty-printing is unhygienic diff --git a/src/test/run-pass/hygiene/auxiliary/my_crate.rs b/src/test/run-pass/hygiene/auxiliary/my_crate.rs index 10dbaa9e9ad..5a7412e4bf5 100644 --- a/src/test/run-pass/hygiene/auxiliary/my_crate.rs +++ b/src/test/run-pass/hygiene/auxiliary/my_crate.rs @@ -1,12 +1,2 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn f() {} diff --git a/src/test/run-pass/hygiene/auxiliary/unhygienic_example.rs b/src/test/run-pass/hygiene/auxiliary/unhygienic_example.rs index 589e8b579b7..3f66748bf30 100644 --- a/src/test/run-pass/hygiene/auxiliary/unhygienic_example.rs +++ b/src/test/run-pass/hygiene/auxiliary/unhygienic_example.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![crate_type = "lib"] diff --git a/src/test/run-pass/hygiene/auxiliary/xcrate.rs b/src/test/run-pass/hygiene/auxiliary/xcrate.rs index f469d87f423..3862914d584 100644 --- a/src/test/run-pass/hygiene/auxiliary/xcrate.rs +++ b/src/test/run-pass/hygiene/auxiliary/xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(decl_macro)] #![allow(unused)] diff --git a/src/test/run-pass/hygiene/hygiene-dodging-1.rs b/src/test/run-pass/hygiene/hygiene-dodging-1.rs index 8c3e8d221f3..69e47e82ba5 100644 --- a/src/test/run-pass/hygiene/hygiene-dodging-1.rs +++ b/src/test/run-pass/hygiene/hygiene-dodging-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] diff --git a/src/test/run-pass/hygiene/hygiene.rs b/src/test/run-pass/hygiene/hygiene.rs index c6b5f9c3974..fb351cf0faf 100644 --- a/src/test/run-pass/hygiene/hygiene.rs +++ b/src/test/run-pass/hygiene/hygiene.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused)] diff --git a/src/test/run-pass/hygiene/hygienic-labels-in-let.rs b/src/test/run-pass/hygiene/hygienic-labels-in-let.rs index 892be9695cc..fb9523b547d 100644 --- a/src/test/run-pass/hygiene/hygienic-labels-in-let.rs +++ b/src/test/run-pass/hygiene/hygienic-labels-in-let.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] diff --git a/src/test/run-pass/hygiene/hygienic-labels-in-let.stderr b/src/test/run-pass/hygiene/hygienic-labels-in-let.stderr index e31c1484399..9c906749f8c 100644 --- a/src/test/run-pass/hygiene/hygienic-labels-in-let.stderr +++ b/src/test/run-pass/hygiene/hygienic-labels-in-let.stderr @@ -1,5 +1,5 @@ warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:25:9 + --> $DIR/hygienic-labels-in-let.rs:15:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -11,7 +11,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:57:9 + --> $DIR/hygienic-labels-in-let.rs:47:9 | LL | 'x: loop { | -- first declared here @@ -20,7 +20,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:57:9 + --> $DIR/hygienic-labels-in-let.rs:47:9 | LL | 'x: loop { $e } | -- first declared here @@ -29,7 +29,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:25:9 + --> $DIR/hygienic-labels-in-let.rs:15:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -41,7 +41,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:25:9 + --> $DIR/hygienic-labels-in-let.rs:15:9 | LL | 'x: loop { $e } | ^^ @@ -53,7 +53,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:25:9 + --> $DIR/hygienic-labels-in-let.rs:15:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -65,7 +65,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:67:9 + --> $DIR/hygienic-labels-in-let.rs:57:9 | LL | 'x: loop { | -- first declared here @@ -74,7 +74,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:67:9 + --> $DIR/hygienic-labels-in-let.rs:57:9 | LL | 'x: loop { $e } | -- first declared here @@ -83,7 +83,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:67:9 + --> $DIR/hygienic-labels-in-let.rs:57:9 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -92,7 +92,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:67:9 + --> $DIR/hygienic-labels-in-let.rs:57:9 | LL | 'x: loop { $e } | -- first declared here @@ -101,7 +101,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:32:9 + --> $DIR/hygienic-labels-in-let.rs:22:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -113,7 +113,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:32:9 + --> $DIR/hygienic-labels-in-let.rs:22:9 | LL | 'x: loop { $e } | -- first declared here @@ -125,7 +125,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:32:9 + --> $DIR/hygienic-labels-in-let.rs:22:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -137,7 +137,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:32:9 + --> $DIR/hygienic-labels-in-let.rs:22:9 | LL | 'x: loop { $e } | -- first declared here @@ -149,7 +149,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:32:9 + --> $DIR/hygienic-labels-in-let.rs:22:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -161,7 +161,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:77:9 + --> $DIR/hygienic-labels-in-let.rs:67:9 | LL | 'x: loop { | -- first declared here @@ -170,7 +170,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:77:9 + --> $DIR/hygienic-labels-in-let.rs:67:9 | LL | 'x: loop { $e } | -- first declared here @@ -179,7 +179,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:77:9 + --> $DIR/hygienic-labels-in-let.rs:67:9 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -188,7 +188,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:77:9 + --> $DIR/hygienic-labels-in-let.rs:67:9 | LL | 'x: loop { $e } | -- first declared here @@ -197,7 +197,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:77:9 + --> $DIR/hygienic-labels-in-let.rs:67:9 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -206,7 +206,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:77:9 + --> $DIR/hygienic-labels-in-let.rs:67:9 | LL | 'x: while 1 + 1 == 2 { $e } | -- first declared here @@ -215,7 +215,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 + --> $DIR/hygienic-labels-in-let.rs:29:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -227,7 +227,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 + --> $DIR/hygienic-labels-in-let.rs:29:9 | LL | 'x: loop { $e } | -- first declared here @@ -239,7 +239,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 + --> $DIR/hygienic-labels-in-let.rs:29:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -251,7 +251,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 + --> $DIR/hygienic-labels-in-let.rs:29:9 | LL | 'x: loop { $e } | -- first declared here @@ -263,7 +263,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 + --> $DIR/hygienic-labels-in-let.rs:29:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -275,7 +275,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 + --> $DIR/hygienic-labels-in-let.rs:29:9 | LL | 'x: while 1 + 1 == 2 { $e } | -- first declared here @@ -287,7 +287,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:39:9 + --> $DIR/hygienic-labels-in-let.rs:29:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope diff --git a/src/test/run-pass/hygiene/hygienic-labels.rs b/src/test/run-pass/hygiene/hygienic-labels.rs index e69f9cd1a86..a364dd9c887 100644 --- a/src/test/run-pass/hygiene/hygienic-labels.rs +++ b/src/test/run-pass/hygiene/hygienic-labels.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] // Test that labels injected by macros do not break hygiene. diff --git a/src/test/run-pass/hygiene/hygienic-labels.stderr b/src/test/run-pass/hygiene/hygienic-labels.stderr index 7bd2886159e..d88dfce540e 100644 --- a/src/test/run-pass/hygiene/hygienic-labels.stderr +++ b/src/test/run-pass/hygiene/hygienic-labels.stderr @@ -1,5 +1,5 @@ warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:22:9 + --> $DIR/hygienic-labels.rs:12:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -11,7 +11,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:47:5 + --> $DIR/hygienic-labels.rs:37:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -20,7 +20,7 @@ LL | 'x: loop { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:47:5 + --> $DIR/hygienic-labels.rs:37:5 | LL | 'x: loop { $e } | -- first declared here @@ -29,7 +29,7 @@ LL | 'x: loop { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:22:9 + --> $DIR/hygienic-labels.rs:12:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -41,7 +41,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:22:9 + --> $DIR/hygienic-labels.rs:12:9 | LL | 'x: loop { $e } | ^^ @@ -53,7 +53,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:22:9 + --> $DIR/hygienic-labels.rs:12:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -65,7 +65,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:53:5 + --> $DIR/hygienic-labels.rs:43:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -74,7 +74,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:53:5 + --> $DIR/hygienic-labels.rs:43:5 | LL | 'x: loop { $e } | -- first declared here @@ -83,7 +83,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:53:5 + --> $DIR/hygienic-labels.rs:43:5 | LL | 'x: loop { | -- first declared here @@ -92,7 +92,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:53:5 + --> $DIR/hygienic-labels.rs:43:5 | LL | 'x: loop { $e } | -- first declared here @@ -101,7 +101,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:36:9 + --> $DIR/hygienic-labels.rs:26:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -113,7 +113,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:36:9 + --> $DIR/hygienic-labels.rs:26:9 | LL | 'x: loop { $e } | -- first declared here @@ -125,7 +125,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:36:9 + --> $DIR/hygienic-labels.rs:26:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -137,7 +137,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:36:9 + --> $DIR/hygienic-labels.rs:26:9 | LL | 'x: loop { $e } | -- first declared here @@ -149,7 +149,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:36:9 + --> $DIR/hygienic-labels.rs:26:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -160,7 +160,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:58:5 + --> $DIR/hygienic-labels.rs:48:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -169,7 +169,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:58:5 + --> $DIR/hygienic-labels.rs:48:5 | LL | 'x: loop { $e } | -- first declared here @@ -178,7 +178,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:58:5 + --> $DIR/hygienic-labels.rs:48:5 | LL | 'x: loop { | -- first declared here @@ -187,7 +187,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:58:5 + --> $DIR/hygienic-labels.rs:48:5 | LL | 'x: loop { $e } | -- first declared here @@ -196,7 +196,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:58:5 + --> $DIR/hygienic-labels.rs:48:5 | LL | 'x: while 1 + 1 == 2 { | -- first declared here @@ -205,7 +205,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:58:5 + --> $DIR/hygienic-labels.rs:48:5 | LL | 'x: while 1 + 1 == 2 { $e } | -- first declared here @@ -214,7 +214,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:29:9 + --> $DIR/hygienic-labels.rs:19:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -226,7 +226,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:29:9 + --> $DIR/hygienic-labels.rs:19:9 | LL | 'x: loop { $e } | -- first declared here @@ -238,7 +238,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:29:9 + --> $DIR/hygienic-labels.rs:19:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -250,7 +250,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:29:9 + --> $DIR/hygienic-labels.rs:19:9 | LL | 'x: loop { $e } | -- first declared here @@ -262,7 +262,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:29:9 + --> $DIR/hygienic-labels.rs:19:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -274,7 +274,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:29:9 + --> $DIR/hygienic-labels.rs:19:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -286,7 +286,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:29:9 + --> $DIR/hygienic-labels.rs:19:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope diff --git a/src/test/run-pass/hygiene/issue-44128.rs b/src/test/run-pass/hygiene/issue-44128.rs index db9e0de2e9a..23ced9ae530 100644 --- a/src/test/run-pass/hygiene/issue-44128.rs +++ b/src/test/run-pass/hygiene/issue-44128.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![feature(decl_macro)] diff --git a/src/test/run-pass/hygiene/issue-47311.rs b/src/test/run-pass/hygiene/issue-47311.rs index 43c4fc747e7..856184fbc83 100644 --- a/src/test/run-pass/hygiene/issue-47311.rs +++ b/src/test/run-pass/hygiene/issue-47311.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty pretty-printing is unhygienic diff --git a/src/test/run-pass/hygiene/issue-47312.rs b/src/test/run-pass/hygiene/issue-47312.rs index 68166912f5f..88e7a028f92 100644 --- a/src/test/run-pass/hygiene/issue-47312.rs +++ b/src/test/run-pass/hygiene/issue-47312.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty pretty-printing is unhygienic diff --git a/src/test/run-pass/hygiene/items.rs b/src/test/run-pass/hygiene/items.rs index 1c215523892..cdc271386b7 100644 --- a/src/test/run-pass/hygiene/items.rs +++ b/src/test/run-pass/hygiene/items.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty pretty-printing is unhygienic diff --git a/src/test/run-pass/hygiene/legacy_interaction.rs b/src/test/run-pass/hygiene/legacy_interaction.rs index 72370396ebb..a5460a89f13 100644 --- a/src/test/run-pass/hygiene/legacy_interaction.rs +++ b/src/test/run-pass/hygiene/legacy_interaction.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // ignore-pretty pretty-printing is unhygienic diff --git a/src/test/run-pass/hygiene/lexical.rs b/src/test/run-pass/hygiene/lexical.rs index 9dc116d3af7..20bda5508c8 100644 --- a/src/test/run-pass/hygiene/lexical.rs +++ b/src/test/run-pass/hygiene/lexical.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty pretty-printing is unhygienic diff --git a/src/test/run-pass/hygiene/specialization.rs b/src/test/run-pass/hygiene/specialization.rs index a1ab5b78ca0..656aa880ad1 100644 --- a/src/test/run-pass/hygiene/specialization.rs +++ b/src/test/run-pass/hygiene/specialization.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty pretty-printing is unhygienic diff --git a/src/test/run-pass/hygiene/trait_items.rs b/src/test/run-pass/hygiene/trait_items.rs index 4007f5b5c8f..680f228c986 100644 --- a/src/test/run-pass/hygiene/trait_items.rs +++ b/src/test/run-pass/hygiene/trait_items.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty pretty-printing is unhygienic diff --git a/src/test/run-pass/hygiene/ty_params.rs b/src/test/run-pass/hygiene/ty_params.rs index a057f2fc5ce..dce4bd6489c 100644 --- a/src/test/run-pass/hygiene/ty_params.rs +++ b/src/test/run-pass/hygiene/ty_params.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty pretty-printing is unhygienic diff --git a/src/test/run-pass/hygiene/wrap_unhygienic_example.rs b/src/test/run-pass/hygiene/wrap_unhygienic_example.rs index 9516bfe50b6..e0277e2bb74 100644 --- a/src/test/run-pass/hygiene/wrap_unhygienic_example.rs +++ b/src/test/run-pass/hygiene/wrap_unhygienic_example.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty pretty-printing is unhygienic diff --git a/src/test/run-pass/hygiene/xcrate.rs b/src/test/run-pass/hygiene/xcrate.rs index 3e330fe3862..6981ce3f687 100644 --- a/src/test/run-pass/hygiene/xcrate.rs +++ b/src/test/run-pass/hygiene/xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty pretty-printing is unhygienic diff --git a/src/test/run-pass/if-bot.rs b/src/test/run-pass/if-bot.rs index e66a8c85723..6d87288dd08 100644 --- a/src/test/run-pass/if-bot.rs +++ b/src/test/run-pass/if-bot.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let i: isize = if false { panic!() } else { 5 }; println!("{}", i); diff --git a/src/test/run-pass/if-check.rs b/src/test/run-pass/if-check.rs index c72cd10a082..43904f6823f 100644 --- a/src/test/run-pass/if-check.rs +++ b/src/test/run-pass/if-check.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn even(x: usize) -> bool { if x < 2 { return false; diff --git a/src/test/run-pass/if-ret.rs b/src/test/run-pass/if-ret.rs index 5c5c4c80ab1..3c2377466a1 100644 --- a/src/test/run-pass/if-ret.rs +++ b/src/test/run-pass/if-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_parens)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index 37436d7ae00..56222fa46f7 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(warnings)] #![allow(unused_must_use)] #![allow(unused_features)] diff --git a/src/test/run-pass/ignore-all-the-things.rs b/src/test/run-pass/ignore-all-the-things.rs index 90d858c2858..6916a199a10 100644 --- a/src/test/run-pass/ignore-all-the-things.rs +++ b/src/test/run-pass/ignore-all-the-things.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_shorthand_field_patterns)] #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/impl-for-never.rs b/src/test/run-pass/impl-for-never.rs index 794f5969bff..d2dbae61767 100644 --- a/src/test/run-pass/impl-for-never.rs +++ b/src/test/run-pass/impl-for-never.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can call static methods on ! both directly and when it appears in a generic #![feature(never_type)] diff --git a/src/test/run-pass/impl-inherent-non-conflict.rs b/src/test/run-pass/impl-inherent-non-conflict.rs index 209b4acb095..ed87ffb0198 100644 --- a/src/test/run-pass/impl-inherent-non-conflict.rs +++ b/src/test/run-pass/impl-inherent-non-conflict.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensure that a user-defined type admits multiple inherent methods // with the same name, which can be called on values that have a // precise enough type to allow distinguishing between the methods. diff --git a/src/test/run-pass/impl-not-adjacent-to-type.rs b/src/test/run-pass/impl-not-adjacent-to-type.rs index beba056b72c..c0cdff30cbf 100644 --- a/src/test/run-pass/impl-not-adjacent-to-type.rs +++ b/src/test/run-pass/impl-not-adjacent-to-type.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - mod foo { pub struct Point { pub x: i32, diff --git a/src/test/run-pass/impl-privacy-xc-1.rs b/src/test/run-pass/impl-privacy-xc-1.rs index 97945f4c4da..42e149eacb5 100644 --- a/src/test/run-pass/impl-privacy-xc-1.rs +++ b/src/test/run-pass/impl-privacy-xc-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:impl_privacy_xc_1.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/impl-privacy-xc-2.rs b/src/test/run-pass/impl-privacy-xc-2.rs index 3ef4b43d079..7cdd7146c33 100644 --- a/src/test/run-pass/impl-privacy-xc-2.rs +++ b/src/test/run-pass/impl-privacy-xc-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:impl_privacy_xc_2.rs extern crate impl_privacy_xc_2; diff --git a/src/test/run-pass/impl-trait-in-bindings.rs b/src/test/run-pass/impl-trait-in-bindings.rs index 631967c3f08..9a1f53b4893 100644 --- a/src/test/run-pass/impl-trait-in-bindings.rs +++ b/src/test/run-pass/impl-trait-in-bindings.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(impl_trait_in_bindings)] use std::fmt::Debug; diff --git a/src/test/run-pass/impl-trait/auto-trait-leak.rs b/src/test/run-pass/impl-trait/auto-trait-leak.rs index fb252b01f85..9976a018b46 100644 --- a/src/test/run-pass/impl-trait/auto-trait-leak.rs +++ b/src/test/run-pass/impl-trait/auto-trait-leak.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Fast path, main can see the concrete type returned. diff --git a/src/test/run-pass/impl-trait/auxiliary/xcrate.rs b/src/test/run-pass/impl-trait/auxiliary/xcrate.rs index c57c1cfe74f..ac016258b7f 100644 --- a/src/test/run-pass/impl-trait/auxiliary/xcrate.rs +++ b/src/test/run-pass/impl-trait/auxiliary/xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // NOTE commented out due to issue #45994 //pub fn fourway_add(a: i32) -> impl Fn(i32) -> impl Fn(i32) -> impl Fn(i32) -> i32 { // move |b| move |c| move |d| a + b + c + d diff --git a/src/test/run-pass/impl-trait/bounds_regression.rs b/src/test/run-pass/impl-trait/bounds_regression.rs index b6abfdebfa8..0fdeb6bdee1 100644 --- a/src/test/run-pass/impl-trait/bounds_regression.rs +++ b/src/test/run-pass/impl-trait/bounds_regression.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub trait FakeGenerator { diff --git a/src/test/run-pass/impl-trait/equality.rs b/src/test/run-pass/impl-trait/equality.rs index 5026f10b6f8..05c9e4173b0 100644 --- a/src/test/run-pass/impl-trait/equality.rs +++ b/src/test/run-pass/impl-trait/equality.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(specialization)] diff --git a/src/test/run-pass/impl-trait/example-calendar.rs b/src/test/run-pass/impl-trait/example-calendar.rs index e6dd421f48f..cd3d48f1a03 100644 --- a/src/test/run-pass/impl-trait/example-calendar.rs +++ b/src/test/run-pass/impl-trait/example-calendar.rs @@ -1,13 +1,3 @@ -// Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // revisions: normal nll @@ -86,7 +76,7 @@ impl NaiveDate { let weeks_in_year = self.last_week_number(); // Work out the final result. - // If the week is -1 or >= weeks_in_year, we will need to adjust the year. + // If the week is `-1` or `>= weeks_in_year`, we will need to adjust the year. let year = self.year(); let wd = self.weekday(); @@ -234,7 +224,7 @@ impl Weekday { } } -/// GroupBy implementation. +/// `GroupBy` implementation. struct GroupBy { it: std::iter::Peekable, f: F, @@ -319,7 +309,7 @@ trait IteratorExt: Iterator + Sized { s } - // HACK(eddyb) Only needed because `impl Trait` can't be + // HACK(eddyb): only needed because `impl Trait` can't be // used with trait methods: `.foo()` becomes `.__(foo)`. fn __(self, f: F) -> R where F: FnOnce(Self) -> R { @@ -329,9 +319,7 @@ trait IteratorExt: Iterator + Sized { impl IteratorExt for It where It: Iterator {} -/// -/// Generates an iterator that yields exactly n spaces. -/// +/// Generates an iterator that yields exactly `n` spaces. fn spaces(n: usize) -> std::iter::Take> { std::iter::repeat(' ').take(n) } @@ -341,9 +329,7 @@ fn test_spaces() { assert_eq!(spaces(10).collect::(), " ") } -/// /// Returns an iterator of dates in a given year. -/// fn dates_in_year(year: i32) -> impl Iterator+Clone { InGroup { it: NaiveDate::from_ymd(year, 1, 1).., @@ -357,10 +343,10 @@ fn test_dates_in_year() { let mut dates = dates_in_year(2013); assert_eq!(dates.next(), Some(NaiveDate::from_ymd(2013, 1, 1))); - // Check increment + // Check increment. assert_eq!(dates.next(), Some(NaiveDate::from_ymd(2013, 1, 2))); - // Check monthly rollover + // Check monthly roll-over. for _ in 3..31 { assert!(dates.next() != None); } @@ -370,7 +356,7 @@ fn test_dates_in_year() { } { - // Check length of year + // Check length of year. let mut dates = dates_in_year(2013); for _ in 0..365 { assert!(dates.next() != None); @@ -379,7 +365,7 @@ fn test_dates_in_year() { } { - // Check length of leap year + // Check length of leap year. let mut dates = dates_in_year(1984); for _ in 0..366 { assert!(dates.next() != None); @@ -388,10 +374,8 @@ fn test_dates_in_year() { } } -/// /// Convenience trait for verifying that a given type iterates over /// `NaiveDate`s. -/// trait DateIterator: Iterator + Clone {} impl DateIterator for It where It: Iterator + Clone {} @@ -427,11 +411,9 @@ fn test_group_by() { } } -/// /// Groups an iterator of dates by month. -/// fn by_month(it: impl Iterator + Clone) - -> impl Iterator + Clone)> + Clone + -> impl Iterator + Clone)> + Clone { it.group_by(|d| d.month()) } @@ -444,9 +426,7 @@ fn test_by_month() { assert!(months.next().is_none()); } -/// /// Groups an iterator of dates by week. -/// fn by_week(it: impl DateIterator) -> impl Iterator + Clone { @@ -518,9 +498,7 @@ const COLS_PER_DAY: u32 = 3; /// The number of columns per week in the formatted output. const COLS_PER_WEEK: u32 = 7 * COLS_PER_DAY; -/// /// Formats an iterator of weeks into an iterator of strings. -/// fn format_weeks(it: impl Iterator) -> impl Iterator { it.map(|week| { let mut buf = String::with_capacity((COLS_PER_DAY * COLS_PER_WEEK + 2) as usize); @@ -541,7 +519,7 @@ fn format_weeks(it: impl Iterator) -> impl Iterator String { const MONTH_NAMES: &'static [&'static str] = &[ "January", "February", "March", "April", "May", "June", @@ -584,7 +560,7 @@ fn month_title(month: u32) -> String { let before = (COLS_PER_WEEK as usize - name.len()) / 2; let after = COLS_PER_WEEK as usize - name.len() - before; - // NOTE: Being slightly more verbose to avoid extra allocations. + // Note: being slightly more verbose to avoid extra allocations. let mut result = String::with_capacity(COLS_PER_WEEK as usize); result.extend(spaces(before)); result.push_str(name); @@ -596,9 +572,7 @@ fn test_month_title() { assert_eq!(month_title(1).len(), COLS_PER_WEEK as usize); } -/// /// Formats a month. -/// fn format_month(it: impl DateIterator) -> impl Iterator { let mut month_days = it.peekable(); let title = month_title(month_days.peek().unwrap().month()); @@ -627,22 +601,17 @@ fn test_format_month() { ); } - -/// /// Formats an iterator of months. -/// fn format_months(it: impl Iterator) -> impl Iterator> { it.map(format_month) } -/// /// Takes an iterator of iterators of strings; the sub-iterators are consumed /// in lock-step, with their elements joined together. -/// trait PasteBlocks: Iterator + Sized -where Self::Item: Iterator { +where Self::Item: Iterator { fn paste_blocks(self, sep_width: usize) -> PasteBlocksIter { PasteBlocksIter { iters: self.collect(), @@ -721,9 +690,7 @@ fn test_paste_blocks() { ); } -/// /// Produces an iterator that yields `n` elements at a time. -/// trait Chunks: Iterator + Sized { fn chunks(self, n: usize) -> ChunksIter { assert!(n > 0); @@ -742,7 +709,7 @@ where It: Iterator { n: usize, } -// NOTE: `chunks` in Rust is more-or-less impossible without overhead of some kind. +// Note: `chunks` in Rust is more-or-less impossible without overhead of some kind. // Aliasing rules mean you need to add dynamic borrow checking, and the design of // `Iterator` means that you need to have the iterator's state kept in an allocation // that is jointly owned by the iterator itself and the sub-iterator. @@ -753,10 +720,7 @@ where It: Iterator { type Item = Vec; fn next(&mut self) -> Option> { - let first = match self.it.next() { - Some(e) => e, - None => return None - }; + let first = self.it.next()?; let mut result = Vec::with_capacity(self.n); result.push(first); @@ -772,9 +736,7 @@ fn test_chunks() { assert_eq!(&*c, &[vec![1, 2, 3], vec![4, 5, 6], vec![7]]); } -/// /// Formats a year. -/// fn format_year(year: i32, months_per_row: usize) -> String { const COL_SPACING: usize = 1; @@ -787,17 +749,17 @@ fn format_year(year: i32, months_per_row: usize) -> String { // Group the months into horizontal rows. .chunks(months_per_row) - // Format each row + // Format each row... .map(|r| r.into_iter() - // By formatting each month + // ... by formatting each month ... .__(format_months) - // Horizontally pasting each respective month's lines together. + // ... and horizontally pasting each respective month's lines together. .paste_blocks(COL_SPACING) .join("\n") ) - // Insert a blank line between each row + // Insert a blank line between each row. .join("\n\n") } diff --git a/src/test/run-pass/impl-trait/example-st.rs b/src/test/run-pass/impl-trait/example-st.rs index 014af37ccf9..4e1aa3a0859 100644 --- a/src/test/run-pass/impl-trait/example-st.rs +++ b/src/test/run-pass/impl-trait/example-st.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct State; diff --git a/src/test/run-pass/impl-trait/lifetimes.rs b/src/test/run-pass/impl-trait/lifetimes.rs index e5a98962ff3..5a21e1dd817 100644 --- a/src/test/run-pass/impl-trait/lifetimes.rs +++ b/src/test/run-pass/impl-trait/lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(warnings)] @@ -41,7 +31,6 @@ impl<'a> SingleRegionTrait<'a> for &'a u32 {} struct SingleRegionStruct<'a>(&'a u32); fn simple_type_hrtb<'b>() -> impl for<'a> SingleRegionTrait<'a> { 5 } -// FIXME(cramertj) add test after #45992 lands to ensure lint is triggered fn elision_single_region_trait(x: &u32) -> impl SingleRegionTrait { x } fn elision_single_region_struct(x: SingleRegionStruct) -> impl Into { x } diff --git a/src/test/run-pass/impl-trait/nesting.rs b/src/test/run-pass/impl-trait/nesting.rs index 3bb081181ff..27bdd5fa483 100644 --- a/src/test/run-pass/impl-trait/nesting.rs +++ b/src/test/run-pass/impl-trait/nesting.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/impl-trait/universal_hrtb_anon.rs b/src/test/run-pass/impl-trait/universal_hrtb_anon.rs index b78ec557d09..30c8d291f6a 100644 --- a/src/test/run-pass/impl-trait/universal_hrtb_anon.rs +++ b/src/test/run-pass/impl-trait/universal_hrtb_anon.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn hrtb(f: impl Fn(&u32) -> u32) -> u32 { diff --git a/src/test/run-pass/impl-trait/universal_hrtb_named.rs b/src/test/run-pass/impl-trait/universal_hrtb_named.rs index 0bec594346b..07ff5d23e0c 100644 --- a/src/test/run-pass/impl-trait/universal_hrtb_named.rs +++ b/src/test/run-pass/impl-trait/universal_hrtb_named.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn hrtb(f: impl for<'a> Fn(&'a u32) -> &'a u32) -> u32 { diff --git a/src/test/run-pass/impl-trait/universal_in_adt_in_parameters.rs b/src/test/run-pass/impl-trait/universal_in_adt_in_parameters.rs index 95e6a3efdf0..a3829133dfa 100644 --- a/src/test/run-pass/impl-trait/universal_in_adt_in_parameters.rs +++ b/src/test/run-pass/impl-trait/universal_in_adt_in_parameters.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::fmt::Display; diff --git a/src/test/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs b/src/test/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs index b9c68c280f1..e98912d95a5 100644 --- a/src/test/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs +++ b/src/test/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::fmt::Display; diff --git a/src/test/run-pass/impl-trait/universal_in_trait_defn_parameters.rs b/src/test/run-pass/impl-trait/universal_in_trait_defn_parameters.rs index 6fb44147c1c..23c217a8f8b 100644 --- a/src/test/run-pass/impl-trait/universal_in_trait_defn_parameters.rs +++ b/src/test/run-pass/impl-trait/universal_in_trait_defn_parameters.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::fmt::Debug; diff --git a/src/test/run-pass/impl-trait/universal_multiple_bounds.rs b/src/test/run-pass/impl-trait/universal_multiple_bounds.rs index 9b1c2b92446..40c1405c39b 100644 --- a/src/test/run-pass/impl-trait/universal_multiple_bounds.rs +++ b/src/test/run-pass/impl-trait/universal_multiple_bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::fmt::Display; diff --git a/src/test/run-pass/impl-trait/xcrate.rs b/src/test/run-pass/impl-trait/xcrate.rs index aa5d3298f69..b73d2946c2b 100644 --- a/src/test/run-pass/impl-trait/xcrate.rs +++ b/src/test/run-pass/impl-trait/xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:xcrate.rs diff --git a/src/test/run-pass/impl-trait/xcrate_simple.rs b/src/test/run-pass/impl-trait/xcrate_simple.rs index 8b7c8ada1c0..2b1fc97e321 100644 --- a/src/test/run-pass/impl-trait/xcrate_simple.rs +++ b/src/test/run-pass/impl-trait/xcrate_simple.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:xcrate.rs diff --git a/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs b/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs index dd26cf78fda..b76c1680bba 100644 --- a/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs +++ b/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] // no-prefer-dynamic diff --git a/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans_macros.rs b/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans_macros.rs index 112315af844..63611c24299 100644 --- a/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans_macros.rs +++ b/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! add1 { ($e:expr) => ({ let a = 1 + $e; diff --git a/src/test/run-pass/imports/import-crate-with-invalid-spans/main.rs b/src/test/run-pass/imports/import-crate-with-invalid-spans/main.rs index 990758d52ff..64a4deca8c3 100644 --- a/src/test/run-pass/imports/import-crate-with-invalid-spans/main.rs +++ b/src/test/run-pass/imports/import-crate-with-invalid-spans/main.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:crate_with_invalid_spans.rs diff --git a/src/test/run-pass/imports/import-from.rs b/src/test/run-pass/imports/import-from.rs index 5f498a48584..2817977b393 100644 --- a/src/test/run-pass/imports/import-from.rs +++ b/src/test/run-pass/imports/import-from.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/imports/import-glob-0.rs b/src/test/run-pass/imports/import-glob-0.rs index 731a716d4a5..9c6a87279a2 100644 --- a/src/test/run-pass/imports/import-glob-0.rs +++ b/src/test/run-pass/imports/import-glob-0.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] use module_of_many_things::*; diff --git a/src/test/run-pass/imports/import-glob-1.rs b/src/test/run-pass/imports/import-glob-1.rs index c4e50c17264..fcc0b63f101 100644 --- a/src/test/run-pass/imports/import-glob-1.rs +++ b/src/test/run-pass/imports/import-glob-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/test/run-pass/imports/import-glob-crate.rs b/src/test/run-pass/imports/import-glob-crate.rs index 4ec5e1bd945..501392b7829 100644 --- a/src/test/run-pass/imports/import-glob-crate.rs +++ b/src/test/run-pass/imports/import-glob-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem::*; diff --git a/src/test/run-pass/imports/import-in-block.rs b/src/test/run-pass/imports/import-in-block.rs index 655bd31b4de..c0ba6220b54 100644 --- a/src/test/run-pass/imports/import-in-block.rs +++ b/src/test/run-pass/imports/import-in-block.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/imports/import-prefix-macro.rs b/src/test/run-pass/imports/import-prefix-macro.rs index 5768029ef8c..d770bb0da80 100644 --- a/src/test/run-pass/imports/import-prefix-macro.rs +++ b/src/test/run-pass/imports/import-prefix-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] mod a { diff --git a/src/test/run-pass/imports/import-rename.rs b/src/test/run-pass/imports/import-rename.rs index 082e8321e18..9ad2b34b837 100644 --- a/src/test/run-pass/imports/import-rename.rs +++ b/src/test/run-pass/imports/import-rename.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] use foo::{x, y as fooy}; diff --git a/src/test/run-pass/imports/import-trailing-comma.rs b/src/test/run-pass/imports/import-trailing-comma.rs index 6c3371b46c7..f65c5c866a3 100644 --- a/src/test/run-pass/imports/import-trailing-comma.rs +++ b/src/test/run-pass/imports/import-trailing-comma.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/imports/import.rs b/src/test/run-pass/imports/import.rs index cb2152f5fac..de8bf626114 100644 --- a/src/test/run-pass/imports/import.rs +++ b/src/test/run-pass/imports/import.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass mod foo { pub fn x(y: isize) { println!("{}", y); } diff --git a/src/test/run-pass/imports/import2.rs b/src/test/run-pass/imports/import2.rs index aaf65fc1c8c..7b70f799ebf 100644 --- a/src/test/run-pass/imports/import2.rs +++ b/src/test/run-pass/imports/import2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use zed::bar; diff --git a/src/test/run-pass/imports/import3.rs b/src/test/run-pass/imports/import3.rs index 38e316f550b..17797aed359 100644 --- a/src/test/run-pass/imports/import3.rs +++ b/src/test/run-pass/imports/import3.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] diff --git a/src/test/run-pass/imports/import4.rs b/src/test/run-pass/imports/import4.rs index 057e1cb5e01..4fda5386112 100644 --- a/src/test/run-pass/imports/import4.rs +++ b/src/test/run-pass/imports/import4.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use zed::bar; diff --git a/src/test/run-pass/imports/import5.rs b/src/test/run-pass/imports/import5.rs index 614c8c435c9..be2a55c2d41 100644 --- a/src/test/run-pass/imports/import5.rs +++ b/src/test/run-pass/imports/import5.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use foo::bar; mod foo { diff --git a/src/test/run-pass/imports/import6.rs b/src/test/run-pass/imports/import6.rs index d98d5b3b0e1..e11b28531f9 100644 --- a/src/test/run-pass/imports/import6.rs +++ b/src/test/run-pass/imports/import6.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] diff --git a/src/test/run-pass/imports/import7.rs b/src/test/run-pass/imports/import7.rs index 67e41824e0d..aca7fbdc4f5 100644 --- a/src/test/run-pass/imports/import7.rs +++ b/src/test/run-pass/imports/import7.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] diff --git a/src/test/run-pass/imports/import8.rs b/src/test/run-pass/imports/import8.rs index 71dd7acac5a..87f0986bae4 100644 --- a/src/test/run-pass/imports/import8.rs +++ b/src/test/run-pass/imports/import8.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use foo::x; diff --git a/src/test/run-pass/imports/imports.rs b/src/test/run-pass/imports/imports.rs index 7ca7ea1fd8c..acb2b32b59d 100644 --- a/src/test/run-pass/imports/imports.rs +++ b/src/test/run-pass/imports/imports.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused)] diff --git a/src/test/run-pass/in-band-lifetimes.rs b/src/test/run-pass/in-band-lifetimes.rs index 6edd0d686ef..c8922605363 100644 --- a/src/test/run-pass/in-band-lifetimes.rs +++ b/src/test/run-pass/in-band-lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(in_band_lifetimes)] diff --git a/src/test/run-pass/inc-range-pat.rs b/src/test/run-pass/inc-range-pat.rs index 237b41b6128..6b99a9d0a74 100644 --- a/src/test/run-pass/inc-range-pat.rs +++ b/src/test/run-pass/inc-range-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test old and new syntax for inclusive range patterns. fn main() { diff --git a/src/test/run-pass/infer-fn-tail-expr.rs b/src/test/run-pass/infer-fn-tail-expr.rs index a3e0f9dc039..ab0210baa96 100644 --- a/src/test/run-pass/infer-fn-tail-expr.rs +++ b/src/test/run-pass/infer-fn-tail-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // issue #680 diff --git a/src/test/run-pass/inherit-env.rs b/src/test/run-pass/inherit-env.rs new file mode 100644 index 00000000000..856d3a5f72d --- /dev/null +++ b/src/test/run-pass/inherit-env.rs @@ -0,0 +1,25 @@ +// ignore-emscripten +// ignore-wasm32 + +use std::env; +use std::process::Command; + +fn main() { + if env::args().nth(1).map(|s| s == "print").unwrap_or(false) { + for (k, v) in env::vars() { + println!("{}={}", k, v); + } + return + } + + let me = env::current_exe().unwrap(); + let result = Command::new(me).arg("print").output().unwrap(); + let output = String::from_utf8(result.stdout).unwrap(); + + for (k, v) in env::vars() { + assert!(output.contains(&format!("{}={}", k, v)), + "output doesn't contain `{}={}`\n{}", + k, v, output); + } +} + diff --git a/src/test/run-pass/init-large-type.rs b/src/test/run-pass/init-large-type.rs index 0ad0ecf8ce9..cb64cd0b0f3 100644 --- a/src/test/run-pass/init-large-type.rs +++ b/src/test/run-pass/init-large-type.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] // Makes sure that zero-initializing large types is reasonably fast, // Doing it incorrectly causes massive slowdown in LLVM during diff --git a/src/test/run-pass/init-res-into-things.rs b/src/test/run-pass/init-res-into-things.rs index dd838ef98db..832637962bb 100644 --- a/src/test/run-pass/init-res-into-things.rs +++ b/src/test/run-pass/init-res-into-things.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] #![feature(box_syntax)] diff --git a/src/test/run-pass/inlined-main.rs b/src/test/run-pass/inlined-main.rs index 1288c37d615..3a55a894267 100644 --- a/src/test/run-pass/inlined-main.rs +++ b/src/test/run-pass/inlined-main.rs @@ -1,12 +1,2 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[inline(always)] fn main() {} diff --git a/src/test/run-pass/inner-attrs-on-impl.rs b/src/test/run-pass/inner-attrs-on-impl.rs index d8d9d5136e2..4cc659562ea 100644 --- a/src/test/run-pass/inner-attrs-on-impl.rs +++ b/src/test/run-pass/inner-attrs-on-impl.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - struct Foo; impl Foo { diff --git a/src/test/run-pass/inner-module.rs b/src/test/run-pass/inner-module.rs index 95a10df5f81..d8658691875 100644 --- a/src/test/run-pass/inner-module.rs +++ b/src/test/run-pass/inner-module.rs @@ -1,16 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - mod inner { pub mod inner2 { pub fn hello() { println!("hello, modular world"); } diff --git a/src/test/run-pass/inner-static.rs b/src/test/run-pass/inner-static.rs index b93ca943e47..6f7d7c22887 100644 --- a/src/test/run-pass/inner-static.rs +++ b/src/test/run-pass/inner-static.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:inner_static.rs diff --git a/src/test/run-pass/instantiable.rs b/src/test/run-pass/instantiable.rs index 7d708b475fc..fe8d9f97149 100644 --- a/src/test/run-pass/instantiable.rs +++ b/src/test/run-pass/instantiable.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/intrinsics/auxiliary/cci_intrinsic.rs b/src/test/run-pass/intrinsics/auxiliary/cci_intrinsic.rs index b6e69d29f70..f65f359875b 100644 --- a/src/test/run-pass/intrinsics/auxiliary/cci_intrinsic.rs +++ b/src/test/run-pass/intrinsics/auxiliary/cci_intrinsic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(intrinsics)] pub mod rusti { diff --git a/src/test/run-pass/intrinsics/intrinsic-alignment.rs b/src/test/run-pass/intrinsics/intrinsic-alignment.rs index 0c1f7724ca8..19e56710620 100644 --- a/src/test/run-pass/intrinsics/intrinsic-alignment.rs +++ b/src/test/run-pass/intrinsics/intrinsic-alignment.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare seems not important to test here diff --git a/src/test/run-pass/intrinsics/intrinsic-assume.rs b/src/test/run-pass/intrinsics/intrinsic-assume.rs index e428c0e50ab..3c9d70cb556 100644 --- a/src/test/run-pass/intrinsics/intrinsic-assume.rs +++ b/src/test/run-pass/intrinsics/intrinsic-assume.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(core_intrinsics)] diff --git a/src/test/run-pass/intrinsics/intrinsic-atomics-cc.rs b/src/test/run-pass/intrinsics/intrinsic-atomics-cc.rs index ce8b07c9075..52e891da9ba 100644 --- a/src/test/run-pass/intrinsics/intrinsic-atomics-cc.rs +++ b/src/test/run-pass/intrinsics/intrinsic-atomics-cc.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_intrinsic.rs diff --git a/src/test/run-pass/intrinsics/intrinsic-atomics.rs b/src/test/run-pass/intrinsics/intrinsic-atomics.rs index d238a57a076..608cf3dee52 100644 --- a/src/test/run-pass/intrinsics/intrinsic-atomics.rs +++ b/src/test/run-pass/intrinsics/intrinsic-atomics.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] #![feature(intrinsics)] diff --git a/src/test/run-pass/intrinsics/intrinsic-move-val-cleanups.rs b/src/test/run-pass/intrinsics/intrinsic-move-val-cleanups.rs index 0f8088c8969..a2068429af5 100644 --- a/src/test/run-pass/intrinsics/intrinsic-move-val-cleanups.rs +++ b/src/test/run-pass/intrinsics/intrinsic-move-val-cleanups.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_unsafe)] #![allow(unreachable_code)] diff --git a/src/test/run-pass/intrinsics/intrinsic-move-val.rs b/src/test/run-pass/intrinsics/intrinsic-move-val.rs index dcc495e5923..75b4ec365fe 100644 --- a/src/test/run-pass/intrinsics/intrinsic-move-val.rs +++ b/src/test/run-pass/intrinsics/intrinsic-move-val.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/intrinsics/intrinsic-uninit.rs b/src/test/run-pass/intrinsics/intrinsic-uninit.rs index 0f58bdbb9c5..9555efb639b 100644 --- a/src/test/run-pass/intrinsics/intrinsic-uninit.rs +++ b/src/test/run-pass/intrinsics/intrinsic-uninit.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/intrinsics/intrinsic-unreachable.rs b/src/test/run-pass/intrinsics/intrinsic-unreachable.rs index 586d0a352f9..da1a32d58ea 100644 --- a/src/test/run-pass/intrinsics/intrinsic-unreachable.rs +++ b/src/test/run-pass/intrinsics/intrinsic-unreachable.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(core_intrinsics)] diff --git a/src/test/run-pass/intrinsics/intrinsics-integer.rs b/src/test/run-pass/intrinsics/intrinsics-integer.rs index 97c1c93cfd4..0154f049950 100644 --- a/src/test/run-pass/intrinsics/intrinsics-integer.rs +++ b/src/test/run-pass/intrinsics/intrinsics-integer.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no i128 support @@ -26,63 +16,63 @@ mod rusti { } pub fn main() { - unsafe { - use rusti::*; - - assert_eq!(ctpop(0u8), 0); assert_eq!(ctpop(0i8), 0); - assert_eq!(ctpop(0u16), 0); assert_eq!(ctpop(0i16), 0); - assert_eq!(ctpop(0u32), 0); assert_eq!(ctpop(0i32), 0); - assert_eq!(ctpop(0u64), 0); assert_eq!(ctpop(0i64), 0); - assert_eq!(ctpop(0u128), 0); assert_eq!(ctpop(0i128), 0); - - assert_eq!(ctpop(1u8), 1); assert_eq!(ctpop(1i8), 1); - assert_eq!(ctpop(1u16), 1); assert_eq!(ctpop(1i16), 1); - assert_eq!(ctpop(1u32), 1); assert_eq!(ctpop(1i32), 1); - assert_eq!(ctpop(1u64), 1); assert_eq!(ctpop(1i64), 1); - assert_eq!(ctpop(1u128), 1); assert_eq!(ctpop(1i128), 1); - - assert_eq!(ctpop(10u8), 2); assert_eq!(ctpop(10i8), 2); - assert_eq!(ctpop(10u16), 2); assert_eq!(ctpop(10i16), 2); - assert_eq!(ctpop(10u32), 2); assert_eq!(ctpop(10i32), 2); - assert_eq!(ctpop(10u64), 2); assert_eq!(ctpop(10i64), 2); - assert_eq!(ctpop(10u128), 2); assert_eq!(ctpop(10i128), 2); - - assert_eq!(ctpop(100u8), 3); assert_eq!(ctpop(100i8), 3); - assert_eq!(ctpop(100u16), 3); assert_eq!(ctpop(100i16), 3); - assert_eq!(ctpop(100u32), 3); assert_eq!(ctpop(100i32), 3); - assert_eq!(ctpop(100u64), 3); assert_eq!(ctpop(100i64), 3); - assert_eq!(ctpop(100u128), 3); assert_eq!(ctpop(100i128), 3); - - assert_eq!(ctpop(-1i8 as u8), 8); assert_eq!(ctpop(-1i8), 8); - assert_eq!(ctpop(-1i16 as u16), 16); assert_eq!(ctpop(-1i16), 16); - assert_eq!(ctpop(-1i32 as u32), 32); assert_eq!(ctpop(-1i32), 32); - assert_eq!(ctpop(-1i64 as u64), 64); assert_eq!(ctpop(-1i64), 64); - assert_eq!(ctpop(-1i128 as u128), 128); assert_eq!(ctpop(-1i128), 128); - - assert_eq!(ctlz(0u8), 8); assert_eq!(ctlz(0i8), 8); - assert_eq!(ctlz(0u16), 16); assert_eq!(ctlz(0i16), 16); - assert_eq!(ctlz(0u32), 32); assert_eq!(ctlz(0i32), 32); - assert_eq!(ctlz(0u64), 64); assert_eq!(ctlz(0i64), 64); - assert_eq!(ctlz(0u128), 128); assert_eq!(ctlz(0i128), 128); - - assert_eq!(ctlz(1u8), 7); assert_eq!(ctlz(1i8), 7); - assert_eq!(ctlz(1u16), 15); assert_eq!(ctlz(1i16), 15); - assert_eq!(ctlz(1u32), 31); assert_eq!(ctlz(1i32), 31); - assert_eq!(ctlz(1u64), 63); assert_eq!(ctlz(1i64), 63); - assert_eq!(ctlz(1u128), 127); assert_eq!(ctlz(1i128), 127); - - assert_eq!(ctlz(10u8), 4); assert_eq!(ctlz(10i8), 4); - assert_eq!(ctlz(10u16), 12); assert_eq!(ctlz(10i16), 12); - assert_eq!(ctlz(10u32), 28); assert_eq!(ctlz(10i32), 28); - assert_eq!(ctlz(10u64), 60); assert_eq!(ctlz(10i64), 60); - assert_eq!(ctlz(10u128), 124); assert_eq!(ctlz(10i128), 124); - - assert_eq!(ctlz(100u8), 1); assert_eq!(ctlz(100i8), 1); - assert_eq!(ctlz(100u16), 9); assert_eq!(ctlz(100i16), 9); - assert_eq!(ctlz(100u32), 25); assert_eq!(ctlz(100i32), 25); - assert_eq!(ctlz(100u64), 57); assert_eq!(ctlz(100i64), 57); - assert_eq!(ctlz(100u128), 121); assert_eq!(ctlz(100i128), 121); + use rusti::*; + + assert_eq!(ctpop(0u8), 0); assert_eq!(ctpop(0i8), 0); + assert_eq!(ctpop(0u16), 0); assert_eq!(ctpop(0i16), 0); + assert_eq!(ctpop(0u32), 0); assert_eq!(ctpop(0i32), 0); + assert_eq!(ctpop(0u64), 0); assert_eq!(ctpop(0i64), 0); + assert_eq!(ctpop(0u128), 0); assert_eq!(ctpop(0i128), 0); + + assert_eq!(ctpop(1u8), 1); assert_eq!(ctpop(1i8), 1); + assert_eq!(ctpop(1u16), 1); assert_eq!(ctpop(1i16), 1); + assert_eq!(ctpop(1u32), 1); assert_eq!(ctpop(1i32), 1); + assert_eq!(ctpop(1u64), 1); assert_eq!(ctpop(1i64), 1); + assert_eq!(ctpop(1u128), 1); assert_eq!(ctpop(1i128), 1); + + assert_eq!(ctpop(10u8), 2); assert_eq!(ctpop(10i8), 2); + assert_eq!(ctpop(10u16), 2); assert_eq!(ctpop(10i16), 2); + assert_eq!(ctpop(10u32), 2); assert_eq!(ctpop(10i32), 2); + assert_eq!(ctpop(10u64), 2); assert_eq!(ctpop(10i64), 2); + assert_eq!(ctpop(10u128), 2); assert_eq!(ctpop(10i128), 2); + + assert_eq!(ctpop(100u8), 3); assert_eq!(ctpop(100i8), 3); + assert_eq!(ctpop(100u16), 3); assert_eq!(ctpop(100i16), 3); + assert_eq!(ctpop(100u32), 3); assert_eq!(ctpop(100i32), 3); + assert_eq!(ctpop(100u64), 3); assert_eq!(ctpop(100i64), 3); + assert_eq!(ctpop(100u128), 3); assert_eq!(ctpop(100i128), 3); + + assert_eq!(ctpop(-1i8 as u8), 8); assert_eq!(ctpop(-1i8), 8); + assert_eq!(ctpop(-1i16 as u16), 16); assert_eq!(ctpop(-1i16), 16); + assert_eq!(ctpop(-1i32 as u32), 32); assert_eq!(ctpop(-1i32), 32); + assert_eq!(ctpop(-1i64 as u64), 64); assert_eq!(ctpop(-1i64), 64); + assert_eq!(ctpop(-1i128 as u128), 128); assert_eq!(ctpop(-1i128), 128); + + assert_eq!(ctlz(0u8), 8); assert_eq!(ctlz(0i8), 8); + assert_eq!(ctlz(0u16), 16); assert_eq!(ctlz(0i16), 16); + assert_eq!(ctlz(0u32), 32); assert_eq!(ctlz(0i32), 32); + assert_eq!(ctlz(0u64), 64); assert_eq!(ctlz(0i64), 64); + assert_eq!(ctlz(0u128), 128); assert_eq!(ctlz(0i128), 128); + + assert_eq!(ctlz(1u8), 7); assert_eq!(ctlz(1i8), 7); + assert_eq!(ctlz(1u16), 15); assert_eq!(ctlz(1i16), 15); + assert_eq!(ctlz(1u32), 31); assert_eq!(ctlz(1i32), 31); + assert_eq!(ctlz(1u64), 63); assert_eq!(ctlz(1i64), 63); + assert_eq!(ctlz(1u128), 127); assert_eq!(ctlz(1i128), 127); + + assert_eq!(ctlz(10u8), 4); assert_eq!(ctlz(10i8), 4); + assert_eq!(ctlz(10u16), 12); assert_eq!(ctlz(10i16), 12); + assert_eq!(ctlz(10u32), 28); assert_eq!(ctlz(10i32), 28); + assert_eq!(ctlz(10u64), 60); assert_eq!(ctlz(10i64), 60); + assert_eq!(ctlz(10u128), 124); assert_eq!(ctlz(10i128), 124); + + assert_eq!(ctlz(100u8), 1); assert_eq!(ctlz(100i8), 1); + assert_eq!(ctlz(100u16), 9); assert_eq!(ctlz(100i16), 9); + assert_eq!(ctlz(100u32), 25); assert_eq!(ctlz(100i32), 25); + assert_eq!(ctlz(100u64), 57); assert_eq!(ctlz(100i64), 57); + assert_eq!(ctlz(100u128), 121); assert_eq!(ctlz(100i128), 121); + unsafe { assert_eq!(ctlz_nonzero(1u8), 7); assert_eq!(ctlz_nonzero(1i8), 7); assert_eq!(ctlz_nonzero(1u16), 15); assert_eq!(ctlz_nonzero(1i16), 15); assert_eq!(ctlz_nonzero(1u32), 31); assert_eq!(ctlz_nonzero(1i32), 31); @@ -100,37 +90,39 @@ pub fn main() { assert_eq!(ctlz_nonzero(100u32), 25); assert_eq!(ctlz_nonzero(100i32), 25); assert_eq!(ctlz_nonzero(100u64), 57); assert_eq!(ctlz_nonzero(100i64), 57); assert_eq!(ctlz_nonzero(100u128), 121); assert_eq!(ctlz_nonzero(100i128), 121); + } - assert_eq!(cttz(-1i8 as u8), 0); assert_eq!(cttz(-1i8), 0); - assert_eq!(cttz(-1i16 as u16), 0); assert_eq!(cttz(-1i16), 0); - assert_eq!(cttz(-1i32 as u32), 0); assert_eq!(cttz(-1i32), 0); - assert_eq!(cttz(-1i64 as u64), 0); assert_eq!(cttz(-1i64), 0); - assert_eq!(cttz(-1i128 as u128), 0); assert_eq!(cttz(-1i128), 0); - - assert_eq!(cttz(0u8), 8); assert_eq!(cttz(0i8), 8); - assert_eq!(cttz(0u16), 16); assert_eq!(cttz(0i16), 16); - assert_eq!(cttz(0u32), 32); assert_eq!(cttz(0i32), 32); - assert_eq!(cttz(0u64), 64); assert_eq!(cttz(0i64), 64); - assert_eq!(cttz(0u128), 128); assert_eq!(cttz(0i128), 128); - - assert_eq!(cttz(1u8), 0); assert_eq!(cttz(1i8), 0); - assert_eq!(cttz(1u16), 0); assert_eq!(cttz(1i16), 0); - assert_eq!(cttz(1u32), 0); assert_eq!(cttz(1i32), 0); - assert_eq!(cttz(1u64), 0); assert_eq!(cttz(1i64), 0); - assert_eq!(cttz(1u128), 0); assert_eq!(cttz(1i128), 0); - - assert_eq!(cttz(10u8), 1); assert_eq!(cttz(10i8), 1); - assert_eq!(cttz(10u16), 1); assert_eq!(cttz(10i16), 1); - assert_eq!(cttz(10u32), 1); assert_eq!(cttz(10i32), 1); - assert_eq!(cttz(10u64), 1); assert_eq!(cttz(10i64), 1); - assert_eq!(cttz(10u128), 1); assert_eq!(cttz(10i128), 1); - - assert_eq!(cttz(100u8), 2); assert_eq!(cttz(100i8), 2); - assert_eq!(cttz(100u16), 2); assert_eq!(cttz(100i16), 2); - assert_eq!(cttz(100u32), 2); assert_eq!(cttz(100i32), 2); - assert_eq!(cttz(100u64), 2); assert_eq!(cttz(100i64), 2); - assert_eq!(cttz(100u128), 2); assert_eq!(cttz(100i128), 2); + assert_eq!(cttz(-1i8 as u8), 0); assert_eq!(cttz(-1i8), 0); + assert_eq!(cttz(-1i16 as u16), 0); assert_eq!(cttz(-1i16), 0); + assert_eq!(cttz(-1i32 as u32), 0); assert_eq!(cttz(-1i32), 0); + assert_eq!(cttz(-1i64 as u64), 0); assert_eq!(cttz(-1i64), 0); + assert_eq!(cttz(-1i128 as u128), 0); assert_eq!(cttz(-1i128), 0); + + assert_eq!(cttz(0u8), 8); assert_eq!(cttz(0i8), 8); + assert_eq!(cttz(0u16), 16); assert_eq!(cttz(0i16), 16); + assert_eq!(cttz(0u32), 32); assert_eq!(cttz(0i32), 32); + assert_eq!(cttz(0u64), 64); assert_eq!(cttz(0i64), 64); + assert_eq!(cttz(0u128), 128); assert_eq!(cttz(0i128), 128); + + assert_eq!(cttz(1u8), 0); assert_eq!(cttz(1i8), 0); + assert_eq!(cttz(1u16), 0); assert_eq!(cttz(1i16), 0); + assert_eq!(cttz(1u32), 0); assert_eq!(cttz(1i32), 0); + assert_eq!(cttz(1u64), 0); assert_eq!(cttz(1i64), 0); + assert_eq!(cttz(1u128), 0); assert_eq!(cttz(1i128), 0); + + assert_eq!(cttz(10u8), 1); assert_eq!(cttz(10i8), 1); + assert_eq!(cttz(10u16), 1); assert_eq!(cttz(10i16), 1); + assert_eq!(cttz(10u32), 1); assert_eq!(cttz(10i32), 1); + assert_eq!(cttz(10u64), 1); assert_eq!(cttz(10i64), 1); + assert_eq!(cttz(10u128), 1); assert_eq!(cttz(10i128), 1); + + assert_eq!(cttz(100u8), 2); assert_eq!(cttz(100i8), 2); + assert_eq!(cttz(100u16), 2); assert_eq!(cttz(100i16), 2); + assert_eq!(cttz(100u32), 2); assert_eq!(cttz(100i32), 2); + assert_eq!(cttz(100u64), 2); assert_eq!(cttz(100i64), 2); + assert_eq!(cttz(100u128), 2); assert_eq!(cttz(100i128), 2); + unsafe { assert_eq!(cttz_nonzero(-1i8 as u8), 0); assert_eq!(cttz_nonzero(-1i8), 0); assert_eq!(cttz_nonzero(-1i16 as u16), 0); assert_eq!(cttz_nonzero(-1i16), 0); assert_eq!(cttz_nonzero(-1i32 as u32), 0); assert_eq!(cttz_nonzero(-1i32), 0); @@ -154,27 +146,27 @@ pub fn main() { assert_eq!(cttz_nonzero(100u32), 2); assert_eq!(cttz_nonzero(100i32), 2); assert_eq!(cttz_nonzero(100u64), 2); assert_eq!(cttz_nonzero(100i64), 2); assert_eq!(cttz_nonzero(100u128), 2); assert_eq!(cttz_nonzero(100i128), 2); - - assert_eq!(bswap(0x0Au8), 0x0A); // no-op - assert_eq!(bswap(0x0Ai8), 0x0A); // no-op - assert_eq!(bswap(0x0A0Bu16), 0x0B0A); - assert_eq!(bswap(0x0A0Bi16), 0x0B0A); - assert_eq!(bswap(0x0ABBCC0Du32), 0x0DCCBB0A); - assert_eq!(bswap(0x0ABBCC0Di32), 0x0DCCBB0A); - assert_eq!(bswap(0x0122334455667708u64), 0x0877665544332201); - assert_eq!(bswap(0x0122334455667708i64), 0x0877665544332201); - assert_eq!(bswap(0x0122334455667708u128), 0x08776655443322010000000000000000); - assert_eq!(bswap(0x0122334455667708i128), 0x08776655443322010000000000000000); - - assert_eq!(bitreverse(0x0Au8), 0x50); - assert_eq!(bitreverse(0x0Ai8), 0x50); - assert_eq!(bitreverse(0x0A0Cu16), 0x3050); - assert_eq!(bitreverse(0x0A0Ci16), 0x3050); - assert_eq!(bitreverse(0x0ABBCC0Eu32), 0x7033DD50); - assert_eq!(bitreverse(0x0ABBCC0Ei32), 0x7033DD50); - assert_eq!(bitreverse(0x0122334455667708u64), 0x10EE66AA22CC4480); - assert_eq!(bitreverse(0x0122334455667708i64), 0x10EE66AA22CC4480); - assert_eq!(bitreverse(0x0122334455667708u128), 0x10EE66AA22CC44800000000000000000); - assert_eq!(bitreverse(0x0122334455667708i128), 0x10EE66AA22CC44800000000000000000); } + + assert_eq!(bswap(0x0Au8), 0x0A); // no-op + assert_eq!(bswap(0x0Ai8), 0x0A); // no-op + assert_eq!(bswap(0x0A0Bu16), 0x0B0A); + assert_eq!(bswap(0x0A0Bi16), 0x0B0A); + assert_eq!(bswap(0x0ABBCC0Du32), 0x0DCCBB0A); + assert_eq!(bswap(0x0ABBCC0Di32), 0x0DCCBB0A); + assert_eq!(bswap(0x0122334455667708u64), 0x0877665544332201); + assert_eq!(bswap(0x0122334455667708i64), 0x0877665544332201); + assert_eq!(bswap(0x0122334455667708u128), 0x08776655443322010000000000000000); + assert_eq!(bswap(0x0122334455667708i128), 0x08776655443322010000000000000000); + + assert_eq!(bitreverse(0x0Au8), 0x50); + assert_eq!(bitreverse(0x0Ai8), 0x50); + assert_eq!(bitreverse(0x0A0Cu16), 0x3050); + assert_eq!(bitreverse(0x0A0Ci16), 0x3050); + assert_eq!(bitreverse(0x0ABBCC0Eu32), 0x7033DD50); + assert_eq!(bitreverse(0x0ABBCC0Ei32), 0x7033DD50); + assert_eq!(bitreverse(0x0122334455667708u64), 0x10EE66AA22CC4480); + assert_eq!(bitreverse(0x0122334455667708i64), 0x10EE66AA22CC4480); + assert_eq!(bitreverse(0x0122334455667708u128), 0x10EE66AA22CC44800000000000000000); + assert_eq!(bitreverse(0x0122334455667708i128), 0x10EE66AA22CC44800000000000000000); } diff --git a/src/test/run-pass/intrinsics/intrinsics-math.rs b/src/test/run-pass/intrinsics/intrinsics-math.rs index d08386beb9e..aea9fde6915 100644 --- a/src/test/run-pass/intrinsics/intrinsics-math.rs +++ b/src/test/run-pass/intrinsics/intrinsics-math.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten fma not implemented in emscripten diff --git a/src/test/run-pass/invalid_const_promotion.rs b/src/test/run-pass/invalid_const_promotion.rs index 0f354e1aad6..1524373895d 100644 --- a/src/test/run-pass/invalid_const_promotion.rs +++ b/src/test/run-pass/invalid_const_promotion.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_mut)] // ignore-wasm32 // ignore-emscripten @@ -15,7 +5,7 @@ // compile-flags: -C debug_assertions=yes #![stable(feature = "rustc", since = "1.0.0")] -#![feature(const_fn, libc, staged_api, rustc_attrs)] +#![feature(const_fn, rustc_private, staged_api, rustc_attrs)] #![allow(const_err)] extern crate libc; diff --git a/src/test/run-pass/invoke-external-foreign.rs b/src/test/run-pass/invoke-external-foreign.rs index d01c3b67895..d34933cde42 100644 --- a/src/test/run-pass/invoke-external-foreign.rs +++ b/src/test/run-pass/invoke-external-foreign.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:foreign_lib.rs // ignore-wasm32-bare no libc to test ffi with diff --git a/src/test/run-pass/irrefutable-unit.rs b/src/test/run-pass/irrefutable-unit.rs index 0c2fbb01f48..f588ae3a557 100644 --- a/src/test/run-pass/irrefutable-unit.rs +++ b/src/test/run-pass/irrefutable-unit.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 pub fn main() { diff --git a/src/test/run-pass/issue-18952.rs b/src/test/run-pass/issue-18952.rs new file mode 100644 index 00000000000..56378b59e36 --- /dev/null +++ b/src/test/run-pass/issue-18952.rs @@ -0,0 +1,56 @@ +// This issue tests fn_traits overloading on arity. +// run-pass + +#![feature(fn_traits)] +#![feature(unboxed_closures)] + +struct Foo; + +impl Fn<(isize, isize)> for Foo { + extern "rust-call" fn call(&self, args: (isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 1, args.1 + 1) + } +} + +impl FnMut<(isize, isize)> for Foo { + extern "rust-call" fn call_mut(&mut self, args: (isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 1, args.1 + 1) + } +} + +impl FnOnce<(isize, isize)> for Foo { + type Output = (isize, isize); + extern "rust-call" fn call_once(self, args: (isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 1, args.1 + 1) + } +} + +impl Fn<(isize, isize, isize)> for Foo { + extern "rust-call" fn call(&self, args: (isize, isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 3, args.1 + 3, args.2 + 3) + } +} + +impl FnMut<(isize, isize, isize)> for Foo { + extern "rust-call" fn call_mut(&mut self, args: (isize, isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 3, args.1 + 3, args.2 + 3) + } +} +impl FnOnce<(isize, isize, isize)> for Foo { + type Output = (isize, isize, isize); + extern "rust-call" fn call_once(self, args: (isize, isize, isize)) -> Self::Output { + println!("{:?}", args); + (args.0 + 3, args.1 + 3, args.2 + 3) + } +} + +fn main() { + let foo = Foo; + assert_eq!(foo(1, 1), (2, 2)); + assert_eq!(foo(1, 1, 1), (4, 4, 4)); +} diff --git a/src/test/run-pass/issue-45510.rs b/src/test/run-pass/issue-45510.rs new file mode 100644 index 00000000000..9e104ce6c4f --- /dev/null +++ b/src/test/run-pass/issue-45510.rs @@ -0,0 +1,32 @@ +// Test overloaded resolution of fn_traits. +// run-pass + +#![feature(fn_traits)] +#![feature(unboxed_closures)] + +#[derive(Debug, PartialEq, Eq)] +struct Ishmael; +#[derive(Debug, PartialEq, Eq)] +struct Maybe; +struct CallMe; + +impl FnOnce<(Ishmael,)> for CallMe { + type Output = Ishmael; + extern "rust-call" fn call_once(self, _args: (Ishmael,)) -> Ishmael { + println!("Split your lungs with blood and thunder!"); + Ishmael + } +} + +impl FnOnce<(Maybe,)> for CallMe { + type Output = Maybe; + extern "rust-call" fn call_once(self, _args: (Maybe,)) -> Maybe { + println!("So we just met, and this is crazy"); + Maybe + } +} + +fn main() { + assert_eq!(CallMe(Ishmael), Ishmael); + assert_eq!(CallMe(Maybe), Maybe); +} diff --git a/src/test/run-pass/issue-48006.rs b/src/test/run-pass/issue-48006.rs index d5887bb64cd..8e7105cf10c 100644 --- a/src/test/run-pass/issue-48006.rs +++ b/src/test/run-pass/issue-48006.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(step_trait)] use std::iter::Step; diff --git a/src/test/run-pass/issue-53728.rs b/src/test/run-pass/issue-53728.rs index 2eaa73ed6f7..00666972e25 100644 --- a/src/test/run-pass/issue-53728.rs +++ b/src/test/run-pass/issue-53728.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #[repr(u16)] enum DeviceKind { diff --git a/src/test/run-pass/issue-53843.rs b/src/test/run-pass/issue-53843.rs new file mode 100644 index 00000000000..53728ec4d9f --- /dev/null +++ b/src/test/run-pass/issue-53843.rs @@ -0,0 +1,24 @@ +use std::ops::Deref; + +pub struct Pin

(P); + +impl Deref for Pin

+where + P: Deref, +{ + type Target = T; + + fn deref(&self) -> &T { + &*self.0 + } +} + +impl

Pin

{ + fn poll(self) {} +} + +fn main() { + let mut unit = (); + let pin = Pin(&mut unit); + pin.poll(); +} diff --git a/src/test/run-pass/issue-54462-mutable-noalias-correctness.rs b/src/test/run-pass/issue-54462-mutable-noalias-correctness.rs index f0e52b29287..e7966b2978f 100644 --- a/src/test/run-pass/issue-54462-mutable-noalias-correctness.rs +++ b/src/test/run-pass/issue-54462-mutable-noalias-correctness.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // compile-flags: -Ccodegen-units=1 -O diff --git a/src/test/run-pass/issue-54467.rs b/src/test/run-pass/issue-54467.rs index 4fc44952e3a..52a9828b548 100644 --- a/src/test/run-pass/issue-54467.rs +++ b/src/test/run-pass/issue-54467.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Stream { type Item; type Error; diff --git a/src/test/run-pass/issue-55376.rs b/src/test/run-pass/issue-55376.rs index 9c7256fd26f..fa92a85a445 100644 --- a/src/test/run-pass/issue-55376.rs +++ b/src/test/run-pass/issue-55376.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that paths in `pub(...)` don't fail HIR verification. #![allow(unused_imports)] diff --git a/src/test/run-pass/issue-55380.rs b/src/test/run-pass/issue-55380.rs new file mode 100644 index 00000000000..862218e2192 --- /dev/null +++ b/src/test/run-pass/issue-55380.rs @@ -0,0 +1,28 @@ +// run-pass + +#![feature(specialization)] + +pub trait Foo { + fn abc() -> u32; + fn def() -> u32; +} + +pub trait Marker {} + +impl Marker for () {} + +impl Foo for T { + default fn abc() -> u32 { 16 } + default fn def() -> u32 { 42 } +} + +impl Foo for T { + fn def() -> u32 { + Self::abc() + } +} + +fn main() { + assert_eq!(<()>::def(), 16); + assert_eq!(::def(), 42); +} diff --git a/src/test/run-pass/issue-56237.rs b/src/test/run-pass/issue-56237.rs new file mode 100644 index 00000000000..87e10e83612 --- /dev/null +++ b/src/test/run-pass/issue-56237.rs @@ -0,0 +1,11 @@ +use std::ops::Deref; + +fn foo

(_value:

::Target) +where + P: Deref, +

::Target: Sized, +{} + +fn main() { + foo::>(2); +} diff --git a/src/test/run-pass/issues/auxiliary/cgu_test.rs b/src/test/run-pass/issues/auxiliary/cgu_test.rs index 7c88d3d37e3..5ed973164a1 100644 --- a/src/test/run-pass/issues/auxiliary/cgu_test.rs +++ b/src/test/run-pass/issues/auxiliary/cgu_test.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // compile-flags: --crate-type=lib diff --git a/src/test/run-pass/issues/auxiliary/cgu_test_a.rs b/src/test/run-pass/issues/auxiliary/cgu_test_a.rs index 0f0d1cd87e1..a3dcd92012e 100644 --- a/src/test/run-pass/issues/auxiliary/cgu_test_a.rs +++ b/src/test/run-pass/issues/auxiliary/cgu_test_a.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // compile-flags: -Ccodegen-units=2 --crate-type=lib diff --git a/src/test/run-pass/issues/auxiliary/cgu_test_b.rs b/src/test/run-pass/issues/auxiliary/cgu_test_b.rs index 0f0d1cd87e1..a3dcd92012e 100644 --- a/src/test/run-pass/issues/auxiliary/cgu_test_b.rs +++ b/src/test/run-pass/issues/auxiliary/cgu_test_b.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // compile-flags: -Ccodegen-units=2 --crate-type=lib diff --git a/src/test/run-pass/issues/auxiliary/i8.rs b/src/test/run-pass/issues/auxiliary/i8.rs index 44e62b99a96..889a9c4ebb1 100644 --- a/src/test/run-pass/issues/auxiliary/i8.rs +++ b/src/test/run-pass/issues/auxiliary/i8.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A crate named after a built-in type. pub struct Test; diff --git a/src/test/run-pass/issues/auxiliary/iss.rs b/src/test/run-pass/issues/auxiliary/iss.rs index b231efa0fec..cf32f6c2d5d 100644 --- a/src/test/run-pass/issues/auxiliary/iss.rs +++ b/src/test/run-pass/issues/auxiliary/iss.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="issue6919_3"] // part of issue-6919.rs diff --git a/src/test/run-pass/issues/auxiliary/issue-10028.rs b/src/test/run-pass/issues/auxiliary/issue-10028.rs index ed42ad6e875..135f26f4047 100644 --- a/src/test/run-pass/issues/auxiliary/issue-10028.rs +++ b/src/test/run-pass/issues/auxiliary/issue-10028.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct ZeroLengthThingWithDestructor; impl Drop for ZeroLengthThingWithDestructor { fn drop(&mut self) {} diff --git a/src/test/run-pass/issues/auxiliary/issue-11224.rs b/src/test/run-pass/issues/auxiliary/issue-11224.rs index 15b72b37781..63543621a80 100644 --- a/src/test/run-pass/issues/auxiliary/issue-11224.rs +++ b/src/test/run-pass/issues/auxiliary/issue-11224.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(dead_code)] mod inner { diff --git a/src/test/run-pass/issues/auxiliary/issue-11225-1.rs b/src/test/run-pass/issues/auxiliary/issue-11225-1.rs index e1ec15be927..2c6f899a0f4 100644 --- a/src/test/run-pass/issues/auxiliary/issue-11225-1.rs +++ b/src/test/run-pass/issues/auxiliary/issue-11225-1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod inner { pub trait Trait { fn f(&self) { f(); } diff --git a/src/test/run-pass/issues/auxiliary/issue-11225-2.rs b/src/test/run-pass/issues/auxiliary/issue-11225-2.rs index 25110edda27..4381f0a4edf 100644 --- a/src/test/run-pass/issues/auxiliary/issue-11225-2.rs +++ b/src/test/run-pass/issues/auxiliary/issue-11225-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use inner::Trait; mod inner { diff --git a/src/test/run-pass/issues/auxiliary/issue-11225-3.rs b/src/test/run-pass/issues/auxiliary/issue-11225-3.rs index d48fb68ba0f..266e42a10b5 100644 --- a/src/test/run-pass/issues/auxiliary/issue-11225-3.rs +++ b/src/test/run-pass/issues/auxiliary/issue-11225-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait PrivateTrait { fn private_trait_method(&self); fn private_trait_method_ufcs(&self); diff --git a/src/test/run-pass/issues/auxiliary/issue-11508.rs b/src/test/run-pass/issues/auxiliary/issue-11508.rs index c5dc3439f2f..16bfc65c2b5 100644 --- a/src/test/run-pass/issues/auxiliary/issue-11508.rs +++ b/src/test/run-pass/issues/auxiliary/issue-11508.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Closed01(pub F); pub trait Bar { fn new() -> Self; } diff --git a/src/test/run-pass/issues/auxiliary/issue-11529.rs b/src/test/run-pass/issues/auxiliary/issue-11529.rs index 21ef99e3c3d..dd3ef438705 100644 --- a/src/test/run-pass/issues/auxiliary/issue-11529.rs +++ b/src/test/run-pass/issues/auxiliary/issue-11529.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct A<'a>(pub &'a isize); diff --git a/src/test/run-pass/issues/auxiliary/issue-12133-dylib.rs b/src/test/run-pass/issues/auxiliary/issue-12133-dylib.rs index ea22258f67d..8bd2b3353b8 100644 --- a/src/test/run-pass/issues/auxiliary/issue-12133-dylib.rs +++ b/src/test/run-pass/issues/auxiliary/issue-12133-dylib.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-12133-dylib2.rs b/src/test/run-pass/issues/auxiliary/issue-12133-dylib2.rs index fa5722ae6a3..30de7400600 100644 --- a/src/test/run-pass/issues/auxiliary/issue-12133-dylib2.rs +++ b/src/test/run-pass/issues/auxiliary/issue-12133-dylib2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "dylib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-12133-rlib.rs b/src/test/run-pass/issues/auxiliary/issue-12133-rlib.rs index 8e46acca124..39c261e1162 100644 --- a/src/test/run-pass/issues/auxiliary/issue-12133-rlib.rs +++ b/src/test/run-pass/issues/auxiliary/issue-12133-rlib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-12660-aux.rs b/src/test/run-pass/issues/auxiliary/issue-12660-aux.rs index 9f2bd5d0e93..6dea8662dfe 100644 --- a/src/test/run-pass/issues/auxiliary/issue-12660-aux.rs +++ b/src/test/run-pass/issues/auxiliary/issue-12660-aux.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] #![crate_name="issue12660aux"] diff --git a/src/test/run-pass/issues/auxiliary/issue-13620-1.rs b/src/test/run-pass/issues/auxiliary/issue-13620-1.rs index e373421fabf..1442c0cc7aa 100644 --- a/src/test/run-pass/issues/auxiliary/issue-13620-1.rs +++ b/src/test/run-pass/issues/auxiliary/issue-13620-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo { pub foo: extern fn() } diff --git a/src/test/run-pass/issues/auxiliary/issue-13620-2.rs b/src/test/run-pass/issues/auxiliary/issue-13620-2.rs index 554170bc130..7efd24407ba 100644 --- a/src/test/run-pass/issues/auxiliary/issue-13620-2.rs +++ b/src/test/run-pass/issues/auxiliary/issue-13620-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate issue_13620_1 as crate1; pub static FOO2: crate1::Foo = crate1::FOO; diff --git a/src/test/run-pass/issues/auxiliary/issue-13872-1.rs b/src/test/run-pass/issues/auxiliary/issue-13872-1.rs index 941b67eb2da..fa9258834c7 100644 --- a/src/test/run-pass/issues/auxiliary/issue-13872-1.rs +++ b/src/test/run-pass/issues/auxiliary/issue-13872-1.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum A { B } diff --git a/src/test/run-pass/issues/auxiliary/issue-13872-2.rs b/src/test/run-pass/issues/auxiliary/issue-13872-2.rs index bb51417528a..8c64f16e3f9 100644 --- a/src/test/run-pass/issues/auxiliary/issue-13872-2.rs +++ b/src/test/run-pass/issues/auxiliary/issue-13872-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate issue_13872_1 as foo; pub use foo::A::B; diff --git a/src/test/run-pass/issues/auxiliary/issue-13872-3.rs b/src/test/run-pass/issues/auxiliary/issue-13872-3.rs index e20618f1ec0..d31d52eb847 100644 --- a/src/test/run-pass/issues/auxiliary/issue-13872-3.rs +++ b/src/test/run-pass/issues/auxiliary/issue-13872-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate issue_13872_2 as bar; use bar::B; diff --git a/src/test/run-pass/issues/auxiliary/issue-14344-1.rs b/src/test/run-pass/issues/auxiliary/issue-14344-1.rs index 78c03bac33f..954a1e554da 100644 --- a/src/test/run-pass/issues/auxiliary/issue-14344-1.rs +++ b/src/test/run-pass/issues/auxiliary/issue-14344-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-14344-2.rs b/src/test/run-pass/issues/auxiliary/issue-14344-2.rs index 9df35e50adb..c47b8c0ea6c 100644 --- a/src/test/run-pass/issues/auxiliary/issue-14344-2.rs +++ b/src/test/run-pass/issues/auxiliary/issue-14344-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate issue_14344_1; pub fn bar() {} diff --git a/src/test/run-pass/issues/auxiliary/issue-14421.rs b/src/test/run-pass/issues/auxiliary/issue-14421.rs index a48088609f9..5fe4b24cf17 100644 --- a/src/test/run-pass/issues/auxiliary/issue-14421.rs +++ b/src/test/run-pass/issues/auxiliary/issue-14421.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] #![deny(warnings)] #![allow(dead_code)] diff --git a/src/test/run-pass/issues/auxiliary/issue-14422.rs b/src/test/run-pass/issues/auxiliary/issue-14422.rs index 32af6d9255e..a6026c1d03f 100644 --- a/src/test/run-pass/issues/auxiliary/issue-14422.rs +++ b/src/test/run-pass/issues/auxiliary/issue-14422.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] #![deny(warnings)] diff --git a/src/test/run-pass/issues/auxiliary/issue-15562.rs b/src/test/run-pass/issues/auxiliary/issue-15562.rs index 76243d3bced..d5afaaa5622 100644 --- a/src/test/run-pass/issues/auxiliary/issue-15562.rs +++ b/src/test/run-pass/issues/auxiliary/issue-15562.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] extern { diff --git a/src/test/run-pass/issues/auxiliary/issue-16643.rs b/src/test/run-pass/issues/auxiliary/issue-16643.rs index b590160a0c2..7808e0119f6 100644 --- a/src/test/run-pass/issues/auxiliary/issue-16643.rs +++ b/src/test/run-pass/issues/auxiliary/issue-16643.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub struct TreeBuilder { pub h: H } diff --git a/src/test/run-pass/issues/auxiliary/issue-17662.rs b/src/test/run-pass/issues/auxiliary/issue-17662.rs index fb55a077005..75efe110cdf 100644 --- a/src/test/run-pass/issues/auxiliary/issue-17662.rs +++ b/src/test/run-pass/issues/auxiliary/issue-17662.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub trait Foo<'a, T> { diff --git a/src/test/run-pass/issues/auxiliary/issue-17718-aux.rs b/src/test/run-pass/issues/auxiliary/issue-17718-aux.rs index 2bc8b4b7ba0..1cba9709f91 100644 --- a/src/test/run-pass/issues/auxiliary/issue-17718-aux.rs +++ b/src/test/run-pass/issues/auxiliary/issue-17718-aux.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::sync::atomic; pub const C1: usize = 1; diff --git a/src/test/run-pass/issues/auxiliary/issue-18501.rs b/src/test/run-pass/issues/auxiliary/issue-18501.rs index af3bc20378c..dd914b464fa 100644 --- a/src/test/run-pass/issues/auxiliary/issue-18501.rs +++ b/src/test/run-pass/issues/auxiliary/issue-18501.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] struct Foo; diff --git a/src/test/run-pass/issues/auxiliary/issue-18514.rs b/src/test/run-pass/issues/auxiliary/issue-18514.rs index 2a5e07a3285..20c8e60ee45 100644 --- a/src/test/run-pass/issues/auxiliary/issue-18514.rs +++ b/src/test/run-pass/issues/auxiliary/issue-18514.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub trait Tr { diff --git a/src/test/run-pass/issues/auxiliary/issue-18711.rs b/src/test/run-pass/issues/auxiliary/issue-18711.rs index c247c0223fc..5cb1f9c4371 100644 --- a/src/test/run-pass/issues/auxiliary/issue-18711.rs +++ b/src/test/run-pass/issues/auxiliary/issue-18711.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] pub fn inner(f: F) -> F { diff --git a/src/test/run-pass/issues/auxiliary/issue-18913-1.rs b/src/test/run-pass/issues/auxiliary/issue-18913-1.rs index 4315e27797f..053c5ada5ee 100644 --- a/src/test/run-pass/issues/auxiliary/issue-18913-1.rs +++ b/src/test/run-pass/issues/auxiliary/issue-18913-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-18913-2.rs b/src/test/run-pass/issues/auxiliary/issue-18913-2.rs index dcdeaec48f5..54747b45f52 100644 --- a/src/test/run-pass/issues/auxiliary/issue-18913-2.rs +++ b/src/test/run-pass/issues/auxiliary/issue-18913-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-19340-1.rs b/src/test/run-pass/issues/auxiliary/issue-19340-1.rs index fc61b78d8a7..39ee36b8b91 100644 --- a/src/test/run-pass/issues/auxiliary/issue-19340-1.rs +++ b/src/test/run-pass/issues/auxiliary/issue-19340-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum Homura { Madoka { name: String }, } diff --git a/src/test/run-pass/issues/auxiliary/issue-2380.rs b/src/test/run-pass/issues/auxiliary/issue-2380.rs index b3e0f061485..9a51a73c9a3 100644 --- a/src/test/run-pass/issues/auxiliary/issue-2380.rs +++ b/src/test/run-pass/issues/auxiliary/issue-2380.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="a"] #![crate_type = "lib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-2414-a.rs b/src/test/run-pass/issues/auxiliary/issue-2414-a.rs index 8c414193bd6..b90ab32ddc4 100644 --- a/src/test/run-pass/issues/auxiliary/issue-2414-a.rs +++ b/src/test/run-pass/issues/auxiliary/issue-2414-a.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="a"] #![crate_type = "lib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-2414-b.rs b/src/test/run-pass/issues/auxiliary/issue-2414-b.rs index b1c95bcb430..fc018349d80 100644 --- a/src/test/run-pass/issues/auxiliary/issue-2414-b.rs +++ b/src/test/run-pass/issues/auxiliary/issue-2414-b.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![crate_name="b"] #![crate_type = "lib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-25185-1.rs b/src/test/run-pass/issues/auxiliary/issue-25185-1.rs index b9da39cbbcb..77a4787ba94 100644 --- a/src/test/run-pass/issues/auxiliary/issue-25185-1.rs +++ b/src/test/run-pass/issues/auxiliary/issue-25185-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-25185-2.rs b/src/test/run-pass/issues/auxiliary/issue-25185-2.rs index 00b5277d6c0..7ce3df255a3 100644 --- a/src/test/run-pass/issues/auxiliary/issue-25185-2.rs +++ b/src/test/run-pass/issues/auxiliary/issue-25185-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate issue_25185_1; pub use issue_25185_1::rust_dbg_extern_identity_u32; diff --git a/src/test/run-pass/issues/auxiliary/issue-2526.rs b/src/test/run-pass/issues/auxiliary/issue-2526.rs index 3d777d01d50..3b27f658cda 100644 --- a/src/test/run-pass/issues/auxiliary/issue-2526.rs +++ b/src/test/run-pass/issues/auxiliary/issue-2526.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="issue_2526"] #![crate_type = "lib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-25467.rs b/src/test/run-pass/issues/auxiliary/issue-25467.rs index e358cde1573..ca9b3097c83 100644 --- a/src/test/run-pass/issues/auxiliary/issue-25467.rs +++ b/src/test/run-pass/issues/auxiliary/issue-25467.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub trait Trait { diff --git a/src/test/run-pass/issues/auxiliary/issue-2631-a.rs b/src/test/run-pass/issues/auxiliary/issue-2631-a.rs index 604a3e69a21..1e8211bfaa7 100644 --- a/src/test/run-pass/issues/auxiliary/issue-2631-a.rs +++ b/src/test/run-pass/issues/auxiliary/issue-2631-a.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="req"] #![crate_type = "lib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-29485.rs b/src/test/run-pass/issues/auxiliary/issue-29485.rs index 825c4497021..1e8891c5120 100644 --- a/src/test/run-pass/issues/auxiliary/issue-29485.rs +++ b/src/test/run-pass/issues/auxiliary/issue-29485.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="a"] #![crate_type = "lib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-3012-1.rs b/src/test/run-pass/issues/auxiliary/issue-3012-1.rs index f34a97519e7..509af2a8d7d 100644 --- a/src/test/run-pass/issues/auxiliary/issue-3012-1.rs +++ b/src/test/run-pass/issues/auxiliary/issue-3012-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="socketlib"] #![crate_type = "lib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-31702-1.rs b/src/test/run-pass/issues/auxiliary/issue-31702-1.rs new file mode 100644 index 00000000000..a48d0dc2c64 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-31702-1.rs @@ -0,0 +1,16 @@ +#[derive(Copy)] +pub struct U256(pub [u64; 4]); + +impl Clone for U256 { + fn clone(&self) -> U256 { + *self + } +} + +impl U256 { + pub fn new(value: u64) -> U256 { + let mut ret = [0; 4]; + ret[0] = value; + U256(ret) + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-31702-2.rs b/src/test/run-pass/issues/auxiliary/issue-31702-2.rs new file mode 100644 index 00000000000..d360ae0ca7e --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-31702-2.rs @@ -0,0 +1,20 @@ +// compile-flags: -g + +extern crate issue_31702_1; + +use std::collections::HashMap; +use issue_31702_1::U256; + +pub struct Ethash { + engine_params: fn() -> Option<&'static Vec>, + u256_params: HashMap, +} + +impl Ethash { + pub fn u256_param(&mut self, name: &str) -> U256 { + let engine = self.engine_params; + *self.u256_params.entry(name.to_owned()).or_insert_with(|| { + engine().map_or(U256::new(0u64), |_a| loop {}) + }) + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-36954.rs b/src/test/run-pass/issues/auxiliary/issue-36954.rs index e5eafa5a5d1..bc444a3817b 100644 --- a/src/test/run-pass/issues/auxiliary/issue-36954.rs +++ b/src/test/run-pass/issues/auxiliary/issue-36954.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] const fn foo(i: i32) -> i32 { diff --git a/src/test/run-pass/issues/auxiliary/issue-41394.rs b/src/test/run-pass/issues/auxiliary/issue-41394.rs index f06b81279ac..2e650efc714 100644 --- a/src/test/run-pass/issues/auxiliary/issue-41394.rs +++ b/src/test/run-pass/issues/auxiliary/issue-41394.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #[repr(u32)] diff --git a/src/test/run-pass/issues/auxiliary/issue-4208-cc.rs b/src/test/run-pass/issues/auxiliary/issue-4208-cc.rs index a7c1633784d..7b4c8b01a9e 100644 --- a/src/test/run-pass/issues/auxiliary/issue-4208-cc.rs +++ b/src/test/run-pass/issues/auxiliary/issue-4208-cc.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="numeric"] #![crate_type = "lib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-4545.rs b/src/test/run-pass/issues/auxiliary/issue-4545.rs index 29feeaa7d92..2f609475075 100644 --- a/src/test/run-pass/issues/auxiliary/issue-4545.rs +++ b/src/test/run-pass/issues/auxiliary/issue-4545.rs @@ -1,12 +1,2 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct S(Option); pub fn mk() -> S { S(None) } diff --git a/src/test/run-pass/issues/auxiliary/issue-48984-aux.rs b/src/test/run-pass/issues/auxiliary/issue-48984-aux.rs index 6290279701e..7cc888cd4cb 100644 --- a/src/test/run-pass/issues/auxiliary/issue-48984-aux.rs +++ b/src/test/run-pass/issues/auxiliary/issue-48984-aux.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #![crate_name = "issue48984aux"] diff --git a/src/test/run-pass/issues/auxiliary/issue-5518.rs b/src/test/run-pass/issues/auxiliary/issue-5518.rs index cea227e050f..bfe96552a5c 100644 --- a/src/test/run-pass/issues/auxiliary/issue-5518.rs +++ b/src/test/run-pass/issues/auxiliary/issue-5518.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait A<'a, T> { fn f(&mut self) -> &'a mut T; fn p() -> T; diff --git a/src/test/run-pass/issues/auxiliary/issue-5521.rs b/src/test/run-pass/issues/auxiliary/issue-5521.rs index 82bd2b64204..c2f81779b35 100644 --- a/src/test/run-pass/issues/auxiliary/issue-5521.rs +++ b/src/test/run-pass/issues/auxiliary/issue-5521.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::collections::HashMap; pub type map = Box>; diff --git a/src/test/run-pass/issues/auxiliary/issue-7178.rs b/src/test/run-pass/issues/auxiliary/issue-7178.rs index 18b464bd924..56ae5139af4 100644 --- a/src/test/run-pass/issues/auxiliary/issue-7178.rs +++ b/src/test/run-pass/issues/auxiliary/issue-7178.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo<'a, A:'a>(&'a A); impl<'a, A> Foo<'a, A> { diff --git a/src/test/run-pass/issues/auxiliary/issue-7899.rs b/src/test/run-pass/issues/auxiliary/issue-7899.rs index e197e84442b..3af6e871661 100644 --- a/src/test/run-pass/issues/auxiliary/issue-7899.rs +++ b/src/test/run-pass/issues/auxiliary/issue-7899.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct V2(pub T, pub T); diff --git a/src/test/run-pass/issues/auxiliary/issue-8044.rs b/src/test/run-pass/issues/auxiliary/issue-8044.rs index 8f328699ae0..2ec25f51cde 100644 --- a/src/test/run-pass/issues/auxiliary/issue-8044.rs +++ b/src/test/run-pass/issues/auxiliary/issue-8044.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct BTree { pub node: TreeItem, } diff --git a/src/test/run-pass/issues/auxiliary/issue-8259.rs b/src/test/run-pass/issues/auxiliary/issue-8259.rs index 91167e8e32b..891aee099dc 100644 --- a/src/test/run-pass/issues/auxiliary/issue-8259.rs +++ b/src/test/run-pass/issues/auxiliary/issue-8259.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub enum Foo<'a> { A, B(&'a str), diff --git a/src/test/run-pass/issues/auxiliary/issue-9906.rs b/src/test/run-pass/issues/auxiliary/issue-9906.rs index 5eb48985bf9..8a3eea790a2 100644 --- a/src/test/run-pass/issues/auxiliary/issue-9906.rs +++ b/src/test/run-pass/issues/auxiliary/issue-9906.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use other::FooBar; pub use other::foo; diff --git a/src/test/run-pass/issues/auxiliary/issue-9968.rs b/src/test/run-pass/issues/auxiliary/issue-9968.rs index d04d761e112..8d795b59ea8 100644 --- a/src/test/run-pass/issues/auxiliary/issue-9968.rs +++ b/src/test/run-pass/issues/auxiliary/issue-9968.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use internal::core::{Trait, Struct}; mod internal { diff --git a/src/test/run-pass/issues/auxiliary/issue13507.rs b/src/test/run-pass/issues/auxiliary/issue13507.rs index 87b01ed9900..c91013043eb 100644 --- a/src/test/run-pass/issues/auxiliary/issue13507.rs +++ b/src/test/run-pass/issues/auxiliary/issue13507.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod testtypes { use std::any::TypeId; diff --git a/src/test/run-pass/issues/auxiliary/issue2170lib.rs b/src/test/run-pass/issues/auxiliary/issue2170lib.rs index b311ee35674..a99385a834d 100644 --- a/src/test/run-pass/issues/auxiliary/issue2170lib.rs +++ b/src/test/run-pass/issues/auxiliary/issue2170lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(_x: i32) { } diff --git a/src/test/run-pass/issues/auxiliary/issue34796aux.rs b/src/test/run-pass/issues/auxiliary/issue34796aux.rs index 9131b609c4c..09c69b90329 100644 --- a/src/test/run-pass/issues/auxiliary/issue34796aux.rs +++ b/src/test/run-pass/issues/auxiliary/issue34796aux.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub trait Future { type Item; diff --git a/src/test/run-pass/issues/auxiliary/issue_10031_aux.rs b/src/test/run-pass/issues/auxiliary/issue_10031_aux.rs index f0f1af2e3a3..e2abeb99ea8 100644 --- a/src/test/run-pass/issues/auxiliary/issue_10031_aux.rs +++ b/src/test/run-pass/issues/auxiliary/issue_10031_aux.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Wrap(pub A); diff --git a/src/test/run-pass/issues/auxiliary/issue_12612_1.rs b/src/test/run-pass/issues/auxiliary/issue_12612_1.rs index a0234c1185a..01f5a784bb7 100644 --- a/src/test/run-pass/issues/auxiliary/issue_12612_1.rs +++ b/src/test/run-pass/issues/auxiliary/issue_12612_1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod bar { pub fn foo() {} } diff --git a/src/test/run-pass/issues/auxiliary/issue_12612_2.rs b/src/test/run-pass/issues/auxiliary/issue_12612_2.rs index b4ae4374b2e..2c724787193 100644 --- a/src/test/run-pass/issues/auxiliary/issue_12612_2.rs +++ b/src/test/run-pass/issues/auxiliary/issue_12612_2.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn baz() {} diff --git a/src/test/run-pass/issues/auxiliary/issue_19293.rs b/src/test/run-pass/issues/auxiliary/issue_19293.rs index 12894ad72e1..31359e86559 100644 --- a/src/test/run-pass/issues/auxiliary/issue_19293.rs +++ b/src/test/run-pass/issues/auxiliary/issue_19293.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo (pub isize); pub enum MyEnum { Foo(Foo), diff --git a/src/test/run-pass/issues/auxiliary/issue_20389.rs b/src/test/run-pass/issues/auxiliary/issue_20389.rs index 4ce7e3079e3..ae6d44eeb77 100644 --- a/src/test/run-pass/issues/auxiliary/issue_20389.rs +++ b/src/test/run-pass/issues/auxiliary/issue_20389.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait T { type C; fn dummy(&self) { } diff --git a/src/test/run-pass/issues/auxiliary/issue_2316_a.rs b/src/test/run-pass/issues/auxiliary/issue_2316_a.rs index 6bd1e7335ad..418ddc0b069 100644 --- a/src/test/run-pass/issues/auxiliary/issue_2316_a.rs +++ b/src/test/run-pass/issues/auxiliary/issue_2316_a.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum cat { tabby, calico, tortoiseshell } diff --git a/src/test/run-pass/issues/auxiliary/issue_2316_b.rs b/src/test/run-pass/issues/auxiliary/issue_2316_b.rs index 8a212f6e5a9..550c2d6eb22 100644 --- a/src/test/run-pass/issues/auxiliary/issue_2316_b.rs +++ b/src/test/run-pass/issues/auxiliary/issue_2316_b.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] extern crate issue_2316_a; diff --git a/src/test/run-pass/issues/auxiliary/issue_2472_b.rs b/src/test/run-pass/issues/auxiliary/issue_2472_b.rs index 5f55476427f..0d151520fe0 100644 --- a/src/test/run-pass/issues/auxiliary/issue_2472_b.rs +++ b/src/test/run-pass/issues/auxiliary/issue_2472_b.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub struct S(pub ()); impl S { diff --git a/src/test/run-pass/issues/auxiliary/issue_2723_a.rs b/src/test/run-pass/issues/auxiliary/issue_2723_a.rs index 44bea136a7c..661b46d829d 100644 --- a/src/test/run-pass/issues/auxiliary/issue_2723_a.rs +++ b/src/test/run-pass/issues/auxiliary/issue_2723_a.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub unsafe fn f(xs: Vec ) { xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::>(); } diff --git a/src/test/run-pass/issues/auxiliary/issue_3136_a.rc b/src/test/run-pass/issues/auxiliary/issue_3136_a.rc index 320e0ceed0f..46da4132b82 100644 --- a/src/test/run-pass/issues/auxiliary/issue_3136_a.rc +++ b/src/test/run-pass/issues/auxiliary/issue_3136_a.rc @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub mod issue_3136_a; diff --git a/src/test/run-pass/issues/auxiliary/issue_3136_a.rs b/src/test/run-pass/issues/auxiliary/issue_3136_a.rs index 55de208cc90..9bb546ab393 100644 --- a/src/test/run-pass/issues/auxiliary/issue_3136_a.rs +++ b/src/test/run-pass/issues/auxiliary/issue_3136_a.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait x { fn use_x(&self); } diff --git a/src/test/run-pass/issues/auxiliary/issue_38190.rs b/src/test/run-pass/issues/auxiliary/issue_38190.rs index 7fc4390d6dc..373e646ba2c 100644 --- a/src/test/run-pass/issues/auxiliary/issue_38190.rs +++ b/src/test/run-pass/issues/auxiliary/issue_38190.rs @@ -1,12 +1,2 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! m { ([$i:item]) => {} } diff --git a/src/test/run-pass/issues/auxiliary/issue_38226_aux.rs b/src/test/run-pass/issues/auxiliary/issue_38226_aux.rs index d48a9733685..f968017199f 100644 --- a/src/test/run-pass/issues/auxiliary/issue_38226_aux.rs +++ b/src/test/run-pass/issues/auxiliary/issue_38226_aux.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="rlib"] #[inline(never)] diff --git a/src/test/run-pass/issues/auxiliary/issue_38715-modern.rs b/src/test/run-pass/issues/auxiliary/issue_38715-modern.rs index 7f14b2c4659..15d072957cb 100644 --- a/src/test/run-pass/issues/auxiliary/issue_38715-modern.rs +++ b/src/test/run-pass/issues/auxiliary/issue_38715-modern.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(duplicate_macro_exports)] #[macro_export] diff --git a/src/test/run-pass/issues/auxiliary/issue_38715.rs b/src/test/run-pass/issues/auxiliary/issue_38715.rs index cf4fee0e515..5c15073f5a5 100644 --- a/src/test/run-pass/issues/auxiliary/issue_38715.rs +++ b/src/test/run-pass/issues/auxiliary/issue_38715.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(duplicate_macro_exports)] #[macro_export] diff --git a/src/test/run-pass/issues/auxiliary/issue_3979_traits.rs b/src/test/run-pass/issues/auxiliary/issue_3979_traits.rs index 46035731c30..5d03a0e9e99 100644 --- a/src/test/run-pass/issues/auxiliary/issue_3979_traits.rs +++ b/src/test/run-pass/issues/auxiliary/issue_3979_traits.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="issue_3979_traits"] #![crate_type = "lib"] diff --git a/src/test/run-pass/issues/auxiliary/issue_39823.rs b/src/test/run-pass/issues/auxiliary/issue_39823.rs index 5342601ac14..3af9c68f233 100644 --- a/src/test/run-pass/issues/auxiliary/issue_39823.rs +++ b/src/test/run-pass/issues/auxiliary/issue_39823.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="rlib"] #[derive(Debug, PartialEq)] diff --git a/src/test/run-pass/issues/auxiliary/issue_40469.rs b/src/test/run-pass/issues/auxiliary/issue_40469.rs index 4970bba431a..4f2f41f2cde 100644 --- a/src/test/run-pass/issues/auxiliary/issue_40469.rs +++ b/src/test/run-pass/issues/auxiliary/issue_40469.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! m { () => { $crate::main(); } } diff --git a/src/test/run-pass/issues/auxiliary/issue_41053.rs b/src/test/run-pass/issues/auxiliary/issue_41053.rs index 68e92b10429..ae73c3e780f 100644 --- a/src/test/run-pass/issues/auxiliary/issue_41053.rs +++ b/src/test/run-pass/issues/auxiliary/issue_41053.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Test; diff --git a/src/test/run-pass/issues/auxiliary/issue_42007_s.rs b/src/test/run-pass/issues/auxiliary/issue_42007_s.rs index 91ad9869ed8..95119a589c9 100644 --- a/src/test/run-pass/issues/auxiliary/issue_42007_s.rs +++ b/src/test/run-pass/issues/auxiliary/issue_42007_s.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[repr(u8)] pub enum E { B = 1 as u8, diff --git a/src/test/run-pass/issues/auxiliary/issue_8401.rs b/src/test/run-pass/issues/auxiliary/issue_8401.rs index 40e01c1474a..e35dbbfabfc 100644 --- a/src/test/run-pass/issues/auxiliary/issue_8401.rs +++ b/src/test/run-pass/issues/auxiliary/issue_8401.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // for this issue, this code must be built in a library use std::mem; diff --git a/src/test/run-pass/issues/auxiliary/issue_9123.rs b/src/test/run-pass/issues/auxiliary/issue_9123.rs index 8c2546e76cf..60af53359e8 100644 --- a/src/test/run-pass/issues/auxiliary/issue_9123.rs +++ b/src/test/run-pass/issues/auxiliary/issue_9123.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub trait X { diff --git a/src/test/run-pass/issues/auxiliary/issue_9155.rs b/src/test/run-pass/issues/auxiliary/issue_9155.rs index 486eb8fd6f6..049a96a655a 100644 --- a/src/test/run-pass/issues/auxiliary/issue_9155.rs +++ b/src/test/run-pass/issues/auxiliary/issue_9155.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo(T); impl Foo { diff --git a/src/test/run-pass/issues/auxiliary/issue_9188.rs b/src/test/run-pass/issues/auxiliary/issue_9188.rs index 8ff85cc359d..3bc5697a1a6 100644 --- a/src/test/run-pass/issues/auxiliary/issue_9188.rs +++ b/src/test/run-pass/issues/auxiliary/issue_9188.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() -> &'static isize { if false { static a: isize = 4; diff --git a/src/test/run-pass/issues/issue-10025.rs b/src/test/run-pass/issues/issue-10025.rs index 109663ac8ae..193d7ee891f 100644 --- a/src/test/run-pass/issues/issue-10025.rs +++ b/src/test/run-pass/issues/issue-10025.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-10028.rs b/src/test/run-pass/issues/issue-10028.rs index 2f7cbcde803..1692470e8d1 100644 --- a/src/test/run-pass/issues/issue-10028.rs +++ b/src/test/run-pass/issues/issue-10028.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:issue-10028.rs diff --git a/src/test/run-pass/issues/issue-10031.rs b/src/test/run-pass/issues/issue-10031.rs index 215760343f0..ba1fbac4845 100644 --- a/src/test/run-pass/issues/issue-10031.rs +++ b/src/test/run-pass/issues/issue-10031.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_10031_aux.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-10228.rs b/src/test/run-pass/issues/issue-10228.rs index 940b478c615..ebf8b436f13 100644 --- a/src/test/run-pass/issues/issue-10228.rs +++ b/src/test/run-pass/issues/issue-10228.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-10392.rs b/src/test/run-pass/issues/issue-10392.rs index 8042797f778..926fa94800e 100644 --- a/src/test/run-pass/issues/issue-10392.rs +++ b/src/test/run-pass/issues/issue-10392.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-10436.rs b/src/test/run-pass/issues/issue-10436.rs index f7f890d8188..a7a20bad517 100644 --- a/src/test/run-pass/issues/issue-10436.rs +++ b/src/test/run-pass/issues/issue-10436.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn works(x: T) -> Vec { vec![x] } diff --git a/src/test/run-pass/issues/issue-10626.rs b/src/test/run-pass/issues/issue-10626.rs index 75c2368d9da..9c10fd2cea6 100644 --- a/src/test/run-pass/issues/issue-10626.rs +++ b/src/test/run-pass/issues/issue-10626.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/issues/issue-10638.rs b/src/test/run-pass/issues/issue-10638.rs index 8648a54159f..e359669c00d 100644 --- a/src/test/run-pass/issues/issue-10638.rs +++ b/src/test/run-pass/issues/issue-10638.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-10682.rs b/src/test/run-pass/issues/issue-10682.rs index e7c23b393f0..afaa90f05ca 100644 --- a/src/test/run-pass/issues/issue-10682.rs +++ b/src/test/run-pass/issues/issue-10682.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for issue #10682 // Nested `proc` usage can't use outer owned data diff --git a/src/test/run-pass/issues/issue-10683.rs b/src/test/run-pass/issues/issue-10683.rs index f25072538ad..dcb221f8c57 100644 --- a/src/test/run-pass/issues/issue-10683.rs +++ b/src/test/run-pass/issues/issue-10683.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-10718.rs b/src/test/run-pass/issues/issue-10718.rs index 546c06d0451..a1de0cfe6ca 100644 --- a/src/test/run-pass/issues/issue-10718.rs +++ b/src/test/run-pass/issues/issue-10718.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-10734.rs b/src/test/run-pass/issues/issue-10734.rs index 6504cca474f..723e6ed22dd 100644 --- a/src/test/run-pass/issues/issue-10734.rs +++ b/src/test/run-pass/issues/issue-10734.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-10764.rs b/src/test/run-pass/issues/issue-10764.rs index 0d912ed467a..42ed1ae93b5 100644 --- a/src/test/run-pass/issues/issue-10764.rs +++ b/src/test/run-pass/issues/issue-10764.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-10767.rs b/src/test/run-pass/issues/issue-10767.rs index 58cb663a721..fa10f073b45 100644 --- a/src/test/run-pass/issues/issue-10767.rs +++ b/src/test/run-pass/issues/issue-10767.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-10802.rs b/src/test/run-pass/issues/issue-10802.rs index bd5d7059c21..8872eae6f8b 100644 --- a/src/test/run-pass/issues/issue-10802.rs +++ b/src/test/run-pass/issues/issue-10802.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-10806.rs b/src/test/run-pass/issues/issue-10806.rs index 6dfa0ecc291..2f1d7bb5aaf 100644 --- a/src/test/run-pass/issues/issue-10806.rs +++ b/src/test/run-pass/issues/issue-10806.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] diff --git a/src/test/run-pass/issues/issue-11047.rs b/src/test/run-pass/issues/issue-11047.rs index 6ff9367aed5..1fb2b5bb3a1 100644 --- a/src/test/run-pass/issues/issue-11047.rs +++ b/src/test/run-pass/issues/issue-11047.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that static methods can be invoked on `type` aliases diff --git a/src/test/run-pass/issues/issue-11085.rs b/src/test/run-pass/issues/issue-11085.rs index 50c87575773..47c03238b55 100644 --- a/src/test/run-pass/issues/issue-11085.rs +++ b/src/test/run-pass/issues/issue-11085.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // compile-flags: --cfg foo diff --git a/src/test/run-pass/issues/issue-1112.rs b/src/test/run-pass/issues/issue-1112.rs index 4283ae0fafb..3ba7bb21708 100644 --- a/src/test/run-pass/issues/issue-1112.rs +++ b/src/test/run-pass/issues/issue-1112.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Issue #1112 diff --git a/src/test/run-pass/issues/issue-11205.rs b/src/test/run-pass/issues/issue-11205.rs index bb7d1768f04..b628bf60196 100644 --- a/src/test/run-pass/issues/issue-11205.rs +++ b/src/test/run-pass/issues/issue-11205.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-11224.rs b/src/test/run-pass/issues/issue-11224.rs index 944983a2453..e1c1df99aca 100644 --- a/src/test/run-pass/issues/issue-11224.rs +++ b/src/test/run-pass/issues/issue-11224.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-11224.rs diff --git a/src/test/run-pass/issues/issue-11225-1.rs b/src/test/run-pass/issues/issue-11225-1.rs index 3c67d9cdd37..d1f2ea5e7de 100644 --- a/src/test/run-pass/issues/issue-11225-1.rs +++ b/src/test/run-pass/issues/issue-11225-1.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-11225-1.rs diff --git a/src/test/run-pass/issues/issue-11225-2.rs b/src/test/run-pass/issues/issue-11225-2.rs index 9e66e6e8672..d41c75443f1 100644 --- a/src/test/run-pass/issues/issue-11225-2.rs +++ b/src/test/run-pass/issues/issue-11225-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-11225-2.rs diff --git a/src/test/run-pass/issues/issue-11225-3.rs b/src/test/run-pass/issues/issue-11225-3.rs index d6e9b1378a0..e69496baa26 100644 --- a/src/test/run-pass/issues/issue-11225-3.rs +++ b/src/test/run-pass/issues/issue-11225-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-11225-3.rs diff --git a/src/test/run-pass/issues/issue-11267.rs b/src/test/run-pass/issues/issue-11267.rs index 37bf64c17eb..1aaeaa62ad0 100644 --- a/src/test/run-pass/issues/issue-11267.rs +++ b/src/test/run-pass/issues/issue-11267.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that unary structs can be mutably borrowed. diff --git a/src/test/run-pass/issues/issue-11382.rs b/src/test/run-pass/issues/issue-11382.rs index fc8f283fc8e..42a7a0d04a1 100644 --- a/src/test/run-pass/issues/issue-11382.rs +++ b/src/test/run-pass/issues/issue-11382.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { println!("{}", 1.2); diff --git a/src/test/run-pass/issues/issue-11508.rs b/src/test/run-pass/issues/issue-11508.rs index d5a1214ffa4..49868b73efa 100644 --- a/src/test/run-pass/issues/issue-11508.rs +++ b/src/test/run-pass/issues/issue-11508.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-11508.rs diff --git a/src/test/run-pass/issues/issue-11529.rs b/src/test/run-pass/issues/issue-11529.rs index e046956297d..9a6cc8e9fe8 100644 --- a/src/test/run-pass/issues/issue-11529.rs +++ b/src/test/run-pass/issues/issue-11529.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-11529.rs diff --git a/src/test/run-pass/issues/issue-11552.rs b/src/test/run-pass/issues/issue-11552.rs index 38dc58a2f12..bae12375da1 100644 --- a/src/test/run-pass/issues/issue-11552.rs +++ b/src/test/run-pass/issues/issue-11552.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-11577.rs b/src/test/run-pass/issues/issue-11577.rs index 1fee0d40206..70177c5ed0d 100644 --- a/src/test/run-pass/issues/issue-11577.rs +++ b/src/test/run-pass/issues/issue-11577.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Destructuring struct variants would ICE where regular structs wouldn't diff --git a/src/test/run-pass/issues/issue-11677.rs b/src/test/run-pass/issues/issue-11677.rs index d9bc76f9b03..5dabecc48f9 100644 --- a/src/test/run-pass/issues/issue-11677.rs +++ b/src/test/run-pass/issues/issue-11677.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] diff --git a/src/test/run-pass/issues/issue-11709.rs b/src/test/run-pass/issues/issue-11709.rs index 7f1669abe1c..f191a203f03 100644 --- a/src/test/run-pass/issues/issue-11709.rs +++ b/src/test/run-pass/issues/issue-11709.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // ignore-pretty issue #37199 diff --git a/src/test/run-pass/issues/issue-11820.rs b/src/test/run-pass/issues/issue-11820.rs index 4546529a902..7ffe9652797 100644 --- a/src/test/run-pass/issues/issue-11820.rs +++ b/src/test/run-pass/issues/issue-11820.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-11940.rs b/src/test/run-pass/issues/issue-11940.rs index 8f2dae938e0..6815c87edd8 100644 --- a/src/test/run-pass/issues/issue-11940.rs +++ b/src/test/run-pass/issues/issue-11940.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const TEST_STR: &'static str = "abcd"; diff --git a/src/test/run-pass/issues/issue-11958.rs b/src/test/run-pass/issues/issue-11958.rs index 6702aa38fd9..8fe8a8c6061 100644 --- a/src/test/run-pass/issues/issue-11958.rs +++ b/src/test/run-pass/issues/issue-11958.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![forbid(warnings)] diff --git a/src/test/run-pass/issues/issue-12033.rs b/src/test/run-pass/issues/issue-12033.rs index 214dfa5a446..9dc7573c9d3 100644 --- a/src/test/run-pass/issues/issue-12033.rs +++ b/src/test/run-pass/issues/issue-12033.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::cell::RefCell; diff --git a/src/test/run-pass/issues/issue-12133-1.rs b/src/test/run-pass/issues/issue-12133-1.rs index 7f896f6a6df..96ad5abd548 100644 --- a/src/test/run-pass/issues/issue-12133-1.rs +++ b/src/test/run-pass/issues/issue-12133-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-12133-rlib.rs // aux-build:issue-12133-dylib.rs diff --git a/src/test/run-pass/issues/issue-12133-2.rs b/src/test/run-pass/issues/issue-12133-2.rs index c2f12fda193..02fec65c2ed 100644 --- a/src/test/run-pass/issues/issue-12133-2.rs +++ b/src/test/run-pass/issues/issue-12133-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-12133-rlib.rs // aux-build:issue-12133-dylib.rs diff --git a/src/test/run-pass/issues/issue-12133-3.rs b/src/test/run-pass/issues/issue-12133-3.rs index 51c39f8f9c7..c87a37ab6b7 100644 --- a/src/test/run-pass/issues/issue-12133-3.rs +++ b/src/test/run-pass/issues/issue-12133-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-12133-rlib.rs // aux-build:issue-12133-dylib.rs diff --git a/src/test/run-pass/issues/issue-12285.rs b/src/test/run-pass/issues/issue-12285.rs index 6391f13d936..24ac5d2fbbf 100644 --- a/src/test/run-pass/issues/issue-12285.rs +++ b/src/test/run-pass/issues/issue-12285.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct S; diff --git a/src/test/run-pass/issues/issue-1257.rs b/src/test/run-pass/issues/issue-1257.rs index 8361151c24e..de5a6d35925 100644 --- a/src/test/run-pass/issues/issue-1257.rs +++ b/src/test/run-pass/issues/issue-1257.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-12582.rs b/src/test/run-pass/issues/issue-12582.rs index dd77e7287ca..f3366704e63 100644 --- a/src/test/run-pass/issues/issue-12582.rs +++ b/src/test/run-pass/issues/issue-12582.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/issues/issue-12612.rs b/src/test/run-pass/issues/issue-12612.rs index d9b563be2c0..158c2aed137 100644 --- a/src/test/run-pass/issues/issue-12612.rs +++ b/src/test/run-pass/issues/issue-12612.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // aux-build:issue_12612_1.rs diff --git a/src/test/run-pass/issues/issue-12660.rs b/src/test/run-pass/issues/issue-12660.rs index 2713543963e..44c492b43f0 100644 --- a/src/test/run-pass/issues/issue-12660.rs +++ b/src/test/run-pass/issues/issue-12660.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-12660-aux.rs diff --git a/src/test/run-pass/issues/issue-12677.rs b/src/test/run-pass/issues/issue-12677.rs index e4d29a59ba1..d0e4c17d4fa 100644 --- a/src/test/run-pass/issues/issue-12677.rs +++ b/src/test/run-pass/issues/issue-12677.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { diff --git a/src/test/run-pass/issues/issue-12699.rs b/src/test/run-pass/issues/issue-12699.rs index eaaa2364f68..b23853074fa 100644 --- a/src/test/run-pass/issues/issue-12699.rs +++ b/src/test/run-pass/issues/issue-12699.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare can't block the thread #![allow(deprecated)] diff --git a/src/test/run-pass/issues/issue-12744.rs b/src/test/run-pass/issues/issue-12744.rs index c0af7bdcbdf..d02620ee1a4 100644 --- a/src/test/run-pass/issues/issue-12744.rs +++ b/src/test/run-pass/issues/issue-12744.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { fn test() -> Box { Box::new(1) } diff --git a/src/test/run-pass/issues/issue-12860.rs b/src/test/run-pass/issues/issue-12860.rs index fba1532e00f..01b642cdfcc 100644 --- a/src/test/run-pass/issues/issue-12860.rs +++ b/src/test/run-pass/issues/issue-12860.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::collections::HashSet; diff --git a/src/test/run-pass/issues/issue-12909.rs b/src/test/run-pass/issues/issue-12909.rs index 4070464ba3a..a68d73a004f 100644 --- a/src/test/run-pass/issues/issue-12909.rs +++ b/src/test/run-pass/issues/issue-12909.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-13027.rs b/src/test/run-pass/issues/issue-13027.rs index 7caf1589aed..1bab82a543f 100644 --- a/src/test/run-pass/issues/issue-13027.rs +++ b/src/test/run-pass/issues/issue-13027.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that match expression handles overlapped literal and range diff --git a/src/test/run-pass/issues/issue-13204.rs b/src/test/run-pass/issues/issue-13204.rs index 0d5a7e07138..3d6aba8455a 100644 --- a/src/test/run-pass/issues/issue-13204.rs +++ b/src/test/run-pass/issues/issue-13204.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] // Test that when instantiating trait default methods, typeck handles diff --git a/src/test/run-pass/issues/issue-13259-windows-tcb-trash.rs b/src/test/run-pass/issues/issue-13259-windows-tcb-trash.rs index de18e09532b..d79d34de571 100644 --- a/src/test/run-pass/issues/issue-13259-windows-tcb-trash.rs +++ b/src/test/run-pass/issues/issue-13259-windows-tcb-trash.rs @@ -1,15 +1,5 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/issues/issue-13264.rs b/src/test/run-pass/issues/issue-13264.rs index db6b80ad225..691bb63a2fe 100644 --- a/src/test/run-pass/issues/issue-13264.rs +++ b/src/test/run-pass/issues/issue-13264.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-13304.rs b/src/test/run-pass/issues/issue-13304.rs index a2a30b26d47..cd74ce38dea 100644 --- a/src/test/run-pass/issues/issue-13304.rs +++ b/src/test/run-pass/issues/issue-13304.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] // ignore-cloudabi no processes diff --git a/src/test/run-pass/issues/issue-13323.rs b/src/test/run-pass/issues/issue-13323.rs index b72abb8b7ac..26847ee7a08 100644 --- a/src/test/run-pass/issues/issue-13323.rs +++ b/src/test/run-pass/issues/issue-13323.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-13434.rs b/src/test/run-pass/issues/issue-13434.rs index 94d22b818e3..1b7d3e20173 100644 --- a/src/test/run-pass/issues/issue-13434.rs +++ b/src/test/run-pass/issues/issue-13434.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Debug)] struct MyStruct; diff --git a/src/test/run-pass/issues/issue-13494.rs b/src/test/run-pass/issues/issue-13494.rs index a31ad72b088..12be97702a9 100644 --- a/src/test/run-pass/issues/issue-13494.rs +++ b/src/test/run-pass/issues/issue-13494.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/issues/issue-13507-2.rs b/src/test/run-pass/issues/issue-13507-2.rs index a189b8f1688..4ea95149dc6 100644 --- a/src/test/run-pass/issues/issue-13507-2.rs +++ b/src/test/run-pass/issues/issue-13507-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // aux-build:issue13507.rs diff --git a/src/test/run-pass/issues/issue-13620.rs b/src/test/run-pass/issues/issue-13620.rs index 624aeaef782..3c3c19df75d 100644 --- a/src/test/run-pass/issues/issue-13620.rs +++ b/src/test/run-pass/issues/issue-13620.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-13620-1.rs // aux-build:issue-13620-2.rs diff --git a/src/test/run-pass/issues/issue-13655.rs b/src/test/run-pass/issues/issue-13655.rs index 9978819d7db..6dd1847995f 100644 --- a/src/test/run-pass/issues/issue-13655.rs +++ b/src/test/run-pass/issues/issue-13655.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(fn_traits, unboxed_closures)] use std::ops::Fn; diff --git a/src/test/run-pass/issues/issue-13665.rs b/src/test/run-pass/issues/issue-13665.rs index 85e8ef57515..a3843c65034 100644 --- a/src/test/run-pass/issues/issue-13665.rs +++ b/src/test/run-pass/issues/issue-13665.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-13763.rs b/src/test/run-pass/issues/issue-13763.rs index 7b335d31238..dd5f6dbc9dc 100644 --- a/src/test/run-pass/issues/issue-13763.rs +++ b/src/test/run-pass/issues/issue-13763.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-13808.rs b/src/test/run-pass/issues/issue-13808.rs index e759ef1c5b4..d1b94c71864 100644 --- a/src/test/run-pass/issues/issue-13808.rs +++ b/src/test/run-pass/issues/issue-13808.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-13867.rs b/src/test/run-pass/issues/issue-13867.rs index 84d7e8a3bc4..e66368f9ba8 100644 --- a/src/test/run-pass/issues/issue-13867.rs +++ b/src/test/run-pass/issues/issue-13867.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that codegen works correctly when there are multiple refutable // patterns in match expression. diff --git a/src/test/run-pass/issues/issue-13872.rs b/src/test/run-pass/issues/issue-13872.rs index e72eac8fbdd..aade6b8367c 100644 --- a/src/test/run-pass/issues/issue-13872.rs +++ b/src/test/run-pass/issues/issue-13872.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-13872-1.rs // aux-build:issue-13872-2.rs diff --git a/src/test/run-pass/issues/issue-13902.rs b/src/test/run-pass/issues/issue-13902.rs index 4f0ab3c55f2..1afde0ebe85 100644 --- a/src/test/run-pass/issues/issue-13902.rs +++ b/src/test/run-pass/issues/issue-13902.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-14229.rs b/src/test/run-pass/issues/issue-14229.rs index c09b2c79104..477a2c65053 100644 --- a/src/test/run-pass/issues/issue-14229.rs +++ b/src/test/run-pass/issues/issue-14229.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo: Sized { fn foo(self) {} diff --git a/src/test/run-pass/issues/issue-14308.rs b/src/test/run-pass/issues/issue-14308.rs index dce2c4aecd6..e067bcdf34a 100644 --- a/src/test/run-pass/issues/issue-14308.rs +++ b/src/test/run-pass/issues/issue-14308.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct A(isize); diff --git a/src/test/run-pass/issues/issue-14344.rs b/src/test/run-pass/issues/issue-14344.rs index 842a5c1ad77..33b1df827d3 100644 --- a/src/test/run-pass/issues/issue-14344.rs +++ b/src/test/run-pass/issues/issue-14344.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-14344-1.rs // aux-build:issue-14344-2.rs diff --git a/src/test/run-pass/issues/issue-14382.rs b/src/test/run-pass/issues/issue-14382.rs index 7fdd5e2b0db..671e7a22667 100644 --- a/src/test/run-pass/issues/issue-14382.rs +++ b/src/test/run-pass/issues/issue-14382.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Debug)] struct Matrix4(S); diff --git a/src/test/run-pass/issues/issue-14393.rs b/src/test/run-pass/issues/issue-14393.rs index 9dd3674f34f..df635407af6 100644 --- a/src/test/run-pass/issues/issue-14393.rs +++ b/src/test/run-pass/issues/issue-14393.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-14399.rs b/src/test/run-pass/issues/issue-14399.rs index 76785212cd7..1b57856e955 100644 --- a/src/test/run-pass/issues/issue-14399.rs +++ b/src/test/run-pass/issues/issue-14399.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // #14399 // We'd previously ICE if we had a method call whose return diff --git a/src/test/run-pass/issues/issue-14421.rs b/src/test/run-pass/issues/issue-14421.rs index 8920134bcbb..c59bd87065f 100644 --- a/src/test/run-pass/issues/issue-14421.rs +++ b/src/test/run-pass/issues/issue-14421.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-14422.rs b/src/test/run-pass/issues/issue-14422.rs index dd1d74779d5..b9e2065d014 100644 --- a/src/test/run-pass/issues/issue-14422.rs +++ b/src/test/run-pass/issues/issue-14422.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-14456.rs b/src/test/run-pass/issues/issue-14456.rs index cfd037e31f6..23347d35178 100644 --- a/src/test/run-pass/issues/issue-14456.rs +++ b/src/test/run-pass/issues/issue-14456.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] // ignore-cloudabi no processes diff --git a/src/test/run-pass/issues/issue-1451.rs b/src/test/run-pass/issues/issue-1451.rs index 7cdc54fa59f..ad8928b2043 100644 --- a/src/test/run-pass/issues/issue-1451.rs +++ b/src/test/run-pass/issues/issue-1451.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-14589.rs b/src/test/run-pass/issues/issue-14589.rs index 78f47237ed6..d495602dff7 100644 --- a/src/test/run-pass/issues/issue-14589.rs +++ b/src/test/run-pass/issues/issue-14589.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // All 3 expressions should work in that the argument gets // coerced to a trait object diff --git a/src/test/run-pass/issues/issue-1460.rs b/src/test/run-pass/issues/issue-1460.rs index 85a87327355..143a0387e21 100644 --- a/src/test/run-pass/issues/issue-1460.rs +++ b/src/test/run-pass/issues/issue-1460.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-14821.rs b/src/test/run-pass/issues/issue-14821.rs index 69291afb92f..5ac0d0df0d7 100644 --- a/src/test/run-pass/issues/issue-14821.rs +++ b/src/test/run-pass/issues/issue-14821.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-14865.rs b/src/test/run-pass/issues/issue-14865.rs index 94da75cdc05..56e78e78f18 100644 --- a/src/test/run-pass/issues/issue-14865.rs +++ b/src/test/run-pass/issues/issue-14865.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-14875.rs b/src/test/run-pass/issues/issue-14875.rs index f983218dc8b..a2fd7962458 100644 --- a/src/test/run-pass/issues/issue-14875.rs +++ b/src/test/run-pass/issues/issue-14875.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare always compiled as panic=abort right now diff --git a/src/test/run-pass/issues/issue-14919.rs b/src/test/run-pass/issues/issue-14919.rs index dd02e513287..c6ccb7575bb 100644 --- a/src/test/run-pass/issues/issue-14919.rs +++ b/src/test/run-pass/issues/issue-14919.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-14940.rs b/src/test/run-pass/issues/issue-14940.rs index 494b790b5bd..ce47a623f00 100644 --- a/src/test/run-pass/issues/issue-14940.rs +++ b/src/test/run-pass/issues/issue-14940.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/issues/issue-14958.rs b/src/test/run-pass/issues/issue-14958.rs index 90716488fab..17f7f159fd2 100644 --- a/src/test/run-pass/issues/issue-14958.rs +++ b/src/test/run-pass/issues/issue-14958.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-15043.rs b/src/test/run-pass/issues/issue-15043.rs index 3ba4966a13e..53748be8a02 100644 --- a/src/test/run-pass/issues/issue-15043.rs +++ b/src/test/run-pass/issues/issue-15043.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-15063.rs b/src/test/run-pass/issues/issue-15063.rs index c8cbc120251..4082675129d 100644 --- a/src/test/run-pass/issues/issue-15063.rs +++ b/src/test/run-pass/issues/issue-15063.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-15080.rs b/src/test/run-pass/issues/issue-15080.rs index ee8356b99e0..4558118a809 100644 --- a/src/test/run-pass/issues/issue-15080.rs +++ b/src/test/run-pass/issues/issue-15080.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(slice_patterns)] diff --git a/src/test/run-pass/issues/issue-15104.rs b/src/test/run-pass/issues/issue-15104.rs index 0cb1d69d186..3a03a52c324 100644 --- a/src/test/run-pass/issues/issue-15104.rs +++ b/src/test/run-pass/issues/issue-15104.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(slice_patterns)] diff --git a/src/test/run-pass/issues/issue-15129.rs b/src/test/run-pass/issues/issue-15129.rs index b0ee797752a..522d0209c29 100644 --- a/src/test/run-pass/issues/issue-15129.rs +++ b/src/test/run-pass/issues/issue-15129.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub enum T { diff --git a/src/test/run-pass/issues/issue-15155.rs b/src/test/run-pass/issues/issue-15155.rs index 3abed1f5637..3e513a3d5ec 100644 --- a/src/test/run-pass/issues/issue-15155.rs +++ b/src/test/run-pass/issues/issue-15155.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait TraitWithSend: Send {} trait IndirectTraitWithSend: TraitWithSend {} diff --git a/src/test/run-pass/issues/issue-15189.rs b/src/test/run-pass/issues/issue-15189.rs index 6c6a4404da9..a9c884bdcfd 100644 --- a/src/test/run-pass/issues/issue-15189.rs +++ b/src/test/run-pass/issues/issue-15189.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! third { ($e:expr) => ({let x = 2; $e[x]}) diff --git a/src/test/run-pass/issues/issue-15221.rs b/src/test/run-pass/issues/issue-15221.rs index 375cb5e14e5..4b8319a8304 100644 --- a/src/test/run-pass/issues/issue-15221.rs +++ b/src/test/run-pass/issues/issue-15221.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(path_statements)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-15444.rs b/src/test/run-pass/issues/issue-15444.rs index 826ca40d63d..e94afee9634 100644 --- a/src/test/run-pass/issues/issue-15444.rs +++ b/src/test/run-pass/issues/issue-15444.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-15487.rs b/src/test/run-pass/issues/issue-15487.rs index 48bcf2183f0..98714cba0e4 100644 --- a/src/test/run-pass/issues/issue-15487.rs +++ b/src/test/run-pass/issues/issue-15487.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_attributes)] // ignore-windows diff --git a/src/test/run-pass/issues/issue-15523-big.rs b/src/test/run-pass/issues/issue-15523-big.rs index 41a52283aac..05414f1db72 100644 --- a/src/test/run-pass/issues/issue-15523-big.rs +++ b/src/test/run-pass/issues/issue-15523-big.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue 15523: derive(PartialOrd) should use the provided // discriminant values for the derived ordering. diff --git a/src/test/run-pass/issues/issue-15523.rs b/src/test/run-pass/issues/issue-15523.rs index a8fc2153c66..220a34b9b0f 100644 --- a/src/test/run-pass/issues/issue-15523.rs +++ b/src/test/run-pass/issues/issue-15523.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue 15523: derive(PartialOrd) should use the provided // discriminant values for the derived ordering. diff --git a/src/test/run-pass/issues/issue-15562.rs b/src/test/run-pass/issues/issue-15562.rs index a3e3f528ff5..b37ba81e291 100644 --- a/src/test/run-pass/issues/issue-15562.rs +++ b/src/test/run-pass/issues/issue-15562.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-15562.rs diff --git a/src/test/run-pass/issues/issue-15571.rs b/src/test/run-pass/issues/issue-15571.rs index 41414b13a19..5381d65232f 100644 --- a/src/test/run-pass/issues/issue-15571.rs +++ b/src/test/run-pass/issues/issue-15571.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-15673.rs b/src/test/run-pass/issues/issue-15673.rs index c706606cf6a..a8733d7f157 100644 --- a/src/test/run-pass/issues/issue-15673.rs +++ b/src/test/run-pass/issues/issue-15673.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] diff --git a/src/test/run-pass/issues/issue-15689-1.rs b/src/test/run-pass/issues/issue-15689-1.rs index 02bf687e74f..d143926b281 100644 --- a/src/test/run-pass/issues/issue-15689-1.rs +++ b/src/test/run-pass/issues/issue-15689-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Debug)] diff --git a/src/test/run-pass/issues/issue-15730.rs b/src/test/run-pass/issues/issue-15730.rs index b5a0715bae6..dacffd154fc 100644 --- a/src/test/run-pass/issues/issue-15730.rs +++ b/src/test/run-pass/issues/issue-15730.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-15734.rs b/src/test/run-pass/issues/issue-15734.rs index 6b386ed0f8d..be582060601 100644 --- a/src/test/run-pass/issues/issue-15734.rs +++ b/src/test/run-pass/issues/issue-15734.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // If `Index` used an associated type for its output, this test would // work more smoothly. diff --git a/src/test/run-pass/issues/issue-15763.rs b/src/test/run-pass/issues/issue-15763.rs index a8aba30a37f..4438d1f2cec 100644 --- a/src/test/run-pass/issues/issue-15763.rs +++ b/src/test/run-pass/issues/issue-15763.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-15774.rs b/src/test/run-pass/issues/issue-15774.rs index 3e4845886e0..ed2235758b9 100644 --- a/src/test/run-pass/issues/issue-15774.rs +++ b/src/test/run-pass/issues/issue-15774.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-15793.rs b/src/test/run-pass/issues/issue-15793.rs index 9c5bea1a53e..769012b1ba7 100644 --- a/src/test/run-pass/issues/issue-15793.rs +++ b/src/test/run-pass/issues/issue-15793.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-15858.rs b/src/test/run-pass/issues/issue-15858.rs index f0b4db7d6bd..41d2f13952a 100644 --- a/src/test/run-pass/issues/issue-15858.rs +++ b/src/test/run-pass/issues/issue-15858.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass static mut DROP_RAN: bool = false; diff --git a/src/test/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs b/src/test/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs index 2b39b80d10f..2470e37e182 100644 --- a/src/test/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs +++ b/src/test/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 diff --git a/src/test/run-pass/issues/issue-16151.rs b/src/test/run-pass/issues/issue-16151.rs index 440037ff119..48a14b2af7c 100644 --- a/src/test/run-pass/issues/issue-16151.rs +++ b/src/test/run-pass/issues/issue-16151.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem; diff --git a/src/test/run-pass/issues/issue-16256.rs b/src/test/run-pass/issues/issue-16256.rs index 20a5bbadcf5..e566eede8d2 100644 --- a/src/test/run-pass/issues/issue-16256.rs +++ b/src/test/run-pass/issues/issue-16256.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-16272.rs b/src/test/run-pass/issues/issue-16272.rs index dd515ea1558..a2570e763f6 100644 --- a/src/test/run-pass/issues/issue-16272.rs +++ b/src/test/run-pass/issues/issue-16272.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/issues/issue-16278.rs b/src/test/run-pass/issues/issue-16278.rs index c3b6c5a38ba..a9fa0db44d3 100644 --- a/src/test/run-pass/issues/issue-16278.rs +++ b/src/test/run-pass/issues/issue-16278.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-tidy-cr diff --git a/src/test/run-pass/issues/issue-16441.rs b/src/test/run-pass/issues/issue-16441.rs index cabed87edda..bae3813f9da 100644 --- a/src/test/run-pass/issues/issue-16441.rs +++ b/src/test/run-pass/issues/issue-16441.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-16452.rs b/src/test/run-pass/issues/issue-16452.rs index 10c9f316b89..faf9edd3b26 100644 --- a/src/test/run-pass/issues/issue-16452.rs +++ b/src/test/run-pass/issues/issue-16452.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-16492.rs b/src/test/run-pass/issues/issue-16492.rs index 7c2f4d99e6a..7fa808237bf 100644 --- a/src/test/run-pass/issues/issue-16492.rs +++ b/src/test/run-pass/issues/issue-16492.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-16530.rs b/src/test/run-pass/issues/issue-16530.rs index f32057e5e44..22a6ef7fa09 100644 --- a/src/test/run-pass/issues/issue-16530.rs +++ b/src/test/run-pass/issues/issue-16530.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(deprecated)] diff --git a/src/test/run-pass/issues/issue-16560.rs b/src/test/run-pass/issues/issue-16560.rs index 795b1efeeeb..d5fffc7ef9b 100644 --- a/src/test/run-pass/issues/issue-16560.rs +++ b/src/test/run-pass/issues/issue-16560.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/issues/issue-16597-empty.rs b/src/test/run-pass/issues/issue-16597-empty.rs index c68e2634831..2bdd08575c4 100644 --- a/src/test/run-pass/issues/issue-16597-empty.rs +++ b/src/test/run-pass/issues/issue-16597-empty.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags:--test diff --git a/src/test/run-pass/issues/issue-16597.rs b/src/test/run-pass/issues/issue-16597.rs index 61b82814210..35769bfc117 100644 --- a/src/test/run-pass/issues/issue-16597.rs +++ b/src/test/run-pass/issues/issue-16597.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // compile-flags:--test diff --git a/src/test/run-pass/issues/issue-1660.rs b/src/test/run-pass/issues/issue-1660.rs index 61b380bf695..aa60a8d8a96 100644 --- a/src/test/run-pass/issues/issue-1660.rs +++ b/src/test/run-pass/issues/issue-1660.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-16602-1.rs b/src/test/run-pass/issues/issue-16602-1.rs index e351832a8c2..dd64ee75b34 100644 --- a/src/test/run-pass/issues/issue-16602-1.rs +++ b/src/test/run-pass/issues/issue-16602-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let mut t = [1; 2]; diff --git a/src/test/run-pass/issues/issue-16602-2.rs b/src/test/run-pass/issues/issue-16602-2.rs index 197059202e0..6364630ffa9 100644 --- a/src/test/run-pass/issues/issue-16602-2.rs +++ b/src/test/run-pass/issues/issue-16602-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct A { pub x: u32, diff --git a/src/test/run-pass/issues/issue-16602-3.rs b/src/test/run-pass/issues/issue-16602-3.rs index bc4cbcbd329..dbfeef053da 100644 --- a/src/test/run-pass/issues/issue-16602-3.rs +++ b/src/test/run-pass/issues/issue-16602-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(unused_assignments)] diff --git a/src/test/run-pass/issues/issue-16643.rs b/src/test/run-pass/issues/issue-16643.rs index 7bfb5444d05..c74a554af2e 100644 --- a/src/test/run-pass/issues/issue-16643.rs +++ b/src/test/run-pass/issues/issue-16643.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-16643.rs diff --git a/src/test/run-pass/issues/issue-16648.rs b/src/test/run-pass/issues/issue-16648.rs index cd0fca9ad62..539f015fa28 100644 --- a/src/test/run-pass/issues/issue-16648.rs +++ b/src/test/run-pass/issues/issue-16648.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let x: (isize, &[isize]) = (2, &[1, 2]); diff --git a/src/test/run-pass/issues/issue-16671.rs b/src/test/run-pass/issues/issue-16671.rs index 5ff2bc97ae2..81a6b669b70 100644 --- a/src/test/run-pass/issues/issue-16671.rs +++ b/src/test/run-pass/issues/issue-16671.rs @@ -1,15 +1,5 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -//compile-flags: -Z borrowck=compare -Z emit-end-regions +//compile-flags: -Z borrowck=compare #![deny(warnings)] diff --git a/src/test/run-pass/issues/issue-16739.rs b/src/test/run-pass/issues/issue-16739.rs index 8404e387659..6868eae6ea4 100644 --- a/src/test/run-pass/issues/issue-16739.rs +++ b/src/test/run-pass/issues/issue-16739.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] #![feature(unboxed_closures, fn_traits)] diff --git a/src/test/run-pass/issues/issue-16745.rs b/src/test/run-pass/issues/issue-16745.rs index 4603c0c2c56..e9137df0f1e 100644 --- a/src/test/run-pass/issues/issue-16745.rs +++ b/src/test/run-pass/issues/issue-16745.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { const X: u8 = 0; diff --git a/src/test/run-pass/issues/issue-16774.rs b/src/test/run-pass/issues/issue-16774.rs index dbaa6c30f45..9e9b84034db 100644 --- a/src/test/run-pass/issues/issue-16774.rs +++ b/src/test/run-pass/issues/issue-16774.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] #![feature(box_patterns)] diff --git a/src/test/run-pass/issues/issue-16783.rs b/src/test/run-pass/issues/issue-16783.rs index 3f1d07b88ec..4af4031d278 100644 --- a/src/test/run-pass/issues/issue-16783.rs +++ b/src/test/run-pass/issues/issue-16783.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-16819.rs b/src/test/run-pass/issues/issue-16819.rs index dab126ccc42..cc0200904e5 100644 --- a/src/test/run-pass/issues/issue-16819.rs +++ b/src/test/run-pass/issues/issue-16819.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // `#[cfg]` on struct field permits empty unusable struct diff --git a/src/test/run-pass/issues/issue-16922.rs b/src/test/run-pass/issues/issue-16922.rs index 8eb066e6f00..82a3943e9ef 100644 --- a/src/test/run-pass/issues/issue-16922.rs +++ b/src/test/run-pass/issues/issue-16922.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-1696.rs b/src/test/run-pass/issues/issue-1696.rs index d205bed7226..b5d77df3a18 100644 --- a/src/test/run-pass/issues/issue-1696.rs +++ b/src/test/run-pass/issues/issue-1696.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::collections::HashMap; diff --git a/src/test/run-pass/issues/issue-1701.rs b/src/test/run-pass/issues/issue-1701.rs index 90b71d5dfe2..bae32a77765 100644 --- a/src/test/run-pass/issues/issue-1701.rs +++ b/src/test/run-pass/issues/issue-1701.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-17068.rs b/src/test/run-pass/issues/issue-17068.rs index ece2284d3c5..fe2c1a34bb4 100644 --- a/src/test/run-pass/issues/issue-17068.rs +++ b/src/test/run-pass/issues/issue-17068.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that regionck creates the right region links in the pattern // binding of a for loop diff --git a/src/test/run-pass/issues/issue-17074.rs b/src/test/run-pass/issues/issue-17074.rs index 1f45e01203f..0ed81132ec6 100644 --- a/src/test/run-pass/issues/issue-17074.rs +++ b/src/test/run-pass/issues/issue-17074.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-17170.rs b/src/test/run-pass/issues/issue-17170.rs index f876f1e1463..8d70dacdc90 100644 --- a/src/test/run-pass/issues/issue-17170.rs +++ b/src/test/run-pass/issues/issue-17170.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(repr_simd)] diff --git a/src/test/run-pass/issues/issue-17216.rs b/src/test/run-pass/issues/issue-17216.rs index c27eb74c90f..05baa1bffdd 100644 --- a/src/test/run-pass/issues/issue-17216.rs +++ b/src/test/run-pass/issues/issue-17216.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] struct Leak<'a> { diff --git a/src/test/run-pass/issues/issue-17233.rs b/src/test/run-pass/issues/issue-17233.rs index 15571d563b2..54a12fdf8e8 100644 --- a/src/test/run-pass/issues/issue-17233.rs +++ b/src/test/run-pass/issues/issue-17233.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const X1: &'static [u8] = &[b'1']; diff --git a/src/test/run-pass/issues/issue-17302.rs b/src/test/run-pass/issues/issue-17302.rs index 708257de0b7..cf7a2f1b063 100644 --- a/src/test/run-pass/issues/issue-17302.rs +++ b/src/test/run-pass/issues/issue-17302.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass static mut DROPPED: [bool; 2] = [false, false]; diff --git a/src/test/run-pass/issues/issue-17322.rs b/src/test/run-pass/issues/issue-17322.rs index dc17f02ab62..79b6a5ae533 100644 --- a/src/test/run-pass/issues/issue-17322.rs +++ b/src/test/run-pass/issues/issue-17322.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-17351.rs b/src/test/run-pass/issues/issue-17351.rs index 69c015ae3e8..f51f0b3ca01 100644 --- a/src/test/run-pass/issues/issue-17351.rs +++ b/src/test/run-pass/issues/issue-17351.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-17361.rs b/src/test/run-pass/issues/issue-17361.rs index 9e478a39b82..e97fc3afd1c 100644 --- a/src/test/run-pass/issues/issue-17361.rs +++ b/src/test/run-pass/issues/issue-17361.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that astconv doesn't forget about mutability of &mut str diff --git a/src/test/run-pass/issues/issue-17503.rs b/src/test/run-pass/issues/issue-17503.rs index 909098e3982..9a92c06e159 100644 --- a/src/test/run-pass/issues/issue-17503.rs +++ b/src/test/run-pass/issues/issue-17503.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let s: &[isize] = &[0, 1, 2, 3, 4]; diff --git a/src/test/run-pass/issues/issue-17662.rs b/src/test/run-pass/issues/issue-17662.rs index 10ee3ce1741..a2683808b52 100644 --- a/src/test/run-pass/issues/issue-17662.rs +++ b/src/test/run-pass/issues/issue-17662.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-17662.rs diff --git a/src/test/run-pass/issues/issue-17718-borrow-interior.rs b/src/test/run-pass/issues/issue-17718-borrow-interior.rs index 51f617340da..5861f218689 100644 --- a/src/test/run-pass/issues/issue-17718-borrow-interior.rs +++ b/src/test/run-pass/issues/issue-17718-borrow-interior.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] struct S { a: usize } diff --git a/src/test/run-pass/issues/issue-17718-parse-const.rs b/src/test/run-pass/issues/issue-17718-parse-const.rs index e9925252540..d5a5f445d5b 100644 --- a/src/test/run-pass/issues/issue-17718-parse-const.rs +++ b/src/test/run-pass/issues/issue-17718-parse-const.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const FOO: usize = 3; diff --git a/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs b/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs index f6a2f099753..65a8713ba05 100644 --- a/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs +++ b/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-17718.rs b/src/test/run-pass/issues/issue-17718.rs index 33e69824dfc..c6341d80844 100644 --- a/src/test/run-pass/issues/issue-17718.rs +++ b/src/test/run-pass/issues/issue-17718.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:issue-17718-aux.rs diff --git a/src/test/run-pass/issues/issue-17734.rs b/src/test/run-pass/issues/issue-17734.rs index e52337667c8..ba8d6c21ca8 100644 --- a/src/test/run-pass/issues/issue-17734.rs +++ b/src/test/run-pass/issues/issue-17734.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that generating drop glue for Box doesn't ICE diff --git a/src/test/run-pass/issues/issue-17756.rs b/src/test/run-pass/issues/issue-17756.rs index 7b8fa866fff..1835b177ff3 100644 --- a/src/test/run-pass/issues/issue-17756.rs +++ b/src/test/run-pass/issues/issue-17756.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-17771.rs b/src/test/run-pass/issues/issue-17771.rs index ed5acf5e1bb..7eea5ce6589 100644 --- a/src/test/run-pass/issues/issue-17771.rs +++ b/src/test/run-pass/issues/issue-17771.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-17816.rs b/src/test/run-pass/issues/issue-17816.rs index ddeac242f78..7ca47d50335 100644 --- a/src/test/run-pass/issues/issue-17816.rs +++ b/src/test/run-pass/issues/issue-17816.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] use std::marker::PhantomData; diff --git a/src/test/run-pass/issues/issue-17877.rs b/src/test/run-pass/issues/issue-17877.rs index 4dee51c4289..af22b1ad8f0 100644 --- a/src/test/run-pass/issues/issue-17877.rs +++ b/src/test/run-pass/issues/issue-17877.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(slice_patterns)] diff --git a/src/test/run-pass/issues/issue-17897.rs b/src/test/run-pass/issues/issue-17897.rs index e543606c9c9..291bd3f1718 100644 --- a/src/test/run-pass/issues/issue-17897.rs +++ b/src/test/run-pass/issues/issue-17897.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn action(mut cb: Box usize>) -> usize { cb(1) diff --git a/src/test/run-pass/issues/issue-18060.rs b/src/test/run-pass/issues/issue-18060.rs index 2714de4b59f..b5f3d0f74bc 100644 --- a/src/test/run-pass/issues/issue-18060.rs +++ b/src/test/run-pass/issues/issue-18060.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for #18060: match arms were matching in the wrong order. diff --git a/src/test/run-pass/issues/issue-18075.rs b/src/test/run-pass/issues/issue-18075.rs index edf923fbaf2..dcd67d8d15a 100644 --- a/src/test/run-pass/issues/issue-18075.rs +++ b/src/test/run-pass/issues/issue-18075.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // exec-env:RUST_LOG=rustc::middle=debug diff --git a/src/test/run-pass/issues/issue-18110.rs b/src/test/run-pass/issues/issue-18110.rs index 6d80e2664dc..41c29e77da5 100644 --- a/src/test/run-pass/issues/issue-18110.rs +++ b/src/test/run-pass/issues/issue-18110.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-18173.rs b/src/test/run-pass/issues/issue-18173.rs index eb29de18ac9..11468040ee5 100644 --- a/src/test/run-pass/issues/issue-18173.rs +++ b/src/test/run-pass/issues/issue-18173.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { type T; diff --git a/src/test/run-pass/issues/issue-18232.rs b/src/test/run-pass/issues/issue-18232.rs index 61b7306e9df..7e6f6ef0f39 100644 --- a/src/test/run-pass/issues/issue-18232.rs +++ b/src/test/run-pass/issues/issue-18232.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-18352.rs b/src/test/run-pass/issues/issue-18352.rs index 802e918e954..5d93ed0646c 100644 --- a/src/test/run-pass/issues/issue-18352.rs +++ b/src/test/run-pass/issues/issue-18352.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const X: &'static str = "12345"; diff --git a/src/test/run-pass/issues/issue-18353.rs b/src/test/run-pass/issues/issue-18353.rs index a3e7552691b..aaa896b66c5 100644 --- a/src/test/run-pass/issues/issue-18353.rs +++ b/src/test/run-pass/issues/issue-18353.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that wrapping an unsized struct in an enum which gets optimised does diff --git a/src/test/run-pass/issues/issue-18412.rs b/src/test/run-pass/issues/issue-18412.rs index 3d1a66877ed..fe1cfb3dffa 100644 --- a/src/test/run-pass/issues/issue-18412.rs +++ b/src/test/run-pass/issues/issue-18412.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that non-static methods can be assigned to local variables as // function pointers. diff --git a/src/test/run-pass/issues/issue-18425.rs b/src/test/run-pass/issues/issue-18425.rs index 615dc8b4f3c..354c14a756a 100644 --- a/src/test/run-pass/issues/issue-18425.rs +++ b/src/test/run-pass/issues/issue-18425.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that codegen doesn't ICE when codegenning an array repeat // expression with a count of 1 and a non-Copy element type. diff --git a/src/test/run-pass/issues/issue-18464.rs b/src/test/run-pass/issues/issue-18464.rs index 64536e993c5..14d2d0a6c8d 100644 --- a/src/test/run-pass/issues/issue-18464.rs +++ b/src/test/run-pass/issues/issue-18464.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![deny(dead_code)] diff --git a/src/test/run-pass/issues/issue-18501.rs b/src/test/run-pass/issues/issue-18501.rs index 2a82b1ab81d..0ca23074c55 100644 --- a/src/test/run-pass/issues/issue-18501.rs +++ b/src/test/run-pass/issues/issue-18501.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we don't ICE when inlining a function from another // crate that uses a trait method as a value due to incorrectly diff --git a/src/test/run-pass/issues/issue-18514.rs b/src/test/run-pass/issues/issue-18514.rs index 6a59b74bd06..48e7f07418f 100644 --- a/src/test/run-pass/issues/issue-18514.rs +++ b/src/test/run-pass/issues/issue-18514.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we don't ICE when codegenning a generic impl method from // an extern crate that contains a match expression on a local diff --git a/src/test/run-pass/issues/issue-18539.rs b/src/test/run-pass/issues/issue-18539.rs index a3211845d58..745df26e320 100644 --- a/src/test/run-pass/issues/issue-18539.rs +++ b/src/test/run-pass/issues/issue-18539.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that coercing bare fn's that return a zero sized type to // a closure doesn't cause an LLVM ERROR diff --git a/src/test/run-pass/issues/issue-18652.rs b/src/test/run-pass/issues/issue-18652.rs index 2c027dada87..59aa0156842 100644 --- a/src/test/run-pass/issues/issue-18652.rs +++ b/src/test/run-pass/issues/issue-18652.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests multiple free variables being passed by value into an unboxed // once closure as an optimization by codegen. This used to hit an diff --git a/src/test/run-pass/issues/issue-18655.rs b/src/test/run-pass/issues/issue-18655.rs index 94638539f6e..3d18542acdc 100644 --- a/src/test/run-pass/issues/issue-18655.rs +++ b/src/test/run-pass/issues/issue-18655.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Factory { type Product; diff --git a/src/test/run-pass/issues/issue-18661.rs b/src/test/run-pass/issues/issue-18661.rs index 0b20cd45cf2..e2427243235 100644 --- a/src/test/run-pass/issues/issue-18661.rs +++ b/src/test/run-pass/issues/issue-18661.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that param substitutions from the correct environment are // used when codegenning unboxed closure calls. diff --git a/src/test/run-pass/issues/issue-18685.rs b/src/test/run-pass/issues/issue-18685.rs index 98f59ed2ccd..bfe24b663f6 100644 --- a/src/test/run-pass/issues/issue-18685.rs +++ b/src/test/run-pass/issues/issue-18685.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that the self param space is not used in a conflicting // manner by unboxed closures within a default method on a trait diff --git a/src/test/run-pass/issues/issue-18711.rs b/src/test/run-pass/issues/issue-18711.rs index 3c3b914e67a..43584187752 100644 --- a/src/test/run-pass/issues/issue-18711.rs +++ b/src/test/run-pass/issues/issue-18711.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we don't panic on a RefCell borrow conflict in certain // code paths involving unboxed closures. diff --git a/src/test/run-pass/issues/issue-18767.rs b/src/test/run-pass/issues/issue-18767.rs index 3577850be2f..2a5721b7295 100644 --- a/src/test/run-pass/issues/issue-18767.rs +++ b/src/test/run-pass/issues/issue-18767.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that regionck uses the right memcat for patterns in for loops // and doesn't ICE. diff --git a/src/test/run-pass/issues/issue-18804/auxiliary/lib.rs b/src/test/run-pass/issues/issue-18804/auxiliary/lib.rs index 06d454b2c89..ae27dd520e9 100644 --- a/src/test/run-pass/issues/issue-18804/auxiliary/lib.rs +++ b/src/test/run-pass/issues/issue-18804/auxiliary/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![feature(linkage)] diff --git a/src/test/run-pass/issues/issue-18804/main.rs b/src/test/run-pass/issues/issue-18804/main.rs index 2abcd4b7ba9..c36048ea545 100644 --- a/src/test/run-pass/issues/issue-18804/main.rs +++ b/src/test/run-pass/issues/issue-18804/main.rs @@ -1,22 +1,17 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test for issue #18804, #[linkage] does not propagate through generic // functions. Failure results in a linker error. // ignore-asmjs no weak symbol support // ignore-emscripten no weak symbol support +// ignore-windows no extern_weak linkage +// ignore-macos no extern_weak linkage // aux-build:lib.rs +// rust-lang/rust#56772: nikic says we need this to be proper test. +// compile-flags: -C no-prepopulate-passes -C passes=name-anon-globals + extern crate lib; fn main() { diff --git a/src/test/run-pass/issues/issue-18845.rs b/src/test/run-pass/issues/issue-18845.rs index 1510c774b28..83fab4b5e8f 100644 --- a/src/test/run-pass/issues/issue-18845.rs +++ b/src/test/run-pass/issues/issue-18845.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This used to generate invalid IR in that even if we took the // `false` branch we'd still try to free the Box from the other diff --git a/src/test/run-pass/issues/issue-18859.rs b/src/test/run-pass/issues/issue-18859.rs index 4c98cb2d02d..c4575bce925 100644 --- a/src/test/run-pass/issues/issue-18859.rs +++ b/src/test/run-pass/issues/issue-18859.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass mod foo { diff --git a/src/test/run-pass/issues/issue-18913.rs b/src/test/run-pass/issues/issue-18913.rs index 57882648405..27fae6d7757 100644 --- a/src/test/run-pass/issues/issue-18913.rs +++ b/src/test/run-pass/issues/issue-18913.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-18913-1.rs // aux-build:issue-18913-2.rs diff --git a/src/test/run-pass/issues/issue-18937-1.rs b/src/test/run-pass/issues/issue-18937-1.rs index bf6a33d69cc..57e56d832c6 100644 --- a/src/test/run-pass/issues/issue-18937-1.rs +++ b/src/test/run-pass/issues/issue-18937-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to type-check this example. In particular, // knowing that `T: 'a` allows us to deduce that `[U]: 'a` (because diff --git a/src/test/run-pass/issues/issue-19001.rs b/src/test/run-pass/issues/issue-19001.rs index e4460d33b9e..85f7a84ac29 100644 --- a/src/test/run-pass/issues/issue-19001.rs +++ b/src/test/run-pass/issues/issue-19001.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // check that we handle recursive arrays correctly in `type_of` diff --git a/src/test/run-pass/issues/issue-19127.rs b/src/test/run-pass/issues/issue-19127.rs index 9826b1b08d2..c847ac9e435 100644 --- a/src/test/run-pass/issues/issue-19127.rs +++ b/src/test/run-pass/issues/issue-19127.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-19135.rs b/src/test/run-pass/issues/issue-19135.rs index 8a5fdc3b775..84540a3ff5f 100644 --- a/src/test/run-pass/issues/issue-19135.rs +++ b/src/test/run-pass/issues/issue-19135.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::marker::PhantomData; diff --git a/src/test/run-pass/issues/issue-19244.rs b/src/test/run-pass/issues/issue-19244.rs index 93cb0b9dd1f..44d9748fd2a 100644 --- a/src/test/run-pass/issues/issue-19244.rs +++ b/src/test/run-pass/issues/issue-19244.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct MyStruct { field: usize } diff --git a/src/test/run-pass/issues/issue-19293.rs b/src/test/run-pass/issues/issue-19293.rs index 5bb336eba91..90f96566f38 100644 --- a/src/test/run-pass/issues/issue-19293.rs +++ b/src/test/run-pass/issues/issue-19293.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_19293.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-19340-1.rs b/src/test/run-pass/issues/issue-19340-1.rs index 62c39d0ff3d..e3cc2daae9b 100644 --- a/src/test/run-pass/issues/issue-19340-1.rs +++ b/src/test/run-pass/issues/issue-19340-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // aux-build:issue-19340-1.rs diff --git a/src/test/run-pass/issues/issue-19340-2.rs b/src/test/run-pass/issues/issue-19340-2.rs index 3f86c7c9180..a222e9e4621 100644 --- a/src/test/run-pass/issues/issue-19340-2.rs +++ b/src/test/run-pass/issues/issue-19340-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-19358.rs b/src/test/run-pass/issues/issue-19358.rs index f58254496ff..f66e0a1c078 100644 --- a/src/test/run-pass/issues/issue-19358.rs +++ b/src/test/run-pass/issues/issue-19358.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Trait { fn dummy(&self) { } } diff --git a/src/test/run-pass/issues/issue-19367.rs b/src/test/run-pass/issues/issue-19367.rs index dfcc0926d80..0699533e72b 100644 --- a/src/test/run-pass/issues/issue-19367.rs +++ b/src/test/run-pass/issues/issue-19367.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct S { o: Option diff --git a/src/test/run-pass/issues/issue-19499.rs b/src/test/run-pass/issues/issue-19499.rs index efdcce17f5f..d09056ce3de 100644 --- a/src/test/run-pass/issues/issue-19499.rs +++ b/src/test/run-pass/issues/issue-19499.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(path_statements)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-1974.rs b/src/test/run-pass/issues/issue-1974.rs index 016afcdd54d..74a54a6029e 100644 --- a/src/test/run-pass/issues/issue-1974.rs +++ b/src/test/run-pass/issues/issue-1974.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue 1974 // Don't double free the condition allocation diff --git a/src/test/run-pass/issues/issue-19811-escape-unicode.rs b/src/test/run-pass/issues/issue-19811-escape-unicode.rs index 5b021f6ee54..a2c50bc022d 100644 --- a/src/test/run-pass/issues/issue-19811-escape-unicode.rs +++ b/src/test/run-pass/issues/issue-19811-escape-unicode.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { diff --git a/src/test/run-pass/issues/issue-20055-box-trait.rs b/src/test/run-pass/issues/issue-20055-box-trait.rs index bd9da3a69c2..cb7b5a638fc 100644 --- a/src/test/run-pass/issues/issue-20055-box-trait.rs +++ b/src/test/run-pass/issues/issue-20055-box-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // See Issues #20055 and #21695. diff --git a/src/test/run-pass/issues/issue-20055-box-unsized-array.rs b/src/test/run-pass/issues/issue-20055-box-unsized-array.rs index 6af9741dc9b..1246c80651f 100644 --- a/src/test/run-pass/issues/issue-20055-box-unsized-array.rs +++ b/src/test/run-pass/issues/issue-20055-box-unsized-array.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue #2005: Check that boxed fixed-size arrays are properly // accounted for (namely, only deallocated if they were actually diff --git a/src/test/run-pass/issues/issue-20174.rs b/src/test/run-pass/issues/issue-20174.rs index 57e7193363e..4ed5a97c172 100644 --- a/src/test/run-pass/issues/issue-20174.rs +++ b/src/test/run-pass/issues/issue-20174.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct GradFn usize>(F); diff --git a/src/test/run-pass/issues/issue-20313.rs b/src/test/run-pass/issues/issue-20313.rs index bc87372e14f..09352044b01 100644 --- a/src/test/run-pass/issues/issue-20313.rs +++ b/src/test/run-pass/issues/issue-20313.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-20343.rs b/src/test/run-pass/issues/issue-20343.rs index 0173b0b2f9c..000b6398442 100644 --- a/src/test/run-pass/issues/issue-20343.rs +++ b/src/test/run-pass/issues/issue-20343.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Regression test for Issue #20343. diff --git a/src/test/run-pass/issues/issue-20389.rs b/src/test/run-pass/issues/issue-20389.rs index 02d444f414c..9c5a1844e29 100644 --- a/src/test/run-pass/issues/issue-20389.rs +++ b/src/test/run-pass/issues/issue-20389.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:issue_20389.rs diff --git a/src/test/run-pass/issues/issue-20427.rs b/src/test/run-pass/issues/issue-20427.rs index 86d94ad85b3..fa2ea6cf592 100644 --- a/src/test/run-pass/issues/issue-20427.rs +++ b/src/test/run-pass/issues/issue-20427.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-20544.rs b/src/test/run-pass/issues/issue-20544.rs index 1a6e647e625..0f4d314f166 100644 --- a/src/test/run-pass/issues/issue-20544.rs +++ b/src/test/run-pass/issues/issue-20544.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(unboxed_closures)] #![feature(fn_traits)] diff --git a/src/test/run-pass/issues/issue-20575.rs b/src/test/run-pass/issues/issue-20575.rs index 35551185807..95273edcf7e 100644 --- a/src/test/run-pass/issues/issue-20575.rs +++ b/src/test/run-pass/issues/issue-20575.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that overloaded calls work with zero arity closures diff --git a/src/test/run-pass/issues/issue-20616.rs b/src/test/run-pass/issues/issue-20616.rs index fa72cf3e76f..6c24d437272 100644 --- a/src/test/run-pass/issues/issue-20616.rs +++ b/src/test/run-pass/issues/issue-20616.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] type MyType<'a, T> = &'a T; diff --git a/src/test/run-pass/issues/issue-2063.rs b/src/test/run-pass/issues/issue-2063.rs index 853c8bc6ec2..9dbac6ccee1 100644 --- a/src/test/run-pass/issues/issue-2063.rs +++ b/src/test/run-pass/issues/issue-2063.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // test that autoderef of a type like this does not // cause compiler to loop. Note that no instances diff --git a/src/test/run-pass/issues/issue-20676.rs b/src/test/run-pass/issues/issue-20676.rs index ff7ea9eaae4..27bbff09a00 100644 --- a/src/test/run-pass/issues/issue-20676.rs +++ b/src/test/run-pass/issues/issue-20676.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for #20676. Error was that we didn't support // UFCS-style calls to a method in `Trait` where `Self` was bound to a diff --git a/src/test/run-pass/issues/issue-2074.rs b/src/test/run-pass/issues/issue-2074.rs index 9aba2637068..bd5f015cca0 100644 --- a/src/test/run-pass/issues/issue-2074.rs +++ b/src/test/run-pass/issues/issue-2074.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-20803.rs b/src/test/run-pass/issues/issue-20803.rs index 7a3e4e71ace..f657cf6cdd7 100644 --- a/src/test/run-pass/issues/issue-20803.rs +++ b/src/test/run-pass/issues/issue-20803.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::Add; diff --git a/src/test/run-pass/issues/issue-20823.rs b/src/test/run-pass/issues/issue-20823.rs index 0a3b6f6eaa0..9e209d5d33a 100644 --- a/src/test/run-pass/issues/issue-20823.rs +++ b/src/test/run-pass/issues/issue-20823.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: --test diff --git a/src/test/run-pass/issues/issue-20847.rs b/src/test/run-pass/issues/issue-20847.rs index 4cb5a01b9de..0cd7edf89db 100644 --- a/src/test/run-pass/issues/issue-20847.rs +++ b/src/test/run-pass/issues/issue-20847.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(fn_traits)] diff --git a/src/test/run-pass/issues/issue-20953.rs b/src/test/run-pass/issues/issue-20953.rs index e2200c0d39b..f5c743d0d82 100644 --- a/src/test/run-pass/issues/issue-20953.rs +++ b/src/test/run-pass/issues/issue-20953.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-21033.rs b/src/test/run-pass/issues/issue-21033.rs index 20357ecd63a..86cc7707e50 100644 --- a/src/test/run-pass/issues/issue-21033.rs +++ b/src/test/run-pass/issues/issue-21033.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-21058.rs b/src/test/run-pass/issues/issue-21058.rs index e2ad0ba5bb2..e0cf26f7034 100644 --- a/src/test/run-pass/issues/issue-21058.rs +++ b/src/test/run-pass/issues/issue-21058.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![feature(core_intrinsics)] diff --git a/src/test/run-pass/issues/issue-21291.rs b/src/test/run-pass/issues/issue-21291.rs index 99912be8f8e..b351e22d862 100644 --- a/src/test/run-pass/issues/issue-21291.rs +++ b/src/test/run-pass/issues/issue-21291.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/issues/issue-21306.rs b/src/test/run-pass/issues/issue-21306.rs index e01f0aaac10..b06a475e4df 100644 --- a/src/test/run-pass/issues/issue-21306.rs +++ b/src/test/run-pass/issues/issue-21306.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::sync::Arc; diff --git a/src/test/run-pass/issues/issue-21361.rs b/src/test/run-pass/issues/issue-21361.rs index 4a566d7f78f..5297a4a7b29 100644 --- a/src/test/run-pass/issues/issue-21361.rs +++ b/src/test/run-pass/issues/issue-21361.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { diff --git a/src/test/run-pass/issues/issue-21384.rs b/src/test/run-pass/issues/issue-21384.rs index eccd1208969..caa99a15982 100644 --- a/src/test/run-pass/issues/issue-21384.rs +++ b/src/test/run-pass/issues/issue-21384.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use ::std::ops::RangeFull; diff --git a/src/test/run-pass/issues/issue-21400.rs b/src/test/run-pass/issues/issue-21400.rs index 2c575d28e12..0f297e9b8f2 100644 --- a/src/test/run-pass/issues/issue-21400.rs +++ b/src/test/run-pass/issues/issue-21400.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for #21400 which itself was extracted from // stackoverflow.com/questions/28031155/is-my-borrow-checker-drunk/28031580 diff --git a/src/test/run-pass/issues/issue-21475.rs b/src/test/run-pass/issues/issue-21475.rs index cdfdad3848d..16d003aba7c 100644 --- a/src/test/run-pass/issues/issue-21475.rs +++ b/src/test/run-pass/issues/issue-21475.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-21486.rs b/src/test/run-pass/issues/issue-21486.rs index 5e576893711..46d6ccd56bd 100644 --- a/src/test/run-pass/issues/issue-21486.rs +++ b/src/test/run-pass/issues/issue-21486.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] // Issue #21486: Make sure that all structures are dropped, even when diff --git a/src/test/run-pass/issues/issue-21655.rs b/src/test/run-pass/issues/issue-21655.rs index 208a5a3f926..cddd48349f9 100644 --- a/src/test/run-pass/issues/issue-21655.rs +++ b/src/test/run-pass/issues/issue-21655.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn test(it: &mut Iterator) { diff --git a/src/test/run-pass/issues/issue-21721.rs b/src/test/run-pass/issues/issue-21721.rs index adda70a0f79..4c1411e1ecf 100644 --- a/src/test/run-pass/issues/issue-21721.rs +++ b/src/test/run-pass/issues/issue-21721.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { diff --git a/src/test/run-pass/issues/issue-2190-1.rs b/src/test/run-pass/issues/issue-2190-1.rs index c77407a6bb1..34a80ab0051 100644 --- a/src/test/run-pass/issues/issue-2190-1.rs +++ b/src/test/run-pass/issues/issue-2190-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-21909.rs b/src/test/run-pass/issues/issue-21909.rs index ad5f1611e6f..7cb558d9a4f 100644 --- a/src/test/run-pass/issues/issue-21909.rs +++ b/src/test/run-pass/issues/issue-21909.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-21922.rs b/src/test/run-pass/issues/issue-21922.rs index 79e9976672e..9727b2efe9a 100644 --- a/src/test/run-pass/issues/issue-21922.rs +++ b/src/test/run-pass/issues/issue-21922.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::Add; fn show(z: i32) { diff --git a/src/test/run-pass/issues/issue-22008.rs b/src/test/run-pass/issues/issue-22008.rs index 54882cda624..00425582266 100644 --- a/src/test/run-pass/issues/issue-22008.rs +++ b/src/test/run-pass/issues/issue-22008.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { let command = "a"; diff --git a/src/test/run-pass/issues/issue-22036.rs b/src/test/run-pass/issues/issue-22036.rs index b814712b91a..30da2130a31 100644 --- a/src/test/run-pass/issues/issue-22036.rs +++ b/src/test/run-pass/issues/issue-22036.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait DigitCollection: Sized { diff --git a/src/test/run-pass/issues/issue-2214.rs b/src/test/run-pass/issues/issue-2214.rs index 8329847d3c5..6e538f711de 100644 --- a/src/test/run-pass/issues/issue-2214.rs +++ b/src/test/run-pass/issues/issue-2214.rs @@ -1,17 +1,7 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/issues/issue-2216.rs b/src/test/run-pass/issues/issue-2216.rs index 42cd3c0488b..fa712edcd1b 100644 --- a/src/test/run-pass/issues/issue-2216.rs +++ b/src/test/run-pass/issues/issue-2216.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] pub fn main() { diff --git a/src/test/run-pass/issues/issue-22258.rs b/src/test/run-pass/issues/issue-22258.rs index 6f97da9b5b5..93ead5818d5 100644 --- a/src/test/run-pass/issues/issue-22258.rs +++ b/src/test/run-pass/issues/issue-22258.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::Add; diff --git a/src/test/run-pass/issues/issue-22346.rs b/src/test/run-pass/issues/issue-22346.rs index 0b58591cd62..b728911e541 100644 --- a/src/test/run-pass/issues/issue-22346.rs +++ b/src/test/run-pass/issues/issue-22346.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-22403.rs b/src/test/run-pass/issues/issue-22403.rs index 76c4af1140b..8d855909435 100644 --- a/src/test/run-pass/issues/issue-22403.rs +++ b/src/test/run-pass/issues/issue-22403.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let x = Box::new([1, 2, 3]); diff --git a/src/test/run-pass/issues/issue-22426.rs b/src/test/run-pass/issues/issue-22426.rs index 8056b74ff8e..adf060a8292 100644 --- a/src/test/run-pass/issues/issue-22426.rs +++ b/src/test/run-pass/issues/issue-22426.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-22463.rs b/src/test/run-pass/issues/issue-22463.rs index e308b65ec87..fdf5a2fca72 100644 --- a/src/test/run-pass/issues/issue-22463.rs +++ b/src/test/run-pass/issues/issue-22463.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! items { () => { diff --git a/src/test/run-pass/issues/issue-22536-copy-mustnt-zero.rs b/src/test/run-pass/issues/issue-22536-copy-mustnt-zero.rs index 116d0620136..017f36484c1 100644 --- a/src/test/run-pass/issues/issue-22536-copy-mustnt-zero.rs +++ b/src/test/run-pass/issues/issue-22536-copy-mustnt-zero.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for Issue #22536: If a type implements Copy, then // moving it must not zero the original memory. diff --git a/src/test/run-pass/issues/issue-22546.rs b/src/test/run-pass/issues/issue-22546.rs index 4f165877afc..c26e457f9e4 100644 --- a/src/test/run-pass/issues/issue-22546.rs +++ b/src/test/run-pass/issues/issue-22546.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Parsing patterns with paths with type parameters (issue #22544) diff --git a/src/test/run-pass/issues/issue-22577.rs b/src/test/run-pass/issues/issue-22577.rs index c78f308f6b8..24f4f60aa2f 100644 --- a/src/test/run-pass/issues/issue-22577.rs +++ b/src/test/run-pass/issues/issue-22577.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-22629.rs b/src/test/run-pass/issues/issue-22629.rs index 9b9918d8aad..7beeb126ee4 100644 --- a/src/test/run-pass/issues/issue-22629.rs +++ b/src/test/run-pass/issues/issue-22629.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // Test transitive analysis for associated types. Collected types diff --git a/src/test/run-pass/issues/issue-22828.rs b/src/test/run-pass/issues/issue-22828.rs index cdbd1deb001..adf4dd6ce75 100644 --- a/src/test/run-pass/issues/issue-22828.rs +++ b/src/test/run-pass/issues/issue-22828.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test transitive analysis for associated types. Collected types diff --git a/src/test/run-pass/issues/issue-2284.rs b/src/test/run-pass/issues/issue-2284.rs index feb752411b1..6f2c958341b 100644 --- a/src/test/run-pass/issues/issue-2284.rs +++ b/src/test/run-pass/issues/issue-2284.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-22864-1.rs b/src/test/run-pass/issues/issue-22864-1.rs index e70e199bc2f..0fad5433d6c 100644 --- a/src/test/run-pass/issues/issue-22864-1.rs +++ b/src/test/run-pass/issues/issue-22864-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { struct Fun(F); diff --git a/src/test/run-pass/issues/issue-22864-2.rs b/src/test/run-pass/issues/issue-22864-2.rs index dea4ec49aad..4aa9e3e086b 100644 --- a/src/test/run-pass/issues/issue-22864-2.rs +++ b/src/test/run-pass/issues/issue-22864-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/issues/issue-2288.rs b/src/test/run-pass/issues/issue-2288.rs index 6185aaca6cf..963e7e62c7f 100644 --- a/src/test/run-pass/issues/issue-2288.rs +++ b/src/test/run-pass/issues/issue-2288.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-22992-2.rs b/src/test/run-pass/issues/issue-22992-2.rs index ccf5354b4ee..042af40eda6 100644 --- a/src/test/run-pass/issues/issue-22992-2.rs +++ b/src/test/run-pass/issues/issue-22992-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct A(B); struct B; diff --git a/src/test/run-pass/issues/issue-22992.rs b/src/test/run-pass/issues/issue-22992.rs index 18f5021f49e..e2ae1f96ee5 100644 --- a/src/test/run-pass/issues/issue-22992.rs +++ b/src/test/run-pass/issues/issue-22992.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty issue #37201 diff --git a/src/test/run-pass/issues/issue-23036.rs b/src/test/run-pass/issues/issue-23036.rs index 4017ae1731c..a307e7eed95 100644 --- a/src/test/run-pass/issues/issue-23036.rs +++ b/src/test/run-pass/issues/issue-23036.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no std::path diff --git a/src/test/run-pass/issues/issue-2316-c.rs b/src/test/run-pass/issues/issue-2316-c.rs index b7a4b6b31e4..6783f3fcfc6 100644 --- a/src/test/run-pass/issues/issue-2316-c.rs +++ b/src/test/run-pass/issues/issue-2316-c.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_2316_a.rs // aux-build:issue_2316_b.rs diff --git a/src/test/run-pass/issues/issue-23208.rs b/src/test/run-pass/issues/issue-23208.rs index 78384017ebc..fd4ffe5d6e1 100644 --- a/src/test/run-pass/issues/issue-23208.rs +++ b/src/test/run-pass/issues/issue-23208.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait TheTrait : TheSuperTrait<::Item> { type Item; diff --git a/src/test/run-pass/issues/issue-23261.rs b/src/test/run-pass/issues/issue-23261.rs index 08f178beaf3..0b34653a345 100644 --- a/src/test/run-pass/issues/issue-23261.rs +++ b/src/test/run-pass/issues/issue-23261.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Matching on a DST struct should not trigger an LLVM assertion. diff --git a/src/test/run-pass/issues/issue-23304-1.rs b/src/test/run-pass/issues/issue-23304-1.rs index 0a6b4e41e2e..1805c1c19b9 100644 --- a/src/test/run-pass/issues/issue-23304-1.rs +++ b/src/test/run-pass/issues/issue-23304-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-23304-2.rs b/src/test/run-pass/issues/issue-23304-2.rs index 511bec0dde9..6376fdb6545 100644 --- a/src/test/run-pass/issues/issue-23304-2.rs +++ b/src/test/run-pass/issues/issue-23304-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-23311.rs b/src/test/run-pass/issues/issue-23311.rs index 3c91f5e1dfe..f275c6338b1 100644 --- a/src/test/run-pass/issues/issue-23311.rs +++ b/src/test/run-pass/issues/issue-23311.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we do not ICE when pattern matching an array against a slice. diff --git a/src/test/run-pass/issues/issue-23336.rs b/src/test/run-pass/issues/issue-23336.rs index 0f0477bf844..cd71d7eed89 100644 --- a/src/test/run-pass/issues/issue-23336.rs +++ b/src/test/run-pass/issues/issue-23336.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub trait Data { fn doit(&self) {} } impl Data for T {} diff --git a/src/test/run-pass/issues/issue-23338-ensure-param-drop-order.rs b/src/test/run-pass/issues/issue-23338-ensure-param-drop-order.rs index f1029a8c49a..823be8c832d 100644 --- a/src/test/run-pass/issues/issue-23338-ensure-param-drop-order.rs +++ b/src/test/run-pass/issues/issue-23338-ensure-param-drop-order.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-23338-params-outlive-temps-of-body.rs b/src/test/run-pass/issues/issue-23338-params-outlive-temps-of-body.rs index e5eb41b235d..d45aaa843fb 100644 --- a/src/test/run-pass/issues/issue-23338-params-outlive-temps-of-body.rs +++ b/src/test/run-pass/issues/issue-23338-params-outlive-temps-of-body.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This is largely checking that we now accept code where temp values // are borrowing from the input parameters (the `foo` case below). diff --git a/src/test/run-pass/issues/issue-23433.rs b/src/test/run-pass/issues/issue-23433.rs index 9c1e9b00000..d4fbbde62ff 100644 --- a/src/test/run-pass/issues/issue-23433.rs +++ b/src/test/run-pass/issues/issue-23433.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Don't fail if we encounter a NonNull where T is an unsized type diff --git a/src/test/run-pass/issues/issue-23485.rs b/src/test/run-pass/issues/issue-23485.rs index 0699dc13c15..a55846f40df 100644 --- a/src/test/run-pass/issues/issue-23485.rs +++ b/src/test/run-pass/issues/issue-23485.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // Test for an ICE that occurred when a default method implementation diff --git a/src/test/run-pass/issues/issue-23491.rs b/src/test/run-pass/issues/issue-23491.rs index 54f66d34f39..d2ded88aeff 100644 --- a/src/test/run-pass/issues/issue-23491.rs +++ b/src/test/run-pass/issues/issue-23491.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-23611-enum-swap-in-drop.rs b/src/test/run-pass/issues/issue-23611-enum-swap-in-drop.rs index ab5a89cbba3..6ef7fd42ec6 100644 --- a/src/test/run-pass/issues/issue-23611-enum-swap-in-drop.rs +++ b/src/test/run-pass/issues/issue-23611-enum-swap-in-drop.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-23649-1.rs b/src/test/run-pass/issues/issue-23649-1.rs index f270f536cf1..fc0c9a605fa 100644 --- a/src/test/run-pass/issues/issue-23649-1.rs +++ b/src/test/run-pass/issues/issue-23649-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem; diff --git a/src/test/run-pass/issues/issue-23649-2.rs b/src/test/run-pass/issues/issue-23649-2.rs index 6cdd94c381e..f5fb8b65020 100644 --- a/src/test/run-pass/issues/issue-23649-2.rs +++ b/src/test/run-pass/issues/issue-23649-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no std::path diff --git a/src/test/run-pass/issues/issue-23699.rs b/src/test/run-pass/issues/issue-23699.rs index 747fc172023..11b65d7a67a 100644 --- a/src/test/run-pass/issues/issue-23699.rs +++ b/src/test/run-pass/issues/issue-23699.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] fn gimme_a_raw_pointer(_: *const T) { } diff --git a/src/test/run-pass/issues/issue-23781.rs b/src/test/run-pass/issues/issue-23781.rs index fcd6dd196ac..220ebdb1872 100644 --- a/src/test/run-pass/issues/issue-23781.rs +++ b/src/test/run-pass/issues/issue-23781.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::fmt; diff --git a/src/test/run-pass/issues/issue-2380-b.rs b/src/test/run-pass/issues/issue-2380-b.rs index fe28c2f3f1b..d708c7b4213 100644 --- a/src/test/run-pass/issues/issue-2380-b.rs +++ b/src/test/run-pass/issues/issue-2380-b.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-2380.rs diff --git a/src/test/run-pass/issues/issue-23808.rs b/src/test/run-pass/issues/issue-23808.rs index 133da00ffaa..0988b09fce9 100644 --- a/src/test/run-pass/issues/issue-23808.rs +++ b/src/test/run-pass/issues/issue-23808.rs @@ -1,14 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass + #![deny(dead_code)] // use different types / traits to test all combinations diff --git a/src/test/run-pass/issues/issue-23825.rs b/src/test/run-pass/issues/issue-23825.rs index 2bcadefe9b8..a9f0095d2e2 100644 --- a/src/test/run-pass/issues/issue-23825.rs +++ b/src/test/run-pass/issues/issue-23825.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Stringify { fn to_string(&self) -> String; diff --git a/src/test/run-pass/issues/issue-2383.rs b/src/test/run-pass/issues/issue-2383.rs index 2e1318ee6c8..06e61ce680b 100644 --- a/src/test/run-pass/issues/issue-2383.rs +++ b/src/test/run-pass/issues/issue-2383.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-23833.rs b/src/test/run-pass/issues/issue-23833.rs index b790f721a3b..77dc5c50d7a 100644 --- a/src/test/run-pass/issues/issue-23833.rs +++ b/src/test/run-pass/issues/issue-23833.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] use std::fmt; diff --git a/src/test/run-pass/issues/issue-23891.rs b/src/test/run-pass/issues/issue-23891.rs index c2197b885c9..73467f715cb 100644 --- a/src/test/run-pass/issues/issue-23891.rs +++ b/src/test/run-pass/issues/issue-23891.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! id { ($s: pat) => ($s); diff --git a/src/test/run-pass/issues/issue-23898.rs b/src/test/run-pass/issues/issue-23898.rs index d06814d620e..a8787f279b7 100644 --- a/src/test/run-pass/issues/issue-23898.rs +++ b/src/test/run-pass/issues/issue-23898.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-23958.rs b/src/test/run-pass/issues/issue-23958.rs index 6f9e7e21668..7e90d758600 100644 --- a/src/test/run-pass/issues/issue-23958.rs +++ b/src/test/run-pass/issues/issue-23958.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Collection where for<'a> &'a Self: IntoIterator { fn my_iter(&self) -> <&Self as IntoIterator>::IntoIter { diff --git a/src/test/run-pass/issues/issue-23968-const-not-overflow.rs b/src/test/run-pass/issues/issue-23968-const-not-overflow.rs index d51167c47f8..b9593021235 100644 --- a/src/test/run-pass/issues/issue-23968-const-not-overflow.rs +++ b/src/test/run-pass/issues/issue-23968-const-not-overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const U8_MAX_HALF: u8 = !0u8 / 2; const U16_MAX_HALF: u16 = !0u16 / 2; diff --git a/src/test/run-pass/issues/issue-23992.rs b/src/test/run-pass/issues/issue-23992.rs index be8588f33a2..1ff44bd7f2d 100644 --- a/src/test/run-pass/issues/issue-23992.rs +++ b/src/test/run-pass/issues/issue-23992.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub struct Outer(T); pub struct Inner<'a> { value: &'a bool } diff --git a/src/test/run-pass/issues/issue-24010.rs b/src/test/run-pass/issues/issue-24010.rs index cce8bb84837..1f68d47d97b 100644 --- a/src/test/run-pass/issues/issue-24010.rs +++ b/src/test/run-pass/issues/issue-24010.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo: Fn(i32) -> i32 + Send {} impl i32 + Send> Foo for T {} diff --git a/src/test/run-pass/issues/issue-24086.rs b/src/test/run-pass/issues/issue-24086.rs index 1d86c4201b5..86fa5a6f368 100644 --- a/src/test/run-pass/issues/issue-24086.rs +++ b/src/test/run-pass/issues/issue-24086.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_mut)] diff --git a/src/test/run-pass/issues/issue-2414-c.rs b/src/test/run-pass/issues/issue-2414-c.rs index d285074accf..f6fe9798067 100644 --- a/src/test/run-pass/issues/issue-2414-c.rs +++ b/src/test/run-pass/issues/issue-2414-c.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-2414-a.rs // aux-build:issue-2414-b.rs diff --git a/src/test/run-pass/issues/issue-2428.rs b/src/test/run-pass/issues/issue-2428.rs index 5a0c9f5a85b..94b830de3e6 100644 --- a/src/test/run-pass/issues/issue-2428.rs +++ b/src/test/run-pass/issues/issue-2428.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-24308.rs b/src/test/run-pass/issues/issue-24308.rs index 6cbdd61273f..9c39a5d2238 100644 --- a/src/test/run-pass/issues/issue-24308.rs +++ b/src/test/run-pass/issues/issue-24308.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub trait Foo { fn method1() {} diff --git a/src/test/run-pass/issues/issue-24313.rs b/src/test/run-pass/issues/issue-24313.rs index cd20ab5a843..d6426361fae 100644 --- a/src/test/run-pass/issues/issue-24313.rs +++ b/src/test/run-pass/issues/issue-24313.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no processes // ignore-emscripten no threads diff --git a/src/test/run-pass/issues/issue-24353.rs b/src/test/run-pass/issues/issue-24353.rs index 753905c2b2f..f78255b7e2b 100644 --- a/src/test/run-pass/issues/issue-24353.rs +++ b/src/test/run-pass/issues/issue-24353.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] fn main() { diff --git a/src/test/run-pass/issues/issue-2445-b.rs b/src/test/run-pass/issues/issue-2445-b.rs index b9e773a5d4f..f369eae3af3 100644 --- a/src/test/run-pass/issues/issue-2445-b.rs +++ b/src/test/run-pass/issues/issue-2445-b.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-2445.rs b/src/test/run-pass/issues/issue-2445.rs index 95782e83ffb..5730ce16574 100644 --- a/src/test/run-pass/issues/issue-2445.rs +++ b/src/test/run-pass/issues/issue-2445.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-24533.rs b/src/test/run-pass/issues/issue-24533.rs index d2104cacd0c..8592bf43072 100644 --- a/src/test/run-pass/issues/issue-24533.rs +++ b/src/test/run-pass/issues/issue-24533.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] use std::slice::Iter; diff --git a/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs b/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs index 10a4678107e..68f7dfd38f4 100644 --- a/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs +++ b/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This test illustrates that under NLL, we can remove our overly // conservative approach for disallowing mutations of match inputs. diff --git a/src/test/run-pass/issues/issue-24589.rs b/src/test/run-pass/issues/issue-24589.rs index 825e3cbd93b..6b03e14f961 100644 --- a/src/test/run-pass/issues/issue-24589.rs +++ b/src/test/run-pass/issues/issue-24589.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub struct _X([u8]); diff --git a/src/test/run-pass/issues/issue-2463.rs b/src/test/run-pass/issues/issue-2463.rs index 8a1b6e45e72..d24a47c53d9 100644 --- a/src/test/run-pass/issues/issue-2463.rs +++ b/src/test/run-pass/issues/issue-2463.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-2472.rs b/src/test/run-pass/issues/issue-2472.rs index bc078ea49cf..cadd0151b4e 100644 --- a/src/test/run-pass/issues/issue-2472.rs +++ b/src/test/run-pass/issues/issue-2472.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_2472_b.rs diff --git a/src/test/run-pass/issues/issue-24779.rs b/src/test/run-pass/issues/issue-24779.rs index 85ab4c6d4c5..f1283d0dcf5 100644 --- a/src/test/run-pass/issues/issue-24779.rs +++ b/src/test/run-pass/issues/issue-24779.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { assert_eq!((||||42)()(), 42); diff --git a/src/test/run-pass/issues/issue-24805-dropck-itemless.rs b/src/test/run-pass/issues/issue-24805-dropck-itemless.rs index 1d1bd21075b..db427ed3d31 100644 --- a/src/test/run-pass/issues/issue-24805-dropck-itemless.rs +++ b/src/test/run-pass/issues/issue-24805-dropck-itemless.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(deprecated)] @@ -23,7 +13,7 @@ trait UserDefined { } impl UserDefined for i32 { } impl<'a, T> UserDefined for &'a T { } -// e.g. `impl_drop!(Send, D_Send)` expands to: +// e.g., `impl_drop!(Send, D_Send)` expands to: // ```rust // struct D_Send(T); // impl Drop for D_Send { fn drop(&mut self) { } } diff --git a/src/test/run-pass/issues/issue-24945-repeat-dash-opts.rs b/src/test/run-pass/issues/issue-24945-repeat-dash-opts.rs index 5206acb8e94..cf3834952c6 100644 --- a/src/test/run-pass/issues/issue-24945-repeat-dash-opts.rs +++ b/src/test/run-pass/issues/issue-24945-repeat-dash-opts.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This test is just checking that we continue to accept `-g -g -O -O` // as options to the compiler. diff --git a/src/test/run-pass/issues/issue-24947.rs b/src/test/run-pass/issues/issue-24947.rs index 91549128447..23705b4c9e7 100644 --- a/src/test/run-pass/issues/issue-24947.rs +++ b/src/test/run-pass/issues/issue-24947.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // #24947 ICE using a trait-associated const in an array size diff --git a/src/test/run-pass/issues/issue-24954.rs b/src/test/run-pass/issues/issue-24954.rs index e8f135f7f67..0177dd4eae5 100644 --- a/src/test/run-pass/issues/issue-24954.rs +++ b/src/test/run-pass/issues/issue-24954.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! foo { ($y:expr) => ({ diff --git a/src/test/run-pass/issues/issue-25089.rs b/src/test/run-pass/issues/issue-25089.rs index e059ac329b4..cf261d43c55 100644 --- a/src/test/run-pass/issues/issue-25089.rs +++ b/src/test/run-pass/issues/issue-25089.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/issues/issue-25145.rs b/src/test/run-pass/issues/issue-25145.rs index 79b1e7c5ef8..f5ae28fbbab 100644 --- a/src/test/run-pass/issues/issue-25145.rs +++ b/src/test/run-pass/issues/issue-25145.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct S; diff --git a/src/test/run-pass/issues/issue-25185.rs b/src/test/run-pass/issues/issue-25185.rs index 764cfdc187a..383c9a1e9c4 100644 --- a/src/test/run-pass/issues/issue-25185.rs +++ b/src/test/run-pass/issues/issue-25185.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-25185-1.rs // aux-build:issue-25185-2.rs diff --git a/src/test/run-pass/issues/issue-2526-a.rs b/src/test/run-pass/issues/issue-2526-a.rs index 210ad831859..f3fdc0bd377 100644 --- a/src/test/run-pass/issues/issue-2526-a.rs +++ b/src/test/run-pass/issues/issue-2526-a.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-2526.rs diff --git a/src/test/run-pass/issues/issue-25279.rs b/src/test/run-pass/issues/issue-25279.rs index 47714cef2d5..fdc516d3761 100644 --- a/src/test/run-pass/issues/issue-25279.rs +++ b/src/test/run-pass/issues/issue-25279.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct S<'a>(&'a ()); diff --git a/src/test/run-pass/issues/issue-25339.rs b/src/test/run-pass/issues/issue-25339.rs index 4551b38b5cd..602f458e4cf 100644 --- a/src/test/run-pass/issues/issue-25339.rs +++ b/src/test/run-pass/issues/issue-25339.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-25343.rs b/src/test/run-pass/issues/issue-25343.rs index 40e9924e5d5..95a0bd9155d 100644 --- a/src/test/run-pass/issues/issue-25343.rs +++ b/src/test/run-pass/issues/issue-25343.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[allow(unused)] fn main() { diff --git a/src/test/run-pass/issues/issue-25467.rs b/src/test/run-pass/issues/issue-25467.rs index 0f078b214ed..31ac5f0f34b 100644 --- a/src/test/run-pass/issues/issue-25467.rs +++ b/src/test/run-pass/issues/issue-25467.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // aux-build:issue-25467.rs diff --git a/src/test/run-pass/issues/issue-25497.rs b/src/test/run-pass/issues/issue-25497.rs index ab5a0bf92f0..25f5ab90f7f 100644 --- a/src/test/run-pass/issues/issue-25497.rs +++ b/src/test/run-pass/issues/issue-25497.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Clone, Debug, PartialEq)] enum Expression { diff --git a/src/test/run-pass/issues/issue-2550.rs b/src/test/run-pass/issues/issue-2550.rs index afe837509b9..04ec66b80d7 100644 --- a/src/test/run-pass/issues/issue-2550.rs +++ b/src/test/run-pass/issues/issue-2550.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-25515.rs b/src/test/run-pass/issues/issue-25515.rs index 03ad360bcd3..75af16d8dda 100644 --- a/src/test/run-pass/issues/issue-25515.rs +++ b/src/test/run-pass/issues/issue-25515.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::rc::Rc; diff --git a/src/test/run-pass/issues/issue-25549-multiple-drop.rs b/src/test/run-pass/issues/issue-25549-multiple-drop.rs index ccb438a8c23..db9261f6ef4 100644 --- a/src/test/run-pass/issues/issue-25549-multiple-drop.rs +++ b/src/test/run-pass/issues/issue-25549-multiple-drop.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] struct Foo<'r>(&'r mut i32); diff --git a/src/test/run-pass/issues/issue-25679.rs b/src/test/run-pass/issues/issue-25679.rs index 29e4b44592f..89544c9eb88 100644 --- a/src/test/run-pass/issues/issue-25679.rs +++ b/src/test/run-pass/issues/issue-25679.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Device { type Resources; diff --git a/src/test/run-pass/issues/issue-25693.rs b/src/test/run-pass/issues/issue-25693.rs index 174fc832598..9af0ba100e8 100644 --- a/src/test/run-pass/issues/issue-25693.rs +++ b/src/test/run-pass/issues/issue-25693.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] pub trait Parameters { type SelfRef; } diff --git a/src/test/run-pass/issues/issue-25700-1.rs b/src/test/run-pass/issues/issue-25700-1.rs index f1109ac93cd..7bc9673a5be 100644 --- a/src/test/run-pass/issues/issue-25700-1.rs +++ b/src/test/run-pass/issues/issue-25700-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct S(Option<&'static T>); diff --git a/src/test/run-pass/issues/issue-25700-2.rs b/src/test/run-pass/issues/issue-25700-2.rs index 99c381042bf..65de5edce48 100644 --- a/src/test/run-pass/issues/issue-25700-2.rs +++ b/src/test/run-pass/issues/issue-25700-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub trait Parser { type Input; diff --git a/src/test/run-pass/issues/issue-25746-bool-transmute.rs b/src/test/run-pass/issues/issue-25746-bool-transmute.rs index da63bc61607..bc2f4a7c1b7 100644 --- a/src/test/run-pass/issues/issue-25746-bool-transmute.rs +++ b/src/test/run-pass/issues/issue-25746-bool-transmute.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem::transmute; diff --git a/src/test/run-pass/issues/issue-25757.rs b/src/test/run-pass/issues/issue-25757.rs index f2fbef2c581..caade6defdd 100644 --- a/src/test/run-pass/issues/issue-25757.rs +++ b/src/test/run-pass/issues/issue-25757.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo { a: u32 diff --git a/src/test/run-pass/issues/issue-25810.rs b/src/test/run-pass/issues/issue-25810.rs index 986ba48d4b7..f32216f3254 100644 --- a/src/test/run-pass/issues/issue-25810.rs +++ b/src/test/run-pass/issues/issue-25810.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let x = X(15); diff --git a/src/test/run-pass/issues/issue-25916.rs b/src/test/run-pass/issues/issue-25916.rs index c71af4660fb..0b415947965 100644 --- a/src/test/run-pass/issues/issue-25916.rs +++ b/src/test/run-pass/issues/issue-25916.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] diff --git a/src/test/run-pass/issues/issue-26127.rs b/src/test/run-pass/issues/issue-26127.rs index c2634ed5690..cb479a23085 100644 --- a/src/test/run-pass/issues/issue-26127.rs +++ b/src/test/run-pass/issues/issue-26127.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Tr { type T; } impl Tr for u8 { type T=(); } diff --git a/src/test/run-pass/issues/issue-26251.rs b/src/test/run-pass/issues/issue-26251.rs index 20ad091695a..0434ef9e5a9 100644 --- a/src/test/run-pass/issues/issue-26251.rs +++ b/src/test/run-pass/issues/issue-26251.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let x = 'a'; diff --git a/src/test/run-pass/issues/issue-2631-b.rs b/src/test/run-pass/issues/issue-2631-b.rs index d53741b470e..c7f6728e3f2 100644 --- a/src/test/run-pass/issues/issue-2631-b.rs +++ b/src/test/run-pass/issues/issue-2631-b.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-2631-a.rs diff --git a/src/test/run-pass/issues/issue-26322.rs b/src/test/run-pass/issues/issue-26322.rs index 23f6a739bd5..c1dc80eb7c5 100644 --- a/src/test/run-pass/issues/issue-26322.rs +++ b/src/test/run-pass/issues/issue-26322.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] #![allow(non_snake_case)] @@ -32,9 +22,9 @@ fn main() { columnline!() } else { (0, 0) }; let cl = columnline!(); - assert_eq!(closure(), (9, 29)); - assert_eq!(iflet, (9, 32)); - assert_eq!(cl, (14, 34)); + assert_eq!(closure(), (9, 19)); + assert_eq!(iflet, (9, 22)); + assert_eq!(cl, (14, 24)); let indirect = indirectcolumnline!(); - assert_eq!(indirect, (20, 38)); + assert_eq!(indirect, (20, 28)); } diff --git a/src/test/run-pass/issues/issue-2633-2.rs b/src/test/run-pass/issues/issue-2633-2.rs index ffc2b6a32a5..02c1a166301 100644 --- a/src/test/run-pass/issues/issue-2633-2.rs +++ b/src/test/run-pass/issues/issue-2633-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-2633.rs b/src/test/run-pass/issues/issue-2633.rs index 410339d37f1..7e8cea75fc8 100644 --- a/src/test/run-pass/issues/issue-2633.rs +++ b/src/test/run-pass/issues/issue-2633.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-2642.rs b/src/test/run-pass/issues/issue-2642.rs index 94d8adfa323..95c5632258e 100644 --- a/src/test/run-pass/issues/issue-2642.rs +++ b/src/test/run-pass/issues/issue-2642.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-26468.rs b/src/test/run-pass/issues/issue-26468.rs index 2c9a48802a6..71cc90e8bd1 100644 --- a/src/test/run-pass/issues/issue-26468.rs +++ b/src/test/run-pass/issues/issue-26468.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-26484.rs b/src/test/run-pass/issues/issue-26484.rs index 66fb1df1675..3b40b3dd8f0 100644 --- a/src/test/run-pass/issues/issue-26484.rs +++ b/src/test/run-pass/issues/issue-26484.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags:-g diff --git a/src/test/run-pass/issues/issue-26641.rs b/src/test/run-pass/issues/issue-26641.rs index 90c2243222c..297b1d689a6 100644 --- a/src/test/run-pass/issues/issue-26641.rs +++ b/src/test/run-pass/issues/issue-26641.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Parser<'a>(Box); diff --git a/src/test/run-pass/issues/issue-26655.rs b/src/test/run-pass/issues/issue-26655.rs index db373f2cc8d..4c01183a440 100644 --- a/src/test/run-pass/issues/issue-26655.rs +++ b/src/test/run-pass/issues/issue-26655.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/issues/issue-26709.rs b/src/test/run-pass/issues/issue-26709.rs index f8f20405a3d..84cd2137367 100644 --- a/src/test/run-pass/issues/issue-26709.rs +++ b/src/test/run-pass/issues/issue-26709.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Wrapper<'a, T: ?Sized>(&'a mut i32, T); diff --git a/src/test/run-pass/issues/issue-26802.rs b/src/test/run-pass/issues/issue-26802.rs index 85d4e4a3f9f..c4aa70d5022 100644 --- a/src/test/run-pass/issues/issue-26802.rs +++ b/src/test/run-pass/issues/issue-26802.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo<'a> { fn bar<'b>(&self, x: &'b u8) -> u8 where 'a: 'b { *x+7 } diff --git a/src/test/run-pass/issues/issue-26805.rs b/src/test/run-pass/issues/issue-26805.rs index 0459c654458..950d98315d0 100644 --- a/src/test/run-pass/issues/issue-26805.rs +++ b/src/test/run-pass/issues/issue-26805.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct NonOrd; diff --git a/src/test/run-pass/issues/issue-26873-multifile.rs b/src/test/run-pass/issues/issue-26873-multifile.rs index 803ef06eba7..7b19713fcc6 100644 --- a/src/test/run-pass/issues/issue-26873-multifile.rs +++ b/src/test/run-pass/issues/issue-26873-multifile.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/test/run-pass/issues/issue-26873-onefile.rs b/src/test/run-pass/issues/issue-26873-onefile.rs index c2f1c6cb1bf..4cfffb08e8f 100644 --- a/src/test/run-pass/issues/issue-26873-onefile.rs +++ b/src/test/run-pass/issues/issue-26873-onefile.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/test/run-pass/issues/issue-26905.rs b/src/test/run-pass/issues/issue-26905.rs index ec0f6b15a34..309e2f7e571 100644 --- a/src/test/run-pass/issues/issue-26905.rs +++ b/src/test/run-pass/issues/issue-26905.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(unsize, coerce_unsized)] diff --git a/src/test/run-pass/issues/issue-26996.rs b/src/test/run-pass/issues/issue-26996.rs index 83445c6657e..8c5d2441780 100644 --- a/src/test/run-pass/issues/issue-26996.rs +++ b/src/test/run-pass/issues/issue-26996.rs @@ -1,16 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -// This test is bogus (i.e. should be compile-fail) during the period +// This test is bogus (i.e., should be compile-fail) during the period // where #54986 is implemented and #54987 is *not* implemented. For // now: just ignore it under nll // diff --git a/src/test/run-pass/issues/issue-27021.rs b/src/test/run-pass/issues/issue-27021.rs index dbad8556aeb..ecb065b1964 100644 --- a/src/test/run-pass/issues/issue-27021.rs +++ b/src/test/run-pass/issues/issue-27021.rs @@ -1,16 +1,6 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -// This test is bogus (i.e. should be compile-fail) during the period +// This test is bogus (i.e., should be compile-fail) during the period // where #54986 is implemented and #54987 is *not* implemented. For // now: just ignore it under nll // diff --git a/src/test/run-pass/issues/issue-27054-primitive-binary-ops.rs b/src/test/run-pass/issues/issue-27054-primitive-binary-ops.rs index cd7e94a2352..c6f925de5d7 100644 --- a/src/test/run-pass/issues/issue-27054-primitive-binary-ops.rs +++ b/src/test/run-pass/issues/issue-27054-primitive-binary-ops.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let x = &mut 1; diff --git a/src/test/run-pass/issues/issue-27060.rs b/src/test/run-pass/issues/issue-27060.rs index adf3179da4f..b6ffc3ecb51 100644 --- a/src/test/run-pass/issues/issue-27060.rs +++ b/src/test/run-pass/issues/issue-27060.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #[repr(packed)] diff --git a/src/test/run-pass/issues/issue-2708.rs b/src/test/run-pass/issues/issue-2708.rs index d760e8eef68..abd5e9507f8 100644 --- a/src/test/run-pass/issues/issue-2708.rs +++ b/src/test/run-pass/issues/issue-2708.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-2718.rs b/src/test/run-pass/issues/issue-2718.rs index 4faf9216fcb..6449337eea4 100644 --- a/src/test/run-pass/issues/issue-2718.rs +++ b/src/test/run-pass/issues/issue-2718.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_unsafe)] diff --git a/src/test/run-pass/issues/issue-2723-b.rs b/src/test/run-pass/issues/issue-2723-b.rs index 34f5238cc80..41f264b6dc0 100644 --- a/src/test/run-pass/issues/issue-2723-b.rs +++ b/src/test/run-pass/issues/issue-2723-b.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_2723_a.rs diff --git a/src/test/run-pass/issues/issue-27240.rs b/src/test/run-pass/issues/issue-27240.rs index 07eb34e32ce..a22db76b9bc 100644 --- a/src/test/run-pass/issues/issue-27240.rs +++ b/src/test/run-pass/issues/issue-27240.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-27268.rs b/src/test/run-pass/issues/issue-27268.rs index fa23241a25b..fccea452fbc 100644 --- a/src/test/run-pass/issues/issue-27268.rs +++ b/src/test/run-pass/issues/issue-27268.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { const _C: &'static Fn() = &||{}; diff --git a/src/test/run-pass/issues/issue-27320.rs b/src/test/run-pass/issues/issue-27320.rs index e5df3ccd76e..d1aa56b915b 100644 --- a/src/test/run-pass/issues/issue-27320.rs +++ b/src/test/run-pass/issues/issue-27320.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-2734.rs b/src/test/run-pass/issues/issue-2734.rs index 68be1556349..fcb224e2d04 100644 --- a/src/test/run-pass/issues/issue-2734.rs +++ b/src/test/run-pass/issues/issue-2734.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-2735-2.rs b/src/test/run-pass/issues/issue-2735-2.rs index a8e81682ada..70ebce9d35a 100644 --- a/src/test/run-pass/issues/issue-2735-2.rs +++ b/src/test/run-pass/issues/issue-2735-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-2735-3.rs b/src/test/run-pass/issues/issue-2735-3.rs index 9b8c2a5142f..23301537835 100644 --- a/src/test/run-pass/issues/issue-2735-3.rs +++ b/src/test/run-pass/issues/issue-2735-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-2735.rs b/src/test/run-pass/issues/issue-2735.rs index 8e5459ad915..c48bedf14f7 100644 --- a/src/test/run-pass/issues/issue-2735.rs +++ b/src/test/run-pass/issues/issue-2735.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-27401-dropflag-reinit.rs b/src/test/run-pass/issues/issue-27401-dropflag-reinit.rs index d72c8309a5f..e137575c2f8 100644 --- a/src/test/run-pass/issues/issue-27401-dropflag-reinit.rs +++ b/src/test/run-pass/issues/issue-27401-dropflag-reinit.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty issue #37201 diff --git a/src/test/run-pass/issues/issue-2748-b.rs b/src/test/run-pass/issues/issue-2748-b.rs index 78e3a3882c2..8df735ac88e 100644 --- a/src/test/run-pass/issues/issue-2748-b.rs +++ b/src/test/run-pass/issues/issue-2748-b.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn thing<'r>(x: &'r [isize]) -> &'r [isize] { x } diff --git a/src/test/run-pass/issues/issue-27639.rs b/src/test/run-pass/issues/issue-27639.rs index 7dcbe21b7e4..945fbad91f6 100644 --- a/src/test/run-pass/issues/issue-27639.rs +++ b/src/test/run-pass/issues/issue-27639.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-27859.rs b/src/test/run-pass/issues/issue-27859.rs index e289995317f..259d706fa2a 100644 --- a/src/test/run-pass/issues/issue-27859.rs +++ b/src/test/run-pass/issues/issue-27859.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no std::env // ignore-wasm32 issue 42629 diff --git a/src/test/run-pass/issues/issue-27890.rs b/src/test/run-pass/issues/issue-27890.rs index 3526a77cbd5..0f6a932e4b8 100644 --- a/src/test/run-pass/issues/issue-27890.rs +++ b/src/test/run-pass/issues/issue-27890.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass static PLUS_ONE: &'static (Fn(i32) -> i32 + Sync) = (&|x: i32| { x + 1 }) as &'static (Fn(i32) -> i32 + Sync); diff --git a/src/test/run-pass/issues/issue-27901.rs b/src/test/run-pass/issues/issue-27901.rs index 5d02bace609..ffd90b68983 100644 --- a/src/test/run-pass/issues/issue-27901.rs +++ b/src/test/run-pass/issues/issue-27901.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Stream { type Item; } impl<'a> Stream for &'a str { type Item = u8; } diff --git a/src/test/run-pass/issues/issue-27997.rs b/src/test/run-pass/issues/issue-27997.rs index f8dba27390c..dd74cf75249 100644 --- a/src/test/run-pass/issues/issue-27997.rs +++ b/src/test/run-pass/issues/issue-27997.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::sync::atomic::{Ordering, AtomicUsize}; diff --git a/src/test/run-pass/issues/issue-28181.rs b/src/test/run-pass/issues/issue-28181.rs index 21b0100e815..c46e131c6ac 100644 --- a/src/test/run-pass/issues/issue-28181.rs +++ b/src/test/run-pass/issues/issue-28181.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn bar(f: F) -> usize where F: Fn([usize; 1]) -> usize { f([2]) } diff --git a/src/test/run-pass/issues/issue-28550.rs b/src/test/run-pass/issues/issue-28550.rs index 95b6943849c..95583f80515 100644 --- a/src/test/run-pass/issues/issue-28550.rs +++ b/src/test/run-pass/issues/issue-28550.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct AT,T>(F::Output); struct BT,T>(A); diff --git a/src/test/run-pass/issues/issue-28676.rs b/src/test/run-pass/issues/issue-28676.rs index c571c4e23ce..2b83478ca61 100644 --- a/src/test/run-pass/issues/issue-28676.rs +++ b/src/test/run-pass/issues/issue-28676.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(improper_ctypes)] diff --git a/src/test/run-pass/issues/issue-28777.rs b/src/test/run-pass/issues/issue-28777.rs index a796d211df2..74de00adadb 100644 --- a/src/test/run-pass/issues/issue-28777.rs +++ b/src/test/run-pass/issues/issue-28777.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let v1 = { 1 + {2} * {3} }; diff --git a/src/test/run-pass/issues/issue-28828.rs b/src/test/run-pass/issues/issue-28828.rs index 2fb6b5875c1..03968809eb7 100644 --- a/src/test/run-pass/issues/issue-28828.rs +++ b/src/test/run-pass/issues/issue-28828.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub trait Foo { type Out; diff --git a/src/test/run-pass/issues/issue-28839.rs b/src/test/run-pass/issues/issue-28839.rs index 1b536fe83c7..73be87a0c1e 100644 --- a/src/test/run-pass/issues/issue-28839.rs +++ b/src/test/run-pass/issues/issue-28839.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty issue #37199 diff --git a/src/test/run-pass/issues/issue-2895.rs b/src/test/run-pass/issues/issue-2895.rs index 9a1be5fef32..d8c08996bc3 100644 --- a/src/test/run-pass/issues/issue-2895.rs +++ b/src/test/run-pass/issues/issue-2895.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-28950.rs b/src/test/run-pass/issues/issue-28950.rs index b7426571fbd..8b55f42f3f4 100644 --- a/src/test/run-pass/issues/issue-28950.rs +++ b/src/test/run-pass/issues/issue-28950.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads // compile-flags: -O diff --git a/src/test/run-pass/issues/issue-28983.rs b/src/test/run-pass/issues/issue-28983.rs index d38a519cb98..3db26a1ee5f 100644 --- a/src/test/run-pass/issues/issue-28983.rs +++ b/src/test/run-pass/issues/issue-28983.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub trait Test { type T; } diff --git a/src/test/run-pass/issues/issue-29053.rs b/src/test/run-pass/issues/issue-29053.rs index 47800b48de4..34c4a0f8f3e 100644 --- a/src/test/run-pass/issues/issue-29053.rs +++ b/src/test/run-pass/issues/issue-29053.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let x: &'static str = "x"; diff --git a/src/test/run-pass/issues/issue-29071-2.rs b/src/test/run-pass/issues/issue-29071-2.rs index 84dbb40ea87..f27bf0261db 100644 --- a/src/test/run-pass/issues/issue-29071-2.rs +++ b/src/test/run-pass/issues/issue-29071-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] fn t1() -> u32 { diff --git a/src/test/run-pass/issues/issue-29092.rs b/src/test/run-pass/issues/issue-29092.rs index 3517f016675..f20d2a424b0 100644 --- a/src/test/run-pass/issues/issue-29092.rs +++ b/src/test/run-pass/issues/issue-29092.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for Issue #29092. // diff --git a/src/test/run-pass/issues/issue-29147.rs b/src/test/run-pass/issues/issue-29147.rs index 93ff713eafe..101bca307f1 100644 --- a/src/test/run-pass/issues/issue-29147.rs +++ b/src/test/run-pass/issues/issue-29147.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![recursion_limit="1024"] diff --git a/src/test/run-pass/issues/issue-29166.rs b/src/test/run-pass/issues/issue-29166.rs index 1cc2c7a8893..ca819ba39a2 100644 --- a/src/test/run-pass/issues/issue-29166.rs +++ b/src/test/run-pass/issues/issue-29166.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This test ensures that vec.into_iter does not overconstrain element lifetime. diff --git a/src/test/run-pass/issues/issue-29227.rs b/src/test/run-pass/issues/issue-29227.rs index a33bb698634..e9dfc2840e5 100644 --- a/src/test/run-pass/issues/issue-29227.rs +++ b/src/test/run-pass/issues/issue-29227.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-tidy-linelength diff --git a/src/test/run-pass/issues/issue-2935.rs b/src/test/run-pass/issues/issue-2935.rs index 6656914e419..58ade32b250 100644 --- a/src/test/run-pass/issues/issue-2935.rs +++ b/src/test/run-pass/issues/issue-2935.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-2936.rs b/src/test/run-pass/issues/issue-2936.rs index 84201348af3..6b932d01d55 100644 --- a/src/test/run-pass/issues/issue-2936.rs +++ b/src/test/run-pass/issues/issue-2936.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-29466.rs b/src/test/run-pass/issues/issue-29466.rs index 0aa4e6355d1..e28185bc3a2 100644 --- a/src/test/run-pass/issues/issue-29466.rs +++ b/src/test/run-pass/issues/issue-29466.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] macro_rules! m( diff --git a/src/test/run-pass/issues/issue-29485.rs b/src/test/run-pass/issues/issue-29485.rs index f3890f8d521..6b2fb7126e3 100644 --- a/src/test/run-pass/issues/issue-29485.rs +++ b/src/test/run-pass/issues/issue-29485.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_attributes)] // aux-build:issue-29485.rs diff --git a/src/test/run-pass/issues/issue-29488.rs b/src/test/run-pass/issues/issue-29488.rs index d9d53ceaaeb..3c9a6a80dbf 100644 --- a/src/test/run-pass/issues/issue-29488.rs +++ b/src/test/run-pass/issues/issue-29488.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/issues/issue-29522.rs b/src/test/run-pass/issues/issue-29522.rs index 75c01b2589e..3d2de5ef63a 100644 --- a/src/test/run-pass/issues/issue-29522.rs +++ b/src/test/run-pass/issues/issue-29522.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // check that we don't accidentally capture upvars just because their name diff --git a/src/test/run-pass/issues/issue-29663.rs b/src/test/run-pass/issues/issue-29663.rs index 709bea268d1..e2e89a8bfa3 100644 --- a/src/test/run-pass/issues/issue-29663.rs +++ b/src/test/run-pass/issues/issue-29663.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] // write_volatile causes an LLVM assert with composite types diff --git a/src/test/run-pass/issues/issue-29668.rs b/src/test/run-pass/issues/issue-29668.rs index f10152b29c9..3d6c27bcda1 100644 --- a/src/test/run-pass/issues/issue-29668.rs +++ b/src/test/run-pass/issues/issue-29668.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Functions can return unnameable types diff --git a/src/test/run-pass/issues/issue-29746.rs b/src/test/run-pass/issues/issue-29746.rs index c2072ddddce..428cc637f55 100644 --- a/src/test/run-pass/issues/issue-29746.rs +++ b/src/test/run-pass/issues/issue-29746.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // zip!(a1,a2,a3,a4) is equivalent to: // a1.zip(a2).zip(a3).zip(a4).map(|(((x1,x2),x3),x4)| (x1,x2,x3,x4)) diff --git a/src/test/run-pass/issues/issue-29844.rs b/src/test/run-pass/issues/issue-29844.rs index 0a17b708fcf..e08942da5e4 100644 --- a/src/test/run-pass/issues/issue-29844.rs +++ b/src/test/run-pass/issues/issue-29844.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::sync::Arc; diff --git a/src/test/run-pass/issues/issue-2989.rs b/src/test/run-pass/issues/issue-2989.rs index 7690d9a6927..c0b67374370 100644 --- a/src/test/run-pass/issues/issue-2989.rs +++ b/src/test/run-pass/issues/issue-2989.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-29914-2.rs b/src/test/run-pass/issues/issue-29914-2.rs index e3b9aa1afae..626de269d95 100644 --- a/src/test/run-pass/issues/issue-29914-2.rs +++ b/src/test/run-pass/issues/issue-29914-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const ARR: [usize; 5] = [5, 4, 3, 2, 1]; diff --git a/src/test/run-pass/issues/issue-29914-3.rs b/src/test/run-pass/issues/issue-29914-3.rs index 1d54e068a72..1c6c64eb316 100644 --- a/src/test/run-pass/issues/issue-29914-3.rs +++ b/src/test/run-pass/issues/issue-29914-3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const ARR: [usize; 5] = [5, 4, 3, 2, 1]; const BLA: usize = ARR[ARR[3]]; diff --git a/src/test/run-pass/issues/issue-29914.rs b/src/test/run-pass/issues/issue-29914.rs index 16f03592756..6da63664dfa 100644 --- a/src/test/run-pass/issues/issue-29914.rs +++ b/src/test/run-pass/issues/issue-29914.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] diff --git a/src/test/run-pass/issues/issue-29927.rs b/src/test/run-pass/issues/issue-29927.rs index ce28ebc53cd..3385e4e6e94 100644 --- a/src/test/run-pass/issues/issue-29927.rs +++ b/src/test/run-pass/issues/issue-29927.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] struct A { diff --git a/src/test/run-pass/issues/issue-29948.rs b/src/test/run-pass/issues/issue-29948.rs index 2beaaec55a1..8ede8143ea6 100644 --- a/src/test/run-pass/issues/issue-29948.rs +++ b/src/test/run-pass/issues/issue-29948.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare compiled with panic=abort by default diff --git a/src/test/run-pass/issues/issue-30018-nopanic.rs b/src/test/run-pass/issues/issue-30018-nopanic.rs index dfbdf1fdeb4..291bab2736d 100644 --- a/src/test/run-pass/issues/issue-30018-nopanic.rs +++ b/src/test/run-pass/issues/issue-30018-nopanic.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] // More thorough regression test for Issues #30018 and #30822. This diff --git a/src/test/run-pass/issues/issue-30018-panic.rs b/src/test/run-pass/issues/issue-30018-panic.rs index 0922cfb9c21..50749b0c742 100644 --- a/src/test/run-pass/issues/issue-30018-panic.rs +++ b/src/test/run-pass/issues/issue-30018-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for Issue #30018. This is very similar to the // original reported test, except that the panic is wrapped in a diff --git a/src/test/run-pass/issues/issue-30081.rs b/src/test/run-pass/issues/issue-30081.rs index b866f7f8f33..e7fca96ed9e 100644 --- a/src/test/run-pass/issues/issue-30081.rs +++ b/src/test/run-pass/issues/issue-30081.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This used to segfault #30081 diff --git a/src/test/run-pass/issues/issue-3012-2.rs b/src/test/run-pass/issues/issue-3012-2.rs index 1a64d6bb9ae..7d32c51f569 100644 --- a/src/test/run-pass/issues/issue-3012-2.rs +++ b/src/test/run-pass/issues/issue-3012-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-3012-1.rs diff --git a/src/test/run-pass/issues/issue-30240.rs b/src/test/run-pass/issues/issue-30240.rs index c18a821c0e8..ab16614fd30 100644 --- a/src/test/run-pass/issues/issue-30240.rs +++ b/src/test/run-pass/issues/issue-30240.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let &ref a = &[0i32] as &[_]; diff --git a/src/test/run-pass/issues/issue-3026.rs b/src/test/run-pass/issues/issue-3026.rs index dcd1572c1a4..1dea8134fba 100644 --- a/src/test/run-pass/issues/issue-3026.rs +++ b/src/test/run-pass/issues/issue-3026.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-3037.rs b/src/test/run-pass/issues/issue-3037.rs index 8ae7b64182d..ff4d32c2840 100644 --- a/src/test/run-pass/issues/issue-3037.rs +++ b/src/test/run-pass/issues/issue-3037.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-30371.rs b/src/test/run-pass/issues/issue-30371.rs index 3877e231527..093d4b8c119 100644 --- a/src/test/run-pass/issues/issue-30371.rs +++ b/src/test/run-pass/issues/issue-30371.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] #![allow(unused_mut)] // rust-lang/rust#54586 diff --git a/src/test/run-pass/issues/issue-30490.rs b/src/test/run-pass/issues/issue-30490.rs index 500999cc1cf..231d41cd86a 100644 --- a/src/test/run-pass/issues/issue-30490.rs +++ b/src/test/run-pass/issues/issue-30490.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no processes // ignore-emscripten no processes @@ -18,7 +8,7 @@ // where the descriptors to inherit were already stdio descriptors. // This test checks to avoid that regression. -#![cfg_attr(unix, feature(libc))] +#![cfg_attr(unix, feature(rustc_private))] #![cfg_attr(windows, allow(unused_imports))] #[cfg(unix)] diff --git a/src/test/run-pass/issues/issue-3052.rs b/src/test/run-pass/issues/issue-3052.rs index 612fd69a499..927102981e7 100644 --- a/src/test/run-pass/issues/issue-3052.rs +++ b/src/test/run-pass/issues/issue-3052.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-30530.rs b/src/test/run-pass/issues/issue-30530.rs index 0e25d72ed88..0ae270200a6 100644 --- a/src/test/run-pass/issues/issue-30530.rs +++ b/src/test/run-pass/issues/issue-30530.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for Issue #30530: alloca's created for storing // intermediate scratch values during brace-less match arms need to be diff --git a/src/test/run-pass/issues/issue-30615.rs b/src/test/run-pass/issues/issue-30615.rs index 28a21adbd29..236a181fc1d 100644 --- a/src/test/run-pass/issues/issue-30615.rs +++ b/src/test/run-pass/issues/issue-30615.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { &0u8 as *const u8 as *const PartialEq; diff --git a/src/test/run-pass/issues/issue-30756.rs b/src/test/run-pass/issues/issue-30756.rs index 6ed0d441b93..836db951bb7 100644 --- a/src/test/run-pass/issues/issue-30756.rs +++ b/src/test/run-pass/issues/issue-30756.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![forbid(unsafe_code)] diff --git a/src/test/run-pass/issues/issue-30891.rs b/src/test/run-pass/issues/issue-30891.rs index 0ec42d44902..30f55e0bd64 100644 --- a/src/test/run-pass/issues/issue-30891.rs +++ b/src/test/run-pass/issues/issue-30891.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const ERROR_CONST: bool = true; diff --git a/src/test/run-pass/issues/issue-3091.rs b/src/test/run-pass/issues/issue-3091.rs index c6103bf017f..0c0a412420a 100644 --- a/src/test/run-pass/issues/issue-3091.rs +++ b/src/test/run-pass/issues/issue-3091.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/issues/issue-3109.rs b/src/test/run-pass/issues/issue-3109.rs index 6017a9ffbe6..bd807cad753 100644 --- a/src/test/run-pass/issues/issue-3109.rs +++ b/src/test/run-pass/issues/issue-3109.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { println!("{:?}", ("hi there!", "you")); diff --git a/src/test/run-pass/issues/issue-3121.rs b/src/test/run-pass/issues/issue-3121.rs index 60b24050092..f7bbfa9f6f4 100644 --- a/src/test/run-pass/issues/issue-3121.rs +++ b/src/test/run-pass/issues/issue-3121.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-31267-additional.rs b/src/test/run-pass/issues/issue-31267-additional.rs index d07cd8e2a77..70dce2c9490 100644 --- a/src/test/run-pass/issues/issue-31267-additional.rs +++ b/src/test/run-pass/issues/issue-31267-additional.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Clone, Copy, Debug)] diff --git a/src/test/run-pass/issues/issue-31267.rs b/src/test/run-pass/issues/issue-31267.rs index 761ef1f89ff..50843c89eb4 100644 --- a/src/test/run-pass/issues/issue-31267.rs +++ b/src/test/run-pass/issues/issue-31267.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for issue #31267 diff --git a/src/test/run-pass/issues/issue-31299.rs b/src/test/run-pass/issues/issue-31299.rs index 6d3be955577..abed18d81f8 100644 --- a/src/test/run-pass/issues/issue-31299.rs +++ b/src/test/run-pass/issues/issue-31299.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for #31299. This was generating an overflow error // because of eager normalization: diff --git a/src/test/run-pass/issues/issue-31702.rs b/src/test/run-pass/issues/issue-31702.rs index 8ce06e8d343..5b24eead345 100644 --- a/src/test/run-pass/issues/issue-31702.rs +++ b/src/test/run-pass/issues/issue-31702.rs @@ -1,21 +1,6 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-31702-1.rs // aux-build:issue-31702-2.rs -// ignore-test: FIXME(#31702) when this test was added it was thought that the -// accompanying llvm update would fix it, but -// unfortunately it appears that was not the case. In -// the interest of not deleting the test, though, -// this is just tagged with ignore-test // this test is actually entirely in the linked library crates diff --git a/src/test/run-pass/issues/issue-31776.rs b/src/test/run-pass/issues/issue-31776.rs index 7386303bef5..c0d2c91e577 100644 --- a/src/test/run-pass/issues/issue-31776.rs +++ b/src/test/run-pass/issues/issue-31776.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-32008.rs b/src/test/run-pass/issues/issue-32008.rs index a04b7af813b..6c2e206796f 100644 --- a/src/test/run-pass/issues/issue-32008.rs +++ b/src/test/run-pass/issues/issue-32008.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-3211.rs b/src/test/run-pass/issues/issue-3211.rs index 8f90b710dae..49dd4fa7360 100644 --- a/src/test/run-pass/issues/issue-3211.rs +++ b/src/test/run-pass/issues/issue-3211.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { let mut x = 0; diff --git a/src/test/run-pass/issues/issue-3220.rs b/src/test/run-pass/issues/issue-3220.rs index 3183df6a4f5..7dc672edb54 100644 --- a/src/test/run-pass/issues/issue-3220.rs +++ b/src/test/run-pass/issues/issue-3220.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-32292.rs b/src/test/run-pass/issues/issue-32292.rs index 856b7e2382b..99b865391de 100644 --- a/src/test/run-pass/issues/issue-32292.rs +++ b/src/test/run-pass/issues/issue-32292.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![deny(warnings)] diff --git a/src/test/run-pass/issues/issue-32389.rs b/src/test/run-pass/issues/issue-32389.rs index 31e4a5c9e47..6824c66cb37 100644 --- a/src/test/run-pass/issues/issue-32389.rs +++ b/src/test/run-pass/issues/issue-32389.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn foo() -> T { loop {} } diff --git a/src/test/run-pass/issues/issue-32518.rs b/src/test/run-pass/issues/issue-32518.rs index bc8b11d3e66..808b40f71b3 100644 --- a/src/test/run-pass/issues/issue-32518.rs +++ b/src/test/run-pass/issues/issue-32518.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // no-prefer-dynamic // aux-build:cgu_test.rs diff --git a/src/test/run-pass/issues/issue-32805.rs b/src/test/run-pass/issues/issue-32805.rs index 4c68bed4b05..23c19473903 100644 --- a/src/test/run-pass/issues/issue-32805.rs +++ b/src/test/run-pass/issues/issue-32805.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn const_mir() -> f32 { 9007199791611905.0 } diff --git a/src/test/run-pass/issues/issue-3290.rs b/src/test/run-pass/issues/issue-3290.rs index 02f27cbf483..63e1b28a60a 100644 --- a/src/test/run-pass/issues/issue-3290.rs +++ b/src/test/run-pass/issues/issue-3290.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-32947.rs b/src/test/run-pass/issues/issue-32947.rs index 9b00a09338e..b07def21e88 100644 --- a/src/test/run-pass/issues/issue-32947.rs +++ b/src/test/run-pass/issues/issue-32947.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten FIXME(#45351) diff --git a/src/test/run-pass/issues/issue-33096.rs b/src/test/run-pass/issues/issue-33096.rs index f89295c0627..f0b472e2fe8 100644 --- a/src/test/run-pass/issues/issue-33096.rs +++ b/src/test/run-pass/issues/issue-33096.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -g diff --git a/src/test/run-pass/issues/issue-33185.rs b/src/test/run-pass/issues/issue-33185.rs index 6268454658f..0d6669146a6 100644 --- a/src/test/run-pass/issues/issue-33185.rs +++ b/src/test/run-pass/issues/issue-33185.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-33187.rs b/src/test/run-pass/issues/issue-33187.rs index a998a953b06..5226f9faf56 100644 --- a/src/test/run-pass/issues/issue-33187.rs +++ b/src/test/run-pass/issues/issue-33187.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo(::Data); diff --git a/src/test/run-pass/issues/issue-33202.rs b/src/test/run-pass/issues/issue-33202.rs index 1101861c09e..11b89ae1b47 100644 --- a/src/test/run-pass/issues/issue-33202.rs +++ b/src/test/run-pass/issues/issue-33202.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[repr(C)] pub enum CPOption { diff --git a/src/test/run-pass/issues/issue-333.rs b/src/test/run-pass/issues/issue-333.rs index 4c47ab77a48..0753aaa0797 100644 --- a/src/test/run-pass/issues/issue-333.rs +++ b/src/test/run-pass/issues/issue-333.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn quux(x: T) -> T { let f = id::; return f(x); } diff --git a/src/test/run-pass/issues/issue-33387.rs b/src/test/run-pass/issues/issue-33387.rs index def4059b9df..792ff95200a 100644 --- a/src/test/run-pass/issues/issue-33387.rs +++ b/src/test/run-pass/issues/issue-33387.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(rustc_attrs)] diff --git a/src/test/run-pass/issues/issue-33461.rs b/src/test/run-pass/issues/issue-33461.rs index 8f1665ba208..9c6c5bfe78c 100644 --- a/src/test/run-pass/issues/issue-33461.rs +++ b/src/test/run-pass/issues/issue-33461.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] use std::marker::PhantomData; diff --git a/src/test/run-pass/issues/issue-33498.rs b/src/test/run-pass/issues/issue-33498.rs index 519db8a05af..9c8a97e7e6b 100644 --- a/src/test/run-pass/issues/issue-33498.rs +++ b/src/test/run-pass/issues/issue-33498.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] pub fn main() { diff --git a/src/test/run-pass/issues/issue-33537.rs b/src/test/run-pass/issues/issue-33537.rs index 023b0e800f5..3539aa64776 100644 --- a/src/test/run-pass/issues/issue-33537.rs +++ b/src/test/run-pass/issues/issue-33537.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const fn foo() -> *const i8 { diff --git a/src/test/run-pass/issues/issue-33687.rs b/src/test/run-pass/issues/issue-33687.rs index e6841595916..ac802ed86dc 100644 --- a/src/test/run-pass/issues/issue-33687.rs +++ b/src/test/run-pass/issues/issue-33687.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(unboxed_closures)] #![feature(fn_traits)] diff --git a/src/test/run-pass/issues/issue-33770.rs b/src/test/run-pass/issues/issue-33770.rs index 5d1de986b47..7962509003f 100644 --- a/src/test/run-pass/issues/issue-33770.rs +++ b/src/test/run-pass/issues/issue-33770.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/issues/issue-3389.rs b/src/test/run-pass/issues/issue-3389.rs index 500de0f6c26..294a07229fb 100644 --- a/src/test/run-pass/issues/issue-3389.rs +++ b/src/test/run-pass/issues/issue-3389.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-33992.rs b/src/test/run-pass/issues/issue-33992.rs index cb9f5ca698d..94fccff9fc6 100644 --- a/src/test/run-pass/issues/issue-33992.rs +++ b/src/test/run-pass/issues/issue-33992.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-windows // ignore-macos diff --git a/src/test/run-pass/issues/issue-34053.rs b/src/test/run-pass/issues/issue-34053.rs index fb6417ee870..fa23ae8f95b 100644 --- a/src/test/run-pass/issues/issue-34053.rs +++ b/src/test/run-pass/issues/issue-34053.rs @@ -1,17 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +use std::sync::atomic::{AtomicUsize, Ordering}; -static DROP_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; +static DROP_COUNTER: AtomicUsize = AtomicUsize::new(0); struct A(i32); diff --git a/src/test/run-pass/issues/issue-34074.rs b/src/test/run-pass/issues/issue-34074.rs index 3f64cfd2e58..0600d3937c1 100644 --- a/src/test/run-pass/issues/issue-34074.rs +++ b/src/test/run-pass/issues/issue-34074.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Make sure several unnamed function parameters don't conflict with each other diff --git a/src/test/run-pass/issues/issue-3429.rs b/src/test/run-pass/issues/issue-3429.rs index d6bc8739377..9d94c3ff61c 100644 --- a/src/test/run-pass/issues/issue-3429.rs +++ b/src/test/run-pass/issues/issue-3429.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-34427.rs b/src/test/run-pass/issues/issue-34427.rs index b43e9ff8b52..a14b5b9e278 100644 --- a/src/test/run-pass/issues/issue-34427.rs +++ b/src/test/run-pass/issues/issue-34427.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue #34427: On ARM, the code in `foo` at one time was generating // a machine code instruction of the form: `str r0, [r0, rN]!` (for diff --git a/src/test/run-pass/issues/issue-3447.rs b/src/test/run-pass/issues/issue-3447.rs index 374dda09033..1e329d1522a 100644 --- a/src/test/run-pass/issues/issue-3447.rs +++ b/src/test/run-pass/issues/issue-3447.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-34503.rs b/src/test/run-pass/issues/issue-34503.rs index b470518fd43..1fb4b8759bd 100644 --- a/src/test/run-pass/issues/issue-34503.rs +++ b/src/test/run-pass/issues/issue-34503.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { struct X; diff --git a/src/test/run-pass/issues/issue-34569.rs b/src/test/run-pass/issues/issue-34569.rs index 1bdd56b15ab..1f68560509e 100644 --- a/src/test/run-pass/issues/issue-34569.rs +++ b/src/test/run-pass/issues/issue-34569.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags:-g diff --git a/src/test/run-pass/issues/issue-34571.rs b/src/test/run-pass/issues/issue-34571.rs index dbb85007be8..bad1bebc697 100644 --- a/src/test/run-pass/issues/issue-34571.rs +++ b/src/test/run-pass/issues/issue-34571.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[repr(u8)] enum Foo { diff --git a/src/test/run-pass/issues/issue-34784.rs b/src/test/run-pass/issues/issue-34784.rs index fe257d57e98..4392637c39f 100644 --- a/src/test/run-pass/issues/issue-34784.rs +++ b/src/test/run-pass/issues/issue-34784.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] const C: *const u8 = &0; diff --git a/src/test/run-pass/issues/issue-34796.rs b/src/test/run-pass/issues/issue-34796.rs index 8de25508687..a81040b8f4d 100644 --- a/src/test/run-pass/issues/issue-34796.rs +++ b/src/test/run-pass/issues/issue-34796.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // This test case exposes conditions where the encoding of a trait object type diff --git a/src/test/run-pass/issues/issue-34798.rs b/src/test/run-pass/issues/issue-34798.rs index 33e78be4889..f0d710123cd 100644 --- a/src/test/run-pass/issues/issue-34798.rs +++ b/src/test/run-pass/issues/issue-34798.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![forbid(improper_ctypes)] #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-34932.rs b/src/test/run-pass/issues/issue-34932.rs index 8f249c32110..3a5fd20ebc3 100644 --- a/src/test/run-pass/issues/issue-34932.rs +++ b/src/test/run-pass/issues/issue-34932.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags:--test // rustc-env:RUSTC_BOOTSTRAP_KEY= diff --git a/src/test/run-pass/issues/issue-3500.rs b/src/test/run-pass/issues/issue-3500.rs index c4d3255cd30..7b39cc16cab 100644 --- a/src/test/run-pass/issues/issue-3500.rs +++ b/src/test/run-pass/issues/issue-3500.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-35423.rs b/src/test/run-pass/issues/issue-35423.rs index 969925679fa..202ffcc1d0d 100644 --- a/src/test/run-pass/issues/issue-35423.rs +++ b/src/test/run-pass/issues/issue-35423.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main () { let x = 4; diff --git a/src/test/run-pass/issues/issue-3556.rs b/src/test/run-pass/issues/issue-3556.rs index 8b2cc17796f..3c1934ade35 100644 --- a/src/test/run-pass/issues/issue-3556.rs +++ b/src/test/run-pass/issues/issue-3556.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-3559.rs b/src/test/run-pass/issues/issue-3559.rs index 8ca001691bb..9d498584a9d 100644 --- a/src/test/run-pass/issues/issue-3559.rs +++ b/src/test/run-pass/issues/issue-3559.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::collections::HashMap; diff --git a/src/test/run-pass/issues/issue-35600.rs b/src/test/run-pass/issues/issue-35600.rs index c9d9f9598f2..9d74726d279 100644 --- a/src/test/run-pass/issues/issue-35600.rs +++ b/src/test/run-pass/issues/issue-35600.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] trait Foo { diff --git a/src/test/run-pass/issues/issue-3563-3.rs b/src/test/run-pass/issues/issue-3563-3.rs index 13d74be89d8..bedfdab97d5 100644 --- a/src/test/run-pass/issues/issue-3563-3.rs +++ b/src/test/run-pass/issues/issue-3563-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] #![allow(non_snake_case)] @@ -128,7 +118,7 @@ trait Canvas { } // Here we provide an implementation of the Canvas methods for AsciiArt. -// Other implementations could also be provided (e.g. for PDF or Apple's Quartz) +// Other implementations could also be provided (e.g., for PDF or Apple's Quartz) // and code can use them polymorphically via the Canvas trait. impl Canvas for AsciiArt { fn add_point(&mut self, shape: Point) { diff --git a/src/test/run-pass/issues/issue-3574.rs b/src/test/run-pass/issues/issue-3574.rs index 1b5f80031b7..eb967577ffb 100644 --- a/src/test/run-pass/issues/issue-3574.rs +++ b/src/test/run-pass/issues/issue-3574.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // rustc --test match_borrowed_str.rs.rs && ./match_borrowed_str.rs diff --git a/src/test/run-pass/issues/issue-35815.rs b/src/test/run-pass/issues/issue-35815.rs index 32b73de1118..70e0ed9f7ce 100644 --- a/src/test/run-pass/issues/issue-35815.rs +++ b/src/test/run-pass/issues/issue-35815.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] use std::mem; diff --git a/src/test/run-pass/issues/issue-36023.rs b/src/test/run-pass/issues/issue-36023.rs index 54a36c6f1b3..64d92bf8c3c 100644 --- a/src/test/run-pass/issues/issue-36023.rs +++ b/src/test/run-pass/issues/issue-36023.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] use std::ops::Deref; diff --git a/src/test/run-pass/issues/issue-36036-associated-type-layout.rs b/src/test/run-pass/issues/issue-36036-associated-type-layout.rs index 772a936af86..022f9a5d556 100644 --- a/src/test/run-pass/issues/issue-36036-associated-type-layout.rs +++ b/src/test/run-pass/issues/issue-36036-associated-type-layout.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue 36036: computing the layout of a type composed from another // trait's associated type caused compiler to ICE when the associated diff --git a/src/test/run-pass/issues/issue-36053.rs b/src/test/run-pass/issues/issue-36053.rs index 3f1fa529d72..a61c02c0a12 100644 --- a/src/test/run-pass/issues/issue-36053.rs +++ b/src/test/run-pass/issues/issue-36053.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for #36053. ICE was caused due to obligations being // added to a special, dedicated fulfillment cx during a diff --git a/src/test/run-pass/issues/issue-36139-normalize-closure-sig.rs b/src/test/run-pass/issues/issue-36139-normalize-closure-sig.rs index 04693f4e615..2d49151ffcc 100644 --- a/src/test/run-pass/issues/issue-36139-normalize-closure-sig.rs +++ b/src/test/run-pass/issues/issue-36139-normalize-closure-sig.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Previously the closure's argument would be inferred to // >::Item, causing an error in MIR type diff --git a/src/test/run-pass/issues/issue-36260.rs b/src/test/run-pass/issues/issue-36260.rs index 052fd9d8477..728dd5ec8d0 100644 --- a/src/test/run-pass/issues/issue-36260.rs +++ b/src/test/run-pass/issues/issue-36260.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Make sure this compiles without getting a linker error because of missing // drop-glue because the collector missed adding drop-glue for the closure: diff --git a/src/test/run-pass/issues/issue-36278-prefix-nesting.rs b/src/test/run-pass/issues/issue-36278-prefix-nesting.rs index 41c01db076e..62d1f5f8258 100644 --- a/src/test/run-pass/issues/issue-36278-prefix-nesting.rs +++ b/src/test/run-pass/issues/issue-36278-prefix-nesting.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue 36278: On an unsized struct with >1 level of nontrivial // nesting, ensure we are computing dynamic size of prefix correctly. diff --git a/src/test/run-pass/issues/issue-36381.rs b/src/test/run-pass/issues/issue-36381.rs index e7e0dca4f64..7db56f1dce8 100644 --- a/src/test/run-pass/issues/issue-36381.rs +++ b/src/test/run-pass/issues/issue-36381.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for #36381. The monomorphization collector was asserting that // there are no projection types, but the `<&str as diff --git a/src/test/run-pass/issues/issue-36401.rs b/src/test/run-pass/issues/issue-36401.rs index fb180a359dd..f51197b01c7 100644 --- a/src/test/run-pass/issues/issue-36401.rs +++ b/src/test/run-pass/issues/issue-36401.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Debug)] pub enum Event { diff --git a/src/test/run-pass/issues/issue-36474.rs b/src/test/run-pass/issues/issue-36474.rs index cfb136c1157..90ee5b3cd4b 100644 --- a/src/test/run-pass/issues/issue-36474.rs +++ b/src/test/run-pass/issues/issue-36474.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { remove_axis(&3, 0); diff --git a/src/test/run-pass/issues/issue-3656.rs b/src/test/run-pass/issues/issue-3656.rs index 63b27406198..d55a22a72b6 100644 --- a/src/test/run-pass/issues/issue-3656.rs +++ b/src/test/run-pass/issues/issue-3656.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(improper_ctypes)] @@ -19,7 +9,7 @@ // pretty-expanded FIXME #23616 // ignore-wasm32-bare no libc to test with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; use libc::{c_uint, uint32_t, c_void}; diff --git a/src/test/run-pass/issues/issue-36744-bitcast-args-if-needed.rs b/src/test/run-pass/issues/issue-36744-bitcast-args-if-needed.rs index 4a566d94a50..34bbb66d979 100644 --- a/src/test/run-pass/issues/issue-36744-bitcast-args-if-needed.rs +++ b/src/test/run-pass/issues/issue-36744-bitcast-args-if-needed.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This tests for an ICE (and, if ignored, subsequent LLVM abort) when // a lifetime-parametric fn is passed into a context whose expected diff --git a/src/test/run-pass/issues/issue-36768.rs b/src/test/run-pass/issues/issue-36768.rs index c6a76b2ca13..f671cbc8205 100644 --- a/src/test/run-pass/issues/issue-36768.rs +++ b/src/test/run-pass/issues/issue-36768.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags:--test #![deny(private_in_public)] diff --git a/src/test/run-pass/issues/issue-36786-resolve-call.rs b/src/test/run-pass/issues/issue-36786-resolve-call.rs index 51aa7906b94..38461db544f 100644 --- a/src/test/run-pass/issues/issue-36786-resolve-call.rs +++ b/src/test/run-pass/issues/issue-36786-resolve-call.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Ensure that types that rely on obligations are autoderefed // correctly diff --git a/src/test/run-pass/issues/issue-36792.rs b/src/test/run-pass/issues/issue-36792.rs index 91e76140b82..99ae633dd0e 100644 --- a/src/test/run-pass/issues/issue-36792.rs +++ b/src/test/run-pass/issues/issue-36792.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn foo() -> impl Copy { foo diff --git a/src/test/run-pass/issues/issue-36816.rs b/src/test/run-pass/issues/issue-36816.rs index 292829b4d24..54690b43c46 100644 --- a/src/test/run-pass/issues/issue-36816.rs +++ b/src/test/run-pass/issues/issue-36816.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! m { () => { 1 } } macro_rules! n { () => { 1 + m!() } } diff --git a/src/test/run-pass/issues/issue-3683.rs b/src/test/run-pass/issues/issue-3683.rs index 9b39577ec65..b12c450c937 100644 --- a/src/test/run-pass/issues/issue-3683.rs +++ b/src/test/run-pass/issues/issue-3683.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { diff --git a/src/test/run-pass/issues/issue-36856.rs b/src/test/run-pass/issues/issue-36856.rs index 9aebb900183..f2dfaf3dd36 100644 --- a/src/test/run-pass/issues/issue-36856.rs +++ b/src/test/run-pass/issues/issue-36856.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for #36856. diff --git a/src/test/run-pass/issues/issue-36936.rs b/src/test/run-pass/issues/issue-36936.rs index da187ac173d..486a422b754 100644 --- a/src/test/run-pass/issues/issue-36936.rs +++ b/src/test/run-pass/issues/issue-36936.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // check that casts are not being treated as lexprs. diff --git a/src/test/run-pass/issues/issue-36954.rs b/src/test/run-pass/issues/issue-36954.rs index d12e9e41ee6..56ff9926ef1 100644 --- a/src/test/run-pass/issues/issue-36954.rs +++ b/src/test/run-pass/issues/issue-36954.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-36954.rs diff --git a/src/test/run-pass/issues/issue-3702.rs b/src/test/run-pass/issues/issue-3702.rs index dfe63913d56..1420dff063c 100644 --- a/src/test/run-pass/issues/issue-3702.rs +++ b/src/test/run-pass/issues/issue-3702.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-37109.rs b/src/test/run-pass/issues/issue-37109.rs index a683af9bbb2..1e57d5f95e8 100644 --- a/src/test/run-pass/issues/issue-37109.rs +++ b/src/test/run-pass/issues/issue-37109.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait ToRef<'a> { type Ref: 'a; diff --git a/src/test/run-pass/issues/issue-37175.rs b/src/test/run-pass/issues/issue-37175.rs index a51f829abd8..9ec9d48d18b 100644 --- a/src/test/run-pass/issues/issue-37175.rs +++ b/src/test/run-pass/issues/issue-37175.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! m { (<$t:ty>) => { stringify!($t) } } fn main() { diff --git a/src/test/run-pass/issues/issue-37222.rs b/src/test/run-pass/issues/issue-37222.rs index 114177702c5..8ea5f6b7a27 100644 --- a/src/test/run-pass/issues/issue-37222.rs +++ b/src/test/run-pass/issues/issue-37222.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #[derive(Debug, PartialEq)] diff --git a/src/test/run-pass/issues/issue-37291/auxiliary/lib.rs b/src/test/run-pass/issues/issue-37291/auxiliary/lib.rs index 67cdea807be..1b163ee1391 100644 --- a/src/test/run-pass/issues/issue-37291/auxiliary/lib.rs +++ b/src/test/run-pass/issues/issue-37291/auxiliary/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] use std::ops::Mul; diff --git a/src/test/run-pass/issues/issue-37291/main.rs b/src/test/run-pass/issues/issue-37291/main.rs index b9b827d3457..6fb6b50da20 100644 --- a/src/test/run-pass/issues/issue-37291/main.rs +++ b/src/test/run-pass/issues/issue-37291/main.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // aux-build:lib.rs diff --git a/src/test/run-pass/issues/issue-3743.rs b/src/test/run-pass/issues/issue-3743.rs index e884bc4d5c4..07741914f80 100644 --- a/src/test/run-pass/issues/issue-3743.rs +++ b/src/test/run-pass/issues/issue-3743.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // If `Mul` used an associated type for its output, this test would // work more smoothly. diff --git a/src/test/run-pass/issues/issue-3753.rs b/src/test/run-pass/issues/issue-3753.rs index 7941b016d14..dc9e42bad97 100644 --- a/src/test/run-pass/issues/issue-3753.rs +++ b/src/test/run-pass/issues/issue-3753.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue #3656 // Issue Name: pub method preceded by attribute can't be parsed diff --git a/src/test/run-pass/issues/issue-37686.rs b/src/test/run-pass/issues/issue-37686.rs index 824f80c04f9..8c376251449 100644 --- a/src/test/run-pass/issues/issue-37686.rs +++ b/src/test/run-pass/issues/issue-37686.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { match (0, 0) { diff --git a/src/test/run-pass/issues/issue-3794.rs b/src/test/run-pass/issues/issue-3794.rs index 936e9db6715..d6af65f787d 100644 --- a/src/test/run-pass/issues/issue-3794.rs +++ b/src/test/run-pass/issues/issue-3794.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-37991.rs b/src/test/run-pass/issues/issue-37991.rs index e63ba3acce3..a6ac4d5ca2e 100644 --- a/src/test/run-pass/issues/issue-37991.rs +++ b/src/test/run-pass/issues/issue-37991.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const fn foo() -> i64 { diff --git a/src/test/run-pass/issues/issue-38002.rs b/src/test/run-pass/issues/issue-38002.rs index 044d84c06d4..fdb31fc44a1 100644 --- a/src/test/run-pass/issues/issue-38002.rs +++ b/src/test/run-pass/issues/issue-38002.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Check that constant ADTs are codegened OK, part k of N. diff --git a/src/test/run-pass/issues/issue-38033.rs b/src/test/run-pass/issues/issue-38033.rs index 3f6ef26ed79..16b867ec88f 100644 --- a/src/test/run-pass/issues/issue-38033.rs +++ b/src/test/run-pass/issues/issue-38033.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::marker; use std::mem; diff --git a/src/test/run-pass/issues/issue-38074.rs b/src/test/run-pass/issues/issue-38074.rs index bae0f5fd3ff..214d6752cef 100644 --- a/src/test/run-pass/issues/issue-38074.rs +++ b/src/test/run-pass/issues/issue-38074.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten FIXME(#45351) diff --git a/src/test/run-pass/issues/issue-38091.rs b/src/test/run-pass/issues/issue-38091.rs index 2e3cf210c4a..00aa810f830 100644 --- a/src/test/run-pass/issues/issue-38091.rs +++ b/src/test/run-pass/issues/issue-38091.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(specialization)] diff --git a/src/test/run-pass/issues/issue-38190.rs b/src/test/run-pass/issues/issue-38190.rs index 86bc2ba02b8..4f83dd26383 100644 --- a/src/test/run-pass/issues/issue-38190.rs +++ b/src/test/run-pass/issues/issue-38190.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_38190.rs // ignore-pretty issue #37195 diff --git a/src/test/run-pass/issues/issue-38226.rs b/src/test/run-pass/issues/issue-38226.rs index d26807a4d68..cd569c583f3 100644 --- a/src/test/run-pass/issues/issue-38226.rs +++ b/src/test/run-pass/issues/issue-38226.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This test makes sure that we don't run into a linker error because of the // middle::reachable pass missing trait methods with default impls. diff --git a/src/test/run-pass/issues/issue-38437.rs b/src/test/run-pass/issues/issue-38437.rs index 2fec9542e0e..e1412169065 100644 --- a/src/test/run-pass/issues/issue-38437.rs +++ b/src/test/run-pass/issues/issue-38437.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Check that drop elaboration clears the "master" discriminant diff --git a/src/test/run-pass/issues/issue-3847.rs b/src/test/run-pass/issues/issue-3847.rs index 1342843f870..16e0b00b39a 100644 --- a/src/test/run-pass/issues/issue-3847.rs +++ b/src/test/run-pass/issues/issue-3847.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass mod buildings { pub struct Tower { pub height: usize } diff --git a/src/test/run-pass/issues/issue-38556.rs b/src/test/run-pass/issues/issue-38556.rs index 4f1dc22af3c..0cc247f5b9c 100644 --- a/src/test/run-pass/issues/issue-38556.rs +++ b/src/test/run-pass/issues/issue-38556.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] pub struct Foo; diff --git a/src/test/run-pass/issues/issue-38715.rs b/src/test/run-pass/issues/issue-38715.rs index 8cc1d8af89c..9d793147e24 100644 --- a/src/test/run-pass/issues/issue-38715.rs +++ b/src/test/run-pass/issues/issue-38715.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_38715.rs // aux-build:issue_38715-modern.rs diff --git a/src/test/run-pass/issues/issue-38763.rs b/src/test/run-pass/issues/issue-38763.rs index c488aa5ca1a..6e6de09225f 100644 --- a/src/test/run-pass/issues/issue-38763.rs +++ b/src/test/run-pass/issues/issue-38763.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten diff --git a/src/test/run-pass/issues/issue-3878.rs b/src/test/run-pass/issues/issue-3878.rs index 9e073c749bb..a121f0ba878 100644 --- a/src/test/run-pass/issues/issue-3878.rs +++ b/src/test/run-pass/issues/issue-3878.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-38942.rs b/src/test/run-pass/issues/issue-38942.rs index 740bf952828..308bdd6e28c 100644 --- a/src/test/run-pass/issues/issue-38942.rs +++ b/src/test/run-pass/issues/issue-38942.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // See https://github.com/rust-lang/rust/issues/38942 diff --git a/src/test/run-pass/issues/issue-3895.rs b/src/test/run-pass/issues/issue-3895.rs index 69207549126..c560ca60dd3 100644 --- a/src/test/run-pass/issues/issue-3895.rs +++ b/src/test/run-pass/issues/issue-3895.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-38987.rs b/src/test/run-pass/issues/issue-38987.rs index ef89ed6fee4..cb4e1b0d409 100644 --- a/src/test/run-pass/issues/issue-38987.rs +++ b/src/test/run-pass/issues/issue-38987.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let _ = -0x8000_0000_0000_0000_0000_0000_0000_0000i128; diff --git a/src/test/run-pass/issues/issue-3904.rs b/src/test/run-pass/issues/issue-3904.rs index 1f5b777c4d2..7beb91a28d2 100644 --- a/src/test/run-pass/issues/issue-3904.rs +++ b/src/test/run-pass/issues/issue-3904.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn example_err(prog: &str, arg: &str) { println!("{}: {}", prog, arg) diff --git a/src/test/run-pass/issues/issue-39292.rs b/src/test/run-pass/issues/issue-39292.rs index 4b79e08f334..0b8139dd795 100644 --- a/src/test/run-pass/issues/issue-39292.rs +++ b/src/test/run-pass/issues/issue-39292.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for issue #39292. The object vtable was being // incorrectly left with a null pointer. diff --git a/src/test/run-pass/issues/issue-3935.rs b/src/test/run-pass/issues/issue-3935.rs index 756bc7b5797..e98d68e0eb2 100644 --- a/src/test/run-pass/issues/issue-3935.rs +++ b/src/test/run-pass/issues/issue-3935.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq)] diff --git a/src/test/run-pass/issues/issue-39367.rs b/src/test/run-pass/issues/issue-39367.rs index 4f6ed57a7ae..bd92224bce1 100644 --- a/src/test/run-pass/issues/issue-39367.rs +++ b/src/test/run-pass/issues/issue-39367.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::Deref; diff --git a/src/test/run-pass/issues/issue-39548.rs b/src/test/run-pass/issues/issue-39548.rs index 28bf971c830..304e37bf3d6 100644 --- a/src/test/run-pass/issues/issue-39548.rs +++ b/src/test/run-pass/issues/issue-39548.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass type Array = [(); ((1 < 2) == false) as usize]; diff --git a/src/test/run-pass/issues/issue-39709.rs b/src/test/run-pass/issues/issue-39709.rs index 25d8a707fe4..8ea49c2082b 100644 --- a/src/test/run-pass/issues/issue-39709.rs +++ b/src/test/run-pass/issues/issue-39709.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_macros)] fn main() { diff --git a/src/test/run-pass/issues/issue-39720.rs b/src/test/run-pass/issues/issue-39720.rs index 157cc41cdd3..a3baa361d57 100644 --- a/src/test/run-pass/issues/issue-39720.rs +++ b/src/test/run-pass/issues/issue-39720.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-39720.stderr b/src/test/run-pass/issues/issue-39720.stderr index 7b717d86335..8121ed28940 100644 --- a/src/test/run-pass/issues/issue-39720.stderr +++ b/src/test/run-pass/issues/issue-39720.stderr @@ -1,5 +1,5 @@ warning[E0566]: conflicting representation hints - --> $DIR/issue-39720.rs:18:8 + --> $DIR/issue-39720.rs:8:8 | LL | #[repr(C)] | ^ @@ -7,7 +7,7 @@ LL | #[repr(simd)] | ^^^^ warning[E0566]: conflicting representation hints - --> $DIR/issue-39720.rs:23:8 + --> $DIR/issue-39720.rs:13:8 | LL | #[repr(C)] | ^ diff --git a/src/test/run-pass/issues/issue-3979-generics.rs b/src/test/run-pass/issues/issue-3979-generics.rs index 8402aac138e..519de1cad6e 100644 --- a/src/test/run-pass/issues/issue-3979-generics.rs +++ b/src/test/run-pass/issues/issue-3979-generics.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-3979-xcrate.rs b/src/test/run-pass/issues/issue-3979-xcrate.rs index a087504c581..0e47dee5b65 100644 --- a/src/test/run-pass/issues/issue-3979-xcrate.rs +++ b/src/test/run-pass/issues/issue-3979-xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:issue_3979_traits.rs diff --git a/src/test/run-pass/issues/issue-3979.rs b/src/test/run-pass/issues/issue-3979.rs index ce7d20b6ef1..72949d8c757 100644 --- a/src/test/run-pass/issues/issue-3979.rs +++ b/src/test/run-pass/issues/issue-3979.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-39808.rs b/src/test/run-pass/issues/issue-39808.rs index 78c67302a99..a4701367373 100644 --- a/src/test/run-pass/issues/issue-39808.rs +++ b/src/test/run-pass/issues/issue-39808.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] diff --git a/src/test/run-pass/issues/issue-39823.rs b/src/test/run-pass/issues/issue-39823.rs index 4a2e4846a59..8a52399273b 100644 --- a/src/test/run-pass/issues/issue-39823.rs +++ b/src/test/run-pass/issues/issue-39823.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_39823.rs diff --git a/src/test/run-pass/issues/issue-39827.rs b/src/test/run-pass/issues/issue-39827.rs index c7b2a0d4fc0..782c668c843 100644 --- a/src/test/run-pass/issues/issue-39827.rs +++ b/src/test/run-pass/issues/issue-39827.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(core_intrinsics)] diff --git a/src/test/run-pass/issues/issue-40003.rs b/src/test/run-pass/issues/issue-40003.rs index d2ed14d1413..642de6b8fe3 100644 --- a/src/test/run-pass/issues/issue-40003.rs +++ b/src/test/run-pass/issues/issue-40003.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] fn main() { diff --git a/src/test/run-pass/issues/issue-40085.rs b/src/test/run-pass/issues/issue-40085.rs index 062366941d9..132044cfd6d 100644 --- a/src/test/run-pass/issues/issue-40085.rs +++ b/src/test/run-pass/issues/issue-40085.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::Index; fn bar() {} diff --git a/src/test/run-pass/issues/issue-40235.rs b/src/test/run-pass/issues/issue-40235.rs index b37372c682f..0f799c3503f 100644 --- a/src/test/run-pass/issues/issue-40235.rs +++ b/src/test/run-pass/issues/issue-40235.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] fn foo() {} diff --git a/src/test/run-pass/issues/issue-40408.rs b/src/test/run-pass/issues/issue-40408.rs index 68f2858df47..81acc41cb83 100644 --- a/src/test/run-pass/issues/issue-40408.rs +++ b/src/test/run-pass/issues/issue-40408.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { println!("{}", 0E+10); diff --git a/src/test/run-pass/issues/issue-40469.rs b/src/test/run-pass/issues/issue-40469.rs index fd0ad2d0e08..2e8247e032b 100644 --- a/src/test/run-pass/issues/issue-40469.rs +++ b/src/test/run-pass/issues/issue-40469.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty issue #37195 diff --git a/src/test/run-pass/issues/issue-40770.rs b/src/test/run-pass/issues/issue-40770.rs index 566f92519b8..c9713c15798 100644 --- a/src/test/run-pass/issues/issue-40770.rs +++ b/src/test/run-pass/issues/issue-40770.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_macros)] macro_rules! m { diff --git a/src/test/run-pass/issues/issue-40847.rs b/src/test/run-pass/issues/issue-40847.rs index 4d18cd6c7de..087b40ad6cd 100644 --- a/src/test/run-pass/issues/issue-40847.rs +++ b/src/test/run-pass/issues/issue-40847.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! gen { ($name:ident ( $($dol:tt $var:ident)* ) $($body:tt)*) => { diff --git a/src/test/run-pass/issues/issue-40883.rs b/src/test/run-pass/issues/issue-40883.rs index 8de60a64ea4..37e61b1b0e6 100644 --- a/src/test/run-pass/issues/issue-40883.rs +++ b/src/test/run-pass/issues/issue-40883.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // check that we don't have linear stack usage with multiple calls to `push` diff --git a/src/test/run-pass/issues/issue-40951.rs b/src/test/run-pass/issues/issue-40951.rs index 693234a1720..49171eba6b3 100644 --- a/src/test/run-pass/issues/issue-40951.rs +++ b/src/test/run-pass/issues/issue-40951.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Regression test for #40951. diff --git a/src/test/run-pass/issues/issue-41053.rs b/src/test/run-pass/issues/issue-41053.rs index 2d9dec6bbc7..b9d8f00ff21 100644 --- a/src/test/run-pass/issues/issue-41053.rs +++ b/src/test/run-pass/issues/issue-41053.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_41053.rs diff --git a/src/test/run-pass/issues/issue-4107.rs b/src/test/run-pass/issues/issue-4107.rs index dee393d07c7..98433e806e3 100644 --- a/src/test/run-pass/issues/issue-4107.rs +++ b/src/test/run-pass/issues/issue-4107.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-41213.rs b/src/test/run-pass/issues/issue-41213.rs index 66499b0a469..5c91bf71102 100644 --- a/src/test/run-pass/issues/issue-41213.rs +++ b/src/test/run-pass/issues/issue-41213.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] enum A { diff --git a/src/test/run-pass/issues/issue-41394.rs b/src/test/run-pass/issues/issue-41394.rs index 9287c672108..37c6525234d 100644 --- a/src/test/run-pass/issues/issue-41394.rs +++ b/src/test/run-pass/issues/issue-41394.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-41394.rs diff --git a/src/test/run-pass/issues/issue-41479.rs b/src/test/run-pass/issues/issue-41479.rs index f527257207a..6daaf440e4b 100644 --- a/src/test/run-pass/issues/issue-41479.rs +++ b/src/test/run-pass/issues/issue-41479.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn split(pair: (A, B)) { let _a = pair.0; diff --git a/src/test/run-pass/issues/issue-41498.rs b/src/test/run-pass/issues/issue-41498.rs index 18acc7d7c31..ad918ecddeb 100644 --- a/src/test/run-pass/issues/issue-41498.rs +++ b/src/test/run-pass/issues/issue-41498.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // regression test for issue #41498. diff --git a/src/test/run-pass/issues/issue-41604.rs b/src/test/run-pass/issues/issue-41604.rs index c4eda86c9c0..11a1cc25b71 100644 --- a/src/test/run-pass/issues/issue-41604.rs +++ b/src/test/run-pass/issues/issue-41604.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct B; diff --git a/src/test/run-pass/issues/issue-41677.rs b/src/test/run-pass/issues/issue-41677.rs index b99a5f7f2a7..afddbc799b7 100644 --- a/src/test/run-pass/issues/issue-41677.rs +++ b/src/test/run-pass/issues/issue-41677.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for #41677. The local variable was winding up with // a type `Receiver` where `?T` was unconstrained, because we diff --git a/src/test/run-pass/issues/issue-41696.rs b/src/test/run-pass/issues/issue-41696.rs index 3937f9c1930..d094f71942f 100644 --- a/src/test/run-pass/issues/issue-41696.rs +++ b/src/test/run-pass/issues/issue-41696.rs @@ -1,16 +1,7 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] +#![recursion_limit = "128"] // this used to cause exponential code-size blowup during LLVM passes. #![feature(test)] diff --git a/src/test/run-pass/issues/issue-41744.rs b/src/test/run-pass/issues/issue-41744.rs index b667b1d929b..edc4354b253 100644 --- a/src/test/run-pass/issues/issue-41744.rs +++ b/src/test/run-pass/issues/issue-41744.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Tc {} impl Tc for bool {} diff --git a/src/test/run-pass/issues/issue-41803.rs b/src/test/run-pass/issues/issue-41803.rs index 30e3d60bd34..19ab81d04d0 100644 --- a/src/test/run-pass/issues/issue-41803.rs +++ b/src/test/run-pass/issues/issue-41803.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass /// A compile-time map from identifiers to arbitrary (heterogeneous) expressions macro_rules! ident_map { diff --git a/src/test/run-pass/issues/issue-41849-variance-req.rs b/src/test/run-pass/issues/issue-41849-variance-req.rs index 61706f6acab..af081083a35 100644 --- a/src/test/run-pass/issues/issue-41849-variance-req.rs +++ b/src/test/run-pass/issues/issue-41849-variance-req.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Regression test for #41849. diff --git a/src/test/run-pass/issues/issue-41888.rs b/src/test/run-pass/issues/issue-41888.rs index 5ae8029e224..32df520f279 100644 --- a/src/test/run-pass/issues/issue-41888.rs +++ b/src/test/run-pass/issues/issue-41888.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { let _ = g(Some(E::F(K))); } diff --git a/src/test/run-pass/issues/issue-42007.rs b/src/test/run-pass/issues/issue-42007.rs index 1347cb62d0e..de1367ec80f 100644 --- a/src/test/run-pass/issues/issue-42007.rs +++ b/src/test/run-pass/issues/issue-42007.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:issue_42007_s.rs diff --git a/src/test/run-pass/issues/issue-4208.rs b/src/test/run-pass/issues/issue-4208.rs index d47e95e9b07..3b01811a9e8 100644 --- a/src/test/run-pass/issues/issue-4208.rs +++ b/src/test/run-pass/issues/issue-4208.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:issue-4208-cc.rs diff --git a/src/test/run-pass/issues/issue-42148.rs b/src/test/run-pass/issues/issue-42148.rs index 76947e8b0ba..cb8c0d6edb6 100644 --- a/src/test/run-pass/issues/issue-42148.rs +++ b/src/test/run-pass/issues/issue-42148.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Zst; diff --git a/src/test/run-pass/issues/issue-42210.rs b/src/test/run-pass/issues/issue-42210.rs index d3b0da5e044..cf4a698f516 100644 --- a/src/test/run-pass/issues/issue-42210.rs +++ b/src/test/run-pass/issues/issue-42210.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for #42210. diff --git a/src/test/run-pass/issues/issue-4228.rs b/src/test/run-pass/issues/issue-4228.rs index e66921fe115..491000b6510 100644 --- a/src/test/run-pass/issues/issue-4228.rs +++ b/src/test/run-pass/issues/issue-4228.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-42453.rs b/src/test/run-pass/issues/issue-42453.rs index 6a4780ece6d..bea441c2bea 100644 --- a/src/test/run-pass/issues/issue-42453.rs +++ b/src/test/run-pass/issues/issue-42453.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-42463.rs b/src/test/run-pass/issues/issue-42463.rs index 9074ab8b6dd..51d6ea3f7a8 100644 --- a/src/test/run-pass/issues/issue-42463.rs +++ b/src/test/run-pass/issues/issue-42463.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::{Deref, DerefMut}; diff --git a/src/test/run-pass/issues/issue-4252.rs b/src/test/run-pass/issues/issue-4252.rs index c733bf5b764..48e617fd7eb 100644 --- a/src/test/run-pass/issues/issue-4252.rs +++ b/src/test/run-pass/issues/issue-4252.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait X { fn call(&self, x: &T); diff --git a/src/test/run-pass/issues/issue-42552.rs b/src/test/run-pass/issues/issue-42552.rs index e1c3a1bd141..50d28a2f0c6 100644 --- a/src/test/run-pass/issues/issue-42552.rs +++ b/src/test/run-pass/issues/issue-42552.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for an obscure issue with the projection cache. diff --git a/src/test/run-pass/issues/issue-42679.rs b/src/test/run-pass/issues/issue-42679.rs index 452d231a846..596309f2568 100644 --- a/src/test/run-pass/issues/issue-42679.rs +++ b/src/test/run-pass/issues/issue-42679.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] #![feature(box_patterns)] diff --git a/src/test/run-pass/issues/issue-42747.rs b/src/test/run-pass/issues/issue-42747.rs index c91de3f40ea..fec65878210 100644 --- a/src/test/run-pass/issues/issue-42747.rs +++ b/src/test/run-pass/issues/issue-42747.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! fooN { ($cur:ident $prev:ty) => { diff --git a/src/test/run-pass/issues/issue-43132.rs b/src/test/run-pass/issues/issue-43132.rs index b80e000d2e7..726a86142f6 100644 --- a/src/test/run-pass/issues/issue-43132.rs +++ b/src/test/run-pass/issues/issue-43132.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused)] diff --git a/src/test/run-pass/issues/issue-43205.rs b/src/test/run-pass/issues/issue-43205.rs index 8f89942ddfc..894a61f3eff 100644 --- a/src/test/run-pass/issues/issue-43205.rs +++ b/src/test/run-pass/issues/issue-43205.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { &&[()][0]; diff --git a/src/test/run-pass/issues/issue-43291.rs b/src/test/run-pass/issues/issue-43291.rs index cb850b54f7b..52b629e35c8 100644 --- a/src/test/run-pass/issues/issue-43291.rs +++ b/src/test/run-pass/issues/issue-43291.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { assert_eq!(!0usize as *const (), foo(0, 1)); diff --git a/src/test/run-pass/issues/issue-4333.rs b/src/test/run-pass/issues/issue-4333.rs index 0886cf0aa68..ae9f4c8bdb5 100644 --- a/src/test/run-pass/issues/issue-4333.rs +++ b/src/test/run-pass/issues/issue-4333.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-43692.rs b/src/test/run-pass/issues/issue-43692.rs index a84dd86a156..a9999c22651 100644 --- a/src/test/run-pass/issues/issue-43692.rs +++ b/src/test/run-pass/issues/issue-43692.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { assert_eq!('\u{10__FFFF}', '\u{10FFFF}'); diff --git a/src/test/run-pass/issues/issue-43853.rs b/src/test/run-pass/issues/issue-43853.rs index bb8af71b54d..47c3ab59aa2 100644 --- a/src/test/run-pass/issues/issue-43853.rs +++ b/src/test/run-pass/issues/issue-43853.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare compiled with panic=abort by default diff --git a/src/test/run-pass/issues/issue-4387.rs b/src/test/run-pass/issues/issue-4387.rs index 45c26433a20..84592f16a4c 100644 --- a/src/test/run-pass/issues/issue-4387.rs +++ b/src/test/run-pass/issues/issue-4387.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-43910.rs b/src/test/run-pass/issues/issue-43910.rs index 5c401a7f82d..d8c87732930 100644 --- a/src/test/run-pass/issues/issue-43910.rs +++ b/src/test/run-pass/issues/issue-43910.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![deny(unused_variables)] diff --git a/src/test/run-pass/issues/issue-43923.rs b/src/test/run-pass/issues/issue-43923.rs index 3f72c5d8af0..ad35a668554 100644 --- a/src/test/run-pass/issues/issue-43923.rs +++ b/src/test/run-pass/issues/issue-43923.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-4401.rs b/src/test/run-pass/issues/issue-4401.rs index 5935901efe7..fef73fbe1f5 100644 --- a/src/test/run-pass/issues/issue-4401.rs +++ b/src/test/run-pass/issues/issue-4401.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { let mut count = 0; diff --git a/src/test/run-pass/issues/issue-44333.rs b/src/test/run-pass/issues/issue-44333.rs index 28fadb9014d..fffef975043 100644 --- a/src/test/run-pass/issues/issue-44333.rs +++ b/src/test/run-pass/issues/issue-44333.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass type Func = fn(usize, usize) -> usize; diff --git a/src/test/run-pass/issues/issue-4446.rs b/src/test/run-pass/issues/issue-4446.rs index 3cd70df23cf..948f2a7bdf3 100644 --- a/src/test/run-pass/issues/issue-4446.rs +++ b/src/test/run-pass/issues/issue-4446.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/issues/issue-4448.rs b/src/test/run-pass/issues/issue-4448.rs index eb474d4c459..27d0326891b 100644 --- a/src/test/run-pass/issues/issue-4448.rs +++ b/src/test/run-pass/issues/issue-4448.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/issues/issue-45124.rs b/src/test/run-pass/issues/issue-45124.rs index da29d65ae14..942014c9184 100644 --- a/src/test/run-pass/issues/issue-45124.rs +++ b/src/test/run-pass/issues/issue-45124.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] // compile-flags: --edition 2018 diff --git a/src/test/run-pass/issues/issue-45152.rs b/src/test/run-pass/issues/issue-45152.rs index 2bba7fec396..fb1c9fb78f3 100644 --- a/src/test/run-pass/issues/issue-45152.rs +++ b/src/test/run-pass/issues/issue-45152.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-4541.rs b/src/test/run-pass/issues/issue-4541.rs index 99415297feb..1f871fcf613 100644 --- a/src/test/run-pass/issues/issue-4541.rs +++ b/src/test/run-pass/issues/issue-4541.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no std::env diff --git a/src/test/run-pass/issues/issue-4542.rs b/src/test/run-pass/issues/issue-4542.rs index 3e19e7fa583..24752114e9f 100644 --- a/src/test/run-pass/issues/issue-4542.rs +++ b/src/test/run-pass/issues/issue-4542.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 // ignore-cloudabi no std::env diff --git a/src/test/run-pass/issues/issue-4545.rs b/src/test/run-pass/issues/issue-4545.rs index 94eedbdb93a..86fcf9af21f 100644 --- a/src/test/run-pass/issues/issue-4545.rs +++ b/src/test/run-pass/issues/issue-4545.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-4545.rs diff --git a/src/test/run-pass/issues/issue-45731.rs b/src/test/run-pass/issues/issue-45731.rs index 27ecc566233..d20c07276a8 100644 --- a/src/test/run-pass/issues/issue-45731.rs +++ b/src/test/run-pass/issues/issue-45731.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // compile-flags:--test -g diff --git a/src/test/run-pass/issues/issue-46069.rs b/src/test/run-pass/issues/issue-46069.rs index 573b2b8198a..fba2a2ebe3b 100644 --- a/src/test/run-pass/issues/issue-46069.rs +++ b/src/test/run-pass/issues/issue-46069.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::iter::{Fuse, Cloned}; use std::slice::Iter; diff --git a/src/test/run-pass/issues/issue-46095.rs b/src/test/run-pass/issues/issue-46095.rs index ac6ca3923f7..59ddb60c9f2 100644 --- a/src/test/run-pass/issues/issue-46095.rs +++ b/src/test/run-pass/issues/issue-46095.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct A; diff --git a/src/test/run-pass/issues/issue-46519.rs b/src/test/run-pass/issues/issue-46519.rs index 94b7032417a..461ea2498b0 100644 --- a/src/test/run-pass/issues/issue-46519.rs +++ b/src/test/run-pass/issues/issue-46519.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags:--test -O diff --git a/src/test/run-pass/issues/issue-46553.rs b/src/test/run-pass/issues/issue-46553.rs index 001db9d8691..e21a532effd 100644 --- a/src/test/run-pass/issues/issue-46553.rs +++ b/src/test/run-pass/issues/issue-46553.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(const_fn)] #![deny(const_err)] diff --git a/src/test/run-pass/issues/issue-46845.rs b/src/test/run-pass/issues/issue-46845.rs index f8f3a2bb5bd..fc85b25519a 100644 --- a/src/test/run-pass/issues/issue-46845.rs +++ b/src/test/run-pass/issues/issue-46845.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // To work around #46855 // compile-flags: -Z mir-opt-level=0 diff --git a/src/test/run-pass/issues/issue-46855.rs b/src/test/run-pass/issues/issue-46855.rs index 3a099c241b1..aa6378f8594 100644 --- a/src/test/run-pass/issues/issue-46855.rs +++ b/src/test/run-pass/issues/issue-46855.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // compile-flags: -Zmir-opt-level=1 diff --git a/src/test/run-pass/issues/issue-46920-byte-array-patterns.rs b/src/test/run-pass/issues/issue-46920-byte-array-patterns.rs index 1e1f1f0baa9..2a8b4bb4922 100644 --- a/src/test/run-pass/issues/issue-46920-byte-array-patterns.rs +++ b/src/test/run-pass/issues/issue-46920-byte-array-patterns.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const CURSOR_PARTITION_LABEL: &'static [u8] = b"partition"; const CURSOR_EVENT_TYPE_LABEL: &'static [u8] = b"event_type"; diff --git a/src/test/run-pass/issues/issue-47139-1.rs b/src/test/run-pass/issues/issue-47139-1.rs index df225b6e0d9..c55fc34346c 100644 --- a/src/test/run-pass/issues/issue-47139-1.rs +++ b/src/test/run-pass/issues/issue-47139-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for issue #47139: // diff --git a/src/test/run-pass/issues/issue-47139-2.rs b/src/test/run-pass/issues/issue-47139-2.rs index dfc506dc8f1..d2ef8942530 100644 --- a/src/test/run-pass/issues/issue-47139-2.rs +++ b/src/test/run-pass/issues/issue-47139-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for issue #47139: // diff --git a/src/test/run-pass/issues/issue-4734.rs b/src/test/run-pass/issues/issue-4734.rs index 5bc977e1491..29c965d7ff5 100644 --- a/src/test/run-pass/issues/issue-4734.rs +++ b/src/test/run-pass/issues/issue-4734.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Ensures that destructors are run for expressions of the form "e;" where diff --git a/src/test/run-pass/issues/issue-4735.rs b/src/test/run-pass/issues/issue-4735.rs index 1b136be9a91..3ea4b01cd2b 100644 --- a/src/test/run-pass/issues/issue-4735.rs +++ b/src/test/run-pass/issues/issue-4735.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-47364.rs b/src/test/run-pass/issues/issue-47364.rs index 58e11ff1035..b524354d9a1 100644 --- a/src/test/run-pass/issues/issue-47364.rs +++ b/src/test/run-pass/issues/issue-47364.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // compile-flags: -C codegen-units=8 -O diff --git a/src/test/run-pass/issues/issue-4759-1.rs b/src/test/run-pass/issues/issue-4759-1.rs index f05cea777af..96fae0fecd9 100644 --- a/src/test/run-pass/issues/issue-4759-1.rs +++ b/src/test/run-pass/issues/issue-4759-1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait U { fn f(self); } impl U for isize { fn f(self) {} } diff --git a/src/test/run-pass/issues/issue-4759.rs b/src/test/run-pass/issues/issue-4759.rs index 12f2874341f..53785af0962 100644 --- a/src/test/run-pass/issues/issue-4759.rs +++ b/src/test/run-pass/issues/issue-4759.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 #![allow(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/issues/issue-47638.rs b/src/test/run-pass/issues/issue-47638.rs index 1a6edd9f498..357364ee612 100644 --- a/src/test/run-pass/issues/issue-47638.rs +++ b/src/test/run-pass/issues/issue-47638.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] fn id<'c, 'b>(f: &'c &'b Fn(&i32)) -> &'c &'b Fn(&'static i32) { diff --git a/src/test/run-pass/issues/issue-48159.rs b/src/test/run-pass/issues/issue-48159.rs index 2f625747b25..fc8f31fb1ef 100644 --- a/src/test/run-pass/issues/issue-48159.rs +++ b/src/test/run-pass/issues/issue-48159.rs @@ -1,15 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -#![feature(repr_packed)] #![allow(non_camel_case_types)] use std::mem; diff --git a/src/test/run-pass/issues/issue-48508-aux.rs b/src/test/run-pass/issues/issue-48508-aux.rs index 1d5ae23cb5e..ebdc70a04df 100644 --- a/src/test/run-pass/issues/issue-48508-aux.rs +++ b/src/test/run-pass/issues/issue-48508-aux.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-test Not a test. Used by issue-48508.rs diff --git a/src/test/run-pass/issues/issue-48508.rs b/src/test/run-pass/issues/issue-48508.rs index 8297d7c33a7..385192b882b 100644 --- a/src/test/run-pass/issues/issue-48508.rs +++ b/src/test/run-pass/issues/issue-48508.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for issue #48508: // diff --git a/src/test/run-pass/issues/issue-4865-1.rs b/src/test/run-pass/issues/issue-4865-1.rs index 5dd142844f5..68fbee37d01 100644 --- a/src/test/run-pass/issues/issue-4865-1.rs +++ b/src/test/run-pass/issues/issue-4865-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // This should resolve fine. diff --git a/src/test/run-pass/issues/issue-4865-2.rs b/src/test/run-pass/issues/issue-4865-2.rs index 6d0395f7ab2..cbe1d0d32c6 100644 --- a/src/test/run-pass/issues/issue-4865-2.rs +++ b/src/test/run-pass/issues/issue-4865-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Previously, this would have failed to resolve due to the circular // block between `use say` and `pub use hello::*`. diff --git a/src/test/run-pass/issues/issue-4865-3.rs b/src/test/run-pass/issues/issue-4865-3.rs index b4126337d05..12f9bba18d8 100644 --- a/src/test/run-pass/issues/issue-4865-3.rs +++ b/src/test/run-pass/issues/issue-4865-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // This should resolve fine even with the circular imports as diff --git a/src/test/run-pass/issues/issue-4875.rs b/src/test/run-pass/issues/issue-4875.rs index c1ef78242fb..8d361314f73 100644 --- a/src/test/run-pass/issues/issue-4875.rs +++ b/src/test/run-pass/issues/issue-4875.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // regression test for issue 4875 diff --git a/src/test/run-pass/issues/issue-48962.rs b/src/test/run-pass/issues/issue-48962.rs index 2fd3ad47f00..7c644789834 100644 --- a/src/test/run-pass/issues/issue-48962.rs +++ b/src/test/run-pass/issues/issue-48962.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // Test that we are able to reinitialize box with moved referent diff --git a/src/test/run-pass/issues/issue-48984.rs b/src/test/run-pass/issues/issue-48984.rs index 035c7e7fcc1..cb340f84897 100644 --- a/src/test/run-pass/issues/issue-48984.rs +++ b/src/test/run-pass/issues/issue-48984.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:issue-48984-aux.rs diff --git a/src/test/run-pass/issues/issue-49298.rs b/src/test/run-pass/issues/issue-49298.rs index db3c9792f35..56443f41020 100644 --- a/src/test/run-pass/issues/issue-49298.rs +++ b/src/test/run-pass/issues/issue-49298.rs @@ -1,18 +1,8 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(test)] #![allow(unused_mut)] // under NLL we get warning about `x` below: rust-lang/rust#54499 -// This test is bogus (i.e. should be compile-fail) during the period +// This test is bogus (i.e., should be compile-fail) during the period // where #54986 is implemented and #54987 is *not* implemented. For // now: just ignore it under nll // diff --git a/src/test/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs b/src/test/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs index ecda8b7d17e..f30d7e2edcc 100644 --- a/src/test/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs +++ b/src/test/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![deny(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/issues/issue-49632.rs b/src/test/run-pass/issues/issue-49632.rs index 2552363b9c9..155fd0d24eb 100644 --- a/src/test/run-pass/issues/issue-49632.rs +++ b/src/test/run-pass/issues/issue-49632.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(stmt_expr_attributes)] diff --git a/src/test/run-pass/issues/issue-49685.rs b/src/test/run-pass/issues/issue-49685.rs index e4dfef1e3da..fb328d67b75 100644 --- a/src/test/run-pass/issues/issue-49685.rs +++ b/src/test/run-pass/issues/issue-49685.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for #49685: drop elaboration was not revealing the // value of `impl Trait` returns, leading to an ICE. diff --git a/src/test/run-pass/issues/issue-49854.rs b/src/test/run-pass/issues/issue-49854.rs index 5dd323eaf8e..0e1db00a34c 100644 --- a/src/test/run-pass/issues/issue-49854.rs +++ b/src/test/run-pass/issues/issue-49854.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ffi::OsString; diff --git a/src/test/run-pass/issues/issue-49955-2.rs b/src/test/run-pass/issues/issue-49955-2.rs index 88883821073..267ed746322 100644 --- a/src/test/run-pass/issues/issue-49955-2.rs +++ b/src/test/run-pass/issues/issue-49955-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -Z borrowck=mir @@ -18,7 +8,7 @@ const FIVE: Cell = Cell::new(5); #[inline(never)] fn tuple_field() -> &'static u32 { // This test is MIR-borrowck-only because the old borrowck - // doesn't agree that borrows of "frozen" (i.e. without any + // doesn't agree that borrows of "frozen" (i.e., without any // interior mutability) fields of non-frozen temporaries, // should be promoted, while MIR promotion does promote them. &(FIVE, 42).1 diff --git a/src/test/run-pass/issues/issue-49955.rs b/src/test/run-pass/issues/issue-49955.rs index a5e67928115..aa114ec0c13 100644 --- a/src/test/run-pass/issues/issue-49955.rs +++ b/src/test/run-pass/issues/issue-49955.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -Z borrowck=compare diff --git a/src/test/run-pass/issues/issue-49973.rs b/src/test/run-pass/issues/issue-49973.rs index c5a3f6c124a..af421c52fb0 100644 --- a/src/test/run-pass/issues/issue-49973.rs +++ b/src/test/run-pass/issues/issue-49973.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Debug)] #[repr(i32)] diff --git a/src/test/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs b/src/test/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs index 6a08a0c58ac..457fca3fedf 100644 --- a/src/test/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs +++ b/src/test/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass /* diff --git a/src/test/run-pass/issues/issue-50415.rs b/src/test/run-pass/issues/issue-50415.rs index 282b3b414fa..20c7be772f9 100644 --- a/src/test/run-pass/issues/issue-50415.rs +++ b/src/test/run-pass/issues/issue-50415.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { // -------- Simplified test case -------- diff --git a/src/test/run-pass/issues/issue-50442.rs b/src/test/run-pass/issues/issue-50442.rs index b22cd829253..25c7dde7a5f 100644 --- a/src/test/run-pass/issues/issue-50442.rs +++ b/src/test/run-pass/issues/issue-50442.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] enum Void {} diff --git a/src/test/run-pass/issues/issue-5060.rs b/src/test/run-pass/issues/issue-5060.rs index 2caa6541f09..c4760bc029b 100644 --- a/src/test/run-pass/issues/issue-5060.rs +++ b/src/test/run-pass/issues/issue-5060.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! print_hd_tl { ($field_hd:ident, $($field_tl:ident),+) => ({ diff --git a/src/test/run-pass/issues/issue-50689.rs b/src/test/run-pass/issues/issue-50689.rs index 6b7f4e6e95e..b49f2950020 100644 --- a/src/test/run-pass/issues/issue-50689.rs +++ b/src/test/run-pass/issues/issue-50689.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] enum Foo { diff --git a/src/test/run-pass/issues/issue-50731.rs b/src/test/run-pass/issues/issue-50731.rs index fd1d5579fbf..209c1e1279b 100644 --- a/src/test/run-pass/issues/issue-50731.rs +++ b/src/test/run-pass/issues/issue-50731.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass enum Void {} fn foo(_: Result<(Void, u32), (Void, String)>) {} diff --git a/src/test/run-pass/issues/issue-50811.rs b/src/test/run-pass/issues/issue-50811.rs index 381afd4ee11..63d87e03c48 100644 --- a/src/test/run-pass/issues/issue-50811.rs +++ b/src/test/run-pass/issues/issue-50811.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(test)] diff --git a/src/test/run-pass/issues/issue-50865-private-impl-trait/auxiliary/lib.rs b/src/test/run-pass/issues/issue-50865-private-impl-trait/auxiliary/lib.rs index 306256d53d3..f3a51b415fa 100644 --- a/src/test/run-pass/issues/issue-50865-private-impl-trait/auxiliary/lib.rs +++ b/src/test/run-pass/issues/issue-50865-private-impl-trait/auxiliary/lib.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub fn bar

( // Error won't happen if "bar" is not generic diff --git a/src/test/run-pass/issues/issue-50865-private-impl-trait/main.rs b/src/test/run-pass/issues/issue-50865-private-impl-trait/main.rs index 8c53ecd9c55..16dfac53ad1 100644 --- a/src/test/run-pass/issues/issue-50865-private-impl-trait/main.rs +++ b/src/test/run-pass/issues/issue-50865-private-impl-trait/main.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:lib.rs diff --git a/src/test/run-pass/issues/issue-51185.rs b/src/test/run-pass/issues/issue-51185.rs index 3fd38e76d1d..52a2b25539d 100644 --- a/src/test/run-pass/issues/issue-51185.rs +++ b/src/test/run-pass/issues/issue-51185.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn foo() -> impl Into fn(&'a ())> { (|_| {}) as for<'a> fn(&'a ()) diff --git a/src/test/run-pass/issues/issue-51345.rs b/src/test/run-pass/issues/issue-51345.rs index cc97da8b45e..29a0a328503 100644 --- a/src/test/run-pass/issues/issue-51345.rs +++ b/src/test/run-pass/issues/issue-51345.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_code)] #![feature(nll)] diff --git a/src/test/run-pass/issues/issue-51582.rs b/src/test/run-pass/issues/issue-51582.rs index 6c513e843eb..63ef05729bc 100644 --- a/src/test/run-pass/issues/issue-51582.rs +++ b/src/test/run-pass/issues/issue-51582.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(core_intrinsics)] diff --git a/src/test/run-pass/issues/issue-51907.rs b/src/test/run-pass/issues/issue-51907.rs index 3ac31fde31f..3691fe19117 100644 --- a/src/test/run-pass/issues/issue-51907.rs +++ b/src/test/run-pass/issues/issue-51907.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { extern fn borrow(&self); diff --git a/src/test/run-pass/issues/issue-5192.rs b/src/test/run-pass/issues/issue-5192.rs index 0f14b0fb5fc..74d8d861a7d 100644 --- a/src/test/run-pass/issues/issue-5192.rs +++ b/src/test/run-pass/issues/issue-5192.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-52140/auxiliary/some_crate.rs b/src/test/run-pass/issues/issue-52140/auxiliary/some_crate.rs index bf8dee0863a..087005849d1 100644 --- a/src/test/run-pass/issues/issue-52140/auxiliary/some_crate.rs +++ b/src/test/run-pass/issues/issue-52140/auxiliary/some_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub fn hello() { diff --git a/src/test/run-pass/issues/issue-52140/main.rs b/src/test/run-pass/issues/issue-52140/main.rs index 3d727e2ad1b..aeac4340455 100644 --- a/src/test/run-pass/issues/issue-52140/main.rs +++ b/src/test/run-pass/issues/issue-52140/main.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:some_crate.rs // compile-flags:--extern some_crate diff --git a/src/test/run-pass/issues/issue-52141/auxiliary/some_crate.rs b/src/test/run-pass/issues/issue-52141/auxiliary/some_crate.rs index bf8dee0863a..087005849d1 100644 --- a/src/test/run-pass/issues/issue-52141/auxiliary/some_crate.rs +++ b/src/test/run-pass/issues/issue-52141/auxiliary/some_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub fn hello() { diff --git a/src/test/run-pass/issues/issue-52141/main.rs b/src/test/run-pass/issues/issue-52141/main.rs index 20705dc38e1..7eea1726cf3 100644 --- a/src/test/run-pass/issues/issue-52141/main.rs +++ b/src/test/run-pass/issues/issue-52141/main.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:some_crate.rs // compile-flags:--extern some_crate diff --git a/src/test/run-pass/issues/issue-52169.rs b/src/test/run-pass/issues/issue-52169.rs index 19c0f51d235..60be97f0aee 100644 --- a/src/test/run-pass/issues/issue-52169.rs +++ b/src/test/run-pass/issues/issue-52169.rs @@ -1,15 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -#![feature(macro_literal_matcher)] macro_rules! a { ($i:literal) => { "right" }; diff --git a/src/test/run-pass/issues/issue-5239-2.rs b/src/test/run-pass/issues/issue-5239-2.rs index 2b328c5177c..b501c6e1853 100644 --- a/src/test/run-pass/issues/issue-5239-2.rs +++ b/src/test/run-pass/issues/issue-5239-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for issue #5239 diff --git a/src/test/run-pass/issues/issue-5243.rs b/src/test/run-pass/issues/issue-5243.rs index 3c630ceff7a..c511d45f02d 100644 --- a/src/test/run-pass/issues/issue-5243.rs +++ b/src/test/run-pass/issues/issue-5243.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Check that merely having lifetime parameters is not diff --git a/src/test/run-pass/issues/issue-52557.rs b/src/test/run-pass/issues/issue-52557.rs index c3dc404058c..09f7a8c5131 100644 --- a/src/test/run-pass/issues/issue-52557.rs +++ b/src/test/run-pass/issues/issue-52557.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // This test checks for namespace pollution by private tests. diff --git a/src/test/run-pass/issues/issue-52705/auxiliary/png2.rs b/src/test/run-pass/issues/issue-52705/auxiliary/png2.rs index 48d53a2cbac..fa9956e440d 100644 --- a/src/test/run-pass/issues/issue-52705/auxiliary/png2.rs +++ b/src/test/run-pass/issues/issue-52705/auxiliary/png2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub struct DecodingError; diff --git a/src/test/run-pass/issues/issue-52705/main.rs b/src/test/run-pass/issues/issue-52705/main.rs index 9a27584c181..90bb8ca7537 100644 --- a/src/test/run-pass/issues/issue-52705/main.rs +++ b/src/test/run-pass/issues/issue-52705/main.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:png2.rs diff --git a/src/test/run-pass/issues/issue-5280.rs b/src/test/run-pass/issues/issue-5280.rs index c791113bee6..3c97dad6b14 100644 --- a/src/test/run-pass/issues/issue-5280.rs +++ b/src/test/run-pass/issues/issue-5280.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-5315.rs b/src/test/run-pass/issues/issue-5315.rs index 11a6b61dc58..38c98254b93 100644 --- a/src/test/run-pass/issues/issue-5315.rs +++ b/src/test/run-pass/issues/issue-5315.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-5321-immediates-with-bare-self.rs b/src/test/run-pass/issues/issue-5321-immediates-with-bare-self.rs index 54d45716de1..64aa2836a7d 100644 --- a/src/test/run-pass/issues/issue-5321-immediates-with-bare-self.rs +++ b/src/test/run-pass/issues/issue-5321-immediates-with-bare-self.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Fooable { diff --git a/src/test/run-pass/issues/issue-53333.rs b/src/test/run-pass/issues/issue-53333.rs index db59f8f7416..ccc9971f93c 100644 --- a/src/test/run-pass/issues/issue-53333.rs +++ b/src/test/run-pass/issues/issue-53333.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // edition:2018 diff --git a/src/test/run-pass/issues/issue-5518.rs b/src/test/run-pass/issues/issue-5518.rs index 4adcc7822e6..97ed9ef309d 100644 --- a/src/test/run-pass/issues/issue-5518.rs +++ b/src/test/run-pass/issues/issue-5518.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-5518.rs diff --git a/src/test/run-pass/issues/issue-5521.rs b/src/test/run-pass/issues/issue-5521.rs index c1740430590..cafdbc39961 100644 --- a/src/test/run-pass/issues/issue-5521.rs +++ b/src/test/run-pass/issues/issue-5521.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:issue-5521.rs diff --git a/src/test/run-pass/issues/issue-5530.rs b/src/test/run-pass/issues/issue-5530.rs index 417dc6ce3c5..72731cbb177 100644 --- a/src/test/run-pass/issues/issue-5530.rs +++ b/src/test/run-pass/issues/issue-5530.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-5550.rs b/src/test/run-pass/issues/issue-5550.rs index aa66737344d..6ea24747b39 100644 --- a/src/test/run-pass/issues/issue-5550.rs +++ b/src/test/run-pass/issues/issue-5550.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-5554.rs b/src/test/run-pass/issues/issue-5554.rs index ec4a082c0ff..7737536f43d 100644 --- a/src/test/run-pass/issues/issue-5554.rs +++ b/src/test/run-pass/issues/issue-5554.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-5666.rs b/src/test/run-pass/issues/issue-5666.rs index c578397487e..bf919ed5b10 100644 --- a/src/test/run-pass/issues/issue-5666.rs +++ b/src/test/run-pass/issues/issue-5666.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-5688.rs b/src/test/run-pass/issues/issue-5688.rs index fdad413776e..b6e364c2f40 100644 --- a/src/test/run-pass/issues/issue-5688.rs +++ b/src/test/run-pass/issues/issue-5688.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass /* # Corrupted initialization in the static struct diff --git a/src/test/run-pass/issues/issue-5708.rs b/src/test/run-pass/issues/issue-5708.rs index 3d44c39c577..d3a2858873c 100644 --- a/src/test/run-pass/issues/issue-5708.rs +++ b/src/test/run-pass/issues/issue-5708.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] /* diff --git a/src/test/run-pass/issues/issue-5718.rs b/src/test/run-pass/issues/issue-5718.rs index 444d3103ada..63efec95311 100644 --- a/src/test/run-pass/issues/issue-5718.rs +++ b/src/test/run-pass/issues/issue-5718.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-5741.rs b/src/test/run-pass/issues/issue-5741.rs index f3beeff60fb..b9eaf0be7fb 100644 --- a/src/test/run-pass/issues/issue-5741.rs +++ b/src/test/run-pass/issues/issue-5741.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 #![allow(while_true)] diff --git a/src/test/run-pass/issues/issue-5791.rs b/src/test/run-pass/issues/issue-5791.rs index 92195169638..2f8bf1e9369 100644 --- a/src/test/run-pass/issues/issue-5791.rs +++ b/src/test/run-pass/issues/issue-5791.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-5917.rs b/src/test/run-pass/issues/issue-5917.rs index 75466c01fed..6ab7081cf88 100644 --- a/src/test/run-pass/issues/issue-5917.rs +++ b/src/test/run-pass/issues/issue-5917.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-5988.rs b/src/test/run-pass/issues/issue-5988.rs index d068195ade7..db77ca4375f 100644 --- a/src/test/run-pass/issues/issue-5988.rs +++ b/src/test/run-pass/issues/issue-5988.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-5997.rs b/src/test/run-pass/issues/issue-5997.rs index 84c2d3b8b14..145e3a7928d 100644 --- a/src/test/run-pass/issues/issue-5997.rs +++ b/src/test/run-pass/issues/issue-5997.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-6117.rs b/src/test/run-pass/issues/issue-6117.rs index 68c729ced82..5235d53d84a 100644 --- a/src/test/run-pass/issues/issue-6117.rs +++ b/src/test/run-pass/issues/issue-6117.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-6128.rs b/src/test/run-pass/issues/issue-6128.rs index d060da34723..f23a317c6ba 100644 --- a/src/test/run-pass/issues/issue-6128.rs +++ b/src/test/run-pass/issues/issue-6128.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-6130.rs b/src/test/run-pass/issues/issue-6130.rs index 12c2abf9c98..a33ea686947 100644 --- a/src/test/run-pass/issues/issue-6130.rs +++ b/src/test/run-pass/issues/issue-6130.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/issues/issue-6153.rs b/src/test/run-pass/issues/issue-6153.rs index e6141b0121c..25f026f214b 100644 --- a/src/test/run-pass/issues/issue-6153.rs +++ b/src/test/run-pass/issues/issue-6153.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/issues/issue-6157.rs b/src/test/run-pass/issues/issue-6157.rs index ff4c6adc55d..354797cb2a7 100644 --- a/src/test/run-pass/issues/issue-6157.rs +++ b/src/test/run-pass/issues/issue-6157.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-6318.rs b/src/test/run-pass/issues/issue-6318.rs index 59ca54a4318..d416048265f 100644 --- a/src/test/run-pass/issues/issue-6318.rs +++ b/src/test/run-pass/issues/issue-6318.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-6334.rs b/src/test/run-pass/issues/issue-6334.rs index e7c6e74938f..acf48da1543 100644 --- a/src/test/run-pass/issues/issue-6334.rs +++ b/src/test/run-pass/issues/issue-6334.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that everything still compiles and runs fine even when // we reorder the bounds. diff --git a/src/test/run-pass/issues/issue-6344-let.rs b/src/test/run-pass/issues/issue-6344-let.rs index 83d908d597c..a7b6a2e2d66 100644 --- a/src/test/run-pass/issues/issue-6344-let.rs +++ b/src/test/run-pass/issues/issue-6344-let.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/issues/issue-6344-match.rs b/src/test/run-pass/issues/issue-6344-match.rs index c427ca6526c..4505a34c716 100644 --- a/src/test/run-pass/issues/issue-6344-match.rs +++ b/src/test/run-pass/issues/issue-6344-match.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/issues/issue-6449.rs b/src/test/run-pass/issues/issue-6449.rs index 9314990b0f3..bfd4c123208 100644 --- a/src/test/run-pass/issues/issue-6449.rs +++ b/src/test/run-pass/issues/issue-6449.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-6892.rs b/src/test/run-pass/issues/issue-6892.rs index b92c5347982..a361461a4ce 100644 --- a/src/test/run-pass/issues/issue-6892.rs +++ b/src/test/run-pass/issues/issue-6892.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Ensures that destructors are run for expressions of the form "let _ = e;" diff --git a/src/test/run-pass/issues/issue-6919.rs b/src/test/run-pass/issues/issue-6919.rs index 1332c863935..11aed120873 100644 --- a/src/test/run-pass/issues/issue-6919.rs +++ b/src/test/run-pass/issues/issue-6919.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_attributes)] // aux-build:iss.rs diff --git a/src/test/run-pass/issues/issue-7012.rs b/src/test/run-pass/issues/issue-7012.rs index 217c0dee560..a1c4bf83beb 100644 --- a/src/test/run-pass/issues/issue-7012.rs +++ b/src/test/run-pass/issues/issue-7012.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-7178.rs b/src/test/run-pass/issues/issue-7178.rs index 3a74ed833e9..30aa736cdc6 100644 --- a/src/test/run-pass/issues/issue-7178.rs +++ b/src/test/run-pass/issues/issue-7178.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-7178.rs diff --git a/src/test/run-pass/issues/issue-7222.rs b/src/test/run-pass/issues/issue-7222.rs index 52c3e17fae6..64907316626 100644 --- a/src/test/run-pass/issues/issue-7222.rs +++ b/src/test/run-pass/issues/issue-7222.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 #![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 diff --git a/src/test/run-pass/issues/issue-7344.rs b/src/test/run-pass/issues/issue-7344.rs index 7402ae1c975..f1727d0c1ae 100644 --- a/src/test/run-pass/issues/issue-7344.rs +++ b/src/test/run-pass/issues/issue-7344.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-7519-match-unit-in-arg.rs b/src/test/run-pass/issues/issue-7519-match-unit-in-arg.rs index 3e60d24627c..7d838cbb09b 100644 --- a/src/test/run-pass/issues/issue-7519-match-unit-in-arg.rs +++ b/src/test/run-pass/issues/issue-7519-match-unit-in-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-7563.rs b/src/test/run-pass/issues/issue-7563.rs index e8c2a4683a5..820fffd1056 100644 --- a/src/test/run-pass/issues/issue-7563.rs +++ b/src/test/run-pass/issues/issue-7563.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] trait IDummy { diff --git a/src/test/run-pass/issues/issue-7575.rs b/src/test/run-pass/issues/issue-7575.rs index e027119855e..ac69f2b1c80 100644 --- a/src/test/run-pass/issues/issue-7575.rs +++ b/src/test/run-pass/issues/issue-7575.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { diff --git a/src/test/run-pass/issues/issue-7660.rs b/src/test/run-pass/issues/issue-7660.rs index e584fc79085..ad0b8ecff39 100644 --- a/src/test/run-pass/issues/issue-7660.rs +++ b/src/test/run-pass/issues/issue-7660.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Regression test for issue 7660 diff --git a/src/test/run-pass/issues/issue-7663.rs b/src/test/run-pass/issues/issue-7663.rs index 2c2ce9483da..b15e215db0f 100644 --- a/src/test/run-pass/issues/issue-7663.rs +++ b/src/test/run-pass/issues/issue-7663.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports, dead_code)] diff --git a/src/test/run-pass/issues/issue-7784.rs b/src/test/run-pass/issues/issue-7784.rs index 864371cab4d..b75e547079e 100644 --- a/src/test/run-pass/issues/issue-7784.rs +++ b/src/test/run-pass/issues/issue-7784.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(slice_patterns)] diff --git a/src/test/run-pass/issues/issue-7899.rs b/src/test/run-pass/issues/issue-7899.rs index 6141eec68fc..fb631f83697 100644 --- a/src/test/run-pass/issues/issue-7899.rs +++ b/src/test/run-pass/issues/issue-7899.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // aux-build:issue-7899.rs diff --git a/src/test/run-pass/issues/issue-7911.rs b/src/test/run-pass/issues/issue-7911.rs index f2299eecb40..cb7e009d074 100644 --- a/src/test/run-pass/issues/issue-7911.rs +++ b/src/test/run-pass/issues/issue-7911.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // (Closes #7911) Test that we can use the same self expression // with different mutability in macro in two methods diff --git a/src/test/run-pass/issues/issue-8044.rs b/src/test/run-pass/issues/issue-8044.rs index 3a3d08dc35a..858f98b654d 100644 --- a/src/test/run-pass/issues/issue-8044.rs +++ b/src/test/run-pass/issues/issue-8044.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-8044.rs diff --git a/src/test/run-pass/issues/issue-8248.rs b/src/test/run-pass/issues/issue-8248.rs index 21060576f2e..239c432e457 100644 --- a/src/test/run-pass/issues/issue-8248.rs +++ b/src/test/run-pass/issues/issue-8248.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-8249.rs b/src/test/run-pass/issues/issue-8249.rs index 07916d9cdb8..db49f354a39 100644 --- a/src/test/run-pass/issues/issue-8249.rs +++ b/src/test/run-pass/issues/issue-8249.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-8259.rs b/src/test/run-pass/issues/issue-8259.rs index b26392b6c72..2802bea7fe0 100644 --- a/src/test/run-pass/issues/issue-8259.rs +++ b/src/test/run-pass/issues/issue-8259.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-8351-1.rs b/src/test/run-pass/issues/issue-8351-1.rs index 5d0dc31caa6..139f027cb90 100644 --- a/src/test/run-pass/issues/issue-8351-1.rs +++ b/src/test/run-pass/issues/issue-8351-1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-8351-2.rs b/src/test/run-pass/issues/issue-8351-2.rs index 5a3b1b13a63..bc66cbb77c0 100644 --- a/src/test/run-pass/issues/issue-8351-2.rs +++ b/src/test/run-pass/issues/issue-8351-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-8391.rs b/src/test/run-pass/issues/issue-8391.rs index d6c85370b8e..1a90369659b 100644 --- a/src/test/run-pass/issues/issue-8391.rs +++ b/src/test/run-pass/issues/issue-8391.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { diff --git a/src/test/run-pass/issues/issue-8401.rs b/src/test/run-pass/issues/issue-8401.rs index 966f89486b7..97d66c5e40f 100644 --- a/src/test/run-pass/issues/issue-8401.rs +++ b/src/test/run-pass/issues/issue-8401.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_8401.rs diff --git a/src/test/run-pass/issues/issue-8460.rs b/src/test/run-pass/issues/issue-8460.rs index 515b0949a71..b7fc564a9b5 100644 --- a/src/test/run-pass/issues/issue-8460.rs +++ b/src/test/run-pass/issues/issue-8460.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/issues/issue-8498.rs b/src/test/run-pass/issues/issue-8498.rs index 334c331dba7..e6241b76109 100644 --- a/src/test/run-pass/issues/issue-8498.rs +++ b/src/test/run-pass/issues/issue-8498.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/issues/issue-8506.rs b/src/test/run-pass/issues/issue-8506.rs index 1cf054a46df..cc32b89234f 100644 --- a/src/test/run-pass/issues/issue-8506.rs +++ b/src/test/run-pass/issues/issue-8506.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-868.rs b/src/test/run-pass/issues/issue-868.rs index 6e9b736cccd..ce0a3c7ca52 100644 --- a/src/test/run-pass/issues/issue-868.rs +++ b/src/test/run-pass/issues/issue-868.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_parens)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-8709.rs b/src/test/run-pass/issues/issue-8709.rs index 3d0739caf1a..ea7525d4477 100644 --- a/src/test/run-pass/issues/issue-8709.rs +++ b/src/test/run-pass/issues/issue-8709.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! sty { diff --git a/src/test/run-pass/issues/issue-8783.rs b/src/test/run-pass/issues/issue-8783.rs index 71915cfb33e..4eb49c82161 100644 --- a/src/test/run-pass/issues/issue-8783.rs +++ b/src/test/run-pass/issues/issue-8783.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-8827.rs b/src/test/run-pass/issues/issue-8827.rs index d854793c22a..95be7616a4f 100644 --- a/src/test/run-pass/issues/issue-8827.rs +++ b/src/test/run-pass/issues/issue-8827.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/issues/issue-8851.rs b/src/test/run-pass/issues/issue-8851.rs index ff4fbc973e0..faacfe5f895 100644 --- a/src/test/run-pass/issues/issue-8851.rs +++ b/src/test/run-pass/issues/issue-8851.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // after fixing #9384 and implementing hygiene for match bindings, diff --git a/src/test/run-pass/issues/issue-8860.rs b/src/test/run-pass/issues/issue-8860.rs index e0b49164281..7925ef3b5df 100644 --- a/src/test/run-pass/issues/issue-8860.rs +++ b/src/test/run-pass/issues/issue-8860.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // compile-flags: -Z borrowck=compare diff --git a/src/test/run-pass/issues/issue-8898.rs b/src/test/run-pass/issues/issue-8898.rs index d405a0949e8..31d5ff86e7c 100644 --- a/src/test/run-pass/issues/issue-8898.rs +++ b/src/test/run-pass/issues/issue-8898.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn assert_repr_eq(obj : T, expected : String) { diff --git a/src/test/run-pass/issues/issue-9047.rs b/src/test/run-pass/issues/issue-9047.rs index 9e919e7b89c..fa8d75aec7a 100644 --- a/src/test/run-pass/issues/issue-9047.rs +++ b/src/test/run-pass/issues/issue-9047.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-9123.rs b/src/test/run-pass/issues/issue-9123.rs index 0f41acecaaa..5072ca6ba53 100644 --- a/src/test/run-pass/issues/issue-9123.rs +++ b/src/test/run-pass/issues/issue-9123.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_9123.rs diff --git a/src/test/run-pass/issues/issue-9129.rs b/src/test/run-pass/issues/issue-9129.rs index 7c9f49c51b5..c81b9b1a10d 100644 --- a/src/test/run-pass/issues/issue-9129.rs +++ b/src/test/run-pass/issues/issue-9129.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-9188.rs b/src/test/run-pass/issues/issue-9188.rs index 44fe06eed49..d7c39e9d505 100644 --- a/src/test/run-pass/issues/issue-9188.rs +++ b/src/test/run-pass/issues/issue-9188.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_9188.rs diff --git a/src/test/run-pass/issues/issue-9259.rs b/src/test/run-pass/issues/issue-9259.rs index 7f93f5a8ab3..d838edbdd66 100644 --- a/src/test/run-pass/issues/issue-9259.rs +++ b/src/test/run-pass/issues/issue-9259.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-9382.rs b/src/test/run-pass/issues/issue-9382.rs index 9ae26d638ff..dbb0fa524ef 100644 --- a/src/test/run-pass/issues/issue-9382.rs +++ b/src/test/run-pass/issues/issue-9382.rs @@ -1,14 +1,5 @@ // pretty-expanded FIXME #23616 -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-9394-inherited-trait-calls.rs b/src/test/run-pass/issues/issue-9394-inherited-trait-calls.rs index ca94a7b2fbd..c4c95aa1aae 100644 --- a/src/test/run-pass/issues/issue-9394-inherited-trait-calls.rs +++ b/src/test/run-pass/issues/issue-9394-inherited-trait-calls.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Base: Base2 + Base3{ diff --git a/src/test/run-pass/issues/issue-9396.rs b/src/test/run-pass/issues/issue-9396.rs index db717e3c99a..3e7e9a51cdd 100644 --- a/src/test/run-pass/issues/issue-9396.rs +++ b/src/test/run-pass/issues/issue-9396.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(deprecated)] diff --git a/src/test/run-pass/issues/issue-9446.rs b/src/test/run-pass/issues/issue-9446.rs index efd04a1c5ac..e200840d290 100644 --- a/src/test/run-pass/issues/issue-9446.rs +++ b/src/test/run-pass/issues/issue-9446.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Wrapper(String); diff --git a/src/test/run-pass/issues/issue-9737.rs b/src/test/run-pass/issues/issue-9737.rs index b74acf5d816..7d3e0567847 100644 --- a/src/test/run-pass/issues/issue-9737.rs +++ b/src/test/run-pass/issues/issue-9737.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] macro_rules! f { diff --git a/src/test/run-pass/issues/issue-979.rs b/src/test/run-pass/issues/issue-979.rs index a00909ffb67..57a99b325ad 100644 --- a/src/test/run-pass/issues/issue-979.rs +++ b/src/test/run-pass/issues/issue-979.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-9837.rs b/src/test/run-pass/issues/issue-9837.rs index 0a4c53ae1c5..5d2c822a576 100644 --- a/src/test/run-pass/issues/issue-9837.rs +++ b/src/test/run-pass/issues/issue-9837.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const C1: i32 = 0x12345678; const C2: isize = C1 as i16 as isize; diff --git a/src/test/run-pass/issues/issue-9906.rs b/src/test/run-pass/issues/issue-9906.rs index 546de0f6429..a2870cf0f6e 100644 --- a/src/test/run-pass/issues/issue-9906.rs +++ b/src/test/run-pass/issues/issue-9906.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-9906.rs diff --git a/src/test/run-pass/issues/issue-9918.rs b/src/test/run-pass/issues/issue-9918.rs index bfad636876c..63ad7040d67 100644 --- a/src/test/run-pass/issues/issue-9918.rs +++ b/src/test/run-pass/issues/issue-9918.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/issues/issue-9942.rs b/src/test/run-pass/issues/issue-9942.rs index 7c50c96e9a8..f4880446526 100644 --- a/src/test/run-pass/issues/issue-9942.rs +++ b/src/test/run-pass/issues/issue-9942.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-9951.rs b/src/test/run-pass/issues/issue-9951.rs index 35cdafc87d0..4e14bdbd734 100644 --- a/src/test/run-pass/issues/issue-9951.rs +++ b/src/test/run-pass/issues/issue-9951.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-9968.rs b/src/test/run-pass/issues/issue-9968.rs index 8fe54ff0c63..3ab90d99af9 100644 --- a/src/test/run-pass/issues/issue-9968.rs +++ b/src/test/run-pass/issues/issue-9968.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue-9968.rs diff --git a/src/test/run-pass/issues/issue2170exe.rs b/src/test/run-pass/issues/issue2170exe.rs index 84b8d421da6..4169ddf9bb7 100644 --- a/src/test/run-pass/issues/issue2170exe.rs +++ b/src/test/run-pass/issues/issue2170exe.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue2170lib.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs b/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs index f1624fd2e58..3ae53baa82a 100644 --- a/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs +++ b/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] // This is a file that pulls in a separate file as a submodule, where diff --git a/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs b/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs index 8dc243aed7e..215145a64b1 100644 --- a/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs +++ b/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; // This ia file with many multi-byte characters, to try to encourage diff --git a/src/test/run-pass/issues/issue24687-embed-debuginfo/main.rs b/src/test/run-pass/issues/issue24687-embed-debuginfo/main.rs index af93c9bff0f..a0cda4fad26 100644 --- a/src/test/run-pass/issues/issue24687-embed-debuginfo/main.rs +++ b/src/test/run-pass/issues/issue24687-embed-debuginfo/main.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue24687_lib.rs // compile-flags:-g diff --git a/src/test/run-pass/issues/issue28498-must-work-ex1.rs b/src/test/run-pass/issues/issue28498-must-work-ex1.rs index 54c53465acb..4699d3352ad 100644 --- a/src/test/run-pass/issues/issue28498-must-work-ex1.rs +++ b/src/test/run-pass/issues/issue28498-must-work-ex1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Example taken from RFC 1238 text diff --git a/src/test/run-pass/issues/issue28498-must-work-ex2.rs b/src/test/run-pass/issues/issue28498-must-work-ex2.rs index b8667710925..17111308555 100644 --- a/src/test/run-pass/issues/issue28498-must-work-ex2.rs +++ b/src/test/run-pass/issues/issue28498-must-work-ex2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Example taken from RFC 1238 text diff --git a/src/test/run-pass/issues/issue28498-ugeh-ex1.rs b/src/test/run-pass/issues/issue28498-ugeh-ex1.rs index 50baa2975dd..65d5588871b 100644 --- a/src/test/run-pass/issues/issue28498-ugeh-ex1.rs +++ b/src/test/run-pass/issues/issue28498-ugeh-ex1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. diff --git a/src/test/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs b/src/test/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs index 0fff6507833..573ec8f6131 100644 --- a/src/test/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs +++ b/src/test/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. diff --git a/src/test/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs b/src/test/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs index 28645801db2..e0863fa9947 100644 --- a/src/test/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs +++ b/src/test/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. diff --git a/src/test/run-pass/issues/issue28498-ugeh-with-trait-bound.rs b/src/test/run-pass/issues/issue28498-ugeh-with-trait-bound.rs index 7df3ceb7614..01d884584f6 100644 --- a/src/test/run-pass/issues/issue28498-ugeh-with-trait-bound.rs +++ b/src/test/run-pass/issues/issue28498-ugeh-with-trait-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. diff --git a/src/test/run-pass/issues/issue29927-1.rs b/src/test/run-pass/issues/issue29927-1.rs index 2104f5ef08a..a236e491375 100644 --- a/src/test/run-pass/issues/issue29927-1.rs +++ b/src/test/run-pass/issues/issue29927-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] const fn f() -> usize { diff --git a/src/test/run-pass/issues/issue_26873_multifile/A/B.rs b/src/test/run-pass/issues/issue_26873_multifile/A/B.rs index cd4d9bc64ed..d1b802ff3cd 100644 --- a/src/test/run-pass/issues/issue_26873_multifile/A/B.rs +++ b/src/test/run-pass/issues/issue_26873_multifile/A/B.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use super::*; diff --git a/src/test/run-pass/issues/issue_26873_multifile/A/C.rs b/src/test/run-pass/issues/issue_26873_multifile/A/C.rs index fb2567584c8..88f3eb04afb 100644 --- a/src/test/run-pass/issues/issue_26873_multifile/A/C.rs +++ b/src/test/run-pass/issues/issue_26873_multifile/A/C.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use super::*; diff --git a/src/test/run-pass/issues/issue_26873_multifile/A/mod.rs b/src/test/run-pass/issues/issue_26873_multifile/A/mod.rs index c36c5b8c4c0..20f40a06782 100644 --- a/src/test/run-pass/issues/issue_26873_multifile/A/mod.rs +++ b/src/test/run-pass/issues/issue_26873_multifile/A/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub mod B; pub mod C; diff --git a/src/test/run-pass/issues/issue_26873_multifile/mod.rs b/src/test/run-pass/issues/issue_26873_multifile/mod.rs index 95ed215d04f..52deea79a20 100644 --- a/src/test/run-pass/issues/issue_26873_multifile/mod.rs +++ b/src/test/run-pass/issues/issue_26873_multifile/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass mod A; diff --git a/src/test/run-pass/issues/issue_3136_b.rs b/src/test/run-pass/issues/issue_3136_b.rs index bf513c8391e..f0bdd2b5ec0 100644 --- a/src/test/run-pass/issues/issue_3136_b.rs +++ b/src/test/run-pass/issues/issue_3136_b.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_3136_a.rc diff --git a/src/test/run-pass/issues/issue_9155.rs b/src/test/run-pass/issues/issue_9155.rs index cb73b6a201d..87c453be142 100644 --- a/src/test/run-pass/issues/issue_9155.rs +++ b/src/test/run-pass/issues/issue_9155.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:issue_9155.rs diff --git a/src/test/run-pass/istr.rs b/src/test/run-pass/istr.rs index 7ebeb79f566..af11e49e56e 100644 --- a/src/test/run-pass/istr.rs +++ b/src/test/run-pass/istr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::string::String; fn test_stack_assign() { diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs index 97fa8d36d13..52b931f638c 100644 --- a/src/test/run-pass/item-attributes.rs +++ b/src/test/run-pass/item-attributes.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] #![allow(unused_attributes)] diff --git a/src/test/run-pass/item-name-overload.rs b/src/test/run-pass/item-name-overload.rs index b07b0359a2d..58ef977919c 100644 --- a/src/test/run-pass/item-name-overload.rs +++ b/src/test/run-pass/item-name-overload.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] diff --git a/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs b/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs index bb51b2519d6..9151172fd15 100644 --- a/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs +++ b/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(dead_code)] diff --git a/src/test/run-pass/iterators/iter-cloned-type-inference.rs b/src/test/run-pass/iterators/iter-cloned-type-inference.rs index 7e4bd4fb31b..898e3371971 100644 --- a/src/test/run-pass/iterators/iter-cloned-type-inference.rs +++ b/src/test/run-pass/iterators/iter-cloned-type-inference.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] diff --git a/src/test/run-pass/iterators/iter-range.rs b/src/test/run-pass/iterators/iter-range.rs index 017ffb3f9be..993d93790e0 100644 --- a/src/test/run-pass/iterators/iter-range.rs +++ b/src/test/run-pass/iterators/iter-range.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/iterators/iter-step-overflow-debug.rs b/src/test/run-pass/iterators/iter-step-overflow-debug.rs index 35f4d7b0c00..5d67c7cbb42 100644 --- a/src/test/run-pass/iterators/iter-step-overflow-debug.rs +++ b/src/test/run-pass/iterators/iter-step-overflow-debug.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare compiled with panic=abort by default // compile-flags: -C debug_assertions=yes diff --git a/src/test/run-pass/iterators/iter-step-overflow-ndebug.rs b/src/test/run-pass/iterators/iter-step-overflow-ndebug.rs index 9f12d08254d..a0ad92071b6 100644 --- a/src/test/run-pass/iterators/iter-step-overflow-ndebug.rs +++ b/src/test/run-pass/iterators/iter-step-overflow-ndebug.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -C debug_assertions=no diff --git a/src/test/run-pass/iterators/iter-sum-overflow-debug.rs b/src/test/run-pass/iterators/iter-sum-overflow-debug.rs index acd70657f44..ee4ab4d24c6 100644 --- a/src/test/run-pass/iterators/iter-sum-overflow-debug.rs +++ b/src/test/run-pass/iterators/iter-sum-overflow-debug.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare compiled with panic=abort by default // compile-flags: -C debug_assertions=yes diff --git a/src/test/run-pass/iterators/iter-sum-overflow-ndebug.rs b/src/test/run-pass/iterators/iter-sum-overflow-ndebug.rs index 1cd8026e456..61d63d41fb8 100644 --- a/src/test/run-pass/iterators/iter-sum-overflow-ndebug.rs +++ b/src/test/run-pass/iterators/iter-sum-overflow-ndebug.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -C debug_assertions=no diff --git a/src/test/run-pass/iterators/iter-sum-overflow-overflow-checks.rs b/src/test/run-pass/iterators/iter-sum-overflow-overflow-checks.rs index a4a237c57a5..429f8e0bc96 100644 --- a/src/test/run-pass/iterators/iter-sum-overflow-overflow-checks.rs +++ b/src/test/run-pass/iterators/iter-sum-overflow-overflow-checks.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare compiled with panic=abort by default // compile-flags: -C overflow-checks diff --git a/src/test/run-pass/iterators/iter-zip.rs b/src/test/run-pass/iterators/iter-zip.rs index f2402fe185a..a76fa2408bb 100644 --- a/src/test/run-pass/iterators/iter-zip.rs +++ b/src/test/run-pass/iterators/iter-zip.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that .zip() specialization preserves side effects // in sideeffectful iterator adaptors. diff --git a/src/test/run-pass/keyword-changes-2012-07-31.rs b/src/test/run-pass/keyword-changes-2012-07-31.rs index 6dbfacf0474..73b0d07090b 100644 --- a/src/test/run-pass/keyword-changes-2012-07-31.rs +++ b/src/test/run-pass/keyword-changes-2012-07-31.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // return -> return // mod -> module diff --git a/src/test/run-pass/kindck-implicit-close-over-mut-var.rs b/src/test/run-pass/kindck-implicit-close-over-mut-var.rs index 9788b1e0603..3b2991ede99 100644 --- a/src/test/run-pass/kindck-implicit-close-over-mut-var.rs +++ b/src/test/run-pass/kindck-implicit-close-over-mut-var.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] #![allow(dead_code)] use std::thread; diff --git a/src/test/run-pass/kinds-in-metadata.rs b/src/test/run-pass/kinds-in-metadata.rs index 84c5da1ad6c..7cfc28b12b9 100644 --- a/src/test/run-pass/kinds-in-metadata.rs +++ b/src/test/run-pass/kinds-in-metadata.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:kinds_in_metadata.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/lambda-infer-unresolved.rs b/src/test/run-pass/lambda-infer-unresolved.rs index ec12f257f61..751801e7c21 100644 --- a/src/test/run-pass/lambda-infer-unresolved.rs +++ b/src/test/run-pass/lambda-infer-unresolved.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_mut)] // This should typecheck even though the type of e is not fully // resolved when we finish typechecking the ||. diff --git a/src/test/run-pass/lambda-var-hygiene.rs b/src/test/run-pass/lambda-var-hygiene.rs index ae5bf71d15f..9cc4cc29bf5 100644 --- a/src/test/run-pass/lambda-var-hygiene.rs +++ b/src/test/run-pass/lambda-var-hygiene.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // shouldn't affect evaluation of $ex: macro_rules! bad_macro { ($ex:expr) => ({(|_x| { $ex }) (9) }) diff --git a/src/test/run-pass/large-records.rs b/src/test/run-pass/large-records.rs index bd685dd4244..9786ea79780 100644 --- a/src/test/run-pass/large-records.rs +++ b/src/test/run-pass/large-records.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] diff --git a/src/test/run-pass/last-use-in-block.rs b/src/test/run-pass/last-use-in-block.rs index bed94de7b95..2bfd982995d 100644 --- a/src/test/run-pass/last-use-in-block.rs +++ b/src/test/run-pass/last-use-in-block.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_parens)] // Issue #1818 diff --git a/src/test/run-pass/last-use-in-cap-clause.rs b/src/test/run-pass/last-use-in-cap-clause.rs index d63a712c1aa..b77f7b5d782 100644 --- a/src/test/run-pass/last-use-in-cap-clause.rs +++ b/src/test/run-pass/last-use-in-cap-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Make sure #1399 stays fixed diff --git a/src/test/run-pass/last-use-is-capture.rs b/src/test/run-pass/last-use-is-capture.rs index 747c7d2eae4..2fa85e2d5b2 100644 --- a/src/test/run-pass/last-use-is-capture.rs +++ b/src/test/run-pass/last-use-is-capture.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Make sure #1399 stays fixed diff --git a/src/test/run-pass/lazy-and-or.rs b/src/test/run-pass/lazy-and-or.rs index 500de64ae83..d1f564fbe4c 100644 --- a/src/test/run-pass/lazy-and-or.rs +++ b/src/test/run-pass/lazy-and-or.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn incr(x: &mut isize) -> bool { *x += 1; assert!((false)); return false; } pub fn main() { diff --git a/src/test/run-pass/lazy-init.rs b/src/test/run-pass/lazy-init.rs index a4a3edf71c0..1d7001b49ee 100644 --- a/src/test/run-pass/lazy-init.rs +++ b/src/test/run-pass/lazy-init.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_mut)] diff --git a/src/test/run-pass/leak-unique-as-tydesc.rs b/src/test/run-pass/leak-unique-as-tydesc.rs index d89888927e1..2293e3c823f 100644 --- a/src/test/run-pass/leak-unique-as-tydesc.rs +++ b/src/test/run-pass/leak-unique-as-tydesc.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 #![feature(box_syntax)] diff --git a/src/test/run-pass/lex-bare-cr-nondoc-comment.rs b/src/test/run-pass/lex-bare-cr-nondoc-comment.rs index ba949ca8881..da18ab268ff 100644 --- a/src/test/run-pass/lex-bare-cr-nondoc-comment.rs +++ b/src/test/run-pass/lex-bare-cr-nondoc-comment.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-cr // nondoc comment with bare CR: ' ' diff --git a/src/test/run-pass/lexer-crlf-line-endings-string-literal-doc-comment.rs b/src/test/run-pass/lexer-crlf-line-endings-string-literal-doc-comment.rs index 05f1f1bfea0..126cab67c1c 100644 --- a/src/test/run-pass/lexer-crlf-line-endings-string-literal-doc-comment.rs +++ b/src/test/run-pass/lexer-crlf-line-endings-string-literal-doc-comment.rs @@ -2,17 +2,10 @@ // ignore-tidy-cr (repeated again because of tidy bug) // license is ignored because tidy can't handle the CRLF here properly. -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// NB: this file needs CRLF line endings. The .gitattributes file in +// N.B., this file needs CRLF line endings. The .gitattributes file in // this directory should enforce it. // ignore-pretty issue #37195 diff --git a/src/test/run-pass/lexical-scoping.rs b/src/test/run-pass/lexical-scoping.rs index 36604042d0f..15797eee9b8 100644 --- a/src/test/run-pass/lexical-scoping.rs +++ b/src/test/run-pass/lexical-scoping.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that items in subscopes can shadow type parameters and local variables (see issue #23880). #![allow(unused)] diff --git a/src/test/run-pass/lib-defaults.rs b/src/test/run-pass/lib-defaults.rs index 19340ed0e97..dcf537866c5 100644 --- a/src/test/run-pass/lib-defaults.rs +++ b/src/test/run-pass/lib-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // dont-check-compiler-stderr (rust-lang/rust#54222) // ignore-wasm32-bare no libc to test ffi with diff --git a/src/test/run-pass/link-cfg-works.rs b/src/test/run-pass/link-cfg-works.rs index 7db948c7daa..a4888292c7d 100644 --- a/src/test/run-pass/link-cfg-works.rs +++ b/src/test/run-pass/link-cfg-works.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:link-cfg-works-transitive-rlib.rs // aux-build:link-cfg-works-transitive-dylib.rs diff --git a/src/test/run-pass/link-section.rs b/src/test/run-pass/link-section.rs index e2369e85d56..1c2d3eaaa3b 100644 --- a/src/test/run-pass/link-section.rs +++ b/src/test/run-pass/link-section.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals)] #[cfg(not(target_os = "macos"))] #[link_section=".moretext"] diff --git a/src/test/run-pass/linkage1.rs b/src/test/run-pass/linkage1.rs index f12a233f493..4e404f26eec 100644 --- a/src/test/run-pass/linkage1.rs +++ b/src/test/run-pass/linkage1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows // ignore-macos // ignore-emscripten doesn't support this linkage diff --git a/src/test/run-pass/lint-cap.rs b/src/test/run-pass/lint-cap.rs index 003a99f746a..0e8bdbdc6aa 100644 --- a/src/test/run-pass/lint-cap.rs +++ b/src/test/run-pass/lint-cap.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --cap-lints allow #![deny(warnings)] diff --git a/src/test/run-pass/lint-dead-code-associated-type.rs b/src/test/run-pass/lint-dead-code-associated-type.rs index 1ae078ba221..576ba6d170c 100644 --- a/src/test/run-pass/lint-dead-code-associated-type.rs +++ b/src/test/run-pass/lint-dead-code-associated-type.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(dead_code)] trait Foo { diff --git a/src/test/run-pass/lint-dead-code-variant.rs b/src/test/run-pass/lint-dead-code-variant.rs index 074c69d8708..3838b83e45f 100644 --- a/src/test/run-pass/lint-dead-code-variant.rs +++ b/src/test/run-pass/lint-dead-code-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(dead_code)] enum Foo { diff --git a/src/test/run-pass/lint-expr-stmt-attrs-for-early-lints.rs b/src/test/run-pass/lint-expr-stmt-attrs-for-early-lints.rs index 16c7176a68d..9ca3ecc72d2 100644 --- a/src/test/run-pass/lint-expr-stmt-attrs-for-early-lints.rs +++ b/src/test/run-pass/lint-expr-stmt-attrs-for-early-lints.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(stmt_expr_attributes)] #![deny(unused_parens)] diff --git a/src/test/run-pass/lint-non-camel-case-types-non-uppercase-statics-unicode.rs b/src/test/run-pass/lint-non-camel-case-types-non-uppercase-statics-unicode.rs deleted file mode 100644 index 14ef8c1f51f..00000000000 --- a/src/test/run-pass/lint-non-camel-case-types-non-uppercase-statics-unicode.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -#![allow(dead_code)] - - -#![forbid(non_camel_case_types)] -#![forbid(non_upper_case_globals)] -#![feature(non_ascii_idents)] - -// Some scripts (e.g. hiragana) don't have a concept of -// upper/lowercase - -struct ヒ; - -static ラ: usize = 0; - -pub fn main() {} diff --git a/src/test/run-pass/lint-non-camel-case-with-trailing-underscores.rs b/src/test/run-pass/lint-non-camel-case-with-trailing-underscores.rs deleted file mode 100644 index 8115a2c50e3..00000000000 --- a/src/test/run-pass/lint-non-camel-case-with-trailing-underscores.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] -// This is ok because we often use the trailing underscore to mean 'prime' - -// pretty-expanded FIXME #23616 - -#[forbid(non_camel_case_types)] -type Foo_ = isize; - -pub fn main() { } diff --git a/src/test/run-pass/lint-unknown-lints-at-crate-level.rs b/src/test/run-pass/lint-unknown-lints-at-crate-level.rs index 1e510c28e78..fe2fbeabac6 100644 --- a/src/test/run-pass/lint-unknown-lints-at-crate-level.rs +++ b/src/test/run-pass/lint-unknown-lints-at-crate-level.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -D warnings -D unknown-lints #![allow(unknown_lints)] diff --git a/src/test/run-pass/list.rs b/src/test/run-pass/list.rs index bab777d0973..62c04bcac75 100644 --- a/src/test/run-pass/list.rs +++ b/src/test/run-pass/list.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/liveness-assign-imm-local-after-ret.rs b/src/test/run-pass/liveness-assign-imm-local-after-ret.rs index bccc939e85e..3dc27dde52b 100644 --- a/src/test/run-pass/liveness-assign-imm-local-after-ret.rs +++ b/src/test/run-pass/liveness-assign-imm-local-after-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unreachable_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/llvm-pr32379.rs b/src/test/run-pass/llvm-pr32379.rs index 5625e81c0e6..a18a5386d81 100644 --- a/src/test/run-pass/llvm-pr32379.rs +++ b/src/test/run-pass/llvm-pr32379.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:llvm_pr32379.rs // LLVM PR #32379 (https://bugs.llvm.org/show_bug.cgi?id=32379), which diff --git a/src/test/run-pass/log-err-phi.rs b/src/test/run-pass/log-err-phi.rs index 2f2328faaca..fd12ffe36f8 100644 --- a/src/test/run-pass/log-err-phi.rs +++ b/src/test/run-pass/log-err-phi.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - pub fn main() { if false { println!("{}", "foobar"); diff --git a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs index 4c501a78b57..3f4d1c701bf 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] #[derive(Clone, Debug)] diff --git a/src/test/run-pass/log-knows-the-names-of-variants.rs b/src/test/run-pass/log-knows-the-names-of-variants.rs index 19a7c7105c9..a16ff802376 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] #[derive(Debug)] diff --git a/src/test/run-pass/log-poly.rs b/src/test/run-pass/log-poly.rs index b54b4692a41..32dbb95a723 100644 --- a/src/test/run-pass/log-poly.rs +++ b/src/test/run-pass/log-poly.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Debug)] enum Numbers { Three diff --git a/src/test/run-pass/logging-only-prints-once.rs b/src/test/run-pass/logging-only-prints-once.rs index 11ab43fd087..7b105600225 100644 --- a/src/test/run-pass/logging-only-prints-once.rs +++ b/src/test/run-pass/logging-only-prints-once.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows // ignore-emscripten no threads support // exec-env:RUST_LOG=debug diff --git a/src/test/run-pass/logging_before_rt_started.rs b/src/test/run-pass/logging_before_rt_started.rs index 820285188ae..0cba1080de2 100644 --- a/src/test/run-pass/logging_before_rt_started.rs +++ b/src/test/run-pass/logging_before_rt_started.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // exec-env:RUST_LOG=std::ptr // In issue #9487, it was realized that std::ptr was invoking the logging diff --git a/src/test/run-pass/long-while.rs b/src/test/run-pass/long-while.rs index ce55c761202..4a3ee6f9713 100644 --- a/src/test/run-pass/long-while.rs +++ b/src/test/run-pass/long-while.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 #![allow(unused_variables)] diff --git a/src/test/run-pass/lto-many-codegen-units.rs b/src/test/run-pass/lto-many-codegen-units.rs index bed675cee56..17c345beb84 100644 --- a/src/test/run-pass/lto-many-codegen-units.rs +++ b/src/test/run-pass/lto-many-codegen-units.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C lto -C codegen-units=8 // no-prefer-dynamic diff --git a/src/test/run-pass/lto-still-runs-thread-dtors.rs b/src/test/run-pass/lto-still-runs-thread-dtors.rs index 91fb7aa51d4..732681af037 100644 --- a/src/test/run-pass/lto-still-runs-thread-dtors.rs +++ b/src/test/run-pass/lto-still-runs-thread-dtors.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C lto // no-prefer-dynamic // ignore-emscripten no threads support diff --git a/src/test/run-pass/lub-glb-with-unbound-infer-var.rs b/src/test/run-pass/lub-glb-with-unbound-infer-var.rs index 6b9bd67f9a5..7e430d26b26 100644 --- a/src/test/run-pass/lub-glb-with-unbound-infer-var.rs +++ b/src/test/run-pass/lub-glb-with-unbound-infer-var.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for a specific corner case: when we compute the LUB of two fn // types and their parameters have unbound variables. In that case, we // wind up relating those two variables. This was causing an ICE in an diff --git a/src/test/run-pass/macro-quote-cond.rs b/src/test/run-pass/macro-quote-cond.rs new file mode 100644 index 00000000000..4d6bcf501ee --- /dev/null +++ b/src/test/run-pass/macro-quote-cond.rs @@ -0,0 +1,46 @@ +#![allow(unused_parens)] +// aux-build:cond_plugin.rs + +#![feature(proc_macro_hygiene)] + +extern crate cond_plugin; + +use cond_plugin::cond; + +fn fact(n : i64) -> i64 { + if n == 0 { + 1 + } else { + n * fact(n - 1) + } +} + +fn fact_cond(n : i64) -> i64 { + cond!( + ((n == 0) 1) + (else (n * fact_cond(n-1))) + ) +} + +fn fib(n : i64) -> i64 { + if n == 0 || n == 1 { + 1 + } else { + fib(n-1) + fib(n-2) + } +} + +fn fib_cond(n : i64) -> i64 { + cond!( + ((n == 0) 1) + ((n == 1) 1) + (else (fib_cond(n-1) + fib_cond(n-2))) + ) +} + +fn main() { + assert_eq!(fact(3), fact_cond(3)); + assert_eq!(fact(5), fact_cond(5)); + assert_eq!(fib(5), fib_cond(5)); + assert_eq!(fib(8), fib_cond(8)); +} diff --git a/src/test/run-pass/macro-quote-test.rs b/src/test/run-pass/macro-quote-test.rs new file mode 100644 index 00000000000..d00e8edf28b --- /dev/null +++ b/src/test/run-pass/macro-quote-test.rs @@ -0,0 +1,11 @@ +// Test that a macro can emit delimiters with nothing inside - `()`, `{}` + +// aux-build:hello_macro.rs + +#![feature(proc_macro_hygiene)] + +extern crate hello_macro; + +fn main() { + hello_macro::hello!(); +} diff --git a/src/test/run-pass/macros/assert-eq-macro-success.rs b/src/test/run-pass/macros/assert-eq-macro-success.rs index a96147db4e1..57858b34837 100644 --- a/src/test/run-pass/macros/assert-eq-macro-success.rs +++ b/src/test/run-pass/macros/assert-eq-macro-success.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Debug)] struct Point { x : isize } diff --git a/src/test/run-pass/macros/assert-eq-macro-unsized.rs b/src/test/run-pass/macros/assert-eq-macro-unsized.rs index b9e93b175a4..00823216bf6 100644 --- a/src/test/run-pass/macros/assert-eq-macro-unsized.rs +++ b/src/test/run-pass/macros/assert-eq-macro-unsized.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { assert_eq!([1, 2, 3][..], vec![1, 2, 3][..]); diff --git a/src/test/run-pass/macros/assert-ne-macro-success.rs b/src/test/run-pass/macros/assert-ne-macro-success.rs index e554607233f..89b3a4c9d6a 100644 --- a/src/test/run-pass/macros/assert-ne-macro-success.rs +++ b/src/test/run-pass/macros/assert-ne-macro-success.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Debug)] struct Point { x : isize } diff --git a/src/test/run-pass/macros/assert-ne-macro-unsized.rs b/src/test/run-pass/macros/assert-ne-macro-unsized.rs index 8833eb34918..e8a86e3da06 100644 --- a/src/test/run-pass/macros/assert-ne-macro-unsized.rs +++ b/src/test/run-pass/macros/assert-ne-macro-unsized.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { assert_ne!([6, 6, 6][..], vec![1, 2, 3][..]); diff --git a/src/test/run-pass/macros/auxiliary/macro-comma-support.rs b/src/test/run-pass/macros/auxiliary/macro-comma-support.rs index 6eafd520a72..6a452c185a8 100644 --- a/src/test/run-pass/macros/auxiliary/macro-comma-support.rs +++ b/src/test/run-pass/macros/auxiliary/macro-comma-support.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - () diff --git a/src/test/run-pass/macros/auxiliary/macro-include-items-expr.rs b/src/test/run-pass/macros/auxiliary/macro-include-items-expr.rs index aea3c749930..7394f194b80 100644 --- a/src/test/run-pass/macros/auxiliary/macro-include-items-expr.rs +++ b/src/test/run-pass/macros/auxiliary/macro-include-items-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test: this is not a test 1 diff --git a/src/test/run-pass/macros/auxiliary/macro-include-items-item.rs b/src/test/run-pass/macros/auxiliary/macro-include-items-item.rs index da72aaef805..7d54745e03b 100644 --- a/src/test/run-pass/macros/auxiliary/macro-include-items-item.rs +++ b/src/test/run-pass/macros/auxiliary/macro-include-items-item.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test: this is not a test fn foo() { bar() } diff --git a/src/test/run-pass/macros/auxiliary/macro_crate_def_only.rs b/src/test/run-pass/macros/auxiliary/macro_crate_def_only.rs index 4f55ac4f65f..c267eefde02 100644 --- a/src/test/run-pass/macros/auxiliary/macro_crate_def_only.rs +++ b/src/test/run-pass/macros/auxiliary/macro_crate_def_only.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! make_a_5 { () => (5) diff --git a/src/test/run-pass/macros/auxiliary/macro_crate_nonterminal.rs b/src/test/run-pass/macros/auxiliary/macro_crate_nonterminal.rs index 4f75e2b5d75..2e2440462ae 100644 --- a/src/test/run-pass/macros/auxiliary/macro_crate_nonterminal.rs +++ b/src/test/run-pass/macros/auxiliary/macro_crate_nonterminal.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn increment(x: usize) -> usize { x + 1 } diff --git a/src/test/run-pass/macros/auxiliary/macro_export_inner_module.rs b/src/test/run-pass/macros/auxiliary/macro_export_inner_module.rs index 84e944f69b9..d71af9ee6f2 100644 --- a/src/test/run-pass/macros/auxiliary/macro_export_inner_module.rs +++ b/src/test/run-pass/macros/auxiliary/macro_export_inner_module.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod inner { #[macro_export] macro_rules! foo { diff --git a/src/test/run-pass/macros/auxiliary/macro_with_super_1.rs b/src/test/run-pass/macros/auxiliary/macro_with_super_1.rs index fd2e52bb355..b015500df06 100644 --- a/src/test/run-pass/macros/auxiliary/macro_with_super_1.rs +++ b/src/test/run-pass/macros/auxiliary/macro_with_super_1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #[macro_export] diff --git a/src/test/run-pass/macros/auxiliary/two_macros.rs b/src/test/run-pass/macros/auxiliary/two_macros.rs index 0da6ba13696..441a978dd69 100644 --- a/src/test/run-pass/macros/auxiliary/two_macros.rs +++ b/src/test/run-pass/macros/auxiliary/two_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! macro_one { ($($t:tt)*) => ($($t)*) } diff --git a/src/test/run-pass/macros/auxiliary/unstable-macros.rs b/src/test/run-pass/macros/auxiliary/unstable-macros.rs index 836164a721a..b8d580702c9 100644 --- a/src/test/run-pass/macros/auxiliary/unstable-macros.rs +++ b/src/test/run-pass/macros/auxiliary/unstable-macros.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(staged_api)] #![stable(feature = "unit_test", since = "1.0.0")] diff --git a/src/test/run-pass/macros/auxiliary/use-macro-self.rs b/src/test/run-pass/macros/auxiliary/use-macro-self.rs index cdc519a5fdb..f1307411a7f 100644 --- a/src/test/run-pass/macros/auxiliary/use-macro-self.rs +++ b/src/test/run-pass/macros/auxiliary/use-macro-self.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod foobarius {} #[macro_export] diff --git a/src/test/run-pass/macros/colorful-write-macros.rs b/src/test/run-pass/macros/colorful-write-macros.rs index ee597f11c6a..aba4383c734 100644 --- a/src/test/run-pass/macros/colorful-write-macros.rs +++ b/src/test/run-pass/macros/colorful-write-macros.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] use std::io::Write; diff --git a/src/test/run-pass/macros/conditional-debug-macro-on.rs b/src/test/run-pass/macros/conditional-debug-macro-on.rs index 14e911f61fc..8665da89758 100644 --- a/src/test/run-pass/macros/conditional-debug-macro-on.rs +++ b/src/test/run-pass/macros/conditional-debug-macro-on.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { // exits early if println! evaluates its arguments, otherwise it diff --git a/src/test/run-pass/macros/die-macro.rs b/src/test/run-pass/macros/die-macro.rs index 26b339550cc..2a726efe822 100644 --- a/src/test/run-pass/macros/die-macro.rs +++ b/src/test/run-pass/macros/die-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Just testing that panic!() type checks in statement or expr diff --git a/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.rs b/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.rs index 8356eb3ecd6..2d78ae6f908 100644 --- a/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.rs +++ b/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/macros/macro-2.rs b/src/test/run-pass/macros/macro-2.rs index cfce7f9c8c1..4890c991dcd 100644 --- a/src/test/run-pass/macros/macro-2.rs +++ b/src/test/run-pass/macros/macro-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/macros/macro-as-fn-body.rs b/src/test/run-pass/macros/macro-as-fn-body.rs index 8c3c9fdc66d..6781c9a9ed4 100644 --- a/src/test/run-pass/macros/macro-as-fn-body.rs +++ b/src/test/run-pass/macros/macro-as-fn-body.rs @@ -1,12 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // run-pass // diff --git a/src/test/run-pass/macros/macro-at-most-once-rep.rs b/src/test/run-pass/macros/macro-at-most-once-rep.rs index c7129423cb6..582ef088a73 100644 --- a/src/test/run-pass/macros/macro-at-most-once-rep.rs +++ b/src/test/run-pass/macros/macro-at-most-once-rep.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] // The logic for parsing Kleene operators in macros has a special case to disambiguate `?`. @@ -22,8 +12,6 @@ // edition:2018 -#![feature(macro_at_most_once_rep)] - macro_rules! foo { ($($a:ident)? ; $num:expr) => { { let mut x = 0; diff --git a/src/test/run-pass/macros/macro-attribute-expansion.rs b/src/test/run-pass/macros/macro-attribute-expansion.rs index 2f4e62e0faa..f01e5c44a67 100644 --- a/src/test/run-pass/macros/macro-attribute-expansion.rs +++ b/src/test/run-pass/macros/macro-attribute-expansion.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! descriptions { ($name:ident is $desc:expr) => { diff --git a/src/test/run-pass/macros/macro-attributes.rs b/src/test/run-pass/macros/macro-attributes.rs index 70190d495a5..953f6be53c5 100644 --- a/src/test/run-pass/macros/macro-attributes.rs +++ b/src/test/run-pass/macros/macro-attributes.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(custom_attribute)] diff --git a/src/test/run-pass/macros/macro-block-nonterminal.rs b/src/test/run-pass/macros/macro-block-nonterminal.rs index 02ad360880f..a6c9dd6e187 100644 --- a/src/test/run-pass/macros/macro-block-nonterminal.rs +++ b/src/test/run-pass/macros/macro-block-nonterminal.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! do_block{ diff --git a/src/test/run-pass/macros/macro-comma-behavior.rs b/src/test/run-pass/macros/macro-comma-behavior.rs index 95774cad229..9f1a31d1ae2 100644 --- a/src/test/run-pass/macros/macro-comma-behavior.rs +++ b/src/test/run-pass/macros/macro-comma-behavior.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // Ideally, any macro call with a trailing comma should behave @@ -15,7 +5,7 @@ // // This checks the behavior of macros with trailing commas in key // places where regressions in behavior seem highly possible (due -// to it being e.g. a place where the addition of an argument +// to it being e.g., a place where the addition of an argument // causes it to go down a code path with subtly different behavior). // // There is a companion test in compile-fail. diff --git a/src/test/run-pass/macros/macro-comma-support.rs b/src/test/run-pass/macros/macro-comma-support.rs index f674123aac7..904f2e2c7fd 100644 --- a/src/test/run-pass/macros/macro-comma-support.rs +++ b/src/test/run-pass/macros/macro-comma-support.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This is meant to be a comprehensive test of invocations with/without // trailing commas (or other, similar optionally-trailing separators). diff --git a/src/test/run-pass/macros/macro-crate-def-only.rs b/src/test/run-pass/macros/macro-crate-def-only.rs index 3a48d0489ce..514b33e3897 100644 --- a/src/test/run-pass/macros/macro-crate-def-only.rs +++ b/src/test/run-pass/macros/macro-crate-def-only.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:macro_crate_def_only.rs diff --git a/src/test/run-pass/macros/macro-crate-nonterminal-renamed.rs b/src/test/run-pass/macros/macro-crate-nonterminal-renamed.rs index c2a9729ec1c..87bd397f065 100644 --- a/src/test/run-pass/macros/macro-crate-nonterminal-renamed.rs +++ b/src/test/run-pass/macros/macro-crate-nonterminal-renamed.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:macro_crate_nonterminal.rs diff --git a/src/test/run-pass/macros/macro-crate-nonterminal.rs b/src/test/run-pass/macros/macro-crate-nonterminal.rs index 114d8961817..4b1056fc725 100644 --- a/src/test/run-pass/macros/macro-crate-nonterminal.rs +++ b/src/test/run-pass/macros/macro-crate-nonterminal.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:macro_crate_nonterminal.rs diff --git a/src/test/run-pass/macros/macro-crate-use.rs b/src/test/run-pass/macros/macro-crate-use.rs index b74d5ec91b5..5c37cac9686 100644 --- a/src/test/run-pass/macros/macro-crate-use.rs +++ b/src/test/run-pass/macros/macro-crate-use.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn increment(x: usize) -> usize { diff --git a/src/test/run-pass/macros/macro-deep_expansion.rs b/src/test/run-pass/macros/macro-deep_expansion.rs index d6def354673..e13d8e1fc84 100644 --- a/src/test/run-pass/macros/macro-deep_expansion.rs +++ b/src/test/run-pass/macros/macro-deep_expansion.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! foo2 { diff --git a/src/test/run-pass/macros/macro-delimiter-significance.rs b/src/test/run-pass/macros/macro-delimiter-significance.rs index 0b6b183e6e8..89f222b0530 100644 --- a/src/test/run-pass/macros/macro-delimiter-significance.rs +++ b/src/test/run-pass/macros/macro-delimiter-significance.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { vec![1_usize, 2, 3].len(); diff --git a/src/test/run-pass/macros/macro-doc-comments.rs b/src/test/run-pass/macros/macro-doc-comments.rs index 2115022f17f..fcc64cc0670 100644 --- a/src/test/run-pass/macros/macro-doc-comments.rs +++ b/src/test/run-pass/macros/macro-doc-comments.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_snake_case)] diff --git a/src/test/run-pass/macros/macro-doc-escapes.rs b/src/test/run-pass/macros/macro-doc-escapes.rs index 5253d960c8d..ff5a5793b20 100644 --- a/src/test/run-pass/macros/macro-doc-escapes.rs +++ b/src/test/run-pass/macros/macro-doc-escapes.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // When expanding a macro, documentation attributes (including documentation comments) must be // passed "as is" without being parsed. Otherwise, some text will be incorrectly interpreted as diff --git a/src/test/run-pass/macros/macro-doc-raw-str-hashes.rs b/src/test/run-pass/macros/macro-doc-raw-str-hashes.rs index b12e00eccc9..a003bff3c04 100644 --- a/src/test/run-pass/macros/macro-doc-raw-str-hashes.rs +++ b/src/test/run-pass/macros/macro-doc-raw-str-hashes.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // The number of `#`s used to wrap the documentation comment should differ regarding the content. // diff --git a/src/test/run-pass/macros/macro-export-inner-module.rs b/src/test/run-pass/macros/macro-export-inner-module.rs index e114790f71a..1f23e90b65c 100644 --- a/src/test/run-pass/macros/macro-export-inner-module.rs +++ b/src/test/run-pass/macros/macro-export-inner-module.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass //aux-build:macro_export_inner_module.rs diff --git a/src/test/run-pass/macros/macro-first-set.rs b/src/test/run-pass/macros/macro-first-set.rs index c5f82ce5f0c..8b09e72ed29 100644 --- a/src/test/run-pass/macros/macro-first-set.rs +++ b/src/test/run-pass/macros/macro-first-set.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass //{{{ issue 40569 ============================================================== diff --git a/src/test/run-pass/macros/macro-follow.rs b/src/test/run-pass/macros/macro-follow.rs index 89a51827d7e..f90afce90ee 100644 --- a/src/test/run-pass/macros/macro-follow.rs +++ b/src/test/run-pass/macros/macro-follow.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_macros)] // Check the macro follow sets (see corresponding cfail test). diff --git a/src/test/run-pass/macros/macro-followed-by-seq.rs b/src/test/run-pass/macros/macro-followed-by-seq.rs index 15738230333..71d59d8d31b 100644 --- a/src/test/run-pass/macros/macro-followed-by-seq.rs +++ b/src/test/run-pass/macros/macro-followed-by-seq.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_macros)] // Regression test for issue #25436: check that things which can be diff --git a/src/test/run-pass/macros/macro-include-items.rs b/src/test/run-pass/macros/macro-include-items.rs index d5d459bf28d..332bf59c944 100644 --- a/src/test/run-pass/macros/macro-include-items.rs +++ b/src/test/run-pass/macros/macro-include-items.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/macros/macro-interpolation.rs b/src/test/run-pass/macros/macro-interpolation.rs index bc0c15bd403..abe1f2aaf15 100644 --- a/src/test/run-pass/macros/macro-interpolation.rs +++ b/src/test/run-pass/macros/macro-interpolation.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! overly_complicated { diff --git a/src/test/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs b/src/test/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs index 457b7232f0a..8f9dcb94794 100644 --- a/src/test/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs +++ b/src/test/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/macros/macro-lifetime-used-with-bound.rs b/src/test/run-pass/macros/macro-lifetime-used-with-bound.rs index 31170a74164..ea3f74c9ada 100644 --- a/src/test/run-pass/macros/macro-lifetime-used-with-bound.rs +++ b/src/test/run-pass/macros/macro-lifetime-used-with-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] macro_rules! foo { diff --git a/src/test/run-pass/macros/macro-lifetime-used-with-labels.rs b/src/test/run-pass/macros/macro-lifetime-used-with-labels.rs index e7c59007702..4c4bccbc12b 100644 --- a/src/test/run-pass/macros/macro-lifetime-used-with-labels.rs +++ b/src/test/run-pass/macros/macro-lifetime-used-with-labels.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] diff --git a/src/test/run-pass/macros/macro-lifetime-used-with-labels.stderr b/src/test/run-pass/macros/macro-lifetime-used-with-labels.stderr index 729178fb8f1..05418d9bddf 100644 --- a/src/test/run-pass/macros/macro-lifetime-used-with-labels.stderr +++ b/src/test/run-pass/macros/macro-lifetime-used-with-labels.stderr @@ -1,5 +1,5 @@ warning: label name `'b` shadows a label name that is already in scope - --> $DIR/macro-lifetime-used-with-labels.rs:31:9 + --> $DIR/macro-lifetime-used-with-labels.rs:21:9 | LL | 'b: loop { | ^^ lifetime 'b already in scope diff --git a/src/test/run-pass/macros/macro-lifetime-used-with-static.rs b/src/test/run-pass/macros/macro-lifetime-used-with-static.rs index 2b37ce461cb..8552c4b8163 100644 --- a/src/test/run-pass/macros/macro-lifetime-used-with-static.rs +++ b/src/test/run-pass/macros/macro-lifetime-used-with-static.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! foo { ($l:lifetime) => { diff --git a/src/test/run-pass/macros/macro-lifetime.rs b/src/test/run-pass/macros/macro-lifetime.rs index f385d73e5bb..5931fe00907 100644 --- a/src/test/run-pass/macros/macro-lifetime.rs +++ b/src/test/run-pass/macros/macro-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! foo { ($l:lifetime) => { diff --git a/src/test/run-pass/macros/macro-literal.rs b/src/test/run-pass/macros/macro-literal.rs index ecbb47757d1..e08d0a67b43 100644 --- a/src/test/run-pass/macros/macro-literal.rs +++ b/src/test/run-pass/macros/macro-literal.rs @@ -1,15 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -#![feature(macro_literal_matcher)] macro_rules! mtester { ($l:literal) => { diff --git a/src/test/run-pass/macros/macro-meta-items.rs b/src/test/run-pass/macros/macro-meta-items.rs index 68f1eae969e..4cbc252aebf 100644 --- a/src/test/run-pass/macros/macro-meta-items.rs +++ b/src/test/run-pass/macros/macro-meta-items.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // compile-flags: --cfg foo diff --git a/src/test/run-pass/macros/macro-method-issue-4621.rs b/src/test/run-pass/macros/macro-method-issue-4621.rs index 17f6b84d108..342fad5f62e 100644 --- a/src/test/run-pass/macros/macro-method-issue-4621.rs +++ b/src/test/run-pass/macros/macro-method-issue-4621.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct A; diff --git a/src/test/run-pass/macros/macro-multiple-items.rs b/src/test/run-pass/macros/macro-multiple-items.rs index 6ebfead9761..3b6dfd9bc5e 100644 --- a/src/test/run-pass/macros/macro-multiple-items.rs +++ b/src/test/run-pass/macros/macro-multiple-items.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! make_foo { () => ( diff --git a/src/test/run-pass/macros/macro-named-default.rs b/src/test/run-pass/macros/macro-named-default.rs index 1a7674ad4e6..9b6cd191640 100644 --- a/src/test/run-pass/macros/macro-named-default.rs +++ b/src/test/run-pass/macros/macro-named-default.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! default { ($($x:tt)*) => { $($x)* } diff --git a/src/test/run-pass/macros/macro-nested_definition_issue-31946.rs b/src/test/run-pass/macros/macro-nested_definition_issue-31946.rs index 276aef879e0..a83c5b2e44f 100644 --- a/src/test/run-pass/macros/macro-nested_definition_issue-31946.rs +++ b/src/test/run-pass/macros/macro-nested_definition_issue-31946.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { println!("{}", { diff --git a/src/test/run-pass/macros/macro-nested_expr.rs b/src/test/run-pass/macros/macro-nested_expr.rs index 5af4649f58b..2f93ffec4ab 100644 --- a/src/test/run-pass/macros/macro-nested_expr.rs +++ b/src/test/run-pass/macros/macro-nested_expr.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // #42164 diff --git a/src/test/run-pass/macros/macro-nested_stmt_macros.rs b/src/test/run-pass/macros/macro-nested_stmt_macros.rs index 81400927d88..5d4758a0c7b 100644 --- a/src/test/run-pass/macros/macro-nested_stmt_macros.rs +++ b/src/test/run-pass/macros/macro-nested_stmt_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! foo { () => { diff --git a/src/test/run-pass/macros/macro-nt-list.rs b/src/test/run-pass/macros/macro-nt-list.rs index 55388ed278f..36aa74f0825 100644 --- a/src/test/run-pass/macros/macro-nt-list.rs +++ b/src/test/run-pass/macros/macro-nt-list.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/macros/macro-of-higher-order.rs b/src/test/run-pass/macros/macro-of-higher-order.rs index 9a535881197..ec551d6cdbc 100644 --- a/src/test/run-pass/macros/macro-of-higher-order.rs +++ b/src/test/run-pass/macros/macro-of-higher-order.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! higher_order { diff --git a/src/test/run-pass/macros/macro-pat-follow.rs b/src/test/run-pass/macros/macro-pat-follow.rs index 12cbfa84505..8673cf79467 100644 --- a/src/test/run-pass/macros/macro-pat-follow.rs +++ b/src/test/run-pass/macros/macro-pat-follow.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! pat_in { ($p:pat in $e:expr) => {{ diff --git a/src/test/run-pass/macros/macro-pat-neg-lit.rs b/src/test/run-pass/macros/macro-pat-neg-lit.rs index ddde5d32e39..5345df2e84e 100644 --- a/src/test/run-pass/macros/macro-pat-neg-lit.rs +++ b/src/test/run-pass/macros/macro-pat-neg-lit.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! enum_number { ($name:ident { $($variant:ident = $value:expr, )* }) => { diff --git a/src/test/run-pass/macros/macro-pat.rs b/src/test/run-pass/macros/macro-pat.rs index 1ed0663fc5a..baf816e53ea 100644 --- a/src/test/run-pass/macros/macro-pat.rs +++ b/src/test/run-pass/macros/macro-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! mypat { diff --git a/src/test/run-pass/macros/macro-path.rs b/src/test/run-pass/macros/macro-path.rs index fc874f0d0ca..be59d8d139b 100644 --- a/src/test/run-pass/macros/macro-path.rs +++ b/src/test/run-pass/macros/macro-path.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/macros/macro-pub-matcher.rs b/src/test/run-pass/macros/macro-pub-matcher.rs index 8e68a3c0045..c02e6794edb 100644 --- a/src/test/run-pass/macros/macro-pub-matcher.rs +++ b/src/test/run-pass/macros/macro-pub-matcher.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code, unused_imports)] #![feature(crate_visibility_modifier)] diff --git a/src/test/run-pass/macros/macro-seq-followed-by-seq.rs b/src/test/run-pass/macros/macro-seq-followed-by-seq.rs index 594717ffcdb..8f0f4fd4a0d 100644 --- a/src/test/run-pass/macros/macro-seq-followed-by-seq.rs +++ b/src/test/run-pass/macros/macro-seq-followed-by-seq.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test of allowing two sequences repetitions in a row, // functionality added as byproduct of RFC amendment #1384 diff --git a/src/test/run-pass/macros/macro-stability.rs b/src/test/run-pass/macros/macro-stability.rs index a5c0cbbcde4..b471aa655e9 100644 --- a/src/test/run-pass/macros/macro-stability.rs +++ b/src/test/run-pass/macros/macro-stability.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:unstable-macros.rs diff --git a/src/test/run-pass/macros/macro-stmt.rs b/src/test/run-pass/macros/macro-stmt.rs index 98b0dcb8336..c9a0b879a0f 100644 --- a/src/test/run-pass/macros/macro-stmt.rs +++ b/src/test/run-pass/macros/macro-stmt.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! myfn { ( $f:ident, ( $( $x:ident ),* ), $body:block ) => ( diff --git a/src/test/run-pass/macros/macro-stmt_macro_in_expr_macro.rs b/src/test/run-pass/macros/macro-stmt_macro_in_expr_macro.rs index 9b197eb2902..528d0b28bf6 100644 --- a/src/test/run-pass/macros/macro-stmt_macro_in_expr_macro.rs +++ b/src/test/run-pass/macros/macro-stmt_macro_in_expr_macro.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] macro_rules! foo { diff --git a/src/test/run-pass/macros/macro-tt-followed-by-seq.rs b/src/test/run-pass/macros/macro-tt-followed-by-seq.rs index 204fdcf7049..90131ebd920 100644 --- a/src/test/run-pass/macros/macro-tt-followed-by-seq.rs +++ b/src/test/run-pass/macros/macro-tt-followed-by-seq.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for issue #25436: permit token-trees to be followed // by sequences, enabling more general parsing. diff --git a/src/test/run-pass/macros/macro-use-all-and-none.rs b/src/test/run-pass/macros/macro-use-all-and-none.rs index 6e035ff7f39..5fdcda0f78a 100644 --- a/src/test/run-pass/macros/macro-use-all-and-none.rs +++ b/src/test/run-pass/macros/macro-use-all-and-none.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:two_macros.rs diff --git a/src/test/run-pass/macros/macro-use-all-and-none.stderr b/src/test/run-pass/macros/macro-use-all-and-none.stderr index fc4b33bafa4..66282a4f11d 100644 --- a/src/test/run-pass/macros/macro-use-all-and-none.stderr +++ b/src/test/run-pass/macros/macro-use-all-and-none.stderr @@ -1,5 +1,5 @@ warning: unused attribute - --> $DIR/macro-use-all-and-none.rs:15:1 + --> $DIR/macro-use-all-and-none.rs:5:1 | LL | #[macro_use()] | ^^^^^^^^^^^^^^ diff --git a/src/test/run-pass/macros/macro-use-all.rs b/src/test/run-pass/macros/macro-use-all.rs index 8bbec89ace2..48c7b77e579 100644 --- a/src/test/run-pass/macros/macro-use-all.rs +++ b/src/test/run-pass/macros/macro-use-all.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:two_macros.rs diff --git a/src/test/run-pass/macros/macro-use-both.rs b/src/test/run-pass/macros/macro-use-both.rs index 5e5b4b778a2..ed5d1312f96 100644 --- a/src/test/run-pass/macros/macro-use-both.rs +++ b/src/test/run-pass/macros/macro-use-both.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:two_macros.rs diff --git a/src/test/run-pass/macros/macro-use-one.rs b/src/test/run-pass/macros/macro-use-one.rs index bdd9cc25b63..f74795e68dc 100644 --- a/src/test/run-pass/macros/macro-use-one.rs +++ b/src/test/run-pass/macros/macro-use-one.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:two_macros.rs diff --git a/src/test/run-pass/macros/macro-with-attrs1.rs b/src/test/run-pass/macros/macro-with-attrs1.rs index 4b2413d2deb..4e943b224cd 100644 --- a/src/test/run-pass/macros/macro-with-attrs1.rs +++ b/src/test/run-pass/macros/macro-with-attrs1.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: --cfg foo diff --git a/src/test/run-pass/macros/macro-with-attrs2.rs b/src/test/run-pass/macros/macro-with-attrs2.rs index 37fc4ba6f2b..78c40810207 100644 --- a/src/test/run-pass/macros/macro-with-attrs2.rs +++ b/src/test/run-pass/macros/macro-with-attrs2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[cfg(foo)] diff --git a/src/test/run-pass/macros/macro-with-braces-in-expr-position.rs b/src/test/run-pass/macros/macro-with-braces-in-expr-position.rs index 8524f047a0b..f7d87434ded 100644 --- a/src/test/run-pass/macros/macro-with-braces-in-expr-position.rs +++ b/src/test/run-pass/macros/macro-with-braces-in-expr-position.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/macros/macro_with_super_2.rs b/src/test/run-pass/macros/macro_with_super_2.rs index 2c984f86f0b..2901a74f612 100644 --- a/src/test/run-pass/macros/macro_with_super_2.rs +++ b/src/test/run-pass/macros/macro_with_super_2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:macro_with_super_1.rs diff --git a/src/test/run-pass/macros/macros-in-extern.rs b/src/test/run-pass/macros/macros-in-extern.rs index 2d3d2a9589c..28abef5cf4e 100644 --- a/src/test/run-pass/macros/macros-in-extern.rs +++ b/src/test/run-pass/macros/macros-in-extern.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32 diff --git a/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs b/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs index 4ec21105882..8fef9b0ed87 100644 --- a/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs +++ b/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(dead_code)] diff --git a/src/test/run-pass/macros/paths-in-macro-invocations.rs b/src/test/run-pass/macros/paths-in-macro-invocations.rs index 121a02226fe..4f745b85c2f 100644 --- a/src/test/run-pass/macros/paths-in-macro-invocations.rs +++ b/src/test/run-pass/macros/paths-in-macro-invocations.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:two_macros.rs diff --git a/src/test/run-pass/macros/pub-item-inside-macro.rs b/src/test/run-pass/macros/pub-item-inside-macro.rs index f17d0ac47b6..d07681453a2 100644 --- a/src/test/run-pass/macros/pub-item-inside-macro.rs +++ b/src/test/run-pass/macros/pub-item-inside-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue #14660 diff --git a/src/test/run-pass/macros/pub-method-inside-macro.rs b/src/test/run-pass/macros/pub-method-inside-macro.rs index 3bd48c11def..bc918c7a4dc 100644 --- a/src/test/run-pass/macros/pub-method-inside-macro.rs +++ b/src/test/run-pass/macros/pub-method-inside-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue #17436 diff --git a/src/test/run-pass/macros/semi-after-macro-ty.rs b/src/test/run-pass/macros/semi-after-macro-ty.rs index 1eaa8c49222..f83ace8fada 100644 --- a/src/test/run-pass/macros/semi-after-macro-ty.rs +++ b/src/test/run-pass/macros/semi-after-macro-ty.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! foo { ($t:ty; $p:path;) => {} diff --git a/src/test/run-pass/macros/stmt_expr_attr_macro_parse.rs b/src/test/run-pass/macros/stmt_expr_attr_macro_parse.rs index faf02af5387..3ab50db0ea1 100644 --- a/src/test/run-pass/macros/stmt_expr_attr_macro_parse.rs +++ b/src/test/run-pass/macros/stmt_expr_attr_macro_parse.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass macro_rules! m { ($e:expr) => { diff --git a/src/test/run-pass/macros/syntax-extension-cfg.rs b/src/test/run-pass/macros/syntax-extension-cfg.rs index f3b2f1df219..2e929fc1dfa 100644 --- a/src/test/run-pass/macros/syntax-extension-cfg.rs +++ b/src/test/run-pass/macros/syntax-extension-cfg.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: --cfg foo --cfg qux="foo" diff --git a/src/test/run-pass/macros/syntax-extension-source-utils.rs b/src/test/run-pass/macros/syntax-extension-source-utils.rs index ffa4adb0136..12931159914 100644 --- a/src/test/run-pass/macros/syntax-extension-source-utils.rs +++ b/src/test/run-pass/macros/syntax-extension-source-utils.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] @@ -24,9 +14,9 @@ pub mod m1 { macro_rules! indirect_line { () => ( line!() ) } pub fn main() { - assert_eq!(line!(), 27); + assert_eq!(line!(), 17); assert_eq!(column!(), 16); - assert_eq!(indirect_line!(), 29); + assert_eq!(indirect_line!(), 19); assert!((file!().ends_with("syntax-extension-source-utils.rs"))); assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string()); assert!(include!("syntax-extension-source-utils-files/includeme.\ @@ -43,5 +33,5 @@ pub fn main() { // The Windows tests are wrapped in an extra module for some reason assert!((m1::m2::where_am_i().ends_with("m1::m2"))); - assert_eq!((46, "( 2 * 3 ) + 5"), (line!(), stringify!((2*3) + 5))); + assert_eq!((36, "( 2 * 3 ) + 5"), (line!(), stringify!((2*3) + 5))); } diff --git a/src/test/run-pass/macros/try-macro.rs b/src/test/run-pass/macros/try-macro.rs index 4a8f55ac83c..83b30a8b7ba 100644 --- a/src/test/run-pass/macros/try-macro.rs +++ b/src/test/run-pass/macros/try-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::num::{ParseFloatError, ParseIntError}; diff --git a/src/test/run-pass/macros/two-macro-use.rs b/src/test/run-pass/macros/two-macro-use.rs index 28c18d71991..07022bb01e3 100644 --- a/src/test/run-pass/macros/two-macro-use.rs +++ b/src/test/run-pass/macros/two-macro-use.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:two_macros.rs diff --git a/src/test/run-pass/macros/type-macros-hlist.rs b/src/test/run-pass/macros/type-macros-hlist.rs index 41d4cef07f2..77d866cea9c 100644 --- a/src/test/run-pass/macros/type-macros-hlist.rs +++ b/src/test/run-pass/macros/type-macros-hlist.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::*; diff --git a/src/test/run-pass/macros/type-macros-simple.rs b/src/test/run-pass/macros/type-macros-simple.rs index 176e9a635c8..579b485a2a5 100644 --- a/src/test/run-pass/macros/type-macros-simple.rs +++ b/src/test/run-pass/macros/type-macros-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/macros/typeck-macro-interaction-issue-8852.rs b/src/test/run-pass/macros/typeck-macro-interaction-issue-8852.rs index 43d70975a9a..f2b089b74b5 100644 --- a/src/test/run-pass/macros/typeck-macro-interaction-issue-8852.rs +++ b/src/test/run-pass/macros/typeck-macro-interaction-issue-8852.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/macros/use-macro-self.rs b/src/test/run-pass/macros/use-macro-self.rs index 65db1f1a306..06464ab0bc9 100644 --- a/src/test/run-pass/macros/use-macro-self.rs +++ b/src/test/run-pass/macros/use-macro-self.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // aux-build:use-macro-self.rs diff --git a/src/test/run-pass/max-min-classes.rs b/src/test/run-pass/max-min-classes.rs index f34d5cbd9e3..9ae5bae19e5 100644 --- a/src/test/run-pass/max-min-classes.rs +++ b/src/test/run-pass/max-min-classes.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_snake_case)] trait Product { fn product(&self) -> isize; diff --git a/src/test/run-pass/methods/auxiliary/method_self_arg1.rs b/src/test/run-pass/methods/auxiliary/method_self_arg1.rs index 785a8b05664..8258fdd9ab9 100644 --- a/src/test/run-pass/methods/auxiliary/method_self_arg1.rs +++ b/src/test/run-pass/methods/auxiliary/method_self_arg1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #![feature(box_syntax)] diff --git a/src/test/run-pass/methods/auxiliary/method_self_arg2.rs b/src/test/run-pass/methods/auxiliary/method_self_arg2.rs index 3761d58087e..94a4a016c3e 100644 --- a/src/test/run-pass/methods/auxiliary/method_self_arg2.rs +++ b/src/test/run-pass/methods/auxiliary/method_self_arg2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #![feature(box_syntax)] diff --git a/src/test/run-pass/methods/method-argument-inference-associated-type.rs b/src/test/run-pass/methods/method-argument-inference-associated-type.rs index 0db38516cb9..b5ba1f94556 100644 --- a/src/test/run-pass/methods/method-argument-inference-associated-type.rs +++ b/src/test/run-pass/methods/method-argument-inference-associated-type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub struct ClientMap; pub struct ClientMap2; diff --git a/src/test/run-pass/methods/method-attributes.rs b/src/test/run-pass/methods/method-attributes.rs index cf61714608b..c7d8b3b1403 100644 --- a/src/test/run-pass/methods/method-attributes.rs +++ b/src/test/run-pass/methods/method-attributes.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_attributes)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/methods/method-early-bound-lifetimes-on-self.rs b/src/test/run-pass/methods/method-early-bound-lifetimes-on-self.rs index f98a35bb9e3..f2ace32c6b6 100644 --- a/src/test/run-pass/methods/method-early-bound-lifetimes-on-self.rs +++ b/src/test/run-pass/methods/method-early-bound-lifetimes-on-self.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that we successfully handle methods where the `self` type has // an early-bound lifetime. Issue #18208. diff --git a/src/test/run-pass/methods/method-mut-self-modifies-mut-slice-lvalue.rs b/src/test/run-pass/methods/method-mut-self-modifies-mut-slice-lvalue.rs index 7e6f0d9e27b..daff037b27b 100644 --- a/src/test/run-pass/methods/method-mut-self-modifies-mut-slice-lvalue.rs +++ b/src/test/run-pass/methods/method-mut-self-modifies-mut-slice-lvalue.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that an `&mut self` method, when invoked on a place whose // type is `&mut [u8]`, passes in a pointer to the place and not a diff --git a/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs b/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs index 27064c792fe..9c0b952849e 100644 --- a/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs +++ b/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/methods/method-projection.rs b/src/test/run-pass/methods/method-projection.rs index a997c8ffbfb..cf33d53968b 100644 --- a/src/test/run-pass/methods/method-projection.rs +++ b/src/test/run-pass/methods/method-projection.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we can use method notation to call methods based on a // projection bound from a trait. Issue #20469. diff --git a/src/test/run-pass/methods/method-recursive-blanket-impl.rs b/src/test/run-pass/methods/method-recursive-blanket-impl.rs index 72ce7a1ac56..a2db75b4e85 100644 --- a/src/test/run-pass/methods/method-recursive-blanket-impl.rs +++ b/src/test/run-pass/methods/method-recursive-blanket-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(unused_imports)] diff --git a/src/test/run-pass/methods/method-self-arg-aux1.rs b/src/test/run-pass/methods/method-self-arg-aux1.rs index c56a69ae4cd..9e38ff7de34 100644 --- a/src/test/run-pass/methods/method-self-arg-aux1.rs +++ b/src/test/run-pass/methods/method-self-arg-aux1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test method calls with self as an argument (cross-crate) diff --git a/src/test/run-pass/methods/method-self-arg-aux2.rs b/src/test/run-pass/methods/method-self-arg-aux2.rs index 1dffa813ceb..8e70399d047 100644 --- a/src/test/run-pass/methods/method-self-arg-aux2.rs +++ b/src/test/run-pass/methods/method-self-arg-aux2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test method calls with self as an argument (cross-crate) diff --git a/src/test/run-pass/methods/method-self-arg-trait.rs b/src/test/run-pass/methods/method-self-arg-trait.rs index 9429d69a156..227b1eab25d 100644 --- a/src/test/run-pass/methods/method-self-arg-trait.rs +++ b/src/test/run-pass/methods/method-self-arg-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test method calls with self as an argument diff --git a/src/test/run-pass/methods/method-self-arg.rs b/src/test/run-pass/methods/method-self-arg.rs index 38e8dfe3e4b..2d25b0dbad1 100644 --- a/src/test/run-pass/methods/method-self-arg.rs +++ b/src/test/run-pass/methods/method-self-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test method calls with self as an argument diff --git a/src/test/run-pass/methods/method-two-trait-defer-resolution-1.rs b/src/test/run-pass/methods/method-two-trait-defer-resolution-1.rs index bb1b90ebfdf..b768620cd3a 100644 --- a/src/test/run-pass/methods/method-two-trait-defer-resolution-1.rs +++ b/src/test/run-pass/methods/method-two-trait-defer-resolution-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/methods/method-two-trait-defer-resolution-2.rs b/src/test/run-pass/methods/method-two-trait-defer-resolution-2.rs index 3550326327d..8af3dcf5c3d 100644 --- a/src/test/run-pass/methods/method-two-trait-defer-resolution-2.rs +++ b/src/test/run-pass/methods/method-two-trait-defer-resolution-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that when we write `x.foo()`, we do not have to know the // complete type of `x` in order to type-check the method call. In diff --git a/src/test/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs b/src/test/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs index 89ac0fc890c..d820d2ad08a 100644 --- a/src/test/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs +++ b/src/test/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we select between traits A and B. To do that, we must // consider the `Sized` bound. diff --git a/src/test/run-pass/methods/method-where-clause.rs b/src/test/run-pass/methods/method-where-clause.rs index 721de2bf8e1..01692abf9b6 100644 --- a/src/test/run-pass/methods/method-where-clause.rs +++ b/src/test/run-pass/methods/method-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we can use method notation to call methods based on a // where clause type, and not only type parameters. diff --git a/src/test/run-pass/mid-path-type-params.rs b/src/test/run-pass/mid-path-type-params.rs index 7e06530b38c..e8ed0424e4a 100644 --- a/src/test/run-pass/mid-path-type-params.rs +++ b/src/test/run-pass/mid-path-type-params.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/minmax-stability-issue-23687.rs b/src/test/run-pass/minmax-stability-issue-23687.rs index ba48648df32..d043a99688a 100644 --- a/src/test/run-pass/minmax-stability-issue-23687.rs +++ b/src/test/run-pass/minmax-stability-issue-23687.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Debug; use std::cmp::{self, PartialOrd, Ordering}; diff --git a/src/test/run-pass/mir/auxiliary/mir_external_refs.rs b/src/test/run-pass/mir/auxiliary/mir_external_refs.rs index 4cad98004d7..9fd58f1d714 100644 --- a/src/test/run-pass/mir/auxiliary/mir_external_refs.rs +++ b/src/test/run-pass/mir/auxiliary/mir_external_refs.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub struct S(pub u8); impl S { diff --git a/src/test/run-pass/mir/mir-inlining/ice-issue-45493.rs b/src/test/run-pass/mir/mir-inlining/ice-issue-45493.rs index 85323d56616..1bd16dc43e1 100644 --- a/src/test/run-pass/mir/mir-inlining/ice-issue-45493.rs +++ b/src/test/run-pass/mir/mir-inlining/ice-issue-45493.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags:-Zmir-opt-level=2 diff --git a/src/test/run-pass/mir/mir-inlining/ice-issue-45885.rs b/src/test/run-pass/mir/mir-inlining/ice-issue-45885.rs index f5401279c89..e930a4d1ccd 100644 --- a/src/test/run-pass/mir/mir-inlining/ice-issue-45885.rs +++ b/src/test/run-pass/mir/mir-inlining/ice-issue-45885.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags:-Zmir-opt-level=2 diff --git a/src/test/run-pass/mir/mir-inlining/no-trait-method-issue-40473.rs b/src/test/run-pass/mir/mir-inlining/no-trait-method-issue-40473.rs index ff5bf4e75a3..8f570dbd4ad 100644 --- a/src/test/run-pass/mir/mir-inlining/no-trait-method-issue-40473.rs +++ b/src/test/run-pass/mir/mir-inlining/no-trait-method-issue-40473.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags:-Zmir-opt-level=2 pub trait Foo { diff --git a/src/test/run-pass/mir/mir-typeck-normalize-fn-sig.rs b/src/test/run-pass/mir/mir-typeck-normalize-fn-sig.rs index 8d8c7af724f..bdd9321afd7 100644 --- a/src/test/run-pass/mir/mir-typeck-normalize-fn-sig.rs +++ b/src/test/run-pass/mir/mir-typeck-normalize-fn-sig.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // This code was creating an ICE in the MIR type checker. The reason diff --git a/src/test/run-pass/mir/mir_adt_construction.rs b/src/test/run-pass/mir/mir_adt_construction.rs index 066edfef0ad..9fb5896de6b 100644 --- a/src/test/run-pass/mir/mir_adt_construction.rs +++ b/src/test/run-pass/mir/mir_adt_construction.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::fmt; diff --git a/src/test/run-pass/mir/mir_ascription_coercion.rs b/src/test/run-pass/mir/mir_ascription_coercion.rs index f52467e5ae8..0ebd20e97d7 100644 --- a/src/test/run-pass/mir/mir_ascription_coercion.rs +++ b/src/test/run-pass/mir/mir_ascription_coercion.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that the result of type ascription has adjustments applied diff --git a/src/test/run-pass/mir/mir_augmented_assignments.rs b/src/test/run-pass/mir/mir_augmented_assignments.rs index dfc6a016185..44454f8f417 100644 --- a/src/test/run-pass/mir/mir_augmented_assignments.rs +++ b/src/test/run-pass/mir/mir_augmented_assignments.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem; use std::ops::{ diff --git a/src/test/run-pass/mir/mir_autoderef.rs b/src/test/run-pass/mir/mir_autoderef.rs index c2d7e6d99ee..a0e615a7387 100644 --- a/src/test/run-pass/mir/mir_autoderef.rs +++ b/src/test/run-pass/mir/mir_autoderef.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::{Deref, DerefMut}; diff --git a/src/test/run-pass/mir/mir_boxing.rs b/src/test/run-pass/mir/mir_boxing.rs index 31b10975a4a..83e1cfb640a 100644 --- a/src/test/run-pass/mir/mir_boxing.rs +++ b/src/test/run-pass/mir/mir_boxing.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/mir/mir_build_match_comparisons.rs b/src/test/run-pass/mir/mir_build_match_comparisons.rs index f5a7362e4a9..8913009f691 100644 --- a/src/test/run-pass/mir/mir_build_match_comparisons.rs +++ b/src/test/run-pass/mir/mir_build_match_comparisons.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] fn test1(x: i8) -> i32 { diff --git a/src/test/run-pass/mir/mir_call_with_associated_type.rs b/src/test/run-pass/mir/mir_call_with_associated_type.rs index 1d960d1b716..7103533e1da 100644 --- a/src/test/run-pass/mir/mir_call_with_associated_type.rs +++ b/src/test/run-pass/mir/mir_call_with_associated_type.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Trait { type Type; diff --git a/src/test/run-pass/mir/mir_calls_to_shims.rs b/src/test/run-pass/mir/mir_calls_to_shims.rs index d9cdec40694..6f13d5612ce 100644 --- a/src/test/run-pass/mir/mir_calls_to_shims.rs +++ b/src/test/run-pass/mir/mir_calls_to_shims.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare compiled with panic=abort by default diff --git a/src/test/run-pass/mir/mir_cast_fn_ret.rs b/src/test/run-pass/mir/mir_cast_fn_ret.rs index d2d29120855..69fd64c1c09 100644 --- a/src/test/run-pass/mir/mir_cast_fn_ret.rs +++ b/src/test/run-pass/mir/mir_cast_fn_ret.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub extern "C" fn tuple2() -> (u16, u8) { (1, 2) diff --git a/src/test/run-pass/mir/mir_codegen_array.rs b/src/test/run-pass/mir/mir_codegen_array.rs index ecbafef8c00..38e443d8e39 100644 --- a/src/test/run-pass/mir/mir_codegen_array.rs +++ b/src/test/run-pass/mir/mir_codegen_array.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] fn into_inner() -> [u64; 1024] { diff --git a/src/test/run-pass/mir/mir_codegen_array_2.rs b/src/test/run-pass/mir/mir_codegen_array_2.rs index 2734bc71b58..03d3aa5ade6 100644 --- a/src/test/run-pass/mir/mir_codegen_array_2.rs +++ b/src/test/run-pass/mir/mir_codegen_array_2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn into_inner(x: u64) -> [u64; 1024] { [x; 2*4*8*16] diff --git a/src/test/run-pass/mir/mir_codegen_call_converging.rs b/src/test/run-pass/mir/mir_codegen_call_converging.rs index d7bce4d5be3..9c340e4e036 100644 --- a/src/test/run-pass/mir/mir_codegen_call_converging.rs +++ b/src/test/run-pass/mir/mir_codegen_call_converging.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn converging_fn() -> u64 { 43 diff --git a/src/test/run-pass/mir/mir_codegen_calls.rs b/src/test/run-pass/mir/mir_codegen_calls.rs index 33ffab40428..075d266d34d 100644 --- a/src/test/run-pass/mir/mir_codegen_calls.rs +++ b/src/test/run-pass/mir/mir_codegen_calls.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(fn_traits, test)] diff --git a/src/test/run-pass/mir/mir_codegen_calls_variadic.rs b/src/test/run-pass/mir/mir_codegen_calls_variadic.rs index ee32f2d0e0f..dc9fee03b77 100644 --- a/src/test/run-pass/mir/mir_codegen_calls_variadic.rs +++ b/src/test/run-pass/mir/mir_codegen_calls_variadic.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare no libc to test ffi with diff --git a/src/test/run-pass/mir/mir_codegen_critical_edge.rs b/src/test/run-pass/mir/mir_codegen_critical_edge.rs index e22cead44f5..03b111e93dd 100644 --- a/src/test/run-pass/mir/mir_codegen_critical_edge.rs +++ b/src/test/run-pass/mir/mir_codegen_critical_edge.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // This code produces a CFG with critical edges that, if we don't diff --git a/src/test/run-pass/mir/mir_codegen_spike1.rs b/src/test/run-pass/mir/mir_codegen_spike1.rs index 0317aa0b509..90bdd6b4bd7 100644 --- a/src/test/run-pass/mir/mir_codegen_spike1.rs +++ b/src/test/run-pass/mir/mir_codegen_spike1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // A simple spike test for MIR version of codegen. diff --git a/src/test/run-pass/mir/mir_codegen_switch.rs b/src/test/run-pass/mir/mir_codegen_switch.rs index d793337925d..d2589ae4ad2 100644 --- a/src/test/run-pass/mir/mir_codegen_switch.rs +++ b/src/test/run-pass/mir/mir_codegen_switch.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass enum Abc { A(u8), diff --git a/src/test/run-pass/mir/mir_codegen_switchint.rs b/src/test/run-pass/mir/mir_codegen_switchint.rs index ef0a98a6e70..c092a6c31b2 100644 --- a/src/test/run-pass/mir/mir_codegen_switchint.rs +++ b/src/test/run-pass/mir/mir_codegen_switchint.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn foo(x: i8) -> i32 { match x { diff --git a/src/test/run-pass/mir/mir_coercion_casts.rs b/src/test/run-pass/mir/mir_coercion_casts.rs index 3de87029e0f..7d761181d80 100644 --- a/src/test/run-pass/mir/mir_coercion_casts.rs +++ b/src/test/run-pass/mir/mir_coercion_casts.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests the coercion casts are handled properly diff --git a/src/test/run-pass/mir/mir_coercions.rs b/src/test/run-pass/mir/mir_coercions.rs index 79a8030e9b5..b673345db70 100644 --- a/src/test/run-pass/mir/mir_coercions.rs +++ b/src/test/run-pass/mir/mir_coercions.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(coerce_unsized, unsize)] diff --git a/src/test/run-pass/mir/mir_constval_adts.rs b/src/test/run-pass/mir/mir_constval_adts.rs index d35dd9c441b..3156be3584e 100644 --- a/src/test/run-pass/mir/mir_constval_adts.rs +++ b/src/test/run-pass/mir/mir_constval_adts.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Debug)] struct Point { diff --git a/src/test/run-pass/mir/mir_drop_order.rs b/src/test/run-pass/mir/mir_drop_order.rs index abc21eee636..2949437b1e4 100644 --- a/src/test/run-pass/mir/mir_drop_order.rs +++ b/src/test/run-pass/mir/mir_drop_order.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare compiled with panic=abort by default diff --git a/src/test/run-pass/mir/mir_early_return_scope.rs b/src/test/run-pass/mir/mir_early_return_scope.rs index af2f55ff650..a696471c361 100644 --- a/src/test/run-pass/mir/mir_early_return_scope.rs +++ b/src/test/run-pass/mir/mir_early_return_scope.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] static mut DROP: bool = false; diff --git a/src/test/run-pass/mir/mir_fat_ptr.rs b/src/test/run-pass/mir/mir_fat_ptr.rs index b3facb3b4c4..fb34de62f31 100644 --- a/src/test/run-pass/mir/mir_fat_ptr.rs +++ b/src/test/run-pass/mir/mir_fat_ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // test that ordinary fat pointer operations work. diff --git a/src/test/run-pass/mir/mir_fat_ptr_drop.rs b/src/test/run-pass/mir/mir_fat_ptr_drop.rs index a2063cd2b3a..d865c3499b2 100644 --- a/src/test/run-pass/mir/mir_fat_ptr_drop.rs +++ b/src/test/run-pass/mir/mir_fat_ptr_drop.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(stable_features)] @@ -20,7 +10,7 @@ use std::sync::atomic; use std::sync::atomic::Ordering::SeqCst; -static COUNTER: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT; +static COUNTER: atomic::AtomicUsize = atomic::AtomicUsize::new(0); struct DropMe { } diff --git a/src/test/run-pass/mir/mir_heavy_promoted.rs b/src/test/run-pass/mir/mir_heavy_promoted.rs index 2f788f1408d..092299880e2 100644 --- a/src/test/run-pass/mir/mir_heavy_promoted.rs +++ b/src/test/run-pass/mir/mir_heavy_promoted.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten apparently only works in optimized mode diff --git a/src/test/run-pass/mir/mir_match_arm_guard.rs b/src/test/run-pass/mir/mir_match_arm_guard.rs index b53f8535079..65e4ed041bb 100644 --- a/src/test/run-pass/mir/mir_match_arm_guard.rs +++ b/src/test/run-pass/mir/mir_match_arm_guard.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // #30527 - We were not generating arms with guards in certain cases. diff --git a/src/test/run-pass/mir/mir_match_test.rs b/src/test/run-pass/mir/mir_match_test.rs new file mode 100644 index 00000000000..1f96d6737e0 --- /dev/null +++ b/src/test/run-pass/mir/mir_match_test.rs @@ -0,0 +1,83 @@ +#![feature(exclusive_range_pattern)] + +// run-pass + +fn main() { + let incl_range = |x, b| { + match x { + 0..=5 if b => 0, + 5..=10 if b => 1, + 1..=4 if !b => 2, + _ => 3, + } + }; + assert_eq!(incl_range(3, false), 2); + assert_eq!(incl_range(3, true), 0); + assert_eq!(incl_range(5, false), 3); + assert_eq!(incl_range(5, true), 0); + + let excl_range = |x, b| { + match x { + 0..5 if b => 0, + 5..10 if b => 1, + 1..4 if !b => 2, + _ => 3, + } + }; + assert_eq!(excl_range(3, false), 2); + assert_eq!(excl_range(3, true), 0); + assert_eq!(excl_range(5, false), 3); + assert_eq!(excl_range(5, true), 1); + + let incl_range_vs_const = |x, b| { + match x { + 0..=5 if b => 0, + 7 => 1, + 3 => 2, + _ => 3, + } + }; + assert_eq!(incl_range_vs_const(5, false), 3); + assert_eq!(incl_range_vs_const(5, true), 0); + assert_eq!(incl_range_vs_const(3, false), 2); + assert_eq!(incl_range_vs_const(3, true), 0); + assert_eq!(incl_range_vs_const(7, false), 1); + assert_eq!(incl_range_vs_const(7, true), 1); + + let excl_range_vs_const = |x, b| { + match x { + 0..5 if b => 0, + 7 => 1, + 3 => 2, + _ => 3, + } + }; + assert_eq!(excl_range_vs_const(5, false), 3); + assert_eq!(excl_range_vs_const(5, true), 3); + assert_eq!(excl_range_vs_const(3, false), 2); + assert_eq!(excl_range_vs_const(3, true), 0); + assert_eq!(excl_range_vs_const(7, false), 1); + assert_eq!(excl_range_vs_const(7, true), 1); + + let const_vs_incl_range = |x, b| { + match x { + 3 if b => 0, + 5..=7 => 2, + 1..=4 => 1, + _ => 3, + } + }; + assert_eq!(const_vs_incl_range(3, false), 1); + assert_eq!(const_vs_incl_range(3, true), 0); + + let const_vs_excl_range = |x, b| { + match x { + 3 if b => 0, + 5..7 => 2, + 1..4 => 1, + _ => 3, + } + }; + assert_eq!(const_vs_excl_range(3, false), 1); + assert_eq!(const_vs_excl_range(3, true), 0); +} diff --git a/src/test/run-pass/mir/mir_misc_casts.rs b/src/test/run-pass/mir/mir_misc_casts.rs index 081814edcd1..2e7fbeee5da 100644 --- a/src/test/run-pass/mir/mir_misc_casts.rs +++ b/src/test/run-pass/mir/mir_misc_casts.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn func(){} diff --git a/src/test/run-pass/mir/mir_overflow_off.rs b/src/test/run-pass/mir/mir_overflow_off.rs index 9d6624b53d0..922ec36e531 100644 --- a/src/test/run-pass/mir/mir_overflow_off.rs +++ b/src/test/run-pass/mir/mir_overflow_off.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -Z force-overflow-checks=off diff --git a/src/test/run-pass/mir/mir_raw_fat_ptr.rs b/src/test/run-pass/mir/mir_raw_fat_ptr.rs index b5ae15b2ce1..328c8c502cb 100644 --- a/src/test/run-pass/mir/mir_raw_fat_ptr.rs +++ b/src/test/run-pass/mir/mir_raw_fat_ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // check raw fat pointer ops in mir // FIXME: please improve this when we get monomorphization support diff --git a/src/test/run-pass/mir/mir_refs_correct.rs b/src/test/run-pass/mir/mir_refs_correct.rs index 1166b6188c2..729db2d25f5 100644 --- a/src/test/run-pass/mir/mir_refs_correct.rs +++ b/src/test/run-pass/mir/mir_refs_correct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:mir_external_refs.rs diff --git a/src/test/run-pass/mir/mir_small_agg_arg.rs b/src/test/run-pass/mir/mir_small_agg_arg.rs index fd81239daff..5a22a0420c5 100644 --- a/src/test/run-pass/mir/mir_small_agg_arg.rs +++ b/src/test/run-pass/mir/mir_small_agg_arg.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] fn foo((x, y): (i8, i8)) { diff --git a/src/test/run-pass/mir/mir_struct_with_assoc_ty.rs b/src/test/run-pass/mir/mir_struct_with_assoc_ty.rs index f94b44a1eea..26d026bdfdd 100644 --- a/src/test/run-pass/mir/mir_struct_with_assoc_ty.rs +++ b/src/test/run-pass/mir/mir_struct_with_assoc_ty.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::marker::PhantomData; diff --git a/src/test/run-pass/mir/mir_temp_promotions.rs b/src/test/run-pass/mir/mir_temp_promotions.rs index ba3e85a0dcf..845dc4c0444 100644 --- a/src/test/run-pass/mir/mir_temp_promotions.rs +++ b/src/test/run-pass/mir/mir_temp_promotions.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn test1(f: f32) -> bool { // test that we properly promote temporaries to allocas when a temporary is assigned to diff --git a/src/test/run-pass/mir/mir_void_return.rs b/src/test/run-pass/mir/mir_void_return.rs index c984bfd8cb1..d257affc268 100644 --- a/src/test/run-pass/mir/mir_void_return.rs +++ b/src/test/run-pass/mir/mir_void_return.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn mir() -> (){ let x = 1; diff --git a/src/test/run-pass/mir/mir_void_return_2.rs b/src/test/run-pass/mir/mir_void_return_2.rs index fbe457fdd83..a1fb0a7db17 100644 --- a/src/test/run-pass/mir/mir_void_return_2.rs +++ b/src/test/run-pass/mir/mir_void_return_2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn nil() {} diff --git a/src/test/run-pass/modules/auxiliary/two_macros_2.rs b/src/test/run-pass/modules/auxiliary/two_macros_2.rs index b16cd3a4210..8ad2c0f1275 100644 --- a/src/test/run-pass/modules/auxiliary/two_macros_2.rs +++ b/src/test/run-pass/modules/auxiliary/two_macros_2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! macro_one { ($($t:tt)*) => ($($t)*) } macro_rules! macro_two { ($($t:tt)*) => ($($t)*) } diff --git a/src/test/run-pass/modules/mod-inside-fn.rs b/src/test/run-pass/modules/mod-inside-fn.rs index da7a3d97c10..93050c8919a 100644 --- a/src/test/run-pass/modules/mod-inside-fn.rs +++ b/src/test/run-pass/modules/mod-inside-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn f() -> isize { diff --git a/src/test/run-pass/modules/mod-view-items.rs b/src/test/run-pass/modules/mod-view-items.rs index ecca9c7ce95..db2b303668b 100644 --- a/src/test/run-pass/modules/mod-view-items.rs +++ b/src/test/run-pass/modules/mod-view-items.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test view items inside non-file-level mods diff --git a/src/test/run-pass/modules/mod_dir_implicit.rs b/src/test/run-pass/modules/mod_dir_implicit.rs index e9a1d6cfa29..d6ea6a98bda 100644 --- a/src/test/run-pass/modules/mod_dir_implicit.rs +++ b/src/test/run-pass/modules/mod_dir_implicit.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty issue #37195 diff --git a/src/test/run-pass/modules/mod_dir_implicit_aux/mod.rs b/src/test/run-pass/modules/mod_dir_implicit_aux/mod.rs index 8687b33cac3..4f1eb85e4cc 100644 --- a/src/test/run-pass/modules/mod_dir_implicit_aux/mod.rs +++ b/src/test/run-pass/modules/mod_dir_implicit_aux/mod.rs @@ -1,12 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn foo() -> isize { 10 } diff --git a/src/test/run-pass/modules/mod_dir_path.rs b/src/test/run-pass/modules/mod_dir_path.rs index ff958f23f11..70f592d0c0e 100644 --- a/src/test/run-pass/modules/mod_dir_path.rs +++ b/src/test/run-pass/modules/mod_dir_path.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_macros)] // ignore-pretty issue #37195 diff --git a/src/test/run-pass/modules/mod_dir_path2.rs b/src/test/run-pass/modules/mod_dir_path2.rs index 9b116d534d9..c3e3e1d639e 100644 --- a/src/test/run-pass/modules/mod_dir_path2.rs +++ b/src/test/run-pass/modules/mod_dir_path2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty issue #37195 diff --git a/src/test/run-pass/modules/mod_dir_path3.rs b/src/test/run-pass/modules/mod_dir_path3.rs index 5bdf2ca2e59..fed70c1bc98 100644 --- a/src/test/run-pass/modules/mod_dir_path3.rs +++ b/src/test/run-pass/modules/mod_dir_path3.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty issue #37195 diff --git a/src/test/run-pass/modules/mod_dir_path_multi.rs b/src/test/run-pass/modules/mod_dir_path_multi.rs index e6a22c21cbc..2b805141a63 100644 --- a/src/test/run-pass/modules/mod_dir_path_multi.rs +++ b/src/test/run-pass/modules/mod_dir_path_multi.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty issue #37195 diff --git a/src/test/run-pass/modules/mod_dir_recursive.rs b/src/test/run-pass/modules/mod_dir_recursive.rs index 88dc845bcb5..b109d13d164 100644 --- a/src/test/run-pass/modules/mod_dir_recursive.rs +++ b/src/test/run-pass/modules/mod_dir_recursive.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty issue #37195 diff --git a/src/test/run-pass/modules/mod_dir_simple.rs b/src/test/run-pass/modules/mod_dir_simple.rs index cb45b3cadaf..1d92c968a8f 100644 --- a/src/test/run-pass/modules/mod_dir_simple.rs +++ b/src/test/run-pass/modules/mod_dir_simple.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty issue #37195 diff --git a/src/test/run-pass/modules/mod_dir_simple/load_another_mod.rs b/src/test/run-pass/modules/mod_dir_simple/load_another_mod.rs index 40717782b92..f96b546aa2f 100644 --- a/src/test/run-pass/modules/mod_dir_simple/load_another_mod.rs +++ b/src/test/run-pass/modules/mod_dir_simple/load_another_mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[path = "test.rs"] pub mod test; diff --git a/src/test/run-pass/modules/mod_dir_simple/test.rs b/src/test/run-pass/modules/mod_dir_simple/test.rs index 8687b33cac3..4f1eb85e4cc 100644 --- a/src/test/run-pass/modules/mod_dir_simple/test.rs +++ b/src/test/run-pass/modules/mod_dir_simple/test.rs @@ -1,12 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn foo() -> isize { 10 } diff --git a/src/test/run-pass/modules/mod_file.rs b/src/test/run-pass/modules/mod_file.rs index 26bf83ca5a4..0ca52889e5c 100644 --- a/src/test/run-pass/modules/mod_file.rs +++ b/src/test/run-pass/modules/mod_file.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty issue #37195 diff --git a/src/test/run-pass/modules/mod_file_aux.rs b/src/test/run-pass/modules/mod_file_aux.rs index a7810a3cae1..6d052272eb3 100644 --- a/src/test/run-pass/modules/mod_file_aux.rs +++ b/src/test/run-pass/modules/mod_file_aux.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-test Not a test. Used by other tests diff --git a/src/test/run-pass/modules/mod_file_with_path_attr.rs b/src/test/run-pass/modules/mod_file_with_path_attr.rs index ede610bcfad..48e253eadae 100644 --- a/src/test/run-pass/modules/mod_file_with_path_attr.rs +++ b/src/test/run-pass/modules/mod_file_with_path_attr.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty issue #37195 diff --git a/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f32.rs b/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f32.rs index 2242daa2d80..ae9811ac024 100644 --- a/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f32.rs +++ b/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f32.rs @@ -1,11 +1 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub type T = f32; diff --git a/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f64.rs b/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f64.rs index 543d672b0ab..df276449c4f 100644 --- a/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f64.rs +++ b/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f64.rs @@ -1,11 +1 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub type T = f64; diff --git a/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_float.rs b/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_float.rs index 7151796c8ec..7a0d84f3a51 100644 --- a/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_float.rs +++ b/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_float.rs @@ -1,11 +1 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub type T = float; diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index 6c7c39e5aa5..f0781c2920d 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/monomorphize-abi-alignment.rs b/src/test/run-pass/monomorphize-abi-alignment.rs index 899f3f4ba30..b55974e6421 100644 --- a/src/test/run-pass/monomorphize-abi-alignment.rs +++ b/src/test/run-pass/monomorphize-abi-alignment.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals)] /*! * On x86_64-linux-gnu and possibly other platforms, structs get 8-byte "preferred" alignment, diff --git a/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs b/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs index b7de1b5f4cb..ec7ff2d8a51 100644 --- a/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs +++ b/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 trait Serializer { diff --git a/src/test/run-pass/moves/move-1-unique.rs b/src/test/run-pass/moves/move-1-unique.rs index 5a0eefc20af..48baead074a 100644 --- a/src/test/run-pass/moves/move-1-unique.rs +++ b/src/test/run-pass/moves/move-1-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![feature(box_syntax)] diff --git a/src/test/run-pass/moves/move-2-unique.rs b/src/test/run-pass/moves/move-2-unique.rs index e62c7393551..910a88c102f 100644 --- a/src/test/run-pass/moves/move-2-unique.rs +++ b/src/test/run-pass/moves/move-2-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![feature(box_syntax)] diff --git a/src/test/run-pass/moves/move-2.rs b/src/test/run-pass/moves/move-2.rs index caab86e584e..4ad53e96e50 100644 --- a/src/test/run-pass/moves/move-2.rs +++ b/src/test/run-pass/moves/move-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![feature(box_syntax)] diff --git a/src/test/run-pass/moves/move-3-unique.rs b/src/test/run-pass/moves/move-3-unique.rs index 9247eac848a..55b10e057d8 100644 --- a/src/test/run-pass/moves/move-3-unique.rs +++ b/src/test/run-pass/moves/move-3-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![feature(box_syntax)] diff --git a/src/test/run-pass/moves/move-4-unique.rs b/src/test/run-pass/moves/move-4-unique.rs index 6d69b5ec946..1787caadb7a 100644 --- a/src/test/run-pass/moves/move-4-unique.rs +++ b/src/test/run-pass/moves/move-4-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![feature(box_syntax)] diff --git a/src/test/run-pass/moves/move-4.rs b/src/test/run-pass/moves/move-4.rs index 5edaffeb2c2..c87c605df77 100644 --- a/src/test/run-pass/moves/move-4.rs +++ b/src/test/run-pass/moves/move-4.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![feature(box_syntax)] diff --git a/src/test/run-pass/moves/move-arg-2-unique.rs b/src/test/run-pass/moves/move-arg-2-unique.rs index 279b6d49358..fcfd5e14765 100644 --- a/src/test/run-pass/moves/move-arg-2-unique.rs +++ b/src/test/run-pass/moves/move-arg-2-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/moves/move-arg-2.rs b/src/test/run-pass/moves/move-arg-2.rs index a813d7ec922..4cd1f6fe810 100644 --- a/src/test/run-pass/moves/move-arg-2.rs +++ b/src/test/run-pass/moves/move-arg-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/moves/move-arg.rs b/src/test/run-pass/moves/move-arg.rs index 1fa10fe48b4..5942cd89fd9 100644 --- a/src/test/run-pass/moves/move-arg.rs +++ b/src/test/run-pass/moves/move-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn test(foo: isize) { assert_eq!(foo, 10); } diff --git a/src/test/run-pass/moves/move-nullary-fn.rs b/src/test/run-pass/moves/move-nullary-fn.rs index b737c8c066c..14c9262c74d 100644 --- a/src/test/run-pass/moves/move-nullary-fn.rs +++ b/src/test/run-pass/moves/move-nullary-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue #922 // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/moves/move-out-of-field.rs b/src/test/run-pass/moves/move-out-of-field.rs index 8c91c524f26..9f697db4f79 100644 --- a/src/test/run-pass/moves/move-out-of-field.rs +++ b/src/test/run-pass/moves/move-out-of-field.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::string::String; diff --git a/src/test/run-pass/moves/move-scalar.rs b/src/test/run-pass/moves/move-scalar.rs index f25741f355e..98bfeb1bc05 100644 --- a/src/test/run-pass/moves/move-scalar.rs +++ b/src/test/run-pass/moves/move-scalar.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] diff --git a/src/test/run-pass/moves/moves-based-on-type-capture-clause.rs b/src/test/run-pass/moves/moves-based-on-type-capture-clause.rs index 333d6e4fd52..4a6a4ed281d 100644 --- a/src/test/run-pass/moves/moves-based-on-type-capture-clause.rs +++ b/src/test/run-pass/moves/moves-based-on-type-capture-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/mpsc_stress.rs b/src/test/run-pass/mpsc_stress.rs index aa369bb17fe..cd30dd62bc4 100644 --- a/src/test/run-pass/mpsc_stress.rs +++ b/src/test/run-pass/mpsc_stress.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test // ignore-emscripten diff --git a/src/test/run-pass/msvc-data-only.rs b/src/test/run-pass/msvc-data-only.rs index ad6888c4d30..ae4103e96c3 100644 --- a/src/test/run-pass/msvc-data-only.rs +++ b/src/test/run-pass/msvc-data-only.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:msvc-data-only-lib.rs extern crate msvc_data_only_lib; diff --git a/src/test/run-pass/multi-panic.rs b/src/test/run-pass/multi-panic.rs index 2e6e10935fa..3f24d989c8c 100644 --- a/src/test/run-pass/multi-panic.rs +++ b/src/test/run-pass/multi-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no processes // ignore-emscripten no processes @@ -17,7 +7,8 @@ fn check_for_no_backtrace(test: std::process::Output) { let mut it = err.lines(); assert_eq!(it.next().map(|l| l.starts_with("thread '' panicked at")), Some(true)); - assert_eq!(it.next(), Some("note: Run with `RUST_BACKTRACE=1` for a backtrace.")); + assert_eq!(it.next(), Some("note: Run with `RUST_BACKTRACE=1` \ + environment variable to display a backtrace.")); assert_eq!(it.next().map(|l| l.starts_with("thread 'main' panicked at")), Some(true)); assert_eq!(it.next(), None); } diff --git a/src/test/run-pass/multibyte.rs b/src/test/run-pass/multibyte.rs index 0475dd10fde..889f0cb75c7 100644 --- a/src/test/run-pass/multibyte.rs +++ b/src/test/run-pass/multibyte.rs @@ -1,12 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // Test that multibyte characters don't crash the compiler diff --git a/src/test/run-pass/multidispatch-conditional-impl-not-considered.rs b/src/test/run-pass/multidispatch-conditional-impl-not-considered.rs index 49ecef9c735..72aa9edd0f3 100644 --- a/src/test/run-pass/multidispatch-conditional-impl-not-considered.rs +++ b/src/test/run-pass/multidispatch-conditional-impl-not-considered.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we correctly ignore the blanket impl // because (in this case) `T` does not impl `Clone`. // diff --git a/src/test/run-pass/multidispatch1.rs b/src/test/run-pass/multidispatch1.rs index 7137a4109b1..ac22aeac12e 100644 --- a/src/test/run-pass/multidispatch1.rs +++ b/src/test/run-pass/multidispatch1.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::fmt::Debug; trait MyTrait { diff --git a/src/test/run-pass/multidispatch2.rs b/src/test/run-pass/multidispatch2.rs index 1573c0234a6..517f8157489 100644 --- a/src/test/run-pass/multidispatch2.rs +++ b/src/test/run-pass/multidispatch2.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::fmt::Debug; use std::default::Default; diff --git a/src/test/run-pass/multiline-comment.rs b/src/test/run-pass/multiline-comment.rs index 8c74326d1c3..76f9284eb3e 100644 --- a/src/test/run-pass/multiline-comment.rs +++ b/src/test/run-pass/multiline-comment.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // pretty-expanded FIXME #23616 /* diff --git a/src/test/run-pass/multiple-reprs.rs b/src/test/run-pass/multiple-reprs.rs index c00fb68f9f7..97c5d930f73 100644 --- a/src/test/run-pass/multiple-reprs.rs +++ b/src/test/run-pass/multiple-reprs.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] use std::mem::{size_of, align_of}; diff --git a/src/test/run-pass/mut-function-arguments.rs b/src/test/run-pass/mut-function-arguments.rs index bf4d4ea921a..924d754b325 100644 --- a/src/test/run-pass/mut-function-arguments.rs +++ b/src/test/run-pass/mut-function-arguments.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn f(mut y: Box) { diff --git a/src/test/run-pass/mut-vstore-expr.rs b/src/test/run-pass/mut-vstore-expr.rs index 503f3ce5f9b..d598e3b88db 100644 --- a/src/test/run-pass/mut-vstore-expr.rs +++ b/src/test/run-pass/mut-vstore-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 pub fn main() { diff --git a/src/test/run-pass/mutual-recursion-group.rs b/src/test/run-pass/mutual-recursion-group.rs index 87879e08414..3be87b5a490 100644 --- a/src/test/run-pass/mutual-recursion-group.rs +++ b/src/test/run-pass/mutual-recursion-group.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] diff --git a/src/test/run-pass/native-print-no-runtime.rs b/src/test/run-pass/native-print-no-runtime.rs index deb0b503061..e4d7eb82c67 100644 --- a/src/test/run-pass/native-print-no-runtime.rs +++ b/src/test/run-pass/native-print-no-runtime.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(start)] #[start] diff --git a/src/test/run-pass/negative.rs b/src/test/run-pass/negative.rs index df074ddc06a..cc75d2ee86a 100644 --- a/src/test/run-pass/negative.rs +++ b/src/test/run-pass/negative.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub fn main() { match -5 { -5 => {} diff --git a/src/test/run-pass/nested-block-comment.rs b/src/test/run-pass/nested-block-comment.rs index 650e28548c1..62d038024a2 100644 --- a/src/test/run-pass/nested-block-comment.rs +++ b/src/test/run-pass/nested-block-comment.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 /* This test checks that nested comments are supported diff --git a/src/test/run-pass/nested-class.rs b/src/test/run-pass/nested-class.rs index ca869386856..1b98291c375 100644 --- a/src/test/run-pass/nested-class.rs +++ b/src/test/run-pass/nested-class.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] pub fn main() { diff --git a/src/test/run-pass/nested-function-names-issue-8587.rs b/src/test/run-pass/nested-function-names-issue-8587.rs index 24b1f5ac75e..7a6164383df 100644 --- a/src/test/run-pass/nested-function-names-issue-8587.rs +++ b/src/test/run-pass/nested-function-names-issue-8587.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure nested functions are separate, even if they have // equal name. // diff --git a/src/test/run-pass/nested_item_main.rs b/src/test/run-pass/nested_item_main.rs index b24d517f737..225619ad47a 100644 --- a/src/test/run-pass/nested_item_main.rs +++ b/src/test/run-pass/nested_item_main.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:nested_item.rs diff --git a/src/test/run-pass/never-result.rs b/src/test/run-pass/never-result.rs index a1b9eda8b89..2b395aa7f66 100644 --- a/src/test/run-pass/never-result.rs +++ b/src/test/run-pass/never-result.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unreachable_code)] // Test that we can extract a ! through pattern matching then use it as several different types. diff --git a/src/test/run-pass/never-type-rvalues.rs b/src/test/run-pass/never-type-rvalues.rs index bda288f4086..2de8567924e 100644 --- a/src/test/run-pass/never-type-rvalues.rs +++ b/src/test/run-pass/never-type-rvalues.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(never_type)] #![allow(dead_code)] #![allow(path_statements)] diff --git a/src/test/run-pass/never_coercions.rs b/src/test/run-pass/never_coercions.rs index dfba5d2c3da..70f67fd3da1 100644 --- a/src/test/run-pass/never_coercions.rs +++ b/src/test/run-pass/never_coercions.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that having something of type ! doesn't screw up type-checking and that it coerces to the // LUB type of the other match arms. diff --git a/src/test/run-pass/new-box-syntax.rs b/src/test/run-pass/new-box-syntax.rs index 6598b70b3d5..a39803c2eb8 100644 --- a/src/test/run-pass/new-box-syntax.rs +++ b/src/test/run-pass/new-box-syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 /* Any copyright is dedicated to the Public Domain. diff --git a/src/test/run-pass/new-box.rs b/src/test/run-pass/new-box.rs index d6881ea90af..b35c5445a44 100644 --- a/src/test/run-pass/new-box.rs +++ b/src/test/run-pass/new-box.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn f(x: Box) { diff --git a/src/test/run-pass/new-impl-syntax.rs b/src/test/run-pass/new-impl-syntax.rs index 554fab53e4b..d02136d9309 100644 --- a/src/test/run-pass/new-impl-syntax.rs +++ b/src/test/run-pass/new-impl-syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; struct Thingy { diff --git a/src/test/run-pass/new-import-syntax.rs b/src/test/run-pass/new-import-syntax.rs index 36e5b020b55..67cf5ab2e1f 100644 --- a/src/test/run-pass/new-import-syntax.rs +++ b/src/test/run-pass/new-import-syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { println!("Hello world!"); } diff --git a/src/test/run-pass/new-style-constants.rs b/src/test/run-pass/new-style-constants.rs index 36d66d1e12b..1ded0cd1c8b 100644 --- a/src/test/run-pass/new-style-constants.rs +++ b/src/test/run-pass/new-style-constants.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static FOO: isize = 3; pub fn main() { diff --git a/src/test/run-pass/new-unicode-escapes.rs b/src/test/run-pass/new-unicode-escapes.rs index 2c041757605..1bce71a9ed9 100644 --- a/src/test/run-pass/new-unicode-escapes.rs +++ b/src/test/run-pass/new-unicode-escapes.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub fn main() { let s = "\u{2603}"; assert_eq!(s, "☃"); diff --git a/src/test/run-pass/new-unsafe-pointers.rs b/src/test/run-pass/new-unsafe-pointers.rs index a0d631046a6..a80ef141087 100644 --- a/src/test/run-pass/new-unsafe-pointers.rs +++ b/src/test/run-pass/new-unsafe-pointers.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 fn main() { diff --git a/src/test/run-pass/newlambdas-ret-infer.rs b/src/test/run-pass/newlambdas-ret-infer.rs index c2871469de1..969868486e6 100644 --- a/src/test/run-pass/newlambdas-ret-infer.rs +++ b/src/test/run-pass/newlambdas-ret-infer.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Test that the lambda kind is inferred correctly as a return // expression diff --git a/src/test/run-pass/newlambdas-ret-infer2.rs b/src/test/run-pass/newlambdas-ret-infer2.rs index 4d545c7a969..676b3507c57 100644 --- a/src/test/run-pass/newlambdas-ret-infer2.rs +++ b/src/test/run-pass/newlambdas-ret-infer2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Test that the lambda kind is inferred correctly as a return // expression diff --git a/src/test/run-pass/newlambdas.rs b/src/test/run-pass/newlambdas.rs index a6f39958632..93199f8ccd5 100644 --- a/src/test/run-pass/newlambdas.rs +++ b/src/test/run-pass/newlambdas.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests for the new |args| expr lambda syntax diff --git a/src/test/run-pass/newtype-polymorphic.rs b/src/test/run-pass/newtype-polymorphic.rs index 20817cddd05..c79b76d646c 100644 --- a/src/test/run-pass/newtype-polymorphic.rs +++ b/src/test/run-pass/newtype-polymorphic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/newtype-temporary.rs b/src/test/run-pass/newtype-temporary.rs index 19790a488b5..f8d6cde2aa8 100644 --- a/src/test/run-pass/newtype-temporary.rs +++ b/src/test/run-pass/newtype-temporary.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(PartialEq, Debug)] struct Foo(usize); diff --git a/src/test/run-pass/newtype.rs b/src/test/run-pass/newtype.rs index 3dbad08f1d8..56d908ad0b7 100644 --- a/src/test/run-pass/newtype.rs +++ b/src/test/run-pass/newtype.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #[derive(Copy, Clone)] struct mytype(Mytype); diff --git a/src/test/run-pass/nil-decl-in-foreign.rs b/src/test/run-pass/nil-decl-in-foreign.rs index 96bc80c2125..faff6b48730 100644 --- a/src/test/run-pass/nil-decl-in-foreign.rs +++ b/src/test/run-pass/nil-decl-in-foreign.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(improper_ctypes)] #![allow(dead_code)] // Issue #901 diff --git a/src/test/run-pass/nll/issue-47153-generic-const.rs b/src/test/run-pass/nll/issue-47153-generic-const.rs index ac41179bcac..4f021fda4e3 100644 --- a/src/test/run-pass/nll/issue-47153-generic-const.rs +++ b/src/test/run-pass/nll/issue-47153-generic-const.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for #47153: constants in a generic context (such as diff --git a/src/test/run-pass/nll/issue-47589.rs b/src/test/run-pass/nll/issue-47589.rs index f960cfd7fb3..5bbed3a8590 100644 --- a/src/test/run-pass/nll/issue-47589.rs +++ b/src/test/run-pass/nll/issue-47589.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(nll)] diff --git a/src/test/run-pass/nll/issue-48623-closure.rs b/src/test/run-pass/nll/issue-48623-closure.rs index 68c9c428b06..5a41fff11a1 100644 --- a/src/test/run-pass/nll/issue-48623-closure.rs +++ b/src/test/run-pass/nll/issue-48623-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(path_statements)] #![allow(dead_code)] diff --git a/src/test/run-pass/nll/issue-48623-generator.rs b/src/test/run-pass/nll/issue-48623-generator.rs index b733545256f..b404daca725 100644 --- a/src/test/run-pass/nll/issue-48623-generator.rs +++ b/src/test/run-pass/nll/issue-48623-generator.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(path_statements)] #![allow(dead_code)] diff --git a/src/test/run-pass/nll/issue-50343.rs b/src/test/run-pass/nll/issue-50343.rs index f33baa288fa..8d2992b3b4f 100644 --- a/src/test/run-pass/nll/issue-50343.rs +++ b/src/test/run-pass/nll/issue-50343.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(nll)] diff --git a/src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs b/src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs index 3e40b527ef4..dc5257cfb92 100644 --- a/src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs +++ b/src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(nll)] diff --git a/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs b/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs index 781dded6272..c3f818812aa 100644 --- a/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs +++ b/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(nll)] diff --git a/src/test/run-pass/nll/mutating_references.rs b/src/test/run-pass/nll/mutating_references.rs index 1cf9e3aae90..0af8751494e 100644 --- a/src/test/run-pass/nll/mutating_references.rs +++ b/src/test/run-pass/nll/mutating_references.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(nll)] diff --git a/src/test/run-pass/nll/process_or_insert_default.rs b/src/test/run-pass/nll/process_or_insert_default.rs index 57fbfb642ea..e9cd4014bc3 100644 --- a/src/test/run-pass/nll/process_or_insert_default.rs +++ b/src/test/run-pass/nll/process_or_insert_default.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(nll)] diff --git a/src/test/run-pass/nll/rc-loop.rs b/src/test/run-pass/nll/rc-loop.rs index 420f09707f1..2c54ee86939 100644 --- a/src/test/run-pass/nll/rc-loop.rs +++ b/src/test/run-pass/nll/rc-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // A test for something that NLL enables. It sometimes happens that diff --git a/src/test/run-pass/no-core-1.rs b/src/test/run-pass/no-core-1.rs index f5f08969118..36a3050d3df 100644 --- a/src/test/run-pass/no-core-1.rs +++ b/src/test/run-pass/no-core-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] #![feature(no_core, core)] #![no_core] diff --git a/src/test/run-pass/no-landing-pads.rs b/src/test/run-pass/no-landing-pads.rs index 73f123045d2..46497865826 100644 --- a/src/test/run-pass/no-landing-pads.rs +++ b/src/test/run-pass/no-landing-pads.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z no-landing-pads -C codegen-units=1 // ignore-emscripten no threads support diff --git a/src/test/run-pass/no-std-1.rs b/src/test/run-pass/no-std-1.rs index 9298d74f9c4..fecf7397c8f 100644 --- a/src/test/run-pass/no-std-1.rs +++ b/src/test/run-pass/no-std-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] extern crate std; diff --git a/src/test/run-pass/no-std-2.rs b/src/test/run-pass/no-std-2.rs index 1b24987052b..946f993ca88 100644 --- a/src/test/run-pass/no-std-2.rs +++ b/src/test/run-pass/no-std-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] extern crate std; diff --git a/src/test/run-pass/no-std-3.rs b/src/test/run-pass/no-std-3.rs index 685c62f5a53..f937d2593a0 100644 --- a/src/test/run-pass/no-std-3.rs +++ b/src/test/run-pass/no-std-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] extern crate std; diff --git a/src/test/run-pass/no-stdio.rs b/src/test/run-pass/no-stdio.rs index d3424176960..005781e1d2f 100644 --- a/src/test/run-pass/no-stdio.rs +++ b/src/test/run-pass/no-stdio.rs @@ -1,18 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-android // ignore-cloudabi no processes // ignore-emscripten no processes -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/non-built-in-quote.rs b/src/test/run-pass/non-built-in-quote.rs index 6c0df5f4c14..75df2788d79 100644 --- a/src/test/run-pass/non-built-in-quote.rs +++ b/src/test/run-pass/non-built-in-quote.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 macro_rules! quote_tokens { () => (()) } diff --git a/src/test/run-pass/non-legacy-modes.rs b/src/test/run-pass/non-legacy-modes.rs index 58534ed96da..a3abbeb8156 100644 --- a/src/test/run-pass/non-legacy-modes.rs +++ b/src/test/run-pass/non-legacy-modes.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - struct X { repr: isize } diff --git a/src/test/run-pass/non_modrs_mods/foors_mod.rs b/src/test/run-pass/non_modrs_mods/foors_mod.rs index b2fea9b5e53..1ed2e0d88df 100644 --- a/src/test/run-pass/non_modrs_mods/foors_mod.rs +++ b/src/test/run-pass/non_modrs_mods/foors_mod.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // ignore-test: not a test, used by non_modrs_mods.rs diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs b/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs index 77cab972352..68429e9831f 100644 --- a/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs +++ b/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod innest; diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs b/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs index b61667cfd88..b76b4321d62 100644 --- a/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs +++ b/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs b/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs index b61667cfd88..b76b4321d62 100644 --- a/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs +++ b/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs b/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs index 77cab972352..68429e9831f 100644 --- a/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs +++ b/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod innest; diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs index 77cab972352..68429e9831f 100644 --- a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod innest; diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs index b61667cfd88..b76b4321d62 100644 --- a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs index b61667cfd88..b76b4321d62 100644 --- a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs index 77cab972352..68429e9831f 100644 --- a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod innest; diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs index 99684c86d2e..46add00996b 100644 --- a/src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod inner_modrs_mod; pub mod inner_foors_mod; pub mod inline { diff --git a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs index 226e6fda0a4..97441eb5e57 100644 --- a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs +++ b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod inner_modrs_mod; diff --git a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs index b61667cfd88..b76b4321d62 100644 --- a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs +++ b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs index 77cab972352..68429e9831f 100644 --- a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs +++ b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod innest; diff --git a/src/test/run-pass/nul-characters.rs b/src/test/run-pass/nul-characters.rs index cbea5e71f25..d93219d83d2 100644 --- a/src/test/run-pass/nul-characters.rs +++ b/src/test/run-pass/nul-characters.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub fn main() { let all_nuls1 = "\0\x00\u{0}\u{0}"; diff --git a/src/test/run-pass/nullable-pointer-ffi-compat.rs b/src/test/run-pass/nullable-pointer-ffi-compat.rs index 2b7cf6c6682..0487052799a 100644 --- a/src/test/run-pass/nullable-pointer-ffi-compat.rs +++ b/src/test/run-pass/nullable-pointer-ffi-compat.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // #11303, #11040: // This would previously crash on i686 Linux due to abi differences // between returning an Option and T, where T is a non nullable diff --git a/src/test/run-pass/nullable-pointer-iotareduction.rs b/src/test/run-pass/nullable-pointer-iotareduction.rs index d33102a38f9..42aad550c1a 100644 --- a/src/test/run-pass/nullable-pointer-iotareduction.rs +++ b/src/test/run-pass/nullable-pointer-iotareduction.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] // Iota-reduction is a rule in the Calculus of (Co-)Inductive Constructions, diff --git a/src/test/run-pass/nullable-pointer-size.rs b/src/test/run-pass/nullable-pointer-size.rs index bdeae618c8b..efd5cea6a4b 100644 --- a/src/test/run-pass/nullable-pointer-size.rs +++ b/src/test/run-pass/nullable-pointer-size.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] use std::mem; diff --git a/src/test/run-pass/numbers-arithmetic/arith-0.rs b/src/test/run-pass/numbers-arithmetic/arith-0.rs index 4d432cd5b4e..7943cb908d1 100644 --- a/src/test/run-pass/numbers-arithmetic/arith-0.rs +++ b/src/test/run-pass/numbers-arithmetic/arith-0.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/arith-1.rs b/src/test/run-pass/numbers-arithmetic/arith-1.rs index b78b359ced0..c13c8d8b765 100644 --- a/src/test/run-pass/numbers-arithmetic/arith-1.rs +++ b/src/test/run-pass/numbers-arithmetic/arith-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/arith-2.rs b/src/test/run-pass/numbers-arithmetic/arith-2.rs index 91e207c2b2f..46c280677ce 100644 --- a/src/test/run-pass/numbers-arithmetic/arith-2.rs +++ b/src/test/run-pass/numbers-arithmetic/arith-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/arith-unsigned.rs b/src/test/run-pass/numbers-arithmetic/arith-unsigned.rs index dc672d50d7f..ad57d9f8645 100644 --- a/src/test/run-pass/numbers-arithmetic/arith-unsigned.rs +++ b/src/test/run-pass/numbers-arithmetic/arith-unsigned.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_comparisons)] diff --git a/src/test/run-pass/numbers-arithmetic/div-mod.rs b/src/test/run-pass/numbers-arithmetic/div-mod.rs index d04638f790b..acb92a7df73 100644 --- a/src/test/run-pass/numbers-arithmetic/div-mod.rs +++ b/src/test/run-pass/numbers-arithmetic/div-mod.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/float-int-invalid-const-cast.rs b/src/test/run-pass/numbers-arithmetic/float-int-invalid-const-cast.rs index 97f5f39a9e5..d210abdf499 100644 --- a/src/test/run-pass/numbers-arithmetic/float-int-invalid-const-cast.rs +++ b/src/test/run-pass/numbers-arithmetic/float-int-invalid-const-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no i128 support diff --git a/src/test/run-pass/numbers-arithmetic/float-literal-inference.rs b/src/test/run-pass/numbers-arithmetic/float-literal-inference.rs index e3e724cbe77..c4645e4f8ff 100644 --- a/src/test/run-pass/numbers-arithmetic/float-literal-inference.rs +++ b/src/test/run-pass/numbers-arithmetic/float-literal-inference.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct S { z: f64 diff --git a/src/test/run-pass/numbers-arithmetic/float-nan.rs b/src/test/run-pass/numbers-arithmetic/float-nan.rs index 7725859eec6..ee87b8cccfe 100644 --- a/src/test/run-pass/numbers-arithmetic/float-nan.rs +++ b/src/test/run-pass/numbers-arithmetic/float-nan.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::f64; diff --git a/src/test/run-pass/numbers-arithmetic/float-signature.rs b/src/test/run-pass/numbers-arithmetic/float-signature.rs index 12a25aa6e8e..d47280ea2e7 100644 --- a/src/test/run-pass/numbers-arithmetic/float-signature.rs +++ b/src/test/run-pass/numbers-arithmetic/float-signature.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/float.rs b/src/test/run-pass/numbers-arithmetic/float.rs index 597b4630683..d55c05857b6 100644 --- a/src/test/run-pass/numbers-arithmetic/float.rs +++ b/src/test/run-pass/numbers-arithmetic/float.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { let pi = 3.1415927f64; diff --git a/src/test/run-pass/numbers-arithmetic/float2.rs b/src/test/run-pass/numbers-arithmetic/float2.rs index 70c7c600f40..b1bcf8da5a3 100644 --- a/src/test/run-pass/numbers-arithmetic/float2.rs +++ b/src/test/run-pass/numbers-arithmetic/float2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/float_math.rs b/src/test/run-pass/numbers-arithmetic/float_math.rs index d86ad34c9d8..a2902ee5608 100644 --- a/src/test/run-pass/numbers-arithmetic/float_math.rs +++ b/src/test/run-pass/numbers-arithmetic/float_math.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(core_intrinsics)] diff --git a/src/test/run-pass/numbers-arithmetic/floatlits.rs b/src/test/run-pass/numbers-arithmetic/floatlits.rs index 34f52ccb33a..07049af315b 100644 --- a/src/test/run-pass/numbers-arithmetic/floatlits.rs +++ b/src/test/run-pass/numbers-arithmetic/floatlits.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/i128-ffi.rs b/src/test/run-pass/numbers-arithmetic/i128-ffi.rs index 747a05f6062..19edf9779f3 100644 --- a/src/test/run-pass/numbers-arithmetic/i128-ffi.rs +++ b/src/test/run-pass/numbers-arithmetic/i128-ffi.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(improper_ctypes)] diff --git a/src/test/run-pass/numbers-arithmetic/i128.rs b/src/test/run-pass/numbers-arithmetic/i128.rs index c3d4a638290..f3b5506ae32 100644 --- a/src/test/run-pass/numbers-arithmetic/i128.rs +++ b/src/test/run-pass/numbers-arithmetic/i128.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(overflowing_literals)] diff --git a/src/test/run-pass/numbers-arithmetic/i32-sub.rs b/src/test/run-pass/numbers-arithmetic/i32-sub.rs index 12a0004ca48..56df772b4e1 100644 --- a/src/test/run-pass/numbers-arithmetic/i32-sub.rs +++ b/src/test/run-pass/numbers-arithmetic/i32-sub.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/i8-incr.rs b/src/test/run-pass/numbers-arithmetic/i8-incr.rs index e9779d202b0..718d259f735 100644 --- a/src/test/run-pass/numbers-arithmetic/i8-incr.rs +++ b/src/test/run-pass/numbers-arithmetic/i8-incr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/int-abs-overflow.rs b/src/test/run-pass/numbers-arithmetic/int-abs-overflow.rs index 92094f7b058..2bc018445db 100644 --- a/src/test/run-pass/numbers-arithmetic/int-abs-overflow.rs +++ b/src/test/run-pass/numbers-arithmetic/int-abs-overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -Z force-overflow-checks=on // ignore-emscripten no threads support diff --git a/src/test/run-pass/numbers-arithmetic/int.rs b/src/test/run-pass/numbers-arithmetic/int.rs index 7d8af653833..b496a70a6fe 100644 --- a/src/test/run-pass/numbers-arithmetic/int.rs +++ b/src/test/run-pass/numbers-arithmetic/int.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/integer-literal-radix.rs b/src/test/run-pass/numbers-arithmetic/integer-literal-radix.rs index 814d7de01a4..8f61ea17a12 100644 --- a/src/test/run-pass/numbers-arithmetic/integer-literal-radix.rs +++ b/src/test/run-pass/numbers-arithmetic/integer-literal-radix.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { diff --git a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs index 240d235c712..80248dc223d 100644 --- a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs +++ b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-3.rs b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-3.rs index 7b10a049dc6..bec718a3c6a 100644 --- a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-3.rs +++ b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() { println!("{}", std::mem::size_of_val(&1)); diff --git a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs index ecbadb94a82..d177ced1a69 100644 --- a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs +++ b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-debug.rs b/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-debug.rs index 704aca19367..e9927304f23 100644 --- a/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-debug.rs +++ b/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-debug.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -C debug_assertions=yes // ignore-wasm32-bare compiled with panic=abort by default diff --git a/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs b/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs index e581f7c97cc..982cd97c50a 100644 --- a/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs +++ b/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -C debug_assertions=no // ignore-emscripten dies with an LLVM error diff --git a/src/test/run-pass/numbers-arithmetic/num-wrapping.rs b/src/test/run-pass/numbers-arithmetic/num-wrapping.rs index 86ca2c8a495..d7ab51f8649 100644 --- a/src/test/run-pass/numbers-arithmetic/num-wrapping.rs +++ b/src/test/run-pass/numbers-arithmetic/num-wrapping.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_macros)] diff --git a/src/test/run-pass/numbers-arithmetic/numeric-method-autoexport.rs b/src/test/run-pass/numbers-arithmetic/numeric-method-autoexport.rs index 22db67bf920..5798c2591a0 100644 --- a/src/test/run-pass/numbers-arithmetic/numeric-method-autoexport.rs +++ b/src/test/run-pass/numbers-arithmetic/numeric-method-autoexport.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This file is intended to test only that methods are automatically // reachable for each numeric type, for each exported impl, with no imports diff --git a/src/test/run-pass/numbers-arithmetic/promoted_overflow_opt.rs b/src/test/run-pass/numbers-arithmetic/promoted_overflow_opt.rs index 16042128901..a3b8ff58a73 100644 --- a/src/test/run-pass/numbers-arithmetic/promoted_overflow_opt.rs +++ b/src/test/run-pass/numbers-arithmetic/promoted_overflow_opt.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(const_err)] diff --git a/src/test/run-pass/numbers-arithmetic/saturating-float-casts.rs b/src/test/run-pass/numbers-arithmetic/saturating-float-casts.rs index a822ac604fa..f13964fb386 100644 --- a/src/test/run-pass/numbers-arithmetic/saturating-float-casts.rs +++ b/src/test/run-pass/numbers-arithmetic/saturating-float-casts.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests saturating float->int casts. See u128-as-f32.rs for the opposite direction. // compile-flags: -Z saturating-float-casts diff --git a/src/test/run-pass/numbers-arithmetic/shift-near-oflo.rs b/src/test/run-pass/numbers-arithmetic/shift-near-oflo.rs index 3effc8de97f..939eb974612 100644 --- a/src/test/run-pass/numbers-arithmetic/shift-near-oflo.rs +++ b/src/test/run-pass/numbers-arithmetic/shift-near-oflo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -C debug-assertions diff --git a/src/test/run-pass/numbers-arithmetic/shift-various-types.rs b/src/test/run-pass/numbers-arithmetic/shift-various-types.rs index 1ae94255adf..473bda3d76e 100644 --- a/src/test/run-pass/numbers-arithmetic/shift-various-types.rs +++ b/src/test/run-pass/numbers-arithmetic/shift-various-types.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we can do shifts by any integral type. diff --git a/src/test/run-pass/numbers-arithmetic/shift.rs b/src/test/run-pass/numbers-arithmetic/shift.rs index e9d48f1a1af..2fc77928ef1 100644 --- a/src/test/run-pass/numbers-arithmetic/shift.rs +++ b/src/test/run-pass/numbers-arithmetic/shift.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] #![allow(overflowing_literals)] diff --git a/src/test/run-pass/numbers-arithmetic/signed-shift-const-eval.rs b/src/test/run-pass/numbers-arithmetic/signed-shift-const-eval.rs index b0ff7a255ab..6d0462b460e 100644 --- a/src/test/run-pass/numbers-arithmetic/signed-shift-const-eval.rs +++ b/src/test/run-pass/numbers-arithmetic/signed-shift-const-eval.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/numbers-arithmetic/u128-as-f32.rs b/src/test/run-pass/numbers-arithmetic/u128-as-f32.rs index 99dfd3ba1cf..bef7deb6276 100644 --- a/src/test/run-pass/numbers-arithmetic/u128-as-f32.rs +++ b/src/test/run-pass/numbers-arithmetic/u128-as-f32.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten u128 not supported diff --git a/src/test/run-pass/numbers-arithmetic/u128.rs b/src/test/run-pass/numbers-arithmetic/u128.rs index c03d39e8416..56d1f221d84 100644 --- a/src/test/run-pass/numbers-arithmetic/u128.rs +++ b/src/test/run-pass/numbers-arithmetic/u128.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten u128 not supported diff --git a/src/test/run-pass/numbers-arithmetic/u32-decr.rs b/src/test/run-pass/numbers-arithmetic/u32-decr.rs index e86d3abefa7..d9e09781877 100644 --- a/src/test/run-pass/numbers-arithmetic/u32-decr.rs +++ b/src/test/run-pass/numbers-arithmetic/u32-decr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/u8-incr-decr.rs b/src/test/run-pass/numbers-arithmetic/u8-incr-decr.rs index 2567da479f1..b16ec011d06 100644 --- a/src/test/run-pass/numbers-arithmetic/u8-incr-decr.rs +++ b/src/test/run-pass/numbers-arithmetic/u8-incr-decr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/u8-incr.rs b/src/test/run-pass/numbers-arithmetic/u8-incr.rs index ca49efaade6..5242acf5b98 100644 --- a/src/test/run-pass/numbers-arithmetic/u8-incr.rs +++ b/src/test/run-pass/numbers-arithmetic/u8-incr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/numbers-arithmetic/uint.rs b/src/test/run-pass/numbers-arithmetic/uint.rs index 01ee2167c72..d219eae8f33 100644 --- a/src/test/run-pass/numbers-arithmetic/uint.rs +++ b/src/test/run-pass/numbers-arithmetic/uint.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/object-lifetime-default-default-to-static.rs b/src/test/run-pass/object-lifetime-default-default-to-static.rs index 1b631f171eb..cf836c1a7de 100644 --- a/src/test/run-pass/object-lifetime-default-default-to-static.rs +++ b/src/test/run-pass/object-lifetime-default-default-to-static.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `Box` is equivalent to `Box`, both in // fields and fn arguments. diff --git a/src/test/run-pass/object-lifetime-default-from-rptr-box.rs b/src/test/run-pass/object-lifetime-default-from-rptr-box.rs index af8018b7653..3f69c927488 100644 --- a/src/test/run-pass/object-lifetime-default-from-rptr-box.rs +++ b/src/test/run-pass/object-lifetime-default-from-rptr-box.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the lifetime from the enclosing `&` is "inherited" // through the `Box` struct. diff --git a/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs b/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs index edd0bdb32c2..dc9e292f0de 100644 --- a/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs +++ b/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the lifetime of the enclosing `&` is used for the object // lifetime bound. diff --git a/src/test/run-pass/object-lifetime-default-from-rptr.rs b/src/test/run-pass/object-lifetime-default-from-rptr.rs index cbff0d4dbaa..061f71b9ae6 100644 --- a/src/test/run-pass/object-lifetime-default-from-rptr.rs +++ b/src/test/run-pass/object-lifetime-default-from-rptr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the lifetime of the enclosing `&` is used for the object // lifetime bound. diff --git a/src/test/run-pass/object-method-numbering.rs b/src/test/run-pass/object-method-numbering.rs index 82d34fa9ae4..455af78c7a0 100644 --- a/src/test/run-pass/object-method-numbering.rs +++ b/src/test/run-pass/object-method-numbering.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for using an object with an associated type binding as the // instantiation for a generic type with a bound. diff --git a/src/test/run-pass/objects-coerce-freeze-borrored.rs b/src/test/run-pass/objects-coerce-freeze-borrored.rs index f907b5723f4..872b9d3e916 100644 --- a/src/test/run-pass/objects-coerce-freeze-borrored.rs +++ b/src/test/run-pass/objects-coerce-freeze-borrored.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can coerce an `@Object` to an `&Object` diff --git a/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs b/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs index c27bc62ada8..a96772bfb63 100644 --- a/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs +++ b/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test invoked `&self` methods on owned objects where the values // closed over do not contain managed values, and thus the boxes do // not have headers. diff --git a/src/test/run-pass/objects-owned-object-owned-method.rs b/src/test/run-pass/objects-owned-object-owned-method.rs index 5d9658dc15d..6ca5233b198 100644 --- a/src/test/run-pass/objects-owned-object-owned-method.rs +++ b/src/test/run-pass/objects-owned-object-owned-method.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test invoked `&self` methods on owned objects where the values // closed over contain managed values. This implies that the boxes // will have headers that must be skipped over. diff --git a/src/test/run-pass/once-move-out-on-heap.rs b/src/test/run-pass/once-move-out-on-heap.rs index 6dd4c0ddce3..46e663417cf 100644 --- a/src/test/run-pass/once-move-out-on-heap.rs +++ b/src/test/run-pass/once-move-out-on-heap.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Testing guarantees provided by once functions. diff --git a/src/test/run-pass/one-tuple.rs b/src/test/run-pass/one-tuple.rs index 68974b47d06..fa54f952938 100644 --- a/src/test/run-pass/one-tuple.rs +++ b/src/test/run-pass/one-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Why one-tuples? Because macros. diff --git a/src/test/run-pass/op-assign-builtins-by-ref.rs b/src/test/run-pass/op-assign-builtins-by-ref.rs index 230d44ba647..8e0353e4849 100644 --- a/src/test/run-pass/op-assign-builtins-by-ref.rs +++ b/src/test/run-pass/op-assign-builtins-by-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { // test compound assignment operators with ref as right-hand side, // for each operator, with various types as operands. diff --git a/src/test/run-pass/opeq.rs b/src/test/run-pass/opeq.rs index f5f0928ff14..ea6c7647bb5 100644 --- a/src/test/run-pass/opeq.rs +++ b/src/test/run-pass/opeq.rs @@ -1,16 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - pub fn main() { let mut x: isize = 1; x *= 2; diff --git a/src/test/run-pass/operator-associativity.rs b/src/test/run-pass/operator-associativity.rs index 86ca8f3325a..69e3f699e9c 100644 --- a/src/test/run-pass/operator-associativity.rs +++ b/src/test/run-pass/operator-associativity.rs @@ -1,16 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - // Testcase for issue #130, operator associativity. pub fn main() { assert_eq!(3 * 5 / 2, 7); } diff --git a/src/test/run-pass/operator-multidispatch.rs b/src/test/run-pass/operator-multidispatch.rs index af7deef11b6..cc546c903b7 100644 --- a/src/test/run-pass/operator-multidispatch.rs +++ b/src/test/run-pass/operator-multidispatch.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can overload the `+` operator for points so that two // points can be added, and a point can be added to an integer. diff --git a/src/test/run-pass/operator-overloading.rs b/src/test/run-pass/operator-overloading.rs index 1d66388275e..026e2536cef 100644 --- a/src/test/run-pass/operator-overloading.rs +++ b/src/test/run-pass/operator-overloading.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] use std::cmp; use std::ops; diff --git a/src/test/run-pass/optimization-fuel-0.rs b/src/test/run-pass/optimization-fuel-0.rs index a12dad4489d..0920bc9c4b9 100644 --- a/src/test/run-pass/optimization-fuel-0.rs +++ b/src/test/run-pass/optimization-fuel-0.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="foo"] use std::mem::size_of; diff --git a/src/test/run-pass/optimization-fuel-1.rs b/src/test/run-pass/optimization-fuel-1.rs index 1e76aaa48b7..58778cac50d 100644 --- a/src/test/run-pass/optimization-fuel-1.rs +++ b/src/test/run-pass/optimization-fuel-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="foo"] use std::mem::size_of; diff --git a/src/test/run-pass/option-ext.rs b/src/test/run-pass/option-ext.rs index c054171ff00..0b21b8e5b5a 100644 --- a/src/test/run-pass/option-ext.rs +++ b/src/test/run-pass/option-ext.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let thing = "{{ f }}"; let f = thing.find("{{"); diff --git a/src/test/run-pass/option-unwrap.rs b/src/test/run-pass/option-unwrap.rs index 32faab4c12c..6ad65c99247 100644 --- a/src/test/run-pass/option-unwrap.rs +++ b/src/test/run-pass/option-unwrap.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] use std::cell::Cell; diff --git a/src/test/run-pass/out-of-stack.rs b/src/test/run-pass/out-of-stack.rs index cd0f7cdbf6d..72d6d680622 100644 --- a/src/test/run-pass/out-of-stack.rs +++ b/src/test/run-pass/out-of-stack.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] #![allow(unconditional_recursion)] // ignore-android: FIXME (#20004) @@ -16,7 +6,7 @@ // ignore-emscripten no processes #![feature(asm)] -#![feature(libc)] +#![feature(rustc_private)] #[cfg(unix)] extern crate libc; diff --git a/src/test/run-pass/out-pointer-aliasing.rs b/src/test/run-pass/out-pointer-aliasing.rs index 790affd939f..48fa9020b93 100644 --- a/src/test/run-pass/out-pointer-aliasing.rs +++ b/src/test/run-pass/out-pointer-aliasing.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #[derive(Copy, Clone)] pub struct Foo { f1: isize, diff --git a/src/test/run-pass/output-slot-variants.rs b/src/test/run-pass/output-slot-variants.rs index e4013854e78..f3cc2e99e0f 100644 --- a/src/test/run-pass/output-slot-variants.rs +++ b/src/test/run-pass/output-slot-variants.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_assignments)] #![allow(unknown_lints)] diff --git a/src/test/run-pass/over-constrained-vregs.rs b/src/test/run-pass/over-constrained-vregs.rs index edbb311fcda..6d1b2d55e55 100644 --- a/src/test/run-pass/over-constrained-vregs.rs +++ b/src/test/run-pass/over-constrained-vregs.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] // Regression test for issue #152. pub fn main() { diff --git a/src/test/run-pass/overlap-doesnt-conflict-with-specialization.rs b/src/test/run-pass/overlap-doesnt-conflict-with-specialization.rs index ed45d81c0d6..ddad0f59699 100644 --- a/src/test/run-pass/overlap-doesnt-conflict-with-specialization.rs +++ b/src/test/run-pass/overlap-doesnt-conflict-with-specialization.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(overlapping_marker_traits)] #![feature(specialization)] diff --git a/src/test/run-pass/overlap-permitted-for-annotated-marker-traits.rs b/src/test/run-pass/overlap-permitted-for-annotated-marker-traits.rs index e1081032c05..53c5cfc8138 100644 --- a/src/test/run-pass/overlap-permitted-for-annotated-marker-traits.rs +++ b/src/test/run-pass/overlap-permitted-for-annotated-marker-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests for RFC 1268: we allow overlapping impls of marker traits, // that is, traits with #[marker]. In this case, a type `T` is // `MyMarker` if it is either `Debug` or `Display`. diff --git a/src/test/run-pass/overloaded/auxiliary/overloaded_autoderef_xc.rs b/src/test/run-pass/overloaded/auxiliary/overloaded_autoderef_xc.rs index 3c8cba13ae7..112455f91f9 100644 --- a/src/test/run-pass/overloaded/auxiliary/overloaded_autoderef_xc.rs +++ b/src/test/run-pass/overloaded/auxiliary/overloaded_autoderef_xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Deref; struct DerefWithHelper { diff --git a/src/test/run-pass/overloaded/overloaded-autoderef-count.rs b/src/test/run-pass/overloaded/overloaded-autoderef-count.rs index 0e07be53829..d58deda09f7 100644 --- a/src/test/run-pass/overloaded/overloaded-autoderef-count.rs +++ b/src/test/run-pass/overloaded/overloaded-autoderef-count.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::cell::Cell; use std::ops::{Deref, DerefMut}; diff --git a/src/test/run-pass/overloaded/overloaded-autoderef-indexing.rs b/src/test/run-pass/overloaded/overloaded-autoderef-indexing.rs index f4f42add88f..1c8c7cca93c 100644 --- a/src/test/run-pass/overloaded/overloaded-autoderef-indexing.rs +++ b/src/test/run-pass/overloaded/overloaded-autoderef-indexing.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::Deref; diff --git a/src/test/run-pass/overloaded/overloaded-autoderef-order.rs b/src/test/run-pass/overloaded/overloaded-autoderef-order.rs index 1480b036542..1ae16d2a7fc 100644 --- a/src/test/run-pass/overloaded/overloaded-autoderef-order.rs +++ b/src/test/run-pass/overloaded/overloaded-autoderef-order.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::rc::Rc; diff --git a/src/test/run-pass/overloaded/overloaded-autoderef-vtable.rs b/src/test/run-pass/overloaded/overloaded-autoderef-vtable.rs index cb987c21a3c..f8e6d12088f 100644 --- a/src/test/run-pass/overloaded/overloaded-autoderef-vtable.rs +++ b/src/test/run-pass/overloaded/overloaded-autoderef-vtable.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/overloaded/overloaded-autoderef-xcrate.rs b/src/test/run-pass/overloaded/overloaded-autoderef-xcrate.rs index 9408d02ba33..d065e825cc3 100644 --- a/src/test/run-pass/overloaded/overloaded-autoderef-xcrate.rs +++ b/src/test/run-pass/overloaded/overloaded-autoderef-xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:overloaded_autoderef_xc.rs diff --git a/src/test/run-pass/overloaded/overloaded-autoderef.rs b/src/test/run-pass/overloaded/overloaded-autoderef.rs index 0c991247eb2..e850633e34f 100644 --- a/src/test/run-pass/overloaded/overloaded-autoderef.rs +++ b/src/test/run-pass/overloaded/overloaded-autoderef.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(stable_features)] diff --git a/src/test/run-pass/overloaded/overloaded-calls-object-one-arg.rs b/src/test/run-pass/overloaded/overloaded-calls-object-one-arg.rs index d80ed4531fe..ff484418c1d 100644 --- a/src/test/run-pass/overloaded/overloaded-calls-object-one-arg.rs +++ b/src/test/run-pass/overloaded/overloaded-calls-object-one-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests calls to closure arguments where the closure takes 1 argument. // This is a bit tricky due to rust-call ABI. diff --git a/src/test/run-pass/overloaded/overloaded-calls-object-two-args.rs b/src/test/run-pass/overloaded/overloaded-calls-object-two-args.rs index bfc815baeaa..0d0136bc29a 100644 --- a/src/test/run-pass/overloaded/overloaded-calls-object-two-args.rs +++ b/src/test/run-pass/overloaded/overloaded-calls-object-two-args.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests calls to closure arguments where the closure takes 2 arguments. // This is a bit tricky due to rust-call ABI. diff --git a/src/test/run-pass/overloaded/overloaded-calls-object-zero-args.rs b/src/test/run-pass/overloaded/overloaded-calls-object-zero-args.rs index ebabaf09f57..bbea6a909c8 100644 --- a/src/test/run-pass/overloaded/overloaded-calls-object-zero-args.rs +++ b/src/test/run-pass/overloaded/overloaded-calls-object-zero-args.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests calls to closure arguments where the closure takes 0 arguments. // This is a bit tricky due to rust-call ABI. diff --git a/src/test/run-pass/overloaded/overloaded-calls-param-vtables.rs b/src/test/run-pass/overloaded/overloaded-calls-param-vtables.rs index 6db534d3081..fde1ad20f7d 100644 --- a/src/test/run-pass/overloaded/overloaded-calls-param-vtables.rs +++ b/src/test/run-pass/overloaded/overloaded-calls-param-vtables.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that nested vtables work with overloaded calls. diff --git a/src/test/run-pass/overloaded/overloaded-calls-simple.rs b/src/test/run-pass/overloaded/overloaded-calls-simple.rs index 825263c891d..41318360799 100644 --- a/src/test/run-pass/overloaded/overloaded-calls-simple.rs +++ b/src/test/run-pass/overloaded/overloaded-calls-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(lang_items, unboxed_closures, fn_traits)] diff --git a/src/test/run-pass/overloaded/overloaded-calls-zero-args.rs b/src/test/run-pass/overloaded/overloaded-calls-zero-args.rs index de8915493da..69ca88619b8 100644 --- a/src/test/run-pass/overloaded/overloaded-calls-zero-args.rs +++ b/src/test/run-pass/overloaded/overloaded-calls-zero-args.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(unboxed_closures, fn_traits)] diff --git a/src/test/run-pass/overloaded/overloaded-deref-count.rs b/src/test/run-pass/overloaded/overloaded-deref-count.rs index 79040afbd0e..e2f1e10b5c8 100644 --- a/src/test/run-pass/overloaded/overloaded-deref-count.rs +++ b/src/test/run-pass/overloaded/overloaded-deref-count.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::cell::Cell; diff --git a/src/test/run-pass/overloaded/overloaded-deref.rs b/src/test/run-pass/overloaded/overloaded-deref.rs index 779d1b2391e..73d8232a322 100644 --- a/src/test/run-pass/overloaded/overloaded-deref.rs +++ b/src/test/run-pass/overloaded/overloaded-deref.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::cell::RefCell; use std::rc::Rc; diff --git a/src/test/run-pass/overloaded/overloaded-index-assoc-list.rs b/src/test/run-pass/overloaded/overloaded-index-assoc-list.rs index 7c23e8e28f8..eb027afeacd 100644 --- a/src/test/run-pass/overloaded/overloaded-index-assoc-list.rs +++ b/src/test/run-pass/overloaded/overloaded-index-assoc-list.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test overloading of the `[]` operator. In particular test that it // takes its argument *by reference*. diff --git a/src/test/run-pass/overloaded/overloaded-index-autoderef.rs b/src/test/run-pass/overloaded/overloaded-index-autoderef.rs index 024bd4e2bb7..6996ee32933 100644 --- a/src/test/run-pass/overloaded/overloaded-index-autoderef.rs +++ b/src/test/run-pass/overloaded/overloaded-index-autoderef.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] diff --git a/src/test/run-pass/overloaded/overloaded-index-in-field.rs b/src/test/run-pass/overloaded/overloaded-index-in-field.rs index 3302a4e3a7d..8a1fa7deb99 100644 --- a/src/test/run-pass/overloaded/overloaded-index-in-field.rs +++ b/src/test/run-pass/overloaded/overloaded-index-in-field.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test using overloaded indexing when the "map" is stored in a // field. This caused problems at some point. diff --git a/src/test/run-pass/overloaded/overloaded-index.rs b/src/test/run-pass/overloaded/overloaded-index.rs index 8ae612764a7..5ad6d2e7004 100644 --- a/src/test/run-pass/overloaded/overloaded-index.rs +++ b/src/test/run-pass/overloaded/overloaded-index.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::{Index, IndexMut}; diff --git a/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs b/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs index b5ed5cc37d9..c87ba6a023b 100644 --- a/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs +++ b/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![allow(unused_variables)] diff --git a/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs b/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs index ae405350ad0..61edd2ace3a 100644 --- a/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs +++ b/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/owned-implies-static.rs b/src/test/run-pass/owned-implies-static.rs index f698b660751..7101726ab6a 100644 --- a/src/test/run-pass/owned-implies-static.rs +++ b/src/test/run-pass/owned-implies-static.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 fn f(_x: T) {} diff --git a/src/test/run-pass/packed/auxiliary/packed.rs b/src/test/run-pass/packed/auxiliary/packed.rs index 828be41cd41..cba166facf4 100644 --- a/src/test/run-pass/packed/auxiliary/packed.rs +++ b/src/test/run-pass/packed/auxiliary/packed.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(repr_packed)] - #[repr(packed)] pub struct P1S5 { a: u8, diff --git a/src/test/run-pass/packed/packed-struct-borrow-element.rs b/src/test/run-pass/packed/packed-struct-borrow-element.rs index 69969ba640f..6ac42ed0d47 100644 --- a/src/test/run-pass/packed/packed-struct-borrow-element.rs +++ b/src/test/run-pass/packed/packed-struct-borrow-element.rs @@ -1,19 +1,7 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // ignore-emscripten weird assertion? -#![feature(repr_packed)] - #[repr(packed)] struct Foo1 { bar: u8, diff --git a/src/test/run-pass/packed/packed-struct-drop-aligned.rs b/src/test/run-pass/packed/packed-struct-drop-aligned.rs index 8cc29797772..fab3bbedac6 100644 --- a/src/test/run-pass/packed/packed-struct-drop-aligned.rs +++ b/src/test/run-pass/packed/packed-struct-drop-aligned.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::cell::Cell; use std::mem; diff --git a/src/test/run-pass/packed/packed-struct-generic-layout.rs b/src/test/run-pass/packed/packed-struct-generic-layout.rs index 04544918171..e064eede4ce 100644 --- a/src/test/run-pass/packed/packed-struct-generic-layout.rs +++ b/src/test/run-pass/packed/packed-struct-generic-layout.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(overflowing_literals)] diff --git a/src/test/run-pass/packed/packed-struct-generic-size.rs b/src/test/run-pass/packed/packed-struct-generic-size.rs index 58cd5505ffc..08d4674d2a8 100644 --- a/src/test/run-pass/packed/packed-struct-generic-size.rs +++ b/src/test/run-pass/packed/packed-struct-generic-size.rs @@ -1,20 +1,7 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] -#![allow(stable_features)] #![allow(unused_comparisons)] -#![feature(repr_packed)] - use std::mem; #[repr(packed)] diff --git a/src/test/run-pass/packed/packed-struct-generic-size.stderr b/src/test/run-pass/packed/packed-struct-generic-size.stderr index 994ea7c44fb..1af476c1568 100644 --- a/src/test/run-pass/packed/packed-struct-generic-size.stderr +++ b/src/test/run-pass/packed/packed-struct-generic-size.stderr @@ -1,35 +1,35 @@ warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:49:14 + --> $DIR/packed-struct-generic-size.rs:36:14 | LL | check!(P1::, 1, 3); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:50:14 + --> $DIR/packed-struct-generic-size.rs:37:14 | LL | check!(P1::, 1, 11); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:52:14 + --> $DIR/packed-struct-generic-size.rs:39:14 | LL | check!(P2::, 1, 3); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:53:14 + --> $DIR/packed-struct-generic-size.rs:40:14 | LL | check!(P2::, 2, 12); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:55:15 + --> $DIR/packed-struct-generic-size.rs:42:15 | LL | check!(P4C::, 1, 3); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:56:15 + --> $DIR/packed-struct-generic-size.rs:43:15 | LL | check!(P4C::, 4, 12); | ^^ try removing `::` diff --git a/src/test/run-pass/packed/packed-struct-layout.rs b/src/test/run-pass/packed/packed-struct-layout.rs index 6aa8770304a..d49c222e648 100644 --- a/src/test/run-pass/packed/packed-struct-layout.rs +++ b/src/test/run-pass/packed/packed-struct-layout.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] use std::mem; diff --git a/src/test/run-pass/packed/packed-struct-match.rs b/src/test/run-pass/packed/packed-struct-match.rs index e349a4e7f54..9a572ced717 100644 --- a/src/test/run-pass/packed/packed-struct-match.rs +++ b/src/test/run-pass/packed/packed-struct-match.rs @@ -1,15 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -#![feature(repr_packed)] #[repr(packed)] struct Foo1 { diff --git a/src/test/run-pass/packed/packed-struct-optimized-enum.rs b/src/test/run-pass/packed/packed-struct-optimized-enum.rs index e22e8c26fe5..7ce62464ef0 100644 --- a/src/test/run-pass/packed/packed-struct-optimized-enum.rs +++ b/src/test/run-pass/packed/packed-struct-optimized-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[repr(packed)] struct Packed(T); @@ -34,12 +24,12 @@ fn main() { // In #46769, `Option<(Packed<&()>, bool)>` was found to have // pointer alignment, without actually being aligned in size. - // E.g. on 64-bit platforms, it had alignment `8` but size `9`. + // e.g., on 64-bit platforms, it had alignment `8` but size `9`. type PackedRefAndBool<'a> = (Packed<&'a ()>, bool); sanity_check_size::>(Some((Packed(&()), true))); // Make sure we don't pay for the enum optimization in size, - // e.g. we shouldn't need extra padding after the packed data. + // e.g., we shouldn't need extra padding after the packed data. assert_eq!(std::mem::align_of::>(), 1); assert_eq!(std::mem::size_of::>(), std::mem::size_of::()); diff --git a/src/test/run-pass/packed/packed-struct-size-xc.rs b/src/test/run-pass/packed/packed-struct-size-xc.rs index 5b1fb6b92c7..46112d51d83 100644 --- a/src/test/run-pass/packed/packed-struct-size-xc.rs +++ b/src/test/run-pass/packed/packed-struct-size-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:packed.rs diff --git a/src/test/run-pass/packed/packed-struct-size.rs b/src/test/run-pass/packed/packed-struct-size.rs index 27e07b87ff4..c832c7cfad5 100644 --- a/src/test/run-pass/packed/packed-struct-size.rs +++ b/src/test/run-pass/packed/packed-struct-size.rs @@ -1,21 +1,8 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] -#![feature(repr_packed)] - - use std::mem; #[repr(packed)] diff --git a/src/test/run-pass/packed/packed-struct-vec.rs b/src/test/run-pass/packed/packed-struct-vec.rs index d64bfe0033b..18676cfc22e 100644 --- a/src/test/run-pass/packed/packed-struct-vec.rs +++ b/src/test/run-pass/packed/packed-struct-vec.rs @@ -1,15 +1,4 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -#![feature(repr_packed)] use std::fmt; use std::mem; diff --git a/src/test/run-pass/packed/packed-tuple-struct-layout.rs b/src/test/run-pass/packed/packed-tuple-struct-layout.rs index c709a40cabb..b88637fbe56 100644 --- a/src/test/run-pass/packed/packed-tuple-struct-layout.rs +++ b/src/test/run-pass/packed/packed-tuple-struct-layout.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem; diff --git a/src/test/run-pass/packed/packed-tuple-struct-size.rs b/src/test/run-pass/packed/packed-tuple-struct-size.rs index 011ff4c20f4..f7a3c903fca 100644 --- a/src/test/run-pass/packed/packed-tuple-struct-size.rs +++ b/src/test/run-pass/packed/packed-tuple-struct-size.rs @@ -1,19 +1,7 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] -#![feature(repr_packed)] - use std::mem; #[repr(packed)] diff --git a/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs b/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs index 5de5786d6a5..e2dbb0d175d 100644 --- a/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs +++ b/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // compile-flags:-C panic=abort diff --git a/src/test/run-pass/panic-runtime/abort.rs b/src/test/run-pass/panic-runtime/abort.rs index 621a258dc9d..719034bd11e 100644 --- a/src/test/run-pass/panic-runtime/abort.rs +++ b/src/test/run-pass/panic-runtime/abort.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // compile-flags:-C panic=abort diff --git a/src/test/run-pass/panic-runtime/auxiliary/exit-success-if-unwind.rs b/src/test/run-pass/panic-runtime/auxiliary/exit-success-if-unwind.rs index 9e5fc592b1a..c0e05740542 100644 --- a/src/test/run-pass/panic-runtime/auxiliary/exit-success-if-unwind.rs +++ b/src/test/run-pass/panic-runtime/auxiliary/exit-success-if-unwind.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass/panic-runtime/link-to-abort.rs b/src/test/run-pass/panic-runtime/link-to-abort.rs index 5016c9591b0..422206c574d 100644 --- a/src/test/run-pass/panic-runtime/link-to-abort.rs +++ b/src/test/run-pass/panic-runtime/link-to-abort.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags:-C panic=abort diff --git a/src/test/run-pass/panic-runtime/link-to-unwind.rs b/src/test/run-pass/panic-runtime/link-to-unwind.rs index 47d7aeaef26..59036ca99bd 100644 --- a/src/test/run-pass/panic-runtime/link-to-unwind.rs +++ b/src/test/run-pass/panic-runtime/link-to-unwind.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // no-prefer-dynamic diff --git a/src/test/run-pass/panic-runtime/lto-abort.rs b/src/test/run-pass/panic-runtime/lto-abort.rs index dd884b966bc..9015a8f25a9 100644 --- a/src/test/run-pass/panic-runtime/lto-abort.rs +++ b/src/test/run-pass/panic-runtime/lto-abort.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // compile-flags:-C lto -C panic=abort diff --git a/src/test/run-pass/panic-runtime/lto-unwind.rs b/src/test/run-pass/panic-runtime/lto-unwind.rs index 3b2a5dd7141..b14cdfc193f 100644 --- a/src/test/run-pass/panic-runtime/lto-unwind.rs +++ b/src/test/run-pass/panic-runtime/lto-unwind.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] diff --git a/src/test/run-pass/panic-uninitialized-zeroed.rs b/src/test/run-pass/panic-uninitialized-zeroed.rs index 2972f6efa32..d47ff6c630d 100644 --- a/src/test/run-pass/panic-uninitialized-zeroed.rs +++ b/src/test/run-pass/panic-uninitialized-zeroed.rs @@ -1,18 +1,8 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare always compiled as panic=abort right now and this requires unwinding // This test checks that instantiating an uninhabited type via `mem::{uninitialized,zeroed}` results // in a runtime panic. -#![feature(never_type)] +#![feature(never_type, maybe_uninit)] use std::{mem, panic}; @@ -30,7 +20,7 @@ fn main() { panic::catch_unwind(|| { mem::uninitialized::() }).err().and_then(|a| a.downcast_ref::().map(|s| { - s == "Attempted to instantiate uninhabited type ! using mem::uninitialized" + s == "Attempted to instantiate uninhabited type !" })), Some(true) ); @@ -39,7 +29,16 @@ fn main() { panic::catch_unwind(|| { mem::zeroed::() }).err().and_then(|a| a.downcast_ref::().map(|s| { - s == "Attempted to instantiate uninhabited type ! using mem::zeroed" + s == "Attempted to instantiate uninhabited type !" + })), + Some(true) + ); + + assert_eq!( + panic::catch_unwind(|| { + mem::MaybeUninit::::uninitialized().into_inner() + }).err().and_then(|a| a.downcast_ref::().map(|s| { + s == "Attempted to instantiate uninhabited type !" })), Some(true) ); @@ -48,7 +47,7 @@ fn main() { panic::catch_unwind(|| { mem::uninitialized::() }).err().and_then(|a| a.downcast_ref::().map(|s| { - s == "Attempted to instantiate uninhabited type Foo using mem::uninitialized" + s == "Attempted to instantiate uninhabited type Foo" })), Some(true) ); @@ -57,7 +56,16 @@ fn main() { panic::catch_unwind(|| { mem::zeroed::() }).err().and_then(|a| a.downcast_ref::().map(|s| { - s == "Attempted to instantiate uninhabited type Foo using mem::zeroed" + s == "Attempted to instantiate uninhabited type Foo" + })), + Some(true) + ); + + assert_eq!( + panic::catch_unwind(|| { + mem::MaybeUninit::::uninitialized().into_inner() + }).err().and_then(|a| a.downcast_ref::().map(|s| { + s == "Attempted to instantiate uninhabited type Foo" })), Some(true) ); @@ -66,7 +74,7 @@ fn main() { panic::catch_unwind(|| { mem::uninitialized::() }).err().and_then(|a| a.downcast_ref::().map(|s| { - s == "Attempted to instantiate uninhabited type Bar using mem::uninitialized" + s == "Attempted to instantiate uninhabited type Bar" })), Some(true) ); @@ -75,7 +83,16 @@ fn main() { panic::catch_unwind(|| { mem::zeroed::() }).err().and_then(|a| a.downcast_ref::().map(|s| { - s == "Attempted to instantiate uninhabited type Bar using mem::zeroed" + s == "Attempted to instantiate uninhabited type Bar" + })), + Some(true) + ); + + assert_eq!( + panic::catch_unwind(|| { + mem::MaybeUninit::::uninitialized().into_inner() + }).err().and_then(|a| a.downcast_ref::().map(|s| { + s == "Attempted to instantiate uninhabited type Bar" })), Some(true) ); diff --git a/src/test/run-pass/panics/panic-handler-chain.rs b/src/test/run-pass/panics/panic-handler-chain.rs index c4c3dc1963e..93044b5cb25 100644 --- a/src/test/run-pass/panics/panic-handler-chain.rs +++ b/src/test/run-pass/panics/panic-handler-chain.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] diff --git a/src/test/run-pass/panics/panic-handler-flail-wildly.rs b/src/test/run-pass/panics/panic-handler-flail-wildly.rs index 5715202067e..ebe4f70378c 100644 --- a/src/test/run-pass/panics/panic-handler-flail-wildly.rs +++ b/src/test/run-pass/panics/panic-handler-flail-wildly.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] diff --git a/src/test/run-pass/panics/panic-handler-set-twice.rs b/src/test/run-pass/panics/panic-handler-set-twice.rs index 1e493fc2bb4..0312ed221ca 100644 --- a/src/test/run-pass/panics/panic-handler-set-twice.rs +++ b/src/test/run-pass/panics/panic-handler-set-twice.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(stable_features)] diff --git a/src/test/run-pass/panics/panic-in-dtor-drops-fields.rs b/src/test/run-pass/panics/panic-in-dtor-drops-fields.rs index bb115f92b90..caddd942dc0 100644 --- a/src/test/run-pass/panics/panic-in-dtor-drops-fields.rs +++ b/src/test/run-pass/panics/panic-in-dtor-drops-fields.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/panics/panic-recover-propagate.rs b/src/test/run-pass/panics/panic-recover-propagate.rs index 42571615105..7969336ca74 100644 --- a/src/test/run-pass/panics/panic-recover-propagate.rs +++ b/src/test/run-pass/panics/panic-recover-propagate.rs @@ -1,21 +1,11 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support -use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use std::sync::atomic::{AtomicUsize, Ordering}; use std::panic; use std::thread; -static A: AtomicUsize = ATOMIC_USIZE_INIT; +static A: AtomicUsize = AtomicUsize::new(0); fn main() { panic::set_hook(Box::new(|_| { diff --git a/src/test/run-pass/panics/panic-safe.rs b/src/test/run-pass/panics/panic-safe.rs index 0d1ce110639..3798a4fc5cb 100644 --- a/src/test/run-pass/panics/panic-safe.rs +++ b/src/test/run-pass/panics/panic-safe.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/paren-free.rs b/src/test/run-pass/paren-free.rs index d9669812d2a..1f05ee0ed22 100644 --- a/src/test/run-pass/paren-free.rs +++ b/src/test/run-pass/paren-free.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let x = true; if x { let mut i = 10; while i > 0 { i -= 1; } } diff --git a/src/test/run-pass/parse-assoc-type-lt.rs b/src/test/run-pass/parse-assoc-type-lt.rs index c8167722053..e6b07c583fb 100644 --- a/src/test/run-pass/parse-assoc-type-lt.rs +++ b/src/test/run-pass/parse-assoc-type-lt.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 trait Foo { diff --git a/src/test/run-pass/parse-panic.rs b/src/test/run-pass/parse-panic.rs index 5c904295bb4..a08cd106ec1 100644 --- a/src/test/run-pass/parse-panic.rs +++ b/src/test/run-pass/parse-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unreachable_code)] diff --git a/src/test/run-pass/parser-unicode-whitespace.rs b/src/test/run-pass/parser-unicode-whitespace.rs index 837bb8339e1..26e79b06172 100644 --- a/src/test/run-pass/parser-unicode-whitespace.rs +++ b/src/test/run-pass/parser-unicode-whitespace.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // Beware editing: it has numerous whitespace characters which are important. // It contains one ranges from the 'PATTERN_WHITE_SPACE' property outlined in // http://unicode.org/Public/UNIDATA/PropList.txt diff --git a/src/test/run-pass/path.rs b/src/test/run-pass/path.rs index fddc2744eb1..7a9b04c0704 100644 --- a/src/test/run-pass/path.rs +++ b/src/test/run-pass/path.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - // pretty-expanded FIXME #23616 mod foo { diff --git a/src/test/run-pass/paths-containing-nul.rs b/src/test/run-pass/paths-containing-nul.rs index 3359f1064c9..8c800089d1c 100644 --- a/src/test/run-pass/paths-containing-nul.rs +++ b/src/test/run-pass/paths-containing-nul.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(deprecated)] // ignore-cloudabi no files or I/O // ignore-wasm32-bare no files or I/O diff --git a/src/test/run-pass/print-stdout-eprint-stderr.rs b/src/test/run-pass/print-stdout-eprint-stderr.rs index 9e36089cc23..9c47a734d7b 100644 --- a/src/test/run-pass/print-stdout-eprint-stderr.rs +++ b/src/test/run-pass/print-stdout-eprint-stderr.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi spawning processes is not supported // ignore-emscripten spawning processes is not supported diff --git a/src/test/run-pass/privacy/auxiliary/priv-impl-prim-ty.rs b/src/test/run-pass/privacy/auxiliary/priv-impl-prim-ty.rs index 19cdede5518..8ccbd3f12bf 100644 --- a/src/test/run-pass/privacy/auxiliary/priv-impl-prim-ty.rs +++ b/src/test/run-pass/privacy/auxiliary/priv-impl-prim-ty.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait A { fn frob(&self); } diff --git a/src/test/run-pass/privacy/auxiliary/privacy_reexport.rs b/src/test/run-pass/privacy/auxiliary/privacy_reexport.rs index fd97f210a55..6b72dbc9233 100644 --- a/src/test/run-pass/privacy/auxiliary/privacy_reexport.rs +++ b/src/test/run-pass/privacy/auxiliary/privacy_reexport.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub extern crate core; pub use foo as bar; diff --git a/src/test/run-pass/privacy/auxiliary/pub_use_mods_xcrate.rs b/src/test/run-pass/privacy/auxiliary/pub_use_mods_xcrate.rs index e4890f4fe2d..74d3504d5be 100644 --- a/src/test/run-pass/privacy/auxiliary/pub_use_mods_xcrate.rs +++ b/src/test/run-pass/privacy/auxiliary/pub_use_mods_xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod a { pub use a::b::c; diff --git a/src/test/run-pass/privacy/auxiliary/pub_use_xcrate1.rs b/src/test/run-pass/privacy/auxiliary/pub_use_xcrate1.rs index 41aafd64cb3..772c9627a71 100644 --- a/src/test/run-pass/privacy/auxiliary/pub_use_xcrate1.rs +++ b/src/test/run-pass/privacy/auxiliary/pub_use_xcrate1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo { pub name: isize } diff --git a/src/test/run-pass/privacy/auxiliary/pub_use_xcrate2.rs b/src/test/run-pass/privacy/auxiliary/pub_use_xcrate2.rs index d59d7f2a613..20d7066d36d 100644 --- a/src/test/run-pass/privacy/auxiliary/pub_use_xcrate2.rs +++ b/src/test/run-pass/privacy/auxiliary/pub_use_xcrate2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate pub_use_xcrate1; pub use pub_use_xcrate1::Foo; diff --git a/src/test/run-pass/privacy/priv-impl-prim-ty.rs b/src/test/run-pass/privacy/priv-impl-prim-ty.rs index 2cb4dee90af..5d6a6b64ed3 100644 --- a/src/test/run-pass/privacy/priv-impl-prim-ty.rs +++ b/src/test/run-pass/privacy/priv-impl-prim-ty.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:priv-impl-prim-ty.rs diff --git a/src/test/run-pass/privacy/privacy-ns.rs b/src/test/run-pass/privacy/privacy-ns.rs index f11ff3f41a1..b1b03eae5db 100644 --- a/src/test/run-pass/privacy/privacy-ns.rs +++ b/src/test/run-pass/privacy/privacy-ns.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_snake_case)] diff --git a/src/test/run-pass/privacy/privacy-reexport.rs b/src/test/run-pass/privacy/privacy-reexport.rs index a12f7bb2611..b3ec3af04ac 100644 --- a/src/test/run-pass/privacy/privacy-reexport.rs +++ b/src/test/run-pass/privacy/privacy-reexport.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:privacy_reexport.rs diff --git a/src/test/run-pass/privacy/privacy1.rs b/src/test/run-pass/privacy/privacy1.rs index 703867713e6..4e54780dad2 100644 --- a/src/test/run-pass/privacy/privacy1.rs +++ b/src/test/run-pass/privacy/privacy1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/privacy/private-class-field.rs b/src/test/run-pass/privacy/private-class-field.rs index 15d83ea4d95..98e32ee0745 100644 --- a/src/test/run-pass/privacy/private-class-field.rs +++ b/src/test/run-pass/privacy/private-class-field.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/privacy/private-method.rs b/src/test/run-pass/privacy/private-method.rs index 012616403c6..726944fb251 100644 --- a/src/test/run-pass/privacy/private-method.rs +++ b/src/test/run-pass/privacy/private-method.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/privacy/pub-extern-privacy.rs b/src/test/run-pass/privacy/pub-extern-privacy.rs index a86133fb283..832acfbadcb 100644 --- a/src/test/run-pass/privacy/pub-extern-privacy.rs +++ b/src/test/run-pass/privacy/pub-extern-privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare no libc to test ffi with diff --git a/src/test/run-pass/privacy/pub-use-xcrate.rs b/src/test/run-pass/privacy/pub-use-xcrate.rs index f9c2de224db..e8a6e8cf182 100644 --- a/src/test/run-pass/privacy/pub-use-xcrate.rs +++ b/src/test/run-pass/privacy/pub-use-xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:pub_use_xcrate1.rs // aux-build:pub_use_xcrate2.rs diff --git a/src/test/run-pass/privacy/pub_use_mods_xcrate_exe.rs b/src/test/run-pass/privacy/pub_use_mods_xcrate_exe.rs index 4ca7c735308..f163619e7cb 100644 --- a/src/test/run-pass/privacy/pub_use_mods_xcrate_exe.rs +++ b/src/test/run-pass/privacy/pub_use_mods_xcrate_exe.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:pub_use_mods_xcrate.rs diff --git a/src/test/run-pass/proc-macro/add-impl.rs b/src/test/run-pass/proc-macro/add-impl.rs new file mode 100644 index 00000000000..239074b4e42 --- /dev/null +++ b/src/test/run-pass/proc-macro/add-impl.rs @@ -0,0 +1,13 @@ +// aux-build:add-impl.rs + +#[macro_use] +extern crate add_impl; + +#[derive(AddImpl)] +struct B; + +fn main() { + B.foo(); + foo(); + bar::foo(); +} diff --git a/src/test/run-pass/proc-macro/append-impl.rs b/src/test/run-pass/proc-macro/append-impl.rs new file mode 100644 index 00000000000..a49fd827801 --- /dev/null +++ b/src/test/run-pass/proc-macro/append-impl.rs @@ -0,0 +1,21 @@ +// aux-build:append-impl.rs + +#![allow(warnings)] + +#[macro_use] +extern crate append_impl; + +trait Append { + fn foo(&self); +} + +#[derive(PartialEq, + Append, + Eq)] +struct A { + inner: u32, +} + +fn main() { + A { inner: 3 }.foo(); +} diff --git a/src/test/run-pass/proc-macro/attr-args.rs b/src/test/run-pass/proc-macro/attr-args.rs new file mode 100644 index 00000000000..6ff6ccacf7c --- /dev/null +++ b/src/test/run-pass/proc-macro/attr-args.rs @@ -0,0 +1,12 @@ +// aux-build:attr-args.rs + +#![allow(warnings)] + +extern crate attr_args; +use attr_args::{attr_with_args, identity}; + +#[attr_with_args(text = "Hello, world!")] +fn foo() {} + +#[identity(fn main() { assert_eq!(foo(), "Hello, world!"); })] +struct Dummy; diff --git a/src/test/run-pass/proc-macro/attr-cfg.rs b/src/test/run-pass/proc-macro/attr-cfg.rs new file mode 100644 index 00000000000..7816576eb5c --- /dev/null +++ b/src/test/run-pass/proc-macro/attr-cfg.rs @@ -0,0 +1,26 @@ +// aux-build:attr-cfg.rs +// revisions: foo bar + +extern crate attr_cfg; +use attr_cfg::attr_cfg; + +#[attr_cfg] +fn outer() -> u8 { + #[cfg(foo)] + fn inner() -> u8 { 1 } + + #[cfg(bar)] + fn inner() -> u8 { 2 } + + inner() +} + +#[cfg(foo)] +fn main() { + assert_eq!(outer(), 1); +} + +#[cfg(bar)] +fn main() { + assert_eq!(outer(), 2); +} diff --git a/src/test/run-pass/proc-macro/attr-on-trait.rs b/src/test/run-pass/proc-macro/attr-on-trait.rs new file mode 100644 index 00000000000..4a8fac41101 --- /dev/null +++ b/src/test/run-pass/proc-macro/attr-on-trait.rs @@ -0,0 +1,18 @@ +// aux-build:attr-on-trait.rs + +extern crate attr_on_trait; + +use attr_on_trait::foo; + +trait Foo { + #[foo] + fn foo() {} +} + +impl Foo for i32 { + fn foo(&self) {} +} + +fn main() { + 3i32.foo(); +} diff --git a/src/test/run-pass/proc-macro/attr-stmt-expr.rs b/src/test/run-pass/proc-macro/attr-stmt-expr.rs new file mode 100644 index 00000000000..3f10754985b --- /dev/null +++ b/src/test/run-pass/proc-macro/attr-stmt-expr.rs @@ -0,0 +1,35 @@ +// aux-build:attr-stmt-expr.rs + +#![feature(stmt_expr_attributes, proc_macro_hygiene)] + +extern crate attr_stmt_expr; +use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr, + no_output, noop}; + +fn print_str(string: &'static str) { + // macros are handled a bit differently + #[expect_print_expr] + println!("{}", string) +} + +fn main() { + #[expect_let] + let string = "Hello, world!"; + + #[expect_print_stmt] + println!("{}", string); + + let _: () = { + #[no_output] + "Hello, world!" + }; + + let _: &'static str = #[noop] "Hello, world!"; + + let _: &'static str = { + #[noop] "Hello, world!" + }; + + #[expect_expr] + print_str("string") +} diff --git a/src/test/run-pass/proc-macro/auxiliary/add-impl.rs b/src/test/run-pass/proc-macro/auxiliary/add-impl.rs new file mode 100644 index 00000000000..741e64875b6 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/add-impl.rs @@ -0,0 +1,21 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(AddImpl)] +// #[cfg(proc_macro)] +pub fn derive(input: TokenStream) -> TokenStream { + "impl B { + fn foo(&self) {} + } + + fn foo() {} + + mod bar { pub fn foo() {} } + ".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/append-impl.rs b/src/test/run-pass/proc-macro/auxiliary/append-impl.rs new file mode 100644 index 00000000000..b032b133759 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/append-impl.rs @@ -0,0 +1,16 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Append)] +pub fn derive_a(input: TokenStream) -> TokenStream { + "impl Append for A { + fn foo(&self) {} + } + ".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/attr-args.rs b/src/test/run-pass/proc-macro/auxiliary/attr-args.rs new file mode 100644 index 00000000000..8dd2a5ac786 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/attr-args.rs @@ -0,0 +1,28 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn attr_with_args(args: TokenStream, input: TokenStream) -> TokenStream { + let args = args.to_string(); + + assert_eq!(args, r#"text = "Hello, world!""#); + + let input = input.to_string(); + + assert_eq!(input, "fn foo() { }"); + + r#" + fn foo() -> &'static str { "Hello, world!" } + "#.parse().unwrap() +} + +#[proc_macro_attribute] +pub fn identity(attr_args: TokenStream, _: TokenStream) -> TokenStream { + attr_args +} diff --git a/src/test/run-pass/proc-macro/auxiliary/attr-cfg.rs b/src/test/run-pass/proc-macro/auxiliary/attr-cfg.rs new file mode 100644 index 00000000000..f50e18d7be3 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/attr-cfg.rs @@ -0,0 +1,23 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn attr_cfg(args: TokenStream, input: TokenStream) -> TokenStream { + let input_str = input.to_string(); + + assert_eq!(input_str, "fn outer() -> u8 { + #[cfg(foo)] + fn inner() -> u8 { 1 } + #[cfg(bar)] + fn inner() -> u8 { 2 } + inner() +}"); + + input +} diff --git a/src/test/run-pass/proc-macro/auxiliary/attr-on-trait.rs b/src/test/run-pass/proc-macro/auxiliary/attr-on-trait.rs new file mode 100644 index 00000000000..d89aaac59f6 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/attr-on-trait.rs @@ -0,0 +1,15 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn foo(attr: TokenStream, item: TokenStream) -> TokenStream { + drop(attr); + assert_eq!(item.to_string(), "fn foo() { }"); + "fn foo(&self);".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/attr-stmt-expr.rs b/src/test/run-pass/proc-macro/auxiliary/attr-stmt-expr.rs new file mode 100644 index 00000000000..d81e16d9d29 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/attr-stmt-expr.rs @@ -0,0 +1,51 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn expect_let(attr: TokenStream, item: TokenStream) -> TokenStream { + assert!(attr.to_string().is_empty()); + assert_eq!(item.to_string(), "let string = \"Hello, world!\";"); + item +} + +#[proc_macro_attribute] +pub fn expect_print_stmt(attr: TokenStream, item: TokenStream) -> TokenStream { + assert!(attr.to_string().is_empty()); + assert_eq!(item.to_string(), "println!(\"{}\" , string);"); + item +} + +#[proc_macro_attribute] +pub fn expect_expr(attr: TokenStream, item: TokenStream) -> TokenStream { + assert!(attr.to_string().is_empty()); + assert_eq!(item.to_string(), "print_str(\"string\")"); + item +} + +#[proc_macro_attribute] +pub fn expect_print_expr(attr: TokenStream, item: TokenStream) -> TokenStream { + assert!(attr.to_string().is_empty()); + assert_eq!(item.to_string(), "println!(\"{}\" , string)"); + item +} + +#[proc_macro_attribute] +pub fn no_output(attr: TokenStream, item: TokenStream) -> TokenStream { + assert!(attr.to_string().is_empty()); + assert!(!item.to_string().is_empty()); + "".parse().unwrap() + +} + +#[proc_macro_attribute] +pub fn noop(attr: TokenStream, item: TokenStream) -> TokenStream { + assert!(attr.to_string().is_empty()); + assert!(!item.to_string().is_empty()); + item +} diff --git a/src/test/run-pass/proc-macro/auxiliary/bang-macro.rs b/src/test/run-pass/proc-macro/auxiliary/bang-macro.rs new file mode 100644 index 00000000000..ff000228218 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/bang-macro.rs @@ -0,0 +1,17 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro] +pub fn rewrite(input: TokenStream) -> TokenStream { + let input = input.to_string(); + + assert_eq!(input, r#""Hello, world!""#); + + r#""NOT Hello, world!""#.parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/call-site.rs b/src/test/run-pass/proc-macro/auxiliary/call-site.rs new file mode 100644 index 00000000000..e64a5a3438a --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/call-site.rs @@ -0,0 +1,27 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::*; + +#[proc_macro] +pub fn check(input: TokenStream) -> TokenStream { + // Parsed `x2` can refer to `x2` from `input` + let parsed1: TokenStream = "let x3 = x2;".parse().unwrap(); + // `x3` parsed from one string can refer to `x3` parsed from another string. + let parsed2: TokenStream = "let x4 = x3;".parse().unwrap(); + // Manually assembled `x4` can refer to parsed `x4`. + let manual: Vec = vec![ + Ident::new("let", Span::call_site()).into(), + Ident::new("x5", Span::call_site()).into(), + Punct::new('=', Spacing::Alone).into(), + Ident::new("x4", Span::call_site()).into(), + Punct::new(';', Spacing::Alone).into(), + ]; + input.into_iter().chain(parsed1.into_iter()) + .chain(parsed2.into_iter()) + .chain(manual.into_iter()) + .collect() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/count_compound_ops.rs b/src/test/run-pass/proc-macro/auxiliary/count_compound_ops.rs new file mode 100644 index 00000000000..e09622e48bf --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/count_compound_ops.rs @@ -0,0 +1,32 @@ +// force-host +// no-prefer-dynamic + +#![feature(proc_macro_hygiene, proc_macro_quote)] +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::{TokenStream, TokenTree, Spacing, Literal, quote}; + +#[proc_macro] +pub fn count_compound_ops(input: TokenStream) -> TokenStream { + assert_eq!(count_compound_ops_helper(quote!(++ (&&) 4@a)), 3); + let l = Literal::u32_suffixed(count_compound_ops_helper(input)); + TokenTree::from(l).into() +} + +fn count_compound_ops_helper(input: TokenStream) -> u32 { + let mut count = 0; + for token in input { + match &token { + TokenTree::Punct(tt) if tt.spacing() == Spacing::Alone => { + count += 1; + } + TokenTree::Group(tt) => { + count += count_compound_ops_helper(tt.stream()); + } + _ => {} + } + } + count +} diff --git a/src/test/run-pass/proc-macro/auxiliary/custom-attr-only-one-derive.rs b/src/test/run-pass/proc-macro/auxiliary/custom-attr-only-one-derive.rs new file mode 100644 index 00000000000..41f73f5963a --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/custom-attr-only-one-derive.rs @@ -0,0 +1,18 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Foo)] +pub fn foo(a: TokenStream) -> TokenStream { + "".parse().unwrap() +} + +#[proc_macro_derive(Bar, attributes(custom))] +pub fn bar(a: TokenStream) -> TokenStream { + "".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/derive-a.rs b/src/test/run-pass/proc-macro/auxiliary/derive-a.rs new file mode 100644 index 00000000000..cd2be5fd84d --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/derive-a.rs @@ -0,0 +1,15 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(A)] +pub fn derive(input: TokenStream) -> TokenStream { + let input = input.to_string(); + assert!(input.contains("struct A;")); + "".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/derive-atob.rs b/src/test/run-pass/proc-macro/auxiliary/derive-atob.rs new file mode 100644 index 00000000000..e78e5bb8f4c --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/derive-atob.rs @@ -0,0 +1,15 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(AToB)] +pub fn derive(input: TokenStream) -> TokenStream { + let input = input.to_string(); + assert_eq!(input, "struct A;"); + "struct B;".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/derive-attr-cfg.rs b/src/test/run-pass/proc-macro/auxiliary/derive-attr-cfg.rs new file mode 100644 index 00000000000..e7e9634e0bd --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/derive-attr-cfg.rs @@ -0,0 +1,14 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Foo, attributes(foo))] +pub fn derive(input: TokenStream) -> TokenStream { + assert!(!input.to_string().contains("#[cfg(any())]")); + "".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/derive-b.rs b/src/test/run-pass/proc-macro/auxiliary/derive-b.rs new file mode 100644 index 00000000000..fd056d605a0 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/derive-b.rs @@ -0,0 +1,17 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(B, attributes(B, C))] +pub fn derive(input: TokenStream) -> TokenStream { + let input = input.to_string(); + assert!(input.contains("#[B [ arbitrary tokens ]]")); + assert!(input.contains("struct B {")); + assert!(input.contains("#[C]")); + "".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/derive-ctod.rs b/src/test/run-pass/proc-macro/auxiliary/derive-ctod.rs new file mode 100644 index 00000000000..dbf44ed1b05 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/derive-ctod.rs @@ -0,0 +1,15 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(CToD)] +pub fn derive(input: TokenStream) -> TokenStream { + let input = input.to_string(); + assert_eq!(input, "struct C;"); + "struct D;".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/derive-nothing.rs b/src/test/run-pass/proc-macro/auxiliary/derive-nothing.rs new file mode 100644 index 00000000000..b6d1e133af7 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/derive-nothing.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Nothing)] +pub fn nothing(input: TokenStream) -> TokenStream { + "".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/derive-same-struct.rs b/src/test/run-pass/proc-macro/auxiliary/derive-same-struct.rs new file mode 100644 index 00000000000..ce7a50d2381 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/derive-same-struct.rs @@ -0,0 +1,21 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(AToB)] +pub fn derive1(input: TokenStream) -> TokenStream { + println!("input1: {:?}", input.to_string()); + assert_eq!(input.to_string(), "struct A;"); + "#[derive(BToC)] struct B;".parse().unwrap() +} + +#[proc_macro_derive(BToC)] +pub fn derive2(input: TokenStream) -> TokenStream { + assert_eq!(input.to_string(), "struct B;"); + "struct C;".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/derive-two-attrs.rs b/src/test/run-pass/proc-macro/auxiliary/derive-two-attrs.rs new file mode 100644 index 00000000000..a6f0eec126a --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/derive-two-attrs.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro_derive(A, attributes(b))] +pub fn foo(_x: TokenStream) -> TokenStream { + TokenStream::new() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/derive-union.rs b/src/test/run-pass/proc-macro/auxiliary/derive-union.rs new file mode 100644 index 00000000000..d950e1e773c --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/derive-union.rs @@ -0,0 +1,18 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(UnionTest)] +pub fn derive(input: TokenStream) -> TokenStream { + let input = input.to_string(); + assert!(input.contains("#[repr(C)]")); + assert!(input.contains("union Test {")); + assert!(input.contains("a: u8,")); + assert!(input.contains("}")); + "".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/double.rs b/src/test/run-pass/proc-macro/auxiliary/double.rs new file mode 100644 index 00000000000..3a2e8d04c36 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/double.rs @@ -0,0 +1,15 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +// Outputs another copy of the struct. Useful for testing the tokens +// seen by the proc_macro. +#[proc_macro_derive(Double)] +pub fn derive(input: TokenStream) -> TokenStream { + format!("mod foo {{ {} }}", input.to_string()).parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/empty-crate.rs b/src/test/run-pass/proc-macro/auxiliary/empty-crate.rs new file mode 100644 index 00000000000..1cf7534b289 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/empty-crate.rs @@ -0,0 +1,5 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![deny(unused_variables)] diff --git a/src/test/run-pass/proc-macro/auxiliary/expand-with-a-macro.rs b/src/test/run-pass/proc-macro/auxiliary/expand-with-a-macro.rs new file mode 100644 index 00000000000..8580005f4fc --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/expand-with-a-macro.rs @@ -0,0 +1,23 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![deny(warnings)] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(A)] +pub fn derive(input: TokenStream) -> TokenStream { + let input = input.to_string(); + assert!(input.contains("struct A;")); + r#" + impl A { + fn a(&self) { + panic!("hello"); + } + } + "#.parse().unwrap() +} + diff --git a/src/test/run-pass/proc-macro/auxiliary/external-crate-var.rs b/src/test/run-pass/proc-macro/auxiliary/external-crate-var.rs new file mode 100644 index 00000000000..09e5aea9b83 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/external-crate-var.rs @@ -0,0 +1,41 @@ +pub struct ExternFoo; + +pub trait ExternTrait { + const CONST: u32; + type Assoc; +} + +impl ExternTrait for ExternFoo { + const CONST: u32 = 0; + type Assoc = ExternFoo; +} + +#[macro_export] +macro_rules! external { () => { + mod bar { + #[derive(Double)] + struct Bar($crate::ExternFoo); + } + + mod qself { + #[derive(Double)] + struct QSelf(<$crate::ExternFoo as $crate::ExternTrait>::Assoc); + } + + mod qself_recurse { + #[derive(Double)] + struct QSelfRecurse(< + <$crate::ExternFoo as $crate::ExternTrait>::Assoc + as $crate::ExternTrait>::Assoc + ); + } + + mod qself_in_const { + #[derive(Double)] + #[repr(u32)] + enum QSelfInConst { + Variant = <$crate::ExternFoo as $crate::ExternTrait>::CONST, + } + } +} } + diff --git a/src/test/run-pass/proc-macro/auxiliary/gen-lifetime-token.rs b/src/test/run-pass/proc-macro/auxiliary/gen-lifetime-token.rs new file mode 100644 index 00000000000..d1a1c584f8b --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/gen-lifetime-token.rs @@ -0,0 +1,25 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro] +pub fn bar(_input: TokenStream) -> TokenStream { + let mut ret = Vec::::new(); + ret.push(Ident::new("static", Span::call_site()).into()); + ret.push(Ident::new("FOO", Span::call_site()).into()); + ret.push(Punct::new(':', Spacing::Alone).into()); + ret.push(Punct::new('&', Spacing::Alone).into()); + ret.push(Punct::new('\'', Spacing::Joint).into()); + ret.push(Ident::new("static", Span::call_site()).into()); + ret.push(Ident::new("i32", Span::call_site()).into()); + ret.push(Punct::new('=', Spacing::Alone).into()); + ret.push(Punct::new('&', Spacing::Alone).into()); + ret.push(Literal::i32_unsuffixed(1).into()); + ret.push(Punct::new(';', Spacing::Alone).into()); + ret.into_iter().collect() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/hygiene_example.rs b/src/test/run-pass/proc-macro/auxiliary/hygiene_example.rs new file mode 100644 index 00000000000..f7e7e0b5751 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/hygiene_example.rs @@ -0,0 +1,7 @@ +extern crate hygiene_example_codegen; + +pub use hygiene_example_codegen::hello; + +pub fn print(string: &str) { + println!("{}", string); +} diff --git a/src/test/run-pass/proc-macro/auxiliary/hygiene_example_codegen.rs b/src/test/run-pass/proc-macro/auxiliary/hygiene_example_codegen.rs new file mode 100644 index 00000000000..5e50a6e916f --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/hygiene_example_codegen.rs @@ -0,0 +1,27 @@ +// force-host +// no-prefer-dynamic + +#![feature(proc_macro_quote, proc_macro_hygiene)] +#![crate_type = "proc-macro"] + +extern crate proc_macro as proc_macro_renamed; // This does not break `quote!` + +use proc_macro_renamed::{TokenStream, quote}; + +#[proc_macro] +pub fn hello(input: TokenStream) -> TokenStream { + quote!(hello_helper!($input)) + //^ `hello_helper!` always resolves to the following proc macro, + //| no matter where `hello!` is used. +} + +#[proc_macro] +pub fn hello_helper(input: TokenStream) -> TokenStream { + quote! { + extern crate hygiene_example; // This is never a conflict error + let string = format!("hello {}", $input); + //^ `format!` always resolves to the prelude macro, + //| even if a different `format!` is in scope where `hello!` is used. + hygiene_example::print(&string) + } +} diff --git a/src/test/run-pass/proc-macro/auxiliary/issue-39889.rs b/src/test/run-pass/proc-macro/auxiliary/issue-39889.rs new file mode 100644 index 00000000000..e7af66da797 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/issue-39889.rs @@ -0,0 +1,17 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro_derive(Issue39889)] +pub fn f(_input: TokenStream) -> TokenStream { + let rules = r#" + macro_rules! id { + ($($tt:tt)*) => { $($tt)* }; + } + "#; + rules.parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/issue-42708.rs b/src/test/run-pass/proc-macro/auxiliary/issue-42708.rs new file mode 100644 index 00000000000..dae05204b8b --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/issue-42708.rs @@ -0,0 +1,18 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Test)] +pub fn derive(_input: TokenStream) -> TokenStream { + "fn f(s: S) { s.x }".parse().unwrap() +} + +#[proc_macro_attribute] +pub fn attr_test(_attr: TokenStream, input: TokenStream) -> TokenStream { + input +} diff --git a/src/test/run-pass/proc-macro/auxiliary/issue-50061.rs b/src/test/run-pass/proc-macro/auxiliary/issue-50061.rs new file mode 100644 index 00000000000..f5fe8cabbce --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/issue-50061.rs @@ -0,0 +1,12 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn check(_a: TokenStream, b: TokenStream) -> TokenStream { + b.into_iter().collect() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/lifetimes.rs b/src/test/run-pass/proc-macro/auxiliary/lifetimes.rs new file mode 100644 index 00000000000..4e5d22e6e3e --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/lifetimes.rs @@ -0,0 +1,26 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro] +pub fn lifetimes_bang(input: TokenStream) -> TokenStream { + // Roundtrip through token trees + input.into_iter().collect() +} + +#[proc_macro_attribute] +pub fn lifetimes_attr(_: TokenStream, input: TokenStream) -> TokenStream { + // Roundtrip through AST + input +} + +#[proc_macro_derive(Lifetimes)] +pub fn lifetimes_derive(input: TokenStream) -> TokenStream { + // Roundtrip through a string + format!("mod m {{ {} }}", input).parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/modify-ast.rs b/src/test/run-pass/proc-macro/auxiliary/modify-ast.rs new file mode 100644 index 00000000000..cc582c1522c --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/modify-ast.rs @@ -0,0 +1,47 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro_attribute] +pub fn assert1(_a: TokenStream, b: TokenStream) -> TokenStream { + assert_eq(b.clone(), "pub fn foo() {}".parse().unwrap()); + b +} + +#[proc_macro_derive(Foo, attributes(foo))] +pub fn assert2(a: TokenStream) -> TokenStream { + assert_eq(a, "pub struct MyStructc { _a: i32, }".parse().unwrap()); + TokenStream::new() +} + +fn assert_eq(a: TokenStream, b: TokenStream) { + let mut a = a.into_iter(); + let mut b = b.into_iter(); + for (a, b) in a.by_ref().zip(&mut b) { + match (a, b) { + (TokenTree::Group(a), TokenTree::Group(b)) => { + assert_eq!(a.delimiter(), b.delimiter()); + assert_eq(a.stream(), b.stream()); + } + (TokenTree::Punct(a), TokenTree::Punct(b)) => { + assert_eq!(a.as_char(), b.as_char()); + assert_eq!(a.spacing(), b.spacing()); + } + (TokenTree::Literal(a), TokenTree::Literal(b)) => { + assert_eq!(a.to_string(), b.to_string()); + } + (TokenTree::Ident(a), TokenTree::Ident(b)) => { + assert_eq!(a.to_string(), b.to_string()); + } + (a, b) => panic!("{:?} != {:?}", a, b), + } + } + + assert!(a.next().is_none()); + assert!(b.next().is_none()); +} diff --git a/src/test/run-pass/proc-macro/auxiliary/negative-token.rs b/src/test/run-pass/proc-macro/auxiliary/negative-token.rs new file mode 100644 index 00000000000..8b89f2e3731 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/negative-token.rs @@ -0,0 +1,18 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro] +pub fn neg_one(_input: TokenStream) -> TokenStream { + TokenTree::Literal(Literal::i32_suffixed(-1)).into() +} + +#[proc_macro] +pub fn neg_one_float(_input: TokenStream) -> TokenStream { + TokenTree::Literal(Literal::f32_suffixed(-1.0)).into() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/not-joint.rs b/src/test/run-pass/proc-macro/auxiliary/not-joint.rs new file mode 100644 index 00000000000..e6c09f7628e --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/not-joint.rs @@ -0,0 +1,30 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro] +pub fn tokens(input: TokenStream) -> TokenStream { + assert_nothing_joint(input); + TokenStream::new() +} + +#[proc_macro_attribute] +pub fn nothing(_: TokenStream, input: TokenStream) -> TokenStream { + assert_nothing_joint(input); + TokenStream::new() +} + +fn assert_nothing_joint(s: TokenStream) { + for tt in s { + match tt { + TokenTree::Group(g) => assert_nothing_joint(g.stream()), + TokenTree::Punct(p) => assert_eq!(p.spacing(), Spacing::Alone), + _ => {} + } + } +} diff --git a/src/test/run-pass/proc-macro/auxiliary/span-api-tests.rs b/src/test/run-pass/proc-macro/auxiliary/span-api-tests.rs new file mode 100644 index 00000000000..cb71291f909 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/span-api-tests.rs @@ -0,0 +1,35 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(proc_macro_span)] + +extern crate proc_macro; + +use proc_macro::*; + +// Re-emits the input tokens by parsing them from strings +#[proc_macro] +pub fn reemit(input: TokenStream) -> TokenStream { + input.to_string().parse().unwrap() +} + +#[proc_macro] +pub fn assert_fake_source_file(input: TokenStream) -> TokenStream { + for tk in input { + let source_file = tk.span().source_file(); + assert!(!source_file.is_real(), "Source file is real: {:?}", source_file); + } + + "".parse().unwrap() +} + +#[proc_macro] +pub fn assert_source_file(input: TokenStream) -> TokenStream { + for tk in input { + let source_file = tk.span().source_file(); + assert!(source_file.is_real(), "Source file is not real: {:?}", source_file); + } + + "".parse().unwrap() +} diff --git a/src/test/run-pass/proc-macro/auxiliary/span-test-macros.rs b/src/test/run-pass/proc-macro/auxiliary/span-test-macros.rs new file mode 100644 index 00000000000..9a78f0a8955 --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/span-test-macros.rs @@ -0,0 +1,9 @@ +#[macro_export] +macro_rules! reemit_legacy { + ($($tok:tt)*) => ($($tok)*) +} + +#[macro_export] +macro_rules! say_hello_extern { + ($macname:ident) => ( $macname! { "Hello, world!" }) +} diff --git a/src/test/run-pass/proc-macro/auxiliary/test-macros.rs b/src/test/run-pass/proc-macro/auxiliary/test-macros.rs new file mode 100644 index 00000000000..15fe3804f9b --- /dev/null +++ b/src/test/run-pass/proc-macro/auxiliary/test-macros.rs @@ -0,0 +1,26 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn nop_attr(_attr: TokenStream, input: TokenStream) -> TokenStream { + assert!(_attr.to_string().is_empty()); + input +} + +#[proc_macro_attribute] +pub fn no_output(_attr: TokenStream, _input: TokenStream) -> TokenStream { + assert!(_attr.to_string().is_empty()); + assert!(!_input.to_string().is_empty()); + "".parse().unwrap() +} + +#[proc_macro] +pub fn emit_input(input: TokenStream) -> TokenStream { + input +} diff --git a/src/test/run-pass/proc-macro/bang-macro.rs b/src/test/run-pass/proc-macro/bang-macro.rs new file mode 100644 index 00000000000..6f04bb10b90 --- /dev/null +++ b/src/test/run-pass/proc-macro/bang-macro.rs @@ -0,0 +1,10 @@ +// aux-build:bang-macro.rs + +#![feature(proc_macro_hygiene)] + +extern crate bang_macro; +use bang_macro::rewrite; + +fn main() { + assert_eq!(rewrite!("Hello, world!"), "NOT Hello, world!"); +} diff --git a/src/test/run-pass/proc-macro/call-site.rs b/src/test/run-pass/proc-macro/call-site.rs new file mode 100644 index 00000000000..f31b418e3b2 --- /dev/null +++ b/src/test/run-pass/proc-macro/call-site.rs @@ -0,0 +1,14 @@ +#![allow(unused_variables)] +#![allow(unused_imports)] +// aux-build:call-site.rs + +#![feature(proc_macro_hygiene)] + +extern crate call_site; +use call_site::*; + +fn main() { + let x1 = 10; + call_site::check!(let x2 = x1;); + let x6 = x5; +} diff --git a/src/test/run-pass/proc-macro/count_compound_ops.rs b/src/test/run-pass/proc-macro/count_compound_ops.rs new file mode 100644 index 00000000000..f42d82ce046 --- /dev/null +++ b/src/test/run-pass/proc-macro/count_compound_ops.rs @@ -0,0 +1,10 @@ +// aux-build:count_compound_ops.rs + +#![feature(proc_macro_hygiene)] + +extern crate count_compound_ops; +use count_compound_ops::count_compound_ops; + +fn main() { + assert_eq!(count_compound_ops!(foo<=>bar << { + // derive_Double outputs secondary copies of each definition + // to test what the proc_macro sees. + mod bar { + #[derive(Double)] + struct Bar($crate::Foo); + } + + mod qself { + #[derive(Double)] + struct QSelf(<::Foo as $crate::Trait>::Assoc); + } + + mod qself_recurse { + #[derive(Double)] + struct QSelfRecurse(<<$crate::Foo as $crate::Trait>::Assoc as $crate::Trait>::Assoc); + } + + mod qself_in_const { + #[derive(Double)] + #[repr(u32)] + enum QSelfInConst { + Variant = <::Foo as $crate::Trait>::CONST, + } + } +} } + +mod local { + local!(); +} + +// and now repeat the above tests, using a macro defined in another crate + +mod external { + external!{} +} + +fn main() {} diff --git a/src/test/run-pass/proc-macro/custom-attr-only-one-derive.rs b/src/test/run-pass/proc-macro/custom-attr-only-one-derive.rs new file mode 100644 index 00000000000..993d3315596 --- /dev/null +++ b/src/test/run-pass/proc-macro/custom-attr-only-one-derive.rs @@ -0,0 +1,15 @@ +// aux-build:custom-attr-only-one-derive.rs + +#![feature(rust_2018_preview)] + +#[macro_use] +extern crate custom_attr_only_one_derive; + +#[derive(Bar, Foo)] +#[custom = "test"] +pub enum A { + B, + C, +} + +fn main() {} diff --git a/src/test/run-pass/proc-macro/derive-attr-cfg.rs b/src/test/run-pass/proc-macro/derive-attr-cfg.rs new file mode 100644 index 00000000000..c23ab9fb683 --- /dev/null +++ b/src/test/run-pass/proc-macro/derive-attr-cfg.rs @@ -0,0 +1,15 @@ +#![allow(dead_code)] +// aux-build:derive-attr-cfg.rs + +extern crate derive_attr_cfg; +use derive_attr_cfg::Foo; + +#[derive(Foo)] +#[foo] +struct S { + #[cfg(any())] + x: i32 +} + +fn main() { +} diff --git a/src/test/run-pass/proc-macro/derive-b.rs b/src/test/run-pass/proc-macro/derive-b.rs new file mode 100644 index 00000000000..af48cabca99 --- /dev/null +++ b/src/test/run-pass/proc-macro/derive-b.rs @@ -0,0 +1,20 @@ +// aux-build:derive-b.rs + +#![feature(unrestricted_attribute_tokens)] + +extern crate derive_b; + +#[derive(Debug, PartialEq, derive_b::B, Eq, Copy, Clone)] +#[cfg_attr(all(), B[arbitrary tokens])] +struct B { + #[C] + a: u64 +} + +fn main() { + B { a: 3 }; + assert_eq!(B { a: 3 }, B { a: 3 }); + let b = B { a: 3 }; + let _d = b; + let _e = b; +} diff --git a/src/test/run-pass/proc-macro/derive-same-struct.rs b/src/test/run-pass/proc-macro/derive-same-struct.rs new file mode 100644 index 00000000000..18401525087 --- /dev/null +++ b/src/test/run-pass/proc-macro/derive-same-struct.rs @@ -0,0 +1,13 @@ +#![allow(path_statements)] +#![allow(dead_code)] +// aux-build:derive-same-struct.rs + +#[macro_use] +extern crate derive_same_struct; + +#[derive(AToB)] +struct A; + +fn main() { + C; +} diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-same-struct.stdout b/src/test/run-pass/proc-macro/derive-same-struct.stdout similarity index 100% rename from src/test/run-pass-fulldeps/proc-macro/derive-same-struct.stdout rename to src/test/run-pass/proc-macro/derive-same-struct.stdout diff --git a/src/test/run-pass/proc-macro/derive-test.rs b/src/test/run-pass/proc-macro/derive-test.rs new file mode 100644 index 00000000000..edb0201ba77 --- /dev/null +++ b/src/test/run-pass/proc-macro/derive-test.rs @@ -0,0 +1,21 @@ +// no-prefer-dynamic +// compile-flags: --test + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +// ``` +// assert!(true); +// ``` +#[proc_macro_derive(Foo)] +pub fn derive_foo(_input: TokenStream) -> TokenStream { + "".parse().unwrap() +} + +#[test] +pub fn test_derive() { + assert!(true); +} diff --git a/src/test/run-pass/proc-macro/derive-two-attrs.rs b/src/test/run-pass/proc-macro/derive-two-attrs.rs new file mode 100644 index 00000000000..a93ba8184f7 --- /dev/null +++ b/src/test/run-pass/proc-macro/derive-two-attrs.rs @@ -0,0 +1,13 @@ +#![allow(dead_code)] +// aux-build:derive-two-attrs.rs + +extern crate derive_two_attrs as foo; + +use foo::A; + +#[derive(A)] +#[b] +#[b] +struct B; + +fn main() {} diff --git a/src/test/run-pass/proc-macro/derive-union.rs b/src/test/run-pass/proc-macro/derive-union.rs new file mode 100644 index 00000000000..6e8b1b726e4 --- /dev/null +++ b/src/test/run-pass/proc-macro/derive-union.rs @@ -0,0 +1,15 @@ +#![allow(unused_variables)] +// aux-build:derive-union.rs + +#[macro_use] +extern crate derive_union; + +#[repr(C)] +#[derive(UnionTest)] +union Test { + a: u8, +} + +fn main() { + let t = Test { a: 0 }; +} diff --git a/src/test/run-pass/proc-macro/empty-crate.rs b/src/test/run-pass/proc-macro/empty-crate.rs new file mode 100644 index 00000000000..84104a3f5cf --- /dev/null +++ b/src/test/run-pass/proc-macro/empty-crate.rs @@ -0,0 +1,7 @@ +#![allow(unused_imports)] +// aux-build:empty-crate.rs + +#[macro_use] +extern crate empty_crate; + +fn main() {} diff --git a/src/test/run-pass/proc-macro/expand-with-a-macro.rs b/src/test/run-pass/proc-macro/expand-with-a-macro.rs new file mode 100644 index 00000000000..46c8e0ef5e5 --- /dev/null +++ b/src/test/run-pass/proc-macro/expand-with-a-macro.rs @@ -0,0 +1,20 @@ +// aux-build:expand-with-a-macro.rs + +// ignore-wasm32-bare compiled with panic=abort by default + +#![deny(warnings)] + +#[macro_use] +extern crate expand_with_a_macro; + +use std::panic; + +#[derive(A)] +struct A; + +fn main() { + assert!(panic::catch_unwind(|| { + A.a(); + }).is_err()); +} + diff --git a/src/test/run-pass/proc-macro/gen-lifetime-token.rs b/src/test/run-pass/proc-macro/gen-lifetime-token.rs new file mode 100644 index 00000000000..1659b87440b --- /dev/null +++ b/src/test/run-pass/proc-macro/gen-lifetime-token.rs @@ -0,0 +1,10 @@ +// aux-build:gen-lifetime-token.rs + +extern crate gen_lifetime_token as bar; + +bar::bar!(); + +fn main() { + let x: &'static i32 = FOO; + assert_eq!(*x, 1); +} diff --git a/src/test/run-pass/proc-macro/hygiene_example.rs b/src/test/run-pass/proc-macro/hygiene_example.rs new file mode 100644 index 00000000000..3e5bab6bb13 --- /dev/null +++ b/src/test/run-pass/proc-macro/hygiene_example.rs @@ -0,0 +1,18 @@ +#![allow(unused_macros)] +// aux-build:hygiene_example_codegen.rs +// aux-build:hygiene_example.rs + +#![feature(proc_macro_hygiene)] + +extern crate hygiene_example; +use hygiene_example::hello; + +fn main() { + mod hygiene_example {} // no conflict with `extern crate hygiene_example;` from the proc macro + macro_rules! format { () => {} } // does not interfere with `format!` from the proc macro + macro_rules! hello_helper { () => {} } // similarly does not intefere with the proc macro + + let string = "world"; // no conflict with `string` from the proc macro + hello!(string); + hello!(string); +} diff --git a/src/test/run-pass/proc-macro/issue-39889.rs b/src/test/run-pass/proc-macro/issue-39889.rs new file mode 100644 index 00000000000..91c8d48b871 --- /dev/null +++ b/src/test/run-pass/proc-macro/issue-39889.rs @@ -0,0 +1,10 @@ +#![allow(dead_code)] +// aux-build:issue-39889.rs + +extern crate issue_39889; +use issue_39889::Issue39889; + +#[derive(Issue39889)] +struct S; + +fn main() {} diff --git a/src/test/run-pass/proc-macro/issue-42708.rs b/src/test/run-pass/proc-macro/issue-42708.rs new file mode 100644 index 00000000000..466021c16e8 --- /dev/null +++ b/src/test/run-pass/proc-macro/issue-42708.rs @@ -0,0 +1,25 @@ +// aux-build:issue-42708.rs + +#![feature(decl_macro)] +#![allow(unused)] + +extern crate issue_42708; + +macro m() { + #[derive(issue_42708::Test)] + struct S { x: () } + + #[issue_42708::attr_test] + struct S2 { x: () } + + #[derive(Clone)] + struct S3 { x: () } + + fn g(s: S, s2: S2, s3: S3) { + (s.x, s2.x, s3.x); + } +} + +m!(); + +fn main() {} diff --git a/src/test/run-pass/proc-macro/issue-50061.rs b/src/test/run-pass/proc-macro/issue-50061.rs new file mode 100644 index 00000000000..b0dad493ebc --- /dev/null +++ b/src/test/run-pass/proc-macro/issue-50061.rs @@ -0,0 +1,21 @@ +#![allow(path_statements)] +// aux-build:issue-50061.rs + +#![feature(decl_macro)] + +extern crate issue_50061; + +macro inner(any_token $v: tt) { + $v +} + +macro outer($v: tt) { + inner!(any_token $v) +} + +#[issue_50061::check] +fn main() { + //! this doc comment forces roundtrip through a string + let checkit = 0; + outer!(checkit); +} diff --git a/src/test/run-pass/proc-macro/lifetimes.rs b/src/test/run-pass/proc-macro/lifetimes.rs new file mode 100644 index 00000000000..e462a53ec28 --- /dev/null +++ b/src/test/run-pass/proc-macro/lifetimes.rs @@ -0,0 +1,24 @@ +#![allow(unused_variables)] +// aux-build:lifetimes.rs + +extern crate lifetimes; +use lifetimes::*; + +lifetimes_bang! { + fn bang<'a>() -> &'a u8 { &0 } +} + +#[lifetimes_attr] +fn attr<'a>() -> &'a u8 { &1 } + +#[derive(Lifetimes)] +pub struct Lifetimes<'a> { + pub field: &'a u8, +} + +fn main() { + assert_eq!(bang::<'static>(), &0); + assert_eq!(attr::<'static>(), &1); + let l1 = Lifetimes { field: &0 }; + let l2 = m::Lifetimes { field: &1 }; +} diff --git a/src/test/run-pass/proc-macro/load-two.rs b/src/test/run-pass/proc-macro/load-two.rs new file mode 100644 index 00000000000..24585e1e067 --- /dev/null +++ b/src/test/run-pass/proc-macro/load-two.rs @@ -0,0 +1,21 @@ +#![allow(path_statements)] +#![allow(dead_code)] +// aux-build:derive-atob.rs +// aux-build:derive-ctod.rs + +#[macro_use] +extern crate derive_atob; +#[macro_use] +extern crate derive_ctod; + +#[derive(Copy, Clone)] +#[derive(AToB)] +struct A; + +#[derive(CToD)] +struct C; + +fn main() { + B; + D; +} diff --git a/src/test/run-pass/proc-macro/macros-in-extern.rs b/src/test/run-pass/proc-macro/macros-in-extern.rs new file mode 100644 index 00000000000..99e3f7d14fd --- /dev/null +++ b/src/test/run-pass/proc-macro/macros-in-extern.rs @@ -0,0 +1,24 @@ +// aux-build:test-macros.rs +// ignore-wasm32 + +#![feature(macros_in_extern)] + +extern crate test_macros; + +use test_macros::{nop_attr, no_output, emit_input}; + +fn main() { + assert_eq!(unsafe { rust_get_test_int() }, 1isize); + assert_eq!(unsafe { rust_dbg_extern_identity_u32(0xDEADBEEF) }, 0xDEADBEEF); +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + #[no_output] + fn some_definitely_unknown_symbol_which_should_be_removed(); + + #[nop_attr] + fn rust_get_test_int() -> isize; + + emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;); +} diff --git a/src/test/run-pass/proc-macro/modify-ast.rs b/src/test/run-pass/proc-macro/modify-ast.rs new file mode 100644 index 00000000000..a96c61f1cb8 --- /dev/null +++ b/src/test/run-pass/proc-macro/modify-ast.rs @@ -0,0 +1,25 @@ +// aux-build:modify-ast.rs + +extern crate modify_ast; + +use modify_ast::*; + +#[derive(Foo)] +pub struct MyStructc { + #[cfg_attr(my_cfg, foo)] + _a: i32, +} + +macro_rules! a { + ($i:item) => ($i) +} + +a! { + #[assert1] + pub fn foo() {} +} + +fn main() { + let _a = MyStructc { _a: 0 }; + foo(); +} diff --git a/src/test/run-pass/proc-macro/negative-token.rs b/src/test/run-pass/proc-macro/negative-token.rs new file mode 100644 index 00000000000..751d1a43a0a --- /dev/null +++ b/src/test/run-pass/proc-macro/negative-token.rs @@ -0,0 +1,12 @@ +// aux-build:negative-token.rs + +#![feature(proc_macro_hygiene)] + +extern crate negative_token; + +use negative_token::*; + +fn main() { + assert_eq!(-1, neg_one!()); + assert_eq!(-1.0, neg_one_float!()); +} diff --git a/src/test/run-pass/proc-macro/not-joint.rs b/src/test/run-pass/proc-macro/not-joint.rs new file mode 100644 index 00000000000..b360e4e1bb2 --- /dev/null +++ b/src/test/run-pass/proc-macro/not-joint.rs @@ -0,0 +1,23 @@ +// aux-build:not-joint.rs + +extern crate not_joint as bar; +use bar::{tokens, nothing}; + +tokens![< -]; + +#[nothing] +a![< -]; + +#[nothing] +b!{< -} + +#[nothing] +c!(< -); + +#[nothing] +fn foo() { + //! dox + let x = 2 < - 3; +} + +fn main() {} diff --git a/src/test/run-pass/proc-macro/smoke.rs b/src/test/run-pass/proc-macro/smoke.rs new file mode 100644 index 00000000000..26fbce3ebf1 --- /dev/null +++ b/src/test/run-pass/proc-macro/smoke.rs @@ -0,0 +1,18 @@ +#![allow(unused_must_use)] +#![allow(path_statements)] +// aux-build:derive-a.rs + +#[macro_use] +extern crate derive_a; + +#[derive(Debug, PartialEq, A, Eq, Copy, Clone)] +struct A; + +fn main() { + A; + assert_eq!(A, A); + A.clone(); + let a = A; + let _c = a; + let _d = a; +} diff --git a/src/test/run-pass/proc-macro/span-api-tests.rs b/src/test/run-pass/proc-macro/span-api-tests.rs new file mode 100644 index 00000000000..0076c08621f --- /dev/null +++ b/src/test/run-pass/proc-macro/span-api-tests.rs @@ -0,0 +1,31 @@ +// aux-build:span-api-tests.rs +// aux-build:span-test-macros.rs + +// ignore-pretty + +#[macro_use] +extern crate span_test_macros; + +extern crate span_api_tests; + +use span_api_tests::{reemit, assert_fake_source_file, assert_source_file}; + +macro_rules! say_hello { + ($macname:ident) => ( $macname! { "Hello, world!" }) +} + +assert_source_file! { "Hello, world!" } + +say_hello! { assert_source_file } + +reemit_legacy! { + assert_source_file! { "Hello, world!" } +} + +say_hello_extern! { assert_fake_source_file } + +reemit! { + assert_source_file! { "Hello, world!" } +} + +fn main() {} diff --git a/src/test/run-pass/proc-macro/struct-field-macro.rs b/src/test/run-pass/proc-macro/struct-field-macro.rs new file mode 100644 index 00000000000..58663cc6c37 --- /dev/null +++ b/src/test/run-pass/proc-macro/struct-field-macro.rs @@ -0,0 +1,16 @@ +#![allow(dead_code)] +// aux-build:derive-nothing.rs + +#[macro_use] +extern crate derive_nothing; + +macro_rules! int { + () => { i32 } +} + +#[derive(Nothing)] +struct S { + x: int!(), +} + +fn main() {} diff --git a/src/test/run-pass/proc_macro.rs b/src/test/run-pass/proc_macro.rs new file mode 100644 index 00000000000..afdf2b8baa1 --- /dev/null +++ b/src/test/run-pass/proc_macro.rs @@ -0,0 +1,38 @@ +// aux-build:proc_macro_def.rs +// ignore-cross-compile + +#![feature(proc_macro_hygiene)] + +extern crate proc_macro_def; + +use proc_macro_def::{attr_tru, attr_identity, identity, ret_tru, tru}; + +#[attr_tru] +fn f1() -> bool { + return false; +} + +#[attr_identity] +fn f2() -> bool { + return identity!(true); +} + +fn f3() -> identity!(bool) { + ret_tru!(); +} + +fn f4(x: bool) -> bool { + match x { + identity!(true) => false, + identity!(false) => true, + } +} + +fn main() { + assert!(f1()); + assert!(f2()); + assert!(tru!()); + assert!(f3()); + assert!(identity!(5 == 5)); + assert!(f4(false)); +} diff --git a/src/test/run-pass/process/process-envs.rs b/src/test/run-pass/process/process-envs.rs index 4fb21d4dc66..1ff0fbbdd08 100644 --- a/src/test/run-pass/process/process-envs.rs +++ b/src/test/run-pass/process/process-envs.rs @@ -1,13 +1,3 @@ -// Copyright 2014, 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/process/process-exit.rs b/src/test/run-pass/process/process-exit.rs index 6314dc2cd64..ecc7b72c0f3 100644 --- a/src/test/run-pass/process/process-exit.rs +++ b/src/test/run-pass/process/process-exit.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // ignore-cloudabi no processes diff --git a/src/test/run-pass/process/process-remove-from-env.rs b/src/test/run-pass/process/process-remove-from-env.rs index d9c35f3e993..9c2aa871e0d 100644 --- a/src/test/run-pass/process/process-remove-from-env.rs +++ b/src/test/run-pass/process/process-remove-from-env.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/process/process-sigpipe.rs b/src/test/run-pass/process/process-sigpipe.rs index 715da1514f3..bf589096006 100644 --- a/src/test/run-pass/process/process-sigpipe.rs +++ b/src/test/run-pass/process/process-sigpipe.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] #![allow(deprecated)] diff --git a/src/test/run-pass/process/process-spawn-nonexistent.rs b/src/test/run-pass/process/process-spawn-nonexistent.rs index 926e93104f3..2fe9f33de38 100644 --- a/src/test/run-pass/process/process-spawn-nonexistent.rs +++ b/src/test/run-pass/process/process-spawn-nonexistent.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/process/process-spawn-with-unicode-params.rs b/src/test/run-pass/process/process-spawn-with-unicode-params.rs index 70ed7982508..e3508cb4e8f 100644 --- a/src/test/run-pass/process/process-spawn-with-unicode-params.rs +++ b/src/test/run-pass/process/process-spawn-with-unicode-params.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // no-prefer-dynamic diff --git a/src/test/run-pass/process/process-status-inherits-stdin.rs b/src/test/run-pass/process/process-status-inherits-stdin.rs index 1b09d5e52bc..e2e17b7fb66 100644 --- a/src/test/run-pass/process/process-status-inherits-stdin.rs +++ b/src/test/run-pass/process/process-status-inherits-stdin.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/project-cache-issue-31849.rs b/src/test/run-pass/project-cache-issue-31849.rs index d03424b2b2b..086883e5cb3 100644 --- a/src/test/run-pass/project-cache-issue-31849.rs +++ b/src/test/run-pass/project-cache-issue-31849.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #31849: the problem here was actually a performance // cliff, but I'm adding the test for reference. diff --git a/src/test/run-pass/project-cache-issue-37154.rs b/src/test/run-pass/project-cache-issue-37154.rs index 3dac45139ac..8b07b9c98ad 100644 --- a/src/test/run-pass/project-cache-issue-37154.rs +++ b/src/test/run-pass/project-cache-issue-37154.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Regression test for #37154: the problem here was that the cache // results in a false error because it was caching placeholder results diff --git a/src/test/run-pass/project-defer-unification.rs b/src/test/run-pass/project-defer-unification.rs index c4a3856bcbc..548c4d29cbb 100644 --- a/src/test/run-pass/project-defer-unification.rs +++ b/src/test/run-pass/project-defer-unification.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_variables)] #![allow(unreachable_code)] diff --git a/src/test/run-pass/ptr-coercion.rs b/src/test/run-pass/ptr-coercion.rs index 3a4d2b3e602..0dd2b5467d9 100644 --- a/src/test/run-pass/ptr-coercion.rs +++ b/src/test/run-pass/ptr-coercion.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] // Test coercions between pointers which don't do anything fancy like unsizing. diff --git a/src/test/run-pass/pure-sum.rs b/src/test/run-pass/pure-sum.rs index 5f6b9b17e36..d000c8488a6 100644 --- a/src/test/run-pass/pure-sum.rs +++ b/src/test/run-pass/pure-sum.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Check that functions can modify local state. diff --git a/src/test/run-pass/purity-infer.rs b/src/test/run-pass/purity-infer.rs index c5588a29cb5..3b2b4186019 100644 --- a/src/test/run-pass/purity-infer.rs +++ b/src/test/run-pass/purity-infer.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn something(f: F) where F: FnOnce() { f(); } pub fn main() { something(|| println!("hi!") ); diff --git a/src/test/run-pass/range-type-infer.rs b/src/test/run-pass/range-type-infer.rs index 809c1ba702b..777286d8558 100644 --- a/src/test/run-pass/range-type-infer.rs +++ b/src/test/run-pass/range-type-infer.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] // Make sure the type inference for the new range expression work as // good as the old one. Check out issue #21672, #21595 and #21649 for diff --git a/src/test/run-pass/range.rs b/src/test/run-pass/range.rs index 2fae4d3cf26..a3667d87613 100644 --- a/src/test/run-pass/range.rs +++ b/src/test/run-pass/range.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_comparisons)] #![allow(dead_code)] #![allow(unused_mut)] diff --git a/src/test/run-pass/range_inclusive.rs b/src/test/run-pass/range_inclusive.rs index 2bedfc133b5..31c3c394034 100644 --- a/src/test/run-pass/range_inclusive.rs +++ b/src/test/run-pass/range_inclusive.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test inclusive range syntax. #![feature(range_is_empty)] diff --git a/src/test/run-pass/range_inclusive_gate.rs b/src/test/run-pass/range_inclusive_gate.rs index 09132efe18c..7f72bf5d325 100644 --- a/src/test/run-pass/range_inclusive_gate.rs +++ b/src/test/run-pass/range_inclusive_gate.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_comparisons)] // Test that you only need the syntax gate if you don't mention the structs. // (Obsoleted since both features are stabilized) diff --git a/src/test/run-pass/ranges-precedence.rs b/src/test/run-pass/ranges-precedence.rs index eb404751ee6..86862993d4d 100644 --- a/src/test/run-pass/ranges-precedence.rs +++ b/src/test/run-pass/ranges-precedence.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the precedence of ranges is correct diff --git a/src/test/run-pass/raw-fat-ptr.rs b/src/test/run-pass/raw-fat-ptr.rs index b4572f45771..df69db1cc9a 100644 --- a/src/test/run-pass/raw-fat-ptr.rs +++ b/src/test/run-pass/raw-fat-ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check raw fat pointer ops use std::mem; diff --git a/src/test/run-pass/raw-str.rs b/src/test/run-pass/raw-str.rs index 9ee824d4185..8861ec3f85a 100644 Binary files a/src/test/run-pass/raw-str.rs and b/src/test/run-pass/raw-str.rs differ diff --git a/src/test/run-pass/rcvr-borrowed-to-region.rs b/src/test/run-pass/rcvr-borrowed-to-region.rs index 02392be7e4f..b1b25358978 100644 --- a/src/test/run-pass/rcvr-borrowed-to-region.rs +++ b/src/test/run-pass/rcvr-borrowed-to-region.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/reachable-unnameable-items.rs b/src/test/run-pass/reachable-unnameable-items.rs index d087be6d10c..a7454047406 100644 --- a/src/test/run-pass/reachable-unnameable-items.rs +++ b/src/test/run-pass/reachable-unnameable-items.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare compiled with panic=abort by default // aux-build:reachable-unnameable-items.rs diff --git a/src/test/run-pass/reachable-unnameable-type-alias.rs b/src/test/run-pass/reachable-unnameable-type-alias.rs index 5d0c6df3d58..a632ce186e1 100644 --- a/src/test/run-pass/reachable-unnameable-type-alias.rs +++ b/src/test/run-pass/reachable-unnameable-type-alias.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(staged_api)] #![stable(feature = "a", since = "b")] diff --git a/src/test/run-pass/readalias.rs b/src/test/run-pass/readalias.rs index d7ddd9505d7..444d4471233 100644 --- a/src/test/run-pass/readalias.rs +++ b/src/test/run-pass/readalias.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] diff --git a/src/test/run-pass/realloc-16687.rs b/src/test/run-pass/realloc-16687.rs index c4cae1e1d61..e283d5b6de1 100644 --- a/src/test/run-pass/realloc-16687.rs +++ b/src/test/run-pass/realloc-16687.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // alloc::heap::reallocate test. // // Ideally this would be revised to use no_std, but for now it serves diff --git a/src/test/run-pass/reexport-should-still-link.rs b/src/test/run-pass/reexport-should-still-link.rs index 1243d72af5e..733f8f9c1f3 100644 --- a/src/test/run-pass/reexport-should-still-link.rs +++ b/src/test/run-pass/reexport-should-still-link.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:reexport-should-still-link.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/reexport-star.rs b/src/test/run-pass/reexport-star.rs index a8d052f407f..ae48f97a9dd 100644 --- a/src/test/run-pass/reexport-star.rs +++ b/src/test/run-pass/reexport-star.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // pretty-expanded FIXME #23616 mod a { diff --git a/src/test/run-pass/reexport-test-harness-main.rs b/src/test/run-pass/reexport-test-harness-main.rs index 88e3e6ba4ac..5171c1c1739 100644 --- a/src/test/run-pass/reexport-test-harness-main.rs +++ b/src/test/run-pass/reexport-test-harness-main.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test #![reexport_test_harness_main = "test_main"] diff --git a/src/test/run-pass/refer-to-other-statics-by-value.rs b/src/test/run-pass/refer-to-other-statics-by-value.rs index 94c98ff95ab..e08700c57c0 100644 --- a/src/test/run-pass/refer-to-other-statics-by-value.rs +++ b/src/test/run-pass/refer-to-other-statics-by-value.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static A: usize = 42; static B: usize = A; diff --git a/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs b/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs index 8bd66b90d58..4221ebfdffb 100644 --- a/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs +++ b/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/regions/regions-addr-of-ret.rs b/src/test/run-pass/regions/regions-addr-of-ret.rs index a9953edb2f5..e5dcd6db033 100644 --- a/src/test/run-pass/regions/regions-addr-of-ret.rs +++ b/src/test/run-pass/regions/regions-addr-of-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn f(x: &isize) -> &isize { return &*x; diff --git a/src/test/run-pass/regions/regions-assoc-type-region-bound.rs b/src/test/run-pass/regions/regions-assoc-type-region-bound.rs index 6a9a2535220..cbb7d1726d9 100644 --- a/src/test/run-pass/regions/regions-assoc-type-region-bound.rs +++ b/src/test/run-pass/regions/regions-assoc-type-region-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that the compiler considers the 'a bound declared in the diff --git a/src/test/run-pass/regions/regions-assoc-type-static-bound.rs b/src/test/run-pass/regions/regions-assoc-type-static-bound.rs index e0bb62b8929..1458787ea65 100644 --- a/src/test/run-pass/regions/regions-assoc-type-static-bound.rs +++ b/src/test/run-pass/regions/regions-assoc-type-static-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that the compiler considers the 'static bound declared in the diff --git a/src/test/run-pass/regions/regions-borrow-at.rs b/src/test/run-pass/regions/regions-borrow-at.rs index 02603292d1b..355e8c91455 100644 --- a/src/test/run-pass/regions/regions-borrow-at.rs +++ b/src/test/run-pass/regions/regions-borrow-at.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/regions/regions-borrow-evec-fixed.rs b/src/test/run-pass/regions/regions-borrow-evec-fixed.rs index 50336cf8cdc..ed828312b46 100644 --- a/src/test/run-pass/regions/regions-borrow-evec-fixed.rs +++ b/src/test/run-pass/regions/regions-borrow-evec-fixed.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn foo(x: &[isize]) -> isize { diff --git a/src/test/run-pass/regions/regions-borrow-evec-uniq.rs b/src/test/run-pass/regions/regions-borrow-evec-uniq.rs index 5f61ab89635..bbf7ba79e2a 100644 --- a/src/test/run-pass/regions/regions-borrow-evec-uniq.rs +++ b/src/test/run-pass/regions/regions-borrow-evec-uniq.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/regions/regions-borrow-uniq.rs b/src/test/run-pass/regions/regions-borrow-uniq.rs index cc88528f64b..3bf049c1511 100644 --- a/src/test/run-pass/regions/regions-borrow-uniq.rs +++ b/src/test/run-pass/regions/regions-borrow-uniq.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/regions/regions-bot.rs b/src/test/run-pass/regions/regions-bot.rs index 3d1ac6277f7..58016293640 100644 --- a/src/test/run-pass/regions/regions-bot.rs +++ b/src/test/run-pass/regions/regions-bot.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // A very limited test of the "bottom" region diff --git a/src/test/run-pass/regions/regions-bound-lists-feature-gate-2.rs b/src/test/run-pass/regions/regions-bound-lists-feature-gate-2.rs index 568b8eed4f3..2c750379933 100644 --- a/src/test/run-pass/regions/regions-bound-lists-feature-gate-2.rs +++ b/src/test/run-pass/regions/regions-bound-lists-feature-gate-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(stable_features)] diff --git a/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs b/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs index f2785992564..204f4f8130d 100644 --- a/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs +++ b/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/regions/regions-close-over-type-parameter-successfully.rs b/src/test/run-pass/regions/regions-close-over-type-parameter-successfully.rs index b2bf71f02fb..85c9c64c643 100644 --- a/src/test/run-pass/regions/regions-close-over-type-parameter-successfully.rs +++ b/src/test/run-pass/regions/regions-close-over-type-parameter-successfully.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // A test where we (successfully) close over a reference into // an object. diff --git a/src/test/run-pass/regions/regions-copy-closure.rs b/src/test/run-pass/regions/regions-copy-closure.rs index a5f0860be16..6545ddf72c7 100644 --- a/src/test/run-pass/regions/regions-copy-closure.rs +++ b/src/test/run-pass/regions/regions-copy-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/regions/regions-creating-enums2.rs b/src/test/run-pass/regions/regions-creating-enums2.rs index 51fdc2dc00e..7b16fb1a8e0 100644 --- a/src/test/run-pass/regions/regions-creating-enums2.rs +++ b/src/test/run-pass/regions/regions-creating-enums2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/regions/regions-creating-enums5.rs b/src/test/run-pass/regions/regions-creating-enums5.rs index 637748ebec8..ad3d9748bf0 100644 --- a/src/test/run-pass/regions/regions-creating-enums5.rs +++ b/src/test/run-pass/regions/regions-creating-enums5.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/regions/regions-debruijn-of-object.rs b/src/test/run-pass/regions/regions-debruijn-of-object.rs index 100fd423cd4..24c0cf53317 100644 --- a/src/test/run-pass/regions/regions-debruijn-of-object.rs +++ b/src/test/run-pass/regions/regions-debruijn-of-object.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/regions/regions-dependent-addr-of.rs b/src/test/run-pass/regions/regions-dependent-addr-of.rs index 2a86d8aa4e5..0a7e6625c73 100644 --- a/src/test/run-pass/regions/regions-dependent-addr-of.rs +++ b/src/test/run-pass/regions/regions-dependent-addr-of.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test lifetimes are linked properly when we create dependent region pointers. // Issue #3148. diff --git a/src/test/run-pass/regions/regions-dependent-autofn.rs b/src/test/run-pass/regions/regions-dependent-autofn.rs index 19b345575c3..246dbb5563c 100644 --- a/src/test/run-pass/regions/regions-dependent-autofn.rs +++ b/src/test/run-pass/regions/regions-dependent-autofn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test lifetimes are linked properly when we autoslice a vector. // Issue #3148. diff --git a/src/test/run-pass/regions/regions-dependent-autoslice.rs b/src/test/run-pass/regions/regions-dependent-autoslice.rs index 12e14ed49b9..4c5b35ec455 100644 --- a/src/test/run-pass/regions/regions-dependent-autoslice.rs +++ b/src/test/run-pass/regions/regions-dependent-autoslice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test lifetimes are linked properly when we autoslice a vector. // Issue #3148. diff --git a/src/test/run-pass/regions/regions-dependent-let-ref.rs b/src/test/run-pass/regions/regions-dependent-let-ref.rs index fa0955bc351..94e3df4b3f1 100644 --- a/src/test/run-pass/regions/regions-dependent-let-ref.rs +++ b/src/test/run-pass/regions/regions-dependent-let-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test lifetimes are linked properly when we take reference // to interior. diff --git a/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs b/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs index 72c4dc37710..fe50a7dd1be 100644 --- a/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs +++ b/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // Test that we are able to compile calls to associated fns like diff --git a/src/test/run-pass/regions/regions-early-bound-trait-param.rs b/src/test/run-pass/regions/regions-early-bound-trait-param.rs index 220614c9203..c71e47db22d 100644 --- a/src/test/run-pass/regions/regions-early-bound-trait-param.rs +++ b/src/test/run-pass/regions/regions-early-bound-trait-param.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that you can use an early-bound lifetime parameter as // on of the generic parameters in a trait. @@ -131,7 +121,7 @@ pub fn main() { // for details. assert_eq!(object_invoke2(&*m), 5); - // The RefMakerTrait above is pretty strange (i.e. it is strange + // The RefMakerTrait above is pretty strange (i.e., it is strange // to consume a value of type T and return a &T). Easiest thing // that came to my mind: consume a cell of a linked list and // return a reference to the list it points to. diff --git a/src/test/run-pass/regions/regions-early-bound-used-in-bound-method.rs b/src/test/run-pass/regions/regions-early-bound-used-in-bound-method.rs index 718ab873a41..a778dae1ed3 100644 --- a/src/test/run-pass/regions/regions-early-bound-used-in-bound-method.rs +++ b/src/test/run-pass/regions/regions-early-bound-used-in-bound-method.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that you can use a fn lifetime parameter as part of // the value for a type parameter in a bound. diff --git a/src/test/run-pass/regions/regions-early-bound-used-in-bound.rs b/src/test/run-pass/regions/regions-early-bound-used-in-bound.rs index e994303643f..6ccc99e845d 100644 --- a/src/test/run-pass/regions/regions-early-bound-used-in-bound.rs +++ b/src/test/run-pass/regions/regions-early-bound-used-in-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that you can use a fn lifetime parameter as part of // the value for a type parameter in a bound. diff --git a/src/test/run-pass/regions/regions-early-bound-used-in-type-param.rs b/src/test/run-pass/regions/regions-early-bound-used-in-type-param.rs index fd4e46b5392..d58c17ad9c8 100644 --- a/src/test/run-pass/regions/regions-early-bound-used-in-type-param.rs +++ b/src/test/run-pass/regions/regions-early-bound-used-in-type-param.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that you can use a fn lifetime parameter as part of // the value for a type parameter in a bound. diff --git a/src/test/run-pass/regions/regions-escape-into-other-fn.rs b/src/test/run-pass/regions/regions-escape-into-other-fn.rs index 1601e73aff9..fd4690463e6 100644 --- a/src/test/run-pass/regions/regions-escape-into-other-fn.rs +++ b/src/test/run-pass/regions/regions-escape-into-other-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/regions/regions-expl-self.rs b/src/test/run-pass/regions/regions-expl-self.rs index d19e7b6c7b5..f7315d628a5 100644 --- a/src/test/run-pass/regions/regions-expl-self.rs +++ b/src/test/run-pass/regions/regions-expl-self.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that you can insert an explicit lifetime in explicit self. diff --git a/src/test/run-pass/regions/regions-fn-subtyping-2.rs b/src/test/run-pass/regions/regions-fn-subtyping-2.rs index 1f9f7baf48b..cbd88ebde0d 100644 --- a/src/test/run-pass/regions/regions-fn-subtyping-2.rs +++ b/src/test/run-pass/regions/regions-fn-subtyping-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Issue #2263. diff --git a/src/test/run-pass/regions/regions-fn-subtyping.rs b/src/test/run-pass/regions/regions-fn-subtyping.rs index 0192890277b..a1da966659a 100644 --- a/src/test/run-pass/regions/regions-fn-subtyping.rs +++ b/src/test/run-pass/regions/regions-fn-subtyping.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_assignments)] diff --git a/src/test/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs b/src/test/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs index bc316983f82..f464cab7554 100644 --- a/src/test/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs +++ b/src/test/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that we recognize that if you have diff --git a/src/test/run-pass/regions/regions-infer-borrow-scope-addr-of.rs b/src/test/run-pass/regions/regions-infer-borrow-scope-addr-of.rs index 6ac09930f85..5d8ad932ed6 100644 --- a/src/test/run-pass/regions/regions-infer-borrow-scope-addr-of.rs +++ b/src/test/run-pass/regions/regions-infer-borrow-scope-addr-of.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem::swap; diff --git a/src/test/run-pass/regions/regions-infer-borrow-scope-view.rs b/src/test/run-pass/regions/regions-infer-borrow-scope-view.rs index 2ad1378de04..349b5204434 100644 --- a/src/test/run-pass/regions/regions-infer-borrow-scope-view.rs +++ b/src/test/run-pass/regions/regions-infer-borrow-scope-view.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/regions/regions-infer-borrow-scope-within-loop-ok.rs b/src/test/run-pass/regions/regions-infer-borrow-scope-within-loop-ok.rs index d527f298ce0..f0ecc5de545 100644 --- a/src/test/run-pass/regions/regions-infer-borrow-scope-within-loop-ok.rs +++ b/src/test/run-pass/regions/regions-infer-borrow-scope-within-loop-ok.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/regions/regions-infer-borrow-scope.rs b/src/test/run-pass/regions/regions-infer-borrow-scope.rs index 6bc2c62c6dc..453973d9c58 100644 --- a/src/test/run-pass/regions/regions-infer-borrow-scope.rs +++ b/src/test/run-pass/regions/regions-infer-borrow-scope.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![feature(box_syntax)] diff --git a/src/test/run-pass/regions/regions-infer-call-2.rs b/src/test/run-pass/regions/regions-infer-call-2.rs index 8fcfd5f2ee5..a288d2e4d6e 100644 --- a/src/test/run-pass/regions/regions-infer-call-2.rs +++ b/src/test/run-pass/regions/regions-infer-call-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn takes_two(x: &isize, y: &isize) -> isize { *x + *y } diff --git a/src/test/run-pass/regions/regions-infer-call.rs b/src/test/run-pass/regions/regions-infer-call.rs index 42ab24705de..248f9e923d3 100644 --- a/src/test/run-pass/regions/regions-infer-call.rs +++ b/src/test/run-pass/regions/regions-infer-call.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn takes_two(x: &isize, y: &isize) -> isize { *x + *y } diff --git a/src/test/run-pass/regions/regions-infer-contravariance-due-to-ret.rs b/src/test/run-pass/regions/regions-infer-contravariance-due-to-ret.rs index fc152fd275a..fbd89501559 100644 --- a/src/test/run-pass/regions/regions-infer-contravariance-due-to-ret.rs +++ b/src/test/run-pass/regions/regions-infer-contravariance-due-to-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs b/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs index 0608802e682..31a48b4adcf 100644 --- a/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs +++ b/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test an edge case in region inference: the lifetime of the borrow diff --git a/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs b/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs index 4eeeac1767c..dff36e6d183 100644 --- a/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs +++ b/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/regions/regions-infer-static-from-proc.rs b/src/test/run-pass/regions/regions-infer-static-from-proc.rs index 2a3cb3735ec..39501e2d697 100644 --- a/src/test/run-pass/regions/regions-infer-static-from-proc.rs +++ b/src/test/run-pass/regions/regions-infer-static-from-proc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/regions/regions-issue-21422.rs b/src/test/run-pass/regions/regions-issue-21422.rs index 6e76793e8b9..198b7146647 100644 --- a/src/test/run-pass/regions/regions-issue-21422.rs +++ b/src/test/run-pass/regions/regions-issue-21422.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Regression test for issue #21422, which was related to failing to // add inference constraints that the operands of a binary operator diff --git a/src/test/run-pass/regions/regions-issue-22246.rs b/src/test/run-pass/regions/regions-issue-22246.rs index 3b7cc8e3775..0858833678b 100644 --- a/src/test/run-pass/regions/regions-issue-22246.rs +++ b/src/test/run-pass/regions/regions-issue-22246.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // Regression test for issue #22246 -- we should be able to deduce diff --git a/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs b/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs index 1a294dceab8..189f6172029 100644 --- a/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs +++ b/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This is a regression test for the ICE from issue #10846. // diff --git a/src/test/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs b/src/test/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs index 2f0de4f4784..b6a89e29ecc 100644 --- a/src/test/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs +++ b/src/test/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // This test verifies that temporary lifetime is correctly computed diff --git a/src/test/run-pass/regions/regions-link-fn-args.rs b/src/test/run-pass/regions/regions-link-fn-args.rs index cb52c69cbe3..231407b226e 100644 --- a/src/test/run-pass/regions/regions-link-fn-args.rs +++ b/src/test/run-pass/regions/regions-link-fn-args.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that region inference correctly links up the regions when a // `ref` borrow occurs inside a fn argument. diff --git a/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs b/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs index 110bc2f1fd3..cd095f6f3a4 100644 --- a/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs +++ b/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test a corner case of LUB coercion. In this case, one arm of the diff --git a/src/test/run-pass/regions/regions-mock-codegen.rs b/src/test/run-pass/regions/regions-mock-codegen.rs index 2393457409e..521ef3f6a4b 100644 --- a/src/test/run-pass/regions/regions-mock-codegen.rs +++ b/src/test/run-pass/regions/regions-mock-codegen.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/regions/regions-no-bound-in-argument-cleanup.rs b/src/test/run-pass/regions/regions-no-bound-in-argument-cleanup.rs index 0f2fa1f7c78..aafab5d86b8 100644 --- a/src/test/run-pass/regions/regions-no-bound-in-argument-cleanup.rs +++ b/src/test/run-pass/regions/regions-no-bound-in-argument-cleanup.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/regions/regions-no-variance-from-fn-generics.rs b/src/test/run-pass/regions/regions-no-variance-from-fn-generics.rs index e409e43297f..76706a82781 100644 --- a/src/test/run-pass/regions/regions-no-variance-from-fn-generics.rs +++ b/src/test/run-pass/regions/regions-no-variance-from-fn-generics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Issue #12856: a lifetime formal binding introduced by a generic fn diff --git a/src/test/run-pass/regions/regions-nullary-variant.rs b/src/test/run-pass/regions/regions-nullary-variant.rs index bde2cf1c082..82470af82fa 100644 --- a/src/test/run-pass/regions/regions-nullary-variant.rs +++ b/src/test/run-pass/regions/regions-nullary-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/regions/regions-params.rs b/src/test/run-pass/regions/regions-params.rs index 81e26e0444e..04f3b8eaf57 100644 --- a/src/test/run-pass/regions/regions-params.rs +++ b/src/test/run-pass/regions/regions-params.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_parens)] diff --git a/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs b/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs index 39dc92cbd7b..948b11e0f30 100644 --- a/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs +++ b/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs b/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs index 329efaf5555..ca52659c4db 100644 --- a/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs +++ b/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/src/test/run-pass/regions/regions-refcell.rs b/src/test/run-pass/regions/regions-refcell.rs index 0042edb65ad..39ad0c53f1e 100644 --- a/src/test/run-pass/regions/regions-refcell.rs +++ b/src/test/run-pass/regions/regions-refcell.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This is a regression test for something that only came up while // attempting to bootstrap librustc with new destructor lifetime diff --git a/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs b/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs index 1b6c025d7fa..f26ef85ef72 100644 --- a/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs +++ b/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that this fairly specialized, but also reasonable, pattern diff --git a/src/test/run-pass/regions/regions-return-interior-of-option.rs b/src/test/run-pass/regions/regions-return-interior-of-option.rs index 6566969185c..2dc91ec84f5 100644 --- a/src/test/run-pass/regions/regions-return-interior-of-option.rs +++ b/src/test/run-pass/regions/regions-return-interior-of-option.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn get(opt: &Option) -> &T { diff --git a/src/test/run-pass/regions/regions-scope-chain-example.rs b/src/test/run-pass/regions/regions-scope-chain-example.rs index ccfa080d216..2beb20add32 100644 --- a/src/test/run-pass/regions/regions-scope-chain-example.rs +++ b/src/test/run-pass/regions/regions-scope-chain-example.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/regions/regions-self-impls.rs b/src/test/run-pass/regions/regions-self-impls.rs index 027c7698bf8..80b88568e42 100644 --- a/src/test/run-pass/regions/regions-self-impls.rs +++ b/src/test/run-pass/regions/regions-self-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/regions/regions-self-in-enums.rs b/src/test/run-pass/regions/regions-self-in-enums.rs index 61160951000..c2e4b2ff10d 100644 --- a/src/test/run-pass/regions/regions-self-in-enums.rs +++ b/src/test/run-pass/regions/regions-self-in-enums.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/regions/regions-simple.rs b/src/test/run-pass/regions/regions-simple.rs index 66492b966d1..fff1b47f53f 100644 --- a/src/test/run-pass/regions/regions-simple.rs +++ b/src/test/run-pass/regions/regions-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { let mut x: isize = 3; diff --git a/src/test/run-pass/regions/regions-static-bound.rs b/src/test/run-pass/regions/regions-static-bound.rs index 7a8e91ccdda..c91c6f87493 100644 --- a/src/test/run-pass/regions/regions-static-bound.rs +++ b/src/test/run-pass/regions/regions-static-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn invariant_id<'a,'b>(t: &'b mut &'static ()) -> &'b mut &'a () where 'a: 'static { t } diff --git a/src/test/run-pass/regions/regions-static-closure.rs b/src/test/run-pass/regions/regions-static-closure.rs index fa579a31806..6d00f7501ca 100644 --- a/src/test/run-pass/regions/regions-static-closure.rs +++ b/src/test/run-pass/regions/regions-static-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/regions/regions-trait-object-1.rs b/src/test/run-pass/regions/regions-trait-object-1.rs index 63bbe31d431..242142588ea 100644 --- a/src/test/run-pass/regions/regions-trait-object-1.rs +++ b/src/test/run-pass/regions/regions-trait-object-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This is a regression test for something that only came up while // attempting to bootstrap libsyntax; it is adapted from diff --git a/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs b/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs index de19fbd0e8c..f10d5a25f16 100644 --- a/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs +++ b/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs b/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs index fb20324ce97..9316aa15d32 100644 --- a/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs +++ b/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test that a type which is covariant with respect to its region diff --git a/src/test/run-pass/repeat-expr-in-static.rs b/src/test/run-pass/repeat-expr-in-static.rs index fc85aa8b510..928509e1bd6 100644 --- a/src/test/run-pass/repeat-expr-in-static.rs +++ b/src/test/run-pass/repeat-expr-in-static.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - static FOO: [isize; 4] = [32; 4]; static BAR: [isize; 4] = [32, 32, 32, 32]; diff --git a/src/test/run-pass/repr_c_int_align.rs b/src/test/run-pass/repr_c_int_align.rs index af4eb615302..9bb08cb6c64 100644 --- a/src/test/run-pass/repr_c_int_align.rs +++ b/src/test/run-pass/repr_c_int_align.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O #![allow(dead_code)] diff --git a/src/test/run-pass/resolve-issue-2428.rs b/src/test/run-pass/resolve-issue-2428.rs index 0ad97e78d1a..7e730f6156c 100644 --- a/src/test/run-pass/resolve-issue-2428.rs +++ b/src/test/run-pass/resolve-issue-2428.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/resolve-pseudo-shadowing.rs b/src/test/run-pass/resolve-pseudo-shadowing.rs index bf6e686bb7b..1a8ce9682ec 100644 --- a/src/test/run-pass/resolve-pseudo-shadowing.rs +++ b/src/test/run-pass/resolve-pseudo-shadowing.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that type parameters can't "shadow" qualified paths. fn check(_c: Clone) { diff --git a/src/test/run-pass/resource-assign-is-not-copy.rs b/src/test/run-pass/resource-assign-is-not-copy.rs index ccc3396e50c..c26473da5e0 100644 --- a/src/test/run-pass/resource-assign-is-not-copy.rs +++ b/src/test/run-pass/resource-assign-is-not-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] use std::cell::Cell; diff --git a/src/test/run-pass/resource-destruct.rs b/src/test/run-pass/resource-destruct.rs index d3ba221b34a..066ce46f0b2 100644 --- a/src/test/run-pass/resource-destruct.rs +++ b/src/test/run-pass/resource-destruct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] use std::cell::Cell; diff --git a/src/test/run-pass/result-opt-conversions.rs b/src/test/run-pass/result-opt-conversions.rs index 0f6da002dda..14b562160df 100644 --- a/src/test/run-pass/result-opt-conversions.rs +++ b/src/test/run-pass/result-opt-conversions.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(transpose_result)] - #[derive(Copy, Clone, Debug, PartialEq)] struct BadNumErr; diff --git a/src/test/run-pass/ret-bang.rs b/src/test/run-pass/ret-bang.rs index 7d4d0218112..eb69ee6f886 100644 --- a/src/test/run-pass/ret-bang.rs +++ b/src/test/run-pass/ret-bang.rs @@ -1,16 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - fn my_err(s: String) -> ! { println!("{}", s); panic!(); } fn okay(i: usize) -> isize { diff --git a/src/test/run-pass/ret-none.rs b/src/test/run-pass/ret-none.rs index 72ee3dbfe2d..f23461faaf4 100644 --- a/src/test/run-pass/ret-none.rs +++ b/src/test/run-pass/ret-none.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] diff --git a/src/test/run-pass/return-nil.rs b/src/test/run-pass/return-nil.rs index fe4244084cb..f24df197234 100644 --- a/src/test/run-pass/return-nil.rs +++ b/src/test/run-pass/return-nil.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - // pretty-expanded FIXME #23616 fn f() { let x: () = (); return x; } diff --git a/src/test/run-pass/rfcs/rfc-1014-2.rs b/src/test/run-pass/rfcs/rfc-1014-2.rs index 7fbc0d1db70..5be092204d7 100644 --- a/src/test/run-pass/rfcs/rfc-1014-2.rs +++ b/src/test/run-pass/rfcs/rfc-1014-2.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/rfcs/rfc-1014.rs b/src/test/run-pass/rfcs/rfc-1014.rs index d101c3c9ab1..3b7b96d0d02 100644 --- a/src/test/run-pass/rfcs/rfc-1014.rs +++ b/src/test/run-pass/rfcs/rfc-1014.rs @@ -1,19 +1,9 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // ignore-cloudabi stdout does not map to file descriptor 1 by default // ignore-wasm32-bare no libc -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs b/src/test/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs index e873b1946d9..f275c67fdf0 100644 --- a/src/test/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs +++ b/src/test/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(as_cell)] diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs index b245b659559..e98582cbce3 100644 --- a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::error::Error; diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-empty.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-empty.rs index 62ad0e2489a..bac695d4e79 100644 --- a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-empty.rs +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-empty.rs @@ -1,12 +1,2 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() {} diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-exitcode.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-exitcode.rs index bff6f9a6bca..9c2270bf827 100644 --- a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-exitcode.rs +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-exitcode.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(process_exitcode_placeholder)] diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-impl-termination.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-impl-termination.rs index 6c3f2fe4ea5..79cfba011c0 100644 --- a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-impl-termination.rs +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-impl-termination.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(termination_trait_lib)] diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs index cf63737d07f..b0e932e1fe0 100644 --- a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::io::Error; diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result.rs index d61876d422a..30f36c24489 100644 --- a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result.rs +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::io::Error; diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-str.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-str.rs index 4f60eda0d9a..f0591c38c00 100644 --- a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-str.rs +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-str.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn main() -> Result<(), &'static str> { Ok(()) diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs index 8d67e235a93..b3be41599a5 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unreachable_patterns)] #![feature(box_syntax, box_patterns)] diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/constref.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/constref.rs index ac245ba6ff8..d5bca6a2474 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/constref.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/constref.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass const CONST_REF: &[u8; 3] = b"foo"; diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/enum.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/enum.rs index 6ea3b6f99ce..52fbb90ed54 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/enum.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/enum.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass enum Wrapper { Wrap(i32), diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/for.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/for.rs index e85d11f073d..a5a24a80634 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/for.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/for.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { let mut tups = vec![(0u8, 1u8)]; diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs index 6244daab1e6..0207f607be8 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] fn some_or_wildcard(r: &Option, b: &i32) { diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs index 9df250ea399..9379753598e 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] fn with_u8() { diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/range.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/range.rs index 3c8463f77ef..580e67513b3 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/range.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/range.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { let i = 5; diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/ref-region.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/ref-region.rs index 7cdd35acaad..b74e45c9328 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/ref-region.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/ref-region.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn foo<'a, 'b>(x: &'a &'b Option) -> &'a u32 { let x: &'a &'a Option = x; diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/reset-mode.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/reset-mode.rs index c8144e09fc8..3b9d07610d2 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/reset-mode.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/reset-mode.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we "reset" the mode as we pass through a `&` pattern. // diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/slice.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/slice.rs index 90fa52bc903..939a3c4a1fd 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/slice.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/slice.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(slice_patterns)] diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/struct.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/struct.rs index 5e41f012137..5a00e5b6823 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/struct.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Debug, PartialEq)] struct Foo { diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs index 9427482ed9c..0cf9ba1b4ca 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] enum Foo { diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple.rs index 830e6f5e5ba..4c22aa2d718 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { let foo = (Some(1), (), (), vec![2, 3]); diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs index 0dbc5c8f969..b3e2fa2c620 100644 --- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![crate_type = "rlib"] #![feature(non_exhaustive)] diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs index 25764457701..08b14d0df94 100644 --- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(non_exhaustive)] diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs index 2975126709b..56a73d8ab60 100644 --- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![crate_type = "rlib"] #![feature(non_exhaustive)] diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs index ff8b473b43b..f7e9c538496 100644 --- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:enums.rs extern crate enums; diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs index 8f0274f318d..384e099275e 100644 --- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(non_exhaustive)] diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs index 34756677636..3cd7234269e 100644 --- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs index 4bbd9e2b7fa..5e71cce1297 100644 --- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![feature(non_exhaustive)] diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs index 2122534facb..90b8219e2a3 100644 --- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:variants.rs extern crate variants; diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs index e339c046b18..603e69b9ff9 100644 --- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(non_exhaustive)] diff --git a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs index 612f5bc0cfc..02d4851ab2a 100644 --- a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs +++ b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(crate_in_paths)] #![allow(dead_code)] diff --git a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr index f95237fbbea..ac4b51bdb58 100644 --- a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr +++ b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr @@ -1,5 +1,5 @@ warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/crate-path-absolute.rs:12:12 + --> $DIR/crate-path-absolute.rs:2:12 | LL | #![feature(crate_in_paths)] | ^^^^^^^^^^^^^^ diff --git a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs index fc77d744a23..5fa8d7b2a49 100644 --- a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs +++ b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(crate_in_paths)] #![feature(crate_visibility_modifier)] diff --git a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr index 91f918dbd2c..63d3a2ea5db 100644 --- a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr +++ b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr @@ -1,5 +1,5 @@ warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/crate-path-visibility-ambiguity.rs:12:12 + --> $DIR/crate-path-visibility-ambiguity.rs:2:12 | LL | #![feature(crate_in_paths)] | ^^^^^^^^^^^^^^ diff --git a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs index a5214d796cd..07e70648452 100644 --- a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs +++ b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Debug, PartialEq)] pub struct S; diff --git a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs index 61cf6dcf30c..15449a6b83e 100644 --- a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs +++ b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:xcrate.rs diff --git a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs deleted file mode 100644 index e25f76ab48e..00000000000 --- a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] -// aux-build:xcrate.rs -// compile-flags:--extern xcrate - -#![feature(extern_in_paths)] - -use extern::xcrate::Z; - -type A = extern::xcrate::S; -type B = for<'a> extern::xcrate::Tr<'a>; - -fn f() { - use extern::xcrate; - use extern::xcrate as ycrate; - let s = xcrate::S; - assert_eq!(format!("{:?}", s), "S"); - let z = ycrate::Z; - assert_eq!(format!("{:?}", z), "Z"); -} - -fn main() { - let s = extern::xcrate::S; - assert_eq!(format!("{:?}", s), "S"); - let z = Z; - assert_eq!(format!("{:?}", z), "Z"); - assert_eq!(A {}, extern::xcrate::S {}); -} diff --git a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/test.rs b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/test.rs index a8fa07af14d..7ed82e32a0a 100644 --- a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/test.rs +++ b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/test.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that `#[test]` works with extern-absolute-paths enabled. // diff --git a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs index dfd9fbd2774..251406e7604 100644 --- a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs +++ b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // edition:2018 diff --git a/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs index 95db3873619..2fe1e05e509 100644 --- a/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs +++ b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem; diff --git a/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/basic.rs b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/basic.rs index 38c00f4a7e1..f2fe59668da 100644 --- a/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/basic.rs +++ b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/basic.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn r#fn(r#match: u32) -> u32 { r#match diff --git a/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/items.rs b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/items.rs index b3ea7b28362..4665225178c 100644 --- a/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/items.rs +++ b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/items.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Debug, PartialEq, Eq)] struct IntWrapper(u32); diff --git a/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/macros.rs b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/macros.rs index ed39498526d..51a3b46d461 100644 --- a/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/macros.rs +++ b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/macros.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(decl_macro)] diff --git a/src/test/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs b/src/test/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs index f9d1ee0e9e0..22f04c58f3b 100644 --- a/src/test/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs +++ b/src/test/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs @@ -1,16 +1,5 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] -#![feature(if_while_or_patterns)] enum E { V(u8), @@ -29,4 +18,16 @@ fn main() { assert_eq!(x, 10); e = W; } + + // Accept leading `|`: + + let mut e = V(10); + + if let | V(x) | U(x) = e { + assert_eq!(x, 10); + } + while let | V(x) | U(x) = e { + assert_eq!(x, 10); + e = W; + } } diff --git a/src/test/run-pass/rfcs/rfc-2302-self-struct-ctor.rs b/src/test/run-pass/rfcs/rfc-2302-self-struct-ctor.rs index 156e240e442..1ec20c50034 100644 --- a/src/test/run-pass/rfcs/rfc-2302-self-struct-ctor.rs +++ b/src/test/run-pass/rfcs/rfc-2302-self-struct-ctor.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(self_struct_ctor)] - #![allow(dead_code)] use std::fmt::Display; diff --git a/src/test/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs b/src/test/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs index a6046cdba94..6d7bca4da24 100644 --- a/src/test/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs +++ b/src/test/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs b/src/test/run-pass/rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs index a6b46d9c00c..17174e22c74 100644 --- a/src/test/run-pass/rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs +++ b/src/test/run-pass/rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/rfcs/rfc1445/eq-allows-match.rs b/src/test/run-pass/rfcs/rfc1445/eq-allows-match.rs index 2dfe62b044a..405a69c94bf 100644 --- a/src/test/run-pass/rfcs/rfc1445/eq-allows-match.rs +++ b/src/test/run-pass/rfcs/rfc1445/eq-allows-match.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/rfcs/rfc1623.rs b/src/test/run-pass/rfcs/rfc1623.rs index cc085a6f367..adaf25c6bbf 100644 --- a/src/test/run-pass/rfcs/rfc1623.rs +++ b/src/test/run-pass/rfcs/rfc1623.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs b/src/test/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs index 7438ba21bfc..c1c5b70bc04 100644 --- a/src/test/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs +++ b/src/test/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "staticlib"] diff --git a/src/test/run-pass/rfcs/rfc1717/library-override.rs b/src/test/run-pass/rfcs/rfc1717/library-override.rs index 6e0ff447081..014ccac31b7 100644 --- a/src/test/run-pass/rfcs/rfc1717/library-override.rs +++ b/src/test/run-pass/rfcs/rfc1717/library-override.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare no libc to test ffi with // compile-flags: -lstatic=wronglibrary:rust_test_helpers diff --git a/src/test/run-pass/rfcs/rfc1857-drop-order.rs b/src/test/run-pass/rfcs/rfc1857-drop-order.rs index 66edfd06730..7923aa7c0e2 100644 --- a/src/test/run-pass/rfcs/rfc1857-drop-order.rs +++ b/src/test/run-pass/rfcs/rfc1857-drop-order.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-wasm32-bare compiled with panic=abort by default diff --git a/src/test/run-pass/rmeta.rs b/src/test/run-pass/rmeta.rs index 11684d8663a..bd8125bbb56 100644 --- a/src/test/run-pass/rmeta.rs +++ b/src/test/run-pass/rmeta.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that using rlibs and rmeta dep crates work together. Specifically, that // there can be both an rmeta and an rlib file and rustc will prefer the rlib. diff --git a/src/test/run-pass/running-with-no-runtime.rs b/src/test/run-pass/running-with-no-runtime.rs index d349519478a..7f8a0f01dde 100644 --- a/src/test/run-pass/running-with-no-runtime.rs +++ b/src/test/run-pass/running-with-no-runtime.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi spawning processes is not supported // ignore-emscripten spawning processes is not supported diff --git a/src/test/run-pass/rustc-rust-log.rs b/src/test/run-pass/rustc-rust-log.rs index 8c3e4b391e9..4360a154015 100644 --- a/src/test/run-pass/rustc-rust-log.rs +++ b/src/test/run-pass/rustc-rust-log.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test is just checking that we won't ICE if logging is turned // on; don't bother trying to compare that (copious) output. (Note // also that this test potentially silly, since we do not build+test @@ -16,6 +6,7 @@ // // dont-check-compiler-stdout // dont-check-compiler-stderr +// compile-flags: --error-format human // rustc-env:RUST_LOG=debug diff --git a/src/test/run-pass/rvalue-static-promotion.rs b/src/test/run-pass/rvalue-static-promotion.rs index acf96b566df..0066217774d 100644 --- a/src/test/run-pass/rvalue-static-promotion.rs +++ b/src/test/run-pass/rvalue-static-promotion.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cell::Cell; const NONE_CELL_STRING: Option> = None; diff --git a/src/test/run-pass/segfault-no-out-of-stack.rs b/src/test/run-pass/segfault-no-out-of-stack.rs index a85fe6733dd..ce485d771f0 100644 --- a/src/test/run-pass/segfault-no-out-of-stack.rs +++ b/src/test/run-pass/segfault-no-out-of-stack.rs @@ -1,18 +1,8 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] // ignore-cloudabi can't run commands // ignore-emscripten can't run commands -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs b/src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs index c609f0dd83e..0eab7617f7a 100644 --- a/src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs +++ b/src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(arbitrary_self_types)] diff --git a/src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs b/src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs index 86b3c86564b..acbe896eebe 100644 --- a/src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs +++ b/src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(arbitrary_self_types)] diff --git a/src/test/run-pass/self/arbitrary_self_types_silly.rs b/src/test/run-pass/self/arbitrary_self_types_silly.rs index 9fb023403ec..fb5f9012b18 100644 --- a/src/test/run-pass/self/arbitrary_self_types_silly.rs +++ b/src/test/run-pass/self/arbitrary_self_types_silly.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(arbitrary_self_types)] diff --git a/src/test/run-pass/self/arbitrary_self_types_struct.rs b/src/test/run-pass/self/arbitrary_self_types_struct.rs index bc526701b6c..cf62cd3a4e6 100644 --- a/src/test/run-pass/self/arbitrary_self_types_struct.rs +++ b/src/test/run-pass/self/arbitrary_self_types_struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(arbitrary_self_types)] diff --git a/src/test/run-pass/self/arbitrary_self_types_trait.rs b/src/test/run-pass/self/arbitrary_self_types_trait.rs index bd06573c99b..fb06344df7e 100644 --- a/src/test/run-pass/self/arbitrary_self_types_trait.rs +++ b/src/test/run-pass/self/arbitrary_self_types_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(arbitrary_self_types)] diff --git a/src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs b/src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs index e75e848db24..b78223fd57c 100644 --- a/src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs +++ b/src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(arbitrary_self_types)] diff --git a/src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs b/src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs index dafa66d9286..25cdfa90990 100644 --- a/src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs +++ b/src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo { #[inline(always)] fn f(&self); diff --git a/src/test/run-pass/self/builtin-superkinds-self-type.rs b/src/test/run-pass/self/builtin-superkinds-self-type.rs index a7754e06892..c56542bb468 100644 --- a/src/test/run-pass/self/builtin-superkinds-self-type.rs +++ b/src/test/run-pass/self/builtin-superkinds-self-type.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests the ability for the Self type in default methods to use // capabilities granted by builtin kinds as supertraits. diff --git a/src/test/run-pass/self/by-value-self-in-mut-slot.rs b/src/test/run-pass/self/by-value-self-in-mut-slot.rs index d7f9ac6cc76..267afd1dcad 100644 --- a/src/test/run-pass/self/by-value-self-in-mut-slot.rs +++ b/src/test/run-pass/self/by-value-self-in-mut-slot.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct X { diff --git a/src/test/run-pass/self/explicit-self-closures.rs b/src/test/run-pass/self/explicit-self-closures.rs index 04e40021a5f..61be98fe3d3 100644 --- a/src/test/run-pass/self/explicit-self-closures.rs +++ b/src/test/run-pass/self/explicit-self-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test to make sure that explicit self params work inside closures diff --git a/src/test/run-pass/self/explicit-self-generic.rs b/src/test/run-pass/self/explicit-self-generic.rs index d23ad94f1f5..03f72a5513c 100644 --- a/src/test/run-pass/self/explicit-self-generic.rs +++ b/src/test/run-pass/self/explicit-self-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![feature(box_syntax)] diff --git a/src/test/run-pass/self/explicit-self-objects-uniq.rs b/src/test/run-pass/self/explicit-self-objects-uniq.rs index 373325aca06..f95686cf112 100644 --- a/src/test/run-pass/self/explicit-self-objects-uniq.rs +++ b/src/test/run-pass/self/explicit-self-objects-uniq.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/self/explicit-self.rs b/src/test/run-pass/self/explicit-self.rs index 1cf38a384ca..6d19d33b6fe 100644 --- a/src/test/run-pass/self/explicit-self.rs +++ b/src/test/run-pass/self/explicit-self.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/self/explicit_self_xcrate_exe.rs b/src/test/run-pass/self/explicit_self_xcrate_exe.rs index 3847bb4c661..c3796f73ab5 100644 --- a/src/test/run-pass/self/explicit_self_xcrate_exe.rs +++ b/src/test/run-pass/self/explicit_self_xcrate_exe.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:explicit_self_xcrate.rs diff --git a/src/test/run-pass/self/move-self.rs b/src/test/run-pass/self/move-self.rs index d414a11edf4..66032780b81 100644 --- a/src/test/run-pass/self/move-self.rs +++ b/src/test/run-pass/self/move-self.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct S { x: String diff --git a/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs b/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs index 42ed4f91e73..ae0512666ce 100644 --- a/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs +++ b/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] // Check that a trait is still object-safe (and usable) if it has diff --git a/src/test/run-pass/self/object-safety-sized-self-generic-method.rs b/src/test/run-pass/self/object-safety-sized-self-generic-method.rs index 218a36f2226..0b3f6633737 100644 --- a/src/test/run-pass/self/object-safety-sized-self-generic-method.rs +++ b/src/test/run-pass/self/object-safety-sized-self-generic-method.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Check that a trait is still object-safe (and usable) if it has diff --git a/src/test/run-pass/self/object-safety-sized-self-return-Self.rs b/src/test/run-pass/self/object-safety-sized-self-return-Self.rs index 09e28473fa7..e88dba0a4e8 100644 --- a/src/test/run-pass/self/object-safety-sized-self-return-Self.rs +++ b/src/test/run-pass/self/object-safety-sized-self-return-Self.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that a trait is still object-safe (and usable) if it has // methods that return `Self` so long as they require `Self : Sized`. diff --git a/src/test/run-pass/self/self-impl.rs b/src/test/run-pass/self/self-impl.rs index 465ca467859..23d513e3fac 100644 --- a/src/test/run-pass/self/self-impl.rs +++ b/src/test/run-pass/self/self-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/self/self-in-mut-slot-default-method.rs b/src/test/run-pass/self/self-in-mut-slot-default-method.rs index 058ad2ef64e..82c5f58f020 100644 --- a/src/test/run-pass/self/self-in-mut-slot-default-method.rs +++ b/src/test/run-pass/self/self-in-mut-slot-default-method.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/self/self-in-mut-slot-immediate-value.rs b/src/test/run-pass/self/self-in-mut-slot-immediate-value.rs index d32f1e13804..60865304f1c 100644 --- a/src/test/run-pass/self/self-in-mut-slot-immediate-value.rs +++ b/src/test/run-pass/self/self-in-mut-slot-immediate-value.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Assert that `mut self` on an immediate value doesn't // allow mutating the original - issue #10615. diff --git a/src/test/run-pass/self/self-in-typedefs.rs b/src/test/run-pass/self/self-in-typedefs.rs index 92eccb47e18..9c0906013fa 100644 --- a/src/test/run-pass/self/self-in-typedefs.rs +++ b/src/test/run-pass/self/self-in-typedefs.rs @@ -1,20 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -#![allow(unions_with_drop_fields)] -#![feature(self_in_typedefs)] #![feature(untagged_unions)] #![allow(dead_code)] +#![allow(unions_with_drop_fields)] enum A<'a, T: 'a> where diff --git a/src/test/run-pass/self/self-re-assign.rs b/src/test/run-pass/self/self-re-assign.rs index 982cc6675fa..a7b089ebff4 100644 --- a/src/test/run-pass/self/self-re-assign.rs +++ b/src/test/run-pass/self/self-re-assign.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Ensure assigning an owned or managed variable to itself works. In particular, // that we do not glue_drop before we glue_take (#3290). diff --git a/src/test/run-pass/self/self-shadowing-import.rs b/src/test/run-pass/self/self-shadowing-import.rs index fbf965df06b..1d60c6c2276 100644 --- a/src/test/run-pass/self/self-shadowing-import.rs +++ b/src/test/run-pass/self/self-shadowing-import.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass mod a { diff --git a/src/test/run-pass/self/self-type-param.rs b/src/test/run-pass/self/self-type-param.rs index 645d61d79c8..6deae5f2d12 100644 --- a/src/test/run-pass/self/self-type-param.rs +++ b/src/test/run-pass/self/self-type-param.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/self/string-self-append.rs b/src/test/run-pass/self/string-self-append.rs index 54729856a6a..e63dc0090cb 100644 --- a/src/test/run-pass/self/string-self-append.rs +++ b/src/test/run-pass/self/string-self-append.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub fn main() { // Make sure we properly handle repeated self-appends. diff --git a/src/test/run-pass/self/ufcs-explicit-self.rs b/src/test/run-pass/self/ufcs-explicit-self.rs index df86065904d..4e2405504f0 100644 --- a/src/test/run-pass/self/ufcs-explicit-self.rs +++ b/src/test/run-pass/self/ufcs-explicit-self.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/self/uniq-self-in-mut-slot.rs b/src/test/run-pass/self/uniq-self-in-mut-slot.rs index 46d51d48547..695f06ecdda 100644 --- a/src/test/run-pass/self/uniq-self-in-mut-slot.rs +++ b/src/test/run-pass/self/uniq-self-in-mut-slot.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/self/where-for-self.rs b/src/test/run-pass/self/where-for-self.rs index 147ab0be74a..76c592dc49b 100644 --- a/src/test/run-pass/self/where-for-self.rs +++ b/src/test/run-pass/self/where-for-self.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we can quantify lifetimes outside a constraint (i.e., including // the self type) in a where clause. diff --git a/src/test/run-pass/semistatement-in-lambda.rs b/src/test/run-pass/semistatement-in-lambda.rs index c9ab466e445..f00fbc363d4 100644 --- a/src/test/run-pass/semistatement-in-lambda.rs +++ b/src/test/run-pass/semistatement-in-lambda.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] pub fn main() { diff --git a/src/test/run-pass/sepcomp/auxiliary/sepcomp-extern-lib.rs b/src/test/run-pass/sepcomp/auxiliary/sepcomp-extern-lib.rs index 72f1f73a81b..73fb5e8f3c4 100644 --- a/src/test/run-pass/sepcomp/auxiliary/sepcomp-extern-lib.rs +++ b/src/test/run-pass/sepcomp/auxiliary/sepcomp-extern-lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub extern "C" fn foo() -> usize { 1234 diff --git a/src/test/run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs b/src/test/run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs index c57d161d8f5..64e34a56da4 100644 --- a/src/test/run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs +++ b/src/test/run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[inline] pub fn cci_fn() -> usize { 1200 diff --git a/src/test/run-pass/sepcomp/auxiliary/sepcomp_lib.rs b/src/test/run-pass/sepcomp/auxiliary/sepcomp_lib.rs index 6f48978a000..1536228c265 100644 --- a/src/test/run-pass/sepcomp/auxiliary/sepcomp_lib.rs +++ b/src/test/run-pass/sepcomp/auxiliary/sepcomp_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C codegen-units=3 --crate-type=rlib,dylib -g pub mod a { diff --git a/src/test/run-pass/sepcomp/sepcomp-cci.rs b/src/test/run-pass/sepcomp/sepcomp-cci.rs index beeece32337..f5c633d250b 100644 --- a/src/test/run-pass/sepcomp/sepcomp-cci.rs +++ b/src/test/run-pass/sepcomp/sepcomp-cci.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-bitrig // compile-flags: -C codegen-units=3 diff --git a/src/test/run-pass/sepcomp/sepcomp-extern.rs b/src/test/run-pass/sepcomp/sepcomp-extern.rs index ae392febc27..18af785c1be 100644 --- a/src/test/run-pass/sepcomp/sepcomp-extern.rs +++ b/src/test/run-pass/sepcomp/sepcomp-extern.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-bitrig // compile-flags: -C codegen-units=3 diff --git a/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs b/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs index 8241711bc12..96bcc260bdf 100644 --- a/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs +++ b/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // ignore-bitrig diff --git a/src/test/run-pass/sepcomp/sepcomp-fns.rs b/src/test/run-pass/sepcomp/sepcomp-fns.rs index 3d917cb70e3..c4ea17225b4 100644 --- a/src/test/run-pass/sepcomp/sepcomp-fns.rs +++ b/src/test/run-pass/sepcomp/sepcomp-fns.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-bitrig // compile-flags: -C codegen-units=3 diff --git a/src/test/run-pass/sepcomp/sepcomp-lib-lto.rs b/src/test/run-pass/sepcomp/sepcomp-lib-lto.rs index 03b837cdcf4..164ae79c254 100644 --- a/src/test/run-pass/sepcomp/sepcomp-lib-lto.rs +++ b/src/test/run-pass/sepcomp/sepcomp-lib-lto.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that we can use `-C lto` when linking against libraries that were // separately compiled. diff --git a/src/test/run-pass/sepcomp/sepcomp-lib.rs b/src/test/run-pass/sepcomp/sepcomp-lib.rs index 11ad12611e1..728dc078b7e 100644 --- a/src/test/run-pass/sepcomp/sepcomp-lib.rs +++ b/src/test/run-pass/sepcomp/sepcomp-lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:sepcomp_lib.rs diff --git a/src/test/run-pass/sepcomp/sepcomp-statics.rs b/src/test/run-pass/sepcomp/sepcomp-statics.rs index 8739b9f52de..e0c6b268b17 100644 --- a/src/test/run-pass/sepcomp/sepcomp-statics.rs +++ b/src/test/run-pass/sepcomp/sepcomp-statics.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // ignore-bitrig diff --git a/src/test/run-pass/sepcomp/sepcomp-unwind.rs b/src/test/run-pass/sepcomp/sepcomp-unwind.rs index 7a1642bcb29..01dbea08098 100644 --- a/src/test/run-pass/sepcomp/sepcomp-unwind.rs +++ b/src/test/run-pass/sepcomp/sepcomp-unwind.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // ignore-bitrig diff --git a/src/test/run-pass/seq-compare.rs b/src/test/run-pass/seq-compare.rs index 43612f52977..cb90e3be0ac 100644 --- a/src/test/run-pass/seq-compare.rs +++ b/src/test/run-pass/seq-compare.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - pub fn main() { assert!(("hello".to_string() < "hellr".to_string())); assert!(("hello ".to_string() > "hello".to_string())); diff --git a/src/test/run-pass/shadow.rs b/src/test/run-pass/shadow.rs index b2028927da4..03338d79da8 100644 --- a/src/test/run-pass/shadow.rs +++ b/src/test/run-pass/shadow.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] fn foo(c: Vec ) { diff --git a/src/test/run-pass/shadowed-use-visibility.rs b/src/test/run-pass/shadowed-use-visibility.rs index b54ba3d2ce7..83f9c0bedc6 100644 --- a/src/test/run-pass/shadowed-use-visibility.rs +++ b/src/test/run-pass/shadowed-use-visibility.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] mod foo { pub fn f() {} diff --git a/src/test/run-pass/shebang.rs b/src/test/run-pass/shebang.rs index a0947cd49a4..a5fbda1c1ea 100644 --- a/src/test/run-pass/shebang.rs +++ b/src/test/run-pass/shebang.rs @@ -1,12 +1,5 @@ #!/usr/bin/env rustx -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. pub fn main() { println!("Hello World"); } diff --git a/src/test/run-pass/signal-alternate-stack-cleanup.rs b/src/test/run-pass/signal-alternate-stack-cleanup.rs index ad099f82d13..3958e72040d 100644 --- a/src/test/run-pass/signal-alternate-stack-cleanup.rs +++ b/src/test/run-pass/signal-alternate-stack-cleanup.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Previously memory for alternate signal stack have been unmapped during // main thread exit while still being in use by signal handlers. This test // triggers this situation by sending signal from atexit handler. @@ -16,7 +6,7 @@ // ignore-wasm32-bare no libc // ignore-windows -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; use libc::*; diff --git a/src/test/run-pass/signal-exit-status.rs b/src/test/run-pass/signal-exit-status.rs index 76171a4cc46..9e1e55ad54d 100644 --- a/src/test/run-pass/signal-exit-status.rs +++ b/src/test/run-pass/signal-exit-status.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no processes // ignore-emscripten no processes // ignore-windows diff --git a/src/test/run-pass/sigpipe-should-be-ignored.rs b/src/test/run-pass/sigpipe-should-be-ignored.rs index c964bcb94ef..2ded71670d2 100644 --- a/src/test/run-pass/sigpipe-should-be-ignored.rs +++ b/src/test/run-pass/sigpipe-should-be-ignored.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] // Be sure that when a SIGPIPE would have been received that the entire process // doesn't die in a ball of fire, but rather it's gracefully handled. diff --git a/src/test/run-pass/simd/simd-generics.rs b/src/test/run-pass/simd/simd-generics.rs index b69b6f0a4cd..ab6caee9d7b 100644 --- a/src/test/run-pass/simd/simd-generics.rs +++ b/src/test/run-pass/simd/simd-generics.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/simd/simd-intrinsic-float-math.rs b/src/test/run-pass/simd/simd-intrinsic-float-math.rs index 216855db747..220a59535ca 100644 --- a/src/test/run-pass/simd/simd-intrinsic-float-math.rs +++ b/src/test/run-pass/simd/simd-intrinsic-float-math.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten // ignore-android diff --git a/src/test/run-pass/simd/simd-intrinsic-float-minmax.rs b/src/test/run-pass/simd/simd-intrinsic-float-minmax.rs index a146b4b2f70..350bc434935 100644 --- a/src/test/run-pass/simd/simd-intrinsic-float-minmax.rs +++ b/src/test/run-pass/simd/simd-intrinsic-float-minmax.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten // min-llvm-version 7.0 diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-arithmetic.rs b/src/test/run-pass/simd/simd-intrinsic-generic-arithmetic.rs index c1094336c29..b67c0ad1eb2 100644 --- a/src/test/run-pass/simd/simd-intrinsic-generic-arithmetic.rs +++ b/src/test/run-pass/simd/simd-intrinsic-generic-arithmetic.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-bitmask.rs b/src/test/run-pass/simd/simd-intrinsic-generic-bitmask.rs new file mode 100644 index 00000000000..b28f742a92e --- /dev/null +++ b/src/test/run-pass/simd/simd-intrinsic-generic-bitmask.rs @@ -0,0 +1,61 @@ +// run-pass +#![allow(non_camel_case_types)] + +// ignore-emscripten + +// Test that the simd_bitmask intrinsic produces correct results. + +#![feature(repr_simd, platform_intrinsics)] +#[allow(non_camel_case_types)] + +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct u32x4(pub u32, pub u32, pub u32, pub u32); + +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct u8x4(pub u8, pub u8, pub u8, pub u8); + +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct Tx4(pub T, pub T, pub T, pub T); + +extern "platform-intrinsic" { + fn simd_bitmask(x: T) -> U; +} + +fn main() { + let z = u32x4(0, 0, 0, 0); + let ez = 0_u8; + + let o = u32x4(!0, !0, !0, !0); + let eo = 0b_1111_u8; + + let m0 = u32x4(!0, 0, !0, 0); + let e0 = 0b_0000_0101_u8; + + // Check that the MSB is extracted: + let m = u8x4(0b_1000_0000, 0b_0100_0001, 0b_1100_0001, 0b_1111_1111); + let e = 0b_1101; + + // Check usize / isize + let msize: Tx4 = Tx4(usize::max_value(), 0, usize::max_value(), usize::max_value()); + + unsafe { + let r: u8 = simd_bitmask(z); + assert_eq!(r, ez); + + let r: u8 = simd_bitmask(o); + assert_eq!(r, eo); + + let r: u8 = simd_bitmask(m0); + assert_eq!(r, e0); + + let r: u8 = simd_bitmask(m); + assert_eq!(r, e); + + let r: u8 = simd_bitmask(msize); + assert_eq!(r, e); + + } +} diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-cast.rs b/src/test/run-pass/simd/simd-intrinsic-generic-cast.rs index f0fb24b5832..15f232e2c0f 100644 --- a/src/test/run-pass/simd/simd-intrinsic-generic-cast.rs +++ b/src/test/run-pass/simd/simd-intrinsic-generic-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten FIXME(#45351) hits an LLVM assert @@ -94,9 +84,9 @@ fn main() { // there are platform differences for some out of range // casts, so we just normalize such things: it's OK for // "invalid" calculations to result in nonsense answers. - // (E.g. negative float to unsigned integer goes through a + // (e.g., negative float to unsigned integer goes through a // library routine on the default i686 platforms, and the - // implementation of that routine differs on e.g. Linux + // implementation of that routine differs on e.g., Linux // vs. macOS, resulting in different answers.) if $from::is_float() { if !$to::in_range(A) { from.0 = 0 as $to; to.0 = 0 as $to; } diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-comparison.rs b/src/test/run-pass/simd/simd-intrinsic-generic-comparison.rs index 0c36d88dafd..2b593e1c9b8 100644 --- a/src/test/run-pass/simd/simd-intrinsic-generic-comparison.rs +++ b/src/test/run-pass/simd/simd-intrinsic-generic-comparison.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten FIXME(#45351) hits an LLVM assert diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-elements.rs b/src/test/run-pass/simd/simd-intrinsic-generic-elements.rs index 0dd1cae18f1..ea3d4b18944 100644 --- a/src/test/run-pass/simd/simd-intrinsic-generic-elements.rs +++ b/src/test/run-pass/simd/simd-intrinsic-generic-elements.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten FIXME(#45351) hits an LLVM assert diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs b/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs index 5f6a72a8e1e..805caebe5b1 100644 --- a/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs +++ b/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs @@ -1,16 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten -// min-llvm-version 6.0 // Test that the simd_{gather,scatter} intrinsics produce the correct results. diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-reduction.rs b/src/test/run-pass/simd/simd-intrinsic-generic-reduction.rs index 822101558ce..e3faa7c625c 100644 --- a/src/test/run-pass/simd/simd-intrinsic-generic-reduction.rs +++ b/src/test/run-pass/simd/simd-intrinsic-generic-reduction.rs @@ -1,17 +1,8 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] // ignore-emscripten +// ignore-aarch64 FIXME: https://github.com/rust-lang/rust/issues/54510 // Test that the simd_reduce_{op} intrinsics produce the correct results. diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-select.rs b/src/test/run-pass/simd/simd-intrinsic-generic-select.rs index 590a2990270..f79b140494e 100644 --- a/src/test/run-pass/simd/simd-intrinsic-generic-select.rs +++ b/src/test/run-pass/simd/simd-intrinsic-generic-select.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] @@ -26,6 +16,10 @@ struct i32x4(pub i32, pub i32, pub i32, pub i32); #[derive(Copy, Clone, PartialEq, Debug)] struct u32x4(pub u32, pub u32, pub u32, pub u32); +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct u32x8(u32, u32, u32, u32, u32, u32, u32, u32); + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] struct f32x4(pub f32, pub f32, pub f32, pub f32); @@ -36,6 +30,7 @@ struct b8x4(pub i8, pub i8, pub i8, pub i8); extern "platform-intrinsic" { fn simd_select(x: T, a: U, b: U) -> U; + fn simd_select_bitmask(x: T, a: U, b: U) -> U; } fn main() { @@ -146,4 +141,29 @@ fn main() { let e = b8x4(t, f, t, t); assert_eq!(r, e); } + + unsafe { + let a = u32x8(0, 1, 2, 3, 4, 5, 6, 7); + let b = u32x8(8, 9, 10, 11, 12, 13, 14, 15); + + let r: u32x8 = simd_select_bitmask(0u8, a, b); + let e = b; + assert_eq!(r, e); + + let r: u32x8 = simd_select_bitmask(0xffu8, a, b); + let e = a; + assert_eq!(r, e); + + let r: u32x8 = simd_select_bitmask(0b01010101u8, a, b); + let e = u32x8(0, 9, 2, 11, 4, 13, 6, 15); + assert_eq!(r, e); + + let r: u32x8 = simd_select_bitmask(0b10101010u8, a, b); + let e = u32x8(8, 1, 10, 3, 12, 5, 14, 7); + assert_eq!(r, e); + + let r: u32x8 = simd_select_bitmask(0b11110000u8, a, b); + let e = u32x8(8, 9, 10, 11, 4, 5, 6, 7); + assert_eq!(r, e); + } } diff --git a/src/test/run-pass/simd/simd-size-align.rs b/src/test/run-pass/simd/simd-size-align.rs index 6a1189ef2db..0a537071a3c 100644 --- a/src/test/run-pass/simd/simd-size-align.rs +++ b/src/test/run-pass/simd/simd-size-align.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(deprecated)] diff --git a/src/test/run-pass/simd/simd-target-feature-mixup.rs b/src/test/run-pass/simd/simd-target-feature-mixup.rs index 5c845031ee4..5842a7fcdf7 100644 --- a/src/test/run-pass/simd/simd-target-feature-mixup.rs +++ b/src/test/run-pass/simd/simd-target-feature-mixup.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(stable_features)] diff --git a/src/test/run-pass/simd/simd-type.rs b/src/test/run-pass/simd/simd-type.rs index 3be3960e7ce..e7b9bfe32f8 100644 --- a/src/test/run-pass/simd/simd-type.rs +++ b/src/test/run-pass/simd/simd-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/simd/simd-upgraded.rs b/src/test/run-pass/simd/simd-upgraded.rs deleted file mode 100644 index e255c4d47a7..00000000000 --- a/src/test/run-pass/simd/simd-upgraded.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] -#![allow(non_camel_case_types)] - -// Test that removed LLVM SIMD intrinsics continue -// to work via the "AutoUpgrade" mechanism. - -#![feature(cfg_target_feature, repr_simd)] -#![feature(platform_intrinsics, stmt_expr_attributes)] - -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); - -fn main() { - #[cfg(target_feature = "sse2")] unsafe { - extern "platform-intrinsic" { - fn x86_mm_min_epi16(x: i16x8, y: i16x8) -> i16x8; - } - assert_eq!(x86_mm_min_epi16(i16x8(0, 1, 2, 3, 4, 5, 6, 7), - i16x8(7, 6, 5, 4, 3, 2, 1, 0)), - i16x8(0, 1, 2, 3, 3, 2, 1, 0)); - }; -} diff --git a/src/test/run-pass/simple-infer.rs b/src/test/run-pass/simple-infer.rs index 6feb2da5fac..020c9c26512 100644 --- a/src/test/run-pass/simple-infer.rs +++ b/src/test/run-pass/simple-infer.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_mut)] diff --git a/src/test/run-pass/simple_global_asm.rs b/src/test/run-pass/simple_global_asm.rs index 2d8ac6d99f7..c6ede34b299 100644 --- a/src/test/run-pass/simple_global_asm.rs +++ b/src/test/run-pass/simple_global_asm.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(global_asm)] #![feature(naked_functions)] #![allow(dead_code)] diff --git a/src/test/run-pass/size-and-align.rs b/src/test/run-pass/size-and-align.rs index 0da63f93cc6..fb7ba68ffe7 100644 --- a/src/test/run-pass/size-and-align.rs +++ b/src/test/run-pass/size-and-align.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] enum clam { a(T, isize), b, } diff --git a/src/test/run-pass/sized-borrowed-pointer.rs b/src/test/run-pass/sized-borrowed-pointer.rs index 03425e04725..e5d55761539 100644 --- a/src/test/run-pass/sized-borrowed-pointer.rs +++ b/src/test/run-pass/sized-borrowed-pointer.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Possibly-dynamic size of typaram should be cleared at pointer boundary. diff --git a/src/test/run-pass/sized-owned-pointer.rs b/src/test/run-pass/sized-owned-pointer.rs index 5624910cee9..8dd3227ba88 100644 --- a/src/test/run-pass/sized-owned-pointer.rs +++ b/src/test/run-pass/sized-owned-pointer.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Possibly-dynamic size of typaram should be cleared at pointer boundary. diff --git a/src/test/run-pass/sleep.rs b/src/test/run-pass/sleep.rs index 9acc6ff8cf0..f0411876c8a 100644 --- a/src/test/run-pass/sleep.rs +++ b/src/test/run-pass/sleep.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten no threads support use std::thread::{self, sleep}; diff --git a/src/test/run-pass/slowparse-bstring.rs b/src/test/run-pass/slowparse-bstring.rs index b2bbd7e9103..ee6be75be22 100644 --- a/src/test/run-pass/slowparse-bstring.rs +++ b/src/test/run-pass/slowparse-bstring.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // Issue #16624 diff --git a/src/test/run-pass/slowparse-string.rs b/src/test/run-pass/slowparse-string.rs index 46b47c8537f..a2bf26f1e27 100644 --- a/src/test/run-pass/slowparse-string.rs +++ b/src/test/run-pass/slowparse-string.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // Issue #16624 diff --git a/src/test/run-pass/snake-case-no-lowercase-equivalent.rs b/src/test/run-pass/snake-case-no-lowercase-equivalent.rs deleted file mode 100644 index 49fb4176755..00000000000 --- a/src/test/run-pass/snake-case-no-lowercase-equivalent.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(dead_code)] -// pretty-expanded FIXME #23616 - -#![feature(non_ascii_idents)] -#![deny(non_snake_case)] - -// This name is neither upper nor lower case -fn 你好() {} - -fn main() {} diff --git a/src/test/run-pass/specialization/assoc-ty-graph-cycle.rs b/src/test/run-pass/specialization/assoc-ty-graph-cycle.rs index f484e98640f..54d51492ab3 100644 --- a/src/test/run-pass/specialization/assoc-ty-graph-cycle.rs +++ b/src/test/run-pass/specialization/assoc-ty-graph-cycle.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Make sure we don't crash with a cycle error during coherence. diff --git a/src/test/run-pass/specialization/auxiliary/cross_crates_defaults.rs b/src/test/run-pass/specialization/auxiliary/cross_crates_defaults.rs index b62d80b589f..5cf975b5752 100644 --- a/src/test/run-pass/specialization/auxiliary/cross_crates_defaults.rs +++ b/src/test/run-pass/specialization/auxiliary/cross_crates_defaults.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(specialization)] // First, test only use of explicit `default` items: diff --git a/src/test/run-pass/specialization/auxiliary/go_trait.rs b/src/test/run-pass/specialization/auxiliary/go_trait.rs index 044bb606b40..aa0ec22896d 100644 --- a/src/test/run-pass/specialization/auxiliary/go_trait.rs +++ b/src/test/run-pass/specialization/auxiliary/go_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] // Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. diff --git a/src/test/run-pass/specialization/auxiliary/specialization_cross_crate.rs b/src/test/run-pass/specialization/auxiliary/specialization_cross_crate.rs index 1d235336de8..8caa8524fb9 100644 --- a/src/test/run-pass/specialization/auxiliary/specialization_cross_crate.rs +++ b/src/test/run-pass/specialization/auxiliary/specialization_cross_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] pub trait Foo { diff --git a/src/test/run-pass/specialization/cross-crate-defaults.rs b/src/test/run-pass/specialization/cross-crate-defaults.rs index ee978755cbd..79cb6594397 100644 --- a/src/test/run-pass/specialization/cross-crate-defaults.rs +++ b/src/test/run-pass/specialization/cross-crate-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cross_crates_defaults.rs diff --git a/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs b/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs index 941bc55a585..15550bcce2a 100644 --- a/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs +++ b/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs b/src/test/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs index dd060f8ef40..c065593b432 100644 --- a/src/test/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs +++ b/src/test/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] // Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. diff --git a/src/test/run-pass/specialization/defaultimpl/out-of-order.rs b/src/test/run-pass/specialization/defaultimpl/out-of-order.rs index e78b0657944..f9c73a19cfa 100644 --- a/src/test/run-pass/specialization/defaultimpl/out-of-order.rs +++ b/src/test/run-pass/specialization/defaultimpl/out-of-order.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that you can list the more specific impl before the more general one. diff --git a/src/test/run-pass/specialization/defaultimpl/overlap-projection.rs b/src/test/run-pass/specialization/defaultimpl/overlap-projection.rs index 00381bb09c9..ed38bb3fc3a 100644 --- a/src/test/run-pass/specialization/defaultimpl/overlap-projection.rs +++ b/src/test/run-pass/specialization/defaultimpl/overlap-projection.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that impls on projected self types can resolve overlap, even when the diff --git a/src/test/run-pass/specialization/defaultimpl/projection.rs b/src/test/run-pass/specialization/defaultimpl/projection.rs index 9d8d99e9ca3..897a7aade2f 100644 --- a/src/test/run-pass/specialization/defaultimpl/projection.rs +++ b/src/test/run-pass/specialization/defaultimpl/projection.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs b/src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs index 440b8d748a4..2b8ca6bb1dd 100644 --- a/src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs +++ b/src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that we can combine a default impl that supplies one method with a diff --git a/src/test/run-pass/specialization/issue-50452.rs b/src/test/run-pass/specialization/issue-50452.rs index 6dec03f7781..93f081d9558 100644 --- a/src/test/run-pass/specialization/issue-50452.rs +++ b/src/test/run-pass/specialization/issue-50452.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(specialization)] diff --git a/src/test/run-pass/specialization/specialization-allowed-cross-crate.rs b/src/test/run-pass/specialization/specialization-allowed-cross-crate.rs index 941bc55a585..15550bcce2a 100644 --- a/src/test/run-pass/specialization/specialization-allowed-cross-crate.rs +++ b/src/test/run-pass/specialization/specialization-allowed-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/specialization/specialization-assoc-fns.rs b/src/test/run-pass/specialization/specialization-assoc-fns.rs index e6db162a70b..b6a7a48972a 100644 --- a/src/test/run-pass/specialization/specialization-assoc-fns.rs +++ b/src/test/run-pass/specialization/specialization-assoc-fns.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that non-method associated functions can be specialized diff --git a/src/test/run-pass/specialization/specialization-basics.rs b/src/test/run-pass/specialization/specialization-basics.rs index 7638b91c3bc..6c359e51bc2 100644 --- a/src/test/run-pass/specialization/specialization-basics.rs +++ b/src/test/run-pass/specialization/specialization-basics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(specialization)] diff --git a/src/test/run-pass/specialization/specialization-cross-crate-no-gate.rs b/src/test/run-pass/specialization/specialization-cross-crate-no-gate.rs index 0427a9a429a..f744b16de7a 100644 --- a/src/test/run-pass/specialization/specialization-cross-crate-no-gate.rs +++ b/src/test/run-pass/specialization/specialization-cross-crate-no-gate.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that specialization works even if only the upstream crate enables it diff --git a/src/test/run-pass/specialization/specialization-cross-crate.rs b/src/test/run-pass/specialization/specialization-cross-crate.rs index 9520c0c0d61..fa63c866329 100644 --- a/src/test/run-pass/specialization/specialization-cross-crate.rs +++ b/src/test/run-pass/specialization/specialization-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:specialization_cross_crate.rs diff --git a/src/test/run-pass/specialization/specialization-default-methods.rs b/src/test/run-pass/specialization/specialization-default-methods.rs index e384687f866..5d65a0457e7 100644 --- a/src/test/run-pass/specialization/specialization-default-methods.rs +++ b/src/test/run-pass/specialization/specialization-default-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(specialization)] diff --git a/src/test/run-pass/specialization/specialization-on-projection.rs b/src/test/run-pass/specialization/specialization-on-projection.rs index 01ec184d6f5..5606eaea307 100644 --- a/src/test/run-pass/specialization/specialization-on-projection.rs +++ b/src/test/run-pass/specialization/specialization-on-projection.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/specialization/specialization-out-of-order.rs b/src/test/run-pass/specialization/specialization-out-of-order.rs index 1bc2a5f9af7..94e764f7636 100644 --- a/src/test/run-pass/specialization/specialization-out-of-order.rs +++ b/src/test/run-pass/specialization/specialization-out-of-order.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that you can list the more specific impl before the more general one. diff --git a/src/test/run-pass/specialization/specialization-overlap-projection.rs b/src/test/run-pass/specialization/specialization-overlap-projection.rs index 4223f8144c1..00b83c7e7a1 100644 --- a/src/test/run-pass/specialization/specialization-overlap-projection.rs +++ b/src/test/run-pass/specialization/specialization-overlap-projection.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that impls on projected self types can resolve overlap, even when the diff --git a/src/test/run-pass/specialization/specialization-projection-alias.rs b/src/test/run-pass/specialization/specialization-projection-alias.rs index 8d5e732397f..0081ed455c9 100644 --- a/src/test/run-pass/specialization/specialization-projection-alias.rs +++ b/src/test/run-pass/specialization/specialization-projection-alias.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/specialization/specialization-projection.rs b/src/test/run-pass/specialization/specialization-projection.rs index ba9051e0061..86cdccf131e 100644 --- a/src/test/run-pass/specialization/specialization-projection.rs +++ b/src/test/run-pass/specialization/specialization-projection.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/specialization/specialization-super-traits.rs b/src/test/run-pass/specialization/specialization-super-traits.rs index d7c340f890d..a0f71d87693 100644 --- a/src/test/run-pass/specialization/specialization-super-traits.rs +++ b/src/test/run-pass/specialization/specialization-super-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(specialization)] diff --git a/src/test/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs b/src/test/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs index 1ead57e8adc..2e32e3ff02d 100644 --- a/src/test/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs +++ b/src/test/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(specialization)] diff --git a/src/test/run-pass/specialization/specialization-translate-projections-with-params.rs b/src/test/run-pass/specialization/specialization-translate-projections-with-params.rs index ba823c43557..bdc6501df44 100644 --- a/src/test/run-pass/specialization/specialization-translate-projections-with-params.rs +++ b/src/test/run-pass/specialization/specialization-translate-projections-with-params.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Ensure that provided items are inherited properly even when impls vary in diff --git a/src/test/run-pass/specialization/specialization-translate-projections.rs b/src/test/run-pass/specialization/specialization-translate-projections.rs index 796485017c5..fcccb67902e 100644 --- a/src/test/run-pass/specialization/specialization-translate-projections.rs +++ b/src/test/run-pass/specialization/specialization-translate-projections.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Ensure that provided items are inherited properly even when impls vary in diff --git a/src/test/run-pass/sse2.rs b/src/test/run-pass/sse2.rs index 041286fe656..c58bf4520c1 100644 --- a/src/test/run-pass/sse2.rs +++ b/src/test/run-pass/sse2.rs @@ -1,18 +1,6 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(stable_features)] -// min-llvm-version 6.0 -// ^ needs MCSubtargetInfo::checkFeatures() // ignore-cloudabi no std::env +#![allow(stable_features)] #![feature(cfg_target_feature)] use std::env; diff --git a/src/test/run-pass/stable-addr-of.rs b/src/test/run-pass/stable-addr-of.rs index 5ffceb2c6a8..2a256bbfa39 100644 --- a/src/test/run-pass/stable-addr-of.rs +++ b/src/test/run-pass/stable-addr-of.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #2040 diff --git a/src/test/run-pass/stack-probes-lto.rs b/src/test/run-pass/stack-probes-lto.rs index 9bf867140a9..5dcb7b91df6 100644 --- a/src/test/run-pass/stack-probes-lto.rs +++ b/src/test/run-pass/stack-probes-lto.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-arm // ignore-aarch64 // ignore-mips diff --git a/src/test/run-pass/stack-probes.rs b/src/test/run-pass/stack-probes.rs index 1334ab8dc63..ff264421cfb 100644 --- a/src/test/run-pass/stack-probes.rs +++ b/src/test/run-pass/stack-probes.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-arm // ignore-aarch64 // ignore-mips diff --git a/src/test/run-pass/statics/auxiliary/static-function-pointer-aux.rs b/src/test/run-pass/statics/auxiliary/static-function-pointer-aux.rs index 2ccdb4e0864..4dfc25764a4 100644 --- a/src/test/run-pass/statics/auxiliary/static-function-pointer-aux.rs +++ b/src/test/run-pass/statics/auxiliary/static-function-pointer-aux.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub fn f(x: isize) -> isize { -x } pub static F: fn(isize) -> isize = f; diff --git a/src/test/run-pass/statics/auxiliary/static-methods-crate.rs b/src/test/run-pass/statics/auxiliary/static-methods-crate.rs index b8fd59bf703..7ff3bc0dd2a 100644 --- a/src/test/run-pass/statics/auxiliary/static-methods-crate.rs +++ b/src/test/run-pass/statics/auxiliary/static-methods-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="static_methods_crate"] #![crate_type = "lib"] diff --git a/src/test/run-pass/statics/auxiliary/static_fn_inline_xc_aux.rs b/src/test/run-pass/statics/auxiliary/static_fn_inline_xc_aux.rs index 2193e12bceb..8d0f7f61ced 100644 --- a/src/test/run-pass/statics/auxiliary/static_fn_inline_xc_aux.rs +++ b/src/test/run-pass/statics/auxiliary/static_fn_inline_xc_aux.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub mod num { pub trait Num2 { fn from_int2(n: isize) -> Self; diff --git a/src/test/run-pass/statics/auxiliary/static_fn_trait_xc_aux.rs b/src/test/run-pass/statics/auxiliary/static_fn_trait_xc_aux.rs index 44e875fbe3c..b8aed2c5f54 100644 --- a/src/test/run-pass/statics/auxiliary/static_fn_trait_xc_aux.rs +++ b/src/test/run-pass/statics/auxiliary/static_fn_trait_xc_aux.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod num { pub trait Num2 { fn from_int2(n: isize) -> Self; diff --git a/src/test/run-pass/statics/auxiliary/static_mut_xc.rs b/src/test/run-pass/statics/auxiliary/static_mut_xc.rs index 9d677e3dc46..264a2243adc 100644 --- a/src/test/run-pass/statics/auxiliary/static_mut_xc.rs +++ b/src/test/run-pass/statics/auxiliary/static_mut_xc.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub static mut a: isize = 3; diff --git a/src/test/run-pass/statics/static-fn-inline-xc.rs b/src/test/run-pass/statics/static-fn-inline-xc.rs index a30c3dba3c3..a400b9c8d56 100644 --- a/src/test/run-pass/statics/static-fn-inline-xc.rs +++ b/src/test/run-pass/statics/static-fn-inline-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:static_fn_inline_xc_aux.rs diff --git a/src/test/run-pass/statics/static-fn-trait-xc.rs b/src/test/run-pass/statics/static-fn-trait-xc.rs index da6108c7852..1d3126128c9 100644 --- a/src/test/run-pass/statics/static-fn-trait-xc.rs +++ b/src/test/run-pass/statics/static-fn-trait-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:static_fn_trait_xc_aux.rs diff --git a/src/test/run-pass/statics/static-function-pointer-xc.rs b/src/test/run-pass/statics/static-function-pointer-xc.rs index 19231ca5134..2d063a751ca 100644 --- a/src/test/run-pass/statics/static-function-pointer-xc.rs +++ b/src/test/run-pass/statics/static-function-pointer-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:static-function-pointer-aux.rs diff --git a/src/test/run-pass/statics/static-function-pointer.rs b/src/test/run-pass/statics/static-function-pointer.rs index e923ee7308e..6c52dfecdec 100644 --- a/src/test/run-pass/statics/static-function-pointer.rs +++ b/src/test/run-pass/statics/static-function-pointer.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass fn f(x: isize) -> isize { x } diff --git a/src/test/run-pass/statics/static-impl.rs b/src/test/run-pass/statics/static-impl.rs index b1cbd5de0b9..e7bdb38ee62 100644 --- a/src/test/run-pass/statics/static-impl.rs +++ b/src/test/run-pass/statics/static-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs b/src/test/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs index 2c5b514df6e..cd3ccfee06f 100644 --- a/src/test/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs +++ b/src/test/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/statics/static-method-xcrate.rs b/src/test/run-pass/statics/static-method-xcrate.rs index f9bae7f3a3b..1d1cb381095 100644 --- a/src/test/run-pass/statics/static-method-xcrate.rs +++ b/src/test/run-pass/statics/static-method-xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:static-methods-crate.rs diff --git a/src/test/run-pass/statics/static-methods-in-traits.rs b/src/test/run-pass/statics/static-methods-in-traits.rs index cdf2168f7dc..ff76d4e4a20 100644 --- a/src/test/run-pass/statics/static-methods-in-traits.rs +++ b/src/test/run-pass/statics/static-methods-in-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass mod a { diff --git a/src/test/run-pass/statics/static-methods-in-traits2.rs b/src/test/run-pass/statics/static-methods-in-traits2.rs index 7e50cc58618..2c43ff6a788 100644 --- a/src/test/run-pass/statics/static-methods-in-traits2.rs +++ b/src/test/run-pass/statics/static-methods-in-traits2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/statics/static-mut-foreign.rs b/src/test/run-pass/statics/static-mut-foreign.rs index d9e43ddea71..5d6fa416b98 100644 --- a/src/test/run-pass/statics/static-mut-foreign.rs +++ b/src/test/run-pass/statics/static-mut-foreign.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Constants (static variables) can be used to match in patterns, but mutable // statics cannot. This ensures that there's some form of error if this is @@ -15,7 +5,7 @@ // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/statics/static-mut-xc.rs b/src/test/run-pass/statics/static-mut-xc.rs index 1e8f5f34ea6..1d172d26a59 100644 --- a/src/test/run-pass/statics/static-mut-xc.rs +++ b/src/test/run-pass/statics/static-mut-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/statics/static-recursive.rs b/src/test/run-pass/statics/static-recursive.rs index 606604e5f6f..95dadc81f81 100644 --- a/src/test/run-pass/statics/static-recursive.rs +++ b/src/test/run-pass/statics/static-recursive.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; diff --git a/src/test/run-pass/stdio-is-blocking.rs b/src/test/run-pass/stdio-is-blocking.rs index 8d4ee146284..281c6a17aa9 100644 --- a/src/test/run-pass/stdio-is-blocking.rs +++ b/src/test/run-pass/stdio-is-blocking.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/str-concat.rs b/src/test/run-pass/str-concat.rs index ad0d2f11abd..a0392f479c8 100644 --- a/src/test/run-pass/str-concat.rs +++ b/src/test/run-pass/str-concat.rs @@ -1,16 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - pub fn main() { let a: String = "hello".to_string(); let b: String = "world".to_string(); diff --git a/src/test/run-pass/str-multiline.rs b/src/test/run-pass/str-multiline.rs index 94e14290498..faf992fabf1 100644 --- a/src/test/run-pass/str-multiline.rs +++ b/src/test/run-pass/str-multiline.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub fn main() { let a: String = "this \ is a test".to_string(); diff --git a/src/test/run-pass/string-box-error.rs b/src/test/run-pass/string-box-error.rs index a80d9a05935..debbe665a89 100644 --- a/src/test/run-pass/string-box-error.rs +++ b/src/test/run-pass/string-box-error.rs @@ -1,14 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Ensure that both `Box` and `Box` can be obtained from `String`. +// Ensure that both `Box` and `Box` can be +// obtained from `String`. use std::error::Error; diff --git a/src/test/run-pass/string-escapes.rs b/src/test/run-pass/string-escapes.rs index acd9e0675ae..6013173f313 100644 --- a/src/test/run-pass/string-escapes.rs +++ b/src/test/run-pass/string-escapes.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn main() { let x = "\\\\\ "; diff --git a/src/test/run-pass/structs-enums/align-struct.rs b/src/test/run-pass/structs-enums/align-struct.rs index a0d05a6d0d2..27ef990aa90 100644 --- a/src/test/run-pass/structs-enums/align-struct.rs +++ b/src/test/run-pass/structs-enums/align-struct.rs @@ -1,17 +1,6 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![feature(box_syntax)] -#![feature(repr_packed)] use std::mem; diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class.rs index 08a13fd8bcc..de2945d7460 100644 --- a/src/test/run-pass/structs-enums/auxiliary/cci_class.rs +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod kitties { pub struct cat { meows : usize, diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class_2.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class_2.rs index 7d147832f09..c3de3150e69 100644 --- a/src/test/run-pass/structs-enums/auxiliary/cci_class_2.rs +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class_2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod kitties { pub struct cat { meows : usize, diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class_3.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class_3.rs index ec1bf108dcb..fb7fad0b5a2 100644 --- a/src/test/run-pass/structs-enums/auxiliary/cci_class_3.rs +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class_3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod kitties { pub struct cat { meows : usize, diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class_4.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class_4.rs index 300cc31632e..85aa3bc8c0d 100644 --- a/src/test/run-pass/structs-enums/auxiliary/cci_class_4.rs +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class_4.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod kitties { pub struct cat { meows : usize, diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class_6.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class_6.rs index c902a6c7dca..35f93d0c6c8 100644 --- a/src/test/run-pass/structs-enums/auxiliary/cci_class_6.rs +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class_6.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod kitties { pub struct cat { diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class_cast.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class_cast.rs index f54a39d61ef..dfc3c56ddee 100644 --- a/src/test/run-pass/structs-enums/auxiliary/cci_class_cast.rs +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class_cast.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod kitty { use std::fmt; diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class_trait.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class_trait.rs index 7ca3d7c4ac9..2d02b591c55 100644 --- a/src/test/run-pass/structs-enums/auxiliary/cci_class_trait.rs +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod animals { pub trait noisy { fn speak(&mut self); diff --git a/src/test/run-pass/structs-enums/auxiliary/empty-struct.rs b/src/test/run-pass/structs-enums/auxiliary/empty-struct.rs index 734e57a774d..93275e7143e 100644 --- a/src/test/run-pass/structs-enums/auxiliary/empty-struct.rs +++ b/src/test/run-pass/structs-enums/auxiliary/empty-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct XEmpty1 {} pub struct XEmpty2; pub struct XEmpty7(); diff --git a/src/test/run-pass/structs-enums/auxiliary/namespaced_enum_emulate_flat.rs b/src/test/run-pass/structs-enums/auxiliary/namespaced_enum_emulate_flat.rs index b7bde4a74a5..55e6b34aca7 100644 --- a/src/test/run-pass/structs-enums/auxiliary/namespaced_enum_emulate_flat.rs +++ b/src/test/run-pass/structs-enums/auxiliary/namespaced_enum_emulate_flat.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use Foo::*; pub enum Foo { diff --git a/src/test/run-pass/structs-enums/auxiliary/namespaced_enums.rs b/src/test/run-pass/structs-enums/auxiliary/namespaced_enums.rs index 3bf39b788db..d3548c76cf2 100644 --- a/src/test/run-pass/structs-enums/auxiliary/namespaced_enums.rs +++ b/src/test/run-pass/structs-enums/auxiliary/namespaced_enums.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum Foo { A, B(isize), diff --git a/src/test/run-pass/structs-enums/auxiliary/newtype_struct_xc.rs b/src/test/run-pass/structs-enums/auxiliary/newtype_struct_xc.rs index be3414b7ad2..9d1e0742e3c 100644 --- a/src/test/run-pass/structs-enums/auxiliary/newtype_struct_xc.rs +++ b/src/test/run-pass/structs-enums/auxiliary/newtype_struct_xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub struct Au(pub isize); diff --git a/src/test/run-pass/structs-enums/auxiliary/struct_destructuring_cross_crate.rs b/src/test/run-pass/structs-enums/auxiliary/struct_destructuring_cross_crate.rs index 26941b726d4..3665ae7e8d3 100644 --- a/src/test/run-pass/structs-enums/auxiliary/struct_destructuring_cross_crate.rs +++ b/src/test/run-pass/structs-enums/auxiliary/struct_destructuring_cross_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub struct S { diff --git a/src/test/run-pass/structs-enums/auxiliary/struct_variant_xc_aux.rs b/src/test/run-pass/structs-enums/auxiliary/struct_variant_xc_aux.rs index 201f028b6b6..e919df611cf 100644 --- a/src/test/run-pass/structs-enums/auxiliary/struct_variant_xc_aux.rs +++ b/src/test/run-pass/structs-enums/auxiliary/struct_variant_xc_aux.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="struct_variant_xc_aux"] #![crate_type = "lib"] diff --git a/src/test/run-pass/structs-enums/auxiliary/xcrate_struct_aliases.rs b/src/test/run-pass/structs-enums/auxiliary/xcrate_struct_aliases.rs index 334f7829bd1..bc8879aa37e 100644 --- a/src/test/run-pass/structs-enums/auxiliary/xcrate_struct_aliases.rs +++ b/src/test/run-pass/structs-enums/auxiliary/xcrate_struct_aliases.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct S { pub x: isize, pub y: isize, diff --git a/src/test/run-pass/structs-enums/borrow-tuple-fields.rs b/src/test/run-pass/structs-enums/borrow-tuple-fields.rs index c7f9c481579..b1d8f91646b 100644 --- a/src/test/run-pass/structs-enums/borrow-tuple-fields.rs +++ b/src/test/run-pass/structs-enums/borrow-tuple-fields.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo(isize, isize); diff --git a/src/test/run-pass/structs-enums/class-attributes-1.rs b/src/test/run-pass/structs-enums/class-attributes-1.rs index bdacb40911b..11ea29ece8a 100644 --- a/src/test/run-pass/structs-enums/class-attributes-1.rs +++ b/src/test/run-pass/structs-enums/class-attributes-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_attributes)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-attributes-2.rs b/src/test/run-pass/structs-enums/class-attributes-2.rs index d17601d44ad..d6cf63e62fe 100644 --- a/src/test/run-pass/structs-enums/class-attributes-2.rs +++ b/src/test/run-pass/structs-enums/class-attributes-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_attributes)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs index c28244a9f90..cb4a67f609d 100644 --- a/src/test/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs +++ b/src/test/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_class_cast.rs diff --git a/src/test/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs index e2efc146c4b..5ce6538fcb3 100644 --- a/src/test/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs +++ b/src/test/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-cast-to-trait.rs b/src/test/run-pass/structs-enums/class-cast-to-trait.rs index 517dad17d1f..7fa60da6e57 100644 --- a/src/test/run-pass/structs-enums/class-cast-to-trait.rs +++ b/src/test/run-pass/structs-enums/class-cast-to-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_mut)] diff --git a/src/test/run-pass/structs-enums/class-dtor.rs b/src/test/run-pass/structs-enums/class-dtor.rs index bd5fd86cefc..ee1cac03c81 100644 --- a/src/test/run-pass/structs-enums/class-dtor.rs +++ b/src/test/run-pass/structs-enums/class-dtor.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-exports.rs b/src/test/run-pass/structs-enums/class-exports.rs index 6f9c609fa45..ee20887cbfb 100644 --- a/src/test/run-pass/structs-enums/class-exports.rs +++ b/src/test/run-pass/structs-enums/class-exports.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-impl-very-parameterized-trait.rs b/src/test/run-pass/structs-enums/class-impl-very-parameterized-trait.rs index deb31c9e053..5e7830296da 100644 --- a/src/test/run-pass/structs-enums/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/structs-enums/class-impl-very-parameterized-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-implement-trait-cross-crate.rs b/src/test/run-pass/structs-enums/class-implement-trait-cross-crate.rs index 3b09ebec256..31b79517566 100644 --- a/src/test/run-pass/structs-enums/class-implement-trait-cross-crate.rs +++ b/src/test/run-pass/structs-enums/class-implement-trait-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-implement-traits.rs b/src/test/run-pass/structs-enums/class-implement-traits.rs index e582940c1e4..c9e98e21b9e 100644 --- a/src/test/run-pass/structs-enums/class-implement-traits.rs +++ b/src/test/run-pass/structs-enums/class-implement-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-method-cross-crate.rs b/src/test/run-pass/structs-enums/class-method-cross-crate.rs index 010f735beee..519f0685fdf 100644 --- a/src/test/run-pass/structs-enums/class-method-cross-crate.rs +++ b/src/test/run-pass/structs-enums/class-method-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_class_2.rs diff --git a/src/test/run-pass/structs-enums/class-methods-cross-crate.rs b/src/test/run-pass/structs-enums/class-methods-cross-crate.rs index ca4a783b70a..c342af31351 100644 --- a/src/test/run-pass/structs-enums/class-methods-cross-crate.rs +++ b/src/test/run-pass/structs-enums/class-methods-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_class_3.rs diff --git a/src/test/run-pass/structs-enums/class-methods.rs b/src/test/run-pass/structs-enums/class-methods.rs index 8cc6025dc43..83f4a5fd39e 100644 --- a/src/test/run-pass/structs-enums/class-methods.rs +++ b/src/test/run-pass/structs-enums/class-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-poly-methods-cross-crate.rs b/src/test/run-pass/structs-enums/class-poly-methods-cross-crate.rs index 7ee98125148..0307ba78d02 100644 --- a/src/test/run-pass/structs-enums/class-poly-methods-cross-crate.rs +++ b/src/test/run-pass/structs-enums/class-poly-methods-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_class_6.rs diff --git a/src/test/run-pass/structs-enums/class-poly-methods.rs b/src/test/run-pass/structs-enums/class-poly-methods.rs index 693a6e829b6..da2870b58a4 100644 --- a/src/test/run-pass/structs-enums/class-poly-methods.rs +++ b/src/test/run-pass/structs-enums/class-poly-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-separate-impl.rs b/src/test/run-pass/structs-enums/class-separate-impl.rs index c482992f7bd..2b10a46e8e2 100644 --- a/src/test/run-pass/structs-enums/class-separate-impl.rs +++ b/src/test/run-pass/structs-enums/class-separate-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-str-field.rs b/src/test/run-pass/structs-enums/class-str-field.rs index 57ec91c9d33..a3dc66aab12 100644 --- a/src/test/run-pass/structs-enums/class-str-field.rs +++ b/src/test/run-pass/structs-enums/class-str-field.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-typarams.rs b/src/test/run-pass/structs-enums/class-typarams.rs index 3d9dafc6f73..4b2d4b12ec9 100644 --- a/src/test/run-pass/structs-enums/class-typarams.rs +++ b/src/test/run-pass/structs-enums/class-typarams.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/classes-cross-crate.rs b/src/test/run-pass/structs-enums/classes-cross-crate.rs index c9cc609e8a1..ca362c7a7d8 100644 --- a/src/test/run-pass/structs-enums/classes-cross-crate.rs +++ b/src/test/run-pass/structs-enums/classes-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_class_4.rs diff --git a/src/test/run-pass/structs-enums/classes-self-referential.rs b/src/test/run-pass/structs-enums/classes-self-referential.rs index 3f0e912e2ad..27d6ebf2c2a 100644 --- a/src/test/run-pass/structs-enums/classes-self-referential.rs +++ b/src/test/run-pass/structs-enums/classes-self-referential.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/classes-simple-cross-crate.rs b/src/test/run-pass/structs-enums/classes-simple-cross-crate.rs index c90ae80036f..6ff0970c0f0 100644 --- a/src/test/run-pass/structs-enums/classes-simple-cross-crate.rs +++ b/src/test/run-pass/structs-enums/classes-simple-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:cci_class.rs diff --git a/src/test/run-pass/structs-enums/classes-simple-method.rs b/src/test/run-pass/structs-enums/classes-simple-method.rs index 48a7d58300c..f3d98337dba 100644 --- a/src/test/run-pass/structs-enums/classes-simple-method.rs +++ b/src/test/run-pass/structs-enums/classes-simple-method.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/classes-simple.rs b/src/test/run-pass/structs-enums/classes-simple.rs index c53f135c0e0..568fbb29f0d 100644 --- a/src/test/run-pass/structs-enums/classes-simple.rs +++ b/src/test/run-pass/structs-enums/classes-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/classes.rs b/src/test/run-pass/structs-enums/classes.rs index 0f9b5b1d7f4..51d84b9091d 100644 --- a/src/test/run-pass/structs-enums/classes.rs +++ b/src/test/run-pass/structs-enums/classes.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/codegen-tag-static-padding.rs b/src/test/run-pass/structs-enums/codegen-tag-static-padding.rs index 3d75786654d..8aa087c018b 100644 --- a/src/test/run-pass/structs-enums/codegen-tag-static-padding.rs +++ b/src/test/run-pass/structs-enums/codegen-tag-static-padding.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/structs-enums/compare-generic-enums.rs b/src/test/run-pass/structs-enums/compare-generic-enums.rs index 60d6cd2746b..84f953b1f8e 100644 --- a/src/test/run-pass/structs-enums/compare-generic-enums.rs +++ b/src/test/run-pass/structs-enums/compare-generic-enums.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/discrim-explicit-23030.rs b/src/test/run-pass/structs-enums/discrim-explicit-23030.rs index 73053131865..211ca7e4e8f 100644 --- a/src/test/run-pass/structs-enums/discrim-explicit-23030.rs +++ b/src/test/run-pass/structs-enums/discrim-explicit-23030.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue 23030: Workaround overflowing discriminant // with explicit assignments. diff --git a/src/test/run-pass/structs-enums/empty-struct-braces.rs b/src/test/run-pass/structs-enums/empty-struct-braces.rs index aebd1b70c3c..0663687c958 100644 --- a/src/test/run-pass/structs-enums/empty-struct-braces.rs +++ b/src/test/run-pass/structs-enums/empty-struct-braces.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/structs-enums/empty-tag.rs b/src/test/run-pass/structs-enums/empty-tag.rs index eab02fd5741..56a438200c0 100644 --- a/src/test/run-pass/structs-enums/empty-tag.rs +++ b/src/test/run-pass/structs-enums/empty-tag.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/enum-alignment.rs b/src/test/run-pass/structs-enums/enum-alignment.rs index 60bfe151b7e..108dfe2e62d 100644 --- a/src/test/run-pass/structs-enums/enum-alignment.rs +++ b/src/test/run-pass/structs-enums/enum-alignment.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(deprecated)] diff --git a/src/test/run-pass/structs-enums/enum-clike-ffi-as-int.rs b/src/test/run-pass/structs-enums/enum-clike-ffi-as-int.rs index ea63b35e59f..e2b2b43dee3 100644 --- a/src/test/run-pass/structs-enums/enum-clike-ffi-as-int.rs +++ b/src/test/run-pass/structs-enums/enum-clike-ffi-as-int.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/structs-enums/enum-discr.rs b/src/test/run-pass/structs-enums/enum-discr.rs index e1e1d6dfeec..bdd6df82d0f 100644 --- a/src/test/run-pass/structs-enums/enum-discr.rs +++ b/src/test/run-pass/structs-enums/enum-discr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/structs-enums/enum-discrim-autosizing.rs b/src/test/run-pass/structs-enums/enum-discrim-autosizing.rs index f9a375d74e9..f68fdda6053 100644 --- a/src/test/run-pass/structs-enums/enum-discrim-autosizing.rs +++ b/src/test/run-pass/structs-enums/enum-discrim-autosizing.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(overflowing_literals)] diff --git a/src/test/run-pass/structs-enums/enum-discrim-manual-sizing.rs b/src/test/run-pass/structs-enums/enum-discrim-manual-sizing.rs index 54bc6506a4b..c8b362c9917 100644 --- a/src/test/run-pass/structs-enums/enum-discrim-manual-sizing.rs +++ b/src/test/run-pass/structs-enums/enum-discrim-manual-sizing.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/structs-enums/enum-discrim-range-overflow.rs b/src/test/run-pass/structs-enums/enum-discrim-range-overflow.rs index 731cb003776..9c4c61e684b 100644 --- a/src/test/run-pass/structs-enums/enum-discrim-range-overflow.rs +++ b/src/test/run-pass/structs-enums/enum-discrim-range-overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(overflowing_literals)] diff --git a/src/test/run-pass/structs-enums/enum-discrim-width-stuff.rs b/src/test/run-pass/structs-enums/enum-discrim-width-stuff.rs index 6b38de6f6b3..f278ae2d0a8 100644 --- a/src/test/run-pass/structs-enums/enum-discrim-width-stuff.rs +++ b/src/test/run-pass/structs-enums/enum-discrim-width-stuff.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(overflowing_literals)] #![allow(dead_code)] diff --git a/src/test/run-pass/structs-enums/enum-disr-val-pretty.rs b/src/test/run-pass/structs-enums/enum-disr-val-pretty.rs index 5c02bf28884..ef1333e0eeb 100644 --- a/src/test/run-pass/structs-enums/enum-disr-val-pretty.rs +++ b/src/test/run-pass/structs-enums/enum-disr-val-pretty.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] // pp-exact diff --git a/src/test/run-pass/structs-enums/enum-export-inheritance.rs b/src/test/run-pass/structs-enums/enum-export-inheritance.rs index d68073711b0..6a36a004a7c 100644 --- a/src/test/run-pass/structs-enums/enum-export-inheritance.rs +++ b/src/test/run-pass/structs-enums/enum-export-inheritance.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/enum-layout-optimization.rs b/src/test/run-pass/structs-enums/enum-layout-optimization.rs index fcc5cc07996..05d297906c3 100644 --- a/src/test/run-pass/structs-enums/enum-layout-optimization.rs +++ b/src/test/run-pass/structs-enums/enum-layout-optimization.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we will do various size optimizations to enum layout, but // *not* if `#[repr(u8)]` or `#[repr(C)]` is passed. See also #40029. diff --git a/src/test/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs b/src/test/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs index 14eac687ecf..c971f567d95 100644 --- a/src/test/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs +++ b/src/test/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This test deserializes an enum in-place by transmuting to a union that // should have the same layout, and manipulating the tag and payloads @@ -20,11 +10,12 @@ use std::mem; #[repr(C, u8)] #[derive(Copy, Clone, Eq, PartialEq, Debug)] enum MyEnum { - A(u32), // Single primitive value - B { x: u8, y: i16 }, // Composite, and the offset of `y` depends on tag being internal - C, // Empty - D(Option), // Contains an enum - E(Duration), // Contains a struct + A(u32), // Single primitive value + B { x: u8, y: i16, z: u8 }, // Composite, and the offsets of `y` and `z` + // depend on tag being internal + C, // Empty + D(Option), // Contains an enum + E(Duration), // Contains a struct } #[repr(C)] @@ -44,14 +35,14 @@ union MyEnumPayload { #[repr(u8)] #[derive(Copy, Clone)] enum MyEnumTag { A, B, C, D, E } #[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantA(u32); -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB {x: u8, y: i16 } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB {x: u8, y: i16, z: u8 } #[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantD(Option); #[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantE(Duration); fn main() { let result: Vec> = vec![ Ok(MyEnum::A(17)), - Ok(MyEnum::B { x: 206, y: 1145 }), + Ok(MyEnum::B { x: 206, y: 1145, z: 78 }), Ok(MyEnum::C), Err(()), Ok(MyEnum::D(Some(407))), @@ -63,7 +54,7 @@ fn main() { // Binary serialized version of the above (little-endian) let input: Vec = vec![ 0, 17, 0, 0, 0, - 1, 206, 121, 4, + 1, 206, 121, 4, 78, 2, 8, /* invalid tag value */ 3, 0, 151, 1, 0, 0, @@ -112,6 +103,7 @@ fn parse_my_enum<'a>(dest: &'a mut MyEnum, buf: &mut &[u8]) -> Result<(), ()> { MyEnumTag::B => { dest.payload.B.x = read_u8(buf)?; dest.payload.B.y = read_u16_le(buf)? as i16; + dest.payload.B.z = read_u8(buf)?; } MyEnumTag::C => { /* do nothing */ diff --git a/src/test/run-pass/structs-enums/enum-non-c-like-repr-c.rs b/src/test/run-pass/structs-enums/enum-non-c-like-repr-c.rs index 80c4339af9d..57ccf114509 100644 --- a/src/test/run-pass/structs-enums/enum-non-c-like-repr-c.rs +++ b/src/test/run-pass/structs-enums/enum-non-c-like-repr-c.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This test deserializes an enum in-place by transmuting to a union that // should have the same layout, and manipulating the tag and payloads @@ -20,11 +10,12 @@ use std::mem; #[repr(C)] #[derive(Copy, Clone, Eq, PartialEq, Debug)] enum MyEnum { - A(u32), // Single primitive value - B { x: u8, y: i16 }, // Composite, and the offset of `y` depends on tag being internal - C, // Empty - D(Option), // Contains an enum - E(Duration), // Contains a struct + A(u32), // Single primitive value + B { x: u8, y: i16, z: u8 }, // Composite, and the offset of `y` and `z` + // depend on tag being internal + C, // Empty + D(Option), // Contains an enum + E(Duration), // Contains a struct } #[repr(C)] @@ -44,14 +35,14 @@ union MyEnumPayload { #[repr(C)] #[derive(Copy, Clone)] enum MyEnumTag { A, B, C, D, E } #[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantA(u32); -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB {x: u8, y: i16 } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB {x: u8, y: i16, z: u8 } #[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantD(Option); #[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantE(Duration); fn main() { let result: Vec> = vec![ Ok(MyEnum::A(17)), - Ok(MyEnum::B { x: 206, y: 1145 }), + Ok(MyEnum::B { x: 206, y: 1145, z: 78 }), Ok(MyEnum::C), Err(()), Ok(MyEnum::D(Some(407))), @@ -63,7 +54,7 @@ fn main() { // Binary serialized version of the above (little-endian) let input: Vec = vec![ 0, 17, 0, 0, 0, - 1, 206, 121, 4, + 1, 206, 121, 4, 78, 2, 8, /* invalid tag value */ 3, 0, 151, 1, 0, 0, @@ -112,6 +103,7 @@ fn parse_my_enum<'a>(dest: &'a mut MyEnum, buf: &mut &[u8]) -> Result<(), ()> { MyEnumTag::B => { dest.payload.B.x = read_u8(buf)?; dest.payload.B.y = read_u16_le(buf)? as i16; + dest.payload.B.z = read_u8(buf)?; } MyEnumTag::C => { /* do nothing */ diff --git a/src/test/run-pass/structs-enums/enum-non-c-like-repr-int.rs b/src/test/run-pass/structs-enums/enum-non-c-like-repr-int.rs index 4c1fe8db1cd..d297c895da5 100644 --- a/src/test/run-pass/structs-enums/enum-non-c-like-repr-int.rs +++ b/src/test/run-pass/structs-enums/enum-non-c-like-repr-int.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This test deserializes an enum in-place by transmuting to a union that // should have the same layout, and manipulating the tag and payloads @@ -20,11 +10,12 @@ use std::mem; #[repr(u8)] #[derive(Copy, Clone, Eq, PartialEq, Debug)] enum MyEnum { - A(u32), // Single primitive value - B { x: u8, y: i16 }, // Composite, and the offset of `y` depends on tag being internal - C, // Empty - D(Option), // Contains an enum - E(Duration), // Contains a struct + A(u32), // Single primitive value + B { x: u8, y: i16, z: u8 }, // Composite, and the offset of `y` and `z` + // depend on tag being internal + C, // Empty + D(Option), // Contains an enum + E(Duration), // Contains a struct } #[allow(non_snake_case)] @@ -39,7 +30,7 @@ union MyEnumRepr { #[repr(u8)] #[derive(Copy, Clone)] enum MyEnumTag { A, B, C, D, E } #[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantA(MyEnumTag, u32); -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB { tag: MyEnumTag, x: u8, y: i16 } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB { tag: MyEnumTag, x: u8, y: i16, z: u8 } #[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantC(MyEnumTag); #[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantD(MyEnumTag, Option); #[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantE(MyEnumTag, Duration); @@ -47,7 +38,7 @@ union MyEnumRepr { fn main() { let result: Vec> = vec![ Ok(MyEnum::A(17)), - Ok(MyEnum::B { x: 206, y: 1145 }), + Ok(MyEnum::B { x: 206, y: 1145, z: 78 }), Ok(MyEnum::C), Err(()), Ok(MyEnum::D(Some(407))), @@ -59,7 +50,7 @@ fn main() { // Binary serialized version of the above (little-endian) let input: Vec = vec![ 0, 17, 0, 0, 0, - 1, 206, 121, 4, + 1, 206, 121, 4, 78, 2, 8, /* invalid tag value */ 3, 0, 151, 1, 0, 0, @@ -108,6 +99,7 @@ fn parse_my_enum<'a>(dest: &'a mut MyEnum, buf: &mut &[u8]) -> Result<(), ()> { MyEnumTag::B => { dest.B.x = read_u8(buf)?; dest.B.y = read_u16_le(buf)? as i16; + dest.B.z = read_u8(buf)?; } MyEnumTag::C => { /* do nothing */ diff --git a/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs b/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs index f5f90c62b88..5e3b5942a82 100644 --- a/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs +++ b/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem::size_of; use std::num::NonZeroUsize; diff --git a/src/test/run-pass/structs-enums/enum-nullable-const-null-with-fields.rs b/src/test/run-pass/structs-enums/enum-nullable-const-null-with-fields.rs index 21d48112841..ae267e7988e 100644 --- a/src/test/run-pass/structs-enums/enum-nullable-const-null-with-fields.rs +++ b/src/test/run-pass/structs-enums/enum-nullable-const-null-with-fields.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::result::Result; diff --git a/src/test/run-pass/structs-enums/enum-nullable-simplifycfg-misopt.rs b/src/test/run-pass/structs-enums/enum-nullable-simplifycfg-misopt.rs index 431d105f01f..77419e1132d 100644 --- a/src/test/run-pass/structs-enums/enum-nullable-simplifycfg-misopt.rs +++ b/src/test/run-pass/structs-enums/enum-nullable-simplifycfg-misopt.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/structs-enums/enum-univariant-repr.rs b/src/test/run-pass/structs-enums/enum-univariant-repr.rs index 7f78da64b67..1e0f6788778 100644 --- a/src/test/run-pass/structs-enums/enum-univariant-repr.rs +++ b/src/test/run-pass/structs-enums/enum-univariant-repr.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem; diff --git a/src/test/run-pass/structs-enums/enum-variants.rs b/src/test/run-pass/structs-enums/enum-variants.rs index 4e9b51fdd0c..9ac5aae726a 100644 --- a/src/test/run-pass/structs-enums/enum-variants.rs +++ b/src/test/run-pass/structs-enums/enum-variants.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_assignments)] diff --git a/src/test/run-pass/structs-enums/enum-vec-initializer.rs b/src/test/run-pass/structs-enums/enum-vec-initializer.rs index 9a2abdbb706..42ee8ba971e 100644 --- a/src/test/run-pass/structs-enums/enum-vec-initializer.rs +++ b/src/test/run-pass/structs-enums/enum-vec-initializer.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/export-abstract-tag.rs b/src/test/run-pass/structs-enums/export-abstract-tag.rs index 6de6e1847fe..76ac73321d3 100644 --- a/src/test/run-pass/structs-enums/export-abstract-tag.rs +++ b/src/test/run-pass/structs-enums/export-abstract-tag.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/export-tag-variant.rs b/src/test/run-pass/structs-enums/export-tag-variant.rs index 700ad4fbe7e..52e0aba0979 100644 --- a/src/test/run-pass/structs-enums/export-tag-variant.rs +++ b/src/test/run-pass/structs-enums/export-tag-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/expr-if-struct.rs b/src/test/run-pass/structs-enums/expr-if-struct.rs index 25777fba274..e62d47c6f5d 100644 --- a/src/test/run-pass/structs-enums/expr-if-struct.rs +++ b/src/test/run-pass/structs-enums/expr-if-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/expr-match-struct.rs b/src/test/run-pass/structs-enums/expr-match-struct.rs index 7c18eff1c46..f0e8d897274 100644 --- a/src/test/run-pass/structs-enums/expr-match-struct.rs +++ b/src/test/run-pass/structs-enums/expr-match-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/field-destruction-order.rs b/src/test/run-pass/structs-enums/field-destruction-order.rs index 5b7b60ff61f..a75a742d90f 100644 --- a/src/test/run-pass/structs-enums/field-destruction-order.rs +++ b/src/test/run-pass/structs-enums/field-destruction-order.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/structs-enums/foreign-struct.rs b/src/test/run-pass/structs-enums/foreign-struct.rs index 47ad6232152..ce02c8fb5c3 100644 --- a/src/test/run-pass/structs-enums/foreign-struct.rs +++ b/src/test/run-pass/structs-enums/foreign-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/functional-struct-upd.rs b/src/test/run-pass/structs-enums/functional-struct-upd.rs index 6fe028c5145..51c6b6d7e4f 100644 --- a/src/test/run-pass/structs-enums/functional-struct-upd.rs +++ b/src/test/run-pass/structs-enums/functional-struct-upd.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Debug)] struct Foo { diff --git a/src/test/run-pass/structs-enums/ivec-tag.rs b/src/test/run-pass/structs-enums/ivec-tag.rs index b94260f9128..c39368a2bb8 100644 --- a/src/test/run-pass/structs-enums/ivec-tag.rs +++ b/src/test/run-pass/structs-enums/ivec-tag.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/structs-enums/module-qualified-struct-destructure.rs b/src/test/run-pass/structs-enums/module-qualified-struct-destructure.rs index 8334dc532e0..57be37cdf2b 100644 --- a/src/test/run-pass/structs-enums/module-qualified-struct-destructure.rs +++ b/src/test/run-pass/structs-enums/module-qualified-struct-destructure.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs index 1f57c9dd473..30cf645821d 100644 --- a/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs +++ b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs index b98772dcf79..f6c395059ed 100644 --- a/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs +++ b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs b/src/test/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs index aff4125ef17..d2ccadea007 100644 --- a/src/test/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs +++ b/src/test/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:namespaced_enums.rs diff --git a/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs b/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs index 4d0524e306d..f36ac69dc08 100644 --- a/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs +++ b/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/namespaced-enums-xcrate.rs b/src/test/run-pass/structs-enums/namespaced-enums-xcrate.rs index d107a9386c3..5e10c3ec1d0 100644 --- a/src/test/run-pass/structs-enums/namespaced-enums-xcrate.rs +++ b/src/test/run-pass/structs-enums/namespaced-enums-xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:namespaced_enums.rs diff --git a/src/test/run-pass/structs-enums/namespaced-enums.rs b/src/test/run-pass/structs-enums/namespaced-enums.rs index 79235525a53..6a2602501a5 100644 --- a/src/test/run-pass/structs-enums/namespaced-enums.rs +++ b/src/test/run-pass/structs-enums/namespaced-enums.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/nested-enum-same-names.rs b/src/test/run-pass/structs-enums/nested-enum-same-names.rs index 8a63b990030..dece3dcd54b 100644 --- a/src/test/run-pass/structs-enums/nested-enum-same-names.rs +++ b/src/test/run-pass/structs-enums/nested-enum-same-names.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/newtype-struct-drop-run.rs b/src/test/run-pass/structs-enums/newtype-struct-drop-run.rs index 2221deeb5ae..0754f318701 100644 --- a/src/test/run-pass/structs-enums/newtype-struct-drop-run.rs +++ b/src/test/run-pass/structs-enums/newtype-struct-drop-run.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Make sure the destructor is run for newtype structs. diff --git a/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs b/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs index c42958aa7e1..f73b492dfcf 100644 --- a/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs +++ b/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_unsafe)] #![allow(unused_variables)] diff --git a/src/test/run-pass/structs-enums/newtype-struct-xc-2.rs b/src/test/run-pass/structs-enums/newtype-struct-xc-2.rs index d83552b063c..40837321be2 100644 --- a/src/test/run-pass/structs-enums/newtype-struct-xc-2.rs +++ b/src/test/run-pass/structs-enums/newtype-struct-xc-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:newtype_struct_xc.rs diff --git a/src/test/run-pass/structs-enums/newtype-struct-xc.rs b/src/test/run-pass/structs-enums/newtype-struct-xc.rs index d88ddd7298c..0c6466d97fc 100644 --- a/src/test/run-pass/structs-enums/newtype-struct-xc.rs +++ b/src/test/run-pass/structs-enums/newtype-struct-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:newtype_struct_xc.rs diff --git a/src/test/run-pass/structs-enums/nonzero-enum.rs b/src/test/run-pass/structs-enums/nonzero-enum.rs index 83bc5c25de3..15b571be563 100644 --- a/src/test/run-pass/structs-enums/nonzero-enum.rs +++ b/src/test/run-pass/structs-enums/nonzero-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] use std::mem::size_of; diff --git a/src/test/run-pass/structs-enums/numeric-fields.rs b/src/test/run-pass/structs-enums/numeric-fields.rs index e311722d651..6ff3afc3870 100644 --- a/src/test/run-pass/structs-enums/numeric-fields.rs +++ b/src/test/run-pass/structs-enums/numeric-fields.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct S(u8, u16); diff --git a/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs b/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs index 86d8af174ac..0a48725cbe4 100644 --- a/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs +++ b/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that the lifetime of the enclosing `&` is used for the object // lifetime bound. diff --git a/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs b/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs index cd88f7a42d0..48ee5a2ed54 100644 --- a/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs +++ b/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that the lifetime from the enclosing `&` is "inherited" // through the `MyBox` struct. diff --git a/src/test/run-pass/structs-enums/rec-align-u32.rs b/src/test/run-pass/structs-enums/rec-align-u32.rs index c82d449391a..889294daa34 100644 --- a/src/test/run-pass/structs-enums/rec-align-u32.rs +++ b/src/test/run-pass/structs-enums/rec-align-u32.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_unsafe)] diff --git a/src/test/run-pass/structs-enums/rec-align-u64.rs b/src/test/run-pass/structs-enums/rec-align-u64.rs index 3315232ec84..d211eed131e 100644 --- a/src/test/run-pass/structs-enums/rec-align-u64.rs +++ b/src/test/run-pass/structs-enums/rec-align-u64.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_unsafe)] diff --git a/src/test/run-pass/structs-enums/rec-auto.rs b/src/test/run-pass/structs-enums/rec-auto.rs index db9a97bd036..c2ef13ede4c 100644 --- a/src/test/run-pass/structs-enums/rec-auto.rs +++ b/src/test/run-pass/structs-enums/rec-auto.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/structs-enums/rec-extend.rs b/src/test/run-pass/structs-enums/rec-extend.rs index c20ff37222c..4c91cd1850e 100644 --- a/src/test/run-pass/structs-enums/rec-extend.rs +++ b/src/test/run-pass/structs-enums/rec-extend.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/structs-enums/rec-tup.rs b/src/test/run-pass/structs-enums/rec-tup.rs index ae8819cb5b8..b85d28fdf03 100644 --- a/src/test/run-pass/structs-enums/rec-tup.rs +++ b/src/test/run-pass/structs-enums/rec-tup.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/rec.rs b/src/test/run-pass/structs-enums/rec.rs index c8e8f81e085..82c84ebd6ff 100644 --- a/src/test/run-pass/structs-enums/rec.rs +++ b/src/test/run-pass/structs-enums/rec.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Copy, Clone)] diff --git a/src/test/run-pass/structs-enums/record-pat.rs b/src/test/run-pass/structs-enums/record-pat.rs index 966749b8354..1acaf2a32c2 100644 --- a/src/test/run-pass/structs-enums/record-pat.rs +++ b/src/test/run-pass/structs-enums/record-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] #![allow(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/structs-enums/resource-in-struct.rs b/src/test/run-pass/structs-enums/resource-in-struct.rs index e8ac8ed749c..35a4b14bc3f 100644 --- a/src/test/run-pass/structs-enums/resource-in-struct.rs +++ b/src/test/run-pass/structs-enums/resource-in-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/simple-generic-tag.rs b/src/test/run-pass/structs-enums/simple-generic-tag.rs index a4ef3b0732f..dbd2834d468 100644 --- a/src/test/run-pass/structs-enums/simple-generic-tag.rs +++ b/src/test/run-pass/structs-enums/simple-generic-tag.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/simple-match-generic-tag.rs b/src/test/run-pass/structs-enums/simple-match-generic-tag.rs index 054f8ce074b..762fd49ad24 100644 --- a/src/test/run-pass/structs-enums/simple-match-generic-tag.rs +++ b/src/test/run-pass/structs-enums/simple-match-generic-tag.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/small-enum-range-edge.rs b/src/test/run-pass/structs-enums/small-enum-range-edge.rs index 5b2a3ca3caf..30612947963 100644 --- a/src/test/run-pass/structs-enums/small-enum-range-edge.rs +++ b/src/test/run-pass/structs-enums/small-enum-range-edge.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/structs-enums/small-enums-with-fields.rs b/src/test/run-pass/structs-enums/small-enums-with-fields.rs index 9e4d4395695..565ec1bd45d 100644 --- a/src/test/run-pass/structs-enums/small-enums-with-fields.rs +++ b/src/test/run-pass/structs-enums/small-enums-with-fields.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::mem::size_of; diff --git a/src/test/run-pass/structs-enums/struct-aliases-xcrate.rs b/src/test/run-pass/structs-enums/struct-aliases-xcrate.rs index 38a2ebdabc9..ffe7b22f809 100644 --- a/src/test/run-pass/structs-enums/struct-aliases-xcrate.rs +++ b/src/test/run-pass/structs-enums/struct-aliases-xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] #![allow(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/structs-enums/struct-aliases.rs b/src/test/run-pass/structs-enums/struct-aliases.rs index 610c512628c..b7aeed7bc39 100644 --- a/src/test/run-pass/structs-enums/struct-aliases.rs +++ b/src/test/run-pass/structs-enums/struct-aliases.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/structs-enums/struct-destructuring-cross-crate.rs b/src/test/run-pass/structs-enums/struct-destructuring-cross-crate.rs index cd746f986f1..19e0a0bbdd2 100644 --- a/src/test/run-pass/structs-enums/struct-destructuring-cross-crate.rs +++ b/src/test/run-pass/structs-enums/struct-destructuring-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:struct_destructuring_cross_crate.rs diff --git a/src/test/run-pass/structs-enums/struct-field-shorthand.rs b/src/test/run-pass/structs-enums/struct-field-shorthand.rs index 1f06cd889a4..ed650c68364 100644 --- a/src/test/run-pass/structs-enums/struct-field-shorthand.rs +++ b/src/test/run-pass/structs-enums/struct-field-shorthand.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo { x: i32, diff --git a/src/test/run-pass/structs-enums/struct-like-variant-construct.rs b/src/test/run-pass/structs-enums/struct-like-variant-construct.rs index 6ed6035caf0..60fc7ce394c 100644 --- a/src/test/run-pass/structs-enums/struct-like-variant-construct.rs +++ b/src/test/run-pass/structs-enums/struct-like-variant-construct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/struct-like-variant-match.rs b/src/test/run-pass/structs-enums/struct-like-variant-match.rs index 93539b45e23..ade1a697037 100644 --- a/src/test/run-pass/structs-enums/struct-like-variant-match.rs +++ b/src/test/run-pass/structs-enums/struct-like-variant-match.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/structs-enums/struct-lit-functional-no-fields.rs b/src/test/run-pass/structs-enums/struct-lit-functional-no-fields.rs index fc28c837adf..f19604e951c 100644 --- a/src/test/run-pass/structs-enums/struct-lit-functional-no-fields.rs +++ b/src/test/run-pass/structs-enums/struct-lit-functional-no-fields.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Debug,PartialEq,Clone)] struct Foo { diff --git a/src/test/run-pass/structs-enums/struct-literal-dtor.rs b/src/test/run-pass/structs-enums/struct-literal-dtor.rs index 032fcecb490..6d1b1dfb9b6 100644 --- a/src/test/run-pass/structs-enums/struct-literal-dtor.rs +++ b/src/test/run-pass/structs-enums/struct-literal-dtor.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/struct-new-as-field-name.rs b/src/test/run-pass/structs-enums/struct-new-as-field-name.rs index 8f2bcbcf620..641fc3c5867 100644 --- a/src/test/run-pass/structs-enums/struct-new-as-field-name.rs +++ b/src/test/run-pass/structs-enums/struct-new-as-field-name.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo { diff --git a/src/test/run-pass/structs-enums/struct-order-of-eval-1.rs b/src/test/run-pass/structs-enums/struct-order-of-eval-1.rs index 989da3cdd6e..f3fe9953856 100644 --- a/src/test/run-pass/structs-enums/struct-order-of-eval-1.rs +++ b/src/test/run-pass/structs-enums/struct-order-of-eval-1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/structs-enums/struct-order-of-eval-2.rs b/src/test/run-pass/structs-enums/struct-order-of-eval-2.rs index 1b0d19db591..a4e0edc97c6 100644 --- a/src/test/run-pass/structs-enums/struct-order-of-eval-2.rs +++ b/src/test/run-pass/structs-enums/struct-order-of-eval-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/structs-enums/struct-order-of-eval-3.rs b/src/test/run-pass/structs-enums/struct-order-of-eval-3.rs index 30f8a0dfe57..60887f8d05a 100644 --- a/src/test/run-pass/structs-enums/struct-order-of-eval-3.rs +++ b/src/test/run-pass/structs-enums/struct-order-of-eval-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Checks that functional-record-update order-of-eval is as expected // even when no Drop-implementations are involved. diff --git a/src/test/run-pass/structs-enums/struct-order-of-eval-4.rs b/src/test/run-pass/structs-enums/struct-order-of-eval-4.rs index 8a436890f92..547df631846 100644 --- a/src/test/run-pass/structs-enums/struct-order-of-eval-4.rs +++ b/src/test/run-pass/structs-enums/struct-order-of-eval-4.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Checks that struct-literal expression order-of-eval is as expected // even when no Drop-implementations are involved. diff --git a/src/test/run-pass/structs-enums/struct-partial-move-1.rs b/src/test/run-pass/structs-enums/struct-partial-move-1.rs index 546bd699777..c1570159388 100644 --- a/src/test/run-pass/structs-enums/struct-partial-move-1.rs +++ b/src/test/run-pass/structs-enums/struct-partial-move-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Debug)] pub struct Partial { x: T, y: T } diff --git a/src/test/run-pass/structs-enums/struct-partial-move-2.rs b/src/test/run-pass/structs-enums/struct-partial-move-2.rs index c8a9527cc96..4315e5c29f3 100644 --- a/src/test/run-pass/structs-enums/struct-partial-move-2.rs +++ b/src/test/run-pass/structs-enums/struct-partial-move-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Debug)] pub struct Partial { x: T, y: T } diff --git a/src/test/run-pass/structs-enums/struct-path-associated-type.rs b/src/test/run-pass/structs-enums/struct-path-associated-type.rs index 89fa79c85e6..2235dfe4b84 100644 --- a/src/test/run-pass/structs-enums/struct-path-associated-type.rs +++ b/src/test/run-pass/structs-enums/struct-path-associated-type.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] struct S { diff --git a/src/test/run-pass/structs-enums/struct-path-self.rs b/src/test/run-pass/structs-enums/struct-path-self.rs index 9163569f9c1..e7a59858f57 100644 --- a/src/test/run-pass/structs-enums/struct-path-self.rs +++ b/src/test/run-pass/structs-enums/struct-path-self.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::Add; diff --git a/src/test/run-pass/structs-enums/struct-pattern-matching.rs b/src/test/run-pass/structs-enums/struct-pattern-matching.rs index c6f769706a6..89361bf2455 100644 --- a/src/test/run-pass/structs-enums/struct-pattern-matching.rs +++ b/src/test/run-pass/structs-enums/struct-pattern-matching.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/structs-enums/struct-return.rs b/src/test/run-pass/structs-enums/struct-return.rs index 5f85954f6b1..5930fc4acbb 100644 --- a/src/test/run-pass/structs-enums/struct-return.rs +++ b/src/test/run-pass/structs-enums/struct-return.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // ignore-wasm32-bare no libc to test ffi with diff --git a/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs b/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs index 206ff2ad13d..7896c829a6e 100644 --- a/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs +++ b/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/struct_variant_xc.rs b/src/test/run-pass/structs-enums/struct_variant_xc.rs index 82881f6b348..9c8d1a69a3e 100644 --- a/src/test/run-pass/structs-enums/struct_variant_xc.rs +++ b/src/test/run-pass/structs-enums/struct_variant_xc.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:struct_variant_xc_aux.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/struct_variant_xc_match.rs b/src/test/run-pass/structs-enums/struct_variant_xc_match.rs index 55b3b1018e9..5358d13faa9 100644 --- a/src/test/run-pass/structs-enums/struct_variant_xc_match.rs +++ b/src/test/run-pass/structs-enums/struct_variant_xc_match.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:struct_variant_xc_aux.rs diff --git a/src/test/run-pass/structs-enums/tag-align-dyn-u64.rs b/src/test/run-pass/structs-enums/tag-align-dyn-u64.rs index 39b40695825..3f7a5e3e511 100644 --- a/src/test/run-pass/structs-enums/tag-align-dyn-u64.rs +++ b/src/test/run-pass/structs-enums/tag-align-dyn-u64.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(deprecated)] diff --git a/src/test/run-pass/structs-enums/tag-align-dyn-variants.rs b/src/test/run-pass/structs-enums/tag-align-dyn-variants.rs index f25321ef7b1..4d075b04c97 100644 --- a/src/test/run-pass/structs-enums/tag-align-dyn-variants.rs +++ b/src/test/run-pass/structs-enums/tag-align-dyn-variants.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(deprecated)] diff --git a/src/test/run-pass/structs-enums/tag-align-shape.rs b/src/test/run-pass/structs-enums/tag-align-shape.rs index 1aff17f77d4..87282ddbcca 100644 --- a/src/test/run-pass/structs-enums/tag-align-shape.rs +++ b/src/test/run-pass/structs-enums/tag-align-shape.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/tag-align-u64.rs b/src/test/run-pass/structs-enums/tag-align-u64.rs index e2f7ffe2768..684b27cd030 100644 --- a/src/test/run-pass/structs-enums/tag-align-u64.rs +++ b/src/test/run-pass/structs-enums/tag-align-u64.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(deprecated)] diff --git a/src/test/run-pass/structs-enums/tag-disr-val-shape.rs b/src/test/run-pass/structs-enums/tag-disr-val-shape.rs index 0f6197f14d5..51052626c30 100644 --- a/src/test/run-pass/structs-enums/tag-disr-val-shape.rs +++ b/src/test/run-pass/structs-enums/tag-disr-val-shape.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/tag-exports.rs b/src/test/run-pass/structs-enums/tag-exports.rs index c93183cff4d..1bcb7d35da3 100644 --- a/src/test/run-pass/structs-enums/tag-exports.rs +++ b/src/test/run-pass/structs-enums/tag-exports.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/tag-in-block.rs b/src/test/run-pass/structs-enums/tag-in-block.rs index e3a39fe2480..03d4dd9b0ab 100644 --- a/src/test/run-pass/structs-enums/tag-in-block.rs +++ b/src/test/run-pass/structs-enums/tag-in-block.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs b/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs index ca3021b2136..3f59db38310 100644 --- a/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs +++ b/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/tag-variant-disr-val.rs b/src/test/run-pass/structs-enums/tag-variant-disr-val.rs index 9f82faad158..297d85c5886 100644 --- a/src/test/run-pass/structs-enums/tag-variant-disr-val.rs +++ b/src/test/run-pass/structs-enums/tag-variant-disr-val.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/tag.rs b/src/test/run-pass/structs-enums/tag.rs index d2b0d9dac0a..5fcd64b7cd1 100644 --- a/src/test/run-pass/structs-enums/tag.rs +++ b/src/test/run-pass/structs-enums/tag.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_parens)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/tuple-struct-construct.rs b/src/test/run-pass/structs-enums/tuple-struct-construct.rs index 58bed9d6b93..972fc9dc04a 100644 --- a/src/test/run-pass/structs-enums/tuple-struct-construct.rs +++ b/src/test/run-pass/structs-enums/tuple-struct-construct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Debug)] struct Foo(isize, isize); diff --git a/src/test/run-pass/structs-enums/tuple-struct-constructor-pointer.rs b/src/test/run-pass/structs-enums/tuple-struct-constructor-pointer.rs index a4b5e41fdf5..23f06516323 100644 --- a/src/test/run-pass/structs-enums/tuple-struct-constructor-pointer.rs +++ b/src/test/run-pass/structs-enums/tuple-struct-constructor-pointer.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(PartialEq, Debug)] struct Foo(isize); diff --git a/src/test/run-pass/structs-enums/tuple-struct-destructuring.rs b/src/test/run-pass/structs-enums/tuple-struct-destructuring.rs index cf2940e796f..dff87ead033 100644 --- a/src/test/run-pass/structs-enums/tuple-struct-destructuring.rs +++ b/src/test/run-pass/structs-enums/tuple-struct-destructuring.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo(isize, isize); diff --git a/src/test/run-pass/structs-enums/tuple-struct-matching.rs b/src/test/run-pass/structs-enums/tuple-struct-matching.rs index 95ade509c0e..432be1d1f7a 100644 --- a/src/test/run-pass/structs-enums/tuple-struct-matching.rs +++ b/src/test/run-pass/structs-enums/tuple-struct-matching.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo(isize, isize); diff --git a/src/test/run-pass/structs-enums/tuple-struct-trivial.rs b/src/test/run-pass/structs-enums/tuple-struct-trivial.rs index bbf810abb9f..c8651fd29de 100644 --- a/src/test/run-pass/structs-enums/tuple-struct-trivial.rs +++ b/src/test/run-pass/structs-enums/tuple-struct-trivial.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/uninstantiable-struct.rs b/src/test/run-pass/structs-enums/uninstantiable-struct.rs index 8706333c743..b1ef525614e 100644 --- a/src/test/run-pass/structs-enums/uninstantiable-struct.rs +++ b/src/test/run-pass/structs-enums/uninstantiable-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub struct Z(&'static Z); diff --git a/src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs b/src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs index 1e1605b7be6..dfe73875215 100644 --- a/src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs +++ b/src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/structs-enums/unit-like-struct.rs b/src/test/run-pass/structs-enums/unit-like-struct.rs index 1a2a4fbbf5f..636ec992667 100644 --- a/src/test/run-pass/structs-enums/unit-like-struct.rs +++ b/src/test/run-pass/structs-enums/unit-like-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo; diff --git a/src/test/run-pass/structs-enums/variant-structs-trivial.rs b/src/test/run-pass/structs-enums/variant-structs-trivial.rs index 7aaaef94347..31fa610a69d 100644 --- a/src/test/run-pass/structs-enums/variant-structs-trivial.rs +++ b/src/test/run-pass/structs-enums/variant-structs-trivial.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structured-compare.rs b/src/test/run-pass/structured-compare.rs index 22d1eeb0e0a..56acc6bd7d4 100644 --- a/src/test/run-pass/structured-compare.rs +++ b/src/test/run-pass/structured-compare.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/super-fast-paren-parsing.rs b/src/test/run-pass/super-fast-paren-parsing.rs index 5e120bd80ee..c86f2b8f9c3 100644 --- a/src/test/run-pass/super-fast-paren-parsing.rs +++ b/src/test/run-pass/super-fast-paren-parsing.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals)] #![allow(dead_code)] // exec-env:RUST_MIN_STACK=16000000 diff --git a/src/test/run-pass/super.rs b/src/test/run-pass/super.rs index 5958565823f..e378aac8be4 100644 --- a/src/test/run-pass/super.rs +++ b/src/test/run-pass/super.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/supported-cast.rs b/src/test/run-pass/supported-cast.rs index 7f92707586b..9d875c59d87 100644 --- a/src/test/run-pass/supported-cast.rs +++ b/src/test/run-pass/supported-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let f = 1_usize as *const String; println!("{:?}", f as isize); diff --git a/src/test/run-pass/svh-add-nothing.rs b/src/test/run-pass/svh-add-nothing.rs index aca50859b6e..b673fa55e38 100644 --- a/src/test/run-pass/svh-add-nothing.rs +++ b/src/test/run-pass/svh-add-nothing.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs diff --git a/src/test/run-pass/swap-1.rs b/src/test/run-pass/swap-1.rs index 12e72aac38d..55f9c1b6fa2 100644 --- a/src/test/run-pass/swap-1.rs +++ b/src/test/run-pass/swap-1.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::mem::swap; pub fn main() { diff --git a/src/test/run-pass/swap-2.rs b/src/test/run-pass/swap-2.rs index 4601b7d7cf5..42b17ef8b78 100644 --- a/src/test/run-pass/swap-2.rs +++ b/src/test/run-pass/swap-2.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::mem::swap; pub fn main() { diff --git a/src/test/run-pass/swap-overlapping.rs b/src/test/run-pass/swap-overlapping.rs index 8fcbfce0f7a..31fd9ce7d1a 100644 --- a/src/test/run-pass/swap-overlapping.rs +++ b/src/test/run-pass/swap-overlapping.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Issue #5041 - avoid overlapping memcpy when src and dest of a swap are the same diff --git a/src/test/run-pass/tail-call-arg-leak.rs b/src/test/run-pass/tail-call-arg-leak.rs index 8842e1b8591..53ec5ea7ff7 100644 --- a/src/test/run-pass/tail-call-arg-leak.rs +++ b/src/test/run-pass/tail-call-arg-leak.rs @@ -1,16 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - // use of tail calls causes arg slot leaks, issue #160. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/tail-cps.rs b/src/test/run-pass/tail-cps.rs index b6313905923..c945f3de0ca 100644 --- a/src/test/run-pass/tail-cps.rs +++ b/src/test/run-pass/tail-cps.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn checktrue(rs: bool) -> bool { assert!((rs)); return true; } pub fn main() { let k = checktrue; evenk(42, k); oddk(45, k); } diff --git a/src/test/run-pass/tail-direct.rs b/src/test/run-pass/tail-direct.rs index 4a7a0acdfa8..47847ee6db9 100644 --- a/src/test/run-pass/tail-direct.rs +++ b/src/test/run-pass/tail-direct.rs @@ -1,17 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - - pub fn main() { assert!((even(42))); assert!((odd(45))); } fn even(n: isize) -> bool { if n == 0 { return true; } else { return odd(n - 1); } } diff --git a/src/test/run-pass/tcp-stress.rs b/src/test/run-pass/tcp-stress.rs index 30da1e523fc..c90f9024af1 100644 --- a/src/test/run-pass/tcp-stress.rs +++ b/src/test/run-pass/tcp-stress.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-android needs extra network permissions // ignore-bitrig system ulimit (Too many open files) // ignore-cloudabi no global network namespace access diff --git a/src/test/run-pass/terminate-in-initializer.rs b/src/test/run-pass/terminate-in-initializer.rs index c9133bae854..cd9d0931606 100644 --- a/src/test/run-pass/terminate-in-initializer.rs +++ b/src/test/run-pass/terminate-in-initializer.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten no threads support // Issue #787 diff --git a/src/test/run-pass/test-allow-dead-extern-static-no-warning.rs b/src/test/run-pass/test-allow-dead-extern-static-no-warning.rs index 8df32b54b85..aa95f55e88e 100644 --- a/src/test/run-pass/test-allow-dead-extern-static-no-warning.rs +++ b/src/test/run-pass/test-allow-dead-extern-static-no-warning.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test #![deny(dead_code)] diff --git a/src/test/run-pass/test-allow-fail-attr.rs b/src/test/run-pass/test-allow-fail-attr.rs index 884633df66b..0c3c2a42488 100644 --- a/src/test/run-pass/test-allow-fail-attr.rs +++ b/src/test/run-pass/test-allow-fail-attr.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare compiled with panic=abort by default // compile-flags: --test #![feature(allow_fail)] diff --git a/src/test/run-pass/test-allow-non-camel-case-variant.rs b/src/test/run-pass/test-allow-non-camel-case-variant.rs deleted file mode 100644 index c7073b3a95e..00000000000 --- a/src/test/run-pass/test-allow-non-camel-case-variant.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![deny(non_camel_case_types)] - -pub enum Foo { - #[allow(non_camel_case_types)] - bar -} - -fn main() {} diff --git a/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs b/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs index 10ad838d3cb..a9d09d0398d 100644 --- a/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs +++ b/src/test/run-pass/test-fn-signature-verification-for-explicit-return-type.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(test)] // compile-flags: --test diff --git a/src/test/run-pass/test-main-not-dead-attr.rs b/src/test/run-pass/test-main-not-dead-attr.rs index 295559b6ddb..fb596dade8f 100644 --- a/src/test/run-pass/test-main-not-dead-attr.rs +++ b/src/test/run-pass/test-main-not-dead-attr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test #![feature(main)] diff --git a/src/test/run-pass/test-main-not-dead.rs b/src/test/run-pass/test-main-not-dead.rs index 7de3ca74796..97ab2e30831 100644 --- a/src/test/run-pass/test-main-not-dead.rs +++ b/src/test/run-pass/test-main-not-dead.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test #![deny(dead_code)] diff --git a/src/test/run-pass/test-runner-hides-buried-main.rs b/src/test/run-pass/test-runner-hides-buried-main.rs index 7ba10850403..4295f8bbf4c 100644 --- a/src/test/run-pass/test-runner-hides-buried-main.rs +++ b/src/test/run-pass/test-runner-hides-buried-main.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test #![feature(main)] diff --git a/src/test/run-pass/test-runner-hides-main.rs b/src/test/run-pass/test-runner-hides-main.rs index 7b696c1f8d2..664d9153caf 100644 --- a/src/test/run-pass/test-runner-hides-main.rs +++ b/src/test/run-pass/test-runner-hides-main.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test // Building as a test runner means that a synthetic main will be run, // not ours diff --git a/src/test/run-pass/test-runner-hides-start.rs b/src/test/run-pass/test-runner-hides-start.rs index fc94b19ada1..2634df10f26 100644 --- a/src/test/run-pass/test-runner-hides-start.rs +++ b/src/test/run-pass/test-runner-hides-start.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test #![feature(start)] diff --git a/src/test/run-pass/test-should-fail-good-message.rs b/src/test/run-pass/test-should-fail-good-message.rs index 360d4952d16..d7d9c6c1edc 100644 --- a/src/test/run-pass/test-should-fail-good-message.rs +++ b/src/test/run-pass/test-should-fail-good-message.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare compiled with panic=abort by default // compile-flags: --test #[test] diff --git a/src/test/run-pass/test-vs-cfg-test.rs b/src/test/run-pass/test-vs-cfg-test.rs index 708fde59888..75f4d0c8db2 100644 --- a/src/test/run-pass/test-vs-cfg-test.rs +++ b/src/test/run-pass/test-vs-cfg-test.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --cfg test // Make sure `--cfg test` does not inject test harness diff --git a/src/test/run-pass/thin-lto-global-allocator.rs b/src/test/run-pass/thin-lto-global-allocator.rs index 257d5bbc306..18869cf66da 100644 --- a/src/test/run-pass/thin-lto-global-allocator.rs +++ b/src/test/run-pass/thin-lto-global-allocator.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z thinlto -C codegen-units=2 #[global_allocator] diff --git a/src/test/run-pass/thinlto/all-crates.rs b/src/test/run-pass/thinlto/all-crates.rs index c10b5cc96d6..e910b2a9f96 100644 --- a/src/test/run-pass/thinlto/all-crates.rs +++ b/src/test/run-pass/thinlto/all-crates.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -Clto=thin diff --git a/src/test/run-pass/thinlto/auxiliary/dylib.rs b/src/test/run-pass/thinlto/auxiliary/dylib.rs index cdb3f49cae8..e8b7f8f9f47 100644 --- a/src/test/run-pass/thinlto/auxiliary/dylib.rs +++ b/src/test/run-pass/thinlto/auxiliary/dylib.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z thinlto -C codegen-units=8 #[inline] diff --git a/src/test/run-pass/thinlto/auxiliary/msvc-imp-present.rs b/src/test/run-pass/thinlto/auxiliary/msvc-imp-present.rs index eff7802a245..933af050a6a 100644 --- a/src/test/run-pass/thinlto/auxiliary/msvc-imp-present.rs +++ b/src/test/run-pass/thinlto/auxiliary/msvc-imp-present.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // compile-flags: -Z thinlto -C codegen-units=8 -C prefer-dynamic diff --git a/src/test/run-pass/thinlto/auxiliary/thin-lto-inlines-aux.rs b/src/test/run-pass/thinlto/auxiliary/thin-lto-inlines-aux.rs index ccbb0e7a718..5fd3f1996dd 100644 --- a/src/test/run-pass/thinlto/auxiliary/thin-lto-inlines-aux.rs +++ b/src/test/run-pass/thinlto/auxiliary/thin-lto-inlines-aux.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/run-pass/thinlto/dylib-works.rs b/src/test/run-pass/thinlto/dylib-works.rs index fc8c0db2e26..9e0782b590e 100644 --- a/src/test/run-pass/thinlto/dylib-works.rs +++ b/src/test/run-pass/thinlto/dylib-works.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:dylib.rs diff --git a/src/test/run-pass/thinlto/msvc-imp-present.rs b/src/test/run-pass/thinlto/msvc-imp-present.rs index 47fc00c79a7..5498afb2937 100644 --- a/src/test/run-pass/thinlto/msvc-imp-present.rs +++ b/src/test/run-pass/thinlto/msvc-imp-present.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:msvc-imp-present.rs diff --git a/src/test/run-pass/thinlto/thin-lto-inlines.rs b/src/test/run-pass/thinlto/thin-lto-inlines.rs index 7ad3847df9b..50d95bd0900 100644 --- a/src/test/run-pass/thinlto/thin-lto-inlines.rs +++ b/src/test/run-pass/thinlto/thin-lto-inlines.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -Z thinlto -C codegen-units=8 -O diff --git a/src/test/run-pass/thinlto/thin-lto-inlines2.rs b/src/test/run-pass/thinlto/thin-lto-inlines2.rs index 33fe3b0c5b4..8853b601293 100644 --- a/src/test/run-pass/thinlto/thin-lto-inlines2.rs +++ b/src/test/run-pass/thinlto/thin-lto-inlines2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -C codegen-units=8 -O -C lto=thin diff --git a/src/test/run-pass/thinlto/weak-works.rs b/src/test/run-pass/thinlto/weak-works.rs index 51516ae87ab..163a3870248 100644 --- a/src/test/run-pass/thinlto/weak-works.rs +++ b/src/test/run-pass/thinlto/weak-works.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // compile-flags: -C codegen-units=8 -Z thinlto diff --git a/src/test/run-pass/thread-local-not-in-prelude.rs b/src/test/run-pass/thread-local-not-in-prelude.rs index 0c365597b82..6825b0338f9 100644 --- a/src/test/run-pass/thread-local-not-in-prelude.rs +++ b/src/test/run-pass/thread-local-not-in-prelude.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] extern crate std; diff --git a/src/test/run-pass/threads-sendsync/auxiliary/thread-local-extern-static.rs b/src/test/run-pass/threads-sendsync/auxiliary/thread-local-extern-static.rs index e9457886be8..b237b1c480e 100644 --- a/src/test/run-pass/threads-sendsync/auxiliary/thread-local-extern-static.rs +++ b/src/test/run-pass/threads-sendsync/auxiliary/thread-local-extern-static.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(cfg_target_thread_local, const_fn, thread_local)] #![crate_type = "lib"] diff --git a/src/test/run-pass/threads-sendsync/comm.rs b/src/test/run-pass/threads-sendsync/comm.rs index b4654b553a4..aa86e174d44 100644 --- a/src/test/run-pass/threads-sendsync/comm.rs +++ b/src/test/run-pass/threads-sendsync/comm.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/send-is-not-static-par-for.rs b/src/test/run-pass/threads-sendsync/send-is-not-static-par-for.rs index 58abd373f0a..dbe46555101 100644 --- a/src/test/run-pass/threads-sendsync/send-is-not-static-par-for.rs +++ b/src/test/run-pass/threads-sendsync/send-is-not-static-par-for.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] use std::thread; diff --git a/src/test/run-pass/threads-sendsync/send-resource.rs b/src/test/run-pass/threads-sendsync/send-resource.rs index a03a3f50c51..023a84d6b6e 100644 --- a/src/test/run-pass/threads-sendsync/send-resource.rs +++ b/src/test/run-pass/threads-sendsync/send-resource.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(dead_code)] diff --git a/src/test/run-pass/threads-sendsync/send-type-inference.rs b/src/test/run-pass/threads-sendsync/send-type-inference.rs index a855bc51480..0d9af7512b4 100644 --- a/src/test/run-pass/threads-sendsync/send-type-inference.rs +++ b/src/test/run-pass/threads-sendsync/send-type-inference.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(dead_code)] diff --git a/src/test/run-pass/threads-sendsync/send_str_hashmap.rs b/src/test/run-pass/threads-sendsync/send_str_hashmap.rs index 9c165a2b83d..7d4cca8ad74 100644 --- a/src/test/run-pass/threads-sendsync/send_str_hashmap.rs +++ b/src/test/run-pass/threads-sendsync/send_str_hashmap.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::collections::HashMap; use std::borrow::Cow; diff --git a/src/test/run-pass/threads-sendsync/send_str_treemap.rs b/src/test/run-pass/threads-sendsync/send_str_treemap.rs index 94fa7d94a18..4d463174590 100644 --- a/src/test/run-pass/threads-sendsync/send_str_treemap.rs +++ b/src/test/run-pass/threads-sendsync/send_str_treemap.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::collections::BTreeMap; use std::borrow::Cow; diff --git a/src/test/run-pass/threads-sendsync/sendable-class.rs b/src/test/run-pass/threads-sendsync/sendable-class.rs index 1dcd7c94868..7facf245bde 100644 --- a/src/test/run-pass/threads-sendsync/sendable-class.rs +++ b/src/test/run-pass/threads-sendsync/sendable-class.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(dead_code)] diff --git a/src/test/run-pass/threads-sendsync/sendfn-is-a-block.rs b/src/test/run-pass/threads-sendsync/sendfn-is-a-block.rs index 55144a7d386..62807d8941a 100644 --- a/src/test/run-pass/threads-sendsync/sendfn-is-a-block.rs +++ b/src/test/run-pass/threads-sendsync/sendfn-is-a-block.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/threads-sendsync/sendfn-spawn-with-fn-arg.rs b/src/test/run-pass/threads-sendsync/sendfn-spawn-with-fn-arg.rs index 24d54b8a0b6..8c40b2a5f11 100644 --- a/src/test/run-pass/threads-sendsync/sendfn-spawn-with-fn-arg.rs +++ b/src/test/run-pass/threads-sendsync/sendfn-spawn-with-fn-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/spawn-fn.rs b/src/test/run-pass/threads-sendsync/spawn-fn.rs index 1e1382df60f..1243bb2579f 100644 --- a/src/test/run-pass/threads-sendsync/spawn-fn.rs +++ b/src/test/run-pass/threads-sendsync/spawn-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/spawn-types.rs b/src/test/run-pass/threads-sendsync/spawn-types.rs index f7abb984b68..1bead6e1bb1 100644 --- a/src/test/run-pass/threads-sendsync/spawn-types.rs +++ b/src/test/run-pass/threads-sendsync/spawn-types.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/threads-sendsync/spawn.rs b/src/test/run-pass/threads-sendsync/spawn.rs index 7aa459a895b..b1dcc9417fb 100644 --- a/src/test/run-pass/threads-sendsync/spawn.rs +++ b/src/test/run-pass/threads-sendsync/spawn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/spawn2.rs b/src/test/run-pass/threads-sendsync/spawn2.rs index 549360b851c..83e066aef96 100644 --- a/src/test/run-pass/threads-sendsync/spawn2.rs +++ b/src/test/run-pass/threads-sendsync/spawn2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/spawning-with-debug.rs b/src/test/run-pass/threads-sendsync/spawning-with-debug.rs index 38fc9dec829..c78ae78dd1b 100644 --- a/src/test/run-pass/threads-sendsync/spawning-with-debug.rs +++ b/src/test/run-pass/threads-sendsync/spawning-with-debug.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(unused_mut)] diff --git a/src/test/run-pass/threads-sendsync/std-sync-right-kind-impls.rs b/src/test/run-pass/threads-sendsync/std-sync-right-kind-impls.rs index e5658683a8e..bc64c816243 100644 --- a/src/test/run-pass/threads-sendsync/std-sync-right-kind-impls.rs +++ b/src/test/run-pass/threads-sendsync/std-sync-right-kind-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/threads-sendsync/sync-send-atomics.rs b/src/test/run-pass/threads-sendsync/sync-send-atomics.rs index 53b19db5d48..0466f4f0e9d 100644 --- a/src/test/run-pass/threads-sendsync/sync-send-atomics.rs +++ b/src/test/run-pass/threads-sendsync/sync-send-atomics.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/threads-sendsync/sync-send-in-std.rs b/src/test/run-pass/threads-sendsync/sync-send-in-std.rs index 93f1bc48b0d..981ac166356 100644 --- a/src/test/run-pass/threads-sendsync/sync-send-in-std.rs +++ b/src/test/run-pass/threads-sendsync/sync-send-in-std.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-cloudabi networking not available diff --git a/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs index b62f6c4cc6d..812cf89751e 100644 --- a/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs +++ b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(warnings)] diff --git a/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs index e95014d829d..903bbf51634 100644 --- a/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs +++ b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/threads-sendsync/task-comm-0.rs b/src/test/run-pass/threads-sendsync/task-comm-0.rs index 955304a5c45..2b9a50e4d41 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-0.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-0.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/task-comm-1.rs b/src/test/run-pass/threads-sendsync/task-comm-1.rs index 0059403c3bb..68ca62909bf 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-1.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/task-comm-10.rs b/src/test/run-pass/threads-sendsync/task-comm-10.rs index 2fadece739f..4cac0dc90cf 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-10.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-10.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(unused_mut)] diff --git a/src/test/run-pass/threads-sendsync/task-comm-11.rs b/src/test/run-pass/threads-sendsync/task-comm-11.rs index 7ecb62364fb..8541e143fb9 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-11.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-11.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/threads-sendsync/task-comm-12.rs b/src/test/run-pass/threads-sendsync/task-comm-12.rs index 6c8e456bcdf..613a5cee58b 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-12.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-12.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(unused_mut)] diff --git a/src/test/run-pass/threads-sendsync/task-comm-13.rs b/src/test/run-pass/threads-sendsync/task-comm-13.rs index 6afc031ffb1..327eaaf8fa1 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-13.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-13.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/task-comm-14.rs b/src/test/run-pass/threads-sendsync/task-comm-14.rs index 7b5336a0551..88d6b090268 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-14.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-14.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_parens)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/task-comm-15.rs b/src/test/run-pass/threads-sendsync/task-comm-15.rs index fdf17d3ce6f..adb14abdce9 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-15.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-15.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/task-comm-16.rs b/src/test/run-pass/threads-sendsync/task-comm-16.rs index 1732411629e..d808fd9aceb 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-16.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-16.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![allow(unused_parens)] diff --git a/src/test/run-pass/threads-sendsync/task-comm-17.rs b/src/test/run-pass/threads-sendsync/task-comm-17.rs index 8dce1f7e31e..72249787093 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-17.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-17.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/task-comm-3.rs b/src/test/run-pass/threads-sendsync/task-comm-3.rs index 9d3985fcde6..570ae0a82ff 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-3.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/task-comm-4.rs b/src/test/run-pass/threads-sendsync/task-comm-4.rs index f6101498a05..b259d69d15d 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-4.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-4.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] diff --git a/src/test/run-pass/threads-sendsync/task-comm-5.rs b/src/test/run-pass/threads-sendsync/task-comm-5.rs index 29f5a5d3f27..cdedf034ac3 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-5.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-5.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::sync::mpsc::channel; diff --git a/src/test/run-pass/threads-sendsync/task-comm-6.rs b/src/test/run-pass/threads-sendsync/task-comm-6.rs index 7564e640371..990205ad334 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-6.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-6.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![allow(unused_assignments)] diff --git a/src/test/run-pass/threads-sendsync/task-comm-7.rs b/src/test/run-pass/threads-sendsync/task-comm-7.rs index de7efc4159d..0b9673e0033 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-7.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-7.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] #![allow(unused_assignments)] diff --git a/src/test/run-pass/threads-sendsync/task-comm-9.rs b/src/test/run-pass/threads-sendsync/task-comm-9.rs index 01d749cba4c..5ed33012100 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-9.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-9.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/task-comm-chan-nil.rs b/src/test/run-pass/threads-sendsync/task-comm-chan-nil.rs index d13415a68ca..a93ddff43dc 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-chan-nil.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-chan-nil.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::sync::mpsc::channel; diff --git a/src/test/run-pass/threads-sendsync/task-life-0.rs b/src/test/run-pass/threads-sendsync/task-life-0.rs index 48d8c8e50b7..785cff9a0f3 100644 --- a/src/test/run-pass/threads-sendsync/task-life-0.rs +++ b/src/test/run-pass/threads-sendsync/task-life-0.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/task-spawn-move-and-copy.rs b/src/test/run-pass/threads-sendsync/task-spawn-move-and-copy.rs index 04adacd689c..458f5653885 100644 --- a/src/test/run-pass/threads-sendsync/task-spawn-move-and-copy.rs +++ b/src/test/run-pass/threads-sendsync/task-spawn-move-and-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/task-stderr.rs b/src/test/run-pass/threads-sendsync/task-stderr.rs index e72809b68b0..d474084bf20 100644 --- a/src/test/run-pass/threads-sendsync/task-stderr.rs +++ b/src/test/run-pass/threads-sendsync/task-stderr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/thread-local-extern-static.rs b/src/test/run-pass/threads-sendsync/thread-local-extern-static.rs index 01c0235c55d..e10f5174b12 100644 --- a/src/test/run-pass/threads-sendsync/thread-local-extern-static.rs +++ b/src/test/run-pass/threads-sendsync/thread-local-extern-static.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-windows // aux-build:thread-local-extern-static.rs diff --git a/src/test/run-pass/threads-sendsync/thread-local-syntax.rs b/src/test/run-pass/threads-sendsync/thread-local-syntax.rs index 522a736ce5a..2f4805e4731 100644 --- a/src/test/run-pass/threads-sendsync/thread-local-syntax.rs +++ b/src/test/run-pass/threads-sendsync/thread-local-syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![deny(missing_docs)] //! this tests the syntax of `thread_local!` diff --git a/src/test/run-pass/threads-sendsync/threads.rs b/src/test/run-pass/threads-sendsync/threads.rs index 51d2d356b00..e3da83aa12b 100644 --- a/src/test/run-pass/threads-sendsync/threads.rs +++ b/src/test/run-pass/threads-sendsync/threads.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs b/src/test/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs index e60a2c8a011..8baef433410 100644 --- a/src/test/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs +++ b/src/test/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // no-prefer-dynamic // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/tls-init-on-init.rs b/src/test/run-pass/threads-sendsync/tls-init-on-init.rs index 5b6afe78482..193c1815105 100644 --- a/src/test/run-pass/threads-sendsync/tls-init-on-init.rs +++ b/src/test/run-pass/threads-sendsync/tls-init-on-init.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] @@ -16,13 +6,13 @@ #![feature(thread_local_try_with)] use std::thread; -use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use std::sync::atomic::{AtomicUsize, Ordering}; struct Foo { cnt: usize } thread_local!(static FOO: Foo = Foo::init()); -static CNT: AtomicUsize = ATOMIC_USIZE_INIT; +static CNT: AtomicUsize = AtomicUsize::new(0); impl Foo { fn init() -> Foo { diff --git a/src/test/run-pass/threads-sendsync/tls-try-with.rs b/src/test/run-pass/threads-sendsync/tls-try-with.rs index f1fcef8e4b9..f36ab4e4f9c 100644 --- a/src/test/run-pass/threads-sendsync/tls-try-with.rs +++ b/src/test/run-pass/threads-sendsync/tls-try-with.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(stable_features)] diff --git a/src/test/run-pass/tool_attributes.rs b/src/test/run-pass/tool_attributes.rs index 9d8e56e44cb..506c11011a6 100644 --- a/src/test/run-pass/tool_attributes.rs +++ b/src/test/run-pass/tool_attributes.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Scoped attributes should not trigger an unused attributes lint. #![deny(unused_attributes)] diff --git a/src/test/run-pass/tool_lints.rs b/src/test/run-pass/tool_lints.rs index 2705c03598a..bf848b8ebe0 100644 --- a/src/test/run-pass/tool_lints.rs +++ b/src/test/run-pass/tool_lints.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![deny(unknown_lints)] #[allow(clippy::almost_swapped)] diff --git a/src/test/run-pass/tool_lints_2018_preview.rs b/src/test/run-pass/tool_lints_2018_preview.rs index 57df3e072a8..be6d1991374 100644 --- a/src/test/run-pass/tool_lints_2018_preview.rs +++ b/src/test/run-pass/tool_lints_2018_preview.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(rust_2018_preview)] #![deny(unknown_lints)] diff --git a/src/test/run-pass/trailing-comma.rs b/src/test/run-pass/trailing-comma.rs index 02bae5aa455..197af295a42 100644 --- a/src/test/run-pass/trailing-comma.rs +++ b/src/test/run-pass/trailing-comma.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 #![feature(slice_patterns)] diff --git a/src/test/run-pass/traits/anon-trait-static-method.rs b/src/test/run-pass/traits/anon-trait-static-method.rs index 94779e7c5da..ede01afae02 100644 --- a/src/test/run-pass/traits/anon-trait-static-method.rs +++ b/src/test/run-pass/traits/anon-trait-static-method.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo { x: isize diff --git a/src/test/run-pass/traits/anon_trait_static_method_exe.rs b/src/test/run-pass/traits/anon_trait_static_method_exe.rs index 958c1094e4f..b4930295499 100644 --- a/src/test/run-pass/traits/anon_trait_static_method_exe.rs +++ b/src/test/run-pass/traits/anon_trait_static_method_exe.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/traits/assignability-trait.rs b/src/test/run-pass/traits/assignability-trait.rs index f90c7b95dcf..a8547c1d271 100644 --- a/src/test/run-pass/traits/assignability-trait.rs +++ b/src/test/run-pass/traits/assignability-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2012-4 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/traits/astconv-cycle-between-trait-and-type.rs b/src/test/run-pass/traits/astconv-cycle-between-trait-and-type.rs index 0eabded7627..cc8f9dc5190 100644 --- a/src/test/run-pass/traits/astconv-cycle-between-trait-and-type.rs +++ b/src/test/run-pass/traits/astconv-cycle-between-trait-and-type.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to successfully compile a setup where a trait // (`Trait1`) references a struct (`SomeType`) which in turn diff --git a/src/test/run-pass/traits/augmented-assignments-trait.rs b/src/test/run-pass/traits/augmented-assignments-trait.rs index af308a6efed..8c418daffdf 100644 --- a/src/test/run-pass/traits/augmented-assignments-trait.rs +++ b/src/test/run-pass/traits/augmented-assignments-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::AddAssign; diff --git a/src/test/run-pass/traits/auto-traits.rs b/src/test/run-pass/traits/auto-traits.rs index f4d824557e5..7702725e640 100644 --- a/src/test/run-pass/traits/auto-traits.rs +++ b/src/test/run-pass/traits/auto-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_doc_comments)] #![feature(optin_builtin_traits)] diff --git a/src/test/run-pass/traits/auxiliary/anon_trait_static_method_lib.rs b/src/test/run-pass/traits/auxiliary/anon_trait_static_method_lib.rs index 9d93d9689e7..dceec7e3ec1 100644 --- a/src/test/run-pass/traits/auxiliary/anon_trait_static_method_lib.rs +++ b/src/test/run-pass/traits/auxiliary/anon_trait_static_method_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo { pub x: isize } diff --git a/src/test/run-pass/traits/auxiliary/go_trait.rs b/src/test/run-pass/traits/auxiliary/go_trait.rs index 044bb606b40..aa0ec22896d 100644 --- a/src/test/run-pass/traits/auxiliary/go_trait.rs +++ b/src/test/run-pass/traits/auxiliary/go_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] // Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. diff --git a/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux.rs b/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux.rs index c1168a912dc..0fb26af80c7 100644 --- a/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux.rs +++ b/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Something { pub x: isize } pub trait A { diff --git a/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux_2.rs b/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux_2.rs index 7443ef9c0f3..15480132a23 100644 --- a/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux_2.rs +++ b/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux_2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:trait_default_method_xc_aux.rs extern crate trait_default_method_xc_aux as aux; diff --git a/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_2_aux.rs b/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_2_aux.rs index af0128d9676..e9327676dc6 100644 --- a/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_2_aux.rs +++ b/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_2_aux.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo { fn f(&self) -> isize; } pub trait Bar { fn g(&self) -> isize; } pub trait Baz { fn h(&self) -> isize; } diff --git a/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_aux.rs b/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_aux.rs index 6be1f8c45f4..9af26cb2e2b 100644 --- a/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_aux.rs +++ b/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_aux.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo { fn f(&self) -> isize; } pub trait Bar { fn g(&self) -> isize; } pub trait Baz { fn h(&self) -> isize; } diff --git a/src/test/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs b/src/test/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs index 1bfada612eb..a2570441226 100644 --- a/src/test/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs +++ b/src/test/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cmp::PartialEq; use std::ops::{Add, Sub, Mul}; diff --git a/src/test/run-pass/traits/auxiliary/trait_safety_lib.rs b/src/test/run-pass/traits/auxiliary/trait_safety_lib.rs index 585a756fd07..6fc432ed455 100644 --- a/src/test/run-pass/traits/auxiliary/trait_safety_lib.rs +++ b/src/test/run-pass/traits/auxiliary/trait_safety_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Simple smoke test that unsafe traits can be compiled etc. pub unsafe trait Foo { diff --git a/src/test/run-pass/traits/auxiliary/trait_xc_call_aux.rs b/src/test/run-pass/traits/auxiliary/trait_xc_call_aux.rs index 9eeb815c5de..b76c52e62a9 100644 --- a/src/test/run-pass/traits/auxiliary/trait_xc_call_aux.rs +++ b/src/test/run-pass/traits/auxiliary/trait_xc_call_aux.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub trait Foo { fn f(&self) -> isize; } diff --git a/src/test/run-pass/traits/auxiliary/traitimpl.rs b/src/test/run-pass/traits/auxiliary/traitimpl.rs index 22e79cc6284..fda5314cdbf 100644 --- a/src/test/run-pass/traits/auxiliary/traitimpl.rs +++ b/src/test/run-pass/traits/auxiliary/traitimpl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test inherent trait impls work cross-crait. pub trait Bar<'a> : 'a {} diff --git a/src/test/run-pass/traits/cycle-trait-type-trait.rs b/src/test/run-pass/traits/cycle-trait-type-trait.rs index 9328c86bd7e..c62d01403c7 100644 --- a/src/test/run-pass/traits/cycle-trait-type-trait.rs +++ b/src/test/run-pass/traits/cycle-trait-type-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Test a case where a supertrait references a type that references diff --git a/src/test/run-pass/traits/default-method-supertrait-vtable.rs b/src/test/run-pass/traits/default-method-supertrait-vtable.rs index 57eb410c9ad..939ad51355e 100644 --- a/src/test/run-pass/traits/default-method-supertrait-vtable.rs +++ b/src/test/run-pass/traits/default-method-supertrait-vtable.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/traits/dyn-trait.rs b/src/test/run-pass/traits/dyn-trait.rs index 0ef6b9fd147..e1c1a8de55a 100644 --- a/src/test/run-pass/traits/dyn-trait.rs +++ b/src/test/run-pass/traits/dyn-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // ignore-pretty `dyn ::foo` parses differently in the current edition diff --git a/src/test/run-pass/traits/fmt-pointer-trait.rs b/src/test/run-pass/traits/fmt-pointer-trait.rs index 66ec8fc44a4..b7876b9bd51 100644 --- a/src/test/run-pass/traits/fmt-pointer-trait.rs +++ b/src/test/run-pass/traits/fmt-pointer-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ptr; use std::rc::Rc; diff --git a/src/test/run-pass/traits/impl-implicit-trait.rs b/src/test/run-pass/traits/impl-implicit-trait.rs index f25ce842311..fac2bcce248 100644 --- a/src/test/run-pass/traits/impl-implicit-trait.rs +++ b/src/test/run-pass/traits/impl-implicit-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/traits/impl-inherent-prefer-over-trait.rs b/src/test/run-pass/traits/impl-inherent-prefer-over-trait.rs index 505209ff3ae..140dcaf6a27 100644 --- a/src/test/run-pass/traits/impl-inherent-prefer-over-trait.rs +++ b/src/test/run-pass/traits/impl-inherent-prefer-over-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo; diff --git a/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs b/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs index f2956d38331..1deb17e00da 100644 --- a/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs +++ b/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/traits/inherent-trait-method-order.rs b/src/test/run-pass/traits/inherent-trait-method-order.rs index 6b6dd5dcbbd..f632ae8a9ac 100644 --- a/src/test/run-pass/traits/inherent-trait-method-order.rs +++ b/src/test/run-pass/traits/inherent-trait-method-order.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass struct Foo; diff --git a/src/test/run-pass/traits/kindck-owned-trait-contains-1.rs b/src/test/run-pass/traits/kindck-owned-trait-contains-1.rs index 55cdeff8c9b..f7a58c6f926 100644 --- a/src/test/run-pass/traits/kindck-owned-trait-contains-1.rs +++ b/src/test/run-pass/traits/kindck-owned-trait-contains-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_snake_case)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/traits/multiple-trait-bounds.rs b/src/test/run-pass/traits/multiple-trait-bounds.rs index b49d2449167..868b334070b 100644 --- a/src/test/run-pass/traits/multiple-trait-bounds.rs +++ b/src/test/run-pass/traits/multiple-trait-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/traits/object-one-type-two-traits.rs b/src/test/run-pass/traits/object-one-type-two-traits.rs index ae2f0d31af2..12e4a34a233 100644 --- a/src/test/run-pass/traits/object-one-type-two-traits.rs +++ b/src/test/run-pass/traits/object-one-type-two-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs b/src/test/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs index 991d482c15b..bc8dc8dbd05 100644 --- a/src/test/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs +++ b/src/test/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![feature(overlapping_marker_traits)] diff --git a/src/test/run-pass/traits/overlap-permitted-for-marker-traits.rs b/src/test/run-pass/traits/overlap-permitted-for-marker-traits.rs index 3f165daf65c..59ec9d5689d 100644 --- a/src/test/run-pass/traits/overlap-permitted-for-marker-traits.rs +++ b/src/test/run-pass/traits/overlap-permitted-for-marker-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests for RFC 1268: we allow overlapping impls of marker traits, // that is, traits without items. In this case, a type `T` is diff --git a/src/test/run-pass/traits/parameterized-trait-with-bounds.rs b/src/test/run-pass/traits/parameterized-trait-with-bounds.rs index d98f8006609..b1339b207eb 100644 --- a/src/test/run-pass/traits/parameterized-trait-with-bounds.rs +++ b/src/test/run-pass/traits/parameterized-trait-with-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/traits/principal-less-trait-objects.rs b/src/test/run-pass/traits/principal-less-trait-objects.rs new file mode 100644 index 00000000000..0984362993c --- /dev/null +++ b/src/test/run-pass/traits/principal-less-trait-objects.rs @@ -0,0 +1,41 @@ +// Check that trait-objects without a principal codegen properly. + +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::mem; + +// Array is to make sure the size is not exactly pointer-size, so +// we can be sure we are measuring the right size in the +// `size_of_val` test. +struct SetOnDrop<'a>(&'a AtomicUsize, [u8; 64]); +impl<'a> Drop for SetOnDrop<'a> { + fn drop(&mut self) { + self.0.store(self.0.load(Ordering::Relaxed)+1, Ordering::Relaxed); + } +} + +trait TypeEq {} +impl TypeEq for T {} +fn assert_types_eq() where U: TypeEq {} + +fn main() { + // Check that different ways of writing the same type are equal. + assert_types_eq::(); + assert_types_eq::(); + assert_types_eq::(); + + // Check that codegen works. + // + // Using `AtomicUsize` here because `Cell` is not `Sync`, and + // so can't be made into a `Box`. + let c = AtomicUsize::new(0); + { + let d: Box = Box::new(SetOnDrop(&c, [0; 64])); + + assert_eq!(mem::size_of_val(&*d), + mem::size_of::()); + assert_eq!(mem::align_of_val(&*d), + mem::align_of::()); + assert_eq!(c.load(Ordering::Relaxed), 0); + } + assert_eq!(c.load(Ordering::Relaxed), 1); +} diff --git a/src/test/run-pass/traits/supertrait-default-generics.rs b/src/test/run-pass/traits/supertrait-default-generics.rs index 984089b4d11..e862c0e976b 100644 --- a/src/test/run-pass/traits/supertrait-default-generics.rs +++ b/src/test/run-pass/traits/supertrait-default-generics.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_snake_case)] diff --git a/src/test/run-pass/traits/syntax-trait-polarity.rs b/src/test/run-pass/traits/syntax-trait-polarity.rs index a77099b4257..c6524f5c8e7 100644 --- a/src/test/run-pass/traits/syntax-trait-polarity.rs +++ b/src/test/run-pass/traits/syntax-trait-polarity.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/traits/trait-alias-bounds.rs b/src/test/run-pass/traits/trait-alias-bounds.rs index d8ac1a8c634..d3dd5cee0c3 100644 --- a/src/test/run-pass/traits/trait-alias-bounds.rs +++ b/src/test/run-pass/traits/trait-alias-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(trait_alias)] use std::marker::PhantomData; diff --git a/src/test/run-pass/traits/trait-alias-object.rs b/src/test/run-pass/traits/trait-alias-object.rs index adac28eeb12..1cf9e34edf3 100644 --- a/src/test/run-pass/traits/trait-alias-object.rs +++ b/src/test/run-pass/traits/trait-alias-object.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(trait_alias)] trait Foo = PartialEq + Send; diff --git a/src/test/run-pass/traits/trait-alias-syntax.rs b/src/test/run-pass/traits/trait-alias-syntax.rs index a9b7afb0ea3..7cdd9184d3f 100644 --- a/src/test/run-pass/traits/trait-alias-syntax.rs +++ b/src/test/run-pass/traits/trait-alias-syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(trait_alias)] trait SimpleAlias = Default; diff --git a/src/test/run-pass/traits/trait-bounds-basic.rs b/src/test/run-pass/traits/trait-bounds-basic.rs index 81b410b7777..af6392e5658 100644 --- a/src/test/run-pass/traits/trait-bounds-basic.rs +++ b/src/test/run-pass/traits/trait-bounds-basic.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unconditional_recursion)] diff --git a/src/test/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs b/src/test/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs index 4ccb48915fc..de6c2afa2bb 100644 --- a/src/test/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs +++ b/src/test/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that type parameter bounds on an implementation need not match the // trait exactly, as long as the implementation doesn't demand *more* bounds diff --git a/src/test/run-pass/traits/trait-bounds-in-arc.rs b/src/test/run-pass/traits/trait-bounds-in-arc.rs index 0b67f492d45..82bdcdcf7c5 100644 --- a/src/test/run-pass/traits/trait-bounds-in-arc.rs +++ b/src/test/run-pass/traits/trait-bounds-in-arc.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // Tests that a heterogeneous list of existential types can be put inside an Arc diff --git a/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs b/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs index aa6b845bb01..18b25b852d1 100644 --- a/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs +++ b/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/traits/trait-bounds-recursion.rs b/src/test/run-pass/traits/trait-bounds-recursion.rs index 3cdd7311332..0023ff654e8 100644 --- a/src/test/run-pass/traits/trait-bounds-recursion.rs +++ b/src/test/run-pass/traits/trait-bounds-recursion.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/traits/trait-bounds.rs b/src/test/run-pass/traits/trait-bounds.rs index 20a9bd47d0e..18382bb59a4 100644 --- a/src/test/run-pass/traits/trait-bounds.rs +++ b/src/test/run-pass/traits/trait-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/traits/trait-cache-issue-18209.rs b/src/test/run-pass/traits/trait-cache-issue-18209.rs index 14452b009cf..15676e4554a 100644 --- a/src/test/run-pass/traits/trait-cache-issue-18209.rs +++ b/src/test/run-pass/traits/trait-cache-issue-18209.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that the cache results from the default method do not pollute // the cache for the later call in `load()`. diff --git a/src/test/run-pass/traits/trait-coercion-generic.rs b/src/test/run-pass/traits/trait-coercion-generic.rs index 541c6e19b23..5d1b442afcc 100644 --- a/src/test/run-pass/traits/trait-coercion-generic.rs +++ b/src/test/run-pass/traits/trait-coercion-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] trait Trait { diff --git a/src/test/run-pass/traits/trait-coercion.rs b/src/test/run-pass/traits/trait-coercion.rs index 948f2e7afaf..1a40b81c89f 100644 --- a/src/test/run-pass/traits/trait-coercion.rs +++ b/src/test/run-pass/traits/trait-coercion.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_mut)] diff --git a/src/test/run-pass/traits/trait-composition-trivial.rs b/src/test/run-pass/traits/trait-composition-trivial.rs index c491beda270..90e5dcd68e8 100644 --- a/src/test/run-pass/traits/trait-composition-trivial.rs +++ b/src/test/run-pass/traits/trait-composition-trivial.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/traits/trait-copy-guessing.rs b/src/test/run-pass/traits/trait-copy-guessing.rs index 1035c9a1751..f031dd9ca48 100644 --- a/src/test/run-pass/traits/trait-copy-guessing.rs +++ b/src/test/run-pass/traits/trait-copy-guessing.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // "guessing" in trait selection can affect `copy_or_move`. Check that this diff --git a/src/test/run-pass/traits/trait-default-method-bound-subst.rs b/src/test/run-pass/traits/trait-default-method-bound-subst.rs index 9a0e53340f6..6a5d5c8ba2d 100644 --- a/src/test/run-pass/traits/trait-default-method-bound-subst.rs +++ b/src/test/run-pass/traits/trait-default-method-bound-subst.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/traits/trait-default-method-bound-subst2.rs b/src/test/run-pass/traits/trait-default-method-bound-subst2.rs index 9139a26d295..78eabba2d23 100644 --- a/src/test/run-pass/traits/trait-default-method-bound-subst2.rs +++ b/src/test/run-pass/traits/trait-default-method-bound-subst2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/traits/trait-default-method-bound-subst3.rs b/src/test/run-pass/traits/trait-default-method-bound-subst3.rs index f7445372fbe..dd39dec4b63 100644 --- a/src/test/run-pass/traits/trait-default-method-bound-subst3.rs +++ b/src/test/run-pass/traits/trait-default-method-bound-subst3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/traits/trait-default-method-bound-subst4.rs b/src/test/run-pass/traits/trait-default-method-bound-subst4.rs index 6f3e2e1e72b..ef133064582 100644 --- a/src/test/run-pass/traits/trait-default-method-bound-subst4.rs +++ b/src/test/run-pass/traits/trait-default-method-bound-subst4.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] diff --git a/src/test/run-pass/traits/trait-default-method-bound.rs b/src/test/run-pass/traits/trait-default-method-bound.rs index 6291be02110..0855a9db851 100644 --- a/src/test/run-pass/traits/trait-default-method-bound.rs +++ b/src/test/run-pass/traits/trait-default-method-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/traits/trait-default-method-xc-2.rs b/src/test/run-pass/traits/trait-default-method-xc-2.rs index c0e27fa8757..5fa1a6cba72 100644 --- a/src/test/run-pass/traits/trait-default-method-xc-2.rs +++ b/src/test/run-pass/traits/trait-default-method-xc-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:trait_default_method_xc_aux.rs // aux-build:trait_default_method_xc_aux_2.rs diff --git a/src/test/run-pass/traits/trait-default-method-xc.rs b/src/test/run-pass/traits/trait-default-method-xc.rs index da84e8992cd..3c20a649613 100644 --- a/src/test/run-pass/traits/trait-default-method-xc.rs +++ b/src/test/run-pass/traits/trait-default-method-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs b/src/test/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs index 753141bcf21..3413db6a684 100644 --- a/src/test/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs +++ b/src/test/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we do not error out because of a (False) ambiguity // between the builtin rules for Sized and the where clause. Issue diff --git a/src/test/run-pass/traits/trait-generic.rs b/src/test/run-pass/traits/trait-generic.rs index a230ad03de8..80efe1c9375 100644 --- a/src/test/run-pass/traits/trait-generic.rs +++ b/src/test/run-pass/traits/trait-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/traits/trait-impl-2.rs b/src/test/run-pass/traits/trait-impl-2.rs index 52657042dd8..b28d74a7b35 100644 --- a/src/test/run-pass/traits/trait-impl-2.rs +++ b/src/test/run-pass/traits/trait-impl-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_snake_case)] diff --git a/src/test/run-pass/traits/trait-impl.rs b/src/test/run-pass/traits/trait-impl.rs index 1ba76676092..6b22ac08bb8 100644 --- a/src/test/run-pass/traits/trait-impl.rs +++ b/src/test/run-pass/traits/trait-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test calling methods on an impl for a bare trait. diff --git a/src/test/run-pass/traits/trait-inheritance-auto-xc-2.rs b/src/test/run-pass/traits/trait-inheritance-auto-xc-2.rs index 273a3f48332..62c3ce8030c 100644 --- a/src/test/run-pass/traits/trait-inheritance-auto-xc-2.rs +++ b/src/test/run-pass/traits/trait-inheritance-auto-xc-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:trait_inheritance_auto_xc_2_aux.rs diff --git a/src/test/run-pass/traits/trait-inheritance-auto-xc.rs b/src/test/run-pass/traits/trait-inheritance-auto-xc.rs index 17d4d42e0c0..e8e651091ad 100644 --- a/src/test/run-pass/traits/trait-inheritance-auto-xc.rs +++ b/src/test/run-pass/traits/trait-inheritance-auto-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // aux-build:trait_inheritance_auto_xc_aux.rs diff --git a/src/test/run-pass/traits/trait-inheritance-auto.rs b/src/test/run-pass/traits/trait-inheritance-auto.rs index 4d61e42445d..0be67a55eba 100644 --- a/src/test/run-pass/traits/trait-inheritance-auto.rs +++ b/src/test/run-pass/traits/trait-inheritance-auto.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Testing that this impl turns A into a Quux, because diff --git a/src/test/run-pass/traits/trait-inheritance-call-bound-inherited.rs b/src/test/run-pass/traits/trait-inheritance-call-bound-inherited.rs index 6a6bd9c7be5..37c2ff63c6a 100644 --- a/src/test/run-pass/traits/trait-inheritance-call-bound-inherited.rs +++ b/src/test/run-pass/traits/trait-inheritance-call-bound-inherited.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/traits/trait-inheritance-call-bound-inherited2.rs b/src/test/run-pass/traits/trait-inheritance-call-bound-inherited2.rs index c8d8c3d62a2..8576d29f251 100644 --- a/src/test/run-pass/traits/trait-inheritance-call-bound-inherited2.rs +++ b/src/test/run-pass/traits/trait-inheritance-call-bound-inherited2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs b/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs index 5410c5c79ad..c0b5db63bd4 100644 --- a/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs +++ b/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Testing that we can cast to a subtrait and call subtrait diff --git a/src/test/run-pass/traits/trait-inheritance-cast.rs b/src/test/run-pass/traits/trait-inheritance-cast.rs index 084a7d8440d..38e5c79e9e0 100644 --- a/src/test/run-pass/traits/trait-inheritance-cast.rs +++ b/src/test/run-pass/traits/trait-inheritance-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Testing that supertrait methods can be called on subtrait object types diff --git a/src/test/run-pass/traits/trait-inheritance-cross-trait-call-xc.rs b/src/test/run-pass/traits/trait-inheritance-cross-trait-call-xc.rs index 2d4756cf925..dbefb22cb72 100644 --- a/src/test/run-pass/traits/trait-inheritance-cross-trait-call-xc.rs +++ b/src/test/run-pass/traits/trait-inheritance-cross-trait-call-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:trait_xc_call_aux.rs diff --git a/src/test/run-pass/traits/trait-inheritance-cross-trait-call.rs b/src/test/run-pass/traits/trait-inheritance-cross-trait-call.rs index 29d54ed697d..512c928ca8f 100644 --- a/src/test/run-pass/traits/trait-inheritance-cross-trait-call.rs +++ b/src/test/run-pass/traits/trait-inheritance-cross-trait-call.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/traits/trait-inheritance-diamond.rs b/src/test/run-pass/traits/trait-inheritance-diamond.rs index 47b3c7446e8..32ad0fb4d41 100644 --- a/src/test/run-pass/traits/trait-inheritance-diamond.rs +++ b/src/test/run-pass/traits/trait-inheritance-diamond.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // B and C both require A, so D does as well, twice, but that's just fine diff --git a/src/test/run-pass/traits/trait-inheritance-multiple-inheritors.rs b/src/test/run-pass/traits/trait-inheritance-multiple-inheritors.rs index 163914e7462..77ecbd8eb17 100644 --- a/src/test/run-pass/traits/trait-inheritance-multiple-inheritors.rs +++ b/src/test/run-pass/traits/trait-inheritance-multiple-inheritors.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/traits/trait-inheritance-multiple-params.rs b/src/test/run-pass/traits/trait-inheritance-multiple-params.rs index 1a08099aa04..8ff5ba54185 100644 --- a/src/test/run-pass/traits/trait-inheritance-multiple-params.rs +++ b/src/test/run-pass/traits/trait-inheritance-multiple-params.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/traits/trait-inheritance-num.rs b/src/test/run-pass/traits/trait-inheritance-num.rs index cd269eac9a4..3d63d78cabb 100644 --- a/src/test/run-pass/traits/trait-inheritance-num.rs +++ b/src/test/run-pass/traits/trait-inheritance-num.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/traits/trait-inheritance-num0.rs b/src/test/run-pass/traits/trait-inheritance-num0.rs index 7ff30118c86..cee52542d38 100644 --- a/src/test/run-pass/traits/trait-inheritance-num0.rs +++ b/src/test/run-pass/traits/trait-inheritance-num0.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Extending Num and using inherited static methods diff --git a/src/test/run-pass/traits/trait-inheritance-num1.rs b/src/test/run-pass/traits/trait-inheritance-num1.rs index 4b47ab58b1d..663dd3a5eaf 100644 --- a/src/test/run-pass/traits/trait-inheritance-num1.rs +++ b/src/test/run-pass/traits/trait-inheritance-num1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/traits/trait-inheritance-num2.rs b/src/test/run-pass/traits/trait-inheritance-num2.rs index 0b9e18c1d27..b713c66a37c 100644 --- a/src/test/run-pass/traits/trait-inheritance-num2.rs +++ b/src/test/run-pass/traits/trait-inheritance-num2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // A more complex example of numeric extensions diff --git a/src/test/run-pass/traits/trait-inheritance-num3.rs b/src/test/run-pass/traits/trait-inheritance-num3.rs index c86b2127a6d..c40be6f8354 100644 --- a/src/test/run-pass/traits/trait-inheritance-num3.rs +++ b/src/test/run-pass/traits/trait-inheritance-num3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub trait NumCast: Sized { fn from(i: i32) -> Option; diff --git a/src/test/run-pass/traits/trait-inheritance-num5.rs b/src/test/run-pass/traits/trait-inheritance-num5.rs index ff64f393341..f478618f7b5 100644 --- a/src/test/run-pass/traits/trait-inheritance-num5.rs +++ b/src/test/run-pass/traits/trait-inheritance-num5.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/traits/trait-inheritance-overloading-simple.rs b/src/test/run-pass/traits/trait-inheritance-overloading-simple.rs index 374246da285..c306aa2cda0 100644 --- a/src/test/run-pass/traits/trait-inheritance-overloading-simple.rs +++ b/src/test/run-pass/traits/trait-inheritance-overloading-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] use std::cmp::PartialEq; diff --git a/src/test/run-pass/traits/trait-inheritance-overloading-xc-exe.rs b/src/test/run-pass/traits/trait-inheritance-overloading-xc-exe.rs index ff8009b1c78..2a9acfdd04a 100644 --- a/src/test/run-pass/traits/trait-inheritance-overloading-xc-exe.rs +++ b/src/test/run-pass/traits/trait-inheritance-overloading-xc-exe.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:trait_inheritance_overloading_xc.rs diff --git a/src/test/run-pass/traits/trait-inheritance-overloading.rs b/src/test/run-pass/traits/trait-inheritance-overloading.rs index 5c15ff579e3..083643e821f 100644 --- a/src/test/run-pass/traits/trait-inheritance-overloading.rs +++ b/src/test/run-pass/traits/trait-inheritance-overloading.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::cmp::PartialEq; use std::ops::{Add, Sub, Mul}; diff --git a/src/test/run-pass/traits/trait-inheritance-self-in-supertype.rs b/src/test/run-pass/traits/trait-inheritance-self-in-supertype.rs index 4274b548429..e8a2bd791a5 100644 --- a/src/test/run-pass/traits/trait-inheritance-self-in-supertype.rs +++ b/src/test/run-pass/traits/trait-inheritance-self-in-supertype.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test for issue #4183: use of Self in supertraits. diff --git a/src/test/run-pass/traits/trait-inheritance-self.rs b/src/test/run-pass/traits/trait-inheritance-self.rs index f66273dd901..5f2559f48eb 100644 --- a/src/test/run-pass/traits/trait-inheritance-self.rs +++ b/src/test/run-pass/traits/trait-inheritance-self.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { fn f(&self, x: &T); diff --git a/src/test/run-pass/traits/trait-inheritance-simple.rs b/src/test/run-pass/traits/trait-inheritance-simple.rs index 7da4647f652..ca3a284e597 100644 --- a/src/test/run-pass/traits/trait-inheritance-simple.rs +++ b/src/test/run-pass/traits/trait-inheritance-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/traits/trait-inheritance-static.rs b/src/test/run-pass/traits/trait-inheritance-static.rs index 561c0582ebc..16218fbd236 100644 --- a/src/test/run-pass/traits/trait-inheritance-static.rs +++ b/src/test/run-pass/traits/trait-inheritance-static.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub trait MyNum { diff --git a/src/test/run-pass/traits/trait-inheritance-static2.rs b/src/test/run-pass/traits/trait-inheritance-static2.rs index b98b7a1e2d9..bc78e1e2328 100644 --- a/src/test/run-pass/traits/trait-inheritance-static2.rs +++ b/src/test/run-pass/traits/trait-inheritance-static2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub trait MyEq {} diff --git a/src/test/run-pass/traits/trait-inheritance-subst.rs b/src/test/run-pass/traits/trait-inheritance-subst.rs index 02f417eb8fc..b2b6503666e 100644 --- a/src/test/run-pass/traits/trait-inheritance-subst.rs +++ b/src/test/run-pass/traits/trait-inheritance-subst.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub trait Add { diff --git a/src/test/run-pass/traits/trait-inheritance-subst2.rs b/src/test/run-pass/traits/trait-inheritance-subst2.rs index 3efe3e64edf..ccc9628c777 100644 --- a/src/test/run-pass/traits/trait-inheritance-subst2.rs +++ b/src/test/run-pass/traits/trait-inheritance-subst2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Panda { diff --git a/src/test/run-pass/traits/trait-inheritance-visibility.rs b/src/test/run-pass/traits/trait-inheritance-visibility.rs index ea3e88f2f9a..6ad86492674 100644 --- a/src/test/run-pass/traits/trait-inheritance-visibility.rs +++ b/src/test/run-pass/traits/trait-inheritance-visibility.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass mod traits { diff --git a/src/test/run-pass/traits/trait-inheritance2.rs b/src/test/run-pass/traits/trait-inheritance2.rs index 22c3b30c9e4..5bfa60b1aec 100644 --- a/src/test/run-pass/traits/trait-inheritance2.rs +++ b/src/test/run-pass/traits/trait-inheritance2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/traits/trait-item-inside-macro.rs b/src/test/run-pass/traits/trait-item-inside-macro.rs index a61afbba55f..54bf872d028 100644 --- a/src/test/run-pass/traits/trait-item-inside-macro.rs +++ b/src/test/run-pass/traits/trait-item-inside-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Issue #34183 diff --git a/src/test/run-pass/traits/trait-object-auto-dedup.rs b/src/test/run-pass/traits/trait-object-auto-dedup.rs index 0d9728210f2..98a386e4c6e 100644 --- a/src/test/run-pass/traits/trait-object-auto-dedup.rs +++ b/src/test/run-pass/traits/trait-object-auto-dedup.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] // Test that duplicate auto trait bounds in trait objects don't create new types. diff --git a/src/test/run-pass/traits/trait-object-exclusion.rs b/src/test/run-pass/traits/trait-object-exclusion.rs index a48c7876967..248804d144a 100644 --- a/src/test/run-pass/traits/trait-object-exclusion.rs +++ b/src/test/run-pass/traits/trait-object-exclusion.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Future: 'static { // The requirement for Self: Sized must prevent instantiation of diff --git a/src/test/run-pass/traits/trait-object-generics.rs b/src/test/run-pass/traits/trait-object-generics.rs index b76717a28ff..168bffa0e48 100644 --- a/src/test/run-pass/traits/trait-object-generics.rs +++ b/src/test/run-pass/traits/trait-object-generics.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // test for #8664 diff --git a/src/test/run-pass/traits/trait-object-lifetime-first.rs b/src/test/run-pass/traits/trait-object-lifetime-first.rs index 20df809c4ff..e95a652057d 100644 --- a/src/test/run-pass/traits/trait-object-lifetime-first.rs +++ b/src/test/run-pass/traits/trait-object-lifetime-first.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::fmt::Display; diff --git a/src/test/run-pass/traits/trait-object-with-lifetime-bound.rs b/src/test/run-pass/traits/trait-object-with-lifetime-bound.rs index ffe66606461..9060380db17 100644 --- a/src/test/run-pass/traits/trait-object-with-lifetime-bound.rs +++ b/src/test/run-pass/traits/trait-object-with-lifetime-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Uncovered during work on new scoping rules for safe destructors // as an important use case to support properly. diff --git a/src/test/run-pass/traits/trait-region-pointer-simple.rs b/src/test/run-pass/traits/trait-region-pointer-simple.rs index 8f021d5b25a..6584182d38a 100644 --- a/src/test/run-pass/traits/trait-region-pointer-simple.rs +++ b/src/test/run-pass/traits/trait-region-pointer-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo { fn f(&self) -> isize; diff --git a/src/test/run-pass/traits/trait-safety-ok-cc.rs b/src/test/run-pass/traits/trait-safety-ok-cc.rs index d1b3dfec45e..099ba80e5b5 100644 --- a/src/test/run-pass/traits/trait-safety-ok-cc.rs +++ b/src/test/run-pass/traits/trait-safety-ok-cc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:trait_safety_lib.rs diff --git a/src/test/run-pass/traits/trait-safety-ok.rs b/src/test/run-pass/traits/trait-safety-ok.rs index 2787d56164a..d456a78b64d 100644 --- a/src/test/run-pass/traits/trait-safety-ok.rs +++ b/src/test/run-pass/traits/trait-safety-ok.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Simple smoke test that unsafe traits can be compiled etc. diff --git a/src/test/run-pass/traits/trait-static-method-overwriting.rs b/src/test/run-pass/traits/trait-static-method-overwriting.rs index 76ec05aba34..f669ffae6bb 100644 --- a/src/test/run-pass/traits/trait-static-method-overwriting.rs +++ b/src/test/run-pass/traits/trait-static-method-overwriting.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] mod base { diff --git a/src/test/run-pass/traits/trait-to-str.rs b/src/test/run-pass/traits/trait-to-str.rs index 3fbb7aadde4..9670edbfa2b 100644 --- a/src/test/run-pass/traits/trait-to-str.rs +++ b/src/test/run-pass/traits/trait-to-str.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/traits/trait-where-clause-vs-impl.rs b/src/test/run-pass/traits/trait-where-clause-vs-impl.rs index e811cc7d6e1..7cfee27efb3 100644 --- a/src/test/run-pass/traits/trait-where-clause-vs-impl.rs +++ b/src/test/run-pass/traits/trait-where-clause-vs-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/traits/trait-with-bounds-default.rs b/src/test/run-pass/traits/trait-with-bounds-default.rs index 97fc58d4e54..31f73d79cc7 100644 --- a/src/test/run-pass/traits/trait-with-bounds-default.rs +++ b/src/test/run-pass/traits/trait-with-bounds-default.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass pub trait Clone2 { diff --git a/src/test/run-pass/traits/traits-assoc-type-in-supertrait.rs b/src/test/run-pass/traits/traits-assoc-type-in-supertrait.rs index 2da40300818..7d6a754cc5a 100644 --- a/src/test/run-pass/traits/traits-assoc-type-in-supertrait.rs +++ b/src/test/run-pass/traits/traits-assoc-type-in-supertrait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test case where an associated type is referenced from within the // supertrait definition. Issue #20220. diff --git a/src/test/run-pass/traits/traits-conditional-dispatch.rs b/src/test/run-pass/traits/traits-conditional-dispatch.rs index e24249ec184..a9c194486fe 100644 --- a/src/test/run-pass/traits/traits-conditional-dispatch.rs +++ b/src/test/run-pass/traits/traits-conditional-dispatch.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to resolve conditional dispatch. Here, the // blanket impl for T:Copy coexists with an impl for Box, because diff --git a/src/test/run-pass/traits/traits-conditional-model-fn.rs b/src/test/run-pass/traits/traits-conditional-model-fn.rs index 106774bd337..27ce6d93a81 100644 --- a/src/test/run-pass/traits/traits-conditional-model-fn.rs +++ b/src/test/run-pass/traits/traits-conditional-model-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // A model for how the `Fn` traits could work. You can implement at diff --git a/src/test/run-pass/traits/traits-default-method-macro.rs b/src/test/run-pass/traits/traits-default-method-macro.rs index 12d057f207d..2b50ee9b422 100644 --- a/src/test/run-pass/traits/traits-default-method-macro.rs +++ b/src/test/run-pass/traits/traits-default-method-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/traits/traits-default-method-mut.rs b/src/test/run-pass/traits/traits-default-method-mut.rs index c83856f0352..5f8e983b09c 100644 --- a/src/test/run-pass/traits/traits-default-method-mut.rs +++ b/src/test/run-pass/traits/traits-default-method-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/traits/traits-default-method-self.rs b/src/test/run-pass/traits/traits-default-method-self.rs index e5cea5ca9a5..cdf4d1e148c 100644 --- a/src/test/run-pass/traits/traits-default-method-self.rs +++ b/src/test/run-pass/traits/traits-default-method-self.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/traits/traits-default-method-trivial.rs b/src/test/run-pass/traits/traits-default-method-trivial.rs index 314fbcfb40e..dc41938ec89 100644 --- a/src/test/run-pass/traits/traits-default-method-trivial.rs +++ b/src/test/run-pass/traits/traits-default-method-trivial.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass diff --git a/src/test/run-pass/traits/traits-elaborate-type-region.rs b/src/test/run-pass/traits/traits-elaborate-type-region.rs index c2689794b2f..03aef0184ba 100644 --- a/src/test/run-pass/traits/traits-elaborate-type-region.rs +++ b/src/test/run-pass/traits/traits-elaborate-type-region.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/traits/traits-impl-object-overlap-issue-23853.rs b/src/test/run-pass/traits/traits-impl-object-overlap-issue-23853.rs index f33b5841d85..c9745e06d8f 100644 --- a/src/test/run-pass/traits/traits-impl-object-overlap-issue-23853.rs +++ b/src/test/run-pass/traits/traits-impl-object-overlap-issue-23853.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to compile the case where both a blanket impl // and the object type itself supply the required trait obligation. diff --git a/src/test/run-pass/traits/traits-issue-22019.rs b/src/test/run-pass/traits/traits-issue-22019.rs index a5da604aeb1..1a887f0f39f 100644 --- a/src/test/run-pass/traits/traits-issue-22019.rs +++ b/src/test/run-pass/traits/traits-issue-22019.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test an issue where global caching was causing free regions from // distinct scopes to be compared (`'g` and `'h`). The only important diff --git a/src/test/run-pass/traits/traits-issue-22110.rs b/src/test/run-pass/traits/traits-issue-22110.rs index 02a2589a4e8..bdbfee799f1 100644 --- a/src/test/run-pass/traits/traits-issue-22110.rs +++ b/src/test/run-pass/traits/traits-issue-22110.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test an issue where we reported ambiguity between the where-clause // and the blanket impl. The only important thing is that compilation diff --git a/src/test/run-pass/traits/traits-issue-22655.rs b/src/test/run-pass/traits/traits-issue-22655.rs index 6766d661622..bc08ca0a2ba 100644 --- a/src/test/run-pass/traits/traits-issue-22655.rs +++ b/src/test/run-pass/traits/traits-issue-22655.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Regression test for issue #22655: This test should not lead to diff --git a/src/test/run-pass/traits/traits-issue-23003.rs b/src/test/run-pass/traits/traits-issue-23003.rs index e77b038fc47..24c2b2ad660 100644 --- a/src/test/run-pass/traits/traits-issue-23003.rs +++ b/src/test/run-pass/traits/traits-issue-23003.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test stack overflow triggered by evaluating the implications. To be // WF, the type `Receipt` would require that ` or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that the right implementation is called through a trait // object when supertraits include multiple references to the diff --git a/src/test/run-pass/traits/traits-multidispatch-infer-convert-target.rs b/src/test/run-pass/traits/traits-multidispatch-infer-convert-target.rs index 22404849be6..ca47d9736f6 100644 --- a/src/test/run-pass/traits/traits-multidispatch-infer-convert-target.rs +++ b/src/test/run-pass/traits/traits-multidispatch-infer-convert-target.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we can infer the Target based on the Self or vice versa. diff --git a/src/test/run-pass/traits/traits-negative-impls.rs b/src/test/run-pass/traits/traits-negative-impls.rs index 0740ab01104..8664b6a6a6e 100644 --- a/src/test/run-pass/traits/traits-negative-impls.rs +++ b/src/test/run-pass/traits/traits-negative-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![feature(optin_builtin_traits)] diff --git a/src/test/run-pass/traits/traits-repeated-supertrait.rs b/src/test/run-pass/traits/traits-repeated-supertrait.rs index 4e70669ec96..c8318bdf154 100644 --- a/src/test/run-pass/traits/traits-repeated-supertrait.rs +++ b/src/test/run-pass/traits/traits-repeated-supertrait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test a case of a trait which extends the same supertrait twice, but // with difference type parameters. Test that we can invoke the diff --git a/src/test/run-pass/traits/ufcs-trait-object.rs b/src/test/run-pass/traits/ufcs-trait-object.rs index 06d3c5e9329..abe164a5720 100644 --- a/src/test/run-pass/traits/ufcs-trait-object.rs +++ b/src/test/run-pass/traits/ufcs-trait-object.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that when you use ufcs form to invoke a trait method (on a // trait object) everything works fine. diff --git a/src/test/run-pass/traits/use-trait-before-def.rs b/src/test/run-pass/traits/use-trait-before-def.rs index 4f107fb8242..1ee2b941909 100644 --- a/src/test/run-pass/traits/use-trait-before-def.rs +++ b/src/test/run-pass/traits/use-trait-before-def.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/transmute-non-immediate-to-immediate.rs b/src/test/run-pass/transmute-non-immediate-to-immediate.rs index bd705a909b0..2119c8336f4 100644 --- a/src/test/run-pass/transmute-non-immediate-to-immediate.rs +++ b/src/test/run-pass/transmute-non-immediate-to-immediate.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #7988 // Transmuting non-immediate type to immediate type diff --git a/src/test/run-pass/transmute-specialization.rs b/src/test/run-pass/transmute-specialization.rs index 823def32270..e2b110db636 100644 --- a/src/test/run-pass/transmute-specialization.rs +++ b/src/test/run-pass/transmute-specialization.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] trait Specializable { type Output; } diff --git a/src/test/run-pass/trivial-message.rs b/src/test/run-pass/trivial-message.rs index c6445190c0a..dae07068276 100644 --- a/src/test/run-pass/trivial-message.rs +++ b/src/test/run-pass/trivial-message.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] /* This is about the simplest program that can successfully send a diff --git a/src/test/run-pass/trivial_casts.rs b/src/test/run-pass/trivial_casts.rs index 3da1ba0f045..bc56d0158d4 100644 --- a/src/test/run-pass/trivial_casts.rs +++ b/src/test/run-pass/trivial_casts.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that all coercions can actually be done using casts (modulo the lints). #![allow(trivial_casts, trivial_numeric_casts)] diff --git a/src/test/run-pass/try-block.rs b/src/test/run-pass/try-block.rs index f618d16c598..dff186cfd07 100644 --- a/src/test/run-pass/try-block.rs +++ b/src/test/run-pass/try-block.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] // compile-flags: --edition 2018 diff --git a/src/test/run-pass/try-from-int-error-partial-eq.rs b/src/test/run-pass/try-from-int-error-partial-eq.rs index 1122f5a7559..83ede675925 100644 --- a/src/test/run-pass/try-from-int-error-partial-eq.rs +++ b/src/test/run-pass/try-from-int-error-partial-eq.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(try_from)] #![allow(unused_must_use)] diff --git a/src/test/run-pass/try-is-identifier-edition2015.rs b/src/test/run-pass/try-is-identifier-edition2015.rs index 94e2d579993..b9807a7072d 100644 --- a/src/test/run-pass/try-is-identifier-edition2015.rs +++ b/src/test/run-pass/try-is-identifier-edition2015.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] // compile-flags: --edition 2015 diff --git a/src/test/run-pass/try-operator-custom.rs b/src/test/run-pass/try-operator-custom.rs index 82ba70c9459..008cab00ea2 100644 --- a/src/test/run-pass/try-operator-custom.rs +++ b/src/test/run-pass/try-operator-custom.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(try_trait)] use std::ops::Try; diff --git a/src/test/run-pass/try-operator-hygiene.rs b/src/test/run-pass/try-operator-hygiene.rs index 045a8a50320..5f0f9a932cd 100644 --- a/src/test/run-pass/try-operator-hygiene.rs +++ b/src/test/run-pass/try-operator-hygiene.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals)] #![allow(dead_code)] // `expr?` expands to: @@ -17,7 +7,7 @@ // Err(err) => return Err(From::from(err)), // } // -// This test verifies that the expansion is hygienic, i.e. it's not affected by other `val` and +// This test verifies that the expansion is hygienic, i.e., it's not affected by other `val` and // `err` bindings that may be in scope. use std::num::ParseIntError; diff --git a/src/test/run-pass/try-operator.rs b/src/test/run-pass/try-operator.rs index f212e560bf2..8e7a7b5dfc6 100644 --- a/src/test/run-pass/try-operator.rs +++ b/src/test/run-pass/try-operator.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // ignore-cloudabi no std::fs diff --git a/src/test/run-pass/try-wait.rs b/src/test/run-pass/try-wait.rs index 7c2333ffdaa..05871ba7d4c 100644 --- a/src/test/run-pass/try-wait.rs +++ b/src/test/run-pass/try-wait.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/try_from.rs b/src/test/run-pass/try_from.rs new file mode 100644 index 00000000000..4522ce3a8d6 --- /dev/null +++ b/src/test/run-pass/try_from.rs @@ -0,0 +1,37 @@ +// This test relies on `TryFrom` being blanket impl for all `T: Into` +// and `TryInto` being blanket impl for all `U: TryFrom` + +// This test was added to show the motivation for doing this +// over `TryFrom` being blanket impl for all `T: From` + +#![feature(try_from, never_type)] + +use std::convert::TryInto; + +struct Foo { + t: T, +} + +// This fails to compile due to coherence restrictions +// as of Rust version 1.32.x, therefore it could not be used +// instead of the `Into` version of the impl, and serves as +// motivation for a blanket impl for all `T: Into`, instead +// of a blanket impl for all `T: From` +/* +impl From> for Box { + fn from(foo: Foo) -> Box { + Box::new(foo.t) + } +} +*/ + +impl Into> for Foo { + fn into(self) -> Vec { + vec![self.t] + } +} + +pub fn main() { + let _: Result, !> = Foo { t: 10 }.try_into(); +} + diff --git a/src/test/run-pass/tup.rs b/src/test/run-pass/tup.rs index b6fb2119308..47ea0e1c0da 100644 --- a/src/test/run-pass/tup.rs +++ b/src/test/run-pass/tup.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] type point = (isize, isize); diff --git a/src/test/run-pass/tuple-index-fat-types.rs b/src/test/run-pass/tuple-index-fat-types.rs index e4ea073bfc2..ee224cc84bf 100644 --- a/src/test/run-pass/tuple-index-fat-types.rs +++ b/src/test/run-pass/tuple-index-fat-types.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - struct Foo<'a>(&'a [isize]); fn main() { diff --git a/src/test/run-pass/tuple-index.rs b/src/test/run-pass/tuple-index.rs index 26d918f2367..e68fa1caa55 100644 --- a/src/test/run-pass/tuple-index.rs +++ b/src/test/run-pass/tuple-index.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - struct Point(isize, isize); fn main() { diff --git a/src/test/run-pass/tydesc-name.rs b/src/test/run-pass/tydesc-name.rs index a66830e23df..94de30e88e1 100644 --- a/src/test/run-pass/tydesc-name.rs +++ b/src/test/run-pass/tydesc-name.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![feature(core_intrinsics)] diff --git a/src/test/run-pass/type-alias-enum-variants-2.rs b/src/test/run-pass/type-alias-enum-variants-2.rs new file mode 100644 index 00000000000..0cf413babcb --- /dev/null +++ b/src/test/run-pass/type-alias-enum-variants-2.rs @@ -0,0 +1,30 @@ +#![feature(type_alias_enum_variants)] + +#[derive(Debug, PartialEq, Eq)] +enum Foo { + Bar(i32), + Baz { i: i32 }, +} + +type FooAlias = Foo; +type OptionAlias = Option; + +impl Foo { + fn foo() -> Self { + Self::Bar(3) + } +} + +fn main() { + let t = FooAlias::Bar(1); + assert_eq!(t, Foo::Bar(1)); + let t = FooAlias::Baz { i: 2 }; + assert_eq!(t, Foo::Baz { i: 2 }); + match t { + FooAlias::Bar(_i) => {} + FooAlias::Baz { i } => { assert_eq!(i, 2); } + } + assert_eq!(Foo::foo(), Foo::Bar(3)); + + assert_eq!(OptionAlias::Some(4), Option::Some(4)); +} diff --git a/src/test/run-pass/type-alias-enum-variants.rs b/src/test/run-pass/type-alias-enum-variants.rs new file mode 100644 index 00000000000..0cf413babcb --- /dev/null +++ b/src/test/run-pass/type-alias-enum-variants.rs @@ -0,0 +1,30 @@ +#![feature(type_alias_enum_variants)] + +#[derive(Debug, PartialEq, Eq)] +enum Foo { + Bar(i32), + Baz { i: i32 }, +} + +type FooAlias = Foo; +type OptionAlias = Option; + +impl Foo { + fn foo() -> Self { + Self::Bar(3) + } +} + +fn main() { + let t = FooAlias::Bar(1); + assert_eq!(t, Foo::Bar(1)); + let t = FooAlias::Baz { i: 2 }; + assert_eq!(t, Foo::Baz { i: 2 }); + match t { + FooAlias::Bar(_i) => {} + FooAlias::Baz { i } => { assert_eq!(i, 2); } + } + assert_eq!(Foo::foo(), Foo::Bar(3)); + + assert_eq!(OptionAlias::Some(4), Option::Some(4)); +} diff --git a/src/test/run-pass/type-ascription.rs b/src/test/run-pass/type-ascription.rs index b5eb2fe1705..7e5231b7e06 100644 --- a/src/test/run-pass/type-ascription.rs +++ b/src/test/run-pass/type-ascription.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_variables)] // Type ascription doesn't lead to unsoundness diff --git a/src/test/run-pass/type-id-higher-rank-2.rs b/src/test/run-pass/type-id-higher-rank-2.rs index aead8bc264d..d9280cf97f9 100644 --- a/src/test/run-pass/type-id-higher-rank-2.rs +++ b/src/test/run-pass/type-id-higher-rank-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can't ignore lifetimes by going through Any. use std::any::Any; diff --git a/src/test/run-pass/type-id-higher-rank.rs b/src/test/run-pass/type-id-higher-rank.rs index 2a6708dc999..55d70e31b16 100644 --- a/src/test/run-pass/type-id-higher-rank.rs +++ b/src/test/run-pass/type-id-higher-rank.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that type IDs correctly account for higher-rank lifetimes // Also acts as a regression test for an ICE (issue #19791) diff --git a/src/test/run-pass/type-in-nested-module.rs b/src/test/run-pass/type-in-nested-module.rs index 8fef294c0cf..077a28436df 100644 --- a/src/test/run-pass/type-in-nested-module.rs +++ b/src/test/run-pass/type-in-nested-module.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] diff --git a/src/test/run-pass/type-infer-generalize-ty-var.rs b/src/test/run-pass/type-infer-generalize-ty-var.rs index b918c3fc396..244a72c80fa 100644 --- a/src/test/run-pass/type-infer-generalize-ty-var.rs +++ b/src/test/run-pass/type-infer-generalize-ty-var.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_upper_case_globals)] #![allow(dead_code)] #![allow(unused_assignments)] diff --git a/src/test/run-pass/type-namespace.rs b/src/test/run-pass/type-namespace.rs index 7172e9b85e3..587a302ad5f 100644 --- a/src/test/run-pass/type-namespace.rs +++ b/src/test/run-pass/type-namespace.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - struct A { a: isize } fn a(a: A) -> isize { return a.a; } diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index e05f6f153a4..81945628996 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/type-param.rs b/src/test/run-pass/type-param.rs index 246cf209efb..bfce3f32879 100644 --- a/src/test/run-pass/type-param.rs +++ b/src/test/run-pass/type-param.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] diff --git a/src/test/run-pass/type-params-in-for-each.rs b/src/test/run-pass/type-params-in-for-each.rs index 76ac2d14b93..509843c6b92 100644 --- a/src/test/run-pass/type-params-in-for-each.rs +++ b/src/test/run-pass/type-params-in-for-each.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/type-ptr.rs b/src/test/run-pass/type-ptr.rs index 94d46b1a96e..57c229a2175 100644 --- a/src/test/run-pass/type-ptr.rs +++ b/src/test/run-pass/type-ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/type-sizes.rs b/src/test/run-pass/type-sizes.rs index 26cadf16e29..db9705058da 100644 --- a/src/test/run-pass/type-sizes.rs +++ b/src/test/run-pass/type-sizes.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] #![feature(never_type)] diff --git a/src/test/run-pass/type-use-i1-versus-i8.rs b/src/test/run-pass/type-use-i1-versus-i8.rs index 6cef9c3be17..dc029e4569e 100644 --- a/src/test/run-pass/type-use-i1-versus-i8.rs +++ b/src/test/run-pass/type-use-i1-versus-i8.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 use std::ptr; diff --git a/src/test/run-pass/typeck-fn-to-unsafe-fn-ptr.rs b/src/test/run-pass/typeck-fn-to-unsafe-fn-ptr.rs index 323705f3f95..101f9756c85 100644 --- a/src/test/run-pass/typeck-fn-to-unsafe-fn-ptr.rs +++ b/src/test/run-pass/typeck-fn-to-unsafe-fn-ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This tests reification from safe function to `unsafe fn` pointer fn do_nothing() -> () {} diff --git a/src/test/run-pass/typeck_type_placeholder_1.rs b/src/test/run-pass/typeck_type_placeholder_1.rs index ee482ea3c52..6a3657e4aef 100644 --- a/src/test/run-pass/typeck_type_placeholder_1.rs +++ b/src/test/run-pass/typeck_type_placeholder_1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // This test checks that the `_` type placeholder works // correctly for enabling type inference. diff --git a/src/test/run-pass/typeclasses-eq-example-static.rs b/src/test/run-pass/typeclasses-eq-example-static.rs index fecc6d70509..60c886ba386 100644 --- a/src/test/run-pass/typeclasses-eq-example-static.rs +++ b/src/test/run-pass/typeclasses-eq-example-static.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(dead_code)] diff --git a/src/test/run-pass/typeclasses-eq-example.rs b/src/test/run-pass/typeclasses-eq-example.rs index f2b6e9cd255..06bec5385eb 100644 --- a/src/test/run-pass/typeclasses-eq-example.rs +++ b/src/test/run-pass/typeclasses-eq-example.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(dead_code)] diff --git a/src/test/run-pass/typeid-intrinsic.rs b/src/test/run-pass/typeid-intrinsic.rs index 2dbe2c0a402..0c7abc086fc 100644 --- a/src/test/run-pass/typeid-intrinsic.rs +++ b/src/test/run-pass/typeid-intrinsic.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(deprecated)] // aux-build:typeid-intrinsic-aux1.rs // aux-build:typeid-intrinsic-aux2.rs diff --git a/src/test/run-pass/typestate-cfg-nesting.rs b/src/test/run-pass/typestate-cfg-nesting.rs index a1047d47b4b..994c7d51692 100644 --- a/src/test/run-pass/typestate-cfg-nesting.rs +++ b/src/test/run-pass/typestate-cfg-nesting.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_assignments)] #![allow(unknown_lints)] diff --git a/src/test/run-pass/typestate-multi-decl.rs b/src/test/run-pass/typestate-multi-decl.rs index a47883463e8..bc8d9c10de1 100644 --- a/src/test/run-pass/typestate-multi-decl.rs +++ b/src/test/run-pass/typestate-multi-decl.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub fn main() { let (x, y) = (10, 20); let z = x + y; diff --git a/src/test/run-pass/ufcs-polymorphic-paths.rs b/src/test/run-pass/ufcs-polymorphic-paths.rs index 491045564ce..e136bb23bcd 100644 --- a/src/test/run-pass/ufcs-polymorphic-paths.rs +++ b/src/test/run-pass/ufcs-polymorphic-paths.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::borrow::{Cow, ToOwned}; use std::default::Default; use std::iter::FromIterator; diff --git a/src/test/run-pass/ufcs-type-params.rs b/src/test/run-pass/ufcs-type-params.rs index d72fde1a333..2bb15b91760 100644 --- a/src/test/run-pass/ufcs-type-params.rs +++ b/src/test/run-pass/ufcs-type-params.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 trait Foo { diff --git a/src/test/run-pass/unary-minus-suffix-inference.rs b/src/test/run-pass/unary-minus-suffix-inference.rs index cff260c3ba6..e5579c20a14 100644 --- a/src/test/run-pass/unary-minus-suffix-inference.rs +++ b/src/test/run-pass/unary-minus-suffix-inference.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let a = 1; let a_neg: i8 = -a; diff --git a/src/test/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs b/src/test/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs index dc9798a2101..ac0a74eebd5 100644 --- a/src/test/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs +++ b/src/test/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Add; #[inline] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-all-traits.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-all-traits.rs index f317b835d10..dfccb02009e 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-all-traits.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-all-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(lang_items)] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs index 6c134611312..08a9796ea29 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Test that you can supply `&F` where `F: FnMut()`. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs index 966458a45f3..76ad40b8f3d 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Test that you can supply `&F` where `F: Fn()`. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-boxed.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-boxed.rs index b0c40700bb3..6d55fe997b0 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-boxed.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-boxed.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-by-ref.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-by-ref.rs index 564986bbbca..cf4d4d3e136 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-by-ref.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-by-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test by-ref capture of environment in unboxed closure types diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs index adfdc0d26e9..e23a75ab334 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] // Test that the call operator autoderefs when calling a bounded type parameter. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs index ef1187a3ffb..9b8a3f4098c 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that the call operator autoderefs when calling a bounded type parameter. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs index 1e2495926b9..22fc148c352 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that the call operator autoderefs when calling to an object type. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs index e40541a2754..91311fba2e8 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::FnMut; diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs index 4ebf6b61cc3..fb24df3c24e 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // Test that we mutate a counter on the stack only when we expect to. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-cross-crate.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-cross-crate.rs index 620d935b3b8..39cc260726d 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-cross-crate.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs index 46a69c4dff2..1c5e74e593c 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-drop.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-drop.rs index 46ea9b29e44..ba3c61ca22b 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-drop.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-drop.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(path_statements)] #![allow(dead_code)] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs index f6f83c33f15..0fd23a2d796 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Checks that higher-ranked extern fn pointers implement the full range of Fn traits. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn.rs index 480a6daac81..677cd259a4e 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Checks that extern fn pointers implement the full range of Fn traits. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-fn-as-fnmut-and-fnonce.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-fn-as-fnmut-and-fnonce.rs index 5f2e05995cc..851f3d2fe9b 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-fn-as-fnmut-and-fnonce.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-fn-as-fnmut-and-fnonce.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Checks that the Fn trait hierarchy rules permit // any Fn trait to be used where Fn is implemented. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-fnmut-as-fnonce.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-fnmut-as-fnonce.rs index 592994cae6e..bd577f7c479 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-fnmut-as-fnonce.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-fnmut-as-fnonce.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Checks that the Fn trait hierarchy rules permit // FnMut or FnOnce to be used where FnMut is implemented. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-generic.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-generic.rs index 9120b71c6d7..740b8b2a72f 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-generic.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::ops::FnMut; diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs index b9219404b46..e0c9105760d 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to infer that the type of `x` is `isize` based // on the expected type from the object. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs index 08e41627a9b..4f23f85b649 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to infer that the type of `x` is `isize` based // on the expected type from the object. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs index 06c704dfda1..c3abdd8aab0 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to infer that the type of `x` is `isize` based // on the expected type from the object. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-explicit-call-early.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-explicit-call-early.rs index 2d0fd046610..9135c82b4fd 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-explicit-call-early.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-explicit-call-early.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(fn_traits)] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut.rs index 3ddde9a16af..73f488a4fbb 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to infer a suitable kind for this closure // that is just called (`FnMut`). diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-move.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-move.rs index 48645efce67..7ac1ae30f77 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-move.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-move.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to infer a suitable kind for this `move` // closure that is just called (`FnMut`). diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut.rs index 80ca969c529..0fbb504c2ba 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to infer a suitable kind for this closure // that is just called (`FnMut`). diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce-move.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce-move.rs index ff8cd4a5eff..6381386c4cc 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce-move.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce-move.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to infer a suitable kind for this `move` // closure that is just called (`FnOnce`). diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce.rs index 698a389ef65..3c8ea7d8510 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we are able to infer a suitable kind for this closure // that is just called (`FnOnce`). diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-kind.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-kind.rs index 362d53126c2..fc01bd9b6d9 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-kind.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-kind.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that we can infer the "kind" of an unboxed closure based on // the expected type. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs index c150e8915c6..72d658f393b 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(fn_traits, unboxed_closures)] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-upvar.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-upvar.rs index 5bf634defda..6a5e5b9c224 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-upvar.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-upvar.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that the type variable in the type(`Vec<_>`) of a closed over // variable does not interfere with type inference. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs index e610e90fb97..5c7aafdc573 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(unboxed_closures, fn_traits)] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs index 6f15133eaee..092224b7934 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that unboxed closures in contexts with free type parameters // monomorphize correctly (issue #16791) diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-move-from-projection-issue-30046.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-move-from-projection-issue-30046.rs index ef3114ff394..4388e6bcf77 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-move-from-projection-issue-30046.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-move-from-projection-issue-30046.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused)] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs index 3b1e4a1d554..9b519e63a95 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-move-some-upvars-in-by-ref-closure.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-move-some-upvars-in-by-ref-closure.rs index b20377ec94f..2d219643f3e 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-move-some-upvars-in-by-ref-closure.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-move-some-upvars-in-by-ref-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that in a by-ref once closure we move some variables even as // we capture others by mutable reference. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs index f6997da7c07..7e53c4d9eb6 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Tests that the re-exports of `FnOnce` et al from the prelude work. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-simple.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-simple.rs index 3f50c7e7262..1449554024c 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-simple.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![allow(unused_imports)] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-single-word-env.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-single-word-env.rs index 253a5354cdd..8ada7494e02 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-single-word-env.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-single-word-env.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Ensures that single-word environments work right in unboxed closures. // These take a different path in codegen. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs index 5526d372706..054f284ea2a 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs index 16f123d62fc..45ab5df94b2 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test unboxed closure sugar used in object types. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-unique-type-id.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-unique-type-id.rs index dbf4a1c5f7e..f86499e2e3f 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-unique-type-id.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-unique-type-id.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // This code used to produce the following ICE: diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs index cf8fe03e3e5..6f41c35584e 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/underscore-lifetimes.rs b/src/test/run-pass/underscore-lifetimes.rs index 0f601021f6a..3d0660554e8 100644 --- a/src/test/run-pass/underscore-lifetimes.rs +++ b/src/test/run-pass/underscore-lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] struct Foo<'a>(&'a u8); diff --git a/src/test/run-pass/underscore-method-after-integer.rs b/src/test/run-pass/underscore-method-after-integer.rs index af912564211..f9c06d1e4f1 100644 --- a/src/test/run-pass/underscore-method-after-integer.rs +++ b/src/test/run-pass/underscore-method-after-integer.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Tr : Sized { fn _method_on_numbers(self) {} } diff --git a/src/test/run-pass/uniform-paths/auxiliary/issue-53691.rs b/src/test/run-pass/uniform-paths/auxiliary/issue-53691.rs index 5845afd72fb..a4653317860 100644 --- a/src/test/run-pass/uniform-paths/auxiliary/issue-53691.rs +++ b/src/test/run-pass/uniform-paths/auxiliary/issue-53691.rs @@ -1,17 +1,5 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 -#![feature(uniform_paths)] - mod m { pub fn f() {} } mod n { pub fn g() {} } diff --git a/src/test/run-pass/uniform-paths/basic-nested.rs b/src/test/run-pass/uniform-paths/basic-nested.rs index a0256187dbb..e4e8b32c70e 100644 --- a/src/test/run-pass/uniform-paths/basic-nested.rs +++ b/src/test/run-pass/uniform-paths/basic-nested.rs @@ -1,22 +1,12 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// This test is similar to `basic.rs`, but nested in modules. // run-pass -#![allow(unused_imports)] -#![allow(non_camel_case_types)] - // edition:2018 -#![feature(decl_macro, uniform_paths)] +#![feature(decl_macro)] -// This test is similar to `basic.rs`, but nested in modules. +#![allow(unused_imports)] +#![allow(non_camel_case_types)] mod foo { // Test that ambiguity errors are not emitted between `self::test` and @@ -41,7 +31,7 @@ use std::io; mod bar { // Also test the unqualified external crate import in a nested module, // to show that the above import doesn't resolve through a local `std` - // item, e.g. the automatically injected `extern crate std;`, which in + // item, e.g., the automatically injected `extern crate std;`, which in // the Rust 2018 should no longer be visible through `crate::std`. pub use std::io; diff --git a/src/test/run-pass/uniform-paths/basic.rs b/src/test/run-pass/uniform-paths/basic.rs index b957b24d625..4e2e2dedef6 100644 --- a/src/test/run-pass/uniform-paths/basic.rs +++ b/src/test/run-pass/uniform-paths/basic.rs @@ -1,20 +1,8 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass -#![allow(unused_imports)] -#![allow(non_camel_case_types)] - // edition:2018 -#![feature(uniform_paths)] +#![allow(unused_imports)] +#![allow(non_camel_case_types)] // Test that ambiguity errors are not emitted between `self::test` and // `::test`, assuming the latter (crate) is not in `extern_prelude`. diff --git a/src/test/run-pass/uniform-paths/issue-53691.rs b/src/test/run-pass/uniform-paths/issue-53691.rs index 62be31d6b85..73e5fbf4238 100644 --- a/src/test/run-pass/uniform-paths/issue-53691.rs +++ b/src/test/run-pass/uniform-paths/issue-53691.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-53691.rs extern crate issue_53691; diff --git a/src/test/run-pass/uniform-paths/macros-nested.rs b/src/test/run-pass/uniform-paths/macros-nested.rs index 373734345fc..a62a28bb94d 100644 --- a/src/test/run-pass/uniform-paths/macros-nested.rs +++ b/src/test/run-pass/uniform-paths/macros-nested.rs @@ -1,21 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// This test is similar to `macros.rs`, but nested in modules. // run-pass -#![allow(non_camel_case_types)] - // edition:2018 -#![feature(uniform_paths)] - -// This test is similar to `macros.rs`, but nested in modules. +#![allow(non_camel_case_types)] mod foo { // Test that ambiguity errors are not emitted between `self::test` and @@ -50,7 +38,7 @@ use std::io; mod bar { // Also test the unqualified external crate import in a nested module, // to show that the above import doesn't resolve through a local `std` - // item, e.g. the automatically injected `extern crate std;`, which in + // item, e.g., the automatically injected `extern crate std;`, which in // the Rust 2018 should no longer be visible through `crate::std`. pub use std::io; } diff --git a/src/test/run-pass/uniform-paths/macros.rs b/src/test/run-pass/uniform-paths/macros.rs index 20984eb13dd..31b809f0cfd 100644 --- a/src/test/run-pass/uniform-paths/macros.rs +++ b/src/test/run-pass/uniform-paths/macros.rs @@ -1,21 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// This test is similar to `basic.rs`, but with macros defining local items. // run-pass -#![allow(non_camel_case_types)] - // edition:2018 -#![feature(uniform_paths)] - -// This test is similar to `basic.rs`, but with macros defining local items. +#![allow(non_camel_case_types)] // Test that ambiguity errors are not emitted between `self::test` and // `::test`, assuming the latter (crate) is not in `extern_prelude`. diff --git a/src/test/run-pass/uniform-paths/same-crate.rs b/src/test/run-pass/uniform-paths/same-crate.rs index bb15d6d53ac..ce4cc13d9ec 100644 --- a/src/test/run-pass/uniform-paths/same-crate.rs +++ b/src/test/run-pass/uniform-paths/same-crate.rs @@ -1,19 +1,6 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass - // edition:2018 -#![feature(uniform_paths)] - pub const A: usize = 0; pub mod foo { diff --git a/src/test/run-pass/unify-return-ty.rs b/src/test/run-pass/unify-return-ty.rs index 01b55ebb8e2..3f743a7da40 100644 --- a/src/test/run-pass/unify-return-ty.rs +++ b/src/test/run-pass/unify-return-ty.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that the tail expr in null() has its type // unified with the type *T, and so the type variable // in that type gets resolved. diff --git a/src/test/run-pass/uninit-empty-types.rs b/src/test/run-pass/uninit-empty-types.rs index 8c69704b3bd..b59971b3498 100644 --- a/src/test/run-pass/uninit-empty-types.rs +++ b/src/test/run-pass/uninit-empty-types.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test the uninit() construct returning various empty types. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/union/auxiliary/union.rs b/src/test/run-pass/union/auxiliary/union.rs index 2c4945622ab..e785e35aeb8 100644 --- a/src/test/run-pass/union/auxiliary/union.rs +++ b/src/test/run-pass/union/auxiliary/union.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub union U { pub a: u8, pub b: u16, diff --git a/src/test/run-pass/union/union-align.rs b/src/test/run-pass/union/union-align.rs index 2ba1b97e4ff..edd83a51169 100644 --- a/src/test/run-pass/union/union-align.rs +++ b/src/test/run-pass/union/union-align.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/union/union-backcomp.rs b/src/test/run-pass/union/union-backcomp.rs index b274a101ee9..4efd4c4d3d3 100644 --- a/src/test/run-pass/union/union-backcomp.rs +++ b/src/test/run-pass/union/union-backcomp.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(path_statements)] #![allow(dead_code)] diff --git a/src/test/run-pass/union/union-basic.rs b/src/test/run-pass/union/union-basic.rs index 9bebe3f265e..73cc9793f2c 100644 --- a/src/test/run-pass/union/union-basic.rs +++ b/src/test/run-pass/union/union-basic.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_imports)] diff --git a/src/test/run-pass/union/union-c-interop.rs b/src/test/run-pass/union/union-c-interop.rs index 976ab845cd1..00f04d5b7ff 100644 --- a/src/test/run-pass/union/union-c-interop.rs +++ b/src/test/run-pass/union/union-c-interop.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_snake_case)] diff --git a/src/test/run-pass/union/union-const-codegen.rs b/src/test/run-pass/union/union-const-codegen.rs index aa583e6cead..d5b30559595 100644 --- a/src/test/run-pass/union/union-const-codegen.rs +++ b/src/test/run-pass/union/union-const-codegen.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass union U { diff --git a/src/test/run-pass/union/union-const-eval-field.rs b/src/test/run-pass/union/union-const-eval-field.rs index c8eda7545d9..3b40a21d80d 100644 --- a/src/test/run-pass/union/union-const-eval-field.rs +++ b/src/test/run-pass/union/union-const-eval-field.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(const_fn)] diff --git a/src/test/run-pass/union/union-derive.rs b/src/test/run-pass/union/union-derive.rs index 60501780816..d4b82cdb250 100644 --- a/src/test/run-pass/union/union-derive.rs +++ b/src/test/run-pass/union/union-derive.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/union/union-drop-assign.rs b/src/test/run-pass/union/union-drop-assign.rs index d147fcd0f09..c4349c45464 100644 --- a/src/test/run-pass/union/union-drop-assign.rs +++ b/src/test/run-pass/union/union-drop-assign.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] #![allow(unions_with_drop_fields)] diff --git a/src/test/run-pass/union/union-drop.rs b/src/test/run-pass/union/union-drop.rs index 7d955f7210f..2060950dda9 100644 --- a/src/test/run-pass/union/union-drop.rs +++ b/src/test/run-pass/union/union-drop.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/union/union-generic.rs b/src/test/run-pass/union/union-generic.rs index efa623841c1..6f2caf8dc5b 100644 --- a/src/test/run-pass/union/union-generic.rs +++ b/src/test/run-pass/union/union-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unions_with_drop_fields)] diff --git a/src/test/run-pass/union/union-inherent-method.rs b/src/test/run-pass/union/union-inherent-method.rs index d9300b5b9f5..2e75cce7b10 100644 --- a/src/test/run-pass/union/union-inherent-method.rs +++ b/src/test/run-pass/union/union-inherent-method.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass union U { diff --git a/src/test/run-pass/union/union-macro.rs b/src/test/run-pass/union/union-macro.rs index ae215dc83ee..e938cd5a614 100644 --- a/src/test/run-pass/union/union-macro.rs +++ b/src/test/run-pass/union/union-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] diff --git a/src/test/run-pass/union/union-nodrop.rs b/src/test/run-pass/union/union-nodrop.rs index d024aca0cd7..4cd64ddb5d6 100644 --- a/src/test/run-pass/union/union-nodrop.rs +++ b/src/test/run-pass/union/union-nodrop.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(core_intrinsics)] diff --git a/src/test/run-pass/union/union-overwrite.rs b/src/test/run-pass/union/union-overwrite.rs index b4d0850a504..64c60604ba9 100644 --- a/src/test/run-pass/union/union-overwrite.rs +++ b/src/test/run-pass/union/union-overwrite.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unions_with_drop_fields)] diff --git a/src/test/run-pass/union/union-packed.rs b/src/test/run-pass/union/union-packed.rs index a6aef9046ee..ceb35d94656 100644 --- a/src/test/run-pass/union/union-packed.rs +++ b/src/test/run-pass/union/union-packed.rs @@ -1,19 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_snake_case)] #![feature(untagged_unions)] -#![feature(repr_packed)] use std::mem::{size_of, size_of_val, align_of, align_of_val}; diff --git a/src/test/run-pass/union/union-pat-refutability.rs b/src/test/run-pass/union/union-pat-refutability.rs index 62a02337986..ebb06726647 100644 --- a/src/test/run-pass/union/union-pat-refutability.rs +++ b/src/test/run-pass/union/union-pat-refutability.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(illegal_floating_point_literal_pattern)] diff --git a/src/test/run-pass/union/union-trait-impl.rs b/src/test/run-pass/union/union-trait-impl.rs index 6e732f24b25..8a7ac817240 100644 --- a/src/test/run-pass/union/union-trait-impl.rs +++ b/src/test/run-pass/union/union-trait-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::fmt; diff --git a/src/test/run-pass/union/union-transmute.rs b/src/test/run-pass/union/union-transmute.rs index 1fc20bef9e0..ac7dede98a3 100644 --- a/src/test/run-pass/union/union-transmute.rs +++ b/src/test/run-pass/union/union-transmute.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass extern crate core; diff --git a/src/test/run-pass/union/union-with-drop-fields-lint.rs b/src/test/run-pass/union/union-with-drop-fields-lint.rs index 5f1ac7b51ee..4dbeb7c1e7e 100644 --- a/src/test/run-pass/union/union-with-drop-fields-lint.rs +++ b/src/test/run-pass/union/union-with-drop-fields-lint.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(untagged_unions)] diff --git a/src/test/run-pass/unique/unique-assign-copy.rs b/src/test/run-pass/unique/unique-assign-copy.rs index e25de1025fa..19469810237 100644 --- a/src/test/run-pass/unique/unique-assign-copy.rs +++ b/src/test/run-pass/unique/unique-assign-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-assign-drop.rs b/src/test/run-pass/unique/unique-assign-drop.rs index fc99a896966..32068e79df4 100644 --- a/src/test/run-pass/unique/unique-assign-drop.rs +++ b/src/test/run-pass/unique/unique-assign-drop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] diff --git a/src/test/run-pass/unique/unique-assign-generic.rs b/src/test/run-pass/unique/unique-assign-generic.rs index ebbe6927261..2d62ce59ad0 100644 --- a/src/test/run-pass/unique/unique-assign-generic.rs +++ b/src/test/run-pass/unique/unique-assign-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-assign.rs b/src/test/run-pass/unique/unique-assign.rs index ee6c084410d..5a88df071a0 100644 --- a/src/test/run-pass/unique/unique-assign.rs +++ b/src/test/run-pass/unique/unique-assign.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-autoderef-field.rs b/src/test/run-pass/unique/unique-autoderef-field.rs index 449bf418651..0360646f133 100644 --- a/src/test/run-pass/unique/unique-autoderef-field.rs +++ b/src/test/run-pass/unique/unique-autoderef-field.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-autoderef-index.rs b/src/test/run-pass/unique/unique-autoderef-index.rs index de7c2f7826e..5a3d17a84ef 100644 --- a/src/test/run-pass/unique/unique-autoderef-index.rs +++ b/src/test/run-pass/unique/unique-autoderef-index.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-cmp.rs b/src/test/run-pass/unique/unique-cmp.rs index 5c17058dbe4..7bbc61d25ac 100644 --- a/src/test/run-pass/unique/unique-cmp.rs +++ b/src/test/run-pass/unique/unique-cmp.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_allocation)] #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-containing-tag.rs b/src/test/run-pass/unique/unique-containing-tag.rs index f2a7de67183..f24b3a8645f 100644 --- a/src/test/run-pass/unique/unique-containing-tag.rs +++ b/src/test/run-pass/unique/unique-containing-tag.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/unique/unique-create.rs b/src/test/run-pass/unique/unique-create.rs index da0ae17a4cd..3df0f7d55fd 100644 --- a/src/test/run-pass/unique/unique-create.rs +++ b/src/test/run-pass/unique/unique-create.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/unique/unique-decl-init-copy.rs b/src/test/run-pass/unique/unique-decl-init-copy.rs index 1ec57a8b8b5..6ae95949e84 100644 --- a/src/test/run-pass/unique/unique-decl-init-copy.rs +++ b/src/test/run-pass/unique/unique-decl-init-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-decl-init.rs b/src/test/run-pass/unique/unique-decl-init.rs index 85190b5142f..2c7b9d6054f 100644 --- a/src/test/run-pass/unique/unique-decl-init.rs +++ b/src/test/run-pass/unique/unique-decl-init.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-decl-move.rs b/src/test/run-pass/unique/unique-decl-move.rs index 8e08ae43bae..4a5ee56ea92 100644 --- a/src/test/run-pass/unique/unique-decl-move.rs +++ b/src/test/run-pass/unique/unique-decl-move.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-decl.rs b/src/test/run-pass/unique/unique-decl.rs index 9b1425381b6..84a1b2a5b83 100644 --- a/src/test/run-pass/unique/unique-decl.rs +++ b/src/test/run-pass/unique/unique-decl.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] diff --git a/src/test/run-pass/unique/unique-deref.rs b/src/test/run-pass/unique/unique-deref.rs index db2e5509c1a..0c6af0f7f97 100644 --- a/src/test/run-pass/unique/unique-deref.rs +++ b/src/test/run-pass/unique/unique-deref.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-destructure.rs b/src/test/run-pass/unique/unique-destructure.rs index 782f151459e..9b9f95dfbca 100644 --- a/src/test/run-pass/unique/unique-destructure.rs +++ b/src/test/run-pass/unique/unique-destructure.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-drop-complex.rs b/src/test/run-pass/unique/unique-drop-complex.rs index 747b1662652..0b7bda83b3f 100644 --- a/src/test/run-pass/unique/unique-drop-complex.rs +++ b/src/test/run-pass/unique/unique-drop-complex.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/unique/unique-ffi-symbols.rs b/src/test/run-pass/unique/unique-ffi-symbols.rs index 761b2ffe30b..b0fe22bc332 100644 --- a/src/test/run-pass/unique/unique-ffi-symbols.rs +++ b/src/test/run-pass/unique/unique-ffi-symbols.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // We used to have a __rust_abi shim that resulted in duplicated symbols // whenever the item path wasn't enough to disambiguate between them. diff --git a/src/test/run-pass/unique/unique-fn-arg-move.rs b/src/test/run-pass/unique/unique-fn-arg-move.rs index 703c2bee84d..ff33839e57e 100644 --- a/src/test/run-pass/unique/unique-fn-arg-move.rs +++ b/src/test/run-pass/unique/unique-fn-arg-move.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-fn-arg-mut.rs b/src/test/run-pass/unique/unique-fn-arg-mut.rs index b495fb30a9c..e8bb35e4eb0 100644 --- a/src/test/run-pass/unique/unique-fn-arg-mut.rs +++ b/src/test/run-pass/unique/unique-fn-arg-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-fn-arg.rs b/src/test/run-pass/unique/unique-fn-arg.rs index ef10e17d9d2..75f2a767f59 100644 --- a/src/test/run-pass/unique/unique-fn-arg.rs +++ b/src/test/run-pass/unique/unique-fn-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-fn-ret.rs b/src/test/run-pass/unique/unique-fn-ret.rs index b4757a4b4d6..cd44cfa9836 100644 --- a/src/test/run-pass/unique/unique-fn-ret.rs +++ b/src/test/run-pass/unique/unique-fn-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-generic-assign.rs b/src/test/run-pass/unique/unique-generic-assign.rs index beb3b2fbb48..9c4405aa8ac 100644 --- a/src/test/run-pass/unique/unique-generic-assign.rs +++ b/src/test/run-pass/unique/unique-generic-assign.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Issue #976 diff --git a/src/test/run-pass/unique/unique-in-tag.rs b/src/test/run-pass/unique/unique-in-tag.rs index 52473bd8e89..8d97ebe6590 100644 --- a/src/test/run-pass/unique/unique-in-tag.rs +++ b/src/test/run-pass/unique/unique-in-tag.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/unique/unique-in-vec-copy.rs b/src/test/run-pass/unique/unique-in-vec-copy.rs index 62b183d62b4..8907a8b20a7 100644 --- a/src/test/run-pass/unique/unique-in-vec-copy.rs +++ b/src/test/run-pass/unique/unique-in-vec-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-in-vec.rs b/src/test/run-pass/unique/unique-in-vec.rs index 681c0c190e4..528ea4fb870 100644 --- a/src/test/run-pass/unique/unique-in-vec.rs +++ b/src/test/run-pass/unique/unique-in-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-init.rs b/src/test/run-pass/unique/unique-init.rs index 9b7c2a99c99..c8a150522fd 100644 --- a/src/test/run-pass/unique/unique-init.rs +++ b/src/test/run-pass/unique/unique-init.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/unique/unique-kinds.rs b/src/test/run-pass/unique/unique-kinds.rs index 33b014db37b..f369a1e2a19 100644 --- a/src/test/run-pass/unique/unique-kinds.rs +++ b/src/test/run-pass/unique/unique-kinds.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-log.rs b/src/test/run-pass/unique/unique-log.rs index f8b5f5562fc..27977717706 100644 --- a/src/test/run-pass/unique/unique-log.rs +++ b/src/test/run-pass/unique/unique-log.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-match-discrim.rs b/src/test/run-pass/unique/unique-match-discrim.rs index e3ceadee1a5..6e6d7432277 100644 --- a/src/test/run-pass/unique/unique-match-discrim.rs +++ b/src/test/run-pass/unique/unique-match-discrim.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Issue #961 diff --git a/src/test/run-pass/unique/unique-move-drop.rs b/src/test/run-pass/unique/unique-move-drop.rs index 53f3c9b6c5c..e1ea58b39ef 100644 --- a/src/test/run-pass/unique/unique-move-drop.rs +++ b/src/test/run-pass/unique/unique-move-drop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] diff --git a/src/test/run-pass/unique/unique-move-temp.rs b/src/test/run-pass/unique/unique-move-temp.rs index e006e1e4f23..4f5de50b722 100644 --- a/src/test/run-pass/unique/unique-move-temp.rs +++ b/src/test/run-pass/unique/unique-move-temp.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-move.rs b/src/test/run-pass/unique/unique-move.rs index 0a1b80c33df..0f6bff1432b 100644 --- a/src/test/run-pass/unique/unique-move.rs +++ b/src/test/run-pass/unique/unique-move.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-mutable.rs b/src/test/run-pass/unique/unique-mutable.rs index fcae9323c38..176cf33d488 100644 --- a/src/test/run-pass/unique/unique-mutable.rs +++ b/src/test/run-pass/unique/unique-mutable.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-object-move.rs b/src/test/run-pass/unique/unique-object-move.rs index 472257b8c79..4bd3764fa15 100644 --- a/src/test/run-pass/unique/unique-object-move.rs +++ b/src/test/run-pass/unique/unique-object-move.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] // Issue #5192 diff --git a/src/test/run-pass/unique/unique-pat-2.rs b/src/test/run-pass/unique/unique-pat-2.rs index 0adf23ceeac..c18e029b252 100644 --- a/src/test/run-pass/unique/unique-pat-2.rs +++ b/src/test/run-pass/unique/unique-pat-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/unique/unique-pat-3.rs b/src/test/run-pass/unique/unique-pat-3.rs index 8deda0e3089..e17b5a3ddb4 100644 --- a/src/test/run-pass/unique/unique-pat-3.rs +++ b/src/test/run-pass/unique/unique-pat-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/unique/unique-pat.rs b/src/test/run-pass/unique/unique-pat.rs index c83989def33..b32195ac274 100644 --- a/src/test/run-pass/unique/unique-pat.rs +++ b/src/test/run-pass/unique/unique-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_patterns)] diff --git a/src/test/run-pass/unique/unique-rec.rs b/src/test/run-pass/unique/unique-rec.rs index 0169be9d139..c8bddd246a8 100644 --- a/src/test/run-pass/unique/unique-rec.rs +++ b/src/test/run-pass/unique/unique-rec.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-send-2.rs b/src/test/run-pass/unique/unique-send-2.rs index f34a7c2cd00..22f0e6c3a49 100644 --- a/src/test/run-pass/unique/unique-send-2.rs +++ b/src/test/run-pass/unique/unique-send-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/unique/unique-send.rs b/src/test/run-pass/unique/unique-send.rs index d7382749861..a5c7561b9ae 100644 --- a/src/test/run-pass/unique/unique-send.rs +++ b/src/test/run-pass/unique/unique-send.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-swap.rs b/src/test/run-pass/unique/unique-swap.rs index 16090fa1b28..33a6b3b3ed0 100644 --- a/src/test/run-pass/unique/unique-swap.rs +++ b/src/test/run-pass/unique/unique-swap.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(box_syntax)] diff --git a/src/test/run-pass/unit.rs b/src/test/run-pass/unit.rs index 17ed465f995..e10b2408cb7 100644 --- a/src/test/run-pass/unit.rs +++ b/src/test/run-pass/unit.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_assignments)] #![allow(unknown_lints)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/unnamed_argument_mode.rs b/src/test/run-pass/unnamed_argument_mode.rs index d498a70be49..fa817be2704 100644 --- a/src/test/run-pass/unnamed_argument_mode.rs +++ b/src/test/run-pass/unnamed_argument_mode.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 fn good(_a: &isize) { diff --git a/src/test/run-pass/unreachable-code-1.rs b/src/test/run-pass/unreachable-code-1.rs index 4e257069506..ac41377e056 100644 --- a/src/test/run-pass/unreachable-code-1.rs +++ b/src/test/run-pass/unreachable-code-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] #![allow(unreachable_code)] diff --git a/src/test/run-pass/unreachable-code.rs b/src/test/run-pass/unreachable-code.rs index 4fffe98e4b2..ea17be7adee 100644 --- a/src/test/run-pass/unreachable-code.rs +++ b/src/test/run-pass/unreachable-code.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] #![allow(dead_code)] diff --git a/src/test/run-pass/unsafe-coercion.rs b/src/test/run-pass/unsafe-coercion.rs index 8661ebb414c..0c977c1ef32 100644 --- a/src/test/run-pass/unsafe-coercion.rs +++ b/src/test/run-pass/unsafe-coercion.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that safe fns are not a subtype of unsafe fns. diff --git a/src/test/run-pass/unsafe-fn-called-from-unsafe-blk.rs b/src/test/run-pass/unsafe-fn-called-from-unsafe-blk.rs index ac5a0db1cd2..e49b372981b 100644 --- a/src/test/run-pass/unsafe-fn-called-from-unsafe-blk.rs +++ b/src/test/run-pass/unsafe-fn-called-from-unsafe-blk.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // // See also: compile-fail/unsafe-fn-called-from-safe.rs diff --git a/src/test/run-pass/unsafe-fn-called-from-unsafe-fn.rs b/src/test/run-pass/unsafe-fn-called-from-unsafe-fn.rs index a40a764bfc2..f9414bee298 100644 --- a/src/test/run-pass/unsafe-fn-called-from-unsafe-fn.rs +++ b/src/test/run-pass/unsafe-fn-called-from-unsafe-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // // See also: compile-fail/unsafe-fn-called-from-safe.rs diff --git a/src/test/run-pass/unsafe-pointer-assignability.rs b/src/test/run-pass/unsafe-pointer-assignability.rs index c8ee0f83b9b..11e22d7a08a 100644 --- a/src/test/run-pass/unsafe-pointer-assignability.rs +++ b/src/test/run-pass/unsafe-pointer-assignability.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn f(x: *const isize) { unsafe { assert_eq!(*x, 3); diff --git a/src/test/run-pass/unsized-locals/unsized-exprs.rs b/src/test/run-pass/unsized-locals/unsized-exprs.rs index 4b988f1e72d..bc64fcdec2e 100644 --- a/src/test/run-pass/unsized-locals/unsized-exprs.rs +++ b/src/test/run-pass/unsized-locals/unsized-exprs.rs @@ -34,4 +34,5 @@ fn main() { udrop::<[u8]>((*foo())); udrop::<[u8]>((*tfoo()).1); *afoo() + 42; + udrop as fn([u8]); } diff --git a/src/test/run-pass/unsized-tuple-impls.rs b/src/test/run-pass/unsized-tuple-impls.rs index 591b19f89e8..17ab317361e 100644 --- a/src/test/run-pass/unsized-tuple-impls.rs +++ b/src/test/run-pass/unsized-tuple-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unsized_tuple_coercion)] use std::collections::HashSet; diff --git a/src/test/run-pass/unsized.rs b/src/test/run-pass/unsized.rs index 6a58c9aa90b..ad69214db87 100644 --- a/src/test/run-pass/unsized.rs +++ b/src/test/run-pass/unsized.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(type_alias_bounds)] #![allow(dead_code)] // Test syntax checks for `?Sized` syntax. diff --git a/src/test/run-pass/unsized2.rs b/src/test/run-pass/unsized2.rs index e4480d7e97a..c3eae299b86 100644 --- a/src/test/run-pass/unsized2.rs +++ b/src/test/run-pass/unsized2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unconditional_recursion)] #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/unsized3.rs b/src/test/run-pass/unsized3.rs index 6d378cb294e..eaa65cf37fa 100644 --- a/src/test/run-pass/unsized3.rs +++ b/src/test/run-pass/unsized3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test structs with always-unsized fields. diff --git a/src/test/run-pass/unused-move-capture.rs b/src/test/run-pass/unused-move-capture.rs index e5a77d1cdbd..baba19c08cd 100644 --- a/src/test/run-pass/unused-move-capture.rs +++ b/src/test/run-pass/unused-move-capture.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // pretty-expanded FIXME #23616 #![feature(box_syntax)] diff --git a/src/test/run-pass/unused-move.rs b/src/test/run-pass/unused-move.rs index 9a0ea181d99..74632dbc797 100644 --- a/src/test/run-pass/unused-move.rs +++ b/src/test/run-pass/unused-move.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #3878 // Issue Name: Unused move causes a crash // Abstract: zero-fill to block after drop diff --git a/src/test/run-pass/unwind-resource.rs b/src/test/run-pass/unwind-resource.rs index e0ddc854fa0..a55730c55fd 100644 --- a/src/test/run-pass/unwind-resource.rs +++ b/src/test/run-pass/unwind-resource.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/unwind-unique.rs b/src/test/run-pass/unwind-unique.rs index 321e8198817..07613a6dd64 100644 --- a/src/test/run-pass/unwind-unique.rs +++ b/src/test/run-pass/unwind-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten no threads support #![feature(box_syntax)] diff --git a/src/test/run-pass/use-crate-name-alias.rs b/src/test/run-pass/use-crate-name-alias.rs index 98594183a00..520e72676b0 100644 --- a/src/test/run-pass/use-crate-name-alias.rs +++ b/src/test/run-pass/use-crate-name-alias.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #1706 // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/use-import-export.rs b/src/test/run-pass/use-import-export.rs index 044472606a5..bb6a8ee55bf 100644 --- a/src/test/run-pass/use-import-export.rs +++ b/src/test/run-pass/use-import-export.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - // pretty-expanded FIXME #23616 mod foo { diff --git a/src/test/run-pass/use-keyword-2.rs b/src/test/run-pass/use-keyword-2.rs index c669b522ab2..840c907e234 100644 --- a/src/test/run-pass/use-keyword-2.rs +++ b/src/test/run-pass/use-keyword-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] pub struct A; diff --git a/src/test/run-pass/use-mod.rs b/src/test/run-pass/use-mod.rs index 3115a359ff1..9af56b71de0 100644 --- a/src/test/run-pass/use-mod.rs +++ b/src/test/run-pass/use-mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/use-nested-groups.rs b/src/test/run-pass/use-nested-groups.rs index be06e463e3b..092b4a34e55 100644 --- a/src/test/run-pass/use-nested-groups.rs +++ b/src/test/run-pass/use-nested-groups.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { pub enum B {} diff --git a/src/test/run-pass/use.rs b/src/test/run-pass/use.rs index d6899e79152..df37a60e356 100644 --- a/src/test/run-pass/use.rs +++ b/src/test/run-pass/use.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/use_inline_dtor.rs b/src/test/run-pass/use_inline_dtor.rs index 0f55a357a00..0873d185575 100644 --- a/src/test/run-pass/use_inline_dtor.rs +++ b/src/test/run-pass/use_inline_dtor.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:inline_dtor.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/using-target-feature-unstable.rs b/src/test/run-pass/using-target-feature-unstable.rs index 614c8d4e1d4..05b1d93a697 100644 --- a/src/test/run-pass/using-target-feature-unstable.rs +++ b/src/test/run-pass/using-target-feature-unstable.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // only-x86_64 // aux-build:using-target-feature-unstable.rs diff --git a/src/test/run-pass/utf8-bom.rs b/src/test/run-pass/utf8-bom.rs index c3052a928d6..90874c9b2e3 100644 --- a/src/test/run-pass/utf8-bom.rs +++ b/src/test/run-pass/utf8-bom.rs @@ -1,12 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // This file has utf-8 BOM, it should be compiled normally without error. diff --git a/src/test/run-pass/utf8.rs b/src/test/run-pass/utf8.rs index ec1c6970ea0..b908afbd5b6 100644 --- a/src/test/run-pass/utf8.rs +++ b/src/test/run-pass/utf8.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let yen: char = '¥'; // 0xa5 let c_cedilla: char = 'ç'; // 0xe7 diff --git a/src/test/run-pass/utf8_chars.rs b/src/test/run-pass/utf8_chars.rs index b2550e77a8a..c29d8557b70 100644 --- a/src/test/run-pass/utf8_chars.rs +++ b/src/test/run-pass/utf8_chars.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::str; pub fn main() { diff --git a/src/test/run-pass/utf8_idents.rs b/src/test/run-pass/utf8_idents.rs index 4614e47609a..7323e144f8d 100644 --- a/src/test/run-pass/utf8_idents.rs +++ b/src/test/run-pass/utf8_idents.rs @@ -1,12 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // #![allow(non_snake_case)] diff --git a/src/test/run-pass/variadic-ffi.rs b/src/test/run-pass/variadic-ffi.rs index 2198ead106b..3539c8d6b72 100644 --- a/src/test/run-pass/variadic-ffi.rs +++ b/src/test/run-pass/variadic-ffi.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare no libc to test ffi with #[link(name = "rust_test_helpers", kind = "static")] diff --git a/src/test/run-pass/variance-intersection-of-ref-and-opt-ref.rs b/src/test/run-pass/variance-intersection-of-ref-and-opt-ref.rs index 948d68e0ccd..fde151400be 100644 --- a/src/test/run-pass/variance-intersection-of-ref-and-opt-ref.rs +++ b/src/test/run-pass/variance-intersection-of-ref-and-opt-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Elaborated version of the opening example from RFC 738. This failed // to compile before variance because invariance of `Option` prevented // us from approximating the lifetimes of `field1` and `field2` to a diff --git a/src/test/run-pass/variance-iterators-in-libcore.rs b/src/test/run-pass/variance-iterators-in-libcore.rs index b9677d5ba85..32b56bd0b5a 100644 --- a/src/test/run-pass/variance-iterators-in-libcore.rs +++ b/src/test/run-pass/variance-iterators-in-libcore.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] use std::iter::Zip; diff --git a/src/test/run-pass/variant-attributes.rs b/src/test/run-pass/variant-attributes.rs index 0c92778cec4..19de3ff2f63 100644 --- a/src/test/run-pass/variant-attributes.rs +++ b/src/test/run-pass/variant-attributes.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_attributes)] #![allow(non_camel_case_types)] #![allow(dead_code)] diff --git a/src/test/run-pass/volatile-fat-ptr.rs b/src/test/run-pass/volatile-fat-ptr.rs index 799917c4b05..f01263b73a9 100644 --- a/src/test/run-pass/volatile-fat-ptr.rs +++ b/src/test/run-pass/volatile-fat-ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] #![feature(volatile)] use std::ptr::{read_volatile, write_volatile}; diff --git a/src/test/run-pass/wait-forked-but-failed-child.rs b/src/test/run-pass/wait-forked-but-failed-child.rs index dc47108e183..e9869866a9b 100644 --- a/src/test/run-pass/wait-forked-but-failed-child.rs +++ b/src/test/run-pass/wait-forked-but-failed-child.rs @@ -1,17 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no processes // ignore-emscripten no processes -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/run-pass/warn-ctypes-inhibit.rs b/src/test/run-pass/warn-ctypes-inhibit.rs index 0c059cb607e..76b36a12c20 100644 --- a/src/test/run-pass/warn-ctypes-inhibit.rs +++ b/src/test/run-pass/warn-ctypes-inhibit.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // compile-flags:-D improper-ctypes diff --git a/src/test/run-pass/weak-lang-item.rs b/src/test/run-pass/weak-lang-item.rs index d9f4ec28920..9a36606a465 100644 --- a/src/test/run-pass/weak-lang-item.rs +++ b/src/test/run-pass/weak-lang-item.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:weak-lang-items.rs // ignore-emscripten no threads support diff --git a/src/test/run-pass/weak-new-uninhabited-issue-48493.rs b/src/test/run-pass/weak-new-uninhabited-issue-48493.rs index eb57c12ed12..4f93800b864 100644 --- a/src/test/run-pass/weak-new-uninhabited-issue-48493.rs +++ b/src/test/run-pass/weak-new-uninhabited-issue-48493.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { enum Void {} std::rc::Weak::::new(); diff --git a/src/test/run-pass/weird-exit-code.rs b/src/test/run-pass/weird-exit-code.rs index cdd6a9b5331..9456cbbe6f7 100644 --- a/src/test/run-pass/weird-exit-code.rs +++ b/src/test/run-pass/weird-exit-code.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // On Windows the GetExitCodeProcess API is used to get the exit code of a // process, but it's easy to mistake a process exiting with the code 259 as // "still running" because this is the value of the STILL_ACTIVE constant. Make diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index c688ec540da..7ce7e29e872 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -1,20 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] #![allow(dead_code)] #![allow(unreachable_code)] #![allow(unused_parens)] // compile-flags: -Z borrowck=compare -#![recursion_limit = "128"] +#![recursion_limit = "256"] use std::cell::Cell; use std::mem::swap; diff --git a/src/test/run-pass/wf-bound-region-in-object-type.rs b/src/test/run-pass/wf-bound-region-in-object-type.rs index b71f633bef4..d81059ca6a8 100644 --- a/src/test/run-pass/wf-bound-region-in-object-type.rs +++ b/src/test/run-pass/wf-bound-region-in-object-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_variables)] // Test that the `wf` checker properly handles bound regions in object diff --git a/src/test/run-pass/where-clauses/auxiliary/where_clauses_xc.rs b/src/test/run-pass/where-clauses/auxiliary/where_clauses_xc.rs index 4549bd719c6..7c8043b2002 100644 --- a/src/test/run-pass/where-clauses/auxiliary/where_clauses_xc.rs +++ b/src/test/run-pass/where-clauses/auxiliary/where_clauses_xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Equal { fn equal(&self, other: &Self) -> bool; fn equals(&self, this: &T, that: &T, x: &U, y: &U) -> bool diff --git a/src/test/run-pass/where-clauses/where-clause-bounds-inconsistency.rs b/src/test/run-pass/where-clauses/where-clause-bounds-inconsistency.rs index 752f8f2252e..cf7d06b6179 100644 --- a/src/test/run-pass/where-clauses/where-clause-bounds-inconsistency.rs +++ b/src/test/run-pass/where-clauses/where-clause-bounds-inconsistency.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs b/src/test/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs index 4d5a676943a..6fc570b9b5b 100644 --- a/src/test/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs +++ b/src/test/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/where-clauses/where-clause-method-substituion.rs b/src/test/run-pass/where-clauses/where-clause-method-substituion.rs index bb9d01a57c1..daa3c8dd8e3 100644 --- a/src/test/run-pass/where-clauses/where-clause-method-substituion.rs +++ b/src/test/run-pass/where-clauses/where-clause-method-substituion.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/where-clauses/where-clause-region-outlives.rs b/src/test/run-pass/where-clauses/where-clause-region-outlives.rs index 5a296c17df0..84925345de1 100644 --- a/src/test/run-pass/where-clauses/where-clause-region-outlives.rs +++ b/src/test/run-pass/where-clauses/where-clause-region-outlives.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/where-clauses/where-clauses-cross-crate.rs b/src/test/run-pass/where-clauses/where-clauses-cross-crate.rs index 0343656061b..9edf0bd5b1d 100644 --- a/src/test/run-pass/where-clauses/where-clauses-cross-crate.rs +++ b/src/test/run-pass/where-clauses/where-clauses-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:where_clauses_xc.rs diff --git a/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs b/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs index fc511914517..4bfd9e6590f 100644 --- a/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs +++ b/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_mut)] #![allow(unused_variables)] diff --git a/src/test/run-pass/where-clauses/where-clauses-method.rs b/src/test/run-pass/where-clauses/where-clauses-method.rs index c9930128bbe..feecff43565 100644 --- a/src/test/run-pass/where-clauses/where-clauses-method.rs +++ b/src/test/run-pass/where-clauses/where-clauses-method.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that a where clause attached to a method allows us to add // additional constraints to a parameter out of scope. diff --git a/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs b/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs index 79d1431eca5..6964cfa2eb0 100644 --- a/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs +++ b/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/where-clauses/where-clauses.rs b/src/test/run-pass/where-clauses/where-clauses.rs index 8f1cf098c30..905ef7c5e8c 100644 --- a/src/test/run-pass/where-clauses/where-clauses.rs +++ b/src/test/run-pass/where-clauses/where-clauses.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Equal { fn equal(&self, other: &Self) -> bool; diff --git a/src/test/run-pass/wrapping-int-api.rs b/src/test/run-pass/wrapping-int-api.rs index 5470ad93e14..fc62caf3b8d 100644 --- a/src/test/run-pass/wrapping-int-api.rs +++ b/src/test/run-pass/wrapping-int-api.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test inherent wrapping_* methods for {i,u}{size,8,16,32,64}. use std::{i8, i16, i32, i64, isize}; diff --git a/src/test/run-pass/write-fmt-errors.rs b/src/test/run-pass/write-fmt-errors.rs index e4439087946..f95bbfd569a 100644 --- a/src/test/run-pass/write-fmt-errors.rs +++ b/src/test/run-pass/write-fmt-errors.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; use std::io::{self, Error, Write, sink}; diff --git a/src/test/run-pass/writealias.rs b/src/test/run-pass/writealias.rs index d190e91575e..f80118e08c9 100644 --- a/src/test/run-pass/writealias.rs +++ b/src/test/run-pass/writealias.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] use std::sync::Mutex; diff --git a/src/test/run-pass/wrong-hashset-issue-42918.rs b/src/test/run-pass/wrong-hashset-issue-42918.rs index 0fcd3efd9ce..12b10640c53 100644 --- a/src/test/run-pass/wrong-hashset-issue-42918.rs +++ b/src/test/run-pass/wrong-hashset-issue-42918.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // #![allow(dead_code)] // compile-flags: -O diff --git a/src/test/run-pass/x86stdcall.rs b/src/test/run-pass/x86stdcall.rs index 69ac68d2583..11a45a58895 100644 --- a/src/test/run-pass/x86stdcall.rs +++ b/src/test/run-pass/x86stdcall.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare no libc to test ffi with // GetLastError doesn't seem to work with stack switching diff --git a/src/test/run-pass/x86stdcall2.rs b/src/test/run-pass/x86stdcall2.rs index 8ea7ec67f1b..3d008f26ab3 100644 --- a/src/test/run-pass/x86stdcall2.rs +++ b/src/test/run-pass/x86stdcall2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] pub type HANDLE = usize; pub type DWORD = u32; diff --git a/src/test/run-pass/yield.rs b/src/test/run-pass/yield.rs index 9910c534926..a5fd14bd8fd 100644 --- a/src/test/run-pass/yield.rs +++ b/src/test/run-pass/yield.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] #![allow(unused_mut)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/yield1.rs b/src/test/run-pass/yield1.rs index 0b603452339..e7a6190b567 100644 --- a/src/test/run-pass/yield1.rs +++ b/src/test/run-pass/yield1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_must_use)] #![allow(unused_mut)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/yield2.rs b/src/test/run-pass/yield2.rs index acc55833133..c4ccd2d1475 100644 --- a/src/test/run-pass/yield2.rs +++ b/src/test/run-pass/yield2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::thread; pub fn main() { diff --git a/src/test/run-pass/yk_swt/collect-trace-twice.rs b/src/test/run-pass/yk_swt/collect-trace-twice.rs index 6c08b355a29..e4475b58cce 100644 --- a/src/test/run-pass/yk_swt/collect-trace-twice.rs +++ b/src/test/run-pass/yk_swt/collect-trace-twice.rs @@ -10,6 +10,7 @@ #![feature(yk_swt)] #![feature(libc)] #![feature(test)] +#![feature(rustc_private)] extern crate core; extern crate libc; diff --git a/src/test/run-pass/yk_swt/collect-trace.rs b/src/test/run-pass/yk_swt/collect-trace.rs index cd729320f65..0a3392e0dad 100644 --- a/src/test/run-pass/yk_swt/collect-trace.rs +++ b/src/test/run-pass/yk_swt/collect-trace.rs @@ -10,6 +10,7 @@ #![feature(yk_swt)] #![feature(libc)] #![feature(test)] +#![feature(rustc_private)] extern crate core; extern crate libc; diff --git a/src/test/run-pass/yk_swt/collect-traces-threaded.rs b/src/test/run-pass/yk_swt/collect-traces-threaded.rs index ff996ca3638..168cbbe8056 100644 --- a/src/test/run-pass/yk_swt/collect-traces-threaded.rs +++ b/src/test/run-pass/yk_swt/collect-traces-threaded.rs @@ -10,6 +10,7 @@ #![feature(yk_swt)] #![feature(libc)] #![feature(test)] +#![feature(rustc_private)] extern crate core; extern crate libc; diff --git a/src/test/run-pass/yk_swt/invalidate-trace.rs b/src/test/run-pass/yk_swt/invalidate-trace.rs index 9fd8a068637..1c98814ee06 100644 --- a/src/test/run-pass/yk_swt/invalidate-trace.rs +++ b/src/test/run-pass/yk_swt/invalidate-trace.rs @@ -10,6 +10,7 @@ #![feature(yk_swt)] #![feature(libc)] #![feature(test)] +#![feature(rustc_private)] extern crate core; extern crate libc; diff --git a/src/test/run-pass/z-crate-attr.rs b/src/test/run-pass/z-crate-attr.rs index 3df0985a2a3..f0843941309 100644 --- a/src/test/run-pass/z-crate-attr.rs +++ b/src/test/run-pass/z-crate-attr.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test checks if an unstable feature is enabled with the -Zcrate-attr=feature(foo) flag. If // the exact feature used here is causing problems feel free to replace it with another // perma-unstable feature. diff --git a/src/test/run-pass/zero-sized/zero-size-type-destructors.rs b/src/test/run-pass/zero-sized/zero-size-type-destructors.rs index 02f8639e832..98b5a439c82 100644 --- a/src/test/run-pass/zero-sized/zero-size-type-destructors.rs +++ b/src/test/run-pass/zero-sized/zero-size-type-destructors.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/zero-sized/zero-sized-binary-heap-push.rs b/src/test/run-pass/zero-sized/zero-sized-binary-heap-push.rs index 118e83537ca..6553c5adbe7 100644 --- a/src/test/run-pass/zero-sized/zero-sized-binary-heap-push.rs +++ b/src/test/run-pass/zero-sized/zero-sized-binary-heap-push.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] use std::collections::BinaryHeap; diff --git a/src/test/run-pass/zero-sized/zero-sized-btreemap-insert.rs b/src/test/run-pass/zero-sized/zero-sized-btreemap-insert.rs index a2c0f78850c..52edb33d6ad 100644 --- a/src/test/run-pass/zero-sized/zero-sized-btreemap-insert.rs +++ b/src/test/run-pass/zero-sized/zero-sized-btreemap-insert.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] #![allow(unused_imports)] diff --git a/src/test/run-pass/zero-sized/zero-sized-linkedlist-push.rs b/src/test/run-pass/zero-sized/zero-sized-linkedlist-push.rs index 7b0b2f3c3c5..03724085f5f 100644 --- a/src/test/run-pass/zero-sized/zero-sized-linkedlist-push.rs +++ b/src/test/run-pass/zero-sized/zero-sized-linkedlist-push.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::collections::LinkedList; use std::iter::Iterator; diff --git a/src/test/run-pass/zero-sized/zero-sized-tuple-struct.rs b/src/test/run-pass/zero-sized/zero-sized-tuple-struct.rs index 2ea51779063..6c438720e5d 100644 --- a/src/test/run-pass/zero-sized/zero-sized-tuple-struct.rs +++ b/src/test/run-pass/zero-sized/zero-sized-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_assignments)] diff --git a/src/test/run-pass/zero-sized/zero-sized-vec-deque-push.rs b/src/test/run-pass/zero-sized/zero-sized-vec-deque-push.rs index 2fc51f3409f..c541208703b 100644 --- a/src/test/run-pass/zero-sized/zero-sized-vec-deque-push.rs +++ b/src/test/run-pass/zero-sized/zero-sized-vec-deque-push.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass use std::collections::VecDeque; use std::iter::Iterator; diff --git a/src/test/run-pass/zero-sized/zero-sized-vec-push.rs b/src/test/run-pass/zero-sized/zero-sized-vec-push.rs index d418535bf9f..9e9fbc972d5 100644 --- a/src/test/run-pass/zero-sized/zero-sized-vec-push.rs +++ b/src/test/run-pass/zero-sized/zero-sized-vec-push.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused_variables)] use std::iter::Iterator; diff --git a/src/test/rustdoc-js/alias-1.js b/src/test/rustdoc-js/alias-1.js index 496bd559b87..7c6327fcdd7 100644 --- a/src/test/rustdoc-js/alias-1.js +++ b/src/test/rustdoc-js/alias-1.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = '&'; const EXPECTED = { diff --git a/src/test/rustdoc-js/alias-2.js b/src/test/rustdoc-js/alias-2.js index 0c5ec4fccbc..f3c6713692b 100644 --- a/src/test/rustdoc-js/alias-2.js +++ b/src/test/rustdoc-js/alias-2.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-order const QUERY = '+'; diff --git a/src/test/rustdoc-js/alias-3.js b/src/test/rustdoc-js/alias-3.js index d9e1ca5f760..392b1e81837 100644 --- a/src/test/rustdoc-js/alias-3.js +++ b/src/test/rustdoc-js/alias-3.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = '!'; const EXPECTED = { diff --git a/src/test/rustdoc-js/alias.js b/src/test/rustdoc-js/alias.js index e7aafe3b9e2..2b709c99119 100644 --- a/src/test/rustdoc-js/alias.js +++ b/src/test/rustdoc-js/alias.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-order const QUERY = '['; diff --git a/src/test/rustdoc-js/basic.js b/src/test/rustdoc-js/basic.js index d7ba1253eab..824cac71083 100644 --- a/src/test/rustdoc-js/basic.js +++ b/src/test/rustdoc-js/basic.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = 'String'; const EXPECTED = { diff --git a/src/test/rustdoc-js/deduplication.js b/src/test/rustdoc-js/deduplication.js index 0f29607d5c9..f02f6cf55ed 100644 --- a/src/test/rustdoc-js/deduplication.js +++ b/src/test/rustdoc-js/deduplication.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-order const QUERY = 'is_nan'; diff --git a/src/test/rustdoc-js/enum-option.js b/src/test/rustdoc-js/enum-option.js index 3dac983b11b..902e0906910 100644 --- a/src/test/rustdoc-js/enum-option.js +++ b/src/test/rustdoc-js/enum-option.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = 'enum:Option'; const EXPECTED = { diff --git a/src/test/rustdoc-js/filter-crate.js b/src/test/rustdoc-js/filter-crate.js new file mode 100644 index 00000000000..2e0330c4497 --- /dev/null +++ b/src/test/rustdoc-js/filter-crate.js @@ -0,0 +1,9 @@ +// exact-check + +const QUERY = 'hashmap'; +const FILTER_CRATE = 'core'; + +const EXPECTED = { + 'others': [ + ], +}; diff --git a/src/test/rustdoc-js/fn-forget.js b/src/test/rustdoc-js/fn-forget.js index 10310d5eaf7..66a5fcaa781 100644 --- a/src/test/rustdoc-js/fn-forget.js +++ b/src/test/rustdoc-js/fn-forget.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = 'fn:forget'; const EXPECTED = { diff --git a/src/test/rustdoc-js/from_u.js b/src/test/rustdoc-js/from_u.js index 34b98a758df..e3f3cd436aa 100644 --- a/src/test/rustdoc-js/from_u.js +++ b/src/test/rustdoc-js/from_u.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = 'from_u'; const EXPECTED = { diff --git a/src/test/rustdoc-js/keyword.js b/src/test/rustdoc-js/keyword.js index 65de3a4662f..868ddd7b6dc 100644 --- a/src/test/rustdoc-js/keyword.js +++ b/src/test/rustdoc-js/keyword.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-order const QUERY = 'fn'; diff --git a/src/test/rustdoc-js/macro-check.js b/src/test/rustdoc-js/macro-check.js index fb616884333..242e0cbf5f4 100644 --- a/src/test/rustdoc-js/macro-check.js +++ b/src/test/rustdoc-js/macro-check.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-order const QUERY = 'panic'; diff --git a/src/test/rustdoc-js/macro-print.js b/src/test/rustdoc-js/macro-print.js index 811ba3474af..858046e72e9 100644 --- a/src/test/rustdoc-js/macro-print.js +++ b/src/test/rustdoc-js/macro-print.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = 'macro:print'; const EXPECTED = { diff --git a/src/test/rustdoc-js/multi-query.js b/src/test/rustdoc-js/multi-query.js index 3f583a3600a..01e54065189 100644 --- a/src/test/rustdoc-js/multi-query.js +++ b/src/test/rustdoc-js/multi-query.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = 'str,u8'; const EXPECTED = { diff --git a/src/test/rustdoc-js/never.js b/src/test/rustdoc-js/never.js index d9e1ca5f760..392b1e81837 100644 --- a/src/test/rustdoc-js/never.js +++ b/src/test/rustdoc-js/never.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = '!'; const EXPECTED = { diff --git a/src/test/rustdoc-js/quoted.js b/src/test/rustdoc-js/quoted.js index dcb85b5de04..924129f86c8 100644 --- a/src/test/rustdoc-js/quoted.js +++ b/src/test/rustdoc-js/quoted.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = '"error"'; const EXPECTED = { diff --git a/src/test/rustdoc-js/should-fail.js b/src/test/rustdoc-js/should-fail.js index 5e41422612a..b85a47dc08a 100644 --- a/src/test/rustdoc-js/should-fail.js +++ b/src/test/rustdoc-js/should-fail.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // should-fail const QUERY = 'fn'; diff --git a/src/test/rustdoc-js/string-from_ut.js b/src/test/rustdoc-js/string-from_ut.js index 3d08ee37366..f9edf4408db 100644 --- a/src/test/rustdoc-js/string-from_ut.js +++ b/src/test/rustdoc-js/string-from_ut.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = 'String::from_ut'; const EXPECTED = { diff --git a/src/test/rustdoc-js/struct-vec.js b/src/test/rustdoc-js/struct-vec.js index 3874e23a2a3..2c808143bae 100644 --- a/src/test/rustdoc-js/struct-vec.js +++ b/src/test/rustdoc-js/struct-vec.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = 'struct:Vec'; const EXPECTED = { diff --git a/src/test/rustdoc-js/substring.js b/src/test/rustdoc-js/substring.js index 49c1c05d301..3a6750151f7 100644 --- a/src/test/rustdoc-js/substring.js +++ b/src/test/rustdoc-js/substring.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // exact-check const QUERY = 'waker_from'; diff --git a/src/test/rustdoc-js/vec-new.js b/src/test/rustdoc-js/vec-new.js index 42951724648..e4daa5065d2 100644 --- a/src/test/rustdoc-js/vec-new.js +++ b/src/test/rustdoc-js/vec-new.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const QUERY = 'Vec::new'; const EXPECTED = { diff --git a/src/test/rustdoc-ui/.gitattributes b/src/test/rustdoc-ui/.gitattributes new file mode 100644 index 00000000000..2bcabdffb3d --- /dev/null +++ b/src/test/rustdoc-ui/.gitattributes @@ -0,0 +1 @@ +intra-links-warning-crlf.rs eol=crlf diff --git a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.rs b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.rs index 85d19c83547..9e64e6eb399 100644 --- a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.rs +++ b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(intra_doc_link_resolution_failure)] /// [v2] //~ ERROR diff --git a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr index b82cbc1ab36..e18b9909f58 100644 --- a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr +++ b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr @@ -1,11 +1,11 @@ error: `[v2]` cannot be resolved, ignoring it... - --> $DIR/deny-intra-link-resolution-failure.rs:13:6 + --> $DIR/deny-intra-link-resolution-failure.rs:3:6 | LL | /// [v2] //~ ERROR | ^^ cannot be resolved, ignoring | note: lint level defined here - --> $DIR/deny-intra-link-resolution-failure.rs:11:9 + --> $DIR/deny-intra-link-resolution-failure.rs:1:9 | LL | #![deny(intra_doc_link_resolution_failure)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/rustdoc-ui/deny-missing-docs-crate.rs b/src/test/rustdoc-ui/deny-missing-docs-crate.rs new file mode 100644 index 00000000000..b74eba3f66b --- /dev/null +++ b/src/test/rustdoc-ui/deny-missing-docs-crate.rs @@ -0,0 +1,3 @@ +#![deny(missing_docs)] //~ ERROR + +pub struct Foo; //~ ERROR diff --git a/src/test/rustdoc-ui/deny-missing-docs-crate.stderr b/src/test/rustdoc-ui/deny-missing-docs-crate.stderr new file mode 100644 index 00000000000..1cfd6092cb3 --- /dev/null +++ b/src/test/rustdoc-ui/deny-missing-docs-crate.stderr @@ -0,0 +1,22 @@ +error: missing documentation for crate + --> $DIR/deny-missing-docs-crate.rs:1:1 + | +LL | / #![deny(missing_docs)] //~ ERROR +LL | | +LL | | pub struct Foo; //~ ERROR + | |_______________^ + | +note: lint level defined here + --> $DIR/deny-missing-docs-crate.rs:1:9 + | +LL | #![deny(missing_docs)] //~ ERROR + | ^^^^^^^^^^^^ + +error: missing documentation for a struct + --> $DIR/deny-missing-docs-crate.rs:3:1 + | +LL | pub struct Foo; //~ ERROR + | ^^^^^^^^^^^^^^^ + +error: Compilation failed, aborting rustdoc + diff --git a/src/test/rustdoc-ui/deny-missing-docs-macro.rs b/src/test/rustdoc-ui/deny-missing-docs-macro.rs new file mode 100644 index 00000000000..b1c1253176b --- /dev/null +++ b/src/test/rustdoc-ui/deny-missing-docs-macro.rs @@ -0,0 +1,8 @@ +//! foo + +#![deny(missing_docs)] + +#[macro_export] +macro_rules! foo { //~ ERROR + () => {} +} diff --git a/src/test/rustdoc-ui/deny-missing-docs-macro.stderr b/src/test/rustdoc-ui/deny-missing-docs-macro.stderr new file mode 100644 index 00000000000..b87e60d8269 --- /dev/null +++ b/src/test/rustdoc-ui/deny-missing-docs-macro.stderr @@ -0,0 +1,14 @@ +error: missing documentation for macro + --> $DIR/deny-missing-docs-macro.rs:6:1 + | +LL | macro_rules! foo { //~ ERROR + | ^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/deny-missing-docs-macro.rs:3:9 + | +LL | #![deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: Compilation failed, aborting rustdoc + diff --git a/src/test/rustdoc-ui/deprecated-attrs.rs b/src/test/rustdoc-ui/deprecated-attrs.rs index dd2e05aeeb4..6f6d5b8b654 100644 --- a/src/test/rustdoc-ui/deprecated-attrs.rs +++ b/src/test/rustdoc-ui/deprecated-attrs.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![doc(no_default_passes, passes = "collapse-docs unindent-comments")] diff --git a/src/test/rustdoc-ui/doc-without-codeblock.rs b/src/test/rustdoc-ui/doc-without-codeblock.rs index e047b272c41..aa3f539ba32 100644 --- a/src/test/rustdoc-ui/doc-without-codeblock.rs +++ b/src/test/rustdoc-ui/doc-without-codeblock.rs @@ -1,20 +1,15 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +//~ ERROR Missing code example in this documentation #![deny(missing_doc_code_examples)] /// Some docs. +//~^ ERROR Missing code example in this documentation pub struct Foo; /// And then, the princess died. +//~^ ERROR Missing code example in this documentation pub mod foo { /// Or maybe not because she saved herself! + //~^ ERROR Missing code example in this documentation pub fn bar() {} } diff --git a/src/test/rustdoc-ui/doc-without-codeblock.stderr b/src/test/rustdoc-ui/doc-without-codeblock.stderr index ba5bb7fc0b1..c07965a6ab9 100644 --- a/src/test/rustdoc-ui/doc-without-codeblock.stderr +++ b/src/test/rustdoc-ui/doc-without-codeblock.stderr @@ -1,25 +1,25 @@ error: Missing code example in this documentation | note: lint level defined here - --> $DIR/doc-without-codeblock.rs:11:9 + --> $DIR/doc-without-codeblock.rs:3:9 | LL | #![deny(missing_doc_code_examples)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: Missing code example in this documentation - --> $DIR/doc-without-codeblock.rs:13:1 + --> $DIR/doc-without-codeblock.rs:5:1 | LL | /// Some docs. | ^^^^^^^^^^^^^^ error: Missing code example in this documentation - --> $DIR/doc-without-codeblock.rs:16:1 + --> $DIR/doc-without-codeblock.rs:9:1 | LL | /// And then, the princess died. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Missing code example in this documentation - --> $DIR/doc-without-codeblock.rs:18:5 + --> $DIR/doc-without-codeblock.rs:12:5 | LL | /// Or maybe not because she saved herself! | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/rustdoc-ui/failed-doctest-output.rs b/src/test/rustdoc-ui/failed-doctest-output.rs index 932fe1c8eb0..48f1424e6b2 100644 --- a/src/test/rustdoc-ui/failed-doctest-output.rs +++ b/src/test/rustdoc-ui/failed-doctest-output.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #51162: A failed doctest was not printing its stdout/stderr // FIXME: if/when the output of the test harness can be tested on its own, this test should be // adapted to use that, and that normalize line can go away diff --git a/src/test/rustdoc-ui/failed-doctest-output.stdout b/src/test/rustdoc-ui/failed-doctest-output.stdout index 527f1355a9e..8af05e9ca97 100644 --- a/src/test/rustdoc-ui/failed-doctest-output.stdout +++ b/src/test/rustdoc-ui/failed-doctest-output.stdout @@ -1,32 +1,32 @@ running 2 tests -test $DIR/failed-doctest-output.rs - OtherStruct (line 27) ... FAILED -test $DIR/failed-doctest-output.rs - SomeStruct (line 21) ... FAILED +test $DIR/failed-doctest-output.rs - OtherStruct (line 17) ... FAILED +test $DIR/failed-doctest-output.rs - SomeStruct (line 11) ... FAILED failures: ----- $DIR/failed-doctest-output.rs - OtherStruct (line 27) stdout ---- +---- $DIR/failed-doctest-output.rs - OtherStruct (line 17) stdout ---- error[E0425]: cannot find value `no` in this scope - --> $DIR/failed-doctest-output.rs:28:1 + --> $DIR/failed-doctest-output.rs:18:1 | 3 | no | ^^ not found in this scope -thread '$DIR/failed-doctest-output.rs - OtherStruct (line 27)' panicked at 'couldn't compile the test', librustdoc/test.rs:323:13 -note: Run with `RUST_BACKTRACE=1` for a backtrace. +thread '$DIR/failed-doctest-output.rs - OtherStruct (line 17)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:354:13 +note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. ----- $DIR/failed-doctest-output.rs - SomeStruct (line 21) stdout ---- -thread '$DIR/failed-doctest-output.rs - SomeStruct (line 21)' panicked at 'test executable failed: +---- $DIR/failed-doctest-output.rs - SomeStruct (line 11) stdout ---- +thread '$DIR/failed-doctest-output.rs - SomeStruct (line 11)' panicked at 'test executable failed: thread 'main' panicked at 'oh no', $DIR/failed-doctest-output.rs:3:1 -note: Run with `RUST_BACKTRACE=1` for a backtrace. +note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. -', librustdoc/test.rs:358:17 +', src/librustdoc/test.rs:389:17 failures: - $DIR/failed-doctest-output.rs - OtherStruct (line 27) - $DIR/failed-doctest-output.rs - SomeStruct (line 21) + $DIR/failed-doctest-output.rs - OtherStruct (line 17) + $DIR/failed-doctest-output.rs - SomeStruct (line 11) test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out diff --git a/src/test/rustdoc-ui/intra-doc-alias-ice.rs b/src/test/rustdoc-ui/intra-doc-alias-ice.rs index a459ab5dd2b..9657d573d50 100644 --- a/src/test/rustdoc-ui/intra-doc-alias-ice.rs +++ b/src/test/rustdoc-ui/intra-doc-alias-ice.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(intra_doc_link_resolution_failure)] pub type TypeAlias = usize; diff --git a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr index 498d02a7d1c..ced56897e2a 100644 --- a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr +++ b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr @@ -1,11 +1,11 @@ error: `[TypeAlias::hoge]` cannot be resolved, ignoring it... - --> $DIR/intra-doc-alias-ice.rs:15:30 + --> $DIR/intra-doc-alias-ice.rs:5:30 | LL | /// [broken cross-reference](TypeAlias::hoge) //~ ERROR | ^^^^^^^^^^^^^^^ cannot be resolved, ignoring | note: lint level defined here - --> $DIR/intra-doc-alias-ice.rs:11:9 + --> $DIR/intra-doc-alias-ice.rs:1:9 | LL | #![deny(intra_doc_link_resolution_failure)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.rs b/src/test/rustdoc-ui/intra-link-span-ice-55723.rs index 12e59a4813f..5891a553e32 100644 --- a/src/test/rustdoc-ui/intra-link-span-ice-55723.rs +++ b/src/test/rustdoc-ui/intra-link-span-ice-55723.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-end-whitespace #![deny(intra_doc_link_resolution_failure)] @@ -17,8 +7,9 @@ // https://github.com/rust-lang/rust/issues/55723 /// ## For example: -/// +/// /// (arr[i]) +//~^ ERROR `[i]` cannot be resolved, ignoring it... pub fn test_ice() { unimplemented!(); } diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr index 7ae6af4a75e..4eb18610628 100644 --- a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr +++ b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr @@ -1,11 +1,11 @@ error: `[i]` cannot be resolved, ignoring it... - --> $DIR/intra-link-span-ice-55723.rs:21:10 + --> $DIR/intra-link-span-ice-55723.rs:11:10 | LL | /// (arr[i]) | ^ cannot be resolved, ignoring | note: lint level defined here - --> $DIR/intra-link-span-ice-55723.rs:13:9 + --> $DIR/intra-link-span-ice-55723.rs:3:9 | LL | #![deny(intra_doc_link_resolution_failure)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/rustdoc-ui/intra-links-warning-crlf.rs b/src/test/rustdoc-ui/intra-links-warning-crlf.rs new file mode 100644 index 00000000000..20f761fcf4f --- /dev/null +++ b/src/test/rustdoc-ui/intra-links-warning-crlf.rs @@ -0,0 +1,23 @@ +// ignore-tidy-cr + +// compile-pass + +// This file checks the spans of intra-link warnings in a file with CRLF line endings. The +// .gitattributes file in this directory should enforce it. + +/// [error] +pub struct A; + +/// +/// docs [error1] + +/// docs [error2] +/// +pub struct B; + +/** + * This is a multi-line comment. + * + * It also has an [error]. + */ +pub struct C; diff --git a/src/test/rustdoc-ui/intra-links-warning-crlf.stderr b/src/test/rustdoc-ui/intra-links-warning-crlf.stderr new file mode 100644 index 00000000000..62537f2ce2d --- /dev/null +++ b/src/test/rustdoc-ui/intra-links-warning-crlf.stderr @@ -0,0 +1,33 @@ +warning: `[error]` cannot be resolved, ignoring it... + --> $DIR/intra-links-warning-crlf.rs:8:6 + | +LL | /// [error] + | ^^^^^ cannot be resolved, ignoring + | + = note: #[warn(intra_doc_link_resolution_failure)] on by default + = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` + +warning: `[error1]` cannot be resolved, ignoring it... + --> $DIR/intra-links-warning-crlf.rs:12:11 + | +LL | /// docs [error1] + | ^^^^^^ cannot be resolved, ignoring + | + = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` + +warning: `[error2]` cannot be resolved, ignoring it... + --> $DIR/intra-links-warning-crlf.rs:14:11 + | +LL | /// docs [error2] + | ^^^^^^ cannot be resolved, ignoring + | + = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` + +warning: `[error]` cannot be resolved, ignoring it... + --> $DIR/intra-links-warning-crlf.rs:21:20 + | +LL | * It also has an [error]. + | ^^^^^ cannot be resolved, ignoring + | + = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` + diff --git a/src/test/rustdoc-ui/intra-links-warning.rs b/src/test/rustdoc-ui/intra-links-warning.rs index d6bc275b57a..26d4598f7ad 100644 --- a/src/test/rustdoc-ui/intra-links-warning.rs +++ b/src/test/rustdoc-ui/intra-links-warning.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass //! Test with [Foo::baz], [Bar::foo], ... @@ -55,3 +45,33 @@ macro_rules! f { } } f!("Foo\nbar [BarF] bar\nbaz"); + +/** # for example, + * + * time to introduce a link [error]*/ +pub struct A; + +/** + * # for example, + * + * time to introduce a link [error] + */ +pub struct B; + +#[doc = "single line [error]"] +pub struct C; + +#[doc = "single line with \"escaping\" [error]"] +pub struct D; + +/// Item docs. +#[doc="Hello there!"] +/// [error] +pub struct E; + +/// +/// docs [error1] + +/// docs [error2] +/// +pub struct F; diff --git a/src/test/rustdoc-ui/intra-links-warning.stderr b/src/test/rustdoc-ui/intra-links-warning.stderr index c05f99fadc9..e5409c04205 100644 --- a/src/test/rustdoc-ui/intra-links-warning.stderr +++ b/src/test/rustdoc-ui/intra-links-warning.stderr @@ -1,5 +1,5 @@ warning: `[Foo::baz]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:13:23 + --> $DIR/intra-links-warning.rs:3:23 | LL | //! Test with [Foo::baz], [Bar::foo], ... | ^^^^^^^^ cannot be resolved, ignoring @@ -8,7 +8,7 @@ LL | //! Test with [Foo::baz], [Bar::foo], ... = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[Bar::foo]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:13:35 + --> $DIR/intra-links-warning.rs:3:35 | LL | //! Test with [Foo::baz], [Bar::foo], ... | ^^^^^^^^ cannot be resolved, ignoring @@ -16,7 +16,7 @@ LL | //! Test with [Foo::baz], [Bar::foo], ... = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[Uniooon::X]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:14:13 + --> $DIR/intra-links-warning.rs:4:13 | LL | //! , [Uniooon::X] and [Qux::Z]. | ^^^^^^^^^^ cannot be resolved, ignoring @@ -24,7 +24,7 @@ LL | //! , [Uniooon::X] and [Qux::Z]. = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[Qux::Z]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:14:30 + --> $DIR/intra-links-warning.rs:4:30 | LL | //! , [Uniooon::X] and [Qux::Z]. | ^^^^^^ cannot be resolved, ignoring @@ -32,7 +32,7 @@ LL | //! , [Uniooon::X] and [Qux::Z]. = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[Uniooon::X]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:16:14 + --> $DIR/intra-links-warning.rs:6:14 | LL | //! , [Uniooon::X] and [Qux::Z]. | ^^^^^^^^^^ cannot be resolved, ignoring @@ -40,7 +40,7 @@ LL | //! , [Uniooon::X] and [Qux::Z]. = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[Qux::Z]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:16:31 + --> $DIR/intra-links-warning.rs:6:31 | LL | //! , [Uniooon::X] and [Qux::Z]. | ^^^^^^ cannot be resolved, ignoring @@ -48,15 +48,85 @@ LL | //! , [Uniooon::X] and [Qux::Z]. = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[Qux:Y]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:18:13 + --> $DIR/intra-links-warning.rs:8:13 | LL | /// [Qux:Y] | ^^^^^ cannot be resolved, ignoring | = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` +warning: `[error]` cannot be resolved, ignoring it... + --> $DIR/intra-links-warning.rs:51:30 + | +LL | * time to introduce a link [error]*/ + | ^^^^^ cannot be resolved, ignoring + | + = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` + +warning: `[error]` cannot be resolved, ignoring it... + --> $DIR/intra-links-warning.rs:57:30 + | +LL | * time to introduce a link [error] + | ^^^^^ cannot be resolved, ignoring + | + = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` + +warning: `[error]` cannot be resolved, ignoring it... + --> $DIR/intra-links-warning.rs:61:1 + | +LL | #[doc = "single line [error]"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the link appears in this line: + + single line [error] + ^^^^^ + = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` + +warning: `[error]` cannot be resolved, ignoring it... + --> $DIR/intra-links-warning.rs:64:1 + | +LL | #[doc = "single line with /"escaping/" [error]"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: the link appears in this line: + + single line with "escaping" [error] + ^^^^^ + = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` + +warning: `[error]` cannot be resolved, ignoring it... + --> $DIR/intra-links-warning.rs:67:1 + | +LL | / /// Item docs. +LL | | #[doc="Hello there!"] +LL | | /// [error] + | |___________^ + | + = note: the link appears in this line: + + [error] + ^^^^^ + = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` + +warning: `[error1]` cannot be resolved, ignoring it... + --> $DIR/intra-links-warning.rs:73:11 + | +LL | /// docs [error1] + | ^^^^^^ cannot be resolved, ignoring + | + = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` + +warning: `[error2]` cannot be resolved, ignoring it... + --> $DIR/intra-links-warning.rs:75:11 + | +LL | /// docs [error2] + | ^^^^^^ cannot be resolved, ignoring + | + = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` + warning: `[BarA]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:24:10 + --> $DIR/intra-links-warning.rs:14:10 | LL | /// bar [BarA] bar | ^^^^ cannot be resolved, ignoring @@ -64,41 +134,23 @@ LL | /// bar [BarA] bar = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[BarB]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:28:1 + --> $DIR/intra-links-warning.rs:20:9 | -LL | / /** -LL | | * Foo -LL | | * bar [BarB] bar -LL | | * baz -LL | | */ - | |___^ +LL | * bar [BarB] bar + | ^^^^ cannot be resolved, ignoring | - = note: the link appears in this line: - - bar [BarB] bar - ^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[BarC]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:35:1 + --> $DIR/intra-links-warning.rs:27:6 | -LL | / /** Foo -LL | | -LL | | bar [BarC] bar -LL | | baz -... | -LL | | -LL | | */ - | |__^ +LL | bar [BarC] bar + | ^^^^ cannot be resolved, ignoring | - = note: the link appears in this line: - - bar [BarC] bar - ^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[BarD]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:48:1 + --> $DIR/intra-links-warning.rs:38:1 | LL | #[doc = "Foo/nbar [BarD] bar/nbaz"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -110,7 +162,7 @@ LL | #[doc = "Foo/nbar [BarD] bar/nbaz"] = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[BarF]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:53:9 + --> $DIR/intra-links-warning.rs:43:9 | LL | #[doc = $f] | ^^^^^^^^^^^ diff --git a/src/test/rustdoc-ui/invalid-syntax.rs b/src/test/rustdoc-ui/invalid-syntax.rs index 8c790d7d07e..924e0386d31 100644 --- a/src/test/rustdoc-ui/invalid-syntax.rs +++ b/src/test/rustdoc-ui/invalid-syntax.rs @@ -1,17 +1,66 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass -// compile-flags: --error-format=human /// ``` /// \__________pkt->size___________/ \_result->size_/ \__pkt->size__/ /// ``` pub fn foo() {} + +/// ``` +/// | +/// LL | use foobar::Baz; +/// | ^^^^^^ did you mean `baz::foobar`? +/// ``` +pub fn bar() {} + +/// ``` +/// valid +/// ``` +/// +/// ``` +/// \_ +/// ``` +/// +/// ```text +/// "invalid +/// ``` +pub fn valid_and_invalid() {} + +/// This is a normal doc comment, but... +/// +/// There's a code block with bad syntax in it: +/// +/// ```rust +/// \_ +/// ``` +/// +/// Good thing we tested it! +pub fn baz() {} + +/// Indented block start +/// +/// code with bad syntax +/// \_ +/// +/// Indented block end +pub fn quux() {} + +/// Unclosed fence +/// +/// ``` +/// slkdjf +pub fn xyzzy() {} + +/// Indented code that contains a fence +/// +/// ``` +pub fn blah() {} + +/// ```edition2018 +/// \_ +/// ``` +pub fn blargh() {} + +#[doc = "```"] +/// \_ +#[doc = "```"] +pub fn crazy_attrs() {} diff --git a/src/test/rustdoc-ui/invalid-syntax.stderr b/src/test/rustdoc-ui/invalid-syntax.stderr index b5661332e8d..10800380a05 100644 --- a/src/test/rustdoc-ui/invalid-syntax.stderr +++ b/src/test/rustdoc-ui/invalid-syntax.stderr @@ -1,10 +1,97 @@ -Output from rustc: -error: unknown start of token: / - --> :1:1 - | -1 | /__________pkt->size___________/ /_result->size_/ /__pkt->size__/ - | ^ - -warning: Invalid doc comment starting with: `/__________pkt->size___________/ /_result->size_/ /__pkt->size__/` -(Ignoring this codeblock) +warning: could not parse code block as Rust code + --> $DIR/invalid-syntax.rs:3:5 + | +LL | /// ``` + | _____^ +LL | | /// /__________pkt->size___________/ /_result->size_/ /__pkt->size__/ +LL | | /// ``` + | |_______^ + | + = note: error from rustc: unknown start of token: / +help: mark blocks that do not contain Rust code as text + | +LL | /// ```text + | ^^^^^^^ + +warning: could not parse code block as Rust code + --> $DIR/invalid-syntax.rs:8:5 + | +LL | /// ``` + | _____^ +LL | | /// | +LL | | /// LL | use foobar::Baz; +LL | | /// | ^^^^^^ did you mean `baz::foobar`? +LL | | /// ``` + | |_______^ + | + = note: error from rustc: unknown start of token: ` +help: mark blocks that do not contain Rust code as text + | +LL | /// ```text + | ^^^^^^^ + +warning: could not parse code block as Rust code + --> $DIR/invalid-syntax.rs:19:5 + | +LL | /// ``` + | _____^ +LL | | /// /_ +LL | | /// ``` + | |_______^ + | + = note: error from rustc: unknown start of token: / +help: mark blocks that do not contain Rust code as text + | +LL | /// ```text + | ^^^^^^^ + +warning: could not parse code block as Rust code + --> $DIR/invalid-syntax.rs:32:5 + | +LL | /// ```rust + | _____^ +LL | | /// /_ +LL | | /// ``` + | |_______^ + | + = note: error from rustc: unknown start of token: / + +warning: could not parse code block as Rust code + --> $DIR/invalid-syntax.rs:41:9 + | +LL | /// code with bad syntax + | _________^ +LL | | /// /_ + | |__________^ + | + = note: error from rustc: unknown start of token: / + +warning: could not parse code block as Rust code + --> $DIR/invalid-syntax.rs:55:9 + | +LL | /// ``` + | ^^^ + | + = note: error from rustc: unknown start of token: ` + +warning: could not parse code block as Rust code + --> $DIR/invalid-syntax.rs:58:5 + | +LL | /// ```edition2018 + | _____^ +LL | | /// /_ +LL | | /// ``` + | |_______^ + | + = note: error from rustc: unknown start of token: / + +warning: doc comment contains an invalid Rust code block + --> $DIR/invalid-syntax.rs:63:1 + | +LL | / #[doc = "```"] +LL | | /// /_ +LL | | #[doc = "```"] + | |______________^ + | + = help: mark blocks that do not contain Rust code as text: ```text diff --git a/src/test/rustdoc-ui/lint-group.rs b/src/test/rustdoc-ui/lint-group.rs new file mode 100644 index 00000000000..0e0ebd9ce70 --- /dev/null +++ b/src/test/rustdoc-ui/lint-group.rs @@ -0,0 +1,24 @@ +//! Documenting the kinds of lints emitted by rustdoc. +//! +//! ``` +//! println!("sup"); +//! ``` + +#![deny(rustdoc)] + +/// what up, let's make an [error] +/// +/// ``` +/// println!("sup"); +/// ``` +pub fn link_error() {} //~^^^^^ ERROR cannot be resolved, ignoring it + +/// wait, this doesn't have a doctest? +pub fn no_doctest() {} //~^ ERROR Missing code example in this documentation + +/// wait, this *does* have a doctest? +/// +/// ``` +/// println!("sup"); +/// ``` +fn private_doctest() {} //~^^^^^ ERROR Documentation test in private item diff --git a/src/test/rustdoc-ui/lint-group.stderr b/src/test/rustdoc-ui/lint-group.stderr new file mode 100644 index 00000000000..48ae7910b0f --- /dev/null +++ b/src/test/rustdoc-ui/lint-group.stderr @@ -0,0 +1,44 @@ +error: Documentation test in private item + --> $DIR/lint-group.rs:19:1 + | +LL | / /// wait, this *does* have a doctest? +LL | | /// +LL | | /// ``` +LL | | /// println!("sup"); +LL | | /// ``` + | |_______^ + | +note: lint level defined here + --> $DIR/lint-group.rs:7:9 + | +LL | #![deny(rustdoc)] + | ^^^^^^^ + = note: #[deny(private_doc_tests)] implied by #[deny(rustdoc)] + +error: `[error]` cannot be resolved, ignoring it... + --> $DIR/lint-group.rs:9:29 + | +LL | /// what up, let's make an [error] + | ^^^^^ cannot be resolved, ignoring + | +note: lint level defined here + --> $DIR/lint-group.rs:7:9 + | +LL | #![deny(rustdoc)] + | ^^^^^^^ + = note: #[deny(intra_doc_link_resolution_failure)] implied by #[deny(rustdoc)] + = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` + +error: Missing code example in this documentation + --> $DIR/lint-group.rs:16:1 + | +LL | /// wait, this doesn't have a doctest? + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint-group.rs:7:9 + | +LL | #![deny(rustdoc)] + | ^^^^^^^ + = note: #[deny(missing_doc_code_examples)] implied by #[deny(rustdoc)] + diff --git a/src/test/rustdoc-ui/private-item-doc-test.rs b/src/test/rustdoc-ui/private-item-doc-test.rs new file mode 100644 index 00000000000..20ac292aeaf --- /dev/null +++ b/src/test/rustdoc-ui/private-item-doc-test.rs @@ -0,0 +1,11 @@ +#![deny(private_doc_tests)] + +mod foo { + /// private doc test + /// + /// ``` + /// assert!(false); + /// ``` + //~^^^^^ ERROR Documentation test in private item + fn bar() {} +} diff --git a/src/test/rustdoc-ui/private-item-doc-test.stderr b/src/test/rustdoc-ui/private-item-doc-test.stderr new file mode 100644 index 00000000000..38062758e92 --- /dev/null +++ b/src/test/rustdoc-ui/private-item-doc-test.stderr @@ -0,0 +1,16 @@ +error: Documentation test in private item + --> $DIR/private-item-doc-test.rs:4:5 + | +LL | / /// private doc test +LL | | /// +LL | | /// ``` +LL | | /// assert!(false); +LL | | /// ``` + | |___________^ + | +note: lint level defined here + --> $DIR/private-item-doc-test.rs:1:9 + | +LL | #![deny(private_doc_tests)] + | ^^^^^^^^^^^^^^^^^ + diff --git a/src/test/rustdoc-ui/unused.rs b/src/test/rustdoc-ui/unused.rs index 8b530986392..e82a41b7a7b 100644 --- a/src/test/rustdoc-ui/unused.rs +++ b/src/test/rustdoc-ui/unused.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // This test purpose is to check that unused_imports lint isn't fired diff --git a/src/test/rustdoc/all.rs b/src/test/rustdoc/all.rs index 1969cf859ee..a95d6c46206 100644 --- a/src/test/rustdoc/all.rs +++ b/src/test/rustdoc/all.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/all.html '//a[@href="struct.Struct.html"]' 'Struct' diff --git a/src/test/rustdoc/assoc-consts-version.rs b/src/test/rustdoc/assoc-consts-version.rs new file mode 100644 index 00000000000..c561269cf9a --- /dev/null +++ b/src/test/rustdoc/assoc-consts-version.rs @@ -0,0 +1,16 @@ +// ignore-tidy-linelength + +#![crate_name = "foo"] + +#![feature(staged_api)] + +#![stable(since="1.1.1", feature="rust1")] + +#[stable(since="1.1.1", feature="rust1")] +pub struct SomeStruct; + +impl SomeStruct { + // @has 'foo/struct.SomeStruct.html' '//*[@id="associatedconstant.SOME_CONST"]//div[@class="since"]' '1.1.2' + #[stable(since="1.1.2", feature="rust2")] + pub const SOME_CONST: usize = 0; +} diff --git a/src/test/rustdoc/assoc-consts.rs b/src/test/rustdoc/assoc-consts.rs index 9ace8714918..ee622e74a08 100644 --- a/src/test/rustdoc/assoc-consts.rs +++ b/src/test/rustdoc/assoc-consts.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub trait Foo { // @has assoc_consts/trait.Foo.html '//*[@class="rust trait"]' \ // 'const FOO: usize;' diff --git a/src/test/rustdoc/assoc-item-cast.rs b/src/test/rustdoc/assoc-item-cast.rs index 24f31b5b104..dc62fac6a95 100644 --- a/src/test/rustdoc/assoc-item-cast.rs +++ b/src/test/rustdoc/assoc-item-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // ignore-tidy-linelength diff --git a/src/test/rustdoc/assoc-types.rs b/src/test/rustdoc/assoc-types.rs index d152be33f4c..b708dc0c717 100644 --- a/src/test/rustdoc/assoc-types.rs +++ b/src/test/rustdoc/assoc-types.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![crate_type="lib"] @@ -15,9 +5,9 @@ // @has assoc_types/trait.Index.html pub trait Index { // @has - '//*[@id="associatedtype.Output"]//code' 'type Output: ?Sized' - // @has - '//*[@id="Output.t"]//code' 'type Output: ?Sized' + // @has - '//code[@id="Output.t"]' 'type Output: ?Sized' type Output: ?Sized; - // @has - '//*[@id="index.v"]//code' 'fn index' + // @has - '//code[@id="index.v"]' 'fn index' // @has - '//*[@id="tymethod.index"]//code' \ // "fn index<'a>(&'a self, index: I) -> &'a Self::Output" // @has - '//*[@id="tymethod.index"]//code//a[@href="../assoc_types/trait.Index.html#associatedtype.Output"]' \ diff --git a/src/test/rustdoc/async-fn.rs b/src/test/rustdoc/async-fn.rs index f3d39deef17..a0b6c291260 100644 --- a/src/test/rustdoc/async-fn.rs +++ b/src/test/rustdoc/async-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // compile-flags:-Z unstable-options diff --git a/src/test/rustdoc/attributes.rs b/src/test/rustdoc/attributes.rs index 22e50900113..eb0e3f065c7 100644 --- a/src/test/rustdoc/attributes.rs +++ b/src/test/rustdoc/attributes.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/fn.f.html '//*[@class="docblock attributes"]' '#[no_mangle]' diff --git a/src/test/rustdoc/auto-impl-for-trait.rs b/src/test/rustdoc/auto-impl-for-trait.rs index 3cd6e7aa4b3..bc658fbfc8c 100644 --- a/src/test/rustdoc/auto-impl-for-trait.rs +++ b/src/test/rustdoc/auto-impl-for-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for https://github.com/rust-lang/rust/issues/48463 issue. use std::any::Any; diff --git a/src/test/rustdoc/auto-impl-primitive.rs b/src/test/rustdoc/auto-impl-primitive.rs index a3887b33cc2..83631b89f28 100644 --- a/src/test/rustdoc/auto-impl-primitive.rs +++ b/src/test/rustdoc/auto-impl-primitive.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub use std::fs::File; diff --git a/src/test/rustdoc/auto-traits.rs b/src/test/rustdoc/auto-traits.rs index 1753c0ebf73..a1fa611994f 100644 --- a/src/test/rustdoc/auto-traits.rs +++ b/src/test/rustdoc/auto-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:auto-traits.rs #![feature(optin_builtin_traits)] diff --git a/src/test/rustdoc/auxiliary/all-item-types.rs b/src/test/rustdoc/auxiliary/all-item-types.rs index 19a0b88ce7d..f94bd998717 100644 --- a/src/test/rustdoc/auxiliary/all-item-types.rs +++ b/src/test/rustdoc/auxiliary/all-item-types.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(extern_types)] pub mod foo_mod {} diff --git a/src/test/rustdoc/auxiliary/auto-traits.rs b/src/test/rustdoc/auxiliary/auto-traits.rs index 70299334b46..f5221061388 100644 --- a/src/test/rustdoc/auxiliary/auto-traits.rs +++ b/src/test/rustdoc/auxiliary/auto-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] pub unsafe auto trait Bar {} diff --git a/src/test/rustdoc/auxiliary/empty.rs b/src/test/rustdoc/auxiliary/empty.rs index 30669470522..d11c69f812a 100644 --- a/src/test/rustdoc/auxiliary/empty.rs +++ b/src/test/rustdoc/auxiliary/empty.rs @@ -1,9 +1 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// intentionally empty diff --git a/src/test/rustdoc/auxiliary/enum_primitive.rs b/src/test/rustdoc/auxiliary/enum_primitive.rs index c265ae44f0d..eff47e8d8dd 100644 --- a/src/test/rustdoc/auxiliary/enum_primitive.rs +++ b/src/test/rustdoc/auxiliary/enum_primitive.rs @@ -19,7 +19,6 @@ // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - //! This crate exports a macro `enum_from_primitive!` that wraps an //! `enum` declaration and automatically adds an implementation of //! `num::FromPrimitive` (reexported here), to allow conversion from @@ -52,7 +51,6 @@ //! } //! ``` - pub mod num_traits { pub trait FromPrimitive: Sized { fn from_i64(n: i64) -> Option; @@ -207,4 +205,3 @@ macro_rules! enum_from_primitive { enum_from_primitive_impl! { $name, $( $( $variant )+ )+ } }; } - diff --git a/src/test/rustdoc/auxiliary/extern-impl-trait.rs b/src/test/rustdoc/auxiliary/extern-impl-trait.rs index ba6c3e95695..dbd54393098 100644 --- a/src/test/rustdoc/auxiliary/extern-impl-trait.rs +++ b/src/test/rustdoc/auxiliary/extern-impl-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo { type Associated; } diff --git a/src/test/rustdoc/auxiliary/extern-links.rs b/src/test/rustdoc/auxiliary/extern-links.rs index 94b7278e990..4a835673a59 100644 --- a/src/test/rustdoc/auxiliary/extern-links.rs +++ b/src/test/rustdoc/auxiliary/extern-links.rs @@ -1,11 +1 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo; diff --git a/src/test/rustdoc/auxiliary/external-cross.rs b/src/test/rustdoc/auxiliary/external-cross.rs index 767fb05313a..473d4ec99f0 100644 --- a/src/test/rustdoc/auxiliary/external-cross.rs +++ b/src/test/rustdoc/auxiliary/external-cross.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(external_doc)] #![deny(missing_doc)] diff --git a/src/test/rustdoc/auxiliary/inline-default-methods.rs b/src/test/rustdoc/auxiliary/inline-default-methods.rs index e21e6ad2043..8a636f44921 100644 --- a/src/test/rustdoc/auxiliary/inline-default-methods.rs +++ b/src/test/rustdoc/auxiliary/inline-default-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux pub trait Foo { diff --git a/src/test/rustdoc/auxiliary/intra-link-extern-crate.rs b/src/test/rustdoc/auxiliary/intra-link-extern-crate.rs index e4a194466cc..db3bb38ada0 100644 --- a/src/test/rustdoc/auxiliary/intra-link-extern-crate.rs +++ b/src/test/rustdoc/auxiliary/intra-link-extern-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="inner"] //! ooh, i'm a rebel just for [kicks] diff --git a/src/test/rustdoc/auxiliary/issue-13698.rs b/src/test/rustdoc/auxiliary/issue-13698.rs index ecddfe99b3b..a65ebfe36a4 100644 --- a/src/test/rustdoc/auxiliary/issue-13698.rs +++ b/src/test/rustdoc/auxiliary/issue-13698.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux pub trait Foo { diff --git a/src/test/rustdoc/auxiliary/issue-15318.rs b/src/test/rustdoc/auxiliary/issue-15318.rs index 145b4df6299..83cc31b587c 100644 --- a/src/test/rustdoc/auxiliary/issue-15318.rs +++ b/src/test/rustdoc/auxiliary/issue-15318.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux #![doc(html_root_url = "http://example.com/")] diff --git a/src/test/rustdoc/auxiliary/issue-17476.rs b/src/test/rustdoc/auxiliary/issue-17476.rs index 644d1634e9d..80c915eb7cf 100644 --- a/src/test/rustdoc/auxiliary/issue-17476.rs +++ b/src/test/rustdoc/auxiliary/issue-17476.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux #![doc(html_root_url = "http://example.com")] diff --git a/src/test/rustdoc/auxiliary/issue-19190-3.rs b/src/test/rustdoc/auxiliary/issue-19190-3.rs index 44621643431..8c526a89a88 100644 --- a/src/test/rustdoc/auxiliary/issue-19190-3.rs +++ b/src/test/rustdoc/auxiliary/issue-19190-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux use std::ops::Deref; diff --git a/src/test/rustdoc/auxiliary/issue-20646.rs b/src/test/rustdoc/auxiliary/issue-20646.rs index 815b78a91d9..8e16f2de0d9 100644 --- a/src/test/rustdoc/auxiliary/issue-20646.rs +++ b/src/test/rustdoc/auxiliary/issue-20646.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux pub trait Trait { diff --git a/src/test/rustdoc/auxiliary/issue-20727.rs b/src/test/rustdoc/auxiliary/issue-20727.rs index 2ec761fad96..7ffc1985b05 100644 --- a/src/test/rustdoc/auxiliary/issue-20727.rs +++ b/src/test/rustdoc/auxiliary/issue-20727.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux pub trait Deref { diff --git a/src/test/rustdoc/auxiliary/issue-21092.rs b/src/test/rustdoc/auxiliary/issue-21092.rs index e906311e3ae..51ab7de1c54 100644 --- a/src/test/rustdoc/auxiliary/issue-21092.rs +++ b/src/test/rustdoc/auxiliary/issue-21092.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux pub trait Foo { diff --git a/src/test/rustdoc/auxiliary/issue-21801.rs b/src/test/rustdoc/auxiliary/issue-21801.rs index f618edec598..732612ff000 100644 --- a/src/test/rustdoc/auxiliary/issue-21801.rs +++ b/src/test/rustdoc/auxiliary/issue-21801.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux pub struct Foo; diff --git a/src/test/rustdoc/auxiliary/issue-22025.rs b/src/test/rustdoc/auxiliary/issue-22025.rs index 35a37e27d91..5346c0e92bd 100644 --- a/src/test/rustdoc/auxiliary/issue-22025.rs +++ b/src/test/rustdoc/auxiliary/issue-22025.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux pub mod foo { diff --git a/src/test/rustdoc/auxiliary/issue-23207-1.rs b/src/test/rustdoc/auxiliary/issue-23207-1.rs index ec9f2004ebf..8531d5f1acd 100644 --- a/src/test/rustdoc/auxiliary/issue-23207-1.rs +++ b/src/test/rustdoc/auxiliary/issue-23207-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod fmt { pub struct Error; } diff --git a/src/test/rustdoc/auxiliary/issue-23207-2.rs b/src/test/rustdoc/auxiliary/issue-23207-2.rs index 5e9c540ab69..e1afb68dc79 100644 --- a/src/test/rustdoc/auxiliary/issue-23207-2.rs +++ b/src/test/rustdoc/auxiliary/issue-23207-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate issue_23207_1; pub mod fmt { diff --git a/src/test/rustdoc/auxiliary/issue-26606-macro.rs b/src/test/rustdoc/auxiliary/issue-26606-macro.rs index 6059a252bce..d60d32526aa 100644 --- a/src/test/rustdoc/auxiliary/issue-26606-macro.rs +++ b/src/test/rustdoc/auxiliary/issue-26606-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! make_item ( ($name: ident) => (pub const $name: usize = 42;) diff --git a/src/test/rustdoc/auxiliary/issue-27362.rs b/src/test/rustdoc/auxiliary/issue-27362.rs index 454f8cb4a51..077bdc33e66 100644 --- a/src/test/rustdoc/auxiliary/issue-27362.rs +++ b/src/test/rustdoc/auxiliary/issue-27362.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux pub const fn foo() {} diff --git a/src/test/rustdoc/auxiliary/issue-28927-1.rs b/src/test/rustdoc/auxiliary/issue-28927-1.rs index abcfb9396f4..688c73428dd 100644 --- a/src/test/rustdoc/auxiliary/issue-28927-1.rs +++ b/src/test/rustdoc/auxiliary/issue-28927-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod detail { pub extern crate issue_28927_2 as inner2; } diff --git a/src/test/rustdoc/auxiliary/issue-28927-2.rs b/src/test/rustdoc/auxiliary/issue-28927-2.rs index c5117005049..7c0937fce20 100644 --- a/src/test/rustdoc/auxiliary/issue-28927-2.rs +++ b/src/test/rustdoc/auxiliary/issue-28927-2.rs @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Baz; diff --git a/src/test/rustdoc/auxiliary/issue-29584.rs b/src/test/rustdoc/auxiliary/issue-29584.rs index 63c79f875ef..a9b8796c0fe 100644 --- a/src/test/rustdoc/auxiliary/issue-29584.rs +++ b/src/test/rustdoc/auxiliary/issue-29584.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux pub struct Foo; diff --git a/src/test/rustdoc/auxiliary/issue-30109-1.rs b/src/test/rustdoc/auxiliary/issue-30109-1.rs index 59f952a0b29..ca05a6a9076 100644 --- a/src/test/rustdoc/auxiliary/issue-30109-1.rs +++ b/src/test/rustdoc/auxiliary/issue-30109-1.rs @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Bar; diff --git a/src/test/rustdoc/auxiliary/issue-34274.rs b/src/test/rustdoc/auxiliary/issue-34274.rs index 72026b60856..b0c3b4f5629 100644 --- a/src/test/rustdoc/auxiliary/issue-34274.rs +++ b/src/test/rustdoc/auxiliary/issue-34274.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { pub fn extern_c_fn(); } diff --git a/src/test/rustdoc/auxiliary/issue-36031.rs b/src/test/rustdoc/auxiliary/issue-36031.rs index 6611cc428b0..da688139e34 100644 --- a/src/test/rustdoc/auxiliary/issue-36031.rs +++ b/src/test/rustdoc/auxiliary/issue-36031.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub trait Foo { const FOO: usize; } diff --git a/src/test/rustdoc/auxiliary/issue-40936.rs b/src/test/rustdoc/auxiliary/issue-40936.rs index 54cc18cca23..b921e520173 100644 --- a/src/test/rustdoc/auxiliary/issue-40936.rs +++ b/src/test/rustdoc/auxiliary/issue-40936.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod outermod { pub mod innermod { pub use super::*; diff --git a/src/test/rustdoc/auxiliary/issue-46727.rs b/src/test/rustdoc/auxiliary/issue-46727.rs index f0869f016e6..30dccfa77b5 100644 --- a/src/test/rustdoc/auxiliary/issue-46727.rs +++ b/src/test/rustdoc/auxiliary/issue-46727.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux pub trait Foo {} diff --git a/src/test/rustdoc/auxiliary/issue-48414.rs b/src/test/rustdoc/auxiliary/issue-48414.rs index 7e0edf76f6a..f442ac72212 100644 --- a/src/test/rustdoc/auxiliary/issue-48414.rs +++ b/src/test/rustdoc/auxiliary/issue-48414.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Woah, this trait links to [OtherTrait](OtherTrait)! pub trait SomeTrait {} diff --git a/src/test/rustdoc/auxiliary/issue-53689.rs b/src/test/rustdoc/auxiliary/issue-53689.rs index 7b7f9013ca3..5003c2c00f4 100644 --- a/src/test/rustdoc/auxiliary/issue-53689.rs +++ b/src/test/rustdoc/auxiliary/issue-53689.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct MyStruct; diff --git a/src/test/rustdoc/auxiliary/masked.rs b/src/test/rustdoc/auxiliary/masked.rs index e0d53a72220..f289359e52a 100644 --- a/src/test/rustdoc/auxiliary/masked.rs +++ b/src/test/rustdoc/auxiliary/masked.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Clone)] pub struct MaskedStruct; diff --git a/src/test/rustdoc/auxiliary/mod-stackoverflow.rs b/src/test/rustdoc/auxiliary/mod-stackoverflow.rs index f03593dbee6..e0b90f180ee 100644 --- a/src/test/rustdoc/auxiliary/mod-stackoverflow.rs +++ b/src/test/rustdoc/auxiliary/mod-stackoverflow.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Cmetadata=aux pub mod tree { diff --git a/src/test/rustdoc/auxiliary/pub-extern-crate.rs b/src/test/rustdoc/auxiliary/pub-extern-crate.rs new file mode 100644 index 00000000000..8c89c8d6c76 --- /dev/null +++ b/src/test/rustdoc/auxiliary/pub-extern-crate.rs @@ -0,0 +1,2 @@ +#![crate_name = "inner"] +pub struct SomeStruct; diff --git a/src/test/rustdoc/auxiliary/pub-use-extern-macros.rs b/src/test/rustdoc/auxiliary/pub-use-extern-macros.rs index 70d174a149d..7934e07339a 100644 --- a/src/test/rustdoc/auxiliary/pub-use-extern-macros.rs +++ b/src/test/rustdoc/auxiliary/pub-use-extern-macros.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![crate_name="macros"] #[macro_export] diff --git a/src/test/rustdoc/auxiliary/reexp_stripped.rs b/src/test/rustdoc/auxiliary/reexp_stripped.rs index 2b061e3997d..ccc3dc11fd1 100644 --- a/src/test/rustdoc/auxiliary/reexp_stripped.rs +++ b/src/test/rustdoc/auxiliary/reexp_stripped.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use private::Quz; pub use hidden::Bar; diff --git a/src/test/rustdoc/auxiliary/rustdoc-default-impl.rs b/src/test/rustdoc/auxiliary/rustdoc-default-impl.rs index c346c7323d3..36e2821c5a8 100644 --- a/src/test/rustdoc/auxiliary/rustdoc-default-impl.rs +++ b/src/test/rustdoc/auxiliary/rustdoc-default-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] pub mod bar { diff --git a/src/test/rustdoc/auxiliary/rustdoc-extern-default-method.rs b/src/test/rustdoc/auxiliary/rustdoc-extern-default-method.rs index 861562753f9..12934238a8e 100644 --- a/src/test/rustdoc/auxiliary/rustdoc-extern-default-method.rs +++ b/src/test/rustdoc/auxiliary/rustdoc-extern-default-method.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub trait Trait { diff --git a/src/test/rustdoc/auxiliary/rustdoc-extern-method.rs b/src/test/rustdoc/auxiliary/rustdoc-extern-method.rs index 96a7a8378b7..e493048d9da 100644 --- a/src/test/rustdoc/auxiliary/rustdoc-extern-method.rs +++ b/src/test/rustdoc/auxiliary/rustdoc-extern-method.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] #![feature(unboxed_closures)] diff --git a/src/test/rustdoc/auxiliary/rustdoc-ffi.rs b/src/test/rustdoc/auxiliary/rustdoc-ffi.rs index e06dbe76dbb..b74d190b526 100644 --- a/src/test/rustdoc/auxiliary/rustdoc-ffi.rs +++ b/src/test/rustdoc/auxiliary/rustdoc-ffi.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] extern "C" { diff --git a/src/test/rustdoc/auxiliary/rustdoc-impl-parts-crosscrate.rs b/src/test/rustdoc/auxiliary/rustdoc-impl-parts-crosscrate.rs index 977d98ca87b..869aebc774a 100644 --- a/src/test/rustdoc/auxiliary/rustdoc-impl-parts-crosscrate.rs +++ b/src/test/rustdoc/auxiliary/rustdoc-impl-parts-crosscrate.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] pub auto trait AnOibit {} diff --git a/src/test/rustdoc/auxiliary/src-links-external.rs b/src/test/rustdoc/auxiliary/src-links-external.rs index 94b7278e990..4a835673a59 100644 --- a/src/test/rustdoc/auxiliary/src-links-external.rs +++ b/src/test/rustdoc/auxiliary/src-links-external.rs @@ -1,11 +1 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo; diff --git a/src/test/rustdoc/auxiliary/unit-return.rs b/src/test/rustdoc/auxiliary/unit-return.rs index 1b30a6a4328..7b9986162c6 100644 --- a/src/test/rustdoc/auxiliary/unit-return.rs +++ b/src/test/rustdoc/auxiliary/unit-return.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn f2(f: F) {} pub fn f3 () + Clone>(f: F) {} diff --git a/src/test/rustdoc/auxiliary/variant-struct.rs b/src/test/rustdoc/auxiliary/variant-struct.rs index d846c0adf61..0f3d2e5f1b7 100644 --- a/src/test/rustdoc/auxiliary/variant-struct.rs +++ b/src/test/rustdoc/auxiliary/variant-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum Foo { Bar { qux: (), diff --git a/src/test/rustdoc/bad-codeblock-syntax.rs b/src/test/rustdoc/bad-codeblock-syntax.rs new file mode 100644 index 00000000000..0ab2f68fcde --- /dev/null +++ b/src/test/rustdoc/bad-codeblock-syntax.rs @@ -0,0 +1,27 @@ +// @has bad_codeblock_syntax/fn.foo.html +// @has - '//*[@class="docblock"]/pre/code' '\_' +/// ``` +/// \_ +/// ``` +pub fn foo() {} + +// @has bad_codeblock_syntax/fn.bar.html +// @has - '//*[@class="docblock"]/pre/code' '`baz::foobar`' +/// ``` +/// `baz::foobar` +/// ``` +pub fn bar() {} + +// @has bad_codeblock_syntax/fn.quux.html +// @has - '//*[@class="docblock"]/pre/code' '\_' +/// ```rust +/// \_ +/// ``` +pub fn quux() {} + +// @has bad_codeblock_syntax/fn.ok.html +// @has - '//*[@class="docblock"]/pre/code[@class="language-text"]' '\_' +/// ```text +/// \_ +/// ``` +pub fn ok() {} diff --git a/src/test/rustdoc/blanket-reexport-item.rs b/src/test/rustdoc/blanket-reexport-item.rs index 355bfa0f2f2..a1db90d7606 100644 --- a/src/test/rustdoc/blanket-reexport-item.rs +++ b/src/test/rustdoc/blanket-reexport-item.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/struct.S.html '//h3[@id="impl-Into"]//code' 'impl Into for T' diff --git a/src/test/rustdoc/cap-lints.rs b/src/test/rustdoc/cap-lints.rs index 39e753daadb..b66f75695f2 100644 --- a/src/test/rustdoc/cap-lints.rs +++ b/src/test/rustdoc/cap-lints.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This should fail a normal compile due to non_camel_case_types, // It should pass a doc-compile as it only needs to type-check and // therefore should not concern itself with the lints. diff --git a/src/test/rustdoc/check-styled-link.rs b/src/test/rustdoc/check-styled-link.rs index 1633711e83d..b479820dfb2 100644 --- a/src/test/rustdoc/check-styled-link.rs +++ b/src/test/rustdoc/check-styled-link.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub struct Foo; diff --git a/src/test/rustdoc/codeblock-title.rs b/src/test/rustdoc/codeblock-title.rs index d6cd5a24d91..2f77929c74e 100644 --- a/src/test/rustdoc/codeblock-title.rs +++ b/src/test/rustdoc/codeblock-title.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // ignore-tidy-linelength diff --git a/src/test/rustdoc/comment-in-doctest.rs b/src/test/rustdoc/comment-in-doctest.rs new file mode 100644 index 00000000000..e4e41bc7ce3 --- /dev/null +++ b/src/test/rustdoc/comment-in-doctest.rs @@ -0,0 +1,20 @@ +// compile-flags:--test + +// comments, both doc comments and regular ones, used to trick rustdoc's doctest parser into +// thinking that everything after it was part of the regular program. combined with the libsyntax +// parser loop failing to detect the manual main function, it would wrap everything in `fn main`, +// which would cause the doctest to fail as the "extern crate" declaration was no longer valid. +// oddly enough, it would pass in 2018 if a crate was in the extern prelude. see +// https://github.com/rust-lang/rust/issues/56727 + +//! ``` +//! // crate: proc-macro-test +//! //! this is a test +//! +//! // used to pull in proc-macro specific items +//! extern crate proc_macro; +//! +//! use proc_macro::TokenStream; +//! +//! # fn main() {} +//! ``` diff --git a/src/test/rustdoc/const-display.rs b/src/test/rustdoc/const-display.rs new file mode 100644 index 00000000000..9df0368c40d --- /dev/null +++ b/src/test/rustdoc/const-display.rs @@ -0,0 +1,32 @@ +#![crate_name = "foo"] + +#![unstable(feature = "humans", + reason = "who ever let humans program computers, we're apparently really bad at it", + issue = "0")] + +#![feature(rustc_const_unstable, const_fn, foo, foo2)] +#![feature(staged_api)] + +// @has 'foo/fn.foo.html' '//pre' 'pub unsafe fn foo() -> u32' +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_const_unstable(feature="foo")] +pub const unsafe fn foo() -> u32 { 42 } + +// @has 'foo/fn.foo2.html' '//pre' 'pub fn foo2() -> u32' +#[unstable(feature = "humans", issue="0")] +pub const fn foo2() -> u32 { 42 } + +// @has 'foo/fn.bar2.html' '//pre' 'pub const fn bar2() -> u32' +#[stable(feature = "rust1", since = "1.0.0")] +pub const fn bar2() -> u32 { 42 } + +// @has 'foo/fn.foo2_gated.html' '//pre' 'pub unsafe fn foo2_gated() -> u32' +#[unstable(feature = "foo2", issue="0")] +pub const unsafe fn foo2_gated() -> u32 { 42 } + +// @has 'foo/fn.bar2_gated.html' '//pre' 'pub const unsafe fn bar2_gated() -> u32' +#[stable(feature = "rust1", since = "1.0.0")] +pub const unsafe fn bar2_gated() -> u32 { 42 } + +// @has 'foo/fn.bar_not_gated.html' '//pre' 'pub unsafe fn bar_not_gated() -> u32' +pub const unsafe fn bar_not_gated() -> u32 { 42 } diff --git a/src/test/rustdoc/const-doc.rs b/src/test/rustdoc/const-doc.rs index b8bded7621e..74ab4af61ac 100644 --- a/src/test/rustdoc/const-doc.rs +++ b/src/test/rustdoc/const-doc.rs @@ -1,14 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::marker::PhantomData; pub struct Foo<'a> { diff --git a/src/test/rustdoc/const-evalutation-ice.rs b/src/test/rustdoc/const-evalutation-ice.rs index 1c04c34ea68..68c7f9c5686 100644 --- a/src/test/rustdoc/const-evalutation-ice.rs +++ b/src/test/rustdoc/const-evalutation-ice.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Just check we don't get an ICE for `N`. use std::cell::Cell; diff --git a/src/test/rustdoc/const-fn.rs b/src/test/rustdoc/const-fn.rs index cb4a5909120..9ea7343e075 100644 --- a/src/test/rustdoc/const-fn.rs +++ b/src/test/rustdoc/const-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/fn.bar.html diff --git a/src/test/rustdoc/const.rs b/src/test/rustdoc/const.rs index 074a211cd08..c33db5809cc 100644 --- a/src/test/rustdoc/const.rs +++ b/src/test/rustdoc/const.rs @@ -1,19 +1,9 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub struct Foo; impl Foo { - // @has const/struct.Foo.html '//*[@id="new.v"]//code' 'const unsafe fn new' + // @has const/struct.Foo.html '//code[@id="new.v"]' 'const unsafe fn new' pub const unsafe fn new() -> Foo { Foo } diff --git a/src/test/rustdoc/constructor-imports.rs b/src/test/rustdoc/constructor-imports.rs index c170eadd3c6..26795c27444 100644 --- a/src/test/rustdoc/constructor-imports.rs +++ b/src/test/rustdoc/constructor-imports.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub mod a { diff --git a/src/test/rustdoc/crate-version.rs b/src/test/rustdoc/crate-version.rs index 07ab5ceedfa..9ea84ac0312 100644 --- a/src/test/rustdoc/crate-version.rs +++ b/src/test/rustdoc/crate-version.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-version=1.3.37 -Z unstable-options // @has 'crate_version/index.html' '//div[@class="block version"]/p' 'Version 1.3.37' diff --git a/src/test/rustdoc/cross-crate-links.rs b/src/test/rustdoc/cross-crate-links.rs index 7ccfb3d9da6..7c736a4cc11 100644 --- a/src/test/rustdoc/cross-crate-links.rs +++ b/src/test/rustdoc/cross-crate-links.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:all-item-types.rs // build-aux-docs diff --git a/src/test/rustdoc/default-impl.rs b/src/test/rustdoc/default-impl.rs index 6153a396634..f11b3b29b93 100644 --- a/src/test/rustdoc/default-impl.rs +++ b/src/test/rustdoc/default-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rustdoc-default-impl.rs // ignore-cross-compile diff --git a/src/test/rustdoc/default-trait-method-link.rs b/src/test/rustdoc/default-trait-method-link.rs index 9cde446eb94..e4f0bdab162 100644 --- a/src/test/rustdoc/default-trait-method-link.rs +++ b/src/test/rustdoc/default-trait-method-link.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/trait.Foo.html '//a[@href="../foo/trait.Foo.html#tymethod.req"]' 'req' diff --git a/src/test/rustdoc/deprecated-future.rs b/src/test/rustdoc/deprecated-future.rs index 6feb98dad09..383afe86cb4 100644 --- a/src/test/rustdoc/deprecated-future.rs +++ b/src/test/rustdoc/deprecated-future.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(deprecated)] // @has deprecated_future/struct.S.html '//*[@class="stab deprecated"]' \ diff --git a/src/test/rustdoc/deprecated-impls.rs b/src/test/rustdoc/deprecated-impls.rs index 3fb83bff916..efd250ce9f0 100644 --- a/src/test/rustdoc/deprecated-impls.rs +++ b/src/test/rustdoc/deprecated-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/struct.Foo0.html diff --git a/src/test/rustdoc/deprecated.rs b/src/test/rustdoc/deprecated.rs index 744304a62c2..ca3f380ed28 100644 --- a/src/test/rustdoc/deprecated.rs +++ b/src/test/rustdoc/deprecated.rs @@ -1,16 +1,28 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(deprecated)] +// @matches deprecated/index.html '//*[@class="docblock-short"]' \ +// '^\[Deprecated\] Deprecated docs' // @has deprecated/struct.S.html '//*[@class="stab deprecated"]' \ // 'Deprecated since 1.0.0: text' +/// Deprecated docs #[deprecated(since = "1.0.0", note = "text")] pub struct S; + +// @matches deprecated/index.html '//*[@class="docblock-short"]' '^Docs' +/// Docs +pub struct T; + +// @matches deprecated/struct.U.html '//*[@class="stab deprecated"]' \ +// 'Deprecated since 1.0.0$' +#[deprecated(since = "1.0.0")] +pub struct U; + +// @matches deprecated/struct.V.html '//*[@class="stab deprecated"]' \ +// 'Deprecated: text$' +#[deprecated(note = "text")] +pub struct V; + +// @matches deprecated/struct.W.html '//*[@class="stab deprecated"]' \ +// 'Deprecated$' +#[deprecated] +pub struct W; diff --git a/src/test/rustdoc/doc-assoc-item.rs b/src/test/rustdoc/doc-assoc-item.rs index 36f44295953..4d5c9f83e1e 100644 --- a/src/test/rustdoc/doc-assoc-item.rs +++ b/src/test/rustdoc/doc-assoc-item.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo { x: T, } diff --git a/src/test/rustdoc/doc-cfg-target-feature.rs b/src/test/rustdoc/doc-cfg-target-feature.rs index ddc5e5bb3f8..f1b000dc823 100644 --- a/src/test/rustdoc/doc-cfg-target-feature.rs +++ b/src/test/rustdoc/doc-cfg-target-feature.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // only-x86_64 // compile-flags:--test // should-fail diff --git a/src/test/rustdoc/doc-cfg.rs b/src/test/rustdoc/doc-cfg.rs index f82dafa2517..aa407b7e926 100644 --- a/src/test/rustdoc/doc-cfg.rs +++ b/src/test/rustdoc/doc-cfg.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(doc_cfg)] #![feature(target_feature, cfg_target_feature)] diff --git a/src/test/rustdoc/doc-proc-macro.rs b/src/test/rustdoc/doc-proc-macro.rs index 01a4a410b03..19172ffa41d 100644 --- a/src/test/rustdoc/doc-proc-macro.rs +++ b/src/test/rustdoc/doc-proc-macro.rs @@ -1,15 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-stage1 - // Issue #52129: ICE when trying to document the `quote` proc-macro from proc_macro // As of this writing, we don't currently attempt to document proc-macros. However, we shouldn't diff --git a/src/test/rustdoc/doc-spotlight.rs b/src/test/rustdoc/doc-spotlight.rs index a570aa2d398..ddd46c3c215 100644 --- a/src/test/rustdoc/doc-spotlight.rs +++ b/src/test/rustdoc/doc-spotlight.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(doc_spotlight)] pub struct Wrapper { diff --git a/src/test/rustdoc/doctest-manual-crate-name.rs b/src/test/rustdoc/doctest-manual-crate-name.rs new file mode 100644 index 00000000000..3a5e3734e14 --- /dev/null +++ b/src/test/rustdoc/doctest-manual-crate-name.rs @@ -0,0 +1,7 @@ +// compile-flags:--test + +//! ``` +//! #![crate_name="asdf"] +//! +//! println!("yo"); +//! ``` diff --git a/src/test/rustdoc/dont-show-const-contents.rs b/src/test/rustdoc/dont-show-const-contents.rs index 1392c62b4ab..656d579e4f3 100644 --- a/src/test/rustdoc/dont-show-const-contents.rs +++ b/src/test/rustdoc/dont-show-const-contents.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the contents of constants are not displayed as part of the // documentation. diff --git a/src/test/rustdoc/double-quote-escape.rs b/src/test/rustdoc/double-quote-escape.rs index 46e2ca8c760..243d8ad7965 100644 --- a/src/test/rustdoc/double-quote-escape.rs +++ b/src/test/rustdoc/double-quote-escape.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // ignore-tidy-linelength diff --git a/src/test/rustdoc/duplicate_impls/impls.rs b/src/test/rustdoc/duplicate_impls/impls.rs index 72e54fe733c..6875ad2726d 100644 --- a/src/test/rustdoc/duplicate_impls/impls.rs +++ b/src/test/rustdoc/duplicate_impls/impls.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo; // just so that `Foo` doesn't show up on `Bar`s sidebar diff --git a/src/test/rustdoc/duplicate_impls/issue-33054.rs b/src/test/rustdoc/duplicate_impls/issue-33054.rs index 43a425d4c5e..3f7cec18563 100644 --- a/src/test/rustdoc/duplicate_impls/issue-33054.rs +++ b/src/test/rustdoc/duplicate_impls/issue-33054.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has issue_33054/impls/struct.Foo.html // @has - '//code' 'impl Foo' // @has - '//code' 'impl Bar for Foo' diff --git a/src/test/rustdoc/edition-doctest.rs b/src/test/rustdoc/edition-doctest.rs index 322d461f854..6de25996bed 100644 --- a/src/test/rustdoc/edition-doctest.rs +++ b/src/test/rustdoc/edition-doctest.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test /// ```rust,edition2018 diff --git a/src/test/rustdoc/edition-flag.rs b/src/test/rustdoc/edition-flag.rs index 3475b657d25..5571245f28d 100644 --- a/src/test/rustdoc/edition-flag.rs +++ b/src/test/rustdoc/edition-flag.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test -Z unstable-options // edition:2018 diff --git a/src/test/rustdoc/empty-mod-private.rs b/src/test/rustdoc/empty-mod-private.rs index 6c6af19be88..12576a1b535 100644 --- a/src/test/rustdoc/empty-mod-private.rs +++ b/src/test/rustdoc/empty-mod-private.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags: --document-private-items diff --git a/src/test/rustdoc/empty-mod-public.rs b/src/test/rustdoc/empty-mod-public.rs index 413fe161424..d097fcf839c 100644 --- a/src/test/rustdoc/empty-mod-public.rs +++ b/src/test/rustdoc/empty-mod-public.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has 'empty_mod_public/index.html' '//a[@href="foo/index.html"]' 'foo' // @has 'empty_mod_public/sidebar-items.js' 'foo' // @matches 'empty_mod_public/foo/index.html' '//h1' 'Module empty_mod_public::foo' diff --git a/src/test/rustdoc/empty-section.rs b/src/test/rustdoc/empty-section.rs index 11a027a13f7..619f2d688a1 100644 --- a/src/test/rustdoc/empty-section.rs +++ b/src/test/rustdoc/empty-section.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] #![feature(optin_builtin_traits)] diff --git a/src/test/rustdoc/escape-deref-methods.rs b/src/test/rustdoc/escape-deref-methods.rs index f31b0ddca9a..a62ad2c4001 100644 --- a/src/test/rustdoc/escape-deref-methods.rs +++ b/src/test/rustdoc/escape-deref-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] use std::ops::{Deref, DerefMut}; diff --git a/src/test/rustdoc/extern-default-method.rs b/src/test/rustdoc/extern-default-method.rs index 10d2884ebae..810c591c53e 100644 --- a/src/test/rustdoc/extern-default-method.rs +++ b/src/test/rustdoc/extern-default-method.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rustdoc-extern-default-method.rs // ignore-cross-compile diff --git a/src/test/rustdoc/extern-html-root-url.rs b/src/test/rustdoc/extern-html-root-url.rs index c8a13bec9d3..674d0305f2e 100644 --- a/src/test/rustdoc/extern-html-root-url.rs +++ b/src/test/rustdoc/extern-html-root-url.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags:-Z unstable-options --extern-html-root-url core=https://example.com/core/0.1.0 diff --git a/src/test/rustdoc/extern-impl-trait.rs b/src/test/rustdoc/extern-impl-trait.rs index 02a8e962fe1..58bd650feb4 100644 --- a/src/test/rustdoc/extern-impl-trait.rs +++ b/src/test/rustdoc/extern-impl-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:extern-impl-trait.rs #![crate_name = "foo"] diff --git a/src/test/rustdoc/extern-impl.rs b/src/test/rustdoc/extern-impl.rs index 5c64b4118c3..f68e10a4d09 100644 --- a/src/test/rustdoc/extern-impl.rs +++ b/src/test/rustdoc/extern-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/struct.Foo.html diff --git a/src/test/rustdoc/extern-links.rs b/src/test/rustdoc/extern-links.rs index c35a5668dce..991f869138d 100644 --- a/src/test/rustdoc/extern-links.rs +++ b/src/test/rustdoc/extern-links.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:extern-links.rs // ignore-cross-compile diff --git a/src/test/rustdoc/extern-method.rs b/src/test/rustdoc/extern-method.rs index c422871867d..7fbe5fe4327 100644 --- a/src/test/rustdoc/extern-method.rs +++ b/src/test/rustdoc/extern-method.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rustdoc-extern-method.rs // ignore-cross-compile diff --git a/src/test/rustdoc/external-cross.rs b/src/test/rustdoc/external-cross.rs index f4a59cee32d..056ed353462 100644 --- a/src/test/rustdoc/external-cross.rs +++ b/src/test/rustdoc/external-cross.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:external-cross.rs // ignore-cross-compile diff --git a/src/test/rustdoc/external-doc.rs b/src/test/rustdoc/external-doc.rs index 07e784a6ccf..4a13f4069c4 100644 --- a/src/test/rustdoc/external-doc.rs +++ b/src/test/rustdoc/external-doc.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(external_doc)] // @has external_doc/struct.CanHasDocs.html diff --git a/src/test/rustdoc/ffi.rs b/src/test/rustdoc/ffi.rs index 8511d461703..8140dfc723c 100644 --- a/src/test/rustdoc/ffi.rs +++ b/src/test/rustdoc/ffi.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rustdoc-ffi.rs // ignore-cross-compile diff --git a/src/test/rustdoc/fn-pointer-arg-name.rs b/src/test/rustdoc/fn-pointer-arg-name.rs index af87f1b4669..4293d849df5 100644 --- a/src/test/rustdoc/fn-pointer-arg-name.rs +++ b/src/test/rustdoc/fn-pointer-arg-name.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/fn.f.html diff --git a/src/test/rustdoc/fn-sidebar.rs b/src/test/rustdoc/fn-sidebar.rs index 4da277a204b..2fe8ebec1c5 100644 --- a/src/test/rustdoc/fn-sidebar.rs +++ b/src/test/rustdoc/fn-sidebar.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/fn.bar.html diff --git a/src/test/rustdoc/force-target-feature.rs b/src/test/rustdoc/force-target-feature.rs index 08f1f06baa3..b6c10e8341b 100644 --- a/src/test/rustdoc/force-target-feature.rs +++ b/src/test/rustdoc/force-target-feature.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // only-x86_64 // compile-flags:--test -C target-feature=+avx // should-fail diff --git a/src/test/rustdoc/foreigntype-reexport.rs b/src/test/rustdoc/foreigntype-reexport.rs index 714222de529..616826ce7b4 100644 --- a/src/test/rustdoc/foreigntype-reexport.rs +++ b/src/test/rustdoc/foreigntype-reexport.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(extern_types)] mod sub { diff --git a/src/test/rustdoc/foreigntype.rs b/src/test/rustdoc/foreigntype.rs index 06447ffaa75..bd8766c0cf1 100644 --- a/src/test/rustdoc/foreigntype.rs +++ b/src/test/rustdoc/foreigntype.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(extern_types)] extern { diff --git a/src/test/rustdoc/generic-impl.rs b/src/test/rustdoc/generic-impl.rs index 46e02ed08e0..03a4d197499 100644 --- a/src/test/rustdoc/generic-impl.rs +++ b/src/test/rustdoc/generic-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] use std::fmt; diff --git a/src/test/rustdoc/hidden-impls.rs b/src/test/rustdoc/hidden-impls.rs index 203c56e9e2e..935bfb26863 100644 --- a/src/test/rustdoc/hidden-impls.rs +++ b/src/test/rustdoc/hidden-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] mod hidden { diff --git a/src/test/rustdoc/hidden-line.rs b/src/test/rustdoc/hidden-line.rs index e05d51c2bac..f2f6173d26d 100644 --- a/src/test/rustdoc/hidden-line.rs +++ b/src/test/rustdoc/hidden-line.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// The '# ' lines should be removed from the output, but the #[derive] should be /// retained. /// diff --git a/src/test/rustdoc/hidden-methods.rs b/src/test/rustdoc/hidden-methods.rs index aea5f44e2a7..27181d489f5 100644 --- a/src/test/rustdoc/hidden-methods.rs +++ b/src/test/rustdoc/hidden-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] #[doc(hidden)] diff --git a/src/test/rustdoc/hidden-trait-struct-impls.rs b/src/test/rustdoc/hidden-trait-struct-impls.rs index d16932828d0..1be956ef393 100644 --- a/src/test/rustdoc/hidden-trait-struct-impls.rs +++ b/src/test/rustdoc/hidden-trait-struct-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] #[doc(hidden)] diff --git a/src/test/rustdoc/impl-disambiguation.rs b/src/test/rustdoc/impl-disambiguation.rs index afe1daf5983..9f553185639 100644 --- a/src/test/rustdoc/impl-disambiguation.rs +++ b/src/test/rustdoc/impl-disambiguation.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub trait Foo {} diff --git a/src/test/rustdoc/impl-everywhere.rs b/src/test/rustdoc/impl-everywhere.rs index 62da6f13942..9d86dd3c29e 100644 --- a/src/test/rustdoc/impl-everywhere.rs +++ b/src/test/rustdoc/impl-everywhere.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub trait Foo {} diff --git a/src/test/rustdoc/impl-parts-crosscrate.rs b/src/test/rustdoc/impl-parts-crosscrate.rs index 1d055ccbead..f9583d1a722 100644 --- a/src/test/rustdoc/impl-parts-crosscrate.rs +++ b/src/test/rustdoc/impl-parts-crosscrate.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rustdoc-impl-parts-crosscrate.rs // ignore-cross-compile diff --git a/src/test/rustdoc/impl-parts.rs b/src/test/rustdoc/impl-parts.rs index 6e472da379c..fbb4e725481 100644 --- a/src/test/rustdoc/impl-parts.rs +++ b/src/test/rustdoc/impl-parts.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] pub auto trait AnOibit {} diff --git a/src/test/rustdoc/index-page.rs b/src/test/rustdoc/index-page.rs index 9d35f8adeac..6998e735297 100644 --- a/src/test/rustdoc/index-page.rs +++ b/src/test/rustdoc/index-page.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z unstable-options --enable-index-page #![crate_name = "foo"] diff --git a/src/test/rustdoc/inline-default-methods.rs b/src/test/rustdoc/inline-default-methods.rs index 055af0160f5..c97644e7f87 100644 --- a/src/test/rustdoc/inline-default-methods.rs +++ b/src/test/rustdoc/inline-default-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:inline-default-methods.rs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/assoc-items.rs b/src/test/rustdoc/inline_cross/assoc-items.rs index 0885f005d13..d4f05bab5ca 100644 --- a/src/test/rustdoc/inline_cross/assoc-items.rs +++ b/src/test/rustdoc/inline_cross/assoc-items.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:assoc-items.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/auxiliary/assoc-items.rs b/src/test/rustdoc/inline_cross/auxiliary/assoc-items.rs index e955526900e..5fa299914f6 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/assoc-items.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/assoc-items.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_type_defaults)] pub struct MyStruct; diff --git a/src/test/rustdoc/inline_cross/auxiliary/cross-glob.rs b/src/test/rustdoc/inline_cross/auxiliary/cross-glob.rs index 5067ce9e9a3..cde7f68ff01 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/cross-glob.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/cross-glob.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "inner"] pub struct SomeStruct; diff --git a/src/test/rustdoc/inline_cross/auxiliary/impl-inline-without-trait.rs b/src/test/rustdoc/inline_cross/auxiliary/impl-inline-without-trait.rs index 5d4adb28cd8..401a6a44af9 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/impl-inline-without-trait.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/impl-inline-without-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait MyTrait { /// docs for my_trait_method fn my_trait_method() {} diff --git a/src/test/rustdoc/inline_cross/auxiliary/issue-33113.rs b/src/test/rustdoc/inline_cross/auxiliary/issue-33113.rs index c476dda2690..4e1f1918e21 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/issue-33113.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/issue-33113.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="bar"] pub trait Bar {} diff --git a/src/test/rustdoc/inline_cross/auxiliary/macro-vis.rs b/src/test/rustdoc/inline_cross/auxiliary/macro-vis.rs index 3fce62529c7..5615a4fdd3d 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/macro-vis.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/macro-vis.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "qwop"] /// (written on a spider's web) Some Macro diff --git a/src/test/rustdoc/inline_cross/auxiliary/macros.rs b/src/test/rustdoc/inline_cross/auxiliary/macros.rs index 39b52d68bf1..6189b018037 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/macros.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/macros.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(staged_api)] #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/test/rustdoc/inline_cross/auxiliary/proc_macro.rs b/src/test/rustdoc/inline_cross/auxiliary/proc_macro.rs index 6aac070c45b..9836b6ba2ed 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/proc_macro.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/proc_macro.rs @@ -1,13 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +// force-host // no-prefer-dynamic #![crate_type="proc-macro"] diff --git a/src/test/rustdoc/inline_cross/auxiliary/renamed-via-module.rs b/src/test/rustdoc/inline_cross/auxiliary/renamed-via-module.rs index 9f7a259a7db..2e529078239 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/renamed-via-module.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/renamed-via-module.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub mod iter { diff --git a/src/test/rustdoc/inline_cross/auxiliary/rustdoc-hidden-sig.rs b/src/test/rustdoc/inline_cross/auxiliary/rustdoc-hidden-sig.rs index e2bc153ce0d..6357b76df0c 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/rustdoc-hidden-sig.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/rustdoc-hidden-sig.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Bar; impl Bar { diff --git a/src/test/rustdoc/inline_cross/auxiliary/rustdoc-hidden.rs b/src/test/rustdoc/inline_cross/auxiliary/rustdoc-hidden.rs index aae3eb84fb5..0c75b3127cf 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/rustdoc-hidden.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/rustdoc-hidden.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[doc(hidden)] pub struct Foo; diff --git a/src/test/rustdoc/inline_cross/auxiliary/rustdoc-nonreachable-impls.rs b/src/test/rustdoc/inline_cross/auxiliary/rustdoc-nonreachable-impls.rs index 5fee36959c2..4e461d3bc37 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/rustdoc-nonreachable-impls.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/rustdoc-nonreachable-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo; pub trait Woof {} diff --git a/src/test/rustdoc/inline_cross/auxiliary/rustdoc-trait-object-impl.rs b/src/test/rustdoc/inline_cross/auxiliary/rustdoc-trait-object-impl.rs index 317262f4175..76913f02cfd 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/rustdoc-trait-object-impl.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/rustdoc-trait-object-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; pub trait Bar {} diff --git a/src/test/rustdoc/inline_cross/auxiliary/trait-vis.rs b/src/test/rustdoc/inline_cross/auxiliary/trait-vis.rs index 7457a5d4899..e5bc7969b5c 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/trait-vis.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/trait-vis.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "inner"] pub struct SomeStruct; diff --git a/src/test/rustdoc/inline_cross/auxiliary/use_crate.rs b/src/test/rustdoc/inline_cross/auxiliary/use_crate.rs index 55202de1981..75efbe0dbe7 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/use_crate.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/use_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod asdf { pub struct SomeStruct; } diff --git a/src/test/rustdoc/inline_cross/auxiliary/use_crate_2.rs b/src/test/rustdoc/inline_cross/auxiliary/use_crate_2.rs index 1f11cbc4da7..25b4c202efe 100644 --- a/src/test/rustdoc/inline_cross/auxiliary/use_crate_2.rs +++ b/src/test/rustdoc/inline_cross/auxiliary/use_crate_2.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct SomethingElse; diff --git a/src/test/rustdoc/inline_cross/cross-glob.rs b/src/test/rustdoc/inline_cross/cross-glob.rs index 21cf158c13b..f97da11a901 100644 --- a/src/test/rustdoc/inline_cross/cross-glob.rs +++ b/src/test/rustdoc/inline_cross/cross-glob.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:cross-glob.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/hidden-use.rs b/src/test/rustdoc/inline_cross/hidden-use.rs index dd668c20362..97715737fd9 100644 --- a/src/test/rustdoc/inline_cross/hidden-use.rs +++ b/src/test/rustdoc/inline_cross/hidden-use.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rustdoc-hidden.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/impl-inline-without-trait.rs b/src/test/rustdoc/inline_cross/impl-inline-without-trait.rs index ea97d9d6ac2..cadeccb60c8 100644 --- a/src/test/rustdoc/inline_cross/impl-inline-without-trait.rs +++ b/src/test/rustdoc/inline_cross/impl-inline-without-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:impl-inline-without-trait.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/inline_hidden.rs b/src/test/rustdoc/inline_cross/inline_hidden.rs index c59b5afd1c4..dcceaadb968 100644 --- a/src/test/rustdoc/inline_cross/inline_hidden.rs +++ b/src/test/rustdoc/inline_cross/inline_hidden.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rustdoc-hidden.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/issue-28480.rs b/src/test/rustdoc/inline_cross/issue-28480.rs index 6b5c5b20147..99f5b900771 100644 --- a/src/test/rustdoc/inline_cross/issue-28480.rs +++ b/src/test/rustdoc/inline_cross/issue-28480.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rustdoc-hidden-sig.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/issue-31948-1.rs b/src/test/rustdoc/inline_cross/issue-31948-1.rs index 677aa529f9f..f47056223fe 100644 --- a/src/test/rustdoc/inline_cross/issue-31948-1.rs +++ b/src/test/rustdoc/inline_cross/issue-31948-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rustdoc-nonreachable-impls.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/issue-31948-2.rs b/src/test/rustdoc/inline_cross/issue-31948-2.rs index 7b42ed378ef..282f0679e98 100644 --- a/src/test/rustdoc/inline_cross/issue-31948-2.rs +++ b/src/test/rustdoc/inline_cross/issue-31948-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rustdoc-nonreachable-impls.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/issue-31948.rs b/src/test/rustdoc/inline_cross/issue-31948.rs index 073e8eb50fb..d5725175e3f 100644 --- a/src/test/rustdoc/inline_cross/issue-31948.rs +++ b/src/test/rustdoc/inline_cross/issue-31948.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rustdoc-nonreachable-impls.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/issue-32881.rs b/src/test/rustdoc/inline_cross/issue-32881.rs index c55a69bcb7b..f783837d060 100644 --- a/src/test/rustdoc/inline_cross/issue-32881.rs +++ b/src/test/rustdoc/inline_cross/issue-32881.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rustdoc-trait-object-impl.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/issue-33113.rs b/src/test/rustdoc/inline_cross/issue-33113.rs index 9ae8fefe730..1e633600aef 100644 --- a/src/test/rustdoc/inline_cross/issue-33113.rs +++ b/src/test/rustdoc/inline_cross/issue-33113.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-33113.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/macro-vis.rs b/src/test/rustdoc/inline_cross/macro-vis.rs index 5467a210bfd..9fefd38ad2c 100644 --- a/src/test/rustdoc/inline_cross/macro-vis.rs +++ b/src/test/rustdoc/inline_cross/macro-vis.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:macro-vis.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/macros.rs b/src/test/rustdoc/inline_cross/macros.rs index 474a1da1875..4e370062385 100644 --- a/src/test/rustdoc/inline_cross/macros.rs +++ b/src/test/rustdoc/inline_cross/macros.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:macros.rs // build-aux-docs @@ -23,5 +13,5 @@ extern crate macros; // @has - '//*[@class="docblock"]' 'docs for my_macro' // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.2.3: text' // @has - '//*[@class="stab unstable"]' 'macro_test' -// @has - '//a/@href' '../src/macros/macros.rs.html#19-21' +// @has - '//a/@href' '../src/macros/macros.rs.html#9-11' pub use macros::my_macro; diff --git a/src/test/rustdoc/inline_cross/proc_macro.rs b/src/test/rustdoc/inline_cross/proc_macro.rs index a879258f82a..e1cdcf49402 100644 --- a/src/test/rustdoc/inline_cross/proc_macro.rs +++ b/src/test/rustdoc/inline_cross/proc_macro.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-stage1 // aux-build:proc_macro.rs // build-aux-docs diff --git a/src/test/rustdoc/inline_cross/renamed-via-module.rs b/src/test/rustdoc/inline_cross/renamed-via-module.rs index a4e01543761..cdedbf07079 100644 --- a/src/test/rustdoc/inline_cross/renamed-via-module.rs +++ b/src/test/rustdoc/inline_cross/renamed-via-module.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:renamed-via-module.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/inline_cross/trait-vis.rs b/src/test/rustdoc/inline_cross/trait-vis.rs index 5b5410b1da4..e6585449cb6 100644 --- a/src/test/rustdoc/inline_cross/trait-vis.rs +++ b/src/test/rustdoc/inline_cross/trait-vis.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:trait-vis.rs extern crate inner; diff --git a/src/test/rustdoc/inline_cross/use_crate.rs b/src/test/rustdoc/inline_cross/use_crate.rs index a98704446ee..f678ba0a46c 100644 --- a/src/test/rustdoc/inline_cross/use_crate.rs +++ b/src/test/rustdoc/inline_cross/use_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:use_crate.rs // aux-build:use_crate_2.rs // build-aux-docs diff --git a/src/test/rustdoc/inline_local/glob-extern-no-defaults.rs b/src/test/rustdoc/inline_local/glob-extern-no-defaults.rs index fd2fdd7b8d3..276e4091c02 100644 --- a/src/test/rustdoc/inline_local/glob-extern-no-defaults.rs +++ b/src/test/rustdoc/inline_local/glob-extern-no-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --no-defaults #![crate_name = "foo"] diff --git a/src/test/rustdoc/inline_local/glob-extern.rs b/src/test/rustdoc/inline_local/glob-extern.rs index cf899d7728c..a23ec3640ee 100644 --- a/src/test/rustdoc/inline_local/glob-extern.rs +++ b/src/test/rustdoc/inline_local/glob-extern.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] mod mod1 { diff --git a/src/test/rustdoc/inline_local/glob-private-no-defaults.rs b/src/test/rustdoc/inline_local/glob-private-no-defaults.rs index 420b60f2aca..ac854ac4320 100644 --- a/src/test/rustdoc/inline_local/glob-private-no-defaults.rs +++ b/src/test/rustdoc/inline_local/glob-private-no-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --no-defaults #![crate_name = "foo"] diff --git a/src/test/rustdoc/inline_local/glob-private.rs b/src/test/rustdoc/inline_local/glob-private.rs index ecc754f012e..d294d590e1b 100644 --- a/src/test/rustdoc/inline_local/glob-private.rs +++ b/src/test/rustdoc/inline_local/glob-private.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] mod mod1 { diff --git a/src/test/rustdoc/inline_local/hidden-use.rs b/src/test/rustdoc/inline_local/hidden-use.rs index 1b1dafcf58b..a972d376aab 100644 --- a/src/test/rustdoc/inline_local/hidden-use.rs +++ b/src/test/rustdoc/inline_local/hidden-use.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod private { pub struct Foo {} } diff --git a/src/test/rustdoc/inline_local/issue-28537.rs b/src/test/rustdoc/inline_local/issue-28537.rs index b38e104b7b4..da9cc4c940d 100644 --- a/src/test/rustdoc/inline_local/issue-28537.rs +++ b/src/test/rustdoc/inline_local/issue-28537.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[doc(hidden)] pub mod foo { pub struct Foo; diff --git a/src/test/rustdoc/inline_local/issue-32343.rs b/src/test/rustdoc/inline_local/issue-32343.rs index a045c9624b1..5620ae0dced 100644 --- a/src/test/rustdoc/inline_local/issue-32343.rs +++ b/src/test/rustdoc/inline_local/issue-32343.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @!has issue_32343/struct.Foo.html // @has issue_32343/index.html // @has - '//code' 'pub use foo::Foo' diff --git a/src/test/rustdoc/inline_local/macro_by_example.rs b/src/test/rustdoc/inline_local/macro_by_example.rs new file mode 100644 index 00000000000..dacc7cfb3cb --- /dev/null +++ b/src/test/rustdoc/inline_local/macro_by_example.rs @@ -0,0 +1,17 @@ +/// docs for foo +#[deprecated(since = "1.2.3", note = "text")] +#[macro_export] +macro_rules! foo { + ($($tt:tt)*) => {} +} + +// @has macro_by_example/macros/index.html +pub mod macros { + // @!has - 'pub use foo as bar;' + // @has macro_by_example/macros/macro.bar.html + // @has - '//*[@class="docblock"]' 'docs for foo' + // @has - '//*[@class="stab deprecated"]' 'Deprecated since 1.2.3: text' + // @has - '//a/@href' 'macro_by_example.rs.html#4-6' + #[doc(inline)] + pub use foo as bar; +} diff --git a/src/test/rustdoc/inline_local/please_inline.rs b/src/test/rustdoc/inline_local/please_inline.rs index d237ab8dab0..48539361fbf 100644 --- a/src/test/rustdoc/inline_local/please_inline.rs +++ b/src/test/rustdoc/inline_local/please_inline.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod foo { pub struct Foo; } diff --git a/src/test/rustdoc/inline_local/trait-vis.rs b/src/test/rustdoc/inline_local/trait-vis.rs index 73b1cc2ce8f..a997d1e25f0 100644 --- a/src/test/rustdoc/inline_local/trait-vis.rs +++ b/src/test/rustdoc/inline_local/trait-vis.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait ThisTrait {} mod asdf { diff --git a/src/test/rustdoc/internal.rs b/src/test/rustdoc/internal.rs new file mode 100644 index 00000000000..ba58da138a8 --- /dev/null +++ b/src/test/rustdoc/internal.rs @@ -0,0 +1,10 @@ +// compile-flags: -Z force-unstable-if-unmarked + +// @matches internal/index.html '//*[@class="docblock-short"]' \ +// '^\[Internal\] Docs' +// @has internal/struct.S.html '//*[@class="stab internal"]' \ +// 'This is an internal compiler API. (rustc_private)' +/// Docs +pub struct S; + +fn main() {} diff --git a/src/test/rustdoc/intra-link-extern-crate.rs b/src/test/rustdoc/intra-link-extern-crate.rs index 5666f3bd2f2..bbe3edaea8c 100644 --- a/src/test/rustdoc/intra-link-extern-crate.rs +++ b/src/test/rustdoc/intra-link-extern-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:intra-link-extern-crate.rs // When loading `extern crate` statements, we would pull in their docs at the same time, even diff --git a/src/test/rustdoc/intra-link-in-bodies.rs b/src/test/rustdoc/intra-link-in-bodies.rs index 8c01941234e..4c693907226 100644 --- a/src/test/rustdoc/intra-link-in-bodies.rs +++ b/src/test/rustdoc/intra-link-in-bodies.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // we need to make sure that intra-doc links on trait impls get resolved in the right scope #![deny(intra_doc_link_resolution_failure)] diff --git a/src/test/rustdoc/intra-link-private.rs b/src/test/rustdoc/intra-link-private.rs index dbdfbc4e5ad..c99b4d70684 100644 --- a/src/test/rustdoc/intra-link-private.rs +++ b/src/test/rustdoc/intra-link-private.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Rustdoc would previously report resolution failures on items that weren't in the public docs. // These failures were legitimate, but not truly relevant - the docs in question couldn't be // checked for accuracy anyway. diff --git a/src/test/rustdoc/intra-link-self.rs b/src/test/rustdoc/intra-link-self.rs index 21317f2af42..acf975f5c73 100644 --- a/src/test/rustdoc/intra-link-self.rs +++ b/src/test/rustdoc/intra-link-self.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/index.html '//a/@href' '../foo/struct.Foo.html#method.new' diff --git a/src/test/rustdoc/intra-links.rs b/src/test/rustdoc/intra-links.rs index 81b81a9a141..9139fc51b09 100644 --- a/src/test/rustdoc/intra-links.rs +++ b/src/test/rustdoc/intra-links.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has intra_links/index.html // @has - '//a/@href' '../intra_links/struct.ThisType.html' // @has - '//a/@href' '../intra_links/struct.ThisType.html#method.this_method' diff --git a/src/test/rustdoc/invalid.crate.name.rs b/src/test/rustdoc/invalid.crate.name.rs index 4e4946a60a3..c19713b565a 100644 --- a/src/test/rustdoc/invalid.crate.name.rs +++ b/src/test/rustdoc/invalid.crate.name.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-name foo pub fn foo() {} diff --git a/src/test/rustdoc/issue-12834.rs b/src/test/rustdoc/issue-12834.rs index 30dce27e738..558009e6937 100644 --- a/src/test/rustdoc/issue-12834.rs +++ b/src/test/rustdoc/issue-12834.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that failing to syntax highlight a rust code-block doesn't cause // rustdoc to fail, while still rendering the code-block (without highlighting). diff --git a/src/test/rustdoc/issue-13698.rs b/src/test/rustdoc/issue-13698.rs index b0efee511bc..3046a8a2862 100644 --- a/src/test/rustdoc/issue-13698.rs +++ b/src/test/rustdoc/issue-13698.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-13698.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-15169.rs b/src/test/rustdoc/issue-15169.rs index 6ab848b92db..e525d85e21e 100644 --- a/src/test/rustdoc/issue-15169.rs +++ b/src/test/rustdoc/issue-15169.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has issue_15169/struct.Foo.html '//*[@id="method.eq"]' 'fn eq' #[derive(PartialEq)] pub struct Foo; diff --git a/src/test/rustdoc/issue-15318-2.rs b/src/test/rustdoc/issue-15318-2.rs index 7999af46eeb..1dbfba988ef 100644 --- a/src/test/rustdoc/issue-15318-2.rs +++ b/src/test/rustdoc/issue-15318-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-15318.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-15318-3.rs b/src/test/rustdoc/issue-15318-3.rs index a54824970c7..1f7443a6572 100644 --- a/src/test/rustdoc/issue-15318-3.rs +++ b/src/test/rustdoc/issue-15318-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has issue_15318_3/primitive.pointer.html /// dox diff --git a/src/test/rustdoc/issue-15318.rs b/src/test/rustdoc/issue-15318.rs index bd22548a888..0349fe2854c 100644 --- a/src/test/rustdoc/issue-15318.rs +++ b/src/test/rustdoc/issue-15318.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-15318.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-15347.rs b/src/test/rustdoc/issue-15347.rs index c50df6edd48..fa67da840b7 100644 --- a/src/test/rustdoc/issue-15347.rs +++ b/src/test/rustdoc/issue-15347.rs @@ -1,13 +1,3 @@ -// Copyright 2105 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --no-defaults --passes collapse-docs --passes unindent-comments // @has issue_15347/fn.foo.html diff --git a/src/test/rustdoc/issue-16019.rs b/src/test/rustdoc/issue-16019.rs index 7aae6a05950..239d92378d9 100644 --- a/src/test/rustdoc/issue-16019.rs +++ b/src/test/rustdoc/issue-16019.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! define_struct { ($rounds:expr) => ( struct Struct { diff --git a/src/test/rustdoc/issue-16265-1.rs b/src/test/rustdoc/issue-16265-1.rs index c0b99a627ea..653fd4c5e34 100644 --- a/src/test/rustdoc/issue-16265-1.rs +++ b/src/test/rustdoc/issue-16265-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo; // @has issue_16265_1/traits/index.html '[src]' diff --git a/src/test/rustdoc/issue-16265-2.rs b/src/test/rustdoc/issue-16265-2.rs index 22a8df407e0..00453a36333 100644 --- a/src/test/rustdoc/issue-16265-2.rs +++ b/src/test/rustdoc/issue-16265-2.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // @has issue_16265_2/index.html '[src]' trait Y {} diff --git a/src/test/rustdoc/issue-17476.rs b/src/test/rustdoc/issue-17476.rs index dcd3f2a2ba5..a5b484c985f 100644 --- a/src/test/rustdoc/issue-17476.rs +++ b/src/test/rustdoc/issue-17476.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-17476.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-18199.rs b/src/test/rustdoc/issue-18199.rs index 275947a18a5..bc0c4a56502 100644 --- a/src/test/rustdoc/issue-18199.rs +++ b/src/test/rustdoc/issue-18199.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test #![doc(test(attr(feature(staged_api))))] diff --git a/src/test/rustdoc/issue-19055.rs b/src/test/rustdoc/issue-19055.rs index 609ae22be10..dbaf744dc47 100644 --- a/src/test/rustdoc/issue-19055.rs +++ b/src/test/rustdoc/issue-19055.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has issue_19055/trait.Any.html pub trait Any {} diff --git a/src/test/rustdoc/issue-19181.rs b/src/test/rustdoc/issue-19181.rs index a2935b73596..3dea152fc6e 100644 --- a/src/test/rustdoc/issue-19181.rs +++ b/src/test/rustdoc/issue-19181.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test // rustdoc should not panic when target crate has compilation errors diff --git a/src/test/rustdoc/issue-19190-2.rs b/src/test/rustdoc/issue-19190-2.rs index 5688c5cba0b..b6416e2e5b9 100644 --- a/src/test/rustdoc/issue-19190-2.rs +++ b/src/test/rustdoc/issue-19190-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Deref; pub struct Bar; diff --git a/src/test/rustdoc/issue-19190-3.rs b/src/test/rustdoc/issue-19190-3.rs index be2e15dffc0..f7366302a1e 100644 --- a/src/test/rustdoc/issue-19190-3.rs +++ b/src/test/rustdoc/issue-19190-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-19190-3.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-19190.rs b/src/test/rustdoc/issue-19190.rs index 15f7528b4ba..a7c25538f7c 100644 --- a/src/test/rustdoc/issue-19190.rs +++ b/src/test/rustdoc/issue-19190.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Deref; pub struct Foo; diff --git a/src/test/rustdoc/issue-20175.rs b/src/test/rustdoc/issue-20175.rs index 33ec4b75c41..6a42e2afbf4 100644 --- a/src/test/rustdoc/issue-20175.rs +++ b/src/test/rustdoc/issue-20175.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo { fn foo(&self) {} } diff --git a/src/test/rustdoc/issue-20646.rs b/src/test/rustdoc/issue-20646.rs index 49fac20035f..2589e27f215 100644 --- a/src/test/rustdoc/issue-20646.rs +++ b/src/test/rustdoc/issue-20646.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-20646.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-20727-2.rs b/src/test/rustdoc/issue-20727-2.rs index 1f29a9c9797..7c8b82fbe21 100644 --- a/src/test/rustdoc/issue-20727-2.rs +++ b/src/test/rustdoc/issue-20727-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-20727.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-20727-3.rs b/src/test/rustdoc/issue-20727-3.rs index e4a9dd7e7f1..52032b75aea 100644 --- a/src/test/rustdoc/issue-20727-3.rs +++ b/src/test/rustdoc/issue-20727-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-20727.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-20727-4.rs b/src/test/rustdoc/issue-20727-4.rs index 960e40b0709..84fc6f94a26 100644 --- a/src/test/rustdoc/issue-20727-4.rs +++ b/src/test/rustdoc/issue-20727-4.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-20727.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-20727.rs b/src/test/rustdoc/issue-20727.rs index e38f06c4b31..f7acffcb4e5 100644 --- a/src/test/rustdoc/issue-20727.rs +++ b/src/test/rustdoc/issue-20727.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-20727.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-21092.rs b/src/test/rustdoc/issue-21092.rs index 8c5bda7584c..14f547abd9a 100644 --- a/src/test/rustdoc/issue-21092.rs +++ b/src/test/rustdoc/issue-21092.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-21092.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-21474.rs b/src/test/rustdoc/issue-21474.rs index 553bbeb0cff..4c530f72b8a 100644 --- a/src/test/rustdoc/issue-21474.rs +++ b/src/test/rustdoc/issue-21474.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use inner::*; mod inner { diff --git a/src/test/rustdoc/issue-21801.rs b/src/test/rustdoc/issue-21801.rs index 4e2c77826b6..2a586b6ff6c 100644 --- a/src/test/rustdoc/issue-21801.rs +++ b/src/test/rustdoc/issue-21801.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-21801.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-22025.rs b/src/test/rustdoc/issue-22025.rs index c0e4e673f94..a721a15f463 100644 --- a/src/test/rustdoc/issue-22025.rs +++ b/src/test/rustdoc/issue-22025.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-22025.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-22038.rs b/src/test/rustdoc/issue-22038.rs index 75df5358945..2db42b561f7 100644 --- a/src/test/rustdoc/issue-22038.rs +++ b/src/test/rustdoc/issue-22038.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { // @has issue_22038/fn.foo1.html \ // '//*[@class="rust fn"]' 'pub unsafe extern "C" fn foo1()' diff --git a/src/test/rustdoc/issue-23106.rs b/src/test/rustdoc/issue-23106.rs index bfafc6be67c..8cda2fc3380 100644 --- a/src/test/rustdoc/issue-23106.rs +++ b/src/test/rustdoc/issue-23106.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test /// ``` diff --git a/src/test/rustdoc/issue-23207.rs b/src/test/rustdoc/issue-23207.rs index 4931d158ac3..747c59bba6a 100644 --- a/src/test/rustdoc/issue-23207.rs +++ b/src/test/rustdoc/issue-23207.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-23207-1.rs // aux-build:issue-23207-2.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-23511.rs b/src/test/rustdoc/issue-23511.rs index ee0a5c1aa1b..4972a9fb47f 100644 --- a/src/test/rustdoc/issue-23511.rs +++ b/src/test/rustdoc/issue-23511.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(lang_items)] #![no_std] diff --git a/src/test/rustdoc/issue-23744.rs b/src/test/rustdoc/issue-23744.rs index 25374ac0c74..642817396b2 100644 --- a/src/test/rustdoc/issue-23744.rs +++ b/src/test/rustdoc/issue-23744.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test /// Example of rustdoc incorrectly parsing ```rust,should_panic. diff --git a/src/test/rustdoc/issue-23812.rs b/src/test/rustdoc/issue-23812.rs index 37f6749694c..5dac8d87b08 100644 --- a/src/test/rustdoc/issue-23812.rs +++ b/src/test/rustdoc/issue-23812.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! doc { (#[$outer:meta] mod $i:ident { #![$inner:meta] }) => ( diff --git a/src/test/rustdoc/issue-25001.rs b/src/test/rustdoc/issue-25001.rs index 0b6a8104661..55d8ee39438 100644 --- a/src/test/rustdoc/issue-25001.rs +++ b/src/test/rustdoc/issue-25001.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has issue_25001/struct.Foo.html pub struct Foo(T); @@ -19,17 +9,17 @@ pub trait Bar { impl Foo { // @has - '//*[@id="method.pass"]//code' 'fn pass()' - // @has - '//*[@id="pass.v"]//code' 'fn pass()' + // @has - '//code[@id="pass.v"]' 'fn pass()' pub fn pass() {} } impl Foo { // @has - '//*[@id="method.pass-1"]//code' 'fn pass() -> usize' - // @has - '//*[@id="pass.v-1"]//code' 'fn pass() -> usize' + // @has - '//code[@id="pass.v-1"]' 'fn pass() -> usize' pub fn pass() -> usize { 42 } } impl Foo { // @has - '//*[@id="method.pass-2"]//code' 'fn pass() -> isize' - // @has - '//*[@id="pass.v-2"]//code' 'fn pass() -> isize' + // @has - '//code[@id="pass.v-2"]' 'fn pass() -> isize' pub fn pass() -> isize { 42 } } diff --git a/src/test/rustdoc/issue-25944.rs b/src/test/rustdoc/issue-25944.rs index c22ecb4a22b..49625294bbe 100644 --- a/src/test/rustdoc/issue-25944.rs +++ b/src/test/rustdoc/issue-25944.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test /// ``` diff --git a/src/test/rustdoc/issue-26606.rs b/src/test/rustdoc/issue-26606.rs index 12de7665451..6de419ec571 100644 --- a/src/test/rustdoc/issue-26606.rs +++ b/src/test/rustdoc/issue-26606.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-26606-macro.rs // ignore-cross-compile // build-aux-docs diff --git a/src/test/rustdoc/issue-26995.rs b/src/test/rustdoc/issue-26995.rs index bfb440a1839..fedc9f51749 100644 --- a/src/test/rustdoc/issue-26995.rs +++ b/src/test/rustdoc/issue-26995.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows // compile-flags: --no-defaults diff --git a/src/test/rustdoc/issue-27104.rs b/src/test/rustdoc/issue-27104.rs index 5fa093d8f29..b74c3eb78ac 100644 --- a/src/test/rustdoc/issue-27104.rs +++ b/src/test/rustdoc/issue-27104.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--no-defaults --passes strip-priv-imports // aux-build:empty.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-27362.rs b/src/test/rustdoc/issue-27362.rs index b28fb7ec47a..3f3878350d5 100644 --- a/src/test/rustdoc/issue-27362.rs +++ b/src/test/rustdoc/issue-27362.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-27362.rs // ignore-cross-compile // ignore-test This test fails on beta/stable #32019 diff --git a/src/test/rustdoc/issue-27759.rs b/src/test/rustdoc/issue-27759.rs index e82e93230aa..f3739dafdf2 100644 --- a/src/test/rustdoc/issue-27759.rs +++ b/src/test/rustdoc/issue-27759.rs @@ -1,26 +1,14 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(staged_api)] #![doc(issue_tracker_base_url = "http://issue_url/")] #![unstable(feature="test", issue="27759")] // @has issue_27759/unstable/index.html -// @has - 'test ' -// @has - '#27759' +// @has - 'test #27759' #[unstable(feature="test", issue="27759")] pub mod unstable { // @has issue_27759/unstable/fn.issue.html - // @has - 'test_function ' - // @has - '#1234567890' - #[unstable(feature="test_function", issue="1234567890")] + // @has - 'test_function #12345' + #[unstable(feature="test_function", issue="12345")] pub fn issue() {} } diff --git a/src/test/rustdoc/issue-27862.rs b/src/test/rustdoc/issue-27862.rs index 6b56585ae8a..ce3978e7e9a 100644 --- a/src/test/rustdoc/issue-27862.rs +++ b/src/test/rustdoc/issue-27862.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - /// Test | Table /// ------|------------- /// t = b | id = \|x\| x diff --git a/src/test/rustdoc/issue-28478.rs b/src/test/rustdoc/issue-28478.rs index cf4ebba4c32..4cc40560254 100644 --- a/src/test/rustdoc/issue-28478.rs +++ b/src/test/rustdoc/issue-28478.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_type_defaults)] // @has issue_28478/trait.Bar.html diff --git a/src/test/rustdoc/issue-28927.rs b/src/test/rustdoc/issue-28927.rs index b3096a94962..7b535f33bf7 100644 --- a/src/test/rustdoc/issue-28927.rs +++ b/src/test/rustdoc/issue-28927.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-28927-2.rs // aux-build:issue-28927-1.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-29449.rs b/src/test/rustdoc/issue-29449.rs index f296048e30b..0d829cf6fcf 100644 --- a/src/test/rustdoc/issue-29449.rs +++ b/src/test/rustdoc/issue-29449.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has issue_29449/struct.Foo.html pub struct Foo; diff --git a/src/test/rustdoc/issue-29503.rs b/src/test/rustdoc/issue-29503.rs index 104e8d62f19..d7e0f37b286 100644 --- a/src/test/rustdoc/issue-29503.rs +++ b/src/test/rustdoc/issue-29503.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength use std::fmt; diff --git a/src/test/rustdoc/issue-29584.rs b/src/test/rustdoc/issue-29584.rs index 0b5ef7fca8e..28e1efec608 100644 --- a/src/test/rustdoc/issue-29584.rs +++ b/src/test/rustdoc/issue-29584.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-29584.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-30109.rs b/src/test/rustdoc/issue-30109.rs index 2d33e9323d1..e9447538ad7 100644 --- a/src/test/rustdoc/issue-30109.rs +++ b/src/test/rustdoc/issue-30109.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // build-aux-docs // aux-build:issue-30109-1.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-30252.rs b/src/test/rustdoc/issue-30252.rs index 11d161fe188..c3777362a66 100644 --- a/src/test/rustdoc/issue-30252.rs +++ b/src/test/rustdoc/issue-30252.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test --cfg feature="bar" /// ```rust diff --git a/src/test/rustdoc/issue-30366.rs b/src/test/rustdoc/issue-30366.rs index e622257b8f0..c6274a058b0 100644 --- a/src/test/rustdoc/issue-30366.rs +++ b/src/test/rustdoc/issue-30366.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has issue_30366/index.html '//a/@href' 'http://www.rust-lang.org/' /// Describe it. [Link somewhere][1]. diff --git a/src/test/rustdoc/issue-31808.rs b/src/test/rustdoc/issue-31808.rs index 20105babfd9..e55c5bd4f7c 100644 --- a/src/test/rustdoc/issue-31808.rs +++ b/src/test/rustdoc/issue-31808.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that associated item impls on primitive types don't crash rustdoc pub trait Foo { diff --git a/src/test/rustdoc/issue-31899.rs b/src/test/rustdoc/issue-31899.rs index 0722dc4e052..e7a8ee239e2 100644 --- a/src/test/rustdoc/issue-31899.rs +++ b/src/test/rustdoc/issue-31899.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // @has issue_31899/index.html // @has - 'Make this line a bit longer.' // @!has - 'rust rust-example-rendered' diff --git a/src/test/rustdoc/issue-32374.rs b/src/test/rustdoc/issue-32374.rs index 6d1f8bc1cf9..58876a1aa11 100644 --- a/src/test/rustdoc/issue-32374.rs +++ b/src/test/rustdoc/issue-32374.rs @@ -1,27 +1,17 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(staged_api)] #![doc(issue_tracker_base_url = "http://issue_url/")] #![unstable(feature="test", issue = "32374")] -// @has issue_32374/index.html '//*[@class="docblock-short"]' \ -// '[Deprecated] [Experimental]' +// @matches issue_32374/index.html '//*[@class="docblock-short"]' \ +// '^\[Deprecated\] \[Experimental\] Docs' // @has issue_32374/struct.T.html '//*[@class="stab deprecated"]' \ // 'Deprecated since 1.0.0: text' -// @has - 'test ' -// @has - '#32374' +// @has - 'test #32374' // @matches issue_32374/struct.T.html '//*[@class="stab unstable"]' \ -// '🔬 This is a nightly-only experimental API. \(test #32374\)$' +// '🔬 This is a nightly-only experimental API. \(test\s#32374\)$' +/// Docs #[rustc_deprecated(since = "1.0.0", reason = "text")] #[unstable(feature = "test", issue = "32374")] pub struct T; diff --git a/src/test/rustdoc/issue-32395.rs b/src/test/rustdoc/issue-32395.rs index 672c8757049..91d18579613 100644 --- a/src/test/rustdoc/issue-32395.rs +++ b/src/test/rustdoc/issue-32395.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:variant-struct.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-32556.rs b/src/test/rustdoc/issue-32556.rs index 3ab138079a1..e1cf1150997 100644 --- a/src/test/rustdoc/issue-32556.rs +++ b/src/test/rustdoc/issue-32556.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// Blah blah blah /// ```ignore (testing rustdoc's handling of ignore) /// bad_assert!(); diff --git a/src/test/rustdoc/issue-32890.rs b/src/test/rustdoc/issue-32890.rs index ef62f12d55e..970954433ec 100644 --- a/src/test/rustdoc/issue-32890.rs +++ b/src/test/rustdoc/issue-32890.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has issue_32890/struct.Foo.html pub struct Foo(T); diff --git a/src/test/rustdoc/issue-33069.rs b/src/test/rustdoc/issue-33069.rs index cd227fdef56..0213a53cab5 100644 --- a/src/test/rustdoc/issue-33069.rs +++ b/src/test/rustdoc/issue-33069.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Bar {} #[doc(hidden)] diff --git a/src/test/rustdoc/issue-33178-1.rs b/src/test/rustdoc/issue-33178-1.rs index a368d6b68b9..4dc425346ab 100644 --- a/src/test/rustdoc/issue-33178-1.rs +++ b/src/test/rustdoc/issue-33178-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:empty.rs // aux-build:variant-struct.rs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-33178.rs b/src/test/rustdoc/issue-33178.rs index 2ecb7d9ec44..1f45fe72391 100644 --- a/src/test/rustdoc/issue-33178.rs +++ b/src/test/rustdoc/issue-33178.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:empty.rs // aux-build:variant-struct.rs // build-aux-docs diff --git a/src/test/rustdoc/issue-33302.rs b/src/test/rustdoc/issue-33302.rs index 538de228424..21356b513ee 100644 --- a/src/test/rustdoc/issue-33302.rs +++ b/src/test/rustdoc/issue-33302.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensure constant and array length values are not taken from source // code, which wreaks havoc with macros. diff --git a/src/test/rustdoc/issue-33592.rs b/src/test/rustdoc/issue-33592.rs index c0de4cc38e4..81450f15c20 100644 --- a/src/test/rustdoc/issue-33592.rs +++ b/src/test/rustdoc/issue-33592.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub trait Foo {} diff --git a/src/test/rustdoc/issue-34025.rs b/src/test/rustdoc/issue-34025.rs index 8c0a7703c91..9b9f21cb316 100644 --- a/src/test/rustdoc/issue-34025.rs +++ b/src/test/rustdoc/issue-34025.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @!has 'foo/sys/index.html' diff --git a/src/test/rustdoc/issue-34274.rs b/src/test/rustdoc/issue-34274.rs index 12f88042161..ce5be84a549 100644 --- a/src/test/rustdoc/issue-34274.rs +++ b/src/test/rustdoc/issue-34274.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-34274.rs // build-aux-docs // ignore-cross-compile @@ -16,5 +6,5 @@ extern crate issue_34274; -// @has foo/fn.extern_c_fn.html '//a/@href' '../src/issue_34274/issue-34274.rs.html#12' +// @has foo/fn.extern_c_fn.html '//a/@href' '../src/issue_34274/issue-34274.rs.html#2' pub use issue_34274::extern_c_fn; diff --git a/src/test/rustdoc/issue-34423.rs b/src/test/rustdoc/issue-34423.rs index 460462d8a66..b429bf8c9ba 100644 --- a/src/test/rustdoc/issue-34423.rs +++ b/src/test/rustdoc/issue-34423.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo; pub trait Bar { diff --git a/src/test/rustdoc/issue-34473.rs b/src/test/rustdoc/issue-34473.rs index a6de638854f..3f824e64044 100644 --- a/src/test/rustdoc/issue-34473.rs +++ b/src/test/rustdoc/issue-34473.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] mod second { diff --git a/src/test/rustdoc/issue-34928.rs b/src/test/rustdoc/issue-34928.rs index b2104a0c80f..4184086f622 100644 --- a/src/test/rustdoc/issue-34928.rs +++ b/src/test/rustdoc/issue-34928.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub trait Bar {} diff --git a/src/test/rustdoc/issue-35169-2.rs b/src/test/rustdoc/issue-35169-2.rs index b19fbaa5b95..0caead100d6 100644 --- a/src/test/rustdoc/issue-35169-2.rs +++ b/src/test/rustdoc/issue-35169-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Deref; use std::ops::DerefMut; diff --git a/src/test/rustdoc/issue-35169.rs b/src/test/rustdoc/issue-35169.rs index 95231f282e3..0978b103076 100644 --- a/src/test/rustdoc/issue-35169.rs +++ b/src/test/rustdoc/issue-35169.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Deref; pub struct Foo; diff --git a/src/test/rustdoc/issue-35488.rs b/src/test/rustdoc/issue-35488.rs index f24166a65f0..c1bf9ceeac1 100644 --- a/src/test/rustdoc/issue-35488.rs +++ b/src/test/rustdoc/issue-35488.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub enum Foo { Bar, diff --git a/src/test/rustdoc/issue-36031.rs b/src/test/rustdoc/issue-36031.rs index b025230f918..af1b32fd22b 100644 --- a/src/test/rustdoc/issue-36031.rs +++ b/src/test/rustdoc/issue-36031.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-36031.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/issue-38129.rs b/src/test/rustdoc/issue-38129.rs index 00ccc74d887..bf9d5e43304 100644 --- a/src/test/rustdoc/issue-38129.rs +++ b/src/test/rustdoc/issue-38129.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test // This file tests the source-partitioning behavior of rustdoc. diff --git a/src/test/rustdoc/issue-38219.rs b/src/test/rustdoc/issue-38219.rs index 19b338bf560..fa57c58c761 100644 --- a/src/test/rustdoc/issue-38219.rs +++ b/src/test/rustdoc/issue-38219.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test // should-fail diff --git a/src/test/rustdoc/issue-40936.rs b/src/test/rustdoc/issue-40936.rs index 3e02eec1b9c..4d2e4c17b1f 100644 --- a/src/test/rustdoc/issue-40936.rs +++ b/src/test/rustdoc/issue-40936.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-40936.rs // build-aux-docs diff --git a/src/test/rustdoc/issue-41783.rs b/src/test/rustdoc/issue-41783.rs index 991cf4cf2b3..cb9b9b15389 100644 --- a/src/test/rustdoc/issue-41783.rs +++ b/src/test/rustdoc/issue-41783.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has issue_41783/struct.Foo.html // @!has - 'space' // @!has - 'comment' diff --git a/src/test/rustdoc/issue-42760.rs b/src/test/rustdoc/issue-42760.rs index f5f5c4f97fd..b07dc3f6e96 100644 --- a/src/test/rustdoc/issue-42760.rs +++ b/src/test/rustdoc/issue-42760.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has issue_42760/struct.NonGen.html // @has - '//h1' 'Example' diff --git a/src/test/rustdoc/issue-42875.rs b/src/test/rustdoc/issue-42875.rs index ebf7056755e..292c2077688 100644 --- a/src/test/rustdoc/issue-42875.rs +++ b/src/test/rustdoc/issue-42875.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --no-defaults #![crate_name = "foo"] diff --git a/src/test/rustdoc/issue-43153.rs b/src/test/rustdoc/issue-43153.rs index 6ac341d8b02..0fe680f10af 100644 --- a/src/test/rustdoc/issue-43153.rs +++ b/src/test/rustdoc/issue-43153.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `include!` in a doc test searches relative to the directory in // which the test is declared. diff --git a/src/test/rustdoc/issue-43701.rs b/src/test/rustdoc/issue-43701.rs index 791d8319599..44335e961f9 100644 --- a/src/test/rustdoc/issue-43701.rs +++ b/src/test/rustdoc/issue-43701.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub use std::vec::Vec; diff --git a/src/test/rustdoc/issue-43869.rs b/src/test/rustdoc/issue-43869.rs index a5ed3d892ce..44356848fbf 100644 --- a/src/test/rustdoc/issue-43869.rs +++ b/src/test/rustdoc/issue-43869.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn g() -> impl Iterator { Some(1u8).into_iter() } diff --git a/src/test/rustdoc/issue-43893.rs b/src/test/rustdoc/issue-43893.rs index a5e343ade38..95d55193459 100644 --- a/src/test/rustdoc/issue-43893.rs +++ b/src/test/rustdoc/issue-43893.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cross-compile #![crate_name = "foo"] @@ -15,15 +5,15 @@ pub trait SomeTrait {} pub struct SomeStruct; -// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#19' +// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#9' impl SomeTrait for usize {} -// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#22-24' +// @has foo/trait.SomeTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#12-14' impl SomeTrait for SomeStruct { // deliberately multi-line impl } pub trait AnotherTrait {} -// @has foo/trait.AnotherTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#29' +// @has foo/trait.AnotherTrait.html '//a/@href' '../src/foo/issue-43893.rs.html#19' impl AnotherTrait for T {} diff --git a/src/test/rustdoc/issue-45584.rs b/src/test/rustdoc/issue-45584.rs index b0e64557be2..cd8c275d852 100644 --- a/src/test/rustdoc/issue-45584.rs +++ b/src/test/rustdoc/issue-45584.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub trait Bar {} diff --git a/src/test/rustdoc/issue-46271.rs b/src/test/rustdoc/issue-46271.rs index cc3be08c568..b38ef20c551 100644 --- a/src/test/rustdoc/issue-46271.rs +++ b/src/test/rustdoc/issue-46271.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // hopefully this doesn't cause an ICE pub fn foo() { diff --git a/src/test/rustdoc/issue-46377.rs b/src/test/rustdoc/issue-46377.rs index db8c7660df1..236afb20be5 100644 --- a/src/test/rustdoc/issue-46377.rs +++ b/src/test/rustdoc/issue-46377.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has 'issue_46377/index.html' '//*[@class="docblock-short"]' 'Check out this struct!' /// # Check out this struct! pub struct SomeStruct; diff --git a/src/test/rustdoc/issue-46380-2.rs b/src/test/rustdoc/issue-46380-2.rs index 22408d3522a..7004d18dc66 100644 --- a/src/test/rustdoc/issue-46380-2.rs +++ b/src/test/rustdoc/issue-46380-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait PublicTrait {} // @has issue_46380_2/struct.PublicStruct.html diff --git a/src/test/rustdoc/issue-46380.rs b/src/test/rustdoc/issue-46380.rs index 85f29ec4b02..8837a6b463e 100644 --- a/src/test/rustdoc/issue-46380.rs +++ b/src/test/rustdoc/issue-46380.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --document-private-items // @has issue_46380/struct.Hidden.html diff --git a/src/test/rustdoc/issue-46727.rs b/src/test/rustdoc/issue-46727.rs index 5b202d8c4fe..0f991cf676f 100644 --- a/src/test/rustdoc/issue-46727.rs +++ b/src/test/rustdoc/issue-46727.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-46727.rs extern crate issue_46727; diff --git a/src/test/rustdoc/issue-46766.rs b/src/test/rustdoc/issue-46766.rs index cf2dd58f45b..36ab739565b 100644 --- a/src/test/rustdoc/issue-46766.rs +++ b/src/test/rustdoc/issue-46766.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub enum Enum{Variant} diff --git a/src/test/rustdoc/issue-46767.rs b/src/test/rustdoc/issue-46767.rs index 1e6b697cd5f..ef6ed104b74 100644 --- a/src/test/rustdoc/issue-46767.rs +++ b/src/test/rustdoc/issue-46767.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] mod private { diff --git a/src/test/rustdoc/issue-46976.rs b/src/test/rustdoc/issue-46976.rs index ce09f62a552..c59f8c72e64 100644 --- a/src/test/rustdoc/issue-46976.rs +++ b/src/test/rustdoc/issue-46976.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn ice(f: impl Fn()) {} diff --git a/src/test/rustdoc/issue-47038.rs b/src/test/rustdoc/issue-47038.rs index 453cd663d2c..810ddca3eab 100644 --- a/src/test/rustdoc/issue-47038.rs +++ b/src/test/rustdoc/issue-47038.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] #![crate_name = "foo"] diff --git a/src/test/rustdoc/issue-47197-blank-line-in-doc-block.rs b/src/test/rustdoc/issue-47197-blank-line-in-doc-block.rs index 8c4d9845f56..19994475de2 100644 --- a/src/test/rustdoc/issue-47197-blank-line-in-doc-block.rs +++ b/src/test/rustdoc/issue-47197-blank-line-in-doc-block.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has issue_47197_blank_line_in_doc_block/fn.whose_woods_these_are_i_think_i_know.html /** diff --git a/src/test/rustdoc/issue-47639.rs b/src/test/rustdoc/issue-47639.rs index 167c3aaec4a..4b3456b86c5 100644 --- a/src/test/rustdoc/issue-47639.rs +++ b/src/test/rustdoc/issue-47639.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This should not ICE pub fn test() { macro_rules! foo { diff --git a/src/test/rustdoc/issue-48377.rs b/src/test/rustdoc/issue-48377.rs index d098b1a5b02..c32bcf380ea 100644 --- a/src/test/rustdoc/issue-48377.rs +++ b/src/test/rustdoc/issue-48377.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test //! This is a doc comment diff --git a/src/test/rustdoc/issue-48414.rs b/src/test/rustdoc/issue-48414.rs index 0136f9c4759..b35743d887b 100644 --- a/src/test/rustdoc/issue-48414.rs +++ b/src/test/rustdoc/issue-48414.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-48414.rs // ICE when resolving paths for a trait that linked to another trait, when both were in an external diff --git a/src/test/rustdoc/issue-50159.rs b/src/test/rustdoc/issue-50159.rs new file mode 100644 index 00000000000..d175c82ec87 --- /dev/null +++ b/src/test/rustdoc/issue-50159.rs @@ -0,0 +1,20 @@ +pub trait Signal { + type Item; +} + +pub trait Signal2 { + type Item2; +} + +impl Signal2 for B where B: Signal { + type Item2 = C; +} + +// @has issue_50159/struct.Switch.html +// @has - '//code' 'impl Send for Switch where ::Item: Send' +// @has - '//code' 'impl Sync for Switch where ::Item: Sync' +// @count - '//*[@id="implementations-list"]/*[@class="impl"]' 0 +// @count - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]' 2 +pub struct Switch { + pub inner: ::Item2, +} diff --git a/src/test/rustdoc/issue-51236.rs b/src/test/rustdoc/issue-51236.rs index 541a1c5e19f..d9accf9c599 100644 --- a/src/test/rustdoc/issue-51236.rs +++ b/src/test/rustdoc/issue-51236.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker::PhantomData; pub mod traits { @@ -17,7 +7,7 @@ pub mod traits { } // @has issue_51236/struct.Owned.html -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl Send for \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl Send for \ // Owned where >::Reader: Send" pub struct Owned where T: for<'a> ::traits::Owned<'a> { marker: PhantomData<>::Reader>, diff --git a/src/test/rustdoc/issue-53689.rs b/src/test/rustdoc/issue-53689.rs index bfe5adf8888..7fe962c5061 100644 --- a/src/test/rustdoc/issue-53689.rs +++ b/src/test/rustdoc/issue-53689.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-53689.rs #![crate_name = "foo"] diff --git a/src/test/rustdoc/issue-53812.rs b/src/test/rustdoc/issue-53812.rs index 60d19fbcd1a..3ebf154077f 100644 --- a/src/test/rustdoc/issue-53812.rs +++ b/src/test/rustdoc/issue-53812.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait MyIterator { } diff --git a/src/test/rustdoc/issue-54705.rs b/src/test/rustdoc/issue-54705.rs index ccc939657a1..263b1eb0bd6 100644 --- a/src/test/rustdoc/issue-54705.rs +++ b/src/test/rustdoc/issue-54705.rs @@ -1,23 +1,12 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub trait ScopeHandle<'scope> {} // @has issue_54705/struct.ScopeFutureContents.html -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'scope, S> \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl<'scope, S> \ // Send for ScopeFutureContents<'scope, S> where S: Sync" // -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'scope, S> \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl<'scope, S> \ // Sync for ScopeFutureContents<'scope, S> where S: Sync" pub struct ScopeFutureContents<'scope, S> where S: ScopeHandle<'scope>, diff --git a/src/test/rustdoc/issue-55321.rs b/src/test/rustdoc/issue-55321.rs index f6ba7c7be17..257cb32c65c 100644 --- a/src/test/rustdoc/issue-55321.rs +++ b/src/test/rustdoc/issue-55321.rs @@ -1,27 +1,16 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(optin_builtin_traits)] // @has issue_55321/struct.A.html -// @has - '//*[@id="implementations-list"]/*[@class="impl"]//*/code' "impl !Send for A" -// @has - '//*[@id="implementations-list"]/*[@class="impl"]//*/code' "impl !Sync for A" +// @has - '//*[@id="implementations-list"]/*[@class="impl"]//code' "impl !Send for A" +// @has - '//*[@id="implementations-list"]/*[@class="impl"]//code' "impl !Sync for A" pub struct A(); impl !Send for A {} impl !Sync for A {} // @has issue_55321/struct.B.html -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl !Send for \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl !Send for \ // B" -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl !Sync for \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl !Sync for \ // B" pub struct B(A, Box); diff --git a/src/test/rustdoc/issue-56701.rs b/src/test/rustdoc/issue-56701.rs new file mode 100644 index 00000000000..6fb30a4ff4c --- /dev/null +++ b/src/test/rustdoc/issue-56701.rs @@ -0,0 +1,34 @@ +// This shouldn't cause a stack overflow when rustdoc is run + +use std::ops::Deref; +use std::ops::DerefMut; + +pub trait SimpleTrait { + type SimpleT; +} + +impl> SimpleTrait for Outer { + type SimpleT = Inner::SimpleT; +} + +pub trait AnotherTrait { + type AnotherT; +} + +impl>> AnotherTrait for Simple { + type AnotherT = T; +} + +pub struct Unrelated>>(UnrelatedT); + +impl>> Deref for Unrelated { + type Target = Vec; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + + +pub fn main() { } + diff --git a/src/test/rustdoc/issue-56822.rs b/src/test/rustdoc/issue-56822.rs new file mode 100644 index 00000000000..5b67817fa4c --- /dev/null +++ b/src/test/rustdoc/issue-56822.rs @@ -0,0 +1,24 @@ +struct Wrapper(T); + +trait MyTrait { + type Output; +} + +impl<'a, I, T: 'a> MyTrait for Wrapper + where I: MyTrait +{ + type Output = T; +} + +struct Inner<'a, T>(&'a T); + +impl<'a, T> MyTrait for Inner<'a, T> { + type Output = &'a T; +} + +// @has issue_56822/struct.Parser.html +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl<'a> Send for \ +// Parser<'a>" +pub struct Parser<'a> { + field: > as MyTrait>::Output +} diff --git a/src/test/rustdoc/keyword.rs b/src/test/rustdoc/keyword.rs index 73a026c581b..d3327ae7ae1 100644 --- a/src/test/rustdoc/keyword.rs +++ b/src/test/rustdoc/keyword.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] #![feature(doc_keyword)] diff --git a/src/test/rustdoc/line-breaks.rs b/src/test/rustdoc/line-breaks.rs index a1eabb515a5..29c16fcd4f8 100644 --- a/src/test/rustdoc/line-breaks.rs +++ b/src/test/rustdoc/line-breaks.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] use std::ops::Add; diff --git a/src/test/rustdoc/link-assoc-const.rs b/src/test/rustdoc/link-assoc-const.rs index aa7ef07d5c0..f9eb2b722d6 100644 --- a/src/test/rustdoc/link-assoc-const.rs +++ b/src/test/rustdoc/link-assoc-const.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/index.html '//a[@href="../foo/foo/constant.FIRSTCONST.html"]' 'foo::FIRSTCONST' diff --git a/src/test/rustdoc/link-title-escape.rs b/src/test/rustdoc/link-title-escape.rs index e10ff1a9917..29e82cba98d 100644 --- a/src/test/rustdoc/link-title-escape.rs +++ b/src/test/rustdoc/link-title-escape.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] //! hello [foo] diff --git a/src/test/rustdoc/macros.rs b/src/test/rustdoc/macros.rs index 9aeeb71707c..c66a2c845bf 100644 --- a/src/test/rustdoc/macros.rs +++ b/src/test/rustdoc/macros.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has macros/macro.my_macro.html //pre 'macro_rules! my_macro {' // @has - //pre '() => { ... };' // @has - //pre '($a:tt) => { ... };' diff --git a/src/test/rustdoc/manual_impl.rs b/src/test/rustdoc/manual_impl.rs index 949ef118288..c9e4f4e0d30 100644 --- a/src/test/rustdoc/manual_impl.rs +++ b/src/test/rustdoc/manual_impl.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has manual_impl/trait.T.html // @has - '//*[@class="docblock"]' 'Docs associated with the trait definition.' // @has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.' diff --git a/src/test/rustdoc/masked.rs b/src/test/rustdoc/masked.rs index 1f398da84e5..c7ad690d66e 100644 --- a/src/test/rustdoc/masked.rs +++ b/src/test/rustdoc/masked.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:masked.rs #![feature(doc_masked)] diff --git a/src/test/rustdoc/method-list.rs b/src/test/rustdoc/method-list.rs index b7112885e88..f84be3eb3f7 100644 --- a/src/test/rustdoc/method-list.rs +++ b/src/test/rustdoc/method-list.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![crate_name = "foo"] diff --git a/src/test/rustdoc/mod-stackoverflow.rs b/src/test/rustdoc/mod-stackoverflow.rs index 1e2f6dbe780..45b1de2162d 100644 --- a/src/test/rustdoc/mod-stackoverflow.rs +++ b/src/test/rustdoc/mod-stackoverflow.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:mod-stackoverflow.rs // ignore-cross-compile diff --git a/src/test/rustdoc/module-impls.rs b/src/test/rustdoc/module-impls.rs index 7be3c500731..198b3446c61 100644 --- a/src/test/rustdoc/module-impls.rs +++ b/src/test/rustdoc/module-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub use std::marker::Send; diff --git a/src/test/rustdoc/must-use.rs b/src/test/rustdoc/must-use.rs index e293675f5b0..b52557fe220 100644 --- a/src/test/rustdoc/must-use.rs +++ b/src/test/rustdoc/must-use.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has must_use/struct.Struct.html //pre '#[must_use]' #[must_use] pub struct Struct { diff --git a/src/test/rustdoc/namespaces.rs b/src/test/rustdoc/namespaces.rs index ec1bc359ab0..ad828e5ee3e 100644 --- a/src/test/rustdoc/namespaces.rs +++ b/src/test/rustdoc/namespaces.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // issue #34843: rustdoc prioritises documenting reexports from the type namespace mod inner { diff --git a/src/test/rustdoc/negative-impl-sidebar.rs b/src/test/rustdoc/negative-impl-sidebar.rs index dc27b26241d..838ca0402e4 100644 --- a/src/test/rustdoc/negative-impl-sidebar.rs +++ b/src/test/rustdoc/negative-impl-sidebar.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] #![crate_name = "foo"] diff --git a/src/test/rustdoc/negative-impl.rs b/src/test/rustdoc/negative-impl.rs index aadabb15d1d..8ac87f4f0cb 100644 --- a/src/test/rustdoc/negative-impl.rs +++ b/src/test/rustdoc/negative-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] // @matches negative_impl/struct.Alpha.html '//pre' "pub struct Alpha" diff --git a/src/test/rustdoc/no-crate-filter.rs b/src/test/rustdoc/no-crate-filter.rs new file mode 100644 index 00000000000..c694d1456ef --- /dev/null +++ b/src/test/rustdoc/no-crate-filter.rs @@ -0,0 +1,6 @@ +#![crate_name = "foo"] + +// compile-flags: -Z unstable-options --disable-per-crate-search + +// @!has 'foo/struct.Foo.html' '//*[id="crate-search"]' +pub struct Foo; diff --git a/src/test/rustdoc/no-run-still-checks-lints.rs b/src/test/rustdoc/no-run-still-checks-lints.rs index a9df3c3c7f2..9f7d1c8845d 100644 --- a/src/test/rustdoc/no-run-still-checks-lints.rs +++ b/src/test/rustdoc/no-run-still-checks-lints.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test // should-fail diff --git a/src/test/rustdoc/no-stack-overflow-25295.rs b/src/test/rustdoc/no-stack-overflow-25295.rs index 37b0aca4b00..7e5c0279031 100644 --- a/src/test/rustdoc/no-stack-overflow-25295.rs +++ b/src/test/rustdoc/no-stack-overflow-25295.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ensure this code doesn't stack overflow // aux-build:enum_primitive.rs diff --git a/src/test/rustdoc/nul-error.rs b/src/test/rustdoc/nul-error.rs index 2c9d07f190d..3d30f5f6b77 100644 --- a/src/test/rustdoc/nul-error.rs +++ b/src/test/rustdoc/nul-error.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/playground-arg.rs b/src/test/rustdoc/playground-arg.rs index 478477dea61..fb1be7397e6 100644 --- a/src/test/rustdoc/playground-arg.rs +++ b/src/test/rustdoc/playground-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --playground-url=https://example.com/ -Z unstable-options // ignore-tidy-linelength diff --git a/src/test/rustdoc/playground-empty.rs b/src/test/rustdoc/playground-empty.rs index 2b3120fa5b4..7d8bd3ffe0d 100644 --- a/src/test/rustdoc/playground-empty.rs +++ b/src/test/rustdoc/playground-empty.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] #![doc(html_playground_url = "")] diff --git a/src/test/rustdoc/playground-none.rs b/src/test/rustdoc/playground-none.rs index 83c312d7ab2..ff51c68d8a2 100644 --- a/src/test/rustdoc/playground-none.rs +++ b/src/test/rustdoc/playground-none.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] //! module docs diff --git a/src/test/rustdoc/playground.rs b/src/test/rustdoc/playground.rs index 9e7c3aa4901..1b76e6c8853 100644 --- a/src/test/rustdoc/playground.rs +++ b/src/test/rustdoc/playground.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![crate_name = "foo"] diff --git a/src/test/rustdoc/prim-title.rs b/src/test/rustdoc/prim-title.rs index 79a3e7f06be..fa3fd512fad 100644 --- a/src/test/rustdoc/prim-title.rs +++ b/src/test/rustdoc/prim-title.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/primitive.u8.html '//head/title' 'u8 - Rust' diff --git a/src/test/rustdoc/primitive-generic-impl.rs b/src/test/rustdoc/primitive-generic-impl.rs index a771b1b15ce..5794322ba1d 100644 --- a/src/test/rustdoc/primitive-generic-impl.rs +++ b/src/test/rustdoc/primitive-generic-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] include!("primitive/primitive-generic-impl.rs"); diff --git a/src/test/rustdoc/primitive-link.rs b/src/test/rustdoc/primitive-link.rs index b0cf8acc7c0..819ef05174a 100644 --- a/src/test/rustdoc/primitive-link.rs +++ b/src/test/rustdoc/primitive-link.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // ignore-tidy-linelength diff --git a/src/test/rustdoc/primitive/primitive-generic-impl.rs b/src/test/rustdoc/primitive/primitive-generic-impl.rs index 1ac1fc95338..b9c56be0fcf 100644 --- a/src/test/rustdoc/primitive/primitive-generic-impl.rs +++ b/src/test/rustdoc/primitive/primitive-generic-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[doc(primitive = "i32")] /// Some useless docs, wouhou! mod i32 {} diff --git a/src/test/rustdoc/private-type-alias.rs b/src/test/rustdoc/private-type-alias.rs index 63719080001..ec7385404f0 100644 --- a/src/test/rustdoc/private-type-alias.rs +++ b/src/test/rustdoc/private-type-alias.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type MyResultPriv = Result; pub type MyResultPub = Result; diff --git a/src/test/rustdoc/proc-macro.rs b/src/test/rustdoc/proc-macro.rs index bfd194701c8..1e396f1be0e 100644 --- a/src/test/rustdoc/proc-macro.rs +++ b/src/test/rustdoc/proc-macro.rs @@ -1,18 +1,14 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-stage1 +// force-host +// no-prefer-dynamic #![crate_type="proc-macro"] #![crate_name="some_macros"] +// @has some_macros/index.html +// @has - '//a/[@href="attr.some_proc_attr.html"]' 'some_proc_attr' + +//! include a link to [some_proc_attr] to make sure it works. + extern crate proc_macro; use proc_macro::TokenStream; @@ -60,3 +56,16 @@ pub fn some_proc_attr(_attr: TokenStream, item: TokenStream) -> TokenStream { pub fn some_derive(_item: TokenStream) -> TokenStream { TokenStream::new() } + +// @has some_macros/foo/index.html +pub mod foo { + // @has - '//code' 'pub use some_proc_macro;' + // @has - '//a/@href' '../../some_macros/macro.some_proc_macro.html' + pub use some_proc_macro; + // @has - '//code' 'pub use some_proc_attr;' + // @has - '//a/@href' '../../some_macros/attr.some_proc_attr.html' + pub use some_proc_attr; + // @has - '//code' 'pub use some_derive;' + // @has - '//a/@href' '../../some_macros/derive.SomeDerive.html' + pub use some_derive; +} diff --git a/src/test/rustdoc/pub-extern-crate.rs b/src/test/rustdoc/pub-extern-crate.rs new file mode 100644 index 00000000000..26747a4d1ac --- /dev/null +++ b/src/test/rustdoc/pub-extern-crate.rs @@ -0,0 +1,9 @@ +// aux-build:pub-extern-crate.rs + +// @has pub_extern_crate/index.html +// @!has - '//code' 'pub extern crate inner' +// @has - '//a/@href' 'inner/index.html' +// @has pub_extern_crate/inner/index.html +// @has pub_extern_crate/inner/struct.SomeStruct.html +#[doc(inline)] +pub extern crate inner; diff --git a/src/test/rustdoc/pub-method.rs b/src/test/rustdoc/pub-method.rs index 24d566e082e..01e5141fe25 100644 --- a/src/test/rustdoc/pub-method.rs +++ b/src/test/rustdoc/pub-method.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags: --document-private-items diff --git a/src/test/rustdoc/pub-restricted.rs b/src/test/rustdoc/pub-restricted.rs index cc8f628cad4..f75dcc200bd 100644 --- a/src/test/rustdoc/pub-restricted.rs +++ b/src/test/rustdoc/pub-restricted.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // compile-flags: --document-private-items diff --git a/src/test/rustdoc/pub-use-extern-macros.rs b/src/test/rustdoc/pub-use-extern-macros.rs index 48fb9bfd207..eefe6b4b073 100644 --- a/src/test/rustdoc/pub-use-extern-macros.rs +++ b/src/test/rustdoc/pub-use-extern-macros.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:pub-use-extern-macros.rs extern crate macros; diff --git a/src/test/rustdoc/recursion1.rs b/src/test/rustdoc/recursion1.rs index 00f7d90fabc..edf7e440fe7 100644 --- a/src/test/rustdoc/recursion1.rs +++ b/src/test/rustdoc/recursion1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] mod m { diff --git a/src/test/rustdoc/recursion2.rs b/src/test/rustdoc/recursion2.rs index 00f7d90fabc..edf7e440fe7 100644 --- a/src/test/rustdoc/recursion2.rs +++ b/src/test/rustdoc/recursion2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] mod m { diff --git a/src/test/rustdoc/recursion3.rs b/src/test/rustdoc/recursion3.rs index 1d9b903a279..e69b4301646 100644 --- a/src/test/rustdoc/recursion3.rs +++ b/src/test/rustdoc/recursion3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod longhands { pub use super::*; diff --git a/src/test/rustdoc/redirect-const.rs b/src/test/rustdoc/redirect-const.rs index c95e5537c88..453da8387ea 100644 --- a/src/test/rustdoc/redirect-const.rs +++ b/src/test/rustdoc/redirect-const.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="foo"] pub use hidden::STATIC_FOO; diff --git a/src/test/rustdoc/redirect-rename.rs b/src/test/rustdoc/redirect-rename.rs index b7c702dcc1f..7de56080e52 100644 --- a/src/test/rustdoc/redirect-rename.rs +++ b/src/test/rustdoc/redirect-rename.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] mod hidden { diff --git a/src/test/rustdoc/redirect.rs b/src/test/rustdoc/redirect.rs index c20dd815d8c..65c57ab65be 100644 --- a/src/test/rustdoc/redirect.rs +++ b/src/test/rustdoc/redirect.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:reexp_stripped.rs // build-aux-docs // ignore-cross-compile diff --git a/src/test/rustdoc/remove-duplicates.rs b/src/test/rustdoc/remove-duplicates.rs index 6c4f6d0700a..759bf84db62 100644 --- a/src/test/rustdoc/remove-duplicates.rs +++ b/src/test/rustdoc/remove-duplicates.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] mod foo { diff --git a/src/test/rustdoc/rustc-macro-crate.rs b/src/test/rustdoc/rustc-macro-crate.rs index d46f9684411..2f6308b20c2 100644 --- a/src/test/rustdoc/rustc-macro-crate.rs +++ b/src/test/rustdoc/rustc-macro-crate.rs @@ -1,15 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +// force-host // no-prefer-dynamic -// ignore-stage1 #![crate_type = "proc-macro"] diff --git a/src/test/rustdoc/search-index-summaries.rs b/src/test/rustdoc/search-index-summaries.rs index dd195dc33e4..dd9c1a0b47d 100644 --- a/src/test/rustdoc/search-index-summaries.rs +++ b/src/test/rustdoc/search-index-summaries.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has 'search-index.js' 'Foo short link.' diff --git a/src/test/rustdoc/search-index.rs b/src/test/rustdoc/search-index.rs index 70b77f6760d..f1b78f17277 100644 --- a/src/test/rustdoc/search-index.rs +++ b/src/test/rustdoc/search-index.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "rustdoc_test"] use std::ops::Deref; diff --git a/src/test/rustdoc/short-docblock-codeblock.rs b/src/test/rustdoc/short-docblock-codeblock.rs index 060b349c251..fc8d53ccf35 100644 --- a/src/test/rustdoc/short-docblock-codeblock.rs +++ b/src/test/rustdoc/short-docblock-codeblock.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/index.html '//*[@class="module-item"]//td[@class="docblock-short"]' "" diff --git a/src/test/rustdoc/short-dockblock.rs b/src/test/rustdoc/short-dockblock.rs index cb36110b291..5493bca54c5 100644 --- a/src/test/rustdoc/short-dockblock.rs +++ b/src/test/rustdoc/short-dockblock.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/index.html '//*[@class="docblock-short"]/p' 'fooo' diff --git a/src/test/rustdoc/sidebar-items.rs b/src/test/rustdoc/sidebar-items.rs index 3ecd6b63510..3ba6dbacc8d 100644 --- a/src/test/rustdoc/sidebar-items.rs +++ b/src/test/rustdoc/sidebar-items.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/trait.Foo.html diff --git a/src/test/rustdoc/sidebar-link-generation.rs b/src/test/rustdoc/sidebar-link-generation.rs new file mode 100644 index 00000000000..76b77b9bcbb --- /dev/null +++ b/src/test/rustdoc/sidebar-link-generation.rs @@ -0,0 +1,13 @@ +#![crate_name = "foo"] + +// @has foo/struct.SomeStruct.html '//*[@class="sidebar-links"]/a[@href="#method.some_fn-1"]' \ +// "some_fn" +pub struct SomeStruct { _inner: T } + +impl SomeStruct<()> { + pub fn some_fn(&self) {} +} + +impl SomeStruct { + pub fn some_fn(&self) {} +} diff --git a/src/test/rustdoc/smoke.rs b/src/test/rustdoc/smoke.rs index 6ba7018bf22..c1ed3a0c953 100644 --- a/src/test/rustdoc/smoke.rs +++ b/src/test/rustdoc/smoke.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has smoke/index.html //! Very docs diff --git a/src/test/rustdoc/sort-modules-by-appearance.rs b/src/test/rustdoc/sort-modules-by-appearance.rs index abffe6fb95b..5be6b98264a 100644 --- a/src/test/rustdoc/sort-modules-by-appearance.rs +++ b/src/test/rustdoc/sort-modules-by-appearance.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests the rustdoc --sort-modules-by-appearance option, that allows module declarations to appear // in the order they are declared in the source code, rather than only alphabetically. diff --git a/src/test/rustdoc/source-file.rs b/src/test/rustdoc/source-file.rs new file mode 100644 index 00000000000..968899dab88 --- /dev/null +++ b/src/test/rustdoc/source-file.rs @@ -0,0 +1,5 @@ +#![crate_name = "foo"] + +// @has source-files.js source-file.rs + +pub struct Foo; diff --git a/src/test/rustdoc/src-links-external.rs b/src/test/rustdoc/src-links-external.rs index 6cc7f1743ad..0469e4ad624 100644 --- a/src/test/rustdoc/src-links-external.rs +++ b/src/test/rustdoc/src-links-external.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:src-links-external.rs // build-aux-docs // ignore-cross-compile @@ -17,8 +7,8 @@ extern crate src_links_external; -// @has foo/bar/index.html '//a/@href' '../../src/src_links_external/src-links-external.rs.html#11' +// @has foo/bar/index.html '//a/@href' '../../src/src_links_external/src-links-external.rs.html#1' #[doc(inline)] pub use src_links_external as bar; -// @has foo/bar/struct.Foo.html '//a/@href' '../../src/src_links_external/src-links-external.rs.html#11' +// @has foo/bar/struct.Foo.html '//a/@href' '../../src/src_links_external/src-links-external.rs.html#1' diff --git a/src/test/rustdoc/src-links.rs b/src/test/rustdoc/src-links.rs index e946e242316..902a319a7b9 100644 --- a/src/test/rustdoc/src-links.rs +++ b/src/test/rustdoc/src-links.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] //! Dox diff --git a/src/test/rustdoc/src-links/mod.rs b/src/test/rustdoc/src-links/mod.rs index eb5e737b369..27b2396811a 100644 --- a/src/test/rustdoc/src-links/mod.rs +++ b/src/test/rustdoc/src-links/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Dox pub mod bar { diff --git a/src/test/rustdoc/static-root-path.rs b/src/test/rustdoc/static-root-path.rs new file mode 100644 index 00000000000..84b32f90c89 --- /dev/null +++ b/src/test/rustdoc/static-root-path.rs @@ -0,0 +1,14 @@ +// compile-flags:-Z unstable-options --static-root-path /cache/ + +// @has static_root_path/struct.SomeStruct.html +// @matches - '"/cache/main\.js"' +// @!matches - '"\.\./main\.js"' +// @matches - '"\.\./search-index\.js"' +// @!matches - '"/cache/search-index\.js"' +pub struct SomeStruct; + +// @has src/static_root_path/static-root-path.rs.html +// @matches - '"/cache/source-script\.js"' +// @!matches - '"\.\./\.\./source-script\.js"' +// @matches - '"\.\./\.\./source-files.js"' +// @!matches - '"/cache/source-files\.js"' diff --git a/src/test/rustdoc/struct-field.rs b/src/test/rustdoc/struct-field.rs index c5016bac7d3..c99169fbca5 100644 --- a/src/test/rustdoc/struct-field.rs +++ b/src/test/rustdoc/struct-field.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // ignore-tidy-linelength diff --git a/src/test/rustdoc/structfields.rs b/src/test/rustdoc/structfields.rs index 75d9be856d7..35cea8afe21 100644 --- a/src/test/rustdoc/structfields.rs +++ b/src/test/rustdoc/structfields.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has structfields/Foo.t.html // @has - struct.Foo.html // @has structfields/struct.Foo.html diff --git a/src/test/rustdoc/synthetic_auto/basic.rs b/src/test/rustdoc/synthetic_auto/basic.rs index 8ff84d11a50..d5f1269d08a 100644 --- a/src/test/rustdoc/synthetic_auto/basic.rs +++ b/src/test/rustdoc/synthetic_auto/basic.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has basic/struct.Foo.html // @has - '//code' 'impl Send for Foo where T: Send' // @has - '//code' 'impl Sync for Foo where T: Sync' diff --git a/src/test/rustdoc/synthetic_auto/complex.rs b/src/test/rustdoc/synthetic_auto/complex.rs index a4ebf6d3a7e..609cefc7115 100644 --- a/src/test/rustdoc/synthetic_auto/complex.rs +++ b/src/test/rustdoc/synthetic_auto/complex.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub trait MyTrait<'a> { type MyItem: ?Sized; @@ -30,7 +20,7 @@ mod foo { } // @has complex/struct.NotOuter.html -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'a, T, K: \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl<'a, T, K: \ // ?Sized> Send for NotOuter<'a, T, K> where K: for<'b> Fn((&'b bool, &'a u8)) \ // -> &'b i8, T: MyTrait<'a>, >::MyItem: Copy, 'a: 'static" diff --git a/src/test/rustdoc/synthetic_auto/lifetimes.rs b/src/test/rustdoc/synthetic_auto/lifetimes.rs index 1c1e7bc2505..6d0a68f9b07 100644 --- a/src/test/rustdoc/synthetic_auto/lifetimes.rs +++ b/src/test/rustdoc/synthetic_auto/lifetimes.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. pub struct Inner<'a, T: 'a> { field: &'a T, } @@ -18,10 +9,10 @@ where {} // @has lifetimes/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'c, K> Send \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl<'c, K> Send \ // for Foo<'c, K> where K: for<'b> Fn(&'b bool) -> &'c u8, 'c: 'static" // -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'c, K> Sync \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl<'c, K> Sync \ // for Foo<'c, K> where K: Sync" pub struct Foo<'c, K: 'c> { inner_field: Inner<'c, K>, diff --git a/src/test/rustdoc/synthetic_auto/manual.rs b/src/test/rustdoc/synthetic_auto/manual.rs index ef6797ecf3c..413ba187f45 100644 --- a/src/test/rustdoc/synthetic_auto/manual.rs +++ b/src/test/rustdoc/synthetic_auto/manual.rs @@ -1,18 +1,8 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has manual/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' 'impl Sync for \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' 'impl Sync for \ // Foo where T: Sync' // -// @has - '//*[@id="implementations-list"]/*[@class="impl"]//*/code' \ +// @has - '//*[@id="implementations-list"]/*[@class="impl"]//code' \ // 'impl Send for Foo' // // @count - '//*[@id="implementations-list"]/*[@class="impl"]' 1 diff --git a/src/test/rustdoc/synthetic_auto/negative.rs b/src/test/rustdoc/synthetic_auto/negative.rs index 64480d28240..30713849da2 100644 --- a/src/test/rustdoc/synthetic_auto/negative.rs +++ b/src/test/rustdoc/synthetic_auto/negative.rs @@ -1,22 +1,12 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Inner { field: *mut T, } // @has negative/struct.Outer.html -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl !Send for \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl !Send for \ // Outer" // -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl \ // !Sync for Outer" pub struct Outer { inner_field: Inner, diff --git a/src/test/rustdoc/synthetic_auto/nested.rs b/src/test/rustdoc/synthetic_auto/nested.rs index ccdbe159b6c..e710ce1c2ed 100644 --- a/src/test/rustdoc/synthetic_auto/nested.rs +++ b/src/test/rustdoc/synthetic_auto/nested.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. pub struct Inner { field: T, } @@ -18,10 +9,10 @@ where } // @has nested/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' 'impl Send for \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' 'impl Send for \ // Foo where T: Copy' // -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' \ // 'impl Sync for Foo where T: Sync' pub struct Foo { inner_field: Inner, diff --git a/src/test/rustdoc/synthetic_auto/no-redundancy.rs b/src/test/rustdoc/synthetic_auto/no-redundancy.rs index 24fba221b99..cf173111ec1 100644 --- a/src/test/rustdoc/synthetic_auto/no-redundancy.rs +++ b/src/test/rustdoc/synthetic_auto/no-redundancy.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Inner { field: T, } @@ -19,7 +9,7 @@ where } // @has no_redundancy/struct.Outer.html -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl Send for \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl Send for \ // Outer where T: Copy + Send" pub struct Outer { inner_field: Inner, diff --git a/src/test/rustdoc/synthetic_auto/project.rs b/src/test/rustdoc/synthetic_auto/project.rs index d588190c4f9..5346521f8d2 100644 --- a/src/test/rustdoc/synthetic_auto/project.rs +++ b/src/test/rustdoc/synthetic_auto/project.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Inner<'a, T: 'a> { field: &'a T, } @@ -33,10 +23,10 @@ where } // @has project/struct.Foo.html -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'c, K> Send \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl<'c, K> Send \ // for Foo<'c, K> where K: MyTrait, 'c: 'static" // -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'c, K> Sync \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl<'c, K> Sync \ // for Foo<'c, K> where K: MyTrait, ::MyItem: OtherTrait, 'c: 'static," pub struct Foo<'c, K: 'c> { inner_field: Inner<'c, K>, diff --git a/src/test/rustdoc/synthetic_auto/self-referential.rs b/src/test/rustdoc/synthetic_auto/self-referential.rs new file mode 100644 index 00000000000..7d15434afe6 --- /dev/null +++ b/src/test/rustdoc/synthetic_auto/self-referential.rs @@ -0,0 +1,30 @@ +// Some unusual code minimized from +// https://github.com/sile/handy_async/tree/7b619b762c06544fc67792c8ff8ebc24a88fdb98 + +pub trait Pattern { + type Value; +} + +pub struct Constrain(A, B, C); + +impl Pattern for Constrain + where A: Pattern, + B: Pattern, + C: Pattern, +{ + type Value = A::Value; +} + +pub struct Wrapper(T); + +impl Pattern for Wrapper { + type Value = T; +} + + +// @has self_referential/struct.WriteAndThen.html +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl Send for \ +// WriteAndThen where ::Value: Send" +pub struct WriteAndThen(pub P1::Value,pub > as Pattern>::Value) + where P1: Pattern; + diff --git a/src/test/rustdoc/synthetic_auto/static-region.rs b/src/test/rustdoc/synthetic_auto/static-region.rs index 96e8b8ed5f6..59493744b62 100644 --- a/src/test/rustdoc/synthetic_auto/static-region.rs +++ b/src/test/rustdoc/synthetic_auto/static-region.rs @@ -1,19 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait OwnedTrait<'a> { type Reader; } // @has static_region/struct.Owned.html -// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl Send for \ +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//code' "impl Send for \ // Owned where >::Reader: Send" pub struct Owned where T: OwnedTrait<'static> { marker: >::Reader, diff --git a/src/test/rustdoc/test-lists.rs b/src/test/rustdoc/test-lists.rs index 29f157e0425..6a510b9ac5d 100644 --- a/src/test/rustdoc/test-lists.rs +++ b/src/test/rustdoc/test-lists.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/fn.f.html diff --git a/src/test/rustdoc/test-parens.rs b/src/test/rustdoc/test-parens.rs index 0c9452fa1e1..d9b9c7957d9 100644 --- a/src/test/rustdoc/test-parens.rs +++ b/src/test/rustdoc/test-parens.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/fn.foo.html diff --git a/src/test/rustdoc/test_option_check/bar.rs b/src/test/rustdoc/test_option_check/bar.rs index 51daa807526..50a182cf7e0 100644 --- a/src/test/rustdoc/test_option_check/bar.rs +++ b/src/test/rustdoc/test_option_check/bar.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test // check-test-line-numbers-match diff --git a/src/test/rustdoc/test_option_check/test.rs b/src/test/rustdoc/test_option_check/test.rs index a9578c5f434..964e8e37ed5 100644 --- a/src/test/rustdoc/test_option_check/test.rs +++ b/src/test/rustdoc/test_option_check/test.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test // check-test-line-numbers-match diff --git a/src/test/rustdoc/titles.rs b/src/test/rustdoc/titles.rs index a56fa420944..3b4c42d865d 100644 --- a/src/test/rustdoc/titles.rs +++ b/src/test/rustdoc/titles.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @matches 'foo/index.html' '//h1' 'Crate foo' diff --git a/src/test/rustdoc/trait-attributes.rs b/src/test/rustdoc/trait-attributes.rs index 00d10408b4c..971e6b554cc 100644 --- a/src/test/rustdoc/trait-attributes.rs +++ b/src/test/rustdoc/trait-attributes.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // ignore-tidy-linelength diff --git a/src/test/rustdoc/trait-self-link.rs b/src/test/rustdoc/trait-self-link.rs index 3233fb96c5c..51e1fe91f96 100644 --- a/src/test/rustdoc/trait-self-link.rs +++ b/src/test/rustdoc/trait-self-link.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @!has trait_self_link/trait.Foo.html //a/@href ../trait_self_link/trait.Foo.html pub trait Foo {} diff --git a/src/test/rustdoc/traits-in-bodies-private.rs b/src/test/rustdoc/traits-in-bodies-private.rs index ac3be7e61e9..96b7c4f9dc0 100644 --- a/src/test/rustdoc/traits-in-bodies-private.rs +++ b/src/test/rustdoc/traits-in-bodies-private.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // when implementing the fix for traits-in-bodies, there was an ICE when documenting private items // and a trait was defined in non-module scope diff --git a/src/test/rustdoc/traits-in-bodies.rs b/src/test/rustdoc/traits-in-bodies.rs index a1d4019bba2..1c3727a5748 100644 --- a/src/test/rustdoc/traits-in-bodies.rs +++ b/src/test/rustdoc/traits-in-bodies.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //prior to fixing `everybody_loops` to preserve items, rustdoc would crash on this file, as it //didn't see that `SomeStruct` implemented `Clone` diff --git a/src/test/rustdoc/tuples.rs b/src/test/rustdoc/tuples.rs index 2269b38780d..53654abff2a 100644 --- a/src/test/rustdoc/tuples.rs +++ b/src/test/rustdoc/tuples.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/fn.tuple0.html //pre 'pub fn tuple0(x: ())' diff --git a/src/test/rustdoc/typedef.rs b/src/test/rustdoc/typedef.rs index 4ac91d35451..80351ff52f5 100644 --- a/src/test/rustdoc/typedef.rs +++ b/src/test/rustdoc/typedef.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait MyTrait { fn method_on_mytrait() {} } diff --git a/src/test/rustdoc/union.rs b/src/test/rustdoc/union.rs index 2eb25d9b7dd..89186227732 100644 --- a/src/test/rustdoc/union.rs +++ b/src/test/rustdoc/union.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // @has union/union.U.html pub union U { // @has - //pre "pub a: u8" diff --git a/src/test/rustdoc/unit-return.rs b/src/test/rustdoc/unit-return.rs index 757e8979edd..ae3a6031519 100644 --- a/src/test/rustdoc/unit-return.rs +++ b/src/test/rustdoc/unit-return.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:unit-return.rs #![crate_name = "foo"] diff --git a/src/test/rustdoc/universal-impl-trait.rs b/src/test/rustdoc/universal-impl-trait.rs index 1c1124282d4..b10b1b8658d 100644 --- a/src/test/rustdoc/universal-impl-trait.rs +++ b/src/test/rustdoc/universal-impl-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] use std::io::Read; diff --git a/src/test/rustdoc/unneeded-trait-implementations-title.rs b/src/test/rustdoc/unneeded-trait-implementations-title.rs index c87b533b9d4..e1bcfd3b97e 100644 --- a/src/test/rustdoc/unneeded-trait-implementations-title.rs +++ b/src/test/rustdoc/unneeded-trait-implementations-title.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub struct Bar; diff --git a/src/test/rustdoc/variadic.rs b/src/test/rustdoc/variadic.rs index 6ba776ba467..bd8f1775b3d 100644 --- a/src/test/rustdoc/variadic.rs +++ b/src/test/rustdoc/variadic.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern "C" { // @has variadic/fn.foo.html //pre 'pub unsafe extern "C" fn foo(x: i32, ...)' pub fn foo(x: i32, ...); diff --git a/src/test/rustdoc/viewpath-rename.rs b/src/test/rustdoc/viewpath-rename.rs index 4b6843d33f7..54612763792 100644 --- a/src/test/rustdoc/viewpath-rename.rs +++ b/src/test/rustdoc/viewpath-rename.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub mod io { diff --git a/src/test/rustdoc/viewpath-self.rs b/src/test/rustdoc/viewpath-self.rs index 000960ad972..a6b6592955f 100644 --- a/src/test/rustdoc/viewpath-self.rs +++ b/src/test/rustdoc/viewpath-self.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub mod io { diff --git a/src/test/rustdoc/where-sized.rs b/src/test/rustdoc/where-sized.rs index c175c839c0f..fe7cad8c3ef 100644 --- a/src/test/rustdoc/where-sized.rs +++ b/src/test/rustdoc/where-sized.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] // @has foo/fn.foo.html diff --git a/src/test/rustdoc/where.rs b/src/test/rustdoc/where.rs index e691f7c5bea..992cddfe72a 100644 --- a/src/test/rustdoc/where.rs +++ b/src/test/rustdoc/where.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "foo"] pub trait MyTrait { fn dummy(&self) { } } diff --git a/src/test/rustfix/closure-immutable-outer-variable.fixed b/src/test/rustfix/closure-immutable-outer-variable.fixed index bddc2eab16d..05bbc13d714 100644 --- a/src/test/rustfix/closure-immutable-outer-variable.fixed +++ b/src/test/rustfix/closure-immutable-outer-variable.fixed @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Point at the captured immutable outer variable fn foo(mut f: Box) { diff --git a/src/test/rustfix/closure-immutable-outer-variable.rs b/src/test/rustfix/closure-immutable-outer-variable.rs index fe8e2bc6c8e..6ed1bc12cb5 100644 --- a/src/test/rustfix/closure-immutable-outer-variable.rs +++ b/src/test/rustfix/closure-immutable-outer-variable.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Point at the captured immutable outer variable fn foo(mut f: Box) { diff --git a/src/test/rustfix/empty-no-fixes.fixed b/src/test/rustfix/empty-no-fixes.fixed index 39e19566d76..3724a00ce7c 100644 --- a/src/test/rustfix/empty-no-fixes.fixed +++ b/src/test/rustfix/empty-no-fixes.fixed @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--crate-type lib diff --git a/src/test/rustfix/empty-no-fixes.rs b/src/test/rustfix/empty-no-fixes.rs index 39e19566d76..3724a00ce7c 100644 --- a/src/test/rustfix/empty-no-fixes.rs +++ b/src/test/rustfix/empty-no-fixes.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--crate-type lib diff --git a/src/test/rustfix/empty-no-fixes.rs.fixed b/src/test/rustfix/empty-no-fixes.rs.fixed index ee58e778253..e30d3ae0965 100644 --- a/src/test/rustfix/empty-no-fixes.rs.fixed +++ b/src/test/rustfix/empty-no-fixes.rs.fixed @@ -1,12 +1,2 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--crate-type lib fn foo() {} diff --git a/src/test/rustfix/issue-45562.fixed b/src/test/rustfix/issue-45562.fixed index d7a27a11fc0..955b2cbf899 100644 --- a/src/test/rustfix/issue-45562.fixed +++ b/src/test/rustfix/issue-45562.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub static RAH: usize = 5; fn main() {} diff --git a/src/test/rustfix/issue-45562.rs b/src/test/rustfix/issue-45562.rs index 39576e9c845..a1ac07044e2 100644 --- a/src/test/rustfix/issue-45562.rs +++ b/src/test/rustfix/issue-45562.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[no_mangle] pub const RAH: usize = 5; fn main() {} diff --git a/src/test/rustfix/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed b/src/test/rustfix/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed index d931f90cd04..b4ae4dc1ab2 100644 --- a/src/test/rustfix/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed +++ b/src/test/rustfix/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed @@ -1,12 +1,2 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate std as other_std; fn main() {} diff --git a/src/test/rustfix/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs b/src/test/rustfix/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs index 7c55f9c4eb9..a202b6c389a 100644 --- a/src/test/rustfix/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs +++ b/src/test/rustfix/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs @@ -1,12 +1,2 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate std; fn main() {} diff --git a/src/test/rustfix/issue-46756-consider-borrowing-cast-or-binexpr.fixed b/src/test/rustfix/issue-46756-consider-borrowing-cast-or-binexpr.fixed index aaa04ef4004..bedc8e15ace 100644 --- a/src/test/rustfix/issue-46756-consider-borrowing-cast-or-binexpr.fixed +++ b/src/test/rustfix/issue-46756-consider-borrowing-cast-or-binexpr.fixed @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { diff --git a/src/test/rustfix/issue-46756-consider-borrowing-cast-or-binexpr.rs b/src/test/rustfix/issue-46756-consider-borrowing-cast-or-binexpr.rs index d21681747e9..9c7ae9657c0 100644 --- a/src/test/rustfix/issue-46756-consider-borrowing-cast-or-binexpr.rs +++ b/src/test/rustfix/issue-46756-consider-borrowing-cast-or-binexpr.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { diff --git a/src/test/rustfix/main-no-fixes.fixed b/src/test/rustfix/main-no-fixes.fixed index 3f07b46791d..f328e4d9d04 100644 --- a/src/test/rustfix/main-no-fixes.fixed +++ b/src/test/rustfix/main-no-fixes.fixed @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/rustfix/main-no-fixes.rs b/src/test/rustfix/main-no-fixes.rs index 3f07b46791d..f328e4d9d04 100644 --- a/src/test/rustfix/main-no-fixes.rs +++ b/src/test/rustfix/main-no-fixes.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/rustfix/main-no-fixes.rs.fixed b/src/test/rustfix/main-no-fixes.rs.fixed index 3f07b46791d..f328e4d9d04 100644 --- a/src/test/rustfix/main-no-fixes.rs.fixed +++ b/src/test/rustfix/main-no-fixes.rs.fixed @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} diff --git a/src/test/rustfix/missing-comma-in-match.fixed b/src/test/rustfix/missing-comma-in-match.fixed index 621a4127bc2..d4696ab9547 100644 --- a/src/test/rustfix/missing-comma-in-match.fixed +++ b/src/test/rustfix/missing-comma-in-match.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match &Some(3) { &None => 1, diff --git a/src/test/rustfix/missing-comma-in-match.rs b/src/test/rustfix/missing-comma-in-match.rs index 8ccad7b9c94..fed796cffe6 100644 --- a/src/test/rustfix/missing-comma-in-match.rs +++ b/src/test/rustfix/missing-comma-in-match.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match &Some(3) { &None => 1 diff --git a/src/test/rustfix/str-as-char.fixed b/src/test/rustfix/str-as-char.fixed index 0ace6d96613..900fee94653 100644 --- a/src/test/rustfix/str-as-char.fixed +++ b/src/test/rustfix/str-as-char.fixed @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("●●"); } diff --git a/src/test/rustfix/str-as-char.rs b/src/test/rustfix/str-as-char.rs index fa0e474fc7f..b446551fefa 100644 --- a/src/test/rustfix/str-as-char.rs +++ b/src/test/rustfix/str-as-char.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!('●●'); } diff --git a/src/test/rustfix/tuple-float-index.fixed b/src/test/rustfix/tuple-float-index.fixed index 9cb7537b428..358a27d3878 100644 --- a/src/test/rustfix/tuple-float-index.fixed +++ b/src/test/rustfix/tuple-float-index.fixed @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main () { ((1, (2, 3)).1).1; } diff --git a/src/test/rustfix/tuple-float-index.rs b/src/test/rustfix/tuple-float-index.rs index 8bfbd0e74db..72612252a80 100644 --- a/src/test/rustfix/tuple-float-index.rs +++ b/src/test/rustfix/tuple-float-index.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main () { (1, (2, 3)).1.1; } diff --git a/src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs b/src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs new file mode 100644 index 00000000000..c83e7bdb998 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/attr_plugin_test.rs @@ -0,0 +1,21 @@ +// force-host + +#![feature(plugin_registrar)] +#![feature(rustc_private)] + +extern crate syntax; + +extern crate rustc; +extern crate rustc_plugin; + +use syntax::feature_gate::AttributeType; +use rustc_plugin::Registry; + + + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_attribute("foo".to_owned(), AttributeType::Normal); + reg.register_attribute("bar".to_owned(), AttributeType::CrateLevel); + reg.register_attribute("baz".to_owned(), AttributeType::Whitelisted); +} diff --git a/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs b/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs deleted file mode 100644 index 679cb772868..00000000000 --- a/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn attr_proc_macro(_: TokenStream, input: TokenStream) -> TokenStream { - input -} diff --git a/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs b/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs deleted file mode 100644 index 6484725814a..00000000000 --- a/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro] -pub fn bang_proc_macro(input: TokenStream) -> TokenStream { - input -} diff --git a/src/test/ui-fulldeps/auxiliary/derive-clona.rs b/src/test/ui-fulldeps/auxiliary/derive-clona.rs deleted file mode 100644 index 719fbdb15ef..00000000000 --- a/src/test/ui-fulldeps/auxiliary/derive-clona.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(Clona)] -pub fn derive_clonea(input: TokenStream) -> TokenStream { - "".parse().unwrap() -} diff --git a/src/test/ui-fulldeps/auxiliary/derive-foo.rs b/src/test/ui-fulldeps/auxiliary/derive-foo.rs deleted file mode 100644 index 64dcf72ba20..00000000000 --- a/src/test/ui-fulldeps/auxiliary/derive-foo.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(FooWithLongName)] -pub fn derive_foo(input: TokenStream) -> TokenStream { - "".parse().unwrap() -} diff --git a/src/test/ui-fulldeps/auxiliary/invalid-punct-ident.rs b/src/test/ui-fulldeps/auxiliary/invalid-punct-ident.rs deleted file mode 100644 index cc899fa610d..00000000000 --- a/src/test/ui-fulldeps/auxiliary/invalid-punct-ident.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] -#![feature(proc_macro_raw_ident)] - -extern crate proc_macro; -use proc_macro::*; - -#[proc_macro] -pub fn invalid_punct(_: TokenStream) -> TokenStream { - TokenTree::from(Punct::new('`', Spacing::Alone)).into() -} - -#[proc_macro] -pub fn invalid_ident(_: TokenStream) -> TokenStream { - TokenTree::from(Ident::new("*", Span::call_site())).into() -} - -#[proc_macro] -pub fn invalid_raw_ident(_: TokenStream) -> TokenStream { - TokenTree::from(Ident::new_raw("self", Span::call_site())).into() -} - -#[proc_macro] -pub fn lexer_failure(_: TokenStream) -> TokenStream { - "a b ) c".parse().expect("parsing failed without panic") -} diff --git a/src/test/ui-fulldeps/auxiliary/lifetimes.rs b/src/test/ui-fulldeps/auxiliary/lifetimes.rs deleted file mode 100644 index fc59a622bfa..00000000000 --- a/src/test/ui-fulldeps/auxiliary/lifetimes.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro] -pub fn single_quote_alone(_: TokenStream) -> TokenStream { - // `&'a u8`, but the `'` token is not joint - let trees: Vec = vec![ - Punct::new('&', Spacing::Alone).into(), - Punct::new('\'', Spacing::Alone).into(), - Ident::new("a", Span::call_site()).into(), - Ident::new("u8", Span::call_site()).into(), - ]; - trees.into_iter().collect() -} diff --git a/src/test/ui-fulldeps/auxiliary/lint_for_crate.rs b/src/test/ui-fulldeps/auxiliary/lint_for_crate.rs new file mode 100644 index 00000000000..82aa28b26b6 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/lint_for_crate.rs @@ -0,0 +1,41 @@ +// force-host + +#![feature(plugin_registrar, rustc_private)] +#![feature(box_syntax)] + +#[macro_use] extern crate rustc; +extern crate rustc_plugin; +extern crate syntax; + +use rustc::lint::{LateContext, LintContext, LintPass, LateLintPass, LateLintPassObject, LintArray}; +use rustc_plugin::Registry; +use rustc::hir; +use syntax::attr; + +declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); + +struct Pass; + +impl LintPass for Pass { + fn name(&self) -> &'static str { + "Pass" + } + + fn get_lints(&self) -> LintArray { + lint_array!(CRATE_NOT_OKAY) + } +} + +impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { + fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { + if !attr::contains_name(&krate.attrs, "crate_okay") { + cx.span_lint(CRATE_NOT_OKAY, krate.span, + "crate is not marked with #![crate_okay]"); + } + } +} + +#[plugin_registrar] +pub fn plugin_registrar(reg: &mut Registry) { + reg.register_late_lint_pass(box Pass); +} diff --git a/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs b/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs index 1057649d969..16630e2b312 100644 --- a/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint_group_plugin_test.rs @@ -1,20 +1,9 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -#![feature(macro_at_most_once_rep)] -// Load rustc as a plugin to get macros +// Load rustc as a plugin to get macros. #[macro_use] extern crate rustc; extern crate rustc_plugin; @@ -30,6 +19,10 @@ declare_lint!(PLEASE_LINT, Warn, "Warn about items named 'pleaselintme'"); struct Pass; impl LintPass for Pass { + fn name(&self) -> &'static str { + "Pass" + } + fn get_lints(&self) -> LintArray { lint_array!(TEST_LINT, PLEASE_LINT) } @@ -37,7 +30,7 @@ impl LintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { - match &*it.name.as_str() { + match &*it.ident.as_str() { "lintme" => cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'"), "pleaselintme" => cx.span_lint(PLEASE_LINT, it.span, "item is named 'pleaselintme'"), _ => {} diff --git a/src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs b/src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs index b0183a3c56b..4e45189b424 100644 --- a/src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint_plugin_test.rs @@ -1,18 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // force-host #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -#![feature(macro_at_most_once_rep)] extern crate syntax; @@ -30,6 +19,10 @@ declare_lint!(TEST_LINT, Warn, "Warn about items named 'lintme'"); struct Pass; impl LintPass for Pass { + fn name(&self) -> &'static str { + "Pass" + } + fn get_lints(&self) -> LintArray { lint_array!(TEST_LINT) } diff --git a/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs b/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs index 7d2acd7aa4c..1a9bd9e66db 100644 --- a/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs @@ -1,16 +1,5 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(plugin_registrar)] #![feature(box_syntax, rustc_private)] -#![feature(macro_at_most_once_rep)] extern crate syntax; @@ -29,6 +18,10 @@ declare_tool_lint!(pub clippy::TEST_GROUP, Warn, "Warn about other stuff"); struct Pass; impl LintPass for Pass { + fn name(&self) -> &'static str { + "Pass" + } + fn get_lints(&self) -> LintArray { lint_array!(TEST_LINT, TEST_GROUP) } diff --git a/src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs b/src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs new file mode 100644 index 00000000000..3df40df7b33 --- /dev/null +++ b/src/test/ui-fulldeps/auxiliary/rlib_crate_test.rs @@ -0,0 +1,12 @@ +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![feature(plugin_registrar, rustc_private)] + +extern crate rustc; +extern crate rustc_plugin; + +use rustc_plugin::Registry; + +#[plugin_registrar] +pub fn plugin_registrar(_: &mut Registry) {} diff --git a/src/test/ui-fulldeps/custom-derive/auxiliary/plugin.rs b/src/test/ui-fulldeps/custom-derive/auxiliary/plugin.rs deleted file mode 100644 index 124bc05b7a3..00000000000 --- a/src/test/ui-fulldeps/custom-derive/auxiliary/plugin.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(Foo)] -pub fn derive_foo(input: TokenStream) -> TokenStream { - input -} - -#[proc_macro_derive(Bar)] -pub fn derive_bar(input: TokenStream) -> TokenStream { - panic!("lolnope"); -} - -#[proc_macro_derive(WithHelper, attributes(helper))] -pub fn with_helper(input: TokenStream) -> TokenStream { - TokenStream::new() -} - -#[proc_macro_attribute] -pub fn helper(_: TokenStream, input: TokenStream) -> TokenStream { - input -} diff --git a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.stderr b/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.stderr deleted file mode 100644 index ee98873064f..00000000000 --- a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0659]: `helper` is ambiguous (derive helper attribute vs any other name) - --> $DIR/helper-attr-blocked-by-import-ambig.rs:10:3 - | -LL | #[helper] //~ ERROR `helper` is ambiguous - | ^^^^^^ ambiguous name - | -note: `helper` could refer to the derive helper attribute defined here - --> $DIR/helper-attr-blocked-by-import-ambig.rs:9:10 - | -LL | #[derive(WithHelper)] - | ^^^^^^^^^^ -note: `helper` could also refer to the attribute macro imported here - --> $DIR/helper-attr-blocked-by-import-ambig.rs:7:5 - | -LL | use plugin::helper; - | ^^^^^^^^^^^^^^ - = help: use `self::helper` to refer to this attribute macro unambiguously - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui-fulldeps/custom-derive/issue-36935.rs b/src/test/ui-fulldeps/custom-derive/issue-36935.rs deleted file mode 100644 index 5ec79a55200..00000000000 --- a/src/test/ui-fulldeps/custom-derive/issue-36935.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:plugin.rs -// ignore-stage1 - -#[macro_use] extern crate plugin; - -#[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked -struct Baz { - a: i32, - b: i32, -} - -fn main() {} diff --git a/src/test/ui-fulldeps/deprecated-derive.rs b/src/test/ui-fulldeps/deprecated-derive.rs index a728523d832..6a0b2283aa3 100644 --- a/src/test/ui-fulldeps/deprecated-derive.rs +++ b/src/test/ui-fulldeps/deprecated-derive.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(rustc_private)] diff --git a/src/test/ui-fulldeps/deprecated-derive.stderr b/src/test/ui-fulldeps/deprecated-derive.stderr index df4bd7f752c..27762910e6a 100644 --- a/src/test/ui-fulldeps/deprecated-derive.stderr +++ b/src/test/ui-fulldeps/deprecated-derive.stderr @@ -1,5 +1,5 @@ warning: derive(Encodable) is deprecated in favor of derive(RustcEncodable) - --> $DIR/deprecated-derive.rs:18:10 + --> $DIR/deprecated-derive.rs:8:10 | LL | #[derive(Encodable)] | ^^^^^^^^^ diff --git a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.rs similarity index 84% rename from src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs rename to src/test/ui-fulldeps/dropck_tarena_cycle_checked.rs index 5ab6b99eb62..a7e8131342f 100644 --- a/src/test/compile-fail-fulldeps/dropck_tarena_cycle_checked.rs +++ b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Reject mixing cyclic structure and Drop when using TypedArena. // // (Compare against compile-fail/dropck_vec_cycle_checked.rs) diff --git a/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr new file mode 100644 index 00000000000..34d026e957d --- /dev/null +++ b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr @@ -0,0 +1,13 @@ +error[E0597]: `arena` does not live long enough + --> $DIR/dropck_tarena_cycle_checked.rs:116:8 + | +LL | f(&arena); + | ^^^^^ borrowed value does not live long enough +LL | } //~^ ERROR `arena` does not live long enough + | - `arena` dropped here while still borrowed + | + = note: values in a scope are dropped in the opposite order they are created + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs new file mode 100644 index 00000000000..3103aef36cb --- /dev/null +++ b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.rs @@ -0,0 +1,43 @@ +// Check that an arena (TypedArena) cannot carry elements whose drop +// methods might access borrowed data of lifetime that does not +// strictly outlive the arena itself. +// +// Compare against run-pass/dropck_tarena_sound_drop.rs, which shows a +// similar setup, but loosens `f` so that the struct `C<'a>` can be +// fed a lifetime longer than that of the arena. +// +// (Also compare against dropck_tarena_cycle_checked.rs, from which +// this was reduced to better understand its error message.) + +#![feature(rustc_private)] + +extern crate arena; + +use arena::TypedArena; + +trait HasId { fn count(&self) -> usize; } + +struct CheckId { v: T } + +// In the code below, the impl of HasId for `&'a usize` does not +// actually access the borrowed data, but the point is that the +// interface to CheckId does not (and cannot) know that, and therefore +// when encountering a value V of type CheckId, we must +// conservatively force the type S to strictly outlive V. +impl Drop for CheckId { + fn drop(&mut self) { + assert!(self.v.count() > 0); + } +} + +struct C<'a> { v: CheckId<&'a usize>, } + +impl<'a> HasId for &'a usize { fn count(&self) -> usize { 1 } } + +fn f<'a>(_arena: &'a TypedArena>) {} + +fn main() { + let arena: TypedArena = TypedArena::default(); + f(&arena); +} //~^ ERROR `arena` does not live long enough + diff --git a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr new file mode 100644 index 00000000000..47754da8b78 --- /dev/null +++ b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr @@ -0,0 +1,13 @@ +error[E0597]: `arena` does not live long enough + --> $DIR/dropck_tarena_unsound_drop.rs:41:8 + | +LL | f(&arena); + | ^^^^^ borrowed value does not live long enough +LL | } //~^ ERROR `arena` does not live long enough + | - `arena` dropped here while still borrowed + | + = note: values in a scope are dropped in the opposite order they are created + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui-fulldeps/gated-plugin.rs b/src/test/ui-fulldeps/gated-plugin.rs new file mode 100644 index 00000000000..a647585e621 --- /dev/null +++ b/src/test/ui-fulldeps/gated-plugin.rs @@ -0,0 +1,6 @@ +// aux-build:attr_plugin_test.rs + +#![plugin(attr_plugin_test)] +//~^ ERROR compiler plugins are experimental and possibly buggy + +fn main() {} diff --git a/src/test/ui-fulldeps/gated-plugin.stderr b/src/test/ui-fulldeps/gated-plugin.stderr new file mode 100644 index 00000000000..37c2b443247 --- /dev/null +++ b/src/test/ui-fulldeps/gated-plugin.stderr @@ -0,0 +1,11 @@ +error[E0658]: compiler plugins are experimental and possibly buggy (see issue #29597) + --> $DIR/gated-plugin.rs:3:1 + | +LL | #![plugin(attr_plugin_test)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(plugin)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui-fulldeps/invalid-punct-ident-1.rs b/src/test/ui-fulldeps/invalid-punct-ident-1.rs deleted file mode 100644 index 576c156c105..00000000000 --- a/src/test/ui-fulldeps/invalid-punct-ident-1.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:invalid-punct-ident.rs - -#[macro_use] -extern crate invalid_punct_ident; - -invalid_punct!(); //~ ERROR proc macro panicked diff --git a/src/test/ui-fulldeps/invalid-punct-ident-2.rs b/src/test/ui-fulldeps/invalid-punct-ident-2.rs deleted file mode 100644 index 874a7d169d1..00000000000 --- a/src/test/ui-fulldeps/invalid-punct-ident-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:invalid-punct-ident.rs - -#[macro_use] -extern crate invalid_punct_ident; - -invalid_ident!(); //~ ERROR proc macro panicked diff --git a/src/test/ui-fulldeps/invalid-punct-ident-3.rs b/src/test/ui-fulldeps/invalid-punct-ident-3.rs deleted file mode 100644 index f73bf500545..00000000000 --- a/src/test/ui-fulldeps/invalid-punct-ident-3.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:invalid-punct-ident.rs - -#[macro_use] -extern crate invalid_punct_ident; - -invalid_raw_ident!(); //~ ERROR proc macro panicked diff --git a/src/test/ui-fulldeps/invalid-punct-ident-4.rs b/src/test/ui-fulldeps/invalid-punct-ident-4.rs deleted file mode 100644 index 1e93c69c650..00000000000 --- a/src/test/ui-fulldeps/invalid-punct-ident-4.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:invalid-punct-ident.rs - -#[macro_use] -extern crate invalid_punct_ident; - -lexer_failure!(); //~ ERROR proc macro panicked - //~| ERROR unexpected close delimiter: `)` diff --git a/src/test/ui-fulldeps/issue-15778-fail.rs b/src/test/ui-fulldeps/issue-15778-fail.rs new file mode 100644 index 00000000000..91c379673b3 --- /dev/null +++ b/src/test/ui-fulldeps/issue-15778-fail.rs @@ -0,0 +1,8 @@ +// aux-build:lint_for_crate.rs +// ignore-stage1 +// compile-flags: -D crate-not-okay + +#![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay] +#![plugin(lint_for_crate)] + +pub fn main() { } diff --git a/src/test/ui-fulldeps/issue-15778-fail.stderr b/src/test/ui-fulldeps/issue-15778-fail.stderr new file mode 100644 index 00000000000..8eafd1cefa6 --- /dev/null +++ b/src/test/ui-fulldeps/issue-15778-fail.stderr @@ -0,0 +1,13 @@ +error: crate is not marked with #![crate_okay] + --> $DIR/issue-15778-fail.rs:5:1 + | +LL | / #![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay] +LL | | #![plugin(lint_for_crate)] +LL | | +LL | | pub fn main() { } + | |_________________^ + | + = note: requested on the command line with `-D crate-not-okay` + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/lifetimes.rs b/src/test/ui-fulldeps/lifetimes.rs deleted file mode 100644 index ff6464a7a3a..00000000000 --- a/src/test/ui-fulldeps/lifetimes.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:lifetimes.rs - -#![feature(proc_macro_hygiene)] - -extern crate lifetimes; - -use lifetimes::*; - -type A = single_quote_alone!(); //~ ERROR expected type, found `'` diff --git a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs new file mode 100644 index 00000000000..75e0a8fc31f --- /dev/null +++ b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.rs @@ -0,0 +1,15 @@ +// aux-build:lint_group_plugin_test.rs +// ignore-stage1 +// compile-flags: -D lint-me + +#![feature(plugin)] +#![plugin(lint_group_plugin_test)] + +fn lintme() { } //~ ERROR item is named 'lintme' + +fn pleaselintme() { } //~ ERROR item is named 'pleaselintme' + +pub fn main() { + lintme(); + pleaselintme(); +} diff --git a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr new file mode 100644 index 00000000000..9b629ca6778 --- /dev/null +++ b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr @@ -0,0 +1,18 @@ +error: item is named 'lintme' + --> $DIR/lint-group-plugin-deny-cmdline.rs:8:1 + | +LL | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | + = note: `-D test-lint` implied by `-D lint-me` + +error: item is named 'pleaselintme' + --> $DIR/lint-group-plugin-deny-cmdline.rs:10:1 + | +LL | fn pleaselintme() { } //~ ERROR item is named 'pleaselintme' + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `-D please-lint` implied by `-D lint-me` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui-fulldeps/lint-group-plugin.rs b/src/test/ui-fulldeps/lint-group-plugin.rs index fee9f45972d..7a650afe5f8 100644 --- a/src/test/ui-fulldeps/lint-group-plugin.rs +++ b/src/test/ui-fulldeps/lint-group-plugin.rs @@ -1,16 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:lint_group_plugin_test.rs // ignore-stage1 + #![feature(plugin)] #![plugin(lint_group_plugin_test)] #![allow(dead_code)] diff --git a/src/test/ui-fulldeps/lint-group-plugin.stderr b/src/test/ui-fulldeps/lint-group-plugin.stderr index 80a309f27e1..b566048c75e 100644 --- a/src/test/ui-fulldeps/lint-group-plugin.stderr +++ b/src/test/ui-fulldeps/lint-group-plugin.stderr @@ -1,5 +1,5 @@ warning: item is named 'lintme' - --> $DIR/lint-group-plugin.rs:18:1 + --> $DIR/lint-group-plugin.rs:9:1 | LL | fn lintme() { } //~ WARNING item is named 'lintme' | ^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | fn lintme() { } //~ WARNING item is named 'lintme' = note: #[warn(test_lint)] on by default warning: item is named 'pleaselintme' - --> $DIR/lint-group-plugin.rs:19:1 + --> $DIR/lint-group-plugin.rs:10:1 | LL | fn pleaselintme() { } //~ WARNING item is named 'pleaselintme' | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs index 19ce2362134..21042c5e7d0 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:lint_plugin_test.rs // ignore-stage1 diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr index cda6ea8bb90..a9b27beb7df 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr @@ -1,11 +1,11 @@ warning: function is never used: `lintme` - --> $DIR/lint-plugin-cmdline-allow.rs:20:1 + --> $DIR/lint-plugin-cmdline-allow.rs:10:1 | LL | fn lintme() { } | ^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-plugin-cmdline-allow.rs:17:9 + --> $DIR/lint-plugin-cmdline-allow.rs:7:9 | LL | #![warn(unused)] | ^^^^^^ diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-load.rs b/src/test/ui-fulldeps/lint-plugin-cmdline-load.rs index 27ef9649cf3..0dca00040bf 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-load.rs +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-load.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:lint_plugin_test.rs // ignore-stage1 diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr b/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr index 33c690a2d9f..1beb5b7816c 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr @@ -1,5 +1,5 @@ warning: item is named 'lintme' - --> $DIR/lint-plugin-cmdline-load.rs:18:1 + --> $DIR/lint-plugin-cmdline-load.rs:8:1 | LL | fn lintme() { } //~ WARNING item is named 'lintme' | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.rs b/src/test/ui-fulldeps/lint-plugin-deny-attr.rs new file mode 100644 index 00000000000..65a36236180 --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.rs @@ -0,0 +1,12 @@ +// aux-build:lint_plugin_test.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(lint_plugin_test)] +#![deny(test_lint)] + +fn lintme() { } //~ ERROR item is named 'lintme' + +pub fn main() { + lintme(); +} diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr new file mode 100644 index 00000000000..81fee10e56f --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr @@ -0,0 +1,14 @@ +error: item is named 'lintme' + --> $DIR/lint-plugin-deny-attr.rs:8:1 + | +LL | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint-plugin-deny-attr.rs:6:9 + | +LL | #![deny(test_lint)] + | ^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs new file mode 100644 index 00000000000..b0c4dc0bce5 --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.rs @@ -0,0 +1,12 @@ +// aux-build:lint_plugin_test.rs +// ignore-stage1 +// compile-flags: -D test-lint + +#![feature(plugin)] +#![plugin(lint_plugin_test)] + +fn lintme() { } //~ ERROR item is named 'lintme' + +pub fn main() { + lintme(); +} diff --git a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr new file mode 100644 index 00000000000..9b84abf704c --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr @@ -0,0 +1,10 @@ +error: item is named 'lintme' + --> $DIR/lint-plugin-deny-cmdline.rs:8:1 + | +LL | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-D test-lint` + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs index 21b8057431b..964fed3b37d 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lint_plugin_test.rs // ignore-stage1 diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr index 56d4a86096f..11dd75621bf 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr @@ -1,5 +1,5 @@ error[E0453]: allow(test_lint) overruled by outer forbid(test_lint) - --> $DIR/lint-plugin-forbid-attrs.rs:20:9 + --> $DIR/lint-plugin-forbid-attrs.rs:10:9 | LL | #![forbid(test_lint)] | --------- `forbid` level set here @@ -8,13 +8,13 @@ LL | #[allow(test_lint)] | ^^^^^^^^^ overruled by previous forbid error: item is named 'lintme' - --> $DIR/lint-plugin-forbid-attrs.rs:18:1 + --> $DIR/lint-plugin-forbid-attrs.rs:8:1 | LL | fn lintme() { } //~ ERROR item is named 'lintme' | ^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-plugin-forbid-attrs.rs:16:11 + --> $DIR/lint-plugin-forbid-attrs.rs:6:11 | LL | #![forbid(test_lint)] | ^^^^^^^^^ diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs new file mode 100644 index 00000000000..07bd785ee71 --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.rs @@ -0,0 +1,13 @@ +// aux-build:lint_plugin_test.rs +// ignore-stage1 +// compile-flags: -F test-lint + +#![feature(plugin)] +#![plugin(lint_plugin_test)] + +fn lintme() { } //~ ERROR item is named 'lintme' + +#[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(test_lint) +pub fn main() { + lintme(); +} diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr new file mode 100644 index 00000000000..b03051250fc --- /dev/null +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr @@ -0,0 +1,19 @@ +error[E0453]: allow(test_lint) overruled by outer forbid(test_lint) + --> $DIR/lint-plugin-forbid-cmdline.rs:10:9 + | +LL | #[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(test_lint) + | ^^^^^^^^^ overruled by previous forbid + | + = note: `forbid` lint level was set on command line + +error: item is named 'lintme' + --> $DIR/lint-plugin-forbid-cmdline.rs:8:1 + | +LL | fn lintme() { } //~ ERROR item is named 'lintme' + | ^^^^^^^^^^^^^^^ + | + = note: requested on the command line with `-F test-lint` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0453`. diff --git a/src/test/ui-fulldeps/lint-plugin.rs b/src/test/ui-fulldeps/lint-plugin.rs index 304cfc3eb6d..031f3b86b14 100644 --- a/src/test/ui-fulldeps/lint-plugin.rs +++ b/src/test/ui-fulldeps/lint-plugin.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:lint_plugin_test.rs // ignore-stage1 diff --git a/src/test/ui-fulldeps/lint-plugin.stderr b/src/test/ui-fulldeps/lint-plugin.stderr index 4a3140925c8..11e3222a1a5 100644 --- a/src/test/ui-fulldeps/lint-plugin.stderr +++ b/src/test/ui-fulldeps/lint-plugin.stderr @@ -1,5 +1,5 @@ warning: item is named 'lintme' - --> $DIR/lint-plugin.rs:18:1 + --> $DIR/lint-plugin.rs:8:1 | LL | fn lintme() { } //~ WARNING item is named 'lintme' | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui-fulldeps/lint_tool_cmdline_allow.rs b/src/test/ui-fulldeps/lint_tool_cmdline_allow.rs index 74888d3e140..d60f41dd5a3 100644 --- a/src/test/ui-fulldeps/lint_tool_cmdline_allow.rs +++ b/src/test/ui-fulldeps/lint_tool_cmdline_allow.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:lint_tool_test.rs // ignore-stage1 diff --git a/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr b/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr index c1a9d818746..9634f1d572f 100644 --- a/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr +++ b/src/test/ui-fulldeps/lint_tool_cmdline_allow.stderr @@ -3,7 +3,7 @@ warning: lint name `test_lint` is deprecated and does not have an effect anymore = note: requested on the command line with `-A test_lint` warning: item is named 'lintme' - --> $DIR/lint_tool_cmdline_allow.rs:20:1 + --> $DIR/lint_tool_cmdline_allow.rs:10:1 | LL | fn lintme() { } | ^^^^^^^^^^^^^^^ @@ -11,13 +11,13 @@ LL | fn lintme() { } = note: #[warn(clippy::test_lint)] on by default warning: function is never used: `lintme` - --> $DIR/lint_tool_cmdline_allow.rs:20:1 + --> $DIR/lint_tool_cmdline_allow.rs:10:1 | LL | fn lintme() { } | ^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint_tool_cmdline_allow.rs:17:9 + --> $DIR/lint_tool_cmdline_allow.rs:7:9 | LL | #![warn(unused)] | ^^^^^^ diff --git a/src/test/ui-fulldeps/lint_tool_test.rs b/src/test/ui-fulldeps/lint_tool_test.rs index 11b70d1d780..04608b62f43 100644 --- a/src/test/ui-fulldeps/lint_tool_test.rs +++ b/src/test/ui-fulldeps/lint_tool_test.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lint_tool_test.rs // ignore-stage1 // compile-flags: --cfg foo diff --git a/src/test/ui-fulldeps/lint_tool_test.stderr b/src/test/ui-fulldeps/lint_tool_test.stderr index ab0c317e1cd..95db7ec455d 100644 --- a/src/test/ui-fulldeps/lint_tool_test.stderr +++ b/src/test/ui-fulldeps/lint_tool_test.stderr @@ -1,5 +1,5 @@ warning: lint name `test_lint` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore - --> $DIR/lint_tool_test.rs:18:23 + --> $DIR/lint_tool_test.rs:8:23 | LL | #![cfg_attr(foo, warn(test_lint))] | ^^^^^^^^^ help: change it to: `clippy::test_lint` @@ -7,19 +7,19 @@ LL | #![cfg_attr(foo, warn(test_lint))] = note: #[warn(renamed_and_removed_lints)] on by default warning: lint name `clippy_group` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore - --> $DIR/lint_tool_test.rs:21:9 + --> $DIR/lint_tool_test.rs:11:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ help: change it to: `clippy::group` warning: lint name `test_group` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore - --> $DIR/lint_tool_test.rs:35:9 + --> $DIR/lint_tool_test.rs:25:9 | LL | #[allow(test_group)] | ^^^^^^^^^^ help: change it to: `clippy::test_group` warning: unknown lint: `this_lint_does_not_exist` - --> $DIR/lint_tool_test.rs:37:8 + --> $DIR/lint_tool_test.rs:27:8 | LL | #[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist` | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -27,32 +27,32 @@ LL | #[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does = note: #[warn(unknown_lints)] on by default warning: lint name `test_lint` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore - --> $DIR/lint_tool_test.rs:18:23 + --> $DIR/lint_tool_test.rs:8:23 | LL | #![cfg_attr(foo, warn(test_lint))] | ^^^^^^^^^ help: change it to: `clippy::test_lint` error: item is named 'lintme' - --> $DIR/lint_tool_test.rs:24:1 + --> $DIR/lint_tool_test.rs:14:1 | LL | fn lintme() { } //~ ERROR item is named 'lintme' | ^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint_tool_test.rs:21:9 + --> $DIR/lint_tool_test.rs:11:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ = note: #[deny(clippy::test_lint)] implied by #[deny(clippy::group)] error: item is named 'lintmetoo' - --> $DIR/lint_tool_test.rs:32:5 + --> $DIR/lint_tool_test.rs:22:5 | LL | fn lintmetoo() { } //~ ERROR item is named 'lintmetoo' | ^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint_tool_test.rs:21:9 + --> $DIR/lint_tool_test.rs:11:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ diff --git a/src/test/ui-fulldeps/macro-crate-rlib.rs b/src/test/ui-fulldeps/macro-crate-rlib.rs new file mode 100644 index 00000000000..21e62171f0f --- /dev/null +++ b/src/test/ui-fulldeps/macro-crate-rlib.rs @@ -0,0 +1,9 @@ +// aux-build:rlib_crate_test.rs +// ignore-tidy-linelength +// ignore-cross-compile gives a different error message + +#![feature(plugin)] +#![plugin(rlib_crate_test)] +//~^ ERROR: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format + +fn main() {} diff --git a/src/test/ui-fulldeps/macro-crate-rlib.stderr b/src/test/ui-fulldeps/macro-crate-rlib.stderr new file mode 100644 index 00000000000..0651cee56f7 --- /dev/null +++ b/src/test/ui-fulldeps/macro-crate-rlib.stderr @@ -0,0 +1,9 @@ +error[E0457]: plugin `rlib_crate_test` only found in rlib format, but must be available in dylib format + --> $DIR/macro-crate-rlib.rs:6:11 + | +LL | #![plugin(rlib_crate_test)] + | ^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0457`. diff --git a/src/test/ui-fulldeps/plugin-as-extern-crate.rs b/src/test/ui-fulldeps/plugin-as-extern-crate.rs new file mode 100644 index 00000000000..37ac8dfa391 --- /dev/null +++ b/src/test/ui-fulldeps/plugin-as-extern-crate.rs @@ -0,0 +1,12 @@ +// aux-build:attr_plugin_test.rs +// ignore-cross-compile +// +// attr_plugin_test will not compile on a cross-compiled target because +// libsyntax is not compiled for it. + +#![deny(plugin_as_library)] +#![allow(unused_extern_crates)] + +extern crate attr_plugin_test; //~ ERROR compiler plugin used as an ordinary library + +fn main() { } diff --git a/src/test/ui-fulldeps/plugin-as-extern-crate.stderr b/src/test/ui-fulldeps/plugin-as-extern-crate.stderr new file mode 100644 index 00000000000..4a5a53980eb --- /dev/null +++ b/src/test/ui-fulldeps/plugin-as-extern-crate.stderr @@ -0,0 +1,14 @@ +error: compiler plugin used as an ordinary library + --> $DIR/plugin-as-extern-crate.rs:10:1 + | +LL | extern crate attr_plugin_test; //~ ERROR compiler plugin used as an ordinary library + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/plugin-as-extern-crate.rs:7:9 + | +LL | #![deny(plugin_as_library)] + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui-fulldeps/plugin-attr-register-deny.rs b/src/test/ui-fulldeps/plugin-attr-register-deny.rs new file mode 100644 index 00000000000..f9922f7f606 --- /dev/null +++ b/src/test/ui-fulldeps/plugin-attr-register-deny.rs @@ -0,0 +1,20 @@ +// aux-build:attr_plugin_test.rs +// ignore-stage1 + +#![feature(plugin)] +#![plugin(attr_plugin_test)] +#![deny(unused_attributes)] + +#[baz] +fn baz() { } // no error + +#[foo] +pub fn main() { + //~^^ ERROR unused + #[bar] + fn inner() {} + //~^^ ERROR crate + //~^^^ ERROR unused + baz(); + inner(); +} diff --git a/src/test/ui-fulldeps/plugin-attr-register-deny.stderr b/src/test/ui-fulldeps/plugin-attr-register-deny.stderr new file mode 100644 index 00000000000..7fea5134d7a --- /dev/null +++ b/src/test/ui-fulldeps/plugin-attr-register-deny.stderr @@ -0,0 +1,26 @@ +error: unused attribute + --> $DIR/plugin-attr-register-deny.rs:14:5 + | +LL | #[bar] + | ^^^^^^ + | +note: lint level defined here + --> $DIR/plugin-attr-register-deny.rs:6:9 + | +LL | #![deny(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ + +error: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] + --> $DIR/plugin-attr-register-deny.rs:14:5 + | +LL | #[bar] + | ^^^^^^ + +error: unused attribute + --> $DIR/plugin-attr-register-deny.rs:11:1 + | +LL | #[foo] + | ^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.rs b/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.rs deleted file mode 100644 index af47dad9e0b..00000000000 --- a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:attribute-spans-preserved.rs - -extern crate attribute_spans_preserved as foo; - -use foo::foo; - -#[ foo ( let y: u32 = "z"; ) ] //~ ERROR: mismatched types -#[ bar { let x: u32 = "y"; } ] //~ ERROR: mismatched types -fn main() { -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/attr_proc_macro.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/attr_proc_macro.rs deleted file mode 100644 index 679cb772868..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/attr_proc_macro.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn attr_proc_macro(_: TokenStream, input: TokenStream) -> TokenStream { - input -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/attribute-spans-preserved.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/attribute-spans-preserved.rs deleted file mode 100644 index e725cc7afb8..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/attribute-spans-preserved.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro_attribute] -pub fn foo(attr: TokenStream, f: TokenStream) -> TokenStream { - let mut tokens = f.into_iter(); - assert_eq!(tokens.next().unwrap().to_string(), "#"); - let next_attr = match tokens.next().unwrap() { - TokenTree::Group(g) => g, - _ => panic!(), - }; - - let fn_tok = tokens.next().unwrap(); - let ident_tok = tokens.next().unwrap(); - let args_tok = tokens.next().unwrap(); - let body = tokens.next().unwrap(); - - let new_body = attr.into_iter() - .chain(next_attr.stream().into_iter().skip(1)); - - let tokens = vec![ - fn_tok, - ident_tok, - args_tok, - Group::new(Delimiter::Brace, new_body.collect()).into(), - ].into_iter().collect::(); - println!("{}", tokens); - return tokens -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/bang_proc_macro.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/bang_proc_macro.rs deleted file mode 100644 index 6484725814a..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/bang_proc_macro.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro] -pub fn bang_proc_macro(input: TokenStream) -> TokenStream { - input -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/builtin-attrs.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/builtin-attrs.rs deleted file mode 100644 index e18ca57aab1..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/builtin-attrs.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::*; - -#[proc_macro_attribute] -pub fn feature(_: TokenStream, input: TokenStream) -> TokenStream { - input -} - -#[proc_macro_attribute] -pub fn repr(_: TokenStream, input: TokenStream) -> TokenStream { - input -} - -#[proc_macro_attribute] -pub fn test(_: TokenStream, input: TokenStream) -> TokenStream { - "struct Test;".parse().unwrap() -} - -#[proc_macro_attribute] -pub fn bench(_: TokenStream, input: TokenStream) -> TokenStream { - "struct Bench;".parse().unwrap() -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowing.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowing.rs deleted file mode 100644 index 0fd8aa5638a..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowing.rs +++ /dev/null @@ -1,16 +0,0 @@ -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::*; - -#[proc_macro_attribute] -pub fn my_attr(_: TokenStream, input: TokenStream) -> TokenStream { - input -} - -#[proc_macro_derive(MyTrait, attributes(my_attr))] -pub fn derive(input: TokenStream) -> TokenStream { - TokenStream::new() -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-panic.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/derive-panic.rs deleted file mode 100644 index 3274f0324e1..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-panic.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic -// force-host - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(A)] -pub fn derive_a(_input: TokenStream) -> TokenStream { - panic!("nope!"); -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs deleted file mode 100644 index 1ed8ef52027..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::*; - -#[proc_macro] -pub fn check(_: TokenStream) -> TokenStream { - " - type Alias = FromOutside; // OK - struct Outer; - mod inner { - type Alias = FromOutside; // `FromOutside` shouldn't be available from here - type Inner = Outer; // `Outer` shouldn't be available from here - } - ".parse().unwrap() -} - -#[proc_macro_attribute] -pub fn check_attr(_: TokenStream, _: TokenStream) -> TokenStream { - " - type AliasAttr = FromOutside; // OK - struct OuterAttr; - mod inner_attr { - type Alias = FromOutside; // `FromOutside` shouldn't be available from here - type Inner = OuterAttr; // `OuterAttr` shouldn't be available from here - } - ".parse().unwrap() -} - -#[proc_macro_derive(CheckDerive)] -pub fn check_derive(_: TokenStream) -> TokenStream { - " - type AliasDerive = FromOutside; // OK - struct OuterDerive; - mod inner_derive { - type Alias = FromOutside; // `FromOutside` shouldn't be available from here - type Inner = OuterDerive; // `OuterDerive` shouldn't be available from here - } - ".parse().unwrap() -} - -#[proc_macro_derive(CheckDeriveLint)] -pub fn check_derive_lint(_: TokenStream) -> TokenStream { - " - type AliasDeriveLint = FromOutside; // OK - struct OuterDeriveLint; - #[allow(proc_macro_derive_resolution_fallback)] - mod inner_derive_lint { - type Alias = FromOutside; // `FromOutside` shouldn't be available from here - type Inner = OuterDeriveLint; // `OuterDeriveLint` shouldn't be available from here - } - ".parse().unwrap() -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/macro-brackets.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/macro-brackets.rs deleted file mode 100644 index be1777f3ebd..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/macro-brackets.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::*; - -#[proc_macro_attribute] -pub fn doit(_: TokenStream, input: TokenStream) -> TokenStream { - input.into_iter().collect() -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/multispan.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/multispan.rs deleted file mode 100644 index 383016f990e..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/multispan.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] -#![feature(proc_macro_diagnostic, proc_macro_span, proc_macro_def_site)] - -extern crate proc_macro; - -use proc_macro::{TokenStream, TokenTree, Span, Diagnostic}; - -fn parse(input: TokenStream) -> Result<(), Diagnostic> { - let mut hi_spans = vec![]; - for tree in input { - if let TokenTree::Ident(ref ident) = tree { - if ident.to_string() == "hi" { - hi_spans.push(ident.span()); - } - } - } - - if !hi_spans.is_empty() { - return Err(Span::def_site() - .error("hello to you, too!") - .span_note(hi_spans, "found these 'hi's")); - } - - Ok(()) -} - -#[proc_macro] -pub fn hello(input: TokenStream) -> TokenStream { - if let Err(diag) = parse(input) { - diag.emit(); - } - - TokenStream::new() -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/nested-item-spans.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/nested-item-spans.rs deleted file mode 100644 index 6b893150b45..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/nested-item-spans.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro_attribute] -pub fn foo(_: TokenStream, item: TokenStream) -> TokenStream { - item.into_iter().collect() -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/parent-source-spans.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/parent-source-spans.rs deleted file mode 100644 index f5590405e61..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/parent-source-spans.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![feature(proc_macro_diagnostic, proc_macro_span)] -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::{TokenStream, TokenTree, Span}; - -fn lit_span(tt: TokenTree) -> (Span, String) { - match tt { - TokenTree::Literal(..) | - TokenTree::Group(..) => (tt.span(), tt.to_string().trim().into()), - _ => panic!("expected a literal in token tree, got: {:?}", tt) - } -} - -#[proc_macro] -pub fn parent_source_spans(input: TokenStream) -> TokenStream { - let mut tokens = input.into_iter(); - let (sp1, str1) = lit_span(tokens.next().expect("first string")); - let _ = tokens.next(); - let (sp2, str2) = lit_span(tokens.next().expect("second string")); - - sp1.error(format!("first final: {}", str1)).emit(); - sp2.error(format!("second final: {}", str2)).emit(); - - if let (Some(p1), Some(p2)) = (sp1.parent(), sp2.parent()) { - p1.error(format!("first parent: {}", str1)).emit(); - p2.error(format!("second parent: {}", str2)).emit(); - - if let (Some(gp1), Some(gp2)) = (p1.parent(), p2.parent()) { - gp1.error(format!("first grandparent: {}", str1)).emit(); - gp2.error(format!("second grandparent: {}", str2)).emit(); - } - } - - sp1.source().error(format!("first source: {}", str1)).emit(); - sp2.source().error(format!("second source: {}", str2)).emit(); - - "ok".parse().unwrap() -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/span-preservation.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/span-preservation.rs deleted file mode 100644 index 65ed9cf7372..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/span-preservation.rs +++ /dev/null @@ -1,12 +0,0 @@ -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_attribute] -pub fn foo(_: TokenStream, input: TokenStream) -> TokenStream { - input.into_iter().collect() -} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/three-equals.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/three-equals.rs deleted file mode 100644 index 569a458f55a..00000000000 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/three-equals.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] -#![feature(proc_macro_diagnostic, proc_macro_span, proc_macro_def_site)] - -extern crate proc_macro; - -use proc_macro::{TokenStream, TokenTree, Span, Diagnostic}; - -fn parse(input: TokenStream) -> Result<(), Diagnostic> { - let mut count = 0; - let mut last_span = Span::def_site(); - for tree in input { - let span = tree.span(); - if count >= 3 { - return Err(span.error(format!("expected EOF, found `{}`.", tree)) - .span_note(last_span, "last good input was here") - .help("input must be: `===`")) - } - - if let TokenTree::Punct(ref tt) = tree { - if tt.as_char() == '=' { - count += 1; - last_span = span; - continue - } - } - return Err(span.error(format!("expected `=`, found `{}`.", tree))); - } - - if count < 3 { - return Err(Span::def_site() - .error(format!("found {} equal signs, need exactly 3", count)) - .help("input must be: `===`")) - } - - Ok(()) -} - -#[proc_macro] -pub fn three_equals(input: TokenStream) -> TokenStream { - if let Err(diag) = parse(input) { - diag.emit(); - return TokenStream::new(); - } - - "3".parse().unwrap() -} diff --git a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.rs b/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.rs deleted file mode 100644 index aa9eae0ba31..00000000000 --- a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.rs +++ /dev/null @@ -1,10 +0,0 @@ -// aux-build:derive-helper-shadowing.rs - -extern crate derive_helper_shadowing; -use derive_helper_shadowing::*; - -#[my_attr] //~ ERROR `my_attr` is ambiguous -#[derive(MyTrait)] -struct S; - -fn main() {} diff --git a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.stderr b/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.stderr deleted file mode 100644 index f04782fac4d..00000000000 --- a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowing.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0659]: `my_attr` is ambiguous (derive helper attribute vs any other name) - --> $DIR/derive-helper-shadowing.rs:6:3 - | -LL | #[my_attr] //~ ERROR `my_attr` is ambiguous - | ^^^^^^^ ambiguous name - | -note: `my_attr` could refer to the derive helper attribute defined here - --> $DIR/derive-helper-shadowing.rs:7:10 - | -LL | #[derive(MyTrait)] - | ^^^^^^^ -note: `my_attr` could also refer to the attribute macro imported here - --> $DIR/derive-helper-shadowing.rs:4:5 - | -LL | use derive_helper_shadowing::*; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `self::my_attr` to refer to this attribute macro unambiguously - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui-fulldeps/proc-macro/generate-mod.rs b/src/test/ui-fulldeps/proc-macro/generate-mod.rs deleted file mode 100644 index 977faf7decd..00000000000 --- a/src/test/ui-fulldeps/proc-macro/generate-mod.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Modules generated by transparent proc macros still acts as barriers for names (issue #50504). - -// aux-build:generate-mod.rs - -extern crate generate_mod; - -struct FromOutside; - -generate_mod::check!(); //~ ERROR cannot find type `FromOutside` in this scope - //~| ERROR cannot find type `Outer` in this scope - -#[generate_mod::check_attr] //~ ERROR cannot find type `FromOutside` in this scope - //~| ERROR cannot find type `OuterAttr` in this scope -struct S; - -#[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope - //~| WARN cannot find type `OuterDerive` in this scope - //~| WARN this was previously accepted - //~| WARN this was previously accepted -struct Z; - -fn inner_block() { - #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope - //~| WARN cannot find type `OuterDerive` in this scope - //~| WARN this was previously accepted - //~| WARN this was previously accepted - struct InnerZ; -} - -#[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed -struct W; - -fn main() {} diff --git a/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs b/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs deleted file mode 100644 index 8b940a0f405..00000000000 --- a/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro = "test"] //~ ERROR: does not take any arguments -pub fn a(a: TokenStream) -> TokenStream { a } - -#[proc_macro()] //~ ERROR: does not take any arguments -pub fn c(a: TokenStream) -> TokenStream { a } - -#[proc_macro(x)] //~ ERROR: does not take any arguments -pub fn d(a: TokenStream) -> TokenStream { a } - -#[proc_macro_attribute = "test"] //~ ERROR: does not take any arguments -pub fn e(_: TokenStream, a: TokenStream) -> TokenStream { a } - -#[proc_macro_attribute()] //~ ERROR: does not take any arguments -pub fn g(_: TokenStream, a: TokenStream) -> TokenStream { a } - -#[proc_macro_attribute(x)] //~ ERROR: does not take any arguments -pub fn h(_: TokenStream, a: TokenStream) -> TokenStream { a } diff --git a/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr b/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr deleted file mode 100644 index 5fd87362db2..00000000000 --- a/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr +++ /dev/null @@ -1,38 +0,0 @@ -error: `#[proc_macro]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:19:1 - | -LL | #[proc_macro = "test"] //~ ERROR: does not take any arguments - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: `#[proc_macro]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:22:1 - | -LL | #[proc_macro()] //~ ERROR: does not take any arguments - | ^^^^^^^^^^^^^^^ - -error: `#[proc_macro]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:25:1 - | -LL | #[proc_macro(x)] //~ ERROR: does not take any arguments - | ^^^^^^^^^^^^^^^^ - -error: `#[proc_macro_attribute]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:28:1 - | -LL | #[proc_macro_attribute = "test"] //~ ERROR: does not take any arguments - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: `#[proc_macro_attribute]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:31:1 - | -LL | #[proc_macro_attribute()] //~ ERROR: does not take any arguments - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: `#[proc_macro_attribute]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:34:1 - | -LL | #[proc_macro_attribute(x)] //~ ERROR: does not take any arguments - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 6 previous errors - diff --git a/src/test/ui-fulldeps/proc-macro/load-panic.rs b/src/test/ui-fulldeps/proc-macro/load-panic.rs deleted file mode 100644 index 462eaf03417..00000000000 --- a/src/test/ui-fulldeps/proc-macro/load-panic.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-panic.rs -// compile-flags:--error-format human - -#[macro_use] -extern crate derive_panic; - -#[derive(A)] -//~^ ERROR: proc-macro derive panicked -struct Foo; - -fn main() {} diff --git a/src/test/ui-fulldeps/proc-macro/macro-brackets.rs b/src/test/ui-fulldeps/proc-macro/macro-brackets.rs deleted file mode 100644 index b29f2775201..00000000000 --- a/src/test/ui-fulldeps/proc-macro/macro-brackets.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:macro-brackets.rs - -extern crate macro_brackets as bar; -use bar::doit; - -macro_rules! id { - ($($t:tt)*) => ($($t)*) -} - -#[doit] -id![static X: u32 = 'a';]; //~ ERROR: mismatched types - - -fn main() {} diff --git a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs b/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs deleted file mode 100644 index e7bb05de88c..00000000000 --- a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![feature(decl_macro)] -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::*; - -#[proc_macro] -pub fn my_macro(input: TokenStream) -> TokenStream { - input -} - -#[proc_macro_attribute] -pub fn my_macro_attr(input: TokenStream, _: TokenStream) -> TokenStream { - input -} - -#[proc_macro_derive(MyTrait)] -pub fn my_macro_derive(input: TokenStream) -> TokenStream { - input -} - -macro my_macro() {} //~ ERROR the name `my_macro` is defined multiple times -macro my_macro_attr() {} //~ ERROR the name `my_macro_attr` is defined multiple times -macro MyTrait() {} //~ ERROR the name `MyTrait` is defined multiple times - -#[proc_macro_derive(SameName)] -pub fn foo(input: TokenStream) -> TokenStream { - input -} - -#[proc_macro] -pub fn SameName(input: TokenStream) -> TokenStream { -//~^ ERROR the name `SameName` is defined multiple times - input -} diff --git a/src/test/ui-fulldeps/proc-macro/macro-use-attr.rs b/src/test/ui-fulldeps/proc-macro/macro-use-attr.rs deleted file mode 100644 index 904562e903d..00000000000 --- a/src/test/ui-fulldeps/proc-macro/macro-use-attr.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-pass -// aux-build:attr_proc_macro.rs - -#[macro_use] extern crate attr_proc_macro; - -#[attr_proc_macro] -struct Foo; - -fn main() { - let _ = Foo; -} diff --git a/src/test/ui-fulldeps/proc-macro/macro-use-bang.rs b/src/test/ui-fulldeps/proc-macro/macro-use-bang.rs deleted file mode 100644 index d7713f48e70..00000000000 --- a/src/test/ui-fulldeps/proc-macro/macro-use-bang.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-pass -// aux-build:bang_proc_macro.rs - -#![feature(proc_macro_hygiene)] - -#[macro_use] -extern crate bang_proc_macro; - -fn main() { - bang_proc_macro!(println!("Hello, world!")); -} diff --git a/src/test/ui-fulldeps/proc-macro/multispan.rs b/src/test/ui-fulldeps/proc-macro/multispan.rs deleted file mode 100644 index 63a95ce211d..00000000000 --- a/src/test/ui-fulldeps/proc-macro/multispan.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:multispan.rs -// ignore-stage1 - -#![feature(proc_macro_hygiene)] - -extern crate multispan; - -use multispan::hello; - -fn main() { - // This one emits no error. - hello!(); - - // Exactly one 'hi'. - hello!(hi); //~ ERROR hello to you, too! - - // Now two, back to back. - hello!(hi hi); //~ ERROR hello to you, too! - - // Now three, back to back. - hello!(hi hi hi); //~ ERROR hello to you, too! - - // Now several, with spacing. - hello!(hi hey hi yo hi beep beep hi hi); //~ ERROR hello to you, too! - hello!(hi there, hi how are you? hi... hi.); //~ ERROR hello to you, too! - hello!(whoah. hi di hi di ho); //~ ERROR hello to you, too! - hello!(hi good hi and good bye); //~ ERROR hello to you, too! -} diff --git a/src/test/ui-fulldeps/proc-macro/nested-item-spans.rs b/src/test/ui-fulldeps/proc-macro/nested-item-spans.rs deleted file mode 100644 index 8f059d6344d..00000000000 --- a/src/test/ui-fulldeps/proc-macro/nested-item-spans.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:nested-item-spans.rs - -extern crate nested_item_spans; - -use nested_item_spans::foo; - -#[foo] -fn another() { - fn bar() { - let x: u32 = "x"; //~ ERROR: mismatched types - } - - bar(); -} - -fn main() { - #[foo] - fn bar() { - let x: u32 = "x"; //~ ERROR: mismatched types - } - - bar(); - another(); -} diff --git a/src/test/ui-fulldeps/proc-macro/non-root.rs b/src/test/ui-fulldeps/proc-macro/non-root.rs deleted file mode 100644 index 24404885788..00000000000 --- a/src/test/ui-fulldeps/proc-macro/non-root.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; -use proc_macro::*; - -fn foo(arg: TokenStream) -> TokenStream { - #[proc_macro] - pub fn foo(arg: TokenStream) -> TokenStream { arg } - //~^ ERROR functions tagged with `#[proc_macro]` must currently reside in the root of the crate - - arg -} diff --git a/src/test/ui-fulldeps/proc-macro/parent-source-spans.rs b/src/test/ui-fulldeps/proc-macro/parent-source-spans.rs deleted file mode 100644 index 7c30a8e328a..00000000000 --- a/src/test/ui-fulldeps/proc-macro/parent-source-spans.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:parent-source-spans.rs -// ignore-stage1 - -#![feature(decl_macro, proc_macro_hygiene)] - -extern crate parent_source_spans; - -use parent_source_spans::parent_source_spans; - -macro one($a:expr, $b:expr) { - two!($a, $b); - //~^ ERROR first parent: "hello" - //~| ERROR second parent: "world" -} - -macro two($a:expr, $b:expr) { - three!($a, $b); - //~^ ERROR first final: "hello" - //~| ERROR second final: "world" - //~| ERROR first final: "yay" - //~| ERROR second final: "rust" -} - -// forwarding tokens directly doesn't create a new source chain -macro three($($tokens:tt)*) { - four!($($tokens)*); -} - -macro four($($tokens:tt)*) { - parent_source_spans!($($tokens)*); -} - -fn main() { - one!("hello", "world"); - //~^ ERROR first grandparent: "hello" - //~| ERROR second grandparent: "world" - //~| ERROR first source: "hello" - //~| ERROR second source: "world" - - two!("yay", "rust"); - //~^ ERROR first parent: "yay" - //~| ERROR second parent: "rust" - //~| ERROR first source: "yay" - //~| ERROR second source: "rust" - - three!("hip", "hop"); - //~^ ERROR first final: "hip" - //~| ERROR second final: "hop" - //~| ERROR first source: "hip" - //~| ERROR second source: "hop" -} diff --git a/src/test/ui-fulldeps/proc-macro/parent-source-spans.stderr b/src/test/ui-fulldeps/proc-macro/parent-source-spans.stderr deleted file mode 100644 index 0442c4f6ce7..00000000000 --- a/src/test/ui-fulldeps/proc-macro/parent-source-spans.stderr +++ /dev/null @@ -1,128 +0,0 @@ -error: first final: "hello" - --> $DIR/parent-source-spans.rs:27:12 - | -LL | three!($a, $b); - | ^^ -... -LL | one!("hello", "world"); - | ----------------------- in this macro invocation - -error: second final: "world" - --> $DIR/parent-source-spans.rs:27:16 - | -LL | three!($a, $b); - | ^^ -... -LL | one!("hello", "world"); - | ----------------------- in this macro invocation - -error: first parent: "hello" - --> $DIR/parent-source-spans.rs:21:5 - | -LL | two!($a, $b); - | ^^^^^^^^^^^^^ -... -LL | one!("hello", "world"); - | ----------------------- in this macro invocation - -error: second parent: "world" - --> $DIR/parent-source-spans.rs:21:5 - | -LL | two!($a, $b); - | ^^^^^^^^^^^^^ -... -LL | one!("hello", "world"); - | ----------------------- in this macro invocation - -error: first grandparent: "hello" - --> $DIR/parent-source-spans.rs:44:5 - | -LL | one!("hello", "world"); - | ^^^^^^^^^^^^^^^^^^^^^^^ - -error: second grandparent: "world" - --> $DIR/parent-source-spans.rs:44:5 - | -LL | one!("hello", "world"); - | ^^^^^^^^^^^^^^^^^^^^^^^ - -error: first source: "hello" - --> $DIR/parent-source-spans.rs:44:5 - | -LL | one!("hello", "world"); - | ^^^^^^^^^^^^^^^^^^^^^^^ - -error: second source: "world" - --> $DIR/parent-source-spans.rs:44:5 - | -LL | one!("hello", "world"); - | ^^^^^^^^^^^^^^^^^^^^^^^ - -error: first final: "yay" - --> $DIR/parent-source-spans.rs:27:12 - | -LL | three!($a, $b); - | ^^ -... -LL | two!("yay", "rust"); - | -------------------- in this macro invocation - -error: second final: "rust" - --> $DIR/parent-source-spans.rs:27:16 - | -LL | three!($a, $b); - | ^^ -... -LL | two!("yay", "rust"); - | -------------------- in this macro invocation - -error: first parent: "yay" - --> $DIR/parent-source-spans.rs:50:5 - | -LL | two!("yay", "rust"); - | ^^^^^^^^^^^^^^^^^^^^ - -error: second parent: "rust" - --> $DIR/parent-source-spans.rs:50:5 - | -LL | two!("yay", "rust"); - | ^^^^^^^^^^^^^^^^^^^^ - -error: first source: "yay" - --> $DIR/parent-source-spans.rs:50:5 - | -LL | two!("yay", "rust"); - | ^^^^^^^^^^^^^^^^^^^^ - -error: second source: "rust" - --> $DIR/parent-source-spans.rs:50:5 - | -LL | two!("yay", "rust"); - | ^^^^^^^^^^^^^^^^^^^^ - -error: first final: "hip" - --> $DIR/parent-source-spans.rs:56:12 - | -LL | three!("hip", "hop"); - | ^^^^^ - -error: second final: "hop" - --> $DIR/parent-source-spans.rs:56:19 - | -LL | three!("hip", "hop"); - | ^^^^^ - -error: first source: "hip" - --> $DIR/parent-source-spans.rs:56:12 - | -LL | three!("hip", "hop"); - | ^^^^^ - -error: second source: "hop" - --> $DIR/parent-source-spans.rs:56:19 - | -LL | three!("hip", "hop"); - | ^^^^^ - -error: aborting due to 18 previous errors - diff --git a/src/test/ui-fulldeps/proc-macro/signature.rs b/src/test/ui-fulldeps/proc-macro/signature.rs deleted file mode 100644 index f2ea6f778cd..00000000000 --- a/src/test/ui-fulldeps/proc-macro/signature.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "proc-macro"] -#![allow(warnings)] - -extern crate proc_macro; - -#[proc_macro_derive(A)] -pub unsafe extern fn foo(a: i32, b: u32) -> u32 { - //~^ ERROR: mismatched types - loop {} -} diff --git a/src/test/ui-fulldeps/proc-macro/span-preservation.rs b/src/test/ui-fulldeps/proc-macro/span-preservation.rs deleted file mode 100644 index adcb42ab2d1..00000000000 --- a/src/test/ui-fulldeps/proc-macro/span-preservation.rs +++ /dev/null @@ -1,51 +0,0 @@ -// aux-build:span-preservation.rs - -// For each of these, we should get the appropriate type mismatch error message, -// and the function should be echoed. - -extern crate span_preservation as foo; - -use foo::foo; - -#[foo] -fn a() { - let x: usize = "hello";;;;; -} - -#[foo] -fn b(x: Option) -> usize { - match x { - Some(x) => { return x }, - None => 10 - } -} - -#[foo] -fn c() { - struct Foo { - a: usize - } - - struct Bar { - a: usize, - b: usize - } - - let x = Foo { a: 10isize }; - let y = Foo { a: 10, b: 10isize }; -} - -// FIXME: This doesn't work at the moment. See the one below. The pretty-printer -// injects a "C" between `extern` and `fn` which causes a "probably_eq" -// `TokenStream` mismatch. The lack of `"C"` should be preserved in the AST. -#[foo] -extern fn bar() { - 0 -} - -#[foo] -extern "C" fn baz() { - 0 -} - -fn main() {} diff --git a/src/test/ui-fulldeps/proc-macro/span-preservation.stderr b/src/test/ui-fulldeps/proc-macro/span-preservation.stderr deleted file mode 100644 index f33245aec37..00000000000 --- a/src/test/ui-fulldeps/proc-macro/span-preservation.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error[E0308]: mismatched types - | - = note: expected type `()` - found type `{integer}` - -error[E0308]: mismatched types - --> $DIR/span-preservation.rs:12:20 - | -LL | let x: usize = "hello";;;;; - | ^^^^^^^ expected usize, found reference - | - = note: expected type `usize` - found type `&'static str` - -error[E0308]: mismatched types - --> $DIR/span-preservation.rs:18:29 - | -LL | Some(x) => { return x }, - | ^ expected usize, found isize - -error[E0308]: mismatched types - --> $DIR/span-preservation.rs:34:22 - | -LL | let x = Foo { a: 10isize }; - | ^^^^^^^ expected usize, found isize - -error[E0560]: struct `c::Foo` has no field named `b` - --> $DIR/span-preservation.rs:35:26 - | -LL | let y = Foo { a: 10, b: 10isize }; - | ^ `c::Foo` does not have this field - | - = note: available fields are: `a` - -error[E0308]: mismatched types - --> $DIR/span-preservation.rs:48:5 - | -LL | extern "C" fn baz() { - | - possibly return type missing here? -LL | 0 - | ^ expected (), found integral variable - | - = note: expected type `()` - found type `{integer}` - -error: aborting due to 6 previous errors - -Some errors occurred: E0308, E0560. -For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui-fulldeps/proc-macro/three-equals.rs b/src/test/ui-fulldeps/proc-macro/three-equals.rs deleted file mode 100644 index dd81b1017eb..00000000000 --- a/src/test/ui-fulldeps/proc-macro/three-equals.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:three-equals.rs -// ignore-stage1 - -#![feature(proc_macro_hygiene)] - -extern crate three_equals; - -use three_equals::three_equals; - -fn main() { - // This one is okay. - three_equals!(===); - - // Need exactly three equals. - three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3 - - // Need exactly three equals. - three_equals!(=====); //~ ERROR expected EOF - - // Only equals accepted. - three_equals!(abc); //~ ERROR expected `=` - - // Only equals accepted. - three_equals!(!!); //~ ERROR expected `=` - - // Only three characters expected. - three_equals!(===a); //~ ERROR expected EOF -} diff --git a/src/test/ui-fulldeps/resolve-error.rs b/src/test/ui-fulldeps/resolve-error.rs deleted file mode 100644 index 1940151357c..00000000000 --- a/src/test/ui-fulldeps/resolve-error.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:derive-foo.rs -// aux-build:derive-clona.rs -// aux-build:attr_proc_macro.rs -// aux-build:bang_proc_macro.rs - -#![feature(custom_attribute)] - -#[macro_use] -extern crate derive_foo; -#[macro_use] -extern crate derive_clona; -extern crate attr_proc_macro; -extern crate bang_proc_macro; - -use attr_proc_macro::attr_proc_macro; -use bang_proc_macro::bang_proc_macro; - -macro_rules! FooWithLongNam { - () => {} -} - -macro_rules! attr_proc_mac { - () => {} -} - -#[derive(FooWithLongNan)] -//~^ ERROR cannot find -struct Foo; - -#[attr_proc_macra] // OK, interpreted as a custom attribute -struct Bar; - -#[FooWithLongNan] // OK, interpreted as a custom attribute -struct Asdf; - -#[derive(Dlone)] -//~^ ERROR cannot find -struct A; - -#[derive(Dlona)] -//~^ ERROR cannot find -struct B; - -#[derive(attr_proc_macra)] -//~^ ERROR cannot find -struct C; - -fn main() { - FooWithLongNama!(); - //~^ ERROR cannot find - - attr_proc_macra!(); - //~^ ERROR cannot find - - Dlona!(); - //~^ ERROR cannot find - - bang_proc_macrp!(); - //~^ ERROR cannot find -} diff --git a/src/test/ui-fulldeps/rust-2018/auxiliary/suggestions-not-always-applicable.rs b/src/test/ui-fulldeps/rust-2018/auxiliary/suggestions-not-always-applicable.rs deleted file mode 100644 index 7ae4731fde1..00000000000 --- a/src/test/ui-fulldeps/rust-2018/auxiliary/suggestions-not-always-applicable.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "proc-macro"] - -extern crate proc_macro; - -use proc_macro::*; - -#[proc_macro_attribute] -pub fn foo(_attr: TokenStream, _f: TokenStream) -> TokenStream { - "pub fn foo() -> ::Foo { ::Foo }".parse().unwrap() -} diff --git a/src/test/ui-fulldeps/rust-2018/proc-macro-crate-in-paths.rs b/src/test/ui-fulldeps/rust-2018/proc-macro-crate-in-paths.rs deleted file mode 100644 index 1068c058745..00000000000 --- a/src/test/ui-fulldeps/rust-2018/proc-macro-crate-in-paths.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-pass - -#![crate_type = "proc-macro"] -#![deny(rust_2018_compatibility)] -#![feature(rust_2018_preview)] - -extern crate proc_macro; - -use proc_macro::TokenStream; - -#[proc_macro_derive(Template, attributes(template))] -pub fn derive_template(input: TokenStream) -> TokenStream { - input -} diff --git a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.fixed b/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.fixed deleted file mode 100644 index b64ebed0305..00000000000 --- a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.fixed +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:suggestions-not-always-applicable.rs -// edition:2015 -// run-rustfix -// rustfix-only-machine-applicable -// compile-pass - -#![feature(rust_2018_preview)] -#![warn(rust_2018_compatibility)] - -extern crate suggestions_not_always_applicable as foo; - -pub struct Foo; - -mod test { - use crate::foo::foo; - - #[foo] //~ WARN: absolute paths must start with - //~| WARN: previously accepted - //~| WARN: absolute paths - //~| WARN: previously accepted - fn main() { - } -} - -fn main() { - test::foo(); -} diff --git a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.rs b/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.rs deleted file mode 100644 index b64ebed0305..00000000000 --- a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:suggestions-not-always-applicable.rs -// edition:2015 -// run-rustfix -// rustfix-only-machine-applicable -// compile-pass - -#![feature(rust_2018_preview)] -#![warn(rust_2018_compatibility)] - -extern crate suggestions_not_always_applicable as foo; - -pub struct Foo; - -mod test { - use crate::foo::foo; - - #[foo] //~ WARN: absolute paths must start with - //~| WARN: previously accepted - //~| WARN: absolute paths - //~| WARN: previously accepted - fn main() { - } -} - -fn main() { - test::foo(); -} diff --git a/src/test/ui-fulldeps/unnecessary-extern-crate.rs b/src/test/ui-fulldeps/unnecessary-extern-crate.rs deleted file mode 100644 index 1cdc9229d07..00000000000 --- a/src/test/ui-fulldeps/unnecessary-extern-crate.rs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// edition:2018 - -#![deny(unused_extern_crates)] -#![feature(alloc, test, libc, crate_visibility_modifier)] - -extern crate alloc; -//~^ ERROR unused extern crate -//~| HELP remove -extern crate alloc as x; -//~^ ERROR unused extern crate -//~| HELP remove - -extern crate proc_macro; - -#[macro_use] -extern crate test; - -pub extern crate test as y; - -pub extern crate libc; - -pub(crate) extern crate libc as a; - -crate extern crate libc as b; - -mod foo { - pub(in crate::foo) extern crate libc as c; - - pub(super) extern crate libc as d; - - extern crate alloc; - //~^ ERROR unused extern crate - //~| HELP remove - - extern crate alloc as x; - //~^ ERROR unused extern crate - //~| HELP remove - - pub extern crate test; - - pub extern crate test as y; - - mod bar { - extern crate alloc; - //~^ ERROR unused extern crate - //~| HELP remove - - extern crate alloc as x; - //~^ ERROR unused extern crate - //~| HELP remove - - pub(in crate::foo::bar) extern crate libc as e; - - fn dummy() { - unsafe { - e::getpid(); - } - } - } - - fn dummy() { - unsafe { - c::getpid(); - d::getpid(); - } - } -} - - -fn main() { - unsafe { a::getpid(); } - unsafe { b::getpid(); } - - proc_macro::TokenStream::new(); -} diff --git a/src/test/ui-fulldeps/unnecessary-extern-crate.stderr b/src/test/ui-fulldeps/unnecessary-extern-crate.stderr deleted file mode 100644 index 58ec5901585..00000000000 --- a/src/test/ui-fulldeps/unnecessary-extern-crate.stderr +++ /dev/null @@ -1,44 +0,0 @@ -error: unused extern crate - --> $DIR/unnecessary-extern-crate.rs:16:1 - | -LL | extern crate alloc; - | ^^^^^^^^^^^^^^^^^^^ help: remove it - | -note: lint level defined here - --> $DIR/unnecessary-extern-crate.rs:13:9 - | -LL | #![deny(unused_extern_crates)] - | ^^^^^^^^^^^^^^^^^^^^ - -error: unused extern crate - --> $DIR/unnecessary-extern-crate.rs:19:1 - | -LL | extern crate alloc as x; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it - -error: unused extern crate - --> $DIR/unnecessary-extern-crate.rs:41:5 - | -LL | extern crate alloc; - | ^^^^^^^^^^^^^^^^^^^ help: remove it - -error: unused extern crate - --> $DIR/unnecessary-extern-crate.rs:45:5 - | -LL | extern crate alloc as x; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it - -error: unused extern crate - --> $DIR/unnecessary-extern-crate.rs:54:9 - | -LL | extern crate alloc; - | ^^^^^^^^^^^^^^^^^^^ help: remove it - -error: unused extern crate - --> $DIR/unnecessary-extern-crate.rs:58:9 - | -LL | extern crate alloc as x; - | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it - -error: aborting due to 6 previous errors - diff --git a/src/test/ui/E0501.ast.nll.stderr b/src/test/ui/E0501.ast.nll.stderr index 72fda9079d6..1d0102d100e 100644 --- a/src/test/ui/E0501.ast.nll.stderr +++ b/src/test/ui/E0501.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access - --> $DIR/E0501.rs:28:23 + --> $DIR/E0501.rs:18:23 | LL | let bar = || { | -- closure construction occurs here @@ -7,13 +7,13 @@ LL | inside_closure(a) | - first borrow occurs due to use of `a` in closure LL | }; LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access - | ^ borrow occurs here + | ^ second borrow occurs here ... LL | drop(bar); | --- first borrow later used here error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access - --> $DIR/E0501.rs:31:23 + --> $DIR/E0501.rs:21:23 | LL | let bar = || { | -- closure construction occurs here @@ -21,7 +21,7 @@ LL | inside_closure(a) | - first borrow occurs due to use of `a` in closure ... LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access - | ^ borrow occurs here + | ^ second borrow occurs here ... LL | drop(bar); | --- first borrow later used here diff --git a/src/test/ui/E0501.ast.stderr b/src/test/ui/E0501.ast.stderr index 229b1665017..e0bd7a08d7f 100644 --- a/src/test/ui/E0501.ast.stderr +++ b/src/test/ui/E0501.ast.stderr @@ -1,5 +1,5 @@ error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access - --> $DIR/E0501.rs:28:23 + --> $DIR/E0501.rs:18:23 | LL | let bar = || { | -- closure construction occurs here @@ -13,7 +13,7 @@ LL | } | - borrow from closure ends here error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access - --> $DIR/E0501.rs:31:23 + --> $DIR/E0501.rs:21:23 | LL | let bar = || { | -- closure construction occurs here diff --git a/src/test/ui/E0501.mir.stderr b/src/test/ui/E0501.mir.stderr index 72fda9079d6..1d0102d100e 100644 --- a/src/test/ui/E0501.mir.stderr +++ b/src/test/ui/E0501.mir.stderr @@ -1,5 +1,5 @@ error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access - --> $DIR/E0501.rs:28:23 + --> $DIR/E0501.rs:18:23 | LL | let bar = || { | -- closure construction occurs here @@ -7,13 +7,13 @@ LL | inside_closure(a) | - first borrow occurs due to use of `a` in closure LL | }; LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access - | ^ borrow occurs here + | ^ second borrow occurs here ... LL | drop(bar); | --- first borrow later used here error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access - --> $DIR/E0501.rs:31:23 + --> $DIR/E0501.rs:21:23 | LL | let bar = || { | -- closure construction occurs here @@ -21,7 +21,7 @@ LL | inside_closure(a) | - first borrow occurs due to use of `a` in closure ... LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access - | ^ borrow occurs here + | ^ second borrow occurs here ... LL | drop(bar); | --- first borrow later used here diff --git a/src/test/ui/E0501.rs b/src/test/ui/E0501.rs index 5643e1ef091..a710e23a670 100644 --- a/src/test/ui/E0501.rs +++ b/src/test/ui/E0501.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/E0506.ast.nll.stderr b/src/test/ui/E0506.ast.nll.stderr index cf6b8d9c8d1..b66c1d129a7 100644 --- a/src/test/ui/E0506.ast.nll.stderr +++ b/src/test/ui/E0506.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `fancy_num` because it is borrowed - --> $DIR/E0506.rs:21:5 + --> $DIR/E0506.rs:11:5 | LL | let fancy_ref = &fancy_num; | ---------- borrow of `fancy_num` occurs here diff --git a/src/test/ui/E0506.ast.stderr b/src/test/ui/E0506.ast.stderr index 54b4e163681..d459dcdc219 100644 --- a/src/test/ui/E0506.ast.stderr +++ b/src/test/ui/E0506.ast.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `fancy_num` because it is borrowed - --> $DIR/E0506.rs:21:5 + --> $DIR/E0506.rs:11:5 | LL | let fancy_ref = &fancy_num; | --------- borrow of `fancy_num` occurs here diff --git a/src/test/ui/E0506.mir.stderr b/src/test/ui/E0506.mir.stderr index cf6b8d9c8d1..b66c1d129a7 100644 --- a/src/test/ui/E0506.mir.stderr +++ b/src/test/ui/E0506.mir.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `fancy_num` because it is borrowed - --> $DIR/E0506.rs:21:5 + --> $DIR/E0506.rs:11:5 | LL | let fancy_ref = &fancy_num; | ---------- borrow of `fancy_num` occurs here diff --git a/src/test/ui/E0506.rs b/src/test/ui/E0506.rs index c4a7f257394..04aaa008b5a 100644 --- a/src/test/ui/E0506.rs +++ b/src/test/ui/E0506.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/E0508-fail.ast.nll.stderr b/src/test/ui/E0508-fail.ast.nll.stderr index fda6c24dc87..4cc1cf89d6c 100644 --- a/src/test/ui/E0508-fail.ast.nll.stderr +++ b/src/test/ui/E0508-fail.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array - --> $DIR/E0508-fail.rs:18:18 + --> $DIR/E0508-fail.rs:8:18 | LL | let _value = array[0]; //[ast]~ ERROR [E0508] | ^^^^^^^^ diff --git a/src/test/ui/E0508-fail.ast.stderr b/src/test/ui/E0508-fail.ast.stderr index faf7411af31..57959c96f63 100644 --- a/src/test/ui/E0508-fail.ast.stderr +++ b/src/test/ui/E0508-fail.ast.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array - --> $DIR/E0508-fail.rs:18:18 + --> $DIR/E0508-fail.rs:8:18 | LL | let _value = array[0]; //[ast]~ ERROR [E0508] | ^^^^^^^^ diff --git a/src/test/ui/E0508-fail.mir.stderr b/src/test/ui/E0508-fail.mir.stderr index fda6c24dc87..4cc1cf89d6c 100644 --- a/src/test/ui/E0508-fail.mir.stderr +++ b/src/test/ui/E0508-fail.mir.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array - --> $DIR/E0508-fail.rs:18:18 + --> $DIR/E0508-fail.rs:8:18 | LL | let _value = array[0]; //[ast]~ ERROR [E0508] | ^^^^^^^^ diff --git a/src/test/ui/E0508-fail.rs b/src/test/ui/E0508-fail.rs index 0c3dce6b034..20eac6cd351 100644 --- a/src/test/ui/E0508-fail.rs +++ b/src/test/ui/E0508-fail.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/E0508.nll.stderr b/src/test/ui/E0508.nll.stderr index 025ff874bce..82fdce2112e 100644 --- a/src/test/ui/E0508.nll.stderr +++ b/src/test/ui/E0508.nll.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array - --> $DIR/E0508.rs:15:18 + --> $DIR/E0508.rs:5:18 | LL | let _value = array[0]; //~ ERROR [E0508] | ^^^^^^^^ diff --git a/src/test/ui/E0508.rs b/src/test/ui/E0508.rs index 86445ad8982..072c3d66183 100644 --- a/src/test/ui/E0508.rs +++ b/src/test/ui/E0508.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct NonCopy; fn main() { diff --git a/src/test/ui/E0508.stderr b/src/test/ui/E0508.stderr index 28ce0d971c6..1e7b4071d5d 100644 --- a/src/test/ui/E0508.stderr +++ b/src/test/ui/E0508.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array - --> $DIR/E0508.rs:15:18 + --> $DIR/E0508.rs:5:18 | LL | let _value = array[0]; //~ ERROR [E0508] | ^^^^^^^^ diff --git a/src/test/ui/E0583.rs b/src/test/ui/E0583.rs index 3a5255d0f5f..969de79c058 100644 --- a/src/test/ui/E0583.rs +++ b/src/test/ui/E0583.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod module_that_doesnt_exist; //~ ERROR E0583 fn main() { diff --git a/src/test/ui/E0583.stderr b/src/test/ui/E0583.stderr index 82e1cccbb68..33b584ccefe 100644 --- a/src/test/ui/E0583.stderr +++ b/src/test/ui/E0583.stderr @@ -1,5 +1,5 @@ error[E0583]: file not found for module `module_that_doesnt_exist` - --> $DIR/E0583.rs:11:5 + --> $DIR/E0583.rs:1:5 | LL | mod module_that_doesnt_exist; //~ ERROR E0583 | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/E0594.ast.nll.stderr b/src/test/ui/E0594.ast.nll.stderr index f96eb01abe4..54681a29b81 100644 --- a/src/test/ui/E0594.ast.nll.stderr +++ b/src/test/ui/E0594.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to immutable static item `NUM` - --> $DIR/E0594.rs:17:5 + --> $DIR/E0594.rs:7:5 | LL | NUM = 20; //[ast]~ ERROR E0594 | ^^^^^^^^ cannot assign diff --git a/src/test/ui/E0594.ast.stderr b/src/test/ui/E0594.ast.stderr index f84c1f56ad0..4eb9ba133ae 100644 --- a/src/test/ui/E0594.ast.stderr +++ b/src/test/ui/E0594.ast.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to immutable static item - --> $DIR/E0594.rs:17:5 + --> $DIR/E0594.rs:7:5 | LL | NUM = 20; //[ast]~ ERROR E0594 | ^^^^^^^^ diff --git a/src/test/ui/E0594.mir.stderr b/src/test/ui/E0594.mir.stderr index f96eb01abe4..54681a29b81 100644 --- a/src/test/ui/E0594.mir.stderr +++ b/src/test/ui/E0594.mir.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to immutable static item `NUM` - --> $DIR/E0594.rs:17:5 + --> $DIR/E0594.rs:7:5 | LL | NUM = 20; //[ast]~ ERROR E0594 | ^^^^^^^^ cannot assign diff --git a/src/test/ui/E0594.rs b/src/test/ui/E0594.rs index e5e96451d13..a8ca2fe6161 100644 --- a/src/test/ui/E0594.rs +++ b/src/test/ui/E0594.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/E0596.ast.nll.stderr b/src/test/ui/E0596.ast.nll.stderr index 589db4a032d..e5da6649f5a 100644 --- a/src/test/ui/E0596.ast.nll.stderr +++ b/src/test/ui/E0596.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/E0596.rs:16:13 + --> $DIR/E0596.rs:6:13 | LL | let x = 1; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/E0596.ast.stderr b/src/test/ui/E0596.ast.stderr index 6aec37d4972..6e65cc855e7 100644 --- a/src/test/ui/E0596.ast.stderr +++ b/src/test/ui/E0596.ast.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable - --> $DIR/E0596.rs:16:18 + --> $DIR/E0596.rs:6:18 | LL | let x = 1; | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/E0596.mir.stderr b/src/test/ui/E0596.mir.stderr index 589db4a032d..e5da6649f5a 100644 --- a/src/test/ui/E0596.mir.stderr +++ b/src/test/ui/E0596.mir.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/E0596.rs:16:13 + --> $DIR/E0596.rs:6:13 | LL | let x = 1; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/E0596.rs b/src/test/ui/E0596.rs index 52bdff55d86..3ea2d64a404 100644 --- a/src/test/ui/E0596.rs +++ b/src/test/ui/E0596.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/E0642.rs b/src/test/ui/E0642.rs index 58ccfc56ab7..cfbd362c1da 100644 --- a/src/test/ui/E0642.rs +++ b/src/test/ui/E0642.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Clone, Copy)] struct S; @@ -16,6 +6,8 @@ trait T { fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies + fn method(S { .. }: S) {} //~ ERROR patterns aren't allowed in methods without bodies + fn f(&ident: &S) {} // ok fn g(&&ident: &&S) {} // ok fn h(mut ident: S) {} // ok diff --git a/src/test/ui/E0642.stderr b/src/test/ui/E0642.stderr index 34c163e2109..4c82a6cbd21 100644 --- a/src/test/ui/E0642.stderr +++ b/src/test/ui/E0642.stderr @@ -1,5 +1,5 @@ error[E0642]: patterns aren't allowed in methods without bodies - --> $DIR/E0642.rs:15:12 + --> $DIR/E0642.rs:5:12 | LL | fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies | ^^^^^^ @@ -9,7 +9,7 @@ LL | fn foo(_: (i32, i32)); //~ ERROR patterns aren't allowed in methods wit | ^ error[E0642]: patterns aren't allowed in methods without bodies - --> $DIR/E0642.rs:17:12 + --> $DIR/E0642.rs:7:12 | LL | fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies | ^^^^^^ @@ -18,6 +18,16 @@ help: give this argument a name or use an underscore to ignore it LL | fn bar(_: (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies | ^ -error: aborting due to 2 previous errors +error[E0642]: patterns aren't allowed in methods without bodies + --> $DIR/E0642.rs:9:15 + | +LL | fn method(S { .. }: S) {} //~ ERROR patterns aren't allowed in methods without bodies + | ^^^^^^^^ +help: give this argument a name or use an underscore to ignore it + | +LL | fn method(_: S) {} //~ ERROR patterns aren't allowed in methods without bodies + | ^ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0642`. diff --git a/src/test/ui/E0660.rs b/src/test/ui/E0660.rs index 2981e4ea8b3..6280d390610 100644 --- a/src/test/ui/E0660.rs +++ b/src/test/ui/E0660.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(asm)] fn main() { diff --git a/src/test/ui/E0660.stderr b/src/test/ui/E0660.stderr index e8acb282be9..d355531ef5d 100644 --- a/src/test/ui/E0660.stderr +++ b/src/test/ui/E0660.stderr @@ -1,11 +1,11 @@ error[E0660]: malformed inline assembly - --> $DIR/E0660.rs:15:5 + --> $DIR/E0660.rs:5:5 | LL | asm!("nop" "nop"); | ^^^^^^^^^^^^^^^^^^ error[E0660]: malformed inline assembly - --> $DIR/E0660.rs:17:5 + --> $DIR/E0660.rs:7:5 | LL | asm!("nop" "nop" : "=r"(a)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/E0661.rs b/src/test/ui/E0661.rs index 2410eba0245..8d355a8a021 100644 --- a/src/test/ui/E0661.rs +++ b/src/test/ui/E0661.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(asm)] fn main() { diff --git a/src/test/ui/E0661.stderr b/src/test/ui/E0661.stderr index 90aeca5612a..1f41f89608f 100644 --- a/src/test/ui/E0661.stderr +++ b/src/test/ui/E0661.stderr @@ -1,5 +1,5 @@ error[E0661]: output operand constraint lacks '=' or '+' - --> $DIR/E0661.rs:15:18 + --> $DIR/E0661.rs:5:18 | LL | asm!("nop" : "r"(a)); | ^^^ diff --git a/src/test/ui/E0662.rs b/src/test/ui/E0662.rs index 700540fd1e0..7fe528c4745 100644 --- a/src/test/ui/E0662.rs +++ b/src/test/ui/E0662.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(asm)] fn main() { diff --git a/src/test/ui/E0662.stderr b/src/test/ui/E0662.stderr index 31655ca1987..2156b43973f 100644 --- a/src/test/ui/E0662.stderr +++ b/src/test/ui/E0662.stderr @@ -1,5 +1,5 @@ error[E0662]: input operand constraint contains '=' - --> $DIR/E0662.rs:16:12 + --> $DIR/E0662.rs:6:12 | LL | : "=test"("a") //~ ERROR E0662 | ^^^^^^^ diff --git a/src/test/ui/E0663.rs b/src/test/ui/E0663.rs index dea2b9156b7..e5b8156cfb3 100644 --- a/src/test/ui/E0663.rs +++ b/src/test/ui/E0663.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(asm)] fn main() { diff --git a/src/test/ui/E0663.stderr b/src/test/ui/E0663.stderr index 0a287620f20..66667a6dc88 100644 --- a/src/test/ui/E0663.stderr +++ b/src/test/ui/E0663.stderr @@ -1,5 +1,5 @@ error[E0663]: input operand constraint contains '+' - --> $DIR/E0663.rs:16:12 + --> $DIR/E0663.rs:6:12 | LL | : "+test"("a") //~ ERROR E0663 | ^^^^^^^ diff --git a/src/test/ui/E0664.rs b/src/test/ui/E0664.rs index 9773f604c46..29ec7ced4fd 100644 --- a/src/test/ui/E0664.rs +++ b/src/test/ui/E0664.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(asm)] fn main() { diff --git a/src/test/ui/E0664.stderr b/src/test/ui/E0664.stderr index 1e79c84cbc8..972b10379d4 100644 --- a/src/test/ui/E0664.stderr +++ b/src/test/ui/E0664.stderr @@ -1,5 +1,5 @@ error[E0664]: clobber should not be surrounded by braces - --> $DIR/E0664.rs:17:12 + --> $DIR/E0664.rs:7:12 | LL | : "{eax}" //~ ERROR E0664 | ^^^^^^^ diff --git a/src/test/ui/E0665.rs b/src/test/ui/E0665.rs index 0a0bd3f5905..cfd42bd9aac 100644 --- a/src/test/ui/E0665.rs +++ b/src/test/ui/E0665.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Default)] //~ ERROR E0665 enum Food { Sweet, diff --git a/src/test/ui/E0665.stderr b/src/test/ui/E0665.stderr index 268224cac38..e044d606531 100644 --- a/src/test/ui/E0665.stderr +++ b/src/test/ui/E0665.stderr @@ -1,5 +1,5 @@ error[E0665]: `Default` cannot be derived for enums, only structs - --> $DIR/E0665.rs:11:10 + --> $DIR/E0665.rs:1:10 | LL | #[derive(Default)] //~ ERROR E0665 | ^^^^^^^ diff --git a/src/test/ui/E0705.rs b/src/test/ui/E0705.rs index 19f9ecc26cf..cc2b8f64d9f 100644 --- a/src/test/ui/E0705.rs +++ b/src/test/ui/E0705.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // This is a stub feature that doesn't control anything, so to make tidy happy, diff --git a/src/test/ui/E0705.stderr b/src/test/ui/E0705.stderr index ccf8a04fdfc..1cb83f2e381 100644 --- a/src/test/ui/E0705.stderr +++ b/src/test/ui/E0705.stderr @@ -1,5 +1,5 @@ warning[E0705]: the feature `test_2018_feature` is included in the Rust 2018 edition - --> $DIR/E0705.rs:16:12 + --> $DIR/E0705.rs:6:12 | LL | #![feature(test_2018_feature)] | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/absolute-paths-in-nested-use-groups.rs b/src/test/ui/absolute-paths-in-nested-use-groups.rs index fe052f2f47f..96b5131674c 100644 --- a/src/test/ui/absolute-paths-in-nested-use-groups.rs +++ b/src/test/ui/absolute-paths-in-nested-use-groups.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] mod foo {} diff --git a/src/test/ui/absolute-paths-in-nested-use-groups.stderr b/src/test/ui/absolute-paths-in-nested-use-groups.stderr index 2bbd7b0ad3a..72ad0509e46 100644 --- a/src/test/ui/absolute-paths-in-nested-use-groups.stderr +++ b/src/test/ui/absolute-paths-in-nested-use-groups.stderr @@ -1,17 +1,17 @@ error[E0433]: failed to resolve: crate root in paths can only be used in start position - --> $DIR/absolute-paths-in-nested-use-groups.rs:16:5 + --> $DIR/absolute-paths-in-nested-use-groups.rs:6:5 | LL | ::bar, //~ ERROR crate root in paths can only be used in start position | ^ crate root in paths can only be used in start position error[E0433]: failed to resolve: `super` in paths can only be used in start position - --> $DIR/absolute-paths-in-nested-use-groups.rs:17:5 + --> $DIR/absolute-paths-in-nested-use-groups.rs:7:5 | LL | super::bar, //~ ERROR `super` in paths can only be used in start position | ^^^^^ `super` in paths can only be used in start position error[E0433]: failed to resolve: `self` in paths can only be used in start position - --> $DIR/absolute-paths-in-nested-use-groups.rs:18:5 + --> $DIR/absolute-paths-in-nested-use-groups.rs:8:5 | LL | self::bar, //~ ERROR `self` in paths can only be used in start position | ^^^^ `self` in paths can only be used in start position diff --git a/src/test/ui/access-mode-in-closures.nll.stderr b/src/test/ui/access-mode-in-closures.nll.stderr index b9de60f43f7..0c9a62351d2 100644 --- a/src/test/ui/access-mode-in-closures.nll.stderr +++ b/src/test/ui/access-mode-in-closures.nll.stderr @@ -1,17 +1,17 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/access-mode-in-closures.rs:19:15 + --> $DIR/access-mode-in-closures.rs:8:15 | -LL | match *s { sty(v) => v } //~ ERROR cannot move out - | ^^ - data moved here +LL | match *s { S(v) => v } //~ ERROR cannot move out + | ^^ - data moved here | | | cannot move out of borrowed content | help: consider removing the `*`: `s` | note: move occurs because `v` has type `std::vec::Vec`, which does not implement the `Copy` trait - --> $DIR/access-mode-in-closures.rs:19:24 + --> $DIR/access-mode-in-closures.rs:8:22 | -LL | match *s { sty(v) => v } //~ ERROR cannot move out - | ^ +LL | match *s { S(v) => v } //~ ERROR cannot move out + | ^ error: aborting due to previous error diff --git a/src/test/ui/access-mode-in-closures.rs b/src/test/ui/access-mode-in-closures.rs index bad192fc2cf..9bd90e70aba 100644 --- a/src/test/ui/access-mode-in-closures.rs +++ b/src/test/ui/access-mode-in-closures.rs @@ -1,21 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +struct S(Vec); - -struct sty(Vec ); - -fn unpack(_unpack: F) where F: FnOnce(&sty) -> Vec {} +fn unpack(_unpack: F) where F: FnOnce(&S) -> Vec {} fn main() { let _foo = unpack(|s| { // Test that `s` is moved here. - match *s { sty(v) => v } //~ ERROR cannot move out + match *s { S(v) => v } //~ ERROR cannot move out }); } diff --git a/src/test/ui/access-mode-in-closures.stderr b/src/test/ui/access-mode-in-closures.stderr index daecbb6ed29..0423c713531 100644 --- a/src/test/ui/access-mode-in-closures.stderr +++ b/src/test/ui/access-mode-in-closures.stderr @@ -1,8 +1,8 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/access-mode-in-closures.rs:19:15 + --> $DIR/access-mode-in-closures.rs:8:15 | -LL | match *s { sty(v) => v } //~ ERROR cannot move out - | ^^ - hint: to prevent move, use `ref v` or `ref mut v` +LL | match *s { S(v) => v } //~ ERROR cannot move out + | ^^ - hint: to prevent move, use `ref v` or `ref mut v` | | | cannot move out of borrowed content diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.rs b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.rs index e98f22b301e..f1a3abad798 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.rs +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort #![feature(alloc_error_handler, panic_handler, lang_items)] diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr index 6dd905ceab4..8efbf7f78d9 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr @@ -1,11 +1,11 @@ error: return type should be `!` - --> $DIR/alloc-error-handler-bad-signature-1.rs:22:6 + --> $DIR/alloc-error-handler-bad-signature-1.rs:12:6 | LL | ) -> () //~ ERROR return type should be `!` | ^^ error: argument should be `Layout` - --> $DIR/alloc-error-handler-bad-signature-1.rs:21:11 + --> $DIR/alloc-error-handler-bad-signature-1.rs:11:11 | LL | info: &Layout, //~ ERROR argument should be `Layout` | ^^^^^^^ diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.rs b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.rs index e2a9a7fd69a..afdaf01d0b8 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.rs +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort #![feature(alloc_error_handler, panic_handler, lang_items)] diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr index c1fcdc75833..95ef9a0522c 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr @@ -1,11 +1,11 @@ error: return type should be `!` - --> $DIR/alloc-error-handler-bad-signature-2.rs:22:3 + --> $DIR/alloc-error-handler-bad-signature-2.rs:12:3 | LL | ) { //~ ERROR return type should be `!` | ^ error: argument should be `Layout` - --> $DIR/alloc-error-handler-bad-signature-2.rs:21:11 + --> $DIR/alloc-error-handler-bad-signature-2.rs:11:11 | LL | info: Layout, //~ ERROR argument should be `Layout` | ^^^^^^ diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.rs b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.rs index 0ab71160852..2d2f770cf4d 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.rs +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort #![feature(alloc_error_handler, panic_handler, lang_items)] diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr index e7885537b06..284802f21b9 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr @@ -1,5 +1,5 @@ error: function should have one argument - --> $DIR/alloc-error-handler-bad-signature-3.rs:20:1 + --> $DIR/alloc-error-handler-bad-signature-3.rs:10:1 | LL | fn oom() -> ! { //~ ERROR function should have one argument | ^^^^^^^^^^^^^ diff --git a/src/test/ui/allocator-submodule.rs b/src/test/ui/allocator-submodule.rs index 39b65766924..a1cca50ba98 100644 --- a/src/test/ui/allocator-submodule.rs +++ b/src/test/ui/allocator-submodule.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that it is possible to create a global allocator in a submodule, rather than in the crate // root. diff --git a/src/test/ui/allocator-submodule.stderr b/src/test/ui/allocator-submodule.stderr index 06e0d36e8a2..32c7211cd16 100644 --- a/src/test/ui/allocator-submodule.stderr +++ b/src/test/ui/allocator-submodule.stderr @@ -1,5 +1,5 @@ error: `global_allocator` cannot be used in submodules - --> $DIR/allocator-submodule.rs:37:5 + --> $DIR/allocator-submodule.rs:27:5 | LL | static MY_HEAP: MyAlloc = MyAlloc; //~ ERROR global_allocator | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/allocator/auxiliary/system-allocator.rs b/src/test/ui/allocator/auxiliary/system-allocator.rs index e5650d5b7b0..97b86bbc96d 100644 --- a/src/test/ui/allocator/auxiliary/system-allocator.rs +++ b/src/test/ui/allocator/auxiliary/system-allocator.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/ui/allocator/auxiliary/system-allocator2.rs b/src/test/ui/allocator/auxiliary/system-allocator2.rs index e5650d5b7b0..97b86bbc96d 100644 --- a/src/test/ui/allocator/auxiliary/system-allocator2.rs +++ b/src/test/ui/allocator/auxiliary/system-allocator2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/ui/allocator/function-allocator.rs b/src/test/ui/allocator/function-allocator.rs index 989c102b86e..d53f6e9b72e 100644 --- a/src/test/ui/allocator/function-allocator.rs +++ b/src/test/ui/allocator/function-allocator.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #[global_allocator] fn foo() {} //~ ERROR: allocators must be statics diff --git a/src/test/ui/allocator/function-allocator.stderr b/src/test/ui/allocator/function-allocator.stderr index 8649b6b1244..ecb6e4d4ecd 100644 --- a/src/test/ui/allocator/function-allocator.stderr +++ b/src/test/ui/allocator/function-allocator.stderr @@ -1,5 +1,5 @@ error: allocators must be statics - --> $DIR/function-allocator.rs:13:1 + --> $DIR/function-allocator.rs:2:1 | LL | fn foo() {} //~ ERROR: allocators must be statics | ^^^^^^^^^^^ diff --git a/src/test/ui/allocator/not-an-allocator.rs b/src/test/ui/allocator/not-an-allocator.rs index 6559335960a..417c371bdbf 100644 --- a/src/test/ui/allocator/not-an-allocator.rs +++ b/src/test/ui/allocator/not-an-allocator.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[global_allocator] static A: usize = 0; //~^ the trait bound `usize: diff --git a/src/test/ui/allocator/not-an-allocator.stderr b/src/test/ui/allocator/not-an-allocator.stderr index 757c5066a66..dd2cf36ff1b 100644 --- a/src/test/ui/allocator/not-an-allocator.stderr +++ b/src/test/ui/allocator/not-an-allocator.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied - --> $DIR/not-an-allocator.rs:12:1 + --> $DIR/not-an-allocator.rs:2:1 | LL | static A: usize = 0; | ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize` @@ -7,7 +7,7 @@ LL | static A: usize = 0; = note: required by `std::alloc::GlobalAlloc::alloc` error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied - --> $DIR/not-an-allocator.rs:12:1 + --> $DIR/not-an-allocator.rs:2:1 | LL | static A: usize = 0; | ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize` @@ -15,7 +15,7 @@ LL | static A: usize = 0; = note: required by `std::alloc::GlobalAlloc::dealloc` error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied - --> $DIR/not-an-allocator.rs:12:1 + --> $DIR/not-an-allocator.rs:2:1 | LL | static A: usize = 0; | ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize` @@ -23,7 +23,7 @@ LL | static A: usize = 0; = note: required by `std::alloc::GlobalAlloc::realloc` error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied - --> $DIR/not-an-allocator.rs:12:1 + --> $DIR/not-an-allocator.rs:2:1 | LL | static A: usize = 0; | ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize` diff --git a/src/test/ui/allocator/two-allocators.rs b/src/test/ui/allocator/two-allocators.rs index 7a97a11df20..c967a45c7b4 100644 --- a/src/test/ui/allocator/two-allocators.rs +++ b/src/test/ui/allocator/two-allocators.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::alloc::System; #[global_allocator] diff --git a/src/test/ui/allocator/two-allocators.stderr b/src/test/ui/allocator/two-allocators.stderr index 5285ee93f2d..da247f6c316 100644 --- a/src/test/ui/allocator/two-allocators.stderr +++ b/src/test/ui/allocator/two-allocators.stderr @@ -1,5 +1,5 @@ error: cannot define more than one #[global_allocator] - --> $DIR/two-allocators.rs:16:1 + --> $DIR/two-allocators.rs:6:1 | LL | static B: System = System; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/allocator/two-allocators2.rs b/src/test/ui/allocator/two-allocators2.rs index e747140dfe5..b7a07cc274e 100644 --- a/src/test/ui/allocator/two-allocators2.rs +++ b/src/test/ui/allocator/two-allocators2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:system-allocator.rs // no-prefer-dynamic // error-pattern: the #[global_allocator] in diff --git a/src/test/ui/allocator/two-allocators3.rs b/src/test/ui/allocator/two-allocators3.rs index dd86b02bd20..8a06335c031 100644 --- a/src/test/ui/allocator/two-allocators3.rs +++ b/src/test/ui/allocator/two-allocators3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:system-allocator.rs // aux-build:system-allocator2.rs // no-prefer-dynamic diff --git a/src/test/ui/always-inhabited-union-ref.rs b/src/test/ui/always-inhabited-union-ref.rs new file mode 100644 index 00000000000..11eae2af9c9 --- /dev/null +++ b/src/test/ui/always-inhabited-union-ref.rs @@ -0,0 +1,32 @@ +// The precise semantics of inhabitedness with respect to unions and references is currently +// undecided. This test file currently checks a conservative choice. + +#![feature(exhaustive_patterns)] +#![feature(never_type)] + +#![allow(dead_code)] +#![allow(unreachable_code)] + +pub union Foo { + foo: !, +} + +fn uninhab_ref() -> &'static ! { + unimplemented!() +} + +fn uninhab_union() -> Foo { + unimplemented!() +} + +fn match_on_uninhab() { + match uninhab_ref() { + //~^ ERROR non-exhaustive patterns: type `&'static !` is non-empty + } + + match uninhab_union() { + //~^ ERROR non-exhaustive patterns: type `Foo` is non-empty + } +} + +fn main() {} diff --git a/src/test/ui/always-inhabited-union-ref.stderr b/src/test/ui/always-inhabited-union-ref.stderr new file mode 100644 index 00000000000..212f5d7c525 --- /dev/null +++ b/src/test/ui/always-inhabited-union-ref.stderr @@ -0,0 +1,27 @@ +error[E0004]: non-exhaustive patterns: type `&'static !` is non-empty + --> $DIR/always-inhabited-union-ref.rs:23:11 + | +LL | match uninhab_ref() { + | ^^^^^^^^^^^^^ + | +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + --> $DIR/always-inhabited-union-ref.rs:23:11 + | +LL | match uninhab_ref() { + | ^^^^^^^^^^^^^ + +error[E0004]: non-exhaustive patterns: type `Foo` is non-empty + --> $DIR/always-inhabited-union-ref.rs:27:11 + | +LL | match uninhab_union() { + | ^^^^^^^^^^^^^^^ + | +help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms + --> $DIR/always-inhabited-union-ref.rs:27:11 + | +LL | match uninhab_union() { + | ^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0004`. diff --git a/src/test/ui/anon-params-denied-2018.stderr b/src/test/ui/anon-params-denied-2018.stderr index 24a1e6ecd93..dd9e933542f 100644 --- a/src/test/ui/anon-params-denied-2018.stderr +++ b/src/test/ui/anon-params-denied-2018.stderr @@ -2,13 +2,21 @@ error: expected one of `:` or `@`, found `)` --> $DIR/anon-params-denied-2018.rs:6:15 | LL | fn foo(i32); //~ expected one of `:` or `@`, found `)` - | ^ expected one of `:` or `@` here + | ---^ expected one of `:` or `@` here + | | + | help: explicitly ignore parameter: `_: i32` + | + = note: anonymous parameters are removed in the 2018 edition (see RFC 1685) error: expected one of `:` or `@`, found `,` --> $DIR/anon-params-denied-2018.rs:8:36 | LL | fn bar_with_default_impl(String, String) {} - | ^ expected one of `:` or `@` here + | ------^ expected one of `:` or `@` here + | | + | help: explicitly ignore parameter: `_: String` + | + = note: anonymous parameters are removed in the 2018 edition (see RFC 1685) error: aborting due to 2 previous errors diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.rs b/src/test/ui/anonymous-higher-ranked-lifetime.rs index 295e3d1a735..55b1667da50 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.rs +++ b/src/test/ui/anonymous-higher-ranked-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { f1(|_: (), _: ()| {}); //~ ERROR type mismatch f2(|_: (), _: ()| {}); //~ ERROR type mismatch diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr index 809d111d74e..d2c722e32b2 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr +++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr @@ -1,5 +1,5 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:2:5 | LL | f1(|_: (), _: ()| {}); //~ ERROR type mismatch | ^^ -------------- found signature of `fn((), ()) -> _` @@ -7,13 +7,13 @@ LL | f1(|_: (), _: ()| {}); //~ ERROR type mismatch | expected signature of `for<'r, 's> fn(&'r (), &'s ()) -> _` | note: required by `f1` - --> $DIR/anonymous-higher-ranked-lifetime.rs:26:1 + --> $DIR/anonymous-higher-ranked-lifetime.rs:16:1 | LL | fn f1(_: F) where F: Fn(&(), &()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:13:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:3:5 | LL | f2(|_: (), _: ()| {}); //~ ERROR type mismatch | ^^ -------------- found signature of `fn((), ()) -> _` @@ -21,13 +21,13 @@ LL | f2(|_: (), _: ()| {}); //~ ERROR type mismatch | expected signature of `for<'a, 'r> fn(&'a (), &'r ()) -> _` | note: required by `f2` - --> $DIR/anonymous-higher-ranked-lifetime.rs:27:1 + --> $DIR/anonymous-higher-ranked-lifetime.rs:17:1 | LL | fn f2(_: F) where F: for<'a> Fn(&'a (), &()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:4:5 | LL | f3(|_: (), _: ()| {}); //~ ERROR type mismatch | ^^ -------------- found signature of `fn((), ()) -> _` @@ -35,13 +35,13 @@ LL | f3(|_: (), _: ()| {}); //~ ERROR type mismatch | expected signature of `for<'r> fn(&(), &'r ()) -> _` | note: required by `f3` - --> $DIR/anonymous-higher-ranked-lifetime.rs:28:1 + --> $DIR/anonymous-higher-ranked-lifetime.rs:18:1 | LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:15:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:5:5 | LL | f4(|_: (), _: ()| {}); //~ ERROR type mismatch | ^^ -------------- found signature of `fn((), ()) -> _` @@ -49,13 +49,13 @@ LL | f4(|_: (), _: ()| {}); //~ ERROR type mismatch | expected signature of `for<'s, 'r> fn(&'s (), &'r ()) -> _` | note: required by `f4` - --> $DIR/anonymous-higher-ranked-lifetime.rs:29:1 + --> $DIR/anonymous-higher-ranked-lifetime.rs:19:1 | LL | fn f4(_: F) where F: for<'r> Fn(&(), &'r ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:6:5 | LL | f5(|_: (), _: ()| {}); //~ ERROR type mismatch | ^^ -------------- found signature of `fn((), ()) -> _` @@ -63,13 +63,13 @@ LL | f5(|_: (), _: ()| {}); //~ ERROR type mismatch | expected signature of `for<'r> fn(&'r (), &'r ()) -> _` | note: required by `f5` - --> $DIR/anonymous-higher-ranked-lifetime.rs:30:1 + --> $DIR/anonymous-higher-ranked-lifetime.rs:20:1 | LL | fn f5(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:17:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:7:5 | LL | g1(|_: (), _: ()| {}); //~ ERROR type mismatch | ^^ -------------- found signature of `fn((), ()) -> _` @@ -77,13 +77,13 @@ LL | g1(|_: (), _: ()| {}); //~ ERROR type mismatch | expected signature of `for<'r> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>) -> _` | note: required by `g1` - --> $DIR/anonymous-higher-ranked-lifetime.rs:33:1 + --> $DIR/anonymous-higher-ranked-lifetime.rs:23:1 | LL | fn g1(_: F) where F: Fn(&(), Box) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 | LL | g2(|_: (), _: ()| {}); //~ ERROR type mismatch | ^^ -------------- found signature of `fn((), ()) -> _` @@ -91,13 +91,13 @@ LL | g2(|_: (), _: ()| {}); //~ ERROR type mismatch | expected signature of `for<'r> fn(&'r (), for<'s> fn(&'s ())) -> _` | note: required by `g2` - --> $DIR/anonymous-higher-ranked-lifetime.rs:34:1 + --> $DIR/anonymous-higher-ranked-lifetime.rs:24:1 | LL | fn g2(_: F) where F: Fn(&(), fn(&())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:19:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:9:5 | LL | g3(|_: (), _: ()| {}); //~ ERROR type mismatch | ^^ -------------- found signature of `fn((), ()) -> _` @@ -105,13 +105,13 @@ LL | g3(|_: (), _: ()| {}); //~ ERROR type mismatch | expected signature of `for<'s> fn(&'s (), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _` | note: required by `g3` - --> $DIR/anonymous-higher-ranked-lifetime.rs:35:1 + --> $DIR/anonymous-higher-ranked-lifetime.rs:25:1 | LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:20:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 | LL | g4(|_: (), _: ()| {}); //~ ERROR type mismatch | ^^ -------------- found signature of `fn((), ()) -> _` @@ -119,13 +119,13 @@ LL | g4(|_: (), _: ()| {}); //~ ERROR type mismatch | expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _` | note: required by `g4` - --> $DIR/anonymous-higher-ranked-lifetime.rs:36:1 + --> $DIR/anonymous-higher-ranked-lifetime.rs:26:1 | LL | fn g4(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:21:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:11:5 | LL | h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` @@ -133,13 +133,13 @@ LL | h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch | expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<(dyn for<'t0> std::ops::Fn(&'t0 ()) + 'static)>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _` | note: required by `h1` - --> $DIR/anonymous-higher-ranked-lifetime.rs:39:1 + --> $DIR/anonymous-higher-ranked-lifetime.rs:29:1 | LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments - --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5 + --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 | LL | h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` @@ -147,7 +147,7 @@ LL | h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch | expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _` | note: required by `h2` - --> $DIR/anonymous-higher-ranked-lifetime.rs:40:1 + --> $DIR/anonymous-higher-ranked-lifetime.rs:30:1 | LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &())) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/arbitrary-self-types-not-object-safe.rs b/src/test/ui/arbitrary-self-types-not-object-safe.rs index 4dc481174a4..2c1fd937a65 100644 --- a/src/test/ui/arbitrary-self-types-not-object-safe.rs +++ b/src/test/ui/arbitrary-self-types-not-object-safe.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(arbitrary_self_types)] use std::rc::Rc; diff --git a/src/test/ui/arbitrary-self-types-not-object-safe.stderr b/src/test/ui/arbitrary-self-types-not-object-safe.stderr index 77ca118471d..dacab1222ab 100644 --- a/src/test/ui/arbitrary-self-types-not-object-safe.stderr +++ b/src/test/ui/arbitrary-self-types-not-object-safe.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/arbitrary-self-types-not-object-safe.rs:40:32 + --> $DIR/arbitrary-self-types-not-object-safe.rs:31:32 | LL | let x = Rc::new(5usize) as Rc; | ^^^^^^^ the trait `Foo` cannot be made into an object @@ -7,7 +7,7 @@ LL | let x = Rc::new(5usize) as Rc; = note: method `foo`'s receiver cannot be dispatched on error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/arbitrary-self-types-not-object-safe.rs:40:13 + --> $DIR/arbitrary-self-types-not-object-safe.rs:31:13 | LL | let x = Rc::new(5usize) as Rc; | ^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object diff --git a/src/test/ui/arg-count-mismatch.rs b/src/test/ui/arg-count-mismatch.rs index 673314ec4c9..cf7487069c1 100644 --- a/src/test/ui/arg-count-mismatch.rs +++ b/src/test/ui/arg-count-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: parameters were supplied fn f(x: isize) { } diff --git a/src/test/ui/arg-count-mismatch.stderr b/src/test/ui/arg-count-mismatch.stderr index 699e36f3472..44f16041363 100644 --- a/src/test/ui/arg-count-mismatch.stderr +++ b/src/test/ui/arg-count-mismatch.stderr @@ -1,5 +1,5 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/arg-count-mismatch.rs:15:28 + --> $DIR/arg-count-mismatch.rs:5:28 | LL | fn f(x: isize) { } | -------------- defined here diff --git a/src/test/ui/arg-type-mismatch.rs b/src/test/ui/arg-type-mismatch.rs index 1f657ca5832..04ce2888785 100644 --- a/src/test/ui/arg-type-mismatch.rs +++ b/src/test/ui/arg-type-mismatch.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // error-pattern: mismatched types fn f(x: isize) { } diff --git a/src/test/ui/arg-type-mismatch.stderr b/src/test/ui/arg-type-mismatch.stderr index 2b24d9db3f5..d41abd1aa81 100644 --- a/src/test/ui/arg-type-mismatch.stderr +++ b/src/test/ui/arg-type-mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/arg-type-mismatch.rs:16:30 + --> $DIR/arg-type-mismatch.rs:5:30 | LL | fn main() { let i: (); i = f(()); } | ^^ expected isize, found () diff --git a/src/test/ui/array-break-length.rs b/src/test/ui/array-break-length.rs index c3cfff0e1f6..ab15ce6e8d8 100644 --- a/src/test/ui/array-break-length.rs +++ b/src/test/ui/array-break-length.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { loop { |_: [_; break]| {} //~ ERROR: `break` outside of loop diff --git a/src/test/ui/array-break-length.stderr b/src/test/ui/array-break-length.stderr index 114245b9cc7..bba47530461 100644 --- a/src/test/ui/array-break-length.stderr +++ b/src/test/ui/array-break-length.stderr @@ -1,11 +1,11 @@ error[E0268]: `break` outside of loop - --> $DIR/array-break-length.rs:13:17 + --> $DIR/array-break-length.rs:3:17 | LL | |_: [_; break]| {} //~ ERROR: `break` outside of loop | ^^^^^ cannot break outside of a loop error[E0268]: `continue` outside of loop - --> $DIR/array-break-length.rs:17:17 + --> $DIR/array-break-length.rs:7:17 | LL | |_: [_; continue]| {} //~ ERROR: `continue` outside of loop | ^^^^^^^^ cannot break outside of a loop diff --git a/src/test/ui/array-not-vector.rs b/src/test/ui/array-not-vector.rs index 47e1c09f380..80b40ef25c3 100644 --- a/src/test/ui/array-not-vector.rs +++ b/src/test/ui/array-not-vector.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let _x: i32 = [1, 2, 3]; //~^ ERROR mismatched types diff --git a/src/test/ui/array-not-vector.stderr b/src/test/ui/array-not-vector.stderr index 83bf058c449..b5a5389db09 100644 --- a/src/test/ui/array-not-vector.stderr +++ b/src/test/ui/array-not-vector.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/array-not-vector.rs:12:19 + --> $DIR/array-not-vector.rs:2:19 | LL | let _x: i32 = [1, 2, 3]; | ^^^^^^^^^ expected i32, found array of 3 elements @@ -8,7 +8,7 @@ LL | let _x: i32 = [1, 2, 3]; found type `[{integer}; 3]` error[E0308]: mismatched types - --> $DIR/array-not-vector.rs:19:20 + --> $DIR/array-not-vector.rs:9:20 | LL | let _y: &i32 = x; | ^ expected i32, found slice diff --git a/src/test/ui/array_const_index-0.rs b/src/test/ui/array_const_index-0.rs index e82458b10d9..3422aeae8c5 100644 --- a/src/test/ui/array_const_index-0.rs +++ b/src/test/ui/array_const_index-0.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const A: &'static [i32] = &[]; const B: i32 = (&A)[1]; //~^ index out of bounds: the len is 0 but the index is 1 diff --git a/src/test/ui/array_const_index-0.stderr b/src/test/ui/array_const_index-0.stderr index 49c316eee12..dfc89e0ae86 100644 --- a/src/test/ui/array_const_index-0.stderr +++ b/src/test/ui/array_const_index-0.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/array_const_index-0.rs:12:1 + --> $DIR/array_const_index-0.rs:2:1 | LL | const B: i32 = (&A)[1]; | ^^^^^^^^^^^^^^^-------^ diff --git a/src/test/ui/array_const_index-1.rs b/src/test/ui/array_const_index-1.rs index 21028a447f4..1f77cb6a392 100644 --- a/src/test/ui/array_const_index-1.rs +++ b/src/test/ui/array_const_index-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const A: [i32; 0] = []; const B: i32 = A[1]; //~^ index out of bounds: the len is 0 but the index is 1 diff --git a/src/test/ui/array_const_index-1.stderr b/src/test/ui/array_const_index-1.stderr index fa0e6e6afc6..3e912fad53a 100644 --- a/src/test/ui/array_const_index-1.stderr +++ b/src/test/ui/array_const_index-1.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/array_const_index-1.rs:12:1 + --> $DIR/array_const_index-1.rs:2:1 | LL | const B: i32 = A[1]; | ^^^^^^^^^^^^^^^----^ diff --git a/src/test/ui/as-ref.rs b/src/test/ui/as-ref.rs deleted file mode 100644 index ae1c98c8564..00000000000 --- a/src/test/ui/as-ref.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct Foo; -fn takes_ref(_: &Foo) {} - -fn main() { - let ref opt = Some(Foo); - opt.map(|arg| takes_ref(arg)); - //~^ ERROR mismatched types [E0308] - opt.and_then(|arg| Some(takes_ref(arg))); - //~^ ERROR mismatched types [E0308] - let ref opt: Result<_, ()> = Ok(Foo); - opt.map(|arg| takes_ref(arg)); - //~^ ERROR mismatched types [E0308] - opt.and_then(|arg| Ok(takes_ref(arg))); - //~^ ERROR mismatched types [E0308] -} diff --git a/src/test/ui/as-ref.stderr b/src/test/ui/as-ref.stderr deleted file mode 100644 index 27016445ec5..00000000000 --- a/src/test/ui/as-ref.stderr +++ /dev/null @@ -1,47 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/as-ref.rs:16:27 - | -LL | opt.map(|arg| takes_ref(arg)); - | - ^^^ expected &Foo, found struct `Foo` - | | - | help: consider using `as_ref` instead: `as_ref().` - | - = note: expected type `&Foo` - found type `Foo` - -error[E0308]: mismatched types - --> $DIR/as-ref.rs:18:37 - | -LL | opt.and_then(|arg| Some(takes_ref(arg))); - | - ^^^ expected &Foo, found struct `Foo` - | | - | help: consider using `as_ref` instead: `as_ref().` - | - = note: expected type `&Foo` - found type `Foo` - -error[E0308]: mismatched types - --> $DIR/as-ref.rs:21:27 - | -LL | opt.map(|arg| takes_ref(arg)); - | - ^^^ expected &Foo, found struct `Foo` - | | - | help: consider using `as_ref` instead: `as_ref().` - | - = note: expected type `&Foo` - found type `Foo` - -error[E0308]: mismatched types - --> $DIR/as-ref.rs:23:35 - | -LL | opt.and_then(|arg| Ok(takes_ref(arg))); - | - ^^^ expected &Foo, found struct `Foo` - | | - | help: consider using `as_ref` instead: `as_ref().` - | - = note: expected type `&Foo` - found type `Foo` - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/asm/asm-bad-clobber.rs b/src/test/ui/asm/asm-bad-clobber.rs index 543eb2ac842..8406a1cc7a8 100644 --- a/src/test/ui/asm/asm-bad-clobber.rs +++ b/src/test/ui/asm/asm-bad-clobber.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-android // ignore-arm // ignore-aarch64 diff --git a/src/test/ui/asm/asm-bad-clobber.stderr b/src/test/ui/asm/asm-bad-clobber.stderr index 81ab006a18a..a279421241f 100644 --- a/src/test/ui/asm/asm-bad-clobber.stderr +++ b/src/test/ui/asm/asm-bad-clobber.stderr @@ -1,5 +1,5 @@ error[E0664]: clobber should not be surrounded by braces - --> $DIR/asm-bad-clobber.rs:32:37 + --> $DIR/asm-bad-clobber.rs:22:37 | LL | asm!("xor %eax, %eax" : : : "{eax}"); | ^^^^^^^ diff --git a/src/test/ui/asm/asm-in-bad-modifier.rs b/src/test/ui/asm/asm-in-bad-modifier.rs index 2eefd4235bc..38cd11e2515 100644 --- a/src/test/ui/asm/asm-in-bad-modifier.rs +++ b/src/test/ui/asm/asm-in-bad-modifier.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-s390x // ignore-emscripten // ignore-powerpc diff --git a/src/test/ui/asm/asm-in-bad-modifier.stderr b/src/test/ui/asm/asm-in-bad-modifier.stderr index dcb11bd1e76..33987539018 100644 --- a/src/test/ui/asm/asm-in-bad-modifier.stderr +++ b/src/test/ui/asm/asm-in-bad-modifier.stderr @@ -1,11 +1,11 @@ error[E0662]: input operand constraint contains '=' - --> $DIR/asm-in-bad-modifier.rs:33:39 + --> $DIR/asm-in-bad-modifier.rs:23:39 | LL | asm!("mov $1, $0" : "=r"(x) : "=r"(5)); //~ ERROR operand constraint contains '=' | ^^^^ error[E0663]: input operand constraint contains '+' - --> $DIR/asm-in-bad-modifier.rs:34:39 + --> $DIR/asm-in-bad-modifier.rs:24:39 | LL | asm!("mov $1, $0" : "=r"(y) : "+r"(5)); //~ ERROR operand constraint contains '+' | ^^^^ diff --git a/src/test/ui/asm/asm-misplaced-option.rs b/src/test/ui/asm/asm-misplaced-option.rs index bb75fbc5bc4..5c202a158f4 100644 --- a/src/test/ui/asm/asm-misplaced-option.rs +++ b/src/test/ui/asm/asm-misplaced-option.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-android // ignore-arm // ignore-aarch64 diff --git a/src/test/ui/asm/asm-misplaced-option.stderr b/src/test/ui/asm/asm-misplaced-option.stderr index 589fd47cc1e..39d88e3fb56 100644 --- a/src/test/ui/asm/asm-misplaced-option.stderr +++ b/src/test/ui/asm/asm-misplaced-option.stderr @@ -1,11 +1,11 @@ warning: unrecognized option - --> $DIR/asm-misplaced-option.rs:36:64 + --> $DIR/asm-misplaced-option.rs:26:64 | LL | asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); | ^^^^ warning: expected a clobber, found an option - --> $DIR/asm-misplaced-option.rs:43:80 + --> $DIR/asm-misplaced-option.rs:33:80 | LL | asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); | ^^^^^^^^^^ diff --git a/src/test/ui/asm/asm-out-assign-imm.nll.stderr b/src/test/ui/asm/asm-out-assign-imm.nll.stderr index 40a36dd895f..ac38218b849 100644 --- a/src/test/ui/asm/asm-out-assign-imm.nll.stderr +++ b/src/test/ui/asm/asm-out-assign-imm.nll.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/asm-out-assign-imm.rs:34:34 + --> $DIR/asm-out-assign-imm.rs:24:34 | LL | let x: isize; | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/asm/asm-out-assign-imm.rs b/src/test/ui/asm/asm-out-assign-imm.rs index 73143f11546..7a8be2a133e 100644 --- a/src/test/ui/asm/asm-out-assign-imm.rs +++ b/src/test/ui/asm/asm-out-assign-imm.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-s390x // ignore-emscripten // ignore-powerpc diff --git a/src/test/ui/asm/asm-out-assign-imm.stderr b/src/test/ui/asm/asm-out-assign-imm.stderr index 51933cac396..98f2f68a8f3 100644 --- a/src/test/ui/asm/asm-out-assign-imm.stderr +++ b/src/test/ui/asm/asm-out-assign-imm.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/asm-out-assign-imm.rs:34:34 + --> $DIR/asm-out-assign-imm.rs:24:34 | LL | x = 1; | ----- first assignment to `x` diff --git a/src/test/ui/asm/asm-out-no-modifier.rs b/src/test/ui/asm/asm-out-no-modifier.rs index 40d2ded8a88..d9142b9f2e0 100644 --- a/src/test/ui/asm/asm-out-no-modifier.rs +++ b/src/test/ui/asm/asm-out-no-modifier.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-s390x // ignore-emscripten // ignore-powerpc diff --git a/src/test/ui/asm/asm-out-no-modifier.stderr b/src/test/ui/asm/asm-out-no-modifier.stderr index 4e9d7b884b3..12a33e451fb 100644 --- a/src/test/ui/asm/asm-out-no-modifier.stderr +++ b/src/test/ui/asm/asm-out-no-modifier.stderr @@ -1,5 +1,5 @@ error[E0661]: output operand constraint lacks '=' or '+' - --> $DIR/asm-out-no-modifier.rs:32:29 + --> $DIR/asm-out-no-modifier.rs:22:29 | LL | asm!("mov $1, $0" : "r"(x) : "r"(5)); //~ ERROR output operand constraint lacks '=' | ^^^ diff --git a/src/test/ui/asm/asm-out-read-uninit.ast.stderr b/src/test/ui/asm/asm-out-read-uninit.ast.stderr index 5f6685e5c1c..cf74298be4a 100644 --- a/src/test/ui/asm/asm-out-read-uninit.ast.stderr +++ b/src/test/ui/asm/asm-out-read-uninit.ast.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/asm-out-read-uninit.rs:35:43 + --> $DIR/asm-out-read-uninit.rs:25:43 | LL | asm!("mov $1, $0" : "=r"(x) : "r"(x)); | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/asm/asm-out-read-uninit.mir.stderr b/src/test/ui/asm/asm-out-read-uninit.mir.stderr index 5f6685e5c1c..cf74298be4a 100644 --- a/src/test/ui/asm/asm-out-read-uninit.mir.stderr +++ b/src/test/ui/asm/asm-out-read-uninit.mir.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/asm-out-read-uninit.rs:35:43 + --> $DIR/asm-out-read-uninit.rs:25:43 | LL | asm!("mov $1, $0" : "=r"(x) : "r"(x)); | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/asm/asm-out-read-uninit.rs b/src/test/ui/asm/asm-out-read-uninit.rs index c308a9f0850..44dd0503c3b 100644 --- a/src/test/ui/asm/asm-out-read-uninit.rs +++ b/src/test/ui/asm/asm-out-read-uninit.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-s390x // ignore-emscripten // ignore-powerpc diff --git a/src/test/ui/asm/asm-parse-errors.rs b/src/test/ui/asm/asm-parse-errors.rs new file mode 100644 index 00000000000..e712ac5826e --- /dev/null +++ b/src/test/ui/asm/asm-parse-errors.rs @@ -0,0 +1,15 @@ +#![feature(asm)] + +fn main() { + asm!(); //~ ERROR requires a string literal as an argument + asm!("nop" : struct); //~ ERROR expected string literal + asm!("mov %eax, $$0x2" : struct); //~ ERROR expected string literal + asm!("mov %eax, $$0x2" : "={eax}" struct); //~ ERROR expected `(` + asm!("mov %eax, $$0x2" : "={eax}"(struct)); //~ ERROR expected expression + asm!("in %dx, %al" : "={al}"(result) : struct); //~ ERROR expected string literal + asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); //~ ERROR expected `(` + asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); //~ ERROR expected expression + asm!("mov $$0x200, %eax" : : : struct); //~ ERROR expected string literal + asm!("mov eax, 2" : "={eax}"(foo) : : : struct); //~ ERROR expected string literal + asm!(123); //~ ERROR inline assembly must be a string literal +} diff --git a/src/test/ui/asm/asm-parse-errors.stderr b/src/test/ui/asm/asm-parse-errors.stderr new file mode 100644 index 00000000000..37b61b80b2b --- /dev/null +++ b/src/test/ui/asm/asm-parse-errors.stderr @@ -0,0 +1,68 @@ +error: macro requires a string literal as an argument + --> $DIR/asm-parse-errors.rs:4:5 + | +LL | asm!(); //~ ERROR requires a string literal as an argument + | ^^^^^^^ string literal required + +error: expected string literal + --> $DIR/asm-parse-errors.rs:5:18 + | +LL | asm!("nop" : struct); //~ ERROR expected string literal + | ^^^^^^ expected string literal + +error: expected string literal + --> $DIR/asm-parse-errors.rs:6:30 + | +LL | asm!("mov %eax, $$0x2" : struct); //~ ERROR expected string literal + | ^^^^^^ expected string literal + +error: expected `(`, found keyword `struct` + --> $DIR/asm-parse-errors.rs:7:39 + | +LL | asm!("mov %eax, $$0x2" : "={eax}" struct); //~ ERROR expected `(` + | ^^^^^^ expected `(` + +error: expected expression, found keyword `struct` + --> $DIR/asm-parse-errors.rs:8:39 + | +LL | asm!("mov %eax, $$0x2" : "={eax}"(struct)); //~ ERROR expected expression + | ^^^^^^ expected expression + +error: expected string literal + --> $DIR/asm-parse-errors.rs:9:44 + | +LL | asm!("in %dx, %al" : "={al}"(result) : struct); //~ ERROR expected string literal + | ^^^^^^ expected string literal + +error: expected `(`, found keyword `struct` + --> $DIR/asm-parse-errors.rs:10:51 + | +LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); //~ ERROR expected `(` + | ^^^^^^ expected `(` + +error: expected expression, found keyword `struct` + --> $DIR/asm-parse-errors.rs:11:51 + | +LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); //~ ERROR expected expression + | ^^^^^^ expected expression + +error: expected string literal + --> $DIR/asm-parse-errors.rs:12:36 + | +LL | asm!("mov $$0x200, %eax" : : : struct); //~ ERROR expected string literal + | ^^^^^^ expected string literal + +error: expected string literal + --> $DIR/asm-parse-errors.rs:13:45 + | +LL | asm!("mov eax, 2" : "={eax}"(foo) : : : struct); //~ ERROR expected string literal + | ^^^^^^ expected string literal + +error: inline assembly must be a string literal + --> $DIR/asm-parse-errors.rs:14:10 + | +LL | asm!(123); //~ ERROR inline assembly must be a string literal + | ^^^ + +error: aborting due to 11 previous errors + diff --git a/src/test/ui/assign-imm-local-twice.ast.nll.stderr b/src/test/ui/assign-imm-local-twice.ast.nll.stderr index 8a50ec8f52c..311a83a76f9 100644 --- a/src/test/ui/assign-imm-local-twice.ast.nll.stderr +++ b/src/test/ui/assign-imm-local-twice.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/assign-imm-local-twice.rs:21:5 + --> $DIR/assign-imm-local-twice.rs:11:5 | LL | let v: isize; | - help: make this binding mutable: `mut v` diff --git a/src/test/ui/assign-imm-local-twice.ast.stderr b/src/test/ui/assign-imm-local-twice.ast.stderr index a34ac54ae3b..d57acb2c621 100644 --- a/src/test/ui/assign-imm-local-twice.ast.stderr +++ b/src/test/ui/assign-imm-local-twice.ast.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/assign-imm-local-twice.rs:21:5 + --> $DIR/assign-imm-local-twice.rs:11:5 | LL | v = 1; //[ast]~ NOTE first assignment | ----- first assignment to `v` diff --git a/src/test/ui/assign-imm-local-twice.mir.stderr b/src/test/ui/assign-imm-local-twice.mir.stderr index 8a50ec8f52c..311a83a76f9 100644 --- a/src/test/ui/assign-imm-local-twice.mir.stderr +++ b/src/test/ui/assign-imm-local-twice.mir.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/assign-imm-local-twice.rs:21:5 + --> $DIR/assign-imm-local-twice.rs:11:5 | LL | let v: isize; | - help: make this binding mutable: `mut v` diff --git a/src/test/ui/assign-imm-local-twice.rs b/src/test/ui/assign-imm-local-twice.rs index 137414ccc6d..de966a17857 100644 --- a/src/test/ui/assign-imm-local-twice.rs +++ b/src/test/ui/assign-imm-local-twice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Zborrowck=mir diff --git a/src/test/ui/assign-to-method.rs b/src/test/ui/assign-to-method.rs index 4518ce36b6d..95f066c382c 100644 --- a/src/test/ui/assign-to-method.rs +++ b/src/test/ui/assign-to-method.rs @@ -1,31 +1,22 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct cat { +struct Cat { meows : usize, how_hungry : isize, } -impl cat { +impl Cat { pub fn speak(&self) { self.meows += 1; } } -fn cat(in_x : usize, in_y : isize) -> cat { - cat { +fn cat(in_x : usize, in_y : isize) -> Cat { + Cat { meows: in_x, how_hungry: in_y } } fn main() { - let nyan : cat = cat(52, 99); + let nyan : Cat = cat(52, 99); nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method + nyan.speak += || println!("meow"); //~ ERROR attempted to take value of method } diff --git a/src/test/ui/assign-to-method.stderr b/src/test/ui/assign-to-method.stderr index 930b4512572..f79f0750d89 100644 --- a/src/test/ui/assign-to-method.stderr +++ b/src/test/ui/assign-to-method.stderr @@ -1,11 +1,19 @@ -error[E0615]: attempted to take value of method `speak` on type `cat` - --> $DIR/assign-to-method.rs:30:8 +error[E0615]: attempted to take value of method `speak` on type `Cat` + --> $DIR/assign-to-method.rs:20:8 | LL | nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method | ^^^^^ | - = help: maybe a `()` to call it is missing? + = help: methods are immutable and cannot be assigned to -error: aborting due to previous error +error[E0615]: attempted to take value of method `speak` on type `Cat` + --> $DIR/assign-to-method.rs:21:8 + | +LL | nyan.speak += || println!("meow"); //~ ERROR attempted to take value of method + | ^^^^^ + | + = help: methods are immutable and cannot be assigned to + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0615`. diff --git a/src/test/ui/assignment-operator-unimplemented.rs b/src/test/ui/assignment-operator-unimplemented.rs index 5b24c6bd79f..21df464d5e4 100644 --- a/src/test/ui/assignment-operator-unimplemented.rs +++ b/src/test/ui/assignment-operator-unimplemented.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; fn main() { diff --git a/src/test/ui/assignment-operator-unimplemented.stderr b/src/test/ui/assignment-operator-unimplemented.stderr index 983d698c63e..1d7adb129d0 100644 --- a/src/test/ui/assignment-operator-unimplemented.stderr +++ b/src/test/ui/assignment-operator-unimplemented.stderr @@ -1,5 +1,5 @@ error[E0368]: binary assignment operation `+=` cannot be applied to type `Foo` - --> $DIR/assignment-operator-unimplemented.rs:16:3 + --> $DIR/assignment-operator-unimplemented.rs:6:3 | LL | a += *b; //~ Error: binary assignment operation `+=` cannot be applied to type `Foo` | -^^^^^^ diff --git a/src/test/ui/assoc-inherent.rs b/src/test/ui/assoc-inherent.rs index 7eab831258f..05329a27142 100644 --- a/src/test/ui/assoc-inherent.rs +++ b/src/test/ui/assoc-inherent.rs @@ -1,19 +1,9 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test associated types are forbidden in inherent impls. +// Test associated types are, until #8995 is implemented, forbidden in inherent impls. struct Foo; impl Foo { - type Bar = isize; //~ERROR associated types are not allowed in inherent impls + type Bar = isize; //~ERROR associated types are not yet supported in inherent impls (see #8995) } fn main() {} diff --git a/src/test/ui/assoc-inherent.stderr b/src/test/ui/assoc-inherent.stderr index 11497cba0ff..f438ac8df4a 100644 --- a/src/test/ui/assoc-inherent.stderr +++ b/src/test/ui/assoc-inherent.stderr @@ -1,7 +1,7 @@ -error[E0202]: associated types are not allowed in inherent impls - --> $DIR/assoc-inherent.rs:16:5 +error[E0202]: associated types are not yet supported in inherent impls (see #8995) + --> $DIR/assoc-inherent.rs:6:5 | -LL | type Bar = isize; //~ERROR associated types are not allowed in inherent impls +LL | type Bar = isize; //~ERROR associated types are not yet supported in inherent impls (see #8995) | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-const/associated-const-ambiguity-report.rs b/src/test/ui/associated-const/associated-const-ambiguity-report.rs index 5051e78d1ba..927d2c69efa 100644 --- a/src/test/ui/associated-const/associated-const-ambiguity-report.rs +++ b/src/test/ui/associated-const/associated-const-ambiguity-report.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Foo { const ID: i32; } diff --git a/src/test/ui/associated-const/associated-const-ambiguity-report.stderr b/src/test/ui/associated-const/associated-const-ambiguity-report.stderr index 0832b1a2605..47748609b16 100644 --- a/src/test/ui/associated-const/associated-const-ambiguity-report.stderr +++ b/src/test/ui/associated-const/associated-const-ambiguity-report.stderr @@ -1,16 +1,16 @@ error[E0034]: multiple applicable items in scope - --> $DIR/associated-const-ambiguity-report.rs:28:16 + --> $DIR/associated-const-ambiguity-report.rs:17:16 | LL | const X: i32 = ::ID; //~ ERROR E0034 | ^^^^^^^^^ multiple `ID` found | note: candidate #1 is defined in an impl of the trait `Foo` for the type `i32` - --> $DIR/associated-const-ambiguity-report.rs:21:5 + --> $DIR/associated-const-ambiguity-report.rs:10:5 | LL | const ID: i32 = 1; | ^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl of the trait `Bar` for the type `i32` - --> $DIR/associated-const-ambiguity-report.rs:25:5 + --> $DIR/associated-const-ambiguity-report.rs:14:5 | LL | const ID: i32 = 3; | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-const/associated-const-array-len.rs b/src/test/ui/associated-const/associated-const-array-len.rs index 2cc10f0f956..17d7824273e 100644 --- a/src/test/ui/associated-const/associated-const-array-len.rs +++ b/src/test/ui/associated-const/associated-const-array-len.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Foo { const ID: usize; } diff --git a/src/test/ui/associated-const/associated-const-array-len.stderr b/src/test/ui/associated-const/associated-const-array-len.stderr index 5504af8fecd..ff56d112c81 100644 --- a/src/test/ui/associated-const/associated-const-array-len.stderr +++ b/src/test/ui/associated-const/associated-const-array-len.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/associated-const-array-len.rs:16:16 + --> $DIR/associated-const-array-len.rs:5:16 | LL | const X: [i32; ::ID] = [0, 1, 2]; | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | note: required by `Foo::ID` - --> $DIR/associated-const-array-len.rs:13:5 + --> $DIR/associated-const-array-len.rs:2:5 | LL | const ID: usize; | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-const/associated-const-dead-code.rs b/src/test/ui/associated-const/associated-const-dead-code.rs index 42db13f4f3b..c47e474d2dd 100644 --- a/src/test/ui/associated-const/associated-const-dead-code.rs +++ b/src/test/ui/associated-const/associated-const-dead-code.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(dead_code)] struct MyFoo; diff --git a/src/test/ui/associated-const/associated-const-dead-code.stderr b/src/test/ui/associated-const/associated-const-dead-code.stderr index ee065812183..8c6d76bbdf6 100644 --- a/src/test/ui/associated-const/associated-const-dead-code.stderr +++ b/src/test/ui/associated-const/associated-const-dead-code.stderr @@ -1,11 +1,11 @@ error: associated const is never used: `BAR` - --> $DIR/associated-const-dead-code.rs:16:5 + --> $DIR/associated-const-dead-code.rs:6:5 | LL | const BAR: u32 = 1; | ^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/associated-const-dead-code.rs:11:9 + --> $DIR/associated-const-dead-code.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ diff --git a/src/test/ui/associated-const/associated-const-generic-obligations.rs b/src/test/ui/associated-const/associated-const-generic-obligations.rs index 45f53418dca..e0b502edaa1 100644 --- a/src/test/ui/associated-const/associated-const-generic-obligations.rs +++ b/src/test/ui/associated-const/associated-const-generic-obligations.rs @@ -1,14 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Foo { type Out: Sized; } diff --git a/src/test/ui/associated-const/associated-const-generic-obligations.stderr b/src/test/ui/associated-const/associated-const-generic-obligations.stderr index 97986a27c64..e4b86d84caf 100644 --- a/src/test/ui/associated-const/associated-const-generic-obligations.stderr +++ b/src/test/ui/associated-const/associated-const-generic-obligations.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `T: Foo` is not satisfied - --> $DIR/associated-const-generic-obligations.rs:25:5 + --> $DIR/associated-const-generic-obligations.rs:14:5 | LL | const FROM: &'static str = "foo"; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T` diff --git a/src/test/ui/associated-const/associated-const-impl-wrong-lifetime.rs b/src/test/ui/associated-const/associated-const-impl-wrong-lifetime.rs index 77653b27fb5..08260ec8f4d 100644 --- a/src/test/ui/associated-const/associated-const-impl-wrong-lifetime.rs +++ b/src/test/ui/associated-const/associated-const-impl-wrong-lifetime.rs @@ -1,14 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Foo { const NAME: &'static str; } diff --git a/src/test/ui/associated-const/associated-const-impl-wrong-lifetime.stderr b/src/test/ui/associated-const/associated-const-impl-wrong-lifetime.stderr index f8375899e3e..c213cfeeafa 100644 --- a/src/test/ui/associated-const/associated-const-impl-wrong-lifetime.stderr +++ b/src/test/ui/associated-const/associated-const-impl-wrong-lifetime.stderr @@ -1,13 +1,13 @@ error[E0308]: mismatched types - --> $DIR/associated-const-impl-wrong-lifetime.rs:18:5 + --> $DIR/associated-const-impl-wrong-lifetime.rs:7:5 | LL | const NAME: &'a str = "unit"; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `&'static str` found type `&'a str` -note: the lifetime 'a as defined on the impl at 17:6... - --> $DIR/associated-const-impl-wrong-lifetime.rs:17:6 +note: the lifetime 'a as defined on the impl at 6:6... + --> $DIR/associated-const-impl-wrong-lifetime.rs:6:6 | LL | impl<'a> Foo for &'a () { | ^^ diff --git a/src/test/ui/associated-const/associated-const-impl-wrong-type.rs b/src/test/ui/associated-const/associated-const-impl-wrong-type.rs index 240dfd16097..1aad749c1eb 100644 --- a/src/test/ui/associated-const/associated-const-impl-wrong-type.rs +++ b/src/test/ui/associated-const/associated-const-impl-wrong-type.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Foo { const BAR: u32; } diff --git a/src/test/ui/associated-const/associated-const-impl-wrong-type.stderr b/src/test/ui/associated-const/associated-const-impl-wrong-type.stderr index cfccacaee28..0693d99282d 100644 --- a/src/test/ui/associated-const/associated-const-impl-wrong-type.stderr +++ b/src/test/ui/associated-const/associated-const-impl-wrong-type.stderr @@ -1,5 +1,5 @@ error[E0326]: implemented const `BAR` has an incompatible type for trait - --> $DIR/associated-const-impl-wrong-type.rs:19:16 + --> $DIR/associated-const-impl-wrong-type.rs:8:16 | LL | const BAR: u32; | --- type in trait diff --git a/src/test/ui/associated-const/associated-const-in-trait.rs b/src/test/ui/associated-const/associated-const-in-trait.rs index f837d9ab8e5..187708a60b4 100644 --- a/src/test/ui/associated-const/associated-const-in-trait.rs +++ b/src/test/ui/associated-const/associated-const-in-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // #29924 #![feature(const_fn, associated_consts)] diff --git a/src/test/ui/associated-const/associated-const-in-trait.stderr b/src/test/ui/associated-const/associated-const-in-trait.stderr index 7804e44f2d7..44a92639b5d 100644 --- a/src/test/ui/associated-const/associated-const-in-trait.stderr +++ b/src/test/ui/associated-const/associated-const-in-trait.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Trait` cannot be made into an object - --> $DIR/associated-const-in-trait.rs:19:6 + --> $DIR/associated-const-in-trait.rs:9:6 | LL | impl Trait { | ^^^^^ the trait `Trait` cannot be made into an object diff --git a/src/test/ui/associated-const/associated-const-no-item.rs b/src/test/ui/associated-const/associated-const-no-item.rs index f9a57cd6d75..35fb662f63a 100644 --- a/src/test/ui/associated-const/associated-const-no-item.rs +++ b/src/test/ui/associated-const/associated-const-no-item.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Foo { const ID: i32; } diff --git a/src/test/ui/associated-const/associated-const-no-item.stderr b/src/test/ui/associated-const/associated-const-no-item.stderr index a09c04ea0b2..de172049872 100644 --- a/src/test/ui/associated-const/associated-const-no-item.stderr +++ b/src/test/ui/associated-const/associated-const-no-item.stderr @@ -1,8 +1,10 @@ error[E0599]: no associated item named `ID` found for type `i32` in the current scope - --> $DIR/associated-const-no-item.rs:16:16 + --> $DIR/associated-const-no-item.rs:5:23 | LL | const X: i32 = ::ID; - | ^^^^^^^^^ associated item not found in `i32` + | -------^^ + | | + | associated item not found in `i32` | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `ID`, perhaps you need to implement it: diff --git a/src/test/ui/associated-const/associated-const-private-impl.rs b/src/test/ui/associated-const/associated-const-private-impl.rs index b5accfff5bb..3ee3134acc4 100644 --- a/src/test/ui/associated-const/associated-const-private-impl.rs +++ b/src/test/ui/associated-const/associated-const-private-impl.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - mod bar1 { pub use self::bar2::Foo; mod bar2 { diff --git a/src/test/ui/associated-const/associated-const-private-impl.stderr b/src/test/ui/associated-const/associated-const-private-impl.stderr index 65be3753bac..7af55174b19 100644 --- a/src/test/ui/associated-const/associated-const-private-impl.stderr +++ b/src/test/ui/associated-const/associated-const-private-impl.stderr @@ -1,5 +1,5 @@ error[E0624]: associated constant `ID` is private - --> $DIR/associated-const-private-impl.rs:24:19 + --> $DIR/associated-const-private-impl.rs:13:19 | LL | assert_eq!(1, bar1::Foo::ID); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arms.rs b/src/test/ui/associated-const/associated-const-type-parameter-arms.rs index 630a234fa66..3f260d84e4c 100644 --- a/src/test/ui/associated-const/associated-const-type-parameter-arms.rs +++ b/src/test/ui/associated-const/associated-const-type-parameter-arms.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub enum EFoo { A, B, C, D } pub trait Foo { diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arms.stderr b/src/test/ui/associated-const/associated-const-type-parameter-arms.stderr index a88dd4d9955..1ccf9febd4b 100644 --- a/src/test/ui/associated-const/associated-const-type-parameter-arms.stderr +++ b/src/test/ui/associated-const/associated-const-type-parameter-arms.stderr @@ -1,11 +1,11 @@ error[E0158]: associated consts cannot be referenced in patterns - --> $DIR/associated-const-type-parameter-arms.rs:31:9 + --> $DIR/associated-const-type-parameter-arms.rs:20:9 | LL | A::X => println!("A::X"), | ^^^^ error[E0158]: associated consts cannot be referenced in patterns - --> $DIR/associated-const-type-parameter-arms.rs:33:9 + --> $DIR/associated-const-type-parameter-arms.rs:22:9 | LL | B::X => println!("B::X"), | ^^^^ diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.rs b/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.rs index d196cf22156..f1f82caf7d4 100644 --- a/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.rs +++ b/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub trait Foo { const Y: usize; } diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr b/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr index a440f1f82f1..573b8ed39bc 100644 --- a/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr +++ b/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `A: Foo` is not satisfied - --> $DIR/associated-const-type-parameter-arrays-2.rs:27:22 + --> $DIR/associated-const-type-parameter-arrays-2.rs:16:22 | LL | let _array = [4; ::Y]; | ^^^^^^^^^^^^^ the trait `Foo` is not implemented for `A` | = help: consider adding a `where A: Foo` bound note: required by `Foo::Y` - --> $DIR/associated-const-type-parameter-arrays-2.rs:13:5 + --> $DIR/associated-const-type-parameter-arrays-2.rs:2:5 | LL | const Y: usize; | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays.rs b/src/test/ui/associated-const/associated-const-type-parameter-arrays.rs index 0b24cab2a68..d51821059fc 100644 --- a/src/test/ui/associated-const/associated-const-type-parameter-arrays.rs +++ b/src/test/ui/associated-const/associated-const-type-parameter-arrays.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub trait Foo { const Y: usize; } diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr b/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr index 48891546360..bf1ee385714 100644 --- a/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr +++ b/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `A: Foo` is not satisfied - --> $DIR/associated-const-type-parameter-arrays.rs:27:23 + --> $DIR/associated-const-type-parameter-arrays.rs:16:23 | LL | let _array: [u32; ::Y]; | ^^^^^^^^^^^^^ the trait `Foo` is not implemented for `A` | = help: consider adding a `where A: Foo` bound note: required by `Foo::Y` - --> $DIR/associated-const-type-parameter-arrays.rs:13:5 + --> $DIR/associated-const-type-parameter-arrays.rs:2:5 | LL | const Y: usize; | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-const/associated-const-upper-case-lint.rs b/src/test/ui/associated-const/associated-const-upper-case-lint.rs deleted file mode 100644 index 497ff426b2f..00000000000 --- a/src/test/ui/associated-const/associated-const-upper-case-lint.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![deny(non_upper_case_globals)] -#![allow(dead_code)] - -struct Foo; - -impl Foo { - const not_upper: bool = true; -} -//~^^ ERROR associated constant `not_upper` should have an upper case name such as `NOT_UPPER` - -fn main() {} diff --git a/src/test/ui/associated-const/associated-const-upper-case-lint.stderr b/src/test/ui/associated-const/associated-const-upper-case-lint.stderr deleted file mode 100644 index 7a5cad69094..00000000000 --- a/src/test/ui/associated-const/associated-const-upper-case-lint.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: associated constant `not_upper` should have an upper case name such as `NOT_UPPER` - --> $DIR/associated-const-upper-case-lint.rs:17:5 - | -LL | const not_upper: bool = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/associated-const-upper-case-lint.rs:11:9 - | -LL | #![deny(non_upper_case_globals)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/associated-item/associated-item-duplicate-names-2.rs b/src/test/ui/associated-item/associated-item-duplicate-names-2.rs index 85ea949b9c8..550c7ae394b 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names-2.rs +++ b/src/test/ui/associated-item/associated-item-duplicate-names-2.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - struct Foo; impl Foo { diff --git a/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr b/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr index 3b9be8976b4..6cc63de35d7 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr +++ b/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr @@ -1,5 +1,5 @@ error[E0201]: duplicate definitions with name `bar`: - --> $DIR/associated-item-duplicate-names-2.rs:16:5 + --> $DIR/associated-item-duplicate-names-2.rs:5:5 | LL | const bar: bool = true; | ----------------------- previous definition of `bar` here diff --git a/src/test/ui/associated-item/associated-item-duplicate-names-3.rs b/src/test/ui/associated-item/associated-item-duplicate-names-3.rs index 12cab13d0b9..6aa1b483eeb 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names-3.rs +++ b/src/test/ui/associated-item/associated-item-duplicate-names-3.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // Before the introduction of the "duplicate associated type" error, the // program below used to result in the "ambiguous associated type" error E0223, diff --git a/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr b/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr index 3edf59f2010..07ce5e621a6 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr +++ b/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr @@ -1,5 +1,5 @@ error[E0201]: duplicate definitions with name `Bar`: - --> $DIR/associated-item-duplicate-names-3.rs:23:5 + --> $DIR/associated-item-duplicate-names-3.rs:14:5 | LL | type Bar = i16; | --------------- previous definition of `Bar` here diff --git a/src/test/ui/associated-item/associated-item-duplicate-names.rs b/src/test/ui/associated-item/associated-item-duplicate-names.rs index a2fc1bc0177..6677fad6876 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names.rs +++ b/src/test/ui/associated-item/associated-item-duplicate-names.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for issue #23969 diff --git a/src/test/ui/associated-item/associated-item-duplicate-names.stderr b/src/test/ui/associated-item/associated-item-duplicate-names.stderr index 4b060a991f9..2bbe9125214 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names.stderr +++ b/src/test/ui/associated-item/associated-item-duplicate-names.stderr @@ -1,5 +1,5 @@ error[E0201]: duplicate definitions with name `Ty`: - --> $DIR/associated-item-duplicate-names.rs:21:5 + --> $DIR/associated-item-duplicate-names.rs:11:5 | LL | type Ty = (); | ------------- previous definition of `Ty` here @@ -7,7 +7,7 @@ LL | type Ty = usize; //~ ERROR duplicate definitions | ^^^^^^^^^^^^^^^^ duplicate definition error[E0201]: duplicate definitions with name `BAR`: - --> $DIR/associated-item-duplicate-names.rs:23:5 + --> $DIR/associated-item-duplicate-names.rs:13:5 | LL | const BAR: u32 = 7; | ------------------- previous definition of `BAR` here diff --git a/src/test/ui/associated-path-shl.rs b/src/test/ui/associated-path-shl.rs index 7daf0d3c4e2..d159082ab7a 100644 --- a/src/test/ui/associated-path-shl.rs +++ b/src/test/ui/associated-path-shl.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that associated paths starting with `<<` are successfully parsed. fn main() { diff --git a/src/test/ui/associated-path-shl.stderr b/src/test/ui/associated-path-shl.stderr index fa41d4abff4..3b62b1b01f4 100644 --- a/src/test/ui/associated-path-shl.stderr +++ b/src/test/ui/associated-path-shl.stderr @@ -1,35 +1,35 @@ error[E0412]: cannot find type `A` in this scope - --> $DIR/associated-path-shl.rs:14:14 + --> $DIR/associated-path-shl.rs:4:14 | LL | let _: <::B>::C; //~ ERROR cannot find type `A` in this scope | ^ not found in this scope error[E0412]: cannot find type `A` in this scope - --> $DIR/associated-path-shl.rs:15:15 + --> $DIR/associated-path-shl.rs:5:15 | LL | let _ = <::B>::C; //~ ERROR cannot find type `A` in this scope | ^ not found in this scope error[E0412]: cannot find type `A` in this scope - --> $DIR/associated-path-shl.rs:16:11 + --> $DIR/associated-path-shl.rs:6:11 | LL | let <::B>::C; //~ ERROR cannot find type `A` in this scope | ^ not found in this scope error[E0412]: cannot find type `A` in this scope - --> $DIR/associated-path-shl.rs:17:17 + --> $DIR/associated-path-shl.rs:7:17 | LL | let 0 ..= <::B>::C; //~ ERROR cannot find type `A` in this scope | ^ not found in this scope error[E0412]: cannot find type `A` in this scope - --> $DIR/associated-path-shl.rs:19:7 + --> $DIR/associated-path-shl.rs:9:7 | LL | <::B>::C; //~ ERROR cannot find type `A` in this scope | ^ not found in this scope error[E0029]: only char and numeric types are allowed in range patterns - --> $DIR/associated-path-shl.rs:17:15 + --> $DIR/associated-path-shl.rs:7:15 | LL | let 0 ..= <::B>::C; //~ ERROR cannot find type `A` in this scope | ^^^^^^^^^^^ ranges require char or numeric types diff --git a/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.rs b/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.rs index ce97019a2b2..c85d41c7f51 100644 --- a/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.rs +++ b/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test equality constraints in a where clause where the type being // equated appears in a supertrait. diff --git a/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.stderr b/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.stderr index 2706dda1c52..9ec6ffb0565 100644 --- a/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.stderr +++ b/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.stderr @@ -1,5 +1,5 @@ error[E0221]: ambiguous associated type `Color` in bounds of `C` - --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:26:24 + --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:16:24 | LL | type Color; | ----------- ambiguous `Color` from `Vehicle` @@ -11,7 +11,7 @@ LL | fn a(_: C::Color) { | ^^^^^^^^ ambiguous associated type `Color` error[E0221]: ambiguous associated type `Color` in bounds of `C` - --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:30:12 + --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:20:12 | LL | type Color; | ----------- ambiguous `Color` from `Vehicle` @@ -23,7 +23,7 @@ LL | fn b(_: C::Color) where C : Vehicle+Box { | ^^^^^^^^ ambiguous associated type `Color` error[E0221]: ambiguous associated type `Color` in bounds of `C` - --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:34:12 + --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:24:12 | LL | type Color; | ----------- ambiguous `Color` from `Vehicle` @@ -35,7 +35,7 @@ LL | fn c(_: C::Color) where C : Vehicle, C : Box { | ^^^^^^^^ ambiguous associated type `Color` error[E0221]: ambiguous associated type `Color` in bounds of `X` - --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:45:20 + --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:35:20 | LL | type Color; | ----------- ambiguous `Color` from `Vehicle` @@ -47,7 +47,7 @@ LL | fn e(&self, _: X::Color) where X : Box; | ^^^^^^^^ ambiguous associated type `Color` error[E0221]: ambiguous associated type `Color` in bounds of `X` - --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:48:20 + --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:38:20 | LL | type Color; | ----------- ambiguous `Color` from `Vehicle` @@ -59,7 +59,7 @@ LL | fn f(&self, _: X::Color) where X : Box { } | ^^^^^^^^ ambiguous associated type `Color` error[E0221]: ambiguous associated type `Color` in bounds of `X` - --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:40:20 + --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:30:20 | LL | type Color; | ----------- ambiguous `Color` from `Vehicle` diff --git a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs index 5536566c619..df9143d685f 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs +++ b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test equality constraints in a where clause where the type being // equated appears in a supertrait. diff --git a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr index 7a10b6d021f..0994dc87c99 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr +++ b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr @@ -1,5 +1,5 @@ error[E0221]: ambiguous associated type `Color` in bounds of `C` - --> $DIR/associated-type-projection-from-multiple-supertraits.rs:29:32 + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:19:32 | LL | type Color; | ----------- ambiguous `Color` from `Vehicle` @@ -11,7 +11,7 @@ LL | fn dent(c: C, color: C::Color) { | ^^^^^^^^ ambiguous associated type `Color` error[E0221]: ambiguous associated type `Color` in bounds of `BoxCar` - --> $DIR/associated-type-projection-from-multiple-supertraits.rs:33:33 + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:33 | LL | type Color; | ----------- ambiguous `Color` from `Vehicle` @@ -23,13 +23,16 @@ LL | fn dent_object(c: BoxCar) { | ^^^^^^^^^^^ ambiguous associated type `Color` error[E0191]: the value of the associated type `Color` (from the trait `Vehicle`) must be specified - --> $DIR/associated-type-projection-from-multiple-supertraits.rs:33:26 + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:26 | +LL | type Color; + | ----------- `Color` defined here +... LL | fn dent_object(c: BoxCar) { - | ^^^^^^^^^^^^^^^^^^^ missing associated type `Color` value + | ^^^^^^^^^^^^^^^^^^^ associated type `Color` must be specified error[E0221]: ambiguous associated type `Color` in bounds of `C` - --> $DIR/associated-type-projection-from-multiple-supertraits.rs:38:29 + --> $DIR/associated-type-projection-from-multiple-supertraits.rs:28:29 | LL | type Color; | ----------- ambiguous `Color` from `Vehicle` diff --git a/src/test/ui/associated-type/associated-type-projection-from-supertrait.rs b/src/test/ui/associated-type/associated-type-projection-from-supertrait.rs index b388b6a28e3..06dfe490b8b 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-supertrait.rs +++ b/src/test/ui/associated-type/associated-type-projection-from-supertrait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test equality constraints in a where clause where the type being // equated appears in a supertrait. diff --git a/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr b/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr index 4bc09b624c8..8c7b4a1333c 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr +++ b/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/associated-type-projection-from-supertrait.rs:43:23 + --> $DIR/associated-type-projection-from-supertrait.rs:33:23 | LL | fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types | ^^^^ expected struct `Black`, found struct `Blue` @@ -8,7 +8,7 @@ LL | fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types found type `Blue` error[E0308]: mismatched types - --> $DIR/associated-type-projection-from-supertrait.rs:44:23 + --> $DIR/associated-type-projection-from-supertrait.rs:34:23 | LL | fn c() { dent(ModelU, Black); } //~ ERROR mismatched types | ^^^^^ expected struct `Blue`, found struct `Black` @@ -17,7 +17,7 @@ LL | fn c() { dent(ModelU, Black); } //~ ERROR mismatched types found type `Black` error[E0308]: mismatched types - --> $DIR/associated-type-projection-from-supertrait.rs:50:28 + --> $DIR/associated-type-projection-from-supertrait.rs:40:28 | LL | fn f() { ModelT.chip_paint(Blue); } //~ ERROR mismatched types | ^^^^ expected struct `Black`, found struct `Blue` @@ -26,7 +26,7 @@ LL | fn f() { ModelT.chip_paint(Blue); } //~ ERROR mismatched types found type `Blue` error[E0308]: mismatched types - --> $DIR/associated-type-projection-from-supertrait.rs:51:28 + --> $DIR/associated-type-projection-from-supertrait.rs:41:28 | LL | fn g() { ModelU.chip_paint(Black); } //~ ERROR mismatched types | ^^^^^ expected struct `Blue`, found struct `Black` diff --git a/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs b/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs index 75b60aa8d10..707bcac78bf 100644 --- a/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs +++ b/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we do not ICE when the self type is `ty::err`, but rather // just propagate the error. diff --git a/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr b/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr index 7924ab74444..8c3463a2832 100644 --- a/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr +++ b/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `(): Add` is not satisfied - --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:33:11 + --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:23:11 | LL | r = r + a; | ^ the trait `Add` is not implemented for `()` diff --git a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.rs b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.rs index b1194154911..653130843c8 100644 --- a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.rs +++ b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test equality constraints in a where clause where the type being // equated appears in a supertrait. diff --git a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr index c43ff1ae4cb..126fb572d99 100644 --- a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr +++ b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving `::Color == Blue` - --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:47:10 + --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:37:10 | LL | fn b() { blue_car(ModelT); } //~ ERROR type mismatch | ^^^^^^^^ expected struct `Black`, found struct `Blue` @@ -7,13 +7,13 @@ LL | fn b() { blue_car(ModelT); } //~ ERROR type mismatch = note: expected type `Black` found type `Blue` note: required by `blue_car` - --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:43:1 + --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:33:1 | LL | fn blue_car>(c: C) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0271]: type mismatch resolving `::Color == Black` - --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:48:10 + --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:38:10 | LL | fn c() { black_car(ModelU); } //~ ERROR type mismatch | ^^^^^^^^^ expected struct `Blue`, found struct `Black` @@ -21,7 +21,7 @@ LL | fn c() { black_car(ModelU); } //~ ERROR type mismatch = note: expected type `Blue` found type `Black` note: required by `black_car` - --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:40:1 + --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:30:1 | LL | fn black_car>(c: C) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/associated-types-bound-failure.rs b/src/test/ui/associated-types/associated-types-bound-failure.rs index cd21fb949cb..883ac363b44 100644 --- a/src/test/ui/associated-types/associated-types-bound-failure.rs +++ b/src/test/ui/associated-types/associated-types-bound-failure.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test equality constraints on associated types in a where clause. pub trait ToInt { diff --git a/src/test/ui/associated-types/associated-types-bound-failure.stderr b/src/test/ui/associated-types/associated-types-bound-failure.stderr index 067dfeb454c..784a53f106a 100644 --- a/src/test/ui/associated-types/associated-types-bound-failure.stderr +++ b/src/test/ui/associated-types/associated-types-bound-failure.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `::R: ToInt` is not satisfied - --> $DIR/associated-types-bound-failure.rs:27:5 + --> $DIR/associated-types-bound-failure.rs:17:5 | LL | ToInt::to_int(&g.get()) //~ ERROR E0277 | ^^^^^^^^^^^^^ the trait `ToInt` is not implemented for `::R` | = help: consider adding a `where ::R: ToInt` bound note: required by `ToInt::to_int` - --> $DIR/associated-types-bound-failure.rs:14:5 + --> $DIR/associated-types-bound-failure.rs:4:5 | LL | fn to_int(&self) -> isize; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/associated-types-coherence-failure.rs b/src/test/ui/associated-types/associated-types-coherence-failure.rs index 786a25500a8..fe1201ea06f 100644 --- a/src/test/ui/associated-types/associated-types-coherence-failure.rs +++ b/src/test/ui/associated-types/associated-types-coherence-failure.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that coherence detects overlap when some of the types in the // impls are projections of associated type. Issue #20624. diff --git a/src/test/ui/associated-types/associated-types-coherence-failure.stderr b/src/test/ui/associated-types/associated-types-coherence-failure.stderr index 85d4bf78458..2c53b0a2248 100644 --- a/src/test/ui/associated-types/associated-types-coherence-failure.stderr +++ b/src/test/ui/associated-types/associated-types-coherence-failure.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `Cow<'_, _>`: - --> $DIR/associated-types-coherence-failure.rs:31:1 + --> $DIR/associated-types-coherence-failure.rs:21:1 | LL | impl<'a, B: ?Sized> IntoCow<'a, B> for ::Owned where B: ToOwned { | ----------------------------------------------------------------------------- first implementation here @@ -8,7 +8,7 @@ LL | impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>` error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `&_`: - --> $DIR/associated-types-coherence-failure.rs:38:1 + --> $DIR/associated-types-coherence-failure.rs:28:1 | LL | impl<'a, B: ?Sized> IntoCow<'a, B> for ::Owned where B: ToOwned { | ----------------------------------------------------------------------------- first implementation here diff --git a/src/test/ui/associated-types/associated-types-eq-1.rs b/src/test/ui/associated-types/associated-types-eq-1.rs index 6f2ee854543..c371138ff45 100644 --- a/src/test/ui/associated-types/associated-types-eq-1.rs +++ b/src/test/ui/associated-types/associated-types-eq-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test equality constraints on associated types. Check that unsupported syntax // does not ICE. diff --git a/src/test/ui/associated-types/associated-types-eq-1.stderr b/src/test/ui/associated-types/associated-types-eq-1.stderr index 81bb2ae4ce2..0935d6ae3e6 100644 --- a/src/test/ui/associated-types/associated-types-eq-1.stderr +++ b/src/test/ui/associated-types/associated-types-eq-1.stderr @@ -1,8 +1,8 @@ error[E0412]: cannot find type `A` in this scope - --> $DIR/associated-types-eq-1.rs:20:12 + --> $DIR/associated-types-eq-1.rs:10:12 | LL | let _: A = x.boo(); //~ ERROR cannot find type `A` in this scope - | ^ did you mean `I`? + | ^ help: a type parameter with a similar name exists: `I` error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-eq-2.rs b/src/test/ui/associated-types/associated-types-eq-2.rs index 755a9f2d73f..18e38d44667 100644 --- a/src/test/ui/associated-types/associated-types-eq-2.rs +++ b/src/test/ui/associated-types/associated-types-eq-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test equality constraints on associated types. Check we get an error when an // equality constraint is used in a qualified path. diff --git a/src/test/ui/associated-types/associated-types-eq-2.stderr b/src/test/ui/associated-types/associated-types-eq-2.stderr index 0b80f3472dc..23ee8cd23b5 100644 --- a/src/test/ui/associated-types/associated-types-eq-2.stderr +++ b/src/test/ui/associated-types/associated-types-eq-2.stderr @@ -1,5 +1,5 @@ error[E0229]: associated type bindings are not allowed here - --> $DIR/associated-types-eq-2.rs:26:30 + --> $DIR/associated-types-eq-2.rs:16:30 | LL | fn baz(x: &>::A) {} | ^^^^^ associated type not allowed here diff --git a/src/test/ui/associated-types/associated-types-eq-3.rs b/src/test/ui/associated-types/associated-types-eq-3.rs index cb952f6534f..1a58dcca9e2 100644 --- a/src/test/ui/associated-types/associated-types-eq-3.rs +++ b/src/test/ui/associated-types/associated-types-eq-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test equality constraints on associated types. Check we get type errors // where we should. diff --git a/src/test/ui/associated-types/associated-types-eq-3.stderr b/src/test/ui/associated-types/associated-types-eq-3.stderr index d8b2be0e1b0..c1a8e2002be 100644 --- a/src/test/ui/associated-types/associated-types-eq-3.stderr +++ b/src/test/ui/associated-types/associated-types-eq-3.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/associated-types-eq-3.rs:33:18 + --> $DIR/associated-types-eq-3.rs:23:18 | LL | let _: Bar = x.boo(); | ^^^^^^^ expected struct `Bar`, found associated type @@ -8,7 +8,7 @@ LL | let _: Bar = x.boo(); found type `::A` error[E0271]: type mismatch resolving `::A == Bar` - --> $DIR/associated-types-eq-3.rs:48:5 + --> $DIR/associated-types-eq-3.rs:38:5 | LL | foo1(a); | ^^^^ expected usize, found struct `Bar` @@ -16,13 +16,13 @@ LL | foo1(a); = note: expected type `usize` found type `Bar` note: required by `foo1` - --> $DIR/associated-types-eq-3.rs:28:1 + --> $DIR/associated-types-eq-3.rs:18:1 | LL | fn foo1>(x: I) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0271]: type mismatch resolving `::A == Bar` - --> $DIR/associated-types-eq-3.rs:51:9 + --> $DIR/associated-types-eq-3.rs:41:9 | LL | baz(&a); | ^^ expected usize, found struct `Bar` diff --git a/src/test/ui/associated-types/associated-types-eq-expr-path.rs b/src/test/ui/associated-types/associated-types-eq-expr-path.rs index 847393ba2b8..143992f29f1 100644 --- a/src/test/ui/associated-types/associated-types-eq-expr-path.rs +++ b/src/test/ui/associated-types/associated-types-eq-expr-path.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that an associated type cannot be bound in an expression path. trait Foo { diff --git a/src/test/ui/associated-types/associated-types-eq-expr-path.stderr b/src/test/ui/associated-types/associated-types-eq-expr-path.stderr index 36c31cd3f05..bd354cf3e16 100644 --- a/src/test/ui/associated-types/associated-types-eq-expr-path.stderr +++ b/src/test/ui/associated-types/associated-types-eq-expr-path.stderr @@ -1,5 +1,5 @@ error[E0229]: associated type bindings are not allowed here - --> $DIR/associated-types-eq-expr-path.rs:24:26 + --> $DIR/associated-types-eq-expr-path.rs:14:26 | LL | let x: isize = Foo::::bar(); | ^^^^^^^ associated type not allowed here diff --git a/src/test/ui/associated-types/associated-types-eq-hr.rs b/src/test/ui/associated-types/associated-types-eq-hr.rs index 52a2ca9082d..20fa1e7a48d 100644 --- a/src/test/ui/associated-types/associated-types-eq-hr.rs +++ b/src/test/ui/associated-types/associated-types-eq-hr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check testing of equality constraints in a higher-ranked context. pub trait TheTrait { @@ -87,23 +77,33 @@ fn tuple_four() // not ok for tuple, two lifetimes, and lifetime matching is invariant } -pub fn main() { +pub fn call_foo() { foo::(); foo::(); //~ ERROR type mismatch +} +pub fn call_bar() { bar::(); //~ ERROR type mismatch bar::(); +} +pub fn call_tuple_one() { tuple_one::(); - //~^ ERROR E0277 - //~| ERROR type mismatch + //~^ ERROR not general enough +} +pub fn call_tuple_two() { tuple_two::(); - //~^ ERROR E0277 - //~| ERROR type mismatch + //~^ ERROR not general enough +} +pub fn call_tuple_three() { tuple_three::(); +} +pub fn call_tuple_four() { tuple_four::(); - //~^ ERROR E0277 + //~^ ERROR not general enough } + +fn main() { } diff --git a/src/test/ui/associated-types/associated-types-eq-hr.stderr b/src/test/ui/associated-types/associated-types-eq-hr.stderr index 5081a2649d1..5299ebbb1ba 100644 --- a/src/test/ui/associated-types/associated-types-eq-hr.stderr +++ b/src/test/ui/associated-types/associated-types-eq-hr.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving `for<'x> >::A == &'x isize` - --> $DIR/associated-types-eq-hr.rs:92:5 + --> $DIR/associated-types-eq-hr.rs:82:5 | LL | foo::(); //~ ERROR type mismatch | ^^^^^^^^^^^^^^^^^ expected usize, found isize @@ -7,7 +7,7 @@ LL | foo::(); //~ ERROR type mismatch = note: expected type `&usize` found type `&isize` note: required by `foo` - --> $DIR/associated-types-eq-hr.rs:54:1 + --> $DIR/associated-types-eq-hr.rs:44:1 | LL | / fn foo() LL | | where T : for<'x> TheTrait<&'x isize, A = &'x isize> @@ -17,7 +17,7 @@ LL | | } | |_^ error[E0271]: type mismatch resolving `for<'x> >::A == &'x usize` - --> $DIR/associated-types-eq-hr.rs:94:5 + --> $DIR/associated-types-eq-hr.rs:86:5 | LL | bar::(); //~ ERROR type mismatch | ^^^^^^^^^^^^^^^^ expected isize, found usize @@ -25,7 +25,7 @@ LL | bar::(); //~ ERROR type mismatch = note: expected type `&isize` found type `&usize` note: required by `bar` - --> $DIR/associated-types-eq-hr.rs:60:1 + --> $DIR/associated-types-eq-hr.rs:50:1 | LL | / fn bar() LL | | where T : for<'x> TheTrait<&'x isize, A = &'x usize> @@ -34,93 +34,36 @@ LL | | // ok for UintStruct, but not IntStruct LL | | } | |_^ -error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied - --> $DIR/associated-types-eq-hr.rs:97:5 +error: implementation of `TheTrait` is not general enough + --> $DIR/associated-types-eq-hr.rs:91:5 | LL | tuple_one::(); - | ^^^^^^^^^^^^^^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple` + | ^^^^^^^^^^^^^^^^^^ | - = help: the following implementations were found: - > -note: required by `tuple_one` - --> $DIR/associated-types-eq-hr.rs:66:1 - | -LL | / fn tuple_one() -LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'x isize> -LL | | { -LL | | // not ok for tuple, two lifetimes and we pick first -LL | | } - | |_^ - -error[E0271]: type mismatch resolving `for<'x, 'y> >::A == &'x isize` - --> $DIR/associated-types-eq-hr.rs:97:5 - | -LL | tuple_one::(); - | ^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime - | -note: required by `tuple_one` - --> $DIR/associated-types-eq-hr.rs:66:1 - | -LL | / fn tuple_one() -LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'x isize> -LL | | { -LL | | // not ok for tuple, two lifetimes and we pick first -LL | | } - | |_^ - -error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied - --> $DIR/associated-types-eq-hr.rs:101:5 - | -LL | tuple_two::(); - | ^^^^^^^^^^^^^^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple` - | - = help: the following implementations were found: - > -note: required by `tuple_two` - --> $DIR/associated-types-eq-hr.rs:72:1 - | -LL | / fn tuple_two() -LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'y isize> -LL | | { -LL | | // not ok for tuple, two lifetimes and we pick second -LL | | } - | |_^ + = note: Due to a where-clause on `tuple_one`, + = note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1` + = note: but `Tuple` actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` -error[E0271]: type mismatch resolving `for<'x, 'y> >::A == &'y isize` - --> $DIR/associated-types-eq-hr.rs:101:5 +error: implementation of `TheTrait` is not general enough + --> $DIR/associated-types-eq-hr.rs:96:5 | LL | tuple_two::(); - | ^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime - | -note: required by `tuple_two` - --> $DIR/associated-types-eq-hr.rs:72:1 + | ^^^^^^^^^^^^^^^^^^ | -LL | / fn tuple_two() -LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'y isize> -LL | | { -LL | | // not ok for tuple, two lifetimes and we pick second -LL | | } - | |_^ + = note: Due to a where-clause on `tuple_two`, + = note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1` + = note: but `Tuple` actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` -error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied - --> $DIR/associated-types-eq-hr.rs:107:5 +error: implementation of `TheTrait` is not general enough + --> $DIR/associated-types-eq-hr.rs:105:5 | LL | tuple_four::(); - | ^^^^^^^^^^^^^^^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple` - | - = help: the following implementations were found: - > -note: required by `tuple_four` - --> $DIR/associated-types-eq-hr.rs:84:1 + | ^^^^^^^^^^^^^^^^^^^ | -LL | / fn tuple_four() -LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize)> -LL | | { -LL | | // not ok for tuple, two lifetimes, and lifetime matching is invariant -LL | | } - | |_^ + = note: Due to a where-clause on `tuple_four`, + = note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1` + = note: but `Tuple` actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` -error: aborting due to 7 previous errors +error: aborting due to 5 previous errors -Some errors occurred: E0271, E0277. -For more information about an error, try `rustc --explain E0271`. +For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/associated-types/associated-types-for-unimpl-trait.rs b/src/test/ui/associated-types/associated-types-for-unimpl-trait.rs index a6fcb9cff13..5b10d1dc2fd 100644 --- a/src/test/ui/associated-types/associated-types-for-unimpl-trait.rs +++ b/src/test/ui/associated-types/associated-types-for-unimpl-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Get { type Value; fn get(&self) -> ::Value; diff --git a/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr b/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr index e6c15e465b6..9f033687a00 100644 --- a/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr +++ b/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Self: Get` is not satisfied - --> $DIR/associated-types-for-unimpl-trait.rs:17:5 + --> $DIR/associated-types-for-unimpl-trait.rs:7:5 | LL | fn uhoh(&self, foo: U, bar: ::Value) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` diff --git a/src/test/ui/associated-types/associated-types-in-ambiguous-context.rs b/src/test/ui/associated-types/associated-types-in-ambiguous-context.rs index becbc27138b..1b1ea9d52a9 100644 --- a/src/test/ui/associated-types/associated-types-in-ambiguous-context.rs +++ b/src/test/ui/associated-types/associated-types-in-ambiguous-context.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Get { type Value; fn get(&self) -> ::Value; diff --git a/src/test/ui/associated-types/associated-types-in-ambiguous-context.stderr b/src/test/ui/associated-types/associated-types-in-ambiguous-context.stderr index 755e83daf47..83667b54807 100644 --- a/src/test/ui/associated-types/associated-types-in-ambiguous-context.stderr +++ b/src/test/ui/associated-types/associated-types-in-ambiguous-context.stderr @@ -1,17 +1,17 @@ error[E0223]: ambiguous associated type - --> $DIR/associated-types-in-ambiguous-context.rs:16:36 + --> $DIR/associated-types-in-ambiguous-context.rs:6:36 | LL | fn get(x: T, y: U) -> Get::Value {} | ^^^^^^^^^^ help: use fully-qualified syntax: `::Value` error[E0223]: ambiguous associated type - --> $DIR/associated-types-in-ambiguous-context.rs:25:10 + --> $DIR/associated-types-in-ambiguous-context.rs:15:10 | LL | type X = std::ops::Deref::Target; | ^^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `::Target` error[E0223]: ambiguous associated type - --> $DIR/associated-types-in-ambiguous-context.rs:21:23 + --> $DIR/associated-types-in-ambiguous-context.rs:11:23 | LL | fn grab(&self) -> Grab::Value; | ^^^^^^^^^^^ help: use fully-qualified syntax: `::Value` diff --git a/src/test/ui/associated-types/associated-types-incomplete-object.rs b/src/test/ui/associated-types/associated-types-incomplete-object.rs index 9f1df14605b..c93f3bec4d7 100644 --- a/src/test/ui/associated-types/associated-types-incomplete-object.rs +++ b/src/test/ui/associated-types/associated-types-incomplete-object.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that the user gets an error if they omit a binding from an // object type. @@ -37,6 +27,5 @@ pub fn main() { //~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified let d = &42isize as &Foo; - //~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified - //~| ERROR the value of the associated type `B` (from the trait `Foo`) must be specified + //~^ ERROR the value of the associated types `A` (from the trait `Foo`), `B` (from the trait } diff --git a/src/test/ui/associated-types/associated-types-incomplete-object.stderr b/src/test/ui/associated-types/associated-types-incomplete-object.stderr index 95b1c631250..d152e028eb7 100644 --- a/src/test/ui/associated-types/associated-types-incomplete-object.stderr +++ b/src/test/ui/associated-types/associated-types-incomplete-object.stderr @@ -1,27 +1,35 @@ error[E0191]: the value of the associated type `B` (from the trait `Foo`) must be specified - --> $DIR/associated-types-incomplete-object.rs:33:26 + --> $DIR/associated-types-incomplete-object.rs:23:26 | +LL | type B; + | ------- `B` defined here +... LL | let b = &42isize as &Foo; - | ^^^^^^^^^^^^ missing associated type `B` value + | ^^^^^^^^^^^^ associated type `B` must be specified error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified - --> $DIR/associated-types-incomplete-object.rs:36:26 + --> $DIR/associated-types-incomplete-object.rs:26:26 | +LL | type A; + | ------- `A` defined here +... LL | let c = &42isize as &Foo; - | ^^^^^^^^^^^ missing associated type `A` value + | ^^^^^^^^^^^ associated type `A` must be specified -error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified - --> $DIR/associated-types-incomplete-object.rs:39:26 - | -LL | let d = &42isize as &Foo; - | ^^^ missing associated type `A` value - -error[E0191]: the value of the associated type `B` (from the trait `Foo`) must be specified - --> $DIR/associated-types-incomplete-object.rs:39:26 +error[E0191]: the value of the associated types `A` (from the trait `Foo`), `B` (from the trait `Foo`) must be specified + --> $DIR/associated-types-incomplete-object.rs:29:26 | +LL | type A; + | ------- `A` defined here +LL | type B; + | ------- `B` defined here +... LL | let d = &42isize as &Foo; - | ^^^ missing associated type `B` value + | ^^^ + | | + | associated type `A` must be specified + | associated type `B` must be specified -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0191`. diff --git a/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.rs b/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.rs index 83726a1676d..3bd3f3a757c 100644 --- a/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.rs +++ b/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we report an error if the trait ref in a qualified type // uses invalid type arguments. diff --git a/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr b/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr index 40cba5e6834..01f66a18d25 100644 --- a/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr +++ b/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `T: Foo` is not satisfied - --> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:20:12 + --> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:10:12 | LL | let u: >::Bar = t.get_bar(); | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T` diff --git a/src/test/ui/associated-types/associated-types-issue-17359.rs b/src/test/ui/associated-types/associated-types-issue-17359.rs index 82258f124d3..88a8a6490e6 100644 --- a/src/test/ui/associated-types/associated-types-issue-17359.rs +++ b/src/test/ui/associated-types/associated-types-issue-17359.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we do not ICE when an impl is missing an associated type (and that we report // a useful error, of course). diff --git a/src/test/ui/associated-types/associated-types-issue-17359.stderr b/src/test/ui/associated-types/associated-types-issue-17359.stderr index 8ba8194bded..e05da8c4e4e 100644 --- a/src/test/ui/associated-types/associated-types-issue-17359.stderr +++ b/src/test/ui/associated-types/associated-types-issue-17359.stderr @@ -1,5 +1,5 @@ error[E0046]: not all trait items implemented, missing: `Type` - --> $DIR/associated-types-issue-17359.rs:18:1 + --> $DIR/associated-types-issue-17359.rs:8:1 | LL | type Type; | ---------- `Type` from trait diff --git a/src/test/ui/associated-types/associated-types-issue-20346.rs b/src/test/ui/associated-types/associated-types-issue-20346.rs index a00aa8364bd..0cce847e1be 100644 --- a/src/test/ui/associated-types/associated-types-issue-20346.rs +++ b/src/test/ui/associated-types/associated-types-issue-20346.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we reliably check the value of the associated type. #![crate_type = "lib"] diff --git a/src/test/ui/associated-types/associated-types-issue-20346.stderr b/src/test/ui/associated-types/associated-types-issue-20346.stderr index 6f3dfbe0898..27b5b1e00f9 100644 --- a/src/test/ui/associated-types/associated-types-issue-20346.stderr +++ b/src/test/ui/associated-types/associated-types-issue-20346.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving ` as Iterator>::Item == std::option::Option` - --> $DIR/associated-types-issue-20346.rs:44:5 + --> $DIR/associated-types-issue-20346.rs:34:5 | LL | is_iterator_of::, _>(&adapter); //~ ERROR type mismatch | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter, found enum `std::option::Option` @@ -7,7 +7,7 @@ LL | is_iterator_of::, _>(&adapter); //~ ERROR type mismatch = note: expected type `T` found type `std::option::Option` note: required by `is_iterator_of` - --> $DIR/associated-types-issue-20346.rs:25:1 + --> $DIR/associated-types-issue-20346.rs:15:1 | LL | fn is_iterator_of>(_: &I) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.rs b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.rs index 9436f825de8..daeaf90117f 100644 --- a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.rs +++ b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { type X; type Y; diff --git a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr index c38a5f6e7f4..ec8852d9f18 100644 --- a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr +++ b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving `::Y == i32` - --> $DIR/associated-types-multiple-types-one-trait.rs:23:5 + --> $DIR/associated-types-multiple-types-one-trait.rs:13:5 | LL | want_y(t); //~ ERROR type mismatch | ^^^^^^ expected associated type, found i32 @@ -7,13 +7,13 @@ LL | want_y(t); //~ ERROR type mismatch = note: expected type `::Y` found type `i32` note: required by `want_y` - --> $DIR/associated-types-multiple-types-one-trait.rs:54:1 + --> $DIR/associated-types-multiple-types-one-trait.rs:44:1 | LL | fn want_y>(t: &T) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0271]: type mismatch resolving `::X == u32` - --> $DIR/associated-types-multiple-types-one-trait.rs:28:5 + --> $DIR/associated-types-multiple-types-one-trait.rs:18:5 | LL | want_x(t); //~ ERROR type mismatch | ^^^^^^ expected associated type, found u32 @@ -21,7 +21,7 @@ LL | want_x(t); //~ ERROR type mismatch = note: expected type `::X` found type `u32` note: required by `want_x` - --> $DIR/associated-types-multiple-types-one-trait.rs:52:1 + --> $DIR/associated-types-multiple-types-one-trait.rs:42:1 | LL | fn want_x>(t: &T) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/associated-types-no-suitable-bound.rs b/src/test/ui/associated-types/associated-types-no-suitable-bound.rs index baf56ffec86..d42460a4c07 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-bound.rs +++ b/src/test/ui/associated-types/associated-types-no-suitable-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Get { type Value; fn get(&self) -> ::Value; diff --git a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr index 84802d49caa..ada9cacbee5 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `T: Get` is not satisfied - --> $DIR/associated-types-no-suitable-bound.rs:21:5 + --> $DIR/associated-types-no-suitable-bound.rs:11:5 | LL | fn uhoh(foo: ::Value) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `T` diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.rs b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.rs index e0f0f3c47ae..17dfa1773dd 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.rs +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we get an error when you use `::Value` in // the trait definition but `Self` does not, in fact, implement `Get`. // diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr index 712b95f8e54..56cd6d09cad 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Self: Get` is not satisfied - --> $DIR/associated-types-no-suitable-supertrait-2.rs:27:5 + --> $DIR/associated-types-no-suitable-supertrait-2.rs:17:5 | LL | fn uhoh(&self, foo: U, bar: ::Value) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.rs b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.rs index ec38595e8fe..c373c5855cd 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.rs +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we get an error when you use `::Value` in // the trait definition but `Self` does not, in fact, implement `Get`. // diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr index 6927146ffbc..71175d36f64 100644 --- a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr +++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Self: Get` is not satisfied - --> $DIR/associated-types-no-suitable-supertrait.rs:27:5 + --> $DIR/associated-types-no-suitable-supertrait.rs:17:5 | LL | fn uhoh(&self, foo: U, bar: ::Value) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` @@ -7,7 +7,7 @@ LL | fn uhoh(&self, foo: U, bar: ::Value) {} = help: consider adding a `where Self: Get` bound error[E0277]: the trait bound `(T, U): Get` is not satisfied - --> $DIR/associated-types-no-suitable-supertrait.rs:32:5 + --> $DIR/associated-types-no-suitable-supertrait.rs:22:5 | LL | fn uhoh(&self, foo: U, bar: <(T, U) as Get>::Value) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)` diff --git a/src/test/ui/associated-types/associated-types-outlives.nll.stderr b/src/test/ui/associated-types/associated-types-outlives.nll.stderr index 384ed8f3284..c58dc314e8a 100644 --- a/src/test/ui/associated-types/associated-types-outlives.nll.stderr +++ b/src/test/ui/associated-types/associated-types-outlives.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/associated-types-outlives.rs:32:14 + --> $DIR/associated-types-outlives.rs:22:14 | LL | 's: loop { y = denormalise(&x); break } | -- borrow of `x` occurs here diff --git a/src/test/ui/associated-types/associated-types-outlives.rs b/src/test/ui/associated-types/associated-types-outlives.rs index f070ab6799c..55c276280b9 100644 --- a/src/test/ui/associated-types/associated-types-outlives.rs +++ b/src/test/ui/associated-types/associated-types-outlives.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #24622. The older associated types code // was erroneously assuming that all projections outlived the current // fn body, causing this (invalid) code to be accepted. diff --git a/src/test/ui/associated-types/associated-types-outlives.stderr b/src/test/ui/associated-types/associated-types-outlives.stderr index 6d46392d94b..4cf3e473cf1 100644 --- a/src/test/ui/associated-types/associated-types-outlives.stderr +++ b/src/test/ui/associated-types/associated-types-outlives.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/associated-types-outlives.rs:32:14 + --> $DIR/associated-types-outlives.rs:22:14 | LL | 's: loop { y = denormalise(&x); break } | - borrow of `x` occurs here diff --git a/src/test/ui/associated-types/associated-types-overridden-binding-2.rs b/src/test/ui/associated-types/associated-types-overridden-binding-2.rs index 8d91561b7d6..7467f332047 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding-2.rs +++ b/src/test/ui/associated-types/associated-types-overridden-binding-2.rs @@ -1,17 +1,8 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(trait_alias)] trait I32Iterator = Iterator; fn main() { let _: &I32Iterator = &vec![42].into_iter(); + //~^ ERROR type mismatch } diff --git a/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr b/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr index 536cd945083..8c0e5570d19 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding-2.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == i32` - --> $DIR/associated-types-overridden-binding-2.rs:16:39 + --> $DIR/associated-types-overridden-binding-2.rs:6:39 | LL | let _: &I32Iterator = &vec![42].into_iter(); | ^^^^^^^^^^^^^^^^^^^^^ expected u32, found i32 diff --git a/src/test/ui/associated-types/associated-types-overridden-binding.rs b/src/test/ui/associated-types/associated-types-overridden-binding.rs index ed2211ecffd..ea3a61b2bef 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding.rs +++ b/src/test/ui/associated-types/associated-types-overridden-binding.rs @@ -1,17 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(trait_alias)] trait Foo: Iterator {} -trait Bar: Foo {} +trait Bar: Foo {} //~ ERROR type annotations required trait I32Iterator = Iterator; trait U32Iterator = I32Iterator; diff --git a/src/test/ui/associated-types/associated-types-overridden-binding.stderr b/src/test/ui/associated-types/associated-types-overridden-binding.stderr index 216aa097db9..b54d2037f5d 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding.stderr @@ -1,11 +1,11 @@ error[E0284]: type annotations required: cannot resolve `::Item == i32` - --> $DIR/associated-types-overridden-binding.rs:14:1 + --> $DIR/associated-types-overridden-binding.rs:4:1 | -LL | trait Bar: Foo {} +LL | trait Bar: Foo {} //~ ERROR type annotations required | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by `Foo` - --> $DIR/associated-types-overridden-binding.rs:13:1 + --> $DIR/associated-types-overridden-binding.rs:3:1 | LL | trait Foo: Iterator {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/associated-types-overridden-default.rs b/src/test/ui/associated-types/associated-types-overridden-default.rs index 946a4b2f73a..629fc7a7668 100644 --- a/src/test/ui/associated-types/associated-types-overridden-default.rs +++ b/src/test/ui/associated-types/associated-types-overridden-default.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_type_defaults)] pub trait Tr { diff --git a/src/test/ui/associated-types/associated-types-overridden-default.stderr b/src/test/ui/associated-types/associated-types-overridden-default.stderr index e9a480be067..79fb9a613c2 100644 --- a/src/test/ui/associated-types/associated-types-overridden-default.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-default.stderr @@ -1,5 +1,5 @@ error[E0399]: the following trait items need to be reimplemented as `Assoc` was overridden: `Assoc2`, `C`, `foo` - --> $DIR/associated-types-overridden-default.rs:21:5 + --> $DIR/associated-types-overridden-default.rs:11:5 | LL | type Assoc = (); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/associated-types-path-1.rs b/src/test/ui/associated-types/associated-types-path-1.rs index ab061ca4d8d..46a5c9e7ca0 100644 --- a/src/test/ui/associated-types/associated-types-path-1.rs +++ b/src/test/ui/associated-types/associated-types-path-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we have one and only one associated type per ref. pub trait Foo { diff --git a/src/test/ui/associated-types/associated-types-path-1.stderr b/src/test/ui/associated-types/associated-types-path-1.stderr index 04147922d9c..5f5fb7a273b 100644 --- a/src/test/ui/associated-types/associated-types-path-1.stderr +++ b/src/test/ui/associated-types/associated-types-path-1.stderr @@ -1,11 +1,11 @@ error[E0220]: associated type `A` not found for `T` - --> $DIR/associated-types-path-1.rs:20:23 + --> $DIR/associated-types-path-1.rs:10:23 | LL | pub fn f1(a: T, x: T::A) {} //~ERROR associated type `A` not found | ^^^^ associated type `A` not found error[E0221]: ambiguous associated type `A` in bounds of `T` - --> $DIR/associated-types-path-1.rs:21:34 + --> $DIR/associated-types-path-1.rs:11:34 | LL | type A; | ------- ambiguous `A` from `Foo` diff --git a/src/test/ui/associated-types/associated-types-path-2.rs b/src/test/ui/associated-types/associated-types-path-2.rs index d62f6b0f1a3..b28b60e7008 100644 --- a/src/test/ui/associated-types/associated-types-path-2.rs +++ b/src/test/ui/associated-types/associated-types-path-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test type checking of uses of associated types via sugary paths. pub trait Foo { diff --git a/src/test/ui/associated-types/associated-types-path-2.stderr b/src/test/ui/associated-types/associated-types-path-2.stderr index 403b4fd4d8e..be7097a0182 100644 --- a/src/test/ui/associated-types/associated-types-path-2.stderr +++ b/src/test/ui/associated-types/associated-types-path-2.stderr @@ -1,47 +1,47 @@ error[E0308]: mismatched types - --> $DIR/associated-types-path-2.rs:29:14 + --> $DIR/associated-types-path-2.rs:19:14 | LL | f1(2i32, 4i32); | ^^^^ expected u32, found i32 error[E0277]: the trait bound `u32: Foo` is not satisfied - --> $DIR/associated-types-path-2.rs:39:5 + --> $DIR/associated-types-path-2.rs:29:5 | LL | f1(2u32, 4u32); | ^^ the trait `Foo` is not implemented for `u32` | note: required by `f1` - --> $DIR/associated-types-path-2.rs:23:1 + --> $DIR/associated-types-path-2.rs:13:1 | LL | pub fn f1(a: T, x: T::A) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `u32: Foo` is not satisfied - --> $DIR/associated-types-path-2.rs:39:5 + --> $DIR/associated-types-path-2.rs:29:5 | LL | f1(2u32, 4u32); | ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u32` error[E0277]: the trait bound `u32: Foo` is not satisfied - --> $DIR/associated-types-path-2.rs:45:5 + --> $DIR/associated-types-path-2.rs:35:5 | LL | f1(2u32, 4i32); | ^^ the trait `Foo` is not implemented for `u32` | note: required by `f1` - --> $DIR/associated-types-path-2.rs:23:1 + --> $DIR/associated-types-path-2.rs:13:1 | LL | pub fn f1(a: T, x: T::A) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `u32: Foo` is not satisfied - --> $DIR/associated-types-path-2.rs:45:5 + --> $DIR/associated-types-path-2.rs:35:5 | LL | f1(2u32, 4i32); | ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u32` error[E0308]: mismatched types - --> $DIR/associated-types-path-2.rs:51:18 + --> $DIR/associated-types-path-2.rs:41:18 | LL | let _: i32 = f2(2i32); | ^^^^^^^^ expected i32, found u32 diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.rs b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.rs index 5451a20d816..9434a88e633 100644 --- a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.rs +++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check projection of an associated type out of a higher-ranked // trait-bound in the context of a function body. diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr index 12bbfb24910..d5310c47fcf 100644 --- a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr +++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:32:40 + --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:22:40 | LL | x: >::A, | --------- these two types are declared with different lifetimes... diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.rs b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.rs index a79d5c4649a..bf13c410cc6 100644 --- a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.rs +++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check projection of an associated type out of a higher-ranked trait-bound // in the context of a function signature. diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr index 399f4d9409a..e06ad648613 100644 --- a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr +++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr @@ -1,5 +1,5 @@ error[E0212]: cannot extract an associated type from a higher-ranked trait bound in this context - --> $DIR/associated-types-project-from-hrtb-in-fn.rs:21:8 + --> $DIR/associated-types-project-from-hrtb-in-fn.rs:11:8 | LL | x: I::A) | ^^^^ diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs index e6251a0d318..20f11ecf638 100644 --- a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs +++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check projection of an associated type out of a higher-ranked trait-bound // in the context of a struct definition. diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.stderr index 05c0c38c79f..4c9b7951393 100644 --- a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.stderr +++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.stderr @@ -1,5 +1,5 @@ error[E0212]: cannot extract an associated type from a higher-ranked trait bound in this context - --> $DIR/associated-types-project-from-hrtb-in-struct.rs:21:12 + --> $DIR/associated-types-project-from-hrtb-in-struct.rs:11:12 | LL | field: I::A | ^^^^ diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.rs b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.rs index af46a1b42d0..cb52c2b4f15 100644 --- a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.rs +++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check projection of an associated type out of a higher-ranked trait-bound // in the context of a method definition in a trait. diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr index ccd568b6253..445e1b19023 100644 --- a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr +++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr @@ -1,5 +1,5 @@ error[E0212]: cannot extract an associated type from a higher-ranked trait bound in this context - --> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:21:32 + --> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:11:32 | LL | fn some_method(&self, arg: I::A); | ^^^^ diff --git a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.rs b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.rs index 3f72391ff90..fc38b26f50b 100644 --- a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.rs +++ b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we get an error when you use `::Value` in // the trait definition even if there is no default method. diff --git a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr index e7e68dcf852..a260e379182 100644 --- a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr +++ b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Self: Get` is not satisfied - --> $DIR/associated-types-projection-to-unrelated-trait-in-method-without-default.rs:19:5 + --> $DIR/associated-types-projection-to-unrelated-trait-in-method-without-default.rs:9:5 | LL | fn okay(&self, foo: U, bar: ::Value); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self` diff --git a/src/test/ui/associated-types/associated-types-subtyping-1.rs b/src/test/ui/associated-types/associated-types-subtyping-1.rs index 479cb359a78..012cffb7b97 100644 --- a/src/test/ui/associated-types/associated-types-subtyping-1.rs +++ b/src/test/ui/associated-types/associated-types-subtyping-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] fn make_any() -> T { loop {} } diff --git a/src/test/ui/associated-types/associated-types-subtyping-1.stderr b/src/test/ui/associated-types/associated-types-subtyping-1.stderr index 3cc7b07a20c..77914dbae79 100644 --- a/src/test/ui/associated-types/associated-types-subtyping-1.stderr +++ b/src/test/ui/associated-types/associated-types-subtyping-1.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/associated-types-subtyping-1.rs:36:38 + --> $DIR/associated-types-subtyping-1.rs:26:38 | LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T) | ----- ----- these two types are declared with different lifetimes... @@ -8,7 +8,7 @@ LL | let _c: >::Type = a; //~ ERROR E0623 | ^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch - --> $DIR/associated-types-subtyping-1.rs:45:38 + --> $DIR/associated-types-subtyping-1.rs:35:38 | LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T) | ----- ----- these two types are declared with different lifetimes... diff --git a/src/test/ui/associated-types/associated-types-unconstrained.rs b/src/test/ui/associated-types/associated-types-unconstrained.rs index aecbf217a5b..99424836ece 100644 --- a/src/test/ui/associated-types/associated-types-unconstrained.rs +++ b/src/test/ui/associated-types/associated-types-unconstrained.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that an associated type cannot be bound in an expression path. trait Foo { diff --git a/src/test/ui/associated-types/associated-types-unconstrained.stderr b/src/test/ui/associated-types/associated-types-unconstrained.stderr index abb220c96c6..da14a69ae30 100644 --- a/src/test/ui/associated-types/associated-types-unconstrained.stderr +++ b/src/test/ui/associated-types/associated-types-unconstrained.stderr @@ -1,5 +1,5 @@ error[E0284]: type annotations required: cannot resolve `<_ as Foo>::A == _` - --> $DIR/associated-types-unconstrained.rs:24:20 + --> $DIR/associated-types-unconstrained.rs:14:20 | LL | let x: isize = Foo::bar(); | ^^^^^^^^ diff --git a/src/test/ui/associated-types/associated-types-unsized.rs b/src/test/ui/associated-types/associated-types-unsized.rs index c561ae861ed..a9bc24e44d1 100644 --- a/src/test/ui/associated-types/associated-types-unsized.rs +++ b/src/test/ui/associated-types/associated-types-unsized.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Get { type Value: ?Sized; fn get(&self) -> ::Value; diff --git a/src/test/ui/associated-types/associated-types-unsized.stderr b/src/test/ui/associated-types/associated-types-unsized.stderr index 09e3cb8c126..c83b14374f7 100644 --- a/src/test/ui/associated-types/associated-types-unsized.stderr +++ b/src/test/ui/associated-types/associated-types-unsized.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `::Value` cannot be known at compilation time - --> $DIR/associated-types-unsized.rs:17:9 + --> $DIR/associated-types-unsized.rs:7:9 | LL | let x = t.get(); //~ ERROR the size for values of type | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `::Value` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where ::Value: std::marker::Sized` bound = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/associated-types/bound-lifetime-constrained.clause.stderr b/src/test/ui/associated-types/bound-lifetime-constrained.clause.stderr index 23a67b5b064..f089f27f0a6 100644 --- a/src/test/ui/associated-types/bound-lifetime-constrained.clause.stderr +++ b/src/test/ui/associated-types/bound-lifetime-constrained.clause.stderr @@ -1,11 +1,11 @@ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-constrained.rs:48:63 + --> $DIR/bound-lifetime-constrained.rs:38:63 | LL | fn clause1() where T: for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32 { | ^^^^^^^ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-constrained.rs:53:42 + --> $DIR/bound-lifetime-constrained.rs:43:42 | LL | fn clause2() where T: for<'a> Fn() -> <() as Foo<'a>>::Item { | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/bound-lifetime-constrained.func.stderr b/src/test/ui/associated-types/bound-lifetime-constrained.func.stderr index c969baeaefe..88d15a17199 100644 --- a/src/test/ui/associated-types/bound-lifetime-constrained.func.stderr +++ b/src/test/ui/associated-types/bound-lifetime-constrained.func.stderr @@ -1,11 +1,11 @@ error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types - --> $DIR/bound-lifetime-constrained.rs:26:50 + --> $DIR/bound-lifetime-constrained.rs:16:50 | LL | fn func1(_: for<'a> fn(<() as Foo<'a>>::Item) -> &'a i32) { | ^^^^^^^ error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types - --> $DIR/bound-lifetime-constrained.rs:33:29 + --> $DIR/bound-lifetime-constrained.rs:23:29 | LL | fn func2(_: for<'a> fn() -> <() as Foo<'a>>::Item) { | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr b/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr index f24fed0f02e..9258854245c 100644 --- a/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr +++ b/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr @@ -1,11 +1,11 @@ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-constrained.rs:38:56 + --> $DIR/bound-lifetime-constrained.rs:28:56 | LL | fn object1(_: Box Fn(<() as Foo<'a>>::Item) -> &'a i32>) { | ^^^^^^^ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-constrained.rs:43:35 + --> $DIR/bound-lifetime-constrained.rs:33:35 | LL | fn object2(_: Box Fn() -> <() as Foo<'a>>::Item>) { | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/bound-lifetime-constrained.rs b/src/test/ui/associated-types/bound-lifetime-constrained.rs index 9ba5045f2a0..b590f88b60d 100644 --- a/src/test/ui/associated-types/bound-lifetime-constrained.rs +++ b/src/test/ui/associated-types/bound-lifetime-constrained.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: func object clause #![allow(dead_code)] diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr index 5df8a828012..fee64c0f663 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr @@ -1,23 +1,23 @@ error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-in-binding-only.rs:22:25 + --> $DIR/bound-lifetime-in-binding-only.rs:12:25 | LL | fn angle Foo>() { | ^^^^^^^^^^^^ error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-in-binding-only.rs:27:37 + --> $DIR/bound-lifetime-in-binding-only.rs:17:37 | LL | fn angle1() where T: for<'a> Foo { | ^^^^^^^^^^^^ error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-in-binding-only.rs:32:37 + --> $DIR/bound-lifetime-in-binding-only.rs:22:37 | LL | fn angle2() where for<'a> T: Foo { | ^^^^^^^^^^^^ error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-in-binding-only.rs:37:27 + --> $DIR/bound-lifetime-in-binding-only.rs:27:27 | LL | fn angle3(_: &for<'a> Foo) { | ^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.elision.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.elision.stderr index 6b9d4ebb298..2745e44ac0c 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.elision.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.elision.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/bound-lifetime-in-binding-only.rs:62:23 + --> $DIR/bound-lifetime-in-binding-only.rs:52:23 | LL | fn elision &i32>() { | ^ help: consider giving it a 'static lifetime: `&'static` diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr index 53594cb83fc..3a5ff9d7956 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/bound-lifetime-in-binding-only.rs:81:1 + --> $DIR/bound-lifetime-in-binding-only.rs:71:1 | LL | fn main() { } //[ok]~ ERROR compilation successful | ^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr index 39a5366080b..8c9480027e6 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr @@ -1,23 +1,23 @@ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-in-binding-only.rs:42:29 + --> $DIR/bound-lifetime-in-binding-only.rs:32:29 | LL | fn paren Fn() -> &'a i32>() { | ^^^^^^^ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-in-binding-only.rs:47:41 + --> $DIR/bound-lifetime-in-binding-only.rs:37:41 | LL | fn paren1() where T: for<'a> Fn() -> &'a i32 { | ^^^^^^^ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-in-binding-only.rs:52:41 + --> $DIR/bound-lifetime-in-binding-only.rs:42:41 | LL | fn paren2() where for<'a> T: Fn() -> &'a i32 { | ^^^^^^^ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/bound-lifetime-in-binding-only.rs:57:31 + --> $DIR/bound-lifetime-in-binding-only.rs:47:31 | LL | fn paren3(_: &for<'a> Fn() -> &'a i32) { | ^^^^^^^ diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs b/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs index 7cb0623315e..e1989d35bbb 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: angle paren ok elision #![allow(dead_code)] diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.elision.stderr b/src/test/ui/associated-types/bound-lifetime-in-return-only.elision.stderr index 7906f0a30e4..96f0cb85c8c 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-return-only.elision.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.elision.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/bound-lifetime-in-return-only.rs:44:23 + --> $DIR/bound-lifetime-in-return-only.rs:34:23 | LL | fn elision(_: fn() -> &i32) { | ^ help: consider giving it a 'static lifetime: `&'static` diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.local.stderr b/src/test/ui/associated-types/bound-lifetime-in-return-only.local.stderr index ce2cfa6765d..788cf667c8d 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-return-only.local.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.local.stderr @@ -1,5 +1,5 @@ error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types - --> $DIR/bound-lifetime-in-return-only.rs:33:28 + --> $DIR/bound-lifetime-in-return-only.rs:23:28 | LL | let _: for<'a> fn() -> &'a i32 = loop { }; | ^^^^^^^ diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.ok.stderr b/src/test/ui/associated-types/bound-lifetime-in-return-only.ok.stderr index 21bef7e5e52..650383b531c 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-return-only.ok.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.ok.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/bound-lifetime-in-return-only.rs:59:1 + --> $DIR/bound-lifetime-in-return-only.rs:49:1 | LL | fn main() { } //[ok]~ ERROR compilation successful | ^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.rs b/src/test/ui/associated-types/bound-lifetime-in-return-only.rs index b9b1317cef5..5a7e086fd47 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-return-only.rs +++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: sig local structure ok elision #![allow(dead_code)] diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.sig.stderr b/src/test/ui/associated-types/bound-lifetime-in-return-only.sig.stderr index 26a1585463a..64dad461999 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-return-only.sig.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.sig.stderr @@ -1,11 +1,11 @@ error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types - --> $DIR/bound-lifetime-in-return-only.rs:22:28 + --> $DIR/bound-lifetime-in-return-only.rs:12:28 | LL | fn sig1(_: for<'a> fn() -> &'a i32) { | ^^^^^^^ error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types - --> $DIR/bound-lifetime-in-return-only.rs:27:39 + --> $DIR/bound-lifetime-in-return-only.rs:17:39 | LL | fn sig2(_: for<'a, 'b> fn(&'b i32) -> &'a i32) { | ^^^^^^^ diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.structure.stderr b/src/test/ui/associated-types/bound-lifetime-in-return-only.structure.stderr index db52e4de69b..f7833500d00 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-return-only.structure.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.structure.stderr @@ -1,5 +1,5 @@ error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types - --> $DIR/bound-lifetime-in-return-only.rs:39:24 + --> $DIR/bound-lifetime-in-return-only.rs:29:24 | LL | x: for<'a> fn() -> &'a i32 | ^^^^^^^ diff --git a/src/test/ui/associated-types/cache/chrono-scan.rs b/src/test/ui/associated-types/cache/chrono-scan.rs index c4b8164522c..00d47c92a37 100644 --- a/src/test/ui/associated-types/cache/chrono-scan.rs +++ b/src/test/ui/associated-types/cache/chrono-scan.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(warnings)] diff --git a/src/test/ui/associated-types/cache/elision.rs b/src/test/ui/associated-types/cache/elision.rs index 01bf25ba993..2b49cd33ba0 100644 --- a/src/test/ui/associated-types/cache/elision.rs +++ b/src/test/ui/associated-types/cache/elision.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(warnings)] diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.stderr index 6cecf68ffff..0fed413f144 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.stderr @@ -1,23 +1,23 @@ error[E0623]: lifetime mismatch - --> $DIR/project-fn-ret-contravariant.rs:55:5 + --> $DIR/project-fn-ret-contravariant.rs:45:5 | LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { | ------- ------------------ | | | this parameter and the return type are declared with different lifetimes... ... -LL | (a, b) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623] +LL | (a, b) //[krisskross]~ ERROR lifetime mismatch [E0623] | ^ ...but data from `y` is returned here error[E0623]: lifetime mismatch - --> $DIR/project-fn-ret-contravariant.rs:55:8 + --> $DIR/project-fn-ret-contravariant.rs:45:8 | LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { | ------- ------------------ | | | this parameter and the return type are declared with different lifetimes... ... -LL | (a, b) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623] +LL | (a, b) //[krisskross]~ ERROR lifetime mismatch [E0623] | ^ ...but data from `x` is returned here error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.ok.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.ok.stderr index c92aa37a60f..15bbea671c5 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.ok.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.ok.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/project-fn-ret-contravariant.rs:60:1 + --> $DIR/project-fn-ret-contravariant.rs:50:1 | LL | fn main() { } | ^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.oneuse.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.oneuse.stderr index c92aa37a60f..15bbea671c5 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.oneuse.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.oneuse.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/project-fn-ret-contravariant.rs:60:1 + --> $DIR/project-fn-ret-contravariant.rs:50:1 | LL | fn main() { } | ^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.rs b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.rs index a5e8f4068e6..d953325df23 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.rs +++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] #![feature(rustc_attrs)] @@ -52,8 +42,8 @@ fn baz<'a,'b>(x: &'a u32) -> &'static u32 { fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { let a = bar(foo, y); let b = bar(foo, x); - (a, b) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623] - //[krisskross]~^ ERROR 55:8: 55:9: lifetime mismatch [E0623] + (a, b) //[krisskross]~ ERROR lifetime mismatch [E0623] + //[krisskross]~^ ERROR lifetime mismatch [E0623] } #[rustc_error] diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.stderr index 9d42c8e3c63..ab148365c91 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.stderr @@ -1,22 +1,22 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/project-fn-ret-contravariant.rs:48:8 + --> $DIR/project-fn-ret-contravariant.rs:38:8 | LL | bar(foo, x) //[transmute]~ ERROR E0495 | ^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 47:8... - --> $DIR/project-fn-ret-contravariant.rs:47:8 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 37:8... + --> $DIR/project-fn-ret-contravariant.rs:37:8 | LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/project-fn-ret-contravariant.rs:48:13 + --> $DIR/project-fn-ret-contravariant.rs:38:13 | LL | bar(foo, x) //[transmute]~ ERROR E0495 | ^ = note: but, the lifetime must be valid for the static lifetime... note: ...so that reference does not outlive borrowed content - --> $DIR/project-fn-ret-contravariant.rs:48:4 + --> $DIR/project-fn-ret-contravariant.rs:38:4 | LL | bar(foo, x) //[transmute]~ ERROR E0495 | ^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.stderr index e867ac4baac..46901b44c4b 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/project-fn-ret-invariant.rs:63:21 + --> $DIR/project-fn-ret-invariant.rs:53:21 | LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { | -------- -------------------- @@ -9,7 +9,7 @@ LL | let a = bar(foo, y); //[krisskross]~ ERROR E0623 | ^ ...but data from `x` is returned here error[E0623]: lifetime mismatch - --> $DIR/project-fn-ret-invariant.rs:65:8 + --> $DIR/project-fn-ret-invariant.rs:55:8 | LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { | -------- -------------------- diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.ok.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.ok.stderr index e3e620ea3a0..8110ed40cfe 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.ok.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.ok.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/project-fn-ret-invariant.rs:69:1 + --> $DIR/project-fn-ret-invariant.rs:59:1 | LL | fn main() { } | ^^^^^^^^^^^^^ diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr index 7c86e20fe64..6b78d66a2d4 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr @@ -1,12 +1,12 @@ error[E0623]: lifetime mismatch - --> $DIR/project-fn-ret-invariant.rs:49:19 + --> $DIR/project-fn-ret-invariant.rs:39:19 | LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { | -------- -------------------- | | | this parameter and the return type are declared with different lifetimes... ... -LL | let b = bar(f, y); //[oneuse]~ ERROR 49:19: 49:20: lifetime mismatch [E0623] +LL | let b = bar(f, y); //[oneuse]~ ERROR lifetime mismatch [E0623] | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.rs b/src/test/ui/associated-types/cache/project-fn-ret-invariant.rs index 6e4bdd4b21c..dfcf31b3b1f 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.rs +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] #![feature(rustc_attrs)] @@ -46,7 +36,7 @@ fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) { let f = foo; // <-- No consistent type can be inferred for `f` here. let a = bar(f, x); - let b = bar(f, y); //[oneuse]~ ERROR 49:19: 49:20: lifetime mismatch [E0623] + let b = bar(f, y); //[oneuse]~ ERROR lifetime mismatch [E0623] (a, b) } diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr index 6432ab9e57d..947844c45c4 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr @@ -1,11 +1,11 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/project-fn-ret-invariant.rs:58:8 + --> $DIR/project-fn-ret-invariant.rs:48:8 | LL | bar(foo, x) //[transmute]~ ERROR E0495 | ^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 54:8... - --> $DIR/project-fn-ret-invariant.rs:54:8 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 44:8... + --> $DIR/project-fn-ret-invariant.rs:44:8 | LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> { | ^^ diff --git a/src/test/ui/associated-types/higher-ranked-projection.bad.stderr b/src/test/ui/associated-types/higher-ranked-projection.bad.stderr index 1351d14fe00..3bbf48cb37f 100644 --- a/src/test/ui/associated-types/higher-ranked-projection.bad.stderr +++ b/src/test/ui/associated-types/higher-ranked-projection.bad.stderr @@ -1,17 +1,12 @@ -error[E0271]: type mismatch resolving `for<'a> <&'a _ as Mirror>::Image == _` - --> $DIR/higher-ranked-projection.rs:35:5 +error: implementation of `Mirror` is not general enough + --> $DIR/higher-ranked-projection.rs:25:5 | LL | foo(()); - | ^^^ expected bound lifetime parameter 'a, found concrete lifetime + | ^^^ | -note: required by `foo` - --> $DIR/higher-ranked-projection.rs:24:1 - | -LL | / fn foo(_t: T) -LL | | where for<'a> &'a T: Mirror -LL | | {} - | |__^ + = note: Due to a where-clause on `foo`, + = note: `Mirror` would have to be implemented for the type `&'0 ()`, for any lifetime `'0` + = note: but `Mirror` is actually implemented for the type `&'1 ()`, for some specific lifetime `'1` error: aborting due to previous error -For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/associated-types/higher-ranked-projection.good.stderr b/src/test/ui/associated-types/higher-ranked-projection.good.stderr index 861827f329b..c5c8451a5a9 100644 --- a/src/test/ui/associated-types/higher-ranked-projection.good.stderr +++ b/src/test/ui/associated-types/higher-ranked-projection.good.stderr @@ -1,10 +1,9 @@ error: compilation successful - --> $DIR/higher-ranked-projection.rs:34:1 + --> $DIR/higher-ranked-projection.rs:24:1 | LL | / fn main() { //[good]~ ERROR compilation successful LL | | foo(()); -LL | | //[bad]~^ ERROR type mismatch resolving `for<'a> <&'a _ as Mirror>::Image == _` -LL | | //[bad]~| expected bound lifetime parameter 'a, found concrete lifetime +LL | | //[bad]~^ ERROR not general enough LL | | } | |_^ diff --git a/src/test/ui/associated-types/higher-ranked-projection.rs b/src/test/ui/associated-types/higher-ranked-projection.rs index 12341fa8db3..1280c8cb4cb 100644 --- a/src/test/ui/associated-types/higher-ranked-projection.rs +++ b/src/test/ui/associated-types/higher-ranked-projection.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] // revisions: good bad @@ -33,6 +23,5 @@ fn foo(_t: T) #[rustc_error] fn main() { //[good]~ ERROR compilation successful foo(()); - //[bad]~^ ERROR type mismatch resolving `for<'a> <&'a _ as Mirror>::Image == _` - //[bad]~| expected bound lifetime parameter 'a, found concrete lifetime + //[bad]~^ ERROR not general enough } diff --git a/src/test/ui/associated-types/issue-36499.rs b/src/test/ui/associated-types/issue-36499.rs index b5b3ecbb580..7f8f13ef8d4 100644 --- a/src/test/ui/associated-types/issue-36499.rs +++ b/src/test/ui/associated-types/issue-36499.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: aborting due to previous error fn main() { diff --git a/src/test/ui/associated-types/issue-36499.stderr b/src/test/ui/associated-types/issue-36499.stderr index 5167c47a6cf..ff450f60acc 100644 --- a/src/test/ui/associated-types/issue-36499.stderr +++ b/src/test/ui/associated-types/issue-36499.stderr @@ -1,5 +1,5 @@ error: expected expression, found `+` - --> $DIR/issue-36499.rs:14:9 + --> $DIR/issue-36499.rs:4:9 | LL | 2 + +2; | ^ expected expression diff --git a/src/test/ui/async-fn-multiple-lifetimes.rs b/src/test/ui/async-fn-multiple-lifetimes.rs index aab4974e2e7..6156617c4da 100644 --- a/src/test/ui/async-fn-multiple-lifetimes.rs +++ b/src/test/ui/async-fn-multiple-lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 #![feature(arbitrary_self_types, async_await, await_macro, futures_api, pin)] diff --git a/src/test/ui/async-fn-multiple-lifetimes.stderr b/src/test/ui/async-fn-multiple-lifetimes.stderr index 1d34673a005..071349b23fa 100644 --- a/src/test/ui/async-fn-multiple-lifetimes.stderr +++ b/src/test/ui/async-fn-multiple-lifetimes.stderr @@ -1,5 +1,5 @@ error[E0709]: multiple different lifetimes used in arguments of `async fn` - --> $DIR/async-fn-multiple-lifetimes.rs:17:47 + --> $DIR/async-fn-multiple-lifetimes.rs:7:47 | LL | async fn multiple_named_lifetimes<'a, 'b>(_: &'a u8, _: &'b u8) {} | ^^ ^^ different lifetime here @@ -9,7 +9,7 @@ LL | async fn multiple_named_lifetimes<'a, 'b>(_: &'a u8, _: &'b u8) {} = help: `async fn` can only accept borrowed values with identical lifetimes error[E0707]: multiple elided lifetimes used in arguments of `async fn` - --> $DIR/async-fn-multiple-lifetimes.rs:26:39 + --> $DIR/async-fn-multiple-lifetimes.rs:16:39 | LL | async fn multiple_elided_lifetimes(_: &u8, _: &u8) {} | ^ ^ different lifetime here @@ -19,7 +19,7 @@ LL | async fn multiple_elided_lifetimes(_: &u8, _: &u8) {} = help: consider giving these arguments named lifetimes error[E0106]: missing lifetime specifier - --> $DIR/async-fn-multiple-lifetimes.rs:26:39 + --> $DIR/async-fn-multiple-lifetimes.rs:16:39 | LL | async fn multiple_elided_lifetimes(_: &u8, _: &u8) {} | ^ expected lifetime parameter diff --git a/src/test/ui/async-matches-expr.rs b/src/test/ui/async-matches-expr.rs index d6959f9ddd8..f375d58d984 100644 --- a/src/test/ui/async-matches-expr.rs +++ b/src/test/ui/async-matches-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // edition:2018 diff --git a/src/test/ui/attempted-access-non-fatal.rs b/src/test/ui/attempted-access-non-fatal.rs index 3d6c46f5ce3..e50c1f23c51 100644 --- a/src/test/ui/attempted-access-non-fatal.rs +++ b/src/test/ui/attempted-access-non-fatal.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that bogus field access is non-fatal fn main() { let x = 0; diff --git a/src/test/ui/attempted-access-non-fatal.stderr b/src/test/ui/attempted-access-non-fatal.stderr index d056a3eff6f..2fee49acdf4 100644 --- a/src/test/ui/attempted-access-non-fatal.stderr +++ b/src/test/ui/attempted-access-non-fatal.stderr @@ -1,11 +1,11 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields - --> $DIR/attempted-access-non-fatal.rs:14:15 + --> $DIR/attempted-access-non-fatal.rs:4:15 | LL | let _ = x.foo; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] | ^^^ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields - --> $DIR/attempted-access-non-fatal.rs:15:15 + --> $DIR/attempted-access-non-fatal.rs:5:15 | LL | let _ = x.bar; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] | ^^^ diff --git a/src/test/ui/attr-bad-crate-attr.rc b/src/test/ui/attr-bad-crate-attr.rc index 4ab07f4fa99..89ba26dfd6f 100644 --- a/src/test/ui/attr-bad-crate-attr.rc +++ b/src/test/ui/attr-bad-crate-attr.rc @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: expected item #![attr = "val"] diff --git a/src/test/ui/attr-eq-token-tree.rs b/src/test/ui/attr-eq-token-tree.rs index c759e62dba0..f28f76db938 100644 --- a/src/test/ui/attr-eq-token-tree.rs +++ b/src/test/ui/attr-eq-token-tree.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(custom_attribute, unrestricted_attribute_tokens)] diff --git a/src/test/ui/attr-usage-inline.rs b/src/test/ui/attr-usage-inline.rs index 250905dbdcd..1996f4a692c 100644 --- a/src/test/ui/attr-usage-inline.rs +++ b/src/test/ui/attr-usage-inline.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #[inline] diff --git a/src/test/ui/attr-usage-inline.stderr b/src/test/ui/attr-usage-inline.stderr index 171bd949e10..3030a2f8f1d 100644 --- a/src/test/ui/attr-usage-inline.stderr +++ b/src/test/ui/attr-usage-inline.stderr @@ -1,5 +1,5 @@ error[E0518]: attribute should be applied to function or closure - --> $DIR/attr-usage-inline.rs:16:1 + --> $DIR/attr-usage-inline.rs:6:1 | LL | #[inline] //~ ERROR: attribute should be applied to function or closure | ^^^^^^^^^ diff --git a/src/test/ui/attr-usage-repr.rs b/src/test/ui/attr-usage-repr.rs index 43790700877..498bf4d284a 100644 --- a/src/test/ui/attr-usage-repr.rs +++ b/src/test/ui/attr-usage-repr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd)] #[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union diff --git a/src/test/ui/attr-usage-repr.stderr b/src/test/ui/attr-usage-repr.stderr index 8d5e49a81f0..990984bbb2b 100644 --- a/src/test/ui/attr-usage-repr.stderr +++ b/src/test/ui/attr-usage-repr.stderr @@ -1,5 +1,5 @@ error[E0517]: attribute should be applied to struct, enum or union - --> $DIR/attr-usage-repr.rs:13:8 + --> $DIR/attr-usage-repr.rs:3:8 | LL | #[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union | ^ @@ -7,7 +7,7 @@ LL | fn f() {} | --------- not a struct, enum or union error[E0517]: attribute should be applied to enum - --> $DIR/attr-usage-repr.rs:25:8 + --> $DIR/attr-usage-repr.rs:15:8 | LL | #[repr(i8)] //~ ERROR: attribute should be applied to enum | ^^ @@ -15,7 +15,7 @@ LL | struct SInt(f64, f64); | ---------------------- not an enum error[E0517]: attribute should be applied to struct or union - --> $DIR/attr-usage-repr.rs:31:8 + --> $DIR/attr-usage-repr.rs:21:8 | LL | #[repr(align(8))] //~ ERROR: attribute should be applied to struct | ^^^^^^^^ @@ -23,7 +23,7 @@ LL | enum EAlign { A, B } | -------------------- not a struct or union error[E0517]: attribute should be applied to struct or union - --> $DIR/attr-usage-repr.rs:34:8 + --> $DIR/attr-usage-repr.rs:24:8 | LL | #[repr(packed)] //~ ERROR: attribute should be applied to struct | ^^^^^^ @@ -31,7 +31,7 @@ LL | enum EPacked { A, B } | --------------------- not a struct or union error[E0517]: attribute should be applied to struct - --> $DIR/attr-usage-repr.rs:37:8 + --> $DIR/attr-usage-repr.rs:27:8 | LL | #[repr(simd)] //~ ERROR: attribute should be applied to struct | ^^^^ diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs index ec7885f1f44..d7feb038530 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test checks variations on `<#[attr] 'a, #[oops]>`, where // `#[oops]` is left dangling (that is, it is unattached, with no // formal binding following it). diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr index afab999b02e..c4c0cee5ccc 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr @@ -1,8 +1,8 @@ error: trailing attribute after lifetime parameters - --> $DIR/attrs-with-no-formal-in-generics-1.rs:19:25 + --> $DIR/attrs-with-no-formal-in-generics-1.rs:9:25 | LL | impl<#[rustc_1] 'a, 'b, #[oops]> RefIntPair<'a, 'b> { - | ^^^^^^^ + | ^^^^^^^ attributes must go before parameters error: aborting due to previous error diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs index efe2d5561a8..f9db6a5f72a 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test checks variations on `<#[attr] 'a, #[oops]>`, where // `#[oops]` is left dangling (that is, it is unattached, with no // formal binding following it). diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr index 8bff45ea989..9099d74ce1b 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr @@ -1,8 +1,8 @@ error: trailing attribute after type parameters - --> $DIR/attrs-with-no-formal-in-generics-2.rs:19:35 + --> $DIR/attrs-with-no-formal-in-generics-2.rs:9:35 | LL | impl<#[rustc_1] 'a, #[rustc_2] T, #[oops]> RefAny<'a, T> {} - | ^^^^^^^ + | ^^^^^^^ attributes must go before parameters error: aborting due to previous error diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs index e7d5b94d242..e9f908d479f 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test checks variations on `<#[attr] 'a, #[oops]>`, where // `#[oops]` is left dangling (that is, it is unattached, with no // formal binding following it). @@ -15,12 +5,8 @@ struct RefIntPair<'a, 'b>(&'a u32, &'b u32); fn hof_lt(_: Q) - where Q: for <#[rustc_1] 'a, 'b, #[oops]> Fn(RefIntPair<'a,'b>) -> &'b u32 + where Q: for <#[allow(unused)] 'a, 'b, #[oops]> Fn(RefIntPair<'a,'b>) -> &'b u32 //~^ ERROR trailing attribute after lifetime parameters -{ - -} - -fn main() { +{} -} +fn main() {} diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr index 351c788f84f..452f0ea5e17 100644 --- a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr +++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr @@ -1,8 +1,8 @@ error: trailing attribute after lifetime parameters - --> $DIR/attrs-with-no-formal-in-generics-3.rs:18:38 + --> $DIR/attrs-with-no-formal-in-generics-3.rs:8:44 | -LL | where Q: for <#[rustc_1] 'a, 'b, #[oops]> Fn(RefIntPair<'a,'b>) -> &'b u32 - | ^^^^^^^ +LL | where Q: for <#[allow(unused)] 'a, 'b, #[oops]> Fn(RefIntPair<'a,'b>) -> &'b u32 + | ^^^^^^^ attributes must go before parameters error: aborting due to previous error diff --git a/src/test/ui/augmented-assignments.nll.stderr b/src/test/ui/augmented-assignments.nll.stderr index 64ac6883087..840b377263d 100644 --- a/src/test/ui/augmented-assignments.nll.stderr +++ b/src/test/ui/augmented-assignments.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/augmented-assignments.rs:26:5 + --> $DIR/augmented-assignments.rs:16:5 | LL | x //~ error: use of moved value: `x` | - @@ -15,7 +15,7 @@ LL | | x; //~ value moved here | borrow later used here error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable - --> $DIR/augmented-assignments.rs:31:5 + --> $DIR/augmented-assignments.rs:21:5 | LL | let y = Int(2); | - help: consider changing this to be mutable: `mut y` diff --git a/src/test/ui/augmented-assignments.rs b/src/test/ui/augmented-assignments.rs index 2857ff2554a..eea15eae879 100644 --- a/src/test/ui/augmented-assignments.rs +++ b/src/test/ui/augmented-assignments.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::AddAssign; struct Int(i32); diff --git a/src/test/ui/augmented-assignments.stderr b/src/test/ui/augmented-assignments.stderr index a7f3328071e..73de315e542 100644 --- a/src/test/ui/augmented-assignments.stderr +++ b/src/test/ui/augmented-assignments.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `y` as mutable - --> $DIR/augmented-assignments.rs:31:5 + --> $DIR/augmented-assignments.rs:21:5 | LL | let y = Int(2); | - help: make this binding mutable: `mut y` @@ -8,7 +8,7 @@ LL | y //~ error: cannot borrow immutable local variable `y` as mutable | ^ cannot borrow mutably error[E0382]: use of moved value: `x` - --> $DIR/augmented-assignments.rs:23:5 + --> $DIR/augmented-assignments.rs:13:5 | LL | x //~ error: use of moved value: `x` | ^ value used here after move diff --git a/src/test/ui/auto-ref-slice-plus-ref.rs b/src/test/ui/auto-ref-slice-plus-ref.rs index 324e9259647..00b279d3226 100644 --- a/src/test/ui/auto-ref-slice-plus-ref.rs +++ b/src/test/ui/auto-ref-slice-plus-ref.rs @@ -1,14 +1,3 @@ -// Copyright 2012-14 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn main() { // Testing that method lookup does not automatically borrow diff --git a/src/test/ui/auto-ref-slice-plus-ref.stderr b/src/test/ui/auto-ref-slice-plus-ref.stderr index f62ac84a185..356e24d18a7 100644 --- a/src/test/ui/auto-ref-slice-plus-ref.stderr +++ b/src/test/ui/auto-ref-slice-plus-ref.stderr @@ -1,16 +1,15 @@ error[E0599]: no method named `test_mut` found for type `std::vec::Vec<{integer}>` in the current scope - --> $DIR/auto-ref-slice-plus-ref.rs:18:7 + --> $DIR/auto-ref-slice-plus-ref.rs:7:7 | LL | a.test_mut(); //~ ERROR no method named `test_mut` found - | ^^^^^^^^ + | ^^^^^^^^ help: did you mean: `get_mut` | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `test_mut`, perhaps you need to implement it: candidate #1: `MyIter` - = help: did you mean `get_mut`? error[E0599]: no method named `test` found for type `std::vec::Vec<{integer}>` in the current scope - --> $DIR/auto-ref-slice-plus-ref.rs:19:7 + --> $DIR/auto-ref-slice-plus-ref.rs:8:7 | LL | a.test(); //~ ERROR no method named `test` found | ^^^^ @@ -20,7 +19,7 @@ LL | a.test(); //~ ERROR no method named `test` found candidate #1: `MyIter` error[E0599]: no method named `test` found for type `[{integer}; 1]` in the current scope - --> $DIR/auto-ref-slice-plus-ref.rs:21:11 + --> $DIR/auto-ref-slice-plus-ref.rs:10:11 | LL | ([1]).test(); //~ ERROR no method named `test` found | ^^^^ @@ -30,7 +29,7 @@ LL | ([1]).test(); //~ ERROR no method named `test` found candidate #1: `MyIter` error[E0599]: no method named `test` found for type `&[{integer}; 1]` in the current scope - --> $DIR/auto-ref-slice-plus-ref.rs:22:12 + --> $DIR/auto-ref-slice-plus-ref.rs:11:12 | LL | (&[1]).test(); //~ ERROR no method named `test` found | ^^^^ diff --git a/src/test/ui/auto-trait-validation.rs b/src/test/ui/auto-trait-validation.rs index 92b222e1322..34d6c3da00e 100644 --- a/src/test/ui/auto-trait-validation.rs +++ b/src/test/ui/auto-trait-validation.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] auto trait Generic {} diff --git a/src/test/ui/auto-trait-validation.stderr b/src/test/ui/auto-trait-validation.stderr index a6bd887021e..e077982069e 100644 --- a/src/test/ui/auto-trait-validation.stderr +++ b/src/test/ui/auto-trait-validation.stderr @@ -1,17 +1,17 @@ error[E0567]: auto traits cannot have generic parameters - --> $DIR/auto-trait-validation.rs:13:1 + --> $DIR/auto-trait-validation.rs:3:1 | LL | auto trait Generic {} | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0568]: auto traits cannot have super traits - --> $DIR/auto-trait-validation.rs:15:1 + --> $DIR/auto-trait-validation.rs:5:1 | LL | auto trait Bound : Copy {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0380]: auto traits cannot have methods or associated items - --> $DIR/auto-trait-validation.rs:17:1 + --> $DIR/auto-trait-validation.rs:7:1 | LL | auto trait MyTrait { fn foo() {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/autoderef-full-lval.rs b/src/test/ui/autoderef-full-lval.rs index c152fdd9296..db09d036ad3 100644 --- a/src/test/ui/autoderef-full-lval.rs +++ b/src/test/ui/autoderef-full-lval.rs @@ -1,33 +1,23 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] -struct clam { +struct Clam { x: Box, y: Box, } -struct fish { +struct Fish { a: Box, } fn main() { - let a: clam = clam{x: box 1, y: box 2}; - let b: clam = clam{x: box 10, y: box 20}; + let a: Clam = Clam{x: box 1, y: box 2}; + let b: Clam = Clam{x: box 10, y: box 20}; let z: isize = a.x + b.y; //~^ ERROR binary operation `+` cannot be applied to type `std::boxed::Box` println!("{}", z); assert_eq!(z, 21); - let forty: fish = fish{a: box 40}; - let two: fish = fish{a: box 2}; + let forty: Fish = Fish{a: box 40}; + let two: Fish = Fish{a: box 2}; let answer: isize = forty.a + two.a; //~^ ERROR binary operation `+` cannot be applied to type `std::boxed::Box` println!("{}", answer); diff --git a/src/test/ui/autoderef-full-lval.stderr b/src/test/ui/autoderef-full-lval.stderr index df8eeb5d171..b92259b69df 100644 --- a/src/test/ui/autoderef-full-lval.stderr +++ b/src/test/ui/autoderef-full-lval.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `+` cannot be applied to type `std::boxed::Box` - --> $DIR/autoderef-full-lval.rs:25:20 + --> $DIR/autoderef-full-lval.rs:15:20 | LL | let z: isize = a.x + b.y; | ^^^^^^^^^ @@ -7,7 +7,7 @@ LL | let z: isize = a.x + b.y; = note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box` error[E0369]: binary operation `+` cannot be applied to type `std::boxed::Box` - --> $DIR/autoderef-full-lval.rs:31:25 + --> $DIR/autoderef-full-lval.rs:21:25 | LL | let answer: isize = forty.a + two.a; | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/auxiliary/cdylib-dep.rs b/src/test/ui/auxiliary/cdylib-dep.rs index a3d0222a14c..8bd2b3353b8 100644 --- a/src/test/ui/auxiliary/cdylib-dep.rs +++ b/src/test/ui/auxiliary/cdylib-dep.rs @@ -1,11 +1 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] diff --git a/src/test/ui/auxiliary/changing-crates-a1.rs b/src/test/ui/auxiliary/changing-crates-a1.rs index 18162c5f756..bc0559b8b80 100644 --- a/src/test/ui/auxiliary/changing-crates-a1.rs +++ b/src/test/ui/auxiliary/changing-crates-a1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "a"] pub fn foo() {} diff --git a/src/test/ui/auxiliary/changing-crates-a2.rs b/src/test/ui/auxiliary/changing-crates-a2.rs index 28eae023d68..fafc6d5b169 100644 --- a/src/test/ui/auxiliary/changing-crates-a2.rs +++ b/src/test/ui/auxiliary/changing-crates-a2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "a"] pub fn foo() { println!("hello!"); } diff --git a/src/test/ui/auxiliary/changing-crates-b.rs b/src/test/ui/auxiliary/changing-crates-b.rs index 7b1190fc085..f9ce29e4c4c 100644 --- a/src/test/ui/auxiliary/changing-crates-b.rs +++ b/src/test/ui/auxiliary/changing-crates-b.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "b"] extern crate a; diff --git a/src/test/ui/auxiliary/default_ty_param_cross_crate_crate.rs b/src/test/ui/auxiliary/default_ty_param_cross_crate_crate.rs index 4bd8ecacb96..612f99dbcf8 100644 --- a/src/test/ui/auxiliary/default_ty_param_cross_crate_crate.rs +++ b/src/test/ui/auxiliary/default_ty_param_cross_crate_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #![crate_name = "default_param_test"] #![feature(default_type_parameter_fallback)] diff --git a/src/test/ui/auxiliary/define_macro.rs b/src/test/ui/auxiliary/define_macro.rs index 6b6b14a896b..4956907c55e 100644 --- a/src/test/ui/auxiliary/define_macro.rs +++ b/src/test/ui/auxiliary/define_macro.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! define_macro { ($i:ident) => { diff --git a/src/test/ui/auxiliary/empty-struct.rs b/src/test/ui/auxiliary/empty-struct.rs index 4a302865634..3fb40f6bfa9 100644 --- a/src/test/ui/auxiliary/empty-struct.rs +++ b/src/test/ui/auxiliary/empty-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct XEmpty1 {} pub struct XEmpty2; pub struct XEmpty6(); diff --git a/src/test/ui/auxiliary/extern-statics.rs b/src/test/ui/auxiliary/extern-statics.rs index 07f70b177b3..725fde518d8 100644 --- a/src/test/ui/auxiliary/extern-statics.rs +++ b/src/test/ui/auxiliary/extern-statics.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { pub static XA: u8; pub static mut XB: u8; diff --git a/src/test/ui/auxiliary/lto-duplicate-symbols1.rs b/src/test/ui/auxiliary/lto-duplicate-symbols1.rs index ea09327bd19..9d510f2626f 100644 --- a/src/test/ui/auxiliary/lto-duplicate-symbols1.rs +++ b/src/test/ui/auxiliary/lto-duplicate-symbols1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/ui/auxiliary/lto-duplicate-symbols2.rs b/src/test/ui/auxiliary/lto-duplicate-symbols2.rs index ea09327bd19..9d510f2626f 100644 --- a/src/test/ui/auxiliary/lto-duplicate-symbols2.rs +++ b/src/test/ui/auxiliary/lto-duplicate-symbols2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/ui/auxiliary/noexporttypelib.rs b/src/test/ui/auxiliary/noexporttypelib.rs index 5ae8e0d298e..67889cc5f65 100644 --- a/src/test/ui/auxiliary/noexporttypelib.rs +++ b/src/test/ui/auxiliary/noexporttypelib.rs @@ -1,12 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub type oint = Option; pub fn foo() -> oint { Some(3) } diff --git a/src/test/ui/auxiliary/orphan_check_diagnostics.rs b/src/test/ui/auxiliary/orphan_check_diagnostics.rs index cf3e9903b5a..6b2c42b69b9 100644 --- a/src/test/ui/auxiliary/orphan_check_diagnostics.rs +++ b/src/test/ui/auxiliary/orphan_check_diagnostics.rs @@ -1,11 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait RemoteTrait { fn dummy(&self) { } } diff --git a/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs b/src/test/ui/auxiliary/pub_and_stability.rs similarity index 91% rename from src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs rename to src/test/ui/auxiliary/pub_and_stability.rs index f46d906d865..ee05a07dbb2 100644 --- a/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs +++ b/src/test/ui/auxiliary/pub_and_stability.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This crate attempts to enumerate the various scenarios for how a // type can define fields and methods with various visibilities and // stabilities. diff --git a/src/test/ui/auxiliary/removing-extern-crate.rs b/src/test/ui/auxiliary/removing-extern-crate.rs index 4275e80e7fe..65e2cc34045 100644 --- a/src/test/ui/auxiliary/removing-extern-crate.rs +++ b/src/test/ui/auxiliary/removing-extern-crate.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // intentionally blank diff --git a/src/test/ui/auxiliary/rmeta_meta.rs b/src/test/ui/auxiliary/rmeta_meta.rs index 4207fc2373b..6d8ed95bd38 100644 --- a/src/test/ui/auxiliary/rmeta_meta.rs +++ b/src/test/ui/auxiliary/rmeta_meta.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // compile-flags: --emit=metadata diff --git a/src/test/ui/auxiliary/rmeta_rlib.rs b/src/test/ui/auxiliary/rmeta_rlib.rs index 6096c4df05b..4a05710db66 100644 --- a/src/test/ui/auxiliary/rmeta_rlib.rs +++ b/src/test/ui/auxiliary/rmeta_rlib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="rlib"] pub struct Foo { diff --git a/src/test/ui/auxiliary/stability_cfg2.rs b/src/test/ui/auxiliary/stability_cfg2.rs index a59f4b4e8f4..8a2899584b9 100644 --- a/src/test/ui/auxiliary/stability_cfg2.rs +++ b/src/test/ui/auxiliary/stability_cfg2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--cfg foo #![cfg_attr(foo, unstable(feature = "unstable_test_feature", issue = "0"))] diff --git a/src/test/ui/auxiliary/use_from_trait_xc.rs b/src/test/ui/auxiliary/use_from_trait_xc.rs new file mode 100644 index 00000000000..4abe11941b1 --- /dev/null +++ b/src/test/ui/auxiliary/use_from_trait_xc.rs @@ -0,0 +1,29 @@ +pub use self::sub::{Bar, Baz}; + +pub trait Trait { + fn foo(&self); + type Assoc; + const CONST: u32; +} + +struct Foo; + +impl Foo { + pub fn new() {} + + pub const C: u32 = 0; +} + +mod sub { + pub struct Bar; + + impl Bar { + pub fn new() {} + } + + pub enum Baz {} + + impl Baz { + pub fn new() {} + } +} diff --git a/src/test/ui/auxiliary/weak-lang-items.rs b/src/test/ui/auxiliary/weak-lang-items.rs index 6434e62b6f7..7a698cf76ae 100644 --- a/src/test/ui/auxiliary/weak-lang-items.rs +++ b/src/test/ui/auxiliary/weak-lang-items.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // This aux-file will require the eh_personality function to be codegen'd, but diff --git a/src/test/ui/auxiliary/xc_private_method_lib.rs b/src/test/ui/auxiliary/xc_private_method_lib.rs index 5e7bc61943b..4d5ec6de392 100644 --- a/src/test/ui/auxiliary/xc_private_method_lib.rs +++ b/src/test/ui/auxiliary/xc_private_method_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub struct Struct { diff --git a/src/test/ui/await-keyword/2015-edition-warning.fixed b/src/test/ui/await-keyword/2015-edition-warning.fixed index c2c40cd11a6..c58496c91f5 100644 --- a/src/test/ui/await-keyword/2015-edition-warning.fixed +++ b/src/test/ui/await-keyword/2015-edition-warning.fixed @@ -5,11 +5,23 @@ mod outer_mod { pub mod r#await { +//~^ ERROR `await` is a keyword +//~| WARN was previously accepted pub struct r#await; +//~^ ERROR `await` is a keyword +//~| WARN was previously accepted } } use outer_mod::r#await::r#await; +//~^ ERROR `await` is a keyword +//~| ERROR `await` is a keyword +//~| WARN was previously accepted +//~| WARN was previously accepted fn main() { match r#await { r#await => {} } +//~^ ERROR `await` is a keyword +//~| ERROR `await` is a keyword +//~| WARN was previously accepted +//~| WARN was previously accepted } diff --git a/src/test/ui/await-keyword/2015-edition-warning.rs b/src/test/ui/await-keyword/2015-edition-warning.rs index 95539ab29dc..a7543a14325 100644 --- a/src/test/ui/await-keyword/2015-edition-warning.rs +++ b/src/test/ui/await-keyword/2015-edition-warning.rs @@ -5,11 +5,23 @@ mod outer_mod { pub mod await { +//~^ ERROR `await` is a keyword +//~| WARN was previously accepted pub struct await; +//~^ ERROR `await` is a keyword +//~| WARN was previously accepted } } use outer_mod::await::await; +//~^ ERROR `await` is a keyword +//~| ERROR `await` is a keyword +//~| WARN was previously accepted +//~| WARN was previously accepted fn main() { match await { await => {} } +//~^ ERROR `await` is a keyword +//~| ERROR `await` is a keyword +//~| WARN was previously accepted +//~| WARN was previously accepted } diff --git a/src/test/ui/await-keyword/2015-edition-warning.stderr b/src/test/ui/await-keyword/2015-edition-warning.stderr index 073e9d7e6d0..d9ae1b9a167 100644 --- a/src/test/ui/await-keyword/2015-edition-warning.stderr +++ b/src/test/ui/await-keyword/2015-edition-warning.stderr @@ -13,7 +13,7 @@ LL | #![deny(keyword_idents)] = note: for more information, see issue #49716 error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:8:20 + --> $DIR/2015-edition-warning.rs:10:20 | LL | pub struct await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` @@ -22,7 +22,7 @@ LL | pub struct await; = note: for more information, see issue #49716 error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:11:16 + --> $DIR/2015-edition-warning.rs:15:16 | LL | use outer_mod::await::await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` @@ -31,7 +31,7 @@ LL | use outer_mod::await::await; = note: for more information, see issue #49716 error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:11:23 + --> $DIR/2015-edition-warning.rs:15:23 | LL | use outer_mod::await::await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` @@ -40,7 +40,7 @@ LL | use outer_mod::await::await; = note: for more information, see issue #49716 error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:14:11 + --> $DIR/2015-edition-warning.rs:22:11 | LL | match await { await => {} } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` @@ -49,7 +49,7 @@ LL | match await { await => {} } = note: for more information, see issue #49716 error: `await` is a keyword in the 2018 edition - --> $DIR/2015-edition-warning.rs:14:19 + --> $DIR/2015-edition-warning.rs:22:19 | LL | match await { await => {} } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` diff --git a/src/test/ui/await-keyword/2018-edition-error.rs b/src/test/ui/await-keyword/2018-edition-error.rs index a9e2e3f79ee..7ba3382ddf1 100644 --- a/src/test/ui/await-keyword/2018-edition-error.rs +++ b/src/test/ui/await-keyword/2018-edition-error.rs @@ -2,12 +2,14 @@ #![allow(non_camel_case_types)] mod outer_mod { - pub mod await { - pub struct await; + pub mod await { //~ ERROR `await` is a keyword + pub struct await; //~ ERROR `await` is a keyword } } -use self::outer_mod::await::await; +use self::outer_mod::await::await; //~ ERROR `await` is a keyword + //~^ ERROR `await` is a keyword fn main() { - match await { await => () } + match await { await => () } //~ ERROR `await` is a keyword + //~^ ERROR `await` is a keyword } diff --git a/src/test/ui/await-keyword/2018-edition-error.stderr b/src/test/ui/await-keyword/2018-edition-error.stderr index d5727b8db37..9ddb27916d1 100644 --- a/src/test/ui/await-keyword/2018-edition-error.stderr +++ b/src/test/ui/await-keyword/2018-edition-error.stderr @@ -1,37 +1,37 @@ error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:5:13 | -LL | pub mod await { +LL | pub mod await { //~ ERROR `await` is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:6:20 | -LL | pub struct await; +LL | pub struct await; //~ ERROR `await` is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:9:22 | -LL | use self::outer_mod::await::await; +LL | use self::outer_mod::await::await; //~ ERROR `await` is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:9:29 | -LL | use self::outer_mod::await::await; +LL | use self::outer_mod::await::await; //~ ERROR `await` is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition - --> $DIR/2018-edition-error.rs:12:11 + --> $DIR/2018-edition-error.rs:13:11 | -LL | match await { await => () } +LL | match await { await => () } //~ ERROR `await` is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition - --> $DIR/2018-edition-error.rs:12:19 + --> $DIR/2018-edition-error.rs:13:19 | -LL | match await { await => () } +LL | match await { await => () } //~ ERROR `await` is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error: aborting due to 6 previous errors diff --git a/src/test/ui/await-keyword/post_expansion_error.rs b/src/test/ui/await-keyword/post_expansion_error.rs index 580ca3b3a4f..96dd48052de 100644 --- a/src/test/ui/await-keyword/post_expansion_error.rs +++ b/src/test/ui/await-keyword/post_expansion_error.rs @@ -6,4 +6,5 @@ macro_rules! r#await { fn main() { await!() + //~^ ERROR `await` is a keyword } diff --git a/src/test/ui/bad/bad-const-type.rs b/src/test/ui/bad/bad-const-type.rs index 5547d19868d..8121929e096 100644 --- a/src/test/ui/bad/bad-const-type.rs +++ b/src/test/ui/bad/bad-const-type.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static i: String = 10; //~^ ERROR mismatched types //~| expected type `std::string::String` //~| found type `{integer}` -//~| expected struct `std::string::String`, found integral variable +//~| expected struct `std::string::String`, found integer fn main() { println!("{}", i); } diff --git a/src/test/ui/bad/bad-const-type.stderr b/src/test/ui/bad/bad-const-type.stderr index fbde1573200..677dc72652e 100644 --- a/src/test/ui/bad/bad-const-type.stderr +++ b/src/test/ui/bad/bad-const-type.stderr @@ -1,10 +1,10 @@ error[E0308]: mismatched types - --> $DIR/bad-const-type.rs:11:20 + --> $DIR/bad-const-type.rs:1:20 | LL | static i: String = 10; | ^^ | | - | expected struct `std::string::String`, found integral variable + | expected struct `std::string::String`, found integer | help: try using a conversion method: `10.to_string()` | = note: expected type `std::string::String` diff --git a/src/test/ui/bad/bad-crate-name.rs b/src/test/ui/bad/bad-crate-name.rs index 70e1806a20b..837d5c35412 100644 --- a/src/test/ui/bad/bad-crate-name.rs +++ b/src/test/ui/bad/bad-crate-name.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate krate-name-here; //~^ ERROR crate name using dashes are not valid in `extern crate` statements //~| ERROR can't find crate for `krate_name_here` diff --git a/src/test/ui/bad/bad-crate-name.stderr b/src/test/ui/bad/bad-crate-name.stderr index 8348badeeeb..a08535a7757 100644 --- a/src/test/ui/bad/bad-crate-name.stderr +++ b/src/test/ui/bad/bad-crate-name.stderr @@ -1,5 +1,5 @@ error: crate name using dashes are not valid in `extern crate` statements - --> $DIR/bad-crate-name.rs:11:14 + --> $DIR/bad-crate-name.rs:1:14 | LL | extern crate krate-name-here; | ^^^^^^^^^^^^^^^ dash-separated idents are not valid @@ -9,7 +9,7 @@ LL | extern crate krate_name_here; | ^ ^ error[E0463]: can't find crate for `krate_name_here` - --> $DIR/bad-crate-name.rs:11:1 + --> $DIR/bad-crate-name.rs:1:1 | LL | extern crate krate-name-here; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate diff --git a/src/test/ui/bad/bad-env-capture.rs b/src/test/ui/bad/bad-env-capture.rs index 6a5e4cfef89..83fd2544fc8 100644 --- a/src/test/ui/bad/bad-env-capture.rs +++ b/src/test/ui/bad/bad-env-capture.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: can't capture dynamic environment in a fn item fn foo() { let x: isize; diff --git a/src/test/ui/bad/bad-env-capture.stderr b/src/test/ui/bad/bad-env-capture.stderr index bf460d2a81e..04975b03780 100644 --- a/src/test/ui/bad/bad-env-capture.stderr +++ b/src/test/ui/bad/bad-env-capture.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/bad-env-capture.rs:14:27 + --> $DIR/bad-env-capture.rs:4:27 | LL | fn bar() { log(debug, x); } | ^ @@ -7,13 +7,13 @@ LL | fn bar() { log(debug, x); } = help: use the `|| { ... }` closure form instead error[E0425]: cannot find function `log` in this scope - --> $DIR/bad-env-capture.rs:14:16 + --> $DIR/bad-env-capture.rs:4:16 | LL | fn bar() { log(debug, x); } | ^^^ not found in this scope error[E0425]: cannot find value `debug` in this scope - --> $DIR/bad-env-capture.rs:14:20 + --> $DIR/bad-env-capture.rs:4:20 | LL | fn bar() { log(debug, x); } | ^^^^^ not found in this scope diff --git a/src/test/ui/bad/bad-env-capture2.rs b/src/test/ui/bad/bad-env-capture2.rs index cf67c73c539..b04569c9d72 100644 --- a/src/test/ui/bad/bad-env-capture2.rs +++ b/src/test/ui/bad/bad-env-capture2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: can't capture dynamic environment in a fn item fn foo(x: isize) { fn bar() { log(debug, x); } diff --git a/src/test/ui/bad/bad-env-capture2.stderr b/src/test/ui/bad/bad-env-capture2.stderr index 8d5703d29f5..f7524c6a09f 100644 --- a/src/test/ui/bad/bad-env-capture2.stderr +++ b/src/test/ui/bad/bad-env-capture2.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/bad-env-capture2.rs:13:27 + --> $DIR/bad-env-capture2.rs:3:27 | LL | fn bar() { log(debug, x); } | ^ @@ -7,13 +7,13 @@ LL | fn bar() { log(debug, x); } = help: use the `|| { ... }` closure form instead error[E0425]: cannot find function `log` in this scope - --> $DIR/bad-env-capture2.rs:13:16 + --> $DIR/bad-env-capture2.rs:3:16 | LL | fn bar() { log(debug, x); } | ^^^ not found in this scope error[E0425]: cannot find value `debug` in this scope - --> $DIR/bad-env-capture2.rs:13:20 + --> $DIR/bad-env-capture2.rs:3:20 | LL | fn bar() { log(debug, x); } | ^^^^^ not found in this scope diff --git a/src/test/ui/bad/bad-env-capture3.rs b/src/test/ui/bad/bad-env-capture3.rs index a30c6770b87..62f12fd1a6d 100644 --- a/src/test/ui/bad/bad-env-capture3.rs +++ b/src/test/ui/bad/bad-env-capture3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: can't capture dynamic environment in a fn item fn foo(x: isize) { fn mth() { diff --git a/src/test/ui/bad/bad-env-capture3.stderr b/src/test/ui/bad/bad-env-capture3.stderr index 258f7d43b56..137612c9790 100644 --- a/src/test/ui/bad/bad-env-capture3.stderr +++ b/src/test/ui/bad/bad-env-capture3.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/bad-env-capture3.rs:14:31 + --> $DIR/bad-env-capture3.rs:4:31 | LL | fn bar() { log(debug, x); } | ^ @@ -7,13 +7,13 @@ LL | fn bar() { log(debug, x); } = help: use the `|| { ... }` closure form instead error[E0425]: cannot find function `log` in this scope - --> $DIR/bad-env-capture3.rs:14:20 + --> $DIR/bad-env-capture3.rs:4:20 | LL | fn bar() { log(debug, x); } | ^^^ not found in this scope error[E0425]: cannot find value `debug` in this scope - --> $DIR/bad-env-capture3.rs:14:24 + --> $DIR/bad-env-capture3.rs:4:24 | LL | fn bar() { log(debug, x); } | ^^^^^ not found in this scope diff --git a/src/test/ui/bad/bad-expr-lhs.rs b/src/test/ui/bad/bad-expr-lhs.rs index c7d2f2c472f..2cd8bc9d473 100644 --- a/src/test/ui/bad/bad-expr-lhs.rs +++ b/src/test/ui/bad/bad-expr-lhs.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { 1 = 2; //~ ERROR invalid left-hand side expression 1 += 2; //~ ERROR invalid left-hand side expression diff --git a/src/test/ui/bad/bad-expr-lhs.stderr b/src/test/ui/bad/bad-expr-lhs.stderr index 5937beef9c7..590d73bc3f5 100644 --- a/src/test/ui/bad/bad-expr-lhs.stderr +++ b/src/test/ui/bad/bad-expr-lhs.stderr @@ -1,29 +1,29 @@ error[E0070]: invalid left-hand side expression - --> $DIR/bad-expr-lhs.rs:12:5 + --> $DIR/bad-expr-lhs.rs:2:5 | LL | 1 = 2; //~ ERROR invalid left-hand side expression | ^^^^^ left-hand of expression not valid error[E0067]: invalid left-hand side expression - --> $DIR/bad-expr-lhs.rs:13:5 + --> $DIR/bad-expr-lhs.rs:3:5 | LL | 1 += 2; //~ ERROR invalid left-hand side expression | ^ invalid expression for left-hand side error[E0070]: invalid left-hand side expression - --> $DIR/bad-expr-lhs.rs:14:5 + --> $DIR/bad-expr-lhs.rs:4:5 | LL | (1, 2) = (3, 4); //~ ERROR invalid left-hand side expression | ^^^^^^^^^^^^^^^ left-hand of expression not valid error[E0070]: invalid left-hand side expression - --> $DIR/bad-expr-lhs.rs:17:5 + --> $DIR/bad-expr-lhs.rs:7:5 | LL | (a, b) = (3, 4); //~ ERROR invalid left-hand side expression | ^^^^^^^^^^^^^^^ left-hand of expression not valid error[E0070]: invalid left-hand side expression - --> $DIR/bad-expr-lhs.rs:19:5 + --> $DIR/bad-expr-lhs.rs:9:5 | LL | None = Some(3); //~ ERROR invalid left-hand side expression | ^^^^^^^^^^^^^^ left-hand of expression not valid diff --git a/src/test/ui/bad/bad-expr-path.rs b/src/test/ui/bad/bad-expr-path.rs index bd62dc66377..99ba93253d1 100644 --- a/src/test/ui/bad/bad-expr-path.rs +++ b/src/test/ui/bad/bad-expr-path.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod m1 {} fn main(arguments: Vec) { //~ ERROR main function has wrong type diff --git a/src/test/ui/bad/bad-expr-path.stderr b/src/test/ui/bad/bad-expr-path.stderr index a1ac17c78d6..71ac9a16ba6 100644 --- a/src/test/ui/bad/bad-expr-path.stderr +++ b/src/test/ui/bad/bad-expr-path.stderr @@ -1,23 +1,23 @@ error[E0425]: cannot find function `log` in this scope - --> $DIR/bad-expr-path.rs:14:5 + --> $DIR/bad-expr-path.rs:4:5 | LL | log(debug, m1::arguments); | ^^^ not found in this scope error[E0425]: cannot find value `debug` in this scope - --> $DIR/bad-expr-path.rs:14:9 + --> $DIR/bad-expr-path.rs:4:9 | LL | log(debug, m1::arguments); | ^^^^^ not found in this scope error[E0425]: cannot find value `arguments` in module `m1` - --> $DIR/bad-expr-path.rs:14:20 + --> $DIR/bad-expr-path.rs:4:20 | LL | log(debug, m1::arguments); | ^^^^^^^^^ not found in `m1` error[E0580]: main function has wrong type - --> $DIR/bad-expr-path.rs:13:1 + --> $DIR/bad-expr-path.rs:3:1 | LL | fn main(arguments: Vec) { //~ ERROR main function has wrong type | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters diff --git a/src/test/ui/bad/bad-expr-path2.rs b/src/test/ui/bad/bad-expr-path2.rs index 06b72d1ed47..43bd2908042 100644 --- a/src/test/ui/bad/bad-expr-path2.rs +++ b/src/test/ui/bad/bad-expr-path2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod m1 { pub mod arguments {} } diff --git a/src/test/ui/bad/bad-expr-path2.stderr b/src/test/ui/bad/bad-expr-path2.stderr index bb7d01c72fe..343de94182e 100644 --- a/src/test/ui/bad/bad-expr-path2.stderr +++ b/src/test/ui/bad/bad-expr-path2.stderr @@ -1,23 +1,23 @@ error[E0425]: cannot find function `log` in this scope - --> $DIR/bad-expr-path2.rs:16:5 + --> $DIR/bad-expr-path2.rs:6:5 | LL | log(debug, m1::arguments); | ^^^ not found in this scope error[E0425]: cannot find value `debug` in this scope - --> $DIR/bad-expr-path2.rs:16:9 + --> $DIR/bad-expr-path2.rs:6:9 | LL | log(debug, m1::arguments); | ^^^^^ not found in this scope error[E0423]: expected value, found module `m1::arguments` - --> $DIR/bad-expr-path2.rs:16:16 + --> $DIR/bad-expr-path2.rs:6:16 | LL | log(debug, m1::arguments); | ^^^^^^^^^^^^^ not a value error[E0580]: main function has wrong type - --> $DIR/bad-expr-path2.rs:15:1 + --> $DIR/bad-expr-path2.rs:5:1 | LL | fn main(arguments: Vec) { //~ ERROR main function has wrong type | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters diff --git a/src/test/ui/bad/bad-extern-link-attrs.rs b/src/test/ui/bad/bad-extern-link-attrs.rs index ff63d4b739a..f042832fba0 100644 --- a/src/test/ui/bad/bad-extern-link-attrs.rs +++ b/src/test/ui/bad/bad-extern-link-attrs.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link()] //~ ERROR: specified without `name = #[link(name = "")] //~ ERROR: with empty name #[link(name = "foo")] diff --git a/src/test/ui/bad/bad-extern-link-attrs.stderr b/src/test/ui/bad/bad-extern-link-attrs.stderr index 5e58bcd0094..6732e8553f3 100644 --- a/src/test/ui/bad/bad-extern-link-attrs.stderr +++ b/src/test/ui/bad/bad-extern-link-attrs.stderr @@ -1,17 +1,17 @@ error[E0459]: #[link(...)] specified without `name = "foo"` - --> $DIR/bad-extern-link-attrs.rs:11:1 + --> $DIR/bad-extern-link-attrs.rs:1:1 | LL | #[link()] //~ ERROR: specified without `name = | ^^^^^^^^^ missing `name` argument error[E0454]: #[link(name = "")] given with empty name - --> $DIR/bad-extern-link-attrs.rs:12:1 + --> $DIR/bad-extern-link-attrs.rs:2:1 | LL | #[link(name = "")] //~ ERROR: with empty name | ^^^^^^^^^^^^^^^^^^ empty name given error[E0458]: unknown kind: `bar` - --> $DIR/bad-extern-link-attrs.rs:14:1 + --> $DIR/bad-extern-link-attrs.rs:4:1 | LL | #[link(name = "foo", kind = "bar")] //~ ERROR: unknown kind | ^^^^^^^^^^^^^^^^^^^^^------------^^ diff --git a/src/test/ui/bad/bad-intrinsic-monomorphization.rs b/src/test/ui/bad/bad-intrinsic-monomorphization.rs index 2fe94d43acd..a29723f34b4 100644 --- a/src/test/ui/bad/bad-intrinsic-monomorphization.rs +++ b/src/test/ui/bad/bad-intrinsic-monomorphization.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd, platform_intrinsics, core_intrinsics)] #![allow(warnings)] #![crate_type = "rlib"] @@ -24,7 +14,7 @@ use std::intrinsics; #[derive(Copy, Clone)] pub struct Foo(i64); -pub unsafe fn test_cttz(v: Foo) -> Foo { +pub fn test_cttz(v: Foo) -> Foo { intrinsics::cttz(v) //~^ ERROR `cttz` intrinsic: expected basic integer type, found `Foo` } diff --git a/src/test/ui/bad/bad-intrinsic-monomorphization.stderr b/src/test/ui/bad/bad-intrinsic-monomorphization.stderr index a088dd0aa43..dee33f574d8 100644 --- a/src/test/ui/bad/bad-intrinsic-monomorphization.stderr +++ b/src/test/ui/bad/bad-intrinsic-monomorphization.stderr @@ -1,17 +1,17 @@ error[E0511]: invalid monomorphization of `cttz` intrinsic: expected basic integer type, found `Foo` - --> $DIR/bad-intrinsic-monomorphization.rs:28:5 + --> $DIR/bad-intrinsic-monomorphization.rs:18:5 | LL | intrinsics::cttz(v) | ^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `fadd_fast` intrinsic: expected basic float type, found `Foo` - --> $DIR/bad-intrinsic-monomorphization.rs:33:5 + --> $DIR/bad-intrinsic-monomorphization.rs:23:5 | LL | intrinsics::fadd_fast(a, b) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `Foo` - --> $DIR/bad-intrinsic-monomorphization.rs:38:5 + --> $DIR/bad-intrinsic-monomorphization.rs:28:5 | LL | simd_add(a, b) | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/bad/bad-lint-cap.rs b/src/test/ui/bad/bad-lint-cap.rs index cb9c347af60..e65c8319d1a 100644 --- a/src/test/ui/bad/bad-lint-cap.rs +++ b/src/test/ui/bad/bad-lint-cap.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --cap-lints test // error-pattern: unknown lint level: `test` diff --git a/src/test/ui/bad/bad-lint-cap2.rs b/src/test/ui/bad/bad-lint-cap2.rs index cb9fb973a01..8bc8aca2049 100644 --- a/src/test/ui/bad/bad-lint-cap2.rs +++ b/src/test/ui/bad/bad-lint-cap2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --cap-lints deny #![warn(unused)] diff --git a/src/test/ui/bad/bad-lint-cap2.stderr b/src/test/ui/bad/bad-lint-cap2.stderr index 7471aa21e58..d7ec41489d1 100644 --- a/src/test/ui/bad/bad-lint-cap2.stderr +++ b/src/test/ui/bad/bad-lint-cap2.stderr @@ -1,11 +1,11 @@ error: unused import: `std::option` - --> $DIR/bad-lint-cap2.rs:16:5 + --> $DIR/bad-lint-cap2.rs:6:5 | LL | use std::option; //~ ERROR | ^^^^^^^^^^^ | note: lint level defined here - --> $DIR/bad-lint-cap2.rs:14:9 + --> $DIR/bad-lint-cap2.rs:4:9 | LL | #![deny(warnings)] | ^^^^^^^^ diff --git a/src/test/ui/bad/bad-lint-cap3.rs b/src/test/ui/bad/bad-lint-cap3.rs index 1a8c18db896..8aab38ee5ec 100644 --- a/src/test/ui/bad/bad-lint-cap3.rs +++ b/src/test/ui/bad/bad-lint-cap3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --cap-lints warn #![warn(unused)] diff --git a/src/test/ui/bad/bad-lint-cap3.stderr b/src/test/ui/bad/bad-lint-cap3.stderr index aa455c51932..5bf0b089afa 100644 --- a/src/test/ui/bad/bad-lint-cap3.stderr +++ b/src/test/ui/bad/bad-lint-cap3.stderr @@ -1,11 +1,11 @@ warning: unused import: `std::option` - --> $DIR/bad-lint-cap3.rs:17:5 + --> $DIR/bad-lint-cap3.rs:7:5 | LL | use std::option; //~ WARN | ^^^^^^^^^^^ | note: lint level defined here - --> $DIR/bad-lint-cap3.rs:14:9 + --> $DIR/bad-lint-cap3.rs:4:9 | LL | #![deny(warnings)] | ^^^^^^^^ diff --git a/src/test/ui/bad/bad-main.rs b/src/test/ui/bad/bad-main.rs index b73b4a6af6e..c9e2f02f071 100644 --- a/src/test/ui/bad/bad-main.rs +++ b/src/test/ui/bad/bad-main.rs @@ -1,11 +1 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main(x: isize) { } //~ ERROR: main function has wrong type [E0580] diff --git a/src/test/ui/bad/bad-main.stderr b/src/test/ui/bad/bad-main.stderr index 3388e0866e5..1a9c11f7b42 100644 --- a/src/test/ui/bad/bad-main.stderr +++ b/src/test/ui/bad/bad-main.stderr @@ -1,5 +1,5 @@ error[E0580]: main function has wrong type - --> $DIR/bad-main.rs:11:1 + --> $DIR/bad-main.rs:1:1 | LL | fn main(x: isize) { } //~ ERROR: main function has wrong type [E0580] | ^^^^^^^^^^^^^^^^^ incorrect number of function parameters diff --git a/src/test/ui/bad/bad-method-typaram-kind.rs b/src/test/ui/bad/bad-method-typaram-kind.rs index 7cef3f13dfc..b088eae1c87 100644 --- a/src/test/ui/bad/bad-method-typaram-kind.rs +++ b/src/test/ui/bad/bad-method-typaram-kind.rs @@ -1,22 +1,12 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() { 1.bar::(); //~ ERROR `T` cannot be sent between threads safely } -trait bar { +trait Bar { fn bar(&self); } -impl bar for usize { +impl Bar for usize { fn bar(&self) { } } diff --git a/src/test/ui/bad/bad-method-typaram-kind.stderr b/src/test/ui/bad/bad-method-typaram-kind.stderr index ed0c49a4f66..8232bdd23a6 100644 --- a/src/test/ui/bad/bad-method-typaram-kind.stderr +++ b/src/test/ui/bad/bad-method-typaram-kind.stderr @@ -1,5 +1,5 @@ error[E0277]: `T` cannot be sent between threads safely - --> $DIR/bad-method-typaram-kind.rs:12:7 + --> $DIR/bad-method-typaram-kind.rs:2:7 | LL | 1.bar::(); //~ ERROR `T` cannot be sent between threads safely | ^^^ `T` cannot be sent between threads safely diff --git a/src/test/ui/bad/bad-mid-path-type-params.rs b/src/test/ui/bad/bad-mid-path-type-params.rs index 1ee70d9bdde..016b1d617e0 100644 --- a/src/test/ui/bad/bad-mid-path-type-params.rs +++ b/src/test/ui/bad/bad-mid-path-type-params.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S { contents: T, } diff --git a/src/test/ui/bad/bad-mid-path-type-params.stderr b/src/test/ui/bad/bad-mid-path-type-params.stderr index 2f2a74e4721..ef53c9a38c7 100644 --- a/src/test/ui/bad/bad-mid-path-type-params.stderr +++ b/src/test/ui/bad/bad-mid-path-type-params.stderr @@ -1,23 +1,23 @@ error[E0107]: wrong number of type arguments: expected 1, found 2 - --> $DIR/bad-mid-path-type-params.rs:40:28 + --> $DIR/bad-mid-path-type-params.rs:30:28 | LL | let _ = S::new::(1, 1.0); | ^^^ unexpected type argument error[E0107]: wrong number of lifetime arguments: expected 0, found 1 - --> $DIR/bad-mid-path-type-params.rs:43:17 + --> $DIR/bad-mid-path-type-params.rs:33:17 | LL | let _ = S::<'a,isize>::new::(1, 1.0); | ^^ unexpected lifetime argument error[E0107]: wrong number of type arguments: expected 1, found 2 - --> $DIR/bad-mid-path-type-params.rs:46:36 + --> $DIR/bad-mid-path-type-params.rs:36:36 | LL | let _: S2 = Trait::new::(1, 1.0); | ^^^ unexpected type argument error[E0107]: wrong number of lifetime arguments: expected 0, found 1 - --> $DIR/bad-mid-path-type-params.rs:49:25 + --> $DIR/bad-mid-path-type-params.rs:39:25 | LL | let _: S2 = Trait::<'a,isize>::new::(1, 1.0); | ^^ unexpected lifetime argument diff --git a/src/test/ui/bad/bad-module.rs b/src/test/ui/bad/bad-module.rs index 4f38d4ce45e..a496c816e94 100644 --- a/src/test/ui/bad/bad-module.rs +++ b/src/test/ui/bad/bad-module.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let foo = thing::len(Vec::new()); //~^ ERROR failed to resolve: use of undeclared type or module `thing` diff --git a/src/test/ui/bad/bad-module.stderr b/src/test/ui/bad/bad-module.stderr index 8bdcceaa191..45d4c5abd93 100644 --- a/src/test/ui/bad/bad-module.stderr +++ b/src/test/ui/bad/bad-module.stderr @@ -1,11 +1,11 @@ error[E0433]: failed to resolve: use of undeclared type or module `thing` - --> $DIR/bad-module.rs:12:15 + --> $DIR/bad-module.rs:2:15 | LL | let foo = thing::len(Vec::new()); | ^^^^^ use of undeclared type or module `thing` error[E0433]: failed to resolve: use of undeclared type or module `foo` - --> $DIR/bad-module.rs:15:15 + --> $DIR/bad-module.rs:5:15 | LL | let foo = foo::bar::baz(); | ^^^ use of undeclared type or module `foo` diff --git a/src/test/ui/bad/bad-sized.rs b/src/test/ui/bad/bad-sized.rs index a58aebee77b..0da4e456f08 100644 --- a/src/test/ui/bad/bad-sized.rs +++ b/src/test/ui/bad/bad-sized.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait {} pub fn main() { diff --git a/src/test/ui/bad/bad-sized.stderr b/src/test/ui/bad/bad-sized.stderr index 5f8013826d9..9565888dcc0 100644 --- a/src/test/ui/bad/bad-sized.stderr +++ b/src/test/ui/bad/bad-sized.stderr @@ -1,27 +1,27 @@ error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/bad-sized.rs:14:24 + --> $DIR/bad-sized.rs:4:24 | LL | let x: Vec = Vec::new(); | ^^^^^ non-auto additional trait error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time - --> $DIR/bad-sized.rs:14:12 + --> $DIR/bad-sized.rs:4:12 | LL | let x: Vec = Vec::new(); | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn Trait` - = note: to learn more, visit + = note: to learn more, visit = note: required by `std::vec::Vec` error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time - --> $DIR/bad-sized.rs:14:33 + --> $DIR/bad-sized.rs:4:33 | LL | let x: Vec = Vec::new(); | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn Trait` - = note: to learn more, visit + = note: to learn more, visit = note: required by `>::new` error: aborting due to 3 previous errors diff --git a/src/test/ui/bad/bad-type-env-capture.rs b/src/test/ui/bad/bad-type-env-capture.rs index c1547dd82b3..d2e6dff1252 100644 --- a/src/test/ui/bad/bad-type-env-capture.rs +++ b/src/test/ui/bad/bad-type-env-capture.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() { fn bar(b: T) { } //~ ERROR can't use type parameters from outer } diff --git a/src/test/ui/bad/bad-type-env-capture.stderr b/src/test/ui/bad/bad-type-env-capture.stderr index 3cb087ab09a..5558a440061 100644 --- a/src/test/ui/bad/bad-type-env-capture.stderr +++ b/src/test/ui/bad/bad-type-env-capture.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use type parameters from outer function - --> $DIR/bad-type-env-capture.rs:12:15 + --> $DIR/bad-type-env-capture.rs:2:15 | LL | fn foo() { | - type variable from outer function diff --git a/src/test/ui/bastion-of-the-turbofish.rs b/src/test/ui/bastion-of-the-turbofish.rs index eadd2389609..0716fcf7f26 100644 --- a/src/test/ui/bastion-of-the-turbofish.rs +++ b/src/test/ui/bastion-of-the-turbofish.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // Bastion of the Turbofish diff --git a/src/test/ui/binary-op-on-double-ref.rs b/src/test/ui/binary-op-on-double-ref.rs index 8b31be911b8..6490cc7fe56 100644 --- a/src/test/ui/binary-op-on-double-ref.rs +++ b/src/test/ui/binary-op-on-double-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let v = vec![1, 2, 3, 4, 5, 6, 7, 8, 9]; let vr = v.iter().filter(|x| { diff --git a/src/test/ui/binary-op-on-double-ref.stderr b/src/test/ui/binary-op-on-double-ref.stderr index c89defa3dd1..f298902e3ff 100644 --- a/src/test/ui/binary-op-on-double-ref.stderr +++ b/src/test/ui/binary-op-on-double-ref.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `%` cannot be applied to type `&&{integer}` - --> $DIR/binary-op-on-double-ref.rs:14:9 + --> $DIR/binary-op-on-double-ref.rs:4:9 | LL | x % 2 == 0 | ^^^^^ diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.rs b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.rs index 2a5c7136dc3..238f2d958c6 100644 --- a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.rs +++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct X { x: (), } impl Drop for X { diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr index 2f05755eabd..427b1a722d9 100644 --- a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr +++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr @@ -1,5 +1,5 @@ error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-2.rs:22:23 + --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-2.rs:12:23 | LL | Some((ref _y, _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern | ------ ^^ by-move pattern here diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.rs b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.rs index 3d3ccb606bf..e8357e91788 100644 --- a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.rs +++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct X { x: (), } impl Drop for X { @@ -16,13 +6,13 @@ impl Drop for X { } } -enum double_option { some2(T,U), none2 } +enum DoubleOption { Some2(T,U), None2 } fn main() { - let x = double_option::some2(X { x: () }, X { x: () }); + let x = DoubleOption::Some2(X { x: () }, X { x: () }); match x { - double_option::some2(ref _y, _z) => { }, + DoubleOption::Some2(ref _y, _z) => { }, //~^ ERROR cannot bind by-move and by-ref in the same pattern - double_option::none2 => panic!() + DoubleOption::None2 => panic!() } } diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.stderr b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.stderr index a573b9a04ba..d53547178db 100644 --- a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.stderr +++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.stderr @@ -1,10 +1,10 @@ error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-3.rs:24:38 + --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-3.rs:14:37 | -LL | double_option::some2(ref _y, _z) => { }, - | ------ ^^ by-move pattern here - | | - | both by-ref and by-move used +LL | DoubleOption::Some2(ref _y, _z) => { }, + | ------ ^^ by-move pattern here + | | + | both by-ref and by-move used error: aborting due to previous error diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.rs b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.rs index 8c7542fbe6b..41dafd2b5bf 100644 --- a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.rs +++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct X { x: (), } impl Drop for X { diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr index e38916b8b27..9ebbedcfe60 100644 --- a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr +++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr @@ -1,5 +1,5 @@ error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-4.rs:22:15 + --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-4.rs:12:15 | LL | Some((_y, ref _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern | ^^ ------ both by-ref and by-move used diff --git a/src/test/ui/binop/binop-bitxor-str.rs b/src/test/ui/binop/binop-bitxor-str.rs index 3f26e3ce904..6021c344dfb 100644 --- a/src/test/ui/binop/binop-bitxor-str.rs +++ b/src/test/ui/binop/binop-bitxor-str.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:`^` cannot be applied to type `std::string::String` fn main() { let x = "a".to_string() ^ "b".to_string(); } diff --git a/src/test/ui/binop/binop-bitxor-str.stderr b/src/test/ui/binop/binop-bitxor-str.stderr index a6804a6d42c..4404fde9200 100644 --- a/src/test/ui/binop/binop-bitxor-str.stderr +++ b/src/test/ui/binop/binop-bitxor-str.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `^` cannot be applied to type `std::string::String` - --> $DIR/binop-bitxor-str.rs:13:21 + --> $DIR/binop-bitxor-str.rs:3:21 | LL | fn main() { let x = "a".to_string() ^ "b".to_string(); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/binop/binop-consume-args.nll.stderr b/src/test/ui/binop/binop-consume-args.nll.stderr new file mode 100644 index 00000000000..59b5aba93ca --- /dev/null +++ b/src/test/ui/binop/binop-consume-args.nll.stderr @@ -0,0 +1,253 @@ +error[E0382]: use of moved value: `lhs` + --> $DIR/binop-consume-args.rs:7:10 + | +LL | fn add, B>(lhs: A, rhs: B) { + | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs + rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `rhs` + --> $DIR/binop-consume-args.rs:8:10 + | +LL | fn add, B>(lhs: A, rhs: B) { + | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs + rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(rhs); //~ ERROR use of moved value: `rhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `lhs` + --> $DIR/binop-consume-args.rs:13:10 + | +LL | fn sub, B>(lhs: A, rhs: B) { + | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs - rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `rhs` + --> $DIR/binop-consume-args.rs:14:10 + | +LL | fn sub, B>(lhs: A, rhs: B) { + | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs - rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(rhs); //~ ERROR use of moved value: `rhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `lhs` + --> $DIR/binop-consume-args.rs:19:10 + | +LL | fn mul, B>(lhs: A, rhs: B) { + | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs * rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `rhs` + --> $DIR/binop-consume-args.rs:20:10 + | +LL | fn mul, B>(lhs: A, rhs: B) { + | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs * rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(rhs); //~ ERROR use of moved value: `rhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `lhs` + --> $DIR/binop-consume-args.rs:25:10 + | +LL | fn div, B>(lhs: A, rhs: B) { + | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs / rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `rhs` + --> $DIR/binop-consume-args.rs:26:10 + | +LL | fn div, B>(lhs: A, rhs: B) { + | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs / rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(rhs); //~ ERROR use of moved value: `rhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `lhs` + --> $DIR/binop-consume-args.rs:31:10 + | +LL | fn rem, B>(lhs: A, rhs: B) { + | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs % rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `rhs` + --> $DIR/binop-consume-args.rs:32:10 + | +LL | fn rem, B>(lhs: A, rhs: B) { + | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs % rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(rhs); //~ ERROR use of moved value: `rhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `lhs` + --> $DIR/binop-consume-args.rs:37:10 + | +LL | fn bitand, B>(lhs: A, rhs: B) { + | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs & rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `rhs` + --> $DIR/binop-consume-args.rs:38:10 + | +LL | fn bitand, B>(lhs: A, rhs: B) { + | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs & rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(rhs); //~ ERROR use of moved value: `rhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `lhs` + --> $DIR/binop-consume-args.rs:43:10 + | +LL | fn bitor, B>(lhs: A, rhs: B) { + | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs | rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `rhs` + --> $DIR/binop-consume-args.rs:44:10 + | +LL | fn bitor, B>(lhs: A, rhs: B) { + | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs | rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(rhs); //~ ERROR use of moved value: `rhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `lhs` + --> $DIR/binop-consume-args.rs:49:10 + | +LL | fn bitxor, B>(lhs: A, rhs: B) { + | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs ^ rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `rhs` + --> $DIR/binop-consume-args.rs:50:10 + | +LL | fn bitxor, B>(lhs: A, rhs: B) { + | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs ^ rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(rhs); //~ ERROR use of moved value: `rhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `lhs` + --> $DIR/binop-consume-args.rs:55:10 + | +LL | fn shl, B>(lhs: A, rhs: B) { + | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs << rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `rhs` + --> $DIR/binop-consume-args.rs:56:10 + | +LL | fn shl, B>(lhs: A, rhs: B) { + | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs << rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(rhs); //~ ERROR use of moved value: `rhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `lhs` + --> $DIR/binop-consume-args.rs:61:10 + | +LL | fn shr, B>(lhs: A, rhs: B) { + | - --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs >> rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` + | ^^^ value used here after move + +error[E0382]: use of moved value: `rhs` + --> $DIR/binop-consume-args.rs:62:10 + | +LL | fn shr, B>(lhs: A, rhs: B) { + | - --- move occurs because `rhs` has type `B`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | lhs >> rhs; + | --- value moved here +LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(rhs); //~ ERROR use of moved value: `rhs` + | ^^^ value used here after move + +error: aborting due to 20 previous errors + +For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/binop/binop-consume-args.rs b/src/test/ui/binop/binop-consume-args.rs index c525a67c7e9..8d6c725d756 100644 --- a/src/test/ui/binop/binop-consume-args.rs +++ b/src/test/ui/binop/binop-consume-args.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that binary operators consume their arguments use std::ops::{Add, Sub, Mul, Div, Rem, BitAnd, BitXor, BitOr, Shl, Shr}; diff --git a/src/test/ui/binop/binop-consume-args.stderr b/src/test/ui/binop/binop-consume-args.stderr index 07627d3711b..0b5d2200b9f 100644 --- a/src/test/ui/binop/binop-consume-args.stderr +++ b/src/test/ui/binop/binop-consume-args.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `lhs` - --> $DIR/binop-consume-args.rs:17:10 + --> $DIR/binop-consume-args.rs:7:10 | LL | lhs + rhs; | --- value moved here @@ -9,7 +9,7 @@ LL | drop(lhs); //~ ERROR use of moved value: `lhs` = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait error[E0382]: use of moved value: `rhs` - --> $DIR/binop-consume-args.rs:18:10 + --> $DIR/binop-consume-args.rs:8:10 | LL | lhs + rhs; | --- value moved here @@ -20,7 +20,7 @@ LL | drop(rhs); //~ ERROR use of moved value: `rhs` = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait error[E0382]: use of moved value: `lhs` - --> $DIR/binop-consume-args.rs:23:10 + --> $DIR/binop-consume-args.rs:13:10 | LL | lhs - rhs; | --- value moved here @@ -30,7 +30,7 @@ LL | drop(lhs); //~ ERROR use of moved value: `lhs` = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait error[E0382]: use of moved value: `rhs` - --> $DIR/binop-consume-args.rs:24:10 + --> $DIR/binop-consume-args.rs:14:10 | LL | lhs - rhs; | --- value moved here @@ -41,7 +41,7 @@ LL | drop(rhs); //~ ERROR use of moved value: `rhs` = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait error[E0382]: use of moved value: `lhs` - --> $DIR/binop-consume-args.rs:29:10 + --> $DIR/binop-consume-args.rs:19:10 | LL | lhs * rhs; | --- value moved here @@ -51,7 +51,7 @@ LL | drop(lhs); //~ ERROR use of moved value: `lhs` = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait error[E0382]: use of moved value: `rhs` - --> $DIR/binop-consume-args.rs:30:10 + --> $DIR/binop-consume-args.rs:20:10 | LL | lhs * rhs; | --- value moved here @@ -62,7 +62,7 @@ LL | drop(rhs); //~ ERROR use of moved value: `rhs` = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait error[E0382]: use of moved value: `lhs` - --> $DIR/binop-consume-args.rs:35:10 + --> $DIR/binop-consume-args.rs:25:10 | LL | lhs / rhs; | --- value moved here @@ -72,7 +72,7 @@ LL | drop(lhs); //~ ERROR use of moved value: `lhs` = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait error[E0382]: use of moved value: `rhs` - --> $DIR/binop-consume-args.rs:36:10 + --> $DIR/binop-consume-args.rs:26:10 | LL | lhs / rhs; | --- value moved here @@ -83,7 +83,7 @@ LL | drop(rhs); //~ ERROR use of moved value: `rhs` = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait error[E0382]: use of moved value: `lhs` - --> $DIR/binop-consume-args.rs:41:10 + --> $DIR/binop-consume-args.rs:31:10 | LL | lhs % rhs; | --- value moved here @@ -93,7 +93,7 @@ LL | drop(lhs); //~ ERROR use of moved value: `lhs` = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait error[E0382]: use of moved value: `rhs` - --> $DIR/binop-consume-args.rs:42:10 + --> $DIR/binop-consume-args.rs:32:10 | LL | lhs % rhs; | --- value moved here @@ -104,7 +104,7 @@ LL | drop(rhs); //~ ERROR use of moved value: `rhs` = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait error[E0382]: use of moved value: `lhs` - --> $DIR/binop-consume-args.rs:47:10 + --> $DIR/binop-consume-args.rs:37:10 | LL | lhs & rhs; | --- value moved here @@ -114,7 +114,7 @@ LL | drop(lhs); //~ ERROR use of moved value: `lhs` = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait error[E0382]: use of moved value: `rhs` - --> $DIR/binop-consume-args.rs:48:10 + --> $DIR/binop-consume-args.rs:38:10 | LL | lhs & rhs; | --- value moved here @@ -125,7 +125,7 @@ LL | drop(rhs); //~ ERROR use of moved value: `rhs` = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait error[E0382]: use of moved value: `lhs` - --> $DIR/binop-consume-args.rs:53:10 + --> $DIR/binop-consume-args.rs:43:10 | LL | lhs | rhs; | --- value moved here @@ -135,7 +135,7 @@ LL | drop(lhs); //~ ERROR use of moved value: `lhs` = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait error[E0382]: use of moved value: `rhs` - --> $DIR/binop-consume-args.rs:54:10 + --> $DIR/binop-consume-args.rs:44:10 | LL | lhs | rhs; | --- value moved here @@ -146,7 +146,7 @@ LL | drop(rhs); //~ ERROR use of moved value: `rhs` = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait error[E0382]: use of moved value: `lhs` - --> $DIR/binop-consume-args.rs:59:10 + --> $DIR/binop-consume-args.rs:49:10 | LL | lhs ^ rhs; | --- value moved here @@ -156,7 +156,7 @@ LL | drop(lhs); //~ ERROR use of moved value: `lhs` = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait error[E0382]: use of moved value: `rhs` - --> $DIR/binop-consume-args.rs:60:10 + --> $DIR/binop-consume-args.rs:50:10 | LL | lhs ^ rhs; | --- value moved here @@ -167,7 +167,7 @@ LL | drop(rhs); //~ ERROR use of moved value: `rhs` = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait error[E0382]: use of moved value: `lhs` - --> $DIR/binop-consume-args.rs:65:10 + --> $DIR/binop-consume-args.rs:55:10 | LL | lhs << rhs; | --- value moved here @@ -177,7 +177,7 @@ LL | drop(lhs); //~ ERROR use of moved value: `lhs` = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait error[E0382]: use of moved value: `rhs` - --> $DIR/binop-consume-args.rs:66:10 + --> $DIR/binop-consume-args.rs:56:10 | LL | lhs << rhs; | --- value moved here @@ -188,7 +188,7 @@ LL | drop(rhs); //~ ERROR use of moved value: `rhs` = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait error[E0382]: use of moved value: `lhs` - --> $DIR/binop-consume-args.rs:71:10 + --> $DIR/binop-consume-args.rs:61:10 | LL | lhs >> rhs; | --- value moved here @@ -198,7 +198,7 @@ LL | drop(lhs); //~ ERROR use of moved value: `lhs` = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait error[E0382]: use of moved value: `rhs` - --> $DIR/binop-consume-args.rs:72:10 + --> $DIR/binop-consume-args.rs:62:10 | LL | lhs >> rhs; | --- value moved here diff --git a/src/test/ui/binop/binop-logic-float.rs b/src/test/ui/binop/binop-logic-float.rs index f3fb5a08c85..c95c1d30d1c 100644 --- a/src/test/ui/binop/binop-logic-float.rs +++ b/src/test/ui/binop/binop-logic-float.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = 1.0_f32 || 2.0_f32; } //~^ ERROR mismatched types //~| ERROR mismatched types diff --git a/src/test/ui/binop/binop-logic-float.stderr b/src/test/ui/binop/binop-logic-float.stderr index 947ee4e2427..5a94307ff85 100644 --- a/src/test/ui/binop/binop-logic-float.stderr +++ b/src/test/ui/binop/binop-logic-float.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/binop-logic-float.rs:11:21 + --> $DIR/binop-logic-float.rs:1:21 | LL | fn main() { let x = 1.0_f32 || 2.0_f32; } | ^^^^^^^ expected bool, found f32 error[E0308]: mismatched types - --> $DIR/binop-logic-float.rs:11:32 + --> $DIR/binop-logic-float.rs:1:32 | LL | fn main() { let x = 1.0_f32 || 2.0_f32; } | ^^^^^^^ expected bool, found f32 diff --git a/src/test/ui/binop/binop-logic-int.rs b/src/test/ui/binop/binop-logic-int.rs index f5e53f84c16..e71daa2dd62 100644 --- a/src/test/ui/binop/binop-logic-int.rs +++ b/src/test/ui/binop/binop-logic-int.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = 1 && 2; } //~^ ERROR mismatched types //~| ERROR mismatched types diff --git a/src/test/ui/binop/binop-logic-int.stderr b/src/test/ui/binop/binop-logic-int.stderr index 56f7601ace2..b699b390b8b 100644 --- a/src/test/ui/binop/binop-logic-int.stderr +++ b/src/test/ui/binop/binop-logic-int.stderr @@ -1,17 +1,17 @@ error[E0308]: mismatched types - --> $DIR/binop-logic-int.rs:11:21 + --> $DIR/binop-logic-int.rs:1:21 | LL | fn main() { let x = 1 && 2; } - | ^ expected bool, found integral variable + | ^ expected bool, found integer | = note: expected type `bool` found type `{integer}` error[E0308]: mismatched types - --> $DIR/binop-logic-int.rs:11:26 + --> $DIR/binop-logic-int.rs:1:26 | LL | fn main() { let x = 1 && 2; } - | ^ expected bool, found integral variable + | ^ expected bool, found integer | = note: expected type `bool` found type `{integer}` diff --git a/src/test/ui/binop/binop-move-semantics.nll.stderr b/src/test/ui/binop/binop-move-semantics.nll.stderr index 612375f9047..7c84e8833a9 100644 --- a/src/test/ui/binop/binop-move-semantics.nll.stderr +++ b/src/test/ui/binop/binop-move-semantics.nll.stderr @@ -1,27 +1,31 @@ error[E0382]: use of moved value: `x` - --> $DIR/binop-move-semantics.rs:18:5 + --> $DIR/binop-move-semantics.rs:8:5 | +LL | fn double_move>(x: T) { + | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument LL | x | - value moved here LL | + LL | x; //~ ERROR: use of moved value | ^ value used here after move - | - = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/binop-move-semantics.rs:24:5 + --> $DIR/binop-move-semantics.rs:14:5 | +LL | fn move_then_borrow + Clone>(x: T) { + | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument LL | x | - value moved here LL | + LL | x.clone(); //~ ERROR: use of moved value | ^ value borrowed here after move - | - = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/binop-move-semantics.rs:31:5 + --> $DIR/binop-move-semantics.rs:21:5 | LL | let m = &x; | -- borrow of `x` occurs here @@ -33,7 +37,7 @@ LL | use_mut(n); use_imm(m); | - borrow later used here error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/binop-move-semantics.rs:33:5 + --> $DIR/binop-move-semantics.rs:23:5 | LL | let n = &mut y; | ------ borrow of `y` occurs here @@ -44,19 +48,19 @@ LL | use_mut(n); use_imm(m); | - borrow later used here error[E0507]: cannot move out of borrowed content - --> $DIR/binop-move-semantics.rs:40:5 + --> $DIR/binop-move-semantics.rs:30:5 | LL | *m //~ ERROR: cannot move out of borrowed content | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/binop-move-semantics.rs:42:5 + --> $DIR/binop-move-semantics.rs:32:5 | LL | *n; //~ ERROR: cannot move out of borrowed content | ^^ cannot move out of borrowed content error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable - --> $DIR/binop-move-semantics.rs:64:5 + --> $DIR/binop-move-semantics.rs:54:5 | LL | &mut f | ------ @@ -71,7 +75,7 @@ LL | | &f; //~ ERROR: cannot borrow `f` as immutable because it is also bor | immutable borrow occurs here error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immutable - --> $DIR/binop-move-semantics.rs:72:5 + --> $DIR/binop-move-semantics.rs:62:5 | LL | &f | -- diff --git a/src/test/ui/binop/binop-move-semantics.rs b/src/test/ui/binop/binop-move-semantics.rs index f6fad8b46dd..2bcf16f8ba8 100644 --- a/src/test/ui/binop/binop-move-semantics.rs +++ b/src/test/ui/binop/binop-move-semantics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that move restrictions are enforced on overloaded binary operations use std::ops::Add; diff --git a/src/test/ui/binop/binop-move-semantics.stderr b/src/test/ui/binop/binop-move-semantics.stderr index 81b8a336a20..b1dc70d379d 100644 --- a/src/test/ui/binop/binop-move-semantics.stderr +++ b/src/test/ui/binop/binop-move-semantics.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/binop-move-semantics.rs:18:5 + --> $DIR/binop-move-semantics.rs:8:5 | LL | x | - value moved here @@ -10,7 +10,7 @@ LL | x; //~ ERROR: use of moved value = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/binop-move-semantics.rs:24:5 + --> $DIR/binop-move-semantics.rs:14:5 | LL | x | - value moved here @@ -21,7 +21,7 @@ LL | x.clone(); //~ ERROR: use of moved value = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/binop-move-semantics.rs:31:5 + --> $DIR/binop-move-semantics.rs:21:5 | LL | let m = &x; | - borrow of `x` occurs here @@ -30,7 +30,7 @@ LL | x //~ ERROR: cannot move out of `x` because it is borrowed | ^ move out of `x` occurs here error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/binop-move-semantics.rs:33:5 + --> $DIR/binop-move-semantics.rs:23:5 | LL | let n = &mut y; | - borrow of `y` occurs here @@ -39,19 +39,19 @@ LL | y; //~ ERROR: cannot move out of `y` because it is borrowed | ^ move out of `y` occurs here error[E0507]: cannot move out of borrowed content - --> $DIR/binop-move-semantics.rs:40:5 + --> $DIR/binop-move-semantics.rs:30:5 | LL | *m //~ ERROR: cannot move out of borrowed content | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/binop-move-semantics.rs:42:5 + --> $DIR/binop-move-semantics.rs:32:5 | LL | *n; //~ ERROR: cannot move out of borrowed content | ^^ cannot move out of borrowed content error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable - --> $DIR/binop-move-semantics.rs:64:6 + --> $DIR/binop-move-semantics.rs:54:6 | LL | &mut f | - mutable borrow occurs here @@ -63,7 +63,7 @@ LL | &f; //~ ERROR: cannot borrow `f` as immutable because it is also borro | mutable borrow ends here error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immutable - --> $DIR/binop-move-semantics.rs:72:10 + --> $DIR/binop-move-semantics.rs:62:10 | LL | &f | - immutable borrow occurs here diff --git a/src/test/ui/binop/binop-mul-bool.rs b/src/test/ui/binop/binop-mul-bool.rs index a36477fc183..3d5349ba880 100644 --- a/src/test/ui/binop/binop-mul-bool.rs +++ b/src/test/ui/binop/binop-mul-bool.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:`*` cannot be applied to type `bool` fn main() { let x = true * false; } diff --git a/src/test/ui/binop/binop-mul-bool.stderr b/src/test/ui/binop/binop-mul-bool.stderr index 1df50876c26..194181b9c11 100644 --- a/src/test/ui/binop/binop-mul-bool.stderr +++ b/src/test/ui/binop/binop-mul-bool.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `*` cannot be applied to type `bool` - --> $DIR/binop-mul-bool.rs:13:21 + --> $DIR/binop-mul-bool.rs:3:21 | LL | fn main() { let x = true * false; } | ^^^^^^^^^^^^ diff --git a/src/test/ui/binop/binop-typeck.rs b/src/test/ui/binop/binop-typeck.rs index 8f17288e991..e1185cfba26 100644 --- a/src/test/ui/binop/binop-typeck.rs +++ b/src/test/ui/binop/binop-typeck.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // issue #500 fn main() { diff --git a/src/test/ui/binop/binop-typeck.stderr b/src/test/ui/binop/binop-typeck.stderr index 1ff81779f3d..928e836c0b5 100644 --- a/src/test/ui/binop/binop-typeck.stderr +++ b/src/test/ui/binop/binop-typeck.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `+` cannot be applied to type `bool` - --> $DIR/binop-typeck.rs:16:13 + --> $DIR/binop-typeck.rs:6:13 | LL | let z = x + y; | ^^^^^ diff --git a/src/test/ui/blind/blind-item-block-item-shadow.rs b/src/test/ui/blind/blind-item-block-item-shadow.rs index eeadecf627d..d90ef77e299 100644 --- a/src/test/ui/blind/blind-item-block-item-shadow.rs +++ b/src/test/ui/blind/blind-item-block-item-shadow.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub struct Bar; } fn main() { diff --git a/src/test/ui/blind/blind-item-block-item-shadow.stderr b/src/test/ui/blind/blind-item-block-item-shadow.stderr index a24ba5d97b1..d897bf56e10 100644 --- a/src/test/ui/blind/blind-item-block-item-shadow.stderr +++ b/src/test/ui/blind/blind-item-block-item-shadow.stderr @@ -1,5 +1,5 @@ error[E0255]: the name `Bar` is defined multiple times - --> $DIR/blind-item-block-item-shadow.rs:16:13 + --> $DIR/blind-item-block-item-shadow.rs:6:13 | LL | struct Bar; | ----------- previous definition of the type `Bar` here diff --git a/src/test/ui/blind/blind-item-block-middle.rs b/src/test/ui/blind/blind-item-block-middle.rs index a501a5cd3ec..6cd3f3bd412 100644 --- a/src/test/ui/blind/blind-item-block-middle.rs +++ b/src/test/ui/blind/blind-item-block-middle.rs @@ -1,12 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#![allow(non_camel_case_types)] mod foo { pub struct bar; } diff --git a/src/test/ui/blind/blind-item-block-middle.stderr b/src/test/ui/blind/blind-item-block-middle.stderr index 0123fd01173..389b63c0adf 100644 --- a/src/test/ui/blind/blind-item-block-middle.stderr +++ b/src/test/ui/blind/blind-item-block-middle.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/blind-item-block-middle.rs:14:9 + --> $DIR/blind-item-block-middle.rs:6:9 | LL | let bar = 5; - | ^^^ expected integral variable, found struct `foo::bar` + | ^^^ expected integer, found struct `foo::bar` | = note: expected type `{integer}` found type `foo::bar` diff --git a/src/test/ui/blind/blind-item-item-shadow.rs b/src/test/ui/blind/blind-item-item-shadow.rs index 38f9a552e1b..82d07ea7091 100644 --- a/src/test/ui/blind/blind-item-item-shadow.rs +++ b/src/test/ui/blind/blind-item-item-shadow.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub mod foo { } } use foo::foo; diff --git a/src/test/ui/blind/blind-item-item-shadow.stderr b/src/test/ui/blind/blind-item-item-shadow.stderr index 78741895344..f17d7843cd7 100644 --- a/src/test/ui/blind/blind-item-item-shadow.stderr +++ b/src/test/ui/blind/blind-item-item-shadow.stderr @@ -1,5 +1,5 @@ error[E0255]: the name `foo` is defined multiple times - --> $DIR/blind-item-item-shadow.rs:13:5 + --> $DIR/blind-item-item-shadow.rs:3:5 | LL | mod foo { pub mod foo { } } | ------- previous definition of the module `foo` here diff --git a/src/test/ui/block-result/block-must-not-have-result-do.rs b/src/test/ui/block-result/block-must-not-have-result-do.rs index 2a6c71dbe39..4fdb69778cb 100644 --- a/src/test/ui/block-result/block-must-not-have-result-do.rs +++ b/src/test/ui/block-result/block-must-not-have-result-do.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { loop { true //~ ERROR mismatched types diff --git a/src/test/ui/block-result/block-must-not-have-result-do.stderr b/src/test/ui/block-result/block-must-not-have-result-do.stderr index d864d767957..151315d34f2 100644 --- a/src/test/ui/block-result/block-must-not-have-result-do.stderr +++ b/src/test/ui/block-result/block-must-not-have-result-do.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/block-must-not-have-result-do.rs:13:9 + --> $DIR/block-must-not-have-result-do.rs:3:9 | LL | true //~ ERROR mismatched types | ^^^^ expected (), found bool diff --git a/src/test/ui/block-result/block-must-not-have-result-res.rs b/src/test/ui/block-result/block-must-not-have-result-res.rs index 8728685fc8b..7e86274a18e 100644 --- a/src/test/ui/block-result/block-must-not-have-result-res.rs +++ b/src/test/ui/block-result/block-must-not-have-result-res.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +struct R; -struct r; - -impl Drop for r { +impl Drop for R { fn drop(&mut self) { true //~ ERROR mismatched types } diff --git a/src/test/ui/block-result/block-must-not-have-result-res.stderr b/src/test/ui/block-result/block-must-not-have-result-res.stderr index 005a3ab9b5d..29885cac234 100644 --- a/src/test/ui/block-result/block-must-not-have-result-res.stderr +++ b/src/test/ui/block-result/block-must-not-have-result-res.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/block-must-not-have-result-res.rs:15:9 + --> $DIR/block-must-not-have-result-res.rs:5:9 | LL | fn drop(&mut self) { | - expected `()` because of default return type diff --git a/src/test/ui/block-result/block-must-not-have-result-while.rs b/src/test/ui/block-result/block-must-not-have-result-while.rs index a0fb470e1e4..96597631396 100644 --- a/src/test/ui/block-result/block-must-not-have-result-while.rs +++ b/src/test/ui/block-result/block-must-not-have-result-while.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { while true { true //~ ERROR mismatched types diff --git a/src/test/ui/block-result/block-must-not-have-result-while.stderr b/src/test/ui/block-result/block-must-not-have-result-while.stderr index a003ae871ca..d41eae1a432 100644 --- a/src/test/ui/block-result/block-must-not-have-result-while.stderr +++ b/src/test/ui/block-result/block-must-not-have-result-while.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/block-must-not-have-result-while.rs:13:9 + --> $DIR/block-must-not-have-result-while.rs:3:9 | LL | true //~ ERROR mismatched types | ^^^^ expected (), found bool diff --git a/src/test/ui/block-result/consider-removing-last-semi.rs b/src/test/ui/block-result/consider-removing-last-semi.rs index 0d4deb3c804..f8cdccba27e 100644 --- a/src/test/ui/block-result/consider-removing-last-semi.rs +++ b/src/test/ui/block-result/consider-removing-last-semi.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f() -> String { //~ ERROR mismatched types 0u8; "bla".to_string(); diff --git a/src/test/ui/block-result/consider-removing-last-semi.stderr b/src/test/ui/block-result/consider-removing-last-semi.stderr index a0855c31737..1bf17db21ac 100644 --- a/src/test/ui/block-result/consider-removing-last-semi.stderr +++ b/src/test/ui/block-result/consider-removing-last-semi.stderr @@ -1,27 +1,27 @@ error[E0308]: mismatched types - --> $DIR/consider-removing-last-semi.rs:11:18 + --> $DIR/consider-removing-last-semi.rs:1:11 | -LL | fn f() -> String { //~ ERROR mismatched types - | __________________^ -LL | | 0u8; -LL | | "bla".to_string(); - | | - help: consider removing this semicolon -LL | | } - | |_^ expected struct `std::string::String`, found () +LL | fn f() -> String { //~ ERROR mismatched types + | - ^^^^^^ expected struct `std::string::String`, found () + | | + | this function's body doesn't return +LL | 0u8; +LL | "bla".to_string(); + | - help: consider removing this semicolon | = note: expected type `std::string::String` found type `()` error[E0308]: mismatched types - --> $DIR/consider-removing-last-semi.rs:16:18 + --> $DIR/consider-removing-last-semi.rs:6:11 | -LL | fn g() -> String { //~ ERROR mismatched types - | __________________^ -LL | | "this won't work".to_string(); -LL | | "removeme".to_string(); - | | - help: consider removing this semicolon -LL | | } - | |_^ expected struct `std::string::String`, found () +LL | fn g() -> String { //~ ERROR mismatched types + | - ^^^^^^ expected struct `std::string::String`, found () + | | + | this function's body doesn't return +LL | "this won't work".to_string(); +LL | "removeme".to_string(); + | - help: consider removing this semicolon | = note: expected type `std::string::String` found type `()` diff --git a/src/test/ui/block-result/issue-11714.rs b/src/test/ui/block-result/issue-11714.rs index bc3936582aa..3dda7e80191 100644 --- a/src/test/ui/block-result/issue-11714.rs +++ b/src/test/ui/block-result/issue-11714.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn blah() -> i32 { //~ ERROR mismatched types 1 diff --git a/src/test/ui/block-result/issue-11714.stderr b/src/test/ui/block-result/issue-11714.stderr index e9cd7281234..2c13b287669 100644 --- a/src/test/ui/block-result/issue-11714.stderr +++ b/src/test/ui/block-result/issue-11714.stderr @@ -1,14 +1,13 @@ error[E0308]: mismatched types - --> $DIR/issue-11714.rs:11:18 + --> $DIR/issue-11714.rs:1:14 | -LL | fn blah() -> i32 { //~ ERROR mismatched types - | __________________^ -LL | | 1 -LL | | -LL | | ; - | | - help: consider removing this semicolon -LL | | } - | |_^ expected i32, found () +LL | fn blah() -> i32 { //~ ERROR mismatched types + | ---- ^^^ expected i32, found () + | | + | this function's body doesn't return +... +LL | ; + | - help: consider removing this semicolon | = note: expected type `i32` found type `()` diff --git a/src/test/ui/block-result/issue-13428.rs b/src/test/ui/block-result/issue-13428.rs index 36520301f55..ac85964353a 100644 --- a/src/test/ui/block-result/issue-13428.rs +++ b/src/test/ui/block-result/issue-13428.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #13428 fn foo() -> String { //~ ERROR mismatched types diff --git a/src/test/ui/block-result/issue-13428.stderr b/src/test/ui/block-result/issue-13428.stderr index 888ee5a2d19..91e926eb5a7 100644 --- a/src/test/ui/block-result/issue-13428.stderr +++ b/src/test/ui/block-result/issue-13428.stderr @@ -1,30 +1,27 @@ error[E0308]: mismatched types - --> $DIR/issue-13428.rs:13:20 + --> $DIR/issue-13428.rs:3:13 | -LL | fn foo() -> String { //~ ERROR mismatched types - | ____________________^ -LL | | format!("Hello {}", -LL | | "world") -LL | | // Put the trailing semicolon on its own line to test that the -LL | | // note message gets the offending semicolon exactly -LL | | ; - | | - help: consider removing this semicolon -LL | | } - | |_^ expected struct `std::string::String`, found () +LL | fn foo() -> String { //~ ERROR mismatched types + | --- ^^^^^^ expected struct `std::string::String`, found () + | | + | this function's body doesn't return +... +LL | ; + | - help: consider removing this semicolon | = note: expected type `std::string::String` found type `()` error[E0308]: mismatched types - --> $DIR/issue-13428.rs:21:20 + --> $DIR/issue-13428.rs:11:13 | -LL | fn bar() -> String { //~ ERROR mismatched types - | ____________________^ -LL | | "foobar".to_string() -LL | | ; - | | - help: consider removing this semicolon -LL | | } - | |_^ expected struct `std::string::String`, found () +LL | fn bar() -> String { //~ ERROR mismatched types + | --- ^^^^^^ expected struct `std::string::String`, found () + | | + | this function's body doesn't return +LL | "foobar".to_string() +LL | ; + | - help: consider removing this semicolon | = note: expected type `std::string::String` found type `()` diff --git a/src/test/ui/block-result/issue-13624.rs b/src/test/ui/block-result/issue-13624.rs index e4ed87c3cb0..7b6a0775e16 100644 --- a/src/test/ui/block-result/issue-13624.rs +++ b/src/test/ui/block-result/issue-13624.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { pub enum Enum { EnumStructVariant { x: u8, y: u8, z: u8 } diff --git a/src/test/ui/block-result/issue-13624.stderr b/src/test/ui/block-result/issue-13624.stderr index e54e22522f2..417667a5354 100644 --- a/src/test/ui/block-result/issue-13624.stderr +++ b/src/test/ui/block-result/issue-13624.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-13624.rs:17:5 + --> $DIR/issue-13624.rs:7:5 | LL | pub fn get_enum_struct_variant() -> () { | -- expected `()` because of return type @@ -10,8 +10,10 @@ LL | Enum::EnumStructVariant { x: 1, y: 2, z: 3 } found type `a::Enum` error[E0308]: mismatched types - --> $DIR/issue-13624.rs:32:9 + --> $DIR/issue-13624.rs:22:9 | +LL | match enum_struct_variant { + | ------------------- this match expression has type `()` LL | a::Enum::EnumStructVariant { x, y, z } => { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found enum `a::Enum` | diff --git a/src/test/ui/block-result/issue-20862.rs b/src/test/ui/block-result/issue-20862.rs index 9df63583998..e435fd7aee9 100644 --- a/src/test/ui/block-result/issue-20862.rs +++ b/src/test/ui/block-result/issue-20862.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(x: i32) { |y| x + y //~^ ERROR: mismatched types diff --git a/src/test/ui/block-result/issue-20862.stderr b/src/test/ui/block-result/issue-20862.stderr index 194cfab8527..fce06f5b45d 100644 --- a/src/test/ui/block-result/issue-20862.stderr +++ b/src/test/ui/block-result/issue-20862.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-20862.rs:12:5 + --> $DIR/issue-20862.rs:2:5 | LL | fn foo(x: i32) { | - possibly return type missing here? @@ -7,10 +7,10 @@ LL | |y| x + y | ^^^^^^^^^ expected (), found closure | = note: expected type `()` - found type `[closure@$DIR/issue-20862.rs:12:5: 12:14 x:_]` + found type `[closure@$DIR/issue-20862.rs:2:5: 2:14 x:_]` error[E0618]: expected function, found `()` - --> $DIR/issue-20862.rs:17:13 + --> $DIR/issue-20862.rs:7:13 | LL | / fn foo(x: i32) { LL | | |y| x + y diff --git a/src/test/ui/block-result/issue-22645.rs b/src/test/ui/block-result/issue-22645.rs index 81f66e3e2cf..5f7fb8dd32b 100644 --- a/src/test/ui/block-result/issue-22645.rs +++ b/src/test/ui/block-result/issue-22645.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Add; trait Scalar {} diff --git a/src/test/ui/block-result/issue-22645.stderr b/src/test/ui/block-result/issue-22645.stderr index c94dd708626..9cb1a6c5d7d 100644 --- a/src/test/ui/block-result/issue-22645.stderr +++ b/src/test/ui/block-result/issue-22645.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `{integer}: Scalar` is not satisfied - --> $DIR/issue-22645.rs:25:5 + --> $DIR/issue-22645.rs:15:5 | LL | b + 3 //~ ERROR E0277 | ^ the trait `Scalar` is not implemented for `{integer}` @@ -9,7 +9,7 @@ LL | b + 3 //~ ERROR E0277 = note: required because of the requirements on the impl of `std::ops::Add<{integer}>` for `Bob` error[E0308]: mismatched types - --> $DIR/issue-22645.rs:25:3 + --> $DIR/issue-22645.rs:15:3 | LL | fn main() { | - expected `()` because of default return type diff --git a/src/test/ui/block-result/issue-3563.rs b/src/test/ui/block-result/issue-3563.rs index 31a363a6b86..9b313d3e9b2 100644 --- a/src/test/ui/block-result/issue-3563.rs +++ b/src/test/ui/block-result/issue-3563.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait A { fn a(&self) { || self.b() diff --git a/src/test/ui/block-result/issue-3563.stderr b/src/test/ui/block-result/issue-3563.stderr index c4dee857574..a6346a5233f 100644 --- a/src/test/ui/block-result/issue-3563.stderr +++ b/src/test/ui/block-result/issue-3563.stderr @@ -1,10 +1,8 @@ error[E0599]: no method named `b` found for type `&Self` in the current scope - --> $DIR/issue-3563.rs:13:17 + --> $DIR/issue-3563.rs:3:17 | LL | || self.b() - | ^ - | - = help: did you mean `a`? + | ^ help: did you mean: `a` error: aborting due to previous error diff --git a/src/test/ui/block-result/issue-5500.rs b/src/test/ui/block-result/issue-5500.rs index 1cbb7588e17..5a549bb07ea 100644 --- a/src/test/ui/block-result/issue-5500.rs +++ b/src/test/ui/block-result/issue-5500.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { &panic!() //~^ ERROR mismatched types diff --git a/src/test/ui/block-result/issue-5500.stderr b/src/test/ui/block-result/issue-5500.stderr index 27018b5da7b..0d9c9d8143d 100644 --- a/src/test/ui/block-result/issue-5500.stderr +++ b/src/test/ui/block-result/issue-5500.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-5500.rs:12:5 + --> $DIR/issue-5500.rs:2:5 | LL | fn main() { | - expected `()` because of default return type diff --git a/src/test/ui/block-result/unexpected-return-on-unit.rs b/src/test/ui/block-result/unexpected-return-on-unit.rs index b116888d63c..2fcbfe8c068 100644 --- a/src/test/ui/block-result/unexpected-return-on-unit.rs +++ b/src/test/ui/block-result/unexpected-return-on-unit.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we do some basic error correction in the tokeniser (and don't spew // too many bogus errors). diff --git a/src/test/ui/block-result/unexpected-return-on-unit.stderr b/src/test/ui/block-result/unexpected-return-on-unit.stderr index 585cfb3d0d3..50af4734202 100644 --- a/src/test/ui/block-result/unexpected-return-on-unit.stderr +++ b/src/test/ui/block-result/unexpected-return-on-unit.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/unexpected-return-on-unit.rs:19:5 + --> $DIR/unexpected-return-on-unit.rs:9:5 | LL | foo() //~ ERROR mismatched types | ^^^^^ expected (), found usize diff --git a/src/test/ui/bogus-tag.rs b/src/test/ui/bogus-tag.rs index 46536cc8575..c594385eec2 100644 --- a/src/test/ui/bogus-tag.rs +++ b/src/test/ui/bogus-tag.rs @@ -1,21 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), } +enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), } fn main() { - let red: color = color::rgb(255, 0, 0); + let red: Color = Color::Rgb(255, 0, 0); match red { - color::rgb(r, g, b) => { println!("rgb"); } - color::hsl(h, s, l) => { println!("hsl"); } - //~^ ERROR no variant + Color::Rgb(r, g, b) => { println!("rgb"); } + Color::Hsl(h, s, l) => { println!("hsl"); } + //~^ ERROR no variant } } diff --git a/src/test/ui/bogus-tag.stderr b/src/test/ui/bogus-tag.stderr index f9917b07f07..3750df84172 100644 --- a/src/test/ui/bogus-tag.stderr +++ b/src/test/ui/bogus-tag.stderr @@ -1,11 +1,11 @@ -error[E0599]: no variant named `hsl` found for type `color` in the current scope - --> $DIR/bogus-tag.rs:18:7 +error[E0599]: no variant named `Hsl` found for type `Color` in the current scope + --> $DIR/bogus-tag.rs:7:16 | -LL | enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), } - | ---------- variant `hsl` not found here +LL | enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), } + | ---------- variant `Hsl` not found here ... -LL | color::hsl(h, s, l) => { println!("hsl"); } - | ^^^^^^^^^^^^^^^^^^^ variant not found in `color` +LL | Color::Hsl(h, s, l) => { println!("hsl"); } + | -------^^^--------- variant not found in `Color` error: aborting due to previous error diff --git a/src/test/ui/borrowck/assign_mutable_fields.nll.stderr b/src/test/ui/borrowck/assign_mutable_fields.nll.stderr index 59af97d9f13..35101df4e0a 100644 --- a/src/test/ui/borrowck/assign_mutable_fields.nll.stderr +++ b/src/test/ui/borrowck/assign_mutable_fields.nll.stderr @@ -1,11 +1,11 @@ error[E0381]: assign to part of possibly uninitialized variable: `x` - --> $DIR/assign_mutable_fields.rs:19:5 + --> $DIR/assign_mutable_fields.rs:9:5 | LL | x.0 = 1; | ^^^^^^^ use of possibly uninitialized `x` error[E0381]: assign to part of possibly uninitialized variable: `x` - --> $DIR/assign_mutable_fields.rs:27:5 + --> $DIR/assign_mutable_fields.rs:17:5 | LL | x.0 = 1; | ^^^^^^^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/assign_mutable_fields.rs b/src/test/ui/borrowck/assign_mutable_fields.rs index 4e41f44ef5b..85d6f3b74c0 100644 --- a/src/test/ui/borrowck/assign_mutable_fields.rs +++ b/src/test/ui/borrowck/assign_mutable_fields.rs @@ -1,18 +1,8 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Currently, we permit you to assign to individual fields of a mut // var, but we do not permit you to use the complete var afterwards. // We hope to fix this at some point. // -// FIXME(#21232) +// FIXME(#54987) fn assign_both_fields_and_use() { let mut x: (u32, u32); diff --git a/src/test/ui/borrowck/assign_mutable_fields.stderr b/src/test/ui/borrowck/assign_mutable_fields.stderr index 677887babd0..9024e7cf01c 100644 --- a/src/test/ui/borrowck/assign_mutable_fields.stderr +++ b/src/test/ui/borrowck/assign_mutable_fields.stderr @@ -1,17 +1,17 @@ error[E0381]: use of possibly uninitialized variable: `x.0` - --> $DIR/assign_mutable_fields.rs:21:10 + --> $DIR/assign_mutable_fields.rs:11:10 | LL | drop(x.0); //~ ERROR | ^^^ use of possibly uninitialized `x.0` error[E0381]: use of possibly uninitialized variable: `x.1` - --> $DIR/assign_mutable_fields.rs:22:10 + --> $DIR/assign_mutable_fields.rs:12:10 | LL | drop(x.1); //~ ERROR | ^^^ use of possibly uninitialized `x.1` error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/assign_mutable_fields.rs:29:10 + --> $DIR/assign_mutable_fields.rs:19:10 | LL | drop(x); //~ ERROR | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr index 631add3e62d..9174a697611 100644 --- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr +++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr @@ -1,71 +1,71 @@ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure - --> $DIR/borrow-immutable-upvar-mutation.rs:25:27 + --> $DIR/borrow-immutable-upvar-mutation.rs:15:27 | LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/borrow-immutable-upvar-mutation.rs:25:24 + --> $DIR/borrow-immutable-upvar-mutation.rs:15:24 | LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign | ^^^^^^^^^ error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/borrow-immutable-upvar-mutation.rs:28:31 + --> $DIR/borrow-immutable-upvar-mutation.rs:18:31 | LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/borrow-immutable-upvar-mutation.rs:28:24 + --> $DIR/borrow-immutable-upvar-mutation.rs:18:24 | LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow | ^^^^^^^^^^^^^^ error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure - --> $DIR/borrow-immutable-upvar-mutation.rs:31:55 + --> $DIR/borrow-immutable-upvar-mutation.rs:21:55 | LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/borrow-immutable-upvar-mutation.rs:31:52 + --> $DIR/borrow-immutable-upvar-mutation.rs:21:52 | LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign | ^^^^^^^^^ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure - --> $DIR/borrow-immutable-upvar-mutation.rs:37:32 + --> $DIR/borrow-immutable-upvar-mutation.rs:27:32 | LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/borrow-immutable-upvar-mutation.rs:37:24 + --> $DIR/borrow-immutable-upvar-mutation.rs:27:24 | LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign | ^^^^^^^^^^^^^^ error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/borrow-immutable-upvar-mutation.rs:40:36 + --> $DIR/borrow-immutable-upvar-mutation.rs:30:36 | LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/borrow-immutable-upvar-mutation.rs:40:24 + --> $DIR/borrow-immutable-upvar-mutation.rs:30:24 | LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow | ^^^^^^^^^^^^^^^^^^^ error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure - --> $DIR/borrow-immutable-upvar-mutation.rs:43:65 + --> $DIR/borrow-immutable-upvar-mutation.rs:33:65 | LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/borrow-immutable-upvar-mutation.rs:43:57 + --> $DIR/borrow-immutable-upvar-mutation.rs:33:57 | LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.rs b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.rs index 00f51973a41..fed8bc95b6b 100644 --- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.rs +++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] // Tests that we can't assign to or mutably borrow upvars from `Fn` diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr index 740e1820f4f..505604ab597 100644 --- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr +++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr @@ -1,73 +1,73 @@ error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure - --> $DIR/borrow-immutable-upvar-mutation.rs:25:27 + --> $DIR/borrow-immutable-upvar-mutation.rs:15:27 | LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign | ^^^^^^ | help: consider changing this closure to take self by mutable reference - --> $DIR/borrow-immutable-upvar-mutation.rs:25:24 + --> $DIR/borrow-immutable-upvar-mutation.rs:15:24 | LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign | ^^^^^^^^^ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure - --> $DIR/borrow-immutable-upvar-mutation.rs:28:36 + --> $DIR/borrow-immutable-upvar-mutation.rs:18:36 | LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow | ^ | help: consider changing this closure to take self by mutable reference - --> $DIR/borrow-immutable-upvar-mutation.rs:28:24 + --> $DIR/borrow-immutable-upvar-mutation.rs:18:24 | LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow | ^^^^^^^^^^^^^^ error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure - --> $DIR/borrow-immutable-upvar-mutation.rs:31:55 + --> $DIR/borrow-immutable-upvar-mutation.rs:21:55 | LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign | ^^^^^^ | help: consider changing this closure to take self by mutable reference - --> $DIR/borrow-immutable-upvar-mutation.rs:31:52 + --> $DIR/borrow-immutable-upvar-mutation.rs:21:52 | LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign | ^^^^^^^^^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure - --> $DIR/borrow-immutable-upvar-mutation.rs:37:32 + --> $DIR/borrow-immutable-upvar-mutation.rs:27:32 | LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications help: consider changing this closure to take self by mutable reference - --> $DIR/borrow-immutable-upvar-mutation.rs:37:24 + --> $DIR/borrow-immutable-upvar-mutation.rs:27:24 | LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign | ^^^^^^^^^^^^^^ error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable - --> $DIR/borrow-immutable-upvar-mutation.rs:40:41 + --> $DIR/borrow-immutable-upvar-mutation.rs:30:41 | LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow | ^ | help: consider changing this closure to take self by mutable reference - --> $DIR/borrow-immutable-upvar-mutation.rs:40:24 + --> $DIR/borrow-immutable-upvar-mutation.rs:30:24 | LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow | ^^^^^^^^^^^^^^^^^^^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure - --> $DIR/borrow-immutable-upvar-mutation.rs:43:65 + --> $DIR/borrow-immutable-upvar-mutation.rs:33:65 | LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications help: consider changing this closure to take self by mutable reference - --> $DIR/borrow-immutable-upvar-mutation.rs:43:57 + --> $DIR/borrow-immutable-upvar-mutation.rs:33:57 | LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr b/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr index 873581d9105..72a29b864a4 100644 --- a/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr +++ b/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/borrow-tuple-fields.rs:22:13 + --> $DIR/borrow-tuple-fields.rs:12:13 | LL | let r = &x.0; | ---- borrow of `x.0` occurs here @@ -10,7 +10,7 @@ LL | r.use_ref(); | - borrow later used here error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable - --> $DIR/borrow-tuple-fields.rs:28:13 + --> $DIR/borrow-tuple-fields.rs:18:13 | LL | let a = &x.0; | ---- immutable borrow occurs here @@ -20,7 +20,7 @@ LL | a.use_ref(); | - immutable borrow later used here error[E0499]: cannot borrow `x.0` as mutable more than once at a time - --> $DIR/borrow-tuple-fields.rs:33:13 + --> $DIR/borrow-tuple-fields.rs:23:13 | LL | let a = &mut x.0; | -------- first mutable borrow occurs here @@ -30,7 +30,7 @@ LL | a.use_ref(); | - first borrow later used here error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/borrow-tuple-fields.rs:38:13 + --> $DIR/borrow-tuple-fields.rs:28:13 | LL | let r = &x.0; | ---- borrow of `x.0` occurs here @@ -40,7 +40,7 @@ LL | r.use_ref(); | - borrow later used here error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable - --> $DIR/borrow-tuple-fields.rs:43:13 + --> $DIR/borrow-tuple-fields.rs:33:13 | LL | let a = &x.0; | ---- immutable borrow occurs here @@ -50,7 +50,7 @@ LL | a.use_ref(); | - immutable borrow later used here error[E0499]: cannot borrow `x.0` as mutable more than once at a time - --> $DIR/borrow-tuple-fields.rs:48:13 + --> $DIR/borrow-tuple-fields.rs:38:13 | LL | let a = &mut x.0; | -------- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrow-tuple-fields.rs b/src/test/ui/borrowck/borrow-tuple-fields.rs index de3a5c799cb..3e24a1b29c9 100644 --- a/src/test/ui/borrowck/borrow-tuple-fields.rs +++ b/src/test/ui/borrowck/borrow-tuple-fields.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] diff --git a/src/test/ui/borrowck/borrow-tuple-fields.stderr b/src/test/ui/borrowck/borrow-tuple-fields.stderr index 1cbfcdfc06a..a62e7287e68 100644 --- a/src/test/ui/borrowck/borrow-tuple-fields.stderr +++ b/src/test/ui/borrowck/borrow-tuple-fields.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/borrow-tuple-fields.rs:22:9 + --> $DIR/borrow-tuple-fields.rs:12:9 | LL | let r = &x.0; | --- borrow of `x.0` occurs here @@ -7,7 +7,7 @@ LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed | ^ move out of `x` occurs here error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable - --> $DIR/borrow-tuple-fields.rs:28:18 + --> $DIR/borrow-tuple-fields.rs:18:18 | LL | let a = &x.0; | --- immutable borrow occurs here @@ -18,7 +18,7 @@ LL | } | - immutable borrow ends here error[E0499]: cannot borrow `x.0` as mutable more than once at a time - --> $DIR/borrow-tuple-fields.rs:33:18 + --> $DIR/borrow-tuple-fields.rs:23:18 | LL | let a = &mut x.0; | --- first mutable borrow occurs here @@ -29,7 +29,7 @@ LL | } | - first borrow ends here error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/borrow-tuple-fields.rs:38:9 + --> $DIR/borrow-tuple-fields.rs:28:9 | LL | let r = &x.0; | --- borrow of `x.0` occurs here @@ -37,7 +37,7 @@ LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed | ^ move out of `x` occurs here error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable - --> $DIR/borrow-tuple-fields.rs:43:18 + --> $DIR/borrow-tuple-fields.rs:33:18 | LL | let a = &x.0; | --- immutable borrow occurs here @@ -48,7 +48,7 @@ LL | } | - immutable borrow ends here error[E0499]: cannot borrow `x.0` as mutable more than once at a time - --> $DIR/borrow-tuple-fields.rs:48:18 + --> $DIR/borrow-tuple-fields.rs:38:18 | LL | let a = &mut x.0; | --- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-access-permissions.ast.nll.stderr b/src/test/ui/borrowck/borrowck-access-permissions.ast.nll.stderr index 0df5e0c6e66..0d771a55d59 100644 --- a/src/test/ui/borrowck/borrowck-access-permissions.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-access-permissions.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-access-permissions.rs:22:19 + --> $DIR/borrowck-access-permissions.rs:12:19 | LL | let x = 1; | - help: consider changing this to be mutable: `mut x` @@ -8,13 +8,13 @@ LL | let _y1 = &mut x; //[ast]~ ERROR [E0596] | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow immutable static item `static_x` as mutable - --> $DIR/borrowck-access-permissions.rs:28:19 + --> $DIR/borrowck-access-permissions.rs:18:19 | LL | let _y1 = &mut static_x; //[ast]~ ERROR [E0596] | ^^^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `*box_x` as mutable, as `box_x` is not declared as mutable - --> $DIR/borrowck-access-permissions.rs:37:19 + --> $DIR/borrowck-access-permissions.rs:27:19 | LL | let box_x = Box::new(1); | ----- help: consider changing this to be mutable: `mut box_x` @@ -23,7 +23,7 @@ LL | let _y1 = &mut *box_x; //[ast]~ ERROR [E0596] | ^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `*ref_x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-access-permissions.rs:46:19 + --> $DIR/borrowck-access-permissions.rs:36:19 | LL | let ref_x = &x; | -- help: consider changing this to be a mutable reference: `&mut x` @@ -32,7 +32,7 @@ LL | let _y1 = &mut *ref_x; //[ast]~ ERROR [E0596] | ^^^^^^^^^^^ `ref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` pointer - --> $DIR/borrowck-access-permissions.rs:56:23 + --> $DIR/borrowck-access-permissions.rs:46:23 | LL | let ptr_x : *const _ = &x; | -- help: consider changing this to be a mutable pointer: `&mut x` @@ -41,7 +41,7 @@ LL | let _y1 = &mut *ptr_x; //[ast]~ ERROR [E0596] | ^^^^^^^^^^^ `ptr_x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-access-permissions.rs:66:18 + --> $DIR/borrowck-access-permissions.rs:56:18 | LL | let foo_ref = &foo; | ---- help: consider changing this to be a mutable reference: `&mut foo` diff --git a/src/test/ui/borrowck/borrowck-access-permissions.ast.stderr b/src/test/ui/borrowck/borrowck-access-permissions.ast.stderr index c2ecdb33ba9..4b0e261b174 100644 --- a/src/test/ui/borrowck/borrowck-access-permissions.ast.stderr +++ b/src/test/ui/borrowck/borrowck-access-permissions.ast.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable - --> $DIR/borrowck-access-permissions.rs:22:24 + --> $DIR/borrowck-access-permissions.rs:12:24 | LL | let x = 1; | - help: make this binding mutable: `mut x` @@ -8,13 +8,13 @@ LL | let _y1 = &mut x; //[ast]~ ERROR [E0596] | ^ cannot borrow mutably error[E0596]: cannot borrow immutable static item as mutable - --> $DIR/borrowck-access-permissions.rs:28:24 + --> $DIR/borrowck-access-permissions.rs:18:24 | LL | let _y1 = &mut static_x; //[ast]~ ERROR [E0596] | ^^^^^^^^ error[E0596]: cannot borrow immutable `Box` content `*box_x` as mutable - --> $DIR/borrowck-access-permissions.rs:37:24 + --> $DIR/borrowck-access-permissions.rs:27:24 | LL | let box_x = Box::new(1); | ----- help: make this binding mutable: `mut box_x` @@ -23,19 +23,19 @@ LL | let _y1 = &mut *box_x; //[ast]~ ERROR [E0596] | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content `*ref_x` as mutable - --> $DIR/borrowck-access-permissions.rs:46:24 + --> $DIR/borrowck-access-permissions.rs:36:24 | LL | let _y1 = &mut *ref_x; //[ast]~ ERROR [E0596] | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow immutable dereference of raw pointer `*ptr_x` as mutable - --> $DIR/borrowck-access-permissions.rs:56:28 + --> $DIR/borrowck-access-permissions.rs:46:28 | LL | let _y1 = &mut *ptr_x; //[ast]~ ERROR [E0596] | ^^^^^^ cannot borrow as mutable error[E0389]: cannot borrow data mutably in a `&` reference - --> $DIR/borrowck-access-permissions.rs:66:23 + --> $DIR/borrowck-access-permissions.rs:56:23 | LL | let _y = &mut *foo_ref.f; //[ast]~ ERROR [E0389] | ^^^^^^^^^^ assignment into an immutable reference diff --git a/src/test/ui/borrowck/borrowck-access-permissions.mir.stderr b/src/test/ui/borrowck/borrowck-access-permissions.mir.stderr index 0df5e0c6e66..0d771a55d59 100644 --- a/src/test/ui/borrowck/borrowck-access-permissions.mir.stderr +++ b/src/test/ui/borrowck/borrowck-access-permissions.mir.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-access-permissions.rs:22:19 + --> $DIR/borrowck-access-permissions.rs:12:19 | LL | let x = 1; | - help: consider changing this to be mutable: `mut x` @@ -8,13 +8,13 @@ LL | let _y1 = &mut x; //[ast]~ ERROR [E0596] | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow immutable static item `static_x` as mutable - --> $DIR/borrowck-access-permissions.rs:28:19 + --> $DIR/borrowck-access-permissions.rs:18:19 | LL | let _y1 = &mut static_x; //[ast]~ ERROR [E0596] | ^^^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `*box_x` as mutable, as `box_x` is not declared as mutable - --> $DIR/borrowck-access-permissions.rs:37:19 + --> $DIR/borrowck-access-permissions.rs:27:19 | LL | let box_x = Box::new(1); | ----- help: consider changing this to be mutable: `mut box_x` @@ -23,7 +23,7 @@ LL | let _y1 = &mut *box_x; //[ast]~ ERROR [E0596] | ^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `*ref_x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-access-permissions.rs:46:19 + --> $DIR/borrowck-access-permissions.rs:36:19 | LL | let ref_x = &x; | -- help: consider changing this to be a mutable reference: `&mut x` @@ -32,7 +32,7 @@ LL | let _y1 = &mut *ref_x; //[ast]~ ERROR [E0596] | ^^^^^^^^^^^ `ref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` pointer - --> $DIR/borrowck-access-permissions.rs:56:23 + --> $DIR/borrowck-access-permissions.rs:46:23 | LL | let ptr_x : *const _ = &x; | -- help: consider changing this to be a mutable pointer: `&mut x` @@ -41,7 +41,7 @@ LL | let _y1 = &mut *ptr_x; //[ast]~ ERROR [E0596] | ^^^^^^^^^^^ `ptr_x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-access-permissions.rs:66:18 + --> $DIR/borrowck-access-permissions.rs:56:18 | LL | let foo_ref = &foo; | ---- help: consider changing this to be a mutable reference: `&mut foo` diff --git a/src/test/ui/borrowck/borrowck-access-permissions.rs b/src/test/ui/borrowck/borrowck-access-permissions.rs index 00a3da86074..993742f427e 100644 --- a/src/test/ui/borrowck/borrowck-access-permissions.rs +++ b/src/test/ui/borrowck/borrowck-access-permissions.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-and-init.nll.stderr b/src/test/ui/borrowck/borrowck-and-init.nll.stderr index 0b1b157f3e0..b4b02cf208a 100644 --- a/src/test/ui/borrowck/borrowck-and-init.nll.stderr +++ b/src/test/ui/borrowck/borrowck-and-init.nll.stderr @@ -1,5 +1,5 @@ error[E0381]: borrow of possibly uninitialized variable: `i` - --> $DIR/borrowck-and-init.rs:15:20 + --> $DIR/borrowck-and-init.rs:5:20 | LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` | ^ use of possibly uninitialized `i` diff --git a/src/test/ui/borrowck/borrowck-and-init.rs b/src/test/ui/borrowck/borrowck-and-init.rs index 92f16d8ffce..ff076c55cad 100644 --- a/src/test/ui/borrowck/borrowck-and-init.rs +++ b/src/test/ui/borrowck/borrowck-and-init.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let i: isize; diff --git a/src/test/ui/borrowck/borrowck-and-init.stderr b/src/test/ui/borrowck/borrowck-and-init.stderr index 2cbc57d66e9..42b658871df 100644 --- a/src/test/ui/borrowck/borrowck-and-init.stderr +++ b/src/test/ui/borrowck/borrowck-and-init.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `i` - --> $DIR/borrowck-and-init.rs:15:20 + --> $DIR/borrowck-and-init.rs:5:20 | LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` | ^ use of possibly uninitialized `i` diff --git a/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr index 4d61840d9e8..43c74988f9e 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time - --> $DIR/borrowck-anon-fields-struct.rs:39:11 + --> $DIR/borrowck-anon-fields-struct.rs:29:11 | LL | Y(ref mut a, _) => a | --------- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-anon-fields-struct.rs b/src/test/ui/borrowck/borrowck-anon-fields-struct.rs index 5ee2b89dd98..a05dfe62b28 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-struct.rs +++ b/src/test/ui/borrowck/borrowck-anon-fields-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that we are able to distinguish when loans borrow different // anonymous fields of a tuple vs the same anonymous field. diff --git a/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr b/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr index e635a2392e1..9c36a9fe875 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time - --> $DIR/borrowck-anon-fields-struct.rs:39:11 + --> $DIR/borrowck-anon-fields-struct.rs:29:11 | LL | Y(ref mut a, _) => a | --------- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr index f36741e9a02..15859040f06 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time - --> $DIR/borrowck-anon-fields-tuple.rs:37:10 + --> $DIR/borrowck-anon-fields-tuple.rs:27:10 | LL | (ref mut a, _) => a | --------- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-anon-fields-tuple.rs b/src/test/ui/borrowck/borrowck-anon-fields-tuple.rs index ebaed01756f..de2a8d83268 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-tuple.rs +++ b/src/test/ui/borrowck/borrowck-anon-fields-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that we are able to distinguish when loans borrow different // anonymous fields of a tuple vs the same anonymous field. diff --git a/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr b/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr index d05d1c31f9d..4b823f396af 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time - --> $DIR/borrowck-anon-fields-tuple.rs:37:10 + --> $DIR/borrowck-anon-fields-tuple.rs:27:10 | LL | (ref mut a, _) => a | --------- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr index 17722bf226d..2f4cf7dd800 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr @@ -1,5 +1,32 @@ +warning[E0503]: cannot use `y` because it was mutably borrowed + --> $DIR/borrowck-anon-fields-variant.rs:17:7 + | +LL | Foo::Y(ref mut a, _) => a, + | --------- borrow of `y.0` occurs here +... +LL | Foo::Y(_, ref mut b) => b, + | ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0` +... +LL | *a += 1; + | ------- borrow later used here + | + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future + +error[E0503]: cannot use `y` because it was mutably borrowed + --> $DIR/borrowck-anon-fields-variant.rs:34:7 + | +LL | Foo::Y(ref mut a, _) => a, + | --------- borrow of `y.0` occurs here +... +LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow + | ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0` +... +LL | *a += 1; + | ------- borrow later used here + error[E0499]: cannot borrow `y.0` as mutable more than once at a time - --> $DIR/borrowck-anon-fields-variant.rs:44:14 + --> $DIR/borrowck-anon-fields-variant.rs:34:14 | LL | Foo::Y(ref mut a, _) => a, | --------- first mutable borrow occurs here @@ -10,6 +37,7 @@ LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow LL | *a += 1; | ------- first borrow later used here -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0499`. +Some errors occurred: E0499, E0503. +For more information about an error, try `rustc --explain E0499`. diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.rs b/src/test/ui/borrowck/borrowck-anon-fields-variant.rs index 4e1b85283a6..c27435608c4 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-variant.rs +++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that we are able to distinguish when loans borrow different // anonymous fields of an enum variant vs the same anonymous field. diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr index 817d0154a63..1e94cdebaec 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time - --> $DIR/borrowck-anon-fields-variant.rs:44:14 + --> $DIR/borrowck-anon-fields-variant.rs:34:14 | LL | Foo::Y(ref mut a, _) => a, | --------- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-argument.nll.stderr b/src/test/ui/borrowck/borrowck-argument.nll.stderr index 4470566eabb..9e7f0930ee5 100644 --- a/src/test/ui/borrowck/borrowck-argument.nll.stderr +++ b/src/test/ui/borrowck/borrowck-argument.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable - --> $DIR/borrowck-argument.rs:20:5 + --> $DIR/borrowck-argument.rs:10:5 | LL | fn func(arg: S) { | --- help: consider changing this to be mutable: `mut arg` @@ -7,7 +7,7 @@ LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument | ^^^ cannot borrow as mutable error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable - --> $DIR/borrowck-argument.rs:25:9 + --> $DIR/borrowck-argument.rs:15:9 | LL | fn method(&self, arg: S) { | --- help: consider changing this to be mutable: `mut arg` @@ -15,7 +15,7 @@ LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument | ^^^ cannot borrow as mutable error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable - --> $DIR/borrowck-argument.rs:31:9 + --> $DIR/borrowck-argument.rs:21:9 | LL | fn default(&self, arg: S) { | --- help: consider changing this to be mutable: `mut arg` @@ -23,7 +23,7 @@ LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument | ^^^ cannot borrow as mutable error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable - --> $DIR/borrowck-argument.rs:42:17 + --> $DIR/borrowck-argument.rs:32:17 | LL | (|arg: S| { arg.mutate() })(s); //~ ERROR: cannot borrow immutable argument | --- ^^^ cannot borrow as mutable diff --git a/src/test/ui/borrowck/borrowck-argument.rs b/src/test/ui/borrowck/borrowck-argument.rs index 3230689e53c..e1f1adec838 100644 --- a/src/test/ui/borrowck/borrowck-argument.rs +++ b/src/test/ui/borrowck/borrowck-argument.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Copy, Clone)] struct S; diff --git a/src/test/ui/borrowck/borrowck-argument.stderr b/src/test/ui/borrowck/borrowck-argument.stderr index 7b8849ec764..fa82b1c00cc 100644 --- a/src/test/ui/borrowck/borrowck-argument.stderr +++ b/src/test/ui/borrowck/borrowck-argument.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable argument `arg` as mutable - --> $DIR/borrowck-argument.rs:20:5 + --> $DIR/borrowck-argument.rs:10:5 | LL | fn func(arg: S) { | --- help: make this binding mutable: `mut arg` @@ -7,7 +7,7 @@ LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument | ^^^ cannot borrow mutably error[E0596]: cannot borrow immutable argument `arg` as mutable - --> $DIR/borrowck-argument.rs:25:9 + --> $DIR/borrowck-argument.rs:15:9 | LL | fn method(&self, arg: S) { | --- help: make this binding mutable: `mut arg` @@ -15,7 +15,7 @@ LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument | ^^^ cannot borrow mutably error[E0596]: cannot borrow immutable argument `arg` as mutable - --> $DIR/borrowck-argument.rs:31:9 + --> $DIR/borrowck-argument.rs:21:9 | LL | fn default(&self, arg: S) { | --- help: make this binding mutable: `mut arg` @@ -23,7 +23,7 @@ LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument | ^^^ cannot borrow mutably error[E0596]: cannot borrow immutable argument `arg` as mutable - --> $DIR/borrowck-argument.rs:42:17 + --> $DIR/borrowck-argument.rs:32:17 | LL | (|arg: S| { arg.mutate() })(s); //~ ERROR: cannot borrow immutable argument | --- ^^^ cannot borrow mutably diff --git a/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr b/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr index 0cec1975db8..86e4832b387 100644 --- a/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr @@ -1,16 +1,17 @@ error[E0382]: use of moved value: `x` - --> $DIR/borrowck-asm.rs:37:17 + --> $DIR/borrowck-asm.rs:27:17 | +LL | let x = &mut 0isize; + | - move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait +LL | unsafe { LL | asm!("nop" : : "r"(x)); | - value moved here LL | } LL | let z = x; //[ast]~ ERROR use of moved value: `x` | ^ value used here after move - | - = note: move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-asm.rs:45:32 + --> $DIR/borrowck-asm.rs:35:32 | LL | let y = &mut x; | ------ borrow of `x` occurs here @@ -22,7 +23,7 @@ LL | let z = y; | - borrow later used here error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:54:31 + --> $DIR/borrowck-asm.rs:44:31 | LL | let x = 3; | - @@ -34,7 +35,7 @@ LL | asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice | ^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:70:31 + --> $DIR/borrowck-asm.rs:60:31 | LL | let x = 3; | - @@ -46,13 +47,13 @@ LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice | ^ cannot assign twice to immutable variable error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-asm.rs:78:32 + --> $DIR/borrowck-asm.rs:68:32 | LL | asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable | ^ use of possibly uninitialized `x` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-asm.rs:87:31 + --> $DIR/borrowck-asm.rs:77:31 | LL | let y = &*x; | --- borrow of `x` occurs here @@ -64,14 +65,15 @@ LL | let z = y; | - borrow later used here error[E0382]: use of moved value: `x` - --> $DIR/borrowck-asm.rs:96:40 + --> $DIR/borrowck-asm.rs:86:40 | +LL | let x = &mut 2; + | - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait +LL | unsafe { LL | asm!("nop" : : "r"(x), "r"(x) ); //[ast]~ ERROR use of moved value | - ^ value used here after move | | | value moved here - | - = note: move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait error: aborting due to 7 previous errors diff --git a/src/test/ui/borrowck/borrowck-asm.ast.stderr b/src/test/ui/borrowck/borrowck-asm.ast.stderr index 5856a1b0790..73eb08b59b0 100644 --- a/src/test/ui/borrowck/borrowck-asm.ast.stderr +++ b/src/test/ui/borrowck/borrowck-asm.ast.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/borrowck-asm.rs:37:13 + --> $DIR/borrowck-asm.rs:27:13 | LL | asm!("nop" : : "r"(x)); | - value moved here @@ -10,7 +10,7 @@ LL | let z = x; //[ast]~ ERROR use of moved value: `x` = note: move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-asm.rs:45:32 + --> $DIR/borrowck-asm.rs:35:32 | LL | let y = &mut x; | - borrow of `x` occurs here @@ -19,7 +19,7 @@ LL | asm!("nop" : : "r"(x)); //[ast]~ ERROR cannot use | ^ use of borrowed `x` error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:54:31 + --> $DIR/borrowck-asm.rs:44:31 | LL | let x = 3; | - first assignment to `x` @@ -28,7 +28,7 @@ LL | asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice | ^ cannot assign twice to immutable variable error[E0506]: cannot assign to `a` because it is borrowed - --> $DIR/borrowck-asm.rs:60:31 + --> $DIR/borrowck-asm.rs:50:31 | LL | let b = &*a; | -- borrow of `a` occurs here @@ -37,7 +37,7 @@ LL | asm!("nop" : "=r"(a)); //[ast]~ ERROR cannot assign to `a` bec | ^ assignment to borrowed `a` occurs here error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:70:31 + --> $DIR/borrowck-asm.rs:60:31 | LL | let x = 3; | - first assignment to `x` @@ -46,13 +46,13 @@ LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice | ^ cannot assign twice to immutable variable error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-asm.rs:78:32 + --> $DIR/borrowck-asm.rs:68:32 | LL | asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable | ^ use of possibly uninitialized `x` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-asm.rs:87:31 + --> $DIR/borrowck-asm.rs:77:31 | LL | let y = &*x; | -- borrow of `x` occurs here @@ -61,7 +61,7 @@ LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign to `x` bec | ^ assignment to borrowed `x` occurs here error[E0382]: use of moved value: `x` - --> $DIR/borrowck-asm.rs:96:40 + --> $DIR/borrowck-asm.rs:86:40 | LL | asm!("nop" : : "r"(x), "r"(x) ); //[ast]~ ERROR use of moved value | - ^ value used here after move diff --git a/src/test/ui/borrowck/borrowck-asm.mir.stderr b/src/test/ui/borrowck/borrowck-asm.mir.stderr index 0cec1975db8..86e4832b387 100644 --- a/src/test/ui/borrowck/borrowck-asm.mir.stderr +++ b/src/test/ui/borrowck/borrowck-asm.mir.stderr @@ -1,16 +1,17 @@ error[E0382]: use of moved value: `x` - --> $DIR/borrowck-asm.rs:37:17 + --> $DIR/borrowck-asm.rs:27:17 | +LL | let x = &mut 0isize; + | - move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait +LL | unsafe { LL | asm!("nop" : : "r"(x)); | - value moved here LL | } LL | let z = x; //[ast]~ ERROR use of moved value: `x` | ^ value used here after move - | - = note: move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-asm.rs:45:32 + --> $DIR/borrowck-asm.rs:35:32 | LL | let y = &mut x; | ------ borrow of `x` occurs here @@ -22,7 +23,7 @@ LL | let z = y; | - borrow later used here error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:54:31 + --> $DIR/borrowck-asm.rs:44:31 | LL | let x = 3; | - @@ -34,7 +35,7 @@ LL | asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice | ^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-asm.rs:70:31 + --> $DIR/borrowck-asm.rs:60:31 | LL | let x = 3; | - @@ -46,13 +47,13 @@ LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice | ^ cannot assign twice to immutable variable error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-asm.rs:78:32 + --> $DIR/borrowck-asm.rs:68:32 | LL | asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable | ^ use of possibly uninitialized `x` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-asm.rs:87:31 + --> $DIR/borrowck-asm.rs:77:31 | LL | let y = &*x; | --- borrow of `x` occurs here @@ -64,14 +65,15 @@ LL | let z = y; | - borrow later used here error[E0382]: use of moved value: `x` - --> $DIR/borrowck-asm.rs:96:40 + --> $DIR/borrowck-asm.rs:86:40 | +LL | let x = &mut 2; + | - move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait +LL | unsafe { LL | asm!("nop" : : "r"(x), "r"(x) ); //[ast]~ ERROR use of moved value | - ^ value used here after move | | | value moved here - | - = note: move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait error: aborting due to 7 previous errors diff --git a/src/test/ui/borrowck/borrowck-asm.rs b/src/test/ui/borrowck/borrowck-asm.rs index d9816401b33..560c87c8d72 100644 --- a/src/test/ui/borrowck/borrowck-asm.rs +++ b/src/test/ui/borrowck/borrowck-asm.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-s390x // ignore-emscripten // ignore-powerpc diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr index 2dda17b38bb..71f36c2b045 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-assign-comp-idx.rs:22:5 + --> $DIR/borrowck-assign-comp-idx.rs:12:5 | LL | let q: &isize = &p[0]; | - immutable borrow occurs here @@ -11,7 +11,7 @@ LL | println!("{}", *q); | -- immutable borrow later used here error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-assign-comp-idx.rs:37:9 + --> $DIR/borrowck-assign-comp-idx.rs:27:9 | LL | borrow( | ------ immutable borrow later used by call diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.rs b/src/test/ui/borrowck/borrowck-assign-comp-idx.rs index 1e665a12a19..f4dffeb8c38 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp-idx.rs +++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Point { x: isize, y: isize, diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr index 69a69b36fc7..9997aa4190e 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr +++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-assign-comp-idx.rs:22:5 + --> $DIR/borrowck-assign-comp-idx.rs:12:5 | LL | let q: &isize = &p[0]; | - immutable borrow occurs here @@ -11,7 +11,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-assign-comp-idx.rs:37:9 + --> $DIR/borrowck-assign-comp-idx.rs:27:9 | LL | &p, | - immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-assign-comp.ast.nll.stderr b/src/test/ui/borrowck/borrowck-assign-comp.ast.nll.stderr index 2a1fbfd43bf..c204248d81a 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-comp.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `p.x` because it is borrowed - --> $DIR/borrowck-assign-comp.rs:23:5 + --> $DIR/borrowck-assign-comp.rs:13:5 | LL | let q = &p; | -- borrow of `p.x` occurs here @@ -11,18 +11,18 @@ LL | q.x; | --- borrow later used here error[E0506]: cannot assign to `p` because it is borrowed - --> $DIR/borrowck-assign-comp.rs:34:5 + --> $DIR/borrowck-assign-comp.rs:24:5 | LL | let q = &p.y; | ---- borrow of `p` occurs here -LL | p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p` +LL | p = Point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p` | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here ... LL | *q; // stretch loan | -- borrow later used here error[E0506]: cannot assign to `p.y` because it is borrowed - --> $DIR/borrowck-assign-comp.rs:46:5 + --> $DIR/borrowck-assign-comp.rs:36:5 | LL | let q = &p.y; | ---- borrow of `p.y` occurs here diff --git a/src/test/ui/borrowck/borrowck-assign-comp.ast.stderr b/src/test/ui/borrowck/borrowck-assign-comp.ast.stderr index 9e5e0e197a9..735c168d7df 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp.ast.stderr +++ b/src/test/ui/borrowck/borrowck-assign-comp.ast.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `p.x` because it is borrowed - --> $DIR/borrowck-assign-comp.rs:23:5 + --> $DIR/borrowck-assign-comp.rs:13:5 | LL | let q = &p; | - borrow of `p.x` occurs here @@ -8,15 +8,15 @@ LL | p.x = 5; //[ast]~ ERROR cannot assign to `p.x` | ^^^^^^^ assignment to borrowed `p.x` occurs here error[E0506]: cannot assign to `p` because it is borrowed - --> $DIR/borrowck-assign-comp.rs:34:5 + --> $DIR/borrowck-assign-comp.rs:24:5 | LL | let q = &p.y; | --- borrow of `p` occurs here -LL | p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p` +LL | p = Point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p` | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here error[E0506]: cannot assign to `p.y` because it is borrowed - --> $DIR/borrowck-assign-comp.rs:46:5 + --> $DIR/borrowck-assign-comp.rs:36:5 | LL | let q = &p.y; | --- borrow of `p.y` occurs here diff --git a/src/test/ui/borrowck/borrowck-assign-comp.mir.stderr b/src/test/ui/borrowck/borrowck-assign-comp.mir.stderr index 2a1fbfd43bf..c204248d81a 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp.mir.stderr +++ b/src/test/ui/borrowck/borrowck-assign-comp.mir.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `p.x` because it is borrowed - --> $DIR/borrowck-assign-comp.rs:23:5 + --> $DIR/borrowck-assign-comp.rs:13:5 | LL | let q = &p; | -- borrow of `p.x` occurs here @@ -11,18 +11,18 @@ LL | q.x; | --- borrow later used here error[E0506]: cannot assign to `p` because it is borrowed - --> $DIR/borrowck-assign-comp.rs:34:5 + --> $DIR/borrowck-assign-comp.rs:24:5 | LL | let q = &p.y; | ---- borrow of `p` occurs here -LL | p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p` +LL | p = Point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p` | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here ... LL | *q; // stretch loan | -- borrow later used here error[E0506]: cannot assign to `p.y` because it is borrowed - --> $DIR/borrowck-assign-comp.rs:46:5 + --> $DIR/borrowck-assign-comp.rs:36:5 | LL | let q = &p.y; | ---- borrow of `p.y` occurs here diff --git a/src/test/ui/borrowck/borrowck-assign-comp.rs b/src/test/ui/borrowck/borrowck-assign-comp.rs index d68420eb205..0cacc3882d8 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp.rs +++ b/src/test/ui/borrowck/borrowck-assign-comp.rs @@ -1,20 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir -struct point { x: isize, y: isize } +struct Point { x: isize, y: isize } fn a() { - let mut p = point {x: 3, y: 4}; + let mut p = Point {x: 3, y: 4}; let q = &p; // This assignment is illegal because the field x is not @@ -29,9 +19,9 @@ fn c() { // this is sort of the opposite. We take a loan to the interior of `p` // and then try to overwrite `p` as a whole. - let mut p = point {x: 3, y: 4}; + let mut p = Point {x: 3, y: 4}; let q = &p.y; - p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p` + p = Point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p` //[mir]~^ ERROR cannot assign to `p` because it is borrowed p.x; // silence warning *q; // stretch loan @@ -41,7 +31,7 @@ fn d() { // just for completeness's sake, the easy case, where we take the // address of a subcomponent and then modify that subcomponent: - let mut p = point {x: 3, y: 4}; + let mut p = Point {x: 3, y: 4}; let q = &p.y; p.y = 5; //[ast]~ ERROR cannot assign to `p.y` //[mir]~^ ERROR cannot assign to `p.y` because it is borrowed diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr index eb4c1ff025b..469199d69b9 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference - --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:19:5 + --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:9:5 | LL | fn a(s: &S) { | -- help: consider changing this to be a mutable reference: `&mut S<'_>` @@ -7,7 +7,7 @@ LL | *s.pointer += 1; //~ ERROR cannot assign | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference - --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:27:5 + --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:17:5 | LL | fn c(s: & &mut S) { | -------- help: consider changing this to be a mutable reference: `&mut &mut S<'_>` diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.rs b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.rs index d66cdb99a74..879c03791eb 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.rs +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that assignments to an `&mut` pointer which is found in a // borrowed (but otherwise non-aliasable) location is illegal. diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr index 4fb65988eee..76e7ee841f8 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr @@ -1,5 +1,5 @@ error[E0389]: cannot assign to data in a `&` reference - --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:19:5 + --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:9:5 | LL | fn a(s: &S) { | -- use `&mut S` here to make mutable @@ -7,7 +7,7 @@ LL | *s.pointer += 1; //~ ERROR cannot assign | ^^^^^^^^^^^^^^^ assignment into an immutable reference error[E0389]: cannot assign to data in a `&` reference - --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:27:5 + --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:17:5 | LL | fn c(s: & &mut S) { | -------- use `&mut &mut S` here to make mutable diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr index 8ca7229b42a..8e3e9d41f8c 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `*y.pointer` because it was mutably borrowed - --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:28:9 + --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9 | LL | let z = copy_borrowed_ptr(&mut y); | ------ borrow of `y` occurs here @@ -9,7 +9,7 @@ LL | *z.pointer += 1; | --------------- borrow later used here error[E0506]: cannot assign to `*y.pointer` because it is borrowed - --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:28:9 + --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9 | LL | let z = copy_borrowed_ptr(&mut y); | ------ borrow of `*y.pointer` occurs here diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.rs b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.rs index 77aa57ef1b5..98080d47c64 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.rs +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that assignments to an `&mut` pointer which is found in a // borrowed (but otherwise non-aliasable) location is illegal. diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr index 9a7c8330505..d4639581223 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed - --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:28:9 + --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:18:9 | LL | let z = copy_borrowed_ptr(&mut y); | - borrow of `*y.pointer` occurs here diff --git a/src/test/ui/borrowck/borrowck-assign-to-constants.ast.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-constants.ast.nll.stderr index 861fe2f2c50..0a30a490a64 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-constants.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-constants.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to immutable static item `foo` - --> $DIR/borrowck-assign-to-constants.rs:18:5 + --> $DIR/borrowck-assign-to-constants.rs:8:5 | LL | foo = 6; //[ast]~ ERROR cannot assign to immutable static item | ^^^^^^^ cannot assign diff --git a/src/test/ui/borrowck/borrowck-assign-to-constants.ast.stderr b/src/test/ui/borrowck/borrowck-assign-to-constants.ast.stderr index 09ddf8387ce..4111f55d9f2 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-constants.ast.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-constants.ast.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to immutable static item - --> $DIR/borrowck-assign-to-constants.rs:18:5 + --> $DIR/borrowck-assign-to-constants.rs:8:5 | LL | foo = 6; //[ast]~ ERROR cannot assign to immutable static item | ^^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-assign-to-constants.mir.stderr b/src/test/ui/borrowck/borrowck-assign-to-constants.mir.stderr index 861fe2f2c50..0a30a490a64 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-constants.mir.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-constants.mir.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to immutable static item `foo` - --> $DIR/borrowck-assign-to-constants.rs:18:5 + --> $DIR/borrowck-assign-to-constants.rs:8:5 | LL | foo = 6; //[ast]~ ERROR cannot assign to immutable static item | ^^^^^^^ cannot assign diff --git a/src/test/ui/borrowck/borrowck-assign-to-constants.rs b/src/test/ui/borrowck/borrowck-assign-to-constants.rs index 57002dd40fc..768b2a5f743 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-constants.rs +++ b/src/test/ui/borrowck/borrowck-assign-to-constants.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr index b41d5cd3623..53aaa4a2957 100644 --- a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr +++ b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-auto-mut-ref-to-immut-var.rs:25:5 + --> $DIR/borrowck-auto-mut-ref-to-immut-var.rs:15:5 | LL | let x = Foo { x: 3 }; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.rs b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.rs index ea020dc0685..247e3da186b 100644 --- a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.rs +++ b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that auto-ref can't create mutable aliases to immutable memory. struct Foo { diff --git a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr index a6338a22389..b48473a884c 100644 --- a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr +++ b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable - --> $DIR/borrowck-auto-mut-ref-to-immut-var.rs:25:5 + --> $DIR/borrowck-auto-mut-ref-to-immut-var.rs:15:5 | LL | let x = Foo { x: 3 }; | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr b/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr index f4ae5eaba16..9e62534c671 100644 --- a/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr +++ b/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-autoref-3261.rs:25:9 + --> $DIR/borrowck-autoref-3261.rs:15:9 | LL | (&mut x).with( | -------- ---- first borrow later used by call diff --git a/src/test/ui/borrowck/borrowck-autoref-3261.rs b/src/test/ui/borrowck/borrowck-autoref-3261.rs index d5f09305808..2ff3d5bd3db 100644 --- a/src/test/ui/borrowck/borrowck-autoref-3261.rs +++ b/src/test/ui/borrowck/borrowck-autoref-3261.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Either { Left(T), Right(U) } struct X(Either<(usize,usize), fn()>); diff --git a/src/test/ui/borrowck/borrowck-autoref-3261.stderr b/src/test/ui/borrowck/borrowck-autoref-3261.stderr index c9e649dee0c..7a5430ac15c 100644 --- a/src/test/ui/borrowck/borrowck-autoref-3261.stderr +++ b/src/test/ui/borrowck/borrowck-autoref-3261.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-autoref-3261.rs:25:9 + --> $DIR/borrowck-autoref-3261.rs:15:9 | LL | (&mut x).with( | - first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr index 77c637b7b4e..1732628d40f 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-bad-nested-calls-free.rs:35:17 + --> $DIR/borrowck-bad-nested-calls-free.rs:25:17 | LL | add( | --- immutable borrow later used by call @@ -9,7 +9,7 @@ LL | rewrite(&mut a)); //~ ERROR cannot borrow | ^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-bad-nested-calls-free.rs:42:17 + --> $DIR/borrowck-bad-nested-calls-free.rs:32:17 | LL | add( | --- immutable borrow later used by call diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.rs b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.rs index 7913f9ac903..3abc56153b7 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.rs +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we detect nested calls that could free pointers evaluated // for earlier arguments. diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr index 461d2fec589..165530d270a 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `a` as mutable because `*a` is also borrowed as immutable - --> $DIR/borrowck-bad-nested-calls-free.rs:35:22 + --> $DIR/borrowck-bad-nested-calls-free.rs:25:22 | LL | &*a, | -- immutable borrow occurs here @@ -9,7 +9,7 @@ LL | rewrite(&mut a)); //~ ERROR cannot borrow | mutable borrow occurs here error[E0502]: cannot borrow `a` as mutable because `*a` is also borrowed as immutable - --> $DIR/borrowck-bad-nested-calls-free.rs:42:22 + --> $DIR/borrowck-bad-nested-calls-free.rs:32:22 | LL | &*a, | -- immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr index d3ee9b2b2b2..117567cba19 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `a` because it is borrowed - --> $DIR/borrowck-bad-nested-calls-move.rs:35:9 + --> $DIR/borrowck-bad-nested-calls-move.rs:25:9 | LL | add( | --- borrow later used by call @@ -9,7 +9,7 @@ LL | a); //~ ERROR cannot move | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed - --> $DIR/borrowck-bad-nested-calls-move.rs:42:9 + --> $DIR/borrowck-bad-nested-calls-move.rs:32:9 | LL | add( | --- borrow later used by call diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.rs b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.rs index e24d4e87add..fd8df78a5d5 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.rs +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we detect nested calls that could free pointers evaluated // for earlier arguments. diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr index 7ed1f2c6583..b2c680f3952 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `a` because it is borrowed - --> $DIR/borrowck-bad-nested-calls-move.rs:35:9 + --> $DIR/borrowck-bad-nested-calls-move.rs:25:9 | LL | &*a, | -- borrow of `*a` occurs here @@ -7,7 +7,7 @@ LL | a); //~ ERROR cannot move | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed - --> $DIR/borrowck-bad-nested-calls-move.rs:42:9 + --> $DIR/borrowck-bad-nested-calls-move.rs:32:9 | LL | &*a, | -- borrow of `*a` occurs here diff --git a/src/test/ui/borrowck/borrowck-block-unint.nll.stderr b/src/test/ui/borrowck/borrowck-block-unint.nll.stderr index f3246c12bd9..ea17fafc939 100644 --- a/src/test/ui/borrowck/borrowck-block-unint.nll.stderr +++ b/src/test/ui/borrowck/borrowck-block-unint.nll.stderr @@ -1,5 +1,5 @@ error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-block-unint.rs:14:11 + --> $DIR/borrowck-block-unint.rs:4:11 | LL | force(|| { //~ ERROR capture of possibly uninitialized variable: `x` | ^^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-block-unint.rs b/src/test/ui/borrowck/borrowck-block-unint.rs index a09ee439245..3c6e9cb5578 100644 --- a/src/test/ui/borrowck/borrowck-block-unint.rs +++ b/src/test/ui/borrowck/borrowck-block-unint.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn force(f: F) where F: FnOnce() { f(); } fn main() { let x: isize; diff --git a/src/test/ui/borrowck/borrowck-block-unint.stderr b/src/test/ui/borrowck/borrowck-block-unint.stderr index 53aa8919fd8..6e7af76fc2e 100644 --- a/src/test/ui/borrowck/borrowck-block-unint.stderr +++ b/src/test/ui/borrowck/borrowck-block-unint.stderr @@ -1,5 +1,5 @@ error[E0381]: capture of possibly uninitialized variable: `x` - --> $DIR/borrowck-block-unint.rs:14:11 + --> $DIR/borrowck-block-unint.rs:4:11 | LL | force(|| { //~ ERROR capture of possibly uninitialized variable: `x` | ^^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr index a368ef5b254..d1377fd439a 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-owned-ptr.rs:29:17 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:18:17 | LL | let bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here @@ -9,7 +9,7 @@ LL | *bar1; | ----- first borrow later used here error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:36:17 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:25:17 | LL | let bar1 = &mut foo.bar1; | ------------- mutable borrow occurs here @@ -19,7 +19,7 @@ LL | *bar1; | ----- mutable borrow later used here error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:43:17 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:32:17 | LL | let bar1 = &foo.bar1; | --------- immutable borrow occurs here @@ -29,7 +29,7 @@ LL | *bar1; | ----- immutable borrow later used here error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-owned-ptr.rs:73:21 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:62:21 | LL | let bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here @@ -41,7 +41,7 @@ LL | *bar1; | ----- first borrow later used here error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:82:17 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:71:17 | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here @@ -52,7 +52,7 @@ LL | *bar1; | ----- mutable borrow later used here error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:83:17 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:72:17 | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here @@ -63,7 +63,7 @@ LL | *bar1; | ----- mutable borrow later used here error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-owned-ptr.rs:90:17 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:79:17 | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here @@ -73,7 +73,7 @@ LL | *bar1; | ----- first borrow later used here error[E0499]: cannot borrow `*foo` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-owned-ptr.rs:97:17 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:86:17 | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here @@ -83,7 +83,7 @@ LL | *bar1; | ----- first borrow later used here error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:104:17 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:93:17 | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here @@ -93,7 +93,7 @@ LL | *bar1; | ----- immutable borrow later used here error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:111:17 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:100:17 | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here @@ -103,7 +103,7 @@ LL | *bar1; | ----- immutable borrow later used here error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as mutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:132:16 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:121:16 | LL | let foo = make_foo(); | --- help: consider changing this to be mutable: `mut foo` diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.rs b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.rs index e5091a92581..1435837bf3b 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.rs +++ b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #[derive(Copy, Clone)] struct Foo { bar1: Bar, diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr index 19a96d56857..e116cb70c1c 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-owned-ptr.rs:29:22 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:18:22 | LL | let bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - first borrow ends here error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:36:18 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:25:18 | LL | let bar1 = &mut foo.bar1; | -------- mutable borrow occurs here @@ -21,7 +21,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:43:22 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:32:22 | LL | let bar1 = &foo.bar1; | -------- immutable borrow occurs here @@ -32,7 +32,7 @@ LL | } | - immutable borrow ends here error[E0499]: cannot borrow `foo` (via `foo.bar2`) as mutable more than once at a time - --> $DIR/borrowck-borrow-from-owned-ptr.rs:57:22 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:46:22 | LL | let bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here (via `foo.bar1`) @@ -43,7 +43,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `foo` (via `foo.bar2`) as mutable more than once at a time - --> $DIR/borrowck-borrow-from-owned-ptr.rs:64:42 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:53:42 | LL | Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } => {} | ------------- ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`) @@ -54,7 +54,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-owned-ptr.rs:73:21 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:62:21 | LL | let bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here @@ -66,7 +66,7 @@ LL | } | - first borrow ends here error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:82:18 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:71:18 | LL | let bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here @@ -77,7 +77,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `*foo` as immutable because `foo.bar1.int1` is also borrowed as mutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:83:18 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:72:18 | LL | let bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here @@ -89,7 +89,7 @@ LL | } | - mutable borrow ends here error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-owned-ptr.rs:90:22 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:79:22 | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here @@ -100,7 +100,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `*foo` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-owned-ptr.rs:97:22 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:86:22 | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here @@ -111,7 +111,7 @@ LL | } | - first borrow ends here error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:104:22 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:93:22 | LL | let bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here @@ -122,7 +122,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `*foo` as mutable because `foo.bar1.int1` is also borrowed as immutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:111:22 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:100:22 | LL | let bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here @@ -133,18 +133,18 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `foo` (via `foo.bar2`) as immutable because `foo` is also borrowed as mutable (via `foo.bar1`) - --> $DIR/borrowck-borrow-from-owned-ptr.rs:126:18 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:115:18 | LL | let bar1 = &mut foo.bar1; | -------- mutable borrow occurs here (via `foo.bar1`) LL | let _foo1 = &foo.bar2; //~ ERROR cannot borrow - | ^^^^^^^^ immutable borrow occurs here (via `foo.bar2`) + | ^^^^^^^^ immutable borrow of `foo.bar2` -- which overlaps with `foo.bar1` -- occurs here LL | *bar1; LL | } | - mutable borrow ends here error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable - --> $DIR/borrowck-borrow-from-owned-ptr.rs:132:21 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:121:21 | LL | let foo = make_foo(); | --- help: make this binding mutable: `mut foo` @@ -152,7 +152,7 @@ LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0499]: cannot borrow `foo` (via `foo.bar2.int2`) as mutable more than once at a time - --> $DIR/borrowck-borrow-from-owned-ptr.rs:139:21 + --> $DIR/borrowck-borrow-from-owned-ptr.rs:128:21 | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here (via `foo.bar1.int1`) diff --git a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr index d02cf6381d2..f53cb32a567 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-stack-variable.rs:28:17 + --> $DIR/borrowck-borrow-from-stack-variable.rs:18:17 | LL | let bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here @@ -9,7 +9,7 @@ LL | *bar1; | ----- first borrow later used here error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:35:17 + --> $DIR/borrowck-borrow-from-stack-variable.rs:25:17 | LL | let bar1 = &mut foo.bar1; | ------------- mutable borrow occurs here @@ -19,7 +19,7 @@ LL | *bar1; | ----- mutable borrow later used here error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:42:17 + --> $DIR/borrowck-borrow-from-stack-variable.rs:32:17 | LL | let bar1 = &foo.bar1; | --------- immutable borrow occurs here @@ -29,7 +29,7 @@ LL | *bar1; | ----- immutable borrow later used here error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-stack-variable.rs:71:21 + --> $DIR/borrowck-borrow-from-stack-variable.rs:61:21 | LL | let bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here @@ -41,7 +41,7 @@ LL | *bar1; | ----- first borrow later used here error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:80:17 + --> $DIR/borrowck-borrow-from-stack-variable.rs:70:17 | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here @@ -52,7 +52,7 @@ LL | *bar1; | ----- mutable borrow later used here error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:81:17 + --> $DIR/borrowck-borrow-from-stack-variable.rs:71:17 | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here @@ -63,7 +63,7 @@ LL | *bar1; | ----- mutable borrow later used here error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-stack-variable.rs:88:17 + --> $DIR/borrowck-borrow-from-stack-variable.rs:78:17 | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here @@ -73,7 +73,7 @@ LL | *bar1; | ----- first borrow later used here error[E0499]: cannot borrow `foo` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-stack-variable.rs:95:17 + --> $DIR/borrowck-borrow-from-stack-variable.rs:85:17 | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here @@ -83,7 +83,7 @@ LL | *bar1; | ----- first borrow later used here error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:102:17 + --> $DIR/borrowck-borrow-from-stack-variable.rs:92:17 | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here @@ -93,7 +93,7 @@ LL | *bar1; | ----- immutable borrow later used here error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:109:17 + --> $DIR/borrowck-borrow-from-stack-variable.rs:99:17 | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here @@ -103,7 +103,7 @@ LL | *bar1; | ----- immutable borrow later used here error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as mutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:130:16 + --> $DIR/borrowck-borrow-from-stack-variable.rs:120:16 | LL | let foo = make_foo(); | --- help: consider changing this to be mutable: `mut foo` diff --git a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.rs b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.rs index 440be93dfdc..231f6beab85 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.rs +++ b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Copy, Clone)] struct Foo { bar1: Bar, diff --git a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr index 75f12c377ed..2c446dfee44 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-stack-variable.rs:28:22 + --> $DIR/borrowck-borrow-from-stack-variable.rs:18:22 | LL | let bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - first borrow ends here error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:35:18 + --> $DIR/borrowck-borrow-from-stack-variable.rs:25:18 | LL | let bar1 = &mut foo.bar1; | -------- mutable borrow occurs here @@ -21,7 +21,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:42:22 + --> $DIR/borrowck-borrow-from-stack-variable.rs:32:22 | LL | let bar1 = &foo.bar1; | -------- immutable borrow occurs here @@ -32,7 +32,7 @@ LL | } | - immutable borrow ends here error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-stack-variable.rs:71:21 + --> $DIR/borrowck-borrow-from-stack-variable.rs:61:21 | LL | let bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here @@ -44,7 +44,7 @@ LL | } | - first borrow ends here error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:80:18 + --> $DIR/borrowck-borrow-from-stack-variable.rs:70:18 | LL | let bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here @@ -55,7 +55,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `foo` as immutable because `foo.bar1.int1` is also borrowed as mutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:81:18 + --> $DIR/borrowck-borrow-from-stack-variable.rs:71:18 | LL | let bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here @@ -67,7 +67,7 @@ LL | } | - mutable borrow ends here error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-stack-variable.rs:88:22 + --> $DIR/borrowck-borrow-from-stack-variable.rs:78:22 | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here @@ -78,7 +78,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `foo` as mutable more than once at a time - --> $DIR/borrowck-borrow-from-stack-variable.rs:95:22 + --> $DIR/borrowck-borrow-from-stack-variable.rs:85:22 | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here @@ -89,7 +89,7 @@ LL | } | - first borrow ends here error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:102:22 + --> $DIR/borrowck-borrow-from-stack-variable.rs:92:22 | LL | let bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here @@ -100,7 +100,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `foo` as mutable because `foo.bar1.int1` is also borrowed as immutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:109:22 + --> $DIR/borrowck-borrow-from-stack-variable.rs:99:22 | LL | let bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here @@ -111,7 +111,7 @@ LL | } | - immutable borrow ends here error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable - --> $DIR/borrowck-borrow-from-stack-variable.rs:130:21 + --> $DIR/borrowck-borrow-from-stack-variable.rs:120:21 | LL | let foo = make_foo(); | --- help: make this binding mutable: `mut foo` diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr index d8df914a8b9..52bc3e98296 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing temporary value - --> $DIR/borrowck-borrow-from-temporary.rs:20:5 + --> $DIR/borrowck-borrow-from-temporary.rs:10:5 | LL | let &Foo(ref x) = &id(Foo(3)); //~ ERROR borrowed value does not live long enough | ---------- temporary value created here diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.rs b/src/test/ui/borrowck/borrowck-borrow-from-temporary.rs index f7514df800d..e7ca1a90f8c 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-temporary.rs +++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test lifetimes are linked properly when we take reference // to interior. diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr b/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr index 7dcfb3e3c87..0726e3d5d5e 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-borrow-from-temporary.rs:19:24 + --> $DIR/borrowck-borrow-from-temporary.rs:9:24 | LL | let &Foo(ref x) = &id(Foo(3)); //~ ERROR borrowed value does not live long enough | ^^^^^^^^^^ temporary value does not live long enough @@ -7,8 +7,8 @@ LL | x LL | } | - temporary value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 18:8... - --> $DIR/borrowck-borrow-from-temporary.rs:18:8 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 8:8... + --> $DIR/borrowck-borrow-from-temporary.rs:8:8 | LL | fn foo<'a>() -> &'a isize { | ^^ diff --git a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.nll.stderr index c2b7d790eea..7d7e305a31f 100644 --- a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*a` as mutable, as `a` is not declared as mutable - --> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:22:5 + --> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:12:5 | LL | let a: Box<_> = box A; | - help: consider changing this to be mutable: `mut a` diff --git a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs index 3662e23a412..8d528182c0d 100644 --- a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs +++ b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] struct A; diff --git a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr index 9f079b8cf98..2c989b29576 100644 --- a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable `Box` content `*a` as mutable - --> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:22:5 + --> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:12:5 | LL | let a: Box<_> = box A; | - help: make this binding mutable: `mut a` diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr index fb04b3b93dc..82b9449de50 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `**t1` which is behind a `&` reference - --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:5 + --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5 | LL | let t1 = t0; | -- help: consider changing this to be a mutable reference: `&mut &mut isize` @@ -8,7 +8,7 @@ LL | **t1 = 22; //~ ERROR cannot assign | ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:24:21 + --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:14:21 | LL | let t1 = &mut *t0; | -------- mutable borrow occurs here @@ -18,7 +18,7 @@ LL | **t1 = 22; | --------- mutable borrow later used here error[E0596]: cannot borrow `**t0` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:29:26 + --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:26 | LL | fn foo4(t0: & &mut isize) { | ------------ help: consider changing this to be a mutable reference: `&mut &mut isize` diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs index d60751eddc7..75bf320dd5b 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs +++ b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that attempt to reborrow an `&mut` pointer in an aliasable // location yields an error. // diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr index f90ffa8c35a..ff2969f5348 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr @@ -1,11 +1,11 @@ error[E0389]: cannot assign to data in a `&` reference - --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:5 + --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5 | LL | **t1 = 22; //~ ERROR cannot assign | ^^^^^^^^^ assignment into an immutable reference error[E0502]: cannot borrow `**t0` as immutable because `*t0` is also borrowed as mutable - --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:24:22 + --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:14:22 | LL | let t1 = &mut *t0; | --- mutable borrow occurs here @@ -16,7 +16,7 @@ LL | } | - mutable borrow ends here error[E0389]: cannot borrow data mutably in a `&` reference - --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:29:31 + --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:31 | LL | fn foo4(t0: & &mut isize) { | ------------ use `&mut &mut isize` here to make mutable diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr index 65c4a392887..c329fc9e910 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/borrowck-borrow-mut-object-twice.rs:23:5 + --> $DIR/borrowck-borrow-mut-object-twice.rs:13:5 | LL | let y = x.f1(); | - first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs index 63a64631f44..5e853afd38c 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs +++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that `&mut` objects cannot be borrowed twice, just like // other `&mut` pointers. diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr index de2fa8db96f..abfce9857f7 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/borrowck-borrow-mut-object-twice.rs:23:5 + --> $DIR/borrowck-borrow-mut-object-twice.rs:13:5 | LL | let y = x.f1(); | - first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr index 522cdfd94d7..ecb013b7a16 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr @@ -1,83 +1,83 @@ error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:57:19 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:47:19 | LL | let __isize = &mut x.y; //~ ERROR cannot borrow | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:61:19 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:51:19 | LL | let __isize = &mut x.y; //~ ERROR cannot borrow | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:69:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:59:5 | LL | &mut x.y //~ ERROR cannot borrow | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:73:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:63:5 | LL | &mut x.y //~ ERROR cannot borrow | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to data in a `&` reference - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:77:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:67:5 | LL | x.y = 3; //~ ERROR cannot assign | ^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:81:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:71:5 | LL | x.y = 3; //~ ERROR cannot assign | ^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:85:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:75:5 | LL | x.y = 3; //~ ERROR cannot assign | ^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:93:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:83:5 | LL | x.set(0, 0); //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:97:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:87:5 | LL | x.set(0, 0); //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:105:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:95:5 | LL | x.y_mut() //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:109:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:99:5 | LL | x.y_mut() //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:113:6 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:103:6 | LL | *x.y_mut() = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:117:6 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:107:6 | LL | *x.y_mut() = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:121:6 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:111:6 | LL | *x.y_mut() = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.rs b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.rs index 693ed29bd05..01dc0af8550 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.rs +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test how overloaded deref interacts with borrows when only // Deref and not DerefMut is implemented. diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr index 31563fbaa1c..c6f9c655a11 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr @@ -1,83 +1,83 @@ error[E0596]: cannot borrow field of immutable binding as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:57:24 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:47:24 | LL | let __isize = &mut x.y; //~ ERROR cannot borrow | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field of immutable binding as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:61:24 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:51:24 | LL | let __isize = &mut x.y; //~ ERROR cannot borrow | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field of immutable binding as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:69:10 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:59:10 | LL | &mut x.y //~ ERROR cannot borrow | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field of immutable binding as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:73:10 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:63:10 | LL | &mut x.y //~ ERROR cannot borrow | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field of immutable binding - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:77:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:67:5 | LL | x.y = 3; //~ ERROR cannot assign | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field of immutable binding - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:81:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:71:5 | LL | x.y = 3; //~ ERROR cannot assign | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field of immutable binding - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:85:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:75:5 | LL | x.y = 3; //~ ERROR cannot assign | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:93:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:83:5 | LL | x.set(0, 0); //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:97:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:87:5 | LL | x.set(0, 0); //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:105:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:95:5 | LL | x.y_mut() //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:109:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:99:5 | LL | x.y_mut() //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:113:6 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:103:6 | LL | *x.y_mut() = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:117:6 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:107:6 | LL | *x.y_mut() = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:121:6 + --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:111:6 | LL | *x.y_mut() = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr index 1e8d81fe76e..1c3131806be 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr @@ -1,41 +1,41 @@ error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-deref.rs:33:19 + --> $DIR/borrowck-borrow-overloaded-deref.rs:23:19 | LL | let __isize = &mut *x; //~ ERROR cannot borrow | ^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-deref.rs:37:19 + --> $DIR/borrowck-borrow-overloaded-deref.rs:27:19 | LL | let __isize = &mut *x; //~ ERROR cannot borrow | ^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-deref.rs:45:5 + --> $DIR/borrowck-borrow-overloaded-deref.rs:35:5 | LL | &mut **x //~ ERROR cannot borrow | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/borrowck-borrow-overloaded-deref.rs:49:5 + --> $DIR/borrowck-borrow-overloaded-deref.rs:39:5 | LL | &mut **x //~ ERROR cannot borrow | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to data in a `&` reference - --> $DIR/borrowck-borrow-overloaded-deref.rs:53:5 + --> $DIR/borrowck-borrow-overloaded-deref.rs:43:5 | LL | *x = 3; //~ ERROR cannot assign | ^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference - --> $DIR/borrowck-borrow-overloaded-deref.rs:57:5 + --> $DIR/borrowck-borrow-overloaded-deref.rs:47:5 | LL | **x = 3; //~ ERROR cannot assign | ^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference - --> $DIR/borrowck-borrow-overloaded-deref.rs:61:5 + --> $DIR/borrowck-borrow-overloaded-deref.rs:51:5 | LL | **x = 3; //~ ERROR cannot assign | ^^^^^^^ cannot assign diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.rs b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.rs index 5b916243b9e..39fa70c4e59 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.rs +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test how overloaded deref interacts with borrows when only // Deref and not DerefMut is implemented. diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr index 641f943b6ce..41e7cc210c8 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr @@ -1,41 +1,41 @@ error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/borrowck-borrow-overloaded-deref.rs:33:24 + --> $DIR/borrowck-borrow-overloaded-deref.rs:23:24 | LL | let __isize = &mut *x; //~ ERROR cannot borrow | ^^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/borrowck-borrow-overloaded-deref.rs:37:24 + --> $DIR/borrowck-borrow-overloaded-deref.rs:27:24 | LL | let __isize = &mut *x; //~ ERROR cannot borrow | ^^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/borrowck-borrow-overloaded-deref.rs:45:10 + --> $DIR/borrowck-borrow-overloaded-deref.rs:35:10 | LL | &mut **x //~ ERROR cannot borrow | ^^^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/borrowck-borrow-overloaded-deref.rs:49:10 + --> $DIR/borrowck-borrow-overloaded-deref.rs:39:10 | LL | &mut **x //~ ERROR cannot borrow | ^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content - --> $DIR/borrowck-borrow-overloaded-deref.rs:53:5 + --> $DIR/borrowck-borrow-overloaded-deref.rs:43:5 | LL | *x = 3; //~ ERROR cannot assign | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content - --> $DIR/borrowck-borrow-overloaded-deref.rs:57:5 + --> $DIR/borrowck-borrow-overloaded-deref.rs:47:5 | LL | **x = 3; //~ ERROR cannot assign | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content - --> $DIR/borrowck-borrow-overloaded-deref.rs:61:5 + --> $DIR/borrowck-borrow-overloaded-deref.rs:51:5 | LL | **x = 3; //~ ERROR cannot assign | ^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr index 80c71b8e282..97dc59c9543 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:32:20 + --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:20:20 | -LL | let x = defer(&vec!["Goodbye", "world!"]); +LL | let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs index 9178aadeeeb..6e943ffabe3 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs @@ -1,20 +1,8 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern: borrowed value does not live long enough - -struct defer<'a> { +struct Defer<'a> { x: &'a [&'a str], } -impl<'a> Drop for defer<'a> { +impl<'a> Drop for Defer<'a> { fn drop(&mut self) { unsafe { println!("{:?}", self.x); @@ -22,13 +10,13 @@ impl<'a> Drop for defer<'a> { } } -fn defer<'r>(x: &'r [&'r str]) -> defer<'r> { - defer { +fn defer<'r>(x: &'r [&'r str]) -> Defer<'r> { + Defer { x: x } } fn main() { - let x = defer(&vec!["Goodbye", "world!"]); + let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough x.x[0]; } diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr index 890b2894943..b9492695119 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:32:20 + --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:20:20 | -LL | let x = defer(&vec!["Goodbye", "world!"]); +LL | let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr index 0c71ac793df..d6e599d1abf 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-borrowed-uniq-rvalue.rs:20:28 + --> $DIR/borrowck-borrowed-uniq-rvalue.rs:10:28 | LL | buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough | ^^^^^^^^^^^ - temporary value is freed at the end of this statement diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs index f58eca7c8ae..88bd106d6f3 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //buggy.rs #![feature(box_syntax)] diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr index 7defd1ee936..bf4674035ea 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-borrowed-uniq-rvalue.rs:20:27 + --> $DIR/borrowck-borrowed-uniq-rvalue.rs:10:27 | LL | buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough | ^^^^^^^^^^^^ - borrowed value dropped here while still borrowed diff --git a/src/test/ui/borrowck/borrowck-box-insensitivity.ast.stderr b/src/test/ui/borrowck/borrowck-box-insensitivity.ast.stderr index 95b26a5724a..236064da3e8 100644 --- a/src/test/ui/borrowck/borrowck-box-insensitivity.ast.stderr +++ b/src/test/ui/borrowck/borrowck-box-insensitivity.ast.stderr @@ -61,7 +61,7 @@ error[E0502]: cannot borrow `a` (via `a.y`) as immutable because `a` is also bor LL | let _x = &mut a.x; | --- mutable borrow occurs here (via `a.x`) LL | let _y = &a.y; //[ast]~ ERROR cannot borrow - | ^^^ immutable borrow occurs here (via `a.y`) + | ^^^ immutable borrow of `a.y` -- which overlaps with `a.x` -- occurs here ... LL | } | - mutable borrow ends here @@ -72,7 +72,7 @@ error[E0502]: cannot borrow `a` (via `a.y`) as mutable because `a` is also borro LL | let _x = &a.x; | --- immutable borrow occurs here (via `a.x`) LL | let _y = &mut a.y; //[ast]~ ERROR cannot borrow - | ^^^ mutable borrow occurs here (via `a.y`) + | ^^^ mutable borrow of `a.y` -- which overlaps with `a.x` -- occurs here ... LL | } | - immutable borrow ends here diff --git a/src/test/ui/borrowck/borrowck-box-insensitivity.rs b/src/test/ui/borrowck/borrowck-box-insensitivity.rs index 2af97a9fc1d..e72048d0ea4 100644 --- a/src/test/ui/borrowck/borrowck-box-insensitivity.rs +++ b/src/test/ui/borrowck/borrowck-box-insensitivity.rs @@ -83,14 +83,14 @@ fn borrow_after_mut_borrow() { let mut a: Box<_> = box A { x: box 0, y: 1 }; let _x = &mut a.x; let _y = &a.y; //[ast]~ ERROR cannot borrow - //[ast]~^ immutable borrow occurs here (via `a.y`) + //[ast]~^ immutable borrow of `a.y` -- which overlaps with `a.x` -- occurs here use_mut(_x); } fn mut_borrow_after_borrow() { let mut a: Box<_> = box A { x: box 0, y: 1 }; let _x = &a.x; let _y = &mut a.y; //[ast]~ ERROR cannot borrow - //[ast]~^ mutable borrow occurs here (via `a.y`) + //[ast]~^ mutable borrow of `a.y` -- which overlaps with `a.x` -- occurs here use_imm(_x); } fn copy_after_move_nested() { diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr index 8c961838ca4..177a2738772 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr @@ -1,5 +1,5 @@ error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-break-uninit-2.rs:19:20 + --> $DIR/borrowck-break-uninit-2.rs:9:20 | LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.rs b/src/test/ui/borrowck/borrowck-break-uninit-2.rs index 82a6c92abaf..95ccb2e1b93 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit-2.rs +++ b/src/test/ui/borrowck/borrowck-break-uninit-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() -> isize { let x: isize; diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr index 4d7d1a0ed22..e574c0ff8a8 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-break-uninit-2.rs:19:20 + --> $DIR/borrowck-break-uninit-2.rs:9:20 | LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr b/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr index 4441c727539..64d1e629fec 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr @@ -1,5 +1,5 @@ error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-break-uninit.rs:19:20 + --> $DIR/borrowck-break-uninit.rs:9:20 | LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-break-uninit.rs b/src/test/ui/borrowck/borrowck-break-uninit.rs index 8a6a036945b..827637cfb95 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit.rs +++ b/src/test/ui/borrowck/borrowck-break-uninit.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() -> isize { let x: isize; diff --git a/src/test/ui/borrowck/borrowck-break-uninit.stderr b/src/test/ui/borrowck/borrowck-break-uninit.stderr index 9d5a21319ab..1a853c35d00 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-break-uninit.rs:19:20 + --> $DIR/borrowck-break-uninit.rs:9:20 | LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.nll.stderr index 814fb7bbedc..ed3d1ff38ec 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-closures-mut-and-imm.rs:31:14 + --> $DIR/borrowck-closures-mut-and-imm.rs:21:14 | LL | let c1 = || x = 4; | -- - first borrow occurs due to use of `x` in closure @@ -14,7 +14,7 @@ LL | drop(c1); | -- mutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-closures-mut-and-imm.rs:39:14 + --> $DIR/borrowck-closures-mut-and-imm.rs:29:14 | LL | let c1 = || set(&mut x); | -- - first borrow occurs due to use of `x` in closure @@ -29,7 +29,7 @@ LL | drop(c1); | -- mutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-closures-mut-and-imm.rs:47:14 + --> $DIR/borrowck-closures-mut-and-imm.rs:37:14 | LL | let c1 = || set(&mut x); | -- - first borrow occurs due to use of `x` in closure @@ -44,7 +44,7 @@ LL | drop(c1); | -- mutable borrow later used here error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-closures-mut-and-imm.rs:55:5 + --> $DIR/borrowck-closures-mut-and-imm.rs:45:5 | LL | let c2 = || x * 5; | -- - borrow occurs due to use in closure @@ -57,7 +57,7 @@ LL | drop(c2); | -- borrow later used here error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-closures-mut-and-imm.rs:63:5 + --> $DIR/borrowck-closures-mut-and-imm.rs:53:5 | LL | let c1 = || get(&x); | -- - borrow occurs due to use in closure @@ -70,7 +70,7 @@ LL | drop(c1); | -- borrow later used here error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/borrowck-closures-mut-and-imm.rs:71:5 + --> $DIR/borrowck-closures-mut-and-imm.rs:61:5 | LL | let c1 = || get(&*x); | -- - borrow occurs due to use in closure @@ -83,7 +83,7 @@ LL | drop(c1); | -- borrow later used here error[E0506]: cannot assign to `*x.f` because it is borrowed - --> $DIR/borrowck-closures-mut-and-imm.rs:83:5 + --> $DIR/borrowck-closures-mut-and-imm.rs:73:5 | LL | let c1 = || get(&*x.f); | -- - borrow occurs due to use in closure @@ -96,7 +96,7 @@ LL | drop(c1); | -- borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-closures-mut-and-imm.rs:95:14 + --> $DIR/borrowck-closures-mut-and-imm.rs:85:14 | LL | let c1 = || get(&*x.f); | -- - first borrow occurs due to use of `x` in closure diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.stderr b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.stderr index 628fbbd1901..363889c6846 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-closures-mut-and-imm.rs:31:14 + --> $DIR/borrowck-closures-mut-and-imm.rs:21:14 | LL | let c1 = || x = 4; | -- - previous borrow occurs due to use of `x` in closure @@ -14,7 +14,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-closures-mut-and-imm.rs:39:14 + --> $DIR/borrowck-closures-mut-and-imm.rs:29:14 | LL | let c1 = || set(&mut x); | -- - previous borrow occurs due to use of `x` in closure @@ -29,7 +29,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-closures-mut-and-imm.rs:47:14 + --> $DIR/borrowck-closures-mut-and-imm.rs:37:14 | LL | let c1 = || set(&mut x); | -- - previous borrow occurs due to use of `x` in closure @@ -44,7 +44,7 @@ LL | } | - mutable borrow ends here error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-closures-mut-and-imm.rs:55:5 + --> $DIR/borrowck-closures-mut-and-imm.rs:45:5 | LL | let c2 = || x * 5; | -- borrow of `x` occurs here @@ -52,7 +52,7 @@ LL | x = 5; //[ast]~ ERROR cannot assign | ^^^^^ assignment to borrowed `x` occurs here error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-closures-mut-and-imm.rs:63:5 + --> $DIR/borrowck-closures-mut-and-imm.rs:53:5 | LL | let c1 = || get(&x); | -- borrow of `x` occurs here @@ -60,7 +60,7 @@ LL | x = 5; //[ast]~ ERROR cannot assign | ^^^^^ assignment to borrowed `x` occurs here error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/borrowck-closures-mut-and-imm.rs:71:5 + --> $DIR/borrowck-closures-mut-and-imm.rs:61:5 | LL | let c1 = || get(&*x); | -- borrow of `*x` occurs here @@ -68,7 +68,7 @@ LL | *x = 5; //[ast]~ ERROR cannot assign to `*x` | ^^^^^^ assignment to borrowed `*x` occurs here error[E0506]: cannot assign to `*x.f` because it is borrowed - --> $DIR/borrowck-closures-mut-and-imm.rs:83:5 + --> $DIR/borrowck-closures-mut-and-imm.rs:73:5 | LL | let c1 = || get(&*x.f); | -- borrow of `*x.f` occurs here @@ -76,7 +76,7 @@ LL | *x.f = 5; //[ast]~ ERROR cannot assign to `*x.f` | ^^^^^^^^ assignment to borrowed `*x.f` occurs here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-closures-mut-and-imm.rs:95:14 + --> $DIR/borrowck-closures-mut-and-imm.rs:85:14 | LL | let c1 = || get(&*x.f); | -- - previous borrow occurs due to use of `x` in closure diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.mir.stderr b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.mir.stderr index 814fb7bbedc..ed3d1ff38ec 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.mir.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.mir.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-closures-mut-and-imm.rs:31:14 + --> $DIR/borrowck-closures-mut-and-imm.rs:21:14 | LL | let c1 = || x = 4; | -- - first borrow occurs due to use of `x` in closure @@ -14,7 +14,7 @@ LL | drop(c1); | -- mutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-closures-mut-and-imm.rs:39:14 + --> $DIR/borrowck-closures-mut-and-imm.rs:29:14 | LL | let c1 = || set(&mut x); | -- - first borrow occurs due to use of `x` in closure @@ -29,7 +29,7 @@ LL | drop(c1); | -- mutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-closures-mut-and-imm.rs:47:14 + --> $DIR/borrowck-closures-mut-and-imm.rs:37:14 | LL | let c1 = || set(&mut x); | -- - first borrow occurs due to use of `x` in closure @@ -44,7 +44,7 @@ LL | drop(c1); | -- mutable borrow later used here error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-closures-mut-and-imm.rs:55:5 + --> $DIR/borrowck-closures-mut-and-imm.rs:45:5 | LL | let c2 = || x * 5; | -- - borrow occurs due to use in closure @@ -57,7 +57,7 @@ LL | drop(c2); | -- borrow later used here error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-closures-mut-and-imm.rs:63:5 + --> $DIR/borrowck-closures-mut-and-imm.rs:53:5 | LL | let c1 = || get(&x); | -- - borrow occurs due to use in closure @@ -70,7 +70,7 @@ LL | drop(c1); | -- borrow later used here error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/borrowck-closures-mut-and-imm.rs:71:5 + --> $DIR/borrowck-closures-mut-and-imm.rs:61:5 | LL | let c1 = || get(&*x); | -- - borrow occurs due to use in closure @@ -83,7 +83,7 @@ LL | drop(c1); | -- borrow later used here error[E0506]: cannot assign to `*x.f` because it is borrowed - --> $DIR/borrowck-closures-mut-and-imm.rs:83:5 + --> $DIR/borrowck-closures-mut-and-imm.rs:73:5 | LL | let c1 = || get(&*x.f); | -- - borrow occurs due to use in closure @@ -96,7 +96,7 @@ LL | drop(c1); | -- borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-closures-mut-and-imm.rs:95:14 + --> $DIR/borrowck-closures-mut-and-imm.rs:85:14 | LL | let c1 = || get(&*x.f); | -- - first borrow occurs due to use of `x` in closure diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs index 9057ba07907..3a802bcbb3e 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs +++ b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that two closures cannot simultaneously have mutable // and immutable access to the variable. Issue #6801. diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr index 160a84c480c..8123e17ce9d 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr @@ -1,17 +1,17 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-closures-mut-of-imm.rs:23:25 + --> $DIR/borrowck-closures-mut-of-imm.rs:13:25 | LL | let mut c1 = || set(&mut *x); | ^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-closures-mut-of-imm.rs:25:25 + --> $DIR/borrowck-closures-mut-of-imm.rs:15:25 | LL | let mut c2 = || set(&mut *x); | ^^^^^^^ cannot borrow as mutable error[E0524]: two closures require unique access to `x` at the same time - --> $DIR/borrowck-closures-mut-of-imm.rs:25:18 + --> $DIR/borrowck-closures-mut-of-imm.rs:15:18 | LL | let mut c1 = || set(&mut *x); | -- - first borrow occurs due to use of `x` in closure diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.rs b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.rs index 3bf4f17fde1..24e06e3c4e6 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.rs +++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that two closures cannot simultaneously have mutable // and immutable access to the variable. Issue #6801. diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr index c248595d571..f529247b1b6 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr @@ -1,5 +1,5 @@ error[E0524]: two closures require unique access to `x` at the same time - --> $DIR/borrowck-closures-mut-of-imm.rs:25:18 + --> $DIR/borrowck-closures-mut-of-imm.rs:15:18 | LL | let mut c1 = || set(&mut *x); | -- - previous borrow occurs due to use of `x` in closure @@ -15,13 +15,13 @@ LL | } | - borrow from first closure ends here error[E0596]: cannot borrow immutable borrowed content `***x` as mutable - --> $DIR/borrowck-closures-mut-of-imm.rs:23:30 + --> $DIR/borrowck-closures-mut-of-imm.rs:13:30 | LL | let mut c1 = || set(&mut *x); | ^^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content `***x` as mutable - --> $DIR/borrowck-closures-mut-of-imm.rs:25:30 + --> $DIR/borrowck-closures-mut-of-imm.rs:15:30 | LL | let mut c2 = || set(&mut *x); | ^^ cannot borrow as mutable diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr index fea61420b19..d3d11e8451c 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-closures-two-mut-fail.rs:26:24 + --> $DIR/borrowck-closures-two-mut-fail.rs:16:24 | LL | let c1 = to_fn_mut(|| x = 4); | -- - first borrow occurs due to use of `x` in closure @@ -13,7 +13,7 @@ LL | c1; | -- first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-closures-two-mut-fail.rs:37:24 + --> $DIR/borrowck-closures-two-mut-fail.rs:27:24 | LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - first borrow occurs due to use of `x` in closure @@ -27,7 +27,7 @@ LL | c1; | -- first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-closures-two-mut-fail.rs:44:24 + --> $DIR/borrowck-closures-two-mut-fail.rs:34:24 | LL | let c1 = to_fn_mut(|| x = 5); | -- - first borrow occurs due to use of `x` in closure @@ -41,7 +41,7 @@ LL | c1; | -- first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-closures-two-mut-fail.rs:51:24 + --> $DIR/borrowck-closures-two-mut-fail.rs:41:24 | LL | let c1 = to_fn_mut(|| x = 5); | -- - first borrow occurs due to use of `x` in closure @@ -56,7 +56,7 @@ LL | c1; | -- first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-closures-two-mut-fail.rs:63:24 + --> $DIR/borrowck-closures-two-mut-fail.rs:53:24 | LL | let c1 = to_fn_mut(|| set(&mut *x.f)); | -- - first borrow occurs due to use of `x` in closure diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.rs b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.rs index 66ebd346dab..2a1757231db 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.rs +++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that two closures cannot simultaneously have mutable // access to the variable, whether that mutable access be used // for direct assignment or for taking mutable ref. Issue #6801. diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr index 59104cc4be9..cb8f5b4366b 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr +++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-closures-two-mut-fail.rs:26:24 + --> $DIR/borrowck-closures-two-mut-fail.rs:16:24 | LL | let c1 = to_fn_mut(|| x = 4); | -- - previous borrow occurs due to use of `x` in closure @@ -14,7 +14,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-closures-two-mut-fail.rs:37:24 + --> $DIR/borrowck-closures-two-mut-fail.rs:27:24 | LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - previous borrow occurs due to use of `x` in closure @@ -29,7 +29,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-closures-two-mut-fail.rs:44:24 + --> $DIR/borrowck-closures-two-mut-fail.rs:34:24 | LL | let c1 = to_fn_mut(|| x = 5); | -- - previous borrow occurs due to use of `x` in closure @@ -44,7 +44,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-closures-two-mut-fail.rs:51:24 + --> $DIR/borrowck-closures-two-mut-fail.rs:41:24 | LL | let c1 = to_fn_mut(|| x = 5); | -- - previous borrow occurs due to use of `x` in closure @@ -59,7 +59,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-closures-two-mut-fail.rs:63:24 + --> $DIR/borrowck-closures-two-mut-fail.rs:53:24 | LL | let c1 = to_fn_mut(|| set(&mut *x.f)); | -- - previous borrow occurs due to use of `x` in closure diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut.rs b/src/test/ui/borrowck/borrowck-closures-two-mut.rs index 55e73af9e6a..1fced982f8d 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut.rs +++ b/src/test/ui/borrowck/borrowck-closures-two-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that two closures cannot simultaneously have mutable // access to the variable, whether that mutable access be used // for direct assignment or for taking mutable ref. Issue #6801. diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut.stderr index bbfe3770236..bfb70694615 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut.stderr +++ b/src/test/ui/borrowck/borrowck-closures-two-mut.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:24:24 + --> $DIR/borrowck-closures-two-mut.rs:14:24 | LL | let c1 = to_fn_mut(|| x = 4); | -- - previous borrow occurs due to use of `x` in closure @@ -14,7 +14,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:36:24 + --> $DIR/borrowck-closures-two-mut.rs:26:24 | LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - previous borrow occurs due to use of `x` in closure @@ -29,7 +29,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:44:24 + --> $DIR/borrowck-closures-two-mut.rs:34:24 | LL | let c1 = to_fn_mut(|| x = 5); | -- - previous borrow occurs due to use of `x` in closure @@ -44,7 +44,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:52:24 + --> $DIR/borrowck-closures-two-mut.rs:42:24 | LL | let c1 = to_fn_mut(|| x = 5); | -- - previous borrow occurs due to use of `x` in closure @@ -59,7 +59,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Ast) - --> $DIR/borrowck-closures-two-mut.rs:65:24 + --> $DIR/borrowck-closures-two-mut.rs:55:24 | LL | let c1 = to_fn_mut(|| set(&mut *x.f)); | -- - previous borrow occurs due to use of `x` in closure @@ -74,7 +74,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) - --> $DIR/borrowck-closures-two-mut.rs:24:24 + --> $DIR/borrowck-closures-two-mut.rs:14:24 | LL | let c1 = to_fn_mut(|| x = 4); | -- - first borrow occurs due to use of `x` in closure @@ -89,7 +89,7 @@ LL | drop((c1, c2)); | -- first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) - --> $DIR/borrowck-closures-two-mut.rs:36:24 + --> $DIR/borrowck-closures-two-mut.rs:26:24 | LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - first borrow occurs due to use of `x` in closure @@ -104,7 +104,7 @@ LL | drop((c1, c2)); | -- first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) - --> $DIR/borrowck-closures-two-mut.rs:44:24 + --> $DIR/borrowck-closures-two-mut.rs:34:24 | LL | let c1 = to_fn_mut(|| x = 5); | -- - first borrow occurs due to use of `x` in closure @@ -119,7 +119,7 @@ LL | drop((c1, c2)); | -- first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) - --> $DIR/borrowck-closures-two-mut.rs:52:24 + --> $DIR/borrowck-closures-two-mut.rs:42:24 | LL | let c1 = to_fn_mut(|| x = 5); | -- - first borrow occurs due to use of `x` in closure @@ -134,7 +134,7 @@ LL | drop((c1, c2)); | -- first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time (Mir) - --> $DIR/borrowck-closures-two-mut.rs:65:24 + --> $DIR/borrowck-closures-two-mut.rs:55:24 | LL | let c1 = to_fn_mut(|| set(&mut *x.f)); | -- - first borrow occurs due to use of `x` in closure diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr index aca4f309257..80e042fc8fc 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-closures-unique-imm.rs:23:9 + --> $DIR/borrowck-closures-unique-imm.rs:11:9 | LL | let p = &this.x; | ------- immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.rs b/src/test/ui/borrowck/borrowck-closures-unique-imm.rs index c4b15a9c0fe..0dd00476910 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique-imm.rs +++ b/src/test/ui/borrowck/borrowck-closures-unique-imm.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - struct Foo { x: isize, } diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr b/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr index 5ab9685850e..1b661b70d7f 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-closures-unique-imm.rs:23:14 + --> $DIR/borrowck-closures-unique-imm.rs:11:14 | LL | let p = &this.x; | ------ immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr index 231ae53fe82..d6082734451 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr @@ -1,5 +1,5 @@ error[E0500]: closure requires unique access to `x` but it is already borrowed - --> $DIR/borrowck-closures-unique.rs:36:14 + --> $DIR/borrowck-closures-unique.rs:26:14 | LL | let c1 = || get(x); | -- - first borrow occurs due to use of `x` in closure @@ -13,7 +13,7 @@ LL | c1; | -- first borrow later used here error[E0500]: closure requires unique access to `x` but it is already borrowed - --> $DIR/borrowck-closures-unique.rs:42:14 + --> $DIR/borrowck-closures-unique.rs:32:14 | LL | let c1 = || get(x); | -- - first borrow occurs due to use of `x` in closure @@ -27,7 +27,7 @@ LL | c1; | -- first borrow later used here error[E0524]: two closures require unique access to `x` at the same time - --> $DIR/borrowck-closures-unique.rs:48:14 + --> $DIR/borrowck-closures-unique.rs:38:14 | LL | let c1 = || set(x); | -- - first borrow occurs due to use of `x` in closure @@ -41,7 +41,7 @@ LL | c1; | -- first borrow later used here error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/borrowck-closures-unique.rs:57:38 + --> $DIR/borrowck-closures-unique.rs:47:38 | LL | fn e(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/borrowck-closures-unique.rs b/src/test/ui/borrowck/borrowck-closures-unique.rs index caf5785f481..a4655ebba11 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique.rs +++ b/src/test/ui/borrowck/borrowck-closures-unique.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that a closure which requires mutable access to the referent // of an `&mut` requires a "unique" borrow -- that is, the variable to // be borrowed (here, `x`) will not be borrowed *mutably*, but diff --git a/src/test/ui/borrowck/borrowck-closures-unique.stderr b/src/test/ui/borrowck/borrowck-closures-unique.stderr index cfcb81b31e7..94181ad2400 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique.stderr @@ -1,5 +1,5 @@ error[E0500]: closure requires unique access to `x` but it is already borrowed - --> $DIR/borrowck-closures-unique.rs:36:14 + --> $DIR/borrowck-closures-unique.rs:26:14 | LL | let c1 = || get(x); | -- - previous borrow occurs due to use of `x` in closure @@ -14,7 +14,7 @@ LL | } | - borrow ends here error[E0500]: closure requires unique access to `x` but it is already borrowed - --> $DIR/borrowck-closures-unique.rs:42:14 + --> $DIR/borrowck-closures-unique.rs:32:14 | LL | let c1 = || get(x); | -- - previous borrow occurs due to use of `x` in closure @@ -29,7 +29,7 @@ LL | } | - borrow ends here error[E0524]: two closures require unique access to `x` at the same time - --> $DIR/borrowck-closures-unique.rs:48:14 + --> $DIR/borrowck-closures-unique.rs:38:14 | LL | let c1 = || set(x); | -- - previous borrow occurs due to use of `x` in closure @@ -44,7 +44,7 @@ LL | } | - borrow from first closure ends here error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/borrowck-closures-unique.rs:57:14 + --> $DIR/borrowck-closures-unique.rs:47:14 | LL | let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument | ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably @@ -54,7 +54,7 @@ LL | x //~ ERROR closure cannot assign to immutable argument | ^ error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/borrowck-closures-unique.rs:62:14 + --> $DIR/borrowck-closures-unique.rs:52:14 | LL | let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable argument | ^^ cannot borrow mutably diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr b/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr index 90eb7fda026..4501e28a188 100644 --- a/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-closures-use-after-free.rs:32:8 + --> $DIR/borrowck-closures-use-after-free.rs:22:8 | LL | let mut test = |foo: &Foo| { | ----------- mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.rs b/src/test/ui/borrowck/borrowck-closures-use-after-free.rs index bb474342a7c..e9f65c4ff7d 100644 --- a/src/test/ui/borrowck/borrowck-closures-use-after-free.rs +++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that a closure which mutates a local variable // cannot also be supplied a borrowed version of that // variable's contents. Issue #11192. diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr b/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr index 7beb31f3944..b41a4a0c676 100644 --- a/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr +++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*ptr` as immutable because `ptr` is also borrowed as mutable - --> $DIR/borrowck-closures-use-after-free.rs:32:9 + --> $DIR/borrowck-closures-use-after-free.rs:22:9 | LL | let mut test = |foo: &Foo| { | ----------- mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr b/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr new file mode 100644 index 00000000000..ea7683a91ad --- /dev/null +++ b/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr @@ -0,0 +1,13 @@ +error[E0382]: use of moved value: `b` + --> $DIR/borrowck-consume-unsize-vec.rs:8:13 + | +LL | fn foo(b: Box<[i32;5]>) { + | - move occurs because `b` has type `std::boxed::Box<[i32; 5]>`, which does not implement the `Copy` trait +LL | consume(b); + | - value moved here +LL | consume(b); //~ ERROR use of moved value + | ^ value used here after move + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/borrowck/borrowck-consume-unsize-vec.rs b/src/test/ui/borrowck/borrowck-consume-unsize-vec.rs index 32490e0dc7d..347f0212c7f 100644 --- a/src/test/ui/borrowck/borrowck-consume-unsize-vec.rs +++ b/src/test/ui/borrowck/borrowck-consume-unsize-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we report an error if an upcast box is moved twice. fn consume(_: Box<[i32]>) { diff --git a/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr b/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr index 8199ce70e2a..2fc2248000f 100644 --- a/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr +++ b/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `b` - --> $DIR/borrowck-consume-unsize-vec.rs:18:13 + --> $DIR/borrowck-consume-unsize-vec.rs:8:13 | LL | consume(b); | - value moved here diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr index b999e092847..15cf359326b 100644 --- a/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr +++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: use of moved value: `b` - --> $DIR/borrowck-consume-upcast-box.rs:20:13 + --> $DIR/borrowck-consume-upcast-box.rs:10:13 | +LL | fn foo(b: Box) { + | - move occurs because `b` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | consume(b); | - value moved here LL | consume(b); //~ ERROR use of moved value | ^ value used here after move - | - = note: move occurs because `b` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.rs b/src/test/ui/borrowck/borrowck-consume-upcast-box.rs index 5bcafa675c7..ed669c4d901 100644 --- a/src/test/ui/borrowck/borrowck-consume-upcast-box.rs +++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we report an error if an upcast box is moved twice. trait Foo { fn dummy(&self); } diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr index 159933a6155..aef1671342e 100644 --- a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr +++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `b` - --> $DIR/borrowck-consume-upcast-box.rs:20:13 + --> $DIR/borrowck-consume-upcast-box.rs:10:13 | LL | consume(b); | - value moved here diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr index c3aba793f19..24467faa90c 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-describe-lvalue.rs:295:13 + --> $DIR/borrowck-describe-lvalue.rs:285:13 | LL | let y = &mut x; | ------ first mutable borrow occurs here @@ -10,7 +10,7 @@ LL | *y = 1; | ------ first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-describe-lvalue.rs:307:20 + --> $DIR/borrowck-describe-lvalue.rs:296:20 | LL | let y = &mut x; | ------ first mutable borrow occurs here @@ -21,7 +21,7 @@ LL | *y = 1; | ------ first borrow later used here error: captured variable cannot escape `FnMut` closure body - --> $DIR/borrowck-describe-lvalue.rs:305:16 + --> $DIR/borrowck-describe-lvalue.rs:294:16 | LL | || { | - inferred to be a `FnMut` closure @@ -38,7 +38,7 @@ LL | | } = note: ...therefore, they cannot allow references to captured variables to escape error[E0503]: cannot use `f.x` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:53:9 + --> $DIR/borrowck-describe-lvalue.rs:43:9 | LL | let x = f.x(); | - borrow of `f` occurs here @@ -49,7 +49,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `g.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:61:9 + --> $DIR/borrowck-describe-lvalue.rs:51:9 | LL | let x = g.x(); | - borrow of `g` occurs here @@ -60,7 +60,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `h.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:69:9 + --> $DIR/borrowck-describe-lvalue.rs:59:9 | LL | let x = &mut h.0; | -------- borrow of `h.0` occurs here @@ -71,7 +71,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `e.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:78:20 + --> $DIR/borrowck-describe-lvalue.rs:68:20 | LL | let x = e.x(); | - borrow of `e` occurs here @@ -83,7 +83,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `u.a` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:88:9 + --> $DIR/borrowck-describe-lvalue.rs:78:9 | LL | let x = &mut u.a; | -------- borrow of `u.a` occurs here @@ -94,7 +94,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `f.x` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:96:9 + --> $DIR/borrowck-describe-lvalue.rs:86:9 | LL | let x = f.x(); | - borrow of `*f` occurs here @@ -105,7 +105,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `g.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:104:9 + --> $DIR/borrowck-describe-lvalue.rs:94:9 | LL | let x = g.x(); | - borrow of `*g` occurs here @@ -116,7 +116,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `h.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:112:9 + --> $DIR/borrowck-describe-lvalue.rs:102:9 | LL | let x = &mut h.0; | -------- borrow of `h.0` occurs here @@ -127,7 +127,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `e.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:121:20 + --> $DIR/borrowck-describe-lvalue.rs:111:20 | LL | let x = e.x(); | - borrow of `*e` occurs here @@ -139,7 +139,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `u.a` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:131:9 + --> $DIR/borrowck-describe-lvalue.rs:121:9 | LL | let x = &mut u.a; | -------- borrow of `u.a` occurs here @@ -150,7 +150,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:140:15 + --> $DIR/borrowck-describe-lvalue.rs:130:15 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -162,7 +162,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:146:18 + --> $DIR/borrowck-describe-lvalue.rs:136:18 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -174,7 +174,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:152:25 + --> $DIR/borrowck-describe-lvalue.rs:142:25 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -186,7 +186,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:158:28 + --> $DIR/borrowck-describe-lvalue.rs:148:28 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -198,7 +198,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:170:15 + --> $DIR/borrowck-describe-lvalue.rs:160:15 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -210,7 +210,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:176:18 + --> $DIR/borrowck-describe-lvalue.rs:166:18 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -222,7 +222,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:182:15 + --> $DIR/borrowck-describe-lvalue.rs:172:15 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -234,7 +234,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:188:18 + --> $DIR/borrowck-describe-lvalue.rs:178:18 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -246,7 +246,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `e` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:202:13 + --> $DIR/borrowck-describe-lvalue.rs:192:13 | LL | let x = &mut e; | ------ borrow of `e` occurs here @@ -258,7 +258,7 @@ LL | drop(x); | - borrow later used here error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:202:18 + --> $DIR/borrowck-describe-lvalue.rs:192:18 | LL | let x = &mut e; | ------ mutable borrow occurs here @@ -270,7 +270,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:207:23 + --> $DIR/borrowck-describe-lvalue.rs:197:23 | LL | let x = &mut e; | ------ mutable borrow occurs here @@ -282,7 +282,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:221:22 + --> $DIR/borrowck-describe-lvalue.rs:211:22 | LL | let x = &mut s; | ------ mutable borrow occurs here @@ -294,7 +294,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:228:28 + --> $DIR/borrowck-describe-lvalue.rs:218:28 | LL | let x = &mut s; | ------ mutable borrow occurs here @@ -306,7 +306,7 @@ LL | drop(x); | - mutable borrow later used here error[E0503]: cannot use `*v` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:271:9 + --> $DIR/borrowck-describe-lvalue.rs:261:9 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -316,8 +316,8 @@ LL | v[0].y; LL | drop(x); | - borrow later used here -error[E0503]: cannot use `v[..].y` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:271:9 +error[E0503]: cannot use `v[_].y` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:261:9 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -328,7 +328,7 @@ LL | drop(x); | - borrow later used here error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:283:24 + --> $DIR/borrowck-describe-lvalue.rs:273:24 | LL | let x = &mut v; | ------ mutable borrow occurs here @@ -340,7 +340,7 @@ LL | drop(x); | - mutable borrow later used here warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:245:29 + --> $DIR/borrowck-describe-lvalue.rs:235:29 | LL | let x = &mut block; | ---------- mutable borrow occurs here @@ -350,12 +350,11 @@ LL | let p: &'a u8 = &*block.current; LL | drop(x); | - mutable borrow later used here | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future warning[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:260:33 + --> $DIR/borrowck-describe-lvalue.rs:250:33 | LL | let x = &mut block; | ---------- mutable borrow occurs here @@ -365,12 +364,11 @@ LL | let p : *const u8 = &*(*block).current; LL | drop(x); | - mutable borrow later used here | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future error[E0382]: use of moved value: `x` - --> $DIR/borrowck-describe-lvalue.rs:318:22 + --> $DIR/borrowck-describe-lvalue.rs:307:22 | LL | drop(x); | - value moved here diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.stderr index bc6385ffd92..278929eedb0 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.stderr +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `f.x` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:53:9 + --> $DIR/borrowck-describe-lvalue.rs:43:9 | LL | let x = f.x(); | - borrow of `f` occurs here @@ -7,7 +7,7 @@ LL | f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowe | ^^^ use of borrowed `f` error[E0503]: cannot use `g.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:61:9 + --> $DIR/borrowck-describe-lvalue.rs:51:9 | LL | let x = g.x(); | - borrow of `g` occurs here @@ -15,7 +15,7 @@ LL | g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowe | ^^^ use of borrowed `g` error[E0503]: cannot use `h.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:69:9 + --> $DIR/borrowck-describe-lvalue.rs:59:9 | LL | let x = &mut h.0; | --- borrow of `h.0` occurs here @@ -23,7 +23,7 @@ LL | h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowe | ^^^ use of borrowed `h.0` error[E0503]: cannot use `e.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:78:20 + --> $DIR/borrowck-describe-lvalue.rs:68:20 | LL | let x = e.x(); | - borrow of `e` occurs here @@ -32,7 +32,7 @@ LL | Baz::X(value) => value | ^^^^^ use of borrowed `e` error[E0503]: cannot use `u.a` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:88:9 + --> $DIR/borrowck-describe-lvalue.rs:78:9 | LL | let x = &mut u.a; | --- borrow of `u.a` occurs here @@ -40,7 +40,7 @@ LL | u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowe | ^^^ use of borrowed `u.a` error[E0503]: cannot use `f.x` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:96:9 + --> $DIR/borrowck-describe-lvalue.rs:86:9 | LL | let x = f.x(); | - borrow of `*f` occurs here @@ -48,7 +48,7 @@ LL | f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowe | ^^^ use of borrowed `*f` error[E0503]: cannot use `g.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:104:9 + --> $DIR/borrowck-describe-lvalue.rs:94:9 | LL | let x = g.x(); | - borrow of `*g` occurs here @@ -56,7 +56,7 @@ LL | g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowe | ^^^ use of borrowed `*g` error[E0503]: cannot use `h.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:112:9 + --> $DIR/borrowck-describe-lvalue.rs:102:9 | LL | let x = &mut h.0; | --- borrow of `h.0` occurs here @@ -64,7 +64,7 @@ LL | h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowe | ^^^ use of borrowed `h.0` error[E0503]: cannot use `e.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:121:20 + --> $DIR/borrowck-describe-lvalue.rs:111:20 | LL | let x = e.x(); | - borrow of `*e` occurs here @@ -73,7 +73,7 @@ LL | Baz::X(value) => value | ^^^^^ use of borrowed `*e` error[E0503]: cannot use `u.a` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:131:9 + --> $DIR/borrowck-describe-lvalue.rs:121:9 | LL | let x = &mut u.a; | --- borrow of `u.a` occurs here @@ -81,7 +81,7 @@ LL | u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowe | ^^^ use of borrowed `u.a` error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:140:15 + --> $DIR/borrowck-describe-lvalue.rs:130:15 | LL | let x = &mut v; | - borrow of `v` occurs here @@ -90,7 +90,7 @@ LL | &[x, _, .., _, _] => println!("{}", x), | ^ use of borrowed `v` error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:146:18 + --> $DIR/borrowck-describe-lvalue.rs:136:18 | LL | let x = &mut v; | - borrow of `v` occurs here @@ -99,7 +99,7 @@ LL | &[_, x, .., _, _] => println!("{}", x), | ^ use of borrowed `v` error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:152:25 + --> $DIR/borrowck-describe-lvalue.rs:142:25 | LL | let x = &mut v; | - borrow of `v` occurs here @@ -108,7 +108,7 @@ LL | &[_, _, .., x, _] => println!("{}", x), | ^ use of borrowed `v` error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:158:28 + --> $DIR/borrowck-describe-lvalue.rs:148:28 | LL | let x = &mut v; | - borrow of `v` occurs here @@ -117,7 +117,7 @@ LL | &[_, _, .., _, x] => println!("{}", x), | ^ use of borrowed `v` error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:170:15 + --> $DIR/borrowck-describe-lvalue.rs:160:15 | LL | let x = &mut v; | - borrow of `v` occurs here @@ -126,7 +126,7 @@ LL | &[x..] => println!("{:?}", x), | ^ use of borrowed `v` error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:176:18 + --> $DIR/borrowck-describe-lvalue.rs:166:18 | LL | let x = &mut v; | - borrow of `v` occurs here @@ -135,7 +135,7 @@ LL | &[_, x..] => println!("{:?}", x), | ^ use of borrowed `v` error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:182:15 + --> $DIR/borrowck-describe-lvalue.rs:172:15 | LL | let x = &mut v; | - borrow of `v` occurs here @@ -144,7 +144,7 @@ LL | &[x.., _] => println!("{:?}", x), | ^ use of borrowed `v` error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:188:18 + --> $DIR/borrowck-describe-lvalue.rs:178:18 | LL | let x = &mut v; | - borrow of `v` occurs here @@ -153,7 +153,7 @@ LL | &[_, x.., _] => println!("{:?}", x), | ^ use of borrowed `v` error[E0502]: cannot borrow `e.0` as immutable because `e` is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:202:18 + --> $DIR/borrowck-describe-lvalue.rs:192:18 | LL | let x = &mut e; | - mutable borrow occurs here @@ -165,7 +165,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `e.x` as immutable because `e` is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:207:23 + --> $DIR/borrowck-describe-lvalue.rs:197:23 | LL | let x = &mut e; | - mutable borrow occurs here @@ -177,7 +177,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `s.y.0` as immutable because `s` is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:221:22 + --> $DIR/borrowck-describe-lvalue.rs:211:22 | LL | let x = &mut s; | - mutable borrow occurs here @@ -189,7 +189,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `s.x.y` as immutable because `s` is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:228:28 + --> $DIR/borrowck-describe-lvalue.rs:218:28 | LL | let x = &mut s; | - mutable borrow occurs here @@ -201,7 +201,7 @@ LL | } | - mutable borrow ends here error[E0503]: cannot use `v[..].y` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:271:9 + --> $DIR/borrowck-describe-lvalue.rs:261:9 | LL | let x = &mut v; | - borrow of `v` occurs here @@ -209,7 +209,7 @@ LL | v[0].y; | ^^^^^^ use of borrowed `v` error[E0499]: cannot borrow `**x` as mutable more than once at a time - --> $DIR/borrowck-describe-lvalue.rs:295:18 + --> $DIR/borrowck-describe-lvalue.rs:285:18 | LL | let y = &mut x; | - first mutable borrow occurs here @@ -220,7 +220,7 @@ LL | }; | - first borrow ends here error[E0499]: cannot borrow `**x` as mutable more than once at a time - --> $DIR/borrowck-describe-lvalue.rs:307:25 + --> $DIR/borrowck-describe-lvalue.rs:296:25 | LL | let y = &mut x; | - first mutable borrow occurs here @@ -231,7 +231,7 @@ LL | } | - first borrow ends here error[E0382]: use of moved value: `x` - --> $DIR/borrowck-describe-lvalue.rs:318:22 + --> $DIR/borrowck-describe-lvalue.rs:307:22 | LL | drop(x); | - value moved here diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr index 5721c52ba21..279548f870f 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-describe-lvalue.rs:295:13 + --> $DIR/borrowck-describe-lvalue.rs:285:13 | LL | let y = &mut x; | ------ first mutable borrow occurs here @@ -10,7 +10,7 @@ LL | *y = 1; | ------ first borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-describe-lvalue.rs:307:20 + --> $DIR/borrowck-describe-lvalue.rs:296:20 | LL | let y = &mut x; | ------ first mutable borrow occurs here @@ -21,7 +21,7 @@ LL | *y = 1; | ------ first borrow later used here error: captured variable cannot escape `FnMut` closure body - --> $DIR/borrowck-describe-lvalue.rs:305:16 + --> $DIR/borrowck-describe-lvalue.rs:294:16 | LL | || { | - inferred to be a `FnMut` closure @@ -38,7 +38,7 @@ LL | | } = note: ...therefore, they cannot allow references to captured variables to escape error[E0503]: cannot use `f.x` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:53:9 + --> $DIR/borrowck-describe-lvalue.rs:43:9 | LL | let x = f.x(); | - borrow of `f` occurs here @@ -49,7 +49,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `g.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:61:9 + --> $DIR/borrowck-describe-lvalue.rs:51:9 | LL | let x = g.x(); | - borrow of `g` occurs here @@ -60,7 +60,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `h.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:69:9 + --> $DIR/borrowck-describe-lvalue.rs:59:9 | LL | let x = &mut h.0; | -------- borrow of `h.0` occurs here @@ -71,7 +71,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `e.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:78:20 + --> $DIR/borrowck-describe-lvalue.rs:68:20 | LL | let x = e.x(); | - borrow of `e` occurs here @@ -83,7 +83,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `u.a` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:88:9 + --> $DIR/borrowck-describe-lvalue.rs:78:9 | LL | let x = &mut u.a; | -------- borrow of `u.a` occurs here @@ -94,7 +94,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `f.x` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:96:9 + --> $DIR/borrowck-describe-lvalue.rs:86:9 | LL | let x = f.x(); | - borrow of `*f` occurs here @@ -105,7 +105,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `g.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:104:9 + --> $DIR/borrowck-describe-lvalue.rs:94:9 | LL | let x = g.x(); | - borrow of `*g` occurs here @@ -116,7 +116,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `h.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:112:9 + --> $DIR/borrowck-describe-lvalue.rs:102:9 | LL | let x = &mut h.0; | -------- borrow of `h.0` occurs here @@ -127,7 +127,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `e.0` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:121:20 + --> $DIR/borrowck-describe-lvalue.rs:111:20 | LL | let x = e.x(); | - borrow of `*e` occurs here @@ -139,7 +139,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `u.a` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:131:9 + --> $DIR/borrowck-describe-lvalue.rs:121:9 | LL | let x = &mut u.a; | -------- borrow of `u.a` occurs here @@ -150,7 +150,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:140:15 + --> $DIR/borrowck-describe-lvalue.rs:130:15 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -162,7 +162,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:146:18 + --> $DIR/borrowck-describe-lvalue.rs:136:18 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -174,7 +174,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:152:25 + --> $DIR/borrowck-describe-lvalue.rs:142:25 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -186,7 +186,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:158:28 + --> $DIR/borrowck-describe-lvalue.rs:148:28 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -198,7 +198,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:170:15 + --> $DIR/borrowck-describe-lvalue.rs:160:15 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -210,7 +210,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:176:18 + --> $DIR/borrowck-describe-lvalue.rs:166:18 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -222,7 +222,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:182:15 + --> $DIR/borrowck-describe-lvalue.rs:172:15 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -234,7 +234,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `v[..]` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:188:18 + --> $DIR/borrowck-describe-lvalue.rs:178:18 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -246,7 +246,7 @@ LL | drop(x); | - borrow later used here error[E0503]: cannot use `e` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:202:13 + --> $DIR/borrowck-describe-lvalue.rs:192:13 | LL | let x = &mut e; | ------ borrow of `e` occurs here @@ -258,7 +258,7 @@ LL | drop(x); | - borrow later used here error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:202:18 + --> $DIR/borrowck-describe-lvalue.rs:192:18 | LL | let x = &mut e; | ------ mutable borrow occurs here @@ -270,7 +270,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:207:23 + --> $DIR/borrowck-describe-lvalue.rs:197:23 | LL | let x = &mut e; | ------ mutable borrow occurs here @@ -282,7 +282,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:221:22 + --> $DIR/borrowck-describe-lvalue.rs:211:22 | LL | let x = &mut s; | ------ mutable borrow occurs here @@ -294,7 +294,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:228:28 + --> $DIR/borrowck-describe-lvalue.rs:218:28 | LL | let x = &mut s; | ------ mutable borrow occurs here @@ -306,7 +306,7 @@ LL | drop(x); | - mutable borrow later used here error[E0503]: cannot use `*v` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:271:9 + --> $DIR/borrowck-describe-lvalue.rs:261:9 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -316,8 +316,8 @@ LL | v[0].y; LL | drop(x); | - borrow later used here -error[E0503]: cannot use `v[..].y` because it was mutably borrowed - --> $DIR/borrowck-describe-lvalue.rs:271:9 +error[E0503]: cannot use `v[_].y` because it was mutably borrowed + --> $DIR/borrowck-describe-lvalue.rs:261:9 | LL | let x = &mut v; | ------ borrow of `v` occurs here @@ -328,7 +328,7 @@ LL | drop(x); | - borrow later used here error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:283:24 + --> $DIR/borrowck-describe-lvalue.rs:273:24 | LL | let x = &mut v; | ------ mutable borrow occurs here @@ -340,7 +340,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:245:29 + --> $DIR/borrowck-describe-lvalue.rs:235:29 | LL | let x = &mut block; | ---------- mutable borrow occurs here @@ -351,7 +351,7 @@ LL | drop(x); | - mutable borrow later used here error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-describe-lvalue.rs:260:33 + --> $DIR/borrowck-describe-lvalue.rs:250:33 | LL | let x = &mut block; | ---------- mutable borrow occurs here @@ -362,7 +362,7 @@ LL | drop(x); | - mutable borrow later used here error[E0382]: use of moved value: `x` - --> $DIR/borrowck-describe-lvalue.rs:318:22 + --> $DIR/borrowck-describe-lvalue.rs:307:22 | LL | drop(x); | - value moved here diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.rs b/src/test/ui/borrowck/borrowck-describe-lvalue.rs index 649de888ab0..eb622ac10ad 100644 --- a/src/test/ui/borrowck/borrowck-describe-lvalue.rs +++ b/src/test/ui/borrowck/borrowck-describe-lvalue.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir @@ -270,7 +260,7 @@ fn main() { let x = &mut v; v[0].y; //[ast]~^ ERROR cannot use `v[..].y` because it was mutably borrowed - //[mir]~^^ ERROR cannot use `v[..].y` because it was mutably borrowed + //[mir]~^^ ERROR cannot use `v[_].y` because it was mutably borrowed //[mir]~| ERROR cannot use `*v` because it was mutably borrowed drop(x); } @@ -299,7 +289,6 @@ fn main() { } // Field from upvar nested { - // FIXME(#49824) -- the free region error below should probably not be there let mut x = 0; || { || { //[mir]~ ERROR captured variable cannot escape `FnMut` closure body diff --git a/src/test/ui/borrowck/borrowck-drop-from-guard.rs b/src/test/ui/borrowck/borrowck-drop-from-guard.rs index 496aa84b593..67a2275dcf7 100644 --- a/src/test/ui/borrowck/borrowck-drop-from-guard.rs +++ b/src/test/ui/borrowck/borrowck-drop-from-guard.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - //compile-flags: -Z borrowck=mir fn foo(_:String) {} diff --git a/src/test/ui/borrowck/borrowck-drop-from-guard.stderr b/src/test/ui/borrowck/borrowck-drop-from-guard.stderr index e28b500ce63..07b597f480f 100644 --- a/src/test/ui/borrowck/borrowck-drop-from-guard.stderr +++ b/src/test/ui/borrowck/borrowck-drop-from-guard.stderr @@ -1,13 +1,14 @@ error[E0382]: use of moved value: `my_str` - --> $DIR/borrowck-drop-from-guard.rs:22:23 + --> $DIR/borrowck-drop-from-guard.rs:11:23 | +LL | let my_str = "hello".to_owned(); + | ------ move occurs because `my_str` has type `std::string::String`, which does not implement the `Copy` trait +LL | match Some(42) { LL | Some(_) if { drop(my_str); false } => {} | ------ value moved here LL | Some(_) => {} LL | None => { foo(my_str); } //~ ERROR [E0382] | ^^^^^^ value used here after move - | - = note: move occurs because `my_str` has type `std::string::String`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-1.nll.stderr b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.nll.stderr index ceb145eea77..3195120cba2 100644 --- a/src/test/ui/borrowck/borrowck-escaping-closure-error-1.nll.stderr +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.nll.stderr @@ -1,5 +1,5 @@ error[E0373]: closure may outlive the current function, but it borrows `books`, which is owned by the current function - --> $DIR/borrowck-escaping-closure-error-1.rs:23:11 + --> $DIR/borrowck-escaping-closure-error-1.rs:13:11 | LL | spawn(|| books.push(4)); | ^^ ----- `books` is borrowed here @@ -7,7 +7,7 @@ LL | spawn(|| books.push(4)); | may outlive borrowed value `books` | note: function requires argument type to outlive `'static` - --> $DIR/borrowck-escaping-closure-error-1.rs:23:5 + --> $DIR/borrowck-escaping-closure-error-1.rs:13:5 | LL | spawn(|| books.push(4)); | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-1.rs b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.rs index 87e40df7663..11c0610aa0c 100644 --- a/src/test/ui/borrowck/borrowck-escaping-closure-error-1.rs +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::thread::spawn; // Test that we give a custom error (E0373) for the case where a diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr index eb1fa53d755..16ba61d9972 100644 --- a/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-1.stderr @@ -1,5 +1,5 @@ error[E0373]: closure may outlive the current function, but it borrows `books`, which is owned by the current function - --> $DIR/borrowck-escaping-closure-error-1.rs:23:11 + --> $DIR/borrowck-escaping-closure-error-1.rs:13:11 | LL | spawn(|| books.push(4)); | ^^ ----- `books` is borrowed here diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.nll.stderr b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.nll.stderr index 454264727de..3227aa9bb68 100644 --- a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.nll.stderr @@ -1,5 +1,5 @@ error[E0373]: closure may outlive the current function, but it borrows `books`, which is owned by the current function - --> $DIR/borrowck-escaping-closure-error-2.rs:21:14 + --> $DIR/borrowck-escaping-closure-error-2.rs:11:14 | LL | Box::new(|| books.push(4)) | ^^ ----- `books` is borrowed here @@ -7,7 +7,7 @@ LL | Box::new(|| books.push(4)) | may outlive borrowed value `books` | note: closure is returned here - --> $DIR/borrowck-escaping-closure-error-2.rs:21:5 + --> $DIR/borrowck-escaping-closure-error-2.rs:11:5 | LL | Box::new(|| books.push(4)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs index 67700be890b..a44e3031e25 100644 --- a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we give a custom error (E0373) for the case where a // closure is escaping current frame, and offer a suggested code edit. // I refrained from including the precise message here, but the diff --git a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr index 1343c0a1f5b..960f65da5f0 100644 --- a/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr +++ b/src/test/ui/borrowck/borrowck-escaping-closure-error-2.stderr @@ -1,5 +1,5 @@ error[E0373]: closure may outlive the current function, but it borrows `books`, which is owned by the current function - --> $DIR/borrowck-escaping-closure-error-2.rs:21:14 + --> $DIR/borrowck-escaping-closure-error-2.rs:11:14 | LL | Box::new(|| books.push(4)) | ^^ ----- `books` is borrowed here diff --git a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.edition.stderr b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.edition.stderr index fa82efa3533..9059ef438d0 100644 --- a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.edition.stderr +++ b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.edition.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-feature-nll-overrides-migrate.rs:32:17 + --> $DIR/borrowck-feature-nll-overrides-migrate.rs:22:17 | LL | (|| { let bar = foo; bar.take() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content diff --git a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs index 104c0886311..4eefc5859ff 100644 --- a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs +++ b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is a test that the `#![feature(nll)]` opt-in overrides the // migration mode. The intention here is to emulate the goal behavior // that `--edition 2018` effects on borrowck (modeled here by `-Z diff --git a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.zflag.stderr b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.zflag.stderr index fa82efa3533..9059ef438d0 100644 --- a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.zflag.stderr +++ b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.zflag.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-feature-nll-overrides-migrate.rs:32:17 + --> $DIR/borrowck-feature-nll-overrides-migrate.rs:22:17 | LL | (|| { let bar = foo; bar.take() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr index 81d9e958e28..25a9a112044 100644 --- a/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr +++ b/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr @@ -1,21 +1,25 @@ error[E0382]: use of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:18:10 + --> $DIR/borrowck-field-sensitivity.rs:8:10 | LL | drop(x.b); | --- value moved here LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` | ^^^^ value used here after move + | + = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:24:10 + --> $DIR/borrowck-field-sensitivity.rs:14:10 | LL | let y = A { a: 3, .. x }; | ---------------- value moved here LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` | ^^^^ value used here after move + | + = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:30:13 + --> $DIR/borrowck-field-sensitivity.rs:20:13 | LL | drop(x.b); | --- value moved here @@ -25,7 +29,7 @@ LL | let p = &x.b; //~ ERROR use of moved value: `x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:37:13 + --> $DIR/borrowck-field-sensitivity.rs:27:13 | LL | let _y = A { a: 3, .. x }; | ---------------- value moved here @@ -35,7 +39,7 @@ LL | let p = &x.b; //~ ERROR use of moved value: `x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0505]: cannot move out of `x.b` because it is borrowed - --> $DIR/borrowck-field-sensitivity.rs:44:10 + --> $DIR/borrowck-field-sensitivity.rs:34:10 | LL | let p = &x.b; | ---- borrow of `x.b` occurs here @@ -45,7 +49,7 @@ LL | drop(**p); | --- borrow later used here error[E0505]: cannot move out of `x.b` because it is borrowed - --> $DIR/borrowck-field-sensitivity.rs:51:14 + --> $DIR/borrowck-field-sensitivity.rs:41:14 | LL | let p = &x.b; | ---- borrow of `x.b` occurs here @@ -55,7 +59,7 @@ LL | drop(**p); | --- borrow later used here error[E0499]: cannot borrow `x.a` as mutable more than once at a time - --> $DIR/borrowck-field-sensitivity.rs:58:13 + --> $DIR/borrowck-field-sensitivity.rs:48:13 | LL | let p = &mut x.a; | -------- first mutable borrow occurs here @@ -65,7 +69,7 @@ LL | drop(*p); | -- first borrow later used here error[E0382]: use of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:66:10 + --> $DIR/borrowck-field-sensitivity.rs:56:10 | LL | drop(x.b); | --- value moved here @@ -75,7 +79,7 @@ LL | drop(x.b); //~ ERROR use of moved value: `x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:72:10 + --> $DIR/borrowck-field-sensitivity.rs:62:10 | LL | let _y = A { a: 3, .. x }; | ---------------- value moved here @@ -85,7 +89,7 @@ LL | drop(x.b); //~ ERROR use of moved value: `x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:78:14 + --> $DIR/borrowck-field-sensitivity.rs:68:14 | LL | drop(x.b); | --- value moved here @@ -95,7 +99,7 @@ LL | let _z = A { a: 3, .. x }; //~ ERROR use of moved value: `x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:84:14 + --> $DIR/borrowck-field-sensitivity.rs:74:14 | LL | let _y = A { a: 3, .. x }; | ---------------- value moved here @@ -105,19 +109,19 @@ LL | let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0381]: assign to part of possibly uninitialized variable: `x` - --> $DIR/borrowck-field-sensitivity.rs:91:5 + --> $DIR/borrowck-field-sensitivity.rs:81:5 | LL | x.a = 1; | ^^^^^^^ use of possibly uninitialized `x` error[E0381]: assign to part of possibly uninitialized variable: `x` - --> $DIR/borrowck-field-sensitivity.rs:97:5 + --> $DIR/borrowck-field-sensitivity.rs:87:5 | LL | x.a = 1; | ^^^^^^^ use of possibly uninitialized `x` error[E0381]: assign to part of possibly uninitialized variable: `x` - --> $DIR/borrowck-field-sensitivity.rs:104:5 + --> $DIR/borrowck-field-sensitivity.rs:94:5 | LL | x.b = box 1; | ^^^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.rs b/src/test/ui/borrowck/borrowck-field-sensitivity.rs index 13fd5fce955..1e9e6d68a51 100644 --- a/src/test/ui/borrowck/borrowck-field-sensitivity.rs +++ b/src/test/ui/borrowck/borrowck-field-sensitivity.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] struct A { a: isize, b: Box } diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr index e5eba3790a0..bfab5cbe536 100644 --- a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr +++ b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `*x.b` - --> $DIR/borrowck-field-sensitivity.rs:18:10 + --> $DIR/borrowck-field-sensitivity.rs:8:10 | LL | drop(x.b); | --- value moved here @@ -9,7 +9,7 @@ LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `*x.b` - --> $DIR/borrowck-field-sensitivity.rs:24:10 + --> $DIR/borrowck-field-sensitivity.rs:14:10 | LL | let y = A { a: 3, .. x }; | - value moved here @@ -19,7 +19,7 @@ LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:30:14 + --> $DIR/borrowck-field-sensitivity.rs:20:14 | LL | drop(x.b); | --- value moved here @@ -29,7 +29,7 @@ LL | let p = &x.b; //~ ERROR use of moved value: `x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:37:14 + --> $DIR/borrowck-field-sensitivity.rs:27:14 | LL | let _y = A { a: 3, .. x }; | - value moved here @@ -39,7 +39,7 @@ LL | let p = &x.b; //~ ERROR use of moved value: `x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0505]: cannot move out of `x.b` because it is borrowed - --> $DIR/borrowck-field-sensitivity.rs:44:10 + --> $DIR/borrowck-field-sensitivity.rs:34:10 | LL | let p = &x.b; | --- borrow of `x.b` occurs here @@ -47,7 +47,7 @@ LL | drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed | ^^^ move out of `x.b` occurs here error[E0505]: cannot move out of `x.b` because it is borrowed - --> $DIR/borrowck-field-sensitivity.rs:51:27 + --> $DIR/borrowck-field-sensitivity.rs:41:27 | LL | let p = &x.b; | --- borrow of `x.b` occurs here @@ -55,7 +55,7 @@ LL | let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because i | ^ move out of `x.b` occurs here error[E0499]: cannot borrow `x.a` as mutable more than once at a time - --> $DIR/borrowck-field-sensitivity.rs:58:18 + --> $DIR/borrowck-field-sensitivity.rs:48:18 | LL | let p = &mut x.a; | --- first mutable borrow occurs here @@ -66,7 +66,7 @@ LL | } | - first borrow ends here error[E0382]: use of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:66:10 + --> $DIR/borrowck-field-sensitivity.rs:56:10 | LL | drop(x.b); | --- value moved here @@ -76,7 +76,7 @@ LL | drop(x.b); //~ ERROR use of moved value: `x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:72:10 + --> $DIR/borrowck-field-sensitivity.rs:62:10 | LL | let _y = A { a: 3, .. x }; | - value moved here @@ -86,7 +86,7 @@ LL | drop(x.b); //~ ERROR use of moved value: `x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:78:27 + --> $DIR/borrowck-field-sensitivity.rs:68:27 | LL | drop(x.b); | --- value moved here @@ -96,7 +96,7 @@ LL | let _z = A { a: 3, .. x }; //~ ERROR use of moved value: `x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:84:27 + --> $DIR/borrowck-field-sensitivity.rs:74:27 | LL | let _y = A { a: 3, .. x }; | - value moved here @@ -106,19 +106,19 @@ LL | let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b` = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0381]: use of possibly uninitialized variable: `x.a` - --> $DIR/borrowck-field-sensitivity.rs:92:10 + --> $DIR/borrowck-field-sensitivity.rs:82:10 | LL | drop(x.a); //~ ERROR use of possibly uninitialized variable: `x.a` | ^^^ use of possibly uninitialized `x.a` error[E0381]: use of possibly uninitialized variable: `x.a` - --> $DIR/borrowck-field-sensitivity.rs:98:14 + --> $DIR/borrowck-field-sensitivity.rs:88:14 | LL | let p = &x.a; //~ ERROR use of possibly uninitialized variable: `x.a` | ^^^ use of possibly uninitialized `x.a` error[E0381]: use of possibly uninitialized variable: `x.b` - --> $DIR/borrowck-field-sensitivity.rs:105:10 + --> $DIR/borrowck-field-sensitivity.rs:95:10 | LL | drop(x.b); //~ ERROR use of possibly uninitialized variable: `x.b` | ^^^ use of possibly uninitialized `x.b` diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.stderr index 4d0c762ca77..6a5c5047fb2 100644 --- a/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.stderr +++ b/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-fn-in-const-a.rs:19:16 + --> $DIR/borrowck-fn-in-const-a.rs:9:16 | LL | return *x //[ast]~ ERROR cannot move out of borrowed content [E0507] | ^^ cannot move out of borrowed content diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.mir.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-a.mir.stderr index 4d0c762ca77..6a5c5047fb2 100644 --- a/src/test/ui/borrowck/borrowck-fn-in-const-a.mir.stderr +++ b/src/test/ui/borrowck/borrowck-fn-in-const-a.mir.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-fn-in-const-a.rs:19:16 + --> $DIR/borrowck-fn-in-const-a.rs:9:16 | LL | return *x //[ast]~ ERROR cannot move out of borrowed content [E0507] | ^^ cannot move out of borrowed content diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.rs b/src/test/ui/borrowck/borrowck-fn-in-const-a.rs index 33b78cb26d8..17663a30ca7 100644 --- a/src/test/ui/borrowck/borrowck-fn-in-const-a.rs +++ b/src/test/ui/borrowck/borrowck-fn-in-const-a.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr index 70173058a36..7d8618e16d9 100644 --- a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr +++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr @@ -1,5 +1,5 @@ error[E0713]: borrow may still be in use when destructor runs - --> $DIR/borrowck-fn-in-const-c.rs:27:16 + --> $DIR/borrowck-fn-in-const-c.rs:17:16 | LL | return &local.inner; //~ ERROR does not live long enough | ^^^^^^^^^^^^ returning this value requires that `local.inner` is borrowed for `'static` diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.rs b/src/test/ui/borrowck/borrowck-fn-in-const-c.rs index e607397e920..d0a2e5b037d 100644 --- a/src/test/ui/borrowck/borrowck-fn-in-const-c.rs +++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we check fns appearing in constant declarations. // Issue #22382. diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr index 1dda8d41860..f6e7e99393c 100644 --- a/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr +++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr @@ -1,5 +1,5 @@ error[E0597]: `local.inner` does not live long enough - --> $DIR/borrowck-fn-in-const-c.rs:27:17 + --> $DIR/borrowck-fn-in-const-c.rs:17:17 | LL | return &local.inner; //~ ERROR does not live long enough | ^^^^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr index 25eb69ad937..8ba6a07b3d2 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15 + --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:15 | LL | for &a in x.iter() { //~ ERROR cannot move out | -- ^^^^^^^^ cannot move out of borrowed content @@ -8,13 +8,13 @@ LL | for &a in x.iter() { //~ ERROR cannot move out | help: consider removing the `&`: `a` | note: move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait - --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10 + --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:10 | LL | for &a in x.iter() { //~ ERROR cannot move out | ^ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:15 + --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:15 | LL | for &a in &f.a { //~ ERROR cannot move out | -- ^^^^ cannot move out of borrowed content @@ -23,13 +23,13 @@ LL | for &a in &f.a { //~ ERROR cannot move out | help: consider removing the `&`: `a` | note: move occurs because `a` has type `std::boxed::Box`, which does not implement the `Copy` trait - --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:10 + --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:10 | LL | for &a in &f.a { //~ ERROR cannot move out | ^ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:15 + --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15 | LL | for &a in x.iter() { //~ ERROR cannot move out | -- ^^^^^^^^ cannot move out of borrowed content @@ -38,7 +38,7 @@ LL | for &a in x.iter() { //~ ERROR cannot move out | help: consider removing the `&`: `a` | note: move occurs because `a` has type `std::boxed::Box`, which does not implement the `Copy` trait - --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:10 + --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10 | LL | for &a in x.iter() { //~ ERROR cannot move out | ^ diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs index 31ec5aea7f3..de75368578d 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #16205. #![feature(box_syntax)] diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr index baa8a668cd9..1a7e2cb6963 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:9 + --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:9 | LL | for &a in x.iter() { //~ ERROR cannot move out | ^- @@ -8,7 +8,7 @@ LL | for &a in x.iter() { //~ ERROR cannot move out | cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:9 + --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:9 | LL | for &a in &f.a { //~ ERROR cannot move out | ^- @@ -17,7 +17,7 @@ LL | for &a in &f.a { //~ ERROR cannot move out | cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:9 + --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:9 | LL | for &a in x.iter() { //~ ERROR cannot move out | ^- diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr index a6487ede6f8..c0549c91e33 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-for-loop-head-linkage.rs:17:9 + --> $DIR/borrowck-for-loop-head-linkage.rs:7:9 | LL | for &x in &vector { | ------- @@ -11,7 +11,7 @@ LL | vector.extend(repeat(0)); //~ ERROR cannot borrow | ^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-for-loop-head-linkage.rs:18:9 + --> $DIR/borrowck-for-loop-head-linkage.rs:8:9 | LL | for &x in &vector { | ------- diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.rs b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.rs index b79fc5b2bf6..a84b695aafb 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.rs +++ b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::iter::repeat; fn main() { diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr index fd00138356d..85008948a1c 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-for-loop-head-linkage.rs:17:9 + --> $DIR/borrowck-for-loop-head-linkage.rs:7:9 | LL | for &x in &vector { | ------ @@ -11,7 +11,7 @@ LL | vector.extend(repeat(0)); //~ ERROR cannot borrow | ^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-for-loop-head-linkage.rs:18:9 + --> $DIR/borrowck-for-loop-head-linkage.rs:8:9 | LL | for &x in &vector { | ------ diff --git a/src/test/ui/borrowck/borrowck-if-no-else.rs b/src/test/ui/borrowck/borrowck-if-no-else.rs index 74b542800b9..044db99d54c 100644 --- a/src/test/ui/borrowck/borrowck-if-no-else.rs +++ b/src/test/ui/borrowck/borrowck-if-no-else.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(x: isize) { println!("{}", x); } fn main() { diff --git a/src/test/ui/borrowck/borrowck-if-no-else.stderr b/src/test/ui/borrowck/borrowck-if-no-else.stderr index 6c4a53a37d9..f6d199d788b 100644 --- a/src/test/ui/borrowck/borrowck-if-no-else.stderr +++ b/src/test/ui/borrowck/borrowck-if-no-else.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-if-no-else.rs:15:9 + --> $DIR/borrowck-if-no-else.rs:5:9 | LL | foo(x); //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-if-with-else.rs b/src/test/ui/borrowck/borrowck-if-with-else.rs index f3b02d12854..f632d61a6c3 100644 --- a/src/test/ui/borrowck/borrowck-if-with-else.rs +++ b/src/test/ui/borrowck/borrowck-if-with-else.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(x: isize) { println!("{}", x); } fn main() { diff --git a/src/test/ui/borrowck/borrowck-if-with-else.stderr b/src/test/ui/borrowck/borrowck-if-with-else.stderr index 097d11e387e..e569fbdeca1 100644 --- a/src/test/ui/borrowck/borrowck-if-with-else.stderr +++ b/src/test/ui/borrowck/borrowck-if-with-else.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-if-with-else.rs:20:9 + --> $DIR/borrowck-if-with-else.rs:10:9 | LL | foo(x); //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.nll.stderr b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.nll.stderr index 0a1bc2c1959..d3708b5cf2b 100644 --- a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `_a` because it is borrowed - --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:19:9 + --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:9:9 | LL | let b = &mut _a; | ------- borrow of `_a` occurs here diff --git a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.stderr b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.stderr index cb6d9875a92..618edf57bb2 100644 --- a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.stderr +++ b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `_a` because it is borrowed - --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:19:9 + --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:9:9 | LL | let b = &mut _a; | -- borrow of `_a` occurs here diff --git a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.mir.stderr b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.mir.stderr index 0a1bc2c1959..d3708b5cf2b 100644 --- a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.mir.stderr +++ b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.mir.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `_a` because it is borrowed - --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:19:9 + --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:9:9 | LL | let b = &mut _a; | ------- borrow of `_a` occurs here diff --git a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs index 6f0e0f43f60..334d2e008b9 100644 --- a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs +++ b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-in-static.nll.stderr b/src/test/ui/borrowck/borrowck-in-static.nll.stderr index 45fa1764f70..ff094ecf707 100644 --- a/src/test/ui/borrowck/borrowck-in-static.nll.stderr +++ b/src/test/ui/borrowck/borrowck-in-static.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/borrowck-in-static.rs:15:17 + --> $DIR/borrowck-in-static.rs:5:17 | LL | let x = Box::new(0); | - captured outer variable diff --git a/src/test/ui/borrowck/borrowck-in-static.rs b/src/test/ui/borrowck/borrowck-in-static.rs index 16b0e8638de..c08f4138bfb 100644 --- a/src/test/ui/borrowck/borrowck-in-static.rs +++ b/src/test/ui/borrowck/borrowck-in-static.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that borrowck looks inside consts/statics static FN : &'static (Fn() -> (BoxBox>) + Sync) = &|| { diff --git a/src/test/ui/borrowck/borrowck-in-static.stderr b/src/test/ui/borrowck/borrowck-in-static.stderr index 356fad07666..400f3cd1c3e 100644 --- a/src/test/ui/borrowck/borrowck-in-static.stderr +++ b/src/test/ui/borrowck/borrowck-in-static.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure - --> $DIR/borrowck-in-static.rs:15:17 + --> $DIR/borrowck-in-static.rs:5:17 | LL | let x = Box::new(0); | - captured outer variable diff --git a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.rs b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.rs index 5b32fd2d198..f7457781adc 100644 --- a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.rs +++ b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let j = || -> isize { let i: isize; diff --git a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr index e55603c451f..0195dc60eb3 100644 --- a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr +++ b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `i` - --> $DIR/borrowck-init-in-called-fn-expr.rs:14:9 + --> $DIR/borrowck-init-in-called-fn-expr.rs:4:9 | LL | i //~ ERROR use of possibly uninitialized variable: `i` | ^ use of possibly uninitialized `i` diff --git a/src/test/ui/borrowck/borrowck-init-in-fn-expr.rs b/src/test/ui/borrowck/borrowck-init-in-fn-expr.rs index 65f1a1fa098..50558146255 100644 --- a/src/test/ui/borrowck/borrowck-init-in-fn-expr.rs +++ b/src/test/ui/borrowck/borrowck-init-in-fn-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let f = || -> isize { let i: isize; diff --git a/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr b/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr index 406fb5e6834..dfa63f71c69 100644 --- a/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr +++ b/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `i` - --> $DIR/borrowck-init-in-fn-expr.rs:14:9 + --> $DIR/borrowck-init-in-fn-expr.rs:4:9 | LL | i //~ ERROR use of possibly uninitialized variable: `i` | ^ use of possibly uninitialized `i` diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.ast.nll.stderr b/src/test/ui/borrowck/borrowck-init-in-fru.ast.nll.stderr index e6025978444..35649b1bb2a 100644 --- a/src/test/ui/borrowck/borrowck-init-in-fru.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-init-in-fru.ast.nll.stderr @@ -1,8 +1,8 @@ error[E0381]: use of possibly uninitialized variable: `origin` - --> $DIR/borrowck-init-in-fru.rs:22:5 + --> $DIR/borrowck-init-in-fru.rs:12:5 | -LL | origin = point {x: 10,.. origin}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y` +LL | origin = Point { x: 10, ..origin }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.ast.stderr b/src/test/ui/borrowck/borrowck-init-in-fru.ast.stderr index a5c1ef7f4f5..3ba01098766 100644 --- a/src/test/ui/borrowck/borrowck-init-in-fru.ast.stderr +++ b/src/test/ui/borrowck/borrowck-init-in-fru.ast.stderr @@ -1,8 +1,8 @@ error[E0381]: use of possibly uninitialized variable: `origin.y` - --> $DIR/borrowck-init-in-fru.rs:22:30 + --> $DIR/borrowck-init-in-fru.rs:12:31 | -LL | origin = point {x: 10,.. origin}; - | ^^^^^^ use of possibly uninitialized `origin.y` +LL | origin = Point { x: 10, ..origin }; + | ^^^^^^ use of possibly uninitialized `origin.y` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.mir.stderr b/src/test/ui/borrowck/borrowck-init-in-fru.mir.stderr index e6025978444..35649b1bb2a 100644 --- a/src/test/ui/borrowck/borrowck-init-in-fru.mir.stderr +++ b/src/test/ui/borrowck/borrowck-init-in-fru.mir.stderr @@ -1,8 +1,8 @@ error[E0381]: use of possibly uninitialized variable: `origin` - --> $DIR/borrowck-init-in-fru.rs:22:5 + --> $DIR/borrowck-init-in-fru.rs:12:5 | -LL | origin = point {x: 10,.. origin}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y` +LL | origin = Point { x: 10, ..origin }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.rs b/src/test/ui/borrowck/borrowck-init-in-fru.rs index 1ec0f980774..9a06c7ab772 100644 --- a/src/test/ui/borrowck/borrowck-init-in-fru.rs +++ b/src/test/ui/borrowck/borrowck-init-in-fru.rs @@ -1,25 +1,15 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir #[derive(Clone)] -struct point { +struct Point { x: isize, y: isize, } fn main() { - let mut origin: point; - origin = point {x: 10,.. origin}; + let mut origin: Point; + origin = Point { x: 10, ..origin }; //[ast]~^ ERROR use of possibly uninitialized variable: `origin.y` [E0381] //[mir]~^^ ERROR [E0381] origin.clone(); diff --git a/src/test/ui/borrowck/borrowck-init-op-equal.rs b/src/test/ui/borrowck/borrowck-init-op-equal.rs index e0d93fd1d47..d3fa852ac91 100644 --- a/src/test/ui/borrowck/borrowck-init-op-equal.rs +++ b/src/test/ui/borrowck/borrowck-init-op-equal.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn test() { let v: isize; v += 1; //~ ERROR use of possibly uninitialized variable: `v` diff --git a/src/test/ui/borrowck/borrowck-init-op-equal.stderr b/src/test/ui/borrowck/borrowck-init-op-equal.stderr index b8e91e356c1..414124040aa 100644 --- a/src/test/ui/borrowck/borrowck-init-op-equal.stderr +++ b/src/test/ui/borrowck/borrowck-init-op-equal.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `v` - --> $DIR/borrowck-init-op-equal.rs:14:5 + --> $DIR/borrowck-init-op-equal.rs:3:5 | LL | v += 1; //~ ERROR use of possibly uninitialized variable: `v` | ^^^^^^ use of possibly uninitialized `v` diff --git a/src/test/ui/borrowck/borrowck-init-plus-equal.rs b/src/test/ui/borrowck/borrowck-init-plus-equal.rs index a036286f363..d895a2e16b5 100644 --- a/src/test/ui/borrowck/borrowck-init-plus-equal.rs +++ b/src/test/ui/borrowck/borrowck-init-plus-equal.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn test() { let mut v: isize; v = v + 1; //~ ERROR use of possibly uninitialized variable: `v` diff --git a/src/test/ui/borrowck/borrowck-init-plus-equal.stderr b/src/test/ui/borrowck/borrowck-init-plus-equal.stderr index f49c06c0c86..124a60b8a50 100644 --- a/src/test/ui/borrowck/borrowck-init-plus-equal.stderr +++ b/src/test/ui/borrowck/borrowck-init-plus-equal.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `v` - --> $DIR/borrowck-init-plus-equal.rs:13:9 + --> $DIR/borrowck-init-plus-equal.rs:3:9 | LL | v = v + 1; //~ ERROR use of possibly uninitialized variable: `v` | ^ use of possibly uninitialized `v` diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr index 123d475f1c0..b99d5e813c7 100644 --- a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr +++ b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr @@ -1,5 +1,5 @@ error[E0501]: cannot borrow `*f` as mutable because previous closure requires unique access - --> $DIR/borrowck-insert-during-each.rs:26:3 + --> $DIR/borrowck-insert-during-each.rs:16:3 | LL | f.foo( | ^ --- first borrow later used by call @@ -10,10 +10,10 @@ LL | | |a| { //~ ERROR closure requires unique access to `f` LL | | f.n.insert(*a); | | - first borrow occurs due to use of `f` in closure LL | | }) - | |__________^ borrow occurs here + | |__________^ second borrow occurs here error[E0500]: closure requires unique access to `f` but it is already borrowed - --> $DIR/borrowck-insert-during-each.rs:27:9 + --> $DIR/borrowck-insert-during-each.rs:17:9 | LL | f.foo( | - --- first borrow later used by call diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.rs b/src/test/ui/borrowck/borrowck-insert-during-each.rs index 8499ebb8ac3..025da4d613d 100644 --- a/src/test/ui/borrowck/borrowck-insert-during-each.rs +++ b/src/test/ui/borrowck/borrowck-insert-during-each.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::HashSet; struct Foo { diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.stderr b/src/test/ui/borrowck/borrowck-insert-during-each.stderr index 30648edffd8..021b5b27ae7 100644 --- a/src/test/ui/borrowck/borrowck-insert-during-each.stderr +++ b/src/test/ui/borrowck/borrowck-insert-during-each.stderr @@ -1,5 +1,5 @@ error[E0500]: closure requires unique access to `f` but `*f` is already borrowed - --> $DIR/borrowck-insert-during-each.rs:27:9 + --> $DIR/borrowck-insert-during-each.rs:17:9 | LL | f.foo( | - borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-issue-14498.ast.nll.stderr b/src/test/ui/borrowck/borrowck-issue-14498.ast.nll.stderr index d90eda41164..81610536c52 100644 --- a/src/test/ui/borrowck/borrowck-issue-14498.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-issue-14498.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `***p` which is behind a `&` reference - --> $DIR/borrowck-issue-14498.rs:29:5 + --> $DIR/borrowck-issue-14498.rs:19:5 | LL | let p = &y; | -- help: consider changing this to be a mutable reference: `&mut y` @@ -7,7 +7,7 @@ LL | ***p = 2; //[ast]~ ERROR cannot assign to data in a `&` reference | ^^^^^^^^ `p` is a `&` reference, so the data it refers to cannot be written error[E0506]: cannot assign to `**y` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:39:5 + --> $DIR/borrowck-issue-14498.rs:29:5 | LL | let p = &y; | -- borrow of `**y` occurs here @@ -19,7 +19,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:50:5 + --> $DIR/borrowck-issue-14498.rs:40:5 | LL | let p = &y; | -- borrow of `**y` occurs here @@ -31,7 +31,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:61:5 + --> $DIR/borrowck-issue-14498.rs:51:5 | LL | let p = &y; | -- borrow of `**y` occurs here @@ -43,7 +43,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:72:5 + --> $DIR/borrowck-issue-14498.rs:62:5 | LL | let p = &y; | -- borrow of `**y` occurs here @@ -55,7 +55,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y.a` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:83:5 + --> $DIR/borrowck-issue-14498.rs:73:5 | LL | let p = &y.a; | ---- borrow of `**y.a` occurs here @@ -67,7 +67,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y.a` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:94:5 + --> $DIR/borrowck-issue-14498.rs:84:5 | LL | let p = &y.a; | ---- borrow of `**y.a` occurs here @@ -79,7 +79,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y.a` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:105:5 + --> $DIR/borrowck-issue-14498.rs:95:5 | LL | let p = &y.a; | ---- borrow of `**y.a` occurs here @@ -91,7 +91,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y.a` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:116:5 + --> $DIR/borrowck-issue-14498.rs:106:5 | LL | let p = &y.a; | ---- borrow of `**y.a` occurs here diff --git a/src/test/ui/borrowck/borrowck-issue-14498.ast.stderr b/src/test/ui/borrowck/borrowck-issue-14498.ast.stderr index ffb793e48df..59249dadcb0 100644 --- a/src/test/ui/borrowck/borrowck-issue-14498.ast.stderr +++ b/src/test/ui/borrowck/borrowck-issue-14498.ast.stderr @@ -1,11 +1,11 @@ error[E0389]: cannot assign to data in a `&` reference - --> $DIR/borrowck-issue-14498.rs:29:5 + --> $DIR/borrowck-issue-14498.rs:19:5 | LL | ***p = 2; //[ast]~ ERROR cannot assign to data in a `&` reference | ^^^^^^^^ assignment into an immutable reference error[E0506]: cannot assign to `**y` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:39:5 + --> $DIR/borrowck-issue-14498.rs:29:5 | LL | let p = &y; | - borrow of `**y` occurs here @@ -14,7 +14,7 @@ LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed | ^^^^^^^ assignment to borrowed `**y` occurs here error[E0506]: cannot assign to `**y` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:50:5 + --> $DIR/borrowck-issue-14498.rs:40:5 | LL | let p = &y; | - borrow of `**y` occurs here @@ -23,7 +23,7 @@ LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed | ^^^^^^^ assignment to borrowed `**y` occurs here error[E0506]: cannot assign to `**y` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:61:5 + --> $DIR/borrowck-issue-14498.rs:51:5 | LL | let p = &y; | - borrow of `**y` occurs here @@ -32,7 +32,7 @@ LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed | ^^^^^^^ assignment to borrowed `**y` occurs here error[E0506]: cannot assign to `**y` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:72:5 + --> $DIR/borrowck-issue-14498.rs:62:5 | LL | let p = &y; | - borrow of `**y` occurs here @@ -41,7 +41,7 @@ LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed | ^^^^^^^ assignment to borrowed `**y` occurs here error[E0506]: cannot assign to `**y.a` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:83:5 + --> $DIR/borrowck-issue-14498.rs:73:5 | LL | let p = &y.a; | --- borrow of `**y.a` occurs here @@ -50,7 +50,7 @@ LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrow | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here error[E0506]: cannot assign to `**y.a` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:94:5 + --> $DIR/borrowck-issue-14498.rs:84:5 | LL | let p = &y.a; | --- borrow of `**y.a` occurs here @@ -59,7 +59,7 @@ LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrow | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here error[E0506]: cannot assign to `**y.a` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:105:5 + --> $DIR/borrowck-issue-14498.rs:95:5 | LL | let p = &y.a; | --- borrow of `**y.a` occurs here @@ -68,7 +68,7 @@ LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrow | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here error[E0506]: cannot assign to `**y.a` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:116:5 + --> $DIR/borrowck-issue-14498.rs:106:5 | LL | let p = &y.a; | --- borrow of `**y.a` occurs here diff --git a/src/test/ui/borrowck/borrowck-issue-14498.mir.stderr b/src/test/ui/borrowck/borrowck-issue-14498.mir.stderr index d90eda41164..81610536c52 100644 --- a/src/test/ui/borrowck/borrowck-issue-14498.mir.stderr +++ b/src/test/ui/borrowck/borrowck-issue-14498.mir.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `***p` which is behind a `&` reference - --> $DIR/borrowck-issue-14498.rs:29:5 + --> $DIR/borrowck-issue-14498.rs:19:5 | LL | let p = &y; | -- help: consider changing this to be a mutable reference: `&mut y` @@ -7,7 +7,7 @@ LL | ***p = 2; //[ast]~ ERROR cannot assign to data in a `&` reference | ^^^^^^^^ `p` is a `&` reference, so the data it refers to cannot be written error[E0506]: cannot assign to `**y` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:39:5 + --> $DIR/borrowck-issue-14498.rs:29:5 | LL | let p = &y; | -- borrow of `**y` occurs here @@ -19,7 +19,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:50:5 + --> $DIR/borrowck-issue-14498.rs:40:5 | LL | let p = &y; | -- borrow of `**y` occurs here @@ -31,7 +31,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:61:5 + --> $DIR/borrowck-issue-14498.rs:51:5 | LL | let p = &y; | -- borrow of `**y` occurs here @@ -43,7 +43,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:72:5 + --> $DIR/borrowck-issue-14498.rs:62:5 | LL | let p = &y; | -- borrow of `**y` occurs here @@ -55,7 +55,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y.a` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:83:5 + --> $DIR/borrowck-issue-14498.rs:73:5 | LL | let p = &y.a; | ---- borrow of `**y.a` occurs here @@ -67,7 +67,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y.a` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:94:5 + --> $DIR/borrowck-issue-14498.rs:84:5 | LL | let p = &y.a; | ---- borrow of `**y.a` occurs here @@ -79,7 +79,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y.a` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:105:5 + --> $DIR/borrowck-issue-14498.rs:95:5 | LL | let p = &y.a; | ---- borrow of `**y.a` occurs here @@ -91,7 +91,7 @@ LL | drop(p); | - borrow later used here error[E0506]: cannot assign to `**y.a` because it is borrowed - --> $DIR/borrowck-issue-14498.rs:116:5 + --> $DIR/borrowck-issue-14498.rs:106:5 | LL | let p = &y.a; | ---- borrow of `**y.a` occurs here diff --git a/src/test/ui/borrowck/borrowck-issue-14498.rs b/src/test/ui/borrowck/borrowck-issue-14498.rs index 3c5f932af47..da62c5a9507 100644 --- a/src/test/ui/borrowck/borrowck-issue-14498.rs +++ b/src/test/ui/borrowck/borrowck-issue-14498.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This tests that we can't modify Box<&mut T> contents while they // are borrowed (#14498). // diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr index 8d2bef315c8..3da8d8f8c47 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/borrowck-issue-2657-1.rs:19:18 + --> $DIR/borrowck-issue-2657-1.rs:9:18 | LL | Some(ref _y) => { | ------ borrow of `x.0` occurs here diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.rs b/src/test/ui/borrowck/borrowck-issue-2657-1.rs index 3eb939c0dda..c38293740ed 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-1.rs +++ b/src/test/ui/borrowck/borrowck-issue-2657-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.stderr b/src/test/ui/borrowck/borrowck-issue-2657-1.stderr index 532f0e6fb00..7663822094d 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-1.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-1.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/borrowck-issue-2657-1.rs:19:13 + --> $DIR/borrowck-issue-2657-1.rs:9:13 | LL | Some(ref _y) => { | ------ borrow of `x.0` occurs here diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr index cdbfab8bd05..061c458f73e 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-issue-2657-2.rs:17:18 + --> $DIR/borrowck-issue-2657-2.rs:7:18 | LL | let _b = *y; //~ ERROR cannot move out | ^^ diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.rs b/src/test/ui/borrowck/borrowck-issue-2657-2.rs index a389a4a5593..cea56110487 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.rs +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn main() { diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.stderr index 42baecd7943..7e718786caa 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-issue-2657-2.rs:17:18 + --> $DIR/borrowck-issue-2657-2.rs:7:18 | LL | let _b = *y; //~ ERROR cannot move out | ^^ diff --git a/src/test/ui/borrowck/borrowck-issue-48962.rs b/src/test/ui/borrowck/borrowck-issue-48962.rs index e3bbfd9d5fe..e7df319a0bb 100644 --- a/src/test/ui/borrowck/borrowck-issue-48962.rs +++ b/src/test/ui/borrowck/borrowck-issue-48962.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] struct Node { diff --git a/src/test/ui/borrowck/borrowck-issue-48962.stderr b/src/test/ui/borrowck/borrowck-issue-48962.stderr index 4448cedda69..de4894d5b52 100644 --- a/src/test/ui/borrowck/borrowck-issue-48962.stderr +++ b/src/test/ui/borrowck/borrowck-issue-48962.stderr @@ -1,22 +1,22 @@ error[E0382]: use of moved value: `src` - --> $DIR/borrowck-issue-48962.rs:26:5 + --> $DIR/borrowck-issue-48962.rs:16:5 | +LL | let mut src = &mut node; + | ------- move occurs because `src` has type `&mut Node`, which does not implement the `Copy` trait LL | {src}; | --- value moved here LL | src.next = None; //~ ERROR use of moved value: `src` [E0382] | ^^^^^^^^ value used here after move - | - = note: move occurs because `src` has type `&mut Node`, which does not implement the `Copy` trait error[E0382]: use of moved value: `src` - --> $DIR/borrowck-issue-48962.rs:32:5 + --> $DIR/borrowck-issue-48962.rs:22:5 | +LL | let mut src = &mut (22, 44); + | ------- move occurs because `src` has type `&mut (i32, i32)`, which does not implement the `Copy` trait LL | {src}; | --- value moved here LL | src.0 = 66; //~ ERROR use of moved value: `src` [E0382] | ^^^^^^^^^^ value used here after move - | - = note: move occurs because `src` has type `&mut (i32, i32)`, which does not implement the `Copy` trait error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr index f1c33a596cb..0c99edeb1a4 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*v` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-lend-flow-if.rs:39:16 + --> $DIR/borrowck-lend-flow-if.rs:29:16 | LL | _w = &v; | -- immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.rs b/src/test/ui/borrowck/borrowck-lend-flow-if.rs index 8e6ac345979..1150346f752 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-if.rs +++ b/src/test/ui/borrowck/borrowck-lend-flow-if.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Note: the borrowck analysis is currently flow-insensitive. // Therefore, some of these errors are marked as spurious and could be // corrected by a simple change to the analysis. The others are diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.stderr b/src/test/ui/borrowck/borrowck-lend-flow-if.stderr index 091f74416c9..d1b6bb0c7c9 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-if.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow-if.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable - --> $DIR/borrowck-lend-flow-if.rs:39:21 + --> $DIR/borrowck-lend-flow-if.rs:29:21 | LL | _w = &v; | - immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-lend-flow-match.ast.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow-match.ast.nll.stderr index 0b6eabfb7ed..02289e0f4ec 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-match.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow-match.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-lend-flow-match.rs:28:13 + --> $DIR/borrowck-lend-flow-match.rs:18:13 | LL | Some(ref r) => { | ----- borrow of `x` occurs here diff --git a/src/test/ui/borrowck/borrowck-lend-flow-match.ast.stderr b/src/test/ui/borrowck/borrowck-lend-flow-match.ast.stderr index 0fcc6bbbc83..23eb814788f 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-match.ast.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow-match.ast.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-lend-flow-match.rs:28:13 + --> $DIR/borrowck-lend-flow-match.rs:18:13 | LL | Some(ref r) => { | ----- borrow of `x` occurs here diff --git a/src/test/ui/borrowck/borrowck-lend-flow-match.mir.stderr b/src/test/ui/borrowck/borrowck-lend-flow-match.mir.stderr index 0b6eabfb7ed..02289e0f4ec 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-match.mir.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow-match.mir.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-lend-flow-match.rs:28:13 + --> $DIR/borrowck-lend-flow-match.rs:18:13 | LL | Some(ref r) => { | ----- borrow of `x` occurs here diff --git a/src/test/ui/borrowck/borrowck-lend-flow-match.rs b/src/test/ui/borrowck/borrowck-lend-flow-match.rs index f2f3e791422..4cd2a239b4e 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-match.rs +++ b/src/test/ui/borrowck/borrowck-lend-flow-match.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr index e97ba68cd5c..ae3313597a3 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*v` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-lend-flow.rs:34:16 + --> $DIR/borrowck-lend-flow.rs:24:16 | LL | let _w = &v; | -- immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-lend-flow.rs b/src/test/ui/borrowck/borrowck-lend-flow.rs index b50a97cf3c3..0eb62ede5d6 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow.rs +++ b/src/test/ui/borrowck/borrowck-lend-flow.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Note: the borrowck analysis is currently flow-insensitive. // Therefore, some of these errors are marked as spurious and could be // corrected by a simple change to the analysis. The others are diff --git a/src/test/ui/borrowck/borrowck-lend-flow.stderr b/src/test/ui/borrowck/borrowck-lend-flow.stderr index 0d67f97fe01..d9080d00553 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable - --> $DIR/borrowck-lend-flow.rs:34:21 + --> $DIR/borrowck-lend-flow.rs:24:21 | LL | let _w = &v; | - immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.nll.stderr index 6f0f23b24c6..4497cfb71d1 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `v` because it is borrowed - --> $DIR/borrowck-loan-blocks-move-cc.rs:24:19 + --> $DIR/borrowck-loan-blocks-move-cc.rs:14:19 | LL | let w = &v; | -- borrow of `v` occurs here @@ -12,7 +12,7 @@ LL | w.use_ref(); | - borrow later used here error[E0505]: cannot move out of `v` because it is borrowed - --> $DIR/borrowck-loan-blocks-move-cc.rs:34:19 + --> $DIR/borrowck-loan-blocks-move-cc.rs:24:19 | LL | let w = &v; | -- borrow of `v` occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs index 27296085d9a..29a20473f48 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] use std::thread; diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.stderr index 57567295992..b170635b4b9 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.stderr @@ -1,5 +1,5 @@ error[E0504]: cannot move `v` into closure because it is borrowed - --> $DIR/borrowck-loan-blocks-move-cc.rs:25:27 + --> $DIR/borrowck-loan-blocks-move-cc.rs:15:27 | LL | let w = &v; | - borrow of `v` occurs here @@ -8,7 +8,7 @@ LL | println!("v={}", *v); | ^ move into closure occurs here error[E0504]: cannot move `v` into closure because it is borrowed - --> $DIR/borrowck-loan-blocks-move-cc.rs:35:27 + --> $DIR/borrowck-loan-blocks-move-cc.rs:25:27 | LL | let w = &v; | - borrow of `v` occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr index 432137cdae1..450102f0c66 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `v` because it is borrowed - --> $DIR/borrowck-loan-blocks-move.rs:21:10 + --> $DIR/borrowck-loan-blocks-move.rs:11:10 | LL | let w = &v; | -- borrow of `v` occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.rs b/src/test/ui/borrowck/borrowck-loan-blocks-move.rs index b1241ae020e..bde73219f70 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move.rs +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr index 5edbf6a9b2c..ba6e34c2ec8 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `v` because it is borrowed - --> $DIR/borrowck-loan-blocks-move.rs:21:10 + --> $DIR/borrowck-loan-blocks-move.rs:11:10 | LL | let w = &v; | - borrow of `v` occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr index b181fcf8b54..281a8103f97 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-loan-blocks-mut-uniq.rs:20:12 + --> $DIR/borrowck-loan-blocks-mut-uniq.rs:10:12 | LL | borrow(&*v, | ------ --- immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.rs b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.rs index 32d8088549d..da30bfa29bb 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.rs +++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn borrow(v: &isize, f: F) where F: FnOnce(&isize) { diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr index 752322dec87..6aa2d5d189d 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `v` as mutable because `*v` is also borrowed as immutable - --> $DIR/borrowck-loan-blocks-mut-uniq.rs:20:12 + --> $DIR/borrowck-loan-blocks-mut-uniq.rs:10:12 | LL | borrow(&*v, | -- immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.nll.stderr b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.nll.stderr index 03ddfb4c903..095ae7f56b2 100644 --- a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: borrow of moved value: `x` - --> $DIR/borrowck-loan-in-overloaded-op.rs:31:20 + --> $DIR/borrowck-loan-in-overloaded-op.rs:21:20 | +LL | let x = Foo(box 3); + | - move occurs because `x` has type `Foo`, which does not implement the `Copy` trait LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur | - ^ value borrowed here after move | | | value moved here - | - = note: move occurs because `x` has type `foo`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs index a9079cfc27d..464f01ca74c 100644 --- a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs +++ b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs @@ -1,33 +1,23 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_patterns)] #![feature(box_syntax)] use std::ops::Add; #[derive(Clone)] -struct foo(Box); +struct Foo(Box); -impl Add for foo { - type Output = foo; +impl Add for Foo { + type Output = Foo; - fn add(self, f: foo) -> foo { - let foo(box i) = self; - let foo(box j) = f; - foo(box (i + j)) + fn add(self, f: Foo) -> Foo { + let Foo(box i) = self; + let Foo(box j) = f; + Foo(box (i + j)) } } fn main() { - let x = foo(box 3); + let x = Foo(box 3); let _y = {x} + x.clone(); // the `{x}` forces a move to occur //~^ ERROR use of moved value: `x` } diff --git a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr index 7cd54e293b0..b6147aae8da 100644 --- a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr +++ b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr @@ -1,12 +1,12 @@ error[E0382]: use of moved value: `x` - --> $DIR/borrowck-loan-in-overloaded-op.rs:31:20 + --> $DIR/borrowck-loan-in-overloaded-op.rs:21:20 | LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur | - ^ value used here after move | | | value moved here | - = note: move occurs because `x` has type `foo`, which does not implement the `Copy` trait + = note: move occurs because `x` has type `Foo`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr index 54865123b71..69845758903 100644 --- a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `*s` because it is borrowed - --> $DIR/borrowck-loan-of-static-data-issue-27616.rs:26:5 + --> $DIR/borrowck-loan-of-static-data-issue-27616.rs:16:5 | LL | let alias: &'static mut String = s; | ------------------- - borrow of `*s` occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.rs b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.rs index 228e71025fd..cb801ef1b5b 100644 --- a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.rs +++ b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem; fn leak(mut b: Box) -> &'static mut T { diff --git a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr index 3f5e09b7443..eceb923e776 100644 --- a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr +++ b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `*s` because it is borrowed - --> $DIR/borrowck-loan-of-static-data-issue-27616.rs:26:5 + --> $DIR/borrowck-loan-of-static-data-issue-27616.rs:16:5 | LL | let alias: &'static mut String = s; | - borrow of `*s` occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr index 6f08c13caa4..421af61ff78 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `p` because it was mutably borrowed - --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:48:5 + --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:38:5 | LL | let q = &mut p; | ------ borrow of `p` occurs here @@ -11,7 +11,7 @@ LL | *q + 3; // OK to use the new alias `q` | -- borrow later used here error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:49:5 + --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:39:5 | LL | let q = &mut p; | ------ mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.rs b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.rs index cce55b6c941..4da10fd44ce 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.rs +++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Add; #[derive(Copy, Clone)] diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr index 4db1d1f298e..b4f7a9af666 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `p` because it was mutably borrowed - --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:48:5 + --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:38:5 | LL | let q = &mut p; | - borrow of `p` occurs here @@ -8,7 +8,7 @@ LL | p + 3; //~ ERROR cannot use `p` | ^ use of borrowed `p` error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:49:5 + --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:39:5 | LL | let q = &mut p; | - mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr index 18c2d67f6b0..bded4d1e0a3 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-loan-rcvr.rs:34:14 + --> $DIR/borrowck-loan-rcvr.rs:23:14 | LL | p.blockm(|| { //~ ERROR cannot borrow `p` as mutable | - ------ ^^ mutable borrow occurs here @@ -10,7 +10,7 @@ LL | p.x = 10; | - second borrow occurs due to use of `p` in closure error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-loan-rcvr.rs:45:5 + --> $DIR/borrowck-loan-rcvr.rs:34:5 | LL | let l = &mut p; | ------ mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.rs b/src/test/ui/borrowck/borrowck-loan-rcvr.rs index 014b27f9659..d2234e17ac7 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr.rs +++ b/src/test/ui/borrowck/borrowck-loan-rcvr.rs @@ -1,22 +1,11 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +struct Point { x: isize, y: isize } - -struct point { x: isize, y: isize } - -trait methods { +trait Methods { fn impurem(&self); fn blockm(&self, f: F) where F: FnOnce(); } -impl methods for point { +impl Methods for Point { fn impurem(&self) { } @@ -24,7 +13,7 @@ impl methods for point { } fn a() { - let mut p = point {x: 3, y: 4}; + let mut p = Point {x: 3, y: 4}; // Here: it's ok to call even though receiver is mutable, because we // can loan it out. @@ -37,7 +26,7 @@ fn a() { } fn b() { - let mut p = point {x: 3, y: 4}; + let mut p = Point {x: 3, y: 4}; // Here I create an outstanding loan and check that we get conflicts: diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr index f5d3cfb3834..eb0bbec0bc7 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-loan-rcvr.rs:34:14 + --> $DIR/borrowck-loan-rcvr.rs:23:14 | LL | p.blockm(|| { //~ ERROR cannot borrow `p` as mutable | - ^^ mutable borrow occurs here @@ -11,7 +11,7 @@ LL | }) | - immutable borrow ends here error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-loan-rcvr.rs:45:5 + --> $DIR/borrowck-loan-rcvr.rs:34:5 | LL | let l = &mut p; | - mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr b/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr index 2b22a125d3f..be48f217ef1 100644 --- a/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-loan-vec-content.rs:28:9 + --> $DIR/borrowck-loan-vec-content.rs:18:9 | LL | takes_imm_elt( | ------------- immutable borrow later used by call diff --git a/src/test/ui/borrowck/borrowck-loan-vec-content.rs b/src/test/ui/borrowck/borrowck-loan-vec-content.rs index c5de95f8fc0..300ec88c5cd 100644 --- a/src/test/ui/borrowck/borrowck-loan-vec-content.rs +++ b/src/test/ui/borrowck/borrowck-loan-vec-content.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Here we check that it is allowed to lend out an element of a // (locally rooted) mutable, unique vector, and that we then prevent // modifications to the contents. diff --git a/src/test/ui/borrowck/borrowck-loan-vec-content.stderr b/src/test/ui/borrowck/borrowck-loan-vec-content.stderr index 2fcfd1fb08d..6a565ff2f10 100644 --- a/src/test/ui/borrowck/borrowck-loan-vec-content.stderr +++ b/src/test/ui/borrowck/borrowck-loan-vec-content.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-loan-vec-content.rs:28:9 + --> $DIR/borrowck-loan-vec-content.rs:18:9 | LL | &v[0], | - immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.nll.stderr b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.nll.stderr index c806545c591..df89e85ebe2 100644 --- a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to function parameter `x` - --> $DIR/borrowck-local-borrow-outlives-fn.rs:15:5 + --> $DIR/borrowck-local-borrow-outlives-fn.rs:5:5 | LL | &x | ^^ returns a reference to data owned by the current function diff --git a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.stderr b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.stderr index af1d294c387..6eda8a439ba 100644 --- a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.stderr +++ b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/borrowck-local-borrow-outlives-fn.rs:15:6 + --> $DIR/borrowck-local-borrow-outlives-fn.rs:5:6 | LL | &x | ^ borrowed value does not live long enough diff --git a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.mir.stderr b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.mir.stderr index c806545c591..df89e85ebe2 100644 --- a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.mir.stderr +++ b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.mir.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to function parameter `x` - --> $DIR/borrowck-local-borrow-outlives-fn.rs:15:5 + --> $DIR/borrowck-local-borrow-outlives-fn.rs:5:5 | LL | &x | ^^ returns a reference to data owned by the current function diff --git a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.rs b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.rs index 7d78925f2db..6137ac914dd 100644 --- a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.rs +++ b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.nll.stderr b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.nll.stderr index c62cbfd1ee9..ac9e73fadec 100644 --- a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `z.1` does not live long enough - --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:16:15 + --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:6:15 | LL | *x = Some(&mut z.1); | ----------^^^^^^^^- diff --git a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.stderr b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.stderr index 0c61c13345c..89a0e6cd829 100644 --- a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.stderr +++ b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.stderr @@ -1,5 +1,5 @@ error[E0597]: `z.1` does not live long enough - --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:16:20 + --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:6:20 | LL | *x = Some(&mut z.1); | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.mir.stderr b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.mir.stderr index c62cbfd1ee9..ac9e73fadec 100644 --- a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.mir.stderr +++ b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.mir.stderr @@ -1,5 +1,5 @@ error[E0597]: `z.1` does not live long enough - --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:16:15 + --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:6:15 | LL | *x = Some(&mut z.1); | ----------^^^^^^^^- diff --git a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs index 2c9ace4825d..9ead465eada 100644 --- a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs +++ b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.nll.stderr b/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.nll.stderr index 0853018bae9..b2b82fba5b0 100644 --- a/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `foo` because it was mutably borrowed - --> $DIR/borrowck-match-already-borrowed.rs:23:9 + --> $DIR/borrowck-match-already-borrowed.rs:13:9 | LL | let p = &mut foo; | -------- borrow of `foo` occurs here @@ -11,7 +11,7 @@ LL | drop(p); | - borrow later used here error[E0503]: cannot use `foo.0` because it was mutably borrowed - --> $DIR/borrowck-match-already-borrowed.rs:25:16 + --> $DIR/borrowck-match-already-borrowed.rs:15:16 | LL | let p = &mut foo; | -------- borrow of `foo` occurs here @@ -23,7 +23,7 @@ LL | drop(p); | - borrow later used here error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-match-already-borrowed.rs:36:9 + --> $DIR/borrowck-match-already-borrowed.rs:26:9 | LL | let r = &mut x; | ------ borrow of `x` occurs here @@ -35,7 +35,7 @@ LL | drop(r); | - borrow later used here error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-match-already-borrowed.rs:38:9 + --> $DIR/borrowck-match-already-borrowed.rs:28:9 | LL | let r = &mut x; | ------ borrow of `x` occurs here diff --git a/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.stderr b/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.stderr index 5ba2f26e220..cfbbef93f1f 100644 --- a/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.stderr +++ b/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `(foo as Foo::A).0` because it was mutably borrowed - --> $DIR/borrowck-match-already-borrowed.rs:25:16 + --> $DIR/borrowck-match-already-borrowed.rs:15:16 | LL | let p = &mut foo; | --- borrow of `foo` occurs here @@ -8,7 +8,7 @@ LL | Foo::A(x) => x //[ast]~ ERROR [E0503] | ^ use of borrowed `foo` error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-match-already-borrowed.rs:36:9 + --> $DIR/borrowck-match-already-borrowed.rs:26:9 | LL | let r = &mut x; | - borrow of `x` occurs here @@ -17,7 +17,7 @@ LL | x => x + 1, //[ast]~ ERROR [E0503] | ^ use of borrowed `x` error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-match-already-borrowed.rs:38:9 + --> $DIR/borrowck-match-already-borrowed.rs:28:9 | LL | let r = &mut x; | - borrow of `x` occurs here diff --git a/src/test/ui/borrowck/borrowck-match-already-borrowed.mir.stderr b/src/test/ui/borrowck/borrowck-match-already-borrowed.mir.stderr index 0853018bae9..b2b82fba5b0 100644 --- a/src/test/ui/borrowck/borrowck-match-already-borrowed.mir.stderr +++ b/src/test/ui/borrowck/borrowck-match-already-borrowed.mir.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `foo` because it was mutably borrowed - --> $DIR/borrowck-match-already-borrowed.rs:23:9 + --> $DIR/borrowck-match-already-borrowed.rs:13:9 | LL | let p = &mut foo; | -------- borrow of `foo` occurs here @@ -11,7 +11,7 @@ LL | drop(p); | - borrow later used here error[E0503]: cannot use `foo.0` because it was mutably borrowed - --> $DIR/borrowck-match-already-borrowed.rs:25:16 + --> $DIR/borrowck-match-already-borrowed.rs:15:16 | LL | let p = &mut foo; | -------- borrow of `foo` occurs here @@ -23,7 +23,7 @@ LL | drop(p); | - borrow later used here error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-match-already-borrowed.rs:36:9 + --> $DIR/borrowck-match-already-borrowed.rs:26:9 | LL | let r = &mut x; | ------ borrow of `x` occurs here @@ -35,7 +35,7 @@ LL | drop(r); | - borrow later used here error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-match-already-borrowed.rs:38:9 + --> $DIR/borrowck-match-already-borrowed.rs:28:9 | LL | let r = &mut x; | ------ borrow of `x` occurs here diff --git a/src/test/ui/borrowck/borrowck-match-already-borrowed.rs b/src/test/ui/borrowck/borrowck-match-already-borrowed.rs index cabce08429e..7f4cdbd0e7c 100644 --- a/src/test/ui/borrowck/borrowck-match-already-borrowed.rs +++ b/src/test/ui/borrowck/borrowck-match-already-borrowed.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.nll.stderr b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.nll.stderr index 2eeb4e433ad..cd88d693238 100644 --- a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:27:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:17:13 | LL | x => { | - @@ -10,7 +10,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variabl | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:34:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:24:13 | LL | E::Foo(x) => { | - @@ -21,7 +21,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variabl | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:41:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:31:13 | LL | S { bar: x } => { | - @@ -32,7 +32,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variabl | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:48:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:38:13 | LL | (x,) => { | - @@ -43,7 +43,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variabl | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:55:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:45:13 | LL | [x,_,_] => { | - diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.stderr b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.stderr index 0d776f44daa..e7bd9dfee12 100644 --- a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.stderr +++ b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:27:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:17:13 | LL | x => { | - first assignment to `x` @@ -7,7 +7,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variabl | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:34:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:24:13 | LL | E::Foo(x) => { | - first assignment to `x` @@ -15,7 +15,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variabl | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:41:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:31:13 | LL | S { bar: x } => { | - first assignment to `x` @@ -23,7 +23,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variabl | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:48:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:38:13 | LL | (x,) => { | - first assignment to `x` @@ -31,7 +31,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variabl | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:55:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:45:13 | LL | [x,_,_] => { | - first assignment to `x` diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.mir.stderr b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.mir.stderr index 2eeb4e433ad..cd88d693238 100644 --- a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.mir.stderr +++ b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.mir.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:27:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:17:13 | LL | x => { | - @@ -10,7 +10,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variabl | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:34:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:24:13 | LL | E::Foo(x) => { | - @@ -21,7 +21,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variabl | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:41:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:31:13 | LL | S { bar: x } => { | - @@ -32,7 +32,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variabl | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:48:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:38:13 | LL | (x,) => { | - @@ -43,7 +43,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variabl | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/borrowck-match-binding-is-assignment.rs:55:13 + --> $DIR/borrowck-match-binding-is-assignment.rs:45:13 | LL | [x,_,_] => { | - diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.rs b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.rs index 30047f84041..2c9c41ca10e 100644 --- a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.rs +++ b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr b/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr index e7dbc6f6e3b..8dba34bd808 100644 --- a/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr +++ b/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr @@ -1,10 +1,9 @@ warning[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-migrate-to-nll.rs:35:17 + --> $DIR/borrowck-migrate-to-nll.rs:25:17 | LL | (|| { let bar = foo; bar.take() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future diff --git a/src/test/ui/borrowck/borrowck-migrate-to-nll.rs b/src/test/ui/borrowck/borrowck-migrate-to-nll.rs index bb6b29072e2..5b7018df919 100644 --- a/src/test/ui/borrowck/borrowck-migrate-to-nll.rs +++ b/src/test/ui/borrowck/borrowck-migrate-to-nll.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is a test of the borrowck migrate mode. It leverages #27282, a // bug that is fixed by NLL: this code is (unsoundly) accepted by // AST-borrowck, but is correctly rejected by the NLL borrowck. diff --git a/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr b/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr index e7dbc6f6e3b..8dba34bd808 100644 --- a/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr +++ b/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr @@ -1,10 +1,9 @@ warning[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-migrate-to-nll.rs:35:17 + --> $DIR/borrowck-migrate-to-nll.rs:25:17 | LL | (|| { let bar = foo; bar.take() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr b/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr index 9f56b26648b..b8a01174417 100644 --- a/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/borrowck-move-by-capture.rs:19:29 + --> $DIR/borrowck-move-by-capture.rs:9:29 | LL | let bar: Box<_> = box 3; | --- captured outer variable diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.rs b/src/test/ui/borrowck/borrowck-move-by-capture.rs index bad52121043..a825ed5e89a 100644 --- a/src/test/ui/borrowck/borrowck-move-by-capture.rs +++ b/src/test/ui/borrowck/borrowck-move-by-capture.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax,unboxed_closures)] fn to_fn_mut>(f: F) -> F { f } diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.stderr b/src/test/ui/borrowck/borrowck-move-by-capture.stderr index a88af1596ef..9c485fb48ca 100644 --- a/src/test/ui/borrowck/borrowck-move-by-capture.stderr +++ b/src/test/ui/borrowck/borrowck-move-by-capture.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured outer variable in an `FnMut` closure - --> $DIR/borrowck-move-by-capture.rs:19:29 + --> $DIR/borrowck-move-by-capture.rs:9:29 | LL | let bar: Box<_> = box 3; | --- captured outer variable diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr index 2df520a936c..9386278886f 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-error-with-note.rs:21:11 + --> $DIR/borrowck-move-error-with-note.rs:11:11 | LL | match *f { //~ ERROR cannot move out of | ^^ @@ -15,7 +15,7 @@ LL | Foo::Foo2(num) => (), | --- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/borrowck-move-error-with-note.rs:23:19 + --> $DIR/borrowck-move-error-with-note.rs:13:19 | LL | Foo::Foo1(num1, | ^^^^ @@ -25,7 +25,7 @@ LL | Foo::Foo2(num) => (), | ^^^ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-error-with-note.rs:39:11 + --> $DIR/borrowck-move-error-with-note.rs:29:11 | LL | match (S {f: "foo".to_string(), g: "bar".to_string()}) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here @@ -36,7 +36,7 @@ LL | g: _t | -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/borrowck-move-error-with-note.rs:42:16 + --> $DIR/borrowck-move-error-with-note.rs:32:16 | LL | f: _s, | ^^ @@ -44,7 +44,7 @@ LL | g: _t | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-error-with-note.rs:57:11 + --> $DIR/borrowck-move-error-with-note.rs:47:11 | LL | match a.a { //~ ERROR cannot move out of | ^^^ @@ -56,7 +56,7 @@ LL | n => { | - data moved here | note: move occurs because `n` has type `std::boxed::Box`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-error-with-note.rs:59:9 + --> $DIR/borrowck-move-error-with-note.rs:49:9 | LL | n => { | ^ diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.rs b/src/test/ui/borrowck/borrowck-move-error-with-note.rs index e0491159a68..d2dab2eacca 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.rs +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] enum Foo { diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr index 81ed058e47f..07009b42e4d 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.stderr +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-error-with-note.rs:21:11 + --> $DIR/borrowck-move-error-with-note.rs:11:11 | LL | match *f { //~ ERROR cannot move out of | ^^ cannot move out of borrowed content @@ -12,7 +12,7 @@ LL | Foo::Foo2(num) => (), | --- ...and here (use `ref num` or `ref mut num`) error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-error-with-note.rs:40:9 + --> $DIR/borrowck-move-error-with-note.rs:30:9 | LL | / S { //~ ERROR cannot move out of type `S`, which implements the `Drop` trait LL | | //~| cannot move out of here @@ -24,7 +24,7 @@ LL | | } => {} | |_________^ cannot move out of here error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-error-with-note.rs:57:11 + --> $DIR/borrowck-move-error-with-note.rs:47:11 | LL | match a.a { //~ ERROR cannot move out of | ^ cannot move out of borrowed content diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr index bd5d19ffe05..b7fa2247e32 100644 --- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `*a` because it is borrowed - --> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:22:13 + --> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:12:13 | LL | let b = &a; | -- borrow of `a` occurs here diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs index 1216fb89667..e058c806516 100644 --- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs +++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // verify that an error is raised when trying to move out of a // borrowed path. diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr index e5557eca6de..2ed888051f6 100644 --- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `*a` because it is borrowed - --> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:22:9 + --> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:12:9 | LL | let b = &a; | - borrow of `a` occurs here diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr index c3a2180b9f0..5b784657953 100644 --- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of dereference of raw pointer - --> $DIR/borrowck-move-from-unsafe-ptr.rs:13:13 + --> $DIR/borrowck-move-from-unsafe-ptr.rs:2:13 | LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer | ^^ diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.rs b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.rs index 9a39ff6206b..bf8ff9cf0a9 100644 --- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.rs +++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - unsafe fn foo(x: *const Box) -> Box { let y = *x; //~ ERROR cannot move out of dereference of raw pointer return y; diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr index cad155103f0..62a52260038 100644 --- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of dereference of raw pointer - --> $DIR/borrowck-move-from-unsafe-ptr.rs:13:13 + --> $DIR/borrowck-move-from-unsafe-ptr.rs:2:13 | LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer | ^^ diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr index 49c2ec0dcf4..c18fce9f4fd 100644 --- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-in-irrefut-pat.rs:16:13 + --> $DIR/borrowck-move-in-irrefut-pat.rs:6:13 | LL | fn arg_item(&_x: &String) {} | ^-- @@ -9,13 +9,13 @@ LL | fn arg_item(&_x: &String) {} | help: consider removing the `&`: `_x` | note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-in-irrefut-pat.rs:16:14 + --> $DIR/borrowck-move-in-irrefut-pat.rs:6:14 | LL | fn arg_item(&_x: &String) {} | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-in-irrefut-pat.rs:21:11 + --> $DIR/borrowck-move-in-irrefut-pat.rs:11:11 | LL | with(|&_x| ()) | ^-- @@ -25,13 +25,13 @@ LL | with(|&_x| ()) | help: consider removing the `&`: `_x` | note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-in-irrefut-pat.rs:21:12 + --> $DIR/borrowck-move-in-irrefut-pat.rs:11:12 | LL | with(|&_x| ()) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-in-irrefut-pat.rs:27:15 + --> $DIR/borrowck-move-in-irrefut-pat.rs:17:15 | LL | let &_x = &"hi".to_string(); | --- ^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -40,7 +40,7 @@ LL | let &_x = &"hi".to_string(); | help: consider removing the `&`: `_x` | note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-in-irrefut-pat.rs:27:10 + --> $DIR/borrowck-move-in-irrefut-pat.rs:17:10 | LL | let &_x = &"hi".to_string(); | ^^ diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.stderr index fa7fb649c8d..019ed96661f 100644 --- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.stderr +++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-in-irrefut-pat.rs:16:13 + --> $DIR/borrowck-move-in-irrefut-pat.rs:6:13 | LL | fn arg_item(&_x: &String) {} | ^-- @@ -8,7 +8,7 @@ LL | fn arg_item(&_x: &String) {} | cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-in-irrefut-pat.rs:21:11 + --> $DIR/borrowck-move-in-irrefut-pat.rs:11:11 | LL | with(|&_x| ()) | ^-- @@ -17,7 +17,7 @@ LL | with(|&_x| ()) | cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-in-irrefut-pat.rs:27:9 + --> $DIR/borrowck-move-in-irrefut-pat.rs:17:9 | LL | let &_x = &"hi".to_string(); | ^-- diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr index 49c2ec0dcf4..c18fce9f4fd 100644 --- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr +++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-in-irrefut-pat.rs:16:13 + --> $DIR/borrowck-move-in-irrefut-pat.rs:6:13 | LL | fn arg_item(&_x: &String) {} | ^-- @@ -9,13 +9,13 @@ LL | fn arg_item(&_x: &String) {} | help: consider removing the `&`: `_x` | note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-in-irrefut-pat.rs:16:14 + --> $DIR/borrowck-move-in-irrefut-pat.rs:6:14 | LL | fn arg_item(&_x: &String) {} | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-in-irrefut-pat.rs:21:11 + --> $DIR/borrowck-move-in-irrefut-pat.rs:11:11 | LL | with(|&_x| ()) | ^-- @@ -25,13 +25,13 @@ LL | with(|&_x| ()) | help: consider removing the `&`: `_x` | note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-in-irrefut-pat.rs:21:12 + --> $DIR/borrowck-move-in-irrefut-pat.rs:11:12 | LL | with(|&_x| ()) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-in-irrefut-pat.rs:27:15 + --> $DIR/borrowck-move-in-irrefut-pat.rs:17:15 | LL | let &_x = &"hi".to_string(); | --- ^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -40,7 +40,7 @@ LL | let &_x = &"hi".to_string(); | help: consider removing the `&`: `_x` | note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-in-irrefut-pat.rs:27:10 + --> $DIR/borrowck-move-in-irrefut-pat.rs:17:10 | LL | let &_x = &"hi".to_string(); | ^^ diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.rs b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.rs index 5fdde484f82..c63f4f60bef 100644 --- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.rs +++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.nll.stderr index d896ff491c6..0789926563c 100644 --- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.nll.stderr @@ -1,6 +1,9 @@ error[E0382]: use of moved value: `t` - --> $DIR/borrowck-move-moved-value-into-closure.rs:24:12 + --> $DIR/borrowck-move-moved-value-into-closure.rs:14:12 | +LL | let t: Box<_> = box 3; + | - move occurs because `t` has type `std::boxed::Box`, which does not implement the `Copy` trait +LL | LL | call_f(move|| { *t + 1 }); | ------ - variable moved due to use in closure | | @@ -9,8 +12,6 @@ LL | call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value | ^^^^^^ - use occurs due to use in closure | | | value used here after move - | - = note: move occurs because `t` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.stderr index c7576b1b32d..308dac83292 100644 --- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.stderr +++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.stderr @@ -1,5 +1,5 @@ error[E0382]: capture of moved value: `t` - --> $DIR/borrowck-move-moved-value-into-closure.rs:24:22 + --> $DIR/borrowck-move-moved-value-into-closure.rs:14:22 | LL | call_f(move|| { *t + 1 }); | ------ value moved (into closure) here diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr index d896ff491c6..0789926563c 100644 --- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr +++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr @@ -1,6 +1,9 @@ error[E0382]: use of moved value: `t` - --> $DIR/borrowck-move-moved-value-into-closure.rs:24:12 + --> $DIR/borrowck-move-moved-value-into-closure.rs:14:12 | +LL | let t: Box<_> = box 3; + | - move occurs because `t` has type `std::boxed::Box`, which does not implement the `Copy` trait +LL | LL | call_f(move|| { *t + 1 }); | ------ - variable moved due to use in closure | | @@ -9,8 +12,6 @@ LL | call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value | ^^^^^^ - use occurs due to use in closure | | | value used here after move - | - = note: move occurs because `t` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs index 2bd6f75df1b..271553370e3 100644 --- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs +++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr index 9d31d2b4aff..ce6433d5a52 100644 --- a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `t0` because it is borrowed - --> $DIR/borrowck-move-mut-base-ptr.rs:20:14 + --> $DIR/borrowck-move-mut-base-ptr.rs:10:14 | LL | let p: &isize = &*t0; // Freezes `*t0` | ---- borrow of `*t0` occurs here diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.rs b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.rs index eb7b310a8bf..10fc1437253 100644 --- a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.rs +++ b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that attempt to move `&mut` pointer while pointee is borrowed // yields an error. // diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr index 33ccd148f5b..224bf0fded8 100644 --- a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `t0` because it is borrowed - --> $DIR/borrowck-move-mut-base-ptr.rs:20:9 + --> $DIR/borrowck-move-mut-base-ptr.rs:10:9 | LL | let p: &isize = &*t0; // Freezes `*t0` | --- borrow of `*t0` occurs here diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.ast.nll.stderr deleted file mode 100644 index d67b63b5aa7..00000000000 --- a/src/test/ui/borrowck/borrowck-move-out-from-array.ast.nll.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0382]: use of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array.rs:20:14 - | -LL | let [_, _x] = a; - | -- value moved here -LL | let [.., _y] = a; //[ast]~ ERROR [E0382] - | ^^ value used here after move - -error[E0382]: use of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array.rs:27:10 - | -LL | let [_x, _] = a; - | -- value moved here -LL | let [_y..] = a; //[ast]~ ERROR [E0382] - | ^^ value used here after move - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.ast.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.ast.stderr index d19c23dce5f..f866ff9e9ba 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array.ast.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array.ast.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array.rs:20:14 + --> $DIR/borrowck-move-out-from-array.rs:10:14 | LL | let [_, _x] = a; | -- value moved here @@ -9,7 +9,7 @@ LL | let [.., _y] = a; //[ast]~ ERROR [E0382] = note: move occurs because `a[..]` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array.rs:27:10 + --> $DIR/borrowck-move-out-from-array.rs:17:10 | LL | let [_x, _] = a; | -- value moved here diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr index d67b63b5aa7..f866ff9e9ba 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr @@ -1,18 +1,22 @@ error[E0382]: use of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array.rs:20:14 + --> $DIR/borrowck-move-out-from-array.rs:10:14 | LL | let [_, _x] = a; | -- value moved here LL | let [.., _y] = a; //[ast]~ ERROR [E0382] | ^^ value used here after move + | + = note: move occurs because `a[..]` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `a[..]` - --> $DIR/borrowck-move-out-from-array.rs:27:10 + --> $DIR/borrowck-move-out-from-array.rs:17:10 | LL | let [_x, _] = a; | -- value moved here LL | let [_y..] = a; //[ast]~ ERROR [E0382] | ^^ value used here after move + | + = note: move occurs because `a[..]` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.rs b/src/test/ui/borrowck/borrowck-move-out-from-array.rs index 0db31cef0ed..503e7b99525 100644 --- a/src/test/ui/borrowck/borrowck-move-out-from-array.rs +++ b/src/test/ui/borrowck/borrowck-move-out-from-array.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr index d58beabb303..81afb104c9d 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of an `Rc` - --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:17:14 + --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:7:14 | LL | let _x = Rc::new(vec![1, 2]).into_iter(); | ^^^^^^^^^^^^^^^^^^^ cannot move out of an `Rc` diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.stderr index 94f7eba63a1..e55898aca5c 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:17:14 + --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:7:14 | LL | let _x = Rc::new(vec![1, 2]).into_iter(); | ^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.mir.stderr index d58beabb303..81afb104c9d 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.mir.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.mir.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of an `Rc` - --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:17:14 + --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:7:14 | LL | let _x = Rc::new(vec![1, 2]).into_iter(); | ^^^^^^^^^^^^^^^^^^^ cannot move out of an `Rc` diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs index af9202d8d77..5ced89478dc 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr index c9c8cf104ce..e6af992c4d9 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of an `Rc` - --> $DIR/borrowck-move-out-of-overloaded-deref.rs:14:14 + --> $DIR/borrowck-move-out-of-overloaded-deref.rs:4:14 | LL | let _x = *Rc::new("hi".to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.rs b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.rs index fffcf575ab0..d5b60139fa6 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.rs +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::rc::Rc; pub fn main() { diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr index df5d911f6a8..cd8d146ab1e 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-move-out-of-overloaded-deref.rs:14:14 + --> $DIR/borrowck-move-out-of-overloaded-deref.rs:4:14 | LL | let _x = *Rc::new("hi".to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.stderr b/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.stderr index 65f70a7984f..752d5330e02 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of static item - --> $DIR/borrowck-move-out-of-static-item.rs:28:10 + --> $DIR/borrowck-move-out-of-static-item.rs:18:10 | LL | test(BAR); //[ast]~ ERROR cannot move out of static item [E0507] | ^^^ cannot move out of static item diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-of-static-item.mir.stderr index 65f70a7984f..752d5330e02 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-static-item.mir.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-static-item.mir.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of static item - --> $DIR/borrowck-move-out-of-static-item.rs:28:10 + --> $DIR/borrowck-move-out-of-static-item.rs:18:10 | LL | test(BAR); //[ast]~ ERROR cannot move out of static item [E0507] | ^^^ cannot move out of static item diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.rs b/src/test/ui/borrowck/borrowck-move-out-of-static-item.rs index 79eb68c95a0..d68d5de5c01 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-static-item.rs +++ b/src/test/ui/borrowck/borrowck-move-out-of-static-item.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr index 34f9f035188..7025ce08fed 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:20:11 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:10:11 | LL | match (S {f:"foo".to_string()}) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here @@ -8,13 +8,13 @@ LL | S {f:_s} => {} | -- data moved here | note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:22:14 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:12:14 | LL | S {f:_s} => {} | ^^ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:20 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:20 | LL | let S {f:_s} = S {f:"foo".to_string()}; | -- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here @@ -22,13 +22,13 @@ LL | let S {f:_s} = S {f:"foo".to_string()}; | data moved here | note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:14 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:14 | LL | let S {f:_s} = S {f:"foo".to_string()}; | ^^ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:19 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:23:19 | LL | fn move_in_fn_arg(S {f:_s}: S) { | ^^^^^--^ @@ -37,7 +37,7 @@ LL | fn move_in_fn_arg(S {f:_s}: S) { | cannot move out of here | note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:24 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:23:24 | LL | fn move_in_fn_arg(S {f:_s}: S) { | ^^ diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.stderr index 4384f046d16..0b025fa175a 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:22:9 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:12:9 | LL | S {f:_s} => {} | ^^^^^--^ @@ -8,7 +8,7 @@ LL | S {f:_s} => {} | cannot move out of here error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:9 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:9 | LL | let S {f:_s} = S {f:"foo".to_string()}; | ^^^^^--^ @@ -17,7 +17,7 @@ LL | let S {f:_s} = S {f:"foo".to_string()}; | cannot move out of here error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:19 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:23:19 | LL | fn move_in_fn_arg(S {f:_s}: S) { | ^^^^^--^ diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr index 34f9f035188..7025ce08fed 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:20:11 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:10:11 | LL | match (S {f:"foo".to_string()}) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here @@ -8,13 +8,13 @@ LL | S {f:_s} => {} | -- data moved here | note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:22:14 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:12:14 | LL | S {f:_s} => {} | ^^ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:20 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:20 | LL | let S {f:_s} = S {f:"foo".to_string()}; | -- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here @@ -22,13 +22,13 @@ LL | let S {f:_s} = S {f:"foo".to_string()}; | data moved here | note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:14 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:18:14 | LL | let S {f:_s} = S {f:"foo".to_string()}; | ^^ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:19 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:23:19 | LL | fn move_in_fn_arg(S {f:_s}: S) { | ^^^^^--^ @@ -37,7 +37,7 @@ LL | fn move_in_fn_arg(S {f:_s}: S) { | cannot move out of here | note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:24 + --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:23:24 | LL | fn move_in_fn_arg(S {f:_s}: S) { | ^^ diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs index 4bb66ace026..cdd71d889ab 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs +++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr index 278c33c71e2..cecba15acce 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:17:11 + --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:7:11 | LL | match S("foo".to_string()) { | ^^^^^^^^^^^^^^^^^^^^ cannot move out of here @@ -7,13 +7,13 @@ LL | S(_s) => {} | -- data moved here | note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:11 + --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:8:11 | LL | S(_s) => {} | ^^ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:24:17 + --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:14:17 | LL | let S(_s) = S("foo".to_string()); | -- ^^^^^^^^^^^^^^^^^^^^ cannot move out of here @@ -21,13 +21,13 @@ LL | let S(_s) = S("foo".to_string()); | data moved here | note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:24:11 + --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:14:11 | LL | let S(_s) = S("foo".to_string()); | ^^ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:28:19 + --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:19 | LL | fn move_in_fn_arg(S(_s): S) { | ^^--^ @@ -36,7 +36,7 @@ LL | fn move_in_fn_arg(S(_s): S) { | cannot move out of here | note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:28:21 + --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:21 | LL | fn move_in_fn_arg(S(_s): S) { | ^^ diff --git a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs index f5fedb8d487..bb294111add 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs +++ b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S(String); impl Drop for S { fn drop(&mut self) { } diff --git a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr index 78a065b60da..134b5e3481e 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:9 + --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:8:9 | LL | S(_s) => {} | ^^--^ @@ -8,7 +8,7 @@ LL | S(_s) => {} | cannot move out of here error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:24:9 + --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:14:9 | LL | let S(_s) = S("foo".to_string()); | ^^--^ @@ -17,7 +17,7 @@ LL | let S(_s) = S("foo".to_string()); | cannot move out of here error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:28:19 + --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:19 | LL | fn move_in_fn_arg(S(_s): S) { | ^^--^ diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr index f3430ba4e06..9aaeefd4cfc 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[Foo]`, a non-copy slice - --> $DIR/borrowck-move-out-of-vec-tail.rs:29:19 + --> $DIR/borrowck-move-out-of-vec-tail.rs:19:19 | LL | match tail { | ^^^^ cannot move out of here @@ -10,7 +10,7 @@ LL | Foo { string: b }] => { | - ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/borrowck-move-out-of-vec-tail.rs:30:33 + --> $DIR/borrowck-move-out-of-vec-tail.rs:20:33 | LL | &[Foo { string: a }, | ^ diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs index 938ce3f2cb8..5f6e01f2df0 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we do not permit moves from &[] matched by a vec pattern. #![feature(slice_patterns)] diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr index c4051e5a255..156ba0d4d7b 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[Foo]`, a non-copy slice - --> $DIR/borrowck-move-out-of-vec-tail.rs:30:18 + --> $DIR/borrowck-move-out-of-vec-tail.rs:20:18 | LL | &[Foo { string: a }, | ^ - hint: to prevent move, use `ref a` or `ref mut a` diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr b/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr index cd8d0cdfee2..3bb5351f97b 100644 --- a/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `a.x` because it is borrowed - --> $DIR/borrowck-move-subcomponent.rs:25:14 + --> $DIR/borrowck-move-subcomponent.rs:15:14 | LL | let pb = &a; | -- borrow of `a` occurs here diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.rs b/src/test/ui/borrowck/borrowck-move-subcomponent.rs index 88871dda659..4185632c4e2 100644 --- a/src/test/ui/borrowck/borrowck-move-subcomponent.rs +++ b/src/test/ui/borrowck/borrowck-move-subcomponent.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that the borrow checker checks all components of a path when moving // out. diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.stderr b/src/test/ui/borrowck/borrowck-move-subcomponent.stderr index f249f0f22cd..187cdbbf815 100644 --- a/src/test/ui/borrowck/borrowck-move-subcomponent.stderr +++ b/src/test/ui/borrowck/borrowck-move-subcomponent.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `a.x` because it is borrowed - --> $DIR/borrowck-move-subcomponent.rs:25:14 + --> $DIR/borrowck-move-subcomponent.rs:15:14 | LL | let pb = &a; | - borrow of `a` occurs here diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr b/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr index ce1880c584a..d0065a2e7dc 100644 --- a/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr +++ b/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x1` because it is borrowed - --> $DIR/borrowck-multiple-captures.rs:22:19 + --> $DIR/borrowck-multiple-captures.rs:12:19 | LL | let p1 = &x1; | --- borrow of `x1` occurs here @@ -13,7 +13,7 @@ LL | borrow(&*p1); | ---- borrow later used here error[E0505]: cannot move out of `x2` because it is borrowed - --> $DIR/borrowck-multiple-captures.rs:22:19 + --> $DIR/borrowck-multiple-captures.rs:12:19 | LL | let p2 = &x2; | --- borrow of `x2` occurs here @@ -27,8 +27,10 @@ LL | borrow(&*p2); | ---- borrow later used here error[E0382]: use of moved value: `x1` - --> $DIR/borrowck-multiple-captures.rs:35:19 + --> $DIR/borrowck-multiple-captures.rs:25:19 | +LL | let x1: Box<_> = box 1; + | -- move occurs because `x1` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | drop(x1); | -- value moved here ... @@ -36,12 +38,12 @@ LL | thread::spawn(move|| { | ^^^^^^ value used here after move LL | drop(x1); //~ ERROR capture of moved value: `x1` | -- use occurs due to use in closure - | - = note: move occurs because `x1` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x2` - --> $DIR/borrowck-multiple-captures.rs:35:19 + --> $DIR/borrowck-multiple-captures.rs:25:19 | +LL | let x2: Box<_> = box 2; + | -- move occurs because `x2` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | drop(x2); | -- value moved here LL | thread::spawn(move|| { @@ -49,11 +51,9 @@ LL | thread::spawn(move|| { LL | drop(x1); //~ ERROR capture of moved value: `x1` LL | drop(x2); //~ ERROR capture of moved value: `x2` | -- use occurs due to use in closure - | - = note: move occurs because `x2` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/borrowck-multiple-captures.rs:46:14 + --> $DIR/borrowck-multiple-captures.rs:36:14 | LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed | - value moved here @@ -63,7 +63,7 @@ LL | drop(x); //~ ERROR use of moved value: `x` = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/borrowck-multiple-captures.rs:44:19 + --> $DIR/borrowck-multiple-captures.rs:34:19 | LL | let p = &x; | -- borrow of `x` occurs here @@ -76,7 +76,7 @@ LL | borrow(&*p); | --- borrow later used here error[E0382]: use of moved value: `x` - --> $DIR/borrowck-multiple-captures.rs:56:14 + --> $DIR/borrowck-multiple-captures.rs:46:14 | LL | drop(x); //~ ERROR capture of moved value: `x` | - value moved here @@ -86,16 +86,16 @@ LL | drop(x); //~ ERROR use of moved value: `x` = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/borrowck-multiple-captures.rs:54:19 + --> $DIR/borrowck-multiple-captures.rs:44:19 | +LL | let x: Box<_> = box 1; + | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | drop(x); | - value moved here LL | thread::spawn(move|| { | ^^^^^^ value used here after move LL | drop(x); //~ ERROR capture of moved value: `x` | - use occurs due to use in closure - | - = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to 8 previous errors diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.rs b/src/test/ui/borrowck/borrowck-multiple-captures.rs index 042b914ce41..ad753781cd6 100644 --- a/src/test/ui/borrowck/borrowck-multiple-captures.rs +++ b/src/test/ui/borrowck/borrowck-multiple-captures.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] use std::thread; diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.stderr b/src/test/ui/borrowck/borrowck-multiple-captures.stderr index 3163ca63452..3cdd0942608 100644 --- a/src/test/ui/borrowck/borrowck-multiple-captures.stderr +++ b/src/test/ui/borrowck/borrowck-multiple-captures.stderr @@ -1,5 +1,5 @@ error[E0504]: cannot move `x1` into closure because it is borrowed - --> $DIR/borrowck-multiple-captures.rs:23:14 + --> $DIR/borrowck-multiple-captures.rs:13:14 | LL | let p1 = &x1; | -- borrow of `x1` occurs here @@ -8,7 +8,7 @@ LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is bor | ^^ move into closure occurs here error[E0504]: cannot move `x2` into closure because it is borrowed - --> $DIR/borrowck-multiple-captures.rs:24:14 + --> $DIR/borrowck-multiple-captures.rs:14:14 | LL | let p2 = &x2; | -- borrow of `x2` occurs here @@ -17,7 +17,7 @@ LL | drop(x2); //~ ERROR cannot move `x2` into closure because it is bor | ^^ move into closure occurs here error[E0382]: capture of moved value: `x1` - --> $DIR/borrowck-multiple-captures.rs:36:14 + --> $DIR/borrowck-multiple-captures.rs:26:14 | LL | drop(x1); | -- value moved here @@ -28,7 +28,7 @@ LL | drop(x1); //~ ERROR capture of moved value: `x1` = note: move occurs because `x1` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: capture of moved value: `x2` - --> $DIR/borrowck-multiple-captures.rs:37:14 + --> $DIR/borrowck-multiple-captures.rs:27:14 | LL | drop(x2); | -- value moved here @@ -39,7 +39,7 @@ LL | drop(x2); //~ ERROR capture of moved value: `x2` = note: move occurs because `x2` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0504]: cannot move `x` into closure because it is borrowed - --> $DIR/borrowck-multiple-captures.rs:45:14 + --> $DIR/borrowck-multiple-captures.rs:35:14 | LL | let p = &x; | - borrow of `x` occurs here @@ -48,7 +48,7 @@ LL | drop(x); //~ ERROR cannot move `x` into closure because it is borro | ^ move into closure occurs here error[E0382]: use of moved value: `x` - --> $DIR/borrowck-multiple-captures.rs:46:14 + --> $DIR/borrowck-multiple-captures.rs:36:14 | LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed | - value moved here @@ -58,7 +58,7 @@ LL | drop(x); //~ ERROR use of moved value: `x` = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: capture of moved value: `x` - --> $DIR/borrowck-multiple-captures.rs:55:14 + --> $DIR/borrowck-multiple-captures.rs:45:14 | LL | drop(x); | - value moved here @@ -69,7 +69,7 @@ LL | drop(x); //~ ERROR capture of moved value: `x` = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/borrowck-multiple-captures.rs:56:14 + --> $DIR/borrowck-multiple-captures.rs:46:14 | LL | drop(x); //~ ERROR capture of moved value: `x` | - value moved here diff --git a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr index 352ace41d93..be69be63411 100644 --- a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-mut-addr-of-imm-var.rs:13:25 + --> $DIR/borrowck-mut-addr-of-imm-var.rs:3:25 | LL | let x: isize = 3; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.rs b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.rs index b6626a835e4..a79a239cbe0 100644 --- a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.rs +++ b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: isize = 3; let y: &mut isize = &mut x; //~ ERROR cannot borrow diff --git a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr index c073db2917a..95635f7f670 100644 --- a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr +++ b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable - --> $DIR/borrowck-mut-addr-of-imm-var.rs:13:30 + --> $DIR/borrowck-mut-addr-of-imm-var.rs:3:30 | LL | let x: isize = 3; | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.nll.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.nll.stderr index 5301ee7a403..806c3a623bc 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-mut-borrow-linear-errors.rs:23:30 + --> $DIR/borrowck-mut-borrow-linear-errors.rs:13:30 | LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | ---- ^^^^^^ second mutable borrow occurs here @@ -10,7 +10,7 @@ LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | ------ first mutable borrow occurs here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-mut-borrow-linear-errors.rs:25:30 + --> $DIR/borrowck-mut-borrow-linear-errors.rs:15:30 | LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | ---- first borrow used here, in later iteration of loop @@ -22,7 +22,7 @@ LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | ------ first mutable borrow occurs here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-mut-borrow-linear-errors.rs:27:30 + --> $DIR/borrowck-mut-borrow-linear-errors.rs:17:30 | LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | ^^^^^^ mutable borrow starts here in previous iteration of loop diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.stderr index 7a43cf15422..dafb60c959a 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.stderr +++ b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-mut-borrow-linear-errors.rs:23:35 + --> $DIR/borrowck-mut-borrow-linear-errors.rs:13:35 | LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | ^ mutable borrow starts here in previous iteration of loop @@ -8,7 +8,7 @@ LL | } | - mutable borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-mut-borrow-linear-errors.rs:25:35 + --> $DIR/borrowck-mut-borrow-linear-errors.rs:15:35 | LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | - first mutable borrow occurs here @@ -20,7 +20,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-mut-borrow-linear-errors.rs:27:35 + --> $DIR/borrowck-mut-borrow-linear-errors.rs:17:35 | LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | - first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.mir.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.mir.stderr index 5301ee7a403..806c3a623bc 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.mir.stderr +++ b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.mir.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-mut-borrow-linear-errors.rs:23:30 + --> $DIR/borrowck-mut-borrow-linear-errors.rs:13:30 | LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | ---- ^^^^^^ second mutable borrow occurs here @@ -10,7 +10,7 @@ LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | ------ first mutable borrow occurs here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-mut-borrow-linear-errors.rs:25:30 + --> $DIR/borrowck-mut-borrow-linear-errors.rs:15:30 | LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | ---- first borrow used here, in later iteration of loop @@ -22,7 +22,7 @@ LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | ------ first mutable borrow occurs here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-mut-borrow-linear-errors.rs:27:30 + --> $DIR/borrowck-mut-borrow-linear-errors.rs:17:30 | LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499] | ^^^^^^ mutable borrow starts here in previous iteration of loop diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs index 7b0a71815a5..bb0b26ecf06 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs +++ b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test to ensure we only report an error for the first issued loan that // conflicts with a new loan, as opposed to every issued loan. This keeps us // down to O(n) errors (for n problem lines), instead of O(n^2) errors. diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr index 57f9a2c1778..666ccf35a7c 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:21:18 + --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:11:18 | LL | let p: &isize = &*t0; // Freezes `*t0` | ---- immutable borrow occurs here @@ -10,7 +10,7 @@ LL | p.use_ref(); | - immutable borrow later used here error[E0499]: cannot borrow `t0` as mutable more than once at a time - --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:29:18 + --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:18 | LL | let p: &mut isize = &mut *t0; // Claims `*t0` | -------- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.rs b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.rs index 45768ef5114..32caa466475 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.rs +++ b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that attempt to mutably borrow `&mut` pointer while pointee is // borrowed yields an error. // diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr index d5b88319629..154a283b43b 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as immutable - --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:21:23 + --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:11:23 | LL | let p: &isize = &*t0; // Freezes `*t0` | --- immutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - immutable borrow ends here error[E0499]: cannot borrow `t0` as mutable more than once at a time - --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:29:23 + --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:23 | LL | let p: &mut isize = &mut *t0; // Claims `*t0` | --- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr index 7c151da3c36..5a9ec98a2db 100644 --- a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable - --> $DIR/borrowck-mut-slice-of-imm-vec.rs:17:11 + --> $DIR/borrowck-mut-slice-of-imm-vec.rs:7:11 | LL | let v = vec![1, 2, 3]; | - help: consider changing this to be mutable: `mut v` diff --git a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.rs b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.rs index 4e0304e20c0..8e23571cedc 100644 --- a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.rs +++ b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn write(v: &mut [isize]) { v[0] += 1; } diff --git a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr index 51b8ae83c61..41ee2adf8aa 100644 --- a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr +++ b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `v` as mutable - --> $DIR/borrowck-mut-slice-of-imm-vec.rs:17:16 + --> $DIR/borrowck-mut-slice-of-imm-vec.rs:7:16 | LL | let v = vec![1, 2, 3]; | - help: make this binding mutable: `mut v` diff --git a/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr b/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr index b363a78cbc2..c1b794fc86e 100644 --- a/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mutate-in-guard.nll.stderr @@ -1,11 +1,11 @@ error[E0302]: cannot assign in a pattern guard - --> $DIR/borrowck-mutate-in-guard.rs:20:25 + --> $DIR/borrowck-mutate-in-guard.rs:10:25 | LL | Enum::A(_) if { x = Enum::B(false); false } => 1, | ^^^^^^^^^^^^^^^^^^ assignment in pattern guard error[E0301]: cannot mutably borrow in a pattern guard - --> $DIR/borrowck-mutate-in-guard.rs:22:38 + --> $DIR/borrowck-mutate-in-guard.rs:12:38 | LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, | ^ borrowed mutably in pattern guard @@ -13,7 +13,7 @@ LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable error[E0302]: cannot assign in a pattern guard - --> $DIR/borrowck-mutate-in-guard.rs:22:41 + --> $DIR/borrowck-mutate-in-guard.rs:12:41 | LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, | ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard diff --git a/src/test/ui/borrowck/borrowck-mutate-in-guard.rs b/src/test/ui/borrowck/borrowck-mutate-in-guard.rs index e35edca639e..2bda3deee15 100644 --- a/src/test/ui/borrowck/borrowck-mutate-in-guard.rs +++ b/src/test/ui/borrowck/borrowck-mutate-in-guard.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Enum<'a> { A(&'a isize), B(bool), diff --git a/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr b/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr index 7a111a1bbcc..9e40856deb0 100644 --- a/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr +++ b/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr @@ -1,17 +1,17 @@ error[E0302]: cannot assign in a pattern guard - --> $DIR/borrowck-mutate-in-guard.rs:20:25 + --> $DIR/borrowck-mutate-in-guard.rs:10:25 | LL | Enum::A(_) if { x = Enum::B(false); false } => 1, | ^^^^^^^^^^^^^^^^^^ assignment in pattern guard error[E0301]: cannot mutably borrow in a pattern guard - --> $DIR/borrowck-mutate-in-guard.rs:22:38 + --> $DIR/borrowck-mutate-in-guard.rs:12:38 | LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, | ^ borrowed mutably in pattern guard error[E0302]: cannot assign in a pattern guard - --> $DIR/borrowck-mutate-in-guard.rs:22:41 + --> $DIR/borrowck-mutate-in-guard.rs:12:41 | LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, | ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr index 9bb1e825f25..b106708352e 100644 --- a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr +++ b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr @@ -1,7 +1,7 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/borrowck-no-cycle-in-exchange-heap.rs:26:15 + --> $DIR/borrowck-no-cycle-in-exchange-heap.rs:16:15 | -LL | cycle::node(ref mut y) => { +LL | Cycle::Node(ref mut y) => { | --------- borrow of `x.0` occurs here LL | y.a = x; //~ ERROR cannot move out of | --- ^ move out of `x` occurs here diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.rs b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.rs index 8cb7423f3cb..4c1ff98ce6e 100644 --- a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.rs +++ b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.rs @@ -1,30 +1,20 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] -struct node_ { - a: Box +struct Node_ { + a: Box } -enum cycle { - node(node_), - empty +enum Cycle { + Node(Node_), + Empty, } fn main() { - let mut x: Box<_> = box cycle::node(node_ {a: box cycle::empty}); + let mut x: Box<_> = box Cycle::Node(Node_ {a: box Cycle::Empty}); // Create a cycle! match *x { - cycle::node(ref mut y) => { + Cycle::Node(ref mut y) => { y.a = x; //~ ERROR cannot move out of } - cycle::empty => {} + Cycle::Empty => {} }; } diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr index 693f25e243c..5aaf825a3c3 100644 --- a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr +++ b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr @@ -1,7 +1,7 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/borrowck-no-cycle-in-exchange-heap.rs:26:15 + --> $DIR/borrowck-no-cycle-in-exchange-heap.rs:16:15 | -LL | cycle::node(ref mut y) => { +LL | Cycle::Node(ref mut y) => { | --------- borrow of `x.0` occurs here LL | y.a = x; //~ ERROR cannot move out of | ^ move out of `x` occurs here diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr index 8a9aaa9d895..ff0cc933232 100644 --- a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr +++ b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-object-lifetime.rs:30:13 + --> $DIR/borrowck-object-lifetime.rs:20:13 | LL | let y = x.borrowed(); | - immutable borrow occurs here @@ -9,7 +9,7 @@ LL | y.use_ref(); | - immutable borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-object-lifetime.rs:36:13 + --> $DIR/borrowck-object-lifetime.rs:26:13 | LL | let y = x.borrowed(); | - immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.rs b/src/test/ui/borrowck/borrowck-object-lifetime.rs index cb7486aefa2..495516cf976 100644 --- a/src/test/ui/borrowck/borrowck-object-lifetime.rs +++ b/src/test/ui/borrowck/borrowck-object-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that borrows that occur due to calls to object methods // properly "claim" the object path. diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.stderr index 5e9045d3e38..b22d05b8a2a 100644 --- a/src/test/ui/borrowck/borrowck-object-lifetime.stderr +++ b/src/test/ui/borrowck/borrowck-object-lifetime.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-object-lifetime.rs:30:13 + --> $DIR/borrowck-object-lifetime.rs:20:13 | LL | let y = x.borrowed(); | - immutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `x` as mutable because `*x` is also borrowed as immutable - --> $DIR/borrowck-object-lifetime.rs:36:18 + --> $DIR/borrowck-object-lifetime.rs:26:18 | LL | let y = x.borrowed(); | - immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-or-init.nll.stderr b/src/test/ui/borrowck/borrowck-or-init.nll.stderr index dd8bf879735..dcd2c18dcaa 100644 --- a/src/test/ui/borrowck/borrowck-or-init.nll.stderr +++ b/src/test/ui/borrowck/borrowck-or-init.nll.stderr @@ -1,5 +1,5 @@ error[E0381]: borrow of possibly uninitialized variable: `i` - --> $DIR/borrowck-or-init.rs:15:20 + --> $DIR/borrowck-or-init.rs:5:20 | LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` | ^ use of possibly uninitialized `i` diff --git a/src/test/ui/borrowck/borrowck-or-init.rs b/src/test/ui/borrowck/borrowck-or-init.rs index 27871a6ab16..5b1487831a6 100644 --- a/src/test/ui/borrowck/borrowck-or-init.rs +++ b/src/test/ui/borrowck/borrowck-or-init.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let i: isize; diff --git a/src/test/ui/borrowck/borrowck-or-init.stderr b/src/test/ui/borrowck/borrowck-or-init.stderr index bc1c3a51667..60024c08303 100644 --- a/src/test/ui/borrowck/borrowck-or-init.stderr +++ b/src/test/ui/borrowck/borrowck-or-init.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `i` - --> $DIR/borrowck-or-init.rs:15:20 + --> $DIR/borrowck-or-init.rs:5:20 | LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` | ^ use of possibly uninitialized `i` diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr index 0c4f2fa9d71..c5a4c4e005a 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-overloaded-call.rs:69:5 + --> $DIR/borrowck-overloaded-call.rs:59:5 | LL | let sp = &mut s; | ------ mutable borrow occurs here @@ -9,7 +9,7 @@ LL | use_mut(sp); | -- mutable borrow later used here error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable - --> $DIR/borrowck-overloaded-call.rs:77:5 + --> $DIR/borrowck-overloaded-call.rs:67:5 | LL | let s = SFnMut { | - help: consider changing this to be mutable: `mut s` @@ -18,14 +18,15 @@ LL | s(3); //~ ERROR cannot borrow immutable local variable `s` as mutable | ^ cannot borrow as mutable error[E0382]: use of moved value: `s` - --> $DIR/borrowck-overloaded-call.rs:85:5 + --> $DIR/borrowck-overloaded-call.rs:75:5 | +LL | let s = SFnOnce { + | - move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait +... LL | s(" world".to_string()); | - value moved here LL | s(" world".to_string()); //~ ERROR use of moved value: `s` | ^ value used here after move - | - = note: move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.rs b/src/test/ui/borrowck/borrowck-overloaded-call.rs index b2401fbbc04..8601449b331 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-call.rs +++ b/src/test/ui/borrowck/borrowck-overloaded-call.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(fn_traits, unboxed_closures)] use std::ops::{Fn, FnMut, FnOnce}; diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.stderr index bb5bafbbc7b..04292261306 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-call.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-call.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-overloaded-call.rs:69:5 + --> $DIR/borrowck-overloaded-call.rs:59:5 | LL | let sp = &mut s; | - mutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - mutable borrow ends here error[E0596]: cannot borrow immutable local variable `s` as mutable - --> $DIR/borrowck-overloaded-call.rs:77:5 + --> $DIR/borrowck-overloaded-call.rs:67:5 | LL | let s = SFnMut { | - help: make this binding mutable: `mut s` @@ -19,7 +19,7 @@ LL | s(3); //~ ERROR cannot borrow immutable local variable `s` as mutable | ^ cannot borrow mutably error[E0382]: use of moved value: `s` - --> $DIR/borrowck-overloaded-call.rs:85:5 + --> $DIR/borrowck-overloaded-call.rs:75:5 | LL | s(" world".to_string()); | - value moved here diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.nll.stderr index 874e6d74b64..f33fb55f9cd 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `v` because it is borrowed - --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:44:5 + --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:34:5 | LL | let i = &v[0].f; | - borrow of `v` occurs here diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.stderr index 8343b60dfbf..59841ee2dbe 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `v` because it is borrowed - --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:44:5 + --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:34:5 | LL | let i = &v[0].f; | - borrow of `v` occurs here diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.mir.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.mir.stderr index 874e6d74b64..f33fb55f9cd 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.mir.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.mir.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `v` because it is borrowed - --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:44:5 + --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:34:5 | LL | let i = &v[0].f; | - borrow of `v` occurs here diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs index 931d053ae7b..348d99f4f98 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs +++ b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we properly record borrows when we are doing an // overloaded, autoderef of a value obtained via an overloaded index // operator. The accounting of the all the implicit things going on diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr index fd4c380ea05..13ace0178f8 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*f` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-overloaded-index-autoderef.rs:47:14 + --> $DIR/borrowck-overloaded-index-autoderef.rs:37:14 | LL | let p = &mut f[&s]; | - mutable borrow occurs here @@ -9,7 +9,7 @@ LL | p.use_mut(); | - mutable borrow later used here error[E0499]: cannot borrow `*f` as mutable more than once at a time - --> $DIR/borrowck-overloaded-index-autoderef.rs:53:18 + --> $DIR/borrowck-overloaded-index-autoderef.rs:43:18 | LL | let p = &mut f[&s]; | - first mutable borrow occurs here @@ -19,7 +19,7 @@ LL | p.use_mut(); | - first borrow later used here error[E0499]: cannot borrow `f.foo` as mutable more than once at a time - --> $DIR/borrowck-overloaded-index-autoderef.rs:63:18 + --> $DIR/borrowck-overloaded-index-autoderef.rs:53:18 | LL | let p = &mut f.foo[&s]; | ----- first mutable borrow occurs here @@ -29,7 +29,7 @@ LL | p.use_mut(); | - first borrow later used here error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-overloaded-index-autoderef.rs:75:18 + --> $DIR/borrowck-overloaded-index-autoderef.rs:65:18 | LL | let p = &f.foo[&s]; | ----- immutable borrow occurs here @@ -39,7 +39,7 @@ LL | p.use_ref(); | - immutable borrow later used here error[E0506]: cannot assign to `f.foo` because it is borrowed - --> $DIR/borrowck-overloaded-index-autoderef.rs:81:5 + --> $DIR/borrowck-overloaded-index-autoderef.rs:71:5 | LL | let p = &f.foo[&s]; | ----- borrow of `f.foo` occurs here @@ -49,7 +49,7 @@ LL | p.use_ref(); | - borrow later used here error[E0506]: cannot assign to `*f` because it is borrowed - --> $DIR/borrowck-overloaded-index-autoderef.rs:87:5 + --> $DIR/borrowck-overloaded-index-autoderef.rs:77:5 | LL | let p = &f.foo[&s]; | ----- borrow of `*f` occurs here @@ -59,7 +59,7 @@ LL | p.use_ref(); | - borrow later used here error[E0506]: cannot assign to `f.foo` because it is borrowed - --> $DIR/borrowck-overloaded-index-autoderef.rs:93:5 + --> $DIR/borrowck-overloaded-index-autoderef.rs:83:5 | LL | let p = &mut f.foo[&s]; | ----- borrow of `f.foo` occurs here @@ -69,7 +69,7 @@ LL | p.use_mut(); | - borrow later used here error[E0506]: cannot assign to `*f` because it is borrowed - --> $DIR/borrowck-overloaded-index-autoderef.rs:99:5 + --> $DIR/borrowck-overloaded-index-autoderef.rs:89:5 | LL | let p = &mut f.foo[&s]; | ----- borrow of `*f` occurs here diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.rs b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.rs index 5ab3d75f181..3d3a3afd341 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.rs +++ b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we still see borrowck errors of various kinds when using // indexing and autoderef in combination. diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr index 7a17a5570e4..9bc83f84339 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*f` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-overloaded-index-autoderef.rs:47:14 + --> $DIR/borrowck-overloaded-index-autoderef.rs:37:14 | LL | let p = &mut f[&s]; | - mutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - mutable borrow ends here error[E0499]: cannot borrow `*f` as mutable more than once at a time - --> $DIR/borrowck-overloaded-index-autoderef.rs:53:18 + --> $DIR/borrowck-overloaded-index-autoderef.rs:43:18 | LL | let p = &mut f[&s]; | - first mutable borrow occurs here @@ -21,7 +21,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `f.foo` as mutable more than once at a time - --> $DIR/borrowck-overloaded-index-autoderef.rs:63:18 + --> $DIR/borrowck-overloaded-index-autoderef.rs:53:18 | LL | let p = &mut f.foo[&s]; | ----- first mutable borrow occurs here @@ -32,7 +32,7 @@ LL | } | - first borrow ends here error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-overloaded-index-autoderef.rs:75:18 + --> $DIR/borrowck-overloaded-index-autoderef.rs:65:18 | LL | let p = &f.foo[&s]; | ----- immutable borrow occurs here @@ -43,7 +43,7 @@ LL | } | - immutable borrow ends here error[E0506]: cannot assign to `f.foo` because it is borrowed - --> $DIR/borrowck-overloaded-index-autoderef.rs:81:5 + --> $DIR/borrowck-overloaded-index-autoderef.rs:71:5 | LL | let p = &f.foo[&s]; | ----- borrow of `f.foo` occurs here @@ -51,7 +51,7 @@ LL | f.foo = g; //~ ERROR cannot assign | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here error[E0506]: cannot assign to `*f` because it is borrowed - --> $DIR/borrowck-overloaded-index-autoderef.rs:87:5 + --> $DIR/borrowck-overloaded-index-autoderef.rs:77:5 | LL | let p = &f.foo[&s]; | ----- borrow of `*f` occurs here @@ -59,7 +59,7 @@ LL | *f = g; //~ ERROR cannot assign | ^^^^^^ assignment to borrowed `*f` occurs here error[E0506]: cannot assign to `f.foo` because it is borrowed - --> $DIR/borrowck-overloaded-index-autoderef.rs:93:5 + --> $DIR/borrowck-overloaded-index-autoderef.rs:83:5 | LL | let p = &mut f.foo[&s]; | ----- borrow of `f.foo` occurs here @@ -67,7 +67,7 @@ LL | f.foo = g; //~ ERROR cannot assign | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here error[E0506]: cannot assign to `*f` because it is borrowed - --> $DIR/borrowck-overloaded-index-autoderef.rs:99:5 + --> $DIR/borrowck-overloaded-index-autoderef.rs:89:5 | LL | let p = &mut f.foo[&s]; | ----- borrow of `*f` occurs here diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr index 92e10c258c2..dbd805f1d26 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-overloaded-index-move-from-vec.rs:30:15 + --> $DIR/borrowck-overloaded-index-move-from-vec.rs:20:15 | LL | let bad = v[0]; | ^^^^ diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs index df72c2b0af7..76dd97ea242 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] use std::ops::Index; diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr index 56246cbf770..fe655dc8b13 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of indexed content - --> $DIR/borrowck-overloaded-index-move-from-vec.rs:30:15 + --> $DIR/borrowck-overloaded-index-move-from-vec.rs:20:15 | LL | let bad = v[0]; | ^^^^ diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr index 198d086aa3b..de60067f1a6 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `s` because it is borrowed - --> $DIR/borrowck-overloaded-index-move-index.rs:60:22 + --> $DIR/borrowck-overloaded-index-move-index.rs:50:22 | LL | let rs = &mut s; | ------ borrow of `s` occurs here @@ -11,7 +11,7 @@ LL | use_mut(rs); | -- borrow later used here error[E0505]: cannot move out of `s` because it is borrowed - --> $DIR/borrowck-overloaded-index-move-index.rs:63:7 + --> $DIR/borrowck-overloaded-index-move-index.rs:53:7 | LL | let rs = &mut s; | ------ borrow of `s` occurs here @@ -23,15 +23,16 @@ LL | use_mut(rs); | -- borrow later used here error[E0382]: use of moved value: `s` - --> $DIR/borrowck-overloaded-index-move-index.rs:63:7 + --> $DIR/borrowck-overloaded-index-move-index.rs:53:7 | +LL | let mut s = "hello".to_string(); + | ----- move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait +... LL | println!("{}", f[s]); | - value moved here ... LL | f[s] = 10; | ^ value used here after move - | - = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.rs b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.rs index e95423a8e83..00f44831456 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.rs +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::{Index, IndexMut}; struct Foo { diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr index cfa5a6e317d..7ea311f3e7f 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `s` because it is borrowed - --> $DIR/borrowck-overloaded-index-move-index.rs:60:22 + --> $DIR/borrowck-overloaded-index-move-index.rs:50:22 | LL | let rs = &mut s; | - borrow of `s` occurs here @@ -8,7 +8,7 @@ LL | println!("{}", f[s]); | ^ move out of `s` occurs here error[E0505]: cannot move out of `s` because it is borrowed - --> $DIR/borrowck-overloaded-index-move-index.rs:63:7 + --> $DIR/borrowck-overloaded-index-move-index.rs:53:7 | LL | let rs = &mut s; | - borrow of `s` occurs here @@ -17,7 +17,7 @@ LL | f[s] = 10; | ^ move out of `s` occurs here error[E0382]: use of moved value: `s` - --> $DIR/borrowck-overloaded-index-move-index.rs:63:7 + --> $DIR/borrowck-overloaded-index-move-index.rs:53:7 | LL | println!("{}", f[s]); | - value moved here diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.nll.stderr index 7ff9285bcc0..2010e8f4962 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-overloaded-index-ref-index.rs:62:22 + --> $DIR/borrowck-overloaded-index-ref-index.rs:52:22 | LL | let rs = &mut s; | ------ mutable borrow occurs here @@ -10,7 +10,7 @@ LL | drop(rs); | -- mutable borrow later used here error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-overloaded-index-ref-index.rs:65:7 + --> $DIR/borrowck-overloaded-index-ref-index.rs:55:7 | LL | let rs = &mut s; | ------ mutable borrow occurs here @@ -22,7 +22,7 @@ LL | drop(rs); | -- mutable borrow later used here error[E0594]: cannot assign to data in a `&` reference - --> $DIR/borrowck-overloaded-index-ref-index.rs:71:5 + --> $DIR/borrowck-overloaded-index-ref-index.rs:61:5 | LL | s[2] = 20; | ^^^^^^^^^ cannot assign diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.stderr index 8675c5b7ac6..f97f0464fc0 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to immutable indexed content - --> $DIR/borrowck-overloaded-index-ref-index.rs:71:5 + --> $DIR/borrowck-overloaded-index-ref-index.rs:61:5 | LL | s[2] = 20; | ^^^^^^^^^ cannot borrow as mutable @@ -7,7 +7,7 @@ LL | s[2] = 20; = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `Bar` error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-overloaded-index-ref-index.rs:62:23 + --> $DIR/borrowck-overloaded-index-ref-index.rs:52:23 | LL | let rs = &mut s; | - mutable borrow occurs here @@ -18,7 +18,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-overloaded-index-ref-index.rs:65:8 + --> $DIR/borrowck-overloaded-index-ref-index.rs:55:8 | LL | let rs = &mut s; | - mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.mir.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.mir.stderr index 7ff9285bcc0..2010e8f4962 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.mir.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.mir.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-overloaded-index-ref-index.rs:62:22 + --> $DIR/borrowck-overloaded-index-ref-index.rs:52:22 | LL | let rs = &mut s; | ------ mutable borrow occurs here @@ -10,7 +10,7 @@ LL | drop(rs); | -- mutable borrow later used here error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-overloaded-index-ref-index.rs:65:7 + --> $DIR/borrowck-overloaded-index-ref-index.rs:55:7 | LL | let rs = &mut s; | ------ mutable borrow occurs here @@ -22,7 +22,7 @@ LL | drop(rs); | -- mutable borrow later used here error[E0594]: cannot assign to data in a `&` reference - --> $DIR/borrowck-overloaded-index-ref-index.rs:71:5 + --> $DIR/borrowck-overloaded-index-ref-index.rs:61:5 | LL | s[2] = 20; | ^^^^^^^^^ cannot assign diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.rs b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.rs index f4f40e0407f..53cab520e43 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.rs +++ b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-1.nll.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-1.nll.stderr index 0444bf97c65..65f2bd6cfbd 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-1.nll.stderr +++ b/src/test/ui/borrowck/borrowck-partial-reinit-1.nll.stderr @@ -1,22 +1,24 @@ error[E0382]: assign of moved value: `t` - --> $DIR/borrowck-partial-reinit-1.rs:37:5 + --> $DIR/borrowck-partial-reinit-1.rs:27:5 | +LL | let mut t = Test2 { b: None }; + | ----- move occurs because `t` has type `Test2`, which does not implement the `Copy` trait +LL | let u = Test; LL | drop(t); | - value moved here LL | t.b = Some(u); | ^^^ value assigned here after move - | - = note: move occurs because `t` has type `Test2`, which does not implement the `Copy` trait error[E0382]: assign of moved value: `t` - --> $DIR/borrowck-partial-reinit-1.rs:43:5 + --> $DIR/borrowck-partial-reinit-1.rs:33:5 | +LL | let mut t = Test3(None); + | ----- move occurs because `t` has type `Test3`, which does not implement the `Copy` trait +LL | let u = Test; LL | drop(t); | - value moved here LL | t.0 = Some(u); | ^^^ value assigned here after move - | - = note: move occurs because `t` has type `Test3`, which does not implement the `Copy` trait error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-1.rs b/src/test/ui/borrowck/borrowck-partial-reinit-1.rs index 1ee040a0705..f763759152c 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-1.rs +++ b/src/test/ui/borrowck/borrowck-partial-reinit-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Test; struct Test2 { diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-1.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-1.stderr index c03921cd3dd..23f5035369d 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-1.stderr +++ b/src/test/ui/borrowck/borrowck-partial-reinit-1.stderr @@ -1,11 +1,11 @@ error[E0383]: partial reinitialization of uninitialized structure `t` - --> $DIR/borrowck-partial-reinit-1.rs:37:5 + --> $DIR/borrowck-partial-reinit-1.rs:27:5 | LL | t.b = Some(u); | ^^^^^^^^^^^^^ error[E0383]: partial reinitialization of uninitialized structure `t` - --> $DIR/borrowck-partial-reinit-1.rs:43:5 + --> $DIR/borrowck-partial-reinit-1.rs:33:5 | LL | t.0 = Some(u); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-2.nll.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-2.nll.stderr index 14272fa3ed5..36a871fbb12 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-partial-reinit-2.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: assign of moved value: `t` - --> $DIR/borrowck-partial-reinit-2.rs:25:5 + --> $DIR/borrowck-partial-reinit-2.rs:15:5 | +LL | let mut t = Test { a: 1, b: None}; + | ----- move occurs because `t` has type `Test`, which does not implement the `Copy` trait LL | let mut u = Test { a: 2, b: Some(Box::new(t))}; | - value moved here LL | t.b = Some(Box::new(u)); | ^^^ value assigned here after move - | - = note: move occurs because `t` has type `Test`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-2.rs b/src/test/ui/borrowck/borrowck-partial-reinit-2.rs index c9cdeff9c7a..986c20e361c 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-2.rs +++ b/src/test/ui/borrowck/borrowck-partial-reinit-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Test { a: isize, b: Option>, diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-2.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-2.stderr index 4ed87b95292..891f6088508 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-2.stderr +++ b/src/test/ui/borrowck/borrowck-partial-reinit-2.stderr @@ -1,5 +1,5 @@ error[E0383]: partial reinitialization of uninitialized structure `t` - --> $DIR/borrowck-partial-reinit-2.rs:25:5 + --> $DIR/borrowck-partial-reinit-2.rs:15:5 | LL | t.b = Some(Box::new(u)); | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-3.nll.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-3.nll.stderr index 3979f1e6753..05f5411eed6 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-3.nll.stderr +++ b/src/test/ui/borrowck/borrowck-partial-reinit-3.nll.stderr @@ -1,5 +1,5 @@ error[E0382]: assign of moved value: `x.0` - --> $DIR/borrowck-partial-reinit-3.rs:20:5 + --> $DIR/borrowck-partial-reinit-3.rs:11:5 | LL | mem::drop(x.0); | --- value moved here diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-3.rs b/src/test/ui/borrowck/borrowck-partial-reinit-3.rs index 0aa73892b82..c7fbd7fc881 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-3.rs +++ b/src/test/ui/borrowck/borrowck-partial-reinit-3.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. use std::mem; struct Test { f: usize } diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-3.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-3.stderr index 66465c07374..262317444cb 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-3.stderr +++ b/src/test/ui/borrowck/borrowck-partial-reinit-3.stderr @@ -1,5 +1,5 @@ error[E0383]: partial reinitialization of uninitialized structure `x.0` - --> $DIR/borrowck-partial-reinit-3.rs:20:5 + --> $DIR/borrowck-partial-reinit-3.rs:11:5 | LL | x.0.f = 3; | ^^^^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-4.nll.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-4.nll.stderr index e1ede72a7c9..f0a9a7dd5e2 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-4.nll.stderr +++ b/src/test/ui/borrowck/borrowck-partial-reinit-4.nll.stderr @@ -1,5 +1,5 @@ error[E0381]: assign of possibly uninitialized variable: `x.0` - --> $DIR/borrowck-partial-reinit-4.rs:27:5 + --> $DIR/borrowck-partial-reinit-4.rs:17:5 | LL | (x.0).0 = Some(Test); | ^^^^^^^ use of possibly uninitialized `x.0` diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-4.rs b/src/test/ui/borrowck/borrowck-partial-reinit-4.rs index 774e04ecb29..ffa6b11b6fa 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-4.rs +++ b/src/test/ui/borrowck/borrowck-partial-reinit-4.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Test; struct Test2(Option); diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr index 229a53ad827..8ca8e7e13c6 100644 --- a/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr +++ b/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr @@ -1,5 +1,5 @@ error[E0383]: partial reinitialization of uninitialized structure `x.0` - --> $DIR/borrowck-partial-reinit-4.rs:27:5 + --> $DIR/borrowck-partial-reinit-4.rs:17:5 | LL | (x.0).0 = Some(Test); | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.nll.stderr b/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.nll.stderr index cfcf177efa3..d65ba12295d 100644 --- a/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-pat-reassign-binding.rs:23:11 + --> $DIR/borrowck-pat-reassign-binding.rs:13:11 | LL | Some(ref i) => { | ----- borrow of `x` occurs here diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.stderr b/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.stderr index fdc04e226a5..207f971acff 100644 --- a/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.stderr +++ b/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-pat-reassign-binding.rs:23:11 + --> $DIR/borrowck-pat-reassign-binding.rs:13:11 | LL | Some(ref i) => { | ----- borrow of `x` occurs here diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-binding.mir.stderr b/src/test/ui/borrowck/borrowck-pat-reassign-binding.mir.stderr index cfcf177efa3..d65ba12295d 100644 --- a/src/test/ui/borrowck/borrowck-pat-reassign-binding.mir.stderr +++ b/src/test/ui/borrowck/borrowck-pat-reassign-binding.mir.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/borrowck-pat-reassign-binding.rs:23:11 + --> $DIR/borrowck-pat-reassign-binding.rs:13:11 | LL | Some(ref i) => { | ----- borrow of `x` occurs here diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-binding.rs b/src/test/ui/borrowck/borrowck-pat-reassign-binding.rs index d917a0abb88..9befa9162d5 100644 --- a/src/test/ui/borrowck/borrowck-pat-reassign-binding.rs +++ b/src/test/ui/borrowck/borrowck-pat-reassign-binding.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr index 1b4f9e77da8..6b41b6f9c4f 100644 --- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-reborrow-from-mut.rs:23:17 + --> $DIR/borrowck-reborrow-from-mut.rs:13:17 | LL | let _bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here @@ -9,7 +9,7 @@ LL | use_mut(_bar1); | ----- first borrow later used here error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-reborrow-from-mut.rs:28:17 + --> $DIR/borrowck-reborrow-from-mut.rs:18:17 | LL | let _bar1 = &mut foo.bar1; | ------------- mutable borrow occurs here @@ -19,7 +19,7 @@ LL | use_mut(_bar1); | ----- mutable borrow later used here error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-reborrow-from-mut.rs:33:17 + --> $DIR/borrowck-reborrow-from-mut.rs:23:17 | LL | let _bar1 = &foo.bar1; | --------- immutable borrow occurs here @@ -29,7 +29,7 @@ LL | use_imm(_bar1); | ----- immutable borrow later used here error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-reborrow-from-mut.rs:55:21 + --> $DIR/borrowck-reborrow-from-mut.rs:45:21 | LL | let _bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here @@ -41,7 +41,7 @@ LL | use_mut(_bar1); | ----- first borrow later used here error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-reborrow-from-mut.rs:62:17 + --> $DIR/borrowck-reborrow-from-mut.rs:52:17 | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here @@ -52,7 +52,7 @@ LL | use_mut(_bar1); | ----- mutable borrow later used here error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-reborrow-from-mut.rs:63:17 + --> $DIR/borrowck-reborrow-from-mut.rs:53:17 | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here @@ -63,7 +63,7 @@ LL | use_mut(_bar1); | ----- mutable borrow later used here error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-reborrow-from-mut.rs:68:17 + --> $DIR/borrowck-reborrow-from-mut.rs:58:17 | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here @@ -73,7 +73,7 @@ LL | use_mut(_bar1); | ----- first borrow later used here error[E0499]: cannot borrow `*foo` as mutable more than once at a time - --> $DIR/borrowck-reborrow-from-mut.rs:73:17 + --> $DIR/borrowck-reborrow-from-mut.rs:63:17 | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here @@ -83,7 +83,7 @@ LL | use_mut(_bar1); | ----- first borrow later used here error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-reborrow-from-mut.rs:78:17 + --> $DIR/borrowck-reborrow-from-mut.rs:68:17 | LL | let _bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here @@ -93,7 +93,7 @@ LL | use_imm(_bar1); | ----- immutable borrow later used here error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-reborrow-from-mut.rs:83:17 + --> $DIR/borrowck-reborrow-from-mut.rs:73:17 | LL | let _bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here @@ -103,7 +103,7 @@ LL | use_imm(_bar1); | ----- immutable borrow later used here error[E0596]: cannot borrow `foo.bar1` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-reborrow-from-mut.rs:98:17 + --> $DIR/borrowck-reborrow-from-mut.rs:88:17 | LL | fn borrow_mut_from_imm(foo: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut Foo` diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.rs b/src/test/ui/borrowck/borrowck-reborrow-from-mut.rs index 9235d900a7e..eef83c5ac1e 100644 --- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.rs +++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { bar1: Bar, bar2: Bar diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr index 1310e38cb3e..c20df9f5ff3 100644 --- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr +++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-reborrow-from-mut.rs:23:22 + --> $DIR/borrowck-reborrow-from-mut.rs:13:22 | LL | let _bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - first borrow ends here error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-reborrow-from-mut.rs:28:18 + --> $DIR/borrowck-reborrow-from-mut.rs:18:18 | LL | let _bar1 = &mut foo.bar1; | -------- mutable borrow occurs here @@ -21,7 +21,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-reborrow-from-mut.rs:33:22 + --> $DIR/borrowck-reborrow-from-mut.rs:23:22 | LL | let _bar1 = &foo.bar1; | -------- immutable borrow occurs here @@ -32,7 +32,7 @@ LL | } | - immutable borrow ends here error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-reborrow-from-mut.rs:55:21 + --> $DIR/borrowck-reborrow-from-mut.rs:45:21 | LL | let _bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here @@ -44,7 +44,7 @@ LL | } | - first borrow ends here error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable - --> $DIR/borrowck-reborrow-from-mut.rs:62:18 + --> $DIR/borrowck-reborrow-from-mut.rs:52:18 | LL | let _bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here @@ -55,7 +55,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `*foo` as immutable because `foo.bar1.int1` is also borrowed as mutable - --> $DIR/borrowck-reborrow-from-mut.rs:63:18 + --> $DIR/borrowck-reborrow-from-mut.rs:53:18 | LL | let _bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here @@ -67,7 +67,7 @@ LL | } | - mutable borrow ends here error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time - --> $DIR/borrowck-reborrow-from-mut.rs:68:22 + --> $DIR/borrowck-reborrow-from-mut.rs:58:22 | LL | let _bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here @@ -78,7 +78,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `*foo` as mutable more than once at a time - --> $DIR/borrowck-reborrow-from-mut.rs:73:22 + --> $DIR/borrowck-reborrow-from-mut.rs:63:22 | LL | let _bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here @@ -89,7 +89,7 @@ LL | } | - first borrow ends here error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable - --> $DIR/borrowck-reborrow-from-mut.rs:78:22 + --> $DIR/borrowck-reborrow-from-mut.rs:68:22 | LL | let _bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here @@ -100,7 +100,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `*foo` as mutable because `foo.bar1.int1` is also borrowed as immutable - --> $DIR/borrowck-reborrow-from-mut.rs:83:22 + --> $DIR/borrowck-reborrow-from-mut.rs:73:22 | LL | let _bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here @@ -111,7 +111,7 @@ LL | } | - immutable borrow ends here error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable - --> $DIR/borrowck-reborrow-from-mut.rs:98:22 + --> $DIR/borrowck-reborrow-from-mut.rs:88:22 | LL | fn borrow_mut_from_imm(foo: &Foo) { | ---- use `&mut Foo` here to make mutable diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.rs b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.rs index af85e68f5de..a7c9200d35a 100644 --- a/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.rs +++ b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that assignments to an `&mut` pointer which is found in a // borrowed (but otherwise non-aliasable) location is illegal. diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.stderr index 52dabfaa1d4..67b6f64eaa6 100644 --- a/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.stderr +++ b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:19:5 + --> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:9:5 | LL | fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> { | ------------- ----- diff --git a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr index ccea5d9565b..67948ad3879 100644 --- a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr +++ b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable - --> $DIR/borrowck-ref-mut-of-imm.rs:14:12 + --> $DIR/borrowck-ref-mut-of-imm.rs:4:12 | LL | fn destructure(x: Option) -> isize { | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.rs b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.rs index 1784b72a699..ae5bb8591f9 100644 --- a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.rs +++ b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn destructure(x: Option) -> isize { match x { None => 0, diff --git a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr index 520992096b5..4eb41758fc1 100644 --- a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr +++ b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow field `(x as std::prelude::v1::Some).0` of immutable binding as mutable - --> $DIR/borrowck-ref-mut-of-imm.rs:14:12 + --> $DIR/borrowck-ref-mut-of-imm.rs:4:12 | LL | fn destructure(x: Option) -> isize { | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/borrowck/borrowck-reinit.rs b/src/test/ui/borrowck/borrowck-reinit.rs index 2e07577c5ea..e8e38a92c81 100644 --- a/src/test/ui/borrowck/borrowck-reinit.rs +++ b/src/test/ui/borrowck/borrowck-reinit.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z borrowck=compare fn main() { diff --git a/src/test/ui/borrowck/borrowck-reinit.stderr b/src/test/ui/borrowck/borrowck-reinit.stderr index 654afa42186..96f3981ac2f 100644 --- a/src/test/ui/borrowck/borrowck-reinit.stderr +++ b/src/test/ui/borrowck/borrowck-reinit.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` (Ast) - --> $DIR/borrowck-reinit.rs:18:16 + --> $DIR/borrowck-reinit.rs:8:16 | LL | drop(x); | - value moved here @@ -9,14 +9,15 @@ LL | let _ = (1,x); //~ ERROR use of moved value: `x` (Ast) = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` (Mir) - --> $DIR/borrowck-reinit.rs:18:16 + --> $DIR/borrowck-reinit.rs:8:16 | +LL | let mut x = Box::new(0); + | ----- move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait +... LL | drop(x); | - value moved here LL | let _ = (1,x); //~ ERROR use of moved value: `x` (Ast) | ^ value used here after move - | - = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr index a089f6d90f8..7b026ee9951 100644 --- a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr +++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-report-with-custom-diagnostic.rs:17:13 + --> $DIR/borrowck-report-with-custom-diagnostic.rs:8:13 | LL | let y = &mut x; | ------ mutable borrow occurs here @@ -11,7 +11,7 @@ LL | y.use_mut(); | - mutable borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-report-with-custom-diagnostic.rs:30:21 + --> $DIR/borrowck-report-with-custom-diagnostic.rs:21:21 | LL | let y = &x; | -- immutable borrow occurs here @@ -23,7 +23,7 @@ LL | y.use_ref(); | - immutable borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-report-with-custom-diagnostic.rs:45:17 + --> $DIR/borrowck-report-with-custom-diagnostic.rs:36:17 | LL | let y = &mut x; | ------ first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.rs b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.rs index 2bc65287982..6f323d91227 100644 --- a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.rs +++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.rs @@ -1,12 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(rustc_attrs)] #![allow(dead_code)] fn main() { #![rustc_error] // rust-lang/rust#49855 diff --git a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr index 1fe052cef71..cb65ea11205 100644 --- a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr +++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-report-with-custom-diagnostic.rs:17:14 + --> $DIR/borrowck-report-with-custom-diagnostic.rs:8:14 | LL | let y = &mut x; | - mutable borrow occurs here @@ -11,7 +11,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-report-with-custom-diagnostic.rs:30:26 + --> $DIR/borrowck-report-with-custom-diagnostic.rs:21:26 | LL | let y = &x; | - immutable borrow occurs here @@ -23,7 +23,7 @@ LL | } | - immutable borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/borrowck-report-with-custom-diagnostic.rs:45:22 + --> $DIR/borrowck-report-with-custom-diagnostic.rs:36:22 | LL | let y = &mut x; | - first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr index 7d6b670e536..65f910de4c3 100644 --- a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr +++ b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing function parameter `x` - --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:17:5 + --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:7:5 | LL | (&x).clone() //~ ERROR `x` does not live long enough | ----^^^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.rs b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.rs index 7529943f0bc..f8cdc3ed97c 100644 --- a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.rs +++ b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that when we clone a `&T` pointer we properly relate the // lifetime of the pointer which results to the pointer being cloned. // Bugs in method resolution have sometimes broken this connection. diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr index 69d5229244b..b54941eed1b 100644 --- a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr +++ b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr @@ -1,13 +1,13 @@ error[E0597]: `x` does not live long enough - --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:17:7 + --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:7:7 | LL | (&x).clone() //~ ERROR `x` does not live long enough | ^ borrowed value does not live long enough LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 16:9... - --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:16:9 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 6:9... + --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:6:9 | LL | fn leak<'a, T>(x: T) -> &'a T { | ^^ diff --git a/src/test/ui/borrowck/borrowck-return.rs b/src/test/ui/borrowck/borrowck-return.rs index 74d435b35e7..e5bee2ca4bf 100644 --- a/src/test/ui/borrowck/borrowck-return.rs +++ b/src/test/ui/borrowck/borrowck-return.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f() -> isize { let x: isize; return x; //~ ERROR use of possibly uninitialized variable: `x` diff --git a/src/test/ui/borrowck/borrowck-return.stderr b/src/test/ui/borrowck/borrowck-return.stderr index 7223289b376..b8a5ce8dc99 100644 --- a/src/test/ui/borrowck/borrowck-return.stderr +++ b/src/test/ui/borrowck/borrowck-return.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-return.rs:13:12 + --> $DIR/borrowck-return.rs:3:12 | LL | return x; //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.rs b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.rs index da36f494eb6..5de8dd3305e 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.rs +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //compile-flags: -Z borrowck=mir #![feature(slice_patterns)] diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr index 7f260910ab8..b1629c0e056 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan.rs:28:20 + --> $DIR/borrowck-slice-pattern-element-loan.rs:18:20 | LL | if let [ref first, ref second, ..] = *s { | ---------- immutable borrow occurs here @@ -9,7 +9,7 @@ LL | nop(&[first, second, second2, third]); | ------ immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan.rs:44:21 + --> $DIR/borrowck-slice-pattern-element-loan.rs:34:21 | LL | if let [.., ref fourth, ref third, _, ref first] = *s { | --------- immutable borrow occurs here @@ -19,7 +19,7 @@ LL | nop(&[first, third, third2, fourth]); | ----- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan.rs:55:20 + --> $DIR/borrowck-slice-pattern-element-loan.rs:45:20 | LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { | ------------- immutable borrow occurs here @@ -30,7 +30,7 @@ LL | nop(&[from_begin1, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan.rs:58:23 + --> $DIR/borrowck-slice-pattern-element-loan.rs:48:23 | LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { | ------------- immutable borrow occurs here @@ -41,7 +41,7 @@ LL | nop(&[from_begin2, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan.rs:61:26 + --> $DIR/borrowck-slice-pattern-element-loan.rs:51:26 | LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { | ------------- immutable borrow occurs here @@ -52,7 +52,7 @@ LL | nop(&[from_begin3, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan.rs:69:21 + --> $DIR/borrowck-slice-pattern-element-loan.rs:59:21 | LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { | --------------- immutable borrow occurs here @@ -63,7 +63,7 @@ LL | nop(&[from_begin0, from_begin1, from_begin3, from_end2]); | ----------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan.rs:72:21 + --> $DIR/borrowck-slice-pattern-element-loan.rs:62:21 | LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { | --------------- immutable borrow occurs here @@ -74,7 +74,7 @@ LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]); | ----------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan.rs:75:21 + --> $DIR/borrowck-slice-pattern-element-loan.rs:65:21 | LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { | --------------- immutable borrow occurs here @@ -85,7 +85,7 @@ LL | nop(&[from_begin0, from_begin1, from_begin3, from_end4]); | ----------- immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan.rs:92:20 + --> $DIR/borrowck-slice-pattern-element-loan.rs:82:20 | LL | if let [ref first, ref second, ..] = *s { | ---------- immutable borrow occurs here @@ -95,7 +95,7 @@ LL | nop(&[first, second]); | ------ immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan.rs:110:17 + --> $DIR/borrowck-slice-pattern-element-loan.rs:100:17 | LL | if let [.., ref second, ref first] = *s { | ---------- immutable borrow occurs here @@ -105,7 +105,7 @@ LL | nop(&[first, second]); | ------ immutable borrow later used here error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-slice-pattern-element-loan.rs:119:17 + --> $DIR/borrowck-slice-pattern-element-loan.rs:109:17 | LL | if let [_, _, _, ref s1..] = *s { | ------ immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-storage-dead.rs b/src/test/ui/borrowck/borrowck-storage-dead.rs index bc01088696d..72c3bc13719 100644 --- a/src/test/ui/borrowck/borrowck-storage-dead.rs +++ b/src/test/ui/borrowck/borrowck-storage-dead.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z borrowck=compare fn ok() { diff --git a/src/test/ui/borrowck/borrowck-storage-dead.stderr b/src/test/ui/borrowck/borrowck-storage-dead.stderr index edb7c13cf8b..057d40d74cf 100644 --- a/src/test/ui/borrowck/borrowck-storage-dead.stderr +++ b/src/test/ui/borrowck/borrowck-storage-dead.stderr @@ -1,11 +1,11 @@ error[E0381]: use of possibly uninitialized variable: `x` (Ast) - --> $DIR/borrowck-storage-dead.rs:28:17 + --> $DIR/borrowck-storage-dead.rs:18:17 | LL | let _ = x + 1; //~ERROR (Ast) [E0381] | ^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` (Mir) - --> $DIR/borrowck-storage-dead.rs:28:17 + --> $DIR/borrowck-storage-dead.rs:18:17 | LL | let _ = x + 1; //~ERROR (Ast) [E0381] | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.nll.stderr b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.nll.stderr index a811f5d4def..dbc9ece0c8f 100644 --- a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.nll.stderr @@ -1,11 +1,11 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-struct-update-with-dtor.rs:25:15 + --> $DIR/borrowck-struct-update-with-dtor.rs:15:15 | LL | let _s2 = S{a: 2, ..s0}; | ^^^^^^^^^^^^^ cannot move out of here error[E0509]: cannot move out of type `T`, which implements the `Drop` trait - --> $DIR/borrowck-struct-update-with-dtor.rs:31:15 + --> $DIR/borrowck-struct-update-with-dtor.rs:21:15 | LL | let _s2 = T{a: 2, ..s0}; | ^^^^^^^^^^^^^ cannot move out of here diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.stderr b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.stderr index aebee2c3321..bc0a954b46d 100644 --- a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.stderr +++ b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.stderr @@ -1,11 +1,11 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-struct-update-with-dtor.rs:25:25 + --> $DIR/borrowck-struct-update-with-dtor.rs:15:25 | LL | let _s2 = S{a: 2, ..s0}; | ^^ cannot move out of here error[E0509]: cannot move out of type `T`, which implements the `Drop` trait - --> $DIR/borrowck-struct-update-with-dtor.rs:31:25 + --> $DIR/borrowck-struct-update-with-dtor.rs:21:25 | LL | let _s2 = T{a: 2, ..s0}; | ^^ cannot move out of here diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.mir.stderr b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.mir.stderr index a811f5d4def..dbc9ece0c8f 100644 --- a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.mir.stderr +++ b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.mir.stderr @@ -1,11 +1,11 @@ error[E0509]: cannot move out of type `S`, which implements the `Drop` trait - --> $DIR/borrowck-struct-update-with-dtor.rs:25:15 + --> $DIR/borrowck-struct-update-with-dtor.rs:15:15 | LL | let _s2 = S{a: 2, ..s0}; | ^^^^^^^^^^^^^ cannot move out of here error[E0509]: cannot move out of type `T`, which implements the `Drop` trait - --> $DIR/borrowck-struct-update-with-dtor.rs:31:15 + --> $DIR/borrowck-struct-update-with-dtor.rs:21:15 | LL | let _s2 = T{a: 2, ..s0}; | ^^^^^^^^^^^^^ cannot move out of here diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs index f90651687a5..da5bb636631 100644 --- a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs +++ b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr index 4fad30fd40d..8fdd5ef4ca6 100644 --- a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-swap-mut-base-ptr.rs:23:10 + --> $DIR/borrowck-swap-mut-base-ptr.rs:13:10 | LL | let p: &isize = &*t0; // Freezes `*t0` | ---- immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.rs b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.rs index b4b78bbb747..3d40d319226 100644 --- a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.rs +++ b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that attempt to swap `&mut` pointer while pointee is borrowed // yields an error. // diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr index 27824725e53..35007216dac 100644 --- a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as immutable - --> $DIR/borrowck-swap-mut-base-ptr.rs:23:15 + --> $DIR/borrowck-swap-mut-base-ptr.rs:13:15 | LL | let p: &isize = &*t0; // Freezes `*t0` | --- immutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.nll.stderr b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.nll.stderr index 7373457e719..34d08a026dd 100644 --- a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0712]: thread-local variable borrowed past end of function - --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:21:20 + --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:11:20 | LL | assert_static(&FOO); //[ast]~ ERROR [E0597] | ^^^^ thread-local variables cannot be borrowed beyond the end of the function diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.stderr b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.stderr index 505bcfb1e6e..4724f1772ba 100644 --- a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.stderr +++ b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:21:21 + --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:11:21 | LL | assert_static(&FOO); //[ast]~ ERROR [E0597] | ^^^ - borrowed value only lives until here diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.mir.stderr b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.mir.stderr index 7373457e719..34d08a026dd 100644 --- a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.mir.stderr +++ b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.mir.stderr @@ -1,5 +1,5 @@ error[E0712]: thread-local variable borrowed past end of function - --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:21:20 + --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:11:20 | LL | assert_static(&FOO); //[ast]~ ERROR [E0597] | ^^^^ thread-local variables cannot be borrowed beyond the end of the function diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs index 7aa02558446..6fd6acc8346 100644 --- a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs +++ b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-unary-move.ast.nll.stderr b/src/test/ui/borrowck/borrowck-unary-move.ast.nll.stderr index caeaa173bb8..53dc6a77887 100644 --- a/src/test/ui/borrowck/borrowck-unary-move.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-unary-move.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/borrowck-unary-move.rs:17:10 + --> $DIR/borrowck-unary-move.rs:7:10 | LL | let y = &*x; | --- borrow of `*x` occurs here diff --git a/src/test/ui/borrowck/borrowck-unary-move.ast.stderr b/src/test/ui/borrowck/borrowck-unary-move.ast.stderr index 968fbb4526d..9383298af9b 100644 --- a/src/test/ui/borrowck/borrowck-unary-move.ast.stderr +++ b/src/test/ui/borrowck/borrowck-unary-move.ast.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/borrowck-unary-move.rs:17:10 + --> $DIR/borrowck-unary-move.rs:7:10 | LL | let y = &*x; | -- borrow of `*x` occurs here diff --git a/src/test/ui/borrowck/borrowck-unary-move.mir.stderr b/src/test/ui/borrowck/borrowck-unary-move.mir.stderr index caeaa173bb8..53dc6a77887 100644 --- a/src/test/ui/borrowck/borrowck-unary-move.mir.stderr +++ b/src/test/ui/borrowck/borrowck-unary-move.mir.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/borrowck-unary-move.rs:17:10 + --> $DIR/borrowck-unary-move.rs:7:10 | LL | let y = &*x; | --- borrow of `*x` occurs here diff --git a/src/test/ui/borrowck/borrowck-unary-move.rs b/src/test/ui/borrowck/borrowck-unary-move.rs index 8163ce29939..4e023ac8599 100644 --- a/src/test/ui/borrowck/borrowck-unary-move.rs +++ b/src/test/ui/borrowck/borrowck-unary-move.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr index ee5ad58290e..363a5a69a07 100644 --- a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr +++ b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-unboxed-closures.rs:13:5 + --> $DIR/borrowck-unboxed-closures.rs:3:5 | LL | let g = &mut f; | ------ mutable borrow occurs here @@ -9,7 +9,7 @@ LL | use_mut(g); | - mutable borrow later used here error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable - --> $DIR/borrowck-unboxed-closures.rs:17:5 + --> $DIR/borrowck-unboxed-closures.rs:7:5 | LL | fn b isize>(f: F) { | - help: consider changing this to be mutable: `mut f` @@ -17,14 +17,16 @@ LL | f(1, 2); //~ ERROR cannot borrow immutable argument | ^ cannot borrow as mutable error[E0382]: use of moved value: `f` - --> $DIR/borrowck-unboxed-closures.rs:22:5 + --> $DIR/borrowck-unboxed-closures.rs:12:5 | +LL | fn c isize>(f: F) { + | - - move occurs because `f` has type `F`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument LL | f(1, 2); | - value moved here LL | f(1, 2); //~ ERROR use of moved value | ^ value used here after move - | - = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.rs b/src/test/ui/borrowck/borrowck-unboxed-closures.rs index 43f143a492f..bfd0fbb3050 100644 --- a/src/test/ui/borrowck/borrowck-unboxed-closures.rs +++ b/src/test/ui/borrowck/borrowck-unboxed-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn a isize>(mut f: F) { let g = &mut f; f(1, 2); //~ ERROR cannot borrow `f` as immutable diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr index 6ee1a6245a5..044119f5089 100644 --- a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr +++ b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-unboxed-closures.rs:13:5 + --> $DIR/borrowck-unboxed-closures.rs:3:5 | LL | let g = &mut f; | - mutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - mutable borrow ends here error[E0596]: cannot borrow immutable argument `f` as mutable - --> $DIR/borrowck-unboxed-closures.rs:17:5 + --> $DIR/borrowck-unboxed-closures.rs:7:5 | LL | fn b isize>(f: F) { | - help: make this binding mutable: `mut f` @@ -18,7 +18,7 @@ LL | f(1, 2); //~ ERROR cannot borrow immutable argument | ^ cannot borrow mutably error[E0382]: use of moved value: `f` - --> $DIR/borrowck-unboxed-closures.rs:22:5 + --> $DIR/borrowck-unboxed-closures.rs:12:5 | LL | f(1, 2); | - value moved here diff --git a/src/test/ui/borrowck/borrowck-uninit-after-item.rs b/src/test/ui/borrowck/borrowck-uninit-after-item.rs index acd827d6c62..83f3752a1a8 100644 --- a/src/test/ui/borrowck/borrowck-uninit-after-item.rs +++ b/src/test/ui/borrowck/borrowck-uninit-after-item.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let bar; fn baz(_x: isize) { } diff --git a/src/test/ui/borrowck/borrowck-uninit-after-item.stderr b/src/test/ui/borrowck/borrowck-uninit-after-item.stderr index 17f9c0197ab..f658b64f11f 100644 --- a/src/test/ui/borrowck/borrowck-uninit-after-item.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-after-item.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `bar` - --> $DIR/borrowck-uninit-after-item.rs:14:9 + --> $DIR/borrowck-uninit-after-item.rs:4:9 | LL | baz(bar); //~ ERROR use of possibly uninitialized variable: `bar` | ^^^ use of possibly uninitialized `bar` diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr index 97eb83d0f14..bdec94b4f84 100644 --- a/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr @@ -1,11 +1,11 @@ error[E0381]: use of possibly uninitialized variable: `a` - --> $DIR/borrowck-uninit-field-access.rs:34:13 + --> $DIR/borrowck-uninit-field-access.rs:24:13 | LL | let _ = a.x + 1; //[ast]~ ERROR use of possibly uninitialized variable: `a.x` | ^^^ use of possibly uninitialized `a.x` error[E0382]: use of moved value: `line1.origin` - --> $DIR/borrowck-uninit-field-access.rs:39:13 + --> $DIR/borrowck-uninit-field-access.rs:29:13 | LL | let _moved = line1.origin; | ------------ value moved here @@ -15,7 +15,7 @@ LL | let _ = line1.origin.x + 1; //[ast]~ ERROR use of moved value: `line1.o = note: move occurs because `line1.origin` has type `Point`, which does not implement the `Copy` trait error[E0382]: use of moved value: `line2` - --> $DIR/borrowck-uninit-field-access.rs:44:5 + --> $DIR/borrowck-uninit-field-access.rs:34:5 | LL | let _moved = (line2.origin, line2.middle); | ------------ value moved here diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.ast.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.ast.stderr index 8536bf22de9..8c05272e5fb 100644 --- a/src/test/ui/borrowck/borrowck-uninit-field-access.ast.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-field-access.ast.stderr @@ -1,11 +1,11 @@ error[E0381]: use of possibly uninitialized variable: `a.x` - --> $DIR/borrowck-uninit-field-access.rs:34:13 + --> $DIR/borrowck-uninit-field-access.rs:24:13 | LL | let _ = a.x + 1; //[ast]~ ERROR use of possibly uninitialized variable: `a.x` | ^^^ use of possibly uninitialized `a.x` error[E0382]: use of moved value: `line1.origin.x` - --> $DIR/borrowck-uninit-field-access.rs:39:13 + --> $DIR/borrowck-uninit-field-access.rs:29:13 | LL | let _moved = line1.origin; | ------ value moved here @@ -15,7 +15,7 @@ LL | let _ = line1.origin.x + 1; //[ast]~ ERROR use of moved value: `line1.o = note: move occurs because `line1.origin` has type `Point`, which does not implement the `Copy` trait error[E0382]: use of partially moved value: `line2` - --> $DIR/borrowck-uninit-field-access.rs:44:5 + --> $DIR/borrowck-uninit-field-access.rs:34:5 | LL | let _moved = (line2.origin, line2.middle); | ------------ value moved here diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr index 97eb83d0f14..bdec94b4f84 100644 --- a/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr @@ -1,11 +1,11 @@ error[E0381]: use of possibly uninitialized variable: `a` - --> $DIR/borrowck-uninit-field-access.rs:34:13 + --> $DIR/borrowck-uninit-field-access.rs:24:13 | LL | let _ = a.x + 1; //[ast]~ ERROR use of possibly uninitialized variable: `a.x` | ^^^ use of possibly uninitialized `a.x` error[E0382]: use of moved value: `line1.origin` - --> $DIR/borrowck-uninit-field-access.rs:39:13 + --> $DIR/borrowck-uninit-field-access.rs:29:13 | LL | let _moved = line1.origin; | ------------ value moved here @@ -15,7 +15,7 @@ LL | let _ = line1.origin.x + 1; //[ast]~ ERROR use of moved value: `line1.o = note: move occurs because `line1.origin` has type `Point`, which does not implement the `Copy` trait error[E0382]: use of moved value: `line2` - --> $DIR/borrowck-uninit-field-access.rs:44:5 + --> $DIR/borrowck-uninit-field-access.rs:34:5 | LL | let _moved = (line2.origin, line2.middle); | ------------ value moved here diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.rs b/src/test/ui/borrowck/borrowck-uninit-field-access.rs index eec7df84c82..ab19b2d7735 100644 --- a/src/test/ui/borrowck/borrowck-uninit-field-access.rs +++ b/src/test/ui/borrowck/borrowck-uninit-field-access.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-uninit-in-assignop.rs b/src/test/ui/borrowck/borrowck-uninit-in-assignop.rs index e253ecc74b9..bfb0dd4301d 100644 --- a/src/test/ui/borrowck/borrowck-uninit-in-assignop.rs +++ b/src/test/ui/borrowck/borrowck-uninit-in-assignop.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that the use of uninitialized variable in assignment operator // expression is detected. diff --git a/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr b/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr index 7d905f64761..a685f0ecf3c 100644 --- a/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr @@ -1,59 +1,59 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-in-assignop.rs:16:5 + --> $DIR/borrowck-uninit-in-assignop.rs:6:5 | LL | x += 1; //~ ERROR use of possibly uninitialized variable: `x` | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-in-assignop.rs:19:5 + --> $DIR/borrowck-uninit-in-assignop.rs:9:5 | LL | x -= 1; //~ ERROR use of possibly uninitialized variable: `x` | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-in-assignop.rs:22:5 + --> $DIR/borrowck-uninit-in-assignop.rs:12:5 | LL | x *= 1; //~ ERROR use of possibly uninitialized variable: `x` | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-in-assignop.rs:25:5 + --> $DIR/borrowck-uninit-in-assignop.rs:15:5 | LL | x /= 1; //~ ERROR use of possibly uninitialized variable: `x` | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-in-assignop.rs:28:5 + --> $DIR/borrowck-uninit-in-assignop.rs:18:5 | LL | x %= 1; //~ ERROR use of possibly uninitialized variable: `x` | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-in-assignop.rs:31:5 + --> $DIR/borrowck-uninit-in-assignop.rs:21:5 | LL | x ^= 1; //~ ERROR use of possibly uninitialized variable: `x` | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-in-assignop.rs:34:5 + --> $DIR/borrowck-uninit-in-assignop.rs:24:5 | LL | x &= 1; //~ ERROR use of possibly uninitialized variable: `x` | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-in-assignop.rs:37:5 + --> $DIR/borrowck-uninit-in-assignop.rs:27:5 | LL | x |= 1; //~ ERROR use of possibly uninitialized variable: `x` | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-in-assignop.rs:40:5 + --> $DIR/borrowck-uninit-in-assignop.rs:30:5 | LL | x <<= 1; //~ ERROR use of possibly uninitialized variable: `x` | ^^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-in-assignop.rs:43:5 + --> $DIR/borrowck-uninit-in-assignop.rs:33:5 | LL | x >>= 1; //~ ERROR use of possibly uninitialized variable: `x` | ^^^^^^^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.nll.stderr b/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.nll.stderr index e9caf7d9e1e..7687176947a 100644 --- a/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.nll.stderr @@ -1,41 +1,41 @@ error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-ref-chain.rs:21:14 + --> $DIR/borrowck-uninit-ref-chain.rs:11:14 | LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381] | ^^^^ use of possibly uninitialized `**x` error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-ref-chain.rs:25:14 + --> $DIR/borrowck-uninit-ref-chain.rs:15:14 | LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381] | ^^^^ use of possibly uninitialized `**x` error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-ref-chain.rs:29:14 + --> $DIR/borrowck-uninit-ref-chain.rs:19:14 | LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381] | ^^^^ use of possibly uninitialized `**x` error[E0381]: assign to part of possibly uninitialized variable: `a` - --> $DIR/borrowck-uninit-ref-chain.rs:34:5 + --> $DIR/borrowck-uninit-ref-chain.rs:24:5 | LL | a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381] | ^^^^^^^ use of possibly uninitialized `a` error[E0381]: assign to part of possibly uninitialized variable: `a` - --> $DIR/borrowck-uninit-ref-chain.rs:39:5 + --> $DIR/borrowck-uninit-ref-chain.rs:29:5 | LL | a.x = &&0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381] | ^^^^^^^^^ use of possibly uninitialized `a` error[E0381]: assign to part of possibly uninitialized variable: `a` - --> $DIR/borrowck-uninit-ref-chain.rs:45:5 + --> $DIR/borrowck-uninit-ref-chain.rs:35:5 | LL | a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381] | ^^^^^^^ use of possibly uninitialized `a` error[E0381]: assign to part of possibly uninitialized variable: `a` - --> $DIR/borrowck-uninit-ref-chain.rs:50:5 + --> $DIR/borrowck-uninit-ref-chain.rs:40:5 | LL | a.x = &&0; //[mir]~ assign to part of possibly uninitialized variable: `a` [E0381] | ^^^^^^^^^ use of possibly uninitialized `a` diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.stderr b/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.stderr index 6b51414e5a2..e8ebf8c2dd0 100644 --- a/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.stderr @@ -1,41 +1,41 @@ error[E0381]: use of possibly uninitialized variable: `**x` - --> $DIR/borrowck-uninit-ref-chain.rs:21:15 + --> $DIR/borrowck-uninit-ref-chain.rs:11:15 | LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381] | ^^^ use of possibly uninitialized `**x` error[E0381]: use of possibly uninitialized variable: `**x` - --> $DIR/borrowck-uninit-ref-chain.rs:25:15 + --> $DIR/borrowck-uninit-ref-chain.rs:15:15 | LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381] | ^^^ use of possibly uninitialized `**x` error[E0381]: use of possibly uninitialized variable: `**x` - --> $DIR/borrowck-uninit-ref-chain.rs:29:15 + --> $DIR/borrowck-uninit-ref-chain.rs:19:15 | LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381] | ^^^ use of possibly uninitialized `**x` error[E0381]: use of possibly uninitialized variable: `a.x` - --> $DIR/borrowck-uninit-ref-chain.rs:35:15 + --> $DIR/borrowck-uninit-ref-chain.rs:25:15 | LL | let _b = &a.x; //[ast]~ ERROR use of possibly uninitialized variable: `a.x` [E0381] | ^^^ use of possibly uninitialized `a.x` error[E0381]: use of possibly uninitialized variable: `**a.x` - --> $DIR/borrowck-uninit-ref-chain.rs:40:15 + --> $DIR/borrowck-uninit-ref-chain.rs:30:15 | LL | let _b = &**a.x; //[ast]~ ERROR use of possibly uninitialized variable: `**a.x` [E0381] | ^^^^^ use of possibly uninitialized `**a.x` error[E0381]: use of possibly uninitialized variable: `a.y` - --> $DIR/borrowck-uninit-ref-chain.rs:46:15 + --> $DIR/borrowck-uninit-ref-chain.rs:36:15 | LL | let _b = &a.y; //[ast]~ ERROR use of possibly uninitialized variable: `a.y` [E0381] | ^^^ use of possibly uninitialized `a.y` error[E0381]: use of possibly uninitialized variable: `**a.y` - --> $DIR/borrowck-uninit-ref-chain.rs:51:15 + --> $DIR/borrowck-uninit-ref-chain.rs:41:15 | LL | let _b = &**a.y; //[ast]~ ERROR use of possibly uninitialized variable: `**a.y` [E0381] | ^^^^^ use of possibly uninitialized `**a.y` diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.mir.stderr b/src/test/ui/borrowck/borrowck-uninit-ref-chain.mir.stderr index e9caf7d9e1e..7687176947a 100644 --- a/src/test/ui/borrowck/borrowck-uninit-ref-chain.mir.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-ref-chain.mir.stderr @@ -1,41 +1,41 @@ error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-ref-chain.rs:21:14 + --> $DIR/borrowck-uninit-ref-chain.rs:11:14 | LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381] | ^^^^ use of possibly uninitialized `**x` error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-ref-chain.rs:25:14 + --> $DIR/borrowck-uninit-ref-chain.rs:15:14 | LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381] | ^^^^ use of possibly uninitialized `**x` error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit-ref-chain.rs:29:14 + --> $DIR/borrowck-uninit-ref-chain.rs:19:14 | LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381] | ^^^^ use of possibly uninitialized `**x` error[E0381]: assign to part of possibly uninitialized variable: `a` - --> $DIR/borrowck-uninit-ref-chain.rs:34:5 + --> $DIR/borrowck-uninit-ref-chain.rs:24:5 | LL | a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381] | ^^^^^^^ use of possibly uninitialized `a` error[E0381]: assign to part of possibly uninitialized variable: `a` - --> $DIR/borrowck-uninit-ref-chain.rs:39:5 + --> $DIR/borrowck-uninit-ref-chain.rs:29:5 | LL | a.x = &&0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381] | ^^^^^^^^^ use of possibly uninitialized `a` error[E0381]: assign to part of possibly uninitialized variable: `a` - --> $DIR/borrowck-uninit-ref-chain.rs:45:5 + --> $DIR/borrowck-uninit-ref-chain.rs:35:5 | LL | a.x = 0; //[mir]~ ERROR assign to part of possibly uninitialized variable: `a` [E0381] | ^^^^^^^ use of possibly uninitialized `a` error[E0381]: assign to part of possibly uninitialized variable: `a` - --> $DIR/borrowck-uninit-ref-chain.rs:50:5 + --> $DIR/borrowck-uninit-ref-chain.rs:40:5 | LL | a.x = &&0; //[mir]~ assign to part of possibly uninitialized variable: `a` [E0381] | ^^^^^^^^^ use of possibly uninitialized `a` diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.rs b/src/test/ui/borrowck/borrowck-uninit-ref-chain.rs index dc9d8405102..562012a23da 100644 --- a/src/test/ui/borrowck/borrowck-uninit-ref-chain.rs +++ b/src/test/ui/borrowck/borrowck-uninit-ref-chain.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-uninit.rs b/src/test/ui/borrowck/borrowck-uninit.rs index f4b73bc889f..71c1f596fa2 100644 --- a/src/test/ui/borrowck/borrowck-uninit.rs +++ b/src/test/ui/borrowck/borrowck-uninit.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(x: isize) { println!("{}", x); } fn main() { diff --git a/src/test/ui/borrowck/borrowck-uninit.stderr b/src/test/ui/borrowck/borrowck-uninit.stderr index ce78001dc64..5e3428e20b1 100644 --- a/src/test/ui/borrowck/borrowck-uninit.stderr +++ b/src/test/ui/borrowck/borrowck-uninit.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-uninit.rs:15:9 + --> $DIR/borrowck-uninit.rs:5:9 | LL | foo(x); //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr index eaba196f8ac..6bb6fc4cf29 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `u.c` because it was mutably borrowed - --> $DIR/borrowck-union-borrow-nested.rs:36:21 + --> $DIR/borrowck-union-borrow-nested.rs:24:21 | LL | let ra = &mut u.s.a; | ---------- borrow of `u.s.a` occurs here diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.rs b/src/test/ui/borrowck/borrowck-union-borrow-nested.rs index 0839d2430a9..b3a6670fa48 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow-nested.rs +++ b/src/test/ui/borrowck/borrowck-union-borrow-nested.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - #[derive(Clone, Copy)] struct S { a: u8, diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr b/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr index 8f90254469b..199a13352c4 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `u.c` because it was mutably borrowed - --> $DIR/borrowck-union-borrow-nested.rs:36:17 + --> $DIR/borrowck-union-borrow-nested.rs:24:17 | LL | let ra = &mut u.s.a; | ----- borrow of `u.s.a` occurs here diff --git a/src/test/ui/borrowck/borrowck-union-borrow.ast.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow.ast.nll.stderr deleted file mode 100644 index 781d693d565..00000000000 --- a/src/test/ui/borrowck/borrowck-union-borrow.ast.nll.stderr +++ /dev/null @@ -1,136 +0,0 @@ -error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-union-borrow.rs:37:23 - | -LL | let ra = &u.a; - | ---- immutable borrow occurs here -LL | let rma = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable - | ^^^^^^^^ mutable borrow occurs here -LL | //[mir]~^ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable -LL | drop(ra); - | -- immutable borrow later used here - -error[E0506]: cannot assign to `u.a` because it is borrowed - --> $DIR/borrowck-union-borrow.rs:43:13 - | -LL | let ra = &u.a; - | ---- borrow of `u.a` occurs here -LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed - | ^^^^^^^ assignment to borrowed `u.a` occurs here -LL | //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed -LL | drop(ra); - | -- borrow later used here - -error[E0502]: cannot borrow `u.b` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-union-borrow.rs:60:23 - | -LL | let ra = &u.a; - | ---- immutable borrow occurs here -LL | let rmb = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) - | ^^^^^^^^ mutable borrow occurs here -LL | //[mir]~^ ERROR cannot borrow `u.b` as mutable because it is also borrowed as immutable -LL | drop(ra); - | -- immutable borrow later used here - -error[E0506]: cannot assign to `u.b` because it is borrowed - --> $DIR/borrowck-union-borrow.rs:66:13 - | -LL | let ra = &u.a; - | ---- borrow of `u.b` occurs here -LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed - | ^^^^^^^ assignment to borrowed `u.b` occurs here -LL | //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed -LL | drop(ra); - | -- borrow later used here - -error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-union-borrow.rs:73:22 - | -LL | let rma = &mut u.a; - | -------- mutable borrow occurs here -LL | let ra = &u.a; //[ast]~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable - | ^^^^ immutable borrow occurs here -LL | //[mir]~^ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable -LL | drop(rma); - | --- mutable borrow later used here - -error[E0503]: cannot use `u.a` because it was mutably borrowed - --> $DIR/borrowck-union-borrow.rs:79:21 - | -LL | let ra = &mut u.a; - | -------- borrow of `u.a` occurs here -LL | let a = u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed - | ^^^ use of borrowed `u.a` -LL | //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed -LL | drop(ra); - | -- borrow later used here - -error[E0499]: cannot borrow `u.a` as mutable more than once at a time - --> $DIR/borrowck-union-borrow.rs:85:24 - | -LL | let rma = &mut u.a; - | -------- first mutable borrow occurs here -LL | let rma2 = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable more than once at a time - | ^^^^^^^^ second mutable borrow occurs here -LL | //[mir]~^ ERROR cannot borrow `u.a` as mutable more than once at a time -LL | drop(rma); - | --- first borrow later used here - -error[E0506]: cannot assign to `u.a` because it is borrowed - --> $DIR/borrowck-union-borrow.rs:91:13 - | -LL | let rma = &mut u.a; - | -------- borrow of `u.a` occurs here -LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed - | ^^^^^^^ assignment to borrowed `u.a` occurs here -LL | //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed -LL | drop(rma); - | --- borrow later used here - -error[E0502]: cannot borrow `u.b` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-union-borrow.rs:98:22 - | -LL | let rma = &mut u.a; - | -------- mutable borrow occurs here -LL | let rb = &u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) - | ^^^^ immutable borrow occurs here -LL | //[mir]~^ ERROR cannot borrow `u.b` as immutable because it is also borrowed as mutable -LL | drop(rma); - | --- mutable borrow later used here - -error[E0503]: cannot use `u.b` because it was mutably borrowed - --> $DIR/borrowck-union-borrow.rs:104:21 - | -LL | let ra = &mut u.a; - | -------- borrow of `u.a` occurs here -LL | let b = u.b; //[ast]~ ERROR cannot use `u.b` because it was mutably borrowed - | ^^^ use of borrowed `u.a` -... -LL | drop(ra); - | -- borrow later used here - -error[E0499]: cannot borrow `u.b` as mutable more than once at a time - --> $DIR/borrowck-union-borrow.rs:111:24 - | -LL | let rma = &mut u.a; - | -------- first mutable borrow occurs here -LL | let rmb2 = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time - | ^^^^^^^^ second mutable borrow occurs here -LL | //[mir]~^ ERROR cannot borrow `u.b` as mutable more than once at a time -LL | drop(rma); - | --- first borrow later used here - -error[E0506]: cannot assign to `u.b` because it is borrowed - --> $DIR/borrowck-union-borrow.rs:117:13 - | -LL | let rma = &mut u.a; - | -------- borrow of `u.b` occurs here -LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed - | ^^^^^^^ assignment to borrowed `u.b` occurs here -LL | //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed -LL | drop(rma); - | --- borrow later used here - -error: aborting due to 12 previous errors - -Some errors occurred: E0499, E0502, E0503, E0506. -For more information about an error, try `rustc --explain E0499`. diff --git a/src/test/ui/borrowck/borrowck-union-borrow.ast.stderr b/src/test/ui/borrowck/borrowck-union-borrow.ast.stderr deleted file mode 100644 index 9a020705792..00000000000 --- a/src/test/ui/borrowck/borrowck-union-borrow.ast.stderr +++ /dev/null @@ -1,118 +0,0 @@ -error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-union-borrow.rs:37:28 - | -LL | let ra = &u.a; - | --- immutable borrow occurs here -LL | let rma = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable - | ^^^ mutable borrow occurs here -... -LL | } - | - immutable borrow ends here - -error[E0506]: cannot assign to `u.a` because it is borrowed - --> $DIR/borrowck-union-borrow.rs:43:13 - | -LL | let ra = &u.a; - | --- borrow of `u.a` occurs here -LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed - | ^^^^^^^ assignment to borrowed `u.a` occurs here - -error[E0502]: cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) - --> $DIR/borrowck-union-borrow.rs:60:28 - | -LL | let ra = &u.a; - | --- immutable borrow occurs here (via `u.a`) -LL | let rmb = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) - | ^^^ mutable borrow occurs here (via `u.b`) -... -LL | } - | - immutable borrow ends here - -error[E0506]: cannot assign to `u.b` because it is borrowed - --> $DIR/borrowck-union-borrow.rs:66:13 - | -LL | let ra = &u.a; - | --- borrow of `u.b` occurs here -LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed - | ^^^^^^^ assignment to borrowed `u.b` occurs here - -error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-union-borrow.rs:73:23 - | -LL | let rma = &mut u.a; - | --- mutable borrow occurs here -LL | let ra = &u.a; //[ast]~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable - | ^^^ immutable borrow occurs here -... -LL | } - | - mutable borrow ends here - -error[E0503]: cannot use `u.a` because it was mutably borrowed - --> $DIR/borrowck-union-borrow.rs:79:17 - | -LL | let ra = &mut u.a; - | --- borrow of `u.a` occurs here -LL | let a = u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed - | ^ use of borrowed `u.a` - -error[E0499]: cannot borrow `u.a` as mutable more than once at a time - --> $DIR/borrowck-union-borrow.rs:85:29 - | -LL | let rma = &mut u.a; - | --- first mutable borrow occurs here -LL | let rma2 = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable more than once at a time - | ^^^ second mutable borrow occurs here -... -LL | } - | - first borrow ends here - -error[E0506]: cannot assign to `u.a` because it is borrowed - --> $DIR/borrowck-union-borrow.rs:91:13 - | -LL | let rma = &mut u.a; - | --- borrow of `u.a` occurs here -LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed - | ^^^^^^^ assignment to borrowed `u.a` occurs here - -error[E0502]: cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) - --> $DIR/borrowck-union-borrow.rs:98:23 - | -LL | let rma = &mut u.a; - | --- mutable borrow occurs here (via `u.a`) -LL | let rb = &u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) - | ^^^ immutable borrow occurs here (via `u.b`) -... -LL | } - | - mutable borrow ends here - -error[E0503]: cannot use `u.b` because it was mutably borrowed - --> $DIR/borrowck-union-borrow.rs:104:17 - | -LL | let ra = &mut u.a; - | --- borrow of `u.a` occurs here -LL | let b = u.b; //[ast]~ ERROR cannot use `u.b` because it was mutably borrowed - | ^ use of borrowed `u.a` - -error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time - --> $DIR/borrowck-union-borrow.rs:111:29 - | -LL | let rma = &mut u.a; - | --- first mutable borrow occurs here (via `u.a`) -LL | let rmb2 = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time - | ^^^ second mutable borrow occurs here (via `u.b`) -... -LL | } - | - first borrow ends here - -error[E0506]: cannot assign to `u.b` because it is borrowed - --> $DIR/borrowck-union-borrow.rs:117:13 - | -LL | let rma = &mut u.a; - | --- borrow of `u.b` occurs here -LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed - | ^^^^^^^ assignment to borrowed `u.b` occurs here - -error: aborting due to 12 previous errors - -Some errors occurred: E0499, E0502, E0503, E0506. -For more information about an error, try `rustc --explain E0499`. diff --git a/src/test/ui/borrowck/borrowck-union-borrow.mir.stderr b/src/test/ui/borrowck/borrowck-union-borrow.mir.stderr index 781d693d565..1a2433c8f6a 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow.mir.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow.mir.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-union-borrow.rs:37:23 + --> $DIR/borrowck-union-borrow.rs:27:23 | LL | let ra = &u.a; | ---- immutable borrow occurs here @@ -10,7 +10,7 @@ LL | drop(ra); | -- immutable borrow later used here error[E0506]: cannot assign to `u.a` because it is borrowed - --> $DIR/borrowck-union-borrow.rs:43:13 + --> $DIR/borrowck-union-borrow.rs:33:13 | LL | let ra = &u.a; | ---- borrow of `u.a` occurs here @@ -21,7 +21,7 @@ LL | drop(ra); | -- borrow later used here error[E0502]: cannot borrow `u.b` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-union-borrow.rs:60:23 + --> $DIR/borrowck-union-borrow.rs:50:23 | LL | let ra = &u.a; | ---- immutable borrow occurs here @@ -32,7 +32,7 @@ LL | drop(ra); | -- immutable borrow later used here error[E0506]: cannot assign to `u.b` because it is borrowed - --> $DIR/borrowck-union-borrow.rs:66:13 + --> $DIR/borrowck-union-borrow.rs:56:13 | LL | let ra = &u.a; | ---- borrow of `u.b` occurs here @@ -43,7 +43,7 @@ LL | drop(ra); | -- borrow later used here error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-union-borrow.rs:73:22 + --> $DIR/borrowck-union-borrow.rs:63:22 | LL | let rma = &mut u.a; | -------- mutable borrow occurs here @@ -54,7 +54,7 @@ LL | drop(rma); | --- mutable borrow later used here error[E0503]: cannot use `u.a` because it was mutably borrowed - --> $DIR/borrowck-union-borrow.rs:79:21 + --> $DIR/borrowck-union-borrow.rs:69:21 | LL | let ra = &mut u.a; | -------- borrow of `u.a` occurs here @@ -65,7 +65,7 @@ LL | drop(ra); | -- borrow later used here error[E0499]: cannot borrow `u.a` as mutable more than once at a time - --> $DIR/borrowck-union-borrow.rs:85:24 + --> $DIR/borrowck-union-borrow.rs:75:24 | LL | let rma = &mut u.a; | -------- first mutable borrow occurs here @@ -76,7 +76,7 @@ LL | drop(rma); | --- first borrow later used here error[E0506]: cannot assign to `u.a` because it is borrowed - --> $DIR/borrowck-union-borrow.rs:91:13 + --> $DIR/borrowck-union-borrow.rs:81:13 | LL | let rma = &mut u.a; | -------- borrow of `u.a` occurs here @@ -87,7 +87,7 @@ LL | drop(rma); | --- borrow later used here error[E0502]: cannot borrow `u.b` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-union-borrow.rs:98:22 + --> $DIR/borrowck-union-borrow.rs:88:22 | LL | let rma = &mut u.a; | -------- mutable borrow occurs here @@ -98,7 +98,7 @@ LL | drop(rma); | --- mutable borrow later used here error[E0503]: cannot use `u.b` because it was mutably borrowed - --> $DIR/borrowck-union-borrow.rs:104:21 + --> $DIR/borrowck-union-borrow.rs:94:21 | LL | let ra = &mut u.a; | -------- borrow of `u.a` occurs here @@ -109,7 +109,7 @@ LL | drop(ra); | -- borrow later used here error[E0499]: cannot borrow `u.b` as mutable more than once at a time - --> $DIR/borrowck-union-borrow.rs:111:24 + --> $DIR/borrowck-union-borrow.rs:101:24 | LL | let rma = &mut u.a; | -------- first mutable borrow occurs here @@ -120,7 +120,7 @@ LL | drop(rma); | --- first borrow later used here error[E0506]: cannot assign to `u.b` because it is borrowed - --> $DIR/borrowck-union-borrow.rs:117:13 + --> $DIR/borrowck-union-borrow.rs:107:13 | LL | let rma = &mut u.a; | -------- borrow of `u.b` occurs here diff --git a/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr new file mode 100644 index 00000000000..5cba30b43b8 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr @@ -0,0 +1,131 @@ +error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable + --> $DIR/borrowck-union-borrow.rs:25:23 + | +LL | let ra = &u.a; + | ---- immutable borrow occurs here +LL | let rma = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable + | ^^^^^^^^ mutable borrow occurs here +LL | drop(ra); + | -- immutable borrow later used here + +error[E0506]: cannot assign to `u.a` because it is borrowed + --> $DIR/borrowck-union-borrow.rs:30:13 + | +LL | let ra = &u.a; + | ---- borrow of `u.a` occurs here +LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed + | ^^^^^^^ assignment to borrowed `u.a` occurs here +LL | drop(ra); + | -- borrow later used here + +error[E0502]: cannot borrow `u` (via `u.b`) as mutable because it is also borrowed as immutable (via `u.a`) + --> $DIR/borrowck-union-borrow.rs:46:23 + | +LL | let ra = &u.a; + | ---- immutable borrow occurs here (via `u.a`) +LL | let rmb = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) + | ^^^^^^^^ mutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here +LL | drop(ra); + | -- immutable borrow later used here + | + = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a` + +error[E0506]: cannot assign to `u.b` because it is borrowed + --> $DIR/borrowck-union-borrow.rs:51:13 + | +LL | let ra = &u.a; + | ---- borrow of `u.b` occurs here +LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed + | ^^^^^^^ assignment to borrowed `u.b` occurs here +LL | drop(ra); + | -- borrow later used here + +error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable + --> $DIR/borrowck-union-borrow.rs:57:22 + | +LL | let rma = &mut u.a; + | -------- mutable borrow occurs here +LL | let ra = &u.a; //~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable + | ^^^^ immutable borrow occurs here +LL | drop(rma); + | --- mutable borrow later used here + +error[E0503]: cannot use `u.a` because it was mutably borrowed + --> $DIR/borrowck-union-borrow.rs:62:21 + | +LL | let ra = &mut u.a; + | -------- borrow of `u.a` occurs here +LL | let a = u.a; //~ ERROR cannot use `u.a` because it was mutably borrowed + | ^^^ use of borrowed `u.a` +LL | drop(ra); + | -- borrow later used here + +error[E0499]: cannot borrow `u.a` as mutable more than once at a time + --> $DIR/borrowck-union-borrow.rs:67:24 + | +LL | let rma = &mut u.a; + | -------- first mutable borrow occurs here +LL | let rma2 = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable more than once at a time + | ^^^^^^^^ second mutable borrow occurs here +LL | drop(rma); + | --- first borrow later used here + +error[E0506]: cannot assign to `u.a` because it is borrowed + --> $DIR/borrowck-union-borrow.rs:72:13 + | +LL | let rma = &mut u.a; + | -------- borrow of `u.a` occurs here +LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed + | ^^^^^^^ assignment to borrowed `u.a` occurs here +LL | drop(rma); + | --- borrow later used here + +error[E0502]: cannot borrow `u` (via `u.b`) as immutable because it is also borrowed as mutable (via `u.a`) + --> $DIR/borrowck-union-borrow.rs:78:22 + | +LL | let rma = &mut u.a; + | -------- mutable borrow occurs here (via `u.a`) +LL | let rb = &u.b; //~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) + | ^^^^ immutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here +LL | drop(rma); + | --- mutable borrow later used here + | + = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a` + +error[E0503]: cannot use `u.b` because it was mutably borrowed + --> $DIR/borrowck-union-borrow.rs:83:21 + | +LL | let ra = &mut u.a; + | -------- borrow of `u.a` occurs here +LL | let b = u.b; //~ ERROR cannot use `u.b` because it was mutably borrowed + | ^^^ use of borrowed `u.a` +LL | +LL | drop(ra); + | -- borrow later used here + +error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time + --> $DIR/borrowck-union-borrow.rs:89:24 + | +LL | let rma = &mut u.a; + | -------- first mutable borrow occurs here (via `u.a`) +LL | let rmb2 = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time + | ^^^^^^^^ second mutable borrow occurs here (via `u.b`) +LL | drop(rma); + | --- first borrow later used here + | + = note: `u.b` is a field of the union `U`, so it overlaps the field `u.a` + +error[E0506]: cannot assign to `u.b` because it is borrowed + --> $DIR/borrowck-union-borrow.rs:94:13 + | +LL | let rma = &mut u.a; + | -------- borrow of `u.b` occurs here +LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed + | ^^^^^^^ assignment to borrowed `u.b` occurs here +LL | drop(rma); + | --- borrow later used here + +error: aborting due to 12 previous errors + +Some errors occurred: E0499, E0502, E0503, E0506. +For more information about an error, try `rustc --explain E0499`. diff --git a/src/test/ui/borrowck/borrowck-union-borrow.rs b/src/test/ui/borrowck/borrowck-union-borrow.rs index 97193bd0191..8afc0be8b55 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow.rs +++ b/src/test/ui/borrowck/borrowck-union-borrow.rs @@ -1,16 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength -// revisions: ast mir -//[mir]compile-flags: -Z borrowck=mir #[derive(Clone, Copy)] union U { @@ -34,14 +22,12 @@ fn main() { } { let ra = &u.a; - let rma = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable - //[mir]~^ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable + let rma = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable drop(ra); } { let ra = &u.a; - u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed - //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed + u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed drop(ra); } // Imm borrow, other field @@ -57,65 +43,55 @@ fn main() { } { let ra = &u.a; - let rmb = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) - //[mir]~^ ERROR cannot borrow `u.b` as mutable because it is also borrowed as immutable + let rmb = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) drop(ra); } { let ra = &u.a; - u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed - //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed + u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed drop(ra); } // Mut borrow, same field { let rma = &mut u.a; - let ra = &u.a; //[ast]~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable - //[mir]~^ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable + let ra = &u.a; //~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable drop(rma); } { let ra = &mut u.a; - let a = u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed - //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed + let a = u.a; //~ ERROR cannot use `u.a` because it was mutably borrowed drop(ra); } { let rma = &mut u.a; - let rma2 = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable more than once at a time - //[mir]~^ ERROR cannot borrow `u.a` as mutable more than once at a time + let rma2 = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable more than once at a time drop(rma); } { let rma = &mut u.a; - u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed - //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed + u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed drop(rma); } // Mut borrow, other field { let rma = &mut u.a; - let rb = &u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) - //[mir]~^ ERROR cannot borrow `u.b` as immutable because it is also borrowed as mutable + let rb = &u.b; //~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) drop(rma); } { let ra = &mut u.a; - let b = u.b; //[ast]~ ERROR cannot use `u.b` because it was mutably borrowed - //[mir]~^ ERROR cannot use `u.b` because it was mutably borrowed + let b = u.b; //~ ERROR cannot use `u.b` because it was mutably borrowed drop(ra); } { let rma = &mut u.a; - let rmb2 = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time - //[mir]~^ ERROR cannot borrow `u.b` as mutable more than once at a time + let rmb2 = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time drop(rma); } { let rma = &mut u.a; - u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed - //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed + u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed drop(rma); } } diff --git a/src/test/ui/borrowck/borrowck-union-borrow.stderr b/src/test/ui/borrowck/borrowck-union-borrow.stderr new file mode 100644 index 00000000000..ef6a331eda0 --- /dev/null +++ b/src/test/ui/borrowck/borrowck-union-borrow.stderr @@ -0,0 +1,118 @@ +error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable + --> $DIR/borrowck-union-borrow.rs:25:28 + | +LL | let ra = &u.a; + | --- immutable borrow occurs here +LL | let rma = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable + | ^^^ mutable borrow occurs here +LL | drop(ra); +LL | } + | - immutable borrow ends here + +error[E0506]: cannot assign to `u.a` because it is borrowed + --> $DIR/borrowck-union-borrow.rs:30:13 + | +LL | let ra = &u.a; + | --- borrow of `u.a` occurs here +LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed + | ^^^^^^^ assignment to borrowed `u.a` occurs here + +error[E0502]: cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) + --> $DIR/borrowck-union-borrow.rs:46:28 + | +LL | let ra = &u.a; + | --- immutable borrow occurs here (via `u.a`) +LL | let rmb = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) + | ^^^ mutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here +LL | drop(ra); +LL | } + | - immutable borrow ends here + +error[E0506]: cannot assign to `u.b` because it is borrowed + --> $DIR/borrowck-union-borrow.rs:51:13 + | +LL | let ra = &u.a; + | --- borrow of `u.b` occurs here +LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed + | ^^^^^^^ assignment to borrowed `u.b` occurs here + +error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable + --> $DIR/borrowck-union-borrow.rs:57:23 + | +LL | let rma = &mut u.a; + | --- mutable borrow occurs here +LL | let ra = &u.a; //~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable + | ^^^ immutable borrow occurs here +LL | drop(rma); +LL | } + | - mutable borrow ends here + +error[E0503]: cannot use `u.a` because it was mutably borrowed + --> $DIR/borrowck-union-borrow.rs:62:17 + | +LL | let ra = &mut u.a; + | --- borrow of `u.a` occurs here +LL | let a = u.a; //~ ERROR cannot use `u.a` because it was mutably borrowed + | ^ use of borrowed `u.a` + +error[E0499]: cannot borrow `u.a` as mutable more than once at a time + --> $DIR/borrowck-union-borrow.rs:67:29 + | +LL | let rma = &mut u.a; + | --- first mutable borrow occurs here +LL | let rma2 = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable more than once at a time + | ^^^ second mutable borrow occurs here +LL | drop(rma); +LL | } + | - first borrow ends here + +error[E0506]: cannot assign to `u.a` because it is borrowed + --> $DIR/borrowck-union-borrow.rs:72:13 + | +LL | let rma = &mut u.a; + | --- borrow of `u.a` occurs here +LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed + | ^^^^^^^ assignment to borrowed `u.a` occurs here + +error[E0502]: cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) + --> $DIR/borrowck-union-borrow.rs:78:23 + | +LL | let rma = &mut u.a; + | --- mutable borrow occurs here (via `u.a`) +LL | let rb = &u.b; //~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) + | ^^^ immutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here +LL | drop(rma); +LL | } + | - mutable borrow ends here + +error[E0503]: cannot use `u.b` because it was mutably borrowed + --> $DIR/borrowck-union-borrow.rs:83:17 + | +LL | let ra = &mut u.a; + | --- borrow of `u.a` occurs here +LL | let b = u.b; //~ ERROR cannot use `u.b` because it was mutably borrowed + | ^ use of borrowed `u.a` + +error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time + --> $DIR/borrowck-union-borrow.rs:89:29 + | +LL | let rma = &mut u.a; + | --- first mutable borrow occurs here (via `u.a`) +LL | let rmb2 = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time + | ^^^ second mutable borrow occurs here (via `u.b`) +LL | drop(rma); +LL | } + | - first borrow ends here + +error[E0506]: cannot assign to `u.b` because it is borrowed + --> $DIR/borrowck-union-borrow.rs:94:13 + | +LL | let rma = &mut u.a; + | --- borrow of `u.b` occurs here +LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed + | ^^^^^^^ assignment to borrowed `u.b` occurs here + +error: aborting due to 12 previous errors + +Some errors occurred: E0499, E0502, E0503, E0506. +For more information about an error, try `rustc --explain E0499`. diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr b/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr index a7125450e1c..e59fef2dc0d 100644 --- a/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: use of moved value: `u` - --> $DIR/borrowck-union-move-assign.rs:27:21 + --> $DIR/borrowck-union-move-assign.rs:17:21 | +LL | let mut u = U { a: A }; + | ----- move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = u.a; | --- value moved here LL | let a = u.a; //~ ERROR use of moved value: `u.a` | ^^^ value used here after move - | - = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.rs b/src/test/ui/borrowck/borrowck-union-move-assign.rs index d4d7bc6b0f7..1bb43252036 100644 --- a/src/test/ui/borrowck/borrowck-union-move-assign.rs +++ b/src/test/ui/borrowck/borrowck-union-move-assign.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(untagged_unions)] // Non-copy diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.stderr b/src/test/ui/borrowck/borrowck-union-move-assign.stderr index b0924d28c9c..f304dc3a124 100644 --- a/src/test/ui/borrowck/borrowck-union-move-assign.stderr +++ b/src/test/ui/borrowck/borrowck-union-move-assign.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `u.a` - --> $DIR/borrowck-union-move-assign.rs:27:17 + --> $DIR/borrowck-union-move-assign.rs:17:17 | LL | let a = u.a; | - value moved here diff --git a/src/test/ui/borrowck/borrowck-union-move.nll.stderr b/src/test/ui/borrowck/borrowck-union-move.nll.stderr index 8597117dbcc..1392a7931c3 100644 --- a/src/test/ui/borrowck/borrowck-union-move.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-move.nll.stderr @@ -1,62 +1,62 @@ error[E0382]: use of moved value: `u` - --> $DIR/borrowck-union-move.rs:36:21 + --> $DIR/borrowck-union-move.rs:26:21 | +LL | let mut u = Unn { n1: NonCopy }; + | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait LL | let a = u.n1; | ---- value moved here LL | let a = u.n1; //~ ERROR use of moved value: `u.n1` | ^^^^ value used here after move - | - = note: move occurs because `u` has type `Unn`, which does not implement the `Copy` trait error[E0382]: use of moved value: `u` - --> $DIR/borrowck-union-move.rs:41:21 + --> $DIR/borrowck-union-move.rs:31:21 | +LL | let mut u = Unn { n1: NonCopy }; + | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait LL | let a = u.n1; | ---- value moved here LL | let a = u; //~ ERROR use of partially moved value: `u` | ^ value used here after move - | - = note: move occurs because `u` has type `Unn`, which does not implement the `Copy` trait error[E0382]: use of moved value: `u` - --> $DIR/borrowck-union-move.rs:46:21 + --> $DIR/borrowck-union-move.rs:36:21 | +LL | let mut u = Unn { n1: NonCopy }; + | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait LL | let a = u.n1; | ---- value moved here LL | let a = u.n2; //~ ERROR use of moved value: `u.n2` | ^^^^ value used here after move - | - = note: move occurs because `u` has type `Unn`, which does not implement the `Copy` trait error[E0382]: use of moved value: `u` - --> $DIR/borrowck-union-move.rs:73:21 + --> $DIR/borrowck-union-move.rs:63:21 | +LL | let mut u = Ucn { c: Copy }; + | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait LL | let a = u.n; | --- value moved here LL | let a = u.n; //~ ERROR use of moved value: `u.n` | ^^^ value used here after move - | - = note: move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait error[E0382]: use of moved value: `u` - --> $DIR/borrowck-union-move.rs:78:21 + --> $DIR/borrowck-union-move.rs:68:21 | +LL | let mut u = Ucn { c: Copy }; + | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait LL | let a = u.n; | --- value moved here LL | let a = u.c; //~ ERROR use of moved value: `u.c` | ^^^ value used here after move - | - = note: move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait error[E0382]: use of moved value: `u` - --> $DIR/borrowck-union-move.rs:93:21 + --> $DIR/borrowck-union-move.rs:83:21 | +LL | let mut u = Ucn { c: Copy }; + | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait LL | let a = u.n; | --- value moved here LL | let a = u; //~ ERROR use of partially moved value: `u` | ^ value used here after move - | - = note: move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait error: aborting due to 6 previous errors diff --git a/src/test/ui/borrowck/borrowck-union-move.rs b/src/test/ui/borrowck/borrowck-union-move.rs index 5320244cf43..e2480604f29 100644 --- a/src/test/ui/borrowck/borrowck-union-move.rs +++ b/src/test/ui/borrowck/borrowck-union-move.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(untagged_unions)] #[derive(Clone, Copy)] diff --git a/src/test/ui/borrowck/borrowck-union-move.stderr b/src/test/ui/borrowck/borrowck-union-move.stderr index d3e441bbbf4..ebd8bdc69c0 100644 --- a/src/test/ui/borrowck/borrowck-union-move.stderr +++ b/src/test/ui/borrowck/borrowck-union-move.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `u.n1` - --> $DIR/borrowck-union-move.rs:36:17 + --> $DIR/borrowck-union-move.rs:26:17 | LL | let a = u.n1; | - value moved here @@ -9,7 +9,7 @@ LL | let a = u.n1; //~ ERROR use of moved value: `u.n1` = note: move occurs because `u.n1` has type `NonCopy`, which does not implement the `Copy` trait error[E0382]: use of partially moved value: `u` - --> $DIR/borrowck-union-move.rs:41:17 + --> $DIR/borrowck-union-move.rs:31:17 | LL | let a = u.n1; | - value moved here @@ -19,7 +19,7 @@ LL | let a = u; //~ ERROR use of partially moved value: `u` = note: move occurs because `u.n2` has type `[type error]`, which does not implement the `Copy` trait error[E0382]: use of moved value: `u.n2` - --> $DIR/borrowck-union-move.rs:46:17 + --> $DIR/borrowck-union-move.rs:36:17 | LL | let a = u.n1; | - value moved here @@ -29,7 +29,7 @@ LL | let a = u.n2; //~ ERROR use of moved value: `u.n2` = note: move occurs because `u.n2` has type `[type error]`, which does not implement the `Copy` trait error[E0382]: use of moved value: `u.n` - --> $DIR/borrowck-union-move.rs:73:17 + --> $DIR/borrowck-union-move.rs:63:17 | LL | let a = u.n; | - value moved here @@ -39,7 +39,7 @@ LL | let a = u.n; //~ ERROR use of moved value: `u.n` = note: move occurs because `u.n` has type `NonCopy`, which does not implement the `Copy` trait error[E0382]: use of moved value: `u.c` - --> $DIR/borrowck-union-move.rs:78:17 + --> $DIR/borrowck-union-move.rs:68:17 | LL | let a = u.n; | - value moved here @@ -49,7 +49,7 @@ LL | let a = u.c; //~ ERROR use of moved value: `u.c` = note: move occurs because `u.c` has type `[type error]`, which does not implement the `Copy` trait error[E0382]: use of partially moved value: `u` - --> $DIR/borrowck-union-move.rs:93:17 + --> $DIR/borrowck-union-move.rs:83:17 | LL | let a = u.n; | - value moved here diff --git a/src/test/ui/borrowck/borrowck-union-uninitialized.nll.stderr b/src/test/ui/borrowck/borrowck-union-uninitialized.nll.stderr index 94a7a4866e6..06c884e2446 100644 --- a/src/test/ui/borrowck/borrowck-union-uninitialized.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-uninitialized.nll.stderr @@ -1,11 +1,11 @@ error[E0381]: assign to part of possibly uninitialized variable: `s` - --> $DIR/borrowck-union-uninitialized.rs:23:9 + --> $DIR/borrowck-union-uninitialized.rs:13:9 | LL | s.a = 0; | ^^^^^^^ use of possibly uninitialized `s` error[E0381]: assign to part of possibly uninitialized variable: `u` - --> $DIR/borrowck-union-uninitialized.rs:24:9 + --> $DIR/borrowck-union-uninitialized.rs:14:9 | LL | u.a = 0; | ^^^^^^^ use of possibly uninitialized `u` diff --git a/src/test/ui/borrowck/borrowck-union-uninitialized.rs b/src/test/ui/borrowck/borrowck-union-uninitialized.rs index 81376a1a169..e7d456ea746 100644 --- a/src/test/ui/borrowck/borrowck-union-uninitialized.rs +++ b/src/test/ui/borrowck/borrowck-union-uninitialized.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S { a: u8, } diff --git a/src/test/ui/borrowck/borrowck-union-uninitialized.stderr b/src/test/ui/borrowck/borrowck-union-uninitialized.stderr index 901d1ecc506..c8b22dd1c9e 100644 --- a/src/test/ui/borrowck/borrowck-union-uninitialized.stderr +++ b/src/test/ui/borrowck/borrowck-union-uninitialized.stderr @@ -1,11 +1,11 @@ error[E0381]: use of possibly uninitialized variable: `s.a` - --> $DIR/borrowck-union-uninitialized.rs:25:13 + --> $DIR/borrowck-union-uninitialized.rs:15:13 | LL | let sa = s.a; //~ ERROR use of possibly uninitialized variable: `s.a` | ^^ use of possibly uninitialized `s.a` error[E0381]: use of possibly uninitialized variable: `u.a` - --> $DIR/borrowck-union-uninitialized.rs:26:13 + --> $DIR/borrowck-union-uninitialized.rs:16:13 | LL | let ua = u.a; //~ ERROR use of possibly uninitialized variable: `u.a` | ^^ use of possibly uninitialized `u.a` diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr b/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr index 29e079ee333..7ca277ac074 100644 --- a/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr +++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-uniq-via-lend.rs:46:12 + --> $DIR/borrowck-uniq-via-lend.rs:36:12 | LL | let w = &mut v; | ------ mutable borrow occurs here @@ -9,7 +9,7 @@ LL | w.use_mut(); | - mutable borrow later used here error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable - --> $DIR/borrowck-uniq-via-lend.rs:63:12 + --> $DIR/borrowck-uniq-via-lend.rs:53:12 | LL | x = &mut v; | ------ mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.rs b/src/test/ui/borrowck/borrowck-uniq-via-lend.rs index 6fbadc9be25..f62880788ed 100644 --- a/src/test/ui/borrowck/borrowck-uniq-via-lend.rs +++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr b/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr index 00b43440183..14a9551acc6 100644 --- a/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr +++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable - --> $DIR/borrowck-uniq-via-lend.rs:46:13 + --> $DIR/borrowck-uniq-via-lend.rs:36:13 | LL | let w = &mut v; | - mutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - mutable borrow ends here error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable - --> $DIR/borrowck-uniq-via-lend.rs:63:13 + --> $DIR/borrowck-uniq-via-lend.rs:53:13 | LL | x = &mut v; | - mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.nll.stderr b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.nll.stderr index 502978f25be..181912320e5 100644 --- a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.nll.stderr @@ -1,11 +1,11 @@ error[E0381]: use of possibly uninitialized variable: `w` - --> $DIR/borrowck-use-in-index-lvalue.rs:16:5 + --> $DIR/borrowck-use-in-index-lvalue.rs:6:5 | LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381] | ^^^^ use of possibly uninitialized `*w` error[E0381]: use of possibly uninitialized variable: `w` - --> $DIR/borrowck-use-in-index-lvalue.rs:20:5 + --> $DIR/borrowck-use-in-index-lvalue.rs:10:5 | LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381] | ^^^^ use of possibly uninitialized `*w` diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.stderr b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.stderr index 3a33081dfcd..abe51578829 100644 --- a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.stderr +++ b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.stderr @@ -1,11 +1,11 @@ error[E0381]: use of possibly uninitialized variable: `*w` - --> $DIR/borrowck-use-in-index-lvalue.rs:16:5 + --> $DIR/borrowck-use-in-index-lvalue.rs:6:5 | LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381] | ^^^^^^^^ use of possibly uninitialized `*w` error[E0381]: use of possibly uninitialized variable: `*w` - --> $DIR/borrowck-use-in-index-lvalue.rs:20:5 + --> $DIR/borrowck-use-in-index-lvalue.rs:10:5 | LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381] | ^^^^^^^^ use of possibly uninitialized `*w` diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.mir.stderr b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.mir.stderr index 502978f25be..181912320e5 100644 --- a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.mir.stderr +++ b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.mir.stderr @@ -1,11 +1,11 @@ error[E0381]: use of possibly uninitialized variable: `w` - --> $DIR/borrowck-use-in-index-lvalue.rs:16:5 + --> $DIR/borrowck-use-in-index-lvalue.rs:6:5 | LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381] | ^^^^ use of possibly uninitialized `*w` error[E0381]: use of possibly uninitialized variable: `w` - --> $DIR/borrowck-use-in-index-lvalue.rs:20:5 + --> $DIR/borrowck-use-in-index-lvalue.rs:10:5 | LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381] | ^^^^ use of possibly uninitialized `*w` diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.rs b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.rs index eb99f78f461..f953dec444a 100644 --- a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.rs +++ b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr b/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr index 2289dd688cf..e7b972fb014 100644 --- a/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr +++ b/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:21:10 + --> $DIR/borrowck-use-mut-borrow.rs:11:10 | LL | let p = &mut x; | ------ borrow of `x` occurs here @@ -9,7 +9,7 @@ LL | *p = 2; | ------ borrow later used here error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:28:10 + --> $DIR/borrowck-use-mut-borrow.rs:18:10 | LL | let p = &mut x.a; | -------- borrow of `x.a` occurs here @@ -19,7 +19,7 @@ LL | *p = 3; | ------ borrow later used here error[E0503]: cannot use `x.a` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:35:10 + --> $DIR/borrowck-use-mut-borrow.rs:25:10 | LL | let p = &mut x; | ------ borrow of `x` occurs here @@ -29,7 +29,7 @@ LL | p.a = 3; | ------- borrow later used here error[E0503]: cannot use `x.a` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:42:10 + --> $DIR/borrowck-use-mut-borrow.rs:32:10 | LL | let p = &mut x.a; | -------- borrow of `x.a` occurs here @@ -39,7 +39,7 @@ LL | *p = 3; | ------ borrow later used here error[E0503]: cannot use `x.a` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:49:13 + --> $DIR/borrowck-use-mut-borrow.rs:39:13 | LL | let p = &mut x; | ------ borrow of `x` occurs here @@ -50,7 +50,7 @@ LL | p.a = 4; | ------- borrow later used here error[E0503]: cannot use `x.a` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:57:13 + --> $DIR/borrowck-use-mut-borrow.rs:47:13 | LL | let p = &mut x.a; | -------- borrow of `x.a` occurs here @@ -61,7 +61,7 @@ LL | *p = 4; | ------ borrow later used here error[E0503]: cannot use `*x` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:65:10 + --> $DIR/borrowck-use-mut-borrow.rs:55:10 | LL | let p = &mut x; | ------ borrow of `x` occurs here @@ -71,7 +71,7 @@ LL | **p = 2; | ------- borrow later used here error[E0503]: cannot use `*x.b` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:72:10 + --> $DIR/borrowck-use-mut-borrow.rs:62:10 | LL | let p = &mut x; | ------ borrow of `x` occurs here @@ -81,7 +81,7 @@ LL | p.a = 3; | ------- borrow later used here error[E0503]: cannot use `*x.b` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:79:10 + --> $DIR/borrowck-use-mut-borrow.rs:69:10 | LL | let p = &mut x.b; | -------- borrow of `x.b` occurs here diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.rs b/src/test/ui/borrowck/borrowck-use-mut-borrow.rs index c11e58651aa..95b165d6ef2 100644 --- a/src/test/ui/borrowck/borrowck-use-mut-borrow.rs +++ b/src/test/ui/borrowck/borrowck-use-mut-borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] #[derive(Copy, Clone)] diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr b/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr index c5bfd813a79..b6b09f008a4 100644 --- a/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr +++ b/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:21:10 + --> $DIR/borrowck-use-mut-borrow.rs:11:10 | LL | let p = &mut x; | - borrow of `x` occurs here @@ -7,7 +7,7 @@ LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed | ^ use of borrowed `x` error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:28:10 + --> $DIR/borrowck-use-mut-borrow.rs:18:10 | LL | let p = &mut x.a; | --- borrow of `x.a` occurs here @@ -15,7 +15,7 @@ LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed | ^ use of borrowed `x.a` error[E0503]: cannot use `x.a` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:35:10 + --> $DIR/borrowck-use-mut-borrow.rs:25:10 | LL | let p = &mut x; | - borrow of `x` occurs here @@ -23,7 +23,7 @@ LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed | ^^^ use of borrowed `x` error[E0503]: cannot use `x.a` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:42:10 + --> $DIR/borrowck-use-mut-borrow.rs:32:10 | LL | let p = &mut x.a; | --- borrow of `x.a` occurs here @@ -31,7 +31,7 @@ LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed | ^^^ use of borrowed `x.a` error[E0503]: cannot use `x.a` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:49:26 + --> $DIR/borrowck-use-mut-borrow.rs:39:26 | LL | let p = &mut x; | - borrow of `x` occurs here @@ -39,7 +39,7 @@ LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mut | ^ use of borrowed `x` error[E0503]: cannot use `x.a` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:57:26 + --> $DIR/borrowck-use-mut-borrow.rs:47:26 | LL | let p = &mut x.a; | --- borrow of `x.a` occurs here @@ -47,7 +47,7 @@ LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mut | ^ use of borrowed `x.a` error[E0503]: cannot use `*x` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:65:10 + --> $DIR/borrowck-use-mut-borrow.rs:55:10 | LL | let p = &mut x; | - borrow of `x` occurs here @@ -55,7 +55,7 @@ LL | drop(*x); //~ ERROR cannot use `*x` because it was mutably borrowed | ^^ use of borrowed `x` error[E0503]: cannot use `*x.b` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:72:10 + --> $DIR/borrowck-use-mut-borrow.rs:62:10 | LL | let p = &mut x; | - borrow of `x` occurs here @@ -63,7 +63,7 @@ LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed | ^^^^ use of borrowed `x` error[E0503]: cannot use `*x.b` because it was mutably borrowed - --> $DIR/borrowck-use-mut-borrow.rs:79:10 + --> $DIR/borrowck-use-mut-borrow.rs:69:10 | LL | let p = &mut x.b; | --- borrow of `x.b` occurs here diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.nll.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.nll.stderr index 22e95ca3ad0..8f4b02a1df3 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:22:13 + --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:12:13 | LL | let y = x as *const Foo; //[ast]~ ERROR use of possibly uninitialized variable: `*x` | ^ use of possibly uninitialized `*x` diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.stderr index 47ea9f33b1e..ecb8922ff8d 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.stderr +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `*x` - --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:22:13 + --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:12:13 | LL | let y = x as *const Foo; //[ast]~ ERROR use of possibly uninitialized variable: `*x` | ^ use of possibly uninitialized `*x` diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.mir.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.mir.stderr index 22e95ca3ad0..8f4b02a1df3 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.mir.stderr +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.mir.stderr @@ -1,5 +1,5 @@ error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:22:13 + --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:12:13 | LL | let y = x as *const Foo; //[ast]~ ERROR use of possibly uninitialized variable: `*x` | ^ use of possibly uninitialized `*x` diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs index 57c2d508356..518228a50ff 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.nll.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.nll.stderr index 11897f50910..dd0a7509a2b 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-use-uninitialized-in-cast.rs:20:13 + --> $DIR/borrowck-use-uninitialized-in-cast.rs:10:13 | LL | let y = x as *const i32; //[ast]~ ERROR use of possibly uninitialized variable: `*x` [E0381] | ^ use of possibly uninitialized `*x` diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.stderr index 75109abad51..d3ddf24d22d 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.stderr +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `*x` - --> $DIR/borrowck-use-uninitialized-in-cast.rs:20:13 + --> $DIR/borrowck-use-uninitialized-in-cast.rs:10:13 | LL | let y = x as *const i32; //[ast]~ ERROR use of possibly uninitialized variable: `*x` [E0381] | ^ use of possibly uninitialized `*x` diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.mir.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.mir.stderr index 11897f50910..dd0a7509a2b 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.mir.stderr +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.mir.stderr @@ -1,5 +1,5 @@ error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/borrowck-use-uninitialized-in-cast.rs:20:13 + --> $DIR/borrowck-use-uninitialized-in-cast.rs:10:13 | LL | let y = x as *const i32; //[ast]~ ERROR use of possibly uninitialized variable: `*x` [E0381] | ^ use of possibly uninitialized `*x` diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.rs b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.rs index dbc20d02057..e15479bde28 100644 --- a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.rs +++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr index f32509737a1..eabd0731388 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `vec` - --> $DIR/borrowck-vec-pattern-element-loan.rs:20:5 + --> $DIR/borrowck-vec-pattern-element-loan.rs:10:5 | LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough | ---- `vec` is borrowed here @@ -8,7 +8,7 @@ LL | tail | ^^^^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing local variable `vec` - --> $DIR/borrowck-vec-pattern-element-loan.rs:30:5 + --> $DIR/borrowck-vec-pattern-element-loan.rs:20:5 | LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough | ---- `vec` is borrowed here @@ -17,7 +17,7 @@ LL | init | ^^^^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing local variable `vec` - --> $DIR/borrowck-vec-pattern-element-loan.rs:40:5 + --> $DIR/borrowck-vec-pattern-element-loan.rs:30:5 | LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough | ---- `vec` is borrowed here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs index 0fd6923326a..0de5132466b 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] fn a<'a>() -> &'a [isize] { diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr index 656a25d14fc..b2fcb2f8cd1 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr @@ -1,5 +1,5 @@ error[E0597]: `vec` does not live long enough - --> $DIR/borrowck-vec-pattern-element-loan.rs:15:26 + --> $DIR/borrowck-vec-pattern-element-loan.rs:5:26 | LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough | ^^^ borrowed value does not live long enough @@ -7,14 +7,14 @@ LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:6... - --> $DIR/borrowck-vec-pattern-element-loan.rs:13:6 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 3:6... + --> $DIR/borrowck-vec-pattern-element-loan.rs:3:6 | LL | fn a<'a>() -> &'a [isize] { | ^^ error[E0597]: `vec` does not live long enough - --> $DIR/borrowck-vec-pattern-element-loan.rs:25:26 + --> $DIR/borrowck-vec-pattern-element-loan.rs:15:26 | LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough | ^^^ borrowed value does not live long enough @@ -22,14 +22,14 @@ LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:6... - --> $DIR/borrowck-vec-pattern-element-loan.rs:23:6 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:6... + --> $DIR/borrowck-vec-pattern-element-loan.rs:13:6 | LL | fn b<'a>() -> &'a [isize] { | ^^ error[E0597]: `vec` does not live long enough - --> $DIR/borrowck-vec-pattern-element-loan.rs:35:26 + --> $DIR/borrowck-vec-pattern-element-loan.rs:25:26 | LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough | ^^^ borrowed value does not live long enough @@ -37,8 +37,8 @@ LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 33:6... - --> $DIR/borrowck-vec-pattern-element-loan.rs:33:6 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:6... + --> $DIR/borrowck-vec-pattern-element-loan.rs:23:6 | LL | fn c<'a>() -> &'a [isize] { | ^^ diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr index 4614c5cf5a6..0059dd60f84 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time - --> $DIR/borrowck-vec-pattern-loan-from-mut.rs:18:13 + --> $DIR/borrowck-vec-pattern-loan-from-mut.rs:8:13 | LL | let vb: &mut [isize] = &mut v; | ------ first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.rs b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.rs index 505c8c6d535..4d99a92b18b 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] fn a() { diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr index 7015923af0a..caadcb36115 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time - --> $DIR/borrowck-vec-pattern-loan-from-mut.rs:18:13 + --> $DIR/borrowck-vec-pattern-loan-from-mut.rs:8:13 | LL | let vb: &mut [isize] = &mut v; | - first mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.nll.stderr index f99e2cec330..6dc2778892d 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.nll.stderr @@ -1,11 +1,11 @@ -error[E0506]: cannot assign to `a[..]` because it is borrowed - --> $DIR/borrowck-vec-pattern-move-tail.rs:24:5 +error[E0506]: cannot assign to `a[_]` because it is borrowed + --> $DIR/borrowck-vec-pattern-move-tail.rs:16:5 | LL | [1, 2, ref tail..] => tail, - | -------- borrow of `a[..]` occurs here + | -------- borrow of `a[_]` occurs here ... LL | a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed - | ^^^^^^^^ assignment to borrowed `a[..]` occurs here + | ^^^^^^^^ assignment to borrowed `a[_]` occurs here ... LL | println!("t[0]: {}", t[0]); | ---- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.stderr index 2b32de6944a..c456dac316d 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `a[..]` because it is borrowed - --> $DIR/borrowck-vec-pattern-move-tail.rs:24:5 + --> $DIR/borrowck-vec-pattern-move-tail.rs:16:5 | LL | [1, 2, ref tail..] => tail, | -------- borrow of `a[..]` occurs here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.cmp.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.cmp.stderr index a6aa9cd6d2a..6eb9eac760f 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.cmp.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.cmp.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `a[..]` because it is borrowed (Ast) - --> $DIR/borrowck-vec-pattern-move-tail.rs:24:5 + --> $DIR/borrowck-vec-pattern-move-tail.rs:16:5 | LL | [1, 2, ref tail..] => tail, | -------- borrow of `a[..]` occurs here @@ -7,14 +7,14 @@ LL | [1, 2, ref tail..] => tail, LL | a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed | ^^^^^^^^ assignment to borrowed `a[..]` occurs here -error[E0506]: cannot assign to `a[..]` because it is borrowed (Mir) - --> $DIR/borrowck-vec-pattern-move-tail.rs:24:5 +error[E0506]: cannot assign to `a[_]` because it is borrowed (Mir) + --> $DIR/borrowck-vec-pattern-move-tail.rs:16:5 | LL | [1, 2, ref tail..] => tail, - | -------- borrow of `a[..]` occurs here + | -------- borrow of `a[_]` occurs here ... LL | a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed - | ^^^^^^^^ assignment to borrowed `a[..]` occurs here + | ^^^^^^^^ assignment to borrowed `a[_]` occurs here ... LL | println!("t[0]: {}", t[0]); | ---- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs index 94877b27d58..e14ecd90d56 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs @@ -1,13 +1,5 @@ - -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // revisions: ast cmp //[cmp]compile-flags: -Z borrowck=compare @@ -23,7 +15,7 @@ fn main() { println!("t[0]: {}", t[0]); a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed //[cmp]~^ ERROR cannot assign to `a[..]` because it is borrowed (Ast) - //[cmp]~| ERROR cannot assign to `a[..]` because it is borrowed (Mir) + //[cmp]~| ERROR cannot assign to `a[_]` because it is borrowed (Mir) println!("t[0]: {}", t[0]); t[0]; } diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr index d5b17119d85..018a3173af1 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr @@ -1,29 +1,29 @@ -error[E0506]: cannot assign to `vec[..]` because it is borrowed - --> $DIR/borrowck-vec-pattern-nesting.rs:20:13 +error[E0506]: cannot assign to `vec[_]` because it is borrowed + --> $DIR/borrowck-vec-pattern-nesting.rs:10:13 | LL | [box ref _a, _, _] => { - | ------ borrow of `vec[..]` occurs here + | ------ borrow of `vec[_]` occurs here LL | //~^ borrow of `vec[..]` occurs here LL | vec[0] = box 4; //~ ERROR cannot assign - | ^^^^^^ assignment to borrowed `vec[..]` occurs here + | ^^^^^^ assignment to borrowed `vec[_]` occurs here LL | //~^ assignment to borrowed `vec[..]` occurs here LL | _a.use_ref(); | -- borrow later used here -error[E0506]: cannot assign to `vec[..]` because it is borrowed - --> $DIR/borrowck-vec-pattern-nesting.rs:33:13 +error[E0506]: cannot assign to `vec[_]` because it is borrowed + --> $DIR/borrowck-vec-pattern-nesting.rs:23:13 | LL | &mut [ref _b..] => { - | ------ borrow of `vec[..]` occurs here + | ------ borrow of `vec[_]` occurs here LL | //~^ borrow of `vec[..]` occurs here LL | vec[0] = box 4; //~ ERROR cannot assign - | ^^^^^^ assignment to borrowed `vec[..]` occurs here + | ^^^^^^ assignment to borrowed `vec[_]` occurs here LL | //~^ assignment to borrowed `vec[..]` occurs here LL | _b.use_ref(); | -- borrow later used here error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:43:11 + --> $DIR/borrowck-vec-pattern-nesting.rs:33:11 | LL | match vec { | ^^^ cannot move out of here @@ -31,7 +31,7 @@ LL | &mut [_a, //~ ERROR cannot move out | -- data moved here | note: move occurs because `_a` has type `std::boxed::Box`, which does not implement the `Copy` trait - --> $DIR/borrowck-vec-pattern-nesting.rs:44:15 + --> $DIR/borrowck-vec-pattern-nesting.rs:34:15 | LL | &mut [_a, //~ ERROR cannot move out | ^^ @@ -45,7 +45,7 @@ LL | ] => { | error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:57:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:47:13 | LL | let a = vec[0]; //~ ERROR cannot move out | ^^^^^^ @@ -54,7 +54,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out | help: consider borrowing here: `&vec[0]` error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:64:11 + --> $DIR/borrowck-vec-pattern-nesting.rs:54:11 | LL | match vec { | ^^^ cannot move out of here @@ -63,7 +63,7 @@ LL | _b] => {} | -- data moved here | note: move occurs because `_b` has type `std::boxed::Box`, which does not implement the `Copy` trait - --> $DIR/borrowck-vec-pattern-nesting.rs:67:10 + --> $DIR/borrowck-vec-pattern-nesting.rs:57:10 | LL | _b] => {} | ^^ @@ -75,7 +75,7 @@ LL | _b] => {} | error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:70:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:60:13 | LL | let a = vec[0]; //~ ERROR cannot move out | ^^^^^^ @@ -84,7 +84,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out | help: consider borrowing here: `&vec[0]` error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:77:11 + --> $DIR/borrowck-vec-pattern-nesting.rs:67:11 | LL | match vec { | ^^^ cannot move out of here @@ -97,13 +97,13 @@ LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out | help: consider removing the `&mut`: `[_a, _b, _c]` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/borrowck-vec-pattern-nesting.rs:78:15 + --> $DIR/borrowck-vec-pattern-nesting.rs:68:15 | LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out | ^^ ^^ ^^ error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:82:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:72:13 | LL | let a = vec[0]; //~ ERROR cannot move out | ^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs index 63dac0a8300..46203b7a3de 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_patterns)] #![feature(box_syntax)] #![feature(slice_patterns)] diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr index a03e1eab7ad..25825fea158 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `vec[..]` because it is borrowed - --> $DIR/borrowck-vec-pattern-nesting.rs:20:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:10:13 | LL | [box ref _a, _, _] => { | ------ borrow of `vec[..]` occurs here @@ -8,7 +8,7 @@ LL | vec[0] = box 4; //~ ERROR cannot assign | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here error[E0506]: cannot assign to `vec[..]` because it is borrowed - --> $DIR/borrowck-vec-pattern-nesting.rs:33:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:23:13 | LL | &mut [ref _b..] => { | ------ borrow of `vec[..]` occurs here @@ -17,7 +17,7 @@ LL | vec[0] = box 4; //~ ERROR cannot assign | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:44:14 + --> $DIR/borrowck-vec-pattern-nesting.rs:34:14 | LL | &mut [_a, //~ ERROR cannot move out | ^-- hint: to prevent move, use `ref _a` or `ref mut _a` @@ -30,7 +30,7 @@ LL | | ] => { | |_________^ cannot move out of here error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:57:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:47:13 | LL | let a = vec[0]; //~ ERROR cannot move out | ^^^^^^ @@ -39,7 +39,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out | help: consider using a reference instead: `&vec[0]` error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:65:14 + --> $DIR/borrowck-vec-pattern-nesting.rs:55:14 | LL | &mut [ //~ ERROR cannot move out | ______________^ @@ -50,7 +50,7 @@ LL | | _b] => {} | hint: to prevent move, use `ref _b` or `ref mut _b` error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:70:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:60:13 | LL | let a = vec[0]; //~ ERROR cannot move out | ^^^^^^ @@ -59,7 +59,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out | help: consider using a reference instead: `&vec[0]` error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:78:14 + --> $DIR/borrowck-vec-pattern-nesting.rs:68:14 | LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out | ^--^^--^^--^ @@ -70,7 +70,7 @@ LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out | cannot move out of here error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice - --> $DIR/borrowck-vec-pattern-nesting.rs:82:13 + --> $DIR/borrowck-vec-pattern-nesting.rs:72:13 | LL | let a = vec[0]; //~ ERROR cannot move out | ^^^^^^ diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr index dcbc283062f..d9d3930dc49 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `vec` - --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:20:5 + --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:10:5 | LL | let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough | ---- `vec` is borrowed here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs index cd8f3ebefe6..b18052a6899 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] fn a<'a>() -> &'a isize { diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr index 36343c1bde6..a4584aac0e8 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr @@ -1,5 +1,5 @@ error[E0597]: `vec` does not live long enough - --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:15:26 + --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:5:26 | LL | let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough | ^^^ borrowed value does not live long enough @@ -7,8 +7,8 @@ LL | let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:6... - --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:13:6 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 3:6... + --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:3:6 | LL | fn a<'a>() -> &'a isize { | ^^ diff --git a/src/test/ui/borrowck/borrowck-while-break.nll.stderr b/src/test/ui/borrowck/borrowck-while-break.nll.stderr index de2ba578962..1defa3da60c 100644 --- a/src/test/ui/borrowck/borrowck-while-break.nll.stderr +++ b/src/test/ui/borrowck/borrowck-while-break.nll.stderr @@ -1,5 +1,5 @@ error[E0381]: borrow of possibly uninitialized variable: `v` - --> $DIR/borrowck-while-break.rs:17:20 + --> $DIR/borrowck-while-break.rs:7:20 | LL | println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v` | ^ use of possibly uninitialized `v` diff --git a/src/test/ui/borrowck/borrowck-while-break.rs b/src/test/ui/borrowck/borrowck-while-break.rs index 8cdf1da5c93..293760efba5 100644 --- a/src/test/ui/borrowck/borrowck-while-break.rs +++ b/src/test/ui/borrowck/borrowck-while-break.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn test(cond: bool) { let v; while cond { diff --git a/src/test/ui/borrowck/borrowck-while-break.stderr b/src/test/ui/borrowck/borrowck-while-break.stderr index eaaecdb5bbb..f35d43162b2 100644 --- a/src/test/ui/borrowck/borrowck-while-break.stderr +++ b/src/test/ui/borrowck/borrowck-while-break.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `v` - --> $DIR/borrowck-while-break.rs:17:20 + --> $DIR/borrowck-while-break.rs:7:20 | LL | println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v` | ^ use of possibly uninitialized `v` diff --git a/src/test/ui/borrowck/borrowck-while-cond.rs b/src/test/ui/borrowck/borrowck-while-cond.rs index 27d42d666ea..28a5fb18a7f 100644 --- a/src/test/ui/borrowck/borrowck-while-cond.rs +++ b/src/test/ui/borrowck/borrowck-while-cond.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: bool; while x { } //~ ERROR use of possibly uninitialized variable: `x` diff --git a/src/test/ui/borrowck/borrowck-while-cond.stderr b/src/test/ui/borrowck/borrowck-while-cond.stderr index 41ef9e800bd..2b5414b42cd 100644 --- a/src/test/ui/borrowck/borrowck-while-cond.stderr +++ b/src/test/ui/borrowck/borrowck-while-cond.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-while-cond.rs:13:11 + --> $DIR/borrowck-while-cond.rs:3:11 | LL | while x { } //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/borrowck-while.rs b/src/test/ui/borrowck/borrowck-while.rs index e3566e9bb92..4274fa997a0 100644 --- a/src/test/ui/borrowck/borrowck-while.rs +++ b/src/test/ui/borrowck/borrowck-while.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f() -> isize { let mut x: isize; while 1 == 1 { x = 10; } diff --git a/src/test/ui/borrowck/borrowck-while.stderr b/src/test/ui/borrowck/borrowck-while.stderr index 9fb2dcaa436..e8aff0d22c2 100644 --- a/src/test/ui/borrowck/borrowck-while.stderr +++ b/src/test/ui/borrowck/borrowck-while.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/borrowck-while.rs:14:12 + --> $DIR/borrowck-while.rs:4:12 | LL | return x; //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/immutable-arg.rs b/src/test/ui/borrowck/immutable-arg.rs index 7c387ed0808..5a5e619ef31 100644 --- a/src/test/ui/borrowck/immutable-arg.rs +++ b/src/test/ui/borrowck/immutable-arg.rs @@ -1,14 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//compile-flags: -Z emit-end-regions -Z borrowck=compare +//compile-flags: -Z borrowck=compare fn foo(_x: u32) { _x = 4; diff --git a/src/test/ui/borrowck/immutable-arg.stderr b/src/test/ui/borrowck/immutable-arg.stderr index 06ae5cdbcc6..8b21e926666 100644 --- a/src/test/ui/borrowck/immutable-arg.stderr +++ b/src/test/ui/borrowck/immutable-arg.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `_x` (Ast) - --> $DIR/immutable-arg.rs:14:5 + --> $DIR/immutable-arg.rs:4:5 | LL | fn foo(_x: u32) { | -- first assignment to `_x` @@ -7,7 +7,7 @@ LL | _x = 4; | ^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign to immutable argument `_x` (Mir) - --> $DIR/immutable-arg.rs:14:5 + --> $DIR/immutable-arg.rs:4:5 | LL | fn foo(_x: u32) { | -- help: make this binding mutable: `mut _x` diff --git a/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr b/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr index 8e7ffa67b06..cd88e25cc42 100644 --- a/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr +++ b/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/index-mut-help-with-impl.rs:19:5 + --> $DIR/index-mut-help-with-impl.rs:9:5 | LL | Index::index(&v, 1..2).make_ascii_uppercase(); //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/borrowck/index-mut-help-with-impl.rs b/src/test/ui/borrowck/index-mut-help-with-impl.rs index a5bab48c5cc..44b57c4a038 100644 --- a/src/test/ui/borrowck/index-mut-help-with-impl.rs +++ b/src/test/ui/borrowck/index-mut-help-with-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // When mutably indexing a type that implements `Index` and `IndexMut` but // `Index::index` is being used specifically, the normal special help message // should not mention a missing `IndexMut` impl. diff --git a/src/test/ui/borrowck/index-mut-help-with-impl.stderr b/src/test/ui/borrowck/index-mut-help-with-impl.stderr index 9c28b86c45a..260ef7c92d0 100644 --- a/src/test/ui/borrowck/index-mut-help-with-impl.stderr +++ b/src/test/ui/borrowck/index-mut-help-with-impl.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/index-mut-help-with-impl.rs:19:5 + --> $DIR/index-mut-help-with-impl.rs:9:5 | LL | Index::index(&v, 1..2).make_ascii_uppercase(); //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/borrowck/index-mut-help.nll.stderr b/src/test/ui/borrowck/index-mut-help.nll.stderr index a15f37684e7..e7047f0048d 100644 --- a/src/test/ui/borrowck/index-mut-help.nll.stderr +++ b/src/test/ui/borrowck/index-mut-help.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/index-mut-help.rs:21:5 + --> $DIR/index-mut-help.rs:11:5 | LL | map["peter"].clear(); //~ ERROR | ^^^^^^^^^^^^ cannot borrow as mutable @@ -7,13 +7,13 @@ LL | map["peter"].clear(); //~ ERROR = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` error[E0594]: cannot assign to data in a `&` reference - --> $DIR/index-mut-help.rs:22:5 + --> $DIR/index-mut-help.rs:12:5 | LL | map["peter"] = "0".to_string(); //~ ERROR | ^^^^^^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/index-mut-help.rs:23:13 + --> $DIR/index-mut-help.rs:13:13 | LL | let _ = &mut map["peter"]; //~ ERROR | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/borrowck/index-mut-help.rs b/src/test/ui/borrowck/index-mut-help.rs index a4df0ced2f2..d57ef975d96 100644 --- a/src/test/ui/borrowck/index-mut-help.rs +++ b/src/test/ui/borrowck/index-mut-help.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // When mutably indexing a type that implements `Index` but not `IndexMut`, a // special 'help' message is added to the output. diff --git a/src/test/ui/borrowck/index-mut-help.stderr b/src/test/ui/borrowck/index-mut-help.stderr index b8b35ed3ed3..985fa9f0361 100644 --- a/src/test/ui/borrowck/index-mut-help.stderr +++ b/src/test/ui/borrowck/index-mut-help.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable indexed content as mutable - --> $DIR/index-mut-help.rs:21:5 + --> $DIR/index-mut-help.rs:11:5 | LL | map["peter"].clear(); //~ ERROR | ^^^^^^^^^^^^ cannot borrow as mutable @@ -7,7 +7,7 @@ LL | map["peter"].clear(); //~ ERROR = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` error[E0594]: cannot assign to immutable indexed content - --> $DIR/index-mut-help.rs:22:5 + --> $DIR/index-mut-help.rs:12:5 | LL | map["peter"] = "0".to_string(); //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable @@ -15,7 +15,7 @@ LL | map["peter"] = "0".to_string(); //~ ERROR = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` error[E0596]: cannot borrow immutable indexed content as mutable - --> $DIR/index-mut-help.rs:23:18 + --> $DIR/index-mut-help.rs:13:18 | LL | let _ = &mut map["peter"]; //~ ERROR | ^^^^^^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/borrowck/issue-41962.rs b/src/test/ui/borrowck/issue-41962.rs index 9431ef5f13d..2bcc074542d 100644 --- a/src/test/ui/borrowck/issue-41962.rs +++ b/src/test/ui/borrowck/issue-41962.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z borrowck=compare pub fn main(){ diff --git a/src/test/ui/borrowck/issue-41962.stderr b/src/test/ui/borrowck/issue-41962.stderr index 39efdb6ddb4..fd4d318b5dd 100644 --- a/src/test/ui/borrowck/issue-41962.stderr +++ b/src/test/ui/borrowck/issue-41962.stderr @@ -1,5 +1,5 @@ error[E0382]: use of partially moved value: `maybe` (Ast) - --> $DIR/issue-41962.rs:17:30 + --> $DIR/issue-41962.rs:7:30 | LL | if let Some(thing) = maybe { | ----- ^^^^^ value used here after move @@ -9,7 +9,7 @@ LL | if let Some(thing) = maybe { = note: move occurs because the value has type `std::vec::Vec`, which does not implement the `Copy` trait error[E0382]: use of moved value: `(maybe as std::prelude::v1::Some).0` (Ast) - --> $DIR/issue-41962.rs:17:21 + --> $DIR/issue-41962.rs:7:21 | LL | if let Some(thing) = maybe { | ^^^^^ value moved here in previous iteration of loop @@ -17,7 +17,7 @@ LL | if let Some(thing) = maybe { = note: move occurs because the value has type `std::vec::Vec`, which does not implement the `Copy` trait error[E0382]: use of moved value (Mir) - --> $DIR/issue-41962.rs:17:21 + --> $DIR/issue-41962.rs:7:21 | LL | if let Some(thing) = maybe { | ^^^^^ value moved here, in previous iteration of loop diff --git a/src/test/ui/borrowck/issue-45983.ast.stderr b/src/test/ui/borrowck/issue-45983.ast.stderr index db7cedffd8f..9cb83c92cae 100644 --- a/src/test/ui/borrowck/issue-45983.ast.stderr +++ b/src/test/ui/borrowck/issue-45983.ast.stderr @@ -1,5 +1,5 @@ error: borrowed data cannot be stored outside of its closure - --> $DIR/issue-45983.rs:36:27 + --> $DIR/issue-45983.rs:26:27 | LL | let x = None; | - borrowed data cannot be stored into here... diff --git a/src/test/ui/borrowck/issue-45983.migrate.stderr b/src/test/ui/borrowck/issue-45983.migrate.stderr index db7cedffd8f..9cb83c92cae 100644 --- a/src/test/ui/borrowck/issue-45983.migrate.stderr +++ b/src/test/ui/borrowck/issue-45983.migrate.stderr @@ -1,5 +1,5 @@ error: borrowed data cannot be stored outside of its closure - --> $DIR/issue-45983.rs:36:27 + --> $DIR/issue-45983.rs:26:27 | LL | let x = None; | - borrowed data cannot be stored into here... diff --git a/src/test/ui/borrowck/issue-45983.nll.stderr b/src/test/ui/borrowck/issue-45983.nll.stderr index 6588215c221..0a03858d568 100644 --- a/src/test/ui/borrowck/issue-45983.nll.stderr +++ b/src/test/ui/borrowck/issue-45983.nll.stderr @@ -1,5 +1,5 @@ error[E0521]: borrowed data escapes outside of closure - --> $DIR/issue-45983.rs:36:18 + --> $DIR/issue-45983.rs:26:18 | LL | let x = None; | - `x` is declared here, outside of the closure body @@ -9,7 +9,7 @@ LL | give_any(|y| x = Some(y)); | `y` is a reference that is only valid in the closure body error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-45983.rs:36:18 + --> $DIR/issue-45983.rs:26:18 | LL | let x = None; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/issue-45983.rs b/src/test/ui/borrowck/issue-45983.rs index ec2a2887127..4dac67d9ae9 100644 --- a/src/test/ui/borrowck/issue-45983.rs +++ b/src/test/ui/borrowck/issue-45983.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // As documented in Issue #45983, this test is evaluating the quality // of our diagnostics on erroneous code using higher-ranked closures. // diff --git a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.rs b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.rs index 670c6bb869d..7477947b89c 100644 --- a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.rs +++ b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.rs @@ -10,7 +10,7 @@ #![feature(thread_local)] #[thread_local] -static mut X: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT; +static mut X: ::std::sync::atomic::AtomicUsize = ::std::sync::atomic::AtomicUsize::new(0); fn main() { unsafe { diff --git a/src/test/ui/borrowck/issue-51117.nll.stderr b/src/test/ui/borrowck/issue-51117.nll.stderr index 71e96577797..140be098a99 100644 --- a/src/test/ui/borrowck/issue-51117.nll.stderr +++ b/src/test/ui/borrowck/issue-51117.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*bar` as mutable more than once at a time - --> $DIR/issue-51117.rs:20:13 + --> $DIR/issue-51117.rs:10:13 | LL | Some(baz) => { | --- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/issue-51117.rs b/src/test/ui/borrowck/issue-51117.rs index 0a1e672b577..e4664e4f3ea 100644 --- a/src/test/ui/borrowck/issue-51117.rs +++ b/src/test/ui/borrowck/issue-51117.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #51117 in borrowck interaction with match // default bindings. The borrow of `*bar` created by `baz` was failing // to register as a conflict with `bar.take()`. diff --git a/src/test/ui/borrowck/issue-51117.stderr b/src/test/ui/borrowck/issue-51117.stderr index cb434f9b322..783ba8df1a6 100644 --- a/src/test/ui/borrowck/issue-51117.stderr +++ b/src/test/ui/borrowck/issue-51117.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*bar` as mutable more than once at a time - --> $DIR/issue-51117.rs:20:13 + --> $DIR/issue-51117.rs:10:13 | LL | Some(baz) => { | --- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/issue-51348-multi-ref-mut-in-guard.rs b/src/test/ui/borrowck/issue-51348-multi-ref-mut-in-guard.rs index c9d39fa360e..a8bfdbad38b 100644 --- a/src/test/ui/borrowck/issue-51348-multi-ref-mut-in-guard.rs +++ b/src/test/ui/borrowck/issue-51348-multi-ref-mut-in-guard.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We used to ICE if you had a single match arm with multiple // candidate patterns with `ref mut` identifiers used in the arm's // guard. diff --git a/src/test/ui/borrowck/issue-51415.nll.stderr b/src/test/ui/borrowck/issue-51415.nll.stderr index d4340938eeb..b025374257f 100644 --- a/src/test/ui/borrowck/issue-51415.nll.stderr +++ b/src/test/ui/borrowck/issue-51415.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-51415.rs:16:42 + --> $DIR/issue-51415.rs:6:42 | LL | let opt = a.iter().enumerate().find(|(_, &s)| { | ^^^^^-^ @@ -8,7 +8,7 @@ LL | let opt = a.iter().enumerate().find(|(_, &s)| { | cannot move out of borrowed content | note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/issue-51415.rs:16:47 + --> $DIR/issue-51415.rs:6:47 | LL | let opt = a.iter().enumerate().find(|(_, &s)| { | ^ diff --git a/src/test/ui/borrowck/issue-51415.rs b/src/test/ui/borrowck/issue-51415.rs index 9067a50a847..f031308fb78 100644 --- a/src/test/ui/borrowck/issue-51415.rs +++ b/src/test/ui/borrowck/issue-51415.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #51415: match default bindings were failing to // see the "move out" implied by `&s` below. diff --git a/src/test/ui/borrowck/issue-51415.stderr b/src/test/ui/borrowck/issue-51415.stderr index b4b0bc75943..895c35e4e77 100644 --- a/src/test/ui/borrowck/issue-51415.stderr +++ b/src/test/ui/borrowck/issue-51415.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-51415.rs:16:46 + --> $DIR/issue-51415.rs:6:46 | LL | let opt = a.iter().enumerate().find(|(_, &s)| { | ^- diff --git a/src/test/ui/borrowck/issue-52713-bug.rs b/src/test/ui/borrowck/issue-52713-bug.rs index 4ecba64b271..460e6b4bbae 100644 --- a/src/test/ui/borrowck/issue-52713-bug.rs +++ b/src/test/ui/borrowck/issue-52713-bug.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for a bug in #52713: this was an optimization for // computing liveness that wound up accidentally causing the program // below to be accepted. diff --git a/src/test/ui/borrowck/issue-52713-bug.stderr b/src/test/ui/borrowck/issue-52713-bug.stderr index 7d9b57400dd..4e6d0d45bf0 100644 --- a/src/test/ui/borrowck/issue-52713-bug.stderr +++ b/src/test/ui/borrowck/issue-52713-bug.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/issue-52713-bug.rs:24:5 + --> $DIR/issue-52713-bug.rs:14:5 | LL | let y = &x; | -- borrow of `x` occurs here diff --git a/src/test/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs b/src/test/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs index 3b53fb9fc42..dcf047c545f 100644 --- a/src/test/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs +++ b/src/test/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is a regression test for #52967, where we discovered that in // the initial deployment of NLL for the 2018 edition, I forgot to // turn on two-phase-borrows in addition to `-Z borrowck=migrate`. diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.ast.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.ast.stderr index e3b5341d2bc..4f845d87aa2 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.ast.stderr +++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.ast.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `t.0` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:25:31 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:26:31 | LL | drop(t); | - value moved here @@ -10,7 +10,7 @@ LL | println!("{:?} {:?}", t.0, t.1); = note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `t.1` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:25:36 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:26:36 | LL | drop(t); | - value moved here @@ -21,7 +21,7 @@ LL | println!("{:?} {:?}", t.0, t.1); = note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait error[E0382]: use of moved value: `u.0` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:33:31 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:37:31 | LL | drop(u); | - value moved here @@ -32,7 +32,7 @@ LL | println!("{:?} {:?}", u.0, u.1); = note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait error[E0382]: use of moved value: `u.1` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:33:36 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:37:36 | LL | drop(u); | - value moved here @@ -43,7 +43,7 @@ LL | println!("{:?} {:?}", u.0, u.1); = note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait error[E0382]: use of moved value: `v.x` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:41:31 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:48:31 | LL | drop(v); | - value moved here @@ -54,7 +54,7 @@ LL | println!("{:?} {:?}", v.x, v.y); = note: move occurs because `v` has type `Spair`, which does not implement the `Copy` trait error[E0382]: use of moved value: `v.y` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:41:36 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:48:36 | LL | drop(v); | - value moved here diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr index 001ed59059c..42aa0381702 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr +++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.nll.stderr @@ -1,32 +1,32 @@ error[E0382]: assign to part of moved value: `t` --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:23:9 | +LL | let mut t: Tuple = (S(0), 0); + | ----- move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait LL | drop(t); | - value moved here LL | t.0 = S(1); | ^^^^^^^^^^ value partially assigned here after move - | - = note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait error[E0382]: assign to part of moved value: `u` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:31:9 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:34:9 | +LL | let mut u: Tpair = Tpair(S(0), 0); + | ----- move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait LL | drop(u); | - value moved here LL | u.0 = S(1); | ^^^^^^^^^^ value partially assigned here after move - | - = note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait error[E0382]: assign to part of moved value: `v` - --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:39:9 + --> $DIR/issue-54499-field-mutation-of-moved-out-with-mut.rs:45:9 | +LL | let mut v: Spair = Spair { x: S(0), y: 0 }; + | ----- move occurs because `v` has type `Spair`, which does not implement the `Copy` trait LL | drop(v); | - value moved here LL | v.x = S(1); | ^^^^^^^^^^ value partially assigned here after move - | - = note: move occurs because `v` has type `Spair`, which does not implement the `Copy` trait error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs index b6339c4a3c7..358a5dd1cbd 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs +++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out-with-mut.rs @@ -21,23 +21,32 @@ fn main() { let mut t: Tuple = (S(0), 0); drop(t); t.0 = S(1); + //[nll]~^ ERROR assign to part of moved value t.1 = 2; println!("{:?} {:?}", t.0, t.1); + //[ast]~^ ERROR use of moved value + //[ast]~^^ ERROR use of moved value } { let mut u: Tpair = Tpair(S(0), 0); drop(u); u.0 = S(1); + //[nll]~^ ERROR assign to part of moved value u.1 = 2; println!("{:?} {:?}", u.0, u.1); + //[ast]~^ ERROR use of moved value + //[ast]~^^ ERROR use of moved value } { let mut v: Spair = Spair { x: S(0), y: 0 }; drop(v); v.x = S(1); + //[nll]~^ ERROR assign to part of moved value v.y = 2; println!("{:?} {:?}", v.x, v.y); + //[ast]~^ ERROR use of moved value + //[ast]~^^ ERROR use of moved value } } diff --git a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr index d35d0058027..1184907f307 100644 --- a/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr +++ b/src/test/ui/borrowck/issue-54499-field-mutation-of-moved-out.nll.stderr @@ -10,12 +10,12 @@ LL | t.0 = S(1); error[E0382]: assign to part of moved value: `t` --> $DIR/issue-54499-field-mutation-of-moved-out.rs:23:9 | +LL | let t: Tuple = (S(0), 0); + | - move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait LL | drop(t); | - value moved here LL | t.0 = S(1); | ^^^^^^^^^^ value partially assigned here after move - | - = note: move occurs because `t` has type `(S, i32)`, which does not implement the `Copy` trait error[E0594]: cannot assign to `t.1`, as `t` is not declared as mutable --> $DIR/issue-54499-field-mutation-of-moved-out.rs:27:9 @@ -38,12 +38,12 @@ LL | u.0 = S(1); error[E0382]: assign to part of moved value: `u` --> $DIR/issue-54499-field-mutation-of-moved-out.rs:38:9 | +LL | let u: Tpair = Tpair(S(0), 0); + | - move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait LL | drop(u); | - value moved here LL | u.0 = S(1); | ^^^^^^^^^^ value partially assigned here after move - | - = note: move occurs because `u` has type `Tpair`, which does not implement the `Copy` trait error[E0594]: cannot assign to `u.1`, as `u` is not declared as mutable --> $DIR/issue-54499-field-mutation-of-moved-out.rs:42:9 @@ -66,12 +66,12 @@ LL | v.x = S(1); error[E0382]: assign to part of moved value: `v` --> $DIR/issue-54499-field-mutation-of-moved-out.rs:53:9 | +LL | let v: Spair = Spair { x: S(0), y: 0 }; + | - move occurs because `v` has type `Spair`, which does not implement the `Copy` trait LL | drop(v); | - value moved here LL | v.x = S(1); | ^^^^^^^^^^ value partially assigned here after move - | - = note: move occurs because `v` has type `Spair`, which does not implement the `Copy` trait error[E0594]: cannot assign to `v.y`, as `v` is not declared as mutable --> $DIR/issue-54499-field-mutation-of-moved-out.rs:57:9 diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs index 0749900986d..ad4accbbeee 100644 --- a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs @@ -13,7 +13,7 @@ impl Value { fn foo(val: Value) { let _reviewers_original: Vec = match val.as_array() { Some(array) => { - *array + *array //~ ERROR cannot move out of borrowed content } None => vec![] }; diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr index 6a12016b2a5..d1d7d13088b 100644 --- a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:16:13 | -LL | *array +LL | *array //~ ERROR cannot move out of borrowed content | ^^^^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr index 3180823f643..f3e9ce364d9 100644 --- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.ast.stderr @@ -9,7 +9,7 @@ LL | x | error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:29:22 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:32:22 | LL | let mut c1 = |z: &'static mut isize| { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably @@ -19,7 +19,7 @@ LL | x | error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:9 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:9 | LL | pub fn capture_assign_whole(x: (i32,)) { | - help: make this binding mutable: `mut x` @@ -27,7 +27,7 @@ LL | || { x = (1,); }; | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:9 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:9 | LL | pub fn capture_assign_part(x: (i32,)) { | - help: make this binding mutable: `mut x` @@ -35,7 +35,7 @@ LL | || { x.0 = 1; }; | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:9 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:58:9 | LL | pub fn capture_reborrow_whole(x: (i32,)) { | - help: make this binding mutable: `mut x` @@ -43,7 +43,7 @@ LL | || { &mut x; }; | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:9 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:9 | LL | pub fn capture_reborrow_part(x: (i32,)) { | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr index 0ccddf0a67d..434f318ad14 100644 --- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.migrate.stderr @@ -8,7 +8,7 @@ LL | let mut c1 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:34:50 | LL | pub fn ee(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` @@ -17,7 +17,7 @@ LL | let mut c2 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14 | LL | pub fn capture_assign_whole(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -25,7 +25,7 @@ LL | || { x = (1,); }; | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:14 | LL | pub fn capture_assign_part(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -33,7 +33,7 @@ LL | || { x.0 = 1; }; | ^^^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:58:14 | LL | pub fn capture_reborrow_whole(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -41,7 +41,7 @@ LL | || { &mut x; }; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:14 | LL | pub fn capture_reborrow_part(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr index 0ccddf0a67d..434f318ad14 100644 --- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.nll.stderr @@ -8,7 +8,7 @@ LL | let mut c1 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:30:50 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:34:50 | LL | pub fn ee(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` @@ -17,7 +17,7 @@ LL | let mut c2 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:40:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14 | LL | pub fn capture_assign_whole(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -25,7 +25,7 @@ LL | || { x = (1,); }; | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:43:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:52:14 | LL | pub fn capture_assign_part(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -33,7 +33,7 @@ LL | || { x.0 = 1; }; | ^^^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:46:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:58:14 | LL | pub fn capture_reborrow_whole(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -41,7 +41,7 @@ LL | || { &mut x; }; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable - --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:49:14 + --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:14 | LL | pub fn capture_reborrow_part(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs index 25ad66a5d9b..2bd71ec25f8 100644 --- a/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs +++ b/src/test/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs @@ -19,6 +19,9 @@ mod borrowck_closures_unique { pub fn e(x: &'static mut isize) { static mut Y: isize = 3; let mut c1 = |y: &'static mut isize| x = y; + //[migrate]~^ ERROR is not declared as mutable + //[nll]~^^ ERROR is not declared as mutable + //[ast]~^^^ closure cannot assign to immutable unsafe { c1(&mut Y); } } } @@ -27,7 +30,10 @@ mod borrowck_closures_unique_grandparent { pub fn ee(x: &'static mut isize) { static mut Z: isize = 3; let mut c1 = |z: &'static mut isize| { + //[ast]~^ closure cannot assign to immutable let mut c2 = |y: &'static mut isize| x = y; + //[migrate]~^ ERROR is not declared as mutable + //[nll]~^^ ERROR is not declared as mutable c2(z); }; unsafe { c1(&mut Z); } @@ -38,15 +44,27 @@ mod borrowck_closures_unique_grandparent { mod mutability_errors { pub fn capture_assign_whole(x: (i32,)) { || { x = (1,); }; + //[ast]~^ ERROR immutable argument + //[migrate]~^^ ERROR is not declared as mutable + //[nll]~^^^ ERROR is not declared as mutable } pub fn capture_assign_part(x: (i32,)) { || { x.0 = 1; }; + //[ast]~^ ERROR immutable argument + //[migrate]~^^ ERROR is not declared as mutable + //[nll]~^^^ ERROR is not declared as mutable } pub fn capture_reborrow_whole(x: (i32,)) { || { &mut x; }; + //[ast]~^ ERROR immutable argument + //[migrate]~^^ ERROR is not declared as mutable + //[nll]~^^^ ERROR is not declared as mutable } pub fn capture_reborrow_part(x: (i32,)) { || { &mut x.0; }; + //[ast]~^ ERROR immutable argument + //[migrate]~^^ ERROR is not declared as mutable + //[nll]~^^^ ERROR is not declared as mutable } } diff --git a/src/test/ui/borrowck/issue-7573.rs b/src/test/ui/borrowck/issue-7573.rs index 8f1545fa009..20a6a5c92f1 100644 --- a/src/test/ui/borrowck/issue-7573.rs +++ b/src/test/ui/borrowck/issue-7573.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub struct CrateId { local_path: String, junk: String diff --git a/src/test/ui/borrowck/issue-7573.stderr b/src/test/ui/borrowck/issue-7573.stderr index 41a804adfe3..fed79ef4f55 100644 --- a/src/test/ui/borrowck/issue-7573.stderr +++ b/src/test/ui/borrowck/issue-7573.stderr @@ -1,5 +1,5 @@ error: borrowed data cannot be stored outside of its closure - --> $DIR/issue-7573.rs:32:27 + --> $DIR/issue-7573.rs:21:27 | LL | let mut lines_to_use: Vec<&CrateId> = Vec::new(); | - cannot infer an appropriate lifetime... diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.stderr b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.stderr index 0c0f539df6a..6793e1a1312 100644 --- a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.stderr +++ b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.stderr @@ -1,11 +1,11 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/move-in-static-initializer-issue-38520.rs:25:23 + --> $DIR/move-in-static-initializer-issue-38520.rs:15:23 | LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507 | ^^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/move-in-static-initializer-issue-38520.rs:27:22 + --> $DIR/move-in-static-initializer-issue-38520.rs:17:22 | LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507 | ^^^ cannot move out of borrowed content diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.mir.stderr b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.mir.stderr index 0c0f539df6a..6793e1a1312 100644 --- a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.mir.stderr +++ b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.mir.stderr @@ -1,11 +1,11 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/move-in-static-initializer-issue-38520.rs:25:23 + --> $DIR/move-in-static-initializer-issue-38520.rs:15:23 | LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507 | ^^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/move-in-static-initializer-issue-38520.rs:27:22 + --> $DIR/move-in-static-initializer-issue-38520.rs:17:22 | LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507 | ^^^ cannot move out of borrowed content diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs index 34e76c92a65..a7b17f7d651 100644 --- a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs +++ b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr b/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr index e57c64ae127..ab05358d03f 100644 --- a/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr +++ b/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time - --> $DIR/mut-borrow-in-loop.rs:20:25 + --> $DIR/mut-borrow-in-loop.rs:10:25 | LL | impl<'a, T : 'a> FuncWrapper<'a, T> { | -- lifetime `'a` defined here @@ -11,7 +11,7 @@ LL | (self.func)(arg) //~ ERROR cannot borrow | argument requires that `*arg` is borrowed for `'a` error[E0499]: cannot borrow `*arg` as mutable more than once at a time - --> $DIR/mut-borrow-in-loop.rs:26:25 + --> $DIR/mut-borrow-in-loop.rs:16:25 | LL | impl<'a, T : 'a> FuncWrapper<'a, T> { | -- lifetime `'a` defined here @@ -23,7 +23,7 @@ LL | (self.func)(arg) //~ ERROR cannot borrow | argument requires that `*arg` is borrowed for `'a` error[E0499]: cannot borrow `*arg` as mutable more than once at a time - --> $DIR/mut-borrow-in-loop.rs:33:25 + --> $DIR/mut-borrow-in-loop.rs:23:25 | LL | impl<'a, T : 'a> FuncWrapper<'a, T> { | -- lifetime `'a` defined here diff --git a/src/test/ui/borrowck/mut-borrow-in-loop.rs b/src/test/ui/borrowck/mut-borrow-in-loop.rs index 31b50d8e531..6b65b903757 100644 --- a/src/test/ui/borrowck/mut-borrow-in-loop.rs +++ b/src/test/ui/borrowck/mut-borrow-in-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // produce special borrowck message inside all kinds of loops struct FuncWrapper<'a, T : 'a> { diff --git a/src/test/ui/borrowck/mut-borrow-in-loop.stderr b/src/test/ui/borrowck/mut-borrow-in-loop.stderr index cda59d3bc68..749e0e172f7 100644 --- a/src/test/ui/borrowck/mut-borrow-in-loop.stderr +++ b/src/test/ui/borrowck/mut-borrow-in-loop.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time - --> $DIR/mut-borrow-in-loop.rs:20:25 + --> $DIR/mut-borrow-in-loop.rs:10:25 | LL | (self.func)(arg) //~ ERROR cannot borrow | ^^^ mutable borrow starts here in previous iteration of loop @@ -8,7 +8,7 @@ LL | } | - mutable borrow ends here error[E0499]: cannot borrow `*arg` as mutable more than once at a time - --> $DIR/mut-borrow-in-loop.rs:26:25 + --> $DIR/mut-borrow-in-loop.rs:16:25 | LL | (self.func)(arg) //~ ERROR cannot borrow | ^^^ mutable borrow starts here in previous iteration of loop @@ -17,7 +17,7 @@ LL | } | - mutable borrow ends here error[E0499]: cannot borrow `*arg` as mutable more than once at a time - --> $DIR/mut-borrow-in-loop.rs:33:25 + --> $DIR/mut-borrow-in-loop.rs:23:25 | LL | (self.func)(arg) //~ ERROR cannot borrow | ^^^ mutable borrow starts here in previous iteration of loop diff --git a/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr b/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr index ece3c62e6a9..5ee31b5efd0 100644 --- a/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr +++ b/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable - --> $DIR/mut-borrow-of-mut-ref.rs:18:7 + --> $DIR/mut-borrow-of-mut-ref.rs:8:7 | LL | fn f(b: &mut i32) { | - help: consider changing this to be mutable: `mut b` diff --git a/src/test/ui/borrowck/mut-borrow-of-mut-ref.rs b/src/test/ui/borrowck/mut-borrow-of-mut-ref.rs index 75b9da52023..212f706953e 100644 --- a/src/test/ui/borrowck/mut-borrow-of-mut-ref.rs +++ b/src/test/ui/borrowck/mut-borrow-of-mut-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Suggest not mutably borrowing a mutable reference fn main() { diff --git a/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr b/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr index 885164cdc06..5278056ac0f 100644 --- a/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr +++ b/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable argument `b` as mutable - --> $DIR/mut-borrow-of-mut-ref.rs:18:12 + --> $DIR/mut-borrow-of-mut-ref.rs:8:12 | LL | g(&mut b) //~ ERROR cannot borrow | ^ cannot borrow mutably diff --git a/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr b/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr index fd201d75106..7e183116c46 100644 --- a/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr +++ b/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `void` as mutable more than once at a time - --> $DIR/mut-borrow-outside-loop.rs:17:18 + --> $DIR/mut-borrow-outside-loop.rs:7:18 | LL | let first = &mut void; | --------- first mutable borrow occurs here @@ -9,7 +9,7 @@ LL | first.use_mut(); | ----- first borrow later used here error[E0499]: cannot borrow `inner_void` as mutable more than once at a time - --> $DIR/mut-borrow-outside-loop.rs:25:28 + --> $DIR/mut-borrow-outside-loop.rs:15:28 | LL | let inner_first = &mut inner_void; | --------------- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/mut-borrow-outside-loop.rs b/src/test/ui/borrowck/mut-borrow-outside-loop.rs index aba520bd864..c02bfbf8739 100644 --- a/src/test/ui/borrowck/mut-borrow-outside-loop.rs +++ b/src/test/ui/borrowck/mut-borrow-outside-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ensure borrowck messages are correct outside special case #![feature(rustc_attrs)] fn main() { #![rustc_error] // rust-lang/rust#49855 diff --git a/src/test/ui/borrowck/mut-borrow-outside-loop.stderr b/src/test/ui/borrowck/mut-borrow-outside-loop.stderr index 95e9fa19129..1b32d8589b5 100644 --- a/src/test/ui/borrowck/mut-borrow-outside-loop.stderr +++ b/src/test/ui/borrowck/mut-borrow-outside-loop.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `void` as mutable more than once at a time - --> $DIR/mut-borrow-outside-loop.rs:17:23 + --> $DIR/mut-borrow-outside-loop.rs:7:23 | LL | let first = &mut void; | ---- first mutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `inner_void` as mutable more than once at a time - --> $DIR/mut-borrow-outside-loop.rs:25:33 + --> $DIR/mut-borrow-outside-loop.rs:15:33 | LL | let inner_first = &mut inner_void; | ---------- first mutable borrow occurs here diff --git a/src/test/ui/borrowck/mutability-errors.nll.stderr b/src/test/ui/borrowck/mutability-errors.nll.stderr index 14c41bb81b2..6dd3582f95f 100644 --- a/src/test/ui/borrowck/mutability-errors.nll.stderr +++ b/src/test/ui/borrowck/mutability-errors.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*x` which is behind a `&` reference - --> $DIR/mutability-errors.rs:19:5 + --> $DIR/mutability-errors.rs:9:5 | LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` @@ -7,7 +7,7 @@ LL | *x = (1,); //~ ERROR | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `x.0` which is behind a `&` reference - --> $DIR/mutability-errors.rs:20:5 + --> $DIR/mutability-errors.rs:10:5 | LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` @@ -16,7 +16,7 @@ LL | x.0 = 1; //~ ERROR | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/mutability-errors.rs:21:5 + --> $DIR/mutability-errors.rs:11:5 | LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` @@ -25,7 +25,7 @@ LL | &mut *x; //~ ERROR | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference - --> $DIR/mutability-errors.rs:22:5 + --> $DIR/mutability-errors.rs:12:5 | LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` @@ -34,31 +34,31 @@ LL | &mut x.0; //~ ERROR | ^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0594]: cannot assign to data in a `&` reference - --> $DIR/mutability-errors.rs:26:5 + --> $DIR/mutability-errors.rs:16:5 | LL | *f() = (1,); //~ ERROR | ^^^^^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference - --> $DIR/mutability-errors.rs:27:5 + --> $DIR/mutability-errors.rs:17:5 | LL | f().0 = 1; //~ ERROR | ^^^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/mutability-errors.rs:28:5 + --> $DIR/mutability-errors.rs:18:5 | LL | &mut *f(); //~ ERROR | ^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/mutability-errors.rs:29:5 + --> $DIR/mutability-errors.rs:19:5 | LL | &mut f().0; //~ ERROR | ^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `*x` which is behind a `*const` pointer - --> $DIR/mutability-errors.rs:33:5 + --> $DIR/mutability-errors.rs:23:5 | LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` @@ -66,7 +66,7 @@ LL | *x = (1,); //~ ERROR | ^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written error[E0594]: cannot assign to `x.0` which is behind a `*const` pointer - --> $DIR/mutability-errors.rs:34:5 + --> $DIR/mutability-errors.rs:24:5 | LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` @@ -75,7 +75,7 @@ LL | (*x).0 = 1; //~ ERROR | ^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer - --> $DIR/mutability-errors.rs:35:5 + --> $DIR/mutability-errors.rs:25:5 | LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` @@ -84,7 +84,7 @@ LL | &mut *x; //~ ERROR | ^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer - --> $DIR/mutability-errors.rs:36:5 + --> $DIR/mutability-errors.rs:26:5 | LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` @@ -93,37 +93,37 @@ LL | &mut (*x).0; //~ ERROR | ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable error[E0594]: cannot assign to data in a `*const` pointer - --> $DIR/mutability-errors.rs:40:5 + --> $DIR/mutability-errors.rs:30:5 | LL | *f() = (1,); //~ ERROR | ^^^^^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `*const` pointer - --> $DIR/mutability-errors.rs:41:5 + --> $DIR/mutability-errors.rs:31:5 | LL | (*f()).0 = 1; //~ ERROR | ^^^^^^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `*const` pointer as mutable - --> $DIR/mutability-errors.rs:42:5 + --> $DIR/mutability-errors.rs:32:5 | LL | &mut *f(); //~ ERROR | ^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `*const` pointer as mutable - --> $DIR/mutability-errors.rs:43:5 + --> $DIR/mutability-errors.rs:33:5 | LL | &mut (*f()).0; //~ ERROR | ^^^^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure - --> $DIR/mutability-errors.rs:50:9 + --> $DIR/mutability-errors.rs:40:9 | LL | x = (1,); //~ ERROR | ^^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/mutability-errors.rs:49:12 + --> $DIR/mutability-errors.rs:39:12 | LL | fn_ref(|| { | ____________^ @@ -135,13 +135,13 @@ LL | | }); | |_____^ error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables - --> $DIR/mutability-errors.rs:51:9 + --> $DIR/mutability-errors.rs:41:9 | LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/mutability-errors.rs:49:12 + --> $DIR/mutability-errors.rs:39:12 | LL | fn_ref(|| { | ____________^ @@ -153,13 +153,13 @@ LL | | }); | |_____^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/mutability-errors.rs:52:9 + --> $DIR/mutability-errors.rs:42:9 | LL | &mut x; //~ ERROR | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/mutability-errors.rs:49:12 + --> $DIR/mutability-errors.rs:39:12 | LL | fn_ref(|| { | ____________^ @@ -171,13 +171,13 @@ LL | | }); | |_____^ error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables - --> $DIR/mutability-errors.rs:53:9 + --> $DIR/mutability-errors.rs:43:9 | LL | &mut x.0; //~ ERROR | ^^^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/mutability-errors.rs:49:12 + --> $DIR/mutability-errors.rs:39:12 | LL | fn_ref(|| { | ____________^ @@ -189,13 +189,13 @@ LL | | }); | |_____^ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure - --> $DIR/mutability-errors.rs:56:9 + --> $DIR/mutability-errors.rs:46:9 | LL | x = (1,); //~ ERROR | ^^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/mutability-errors.rs:55:12 + --> $DIR/mutability-errors.rs:45:12 | LL | fn_ref(move || { | ____________^ @@ -207,13 +207,13 @@ LL | | }); | |_____^ error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables - --> $DIR/mutability-errors.rs:57:9 + --> $DIR/mutability-errors.rs:47:9 | LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/mutability-errors.rs:55:12 + --> $DIR/mutability-errors.rs:45:12 | LL | fn_ref(move || { | ____________^ @@ -225,13 +225,13 @@ LL | | }); | |_____^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/mutability-errors.rs:58:9 + --> $DIR/mutability-errors.rs:48:9 | LL | &mut x; //~ ERROR | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/mutability-errors.rs:55:12 + --> $DIR/mutability-errors.rs:45:12 | LL | fn_ref(move || { | ____________^ @@ -243,13 +243,13 @@ LL | | }); | |_____^ error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables - --> $DIR/mutability-errors.rs:59:9 + --> $DIR/mutability-errors.rs:49:9 | LL | &mut x.0; //~ ERROR | ^^^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/mutability-errors.rs:55:12 + --> $DIR/mutability-errors.rs:45:12 | LL | fn_ref(move || { | ____________^ @@ -261,7 +261,7 @@ LL | | }); | |_____^ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/mutability-errors.rs:64:5 + --> $DIR/mutability-errors.rs:54:5 | LL | fn imm_local(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -269,7 +269,7 @@ LL | &mut x; //~ ERROR | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable - --> $DIR/mutability-errors.rs:65:5 + --> $DIR/mutability-errors.rs:55:5 | LL | fn imm_local(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -278,7 +278,7 @@ LL | &mut x.0; //~ ERROR | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/mutability-errors.rs:70:9 + --> $DIR/mutability-errors.rs:60:9 | LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -287,7 +287,7 @@ LL | x = (1,); | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/mutability-errors.rs:71:9 + --> $DIR/mutability-errors.rs:61:9 | LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -296,7 +296,7 @@ LL | x.0 = 1; | ^^^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/mutability-errors.rs:72:9 + --> $DIR/mutability-errors.rs:62:9 | LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -305,7 +305,7 @@ LL | &mut x; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable - --> $DIR/mutability-errors.rs:73:9 + --> $DIR/mutability-errors.rs:63:9 | LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -314,7 +314,7 @@ LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/mutability-errors.rs:76:9 + --> $DIR/mutability-errors.rs:66:9 | LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -323,7 +323,7 @@ LL | x = (1,); //~ ERROR | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/mutability-errors.rs:77:9 + --> $DIR/mutability-errors.rs:67:9 | LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -332,7 +332,7 @@ LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/mutability-errors.rs:78:9 + --> $DIR/mutability-errors.rs:68:9 | LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -341,7 +341,7 @@ LL | &mut x; //~ ERROR | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable - --> $DIR/mutability-errors.rs:79:9 + --> $DIR/mutability-errors.rs:69:9 | LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` @@ -350,25 +350,25 @@ LL | &mut x.0; //~ ERROR | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable static item `X` - --> $DIR/mutability-errors.rs:86:5 + --> $DIR/mutability-errors.rs:76:5 | LL | X = (1,); //~ ERROR | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `X.0`, as `X` is an immutable static item - --> $DIR/mutability-errors.rs:87:5 + --> $DIR/mutability-errors.rs:77:5 | LL | X.0 = 1; //~ ERROR | ^^^^^^^ cannot assign error[E0596]: cannot borrow immutable static item `X` as mutable - --> $DIR/mutability-errors.rs:88:5 + --> $DIR/mutability-errors.rs:78:5 | LL | &mut X; //~ ERROR | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item - --> $DIR/mutability-errors.rs:89:5 + --> $DIR/mutability-errors.rs:79:5 | LL | &mut X.0; //~ ERROR | ^^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/borrowck/mutability-errors.rs b/src/test/ui/borrowck/mutability-errors.rs index 0b4548cbebb..26f7f605ebe 100644 --- a/src/test/ui/borrowck/mutability-errors.rs +++ b/src/test/ui/borrowck/mutability-errors.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // All the possible mutability error cases. #![allow(unused)] diff --git a/src/test/ui/borrowck/mutability-errors.stderr b/src/test/ui/borrowck/mutability-errors.stderr index 5013f877e7e..b7fd6ee7214 100644 --- a/src/test/ui/borrowck/mutability-errors.stderr +++ b/src/test/ui/borrowck/mutability-errors.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to immutable borrowed content `*x` - --> $DIR/mutability-errors.rs:19:5 + --> $DIR/mutability-errors.rs:9:5 | LL | fn named_ref(x: &(i32,)) { | ------- use `&mut (i32,)` here to make mutable @@ -7,7 +7,7 @@ LL | *x = (1,); //~ ERROR | ^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to field `x.0` of immutable binding - --> $DIR/mutability-errors.rs:20:5 + --> $DIR/mutability-errors.rs:10:5 | LL | fn named_ref(x: &(i32,)) { | ------- use `&mut (i32,)` here to make mutable @@ -16,7 +16,7 @@ LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable borrowed content `*x` as mutable - --> $DIR/mutability-errors.rs:21:10 + --> $DIR/mutability-errors.rs:11:10 | LL | fn named_ref(x: &(i32,)) { | ------- use `&mut (i32,)` here to make mutable @@ -25,7 +25,7 @@ LL | &mut *x; //~ ERROR | ^^ cannot borrow as mutable error[E0596]: cannot borrow field `x.0` of immutable binding as mutable - --> $DIR/mutability-errors.rs:22:10 + --> $DIR/mutability-errors.rs:12:10 | LL | fn named_ref(x: &(i32,)) { | ------- use `&mut (i32,)` here to make mutable @@ -34,85 +34,85 @@ LL | &mut x.0; //~ ERROR | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to immutable borrowed content - --> $DIR/mutability-errors.rs:26:5 + --> $DIR/mutability-errors.rs:16:5 | LL | *f() = (1,); //~ ERROR | ^^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to field of immutable binding - --> $DIR/mutability-errors.rs:27:5 + --> $DIR/mutability-errors.rs:17:5 | LL | f().0 = 1; //~ ERROR | ^^^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/mutability-errors.rs:28:10 + --> $DIR/mutability-errors.rs:18:10 | LL | &mut *f(); //~ ERROR | ^^^^ cannot borrow as mutable error[E0596]: cannot borrow field of immutable binding as mutable - --> $DIR/mutability-errors.rs:29:10 + --> $DIR/mutability-errors.rs:19:10 | LL | &mut f().0; //~ ERROR | ^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to immutable dereference of raw pointer `*x` - --> $DIR/mutability-errors.rs:33:5 + --> $DIR/mutability-errors.rs:23:5 | LL | *x = (1,); //~ ERROR | ^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to field `x.0` of immutable binding - --> $DIR/mutability-errors.rs:34:5 + --> $DIR/mutability-errors.rs:24:5 | LL | (*x).0 = 1; //~ ERROR | ^^^^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable dereference of raw pointer `*x` as mutable - --> $DIR/mutability-errors.rs:35:10 + --> $DIR/mutability-errors.rs:25:10 | LL | &mut *x; //~ ERROR | ^^ cannot borrow as mutable error[E0596]: cannot borrow field `x.0` of immutable binding as mutable - --> $DIR/mutability-errors.rs:36:10 + --> $DIR/mutability-errors.rs:26:10 | LL | &mut (*x).0; //~ ERROR | ^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to immutable dereference of raw pointer - --> $DIR/mutability-errors.rs:40:5 + --> $DIR/mutability-errors.rs:30:5 | LL | *f() = (1,); //~ ERROR | ^^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to field of immutable binding - --> $DIR/mutability-errors.rs:41:5 + --> $DIR/mutability-errors.rs:31:5 | LL | (*f()).0 = 1; //~ ERROR | ^^^^^^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable dereference of raw pointer as mutable - --> $DIR/mutability-errors.rs:42:10 + --> $DIR/mutability-errors.rs:32:10 | LL | &mut *f(); //~ ERROR | ^^^^ cannot borrow as mutable error[E0596]: cannot borrow field of immutable binding as mutable - --> $DIR/mutability-errors.rs:43:10 + --> $DIR/mutability-errors.rs:33:10 | LL | &mut (*f()).0; //~ ERROR | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure - --> $DIR/mutability-errors.rs:50:9 + --> $DIR/mutability-errors.rs:40:9 | LL | x = (1,); //~ ERROR | ^^^^^^^^ | help: consider changing this closure to take self by mutable reference - --> $DIR/mutability-errors.rs:49:12 + --> $DIR/mutability-errors.rs:39:12 | LL | fn_ref(|| { | ____________^ @@ -124,13 +124,13 @@ LL | | }); | |_____^ error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure - --> $DIR/mutability-errors.rs:51:9 + --> $DIR/mutability-errors.rs:41:9 | LL | x.0 = 1; //~ ERROR | ^^^^^^^ | help: consider changing this closure to take self by mutable reference - --> $DIR/mutability-errors.rs:49:12 + --> $DIR/mutability-errors.rs:39:12 | LL | fn_ref(|| { | ____________^ @@ -142,13 +142,13 @@ LL | | }); | |_____^ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure - --> $DIR/mutability-errors.rs:52:14 + --> $DIR/mutability-errors.rs:42:14 | LL | &mut x; //~ ERROR | ^ | help: consider changing this closure to take self by mutable reference - --> $DIR/mutability-errors.rs:49:12 + --> $DIR/mutability-errors.rs:39:12 | LL | fn_ref(|| { | ____________^ @@ -160,13 +160,13 @@ LL | | }); | |_____^ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure - --> $DIR/mutability-errors.rs:53:14 + --> $DIR/mutability-errors.rs:43:14 | LL | &mut x.0; //~ ERROR | ^^^ | help: consider changing this closure to take self by mutable reference - --> $DIR/mutability-errors.rs:49:12 + --> $DIR/mutability-errors.rs:39:12 | LL | fn_ref(|| { | ____________^ @@ -178,14 +178,14 @@ LL | | }); | |_____^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure - --> $DIR/mutability-errors.rs:56:9 + --> $DIR/mutability-errors.rs:46:9 | LL | x = (1,); //~ ERROR | ^^^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications help: consider changing this closure to take self by mutable reference - --> $DIR/mutability-errors.rs:55:12 + --> $DIR/mutability-errors.rs:45:12 | LL | fn_ref(move || { | ____________^ @@ -197,19 +197,19 @@ LL | | }); | |_____^ error[E0594]: cannot assign to field `x.0` of immutable binding - --> $DIR/mutability-errors.rs:57:9 + --> $DIR/mutability-errors.rs:47:9 | LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable - --> $DIR/mutability-errors.rs:58:14 + --> $DIR/mutability-errors.rs:48:14 | LL | &mut x; //~ ERROR | ^ | help: consider changing this closure to take self by mutable reference - --> $DIR/mutability-errors.rs:55:12 + --> $DIR/mutability-errors.rs:45:12 | LL | fn_ref(move || { | ____________^ @@ -221,13 +221,13 @@ LL | | }); | |_____^ error[E0596]: cannot borrow field `x.0` of immutable binding as mutable - --> $DIR/mutability-errors.rs:59:14 + --> $DIR/mutability-errors.rs:49:14 | LL | &mut x.0; //~ ERROR | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable argument `x` as mutable - --> $DIR/mutability-errors.rs:64:10 + --> $DIR/mutability-errors.rs:54:10 | LL | fn imm_local(x: (i32,)) { | - help: make this binding mutable: `mut x` @@ -235,7 +235,7 @@ LL | &mut x; //~ ERROR | ^ cannot borrow mutably error[E0596]: cannot borrow field `x.0` of immutable binding as mutable - --> $DIR/mutability-errors.rs:65:10 + --> $DIR/mutability-errors.rs:55:10 | LL | fn imm_local(x: (i32,)) { | - help: make this binding mutable: `mut x` @@ -244,7 +244,7 @@ LL | &mut x.0; //~ ERROR | ^^^ cannot mutably borrow field of immutable binding error[E0595]: closure cannot assign to immutable argument `x` - --> $DIR/mutability-errors.rs:69:5 + --> $DIR/mutability-errors.rs:59:5 | LL | fn imm_capture(x: (i32,)) { | - help: make this binding mutable: `mut x` @@ -252,7 +252,7 @@ LL | || { //~ ERROR | ^^ cannot borrow mutably error[E0594]: cannot assign to captured outer variable in an `FnMut` closure - --> $DIR/mutability-errors.rs:76:9 + --> $DIR/mutability-errors.rs:66:9 | LL | fn imm_capture(x: (i32,)) { | - help: consider making `x` mutable: `mut x` @@ -261,43 +261,43 @@ LL | x = (1,); //~ ERROR | ^^^^^^^^ error[E0594]: cannot assign to field `x.0` of immutable binding - --> $DIR/mutability-errors.rs:77:9 + --> $DIR/mutability-errors.rs:67:9 | LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable - --> $DIR/mutability-errors.rs:78:14 + --> $DIR/mutability-errors.rs:68:14 | LL | &mut x; //~ ERROR | ^ error[E0596]: cannot borrow field `x.0` of immutable binding as mutable - --> $DIR/mutability-errors.rs:79:14 + --> $DIR/mutability-errors.rs:69:14 | LL | &mut x.0; //~ ERROR | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to immutable static item - --> $DIR/mutability-errors.rs:86:5 + --> $DIR/mutability-errors.rs:76:5 | LL | X = (1,); //~ ERROR | ^^^^^^^^ error[E0594]: cannot assign to field of immutable binding - --> $DIR/mutability-errors.rs:87:5 + --> $DIR/mutability-errors.rs:77:5 | LL | X.0 = 1; //~ ERROR | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable static item as mutable - --> $DIR/mutability-errors.rs:88:10 + --> $DIR/mutability-errors.rs:78:10 | LL | &mut X; //~ ERROR | ^ error[E0596]: cannot borrow field of immutable binding as mutable - --> $DIR/mutability-errors.rs:89:10 + --> $DIR/mutability-errors.rs:79:10 | LL | &mut X.0; //~ ERROR | ^^^ cannot mutably borrow field of immutable binding diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr index 229da2a330b..66e3c4056a2 100644 --- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr +++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing temporary value - --> $DIR/promote-ref-mut-in-let-issue-46557.rs:16:5 + --> $DIR/promote-ref-mut-in-let-issue-46557.rs:6:5 | LL | let ref mut x = 1234543; //~ ERROR | ------- temporary value created here @@ -7,7 +7,7 @@ LL | x | ^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing temporary value - --> $DIR/promote-ref-mut-in-let-issue-46557.rs:21:5 + --> $DIR/promote-ref-mut-in-let-issue-46557.rs:11:5 | LL | let (ref mut x, ) = (1234543, ); //~ ERROR | ----------- temporary value created here @@ -15,7 +15,7 @@ LL | x | ^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing temporary value - --> $DIR/promote-ref-mut-in-let-issue-46557.rs:25:5 + --> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:5 | LL | match 1234543 { | ^ ------- temporary value created here @@ -26,7 +26,7 @@ LL | | } | |_____^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing temporary value - --> $DIR/promote-ref-mut-in-let-issue-46557.rs:31:5 + --> $DIR/promote-ref-mut-in-let-issue-46557.rs:21:5 | LL | match (123443,) { | ^ --------- temporary value created here @@ -37,7 +37,7 @@ LL | | } | |_____^ returns a value referencing data owned by the current function error[E0515]: cannot return reference to temporary value - --> $DIR/promote-ref-mut-in-let-issue-46557.rs:37:5 + --> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:5 | LL | &mut 1234543 //~ ERROR | ^^^^^------- diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.rs b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.rs index 4c5f458d6a3..ae305b68941 100644 --- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.rs +++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we fail to promote the constant here which has a `ref // mut` borrow. diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr index 931eb7da744..51e47fd44d9 100644 --- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr +++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:9 + --> $DIR/promote-ref-mut-in-let-issue-46557.rs:5:9 | LL | let ref mut x = 1234543; //~ ERROR | ^^^^^^^^^ temporary value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/promote-ref-mut-in-let-issue-46557.rs:20:10 + --> $DIR/promote-ref-mut-in-let-issue-46557.rs:10:10 | LL | let (ref mut x, ) = (1234543, ); //~ ERROR | ^^^^^^^^^ borrowed value does not live long enough @@ -21,7 +21,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/promote-ref-mut-in-let-issue-46557.rs:26:9 + --> $DIR/promote-ref-mut-in-let-issue-46557.rs:16:9 | LL | ref mut x => x //~ ERROR | ^^^^^^^^^ temporary value does not live long enough @@ -32,7 +32,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/promote-ref-mut-in-let-issue-46557.rs:32:10 + --> $DIR/promote-ref-mut-in-let-issue-46557.rs:22:10 | LL | (ref mut x,) => x, //~ ERROR | ^^^^^^^^^ borrowed value does not live long enough @@ -43,7 +43,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/promote-ref-mut-in-let-issue-46557.rs:37:10 + --> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:10 | LL | &mut 1234543 //~ ERROR | ^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr index 1f0938dd3d2..bf9084259c8 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr @@ -1,11 +1,11 @@ error[E0381]: assign to part of possibly uninitialized variable: `x` - --> $DIR/reassignment_immutable_fields.rs:17:5 + --> $DIR/reassignment_immutable_fields.rs:7:5 | LL | x.0 = 1; //~ ERROR | ^^^^^^^ use of possibly uninitialized `x` error[E0381]: assign to part of possibly uninitialized variable: `x` - --> $DIR/reassignment_immutable_fields.rs:25:5 + --> $DIR/reassignment_immutable_fields.rs:15:5 | LL | x.0 = 1; //~ ERROR | ^^^^^^^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.rs b/src/test/ui/borrowck/reassignment_immutable_fields.rs index c49ae2f9567..4529e32a692 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields.rs +++ b/src/test/ui/borrowck/reassignment_immutable_fields.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test is currently disallowed, but we hope someday to support it. // // FIXME(#21232) diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.stderr index d16c0a5e37b..c63f56702ab 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to field `x.0` of immutable binding - --> $DIR/reassignment_immutable_fields.rs:17:5 + --> $DIR/reassignment_immutable_fields.rs:7:5 | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` @@ -7,7 +7,7 @@ LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.1` of immutable binding - --> $DIR/reassignment_immutable_fields.rs:18:5 + --> $DIR/reassignment_immutable_fields.rs:8:5 | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` @@ -16,19 +16,19 @@ LL | x.1 = 22; //~ ERROR | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0381]: use of possibly uninitialized variable: `x.0` - --> $DIR/reassignment_immutable_fields.rs:19:10 + --> $DIR/reassignment_immutable_fields.rs:9:10 | LL | drop(x.0); //~ ERROR | ^^^ use of possibly uninitialized `x.0` error[E0381]: use of possibly uninitialized variable: `x.1` - --> $DIR/reassignment_immutable_fields.rs:20:10 + --> $DIR/reassignment_immutable_fields.rs:10:10 | LL | drop(x.1); //~ ERROR | ^^^ use of possibly uninitialized `x.1` error[E0594]: cannot assign to field `x.0` of immutable binding - --> $DIR/reassignment_immutable_fields.rs:25:5 + --> $DIR/reassignment_immutable_fields.rs:15:5 | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` @@ -36,7 +36,7 @@ LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.1` of immutable binding - --> $DIR/reassignment_immutable_fields.rs:26:5 + --> $DIR/reassignment_immutable_fields.rs:16:5 | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` @@ -45,7 +45,7 @@ LL | x.1 = 22; //~ ERROR | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/reassignment_immutable_fields.rs:27:10 + --> $DIR/reassignment_immutable_fields.rs:17:10 | LL | drop(x); //~ ERROR | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr index fb1fe277740..53b51eb894a 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr @@ -1,11 +1,11 @@ error[E0381]: assign to part of possibly uninitialized variable: `x` - --> $DIR/reassignment_immutable_fields_overlapping.rs:22:5 + --> $DIR/reassignment_immutable_fields_overlapping.rs:12:5 | LL | x.a = 1; //~ ERROR | ^^^^^^^ use of possibly uninitialized `x` error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable - --> $DIR/reassignment_immutable_fields_overlapping.rs:23:5 + --> $DIR/reassignment_immutable_fields_overlapping.rs:13:5 | LL | let x: Foo; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.rs b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.rs index add23ec8f24..d7aad6c01bd 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.rs +++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This should never be allowed -- `foo.a` and `foo.b` are // overlapping, so since `x` is not `mut` we should not permit // reassignment. diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr index b0b351889b7..e34024736c6 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to field `x.a` of immutable binding - --> $DIR/reassignment_immutable_fields_overlapping.rs:22:5 + --> $DIR/reassignment_immutable_fields_overlapping.rs:12:5 | LL | let x: Foo; | - help: make this binding mutable: `mut x` @@ -7,7 +7,7 @@ LL | x.a = 1; //~ ERROR | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.b` of immutable binding - --> $DIR/reassignment_immutable_fields_overlapping.rs:23:5 + --> $DIR/reassignment_immutable_fields_overlapping.rs:13:5 | LL | let x: Foo; | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr index 96677be7241..910b8292ec8 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable - --> $DIR/reassignment_immutable_fields_twice.rs:17:5 + --> $DIR/reassignment_immutable_fields_twice.rs:7:5 | LL | let x: (u32, u32); | - help: consider changing this to be mutable: `mut x` @@ -8,7 +8,7 @@ LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot assign error[E0381]: assign to part of possibly uninitialized variable: `x` - --> $DIR/reassignment_immutable_fields_twice.rs:22:5 + --> $DIR/reassignment_immutable_fields_twice.rs:12:5 | LL | x.0 = 1; //~ ERROR | ^^^^^^^ use of possibly uninitialized `x` diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs b/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs index c7e7e5c4533..a10baf627f3 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs +++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This should never be allowed -- since `x` is not `mut`, so `x.0` // cannot be assigned twice. diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr index 65dff51059c..75d7f99ed0c 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to field `x.0` of immutable binding - --> $DIR/reassignment_immutable_fields_twice.rs:17:5 + --> $DIR/reassignment_immutable_fields_twice.rs:7:5 | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` @@ -8,7 +8,7 @@ LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.0` of immutable binding - --> $DIR/reassignment_immutable_fields_twice.rs:22:5 + --> $DIR/reassignment_immutable_fields_twice.rs:12:5 | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` @@ -16,7 +16,7 @@ LL | x.0 = 1; //~ ERROR | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.0` of immutable binding - --> $DIR/reassignment_immutable_fields_twice.rs:23:5 + --> $DIR/reassignment_immutable_fields_twice.rs:13:5 | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` @@ -25,7 +25,7 @@ LL | x.0 = 22; //~ ERROR | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.1` of immutable binding - --> $DIR/reassignment_immutable_fields_twice.rs:24:5 + --> $DIR/reassignment_immutable_fields_twice.rs:14:5 | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.rs b/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.rs index 04f90ea9ad3..da918ba92b8 100644 --- a/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.rs +++ b/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that explicit region bounds are allowed on the various // nominal types (but not on other types) and that they are type // checked. diff --git a/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr b/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr index b139369014e..8d6ac627506 100644 --- a/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr +++ b/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.stderr @@ -1,5 +1,5 @@ error[E0195]: lifetime parameters or bounds on method `no_bound` do not match the trait declaration - --> $DIR/regions-bound-missing-bound-in-impl.rs:29:16 + --> $DIR/regions-bound-missing-bound-in-impl.rs:19:16 | LL | fn no_bound<'b>(self, b: Inv<'b>); | ---- lifetimes in impl do not match this method in trait @@ -8,7 +8,7 @@ LL | fn no_bound<'b:'a>(self, b: Inv<'b>) { | ^^^^^^^ lifetimes do not match method in trait error[E0195]: lifetime parameters or bounds on method `has_bound` do not match the trait declaration - --> $DIR/regions-bound-missing-bound-in-impl.rs:33:17 + --> $DIR/regions-bound-missing-bound-in-impl.rs:23:17 | LL | fn has_bound<'b:'a>(self, b: Inv<'b>); | ------- lifetimes in impl do not match this method in trait @@ -17,26 +17,26 @@ LL | fn has_bound<'b>(self, b: Inv<'b>) { | ^^^^ lifetimes do not match method in trait error[E0308]: method not compatible with trait - --> $DIR/regions-bound-missing-bound-in-impl.rs:37:5 + --> $DIR/regions-bound-missing-bound-in-impl.rs:27:5 | LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `fn(&'a isize, Inv<'c>, Inv<'c>, Inv<'d>)` found type `fn(&'a isize, Inv<'_>, Inv<'c>, Inv<'d>)` -note: the lifetime 'c as defined on the method body at 37:24... - --> $DIR/regions-bound-missing-bound-in-impl.rs:37:24 +note: the lifetime 'c as defined on the method body at 27:24... + --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^ -note: ...does not necessarily outlive the lifetime 'c as defined on the method body at 37:24 - --> $DIR/regions-bound-missing-bound-in-impl.rs:37:24 +note: ...does not necessarily outlive the lifetime 'c as defined on the method body at 27:24 + --> $DIR/regions-bound-missing-bound-in-impl.rs:27:24 | LL | fn wrong_bound1<'b,'c,'d:'a+'c>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>) { | ^^ error[E0195]: lifetime parameters or bounds on method `wrong_bound2` do not match the trait declaration - --> $DIR/regions-bound-missing-bound-in-impl.rs:51:5 + --> $DIR/regions-bound-missing-bound-in-impl.rs:41:5 | LL | fn wrong_bound2<'b,'c,'d:'a+'b>(self, b: Inv<'b>, c: Inv<'c>, d: Inv<'d>); | ---------------- lifetimes in impl do not match this method in trait @@ -45,7 +45,7 @@ LL | fn wrong_bound2(self, b: Inv, c: Inv, d: Inv) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetimes do not match method in trait error[E0276]: impl has stricter requirements than trait - --> $DIR/regions-bound-missing-bound-in-impl.rs:58:5 + --> $DIR/regions-bound-missing-bound-in-impl.rs:48:5 | LL | fn another_bound<'x: 'a>(self, x: Inv<'x>, y: Inv<'t>); | ------------------------------------------------------- definition of `another_bound` from trait diff --git a/src/test/ui/borrowck/regions-escape-bound-fn-2.rs b/src/test/ui/borrowck/regions-escape-bound-fn-2.rs index 1c38dee99a7..cb423032b46 100644 --- a/src/test/ui/borrowck/regions-escape-bound-fn-2.rs +++ b/src/test/ui/borrowck/regions-escape-bound-fn-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn with_int(f: F) where F: FnOnce(&isize) { let x = 3; f(&x); diff --git a/src/test/ui/borrowck/regions-escape-bound-fn-2.stderr b/src/test/ui/borrowck/regions-escape-bound-fn-2.stderr index 05654a93564..4b37edafa12 100644 --- a/src/test/ui/borrowck/regions-escape-bound-fn-2.stderr +++ b/src/test/ui/borrowck/regions-escape-bound-fn-2.stderr @@ -1,5 +1,5 @@ error: borrowed data cannot be stored outside of its closure - --> $DIR/regions-escape-bound-fn-2.rs:18:27 + --> $DIR/regions-escape-bound-fn-2.rs:8:27 | LL | let mut x = None; | ----- borrowed data cannot be stored into here... diff --git a/src/test/ui/borrowck/regions-escape-bound-fn.rs b/src/test/ui/borrowck/regions-escape-bound-fn.rs index c22742371ac..772df3e6c58 100644 --- a/src/test/ui/borrowck/regions-escape-bound-fn.rs +++ b/src/test/ui/borrowck/regions-escape-bound-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn with_int(f: F) where F: FnOnce(&isize) { let x = 3; f(&x); diff --git a/src/test/ui/borrowck/regions-escape-bound-fn.stderr b/src/test/ui/borrowck/regions-escape-bound-fn.stderr index 5f05ee90d07..4973d5306f9 100644 --- a/src/test/ui/borrowck/regions-escape-bound-fn.stderr +++ b/src/test/ui/borrowck/regions-escape-bound-fn.stderr @@ -1,5 +1,5 @@ error: borrowed data cannot be stored outside of its closure - --> $DIR/regions-escape-bound-fn.rs:18:27 + --> $DIR/regions-escape-bound-fn.rs:8:27 | LL | let mut x: Option<&isize> = None; | ----- borrowed data cannot be stored into here... diff --git a/src/test/ui/borrowck/regions-escape-unboxed-closure.rs b/src/test/ui/borrowck/regions-escape-unboxed-closure.rs index 5a214504df4..62ddf4decfc 100644 --- a/src/test/ui/borrowck/regions-escape-unboxed-closure.rs +++ b/src/test/ui/borrowck/regions-escape-unboxed-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn with_int(f: &mut FnMut(&isize)) { } diff --git a/src/test/ui/borrowck/regions-escape-unboxed-closure.stderr b/src/test/ui/borrowck/regions-escape-unboxed-closure.stderr index c90dd2417d0..047e290acae 100644 --- a/src/test/ui/borrowck/regions-escape-unboxed-closure.stderr +++ b/src/test/ui/borrowck/regions-escape-unboxed-closure.stderr @@ -1,5 +1,5 @@ error: borrowed data cannot be stored outside of its closure - --> $DIR/regions-escape-unboxed-closure.rs:16:32 + --> $DIR/regions-escape-unboxed-closure.rs:6:32 | LL | let mut x: Option<&isize> = None; | ----- borrowed data cannot be stored into here... diff --git a/src/test/ui/borrowck/two-phase-across-loop.rs b/src/test/ui/borrowck/two-phase-across-loop.rs index e03a0355b48..b1a4c54f49b 100644 --- a/src/test/ui/borrowck/two-phase-across-loop.rs +++ b/src/test/ui/borrowck/two-phase-across-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a borrow which starts as a 2-phase borrow and gets // carried around a loop winds up conflicting with itself. diff --git a/src/test/ui/borrowck/two-phase-across-loop.stderr b/src/test/ui/borrowck/two-phase-across-loop.stderr index 65c3d27923e..10ff0ca604c 100644 --- a/src/test/ui/borrowck/two-phase-across-loop.stderr +++ b/src/test/ui/borrowck/two-phase-across-loop.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time - --> $DIR/two-phase-across-loop.rs:29:22 + --> $DIR/two-phase-across-loop.rs:19:22 | LL | strings.push(foo.get_string()); //~ ERROR cannot borrow `foo` as mutable | ^^^ mutable borrow starts here in previous iteration of loop diff --git a/src/test/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr b/src/test/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr index ad1dc439c6d..7bae14382d0 100644 --- a/src/test/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr +++ b/src/test/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-activation-sharing-interference.rs:42:15 + --> $DIR/two-phase-activation-sharing-interference.rs:32:15 | LL | let y = &mut x; | ------ mutable borrow occurs here @@ -10,7 +10,7 @@ LL | *y += 1; | ------- mutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-activation-sharing-interference.rs:50:13 + --> $DIR/two-phase-activation-sharing-interference.rs:40:13 | LL | let y = &mut x; | ------ mutable borrow occurs here @@ -21,7 +21,7 @@ LL | *y += 1; | ------- mutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-activation-sharing-interference.rs:61:13 + --> $DIR/two-phase-activation-sharing-interference.rs:51:13 | LL | let y = &mut x; | ------ mutable borrow occurs here @@ -32,7 +32,7 @@ LL | *y += 1; | ------- mutable borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-activation-sharing-interference.rs:72:14 + --> $DIR/two-phase-activation-sharing-interference.rs:62:14 | LL | let y = &mut x; | ------ mutable borrow occurs here diff --git a/src/test/ui/borrowck/two-phase-activation-sharing-interference.rs b/src/test/ui/borrowck/two-phase-activation-sharing-interference.rs index 77b237e34f2..5754220e824 100644 --- a/src/test/ui/borrowck/two-phase-activation-sharing-interference.rs +++ b/src/test/ui/borrowck/two-phase-activation-sharing-interference.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // revisions: nll_target diff --git a/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr index 45cfc836017..232876e6f0b 100644 --- a/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr +++ b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `i` because it was mutably borrowed - --> $DIR/two-phase-allow-access-during-reservation.rs:40:19 + --> $DIR/two-phase-allow-access-during-reservation.rs:30:19 | LL | /*1*/ let p = &mut i; // (reservation of `i` starts here) | ------ borrow of `i` occurs here @@ -11,7 +11,7 @@ LL | /*3*/ *p += 1; // (mutable borrow of `i` starts here, since `p` | ------- borrow later used here error[E0503]: cannot use `i` because it was mutably borrowed - --> $DIR/two-phase-allow-access-during-reservation.rs:45:19 + --> $DIR/two-phase-allow-access-during-reservation.rs:35:19 | LL | /*1*/ let p = &mut i; // (reservation of `i` starts here) | ------ borrow of `i` occurs here diff --git a/src/test/ui/borrowck/two-phase-allow-access-during-reservation.rs b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.rs index 5deabf93764..e428964939a 100644 --- a/src/test/ui/borrowck/two-phase-allow-access-during-reservation.rs +++ b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // revisions: nll_target diff --git a/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.rs b/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.rs index 15700a1d61a..fd1b8841b4e 100644 --- a/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.rs +++ b/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z borrowck=mir -Z two-phase-borrows // This is the third counter-example from Niko's blog post diff --git a/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr b/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr index a3d3da94d54..9123e1890fe 100644 --- a/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr +++ b/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable - --> $DIR/two-phase-cannot-nest-mut-self-calls.rs:26:9 + --> $DIR/two-phase-cannot-nest-mut-self-calls.rs:16:9 | LL | vec.get({ | --- --- immutable borrow later used by call diff --git a/src/test/ui/borrowck/two-phase-method-receivers.rs b/src/test/ui/borrowck/two-phase-method-receivers.rs index 6d7ed61bdd8..f1df1a6a2c8 100644 --- a/src/test/ui/borrowck/two-phase-method-receivers.rs +++ b/src/test/ui/borrowck/two-phase-method-receivers.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z borrowck=mir -Z two-phase-borrows // run-pass diff --git a/src/test/ui/borrowck/two-phase-multi-mut.rs b/src/test/ui/borrowck/two-phase-multi-mut.rs index 2b823628855..ed3d257da9f 100644 --- a/src/test/ui/borrowck/two-phase-multi-mut.rs +++ b/src/test/ui/borrowck/two-phase-multi-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] struct Foo { diff --git a/src/test/ui/borrowck/two-phase-multi-mut.stderr b/src/test/ui/borrowck/two-phase-multi-mut.stderr index a6d311a7b1d..c4168503e4c 100644 --- a/src/test/ui/borrowck/two-phase-multi-mut.stderr +++ b/src/test/ui/borrowck/two-phase-multi-mut.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time - --> $DIR/two-phase-multi-mut.rs:23:5 + --> $DIR/two-phase-multi-mut.rs:13:5 | LL | foo.method(&mut foo); | ^^^^------^--------^ @@ -9,7 +9,7 @@ LL | foo.method(&mut foo); | second mutable borrow occurs here error[E0499]: cannot borrow `foo` as mutable more than once at a time - --> $DIR/two-phase-multi-mut.rs:23:16 + --> $DIR/two-phase-multi-mut.rs:13:16 | LL | foo.method(&mut foo); | --- ------ ^^^^^^^^ second mutable borrow occurs here diff --git a/src/test/ui/borrowck/two-phase-multiple-activations.rs b/src/test/ui/borrowck/two-phase-multiple-activations.rs index 9ea9696511b..38ba0948640 100644 --- a/src/test/ui/borrowck/two-phase-multiple-activations.rs +++ b/src/test/ui/borrowck/two-phase-multiple-activations.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z borrowck=mir -Z two-phase-borrows // run-pass diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.nll.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.nll.stderr index a272d2cf019..d026f81b7aa 100644 --- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.nll.stderr +++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*f` as mutable more than once at a time - --> $DIR/two-phase-nonrecv-autoref.rs:70:11 + --> $DIR/two-phase-nonrecv-autoref.rs:60:11 | LL | f(f(10)); | - ^ second mutable borrow occurs here @@ -8,15 +8,19 @@ LL | f(f(10)); | first borrow later used by call error[E0382]: use of moved value: `*f` - --> $DIR/two-phase-nonrecv-autoref.rs:79:11 + --> $DIR/two-phase-nonrecv-autoref.rs:69:11 | +LL | fn twice_ten_so i32>(f: Box) { + | - consider adding a `Copy` constraint to this type argument LL | f(f(10)); | - ^ value used here after move | | | value moved here + | + = note: move occurs because `*f` has type `F`, which does not implement the `Copy` trait error[E0499]: cannot borrow `*f` as mutable more than once at a time - --> $DIR/two-phase-nonrecv-autoref.rs:86:11 + --> $DIR/two-phase-nonrecv-autoref.rs:76:11 | LL | f(f(10)); | - ^ second mutable borrow occurs here @@ -25,27 +29,29 @@ LL | f(f(10)); | first borrow later used by call error[E0161]: cannot move a value of type dyn std::ops::FnOnce(i32) -> i32: the size of dyn std::ops::FnOnce(i32) -> i32 cannot be statically determined - --> $DIR/two-phase-nonrecv-autoref.rs:95:9 + --> $DIR/two-phase-nonrecv-autoref.rs:85:9 | LL | f(f(10)); | ^ error[E0161]: cannot move a value of type dyn std::ops::FnOnce(i32) -> i32: the size of dyn std::ops::FnOnce(i32) -> i32 cannot be statically determined - --> $DIR/two-phase-nonrecv-autoref.rs:95:11 + --> $DIR/two-phase-nonrecv-autoref.rs:85:11 | LL | f(f(10)); | ^ error[E0382]: use of moved value: `*f` - --> $DIR/two-phase-nonrecv-autoref.rs:95:11 + --> $DIR/two-phase-nonrecv-autoref.rs:85:11 | LL | f(f(10)); | - ^ value used here after move | | | value moved here + | + = note: move occurs because `*f` has type `dyn std::ops::FnOnce(i32) -> i32`, which does not implement the `Copy` trait error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:139:27 + --> $DIR/two-phase-nonrecv-autoref.rs:129:27 | LL | double_access(&mut a, &a); | ------------- ------ ^^ immutable borrow occurs here @@ -54,7 +60,7 @@ LL | double_access(&mut a, &a); | mutable borrow later used by call error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:167:7 + --> $DIR/two-phase-nonrecv-autoref.rs:157:7 | LL | i[i[3]] = 4; | --^---- @@ -64,7 +70,7 @@ LL | i[i[3]] = 4; | mutable borrow later used here error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:173:7 + --> $DIR/two-phase-nonrecv-autoref.rs:163:7 | LL | i[i[3]] = i[4]; | --^---- diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.stderr index b64323a5cc4..426939f371c 100644 --- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.stderr +++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `*x` because it was mutably borrowed - --> $DIR/two-phase-nonrecv-autoref.rs:41:12 + --> $DIR/two-phase-nonrecv-autoref.rs:31:12 | LL | foo(x, *x); | - ^^ use of borrowed `*x` @@ -7,7 +7,7 @@ LL | foo(x, *x); | borrow of `*x` occurs here error[E0499]: cannot borrow `*f` as mutable more than once at a time - --> $DIR/two-phase-nonrecv-autoref.rs:70:11 + --> $DIR/two-phase-nonrecv-autoref.rs:60:11 | LL | f(f(10)); | - ^ - first borrow ends here @@ -16,7 +16,7 @@ LL | f(f(10)); | first mutable borrow occurs here error[E0382]: use of moved value: `*f` - --> $DIR/two-phase-nonrecv-autoref.rs:79:11 + --> $DIR/two-phase-nonrecv-autoref.rs:69:11 | LL | f(f(10)); | - ^ value used here after move @@ -26,7 +26,7 @@ LL | f(f(10)); = note: move occurs because `*f` has type `F`, which does not implement the `Copy` trait error[E0499]: cannot borrow `*f` as mutable more than once at a time - --> $DIR/two-phase-nonrecv-autoref.rs:86:11 + --> $DIR/two-phase-nonrecv-autoref.rs:76:11 | LL | f(f(10)); | - ^ - first borrow ends here @@ -35,7 +35,7 @@ LL | f(f(10)); | first mutable borrow occurs here error[E0382]: use of moved value: `*f` - --> $DIR/two-phase-nonrecv-autoref.rs:95:11 + --> $DIR/two-phase-nonrecv-autoref.rs:85:11 | LL | f(f(10)); | - ^ value used here after move @@ -45,7 +45,7 @@ LL | f(f(10)); = note: move occurs because `*f` has type `(dyn std::ops::FnOnce(i32) -> i32 + 'static)`, which does not implement the `Copy` trait error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:139:28 + --> $DIR/two-phase-nonrecv-autoref.rs:129:28 | LL | double_access(&mut a, &a); | - ^- mutable borrow ends here @@ -54,7 +54,7 @@ LL | double_access(&mut a, &a); | mutable borrow occurs here error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:145:9 + --> $DIR/two-phase-nonrecv-autoref.rs:135:9 | LL | a.m(a.i(10)); | - ^ - mutable borrow ends here @@ -63,7 +63,7 @@ LL | a.m(a.i(10)); | mutable borrow occurs here error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:167:7 + --> $DIR/two-phase-nonrecv-autoref.rs:157:7 | LL | i[i[3]] = 4; | - ^ - mutable borrow ends here @@ -72,7 +72,7 @@ LL | i[i[3]] = 4; | mutable borrow occurs here error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:173:7 + --> $DIR/two-phase-nonrecv-autoref.rs:163:7 | LL | i[i[3]] = i[4]; | - ^ - mutable borrow ends here @@ -81,7 +81,7 @@ LL | i[i[3]] = i[4]; | mutable borrow occurs here error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:182:12 + --> $DIR/two-phase-nonrecv-autoref.rs:172:12 | LL | v.push(v.len()); | - ^ - mutable borrow ends here @@ -90,7 +90,7 @@ LL | v.push(v.len()); | mutable borrow occurs here error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:193:9 + --> $DIR/two-phase-nonrecv-autoref.rs:183:9 | LL | s.m(s.i(10)); | - ^ - mutable borrow ends here @@ -99,7 +99,7 @@ LL | s.m(s.i(10)); | mutable borrow occurs here error[E0502]: cannot borrow `t` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:198:9 + --> $DIR/two-phase-nonrecv-autoref.rs:188:9 | LL | t.m(t.i(10)); | - ^ - mutable borrow ends here diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr index a272d2cf019..d026f81b7aa 100644 --- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr +++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*f` as mutable more than once at a time - --> $DIR/two-phase-nonrecv-autoref.rs:70:11 + --> $DIR/two-phase-nonrecv-autoref.rs:60:11 | LL | f(f(10)); | - ^ second mutable borrow occurs here @@ -8,15 +8,19 @@ LL | f(f(10)); | first borrow later used by call error[E0382]: use of moved value: `*f` - --> $DIR/two-phase-nonrecv-autoref.rs:79:11 + --> $DIR/two-phase-nonrecv-autoref.rs:69:11 | +LL | fn twice_ten_so i32>(f: Box) { + | - consider adding a `Copy` constraint to this type argument LL | f(f(10)); | - ^ value used here after move | | | value moved here + | + = note: move occurs because `*f` has type `F`, which does not implement the `Copy` trait error[E0499]: cannot borrow `*f` as mutable more than once at a time - --> $DIR/two-phase-nonrecv-autoref.rs:86:11 + --> $DIR/two-phase-nonrecv-autoref.rs:76:11 | LL | f(f(10)); | - ^ second mutable borrow occurs here @@ -25,27 +29,29 @@ LL | f(f(10)); | first borrow later used by call error[E0161]: cannot move a value of type dyn std::ops::FnOnce(i32) -> i32: the size of dyn std::ops::FnOnce(i32) -> i32 cannot be statically determined - --> $DIR/two-phase-nonrecv-autoref.rs:95:9 + --> $DIR/two-phase-nonrecv-autoref.rs:85:9 | LL | f(f(10)); | ^ error[E0161]: cannot move a value of type dyn std::ops::FnOnce(i32) -> i32: the size of dyn std::ops::FnOnce(i32) -> i32 cannot be statically determined - --> $DIR/two-phase-nonrecv-autoref.rs:95:11 + --> $DIR/two-phase-nonrecv-autoref.rs:85:11 | LL | f(f(10)); | ^ error[E0382]: use of moved value: `*f` - --> $DIR/two-phase-nonrecv-autoref.rs:95:11 + --> $DIR/two-phase-nonrecv-autoref.rs:85:11 | LL | f(f(10)); | - ^ value used here after move | | | value moved here + | + = note: move occurs because `*f` has type `dyn std::ops::FnOnce(i32) -> i32`, which does not implement the `Copy` trait error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:139:27 + --> $DIR/two-phase-nonrecv-autoref.rs:129:27 | LL | double_access(&mut a, &a); | ------------- ------ ^^ immutable borrow occurs here @@ -54,7 +60,7 @@ LL | double_access(&mut a, &a); | mutable borrow later used by call error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:167:7 + --> $DIR/two-phase-nonrecv-autoref.rs:157:7 | LL | i[i[3]] = 4; | --^---- @@ -64,7 +70,7 @@ LL | i[i[3]] = 4; | mutable borrow later used here error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-nonrecv-autoref.rs:173:7 + --> $DIR/two-phase-nonrecv-autoref.rs:163:7 | LL | i[i[3]] = i[4]; | --^---- diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs index 30752e8ddb1..1a14cb90f38 100644 --- a/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs +++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast nll //[ast]compile-flags: //[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows @@ -49,7 +39,7 @@ fn deref_coercion(x: &mut u32) { // // - [x] Resolving overloaded_call_traits (call, call_mut, call_once) // - [x] deref_coercion (shown above) -// - [x] coerce_unsized e.g. `&[T; n]`, `&mut [T; n] -> &[T]`, +// - [x] coerce_unsized e.g., `&[T; n]`, `&mut [T; n] -> &[T]`, // `&mut [T; n] -> &mut [T]`, `&Concrete -> &Trait` // - [x] Method Call Receivers (the case we want to support!) // - [x] ExprKind::Index and ExprKind::Unary Deref; only need to handle coerce_index_op diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.rs b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.rs index f9326d944b8..13c1df7db2b 100644 --- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.rs +++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z borrowck=mir -Z two-phase-borrows // This is similar to two-phase-reservation-sharing-interference.rs diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr index 2ac10a82f7b..ad4636a4a91 100644 --- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr +++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/two-phase-reservation-sharing-interference-2.rs:27:1 + --> $DIR/two-phase-reservation-sharing-interference-2.rs:17:1 | LL | / fn main() { //~ ERROR compilation successful LL | | let mut v = vec![0, 1, 2]; diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr index 21f54881b00..7b64d9d4002 100644 --- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr +++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable - --> $DIR/two-phase-reservation-sharing-interference.rs:46:17 + --> $DIR/two-phase-reservation-sharing-interference.rs:36:17 | LL | let shared = &vec; | ---- immutable borrow occurs here diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs index 1e86603c19e..f5fa8218edc 100644 --- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs +++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // revisions: nll_target diff --git a/src/test/ui/borrowck/two-phase-sneaky.nll.stderr b/src/test/ui/borrowck/two-phase-sneaky.nll.stderr index 4847f6cec86..c66f3cbed91 100644 --- a/src/test/ui/borrowck/two-phase-sneaky.nll.stderr +++ b/src/test/ui/borrowck/two-phase-sneaky.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time - --> $DIR/two-phase-sneaky.rs:22:9 + --> $DIR/two-phase-sneaky.rs:12:9 | LL | v[0].push_str({ | - -------- first borrow later used by call diff --git a/src/test/ui/borrowck/two-phase-sneaky.rs b/src/test/ui/borrowck/two-phase-sneaky.rs index eec4b470d75..abfa13da6af 100644 --- a/src/test/ui/borrowck/two-phase-sneaky.rs +++ b/src/test/ui/borrowck/two-phase-sneaky.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // cmpile-flags: -Z borrowck=mir -Z two-phase-borrows // This is the first counter-example from Niko's blog post diff --git a/src/test/ui/borrowck/two-phase-sneaky.stderr b/src/test/ui/borrowck/two-phase-sneaky.stderr index 1ab9c188482..38f24ccd606 100644 --- a/src/test/ui/borrowck/two-phase-sneaky.stderr +++ b/src/test/ui/borrowck/two-phase-sneaky.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time - --> $DIR/two-phase-sneaky.rs:22:9 + --> $DIR/two-phase-sneaky.rs:12:9 | LL | v[0].push_str({ | - first mutable borrow occurs here diff --git a/src/test/ui/borrowck/two-phase-surprise-no-conflict.ast.stderr b/src/test/ui/borrowck/two-phase-surprise-no-conflict.ast.stderr index 6e7f35d1fda..a2e5c7e88e8 100644 --- a/src/test/ui/borrowck/two-phase-surprise-no-conflict.ast.stderr +++ b/src/test/ui/borrowck/two-phase-surprise-no-conflict.ast.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `self.cx` because it was mutably borrowed - --> $DIR/two-phase-surprise-no-conflict.rs:40:13 + --> $DIR/two-phase-surprise-no-conflict.rs:30:13 | LL | let _mut_borrow = &mut *self; | ----- borrow of `*self` occurs here @@ -7,7 +7,7 @@ LL | let _access = self.cx; | ^^^^^^^ use of borrowed `*self` error[E0502]: cannot borrow `*self.cx_mut` as immutable because `*self` is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:79:33 + --> $DIR/two-phase-surprise-no-conflict.rs:69:33 | LL | self.hash_expr(&self.cx_mut.body(eid).value); | ---- ^^^^^^^^^^^ - mutable borrow ends here @@ -16,7 +16,7 @@ LL | self.hash_expr(&self.cx_mut.body(eid).value); | mutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:131:52 + --> $DIR/two-phase-surprise-no-conflict.rs:121:52 | LL | reg.register_static(Box::new(TrivialPass::new(®.sess_mut))); | --- ^^^^^^^^^^^^ - mutable borrow ends here @@ -24,7 +24,7 @@ LL | reg.register_static(Box::new(TrivialPass::new(®.sess_mut))); | mutable borrow occurs here immutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:135:51 + --> $DIR/two-phase-surprise-no-conflict.rs:125:51 | LL | reg.register_bound(Box::new(TrivialPass::new(®.sess_mut))); | --- ^^^^^^^^^^^^ - mutable borrow ends here @@ -32,7 +32,7 @@ LL | reg.register_bound(Box::new(TrivialPass::new(®.sess_mut))); | mutable borrow occurs here immutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:139:50 + --> $DIR/two-phase-surprise-no-conflict.rs:129:50 | LL | reg.register_univ(Box::new(TrivialPass::new(®.sess_mut))); | --- ^^^^^^^^^^^^ - mutable borrow ends here @@ -40,7 +40,7 @@ LL | reg.register_univ(Box::new(TrivialPass::new(®.sess_mut))); | mutable borrow occurs here immutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:143:41 + --> $DIR/two-phase-surprise-no-conflict.rs:133:41 | LL | reg.register_ref(&TrivialPass::new(®.sess_mut)); | --- ^^^^^^^^^^^^ - mutable borrow ends here @@ -48,7 +48,7 @@ LL | reg.register_ref(&TrivialPass::new(®.sess_mut)); | mutable borrow occurs here immutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:151:56 + --> $DIR/two-phase-surprise-no-conflict.rs:141:56 | LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut))); | --- ^^^^^^^^^^^^ - first borrow ends here @@ -56,7 +56,7 @@ LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut))); | first mutable borrow occurs here second mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:156:59 + --> $DIR/two-phase-surprise-no-conflict.rs:146:59 | LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); | --- ^^^^^^^^^^^^ - first borrow ends here @@ -64,7 +64,7 @@ LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); | first mutable borrow occurs here second mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:161:58 + --> $DIR/two-phase-surprise-no-conflict.rs:151:58 | LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); | --- ^^^^^^^^^^^^ - first borrow ends here @@ -72,7 +72,7 @@ LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); | first mutable borrow occurs here second mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:166:49 + --> $DIR/two-phase-surprise-no-conflict.rs:156:49 | LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut)); | --- ^^^^^^^^^^^^ - first borrow ends here @@ -80,7 +80,7 @@ LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut)); | first mutable borrow occurs here second mutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:178:51 + --> $DIR/two-phase-surprise-no-conflict.rs:168:51 | LL | reg.register_bound(Box::new(CapturePass::new(®.sess_mut))); | --- ^^^^^^^^^^^^ - mutable borrow ends here @@ -88,7 +88,7 @@ LL | reg.register_bound(Box::new(CapturePass::new(®.sess_mut))); | mutable borrow occurs here immutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:183:50 + --> $DIR/two-phase-surprise-no-conflict.rs:173:50 | LL | reg.register_univ(Box::new(CapturePass::new(®.sess_mut))); | --- ^^^^^^^^^^^^ - mutable borrow ends here @@ -96,7 +96,7 @@ LL | reg.register_univ(Box::new(CapturePass::new(®.sess_mut))); | mutable borrow occurs here immutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because `*reg` is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:188:41 + --> $DIR/two-phase-surprise-no-conflict.rs:178:41 | LL | reg.register_ref(&CapturePass::new(®.sess_mut)); | --- ^^^^^^^^^^^^ - mutable borrow ends here @@ -104,7 +104,7 @@ LL | reg.register_ref(&CapturePass::new(®.sess_mut)); | mutable borrow occurs here immutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:200:59 + --> $DIR/two-phase-surprise-no-conflict.rs:190:59 | LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | --- ^^^^^^^^^^^^ - first borrow ends here @@ -112,7 +112,7 @@ LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | first mutable borrow occurs here second mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:206:58 + --> $DIR/two-phase-surprise-no-conflict.rs:196:58 | LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | --- ^^^^^^^^^^^^ - first borrow ends here @@ -120,7 +120,7 @@ LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | first mutable borrow occurs here second mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:212:49 + --> $DIR/two-phase-surprise-no-conflict.rs:202:49 | LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut)); | --- ^^^^^^^^^^^^ - first borrow ends here diff --git a/src/test/ui/borrowck/two-phase-surprise-no-conflict.nll.stderr b/src/test/ui/borrowck/two-phase-surprise-no-conflict.nll.stderr index 5a90a9ff52c..1ac3a696704 100644 --- a/src/test/ui/borrowck/two-phase-surprise-no-conflict.nll.stderr +++ b/src/test/ui/borrowck/two-phase-surprise-no-conflict.nll.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `self.cx` because it was mutably borrowed - --> $DIR/two-phase-surprise-no-conflict.rs:40:23 + --> $DIR/two-phase-surprise-no-conflict.rs:30:23 | LL | let _mut_borrow = &mut *self; | ---------- borrow of `*self` occurs here @@ -10,7 +10,7 @@ LL | _mut_borrow; | ----------- borrow later used here error[E0502]: cannot borrow `*self` as mutable because it is also borrowed as immutable - --> $DIR/two-phase-surprise-no-conflict.rs:79:17 + --> $DIR/two-phase-surprise-no-conflict.rs:69:17 | LL | self.hash_expr(&self.cx_mut.body(eid).value); | ^^^^^---------^^-----------^^^^^^^^^^^^^^^^^ @@ -20,7 +20,7 @@ LL | self.hash_expr(&self.cx_mut.body(eid).value); | mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:151:51 + --> $DIR/two-phase-surprise-no-conflict.rs:141:51 | LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut))); | --- --------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here @@ -29,7 +29,7 @@ LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut))); | first mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:156:54 + --> $DIR/two-phase-surprise-no-conflict.rs:146:54 | LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here @@ -38,7 +38,7 @@ LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); | first mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:161:53 + --> $DIR/two-phase-surprise-no-conflict.rs:151:53 | LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here @@ -47,7 +47,7 @@ LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); | first mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:166:44 + --> $DIR/two-phase-surprise-no-conflict.rs:156:44 | LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut)); | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here @@ -56,7 +56,7 @@ LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut)); | first mutable borrow occurs here error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable - --> $DIR/two-phase-surprise-no-conflict.rs:178:5 + --> $DIR/two-phase-surprise-no-conflict.rs:168:5 | LL | reg.register_bound(Box::new(CapturePass::new(®.sess_mut))); | ^^^^--------------^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^^^ @@ -66,7 +66,7 @@ LL | reg.register_bound(Box::new(CapturePass::new(®.sess_mut))); | mutable borrow occurs here error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable - --> $DIR/two-phase-surprise-no-conflict.rs:183:5 + --> $DIR/two-phase-surprise-no-conflict.rs:173:5 | LL | fn register_plugins<'a>(mk_reg: impl Fn() -> &'a mut Registry<'a>) { | -- lifetime `'a` defined here @@ -79,7 +79,7 @@ LL | reg.register_univ(Box::new(CapturePass::new(®.sess_mut))); | mutable borrow occurs here error[E0502]: cannot borrow `*reg` as mutable because it is also borrowed as immutable - --> $DIR/two-phase-surprise-no-conflict.rs:188:5 + --> $DIR/two-phase-surprise-no-conflict.rs:178:5 | LL | reg.register_ref(&CapturePass::new(®.sess_mut)); | ^^^^------------^^^^^^^^^^^^^^^^^^^-------------^^ @@ -89,7 +89,7 @@ LL | reg.register_ref(&CapturePass::new(®.sess_mut)); | mutable borrow occurs here error[E0499]: cannot borrow `*reg` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:200:5 + --> $DIR/two-phase-surprise-no-conflict.rs:190:5 | LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | ^^^^--------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------^^^ @@ -99,7 +99,7 @@ LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | second mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:200:54 + --> $DIR/two-phase-surprise-no-conflict.rs:190:54 | LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here @@ -108,7 +108,7 @@ LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | first mutable borrow occurs here error[E0499]: cannot borrow `*reg` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:206:5 + --> $DIR/two-phase-surprise-no-conflict.rs:196:5 | LL | fn register_plugins<'a>(mk_reg: impl Fn() -> &'a mut Registry<'a>) { | -- lifetime `'a` defined here @@ -121,7 +121,7 @@ LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | second mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:206:53 + --> $DIR/two-phase-surprise-no-conflict.rs:196:53 | LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here @@ -130,7 +130,7 @@ LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | first mutable borrow occurs here error[E0499]: cannot borrow `*reg` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:212:5 + --> $DIR/two-phase-surprise-no-conflict.rs:202:5 | LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut)); | ^^^^------------^^^^^^^^^^^^^^^^^^^^^^^-----------------^^ @@ -140,7 +140,7 @@ LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut)); | second mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:212:44 + --> $DIR/two-phase-surprise-no-conflict.rs:202:44 | LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut)); | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here diff --git a/src/test/ui/borrowck/two-phase-surprise-no-conflict.no2pb.stderr b/src/test/ui/borrowck/two-phase-surprise-no-conflict.no2pb.stderr index 06ac92b18e1..9b46567318c 100644 --- a/src/test/ui/borrowck/two-phase-surprise-no-conflict.no2pb.stderr +++ b/src/test/ui/borrowck/two-phase-surprise-no-conflict.no2pb.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `self.cx` because it was mutably borrowed - --> $DIR/two-phase-surprise-no-conflict.rs:40:23 + --> $DIR/two-phase-surprise-no-conflict.rs:30:23 | LL | let _mut_borrow = &mut *self; | ---------- borrow of `*self` occurs here @@ -10,7 +10,7 @@ LL | _mut_borrow; | ----------- borrow later used here error[E0502]: cannot borrow `*self.cx` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:64:33 + --> $DIR/two-phase-surprise-no-conflict.rs:54:33 | LL | self.hash_expr(&self.cx.body(eid).value); | ---- --------- ^^^^^^^ immutable borrow occurs here @@ -19,7 +19,7 @@ LL | self.hash_expr(&self.cx.body(eid).value); | mutable borrow occurs here error[E0502]: cannot borrow `*self.cx_mut` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:79:33 + --> $DIR/two-phase-surprise-no-conflict.rs:69:33 | LL | self.hash_expr(&self.cx_mut.body(eid).value); | ---- --------- ^^^^^^^^^^^ immutable borrow occurs here @@ -28,7 +28,7 @@ LL | self.hash_expr(&self.cx_mut.body(eid).value); | mutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:131:51 + --> $DIR/two-phase-surprise-no-conflict.rs:121:51 | LL | reg.register_static(Box::new(TrivialPass::new(®.sess_mut))); | --- --------------- ^^^^^^^^^^^^^ immutable borrow occurs here @@ -37,7 +37,7 @@ LL | reg.register_static(Box::new(TrivialPass::new(®.sess_mut))); | mutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:135:50 + --> $DIR/two-phase-surprise-no-conflict.rs:125:50 | LL | reg.register_bound(Box::new(TrivialPass::new(®.sess_mut))); | --- -------------- ^^^^^^^^^^^^^ immutable borrow occurs here @@ -46,7 +46,7 @@ LL | reg.register_bound(Box::new(TrivialPass::new(®.sess_mut))); | mutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:139:49 + --> $DIR/two-phase-surprise-no-conflict.rs:129:49 | LL | reg.register_univ(Box::new(TrivialPass::new(®.sess_mut))); | --- ------------- ^^^^^^^^^^^^^ immutable borrow occurs here @@ -55,7 +55,7 @@ LL | reg.register_univ(Box::new(TrivialPass::new(®.sess_mut))); | mutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:143:40 + --> $DIR/two-phase-surprise-no-conflict.rs:133:40 | LL | reg.register_ref(&TrivialPass::new(®.sess_mut)); | --- ------------ ^^^^^^^^^^^^^ immutable borrow occurs here @@ -64,7 +64,7 @@ LL | reg.register_ref(&TrivialPass::new(®.sess_mut)); | mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:151:51 + --> $DIR/two-phase-surprise-no-conflict.rs:141:51 | LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut))); | --- --------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here @@ -73,7 +73,7 @@ LL | reg.register_static(Box::new(TrivialPass::new(&mut reg.sess_mut))); | first mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:156:54 + --> $DIR/two-phase-surprise-no-conflict.rs:146:54 | LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here @@ -82,7 +82,7 @@ LL | reg.register_bound(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); | first mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:161:53 + --> $DIR/two-phase-surprise-no-conflict.rs:151:53 | LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here @@ -91,7 +91,7 @@ LL | reg.register_univ(Box::new(TrivialPass::new_mut(&mut reg.sess_mut))); | first mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:166:44 + --> $DIR/two-phase-surprise-no-conflict.rs:156:44 | LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut)); | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here @@ -100,7 +100,7 @@ LL | reg.register_ref(&TrivialPass::new_mut(&mut reg.sess_mut)); | first mutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:178:50 + --> $DIR/two-phase-surprise-no-conflict.rs:168:50 | LL | reg.register_bound(Box::new(CapturePass::new(®.sess_mut))); | --- -------------- ^^^^^^^^^^^^^ immutable borrow occurs here @@ -109,7 +109,7 @@ LL | reg.register_bound(Box::new(CapturePass::new(®.sess_mut))); | mutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:183:49 + --> $DIR/two-phase-surprise-no-conflict.rs:173:49 | LL | reg.register_univ(Box::new(CapturePass::new(®.sess_mut))); | --- ------------- ^^^^^^^^^^^^^ immutable borrow occurs here @@ -118,7 +118,7 @@ LL | reg.register_univ(Box::new(CapturePass::new(®.sess_mut))); | mutable borrow occurs here error[E0502]: cannot borrow `reg.sess_mut` as immutable because it is also borrowed as mutable - --> $DIR/two-phase-surprise-no-conflict.rs:188:40 + --> $DIR/two-phase-surprise-no-conflict.rs:178:40 | LL | reg.register_ref(&CapturePass::new(®.sess_mut)); | --- ------------ ^^^^^^^^^^^^^ immutable borrow occurs here @@ -127,7 +127,7 @@ LL | reg.register_ref(&CapturePass::new(®.sess_mut)); | mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:200:54 + --> $DIR/two-phase-surprise-no-conflict.rs:190:54 | LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | --- -------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here @@ -136,7 +136,7 @@ LL | reg.register_bound(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | first mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:206:53 + --> $DIR/two-phase-surprise-no-conflict.rs:196:53 | LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | --- ------------- ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here @@ -145,7 +145,7 @@ LL | reg.register_univ(Box::new(CapturePass::new_mut(&mut reg.sess_mut))); | first mutable borrow occurs here error[E0499]: cannot borrow `reg.sess_mut` as mutable more than once at a time - --> $DIR/two-phase-surprise-no-conflict.rs:212:44 + --> $DIR/two-phase-surprise-no-conflict.rs:202:44 | LL | reg.register_ref(&CapturePass::new_mut(&mut reg.sess_mut)); | --- ------------ ^^^^^^^^^^^^^^^^^ second mutable borrow occurs here diff --git a/src/test/ui/borrowck/two-phase-surprise-no-conflict.rs b/src/test/ui/borrowck/two-phase-surprise-no-conflict.rs index 36bf44afb15..f097defa224 100644 --- a/src/test/ui/borrowck/two-phase-surprise-no-conflict.rs +++ b/src/test/ui/borrowck/two-phase-surprise-no-conflict.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is a test adapted from a minimization of the code from // rust-lang/rust#52934, where an accidental disabling of // two-phase-borrows (in the initial 2018 edition integration) broke diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr index 0eb5fc8c324..d6125cfd721 100644 --- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr +++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9 + --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:11:9 | LL | let y = vec![format!("World")]; | - captured outer variable diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs index cd9f1636c3f..4c6a05338a1 100644 --- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs +++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a by-ref `FnMut` closure gets an error when it tries to // consume a value. diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr index f2f8ae8c08c..bdfd6fb7e55 100644 --- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr +++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure - --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9 + --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:11:9 | LL | let y = vec![format!("World")]; | - captured outer variable diff --git a/src/test/ui/bounds-lifetime.rs b/src/test/ui/bounds-lifetime.rs index 5bfaa6c54fa..8abfe3e4b76 100644 --- a/src/test/ui/bounds-lifetime.rs +++ b/src/test/ui/bounds-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type A = for<'b, 'a: 'b> fn(); //~ ERROR lifetime bounds cannot be used in this context type B = for<'b, 'a: 'b,> fn(); //~ ERROR lifetime bounds cannot be used in this context type C = for<'b, 'a: 'b +> fn(); //~ ERROR lifetime bounds cannot be used in this context diff --git a/src/test/ui/bounds-lifetime.stderr b/src/test/ui/bounds-lifetime.stderr index cbd140c13be..d57cb40b2a8 100644 --- a/src/test/ui/bounds-lifetime.stderr +++ b/src/test/ui/bounds-lifetime.stderr @@ -1,29 +1,29 @@ error: lifetime bounds cannot be used in this context - --> $DIR/bounds-lifetime.rs:11:22 + --> $DIR/bounds-lifetime.rs:1:22 | LL | type A = for<'b, 'a: 'b> fn(); //~ ERROR lifetime bounds cannot be used in this context | ^^ error: lifetime bounds cannot be used in this context - --> $DIR/bounds-lifetime.rs:12:22 + --> $DIR/bounds-lifetime.rs:2:22 | LL | type B = for<'b, 'a: 'b,> fn(); //~ ERROR lifetime bounds cannot be used in this context | ^^ error: lifetime bounds cannot be used in this context - --> $DIR/bounds-lifetime.rs:13:22 + --> $DIR/bounds-lifetime.rs:3:22 | LL | type C = for<'b, 'a: 'b +> fn(); //~ ERROR lifetime bounds cannot be used in this context | ^^ error: only lifetime parameters can be used in this context - --> $DIR/bounds-lifetime.rs:14:18 + --> $DIR/bounds-lifetime.rs:4:18 | LL | type D = for<'a, T> fn(); //~ ERROR only lifetime parameters can be used in this context | ^ error: only lifetime parameters can be used in this context - --> $DIR/bounds-lifetime.rs:15:14 + --> $DIR/bounds-lifetime.rs:5:14 | LL | type E = for Fn(); //~ ERROR only lifetime parameters can be used in this context | ^ diff --git a/src/test/ui/break-outside-loop.rs b/src/test/ui/break-outside-loop.rs index 1f257b8a5cb..fef298f7c39 100644 --- a/src/test/ui/break-outside-loop.rs +++ b/src/test/ui/break-outside-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { t: String } diff --git a/src/test/ui/break-outside-loop.stderr b/src/test/ui/break-outside-loop.stderr index 820272d7e80..5e008a06477 100644 --- a/src/test/ui/break-outside-loop.stderr +++ b/src/test/ui/break-outside-loop.stderr @@ -1,29 +1,29 @@ error[E0268]: `break` outside of loop - --> $DIR/break-outside-loop.rs:20:15 + --> $DIR/break-outside-loop.rs:10:15 | LL | let pth = break; //~ ERROR: `break` outside of loop | ^^^^^ cannot break outside of a loop error[E0268]: `continue` outside of loop - --> $DIR/break-outside-loop.rs:21:17 + --> $DIR/break-outside-loop.rs:11:17 | LL | if cond() { continue } //~ ERROR: `continue` outside of loop | ^^^^^^^^ cannot break outside of a loop error[E0267]: `break` inside of a closure - --> $DIR/break-outside-loop.rs:27:25 + --> $DIR/break-outside-loop.rs:17:25 | LL | if cond() { break } //~ ERROR: `break` inside of a closure | ^^^^^ cannot break inside of a closure error[E0267]: `continue` inside of a closure - --> $DIR/break-outside-loop.rs:28:25 + --> $DIR/break-outside-loop.rs:18:25 | LL | if cond() { continue } //~ ERROR: `continue` inside of a closure | ^^^^^^^^ cannot break inside of a closure error[E0268]: `break` outside of loop - --> $DIR/break-outside-loop.rs:34:25 + --> $DIR/break-outside-loop.rs:24:25 | LL | let unconstrained = break; //~ ERROR: `break` outside of loop | ^^^^^ cannot break outside of a loop diff --git a/src/test/ui/break-while-condition.rs b/src/test/ui/break-while-condition.rs index 050b479d485..6064e6ab002 100644 --- a/src/test/ui/break-while-condition.rs +++ b/src/test/ui/break-while-condition.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(never_type)] fn main() { diff --git a/src/test/ui/break-while-condition.stderr b/src/test/ui/break-while-condition.stderr index 9d22dcce454..3e81753a410 100644 --- a/src/test/ui/break-while-condition.stderr +++ b/src/test/ui/break-while-condition.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/break-while-condition.rs:19:20 + --> $DIR/break-while-condition.rs:9:20 | LL | let _: ! = { //~ ERROR mismatched types | ____________________^ @@ -11,7 +11,7 @@ LL | | }; found type `()` error[E0308]: mismatched types - --> $DIR/break-while-condition.rs:26:13 + --> $DIR/break-while-condition.rs:16:13 | LL | / while false { //~ ERROR mismatched types LL | | break @@ -22,7 +22,7 @@ LL | | } found type `()` error[E0308]: mismatched types - --> $DIR/break-while-condition.rs:34:13 + --> $DIR/break-while-condition.rs:24:13 | LL | / while false { //~ ERROR mismatched types LL | | return diff --git a/src/test/ui/builtin-superkinds/auxiliary/trait_superkinds_in_metadata.rs b/src/test/ui/builtin-superkinds/auxiliary/trait_superkinds_in_metadata.rs index 0fa2d3459f4..acfd1e13e93 100644 --- a/src/test/ui/builtin-superkinds/auxiliary/trait_superkinds_in_metadata.rs +++ b/src/test/ui/builtin-superkinds/auxiliary/trait_superkinds_in_metadata.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test library crate for cross-crate usages of traits inheriting // from the builtin kinds. Mostly tests metadata correctness. diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.rs index 3f7f2adabdf..e716489c24a 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.rs +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for traits that inherit from multiple builtin kinds at once, // testing that all such kinds must be present on implementing types. diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr index a462fcf4de4..9771436d167 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr @@ -1,5 +1,5 @@ error[E0277]: `T` cannot be sent between threads safely - --> $DIR/builtin-superkinds-double-superkind.rs:16:24 + --> $DIR/builtin-superkinds-double-superkind.rs:6:24 | LL | impl Foo for (T,) { } | ^^^ `T` cannot be sent between threads safely @@ -9,7 +9,7 @@ LL | impl Foo for (T,) { } = note: required because it appears within the type `(T,)` error[E0277]: `T` cannot be shared between threads safely - --> $DIR/builtin-superkinds-double-superkind.rs:19:16 + --> $DIR/builtin-superkinds-double-superkind.rs:9:16 | LL | impl Foo for (T,T) { } | ^^^ `T` cannot be shared between threads safely diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.rs index 88b5a3fbb55..b4555a1809a 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.rs +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.rs @@ -1,14 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // aux-build:trait_superkinds_in_metadata.rs // Test for traits inheriting from the builtin kinds cross-crate. diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr index dcc7e3cd350..61c18a24fb0 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr @@ -1,5 +1,5 @@ error[E0277]: `T` cannot be sent between threads safely - --> $DIR/builtin-superkinds-in-metadata.rs:24:23 + --> $DIR/builtin-superkinds-in-metadata.rs:13:23 | LL | impl RequiresRequiresShareAndSend for X { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `T` cannot be sent between threads safely diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.rs index 3065ecfaa30..6fba87b3197 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.rs +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests (negatively) the ability for the Self type in default methods // to use capabilities granted by builtin kinds as supertraits. diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.stderr index f96393d4b85..2fdb3836dd9 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/builtin-superkinds-self-type.rs:20:16 + --> $DIR/builtin-superkinds-self-type.rs:10:16 | LL | impl Foo for T { } | -- ^^^ @@ -7,7 +7,7 @@ LL | impl Foo for T { } | help: consider adding an explicit lifetime bound `T: 'static`... | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/builtin-superkinds-self-type.rs:20:16 + --> $DIR/builtin-superkinds-self-type.rs:10:16 | LL | impl Foo for T { } | ^^^ diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.rs index 22dc9598d29..afafc094383 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.rs +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for traits inheriting from the builtin kinds, checking // the type contents of the implementing type (that's not a typaram). diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr index 043953e7a2b..a0ff64077c4 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::rc::Rc` cannot be sent between threads safely - --> $DIR/builtin-superkinds-simple.rs:16:6 + --> $DIR/builtin-superkinds-simple.rs:6:6 | LL | impl Foo for std::rc::Rc { } | ^^^ `std::rc::Rc` cannot be sent between threads safely diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.rs index e0b2043c110..74ae62711eb 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.rs +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for traits inheriting from the builtin kinds. trait Foo : Send { } diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr index 00bad2e80ef..dc5479e5e2d 100644 --- a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr +++ b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr @@ -1,5 +1,5 @@ error[E0277]: `T` cannot be sent between threads safely - --> $DIR/builtin-superkinds-typaram-not-send.rs:15:24 + --> $DIR/builtin-superkinds-typaram-not-send.rs:5:24 | LL | impl Foo for T { } | ^^^ `T` cannot be sent between threads safely diff --git a/src/test/ui/by-move-pattern-binding.nll.stderr b/src/test/ui/by-move-pattern-binding.nll.stderr index 491b5b5bd74..4b4a989368a 100644 --- a/src/test/ui/by-move-pattern-binding.nll.stderr +++ b/src/test/ui/by-move-pattern-binding.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/by-move-pattern-binding.rs:24:11 + --> $DIR/by-move-pattern-binding.rs:14:11 | LL | match &s.x { | ^^^^ cannot move out of borrowed content @@ -11,7 +11,7 @@ LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move | help: consider removing the `&`: `E::Bar(identifier)` | note: move occurs because `identifier` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/by-move-pattern-binding.rs:26:17 + --> $DIR/by-move-pattern-binding.rs:16:17 | LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move | ^^^^^^^^^^ diff --git a/src/test/ui/by-move-pattern-binding.rs b/src/test/ui/by-move-pattern-binding.rs index a49256d1bfc..455b206e53f 100644 --- a/src/test/ui/by-move-pattern-binding.rs +++ b/src/test/ui/by-move-pattern-binding.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum E { Foo, Bar(String) diff --git a/src/test/ui/by-move-pattern-binding.stderr b/src/test/ui/by-move-pattern-binding.stderr index a20de4ba42a..d3c5e2caa42 100644 --- a/src/test/ui/by-move-pattern-binding.stderr +++ b/src/test/ui/by-move-pattern-binding.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/by-move-pattern-binding.rs:26:9 + --> $DIR/by-move-pattern-binding.rs:16:9 | LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move | ^^^^^^^^----------^ diff --git a/src/test/ui/call-fn-never-arg-wrong-type.rs b/src/test/ui/call-fn-never-arg-wrong-type.rs index 583befed1e8..7ed1162171f 100644 --- a/src/test/ui/call-fn-never-arg-wrong-type.rs +++ b/src/test/ui/call-fn-never-arg-wrong-type.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can't pass other types for ! #![feature(never_type)] diff --git a/src/test/ui/call-fn-never-arg-wrong-type.stderr b/src/test/ui/call-fn-never-arg-wrong-type.stderr index 84ed8d15a42..602963ee89c 100644 --- a/src/test/ui/call-fn-never-arg-wrong-type.stderr +++ b/src/test/ui/call-fn-never-arg-wrong-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/call-fn-never-arg-wrong-type.rs:20:9 + --> $DIR/call-fn-never-arg-wrong-type.rs:10:9 | LL | foo("wow"); //~ ERROR mismatched types | ^^^^^ expected !, found reference diff --git a/src/test/ui/can-begin-expr-check.rs b/src/test/ui/can-begin-expr-check.rs index 68f219c6ed9..35aed067c69 100644 --- a/src/test/ui/can-begin-expr-check.rs +++ b/src/test/ui/can-begin-expr-check.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { return; diff --git a/src/test/ui/can-begin-expr-check.stderr b/src/test/ui/can-begin-expr-check.stderr index ddcb69c5ee3..f25b348816b 100644 --- a/src/test/ui/can-begin-expr-check.stderr +++ b/src/test/ui/can-begin-expr-check.stderr @@ -1,5 +1,5 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `enum` - --> $DIR/can-begin-expr-check.rs:29:12 + --> $DIR/can-begin-expr-check.rs:19:12 | LL | return enum; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `enum` | ^^^^ expected one of `.`, `;`, `?`, `}`, or an operator here diff --git a/src/test/ui/cannot-mutate-captured-non-mut-var.ast.nll.stderr b/src/test/ui/cannot-mutate-captured-non-mut-var.ast.nll.stderr index a7ffc06872c..581dcde59f5 100644 --- a/src/test/ui/cannot-mutate-captured-non-mut-var.ast.nll.stderr +++ b/src/test/ui/cannot-mutate-captured-non-mut-var.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/cannot-mutate-captured-non-mut-var.rs:23:25 + --> $DIR/cannot-mutate-captured-non-mut-var.rs:13:25 | LL | let x = 1; | - help: consider changing this to be mutable: `mut x` @@ -7,7 +7,7 @@ LL | to_fn_once(move|| { x = 2; }); | ^^^^^ cannot assign error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable - --> $DIR/cannot-mutate-captured-non-mut-var.rs:28:25 + --> $DIR/cannot-mutate-captured-non-mut-var.rs:18:25 | LL | let s = std::io::stdin(); | - help: consider changing this to be mutable: `mut s` diff --git a/src/test/ui/cannot-mutate-captured-non-mut-var.ast.stderr b/src/test/ui/cannot-mutate-captured-non-mut-var.ast.stderr index 02d57ca48f2..1098c16aaf6 100644 --- a/src/test/ui/cannot-mutate-captured-non-mut-var.ast.stderr +++ b/src/test/ui/cannot-mutate-captured-non-mut-var.ast.stderr @@ -1,11 +1,11 @@ error[E0594]: cannot assign to immutable captured outer variable in an `FnOnce` closure `x` - --> $DIR/cannot-mutate-captured-non-mut-var.rs:23:25 + --> $DIR/cannot-mutate-captured-non-mut-var.rs:13:25 | LL | to_fn_once(move|| { x = 2; }); | ^^^^^ error[E0596]: cannot borrow immutable captured outer variable in an `FnOnce` closure `s` as mutable - --> $DIR/cannot-mutate-captured-non-mut-var.rs:28:25 + --> $DIR/cannot-mutate-captured-non-mut-var.rs:18:25 | LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); }); | ^ diff --git a/src/test/ui/cannot-mutate-captured-non-mut-var.mir.stderr b/src/test/ui/cannot-mutate-captured-non-mut-var.mir.stderr index a7ffc06872c..581dcde59f5 100644 --- a/src/test/ui/cannot-mutate-captured-non-mut-var.mir.stderr +++ b/src/test/ui/cannot-mutate-captured-non-mut-var.mir.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/cannot-mutate-captured-non-mut-var.rs:23:25 + --> $DIR/cannot-mutate-captured-non-mut-var.rs:13:25 | LL | let x = 1; | - help: consider changing this to be mutable: `mut x` @@ -7,7 +7,7 @@ LL | to_fn_once(move|| { x = 2; }); | ^^^^^ cannot assign error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable - --> $DIR/cannot-mutate-captured-non-mut-var.rs:28:25 + --> $DIR/cannot-mutate-captured-non-mut-var.rs:18:25 | LL | let s = std::io::stdin(); | - help: consider changing this to be mutable: `mut s` diff --git a/src/test/ui/cannot-mutate-captured-non-mut-var.rs b/src/test/ui/cannot-mutate-captured-non-mut-var.rs index 6bd52f00788..18257d09fa0 100644 --- a/src/test/ui/cannot-mutate-captured-non-mut-var.rs +++ b/src/test/ui/cannot-mutate-captured-non-mut-var.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/capture1.rs b/src/test/ui/capture1.rs index 984385f4cc0..2938c084537 100644 --- a/src/test/ui/capture1.rs +++ b/src/test/ui/capture1.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // error-pattern: can't capture dynamic environment in a fn item fn main() { diff --git a/src/test/ui/capture1.stderr b/src/test/ui/capture1.stderr index 82eb1b64cfc..ad8434709d5 100644 --- a/src/test/ui/capture1.stderr +++ b/src/test/ui/capture1.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/capture1.rs:16:32 + --> $DIR/capture1.rs:5:32 | LL | fn foo() -> isize { return bar; } | ^^^ diff --git a/src/test/ui/cast/cast-as-bool.rs b/src/test/ui/cast/cast-as-bool.rs index 68e26c23e44..8130f4dedc9 100644 --- a/src/test/ui/cast/cast-as-bool.rs +++ b/src/test/ui/cast/cast-as-bool.rs @@ -1,14 +1,9 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { - let u = 5 as bool; - //~^ ERROR cannot cast as `bool` + let u = 5 as bool; //~ ERROR cannot cast as `bool` + //~| HELP compare with zero instead + //~| SUGGESTION 5 != 0 + let t = (1 + 2) as bool; //~ ERROR cannot cast as `bool` + //~| HELP compare with zero instead + //~| SUGGESTION (1 + 2) != 0 + let v = "hello" as bool; //~ ERROR cannot cast as `bool` } diff --git a/src/test/ui/cast/cast-as-bool.stderr b/src/test/ui/cast/cast-as-bool.stderr index 050a18ec9d3..6099a4195b3 100644 --- a/src/test/ui/cast/cast-as-bool.stderr +++ b/src/test/ui/cast/cast-as-bool.stderr @@ -1,11 +1,21 @@ error[E0054]: cannot cast as `bool` - --> $DIR/cast-as-bool.rs:12:13 + --> $DIR/cast-as-bool.rs:2:13 | -LL | let u = 5 as bool; - | ^^^^^^^^^ unsupported cast +LL | let u = 5 as bool; //~ ERROR cannot cast as `bool` + | ^^^^^^^^^ help: compare with zero instead: `5 != 0` + +error[E0054]: cannot cast as `bool` + --> $DIR/cast-as-bool.rs:5:13 + | +LL | let t = (1 + 2) as bool; //~ ERROR cannot cast as `bool` + | ^^^^^^^^^^^^^^^ help: compare with zero instead: `(1 + 2) != 0` + +error[E0054]: cannot cast as `bool` + --> $DIR/cast-as-bool.rs:8:13 | - = help: compare with zero instead +LL | let v = "hello" as bool; //~ ERROR cannot cast as `bool` + | ^^^^^^^^^^^^^^^ unsupported cast -error: aborting due to previous error +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0054`. diff --git a/src/test/ui/cast/cast-errors-issue-43825.rs b/src/test/ui/cast/cast-errors-issue-43825.rs index 65b391205e3..00e0da44bbf 100644 --- a/src/test/ui/cast/cast-errors-issue-43825.rs +++ b/src/test/ui/cast/cast-errors-issue-43825.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let error = error; //~ ERROR cannot find value `error` diff --git a/src/test/ui/cast/cast-errors-issue-43825.stderr b/src/test/ui/cast/cast-errors-issue-43825.stderr index 6dbbadde5c6..cfd1ca25a96 100644 --- a/src/test/ui/cast/cast-errors-issue-43825.stderr +++ b/src/test/ui/cast/cast-errors-issue-43825.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `error` in this scope - --> $DIR/cast-errors-issue-43825.rs:12:17 + --> $DIR/cast-errors-issue-43825.rs:2:17 | LL | let error = error; //~ ERROR cannot find value `error` | ^^^^^ not found in this scope diff --git a/src/test/ui/cast/cast-from-nil.rs b/src/test/ui/cast/cast-from-nil.rs index ab22d352480..b5ceef76ac2 100644 --- a/src/test/ui/cast/cast-from-nil.rs +++ b/src/test/ui/cast/cast-from-nil.rs @@ -1,12 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: non-primitive cast: `()` as `u32` fn main() { let u = (assert!(true) as u32); } diff --git a/src/test/ui/cast/cast-from-nil.stderr b/src/test/ui/cast/cast-from-nil.stderr index 4400007f93d..c8e3628a7de 100644 --- a/src/test/ui/cast/cast-from-nil.stderr +++ b/src/test/ui/cast/cast-from-nil.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `()` as `u32` - --> $DIR/cast-from-nil.rs:12:21 + --> $DIR/cast-from-nil.rs:2:21 | LL | fn main() { let u = (assert!(true) as u32); } | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/cast/cast-ptr-to-int-const.rs b/src/test/ui/cast/cast-ptr-to-int-const.rs index 8764cb72b8c..ac153cb5742 100644 --- a/src/test/ui/cast/cast-ptr-to-int-const.rs +++ b/src/test/ui/cast/cast-ptr-to-int-const.rs @@ -1,17 +1,11 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-const_raw_ptr_to_usize_cast fn main() { - const X: u32 = main as u32; //~ ERROR casting pointers to integers in constants is unstable + const X: u32 = unsafe { + main as u32 //~ ERROR casting pointers to integers in constants is unstable + }; const Y: u32 = 0; - const Z: u32 = &Y as *const u32 as u32; //~ ERROR is unstable + const Z: u32 = unsafe { + &Y as *const u32 as u32 //~ ERROR is unstable + }; } diff --git a/src/test/ui/cast/cast-ptr-to-int-const.stderr b/src/test/ui/cast/cast-ptr-to-int-const.stderr index 7c3b4e42138..d04595ee4e8 100644 --- a/src/test/ui/cast/cast-ptr-to-int-const.stderr +++ b/src/test/ui/cast/cast-ptr-to-int-const.stderr @@ -1,16 +1,16 @@ error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) - --> $DIR/cast-ptr-to-int-const.rs:14:20 + --> $DIR/cast-ptr-to-int-const.rs:5:9 | -LL | const X: u32 = main as u32; //~ ERROR casting pointers to integers in constants is unstable - | ^^^^^^^^^^^ +LL | main as u32 //~ ERROR casting pointers to integers in constants is unstable + | ^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) - --> $DIR/cast-ptr-to-int-const.rs:16:20 + --> $DIR/cast-ptr-to-int-const.rs:9:9 | -LL | const Z: u32 = &Y as *const u32 as u32; //~ ERROR is unstable - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | &Y as *const u32 as u32 //~ ERROR is unstable + | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable diff --git a/src/test/ui/cast/cast-rfc0401-2.rs b/src/test/ui/cast/cast-rfc0401-2.rs index 0dac707688d..7709aa34104 100644 --- a/src/test/ui/cast/cast-rfc0401-2.rs +++ b/src/test/ui/cast/cast-rfc0401-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // RFC 401 test extracted into distinct file. This is because some the // change to suppress "derived" errors wound up suppressing this error // message, since the fallback for `3` doesn't occur. diff --git a/src/test/ui/cast/cast-rfc0401-2.stderr b/src/test/ui/cast/cast-rfc0401-2.stderr index f7ffa245959..52f6af78a9b 100644 --- a/src/test/ui/cast/cast-rfc0401-2.stderr +++ b/src/test/ui/cast/cast-rfc0401-2.stderr @@ -1,10 +1,8 @@ error[E0054]: cannot cast as `bool` - --> $DIR/cast-rfc0401-2.rs:16:13 + --> $DIR/cast-rfc0401-2.rs:6:13 | LL | let _ = 3 as bool; - | ^^^^^^^^^ unsupported cast - | - = help: compare with zero instead + | ^^^^^^^^^ help: compare with zero instead: `3 != 0` error: aborting due to previous error diff --git a/src/test/ui/cast/cast-to-bare-fn.rs b/src/test/ui/cast/cast-to-bare-fn.rs index d5a998c6e4b..1992f26378f 100644 --- a/src/test/ui/cast/cast-to-bare-fn.rs +++ b/src/test/ui/cast/cast-to-bare-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(_x: isize) { } fn main() { diff --git a/src/test/ui/cast/cast-to-bare-fn.stderr b/src/test/ui/cast/cast-to-bare-fn.stderr index ed07f37f4f1..84933dca929 100644 --- a/src/test/ui/cast/cast-to-bare-fn.stderr +++ b/src/test/ui/cast/cast-to-bare-fn.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `fn(isize) {foo}` as `extern "C" fn() -> isize` - --> $DIR/cast-to-bare-fn.rs:15:13 + --> $DIR/cast-to-bare-fn.rs:5:13 | LL | let x = foo as extern "C" fn() -> isize; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | let x = foo as extern "C" fn() -> isize; = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait error[E0605]: non-primitive cast: `u64` as `fn(isize) -> (isize, isize)` - --> $DIR/cast-to-bare-fn.rs:17:13 + --> $DIR/cast-to-bare-fn.rs:7:13 | LL | let y = v as extern "Rust" fn(isize) -> (isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/cast/cast-to-nil.rs b/src/test/ui/cast/cast-to-nil.rs index 27d9e8a42b1..085bb09e631 100644 --- a/src/test/ui/cast/cast-to-nil.rs +++ b/src/test/ui/cast/cast-to-nil.rs @@ -1,12 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: non-primitive cast: `u32` as `()` fn main() { let u = 0u32 as (); } diff --git a/src/test/ui/cast/cast-to-nil.stderr b/src/test/ui/cast/cast-to-nil.stderr index f7ee68e3d2b..478f6b69daf 100644 --- a/src/test/ui/cast/cast-to-nil.stderr +++ b/src/test/ui/cast/cast-to-nil.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `u32` as `()` - --> $DIR/cast-to-nil.rs:12:21 + --> $DIR/cast-to-nil.rs:2:21 | LL | fn main() { let u = 0u32 as (); } | ^^^^^^^^^^ diff --git a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs index 010b5a1b106..ac859c51263 100644 --- a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs +++ b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { &1 as Send; //~ ERROR cast to unsized Box::new(1) as Send; //~ ERROR cast to unsized diff --git a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr index 1e871d47284..37c6ba1b909 100644 --- a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr +++ b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr @@ -1,5 +1,5 @@ error[E0620]: cast to unsized type: `&{integer}` as `dyn std::marker::Send` - --> $DIR/cast-to-unsized-trait-object-suggestion.rs:12:5 + --> $DIR/cast-to-unsized-trait-object-suggestion.rs:2:5 | LL | &1 as Send; //~ ERROR cast to unsized | ^^^^^^---- @@ -7,7 +7,7 @@ LL | &1 as Send; //~ ERROR cast to unsized | help: try casting to a reference instead: `&Send` error[E0620]: cast to unsized type: `std::boxed::Box<{integer}>` as `dyn std::marker::Send` - --> $DIR/cast-to-unsized-trait-object-suggestion.rs:13:5 + --> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5 | LL | Box::new(1) as Send; //~ ERROR cast to unsized | ^^^^^^^^^^^^^^^---- diff --git a/src/test/ui/cast_char.rs b/src/test/ui/cast_char.rs index 4dfa5037bc5..8c319af9c96 100644 --- a/src/test/ui/cast_char.rs +++ b/src/test/ui/cast_char.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(overflowing_literals)] fn main() { diff --git a/src/test/ui/cast_char.stderr b/src/test/ui/cast_char.stderr index 600d7e61a09..570ca7cba86 100644 --- a/src/test/ui/cast_char.stderr +++ b/src/test/ui/cast_char.stderr @@ -1,17 +1,17 @@ error: only u8 can be cast into char - --> $DIR/cast_char.rs:14:23 + --> $DIR/cast_char.rs:4:23 | LL | const XYZ: char = 0x1F888 as char; | ^^^^^^^^^^^^^^^ help: use a char literal instead: `'/u{1F888}'` | note: lint level defined here - --> $DIR/cast_char.rs:11:9 + --> $DIR/cast_char.rs:1:9 | LL | #![deny(overflowing_literals)] | ^^^^^^^^^^^^^^^^^^^^ error: only u8 can be cast into char - --> $DIR/cast_char.rs:16:22 + --> $DIR/cast_char.rs:6:22 | LL | const XY: char = 129160 as char; | ^^^^^^^^^^^^^^ help: use a char literal instead: `'/u{1F888}'` diff --git a/src/test/ui/casts-differing-anon.rs b/src/test/ui/casts-differing-anon.rs index 05a03d3b179..cba178104c9 100644 --- a/src/test/ui/casts-differing-anon.rs +++ b/src/test/ui/casts-differing-anon.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; fn foo() -> Box { diff --git a/src/test/ui/casts-differing-anon.stderr b/src/test/ui/casts-differing-anon.stderr index dac24af671c..8e09a7cd83b 100644 --- a/src/test/ui/casts-differing-anon.stderr +++ b/src/test/ui/casts-differing-anon.stderr @@ -1,5 +1,5 @@ error[E0606]: casting `*mut impl std::fmt::Debug+?Sized` as `*mut impl std::fmt::Debug+?Sized` is invalid - --> $DIR/casts-differing-anon.rs:31:13 + --> $DIR/casts-differing-anon.rs:21:13 | LL | b_raw = f_raw as *mut _; //~ ERROR is invalid | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/casts-issue-46365.rs b/src/test/ui/casts-issue-46365.rs index 79f636e413f..2e7c26b54e4 100644 --- a/src/test/ui/casts-issue-46365.rs +++ b/src/test/ui/casts-issue-46365.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Lorem { ipsum: Ipsum //~ ERROR cannot find type `Ipsum` } diff --git a/src/test/ui/casts-issue-46365.stderr b/src/test/ui/casts-issue-46365.stderr index 08ba5e4b321..91edfaf410e 100644 --- a/src/test/ui/casts-issue-46365.stderr +++ b/src/test/ui/casts-issue-46365.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `Ipsum` in this scope - --> $DIR/casts-issue-46365.rs:12:12 + --> $DIR/casts-issue-46365.rs:2:12 | LL | ipsum: Ipsum //~ ERROR cannot find type `Ipsum` | ^^^^^ not found in this scope diff --git a/src/test/ui/cdylib-deps-must-be-static.rs b/src/test/ui/cdylib-deps-must-be-static.rs index 0a06e01cab0..241cc96fec0 100644 --- a/src/test/ui/cdylib-deps-must-be-static.rs +++ b/src/test/ui/cdylib-deps-must-be-static.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: crate `cdylib_dep` required to be available in rlib format, but was not found // aux-build:cdylib-dep.rs // ignore-musl diff --git a/src/test/ui/chalkify/lower_env1.rs b/src/test/ui/chalkify/lower_env1.rs index b772db5ca55..afb6bddbf26 100644 --- a/src/test/ui/chalkify/lower_env1.rs +++ b/src/test/ui/chalkify/lower_env1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #![allow(dead_code)] diff --git a/src/test/ui/chalkify/lower_env1.stderr b/src/test/ui/chalkify/lower_env1.stderr index 4aa40bae319..f4d16a09a36 100644 --- a/src/test/ui/chalkify/lower_env1.stderr +++ b/src/test/ui/chalkify/lower_env1.stderr @@ -1,5 +1,5 @@ error: program clause dump - --> $DIR/lower_env1.rs:16:1 + --> $DIR/lower_env1.rs:6:1 | LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump = note: forall { WellFormed(Self: Bar) :- Implemented(Self: Bar), WellFormed(Self: Foo). } error: program clause dump - --> $DIR/lower_env1.rs:19:1 + --> $DIR/lower_env1.rs:9:1 | LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/chalkify/lower_env2.rs b/src/test/ui/chalkify/lower_env2.rs index 2328db5b4f6..a067575a9cf 100644 --- a/src/test/ui/chalkify/lower_env2.rs +++ b/src/test/ui/chalkify/lower_env2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #![allow(dead_code)] diff --git a/src/test/ui/chalkify/lower_env2.stderr b/src/test/ui/chalkify/lower_env2.stderr index 74833ef064f..f05b91c674d 100644 --- a/src/test/ui/chalkify/lower_env2.stderr +++ b/src/test/ui/chalkify/lower_env2.stderr @@ -1,5 +1,5 @@ error: program clause dump - --> $DIR/lower_env2.rs:16:1 + --> $DIR/lower_env2.rs:6:1 | LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump = note: forall<'a, T> { WellFormed(S<'a, T>) :- Implemented(T: Foo), TypeOutlives(T: 'a). } error: program clause dump - --> $DIR/lower_env2.rs:21:1 + --> $DIR/lower_env2.rs:11:1 | LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/chalkify/lower_env3.rs b/src/test/ui/chalkify/lower_env3.rs index 1f8bc49e309..61ed3cbb277 100644 --- a/src/test/ui/chalkify/lower_env3.rs +++ b/src/test/ui/chalkify/lower_env3.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #![allow(dead_code)] diff --git a/src/test/ui/chalkify/lower_env3.stderr b/src/test/ui/chalkify/lower_env3.stderr index eef6405f8f8..e602a8fcdaf 100644 --- a/src/test/ui/chalkify/lower_env3.stderr +++ b/src/test/ui/chalkify/lower_env3.stderr @@ -1,5 +1,5 @@ error: program clause dump - --> $DIR/lower_env3.rs:15:5 + --> $DIR/lower_env3.rs:5:5 | LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump = note: forall { Implemented(Self: Foo) :- FromEnv(Self: Foo). } error: program clause dump - --> $DIR/lower_env3.rs:20:5 + --> $DIR/lower_env3.rs:10:5 | LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/chalkify/lower_impl.rs b/src/test/ui/chalkify/lower_impl.rs index b38b87cdb12..1bd44a9f498 100644 --- a/src/test/ui/chalkify/lower_impl.rs +++ b/src/test/ui/chalkify/lower_impl.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] trait Foo { } diff --git a/src/test/ui/chalkify/lower_impl.stderr b/src/test/ui/chalkify/lower_impl.stderr index 92a209f673d..48af37edec4 100644 --- a/src/test/ui/chalkify/lower_impl.stderr +++ b/src/test/ui/chalkify/lower_impl.stderr @@ -1,5 +1,5 @@ error: program clause dump - --> $DIR/lower_impl.rs:15:1 + --> $DIR/lower_impl.rs:5:1 | LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump = note: forall { Implemented(T: Foo) :- ProjectionEq(::Item == i32), TypeOutlives(T: 'static), Implemented(T: std::iter::Iterator), Implemented(T: std::marker::Sized). } error: program clause dump - --> $DIR/lower_impl.rs:23:5 + --> $DIR/lower_impl.rs:13:5 | LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/chalkify/lower_struct.rs b/src/test/ui/chalkify/lower_struct.rs index 9b4bba67112..aecccea5c14 100644 --- a/src/test/ui/chalkify/lower_struct.rs +++ b/src/test/ui/chalkify/lower_struct.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_dump_program_clauses] //~ ERROR program clause dump diff --git a/src/test/ui/chalkify/lower_struct.stderr b/src/test/ui/chalkify/lower_struct.stderr index a0dd9369700..e75e71450fb 100644 --- a/src/test/ui/chalkify/lower_struct.stderr +++ b/src/test/ui/chalkify/lower_struct.stderr @@ -1,5 +1,5 @@ error: program clause dump - --> $DIR/lower_struct.rs:13:1 + --> $DIR/lower_struct.rs:3:1 | LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/chalkify/lower_trait.rs b/src/test/ui/chalkify/lower_trait.rs index ba7d4ff0d9b..0e1956022f9 100644 --- a/src/test/ui/chalkify/lower_trait.rs +++ b/src/test/ui/chalkify/lower_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] trait Bar { } diff --git a/src/test/ui/chalkify/lower_trait.stderr b/src/test/ui/chalkify/lower_trait.stderr index c957a2ac7e7..4546d2ede82 100644 --- a/src/test/ui/chalkify/lower_trait.stderr +++ b/src/test/ui/chalkify/lower_trait.stderr @@ -1,5 +1,5 @@ error: program clause dump - --> $DIR/lower_trait.rs:15:1 + --> $DIR/lower_trait.rs:5:1 | LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump = note: forall { WellFormed(Self: Foo) :- Implemented(Self: Foo), WellFormed(S: std::marker::Sized), WellFormed(>::Assoc: Bar). } error: program clause dump - --> $DIR/lower_trait.rs:17:5 + --> $DIR/lower_trait.rs:7:5 | LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/chalkify/lower_trait_higher_rank.rs b/src/test/ui/chalkify/lower_trait_higher_rank.rs index c0e1d8fc4c8..715f09632bd 100644 --- a/src/test/ui/chalkify/lower_trait_higher_rank.rs +++ b/src/test/ui/chalkify/lower_trait_higher_rank.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_dump_program_clauses] //~ ERROR program clause dump diff --git a/src/test/ui/chalkify/lower_trait_higher_rank.stderr b/src/test/ui/chalkify/lower_trait_higher_rank.stderr index 6d3e0ec55b2..d7e18596a7d 100644 --- a/src/test/ui/chalkify/lower_trait_higher_rank.stderr +++ b/src/test/ui/chalkify/lower_trait_higher_rank.stderr @@ -1,5 +1,5 @@ error: program clause dump - --> $DIR/lower_trait_higher_rank.rs:13:1 + --> $DIR/lower_trait_higher_rank.rs:3:1 | LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/chalkify/lower_trait_where_clause.rs b/src/test/ui/chalkify/lower_trait_where_clause.rs index ac58c0bf2fe..78fa39f1dc1 100644 --- a/src/test/ui/chalkify/lower_trait_where_clause.rs +++ b/src/test/ui/chalkify/lower_trait_where_clause.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] use std::borrow::Borrow; diff --git a/src/test/ui/chalkify/lower_trait_where_clause.stderr b/src/test/ui/chalkify/lower_trait_where_clause.stderr index fcd516c89ba..5400224bdf4 100644 --- a/src/test/ui/chalkify/lower_trait_where_clause.stderr +++ b/src/test/ui/chalkify/lower_trait_where_clause.stderr @@ -1,5 +1,5 @@ error: program clause dump - --> $DIR/lower_trait_where_clause.rs:15:1 + --> $DIR/lower_trait_where_clause.rs:5:1 | LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/chalkify/type_inference.rs b/src/test/ui/chalkify/type_inference.rs new file mode 100644 index 00000000000..62a53ec0317 --- /dev/null +++ b/src/test/ui/chalkify/type_inference.rs @@ -0,0 +1,26 @@ +// compile-flags: -Z chalk + +trait Foo { } +impl Foo for i32 { } + +trait Bar { } +impl Bar for i32 { } +impl Bar for u32 { } + +fn only_foo(_x: T) { } + +fn only_bar(_x: T) { } + +fn main() { + let x = 5.0; + + // The only type which implements `Foo` is `i32`, so the chalk trait solver + // is expecting a variable of type `i32`. This behavior differs from the + // old-style trait solver. I guess this will change, that's why I'm + // adding that test. + only_foo(x); //~ ERROR mismatched types + + // Here we have two solutions so we get back the behavior of the old-style + // trait solver. + only_bar(x); //~ ERROR the trait bound `{float}: Bar` is not satisfied +} diff --git a/src/test/ui/chalkify/type_inference.stderr b/src/test/ui/chalkify/type_inference.stderr new file mode 100644 index 00000000000..d65b701307b --- /dev/null +++ b/src/test/ui/chalkify/type_inference.stderr @@ -0,0 +1,28 @@ +error[E0308]: mismatched types + --> $DIR/type_inference.rs:21:14 + | +LL | only_foo(x); //~ ERROR mismatched types + | ^ expected i32, found floating-point number + | + = note: expected type `i32` + found type `{float}` + +error[E0277]: the trait bound `{float}: Bar` is not satisfied + --> $DIR/type_inference.rs:25:5 + | +LL | only_bar(x); //~ ERROR the trait bound `{float}: Bar` is not satisfied + | ^^^^^^^^ the trait `Bar` is not implemented for `{float}` + | + = help: the following implementations were found: + + +note: required by `only_bar` + --> $DIR/type_inference.rs:12:1 + | +LL | fn only_bar(_x: T) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +Some errors occurred: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/changing-crates.rs b/src/test/ui/changing-crates.rs index 5963a58a2d2..60c043bc43f 100644 --- a/src/test/ui/changing-crates.rs +++ b/src/test/ui/changing-crates.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-msvc FIXME #31306 // note that these aux-build directives must be in this order diff --git a/src/test/ui/changing-crates.stderr b/src/test/ui/changing-crates.stderr index d8de685c7d7..a8b986d67f8 100644 --- a/src/test/ui/changing-crates.stderr +++ b/src/test/ui/changing-crates.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/changing-crates.rs:20:1 + --> $DIR/changing-crates.rs:10:1 | LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/check-static-immutable-mut-slices.rs b/src/test/ui/check-static-immutable-mut-slices.rs index 1804b9e04c2..d5e9fb2dede 100644 --- a/src/test/ui/check-static-immutable-mut-slices.rs +++ b/src/test/ui/check-static-immutable-mut-slices.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks that immutable static items can't have mutable slices static TEST: &'static mut [isize] = &mut []; diff --git a/src/test/ui/check-static-immutable-mut-slices.stderr b/src/test/ui/check-static-immutable-mut-slices.stderr index b0a7cd1221b..4f4bf16a0ff 100644 --- a/src/test/ui/check-static-immutable-mut-slices.stderr +++ b/src/test/ui/check-static-immutable-mut-slices.stderr @@ -1,5 +1,5 @@ error[E0017]: references in statics may only refer to immutable values - --> $DIR/check-static-immutable-mut-slices.rs:13:37 + --> $DIR/check-static-immutable-mut-slices.rs:3:37 | LL | static TEST: &'static mut [isize] = &mut []; | ^^^^^^^ statics require immutable values diff --git a/src/test/ui/check-static-values-constraints.nll.stderr b/src/test/ui/check-static-values-constraints.nll.stderr index 5522e22fb1f..f1a23124908 100644 --- a/src/test/ui/check-static-values-constraints.nll.stderr +++ b/src/test/ui/check-static-values-constraints.nll.stderr @@ -1,5 +1,5 @@ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/check-static-values-constraints.rs:75:43 + --> $DIR/check-static-values-constraints.rs:65:43 | LL | ..SafeStruct{field1: SafeEnum::Variant3(WithDtor), | ___________________________________________^ @@ -8,49 +8,85 @@ LL | | field2: SafeEnum::Va | |________________________________________________________________________________^ statics cannot evaluate destructors error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:89:33 + --> $DIR/check-static-values-constraints.rs:79:33 | LL | static STATIC11: Box = box MyOwned; | ^^^^^^^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:79:37 + | +LL | static STATIC11: Box = box MyOwned; + | ^^^^^^^ + error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/check-static-values-constraints.rs:99:32 + --> $DIR/check-static-values-constraints.rs:90:32 | LL | field2: SafeEnum::Variant4("str".to_string()) | ^^^^^^^^^^^^^^^^^ error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:104:5 + --> $DIR/check-static-values-constraints.rs:95:5 | LL | box MyOwned, //~ ERROR allocations are not allowed in statics | ^^^^^^^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:95:9 + | +LL | box MyOwned, //~ ERROR allocations are not allowed in statics + | ^^^^^^^ + error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:105:5 + --> $DIR/check-static-values-constraints.rs:97:5 | LL | box MyOwned, //~ ERROR allocations are not allowed in statics | ^^^^^^^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:97:9 + | +LL | box MyOwned, //~ ERROR allocations are not allowed in statics + | ^^^^^^^ + error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:109:6 + --> $DIR/check-static-values-constraints.rs:102:6 | LL | &box MyOwned, //~ ERROR allocations are not allowed in statics | ^^^^^^^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:102:10 + | +LL | &box MyOwned, //~ ERROR allocations are not allowed in statics + | ^^^^^^^ + error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:110:6 + --> $DIR/check-static-values-constraints.rs:104:6 | LL | &box MyOwned, //~ ERROR allocations are not allowed in statics | ^^^^^^^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:104:10 + | +LL | &box MyOwned, //~ ERROR allocations are not allowed in statics + | ^^^^^^^ + error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:116:5 + --> $DIR/check-static-values-constraints.rs:111:5 | LL | box 3; | ^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:111:9 + | +LL | box 3; + | ^ + error[E0507]: cannot move out of static item - --> $DIR/check-static-values-constraints.rs:120:45 + --> $DIR/check-static-values-constraints.rs:116:45 | LL | let y = { static x: Box = box 3; x }; | ^ @@ -59,12 +95,18 @@ LL | let y = { static x: Box = box 3; x }; | help: consider borrowing here: `&x` error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:120:38 + --> $DIR/check-static-values-constraints.rs:116:38 | LL | let y = { static x: Box = box 3; x }; | ^^^^^ allocation not allowed in statics -error: aborting due to 10 previous errors +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:116:42 + | +LL | let y = { static x: Box = box 3; x }; + | ^ + +error: aborting due to 17 previous errors -Some errors occurred: E0010, E0015, E0493, E0507. +Some errors occurred: E0010, E0015, E0019, E0493, E0507. For more information about an error, try `rustc --explain E0010`. diff --git a/src/test/ui/check-static-values-constraints.rs b/src/test/ui/check-static-values-constraints.rs index 37f665960c8..acfb3b5e44b 100644 --- a/src/test/ui/check-static-values-constraints.rs +++ b/src/test/ui/check-static-values-constraints.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Verifies all possible restrictions for statics values. #![allow(warnings)] @@ -88,6 +78,7 @@ struct MyOwned; static STATIC11: Box = box MyOwned; //~^ ERROR allocations are not allowed in statics +//~| ERROR static contains unimplemented expression type static mut STATIC12: UnsafeStruct = UnsafeStruct; @@ -102,12 +93,16 @@ static mut STATIC14: SafeStruct = SafeStruct { static STATIC15: &'static [Box] = &[ box MyOwned, //~ ERROR allocations are not allowed in statics + //~| ERROR contains unimplemented expression box MyOwned, //~ ERROR allocations are not allowed in statics + //~| ERROR contains unimplemented expression ]; static STATIC16: (&'static Box, &'static Box) = ( &box MyOwned, //~ ERROR allocations are not allowed in statics + //~| ERROR contains unimplemented expression &box MyOwned, //~ ERROR allocations are not allowed in statics + //~| ERROR contains unimplemented expression ); static mut STATIC17: SafeEnum = SafeEnum::Variant1; @@ -115,9 +110,11 @@ static mut STATIC17: SafeEnum = SafeEnum::Variant1; static STATIC19: Box = box 3; //~^ ERROR allocations are not allowed in statics + //~| ERROR contains unimplemented expression pub fn main() { let y = { static x: Box = box 3; x }; //~^ ERROR allocations are not allowed in statics - //~^^ ERROR cannot move out of static item + //~| ERROR cannot move out of static item + //~| ERROR contains unimplemented expression } diff --git a/src/test/ui/check-static-values-constraints.stderr b/src/test/ui/check-static-values-constraints.stderr index ac979a3fa7c..5b1f265c34a 100644 --- a/src/test/ui/check-static-values-constraints.stderr +++ b/src/test/ui/check-static-values-constraints.stderr @@ -1,5 +1,5 @@ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/check-static-values-constraints.rs:75:43 + --> $DIR/check-static-values-constraints.rs:65:43 | LL | ..SafeStruct{field1: SafeEnum::Variant3(WithDtor), | ___________________________________________^ @@ -8,60 +8,102 @@ LL | | field2: SafeEnum::Va | |________________________________________________________________________________^ statics cannot evaluate destructors error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:89:33 + --> $DIR/check-static-values-constraints.rs:79:33 | LL | static STATIC11: Box = box MyOwned; | ^^^^^^^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:79:37 + | +LL | static STATIC11: Box = box MyOwned; + | ^^^^^^^ + error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/check-static-values-constraints.rs:99:32 + --> $DIR/check-static-values-constraints.rs:90:32 | LL | field2: SafeEnum::Variant4("str".to_string()) | ^^^^^^^^^^^^^^^^^ error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:104:5 + --> $DIR/check-static-values-constraints.rs:95:5 | LL | box MyOwned, //~ ERROR allocations are not allowed in statics | ^^^^^^^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:95:9 + | +LL | box MyOwned, //~ ERROR allocations are not allowed in statics + | ^^^^^^^ + error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:105:5 + --> $DIR/check-static-values-constraints.rs:97:5 | LL | box MyOwned, //~ ERROR allocations are not allowed in statics | ^^^^^^^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:97:9 + | +LL | box MyOwned, //~ ERROR allocations are not allowed in statics + | ^^^^^^^ + error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:109:6 + --> $DIR/check-static-values-constraints.rs:102:6 | LL | &box MyOwned, //~ ERROR allocations are not allowed in statics | ^^^^^^^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:102:10 + | +LL | &box MyOwned, //~ ERROR allocations are not allowed in statics + | ^^^^^^^ + error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:110:6 + --> $DIR/check-static-values-constraints.rs:104:6 | LL | &box MyOwned, //~ ERROR allocations are not allowed in statics | ^^^^^^^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:104:10 + | +LL | &box MyOwned, //~ ERROR allocations are not allowed in statics + | ^^^^^^^ + error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:116:5 + --> $DIR/check-static-values-constraints.rs:111:5 | LL | box 3; | ^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:111:9 + | +LL | box 3; + | ^ + error[E0507]: cannot move out of static item - --> $DIR/check-static-values-constraints.rs:120:45 + --> $DIR/check-static-values-constraints.rs:116:45 | LL | let y = { static x: Box = box 3; x }; | ^ cannot move out of static item error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:120:38 + --> $DIR/check-static-values-constraints.rs:116:38 | LL | let y = { static x: Box = box 3; x }; | ^^^^^ allocation not allowed in statics -error: aborting due to 10 previous errors +error[E0019]: static contains unimplemented expression type + --> $DIR/check-static-values-constraints.rs:116:42 + | +LL | let y = { static x: Box = box 3; x }; + | ^ + +error: aborting due to 17 previous errors -Some errors occurred: E0010, E0015, E0493, E0507. +Some errors occurred: E0010, E0015, E0019, E0493, E0507. For more information about an error, try `rustc --explain E0010`. diff --git a/src/test/ui/check_match/issue-35609.rs b/src/test/ui/check_match/issue-35609.rs index d52718b7bf4..8ef75e3511e 100644 --- a/src/test/ui/check_match/issue-35609.rs +++ b/src/test/ui/check_match/issue-35609.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Enum { A, B, C, D, E, F } diff --git a/src/test/ui/check_match/issue-35609.stderr b/src/test/ui/check_match/issue-35609.stderr index 418573171f1..7a517e856cb 100644 --- a/src/test/ui/check_match/issue-35609.stderr +++ b/src/test/ui/check_match/issue-35609.stderr @@ -1,47 +1,47 @@ error[E0004]: non-exhaustive patterns: `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered - --> $DIR/issue-35609.rs:20:11 + --> $DIR/issue-35609.rs:10:11 | LL | match (A, ()) { //~ ERROR non-exhaustive | ^^^^^^^ patterns `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered error[E0004]: non-exhaustive patterns: `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered - --> $DIR/issue-35609.rs:24:11 + --> $DIR/issue-35609.rs:14:11 | LL | match (A, A) { //~ ERROR non-exhaustive | ^^^^^^ patterns `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered - --> $DIR/issue-35609.rs:28:11 + --> $DIR/issue-35609.rs:18:11 | LL | match ((A, ()), ()) { //~ ERROR non-exhaustive | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered - --> $DIR/issue-35609.rs:32:11 + --> $DIR/issue-35609.rs:22:11 | LL | match ((A, ()), A) { //~ ERROR non-exhaustive | ^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered - --> $DIR/issue-35609.rs:36:11 + --> $DIR/issue-35609.rs:26:11 | LL | match ((A, ()), ()) { //~ ERROR non-exhaustive | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered - --> $DIR/issue-35609.rs:41:11 + --> $DIR/issue-35609.rs:31:11 | LL | match S(A, ()) { //~ ERROR non-exhaustive | ^^^^^^^^ patterns `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered error[E0004]: non-exhaustive patterns: `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered - --> $DIR/issue-35609.rs:45:11 + --> $DIR/issue-35609.rs:35:11 | LL | match (Sd { x: A, y: () }) { //~ ERROR non-exhaustive | ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered - --> $DIR/issue-35609.rs:49:11 + --> $DIR/issue-35609.rs:39:11 | LL | match Some(A) { //~ ERROR non-exhaustive | ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered diff --git a/src/test/ui/check_match/issue-43253.rs b/src/test/ui/check_match/issue-43253.rs index aace8c0c02b..5d084248a7f 100644 --- a/src/test/ui/check_match/issue-43253.rs +++ b/src/test/ui/check_match/issue-43253.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(exclusive_range_pattern)] diff --git a/src/test/ui/check_match/issue-43253.stderr b/src/test/ui/check_match/issue-43253.stderr index 2af6a2a6368..d961f623e1f 100644 --- a/src/test/ui/check_match/issue-43253.stderr +++ b/src/test/ui/check_match/issue-43253.stderr @@ -1,23 +1,23 @@ warning: unreachable pattern - --> $DIR/issue-43253.rs:39:9 + --> $DIR/issue-43253.rs:29:9 | LL | 9 => {}, | ^ | note: lint level defined here - --> $DIR/issue-43253.rs:14:9 + --> $DIR/issue-43253.rs:4:9 | LL | #![warn(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ warning: unreachable pattern - --> $DIR/issue-43253.rs:45:9 + --> $DIR/issue-43253.rs:35:9 | LL | 8..=9 => {}, | ^^^^^ warning: unreachable pattern - --> $DIR/issue-43253.rs:51:9 + --> $DIR/issue-43253.rs:41:9 | LL | 9..=9 => {}, | ^^^^^ diff --git a/src/test/ui/class-cast-to-trait.rs b/src/test/ui/class-cast-to-trait.rs index af83b0ecbf2..3ae4987254f 100644 --- a/src/test/ui/class-cast-to-trait.rs +++ b/src/test/ui/class-cast-to-trait.rs @@ -1,27 +1,17 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] -trait noisy { +trait Noisy { fn speak(&self); } -struct cat { +struct Cat { meows : usize, how_hungry : isize, name : String, } -impl cat { +impl Cat { pub fn eat(&self) -> bool { if self.how_hungry > 0 { println!("OM NOM NOM"); @@ -35,12 +25,12 @@ impl cat { } } -impl noisy for cat { +impl Noisy for Cat { fn speak(&self) { self.meow(); } } -impl cat { +impl Cat { fn meow(&self) { println!("Meow"); self.meows += 1; @@ -50,8 +40,8 @@ impl cat { } } -fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { - cat { +fn cat(in_x : usize, in_y : isize, in_name: String) -> Cat { + Cat { meows: in_x, how_hungry: in_y, name: in_name @@ -59,6 +49,6 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { } fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; + let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; nyan.eat(); //~ ERROR no method named `eat` found } diff --git a/src/test/ui/class-cast-to-trait.stderr b/src/test/ui/class-cast-to-trait.stderr index c1e08807f97..f5bd7a13aa4 100644 --- a/src/test/ui/class-cast-to-trait.stderr +++ b/src/test/ui/class-cast-to-trait.stderr @@ -1,5 +1,5 @@ -error[E0599]: no method named `eat` found for type `std::boxed::Box` in the current scope - --> $DIR/class-cast-to-trait.rs:63:8 +error[E0599]: no method named `eat` found for type `std::boxed::Box` in the current scope + --> $DIR/class-cast-to-trait.rs:53:8 | LL | nyan.eat(); //~ ERROR no method named `eat` found | ^^^ diff --git a/src/test/ui/class-method-missing.rs b/src/test/ui/class-method-missing.rs index 46b100a4d39..5dc18328f31 100644 --- a/src/test/ui/class-method-missing.rs +++ b/src/test/ui/class-method-missing.rs @@ -1,27 +1,17 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait animal { +trait Animal { fn eat(&self); } -struct cat { +struct Cat { meows: usize, } -impl animal for cat { +impl Animal for Cat { //~^ ERROR not all trait items implemented, missing: `eat` } -fn cat(in_x : usize) -> cat { - cat { +fn cat(in_x : usize) -> Cat { + Cat { meows: in_x } } diff --git a/src/test/ui/class-method-missing.stderr b/src/test/ui/class-method-missing.stderr index c1da06e3a3a..3b4ac3a9adc 100644 --- a/src/test/ui/class-method-missing.stderr +++ b/src/test/ui/class-method-missing.stderr @@ -1,10 +1,10 @@ error[E0046]: not all trait items implemented, missing: `eat` - --> $DIR/class-method-missing.rs:19:1 + --> $DIR/class-method-missing.rs:9:1 | LL | fn eat(&self); | -------------- `eat` from trait ... -LL | impl animal for cat { +LL | impl Animal for Cat { | ^^^^^^^^^^^^^^^^^^^ missing `eat` in implementation error: aborting due to previous error diff --git a/src/test/ui/class-missing-self.rs b/src/test/ui/class-missing-self.rs index 372bf4cac87..515754e54fe 100644 --- a/src/test/ui/class-missing-self.rs +++ b/src/test/ui/class-missing-self.rs @@ -1,18 +1,8 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct cat { +struct Cat { meows : usize, } -impl cat { +impl Cat { fn sleep(&self) { loop{} } fn meow(&self) { println!("Meow"); diff --git a/src/test/ui/class-missing-self.stderr b/src/test/ui/class-missing-self.stderr index 33bf62e7087..484778f83ec 100644 --- a/src/test/ui/class-missing-self.stderr +++ b/src/test/ui/class-missing-self.stderr @@ -1,11 +1,11 @@ error[E0425]: cannot find value `meows` in this scope - --> $DIR/class-missing-self.rs:19:7 + --> $DIR/class-missing-self.rs:9:7 | LL | meows += 1; //~ ERROR cannot find value `meows` in this scope | ^^^^^ help: try: `self.meows` error[E0425]: cannot find function `sleep` in this scope - --> $DIR/class-missing-self.rs:20:7 + --> $DIR/class-missing-self.rs:10:7 | LL | sleep(); //~ ERROR cannot find function `sleep` in this scope | ^^^^^ not found in this scope diff --git a/src/test/ui/cleanup-rvalue-scopes-cf.rs b/src/test/ui/cleanup-rvalue-scopes-cf.rs index 0f83bf80d24..106dbd324ff 100644 --- a/src/test/ui/cleanup-rvalue-scopes-cf.rs +++ b/src/test/ui/cleanup-rvalue-scopes-cf.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-compare-mode-nll // Test that the borrow checker prevents pointers to temporaries diff --git a/src/test/ui/cleanup-rvalue-scopes-cf.stderr b/src/test/ui/cleanup-rvalue-scopes-cf.stderr index e1de4a2a8d4..561403d1b42 100644 --- a/src/test/ui/cleanup-rvalue-scopes-cf.stderr +++ b/src/test/ui/cleanup-rvalue-scopes-cf.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/cleanup-rvalue-scopes-cf.rs:38:19 + --> $DIR/cleanup-rvalue-scopes-cf.rs:28:19 | LL | let _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough | ^^^^^^^^^^^ - temporary value dropped here while still borrowed @@ -12,7 +12,7 @@ LL | } = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/cleanup-rvalue-scopes-cf.rs:39:14 + --> $DIR/cleanup-rvalue-scopes-cf.rs:29:14 | LL | let _x = AddFlags(1).get(); //~ ERROR value does not live long enough | ^^^^^^^^^^^ - temporary value dropped here while still borrowed @@ -25,7 +25,7 @@ LL | } = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/cleanup-rvalue-scopes-cf.rs:40:21 + --> $DIR/cleanup-rvalue-scopes-cf.rs:30:21 | LL | let _x = &*arg(&AddFlags(1)); //~ ERROR value does not live long enough | ^^^^^^^^^^^ - temporary value dropped here while still borrowed @@ -38,7 +38,7 @@ LL | } = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/cleanup-rvalue-scopes-cf.rs:41:24 + --> $DIR/cleanup-rvalue-scopes-cf.rs:31:24 | LL | let ref _x = *arg(&AddFlags(1)); //~ ERROR value does not live long enough | ^^^^^^^^^^^ - temporary value dropped here while still borrowed @@ -51,7 +51,7 @@ LL | } = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/cleanup-rvalue-scopes-cf.rs:42:24 + --> $DIR/cleanup-rvalue-scopes-cf.rs:32:24 | LL | let &ref _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough | ^^^^^^^^^^^ - temporary value dropped here while still borrowed @@ -64,7 +64,7 @@ LL | } = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/cleanup-rvalue-scopes-cf.rs:43:14 + --> $DIR/cleanup-rvalue-scopes-cf.rs:33:14 | LL | let _x = AddFlags(1).get(); //~ ERROR value does not live long enough | ^^^^^^^^^^^ - temporary value dropped here while still borrowed @@ -77,7 +77,7 @@ LL | } = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/cleanup-rvalue-scopes-cf.rs:44:34 + --> $DIR/cleanup-rvalue-scopes-cf.rs:34:34 | LL | let Box { f: _x } = Box { f: AddFlags(1).get() }; //~ ERROR value does not live long enough | ^^^^^^^^^^^ - temporary value dropped here while still borrowed diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn-multiple.rs b/src/test/ui/closure-expected-type/expect-fn-supply-fn-multiple.rs index 32efb01c0fe..1bfaecd16c0 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn-multiple.rs +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn-multiple.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(warnings)] diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.rs b/src/test/ui/closure-expected-type/expect-fn-supply-fn.rs index 63284c98020..6977fd47a2e 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.rs +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn with_closure_expecting_fn_with_free_region(_: F) where F: for<'a> FnOnce(fn(&'a u32), &i32) { @@ -38,14 +28,14 @@ fn expect_free_supply_bound() { // Here, we are given a function whose region is bound at closure level, // but we expect one bound in the argument. Error results. with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); - //~^ ERROR type mismatch in closure arguments + //~^ ERROR mismatched types } fn expect_bound_supply_free_from_fn<'x>(x: &'x u32) { // Here, we are given a `fn(&u32)` but we expect a `fn(&'x // u32)`. In principle, this could be ok, but we demand equality. with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); - //~^ ERROR type mismatch in closure arguments + //~^ ERROR mismatched types } fn expect_bound_supply_free_from_closure() { @@ -53,8 +43,9 @@ fn expect_bound_supply_free_from_closure() { // bound at the closure level, but we expect something bound at // the argument level. type Foo<'a> = fn(&'a u32); - with_closure_expecting_fn_with_bound_region(|_x: Foo<'_>, y| {}); - //~^ ERROR type mismatch in closure arguments + with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { + //~^ ERROR mismatched types + }); } fn expect_bound_supply_bound<'x>(x: &'x u32) { diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr index 4dca5922910..b1cfd6cef10 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr @@ -1,93 +1,68 @@ error[E0308]: mismatched types - --> $DIR/expect-fn-supply-fn.rs:24:52 + --> $DIR/expect-fn-supply-fn.rs:14:52 | LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | ^^^^^^^^^^^ lifetime mismatch | = note: expected type `fn(&u32)` found type `fn(&'x u32)` -note: the anonymous lifetime #2 defined on the body at 24:48... - --> $DIR/expect-fn-supply-fn.rs:24:48 +note: the anonymous lifetime #2 defined on the body at 14:48... + --> $DIR/expect-fn-supply-fn.rs:14:48 | LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | ^^^^^^^^^^^^^^^^^^^^^^ -note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 21:36 - --> $DIR/expect-fn-supply-fn.rs:21:36 +note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 11:36 + --> $DIR/expect-fn-supply-fn.rs:11:36 | LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { | ^^ error[E0308]: mismatched types - --> $DIR/expect-fn-supply-fn.rs:24:52 + --> $DIR/expect-fn-supply-fn.rs:14:52 | LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | ^^^^^^^^^^^ lifetime mismatch | = note: expected type `fn(&u32)` found type `fn(&'x u32)` -note: the lifetime 'x as defined on the function body at 21:36... - --> $DIR/expect-fn-supply-fn.rs:21:36 +note: the lifetime 'x as defined on the function body at 11:36... + --> $DIR/expect-fn-supply-fn.rs:11:36 | LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { | ^^ -note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 24:48 - --> $DIR/expect-fn-supply-fn.rs:24:48 +note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 14:48 + --> $DIR/expect-fn-supply-fn.rs:14:48 | LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | ^^^^^^^^^^^^^^^^^^^^^^ -error[E0631]: type mismatch in closure arguments - --> $DIR/expect-fn-supply-fn.rs:40:5 +error[E0308]: mismatched types + --> $DIR/expect-fn-supply-fn.rs:30:52 | LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {}); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `fn(for<'r> fn(&'r u32), _) -> _` - | | - | expected signature of `for<'a, 'r> fn(fn(&'a u32), &'r i32) -> _` - | -note: required by `with_closure_expecting_fn_with_free_region` - --> $DIR/expect-fn-supply-fn.rs:11:1 + | ^^^^^^^^ one type is more general than the other | -LL | / fn with_closure_expecting_fn_with_free_region(_: F) -LL | | where F: for<'a> FnOnce(fn(&'a u32), &i32) -LL | | { -LL | | } - | |_^ + = note: expected type `fn(&u32)` + found type `for<'r> fn(&'r u32)` -error[E0631]: type mismatch in closure arguments - --> $DIR/expect-fn-supply-fn.rs:47:5 +error[E0308]: mismatched types + --> $DIR/expect-fn-supply-fn.rs:37:53 | LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {}); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _` - | | - | expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _` + | ^^^^^^^^^^^ one type is more general than the other | -note: required by `with_closure_expecting_fn_with_bound_region` - --> $DIR/expect-fn-supply-fn.rs:16:1 - | -LL | / fn with_closure_expecting_fn_with_bound_region(_: F) -LL | | where F: FnOnce(fn(&u32), &i32) -LL | | { -LL | | } - | |_^ + = note: expected type `for<'r> fn(&'r u32)` + found type `fn(&'x u32)` -error[E0631]: type mismatch in closure arguments - --> $DIR/expect-fn-supply-fn.rs:56:5 - | -LL | with_closure_expecting_fn_with_bound_region(|_x: Foo<'_>, y| {}); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `for<'r> fn(fn(&'r u32), _) -> _` - | | - | expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _` +error[E0308]: mismatched types + --> $DIR/expect-fn-supply-fn.rs:46:53 | -note: required by `with_closure_expecting_fn_with_bound_region` - --> $DIR/expect-fn-supply-fn.rs:16:1 +LL | with_closure_expecting_fn_with_bound_region(|x: Foo<'_>, y| { + | ^^^^^^^ one type is more general than the other | -LL | / fn with_closure_expecting_fn_with_bound_region(_: F) -LL | | where F: FnOnce(fn(&u32), &i32) -LL | | { -LL | | } - | |_^ + = note: expected type `for<'r> fn(&'r u32)` + found type `fn(&u32)` error: aborting due to 5 previous errors -Some errors occurred: E0308, E0631. -For more information about an error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.rs b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.rs index bef69a4b0b9..e5ec6b271e7 100644 --- a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.rs +++ b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn with_closure(_: F) where F: FnOnce(A, A) { diff --git a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr index 51dcf5eb3da..7a0938e9f7e 100644 --- a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr +++ b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr @@ -1,5 +1,5 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/expect-infer-var-appearing-twice.rs:24:5 + --> $DIR/expect-infer-var-appearing-twice.rs:14:5 | LL | with_closure(|x: u32, y: i32| { | ^^^^^^^^^^^^ ---------------- found signature of `fn(u32, i32) -> _` @@ -7,7 +7,7 @@ LL | with_closure(|x: u32, y: i32| { | expected signature of `fn(_, _) -> _` | note: required by `with_closure` - --> $DIR/expect-infer-var-appearing-twice.rs:11:1 + --> $DIR/expect-infer-var-appearing-twice.rs:1:1 | LL | / fn with_closure(_: F) LL | | where F: FnOnce(A, A) diff --git a/src/test/ui/closure-expected-type/expect-infer-var-supply-ty-with-bound-region.rs b/src/test/ui/closure-expected-type/expect-infer-var-supply-ty-with-bound-region.rs index 6767aa62f78..3e42284b72c 100644 --- a/src/test/ui/closure-expected-type/expect-infer-var-supply-ty-with-bound-region.rs +++ b/src/test/ui/closure-expected-type/expect-infer-var-supply-ty-with-bound-region.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass fn with_closure(_: F) diff --git a/src/test/ui/closure-expected-type/expect-infer-var-supply-ty-with-free-region.rs b/src/test/ui/closure-expected-type/expect-infer-var-supply-ty-with-free-region.rs index aea5cb21e63..cf417d7c2a8 100644 --- a/src/test/ui/closure-expected-type/expect-infer-var-supply-ty-with-free-region.rs +++ b/src/test/ui/closure-expected-type/expect-infer-var-supply-ty-with-free-region.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass fn with_closure(_: F) diff --git a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.rs b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.rs index 377eaadbd6a..97d7a51a72b 100644 --- a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.rs +++ b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn with_closure(_: F) where F: FnOnce(A, B) { diff --git a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr index 273fb2a2dd2..7dd996cce5d 100644 --- a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr +++ b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/expect-two-infer-vars-supply-ty-with-bound-region.rs:18:27 + --> $DIR/expect-two-infer-vars-supply-ty-with-bound-region.rs:8:27 | LL | with_closure(|x: u32, y| {}); //~ ERROR E0282 | ^ consider giving this closure parameter a type diff --git a/src/test/ui/closure-expected-type/issue-24421.rs b/src/test/ui/closure-expected-type/issue-24421.rs index b3c50a74a32..477eb40c57e 100644 --- a/src/test/ui/closure-expected-type/issue-24421.rs +++ b/src/test/ui/closure-expected-type/issue-24421.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass fn test(f: F) {} diff --git a/src/test/ui/closure-expected.rs b/src/test/ui/closure-expected.rs index ff52948ca85..9b15a63da28 100644 --- a/src/test/ui/closure-expected.rs +++ b/src/test/ui/closure-expected.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = Some(1); let y = x.or_else(4); diff --git a/src/test/ui/closure-expected.stderr b/src/test/ui/closure-expected.stderr index 0da506b5b81..ff77423577d 100644 --- a/src/test/ui/closure-expected.stderr +++ b/src/test/ui/closure-expected.stderr @@ -1,5 +1,5 @@ error[E0277]: expected a `std::ops::FnOnce<()>` closure, found `{integer}` - --> $DIR/closure-expected.rs:13:15 + --> $DIR/closure-expected.rs:3:15 | LL | let y = x.or_else(4); | ^^^^^^^ expected an `FnOnce<()>` closure, found `{integer}` diff --git a/src/test/ui/closure_context/issue-26046-fn-mut.rs b/src/test/ui/closure_context/issue-26046-fn-mut.rs index 3b179a475e7..e5840181e41 100644 --- a/src/test/ui/closure_context/issue-26046-fn-mut.rs +++ b/src/test/ui/closure_context/issue-26046-fn-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() -> Box { let num = 5; diff --git a/src/test/ui/closure_context/issue-26046-fn-mut.stderr b/src/test/ui/closure_context/issue-26046-fn-mut.stderr index ac98d9427e4..bdfd26f6871 100644 --- a/src/test/ui/closure_context/issue-26046-fn-mut.stderr +++ b/src/test/ui/closure_context/issue-26046-fn-mut.stderr @@ -1,5 +1,5 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut` - --> $DIR/issue-26046-fn-mut.rs:14:19 + --> $DIR/issue-26046-fn-mut.rs:4:19 | LL | let closure = || { //~ ERROR expected a closure that | ^^ this closure implements `FnMut`, not `Fn` diff --git a/src/test/ui/closure_context/issue-26046-fn-once.rs b/src/test/ui/closure_context/issue-26046-fn-once.rs index cf15985ee83..d33420c52a0 100644 --- a/src/test/ui/closure_context/issue-26046-fn-once.rs +++ b/src/test/ui/closure_context/issue-26046-fn-once.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn get_closure() -> Box Vec> { let vec = vec![1u8, 2u8]; diff --git a/src/test/ui/closure_context/issue-26046-fn-once.stderr b/src/test/ui/closure_context/issue-26046-fn-once.stderr index e09fdb5fb77..e7bcbb9e630 100644 --- a/src/test/ui/closure_context/issue-26046-fn-once.stderr +++ b/src/test/ui/closure_context/issue-26046-fn-once.stderr @@ -1,5 +1,5 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` - --> $DIR/issue-26046-fn-once.rs:14:19 + --> $DIR/issue-26046-fn-once.rs:4:19 | LL | let closure = move || { //~ ERROR expected a closure | ^^^^^^^ this closure implements `FnOnce`, not `Fn` diff --git a/src/test/ui/closure_context/issue-42065.rs b/src/test/ui/closure_context/issue-42065.rs index 9daa76d858f..c506600f4d9 100644 --- a/src/test/ui/closure_context/issue-42065.rs +++ b/src/test/ui/closure_context/issue-42065.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::HashMap; fn main() { diff --git a/src/test/ui/closure_context/issue-42065.stderr b/src/test/ui/closure_context/issue-42065.stderr index 5c2105c4f79..69d98654048 100644 --- a/src/test/ui/closure_context/issue-42065.stderr +++ b/src/test/ui/closure_context/issue-42065.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `debug_dump_dict` - --> $DIR/issue-42065.rs:21:5 + --> $DIR/issue-42065.rs:11:5 | LL | debug_dump_dict(); | --------------- value moved here @@ -7,7 +7,7 @@ LL | debug_dump_dict(); | ^^^^^^^^^^^^^^^ value used here after move | note: closure cannot be invoked more than once because it moves the variable `dict` out of its environment - --> $DIR/issue-42065.rs:16:29 + --> $DIR/issue-42065.rs:6:29 | LL | for (key, value) in dict { | ^^^^ diff --git a/src/test/ui/closure_promotion.rs b/src/test/ui/closure_promotion.rs index 7f282c73220..a80745e8bcc 100644 --- a/src/test/ui/closure_promotion.rs +++ b/src/test/ui/closure_promotion.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-compare-mode-nll #![allow(const_err)] diff --git a/src/test/ui/closure_promotion.stderr b/src/test/ui/closure_promotion.stderr index 058c8229303..7b901e30117 100644 --- a/src/test/ui/closure_promotion.stderr +++ b/src/test/ui/closure_promotion.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/closure_promotion.rs:17:26 + --> $DIR/closure_promotion.rs:7:26 | LL | let x: &'static _ = &|| { let z = 3; z }; //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/closures/closure-array-break-length.rs b/src/test/ui/closures/closure-array-break-length.rs index 8be5b925a39..ac17bfdc941 100644 --- a/src/test/ui/closures/closure-array-break-length.rs +++ b/src/test/ui/closures/closure-array-break-length.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { |_: [_; continue]| {}; //~ ERROR: `continue` outside of loop diff --git a/src/test/ui/closures/closure-array-break-length.stderr b/src/test/ui/closures/closure-array-break-length.stderr index f62b1354370..fa7a63b642e 100644 --- a/src/test/ui/closures/closure-array-break-length.stderr +++ b/src/test/ui/closures/closure-array-break-length.stderr @@ -1,17 +1,17 @@ error[E0268]: `continue` outside of loop - --> $DIR/closure-array-break-length.rs:12:13 + --> $DIR/closure-array-break-length.rs:2:13 | LL | |_: [_; continue]| {}; //~ ERROR: `continue` outside of loop | ^^^^^^^^ cannot break outside of a loop error[E0268]: `continue` outside of loop - --> $DIR/closure-array-break-length.rs:14:19 + --> $DIR/closure-array-break-length.rs:4:19 | LL | while |_: [_; continue]| {} {} //~ ERROR: `continue` outside of loop | ^^^^^^^^ cannot break outside of a loop error[E0268]: `break` outside of loop - --> $DIR/closure-array-break-length.rs:16:19 + --> $DIR/closure-array-break-length.rs:6:19 | LL | while |_: [_; break]| {} {} //~ ERROR: `break` outside of loop | ^^^^^ cannot break outside of a loop diff --git a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.rs b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.rs index 12e9fb30902..039cf3e0464 100644 --- a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.rs +++ b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct X where F: FnOnce() + 'static + Send { field: F, } diff --git a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr index e1b18b1d49e..7d637fed8ab 100644 --- a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr +++ b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: `F` cannot be sent between threads safely - --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:15:1 + --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:5:1 | LL | / fn foo(blk: F) -> X where F: FnOnce() + 'static { LL | | //~^ ERROR `F` cannot be sent between threads safely @@ -10,7 +10,7 @@ LL | | } = help: the trait `std::marker::Send` is not implemented for `F` = help: consider adding a `where F: std::marker::Send` bound note: required by `X` - --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:11:1 + --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:1:1 | LL | struct X where F: FnOnce() + 'static + Send { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.rs b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.rs index 1ffba68263a..4fa5d54431c 100644 --- a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.rs +++ b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn bar(blk: F) where F: FnOnce() + 'static { } diff --git a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.stderr b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.stderr index 825f469c330..f50c3e3b531 100644 --- a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.stderr +++ b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:15:5 + --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5 | LL | fn foo(x: &()) { | --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()` diff --git a/src/test/ui/closures/closure-bounds-subtype.rs b/src/test/ui/closures/closure-bounds-subtype.rs index db26535b004..4888cbfcc1f 100644 --- a/src/test/ui/closures/closure-bounds-subtype.rs +++ b/src/test/ui/closures/closure-bounds-subtype.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn take_any(_: F) where F: FnOnce() { } diff --git a/src/test/ui/closures/closure-bounds-subtype.stderr b/src/test/ui/closures/closure-bounds-subtype.stderr index ffe486d4468..d018956d026 100644 --- a/src/test/ui/closures/closure-bounds-subtype.stderr +++ b/src/test/ui/closures/closure-bounds-subtype.stderr @@ -1,5 +1,5 @@ error[E0277]: `F` cannot be shared between threads safely - --> $DIR/closure-bounds-subtype.rs:24:5 + --> $DIR/closure-bounds-subtype.rs:13:5 | LL | take_const_owned(f); //~ ERROR `F` cannot be shared between threads safely [E0277] | ^^^^^^^^^^^^^^^^ `F` cannot be shared between threads safely @@ -7,7 +7,7 @@ LL | take_const_owned(f); //~ ERROR `F` cannot be shared between threads saf = help: the trait `std::marker::Sync` is not implemented for `F` = help: consider adding a `where F: std::marker::Sync` bound note: required by `take_const_owned` - --> $DIR/closure-bounds-subtype.rs:15:1 + --> $DIR/closure-bounds-subtype.rs:4:1 | LL | fn take_const_owned(_: F) where F: FnOnce() + Sync + Send { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.rs b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.rs index a464c5853e1..28a6ab77a91 100644 --- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.rs +++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] fn closure_expecting_bound(_: F) diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr index 56b43bbd7d3..633dd4f5c62 100644 --- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr +++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr @@ -1,5 +1,5 @@ error: borrowed data cannot be stored outside of its closure - --> $DIR/expect-region-supply-region.rs:28:18 + --> $DIR/expect-region-supply-region.rs:18:18 | LL | let mut f: Option<&u32> = None; | ----- borrowed data cannot be stored into here... @@ -9,7 +9,7 @@ LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of it | ^ cannot be stored outside of its closure error: borrowed data cannot be stored outside of its closure - --> $DIR/expect-region-supply-region.rs:38:18 + --> $DIR/expect-region-supply-region.rs:28:18 | LL | let mut f: Option<&u32> = None; | ----- borrowed data cannot be stored into here... @@ -19,15 +19,15 @@ LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of it | ^ cannot be stored outside of its closure error[E0308]: mismatched types - --> $DIR/expect-region-supply-region.rs:47:33 + --> $DIR/expect-region-supply-region.rs:37:33 | LL | closure_expecting_bound(|x: &'x u32| { | ^^^^^^^ lifetime mismatch | = note: expected type `&u32` found type `&'x u32` -note: the anonymous lifetime #2 defined on the body at 47:29... - --> $DIR/expect-region-supply-region.rs:47:29 +note: the anonymous lifetime #2 defined on the body at 37:29... + --> $DIR/expect-region-supply-region.rs:37:29 | LL | closure_expecting_bound(|x: &'x u32| { | _____________________________^ @@ -38,27 +38,27 @@ LL | | LL | | //~^ ERROR borrowed data cannot be stored outside of its closure LL | | }); | |_____^ -note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 42:30 - --> $DIR/expect-region-supply-region.rs:42:30 +note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 32:30 + --> $DIR/expect-region-supply-region.rs:32:30 | LL | fn expect_bound_supply_named<'x>() { | ^^ error[E0308]: mismatched types - --> $DIR/expect-region-supply-region.rs:47:33 + --> $DIR/expect-region-supply-region.rs:37:33 | LL | closure_expecting_bound(|x: &'x u32| { | ^^^^^^^ lifetime mismatch | = note: expected type `&u32` found type `&'x u32` -note: the lifetime 'x as defined on the function body at 42:30... - --> $DIR/expect-region-supply-region.rs:42:30 +note: the lifetime 'x as defined on the function body at 32:30... + --> $DIR/expect-region-supply-region.rs:32:30 | LL | fn expect_bound_supply_named<'x>() { | ^^ -note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 47:29 - --> $DIR/expect-region-supply-region.rs:47:29 +note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 37:29 + --> $DIR/expect-region-supply-region.rs:37:29 | LL | closure_expecting_bound(|x: &'x u32| { | _____________________________^ @@ -71,7 +71,7 @@ LL | | }); | |_____^ error: borrowed data cannot be stored outside of its closure - --> $DIR/expect-region-supply-region.rs:52:18 + --> $DIR/expect-region-supply-region.rs:42:18 | LL | let mut f: Option<&u32> = None; | ----- borrowed data cannot be stored into here... diff --git a/src/test/ui/closures/closure-immutable-outer-variable.fixed b/src/test/ui/closures/closure-immutable-outer-variable.fixed index b3a0d592f76..22164a24d8b 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.fixed +++ b/src/test/ui/closures/closure-immutable-outer-variable.fixed @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix // Point at the captured immutable outer variable diff --git a/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr b/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr index d91c1199b3f..0c4d90f4c53 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr +++ b/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `y`, as it is not declared as mutable - --> $DIR/closure-immutable-outer-variable.rs:21:26 + --> $DIR/closure-immutable-outer-variable.rs:11:26 | LL | let y = true; | - help: consider changing this to be mutable: `mut y` diff --git a/src/test/ui/closures/closure-immutable-outer-variable.rs b/src/test/ui/closures/closure-immutable-outer-variable.rs index e162678460c..fc4e3857268 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.rs +++ b/src/test/ui/closures/closure-immutable-outer-variable.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix // Point at the captured immutable outer variable diff --git a/src/test/ui/closures/closure-immutable-outer-variable.rs.fixed b/src/test/ui/closures/closure-immutable-outer-variable.rs.fixed index 80a5a45a305..5c6358beb24 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.rs.fixed +++ b/src/test/ui/closures/closure-immutable-outer-variable.rs.fixed @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Point at the captured immutable outer variable fn foo(mut f: Box) { diff --git a/src/test/ui/closures/closure-immutable-outer-variable.stderr b/src/test/ui/closures/closure-immutable-outer-variable.stderr index 0ee11d8cf15..c6a6ebd931c 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.stderr +++ b/src/test/ui/closures/closure-immutable-outer-variable.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure - --> $DIR/closure-immutable-outer-variable.rs:21:26 + --> $DIR/closure-immutable-outer-variable.rs:11:26 | LL | let y = true; | - help: consider making `y` mutable: `mut y` diff --git a/src/test/ui/closures/closure-move-sync.rs b/src/test/ui/closures/closure-move-sync.rs index e096e7ca3a0..580cd1af4f3 100644 --- a/src/test/ui/closures/closure-move-sync.rs +++ b/src/test/ui/closures/closure-move-sync.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::thread; use std::sync::mpsc::channel; diff --git a/src/test/ui/closures/closure-move-sync.stderr b/src/test/ui/closures/closure-move-sync.stderr index 076bae8dbd7..8afebc7c748 100644 --- a/src/test/ui/closures/closure-move-sync.stderr +++ b/src/test/ui/closures/closure-move-sync.stderr @@ -1,23 +1,23 @@ error[E0277]: `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely - --> $DIR/closure-move-sync.rs:16:13 + --> $DIR/closure-move-sync.rs:6:13 | LL | let t = thread::spawn(|| { | ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Receiver<()>` = note: required because of the requirements on the impl of `std::marker::Send` for `&std::sync::mpsc::Receiver<()>` - = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:16:27: 19:6 recv:&std::sync::mpsc::Receiver<()>]` + = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:6:27: 9:6 recv:&std::sync::mpsc::Receiver<()>]` = note: required by `std::thread::spawn` error[E0277]: `std::sync::mpsc::Sender<()>` cannot be shared between threads safely - --> $DIR/closure-move-sync.rs:28:5 + --> $DIR/closure-move-sync.rs:18:5 | LL | thread::spawn(|| tx.send(()).unwrap()); | ^^^^^^^^^^^^^ `std::sync::mpsc::Sender<()>` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Sender<()>` = note: required because of the requirements on the impl of `std::marker::Send` for `&std::sync::mpsc::Sender<()>` - = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:28:19: 28:42 tx:&std::sync::mpsc::Sender<()>]` + = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:18:19: 18:42 tx:&std::sync::mpsc::Sender<()>]` = note: required by `std::thread::spawn` error: aborting due to 2 previous errors diff --git a/src/test/ui/closures/closure-no-fn-1.rs b/src/test/ui/closures/closure-no-fn-1.rs index 10c99703a97..48c3e472520 100644 --- a/src/test/ui/closures/closure-no-fn-1.rs +++ b/src/test/ui/closures/closure-no-fn-1.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensure that capturing closures are never coerced to fns // Especially interesting as non-capturing closures can be. diff --git a/src/test/ui/closures/closure-no-fn-1.stderr b/src/test/ui/closures/closure-no-fn-1.stderr index 4786a6836cd..6d07c6b035e 100644 --- a/src/test/ui/closures/closure-no-fn-1.stderr +++ b/src/test/ui/closures/closure-no-fn-1.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/closure-no-fn-1.rs:16:29 + --> $DIR/closure-no-fn-1.rs:6:29 | LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a }; | ^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found closure | = note: expected type `fn(u8) -> u8` - found type `[closure@$DIR/closure-no-fn-1.rs:16:29: 16:50 a:_]` + found type `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:50 a:_]` error: aborting due to previous error diff --git a/src/test/ui/closures/closure-no-fn-2.rs b/src/test/ui/closures/closure-no-fn-2.rs index a6438bb5f24..f3066f7a330 100644 --- a/src/test/ui/closures/closure-no-fn-2.rs +++ b/src/test/ui/closures/closure-no-fn-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensure that capturing closures are never coerced to fns // Especially interesting as non-capturing closures can be. diff --git a/src/test/ui/closures/closure-no-fn-2.stderr b/src/test/ui/closures/closure-no-fn-2.stderr index 1aad49777dc..5adcdf6058b 100644 --- a/src/test/ui/closures/closure-no-fn-2.stderr +++ b/src/test/ui/closures/closure-no-fn-2.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/closure-no-fn-2.rs:16:27 + --> $DIR/closure-no-fn-2.rs:6:27 | LL | let bar: fn() -> u8 = || { b }; | ^^^^^^^^ expected fn pointer, found closure | = note: expected type `fn() -> u8` - found type `[closure@$DIR/closure-no-fn-2.rs:16:27: 16:35 b:_]` + found type `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:35 b:_]` error: aborting due to previous error diff --git a/src/test/ui/closures/closure-no-fn-3.rs b/src/test/ui/closures/closure-no-fn-3.rs index 6584c16c9de..53217c2f199 100644 --- a/src/test/ui/closures/closure-no-fn-3.rs +++ b/src/test/ui/closures/closure-no-fn-3.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensure that capturing closures are never coerced to fns // Especially interesting as non-capturing closures can be. diff --git a/src/test/ui/closures/closure-no-fn-3.stderr b/src/test/ui/closures/closure-no-fn-3.stderr index bd28045c1b9..ab6056b6547 100644 --- a/src/test/ui/closures/closure-no-fn-3.stderr +++ b/src/test/ui/closures/closure-no-fn-3.stderr @@ -1,5 +1,5 @@ -error[E0605]: non-primitive cast: `[closure@$DIR/closure-no-fn-3.rs:16:27: 16:37 b:_]` as `fn() -> u8` - --> $DIR/closure-no-fn-3.rs:16:27 +error[E0605]: non-primitive cast: `[closure@$DIR/closure-no-fn-3.rs:6:27: 6:37 b:_]` as `fn() -> u8` + --> $DIR/closure-no-fn-3.rs:6:27 | LL | let baz: fn() -> u8 = (|| { b }) as fn() -> u8; | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/closures/closure-referencing-itself-issue-25954.rs b/src/test/ui/closures/closure-referencing-itself-issue-25954.rs index 9357d0e7615..7dd0e51797d 100644 --- a/src/test/ui/closures/closure-referencing-itself-issue-25954.rs +++ b/src/test/ui/closures/closure-referencing-itself-issue-25954.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #25954: detect and reject a closure type that // references itself. diff --git a/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr b/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr index fa00d9fd9a4..f60be43bba8 100644 --- a/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr +++ b/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/closure-referencing-itself-issue-25954.rs:25:13 + --> $DIR/closure-referencing-itself-issue-25954.rs:15:13 | LL | let q = || p.b.set(5i32); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^ cyclic type of infinite size diff --git a/src/test/ui/closures/closure-reform-bad.rs b/src/test/ui/closures/closure-reform-bad.rs index 490734d463d..0ba48ab5184 100644 --- a/src/test/ui/closures/closure-reform-bad.rs +++ b/src/test/ui/closures/closure-reform-bad.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ diff --git a/src/test/ui/closures/closure-reform-bad.stderr b/src/test/ui/closures/closure-reform-bad.stderr index a4e18175369..76f88d04907 100644 --- a/src/test/ui/closures/closure-reform-bad.stderr +++ b/src/test/ui/closures/closure-reform-bad.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/closure-reform-bad.rs:21:15 + --> $DIR/closure-reform-bad.rs:11:15 | LL | call_bare(f) //~ ERROR mismatched types | ^ expected fn pointer, found closure | = note: expected type `for<'r> fn(&'r str)` - found type `[closure@$DIR/closure-reform-bad.rs:20:13: 20:50 string:_]` + found type `[closure@$DIR/closure-reform-bad.rs:10:13: 10:50 string:_]` error: aborting due to previous error diff --git a/src/test/ui/closures/closure-wrong-kind.rs b/src/test/ui/closures/closure-wrong-kind.rs index a387e4c5ece..9bf38bfb66b 100644 --- a/src/test/ui/closures/closure-wrong-kind.rs +++ b/src/test/ui/closures/closure-wrong-kind.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ diff --git a/src/test/ui/closures/closure-wrong-kind.stderr b/src/test/ui/closures/closure-wrong-kind.stderr index 636f30770a9..b289ea29644 100644 --- a/src/test/ui/closures/closure-wrong-kind.stderr +++ b/src/test/ui/closures/closure-wrong-kind.stderr @@ -1,5 +1,5 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` - --> $DIR/closure-wrong-kind.rs:20:19 + --> $DIR/closure-wrong-kind.rs:10:19 | LL | let closure = |_| foo(x); //~ ERROR E0525 | ^^^^^^^^-^ diff --git a/src/test/ui/codemap_tests/bad-format-args.rs b/src/test/ui/codemap_tests/bad-format-args.rs index df7d5fe927e..9f901857744 100644 --- a/src/test/ui/codemap_tests/bad-format-args.rs +++ b/src/test/ui/codemap_tests/bad-format-args.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { format!(); //~ ERROR requires at least a format string argument format!("" 1); //~ ERROR expected token: `,` diff --git a/src/test/ui/codemap_tests/bad-format-args.stderr b/src/test/ui/codemap_tests/bad-format-args.stderr index 1c801f2a790..38320416b45 100644 --- a/src/test/ui/codemap_tests/bad-format-args.stderr +++ b/src/test/ui/codemap_tests/bad-format-args.stderr @@ -1,5 +1,5 @@ error: requires at least a format string argument - --> $DIR/bad-format-args.rs:12:5 + --> $DIR/bad-format-args.rs:2:5 | LL | format!(); //~ ERROR requires at least a format string argument | ^^^^^^^^^^ @@ -7,13 +7,13 @@ LL | format!(); //~ ERROR requires at least a format string argument = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: expected token: `,` - --> $DIR/bad-format-args.rs:13:16 + --> $DIR/bad-format-args.rs:3:16 | LL | format!("" 1); //~ ERROR expected token: `,` | ^ error: expected token: `,` - --> $DIR/bad-format-args.rs:14:19 + --> $DIR/bad-format-args.rs:4:19 | LL | format!("", 1 1); //~ ERROR expected token: `,` | ^ diff --git a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs index 532d173011d..f35fbad7cd6 100644 --- a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs +++ b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] trait C {} diff --git a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr index 7975966bf80..5f8bc387a3d 100644 --- a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr +++ b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr @@ -1,5 +1,5 @@ error[E0592]: duplicate definitions with name `f` - --> $DIR/coherence-overlapping-inherent-impl-trait.rs:14:10 + --> $DIR/coherence-overlapping-inherent-impl-trait.rs:4:10 | LL | impl C { fn f() {} } //~ ERROR duplicate | ^^^^^^^^^ duplicate definitions for `f` diff --git a/src/test/ui/codemap_tests/empty_span.rs b/src/test/ui/codemap_tests/empty_span.rs index 8e0395e3c50..4d52b391280 100644 --- a/src/test/ui/codemap_tests/empty_span.rs +++ b/src/test/ui/codemap_tests/empty_span.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] fn main() { struct Foo; diff --git a/src/test/ui/codemap_tests/empty_span.stderr b/src/test/ui/codemap_tests/empty_span.stderr index 9383bfc92a8..f5285677097 100644 --- a/src/test/ui/codemap_tests/empty_span.stderr +++ b/src/test/ui/codemap_tests/empty_span.stderr @@ -1,5 +1,5 @@ error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static main::Foo` - --> $DIR/empty_span.rs:17:5 + --> $DIR/empty_span.rs:7:5 | LL | unsafe impl Send for &'static Foo { } //~ ERROR cross-crate traits with a default impl | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr b/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr index 8251f04d353..7fdeb03acbd 100644 --- a/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr +++ b/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/huge_multispan_highlight.rs:100:13 + --> $DIR/huge_multispan_highlight.rs:90:13 | LL | let x = "foo"; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.rs b/src/test/ui/codemap_tests/huge_multispan_highlight.rs index cf593eab853..623c59081d0 100644 --- a/src/test/ui/codemap_tests/huge_multispan_highlight.rs +++ b/src/test/ui/codemap_tests/huge_multispan_highlight.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = "foo"; diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.stderr b/src/test/ui/codemap_tests/huge_multispan_highlight.stderr index 42eb1e9cb21..41df802b503 100644 --- a/src/test/ui/codemap_tests/huge_multispan_highlight.stderr +++ b/src/test/ui/codemap_tests/huge_multispan_highlight.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable - --> $DIR/huge_multispan_highlight.rs:100:18 + --> $DIR/huge_multispan_highlight.rs:90:18 | LL | let x = "foo"; | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/codemap_tests/issue-11715.nll.stderr b/src/test/ui/codemap_tests/issue-11715.nll.stderr index 76ed3bc3137..9f30f385425 100644 --- a/src/test/ui/codemap_tests/issue-11715.nll.stderr +++ b/src/test/ui/codemap_tests/issue-11715.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/issue-11715.rs:100:13 + --> $DIR/issue-11715.rs:5:13 | LL | let y = &mut x; | ------ first mutable borrow occurs here diff --git a/src/test/ui/codemap_tests/issue-11715.rs b/src/test/ui/codemap_tests/issue-11715.rs index 415aa368708..617d57ff75a 100644 --- a/src/test/ui/codemap_tests/issue-11715.rs +++ b/src/test/ui/codemap_tests/issue-11715.rs @@ -1,98 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #![feature(rustc_attrs)] fn main() { #![rustc_error] // rust-lang/rust#49855 let mut x = "foo"; diff --git a/src/test/ui/codemap_tests/issue-11715.stderr b/src/test/ui/codemap_tests/issue-11715.stderr index eb73c69c5dc..8f320a4e19b 100644 --- a/src/test/ui/codemap_tests/issue-11715.stderr +++ b/src/test/ui/codemap_tests/issue-11715.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/issue-11715.rs:100:18 + --> $DIR/issue-11715.rs:5:18 | LL | let y = &mut x; | - first mutable borrow occurs here diff --git a/src/test/ui/codemap_tests/issue-28308.rs b/src/test/ui/codemap_tests/issue-28308.rs index c71c28ed625..81493f8c453 100644 --- a/src/test/ui/codemap_tests/issue-28308.rs +++ b/src/test/ui/codemap_tests/issue-28308.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { assert!("foo"); //~^ ERROR cannot apply unary operator `!` diff --git a/src/test/ui/codemap_tests/issue-28308.stderr b/src/test/ui/codemap_tests/issue-28308.stderr index 15c159a3b15..d44c157003d 100644 --- a/src/test/ui/codemap_tests/issue-28308.stderr +++ b/src/test/ui/codemap_tests/issue-28308.stderr @@ -1,5 +1,5 @@ error[E0600]: cannot apply unary operator `!` to type `&'static str` - --> $DIR/issue-28308.rs:12:5 + --> $DIR/issue-28308.rs:2:5 | LL | assert!("foo"); | ^^^^^^^^^^^^^^^ cannot apply unary operator `!` diff --git a/src/test/ui/codemap_tests/one_line.nll.stderr b/src/test/ui/codemap_tests/one_line.nll.stderr index d79405e9a59..0eb257c5976 100644 --- a/src/test/ui/codemap_tests/one_line.nll.stderr +++ b/src/test/ui/codemap_tests/one_line.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time - --> $DIR/one_line.rs:13:12 + --> $DIR/one_line.rs:3:12 | LL | v.push(v.pop().unwrap()); //~ ERROR cannot borrow | - ---- ^ second mutable borrow occurs here diff --git a/src/test/ui/codemap_tests/one_line.rs b/src/test/ui/codemap_tests/one_line.rs index 3fb35dd26ac..bb36813dbdd 100644 --- a/src/test/ui/codemap_tests/one_line.rs +++ b/src/test/ui/codemap_tests/one_line.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let mut v = vec![Some("foo"), Some("bar")]; v.push(v.pop().unwrap()); //~ ERROR cannot borrow diff --git a/src/test/ui/codemap_tests/one_line.stderr b/src/test/ui/codemap_tests/one_line.stderr index 5a6d474ed16..2ea793c0969 100644 --- a/src/test/ui/codemap_tests/one_line.stderr +++ b/src/test/ui/codemap_tests/one_line.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time - --> $DIR/one_line.rs:13:12 + --> $DIR/one_line.rs:3:12 | LL | v.push(v.pop().unwrap()); //~ ERROR cannot borrow | - ^ - first borrow ends here diff --git a/src/test/ui/codemap_tests/overlapping_inherent_impls.rs b/src/test/ui/codemap_tests/overlapping_inherent_impls.rs index 18e77ddfd2c..66af212267d 100644 --- a/src/test/ui/codemap_tests/overlapping_inherent_impls.rs +++ b/src/test/ui/codemap_tests/overlapping_inherent_impls.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that you cannot define items with the same name in overlapping inherent // impl blocks. diff --git a/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr b/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr index db729ac34f3..1b20b699d9f 100644 --- a/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr +++ b/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr @@ -1,5 +1,5 @@ error[E0592]: duplicate definitions with name `id` - --> $DIR/overlapping_inherent_impls.rs:19:5 + --> $DIR/overlapping_inherent_impls.rs:9:5 | LL | fn id() {} //~ ERROR duplicate definitions | ^^^^^^^^^^ duplicate definitions for `id` @@ -8,7 +8,7 @@ LL | fn id() {} | ---------- other definition for `id` error[E0592]: duplicate definitions with name `bar` - --> $DIR/overlapping_inherent_impls.rs:29:5 + --> $DIR/overlapping_inherent_impls.rs:19:5 | LL | fn bar(&self) {} //~ ERROR duplicate definitions | ^^^^^^^^^^^^^^^^ duplicate definitions for `bar` @@ -17,7 +17,7 @@ LL | fn bar(&self) {} | ---------------- other definition for `bar` error[E0592]: duplicate definitions with name `baz` - --> $DIR/overlapping_inherent_impls.rs:39:5 + --> $DIR/overlapping_inherent_impls.rs:29:5 | LL | fn baz(&self) {} //~ ERROR duplicate definitions | ^^^^^^^^^^^^^^^^ duplicate definitions for `baz` diff --git a/src/test/ui/codemap_tests/tab.rs b/src/test/ui/codemap_tests/tab.rs index b8dedb0daf5..64569f2e72b 100644 --- a/src/test/ui/codemap_tests/tab.rs +++ b/src/test/ui/codemap_tests/tab.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-tab fn main() { diff --git a/src/test/ui/codemap_tests/tab.stderr b/src/test/ui/codemap_tests/tab.stderr index c466610bcec..80b5773fda3 100644 --- a/src/test/ui/codemap_tests/tab.stderr +++ b/src/test/ui/codemap_tests/tab.stderr @@ -1,11 +1,11 @@ error[E0425]: cannot find value `bar` in this scope - --> $DIR/tab.rs:14:2 + --> $DIR/tab.rs:4:2 | LL | bar; //~ ERROR cannot find value `bar` | ^^^ not found in this scope error[E0308]: mismatched types - --> $DIR/tab.rs:18:2 + --> $DIR/tab.rs:8:2 | LL | fn foo() { | - help: try adding a return type: `-> &'static str` diff --git a/src/test/ui/codemap_tests/tab_2.rs b/src/test/ui/codemap_tests/tab_2.rs index b759a4abcae..644697c3239 100644 --- a/src/test/ui/codemap_tests/tab_2.rs +++ b/src/test/ui/codemap_tests/tab_2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-tab fn main() { diff --git a/src/test/ui/codemap_tests/tab_2.stderr b/src/test/ui/codemap_tests/tab_2.stderr index d8ad5955cae..f7eec3eb8da 100644 --- a/src/test/ui/codemap_tests/tab_2.stderr +++ b/src/test/ui/codemap_tests/tab_2.stderr @@ -1,5 +1,5 @@ error: unterminated double quote string - --> $DIR/tab_2.rs:14:7 + --> $DIR/tab_2.rs:4:7 | LL | """; //~ ERROR unterminated double quote | ___________________^ diff --git a/src/test/ui/codemap_tests/tab_3.nll.stderr b/src/test/ui/codemap_tests/tab_3.nll.stderr index c56cb7772c8..3b8507a067d 100644 --- a/src/test/ui/codemap_tests/tab_3.nll.stderr +++ b/src/test/ui/codemap_tests/tab_3.nll.stderr @@ -1,13 +1,13 @@ error[E0382]: borrow of moved value: `some_vec` - --> $DIR/tab_3.rs:17:20 + --> $DIR/tab_3.rs:7:20 | +LL | let some_vec = vec!["hi"]; + | -------- move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait LL | some_vec.into_iter(); | -------- value moved here LL | { LL | println!("{:?}", some_vec); //~ ERROR use of moved | ^^^^^^^^ value borrowed here after move - | - = note: move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/tab_3.rs b/src/test/ui/codemap_tests/tab_3.rs index ea235ed71a9..4fd5b70f7ae 100644 --- a/src/test/ui/codemap_tests/tab_3.rs +++ b/src/test/ui/codemap_tests/tab_3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-tab fn main() { diff --git a/src/test/ui/codemap_tests/tab_3.stderr b/src/test/ui/codemap_tests/tab_3.stderr index d960c0b7da8..6e93ae13069 100644 --- a/src/test/ui/codemap_tests/tab_3.stderr +++ b/src/test/ui/codemap_tests/tab_3.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `some_vec` - --> $DIR/tab_3.rs:17:20 + --> $DIR/tab_3.rs:7:20 | LL | some_vec.into_iter(); | -------- value moved here diff --git a/src/test/ui/codemap_tests/two_files.rs b/src/test/ui/codemap_tests/two_files.rs index 4c99ee67598..71d97d3c289 100644 --- a/src/test/ui/codemap_tests/two_files.rs +++ b/src/test/ui/codemap_tests/two_files.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - include!("two_files_data.rs"); struct Baz { } diff --git a/src/test/ui/codemap_tests/two_files.stderr b/src/test/ui/codemap_tests/two_files.stderr index f60f1dfcf37..65df3f382c0 100644 --- a/src/test/ui/codemap_tests/two_files.stderr +++ b/src/test/ui/codemap_tests/two_files.stderr @@ -1,5 +1,5 @@ error[E0404]: expected trait, found type alias `Bar` - --> $DIR/two_files.rs:15:6 + --> $DIR/two_files.rs:5:6 | LL | impl Bar for Baz { } //~ ERROR expected trait, found type alias | ^^^ type aliases cannot be used as traits diff --git a/src/test/ui/codemap_tests/two_files_data.rs b/src/test/ui/codemap_tests/two_files_data.rs index a3dcea0546d..db8ab14e673 100644 --- a/src/test/ui/codemap_tests/two_files_data.rs +++ b/src/test/ui/codemap_tests/two_files_data.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test trait Foo { } diff --git a/src/test/ui/codemap_tests/unicode.rs b/src/test/ui/codemap_tests/unicode.rs index ac22906a623..7180e903b5c 100644 --- a/src/test/ui/codemap_tests/unicode.rs +++ b/src/test/ui/codemap_tests/unicode.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI fn main() { } diff --git a/src/test/ui/codemap_tests/unicode.stderr b/src/test/ui/codemap_tests/unicode.stderr index ee11a6662c2..1ba6ac44788 100644 --- a/src/test/ui/codemap_tests/unicode.stderr +++ b/src/test/ui/codemap_tests/unicode.stderr @@ -1,5 +1,5 @@ error[E0703]: invalid ABI: found `路濫狼á́́` - --> $DIR/unicode.rs:11:8 + --> $DIR/unicode.rs:1:8 | LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI | ^^^^^^^^^ invalid ABI diff --git a/src/test/ui/codemap_tests/unicode_2.rs b/src/test/ui/codemap_tests/unicode_2.rs index c01b0b286af..fa69115b2da 100644 --- a/src/test/ui/codemap_tests/unicode_2.rs +++ b/src/test/ui/codemap_tests/unicode_2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(non_ascii_idents)] fn main() { diff --git a/src/test/ui/codemap_tests/unicode_2.stderr b/src/test/ui/codemap_tests/unicode_2.stderr index b7f7f7fc5ce..1bc7452b9f2 100644 --- a/src/test/ui/codemap_tests/unicode_2.stderr +++ b/src/test/ui/codemap_tests/unicode_2.stderr @@ -1,5 +1,5 @@ error: invalid width `7` for integer literal - --> $DIR/unicode_2.rs:14:25 + --> $DIR/unicode_2.rs:4:25 | LL | let _ = ("a̐éö̲", 0u7); //~ ERROR invalid width | ^^^ @@ -7,7 +7,7 @@ LL | let _ = ("a̐éö̲", 0u7); //~ ERROR invalid width = help: valid widths are 8, 16, 32, 64 and 128 error: invalid width `42` for integer literal - --> $DIR/unicode_2.rs:15:20 + --> $DIR/unicode_2.rs:5:20 | LL | let _ = ("아あ", 1i42); //~ ERROR invalid width | ^^^^ @@ -15,7 +15,7 @@ LL | let _ = ("아あ", 1i42); //~ ERROR invalid width = help: valid widths are 8, 16, 32, 64 and 128 error[E0425]: cannot find value `a̐é` in this scope - --> $DIR/unicode_2.rs:16:13 + --> $DIR/unicode_2.rs:6:13 | LL | let _ = a̐é; //~ ERROR cannot find | ^^ not found in this scope diff --git a/src/test/ui/codemap_tests/unicode_3.rs b/src/test/ui/codemap_tests/unicode_3.rs index 5e6dde7413b..ff6d54468b8 100644 --- a/src/test/ui/codemap_tests/unicode_3.rs +++ b/src/test/ui/codemap_tests/unicode_3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass fn main() { diff --git a/src/test/ui/codemap_tests/unicode_3.stderr b/src/test/ui/codemap_tests/unicode_3.stderr index 1a44d39aa27..56f4f73131f 100644 --- a/src/test/ui/codemap_tests/unicode_3.stderr +++ b/src/test/ui/codemap_tests/unicode_3.stderr @@ -1,5 +1,5 @@ warning: denote infinite loops with `loop { ... }` - --> $DIR/unicode_3.rs:14:45 + --> $DIR/unicode_3.rs:4:45 | LL | let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; } | ^^^^^^^^^^ help: use `loop` diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs b/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs index ef65927fc5d..9a4e134cb39 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A version of coerce-expect-unsized that uses type ascription. // Doesn't work so far, but supposed to work eventually diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr index 894fbbf202a..5ad3889666b 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:19:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:9:13 | LL | let _ = box { [1, 2, 3] }: Box<[i32]>; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements @@ -8,7 +8,7 @@ LL | let _ = box { [1, 2, 3] }: Box<[i32]>; //~ ERROR mismatched types found type `std::boxed::Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:20:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:10:13 | LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements @@ -17,7 +17,7 @@ LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; //~ E found type `std::boxed::Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:21:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:11:13 | LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[i32]>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements @@ -26,16 +26,16 @@ LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[ found type `std::boxed::Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:23:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:13:13 | LL | let _ = box { |x| (x as u8) }: Box _>; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `std::boxed::Box u8>` - found type `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:23:19: 23:32]>` + found type `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:19: 13:32]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:24:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:14:13 | LL | let _ = box if true { false } else { true }: Box; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool @@ -44,7 +44,7 @@ LL | let _ = box if true { false } else { true }: Box; //~ ERROR mism found type `std::boxed::Box` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:25:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:15:13 | LL | let _ = box match true { true => 'a', false => 'b' }: Box; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char @@ -53,7 +53,7 @@ LL | let _ = box match true { true => 'a', false => 'b' }: Box; //~ E found type `std::boxed::Box` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:27:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:17:13 | LL | let _ = &{ [1, 2, 3] }: &[i32]; //~ ERROR mismatched types | ^^^^^^^^^^^^^^ expected slice, found array of 3 elements @@ -62,7 +62,7 @@ LL | let _ = &{ [1, 2, 3] }: &[i32]; //~ ERROR mismatched types found type `&[i32; 3]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:28:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:18:13 | LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements @@ -71,7 +71,7 @@ LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; //~ ERROR mi found type `&[i32; 3]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:29:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:19:13 | LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements @@ -80,16 +80,16 @@ LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; found type `&[i32; 3]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:31:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:21:13 | LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `&dyn std::ops::Fn(i32) -> u8` - found type `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:31:16: 31:29]` + found type `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:29]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:32:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:22:13 | LL | let _ = &if true { false } else { true }: &Debug; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool @@ -98,7 +98,7 @@ LL | let _ = &if true { false } else { true }: &Debug; //~ ERROR mismatched found type `&bool` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:33:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:23:13 | LL | let _ = &match true { true => 'a', false => 'b' }: &Debug; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char @@ -107,7 +107,7 @@ LL | let _ = &match true { true => 'a', false => 'b' }: &Debug; //~ ERROR mi found type `&char` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:35:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:25:13 | LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements @@ -116,13 +116,13 @@ LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; //~ ERROR mismatched types found type `std::boxed::Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:36:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:26:13 | LL | let _ = Box::new(|x| (x as u8)): Box _>; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `std::boxed::Box _>` - found type `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:36:22: 36:35]>` + found type `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>` error: aborting due to 14 previous errors diff --git a/src/test/ui/coercion/coerce-issue-49593-box-never.rs b/src/test/ui/coercion/coerce-issue-49593-box-never.rs new file mode 100644 index 00000000000..81723bb15b7 --- /dev/null +++ b/src/test/ui/coercion/coerce-issue-49593-box-never.rs @@ -0,0 +1,52 @@ +// compile-pass + +#![feature(never_type)] +#![allow(unreachable_code)] + +use std::error::Error; +use std::mem; + +fn raw_ptr_box(t: T) -> *mut T { + panic!() +} + +fn foo(x: !) -> Box { + /* *mut $0 is coerced to Box here */ Box::<_ /* ! */>::new(x) +} + +fn foo_raw_ptr(x: !) -> *mut dyn Error { + /* *mut $0 is coerced to *mut Error here */ raw_ptr_box::<_ /* ! */>(x) +} + +fn no_coercion(d: *mut dyn Error) -> *mut dyn Error { + /* an unsize coercion won't compile here, and it is indeed not used + because there is nothing requiring the _ to be Sized */ + d as *mut _ +} + +trait Xyz {} +struct S; +struct T; +impl Xyz for S {} +impl Xyz for T {} + +fn foo_no_never() { + let mut x /* : Option */ = None; + let mut first_iter = false; + loop { + if !first_iter { + let y: Box + = /* Box<$0> is coerced to Box here */ Box::new(x.unwrap()); + } + + x = Some(S); + first_iter = true; + } + + let mut y : Option = None; + // assert types are equal + mem::swap(&mut x, &mut y); +} + +fn main() { +} diff --git a/src/test/ui/coercion/coerce-mut.rs b/src/test/ui/coercion/coerce-mut.rs index bc3d58ef33d..409fb8e86be 100644 --- a/src/test/ui/coercion/coerce-mut.rs +++ b/src/test/ui/coercion/coerce-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f(x: &mut i32) {} fn main() { diff --git a/src/test/ui/coercion/coerce-mut.stderr b/src/test/ui/coercion/coerce-mut.stderr index 5e460b199a1..f8e3d6e60d6 100644 --- a/src/test/ui/coercion/coerce-mut.stderr +++ b/src/test/ui/coercion/coerce-mut.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/coerce-mut.rs:15:7 + --> $DIR/coerce-mut.rs:5:7 | LL | f(&x); | ^^ types differ in mutability diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.ast.nll.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.ast.nll.stderr index 60584e481c1..5b9249cffae 100644 --- a/src/test/ui/coercion/coerce-overloaded-autoderef.ast.nll.stderr +++ b/src/test/ui/coercion/coerce-overloaded-autoderef.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/coerce-overloaded-autoderef.rs:22:24 + --> $DIR/coerce-overloaded-autoderef.rs:12:24 | LL | let y = borrow_mut(x); | - first mutable borrow occurs here @@ -10,7 +10,7 @@ LL | drop((y, z)); | - first borrow later used here error[E0506]: cannot assign to `**x` because it is borrowed - --> $DIR/coerce-overloaded-autoderef.rs:31:5 + --> $DIR/coerce-overloaded-autoderef.rs:21:5 | LL | let y = borrow(x); | - borrow of `**x` occurs here @@ -22,7 +22,7 @@ LL | drop((y, z)); | - borrow later used here error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/coerce-overloaded-autoderef.rs:38:20 + --> $DIR/coerce-overloaded-autoderef.rs:28:20 | LL | borrow_mut2(x, x); | ----------- - ^ second mutable borrow occurs here @@ -31,7 +31,7 @@ LL | borrow_mut2(x, x); | first borrow later used by call error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable - --> $DIR/coerce-overloaded-autoderef.rs:44:5 + --> $DIR/coerce-overloaded-autoderef.rs:34:5 | LL | borrow2(x, x); | -------^^^^-^ diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.ast.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.ast.stderr index 3bb5ec72002..54215f56bca 100644 --- a/src/test/ui/coercion/coerce-overloaded-autoderef.ast.stderr +++ b/src/test/ui/coercion/coerce-overloaded-autoderef.ast.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/coerce-overloaded-autoderef.rs:22:24 + --> $DIR/coerce-overloaded-autoderef.rs:12:24 | LL | let y = borrow_mut(x); | - first mutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - first borrow ends here error[E0506]: cannot assign to `**x` because it is borrowed - --> $DIR/coerce-overloaded-autoderef.rs:31:5 + --> $DIR/coerce-overloaded-autoderef.rs:21:5 | LL | let y = borrow(x); | - borrow of `**x` occurs here @@ -19,7 +19,7 @@ LL | **x += 1; | ^^^^^^^^ assignment to borrowed `**x` occurs here error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/coerce-overloaded-autoderef.rs:38:20 + --> $DIR/coerce-overloaded-autoderef.rs:28:20 | LL | borrow_mut2(x, x); | - ^- first borrow ends here @@ -28,7 +28,7 @@ LL | borrow_mut2(x, x); | first mutable borrow occurs here error[E0502]: cannot borrow `*x` as immutable because it is also borrowed as mutable - --> $DIR/coerce-overloaded-autoderef.rs:44:16 + --> $DIR/coerce-overloaded-autoderef.rs:34:16 | LL | borrow2(x, x); | - ^- mutable borrow ends here diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.mir.nll.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.mir.nll.stderr index 60584e481c1..5b9249cffae 100644 --- a/src/test/ui/coercion/coerce-overloaded-autoderef.mir.nll.stderr +++ b/src/test/ui/coercion/coerce-overloaded-autoderef.mir.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/coerce-overloaded-autoderef.rs:22:24 + --> $DIR/coerce-overloaded-autoderef.rs:12:24 | LL | let y = borrow_mut(x); | - first mutable borrow occurs here @@ -10,7 +10,7 @@ LL | drop((y, z)); | - first borrow later used here error[E0506]: cannot assign to `**x` because it is borrowed - --> $DIR/coerce-overloaded-autoderef.rs:31:5 + --> $DIR/coerce-overloaded-autoderef.rs:21:5 | LL | let y = borrow(x); | - borrow of `**x` occurs here @@ -22,7 +22,7 @@ LL | drop((y, z)); | - borrow later used here error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/coerce-overloaded-autoderef.rs:38:20 + --> $DIR/coerce-overloaded-autoderef.rs:28:20 | LL | borrow_mut2(x, x); | ----------- - ^ second mutable borrow occurs here @@ -31,7 +31,7 @@ LL | borrow_mut2(x, x); | first borrow later used by call error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable - --> $DIR/coerce-overloaded-autoderef.rs:44:5 + --> $DIR/coerce-overloaded-autoderef.rs:34:5 | LL | borrow2(x, x); | -------^^^^-^ diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.mir.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.mir.stderr index 0ca752b5ff9..8dc6fe50afb 100644 --- a/src/test/ui/coercion/coerce-overloaded-autoderef.mir.stderr +++ b/src/test/ui/coercion/coerce-overloaded-autoderef.mir.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/coerce-overloaded-autoderef.rs:22:24 + --> $DIR/coerce-overloaded-autoderef.rs:12:24 | LL | let y = borrow_mut(x); | - first mutable borrow occurs here @@ -10,7 +10,7 @@ LL | drop((y, z)); | - first borrow later used here error[E0506]: cannot assign to `**x` because it is borrowed - --> $DIR/coerce-overloaded-autoderef.rs:31:5 + --> $DIR/coerce-overloaded-autoderef.rs:21:5 | LL | let y = borrow(x); | - borrow of `**x` occurs here @@ -22,7 +22,7 @@ LL | drop((y, z)); | - borrow later used here error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/coerce-overloaded-autoderef.rs:38:20 + --> $DIR/coerce-overloaded-autoderef.rs:28:20 | LL | borrow_mut2(x, x); | ----------- - ^ second mutable borrow occurs here @@ -31,7 +31,7 @@ LL | borrow_mut2(x, x); | first borrow later used by call error[E0502]: cannot borrow `*x` as immutable because it is also borrowed as mutable - --> $DIR/coerce-overloaded-autoderef.rs:44:16 + --> $DIR/coerce-overloaded-autoderef.rs:34:16 | LL | borrow2(x, x); | ------- - ^ immutable borrow occurs here diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.rs b/src/test/ui/coercion/coerce-overloaded-autoderef.rs index 5a05f59c6f4..ec72745cd71 100644 --- a/src/test/ui/coercion/coerce-overloaded-autoderef.rs +++ b/src/test/ui/coercion/coerce-overloaded-autoderef.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/coercion/coerce-to-bang-cast.rs b/src/test/ui/coercion/coerce-to-bang-cast.rs index 14a06b306d8..8ef19480846 100644 --- a/src/test/ui/coercion/coerce-to-bang-cast.rs +++ b/src/test/ui/coercion/coerce-to-bang-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(never_type)] fn foo(x: usize, y: !, z: usize) { } diff --git a/src/test/ui/coercion/coerce-to-bang-cast.stderr b/src/test/ui/coercion/coerce-to-bang-cast.stderr index fde94144512..2982801f461 100644 --- a/src/test/ui/coercion/coerce-to-bang-cast.stderr +++ b/src/test/ui/coercion/coerce-to-bang-cast.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `i32` as `!` - --> $DIR/coerce-to-bang-cast.rs:16:13 + --> $DIR/coerce-to-bang-cast.rs:6:13 | LL | let y = {return; 22} as !; | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | let y = {return; 22} as !; = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait error[E0605]: non-primitive cast: `i32` as `!` - --> $DIR/coerce-to-bang-cast.rs:21:13 + --> $DIR/coerce-to-bang-cast.rs:11:13 | LL | let y = 22 as !; //~ ERROR non-primitive cast | ^^^^^^^ diff --git a/src/test/ui/coercion/coerce-to-bang.rs b/src/test/ui/coercion/coerce-to-bang.rs index 8b4e2c3c051..1e06934d09f 100644 --- a/src/test/ui/coercion/coerce-to-bang.rs +++ b/src/test/ui/coercion/coerce-to-bang.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(never_type)] fn foo(x: usize, y: !, z: usize) { } diff --git a/src/test/ui/coercion/coerce-to-bang.stderr b/src/test/ui/coercion/coerce-to-bang.stderr index bf490cd20aa..72e7211de7a 100644 --- a/src/test/ui/coercion/coerce-to-bang.stderr +++ b/src/test/ui/coercion/coerce-to-bang.stderr @@ -1,89 +1,89 @@ error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:16:17 + --> $DIR/coerce-to-bang.rs:6:17 | LL | foo(return, 22, 44); - | ^^ expected !, found integral variable + | ^^ expected !, found integer | = note: expected type `!` found type `{integer}` error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:28:13 + --> $DIR/coerce-to-bang.rs:18:13 | LL | foo(22, 44, return); //~ ERROR mismatched types - | ^^ expected !, found integral variable + | ^^ expected !, found integer | = note: expected type `!` found type `{integer}` error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:36:12 + --> $DIR/coerce-to-bang.rs:26:12 | LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverge. - | ^ expected !, found integral variable + | ^ expected !, found integer | = note: expected type `!` found type `{integer}` error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:46:12 + --> $DIR/coerce-to-bang.rs:36:12 | LL | foo(a, b, c); //~ ERROR mismatched types - | ^ expected !, found integral variable + | ^ expected !, found integer | = note: expected type `!` found type `{integer}` error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:55:12 + --> $DIR/coerce-to-bang.rs:45:12 | LL | foo(a, b, c); //~ ERROR mismatched types - | ^ expected !, found integral variable + | ^ expected !, found integer | = note: expected type `!` found type `{integer}` error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:60:21 + --> $DIR/coerce-to-bang.rs:50:21 | LL | let x: [!; 2] = [return, 22]; //~ ERROR mismatched types - | ^^^^^^^^^^^^ expected !, found integral variable + | ^^^^^^^^^^^^ expected !, found integer | = note: expected type `[!; 2]` found type `[{integer}; 2]` error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:65:22 + --> $DIR/coerce-to-bang.rs:55:22 | LL | let x: [!; 2] = [22, return]; //~ ERROR mismatched types - | ^^ expected !, found integral variable + | ^^ expected !, found integer | = note: expected type `!` found type `{integer}` error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:70:37 + --> $DIR/coerce-to-bang.rs:60:37 | LL | let x: (usize, !, usize) = (22, 44, 66); //~ ERROR mismatched types - | ^^ expected !, found integral variable + | ^^ expected !, found integer | = note: expected type `!` found type `{integer}` error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:75:41 + --> $DIR/coerce-to-bang.rs:65:41 | LL | let x: (usize, !, usize) = (return, 44, 66); - | ^^ expected !, found integral variable + | ^^ expected !, found integer | = note: expected type `!` found type `{integer}` error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:86:37 + --> $DIR/coerce-to-bang.rs:76:37 | LL | let x: (usize, !, usize) = (22, 44, return); //~ ERROR mismatched types - | ^^ expected !, found integral variable + | ^^ expected !, found integer | = note: expected type `!` found type `{integer}` diff --git a/src/test/ui/coercion/coercion-missing-tail-expected-type.rs b/src/test/ui/coercion/coercion-missing-tail-expected-type.rs index b235a0f2136..20a4407e9a1 100644 --- a/src/test/ui/coercion/coercion-missing-tail-expected-type.rs +++ b/src/test/ui/coercion/coercion-missing-tail-expected-type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // #41425 -- error message "mismatched types" has wrong types fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types diff --git a/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr b/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr index 84b6c961a25..c8ec2f0545e 100644 --- a/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr +++ b/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr @@ -1,25 +1,25 @@ error[E0308]: mismatched types - --> $DIR/coercion-missing-tail-expected-type.rs:13:28 + --> $DIR/coercion-missing-tail-expected-type.rs:3:24 | -LL | fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types - | ____________________________^ -LL | | x + 1; - | | - help: consider removing this semicolon -LL | | } - | |_^ expected i32, found () +LL | fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types + | -------- ^^^ expected i32, found () + | | + | this function's body doesn't return +LL | x + 1; + | - help: consider removing this semicolon | = note: expected type `i32` found type `()` error[E0308]: mismatched types - --> $DIR/coercion-missing-tail-expected-type.rs:17:29 + --> $DIR/coercion-missing-tail-expected-type.rs:7:13 | -LL | fn foo() -> Result { //~ ERROR mismatched types - | _____________________________^ -LL | | Ok(1); - | | - help: consider removing this semicolon -LL | | } - | |_^ expected enum `std::result::Result`, found () +LL | fn foo() -> Result { //~ ERROR mismatched types + | --- ^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found () + | | + | this function's body doesn't return +LL | Ok(1); + | - help: consider removing this semicolon | = note: expected type `std::result::Result` found type `()` diff --git a/src/test/ui/coercion/coercion-slice.rs b/src/test/ui/coercion/coercion-slice.rs index 7c5a4e0c3c6..312b634c9fd 100644 --- a/src/test/ui/coercion/coercion-slice.rs +++ b/src/test/ui/coercion/coercion-slice.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that we forbid coercion from `[T; n]` to `&[T]` fn main() { diff --git a/src/test/ui/coercion/coercion-slice.stderr b/src/test/ui/coercion/coercion-slice.stderr index 47a77d42773..6fa71237117 100644 --- a/src/test/ui/coercion/coercion-slice.stderr +++ b/src/test/ui/coercion/coercion-slice.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/coercion-slice.rs:14:21 + --> $DIR/coercion-slice.rs:4:21 | LL | let _: &[i32] = [0]; | ^^^ diff --git a/src/test/ui/coherence/auxiliary/coherence_copy_like_lib.rs b/src/test/ui/coherence/auxiliary/coherence_copy_like_lib.rs index d3d389c6a8b..b5b4802c112 100644 --- a/src/test/ui/coherence/auxiliary/coherence_copy_like_lib.rs +++ b/src/test/ui/coherence/auxiliary/coherence_copy_like_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![feature(fundamental)] diff --git a/src/test/ui/coherence/auxiliary/coherence_fundamental_trait_lib.rs b/src/test/ui/coherence/auxiliary/coherence_fundamental_trait_lib.rs new file mode 100644 index 00000000000..21aaea47963 --- /dev/null +++ b/src/test/ui/coherence/auxiliary/coherence_fundamental_trait_lib.rs @@ -0,0 +1,7 @@ +#![crate_type = "rlib"] +#![feature(fundamental)] + +pub trait Misc {} + +#[fundamental] +pub trait Fundamental {} diff --git a/src/test/ui/coherence/auxiliary/coherence_inherent_cc_lib.rs b/src/test/ui/coherence/auxiliary/coherence_inherent_cc_lib.rs index 0458636a401..08d22fbedf5 100644 --- a/src/test/ui/coherence/auxiliary/coherence_inherent_cc_lib.rs +++ b/src/test/ui/coherence/auxiliary/coherence_inherent_cc_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // See coherence_inherent_cc.rs pub trait TheTrait { diff --git a/src/test/ui/coherence/auxiliary/coherence_lib.rs b/src/test/ui/coherence/auxiliary/coherence_lib.rs index daa123849e4..9a5ec824306 100644 --- a/src/test/ui/coherence/auxiliary/coherence_lib.rs +++ b/src/test/ui/coherence/auxiliary/coherence_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub trait Remote { diff --git a/src/test/ui/coherence/auxiliary/coherence_orphan_lib.rs b/src/test/ui/coherence/auxiliary/coherence_orphan_lib.rs index b22d12300c7..2664ef55069 100644 --- a/src/test/ui/coherence/auxiliary/coherence_orphan_lib.rs +++ b/src/test/ui/coherence/auxiliary/coherence_orphan_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait TheTrait { fn the_fn(&self); } diff --git a/src/test/ui/coherence/auxiliary/go_trait.rs b/src/test/ui/coherence/auxiliary/go_trait.rs index 044bb606b40..aa0ec22896d 100644 --- a/src/test/ui/coherence/auxiliary/go_trait.rs +++ b/src/test/ui/coherence/auxiliary/go_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] // Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. diff --git a/src/test/ui/coherence/auxiliary/re_rebalance_coherence_lib.rs b/src/test/ui/coherence/auxiliary/re_rebalance_coherence_lib.rs new file mode 100644 index 00000000000..c8d027b25c7 --- /dev/null +++ b/src/test/ui/coherence/auxiliary/re_rebalance_coherence_lib.rs @@ -0,0 +1,23 @@ + +pub trait Backend{} +pub trait SupportsDefaultKeyword {} + +impl SupportsDefaultKeyword for Postgres {} + +pub struct Postgres; + +impl Backend for Postgres {} + +pub struct AstPass(::std::marker::PhantomData); + +pub trait QueryFragment {} + + +#[derive(Debug, Clone, Copy)] +pub struct BatchInsert<'a, T: 'a, Tab> { + _marker: ::std::marker::PhantomData<(&'a T, Tab)>, +} + +impl<'a, T:'a, Tab, DB> QueryFragment for BatchInsert<'a, T, Tab> +where DB: SupportsDefaultKeyword + Backend, +{} diff --git a/src/test/ui/coherence/auxiliary/trait_impl_conflict.rs b/src/test/ui/coherence/auxiliary/trait_impl_conflict.rs index 3190ce430ad..5e5f017ed45 100644 --- a/src/test/ui/coherence/auxiliary/trait_impl_conflict.rs +++ b/src/test/ui/coherence/auxiliary/trait_impl_conflict.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo { fn foo() {} } diff --git a/src/test/ui/coherence/coherence-all-remote.old.stderr b/src/test/ui/coherence/coherence-all-remote.old.stderr new file mode 100644 index 00000000000..0389a6228ef --- /dev/null +++ b/src/test/ui/coherence/coherence-all-remote.old.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-all-remote.rs:9:1 + | +LL | impl Remote1 for isize { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-all-remote.re.stderr b/src/test/ui/coherence/coherence-all-remote.re.stderr new file mode 100644 index 00000000000..0389a6228ef --- /dev/null +++ b/src/test/ui/coherence/coherence-all-remote.re.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-all-remote.rs:9:1 + | +LL | impl Remote1 for isize { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-all-remote.rs b/src/test/ui/coherence/coherence-all-remote.rs index 7a5340041c2..68c924ee274 100644 --- a/src/test/ui/coherence/coherence-all-remote.rs +++ b/src/test/ui/coherence/coherence-all-remote.rs @@ -1,19 +1,13 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::Remote1; impl Remote1 for isize { } -//~^ ERROR E0210 +//[old]~^ ERROR E0210 +//[re]~^^ ERROR E0210 fn main() { } diff --git a/src/test/ui/coherence/coherence-all-remote.stderr b/src/test/ui/coherence/coherence-all-remote.stderr deleted file mode 100644 index 1f71969989b..00000000000 --- a/src/test/ui/coherence/coherence-all-remote.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/coherence-all-remote.rs:16:1 - | -LL | impl Remote1 for isize { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type - | - = note: only traits defined in the current crate can be implemented for a type parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-bigint-param.old.stderr b/src/test/ui/coherence/coherence-bigint-param.old.stderr new file mode 100644 index 00000000000..54fec07e65a --- /dev/null +++ b/src/test/ui/coherence/coherence-bigint-param.old.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-bigint-param.rs:11:1 + | +LL | impl Remote1 for T { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-bigint-param.re.stderr b/src/test/ui/coherence/coherence-bigint-param.re.stderr new file mode 100644 index 00000000000..54fec07e65a --- /dev/null +++ b/src/test/ui/coherence/coherence-bigint-param.re.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-bigint-param.rs:11:1 + | +LL | impl Remote1 for T { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-bigint-param.rs b/src/test/ui/coherence/coherence-bigint-param.rs index 32c5b669381..24106b4b348 100644 --- a/src/test/ui/coherence/coherence-bigint-param.rs +++ b/src/test/ui/coherence/coherence-bigint-param.rs @@ -1,14 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::Remote1; @@ -16,6 +9,7 @@ use lib::Remote1; pub struct BigInt; impl Remote1 for T { } -//~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[re]~^^ ERROR E0210 fn main() { } diff --git a/src/test/ui/coherence/coherence-bigint-param.stderr b/src/test/ui/coherence/coherence-bigint-param.stderr deleted file mode 100644 index 7d2796ee690..00000000000 --- a/src/test/ui/coherence/coherence-bigint-param.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/coherence-bigint-param.rs:18:1 - | -LL | impl Remote1 for T { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type - | - = note: only traits defined in the current crate can be implemented for a type parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.old.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.old.stderr new file mode 100644 index 00000000000..a6d29048b4d --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.old.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait`: + --> $DIR/coherence-blanket-conflicts-with-blanket-implemented.rs:28:1 + | +LL | impl MyTrait for T { + | -------------------------- first implementation here +... +LL | impl MyTrait for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.re.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.re.stderr new file mode 100644 index 00000000000..a6d29048b4d --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait`: + --> $DIR/coherence-blanket-conflicts-with-blanket-implemented.rs:28:1 + | +LL | impl MyTrait for T { + | -------------------------- first implementation here +... +LL | impl MyTrait for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs index 434d77828b4..098a13e54bf 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs @@ -1,12 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] use std::fmt::Debug; use std::default::Default; @@ -31,7 +25,10 @@ impl MyTrait for T { fn get(&self) -> usize { 0 } } -impl MyTrait for T { //~ ERROR E0119 +impl MyTrait for T { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 + fn get(&self) -> usize { 0 } } diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr deleted file mode 100644 index 7dbcda06511..00000000000 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait`: - --> $DIR/coherence-blanket-conflicts-with-blanket-implemented.rs:34:1 - | -LL | impl MyTrait for T { - | -------------------------- first implementation here -... -LL | impl MyTrait for T { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.old.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.old.stderr new file mode 100644 index 00000000000..1f3ddd1dc42 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.old.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait`: + --> $DIR/coherence-blanket-conflicts-with-blanket-unimplemented.rs:24:1 + | +LL | impl MyTrait for T { + | -------------------------- first implementation here +... +LL | impl MyTrait for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.re.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.re.stderr new file mode 100644 index 00000000000..1f3ddd1dc42 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait`: + --> $DIR/coherence-blanket-conflicts-with-blanket-unimplemented.rs:24:1 + | +LL | impl MyTrait for T { + | -------------------------- first implementation here +... +LL | impl MyTrait for T { + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs index 7ad5cd71ca8..5b76fc0174b 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs @@ -1,12 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] use std::fmt::Debug; use std::default::Default; @@ -27,7 +21,9 @@ impl MyTrait for T { fn get(&self) -> usize { 0 } } -impl MyTrait for T { //~ ERROR E0119 +impl MyTrait for T { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn get(&self) -> usize { 0 } } diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr deleted file mode 100644 index faabfb6c7c0..00000000000 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait`: - --> $DIR/coherence-blanket-conflicts-with-blanket-unimplemented.rs:30:1 - | -LL | impl MyTrait for T { - | -------------------------- first implementation here -... -LL | impl MyTrait for T { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.old.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.old.stderr new file mode 100644 index 00000000000..298ac6d1f21 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.old.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `go_trait::GoMut` for type `MyThingy`: + --> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:18:1 + | +LL | impl GoMut for MyThingy { + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `go_trait`: + - impl go_trait::GoMut for G + where G: go_trait::Go; + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.re.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.re.stderr new file mode 100644 index 00000000000..298ac6d1f21 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.re.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `go_trait::GoMut` for type `MyThingy`: + --> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:18:1 + | +LL | impl GoMut for MyThingy { + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `go_trait`: + - impl go_trait::GoMut for G + where G: go_trait::Go; + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs index b3ef79c6cc0..b0aaf57e2a9 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs @@ -1,14 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:go_trait.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate go_trait; @@ -22,7 +15,9 @@ impl Go for MyThingy { fn go(&self, arg: isize) { } } -impl GoMut for MyThingy { //~ ERROR conflicting implementations +impl GoMut for MyThingy { +//[old]~^ ERROR conflicting implementations +//[re]~^^ ERROR E0119 fn go_mut(&mut self, arg: isize) { } } diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr deleted file mode 100644 index 38aff37bfcc..00000000000 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0119]: conflicting implementations of trait `go_trait::GoMut` for type `MyThingy`: - --> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:25:1 - | -LL | impl GoMut for MyThingy { //~ ERROR conflicting implementations - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: conflicting implementation in crate `go_trait`: - - impl go_trait::GoMut for G - where G: go_trait::Go; - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.old.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.old.stderr new file mode 100644 index 00000000000..94bbbdbe0a4 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.old.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: + --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:26:1 + | +LL | impl MyTrait for T { + | ------------------------ first implementation here +... +LL | impl MyTrait for MyType { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.re.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.re.stderr new file mode 100644 index 00000000000..94bbbdbe0a4 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: + --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:26:1 + | +LL | impl MyTrait for T { + | ------------------------ first implementation here +... +LL | impl MyTrait for MyType { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs index 1defe6c8b20..9192d123514 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs @@ -1,12 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] use std::fmt::Debug; use std::default::Default; @@ -29,7 +23,9 @@ struct MyType { dummy: usize } -impl MyTrait for MyType { //~ ERROR E0119 +impl MyTrait for MyType { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn get(&self) -> usize { (*self).clone() } } diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr deleted file mode 100644 index a5992406262..00000000000 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: - --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:32:1 - | -LL | impl MyTrait for T { - | ------------------------ first implementation here -... -LL | impl MyTrait for MyType { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.old.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.old.stderr new file mode 100644 index 00000000000..cf799c20cb4 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.old.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: + --> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:24:1 + | +LL | impl MyTrait for T { + | -------------------------------- first implementation here +... +LL | impl MyTrait for MyType { + | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.re.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.re.stderr new file mode 100644 index 00000000000..cf799c20cb4 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: + --> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:24:1 + | +LL | impl MyTrait for T { + | -------------------------------- first implementation here +... +LL | impl MyTrait for MyType { + | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs index 5c5c4d32d67..51cb10e6185 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs @@ -1,16 +1,10 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a blank impl for all T:PartialEq conflicts with an impl for some // specific T when T:PartialEq. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + trait OtherTrait { fn noop(&self); } @@ -27,7 +21,9 @@ struct MyType { dummy: usize } -impl MyTrait for MyType { //~ ERROR E0119 +impl MyTrait for MyType { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn get(&self) -> usize { self.dummy } } diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr deleted file mode 100644 index 9a6e0071eb7..00000000000 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: - --> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:30:1 - | -LL | impl MyTrait for T { - | -------------------------------- first implementation here -... -LL | impl MyTrait for MyType { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.old.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.old.stderr new file mode 100644 index 00000000000..0807b11a434 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.old.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: + --> $DIR/coherence-blanket-conflicts-with-specific.rs:23:1 + | +LL | impl MyTrait for T { + | --------------------- first implementation here +... +LL | impl MyTrait for MyType { + | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.re.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.re.stderr new file mode 100644 index 00000000000..0807b11a434 --- /dev/null +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: + --> $DIR/coherence-blanket-conflicts-with-specific.rs:23:1 + | +LL | impl MyTrait for T { + | --------------------- first implementation here +... +LL | impl MyTrait for MyType { + | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.rs index 57d71b44b0f..3ecb613188a 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.rs @@ -1,12 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] use std::fmt::Debug; use std::default::Default; @@ -26,7 +20,9 @@ struct MyType { dummy: usize } -impl MyTrait for MyType { //~ ERROR E0119 +impl MyTrait for MyType { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn get(&self) -> usize { self.dummy } } diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.stderr deleted file mode 100644 index 955cd3b125f..00000000000 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`: - --> $DIR/coherence-blanket-conflicts-with-specific.rs:29:1 - | -LL | impl MyTrait for T { - | --------------------- first implementation here -... -LL | impl MyTrait for MyType { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.old.stderr b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.old.stderr new file mode 100644 index 00000000000..bb3641f2247 --- /dev/null +++ b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.old.stderr @@ -0,0 +1,21 @@ +error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<_>`: + --> $DIR/coherence-conflicting-negative-trait-impl.rs:13:1 + | +LL | unsafe impl Send for TestType {} + | ---------------------------------------------------- first implementation here +LL | +LL | impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` + +error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType`: + --> $DIR/coherence-conflicting-negative-trait-impl.rs:19:1 + | +LL | unsafe impl Send for TestType {} + | ------------------------------------------- first implementation here +LL | +LL | impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.re.stderr b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.re.stderr new file mode 100644 index 00000000000..bb3641f2247 --- /dev/null +++ b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.re.stderr @@ -0,0 +1,21 @@ +error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<_>`: + --> $DIR/coherence-conflicting-negative-trait-impl.rs:13:1 + | +LL | unsafe impl Send for TestType {} + | ---------------------------------------------------- first implementation here +LL | +LL | impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` + +error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType`: + --> $DIR/coherence-conflicting-negative-trait-impl.rs:19:1 + | +LL | unsafe impl Send for TestType {} + | ------------------------------------------- first implementation here +LL | +LL | impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.rs b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.rs index 8e9d1eff345..e05fecb11ed 100644 --- a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.rs +++ b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.rs @@ -1,13 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] #![feature(overlapping_marker_traits)] @@ -18,11 +11,13 @@ struct TestType(::std::marker::PhantomData); unsafe impl Send for TestType {} impl !Send for TestType {} -//~^ ERROR conflicting implementations of trait `std::marker::Send` +//[old]~^ ERROR conflicting implementations of trait `std::marker::Send` +//[re]~^^ ERROR E0119 unsafe impl Send for TestType {} impl !Send for TestType {} -//~^ ERROR conflicting implementations of trait `std::marker::Send` +//[old]~^ ERROR conflicting implementations of trait `std::marker::Send` +//[re]~^^ ERROR E0119 fn main() {} diff --git a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr deleted file mode 100644 index a2a869daff0..00000000000 --- a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<_>`: - --> $DIR/coherence-conflicting-negative-trait-impl.rs:20:1 - | -LL | unsafe impl Send for TestType {} - | ---------------------------------------------------- first implementation here -LL | -LL | impl !Send for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` - -error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType`: - --> $DIR/coherence-conflicting-negative-trait-impl.rs:25:1 - | -LL | unsafe impl Send for TestType {} - | ------------------------------------------- first implementation here -LL | -LL | impl !Send for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-cow.a.stderr b/src/test/ui/coherence/coherence-cow.a.stderr index f05333348ec..dd9cfab503f 100644 --- a/src/test/ui/coherence/coherence-cow.a.stderr +++ b/src/test/ui/coherence/coherence-cow.a.stderr @@ -1,7 +1,7 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/coherence-cow.rs:26:1 +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-cow.rs:18:1 | -LL | impl Remote for Pair> { } //[a]~ ERROR E0210 +LL | impl Remote for Pair> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/coherence-cow.b.stderr b/src/test/ui/coherence/coherence-cow.b.stderr index 269bcd576af..fb3ca3fc6b7 100644 --- a/src/test/ui/coherence/coherence-cow.b.stderr +++ b/src/test/ui/coherence/coherence-cow.b.stderr @@ -1,7 +1,7 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/coherence-cow.rs:29:1 +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-cow.rs:23:1 | -LL | impl Remote for Pair,T> { } //[b]~ ERROR E0210 +LL | impl Remote for Pair,T> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/coherence/coherence-cow.c.stderr b/src/test/ui/coherence/coherence-cow.c.stderr index e89308db054..f17823b7f89 100644 --- a/src/test/ui/coherence/coherence-cow.c.stderr +++ b/src/test/ui/coherence/coherence-cow.c.stderr @@ -1,5 +1,5 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/coherence-cow.rs:32:1 +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-cow.rs:28:1 | LL | impl Remote for Pair,U> { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/coherence/coherence-cow.re_a.stderr b/src/test/ui/coherence/coherence-cow.re_a.stderr new file mode 100644 index 00000000000..b0ec55a9bc5 --- /dev/null +++ b/src/test/ui/coherence/coherence-cow.re_a.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-cow.rs:18:1 + | +LL | impl Remote for Pair> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-cow.re_b.stderr b/src/test/ui/coherence/coherence-cow.re_b.stderr new file mode 100644 index 00000000000..ce261127093 --- /dev/null +++ b/src/test/ui/coherence/coherence-cow.re_b.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-cow.rs:23:1 + | +LL | impl Remote for Pair,T> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-cow.re_c.stderr b/src/test/ui/coherence/coherence-cow.re_c.stderr new file mode 100644 index 00000000000..1c2030d8dfe --- /dev/null +++ b/src/test/ui/coherence/coherence-cow.re_c.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-cow.rs:28:1 + | +LL | impl Remote for Pair,U> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-cow.rs b/src/test/ui/coherence/coherence-cow.rs index 86ae5b44d9d..956b0734148 100644 --- a/src/test/ui/coherence/coherence-cow.rs +++ b/src/test/ui/coherence/coherence-cow.rs @@ -1,14 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// revisions: a b c +// revisions: a b c re_a re_b re_c + +#![cfg_attr(any(re_a, re_b, re_c), feature(re_rebalance_coherence))] // aux-build:coherence_lib.rs @@ -22,14 +14,19 @@ use lib::{Remote,Pair}; pub struct Cover(T); -#[cfg(a)] -impl Remote for Pair> { } //[a]~ ERROR E0210 +#[cfg(any(a, re_a))] +impl Remote for Pair> { } +//[a]~^ ERROR E0210 +//[re_a]~^^ ERROR E0117 -#[cfg(b)] -impl Remote for Pair,T> { } //[b]~ ERROR E0210 +#[cfg(any(b, re_b))] +impl Remote for Pair,T> { } +//[b]~^ ERROR E0210 +//[re_b]~^^ ERROR E0117 -#[cfg(c)] +#[cfg(any(c, re_c))] impl Remote for Pair,U> { } //[c]~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[re_c]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-cross-crate-conflict.old.stderr b/src/test/ui/coherence/coherence-cross-crate-conflict.old.stderr new file mode 100644 index 00000000000..3ba32a52835 --- /dev/null +++ b/src/test/ui/coherence/coherence-cross-crate-conflict.old.stderr @@ -0,0 +1,21 @@ +error[E0119]: conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`: + --> $DIR/coherence-cross-crate-conflict.rs:12:1 + | +LL | impl Foo for A { + | ^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `trait_impl_conflict`: + - impl trait_impl_conflict::Foo for isize; + +error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-cross-crate-conflict.rs:12:1 + | +LL | impl Foo for A { + | ^^^^^^^^^^^^^^^^^ type parameter `A` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to 2 previous errors + +Some errors occurred: E0119, E0210. +For more information about an error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-cross-crate-conflict.re.stderr b/src/test/ui/coherence/coherence-cross-crate-conflict.re.stderr new file mode 100644 index 00000000000..3ba32a52835 --- /dev/null +++ b/src/test/ui/coherence/coherence-cross-crate-conflict.re.stderr @@ -0,0 +1,21 @@ +error[E0119]: conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`: + --> $DIR/coherence-cross-crate-conflict.rs:12:1 + | +LL | impl Foo for A { + | ^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `trait_impl_conflict`: + - impl trait_impl_conflict::Foo for isize; + +error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-cross-crate-conflict.rs:12:1 + | +LL | impl Foo for A { + | ^^^^^^^^^^^^^^^^^ type parameter `A` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to 2 previous errors + +Some errors occurred: E0119, E0210. +For more information about an error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-cross-crate-conflict.rs b/src/test/ui/coherence/coherence-cross-crate-conflict.rs index aac870293fd..9643ab643df 100644 --- a/src/test/ui/coherence/coherence-cross-crate-conflict.rs +++ b/src/test/ui/coherence/coherence-cross-crate-conflict.rs @@ -1,23 +1,19 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The error here is strictly due to orphan rules; the impl here // generalizes the one upstream // aux-build:trait_impl_conflict.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + extern crate trait_impl_conflict; use trait_impl_conflict::Foo; impl Foo for A { - //~^ ERROR type parameter `A` must be used as the type parameter for some local type - //~| ERROR conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize` + //[old]~^ ERROR type parameter `A` must be used as the type parameter for some local type + //[old]~| ERROR conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize` + //[re]~^^^ ERROR E0119 + //[re]~| ERROR E0210 } fn main() { diff --git a/src/test/ui/coherence/coherence-cross-crate-conflict.stderr b/src/test/ui/coherence/coherence-cross-crate-conflict.stderr deleted file mode 100644 index ee11967cc0d..00000000000 --- a/src/test/ui/coherence/coherence-cross-crate-conflict.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0119]: conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`: - --> $DIR/coherence-cross-crate-conflict.rs:18:1 - | -LL | impl Foo for A { - | ^^^^^^^^^^^^^^^^^ - | - = note: conflicting implementation in crate `trait_impl_conflict`: - - impl trait_impl_conflict::Foo for isize; - -error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/coherence-cross-crate-conflict.rs:18:1 - | -LL | impl Foo for A { - | ^^^^^^^^^^^^^^^^^ type parameter `A` must be used as the type parameter for some local type - | - = note: only traits defined in the current crate can be implemented for a type parameter - -error: aborting due to 2 previous errors - -Some errors occurred: E0119, E0210. -For more information about an error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-default-trait-impl.old.stderr b/src/test/ui/coherence/coherence-default-trait-impl.old.stderr new file mode 100644 index 00000000000..534f4b0dcdb --- /dev/null +++ b/src/test/ui/coherence/coherence-default-trait-impl.old.stderr @@ -0,0 +1,16 @@ +error[E0199]: implementing the trait `MySafeTrait` is not unsafe + --> $DIR/coherence-default-trait-impl.rs:10:1 + | +LL | unsafe impl MySafeTrait for Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0200]: the trait `MyUnsafeTrait` requires an `unsafe impl` declaration + --> $DIR/coherence-default-trait-impl.rs:16:1 + | +LL | impl MyUnsafeTrait for Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +Some errors occurred: E0199, E0200. +For more information about an error, try `rustc --explain E0199`. diff --git a/src/test/ui/coherence/coherence-default-trait-impl.re.stderr b/src/test/ui/coherence/coherence-default-trait-impl.re.stderr new file mode 100644 index 00000000000..534f4b0dcdb --- /dev/null +++ b/src/test/ui/coherence/coherence-default-trait-impl.re.stderr @@ -0,0 +1,16 @@ +error[E0199]: implementing the trait `MySafeTrait` is not unsafe + --> $DIR/coherence-default-trait-impl.rs:10:1 + | +LL | unsafe impl MySafeTrait for Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0200]: the trait `MyUnsafeTrait` requires an `unsafe impl` declaration + --> $DIR/coherence-default-trait-impl.rs:16:1 + | +LL | impl MyUnsafeTrait for Foo {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +Some errors occurred: E0199, E0200. +For more information about an error, try `rustc --explain E0199`. diff --git a/src/test/ui/coherence/coherence-default-trait-impl.rs b/src/test/ui/coherence/coherence-default-trait-impl.rs index 751d0a14c57..606b4947b5f 100644 --- a/src/test/ui/coherence/coherence-default-trait-impl.rs +++ b/src/test/ui/coherence/coherence-default-trait-impl.rs @@ -1,13 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] auto trait MySafeTrait {} @@ -15,11 +8,13 @@ auto trait MySafeTrait {} struct Foo; unsafe impl MySafeTrait for Foo {} -//~^ ERROR implementing the trait `MySafeTrait` is not unsafe +//[old]~^ ERROR implementing the trait `MySafeTrait` is not unsafe +//[re]~^^ ERROR E0199 unsafe auto trait MyUnsafeTrait {} impl MyUnsafeTrait for Foo {} -//~^ ERROR the trait `MyUnsafeTrait` requires an `unsafe impl` declaration +//[old]~^ ERROR the trait `MyUnsafeTrait` requires an `unsafe impl` declaration +//[re]~^^ ERROR E0200 fn main() {} diff --git a/src/test/ui/coherence/coherence-default-trait-impl.stderr b/src/test/ui/coherence/coherence-default-trait-impl.stderr deleted file mode 100644 index b7d9364f237..00000000000 --- a/src/test/ui/coherence/coherence-default-trait-impl.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0199]: implementing the trait `MySafeTrait` is not unsafe - --> $DIR/coherence-default-trait-impl.rs:17:1 - | -LL | unsafe impl MySafeTrait for Foo {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0200]: the trait `MyUnsafeTrait` requires an `unsafe impl` declaration - --> $DIR/coherence-default-trait-impl.rs:22:1 - | -LL | impl MyUnsafeTrait for Foo {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -Some errors occurred: E0199, E0200. -For more information about an error, try `rustc --explain E0199`. diff --git a/src/test/ui/coherence/coherence-error-suppression.old.stderr b/src/test/ui/coherence/coherence-error-suppression.old.stderr new file mode 100644 index 00000000000..b81f7553317 --- /dev/null +++ b/src/test/ui/coherence/coherence-error-suppression.old.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `DoesNotExist` in this scope + --> $DIR/coherence-error-suppression.rs:13:14 + | +LL | impl Foo for DoesNotExist {} + | ^^^^^^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/coherence/coherence-error-suppression.re.stderr b/src/test/ui/coherence/coherence-error-suppression.re.stderr new file mode 100644 index 00000000000..b81f7553317 --- /dev/null +++ b/src/test/ui/coherence/coherence-error-suppression.re.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `DoesNotExist` in this scope + --> $DIR/coherence-error-suppression.rs:13:14 + | +LL | impl Foo for DoesNotExist {} + | ^^^^^^^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/coherence/coherence-error-suppression.rs b/src/test/ui/coherence/coherence-error-suppression.rs index 56d2455ca21..60b88fb80e4 100644 --- a/src/test/ui/coherence/coherence-error-suppression.rs +++ b/src/test/ui/coherence/coherence-error-suppression.rs @@ -1,22 +1,18 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that error types in coherence do not cause error cascades. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + trait Foo {} impl Foo for i8 {} impl Foo for i16 {} impl Foo for i32 {} impl Foo for i64 {} -impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope +impl Foo for DoesNotExist {} +//[old]~^ ERROR cannot find type `DoesNotExist` in this scope +//[re]~^^ ERROR E0412 impl Foo for u8 {} impl Foo for u16 {} impl Foo for u32 {} diff --git a/src/test/ui/coherence/coherence-error-suppression.stderr b/src/test/ui/coherence/coherence-error-suppression.stderr deleted file mode 100644 index 8cf3fe760f1..00000000000 --- a/src/test/ui/coherence/coherence-error-suppression.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0412]: cannot find type `DoesNotExist` in this scope - --> $DIR/coherence-error-suppression.rs:19:14 - | -LL | impl Foo for DoesNotExist {} //~ ERROR cannot find type `DoesNotExist` in this scope - | ^^^^^^^^^^^^ not found in this scope - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr b/src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr new file mode 100644 index 00000000000..2d1247e831e --- /dev/null +++ b/src/test/ui/coherence/coherence-fundamental-trait-objects.old.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-fundamental-trait-objects.rs:15:1 + | +LL | impl Misc for dyn Fundamental {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr b/src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr new file mode 100644 index 00000000000..2d1247e831e --- /dev/null +++ b/src/test/ui/coherence/coherence-fundamental-trait-objects.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-fundamental-trait-objects.rs:15:1 + | +LL | impl Misc for dyn Fundamental {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-fundamental-trait-objects.rs b/src/test/ui/coherence/coherence-fundamental-trait-objects.rs new file mode 100644 index 00000000000..0c7d54425dd --- /dev/null +++ b/src/test/ui/coherence/coherence-fundamental-trait-objects.rs @@ -0,0 +1,19 @@ +// Check that trait objects from #[fundamental] traits are not +// treated as #[fundamental] types - the 2 meanings of #[fundamental] +// are distinct. + +// aux-build:coherence_fundamental_trait_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + +extern crate coherence_fundamental_trait_lib; + +use coherence_fundamental_trait_lib::{Fundamental, Misc}; + +pub struct Local; +impl Misc for dyn Fundamental {} +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 + +fn main() {} diff --git a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs new file mode 100644 index 00000000000..5ea69190951 --- /dev/null +++ b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.rs @@ -0,0 +1,29 @@ +#![feature(optin_builtin_traits)] + +// Test for issue #56934 - that it is impossible to redundantly +// implement an auto-trait for a trait object type that contains it. + +// Negative impl variant. + +auto trait Marker1 {} +auto trait Marker2 {} + +trait Object: Marker1 {} + +// A supertrait marker is illegal... +impl !Marker1 for dyn Object + Marker2 { } //~ ERROR E0371 +// ...and also a direct component. +impl !Marker2 for dyn Object + Marker2 { } //~ ERROR E0371 + +// But implementing a marker if it is not present is OK. +impl !Marker2 for dyn Object {} // OK + +// A non-principal trait-object type is orphan even in its crate. +impl !Send for dyn Marker2 {} //~ ERROR E0117 + +// And impl'ing a remote marker for a local trait object is forbidden +// by one of these special orphan-like rules. +impl !Send for dyn Object {} //~ ERROR E0321 +impl !Send for dyn Object + Marker2 {} //~ ERROR E0321 + +fn main() { } diff --git a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr new file mode 100644 index 00000000000..c8a146cdd44 --- /dev/null +++ b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr @@ -0,0 +1,37 @@ +error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:14:1 + | +LL | impl !Marker1 for dyn Object + Marker2 { } //~ ERROR E0371 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` + +error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:16:1 + | +LL | impl !Marker2 for dyn Object + Marker2 { } //~ ERROR E0371 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:22:1 + | +LL | impl !Send for dyn Marker2 {} //~ ERROR E0117 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)` + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:26:1 + | +LL | impl !Send for dyn Object {} //~ ERROR E0321 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type + +error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + Marker2 + 'static)` + --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:27:1 + | +LL | impl !Send for dyn Object + Marker2 {} //~ ERROR E0321 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type + +error: aborting due to 5 previous errors + +Some errors occurred: E0117, E0321, E0371. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs new file mode 100644 index 00000000000..6b5689e8260 --- /dev/null +++ b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.rs @@ -0,0 +1,29 @@ +#![feature(optin_builtin_traits)] + +// Test for issue #56934 - that it is impossible to redundantly +// implement an auto-trait for a trait object type that contains it. + +// Positive impl variant. + +auto trait Marker1 {} +auto trait Marker2 {} + +trait Object: Marker1 {} + +// A supertrait marker is illegal... +impl Marker1 for dyn Object + Marker2 { } //~ ERROR E0371 +// ...and also a direct component. +impl Marker2 for dyn Object + Marker2 { } //~ ERROR E0371 + +// But implementing a marker if it is not present is OK. +impl Marker2 for dyn Object {} // OK + +// A non-principal trait-object type is orphan even in its crate. +unsafe impl Send for dyn Marker2 {} //~ ERROR E0117 + +// And impl'ing a remote marker for a local trait object is forbidden +// by one of these special orphan-like rules. +unsafe impl Send for dyn Object {} //~ ERROR E0321 +unsafe impl Send for dyn Object + Marker2 {} //~ ERROR E0321 + +fn main() { } diff --git a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr new file mode 100644 index 00000000000..78ca2f5279d --- /dev/null +++ b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr @@ -0,0 +1,37 @@ +error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:14:1 + | +LL | impl Marker1 for dyn Object + Marker2 { } //~ ERROR E0371 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` + +error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:16:1 + | +LL | impl Marker2 for dyn Object + Marker2 { } //~ ERROR E0371 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:22:1 + | +LL | unsafe impl Send for dyn Marker2 {} //~ ERROR E0117 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)` + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:26:1 + | +LL | unsafe impl Send for dyn Object {} //~ ERROR E0321 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type + +error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + Marker2 + 'static)` + --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:27:1 + | +LL | unsafe impl Send for dyn Object + Marker2 {} //~ ERROR E0321 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type + +error: aborting due to 5 previous errors + +Some errors occurred: E0117, E0321, E0371. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr new file mode 100644 index 00000000000..b48f6bbfb94 --- /dev/null +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.old.stderr @@ -0,0 +1,11 @@ +error[E0038]: the trait `NotObjectSafe` cannot be made into an object + --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:11:6 + | +LL | impl NotObjectSafe for NotObjectSafe { } + | ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object + | + = note: method `eq` references the `Self` type in its arguments or return type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr new file mode 100644 index 00000000000..b48f6bbfb94 --- /dev/null +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.re.stderr @@ -0,0 +1,11 @@ +error[E0038]: the trait `NotObjectSafe` cannot be made into an object + --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:11:6 + | +LL | impl NotObjectSafe for NotObjectSafe { } + | ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object + | + = note: method `eq` references the `Self` type in its arguments or return type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs index 8bb9556fcc0..803e8fc6bca 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs @@ -1,19 +1,15 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we give suitable error messages when the user attempts to // impl a trait `Trait` for its own object type. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + // If the trait is not object-safe, we give a more tailored message // because we're such schnuckels: trait NotObjectSafe { fn eq(&self, other: Self); } -impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038 +impl NotObjectSafe for NotObjectSafe { } +//[old]~^ ERROR E0038 +//[re]~^^ ERROR E0038 fn main() { } diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr deleted file mode 100644 index 5d62a86b96f..00000000000 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0038]: the trait `NotObjectSafe` cannot be made into an object - --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:17:6 - | -LL | impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038 - | ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object - | - = note: method `eq` references the `Self` type in its arguments or return type - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr new file mode 100644 index 00000000000..324747603f9 --- /dev/null +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.old.stderr @@ -0,0 +1,21 @@ +error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo` + --> $DIR/coherence-impl-trait-for-trait.rs:13:1 + | +LL | impl Foo for Baz { } + | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` + +error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar` + --> $DIR/coherence-impl-trait-for-trait.rs:16:1 + | +LL | impl Bar for Baz { } + | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` + +error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz` + --> $DIR/coherence-impl-trait-for-trait.rs:19:1 + | +LL | impl Baz for Baz { } + | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0371`. diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr new file mode 100644 index 00000000000..324747603f9 --- /dev/null +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.re.stderr @@ -0,0 +1,21 @@ +error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo` + --> $DIR/coherence-impl-trait-for-trait.rs:13:1 + | +LL | impl Foo for Baz { } + | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` + +error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar` + --> $DIR/coherence-impl-trait-for-trait.rs:16:1 + | +LL | impl Bar for Baz { } + | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` + +error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz` + --> $DIR/coherence-impl-trait-for-trait.rs:19:1 + | +LL | impl Baz for Baz { } + | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0371`. diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.rs b/src/test/ui/coherence/coherence-impl-trait-for-trait.rs index cd75b0e34f2..dcaf564fdec 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait.rs +++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.rs @@ -1,24 +1,24 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we give suitable error messages when the user attempts to // impl a trait `Trait` for its own object type. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + trait Foo { fn dummy(&self) { } } trait Bar: Foo { } trait Baz: Bar { } // Supertraits of Baz are not legal: -impl Foo for Baz { } //~ ERROR E0371 -impl Bar for Baz { } //~ ERROR E0371 -impl Baz for Baz { } //~ ERROR E0371 +impl Foo for Baz { } +//[old]~^ ERROR E0371 +//[re]~^^ ERROR E0371 +impl Bar for Baz { } +//[old]~^ ERROR E0371 +//[re]~^^ ERROR E0371 +impl Baz for Baz { } +//[old]~^ ERROR E0371 +//[re]~^^ ERROR E0371 // But other random traits are: trait Other { } diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait.stderr deleted file mode 100644 index 26e702d1fde..00000000000 --- a/src/test/ui/coherence/coherence-impl-trait-for-trait.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo` - --> $DIR/coherence-impl-trait-for-trait.rs:19:1 - | -LL | impl Foo for Baz { } //~ ERROR E0371 - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo` - -error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar` - --> $DIR/coherence-impl-trait-for-trait.rs:20:1 - | -LL | impl Bar for Baz { } //~ ERROR E0371 - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar` - -error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz` - --> $DIR/coherence-impl-trait-for-trait.rs:21:1 - | -LL | impl Baz for Baz { } //~ ERROR E0371 - | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0371`. diff --git a/src/test/ui/coherence/coherence-impls-copy.old.stderr b/src/test/ui/coherence/coherence-impls-copy.old.stderr new file mode 100644 index 00000000000..e870c267ce1 --- /dev/null +++ b/src/test/ui/coherence/coherence-impls-copy.old.stderr @@ -0,0 +1,87 @@ +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `i32`: + --> $DIR/coherence-impls-copy.rs:8:1 + | +LL | impl Copy for i32 {} + | ^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl std::marker::Copy for i32; + +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: + --> $DIR/coherence-impls-copy.rs:37:1 + | +LL | impl Copy for &'static NotSync {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl std::marker::Copy for &T + where T: ?Sized; + +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: + --> $DIR/coherence-impls-copy.rs:45:1 + | +LL | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl std::marker::Copy for &T + where T: ?Sized; + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:27:15 + | +LL | impl Copy for &'static mut MyType {} + | ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:32:15 + | +LL | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:40:15 + | +LL | impl Copy for [MyType] {} + | ^^^^^^^^ type is not a structure or enumeration + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:8:1 + | +LL | impl Copy for i32 {} + | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:32:1 + | +LL | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:40:1 + | +LL | impl Copy for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:45:1 + | +LL | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 10 previous errors + +Some errors occurred: E0117, E0119, E0206. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-impls-copy.re.stderr b/src/test/ui/coherence/coherence-impls-copy.re.stderr new file mode 100644 index 00000000000..e870c267ce1 --- /dev/null +++ b/src/test/ui/coherence/coherence-impls-copy.re.stderr @@ -0,0 +1,87 @@ +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `i32`: + --> $DIR/coherence-impls-copy.rs:8:1 + | +LL | impl Copy for i32 {} + | ^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl std::marker::Copy for i32; + +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: + --> $DIR/coherence-impls-copy.rs:37:1 + | +LL | impl Copy for &'static NotSync {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl std::marker::Copy for &T + where T: ?Sized; + +error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: + --> $DIR/coherence-impls-copy.rs:45:1 + | +LL | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: conflicting implementation in crate `core`: + - impl std::marker::Copy for &T + where T: ?Sized; + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:27:15 + | +LL | impl Copy for &'static mut MyType {} + | ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:32:15 + | +LL | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration + +error[E0206]: the trait `Copy` may not be implemented for this type + --> $DIR/coherence-impls-copy.rs:40:15 + | +LL | impl Copy for [MyType] {} + | ^^^^^^^^ type is not a structure or enumeration + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:8:1 + | +LL | impl Copy for i32 {} + | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:32:1 + | +LL | impl Copy for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:40:1 + | +LL | impl Copy for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-copy.rs:45:1 + | +LL | impl Copy for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 10 previous errors + +Some errors occurred: E0117, E0119, E0206. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-impls-copy.rs b/src/test/ui/coherence/coherence-impls-copy.rs index f48790d1f40..97133bc33ce 100644 --- a/src/test/ui/coherence/coherence-impls-copy.rs +++ b/src/test/ui/coherence/coherence-impls-copy.rs @@ -1,21 +1,15 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] use std::marker::Copy; impl Copy for i32 {} -//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `i32`: -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types - +//[old]~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `i32`: +//[old]~| ERROR only traits defined in the current crate can be implemented for arbitrary types +//[re]~^^^ ERROR E0119 +//[re]~| ERROR E0117 enum TestE { A } @@ -31,23 +25,27 @@ impl Clone for TestE { fn clone(&self) -> Self { *self } } impl Copy for MyType {} impl Copy for &'static mut MyType {} -//~^ ERROR the trait `Copy` may not be implemented for this type +//[old]~^ ERROR the trait `Copy` may not be implemented for this type +//[re]~^^ ERROR E0206 impl Clone for MyType { fn clone(&self) -> Self { *self } } impl Copy for (MyType, MyType) {} -//~^ ERROR the trait `Copy` may not be implemented for this type -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types - +//[old]~^ ERROR the trait `Copy` may not be implemented for this type +//[old]~| ERROR only traits defined in the current crate can be implemented for arbitrary types +//[re]~^^^ ERROR E0206 +//[re]~| ERROR E0117 impl Copy for &'static NotSync {} -//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: - +//[old]~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: +//[re]~^^ ERROR E0119 impl Copy for [MyType] {} -//~^ ERROR the trait `Copy` may not be implemented for this type -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types - +//[old]~^ ERROR the trait `Copy` may not be implemented for this type +//[old]~| ERROR only traits defined in the current crate can be implemented for arbitrary types +//[re]~^^^ ERROR E0206 +//[re]~| ERROR E0117 impl Copy for &'static [NotSync] {} -//~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: -//~| ERROR only traits defined in the current crate can be implemented for arbitrary types - +//[old]~^ ERROR conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: +//[old]~| ERROR only traits defined in the current crate can be implemented for arbitrary types +//[re]~^^^ ERROR E0119 +//[re]~| ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-impls-copy.stderr b/src/test/ui/coherence/coherence-impls-copy.stderr deleted file mode 100644 index dc417957795..00000000000 --- a/src/test/ui/coherence/coherence-impls-copy.stderr +++ /dev/null @@ -1,87 +0,0 @@ -error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `i32`: - --> $DIR/coherence-impls-copy.rs:15:1 - | -LL | impl Copy for i32 {} - | ^^^^^^^^^^^^^^^^^ - | - = note: conflicting implementation in crate `core`: - - impl std::marker::Copy for i32; - -error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&NotSync`: - --> $DIR/coherence-impls-copy.rs:41:1 - | -LL | impl Copy for &'static NotSync {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: conflicting implementation in crate `core`: - - impl std::marker::Copy for &T - where T: ?Sized; - -error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `&[NotSync]`: - --> $DIR/coherence-impls-copy.rs:48:1 - | -LL | impl Copy for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: conflicting implementation in crate `core`: - - impl std::marker::Copy for &T - where T: ?Sized; - -error[E0206]: the trait `Copy` may not be implemented for this type - --> $DIR/coherence-impls-copy.rs:33:15 - | -LL | impl Copy for &'static mut MyType {} - | ^^^^^^^^^^^^^^^^^^^ type is not a structure or enumeration - -error[E0206]: the trait `Copy` may not be implemented for this type - --> $DIR/coherence-impls-copy.rs:37:15 - | -LL | impl Copy for (MyType, MyType) {} - | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration - -error[E0206]: the trait `Copy` may not be implemented for this type - --> $DIR/coherence-impls-copy.rs:44:15 - | -LL | impl Copy for [MyType] {} - | ^^^^^^^^ type is not a structure or enumeration - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:15:1 - | -LL | impl Copy for i32 {} - | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:37:1 - | -LL | impl Copy for (MyType, MyType) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:44:1 - | -LL | impl Copy for [MyType] {} - | ^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-copy.rs:48:1 - | -LL | impl Copy for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to 10 previous errors - -Some errors occurred: E0117, E0119, E0206. -For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-impls-send.old.stderr b/src/test/ui/coherence/coherence-impls-send.old.stderr new file mode 100644 index 00000000000..3ede8363d11 --- /dev/null +++ b/src/test/ui/coherence/coherence-impls-send.old.stderr @@ -0,0 +1,37 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:20:1 + | +LL | unsafe impl Send for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static NotSync` + --> $DIR/coherence-impls-send.rs:24:1 + | +LL | unsafe impl Send for &'static NotSync {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:28:1 + | +LL | unsafe impl Send for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:32:1 + | +LL | unsafe impl Send for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 4 previous errors + +Some errors occurred: E0117, E0321. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-impls-send.re.stderr b/src/test/ui/coherence/coherence-impls-send.re.stderr new file mode 100644 index 00000000000..3ede8363d11 --- /dev/null +++ b/src/test/ui/coherence/coherence-impls-send.re.stderr @@ -0,0 +1,37 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:20:1 + | +LL | unsafe impl Send for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static NotSync` + --> $DIR/coherence-impls-send.rs:24:1 + | +LL | unsafe impl Send for &'static NotSync {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:28:1 + | +LL | unsafe impl Send for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-send.rs:32:1 + | +LL | unsafe impl Send for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 4 previous errors + +Some errors occurred: E0117, E0321. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-impls-send.rs b/src/test/ui/coherence/coherence-impls-send.rs index 9caaee41aeb..ef13e9caa66 100644 --- a/src/test/ui/coherence/coherence-impls-send.rs +++ b/src/test/ui/coherence/coherence-impls-send.rs @@ -1,13 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] #![feature(overlapping_marker_traits)] @@ -25,16 +18,20 @@ impl !Sync for NotSync {} unsafe impl Send for TestE {} unsafe impl Send for MyType {} unsafe impl Send for (MyType, MyType) {} -//~^ ERROR E0117 +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 unsafe impl Send for &'static NotSync {} -//~^ ERROR E0321 +//[old]~^ ERROR E0321 +//[re]~^^ ERROR E0321 unsafe impl Send for [MyType] {} -//~^ ERROR E0117 +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 unsafe impl Send for &'static [NotSync] {} -//~^ ERROR E0117 +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-impls-send.stderr b/src/test/ui/coherence/coherence-impls-send.stderr deleted file mode 100644 index 4e7e228b23f..00000000000 --- a/src/test/ui/coherence/coherence-impls-send.stderr +++ /dev/null @@ -1,37 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:27:1 - | -LL | unsafe impl Send for (MyType, MyType) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static NotSync` - --> $DIR/coherence-impls-send.rs:30:1 - | -LL | unsafe impl Send for &'static NotSync {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:33:1 - | -LL | unsafe impl Send for [MyType] {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-send.rs:36:1 - | -LL | unsafe impl Send for &'static [NotSync] {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to 4 previous errors - -Some errors occurred: E0117, E0321. -For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-impls-sized.old.stderr b/src/test/ui/coherence/coherence-impls-sized.old.stderr new file mode 100644 index 00000000000..86a0996554d --- /dev/null +++ b/src/test/ui/coherence/coherence-impls-sized.old.stderr @@ -0,0 +1,67 @@ +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:17:1 + | +LL | impl Sized for TestE {} + | ^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:22:1 + | +LL | impl Sized for MyType {} + | ^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:27:1 + | +LL | impl Sized for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:34:1 + | +LL | impl Sized for &'static NotSync {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:39:1 + | +LL | impl Sized for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:46:1 + | +LL | impl Sized for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:27:1 + | +LL | impl Sized for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:39:1 + | +LL | impl Sized for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:46:1 + | +LL | impl Sized for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 9 previous errors + +Some errors occurred: E0117, E0322. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-impls-sized.re.stderr b/src/test/ui/coherence/coherence-impls-sized.re.stderr new file mode 100644 index 00000000000..86a0996554d --- /dev/null +++ b/src/test/ui/coherence/coherence-impls-sized.re.stderr @@ -0,0 +1,67 @@ +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:17:1 + | +LL | impl Sized for TestE {} + | ^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:22:1 + | +LL | impl Sized for MyType {} + | ^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:27:1 + | +LL | impl Sized for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:34:1 + | +LL | impl Sized for &'static NotSync {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:39:1 + | +LL | impl Sized for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0322]: explicit impls for the `Sized` trait are not permitted + --> $DIR/coherence-impls-sized.rs:46:1 + | +LL | impl Sized for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:27:1 + | +LL | impl Sized for (MyType, MyType) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:39:1 + | +LL | impl Sized for [MyType] {} + | ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-impls-sized.rs:46:1 + | +LL | impl Sized for &'static [NotSync] {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 9 previous errors + +Some errors occurred: E0117, E0322. +For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-impls-sized.rs b/src/test/ui/coherence/coherence-impls-sized.rs index 60b5d14d158..84ae2dd291b 100644 --- a/src/test/ui/coherence/coherence-impls-sized.rs +++ b/src/test/ui/coherence/coherence-impls-sized.rs @@ -1,13 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] use std::marker::Copy; @@ -21,26 +14,41 @@ struct MyType; struct NotSync; impl !Sync for NotSync {} -impl Sized for TestE {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed - -impl Sized for MyType {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed - -impl Sized for (MyType, MyType) {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed -//~| ERROR E0117 - -impl Sized for &'static NotSync {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed - -impl Sized for [MyType] {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed -//~| ERROR E0117 - -impl Sized for &'static [NotSync] {} //~ ERROR E0322 -//~^ impl of 'Sized' not allowed -//~| ERROR E0117 +impl Sized for TestE {} +//[old]~^ ERROR E0322 +//[old]~| impl of 'Sized' not allowed +//[re]~^^^ ERROR E0322 + +impl Sized for MyType {} +//[old]~^ ERROR E0322 +//[old]~| impl of 'Sized' not allowed +//[re]~^^^ ERROR E0322 + +impl Sized for (MyType, MyType) {} +//[old]~^ ERROR E0322 +//[old]~| impl of 'Sized' not allowed +//[old]~| ERROR E0117 +//[re]~^^^^ ERROR E0322 +//[re]~| ERROR E0117 + +impl Sized for &'static NotSync {} +//[old]~^ ERROR E0322 +//[old]~| impl of 'Sized' not allowed +//[re]~^^^ ERROR E0322 + +impl Sized for [MyType] {} +//[old]~^ ERROR E0322 +//[old]~| impl of 'Sized' not allowed +//[old]~| ERROR E0117 +//[re]~^^^^ ERROR E0322 +//[re]~| ERROR E0117 + +impl Sized for &'static [NotSync] {} +//[old]~^ ERROR E0322 +//[old]~| impl of 'Sized' not allowed +//[old]~| ERROR E0117 +//[re]~^^^^ ERROR E0322 +//[re]~| ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-impls-sized.stderr b/src/test/ui/coherence/coherence-impls-sized.stderr deleted file mode 100644 index 683fb0aaa68..00000000000 --- a/src/test/ui/coherence/coherence-impls-sized.stderr +++ /dev/null @@ -1,67 +0,0 @@ -error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:24:1 - | -LL | impl Sized for TestE {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed - -error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:27:1 - | -LL | impl Sized for MyType {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed - -error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:30:1 - | -LL | impl Sized for (MyType, MyType) {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed - -error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:34:1 - | -LL | impl Sized for &'static NotSync {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed - -error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:37:1 - | -LL | impl Sized for [MyType] {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed - -error[E0322]: explicit impls for the `Sized` trait are not permitted - --> $DIR/coherence-impls-sized.rs:41:1 - | -LL | impl Sized for &'static [NotSync] {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:30:1 - | -LL | impl Sized for (MyType, MyType) {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:37:1 - | -LL | impl Sized for [MyType] {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-impls-sized.rs:41:1 - | -LL | impl Sized for &'static [NotSync] {} //~ ERROR E0322 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to 9 previous errors - -Some errors occurred: E0117, E0322. -For more information about an error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.old.stderr b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.old.stderr new file mode 100644 index 00000000000..a2fa49acd2c --- /dev/null +++ b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.old.stderr @@ -0,0 +1,16 @@ +error[E0391]: cycle detected when processing `Trait` + --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:12:1 + | +LL | trait Trait { type Assoc; } + | ^^^^^^^^^^^^^^ + | + = note: ...which again requires processing `Trait`, completing the cycle +note: cycle used when coherence checking all impls of trait `Trait` + --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:12:1 + | +LL | trait Trait { type Assoc; } + | ^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.re.stderr b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.re.stderr new file mode 100644 index 00000000000..a2fa49acd2c --- /dev/null +++ b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.re.stderr @@ -0,0 +1,16 @@ +error[E0391]: cycle detected when processing `Trait` + --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:12:1 + | +LL | trait Trait { type Assoc; } + | ^^^^^^^^^^^^^^ + | + = note: ...which again requires processing `Trait`, completing the cycle +note: cycle used when coherence checking all impls of trait `Trait` + --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:12:1 + | +LL | trait Trait { type Assoc; } + | ^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.rs b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.rs index 5db901b5ba1..5a6b8fb7316 100644 --- a/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.rs +++ b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.rs @@ -1,23 +1,17 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Formerly this ICEd with the following message: // Tried to project an inherited associated type during coherence checking, // which is currently not supported. // // No we expect to run into a more user-friendly cycle error instead. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(specialization)] trait Trait { type Assoc; } -//~^ cycle detected +//[old]~^ cycle detected +//[re]~^^ ERROR E0391 impl Trait for Vec { type Assoc = (); diff --git a/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr deleted file mode 100644 index 5dba448a963..00000000000 --- a/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0391]: cycle detected when processing `Trait` - --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:19:1 - | -LL | trait Trait { type Assoc; } - | ^^^^^^^^^^^^^^ - | - = note: ...which again requires processing `Trait`, completing the cycle -note: cycle used when coherence checking all impls of trait `Trait` - --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:19:1 - | -LL | trait Trait { type Assoc; } - | ^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/coherence/coherence-lone-type-parameter.old.stderr b/src/test/ui/coherence/coherence-lone-type-parameter.old.stderr new file mode 100644 index 00000000000..ac77241e9e7 --- /dev/null +++ b/src/test/ui/coherence/coherence-lone-type-parameter.old.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-lone-type-parameter.rs:9:1 + | +LL | impl Remote for T { } + | ^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-lone-type-parameter.re.stderr b/src/test/ui/coherence/coherence-lone-type-parameter.re.stderr new file mode 100644 index 00000000000..ac77241e9e7 --- /dev/null +++ b/src/test/ui/coherence/coherence-lone-type-parameter.re.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-lone-type-parameter.rs:9:1 + | +LL | impl Remote for T { } + | ^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-lone-type-parameter.rs b/src/test/ui/coherence/coherence-lone-type-parameter.rs index e78f392b386..63b38bf1cc1 100644 --- a/src/test/ui/coherence/coherence-lone-type-parameter.rs +++ b/src/test/ui/coherence/coherence-lone-type-parameter.rs @@ -1,19 +1,14 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::Remote; impl Remote for T { } -//~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[re]~^^ ERROR E0210 + fn main() { } diff --git a/src/test/ui/coherence/coherence-lone-type-parameter.stderr b/src/test/ui/coherence/coherence-lone-type-parameter.stderr deleted file mode 100644 index 6389bc0e7ab..00000000000 --- a/src/test/ui/coherence/coherence-lone-type-parameter.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/coherence-lone-type-parameter.rs:16:1 - | -LL | impl Remote for T { } - | ^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type - | - = note: only traits defined in the current crate can be implemented for a type parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-negative-impls-safe.old.stderr b/src/test/ui/coherence/coherence-negative-impls-safe.old.stderr new file mode 100644 index 00000000000..7ed47dca497 --- /dev/null +++ b/src/test/ui/coherence/coherence-negative-impls-safe.old.stderr @@ -0,0 +1,9 @@ +error[E0198]: negative impls cannot be unsafe + --> $DIR/coherence-negative-impls-safe.rs:10:1 + | +LL | unsafe impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0198`. diff --git a/src/test/ui/coherence/coherence-negative-impls-safe.re.stderr b/src/test/ui/coherence/coherence-negative-impls-safe.re.stderr new file mode 100644 index 00000000000..7ed47dca497 --- /dev/null +++ b/src/test/ui/coherence/coherence-negative-impls-safe.re.stderr @@ -0,0 +1,9 @@ +error[E0198]: negative impls cannot be unsafe + --> $DIR/coherence-negative-impls-safe.rs:10:1 + | +LL | unsafe impl !Send for TestType {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0198`. diff --git a/src/test/ui/coherence/coherence-negative-impls-safe.rs b/src/test/ui/coherence/coherence-negative-impls-safe.rs index 1ae07b64685..b6658d5bfa4 100644 --- a/src/test/ui/coherence/coherence-negative-impls-safe.rs +++ b/src/test/ui/coherence/coherence-negative-impls-safe.rs @@ -1,13 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] use std::marker::Send; @@ -15,6 +8,7 @@ use std::marker::Send; struct TestType; unsafe impl !Send for TestType {} -//~^ ERROR negative impls cannot be unsafe +//[old]~^ ERROR negative impls cannot be unsafe +//[re]~^^ ERROR E0198 fn main() {} diff --git a/src/test/ui/coherence/coherence-negative-impls-safe.stderr b/src/test/ui/coherence/coherence-negative-impls-safe.stderr deleted file mode 100644 index 7373f79942f..00000000000 --- a/src/test/ui/coherence/coherence-negative-impls-safe.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0198]: negative impls cannot be unsafe - --> $DIR/coherence-negative-impls-safe.rs:17:1 - | -LL | unsafe impl !Send for TestType {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0198`. diff --git a/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.old.stderr b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.old.stderr new file mode 100644 index 00000000000..81465e71856 --- /dev/null +++ b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.old.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `MyTrait`: + --> $DIR/coherence-no-direct-lifetime-dispatch.rs:10:1 + | +LL | impl MyTrait for T {} + | --------------------- first implementation here +LL | impl MyTrait for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.re.stderr b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.re.stderr new file mode 100644 index 00000000000..81465e71856 --- /dev/null +++ b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.re.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `MyTrait`: + --> $DIR/coherence-no-direct-lifetime-dispatch.rs:10:1 + | +LL | impl MyTrait for T {} + | --------------------- first implementation here +LL | impl MyTrait for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.rs b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.rs index 47026cd32d4..9717f1ed051 100644 --- a/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.rs +++ b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.rs @@ -1,18 +1,14 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that you cannot *directly* dispatch on lifetime requirements +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + trait MyTrait { fn foo() {} } impl MyTrait for T {} -impl MyTrait for T {} //~ ERROR E0119 +impl MyTrait for T {} +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() {} diff --git a/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr deleted file mode 100644 index 669c5e3a4a6..00000000000 --- a/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait`: - --> $DIR/coherence-no-direct-lifetime-dispatch.rs:16:1 - | -LL | impl MyTrait for T {} - | --------------------- first implementation here -LL | impl MyTrait for T {} //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-orphan.old.stderr b/src/test/ui/coherence/coherence-orphan.old.stderr new file mode 100644 index 00000000000..e6dc17d95a2 --- /dev/null +++ b/src/test/ui/coherence/coherence-orphan.old.stderr @@ -0,0 +1,21 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-orphan.rs:13:1 + | +LL | impl TheTrait for isize { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-orphan.rs:21:1 + | +LL | impl !Send for Vec { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-orphan.re.stderr b/src/test/ui/coherence/coherence-orphan.re.stderr new file mode 100644 index 00000000000..e6dc17d95a2 --- /dev/null +++ b/src/test/ui/coherence/coherence-orphan.re.stderr @@ -0,0 +1,21 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-orphan.rs:13:1 + | +LL | impl TheTrait for isize { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-orphan.rs:21:1 + | +LL | impl !Send for Vec { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-orphan.rs b/src/test/ui/coherence/coherence-orphan.rs index 80efc7b75e2..18f50e46021 100644 --- a/src/test/ui/coherence/coherence-orphan.rs +++ b/src/test/ui/coherence/coherence-orphan.rs @@ -1,15 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:coherence_orphan_lib.rs +// revisions: old re +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(optin_builtin_traits)] extern crate coherence_orphan_lib as lib; @@ -19,13 +11,15 @@ use lib::TheTrait; struct TheType; impl TheTrait for isize { } -//~^ ERROR E0117 +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 impl TheTrait for isize { } impl TheTrait for TheType { } impl !Send for Vec { } -//~^ ERROR E0117 +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-orphan.stderr b/src/test/ui/coherence/coherence-orphan.stderr deleted file mode 100644 index ee863533237..00000000000 --- a/src/test/ui/coherence/coherence-orphan.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-orphan.rs:21:1 - | -LL | impl TheTrait for isize { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-orphan.rs:28:1 - | -LL | impl !Send for Vec { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.old.stderr b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.old.stderr new file mode 100644 index 00000000000..c7f85b0b590 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.old.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `From<(_,)>` for type `(_,)`: + --> $DIR/coherence-overlap-all-t-and-tuple.rs:20:1 + | +LL | impl From for T { + | ---------------------- first implementation here +... +LL | impl From<(U11,)> for (T11,) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_,)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.re.stderr b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.re.stderr new file mode 100644 index 00000000000..c7f85b0b590 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `From<(_,)>` for type `(_,)`: + --> $DIR/coherence-overlap-all-t-and-tuple.rs:20:1 + | +LL | impl From for T { + | ---------------------- first implementation here +... +LL | impl From<(U11,)> for (T11,) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_,)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.rs b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.rs index 1fad608db6c..bf3ce89f70b 100644 --- a/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.rs +++ b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we detect an overlap here in the case where: // // for some type X: @@ -16,6 +6,10 @@ // // Seems pretty basic, but then there was issue #24241. :) +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + trait From { fn foo() {} } @@ -23,7 +17,9 @@ trait From { impl From for T { } -impl From<(U11,)> for (T11,) { //~ ERROR E0119 +impl From<(U11,)> for (T11,) { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 } fn main() { } diff --git a/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.stderr b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.stderr deleted file mode 100644 index 993de789ef5..00000000000 --- a/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `From<(_,)>` for type `(_,)`: - --> $DIR/coherence-overlap-all-t-and-tuple.rs:26:1 - | -LL | impl From for T { - | ---------------------- first implementation here -... -LL | impl From<(U11,)> for (T11,) { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_,)` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-downstream-inherent.old.stderr b/src/test/ui/coherence/coherence-overlap-downstream-inherent.old.stderr new file mode 100644 index 00000000000..dcfc017f1b0 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-downstream-inherent.old.stderr @@ -0,0 +1,23 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-downstream-inherent.rs:11:26 + | +LL | impl Sweet { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +... +LL | impl Sweet { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + +error[E0592]: duplicate definitions with name `f` + --> $DIR/coherence-overlap-downstream-inherent.rs:18:38 + | +LL | impl A where T: Bar { fn f(&self) {} } + | ^^^^^^^^^^^^^^ duplicate definitions for `f` +... +LL | impl A { fn f(&self) {} } + | -------------- other definition for `f` + | + = note: downstream crates may implement trait `Bar<_>` for type `i32` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/coherence/coherence-overlap-downstream-inherent.re.stderr b/src/test/ui/coherence/coherence-overlap-downstream-inherent.re.stderr new file mode 100644 index 00000000000..dcfc017f1b0 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-downstream-inherent.re.stderr @@ -0,0 +1,23 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-downstream-inherent.rs:11:26 + | +LL | impl Sweet { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +... +LL | impl Sweet { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + +error[E0592]: duplicate definitions with name `f` + --> $DIR/coherence-overlap-downstream-inherent.rs:18:38 + | +LL | impl A where T: Bar { fn f(&self) {} } + | ^^^^^^^^^^^^^^ duplicate definitions for `f` +... +LL | impl A { fn f(&self) {} } + | -------------- other definition for `f` + | + = note: downstream crates may implement trait `Bar<_>` for type `i32` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/coherence/coherence-overlap-downstream-inherent.rs b/src/test/ui/coherence/coherence-overlap-downstream-inherent.rs index fd6e1d339f3..ad54d247f91 100644 --- a/src/test/ui/coherence/coherence-overlap-downstream-inherent.rs +++ b/src/test/ui/coherence/coherence-overlap-downstream-inherent.rs @@ -1,27 +1,23 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that we consider `T: Sugar + Fruit` to be ambiguous, even // though no impls are found. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + struct Sweet(X); pub trait Sugar {} pub trait Fruit {} impl Sweet { fn dummy(&self) { } } -//~^ ERROR E0592 +//[old]~^ ERROR E0592 +//[re]~^^ ERROR E0592 impl Sweet { fn dummy(&self) { } } trait Bar {} struct A(T, X); impl A where T: Bar { fn f(&self) {} } -//~^ ERROR E0592 +//[old]~^ ERROR E0592 +//[re]~^^ ERROR E0592 impl A { fn f(&self) {} } fn main() {} diff --git a/src/test/ui/coherence/coherence-overlap-downstream-inherent.stderr b/src/test/ui/coherence/coherence-overlap-downstream-inherent.stderr deleted file mode 100644 index 29df3f9c37a..00000000000 --- a/src/test/ui/coherence/coherence-overlap-downstream-inherent.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0592]: duplicate definitions with name `dummy` - --> $DIR/coherence-overlap-downstream-inherent.rs:17:26 - | -LL | impl Sweet { fn dummy(&self) { } } - | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` -LL | //~^ ERROR E0592 -LL | impl Sweet { fn dummy(&self) { } } - | ------------------- other definition for `dummy` - -error[E0592]: duplicate definitions with name `f` - --> $DIR/coherence-overlap-downstream-inherent.rs:23:38 - | -LL | impl A where T: Bar { fn f(&self) {} } - | ^^^^^^^^^^^^^^ duplicate definitions for `f` -LL | //~^ ERROR E0592 -LL | impl A { fn f(&self) {} } - | -------------- other definition for `f` - | - = note: downstream crates may implement trait `Bar<_>` for type `i32` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/coherence/coherence-overlap-downstream.old.stderr b/src/test/ui/coherence/coherence-overlap-downstream.old.stderr new file mode 100644 index 00000000000..b4847c03d41 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-downstream.old.stderr @@ -0,0 +1,21 @@ +error[E0119]: conflicting implementations of trait `Sweet`: + --> $DIR/coherence-overlap-downstream.rs:12:1 + | +LL | impl Sweet for T { } + | ------------------------- first implementation here +LL | impl Sweet for T { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`: + --> $DIR/coherence-overlap-downstream.rs:19:1 + | +LL | impl Foo for T where T: Bar {} + | --------------------------------------- first implementation here +LL | impl Foo for i32 {} + | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + | + = note: downstream crates may implement trait `Bar<_>` for type `i32` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-downstream.re.stderr b/src/test/ui/coherence/coherence-overlap-downstream.re.stderr new file mode 100644 index 00000000000..b4847c03d41 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-downstream.re.stderr @@ -0,0 +1,21 @@ +error[E0119]: conflicting implementations of trait `Sweet`: + --> $DIR/coherence-overlap-downstream.rs:12:1 + | +LL | impl Sweet for T { } + | ------------------------- first implementation here +LL | impl Sweet for T { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`: + --> $DIR/coherence-overlap-downstream.rs:19:1 + | +LL | impl Foo for T where T: Bar {} + | --------------------------------------- first implementation here +LL | impl Foo for i32 {} + | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + | + = note: downstream crates may implement trait `Bar<_>` for type `i32` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-downstream.rs b/src/test/ui/coherence/coherence-overlap-downstream.rs index 63898ef9a20..c6ced7b80fd 100644 --- a/src/test/ui/coherence/coherence-overlap-downstream.rs +++ b/src/test/ui/coherence/coherence-overlap-downstream.rs @@ -1,27 +1,23 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that we consider `T: Sugar + Fruit` to be ambiguous, even // though no impls are found. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + pub trait Sugar {} pub trait Fruit {} pub trait Sweet {} impl Sweet for T { } impl Sweet for T { } -//~^ ERROR E0119 +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 pub trait Foo {} pub trait Bar {} impl Foo for T where T: Bar {} impl Foo for i32 {} -//~^ ERROR E0119 +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() { } diff --git a/src/test/ui/coherence/coherence-overlap-downstream.stderr b/src/test/ui/coherence/coherence-overlap-downstream.stderr deleted file mode 100644 index 8e14e4f9bda..00000000000 --- a/src/test/ui/coherence/coherence-overlap-downstream.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0119]: conflicting implementations of trait `Sweet`: - --> $DIR/coherence-overlap-downstream.rs:18:1 - | -LL | impl Sweet for T { } - | ------------------------- first implementation here -LL | impl Sweet for T { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation - -error[E0119]: conflicting implementations of trait `Foo<_>` for type `i32`: - --> $DIR/coherence-overlap-downstream.rs:24:1 - | -LL | impl Foo for T where T: Bar {} - | --------------------------------------- first implementation here -LL | impl Foo for i32 {} - | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` - | - = note: downstream crates may implement trait `Bar<_>` for type `i32` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr new file mode 100644 index 00000000000..6fd93077540 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.old.stderr @@ -0,0 +1,14 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-issue-23516-inherent.rs:13:25 + | +LL | impl Cake { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +... +LL | impl Cake> { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + | + = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.re.stderr b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.re.stderr new file mode 100644 index 00000000000..6fd93077540 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.re.stderr @@ -0,0 +1,14 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-issue-23516-inherent.rs:13:25 + | +LL | impl Cake { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +... +LL | impl Cake> { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + | + = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.rs b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.rs index 94a7bdbc69e..969366e29cc 100644 --- a/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.rs +++ b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.rs @@ -1,23 +1,18 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that we consider `Box: !Sugar` to be ambiguous, even // though we see no impl of `Sugar` for `Box`. Therefore, an overlap // error is reported for the following pair of impls (#23516). +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + pub trait Sugar {} struct Cake(X); impl Cake { fn dummy(&self) { } } -//~^ ERROR E0592 +//[old]~^ ERROR E0592 +//[re]~^^ ERROR E0592 impl Cake> { fn dummy(&self) { } } fn main() { } diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.stderr b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.stderr deleted file mode 100644 index d217a4d2cdf..00000000000 --- a/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0592]: duplicate definitions with name `dummy` - --> $DIR/coherence-overlap-issue-23516-inherent.rs:19:25 - | -LL | impl Cake { fn dummy(&self) { } } - | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` -LL | //~^ ERROR E0592 -LL | impl Cake> { fn dummy(&self) { } } - | ------------------- other definition for `dummy` - | - = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516.old.stderr b/src/test/ui/coherence/coherence-overlap-issue-23516.old.stderr new file mode 100644 index 00000000000..d17d67adf0e --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-issue-23516.old.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Sweet` for type `std::boxed::Box<_>`: + --> $DIR/coherence-overlap-issue-23516.rs:12:1 + | +LL | impl Sweet for T { } + | ------------------------- first implementation here +LL | impl Sweet for Box { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>` + | + = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516.re.stderr b/src/test/ui/coherence/coherence-overlap-issue-23516.re.stderr new file mode 100644 index 00000000000..d17d67adf0e --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-issue-23516.re.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Sweet` for type `std::boxed::Box<_>`: + --> $DIR/coherence-overlap-issue-23516.rs:12:1 + | +LL | impl Sweet for T { } + | ------------------------- first implementation here +LL | impl Sweet for Box { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>` + | + = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516.rs b/src/test/ui/coherence/coherence-overlap-issue-23516.rs index 3cd184b9be9..e3c15e149f8 100644 --- a/src/test/ui/coherence/coherence-overlap-issue-23516.rs +++ b/src/test/ui/coherence/coherence-overlap-issue-23516.rs @@ -1,21 +1,16 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that we consider `Box: !Sugar` to be ambiguous, even // though we see no impl of `Sugar` for `Box`. Therefore, an overlap // error is reported for the following pair of impls (#23516). +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + pub trait Sugar { fn dummy(&self) { } } pub trait Sweet { fn dummy(&self) { } } impl Sweet for T { } impl Sweet for Box { } -//~^ ERROR E0119 +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() { } diff --git a/src/test/ui/coherence/coherence-overlap-issue-23516.stderr b/src/test/ui/coherence/coherence-overlap-issue-23516.stderr deleted file mode 100644 index ea2ecda6f0d..00000000000 --- a/src/test/ui/coherence/coherence-overlap-issue-23516.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0119]: conflicting implementations of trait `Sweet` for type `std::boxed::Box<_>`: - --> $DIR/coherence-overlap-issue-23516.rs:18:1 - | -LL | impl Sweet for T { } - | ------------------------- first implementation here -LL | impl Sweet for Box { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::boxed::Box<_>` - | - = note: downstream crates may implement trait `Sugar` for type `std::boxed::Box<_>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-messages.old.stderr b/src/test/ui/coherence/coherence-overlap-messages.old.stderr new file mode 100644 index 00000000000..429e67573b5 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-messages.old.stderr @@ -0,0 +1,44 @@ +error[E0119]: conflicting implementations of trait `Foo`: + --> $DIR/coherence-overlap-messages.rs:8:1 + | +LL | impl Foo for T {} + | ----------------- first implementation here +LL | impl Foo for U {} + | ^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`: + --> $DIR/coherence-overlap-messages.rs:16:1 + | +LL | impl Bar for (T, u8) {} + | ----------------------- first implementation here +LL | impl Bar for (u8, T) {} + | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)` + +error[E0119]: conflicting implementations of trait `Baz` for type `u8`: + --> $DIR/coherence-overlap-messages.rs:23:1 + | +LL | impl Baz for T {} + | --------------------- first implementation here +LL | impl Baz for u8 {} + | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8` + +error[E0119]: conflicting implementations of trait `Quux<_, _>`: + --> $DIR/coherence-overlap-messages.rs:30:1 + | +LL | impl Quux for T {} + | ------------------------------ first implementation here +LL | impl Quux for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Quux<_, _>`: + --> $DIR/coherence-overlap-messages.rs:33:1 + | +LL | impl Quux for T {} + | ------------------------------ first implementation here +... +LL | impl Quux for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-messages.re.stderr b/src/test/ui/coherence/coherence-overlap-messages.re.stderr new file mode 100644 index 00000000000..429e67573b5 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-messages.re.stderr @@ -0,0 +1,44 @@ +error[E0119]: conflicting implementations of trait `Foo`: + --> $DIR/coherence-overlap-messages.rs:8:1 + | +LL | impl Foo for T {} + | ----------------- first implementation here +LL | impl Foo for U {} + | ^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`: + --> $DIR/coherence-overlap-messages.rs:16:1 + | +LL | impl Bar for (T, u8) {} + | ----------------------- first implementation here +LL | impl Bar for (u8, T) {} + | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)` + +error[E0119]: conflicting implementations of trait `Baz` for type `u8`: + --> $DIR/coherence-overlap-messages.rs:23:1 + | +LL | impl Baz for T {} + | --------------------- first implementation here +LL | impl Baz for u8 {} + | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8` + +error[E0119]: conflicting implementations of trait `Quux<_, _>`: + --> $DIR/coherence-overlap-messages.rs:30:1 + | +LL | impl Quux for T {} + | ------------------------------ first implementation here +LL | impl Quux for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error[E0119]: conflicting implementations of trait `Quux<_, _>`: + --> $DIR/coherence-overlap-messages.rs:33:1 + | +LL | impl Quux for T {} + | ------------------------------ first implementation here +... +LL | impl Quux for T {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-messages.rs b/src/test/ui/coherence/coherence-overlap-messages.rs index a10deeafbe6..e0e2e672e98 100644 --- a/src/test/ui/coherence/coherence-overlap-messages.rs +++ b/src/test/ui/coherence/coherence-overlap-messages.rs @@ -1,32 +1,37 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] trait Foo { fn foo() {} } impl Foo for T {} -impl Foo for U {} //~ ERROR conflicting implementations of trait `Foo`: +impl Foo for U {} +//[old]~^ ERROR conflicting implementations of trait `Foo`: +//[re]~^^ ERROR E0119 + trait Bar { fn bar() {} } impl Bar for (T, u8) {} -impl Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: +impl Bar for (u8, T) {} +//[old]~^ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: +//[re]~^^ ERROR E0119 trait Baz { fn baz() {} } impl Baz for T {} -impl Baz for u8 {} //~ ERROR conflicting implementations of trait `Baz` for type `u8`: +impl Baz for u8 {} +//[old]~^ ERROR conflicting implementations of trait `Baz` for type `u8`: +//[re]~^^ ERROR E0119 trait Quux { fn quux() {} } impl Quux for T {} -impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: -impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: +impl Quux for T {} +//[old]~^ ERROR conflicting implementations of trait `Quux<_, _>`: +//[re]~^^ ERROR E0119 +impl Quux for T {} +//[old]~^ ERROR conflicting implementations of trait `Quux<_, _>`: +//[re]~^^ ERROR E0119 fn main() {} diff --git a/src/test/ui/coherence/coherence-overlap-messages.stderr b/src/test/ui/coherence/coherence-overlap-messages.stderr deleted file mode 100644 index 60023c6c249..00000000000 --- a/src/test/ui/coherence/coherence-overlap-messages.stderr +++ /dev/null @@ -1,44 +0,0 @@ -error[E0119]: conflicting implementations of trait `Foo`: - --> $DIR/coherence-overlap-messages.rs:14:1 - | -LL | impl Foo for T {} - | ----------------- first implementation here -LL | impl Foo for U {} //~ ERROR conflicting implementations of trait `Foo`: - | ^^^^^^^^^^^^^^^^^ conflicting implementation - -error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`: - --> $DIR/coherence-overlap-messages.rs:19:1 - | -LL | impl Bar for (T, u8) {} - | ----------------------- first implementation here -LL | impl Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`: - | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)` - -error[E0119]: conflicting implementations of trait `Baz` for type `u8`: - --> $DIR/coherence-overlap-messages.rs:24:1 - | -LL | impl Baz for T {} - | --------------------- first implementation here -LL | impl Baz for u8 {} //~ ERROR conflicting implementations of trait `Baz` for type `u8`: - | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8` - -error[E0119]: conflicting implementations of trait `Quux<_, _>`: - --> $DIR/coherence-overlap-messages.rs:29:1 - | -LL | impl Quux for T {} - | ------------------------------ first implementation here -LL | impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation - -error[E0119]: conflicting implementations of trait `Quux<_, _>`: - --> $DIR/coherence-overlap-messages.rs:30:1 - | -LL | impl Quux for T {} - | ------------------------------ first implementation here -LL | impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: -LL | impl Quux for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`: - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-upstream-inherent.old.stderr b/src/test/ui/coherence/coherence-overlap-upstream-inherent.old.stderr new file mode 100644 index 00000000000..928b65e0039 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-upstream-inherent.old.stderr @@ -0,0 +1,14 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-upstream-inherent.rs:15:32 + | +LL | impl A where T: Remote { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +... +LL | impl A { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + | + = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/coherence/coherence-overlap-upstream-inherent.re.stderr b/src/test/ui/coherence/coherence-overlap-upstream-inherent.re.stderr new file mode 100644 index 00000000000..928b65e0039 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-upstream-inherent.re.stderr @@ -0,0 +1,14 @@ +error[E0592]: duplicate definitions with name `dummy` + --> $DIR/coherence-overlap-upstream-inherent.rs:15:32 + | +LL | impl A where T: Remote { fn dummy(&self) { } } + | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` +... +LL | impl A { fn dummy(&self) { } } + | ------------------- other definition for `dummy` + | + = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/coherence/coherence-overlap-upstream-inherent.rs b/src/test/ui/coherence/coherence-overlap-upstream-inherent.rs index a5a6a88a128..92b619af076 100644 --- a/src/test/ui/coherence/coherence-overlap-upstream-inherent.rs +++ b/src/test/ui/coherence/coherence-overlap-upstream-inherent.rs @@ -1,17 +1,11 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that we consider `i16: Remote` to be ambiguous, even // though the upstream crate doesn't implement it for now. // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + extern crate coherence_lib; @@ -19,7 +13,8 @@ use coherence_lib::Remote; struct A(X); impl A where T: Remote { fn dummy(&self) { } } -//~^ ERROR E0592 +//[old]~^ ERROR E0592 +//[re]~^^ ERROR E0592 impl A { fn dummy(&self) { } } fn main() {} diff --git a/src/test/ui/coherence/coherence-overlap-upstream-inherent.stderr b/src/test/ui/coherence/coherence-overlap-upstream-inherent.stderr deleted file mode 100644 index 6c6f0dc2483..00000000000 --- a/src/test/ui/coherence/coherence-overlap-upstream-inherent.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0592]: duplicate definitions with name `dummy` - --> $DIR/coherence-overlap-upstream-inherent.rs:21:32 - | -LL | impl A where T: Remote { fn dummy(&self) { } } - | ^^^^^^^^^^^^^^^^^^^ duplicate definitions for `dummy` -LL | //~^ ERROR E0592 -LL | impl A { fn dummy(&self) { } } - | ------------------- other definition for `dummy` - | - = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0592`. diff --git a/src/test/ui/coherence/coherence-overlap-upstream.old.stderr b/src/test/ui/coherence/coherence-overlap-upstream.old.stderr new file mode 100644 index 00000000000..6c3484c2d8c --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-upstream.old.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i16`: + --> $DIR/coherence-overlap-upstream.rs:16:1 + | +LL | impl Foo for T where T: Remote {} + | --------------------------------- first implementation here +LL | impl Foo for i16 {} + | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16` + | + = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-upstream.re.stderr b/src/test/ui/coherence/coherence-overlap-upstream.re.stderr new file mode 100644 index 00000000000..6c3484c2d8c --- /dev/null +++ b/src/test/ui/coherence/coherence-overlap-upstream.re.stderr @@ -0,0 +1,13 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i16`: + --> $DIR/coherence-overlap-upstream.rs:16:1 + | +LL | impl Foo for T where T: Remote {} + | --------------------------------- first implementation here +LL | impl Foo for i16 {} + | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16` + | + = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlap-upstream.rs b/src/test/ui/coherence/coherence-overlap-upstream.rs index f772848cb58..62f675003f9 100644 --- a/src/test/ui/coherence/coherence-overlap-upstream.rs +++ b/src/test/ui/coherence/coherence-overlap-upstream.rs @@ -1,17 +1,11 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that we consider `i16: Remote` to be ambiguous, even // though the upstream crate doesn't implement it for now. // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + extern crate coherence_lib; @@ -20,6 +14,7 @@ use coherence_lib::Remote; trait Foo {} impl Foo for T where T: Remote {} impl Foo for i16 {} -//~^ ERROR E0119 +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() {} diff --git a/src/test/ui/coherence/coherence-overlap-upstream.stderr b/src/test/ui/coherence/coherence-overlap-upstream.stderr deleted file mode 100644 index 794c830cc5b..00000000000 --- a/src/test/ui/coherence/coherence-overlap-upstream.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0119]: conflicting implementations of trait `Foo` for type `i16`: - --> $DIR/coherence-overlap-upstream.rs:22:1 - | -LL | impl Foo for T where T: Remote {} - | --------------------------------- first implementation here -LL | impl Foo for i16 {} - | ^^^^^^^^^^^^^^^^ conflicting implementation for `i16` - | - = note: upstream crates may add new impl of trait `coherence_lib::Remote` for type `i16` in future versions - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-overlapping-pairs.old.stderr b/src/test/ui/coherence/coherence-overlapping-pairs.old.stderr new file mode 100644 index 00000000000..b275af9668d --- /dev/null +++ b/src/test/ui/coherence/coherence-overlapping-pairs.old.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-overlapping-pairs.rs:11:1 + | +LL | impl Remote for lib::Pair { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr b/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr new file mode 100644 index 00000000000..a6fa609deb2 --- /dev/null +++ b/src/test/ui/coherence/coherence-overlapping-pairs.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-overlapping-pairs.rs:11:1 + | +LL | impl Remote for lib::Pair { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-overlapping-pairs.rs b/src/test/ui/coherence/coherence-overlapping-pairs.rs index ba9dc53e868..de31a083940 100644 --- a/src/test/ui/coherence/coherence-overlapping-pairs.rs +++ b/src/test/ui/coherence/coherence-overlapping-pairs.rs @@ -1,14 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::Remote; @@ -16,6 +9,7 @@ use lib::Remote; struct Foo; impl Remote for lib::Pair { } -//~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-overlapping-pairs.stderr b/src/test/ui/coherence/coherence-overlapping-pairs.stderr deleted file mode 100644 index 41d47888554..00000000000 --- a/src/test/ui/coherence/coherence-overlapping-pairs.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/coherence-overlapping-pairs.rs:18:1 - | -LL | impl Remote for lib::Pair { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type - | - = note: only traits defined in the current crate can be implemented for a type parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.old.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.old.stderr new file mode 100644 index 00000000000..8b25bee6e2f --- /dev/null +++ b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.old.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-pair-covered-uncovered-1.rs:15:1 + | +LL | impl Remote1>> for i32 { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr new file mode 100644 index 00000000000..e45cd78363c --- /dev/null +++ b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-pair-covered-uncovered-1.rs:15:1 + | +LL | impl Remote1>> for i32 { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.rs b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.rs index f55efef14fa..91794b7999b 100644 --- a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.rs +++ b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.rs @@ -1,17 +1,11 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the same coverage rules apply even if the local type appears in the // list of type parameters, not the self type. // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + extern crate coherence_lib as lib; use lib::{Remote1, Pair}; @@ -19,6 +13,7 @@ use lib::{Remote1, Pair}; pub struct Local(T); impl Remote1>> for i32 { } -//~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.stderr deleted file mode 100644 index 3545593fb6d..00000000000 --- a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/coherence-pair-covered-uncovered-1.rs:21:1 - | -LL | impl Remote1>> for i32 { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type - | - = note: only traits defined in the current crate can be implemented for a type parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered.old.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered.old.stderr new file mode 100644 index 00000000000..39558d8dcc0 --- /dev/null +++ b/src/test/ui/coherence/coherence-pair-covered-uncovered.old.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-pair-covered-uncovered.rs:11:1 + | +LL | impl Remote for Pair> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr new file mode 100644 index 00000000000..54d5f3058a8 --- /dev/null +++ b/src/test/ui/coherence/coherence-pair-covered-uncovered.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-pair-covered-uncovered.rs:11:1 + | +LL | impl Remote for Pair> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered.rs b/src/test/ui/coherence/coherence-pair-covered-uncovered.rs index 0642dff4b28..49a91412bec 100644 --- a/src/test/ui/coherence/coherence-pair-covered-uncovered.rs +++ b/src/test/ui/coherence/coherence-pair-covered-uncovered.rs @@ -1,14 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::{Remote, Pair}; @@ -16,6 +9,7 @@ use lib::{Remote, Pair}; struct Local(T); impl Remote for Pair> { } -//~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[old]~^ ERROR type parameter `T` must be used as the type parameter for some local type +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered.stderr deleted file mode 100644 index f58cb4648cb..00000000000 --- a/src/test/ui/coherence/coherence-pair-covered-uncovered.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/coherence-pair-covered-uncovered.rs:18:1 - | -LL | impl Remote for Pair> { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type - | - = note: only traits defined in the current crate can be implemented for a type parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-projection-conflict-orphan.old.stderr b/src/test/ui/coherence/coherence-projection-conflict-orphan.old.stderr new file mode 100644 index 00000000000..cde9360ddf2 --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-conflict-orphan.old.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i32`: + --> $DIR/coherence-projection-conflict-orphan.rs:19:1 + | +LL | impl Foo for i32 { } + | --------------------- first implementation here +LL | +LL | impl Foo for A { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + | + = note: upstream crates may add new impl of trait `std::iter::Iterator` for type `i32` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-projection-conflict-orphan.re.stderr b/src/test/ui/coherence/coherence-projection-conflict-orphan.re.stderr new file mode 100644 index 00000000000..cde9360ddf2 --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-conflict-orphan.re.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i32`: + --> $DIR/coherence-projection-conflict-orphan.rs:19:1 + | +LL | impl Foo for i32 { } + | --------------------- first implementation here +LL | +LL | impl Foo for A { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + | + = note: upstream crates may add new impl of trait `std::iter::Iterator` for type `i32` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-projection-conflict-orphan.rs b/src/test/ui/coherence/coherence-projection-conflict-orphan.rs index 784ff0cd5e0..4f7fc71536b 100644 --- a/src/test/ui/coherence/coherence-projection-conflict-orphan.rs +++ b/src/test/ui/coherence/coherence-projection-conflict-orphan.rs @@ -1,13 +1,6 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re +#![cfg_attr(re, feature(re_rebalance_coherence))] #![feature(rustc_attrs)] // Here we expect a coherence conflict because, even though `i32` does @@ -23,6 +16,8 @@ pub trait Bar { impl Foo for i32 { } -impl Foo for A { } //~ ERROR E0119 +impl Foo for A { } +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() {} diff --git a/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr b/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr deleted file mode 100644 index a0fcf072fa8..00000000000 --- a/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0119]: conflicting implementations of trait `Foo` for type `i32`: - --> $DIR/coherence-projection-conflict-orphan.rs:26:1 - | -LL | impl Foo for i32 { } - | --------------------- first implementation here -LL | -LL | impl Foo for A { } //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` - | - = note: upstream crates may add new impl of trait `std::iter::Iterator` for type `i32` in future versions - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-projection-conflict-ty-param.old.stderr b/src/test/ui/coherence/coherence-projection-conflict-ty-param.old.stderr new file mode 100644 index 00000000000..b53a4c973ed --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-conflict-ty-param.old.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Foo<_>` for type `std::option::Option<_>`: + --> $DIR/coherence-projection-conflict-ty-param.rs:14:1 + | +LL | impl > Foo

for Option {} + | ---------------------------------------- first implementation here +LL | +LL | impl Foo for Option { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::option::Option<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-projection-conflict-ty-param.re.stderr b/src/test/ui/coherence/coherence-projection-conflict-ty-param.re.stderr new file mode 100644 index 00000000000..b53a4c973ed --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-conflict-ty-param.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Foo<_>` for type `std::option::Option<_>`: + --> $DIR/coherence-projection-conflict-ty-param.rs:14:1 + | +LL | impl > Foo

for Option {} + | ---------------------------------------- first implementation here +LL | +LL | impl Foo for Option { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::option::Option<_>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-projection-conflict-ty-param.rs b/src/test/ui/coherence/coherence-projection-conflict-ty-param.rs index 120d9046389..819947fa547 100644 --- a/src/test/ui/coherence/coherence-projection-conflict-ty-param.rs +++ b/src/test/ui/coherence/coherence-projection-conflict-ty-param.rs @@ -1,22 +1,18 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Coherence error results because we do not know whether `T: Foo

` or not // for the second impl. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + use std::marker::PhantomData; pub trait Foo

{ fn foo() {} } impl > Foo

for Option {} -impl Foo for Option { } //~ ERROR E0119 +impl Foo for Option { } +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() {} diff --git a/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr b/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr deleted file mode 100644 index cfbf96bc1c8..00000000000 --- a/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `Foo<_>` for type `std::option::Option<_>`: - --> $DIR/coherence-projection-conflict-ty-param.rs:20:1 - | -LL | impl > Foo

for Option {} - | ---------------------------------------- first implementation here -LL | -LL | impl Foo for Option { } //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::option::Option<_>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-projection-conflict.old.stderr b/src/test/ui/coherence/coherence-projection-conflict.old.stderr new file mode 100644 index 00000000000..c2e5fc86175 --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-conflict.old.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i32`: + --> $DIR/coherence-projection-conflict.rs:15:1 + | +LL | impl Foo for i32 { } + | --------------------- first implementation here +LL | +LL | impl Foo for A { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-projection-conflict.re.stderr b/src/test/ui/coherence/coherence-projection-conflict.re.stderr new file mode 100644 index 00000000000..c2e5fc86175 --- /dev/null +++ b/src/test/ui/coherence/coherence-projection-conflict.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `Foo` for type `i32`: + --> $DIR/coherence-projection-conflict.rs:15:1 + | +LL | impl Foo for i32 { } + | --------------------- first implementation here +LL | +LL | impl Foo for A { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-projection-conflict.rs b/src/test/ui/coherence/coherence-projection-conflict.rs index 3c32ab38b93..4086aeef8c0 100644 --- a/src/test/ui/coherence/coherence-projection-conflict.rs +++ b/src/test/ui/coherence/coherence-projection-conflict.rs @@ -1,12 +1,6 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] use std::marker::PhantomData; @@ -18,7 +12,9 @@ pub trait Bar { impl Foo for i32 { } -impl Foo for A { } //~ ERROR E0119 +impl Foo for A { } +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 impl Bar for i32 { type Output = i32; diff --git a/src/test/ui/coherence/coherence-projection-conflict.stderr b/src/test/ui/coherence/coherence-projection-conflict.stderr deleted file mode 100644 index 3832faf28d8..00000000000 --- a/src/test/ui/coherence/coherence-projection-conflict.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `Foo` for type `i32`: - --> $DIR/coherence-projection-conflict.rs:21:1 - | -LL | impl Foo for i32 { } - | --------------------- first implementation here -LL | -LL | impl Foo for A { } //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-projection-ok-orphan.rs b/src/test/ui/coherence/coherence-projection-ok-orphan.rs index 1ce455123aa..652b438feb1 100644 --- a/src/test/ui/coherence/coherence-projection-ok-orphan.rs +++ b/src/test/ui/coherence/coherence-projection-ok-orphan.rs @@ -1,15 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] // Here we do not get a coherence conflict because `Baz: Iterator` // does not hold and (due to the orphan rules), we can rely on that. diff --git a/src/test/ui/coherence/coherence-projection-ok.rs b/src/test/ui/coherence/coherence-projection-ok.rs index dfb2ef0a2ba..f759a9e1b45 100644 --- a/src/test/ui/coherence/coherence-projection-ok.rs +++ b/src/test/ui/coherence/coherence-projection-ok.rs @@ -1,15 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] pub trait Foo

{} pub trait Bar { diff --git a/src/test/ui/coherence/coherence-subtyping.old.stderr b/src/test/ui/coherence/coherence-subtyping.old.stderr new file mode 100644 index 00000000000..db9f9f76653 --- /dev/null +++ b/src/test/ui/coherence/coherence-subtyping.old.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`: + --> $DIR/coherence-subtyping.rs:15:1 + | +LL | impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { + | --------------------------------------------------------- first implementation here +... +LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` + | + = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-subtyping.re.stderr b/src/test/ui/coherence/coherence-subtyping.re.stderr new file mode 100644 index 00000000000..db9f9f76653 --- /dev/null +++ b/src/test/ui/coherence/coherence-subtyping.re.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `TheTrait` for type `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8`: + --> $DIR/coherence-subtyping.rs:15:1 + | +LL | impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { + | --------------------------------------------------------- first implementation here +... +LL | impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a, 'b> fn(&'a u8, &'b u8) -> &'a u8` + | + = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-subtyping.rs b/src/test/ui/coherence/coherence-subtyping.rs new file mode 100644 index 00000000000..f27e14eab63 --- /dev/null +++ b/src/test/ui/coherence/coherence-subtyping.rs @@ -0,0 +1,20 @@ +// Test that two distinct impls which match subtypes of one another +// yield coherence errors (or not) depending on the variance. + +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + +trait TheTrait { + fn foo(&self) { } +} + +impl TheTrait for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { +} + +impl TheTrait for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { + //[old]~^ ERROR + //[re]~^^ ERROR +} + +fn main() { } diff --git a/src/test/ui/coherence/coherence-tuple-conflict.old.stderr b/src/test/ui/coherence/coherence-tuple-conflict.old.stderr new file mode 100644 index 00000000000..e832bdebbdd --- /dev/null +++ b/src/test/ui/coherence/coherence-tuple-conflict.old.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `(_, _)`: + --> $DIR/coherence-tuple-conflict.rs:19:1 + | +LL | impl MyTrait for (T,T) { + | ------------------------- first implementation here +... +LL | impl MyTrait for (A,B) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-tuple-conflict.re.stderr b/src/test/ui/coherence/coherence-tuple-conflict.re.stderr new file mode 100644 index 00000000000..e832bdebbdd --- /dev/null +++ b/src/test/ui/coherence/coherence-tuple-conflict.re.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `(_, _)`: + --> $DIR/coherence-tuple-conflict.rs:19:1 + | +LL | impl MyTrait for (T,T) { + | ------------------------- first implementation here +... +LL | impl MyTrait for (A,B) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-tuple-conflict.rs b/src/test/ui/coherence/coherence-tuple-conflict.rs index 7807f93df1a..130867b2242 100644 --- a/src/test/ui/coherence/coherence-tuple-conflict.rs +++ b/src/test/ui/coherence/coherence-tuple-conflict.rs @@ -1,12 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] use std::fmt::Debug; use std::default::Default; @@ -22,7 +16,9 @@ impl MyTrait for (T,T) { fn get(&self) -> usize { 0 } } -impl MyTrait for (A,B) { //~ ERROR E0119 +impl MyTrait for (A,B) { +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn get(&self) -> usize { self.dummy } } diff --git a/src/test/ui/coherence/coherence-tuple-conflict.stderr b/src/test/ui/coherence/coherence-tuple-conflict.stderr deleted file mode 100644 index 4ceafea0a70..00000000000 --- a/src/test/ui/coherence/coherence-tuple-conflict.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `(_, _)`: - --> $DIR/coherence-tuple-conflict.rs:25:1 - | -LL | impl MyTrait for (T,T) { - | ------------------------- first implementation here -... -LL | impl MyTrait for (A,B) { //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence-vec-local-2.old.stderr b/src/test/ui/coherence/coherence-vec-local-2.old.stderr new file mode 100644 index 00000000000..1c1118a58c6 --- /dev/null +++ b/src/test/ui/coherence/coherence-vec-local-2.old.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/coherence-vec-local-2.rs:14:1 + | +LL | impl Remote for Vec> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-vec-local-2.re.stderr b/src/test/ui/coherence/coherence-vec-local-2.re.stderr new file mode 100644 index 00000000000..6992aa7a0bd --- /dev/null +++ b/src/test/ui/coherence/coherence-vec-local-2.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-vec-local-2.rs:14:1 + | +LL | impl Remote for Vec> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-vec-local-2.rs b/src/test/ui/coherence/coherence-vec-local-2.rs index 196c2f4ee3c..423543964c2 100644 --- a/src/test/ui/coherence/coherence-vec-local-2.rs +++ b/src/test/ui/coherence/coherence-vec-local-2.rs @@ -1,23 +1,18 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a local, generic type appearing within a // *non-fundamental* remote type like `Vec` is not considered local. // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::Remote; struct Local(T); -impl Remote for Vec> { } //~ ERROR E0210 +impl Remote for Vec> { } +//[old]~^ ERROR E0210 +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-vec-local-2.stderr b/src/test/ui/coherence/coherence-vec-local-2.stderr deleted file mode 100644 index 2980d4a3392..00000000000 --- a/src/test/ui/coherence/coherence-vec-local-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/coherence-vec-local-2.rs:21:1 - | -LL | impl Remote for Vec> { } //~ ERROR E0210 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type - | - = note: only traits defined in the current crate can be implemented for a type parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/coherence/coherence-vec-local.old.stderr b/src/test/ui/coherence/coherence-vec-local.old.stderr new file mode 100644 index 00000000000..b35e7a8ba8b --- /dev/null +++ b/src/test/ui/coherence/coherence-vec-local.old.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-vec-local.rs:14:1 + | +LL | impl Remote for Vec { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-vec-local.re.stderr b/src/test/ui/coherence/coherence-vec-local.re.stderr new file mode 100644 index 00000000000..b35e7a8ba8b --- /dev/null +++ b/src/test/ui/coherence/coherence-vec-local.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence-vec-local.rs:14:1 + | +LL | impl Remote for Vec { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence-vec-local.rs b/src/test/ui/coherence/coherence-vec-local.rs index 49822dcfcb3..351ddd2aa67 100644 --- a/src/test/ui/coherence/coherence-vec-local.rs +++ b/src/test/ui/coherence/coherence-vec-local.rs @@ -1,23 +1,18 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a local type (with no type parameters) appearing within a // *non-fundamental* remote type like `Vec` is not considered local. // aux-build:coherence_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_lib as lib; use lib::Remote; struct Local; -impl Remote for Vec { } //~ ERROR E0117 +impl Remote for Vec { } +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence-vec-local.stderr b/src/test/ui/coherence/coherence-vec-local.stderr deleted file mode 100644 index b3c26160fe5..00000000000 --- a/src/test/ui/coherence/coherence-vec-local.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence-vec-local.rs:21:1 - | -LL | impl Remote for Vec { } //~ ERROR E0117 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.rs b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.rs index 7d41fc1fb63..a0303142622 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.rs +++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.rs @@ -1,19 +1,12 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. // aux-build:coherence_copy_like_lib.rs // compile-pass // skip-codgen +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] extern crate coherence_copy_like_lib as lib; diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs index 15acf1a99af..bd8317e2246 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs +++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs @@ -1,19 +1,12 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. // aux-build:coherence_copy_like_lib.rs // compile-pass // skip-codegen +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] extern crate coherence_copy_like_lib as lib; diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.old.stderr b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.old.stderr new file mode 100644 index 00000000000..12c7a1f977c --- /dev/null +++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.old.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyFundamentalStruct<(MyType,)>`: + --> $DIR/coherence_copy_like_err_fundamental_struct_tuple.rs:19:1 + | +LL | impl MyTrait for T { } + | ---------------------------------- first implementation here +... +LL | impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyFundamentalStruct<(MyType,)>` + | + = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyFundamentalStruct<(MyType,)>` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.re.stderr b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.re.stderr new file mode 100644 index 00000000000..12c7a1f977c --- /dev/null +++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.re.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyFundamentalStruct<(MyType,)>`: + --> $DIR/coherence_copy_like_err_fundamental_struct_tuple.rs:19:1 + | +LL | impl MyTrait for T { } + | ---------------------------------- first implementation here +... +LL | impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyFundamentalStruct<(MyType,)>` + | + = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyFundamentalStruct<(MyType,)>` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.rs b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.rs index ee6a61dca4a..2a61042c6a0 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.rs +++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.rs @@ -1,18 +1,10 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. // aux-build:coherence_copy_like_lib.rs +// revisions: old re +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_copy_like_lib as lib; @@ -24,7 +16,9 @@ trait MyTrait { fn foo() {} } impl MyTrait for T { } // Tuples are not fundamental. -impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } //~ ERROR E0119 +impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() { } diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr deleted file mode 100644 index c7c49fe1462..00000000000 --- a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyFundamentalStruct<(MyType,)>`: - --> $DIR/coherence_copy_like_err_fundamental_struct_tuple.rs:27:1 - | -LL | impl MyTrait for T { } - | ---------------------------------- first implementation here -... -LL | impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyFundamentalStruct<(MyType,)>` - | - = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyFundamentalStruct<(MyType,)>` in future versions - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence_copy_like_err_struct.old.stderr b/src/test/ui/coherence/coherence_copy_like_err_struct.old.stderr new file mode 100644 index 00000000000..1b6c62e9bf3 --- /dev/null +++ b/src/test/ui/coherence/coherence_copy_like_err_struct.old.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyStruct`: + --> $DIR/coherence_copy_like_err_struct.rs:22:1 + | +LL | impl MyTrait for T { } + | ---------------------------------- first implementation here +... +LL | impl MyTrait for lib::MyStruct { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyStruct` + | + = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyStruct` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence_copy_like_err_struct.re.stderr b/src/test/ui/coherence/coherence_copy_like_err_struct.re.stderr new file mode 100644 index 00000000000..1b6c62e9bf3 --- /dev/null +++ b/src/test/ui/coherence/coherence_copy_like_err_struct.re.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyStruct`: + --> $DIR/coherence_copy_like_err_struct.rs:22:1 + | +LL | impl MyTrait for T { } + | ---------------------------------- first implementation here +... +LL | impl MyTrait for lib::MyStruct { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyStruct` + | + = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyStruct` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence_copy_like_err_struct.rs b/src/test/ui/coherence/coherence_copy_like_err_struct.rs index 04262e65c5a..38fc2e662d7 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_struct.rs +++ b/src/test/ui/coherence/coherence_copy_like_err_struct.rs @@ -1,14 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:coherence_copy_like_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. @@ -26,6 +19,8 @@ impl MyTrait for T { } // MyStruct: !MyTrait // // which we cannot approve. -impl MyTrait for lib::MyStruct { } //~ ERROR E0119 +impl MyTrait for lib::MyStruct { } +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() { } diff --git a/src/test/ui/coherence/coherence_copy_like_err_struct.stderr b/src/test/ui/coherence/coherence_copy_like_err_struct.stderr deleted file mode 100644 index 786a3df0503..00000000000 --- a/src/test/ui/coherence/coherence_copy_like_err_struct.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyStruct`: - --> $DIR/coherence_copy_like_err_struct.rs:29:1 - | -LL | impl MyTrait for T { } - | ---------------------------------- first implementation here -... -LL | impl MyTrait for lib::MyStruct { } //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyStruct` - | - = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyStruct` in future versions - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence_copy_like_err_tuple.old.stderr b/src/test/ui/coherence/coherence_copy_like_err_tuple.old.stderr new file mode 100644 index 00000000000..11bd788c761 --- /dev/null +++ b/src/test/ui/coherence/coherence_copy_like_err_tuple.old.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `(MyType,)`: + --> $DIR/coherence_copy_like_err_tuple.rs:21:1 + | +LL | impl MyTrait for T { } + | ---------------------------------- first implementation here +... +LL | impl MyTrait for (MyType,) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(MyType,)` + | + = note: upstream crates may add new impl of trait `lib::MyCopy` for type `(MyType,)` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence_copy_like_err_tuple.re.stderr b/src/test/ui/coherence/coherence_copy_like_err_tuple.re.stderr new file mode 100644 index 00000000000..11bd788c761 --- /dev/null +++ b/src/test/ui/coherence/coherence_copy_like_err_tuple.re.stderr @@ -0,0 +1,14 @@ +error[E0119]: conflicting implementations of trait `MyTrait` for type `(MyType,)`: + --> $DIR/coherence_copy_like_err_tuple.rs:21:1 + | +LL | impl MyTrait for T { } + | ---------------------------------- first implementation here +... +LL | impl MyTrait for (MyType,) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(MyType,)` + | + = note: upstream crates may add new impl of trait `lib::MyCopy` for type `(MyType,)` in future versions + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence_copy_like_err_tuple.rs b/src/test/ui/coherence/coherence_copy_like_err_tuple.rs index 378a70864f0..7234bed1ba0 100644 --- a/src/test/ui/coherence/coherence_copy_like_err_tuple.rs +++ b/src/test/ui/coherence/coherence_copy_like_err_tuple.rs @@ -1,17 +1,10 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. // aux-build:coherence_copy_like_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] extern crate coherence_copy_like_lib as lib; @@ -25,6 +18,8 @@ impl MyTrait for T { } // (MyType,): !MyTrait // // which we cannot approve. -impl MyTrait for (MyType,) { } //~ ERROR E0119 +impl MyTrait for (MyType,) { } +//[old]~^ ERROR E0119 +//[re]~^^ ERROR E0119 fn main() { } diff --git a/src/test/ui/coherence/coherence_copy_like_err_tuple.stderr b/src/test/ui/coherence/coherence_copy_like_err_tuple.stderr deleted file mode 100644 index 3708a38443c..00000000000 --- a/src/test/ui/coherence/coherence_copy_like_err_tuple.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0119]: conflicting implementations of trait `MyTrait` for type `(MyType,)`: - --> $DIR/coherence_copy_like_err_tuple.rs:28:1 - | -LL | impl MyTrait for T { } - | ---------------------------------- first implementation here -... -LL | impl MyTrait for (MyType,) { } //~ ERROR E0119 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(MyType,)` - | - = note: upstream crates may add new impl of trait `lib::MyCopy` for type `(MyType,)` in future versions - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/coherence/coherence_inherent.old.stderr b/src/test/ui/coherence/coherence_inherent.old.stderr new file mode 100644 index 00000000000..fa564459b21 --- /dev/null +++ b/src/test/ui/coherence/coherence_inherent.old.stderr @@ -0,0 +1,13 @@ +error[E0599]: no method named `the_fn` found for type `&Lib::TheStruct` in the current scope + --> $DIR/coherence_inherent.rs:35:11 + | +LL | s.the_fn(); + | ^^^^^^ + | + = help: items from traits can only be used if the trait is in scope + = note: the following trait is implemented but not in scope, perhaps add a `use` for it: + `use Lib::TheTrait;` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/coherence/coherence_inherent.re.stderr b/src/test/ui/coherence/coherence_inherent.re.stderr new file mode 100644 index 00000000000..fa564459b21 --- /dev/null +++ b/src/test/ui/coherence/coherence_inherent.re.stderr @@ -0,0 +1,13 @@ +error[E0599]: no method named `the_fn` found for type `&Lib::TheStruct` in the current scope + --> $DIR/coherence_inherent.rs:35:11 + | +LL | s.the_fn(); + | ^^^^^^ + | + = help: items from traits can only be used if the trait is in scope + = note: the following trait is implemented but not in scope, perhaps add a `use` for it: + `use Lib::TheTrait;` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/coherence/coherence_inherent.rs b/src/test/ui/coherence/coherence_inherent.rs index 087b8c14e35..f0d3682adb8 100644 --- a/src/test/ui/coherence/coherence_inherent.rs +++ b/src/test/ui/coherence/coherence_inherent.rs @@ -1,16 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that methods that implement a trait cannot be invoked // unless the trait is imported. +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] + mod Lib { pub trait TheTrait { fn the_fn(&self); @@ -38,7 +32,9 @@ mod NoImport { use Lib::TheStruct; fn call_the_fn(s: &TheStruct) { - s.the_fn(); //~ ERROR no method named `the_fn` found + s.the_fn(); + //[old]~^ ERROR no method named `the_fn` found + //[re]~^^ ERROR E0599 } } diff --git a/src/test/ui/coherence/coherence_inherent.stderr b/src/test/ui/coherence/coherence_inherent.stderr deleted file mode 100644 index 1708979ab11..00000000000 --- a/src/test/ui/coherence/coherence_inherent.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0599]: no method named `the_fn` found for type `&Lib::TheStruct` in the current scope - --> $DIR/coherence_inherent.rs:41:11 - | -LL | s.the_fn(); //~ ERROR no method named `the_fn` found - | ^^^^^^ - | - = help: items from traits can only be used if the trait is in scope - = note: the following trait is implemented but not in scope, perhaps add a `use` for it: - `use Lib::TheTrait;` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/coherence/coherence_inherent_cc.old.stderr b/src/test/ui/coherence/coherence_inherent_cc.old.stderr new file mode 100644 index 00000000000..4d93e699031 --- /dev/null +++ b/src/test/ui/coherence/coherence_inherent_cc.old.stderr @@ -0,0 +1,13 @@ +error[E0599]: no method named `the_fn` found for type `&coherence_inherent_cc_lib::TheStruct` in the current scope + --> $DIR/coherence_inherent_cc.rs:26:11 + | +LL | s.the_fn(); + | ^^^^^^ + | + = help: items from traits can only be used if the trait is in scope + = note: the following trait is implemented but not in scope, perhaps add a `use` for it: + `use coherence_inherent_cc_lib::TheTrait;` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/coherence/coherence_inherent_cc.re.stderr b/src/test/ui/coherence/coherence_inherent_cc.re.stderr new file mode 100644 index 00000000000..4d93e699031 --- /dev/null +++ b/src/test/ui/coherence/coherence_inherent_cc.re.stderr @@ -0,0 +1,13 @@ +error[E0599]: no method named `the_fn` found for type `&coherence_inherent_cc_lib::TheStruct` in the current scope + --> $DIR/coherence_inherent_cc.rs:26:11 + | +LL | s.the_fn(); + | ^^^^^^ + | + = help: items from traits can only be used if the trait is in scope + = note: the following trait is implemented but not in scope, perhaps add a `use` for it: + `use coherence_inherent_cc_lib::TheTrait;` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/coherence/coherence_inherent_cc.rs b/src/test/ui/coherence/coherence_inherent_cc.rs index 442c4c89de4..2c980d839b9 100644 --- a/src/test/ui/coherence/coherence_inherent_cc.rs +++ b/src/test/ui/coherence/coherence_inherent_cc.rs @@ -1,14 +1,7 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:coherence_inherent_cc_lib.rs +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] // Tests that methods that implement a trait cannot be invoked // unless the trait is imported. @@ -30,7 +23,9 @@ mod NoImport { use coherence_inherent_cc_lib::TheStruct; fn call_the_fn(s: &TheStruct) { - s.the_fn(); //~ ERROR no method named `the_fn` found + s.the_fn(); + //[old]~^ ERROR no method named `the_fn` found + //[re]~^^ ERROR E0599 } } diff --git a/src/test/ui/coherence/coherence_inherent_cc.stderr b/src/test/ui/coherence/coherence_inherent_cc.stderr deleted file mode 100644 index a3c1b60d09a..00000000000 --- a/src/test/ui/coherence/coherence_inherent_cc.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0599]: no method named `the_fn` found for type `&coherence_inherent_cc_lib::TheStruct` in the current scope - --> $DIR/coherence_inherent_cc.rs:33:11 - | -LL | s.the_fn(); //~ ERROR no method named `the_fn` found - | ^^^^^^ - | - = help: items from traits can only be used if the trait is in scope - = note: the following trait is implemented but not in scope, perhaps add a `use` for it: - `use coherence_inherent_cc_lib::TheTrait;` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/coherence/coherence_local.rs b/src/test/ui/coherence/coherence_local.rs index 7124c05036c..cac45b0b9ed 100644 --- a/src/test/ui/coherence/coherence_local.rs +++ b/src/test/ui/coherence/coherence_local.rs @@ -1,19 +1,12 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. // aux-build:coherence_copy_like_lib.rs // compile-pass // skip-codegen +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] extern crate coherence_copy_like_lib as lib; diff --git a/src/test/ui/coherence/coherence_local_err_struct.old.stderr b/src/test/ui/coherence/coherence_local_err_struct.old.stderr new file mode 100644 index 00000000000..e1f651493f6 --- /dev/null +++ b/src/test/ui/coherence/coherence_local_err_struct.old.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence_local_err_struct.rs:17:1 + | +LL | impl lib::MyCopy for lib::MyStruct { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence_local_err_struct.re.stderr b/src/test/ui/coherence/coherence_local_err_struct.re.stderr new file mode 100644 index 00000000000..e1f651493f6 --- /dev/null +++ b/src/test/ui/coherence/coherence_local_err_struct.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence_local_err_struct.rs:17:1 + | +LL | impl lib::MyCopy for lib::MyStruct { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence_local_err_struct.rs b/src/test/ui/coherence/coherence_local_err_struct.rs index 72772a6efbd..d6faaf2977a 100644 --- a/src/test/ui/coherence/coherence_local_err_struct.rs +++ b/src/test/ui/coherence/coherence_local_err_struct.rs @@ -1,19 +1,10 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. // aux-build:coherence_copy_like_lib.rs +// revisions: old re - +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] extern crate coherence_copy_like_lib as lib; @@ -23,7 +14,9 @@ struct MyType { x: i32 } // These are all legal because they are all fundamental types: // MyStruct is not fundamental. -impl lib::MyCopy for lib::MyStruct { } //~ ERROR E0117 +impl lib::MyCopy for lib::MyStruct { } +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence_local_err_struct.stderr b/src/test/ui/coherence/coherence_local_err_struct.stderr deleted file mode 100644 index c35e95040de..00000000000 --- a/src/test/ui/coherence/coherence_local_err_struct.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence_local_err_struct.rs:26:1 - | -LL | impl lib::MyCopy for lib::MyStruct { } //~ ERROR E0117 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence_local_err_tuple.old.stderr b/src/test/ui/coherence/coherence_local_err_tuple.old.stderr new file mode 100644 index 00000000000..171daa54861 --- /dev/null +++ b/src/test/ui/coherence/coherence_local_err_tuple.old.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence_local_err_tuple.rs:17:1 + | +LL | impl lib::MyCopy for (MyType,) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence_local_err_tuple.re.stderr b/src/test/ui/coherence/coherence_local_err_tuple.re.stderr new file mode 100644 index 00000000000..171daa54861 --- /dev/null +++ b/src/test/ui/coherence/coherence_local_err_tuple.re.stderr @@ -0,0 +1,12 @@ +error[E0117]: only traits defined in the current crate can be implemented for arbitrary types + --> $DIR/coherence_local_err_tuple.rs:17:1 + | +LL | impl lib::MyCopy for (MyType,) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate + | + = note: the impl does not reference only types defined in this crate + = note: define and implement a trait or new type instead + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence_local_err_tuple.rs b/src/test/ui/coherence/coherence_local_err_tuple.rs index 88e98c7ce00..2685b2df8cb 100644 --- a/src/test/ui/coherence/coherence_local_err_tuple.rs +++ b/src/test/ui/coherence/coherence_local_err_tuple.rs @@ -1,19 +1,10 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. // aux-build:coherence_copy_like_lib.rs +// revisions: old re - +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] extern crate coherence_copy_like_lib as lib; @@ -23,7 +14,9 @@ struct MyType { x: i32 } // These are all legal because they are all fundamental types: // Tuples are not fundamental, so this is not a local impl. -impl lib::MyCopy for (MyType,) { } //~ ERROR E0117 +impl lib::MyCopy for (MyType,) { } +//[old]~^ ERROR E0117 +//[re]~^^ ERROR E0117 fn main() { } diff --git a/src/test/ui/coherence/coherence_local_err_tuple.stderr b/src/test/ui/coherence/coherence_local_err_tuple.stderr deleted file mode 100644 index a3f9f2d32b8..00000000000 --- a/src/test/ui/coherence/coherence_local_err_tuple.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/coherence_local_err_tuple.rs:26:1 - | -LL | impl lib::MyCopy for (MyType,) { } //~ ERROR E0117 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate - | - = note: the impl does not reference any types defined in this crate - = note: define and implement a trait or new type instead - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0117`. diff --git a/src/test/ui/coherence/coherence_local_ref.rs b/src/test/ui/coherence/coherence_local_ref.rs index de26433012d..a52510b8ea9 100644 --- a/src/test/ui/coherence/coherence_local_ref.rs +++ b/src/test/ui/coherence/coherence_local_ref.rs @@ -1,19 +1,12 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. // aux-build:coherence_copy_like_lib.rs // compile-pass // skip-codegen +// revisions: old re + +#![cfg_attr(re, feature(re_rebalance_coherence))] #![allow(dead_code)] extern crate coherence_copy_like_lib as lib; diff --git a/src/test/ui/coherence/re-rebalance-coherence.rs b/src/test/ui/coherence/re-rebalance-coherence.rs new file mode 100644 index 00000000000..33ad4e97536 --- /dev/null +++ b/src/test/ui/coherence/re-rebalance-coherence.rs @@ -0,0 +1,13 @@ +#![feature(re_rebalance_coherence)] + +// run-pass +// aux-build:re_rebalance_coherence_lib.rs + +extern crate re_rebalance_coherence_lib as lib; +use lib::*; + +struct Oracle; +impl Backend for Oracle {} +impl<'a, T:'a, Tab> QueryFragment for BatchInsert<'a, T, Tab> {} + +fn main() {} diff --git a/src/test/ui/command-line-diagnostics.nll.stderr b/src/test/ui/command-line-diagnostics.nll.stderr index 6273ba33e16..b3f8d8a643f 100644 --- a/src/test/ui/command-line-diagnostics.nll.stderr +++ b/src/test/ui/command-line-diagnostics.nll.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/command-line-diagnostics.rs:16:5 + --> $DIR/command-line-diagnostics.rs:6:5 | LL | let x = 42; | - diff --git a/src/test/ui/command-line-diagnostics.rs b/src/test/ui/command-line-diagnostics.rs index ac631c2e45e..248fb83a3ab 100644 --- a/src/test/ui/command-line-diagnostics.rs +++ b/src/test/ui/command-line-diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test checks the output format without the intermediate json representation // compile-flags: --error-format=human diff --git a/src/test/ui/command-line-diagnostics.stderr b/src/test/ui/command-line-diagnostics.stderr index 2a45edae325..6f1156e0d36 100644 --- a/src/test/ui/command-line-diagnostics.stderr +++ b/src/test/ui/command-line-diagnostics.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/command-line-diagnostics.rs:16:5 + --> $DIR/command-line-diagnostics.rs:6:5 | LL | let x = 42; | - first assignment to `x` diff --git a/src/test/ui/compare-method/proj-outlives-region.rs b/src/test/ui/compare-method/proj-outlives-region.rs index eab01e9e982..969bc566d38 100644 --- a/src/test/ui/compare-method/proj-outlives-region.rs +++ b/src/test/ui/compare-method/proj-outlives-region.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we elaborate `Type: 'region` constraints and infer various important things. trait Master<'a, T: ?Sized, U> { diff --git a/src/test/ui/compare-method/proj-outlives-region.stderr b/src/test/ui/compare-method/proj-outlives-region.stderr index 5d734a25fe8..ba0b04dca9d 100644 --- a/src/test/ui/compare-method/proj-outlives-region.stderr +++ b/src/test/ui/compare-method/proj-outlives-region.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/proj-outlives-region.rs:19:5 + --> $DIR/proj-outlives-region.rs:9:5 | LL | fn foo() where T: 'a; | --------------------- definition of `foo` from trait diff --git a/src/test/ui/compare-method/region-extra-2.rs b/src/test/ui/compare-method/region-extra-2.rs index b0cd3b8fdd2..3d57b544e16 100644 --- a/src/test/ui/compare-method/region-extra-2.rs +++ b/src/test/ui/compare-method/region-extra-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #22779. An extra where clause was // permitted on the impl that is not present on the trait. diff --git a/src/test/ui/compare-method/region-extra-2.stderr b/src/test/ui/compare-method/region-extra-2.stderr index 4e4f0d7c7bc..420d99c15ec 100644 --- a/src/test/ui/compare-method/region-extra-2.stderr +++ b/src/test/ui/compare-method/region-extra-2.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/region-extra-2.rs:19:5 + --> $DIR/region-extra-2.rs:9:5 | LL | fn renew<'b: 'a>(self) -> &'b mut [T]; | -------------------------------------- definition of `renew` from trait diff --git a/src/test/ui/compare-method/region-extra.rs b/src/test/ui/compare-method/region-extra.rs index 9befa1ba60e..1070cb84512 100644 --- a/src/test/ui/compare-method/region-extra.rs +++ b/src/test/ui/compare-method/region-extra.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that you cannot add an extra where clause in the impl relating // two regions. diff --git a/src/test/ui/compare-method/region-extra.stderr b/src/test/ui/compare-method/region-extra.stderr index a366fe74676..48ca690f425 100644 --- a/src/test/ui/compare-method/region-extra.stderr +++ b/src/test/ui/compare-method/region-extra.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/region-extra.rs:19:5 + --> $DIR/region-extra.rs:9:5 | LL | fn foo(); | --------- definition of `foo` from trait diff --git a/src/test/ui/compare-method/region-unrelated.rs b/src/test/ui/compare-method/region-unrelated.rs index 31ab6cb7fc4..9730c9dfe6c 100644 --- a/src/test/ui/compare-method/region-unrelated.rs +++ b/src/test/ui/compare-method/region-unrelated.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we elaborate `Type: 'region` constraints and infer various important things. trait Master<'a, T: ?Sized, U> { diff --git a/src/test/ui/compare-method/region-unrelated.stderr b/src/test/ui/compare-method/region-unrelated.stderr index 6448e0fb25a..fd3576ddcf1 100644 --- a/src/test/ui/compare-method/region-unrelated.stderr +++ b/src/test/ui/compare-method/region-unrelated.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/region-unrelated.rs:19:5 + --> $DIR/region-unrelated.rs:9:5 | LL | fn foo() where T: 'a; | --------------------- definition of `foo` from trait diff --git a/src/test/ui/compare-method/reordered-type-param.rs b/src/test/ui/compare-method/reordered-type-param.rs index 0b844d4521d..a858b66d760 100644 --- a/src/test/ui/compare-method/reordered-type-param.rs +++ b/src/test/ui/compare-method/reordered-type-param.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that ty params get matched correctly when comparing // an impl against a trait // diff --git a/src/test/ui/compare-method/reordered-type-param.stderr b/src/test/ui/compare-method/reordered-type-param.stderr index 1efd5f2fb25..c162c720a48 100644 --- a/src/test/ui/compare-method/reordered-type-param.stderr +++ b/src/test/ui/compare-method/reordered-type-param.stderr @@ -1,5 +1,5 @@ error[E0053]: method `b` has an incompatible type for trait - --> $DIR/reordered-type-param.rs:26:30 + --> $DIR/reordered-type-param.rs:16:30 | LL | fn b(&self, x: C) -> C; | - type in trait diff --git a/src/test/ui/compare-method/trait-bound-on-type-parameter.rs b/src/test/ui/compare-method/trait-bound-on-type-parameter.rs index 09e9fb4ca2b..5359001ea43 100644 --- a/src/test/ui/compare-method/trait-bound-on-type-parameter.rs +++ b/src/test/ui/compare-method/trait-bound-on-type-parameter.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that impl can't add extra `F: Sync` bound aren't *more* restrictive // than the trait method it's implementing. // diff --git a/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr b/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr index 4530cb18718..07f5a0a6cec 100644 --- a/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr +++ b/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/trait-bound-on-type-parameter.rs:25:5 + --> $DIR/trait-bound-on-type-parameter.rs:15:5 | LL | fn b(&self, x: C) -> C; | ---------------------------- definition of `b` from trait diff --git a/src/test/ui/compare-method/traits-misc-mismatch-1.rs b/src/test/ui/compare-method/traits-misc-mismatch-1.rs index cca282a1d19..0da4aba303c 100644 --- a/src/test/ui/compare-method/traits-misc-mismatch-1.rs +++ b/src/test/ui/compare-method/traits-misc-mismatch-1.rs @@ -1,12 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // Make sure rustc checks the type parameter bounds in implementations of traits, // see #2687 diff --git a/src/test/ui/compare-method/traits-misc-mismatch-1.stderr b/src/test/ui/compare-method/traits-misc-mismatch-1.stderr index e99ce95b371..717c0d2315e 100644 --- a/src/test/ui/compare-method/traits-misc-mismatch-1.stderr +++ b/src/test/ui/compare-method/traits-misc-mismatch-1.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:36:5 + --> $DIR/traits-misc-mismatch-1.rs:27:5 | LL | fn test_error1_fn(&self); | -------------------------------- definition of `test_error1_fn` from trait @@ -8,7 +8,7 @@ LL | fn test_error1_fn(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::cmp::Ord` error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:40:5 + --> $DIR/traits-misc-mismatch-1.rs:31:5 | LL | fn test_error2_fn(&self); | -------------------------------------- definition of `test_error2_fn` from trait @@ -17,7 +17,7 @@ LL | fn test_error2_fn(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B` error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:44:5 + --> $DIR/traits-misc-mismatch-1.rs:35:5 | LL | fn test_error3_fn(&self); | -------------------------------------- definition of `test_error3_fn` from trait @@ -26,7 +26,7 @@ LL | fn test_error3_fn(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B` error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:54:5 + --> $DIR/traits-misc-mismatch-1.rs:45:5 | LL | fn test_error5_fn(&self); | ------------------------------- definition of `test_error5_fn` from trait @@ -35,7 +35,7 @@ LL | fn test_error5_fn(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: B` error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:60:5 + --> $DIR/traits-misc-mismatch-1.rs:51:5 | LL | fn test_error7_fn(&self); | ------------------------------- definition of `test_error7_fn` from trait @@ -44,7 +44,7 @@ LL | fn test_error7_fn(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::cmp::Eq` error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:63:5 + --> $DIR/traits-misc-mismatch-1.rs:54:5 | LL | fn test_error8_fn(&self); | ------------------------------- definition of `test_error8_fn` from trait @@ -53,7 +53,7 @@ LL | fn test_error8_fn(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: C` error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-1.rs:76:5 + --> $DIR/traits-misc-mismatch-1.rs:67:5 | LL | fn method>(&self); | ---------------------------------- definition of `method` from trait diff --git a/src/test/ui/compare-method/traits-misc-mismatch-2.rs b/src/test/ui/compare-method/traits-misc-mismatch-2.rs index e82cf256df1..d7f31c1d971 100644 --- a/src/test/ui/compare-method/traits-misc-mismatch-2.rs +++ b/src/test/ui/compare-method/traits-misc-mismatch-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #5886: a complex instance of issue #2687. trait Iterator { diff --git a/src/test/ui/compare-method/traits-misc-mismatch-2.stderr b/src/test/ui/compare-method/traits-misc-mismatch-2.stderr index 1de5b1a8a1a..acf94ad32b1 100644 --- a/src/test/ui/compare-method/traits-misc-mismatch-2.stderr +++ b/src/test/ui/compare-method/traits-misc-mismatch-2.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/traits-misc-mismatch-2.rs:23:5 + --> $DIR/traits-misc-mismatch-2.rs:13:5 | LL | fn zip>(self, other: U) -> ZipIterator; | ------------------------------------------------------------------ definition of `zip` from trait diff --git a/src/test/ui/compile_error_macro.rs b/src/test/ui/compile_error_macro.rs index e9c5993098c..3f7b57cd078 100644 --- a/src/test/ui/compile_error_macro.rs +++ b/src/test/ui/compile_error_macro.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { compile_error!("a very descriptive error message"); //~ ERROR: a very descriptive error message } diff --git a/src/test/ui/compile_error_macro.stderr b/src/test/ui/compile_error_macro.stderr index 1abf5accc17..9e11db68315 100644 --- a/src/test/ui/compile_error_macro.stderr +++ b/src/test/ui/compile_error_macro.stderr @@ -1,5 +1,5 @@ error: a very descriptive error message - --> $DIR/compile_error_macro.rs:12:5 + --> $DIR/compile_error_macro.rs:2:5 | LL | compile_error!("a very descriptive error message"); //~ ERROR: a very descriptive error message | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/concat.rs b/src/test/ui/concat.rs index e29c6ac5d5e..d7ab7d62625 100644 --- a/src/test/ui/concat.rs +++ b/src/test/ui/concat.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { concat!(b'f'); //~ ERROR: cannot concatenate a byte string literal concat!(b"foo"); //~ ERROR: cannot concatenate a byte string literal diff --git a/src/test/ui/concat.stderr b/src/test/ui/concat.stderr index 0128811353f..b6024972c74 100644 --- a/src/test/ui/concat.stderr +++ b/src/test/ui/concat.stderr @@ -1,17 +1,17 @@ error: cannot concatenate a byte string literal - --> $DIR/concat.rs:12:13 + --> $DIR/concat.rs:2:13 | LL | concat!(b'f'); //~ ERROR: cannot concatenate a byte string literal | ^^^^ error: cannot concatenate a byte string literal - --> $DIR/concat.rs:13:13 + --> $DIR/concat.rs:3:13 | LL | concat!(b"foo"); //~ ERROR: cannot concatenate a byte string literal | ^^^^^^ error: expected a literal - --> $DIR/concat.rs:14:13 + --> $DIR/concat.rs:4:13 | LL | concat!(foo); //~ ERROR: expected a literal | ^^^ @@ -19,7 +19,7 @@ LL | concat!(foo); //~ ERROR: expected a literal = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()` error: expected a literal - --> $DIR/concat.rs:15:13 + --> $DIR/concat.rs:5:13 | LL | concat!(foo()); //~ ERROR: expected a literal | ^^^^^ diff --git a/src/test/ui/conditional-compilation/auxiliary/namespaced_enums.rs b/src/test/ui/conditional-compilation/auxiliary/namespaced_enums.rs index 3bf39b788db..d3548c76cf2 100644 --- a/src/test/ui/conditional-compilation/auxiliary/namespaced_enums.rs +++ b/src/test/ui/conditional-compilation/auxiliary/namespaced_enums.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum Foo { A, B(isize), diff --git a/src/test/ui/conditional-compilation/cfg-attr-cfg-2.rs b/src/test/ui/conditional-compilation/cfg-attr-cfg-2.rs index 58a62d45ea5..898c5bac850 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-cfg-2.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-cfg-2.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // error-pattern: `main` function not found // compile-flags: --cfg foo diff --git a/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs b/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs index a79c7663861..0dceba28b6e 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs @@ -1,17 +1,8 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -// compile-flags: --cfg broken - // https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044 +// compile-flags: --cfg broken + +#![crate_type = "lib"] #![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental -fn main() { } +pub struct S {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr b/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr index a730473f663..37c7a571d0f 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr @@ -1,5 +1,5 @@ error[E0658]: no_core is experimental (see issue #29639) - --> $DIR/cfg-attr-crate-2.rs:15:21 + --> $DIR/cfg-attr-crate-2.rs:6:21 | LL | #![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental | ^^^^^^^ diff --git a/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs index 09fe6cec49c..496d196c94a 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs @@ -1,12 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[cfg(foo(bar))] //~ ERROR invalid predicate `foo` +fn check() {} + fn main() {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr index 5a89f9766d1..d75a0389851 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr @@ -1,5 +1,5 @@ error[E0537]: invalid predicate `foo` - --> $DIR/cfg-attr-invalid-predicate.rs:11:7 + --> $DIR/cfg-attr-invalid-predicate.rs:1:7 | LL | #[cfg(foo(bar))] //~ ERROR invalid predicate `foo` | ^^^^^^^^ diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-false.rs b/src/test/ui/conditional-compilation/cfg-attr-multi-false.rs index ec4ee80b498..f1ab2f0f946 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-false.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-false.rs @@ -4,7 +4,6 @@ // compile-pass #![warn(unused_must_use)] -#![feature(cfg_attr_multi)] #[cfg_attr(any(), deprecated, must_use)] struct Struct {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.rs b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.rs index d4c3186a6eb..be762c56048 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.rs @@ -1,16 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// // compile-flags: --cfg broken -#![feature(cfg_attr_multi)] +#![crate_type = "lib"] #![cfg_attr(broken, no_core, no_std)] //~ ERROR no_core is experimental -fn main() { } +pub struct S {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr index bf68d92cc0b..8cdf4ec31e7 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr @@ -1,5 +1,5 @@ error[E0658]: no_core is experimental (see issue #29639) - --> $DIR/cfg-attr-multi-invalid-1.rs:14:21 + --> $DIR/cfg-attr-multi-invalid-1.rs:4:21 | LL | #![cfg_attr(broken, no_core, no_std)] //~ ERROR no_core is experimental | ^^^^^^^ diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.rs b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.rs index bee6b7d4886..8a9e99d703c 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.rs @@ -1,16 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// // compile-flags: --cfg broken -#![feature(cfg_attr_multi)] +#![crate_type = "lib"] #![cfg_attr(broken, no_std, no_core)] //~ ERROR no_core is experimental -fn main() { } +pub struct S {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr index 5c72a400e0b..b3a3b0c0f97 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr @@ -1,5 +1,5 @@ error[E0658]: no_core is experimental (see issue #29639) - --> $DIR/cfg-attr-multi-invalid-2.rs:14:29 + --> $DIR/cfg-attr-multi-invalid-2.rs:4:29 | LL | #![cfg_attr(broken, no_std, no_core)] //~ ERROR no_core is experimental | ^^^^^^^ diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-true.rs b/src/test/ui/conditional-compilation/cfg-attr-multi-true.rs index 68307a9c456..86524e8bd28 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-true.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-true.rs @@ -5,7 +5,6 @@ // compile-pass #![warn(unused_must_use)] -#![feature(cfg_attr_multi)] #[cfg_attr(all(), deprecated, must_use)] struct MustUseDeprecated {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr b/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr index 8b62587c6f8..3d14c197397 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr @@ -1,5 +1,5 @@ warning: use of deprecated item 'MustUseDeprecated' - --> $DIR/cfg-attr-multi-true.rs:13:6 + --> $DIR/cfg-attr-multi-true.rs:12:6 | LL | impl MustUseDeprecated { //~ warning: use of deprecated item | ^^^^^^^^^^^^^^^^^ @@ -7,25 +7,25 @@ LL | impl MustUseDeprecated { //~ warning: use of deprecated item = note: #[warn(deprecated)] on by default warning: use of deprecated item 'MustUseDeprecated' - --> $DIR/cfg-attr-multi-true.rs:20:5 + --> $DIR/cfg-attr-multi-true.rs:19:5 | LL | MustUseDeprecated::new(); //~ warning: use of deprecated item | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'MustUseDeprecated' - --> $DIR/cfg-attr-multi-true.rs:14:17 + --> $DIR/cfg-attr-multi-true.rs:13:17 | LL | fn new() -> MustUseDeprecated { //~ warning: use of deprecated item | ^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'MustUseDeprecated' - --> $DIR/cfg-attr-multi-true.rs:15:9 + --> $DIR/cfg-attr-multi-true.rs:14:9 | LL | MustUseDeprecated {} //~ warning: use of deprecated item | ^^^^^^^^^^^^^^^^^ warning: unused `MustUseDeprecated` that must be used - --> $DIR/cfg-attr-multi-true.rs:20:5 + --> $DIR/cfg-attr-multi-true.rs:19:5 | LL | MustUseDeprecated::new(); //~ warning: use of deprecated item | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/conditional-compilation/cfg-attr-parse.rs b/src/test/ui/conditional-compilation/cfg-attr-parse.rs index eec0e8faca8..93aef72220c 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-parse.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-parse.rs @@ -1,7 +1,5 @@ // Parse `cfg_attr` with varying numbers of attributes and trailing commas -#![feature(cfg_attr_multi)] - // Completely empty `cfg_attr` input #[cfg_attr()] //~ error: expected identifier, found `)` struct NoConfigurationPredicate; diff --git a/src/test/ui/conditional-compilation/cfg-attr-parse.stderr b/src/test/ui/conditional-compilation/cfg-attr-parse.stderr index 553406b6dd8..36c7c817cb3 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-parse.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-parse.stderr @@ -1,29 +1,29 @@ error: expected identifier, found `)` - --> $DIR/cfg-attr-parse.rs:6:12 + --> $DIR/cfg-attr-parse.rs:4:12 | LL | #[cfg_attr()] //~ error: expected identifier, found `)` | ^ expected identifier error: expected `,`, found `)` - --> $DIR/cfg-attr-parse.rs:10:17 + --> $DIR/cfg-attr-parse.rs:8:17 | LL | #[cfg_attr(all())] //~ error: expected `,`, found `)` | ^ expected `,` error: expected identifier, found `,` - --> $DIR/cfg-attr-parse.rs:18:18 + --> $DIR/cfg-attr-parse.rs:16:18 | LL | #[cfg_attr(all(),,)] //~ ERROR expected identifier | ^ expected identifier error: expected identifier, found `,` - --> $DIR/cfg-attr-parse.rs:30:28 + --> $DIR/cfg-attr-parse.rs:28:28 | LL | #[cfg_attr(all(), must_use,,)] //~ ERROR expected identifier | ^ expected identifier error: expected identifier, found `,` - --> $DIR/cfg-attr-parse.rs:42:40 + --> $DIR/cfg-attr-parse.rs:40:40 | LL | #[cfg_attr(all(), must_use, deprecated,,)] //~ ERROR expected identifier | ^ expected identifier diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs index 83e162e0871..c5aa903f949 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs @@ -27,9 +27,12 @@ struct S9; macro_rules! generate_s10 { ($expr: expr) => { - #[cfg(feature = $expr)] //~ ERROR `cfg` is not a well-formed meta-item + #[cfg(feature = $expr)] + //~^ ERROR expected unsuffixed literal or identifier, found concat!("nonexistent") struct S10; } } generate_s10!(concat!("nonexistent")); + +fn main() {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index da06a81751c..bcf13ead2f4 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -52,11 +52,11 @@ error[E0565]: literal in `cfg` predicate value must be a string LL | #[cfg(a = b"hi")] //~ ERROR literal in `cfg` predicate value must be a string | ^^^^^ help: consider removing the prefix: `"hi"` -error: `cfg` is not a well-formed meta-item - --> $DIR/cfg-attr-syntax-validation.rs:30:9 +error: expected unsuffixed literal or identifier, found concat!("nonexistent") + --> $DIR/cfg-attr-syntax-validation.rs:30:15 | -LL | #[cfg(feature = $expr)] //~ ERROR `cfg` is not a well-formed meta-item - | ^^^^^^^^^^^^^^^^^^^^^^^ help: expected syntax is: `#[cfg(/* predicate */)]` +LL | #[cfg(feature = $expr)] + | ^^^^^^^ ... LL | generate_s10!(concat!("nonexistent")); | -------------------------------------- in this macro invocation diff --git a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.rs b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.rs index afcb896b43c..1ed2ddcda44 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo { () => { #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown diff --git a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr index 0f51c7d68c6..c5097c15c3c 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr @@ -1,5 +1,5 @@ error[E0658]: The attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/cfg-attr-unknown-attribute-macro-expansion.rs:13:27 + --> $DIR/cfg-attr-unknown-attribute-macro-expansion.rs:3:27 | LL | #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown | ^^^^^^^ diff --git a/src/test/ui/conditional-compilation/cfg-empty-codemap.rs b/src/test/ui/conditional-compilation/cfg-empty-codemap.rs index 5cf8135ca6b..9e34cacf74d 100644 --- a/src/test/ui/conditional-compilation/cfg-empty-codemap.rs +++ b/src/test/ui/conditional-compilation/cfg-empty-codemap.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that empty source_maps don't ICE (#23301) // compile-flags: --cfg "" diff --git a/src/test/ui/conditional-compilation/cfg-in-crate-1.rs b/src/test/ui/conditional-compilation/cfg-in-crate-1.rs index bbccf2bcd0f..8561cd83013 100644 --- a/src/test/ui/conditional-compilation/cfg-in-crate-1.rs +++ b/src/test/ui/conditional-compilation/cfg-in-crate-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: `main` function not found #![cfg(bar)] diff --git a/src/test/ui/conditional-compilation/cfg-non-opt-expr.rs b/src/test/ui/conditional-compilation/cfg-non-opt-expr.rs index 55eca7f45a5..0ddbd8a156d 100644 --- a/src/test/ui/conditional-compilation/cfg-non-opt-expr.rs +++ b/src/test/ui/conditional-compilation/cfg-non-opt-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(stmt_expr_attributes)] #![feature(custom_test_frameworks)] diff --git a/src/test/ui/conditional-compilation/cfg-non-opt-expr.stderr b/src/test/ui/conditional-compilation/cfg-non-opt-expr.stderr index 1892cee113e..933b7dc184a 100644 --- a/src/test/ui/conditional-compilation/cfg-non-opt-expr.stderr +++ b/src/test/ui/conditional-compilation/cfg-non-opt-expr.stderr @@ -1,17 +1,17 @@ error: removing an expression is not supported in this position - --> $DIR/cfg-non-opt-expr.rs:15:13 + --> $DIR/cfg-non-opt-expr.rs:5:13 | LL | let _ = #[cfg(unset)] (); | ^^^^^^^^^^^^^ error: removing an expression is not supported in this position - --> $DIR/cfg-non-opt-expr.rs:17:21 + --> $DIR/cfg-non-opt-expr.rs:7:21 | LL | let _ = 1 + 2 + #[cfg(unset)] 3; | ^^^^^^^^^^^^^ error: removing an expression is not supported in this position - --> $DIR/cfg-non-opt-expr.rs:19:23 + --> $DIR/cfg-non-opt-expr.rs:9:23 | LL | let _ = [1, 2, 3][#[cfg(unset)] 1]; | ^^^^^^^^^^^^^ diff --git a/src/test/ui/conditional-compilation/cfg_attr_path.rs b/src/test/ui/conditional-compilation/cfg_attr_path.rs index b2805d76d8f..9e9ff6622ce 100644 --- a/src/test/ui/conditional-compilation/cfg_attr_path.rs +++ b/src/test/ui/conditional-compilation/cfg_attr_path.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(dead_code)] diff --git a/src/test/ui/conflicting-repr-hints.rs b/src/test/ui/conflicting-repr-hints.rs index 426f60c6b09..cc986b25219 100644 --- a/src/test/ui/conflicting-repr-hints.rs +++ b/src/test/ui/conflicting-repr-hints.rs @@ -1,15 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] -#![feature(repr_packed)] #[repr(C)] enum A { A } diff --git a/src/test/ui/conflicting-repr-hints.stderr b/src/test/ui/conflicting-repr-hints.stderr index 7a4e5a5488a..148f1211b08 100644 --- a/src/test/ui/conflicting-repr-hints.stderr +++ b/src/test/ui/conflicting-repr-hints.stderr @@ -1,47 +1,47 @@ warning[E0566]: conflicting representation hints - --> $DIR/conflicting-repr-hints.rs:20:8 + --> $DIR/conflicting-repr-hints.rs:9:8 | LL | #[repr(C, u64)] //~ WARNING conflicting representation hints | ^ ^^^ warning[E0566]: conflicting representation hints - --> $DIR/conflicting-repr-hints.rs:23:8 + --> $DIR/conflicting-repr-hints.rs:12:8 | LL | #[repr(u32, u64)] //~ WARNING conflicting representation hints | ^^^ ^^^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:30:1 + --> $DIR/conflicting-repr-hints.rs:19:1 | LL | struct F(i32); //~ ERROR type has conflicting packed and align representation hints | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:34:1 + --> $DIR/conflicting-repr-hints.rs:23:1 | LL | struct G(i32); //~ ERROR type has conflicting packed and align representation hints | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:38:1 + --> $DIR/conflicting-repr-hints.rs:27:1 | LL | struct H(i32); //~ ERROR type has conflicting packed and align representation hints | ^^^^^^^^^^^^^^ error[E0634]: type has conflicting packed representation hints - --> $DIR/conflicting-repr-hints.rs:41:1 + --> $DIR/conflicting-repr-hints.rs:30:1 | LL | struct I(i32); //~ ERROR type has conflicting packed representation hints | ^^^^^^^^^^^^^^ error[E0634]: type has conflicting packed representation hints - --> $DIR/conflicting-repr-hints.rs:45:1 + --> $DIR/conflicting-repr-hints.rs:34:1 | LL | struct J(i32); //~ ERROR type has conflicting packed representation hints | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:51:1 + --> $DIR/conflicting-repr-hints.rs:40:1 | LL | / union X { //~ ERROR type has conflicting packed and align representation hints LL | | i: i32 @@ -49,7 +49,7 @@ LL | | } | |_^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:57:1 + --> $DIR/conflicting-repr-hints.rs:46:1 | LL | / union Y { //~ ERROR type has conflicting packed and align representation hints LL | | i: i32 @@ -57,7 +57,7 @@ LL | | } | |_^ error[E0587]: type has conflicting packed and align representation hints - --> $DIR/conflicting-repr-hints.rs:63:1 + --> $DIR/conflicting-repr-hints.rs:52:1 | LL | / union Z { //~ ERROR type has conflicting packed and align representation hints LL | | i: i32 diff --git a/src/test/ui/confuse-field-and-method/issue-18343.rs b/src/test/ui/confuse-field-and-method/issue-18343.rs index ef1566ab56a..bc2d73fae11 100644 --- a/src/test/ui/confuse-field-and-method/issue-18343.rs +++ b/src/test/ui/confuse-field-and-method/issue-18343.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Obj where F: FnMut() -> u32 { closure: F, } diff --git a/src/test/ui/confuse-field-and-method/issue-18343.stderr b/src/test/ui/confuse-field-and-method/issue-18343.stderr index b1e3105a5f9..36112cd0e10 100644 --- a/src/test/ui/confuse-field-and-method/issue-18343.stderr +++ b/src/test/ui/confuse-field-and-method/issue-18343.stderr @@ -1,5 +1,5 @@ -error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-18343.rs:16:28: 16:33]>` in the current scope - --> $DIR/issue-18343.rs:17:7 +error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-18343.rs:6:28: 6:33]>` in the current scope + --> $DIR/issue-18343.rs:7:7 | LL | struct Obj where F: FnMut() -> u32 { | ------------------------------------- method `closure` not found for this diff --git a/src/test/ui/confuse-field-and-method/issue-2392.rs b/src/test/ui/confuse-field-and-method/issue-2392.rs index f0c5a2a913f..41287c25914 100644 --- a/src/test/ui/confuse-field-and-method/issue-2392.rs +++ b/src/test/ui/confuse-field-and-method/issue-2392.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(core, fnbox)] use std::boxed::FnBox; diff --git a/src/test/ui/confuse-field-and-method/issue-2392.stderr b/src/test/ui/confuse-field-and-method/issue-2392.stderr index 9049ffd4090..0c09bd2284b 100644 --- a/src/test/ui/confuse-field-and-method/issue-2392.stderr +++ b/src/test/ui/confuse-field-and-method/issue-2392.stderr @@ -1,5 +1,5 @@ -error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-2392.rs:49:36: 49:41]>` in the current scope - --> $DIR/issue-2392.rs:50:15 +error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue-2392.rs:39:36: 39:41]>` in the current scope + --> $DIR/issue-2392.rs:40:15 | LL | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this @@ -9,8 +9,8 @@ LL | o_closure.closure(); //~ ERROR no method named `closure` found | = help: use `(o_closure.closure)(...)` if you meant to call the function stored in the `closure` field -error[E0599]: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:49:36: 49:41]>` in the current scope - --> $DIR/issue-2392.rs:52:15 +error[E0599]: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:39:36: 39:41]>` in the current scope + --> $DIR/issue-2392.rs:42:15 | LL | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `not_closure` not found for this @@ -21,7 +21,7 @@ LL | o_closure.not_closure(); = help: did you mean to write `o_closure.not_closure` instead of `o_closure.not_closure(...)`? error[E0599]: no method named `closure` found for type `Obj u32 {func}>` in the current scope - --> $DIR/issue-2392.rs:56:12 + --> $DIR/issue-2392.rs:46:12 | LL | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this @@ -32,7 +32,7 @@ LL | o_func.closure(); //~ ERROR no method named `closure` found = help: use `(o_func.closure)(...)` if you meant to call the function stored in the `closure` field error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope - --> $DIR/issue-2392.rs:59:14 + --> $DIR/issue-2392.rs:49:14 | LL | struct BoxedObj { | --------------- method `boxed_closure` not found for this @@ -43,7 +43,7 @@ LL | boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` foun = help: use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope - --> $DIR/issue-2392.rs:62:19 + --> $DIR/issue-2392.rs:52:19 | LL | struct BoxedObj { | --------------- method `boxed_closure` not found for this @@ -54,7 +54,7 @@ LL | boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` = help: use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field error[E0599]: no method named `closure` found for type `Obj u32 {func}>` in the current scope - --> $DIR/issue-2392.rs:67:12 + --> $DIR/issue-2392.rs:57:12 | LL | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this @@ -65,7 +65,7 @@ LL | w.wrap.closure();//~ ERROR no method named `closure` found = help: use `(w.wrap.closure)(...)` if you meant to call the function stored in the `closure` field error[E0599]: no method named `not_closure` found for type `Obj u32 {func}>` in the current scope - --> $DIR/issue-2392.rs:69:12 + --> $DIR/issue-2392.rs:59:12 | LL | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `not_closure` not found for this @@ -76,7 +76,7 @@ LL | w.wrap.not_closure(); = help: did you mean to write `w.wrap.not_closure` instead of `w.wrap.not_closure(...)`? error[E0599]: no method named `closure` found for type `Obj + 'static)>>` in the current scope - --> $DIR/issue-2392.rs:72:24 + --> $DIR/issue-2392.rs:62:24 | LL | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this @@ -87,7 +87,7 @@ LL | check_expression().closure();//~ ERROR no method named `closure` found = help: use `(check_expression().closure)(...)` if you meant to call the function stored in the `closure` field error[E0599]: no method named `f1` found for type `FuncContainer` in the current scope - --> $DIR/issue-2392.rs:78:31 + --> $DIR/issue-2392.rs:68:31 | LL | struct FuncContainer { | -------------------- method `f1` not found for this @@ -98,7 +98,7 @@ LL | (*self.container).f1(1); //~ ERROR no method named `f1` found = help: use `((*self.container).f1)(...)` if you meant to call the function stored in the `f1` field error[E0599]: no method named `f2` found for type `FuncContainer` in the current scope - --> $DIR/issue-2392.rs:79:31 + --> $DIR/issue-2392.rs:69:31 | LL | struct FuncContainer { | -------------------- method `f2` not found for this @@ -109,7 +109,7 @@ LL | (*self.container).f2(1); //~ ERROR no method named `f2` found = help: use `((*self.container).f2)(...)` if you meant to call the function stored in the `f2` field error[E0599]: no method named `f3` found for type `FuncContainer` in the current scope - --> $DIR/issue-2392.rs:80:31 + --> $DIR/issue-2392.rs:70:31 | LL | struct FuncContainer { | -------------------- method `f3` not found for this diff --git a/src/test/ui/confuse-field-and-method/issue-32128.rs b/src/test/ui/confuse-field-and-method/issue-32128.rs index d306b38e00e..02c6838d419 100644 --- a/src/test/ui/confuse-field-and-method/issue-32128.rs +++ b/src/test/ui/confuse-field-and-method/issue-32128.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Example { example: Box i32> } diff --git a/src/test/ui/confuse-field-and-method/issue-32128.stderr b/src/test/ui/confuse-field-and-method/issue-32128.stderr index 95b764b43ed..902f60668f2 100644 --- a/src/test/ui/confuse-field-and-method/issue-32128.stderr +++ b/src/test/ui/confuse-field-and-method/issue-32128.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `example` found for type `Example` in the current scope - --> $DIR/issue-32128.rs:22:10 + --> $DIR/issue-32128.rs:12:10 | LL | struct Example { | -------------- method `example` not found for this diff --git a/src/test/ui/confuse-field-and-method/issue-33784.rs b/src/test/ui/confuse-field-and-method/issue-33784.rs index 4cd50be50d4..e9bb1f9fb46 100644 --- a/src/test/ui/confuse-field-and-method/issue-33784.rs +++ b/src/test/ui/confuse-field-and-method/issue-33784.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Deref; struct Obj where F: FnMut() -> u32 { diff --git a/src/test/ui/confuse-field-and-method/issue-33784.stderr b/src/test/ui/confuse-field-and-method/issue-33784.stderr index b7f13320eec..73bcf0fd9c0 100644 --- a/src/test/ui/confuse-field-and-method/issue-33784.stderr +++ b/src/test/ui/confuse-field-and-method/issue-33784.stderr @@ -1,13 +1,13 @@ -error[E0599]: no method named `closure` found for type `&Obj<[closure@$DIR/issue-33784.rs:35:43: 35:48]>` in the current scope - --> $DIR/issue-33784.rs:37:7 +error[E0599]: no method named `closure` found for type `&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:48]>` in the current scope + --> $DIR/issue-33784.rs:27:7 | LL | p.closure(); //~ ERROR no method named `closure` found | ^^^^^^^ field, not a method | = help: use `(p.closure)(...)` if you meant to call the function stored in the `closure` field -error[E0599]: no method named `fn_ptr` found for type `&&Obj<[closure@$DIR/issue-33784.rs:35:43: 35:48]>` in the current scope - --> $DIR/issue-33784.rs:39:7 +error[E0599]: no method named `fn_ptr` found for type `&&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:48]>` in the current scope + --> $DIR/issue-33784.rs:29:7 | LL | q.fn_ptr(); //~ ERROR no method named `fn_ptr` found | ^^^^^^ field, not a method @@ -15,7 +15,7 @@ LL | q.fn_ptr(); //~ ERROR no method named `fn_ptr` found = help: use `(q.fn_ptr)(...)` if you meant to call the function stored in the `fn_ptr` field error[E0599]: no method named `c_fn_ptr` found for type `&D` in the current scope - --> $DIR/issue-33784.rs:42:7 + --> $DIR/issue-33784.rs:32:7 | LL | s.c_fn_ptr(); //~ ERROR no method named `c_fn_ptr` found | ^^^^^^^^ field, not a method diff --git a/src/test/ui/confuse-field-and-method/private-field.rs b/src/test/ui/confuse-field-and-method/private-field.rs index 4cf939bbed6..28b8935ac0d 100644 --- a/src/test/ui/confuse-field-and-method/private-field.rs +++ b/src/test/ui/confuse-field-and-method/private-field.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod animal { pub struct Dog { pub age: usize, diff --git a/src/test/ui/confuse-field-and-method/private-field.stderr b/src/test/ui/confuse-field-and-method/private-field.stderr index 145df8b156b..e3058ad0a9e 100644 --- a/src/test/ui/confuse-field-and-method/private-field.stderr +++ b/src/test/ui/confuse-field-and-method/private-field.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `dog_age` found for type `animal::Dog` in the current scope - --> $DIR/private-field.rs:26:23 + --> $DIR/private-field.rs:16:23 | LL | pub struct Dog { | -------------- method `dog_age` not found for this diff --git a/src/test/ui/conservative_impl_trait.rs b/src/test/ui/conservative_impl_trait.rs index 8554b346beb..b7f795eadb7 100644 --- a/src/test/ui/conservative_impl_trait.rs +++ b/src/test/ui/conservative_impl_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // #39872, #39553 fn will_ice(something: &u32) -> impl Iterator { diff --git a/src/test/ui/conservative_impl_trait.stderr b/src/test/ui/conservative_impl_trait.stderr index cfa4618566e..58223d9d3bf 100644 --- a/src/test/ui/conservative_impl_trait.stderr +++ b/src/test/ui/conservative_impl_trait.stderr @@ -1,5 +1,5 @@ error[E0277]: `()` is not an iterator - --> $DIR/conservative_impl_trait.rs:13:33 + --> $DIR/conservative_impl_trait.rs:3:33 | LL | fn will_ice(something: &u32) -> impl Iterator { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator diff --git a/src/test/ui/constructor-lifetime-args.rs b/src/test/ui/constructor-lifetime-args.rs index 1fe50cfebba..6af5f6d56e7 100644 --- a/src/test/ui/constructor-lifetime-args.rs +++ b/src/test/ui/constructor-lifetime-args.rs @@ -1,15 +1,5 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // All lifetime parameters in struct constructors are currently considered early bound, -// i.e. `S::` is interpreted kinda like an associated item `S::::ctor`. +// i.e., `S::` is interpreted kinda like an associated item `S::::ctor`. // This behavior is a bit weird, because if equivalent constructor were written manually // it would get late bound lifetime parameters. // Variant constructors behave in the same way, lifetime parameters are considered diff --git a/src/test/ui/constructor-lifetime-args.stderr b/src/test/ui/constructor-lifetime-args.stderr index d1d801499d3..ec8ed9288cc 100644 --- a/src/test/ui/constructor-lifetime-args.stderr +++ b/src/test/ui/constructor-lifetime-args.stderr @@ -1,23 +1,23 @@ error[E0107]: wrong number of lifetime arguments: expected 2, found 1 - --> $DIR/constructor-lifetime-args.rs:27:5 + --> $DIR/constructor-lifetime-args.rs:17:5 | LL | S::<'static>(&0, &0); | ^^^^^^^^^^^^ expected 2 lifetime arguments error[E0107]: wrong number of lifetime arguments: expected 2, found 3 - --> $DIR/constructor-lifetime-args.rs:29:27 + --> $DIR/constructor-lifetime-args.rs:19:27 | LL | S::<'static, 'static, 'static>(&0, &0); | ^^^^^^^ unexpected lifetime argument error[E0107]: wrong number of lifetime arguments: expected 2, found 1 - --> $DIR/constructor-lifetime-args.rs:32:5 + --> $DIR/constructor-lifetime-args.rs:22:5 | LL | E::V::<'static>(&0); | ^^^^^^^^^^^^^^^ expected 2 lifetime arguments error[E0107]: wrong number of lifetime arguments: expected 2, found 3 - --> $DIR/constructor-lifetime-args.rs:34:30 + --> $DIR/constructor-lifetime-args.rs:24:30 | LL | E::V::<'static, 'static, 'static>(&0); | ^^^^^^^ unexpected lifetime argument diff --git a/src/test/ui/consts/auxiliary/const_fn_lib.rs b/src/test/ui/consts/auxiliary/const_fn_lib.rs index 5063c8d1d1f..85714efdbe9 100644 --- a/src/test/ui/consts/auxiliary/const_fn_lib.rs +++ b/src/test/ui/consts/auxiliary/const_fn_lib.rs @@ -1,15 +1,23 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Crate that exports a const fn. Used for testing cross-crate. +#![feature(const_fn)] #![crate_type="rlib"] -pub const fn foo() -> usize { 22 } //~ ERROR const fn is unstable +pub const fn foo() -> usize { 22 } + +pub const fn bar() -> fn() { + fn x() {} + x +} + +#[inline] +pub const fn bar_inlined() -> fn() { + fn x() {} + x +} + +#[inline(always)] +pub const fn bar_inlined_always() -> fn() { + fn x() {} + x +} diff --git a/src/test/ui/consts/auxiliary/promotable_const_fn_lib.rs b/src/test/ui/consts/auxiliary/promotable_const_fn_lib.rs index f6bbcc60e4e..e54cbb09804 100644 --- a/src/test/ui/consts/auxiliary/promotable_const_fn_lib.rs +++ b/src/test/ui/consts/auxiliary/promotable_const_fn_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Crate that exports a const fn. Used for testing cross-crate. #![feature(staged_api, rustc_attrs)] diff --git a/src/test/ui/consts/const-array-oob-arith.rs b/src/test/ui/consts/const-array-oob-arith.rs index 9c07abdc36d..2f9b30b51d1 100644 --- a/src/test/ui/consts/const-array-oob-arith.rs +++ b/src/test/ui/consts/const-array-oob-arith.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_indexing)] const ARR: [i32; 6] = [42, 43, 44, 45, 46, 47]; diff --git a/src/test/ui/consts/const-array-oob-arith.stderr b/src/test/ui/consts/const-array-oob-arith.stderr index 5b5f9425e73..edd3095b0fc 100644 --- a/src/test/ui/consts/const-array-oob-arith.stderr +++ b/src/test/ui/consts/const-array-oob-arith.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/const-array-oob-arith.rs:17:45 + --> $DIR/const-array-oob-arith.rs:7:45 | LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; //~ ERROR: mismatched types | ^^^ expected an array with a fixed size of 2 elements, found one with 1 elements @@ -8,7 +8,7 @@ LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; //~ ERROR: mismatched type found type `[i32; 1]` error[E0308]: mismatched types - --> $DIR/const-array-oob-arith.rs:18:44 + --> $DIR/const-array-oob-arith.rs:8:44 | LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99]; //~ ERROR: mismatched types | ^^^^^^^ expected an array with a fixed size of 1 elements, found one with 2 elements diff --git a/src/test/ui/consts/const-array-oob.rs b/src/test/ui/consts/const-array-oob.rs index 227364cffd1..39ef45175f9 100644 --- a/src/test/ui/consts/const-array-oob.rs +++ b/src/test/ui/consts/const-array-oob.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![feature(const_indexing)] diff --git a/src/test/ui/consts/const-array-oob.stderr b/src/test/ui/consts/const-array-oob.stderr index 5986376938b..2d9a4fd0dea 100644 --- a/src/test/ui/consts/const-array-oob.stderr +++ b/src/test/ui/consts/const-array-oob.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const-array-oob.rs:18:19 + --> $DIR/const-array-oob.rs:8:19 | LL | const BLUB: [u32; FOO[4]] = [5, 6]; | ^^^^^^ index out of bounds: the len is 3 but the index is 4 diff --git a/src/test/ui/consts/const-block-non-item-statement-2.rs b/src/test/ui/consts/const-block-non-item-statement-2.rs deleted file mode 100644 index f80d55cb342..00000000000 --- a/src/test/ui/consts/const-block-non-item-statement-2.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -const A: usize = { 1; 2 }; -//~^ ERROR statements in constants are unstable - -const B: usize = { { } 2 }; -//~^ ERROR statements in constants are unstable - -macro_rules! foo { - () => (()) //~ ERROR statements in constants are unstable -} -const C: usize = { foo!(); 2 }; - -const D: usize = { let x = 4; 2 }; -//~^ ERROR let bindings in constants are unstable -//~| ERROR statements in constants are unstable -//~| ERROR let bindings in constants are unstable -//~| ERROR statements in constants are unstable - -pub fn main() {} diff --git a/src/test/ui/consts/const-block-non-item-statement-2.stderr b/src/test/ui/consts/const-block-non-item-statement-2.stderr deleted file mode 100644 index 580f7e039d1..00000000000 --- a/src/test/ui/consts/const-block-non-item-statement-2.stderr +++ /dev/null @@ -1,62 +0,0 @@ -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement-2.rs:11:20 - | -LL | const A: usize = { 1; 2 }; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement-2.rs:14:20 - | -LL | const B: usize = { { } 2 }; - | ^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement-2.rs:18:12 - | -LL | () => (()) //~ ERROR statements in constants are unstable - | ^^ -LL | } -LL | const C: usize = { foo!(); 2 }; - | ------- in this macro invocation - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement-2.rs:22:28 - | -LL | const D: usize = { let x = 4; 2 }; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement-2.rs:22:28 - | -LL | const D: usize = { let x = 4; 2 }; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement-2.rs:22:1 - | -LL | const D: usize = { let x = 4; 2 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement-2.rs:22:1 - | -LL | const D: usize = { let x = 4; 2 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error: aborting due to 7 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/const-block-non-item-statement-3.rs b/src/test/ui/consts/const-block-non-item-statement-3.rs deleted file mode 100644 index cfa4b778dde..00000000000 --- a/src/test/ui/consts/const-block-non-item-statement-3.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -type Array = [u32; { let x = 2; 5 }]; -//~^ ERROR let bindings in constants are unstable -//~| ERROR statements in constants are unstable -//~| ERROR let bindings in constants are unstable -//~| ERROR statements in constants are unstable - -pub fn main() {} diff --git a/src/test/ui/consts/const-block-non-item-statement-3.stderr b/src/test/ui/consts/const-block-non-item-statement-3.stderr deleted file mode 100644 index 0124288d43d..00000000000 --- a/src/test/ui/consts/const-block-non-item-statement-3.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0658]: let bindings in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement-3.rs:11:31 - | -LL | type Array = [u32; { let x = 2; 5 }]; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement-3.rs:11:31 - | -LL | type Array = [u32; { let x = 2; 5 }]; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement-3.rs:11:20 - | -LL | type Array = [u32; { let x = 2; 5 }]; - | ^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement-3.rs:11:20 - | -LL | type Array = [u32; { let x = 2; 5 }]; - | ^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/const-block-non-item-statement.rs b/src/test/ui/consts/const-block-non-item-statement.rs index f974a24c26f..5ecf9a04984 100644 --- a/src/test/ui/consts/const-block-non-item-statement.rs +++ b/src/test/ui/consts/const-block-non-item-statement.rs @@ -1,19 +1,23 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// compile-pass enum Foo { Bar = { let x = 1; 3 } - //~^ ERROR let bindings in constants are unstable - //~| ERROR statements in constants are unstable - //~| ERROR let bindings in constants are unstable - //~| ERROR statements in constants are unstable } + +const A: usize = { 1; 2 }; + +const B: usize = { { } 2 }; + +macro_rules! foo { + () => (()) +} + +const C: usize = { foo!(); 2 }; + +const D: usize = { let x = 4; 2 }; + +type Array = [u32; { let x = 2; 5 }]; +type Array2 = [u32; { let mut x = 2; x = 3; x}]; + pub fn main() {} diff --git a/src/test/ui/consts/const-block-non-item-statement.stderr b/src/test/ui/consts/const-block-non-item-statement.stderr deleted file mode 100644 index b367a9d9937..00000000000 --- a/src/test/ui/consts/const-block-non-item-statement.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0658]: let bindings in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement.rs:12:21 - | -LL | Bar = { let x = 1; 3 } - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement.rs:12:21 - | -LL | Bar = { let x = 1; 3 } - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement.rs:12:11 - | -LL | Bar = { let x = 1; 3 } - | ^^^^^^^^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/const-block-non-item-statement.rs:12:11 - | -LL | Bar = { let x = 1; 3 } - | ^^^^^^^^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/const-call.rs b/src/test/ui/consts/const-call.rs index bd407192cd7..3d5b64ed4c2 100644 --- a/src/test/ui/consts/const-call.rs +++ b/src/test/ui/consts/const-call.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f(x: usize) -> usize { x } diff --git a/src/test/ui/consts/const-call.stderr b/src/test/ui/consts/const-call.stderr index 219fcec51b3..12a6983ba1f 100644 --- a/src/test/ui/consts/const-call.stderr +++ b/src/test/ui/consts/const-call.stderr @@ -1,11 +1,11 @@ error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants - --> $DIR/const-call.rs:16:17 + --> $DIR/const-call.rs:6:17 | LL | let _ = [0; f(2)]; | ^^^^ error[E0080]: evaluation of constant value failed - --> $DIR/const-call.rs:16:17 + --> $DIR/const-call.rs:6:17 | LL | let _ = [0; f(2)]; | ^^^^ calling non-const function `f` diff --git a/src/test/ui/consts/const-cast-different-types.rs b/src/test/ui/consts/const-cast-different-types.rs index 397804566b4..3bd5ed8f8c9 100644 --- a/src/test/ui/consts/const-cast-different-types.rs +++ b/src/test/ui/consts/const-cast-different-types.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static a: &'static str = "foo"; static b: *const u8 = a as *const u8; //~ ERROR casting static c: *const u8 = &a as *const u8; //~ ERROR casting diff --git a/src/test/ui/consts/const-cast-different-types.stderr b/src/test/ui/consts/const-cast-different-types.stderr index bc4d1358697..ced9b9fb3c7 100644 --- a/src/test/ui/consts/const-cast-different-types.stderr +++ b/src/test/ui/consts/const-cast-different-types.stderr @@ -1,11 +1,11 @@ error[E0606]: casting `&'static str` as `*const u8` is invalid - --> $DIR/const-cast-different-types.rs:12:23 + --> $DIR/const-cast-different-types.rs:2:23 | LL | static b: *const u8 = a as *const u8; //~ ERROR casting | ^^^^^^^^^^^^^^ error[E0606]: casting `&&'static str` as `*const u8` is invalid - --> $DIR/const-cast-different-types.rs:13:23 + --> $DIR/const-cast-different-types.rs:3:23 | LL | static c: *const u8 = &a as *const u8; //~ ERROR casting | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-cast-wrong-type.rs b/src/test/ui/consts/const-cast-wrong-type.rs index b3597441834..c250cc53dbc 100644 --- a/src/test/ui/consts/const-cast-wrong-type.rs +++ b/src/test/ui/consts/const-cast-wrong-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static a: [u8; 3] = ['h' as u8, 'i' as u8, 0 as u8]; static b: *const i8 = &a as *const i8; //~ ERROR mismatched types diff --git a/src/test/ui/consts/const-cast-wrong-type.stderr b/src/test/ui/consts/const-cast-wrong-type.stderr index d7ac89cc6a0..7684822d939 100644 --- a/src/test/ui/consts/const-cast-wrong-type.stderr +++ b/src/test/ui/consts/const-cast-wrong-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/const-cast-wrong-type.rs:12:23 + --> $DIR/const-cast-wrong-type.rs:2:23 | LL | static b: *const i8 = &a as *const i8; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^ expected u8, found i8 diff --git a/src/test/ui/consts/const-deref-ptr.rs b/src/test/ui/consts/const-deref-ptr.rs index 3d0477feb20..b5f603bb47a 100644 --- a/src/test/ui/consts/const-deref-ptr.rs +++ b/src/test/ui/consts/const-deref-ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that you can't dereference raw pointers in constants. fn main() { diff --git a/src/test/ui/consts/const-deref-ptr.stderr b/src/test/ui/consts/const-deref-ptr.stderr index 94a383bcf16..8de0f6c1514 100644 --- a/src/test/ui/consts/const-deref-ptr.stderr +++ b/src/test/ui/consts/const-deref-ptr.stderr @@ -1,5 +1,5 @@ error[E0658]: dereferencing raw pointers in statics is unstable (see issue #51911) - --> $DIR/const-deref-ptr.rs:14:29 + --> $DIR/const-deref-ptr.rs:4:29 | LL | static C: u64 = unsafe {*(0xdeadbeef as *const u64)}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-err-early.rs b/src/test/ui/consts/const-err-early.rs index 39b1b342eac..bae2cd286e1 100644 --- a/src/test/ui/consts/const-err-early.rs +++ b/src/test/ui/consts/const-err-early.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(const_err)] pub const A: i8 = -std::i8::MIN; //~ ERROR const_err diff --git a/src/test/ui/consts/const-err-early.stderr b/src/test/ui/consts/const-err-early.stderr index 1dd6c096e37..a64f0e25949 100644 --- a/src/test/ui/consts/const-err-early.stderr +++ b/src/test/ui/consts/const-err-early.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/const-err-early.rs:13:1 + --> $DIR/const-err-early.rs:3:1 | LL | pub const A: i8 = -std::i8::MIN; //~ ERROR const_err | ^^^^^^^^^^^^^^^^^^-------------^ @@ -7,13 +7,13 @@ LL | pub const A: i8 = -std::i8::MIN; //~ ERROR const_err | attempt to negate with overflow | note: lint level defined here - --> $DIR/const-err-early.rs:11:9 + --> $DIR/const-err-early.rs:1:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: any use of this value will cause an error - --> $DIR/const-err-early.rs:14:1 + --> $DIR/const-err-early.rs:4:1 | LL | pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err | ^^^^^^^^^^^^^^^^^^-------------^ @@ -21,7 +21,7 @@ LL | pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err | attempt to add with overflow error: any use of this value will cause an error - --> $DIR/const-err-early.rs:15:1 + --> $DIR/const-err-early.rs:5:1 | LL | pub const C: u8 = 200u8 * 4; //~ ERROR const_err | ^^^^^^^^^^^^^^^^^^---------^ @@ -29,7 +29,7 @@ LL | pub const C: u8 = 200u8 * 4; //~ ERROR const_err | attempt to multiply with overflow error: any use of this value will cause an error - --> $DIR/const-err-early.rs:16:1 + --> $DIR/const-err-early.rs:6:1 | LL | pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err | ^^^^^^^^^^^^^^^^^^-----------------^ @@ -37,7 +37,7 @@ LL | pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err | attempt to subtract with overflow error: any use of this value will cause an error - --> $DIR/const-err-early.rs:17:1 + --> $DIR/const-err-early.rs:7:1 | LL | pub const E: u8 = [5u8][1]; //~ ERROR const_err | ^^^^^^^^^^^^^^^^^^--------^ diff --git a/src/test/ui/consts/const-err-multi.rs b/src/test/ui/consts/const-err-multi.rs index 5cf3114c64a..fa3ad832c60 100644 --- a/src/test/ui/consts/const-err-multi.rs +++ b/src/test/ui/consts/const-err-multi.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(const_err)] pub const A: i8 = -std::i8::MIN; diff --git a/src/test/ui/consts/const-err-multi.stderr b/src/test/ui/consts/const-err-multi.stderr index e77a31a9f5f..af62665c056 100644 --- a/src/test/ui/consts/const-err-multi.stderr +++ b/src/test/ui/consts/const-err-multi.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/const-err-multi.rs:13:1 + --> $DIR/const-err-multi.rs:3:1 | LL | pub const A: i8 = -std::i8::MIN; | ^^^^^^^^^^^^^^^^^^-------------^ @@ -7,13 +7,13 @@ LL | pub const A: i8 = -std::i8::MIN; | attempt to negate with overflow | note: lint level defined here - --> $DIR/const-err-multi.rs:11:9 + --> $DIR/const-err-multi.rs:1:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: any use of this value will cause an error - --> $DIR/const-err-multi.rs:15:1 + --> $DIR/const-err-multi.rs:5:1 | LL | pub const B: i8 = A; | ^^^^^^^^^^^^^^^^^^-^ @@ -21,7 +21,7 @@ LL | pub const B: i8 = A; | referenced constant has errors error: any use of this value will cause an error - --> $DIR/const-err-multi.rs:17:1 + --> $DIR/const-err-multi.rs:7:1 | LL | pub const C: u8 = A as u8; | ^^^^^^^^^^^^^^^^^^-------^ @@ -29,7 +29,7 @@ LL | pub const C: u8 = A as u8; | referenced constant has errors error: any use of this value will cause an error - --> $DIR/const-err-multi.rs:19:1 + --> $DIR/const-err-multi.rs:9:1 | LL | pub const D: i8 = 50 - A; | ^^^^^^^^^^^^^^^^^^------^ diff --git a/src/test/ui/consts/const-err.rs b/src/test/ui/consts/const-err.rs index fff50c86646..8cc3dc7f587 100644 --- a/src/test/ui/consts/const-err.rs +++ b/src/test/ui/consts/const-err.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Zforce-overflow-checks=on #![allow(exceeding_bitshifts)] diff --git a/src/test/ui/consts/const-err.stderr b/src/test/ui/consts/const-err.stderr index e2ef7c3d0d4..082494b43c2 100644 --- a/src/test/ui/consts/const-err.stderr +++ b/src/test/ui/consts/const-err.stderr @@ -1,5 +1,5 @@ warning: any use of this value will cause an error - --> $DIR/const-err.rs:20:1 + --> $DIR/const-err.rs:10:1 | LL | const FOO: u8 = [5u8][1]; | ^^^^^^^^^^^^^^^^--------^ @@ -7,13 +7,13 @@ LL | const FOO: u8 = [5u8][1]; | index out of bounds: the len is 1 but the index is 1 | note: lint level defined here - --> $DIR/const-err.rs:14:9 + --> $DIR/const-err.rs:4:9 | LL | #![warn(const_err)] | ^^^^^^^^^ error[E0080]: erroneous constant used - --> $DIR/const-err.rs:24:15 + --> $DIR/const-err.rs:14:15 | LL | black_box((FOO, FOO)); | ^^^^^^^^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-err2.rs b/src/test/ui/consts/const-err2.rs index 9a5cb5a4a83..a5f685a159b 100644 --- a/src/test/ui/consts/const-err2.rs +++ b/src/test/ui/consts/const-err2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // needed because negating int::MIN will behave differently between // optimized compilation and unoptimized compilation and thus would // lead to different lints being emitted diff --git a/src/test/ui/consts/const-err2.stderr b/src/test/ui/consts/const-err2.stderr index 7201ecbc55d..659c3afc618 100644 --- a/src/test/ui/consts/const-err2.stderr +++ b/src/test/ui/consts/const-err2.stderr @@ -1,35 +1,35 @@ error: this expression will panic at runtime - --> $DIR/const-err2.rs:25:13 + --> $DIR/const-err2.rs:15:13 | LL | let a = -std::i8::MIN; | ^^^^^^^^^^^^^ attempt to negate with overflow | note: lint level defined here - --> $DIR/const-err2.rs:18:9 + --> $DIR/const-err2.rs:8:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/const-err2.rs:27:13 + --> $DIR/const-err2.rs:17:13 | LL | let b = 200u8 + 200u8 + 200u8; | ^^^^^^^^^^^^^ attempt to add with overflow error: this expression will panic at runtime - --> $DIR/const-err2.rs:29:13 + --> $DIR/const-err2.rs:19:13 | LL | let c = 200u8 * 4; | ^^^^^^^^^ attempt to multiply with overflow error: this expression will panic at runtime - --> $DIR/const-err2.rs:31:13 + --> $DIR/const-err2.rs:21:13 | LL | let d = 42u8 - (42u8 + 1); | ^^^^^^^^^^^^^^^^^ attempt to subtract with overflow error: index out of bounds: the len is 1 but the index is 1 - --> $DIR/const-err2.rs:33:14 + --> $DIR/const-err2.rs:23:14 | LL | let _e = [5u8][1]; | ^^^^^^^^ diff --git a/src/test/ui/consts/const-err4.rs b/src/test/ui/consts/const-err4.rs index 129177e9a1a..70d9bc149d8 100644 --- a/src/test/ui/consts/const-err4.rs +++ b/src/test/ui/consts/const-err4.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Copy, Clone)] union Foo { a: isize, diff --git a/src/test/ui/consts/const-err4.stderr b/src/test/ui/consts/const-err4.stderr index 38a8f75a5c2..1feec3c21c0 100644 --- a/src/test/ui/consts/const-err4.stderr +++ b/src/test/ui/consts/const-err4.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/const-err4.rs:18:11 + --> $DIR/const-err4.rs:8:11 | LL | Boo = [unsafe { Foo { b: () }.a }; 4][3], | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes diff --git a/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.rs b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.rs new file mode 100644 index 00000000000..4d3c714481a --- /dev/null +++ b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.rs @@ -0,0 +1,19 @@ +// New test for #53818: modifying static memory at compile-time is not allowed. +// The test should never compile successfully + +#![feature(const_raw_ptr_deref)] + +use std::cell::UnsafeCell; + +struct Foo(UnsafeCell); + +unsafe impl Send for Foo {} +unsafe impl Sync for Foo {} + +static FOO: Foo = Foo(UnsafeCell::new(42)); + +static BAR: () = unsafe { + *FOO.0.get() = 5; //~ ERROR contains unimplemented expression type +}; + +fn main() {} diff --git a/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr new file mode 100644 index 00000000000..be1be6c0600 --- /dev/null +++ b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr @@ -0,0 +1,9 @@ +error[E0019]: static contains unimplemented expression type + --> $DIR/assign-to-static-within-other-static-2.rs:16:5 + | +LL | *FOO.0.get() = 5; //~ ERROR contains unimplemented expression type + | ^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0019`. diff --git a/src/test/ui/consts/const-eval/assign-to-static-within-other-static.rs b/src/test/ui/consts/const-eval/assign-to-static-within-other-static.rs new file mode 100644 index 00000000000..b4c416b1c55 --- /dev/null +++ b/src/test/ui/consts/const-eval/assign-to-static-within-other-static.rs @@ -0,0 +1,13 @@ +// New test for #53818: modifying static memory at compile-time is not allowed. +// The test should never compile successfully + +#![feature(const_raw_ptr_deref)] + +use std::cell::UnsafeCell; + +static mut FOO: u32 = 42; +static BOO: () = unsafe { + FOO = 5; //~ ERROR cannot mutate statics in the initializer of another static +}; + +fn main() {} diff --git a/src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr b/src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr new file mode 100644 index 00000000000..31e49dc10ca --- /dev/null +++ b/src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr @@ -0,0 +1,8 @@ +error: cannot mutate statics in the initializer of another static + --> $DIR/assign-to-static-within-other-static.rs:10:5 + | +LL | FOO = 5; //~ ERROR cannot mutate statics in the initializer of another static + | ^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/consts/const-eval/auxiliary/stability.rs b/src/test/ui/consts/const-eval/auxiliary/stability.rs index 18c6b52fa7c..5551d35bcc8 100644 --- a/src/test/ui/consts/const-eval/auxiliary/stability.rs +++ b/src/test/ui/consts/const-eval/auxiliary/stability.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Crate that exports a const fn. Used for testing cross-crate. #![crate_type="rlib"] diff --git a/src/test/ui/consts/const-eval/conditional_array_execution.rs b/src/test/ui/consts/const-eval/conditional_array_execution.rs index 4e245c6b9e8..12e51c24605 100644 --- a/src/test/ui/consts/const-eval/conditional_array_execution.rs +++ b/src/test/ui/consts/const-eval/conditional_array_execution.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![warn(const_err)] const X: u32 = 5; diff --git a/src/test/ui/consts/const-eval/conditional_array_execution.stderr b/src/test/ui/consts/const-eval/conditional_array_execution.stderr index 90131080ed1..7722c7423fc 100644 --- a/src/test/ui/consts/const-eval/conditional_array_execution.stderr +++ b/src/test/ui/consts/const-eval/conditional_array_execution.stderr @@ -1,5 +1,5 @@ warning: any use of this value will cause an error - --> $DIR/conditional_array_execution.rs:15:1 + --> $DIR/conditional_array_execution.rs:5:1 | LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; | ^^^^^^^^^^^^^^^^^^-----^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,13 +7,13 @@ LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; | attempt to subtract with overflow | note: lint level defined here - --> $DIR/conditional_array_execution.rs:11:9 + --> $DIR/conditional_array_execution.rs:1:9 | LL | #![warn(const_err)] | ^^^^^^^^^ error[E0080]: evaluation of constant expression failed - --> $DIR/conditional_array_execution.rs:19:20 + --> $DIR/conditional_array_execution.rs:9:20 | LL | println!("{}", FOO); | ^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-2.rs b/src/test/ui/consts/const-eval/const-eval-overflow-2.rs index ce3d54ee46d..9369702f172 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-2.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Evaluation of constants in refutable patterns goes through // different compiler control-flow paths. diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr index 70c98977301..13f00c47f6c 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr @@ -1,5 +1,5 @@ error: could not evaluate constant pattern - --> $DIR/const-eval-overflow-2.rs:25:9 + --> $DIR/const-eval-overflow-2.rs:15:9 | LL | NEG_NEG_128 => println!("A"), | ^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3.rs b/src/test/ui/consts/const-eval/const-eval-overflow-3.rs index d930cb77047..95deb04fb01 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-3.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Evaluation of constants in array-elem count goes through different // compiler control-flow paths. // diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr index bcef9eff2f8..2c5b4607aa4 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const-eval-overflow-3.rs:30:11 + --> $DIR/const-eval-overflow-3.rs:20:11 | LL | = [0; (i8::MAX + 1) as usize]; | ^^^^^^^^^^^^^ attempt to add with overflow diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs b/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs index 719b21000f7..5a6be0c9bd3 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Evaluation of constants in array-elem count goes through different // compiler control-flow paths. // diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr index 4f1163bf9a1..59a9d25c719 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/const-eval-overflow-3b.rs:34:22 + --> $DIR/const-eval-overflow-3b.rs:24:22 | LL | = [0; (i8::MAX + 1u8) as usize]; | ^^^ expected i8, found u8 error[E0277]: cannot add `u8` to `i8` - --> $DIR/const-eval-overflow-3b.rs:34:20 + --> $DIR/const-eval-overflow-3b.rs:24:20 | LL | = [0; (i8::MAX + 1u8) as usize]; | ^ no implementation for `i8 + u8` diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4.rs b/src/test/ui/consts/const-eval/const-eval-overflow-4.rs index 5d692d9d7fc..0b12a438f96 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-4.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow-4.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Evaluation of constants in array-elem count goes through different // compiler control-flow paths. // diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-4.stderr index fd186dc719c..fe7db23dc2e 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-4.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-4.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const-eval-overflow-4.rs:23:13 + --> $DIR/const-eval-overflow-4.rs:13:13 | LL | : [u32; (i8::MAX as i8 + 1i8) as usize] | ^^^^^^^^^^^^^^^^^^^^^ attempt to add with overflow diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4b.rs b/src/test/ui/consts/const-eval/const-eval-overflow-4b.rs index 6028df18839..75c396f2351 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-4b.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow-4b.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Evaluation of constants in array-elem count goes through different // compiler control-flow paths. // diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr index d171e7f09d1..0c2f76a5582 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/const-eval-overflow-4b.rs:22:30 + --> $DIR/const-eval-overflow-4b.rs:12:30 | LL | : [u32; (i8::MAX as i8 + 1u8) as usize] | ^^^ expected i8, found u8 error[E0277]: cannot add `u8` to `i8` - --> $DIR/const-eval-overflow-4b.rs:22:28 + --> $DIR/const-eval-overflow-4b.rs:12:28 | LL | : [u32; (i8::MAX as i8 + 1u8) as usize] | ^ no implementation for `i8 + u8` @@ -13,7 +13,7 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize] = help: the trait `std::ops::Add` is not implemented for `i8` error[E0604]: only `u8` can be cast as `char`, not `i8` - --> $DIR/const-eval-overflow-4b.rs:35:13 + --> $DIR/const-eval-overflow-4b.rs:25:13 | LL | : [u32; 5i8 as char as usize] | ^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2.rs b/src/test/ui/consts/const-eval/const-eval-overflow2.rs index 8e094a7f7dc..4700c63adbc 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow2.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] // Note: the relevant lint pass here runs before some of the constant -// evaluation below (e.g. that performed by codegen and llvm), so if you +// evaluation below (e.g., that performed by codegen and llvm), so if you // change this warn to a deny, then the compiler will exit before // those errors are detected. diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr index 596ba6bb223..5ec2a2feb09 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:24:1 + --> $DIR/const-eval-overflow2.rs:14:1 | LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -9,13 +9,13 @@ LL | | ); | |_______^ | note: lint level defined here - --> $DIR/const-eval-overflow2.rs:18:9 + --> $DIR/const-eval-overflow2.rs:8:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:29:1 + --> $DIR/const-eval-overflow2.rs:19:1 | LL | / const VALS_I16: (i16,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -25,7 +25,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:34:1 + --> $DIR/const-eval-overflow2.rs:24:1 | LL | / const VALS_I32: (i32,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -35,7 +35,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:39:1 + --> $DIR/const-eval-overflow2.rs:29:1 | LL | / const VALS_I64: (i64,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -45,7 +45,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:44:1 + --> $DIR/const-eval-overflow2.rs:34:1 | LL | / const VALS_U8: (u8,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -55,7 +55,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:49:1 + --> $DIR/const-eval-overflow2.rs:39:1 | LL | / const VALS_U16: (u16,) = ( //~ ERROR any use of this value will cause an error LL | | u16::MIN - 1, @@ -64,7 +64,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:53:1 + --> $DIR/const-eval-overflow2.rs:43:1 | LL | / const VALS_U32: (u32,) = ( //~ ERROR any use of this value will cause an error LL | | u32::MIN - 1, @@ -73,7 +73,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2.rs:57:1 + --> $DIR/const-eval-overflow2.rs:47:1 | LL | / const VALS_U64: (u64,) = //~ ERROR any use of this value will cause an error LL | | ( diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.rs b/src/test/ui/consts/const-eval/const-eval-overflow2b.rs index c69d03071e7..6bed90aa8ea 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2b.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow2b.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] // Note: the relevant lint pass here runs before some of the constant -// evaluation below (e.g. that performed by codegen and llvm), so if you +// evaluation below (e.g., that performed by codegen and llvm), so if you // change this warn to a deny, then the compiler will exit before // those errors are detected. diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr index 82f245eaee8..7866b6c30c3 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:24:1 + --> $DIR/const-eval-overflow2b.rs:14:1 | LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -9,13 +9,13 @@ LL | | ); | |_______^ | note: lint level defined here - --> $DIR/const-eval-overflow2b.rs:18:9 + --> $DIR/const-eval-overflow2b.rs:8:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:29:1 + --> $DIR/const-eval-overflow2b.rs:19:1 | LL | / const VALS_I16: (i16,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -25,7 +25,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:34:1 + --> $DIR/const-eval-overflow2b.rs:24:1 | LL | / const VALS_I32: (i32,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -35,7 +35,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:39:1 + --> $DIR/const-eval-overflow2b.rs:29:1 | LL | / const VALS_I64: (i64,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -45,7 +45,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:44:1 + --> $DIR/const-eval-overflow2b.rs:34:1 | LL | / const VALS_U8: (u8,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -55,7 +55,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:49:1 + --> $DIR/const-eval-overflow2b.rs:39:1 | LL | / const VALS_U16: (u16,) = ( //~ ERROR any use of this value will cause an error LL | | u16::MAX + 1, @@ -64,7 +64,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:53:1 + --> $DIR/const-eval-overflow2b.rs:43:1 | LL | / const VALS_U32: (u32,) = ( //~ ERROR any use of this value will cause an error LL | | u32::MAX + 1, @@ -73,7 +73,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2b.rs:57:1 + --> $DIR/const-eval-overflow2b.rs:47:1 | LL | / const VALS_U64: (u64,) = //~ ERROR any use of this value will cause an error LL | | ( diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.rs b/src/test/ui/consts/const-eval/const-eval-overflow2c.rs index f442661ec63..108251e4bd2 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2c.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow2c.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_imports)] // Note: the relevant lint pass here runs before some of the constant -// evaluation below (e.g. that performed by codegen and llvm), so if you +// evaluation below (e.g., that performed by codegen and llvm), so if you // change this warn to a deny, then the compiler will exit before // those errors are detected. diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr index 91064eb867d..5370fdd25d8 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:24:1 + --> $DIR/const-eval-overflow2c.rs:14:1 | LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -9,13 +9,13 @@ LL | | ); | |_______^ | note: lint level defined here - --> $DIR/const-eval-overflow2c.rs:18:9 + --> $DIR/const-eval-overflow2c.rs:8:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:29:1 + --> $DIR/const-eval-overflow2c.rs:19:1 | LL | / const VALS_I16: (i16,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -25,7 +25,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:34:1 + --> $DIR/const-eval-overflow2c.rs:24:1 | LL | / const VALS_I32: (i32,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -35,7 +35,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:39:1 + --> $DIR/const-eval-overflow2c.rs:29:1 | LL | / const VALS_I64: (i64,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -45,7 +45,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:44:1 + --> $DIR/const-eval-overflow2c.rs:34:1 | LL | / const VALS_U8: (u8,) = //~ ERROR any use of this value will cause an error LL | | ( @@ -55,7 +55,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:49:1 + --> $DIR/const-eval-overflow2c.rs:39:1 | LL | / const VALS_U16: (u16,) = ( //~ ERROR any use of this value will cause an error LL | | u16::MAX * 2, @@ -64,7 +64,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:53:1 + --> $DIR/const-eval-overflow2c.rs:43:1 | LL | / const VALS_U32: (u32,) = ( //~ ERROR any use of this value will cause an error LL | | u32::MAX * 2, @@ -73,7 +73,7 @@ LL | | ); | |_______^ error: any use of this value will cause an error - --> $DIR/const-eval-overflow2c.rs:57:1 + --> $DIR/const-eval-overflow2c.rs:47:1 | LL | / const VALS_U64: (u64,) = //~ ERROR any use of this value will cause an error LL | | ( diff --git a/src/test/ui/consts/const-eval/const-eval-span.rs b/src/test/ui/consts/const-eval/const-eval-span.rs index f0fa1c0b9b4..59f4b138249 100644 --- a/src/test/ui/consts/const-eval/const-eval-span.rs +++ b/src/test/ui/consts/const-eval/const-eval-span.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that error in constant evaluation of enum discriminant // provides the context for what caused the evaluation. diff --git a/src/test/ui/consts/const-eval/const-eval-span.stderr b/src/test/ui/consts/const-eval/const-eval-span.stderr index afe8d1bc0b5..8ff9bfe54c7 100644 --- a/src/test/ui/consts/const-eval/const-eval-span.stderr +++ b/src/test/ui/consts/const-eval/const-eval-span.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/const-eval-span.rs:19:9 + --> $DIR/const-eval-span.rs:9:9 | LL | V = CONSTANT, | ^^^^^^^^ expected isize, found struct `S` diff --git a/src/test/ui/consts/const-eval/const_let.rs b/src/test/ui/consts/const-eval/const_let.rs index 602d4da24f3..63321b91200 100644 --- a/src/test/ui/consts/const-eval/const_let.rs +++ b/src/test/ui/consts/const-eval/const_let.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(const_let)] - fn main() {} struct FakeNeedsDrop; diff --git a/src/test/ui/consts/const-eval/const_let.stderr b/src/test/ui/consts/const-eval/const_let.stderr index 86e3482fda6..00de97e6fb3 100644 --- a/src/test/ui/consts/const-eval/const_let.stderr +++ b/src/test/ui/consts/const-eval/const_let.stderr @@ -1,11 +1,11 @@ error[E0019]: constant contains unimplemented expression type - --> $DIR/const_let.rs:25:55 + --> $DIR/const_let.rs:13:55 | LL | const Y: FakeNeedsDrop = { let mut x = FakeNeedsDrop; x = FakeNeedsDrop; x }; | ^ error[E0019]: constant contains unimplemented expression type - --> $DIR/const_let.rs:29:35 + --> $DIR/const_let.rs:17:35 | LL | const Z: () = { let mut x = None; x = Some(FakeNeedsDrop); }; | ^ diff --git a/src/test/ui/consts/const-eval/const_panic.rs b/src/test/ui/consts/const-eval/const_panic.rs index 9af631afed4..3e5112b0b14 100644 --- a/src/test/ui/consts/const-eval/const_panic.rs +++ b/src/test/ui/consts/const-eval/const_panic.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_panic)] #![crate_type = "lib"] diff --git a/src/test/ui/consts/const-eval/const_panic.stderr b/src/test/ui/consts/const-eval/const_panic.stderr index fcdbcbf5bfa..eecac7c7107 100644 --- a/src/test/ui/consts/const-eval/const_panic.stderr +++ b/src/test/ui/consts/const-eval/const_panic.stderr @@ -1,31 +1,31 @@ error: any use of this value will cause an error - --> $DIR/const_panic.rs:14:1 + --> $DIR/const_panic.rs:4:1 | LL | pub const Z: () = panic!("cheese"); | ^^^^^^^^^^^^^^^^^^----------------^ | | - | the evaluated program panicked at 'cheese', $DIR/const_panic.rs:14:19 + | the evaluated program panicked at 'cheese', $DIR/const_panic.rs:4:19 | = note: #[deny(const_err)] on by default = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: any use of this value will cause an error - --> $DIR/const_panic.rs:17:1 + --> $DIR/const_panic.rs:7:1 | LL | pub const Y: () = unreachable!(); | ^^^^^^^^^^^^^^^^^^--------------^ | | - | the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:17:19 + | the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:7:19 | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: any use of this value will cause an error - --> $DIR/const_panic.rs:20:1 + --> $DIR/const_panic.rs:10:1 | LL | pub const X: () = unimplemented!(); | ^^^^^^^^^^^^^^^^^^----------------^ | | - | the evaluated program panicked at 'not yet implemented', $DIR/const_panic.rs:20:19 + | the evaluated program panicked at 'not yet implemented', $DIR/const_panic.rs:10:19 | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/const_panic_libcore.rs b/src/test/ui/consts/const-eval/const_panic_libcore.rs index 11da8742b10..e42685e9c76 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore.rs +++ b/src/test/ui/consts/const-eval/const_panic_libcore.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] #![crate_type = "lib"] #![feature(const_panic)] diff --git a/src/test/ui/consts/const-eval/const_panic_libcore.stderr b/src/test/ui/consts/const-eval/const_panic_libcore.stderr index a8f04b96a8b..83c89c329dc 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore.stderr +++ b/src/test/ui/consts/const-eval/const_panic_libcore.stderr @@ -1,31 +1,31 @@ error: any use of this value will cause an error - --> $DIR/const_panic_libcore.rs:15:1 + --> $DIR/const_panic_libcore.rs:5:1 | LL | const Z: () = panic!("cheese"); | ^^^^^^^^^^^^^^----------------^ | | - | the evaluated program panicked at 'cheese', $DIR/const_panic_libcore.rs:15:15 + | the evaluated program panicked at 'cheese', $DIR/const_panic_libcore.rs:5:15 | = note: #[deny(const_err)] on by default = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: any use of this value will cause an error - --> $DIR/const_panic_libcore.rs:18:1 + --> $DIR/const_panic_libcore.rs:8:1 | LL | const Y: () = unreachable!(); | ^^^^^^^^^^^^^^--------------^ | | - | the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore.rs:18:15 + | the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore.rs:8:15 | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: any use of this value will cause an error - --> $DIR/const_panic_libcore.rs:21:1 + --> $DIR/const_panic_libcore.rs:11:1 | LL | const X: () = unimplemented!(); | ^^^^^^^^^^^^^^----------------^ | | - | the evaluated program panicked at 'not yet implemented', $DIR/const_panic_libcore.rs:21:15 + | the evaluated program panicked at 'not yet implemented', $DIR/const_panic_libcore.rs:11:15 | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_main.rs b/src/test/ui/consts/const-eval/const_panic_libcore_main.rs index 03365ae46ab..9afcdf77610 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore_main.rs +++ b/src/test/ui/consts/const-eval/const_panic_libcore_main.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "bin"] #![feature(lang_items)] #![feature(const_panic)] diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_main.stderr b/src/test/ui/consts/const-eval/const_panic_libcore_main.stderr index 50794c8f065..4cc48618e32 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore_main.stderr +++ b/src/test/ui/consts/const-eval/const_panic_libcore_main.stderr @@ -1,31 +1,31 @@ error: any use of this value will cause an error - --> $DIR/const_panic_libcore_main.rs:19:1 + --> $DIR/const_panic_libcore_main.rs:9:1 | LL | const Z: () = panic!("cheese"); | ^^^^^^^^^^^^^^----------------^ | | - | the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_main.rs:19:15 + | the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_main.rs:9:15 | = note: #[deny(const_err)] on by default = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: any use of this value will cause an error - --> $DIR/const_panic_libcore_main.rs:22:1 + --> $DIR/const_panic_libcore_main.rs:12:1 | LL | const Y: () = unreachable!(); | ^^^^^^^^^^^^^^--------------^ | | - | the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_main.rs:22:15 + | the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_main.rs:12:15 | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: any use of this value will cause an error - --> $DIR/const_panic_libcore_main.rs:25:1 + --> $DIR/const_panic_libcore_main.rs:15:1 | LL | const X: () = unimplemented!(); | ^^^^^^^^^^^^^^----------------^ | | - | the evaluated program panicked at 'not yet implemented', $DIR/const_panic_libcore_main.rs:25:15 + | the evaluated program panicked at 'not yet implemented', $DIR/const_panic_libcore_main.rs:15:15 | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/consts/const-eval/const_prop_errors.rs b/src/test/ui/consts/const-eval/const_prop_errors.rs index bea4fb76ed1..51b50b2e75f 100644 --- a/src/test/ui/consts/const-eval/const_prop_errors.rs +++ b/src/test/ui/consts/const-eval/const_prop_errors.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub trait Foo { diff --git a/src/test/ui/consts/const-eval/const_raw_ptr_ops.rs b/src/test/ui/consts/const-eval/const_raw_ptr_ops.rs index 3cd2c04c9f1..44266682a5c 100644 --- a/src/test/ui/consts/const-eval/const_raw_ptr_ops.rs +++ b/src/test/ui/consts/const-eval/const_raw_ptr_ops.rs @@ -1,25 +1,15 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_raw_ptr_to_usize_cast, const_compare_raw_pointers, const_raw_ptr_deref)] fn main() {} // unconst and bad, will thus error in miri -const X: bool = &1 as *const i32 == &2 as *const i32; //~ ERROR any use of this value will cause +const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 }; //~ ERROR any use of this // unconst and fine -const X2: bool = 42 as *const i32 == 43 as *const i32; +const X2: bool = unsafe { 42 as *const i32 == 43 as *const i32 }; // unconst and fine -const Y: usize = 42usize as *const i32 as usize + 1; +const Y: usize = unsafe { 42usize as *const i32 as usize + 1 }; // unconst and bad, will thus error in miri -const Y2: usize = &1 as *const i32 as usize + 1; //~ ERROR any use of this value will cause +const Y2: usize = unsafe { &1 as *const i32 as usize + 1 }; //~ ERROR any use of this // unconst and fine const Z: i32 = unsafe { *(&1 as *const i32) }; // unconst and bad, will thus error in miri diff --git a/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr b/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr index 72bbdeb0183..6be54c0bad4 100644 --- a/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr +++ b/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr @@ -1,23 +1,23 @@ error: any use of this value will cause an error - --> $DIR/const_raw_ptr_ops.rs:16:1 + --> $DIR/const_raw_ptr_ops.rs:6:1 | -LL | const X: bool = &1 as *const i32 == &2 as *const i32; //~ ERROR any use of this value will cause - | ^^^^^^^^^^^^^^^^------------------------------------^ - | | - | "pointer arithmetic or comparison" needs an rfc before being allowed inside constants +LL | const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 }; //~ ERROR any use of this + | ^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | "pointer arithmetic or comparison" needs an rfc before being allowed inside constants | = note: #[deny(const_err)] on by default error: any use of this value will cause an error - --> $DIR/const_raw_ptr_ops.rs:22:1 + --> $DIR/const_raw_ptr_ops.rs:12:1 | -LL | const Y2: usize = &1 as *const i32 as usize + 1; //~ ERROR any use of this value will cause - | ^^^^^^^^^^^^^^^^^^-----------------------------^ - | | - | "pointer arithmetic or comparison" needs an rfc before being allowed inside constants +LL | const Y2: usize = unsafe { &1 as *const i32 as usize + 1 }; //~ ERROR any use of this + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------^^^ + | | + | "pointer arithmetic or comparison" needs an rfc before being allowed inside constants error: any use of this value will cause an error - --> $DIR/const_raw_ptr_ops.rs:26:1 + --> $DIR/const_raw_ptr_ops.rs:16:1 | LL | const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR any use of this value will cause | ^^^^^^^^^^^^^^^^^^^^^^^^^-------------------^^^ @@ -25,7 +25,7 @@ LL | const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR any use of this v | a memory access tried to interpret some bytes as a pointer error: any use of this value will cause an error - --> $DIR/const_raw_ptr_ops.rs:27:1 + --> $DIR/const_raw_ptr_ops.rs:17:1 | LL | const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR any use of this value will cause | ^^^^^^^^^^^^^^^^^^^^^^^^^-------------------^^^ diff --git a/src/test/ui/consts/const-eval/const_signed_pat.rs b/src/test/ui/consts/const-eval/const_signed_pat.rs index 008ebf13c63..cb4fb46bd05 100644 --- a/src/test/ui/consts/const-eval/const_signed_pat.rs +++ b/src/test/ui/consts/const-eval/const_signed_pat.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass fn main() { diff --git a/src/test/ui/consts/const-eval/const_transmute.rs b/src/test/ui/consts/const-eval/const_transmute.rs index 8dd1476d25a..e4f7fb155ab 100644 --- a/src/test/ui/consts/const-eval/const_transmute.rs +++ b/src/test/ui/consts/const-eval/const_transmute.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // run-pass diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr index 8c4806cddfe..238db527e38 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr @@ -1,13 +1,13 @@ error: `foo` is not yet stable as a const fn - --> $DIR/dont_promote_unstable_const_fn.rs:25:25 + --> $DIR/dont_promote_unstable_const_fn.rs:15:25 | LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a const fn | ^^^^^ | - = help: in Nightly builds, add `#![feature(foo)]` to the crate attributes to enable + = help: add `#![feature(foo)]` to the crate attributes to enable error[E0716]: temporary value dropped while borrowed - --> $DIR/dont_promote_unstable_const_fn.rs:28:28 + --> $DIR/dont_promote_unstable_const_fn.rs:18:28 | LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough | ------------ ^^^^^ creates a temporary which is freed while still in use @@ -17,7 +17,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/dont_promote_unstable_const_fn.rs:32:28 + --> $DIR/dont_promote_unstable_const_fn.rs:22:28 | LL | let _: &'static u32 = &meh(); //~ ERROR does not live long enough | ------------ ^^^^^ creates a temporary which is freed while still in use @@ -28,7 +28,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/dont_promote_unstable_const_fn.rs:33:26 + --> $DIR/dont_promote_unstable_const_fn.rs:23:26 | LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis(); | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs index a371d5485e1..7170be1b88b 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(feature = "humans", reason = "who ever let humans program computers, we're apparently really bad at it", diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr index b3d7ba3e5c4..fdbc4cb0c8d 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr @@ -1,13 +1,13 @@ error: `foo` is not yet stable as a const fn - --> $DIR/dont_promote_unstable_const_fn.rs:25:25 + --> $DIR/dont_promote_unstable_const_fn.rs:15:25 | LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a const fn | ^^^^^ | - = help: in Nightly builds, add `#![feature(foo)]` to the crate attributes to enable + = help: add `#![feature(foo)]` to the crate attributes to enable error[E0597]: borrowed value does not live long enough - --> $DIR/dont_promote_unstable_const_fn.rs:28:28 + --> $DIR/dont_promote_unstable_const_fn.rs:18:28 | LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough | ^^^^^ temporary value does not live long enough @@ -17,7 +17,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/dont_promote_unstable_const_fn.rs:32:28 + --> $DIR/dont_promote_unstable_const_fn.rs:22:28 | LL | let _: &'static u32 = &meh(); //~ ERROR does not live long enough | ^^^^^ temporary value does not live long enough @@ -28,7 +28,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/dont_promote_unstable_const_fn.rs:33:26 + --> $DIR/dont_promote_unstable_const_fn.rs:23:26 | LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr index 15fd28cd5a5..4355401987b 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:18:28 + --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28 | LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough | ------------ ^^^^^ creates a temporary which is freed while still in use @@ -10,7 +10,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:19:29 + --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29 | LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough | ------------ ^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs index 81be5d4fe1a..6dcfcfe6780 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:stability.rs extern crate stability; diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr index cea36a0fa36..8be7add2200 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:18:28 + --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28 | LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough | ^^^^^ temporary value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:19:29 + --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29 | LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough | ^^^^^ temporary value does not live long enough diff --git a/src/test/ui/consts/const-eval/double_check.rs b/src/test/ui/consts/const-eval/double_check.rs index 76f9276c058..9ac511767c0 100644 --- a/src/test/ui/consts/const-eval/double_check.rs +++ b/src/test/ui/consts/const-eval/double_check.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass enum Foo { diff --git a/src/test/ui/consts/const-eval/double_check2.rs b/src/test/ui/consts/const-eval/double_check2.rs index 701632362ce..dc2b58faf92 100644 --- a/src/test/ui/consts/const-eval/double_check2.rs +++ b/src/test/ui/consts/const-eval/double_check2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { A = 5, B = 42, diff --git a/src/test/ui/consts/const-eval/double_check2.stderr b/src/test/ui/consts/const-eval/double_check2.stderr index 7e82d4fc264..06b38bf7103 100644 --- a/src/test/ui/consts/const-eval/double_check2.stderr +++ b/src/test/ui/consts/const-eval/double_check2.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/double_check2.rs:25:1 + --> $DIR/double_check2.rs:15:1 | LL | / static FOO: (&Foo, &Bar) = unsafe {( //~ undefined behavior LL | | Union { u8: &BAR }.foo, diff --git a/src/test/ui/consts/const-eval/duration_conversion.rs b/src/test/ui/consts/const-eval/duration_conversion.rs index c8bed4a2b77..854f97d4754 100644 --- a/src/test/ui/consts/const-eval/duration_conversion.rs +++ b/src/test/ui/consts/const-eval/duration_conversion.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass use std::time::Duration; diff --git a/src/test/ui/consts/const-eval/enum_discr.rs b/src/test/ui/consts/const-eval/enum_discr.rs index ba38a42092e..4851e752094 100644 --- a/src/test/ui/consts/const-eval/enum_discr.rs +++ b/src/test/ui/consts/const-eval/enum_discr.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // run-pass diff --git a/src/test/ui/consts/const-eval/extern_fat_pointer.rs b/src/test/ui/consts/const-eval/extern_fat_pointer.rs index 071311430a8..f8e6fd09c7e 100644 --- a/src/test/ui/consts/const-eval/extern_fat_pointer.rs +++ b/src/test/ui/consts/const-eval/extern_fat_pointer.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(extern_types)] diff --git a/src/test/ui/consts/const-eval/feature-gate-const_fn_union.rs b/src/test/ui/consts/const-eval/feature-gate-const_fn_union.rs index 113046b0689..b0ae746ace5 100644 --- a/src/test/ui/consts/const-eval/feature-gate-const_fn_union.rs +++ b/src/test/ui/consts/const-eval/feature-gate-const_fn_union.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_fn)] fn main() {} diff --git a/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr b/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr index 1e28f14165f..c562c66389f 100644 --- a/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr +++ b/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr @@ -1,5 +1,5 @@ error[E0658]: unions in const fn are unstable (see issue #51909) - --> $DIR/feature-gate-const_fn_union.rs:21:5 + --> $DIR/feature-gate-const_fn_union.rs:11:5 | LL | Foo { u }.i //~ ERROR unions in const fn are unstable | ^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/feature-gate-const_panic.rs b/src/test/ui/consts/const-eval/feature-gate-const_panic.rs index 26eb95d9c66..ba5b07239a2 100644 --- a/src/test/ui/consts/const-eval/feature-gate-const_panic.rs +++ b/src/test/ui/consts/const-eval/feature-gate-const_panic.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} const Z: () = panic!("cheese"); diff --git a/src/test/ui/consts/const-eval/feature-gate-const_panic.stderr b/src/test/ui/consts/const-eval/feature-gate-const_panic.stderr index f4d05edd04a..08103413556 100644 --- a/src/test/ui/consts/const-eval/feature-gate-const_panic.stderr +++ b/src/test/ui/consts/const-eval/feature-gate-const_panic.stderr @@ -1,5 +1,5 @@ error[E0658]: panicking in constants is unstable (see issue #51999) - --> $DIR/feature-gate-const_panic.rs:13:15 + --> $DIR/feature-gate-const_panic.rs:3:15 | LL | const Z: () = panic!("cheese"); | ^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | const Z: () = panic!("cheese"); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error[E0658]: panicking in constants is unstable (see issue #51999) - --> $DIR/feature-gate-const_panic.rs:19:15 + --> $DIR/feature-gate-const_panic.rs:9:15 | LL | const X: () = unimplemented!(); | ^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | const X: () = unimplemented!(); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error[E0658]: panicking in constants is unstable (see issue #51999) - --> $DIR/feature-gate-const_panic.rs:16:15 + --> $DIR/feature-gate-const_panic.rs:6:15 | LL | const Y: () = unreachable!(); | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/ice-generic-assoc-const.rs b/src/test/ui/consts/const-eval/ice-generic-assoc-const.rs index 31e056b66bc..e92de84c279 100644 --- a/src/test/ui/consts/const-eval/ice-generic-assoc-const.rs +++ b/src/test/ui/consts/const-eval/ice-generic-assoc-const.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub trait Nullable { diff --git a/src/test/ui/consts/const-eval/ice-packed.rs b/src/test/ui/consts/const-eval/ice-packed.rs index 1db12a06b03..b9fe4eadd41 100644 --- a/src/test/ui/consts/const-eval/ice-packed.rs +++ b/src/test/ui/consts/const-eval/ice-packed.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #[derive(Copy, Clone, PartialEq, Eq)] #[repr(packed)] diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds.rs b/src/test/ui/consts/const-eval/index_out_of_bounds.rs index e7ffbe81b9a..80e0d28fec2 100644 --- a/src/test/ui/consts/const-eval/index_out_of_bounds.rs +++ b/src/test/ui/consts/const-eval/index_out_of_bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static FOO: i32 = [][0]; //~^ ERROR E0080 diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds.stderr b/src/test/ui/consts/const-eval/index_out_of_bounds.stderr index a08d405d449..1b2974e4e3d 100644 --- a/src/test/ui/consts/const-eval/index_out_of_bounds.stderr +++ b/src/test/ui/consts/const-eval/index_out_of_bounds.stderr @@ -1,5 +1,5 @@ error[E0080]: could not evaluate static initializer - --> $DIR/index_out_of_bounds.rs:11:19 + --> $DIR/index_out_of_bounds.rs:1:19 | LL | static FOO: i32 = [][0]; | ^^^^^ index out of bounds: the len is 0 but the index is 0 diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs index 7a7e2ef0b6b..4b487c09a11 100644 --- a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs +++ b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let array = [std::env::args().len()]; array[1]; //~ ERROR index out of bounds diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr index 97badc19c94..1a9e1b0ae85 100644 --- a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr +++ b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr @@ -1,5 +1,5 @@ error: index out of bounds: the len is 1 but the index is 1 - --> $DIR/index_out_of_bounds_propagated.rs:13:5 + --> $DIR/index_out_of_bounds_propagated.rs:3:5 | LL | array[1]; //~ ERROR index out of bounds | ^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/infinite_loop.rs b/src/test/ui/consts/const-eval/infinite_loop.rs index d23b6250b4d..a2a45af7cb0 100644 --- a/src/test/ui/consts/const-eval/infinite_loop.rs +++ b/src/test/ui/consts/const-eval/infinite_loop.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(const_let)] - fn main() { // Tests the Collatz conjecture with an incorrect base case (0 instead of 1). // The value of `n` will loop indefinitely (4 - 2 - 1 - 4). diff --git a/src/test/ui/consts/const-eval/infinite_loop.stderr b/src/test/ui/consts/const-eval/infinite_loop.stderr index 2ff80e5efb5..422c2bab6ea 100644 --- a/src/test/ui/consts/const-eval/infinite_loop.stderr +++ b/src/test/ui/consts/const-eval/infinite_loop.stderr @@ -1,5 +1,5 @@ error[E0019]: constant contains unimplemented expression type - --> $DIR/infinite_loop.rs:19:9 + --> $DIR/infinite_loop.rs:7:9 | LL | / while n != 0 { //~ ERROR constant contains unimplemented expression type LL | | n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; @@ -8,7 +8,7 @@ LL | | } | |_________^ warning: Constant evaluating a complex constant, this might take some time - --> $DIR/infinite_loop.rs:16:18 + --> $DIR/infinite_loop.rs:4:18 | LL | let _ = [(); { | __________________^ @@ -21,7 +21,7 @@ LL | | }]; | |_____^ error[E0080]: evaluation of constant value failed - --> $DIR/infinite_loop.rs:20:20 + --> $DIR/infinite_loop.rs:8:20 | LL | n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; | ^^^^^^^^^^ duplicate interpreter state observed here, const evaluation will never terminate diff --git a/src/test/ui/consts/const-eval/issue-43197.rs b/src/test/ui/consts/const-eval/issue-43197.rs index 125b5e4d208..440862090bd 100644 --- a/src/test/ui/consts/const-eval/issue-43197.rs +++ b/src/test/ui/consts/const-eval/issue-43197.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![warn(const_err)] const fn foo(x: u32) -> u32 { diff --git a/src/test/ui/consts/const-eval/issue-43197.stderr b/src/test/ui/consts/const-eval/issue-43197.stderr index eaaebc5d75a..84c68610260 100644 --- a/src/test/ui/consts/const-eval/issue-43197.stderr +++ b/src/test/ui/consts/const-eval/issue-43197.stderr @@ -1,5 +1,5 @@ warning: any use of this value will cause an error - --> $DIR/issue-43197.rs:18:5 + --> $DIR/issue-43197.rs:8:5 | LL | const X: u32 = 0-1; | ^^^^^^^^^^^^^^^---^ @@ -7,13 +7,13 @@ LL | const X: u32 = 0-1; | attempt to subtract with overflow | note: lint level defined here - --> $DIR/issue-43197.rs:11:9 + --> $DIR/issue-43197.rs:1:9 | LL | #![warn(const_err)] | ^^^^^^^^^ warning: any use of this value will cause an error - --> $DIR/issue-43197.rs:20:5 + --> $DIR/issue-43197.rs:10:5 | LL | const Y: u32 = foo(0-1); | ^^^^^^^^^^^^^^^^^^^---^^ @@ -21,13 +21,13 @@ LL | const Y: u32 = foo(0-1); | attempt to subtract with overflow error[E0080]: evaluation of constant expression failed - --> $DIR/issue-43197.rs:22:26 + --> $DIR/issue-43197.rs:12:26 | LL | println!("{} {}", X, Y); | ^ referenced constant has errors error[E0080]: evaluation of constant expression failed - --> $DIR/issue-43197.rs:22:23 + --> $DIR/issue-43197.rs:12:23 | LL | println!("{} {}", X, Y); | ^ referenced constant has errors diff --git a/src/test/ui/consts/const-eval/issue-44578.rs b/src/test/ui/consts/const-eval/issue-44578.rs index 9bd84b91d7f..4d93130f2af 100644 --- a/src/test/ui/consts/const-eval/issue-44578.rs +++ b/src/test/ui/consts/const-eval/issue-44578.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(const_err)] trait Foo { diff --git a/src/test/ui/consts/const-eval/issue-44578.stderr b/src/test/ui/consts/const-eval/issue-44578.stderr index 570a8960164..3fadeac1d5c 100644 --- a/src/test/ui/consts/const-eval/issue-44578.stderr +++ b/src/test/ui/consts/const-eval/issue-44578.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant expression failed - --> $DIR/issue-44578.rs:35:20 + --> $DIR/issue-44578.rs:25:20 | LL | println!("{}", as Foo>::AMT); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-eval/issue-47971.rs b/src/test/ui/consts/const-eval/issue-47971.rs index dc449c663c3..9d7b05cd232 100644 --- a/src/test/ui/consts/const-eval/issue-47971.rs +++ b/src/test/ui/consts/const-eval/issue-47971.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass struct S(pub &'static u32, pub u32); diff --git a/src/test/ui/consts/const-eval/issue-50706.rs b/src/test/ui/consts/const-eval/issue-50706.rs index 2b0082d95b3..cb45b86cd7b 100644 --- a/src/test/ui/consts/const-eval/issue-50706.rs +++ b/src/test/ui/consts/const-eval/issue-50706.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub struct Stats; diff --git a/src/test/ui/consts/const-eval/issue-50814-2.rs b/src/test/ui/consts/const-eval/issue-50814-2.rs index 9a59ffd65ac..b13c19c660e 100644 --- a/src/test/ui/consts/const-eval/issue-50814-2.rs +++ b/src/test/ui/consts/const-eval/issue-50814-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait C { const BOO: usize; } diff --git a/src/test/ui/consts/const-eval/issue-50814-2.stderr b/src/test/ui/consts/const-eval/issue-50814-2.stderr index b36b3cf526c..7c2cd7c5ca0 100644 --- a/src/test/ui/consts/const-eval/issue-50814-2.stderr +++ b/src/test/ui/consts/const-eval/issue-50814-2.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/issue-50814-2.rs:22:5 + --> $DIR/issue-50814-2.rs:12:5 | LL | const BAR: usize = [5, 6, 7][T::BOO]; //~ ERROR any use of this value will cause an error | ^^^^^^^^^^^^^^^^^^^-----------------^ @@ -9,7 +9,7 @@ LL | const BAR: usize = [5, 6, 7][T::BOO]; //~ ERROR any use of this value w = note: #[deny(const_err)] on by default error[E0080]: evaluation of constant expression failed - --> $DIR/issue-50814-2.rs:26:5 + --> $DIR/issue-50814-2.rs:16:5 | LL | & as Foo>::BAR //~ ERROR E0080 | ^--------------------- diff --git a/src/test/ui/consts/const-eval/issue-50814.rs b/src/test/ui/consts/const-eval/issue-50814.rs index 3c7f1826449..b85cecda16e 100644 --- a/src/test/ui/consts/const-eval/issue-50814.rs +++ b/src/test/ui/consts/const-eval/issue-50814.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Unsigned { const MAX: u8; } diff --git a/src/test/ui/consts/const-eval/issue-50814.stderr b/src/test/ui/consts/const-eval/issue-50814.stderr index ebd0e34ab7e..757e55fe31d 100644 --- a/src/test/ui/consts/const-eval/issue-50814.stderr +++ b/src/test/ui/consts/const-eval/issue-50814.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/issue-50814.rs:23:5 + --> $DIR/issue-50814.rs:13:5 | LL | const MAX: u8 = A::MAX + B::MAX; //~ ERROR any use of this value will cause an error | ^^^^^^^^^^^^^^^^---------------^ @@ -9,7 +9,7 @@ LL | const MAX: u8 = A::MAX + B::MAX; //~ ERROR any use of this value will c = note: #[deny(const_err)] on by default error[E0080]: evaluation of constant expression failed - --> $DIR/issue-50814.rs:27:5 + --> $DIR/issue-50814.rs:17:5 | LL | &Sum::::MAX //~ ERROR E0080 | ^----------------- diff --git a/src/test/ui/consts/const-eval/issue-51300.rs b/src/test/ui/consts/const-eval/issue-51300.rs index f91711c3c0f..72a6072e4b7 100644 --- a/src/test/ui/consts/const-eval/issue-51300.rs +++ b/src/test/ui/consts/const-eval/issue-51300.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // https://github.com/rust-lang/rust/issues/51300 diff --git a/src/test/ui/consts/const-eval/issue-52442.rs b/src/test/ui/consts/const-eval/issue-52442.rs index 8e207b712c3..fadcde528d8 100644 --- a/src/test/ui/consts/const-eval/issue-52442.rs +++ b/src/test/ui/consts/const-eval/issue-52442.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { [(); { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type //~^ ERROR it is undefined behavior to use this value diff --git a/src/test/ui/consts/const-eval/issue-52442.stderr b/src/test/ui/consts/const-eval/issue-52442.stderr index 608094b179d..516796c1a42 100644 --- a/src/test/ui/consts/const-eval/issue-52442.stderr +++ b/src/test/ui/consts/const-eval/issue-52442.stderr @@ -1,11 +1,11 @@ error[E0019]: constant contains unimplemented expression type - --> $DIR/issue-52442.rs:12:14 + --> $DIR/issue-52442.rs:2:14 | LL | [(); { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type | ^^^^^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value - --> $DIR/issue-52442.rs:12:11 + --> $DIR/issue-52442.rs:2:11 | LL | [(); { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes diff --git a/src/test/ui/consts/const-eval/issue-52475.rs b/src/test/ui/consts/const-eval/issue-52475.rs index b21c1827e2b..aafdd5fe617 100644 --- a/src/test/ui/consts/const-eval/issue-52475.rs +++ b/src/test/ui/consts/const-eval/issue-52475.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(const_let)] - fn main() { let _ = [(); { //~^ WARNING Constant evaluating a complex constant, this might take some time diff --git a/src/test/ui/consts/const-eval/issue-52475.stderr b/src/test/ui/consts/const-eval/issue-52475.stderr index c0cd98b2fca..4f1b2ab4c8f 100644 --- a/src/test/ui/consts/const-eval/issue-52475.stderr +++ b/src/test/ui/consts/const-eval/issue-52475.stderr @@ -1,5 +1,5 @@ error[E0019]: constant contains unimplemented expression type - --> $DIR/issue-52475.rs:18:9 + --> $DIR/issue-52475.rs:6:9 | LL | / while n < 5 { //~ ERROR constant contains unimplemented expression type LL | | n = (n + 1) % 5; //~ ERROR evaluation of constant value failed @@ -8,7 +8,7 @@ LL | | } | |_________^ warning: Constant evaluating a complex constant, this might take some time - --> $DIR/issue-52475.rs:14:18 + --> $DIR/issue-52475.rs:2:18 | LL | let _ = [(); { | __________________^ @@ -21,7 +21,7 @@ LL | | }]; | |_____^ error[E0080]: evaluation of constant value failed - --> $DIR/issue-52475.rs:19:17 + --> $DIR/issue-52475.rs:7:17 | LL | n = (n + 1) % 5; //~ ERROR evaluation of constant value failed | ^^^^^^^^^^^ duplicate interpreter state observed here, const evaluation will never terminate diff --git a/src/test/ui/consts/const-eval/issue-53157.rs b/src/test/ui/consts/const-eval/issue-53157.rs index 900847767e1..b9958609971 100644 --- a/src/test/ui/consts/const-eval/issue-53157.rs +++ b/src/test/ui/consts/const-eval/issue-53157.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass macro_rules! m { diff --git a/src/test/ui/consts/const-eval/issue-53401.rs b/src/test/ui/consts/const-eval/issue-53401.rs index cb74f4f8f75..89834aa94fc 100644 --- a/src/test/ui/consts/const-eval/issue-53401.rs +++ b/src/test/ui/consts/const-eval/issue-53401.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub const STATIC_TRAIT: &Test = &(); diff --git a/src/test/ui/consts/const-eval/match-test-ptr-null.rs b/src/test/ui/consts/const-eval/match-test-ptr-null.rs index 1a3164b0b03..b27b816cf50 100644 --- a/src/test/ui/consts/const-eval/match-test-ptr-null.rs +++ b/src/test/ui/consts/const-eval/match-test-ptr-null.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { // Make sure match uses the usual pointer comparison code path -- i.e., it should complain // that pointer comparison is disallowed, not that parts of a pointer are accessed as raw diff --git a/src/test/ui/consts/const-eval/match-test-ptr-null.stderr b/src/test/ui/consts/const-eval/match-test-ptr-null.stderr index 86812b6c493..94615c019fe 100644 --- a/src/test/ui/consts/const-eval/match-test-ptr-null.stderr +++ b/src/test/ui/consts/const-eval/match-test-ptr-null.stderr @@ -1,5 +1,5 @@ error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) - --> $DIR/match-test-ptr-null.rs:16:15 + --> $DIR/match-test-ptr-null.rs:6:15 | LL | match &1 as *const i32 as usize { //~ ERROR casting pointers to integers in constants | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,13 +7,13 @@ LL | match &1 as *const i32 as usize { //~ ERROR casting pointers to int = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable error[E0019]: constant contains unimplemented expression type - --> $DIR/match-test-ptr-null.rs:17:13 + --> $DIR/match-test-ptr-null.rs:7:13 | LL | 0 => 42, //~ ERROR constant contains unimplemented expression type | ^ error[E0080]: evaluation of constant value failed - --> $DIR/match-test-ptr-null.rs:17:13 + --> $DIR/match-test-ptr-null.rs:7:13 | LL | 0 => 42, //~ ERROR constant contains unimplemented expression type | ^ "pointer arithmetic or comparison" needs an rfc before being allowed inside constants diff --git a/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs b/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs index 4136a7b6a72..32f0062168b 100644 --- a/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs +++ b/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs @@ -1,18 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // New test for #53818: modifying static memory at compile-time is not allowed. -// The test should never succeed. +// The test should never compile successfully #![feature(const_raw_ptr_deref)] -#![feature(const_let)] use std::cell::UnsafeCell; @@ -27,9 +16,7 @@ fn foo() {} static BAR: () = unsafe { *FOO.0.get() = 5; - //~^ ERROR statements in statics are unstable (see issue #48821) - // This error is caused by a separate bug that the feature gate error is reported - // even though the feature gate "const_let" is active. + //~^ contains unimplemented expression foo(); //~^ ERROR calls in statics are limited to constant functions, tuple structs and tuple variants diff --git a/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr b/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr index c2bba27e4d1..9fad6868d20 100644 --- a/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr +++ b/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr @@ -1,18 +1,16 @@ -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/mod-static-with-const-fn.rs:29:5 +error[E0019]: static contains unimplemented expression type + --> $DIR/mod-static-with-const-fn.rs:18:5 | LL | *FOO.0.get() = 5; | ^^^^^^^^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/mod-static-with-const-fn.rs:34:5 + --> $DIR/mod-static-with-const-fn.rs:21:5 | LL | foo(); | ^^^^^ error: aborting due to 2 previous errors -Some errors occurred: E0015, E0658. +Some errors occurred: E0015, E0019. For more information about an error, try `rustc --explain E0015`. diff --git a/src/test/ui/consts/const-eval/no_lint_for_statically_known_error.rs b/src/test/ui/consts/const-eval/no_lint_for_statically_known_error.rs index 41d5192d33d..0d14cf0f6d9 100644 --- a/src/test/ui/consts/const-eval/no_lint_for_statically_known_error.rs +++ b/src/test/ui/consts/const-eval/no_lint_for_statically_known_error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // if `X` were used instead of `x`, `X - 10` would result in a lint. diff --git a/src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs b/src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs index 922d7d3ab96..06b1727258d 100644 --- a/src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs +++ b/src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(nll)] diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr index bd14b1a2b5d..a2a71fc2ce3 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/promoted_const_fn_fail.rs:30:27 + --> $DIR/promoted_const_fn_fail.rs:20:27 | LL | let x: &'static u8 = &(bar() + 1); //~ ERROR does not live long enough | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs b/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs index aa6cd888018..80562b0ee83 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_fn, const_fn_union)] #![allow(const_err)] diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr index 4d80f701bcf..9316d48ab43 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/promoted_const_fn_fail.rs:30:27 + --> $DIR/promoted_const_fn_fail.rs:20:27 | LL | let x: &'static u8 = &(bar() + 1); //~ ERROR does not live long enough | ^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.nll.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.nll.stderr index c6b3dd242e9..987d2304ae8 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.nll.stderr +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/promoted_const_fn_fail_deny_const_err.rs:31:27 + --> $DIR/promoted_const_fn_fail_deny_const_err.rs:21:27 | LL | let x: &'static u8 = &(bar() + 1); | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs index dca8f3c4745..f331e44de17 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_fn, const_fn_union)] #![deny(const_err)] @@ -29,6 +19,7 @@ fn main() { // This will compile, but then hard-abort at runtime. // FIXME(oli-obk): this should instead panic (not hard-abort) at runtime. let x: &'static u8 = &(bar() + 1); + //~^ ERROR does not live long enough let y = *x; unreachable!(); } diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr index 728ff39f579..9c786b0864c 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/promoted_const_fn_fail_deny_const_err.rs:31:27 + --> $DIR/promoted_const_fn_fail_deny_const_err.rs:21:27 | LL | let x: &'static u8 = &(bar() + 1); | ^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/consts/const-eval/promoted_errors.rs b/src/test/ui/consts/const-eval/promoted_errors.rs index a58c4be66c4..ebf80e7d2e6 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.rs +++ b/src/test/ui/consts/const-eval/promoted_errors.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![warn(const_err)] // compile-pass diff --git a/src/test/ui/consts/const-eval/promoted_errors.stderr b/src/test/ui/consts/const-eval/promoted_errors.stderr index 26499fcb9b5..c9d5ede61ad 100644 --- a/src/test/ui/consts/const-eval/promoted_errors.stderr +++ b/src/test/ui/consts/const-eval/promoted_errors.stderr @@ -1,59 +1,59 @@ warning: this expression will panic at runtime - --> $DIR/promoted_errors.rs:17:14 + --> $DIR/promoted_errors.rs:7:14 | LL | let _x = 0u32 - 1; | ^^^^^^^^ attempt to subtract with overflow | note: lint level defined here - --> $DIR/promoted_errors.rs:11:9 + --> $DIR/promoted_errors.rs:1:9 | LL | #![warn(const_err)] | ^^^^^^^^^ warning: attempt to divide by zero - --> $DIR/promoted_errors.rs:19:20 + --> $DIR/promoted_errors.rs:9:20 | LL | println!("{}", 1/(1-1)); | ^^^^^^^ warning: attempt to divide by zero - --> $DIR/promoted_errors.rs:21:14 + --> $DIR/promoted_errors.rs:11:14 | LL | let _x = 1/(1-1); | ^^^^^^^ warning: this expression will panic at runtime - --> $DIR/promoted_errors.rs:21:14 + --> $DIR/promoted_errors.rs:11:14 | LL | let _x = 1/(1-1); | ^^^^^^^ attempt to divide by zero warning: attempt to divide by zero - --> $DIR/promoted_errors.rs:24:20 + --> $DIR/promoted_errors.rs:14:20 | LL | println!("{}", 1/(false as u32)); | ^^^^^^^^^^^^^^^^ warning: attempt to divide by zero - --> $DIR/promoted_errors.rs:26:14 + --> $DIR/promoted_errors.rs:16:14 | LL | let _x = 1/(false as u32); | ^^^^^^^^^^^^^^^^ warning: this expression will panic at runtime - --> $DIR/promoted_errors.rs:26:14 + --> $DIR/promoted_errors.rs:16:14 | LL | let _x = 1/(false as u32); | ^^^^^^^^^^^^^^^^ attempt to divide by zero warning: reaching this expression at runtime will panic or abort - --> $DIR/promoted_errors.rs:24:20 + --> $DIR/promoted_errors.rs:14:20 | LL | println!("{}", 1/(false as u32)); | ^^^^^^^^^^^^^^^^ attempt to divide by zero warning: reaching this expression at runtime will panic or abort - --> $DIR/promoted_errors.rs:19:20 + --> $DIR/promoted_errors.rs:9:20 | LL | println!("{}", 1/(1-1)); | ^^^^^^^ attempt to divide by zero diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr index 7141d7ac8b8..117090d89fd 100644 --- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr +++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/promoted_raw_ptr_ops.rs:14:29 + --> $DIR/promoted_raw_ptr_ops.rs:4:29 | LL | let x: &'static bool = &(42 as *const i32 == 43 as *const i32); | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -10,7 +10,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promoted_raw_ptr_ops.rs:16:30 + --> $DIR/promoted_raw_ptr_ops.rs:6:30 | LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -21,7 +21,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promoted_raw_ptr_ops.rs:17:28 + --> $DIR/promoted_raw_ptr_ops.rs:7:28 | LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -32,7 +32,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/promoted_raw_ptr_ops.rs:18:29 + --> $DIR/promoted_raw_ptr_ops.rs:8:29 | LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs index c915886ca25..ef7e5506f22 100644 --- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs +++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_raw_ptr_to_usize_cast, const_compare_raw_pointers, const_raw_ptr_deref)] fn main() { diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr index baf12c5ac59..9d1dcfafa63 100644 --- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr +++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/promoted_raw_ptr_ops.rs:14:29 + --> $DIR/promoted_raw_ptr_ops.rs:4:29 | LL | let x: &'static bool = &(42 as *const i32 == 43 as *const i32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/promoted_raw_ptr_ops.rs:16:30 + --> $DIR/promoted_raw_ptr_ops.rs:6:30 | LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -21,7 +21,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/promoted_raw_ptr_ops.rs:17:28 + --> $DIR/promoted_raw_ptr_ops.rs:7:28 | LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -32,7 +32,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/promoted_raw_ptr_ops.rs:18:29 + --> $DIR/promoted_raw_ptr_ops.rs:8:29 | LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/consts/const-eval/pub_const_err.rs b/src/test/ui/consts/const-eval/pub_const_err.rs index 41cf844a8e2..d882dad295b 100644 --- a/src/test/ui/consts/const-eval/pub_const_err.rs +++ b/src/test/ui/consts/const-eval/pub_const_err.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![warn(const_err)] diff --git a/src/test/ui/consts/const-eval/pub_const_err.stderr b/src/test/ui/consts/const-eval/pub_const_err.stderr index 2194180c2ef..9395832108d 100644 --- a/src/test/ui/consts/const-eval/pub_const_err.stderr +++ b/src/test/ui/consts/const-eval/pub_const_err.stderr @@ -1,5 +1,5 @@ warning: any use of this value will cause an error - --> $DIR/pub_const_err.rs:16:1 + --> $DIR/pub_const_err.rs:6:1 | LL | pub const Z: u32 = 0 - 1; | ^^^^^^^^^^^^^^^^^^^-----^ @@ -7,7 +7,7 @@ LL | pub const Z: u32 = 0 - 1; | attempt to subtract with overflow | note: lint level defined here - --> $DIR/pub_const_err.rs:12:9 + --> $DIR/pub_const_err.rs:2:9 | LL | #![warn(const_err)] | ^^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/pub_const_err_bin.rs b/src/test/ui/consts/const-eval/pub_const_err_bin.rs index 0ee7d603e31..dee09b70d93 100644 --- a/src/test/ui/consts/const-eval/pub_const_err_bin.rs +++ b/src/test/ui/consts/const-eval/pub_const_err_bin.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![warn(const_err)] diff --git a/src/test/ui/consts/const-eval/pub_const_err_bin.stderr b/src/test/ui/consts/const-eval/pub_const_err_bin.stderr index 60834e00650..6716f337f41 100644 --- a/src/test/ui/consts/const-eval/pub_const_err_bin.stderr +++ b/src/test/ui/consts/const-eval/pub_const_err_bin.stderr @@ -1,5 +1,5 @@ warning: any use of this value will cause an error - --> $DIR/pub_const_err_bin.rs:14:1 + --> $DIR/pub_const_err_bin.rs:4:1 | LL | pub const Z: u32 = 0 - 1; | ^^^^^^^^^^^^^^^^^^^-----^ @@ -7,7 +7,7 @@ LL | pub const Z: u32 = 0 - 1; | attempt to subtract with overflow | note: lint level defined here - --> $DIR/pub_const_err_bin.rs:12:9 + --> $DIR/pub_const_err_bin.rs:2:9 | LL | #![warn(const_err)] | ^^^^^^^^^ diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.rs b/src/test/ui/consts/const-eval/ref_to_int_match.rs index 2254ed5d9e3..b6a2ed1f9bc 100644 --- a/src/test/ui/consts/const-eval/ref_to_int_match.rs +++ b/src/test/ui/consts/const-eval/ref_to_int_match.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_fn_union)] fn main() { diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.stderr b/src/test/ui/consts/const-eval/ref_to_int_match.stderr index c4bad73eb02..888fe065a62 100644 --- a/src/test/ui/consts/const-eval/ref_to_int_match.stderr +++ b/src/test/ui/consts/const-eval/ref_to_int_match.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/ref_to_int_match.rs:33:1 + --> $DIR/ref_to_int_match.rs:23:1 | LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; //~ ERROR it is undefined behavior to use this value | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes @@ -7,7 +7,7 @@ LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; //~ ERROR it is undefined beh = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error: could not evaluate constant pattern - --> $DIR/ref_to_int_match.rs:17:14 + --> $DIR/ref_to_int_match.rs:7:14 | LL | 10..=BAR => {}, //~ ERROR could not evaluate constant pattern | ^^^ diff --git a/src/test/ui/consts/const-eval/shift_overflow.rs b/src/test/ui/consts/const-eval/shift_overflow.rs index a2c6ed36d30..f7d0f6bd961 100644 --- a/src/test/ui/consts/const-eval/shift_overflow.rs +++ b/src/test/ui/consts/const-eval/shift_overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { // test that we detect overflows for non-u32 discriminants X = 1 << ((u32::max_value() as u64) + 1), //~ ERROR E0080 diff --git a/src/test/ui/consts/const-eval/shift_overflow.stderr b/src/test/ui/consts/const-eval/shift_overflow.stderr index f1d30394d38..e5c34f94d2c 100644 --- a/src/test/ui/consts/const-eval/shift_overflow.stderr +++ b/src/test/ui/consts/const-eval/shift_overflow.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/shift_overflow.rs:13:9 + --> $DIR/shift_overflow.rs:3:9 | LL | X = 1 << ((u32::max_value() as u64) + 1), //~ ERROR E0080 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to shift left with overflow diff --git a/src/test/ui/consts/const-eval/simple_with_undef.rs b/src/test/ui/consts/const-eval/simple_with_undef.rs index d18059fafd5..61398f3a375 100644 --- a/src/test/ui/consts/const-eval/simple_with_undef.rs +++ b/src/test/ui/consts/const-eval/simple_with_undef.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass const PARSE_BOOL: Option<&'static str> = None; diff --git a/src/test/ui/consts/const-eval/strlen.rs b/src/test/ui/consts/const-eval/strlen.rs index dfa41c491fa..6a5cad82c3a 100644 --- a/src/test/ui/consts/const-eval/strlen.rs +++ b/src/test/ui/consts/const-eval/strlen.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(const_str_len, const_str_as_bytes)] diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr index a8ae4436266..90fe7eebe4a 100644 --- a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr +++ b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/transmute-const-promotion.rs:16:37 + --> $DIR/transmute-const-promotion.rs:6:37 | LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) }; | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.rs b/src/test/ui/consts/const-eval/transmute-const-promotion.rs index ea55584f240..a1da3503973 100644 --- a/src/test/ui/consts/const-eval/transmute-const-promotion.rs +++ b/src/test/ui/consts/const-eval/transmute-const-promotion.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_transmute)] use std::mem; diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.stderr b/src/test/ui/consts/const-eval/transmute-const-promotion.stderr index 2f46684b446..996e84de06d 100644 --- a/src/test/ui/consts/const-eval/transmute-const-promotion.stderr +++ b/src/test/ui/consts/const-eval/transmute-const-promotion.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/transmute-const-promotion.rs:16:37 + --> $DIR/transmute-const-promotion.rs:6:37 | LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) }; | ^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/consts/const-eval/transmute-const.rs b/src/test/ui/consts/const-eval/transmute-const.rs index 1d0ac4c98f5..48f2b39832e 100644 --- a/src/test/ui/consts/const-eval/transmute-const.rs +++ b/src/test/ui/consts/const-eval/transmute-const.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_transmute)] use std::mem; diff --git a/src/test/ui/consts/const-eval/transmute-const.stderr b/src/test/ui/consts/const-eval/transmute-const.stderr index cf87170a89d..cacf8636479 100644 --- a/src/test/ui/consts/const-eval/transmute-const.stderr +++ b/src/test/ui/consts/const-eval/transmute-const.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/transmute-const.rs:15:1 + --> $DIR/transmute-const.rs:5:1 | LL | static FOO: bool = unsafe { mem::transmute(3u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3, but expected something less or equal to 1 diff --git a/src/test/ui/consts/const-eval/ub-enum.rs b/src/test/ui/consts/const-eval/ub-enum.rs index 2bf85e25a21..fe8675d326e 100644 --- a/src/test/ui/consts/const-eval/ub-enum.rs +++ b/src/test/ui/consts/const-eval/ub-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(const_err)] // make sure we cannot allow away the errors tested here #[repr(usize)] diff --git a/src/test/ui/consts/const-eval/ub-enum.stderr b/src/test/ui/consts/const-eval/ub-enum.stderr index 509faaa46f8..2bf4cf9bfd6 100644 --- a/src/test/ui/consts/const-eval/ub-enum.stderr +++ b/src/test/ui/consts/const-eval/ub-enum.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:24:1 + --> $DIR/ub-enum.rs:14:1 | LL | const BAD_ENUM: Enum = unsafe { TransmuteEnum { in1: &1 }.out1 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant @@ -7,7 +7,7 @@ LL | const BAD_ENUM: Enum = unsafe { TransmuteEnum { in1: &1 }.out1 }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:44:1 + --> $DIR/ub-enum.rs:34:1 | LL | const BAD_ENUM2: Enum2 = unsafe { TransmuteEnum2 { in1: 0 }.out1 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected a valid enum discriminant @@ -15,7 +15,7 @@ LL | const BAD_ENUM2: Enum2 = unsafe { TransmuteEnum2 { in1: 0 }.out1 }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:46:1 + --> $DIR/ub-enum.rs:36:1 | LL | const BAD_ENUM3: Enum2 = unsafe { TransmuteEnum2 { in2: &0 }.out1 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant @@ -23,7 +23,7 @@ LL | const BAD_ENUM3: Enum2 = unsafe { TransmuteEnum2 { in2: &0 }.out1 }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:48:1 + --> $DIR/ub-enum.rs:38:1 | LL | const BAD_ENUM4: Wrap = unsafe { TransmuteEnum2 { in2: &0 }.out2 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected something that cannot possibly fail to be in the range 2..=2 @@ -31,7 +31,7 @@ LL | const BAD_ENUM4: Wrap = unsafe { TransmuteEnum2 { in2: &0 }.out2 }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:52:1 + --> $DIR/ub-enum.rs:42:1 | LL | const BAD_ENUM_UNDEF : Enum2 = unsafe { TransmuteEnum2 { in3: () }.out1 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a valid enum discriminant @@ -39,7 +39,7 @@ LL | const BAD_ENUM_UNDEF : Enum2 = unsafe { TransmuteEnum2 { in3: () }.out1 }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:56:1 + --> $DIR/ub-enum.rs:46:1 | LL | const BAD_ENUM_PTR: Option = unsafe { TransmuteEnum2 { in2: &0 }.out3 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected a valid enum discriminant @@ -47,7 +47,7 @@ LL | const BAD_ENUM_PTR: Option = unsafe { TransmuteEnum2 { in2: &0 }.out = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-enum.rs:66:1 + --> $DIR/ub-enum.rs:56:1 | LL | const BAD_ENUM_CHAR: Option<(char, char)> = Some(('x', unsafe { TransmuteChar { a: !0 }.b })); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 4294967295 at ..0.1, but expected something less or equal to 1114111 diff --git a/src/test/ui/consts/const-eval/ub-nonnull.rs b/src/test/ui/consts/const-eval/ub-nonnull.rs index 113221959fb..3e0b0948ef3 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.rs +++ b/src/test/ui/consts/const-eval/ub-nonnull.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs, const_transmute)] #![allow(const_err)] // make sure we cannot allow away the errors tested here @@ -23,6 +13,13 @@ const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; //~^ ERROR it is undefined behavior to use this value +union Transmute { + uninit: (), + out: NonZeroU8, +} +const UNINIT: NonZeroU8 = unsafe { Transmute { uninit: () }.out }; +//~^ ERROR it is undefined behavior to use this value + // Also test other uses of rustc_layout_scalar_valid_range_start #[rustc_layout_scalar_valid_range_start(10)] diff --git a/src/test/ui/consts/const-eval/ub-nonnull.stderr b/src/test/ui/consts/const-eval/ub-nonnull.stderr index c50b0208f15..6230712ad6f 100644 --- a/src/test/ui/consts/const-eval/ub-nonnull.stderr +++ b/src/test/ui/consts/const-eval/ub-nonnull.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:18:1 + --> $DIR/ub-nonnull.rs:8:1 | LL | const NULL_PTR: NonNull = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1 @@ -7,7 +7,7 @@ LL | const NULL_PTR: NonNull = unsafe { mem::transmute(0usize) }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:21:1 + --> $DIR/ub-nonnull.rs:11:1 | LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1 @@ -15,7 +15,7 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:23:1 + --> $DIR/ub-nonnull.rs:13:1 | LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1 @@ -23,7 +23,15 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:31:1 + --> $DIR/ub-nonnull.rs:20:1 + | +LL | const UNINIT: NonZeroU8 = unsafe { Transmute { uninit: () }.out }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected something greater or equal to 1 + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior + +error[E0080]: it is undefined behavior to use this value + --> $DIR/ub-nonnull.rs:28:1 | LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 42, but expected something in the range 10..=30 @@ -31,13 +39,13 @@ LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-nonnull.rs:37:1 + --> $DIR/ub-nonnull.rs:34:1 | LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 20, but expected something less or equal to 10, or greater or equal to 30 | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/ub-ref.rs b/src/test/ui/consts/const-eval/ub-ref.rs index c0dd94a375b..3b19f3b0775 100644 --- a/src/test/ui/consts/const-eval/ub-ref.rs +++ b/src/test/ui/consts/const-eval/ub-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_transmute)] #![allow(const_err)] // make sure we cannot allow away the errors tested here diff --git a/src/test/ui/consts/const-eval/ub-ref.stderr b/src/test/ui/consts/const-eval/ub-ref.stderr index fe969d40a2e..f8b5b2f50ce 100644 --- a/src/test/ui/consts/const-eval/ub-ref.stderr +++ b/src/test/ui/consts/const-eval/ub-ref.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref.rs:16:1 + --> $DIR/ub-ref.rs:6:1 | LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered unaligned reference @@ -7,7 +7,7 @@ LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref.rs:19:1 + --> $DIR/ub-ref.rs:9:1 | LL | const NULL: &u16 = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0, but expected something greater or equal to 1 @@ -15,7 +15,7 @@ LL | const NULL: &u16 = unsafe { mem::transmute(0usize) }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref.rs:22:1 + --> $DIR/ub-ref.rs:12:1 | LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes @@ -23,7 +23,7 @@ LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref.rs:25:1 + --> $DIR/ub-ref.rs:15:1 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer at ., but expected plain (non-pointer) bytes @@ -31,7 +31,7 @@ LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref.rs:28:1 + --> $DIR/ub-ref.rs:18:1 | LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered integer pointer in non-ZST reference diff --git a/src/test/ui/consts/const-eval/ub-uninhabit.rs b/src/test/ui/consts/const-eval/ub-uninhabit.rs index 74713af2ea0..42cba02f579 100644 --- a/src/test/ui/consts/const-eval/ub-uninhabit.rs +++ b/src/test/ui/consts/const-eval/ub-uninhabit.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_transmute)] #![allow(const_err)] // make sure we cannot allow away the errors tested here @@ -16,14 +6,18 @@ use std::mem; #[derive(Copy, Clone)] enum Bar {} -const BAD_BAD_BAD: Bar = unsafe { mem::transmute(()) }; +union TransmuteUnion { + a: A, + b: B, +} + +const BAD_BAD_BAD: Bar = unsafe { (TransmuteUnion::<(), Bar> { a: () }).b }; //~^ ERROR it is undefined behavior to use this value const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; //~^ ERROR it is undefined behavior to use this value -const BAD_BAD_ARRAY: [Bar; 1] = unsafe { mem::transmute(()) }; +const BAD_BAD_ARRAY: [Bar; 1] = unsafe { (TransmuteUnion::<(), [Bar; 1]> { a: () }).b }; //~^ ERROR it is undefined behavior to use this value -fn main() { -} +fn main() {} diff --git a/src/test/ui/consts/const-eval/ub-uninhabit.stderr b/src/test/ui/consts/const-eval/ub-uninhabit.stderr index c5ac72b639c..c8842ecc23c 100644 --- a/src/test/ui/consts/const-eval/ub-uninhabit.stderr +++ b/src/test/ui/consts/const-eval/ub-uninhabit.stderr @@ -1,13 +1,13 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-uninhabit.rs:19:1 + --> $DIR/ub-uninhabit.rs:14:1 | -LL | const BAD_BAD_BAD: Bar = unsafe { mem::transmute(()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type +LL | const BAD_BAD_BAD: Bar = unsafe { (TransmuteUnion::<(), Bar> { a: () }).b }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-uninhabit.rs:22:1 + --> $DIR/ub-uninhabit.rs:17:1 | LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type at . @@ -15,10 +15,10 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-uninhabit.rs:25:1 + --> $DIR/ub-uninhabit.rs:20:1 | -LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { mem::transmute(()) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type at [0] +LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { (TransmuteUnion::<(), [Bar; 1]> { a: () }).b }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior diff --git a/src/test/ui/consts/const-eval/ub-upvars.rs b/src/test/ui/consts/const-eval/ub-upvars.rs index 6661de4ab2c..9b7bca6b72d 100644 --- a/src/test/ui/consts/const-eval/ub-upvars.rs +++ b/src/test/ui/consts/const-eval/ub-upvars.rs @@ -1,14 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(const_transmute,const_let)] +#![feature(const_transmute)] #![allow(const_err)] // make sure we cannot allow away the errors tested here use std::mem; diff --git a/src/test/ui/consts/const-eval/ub-upvars.stderr b/src/test/ui/consts/const-eval/ub-upvars.stderr index 3617a53a978..d18339f2434 100644 --- a/src/test/ui/consts/const-eval/ub-upvars.stderr +++ b/src/test/ui/consts/const-eval/ub-upvars.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-upvars.rs:16:1 + --> $DIR/ub-upvars.rs:6:1 | LL | / const BAD_UPVAR: &FnOnce() = &{ //~ ERROR it is undefined behavior to use this value LL | | let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) }; diff --git a/src/test/ui/consts/const-eval/union-const-eval-field.rs b/src/test/ui/consts/const-eval/union-const-eval-field.rs index 2bdad3af889..56f3ef3db25 100644 --- a/src/test/ui/consts/const-eval/union-const-eval-field.rs +++ b/src/test/ui/consts/const-eval/union-const-eval-field.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_fn)] type Field1 = i32; diff --git a/src/test/ui/consts/const-eval/union-const-eval-field.stderr b/src/test/ui/consts/const-eval/union-const-eval-field.stderr index ca7cf2b028c..4a53337341e 100644 --- a/src/test/ui/consts/const-eval/union-const-eval-field.stderr +++ b/src/test/ui/consts/const-eval/union-const-eval-field.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/union-const-eval-field.rs:37:5 + --> $DIR/union-const-eval-field.rs:27:5 | LL | const FIELD3: Field3 = unsafe { UNION.field3 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes diff --git a/src/test/ui/consts/const-eval/union-ice.rs b/src/test/ui/consts/const-eval/union-ice.rs index 6bd63472b21..33736b360d3 100644 --- a/src/test/ui/consts/const-eval/union-ice.rs +++ b/src/test/ui/consts/const-eval/union-ice.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_fn)] type Field1 = i32; diff --git a/src/test/ui/consts/const-eval/union-ice.stderr b/src/test/ui/consts/const-eval/union-ice.stderr index 7cadef24617..3edc5241571 100644 --- a/src/test/ui/consts/const-eval/union-ice.stderr +++ b/src/test/ui/consts/const-eval/union-ice.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ice.rs:23:1 + --> $DIR/union-ice.rs:13:1 | LL | const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR it is undefined behavior to use this value | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes @@ -7,7 +7,7 @@ LL | const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR it is undefined b = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ice.rs:25:1 + --> $DIR/union-ice.rs:15:1 | LL | / const FIELD_PATH: Struct = Struct { //~ ERROR it is undefined behavior to use this value LL | | a: 42, @@ -18,7 +18,7 @@ LL | | }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ice.rs:35:1 + --> $DIR/union-ice.rs:25:1 | LL | / const FIELD_PATH2: Struct2 = Struct2 { //~ ERROR it is undefined behavior to use this value LL | | b: [ diff --git a/src/test/ui/consts/const-eval/union-ub-fat-ptr.rs b/src/test/ui/consts/const-eval/union-ub-fat-ptr.rs index 31540b46631..13489c50a12 100644 --- a/src/test/ui/consts/const-eval/union-ub-fat-ptr.rs +++ b/src/test/ui/consts/const-eval/union-ub-fat-ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] #![allow(const_err)] // make sure we cannot allow away the errors tested here diff --git a/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr b/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr index c21690754f6..761a5fc4445 100644 --- a/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr +++ b/src/test/ui/consts/const-eval/union-ub-fat-ptr.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:88:1 + --> $DIR/union-ub-fat-ptr.rs:78:1 | LL | const B: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.str}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling (not entirely in bounds) reference @@ -7,7 +7,7 @@ LL | const B: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:91:1 + --> $DIR/union-ub-fat-ptr.rs:81:1 | LL | const C: &str = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.str}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in fat pointer @@ -15,7 +15,7 @@ LL | const C: &str = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:94:1 + --> $DIR/union-ub-fat-ptr.rs:84:1 | LL | const C2: &MyStr = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.my_str}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in fat pointer @@ -23,7 +23,7 @@ LL | const C2: &MyStr = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:100:1 + --> $DIR/union-ub-fat-ptr.rs:90:1 | LL | const B2: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.slice}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered dangling (not entirely in bounds) reference @@ -31,7 +31,7 @@ LL | const B2: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:103:1 + --> $DIR/union-ub-fat-ptr.rs:93:1 | LL | const C3: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.slice}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-integer slice length in fat pointer @@ -39,7 +39,7 @@ LL | const C3: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, l = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:107:1 + --> $DIR/union-ub-fat-ptr.rs:97:1 | LL | const D: &Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop fn in vtable @@ -47,7 +47,7 @@ LL | const D: &Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:110:1 + --> $DIR/union-ub-fat-ptr.rs:100:1 | LL | const E: &Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered invalid drop fn in vtable @@ -55,7 +55,7 @@ LL | const E: &Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtabl = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:113:1 + --> $DIR/union-ub-fat-ptr.rs:103:1 | LL | const F: &Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered non-pointer vtable in fat pointer @@ -63,7 +63,7 @@ LL | const F: &Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtabl = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:117:1 + --> $DIR/union-ub-fat-ptr.rs:107:1 | LL | const G: &Trait = &unsafe { BoolTransmute { val: 3 }.bl }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .., but expected something less or equal to 1 @@ -71,7 +71,7 @@ LL | const G: &Trait = &unsafe { BoolTransmute { val: 3 }.bl }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:121:1 + --> $DIR/union-ub-fat-ptr.rs:111:1 | LL | const H: &[bool] = &[unsafe { BoolTransmute { val: 3 }.bl }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at .[0], but expected something less or equal to 1 @@ -79,7 +79,7 @@ LL | const H: &[bool] = &[unsafe { BoolTransmute { val: 3 }.bl }]; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:127:1 + --> $DIR/union-ub-fat-ptr.rs:117:1 | LL | const I2: &MySliceBool = &MySlice(unsafe { BoolTransmute { val: 3 }.bl }, [false]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at ..0, but expected something less or equal to 1 @@ -87,7 +87,7 @@ LL | const I2: &MySliceBool = &MySlice(unsafe { BoolTransmute { val: 3 }.bl }, [ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:130:1 + --> $DIR/union-ub-fat-ptr.rs:120:1 | LL | const I3: &MySliceBool = &MySlice(true, [unsafe { BoolTransmute { val: 3 }.bl }]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 3 at ..1[0], but expected something less or equal to 1 @@ -95,7 +95,7 @@ LL | const I3: &MySliceBool = &MySlice(true, [unsafe { BoolTransmute { val: 3 }. = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:134:1 + --> $DIR/union-ub-fat-ptr.rs:124:1 | LL | const J1: &str = unsafe { SliceTransmute { slice: &[0xFF] }.str }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized or non-UTF-8 data in str at . @@ -103,7 +103,7 @@ LL | const J1: &str = unsafe { SliceTransmute { slice: &[0xFF] }.str }; = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub-fat-ptr.rs:137:1 + --> $DIR/union-ub-fat-ptr.rs:127:1 | LL | const J2: &MyStr = unsafe { SliceTransmute { slice: &[0xFF] }.my_str }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized or non-UTF-8 data in str at ..0 diff --git a/src/test/ui/consts/const-eval/union-ub.rs b/src/test/ui/consts/const-eval/union-ub.rs index 712147b52e9..cf436141c5a 100644 --- a/src/test/ui/consts/const-eval/union-ub.rs +++ b/src/test/ui/consts/const-eval/union-ub.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(const_err)] // make sure we cannot allow away the errors tested here union DummyUnion { diff --git a/src/test/ui/consts/const-eval/union-ub.stderr b/src/test/ui/consts/const-eval/union-ub.stderr index db78ead370b..7baa55be6e1 100644 --- a/src/test/ui/consts/const-eval/union-ub.stderr +++ b/src/test/ui/consts/const-eval/union-ub.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/union-ub.rs:38:1 + --> $DIR/union-ub.rs:28:1 | LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 42, but expected something less or equal to 1 diff --git a/src/test/ui/consts/const-eval/union_promotion.nll.stderr b/src/test/ui/consts/const-eval/union_promotion.nll.stderr index 60ce75a6f9b..11bc7f9da35 100644 --- a/src/test/ui/consts/const-eval/union_promotion.nll.stderr +++ b/src/test/ui/consts/const-eval/union_promotion.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/union_promotion.rs:19:29 + --> $DIR/union_promotion.rs:9:29 | LL | let x: &'static bool = &unsafe { //~ borrowed value does not live long enough | ____________-------------____^ diff --git a/src/test/ui/consts/const-eval/union_promotion.rs b/src/test/ui/consts/const-eval/union_promotion.rs index 714d7a4fc8b..c308c81cf64 100644 --- a/src/test/ui/consts/const-eval/union_promotion.rs +++ b/src/test/ui/consts/const-eval/union_promotion.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(const_err)] union Foo { diff --git a/src/test/ui/consts/const-eval/union_promotion.stderr b/src/test/ui/consts/const-eval/union_promotion.stderr index b4aa91f2de7..643c784ca08 100644 --- a/src/test/ui/consts/const-eval/union_promotion.stderr +++ b/src/test/ui/consts/const-eval/union_promotion.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/union_promotion.rs:19:29 + --> $DIR/union_promotion.rs:9:29 | LL | let x: &'static bool = &unsafe { //~ borrowed value does not live long enough | _____________________________^ diff --git a/src/test/ui/consts/const-eval/unused-broken-const.rs b/src/test/ui/consts/const-eval/unused-broken-const.rs index 53ce82f8e87..56b16e224e5 100644 --- a/src/test/ui/consts/const-eval/unused-broken-const.rs +++ b/src/test/ui/consts/const-eval/unused-broken-const.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // make sure that an *unused* broken const triggers an error even in a check build // compile-flags: --emit=dep-info,metadata diff --git a/src/test/ui/consts/const-eval/unused-broken-const.stderr b/src/test/ui/consts/const-eval/unused-broken-const.stderr index 5fb2a3722e2..c0061f8b30c 100644 --- a/src/test/ui/consts/const-eval/unused-broken-const.stderr +++ b/src/test/ui/consts/const-eval/unused-broken-const.stderr @@ -1,7 +1,7 @@ warning: due to multiple output types requested, the explicitly specified output file name will be adapted for each output type error: any use of this value will cause an error - --> $DIR/unused-broken-const.rs:15:1 + --> $DIR/unused-broken-const.rs:5:1 | LL | const FOO: i32 = [][0]; | ^^^^^^^^^^^^^^^^^-----^ diff --git a/src/test/ui/consts/const-expr-addr-operator.rs b/src/test/ui/consts/const-expr-addr-operator.rs index f51cce5d4e0..dc9f292c2b8 100644 --- a/src/test/ui/consts/const-expr-addr-operator.rs +++ b/src/test/ui/consts/const-expr-addr-operator.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Encountered while testing #44614. // compile-pass diff --git a/src/test/ui/consts/const-fn-destructuring-arg.rs b/src/test/ui/consts/const-fn-destructuring-arg.rs index fce1688716d..dcf89f90e31 100644 --- a/src/test/ui/consts/const-fn-destructuring-arg.rs +++ b/src/test/ui/consts/const-fn-destructuring-arg.rs @@ -1,27 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// compile-pass -// test that certain things are disallowed in constant functions - -#![feature(const_fn)] - -// no destructuring -const fn i(( - a, - //~^ ERROR arguments of constant functions can only be immutable by-value bindings - b - //~^ ERROR arguments of constant functions can only be immutable by-value bindings - ): (u32, u32)) -> u32 { +const fn i((a, b): (u32, u32)) -> u32 { a + b - //~^ ERROR let bindings in constant functions are unstable - //~| ERROR let bindings in constant functions are unstable } fn main() {} diff --git a/src/test/ui/consts/const-fn-destructuring-arg.stderr b/src/test/ui/consts/const-fn-destructuring-arg.stderr deleted file mode 100644 index 029d63a7720..00000000000 --- a/src/test/ui/consts/const-fn-destructuring-arg.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0658]: arguments of constant functions can only be immutable by-value bindings (see issue #48821) - --> $DIR/const-fn-destructuring-arg.rs:17:13 - | -LL | a, - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: arguments of constant functions can only be immutable by-value bindings (see issue #48821) - --> $DIR/const-fn-destructuring-arg.rs:19:13 - | -LL | b - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constant functions are unstable (see issue #48821) - --> $DIR/const-fn-destructuring-arg.rs:22:5 - | -LL | a + b - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constant functions are unstable (see issue #48821) - --> $DIR/const-fn-destructuring-arg.rs:22:9 - | -LL | a + b - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/const-fn-mismatch.rs b/src/test/ui/consts/const-fn-mismatch.rs index 4e1fa6bd186..5bd274fe66b 100644 --- a/src/test/ui/consts/const-fn-mismatch.rs +++ b/src/test/ui/consts/const-fn-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can't declare a const fn in an impl -- right now it's // just not allowed at all, though eventually it'd make sense to allow // it if the trait fn is const (but right now no trait fns can be diff --git a/src/test/ui/consts/const-fn-mismatch.stderr b/src/test/ui/consts/const-fn-mismatch.stderr index 1c9728fec9e..03bb7c6e8d6 100644 --- a/src/test/ui/consts/const-fn-mismatch.stderr +++ b/src/test/ui/consts/const-fn-mismatch.stderr @@ -1,5 +1,5 @@ error[E0379]: trait fns cannot be declared const - --> $DIR/const-fn-mismatch.rs:23:5 + --> $DIR/const-fn-mismatch.rs:13:5 | LL | const fn f() -> u32 { 22 } | ^^^^^ trait fns cannot be const diff --git a/src/test/ui/consts/const-fn-not-in-trait.rs b/src/test/ui/consts/const-fn-not-in-trait.rs index 1877929173d..3975c22c56e 100644 --- a/src/test/ui/consts/const-fn-not-in-trait.rs +++ b/src/test/ui/consts/const-fn-not-in-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that const fn is illegal in a trait declaration, whether or // not a default is provided. diff --git a/src/test/ui/consts/const-fn-not-in-trait.stderr b/src/test/ui/consts/const-fn-not-in-trait.stderr index 5801f701ff8..6821a6c2bc6 100644 --- a/src/test/ui/consts/const-fn-not-in-trait.stderr +++ b/src/test/ui/consts/const-fn-not-in-trait.stderr @@ -1,11 +1,11 @@ error[E0379]: trait fns cannot be declared const - --> $DIR/const-fn-not-in-trait.rs:17:5 + --> $DIR/const-fn-not-in-trait.rs:7:5 | LL | const fn f() -> u32; | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const - --> $DIR/const-fn-not-in-trait.rs:19:5 + --> $DIR/const-fn-not-in-trait.rs:9:5 | LL | const fn g() -> u32 { 0 } | ^^^^^ trait fns cannot be const diff --git a/src/test/ui/consts/const-fn-not-safe-for-const.rs b/src/test/ui/consts/const-fn-not-safe-for-const.rs index 30a738a83a3..085ff5c58e6 100644 --- a/src/test/ui/consts/const-fn-not-safe-for-const.rs +++ b/src/test/ui/consts/const-fn-not-safe-for-const.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can't call random fns in a const fn or do other bad things. #![feature(const_fn, const_transmute)] @@ -38,14 +28,8 @@ const fn get_Y_addr() -> &'static u32 { const fn get() -> u32 { let x = 22; - //~^ ERROR let bindings in constant functions are unstable - //~| ERROR statements in constant functions are unstable let y = 44; - //~^ ERROR let bindings in constant functions are unstable - //~| ERROR statements in constant functions are unstable x + y - //~^ ERROR let bindings in constant functions are unstable - //~| ERROR let bindings in constant functions are unstable } fn main() {} diff --git a/src/test/ui/consts/const-fn-not-safe-for-const.stderr b/src/test/ui/consts/const-fn-not-safe-for-const.stderr index 613670acc93..2003b137c27 100644 --- a/src/test/ui/consts/const-fn-not-safe-for-const.stderr +++ b/src/test/ui/consts/const-fn-not-safe-for-const.stderr @@ -1,70 +1,22 @@ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants - --> $DIR/const-fn-not-safe-for-const.rs:24:5 + --> $DIR/const-fn-not-safe-for-const.rs:14:5 | LL | random() //~ ERROR E0015 | ^^^^^^^^ error[E0013]: constant functions cannot refer to statics, use a constant instead - --> $DIR/const-fn-not-safe-for-const.rs:30:5 + --> $DIR/const-fn-not-safe-for-const.rs:20:5 | LL | Y | ^ error[E0013]: constant functions cannot refer to statics, use a constant instead - --> $DIR/const-fn-not-safe-for-const.rs:35:5 + --> $DIR/const-fn-not-safe-for-const.rs:25:5 | LL | &Y | ^^ -error[E0658]: let bindings in constant functions are unstable (see issue #48821) - --> $DIR/const-fn-not-safe-for-const.rs:40:13 - | -LL | let x = 22; - | ^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constant functions are unstable (see issue #48821) - --> $DIR/const-fn-not-safe-for-const.rs:40:13 - | -LL | let x = 22; - | ^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constant functions are unstable (see issue #48821) - --> $DIR/const-fn-not-safe-for-const.rs:43:13 - | -LL | let y = 44; - | ^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constant functions are unstable (see issue #48821) - --> $DIR/const-fn-not-safe-for-const.rs:43:13 - | -LL | let y = 44; - | ^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constant functions are unstable (see issue #48821) - --> $DIR/const-fn-not-safe-for-const.rs:46:5 - | -LL | x + y - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constant functions are unstable (see issue #48821) - --> $DIR/const-fn-not-safe-for-const.rs:46:9 - | -LL | x + y - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error: aborting due to 9 previous errors +error: aborting due to 3 previous errors -Some errors occurred: E0013, E0015, E0658. +Some errors occurred: E0013, E0015. For more information about an error, try `rustc --explain E0013`. diff --git a/src/test/ui/consts/const-fn-stability-calls-3.rs b/src/test/ui/consts/const-fn-stability-calls-3.rs index 031576dd308..44bcca8d802 100644 --- a/src/test/ui/consts/const-fn-stability-calls-3.rs +++ b/src/test/ui/consts/const-fn-stability-calls-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test use of const fn from another crate without a feature gate. // compile-pass diff --git a/src/test/ui/consts/const-int-conversion.nll.stderr b/src/test/ui/consts/const-int-conversion.nll.stderr index fbf0803214b..afc051013ed 100644 --- a/src/test/ui/consts/const-int-conversion.nll.stderr +++ b/src/test/ui/consts/const-int-conversion.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-conversion.rs:14:28 + --> $DIR/const-int-conversion.rs:4:28 | LL | let x: &'static i32 = &(5_i32.reverse_bits()); | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -10,7 +10,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-conversion.rs:16:28 + --> $DIR/const-int-conversion.rs:6:28 | LL | let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78])); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -21,7 +21,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-conversion.rs:18:28 + --> $DIR/const-int-conversion.rs:8:28 | LL | let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78])); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -32,7 +32,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-conversion.rs:20:28 + --> $DIR/const-int-conversion.rs:10:28 | LL | let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0]))); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -43,7 +43,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-conversion.rs:22:29 + --> $DIR/const-int-conversion.rs:12:29 | LL | let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes()); | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -54,7 +54,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-conversion.rs:24:29 + --> $DIR/const-int-conversion.rs:14:29 | LL | let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes()); | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -65,7 +65,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-conversion.rs:26:29 + --> $DIR/const-int-conversion.rs:16:29 | LL | let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes()); | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-int-conversion.rs b/src/test/ui/consts/const-int-conversion.rs index 0abe6b4a1e4..8f0aa141a9d 100644 --- a/src/test/ui/consts/const-int-conversion.rs +++ b/src/test/ui/consts/const-int-conversion.rs @@ -1,14 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(reverse_bits, int_to_from_bytes)] +#![feature(reverse_bits)] fn main() { let x: &'static i32 = &(5_i32.reverse_bits()); diff --git a/src/test/ui/consts/const-int-conversion.stderr b/src/test/ui/consts/const-int-conversion.stderr index fc2472a7b58..b216d41727b 100644 --- a/src/test/ui/consts/const-int-conversion.stderr +++ b/src/test/ui/consts/const-int-conversion.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-conversion.rs:14:28 + --> $DIR/const-int-conversion.rs:4:28 | LL | let x: &'static i32 = &(5_i32.reverse_bits()); | ^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-conversion.rs:16:28 + --> $DIR/const-int-conversion.rs:6:28 | LL | let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78])); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -21,7 +21,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-conversion.rs:18:28 + --> $DIR/const-int-conversion.rs:8:28 | LL | let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78])); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -32,7 +32,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-conversion.rs:20:28 + --> $DIR/const-int-conversion.rs:10:28 | LL | let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0]))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -43,7 +43,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-conversion.rs:22:29 + --> $DIR/const-int-conversion.rs:12:29 | LL | let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -54,7 +54,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-conversion.rs:24:29 + --> $DIR/const-int-conversion.rs:14:29 | LL | let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -65,7 +65,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-conversion.rs:26:29 + --> $DIR/const-int-conversion.rs:16:29 | LL | let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/consts/const-int-overflowing.nll.stderr b/src/test/ui/consts/const-int-overflowing.nll.stderr index 64ea01dd1d6..ffcac69c1af 100644 --- a/src/test/ui/consts/const-int-overflowing.nll.stderr +++ b/src/test/ui/consts/const-int-overflowing.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-overflowing.rs:12:36 + --> $DIR/const-int-overflowing.rs:2:36 | LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); //~ ERROR does not live long enough | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -10,7 +10,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-overflowing.rs:13:36 + --> $DIR/const-int-overflowing.rs:3:36 | LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); //~ ERROR does not live long enough | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -21,7 +21,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-overflowing.rs:14:36 + --> $DIR/const-int-overflowing.rs:4:36 | LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-int-overflowing.rs b/src/test/ui/consts/const-int-overflowing.rs index 7bff6b9adb0..4e69e857806 100644 --- a/src/test/ui/consts/const-int-overflowing.rs +++ b/src/test/ui/consts/const-int-overflowing.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); //~ ERROR does not live long enough let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); //~ ERROR does not live long enough diff --git a/src/test/ui/consts/const-int-overflowing.stderr b/src/test/ui/consts/const-int-overflowing.stderr index e06fb6af1a6..736909e0932 100644 --- a/src/test/ui/consts/const-int-overflowing.stderr +++ b/src/test/ui/consts/const-int-overflowing.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-overflowing.rs:12:36 + --> $DIR/const-int-overflowing.rs:2:36 | LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-overflowing.rs:13:36 + --> $DIR/const-int-overflowing.rs:3:36 | LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -21,7 +21,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-overflowing.rs:14:36 + --> $DIR/const-int-overflowing.rs:4:36 | LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/consts/const-int-rotate.nll.stderr b/src/test/ui/consts/const-int-rotate.nll.stderr index a8a7973bc03..9923096f46d 100644 --- a/src/test/ui/consts/const-int-rotate.nll.stderr +++ b/src/test/ui/consts/const-int-rotate.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-rotate.rs:12:28 + --> $DIR/const-int-rotate.rs:2:28 | LL | let x: &'static i32 = &(5_i32.rotate_left(3)); //~ ERROR does not live long enough | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -10,7 +10,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-rotate.rs:13:28 + --> $DIR/const-int-rotate.rs:3:28 | LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-int-rotate.rs b/src/test/ui/consts/const-int-rotate.rs index e6f05338c84..d07c00e0110 100644 --- a/src/test/ui/consts/const-int-rotate.rs +++ b/src/test/ui/consts/const-int-rotate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: &'static i32 = &(5_i32.rotate_left(3)); //~ ERROR does not live long enough let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough diff --git a/src/test/ui/consts/const-int-rotate.stderr b/src/test/ui/consts/const-int-rotate.stderr index fa2f6255e01..c15727961f9 100644 --- a/src/test/ui/consts/const-int-rotate.stderr +++ b/src/test/ui/consts/const-int-rotate.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-rotate.rs:12:28 + --> $DIR/const-int-rotate.rs:2:28 | LL | let x: &'static i32 = &(5_i32.rotate_left(3)); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-rotate.rs:13:28 + --> $DIR/const-int-rotate.rs:3:28 | LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/consts/const-int-sign.nll.stderr b/src/test/ui/consts/const-int-sign.nll.stderr index afc994457b6..43fd002ff3a 100644 --- a/src/test/ui/consts/const-int-sign.nll.stderr +++ b/src/test/ui/consts/const-int-sign.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-sign.rs:12:29 + --> $DIR/const-int-sign.rs:2:29 | LL | let x: &'static bool = &(5_i32.is_negative()); //~ ERROR does not live long enough | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -10,7 +10,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-sign.rs:13:29 + --> $DIR/const-int-sign.rs:3:29 | LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-int-sign.rs b/src/test/ui/consts/const-int-sign.rs index 1082c385cd4..a21797c5ce4 100644 --- a/src/test/ui/consts/const-int-sign.rs +++ b/src/test/ui/consts/const-int-sign.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: &'static bool = &(5_i32.is_negative()); //~ ERROR does not live long enough let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough diff --git a/src/test/ui/consts/const-int-sign.stderr b/src/test/ui/consts/const-int-sign.stderr index 1d456287bd8..5a9a23af9d6 100644 --- a/src/test/ui/consts/const-int-sign.stderr +++ b/src/test/ui/consts/const-int-sign.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-sign.rs:12:29 + --> $DIR/const-int-sign.rs:2:29 | LL | let x: &'static bool = &(5_i32.is_negative()); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-sign.rs:13:29 + --> $DIR/const-int-sign.rs:3:29 | LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/consts/const-int-unchecked.rs b/src/test/ui/consts/const-int-unchecked.rs index cbf855633fd..8ee029b6cc3 100644 --- a/src/test/ui/consts/const-int-unchecked.rs +++ b/src/test/ui/consts/const-int-unchecked.rs @@ -1,21 +1,120 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(core_intrinsics)] use std::intrinsics; -const SHR: u8 = unsafe { intrinsics::unchecked_shr(5_u8, 8) }; -//^~ ERROR: Overflowing shift by 8 in unchecked_shr -const SHL: u8 = unsafe { intrinsics::unchecked_shl(5_u8, 8) }; -//^~ ERROR: Overflowing shift by 8 in unchecked_shl +// The documentation of `unchecked_shl` states that it: +// +// Performs an unchecked left shift, resulting in undefined behavior when +// y < 0 or y >= N, where N is the width of T in bits. +// +// So we check this for a few `y`. + +// unsigned types: + +const SHL_U8: u8 = unsafe { intrinsics::unchecked_shl(5_u8, 8) }; +//~^ ERROR any use of this value will cause an error +const SHL_U16: u16 = unsafe { intrinsics::unchecked_shl(5_u16, 16) }; +//~^ ERROR any use of this value will cause an error +const SHL_U32: u32 = unsafe { intrinsics::unchecked_shl(5_u32, 32) }; +//~^ ERROR any use of this value will cause an error +const SHL_U64: u64 = unsafe { intrinsics::unchecked_shl(5_u64, 64) }; +//~^ ERROR any use of this value will cause an error +const SHL_U128: u128 = unsafe { intrinsics::unchecked_shl(5_u128, 128) }; +//~^ ERROR any use of this value will cause an error + +// signed types: + +const SHL_I8: i8 = unsafe { intrinsics::unchecked_shl(5_i8, 8) }; +//~^ ERROR any use of this value will cause an error +const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_16, 16) }; +//~^ ERROR any use of this value will cause an error +const SHL_I32: i32 = unsafe { intrinsics::unchecked_shl(5_i32, 32) }; +//~^ ERROR any use of this value will cause an error +const SHL_I64: i64 = unsafe { intrinsics::unchecked_shl(5_i64, 64) }; +//~^ ERROR any use of this value will cause an error +const SHL_I128: i128 = unsafe { intrinsics::unchecked_shl(5_i128, 128) }; +//~^ ERROR any use of this value will cause an error + +// and make sure we capture y < 0: + +const SHL_I8_NEG: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -1) }; +//~^ ERROR any use of this value will cause an error +const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_16, -1) }; +//~^ ERROR any use of this value will cause an error +const SHL_I32_NEG: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -1) }; +//~^ ERROR any use of this value will cause an error +const SHL_I64_NEG: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -1) }; +//~^ ERROR any use of this value will cause an error +const SHL_I128_NEG: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -1) }; +//~^ ERROR any use of this value will cause an error + +// and that there's no special relation to the value -1 by picking some +// negative values at random: + +const SHL_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -6) }; +//~^ ERROR any use of this value will cause an error +const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_16, -13) }; +//~^ ERROR any use of this value will cause an error +const SHL_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -25) }; +//~^ ERROR any use of this value will cause an error +const SHL_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -30) }; +//~^ ERROR any use of this value will cause an error +const SHL_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -93) }; +//~^ ERROR any use of this value will cause an error + +// Repeat it all over for `unchecked_shr` + +// unsigned types: + +const SHR_U8: u8 = unsafe { intrinsics::unchecked_shr(5_u8, 8) }; +//~^ ERROR any use of this value will cause an error +const SHR_U16: u16 = unsafe { intrinsics::unchecked_shr(5_u16, 16) }; +//~^ ERROR any use of this value will cause an error +const SHR_U32: u32 = unsafe { intrinsics::unchecked_shr(5_u32, 32) }; +//~^ ERROR any use of this value will cause an error +const SHR_U64: u64 = unsafe { intrinsics::unchecked_shr(5_u64, 64) }; +//~^ ERROR any use of this value will cause an error +const SHR_U128: u128 = unsafe { intrinsics::unchecked_shr(5_u128, 128) }; +//~^ ERROR any use of this value will cause an error + +// signed types: + +const SHR_I8: i8 = unsafe { intrinsics::unchecked_shr(5_i8, 8) }; +//~^ ERROR any use of this value will cause an error +const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_16, 16) }; +//~^ ERROR any use of this value will cause an error +const SHR_I32: i32 = unsafe { intrinsics::unchecked_shr(5_i32, 32) }; +//~^ ERROR any use of this value will cause an error +const SHR_I64: i64 = unsafe { intrinsics::unchecked_shr(5_i64, 64) }; +//~^ ERROR any use of this value will cause an error +const SHR_I128: i128 = unsafe { intrinsics::unchecked_shr(5_i128, 128) }; +//~^ ERROR any use of this value will cause an error + +// and make sure we capture y < 0: + +const SHR_I8_NEG: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -1) }; +//~^ ERROR any use of this value will cause an error +const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_16, -1) }; +//~^ ERROR any use of this value will cause an error +const SHR_I32_NEG: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -1) }; +//~^ ERROR any use of this value will cause an error +const SHR_I64_NEG: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -1) }; +//~^ ERROR any use of this value will cause an error +const SHR_I128_NEG: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -1) }; +//~^ ERROR any use of this value will cause an error + +// and that there's no special relation to the value -1 by picking some +// negative values at random: + +const SHR_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -6) }; +//~^ ERROR any use of this value will cause an error +const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_16, -13) }; +//~^ ERROR any use of this value will cause an error +const SHR_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -25) }; +//~^ ERROR any use of this value will cause an error +const SHR_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -30) }; +//~^ ERROR any use of this value will cause an error +const SHR_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -93) }; +//~^ ERROR any use of this value will cause an error -fn main() { -} +fn main() {} diff --git a/src/test/ui/consts/const-int-unchecked.stderr b/src/test/ui/consts/const-int-unchecked.stderr index 314a3e488a1..4382d9174b7 100644 --- a/src/test/ui/consts/const-int-unchecked.stderr +++ b/src/test/ui/consts/const-int-unchecked.stderr @@ -1,20 +1,324 @@ error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:15:1 + --> $DIR/const-int-unchecked.rs:14:1 | -LL | const SHR: u8 = unsafe { intrinsics::unchecked_shr(5_u8, 8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^ - | | - | Overflowing shift by 8 in unchecked_shr +LL | const SHL_U8: u8 = unsafe { intrinsics::unchecked_shl(5_u8, 8) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^ + | | + | Overflowing shift by 8 in unchecked_shl | = note: #[deny(const_err)] on by default error: any use of this value will cause an error - --> $DIR/const-int-unchecked.rs:17:1 + --> $DIR/const-int-unchecked.rs:16:1 | -LL | const SHL: u8 = unsafe { intrinsics::unchecked_shl(5_u8, 8) }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^ - | | - | Overflowing shift by 8 in unchecked_shl +LL | const SHL_U16: u16 = unsafe { intrinsics::unchecked_shl(5_u16, 16) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 16 in unchecked_shl -error: aborting due to 2 previous errors +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:18:1 + | +LL | const SHL_U32: u32 = unsafe { intrinsics::unchecked_shl(5_u32, 32) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 32 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:20:1 + | +LL | const SHL_U64: u64 = unsafe { intrinsics::unchecked_shl(5_u64, 64) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 64 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:22:1 + | +LL | const SHL_U128: u128 = unsafe { intrinsics::unchecked_shl(5_u128, 128) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------------^^^ + | | + | Overflowing shift by 128 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:27:1 + | +LL | const SHL_I8: i8 = unsafe { intrinsics::unchecked_shl(5_i8, 8) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^ + | | + | Overflowing shift by 8 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:29:1 + | +LL | const SHL_I16: i16 = unsafe { intrinsics::unchecked_shl(5_16, 16) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^ + | | + | Overflowing shift by 16 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:31:1 + | +LL | const SHL_I32: i32 = unsafe { intrinsics::unchecked_shl(5_i32, 32) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 32 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:33:1 + | +LL | const SHL_I64: i64 = unsafe { intrinsics::unchecked_shl(5_i64, 64) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 64 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:35:1 + | +LL | const SHL_I128: i128 = unsafe { intrinsics::unchecked_shl(5_i128, 128) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------------^^^ + | | + | Overflowing shift by 128 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:40:1 + | +LL | const SHL_I8_NEG: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^ + | | + | Overflowing shift by 255 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:42:1 + | +LL | const SHL_I16_NEG: i16 = unsafe { intrinsics::unchecked_shl(5_16, -1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^ + | | + | Overflowing shift by 65535 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:44:1 + | +LL | const SHL_I32_NEG: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 4294967295 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:46:1 + | +LL | const SHL_I64_NEG: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 18446744073709551615 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:48:1 + | +LL | const SHL_I128_NEG: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------------^^^ + | | + | Overflowing shift by 340282366920938463463374607431768211455 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:54:1 + | +LL | const SHL_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shl(5_i8, -6) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^ + | | + | Overflowing shift by 250 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:56:1 + | +LL | const SHL_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shl(5_16, -13) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 65523 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:58:1 + | +LL | const SHL_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shl(5_i32, -25) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------------^^^ + | | + | Overflowing shift by 4294967271 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:60:1 + | +LL | const SHL_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shl(5_i64, -30) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------------^^^ + | | + | Overflowing shift by 18446744073709551586 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:62:1 + | +LL | const SHL_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shl(5_i128, -93) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------------^^^ + | | + | Overflowing shift by 340282366920938463463374607431768211363 in unchecked_shl + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:69:1 + | +LL | const SHR_U8: u8 = unsafe { intrinsics::unchecked_shr(5_u8, 8) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^ + | | + | Overflowing shift by 8 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:71:1 + | +LL | const SHR_U16: u16 = unsafe { intrinsics::unchecked_shr(5_u16, 16) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 16 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:73:1 + | +LL | const SHR_U32: u32 = unsafe { intrinsics::unchecked_shr(5_u32, 32) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 32 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:75:1 + | +LL | const SHR_U64: u64 = unsafe { intrinsics::unchecked_shr(5_u64, 64) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 64 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:77:1 + | +LL | const SHR_U128: u128 = unsafe { intrinsics::unchecked_shr(5_u128, 128) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------------^^^ + | | + | Overflowing shift by 128 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:82:1 + | +LL | const SHR_I8: i8 = unsafe { intrinsics::unchecked_shr(5_i8, 8) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^ + | | + | Overflowing shift by 8 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:84:1 + | +LL | const SHR_I16: i16 = unsafe { intrinsics::unchecked_shr(5_16, 16) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^ + | | + | Overflowing shift by 16 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:86:1 + | +LL | const SHR_I32: i32 = unsafe { intrinsics::unchecked_shr(5_i32, 32) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 32 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:88:1 + | +LL | const SHR_I64: i64 = unsafe { intrinsics::unchecked_shr(5_i64, 64) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 64 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:90:1 + | +LL | const SHR_I128: i128 = unsafe { intrinsics::unchecked_shr(5_i128, 128) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------------^^^ + | | + | Overflowing shift by 128 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:95:1 + | +LL | const SHR_I8_NEG: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^ + | | + | Overflowing shift by 255 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:97:1 + | +LL | const SHR_I16_NEG: i16 = unsafe { intrinsics::unchecked_shr(5_16, -1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^ + | | + | Overflowing shift by 65535 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:99:1 + | +LL | const SHR_I32_NEG: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 4294967295 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:101:1 + | +LL | const SHR_I64_NEG: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 18446744073709551615 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:103:1 + | +LL | const SHR_I128_NEG: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -1) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------------^^^ + | | + | Overflowing shift by 340282366920938463463374607431768211455 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:109:1 + | +LL | const SHR_I8_NEG_RANDOM: i8 = unsafe { intrinsics::unchecked_shr(5_i8, -6) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^ + | | + | Overflowing shift by 250 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:111:1 + | +LL | const SHR_I16_NEG_RANDOM: i16 = unsafe { intrinsics::unchecked_shr(5_16, -13) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ + | | + | Overflowing shift by 65523 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:113:1 + | +LL | const SHR_I32_NEG_RANDOM: i32 = unsafe { intrinsics::unchecked_shr(5_i32, -25) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------------^^^ + | | + | Overflowing shift by 4294967271 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:115:1 + | +LL | const SHR_I64_NEG_RANDOM: i64 = unsafe { intrinsics::unchecked_shr(5_i64, -30) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------------^^^ + | | + | Overflowing shift by 18446744073709551586 in unchecked_shr + +error: any use of this value will cause an error + --> $DIR/const-int-unchecked.rs:117:1 + | +LL | const SHR_I128_NEG_RANDOM: i128 = unsafe { intrinsics::unchecked_shr(5_i128, -93) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------------^^^ + | | + | Overflowing shift by 340282366920938463463374607431768211363 in unchecked_shr + +error: aborting due to 40 previous errors diff --git a/src/test/ui/consts/const-int-wrapping.nll.stderr b/src/test/ui/consts/const-int-wrapping.nll.stderr index 4f89c79b83b..036c8b9d95e 100644 --- a/src/test/ui/consts/const-int-wrapping.nll.stderr +++ b/src/test/ui/consts/const-int-wrapping.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-wrapping.rs:12:28 + --> $DIR/const-int-wrapping.rs:2:28 | LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); //~ ERROR does not live long enough | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -10,7 +10,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-wrapping.rs:13:28 + --> $DIR/const-int-wrapping.rs:3:28 | LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); //~ ERROR does not live long enough | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -21,7 +21,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-wrapping.rs:14:28 + --> $DIR/const-int-wrapping.rs:4:28 | LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); //~ ERROR does not live long enough | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -32,7 +32,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-wrapping.rs:15:28 + --> $DIR/const-int-wrapping.rs:5:28 | LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); //~ ERROR does not live long enough | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use @@ -43,7 +43,7 @@ LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed - --> $DIR/const-int-wrapping.rs:16:28 + --> $DIR/const-int-wrapping.rs:6:28 | LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/consts/const-int-wrapping.rs b/src/test/ui/consts/const-int-wrapping.rs index bd11d5df232..720e40b6ebd 100644 --- a/src/test/ui/consts/const-int-wrapping.rs +++ b/src/test/ui/consts/const-int-wrapping.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: &'static i32 = &(5_i32.wrapping_add(3)); //~ ERROR does not live long enough let y: &'static i32 = &(5_i32.wrapping_sub(3)); //~ ERROR does not live long enough diff --git a/src/test/ui/consts/const-int-wrapping.stderr b/src/test/ui/consts/const-int-wrapping.stderr index 94974e09939..ec9776b8211 100644 --- a/src/test/ui/consts/const-int-wrapping.stderr +++ b/src/test/ui/consts/const-int-wrapping.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-wrapping.rs:12:28 + --> $DIR/const-int-wrapping.rs:2:28 | LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-wrapping.rs:13:28 + --> $DIR/const-int-wrapping.rs:3:28 | LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -21,7 +21,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-wrapping.rs:14:28 + --> $DIR/const-int-wrapping.rs:4:28 | LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -32,7 +32,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-wrapping.rs:15:28 + --> $DIR/const-int-wrapping.rs:5:28 | LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -43,7 +43,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/const-int-wrapping.rs:16:28 + --> $DIR/const-int-wrapping.rs:6:28 | LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/consts/const-integer-bool-ops.rs b/src/test/ui/consts/const-integer-bool-ops.rs index 5f0829eb358..f0d5a558e35 100644 --- a/src/test/ui/consts/const-integer-bool-ops.rs +++ b/src/test/ui/consts/const-integer-bool-ops.rs @@ -1,18 +1,8 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const X: usize = 42 && 39; //~^ ERROR mismatched types -//~| expected bool, found integral variable +//~| expected bool, found integer //~| ERROR mismatched types -//~| expected bool, found integral variable +//~| expected bool, found integer //~| ERROR mismatched types //~| expected usize, found bool const ARR: [i32; X] = [99; 34]; @@ -20,9 +10,9 @@ const ARR: [i32; X] = [99; 34]; const X1: usize = 42 || 39; //~^ ERROR mismatched types -//~| expected bool, found integral variable +//~| expected bool, found integer //~| ERROR mismatched types -//~| expected bool, found integral variable +//~| expected bool, found integer //~| ERROR mismatched types //~| expected usize, found bool const ARR1: [i32; X1] = [99; 47]; @@ -30,9 +20,9 @@ const ARR1: [i32; X1] = [99; 47]; const X2: usize = -42 || -39; //~^ ERROR mismatched types -//~| expected bool, found integral variable +//~| expected bool, found integer //~| ERROR mismatched types -//~| expected bool, found integral variable +//~| expected bool, found integer //~| ERROR mismatched types //~| expected usize, found bool const ARR2: [i32; X2] = [99; 18446744073709551607]; @@ -40,9 +30,9 @@ const ARR2: [i32; X2] = [99; 18446744073709551607]; const X3: usize = -42 && -39; //~^ ERROR mismatched types -//~| expected bool, found integral variable +//~| expected bool, found integer //~| ERROR mismatched types -//~| expected bool, found integral variable +//~| expected bool, found integer //~| ERROR mismatched types //~| expected usize, found bool const ARR3: [i32; X3] = [99; 6]; diff --git a/src/test/ui/consts/const-integer-bool-ops.stderr b/src/test/ui/consts/const-integer-bool-ops.stderr index 1bcb3ea719d..7885eb446f0 100644 --- a/src/test/ui/consts/const-integer-bool-ops.stderr +++ b/src/test/ui/consts/const-integer-bool-ops.stderr @@ -1,191 +1,191 @@ error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:11:18 + --> $DIR/const-integer-bool-ops.rs:1:18 | LL | const X: usize = 42 && 39; - | ^^ expected bool, found integral variable + | ^^ expected bool, found integer | = note: expected type `bool` found type `{integer}` error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:11:24 + --> $DIR/const-integer-bool-ops.rs:1:24 | LL | const X: usize = 42 && 39; - | ^^ expected bool, found integral variable + | ^^ expected bool, found integer | = note: expected type `bool` found type `{integer}` error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:11:18 + --> $DIR/const-integer-bool-ops.rs:1:18 | LL | const X: usize = 42 && 39; | ^^^^^^^^ expected usize, found bool error[E0080]: evaluation of constant value failed - --> $DIR/const-integer-bool-ops.rs:18:18 + --> $DIR/const-integer-bool-ops.rs:8:18 | LL | const ARR: [i32; X] = [99; 34]; | ^ referenced constant has errors error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:21:19 + --> $DIR/const-integer-bool-ops.rs:11:19 | LL | const X1: usize = 42 || 39; - | ^^ expected bool, found integral variable + | ^^ expected bool, found integer | = note: expected type `bool` found type `{integer}` error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:21:25 + --> $DIR/const-integer-bool-ops.rs:11:25 | LL | const X1: usize = 42 || 39; - | ^^ expected bool, found integral variable + | ^^ expected bool, found integer | = note: expected type `bool` found type `{integer}` error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:21:19 + --> $DIR/const-integer-bool-ops.rs:11:19 | LL | const X1: usize = 42 || 39; | ^^^^^^^^ expected usize, found bool error[E0080]: evaluation of constant value failed - --> $DIR/const-integer-bool-ops.rs:28:19 + --> $DIR/const-integer-bool-ops.rs:18:19 | LL | const ARR1: [i32; X1] = [99; 47]; | ^^ referenced constant has errors error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:31:19 + --> $DIR/const-integer-bool-ops.rs:21:19 | LL | const X2: usize = -42 || -39; - | ^^^ expected bool, found integral variable + | ^^^ expected bool, found integer | = note: expected type `bool` found type `{integer}` error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:31:26 + --> $DIR/const-integer-bool-ops.rs:21:26 | LL | const X2: usize = -42 || -39; - | ^^^ expected bool, found integral variable + | ^^^ expected bool, found integer | = note: expected type `bool` found type `{integer}` error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:31:19 + --> $DIR/const-integer-bool-ops.rs:21:19 | LL | const X2: usize = -42 || -39; | ^^^^^^^^^^ expected usize, found bool error[E0080]: evaluation of constant value failed - --> $DIR/const-integer-bool-ops.rs:38:19 + --> $DIR/const-integer-bool-ops.rs:28:19 | LL | const ARR2: [i32; X2] = [99; 18446744073709551607]; | ^^ referenced constant has errors error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:41:19 + --> $DIR/const-integer-bool-ops.rs:31:19 | LL | const X3: usize = -42 && -39; - | ^^^ expected bool, found integral variable + | ^^^ expected bool, found integer | = note: expected type `bool` found type `{integer}` error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:41:26 + --> $DIR/const-integer-bool-ops.rs:31:26 | LL | const X3: usize = -42 && -39; - | ^^^ expected bool, found integral variable + | ^^^ expected bool, found integer | = note: expected type `bool` found type `{integer}` error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:41:19 + --> $DIR/const-integer-bool-ops.rs:31:19 | LL | const X3: usize = -42 && -39; | ^^^^^^^^^^ expected usize, found bool error[E0080]: evaluation of constant value failed - --> $DIR/const-integer-bool-ops.rs:48:19 + --> $DIR/const-integer-bool-ops.rs:38:19 | LL | const ARR3: [i32; X3] = [99; 6]; | ^^ referenced constant has errors error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:51:18 + --> $DIR/const-integer-bool-ops.rs:41:18 | LL | const Y: usize = 42.0 == 42.0; | ^^^^^^^^^^^^ expected usize, found bool error[E0080]: evaluation of constant value failed - --> $DIR/const-integer-bool-ops.rs:54:19 + --> $DIR/const-integer-bool-ops.rs:44:19 | LL | const ARRR: [i32; Y] = [99; 1]; | ^ referenced constant has errors error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:57:19 + --> $DIR/const-integer-bool-ops.rs:47:19 | LL | const Y1: usize = 42.0 >= 42.0; | ^^^^^^^^^^^^ expected usize, found bool error[E0080]: evaluation of constant value failed - --> $DIR/const-integer-bool-ops.rs:60:20 + --> $DIR/const-integer-bool-ops.rs:50:20 | LL | const ARRR1: [i32; Y1] = [99; 1]; | ^^ referenced constant has errors error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:63:19 + --> $DIR/const-integer-bool-ops.rs:53:19 | LL | const Y2: usize = 42.0 <= 42.0; | ^^^^^^^^^^^^ expected usize, found bool error[E0080]: evaluation of constant value failed - --> $DIR/const-integer-bool-ops.rs:66:20 + --> $DIR/const-integer-bool-ops.rs:56:20 | LL | const ARRR2: [i32; Y2] = [99; 1]; | ^^ referenced constant has errors error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:69:19 + --> $DIR/const-integer-bool-ops.rs:59:19 | LL | const Y3: usize = 42.0 > 42.0; | ^^^^^^^^^^^ expected usize, found bool error[E0080]: evaluation of constant value failed - --> $DIR/const-integer-bool-ops.rs:72:20 + --> $DIR/const-integer-bool-ops.rs:62:20 | LL | const ARRR3: [i32; Y3] = [99; 0]; | ^^ referenced constant has errors error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:75:19 + --> $DIR/const-integer-bool-ops.rs:65:19 | LL | const Y4: usize = 42.0 < 42.0; | ^^^^^^^^^^^ expected usize, found bool error[E0080]: evaluation of constant value failed - --> $DIR/const-integer-bool-ops.rs:78:20 + --> $DIR/const-integer-bool-ops.rs:68:20 | LL | const ARRR4: [i32; Y4] = [99; 0]; | ^^ referenced constant has errors error[E0308]: mismatched types - --> $DIR/const-integer-bool-ops.rs:81:19 + --> $DIR/const-integer-bool-ops.rs:71:19 | LL | const Y5: usize = 42.0 != 42.0; | ^^^^^^^^^^^^ expected usize, found bool error[E0080]: evaluation of constant value failed - --> $DIR/const-integer-bool-ops.rs:84:20 + --> $DIR/const-integer-bool-ops.rs:74:20 | LL | const ARRR5: [i32; Y5] = [99; 0]; | ^^ referenced constant has errors diff --git a/src/test/ui/consts/const-len-underflow-separate-spans.rs b/src/test/ui/consts/const-len-underflow-separate-spans.rs index 68452082ef3..01d2951b416 100644 --- a/src/test/ui/consts/const-len-underflow-separate-spans.rs +++ b/src/test/ui/consts/const-len-underflow-separate-spans.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that a constant-evaluation underflow highlights the correct // spot (where the underflow occurred), while also providing the // overall context for what caused the evaluation. diff --git a/src/test/ui/consts/const-len-underflow-separate-spans.stderr b/src/test/ui/consts/const-len-underflow-separate-spans.stderr index da39fa2e6f2..6ee92032bd7 100644 --- a/src/test/ui/consts/const-len-underflow-separate-spans.stderr +++ b/src/test/ui/consts/const-len-underflow-separate-spans.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/const-len-underflow-separate-spans.rs:17:1 + --> $DIR/const-len-underflow-separate-spans.rs:7:1 | LL | const LEN: usize = ONE - TWO; | ^^^^^^^^^^^^^^^^^^^---------^ @@ -9,7 +9,7 @@ LL | const LEN: usize = ONE - TWO; = note: #[deny(const_err)] on by default error[E0080]: evaluation of constant value failed - --> $DIR/const-len-underflow-separate-spans.rs:21:17 + --> $DIR/const-len-underflow-separate-spans.rs:11:17 | LL | let a: [i8; LEN] = unimplemented!(); | ^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-len-underflow-subspans.rs b/src/test/ui/consts/const-len-underflow-subspans.rs index 10180f36489..37f6ef1bd9d 100644 --- a/src/test/ui/consts/const-len-underflow-subspans.rs +++ b/src/test/ui/consts/const-len-underflow-subspans.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that a constant-evaluation underflow highlights the correct // spot (where the underflow occurred). diff --git a/src/test/ui/consts/const-len-underflow-subspans.stderr b/src/test/ui/consts/const-len-underflow-subspans.stderr index 3fca7ecb19a..63bce1e2c83 100644 --- a/src/test/ui/consts/const-len-underflow-subspans.stderr +++ b/src/test/ui/consts/const-len-underflow-subspans.stderr @@ -1,5 +1,5 @@ error[E0080]: evaluation of constant value failed - --> $DIR/const-len-underflow-subspans.rs:18:17 + --> $DIR/const-len-underflow-subspans.rs:8:17 | LL | let a: [i8; ONE - TWO] = unimplemented!(); | ^^^^^^^^^ attempt to subtract with overflow diff --git a/src/test/ui/consts/const-match-check.eval1.stderr b/src/test/ui/consts/const-match-check.eval1.stderr index 3caf1491aba..4c6499cf99c 100644 --- a/src/test/ui/consts/const-match-check.eval1.stderr +++ b/src/test/ui/consts/const-match-check.eval1.stderr @@ -1,8 +1,8 @@ -error[E0005]: refutable pattern in local binding: `_` not covered - --> $DIR/const-match-check.rs:35:15 +error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered + --> $DIR/const-match-check.rs:25:15 | LL | A = { let 0 = 0; 0 }, - | ^ pattern `_` not covered + | ^ pattern `-2147483648i32..=-1i32` not covered error: aborting due to previous error diff --git a/src/test/ui/consts/const-match-check.eval2.stderr b/src/test/ui/consts/const-match-check.eval2.stderr index de85d4d73db..854f8f3a7b9 100644 --- a/src/test/ui/consts/const-match-check.eval2.stderr +++ b/src/test/ui/consts/const-match-check.eval2.stderr @@ -1,8 +1,8 @@ -error[E0005]: refutable pattern in local binding: `_` not covered - --> $DIR/const-match-check.rs:41:24 +error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered + --> $DIR/const-match-check.rs:31:24 | LL | let x: [i32; { let 0 = 0; 0 }] = []; - | ^ pattern `_` not covered + | ^ pattern `-2147483648i32..=-1i32` not covered error: aborting due to previous error diff --git a/src/test/ui/consts/const-match-check.matchck.stderr b/src/test/ui/consts/const-match-check.matchck.stderr index bbf1169c577..c9028b1c2a2 100644 --- a/src/test/ui/consts/const-match-check.matchck.stderr +++ b/src/test/ui/consts/const-match-check.matchck.stderr @@ -1,26 +1,26 @@ -error[E0005]: refutable pattern in local binding: `_` not covered - --> $DIR/const-match-check.rs:14:22 +error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered + --> $DIR/const-match-check.rs:4:22 | LL | const X: i32 = { let 0 = 0; 0 }; - | ^ pattern `_` not covered + | ^ pattern `-2147483648i32..=-1i32` not covered -error[E0005]: refutable pattern in local binding: `_` not covered - --> $DIR/const-match-check.rs:18:23 +error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered + --> $DIR/const-match-check.rs:8:23 | LL | static Y: i32 = { let 0 = 0; 0 }; - | ^ pattern `_` not covered + | ^ pattern `-2147483648i32..=-1i32` not covered -error[E0005]: refutable pattern in local binding: `_` not covered - --> $DIR/const-match-check.rs:23:26 +error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered + --> $DIR/const-match-check.rs:13:26 | LL | const X: i32 = { let 0 = 0; 0 }; - | ^ pattern `_` not covered + | ^ pattern `-2147483648i32..=-1i32` not covered -error[E0005]: refutable pattern in local binding: `_` not covered - --> $DIR/const-match-check.rs:29:26 +error[E0005]: refutable pattern in local binding: `-2147483648i32..=-1i32` not covered + --> $DIR/const-match-check.rs:19:26 | LL | const X: i32 = { let 0 = 0; 0 }; - | ^ pattern `_` not covered + | ^ pattern `-2147483648i32..=-1i32` not covered error: aborting due to 4 previous errors diff --git a/src/test/ui/consts/const-match-check.rs b/src/test/ui/consts/const-match-check.rs index 304eef7847c..60f60fa40e3 100644 --- a/src/test/ui/consts/const-match-check.rs +++ b/src/test/ui/consts/const-match-check.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: matchck eval1 eval2 #[cfg(matchck)] diff --git a/src/test/ui/consts/const-match-pattern-arm.rs b/src/test/ui/consts/const-match-pattern-arm.rs index bc944948f3d..3b985269a56 100644 --- a/src/test/ui/consts/const-match-pattern-arm.rs +++ b/src/test/ui/consts/const-match-pattern-arm.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] const x: bool = match Some(true) { diff --git a/src/test/ui/consts/const-match-pattern-arm.stderr b/src/test/ui/consts/const-match-pattern-arm.stderr index 201aa7cd5b7..c793cc0cd78 100644 --- a/src/test/ui/consts/const-match-pattern-arm.stderr +++ b/src/test/ui/consts/const-match-pattern-arm.stderr @@ -1,11 +1,11 @@ error[E0019]: constant contains unimplemented expression type - --> $DIR/const-match-pattern-arm.rs:14:5 + --> $DIR/const-match-pattern-arm.rs:4:5 | LL | Some(value) => true, | ^^^^^^^^^^^ error[E0019]: constant contains unimplemented expression type - --> $DIR/const-match-pattern-arm.rs:21:9 + --> $DIR/const-match-pattern-arm.rs:11:9 | LL | Some(value) => true, | ^^^^^^^^^^^ diff --git a/src/test/ui/consts/const-nonzero.rs b/src/test/ui/consts/const-nonzero.rs new file mode 100644 index 00000000000..c06ab227f64 --- /dev/null +++ b/src/test/ui/consts/const-nonzero.rs @@ -0,0 +1,9 @@ +// compile-pass + +use std::num::NonZeroU8; + +const X: NonZeroU8 = unsafe { NonZeroU8::new_unchecked(5) }; +const Y: u8 = X.get(); + +fn main() { +} diff --git a/src/test/ui/consts/const-pattern-irrefutable.rs b/src/test/ui/consts/const-pattern-irrefutable.rs index af0b95e002d..d3f7be18a98 100644 --- a/src/test/ui/consts/const-pattern-irrefutable.rs +++ b/src/test/ui/consts/const-pattern-irrefutable.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub const b: u8 = 2; pub const d: u8 = 2; @@ -19,8 +9,8 @@ use foo::d; const a: u8 = 2; fn main() { - let a = 4; //~ ERROR refutable pattern in local binding: `_` not covered - let c = 4; //~ ERROR refutable pattern in local binding: `_` not covered - let d = 4; //~ ERROR refutable pattern in local binding: `_` not covered - fn f() {} // Check that the `NOTE`s still work with an item here (c.f. issue #35115). + let a = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered + let c = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered + let d = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered + fn f() {} // Check that the `NOTE`s still work with an item here (cf. issue #35115). } diff --git a/src/test/ui/consts/const-pattern-irrefutable.stderr b/src/test/ui/consts/const-pattern-irrefutable.stderr index 6d5738f3328..ee0d4d88374 100644 --- a/src/test/ui/consts/const-pattern-irrefutable.stderr +++ b/src/test/ui/consts/const-pattern-irrefutable.stderr @@ -1,19 +1,19 @@ -error[E0005]: refutable pattern in local binding: `_` not covered - --> $DIR/const-pattern-irrefutable.rs:22:9 +error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered + --> $DIR/const-pattern-irrefutable.rs:12:9 | -LL | let a = 4; //~ ERROR refutable pattern in local binding: `_` not covered +LL | let a = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered | ^ interpreted as a constant pattern, not new variable -error[E0005]: refutable pattern in local binding: `_` not covered - --> $DIR/const-pattern-irrefutable.rs:23:9 +error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered + --> $DIR/const-pattern-irrefutable.rs:13:9 | -LL | let c = 4; //~ ERROR refutable pattern in local binding: `_` not covered +LL | let c = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered | ^ interpreted as a constant pattern, not new variable -error[E0005]: refutable pattern in local binding: `_` not covered - --> $DIR/const-pattern-irrefutable.rs:24:9 +error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered + --> $DIR/const-pattern-irrefutable.rs:14:9 | -LL | let d = 4; //~ ERROR refutable pattern in local binding: `_` not covered +LL | let d = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered | ^ interpreted as a constant pattern, not new variable error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/const-pattern-not-const-evaluable.rs b/src/test/ui/consts/const-pattern-not-const-evaluable.rs index 07880b03001..8dd78ca0ba4 100644 --- a/src/test/ui/consts/const-pattern-not-const-evaluable.rs +++ b/src/test/ui/consts/const-pattern-not-const-evaluable.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #[derive(PartialEq, Eq)] diff --git a/src/test/ui/consts/const-size_of-cycle.rs b/src/test/ui/consts/const-size_of-cycle.rs index 1ea7b973c46..1bbe881872c 100644 --- a/src/test/ui/consts/const-size_of-cycle.rs +++ b/src/test/ui/consts/const-size_of-cycle.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-musl // ignore-x86 // error-pattern: cycle detected diff --git a/src/test/ui/consts/const-size_of-cycle.stderr b/src/test/ui/consts/const-size_of-cycle.stderr index e824657f8af..8f8eb38e938 100644 --- a/src/test/ui/consts/const-size_of-cycle.stderr +++ b/src/test/ui/consts/const-size_of-cycle.stderr @@ -1,5 +1,5 @@ error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}` - --> $DIR/const-size_of-cycle.rs:16:17 + --> $DIR/const-size_of-cycle.rs:6:17 | LL | bytes: [u8; std::mem::size_of::()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,16 +9,16 @@ note: ...which requires const-evaluating `Foo::bytes::{{constant}}`... | LL | intrinsics::size_of::() | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires computing layout of `Foo`... -note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`... + = note: ...which requires computing layout of `Foo`... + = note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All, def_id: None }, value: [u8; _] }`... note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}`... - --> $DIR/const-size_of-cycle.rs:16:17 + --> $DIR/const-size_of-cycle.rs:6:17 | LL | bytes: [u8; std::mem::size_of::()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}`, completing the cycle note: cycle used when processing `Foo` - --> $DIR/const-size_of-cycle.rs:15:1 + --> $DIR/const-size_of-cycle.rs:5:1 | LL | struct Foo { | ^^^^^^^^^^ diff --git a/src/test/ui/consts/const-slice-oob.rs b/src/test/ui/consts/const-slice-oob.rs index 04d9b01633b..1775f35fac4 100644 --- a/src/test/ui/consts/const-slice-oob.rs +++ b/src/test/ui/consts/const-slice-oob.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[deny(const_err)] const FOO: &'static[u32] = &[1, 2, 3]; diff --git a/src/test/ui/consts/const-slice-oob.stderr b/src/test/ui/consts/const-slice-oob.stderr index 4a8ad5ed6ca..1122665cf8e 100644 --- a/src/test/ui/consts/const-slice-oob.stderr +++ b/src/test/ui/consts/const-slice-oob.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/const-slice-oob.rs:14:1 + --> $DIR/const-slice-oob.rs:4:1 | LL | const BAR: u32 = FOO[5]; | ^^^^^^^^^^^^^^^^^------^ diff --git a/src/test/ui/consts/const-tup-index-span.rs b/src/test/ui/consts/const-tup-index-span.rs index e1d58116481..047ed0204b1 100644 --- a/src/test/ui/consts/const-tup-index-span.rs +++ b/src/test/ui/consts/const-tup-index-span.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test spans of errors const TUP: (usize,) = 5usize << 64; diff --git a/src/test/ui/consts/const-tup-index-span.stderr b/src/test/ui/consts/const-tup-index-span.stderr index 3018baac5a5..ed631b824d5 100644 --- a/src/test/ui/consts/const-tup-index-span.stderr +++ b/src/test/ui/consts/const-tup-index-span.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/const-tup-index-span.rs:13:23 + --> $DIR/const-tup-index-span.rs:3:23 | LL | const TUP: (usize,) = 5usize << 64; | ^^^^^^^^^^^^ expected tuple, found usize @@ -8,7 +8,7 @@ LL | const TUP: (usize,) = 5usize << 64; found type `usize` error[E0080]: evaluation of constant value failed - --> $DIR/const-tup-index-span.rs:16:18 + --> $DIR/const-tup-index-span.rs:6:18 | LL | const ARR: [i32; TUP.0] = []; | ^^^ referenced constant has errors diff --git a/src/test/ui/consts/const-type-mismatch.rs b/src/test/ui/consts/const-type-mismatch.rs index ddad4e79cfd..6e56c046f7a 100644 --- a/src/test/ui/consts/const-type-mismatch.rs +++ b/src/test/ui/consts/const-type-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // `const`s shouldn't suggest `.into()` const TEN: u8 = 10; diff --git a/src/test/ui/consts/const-type-mismatch.stderr b/src/test/ui/consts/const-type-mismatch.stderr index 965995f82c5..dbc533c6c60 100644 --- a/src/test/ui/consts/const-type-mismatch.stderr +++ b/src/test/ui/consts/const-type-mismatch.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/const-type-mismatch.rs:14:21 + --> $DIR/const-type-mismatch.rs:4:21 | LL | const TWELVE: u16 = TEN + 2; | ^^^^^^^ expected u16, found u8 error[E0308]: mismatched types - --> $DIR/const-type-mismatch.rs:19:27 + --> $DIR/const-type-mismatch.rs:9:27 | LL | const ALSO_TEN: u16 = TEN; | ^^^ expected u16, found u8 diff --git a/src/test/ui/consts/const-typeid-of.rs b/src/test/ui/consts/const-typeid-of.rs index 401125cef09..3829c481da8 100644 --- a/src/test/ui/consts/const-typeid-of.rs +++ b/src/test/ui/consts/const-typeid-of.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::any::TypeId; struct A; diff --git a/src/test/ui/consts/const-typeid-of.stderr b/src/test/ui/consts/const-typeid-of.stderr index d13ced9a10a..05347fbc819 100644 --- a/src/test/ui/consts/const-typeid-of.stderr +++ b/src/test/ui/consts/const-typeid-of.stderr @@ -1,10 +1,10 @@ error: `std::any::TypeId::of` is not yet stable as a const fn - --> $DIR/const-typeid-of.rs:16:26 + --> $DIR/const-typeid-of.rs:6:26 | LL | const A_ID: TypeId = TypeId::of::(); | ^^^^^^^^^^^^^^^^^ | - = help: in Nightly builds, add `#![feature(const_type_id)]` to the crate attributes to enable + = help: add `#![feature(const_type_id)]` to the crate attributes to enable error: aborting due to previous error diff --git a/src/test/ui/consts/const-unsized.rs b/src/test/ui/consts/const-unsized.rs index 39ac969b80e..e20ded68ceb 100644 --- a/src/test/ui/consts/const-unsized.rs +++ b/src/test/ui/consts/const-unsized.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Debug; const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); diff --git a/src/test/ui/consts/const-unsized.stderr b/src/test/ui/consts/const-unsized.stderr index 8671e609ac8..0f996fcd943 100644 --- a/src/test/ui/consts/const-unsized.stderr +++ b/src/test/ui/consts/const-unsized.stderr @@ -1,38 +1,38 @@ error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time - --> $DIR/const-unsized.rs:13:16 + --> $DIR/const-unsized.rs:3:16 | LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)` - = note: to learn more, visit + = note: to learn more, visit error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/const-unsized.rs:16:18 + --> $DIR/const-unsized.rs:6:18 | LL | const CONST_FOO: str = *"foo"; | ^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time - --> $DIR/const-unsized.rs:19:18 + --> $DIR/const-unsized.rs:9:18 | LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync)); | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)` - = note: to learn more, visit + = note: to learn more, visit error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/const-unsized.rs:22:20 + --> $DIR/const-unsized.rs:12:20 | LL | static STATIC_BAR: str = *"bar"; | ^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit error: aborting due to 4 previous errors diff --git a/src/test/ui/consts/const_fn_return_nested_fn_ptr.rs b/src/test/ui/consts/const_fn_return_nested_fn_ptr.rs new file mode 100644 index 00000000000..c7617c9c7ad --- /dev/null +++ b/src/test/ui/consts/const_fn_return_nested_fn_ptr.rs @@ -0,0 +1,10 @@ +// compile-pass +// aux-build:const_fn_lib.rs + +extern crate const_fn_lib; + +fn main() { + const_fn_lib::bar()(); + const_fn_lib::bar_inlined()(); + const_fn_lib::bar_inlined_always()(); +} diff --git a/src/test/ui/consts/const_let_assign.rs b/src/test/ui/consts/const_let_assign.rs new file mode 100644 index 00000000000..0b09b8469fd --- /dev/null +++ b/src/test/ui/consts/const_let_assign.rs @@ -0,0 +1,10 @@ +// compile-pass + +struct S(i32); + +const A: () = { + let mut s = S(0); + s.0 = 1; +}; + +fn main() {} diff --git a/src/test/ui/consts/const_let_assign2.rs b/src/test/ui/consts/const_let_assign2.rs new file mode 100644 index 00000000000..1c44237e49b --- /dev/null +++ b/src/test/ui/consts/const_let_assign2.rs @@ -0,0 +1,22 @@ +// compile-pass + +pub struct AA { + pub data: [u8; 10], +} + +impl AA { + pub const fn new() -> Self { + let mut res: AA = AA { data: [0; 10] }; + res.data[0] = 5; + res + } +} + +static mut BB: AA = AA::new(); + +fn main() { + let ptr = unsafe { &mut BB }; + for a in ptr.data.iter() { + println!("{}", a); + } +} diff --git a/src/test/ui/consts/const_let_assign3.rs b/src/test/ui/consts/const_let_assign3.rs new file mode 100644 index 00000000000..cbe73923e9c --- /dev/null +++ b/src/test/ui/consts/const_let_assign3.rs @@ -0,0 +1,31 @@ +#![feature(const_fn)] + +struct S { + state: u32, +} + +impl S { + const fn foo(&mut self, x: u32) { + self.state = x; + //~^ contains unimplemented expression + } +} + +const FOO: S = { + let mut s = S { state: 42 }; + s.foo(3); //~ ERROR references in constants may only refer to immutable values + s +}; + +type Array = [u32; { + let mut x = 2; + let y = &mut x; +//~^ ERROR references in constants may only refer to immutable values + *y = 42; +//~^ ERROR constant contains unimplemented expression type + *y +}]; + +fn main() { + assert_eq!(FOO.state, 3); +} diff --git a/src/test/ui/consts/const_let_assign3.stderr b/src/test/ui/consts/const_let_assign3.stderr new file mode 100644 index 00000000000..6649fb997cc --- /dev/null +++ b/src/test/ui/consts/const_let_assign3.stderr @@ -0,0 +1,28 @@ +error[E0019]: constant function contains unimplemented expression type + --> $DIR/const_let_assign3.rs:9:9 + | +LL | self.state = x; + | ^^^^^^^^^^^^^^ + +error[E0017]: references in constants may only refer to immutable values + --> $DIR/const_let_assign3.rs:16:5 + | +LL | s.foo(3); //~ ERROR references in constants may only refer to immutable values + | ^ constants require immutable values + +error[E0017]: references in constants may only refer to immutable values + --> $DIR/const_let_assign3.rs:22:13 + | +LL | let y = &mut x; + | ^^^^^^ constants require immutable values + +error[E0019]: constant contains unimplemented expression type + --> $DIR/const_let_assign3.rs:24:5 + | +LL | *y = 42; + | ^^^^^^^ + +error: aborting due to 4 previous errors + +Some errors occurred: E0017, E0019. +For more information about an error, try `rustc --explain E0017`. diff --git a/src/test/ui/consts/const_let_eq.rs b/src/test/ui/consts/const_let_eq.rs new file mode 100644 index 00000000000..a2364c392f2 --- /dev/null +++ b/src/test/ui/consts/const_let_eq.rs @@ -0,0 +1,468 @@ +// run-pass + +struct Foo(T); +struct Bar { x: T } +struct W(u32); +struct A { a: u32 } + +const fn basics((a,): (u32,)) -> u32 { + // Deferred assignment: + let b: u32; + b = a + 1; + + // Immediate assignment: + let c: u32 = b + 1; + + // Mutables: + let mut d: u32 = c + 1; + d = d + 1; + // +4 so far. + + // No effect statements work: + ; ; + 1; + + // Array projection + let mut arr: [u32; 1] = [0]; + arr[0] = 1; + d = d + arr[0]; + // +5 + + // Field projection: + let mut foo: Foo = Foo(0); + let mut bar: Bar = Bar { x: 0 }; + foo.0 = 1; + bar.x = 1; + d = d + foo.0 + bar.x; + // +7 + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(0)]; + arr[0].0 = 1; + d = d + arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: 0 }]; + arr[0].x = 1; + d = d + arr[0].x; + // +9 + + // Field + Array projection: + let mut arr: Foo<[u32; 1]> = Foo([0]); + (arr.0)[0] = 1; + d = d + (arr.0)[0]; + let mut arr: Bar<[u32; 1]> = Bar { x: [0] }; + arr.x[0] = 1; + d = d + arr.x[0]; + // +11 + + d +} + +const fn add_assign(W(a): W) -> u32 { + // Mutables: + let mut d: u32 = a + 1; + d += 1; + // +2 so far. + + // Array projection + let mut arr: [u32; 1] = [0]; + arr[0] += 1; + d += arr[0]; + // +3 + + // Field projection: + let mut foo: Foo = Foo(0); + let mut bar: Bar = Bar { x: 0 }; + foo.0 += 1; + bar.x += 1; + d += foo.0 + bar.x; + // +5 + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(0)]; + arr[0].0 += 1; + d += arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: 0 }]; + arr[0].x += 1; + d += arr[0].x; + // +7 + + // Field + Array projection: + let mut arr: Foo<[u32; 1]> = Foo([0]); + (arr.0)[0] += 1; + d += (arr.0)[0]; + let mut arr: Bar<[u32; 1]> = Bar { x: [0] }; + arr.x[0] += 1; + d += arr.x[0]; + // +9 + + d +} + +const fn mul_assign(A { a }: A) -> u32 { + // Mutables: + let mut d: u32 = a + 1; + d *= 2; + // 2^1 * (a + 1) + + // Array projection + let mut arr: [u32; 1] = [1]; + arr[0] *= 2; + d *= arr[0]; + // 2^2 * (a + 1) + + // Field projection: + let mut foo: Foo = Foo(1); + let mut bar: Bar = Bar { x: 1 }; + foo.0 *= 2; + bar.x *= 2; + d *= foo.0 + bar.x; + // 2^4 * (a + 1) + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(1)]; + arr[0].0 *= 2; + d *= arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: 1 }]; + arr[0].x *= 2; + d *= arr[0].x; + // 2^6 * (a + 1) + + // Field + Array projection: + let mut arr: Foo<[u32; 1]> = Foo([1]); + (arr.0)[0] *= 2; + d *= (arr.0)[0]; + let mut arr: Bar<[u32; 1]> = Bar { x: [1] }; + arr.x[0] *= 2; + d *= arr.x[0]; + // 2^8 * (a + 1) + + d +} + +const fn div_assign(a: [u32; 1]) -> u32 { + let a = a[0]; + // Mutables: + let mut d: u32 = 1024 * a; + d /= 2; + // 512 + + // Array projection + let mut arr: [u32; 1] = [4]; + arr[0] /= 2; + d /= arr[0]; + // 256 + + // Field projection: + let mut foo: Foo = Foo(4); + let mut bar: Bar = Bar { x: 4 }; + foo.0 /= 2; + bar.x /= 2; + d /= foo.0; + d /= bar.x; + // 64 + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(4)]; + arr[0].0 /= 2; + d /= arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: 4 }]; + arr[0].x /= 2; + d /= arr[0].x; + // 16 + + // Field + Array projection: + let mut arr: Foo<[u32; 1]> = Foo([4]); + (arr.0)[0] /= 2; + d /= (arr.0)[0]; + let mut arr: Bar<[u32; 1]> = Bar { x: [4] }; + arr.x[0] /= 2; + d /= arr.x[0]; + // 4 + + d +} + +const fn rem_assign(W(a): W) -> u32 { + // Mutables: + let mut d: u32 = a; + d %= 10; + d += 10; + + // Array projection + let mut arr: [u32; 1] = [3]; + arr[0] %= 2; + d %= 9 + arr[0]; + d += 10; + + // Field projection: + let mut foo: Foo = Foo(5); + let mut bar: Bar = Bar { x: 7 }; + foo.0 %= 2; + bar.x %= 2; + d %= 8 + foo.0 + bar.x; + d += 10; + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(4)]; + arr[0].0 %= 3; + d %= 9 + arr[0].0; + d += 10; + let mut arr: [Bar; 1] = [Bar { x: 7 }]; + arr[0].x %= 3; + d %= 9 + arr[0].x; + d += 10; + + // Field + Array projection: + let mut arr: Foo<[u32; 1]> = Foo([6]); + (arr.0)[0] %= 5; + d %= 9 + (arr.0)[0]; + let mut arr: Bar<[u32; 1]> = Bar { x: [11] }; + arr.x[0] %= 5; + d %= 9 + arr.x[0]; + + d +} + +const fn sub_assign(W(a): W) -> u32 { + // Mutables: + let mut d: u32 = a; + d -= 1; + + // Array projection + let mut arr: [u32; 1] = [2]; + arr[0] -= 1; + d -= arr[0]; + + // Field projection: + let mut foo: Foo = Foo(2); + let mut bar: Bar = Bar { x: 2 }; + foo.0 -= 1; + bar.x -= 1; + d -= foo.0 + bar.x; + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(2)]; + arr[0].0 -= 1; + d -= arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: 2 }]; + arr[0].x -= 1; + d -= arr[0].x; + + // Field + Array projection: + let mut arr: Foo<[u32; 1]> = Foo([2]); + (arr.0)[0] -= 1; + d -= (arr.0)[0]; + let mut arr: Bar<[u32; 1]> = Bar { x: [2] }; + arr.x[0] -= 1; + d -= arr.x[0]; + + d +} + +const fn shl_assign(W(a): W) -> u32 { + // Mutables: + let mut d: u32 = a; + d <<= 1; // 10 + + // Array projection + let mut arr: [u32; 1] = [1]; + arr[0] <<= 1; + d <<= arr[0]; // 10 << 2 + + // Field projection: + let mut foo: Foo = Foo(1); + let mut bar: Bar = Bar { x: 1 }; + foo.0 <<= 1; + bar.x <<= 1; + d <<= foo.0 + bar.x; // 1000 << 4 + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(1)]; + arr[0].0 <<= 1; + d <<= arr[0].0; // 1000_0000 << 2 + let mut arr: [Bar; 1] = [Bar { x: 1 }]; + arr[0].x <<= 1; + d <<= arr[0].x; // 1000_0000_00 << 2 + + // Field + Array projection: + let mut arr: Foo<[u32; 1]> = Foo([1]); + (arr.0)[0] <<= 1; + d <<= (arr.0)[0]; // 1000_0000_0000 << 2 + let mut arr: Bar<[u32; 1]> = Bar { x: [1] }; + arr.x[0] <<= 1; + d <<= arr.x[0]; // 1000_0000_0000_00 << 2 + + d +} + +const fn shr_assign(W(a): W) -> u32 { + // Mutables: + let mut d: u32 = a; + d >>= 1; // /= 2 + + // Array projection + let mut arr: [u32; 1] = [2]; + arr[0] >>= 1; + d >>= arr[0]; // /= 4 + + // Field projection: + let mut foo: Foo = Foo(2); + let mut bar: Bar = Bar { x: 2 }; + foo.0 >>= 1; + bar.x >>= 1; + d >>= foo.0 + bar.x; // /= 16 + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(2)]; + arr[0].0 >>= 1; + d >>= arr[0].0; // /= 32 + let mut arr: [Bar; 1] = [Bar { x: 2 }]; + arr[0].x >>= 1; + d >>= arr[0].x; // /= 64 + + // Field + Array projection: + let mut arr: Foo<[u32; 1]> = Foo([2]); + (arr.0)[0] >>= 1; + d >>= (arr.0)[0]; // /= 128 + let mut arr: Bar<[u32; 1]> = Bar { x: [2] }; + arr.x[0] >>= 1; + d >>= arr.x[0]; // /= 256 + + d +} + +const fn bit_and_assign(W(a): W) -> u32 { + let f = 0b1111_1111_1111_1111; + + // Mutables: + let mut d: u32 = a; + d &= 0b1111_1111_1111_1110; + + // Array projection + let mut arr: [u32; 1] = [f]; + arr[0] &= 0b1111_1111_1111_1101; + d &= arr[0]; + + // Field projection: + let mut foo: Foo = Foo(f); + let mut bar: Bar = Bar { x: f }; + foo.0 &= 0b1111_1111_1111_0111; + bar.x &= 0b1111_1111_1101_1111; + d &= foo.0 & bar.x; + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(f)]; + arr[0].0 &= 0b1111_1110_1111_1111; + d &= arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: f }]; + arr[0].x &= 0b1111_1101_1111_1111; + d &= arr[0].x; + + // Field + Array projection: + let mut arr: Foo<[u32; 1]> = Foo([f]); + (arr.0)[0] &= 0b1011_1111_1111_1111; + d &= (arr.0)[0]; + let mut arr: Bar<[u32; 1]> = Bar { x: [f] }; + arr.x[0] &= 0b0111_1111_1111_1111; + d &= arr.x[0]; + + d +} + +const fn bit_or_assign(W(a): W) -> u32 { + let f = 0b0000_0000_0000_0000; + + // Mutables: + let mut d: u32 = a; + d |= 0b0000_0000_0000_0001; + + // Array projection + let mut arr: [u32; 1] = [f]; + arr[0] |= 0b0000_0000_0000_1001; + d |= arr[0]; + + // Field projection: + let mut foo: Foo = Foo(f); + let mut bar: Bar = Bar { x: f }; + foo.0 |= 0b0000_0000_0001_0000; + bar.x |= 0b0000_0000_0100_0000; + d |= foo.0 | bar.x; + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(f)]; + arr[0].0 |= 0b0000_0001_0000_0000; + d |= arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: f }]; + arr[0].x |= 0b0000_0010_0000_0000; + d |= arr[0].x; + + // Field + Array projection: + let mut arr: Foo<[u32; 1]> = Foo([f]); + (arr.0)[0] |= 0b1000_0000_0000_0000; + d |= (arr.0)[0]; // /= 128 + let mut arr: Bar<[u32; 1]> = Bar { x: [f] }; + arr.x[0] |= 0b1100_0000_0000_0000; + d |= arr.x[0]; // /= 256 + + d +} + +const fn bit_xor_assign(W(a): W) -> u32 { + let f = 0b0000_0000_0000_0000; + + // Mutables: + let mut d: u32 = a; + d ^= 0b0000_0000_0000_0001; + + // Array projection + let mut arr: [u32; 1] = [f]; + arr[0] ^= 0b0000_0000_0000_0010; + d ^= arr[0]; + + // Field projection: + let mut foo: Foo = Foo(f); + let mut bar: Bar = Bar { x: f }; + foo.0 ^= 0b0000_0000_0001_0000; + bar.x ^= 0b0000_0000_1000_0000; + d ^= foo.0 ^ bar.x; + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(f)]; + arr[0].0 ^= 0b0000_0001_0000_0000; + d ^= arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: f }]; + arr[0].x ^= 0b0000_0010_0000_0000; + d ^= arr[0].x; + + // Field + Array projection: + let mut arr: Foo<[u32; 1]> = Foo([f]); + (arr.0)[0] ^= 0b0100_0000_0000_0000; + d ^= (arr.0)[0]; + let mut arr: Bar<[u32; 1]> = Bar { x: [f] }; + arr.x[0] ^= 0b1000_0000_0000_0000; + d ^= arr.x[0]; + + d +} + +macro_rules! test { + ($c:ident, $e:expr, $r:expr) => { + const $c: u32 = $e; + assert_eq!($c, $r); + assert_eq!($e, $r); + } +} + +fn main() { + test!(BASICS, basics((2,)), 13); + test!(ADD, add_assign(W(1)), 10); + test!(MUL, mul_assign(A { a: 0 }), 256); + test!(DIV, div_assign([1]), 4); + test!(REM, rem_assign(W(5)), 5); + test!(SUB, sub_assign(W(8)), 0); + test!(SHL, shl_assign(W(1)), 0b1000_0000_0000_0000); + test!(SHR, shr_assign(W(256)), 1); + test!(AND, bit_and_assign(W(0b1011_1111_1111_1111_1111)), 0b0011_1100_1101_0100); + test!(OR, bit_or_assign(W(0b1011_0000_0000_0000)), 0b1111_0011_0101_1001); + test!(XOR, bit_xor_assign(W(0b0000_0000_0000_0000)), 0b1100_0011_1001_0011); +} diff --git a/src/test/ui/consts/const_let_eq_float.rs b/src/test/ui/consts/const_let_eq_float.rs new file mode 100644 index 00000000000..c48f54e567b --- /dev/null +++ b/src/test/ui/consts/const_let_eq_float.rs @@ -0,0 +1,279 @@ +// compile-pass + +#![feature(const_fn)] + +struct Foo(T); +struct Bar { x: T } +struct W(f32); +struct A { a: f32 } + +const fn basics((a,): (f32,)) -> f32 { + // Deferred assignment: + let b: f32; + b = a + 1.0; + + // Immediate assignment: + let c: f32 = b + 1.0; + + // Mutables: + let mut d: f32 = c + 1.0; + d = d + 1.0; + // +4 so far. + + // No effect statements work: + ; ; + 1; + + // Array projection + let mut arr: [f32; 1] = [0.0]; + arr[0] = 1.0; + d = d + arr[0]; + // +5 + + // Field projection: + let mut foo: Foo = Foo(0.0); + let mut bar: Bar = Bar { x: 0.0 }; + foo.0 = 1.0; + bar.x = 1.0; + d = d + foo.0 + bar.x; + // +7 + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(0.0)]; + arr[0].0 = 1.0; + d = d + arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: 0.0 }]; + arr[0].x = 1.0; + d = d + arr[0].x; + // +9 + + // Field + Array projection: + let mut arr: Foo<[f32; 1]> = Foo([0.0]); + (arr.0)[0] = 1.0; + d = d + (arr.0)[0]; + let mut arr: Bar<[f32; 1]> = Bar { x: [0.0] }; + arr.x[0] = 1.0; + d = d + arr.x[0]; + // +11 + + d +} + +const fn add_assign(W(a): W) -> f32 { + // Mutables: + let mut d: f32 = a + 1.0; + d += 1.0; + // +2 so far. + + // Array projection + let mut arr: [f32; 1] = [0.0]; + arr[0] += 1.0; + d += arr[0]; + // +3 + + // Field projection: + let mut foo: Foo = Foo(0.0); + let mut bar: Bar = Bar { x: 0.0 }; + foo.0 += 1.0; + bar.x += 1.0; + d += foo.0 + bar.x; + // +5 + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(0.0)]; + arr[0].0 += 1.0; + d += arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: 0.0 }]; + arr[0].x += 1.0; + d += arr[0].x; + // +7 + + // Field + Array projection: + let mut arr: Foo<[f32; 1]> = Foo([0.0]); + (arr.0)[0] += 1.0; + d += (arr.0)[0]; + let mut arr: Bar<[f32; 1]> = Bar { x: [0.0] }; + arr.x[0] += 1.0; + d += arr.x[0]; + // +9 + + d +} + +const fn mul_assign(A { a }: A) -> f32 { + // Mutables: + let mut d: f32 = a + 1.0; + d *= 2.0; + // 2^1 * (a + 1) + + // Array projection + let mut arr: [f32; 1] = [1.0]; + arr[0] *= 2.0; + d *= arr[0]; + // 2^2 * (a + 1) + + // Field projection: + let mut foo: Foo = Foo(1.0); + let mut bar: Bar = Bar { x: 1.0 }; + foo.0 *= 2.0; + bar.x *= 2.0; + d *= foo.0 + bar.x; + // 2^4 * (a + 1) + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(1.0)]; + arr[0].0 *= 2.0; + d *= arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: 1.0 }]; + arr[0].x *= 2.0; + d *= arr[0].x; + // 2^6 * (a + 1) + + // Field + Array projection: + let mut arr: Foo<[f32; 1]> = Foo([1.0]); + (arr.0)[0] *= 2.0; + d *= (arr.0)[0]; + let mut arr: Bar<[f32; 1]> = Bar { x: [1.0] }; + arr.x[0] *= 2.0; + d *= arr.x[0]; + // 2^8 * (a + 1) + + d +} + +const fn div_assign(a: [f32; 1]) -> f32 { + let a = a[0]; + // Mutables: + let mut d: f32 = 1024.0 * a; + d /= 2.0; + // 512 + + // Array projection + let mut arr: [f32; 1] = [4.0]; + arr[0] /= 2.0; + d /= arr[0]; + // 256 + + // Field projection: + let mut foo: Foo = Foo(4.0); + let mut bar: Bar = Bar { x: 4.0 }; + foo.0 /= 2.0; + bar.x /= 2.0; + d /= foo.0; + d /= bar.x; + // 64 + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(4.0)]; + arr[0].0 /= 2.0; + d /= arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: 4.0 }]; + arr[0].x /= 2.0; + d /= arr[0].x; + // 16 + + // Field + Array projection: + let mut arr: Foo<[f32; 1]> = Foo([4.0]); + (arr.0)[0] /= 2.0; + d /= (arr.0)[0]; + let mut arr: Bar<[f32; 1]> = Bar { x: [4.0] }; + arr.x[0] /= 2.0; + d /= arr.x[0]; + // 4 + + d +} + +const fn rem_assign(W(a): W) -> f32 { + // Mutables: + let mut d: f32 = a; + d %= 10.0; + d += 10.0; + + // Array projection + let mut arr: [f32; 1] = [3.0]; + arr[0] %= 2.0; + d %= 9.0 + arr[0]; + d += 10.0; + + // Field projection: + let mut foo: Foo = Foo(5.0); + let mut bar: Bar = Bar { x: 7.0 }; + foo.0 %= 2.0; + bar.x %= 2.0; + d %= 8.0 + foo.0 + bar.x; + d += 10.0; + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(4.0)]; + arr[0].0 %= 3.0; + d %= 9.0 + arr[0].0; + d += 10.0; + let mut arr: [Bar; 1] = [Bar { x: 7.0 }]; + arr[0].x %= 3.0; + d %= 9.0 + arr[0].x; + d += 10.0; + + // Field + Array projection: + let mut arr: Foo<[f32; 1]> = Foo([6.0]); + (arr.0)[0] %= 5.0; + d %= 9.0 + (arr.0)[0]; + let mut arr: Bar<[f32; 1]> = Bar { x: [11.0] }; + arr.x[0] %= 5.0; + d %= 9.0 + arr.x[0]; + + d +} + +const fn sub_assign(W(a): W) -> f32 { + // Mutables: + let mut d: f32 = a; + d -= 1.0; + + // Array projection + let mut arr: [f32; 1] = [2.0]; + arr[0] -= 1.0; + d -= arr[0]; + + // Field projection: + let mut foo: Foo = Foo(2.0); + let mut bar: Bar = Bar { x: 2.0 }; + foo.0 -= 1.0; + bar.x -= 1.0; + d -= foo.0 + bar.x; + + // Array + Field projection: + let mut arr: [Foo; 1] = [Foo(2.0)]; + arr[0].0 -= 1.0; + d -= arr[0].0; + let mut arr: [Bar; 1] = [Bar { x: 2.0 }]; + arr[0].x -= 1.0; + d -= arr[0].x; + + // Field + Array projection: + let mut arr: Foo<[f32; 1]> = Foo([2.0]); + (arr.0)[0] -= 1.0; + d -= (arr.0)[0]; + let mut arr: Bar<[f32; 1]> = Bar { x: [2.0] }; + arr.x[0] -= 1.0; + d -= arr.x[0]; + + d +} + +macro_rules! test { + ($c:ident, $e:expr, $r:expr) => { + const $c: f32 = $e; + assert_eq!($c, $r); + assert_eq!($e, $r); + } +} + +fn main() { + test!(BASICS, basics((2.0,)), 13.0); + test!(ADD, add_assign(W(1.0)), 10.0); + test!(MUL, mul_assign(A { a: 0.0 }), 256.0); + test!(DIV, div_assign([1.0]), 4.0); + test!(REM, rem_assign(W(5.0)), 5.0); + test!(SUB, sub_assign(W(8.0)), 0.0); +} diff --git a/src/test/ui/consts/const_let_irrefutable.rs b/src/test/ui/consts/const_let_irrefutable.rs new file mode 100644 index 00000000000..424a16f7ed3 --- /dev/null +++ b/src/test/ui/consts/const_let_irrefutable.rs @@ -0,0 +1,11 @@ +// compile-pass + +fn main() {} + +const fn tup((a, b): (i32, i32)) -> i32 { + a + b +} + +const fn array([a, b]: [i32; 2]) -> i32 { + a + b +} diff --git a/src/test/ui/consts/const_let_refutable.rs b/src/test/ui/consts/const_let_refutable.rs new file mode 100644 index 00000000000..345f682868f --- /dev/null +++ b/src/test/ui/consts/const_let_refutable.rs @@ -0,0 +1,5 @@ +fn main() {} + +const fn slice([a, b]: &[i32]) -> i32 { //~ ERROR refutable pattern in function argument + a + b +} diff --git a/src/test/ui/consts/const_let_refutable.stderr b/src/test/ui/consts/const_let_refutable.stderr new file mode 100644 index 00000000000..c5d2ba02a70 --- /dev/null +++ b/src/test/ui/consts/const_let_refutable.stderr @@ -0,0 +1,9 @@ +error[E0005]: refutable pattern in function argument: `&[]` not covered + --> $DIR/const_let_refutable.rs:3:16 + | +LL | const fn slice([a, b]: &[i32]) -> i32 { //~ ERROR refutable pattern in function argument + | ^^^^^^ pattern `&[]` not covered + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0005`. diff --git a/src/test/ui/consts/const_short_circuit.rs b/src/test/ui/consts/const_short_circuit.rs new file mode 100644 index 00000000000..1e7b7ed3193 --- /dev/null +++ b/src/test/ui/consts/const_short_circuit.rs @@ -0,0 +1,16 @@ +#![feature(underscore_const_names)] + +const _: bool = false && false; +const _: bool = true && false; +const _: bool = { + let mut x = true && false; + //~^ ERROR new features like let bindings are not permitted + x +}; +const _: bool = { + let x = true && false; + //~^ ERROR new features like let bindings are not permitted + x +}; + +fn main() {} diff --git a/src/test/ui/consts/const_short_circuit.stderr b/src/test/ui/consts/const_short_circuit.stderr new file mode 100644 index 00000000000..a67bb0b1b6d --- /dev/null +++ b/src/test/ui/consts/const_short_circuit.stderr @@ -0,0 +1,26 @@ +error: new features like let bindings are not permitted in constants which also use short circuiting operators + --> $DIR/const_short_circuit.rs:6:9 + | +LL | let mut x = true && false; + | ^^^^^ + | +note: use of `&&` operator here does not actually short circuit due to the const evaluator presently not being able to do control flow. See https://github.com/rust-lang/rust/issues/49146 for more information. + --> $DIR/const_short_circuit.rs:6:22 + | +LL | let mut x = true && false; + | ^^ + +error: new features like let bindings are not permitted in constants which also use short circuiting operators + --> $DIR/const_short_circuit.rs:11:9 + | +LL | let x = true && false; + | ^ + | +note: use of `&&` operator here does not actually short circuit due to the const evaluator presently not being able to do control flow. See https://github.com/rust-lang/rust/issues/49146 for more information. + --> $DIR/const_short_circuit.rs:11:18 + | +LL | let x = true && false; + | ^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/consts/dangling-alloc-id-ice.rs b/src/test/ui/consts/dangling-alloc-id-ice.rs index 695d33b6908..dbc50f1fbd4 100644 --- a/src/test/ui/consts/dangling-alloc-id-ice.rs +++ b/src/test/ui/consts/dangling-alloc-id-ice.rs @@ -1,7 +1,5 @@ // https://github.com/rust-lang/rust/issues/55223 -#![feature(const_let)] - union Foo<'a> { y: &'a (), long_live_the_unit: &'static (), diff --git a/src/test/ui/consts/dangling-alloc-id-ice.stderr b/src/test/ui/consts/dangling-alloc-id-ice.stderr index a5fa88e5e68..2cd8711f03d 100644 --- a/src/test/ui/consts/dangling-alloc-id-ice.stderr +++ b/src/test/ui/consts/dangling-alloc-id-ice.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/dangling-alloc-id-ice.rs:10:1 + --> $DIR/dangling-alloc-id-ice.rs:8:1 | LL | / const FOO: &() = { //~ ERROR any use of this value will cause an error LL | | let y = (); diff --git a/src/test/ui/consts/dangling_raw_ptr.rs b/src/test/ui/consts/dangling_raw_ptr.rs index 7fc773412f2..c2d8e6d421a 100644 --- a/src/test/ui/consts/dangling_raw_ptr.rs +++ b/src/test/ui/consts/dangling_raw_ptr.rs @@ -1,5 +1,3 @@ -#![feature(const_let)] - const FOO: *const u32 = { //~ ERROR any use of this value will cause an error let x = 42; &x diff --git a/src/test/ui/consts/dangling_raw_ptr.stderr b/src/test/ui/consts/dangling_raw_ptr.stderr index 3b20936f8ae..091f1f785cb 100644 --- a/src/test/ui/consts/dangling_raw_ptr.stderr +++ b/src/test/ui/consts/dangling_raw_ptr.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/dangling_raw_ptr.rs:3:1 + --> $DIR/dangling_raw_ptr.rs:1:1 | LL | / const FOO: *const u32 = { //~ ERROR any use of this value will cause an error LL | | let x = 42; diff --git a/src/test/ui/consts/drop_none.rs b/src/test/ui/consts/drop_none.rs new file mode 100644 index 00000000000..86a197ffb99 --- /dev/null +++ b/src/test/ui/consts/drop_none.rs @@ -0,0 +1,13 @@ +// compile-pass +#![allow(dead_code)] +struct A; +impl Drop for A { + fn drop(&mut self) {} +} + +const FOO: Option = None; + +const BAR: () = (FOO, ()).1; + + +fn main() {} diff --git a/src/test/ui/consts/int_ptr_for_zst_slices.rs b/src/test/ui/consts/int_ptr_for_zst_slices.rs new file mode 100644 index 00000000000..afa2c6a5b9e --- /dev/null +++ b/src/test/ui/consts/int_ptr_for_zst_slices.rs @@ -0,0 +1,7 @@ +// compile-pass + +#![feature(const_raw_ptr_deref)] + +const FOO: &str = unsafe { &*(1_usize as *const [u8; 0] as *const [u8] as *const str) }; + +fn main() {} diff --git a/src/test/ui/consts/issue-56164.rs b/src/test/ui/consts/issue-56164.rs new file mode 100644 index 00000000000..9d1a8b59463 --- /dev/null +++ b/src/test/ui/consts/issue-56164.rs @@ -0,0 +1,13 @@ +#![feature(const_fn)] + +const fn foo() { (||{})() } +//~^ ERROR calls in constant functions are limited to constant functions, tuple structs and tuple +// variants + +const fn bad(input: fn()) { + input() + //~^ ERROR function pointers are not allowed in const fn +} + +fn main() { +} diff --git a/src/test/ui/consts/issue-56164.stderr b/src/test/ui/consts/issue-56164.stderr new file mode 100644 index 00000000000..d3e9ce379ae --- /dev/null +++ b/src/test/ui/consts/issue-56164.stderr @@ -0,0 +1,15 @@ +error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants + --> $DIR/issue-56164.rs:3:18 + | +LL | const fn foo() { (||{})() } + | ^^^^^^^^ + +error: function pointers are not allowed in const fn + --> $DIR/issue-56164.rs:8:5 + | +LL | input() + | ^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0015`. diff --git a/src/test/ui/consts/match_ice.rs b/src/test/ui/consts/match_ice.rs new file mode 100644 index 00000000000..53c5782a4c7 --- /dev/null +++ b/src/test/ui/consts/match_ice.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/53708 + +struct S; + +fn main() { + const C: &S = &S; + match C { //~ ERROR non-exhaustive + C => {} // this is a common bug around constants and references in patterns + } +} diff --git a/src/test/ui/consts/match_ice.stderr b/src/test/ui/consts/match_ice.stderr new file mode 100644 index 00000000000..e6e04e2c462 --- /dev/null +++ b/src/test/ui/consts/match_ice.stderr @@ -0,0 +1,9 @@ +error[E0004]: non-exhaustive patterns: `&S` not covered + --> $DIR/match_ice.rs:7:11 + | +LL | match C { //~ ERROR non-exhaustive + | ^ pattern `&S` not covered + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0004`. diff --git a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs b/src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs index d8abd976558..c2600f894dc 100644 --- a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs +++ b/src/test/ui/consts/min_const_fn/cmp_fn_pointers.rs @@ -1,5 +1,5 @@ const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointers in const fn are unstable - x == y + unsafe { x == y } } fn main() {} diff --git a/src/test/ui/consts/min_const_fn/loop_ice.rs b/src/test/ui/consts/min_const_fn/loop_ice.rs new file mode 100644 index 00000000000..4278a8e2d00 --- /dev/null +++ b/src/test/ui/consts/min_const_fn/loop_ice.rs @@ -0,0 +1,5 @@ +const fn foo() { + loop {} //~ ERROR loops are not allowed in const fn +} + +fn main() {} diff --git a/src/test/ui/consts/min_const_fn/loop_ice.stderr b/src/test/ui/consts/min_const_fn/loop_ice.stderr new file mode 100644 index 00000000000..1424cea65af --- /dev/null +++ b/src/test/ui/consts/min_const_fn/loop_ice.stderr @@ -0,0 +1,8 @@ +error: loops are not allowed in const fn + --> $DIR/loop_ice.rs:2:5 + | +LL | loop {} //~ ERROR loops are not allowed in const fn + | ^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr index f43befb37c1..763c69e8050 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr @@ -1,197 +1,203 @@ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/min_const_fn.rs:47:25 + --> $DIR/min_const_fn.rs:37:25 | LL | const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated | ^^^^ constant functions cannot evaluate destructors error: mutable references in const fn are unstable - --> $DIR/min_const_fn.rs:49:36 + --> $DIR/min_const_fn.rs:39:36 | LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } | ^^^^^^ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/min_const_fn.rs:54:28 + --> $DIR/min_const_fn.rs:44:28 | LL | const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated | ^^^^ constant functions cannot evaluate destructors error: mutable references in const fn are unstable - --> $DIR/min_const_fn.rs:56:42 + --> $DIR/min_const_fn.rs:46:42 | LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } | ^^^^^^ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/min_const_fn.rs:61:27 + --> $DIR/min_const_fn.rs:51:27 | LL | const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors | ^^^^ constant functions cannot evaluate destructors error: mutable references in const fn are unstable - --> $DIR/min_const_fn.rs:63:38 + --> $DIR/min_const_fn.rs:53:38 | LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } | ^^^^^^ error: mutable references in const fn are unstable - --> $DIR/min_const_fn.rs:68:39 + --> $DIR/min_const_fn.rs:58:39 | LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } | ^^^^^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:86:16 + --> $DIR/min_const_fn.rs:76:16 | LL | const fn foo11(t: T) -> T { t } | ^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:88:18 + --> $DIR/min_const_fn.rs:78:18 | LL | const fn foo11_2(t: T) -> T { t } | ^ error: only int, `bool` and `char` operations are stable in const fn - --> $DIR/min_const_fn.rs:90:33 + --> $DIR/min_const_fn.rs:80:33 | LL | const fn foo19(f: f32) -> f32 { f * 2.0 } | ^^^^^^^ error: only int, `bool` and `char` operations are stable in const fn - --> $DIR/min_const_fn.rs:92:35 + --> $DIR/min_const_fn.rs:82:35 | LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f } | ^^^^^^^ error: only int and `bool` operations are stable in const fn - --> $DIR/min_const_fn.rs:94:35 + --> $DIR/min_const_fn.rs:84:35 | LL | const fn foo19_3(f: f32) -> f32 { -f } | ^^ error: only int, `bool` and `char` operations are stable in const fn - --> $DIR/min_const_fn.rs:96:43 + --> $DIR/min_const_fn.rs:86:43 | LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g } | ^^^^^ error: cannot access `static` items in const fn - --> $DIR/min_const_fn.rs:100:27 + --> $DIR/min_const_fn.rs:90:27 | LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn | ^^^ error: cannot access `static` items in const fn - --> $DIR/min_const_fn.rs:101:36 + --> $DIR/min_const_fn.rs:91:36 | LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items | ^^^^ error: casting pointers to ints is unstable in const fn - --> $DIR/min_const_fn.rs:102:42 + --> $DIR/min_const_fn.rs:92:42 | LL | const fn foo30(x: *const u32) -> usize { x as usize } | ^^^^^^^^^^ error: casting pointers to ints is unstable in const fn - --> $DIR/min_const_fn.rs:104:42 + --> $DIR/min_const_fn.rs:94:63 + | +LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } } + | ^^^^^^^^^^ + +error: casting pointers to ints is unstable in const fn + --> $DIR/min_const_fn.rs:96:42 | LL | const fn foo30_2(x: *mut u32) -> usize { x as usize } | ^^^^^^^^^^ +error: casting pointers to ints is unstable in const fn + --> $DIR/min_const_fn.rs:98:63 + | +LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } } + | ^^^^^^^^^^ + error: `if`, `match`, `&&` and `||` are not stable in const fn - --> $DIR/min_const_fn.rs:106:38 + --> $DIR/min_const_fn.rs:100:38 | LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } } | ^^^^^^^^^^^^^^^^^^^^^^ error: `if`, `match`, `&&` and `||` are not stable in const fn - --> $DIR/min_const_fn.rs:108:29 + --> $DIR/min_const_fn.rs:102:29 | LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn | ^^^^^^^^^^^ -error: local variables in const fn are unstable - --> $DIR/min_const_fn.rs:109:34 - | -LL | const fn foo30_6() -> bool { let x = true; x } //~ ERROR local variables in const fn are unstable - | ^ - error: `if`, `match`, `&&` and `||` are not stable in const fn - --> $DIR/min_const_fn.rs:110:44 + --> $DIR/min_const_fn.rs:104:44 | LL | const fn foo36(a: bool, b: bool) -> bool { a && b } | ^^^^^^ error: `if`, `match`, `&&` and `||` are not stable in const fn - --> $DIR/min_const_fn.rs:112:44 + --> $DIR/min_const_fn.rs:106:44 | LL | const fn foo37(a: bool, b: bool) -> bool { a || b } | ^^^^^^ error: mutable references in const fn are unstable - --> $DIR/min_const_fn.rs:114:14 + --> $DIR/min_const_fn.rs:108:14 | LL | const fn inc(x: &mut i32) { *x += 1 } | ^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:119:6 + --> $DIR/min_const_fn.rs:113:6 | LL | impl Foo { | ^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:124:6 + --> $DIR/min_const_fn.rs:118:6 | LL | impl Foo { | ^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:129:6 + --> $DIR/min_const_fn.rs:123:6 | LL | impl Foo { | ^ error: `impl Trait` in const fn is unstable - --> $DIR/min_const_fn.rs:135:24 + --> $DIR/min_const_fn.rs:129:24 | LL | const fn no_rpit2() -> AlanTuring { AlanTuring(0) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:137:34 + --> $DIR/min_const_fn.rs:131:34 | LL | const fn no_apit2(_x: AlanTuring) {} | ^^^^^^^^^^^^^^^^^^^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:139:22 + --> $DIR/min_const_fn.rs:133:22 | LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` | ^^^^^^^^^^^^^^^^^^^^ error: `impl Trait` in const fn is unstable - --> $DIR/min_const_fn.rs:140:23 + --> $DIR/min_const_fn.rs:134:23 | LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable | ^^^^^^^^^^^^^^^^^^^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:141:23 + --> $DIR/min_const_fn.rs:135:23 | LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` | ^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:142:32 + --> $DIR/min_const_fn.rs:136:32 | LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning[E0515]: cannot return reference to temporary value - --> $DIR/min_const_fn.rs:142:63 + --> $DIR/min_const_fn.rs:136:63 | LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ^-- @@ -199,29 +205,28 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | |temporary value created here | returns a reference to data owned by the current function | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:147:41 + --> $DIR/min_const_fn.rs:141:41 | LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: function pointers in const fn are unstable - --> $DIR/min_const_fn.rs:150:21 + --> $DIR/min_const_fn.rs:144:21 | LL | const fn no_fn_ptrs(_x: fn()) {} | ^^ error: function pointers in const fn are unstable - --> $DIR/min_const_fn.rs:152:27 + --> $DIR/min_const_fn.rs:146:27 | LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } | ^^^^ -error: aborting due to 35 previous errors +error: aborting due to 36 previous errors Some errors occurred: E0493, E0515. For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.rs b/src/test/ui/consts/min_const_fn/min_const_fn.rs index 0dba3a7de53..ee3ffcd4026 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ok const fn foo1() {} const fn foo2(x: i32) -> i32 { x } @@ -78,9 +68,9 @@ const fn i32_ops2(c: i32, d: i32) -> bool { c < d } const fn i32_ops3(c: i32, d: i32) -> bool { c != d } const fn i32_ops4(c: i32, d: i32) -> i32 { c + d } const fn char_cast(u: u8) -> char { u as char } -const unsafe fn foo4() -> i32 { 42 } -const unsafe fn foo5() -> *const T { 0 as *const T } -const unsafe fn foo6() -> *mut T { 0 as *mut T } +const unsafe fn ret_i32_no_unsafe() -> i32 { 42 } +const unsafe fn ret_null_ptr_no_unsafe() -> *const T { 0 as *const T } +const unsafe fn ret_null_mut_ptr_no_unsafe() -> *mut T { 0 as *mut T } // not ok const fn foo11(t: T) -> T { t } @@ -100,13 +90,17 @@ static BAR: u32 = 42; const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items const fn foo30(x: *const u32) -> usize { x as usize } -//~^ ERROR casting pointers to int +//~^ ERROR casting pointers to ints is unstable +const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } } +//~^ ERROR casting pointers to ints is unstable const fn foo30_2(x: *mut u32) -> usize { x as usize } -//~^ ERROR casting pointers to int +//~^ ERROR casting pointers to ints is unstable +const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } } +//~^ ERROR casting pointers to ints is unstable const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } } //~^ ERROR `if`, `match`, `&&` and `||` are not stable in const fn const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn -const fn foo30_6() -> bool { let x = true; x } //~ ERROR local variables in const fn are unstable +const fn foo30_6() -> bool { let x = true; x } const fn foo36(a: bool, b: bool) -> bool { a && b } //~^ ERROR `if`, `match`, `&&` and `||` are not stable in const fn const fn foo37(a: bool, b: bool) -> bool { a || b } diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr index bcb9be6e548..52c60c57b8f 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.stderr @@ -1,213 +1,219 @@ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/min_const_fn.rs:47:25 + --> $DIR/min_const_fn.rs:37:25 | LL | const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated | ^^^^ constant functions cannot evaluate destructors error: mutable references in const fn are unstable - --> $DIR/min_const_fn.rs:49:36 + --> $DIR/min_const_fn.rs:39:36 | LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } | ^^^^^^ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/min_const_fn.rs:54:28 + --> $DIR/min_const_fn.rs:44:28 | LL | const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated | ^^^^ constant functions cannot evaluate destructors error: mutable references in const fn are unstable - --> $DIR/min_const_fn.rs:56:42 + --> $DIR/min_const_fn.rs:46:42 | LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } | ^^^^^^ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/min_const_fn.rs:61:27 + --> $DIR/min_const_fn.rs:51:27 | LL | const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors | ^^^^ constant functions cannot evaluate destructors error: mutable references in const fn are unstable - --> $DIR/min_const_fn.rs:63:38 + --> $DIR/min_const_fn.rs:53:38 | LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } | ^^^^^^ error: mutable references in const fn are unstable - --> $DIR/min_const_fn.rs:68:39 + --> $DIR/min_const_fn.rs:58:39 | LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } | ^^^^^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:86:16 + --> $DIR/min_const_fn.rs:76:16 | LL | const fn foo11(t: T) -> T { t } | ^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:88:18 + --> $DIR/min_const_fn.rs:78:18 | LL | const fn foo11_2(t: T) -> T { t } | ^ error: only int, `bool` and `char` operations are stable in const fn - --> $DIR/min_const_fn.rs:90:33 + --> $DIR/min_const_fn.rs:80:33 | LL | const fn foo19(f: f32) -> f32 { f * 2.0 } | ^^^^^^^ error: only int, `bool` and `char` operations are stable in const fn - --> $DIR/min_const_fn.rs:92:35 + --> $DIR/min_const_fn.rs:82:35 | LL | const fn foo19_2(f: f32) -> f32 { 2.0 - f } | ^^^^^^^ error: only int and `bool` operations are stable in const fn - --> $DIR/min_const_fn.rs:94:35 + --> $DIR/min_const_fn.rs:84:35 | LL | const fn foo19_3(f: f32) -> f32 { -f } | ^^ error: only int, `bool` and `char` operations are stable in const fn - --> $DIR/min_const_fn.rs:96:43 + --> $DIR/min_const_fn.rs:86:43 | LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g } | ^^^^^ error: cannot access `static` items in const fn - --> $DIR/min_const_fn.rs:100:27 + --> $DIR/min_const_fn.rs:90:27 | LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn | ^^^ error: cannot access `static` items in const fn - --> $DIR/min_const_fn.rs:101:36 + --> $DIR/min_const_fn.rs:91:36 | LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items | ^^^^ error: casting pointers to ints is unstable in const fn - --> $DIR/min_const_fn.rs:102:42 + --> $DIR/min_const_fn.rs:92:42 | LL | const fn foo30(x: *const u32) -> usize { x as usize } | ^^^^^^^^^^ error: casting pointers to ints is unstable in const fn - --> $DIR/min_const_fn.rs:104:42 + --> $DIR/min_const_fn.rs:94:63 + | +LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } } + | ^^^^^^^^^^ + +error: casting pointers to ints is unstable in const fn + --> $DIR/min_const_fn.rs:96:42 | LL | const fn foo30_2(x: *mut u32) -> usize { x as usize } | ^^^^^^^^^^ +error: casting pointers to ints is unstable in const fn + --> $DIR/min_const_fn.rs:98:63 + | +LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } } + | ^^^^^^^^^^ + error: `if`, `match`, `&&` and `||` are not stable in const fn - --> $DIR/min_const_fn.rs:106:38 + --> $DIR/min_const_fn.rs:100:38 | LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } } | ^^^^^^^^^^^^^^^^^^^^^^ error: `if`, `match`, `&&` and `||` are not stable in const fn - --> $DIR/min_const_fn.rs:108:29 + --> $DIR/min_const_fn.rs:102:29 | LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn | ^^^^^^^^^^^ -error: local variables in const fn are unstable - --> $DIR/min_const_fn.rs:109:34 - | -LL | const fn foo30_6() -> bool { let x = true; x } //~ ERROR local variables in const fn are unstable - | ^ - error: `if`, `match`, `&&` and `||` are not stable in const fn - --> $DIR/min_const_fn.rs:110:44 + --> $DIR/min_const_fn.rs:104:44 | LL | const fn foo36(a: bool, b: bool) -> bool { a && b } | ^^^^^^ error: `if`, `match`, `&&` and `||` are not stable in const fn - --> $DIR/min_const_fn.rs:112:44 + --> $DIR/min_const_fn.rs:106:44 | LL | const fn foo37(a: bool, b: bool) -> bool { a || b } | ^^^^^^ error: mutable references in const fn are unstable - --> $DIR/min_const_fn.rs:114:14 + --> $DIR/min_const_fn.rs:108:14 | LL | const fn inc(x: &mut i32) { *x += 1 } | ^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:119:6 + --> $DIR/min_const_fn.rs:113:6 | LL | impl Foo { | ^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:124:6 + --> $DIR/min_const_fn.rs:118:6 | LL | impl Foo { | ^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:129:6 + --> $DIR/min_const_fn.rs:123:6 | LL | impl Foo { | ^ error: `impl Trait` in const fn is unstable - --> $DIR/min_const_fn.rs:135:24 + --> $DIR/min_const_fn.rs:129:24 | LL | const fn no_rpit2() -> AlanTuring { AlanTuring(0) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:137:34 + --> $DIR/min_const_fn.rs:131:34 | LL | const fn no_apit2(_x: AlanTuring) {} | ^^^^^^^^^^^^^^^^^^^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:139:22 + --> $DIR/min_const_fn.rs:133:22 | LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` | ^^^^^^^^^^^^^^^^^^^^ error: `impl Trait` in const fn is unstable - --> $DIR/min_const_fn.rs:140:23 + --> $DIR/min_const_fn.rs:134:23 | LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable | ^^^^^^^^^^^^^^^^^^^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:141:23 + --> $DIR/min_const_fn.rs:135:23 | LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` | ^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:142:32 + --> $DIR/min_const_fn.rs:136:32 | LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:147:41 + --> $DIR/min_const_fn.rs:141:41 | LL | const fn really_no_traits_i_mean_it() { (&() as &std::fmt::Debug, ()).1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: function pointers in const fn are unstable - --> $DIR/min_const_fn.rs:150:21 + --> $DIR/min_const_fn.rs:144:21 | LL | const fn no_fn_ptrs(_x: fn()) {} | ^^ error: function pointers in const fn are unstable - --> $DIR/min_const_fn.rs:152:27 + --> $DIR/min_const_fn.rs:146:27 | LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } | ^^^^ -error: aborting due to 35 previous errors +error: aborting due to 36 previous errors For more information about this error, try `rustc --explain E0493`. diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr index 4ec00a16456..6dbe9b1c6ab 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.nll.stderr @@ -1,17 +1,17 @@ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn_dyn.rs:19:5 + --> $DIR/min_const_fn_dyn.rs:9:5 | LL | x.0.field; | ^^^^^^^^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn_dyn.rs:22:66 + --> $DIR/min_const_fn_dyn.rs:12:66 | LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } | ^^ warning[E0716]: temporary value dropped while borrowed - --> $DIR/min_const_fn_dyn.rs:22:67 + --> $DIR/min_const_fn_dyn.rs:12:67 | LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } | -^ - temporary value is freed at the end of this statement @@ -19,9 +19,8 @@ LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } | |creates a temporary which is freed while still in use | cast requires that borrow lasts for `'static` | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs index e02474734d9..6ca1e59b3af 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct HasDyn { field: &'static dyn std::fmt::Debug, } diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr index 7bf9bdb6fa9..8179cf795b4 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_dyn.stderr @@ -1,11 +1,11 @@ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn_dyn.rs:19:5 + --> $DIR/min_const_fn_dyn.rs:9:5 | LL | x.0.field; | ^^^^^^^^^ error: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn_dyn.rs:22:66 + --> $DIR/min_const_fn_dyn.rs:12:66 | LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) } | ^^ diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs index 64f212bc237..584ea46b1a6 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct HasPtr { field: fn(), } diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr index 54ffe66581d..c1cb19180a5 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_fn_ptr.stderr @@ -1,11 +1,11 @@ error: function pointers in const fn are unstable - --> $DIR/min_const_fn_fn_ptr.rs:21:5 + --> $DIR/min_const_fn_fn_ptr.rs:11:5 | LL | x.0.field; | ^^^^^^^^^ error: function pointers in const fn are unstable - --> $DIR/min_const_fn_fn_ptr.rs:24:59 + --> $DIR/min_const_fn_fn_ptr.rs:14:59 | LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasPtr { field }) } | ^^^^^ diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd.rs b/src/test/ui/consts/min_const_fn/min_const_fn_libstd.rs index 1a3e6d01912..781d2891c26 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_libstd.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn_libstd.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(integer_atomics)] // compile-pass diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs index 9f5d0ad5df3..db416e7eb03 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![unstable(feature = "humans", reason = "who ever let humans program computers, we're apparently really bad at it", diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr index 1ef7ffd3a91..9640105d25c 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr @@ -1,23 +1,23 @@ error: can only call other `min_const_fn` within a `min_const_fn` - --> $DIR/min_const_fn_libstd_stability.rs:25:25 + --> $DIR/min_const_fn_libstd_stability.rs:15:25 | LL | const fn bar() -> u32 { foo() } //~ ERROR can only call other `min_const_fn` | ^^^^^ error: can only call other `min_const_fn` within a `min_const_fn` - --> $DIR/min_const_fn_libstd_stability.rs:32:26 + --> $DIR/min_const_fn_libstd_stability.rs:22:26 | LL | const fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min_const_fn` | ^^^^^^ error: only int, `bool` and `char` operations are stable in const fn - --> $DIR/min_const_fn_libstd_stability.rs:36:26 + --> $DIR/min_const_fn_libstd_stability.rs:26:26 | LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` operations | ^^^^^^^^^^^^^ error: can only call other `min_const_fn` within a `min_const_fn` - --> $DIR/min_const_fn_libstd_stability.rs:44:32 + --> $DIR/min_const_fn_libstd_stability.rs:34:32 | LL | const fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `min_const_fn` | ^^^^^^^^^^^^ diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs index 67332c6d2cf..e25dafa74d7 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.rs @@ -1,36 +1,65 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ok -const unsafe fn foo4() -> i32 { 42 } -const unsafe fn foo5() -> *const T { 0 as *const T } -const unsafe fn foo6() -> *mut T { 0 as *mut T } +//------------------------------------------------------------------------------ +// OK +//------------------------------------------------------------------------------ + +const unsafe fn ret_i32_no_unsafe() -> i32 { 42 } +const unsafe fn ret_null_ptr_no_unsafe() -> *const T { 0 as *const T } +const unsafe fn ret_null_mut_ptr_no_unsafe() -> *mut T { 0 as *mut T } const fn no_unsafe() { unsafe {} } -// not ok -const fn foo8() -> i32 { - unsafe { foo4() } //~ ERROR unsafe operations are not allowed in const fn +const fn call_unsafe_const_fn() -> i32 { + unsafe { ret_i32_no_unsafe() } +} +const fn call_unsafe_generic_const_fn() -> *const String { + unsafe { ret_null_ptr_no_unsafe::() } +} +const fn call_unsafe_generic_cell_const_fn() + -> *const Vec> +{ + unsafe { ret_null_mut_ptr_no_unsafe::>>() } +} + +const unsafe fn call_unsafe_const_unsafe_fn() -> i32 { + unsafe { ret_i32_no_unsafe() } +} +const unsafe fn call_unsafe_generic_const_unsafe_fn() -> *const String { + unsafe { ret_null_ptr_no_unsafe::() } } -const fn foo9() -> *const String { - unsafe { foo5::() } //~ ERROR unsafe operations are not allowed in const fn +const unsafe fn call_unsafe_generic_cell_const_unsafe_fn() + -> *const Vec> +{ + unsafe { ret_null_mut_ptr_no_unsafe::>>() } +} + +const unsafe fn call_unsafe_const_unsafe_fn_immediate() -> i32 { + ret_i32_no_unsafe() } -const fn foo10() -> *const Vec> { - unsafe { foo6::>>() } //~ ERROR not allowed in const fn +const unsafe fn call_unsafe_generic_const_unsafe_fn_immediate() -> *const String { + ret_null_ptr_no_unsafe::() } -const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowed in const fn +const unsafe fn call_unsafe_generic_cell_const_unsafe_fn_immediate() + -> *const Vec> +{ + ret_null_mut_ptr_no_unsafe::>>() +} + +//------------------------------------------------------------------------------ +// NOT OK +//------------------------------------------------------------------------------ + +const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe +//~^ dereferencing raw pointers in constant functions + +const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x } +//~^ dereferencing raw pointers in constant functions + +const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x } //~^ dereferencing raw pointers in constant functions fn main() {} const unsafe fn no_union() { union Foo { x: (), y: () } - Foo { x: () }.y //~ ERROR not allowed in const fn + Foo { x: () }.y //~^ unions in const fn } diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr index 8cff0d491d8..95871749365 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr @@ -1,59 +1,44 @@ error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911) - --> $DIR/min_const_fn_unsafe.rs:27:51 + --> $DIR/min_const_fn_unsafe.rs:50:77 | -LL | const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowed in const fn - | ^^ +LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe + | ^^^ | = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable -error[E0658]: unions in const fn are unstable (see issue #51909) - --> $DIR/min_const_fn_unsafe.rs:34:5 - | -LL | Foo { x: () }.y //~ ERROR not allowed in const fn - | ^^^^^^^^^^^^^^^ - | - = help: add #![feature(const_fn_union)] to the crate attributes to enable - -error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn - --> $DIR/min_const_fn_unsafe.rs:19:14 +error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911) + --> $DIR/min_const_fn_unsafe.rs:53:70 | -LL | unsafe { foo4() } //~ ERROR unsafe operations are not allowed in const fn - | ^^^^^^ call to unsafe function +LL | const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x } + | ^^ | - = note: consult the function's documentation for information on how to avoid undefined behavior + = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable -error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn - --> $DIR/min_const_fn_unsafe.rs:22:14 +error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911) + --> $DIR/min_const_fn_unsafe.rs:56:83 | -LL | unsafe { foo5::() } //~ ERROR unsafe operations are not allowed in const fn - | ^^^^^^^^^^^^^^^^ call to unsafe function +LL | const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x } + | ^^^ | - = note: consult the function's documentation for information on how to avoid undefined behavior + = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable -error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn - --> $DIR/min_const_fn_unsafe.rs:25:14 +error[E0658]: unions in const fn are unstable (see issue #51909) + --> $DIR/min_const_fn_unsafe.rs:63:5 | -LL | unsafe { foo6::>>() } //~ ERROR not allowed in const fn - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function +LL | Foo { x: () }.y + | ^^^^^^^^^^^^^^^ | - = note: consult the function's documentation for information on how to avoid undefined behavior + = help: add #![feature(const_fn_union)] to the crate attributes to enable -error: dereference of raw pointer is unsafe and unsafe operations are not allowed in const fn - --> $DIR/min_const_fn_unsafe.rs:27:51 +error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block + --> $DIR/min_const_fn_unsafe.rs:50:77 | -LL | const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowed in const fn - | ^^ dereference of raw pointer +LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe + | ^^^ dereference of raw pointer | = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior -error: access to union field is unsafe and unsafe operations are not allowed in const fn - --> $DIR/min_const_fn_unsafe.rs:34:5 - | -LL | Foo { x: () }.y //~ ERROR not allowed in const fn - | ^^^^^^^^^^^^^^^ access to union field - | - = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior - -error: aborting due to 7 previous errors +error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0133, E0658. +For more information about an error, try `rustc --explain E0133`. diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs new file mode 100644 index 00000000000..7faba480a23 --- /dev/null +++ b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.rs @@ -0,0 +1,36 @@ +#![unstable(feature = "humans", + reason = "who ever let humans program computers, + we're apparently really bad at it", + issue = "0")] + +#![feature(rustc_const_unstable, const_fn, foo, foo2)] +#![feature(staged_api)] + +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_const_unstable(feature="foo")] +const unsafe fn foo() -> u32 { 42 } + +#[stable(feature = "rust1", since = "1.0.0")] +// can't call non-min_const_fn +const unsafe fn bar() -> u32 { unsafe { foo() } } //~ ERROR can only call other `min_const_fn` + +#[unstable(feature = "rust1", issue="0")] +const unsafe fn foo2() -> u32 { 42 } + +#[stable(feature = "rust1", since = "1.0.0")] +// can't call non-min_const_fn +const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR can only call other `min_const_fn` + +#[stable(feature = "rust1", since = "1.0.0")] +// conformity is required, even with `const_fn` feature gate +const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` op + +// check whether this function cannot be called even with the feature gate active +#[unstable(feature = "foo2", issue="0")] +const unsafe fn foo2_gated() -> u32 { 42 } + +#[stable(feature = "rust1", since = "1.0.0")] +// can't call non-min_const_fn +const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } //~ ERROR can only call other + +fn main() {} diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr new file mode 100644 index 00000000000..049c25e7191 --- /dev/null +++ b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr @@ -0,0 +1,26 @@ +error: can only call other `min_const_fn` within a `min_const_fn` + --> $DIR/min_const_unsafe_fn_libstd_stability.rs:15:41 + | +LL | const unsafe fn bar() -> u32 { unsafe { foo() } } //~ ERROR can only call other `min_const_fn` + | ^^^^^ + +error: can only call other `min_const_fn` within a `min_const_fn` + --> $DIR/min_const_unsafe_fn_libstd_stability.rs:22:42 + | +LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR can only call other `min_const_fn` + | ^^^^^^ + +error: only int, `bool` and `char` operations are stable in const fn + --> $DIR/min_const_unsafe_fn_libstd_stability.rs:26:33 + | +LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` op + | ^^^^^^^^^^^^^ + +error: can only call other `min_const_fn` within a `min_const_fn` + --> $DIR/min_const_unsafe_fn_libstd_stability.rs:34:48 + | +LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } //~ ERROR can only call other + | ^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.rs b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.rs new file mode 100644 index 00000000000..bc1d5091f38 --- /dev/null +++ b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.rs @@ -0,0 +1,32 @@ +#![unstable(feature = "humans", + reason = "who ever let humans program computers, + we're apparently really bad at it", + issue = "0")] + +#![feature(rustc_const_unstable, const_fn, foo, foo2)] +#![feature(staged_api)] + +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_const_unstable(feature="foo")] +const fn foo() -> u32 { 42 } + +#[stable(feature = "rust1", since = "1.0.0")] +// can't call non-min_const_fn +const unsafe fn bar() -> u32 { foo() } //~ ERROR can only call other `min_const_fn` + +#[unstable(feature = "rust1", issue="0")] +const fn foo2() -> u32 { 42 } + +#[stable(feature = "rust1", since = "1.0.0")] +// can't call non-min_const_fn +const unsafe fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min_const_fn` + +// check whether this function cannot be called even with the feature gate active +#[unstable(feature = "foo2", issue="0")] +const fn foo2_gated() -> u32 { 42 } + +#[stable(feature = "rust1", since = "1.0.0")] +// can't call non-min_const_fn +const unsafe fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `min_const_fn` + +fn main() {} diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr new file mode 100644 index 00000000000..89509f813e1 --- /dev/null +++ b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr @@ -0,0 +1,20 @@ +error: can only call other `min_const_fn` within a `min_const_fn` + --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:15:32 + | +LL | const unsafe fn bar() -> u32 { foo() } //~ ERROR can only call other `min_const_fn` + | ^^^^^ + +error: can only call other `min_const_fn` within a `min_const_fn` + --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:22:33 + | +LL | const unsafe fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min_const_fn` + | ^^^^^^ + +error: can only call other `min_const_fn` within a `min_const_fn` + --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:30:39 + | +LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `min_const_fn` + | ^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/consts/min_const_fn/mutable_borrow.rs b/src/test/ui/consts/min_const_fn/mutable_borrow.rs new file mode 100644 index 00000000000..89acfea6ed8 --- /dev/null +++ b/src/test/ui/consts/min_const_fn/mutable_borrow.rs @@ -0,0 +1,17 @@ +const fn mutable_ref_in_const() -> u8 { + let mut a = 0; + let b = &mut a; //~ ERROR mutable references in const fn + *b +} + +struct X; + +impl X { + const fn inherent_mutable_ref_in_const() -> u8 { + let mut a = 0; + let b = &mut a; //~ ERROR mutable references in const fn + *b + } +} + +fn main() {} diff --git a/src/test/ui/consts/min_const_fn/mutable_borrow.stderr b/src/test/ui/consts/min_const_fn/mutable_borrow.stderr new file mode 100644 index 00000000000..5ce0f30dc6e --- /dev/null +++ b/src/test/ui/consts/min_const_fn/mutable_borrow.stderr @@ -0,0 +1,14 @@ +error: mutable references in const fn are unstable + --> $DIR/mutable_borrow.rs:3:9 + | +LL | let b = &mut a; //~ ERROR mutable references in const fn + | ^ + +error: mutable references in const fn are unstable + --> $DIR/mutable_borrow.rs:12:13 + | +LL | let b = &mut a; //~ ERROR mutable references in const fn + | ^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/consts/partial_qualif.rs b/src/test/ui/consts/partial_qualif.rs new file mode 100644 index 00000000000..32c68e69f4b --- /dev/null +++ b/src/test/ui/consts/partial_qualif.rs @@ -0,0 +1,9 @@ +use std::cell::Cell; + +const FOO: &(Cell, bool) = { + let mut a = (Cell::new(0), false); + a.1 = true; // sets `qualif(a)` to `qualif(a) | qualif(true)` + &{a} //~ ERROR cannot borrow a constant which may contain interior mutability +}; + +fn main() {} diff --git a/src/test/ui/consts/partial_qualif.stderr b/src/test/ui/consts/partial_qualif.stderr new file mode 100644 index 00000000000..967fb83b78b --- /dev/null +++ b/src/test/ui/consts/partial_qualif.stderr @@ -0,0 +1,9 @@ +error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead + --> $DIR/partial_qualif.rs:6:5 + | +LL | &{a} //~ ERROR cannot borrow a constant which may contain interior mutability + | ^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0492`. diff --git a/src/test/ui/consts/projection_qualif.rs b/src/test/ui/consts/projection_qualif.rs new file mode 100644 index 00000000000..dedb7db5920 --- /dev/null +++ b/src/test/ui/consts/projection_qualif.rs @@ -0,0 +1,13 @@ +use std::cell::Cell; + +const FOO: &u32 = { + let mut a = 42; + { + let b: *mut u32 = &mut a; //~ ERROR may only refer to immutable values + unsafe { *b = 5; } //~ ERROR dereferencing raw pointers in constants + //~^ contains unimplemented expression + } + &{a} +}; + +fn main() {} diff --git a/src/test/ui/consts/projection_qualif.stderr b/src/test/ui/consts/projection_qualif.stderr new file mode 100644 index 00000000000..410c51c4b54 --- /dev/null +++ b/src/test/ui/consts/projection_qualif.stderr @@ -0,0 +1,24 @@ +error[E0017]: references in constants may only refer to immutable values + --> $DIR/projection_qualif.rs:6:27 + | +LL | let b: *mut u32 = &mut a; //~ ERROR may only refer to immutable values + | ^^^^^^ constants require immutable values + +error[E0019]: constant contains unimplemented expression type + --> $DIR/projection_qualif.rs:7:18 + | +LL | unsafe { *b = 5; } //~ ERROR dereferencing raw pointers in constants + | ^^^^^^ + +error[E0658]: dereferencing raw pointers in constants is unstable (see issue #51911) + --> $DIR/projection_qualif.rs:7:18 + | +LL | unsafe { *b = 5; } //~ ERROR dereferencing raw pointers in constants + | ^^^^^^ + | + = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable + +error: aborting due to 3 previous errors + +Some errors occurred: E0017, E0019, E0658. +For more information about an error, try `rustc --explain E0017`. diff --git a/src/test/ui/consts/promote_const_let.nll.stderr b/src/test/ui/consts/promote_const_let.nll.stderr new file mode 100644 index 00000000000..e6ee1523a3b --- /dev/null +++ b/src/test/ui/consts/promote_const_let.nll.stderr @@ -0,0 +1,29 @@ +error[E0597]: `y` does not live long enough + --> $DIR/promote_const_let.rs:4:9 + | +LL | let x: &'static u32 = { + | ------------ type annotation requires that `y` is borrowed for `'static` +LL | let y = 42; +LL | &y //~ ERROR does not live long enough + | ^^ borrowed value does not live long enough +LL | }; + | - `y` dropped here while still borrowed + +error[E0716]: temporary value dropped while borrowed + --> $DIR/promote_const_let.rs:6:28 + | +LL | let x: &'static u32 = &{ //~ ERROR does not live long enough + | ____________------------____^ + | | | + | | type annotation requires that borrow lasts for `'static` +LL | | let y = 42; +LL | | y +LL | | }; + | |_____^ creates a temporary which is freed while still in use +LL | } + | - temporary value is freed at the end of this statement + +error: aborting due to 2 previous errors + +Some errors occurred: E0597, E0716. +For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/consts/promote_const_let.rs b/src/test/ui/consts/promote_const_let.rs new file mode 100644 index 00000000000..a8a6d4d99c6 --- /dev/null +++ b/src/test/ui/consts/promote_const_let.rs @@ -0,0 +1,10 @@ +fn main() { + let x: &'static u32 = { + let y = 42; + &y //~ ERROR does not live long enough + }; + let x: &'static u32 = &{ //~ ERROR does not live long enough + let y = 42; + y + }; +} diff --git a/src/test/ui/consts/promote_const_let.stderr b/src/test/ui/consts/promote_const_let.stderr new file mode 100644 index 00000000000..d37bd491860 --- /dev/null +++ b/src/test/ui/consts/promote_const_let.stderr @@ -0,0 +1,27 @@ +error[E0597]: `y` does not live long enough + --> $DIR/promote_const_let.rs:4:10 + | +LL | &y //~ ERROR does not live long enough + | ^ borrowed value does not live long enough +LL | }; + | - borrowed value only lives until here + | + = note: borrowed value must be valid for the static lifetime... + +error[E0597]: borrowed value does not live long enough + --> $DIR/promote_const_let.rs:6:28 + | +LL | let x: &'static u32 = &{ //~ ERROR does not live long enough + | ____________________________^ +LL | | let y = 42; +LL | | y +LL | | }; + | |_____^ temporary value does not live long enough +LL | } + | - temporary value only lives until here + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/consts/promoted_regression.rs b/src/test/ui/consts/promoted_regression.rs new file mode 100644 index 00000000000..68b9a20ecf9 --- /dev/null +++ b/src/test/ui/consts/promoted_regression.rs @@ -0,0 +1,9 @@ +// compile-pass + +fn main() { + let _ = &[("", ""); 3]; +} + +const FOO: &[(&str, &str)] = &[("", ""); 3]; +const BAR: &[(&str, &str); 5] = &[("", ""); 5]; +const BAA: &[[&str; 12]; 11] = &[[""; 12]; 11]; diff --git a/src/test/ui/consts/qualif_overwrite.rs b/src/test/ui/consts/qualif_overwrite.rs new file mode 100644 index 00000000000..430eea37de7 --- /dev/null +++ b/src/test/ui/consts/qualif_overwrite.rs @@ -0,0 +1,13 @@ +use std::cell::Cell; + +// this is overly conservative. The reset to `None` should clear `a` of all qualifications +// while we could fix this, it would be inconsistent with `qualif_overwrite_2.rs`. +// We can fix this properly in the future by allowing constants that do not depend on generics +// to be checked by an analysis on the final value instead of looking at the body. +const FOO: &Option> = { + let mut a = Some(Cell::new(0)); + a = None; // sets `qualif(a)` to `qualif(a) | qualif(None)` + &{a} //~ ERROR cannot borrow a constant which may contain interior mutability +}; + +fn main() {} diff --git a/src/test/ui/consts/qualif_overwrite.stderr b/src/test/ui/consts/qualif_overwrite.stderr new file mode 100644 index 00000000000..30479139e31 --- /dev/null +++ b/src/test/ui/consts/qualif_overwrite.stderr @@ -0,0 +1,9 @@ +error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead + --> $DIR/qualif_overwrite.rs:10:5 + | +LL | &{a} //~ ERROR cannot borrow a constant which may contain interior mutability + | ^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0492`. diff --git a/src/test/ui/consts/qualif_overwrite_2.rs b/src/test/ui/consts/qualif_overwrite_2.rs new file mode 100644 index 00000000000..fa79b5c14a7 --- /dev/null +++ b/src/test/ui/consts/qualif_overwrite_2.rs @@ -0,0 +1,11 @@ +use std::cell::Cell; + +// const qualification is not smart enough to know about fields and always assumes that there might +// be other fields that caused the qualification +const FOO: &Option> = { + let mut a = (Some(Cell::new(0)),); + a.0 = None; // sets `qualif(a)` to `qualif(a) | qualif(None)` + &{a.0} //~ ERROR cannot borrow a constant which may contain interior mutability +}; + +fn main() {} diff --git a/src/test/ui/consts/qualif_overwrite_2.stderr b/src/test/ui/consts/qualif_overwrite_2.stderr new file mode 100644 index 00000000000..8276db99a12 --- /dev/null +++ b/src/test/ui/consts/qualif_overwrite_2.stderr @@ -0,0 +1,9 @@ +error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead + --> $DIR/qualif_overwrite_2.rs:8:5 + | +LL | &{a.0} //~ ERROR cannot borrow a constant which may contain interior mutability + | ^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0492`. diff --git a/src/test/ui/consts/single_variant_match_ice.rs b/src/test/ui/consts/single_variant_match_ice.rs index 67a41bc5dc4..79dde3c18e8 100644 --- a/src/test/ui/consts/single_variant_match_ice.rs +++ b/src/test/ui/consts/single_variant_match_ice.rs @@ -2,6 +2,14 @@ enum Foo { Prob, } +const FOO: u32 = match Foo::Prob { + Foo::Prob => 42, //~ ERROR unimplemented expression type +}; + +const BAR: u32 = match Foo::Prob { + x => 42, //~ ERROR unimplemented expression type +}; + impl Foo { pub const fn as_val(&self) -> u8 { use self::Foo::*; diff --git a/src/test/ui/consts/single_variant_match_ice.stderr b/src/test/ui/consts/single_variant_match_ice.stderr index a0222b0d489..f5c2cb5e0e9 100644 --- a/src/test/ui/consts/single_variant_match_ice.stderr +++ b/src/test/ui/consts/single_variant_match_ice.stderr @@ -1,8 +1,21 @@ +error[E0019]: constant contains unimplemented expression type + --> $DIR/single_variant_match_ice.rs:6:5 + | +LL | Foo::Prob => 42, //~ ERROR unimplemented expression type + | ^^^^^^^^^ + +error[E0019]: constant contains unimplemented expression type + --> $DIR/single_variant_match_ice.rs:10:5 + | +LL | x => 42, //~ ERROR unimplemented expression type + | ^ + error: `if`, `match`, `&&` and `||` are not stable in const fn - --> $DIR/single_variant_match_ice.rs:10:13 + --> $DIR/single_variant_match_ice.rs:18:13 | LL | Prob => 0x1, //~ ERROR `if`, `match`, `&&` and `||` are not stable in const fn | ^^^^ -error: aborting due to previous error +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0019`. diff --git a/src/test/ui/consts/static_mut_containing_mut_ref.rs b/src/test/ui/consts/static_mut_containing_mut_ref.rs new file mode 100644 index 00000000000..27e1a111163 --- /dev/null +++ b/src/test/ui/consts/static_mut_containing_mut_ref.rs @@ -0,0 +1,7 @@ +// compile-pass + +static mut STDERR_BUFFER_SPACE: [u8; 42] = [0u8; 42]; + +pub static mut STDERR_BUFFER: *mut [u8] = unsafe { &mut STDERR_BUFFER_SPACE }; + +fn main() {} diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.rs b/src/test/ui/consts/static_mut_containing_mut_ref2.rs new file mode 100644 index 00000000000..ef378fa8451 --- /dev/null +++ b/src/test/ui/consts/static_mut_containing_mut_ref2.rs @@ -0,0 +1,7 @@ +static mut STDERR_BUFFER_SPACE: u8 = 0; + +pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; +//~^ ERROR references in statics may only refer to immutable values +//~| ERROR static contains unimplemented expression type + +fn main() {} diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.stderr b/src/test/ui/consts/static_mut_containing_mut_ref2.stderr new file mode 100644 index 00000000000..72186571d69 --- /dev/null +++ b/src/test/ui/consts/static_mut_containing_mut_ref2.stderr @@ -0,0 +1,16 @@ +error[E0017]: references in statics may only refer to immutable values + --> $DIR/static_mut_containing_mut_ref2.rs:3:46 + | +LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ statics require immutable values + +error[E0019]: static contains unimplemented expression type + --> $DIR/static_mut_containing_mut_ref2.rs:3:45 + | +LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +Some errors occurred: E0017, E0019. +For more information about an error, try `rustc --explain E0017`. diff --git a/src/test/ui/consts/static_mut_containing_mut_ref3.rs b/src/test/ui/consts/static_mut_containing_mut_ref3.rs new file mode 100644 index 00000000000..c24c7e27920 --- /dev/null +++ b/src/test/ui/consts/static_mut_containing_mut_ref3.rs @@ -0,0 +1,6 @@ +static mut FOO: (u8, u8) = (42, 43); + +static mut BAR: () = unsafe { FOO.0 = 99; }; +//~^ ERROR could not evaluate static initializer + +fn main() {} diff --git a/src/test/ui/consts/static_mut_containing_mut_ref3.stderr b/src/test/ui/consts/static_mut_containing_mut_ref3.stderr new file mode 100644 index 00000000000..e88e49b097a --- /dev/null +++ b/src/test/ui/consts/static_mut_containing_mut_ref3.stderr @@ -0,0 +1,9 @@ +error[E0080]: could not evaluate static initializer + --> $DIR/static_mut_containing_mut_ref3.rs:3:31 + | +LL | static mut BAR: () = unsafe { FOO.0 = 99; }; + | ^^^^^^^^^^ tried to modify a static's initial value from another static's initializer + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/validate_never_arrays.rs b/src/test/ui/consts/validate_never_arrays.rs new file mode 100644 index 00000000000..9610b7b22f1 --- /dev/null +++ b/src/test/ui/consts/validate_never_arrays.rs @@ -0,0 +1,5 @@ +#![feature(const_raw_ptr_deref, never_type)] + +const FOO: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior + +fn main() {} diff --git a/src/test/ui/consts/validate_never_arrays.stderr b/src/test/ui/consts/validate_never_arrays.stderr new file mode 100644 index 00000000000..b9d181a76dd --- /dev/null +++ b/src/test/ui/consts/validate_never_arrays.stderr @@ -0,0 +1,11 @@ +error[E0080]: it is undefined behavior to use this value + --> $DIR/validate_never_arrays.rs:3:1 + | +LL | const FOO: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type at . + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/conversion-methods.rs b/src/test/ui/conversion-methods.rs index 8a53bc3ca93..46c2e511f33 100644 --- a/src/test/ui/conversion-methods.rs +++ b/src/test/ui/conversion-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::path::{Path, PathBuf}; diff --git a/src/test/ui/conversion-methods.stderr b/src/test/ui/conversion-methods.stderr index 970ccad2316..33fff4a0f68 100644 --- a/src/test/ui/conversion-methods.stderr +++ b/src/test/ui/conversion-methods.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/conversion-methods.rs:15:41 + --> $DIR/conversion-methods.rs:5:41 | LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—"; //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^ @@ -11,7 +11,7 @@ LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—"; //~ ERROR found type `&'static str` error[E0308]: mismatched types - --> $DIR/conversion-methods.rs:16:40 + --> $DIR/conversion-methods.rs:6:40 | LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,19 +23,19 @@ LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise"); found type `&std::path::Path` error[E0308]: mismatched types - --> $DIR/conversion-methods.rs:19:40 + --> $DIR/conversion-methods.rs:9:40 | LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here | ^ | | - | expected struct `std::string::String`, found integral variable + | expected struct `std::string::String`, found integer | help: try using a conversion method: `2.to_string()` | = note: expected type `std::string::String` found type `{integer}` error[E0308]: mismatched types - --> $DIR/conversion-methods.rs:22:47 + --> $DIR/conversion-methods.rs:12:47 | LL | let _prove_piercing_earnest: Vec = &[1, 2, 3]; //~ ERROR mismatched types | ^^^^^^^^^^ diff --git a/src/test/ui/copy-a-resource.rs b/src/test/ui/copy-a-resource.rs index 70633c92e64..55f2dd4ee6d 100644 --- a/src/test/ui/copy-a-resource.rs +++ b/src/test/ui/copy-a-resource.rs @@ -1,24 +1,14 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Debug)] -struct foo { +struct Foo { i: isize, } -impl Drop for foo { +impl Drop for Foo { fn drop(&mut self) {} } -fn foo(i:isize) -> foo { - foo { +fn foo(i:isize) -> Foo { + Foo { i: i } } diff --git a/src/test/ui/copy-a-resource.stderr b/src/test/ui/copy-a-resource.stderr index 6d8d4884d73..cceb9e328b6 100644 --- a/src/test/ui/copy-a-resource.stderr +++ b/src/test/ui/copy-a-resource.stderr @@ -1,7 +1,7 @@ -error[E0599]: no method named `clone` found for type `foo` in the current scope - --> $DIR/copy-a-resource.rs:28:16 +error[E0599]: no method named `clone` found for type `Foo` in the current scope + --> $DIR/copy-a-resource.rs:18:16 | -LL | struct foo { +LL | struct Foo { | ---------- method `clone` not found for this ... LL | let _y = x.clone(); diff --git a/src/test/ui/crate-in-paths.rs b/src/test/ui/crate-in-paths.rs index cbf60b6b6a6..50ed50cbef0 100644 --- a/src/test/ui/crate-in-paths.rs +++ b/src/test/ui/crate-in-paths.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 #![feature(crate_visibility_modifier)] diff --git a/src/test/ui/crate-in-paths.stderr b/src/test/ui/crate-in-paths.stderr index 5bb1a28ebb8..c67fd4ac13c 100644 --- a/src/test/ui/crate-in-paths.stderr +++ b/src/test/ui/crate-in-paths.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `Foo` in this scope - --> $DIR/crate-in-paths.rs:20:5 + --> $DIR/crate-in-paths.rs:10:5 | LL | Foo; | ^^^ not found in this scope diff --git a/src/test/ui/crate-name-mismatch.rs b/src/test/ui/crate-name-mismatch.rs index 589c0beb760..49a257f7b87 100644 --- a/src/test/ui/crate-name-mismatch.rs +++ b/src/test/ui/crate-name-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-name foo #![crate_name = "bar"] diff --git a/src/test/ui/crate-name-mismatch.stderr b/src/test/ui/crate-name-mismatch.stderr index 26ef91ba8e7..4784db86dea 100644 --- a/src/test/ui/crate-name-mismatch.stderr +++ b/src/test/ui/crate-name-mismatch.stderr @@ -1,5 +1,5 @@ error: --crate-name and #[crate_name] are required to match, but `foo` != `bar` - --> $DIR/crate-name-mismatch.rs:13:1 + --> $DIR/crate-name-mismatch.rs:3:1 | LL | #![crate_name = "bar"] | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/cross/cross-borrow-trait.rs b/src/test/ui/cross/cross-borrow-trait.rs index 7c76cf475d2..d8d7537f24a 100644 --- a/src/test/ui/cross/cross-borrow-trait.rs +++ b/src/test/ui/cross/cross-borrow-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that cross-borrowing (implicitly converting from `Box` to `&T`) is // forbidden when `T` is a trait. diff --git a/src/test/ui/cross/cross-borrow-trait.stderr b/src/test/ui/cross/cross-borrow-trait.stderr index d25316d542a..949b63ffbde 100644 --- a/src/test/ui/cross/cross-borrow-trait.stderr +++ b/src/test/ui/cross/cross-borrow-trait.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/cross-borrow-trait.rs:20:22 + --> $DIR/cross-borrow-trait.rs:10:22 | LL | let _y: &Trait = x; //~ ERROR E0308 | ^ diff --git a/src/test/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs b/src/test/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs index 598e9f0f53a..fbda3dbe948 100644 --- a/src/test/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs +++ b/src/test/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs @@ -1,20 +1,10 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "dylib"] pub fn print(_args: std::fmt::Arguments) {} #[macro_export] macro_rules! myprint { - ($($arg:tt)*) => (print(format_args!($($arg)*))); + ($($arg:tt)*) => ($crate::print(format_args!($($arg)*))); } #[macro_export] diff --git a/src/test/ui/cross/cross-crate-macro-backtrace/main.rs b/src/test/ui/cross/cross-crate-macro-backtrace/main.rs index 9a6fa3e6920..f7d4330ab19 100644 --- a/src/test/ui/cross/cross-crate-macro-backtrace/main.rs +++ b/src/test/ui/cross/cross-crate-macro-backtrace/main.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:extern_macro_crate.rs #[macro_use(myprintln, myprint)] extern crate extern_macro_crate; diff --git a/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr b/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr index bffd76ca587..b6ebe0ff1fc 100644 --- a/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr +++ b/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr @@ -1,5 +1,5 @@ error: 1 positional argument in format string, but no arguments were given - --> $DIR/main.rs:16:5 + --> $DIR/main.rs:6:5 | LL | myprintln!("{}"); | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/cross/cross-file-errors/main.rs b/src/test/ui/cross/cross-file-errors/main.rs index 659075acd88..74e9461803c 100644 --- a/src/test/ui/cross/cross-file-errors/main.rs +++ b/src/test/ui/cross/cross-file-errors/main.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_use] mod underscore; diff --git a/src/test/ui/cross/cross-file-errors/main.stderr b/src/test/ui/cross/cross-file-errors/main.stderr index a64595fbb40..7fd91eb1d66 100644 --- a/src/test/ui/cross/cross-file-errors/main.stderr +++ b/src/test/ui/cross/cross-file-errors/main.stderr @@ -1,10 +1,10 @@ error: expected expression, found reserved identifier `_` - --> $DIR/underscore.rs:18:9 + --> $DIR/underscore.rs:8:9 | LL | _ | ^ expected expression | - ::: $DIR/main.rs:15:5 + ::: $DIR/main.rs:5:5 | LL | underscore!(); | -------------- in this macro invocation diff --git a/src/test/ui/cross/cross-file-errors/underscore.rs b/src/test/ui/cross/cross-file-errors/underscore.rs index 312b3b8f4dd..76e72a93fcc 100644 --- a/src/test/ui/cross/cross-file-errors/underscore.rs +++ b/src/test/ui/cross/cross-file-errors/underscore.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We want this file only so we can test cross-file error // messages, but we don't want it in an external crate. // ignore-test diff --git a/src/test/ui/cross/cross-fn-cache-hole.rs b/src/test/ui/cross/cross-fn-cache-hole.rs index d437fc019fd..249c6474c94 100644 --- a/src/test/ui/cross/cross-fn-cache-hole.rs +++ b/src/test/ui/cross/cross-fn-cache-hole.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that when there are vacuous predicates in the environment // (which make a fn uncallable) we don't erroneously cache those and // then consider them satisfied elsewhere. The current technique for diff --git a/src/test/ui/cross/cross-fn-cache-hole.stderr b/src/test/ui/cross/cross-fn-cache-hole.stderr index bfcb83204bb..2cd57e363d0 100644 --- a/src/test/ui/cross/cross-fn-cache-hole.stderr +++ b/src/test/ui/cross/cross-fn-cache-hole.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `i32: Bar` is not satisfied - --> $DIR/cross-fn-cache-hole.rs:25:1 + --> $DIR/cross-fn-cache-hole.rs:15:1 | LL | / fn vacuous() //~ ERROR the trait bound `i32: Bar` is not satisfied LL | | where i32: Foo diff --git a/src/test/ui/custom-attribute-multisegment.rs b/src/test/ui/custom-attribute-multisegment.rs index 354f7173872..95cefe53938 100644 --- a/src/test/ui/custom-attribute-multisegment.rs +++ b/src/test/ui/custom-attribute-multisegment.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unresolved multi-segment attributes are not treated as custom. #![feature(custom_attribute)] diff --git a/src/test/ui/custom-attribute-multisegment.stderr b/src/test/ui/custom-attribute-multisegment.stderr index 690ba4982ab..6f6a87dd159 100644 --- a/src/test/ui/custom-attribute-multisegment.stderr +++ b/src/test/ui/custom-attribute-multisegment.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: could not find `nonexistent` in `existent` - --> $DIR/custom-attribute-multisegment.rs:17:13 + --> $DIR/custom-attribute-multisegment.rs:7:13 | LL | #[existent::nonexistent] //~ ERROR failed to resolve: could not find `nonexistent` in `existent` | ^^^^^^^^^^^ could not find `nonexistent` in `existent` diff --git a/src/test/ui/custom-derive/auxiliary/plugin.rs b/src/test/ui/custom-derive/auxiliary/plugin.rs new file mode 100644 index 00000000000..5e500de607c --- /dev/null +++ b/src/test/ui/custom-derive/auxiliary/plugin.rs @@ -0,0 +1,28 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Foo)] +pub fn derive_foo(input: TokenStream) -> TokenStream { + input +} + +#[proc_macro_derive(Bar)] +pub fn derive_bar(input: TokenStream) -> TokenStream { + panic!("lolnope"); +} + +#[proc_macro_derive(WithHelper, attributes(helper))] +pub fn with_helper(input: TokenStream) -> TokenStream { + TokenStream::new() +} + +#[proc_macro_attribute] +pub fn helper(_: TokenStream, input: TokenStream) -> TokenStream { + input +} diff --git a/src/test/ui-fulldeps/custom-derive/derive-in-mod.rs b/src/test/ui/custom-derive/derive-in-mod.rs similarity index 100% rename from src/test/ui-fulldeps/custom-derive/derive-in-mod.rs rename to src/test/ui/custom-derive/derive-in-mod.rs diff --git a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.rs b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs similarity index 91% rename from src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.rs rename to src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs index b750a8bb0d9..ba072ba3568 100644 --- a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import-ambig.rs +++ b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.rs @@ -1,5 +1,4 @@ // aux-build:plugin.rs -// ignore-stage1 #[macro_use(WithHelper)] extern crate plugin; diff --git a/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr new file mode 100644 index 00000000000..2c9d226cc9e --- /dev/null +++ b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr @@ -0,0 +1,21 @@ +error[E0659]: `helper` is ambiguous (derive helper attribute vs any other name) + --> $DIR/helper-attr-blocked-by-import-ambig.rs:9:3 + | +LL | #[helper] //~ ERROR `helper` is ambiguous + | ^^^^^^ ambiguous name + | +note: `helper` could refer to the derive helper attribute defined here + --> $DIR/helper-attr-blocked-by-import-ambig.rs:8:10 + | +LL | #[derive(WithHelper)] + | ^^^^^^^^^^ +note: `helper` could also refer to the attribute macro imported here + --> $DIR/helper-attr-blocked-by-import-ambig.rs:6:5 + | +LL | use plugin::helper; + | ^^^^^^^^^^^^^^ + = help: use `crate::helper` to refer to this attribute macro unambiguously + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import.rs b/src/test/ui/custom-derive/helper-attr-blocked-by-import.rs similarity index 95% rename from src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import.rs rename to src/test/ui/custom-derive/helper-attr-blocked-by-import.rs index 03b774f6c64..abbf014f553 100644 --- a/src/test/ui-fulldeps/custom-derive/helper-attr-blocked-by-import.rs +++ b/src/test/ui/custom-derive/helper-attr-blocked-by-import.rs @@ -1,6 +1,5 @@ // compile-pass // aux-build:plugin.rs -// ignore-stage1 #[macro_use(WithHelper)] extern crate plugin; diff --git a/src/test/ui/custom-derive/issue-36935.rs b/src/test/ui/custom-derive/issue-36935.rs new file mode 100644 index 00000000000..7a5d19f771f --- /dev/null +++ b/src/test/ui/custom-derive/issue-36935.rs @@ -0,0 +1,12 @@ +// aux-build:plugin.rs + + +#[macro_use] extern crate plugin; + +#[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked +struct Baz { + a: i32, + b: i32, +} + +fn main() {} diff --git a/src/test/ui-fulldeps/custom-derive/issue-36935.stderr b/src/test/ui/custom-derive/issue-36935.stderr similarity index 86% rename from src/test/ui-fulldeps/custom-derive/issue-36935.stderr rename to src/test/ui/custom-derive/issue-36935.stderr index ecbe0a9a0c0..d4c91546329 100644 --- a/src/test/ui-fulldeps/custom-derive/issue-36935.stderr +++ b/src/test/ui/custom-derive/issue-36935.stderr @@ -1,5 +1,5 @@ error: proc-macro derive panicked - --> $DIR/issue-36935.rs:16:15 + --> $DIR/issue-36935.rs:6:15 | LL | #[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked | ^^^ diff --git a/src/test/ui/custom-test-frameworks-simple.rs b/src/test/ui/custom-test-frameworks-simple.rs index 39a4dc569fa..a8aac6ec142 100644 --- a/src/test/ui/custom-test-frameworks-simple.rs +++ b/src/test/ui/custom-test-frameworks-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test // run-pass diff --git a/src/test/ui/custom_attribute.rs b/src/test/ui/custom_attribute.rs index eff734230ee..9cb43ab07ad 100644 --- a/src/test/ui/custom_attribute.rs +++ b/src/test/ui/custom_attribute.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(stmt_expr_attributes)] #[foo] //~ ERROR The attribute `foo` diff --git a/src/test/ui/custom_attribute.stderr b/src/test/ui/custom_attribute.stderr index 6ecad7d79b8..1100d82f840 100644 --- a/src/test/ui/custom_attribute.stderr +++ b/src/test/ui/custom_attribute.stderr @@ -1,5 +1,5 @@ error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/custom_attribute.rs:13:3 + --> $DIR/custom_attribute.rs:3:3 | LL | #[foo] //~ ERROR The attribute `foo` | ^^^ @@ -7,7 +7,7 @@ LL | #[foo] //~ ERROR The attribute `foo` = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/custom_attribute.rs:15:7 + --> $DIR/custom_attribute.rs:5:7 | LL | #[foo] //~ ERROR The attribute `foo` | ^^^ @@ -15,7 +15,7 @@ LL | #[foo] //~ ERROR The attribute `foo` = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/custom_attribute.rs:17:7 + --> $DIR/custom_attribute.rs:7:7 | LL | #[foo] //~ ERROR The attribute `foo` | ^^^ diff --git a/src/test/ui/custom_test_frameworks/auxiliary/dynamic_runner.rs b/src/test/ui/custom_test_frameworks/auxiliary/dynamic_runner.rs index c204e69eafc..a56e0b1f5f0 100644 --- a/src/test/ui/custom_test_frameworks/auxiliary/dynamic_runner.rs +++ b/src/test/ui/custom_test_frameworks/auxiliary/dynamic_runner.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::process::exit; pub trait Testable { diff --git a/src/test/ui/custom_test_frameworks/auxiliary/example_runner.rs b/src/test/ui/custom_test_frameworks/auxiliary/example_runner.rs index 7b6b5e02955..dd68c0685ac 100644 --- a/src/test/ui/custom_test_frameworks/auxiliary/example_runner.rs +++ b/src/test/ui/custom_test_frameworks/auxiliary/example_runner.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Testable { fn name(&self) -> String; fn run(&self) -> Option; // None will be success, Some is the error message diff --git a/src/test/ui/custom_test_frameworks/dynamic.rs b/src/test/ui/custom_test_frameworks/dynamic.rs index f82571b948a..6766ec542b1 100644 --- a/src/test/ui/custom_test_frameworks/dynamic.rs +++ b/src/test/ui/custom_test_frameworks/dynamic.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:dynamic_runner.rs // compile-flags:--test diff --git a/src/test/ui/custom_test_frameworks/full.rs b/src/test/ui/custom_test_frameworks/full.rs index 9fcf76ec33e..8c818826857 100644 --- a/src/test/ui/custom_test_frameworks/full.rs +++ b/src/test/ui/custom_test_frameworks/full.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:example_runner.rs // compile-flags:--test diff --git a/src/test/ui/custom_test_frameworks/mismatch.rs b/src/test/ui/custom_test_frameworks/mismatch.rs index 28753f1649a..e6848e2f3bd 100644 --- a/src/test/ui/custom_test_frameworks/mismatch.rs +++ b/src/test/ui/custom_test_frameworks/mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:example_runner.rs // compile-flags:--test #![feature(custom_test_frameworks)] @@ -17,3 +7,4 @@ extern crate example_runner; #[test] fn wrong_kind(){} +//~^ ERROR trait bound `test::TestDescAndFn: example_runner::Testable` is not satisfied diff --git a/src/test/ui/custom_test_frameworks/mismatch.stderr b/src/test/ui/custom_test_frameworks/mismatch.stderr index 8e2afaedfff..9e2688c6393 100644 --- a/src/test/ui/custom_test_frameworks/mismatch.stderr +++ b/src/test/ui/custom_test_frameworks/mismatch.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `test::TestDescAndFn: example_runner::Testable` is not satisfied - --> $DIR/mismatch.rs:19:1 + --> $DIR/mismatch.rs:9:1 | LL | fn wrong_kind(){} | ^^^^^^^^^^^^^^^^^ the trait `example_runner::Testable` is not implemented for `test::TestDescAndFn` diff --git a/src/test/ui/cycle-projection-based-on-where-clause.rs b/src/test/ui/cycle-projection-based-on-where-clause.rs index 56ad1771e00..336b67852cd 100644 --- a/src/test/ui/cycle-projection-based-on-where-clause.rs +++ b/src/test/ui/cycle-projection-based-on-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Example cycle where a bound on `T` uses a shorthand for `T`. This // creates a cycle because we have to know the bounds on `T` to figure // out what trait defines `Item`, but we can't know the bounds on `T` diff --git a/src/test/ui/cycle-projection-based-on-where-clause.stderr b/src/test/ui/cycle-projection-based-on-where-clause.stderr index c7147bcddc4..b11a8bda9b4 100644 --- a/src/test/ui/cycle-projection-based-on-where-clause.stderr +++ b/src/test/ui/cycle-projection-based-on-where-clause.stderr @@ -1,18 +1,18 @@ error[E0391]: cycle detected when computing the bounds for type parameter `T` - --> $DIR/cycle-projection-based-on-where-clause.rs:27:19 + --> $DIR/cycle-projection-based-on-where-clause.rs:17:19 | LL | T : Add | ^^^^^^^ | = note: ...which again requires computing the bounds for type parameter `T`, completing the cycle note: cycle used when processing `A` - --> $DIR/cycle-projection-based-on-where-clause.rs:27:19 + --> $DIR/cycle-projection-based-on-where-clause.rs:17:19 | LL | T : Add | ^^^^^^^ error[E0220]: associated type `Item` not found for `T` - --> $DIR/cycle-projection-based-on-where-clause.rs:27:19 + --> $DIR/cycle-projection-based-on-where-clause.rs:17:19 | LL | T : Add | ^^^^^^^ associated type `Item` not found diff --git a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs index b8bae215456..d658753eb24 100644 --- a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs +++ b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a cycle where a type parameter on a trait has a default that // again references the trait. diff --git a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr index 767a99a3265..aa45462a52e 100644 --- a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr +++ b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr @@ -1,10 +1,15 @@ error[E0391]: cycle detected when processing `Foo::X` - --> $DIR/cycle-trait-default-type-trait.rs:14:19 + --> $DIR/cycle-trait-default-type-trait.rs:4:19 | LL | trait Foo> { | ^^^ | = note: ...which again requires processing `Foo::X`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/cycle-trait-default-type-trait.rs:4:1 + | +LL | trait Foo> { + | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.rs b/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.rs index b802463fcb0..e6ab2c790d6 100644 --- a/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.rs +++ b/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a supertrait cycle where a trait extends itself. trait Chromosome: Chromosome { diff --git a/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.stderr b/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.stderr index 1e46ce6a30f..8aa3ac8abf5 100644 --- a/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.stderr +++ b/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.stderr @@ -1,10 +1,15 @@ error[E0391]: cycle detected when computing the supertraits of `Chromosome` - --> $DIR/cycle-trait-supertrait-direct.rs:13:19 + --> $DIR/cycle-trait-supertrait-direct.rs:3:19 | LL | trait Chromosome: Chromosome { | ^^^^^^^^^^ | = note: ...which again requires computing the supertraits of `Chromosome`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/cycle-trait-supertrait-direct.rs:3:1 + | +LL | trait Chromosome: Chromosome { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/cycle-trait/cycle-trait-supertrait-indirect.rs b/src/test/ui/cycle-trait/cycle-trait-supertrait-indirect.rs index f240a34817d..9a72b65da88 100644 --- a/src/test/ui/cycle-trait/cycle-trait-supertrait-indirect.rs +++ b/src/test/ui/cycle-trait/cycle-trait-supertrait-indirect.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a supertrait cycle where the first trait we find (`A`) is not // a direct participant in the cycle. diff --git a/src/test/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr b/src/test/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr index dd88a9c4d40..9740f43a4ba 100644 --- a/src/test/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr +++ b/src/test/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr @@ -1,17 +1,17 @@ error[E0391]: cycle detected when computing the supertraits of `B` - --> $DIR/cycle-trait-supertrait-indirect.rs:17:10 + --> $DIR/cycle-trait-supertrait-indirect.rs:7:10 | LL | trait B: C { | ^ | note: ...which requires computing the supertraits of `C`... - --> $DIR/cycle-trait-supertrait-indirect.rs:21:10 + --> $DIR/cycle-trait-supertrait-indirect.rs:11:10 | LL | trait C: B { } | ^ = note: ...which again requires computing the supertraits of `B`, completing the cycle note: cycle used when computing the supertraits of `A` - --> $DIR/cycle-trait-supertrait-indirect.rs:14:10 + --> $DIR/cycle-trait-supertrait-indirect.rs:4:10 | LL | trait A: B { | ^ diff --git a/src/test/ui/dead-code-closure-bang.rs b/src/test/ui/dead-code-closure-bang.rs index d808d797272..8e8636b1180 100644 --- a/src/test/ui/dead-code-closure-bang.rs +++ b/src/test/ui/dead-code-closure-bang.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test FIXME(#20574) #![deny(unreachable_code)] diff --git a/src/test/ui/dead-code-ret.rs b/src/test/ui/dead-code-ret.rs index 250d22db374..fad35794fae 100644 --- a/src/test/ui/dead-code-ret.rs +++ b/src/test/ui/dead-code-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: unreachable statement #![deny(unreachable_code)] diff --git a/src/test/ui/dead-code-ret.stderr b/src/test/ui/dead-code-ret.stderr index 9f940166966..092a176f443 100644 --- a/src/test/ui/dead-code-ret.stderr +++ b/src/test/ui/dead-code-ret.stderr @@ -1,11 +1,11 @@ error: unreachable statement - --> $DIR/dead-code-ret.rs:17:5 + --> $DIR/dead-code-ret.rs:7:5 | LL | println!("Paul is dead"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/dead-code-ret.rs:13:9 + --> $DIR/dead-code-ret.rs:3:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dead-code-tuple-struct-field.rs b/src/test/ui/dead-code-tuple-struct-field.rs new file mode 100644 index 00000000000..496ce4fb378 --- /dev/null +++ b/src/test/ui/dead-code-tuple-struct-field.rs @@ -0,0 +1,12 @@ +// compile-pass + +#![deny(dead_code)] + +const LEN: usize = 4; + +#[derive(Debug)] +struct Wrapper([u8; LEN]); + +fn main() { + println!("{:?}", Wrapper([0, 1, 2, 3])); +} diff --git a/src/test/ui/defaulted-never-note.rs b/src/test/ui/defaulted-never-note.rs index b53ef0f5ba8..acda4b42f15 100644 --- a/src/test/ui/defaulted-never-note.rs +++ b/src/test/ui/defaulted-never-note.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We need to opt into the `!` feature in order to trigger the // requirement that this is testing. #![feature(never_type)] diff --git a/src/test/ui/defaulted-never-note.stderr b/src/test/ui/defaulted-never-note.stderr index 32922354fe6..45174c32294 100644 --- a/src/test/ui/defaulted-never-note.stderr +++ b/src/test/ui/defaulted-never-note.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `!: ImplementedForUnitButNotNever` is not satisfied - --> $DIR/defaulted-never-note.rs:36:5 + --> $DIR/defaulted-never-note.rs:26:5 | LL | foo(_x); | ^^^ the trait `ImplementedForUnitButNotNever` is not implemented for `!` | = note: the trait is implemented for `()`. Possibly this error has been caused by changes to Rust's type-inference algorithm (see: https://github.com/rust-lang/rust/issues/48950 for more info). Consider whether you meant to use the type `()` here instead. note: required by `foo` - --> $DIR/defaulted-never-note.rs:31:1 + --> $DIR/defaulted-never-note.rs:21:1 | LL | fn foo(_t: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.rs b/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.rs index c20cfbc7e23..f3df57e6ff9 100644 --- a/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.rs +++ b/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that when a trait impl changes, fns whose body uses that trait // must also be recompiled. diff --git a/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr b/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr index e00b3ccf281..a25a1786e81 100644 --- a/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr +++ b/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr @@ -1,5 +1,5 @@ error: OK - --> $DIR/dep-graph-assoc-type-codegen.rs:38:5 + --> $DIR/dep-graph-assoc-type-codegen.rs:28:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dep-graph/dep-graph-caller-callee.rs b/src/test/ui/dep-graph/dep-graph-caller-callee.rs index 222c1972005..f8276ea3ad6 100644 --- a/src/test/ui/dep-graph/dep-graph-caller-callee.rs +++ b/src/test/ui/dep-graph/dep-graph-caller-callee.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that immediate callers have to change when callee changes, but // not callers' callers. diff --git a/src/test/ui/dep-graph/dep-graph-caller-callee.stderr b/src/test/ui/dep-graph/dep-graph-caller-callee.stderr index 8943b051c12..d7bf6382257 100644 --- a/src/test/ui/dep-graph/dep-graph-caller-callee.stderr +++ b/src/test/ui/dep-graph/dep-graph-caller-callee.stderr @@ -1,11 +1,11 @@ error: OK - --> $DIR/dep-graph-caller-callee.rs:30:5 + --> $DIR/dep-graph-caller-callee.rs:20:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `x::x` to `TypeckTables` - --> $DIR/dep-graph-caller-callee.rs:41:5 + --> $DIR/dep-graph-caller-callee.rs:31:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dep-graph/dep-graph-struct-signature.rs b/src/test/ui/dep-graph/dep-graph-struct-signature.rs index 6343dc201c5..3d660aa8f4b 100644 --- a/src/test/ui/dep-graph/dep-graph-struct-signature.rs +++ b/src/test/ui/dep-graph/dep-graph-struct-signature.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test cases where a changing struct appears in the signature of fns // and methods. diff --git a/src/test/ui/dep-graph/dep-graph-struct-signature.stderr b/src/test/ui/dep-graph/dep-graph-struct-signature.stderr index 0d75bf5a9ad..d7d56f219b4 100644 --- a/src/test/ui/dep-graph/dep-graph-struct-signature.stderr +++ b/src/test/ui/dep-graph/dep-graph-struct-signature.stderr @@ -1,131 +1,131 @@ error: no path from `WillChange` to `TypeOfItem` - --> $DIR/dep-graph-struct-signature.rs:37:5 + --> $DIR/dep-graph-struct-signature.rs:27:5 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `AssociatedItems` - --> $DIR/dep-graph-struct-signature.rs:38:5 + --> $DIR/dep-graph-struct-signature.rs:28:5 | LL | #[rustc_then_this_would_need(AssociatedItems)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `TraitDefOfItem` - --> $DIR/dep-graph-struct-signature.rs:39:5 + --> $DIR/dep-graph-struct-signature.rs:29:5 | LL | #[rustc_then_this_would_need(TraitDefOfItem)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:45:5 + --> $DIR/dep-graph-struct-signature.rs:35:5 | LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:46:5 + --> $DIR/dep-graph-struct-signature.rs:36:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:49:5 + --> $DIR/dep-graph-struct-signature.rs:39:5 | LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:50:5 + --> $DIR/dep-graph-struct-signature.rs:40:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:55:5 + --> $DIR/dep-graph-struct-signature.rs:45:5 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:62:5 + --> $DIR/dep-graph-struct-signature.rs:52:5 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:70:9 + --> $DIR/dep-graph-struct-signature.rs:60:9 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:72:9 + --> $DIR/dep-graph-struct-signature.rs:62:9 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `TypeOfItem` - --> $DIR/dep-graph-struct-signature.rs:77:5 + --> $DIR/dep-graph-struct-signature.rs:67:5 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `TypeOfItem` - --> $DIR/dep-graph-struct-signature.rs:84:5 + --> $DIR/dep-graph-struct-signature.rs:74:5 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `FnSignature` - --> $DIR/dep-graph-struct-signature.rs:90:5 + --> $DIR/dep-graph-struct-signature.rs:80:5 | LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `FnSignature` - --> $DIR/dep-graph-struct-signature.rs:93:5 + --> $DIR/dep-graph-struct-signature.rs:83:5 | LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR no path from `WillChange` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `TypeckTables` - --> $DIR/dep-graph-struct-signature.rs:94:5 + --> $DIR/dep-graph-struct-signature.rs:84:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path from `WillChange` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:41:9 + --> $DIR/dep-graph-struct-signature.rs:31:9 | LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `FnSignature` - --> $DIR/dep-graph-struct-signature.rs:86:9 + --> $DIR/dep-graph-struct-signature.rs:76:9 | LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:57:9 + --> $DIR/dep-graph-struct-signature.rs:47:9 | LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:58:9 + --> $DIR/dep-graph-struct-signature.rs:48:9 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:64:9 + --> $DIR/dep-graph-struct-signature.rs:54:9 | LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-struct-signature.rs:65:9 + --> $DIR/dep-graph-struct-signature.rs:55:9 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs index 7dd02f57b36..16e5a705d25 100644 --- a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs +++ b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that adding an impl to a trait `Foo` DOES affect functions // that only use `Bar` if they have methods in common. diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr index 877a056019f..2fa1e1edc87 100644 --- a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr +++ b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr @@ -1,11 +1,11 @@ error: OK - --> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:42:5 + --> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:32:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `x::` to `TypeckTables` - --> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:51:5 + --> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:41:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.rs b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.rs index 6b3525333bc..064302c9c80 100644 --- a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.rs +++ b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that adding an impl to a trait `Foo` does not affect functions // that only use `Bar`, so long as they do not have methods in common. diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr index f939fac3146..8670e7deb4c 100644 --- a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr +++ b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr @@ -1,11 +1,11 @@ error: no path from `x::` to `TypeckTables` - --> $DIR/dep-graph-trait-impl-two-traits.rs:41:5 + --> $DIR/dep-graph-trait-impl-two-traits.rs:31:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `x::` to `TypeckTables` - --> $DIR/dep-graph-trait-impl-two-traits.rs:50:5 + --> $DIR/dep-graph-trait-impl-two-traits.rs:40:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl.rs b/src/test/ui/dep-graph/dep-graph-trait-impl.rs index 85b3e69065d..7d088082c7a 100644 --- a/src/test/ui/dep-graph/dep-graph-trait-impl.rs +++ b/src/test/ui/dep-graph/dep-graph-trait-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that when a trait impl changes, fns whose body uses that trait // must also be recompiled. diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl.stderr b/src/test/ui/dep-graph/dep-graph-trait-impl.stderr index c569e8584e7..fe97846d6cc 100644 --- a/src/test/ui/dep-graph/dep-graph-trait-impl.stderr +++ b/src/test/ui/dep-graph/dep-graph-trait-impl.stderr @@ -1,29 +1,29 @@ error: OK - --> $DIR/dep-graph-trait-impl.rs:37:5 + --> $DIR/dep-graph-trait-impl.rs:27:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-trait-impl.rs:42:5 + --> $DIR/dep-graph-trait-impl.rs:32:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-trait-impl.rs:47:5 + --> $DIR/dep-graph-trait-impl.rs:37:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-trait-impl.rs:52:5 + --> $DIR/dep-graph-trait-impl.rs:42:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `x::` to `TypeckTables` - --> $DIR/dep-graph-trait-impl.rs:65:5 + --> $DIR/dep-graph-trait-impl.rs:55:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dep-graph/dep-graph-type-alias.rs b/src/test/ui/dep-graph/dep-graph-type-alias.rs index dca1fa4d98f..0f703aeb0f7 100644 --- a/src/test/ui/dep-graph/dep-graph-type-alias.rs +++ b/src/test/ui/dep-graph/dep-graph-type-alias.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // Test that changing what a `type` points to does not go unnoticed. // compile-flags: -Z query-dep-graph diff --git a/src/test/ui/dep-graph/dep-graph-type-alias.stderr b/src/test/ui/dep-graph/dep-graph-type-alias.stderr index b018c250667..72def33cbcf 100644 --- a/src/test/ui/dep-graph/dep-graph-type-alias.stderr +++ b/src/test/ui/dep-graph/dep-graph-type-alias.stderr @@ -1,71 +1,71 @@ error: no path from `TypeAlias` to `TypeOfItem` - --> $DIR/dep-graph-type-alias.rs:28:1 + --> $DIR/dep-graph-type-alias.rs:17:1 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-type-alias.rs:30:5 + --> $DIR/dep-graph-type-alias.rs:19:5 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `TypeAlias` to `TypeOfItem` - --> $DIR/dep-graph-type-alias.rs:35:1 + --> $DIR/dep-graph-type-alias.rs:24:1 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-type-alias.rs:38:9 + --> $DIR/dep-graph-type-alias.rs:27:9 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `TypeAlias` to `TypeOfItem` - --> $DIR/dep-graph-type-alias.rs:44:1 + --> $DIR/dep-graph-type-alias.rs:33:1 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `TypeAlias` to `TypeOfItem` - --> $DIR/dep-graph-type-alias.rs:52:1 + --> $DIR/dep-graph-type-alias.rs:41:1 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-type-alias.rs:59:1 + --> $DIR/dep-graph-type-alias.rs:48:1 | LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-type-alias.rs:62:1 + --> $DIR/dep-graph-type-alias.rs:51:1 | LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-type-alias.rs:63:1 + --> $DIR/dep-graph-type-alias.rs:52:1 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-type-alias.rs:46:5 + --> $DIR/dep-graph-type-alias.rs:35:5 | LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-type-alias.rs:54:5 + --> $DIR/dep-graph-type-alias.rs:43:5 | LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK - --> $DIR/dep-graph-type-alias.rs:55:5 + --> $DIR/dep-graph-type-alias.rs:44:5 | LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dep-graph/dep-graph-variance-alias.rs b/src/test/ui/dep-graph/dep-graph-variance-alias.rs index 18cfd001804..0a70bfd08bf 100644 --- a/src/test/ui/dep-graph/dep-graph-variance-alias.rs +++ b/src/test/ui/dep-graph/dep-graph-variance-alias.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that changing what a `type` points to does not go unnoticed // by the variance analysis. diff --git a/src/test/ui/dep-graph/dep-graph-variance-alias.stderr b/src/test/ui/dep-graph/dep-graph-variance-alias.stderr index a3b12013906..f7c7f01020d 100644 --- a/src/test/ui/dep-graph/dep-graph-variance-alias.stderr +++ b/src/test/ui/dep-graph/dep-graph-variance-alias.stderr @@ -1,5 +1,5 @@ error: OK - --> $DIR/dep-graph-variance-alias.rs:29:1 + --> $DIR/dep-graph-variance-alias.rs:19:1 | LL | #[rustc_then_this_would_need(ItemVariances)] //~ ERROR OK | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/deprecation/atomic_initializers.fixed b/src/test/ui/deprecation/atomic_initializers.fixed new file mode 100644 index 00000000000..dee1d979cff --- /dev/null +++ b/src/test/ui/deprecation/atomic_initializers.fixed @@ -0,0 +1,11 @@ +// run-rustfix +// compile-pass + +#[allow(deprecated, unused_imports)] +use std::sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT}; + +#[allow(dead_code)] +static FOO: AtomicIsize = AtomicIsize::new(0); +//~^ WARN use of deprecated item + +fn main() {} diff --git a/src/test/ui/deprecation/atomic_initializers.rs b/src/test/ui/deprecation/atomic_initializers.rs new file mode 100644 index 00000000000..b9e25e817bc --- /dev/null +++ b/src/test/ui/deprecation/atomic_initializers.rs @@ -0,0 +1,11 @@ +// run-rustfix +// compile-pass + +#[allow(deprecated, unused_imports)] +use std::sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT}; + +#[allow(dead_code)] +static FOO: AtomicIsize = ATOMIC_ISIZE_INIT; +//~^ WARN use of deprecated item + +fn main() {} diff --git a/src/test/ui/deprecation/atomic_initializers.stderr b/src/test/ui/deprecation/atomic_initializers.stderr new file mode 100644 index 00000000000..77c370814f7 --- /dev/null +++ b/src/test/ui/deprecation/atomic_initializers.stderr @@ -0,0 +1,12 @@ +warning: use of deprecated item 'std::sync::atomic::ATOMIC_ISIZE_INIT': the `new` function is now preferred + --> $DIR/atomic_initializers.rs:8:27 + | +LL | static FOO: AtomicIsize = ATOMIC_ISIZE_INIT; + | ^^^^^^^^^^^^^^^^^ + | + = note: #[warn(deprecated)] on by default +help: use of deprecated item 'std::sync::atomic::ATOMIC_ISIZE_INIT': the `new` function is now preferred + | +LL | static FOO: AtomicIsize = AtomicIsize::new(0); + | ^^^^^^^^^^^^^^^^^^^ + diff --git a/src/test/ui/deprecation/auxiliary/deprecation-lint.rs b/src/test/ui/deprecation/auxiliary/deprecation-lint.rs index 17510289875..948bf1cb71b 100644 --- a/src/test/ui/deprecation/auxiliary/deprecation-lint.rs +++ b/src/test/ui/deprecation/auxiliary/deprecation-lint.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(deprecated)] #[deprecated(since = "1.0.0", note = "text")] diff --git a/src/test/ui/deprecation/deprecated-macro_escape-inner.rs b/src/test/ui/deprecation/deprecated-macro_escape-inner.rs index dce80698dea..957e839013e 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape-inner.rs +++ b/src/test/ui/deprecation/deprecated-macro_escape-inner.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass mod foo { diff --git a/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr index 56c08383797..94229386e5f 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr +++ b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr @@ -1,5 +1,5 @@ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/deprecated-macro_escape-inner.rs:14:5 + --> $DIR/deprecated-macro_escape-inner.rs:4:5 | LL | #![macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/deprecation/deprecated-macro_escape.rs b/src/test/ui/deprecation/deprecated-macro_escape.rs index a234572343c..1b82a99f42e 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape.rs +++ b/src/test/ui/deprecation/deprecated-macro_escape.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use diff --git a/src/test/ui/deprecation/deprecated-macro_escape.stderr b/src/test/ui/deprecation/deprecated-macro_escape.stderr index 09ff3285740..f0edd838874 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape.stderr +++ b/src/test/ui/deprecation/deprecated-macro_escape.stderr @@ -1,5 +1,5 @@ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/deprecated-macro_escape.rs:13:1 + --> $DIR/deprecated-macro_escape.rs:3:1 | LL | #[macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/deprecation/deprecated_no_stack_check.rs b/src/test/ui/deprecation/deprecated_no_stack_check.rs index 38aaefd52b3..8e1f5bbf045 100644 --- a/src/test/ui/deprecation/deprecated_no_stack_check.rs +++ b/src/test/ui/deprecation/deprecated_no_stack_check.rs @@ -1,16 +1,6 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(warnings)] #![feature(no_stack_check)] -//~^ ERROR: 12:12: 12:26: feature has been removed [E0557] +//~^ ERROR: feature has been removed [E0557] fn main() { } diff --git a/src/test/ui/deprecation/deprecated_no_stack_check.stderr b/src/test/ui/deprecation/deprecated_no_stack_check.stderr index 2f847a253e4..c936a550b3a 100644 --- a/src/test/ui/deprecation/deprecated_no_stack_check.stderr +++ b/src/test/ui/deprecation/deprecated_no_stack_check.stderr @@ -1,5 +1,5 @@ error[E0557]: feature has been removed - --> $DIR/deprecated_no_stack_check.rs:12:12 + --> $DIR/deprecated_no_stack_check.rs:2:12 | LL | #![feature(no_stack_check)] | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/deprecation/deprecation-in-future.rs b/src/test/ui/deprecation/deprecation-in-future.rs new file mode 100644 index 00000000000..c6c60177e9d --- /dev/null +++ b/src/test/ui/deprecation/deprecation-in-future.rs @@ -0,0 +1,12 @@ +// ignore-tidy-linelength + +#![deny(deprecated_in_future)] + +#[deprecated(since = "99.99.99", note = "text")] +pub fn deprecated_future() {} + +fn test() { + deprecated_future(); //~ ERROR use of item 'deprecated_future' that will be deprecated in future version 99.99.99: text +} + +fn main() {} diff --git a/src/test/ui/deprecation/deprecation-in-future.stderr b/src/test/ui/deprecation/deprecation-in-future.stderr new file mode 100644 index 00000000000..38392cf9608 --- /dev/null +++ b/src/test/ui/deprecation/deprecation-in-future.stderr @@ -0,0 +1,14 @@ +error: use of item 'deprecated_future' that will be deprecated in future version 99.99.99: text + --> $DIR/deprecation-in-future.rs:9:5 + | +LL | deprecated_future(); //~ ERROR use of item 'deprecated_future' that will be deprecated in future version 99.99.99: text + | ^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/deprecation-in-future.rs:3:9 + | +LL | #![deny(deprecated_in_future)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/deprecation/deprecation-in-staged-api.rs b/src/test/ui/deprecation/deprecation-in-staged-api.rs index 5c6facbf014..bcc17c789f5 100644 --- a/src/test/ui/deprecation/deprecation-in-staged-api.rs +++ b/src/test/ui/deprecation/deprecation-in-staged-api.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // #[deprecated] can't be used in staged api #![feature(staged_api)] diff --git a/src/test/ui/deprecation/deprecation-in-staged-api.stderr b/src/test/ui/deprecation/deprecation-in-staged-api.stderr index 9ad56585015..3e64d756e7e 100644 --- a/src/test/ui/deprecation/deprecation-in-staged-api.stderr +++ b/src/test/ui/deprecation/deprecation-in-staged-api.stderr @@ -1,5 +1,5 @@ error: `#[deprecated]` cannot be used in staged api, use `#[rustc_deprecated]` instead - --> $DIR/deprecation-in-staged-api.rs:18:1 + --> $DIR/deprecation-in-staged-api.rs:8:1 | LL | fn main() { } //~ERROR `#[deprecated]` cannot be used in staged api | ^^^^^^^^^^^^^ diff --git a/src/test/ui/deprecation/deprecation-lint-2.rs b/src/test/ui/deprecation/deprecation-lint-2.rs index 2817e06652a..2aa0d0c64d2 100644 --- a/src/test/ui/deprecation/deprecation-lint-2.rs +++ b/src/test/ui/deprecation/deprecation-lint-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:deprecation-lint.rs // error-pattern: use of deprecated item diff --git a/src/test/ui/deprecation/deprecation-lint-2.stderr b/src/test/ui/deprecation/deprecation-lint-2.stderr index fedc6b22f32..f90ca798601 100644 --- a/src/test/ui/deprecation/deprecation-lint-2.stderr +++ b/src/test/ui/deprecation/deprecation-lint-2.stderr @@ -1,11 +1,11 @@ error: use of deprecated item 'deprecation_lint::deprecated': text - --> $DIR/deprecation-lint-2.rs:22:5 + --> $DIR/deprecation-lint-2.rs:12:5 | LL | macro_test!(); | ^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/deprecation-lint-2.rs:14:9 + --> $DIR/deprecation-lint-2.rs:4:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ diff --git a/src/test/ui/deprecation/deprecation-lint-3.rs b/src/test/ui/deprecation/deprecation-lint-3.rs index 7faaa181d39..ae2dd7aac81 100644 --- a/src/test/ui/deprecation/deprecation-lint-3.rs +++ b/src/test/ui/deprecation/deprecation-lint-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:deprecation-lint.rs // error-pattern: use of deprecated item diff --git a/src/test/ui/deprecation/deprecation-lint-3.stderr b/src/test/ui/deprecation/deprecation-lint-3.stderr index 9dfc44ebc61..fb90a63b0fb 100644 --- a/src/test/ui/deprecation/deprecation-lint-3.stderr +++ b/src/test/ui/deprecation/deprecation-lint-3.stderr @@ -1,11 +1,11 @@ error: use of deprecated item 'deprecation_lint::deprecated_text': text - --> $DIR/deprecation-lint-3.rs:23:5 + --> $DIR/deprecation-lint-3.rs:13:5 | LL | macro_test_arg_nested!(deprecated_text); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/deprecation-lint-3.rs:14:9 + --> $DIR/deprecation-lint-3.rs:4:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ diff --git a/src/test/ui/deprecation/deprecation-lint-nested.rs b/src/test/ui/deprecation/deprecation-lint-nested.rs index eedbba59c6f..ee6f0a22363 100644 --- a/src/test/ui/deprecation/deprecation-lint-nested.rs +++ b/src/test/ui/deprecation/deprecation-lint-nested.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(deprecated)] #![allow(warnings)] diff --git a/src/test/ui/deprecation/deprecation-lint-nested.stderr b/src/test/ui/deprecation/deprecation-lint-nested.stderr index 4e2b462fd1b..b30da349335 100644 --- a/src/test/ui/deprecation/deprecation-lint-nested.stderr +++ b/src/test/ui/deprecation/deprecation-lint-nested.stderr @@ -1,41 +1,41 @@ error: use of deprecated item 'loud::DeprecatedType' - --> $DIR/deprecation-lint-nested.rs:65:16 + --> $DIR/deprecation-lint-nested.rs:55:16 | LL | struct Foo(DeprecatedType); //~ ERROR use of deprecated item | ^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/deprecation-lint-nested.rs:11:9 + --> $DIR/deprecation-lint-nested.rs:1:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ error: use of deprecated item 'loud::DeprecatedTrait' - --> $DIR/deprecation-lint-nested.rs:67:10 + --> $DIR/deprecation-lint-nested.rs:57:10 | LL | impl DeprecatedTrait for Foo {} //~ ERROR use of deprecated item | ^^^^^^^^^^^^^^^ error: use of deprecated item 'loud::DEPRECATED_STATIC' - --> $DIR/deprecation-lint-nested.rs:76:9 + --> $DIR/deprecation-lint-nested.rs:66:9 | LL | DEPRECATED_STATIC + //~ ERROR use of deprecated item | ^^^^^^^^^^^^^^^^^ error: use of deprecated item 'loud::DEPRECATED_CONST' - --> $DIR/deprecation-lint-nested.rs:77:9 + --> $DIR/deprecation-lint-nested.rs:67:9 | LL | DEPRECATED_CONST //~ ERROR use of deprecated item | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'loud::DeprecatedTrait' - --> $DIR/deprecation-lint-nested.rs:70:19 + --> $DIR/deprecation-lint-nested.rs:60:19 | LL | fn bar() { //~ ERROR use of deprecated item | ^^^^^^^^^^^^^^^ error: use of deprecated item 'loud::deprecated_fn' - --> $DIR/deprecation-lint-nested.rs:71:13 + --> $DIR/deprecation-lint-nested.rs:61:13 | LL | deprecated_fn(); //~ ERROR use of deprecated item | ^^^^^^^^^^^^^ diff --git a/src/test/ui/deprecation/deprecation-lint.rs b/src/test/ui/deprecation/deprecation-lint.rs index 93eb6b6b115..6b3e9a8ad81 100644 --- a/src/test/ui/deprecation/deprecation-lint.rs +++ b/src/test/ui/deprecation/deprecation-lint.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:deprecation-lint.rs // ignore-tidy-linelength diff --git a/src/test/ui/deprecation/deprecation-lint.stderr b/src/test/ui/deprecation/deprecation-lint.stderr index addca669917..46875d0bf13 100644 --- a/src/test/ui/deprecation/deprecation-lint.stderr +++ b/src/test/ui/deprecation/deprecation-lint.stderr @@ -1,725 +1,725 @@ error: use of deprecated item 'deprecation_lint::deprecated': text - --> $DIR/deprecation-lint.rs:27:9 + --> $DIR/deprecation-lint.rs:17:9 | LL | deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::deprecated' | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/deprecation-lint.rs:14:9 + --> $DIR/deprecation-lint.rs:4:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:32:9 + --> $DIR/deprecation-lint.rs:22:9 | LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:34:9 + --> $DIR/deprecation-lint.rs:24:9 | LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::deprecated_text': text - --> $DIR/deprecation-lint.rs:36:9 + --> $DIR/deprecation-lint.rs:26:9 | LL | deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_text': text | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:41:9 + --> $DIR/deprecation-lint.rs:31:9 | LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:43:9 + --> $DIR/deprecation-lint.rs:33:9 | LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedStruct': text - --> $DIR/deprecation-lint.rs:45:17 + --> $DIR/deprecation-lint.rs:35:17 | LL | let _ = DeprecatedStruct { //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedStruct': text | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedUnitStruct': text - --> $DIR/deprecation-lint.rs:49:17 + --> $DIR/deprecation-lint.rs:39:17 | LL | let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedUnitStruct': text | ^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Enum::DeprecatedVariant': text - --> $DIR/deprecation-lint.rs:51:17 + --> $DIR/deprecation-lint.rs:41:17 | LL | let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'deprecation_lint::Enum::DeprecatedVariant': text | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedTupleStruct': text - --> $DIR/deprecation-lint.rs:53:17 + --> $DIR/deprecation-lint.rs:43:17 | LL | let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedTupleStruct': text | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::nested::DeprecatedStruct': text - --> $DIR/deprecation-lint.rs:55:17 + --> $DIR/deprecation-lint.rs:45:17 | LL | let _ = nested::DeprecatedStruct { //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedStruct': text | ^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::nested::DeprecatedUnitStruct': text - --> $DIR/deprecation-lint.rs:59:17 + --> $DIR/deprecation-lint.rs:49:17 | LL | let _ = nested::DeprecatedUnitStruct; //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedUnitStruct': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::nested::Enum::DeprecatedVariant': text - --> $DIR/deprecation-lint.rs:61:17 + --> $DIR/deprecation-lint.rs:51:17 | LL | let _ = nested::Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'deprecation_lint::nested::Enum::DeprecatedVariant': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::nested::DeprecatedTupleStruct': text - --> $DIR/deprecation-lint.rs:63:17 + --> $DIR/deprecation-lint.rs:53:17 | LL | let _ = nested::DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedTupleStruct': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::deprecated_text': text - --> $DIR/deprecation-lint.rs:70:25 + --> $DIR/deprecation-lint.rs:60:25 | LL | macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_text': text | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::deprecated_text': text - --> $DIR/deprecation-lint.rs:71:41 + --> $DIR/deprecation-lint.rs:61:41 | LL | macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_text': text | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:76:9 + --> $DIR/deprecation-lint.rs:66:9 | LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:78:9 + --> $DIR/deprecation-lint.rs:68:9 | LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:80:9 + --> $DIR/deprecation-lint.rs:70:9 | LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:82:9 + --> $DIR/deprecation-lint.rs:72:9 | LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedTrait': text - --> $DIR/deprecation-lint.rs:92:10 + --> $DIR/deprecation-lint.rs:82:10 | LL | impl DeprecatedTrait for S {} //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedTrait': text | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedTrait': text - --> $DIR/deprecation-lint.rs:93:24 + --> $DIR/deprecation-lint.rs:83:24 | LL | trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedTrait': text | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Deprecated': text - --> $DIR/deprecation-lint.rs:124:17 + --> $DIR/deprecation-lint.rs:114:17 | LL | let x = Deprecated { | ^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Deprecated': text - --> $DIR/deprecation-lint.rs:133:13 + --> $DIR/deprecation-lint.rs:123:13 | LL | let Deprecated { | ^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Deprecated': text - --> $DIR/deprecation-lint.rs:139:13 + --> $DIR/deprecation-lint.rs:129:13 | LL | let Deprecated | ^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Deprecated2': text - --> $DIR/deprecation-lint.rs:143:17 + --> $DIR/deprecation-lint.rs:133:17 | LL | let x = Deprecated2(1, 2, 3); | ^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Deprecated2': text - --> $DIR/deprecation-lint.rs:153:13 + --> $DIR/deprecation-lint.rs:143:13 | LL | let Deprecated2 | ^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Deprecated2': text - --> $DIR/deprecation-lint.rs:162:13 + --> $DIR/deprecation-lint.rs:152:13 | LL | let Deprecated2 | ^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::deprecated_mod::deprecated': text - --> $DIR/deprecation-lint.rs:173:9 + --> $DIR/deprecation-lint.rs:163:9 | LL | deprecated_mod::deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_mod::deprecated': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::deprecated': text - --> $DIR/deprecation-lint.rs:256:9 + --> $DIR/deprecation-lint.rs:246:9 | LL | deprecated(); //~ ERROR use of deprecated item 'this_crate::deprecated' | ^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:261:9 + --> $DIR/deprecation-lint.rs:251:9 | LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:263:9 + --> $DIR/deprecation-lint.rs:253:9 | LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::deprecated_text': text - --> $DIR/deprecation-lint.rs:265:9 + --> $DIR/deprecation-lint.rs:255:9 | LL | deprecated_text(); //~ ERROR use of deprecated item 'this_crate::deprecated_text': text | ^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:270:9 + --> $DIR/deprecation-lint.rs:260:9 | LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:272:9 + --> $DIR/deprecation-lint.rs:262:9 | LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedStruct': text - --> $DIR/deprecation-lint.rs:277:17 + --> $DIR/deprecation-lint.rs:267:17 | LL | let _ = DeprecatedStruct { | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedUnitStruct': text - --> $DIR/deprecation-lint.rs:282:17 + --> $DIR/deprecation-lint.rs:272:17 | LL | let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item 'this_crate::DeprecatedUnitStruct': text | ^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Enum::DeprecatedVariant': text - --> $DIR/deprecation-lint.rs:284:17 + --> $DIR/deprecation-lint.rs:274:17 | LL | let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'this_crate::Enum::DeprecatedVariant': text | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedTupleStruct': text - --> $DIR/deprecation-lint.rs:286:17 + --> $DIR/deprecation-lint.rs:276:17 | LL | let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'this_crate::DeprecatedTupleStruct': text | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::nested::DeprecatedStruct': text - --> $DIR/deprecation-lint.rs:288:17 + --> $DIR/deprecation-lint.rs:278:17 | LL | let _ = nested::DeprecatedStruct { | ^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::nested::DeprecatedUnitStruct': text - --> $DIR/deprecation-lint.rs:293:17 + --> $DIR/deprecation-lint.rs:283:17 | LL | let _ = nested::DeprecatedUnitStruct; //~ ERROR use of deprecated item 'this_crate::nested::DeprecatedUnitStruct': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::nested::Enum::DeprecatedVariant': text - --> $DIR/deprecation-lint.rs:295:17 + --> $DIR/deprecation-lint.rs:285:17 | LL | let _ = nested::Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'this_crate::nested::Enum::DeprecatedVariant': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::nested::DeprecatedTupleStruct': text - --> $DIR/deprecation-lint.rs:297:17 + --> $DIR/deprecation-lint.rs:287:17 | LL | let _ = nested::DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'this_crate::nested::DeprecatedTupleStruct': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:302:9 + --> $DIR/deprecation-lint.rs:292:9 | LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:304:9 + --> $DIR/deprecation-lint.rs:294:9 | LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:306:9 + --> $DIR/deprecation-lint.rs:296:9 | LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:308:9 + --> $DIR/deprecation-lint.rs:298:9 | LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::test_fn_closure_body::{{closure}}::bar' - --> $DIR/deprecation-lint.rs:326:13 + --> $DIR/deprecation-lint.rs:316:13 | LL | bar(); //~ ERROR use of deprecated item 'this_crate::test_fn_closure_body::{{closure}}::bar' | ^^^ error: use of deprecated item 'this_crate::DeprecatedTrait': text - --> $DIR/deprecation-lint.rs:345:10 + --> $DIR/deprecation-lint.rs:335:10 | LL | impl DeprecatedTrait for S { } //~ ERROR use of deprecated item 'this_crate::DeprecatedTrait': text | ^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedTrait': text - --> $DIR/deprecation-lint.rs:347:24 + --> $DIR/deprecation-lint.rs:337:24 | LL | trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item 'this_crate::DeprecatedTrait': text | ^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate2::Deprecated': text - --> $DIR/deprecation-lint.rs:399:17 + --> $DIR/deprecation-lint.rs:389:17 | LL | let x = Deprecated { | ^^^^^^^^^^ error: use of deprecated item 'this_crate2::Deprecated': text - --> $DIR/deprecation-lint.rs:408:13 + --> $DIR/deprecation-lint.rs:398:13 | LL | let Deprecated { | ^^^^^^^^^^ error: use of deprecated item 'this_crate2::Deprecated': text - --> $DIR/deprecation-lint.rs:414:13 + --> $DIR/deprecation-lint.rs:404:13 | LL | let Deprecated | ^^^^^^^^^^ error: use of deprecated item 'this_crate2::Deprecated2': text - --> $DIR/deprecation-lint.rs:419:17 + --> $DIR/deprecation-lint.rs:409:17 | LL | let x = Deprecated2(1, 2, 3); | ^^^^^^^^^^^ error: use of deprecated item 'this_crate2::Deprecated2': text - --> $DIR/deprecation-lint.rs:429:13 + --> $DIR/deprecation-lint.rs:419:13 | LL | let Deprecated2 | ^^^^^^^^^^^ error: use of deprecated item 'this_crate2::Deprecated2': text - --> $DIR/deprecation-lint.rs:438:13 + --> $DIR/deprecation-lint.rs:428:13 | LL | let Deprecated2 | ^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated': text - --> $DIR/deprecation-lint.rs:28:13 + --> $DIR/deprecation-lint.rs:18:13 | LL | foo.method_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated' | ^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated': text - --> $DIR/deprecation-lint.rs:29:9 + --> $DIR/deprecation-lint.rs:19:9 | LL | Foo::method_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated': text - --> $DIR/deprecation-lint.rs:30:9 + --> $DIR/deprecation-lint.rs:20:9 | LL | ::method_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:31:13 + --> $DIR/deprecation-lint.rs:21:13 | LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:33:9 + --> $DIR/deprecation-lint.rs:23:9 | LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text - --> $DIR/deprecation-lint.rs:37:13 + --> $DIR/deprecation-lint.rs:27:13 | LL | foo.method_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text - --> $DIR/deprecation-lint.rs:38:9 + --> $DIR/deprecation-lint.rs:28:9 | LL | Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text - --> $DIR/deprecation-lint.rs:39:9 + --> $DIR/deprecation-lint.rs:29:9 | LL | ::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:40:13 + --> $DIR/deprecation-lint.rs:30:13 | LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:42:9 + --> $DIR/deprecation-lint.rs:32:9 | LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedStruct::i': text - --> $DIR/deprecation-lint.rs:46:13 + --> $DIR/deprecation-lint.rs:36:13 | LL | i: 0 //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedStruct::i': text | ^^^^ error: use of deprecated item 'deprecation_lint::nested::DeprecatedStruct::i': text - --> $DIR/deprecation-lint.rs:56:13 + --> $DIR/deprecation-lint.rs:46:13 | LL | i: 0 //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedStruct::i': text | ^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:75:13 + --> $DIR/deprecation-lint.rs:65:13 | LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:77:9 + --> $DIR/deprecation-lint.rs:67:9 | LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:79:13 + --> $DIR/deprecation-lint.rs:69:13 | LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:81:9 + --> $DIR/deprecation-lint.rs:71:9 | LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:86:13 + --> $DIR/deprecation-lint.rs:76:13 | LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:87:13 + --> $DIR/deprecation-lint.rs:77:13 | LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Stable::override2': text - --> $DIR/deprecation-lint.rs:97:13 + --> $DIR/deprecation-lint.rs:87:13 | LL | override2: 3, | ^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Stable::override2': text - --> $DIR/deprecation-lint.rs:101:17 + --> $DIR/deprecation-lint.rs:91:17 | LL | let _ = x.override2; | ^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Stable::override2': text - --> $DIR/deprecation-lint.rs:105:13 + --> $DIR/deprecation-lint.rs:95:13 | LL | override2: _ | ^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Stable2::2': text - --> $DIR/deprecation-lint.rs:113:17 + --> $DIR/deprecation-lint.rs:103:17 | LL | let _ = x.2; | ^^^ error: use of deprecated item 'deprecation_lint::Stable2::2': text - --> $DIR/deprecation-lint.rs:118:20 + --> $DIR/deprecation-lint.rs:108:20 | LL | _) | ^ error: use of deprecated item 'deprecation_lint::Deprecated::inherit': text - --> $DIR/deprecation-lint.rs:126:13 + --> $DIR/deprecation-lint.rs:116:13 | LL | inherit: 1, | ^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Deprecated::inherit': text - --> $DIR/deprecation-lint.rs:130:17 + --> $DIR/deprecation-lint.rs:120:17 | LL | let _ = x.inherit; | ^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Deprecated::inherit': text - --> $DIR/deprecation-lint.rs:135:13 + --> $DIR/deprecation-lint.rs:125:13 | LL | inherit: _, | ^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Deprecated2::0': text - --> $DIR/deprecation-lint.rs:146:17 + --> $DIR/deprecation-lint.rs:136:17 | LL | let _ = x.0; | ^^^ error: use of deprecated item 'deprecation_lint::Deprecated2::1': text - --> $DIR/deprecation-lint.rs:148:17 + --> $DIR/deprecation-lint.rs:138:17 | LL | let _ = x.1; | ^^^ error: use of deprecated item 'deprecation_lint::Deprecated2::2': text - --> $DIR/deprecation-lint.rs:150:17 + --> $DIR/deprecation-lint.rs:140:17 | LL | let _ = x.2; | ^^^ error: use of deprecated item 'deprecation_lint::Deprecated2::0': text - --> $DIR/deprecation-lint.rs:155:14 + --> $DIR/deprecation-lint.rs:145:14 | LL | (_, | ^ error: use of deprecated item 'deprecation_lint::Deprecated2::1': text - --> $DIR/deprecation-lint.rs:157:14 + --> $DIR/deprecation-lint.rs:147:14 | LL | _, | ^ error: use of deprecated item 'deprecation_lint::Deprecated2::2': text - --> $DIR/deprecation-lint.rs:159:14 + --> $DIR/deprecation-lint.rs:149:14 | LL | _) | ^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated': text - --> $DIR/deprecation-lint.rs:257:13 + --> $DIR/deprecation-lint.rs:247:13 | LL | foo.method_deprecated(); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated' | ^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated': text - --> $DIR/deprecation-lint.rs:258:9 + --> $DIR/deprecation-lint.rs:248:9 | LL | Foo::method_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated': text - --> $DIR/deprecation-lint.rs:259:9 + --> $DIR/deprecation-lint.rs:249:9 | LL | ::method_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:260:13 + --> $DIR/deprecation-lint.rs:250:13 | LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:262:9 + --> $DIR/deprecation-lint.rs:252:9 | LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text - --> $DIR/deprecation-lint.rs:266:13 + --> $DIR/deprecation-lint.rs:256:13 | LL | foo.method_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text - --> $DIR/deprecation-lint.rs:267:9 + --> $DIR/deprecation-lint.rs:257:9 | LL | Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text - --> $DIR/deprecation-lint.rs:268:9 + --> $DIR/deprecation-lint.rs:258:9 | LL | ::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:269:13 + --> $DIR/deprecation-lint.rs:259:13 | LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:271:9 + --> $DIR/deprecation-lint.rs:261:9 | LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedStruct::i': text - --> $DIR/deprecation-lint.rs:279:13 + --> $DIR/deprecation-lint.rs:269:13 | LL | i: 0 //~ ERROR use of deprecated item 'this_crate::DeprecatedStruct::i': text | ^^^^ error: use of deprecated item 'this_crate::nested::DeprecatedStruct::i': text - --> $DIR/deprecation-lint.rs:290:13 + --> $DIR/deprecation-lint.rs:280:13 | LL | i: 0 //~ ERROR use of deprecated item 'this_crate::nested::DeprecatedStruct::i': text | ^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:301:13 + --> $DIR/deprecation-lint.rs:291:13 | LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:303:9 + --> $DIR/deprecation-lint.rs:293:9 | LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:305:13 + --> $DIR/deprecation-lint.rs:295:13 | LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:307:9 + --> $DIR/deprecation-lint.rs:297:9 | LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/deprecation-lint.rs:312:13 + --> $DIR/deprecation-lint.rs:302:13 | LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/deprecation-lint.rs:313:13 + --> $DIR/deprecation-lint.rs:303:13 | LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate2::Stable::override2': text - --> $DIR/deprecation-lint.rs:372:13 + --> $DIR/deprecation-lint.rs:362:13 | LL | override2: 3, | ^^^^^^^^^^^^ error: use of deprecated item 'this_crate2::Stable::override2': text - --> $DIR/deprecation-lint.rs:376:17 + --> $DIR/deprecation-lint.rs:366:17 | LL | let _ = x.override2; | ^^^^^^^^^^^ error: use of deprecated item 'this_crate2::Stable::override2': text - --> $DIR/deprecation-lint.rs:380:13 + --> $DIR/deprecation-lint.rs:370:13 | LL | override2: _ | ^^^^^^^^^^^^ error: use of deprecated item 'this_crate2::Stable2::2': text - --> $DIR/deprecation-lint.rs:388:17 + --> $DIR/deprecation-lint.rs:378:17 | LL | let _ = x.2; | ^^^ error: use of deprecated item 'this_crate2::Stable2::2': text - --> $DIR/deprecation-lint.rs:393:20 + --> $DIR/deprecation-lint.rs:383:20 | LL | _) | ^ error: use of deprecated item 'this_crate2::Deprecated::inherit': text - --> $DIR/deprecation-lint.rs:401:13 + --> $DIR/deprecation-lint.rs:391:13 | LL | inherit: 1, | ^^^^^^^^^^ error: use of deprecated item 'this_crate2::Deprecated::inherit': text - --> $DIR/deprecation-lint.rs:405:17 + --> $DIR/deprecation-lint.rs:395:17 | LL | let _ = x.inherit; | ^^^^^^^^^ error: use of deprecated item 'this_crate2::Deprecated::inherit': text - --> $DIR/deprecation-lint.rs:410:13 + --> $DIR/deprecation-lint.rs:400:13 | LL | inherit: _, | ^^^^^^^^^^ error: use of deprecated item 'this_crate2::Deprecated2::0': text - --> $DIR/deprecation-lint.rs:422:17 + --> $DIR/deprecation-lint.rs:412:17 | LL | let _ = x.0; | ^^^ error: use of deprecated item 'this_crate2::Deprecated2::1': text - --> $DIR/deprecation-lint.rs:424:17 + --> $DIR/deprecation-lint.rs:414:17 | LL | let _ = x.1; | ^^^ error: use of deprecated item 'this_crate2::Deprecated2::2': text - --> $DIR/deprecation-lint.rs:426:17 + --> $DIR/deprecation-lint.rs:416:17 | LL | let _ = x.2; | ^^^ error: use of deprecated item 'this_crate2::Deprecated2::0': text - --> $DIR/deprecation-lint.rs:431:14 + --> $DIR/deprecation-lint.rs:421:14 | LL | (_, | ^ error: use of deprecated item 'this_crate2::Deprecated2::1': text - --> $DIR/deprecation-lint.rs:433:14 + --> $DIR/deprecation-lint.rs:423:14 | LL | _, | ^ error: use of deprecated item 'this_crate2::Deprecated2::2': text - --> $DIR/deprecation-lint.rs:435:14 + --> $DIR/deprecation-lint.rs:425:14 | LL | _) | ^ diff --git a/src/test/ui/deprecation/deprecation-sanity.rs b/src/test/ui/deprecation/deprecation-sanity.rs index af2ac79ea80..09bae0bdfb1 100644 --- a/src/test/ui/deprecation/deprecation-sanity.rs +++ b/src/test/ui/deprecation/deprecation-sanity.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Various checks that deprecation attributes are used correctly mod bogus_attribute_types_1 { diff --git a/src/test/ui/deprecation/deprecation-sanity.stderr b/src/test/ui/deprecation/deprecation-sanity.stderr index 967eb6e23a3..a8bfcc23cc8 100644 --- a/src/test/ui/deprecation/deprecation-sanity.stderr +++ b/src/test/ui/deprecation/deprecation-sanity.stderr @@ -1,41 +1,41 @@ error[E0541]: unknown meta item 'reason' - --> $DIR/deprecation-sanity.rs:14:43 + --> $DIR/deprecation-sanity.rs:4:43 | LL | #[deprecated(since = "a", note = "a", reason)] //~ ERROR unknown meta item 'reason' | ^^^^^^ expected one of `since`, `note` error[E0551]: incorrect meta item - --> $DIR/deprecation-sanity.rs:17:31 + --> $DIR/deprecation-sanity.rs:7:31 | LL | #[deprecated(since = "a", note)] //~ ERROR incorrect meta item | ^^^^ error[E0551]: incorrect meta item - --> $DIR/deprecation-sanity.rs:20:18 + --> $DIR/deprecation-sanity.rs:10:18 | LL | #[deprecated(since, note = "a")] //~ ERROR incorrect meta item | ^^^^^ error[E0551]: incorrect meta item - --> $DIR/deprecation-sanity.rs:23:31 + --> $DIR/deprecation-sanity.rs:13:31 | LL | #[deprecated(since = "a", note(b))] //~ ERROR incorrect meta item | ^^^^^^^ error[E0551]: incorrect meta item - --> $DIR/deprecation-sanity.rs:26:18 + --> $DIR/deprecation-sanity.rs:16:18 | LL | #[deprecated(since(b), note = "a")] //~ ERROR incorrect meta item | ^^^^^^^^ error[E0550]: multiple deprecated attributes - --> $DIR/deprecation-sanity.rs:32:1 + --> $DIR/deprecation-sanity.rs:22:1 | LL | fn multiple1() { } //~ ERROR multiple deprecated attributes | ^^^^^^^^^^^^^^^^^^ error[E0538]: multiple 'since' items - --> $DIR/deprecation-sanity.rs:34:27 + --> $DIR/deprecation-sanity.rs:24:27 | LL | #[deprecated(since = "a", since = "b", note = "c")] //~ ERROR multiple 'since' items | ^^^^^^^^^^^ diff --git a/src/test/ui/deref-non-pointer.rs b/src/test/ui/deref-non-pointer.rs index 1c711c0145d..82ab355e697 100644 --- a/src/test/ui/deref-non-pointer.rs +++ b/src/test/ui/deref-non-pointer.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match *1 { //~ ERROR: cannot be dereferenced _ => { panic!(); } diff --git a/src/test/ui/deref-non-pointer.stderr b/src/test/ui/deref-non-pointer.stderr index 3e0ea06123d..0852311b7b1 100644 --- a/src/test/ui/deref-non-pointer.stderr +++ b/src/test/ui/deref-non-pointer.stderr @@ -1,5 +1,5 @@ error[E0614]: type `{integer}` cannot be dereferenced - --> $DIR/deref-non-pointer.rs:12:9 + --> $DIR/deref-non-pointer.rs:2:9 | LL | match *1 { //~ ERROR: cannot be dereferenced | ^^ diff --git a/src/test/ui/deref-suggestion.rs b/src/test/ui/deref-suggestion.rs index 1776a71a6bb..83e54b64f47 100644 --- a/src/test/ui/deref-suggestion.rs +++ b/src/test/ui/deref-suggestion.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! borrow { ($x:expr) => { &$x } //~ ERROR mismatched types } diff --git a/src/test/ui/deref-suggestion.stderr b/src/test/ui/deref-suggestion.stderr index 9811c5969da..99e2b38c3f0 100644 --- a/src/test/ui/deref-suggestion.stderr +++ b/src/test/ui/deref-suggestion.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:18:9 + --> $DIR/deref-suggestion.rs:8:9 | LL | foo(s); | ^ @@ -11,7 +11,7 @@ LL | foo(s); found type `&std::string::String` error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:24:10 + --> $DIR/deref-suggestion.rs:14:10 | LL | foo3(u); | ^ @@ -23,7 +23,7 @@ LL | foo3(u); found type `&u32` error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:32:9 + --> $DIR/deref-suggestion.rs:22:9 | LL | foo(&"aaa".to_owned()); | ^^^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | foo(&"aaa".to_owned()); found type `&std::string::String` error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:34:9 + --> $DIR/deref-suggestion.rs:24:9 | LL | foo(&mut "aaa".to_owned()); | ^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | foo(&mut "aaa".to_owned()); found type `&mut std::string::String` error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:12:20 + --> $DIR/deref-suggestion.rs:2:20 | LL | ($x:expr) => { &$x } //~ ERROR mismatched types | ^^^ expected u32, found &{integer} @@ -59,7 +59,7 @@ LL | foo3(borrow!(0)); found type `&{integer}` error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:38:5 + --> $DIR/deref-suggestion.rs:28:5 | LL | assert_eq!(3i32, &3i32); | ^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found &i32 diff --git a/src/test/ui/derive-uninhabited-enum-38885.rs b/src/test/ui/derive-uninhabited-enum-38885.rs index dc7f5d60cd8..c0279d60e24 100644 --- a/src/test/ui/derive-uninhabited-enum-38885.rs +++ b/src/test/ui/derive-uninhabited-enum-38885.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // compile-flags: -Wunused diff --git a/src/test/ui/derive-uninhabited-enum-38885.stderr b/src/test/ui/derive-uninhabited-enum-38885.stderr index 11032abfa12..8930b1f1974 100644 --- a/src/test/ui/derive-uninhabited-enum-38885.stderr +++ b/src/test/ui/derive-uninhabited-enum-38885.stderr @@ -1,5 +1,5 @@ warning: enum is never used: `Void` - --> $DIR/derive-uninhabited-enum-38885.rs:18:1 + --> $DIR/derive-uninhabited-enum-38885.rs:8:1 | LL | enum Void {} //~ WARN never used | ^^^^^^^^^ @@ -7,7 +7,7 @@ LL | enum Void {} //~ WARN never used = note: `-W dead-code` implied by `-W unused` warning: enum is never used: `Foo` - --> $DIR/derive-uninhabited-enum-38885.rs:21:1 + --> $DIR/derive-uninhabited-enum-38885.rs:11:1 | LL | enum Foo { //~ WARN never used | ^^^^^^^^ diff --git a/src/test/ui/derived-errors/issue-30580.rs b/src/test/ui/derived-errors/issue-30580.rs index 553ad0a3341..6940fcf7c3a 100644 --- a/src/test/ui/derived-errors/issue-30580.rs +++ b/src/test/ui/derived-errors/issue-30580.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we do not see uninformative region-related errors // when we get some basic type-checking failure. See #30580. diff --git a/src/test/ui/derived-errors/issue-30580.stderr b/src/test/ui/derived-errors/issue-30580.stderr index bf9a5a299e3..d4829ad2a1a 100644 --- a/src/test/ui/derived-errors/issue-30580.stderr +++ b/src/test/ui/derived-errors/issue-30580.stderr @@ -1,5 +1,5 @@ error[E0609]: no field `c` on type `&Foo` - --> $DIR/issue-30580.rs:22:11 + --> $DIR/issue-30580.rs:12:11 | LL | b.c; //~ ERROR no field `c` on type `&Foo` | ^ diff --git a/src/test/ui/derived-errors/issue-31997-1.rs b/src/test/ui/derived-errors/issue-31997-1.rs index 7d79c48c06a..90c1b498cea 100644 --- a/src/test/ui/derived-errors/issue-31997-1.rs +++ b/src/test/ui/derived-errors/issue-31997-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for this example from #31997 -- main goal is to // emit as minimal and precise an error set as possible. Ideally, we'd // only emit the E0433 error below, but right now we emit two. diff --git a/src/test/ui/derived-errors/issue-31997-1.stderr b/src/test/ui/derived-errors/issue-31997-1.stderr index 5c5422f091b..6df748122a2 100644 --- a/src/test/ui/derived-errors/issue-31997-1.stderr +++ b/src/test/ui/derived-errors/issue-31997-1.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: use of undeclared type or module `HashMap` - --> $DIR/issue-31997-1.rs:30:19 + --> $DIR/issue-31997-1.rs:20:19 | LL | let mut map = HashMap::new(); | ^^^^^^^ use of undeclared type or module `HashMap` diff --git a/src/test/ui/derived-errors/issue-31997.rs b/src/test/ui/derived-errors/issue-31997.rs index 2e1d3c55a8f..025e9100e23 100644 --- a/src/test/ui/derived-errors/issue-31997.rs +++ b/src/test/ui/derived-errors/issue-31997.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the resolve failure does not lead to downstream type errors. // See issue #31997. diff --git a/src/test/ui/derived-errors/issue-31997.stderr b/src/test/ui/derived-errors/issue-31997.stderr index 25088e8654b..246e6f6465c 100644 --- a/src/test/ui/derived-errors/issue-31997.stderr +++ b/src/test/ui/derived-errors/issue-31997.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find function `bar` in this scope - --> $DIR/issue-31997.rs:23:21 + --> $DIR/issue-31997.rs:13:21 | LL | try!(closure(|| bar(0 as *mut _))); //~ ERROR cannot find function `bar` in this scope | ^^^ not found in this scope diff --git a/src/test/ui/derives/derive-assoc-type-not-impl.rs b/src/test/ui/derives/derive-assoc-type-not-impl.rs index 3799f2ffba4..0f642d63a1d 100644 --- a/src/test/ui/derives/derive-assoc-type-not-impl.rs +++ b/src/test/ui/derives/derive-assoc-type-not-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { type X; fn method(&self) {} diff --git a/src/test/ui/derives/derive-assoc-type-not-impl.stderr b/src/test/ui/derives/derive-assoc-type-not-impl.stderr index c49e3387661..1b25231677c 100644 --- a/src/test/ui/derives/derive-assoc-type-not-impl.stderr +++ b/src/test/ui/derives/derive-assoc-type-not-impl.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `clone` found for type `Bar` in the current scope - --> $DIR/derive-assoc-type-not-impl.rs:28:30 + --> $DIR/derive-assoc-type-not-impl.rs:18:30 | LL | struct Bar { | ------------------ method `clone` not found for this diff --git a/src/test/ui/derives/derive-on-trait-item-or-impl-item.rs b/src/test/ui/derives/derive-on-trait-item-or-impl-item.rs index 9ff1c14f54c..b847000a81d 100644 --- a/src/test/ui/derives/derive-on-trait-item-or-impl-item.rs +++ b/src/test/ui/derives/derive-on-trait-item-or-impl-item.rs @@ -1,19 +1,11 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { #[derive(Clone)] //~^ ERROR `derive` may only be applied to structs, enums and unions type Bar; } +struct Bar; + impl Bar { #[derive(Clone)] //~^ ERROR `derive` may only be applied to structs, enums and unions diff --git a/src/test/ui/derives/derive-on-trait-item-or-impl-item.stderr b/src/test/ui/derives/derive-on-trait-item-or-impl-item.stderr index 8246889b620..b3aa886cd49 100644 --- a/src/test/ui/derives/derive-on-trait-item-or-impl-item.stderr +++ b/src/test/ui/derives/derive-on-trait-item-or-impl-item.stderr @@ -1,11 +1,11 @@ error: `derive` may only be applied to structs, enums and unions - --> $DIR/derive-on-trait-item-or-impl-item.rs:12:5 + --> $DIR/derive-on-trait-item-or-impl-item.rs:2:5 | LL | #[derive(Clone)] | ^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/derive-on-trait-item-or-impl-item.rs:18:5 + --> $DIR/derive-on-trait-item-or-impl-item.rs:10:5 | LL | #[derive(Clone)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs index 244acbf6605..b556d442420 100644 --- a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr index fbe9d3f7d69..deb1cbd89b8 100644 --- a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied - --> $DIR/derives-span-Clone-enum-struct-variant.rs:19:6 + --> $DIR/derives-span-Clone-enum-struct-variant.rs:9:6 | LL | x: Error //~ ERROR | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Clone-enum.rs b/src/test/ui/derives/derives-span-Clone-enum.rs index 785a3d35430..9bb4f486c3e 100644 --- a/src/test/ui/derives/derives-span-Clone-enum.rs +++ b/src/test/ui/derives/derives-span-Clone-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Clone-enum.stderr b/src/test/ui/derives/derives-span-Clone-enum.stderr index b5b3c8bfc85..de043cd28aa 100644 --- a/src/test/ui/derives/derives-span-Clone-enum.stderr +++ b/src/test/ui/derives/derives-span-Clone-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied - --> $DIR/derives-span-Clone-enum.rs:19:6 + --> $DIR/derives-span-Clone-enum.rs:9:6 | LL | Error //~ ERROR | ^^^^^ the trait `std::clone::Clone` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Clone-struct.rs b/src/test/ui/derives/derives-span-Clone-struct.rs index b1b1dc7bed1..f151636f848 100644 --- a/src/test/ui/derives/derives-span-Clone-struct.rs +++ b/src/test/ui/derives/derives-span-Clone-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Clone-struct.stderr b/src/test/ui/derives/derives-span-Clone-struct.stderr index ebd1e666b38..dd6fa9706c2 100644 --- a/src/test/ui/derives/derives-span-Clone-struct.stderr +++ b/src/test/ui/derives/derives-span-Clone-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied - --> $DIR/derives-span-Clone-struct.rs:18:5 + --> $DIR/derives-span-Clone-struct.rs:8:5 | LL | x: Error //~ ERROR | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Clone-tuple-struct.rs b/src/test/ui/derives/derives-span-Clone-tuple-struct.rs index d56e21b9a8a..7a62885324e 100644 --- a/src/test/ui/derives/derives-span-Clone-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Clone-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr index 6867baad2c1..5258240fc1f 100644 --- a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied - --> $DIR/derives-span-Clone-tuple-struct.rs:18:5 + --> $DIR/derives-span-Clone-tuple-struct.rs:8:5 | LL | Error //~ ERROR | ^^^^^ the trait `std::clone::Clone` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs index 4c25e482c2a..949597bc8f6 100644 --- a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr index f5939a2e937..c981c20b762 100644 --- a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` - --> $DIR/derives-span-Debug-enum-struct-variant.rs:19:6 + --> $DIR/derives-span-Debug-enum-struct-variant.rs:9:6 | LL | x: Error //~ ERROR | ^^^^^^^^ `Error` cannot be formatted using `{:?}` diff --git a/src/test/ui/derives/derives-span-Debug-enum.rs b/src/test/ui/derives/derives-span-Debug-enum.rs index 0cb02aa54e6..b2a39708ceb 100644 --- a/src/test/ui/derives/derives-span-Debug-enum.rs +++ b/src/test/ui/derives/derives-span-Debug-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Debug-enum.stderr b/src/test/ui/derives/derives-span-Debug-enum.stderr index 566a5786de7..02cfe20616c 100644 --- a/src/test/ui/derives/derives-span-Debug-enum.stderr +++ b/src/test/ui/derives/derives-span-Debug-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` - --> $DIR/derives-span-Debug-enum.rs:19:6 + --> $DIR/derives-span-Debug-enum.rs:9:6 | LL | Error //~ ERROR | ^^^^^ `Error` cannot be formatted using `{:?}` diff --git a/src/test/ui/derives/derives-span-Debug-struct.rs b/src/test/ui/derives/derives-span-Debug-struct.rs index 33fa82355ec..cf91c9436a6 100644 --- a/src/test/ui/derives/derives-span-Debug-struct.rs +++ b/src/test/ui/derives/derives-span-Debug-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Debug-struct.stderr b/src/test/ui/derives/derives-span-Debug-struct.stderr index 30145a78a26..5fe7d846b4c 100644 --- a/src/test/ui/derives/derives-span-Debug-struct.stderr +++ b/src/test/ui/derives/derives-span-Debug-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` - --> $DIR/derives-span-Debug-struct.rs:18:5 + --> $DIR/derives-span-Debug-struct.rs:8:5 | LL | x: Error //~ ERROR | ^^^^^^^^ `Error` cannot be formatted using `{:?}` diff --git a/src/test/ui/derives/derives-span-Debug-tuple-struct.rs b/src/test/ui/derives/derives-span-Debug-tuple-struct.rs index 760ed199f6a..cea973c91a7 100644 --- a/src/test/ui/derives/derives-span-Debug-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Debug-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr index 963fc8a38f0..9088b9e83b0 100644 --- a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` - --> $DIR/derives-span-Debug-tuple-struct.rs:18:5 + --> $DIR/derives-span-Debug-tuple-struct.rs:8:5 | LL | Error //~ ERROR | ^^^^^ `Error` cannot be formatted using `{:?}` diff --git a/src/test/ui/derives/derives-span-Default-struct.rs b/src/test/ui/derives/derives-span-Default-struct.rs index 4adfe75adaf..71fd5829e75 100644 --- a/src/test/ui/derives/derives-span-Default-struct.rs +++ b/src/test/ui/derives/derives-span-Default-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Default-struct.stderr b/src/test/ui/derives/derives-span-Default-struct.stderr index a9634e64fa9..1ad7cd45477 100644 --- a/src/test/ui/derives/derives-span-Default-struct.stderr +++ b/src/test/ui/derives/derives-span-Default-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::default::Default` is not satisfied - --> $DIR/derives-span-Default-struct.rs:18:5 + --> $DIR/derives-span-Default-struct.rs:8:5 | LL | x: Error //~ ERROR | ^^^^^^^^ the trait `std::default::Default` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Default-tuple-struct.rs b/src/test/ui/derives/derives-span-Default-tuple-struct.rs index a5e3a7cd49f..463f7d230ca 100644 --- a/src/test/ui/derives/derives-span-Default-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Default-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr index eb0ef61a57d..447bc73ceb4 100644 --- a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::default::Default` is not satisfied - --> $DIR/derives-span-Default-tuple-struct.rs:18:5 + --> $DIR/derives-span-Default-tuple-struct.rs:8:5 | LL | Error //~ ERROR | ^^^^^ the trait `std::default::Default` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs index 6abd1d31e66..d2dab8687f7 100644 --- a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr index b230c014092..e8bcec46655 100644 --- a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied - --> $DIR/derives-span-Eq-enum-struct-variant.rs:19:6 + --> $DIR/derives-span-Eq-enum-struct-variant.rs:9:6 | LL | x: Error //~ ERROR | ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Eq-enum.rs b/src/test/ui/derives/derives-span-Eq-enum.rs index f361278a620..c6c0d432108 100644 --- a/src/test/ui/derives/derives-span-Eq-enum.rs +++ b/src/test/ui/derives/derives-span-Eq-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-Eq-enum.stderr b/src/test/ui/derives/derives-span-Eq-enum.stderr index 7f6d27a311d..95ff08a4332 100644 --- a/src/test/ui/derives/derives-span-Eq-enum.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied - --> $DIR/derives-span-Eq-enum.rs:19:6 + --> $DIR/derives-span-Eq-enum.rs:9:6 | LL | Error //~ ERROR | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Eq-struct.rs b/src/test/ui/derives/derives-span-Eq-struct.rs index 7067caa6d5c..df310039847 100644 --- a/src/test/ui/derives/derives-span-Eq-struct.rs +++ b/src/test/ui/derives/derives-span-Eq-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-Eq-struct.stderr b/src/test/ui/derives/derives-span-Eq-struct.stderr index a9db0401959..44bbcf73dd7 100644 --- a/src/test/ui/derives/derives-span-Eq-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied - --> $DIR/derives-span-Eq-struct.rs:18:5 + --> $DIR/derives-span-Eq-struct.rs:8:5 | LL | x: Error //~ ERROR | ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Eq-tuple-struct.rs b/src/test/ui/derives/derives-span-Eq-tuple-struct.rs index 1a09628b770..abf6526b900 100644 --- a/src/test/ui/derives/derives-span-Eq-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Eq-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr index 70f39f30eed..26228b38913 100644 --- a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied - --> $DIR/derives-span-Eq-tuple-struct.rs:18:5 + --> $DIR/derives-span-Eq-tuple-struct.rs:8:5 | LL | Error //~ ERROR | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs index 907045cce47..3018a7b6d03 100644 --- a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr index bde7556f7ce..324f2f1fd6d 100644 --- a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied - --> $DIR/derives-span-Hash-enum-struct-variant.rs:19:6 + --> $DIR/derives-span-Hash-enum-struct-variant.rs:9:6 | LL | x: Error //~ ERROR | ^^^^^^^^ the trait `std::hash::Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Hash-enum.rs b/src/test/ui/derives/derives-span-Hash-enum.rs index 321b9e71a0f..bb656e5c2fe 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.rs +++ b/src/test/ui/derives/derives-span-Hash-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr index 72b8f3ada02..da44a8f498e 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied - --> $DIR/derives-span-Hash-enum.rs:19:6 + --> $DIR/derives-span-Hash-enum.rs:9:6 | LL | Error //~ ERROR | ^^^^^ the trait `std::hash::Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Hash-struct.rs b/src/test/ui/derives/derives-span-Hash-struct.rs index 7f69c3a8e25..fa5e2af6be8 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.rs +++ b/src/test/ui/derives/derives-span-Hash-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Hash-struct.stderr b/src/test/ui/derives/derives-span-Hash-struct.stderr index 3068bcfe0a0..17d45e4b0dd 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied - --> $DIR/derives-span-Hash-struct.rs:18:5 + --> $DIR/derives-span-Hash-struct.rs:8:5 | LL | x: Error //~ ERROR | ^^^^^^^^ the trait `std::hash::Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.rs b/src/test/ui/derives/derives-span-Hash-tuple-struct.rs index 2dee63c4298..3822bce1466 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr index a65fbd8b6e6..e0e5cce107f 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied - --> $DIR/derives-span-Hash-tuple-struct.rs:18:5 + --> $DIR/derives-span-Hash-tuple-struct.rs:8:5 | LL | Error //~ ERROR | ^^^^^ the trait `std::hash::Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs index 8f4e393c96a..62355cc2d96 100644 --- a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(Eq,PartialOrd,PartialEq)] diff --git a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr index 5968efd5ca1..149a9475f10 100644 --- a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied - --> $DIR/derives-span-Ord-enum-struct-variant.rs:19:6 + --> $DIR/derives-span-Ord-enum-struct-variant.rs:9:6 | LL | x: Error //~ ERROR | ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Ord-enum.rs b/src/test/ui/derives/derives-span-Ord-enum.rs index b8ceacf3753..72738931d10 100644 --- a/src/test/ui/derives/derives-span-Ord-enum.rs +++ b/src/test/ui/derives/derives-span-Ord-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(Eq,PartialOrd,PartialEq)] diff --git a/src/test/ui/derives/derives-span-Ord-enum.stderr b/src/test/ui/derives/derives-span-Ord-enum.stderr index 074a8f84cec..17ab75549e4 100644 --- a/src/test/ui/derives/derives-span-Ord-enum.stderr +++ b/src/test/ui/derives/derives-span-Ord-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied - --> $DIR/derives-span-Ord-enum.rs:19:6 + --> $DIR/derives-span-Ord-enum.rs:9:6 | LL | Error //~ ERROR | ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Ord-struct.rs b/src/test/ui/derives/derives-span-Ord-struct.rs index 2ff62bac2bc..53d4c2c22b5 100644 --- a/src/test/ui/derives/derives-span-Ord-struct.rs +++ b/src/test/ui/derives/derives-span-Ord-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(Eq,PartialOrd,PartialEq)] diff --git a/src/test/ui/derives/derives-span-Ord-struct.stderr b/src/test/ui/derives/derives-span-Ord-struct.stderr index 2e584e6ca87..7088f8fc890 100644 --- a/src/test/ui/derives/derives-span-Ord-struct.stderr +++ b/src/test/ui/derives/derives-span-Ord-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied - --> $DIR/derives-span-Ord-struct.rs:18:5 + --> $DIR/derives-span-Ord-struct.rs:8:5 | LL | x: Error //~ ERROR | ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Ord-tuple-struct.rs b/src/test/ui/derives/derives-span-Ord-tuple-struct.rs index 24eacb71d7b..4e09c270986 100644 --- a/src/test/ui/derives/derives-span-Ord-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Ord-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(Eq,PartialOrd,PartialEq)] diff --git a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr index 0da452f0a6a..5c046366993 100644 --- a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied - --> $DIR/derives-span-Ord-tuple-struct.rs:18:5 + --> $DIR/derives-span-Ord-tuple-struct.rs:8:5 | LL | Error //~ ERROR | ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs index 14d94f1599e..d66faa086de 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr index cad446f8326..7683402d8aa 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:19:6 + --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6 | LL | x: Error //~ ERROR | ^^^^^^^^ @@ -7,7 +7,7 @@ LL | x: Error //~ ERROR = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:19:6 + --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6 | LL | x: Error //~ ERROR | ^^^^^^^^ diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.rs b/src/test/ui/derives/derives-span-PartialEq-enum.rs index ab58bb938b9..66edf460b31 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum.rs +++ b/src/test/ui/derives/derives-span-PartialEq-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.stderr b/src/test/ui/derives/derives-span-PartialEq-enum.stderr index e75d0693db5..9fa1a2bf17a 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum.rs:19:6 + --> $DIR/derives-span-PartialEq-enum.rs:9:6 | LL | Error //~ ERROR | ^^^^^ @@ -7,7 +7,7 @@ LL | Error //~ ERROR = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum.rs:19:6 + --> $DIR/derives-span-PartialEq-enum.rs:9:6 | LL | Error //~ ERROR | ^^^^^ diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.rs b/src/test/ui/derives/derives-span-PartialEq-struct.rs index 05a0990ff03..ce5c67af77f 100644 --- a/src/test/ui/derives/derives-span-PartialEq-struct.rs +++ b/src/test/ui/derives/derives-span-PartialEq-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-struct.stderr index c8cd509a824..4a08c985b4a 100644 --- a/src/test/ui/derives/derives-span-PartialEq-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-struct.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-struct.rs:18:5 + --> $DIR/derives-span-PartialEq-struct.rs:8:5 | LL | x: Error //~ ERROR | ^^^^^^^^ @@ -7,7 +7,7 @@ LL | x: Error //~ ERROR = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-struct.rs:18:5 + --> $DIR/derives-span-PartialEq-struct.rs:8:5 | LL | x: Error //~ ERROR | ^^^^^^^^ diff --git a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs index cdeb7ce45bc..eaa62831136 100644 --- a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr index b66189fb567..850eab4f088 100644 --- a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-tuple-struct.rs:18:5 + --> $DIR/derives-span-PartialEq-tuple-struct.rs:8:5 | LL | Error //~ ERROR | ^^^^^ @@ -7,7 +7,7 @@ LL | Error //~ ERROR = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-tuple-struct.rs:18:5 + --> $DIR/derives-span-PartialEq-tuple-struct.rs:8:5 | LL | Error //~ ERROR | ^^^^^ diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs index a5df717e06b..0bc6f98d982 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr index 7e55ba70c13..0c359629d78 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:19:6 + --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:9:6 | LL | x: Error //~ ERROR | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.rs b/src/test/ui/derives/derives-span-PartialOrd-enum.rs index 3411d2f3119..ee4423f3bee 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr index d8b3bd9f1bc..e4036a540db 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum.rs:19:6 + --> $DIR/derives-span-PartialOrd-enum.rs:9:6 | LL | Error //~ ERROR | ^^^^^ no implementation for `Error < Error` and `Error > Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.rs b/src/test/ui/derives/derives-span-PartialOrd-struct.rs index 1feadc2fd83..48435e0cd45 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-struct.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr index afd93dce625..5c77a05e9d0 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-struct.rs:18:5 + --> $DIR/derives-span-PartialOrd-struct.rs:8:5 | LL | x: Error //~ ERROR | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs index 9db0fed2d9e..2aa412e6d1d 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr index a65ee40f220..e38a0424b3d 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-tuple-struct.rs:18:5 + --> $DIR/derives-span-PartialOrd-tuple-struct.rs:8:5 | LL | Error //~ ERROR | ^^^^^ no implementation for `Error < Error` and `Error > Error` diff --git a/src/test/ui/derives/deriving-bounds.rs b/src/test/ui/derives/deriving-bounds.rs index 72d06274de4..607cfa1bb2c 100644 --- a/src/test/ui/derives/deriving-bounds.rs +++ b/src/test/ui/derives/deriving-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Send)] //~^ ERROR this unsafe trait should be implemented explicitly struct Test; diff --git a/src/test/ui/derives/deriving-bounds.stderr b/src/test/ui/derives/deriving-bounds.stderr index 2c42fd1b672..deb84fd99bd 100644 --- a/src/test/ui/derives/deriving-bounds.stderr +++ b/src/test/ui/derives/deriving-bounds.stderr @@ -1,11 +1,11 @@ error: this unsafe trait should be implemented explicitly - --> $DIR/deriving-bounds.rs:11:10 + --> $DIR/deriving-bounds.rs:1:10 | LL | #[derive(Send)] | ^^^^ error: this unsafe trait should be implemented explicitly - --> $DIR/deriving-bounds.rs:15:10 + --> $DIR/deriving-bounds.rs:5:10 | LL | #[derive(Sync)] | ^^^^ diff --git a/src/test/ui/derives/deriving-copyclone.rs b/src/test/ui/derives/deriving-copyclone.rs index 92fb7c5737a..afe61969071 100644 --- a/src/test/ui/derives/deriving-copyclone.rs +++ b/src/test/ui/derives/deriving-copyclone.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // this will get a no-op Clone impl #[derive(Copy, Clone)] struct A { diff --git a/src/test/ui/derives/deriving-copyclone.stderr b/src/test/ui/derives/deriving-copyclone.stderr index 2d0dc6649e7..0a9fdd34fe2 100644 --- a/src/test/ui/derives/deriving-copyclone.stderr +++ b/src/test/ui/derives/deriving-copyclone.stderr @@ -1,38 +1,38 @@ error[E0277]: the trait bound `C: std::marker::Copy` is not satisfied - --> $DIR/deriving-copyclone.rs:41:5 + --> $DIR/deriving-copyclone.rs:31:5 | LL | is_copy(B { a: 1, b: C }); //~ERROR Copy | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `C` | = note: required because of the requirements on the impl of `std::marker::Copy` for `B` note: required by `is_copy` - --> $DIR/deriving-copyclone.rs:28:1 + --> $DIR/deriving-copyclone.rs:18:1 | LL | fn is_copy(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `C: std::clone::Clone` is not satisfied - --> $DIR/deriving-copyclone.rs:42:5 + --> $DIR/deriving-copyclone.rs:32:5 | LL | is_clone(B { a: 1, b: C }); //~ERROR Clone | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `C` | = note: required because of the requirements on the impl of `std::clone::Clone` for `B` note: required by `is_clone` - --> $DIR/deriving-copyclone.rs:29:1 + --> $DIR/deriving-copyclone.rs:19:1 | LL | fn is_clone(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `D: std::marker::Copy` is not satisfied - --> $DIR/deriving-copyclone.rs:45:5 + --> $DIR/deriving-copyclone.rs:35:5 | LL | is_copy(B { a: 1, b: D }); //~ERROR Copy | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `D` | = note: required because of the requirements on the impl of `std::marker::Copy` for `B` note: required by `is_copy` - --> $DIR/deriving-copyclone.rs:28:1 + --> $DIR/deriving-copyclone.rs:18:1 | LL | fn is_copy(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/derives/deriving-meta-empty-trait-list.rs b/src/test/ui/derives/deriving-meta-empty-trait-list.rs index cf4dfb947f4..88248414615 100644 --- a/src/test/ui/derives/deriving-meta-empty-trait-list.rs +++ b/src/test/ui/derives/deriving-meta-empty-trait-list.rs @@ -1,19 +1,4 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![allow(dead_code)] - -#[derive] //~ WARNING empty trait list in `derive` -struct Foo; +// compile-pass #[derive()] //~ WARNING empty trait list in `derive` struct Bar; diff --git a/src/test/ui/derives/deriving-meta-empty-trait-list.stderr b/src/test/ui/derives/deriving-meta-empty-trait-list.stderr index f5532f7c561..191bb780f7e 100644 --- a/src/test/ui/derives/deriving-meta-empty-trait-list.stderr +++ b/src/test/ui/derives/deriving-meta-empty-trait-list.stderr @@ -1,11 +1,5 @@ warning: empty trait list in `derive` - --> $DIR/deriving-meta-empty-trait-list.rs:15:1 - | -LL | #[derive] //~ WARNING empty trait list in `derive` - | ^^^^^^^^^ - -warning: empty trait list in `derive` - --> $DIR/deriving-meta-empty-trait-list.rs:18:1 + --> $DIR/deriving-meta-empty-trait-list.rs:3:1 | LL | #[derive()] //~ WARNING empty trait list in `derive` | ^^^^^^^^^^^ diff --git a/src/test/ui/derives/deriving-meta-unknown-trait.rs b/src/test/ui/derives/deriving-meta-unknown-trait.rs index d388ece0844..2b29f10150b 100644 --- a/src/test/ui/derives/deriving-meta-unknown-trait.rs +++ b/src/test/ui/derives/deriving-meta-unknown-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #[derive(Eqr)] diff --git a/src/test/ui/derives/deriving-meta-unknown-trait.stderr b/src/test/ui/derives/deriving-meta-unknown-trait.stderr index aa0f1e21213..2b121ac679a 100644 --- a/src/test/ui/derives/deriving-meta-unknown-trait.stderr +++ b/src/test/ui/derives/deriving-meta-unknown-trait.stderr @@ -1,5 +1,5 @@ error: cannot find derive macro `Eqr` in this scope - --> $DIR/deriving-meta-unknown-trait.rs:13:10 + --> $DIR/deriving-meta-unknown-trait.rs:3:10 | LL | #[derive(Eqr)] | ^^^ help: try: `Eq` diff --git a/src/test/ui/derives/deriving-no-inner-impl-error-message.rs b/src/test/ui/derives/deriving-no-inner-impl-error-message.rs index 129c859b919..d3ac5d2fe2f 100644 --- a/src/test/ui/derives/deriving-no-inner-impl-error-message.rs +++ b/src/test/ui/derives/deriving-no-inner-impl-error-message.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct NoCloneOrEq; #[derive(PartialEq)] diff --git a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr index 48d27ae1474..02ea6321eb8 100644 --- a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr +++ b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `NoCloneOrEq` - --> $DIR/deriving-no-inner-impl-error-message.rs:15:5 + --> $DIR/deriving-no-inner-impl-error-message.rs:5:5 | LL | x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq` | ^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to typ = note: an implementation of `std::cmp::PartialEq` might be missing for `NoCloneOrEq` error[E0369]: binary operation `!=` cannot be applied to type `NoCloneOrEq` - --> $DIR/deriving-no-inner-impl-error-message.rs:15:5 + --> $DIR/deriving-no-inner-impl-error-message.rs:5:5 | LL | x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq` | ^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to typ = note: an implementation of `std::cmp::PartialEq` might be missing for `NoCloneOrEq` error[E0277]: the trait bound `NoCloneOrEq: std::clone::Clone` is not satisfied - --> $DIR/deriving-no-inner-impl-error-message.rs:20:5 + --> $DIR/deriving-no-inner-impl-error-message.rs:10:5 | LL | x: NoCloneOrEq | ^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `NoCloneOrEq` diff --git a/src/test/ui/derives/deriving-non-type.rs b/src/test/ui/derives/deriving-non-type.rs index 84dd22435b8..7e14c12c0a9 100644 --- a/src/test/ui/derives/deriving-non-type.rs +++ b/src/test/ui/derives/deriving-non-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] struct S; diff --git a/src/test/ui/derives/deriving-non-type.stderr b/src/test/ui/derives/deriving-non-type.stderr index d9da03afb03..98594542653 100644 --- a/src/test/ui/derives/deriving-non-type.stderr +++ b/src/test/ui/derives/deriving-non-type.stderr @@ -1,53 +1,53 @@ error: `derive` may only be applied to structs, enums and unions - --> $DIR/deriving-non-type.rs:15:1 + --> $DIR/deriving-non-type.rs:5:1 | LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/deriving-non-type.rs:18:1 + --> $DIR/deriving-non-type.rs:8:1 | LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/deriving-non-type.rs:21:1 + --> $DIR/deriving-non-type.rs:11:1 | LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/deriving-non-type.rs:24:1 + --> $DIR/deriving-non-type.rs:14:1 | LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/deriving-non-type.rs:27:1 + --> $DIR/deriving-non-type.rs:17:1 | LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/deriving-non-type.rs:30:1 + --> $DIR/deriving-non-type.rs:20:1 | LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/deriving-non-type.rs:33:1 + --> $DIR/deriving-non-type.rs:23:1 | LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/deriving-non-type.rs:36:1 + --> $DIR/deriving-non-type.rs:26:1 | LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/deriving-non-type.rs:39:1 + --> $DIR/deriving-non-type.rs:29:1 | LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/derives/deriving-primitive.rs b/src/test/ui/derives/deriving-primitive.rs index 04fdee5e3ed..53acf6164d9 100644 --- a/src/test/ui/derives/deriving-primitive.rs +++ b/src/test/ui/derives/deriving-primitive.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(FromPrimitive)] //~ ERROR cannot find derive macro `FromPrimitive` in this scope enum Foo {} diff --git a/src/test/ui/derives/deriving-primitive.stderr b/src/test/ui/derives/deriving-primitive.stderr index bc2d3393290..377f4e87082 100644 --- a/src/test/ui/derives/deriving-primitive.stderr +++ b/src/test/ui/derives/deriving-primitive.stderr @@ -1,5 +1,5 @@ error: cannot find derive macro `FromPrimitive` in this scope - --> $DIR/deriving-primitive.rs:11:10 + --> $DIR/deriving-primitive.rs:1:10 | LL | #[derive(FromPrimitive)] //~ ERROR cannot find derive macro `FromPrimitive` in this scope | ^^^^^^^^^^^^^ diff --git a/src/test/ui/derives/deriving-with-repr-packed.rs b/src/test/ui/derives/deriving-with-repr-packed.rs index 43375098cb5..66b0f85c85d 100644 --- a/src/test/ui/derives/deriving-with-repr-packed.rs +++ b/src/test/ui/derives/deriving-with-repr-packed.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(safe_packed_borrows)] // check that derive on a packed struct with non-Copy fields diff --git a/src/test/ui/derives/deriving-with-repr-packed.stderr b/src/test/ui/derives/deriving-with-repr-packed.stderr index a7599c1e7db..4ab14a1df84 100644 --- a/src/test/ui/derives/deriving-with-repr-packed.stderr +++ b/src/test/ui/derives/deriving-with-repr-packed.stderr @@ -1,11 +1,11 @@ error: #[derive] can't be used on a #[repr(packed)] struct with type parameters (error E0133) - --> $DIR/deriving-with-repr-packed.rs:18:16 + --> $DIR/deriving-with-repr-packed.rs:8:16 | LL | #[derive(Copy, Clone, PartialEq, Eq)] | ^^^^^ | note: lint level defined here - --> $DIR/deriving-with-repr-packed.rs:11:9 + --> $DIR/deriving-with-repr-packed.rs:1:9 | LL | #![deny(safe_packed_borrows)] | ^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | #![deny(safe_packed_borrows)] = note: for more information, see issue #46043 error: #[derive] can't be used on a #[repr(packed)] struct with type parameters (error E0133) - --> $DIR/deriving-with-repr-packed.rs:18:23 + --> $DIR/deriving-with-repr-packed.rs:8:23 | LL | #[derive(Copy, Clone, PartialEq, Eq)] | ^^^^^^^^^ @@ -22,7 +22,7 @@ LL | #[derive(Copy, Clone, PartialEq, Eq)] = note: for more information, see issue #46043 error: #[derive] can't be used on a #[repr(packed)] struct that does not derive Copy (error E0133) - --> $DIR/deriving-with-repr-packed.rs:26:10 + --> $DIR/deriving-with-repr-packed.rs:16:10 | LL | #[derive(PartialEq, Eq)] | ^^^^^^^^^ @@ -31,7 +31,7 @@ LL | #[derive(PartialEq, Eq)] = note: for more information, see issue #46043 error: #[derive] can't be used on a #[repr(packed)] struct that does not derive Copy (error E0133) - --> $DIR/deriving-with-repr-packed.rs:35:10 + --> $DIR/deriving-with-repr-packed.rs:25:10 | LL | #[derive(PartialEq)] | ^^^^^^^^^ diff --git a/src/test/ui/destructure-trait-ref.rs b/src/test/ui/destructure-trait-ref.rs index b5acdc12ca0..66be493cb1f 100644 --- a/src/test/ui/destructure-trait-ref.rs +++ b/src/test/ui/destructure-trait-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The regression test for #15031 to make sure destructuring trait // reference work properly. diff --git a/src/test/ui/destructure-trait-ref.stderr b/src/test/ui/destructure-trait-ref.stderr index 0335fff7bce..4c93a6781ea 100644 --- a/src/test/ui/destructure-trait-ref.stderr +++ b/src/test/ui/destructure-trait-ref.stderr @@ -1,23 +1,23 @@ error[E0033]: type `&dyn T` cannot be dereferenced - --> $DIR/destructure-trait-ref.rs:36:9 + --> $DIR/destructure-trait-ref.rs:26:9 | LL | let &x = &1isize as &T; //~ ERROR type `&dyn T` cannot be dereferenced | ^^ type `&dyn T` cannot be dereferenced error[E0033]: type `&dyn T` cannot be dereferenced - --> $DIR/destructure-trait-ref.rs:37:10 + --> $DIR/destructure-trait-ref.rs:27:10 | LL | let &&x = &(&1isize as &T); //~ ERROR type `&dyn T` cannot be dereferenced | ^^ type `&dyn T` cannot be dereferenced error[E0033]: type `std::boxed::Box` cannot be dereferenced - --> $DIR/destructure-trait-ref.rs:38:9 + --> $DIR/destructure-trait-ref.rs:28:9 | LL | let box x = box 1isize as Box; //~ ERROR type `std::boxed::Box` cannot be dereferenced | ^^^^^ type `std::boxed::Box` cannot be dereferenced error[E0308]: mismatched types - --> $DIR/destructure-trait-ref.rs:41:10 + --> $DIR/destructure-trait-ref.rs:31:10 | LL | let &&x = &1isize as &T; | ^^ expected trait T, found reference @@ -27,7 +27,7 @@ LL | let &&x = &1isize as &T; = help: did you mean `x: &dyn T`? error[E0308]: mismatched types - --> $DIR/destructure-trait-ref.rs:46:11 + --> $DIR/destructure-trait-ref.rs:36:11 | LL | let &&&x = &(&1isize as &T); | ^^ expected trait T, found reference @@ -37,7 +37,7 @@ LL | let &&&x = &(&1isize as &T); = help: did you mean `x: &dyn T`? error[E0308]: mismatched types - --> $DIR/destructure-trait-ref.rs:51:13 + --> $DIR/destructure-trait-ref.rs:41:13 | LL | let box box x = box 1isize as Box; | ^^^^^ expected trait T, found struct `std::boxed::Box` diff --git a/src/test/ui/did_you_mean/E0178.rs b/src/test/ui/did_you_mean/E0178.rs index 21cdb38fdb1..aad95dc2c20 100644 --- a/src/test/ui/did_you_mean/E0178.rs +++ b/src/test/ui/did_you_mean/E0178.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo {} struct Bar<'a> { diff --git a/src/test/ui/did_you_mean/E0178.stderr b/src/test/ui/did_you_mean/E0178.stderr index 29e7aeb45ca..ad9bb57c922 100644 --- a/src/test/ui/did_you_mean/E0178.stderr +++ b/src/test/ui/did_you_mean/E0178.stderr @@ -1,23 +1,23 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` - --> $DIR/E0178.rs:14:8 + --> $DIR/E0178.rs:4:8 | LL | w: &'a Foo + Copy, //~ ERROR expected a path | ^^^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + Copy)` error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` - --> $DIR/E0178.rs:15:8 + --> $DIR/E0178.rs:5:8 | LL | x: &'a Foo + 'a, //~ ERROR expected a path | ^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + 'a)` error[E0178]: expected a path on the left-hand side of `+`, not `&'a mut Foo` - --> $DIR/E0178.rs:16:8 + --> $DIR/E0178.rs:6:8 | LL | y: &'a mut Foo + 'a, //~ ERROR expected a path | ^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'a mut (Foo + 'a)` error[E0178]: expected a path on the left-hand side of `+`, not `fn() -> Foo` - --> $DIR/E0178.rs:17:8 + --> $DIR/E0178.rs:7:8 | LL | z: fn() -> Foo + 'a, //~ ERROR expected a path | ^^^^^^^^^^^^^^^^ perhaps you forgot parentheses? diff --git a/src/test/ui/did_you_mean/bad-assoc-expr.rs b/src/test/ui/did_you_mean/bad-assoc-expr.rs index 779aa952c81..2e13db17d82 100644 --- a/src/test/ui/did_you_mean/bad-assoc-expr.rs +++ b/src/test/ui/did_you_mean/bad-assoc-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let a = [1, 2, 3, 4]; [i32; 4]::clone(&a); diff --git a/src/test/ui/did_you_mean/bad-assoc-expr.stderr b/src/test/ui/did_you_mean/bad-assoc-expr.stderr index c4f7e47c61b..e1eceabcc30 100644 --- a/src/test/ui/did_you_mean/bad-assoc-expr.stderr +++ b/src/test/ui/did_you_mean/bad-assoc-expr.stderr @@ -1,35 +1,35 @@ error: missing angle brackets in associated item path - --> $DIR/bad-assoc-expr.rs:13:5 + --> $DIR/bad-assoc-expr.rs:3:5 | LL | [i32; 4]::clone(&a); | ^^^^^^^^^^^^^^^ help: try: `<[i32; 4]>::clone` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-expr.rs:16:5 + --> $DIR/bad-assoc-expr.rs:6:5 | LL | [i32]::as_ref(&a); | ^^^^^^^^^^^^^ help: try: `<[i32]>::as_ref` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-expr.rs:19:5 + --> $DIR/bad-assoc-expr.rs:9:5 | LL | (u8)::clone(&0); | ^^^^^^^^^^^ help: try: `<(u8)>::clone` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-expr.rs:22:5 + --> $DIR/bad-assoc-expr.rs:12:5 | LL | (u8, u8)::clone(&(0, 0)); | ^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::clone` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-expr.rs:25:6 + --> $DIR/bad-assoc-expr.rs:15:6 | LL | &(u8)::clone(&0); | ^^^^^^^^^^^ help: try: `<(u8)>::clone` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-expr.rs:28:10 + --> $DIR/bad-assoc-expr.rs:18:10 | LL | 10 + (u8)::clone(&0); | ^^^^^^^^^^^ help: try: `<(u8)>::clone` diff --git a/src/test/ui/did_you_mean/bad-assoc-pat.rs b/src/test/ui/did_you_mean/bad-assoc-pat.rs index bf6be0ee985..5bd2f1a894e 100644 --- a/src/test/ui/did_you_mean/bad-assoc-pat.rs +++ b/src/test/ui/did_you_mean/bad-assoc-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match 0u8 { [u8]::AssocItem => {} diff --git a/src/test/ui/did_you_mean/bad-assoc-pat.stderr b/src/test/ui/did_you_mean/bad-assoc-pat.stderr index 10ee175a97e..92fd9f26777 100644 --- a/src/test/ui/did_you_mean/bad-assoc-pat.stderr +++ b/src/test/ui/did_you_mean/bad-assoc-pat.stderr @@ -1,50 +1,58 @@ error: missing angle brackets in associated item path - --> $DIR/bad-assoc-pat.rs:13:9 + --> $DIR/bad-assoc-pat.rs:3:9 | LL | [u8]::AssocItem => {} | ^^^^^^^^^^^^^^^ help: try: `<[u8]>::AssocItem` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-pat.rs:16:9 + --> $DIR/bad-assoc-pat.rs:6:9 | LL | (u8, u8)::AssocItem => {} | ^^^^^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::AssocItem` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-pat.rs:19:9 + --> $DIR/bad-assoc-pat.rs:9:9 | LL | _::AssocItem => {} | ^^^^^^^^^^^^ help: try: `<_>::AssocItem` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-pat.rs:24:10 + --> $DIR/bad-assoc-pat.rs:14:10 | LL | &(u8,)::AssocItem => {} | ^^^^^^^^^^^^^^^^ help: try: `<(u8,)>::AssocItem` error[E0599]: no associated item named `AssocItem` found for type `[u8]` in the current scope - --> $DIR/bad-assoc-pat.rs:13:9 + --> $DIR/bad-assoc-pat.rs:3:15 | LL | [u8]::AssocItem => {} - | ^^^^^^^^^^^^^^^ associated item not found in `[u8]` + | ------^^^^^^^^^ + | | + | associated item not found in `[u8]` error[E0599]: no associated item named `AssocItem` found for type `(u8, u8)` in the current scope - --> $DIR/bad-assoc-pat.rs:16:9 + --> $DIR/bad-assoc-pat.rs:6:19 | LL | (u8, u8)::AssocItem => {} - | ^^^^^^^^^^^^^^^^^^^ associated item not found in `(u8, u8)` + | ----------^^^^^^^^^ + | | + | associated item not found in `(u8, u8)` error[E0599]: no associated item named `AssocItem` found for type `_` in the current scope - --> $DIR/bad-assoc-pat.rs:19:9 + --> $DIR/bad-assoc-pat.rs:9:12 | LL | _::AssocItem => {} - | ^^^^^^^^^^^^ associated item not found in `_` + | ---^^^^^^^^^ + | | + | associated item not found in `_` error[E0599]: no associated item named `AssocItem` found for type `(u8,)` in the current scope - --> $DIR/bad-assoc-pat.rs:24:10 + --> $DIR/bad-assoc-pat.rs:14:17 | LL | &(u8,)::AssocItem => {} - | ^^^^^^^^^^^^^^^^ associated item not found in `(u8,)` + | -------^^^^^^^^^ + | | + | associated item not found in `(u8,)` error: aborting due to 8 previous errors diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.rs b/src/test/ui/did_you_mean/bad-assoc-ty.rs index b4a59904ee4..436bda1547b 100644 --- a/src/test/ui/did_you_mean/bad-assoc-ty.rs +++ b/src/test/ui/did_you_mean/bad-assoc-ty.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type A = [u8; 4]::AssocTy; //~^ ERROR missing angle brackets in associated item path //~| ERROR ambiguous associated type diff --git a/src/test/ui/did_you_mean/bad-assoc-ty.stderr b/src/test/ui/did_you_mean/bad-assoc-ty.stderr index 5de9f5866ff..a9dcc831ba7 100644 --- a/src/test/ui/did_you_mean/bad-assoc-ty.stderr +++ b/src/test/ui/did_you_mean/bad-assoc-ty.stderr @@ -1,89 +1,89 @@ error: missing angle brackets in associated item path - --> $DIR/bad-assoc-ty.rs:11:10 + --> $DIR/bad-assoc-ty.rs:1:10 | LL | type A = [u8; 4]::AssocTy; | ^^^^^^^^^^^^^^^^ help: try: `<[u8; 4]>::AssocTy` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-ty.rs:15:10 + --> $DIR/bad-assoc-ty.rs:5:10 | LL | type B = [u8]::AssocTy; | ^^^^^^^^^^^^^ help: try: `<[u8]>::AssocTy` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-ty.rs:19:10 + --> $DIR/bad-assoc-ty.rs:9:10 | LL | type C = (u8)::AssocTy; | ^^^^^^^^^^^^^ help: try: `<(u8)>::AssocTy` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-ty.rs:23:10 + --> $DIR/bad-assoc-ty.rs:13:10 | LL | type D = (u8, u8)::AssocTy; | ^^^^^^^^^^^^^^^^^ help: try: `<(u8, u8)>::AssocTy` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-ty.rs:27:10 + --> $DIR/bad-assoc-ty.rs:17:10 | LL | type E = _::AssocTy; | ^^^^^^^^^^ help: try: `<_>::AssocTy` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-ty.rs:31:19 + --> $DIR/bad-assoc-ty.rs:21:19 | LL | type F = &'static (u8)::AssocTy; | ^^^^^^^^^^^^^ help: try: `<(u8)>::AssocTy` error: missing angle brackets in associated item path - --> $DIR/bad-assoc-ty.rs:37:10 + --> $DIR/bad-assoc-ty.rs:27:10 | LL | type G = 'static + (Send)::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `<'static + Send>::AssocTy` error[E0223]: ambiguous associated type - --> $DIR/bad-assoc-ty.rs:11:10 + --> $DIR/bad-assoc-ty.rs:1:10 | LL | type A = [u8; 4]::AssocTy; | ^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<[u8; _] as Trait>::AssocTy` error[E0223]: ambiguous associated type - --> $DIR/bad-assoc-ty.rs:15:10 + --> $DIR/bad-assoc-ty.rs:5:10 | LL | type B = [u8]::AssocTy; | ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<[u8] as Trait>::AssocTy` error[E0223]: ambiguous associated type - --> $DIR/bad-assoc-ty.rs:19:10 + --> $DIR/bad-assoc-ty.rs:9:10 | LL | type C = (u8)::AssocTy; | ^^^^^^^^^^^^^ help: use fully-qualified syntax: `::AssocTy` error[E0223]: ambiguous associated type - --> $DIR/bad-assoc-ty.rs:23:10 + --> $DIR/bad-assoc-ty.rs:13:10 | LL | type D = (u8, u8)::AssocTy; | ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(u8, u8) as Trait>::AssocTy` error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/bad-assoc-ty.rs:27:10 + --> $DIR/bad-assoc-ty.rs:17:10 | LL | type E = _::AssocTy; | ^ not allowed in type signatures error[E0223]: ambiguous associated type - --> $DIR/bad-assoc-ty.rs:31:19 + --> $DIR/bad-assoc-ty.rs:21:19 | LL | type F = &'static (u8)::AssocTy; | ^^^^^^^^^^^^^ help: use fully-qualified syntax: `::AssocTy` error[E0223]: ambiguous associated type - --> $DIR/bad-assoc-ty.rs:37:10 + --> $DIR/bad-assoc-ty.rs:27:10 | LL | type G = 'static + (Send)::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn std::marker::Send + 'static) as Trait>::AssocTy` error[E0223]: ambiguous associated type - --> $DIR/bad-assoc-ty.rs:43:10 + --> $DIR/bad-assoc-ty.rs:33:10 | LL | type H = Fn(u8) -> (u8)::Output; | ^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<(dyn std::ops::Fn(u8) -> u8 + 'static) as Trait>::Output` diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.rs b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.rs index 076b61b1790..1749137d438 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.rs +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(&self, a: A) -> A { a diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr index 1e55b0c024f..8aedb4229e6 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Bar: Foo` is not satisfied - --> $DIR/issue-21659-show-relevant-trait-impls-1.rs:34:8 + --> $DIR/issue-21659-show-relevant-trait-impls-1.rs:24:8 | LL | f1.foo(1usize); | ^^^ the trait `Foo` is not implemented for `Bar` diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.rs b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.rs index 6beff6ba2a1..e898b224ed1 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.rs +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(&self, a: A) -> A { a diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr index 33804553a29..d6d5ce4d1a7 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Bar: Foo` is not satisfied - --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:38:8 + --> $DIR/issue-21659-show-relevant-trait-impls-2.rs:28:8 | LL | f1.foo(1usize); | ^^^ the trait `Foo` is not implemented for `Bar` @@ -8,7 +8,7 @@ LL | f1.foo(1usize); > > > - > + > and 2 others error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-31424.nll.stderr b/src/test/ui/did_you_mean/issue-31424.nll.stderr index fca29c9a9f6..91368dded37 100644 --- a/src/test/ui/did_you_mean/issue-31424.nll.stderr +++ b/src/test/ui/did_you_mean/issue-31424.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-31424.rs:17:9 + --> $DIR/issue-31424.rs:7:9 | LL | (&mut self).bar(); //~ ERROR cannot borrow | ^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | (&mut self).bar(); //~ ERROR cannot borrow | try removing `&mut` here warning: function cannot return without recursing - --> $DIR/issue-31424.rs:22:5 + --> $DIR/issue-31424.rs:12:5 | LL | fn bar(self: &mut Self) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -20,7 +20,7 @@ LL | (&mut self).bar(); //~ ERROR cannot borrow = help: a `loop` may express intention better if this is on purpose error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-31424.rs:24:9 + --> $DIR/issue-31424.rs:14:9 | LL | (&mut self).bar(); //~ ERROR cannot borrow | ^^^^^^^^^^^ diff --git a/src/test/ui/did_you_mean/issue-31424.rs b/src/test/ui/did_you_mean/issue-31424.rs index 903a76a8243..d321d64a312 100644 --- a/src/test/ui/did_you_mean/issue-31424.rs +++ b/src/test/ui/did_you_mean/issue-31424.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // forbid-output: &mut mut self struct Struct; diff --git a/src/test/ui/did_you_mean/issue-31424.stderr b/src/test/ui/did_you_mean/issue-31424.stderr index 2e4bcc7f959..1442666ef66 100644 --- a/src/test/ui/did_you_mean/issue-31424.stderr +++ b/src/test/ui/did_you_mean/issue-31424.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable argument `self` as mutable - --> $DIR/issue-31424.rs:17:15 + --> $DIR/issue-31424.rs:7:15 | LL | (&mut self).bar(); //~ ERROR cannot borrow | ^^^^ @@ -8,7 +8,7 @@ LL | (&mut self).bar(); //~ ERROR cannot borrow | try removing `&mut` here warning: function cannot return without recursing - --> $DIR/issue-31424.rs:22:5 + --> $DIR/issue-31424.rs:12:5 | LL | fn bar(self: &mut Self) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -20,7 +20,7 @@ LL | (&mut self).bar(); //~ ERROR cannot borrow = help: a `loop` may express intention better if this is on purpose error[E0596]: cannot borrow immutable argument `self` as mutable - --> $DIR/issue-31424.rs:24:15 + --> $DIR/issue-31424.rs:14:15 | LL | (&mut self).bar(); //~ ERROR cannot borrow | ^^^^ cannot borrow mutably diff --git a/src/test/ui/did_you_mean/issue-34126.nll.stderr b/src/test/ui/did_you_mean/issue-34126.nll.stderr index 8e29dccb8a7..ed73cca435f 100644 --- a/src/test/ui/did_you_mean/issue-34126.nll.stderr +++ b/src/test/ui/did_you_mean/issue-34126.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-34126.rs:16:18 + --> $DIR/issue-34126.rs:6:18 | LL | self.run(&mut self); //~ ERROR cannot borrow | ^^^^^^^^^ @@ -8,7 +8,7 @@ LL | self.run(&mut self); //~ ERROR cannot borrow | try removing `&mut` here error[E0502]: cannot borrow `self` as mutable because it is also borrowed as immutable - --> $DIR/issue-34126.rs:16:18 + --> $DIR/issue-34126.rs:6:18 | LL | self.run(&mut self); //~ ERROR cannot borrow | ---- --- ^^^^^^^^^ mutable borrow occurs here diff --git a/src/test/ui/did_you_mean/issue-34126.rs b/src/test/ui/did_you_mean/issue-34126.rs index 9dfb38abd04..15bef1ef815 100644 --- a/src/test/ui/did_you_mean/issue-34126.rs +++ b/src/test/ui/did_you_mean/issue-34126.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Z { } impl Z { diff --git a/src/test/ui/did_you_mean/issue-34126.stderr b/src/test/ui/did_you_mean/issue-34126.stderr index 08ece78b788..05ea4ef91ce 100644 --- a/src/test/ui/did_you_mean/issue-34126.stderr +++ b/src/test/ui/did_you_mean/issue-34126.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable argument `self` as mutable - --> $DIR/issue-34126.rs:16:23 + --> $DIR/issue-34126.rs:6:23 | LL | self.run(&mut self); //~ ERROR cannot borrow | ^^^^ diff --git a/src/test/ui/did_you_mean/issue-34337.nll.stderr b/src/test/ui/did_you_mean/issue-34337.nll.stderr index 38315a067c0..5e46889866d 100644 --- a/src/test/ui/did_you_mean/issue-34337.nll.stderr +++ b/src/test/ui/did_you_mean/issue-34337.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `key` as mutable, as it is not declared as mutable - --> $DIR/issue-34337.rs:16:9 + --> $DIR/issue-34337.rs:6:9 | LL | get(&mut key); //~ ERROR cannot borrow | ^^^^^^^^ diff --git a/src/test/ui/did_you_mean/issue-34337.rs b/src/test/ui/did_you_mean/issue-34337.rs index a426c0f48cc..bb699609b3d 100644 --- a/src/test/ui/did_you_mean/issue-34337.rs +++ b/src/test/ui/did_you_mean/issue-34337.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn get(key: &mut String) { } fn main() { diff --git a/src/test/ui/did_you_mean/issue-34337.stderr b/src/test/ui/did_you_mean/issue-34337.stderr index 7a4a03ce5d7..4bf988b72cd 100644 --- a/src/test/ui/did_you_mean/issue-34337.stderr +++ b/src/test/ui/did_you_mean/issue-34337.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `key` as mutable - --> $DIR/issue-34337.rs:16:14 + --> $DIR/issue-34337.rs:6:14 | LL | get(&mut key); //~ ERROR cannot borrow | ^^^ diff --git a/src/test/ui/did_you_mean/issue-35937.nll.stderr b/src/test/ui/did_you_mean/issue-35937.nll.stderr index 34bdf48e2a6..76fb1e22953 100644 --- a/src/test/ui/did_you_mean/issue-35937.nll.stderr +++ b/src/test/ui/did_you_mean/issue-35937.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `f.v` as mutable, as `f` is not declared as mutable - --> $DIR/issue-35937.rs:17:5 + --> $DIR/issue-35937.rs:7:5 | LL | let f = Foo { v: Vec::new() }; | - help: consider changing this to be mutable: `mut f` @@ -7,7 +7,7 @@ LL | f.v.push("cat".to_string()); //~ ERROR cannot borrow | ^^^ cannot borrow as mutable error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable - --> $DIR/issue-35937.rs:26:5 + --> $DIR/issue-35937.rs:16:5 | LL | let s = S { x: 42 }; | - help: consider changing this to be mutable: `mut s` @@ -15,7 +15,7 @@ LL | s.x += 1; //~ ERROR cannot assign | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable - --> $DIR/issue-35937.rs:30:5 + --> $DIR/issue-35937.rs:20:5 | LL | fn bar(s: S) { | - help: consider changing this to be mutable: `mut s` diff --git a/src/test/ui/did_you_mean/issue-35937.rs b/src/test/ui/did_you_mean/issue-35937.rs index 867b47cf99e..ebeba74f176 100644 --- a/src/test/ui/did_you_mean/issue-35937.rs +++ b/src/test/ui/did_you_mean/issue-35937.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { pub v: Vec } diff --git a/src/test/ui/did_you_mean/issue-35937.stderr b/src/test/ui/did_you_mean/issue-35937.stderr index 591c3a0df03..7499a9475e8 100644 --- a/src/test/ui/did_you_mean/issue-35937.stderr +++ b/src/test/ui/did_you_mean/issue-35937.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow field `f.v` of immutable binding as mutable - --> $DIR/issue-35937.rs:17:5 + --> $DIR/issue-35937.rs:7:5 | LL | let f = Foo { v: Vec::new() }; | - help: make this binding mutable: `mut f` @@ -7,7 +7,7 @@ LL | f.v.push("cat".to_string()); //~ ERROR cannot borrow | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `s.x` of immutable binding - --> $DIR/issue-35937.rs:26:5 + --> $DIR/issue-35937.rs:16:5 | LL | let s = S { x: 42 }; | - help: make this binding mutable: `mut s` @@ -15,7 +15,7 @@ LL | s.x += 1; //~ ERROR cannot assign | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `s.x` of immutable binding - --> $DIR/issue-35937.rs:30:5 + --> $DIR/issue-35937.rs:20:5 | LL | fn bar(s: S) { | - help: make this binding mutable: `mut s` diff --git a/src/test/ui/did_you_mean/issue-36798.rs b/src/test/ui/did_you_mean/issue-36798.rs index 6e641ff025c..89d71d83151 100644 --- a/src/test/ui/did_you_mean/issue-36798.rs +++ b/src/test/ui/did_you_mean/issue-36798.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { bar: u8 } diff --git a/src/test/ui/did_you_mean/issue-36798.stderr b/src/test/ui/did_you_mean/issue-36798.stderr index c0a73abdf72..8273fad4764 100644 --- a/src/test/ui/did_you_mean/issue-36798.stderr +++ b/src/test/ui/did_you_mean/issue-36798.stderr @@ -1,8 +1,8 @@ error[E0609]: no field `baz` on type `Foo` - --> $DIR/issue-36798.rs:17:7 + --> $DIR/issue-36798.rs:7:7 | LL | f.baz; //~ ERROR no field - | ^^^ did you mean `bar`? + | ^^^ help: a field with a similar name exists: `bar` error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-36798_unknown_field.rs b/src/test/ui/did_you_mean/issue-36798_unknown_field.rs index ec54a8d2b43..ef9744b4af8 100644 --- a/src/test/ui/did_you_mean/issue-36798_unknown_field.rs +++ b/src/test/ui/did_you_mean/issue-36798_unknown_field.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { bar: u8 } diff --git a/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr b/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr index 4cf0df44351..b884d8a53d3 100644 --- a/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr +++ b/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr @@ -1,5 +1,5 @@ error[E0609]: no field `zz` on type `Foo` - --> $DIR/issue-36798_unknown_field.rs:17:7 + --> $DIR/issue-36798_unknown_field.rs:7:7 | LL | f.zz; //~ ERROR no field | ^^ unknown field diff --git a/src/test/ui/did_you_mean/issue-37139.nll.stderr b/src/test/ui/did_you_mean/issue-37139.nll.stderr index 7cc7ca14638..4d1c8a6b0eb 100644 --- a/src/test/ui/did_you_mean/issue-37139.nll.stderr +++ b/src/test/ui/did_you_mean/issue-37139.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/issue-37139.rs:22:18 + --> $DIR/issue-37139.rs:12:18 | LL | test(&mut x); //~ ERROR cannot borrow immutable | ^^^^^^ diff --git a/src/test/ui/did_you_mean/issue-37139.rs b/src/test/ui/did_you_mean/issue-37139.rs index 8a1a7ce0c32..b7f419ae4a6 100644 --- a/src/test/ui/did_you_mean/issue-37139.rs +++ b/src/test/ui/did_you_mean/issue-37139.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum TestEnum { Item(i32), } diff --git a/src/test/ui/did_you_mean/issue-37139.stderr b/src/test/ui/did_you_mean/issue-37139.stderr index 7cf3326f9d6..38617fda2af 100644 --- a/src/test/ui/did_you_mean/issue-37139.stderr +++ b/src/test/ui/did_you_mean/issue-37139.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable - --> $DIR/issue-37139.rs:22:23 + --> $DIR/issue-37139.rs:12:23 | LL | test(&mut x); //~ ERROR cannot borrow immutable | ^ diff --git a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.rs b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.rs index c9c1c5d141d..a1ef68ecfe2 100644 --- a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.rs +++ b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use Foo; //~ ERROR unresolved use Foo1; //~ ERROR unresolved diff --git a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr index e3c75599a41..1f3f7c47570 100644 --- a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr +++ b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr @@ -1,11 +1,11 @@ error[E0432]: unresolved import `Foo` - --> $DIR/issue-38054-do-not-show-unresolved-names.rs:11:5 + --> $DIR/issue-38054-do-not-show-unresolved-names.rs:1:5 | LL | use Foo; //~ ERROR unresolved | ^^^ no `Foo` in the root error[E0432]: unresolved import `Foo1` - --> $DIR/issue-38054-do-not-show-unresolved-names.rs:13:5 + --> $DIR/issue-38054-do-not-show-unresolved-names.rs:3:5 | LL | use Foo1; //~ ERROR unresolved | ^^^^ no `Foo1` in the root diff --git a/src/test/ui/did_you_mean/issue-38147-1.nll.stderr b/src/test/ui/did_you_mean/issue-38147-1.nll.stderr index 25613561bba..838673b21d1 100644 --- a/src/test/ui/did_you_mean/issue-38147-1.nll.stderr +++ b/src/test/ui/did_you_mean/issue-38147-1.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference - --> $DIR/issue-38147-1.rs:27:9 + --> $DIR/issue-38147-1.rs:17:9 | LL | fn f(&self) { | ----- help: consider changing this to be a mutable reference: `&mut self` diff --git a/src/test/ui/did_you_mean/issue-38147-1.rs b/src/test/ui/did_you_mean/issue-38147-1.rs index a7ce7406566..b67239619d9 100644 --- a/src/test/ui/did_you_mean/issue-38147-1.rs +++ b/src/test/ui/did_you_mean/issue-38147-1.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Pass<'a> { s: &'a mut String } diff --git a/src/test/ui/did_you_mean/issue-38147-1.stderr b/src/test/ui/did_you_mean/issue-38147-1.stderr index 4ebb5683405..74c72edd028 100644 --- a/src/test/ui/did_you_mean/issue-38147-1.stderr +++ b/src/test/ui/did_you_mean/issue-38147-1.stderr @@ -1,5 +1,5 @@ error[E0389]: cannot borrow data mutably in a `&` reference - --> $DIR/issue-38147-1.rs:27:9 + --> $DIR/issue-38147-1.rs:17:9 | LL | fn f(&self) { | ----- use `&mut self` here to make mutable diff --git a/src/test/ui/did_you_mean/issue-38147-2.nll.stderr b/src/test/ui/did_you_mean/issue-38147-2.nll.stderr index ebd44d46eb2..cb498108931 100644 --- a/src/test/ui/did_you_mean/issue-38147-2.nll.stderr +++ b/src/test/ui/did_you_mean/issue-38147-2.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference - --> $DIR/issue-38147-2.rs:17:9 + --> $DIR/issue-38147-2.rs:7:9 | LL | s: &'a String | ---------- help: consider changing this to be mutable: `&'a mut String` diff --git a/src/test/ui/did_you_mean/issue-38147-2.rs b/src/test/ui/did_you_mean/issue-38147-2.rs index 1a24f471f08..e43ebf9d261 100644 --- a/src/test/ui/did_you_mean/issue-38147-2.rs +++ b/src/test/ui/did_you_mean/issue-38147-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Bar<'a> { s: &'a String } diff --git a/src/test/ui/did_you_mean/issue-38147-2.stderr b/src/test/ui/did_you_mean/issue-38147-2.stderr index 31433cf83c3..fa4fccb8d27 100644 --- a/src/test/ui/did_you_mean/issue-38147-2.stderr +++ b/src/test/ui/did_you_mean/issue-38147-2.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow borrowed content `*self.s` of immutable binding as mutable - --> $DIR/issue-38147-2.rs:17:9 + --> $DIR/issue-38147-2.rs:7:9 | LL | s: &'a String | ---------- use `&'a mut String` here to make mutable diff --git a/src/test/ui/did_you_mean/issue-38147-3.nll.stderr b/src/test/ui/did_you_mean/issue-38147-3.nll.stderr index d644a84c7bb..67782578a2c 100644 --- a/src/test/ui/did_you_mean/issue-38147-3.nll.stderr +++ b/src/test/ui/did_you_mean/issue-38147-3.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference - --> $DIR/issue-38147-3.rs:17:9 + --> $DIR/issue-38147-3.rs:7:9 | LL | s: &'a String | ---------- help: consider changing this to be mutable: `&'a mut String` diff --git a/src/test/ui/did_you_mean/issue-38147-3.rs b/src/test/ui/did_you_mean/issue-38147-3.rs index 5e2bf06e5d9..4cd703f2f61 100644 --- a/src/test/ui/did_you_mean/issue-38147-3.rs +++ b/src/test/ui/did_you_mean/issue-38147-3.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Qux<'a> { s: &'a String } diff --git a/src/test/ui/did_you_mean/issue-38147-3.stderr b/src/test/ui/did_you_mean/issue-38147-3.stderr index 8bb23acdc40..2cb9835278d 100644 --- a/src/test/ui/did_you_mean/issue-38147-3.stderr +++ b/src/test/ui/did_you_mean/issue-38147-3.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow borrowed content `*self.s` of immutable binding as mutable - --> $DIR/issue-38147-3.rs:17:9 + --> $DIR/issue-38147-3.rs:7:9 | LL | s: &'a String | ---------- use `&'a mut String` here to make mutable diff --git a/src/test/ui/did_you_mean/issue-38147-4.nll.stderr b/src/test/ui/did_you_mean/issue-38147-4.nll.stderr index eccbe19ac94..458e41f6aae 100644 --- a/src/test/ui/did_you_mean/issue-38147-4.nll.stderr +++ b/src/test/ui/did_you_mean/issue-38147-4.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*f.s` as mutable, as it is behind a `&` reference - --> $DIR/issue-38147-4.rs:16:5 + --> $DIR/issue-38147-4.rs:6:5 | LL | fn f(x: usize, f: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut Foo<'_>` diff --git a/src/test/ui/did_you_mean/issue-38147-4.rs b/src/test/ui/did_you_mean/issue-38147-4.rs index 49a8f2b6ff6..26573d4fdde 100644 --- a/src/test/ui/did_you_mean/issue-38147-4.rs +++ b/src/test/ui/did_you_mean/issue-38147-4.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'a> { s: &'a mut String } diff --git a/src/test/ui/did_you_mean/issue-38147-4.stderr b/src/test/ui/did_you_mean/issue-38147-4.stderr index e78cea14a7b..6dc4f101084 100644 --- a/src/test/ui/did_you_mean/issue-38147-4.stderr +++ b/src/test/ui/did_you_mean/issue-38147-4.stderr @@ -1,5 +1,5 @@ error[E0389]: cannot borrow data mutably in a `&` reference - --> $DIR/issue-38147-4.rs:16:5 + --> $DIR/issue-38147-4.rs:6:5 | LL | fn f(x: usize, f: &Foo) { | ---- use `&mut Foo` here to make mutable diff --git a/src/test/ui/did_you_mean/issue-39544.nll.stderr b/src/test/ui/did_you_mean/issue-39544.nll.stderr index 8c848b33241..2fb8e3db68c 100644 --- a/src/test/ui/did_you_mean/issue-39544.nll.stderr +++ b/src/test/ui/did_you_mean/issue-39544.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable - --> $DIR/issue-39544.rs:21:13 + --> $DIR/issue-39544.rs:11:13 | LL | let z = Z { x: X::Y }; | - help: consider changing this to be mutable: `mut z` @@ -7,7 +7,7 @@ LL | let _ = &mut z.x; //~ ERROR cannot borrow | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference - --> $DIR/issue-39544.rs:26:17 + --> $DIR/issue-39544.rs:16:17 | LL | fn foo<'z>(&'z self) { | -------- help: consider changing this to be a mutable reference: `&'z mut self` @@ -15,7 +15,7 @@ LL | let _ = &mut self.x; //~ ERROR cannot borrow | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference - --> $DIR/issue-39544.rs:30:17 + --> $DIR/issue-39544.rs:20:17 | LL | fn foo1(&self, other: &Z) { | ----- help: consider changing this to be a mutable reference: `&mut self` @@ -23,7 +23,7 @@ LL | let _ = &mut self.x; //~ ERROR cannot borrow | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference - --> $DIR/issue-39544.rs:31:17 + --> $DIR/issue-39544.rs:21:17 | LL | fn foo1(&self, other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` @@ -32,7 +32,7 @@ LL | let _ = &mut other.x; //~ ERROR cannot borrow | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference - --> $DIR/issue-39544.rs:35:17 + --> $DIR/issue-39544.rs:25:17 | LL | fn foo2<'a>(&'a self, other: &Z) { | -------- help: consider changing this to be a mutable reference: `&'a mut self` @@ -40,7 +40,7 @@ LL | let _ = &mut self.x; //~ ERROR cannot borrow | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference - --> $DIR/issue-39544.rs:36:17 + --> $DIR/issue-39544.rs:26:17 | LL | fn foo2<'a>(&'a self, other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` @@ -49,7 +49,7 @@ LL | let _ = &mut other.x; //~ ERROR cannot borrow | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference - --> $DIR/issue-39544.rs:40:17 + --> $DIR/issue-39544.rs:30:17 | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -------- help: consider changing this to be a mutable reference: `&'a mut Self` @@ -57,7 +57,7 @@ LL | let _ = &mut self.x; //~ ERROR cannot borrow | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference - --> $DIR/issue-39544.rs:41:17 + --> $DIR/issue-39544.rs:31:17 | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` @@ -66,7 +66,7 @@ LL | let _ = &mut other.x; //~ ERROR cannot borrow | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference - --> $DIR/issue-39544.rs:45:17 + --> $DIR/issue-39544.rs:35:17 | LL | fn foo4(other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` @@ -74,7 +74,7 @@ LL | let _ = &mut other.x; //~ ERROR cannot borrow | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable - --> $DIR/issue-39544.rs:51:13 + --> $DIR/issue-39544.rs:41:13 | LL | pub fn with_arg(z: Z, w: &Z) { | - help: consider changing this to be mutable: `mut z` @@ -82,7 +82,7 @@ LL | let _ = &mut z.x; //~ ERROR cannot borrow | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `w.x` as mutable, as it is behind a `&` reference - --> $DIR/issue-39544.rs:52:13 + --> $DIR/issue-39544.rs:42:13 | LL | pub fn with_arg(z: Z, w: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` @@ -91,7 +91,7 @@ LL | let _ = &mut w.x; //~ ERROR cannot borrow | ^^^^^^^^ `w` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0594]: cannot assign to `*x.0` which is behind a `&` reference - --> $DIR/issue-39544.rs:58:5 + --> $DIR/issue-39544.rs:48:5 | LL | *x.0 = 1; | ^^^^^^^^ cannot assign diff --git a/src/test/ui/did_you_mean/issue-39544.rs b/src/test/ui/did_you_mean/issue-39544.rs index 205cbce7094..89696a06aaa 100644 --- a/src/test/ui/did_you_mean/issue-39544.rs +++ b/src/test/ui/did_you_mean/issue-39544.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum X { Y } diff --git a/src/test/ui/did_you_mean/issue-39544.stderr b/src/test/ui/did_you_mean/issue-39544.stderr index 7cf2ca720ef..7d6a672843a 100644 --- a/src/test/ui/did_you_mean/issue-39544.stderr +++ b/src/test/ui/did_you_mean/issue-39544.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow field `z.x` of immutable binding as mutable - --> $DIR/issue-39544.rs:21:18 + --> $DIR/issue-39544.rs:11:18 | LL | let z = Z { x: X::Y }; | - help: make this binding mutable: `mut z` @@ -7,7 +7,7 @@ LL | let _ = &mut z.x; //~ ERROR cannot borrow | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `self.x` of immutable binding as mutable - --> $DIR/issue-39544.rs:26:22 + --> $DIR/issue-39544.rs:16:22 | LL | fn foo<'z>(&'z self) { | -------- use `&'z mut self` here to make mutable @@ -15,7 +15,7 @@ LL | let _ = &mut self.x; //~ ERROR cannot borrow | ^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `self.x` of immutable binding as mutable - --> $DIR/issue-39544.rs:30:22 + --> $DIR/issue-39544.rs:20:22 | LL | fn foo1(&self, other: &Z) { | ----- use `&mut self` here to make mutable @@ -23,7 +23,7 @@ LL | let _ = &mut self.x; //~ ERROR cannot borrow | ^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `other.x` of immutable binding as mutable - --> $DIR/issue-39544.rs:31:22 + --> $DIR/issue-39544.rs:21:22 | LL | fn foo1(&self, other: &Z) { | -- use `&mut Z` here to make mutable @@ -32,7 +32,7 @@ LL | let _ = &mut other.x; //~ ERROR cannot borrow | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `self.x` of immutable binding as mutable - --> $DIR/issue-39544.rs:35:22 + --> $DIR/issue-39544.rs:25:22 | LL | fn foo2<'a>(&'a self, other: &Z) { | -------- use `&'a mut self` here to make mutable @@ -40,7 +40,7 @@ LL | let _ = &mut self.x; //~ ERROR cannot borrow | ^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `other.x` of immutable binding as mutable - --> $DIR/issue-39544.rs:36:22 + --> $DIR/issue-39544.rs:26:22 | LL | fn foo2<'a>(&'a self, other: &Z) { | -- use `&mut Z` here to make mutable @@ -49,7 +49,7 @@ LL | let _ = &mut other.x; //~ ERROR cannot borrow | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `self.x` of immutable binding as mutable - --> $DIR/issue-39544.rs:40:22 + --> $DIR/issue-39544.rs:30:22 | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -------- use `&'a mut Self` here to make mutable @@ -57,7 +57,7 @@ LL | let _ = &mut self.x; //~ ERROR cannot borrow | ^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `other.x` of immutable binding as mutable - --> $DIR/issue-39544.rs:41:22 + --> $DIR/issue-39544.rs:31:22 | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -- use `&mut Z` here to make mutable @@ -66,7 +66,7 @@ LL | let _ = &mut other.x; //~ ERROR cannot borrow | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `other.x` of immutable binding as mutable - --> $DIR/issue-39544.rs:45:22 + --> $DIR/issue-39544.rs:35:22 | LL | fn foo4(other: &Z) { | -- use `&mut Z` here to make mutable @@ -74,7 +74,7 @@ LL | let _ = &mut other.x; //~ ERROR cannot borrow | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `z.x` of immutable binding as mutable - --> $DIR/issue-39544.rs:51:18 + --> $DIR/issue-39544.rs:41:18 | LL | pub fn with_arg(z: Z, w: &Z) { | - help: make this binding mutable: `mut z` @@ -82,7 +82,7 @@ LL | let _ = &mut z.x; //~ ERROR cannot borrow | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `w.x` of immutable binding as mutable - --> $DIR/issue-39544.rs:52:18 + --> $DIR/issue-39544.rs:42:18 | LL | pub fn with_arg(z: Z, w: &Z) { | -- use `&mut Z` here to make mutable @@ -91,7 +91,7 @@ LL | let _ = &mut w.x; //~ ERROR cannot borrow | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to borrowed content `*x.0` of immutable binding - --> $DIR/issue-39544.rs:58:5 + --> $DIR/issue-39544.rs:48:5 | LL | *x.0 = 1; | ^^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.rs b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.rs index 660aedc3596..63a8c547c6f 100644 --- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.rs +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn bar(&self){} } diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr index 3b08fcf0df1..3411958be62 100644 --- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `i8: Foo` is not satisfied - --> $DIR/issue-39802-show-5-trait-impls.rs:34:5 + --> $DIR/issue-39802-show-5-trait-impls.rs:24:5 | LL | Foo::::bar(&1i8); //~ ERROR is not satisfied | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i8` @@ -11,13 +11,13 @@ LL | Foo::::bar(&1i8); //~ ERROR is not satisfied > > note: required by `Foo::bar` - --> $DIR/issue-39802-show-5-trait-impls.rs:12:5 + --> $DIR/issue-39802-show-5-trait-impls.rs:2:5 | LL | fn bar(&self){} | ^^^^^^^^^^^^^ error[E0277]: the trait bound `u8: Foo` is not satisfied - --> $DIR/issue-39802-show-5-trait-impls.rs:35:5 + --> $DIR/issue-39802-show-5-trait-impls.rs:25:5 | LL | Foo::::bar(&1u8); //~ ERROR is not satisfied | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u8` @@ -28,25 +28,25 @@ LL | Foo::::bar(&1u8); //~ ERROR is not satisfied > > note: required by `Foo::bar` - --> $DIR/issue-39802-show-5-trait-impls.rs:12:5 + --> $DIR/issue-39802-show-5-trait-impls.rs:2:5 | LL | fn bar(&self){} | ^^^^^^^^^^^^^ error[E0277]: the trait bound `bool: Foo` is not satisfied - --> $DIR/issue-39802-show-5-trait-impls.rs:36:5 + --> $DIR/issue-39802-show-5-trait-impls.rs:26:5 | LL | Foo::::bar(&true); //~ ERROR is not satisfied | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `bool` | = help: the following implementations were found: + > + > > > - > - > and 2 others note: required by `Foo::bar` - --> $DIR/issue-39802-show-5-trait-impls.rs:12:5 + --> $DIR/issue-39802-show-5-trait-impls.rs:2:5 | LL | fn bar(&self){} | ^^^^^^^^^^^^^ diff --git a/src/test/ui/did_you_mean/issue-40006.rs b/src/test/ui/did_you_mean/issue-40006.rs index 62316b96db0..75ea02b6a9d 100644 --- a/src/test/ui/did_you_mean/issue-40006.rs +++ b/src/test/ui/did_you_mean/issue-40006.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - impl X { //~ ERROR cannot be made into an object //~^ ERROR missing Y diff --git a/src/test/ui/did_you_mean/issue-40006.stderr b/src/test/ui/did_you_mean/issue-40006.stderr index d3ce2cf12f2..1b9eecb7769 100644 --- a/src/test/ui/did_you_mean/issue-40006.stderr +++ b/src/test/ui/did_you_mean/issue-40006.stderr @@ -1,5 +1,5 @@ error: missing `fn`, `type`, or `const` for impl-item declaration - --> $DIR/issue-40006.rs:11:9 + --> $DIR/issue-40006.rs:1:9 | LL | impl X { //~ ERROR cannot be made into an object | _________^ @@ -8,7 +8,7 @@ LL | | Y | |____^ missing `fn`, `type`, or `const` error: missing `fn`, `type`, or `const` for trait-item declaration - --> $DIR/issue-40006.rs:18:10 + --> $DIR/issue-40006.rs:8:10 | LL | trait X { //~ ERROR missing | __________^ @@ -16,13 +16,13 @@ LL | | X() {} | |____^ missing `fn`, `type`, or `const` error: expected `[`, found `#` - --> $DIR/issue-40006.rs:20:17 + --> $DIR/issue-40006.rs:10:17 | LL | fn xxx() { ### } //~ ERROR missing | ^ expected `[` error: missing `fn`, `type`, or `const` for trait-item declaration - --> $DIR/issue-40006.rs:20:21 + --> $DIR/issue-40006.rs:10:21 | LL | fn xxx() { ### } //~ ERROR missing | _____________________^ @@ -31,7 +31,7 @@ LL | | L = M; //~ ERROR missing | |____^ missing `fn`, `type`, or `const` error: missing `fn`, `type`, or `const` for trait-item declaration - --> $DIR/issue-40006.rs:22:11 + --> $DIR/issue-40006.rs:12:11 | LL | L = M; //~ ERROR missing | ___________^ @@ -39,25 +39,25 @@ LL | | Z = { 2 + 3 }; //~ ERROR expected one of | |____^ missing `fn`, `type`, or `const` error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;` - --> $DIR/issue-40006.rs:23:18 + --> $DIR/issue-40006.rs:13:18 | LL | Z = { 2 + 3 }; //~ ERROR expected one of | ^ expected one of 7 possible tokens here error: expected one of `!` or `::`, found `(` - --> $DIR/issue-40006.rs:24:9 + --> $DIR/issue-40006.rs:14:9 | LL | ::Y (); //~ ERROR expected one of | ^ expected one of `!` or `::` here error: missing `fn`, `type`, or `const` for impl-item declaration - --> $DIR/issue-40006.rs:28:8 + --> $DIR/issue-40006.rs:18:8 | LL | pub hello_method(&self) { //~ ERROR missing | ^ missing `fn`, `type`, or `const` error[E0038]: the trait `X` cannot be made into an object - --> $DIR/issue-40006.rs:11:6 + --> $DIR/issue-40006.rs:1:6 | LL | impl X { //~ ERROR cannot be made into an object | ^ the trait `X` cannot be made into an object diff --git a/src/test/ui/did_you_mean/issue-40396.rs b/src/test/ui/did_you_mean/issue-40396.rs index eb62dc54084..63eec50c2d2 100644 --- a/src/test/ui/did_you_mean/issue-40396.rs +++ b/src/test/ui/did_you_mean/issue-40396.rs @@ -1,24 +1,27 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() { - println!("{:?}", (0..13).collect>()); //~ ERROR chained comparison + (0..13).collect>(); + //~^ ERROR chained comparison + //~| ERROR expected value, found struct `Vec` + //~| ERROR expected value, found builtin type `i32` + //~| ERROR attempted to take value of method `collect` } fn bar() { - println!("{:?}", Vec::new()); //~ ERROR chained comparison + Vec::new(); + //~^ ERROR chained comparison + //~| ERROR expected value, found struct `Vec` + //~| ERROR expected value, found builtin type `i32` + //~| ERROR cannot find function `new` in the crate root } fn qux() { - println!("{:?}", (0..13).collect()); //~ ERROR chained comparison + (0..13).collect(); //~^ ERROR chained comparison + //~| ERROR chained comparison + //~| ERROR expected value, found struct `Vec` + //~| ERROR expected value, found builtin type `i32` + //~| ERROR attempted to take value of method `collect` + //~| ERROR mismatched types } fn main() {} diff --git a/src/test/ui/did_you_mean/issue-40396.stderr b/src/test/ui/did_you_mean/issue-40396.stderr index 219fd45665a..86bbf2bf27a 100644 --- a/src/test/ui/did_you_mean/issue-40396.stderr +++ b/src/test/ui/did_you_mean/issue-40396.stderr @@ -1,38 +1,103 @@ error: chained comparison operators require parentheses - --> $DIR/issue-40396.rs:12:37 + --> $DIR/issue-40396.rs:2:20 | -LL | println!("{:?}", (0..13).collect>()); //~ ERROR chained comparison - | ^^^^^^^^ +LL | (0..13).collect>(); + | ^^^^^^^^ | = help: use `::<...>` instead of `<...>` if you meant to specify type arguments = help: or use `(...)` if you meant to specify fn arguments error: chained comparison operators require parentheses - --> $DIR/issue-40396.rs:16:25 + --> $DIR/issue-40396.rs:10:8 | -LL | println!("{:?}", Vec::new()); //~ ERROR chained comparison - | ^^^^^^^ +LL | Vec::new(); + | ^^^^^^^ | = help: use `::<...>` instead of `<...>` if you meant to specify type arguments = help: or use `(...)` if you meant to specify fn arguments error: chained comparison operators require parentheses - --> $DIR/issue-40396.rs:20:37 + --> $DIR/issue-40396.rs:18:20 | -LL | println!("{:?}", (0..13).collect()); //~ ERROR chained comparison - | ^^^^^^^^ +LL | (0..13).collect(); + | ^^^^^^^^ | = help: use `::<...>` instead of `<...>` if you meant to specify type arguments = help: or use `(...)` if you meant to specify fn arguments error: chained comparison operators require parentheses - --> $DIR/issue-40396.rs:20:41 + --> $DIR/issue-40396.rs:18:24 | -LL | println!("{:?}", (0..13).collect()); //~ ERROR chained comparison - | ^^^^^^ +LL | (0..13).collect(); + | ^^^^^^ | = help: use `::<...>` instead of `<...>` if you meant to specify type arguments = help: or use `(...)` if you meant to specify fn arguments -error: aborting due to 4 previous errors +error[E0423]: expected value, found struct `Vec` + --> $DIR/issue-40396.rs:2:21 + | +LL | (0..13).collect>(); + | ^^^ did you mean `Vec { /* fields */ }`? + +error[E0423]: expected value, found builtin type `i32` + --> $DIR/issue-40396.rs:2:25 + | +LL | (0..13).collect>(); + | ^^^ not a value + +error[E0423]: expected value, found struct `Vec` + --> $DIR/issue-40396.rs:10:5 + | +LL | Vec::new(); + | ^^^ did you mean `Vec { /* fields */ }`? + +error[E0423]: expected value, found builtin type `i32` + --> $DIR/issue-40396.rs:10:9 + | +LL | Vec::new(); + | ^^^ not a value + +error[E0425]: cannot find function `new` in the crate root + --> $DIR/issue-40396.rs:10:15 + | +LL | Vec::new(); + | ^^^ not found in the crate root + +error[E0423]: expected value, found struct `Vec` + --> $DIR/issue-40396.rs:18:21 + | +LL | (0..13).collect(); + | ^^^ did you mean `Vec { /* fields */ }`? + +error[E0423]: expected value, found builtin type `i32` + --> $DIR/issue-40396.rs:18:25 + | +LL | (0..13).collect(); + | ^^^ not a value + +error[E0615]: attempted to take value of method `collect` on type `std::ops::Range<{integer}>` + --> $DIR/issue-40396.rs:2:13 + | +LL | (0..13).collect>(); + | ^^^^^^^ help: use parentheses to call the method: `collect()` + +error[E0615]: attempted to take value of method `collect` on type `std::ops::Range<{integer}>` + --> $DIR/issue-40396.rs:18:13 + | +LL | (0..13).collect(); + | ^^^^^^^ help: use parentheses to call the method: `collect()` + +error[E0308]: mismatched types + --> $DIR/issue-40396.rs:18:29 + | +LL | (0..13).collect(); + | ^^ expected bool, found () + | + = note: expected type `bool` + found type `()` + +error: aborting due to 14 previous errors +Some errors occurred: E0308, E0423, E0425, E0615. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/did_you_mean/issue-40823.nll.stderr b/src/test/ui/did_you_mean/issue-40823.nll.stderr index 44ae058cc28..0389cf5499d 100644 --- a/src/test/ui/did_you_mean/issue-40823.nll.stderr +++ b/src/test/ui/did_you_mean/issue-40823.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*buf` as mutable, as it is behind a `&` reference - --> $DIR/issue-40823.rs:13:5 + --> $DIR/issue-40823.rs:3:5 | LL | let mut buf = &[1, 2, 3, 4]; | ------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4]` diff --git a/src/test/ui/did_you_mean/issue-40823.rs b/src/test/ui/did_you_mean/issue-40823.rs index 3b48cef1902..7e456a354b3 100644 --- a/src/test/ui/did_you_mean/issue-40823.rs +++ b/src/test/ui/did_you_mean/issue-40823.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let mut buf = &[1, 2, 3, 4]; buf.iter_mut(); //~ ERROR cannot borrow immutable borrowed content diff --git a/src/test/ui/did_you_mean/issue-40823.stderr b/src/test/ui/did_you_mean/issue-40823.stderr index 20e95513ec2..ee64e79ead9 100644 --- a/src/test/ui/did_you_mean/issue-40823.stderr +++ b/src/test/ui/did_you_mean/issue-40823.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable borrowed content `*buf` as mutable - --> $DIR/issue-40823.rs:13:5 + --> $DIR/issue-40823.rs:3:5 | LL | buf.iter_mut(); //~ ERROR cannot borrow immutable borrowed content | ^^^ cannot borrow as mutable diff --git a/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.rs b/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.rs index e8fd248011c..b59fe423025 100644 --- a/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.rs +++ b/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = ~1; //~ ERROR cannot be used as a unary operator } diff --git a/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr b/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr index f13f15f6377..d2d9abee22c 100644 --- a/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr +++ b/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr @@ -1,5 +1,5 @@ error: `~` cannot be used as a unary operator - --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:12:13 + --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:2:13 | LL | let x = ~1; //~ ERROR cannot be used as a unary operator | ^ help: use `!` to perform bitwise negation diff --git a/src/test/ui/did_you_mean/issue-42599_available_fields_note.rs b/src/test/ui/did_you_mean/issue-42599_available_fields_note.rs index ad5bedcefc2..c377dfc126a 100644 --- a/src/test/ui/did_you_mean/issue-42599_available_fields_note.rs +++ b/src/test/ui/did_you_mean/issue-42599_available_fields_note.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod submodule { #[derive(Default)] diff --git a/src/test/ui/did_you_mean/issue-42599_available_fields_note.stderr b/src/test/ui/did_you_mean/issue-42599_available_fields_note.stderr index c4b282bde52..e5dd61c45d6 100644 --- a/src/test/ui/did_you_mean/issue-42599_available_fields_note.stderr +++ b/src/test/ui/did_you_mean/issue-42599_available_fields_note.stderr @@ -1,11 +1,11 @@ error[E0560]: struct `submodule::Demo` has no field named `inocently_mispellable` - --> $DIR/issue-42599_available_fields_note.rs:26:39 + --> $DIR/issue-42599_available_fields_note.rs:16:39 | LL | Self { secret_integer: 2, inocently_mispellable: () } - | ^^^^^^^^^^^^^^^^^^^^^ field does not exist - did you mean `innocently_misspellable`? + | ^^^^^^^^^^^^^^^^^^^^^ help: a field with a similar name exists: `innocently_misspellable` error[E0560]: struct `submodule::Demo` has no field named `egregiously_nonexistent_field` - --> $DIR/issue-42599_available_fields_note.rs:31:39 + --> $DIR/issue-42599_available_fields_note.rs:21:39 | LL | Self { secret_integer: 3, egregiously_nonexistent_field: () } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `submodule::Demo` does not have this field @@ -13,13 +13,13 @@ LL | Self { secret_integer: 3, egregiously_nonexistent_field: () } = note: available fields are: `favorite_integer`, `secret_integer`, `innocently_misspellable`, `another_field`, `yet_another_field` ... and 2 others error[E0609]: no field `inocently_mispellable` on type `submodule::Demo` - --> $DIR/issue-42599_available_fields_note.rs:42:41 + --> $DIR/issue-42599_available_fields_note.rs:32:41 | LL | let innocent_field_misaccess = demo.inocently_mispellable; - | ^^^^^^^^^^^^^^^^^^^^^ did you mean `innocently_misspellable`? + | ^^^^^^^^^^^^^^^^^^^^^ help: a field with a similar name exists: `innocently_misspellable` error[E0609]: no field `egregiously_nonexistent_field` on type `submodule::Demo` - --> $DIR/issue-42599_available_fields_note.rs:45:42 + --> $DIR/issue-42599_available_fields_note.rs:35:42 | LL | let egregious_field_misaccess = demo.egregiously_nonexistent_field; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown field diff --git a/src/test/ui/did_you_mean/issue-42764.rs b/src/test/ui/did_you_mean/issue-42764.rs index 1c79499ba59..5dd70aade67 100644 --- a/src/test/ui/did_you_mean/issue-42764.rs +++ b/src/test/ui/did_you_mean/issue-42764.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum DoubleOption { FirstSome(T), AlternativeSome(T), diff --git a/src/test/ui/did_you_mean/issue-42764.stderr b/src/test/ui/did_you_mean/issue-42764.stderr index e256a436aff..64868c414ef 100644 --- a/src/test/ui/did_you_mean/issue-42764.stderr +++ b/src/test/ui/did_you_mean/issue-42764.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-42764.rs:21:43 + --> $DIR/issue-42764.rs:11:43 | LL | this_function_expects_a_double_option(n); | ^ expected enum `DoubleOption`, found usize @@ -14,7 +14,7 @@ LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/issue-42764.rs:37:33 + --> $DIR/issue-42764.rs:27:33 | LL | let _c = Context { wrapper: Payload{} }; | ^^^^^^^^^ expected struct `Wrapper`, found struct `Payload` diff --git a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs index 7b877523e35..f5dbab1ef35 100644 --- a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs +++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Example { Ex(String), NotEx } fn result_test() { diff --git a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr index 779ae31ca30..e6d10ffaae9 100644 --- a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr +++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr @@ -1,5 +1,5 @@ error[E0423]: expected function, found enum `Option` - --> $DIR/issue-43871-enum-instead-of-variant.rs:14:13 + --> $DIR/issue-43871-enum-instead-of-variant.rs:4:13 | LL | let x = Option(1); //~ ERROR expected function, found enum | ^^^^^^ @@ -9,7 +9,7 @@ LL | let x = Option(1); //~ ERROR expected function, found enum - `std::prelude::v1::Option::Some` error[E0532]: expected tuple struct/variant, found enum `Option` - --> $DIR/issue-43871-enum-instead-of-variant.rs:16:12 + --> $DIR/issue-43871-enum-instead-of-variant.rs:6:12 | LL | if let Option(_) = x { //~ ERROR expected tuple struct/variant, found enum | ^^^^^^ @@ -19,7 +19,7 @@ LL | if let Option(_) = x { //~ ERROR expected tuple struct/variant, found e - `std::prelude::v1::Option::Some` error[E0532]: expected tuple struct/variant, found enum `Example` - --> $DIR/issue-43871-enum-instead-of-variant.rs:22:12 + --> $DIR/issue-43871-enum-instead-of-variant.rs:12:12 | LL | if let Example(_) = y { //~ ERROR expected tuple struct/variant, found enum | ^^^^^^^ diff --git a/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.rs b/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.rs index 0d3ac8740e2..63e8b2ba002 100644 --- a/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.rs +++ b/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] struct PersonalityInventory { diff --git a/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr b/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr index d73e6287f12..bfe1ed32859 100644 --- a/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr +++ b/src/test/ui/did_you_mean/issue-46718-struct-pattern-dotdotdot.stderr @@ -1,5 +1,5 @@ error: expected field pattern, found `...` - --> $DIR/issue-46718-struct-pattern-dotdotdot.rs:21:55 + --> $DIR/issue-46718-struct-pattern-dotdotdot.rs:11:55 | LL | PersonalityInventory { expressivity: exp, ... } => exp | ^^^ help: to omit remaining fields, use one fewer `.`: `..` diff --git a/src/test/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.rs b/src/test/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.rs index 45265173419..df697ccb616 100644 --- a/src/test/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.rs +++ b/src/test/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn gratitude() { let for_you = false; if not for_you { diff --git a/src/test/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr b/src/test/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr index 8b6e34c585f..f1c93d54637 100644 --- a/src/test/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr +++ b/src/test/ui/did_you_mean/issue-46836-identifier-not-instead-of-negation.stderr @@ -1,5 +1,5 @@ error: unexpected `for_you` after identifier - --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:13:12 + --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:3:12 | LL | if not for_you { | ----^^^^^^^ @@ -7,7 +7,7 @@ LL | if not for_you { | help: use `!` to perform logical negation error: unexpected `the_worst` after identifier - --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:21:15 + --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:11:15 | LL | while not the_worst { | ----^^^^^^^^^ @@ -15,7 +15,7 @@ LL | while not the_worst { | help: use `!` to perform logical negation error: unexpected `println` after identifier - --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:30:9 + --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:20:9 | LL | if not // lack of braces is [sic] | ----- help: use `!` to perform logical negation @@ -23,7 +23,7 @@ LL | println!("Then when?"); | ^^^^^^^ error: expected `{`, found `;` - --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:30:31 + --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:20:31 | LL | if not // lack of braces is [sic] | -- this `if` statement has a condition, but no block @@ -31,7 +31,7 @@ LL | println!("Then when?"); | ^ expected `{` error: unexpected `2` after identifier - --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:36:24 + --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:26:24 | LL | let resource = not 2; | ----^ @@ -39,7 +39,7 @@ LL | let resource = not 2; | help: use `!` to perform logical negation error: unexpected `be_smothered_out_before` after identifier - --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:42:27 + --> $DIR/issue-46836-identifier-not-instead-of-negation.rs:32:27 | LL | let young_souls = not be_smothered_out_before; | ----^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs index 7bdaaddad84..43b5f6d5431 100644 --- a/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs +++ b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] #[derive(Copy, Clone)] diff --git a/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr index db3f93af444..8099c3c0584 100644 --- a/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr +++ b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr @@ -1,38 +1,86 @@ error: unexpected `,` in pattern - --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:48:17 + --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:38:17 | LL | while let b1, b2, b3 = reading_frame.next().expect("there should be a start codon") { - | --^------- help: try adding parentheses: `(b1, b2, b3)` + | ^ +help: try adding parentheses to match on a tuple.. + | +LL | while let (b1, b2, b3) = reading_frame.next().expect("there should be a start codon") { + | ^^^^^^^^^^^^ +help: ..or a vertical bar to match on multiple alternatives + | +LL | while let b1 | b2 | b3 = reading_frame.next().expect("there should be a start codon") { + | ^^^^^^^^^^^^ error: unexpected `,` in pattern - --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:59:14 + --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:49:14 | LL | if let b1, b2, b3 = reading_frame.next().unwrap() { - | --^------- help: try adding parentheses: `(b1, b2, b3)` + | ^ +help: try adding parentheses to match on a tuple.. + | +LL | if let (b1, b2, b3) = reading_frame.next().unwrap() { + | ^^^^^^^^^^^^ +help: ..or a vertical bar to match on multiple alternatives + | +LL | if let b1 | b2 | b3 = reading_frame.next().unwrap() { + | ^^^^^^^^^^^^ error: unexpected `,` in pattern - --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:69:28 + --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:59:28 | LL | Nucleotide::Adenine, Nucleotide::Cytosine, _ => true - | -------------------^------------------------ help: try adding parentheses: `(Nucleotide::Adenine, Nucleotide::Cytosine, _)` + | ^ +help: try adding parentheses to match on a tuple.. + | +LL | (Nucleotide::Adenine, Nucleotide::Cytosine, _) => true + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: ..or a vertical bar to match on multiple alternatives + | +LL | Nucleotide::Adenine | Nucleotide::Cytosine | _ => true + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: unexpected `,` in pattern - --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:77:10 + --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:67:10 | LL | for x, _barr_body in women.iter().map(|woman| woman.allosomes.clone()) { - | -^----------- help: try adding parentheses: `(x, _barr_body)` + | ^ +help: try adding parentheses to match on a tuple.. + | +LL | for (x, _barr_body) in women.iter().map(|woman| woman.allosomes.clone()) { + | ^^^^^^^^^^^^^^^ +help: ..or a vertical bar to match on multiple alternatives + | +LL | for x | _barr_body in women.iter().map(|woman| woman.allosomes.clone()) { + | ^^^^^^^^^^^^^^ error: unexpected `,` in pattern - --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:85:10 + --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:75:10 | LL | for x, y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) { - | -^------------------- help: try adding parentheses: `(x, y @ Allosome::Y(_))` + | ^ +help: try adding parentheses to match on a tuple.. + | +LL | for (x, y @ Allosome::Y(_)) in men.iter().map(|man| man.allosomes.clone()) { + | ^^^^^^^^^^^^^^^^^^^^^^^ +help: ..or a vertical bar to match on multiple alternatives + | +LL | for x | y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) { + | ^^^^^^^^^^^^^^^^^^^^^^ error: unexpected `,` in pattern - --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:94:14 + --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:84:14 | LL | let women, men: (Vec, Vec) = genomes.iter().cloned() - | -----^---- help: try adding parentheses: `(women, men)` + | ^ +help: try adding parentheses to match on a tuple.. + | +LL | let (women, men): (Vec, Vec) = genomes.iter().cloned() + | ^^^^^^^^^^^^ +help: ..or a vertical bar to match on multiple alternatives + | +LL | let women | men: (Vec, Vec) = genomes.iter().cloned() + | ^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.rs b/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.rs index 9daf9df6955..b4795e76c98 100644 --- a/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.rs +++ b/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹⋅s⁻² //~^ ERROR expected at least one digit in exponent diff --git a/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr b/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr index b387472e0e7..253deb2be6e 100644 --- a/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr +++ b/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr @@ -1,5 +1,5 @@ error: expected at least one digit in exponent - --> $DIR/issue-49746-unicode-confusable-in-float-literal-expt.rs:11:53 + --> $DIR/issue-49746-unicode-confusable-in-float-literal-expt.rs:1:53 | LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹⋅s⁻² | ^ diff --git a/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.rs b/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.rs index 243e3a65f39..73f1856ca1d 100644 --- a/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.rs +++ b/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let sixteen: f32 = 16; //~^ ERROR mismatched types diff --git a/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.stderr b/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.stderr index caaa9541417..301704ec0c7 100644 --- a/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.stderr +++ b/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.stderr @@ -1,53 +1,53 @@ error[E0308]: mismatched types - --> $DIR/issue-53280-expected-float-found-integer-literal.rs:12:24 + --> $DIR/issue-53280-expected-float-found-integer-literal.rs:2:24 | LL | let sixteen: f32 = 16; | ^^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `16.0` | = note: expected type `f32` found type `{integer}` error[E0308]: mismatched types - --> $DIR/issue-53280-expected-float-found-integer-literal.rs:15:38 + --> $DIR/issue-53280-expected-float-found-integer-literal.rs:5:38 | LL | let a_million_and_seventy: f64 = 1_000_070; | ^^^^^^^^^ | | - | expected f64, found integral variable + | expected f64, found integer | help: use a float literal: `1_000_070.0` | = note: expected type `f64` found type `{integer}` error[E0308]: mismatched types - --> $DIR/issue-53280-expected-float-found-integer-literal.rs:18:30 + --> $DIR/issue-53280-expected-float-found-integer-literal.rs:8:30 | LL | let negative_nine: f32 = -9; | ^^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `-9.0` | = note: expected type `f32` found type `{integer}` error[E0308]: mismatched types - --> $DIR/issue-53280-expected-float-found-integer-literal.rs:25:30 + --> $DIR/issue-53280-expected-float-found-integer-literal.rs:15:30 | LL | let sixteen_again: f64 = 0x10; - | ^^^^ expected f64, found integral variable + | ^^^^ expected f64, found integer | = note: expected type `f64` found type `{integer}` error[E0308]: mismatched types - --> $DIR/issue-53280-expected-float-found-integer-literal.rs:27:30 + --> $DIR/issue-53280-expected-float-found-integer-literal.rs:17:30 | LL | let and_once_more: f32 = 0o20; - | ^^^^ expected f32, found integral variable + | ^^^^ expected f32, found integer | = note: expected type `f32` found type `{integer}` diff --git a/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs b/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs index d053b11772c..687479bad3f 100644 --- a/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs +++ b/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn test_and() { let a = true; let b = false; diff --git a/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr b/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr index aa54425efa3..35123b11133 100644 --- a/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr +++ b/src/test/ui/did_you_mean/issue-54109-and_instead_of_ampersands.stderr @@ -1,5 +1,5 @@ error: expected `{`, found `and` - --> $DIR/issue-54109-and_instead_of_ampersands.rs:14:10 + --> $DIR/issue-54109-and_instead_of_ampersands.rs:4:10 | LL | if a and b { | -- ^^^ @@ -9,7 +9,7 @@ LL | if a and b { | this `if` statement has a condition, but no block error: expected `{`, found `or` - --> $DIR/issue-54109-and_instead_of_ampersands.rs:23:10 + --> $DIR/issue-54109-and_instead_of_ampersands.rs:13:10 | LL | if a or b { | -- ^^ @@ -19,7 +19,7 @@ LL | if a or b { | this `if` statement has a condition, but no block error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `and` - --> $DIR/issue-54109-and_instead_of_ampersands.rs:32:11 + --> $DIR/issue-54109-and_instead_of_ampersands.rs:22:11 | LL | if (a and b) { | ^^^ @@ -28,7 +28,7 @@ LL | if (a and b) { | help: use `&&` instead of `and` for the boolean operator error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found `or` - --> $DIR/issue-54109-and_instead_of_ampersands.rs:41:11 + --> $DIR/issue-54109-and_instead_of_ampersands.rs:31:11 | LL | if (a or b) { | ^^ @@ -37,7 +37,7 @@ LL | if (a or b) { | help: use `||` instead of `or` for the boolean operator error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `and` - --> $DIR/issue-54109-and_instead_of_ampersands.rs:50:13 + --> $DIR/issue-54109-and_instead_of_ampersands.rs:40:13 | LL | while a and b { | ^^^ @@ -46,7 +46,7 @@ LL | while a and b { | help: use `&&` instead of `and` for the boolean operator error: expected one of `!`, `.`, `::`, `?`, `{`, or an operator, found `or` - --> $DIR/issue-54109-and_instead_of_ampersands.rs:59:13 + --> $DIR/issue-54109-and_instead_of_ampersands.rs:49:13 | LL | while a or b { | ^^ diff --git a/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.rs b/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.rs new file mode 100644 index 00000000000..264cfa44994 --- /dev/null +++ b/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.rs @@ -0,0 +1,15 @@ +enum PutDown { Set } +enum AffixHeart { Set } +enum CauseToBe { Set } +enum Determine { Set } +enum TableDishesAction { Set } +enum Solidify { Set } +enum UnorderedCollection { Set } + +fn setup() -> Set { Set } +//~^ ERROR cannot find type `Set` in this scope +//~| ERROR cannot find value `Set` in this scope + +fn main() { + setup(); +} diff --git a/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr b/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr new file mode 100644 index 00000000000..6107ca32a5d --- /dev/null +++ b/src/test/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr @@ -0,0 +1,38 @@ +error[E0412]: cannot find type `Set` in this scope + --> $DIR/issue-56028-there-is-an-enum-variant.rs:9:15 + | +LL | fn setup() -> Set { Set } + | ^^^ not found in this scope +help: there is an enum variant `AffixHeart::Set` and 7 others; try using the variant's enum + | +LL | fn setup() -> AffixHeart { Set } + | ^^^^^^^^^^ +LL | fn setup() -> CauseToBe { Set } + | ^^^^^^^^^ +LL | fn setup() -> Determine { Set } + | ^^^^^^^^^ +LL | fn setup() -> PutDown { Set } + | ^^^^^^^ +and 3 other candidates + +error[E0425]: cannot find value `Set` in this scope + --> $DIR/issue-56028-there-is-an-enum-variant.rs:9:21 + | +LL | fn setup() -> Set { Set } + | ^^^ not found in this scope +help: possible candidates are found in other modules, you can import them into scope + | +LL | use AffixHeart::Set; + | +LL | use CauseToBe::Set; + | +LL | use Determine::Set; + | +LL | use PutDown::Set; + | +and 3 other candidates + +error: aborting due to 2 previous errors + +Some errors occurred: E0412, E0425. +For more information about an error, try `rustc --explain E0412`. diff --git a/src/test/ui/did_you_mean/multiple-pattern-typo.rs b/src/test/ui/did_you_mean/multiple-pattern-typo.rs index a8994fd6c96..14ad33d53b0 100644 --- a/src/test/ui/did_you_mean/multiple-pattern-typo.rs +++ b/src/test/ui/did_you_mean/multiple-pattern-typo.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = 3; match x { diff --git a/src/test/ui/did_you_mean/multiple-pattern-typo.stderr b/src/test/ui/did_you_mean/multiple-pattern-typo.stderr index c3a706d5901..2825ff46825 100644 --- a/src/test/ui/did_you_mean/multiple-pattern-typo.stderr +++ b/src/test/ui/did_you_mean/multiple-pattern-typo.stderr @@ -1,5 +1,5 @@ error: unexpected token `||` after pattern - --> $DIR/multiple-pattern-typo.rs:14:15 + --> $DIR/multiple-pattern-typo.rs:4:15 | LL | 1 | 2 || 3 => (), //~ ERROR unexpected token `||` after pattern | ^^ help: use a single `|` to specify multiple patterns: `|` diff --git a/src/test/ui/did_you_mean/pub-macro-rules.rs b/src/test/ui/did_you_mean/pub-macro-rules.rs index 65a0d642cd7..c5393703f70 100644 --- a/src/test/ui/did_you_mean/pub-macro-rules.rs +++ b/src/test/ui/did_you_mean/pub-macro-rules.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_use] mod bleh { pub macro_rules! foo { //~ ERROR can't qualify macro_rules invocation ($n:ident) => ( diff --git a/src/test/ui/did_you_mean/pub-macro-rules.stderr b/src/test/ui/did_you_mean/pub-macro-rules.stderr index dfeab75525b..7e62fc7c4fc 100644 --- a/src/test/ui/did_you_mean/pub-macro-rules.stderr +++ b/src/test/ui/did_you_mean/pub-macro-rules.stderr @@ -1,5 +1,5 @@ error: can't qualify macro_rules invocation with `pub` - --> $DIR/pub-macro-rules.rs:12:5 + --> $DIR/pub-macro-rules.rs:2:5 | LL | pub macro_rules! foo { //~ ERROR can't qualify macro_rules invocation | ^^^ help: try exporting the macro: `#[macro_export]` diff --git a/src/test/ui/did_you_mean/recursion_limit.rs b/src/test/ui/did_you_mean/recursion_limit.rs index 2d27f167a03..38db12960e7 100644 --- a/src/test/ui/did_you_mean/recursion_limit.rs +++ b/src/test/ui/did_you_mean/recursion_limit.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the recursion limit can be changed and that the compiler // suggests a fix. In this case, we have deeply nested types that will // fail the `Send` check by overflow when the recursion limit is set diff --git a/src/test/ui/did_you_mean/recursion_limit.stderr b/src/test/ui/did_you_mean/recursion_limit.stderr index 691c7ccd9fd..0738c3f65b9 100644 --- a/src/test/ui/did_you_mean/recursion_limit.stderr +++ b/src/test/ui/did_you_mean/recursion_limit.stderr @@ -1,11 +1,10 @@ -error[E0275]: overflow evaluating the requirement `K: std::marker::Send` - --> $DIR/recursion_limit.rs:44:5 +error[E0275]: overflow evaluating the requirement `J: std::marker::Send` + --> $DIR/recursion_limit.rs:34:5 | LL | is_send::(); //~ ERROR overflow evaluating the requirement | ^^^^^^^^^^^^ | = help: consider adding a `#![recursion_limit="20"]` attribute to your crate - = note: required because it appears within the type `J` = note: required because it appears within the type `I` = note: required because it appears within the type `H` = note: required because it appears within the type `G` @@ -16,7 +15,7 @@ LL | is_send::(); //~ ERROR overflow evaluating the requirement = note: required because it appears within the type `B` = note: required because it appears within the type `A` note: required by `is_send` - --> $DIR/recursion_limit.rs:41:1 + --> $DIR/recursion_limit.rs:31:1 | LL | fn is_send() { } | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/did_you_mean/recursion_limit_deref.rs b/src/test/ui/did_you_mean/recursion_limit_deref.rs index f5e75f40fca..76e555e5aa6 100644 --- a/src/test/ui/did_you_mean/recursion_limit_deref.rs +++ b/src/test/ui/did_you_mean/recursion_limit_deref.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the recursion limit can be changed and that the compiler // suggests a fix. In this case, we have a long chain of Deref impls // which will cause an overflow during the autoderef loop. diff --git a/src/test/ui/did_you_mean/recursion_limit_deref.stderr b/src/test/ui/did_you_mean/recursion_limit_deref.stderr index 20a94f7aac1..f8672b20c78 100644 --- a/src/test/ui/did_you_mean/recursion_limit_deref.stderr +++ b/src/test/ui/did_you_mean/recursion_limit_deref.stderr @@ -1,5 +1,5 @@ -error[E0055]: reached the recursion limit while auto-dereferencing I - --> $DIR/recursion_limit_deref.rs:60:22 +error[E0055]: reached the recursion limit while auto-dereferencing `I` + --> $DIR/recursion_limit_deref.rs:50:22 | LL | let x: &Bottom = &t; //~ ERROR mismatched types | ^^ deref recursion limit reached @@ -7,7 +7,7 @@ LL | let x: &Bottom = &t; //~ ERROR mismatched types = help: consider adding a `#![recursion_limit="20"]` attribute to your crate error[E0308]: mismatched types - --> $DIR/recursion_limit_deref.rs:60:22 + --> $DIR/recursion_limit_deref.rs:50:22 | LL | let x: &Bottom = &t; //~ ERROR mismatched types | ^^ expected struct `Bottom`, found struct `Top` diff --git a/src/test/ui/did_you_mean/recursion_limit_macro.rs b/src/test/ui/did_you_mean/recursion_limit_macro.rs index 16d07f36990..c9415361cf8 100644 --- a/src/test/ui/did_you_mean/recursion_limit_macro.rs +++ b/src/test/ui/did_you_mean/recursion_limit_macro.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the recursion limit can be changed and that the compiler // suggests a fix. In this case, we have a recursing macro that will // overflow if the number of arguments surpasses the recursion limit. diff --git a/src/test/ui/did_you_mean/recursion_limit_macro.stderr b/src/test/ui/did_you_mean/recursion_limit_macro.stderr index 265a688df99..5941d088f3a 100644 --- a/src/test/ui/did_you_mean/recursion_limit_macro.stderr +++ b/src/test/ui/did_you_mean/recursion_limit_macro.stderr @@ -1,5 +1,5 @@ error: recursion limit reached while expanding the macro `recurse` - --> $DIR/recursion_limit_macro.rs:20:31 + --> $DIR/recursion_limit_macro.rs:10:31 | LL | ($t:tt $($tail:tt)*) => { recurse!($($tail)*) }; //~ ERROR recursion limit | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs index 76bc971e115..a05227416cf 100644 --- a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs +++ b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let _: &Copy + 'static; //~ ERROR expected a path //~^ ERROR cannot be made into an object diff --git a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr index 6dd21648931..85c05274773 100644 --- a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr +++ b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr @@ -1,17 +1,17 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&Copy` - --> $DIR/trait-object-reference-without-parens-suggestion.rs:12:12 + --> $DIR/trait-object-reference-without-parens-suggestion.rs:2:12 | LL | let _: &Copy + 'static; //~ ERROR expected a path | ^^^^^^^^^^^^^^^ help: try adding parentheses: `&(Copy + 'static)` error[E0178]: expected a path on the left-hand side of `+`, not `&'static Copy` - --> $DIR/trait-object-reference-without-parens-suggestion.rs:14:12 + --> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12 | LL | let _: &'static Copy + 'static; //~ ERROR expected a path | ^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'static (Copy + 'static)` error[E0038]: the trait `std::marker::Copy` cannot be made into an object - --> $DIR/trait-object-reference-without-parens-suggestion.rs:12:12 + --> $DIR/trait-object-reference-without-parens-suggestion.rs:2:12 | LL | let _: &Copy + 'static; //~ ERROR expected a path | ^^^^^ the trait `std::marker::Copy` cannot be made into an object diff --git a/src/test/ui/directory_ownership/foo/mod_file_not_owning/aux2.rs b/src/test/ui/directory_ownership/foo/mod_file_not_owning/aux2.rs index fc4bca865c9..d11c69f812a 100644 --- a/src/test/ui/directory_ownership/foo/mod_file_not_owning/aux2.rs +++ b/src/test/ui/directory_ownership/foo/mod_file_not_owning/aux2.rs @@ -1,9 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// intentionally empty diff --git a/src/test/ui/directory_ownership/foo/mod_file_not_owning_aux2.rs b/src/test/ui/directory_ownership/foo/mod_file_not_owning_aux2.rs index fc4bca865c9..d11c69f812a 100644 --- a/src/test/ui/directory_ownership/foo/mod_file_not_owning_aux2.rs +++ b/src/test/ui/directory_ownership/foo/mod_file_not_owning_aux2.rs @@ -1,9 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// intentionally empty diff --git a/src/test/ui/directory_ownership/macro-expanded-mod.rs b/src/test/ui/directory_ownership/macro-expanded-mod.rs index 8e631a64f7a..9752a64162e 100644 --- a/src/test/ui/directory_ownership/macro-expanded-mod.rs +++ b/src/test/ui/directory_ownership/macro-expanded-mod.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that macro-expanded non-inline modules behave correctly macro_rules! mod_decl { @@ -19,5 +9,6 @@ mod macro_expanded_mod_helper { } fn main() { - mod_decl!(foo); //~ ERROR Cannot declare a non-inline module inside a block + mod_decl!(foo); + //~^ ERROR Cannot declare a non-inline module inside a block } diff --git a/src/test/ui/directory_ownership/macro-expanded-mod.stderr b/src/test/ui/directory_ownership/macro-expanded-mod.stderr index a9efcd883c1..620a00f89bb 100644 --- a/src/test/ui/directory_ownership/macro-expanded-mod.stderr +++ b/src/test/ui/directory_ownership/macro-expanded-mod.stderr @@ -1,7 +1,7 @@ error: Cannot declare a non-inline module inside a block unless it has a path attribute - --> $DIR/macro-expanded-mod.rs:22:15 + --> $DIR/macro-expanded-mod.rs:12:15 | -LL | mod_decl!(foo); //~ ERROR Cannot declare a non-inline module inside a block +LL | mod_decl!(foo); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/directory_ownership/macro_expanded_mod_helper/foo/bar.rs b/src/test/ui/directory_ownership/macro_expanded_mod_helper/foo/bar.rs index 4ef92981314..01c087dbc9e 100644 --- a/src/test/ui/directory_ownership/macro_expanded_mod_helper/foo/bar.rs +++ b/src/test/ui/directory_ownership/macro_expanded_mod_helper/foo/bar.rs @@ -1,11 +1 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test not a test, auxiliary diff --git a/src/test/ui/directory_ownership/macro_expanded_mod_helper/foo/mod.rs b/src/test/ui/directory_ownership/macro_expanded_mod_helper/foo/mod.rs index 41a8c288e7c..2ec1c8bcc9c 100644 --- a/src/test/ui/directory_ownership/macro_expanded_mod_helper/foo/mod.rs +++ b/src/test/ui/directory_ownership/macro_expanded_mod_helper/foo/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test not a test, auxiliary mod_decl!(bar); diff --git a/src/test/ui/directory_ownership/mod_file_not_owning_aux1.rs b/src/test/ui/directory_ownership/mod_file_not_owning_aux1.rs index 4ac94a92e37..eb5e8e3e1ab 100644 --- a/src/test/ui/directory_ownership/mod_file_not_owning_aux1.rs +++ b/src/test/ui/directory_ownership/mod_file_not_owning_aux1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test this is not a test macro_rules! m { diff --git a/src/test/ui/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs b/src/test/ui/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs index fc4bca865c9..d11c69f812a 100644 --- a/src/test/ui/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs +++ b/src/test/ui/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs @@ -1,9 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// intentionally empty diff --git a/src/test/ui/directory_ownership/mod_file_not_owning_aux2.rs b/src/test/ui/directory_ownership/mod_file_not_owning_aux2.rs index 41401d640f6..920938c4ad4 100644 --- a/src/test/ui/directory_ownership/mod_file_not_owning_aux2.rs +++ b/src/test/ui/directory_ownership/mod_file_not_owning_aux2.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test this is not a test diff --git a/src/test/ui/directory_ownership/mod_file_not_owning_aux3.rs b/src/test/ui/directory_ownership/mod_file_not_owning_aux3.rs index 3a164fd55d9..6e4a3928956 100644 --- a/src/test/ui/directory_ownership/mod_file_not_owning_aux3.rs +++ b/src/test/ui/directory_ownership/mod_file_not_owning_aux3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test this is not a test mod mod_file_not_owning_aux2; diff --git a/src/test/ui/directory_ownership/non-inline-mod-restriction.rs b/src/test/ui/directory_ownership/non-inline-mod-restriction.rs index c4ede12e820..af31b8a4928 100644 --- a/src/test/ui/directory_ownership/non-inline-mod-restriction.rs +++ b/src/test/ui/directory_ownership/non-inline-mod-restriction.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that non-inline modules are not allowed inside blocks. fn main() { diff --git a/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr b/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr index 93debdd675a..6ceaa2e346a 100644 --- a/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr +++ b/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr @@ -1,5 +1,5 @@ error: Cannot declare a non-inline module inside a block unless it has a path attribute - --> $DIR/non-inline-mod-restriction.rs:14:9 + --> $DIR/non-inline-mod-restriction.rs:4:9 | LL | mod foo; //~ ERROR Cannot declare a non-inline module inside a block | ^^^ diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr index 8e059937028..59cb804a801 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `X`, which implements the `Drop` trait - --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:22:22 + --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:22 | LL | let X { x: y } = x; //~ ERROR cannot move out of type | - ^ cannot move out of here @@ -7,7 +7,7 @@ LL | let X { x: y } = x; //~ ERROR cannot move out of type | data moved here | note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:22:16 + --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:16 | LL | let X { x: y } = x; //~ ERROR cannot move out of type | ^ diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.rs b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.rs index 2621820c222..8e394498a23 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.rs +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct X { x: String, } diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr index cbf5fc61f93..cb32616d6e6 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `X`, which implements the `Drop` trait - --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:22:9 + --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:9 | LL | let X { x: y } = x; //~ ERROR cannot move out of type | ^^^^^^^-^^ diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr index dd1a3ef2a2b..2143c2f9b22 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `X`, which implements the `Drop` trait - --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:24:11 + --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:14:11 | LL | match x { | ^ cannot move out of here @@ -7,7 +7,7 @@ LL | X { x: y } => println!("contents: {}", y) | - data moved here | note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:25:16 + --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:15:16 | LL | X { x: y } => println!("contents: {}", y) | ^ diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs index 38049209903..3a5ed6e3b3e 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct X { x: String, } diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr index af2a1a06b56..8be1b385afe 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `X`, which implements the `Drop` trait - --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:25:9 + --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:15:9 | LL | X { x: y } => println!("contents: {}", y) | ^^^^^^^-^^ diff --git a/src/test/ui/discrim/discrim-ill-typed.rs b/src/test/ui/discrim/discrim-ill-typed.rs index 62e54c3f237..3844d21094e 100644 --- a/src/test/ui/discrim/discrim-ill-typed.rs +++ b/src/test/ui/discrim/discrim-ill-typed.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // When explicit discriminant value has // a type that does not match the representation // type, rustc should fail gracefully. diff --git a/src/test/ui/discrim/discrim-ill-typed.stderr b/src/test/ui/discrim/discrim-ill-typed.stderr index 50911037794..14cdb9e07f9 100644 --- a/src/test/ui/discrim/discrim-ill-typed.stderr +++ b/src/test/ui/discrim/discrim-ill-typed.stderr @@ -1,47 +1,47 @@ error[E0308]: mismatched types - --> $DIR/discrim-ill-typed.rs:27:16 + --> $DIR/discrim-ill-typed.rs:17:16 | LL | OhNo = 0_u8, | ^^^^ expected i8, found u8 error[E0308]: mismatched types - --> $DIR/discrim-ill-typed.rs:40:16 + --> $DIR/discrim-ill-typed.rs:30:16 | LL | OhNo = 0_i8, | ^^^^ expected u8, found i8 error[E0308]: mismatched types - --> $DIR/discrim-ill-typed.rs:53:16 + --> $DIR/discrim-ill-typed.rs:43:16 | LL | OhNo = 0_u16, | ^^^^^ expected i16, found u16 error[E0308]: mismatched types - --> $DIR/discrim-ill-typed.rs:66:16 + --> $DIR/discrim-ill-typed.rs:56:16 | LL | OhNo = 0_i16, | ^^^^^ expected u16, found i16 error[E0308]: mismatched types - --> $DIR/discrim-ill-typed.rs:79:16 + --> $DIR/discrim-ill-typed.rs:69:16 | LL | OhNo = 0_u32, | ^^^^^ expected i32, found u32 error[E0308]: mismatched types - --> $DIR/discrim-ill-typed.rs:92:16 + --> $DIR/discrim-ill-typed.rs:82:16 | LL | OhNo = 0_i32, | ^^^^^ expected u32, found i32 error[E0308]: mismatched types - --> $DIR/discrim-ill-typed.rs:105:16 + --> $DIR/discrim-ill-typed.rs:95:16 | LL | OhNo = 0_u64, | ^^^^^ expected i64, found u64 error[E0308]: mismatched types - --> $DIR/discrim-ill-typed.rs:118:16 + --> $DIR/discrim-ill-typed.rs:108:16 | LL | OhNo = 0_i64, | ^^^^^ expected u64, found i64 diff --git a/src/test/ui/discrim/discrim-overflow-2.rs b/src/test/ui/discrim/discrim-overflow-2.rs index 9f77e77d158..9ff39cd0484 100644 --- a/src/test/ui/discrim/discrim-overflow-2.rs +++ b/src/test/ui/discrim/discrim-overflow-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // Issue 23030: Detect overflowing discriminant diff --git a/src/test/ui/discrim/discrim-overflow-2.stderr b/src/test/ui/discrim/discrim-overflow-2.stderr index bd610bc7163..c490509142a 100644 --- a/src/test/ui/discrim/discrim-overflow-2.stderr +++ b/src/test/ui/discrim/discrim-overflow-2.stderr @@ -1,5 +1,5 @@ error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow-2.rs:27:9 + --> $DIR/discrim-overflow-2.rs:17:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 127 @@ -7,7 +7,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = -128` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow-2.rs:36:9 + --> $DIR/discrim-overflow-2.rs:26:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 255 @@ -15,7 +15,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = 0` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow-2.rs:45:9 + --> $DIR/discrim-overflow-2.rs:35:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 32767 @@ -23,7 +23,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = -32768` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow-2.rs:54:9 + --> $DIR/discrim-overflow-2.rs:44:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 65535 @@ -31,7 +31,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = 0` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow-2.rs:63:9 + --> $DIR/discrim-overflow-2.rs:53:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 2147483647 @@ -39,7 +39,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = -2147483648` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow-2.rs:72:9 + --> $DIR/discrim-overflow-2.rs:62:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 4294967295 @@ -47,7 +47,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = 0` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow-2.rs:81:9 + --> $DIR/discrim-overflow-2.rs:71:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 9223372036854775807 @@ -55,7 +55,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = -9223372036854775808` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow-2.rs:90:9 + --> $DIR/discrim-overflow-2.rs:80:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 18446744073709551615 diff --git a/src/test/ui/discrim/discrim-overflow.rs b/src/test/ui/discrim/discrim-overflow.rs index 16b417c61a5..c612661178c 100644 --- a/src/test/ui/discrim/discrim-overflow.rs +++ b/src/test/ui/discrim/discrim-overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // Issue 23030: Detect overflowing discriminant diff --git a/src/test/ui/discrim/discrim-overflow.stderr b/src/test/ui/discrim/discrim-overflow.stderr index ef784679ce0..e71df51e36d 100644 --- a/src/test/ui/discrim/discrim-overflow.stderr +++ b/src/test/ui/discrim/discrim-overflow.stderr @@ -1,5 +1,5 @@ error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow.rs:25:9 + --> $DIR/discrim-overflow.rs:15:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 127 @@ -7,7 +7,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = -128` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow.rs:36:9 + --> $DIR/discrim-overflow.rs:26:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 255 @@ -15,7 +15,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = 0` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow.rs:47:9 + --> $DIR/discrim-overflow.rs:37:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 32767 @@ -23,7 +23,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = -32768` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow.rs:58:9 + --> $DIR/discrim-overflow.rs:48:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 65535 @@ -31,7 +31,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = 0` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow.rs:70:9 + --> $DIR/discrim-overflow.rs:60:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 2147483647 @@ -39,7 +39,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = -2147483648` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow.rs:82:9 + --> $DIR/discrim-overflow.rs:72:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 4294967295 @@ -47,7 +47,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = 0` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow.rs:94:9 + --> $DIR/discrim-overflow.rs:84:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 9223372036854775807 @@ -55,7 +55,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] = note: explicitly set `OhNo = -9223372036854775808` if that is desired outcome error[E0370]: enum discriminant overflowed - --> $DIR/discrim-overflow.rs:106:9 + --> $DIR/discrim-overflow.rs:96:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] | ^^^^ overflowed on value after 18446744073709551615 diff --git a/src/test/ui/diverging-fn-tail-35849.rs b/src/test/ui/diverging-fn-tail-35849.rs index 9ef5159cb77..f21ce2973e9 100644 --- a/src/test/ui/diverging-fn-tail-35849.rs +++ b/src/test/ui/diverging-fn-tail-35849.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn assert_sizeof() -> ! { unsafe { ::std::mem::transmute::(panic!()) diff --git a/src/test/ui/diverging-fn-tail-35849.stderr b/src/test/ui/diverging-fn-tail-35849.stderr index 8f8ab79b25b..383a7009e85 100644 --- a/src/test/ui/diverging-fn-tail-35849.stderr +++ b/src/test/ui/diverging-fn-tail-35849.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/diverging-fn-tail-35849.rs:13:9 + --> $DIR/diverging-fn-tail-35849.rs:3:9 | LL | fn assert_sizeof() -> ! { | - expected `!` because of return type diff --git a/src/test/ui/diverging-tuple-parts-39485.rs b/src/test/ui/diverging-tuple-parts-39485.rs index eedad08ab55..0cde6119308 100644 --- a/src/test/ui/diverging-tuple-parts-39485.rs +++ b/src/test/ui/diverging-tuple-parts-39485.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // After #39485, this test used to pass, but that change was reverted // due to numerous inference failures like #39808, so it now fails // again. #39485 made it so that diverging types never propagate diff --git a/src/test/ui/diverging-tuple-parts-39485.stderr b/src/test/ui/diverging-tuple-parts-39485.stderr index 603f8709c14..c399650d325 100644 --- a/src/test/ui/diverging-tuple-parts-39485.stderr +++ b/src/test/ui/diverging-tuple-parts-39485.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/diverging-tuple-parts-39485.rs:18:5 + --> $DIR/diverging-tuple-parts-39485.rs:8:5 | LL | fn g() { | - help: try adding a return type: `-> &_` @@ -10,7 +10,7 @@ LL | &panic!() //~ ERROR mismatched types found type `&_` error[E0308]: mismatched types - --> $DIR/diverging-tuple-parts-39485.rs:22:5 + --> $DIR/diverging-tuple-parts-39485.rs:12:5 | LL | fn f() -> isize { | ----- expected `isize` because of return type diff --git a/src/test/ui/does-nothing.rs b/src/test/ui/does-nothing.rs index 01de94bddbd..e4992e2cfd3 100644 --- a/src/test/ui/does-nothing.rs +++ b/src/test/ui/does-nothing.rs @@ -1,12 +1,2 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("doing"); this_does_nothing_what_the; println!("boing"); } //~^ ERROR cannot find value `this_does_nothing_what_the` in this scope diff --git a/src/test/ui/does-nothing.stderr b/src/test/ui/does-nothing.stderr index fa4b1f2f1c8..dca79231517 100644 --- a/src/test/ui/does-nothing.stderr +++ b/src/test/ui/does-nothing.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `this_does_nothing_what_the` in this scope - --> $DIR/does-nothing.rs:11:32 + --> $DIR/does-nothing.rs:1:32 | LL | fn main() { println!("doing"); this_does_nothing_what_the; println!("boing"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.rs b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.rs index 87a29038035..bbab6f87748 100644 --- a/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.rs +++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a {} macro_rules! m { diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr index fe9af74c01d..206af6757b2 100644 --- a/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr +++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: `$crate` in paths can only be used in start position - --> $DIR/dollar-crate-is-keyword-2.rs:16:16 + --> $DIR/dollar-crate-is-keyword-2.rs:6:16 | LL | use a::$crate::b; //~ ERROR `$crate` in paths can only be used in start position | ^^^^^^ `$crate` in paths can only be used in start position @@ -8,7 +8,7 @@ LL | m!(); | ----- in this macro invocation error[E0432]: unresolved import `a::$crate` - --> $DIR/dollar-crate-is-keyword-2.rs:15:13 + --> $DIR/dollar-crate-is-keyword-2.rs:5:13 | LL | use a::$crate; //~ ERROR unresolved import `a::$crate` | ^^^^^^^^^ no `$crate` in `a` @@ -17,7 +17,7 @@ LL | m!(); | ----- in this macro invocation error[E0433]: failed to resolve: `$crate` in paths can only be used in start position - --> $DIR/dollar-crate-is-keyword-2.rs:17:21 + --> $DIR/dollar-crate-is-keyword-2.rs:7:21 | LL | type A = a::$crate; //~ ERROR `$crate` in paths can only be used in start position | ^^^^^^ `$crate` in paths can only be used in start position diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs b/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs index 4a667f020ad..6deaeb81179 100644 --- a/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs +++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! m { () => { // Avoid having more than one `$crate`-named item in the same module, diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr b/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr index 77f4ef33949..e94a5fe96ff 100644 --- a/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr +++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr @@ -1,5 +1,5 @@ error: expected identifier, found reserved identifier `$crate` - --> $DIR/dollar-crate-is-keyword.rs:16:20 + --> $DIR/dollar-crate-is-keyword.rs:6:20 | LL | struct $crate {} //~ ERROR expected identifier, found reserved identifier `$crate` | ^^^^^^ expected identifier, found reserved identifier @@ -8,7 +8,7 @@ LL | m!(); | ----- in this macro invocation error: expected identifier, found reserved identifier `$crate` - --> $DIR/dollar-crate-is-keyword.rs:21:23 + --> $DIR/dollar-crate-is-keyword.rs:11:23 | LL | use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate` | ^^^^^^ expected identifier, found reserved identifier @@ -17,7 +17,7 @@ LL | m!(); | ----- in this macro invocation warning: `$crate` may not be imported - --> $DIR/dollar-crate-is-keyword.rs:19:9 + --> $DIR/dollar-crate-is-keyword.rs:9:9 | LL | use $crate; // OK | ^^^^^^^^^^^ @@ -28,7 +28,7 @@ LL | m!(); = note: `use $crate;` was erroneously allowed and will become a hard error in a future release warning: `$crate` may not be imported - --> $DIR/dollar-crate-is-keyword.rs:21:9 + --> $DIR/dollar-crate-is-keyword.rs:11:9 | LL | use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate` | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dont-suggest-private-trait-method.rs b/src/test/ui/dont-suggest-private-trait-method.rs index 99bee0d3c59..ef0904c1a2d 100644 --- a/src/test/ui/dont-suggest-private-trait-method.rs +++ b/src/test/ui/dont-suggest-private-trait-method.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct T; fn main() { diff --git a/src/test/ui/dont-suggest-private-trait-method.stderr b/src/test/ui/dont-suggest-private-trait-method.stderr index 81ecc546a6d..af4253779a4 100644 --- a/src/test/ui/dont-suggest-private-trait-method.stderr +++ b/src/test/ui/dont-suggest-private-trait-method.stderr @@ -1,11 +1,13 @@ error[E0599]: no function or associated item named `new` found for type `T` in the current scope - --> $DIR/dont-suggest-private-trait-method.rs:14:5 + --> $DIR/dont-suggest-private-trait-method.rs:4:8 | LL | struct T; | --------- function or associated item `new` not found for this ... LL | T::new(); - | ^^^^^^ function or associated item not found in `T` + | ---^^^ + | | + | function or associated item not found in `T` error: aborting due to previous error diff --git a/src/test/ui/dotdotdot-expr.rs b/src/test/ui/dotdotdot-expr.rs index afb73a526a8..d842fb6e030 100644 --- a/src/test/ui/dotdotdot-expr.rs +++ b/src/test/ui/dotdotdot-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let _redemptive = 1...21; //~^ ERROR unexpected token diff --git a/src/test/ui/dotdotdot-expr.stderr b/src/test/ui/dotdotdot-expr.stderr index 3315538f2f7..a5ef7b65048 100644 --- a/src/test/ui/dotdotdot-expr.stderr +++ b/src/test/ui/dotdotdot-expr.stderr @@ -1,5 +1,5 @@ error: unexpected token: `...` - --> $DIR/dotdotdot-expr.rs:12:24 + --> $DIR/dotdotdot-expr.rs:2:24 | LL | let _redemptive = 1...21; | ^^^ diff --git a/src/test/ui/double-import.rs b/src/test/ui/double-import.rs index 154c9bebb0f..e7325368b4d 100644 --- a/src/test/ui/double-import.rs +++ b/src/test/ui/double-import.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This tests that conflicting imports shows both `use` lines // when reporting the error. diff --git a/src/test/ui/double-import.stderr b/src/test/ui/double-import.stderr index 436d594921b..2fefdc49e9c 100644 --- a/src/test/ui/double-import.stderr +++ b/src/test/ui/double-import.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `foo` is defined multiple times - --> $DIR/double-import.rs:23:5 + --> $DIR/double-import.rs:13:5 | LL | use sub1::foo; | --------- previous import of the value `foo` here diff --git a/src/test/ui/double-type-import.rs b/src/test/ui/double-type-import.rs index 9629da735b0..6b1eb65d5ae 100644 --- a/src/test/ui/double-type-import.rs +++ b/src/test/ui/double-type-import.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub use self::bar::X; use self::bar::X; diff --git a/src/test/ui/double-type-import.stderr b/src/test/ui/double-type-import.stderr index f1d6e63c713..4bdee0c4c9f 100644 --- a/src/test/ui/double-type-import.stderr +++ b/src/test/ui/double-type-import.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `X` is defined multiple times - --> $DIR/double-type-import.rs:13:9 + --> $DIR/double-type-import.rs:3:9 | LL | pub use self::bar::X; | ------------ previous import of the type `X` here diff --git a/src/test/ui/dropck/auxiliary/dropck_eyepatch_extern_crate.rs b/src/test/ui/dropck/auxiliary/dropck_eyepatch_extern_crate.rs index 08722ca62ac..e070829574e 100644 --- a/src/test/ui/dropck/auxiliary/dropck_eyepatch_extern_crate.rs +++ b/src/test/ui/dropck/auxiliary/dropck_eyepatch_extern_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(dropck_eyepatch)] // This is a support file for ../dropck-eyepatch-extern-crate.rs diff --git a/src/test/ui/dropck/drop-on-non-struct.rs b/src/test/ui/dropck/drop-on-non-struct.rs index 26b247d0d0f..259cdf40ae5 100644 --- a/src/test/ui/dropck/drop-on-non-struct.rs +++ b/src/test/ui/dropck/drop-on-non-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - impl<'a> Drop for &'a mut isize { //~^ ERROR the Drop trait may only be implemented on structures //~^^ ERROR E0117 diff --git a/src/test/ui/dropck/drop-on-non-struct.stderr b/src/test/ui/dropck/drop-on-non-struct.stderr index 6582df6bddc..6b670d5d434 100644 --- a/src/test/ui/dropck/drop-on-non-struct.stderr +++ b/src/test/ui/dropck/drop-on-non-struct.stderr @@ -1,16 +1,16 @@ error[E0120]: the Drop trait may only be implemented on structures - --> $DIR/drop-on-non-struct.rs:11:19 + --> $DIR/drop-on-non-struct.rs:1:19 | LL | impl<'a> Drop for &'a mut isize { | ^^^^^^^^^^^^^ implementing Drop requires a struct error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/drop-on-non-struct.rs:11:1 + --> $DIR/drop-on-non-struct.rs:1:1 | LL | impl<'a> Drop for &'a mut isize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | - = note: the impl does not reference any types defined in this crate + = note: the impl does not reference only types defined in this crate = note: define and implement a trait or new type instead error: aborting due to 2 previous errors diff --git a/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr b/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr index 30f9907401c..9c6c9341be7 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr +++ b/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `a` because it is borrowed - --> $DIR/drop-with-active-borrows-1.rs:14:10 + --> $DIR/drop-with-active-borrows-1.rs:4:10 | LL | let b: Vec<&str> = a.lines().collect(); | - borrow of `a` occurs here diff --git a/src/test/ui/dropck/drop-with-active-borrows-1.rs b/src/test/ui/dropck/drop-with-active-borrows-1.rs index 903365fb909..1e924af296a 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-1.rs +++ b/src/test/ui/dropck/drop-with-active-borrows-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let a = "".to_string(); let b: Vec<&str> = a.lines().collect(); diff --git a/src/test/ui/dropck/drop-with-active-borrows-1.stderr b/src/test/ui/dropck/drop-with-active-borrows-1.stderr index 60107427ea5..a4295f96205 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-1.stderr +++ b/src/test/ui/dropck/drop-with-active-borrows-1.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `a` because it is borrowed - --> $DIR/drop-with-active-borrows-1.rs:14:10 + --> $DIR/drop-with-active-borrows-1.rs:4:10 | LL | let b: Vec<&str> = a.lines().collect(); | - borrow of `a` occurs here diff --git a/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr b/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr index 6200ec3722c..ffec9306b77 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr +++ b/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `raw_lines` - --> $DIR/drop-with-active-borrows-2.rs:13:5 + --> $DIR/drop-with-active-borrows-2.rs:3:5 | LL | raw_lines.iter().map(|l| l.trim()).collect() | ---------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dropck/drop-with-active-borrows-2.rs b/src/test/ui/dropck/drop-with-active-borrows-2.rs index 33e4d3e62c4..4e45633a281 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-2.rs +++ b/src/test/ui/dropck/drop-with-active-borrows-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn read_lines_borrowed<'a>() -> Vec<&'a str> { let raw_lines: Vec = vec!["foo ".to_string(), " bar".to_string()]; raw_lines.iter().map(|l| l.trim()).collect() diff --git a/src/test/ui/dropck/drop-with-active-borrows-2.stderr b/src/test/ui/dropck/drop-with-active-borrows-2.stderr index 0fd4bf81039..347389cb59d 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-2.stderr +++ b/src/test/ui/dropck/drop-with-active-borrows-2.stderr @@ -1,5 +1,5 @@ error[E0597]: `raw_lines` does not live long enough - --> $DIR/drop-with-active-borrows-2.rs:13:5 + --> $DIR/drop-with-active-borrows-2.rs:3:5 | LL | raw_lines.iter().map(|l| l.trim()).collect() | ^^^^^^^^^ borrowed value does not live long enough @@ -7,8 +7,8 @@ LL | //~^ ERROR `raw_lines` does not live long enough LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 11:24... - --> $DIR/drop-with-active-borrows-2.rs:11:24 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 1:24... + --> $DIR/drop-with-active-borrows-2.rs:1:24 | LL | fn read_lines_borrowed<'a>() -> Vec<&'a str> { | ^^ diff --git a/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.rs b/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.rs index cba438b02a9..6869ab1c458 100644 --- a/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.rs +++ b/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(dropck_eyepatch)] // This test ensures that a use of `#[may_dangle]` is rejected if diff --git a/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr b/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr index 9d68ff13ef3..c3139948a07 100644 --- a/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr +++ b/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr @@ -1,5 +1,5 @@ error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attribute - --> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:31:1 + --> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:21:1 | LL | / impl<#[may_dangle] A, B: fmt::Debug> Drop for Pt { LL | | //~^ ERROR requires an `unsafe impl` declaration due to `#[may_dangle]` attribute @@ -10,7 +10,7 @@ LL | | } | |_^ error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attribute - --> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:37:1 + --> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:27:1 | LL | / impl<#[may_dangle] 'a, 'b, B: fmt::Debug> Drop for Pr<'a, 'b, B> { LL | | //~^ ERROR requires an `unsafe impl` declaration due to `#[may_dangle]` attribute diff --git a/src/test/ui/dropck/dropck-eyepatch.rs b/src/test/ui/dropck/dropck-eyepatch.rs index d7a671fd33c..fb1c03b6786 100644 --- a/src/test/ui/dropck/dropck-eyepatch.rs +++ b/src/test/ui/dropck/dropck-eyepatch.rs @@ -31,7 +31,7 @@ // - D means "I implement Drop" // // - P means "I implement Drop but guarantee my (first) parameter is -// pure, i.e. not accessed from the destructor"; no other parameters +// pure, i.e., not accessed from the destructor"; no other parameters // are pure. // // - S means "I do not implement Drop" diff --git a/src/test/ui/dropck/dropck-union.nll.stderr b/src/test/ui/dropck/dropck-union.nll.stderr index b828a167561..667bb7221aa 100644 --- a/src/test/ui/dropck/dropck-union.nll.stderr +++ b/src/test/ui/dropck/dropck-union.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `v` does not live long enough - --> $DIR/dropck-union.rs:49:18 + --> $DIR/dropck-union.rs:39:18 | LL | v.0.set(Some(&v)); //~ ERROR: `v` does not live long enough | ^^ borrowed value does not live long enough diff --git a/src/test/ui/dropck/dropck-union.rs b/src/test/ui/dropck/dropck-union.rs index f16d761fdab..ef4d1b360b8 100644 --- a/src/test/ui/dropck/dropck-union.rs +++ b/src/test/ui/dropck/dropck-union.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(untagged_unions)] use std::cell::Cell; diff --git a/src/test/ui/dropck/dropck-union.stderr b/src/test/ui/dropck/dropck-union.stderr index a383ca5d390..6cb3c139132 100644 --- a/src/test/ui/dropck/dropck-union.stderr +++ b/src/test/ui/dropck/dropck-union.stderr @@ -1,5 +1,5 @@ error[E0597]: `v` does not live long enough - --> $DIR/dropck-union.rs:49:19 + --> $DIR/dropck-union.rs:39:19 | LL | v.0.set(Some(&v)); //~ ERROR: `v` does not live long enough | ^ borrowed value does not live long enough diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.rs b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.rs index f0968853819..6ca5f5e3c5f 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.rs +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 22443: Reject code using non-regular types that would // otherwise cause dropck to loop infinitely. diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr index f4dd867ec68..317ac767431 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr @@ -1,5 +1,5 @@ error[E0320]: overflow while adding drop-check rules for FingerTree - --> $DIR/dropck_no_diverge_on_nonregular_1.rs:34:9 + --> $DIR/dropck_no_diverge_on_nonregular_1.rs:24:9 | LL | let ft = //~ ERROR overflow while adding drop-check rules for FingerTree | ^^ @@ -7,7 +7,7 @@ LL | let ft = //~ ERROR overflow while adding drop-check rules for FingerTre = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> error[E0320]: overflow while adding drop-check rules for FingerTree - --> $DIR/dropck_no_diverge_on_nonregular_1.rs:35:9 + --> $DIR/dropck_no_diverge_on_nonregular_1.rs:25:9 | LL | FingerTree::Single(1); | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.rs b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.rs index 886bd6bea20..d34f7e326d1 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.rs +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 22443: Reject code using non-regular types that would // otherwise cause dropck to loop infinitely. diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr index ae9c50a66a0..b87e7a11149 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr @@ -1,5 +1,5 @@ error[E0320]: overflow while adding drop-check rules for FingerTree - --> $DIR/dropck_no_diverge_on_nonregular_2.rs:33:9 + --> $DIR/dropck_no_diverge_on_nonregular_2.rs:23:9 | LL | let ft = //~ ERROR overflow while adding drop-check rules for FingerTree | ^^ @@ -7,7 +7,7 @@ LL | let ft = //~ ERROR overflow while adding drop-check rules for FingerTre = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> error[E0320]: overflow while adding drop-check rules for FingerTree - --> $DIR/dropck_no_diverge_on_nonregular_2.rs:34:9 + --> $DIR/dropck_no_diverge_on_nonregular_2.rs:24:9 | LL | FingerTree::Single(1); | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.rs b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.rs index 45531666ecf..e2e600b17f2 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.rs +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 22443: Reject code using non-regular types that would // otherwise cause dropck to loop infinitely. // diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr index e0089f8b298..799ee45a202 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr @@ -1,5 +1,5 @@ error[E0320]: overflow while adding drop-check rules for std::option::Option> - --> $DIR/dropck_no_diverge_on_nonregular_3.rs:42:9 + --> $DIR/dropck_no_diverge_on_nonregular_3.rs:32:9 | LL | let w = //~ ERROR overflow while adding drop-check rules for std::option | ^ @@ -7,7 +7,7 @@ LL | let w = //~ ERROR overflow while adding drop-check rules for std::optio = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> error[E0320]: overflow while adding drop-check rules for std::option::Option> - --> $DIR/dropck_no_diverge_on_nonregular_3.rs:43:9 + --> $DIR/dropck_no_diverge_on_nonregular_3.rs:33:9 | LL | Some(Wrapper::Simple::); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | Some(Wrapper::Simple::); = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> error[E0320]: overflow while adding drop-check rules for Wrapper - --> $DIR/dropck_no_diverge_on_nonregular_3.rs:43:14 + --> $DIR/dropck_no_diverge_on_nonregular_3.rs:33:14 | LL | Some(Wrapper::Simple::); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr index d4b74841b0d..28b9656c6fd 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `o2` does not live long enough - --> $DIR/dropck_trait_cycle_checked.rs:121:13 + --> $DIR/dropck_trait_cycle_checked.rs:111:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o2` is borrowed for `'static` @@ -10,7 +10,7 @@ LL | } | - `o2` dropped here while still borrowed error[E0597]: `o3` does not live long enough - --> $DIR/dropck_trait_cycle_checked.rs:122:13 + --> $DIR/dropck_trait_cycle_checked.rs:112:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o3` is borrowed for `'static` @@ -22,7 +22,7 @@ LL | } | - `o3` dropped here while still borrowed error[E0597]: `o2` does not live long enough - --> $DIR/dropck_trait_cycle_checked.rs:123:13 + --> $DIR/dropck_trait_cycle_checked.rs:113:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o2` is borrowed for `'static` @@ -34,7 +34,7 @@ LL | } | - `o2` dropped here while still borrowed error[E0597]: `o3` does not live long enough - --> $DIR/dropck_trait_cycle_checked.rs:124:13 + --> $DIR/dropck_trait_cycle_checked.rs:114:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o3` is borrowed for `'static` @@ -46,7 +46,7 @@ LL | } | - `o3` dropped here while still borrowed error[E0597]: `o1` does not live long enough - --> $DIR/dropck_trait_cycle_checked.rs:125:13 + --> $DIR/dropck_trait_cycle_checked.rs:115:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o1` is borrowed for `'static` @@ -58,7 +58,7 @@ LL | } | - `o1` dropped here while still borrowed error[E0597]: `o2` does not live long enough - --> $DIR/dropck_trait_cycle_checked.rs:126:13 + --> $DIR/dropck_trait_cycle_checked.rs:116:13 | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o2` is borrowed for `'static` diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.rs b/src/test/ui/dropck/dropck_trait_cycle_checked.rs index b6b7fa1a233..128bbb04ee0 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.rs +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Reject mixing cyclic structure and Drop when using trait // objects to hide the cross-references. // diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr index ab255cf0c98..0e4bd829a94 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr @@ -1,5 +1,5 @@ error[E0597]: `o2` does not live long enough - --> $DIR/dropck_trait_cycle_checked.rs:121:14 + --> $DIR/dropck_trait_cycle_checked.rs:111:14 | LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough | ^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: `o3` does not live long enough - --> $DIR/dropck_trait_cycle_checked.rs:122:14 + --> $DIR/dropck_trait_cycle_checked.rs:112:14 | LL | o1.set1(&o3); //~ ERROR `o3` does not live long enough | ^^ borrowed value does not live long enough @@ -21,7 +21,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: `o2` does not live long enough - --> $DIR/dropck_trait_cycle_checked.rs:123:14 + --> $DIR/dropck_trait_cycle_checked.rs:113:14 | LL | o2.set0(&o2); //~ ERROR `o2` does not live long enough | ^^ borrowed value does not live long enough @@ -32,7 +32,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: `o3` does not live long enough - --> $DIR/dropck_trait_cycle_checked.rs:124:14 + --> $DIR/dropck_trait_cycle_checked.rs:114:14 | LL | o2.set1(&o3); //~ ERROR `o3` does not live long enough | ^^ borrowed value does not live long enough @@ -43,7 +43,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: `o1` does not live long enough - --> $DIR/dropck_trait_cycle_checked.rs:125:14 + --> $DIR/dropck_trait_cycle_checked.rs:115:14 | LL | o3.set0(&o1); //~ ERROR `o1` does not live long enough | ^^ borrowed value does not live long enough @@ -54,7 +54,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: `o2` does not live long enough - --> $DIR/dropck_trait_cycle_checked.rs:126:14 + --> $DIR/dropck_trait_cycle_checked.rs:116:14 | LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough | ^^ borrowed value does not live long enough diff --git a/src/test/ui/dst/dst-bad-assign-2.rs b/src/test/ui/dst/dst-bad-assign-2.rs index 372f3187805..b4f72d034f5 100644 --- a/src/test/ui/dst/dst-bad-assign-2.rs +++ b/src/test/ui/dst/dst-bad-assign-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Forbid assignment into a dynamically sized type. struct Fat { diff --git a/src/test/ui/dst/dst-bad-assign-2.stderr b/src/test/ui/dst/dst-bad-assign-2.stderr index ead973d25a0..4e1e67c7f48 100644 --- a/src/test/ui/dst/dst-bad-assign-2.stderr +++ b/src/test/ui/dst/dst-bad-assign-2.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `dyn ToBar` cannot be known at compilation time - --> $DIR/dst-bad-assign-2.rs:45:5 + --> $DIR/dst-bad-assign-2.rs:35:5 | LL | f5.ptr = *z; | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn ToBar` - = note: to learn more, visit + = note: to learn more, visit = note: the left-hand-side of an assignment must have a statically known size error: aborting due to previous error diff --git a/src/test/ui/dst/dst-bad-assign-3.rs b/src/test/ui/dst/dst-bad-assign-3.rs index 339cfb5443d..5124abc7d82 100644 --- a/src/test/ui/dst/dst-bad-assign-3.rs +++ b/src/test/ui/dst/dst-bad-assign-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Forbid assignment into a dynamically sized type. #![feature(unsized_tuple_coercion)] diff --git a/src/test/ui/dst/dst-bad-assign-3.stderr b/src/test/ui/dst/dst-bad-assign-3.stderr index ec172fae7a6..0c4f8661319 100644 --- a/src/test/ui/dst/dst-bad-assign-3.stderr +++ b/src/test/ui/dst/dst-bad-assign-3.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/dst-bad-assign-3.rs:43:12 + --> $DIR/dst-bad-assign-3.rs:33:12 | LL | f5.2 = Bar1 {f: 36}; | ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1` @@ -8,13 +8,13 @@ LL | f5.2 = Bar1 {f: 36}; found type `Bar1` error[E0277]: the size for values of type `dyn ToBar` cannot be known at compilation time - --> $DIR/dst-bad-assign-3.rs:43:5 + --> $DIR/dst-bad-assign-3.rs:33:5 | LL | f5.2 = Bar1 {f: 36}; | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn ToBar` - = note: to learn more, visit + = note: to learn more, visit = note: the left-hand-side of an assignment must have a statically known size error: aborting due to 2 previous errors diff --git a/src/test/ui/dst/dst-bad-assign.rs b/src/test/ui/dst/dst-bad-assign.rs index 9a329c636ae..003c80b4dc4 100644 --- a/src/test/ui/dst/dst-bad-assign.rs +++ b/src/test/ui/dst/dst-bad-assign.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Forbid assignment into a dynamically sized type. struct Fat { diff --git a/src/test/ui/dst/dst-bad-assign.stderr b/src/test/ui/dst/dst-bad-assign.stderr index 72f28af5175..a60d9d66f39 100644 --- a/src/test/ui/dst/dst-bad-assign.stderr +++ b/src/test/ui/dst/dst-bad-assign.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/dst-bad-assign.rs:45:14 + --> $DIR/dst-bad-assign.rs:35:14 | LL | f5.ptr = Bar1 {f: 36}; | ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1` @@ -8,13 +8,13 @@ LL | f5.ptr = Bar1 {f: 36}; found type `Bar1` error[E0277]: the size for values of type `dyn ToBar` cannot be known at compilation time - --> $DIR/dst-bad-assign.rs:45:5 + --> $DIR/dst-bad-assign.rs:35:5 | LL | f5.ptr = Bar1 {f: 36}; | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn ToBar` - = note: to learn more, visit + = note: to learn more, visit = note: the left-hand-side of an assignment must have a statically known size error: aborting due to 2 previous errors diff --git a/src/test/ui/dst/dst-bad-coerce1.rs b/src/test/ui/dst/dst-bad-coerce1.rs index b0de84a5300..8ca34234c03 100644 --- a/src/test/ui/dst/dst-bad-coerce1.rs +++ b/src/test/ui/dst/dst-bad-coerce1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Attempt to change the type as well as unsizing. #![feature(unsized_tuple_coercion)] diff --git a/src/test/ui/dst/dst-bad-coerce1.stderr b/src/test/ui/dst/dst-bad-coerce1.stderr index bb59c4d5617..34b2d6d3d8b 100644 --- a/src/test/ui/dst/dst-bad-coerce1.stderr +++ b/src/test/ui/dst/dst-bad-coerce1.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/dst-bad-coerce1.rs:26:29 + --> $DIR/dst-bad-coerce1.rs:16:29 | LL | let f3: &Fat<[usize]> = f2; | ^^ expected slice, found array of 3 elements @@ -8,7 +8,7 @@ LL | let f3: &Fat<[usize]> = f2; found type `&Fat<[isize; 3]>` error[E0277]: the trait bound `Foo: Bar` is not satisfied - --> $DIR/dst-bad-coerce1.rs:32:25 + --> $DIR/dst-bad-coerce1.rs:22:25 | LL | let f3: &Fat = f2; | ^^ the trait `Bar` is not implemented for `Foo` @@ -16,7 +16,7 @@ LL | let f3: &Fat = f2; = note: required for the cast to the object type `dyn Bar` error[E0308]: mismatched types - --> $DIR/dst-bad-coerce1.rs:38:27 + --> $DIR/dst-bad-coerce1.rs:28:27 | LL | let f3: &([usize],) = f2; | ^^ expected slice, found array of 3 elements @@ -25,7 +25,7 @@ LL | let f3: &([usize],) = f2; found type `&([isize; 3],)` error[E0277]: the trait bound `Foo: Bar` is not satisfied - --> $DIR/dst-bad-coerce1.rs:44:23 + --> $DIR/dst-bad-coerce1.rs:34:23 | LL | let f3: &(Bar,) = f2; | ^^ the trait `Bar` is not implemented for `Foo` diff --git a/src/test/ui/dst/dst-bad-coerce2.rs b/src/test/ui/dst/dst-bad-coerce2.rs index 9e92f649b2d..2bc7ecced0a 100644 --- a/src/test/ui/dst/dst-bad-coerce2.rs +++ b/src/test/ui/dst/dst-bad-coerce2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Attempt to change the mutability as well as unsizing. struct Fat { diff --git a/src/test/ui/dst/dst-bad-coerce2.stderr b/src/test/ui/dst/dst-bad-coerce2.stderr index 51991544a2e..6fb5c4b32ef 100644 --- a/src/test/ui/dst/dst-bad-coerce2.stderr +++ b/src/test/ui/dst/dst-bad-coerce2.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/dst-bad-coerce2.rs:25:33 + --> $DIR/dst-bad-coerce2.rs:15:33 | LL | let f3: &mut Fat<[isize]> = f2; //~ ERROR mismatched types | ^^ types differ in mutability @@ -8,7 +8,7 @@ LL | let f3: &mut Fat<[isize]> = f2; //~ ERROR mismatched types found type `&Fat<[isize; 3]>` error[E0308]: mismatched types - --> $DIR/dst-bad-coerce2.rs:30:29 + --> $DIR/dst-bad-coerce2.rs:20:29 | LL | let f3: &mut Fat = f2; //~ ERROR mismatched types | ^^ types differ in mutability @@ -17,7 +17,7 @@ LL | let f3: &mut Fat = f2; //~ ERROR mismatched types found type `&Fat` error[E0308]: mismatched types - --> $DIR/dst-bad-coerce2.rs:35:31 + --> $DIR/dst-bad-coerce2.rs:25:31 | LL | let f3: &mut ([isize],) = f2; //~ ERROR mismatched types | ^^ types differ in mutability @@ -26,7 +26,7 @@ LL | let f3: &mut ([isize],) = f2; //~ ERROR mismatched types found type `&([isize; 3],)` error[E0308]: mismatched types - --> $DIR/dst-bad-coerce2.rs:40:27 + --> $DIR/dst-bad-coerce2.rs:30:27 | LL | let f3: &mut (Bar,) = f2; //~ ERROR mismatched types | ^^ types differ in mutability diff --git a/src/test/ui/dst/dst-bad-coerce3.nll.stderr b/src/test/ui/dst/dst-bad-coerce3.nll.stderr index 4f85266e3fd..8f1289845e3 100644 --- a/src/test/ui/dst/dst-bad-coerce3.nll.stderr +++ b/src/test/ui/dst/dst-bad-coerce3.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `f1` does not live long enough - --> $DIR/dst-bad-coerce3.rs:26:32 + --> $DIR/dst-bad-coerce3.rs:16:32 | LL | fn baz<'a>() { | -- lifetime `'a` defined here @@ -13,7 +13,7 @@ LL | } | - `f1` dropped here while still borrowed error[E0597]: `f1` does not live long enough - --> $DIR/dst-bad-coerce3.rs:31:25 + --> $DIR/dst-bad-coerce3.rs:21:25 | LL | fn baz<'a>() { | -- lifetime `'a` defined here @@ -27,7 +27,7 @@ LL | } | - `f1` dropped here while still borrowed error[E0597]: `f1` does not live long enough - --> $DIR/dst-bad-coerce3.rs:36:30 + --> $DIR/dst-bad-coerce3.rs:26:30 | LL | fn baz<'a>() { | -- lifetime `'a` defined here @@ -41,7 +41,7 @@ LL | } | - `f1` dropped here while still borrowed error[E0597]: `f1` does not live long enough - --> $DIR/dst-bad-coerce3.rs:41:23 + --> $DIR/dst-bad-coerce3.rs:31:23 | LL | fn baz<'a>() { | -- lifetime `'a` defined here diff --git a/src/test/ui/dst/dst-bad-coerce3.rs b/src/test/ui/dst/dst-bad-coerce3.rs index 35a147c15bb..58c988520eb 100644 --- a/src/test/ui/dst/dst-bad-coerce3.rs +++ b/src/test/ui/dst/dst-bad-coerce3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Attempt to extend the lifetime as well as unsizing. #![feature(unsized_tuple_coercion)] diff --git a/src/test/ui/dst/dst-bad-coerce3.stderr b/src/test/ui/dst/dst-bad-coerce3.stderr index 3c4eb272082..701a869ee91 100644 --- a/src/test/ui/dst/dst-bad-coerce3.stderr +++ b/src/test/ui/dst/dst-bad-coerce3.stderr @@ -1,5 +1,5 @@ error[E0597]: `f1` does not live long enough - --> $DIR/dst-bad-coerce3.rs:26:33 + --> $DIR/dst-bad-coerce3.rs:16:33 | LL | let f2: &Fat<[isize; 3]> = &f1; //~ ERROR `f1` does not live long enough | ^^ borrowed value does not live long enough @@ -7,14 +7,14 @@ LL | let f2: &Fat<[isize; 3]> = &f1; //~ ERROR `f1` does not live long enoug LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:8... - --> $DIR/dst-bad-coerce3.rs:23:8 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:8... + --> $DIR/dst-bad-coerce3.rs:13:8 | LL | fn baz<'a>() { | ^^ error[E0597]: `f1` does not live long enough - --> $DIR/dst-bad-coerce3.rs:31:26 + --> $DIR/dst-bad-coerce3.rs:21:26 | LL | let f2: &Fat = &f1; //~ ERROR `f1` does not live long enough | ^^ borrowed value does not live long enough @@ -22,14 +22,14 @@ LL | let f2: &Fat = &f1; //~ ERROR `f1` does not live long enough LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:8... - --> $DIR/dst-bad-coerce3.rs:23:8 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:8... + --> $DIR/dst-bad-coerce3.rs:13:8 | LL | fn baz<'a>() { | ^^ error[E0597]: `f1` does not live long enough - --> $DIR/dst-bad-coerce3.rs:36:31 + --> $DIR/dst-bad-coerce3.rs:26:31 | LL | let f2: &([isize; 3],) = &f1; //~ ERROR `f1` does not live long enough | ^^ borrowed value does not live long enough @@ -37,14 +37,14 @@ LL | let f2: &([isize; 3],) = &f1; //~ ERROR `f1` does not live long enough LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:8... - --> $DIR/dst-bad-coerce3.rs:23:8 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:8... + --> $DIR/dst-bad-coerce3.rs:13:8 | LL | fn baz<'a>() { | ^^ error[E0597]: `f1` does not live long enough - --> $DIR/dst-bad-coerce3.rs:41:24 + --> $DIR/dst-bad-coerce3.rs:31:24 | LL | let f2: &(Foo,) = &f1; //~ ERROR `f1` does not live long enough | ^^ borrowed value does not live long enough @@ -52,8 +52,8 @@ LL | let f3: &'a (Bar,) = f2; LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:8... - --> $DIR/dst-bad-coerce3.rs:23:8 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:8... + --> $DIR/dst-bad-coerce3.rs:13:8 | LL | fn baz<'a>() { | ^^ diff --git a/src/test/ui/dst/dst-bad-coerce4.rs b/src/test/ui/dst/dst-bad-coerce4.rs index 874b7588ff9..9635e1e3380 100644 --- a/src/test/ui/dst/dst-bad-coerce4.rs +++ b/src/test/ui/dst/dst-bad-coerce4.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Attempt to coerce from unsized to sized. #![feature(unsized_tuple_coercion)] diff --git a/src/test/ui/dst/dst-bad-coerce4.stderr b/src/test/ui/dst/dst-bad-coerce4.stderr index 279de13cf37..fbf59ae5c66 100644 --- a/src/test/ui/dst/dst-bad-coerce4.stderr +++ b/src/test/ui/dst/dst-bad-coerce4.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/dst-bad-coerce4.rs:22:32 + --> $DIR/dst-bad-coerce4.rs:12:32 | LL | let f2: &Fat<[isize; 3]> = f1; | ^^ expected array of 3 elements, found slice @@ -8,7 +8,7 @@ LL | let f2: &Fat<[isize; 3]> = f1; found type `&Fat<[isize]>` error[E0308]: mismatched types - --> $DIR/dst-bad-coerce4.rs:30:30 + --> $DIR/dst-bad-coerce4.rs:20:30 | LL | let f2: &([isize; 3],) = f1; | ^^ expected array of 3 elements, found slice diff --git a/src/test/ui/dst/dst-bad-coercions.rs b/src/test/ui/dst/dst-bad-coercions.rs index 883c16b0895..9aa697225d5 100644 --- a/src/test/ui/dst/dst-bad-coercions.rs +++ b/src/test/ui/dst/dst-bad-coercions.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test implicit coercions involving DSTs and raw pointers. struct S; diff --git a/src/test/ui/dst/dst-bad-coercions.stderr b/src/test/ui/dst/dst-bad-coercions.stderr index 8901ef1caaa..df223b7cb96 100644 --- a/src/test/ui/dst/dst-bad-coercions.stderr +++ b/src/test/ui/dst/dst-bad-coercions.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:24:17 + --> $DIR/dst-bad-coercions.rs:14:17 | LL | let y: &S = x; //~ ERROR mismatched types | ^ expected &S, found *-ptr @@ -8,7 +8,7 @@ LL | let y: &S = x; //~ ERROR mismatched types found type `*const S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:25:17 + --> $DIR/dst-bad-coercions.rs:15:17 | LL | let y: &T = x; //~ ERROR mismatched types | ^ @@ -20,7 +20,7 @@ LL | let y: &T = x; //~ ERROR mismatched types found type `*const S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:29:17 + --> $DIR/dst-bad-coercions.rs:19:17 | LL | let y: &S = x; //~ ERROR mismatched types | ^ expected &S, found *-ptr @@ -29,7 +29,7 @@ LL | let y: &S = x; //~ ERROR mismatched types found type `*mut S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:30:17 + --> $DIR/dst-bad-coercions.rs:20:17 | LL | let y: &T = x; //~ ERROR mismatched types | ^ @@ -41,7 +41,7 @@ LL | let y: &T = x; //~ ERROR mismatched types found type `*mut S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:33:21 + --> $DIR/dst-bad-coercions.rs:23:21 | LL | let x: &mut T = &S; //~ ERROR mismatched types | ^^ types differ in mutability @@ -50,7 +50,7 @@ LL | let x: &mut T = &S; //~ ERROR mismatched types found type `&S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:34:21 + --> $DIR/dst-bad-coercions.rs:24:21 | LL | let x: *mut T = &S; //~ ERROR mismatched types | ^^ types differ in mutability @@ -59,7 +59,7 @@ LL | let x: *mut T = &S; //~ ERROR mismatched types found type `&S` error[E0308]: mismatched types - --> $DIR/dst-bad-coercions.rs:35:21 + --> $DIR/dst-bad-coercions.rs:25:21 | LL | let x: *mut S = &S; //~ ERROR mismatched types | ^^ types differ in mutability diff --git a/src/test/ui/dst/dst-bad-deep-2.rs b/src/test/ui/dst/dst-bad-deep-2.rs index a54301071ba..e587399135d 100644 --- a/src/test/ui/dst/dst-bad-deep-2.rs +++ b/src/test/ui/dst/dst-bad-deep-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Try to initialise a DST struct where the lost information is deeply nested. // This is an error because it requires an unsized rvalue. This is a problem // because it would require stack allocation of an unsized temporary (*g in the diff --git a/src/test/ui/dst/dst-bad-deep-2.stderr b/src/test/ui/dst/dst-bad-deep-2.stderr index 2c0a540f25a..cb2735147a3 100644 --- a/src/test/ui/dst/dst-bad-deep-2.stderr +++ b/src/test/ui/dst/dst-bad-deep-2.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `[isize]` cannot be known at compilation time - --> $DIR/dst-bad-deep-2.rs:21:30 + --> $DIR/dst-bad-deep-2.rs:11:30 | LL | let h: &(([isize],),) = &(*g,); | ^^^^^ doesn't have a size known at compile-time | = help: within `(([isize],),)`, the trait `std::marker::Sized` is not implemented for `[isize]` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `([isize],)` = note: required because it appears within the type `(([isize],),)` = note: tuples must have a statically known size to be initialized diff --git a/src/test/ui/dst/dst-bad-deep.rs b/src/test/ui/dst/dst-bad-deep.rs index 3d7e2b8f671..a4267296082 100644 --- a/src/test/ui/dst/dst-bad-deep.rs +++ b/src/test/ui/dst/dst-bad-deep.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Try to initialise a DST struct where the lost information is deeply nested. // This is an error because it requires an unsized rvalue. This is a problem // because it would require stack allocation of an unsized temporary (*g in the diff --git a/src/test/ui/dst/dst-bad-deep.stderr b/src/test/ui/dst/dst-bad-deep.stderr index 2ac8cb325a1..521adf601cc 100644 --- a/src/test/ui/dst/dst-bad-deep.stderr +++ b/src/test/ui/dst/dst-bad-deep.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `[isize]` cannot be known at compilation time - --> $DIR/dst-bad-deep.rs:23:34 + --> $DIR/dst-bad-deep.rs:13:34 | LL | let h: &Fat> = &Fat { ptr: *g }; | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Fat>`, the trait `std::marker::Sized` is not implemented for `[isize]` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `Fat<[isize]>` = note: required because it appears within the type `Fat>` = note: structs must have a statically known size to be initialized diff --git a/src/test/ui/dst/dst-index.nll.stderr b/src/test/ui/dst/dst-index.nll.stderr index 0aa85d3ed7a..92e3d2b684a 100644 --- a/src/test/ui/dst/dst-index.nll.stderr +++ b/src/test/ui/dst/dst-index.nll.stderr @@ -1,23 +1,23 @@ error[E0161]: cannot move a value of type str: the size of str cannot be statically determined - --> $DIR/dst-index.rs:41:5 + --> $DIR/dst-index.rs:31:5 | LL | S[0]; | ^^^^ error[E0161]: cannot move a value of type dyn std::fmt::Debug: the size of dyn std::fmt::Debug cannot be statically determined - --> $DIR/dst-index.rs:44:5 + --> $DIR/dst-index.rs:34:5 | LL | T[0]; | ^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dst-index.rs:41:5 + --> $DIR/dst-index.rs:31:5 | LL | S[0]; | ^^^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/dst-index.rs:44:5 + --> $DIR/dst-index.rs:34:5 | LL | T[0]; | ^^^^ cannot move out of borrowed content diff --git a/src/test/ui/dst/dst-index.rs b/src/test/ui/dst/dst-index.rs index c52458934bd..663c704ff39 100644 --- a/src/test/ui/dst/dst-index.rs +++ b/src/test/ui/dst/dst-index.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that overloaded index expressions with DST result types // can't be used as rvalues diff --git a/src/test/ui/dst/dst-index.stderr b/src/test/ui/dst/dst-index.stderr index 7c5e79dab99..05993f50fa1 100644 --- a/src/test/ui/dst/dst-index.stderr +++ b/src/test/ui/dst/dst-index.stderr @@ -1,23 +1,23 @@ error[E0161]: cannot move a value of type str: the size of str cannot be statically determined - --> $DIR/dst-index.rs:41:5 + --> $DIR/dst-index.rs:31:5 | LL | S[0]; | ^^^^ error[E0161]: cannot move a value of type (dyn std::fmt::Debug + 'static): the size of (dyn std::fmt::Debug + 'static) cannot be statically determined - --> $DIR/dst-index.rs:44:5 + --> $DIR/dst-index.rs:34:5 | LL | T[0]; | ^^^^ error[E0507]: cannot move out of indexed content - --> $DIR/dst-index.rs:41:5 + --> $DIR/dst-index.rs:31:5 | LL | S[0]; | ^^^^ cannot move out of indexed content error[E0507]: cannot move out of indexed content - --> $DIR/dst-index.rs:44:5 + --> $DIR/dst-index.rs:34:5 | LL | T[0]; | ^^^^ cannot move out of indexed content diff --git a/src/test/ui/dst/dst-object-from-unsized-type.rs b/src/test/ui/dst/dst-object-from-unsized-type.rs index 70b46b1bd79..f4ee1783a2e 100644 --- a/src/test/ui/dst/dst-object-from-unsized-type.rs +++ b/src/test/ui/dst/dst-object-from-unsized-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we cannot create objects from unsized types. trait Foo { fn foo(&self) {} } diff --git a/src/test/ui/dst/dst-object-from-unsized-type.stderr b/src/test/ui/dst/dst-object-from-unsized-type.stderr index 862c52e43c0..4851ca10828 100644 --- a/src/test/ui/dst/dst-object-from-unsized-type.stderr +++ b/src/test/ui/dst/dst-object-from-unsized-type.stderr @@ -1,43 +1,43 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/dst-object-from-unsized-type.rs:18:19 + --> $DIR/dst-object-from-unsized-type.rs:8:19 | LL | let u: &Foo = t; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/dst-object-from-unsized-type.rs:23:19 + --> $DIR/dst-object-from-unsized-type.rs:13:19 | LL | let v: &Foo = t as &Foo; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/dst-object-from-unsized-type.rs:28:24 + --> $DIR/dst-object-from-unsized-type.rs:18:24 | LL | let _: &[&Foo] = &["hi"]; | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/dst-object-from-unsized-type.rs:33:19 + --> $DIR/dst-object-from-unsized-type.rs:23:19 | LL | let _: &Foo = x as &Foo; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit + = note: to learn more, visit = note: required for the cast to the object type `dyn Foo` error: aborting due to 4 previous errors diff --git a/src/test/ui/dst/dst-rvalue.nll.stderr b/src/test/ui/dst/dst-rvalue.nll.stderr index b120da773a2..d0d8f793959 100644 --- a/src/test/ui/dst/dst-rvalue.nll.stderr +++ b/src/test/ui/dst/dst-rvalue.nll.stderr @@ -1,23 +1,23 @@ error[E0161]: cannot move a value of type str: the size of str cannot be statically determined - --> $DIR/dst-rvalue.rs:16:28 + --> $DIR/dst-rvalue.rs:6:28 | LL | let _x: Box = box *"hello world"; | ^^^^^^^^^^^^^^ error[E0161]: cannot move a value of type [isize]: the size of [isize] cannot be statically determined - --> $DIR/dst-rvalue.rs:21:32 + --> $DIR/dst-rvalue.rs:11:32 | LL | let _x: Box<[isize]> = box *array; | ^^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dst-rvalue.rs:16:28 + --> $DIR/dst-rvalue.rs:6:28 | LL | let _x: Box = box *"hello world"; | ^^^^^^^^^^^^^^ cannot move out of borrowed content error[E0508]: cannot move out of type `[isize]`, a non-copy slice - --> $DIR/dst-rvalue.rs:21:32 + --> $DIR/dst-rvalue.rs:11:32 | LL | let _x: Box<[isize]> = box *array; | ^^^^^^ cannot move out of here diff --git a/src/test/ui/dst/dst-rvalue.rs b/src/test/ui/dst/dst-rvalue.rs index 69bda8c1671..86747dad00d 100644 --- a/src/test/ui/dst/dst-rvalue.rs +++ b/src/test/ui/dst/dst-rvalue.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that dynamically sized rvalues are forbidden #![feature(box_syntax)] diff --git a/src/test/ui/dst/dst-rvalue.stderr b/src/test/ui/dst/dst-rvalue.stderr index 0957105c8a7..2c92f5dcbf5 100644 --- a/src/test/ui/dst/dst-rvalue.stderr +++ b/src/test/ui/dst/dst-rvalue.stderr @@ -1,23 +1,23 @@ error[E0161]: cannot move a value of type str: the size of str cannot be statically determined - --> $DIR/dst-rvalue.rs:16:28 + --> $DIR/dst-rvalue.rs:6:28 | LL | let _x: Box = box *"hello world"; | ^^^^^^^^^^^^^^ error[E0161]: cannot move a value of type [isize]: the size of [isize] cannot be statically determined - --> $DIR/dst-rvalue.rs:21:32 + --> $DIR/dst-rvalue.rs:11:32 | LL | let _x: Box<[isize]> = box *array; | ^^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/dst-rvalue.rs:16:28 + --> $DIR/dst-rvalue.rs:6:28 | LL | let _x: Box = box *"hello world"; | ^^^^^^^^^^^^^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/dst-rvalue.rs:21:32 + --> $DIR/dst-rvalue.rs:11:32 | LL | let _x: Box<[isize]> = box *array; | ^^^^^^ cannot move out of borrowed content diff --git a/src/test/ui/dst/dst-sized-trait-param.rs b/src/test/ui/dst/dst-sized-trait-param.rs index 7316a48970f..cfd59197bec 100644 --- a/src/test/ui/dst/dst-sized-trait-param.rs +++ b/src/test/ui/dst/dst-sized-trait-param.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that when you implement a trait that has a sized type // parameter, the corresponding value must be sized. Also that the // self type must be sized if appropriate. diff --git a/src/test/ui/dst/dst-sized-trait-param.stderr b/src/test/ui/dst/dst-sized-trait-param.stderr index 47f8215d526..40dc9978f36 100644 --- a/src/test/ui/dst/dst-sized-trait-param.stderr +++ b/src/test/ui/dst/dst-sized-trait-param.stderr @@ -1,20 +1,20 @@ error[E0277]: the size for values of type `[isize]` cannot be known at compilation time - --> $DIR/dst-sized-trait-param.rs:17:6 + --> $DIR/dst-sized-trait-param.rs:7:6 | LL | impl Foo<[isize]> for usize { } | ^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[isize]` - = note: to learn more, visit + = note: to learn more, visit error[E0277]: the size for values of type `[usize]` cannot be known at compilation time - --> $DIR/dst-sized-trait-param.rs:20:6 + --> $DIR/dst-sized-trait-param.rs:10:6 | LL | impl Foo for [usize] { } | ^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[usize]` - = note: to learn more, visit + = note: to learn more, visit error: aborting due to 2 previous errors diff --git a/src/test/ui/duplicate/dupe-symbols-1.rs b/src/test/ui/duplicate/dupe-symbols-1.rs index 9fa4eafcad0..f943c7b1110 100644 --- a/src/test/ui/duplicate/dupe-symbols-1.rs +++ b/src/test/ui/duplicate/dupe-symbols-1.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // #![crate_type="rlib"] #![allow(warnings)] diff --git a/src/test/ui/duplicate/dupe-symbols-1.stderr b/src/test/ui/duplicate/dupe-symbols-1.stderr index c702a0f3a1b..58aa1e433d1 100644 --- a/src/test/ui/duplicate/dupe-symbols-1.stderr +++ b/src/test/ui/duplicate/dupe-symbols-1.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/dupe-symbols-1.rs:19:1 + --> $DIR/dupe-symbols-1.rs:10:1 | LL | / pub fn b() { LL | | //~^ symbol `fail` is already defined diff --git a/src/test/ui/duplicate/dupe-symbols-2.rs b/src/test/ui/duplicate/dupe-symbols-2.rs index 1f19bd2f249..9257f97fb93 100644 --- a/src/test/ui/duplicate/dupe-symbols-2.rs +++ b/src/test/ui/duplicate/dupe-symbols-2.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // #![crate_type="rlib"] #![allow(warnings)] diff --git a/src/test/ui/duplicate/dupe-symbols-2.stderr b/src/test/ui/duplicate/dupe-symbols-2.stderr index 5d5e9d73d7b..65185cd5429 100644 --- a/src/test/ui/duplicate/dupe-symbols-2.stderr +++ b/src/test/ui/duplicate/dupe-symbols-2.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/dupe-symbols-2.rs:22:5 + --> $DIR/dupe-symbols-2.rs:13:5 | LL | / pub extern fn fail() { LL | | //~^ symbol `fail` is already defined diff --git a/src/test/ui/duplicate/dupe-symbols-3.rs b/src/test/ui/duplicate/dupe-symbols-3.rs index 98a61c33c58..03b3a0ab207 100644 --- a/src/test/ui/duplicate/dupe-symbols-3.rs +++ b/src/test/ui/duplicate/dupe-symbols-3.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // #![crate_type="rlib"] #![allow(warnings)] diff --git a/src/test/ui/duplicate/dupe-symbols-3.stderr b/src/test/ui/duplicate/dupe-symbols-3.stderr index 6801016373d..5cd618bc9f6 100644 --- a/src/test/ui/duplicate/dupe-symbols-3.stderr +++ b/src/test/ui/duplicate/dupe-symbols-3.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/dupe-symbols-3.rs:19:1 + --> $DIR/dupe-symbols-3.rs:10:1 | LL | / pub fn fail() { LL | | //~^ symbol `fail` is already defined diff --git a/src/test/ui/duplicate/dupe-symbols-4.rs b/src/test/ui/duplicate/dupe-symbols-4.rs index 9e730699d25..8fbf1151f7c 100644 --- a/src/test/ui/duplicate/dupe-symbols-4.rs +++ b/src/test/ui/duplicate/dupe-symbols-4.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // error-pattern: symbol `fail` is already defined #![crate_type="rlib"] diff --git a/src/test/ui/duplicate/dupe-symbols-4.stderr b/src/test/ui/duplicate/dupe-symbols-4.stderr index fdbb5ce90c1..84d57766c35 100644 --- a/src/test/ui/duplicate/dupe-symbols-4.stderr +++ b/src/test/ui/duplicate/dupe-symbols-4.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/dupe-symbols-4.rs:30:5 + --> $DIR/dupe-symbols-4.rs:21:5 | LL | fn fail(self) {} | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/duplicate/dupe-symbols-5.rs b/src/test/ui/duplicate/dupe-symbols-5.rs index eb4b50d03ca..4a96a685821 100644 --- a/src/test/ui/duplicate/dupe-symbols-5.rs +++ b/src/test/ui/duplicate/dupe-symbols-5.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // #![crate_type="rlib"] #![allow(warnings)] diff --git a/src/test/ui/duplicate/dupe-symbols-5.stderr b/src/test/ui/duplicate/dupe-symbols-5.stderr index 8ded374127b..3acfdd22a9a 100644 --- a/src/test/ui/duplicate/dupe-symbols-5.stderr +++ b/src/test/ui/duplicate/dupe-symbols-5.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/dupe-symbols-5.rs:18:1 + --> $DIR/dupe-symbols-5.rs:9:1 | LL | / pub fn b() { LL | | //~^ symbol `fail` is already defined diff --git a/src/test/ui/duplicate/dupe-symbols-6.rs b/src/test/ui/duplicate/dupe-symbols-6.rs index 6f412d9a0de..5a1b917f179 100644 --- a/src/test/ui/duplicate/dupe-symbols-6.rs +++ b/src/test/ui/duplicate/dupe-symbols-6.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![crate_type="rlib"] #![allow(warnings)] diff --git a/src/test/ui/duplicate/dupe-symbols-6.stderr b/src/test/ui/duplicate/dupe-symbols-6.stderr index 6dbb831832a..69781ee3e0d 100644 --- a/src/test/ui/duplicate/dupe-symbols-6.stderr +++ b/src/test/ui/duplicate/dupe-symbols-6.stderr @@ -1,5 +1,5 @@ error: symbol `fail` is already defined - --> $DIR/dupe-symbols-6.rs:17:1 + --> $DIR/dupe-symbols-6.rs:8:1 | LL | static HELLO_TWICE: u16 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/duplicate/dupe-symbols-7.rs b/src/test/ui/duplicate/dupe-symbols-7.rs index c2880ba6f51..b28f1a40fe9 100644 --- a/src/test/ui/duplicate/dupe-symbols-7.rs +++ b/src/test/ui/duplicate/dupe-symbols-7.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // error-pattern: entry symbol `main` defined multiple times #![allow(warnings)] diff --git a/src/test/ui/duplicate/dupe-symbols-7.stderr b/src/test/ui/duplicate/dupe-symbols-7.stderr index 5fadbd5bd10..a1dbbb0c685 100644 --- a/src/test/ui/duplicate/dupe-symbols-7.stderr +++ b/src/test/ui/duplicate/dupe-symbols-7.stderr @@ -1,5 +1,5 @@ error: entry symbol `main` defined multiple times - --> $DIR/dupe-symbols-7.rs:15:1 + --> $DIR/dupe-symbols-7.rs:6:1 | LL | fn main(){} | ^^^^^^^^^^^ diff --git a/src/test/ui/duplicate/duplicate-check-macro-exports.rs b/src/test/ui/duplicate/duplicate-check-macro-exports.rs index 42b2b1d650f..9ba28acfdee 100644 --- a/src/test/ui/duplicate/duplicate-check-macro-exports.rs +++ b/src/test/ui/duplicate/duplicate-check-macro-exports.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use std::panic; #[macro_export] diff --git a/src/test/ui/duplicate/duplicate-check-macro-exports.stderr b/src/test/ui/duplicate/duplicate-check-macro-exports.stderr index eced6b303e8..97ee9b9b05f 100644 --- a/src/test/ui/duplicate/duplicate-check-macro-exports.stderr +++ b/src/test/ui/duplicate/duplicate-check-macro-exports.stderr @@ -1,5 +1,5 @@ error[E0255]: the name `panic` is defined multiple times - --> $DIR/duplicate-check-macro-exports.rs:14:1 + --> $DIR/duplicate-check-macro-exports.rs:4:1 | LL | pub use std::panic; | ---------- previous import of the macro `panic` here diff --git a/src/test/ui/duplicate/duplicate-parameter.rs b/src/test/ui/duplicate/duplicate-parameter.rs index 7586bc61cd6..e5b21bbcd9f 100644 --- a/src/test/ui/duplicate/duplicate-parameter.rs +++ b/src/test/ui/duplicate/duplicate-parameter.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f(a: isize, a: isize) {} //~^ ERROR identifier `a` is bound more than once in this parameter list diff --git a/src/test/ui/duplicate/duplicate-parameter.stderr b/src/test/ui/duplicate/duplicate-parameter.stderr index 6cc7244ea79..f3ef0bcf3a0 100644 --- a/src/test/ui/duplicate/duplicate-parameter.stderr +++ b/src/test/ui/duplicate/duplicate-parameter.stderr @@ -1,5 +1,5 @@ error[E0415]: identifier `a` is bound more than once in this parameter list - --> $DIR/duplicate-parameter.rs:11:16 + --> $DIR/duplicate-parameter.rs:1:16 | LL | fn f(a: isize, a: isize) {} | ^ used as parameter more than once diff --git a/src/test/ui/duplicate/duplicate-type-parameter.rs b/src/test/ui/duplicate/duplicate-type-parameter.rs index 3b0f8ee5bda..2751b3c8dc0 100644 --- a/src/test/ui/duplicate/duplicate-type-parameter.rs +++ b/src/test/ui/duplicate/duplicate-type-parameter.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type Foo = Option; //~^ ERROR the name `T` is already used diff --git a/src/test/ui/duplicate/duplicate-type-parameter.stderr b/src/test/ui/duplicate/duplicate-type-parameter.stderr index 186a1e52bb8..41750d4bb36 100644 --- a/src/test/ui/duplicate/duplicate-type-parameter.stderr +++ b/src/test/ui/duplicate/duplicate-type-parameter.stderr @@ -1,5 +1,5 @@ error[E0403]: the name `T` is already used for a type parameter in this type parameter list - --> $DIR/duplicate-type-parameter.rs:11:12 + --> $DIR/duplicate-type-parameter.rs:1:12 | LL | type Foo = Option; | - ^ already used @@ -7,7 +7,7 @@ LL | type Foo = Option; | first use of `T` error[E0403]: the name `T` is already used for a type parameter in this type parameter list - --> $DIR/duplicate-type-parameter.rs:14:14 + --> $DIR/duplicate-type-parameter.rs:4:14 | LL | struct Bar(T); | - ^ already used @@ -15,7 +15,7 @@ LL | struct Bar(T); | first use of `T` error[E0403]: the name `T` is already used for a type parameter in this type parameter list - --> $DIR/duplicate-type-parameter.rs:17:14 + --> $DIR/duplicate-type-parameter.rs:7:14 | LL | struct Baz { | - ^ already used @@ -23,7 +23,7 @@ LL | struct Baz { | first use of `T` error[E0403]: the name `T` is already used for a type parameter in this type parameter list - --> $DIR/duplicate-type-parameter.rs:22:12 + --> $DIR/duplicate-type-parameter.rs:12:12 | LL | enum Boo { | - ^ already used @@ -31,7 +31,7 @@ LL | enum Boo { | first use of `T` error[E0403]: the name `T` is already used for a type parameter in this type parameter list - --> $DIR/duplicate-type-parameter.rs:28:11 + --> $DIR/duplicate-type-parameter.rs:18:11 | LL | fn quux(x: T) {} | - ^ already used @@ -39,7 +39,7 @@ LL | fn quux(x: T) {} | first use of `T` error[E0403]: the name `T` is already used for a type parameter in this type parameter list - --> $DIR/duplicate-type-parameter.rs:31:13 + --> $DIR/duplicate-type-parameter.rs:21:13 | LL | trait Qux {} | - ^ already used @@ -47,7 +47,7 @@ LL | trait Qux {} | first use of `T` error[E0403]: the name `T` is already used for a type parameter in this type parameter list - --> $DIR/duplicate-type-parameter.rs:34:8 + --> $DIR/duplicate-type-parameter.rs:24:8 | LL | impl Qux for Option {} | - ^ already used @@ -55,7 +55,7 @@ LL | impl Qux for Option {} | first use of `T` error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates - --> $DIR/duplicate-type-parameter.rs:34:6 + --> $DIR/duplicate-type-parameter.rs:24:6 | LL | impl Qux for Option {} | ^ unconstrained type parameter diff --git a/src/test/ui/duplicate_entry_error.rs b/src/test/ui/duplicate_entry_error.rs index 176aa7cca53..62df42b1a68 100644 --- a/src/test/ui/duplicate_entry_error.rs +++ b/src/test/ui/duplicate_entry_error.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // note-pattern: first defined in crate `std`. // Test for issue #31788 and E0152 diff --git a/src/test/ui/duplicate_entry_error.stderr b/src/test/ui/duplicate_entry_error.stderr index b330d2f30f8..ddb11e19c03 100644 --- a/src/test/ui/duplicate_entry_error.stderr +++ b/src/test/ui/duplicate_entry_error.stderr @@ -1,5 +1,5 @@ error[E0152]: duplicate lang item found: `panic_impl`. - --> $DIR/duplicate_entry_error.rs:20:1 + --> $DIR/duplicate_entry_error.rs:10:1 | LL | / fn panic_impl(info: &PanicInfo) -> ! { LL | | //~^ ERROR: duplicate lang item found: `panic_impl`. diff --git a/src/test/ui/dyn-trait-compatibility.rs b/src/test/ui/dyn-trait-compatibility.rs index 4297e1b43d3..2a1cea6c348 100644 --- a/src/test/ui/dyn-trait-compatibility.rs +++ b/src/test/ui/dyn-trait-compatibility.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type A0 = dyn; //~^ ERROR cannot find type `dyn` in this scope type A1 = dyn::dyn; diff --git a/src/test/ui/dyn-trait-compatibility.stderr b/src/test/ui/dyn-trait-compatibility.stderr index 93048ccad6f..aef785a75b9 100644 --- a/src/test/ui/dyn-trait-compatibility.stderr +++ b/src/test/ui/dyn-trait-compatibility.stderr @@ -1,47 +1,47 @@ error[E0433]: failed to resolve: use of undeclared type or module `dyn` - --> $DIR/dyn-trait-compatibility.rs:13:11 + --> $DIR/dyn-trait-compatibility.rs:3:11 | LL | type A1 = dyn::dyn; | ^^^ use of undeclared type or module `dyn` error[E0433]: failed to resolve: use of undeclared type or module `dyn` - --> $DIR/dyn-trait-compatibility.rs:19:23 + --> $DIR/dyn-trait-compatibility.rs:9:23 | LL | type A3 = dyn<::dyn>; | ^^^ use of undeclared type or module `dyn` error[E0412]: cannot find type `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:11:11 + --> $DIR/dyn-trait-compatibility.rs:1:11 | LL | type A0 = dyn; | ^^^ not found in this scope error[E0412]: cannot find type `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:15:11 + --> $DIR/dyn-trait-compatibility.rs:5:11 | LL | type A2 = dyn; | ^^^ not found in this scope error[E0412]: cannot find type `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:15:15 + --> $DIR/dyn-trait-compatibility.rs:5:15 | LL | type A2 = dyn; | ^^^ not found in this scope error[E0412]: cannot find type `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:15:20 + --> $DIR/dyn-trait-compatibility.rs:5:20 | LL | type A2 = dyn; | ^^^ not found in this scope error[E0412]: cannot find type `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:19:11 + --> $DIR/dyn-trait-compatibility.rs:9:11 | LL | type A3 = dyn<::dyn>; | ^^^ not found in this scope error[E0412]: cannot find type `dyn` in this scope - --> $DIR/dyn-trait-compatibility.rs:19:16 + --> $DIR/dyn-trait-compatibility.rs:9:16 | LL | type A3 = dyn<::dyn>; | ^^^ not found in this scope diff --git a/src/test/ui/e0119/auxiliary/complex_impl_support.rs b/src/test/ui/e0119/auxiliary/complex_impl_support.rs index b30db966099..ad5bb107fc6 100644 --- a/src/test/ui/e0119/auxiliary/complex_impl_support.rs +++ b/src/test/ui/e0119/auxiliary/complex_impl_support.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker::PhantomData; pub trait External {} diff --git a/src/test/ui/e0119/auxiliary/issue_23563_a.rs b/src/test/ui/e0119/auxiliary/issue_23563_a.rs index 57a0da0248d..4e85bcc4ba6 100644 --- a/src/test/ui/e0119/auxiliary/issue_23563_a.rs +++ b/src/test/ui/e0119/auxiliary/issue_23563_a.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ref: https://github.com/rust-lang/rust/issues/23563#issuecomment-260751672 pub trait LolTo { diff --git a/src/test/ui/e0119/complex-impl.rs b/src/test/ui/e0119/complex-impl.rs index b8b30a28414..3cba39ecbf9 100644 --- a/src/test/ui/e0119/complex-impl.rs +++ b/src/test/ui/e0119/complex-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:complex_impl_support.rs extern crate complex_impl_support; diff --git a/src/test/ui/e0119/complex-impl.stderr b/src/test/ui/e0119/complex-impl.stderr index 1fc4c28d67c..fb0c94dcc3d 100644 --- a/src/test/ui/e0119/complex-impl.stderr +++ b/src/test/ui/e0119/complex-impl.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `complex_impl_support::External` for type `(Q, complex_impl_support::M<'_, '_, '_, std::boxed::Box<_>, _, _>)`: - --> $DIR/complex-impl.rs:19:1 + --> $DIR/complex-impl.rs:9:1 | LL | impl External for (Q, R) {} //~ ERROR must be used | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,8 +8,8 @@ LL | impl External for (Q, R) {} //~ ERROR must be used - impl<'a, 'b, 'c, T, U, V, W> complex_impl_support::External for (T, complex_impl_support::M<'a, 'b, 'c, std::boxed::Box, V, W>) where >::Output == V, ::Item == T, 'b : 'a, T : 'a, U: std::ops::FnOnce<(T,)>, U : 'static, V: std::iter::Iterator, V: std::clone::Clone, W: std::ops::Add, ::Output: std::marker::Copy; -error[E0210]: type parameter `R` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/complex-impl.rs:19:1 +error[E0210]: type parameter `R` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/complex-impl.rs:9:1 | LL | impl External for (Q, R) {} //~ ERROR must be used | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `R` must be used as the type parameter for some local type diff --git a/src/test/ui/e0119/conflict-with-std.rs b/src/test/ui/e0119/conflict-with-std.rs index ed9033ad53d..e639bc5db5e 100644 --- a/src/test/ui/e0119/conflict-with-std.rs +++ b/src/test/ui/e0119/conflict-with-std.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(try_from)] use std::marker::PhantomData; diff --git a/src/test/ui/e0119/conflict-with-std.stderr b/src/test/ui/e0119/conflict-with-std.stderr index e8b2c84c0df..c2ae321aa5e 100644 --- a/src/test/ui/e0119/conflict-with-std.stderr +++ b/src/test/ui/e0119/conflict-with-std.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::convert::AsRef` for type `std::boxed::Box`: - --> $DIR/conflict-with-std.rs:17:1 + --> $DIR/conflict-with-std.rs:7:1 | LL | impl AsRef for Box { //~ ERROR conflicting implementations | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | impl AsRef for Box { //~ ERROR conflicting implementations where T: ?Sized; error[E0119]: conflicting implementations of trait `std::convert::From` for type `S`: - --> $DIR/conflict-with-std.rs:24:1 + --> $DIR/conflict-with-std.rs:14:1 | LL | impl From for S { //~ ERROR conflicting implementations | ^^^^^^^^^^^^^^^^^^ @@ -18,14 +18,14 @@ LL | impl From for S { //~ ERROR conflicting implementations - impl std::convert::From for T; error[E0119]: conflicting implementations of trait `std::convert::TryFrom` for type `X`: - --> $DIR/conflict-with-std.rs:31:1 + --> $DIR/conflict-with-std.rs:21:1 | LL | impl TryFrom for X { //~ ERROR conflicting implementations | ^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl std::convert::TryFrom for T - where T: std::convert::From; + where U: std::convert::Into; error: aborting due to 3 previous errors diff --git a/src/test/ui/e0119/issue-23563.rs b/src/test/ui/e0119/issue-23563.rs index c6d03a4cfc0..a2804fcf1cc 100644 --- a/src/test/ui/e0119/issue-23563.rs +++ b/src/test/ui/e0119/issue-23563.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue_23563_a.rs // Ref: https://github.com/rust-lang/rust/issues/23563#issuecomment-260751672 diff --git a/src/test/ui/e0119/issue-23563.stderr b/src/test/ui/e0119/issue-23563.stderr index 0630b76882e..53f9a5e7064 100644 --- a/src/test/ui/e0119/issue-23563.stderr +++ b/src/test/ui/e0119/issue-23563.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `a::LolFrom<&[_]>` for type `LocalType<_>`: - --> $DIR/issue-23563.rs:23:1 + --> $DIR/issue-23563.rs:13:1 | LL | impl<'a, T> LolFrom<&'a [T]> for LocalType { //~ ERROR conflicting implementations of trait | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/e0119/issue-27403.rs b/src/test/ui/e0119/issue-27403.rs index 98953153faf..b03a564ffd4 100644 --- a/src/test/ui/e0119/issue-27403.rs +++ b/src/test/ui/e0119/issue-27403.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct GenX { inner: S, } diff --git a/src/test/ui/e0119/issue-27403.stderr b/src/test/ui/e0119/issue-27403.stderr index 9dea60a72b5..76c326fb205 100644 --- a/src/test/ui/e0119/issue-27403.stderr +++ b/src/test/ui/e0119/issue-27403.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::convert::Into<_>` for type `GenX<_>`: - --> $DIR/issue-27403.rs:15:1 + --> $DIR/issue-27403.rs:5:1 | LL | impl Into for GenX { //~ ERROR conflicting implementations | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/e0119/issue-28981.rs b/src/test/ui/e0119/issue-28981.rs index 8a52464ff50..c31b212b25a 100644 --- a/src/test/ui/e0119/issue-28981.rs +++ b/src/test/ui/e0119/issue-28981.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Deref; struct Foo; diff --git a/src/test/ui/e0119/issue-28981.stderr b/src/test/ui/e0119/issue-28981.stderr index 76ff88d6cc6..8b4cd9acac4 100644 --- a/src/test/ui/e0119/issue-28981.stderr +++ b/src/test/ui/e0119/issue-28981.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::ops::Deref` for type `&_`: - --> $DIR/issue-28981.rs:15:1 + --> $DIR/issue-28981.rs:5:1 | LL | impl Deref for Foo { } //~ ERROR must be used | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,8 +8,8 @@ LL | impl Deref for Foo { } //~ ERROR must be used - impl std::ops::Deref for &T where T: ?Sized; -error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/issue-28981.rs:15:1 +error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/issue-28981.rs:5:1 | LL | impl Deref for Foo { } //~ ERROR must be used | ^^^^^^^^^^^^^^^^^^^^^^^ type parameter `Foo` must be used as the type parameter for some local type diff --git a/src/test/ui/e0119/so-37347311.rs b/src/test/ui/e0119/so-37347311.rs index 933cdb3cd53..d5f624bc4d9 100644 --- a/src/test/ui/e0119/so-37347311.rs +++ b/src/test/ui/e0119/so-37347311.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ref: https://stackoverflow.com/q/37347311 trait Storage { diff --git a/src/test/ui/e0119/so-37347311.stderr b/src/test/ui/e0119/so-37347311.stderr index 6c14b200ee5..eb321668d13 100644 --- a/src/test/ui/e0119/so-37347311.stderr +++ b/src/test/ui/e0119/so-37347311.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::convert::From>` for type `MyError<_>`: - --> $DIR/so-37347311.rs:21:1 + --> $DIR/so-37347311.rs:11:1 | LL | impl From for MyError { //~ ERROR conflicting implementations | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/editions/auxiliary/absolute.rs b/src/test/ui/editions/auxiliary/absolute.rs new file mode 100644 index 00000000000..d596f97355f --- /dev/null +++ b/src/test/ui/editions/auxiliary/absolute.rs @@ -0,0 +1 @@ +pub struct Path; diff --git a/src/test/ui/editions/auxiliary/edition-extern-crate-allowed.rs b/src/test/ui/editions/auxiliary/edition-extern-crate-allowed.rs index d26ab6d3518..d11c69f812a 100644 --- a/src/test/ui/editions/auxiliary/edition-extern-crate-allowed.rs +++ b/src/test/ui/editions/auxiliary/edition-extern-crate-allowed.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // intentionally empty diff --git a/src/test/ui/editions/auxiliary/edition-imports-2015.rs b/src/test/ui/editions/auxiliary/edition-imports-2015.rs new file mode 100644 index 00000000000..c72331ca2e1 --- /dev/null +++ b/src/test/ui/editions/auxiliary/edition-imports-2015.rs @@ -0,0 +1,31 @@ +// edition:2015 + +#[macro_export] +macro_rules! gen_imports { () => { + use import::Path; + use std::collections::LinkedList; + + fn check_absolute() { + ::absolute::Path; + ::std::collections::LinkedList::::new(); + } +}} + +#[macro_export] +macro_rules! gen_glob { () => { + use *; +}} + +#[macro_export] +macro_rules! gen_gated { () => { + fn check_gated() { + enum E { A } + use E::*; + } +}} + +#[macro_export] +macro_rules! gen_ambiguous { () => { + use Ambiguous; + type A = ::edition_imports_2015::Path; +}} diff --git a/src/test/ui/editions/auxiliary/edition-imports-2018.rs b/src/test/ui/editions/auxiliary/edition-imports-2018.rs new file mode 100644 index 00000000000..b08dc499a0d --- /dev/null +++ b/src/test/ui/editions/auxiliary/edition-imports-2018.rs @@ -0,0 +1,17 @@ +// edition:2018 + +#[macro_export] +macro_rules! gen_imports { () => { + use import::Path; + use std::collections::LinkedList; + + fn check_absolute() { + ::absolute::Path; + ::std::collections::LinkedList::::new(); + } +}} + +#[macro_export] +macro_rules! gen_glob { () => { + use *; +}} diff --git a/src/test/ui/editions/auxiliary/edition-kw-macro-2015.rs b/src/test/ui/editions/auxiliary/edition-kw-macro-2015.rs index 9343312fdd8..7cfd128f2bf 100644 --- a/src/test/ui/editions/auxiliary/edition-kw-macro-2015.rs +++ b/src/test/ui/editions/auxiliary/edition-kw-macro-2015.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2015 #![allow(keyword_idents)] diff --git a/src/test/ui/editions/auxiliary/edition-kw-macro-2018.rs b/src/test/ui/editions/auxiliary/edition-kw-macro-2018.rs index 19a7b91624f..d07c0218db3 100644 --- a/src/test/ui/editions/auxiliary/edition-kw-macro-2018.rs +++ b/src/test/ui/editions/auxiliary/edition-kw-macro-2018.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 #![allow(keyword_idents)] diff --git a/src/test/ui/editions/edition-deny-overflowing-literals-2018.rs b/src/test/ui/editions/edition-deny-overflowing-literals-2018.rs index 48dfd24d50d..0527d75214a 100644 --- a/src/test/ui/editions/edition-deny-overflowing-literals-2018.rs +++ b/src/test/ui/editions/edition-deny-overflowing-literals-2018.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 fn main() { diff --git a/src/test/ui/editions/edition-deny-overflowing-literals-2018.stderr b/src/test/ui/editions/edition-deny-overflowing-literals-2018.stderr index 97f547abfa7..6d1d8568bcf 100644 --- a/src/test/ui/editions/edition-deny-overflowing-literals-2018.stderr +++ b/src/test/ui/editions/edition-deny-overflowing-literals-2018.stderr @@ -1,5 +1,5 @@ error: literal out of range for u8 - --> $DIR/edition-deny-overflowing-literals-2018.rs:14:17 + --> $DIR/edition-deny-overflowing-literals-2018.rs:4:17 | LL | let x: u8 = 256; | ^^^ diff --git a/src/test/ui/editions/edition-extern-crate-allowed.rs b/src/test/ui/editions/edition-extern-crate-allowed.rs index 75761a0b5b9..6361fff6ff4 100644 --- a/src/test/ui/editions/edition-extern-crate-allowed.rs +++ b/src/test/ui/editions/edition-extern-crate-allowed.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:edition-extern-crate-allowed.rs // edition:2015 // compile-pass diff --git a/src/test/ui/editions/edition-extern-crate-allowed.stderr b/src/test/ui/editions/edition-extern-crate-allowed.stderr index 7c1ccc540c5..b675c13f75d 100644 --- a/src/test/ui/editions/edition-extern-crate-allowed.stderr +++ b/src/test/ui/editions/edition-extern-crate-allowed.stderr @@ -1,11 +1,11 @@ warning: unused extern crate - --> $DIR/edition-extern-crate-allowed.rs:17:1 + --> $DIR/edition-extern-crate-allowed.rs:7:1 | LL | extern crate edition_extern_crate_allowed; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | note: lint level defined here - --> $DIR/edition-extern-crate-allowed.rs:15:9 + --> $DIR/edition-extern-crate-allowed.rs:5:9 | LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/editions/edition-feature-ok.rs b/src/test/ui/editions/edition-feature-ok.rs index 5896e9a0715..c2468df4939 100644 --- a/src/test/ui/editions/edition-feature-ok.rs +++ b/src/test/ui/editions/edition-feature-ok.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(rust_2018_preview)] diff --git a/src/test/ui/editions/edition-feature-redundant.rs b/src/test/ui/editions/edition-feature-redundant.rs index d20873f5e11..87a2a22105f 100644 --- a/src/test/ui/editions/edition-feature-redundant.rs +++ b/src/test/ui/editions/edition-feature-redundant.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // compile-pass diff --git a/src/test/ui/editions/edition-feature-redundant.stderr b/src/test/ui/editions/edition-feature-redundant.stderr index ccf7b21fbc5..36e90f3a246 100644 --- a/src/test/ui/editions/edition-feature-redundant.stderr +++ b/src/test/ui/editions/edition-feature-redundant.stderr @@ -1,5 +1,5 @@ warning[E0705]: the feature `rust_2018_preview` is included in the Rust 2018 edition - --> $DIR/edition-feature-redundant.rs:14:12 + --> $DIR/edition-feature-redundant.rs:4:12 | LL | #![feature(rust_2018_preview)] | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/editions/edition-imports-2015.rs b/src/test/ui/editions/edition-imports-2015.rs new file mode 100644 index 00000000000..5ba45b19dde --- /dev/null +++ b/src/test/ui/editions/edition-imports-2015.rs @@ -0,0 +1,26 @@ +// edition:2015 +// compile-flags:--extern absolute +// aux-build:edition-imports-2018.rs +// aux-build:absolute.rs + +#[macro_use] +extern crate edition_imports_2018; + +mod check { + mod import { + pub struct Path; + } + + gen_imports!(); // OK + + fn check() { + Path; + LinkedList::::new(); + } +} + +mod check_glob { + gen_glob!(); //~ ERROR cannot glob-import all possible crates +} + +fn main() {} diff --git a/src/test/ui/editions/edition-imports-2015.stderr b/src/test/ui/editions/edition-imports-2015.stderr new file mode 100644 index 00000000000..816ab21d814 --- /dev/null +++ b/src/test/ui/editions/edition-imports-2015.stderr @@ -0,0 +1,10 @@ +error: cannot glob-import all possible crates + --> $DIR/edition-imports-2015.rs:23:5 + | +LL | gen_glob!(); //~ ERROR cannot glob-import all possible crates + | ^^^^^^^^^^^^ + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/src/test/ui/editions/edition-imports-2018.rs b/src/test/ui/editions/edition-imports-2018.rs new file mode 100644 index 00000000000..dcdbf0d050b --- /dev/null +++ b/src/test/ui/editions/edition-imports-2018.rs @@ -0,0 +1,27 @@ +// edition:2018 +// aux-build:edition-imports-2015.rs + +#[macro_use] +extern crate edition_imports_2015; + +mod import { + pub struct Path; +} +mod absolute { + pub struct Path; +} + +mod check { + gen_imports!(); // OK + + fn check() { + Path; + LinkedList::::new(); + } +} + +mod check_glob { + gen_glob!(); //~ ERROR cannot glob-import all possible crates +} + +fn main() {} diff --git a/src/test/ui/editions/edition-imports-2018.stderr b/src/test/ui/editions/edition-imports-2018.stderr new file mode 100644 index 00000000000..944f42ee045 --- /dev/null +++ b/src/test/ui/editions/edition-imports-2018.stderr @@ -0,0 +1,10 @@ +error: cannot glob-import all possible crates + --> $DIR/edition-imports-2018.rs:24:5 + | +LL | gen_glob!(); //~ ERROR cannot glob-import all possible crates + | ^^^^^^^^^^^^ + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs new file mode 100644 index 00000000000..53ec3867f01 --- /dev/null +++ b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs @@ -0,0 +1,20 @@ +// edition:2018 +// compile-flags:--extern edition_imports_2015 +// aux-build:edition-imports-2015.rs + +mod edition_imports_2015 { + pub struct Path; +} + +pub struct Ambiguous {} + +mod check { + pub struct Ambiguous {} + + fn check() { + edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous + //~| ERROR `edition_imports_2015` is ambiguous + } +} + +fn main() {} diff --git a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr new file mode 100644 index 00000000000..ac2bf21c5c0 --- /dev/null +++ b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr @@ -0,0 +1,40 @@ +error[E0659]: `Ambiguous` is ambiguous (name vs any other name during import resolution) + --> $DIR/edition-imports-virtual-2015-ambiguity.rs:15:9 + | +LL | edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name + | +note: `Ambiguous` could refer to the struct defined here + --> $DIR/edition-imports-virtual-2015-ambiguity.rs:9:1 + | +LL | pub struct Ambiguous {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + = help: use `crate::Ambiguous` to refer to this struct unambiguously +note: `Ambiguous` could also refer to the struct defined here + --> $DIR/edition-imports-virtual-2015-ambiguity.rs:12:5 + | +LL | pub struct Ambiguous {} + | ^^^^^^^^^^^^^^^^^^^^^^^ + = help: use `self::Ambiguous` to refer to this struct unambiguously + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error[E0659]: `edition_imports_2015` is ambiguous (name in the crate root vs extern crate during absolute path resolution) + --> $DIR/edition-imports-virtual-2015-ambiguity.rs:15:9 + | +LL | edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name + | + = note: `edition_imports_2015` could refer to an extern crate passed with `--extern` +note: `edition_imports_2015` could also refer to the module defined here + --> $DIR/edition-imports-virtual-2015-ambiguity.rs:5:1 + | +LL | / mod edition_imports_2015 { +LL | | pub struct Path; +LL | | } + | |_^ + = help: use `crate::edition_imports_2015` to refer to this module unambiguously + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.rs b/src/test/ui/editions/edition-imports-virtual-2015-gated.rs new file mode 100644 index 00000000000..a1bf4f5eb51 --- /dev/null +++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.rs @@ -0,0 +1,12 @@ +// edition:2018 +// aux-build:edition-imports-2015.rs +// error-pattern: imports can only refer to extern crate names passed with `--extern` + +#[macro_use] +extern crate edition_imports_2015; + +mod check { + gen_gated!(); +} + +fn main() {} diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr new file mode 100644 index 00000000000..7c78fbb26a1 --- /dev/null +++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr @@ -0,0 +1,20 @@ +error: imports can only refer to extern crate names passed with `--extern` in macros originating from 2015 edition + --> <::edition_imports_2015::gen_gated macros>:1:50 + | +LL | ( ) => { fn check_gated ( ) { enum E { A } use E :: * ; } } + | ^ + | + ::: $DIR/edition-imports-virtual-2015-gated.rs:9:5 + | +LL | gen_gated!(); + | ------------- not an extern crate passed with `--extern` + | +note: this import refers to the enum defined here + --> $DIR/edition-imports-virtual-2015-gated.rs:9:5 + | +LL | gen_gated!(); + | ^^^^^^^^^^^^^ + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: aborting due to previous error + diff --git a/src/test/ui/editions/edition-keywords-2015-2015-expansion.rs b/src/test/ui/editions/edition-keywords-2015-2015-expansion.rs index 382c7c1f325..c3757ab1934 100644 --- a/src/test/ui/editions/edition-keywords-2015-2015-expansion.rs +++ b/src/test/ui/editions/edition-keywords-2015-2015-expansion.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2015 // aux-build:edition-kw-macro-2015.rs // compile-pass diff --git a/src/test/ui/editions/edition-keywords-2015-2015-parsing.rs b/src/test/ui/editions/edition-keywords-2015-2015-parsing.rs index bdb190c748a..d1752a7ec71 100644 --- a/src/test/ui/editions/edition-keywords-2015-2015-parsing.rs +++ b/src/test/ui/editions/edition-keywords-2015-2015-parsing.rs @@ -1,19 +1,13 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2015 // aux-build:edition-kw-macro-2015.rs #[macro_use] extern crate edition_kw_macro_2015; +mod module { + pub fn async() {} +} + pub fn check_async() { let mut async = 1; // OK let mut r#async = 1; // OK @@ -28,3 +22,5 @@ pub fn check_async() { module::async(); // OK module::r#async(); // OK } + +fn main() {} diff --git a/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr index e8f05cbb0ef..f2a9da71ca5 100644 --- a/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr @@ -1,14 +1,14 @@ error: no rules expected the token `r#async` - --> $DIR/edition-keywords-2015-2015-parsing.rs:22:31 + --> $DIR/edition-keywords-2015-2015-parsing.rs:16:31 | LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` - | ^^^^^^^ no rules expected the token `r#async` + | ^^^^^^^ no rules expected this token in macro call error: no rules expected the token `async` - --> $DIR/edition-keywords-2015-2015-parsing.rs:23:35 + --> $DIR/edition-keywords-2015-2015-parsing.rs:17:35 | LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` - | ^^^^^ no rules expected the token `async` + | ^^^^^ no rules expected this token in macro call error: aborting due to 2 previous errors diff --git a/src/test/ui/editions/edition-keywords-2015-2018-expansion.rs b/src/test/ui/editions/edition-keywords-2015-2018-expansion.rs index 291fd0285e5..2684c8e00b2 100644 --- a/src/test/ui/editions/edition-keywords-2015-2018-expansion.rs +++ b/src/test/ui/editions/edition-keywords-2015-2018-expansion.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2015 // aux-build:edition-kw-macro-2018.rs @@ -20,3 +10,5 @@ mod one_async { mod two_async { produces_async_raw! {} // OK } + +fn main() {} diff --git a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr index d087146d7a1..af1ac19c837 100644 --- a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr @@ -1,10 +1,14 @@ error: expected identifier, found reserved keyword `async` - --> $DIR/edition-keywords-2015-2018-expansion.rs:18:5 + --> $DIR/edition-keywords-2015-2018-expansion.rs:8:5 | LL | produces_async! {} //~ ERROR expected identifier, found reserved keyword | ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) +help: you can escape reserved keywords to use them as identifiers + | +LL | ( ) => ( pub fn r#async ( ) { } ) + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/editions/edition-keywords-2015-2018-parsing.rs b/src/test/ui/editions/edition-keywords-2015-2018-parsing.rs index 1b7bfb53059..44455f43856 100644 --- a/src/test/ui/editions/edition-keywords-2015-2018-parsing.rs +++ b/src/test/ui/editions/edition-keywords-2015-2018-parsing.rs @@ -1,19 +1,13 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2015 // aux-build:edition-kw-macro-2018.rs #[macro_use] extern crate edition_kw_macro_2018; +mod module { + pub fn async() {} +} + pub fn check_async() { let mut async = 1; // OK let mut r#async = 1; // OK @@ -28,3 +22,5 @@ pub fn check_async() { module::async(); // OK module::r#async(); // OK } + +fn main() {} diff --git a/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr index 3f5e1137383..fbb3b8bc756 100644 --- a/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr @@ -1,14 +1,14 @@ error: no rules expected the token `r#async` - --> $DIR/edition-keywords-2015-2018-parsing.rs:22:31 + --> $DIR/edition-keywords-2015-2018-parsing.rs:16:31 | LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` - | ^^^^^^^ no rules expected the token `r#async` + | ^^^^^^^ no rules expected this token in macro call error: no rules expected the token `async` - --> $DIR/edition-keywords-2015-2018-parsing.rs:23:35 + --> $DIR/edition-keywords-2015-2018-parsing.rs:17:35 | LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` - | ^^^^^ no rules expected the token `async` + | ^^^^^ no rules expected this token in macro call error: aborting due to 2 previous errors diff --git a/src/test/ui/editions/edition-keywords-2018-2015-expansion.rs b/src/test/ui/editions/edition-keywords-2018-2015-expansion.rs index 46434daaab9..6a30c498219 100644 --- a/src/test/ui/editions/edition-keywords-2018-2015-expansion.rs +++ b/src/test/ui/editions/edition-keywords-2018-2015-expansion.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // aux-build:edition-kw-macro-2015.rs // compile-pass diff --git a/src/test/ui/editions/edition-keywords-2018-2015-parsing.rs b/src/test/ui/editions/edition-keywords-2018-2015-parsing.rs index 02b061f8cbc..fb8e0cdb4c3 100644 --- a/src/test/ui/editions/edition-keywords-2018-2015-parsing.rs +++ b/src/test/ui/editions/edition-keywords-2018-2015-parsing.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // aux-build:edition-kw-macro-2015.rs diff --git a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr index b6ff60f1492..52399362482 100644 --- a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr @@ -1,32 +1,45 @@ error: expected identifier, found reserved keyword `async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:18:13 + --> $DIR/edition-keywords-2018-2015-parsing.rs:8:13 | LL | let mut async = 1; //~ ERROR expected identifier, found reserved keyword `async` | ^^^^^ expected identifier, found reserved keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | let mut r#async = 1; //~ ERROR expected identifier, found reserved keyword `async` + | ^^^^^^^ error: expected identifier, found reserved keyword `async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:28:13 + --> $DIR/edition-keywords-2018-2015-parsing.rs:18:13 | LL | module::async(); //~ ERROR expected identifier, found reserved keyword `async` | ^^^^^ expected identifier, found reserved keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | module::r#async(); //~ ERROR expected identifier, found reserved keyword `async` + | ^^^^^^^ error: no rules expected the token `r#async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:22:31 + --> $DIR/edition-keywords-2018-2015-parsing.rs:12:31 | LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` - | ^^^^^^^ no rules expected the token `r#async` + | ^^^^^^^ no rules expected this token in macro call error: no rules expected the token `async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:23:35 + --> $DIR/edition-keywords-2018-2015-parsing.rs:13:35 | LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` - | ^^^^^ no rules expected the token `async` + | ^^^^^ no rules expected this token in macro call -error: expected one of `move`, `|`, or `||`, found `` - --> <::edition_kw_macro_2015::passes_ident macros>:1:22 +error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` + --> <::edition_kw_macro_2015::passes_ident macros>:1:25 | LL | ( $ i : ident ) => ( $ i ) - | ^^^ expected one of `move`, `|`, or `||` here + | ^ expected one of `move`, `|`, or `||` here + | + ::: $DIR/edition-keywords-2018-2015-parsing.rs:16:8 + | +LL | if passes_ident!(async) == 1 {} + | -------------------- in this macro invocation error: aborting due to 5 previous errors diff --git a/src/test/ui/editions/edition-keywords-2018-2018-expansion.rs b/src/test/ui/editions/edition-keywords-2018-2018-expansion.rs index 81bef913ac6..6f766550d47 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-expansion.rs +++ b/src/test/ui/editions/edition-keywords-2018-2018-expansion.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // aux-build:edition-kw-macro-2018.rs @@ -20,3 +10,5 @@ mod one_async { mod two_async { produces_async_raw! {} // OK } + +fn main() {} diff --git a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr index c6e0927a3a4..d997c3d8a42 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr @@ -1,10 +1,14 @@ error: expected identifier, found reserved keyword `async` - --> $DIR/edition-keywords-2018-2018-expansion.rs:18:5 + --> $DIR/edition-keywords-2018-2018-expansion.rs:8:5 | LL | produces_async! {} //~ ERROR expected identifier, found reserved keyword `async` | ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) +help: you can escape reserved keywords to use them as identifiers + | +LL | ( ) => ( pub fn r#async ( ) { } ) + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/editions/edition-keywords-2018-2018-parsing.rs b/src/test/ui/editions/edition-keywords-2018-2018-parsing.rs index 565c2f2dc74..88cebf45ad8 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-parsing.rs +++ b/src/test/ui/editions/edition-keywords-2018-2018-parsing.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // aux-build:edition-kw-macro-2018.rs diff --git a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr index ffe666a7e64..1621368870a 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr @@ -1,32 +1,45 @@ error: expected identifier, found reserved keyword `async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:18:13 + --> $DIR/edition-keywords-2018-2018-parsing.rs:8:13 | LL | let mut async = 1; //~ ERROR expected identifier, found reserved keyword `async` | ^^^^^ expected identifier, found reserved keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | let mut r#async = 1; //~ ERROR expected identifier, found reserved keyword `async` + | ^^^^^^^ error: expected identifier, found reserved keyword `async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:28:13 + --> $DIR/edition-keywords-2018-2018-parsing.rs:18:13 | LL | module::async(); //~ ERROR expected identifier, found reserved keyword `async` | ^^^^^ expected identifier, found reserved keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | module::r#async(); //~ ERROR expected identifier, found reserved keyword `async` + | ^^^^^^^ error: no rules expected the token `r#async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:22:31 + --> $DIR/edition-keywords-2018-2018-parsing.rs:12:31 | LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` - | ^^^^^^^ no rules expected the token `r#async` + | ^^^^^^^ no rules expected this token in macro call error: no rules expected the token `async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:23:35 + --> $DIR/edition-keywords-2018-2018-parsing.rs:13:35 | LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` - | ^^^^^ no rules expected the token `async` + | ^^^^^ no rules expected this token in macro call -error: expected one of `move`, `|`, or `||`, found `` - --> <::edition_kw_macro_2018::passes_ident macros>:1:22 +error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` + --> <::edition_kw_macro_2018::passes_ident macros>:1:25 | LL | ( $ i : ident ) => ( $ i ) - | ^^^ expected one of `move`, `|`, or `||` here + | ^ expected one of `move`, `|`, or `||` here + | + ::: $DIR/edition-keywords-2018-2018-parsing.rs:16:8 + | +LL | if passes_ident!(async) == 1 {} + | -------------------- in this macro invocation error: aborting due to 5 previous errors diff --git a/src/test/ui/editions/edition-raw-pointer-method-2015.rs b/src/test/ui/editions/edition-raw-pointer-method-2015.rs index 4ba44fa54d8..a538bca75f6 100644 --- a/src/test/ui/editions/edition-raw-pointer-method-2015.rs +++ b/src/test/ui/editions/edition-raw-pointer-method-2015.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // edition:2015 diff --git a/src/test/ui/editions/edition-raw-pointer-method-2015.stderr b/src/test/ui/editions/edition-raw-pointer-method-2015.stderr index 7fd098c98e3..deea6a71b24 100644 --- a/src/test/ui/editions/edition-raw-pointer-method-2015.stderr +++ b/src/test/ui/editions/edition-raw-pointer-method-2015.stderr @@ -1,11 +1,11 @@ error: type annotations needed - --> $DIR/edition-raw-pointer-method-2015.rs:20:15 + --> $DIR/edition-raw-pointer-method-2015.rs:10:15 | LL | let _ = y.is_null(); | ^^^^^^^ | note: lint level defined here - --> $DIR/edition-raw-pointer-method-2015.rs:16:8 + --> $DIR/edition-raw-pointer-method-2015.rs:6:8 | LL | #[deny(warnings)] | ^^^^^^^^ diff --git a/src/test/ui/editions/edition-raw-pointer-method-2018.rs b/src/test/ui/editions/edition-raw-pointer-method-2018.rs index c8548ed35b9..eabab5e4739 100644 --- a/src/test/ui/editions/edition-raw-pointer-method-2018.rs +++ b/src/test/ui/editions/edition-raw-pointer-method-2018.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // edition:2018 diff --git a/src/test/ui/editions/edition-raw-pointer-method-2018.stderr b/src/test/ui/editions/edition-raw-pointer-method-2018.stderr index 0708b4bbd46..03e7f3a9449 100644 --- a/src/test/ui/editions/edition-raw-pointer-method-2018.stderr +++ b/src/test/ui/editions/edition-raw-pointer-method-2018.stderr @@ -1,5 +1,5 @@ error[E0699]: the type of this value must be known to call a method on a raw pointer on it - --> $DIR/edition-raw-pointer-method-2018.rs:20:15 + --> $DIR/edition-raw-pointer-method-2018.rs:10:15 | LL | let _ = y.is_null(); | ^^^^^^^ diff --git a/src/test/ui/elide-errors-on-mismatched-tuple.rs b/src/test/ui/elide-errors-on-mismatched-tuple.rs index 68e579788bc..e68358fd978 100644 --- a/src/test/ui/elide-errors-on-mismatched-tuple.rs +++ b/src/test/ui/elide-errors-on-mismatched-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Hide irrelevant E0277 errors (#50333) trait T {} diff --git a/src/test/ui/elide-errors-on-mismatched-tuple.stderr b/src/test/ui/elide-errors-on-mismatched-tuple.stderr index b901175d534..1ef9d7ae982 100644 --- a/src/test/ui/elide-errors-on-mismatched-tuple.stderr +++ b/src/test/ui/elide-errors-on-mismatched-tuple.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/elide-errors-on-mismatched-tuple.rs:24:9 + --> $DIR/elide-errors-on-mismatched-tuple.rs:14:9 | LL | let (a, b, c) = (A::new(), A::new()); // This tuple is 2 elements, should be three | ^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements diff --git a/src/test/ui/elided-test.rs b/src/test/ui/elided-test.rs index 0cdd0010a74..b3f4446f189 100644 --- a/src/test/ui/elided-test.rs +++ b/src/test/ui/elided-test.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: `main` function not found // Since we're not compiling a test runner this function should be elided diff --git a/src/test/ui/empty/auxiliary/empty-struct.rs b/src/test/ui/empty/auxiliary/empty-struct.rs index 4a302865634..3fb40f6bfa9 100644 --- a/src/test/ui/empty/auxiliary/empty-struct.rs +++ b/src/test/ui/empty/auxiliary/empty-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct XEmpty1 {} pub struct XEmpty2; pub struct XEmpty6(); diff --git a/src/test/ui/empty/auxiliary/two_macros.rs b/src/test/ui/empty/auxiliary/two_macros.rs index 060960f0dbc..2330c75c8e0 100644 --- a/src/test/ui/empty/auxiliary/two_macros.rs +++ b/src/test/ui/empty/auxiliary/two_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! macro_one { () => ("one") } diff --git a/src/test/ui/empty/empty-comment.rs b/src/test/ui/empty/empty-comment.rs index a5568ff826b..174274d28b0 100644 --- a/src/test/ui/empty/empty-comment.rs +++ b/src/test/ui/empty/empty-comment.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // `/**/` was previously regarded as a doc comment because it starts with `/**` and ends with `*/`. // This could break some internal logic that assumes the length of a doc comment is at least 5, // leading to an ICE. diff --git a/src/test/ui/empty/empty-comment.stderr b/src/test/ui/empty/empty-comment.stderr index de826102081..908d5710c8a 100644 --- a/src/test/ui/empty/empty-comment.stderr +++ b/src/test/ui/empty/empty-comment.stderr @@ -1,11 +1,11 @@ error: unexpected end of macro invocation - --> $DIR/empty-comment.rs:20:5 + --> $DIR/empty-comment.rs:10:5 | LL | macro_rules! one_arg_macro { | -------------------------- when calling this macro ... LL | one_arg_macro!(/**/); //~ ERROR unexpected end - | ^^^^^^^^^^^^^^^^^^^^^ unexpected end of macro invocation + | ^^^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments error: aborting due to previous error diff --git a/src/test/ui/empty/empty-linkname.rs b/src/test/ui/empty/empty-linkname.rs index 20e0f9cd0b2..79895ab5834 100644 --- a/src/test/ui/empty/empty-linkname.rs +++ b/src/test/ui/empty/empty-linkname.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link(name = "")] //~ ERROR: given with empty name extern { } diff --git a/src/test/ui/empty/empty-linkname.stderr b/src/test/ui/empty/empty-linkname.stderr index 9a637aa7833..a07a4f1c567 100644 --- a/src/test/ui/empty/empty-linkname.stderr +++ b/src/test/ui/empty/empty-linkname.stderr @@ -1,5 +1,5 @@ error[E0454]: #[link(name = "")] given with empty name - --> $DIR/empty-linkname.rs:11:1 + --> $DIR/empty-linkname.rs:1:1 | LL | #[link(name = "")] //~ ERROR: given with empty name | ^^^^^^^^^^^^^^^^^^ empty name given diff --git a/src/test/ui/empty/empty-macro-use.rs b/src/test/ui/empty/empty-macro-use.rs index 823a7426079..846004e661d 100644 --- a/src/test/ui/empty/empty-macro-use.rs +++ b/src/test/ui/empty/empty-macro-use.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:two_macros.rs #[macro_use()] diff --git a/src/test/ui/empty/empty-macro-use.stderr b/src/test/ui/empty/empty-macro-use.stderr index 8feb0930718..16300411c8c 100644 --- a/src/test/ui/empty/empty-macro-use.stderr +++ b/src/test/ui/empty/empty-macro-use.stderr @@ -1,5 +1,5 @@ error: cannot find macro `macro_two!` in this scope - --> $DIR/empty-macro-use.rs:17:5 + --> $DIR/empty-macro-use.rs:7:5 | LL | macro_two!(); | ^^^^^^^^^ diff --git a/src/test/ui/empty/empty-never-array.rs b/src/test/ui/empty/empty-never-array.rs index 53b24e17319..01b99134a44 100644 --- a/src/test/ui/empty/empty-never-array.rs +++ b/src/test/ui/empty/empty-never-array.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(never_type)] enum Helper { diff --git a/src/test/ui/empty/empty-never-array.stderr b/src/test/ui/empty/empty-never-array.stderr index d9ef2f30aab..e409f14d6ce 100644 --- a/src/test/ui/empty/empty-never-array.stderr +++ b/src/test/ui/empty/empty-never-array.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding: `T(_, _)` not covered - --> $DIR/empty-never-array.rs:20:9 + --> $DIR/empty-never-array.rs:10:9 | LL | let Helper::U(u) = Helper::T(t, []); | ^^^^^^^^^^^^ pattern `T(_, _)` not covered diff --git a/src/test/ui/empty/empty-struct-braces-expr.rs b/src/test/ui/empty/empty-struct-braces-expr.rs index 3096e8f8313..2f2f41ae8c1 100644 --- a/src/test/ui/empty/empty-struct-braces-expr.rs +++ b/src/test/ui/empty/empty-struct-braces-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Can't use empty braced struct as constant or constructor function // aux-build:empty-struct.rs diff --git a/src/test/ui/empty/empty-struct-braces-expr.stderr b/src/test/ui/empty/empty-struct-braces-expr.stderr index 9b6114875e2..19844503a48 100644 --- a/src/test/ui/empty/empty-struct-braces-expr.stderr +++ b/src/test/ui/empty/empty-struct-braces-expr.stderr @@ -1,66 +1,68 @@ error[E0423]: expected value, found struct `Empty1` - --> $DIR/empty-struct-braces-expr.rs:25:14 + --> $DIR/empty-struct-braces-expr.rs:15:14 | LL | let e1 = Empty1; //~ ERROR expected value, found struct `Empty1` | ^^^^^^ | | - | did you mean `XEmpty2`? | did you mean `Empty1 { /* fields */ }`? + | help: a unit struct with a similar name exists: `XEmpty2` error[E0423]: expected function, found struct `Empty1` - --> $DIR/empty-struct-braces-expr.rs:26:14 + --> $DIR/empty-struct-braces-expr.rs:16:14 | LL | let e1 = Empty1(); //~ ERROR expected function, found struct `Empty1` | ^^^^^^ | | - | did you mean `XEmpty2`? | did you mean `Empty1 { /* fields */ }`? + | help: a unit struct with a similar name exists: `XEmpty2` error[E0423]: expected value, found struct variant `E::Empty3` - --> $DIR/empty-struct-braces-expr.rs:27:14 + --> $DIR/empty-struct-braces-expr.rs:17:14 | LL | let e3 = E::Empty3; //~ ERROR expected value, found struct variant `E::Empty3` | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? error[E0423]: expected function, found struct variant `E::Empty3` - --> $DIR/empty-struct-braces-expr.rs:28:14 + --> $DIR/empty-struct-braces-expr.rs:18:14 | LL | let e3 = E::Empty3(); //~ ERROR expected function, found struct variant `E::Empty3` | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? error[E0423]: expected value, found struct `XEmpty1` - --> $DIR/empty-struct-braces-expr.rs:30:15 + --> $DIR/empty-struct-braces-expr.rs:20:15 | LL | let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1` | ^^^^^^^ | | - | did you mean `XEmpty2`? | did you mean `XEmpty1 { /* fields */ }`? + | help: a unit struct with a similar name exists: `XEmpty2` error[E0423]: expected function, found struct `XEmpty1` - --> $DIR/empty-struct-braces-expr.rs:31:15 + --> $DIR/empty-struct-braces-expr.rs:21:15 | LL | let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1` | ^^^^^^^ | | - | did you mean `XEmpty2`? | did you mean `XEmpty1 { /* fields */ }`? + | help: a unit struct with a similar name exists: `XEmpty2` error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope - --> $DIR/empty-struct-braces-expr.rs:32:15 + --> $DIR/empty-struct-braces-expr.rs:22:19 | LL | let xe3 = XE::Empty3; //~ ERROR no variant named `Empty3` found for type - | ^^^^^^^^^^ variant not found in `empty_struct::XE` - | - = note: did you mean `empty_struct::XE::XEmpty3`? + | ----^^^^^^ + | | | + | | help: did you mean: `XEmpty3` + | variant not found in `empty_struct::XE` error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope - --> $DIR/empty-struct-braces-expr.rs:33:15 + --> $DIR/empty-struct-braces-expr.rs:23:19 | LL | let xe3 = XE::Empty3(); //~ ERROR no variant named `Empty3` found for type - | ^^^^^^^^^^ variant not found in `empty_struct::XE` - | - = note: did you mean `empty_struct::XE::XEmpty3`? + | ----^^^^^^ + | | | + | | help: did you mean: `XEmpty3` + | variant not found in `empty_struct::XE` error: aborting due to 8 previous errors diff --git a/src/test/ui/empty/empty-struct-braces-pat-1.rs b/src/test/ui/empty/empty-struct-braces-pat-1.rs index e527170e9f9..81062320fe4 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-1.rs +++ b/src/test/ui/empty/empty-struct-braces-pat-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Can't use empty braced struct as constant pattern // aux-build:empty-struct.rs diff --git a/src/test/ui/empty/empty-struct-braces-pat-1.stderr b/src/test/ui/empty/empty-struct-braces-pat-1.stderr index aad47f4d954..6c361c70344 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-1.stderr +++ b/src/test/ui/empty/empty-struct-braces-pat-1.stderr @@ -1,16 +1,16 @@ error[E0532]: expected unit struct/variant or constant, found struct variant `E::Empty3` - --> $DIR/empty-struct-braces-pat-1.rs:34:9 + --> $DIR/empty-struct-braces-pat-1.rs:24:9 | LL | E::Empty3 => () | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? error[E0532]: expected unit struct/variant or constant, found struct variant `XE::XEmpty3` - --> $DIR/empty-struct-braces-pat-1.rs:41:9 + --> $DIR/empty-struct-braces-pat-1.rs:31:9 | LL | XE::XEmpty3 => () | ^^^^------- | | | - | | did you mean `XEmpty4`? + | | help: a unit variant with a similar name exists: `XEmpty4` | did you mean `XE::XEmpty3 { /* fields */ }`? error: aborting due to 2 previous errors diff --git a/src/test/ui/empty/empty-struct-braces-pat-2.rs b/src/test/ui/empty/empty-struct-braces-pat-2.rs index d3b13457dc6..187d953d805 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-2.rs +++ b/src/test/ui/empty/empty-struct-braces-pat-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Can't use empty braced struct as enum pattern // aux-build:empty-struct.rs diff --git a/src/test/ui/empty/empty-struct-braces-pat-2.stderr b/src/test/ui/empty/empty-struct-braces-pat-2.stderr index 26fb42c4e94..fc2ed79bb2e 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-2.stderr +++ b/src/test/ui/empty/empty-struct-braces-pat-2.stderr @@ -1,38 +1,38 @@ error[E0532]: expected tuple struct/variant, found struct `Empty1` - --> $DIR/empty-struct-braces-pat-2.rs:25:9 + --> $DIR/empty-struct-braces-pat-2.rs:15:9 | LL | Empty1() => () //~ ERROR expected tuple struct/variant, found struct `Empty1` | ^^^^^^ | | - | did you mean `XEmpty6`? | did you mean `Empty1 { /* fields */ }`? + | help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found struct `XEmpty1` - --> $DIR/empty-struct-braces-pat-2.rs:28:9 + --> $DIR/empty-struct-braces-pat-2.rs:18:9 | LL | XEmpty1() => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1` | ^^^^^^^ | | - | did you mean `XEmpty6`? | did you mean `XEmpty1 { /* fields */ }`? + | help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found struct `Empty1` - --> $DIR/empty-struct-braces-pat-2.rs:31:9 + --> $DIR/empty-struct-braces-pat-2.rs:21:9 | LL | Empty1(..) => () //~ ERROR expected tuple struct/variant, found struct `Empty1` | ^^^^^^ | | - | did you mean `XEmpty6`? | did you mean `Empty1 { /* fields */ }`? + | help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found struct `XEmpty1` - --> $DIR/empty-struct-braces-pat-2.rs:34:9 + --> $DIR/empty-struct-braces-pat-2.rs:24:9 | LL | XEmpty1(..) => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1` | ^^^^^^^ | | - | did you mean `XEmpty6`? | did you mean `XEmpty1 { /* fields */ }`? + | help: a tuple struct with a similar name exists: `XEmpty6` error: aborting due to 4 previous errors diff --git a/src/test/ui/empty/empty-struct-braces-pat-3.rs b/src/test/ui/empty/empty-struct-braces-pat-3.rs index d6c5b953492..fad28d78fe5 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-3.rs +++ b/src/test/ui/empty/empty-struct-braces-pat-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Can't use empty braced struct as enum pattern // aux-build:empty-struct.rs diff --git a/src/test/ui/empty/empty-struct-braces-pat-3.stderr b/src/test/ui/empty/empty-struct-braces-pat-3.stderr index 389bf0a65c6..af8731b5f05 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-3.stderr +++ b/src/test/ui/empty/empty-struct-braces-pat-3.stderr @@ -1,31 +1,31 @@ error[E0532]: expected tuple struct/variant, found struct variant `E::Empty3` - --> $DIR/empty-struct-braces-pat-3.rs:27:9 + --> $DIR/empty-struct-braces-pat-3.rs:17:9 | LL | E::Empty3() => () | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? error[E0532]: expected tuple struct/variant, found struct variant `XE::XEmpty3` - --> $DIR/empty-struct-braces-pat-3.rs:31:9 + --> $DIR/empty-struct-braces-pat-3.rs:21:9 | LL | XE::XEmpty3() => () | ^^^^------- | | | - | | did you mean `XEmpty5`? + | | help: a tuple variant with a similar name exists: `XEmpty5` | did you mean `XE::XEmpty3 { /* fields */ }`? error[E0532]: expected tuple struct/variant, found struct variant `E::Empty3` - --> $DIR/empty-struct-braces-pat-3.rs:35:9 + --> $DIR/empty-struct-braces-pat-3.rs:25:9 | LL | E::Empty3(..) => () | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? error[E0532]: expected tuple struct/variant, found struct variant `XE::XEmpty3` - --> $DIR/empty-struct-braces-pat-3.rs:39:9 + --> $DIR/empty-struct-braces-pat-3.rs:29:9 | LL | XE::XEmpty3(..) => () | ^^^^------- | | | - | | did you mean `XEmpty5`? + | | help: a tuple variant with a similar name exists: `XEmpty5` | did you mean `XE::XEmpty3 { /* fields */ }`? error: aborting due to 4 previous errors diff --git a/src/test/ui/empty/empty-struct-tuple-pat.rs b/src/test/ui/empty/empty-struct-tuple-pat.rs index 5e683eafade..00a48594e93 100644 --- a/src/test/ui/empty/empty-struct-tuple-pat.rs +++ b/src/test/ui/empty/empty-struct-tuple-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Can't use unit struct as enum pattern // aux-build:empty-struct.rs diff --git a/src/test/ui/empty/empty-struct-tuple-pat.stderr b/src/test/ui/empty/empty-struct-tuple-pat.stderr index 3708aa36089..f92c4e5c463 100644 --- a/src/test/ui/empty/empty-struct-tuple-pat.stderr +++ b/src/test/ui/empty/empty-struct-tuple-pat.stderr @@ -1,5 +1,5 @@ error[E0530]: match bindings cannot shadow tuple structs - --> $DIR/empty-struct-tuple-pat.rs:32:9 + --> $DIR/empty-struct-tuple-pat.rs:22:9 | LL | struct Empty2(); | ---------------- the tuple struct `Empty2` is defined here @@ -8,7 +8,7 @@ LL | Empty2 => () //~ ERROR match bindings cannot shadow tuple structs | ^^^^^^ cannot be named the same as a tuple struct error[E0530]: match bindings cannot shadow tuple structs - --> $DIR/empty-struct-tuple-pat.rs:35:9 + --> $DIR/empty-struct-tuple-pat.rs:25:9 | LL | use empty_struct::*; | --------------- the tuple struct `XEmpty6` is imported here @@ -17,18 +17,18 @@ LL | XEmpty6 => () //~ ERROR match bindings cannot shadow tuple structs | ^^^^^^^ cannot be named the same as a tuple struct error[E0532]: expected unit struct/variant or constant, found tuple variant `E::Empty4` - --> $DIR/empty-struct-tuple-pat.rs:39:9 + --> $DIR/empty-struct-tuple-pat.rs:29:9 | LL | E::Empty4 => () | ^^^^^^^^^ not a unit struct/variant or constant error[E0532]: expected unit struct/variant or constant, found tuple variant `XE::XEmpty5` - --> $DIR/empty-struct-tuple-pat.rs:43:9 + --> $DIR/empty-struct-tuple-pat.rs:33:9 | LL | XE::XEmpty5 => (), | ^^^^------- | | - | did you mean `XEmpty4`? + | help: a unit variant with a similar name exists: `XEmpty4` error: aborting due to 4 previous errors diff --git a/src/test/ui/empty/empty-struct-unit-expr.rs b/src/test/ui/empty/empty-struct-unit-expr.rs index 941292a7ec2..b192e3a92c3 100644 --- a/src/test/ui/empty/empty-struct-unit-expr.rs +++ b/src/test/ui/empty/empty-struct-unit-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Can't use unit struct as constructor function // aux-build:empty-struct.rs diff --git a/src/test/ui/empty/empty-struct-unit-expr.stderr b/src/test/ui/empty/empty-struct-unit-expr.stderr index 360e0c6f107..b3519948f64 100644 --- a/src/test/ui/empty/empty-struct-unit-expr.stderr +++ b/src/test/ui/empty/empty-struct-unit-expr.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `Empty2` - --> $DIR/empty-struct-unit-expr.rs:25:14 + --> $DIR/empty-struct-unit-expr.rs:15:14 | LL | struct Empty2; | -------------- `Empty2` defined here @@ -10,7 +10,7 @@ LL | let e2 = Empty2(); //~ ERROR expected function, found `Empty2` | call expression requires function error[E0618]: expected function, found enum variant `E::Empty4` - --> $DIR/empty-struct-unit-expr.rs:26:14 + --> $DIR/empty-struct-unit-expr.rs:16:14 | LL | Empty4 | ------ `E::Empty4` defined here @@ -25,7 +25,7 @@ LL | let e4 = E::Empty4; | ^^^^^^^^^ error[E0618]: expected function, found `empty_struct::XEmpty2` - --> $DIR/empty-struct-unit-expr.rs:28:15 + --> $DIR/empty-struct-unit-expr.rs:18:15 | LL | let xe2 = XEmpty2(); //~ ERROR expected function, found `empty_struct::XEmpty2` | ^^^^^^^-- @@ -33,7 +33,7 @@ LL | let xe2 = XEmpty2(); //~ ERROR expected function, found `empty_struct:: | call expression requires function error[E0618]: expected function, found enum variant `XE::XEmpty4` - --> $DIR/empty-struct-unit-expr.rs:29:15 + --> $DIR/empty-struct-unit-expr.rs:19:15 | LL | let xe4 = XE::XEmpty4(); | ^^^^^^^^^^^-- diff --git a/src/test/ui/empty/empty-struct-unit-pat.rs b/src/test/ui/empty/empty-struct-unit-pat.rs index 532c2d85053..8a0e2f505e4 100644 --- a/src/test/ui/empty/empty-struct-unit-pat.rs +++ b/src/test/ui/empty/empty-struct-unit-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Can't use unit struct as tuple struct pattern // aux-build:empty-struct.rs diff --git a/src/test/ui/empty/empty-struct-unit-pat.stderr b/src/test/ui/empty/empty-struct-unit-pat.stderr index 042b53521c2..e62246562be 100644 --- a/src/test/ui/empty/empty-struct-unit-pat.stderr +++ b/src/test/ui/empty/empty-struct-unit-pat.stderr @@ -1,54 +1,54 @@ error[E0532]: expected tuple struct/variant, found unit struct `Empty2` - --> $DIR/empty-struct-unit-pat.rs:31:9 + --> $DIR/empty-struct-unit-pat.rs:21:9 | LL | Empty2() => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2` - | ^^^^^^ did you mean `XEmpty6`? + | ^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2` - --> $DIR/empty-struct-unit-pat.rs:34:9 + --> $DIR/empty-struct-unit-pat.rs:24:9 | LL | XEmpty2() => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2` - | ^^^^^^^ did you mean `XEmpty6`? + | ^^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found unit struct `Empty2` - --> $DIR/empty-struct-unit-pat.rs:37:9 + --> $DIR/empty-struct-unit-pat.rs:27:9 | LL | Empty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2` - | ^^^^^^ did you mean `XEmpty6`? + | ^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2` - --> $DIR/empty-struct-unit-pat.rs:40:9 + --> $DIR/empty-struct-unit-pat.rs:30:9 | LL | XEmpty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2` - | ^^^^^^^ did you mean `XEmpty6`? + | ^^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4` - --> $DIR/empty-struct-unit-pat.rs:44:9 + --> $DIR/empty-struct-unit-pat.rs:34:9 | LL | E::Empty4() => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4` | ^^^^^^^^^ not a tuple struct/variant error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4` - --> $DIR/empty-struct-unit-pat.rs:47:9 + --> $DIR/empty-struct-unit-pat.rs:37:9 | LL | XE::XEmpty4() => (), | ^^^^------- | | - | did you mean `XEmpty5`? + | help: a tuple variant with a similar name exists: `XEmpty5` error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4` - --> $DIR/empty-struct-unit-pat.rs:52:9 + --> $DIR/empty-struct-unit-pat.rs:42:9 | LL | E::Empty4(..) => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4` | ^^^^^^^^^ not a tuple struct/variant error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4` - --> $DIR/empty-struct-unit-pat.rs:55:9 + --> $DIR/empty-struct-unit-pat.rs:45:9 | LL | XE::XEmpty4(..) => (), | ^^^^------- | | - | did you mean `XEmpty5`? + | help: a tuple variant with a similar name exists: `XEmpty5` error: aborting due to 8 previous errors diff --git a/src/test/ui/enable-unstable-lib-feature.rs b/src/test/ui/enable-unstable-lib-feature.rs index b10a0a60f14..2f248bf14c1 100644 --- a/src/test/ui/enable-unstable-lib-feature.rs +++ b/src/test/ui/enable-unstable-lib-feature.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that enabling an unstable feature disables warnings // aux-build:stability_cfg2.rs diff --git a/src/test/ui/enable-unstable-lib-feature.stderr b/src/test/ui/enable-unstable-lib-feature.stderr index 20b2eb51fcb..51cfe7beade 100644 --- a/src/test/ui/enable-unstable-lib-feature.stderr +++ b/src/test/ui/enable-unstable-lib-feature.stderr @@ -1,11 +1,11 @@ -error: function `BOGUS` should have a snake case name such as `bogus` - --> $DIR/enable-unstable-lib-feature.rs:22:1 +error: function `BOGUS` should have a snake case name + --> $DIR/enable-unstable-lib-feature.rs:12:8 | LL | pub fn BOGUS() { } //~ ERROR - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^ help: convert the identifier to snake case: `bogus` | note: lint level defined here - --> $DIR/enable-unstable-lib-feature.rs:16:9 + --> $DIR/enable-unstable-lib-feature.rs:6:9 | LL | #![deny(non_snake_case)] // To trigger a hard error | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/enum-variant-generic-args.rs b/src/test/ui/enum-variant-generic-args.rs new file mode 100644 index 00000000000..6eddd709645 --- /dev/null +++ b/src/test/ui/enum-variant-generic-args.rs @@ -0,0 +1,73 @@ +#![feature(type_alias_enum_variants)] + +enum Enum { TSVariant(T), SVariant { v: T } } +type Alias = Enum; +type AliasFixed = Enum<()>; + +impl Enum { + fn ts_variant() { + Self::TSVariant(()); + //~^ ERROR mismatched types [E0308] + Self::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + Self::<()>::TSVariant(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR mismatched types [E0308] + Self::<()>::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR type arguments are not allowed on this entity [E0109] + } + + fn s_variant() { + Self::SVariant { v: () }; + //~^ ERROR mismatched types [E0308] + Self::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR mismatched types [E0308] + Self::<()>::SVariant { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR mismatched types [E0308] + Self::<()>::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR type arguments are not allowed on this entity [E0109] + //~^^^ ERROR mismatched types [E0308] + } +} + +fn main() { + // Tuple struct variant + + Enum::<()>::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + + Alias::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + Alias::<()>::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + + AliasFixed::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + AliasFixed::<()>::TSVariant(()); + //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] + AliasFixed::<()>::TSVariant::<()>(()); + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] + + // Struct variant + + Enum::<()>::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + + Alias::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + Alias::<()>::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + + AliasFixed::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + AliasFixed::<()>::SVariant { v: () }; + //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] + AliasFixed::<()>::SVariant::<()> { v: () }; + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~^^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] +} diff --git a/src/test/ui/enum-variant-generic-args.stderr b/src/test/ui/enum-variant-generic-args.stderr new file mode 100644 index 00000000000..4d3b5767346 --- /dev/null +++ b/src/test/ui/enum-variant-generic-args.stderr @@ -0,0 +1,190 @@ +error[E0308]: mismatched types + --> $DIR/enum-variant-generic-args.rs:9:25 + | +LL | Self::TSVariant(()); + | ^^ expected type parameter, found () + | + = note: expected type `T` + found type `()` + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:11:27 + | +LL | Self::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:13:16 + | +LL | Self::<()>::TSVariant(()); + | ^^ type argument not allowed + +error[E0308]: mismatched types + --> $DIR/enum-variant-generic-args.rs:13:31 + | +LL | Self::<()>::TSVariant(()); + | ^^ expected type parameter, found () + | + = note: expected type `T` + found type `()` + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:16:16 + | +LL | Self::<()>::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:16:33 + | +LL | Self::<()>::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0308]: mismatched types + --> $DIR/enum-variant-generic-args.rs:22:29 + | +LL | Self::SVariant { v: () }; + | ^^ expected type parameter, found () + | + = note: expected type `T` + found type `()` + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:24:26 + | +LL | Self::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0308]: mismatched types + --> $DIR/enum-variant-generic-args.rs:24:35 + | +LL | Self::SVariant::<()> { v: () }; + | ^^ expected type parameter, found () + | + = note: expected type `T` + found type `()` + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:27:16 + | +LL | Self::<()>::SVariant { v: () }; + | ^^ type argument not allowed + +error[E0308]: mismatched types + --> $DIR/enum-variant-generic-args.rs:27:35 + | +LL | Self::<()>::SVariant { v: () }; + | ^^ expected type parameter, found () + | + = note: expected type `T` + found type `()` + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:30:16 + | +LL | Self::<()>::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:30:32 + | +LL | Self::<()>::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0308]: mismatched types + --> $DIR/enum-variant-generic-args.rs:30:41 + | +LL | Self::<()>::SVariant::<()> { v: () }; + | ^^ expected type parameter, found () + | + = note: expected type `T` + found type `()` + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:40:29 + | +LL | Enum::<()>::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:43:24 + | +LL | Alias::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:45:30 + | +LL | Alias::<()>::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:48:29 + | +LL | AliasFixed::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0107]: wrong number of type arguments: expected 0, found 1 + --> $DIR/enum-variant-generic-args.rs:50:18 + | +LL | AliasFixed::<()>::TSVariant(()); + | ^^ unexpected type argument + +error[E0107]: wrong number of type arguments: expected 0, found 1 + --> $DIR/enum-variant-generic-args.rs:52:18 + | +LL | AliasFixed::<()>::TSVariant::<()>(()); + | ^^ unexpected type argument + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:52:35 + | +LL | AliasFixed::<()>::TSVariant::<()>(()); + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:58:28 + | +LL | Enum::<()>::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:61:23 + | +LL | Alias::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:63:29 + | +LL | Alias::<()>::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:66:28 + | +LL | AliasFixed::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error[E0107]: wrong number of type arguments: expected 0, found 1 + --> $DIR/enum-variant-generic-args.rs:68:18 + | +LL | AliasFixed::<()>::SVariant { v: () }; + | ^^ unexpected type argument + +error[E0107]: wrong number of type arguments: expected 0, found 1 + --> $DIR/enum-variant-generic-args.rs:70:18 + | +LL | AliasFixed::<()>::SVariant::<()> { v: () }; + | ^^ unexpected type argument + +error[E0109]: type arguments are not allowed on this entity + --> $DIR/enum-variant-generic-args.rs:70:34 + | +LL | AliasFixed::<()>::SVariant::<()> { v: () }; + | ^^ type argument not allowed + +error: aborting due to 28 previous errors + +Some errors occurred: E0107, E0109, E0308. +For more information about an error, try `rustc --explain E0107`. diff --git a/src/test/ui/enum/enum-and-module-in-same-scope.rs b/src/test/ui/enum/enum-and-module-in-same-scope.rs index 9b6c8712f69..cc6e199bd7c 100644 --- a/src/test/ui/enum/enum-and-module-in-same-scope.rs +++ b/src/test/ui/enum/enum-and-module-in-same-scope.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { X } diff --git a/src/test/ui/enum/enum-and-module-in-same-scope.stderr b/src/test/ui/enum/enum-and-module-in-same-scope.stderr index 230872abe0b..5f42af8f260 100644 --- a/src/test/ui/enum/enum-and-module-in-same-scope.stderr +++ b/src/test/ui/enum/enum-and-module-in-same-scope.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `Foo` is defined multiple times - --> $DIR/enum-and-module-in-same-scope.rs:15:1 + --> $DIR/enum-and-module-in-same-scope.rs:5:1 | LL | enum Foo { | -------- previous definition of the type `Foo` here diff --git a/src/test/ui/enum/enum-discrim-autosizing.rs b/src/test/ui/enum/enum-discrim-autosizing.rs index dab22de1b6e..e9bb9275971 100644 --- a/src/test/ui/enum/enum-discrim-autosizing.rs +++ b/src/test/ui/enum/enum-discrim-autosizing.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // With no repr attribute the discriminant will default to isize. // On 32-bit architectures this is equivalent to i32 so the variants // collide. On other architectures we need compilation to fail anyway, diff --git a/src/test/ui/enum/enum-discrim-autosizing.stderr b/src/test/ui/enum/enum-discrim-autosizing.stderr index e4419d62851..67b0d75d787 100644 --- a/src/test/ui/enum/enum-discrim-autosizing.stderr +++ b/src/test/ui/enum/enum-discrim-autosizing.stderr @@ -1,5 +1,5 @@ error[E0081]: discriminant value `0` already exists - --> $DIR/enum-discrim-autosizing.rs:18:12 + --> $DIR/enum-discrim-autosizing.rs:8:12 | LL | Au64 = 0, | - first use of `0` diff --git a/src/test/ui/enum/enum-discrim-too-small.rs b/src/test/ui/enum/enum-discrim-too-small.rs index 393a67be57f..e498414020b 100644 --- a/src/test/ui/enum/enum-discrim-too-small.rs +++ b/src/test/ui/enum/enum-discrim-too-small.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #[repr(u8)] enum Eu8 { Au8 = 23, diff --git a/src/test/ui/enum/enum-discrim-too-small.stderr b/src/test/ui/enum/enum-discrim-too-small.stderr index 4c8ff52c12b..40205d95b1f 100644 --- a/src/test/ui/enum/enum-discrim-too-small.stderr +++ b/src/test/ui/enum/enum-discrim-too-small.stderr @@ -1,5 +1,5 @@ error[E0600]: cannot apply unary operator `-` to type `u8` - --> $DIR/enum-discrim-too-small.rs:16:11 + --> $DIR/enum-discrim-too-small.rs:5:11 | LL | Cu8 = -23, | ^^^ cannot apply unary operator `-` @@ -7,7 +7,7 @@ LL | Cu8 = -23, = note: unsigned values cannot be negated error[E0600]: cannot apply unary operator `-` to type `u16` - --> $DIR/enum-discrim-too-small.rs:24:12 + --> $DIR/enum-discrim-too-small.rs:13:12 | LL | Cu16 = -22333, | ^^^^^^ cannot apply unary operator `-` @@ -15,7 +15,7 @@ LL | Cu16 = -22333, = note: unsigned values cannot be negated error[E0600]: cannot apply unary operator `-` to type `u32` - --> $DIR/enum-discrim-too-small.rs:32:12 + --> $DIR/enum-discrim-too-small.rs:21:12 | LL | Cu32 = -2_000_000_000, | ^^^^^^^^^^^^^^ cannot apply unary operator `-` @@ -23,7 +23,7 @@ LL | Cu32 = -2_000_000_000, = note: unsigned values cannot be negated error[E0600]: cannot apply unary operator `-` to type `u64` - --> $DIR/enum-discrim-too-small.rs:40:12 + --> $DIR/enum-discrim-too-small.rs:29:12 | LL | Cu32 = -2_000_000_000, | ^^^^^^^^^^^^^^ cannot apply unary operator `-` diff --git a/src/test/ui/enum/enum-discrim-too-small2.rs b/src/test/ui/enum/enum-discrim-too-small2.rs index d66716c14c3..af605643025 100644 --- a/src/test/ui/enum/enum-discrim-too-small2.rs +++ b/src/test/ui/enum/enum-discrim-too-small2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(overflowing_literals)] #![allow(dead_code)] diff --git a/src/test/ui/enum/enum-discrim-too-small2.stderr b/src/test/ui/enum/enum-discrim-too-small2.stderr index 536dbf64a9d..31ca01b86bd 100644 --- a/src/test/ui/enum/enum-discrim-too-small2.stderr +++ b/src/test/ui/enum/enum-discrim-too-small2.stderr @@ -1,29 +1,29 @@ error: literal out of range for i8 - --> $DIR/enum-discrim-too-small2.rs:18:11 + --> $DIR/enum-discrim-too-small2.rs:8:11 | LL | Ci8 = 223, //~ ERROR literal out of range for i8 | ^^^ | note: lint level defined here - --> $DIR/enum-discrim-too-small2.rs:11:9 + --> $DIR/enum-discrim-too-small2.rs:1:9 | LL | #![deny(overflowing_literals)] | ^^^^^^^^^^^^^^^^^^^^ error: literal out of range for i16 - --> $DIR/enum-discrim-too-small2.rs:25:12 + --> $DIR/enum-discrim-too-small2.rs:15:12 | LL | Ci16 = 55555, //~ ERROR literal out of range for i16 | ^^^^^ error: literal out of range for i32 - --> $DIR/enum-discrim-too-small2.rs:32:12 + --> $DIR/enum-discrim-too-small2.rs:22:12 | LL | Ci32 = 3_000_000_000, //~ ERROR literal out of range for i32 | ^^^^^^^^^^^^^ error: literal out of range for i64 - --> $DIR/enum-discrim-too-small2.rs:39:12 + --> $DIR/enum-discrim-too-small2.rs:29:12 | LL | Ci64 = 9223372036854775809, //~ ERROR literal out of range for i64 | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/enum/enum-in-scope.rs b/src/test/ui/enum/enum-in-scope.rs index bc1bd03f2d6..df14bc62e76 100644 --- a/src/test/ui/enum/enum-in-scope.rs +++ b/src/test/ui/enum/enum-in-scope.rs @@ -1,12 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#![allow(non_camel_case_types)] struct hello(isize); diff --git a/src/test/ui/enum/enum-in-scope.stderr b/src/test/ui/enum/enum-in-scope.stderr index b294aabb4ed..cd0100ec2fc 100644 --- a/src/test/ui/enum/enum-in-scope.stderr +++ b/src/test/ui/enum/enum-in-scope.stderr @@ -1,5 +1,5 @@ error[E0530]: let bindings cannot shadow tuple structs - --> $DIR/enum-in-scope.rs:14:9 + --> $DIR/enum-in-scope.rs:6:9 | LL | struct hello(isize); | -------------------- the tuple struct `hello` is defined here diff --git a/src/test/ui/enum/enum-size-variance.rs b/src/test/ui/enum/enum-size-variance.rs index 582998a986d..082bd0dcfb2 100644 --- a/src/test/ui/enum/enum-size-variance.rs +++ b/src/test/ui/enum/enum-size-variance.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![warn(variant_size_differences)] diff --git a/src/test/ui/enum/enum-size-variance.stderr b/src/test/ui/enum/enum-size-variance.stderr index f6df65b1d9d..5cc0a0d7a8f 100644 --- a/src/test/ui/enum/enum-size-variance.stderr +++ b/src/test/ui/enum/enum-size-variance.stderr @@ -1,11 +1,11 @@ warning: enum variant is more than three times larger (32 bytes) than the next largest - --> $DIR/enum-size-variance.rs:28:5 + --> $DIR/enum-size-variance.rs:18:5 | LL | L(i64, i64, i64, i64), //~ WARNING three times larger | ^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/enum-size-variance.rs:13:9 + --> $DIR/enum-size-variance.rs:3:9 | LL | #![warn(variant_size_differences)] | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/enum/enum-to-float-cast-2.rs b/src/test/ui/enum/enum-to-float-cast-2.rs index e6f473c8aac..c861b5ed9ff 100644 --- a/src/test/ui/enum/enum-to-float-cast-2.rs +++ b/src/test/ui/enum/enum-to-float-cast-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that enum-to-float casts are disallowed. enum E { diff --git a/src/test/ui/enum/enum-to-float-cast-2.stderr b/src/test/ui/enum/enum-to-float-cast-2.stderr index e8e6d8fbcfb..42d08a11ed1 100644 --- a/src/test/ui/enum/enum-to-float-cast-2.stderr +++ b/src/test/ui/enum/enum-to-float-cast-2.stderr @@ -1,5 +1,5 @@ error[E0606]: casting `E` as `f32` is invalid - --> $DIR/enum-to-float-cast-2.rs:24:13 + --> $DIR/enum-to-float-cast-2.rs:14:13 | LL | let a = E::L0 as f32; //~ ERROR casting | ^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | let a = E::L0 as f32; //~ ERROR casting = help: cast through an integer first error[E0606]: casting `F` as `f32` is invalid - --> $DIR/enum-to-float-cast-2.rs:25:13 + --> $DIR/enum-to-float-cast-2.rs:15:13 | LL | let c = F::H1 as f32; //~ ERROR casting | ^^^^^^^^^^^^ diff --git a/src/test/ui/enum/enum-to-float-cast.rs b/src/test/ui/enum/enum-to-float-cast.rs index b562ba0e41a..05acdfd34e2 100644 --- a/src/test/ui/enum/enum-to-float-cast.rs +++ b/src/test/ui/enum/enum-to-float-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that enum-to-float casts are disallowed. enum E { diff --git a/src/test/ui/enum/enum-to-float-cast.stderr b/src/test/ui/enum/enum-to-float-cast.stderr index adc2015909c..e6cd2ed4d0d 100644 --- a/src/test/ui/enum/enum-to-float-cast.stderr +++ b/src/test/ui/enum/enum-to-float-cast.stderr @@ -1,5 +1,5 @@ error[E0606]: casting `E` as `f32` is invalid - --> $DIR/enum-to-float-cast.rs:23:18 + --> $DIR/enum-to-float-cast.rs:13:18 | LL | static C0: f32 = E::L0 as f32; //~ ERROR casting | ^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | static C0: f32 = E::L0 as f32; //~ ERROR casting = help: cast through an integer first error[E0606]: casting `F` as `f32` is invalid - --> $DIR/enum-to-float-cast.rs:24:18 + --> $DIR/enum-to-float-cast.rs:14:18 | LL | static C1: f32 = F::H1 as f32; //~ ERROR casting | ^^^^^^^^^^^^ diff --git a/src/test/ui/enum/enum-variant-type-2.rs b/src/test/ui/enum/enum-variant-type-2.rs index 258bfd1e3ba..27286a0a3dd 100644 --- a/src/test/ui/enum/enum-variant-type-2.rs +++ b/src/test/ui/enum/enum-variant-type-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that enum variants are not actually types. enum Foo { diff --git a/src/test/ui/enum/enum-variant-type-2.stderr b/src/test/ui/enum/enum-variant-type-2.stderr index 7a786af71bb..3e7a4edd66e 100644 --- a/src/test/ui/enum/enum-variant-type-2.stderr +++ b/src/test/ui/enum/enum-variant-type-2.stderr @@ -1,11 +1,11 @@ error[E0573]: expected type, found variant `Foo::Bar` - --> $DIR/enum-variant-type-2.rs:17:11 + --> $DIR/enum-variant-type-2.rs:7:11 | LL | fn foo(x: Foo::Bar) {} //~ ERROR expected type, found variant `Foo::Bar` | ^^^^^^^^ | | | not a type - | help: you can try using the variant's enum: `Foo` + | help: try using the variant's enum: `Foo` error: aborting due to previous error diff --git a/src/test/ui/enums-pats-not-idents.rs b/src/test/ui/enums-pats-not-idents.rs index 36bd54f599b..1593f1e1b16 100644 --- a/src/test/ui/enums-pats-not-idents.rs +++ b/src/test/ui/enums-pats-not-idents.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let a(1) = 13; //~ ERROR cannot find tuple struct/variant `a` in this scope } diff --git a/src/test/ui/enums-pats-not-idents.stderr b/src/test/ui/enums-pats-not-idents.stderr index 5bd119622e5..5e12f3b5ead 100644 --- a/src/test/ui/enums-pats-not-idents.stderr +++ b/src/test/ui/enums-pats-not-idents.stderr @@ -1,5 +1,5 @@ error[E0531]: cannot find tuple struct/variant `a` in this scope - --> $DIR/enums-pats-not-idents.rs:12:9 + --> $DIR/enums-pats-not-idents.rs:2:9 | LL | let a(1) = 13; //~ ERROR cannot find tuple struct/variant `a` in this scope | ^ not found in this scope diff --git a/src/test/ui/error-codes/E0001.rs b/src/test/ui/error-codes/E0001.rs index b72b0d66190..2c95f02bf34 100644 --- a/src/test/ui/error-codes/E0001.rs +++ b/src/test/ui/error-codes/E0001.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unreachable_patterns)] fn main() { diff --git a/src/test/ui/error-codes/E0001.stderr b/src/test/ui/error-codes/E0001.stderr index af67a438f52..0b884c54a82 100644 --- a/src/test/ui/error-codes/E0001.stderr +++ b/src/test/ui/error-codes/E0001.stderr @@ -1,11 +1,11 @@ error: unreachable pattern - --> $DIR/E0001.rs:18:9 + --> $DIR/E0001.rs:8:9 | LL | _ => {/* ... */} //~ ERROR unreachable pattern | ^ | note: lint level defined here - --> $DIR/E0001.rs:11:9 + --> $DIR/E0001.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0004-2.rs b/src/test/ui/error-codes/E0004-2.rs index 824b86cfa83..c7612fd50a7 100644 --- a/src/test/ui/error-codes/E0004-2.rs +++ b/src/test/ui/error-codes/E0004-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = Some(1); diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr index 900812787bc..8b262cc6eb7 100644 --- a/src/test/ui/error-codes/E0004-2.stderr +++ b/src/test/ui/error-codes/E0004-2.stderr @@ -1,11 +1,11 @@ -error[E0004]: non-exhaustive patterns: type std::option::Option is non-empty - --> $DIR/E0004-2.rs:14:11 +error[E0004]: non-exhaustive patterns: type `std::option::Option` is non-empty + --> $DIR/E0004-2.rs:4:11 | LL | match x { } //~ ERROR E0004 | ^ | help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/E0004-2.rs:14:11 + --> $DIR/E0004-2.rs:4:11 | LL | match x { } //~ ERROR E0004 | ^ diff --git a/src/test/ui/error-codes/E0004.rs b/src/test/ui/error-codes/E0004.rs index 8df07a0c1c5..1ee9d2bad14 100644 --- a/src/test/ui/error-codes/E0004.rs +++ b/src/test/ui/error-codes/E0004.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Terminator { HastaLaVistaBaby, TalkToMyHand, diff --git a/src/test/ui/error-codes/E0004.stderr b/src/test/ui/error-codes/E0004.stderr index cf364a88689..a66dd929032 100644 --- a/src/test/ui/error-codes/E0004.stderr +++ b/src/test/ui/error-codes/E0004.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `HastaLaVistaBaby` not covered - --> $DIR/E0004.rs:19:11 + --> $DIR/E0004.rs:9:11 | LL | match x { //~ ERROR E0004 | ^ pattern `HastaLaVistaBaby` not covered diff --git a/src/test/ui/error-codes/E0005.rs b/src/test/ui/error-codes/E0005.rs index 0405bba81b5..f4730697e18 100644 --- a/src/test/ui/error-codes/E0005.rs +++ b/src/test/ui/error-codes/E0005.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = Some(1); let Some(y) = x; //~ ERROR E0005 diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr index b321a69805e..2a38aae0873 100644 --- a/src/test/ui/error-codes/E0005.stderr +++ b/src/test/ui/error-codes/E0005.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding: `None` not covered - --> $DIR/E0005.rs:13:9 + --> $DIR/E0005.rs:3:9 | LL | let Some(y) = x; //~ ERROR E0005 | ^^^^^^^ pattern `None` not covered diff --git a/src/test/ui/error-codes/E0007.rs b/src/test/ui/error-codes/E0007.rs index d5acbdebbe9..8fc6342002b 100644 --- a/src/test/ui/error-codes/E0007.rs +++ b/src/test/ui/error-codes/E0007.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = Some("s".to_string()); match x { diff --git a/src/test/ui/error-codes/E0007.stderr b/src/test/ui/error-codes/E0007.stderr index f662365b8f1..a5d694976cf 100644 --- a/src/test/ui/error-codes/E0007.stderr +++ b/src/test/ui/error-codes/E0007.stderr @@ -1,11 +1,11 @@ error[E0007]: cannot bind by-move with sub-bindings - --> $DIR/E0007.rs:14:9 + --> $DIR/E0007.rs:4:9 | LL | op_string @ Some(s) => {}, | ^^^^^^^^^^^^^^^^^^^ binds an already bound by-move value by moving it error[E0303]: pattern bindings are not allowed after an `@` - --> $DIR/E0007.rs:14:26 + --> $DIR/E0007.rs:4:26 | LL | op_string @ Some(s) => {}, | ^ not allowed after `@` diff --git a/src/test/ui/error-codes/E0008.nll.stderr b/src/test/ui/error-codes/E0008.nll.stderr index ce627cb741a..2505c03a148 100644 --- a/src/test/ui/error-codes/E0008.nll.stderr +++ b/src/test/ui/error-codes/E0008.nll.stderr @@ -1,5 +1,5 @@ error[E0008]: cannot bind by-move into a pattern guard - --> $DIR/E0008.rs:13:14 + --> $DIR/E0008.rs:3:14 | LL | Some(s) if s.len() == 0 => {}, | ^ moves value into pattern guard diff --git a/src/test/ui/error-codes/E0008.rs b/src/test/ui/error-codes/E0008.rs index ba5720e6f0a..c87ef4cb854 100644 --- a/src/test/ui/error-codes/E0008.rs +++ b/src/test/ui/error-codes/E0008.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match Some("hi".to_string()) { Some(s) if s.len() == 0 => {}, diff --git a/src/test/ui/error-codes/E0008.stderr b/src/test/ui/error-codes/E0008.stderr index e9af3166ed5..d5c44efd667 100644 --- a/src/test/ui/error-codes/E0008.stderr +++ b/src/test/ui/error-codes/E0008.stderr @@ -1,5 +1,5 @@ error[E0008]: cannot bind by-move into a pattern guard - --> $DIR/E0008.rs:13:14 + --> $DIR/E0008.rs:3:14 | LL | Some(s) if s.len() == 0 => {}, | ^ moves value into pattern guard diff --git a/src/test/ui/error-codes/E0009.rs b/src/test/ui/error-codes/E0009.rs index 02e2e80e7ea..0610d03cfe9 100644 --- a/src/test/ui/error-codes/E0009.rs +++ b/src/test/ui/error-codes/E0009.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { struct X { x: (), } let x = Some((X { x: () }, X { x: () })); diff --git a/src/test/ui/error-codes/E0009.stderr b/src/test/ui/error-codes/E0009.stderr index 8b3071420dd..f8acb9a09d9 100644 --- a/src/test/ui/error-codes/E0009.stderr +++ b/src/test/ui/error-codes/E0009.stderr @@ -1,5 +1,5 @@ error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/E0009.rs:15:15 + --> $DIR/E0009.rs:5:15 | LL | Some((y, ref z)) => {}, | ^ ----- both by-ref and by-move used diff --git a/src/test/ui/error-codes/E0010-teach.rs b/src/test/ui/error-codes/E0010-teach.rs index e5ccf32af14..da51035ab55 100644 --- a/src/test/ui/error-codes/E0010-teach.rs +++ b/src/test/ui/error-codes/E0010-teach.rs @@ -1,18 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z teach #![feature(box_syntax)] #![allow(warnings)] const CON : Box = box 0; //~ ERROR E0010 +//~^ ERROR constant contains unimplemented expression type fn main() {} diff --git a/src/test/ui/error-codes/E0010-teach.stderr b/src/test/ui/error-codes/E0010-teach.stderr index fa5c767caf2..77e7b5ec0e8 100644 --- a/src/test/ui/error-codes/E0010-teach.stderr +++ b/src/test/ui/error-codes/E0010-teach.stderr @@ -1,11 +1,21 @@ error[E0010]: allocations are not allowed in constants - --> $DIR/E0010-teach.rs:16:24 + --> $DIR/E0010-teach.rs:6:24 | LL | const CON : Box = box 0; //~ ERROR E0010 | ^^^^^ allocation not allowed in constants | = note: The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time. -error: aborting due to previous error +error[E0019]: constant contains unimplemented expression type + --> $DIR/E0010-teach.rs:6:28 + | +LL | const CON : Box = box 0; //~ ERROR E0010 + | ^ + | + = note: A function call isn't allowed in the const's initialization expression because the expression's value must be known at compile-time. + = note: Remember: you can't use a function call inside a const's initialization expression! However, you can use it anywhere else. + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0010`. +Some errors occurred: E0010, E0019. +For more information about an error, try `rustc --explain E0010`. diff --git a/src/test/ui/error-codes/E0010.rs b/src/test/ui/error-codes/E0010.rs index 66a9319a7df..3398e2c28ba 100644 --- a/src/test/ui/error-codes/E0010.rs +++ b/src/test/ui/error-codes/E0010.rs @@ -1,16 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] #![allow(warnings)] const CON : Box = box 0; //~ ERROR E0010 +//~^ ERROR constant contains unimplemented expression type fn main() {} diff --git a/src/test/ui/error-codes/E0010.stderr b/src/test/ui/error-codes/E0010.stderr index 83c1b409a51..1364693109e 100644 --- a/src/test/ui/error-codes/E0010.stderr +++ b/src/test/ui/error-codes/E0010.stderr @@ -1,9 +1,16 @@ error[E0010]: allocations are not allowed in constants - --> $DIR/E0010.rs:14:24 + --> $DIR/E0010.rs:4:24 | LL | const CON : Box = box 0; //~ ERROR E0010 | ^^^^^ allocation not allowed in constants -error: aborting due to previous error +error[E0019]: constant contains unimplemented expression type + --> $DIR/E0010.rs:4:28 + | +LL | const CON : Box = box 0; //~ ERROR E0010 + | ^ + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0010`. +Some errors occurred: E0010, E0019. +For more information about an error, try `rustc --explain E0010`. diff --git a/src/test/ui/error-codes/E0017.nll.stderr b/src/test/ui/error-codes/E0017.nll.stderr index 08708d213d3..305e85563eb 100644 --- a/src/test/ui/error-codes/E0017.nll.stderr +++ b/src/test/ui/error-codes/E0017.nll.stderr @@ -1,28 +1,34 @@ error[E0017]: references in constants may only refer to immutable values - --> $DIR/E0017.rs:14:30 + --> $DIR/E0017.rs:4:30 | LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 | ^^^^^^ constants require immutable values +error: cannot mutate statics in the initializer of another static + --> $DIR/E0017.rs:5:39 + | +LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 + | ^^^^^^ + error[E0017]: references in statics may only refer to immutable values - --> $DIR/E0017.rs:15:39 + --> $DIR/E0017.rs:5:39 | LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 | ^^^^^^ statics require immutable values error[E0596]: cannot borrow immutable static item `X` as mutable - --> $DIR/E0017.rs:15:39 + --> $DIR/E0017.rs:5:39 | LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 | ^^^^^^ cannot borrow as mutable error[E0017]: references in statics may only refer to immutable values - --> $DIR/E0017.rs:17:38 + --> $DIR/E0017.rs:8:38 | LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 | ^^^^^^ statics require immutable values -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors Some errors occurred: E0017, E0596. For more information about an error, try `rustc --explain E0017`. diff --git a/src/test/ui/error-codes/E0017.rs b/src/test/ui/error-codes/E0017.rs index c98c35a1442..71250eb4621 100644 --- a/src/test/ui/error-codes/E0017.rs +++ b/src/test/ui/error-codes/E0017.rs @@ -1,18 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static X: i32 = 1; const C: i32 = 2; const CR: &'static mut i32 = &mut C; //~ ERROR E0017 static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 //~| ERROR cannot borrow + //~| ERROR cannot mutate statics static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 fn main() {} diff --git a/src/test/ui/error-codes/E0017.stderr b/src/test/ui/error-codes/E0017.stderr index 411b9f31397..93f5ca55455 100644 --- a/src/test/ui/error-codes/E0017.stderr +++ b/src/test/ui/error-codes/E0017.stderr @@ -1,28 +1,34 @@ error[E0017]: references in constants may only refer to immutable values - --> $DIR/E0017.rs:14:30 + --> $DIR/E0017.rs:4:30 | LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 | ^^^^^^ constants require immutable values +error: cannot mutate statics in the initializer of another static + --> $DIR/E0017.rs:5:39 + | +LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 + | ^^^^^^ + error[E0017]: references in statics may only refer to immutable values - --> $DIR/E0017.rs:15:39 + --> $DIR/E0017.rs:5:39 | LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 | ^^^^^^ statics require immutable values error[E0596]: cannot borrow immutable static item as mutable - --> $DIR/E0017.rs:15:44 + --> $DIR/E0017.rs:5:44 | LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 | ^ error[E0017]: references in statics may only refer to immutable values - --> $DIR/E0017.rs:17:38 + --> $DIR/E0017.rs:8:38 | LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 | ^^^^^^ statics require immutable values -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors Some errors occurred: E0017, E0596. For more information about an error, try `rustc --explain E0017`. diff --git a/src/test/ui/error-codes/E0023.rs b/src/test/ui/error-codes/E0023.rs index 24032c59844..2a97e9048a4 100644 --- a/src/test/ui/error-codes/E0023.rs +++ b/src/test/ui/error-codes/E0023.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Fruit { Apple(String, String), Pear(u32), diff --git a/src/test/ui/error-codes/E0023.stderr b/src/test/ui/error-codes/E0023.stderr index 26f7baeb1a4..37704fc3233 100644 --- a/src/test/ui/error-codes/E0023.stderr +++ b/src/test/ui/error-codes/E0023.stderr @@ -1,17 +1,17 @@ error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields - --> $DIR/E0023.rs:20:9 + --> $DIR/E0023.rs:10:9 | LL | Fruit::Apple(a) => {}, //~ ERROR E0023 | ^^^^^^^^^^^^^^^ expected 2 fields, found 1 error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields - --> $DIR/E0023.rs:21:9 + --> $DIR/E0023.rs:11:9 | LL | Fruit::Apple(a, b, c) => {}, //~ ERROR E0023 | ^^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 3 error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field - --> $DIR/E0023.rs:22:9 + --> $DIR/E0023.rs:12:9 | LL | Fruit::Pear(1, 2) => {}, //~ ERROR E0023 | ^^^^^^^^^^^^^^^^^ expected 1 field, found 2 diff --git a/src/test/ui/error-codes/E0025.rs b/src/test/ui/error-codes/E0025.rs index 81d0ea8a5e2..549269a7542 100644 --- a/src/test/ui/error-codes/E0025.rs +++ b/src/test/ui/error-codes/E0025.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { a: u8, b: u8, diff --git a/src/test/ui/error-codes/E0025.stderr b/src/test/ui/error-codes/E0025.stderr index f60372559a3..dfec6d0276a 100644 --- a/src/test/ui/error-codes/E0025.stderr +++ b/src/test/ui/error-codes/E0025.stderr @@ -1,5 +1,5 @@ error[E0025]: field `a` bound multiple times in the pattern - --> $DIR/E0025.rs:18:21 + --> $DIR/E0025.rs:8:21 | LL | let Foo { a: x, a: y, b: 0 } = x; | ---- ^^^^ multiple uses of `a` in pattern diff --git a/src/test/ui/error-codes/E0026-teach.rs b/src/test/ui/error-codes/E0026-teach.rs index e0ce44a8b6f..7c51004ffe4 100644 --- a/src/test/ui/error-codes/E0026-teach.rs +++ b/src/test/ui/error-codes/E0026-teach.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z teach struct Thing { diff --git a/src/test/ui/error-codes/E0026-teach.stderr b/src/test/ui/error-codes/E0026-teach.stderr index 67ea32fba86..1a80edcbbe2 100644 --- a/src/test/ui/error-codes/E0026-teach.stderr +++ b/src/test/ui/error-codes/E0026-teach.stderr @@ -1,5 +1,5 @@ error[E0026]: struct `Thing` does not have a field named `z` - --> $DIR/E0026-teach.rs:21:23 + --> $DIR/E0026-teach.rs:11:23 | LL | Thing { x, y, z } => {} | ^ struct `Thing` does not have this field diff --git a/src/test/ui/error-codes/E0026.rs b/src/test/ui/error-codes/E0026.rs index f8ad7b5a30e..0b1ea1c7bcd 100644 --- a/src/test/ui/error-codes/E0026.rs +++ b/src/test/ui/error-codes/E0026.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Thing { x: u32, y: u32 diff --git a/src/test/ui/error-codes/E0026.stderr b/src/test/ui/error-codes/E0026.stderr index 9dabbc8a775..031481812d0 100644 --- a/src/test/ui/error-codes/E0026.stderr +++ b/src/test/ui/error-codes/E0026.stderr @@ -1,5 +1,5 @@ error[E0026]: struct `Thing` does not have a field named `z` - --> $DIR/E0026.rs:19:23 + --> $DIR/E0026.rs:9:23 | LL | Thing { x, y, z } => {} | ^ struct `Thing` does not have this field diff --git a/src/test/ui/error-codes/E0027-teach.rs b/src/test/ui/error-codes/E0027-teach.rs index 17e045bb8b0..11402f01484 100644 --- a/src/test/ui/error-codes/E0027-teach.rs +++ b/src/test/ui/error-codes/E0027-teach.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z teach struct Dog { diff --git a/src/test/ui/error-codes/E0027-teach.stderr b/src/test/ui/error-codes/E0027-teach.stderr index 1c5333d76a8..aa4cb9d4d18 100644 --- a/src/test/ui/error-codes/E0027-teach.stderr +++ b/src/test/ui/error-codes/E0027-teach.stderr @@ -1,5 +1,5 @@ error[E0027]: pattern does not mention field `name` - --> $DIR/E0027-teach.rs:22:9 + --> $DIR/E0027-teach.rs:12:9 | LL | Dog { age: x } => {} | ^^^^^^^^^^^^^^ missing field `name` diff --git a/src/test/ui/error-codes/E0027.rs b/src/test/ui/error-codes/E0027.rs index b63b0ab5dfd..b8c6a2b7fcd 100644 --- a/src/test/ui/error-codes/E0027.rs +++ b/src/test/ui/error-codes/E0027.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Dog { name: String, age: u32, diff --git a/src/test/ui/error-codes/E0027.stderr b/src/test/ui/error-codes/E0027.stderr index 208b263e0f8..4f17bba6477 100644 --- a/src/test/ui/error-codes/E0027.stderr +++ b/src/test/ui/error-codes/E0027.stderr @@ -1,5 +1,5 @@ error[E0027]: pattern does not mention field `name` - --> $DIR/E0027.rs:20:9 + --> $DIR/E0027.rs:10:9 | LL | Dog { age: x } => {} | ^^^^^^^^^^^^^^ missing field `name` diff --git a/src/test/ui/error-codes/E0029-teach.rs b/src/test/ui/error-codes/E0029-teach.rs index 328c46311af..83058d397cf 100644 --- a/src/test/ui/error-codes/E0029-teach.rs +++ b/src/test/ui/error-codes/E0029-teach.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z teach fn main() { diff --git a/src/test/ui/error-codes/E0029-teach.stderr b/src/test/ui/error-codes/E0029-teach.stderr index bb4fac9a4cb..998ef4bc1d7 100644 --- a/src/test/ui/error-codes/E0029-teach.stderr +++ b/src/test/ui/error-codes/E0029-teach.stderr @@ -1,5 +1,5 @@ error[E0029]: only char and numeric types are allowed in range patterns - --> $DIR/E0029-teach.rs:17:9 + --> $DIR/E0029-teach.rs:7:9 | LL | "hello" ..= "world" => {} | ^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types diff --git a/src/test/ui/error-codes/E0029.rs b/src/test/ui/error-codes/E0029.rs index c89b4f5b377..fe0d851832b 100644 --- a/src/test/ui/error-codes/E0029.rs +++ b/src/test/ui/error-codes/E0029.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let s = "hoho"; diff --git a/src/test/ui/error-codes/E0029.stderr b/src/test/ui/error-codes/E0029.stderr index d25666f9cf8..209d219191c 100644 --- a/src/test/ui/error-codes/E0029.stderr +++ b/src/test/ui/error-codes/E0029.stderr @@ -1,5 +1,5 @@ error[E0029]: only char and numeric types are allowed in range patterns - --> $DIR/E0029.rs:15:9 + --> $DIR/E0029.rs:5:9 | LL | "hello" ..= "world" => {} | ^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types diff --git a/src/test/ui/error-codes/E0030-teach.rs b/src/test/ui/error-codes/E0030-teach.rs index cf860cea24c..388064fb0fa 100644 --- a/src/test/ui/error-codes/E0030-teach.rs +++ b/src/test/ui/error-codes/E0030-teach.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z teach fn main() { diff --git a/src/test/ui/error-codes/E0030-teach.stderr b/src/test/ui/error-codes/E0030-teach.stderr index 2a7243a9569..3f1ad4af3a9 100644 --- a/src/test/ui/error-codes/E0030-teach.stderr +++ b/src/test/ui/error-codes/E0030-teach.stderr @@ -1,5 +1,5 @@ error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/E0030-teach.rs:15:9 + --> $DIR/E0030-teach.rs:5:9 | LL | 1000 ..= 5 => {} | ^^^^ lower bound larger than upper bound diff --git a/src/test/ui/error-codes/E0030.rs b/src/test/ui/error-codes/E0030.rs index e147dd932b0..58d856b7c9d 100644 --- a/src/test/ui/error-codes/E0030.rs +++ b/src/test/ui/error-codes/E0030.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn main() { match 5u32 { 1000 ..= 5 => {} diff --git a/src/test/ui/error-codes/E0030.stderr b/src/test/ui/error-codes/E0030.stderr index 020655ee45b..db8161d8fd5 100644 --- a/src/test/ui/error-codes/E0030.stderr +++ b/src/test/ui/error-codes/E0030.stderr @@ -1,5 +1,5 @@ error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/E0030.rs:14:9 + --> $DIR/E0030.rs:3:9 | LL | 1000 ..= 5 => {} | ^^^^ lower bound larger than upper bound diff --git a/src/test/ui/error-codes/E0033-teach.rs b/src/test/ui/error-codes/E0033-teach.rs index 51a1390bf79..0f0b8d864dc 100644 --- a/src/test/ui/error-codes/E0033-teach.rs +++ b/src/test/ui/error-codes/E0033-teach.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z teach trait SomeTrait { diff --git a/src/test/ui/error-codes/E0033-teach.stderr b/src/test/ui/error-codes/E0033-teach.stderr index 2fac6080f49..81a8f164b94 100644 --- a/src/test/ui/error-codes/E0033-teach.stderr +++ b/src/test/ui/error-codes/E0033-teach.stderr @@ -1,11 +1,11 @@ error[E0423]: expected value, found trait `SomeTrait` - --> $DIR/E0033-teach.rs:18:33 + --> $DIR/E0033-teach.rs:8:33 | LL | let trait_obj: &SomeTrait = SomeTrait; | ^^^^^^^^^ not a value error[E0038]: the trait `SomeTrait` cannot be made into an object - --> $DIR/E0033-teach.rs:18:20 + --> $DIR/E0033-teach.rs:8:20 | LL | let trait_obj: &SomeTrait = SomeTrait; | ^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object @@ -13,7 +13,7 @@ LL | let trait_obj: &SomeTrait = SomeTrait; = note: method `foo` has no receiver error[E0033]: type `&dyn SomeTrait` cannot be dereferenced - --> $DIR/E0033-teach.rs:23:9 + --> $DIR/E0033-teach.rs:13:9 | LL | let &invalid = trait_obj; | ^^^^^^^^ type `&dyn SomeTrait` cannot be dereferenced diff --git a/src/test/ui/error-codes/E0033.rs b/src/test/ui/error-codes/E0033.rs index 3cdbb55f6de..5a4f3cbce60 100644 --- a/src/test/ui/error-codes/E0033.rs +++ b/src/test/ui/error-codes/E0033.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait SomeTrait { fn foo(); } diff --git a/src/test/ui/error-codes/E0033.stderr b/src/test/ui/error-codes/E0033.stderr index 5d789566beb..e250df81c14 100644 --- a/src/test/ui/error-codes/E0033.stderr +++ b/src/test/ui/error-codes/E0033.stderr @@ -1,11 +1,11 @@ error[E0423]: expected value, found trait `SomeTrait` - --> $DIR/E0033.rs:16:33 + --> $DIR/E0033.rs:6:33 | LL | let trait_obj: &SomeTrait = SomeTrait; | ^^^^^^^^^ not a value error[E0038]: the trait `SomeTrait` cannot be made into an object - --> $DIR/E0033.rs:16:20 + --> $DIR/E0033.rs:6:20 | LL | let trait_obj: &SomeTrait = SomeTrait; | ^^^^^^^^^^ the trait `SomeTrait` cannot be made into an object @@ -13,7 +13,7 @@ LL | let trait_obj: &SomeTrait = SomeTrait; = note: method `foo` has no receiver error[E0033]: type `&dyn SomeTrait` cannot be dereferenced - --> $DIR/E0033.rs:21:9 + --> $DIR/E0033.rs:11:9 | LL | let &invalid = trait_obj; | ^^^^^^^^ type `&dyn SomeTrait` cannot be dereferenced diff --git a/src/test/ui/error-codes/E0034.rs b/src/test/ui/error-codes/E0034.rs index 6eebd4d4d53..f962da115e0 100644 --- a/src/test/ui/error-codes/E0034.rs +++ b/src/test/ui/error-codes/E0034.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Test; trait Trait1 { diff --git a/src/test/ui/error-codes/E0034.stderr b/src/test/ui/error-codes/E0034.stderr index cec0f2d2a80..3c5569eb79f 100644 --- a/src/test/ui/error-codes/E0034.stderr +++ b/src/test/ui/error-codes/E0034.stderr @@ -1,16 +1,16 @@ error[E0034]: multiple applicable items in scope - --> $DIR/E0034.rs:30:5 + --> $DIR/E0034.rs:20:5 | LL | Test::foo() //~ ERROR multiple applicable items in scope | ^^^^^^^^^ multiple `foo` found | note: candidate #1 is defined in an impl of the trait `Trait1` for the type `Test` - --> $DIR/E0034.rs:22:5 + --> $DIR/E0034.rs:12:5 | LL | fn foo() {} | ^^^^^^^^ note: candidate #2 is defined in an impl of the trait `Trait2` for the type `Test` - --> $DIR/E0034.rs:26:5 + --> $DIR/E0034.rs:16:5 | LL | fn foo() {} | ^^^^^^^^ diff --git a/src/test/ui/error-codes/E0038.rs b/src/test/ui/error-codes/E0038.rs index 8087928c051..b2226803da7 100644 --- a/src/test/ui/error-codes/E0038.rs +++ b/src/test/ui/error-codes/E0038.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait { fn foo(&self) -> Self; } diff --git a/src/test/ui/error-codes/E0038.stderr b/src/test/ui/error-codes/E0038.stderr index bc76323f183..74b77338c85 100644 --- a/src/test/ui/error-codes/E0038.stderr +++ b/src/test/ui/error-codes/E0038.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Trait` cannot be made into an object - --> $DIR/E0038.rs:15:1 + --> $DIR/E0038.rs:5:1 | LL | fn call_foo(x: Box) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` cannot be made into an object diff --git a/src/test/ui/error-codes/E0040.rs b/src/test/ui/error-codes/E0040.rs index 8385d68c540..113efae82c5 100644 --- a/src/test/ui/error-codes/E0040.rs +++ b/src/test/ui/error-codes/E0040.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: i32, } diff --git a/src/test/ui/error-codes/E0040.stderr b/src/test/ui/error-codes/E0040.stderr index 01636ae98b8..96645590281 100644 --- a/src/test/ui/error-codes/E0040.stderr +++ b/src/test/ui/error-codes/E0040.stderr @@ -1,5 +1,5 @@ error[E0040]: explicit use of destructor method - --> $DIR/E0040.rs:23:7 + --> $DIR/E0040.rs:13:7 | LL | x.drop(); | ^^^^ explicit destructor calls not allowed diff --git a/src/test/ui/error-codes/E0044.rs b/src/test/ui/error-codes/E0044.rs index 35e3c768558..a5265e7dc17 100644 --- a/src/test/ui/error-codes/E0044.rs +++ b/src/test/ui/error-codes/E0044.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { fn sqrt(f: T) -> T; //~^ ERROR foreign items may not have type parameters [E0044] diff --git a/src/test/ui/error-codes/E0044.stderr b/src/test/ui/error-codes/E0044.stderr index ce966251bf4..57c21116b28 100644 --- a/src/test/ui/error-codes/E0044.stderr +++ b/src/test/ui/error-codes/E0044.stderr @@ -1,5 +1,5 @@ error[E0044]: foreign items may not have type parameters - --> $DIR/E0044.rs:12:5 + --> $DIR/E0044.rs:2:5 | LL | fn sqrt(f: T) -> T; | ^^^^^^^^^^^^^^^^^^^^^^ can't have type parameters diff --git a/src/test/ui/error-codes/E0045.rs b/src/test/ui/error-codes/E0045.rs index 57c639dd143..fb3df56f706 100644 --- a/src/test/ui/error-codes/E0045.rs +++ b/src/test/ui/error-codes/E0045.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern "Rust" { fn foo(x: u8, ...); } //~ ERROR E0045 fn main() { diff --git a/src/test/ui/error-codes/E0045.stderr b/src/test/ui/error-codes/E0045.stderr index 35a592a6986..b38bbc169bd 100644 --- a/src/test/ui/error-codes/E0045.stderr +++ b/src/test/ui/error-codes/E0045.stderr @@ -1,5 +1,5 @@ error[E0045]: variadic function must have C or cdecl calling convention - --> $DIR/E0045.rs:11:17 + --> $DIR/E0045.rs:1:17 | LL | extern "Rust" { fn foo(x: u8, ...); } //~ ERROR E0045 | ^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention diff --git a/src/test/ui/error-codes/E0049.rs b/src/test/ui/error-codes/E0049.rs index 5867e11e9ac..c141f8a8828 100644 --- a/src/test/ui/error-codes/E0049.rs +++ b/src/test/ui/error-codes/E0049.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(x: T) -> Self; } diff --git a/src/test/ui/error-codes/E0049.stderr b/src/test/ui/error-codes/E0049.stderr index b7eaad57043..0d132bdbbdd 100644 --- a/src/test/ui/error-codes/E0049.stderr +++ b/src/test/ui/error-codes/E0049.stderr @@ -1,5 +1,5 @@ error[E0049]: method `foo` has 0 type parameters but its trait declaration has 1 type parameter - --> $DIR/E0049.rs:18:5 + --> $DIR/E0049.rs:8:5 | LL | fn foo(x: T) -> Self; | --------------------------------- expected 1 type parameter diff --git a/src/test/ui/error-codes/E0050.rs b/src/test/ui/error-codes/E0050.rs index 2ccc380c540..98fb62785ee 100644 --- a/src/test/ui/error-codes/E0050.rs +++ b/src/test/ui/error-codes/E0050.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(&self, x: u8) -> bool; fn bar(&self, x: u8, y: u8, z: u8); diff --git a/src/test/ui/error-codes/E0050.stderr b/src/test/ui/error-codes/E0050.stderr index bff3b7b16b9..2c1fd111d26 100644 --- a/src/test/ui/error-codes/E0050.stderr +++ b/src/test/ui/error-codes/E0050.stderr @@ -1,29 +1,29 @@ error[E0050]: method `foo` has 1 parameter but the declaration in trait `Foo::foo` has 2 - --> $DIR/E0050.rs:20:12 + --> $DIR/E0050.rs:10:12 | LL | fn foo(&self, x: u8) -> bool; - | -- trait requires 2 parameters + | ------------ trait requires 2 parameters ... LL | fn foo(&self) -> bool { true } //~ ERROR E0050 | ^^^^^ expected 2 parameters, found 1 error[E0050]: method `bar` has 1 parameter but the declaration in trait `Foo::bar` has 4 - --> $DIR/E0050.rs:21:12 + --> $DIR/E0050.rs:11:12 | LL | fn bar(&self, x: u8, y: u8, z: u8); - | -- trait requires 4 parameters + | -------------------------- trait requires 4 parameters ... LL | fn bar(&self) { } //~ ERROR E0050 | ^^^^^ expected 4 parameters, found 1 error[E0050]: method `less` has 4 parameters but the declaration in trait `Foo::less` has 1 - --> $DIR/E0050.rs:22:37 + --> $DIR/E0050.rs:12:13 | LL | fn less(&self); | ----- trait requires 1 parameter ... LL | fn less(&self, x: u8, y: u8, z: u8) { } //~ ERROR E0050 - | ^^ expected 1 parameter, found 4 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 parameter, found 4 error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0054.rs b/src/test/ui/error-codes/E0054.rs index 158cd6ff9bb..55bda4ead96 100644 --- a/src/test/ui/error-codes/E0054.rs +++ b/src/test/ui/error-codes/E0054.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = 5; let x_is_nonzero = x as bool; //~ ERROR E0054 diff --git a/src/test/ui/error-codes/E0054.stderr b/src/test/ui/error-codes/E0054.stderr index d5cf18460fd..cce32fa2944 100644 --- a/src/test/ui/error-codes/E0054.stderr +++ b/src/test/ui/error-codes/E0054.stderr @@ -1,10 +1,8 @@ error[E0054]: cannot cast as `bool` - --> $DIR/E0054.rs:13:24 + --> $DIR/E0054.rs:3:24 | LL | let x_is_nonzero = x as bool; //~ ERROR E0054 - | ^^^^^^^^^ unsupported cast - | - = help: compare with zero instead + | ^^^^^^^^^ help: compare with zero instead: `x != 0` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0055.rs b/src/test/ui/error-codes/E0055.rs index 6e186b81cad..b525575d98d 100644 --- a/src/test/ui/error-codes/E0055.rs +++ b/src/test/ui/error-codes/E0055.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![recursion_limit="2"] +#![recursion_limit="5"] struct Foo; impl Foo { @@ -17,7 +7,7 @@ impl Foo { fn main() { let foo = Foo; - let ref_foo = &&Foo; + let ref_foo = &&&&&Foo; ref_foo.foo(); //~^ ERROR E0055 } diff --git a/src/test/ui/error-codes/E0055.stderr b/src/test/ui/error-codes/E0055.stderr index 9653f4eaeef..d06566ffbe9 100644 --- a/src/test/ui/error-codes/E0055.stderr +++ b/src/test/ui/error-codes/E0055.stderr @@ -1,10 +1,10 @@ -error[E0055]: reached the recursion limit while auto-dereferencing Foo - --> $DIR/E0055.rs:21:13 +error[E0055]: reached the recursion limit while auto-dereferencing `Foo` + --> $DIR/E0055.rs:11:13 | LL | ref_foo.foo(); | ^^^ deref recursion limit reached | - = help: consider adding a `#![recursion_limit="4"]` attribute to your crate + = help: consider adding a `#![recursion_limit="10"]` attribute to your crate error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0057.rs b/src/test/ui/error-codes/E0057.rs index 1fb5498b099..83f941f65b9 100644 --- a/src/test/ui/error-codes/E0057.rs +++ b/src/test/ui/error-codes/E0057.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let f = |x| x * 3; let a = f(); //~ ERROR E0057 diff --git a/src/test/ui/error-codes/E0057.stderr b/src/test/ui/error-codes/E0057.stderr index fb3e710b8cf..5906a05c32c 100644 --- a/src/test/ui/error-codes/E0057.stderr +++ b/src/test/ui/error-codes/E0057.stderr @@ -1,11 +1,11 @@ error[E0057]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/E0057.rs:13:13 + --> $DIR/E0057.rs:3:13 | LL | let a = f(); //~ ERROR E0057 | ^^^ expected 1 parameter error[E0057]: this function takes 1 parameter but 2 parameters were supplied - --> $DIR/E0057.rs:15:13 + --> $DIR/E0057.rs:5:13 | LL | let c = f(2, 3); //~ ERROR E0057 | ^^^^^^^ expected 1 parameter diff --git a/src/test/ui/error-codes/E0059.rs b/src/test/ui/error-codes/E0059.rs index 4ae9b2f91d2..f775089bfb9 100644 --- a/src/test/ui/error-codes/E0059.rs +++ b/src/test/ui/error-codes/E0059.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] fn foo>(f: F) -> F::Output { f(3) } //~ ERROR E0059 diff --git a/src/test/ui/error-codes/E0059.stderr b/src/test/ui/error-codes/E0059.stderr index abe8b729c93..a96e1a0beab 100644 --- a/src/test/ui/error-codes/E0059.stderr +++ b/src/test/ui/error-codes/E0059.stderr @@ -1,5 +1,5 @@ error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit - --> $DIR/E0059.rs:13:41 + --> $DIR/E0059.rs:3:41 | LL | fn foo>(f: F) -> F::Output { f(3) } //~ ERROR E0059 | ^^^^ diff --git a/src/test/ui/error-codes/E0060.rs b/src/test/ui/error-codes/E0060.rs index f4505209b66..2bb490fb3ea 100644 --- a/src/test/ui/error-codes/E0060.rs +++ b/src/test/ui/error-codes/E0060.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern "C" { fn printf(_: *const u8, ...) -> u32; } diff --git a/src/test/ui/error-codes/E0060.stderr b/src/test/ui/error-codes/E0060.stderr index c6aac6e41c6..8a2e7d1a72c 100644 --- a/src/test/ui/error-codes/E0060.stderr +++ b/src/test/ui/error-codes/E0060.stderr @@ -1,5 +1,5 @@ error[E0060]: this function takes at least 1 parameter but 0 parameters were supplied - --> $DIR/E0060.rs:16:14 + --> $DIR/E0060.rs:6:14 | LL | fn printf(_: *const u8, ...) -> u32; | ------------------------------------ defined here diff --git a/src/test/ui/error-codes/E0061.rs b/src/test/ui/error-codes/E0061.rs index 221e18cf89d..e64ea36ac92 100644 --- a/src/test/ui/error-codes/E0061.rs +++ b/src/test/ui/error-codes/E0061.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f(a: u16, b: &str) {} fn f2(a: u16) {} diff --git a/src/test/ui/error-codes/E0061.stderr b/src/test/ui/error-codes/E0061.stderr index d5842a18bc8..73103241f7a 100644 --- a/src/test/ui/error-codes/E0061.stderr +++ b/src/test/ui/error-codes/E0061.stderr @@ -1,5 +1,5 @@ error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/E0061.rs:16:5 + --> $DIR/E0061.rs:6:5 | LL | fn f(a: u16, b: &str) {} | --------------------- defined here @@ -8,7 +8,7 @@ LL | f(0); | ^^^^ expected 2 parameters error[E0061]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/E0061.rs:20:5 + --> $DIR/E0061.rs:10:5 | LL | fn f2(a: u16) {} | ------------- defined here diff --git a/src/test/ui/error-codes/E0062.rs b/src/test/ui/error-codes/E0062.rs index 684c9464ff8..3b7f8875086 100644 --- a/src/test/ui/error-codes/E0062.rs +++ b/src/test/ui/error-codes/E0062.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: i32 } diff --git a/src/test/ui/error-codes/E0062.stderr b/src/test/ui/error-codes/E0062.stderr index c5c38c6f5ff..a3e14099507 100644 --- a/src/test/ui/error-codes/E0062.stderr +++ b/src/test/ui/error-codes/E0062.stderr @@ -1,5 +1,5 @@ error[E0062]: field `x` specified more than once - --> $DIR/E0062.rs:18:9 + --> $DIR/E0062.rs:8:9 | LL | x: 0, | ---- first use of `x` diff --git a/src/test/ui/error-codes/E0063.rs b/src/test/ui/error-codes/E0063.rs index 0208aff066b..37fc0a2987d 100644 --- a/src/test/ui/error-codes/E0063.rs +++ b/src/test/ui/error-codes/E0063.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength struct SingleFoo { diff --git a/src/test/ui/error-codes/E0063.stderr b/src/test/ui/error-codes/E0063.stderr index 1ed54b4e7ba..5d366e0c1c4 100644 --- a/src/test/ui/error-codes/E0063.stderr +++ b/src/test/ui/error-codes/E0063.stderr @@ -1,23 +1,23 @@ error[E0063]: missing field `x` in initializer of `SingleFoo` - --> $DIR/E0063.rs:42:13 + --> $DIR/E0063.rs:32:13 | LL | let w = SingleFoo { }; | ^^^^^^^^^ missing `x` error[E0063]: missing fields `y`, `z` in initializer of `PluralFoo` - --> $DIR/E0063.rs:44:13 + --> $DIR/E0063.rs:34:13 | LL | let x = PluralFoo {x: 1}; | ^^^^^^^^^ missing `y`, `z` error[E0063]: missing fields `a`, `b`, `y` and 1 other field in initializer of `TruncatedFoo` - --> $DIR/E0063.rs:46:13 + --> $DIR/E0063.rs:36:13 | LL | let y = TruncatedFoo{x:1}; | ^^^^^^^^^^^^ missing `a`, `b`, `y` and 1 other field error[E0063]: missing fields `a`, `b`, `c` and 2 other fields in initializer of `TruncatedPluralFoo` - --> $DIR/E0063.rs:48:13 + --> $DIR/E0063.rs:38:13 | LL | let z = TruncatedPluralFoo{x:1}; | ^^^^^^^^^^^^^^^^^^ missing `a`, `b`, `c` and 2 other fields diff --git a/src/test/ui/error-codes/E0067.rs b/src/test/ui/error-codes/E0067.rs index a3fc30ee1c7..5925443ddc4 100644 --- a/src/test/ui/error-codes/E0067.rs +++ b/src/test/ui/error-codes/E0067.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::LinkedList; fn main() { diff --git a/src/test/ui/error-codes/E0067.stderr b/src/test/ui/error-codes/E0067.stderr index 43e1ca4096c..fd4ca7c9f70 100644 --- a/src/test/ui/error-codes/E0067.stderr +++ b/src/test/ui/error-codes/E0067.stderr @@ -1,5 +1,5 @@ error[E0368]: binary assignment operation `+=` cannot be applied to type `std::collections::LinkedList<_>` - --> $DIR/E0067.rs:14:5 + --> $DIR/E0067.rs:4:5 | LL | LinkedList::new() += 1; //~ ERROR E0368 | -----------------^^^^^ @@ -9,7 +9,7 @@ LL | LinkedList::new() += 1; //~ ERROR E0368 = note: an implementation of `std::ops::AddAssign` might be missing for `std::collections::LinkedList<_>` error[E0067]: invalid left-hand side expression - --> $DIR/E0067.rs:14:5 + --> $DIR/E0067.rs:4:5 | LL | LinkedList::new() += 1; //~ ERROR E0368 | ^^^^^^^^^^^^^^^^^ invalid expression for left-hand side diff --git a/src/test/ui/error-codes/E0069.rs b/src/test/ui/error-codes/E0069.rs index a6a7898ed4e..a4ba9fd8deb 100644 --- a/src/test/ui/error-codes/E0069.rs +++ b/src/test/ui/error-codes/E0069.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() -> u8 { return; //~^ ERROR `return;` in a function whose return type is not `()` diff --git a/src/test/ui/error-codes/E0069.stderr b/src/test/ui/error-codes/E0069.stderr index 0ba1ed45663..ff9bbe01dd5 100644 --- a/src/test/ui/error-codes/E0069.stderr +++ b/src/test/ui/error-codes/E0069.stderr @@ -1,8 +1,10 @@ error[E0069]: `return;` in a function whose return type is not `()` - --> $DIR/E0069.rs:12:5 + --> $DIR/E0069.rs:2:5 | +LL | fn foo() -> u8 { + | -- expected `u8` because of this return type LL | return; - | ^^^^^^ return type is not () + | ^^^^^^ return type is not `()` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0070.rs b/src/test/ui/error-codes/E0070.rs index ba66bd03aef..ab956d81098 100644 --- a/src/test/ui/error-codes/E0070.rs +++ b/src/test/ui/error-codes/E0070.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const SOME_CONST : i32 = 12; fn some_other_func() {} diff --git a/src/test/ui/error-codes/E0070.stderr b/src/test/ui/error-codes/E0070.stderr index 892e6943112..4c1cfd858e6 100644 --- a/src/test/ui/error-codes/E0070.stderr +++ b/src/test/ui/error-codes/E0070.stderr @@ -1,26 +1,26 @@ error[E0070]: invalid left-hand side expression - --> $DIR/E0070.rs:16:5 + --> $DIR/E0070.rs:6:5 | LL | SOME_CONST = 14; //~ ERROR E0070 | ^^^^^^^^^^^^^^^ left-hand of expression not valid error[E0070]: invalid left-hand side expression - --> $DIR/E0070.rs:17:5 + --> $DIR/E0070.rs:7:5 | LL | 1 = 3; //~ ERROR E0070 | ^^^^^ left-hand of expression not valid error[E0308]: mismatched types - --> $DIR/E0070.rs:18:25 + --> $DIR/E0070.rs:8:25 | LL | some_other_func() = 4; //~ ERROR E0070 - | ^ expected (), found integral variable + | ^ expected (), found integer | = note: expected type `()` found type `{integer}` error[E0070]: invalid left-hand side expression - --> $DIR/E0070.rs:18:5 + --> $DIR/E0070.rs:8:5 | LL | some_other_func() = 4; //~ ERROR E0070 | ^^^^^^^^^^^^^^^^^^^^^ left-hand of expression not valid diff --git a/src/test/ui/error-codes/E0071.rs b/src/test/ui/error-codes/E0071.rs index d71dc7966fa..bd8469de75d 100644 --- a/src/test/ui/error-codes/E0071.rs +++ b/src/test/ui/error-codes/E0071.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo {} type FooAlias = Foo; diff --git a/src/test/ui/error-codes/E0071.stderr b/src/test/ui/error-codes/E0071.stderr index 637338672e0..ae312fc400a 100644 --- a/src/test/ui/error-codes/E0071.stderr +++ b/src/test/ui/error-codes/E0071.stderr @@ -1,5 +1,5 @@ error[E0071]: expected struct, variant or union type, found enum `Foo` - --> $DIR/E0071.rs:15:13 + --> $DIR/E0071.rs:5:13 | LL | let u = FooAlias { value: 0 }; | ^^^^^^^^ not a struct diff --git a/src/test/ui/error-codes/E0075.rs b/src/test/ui/error-codes/E0075.rs index d7783904e2e..7feab0a8bd7 100644 --- a/src/test/ui/error-codes/E0075.rs +++ b/src/test/ui/error-codes/E0075.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd)] #[repr(simd)] diff --git a/src/test/ui/error-codes/E0075.stderr b/src/test/ui/error-codes/E0075.stderr index d29d5d78803..abf68897096 100644 --- a/src/test/ui/error-codes/E0075.stderr +++ b/src/test/ui/error-codes/E0075.stderr @@ -1,5 +1,5 @@ error[E0075]: SIMD vector cannot be empty - --> $DIR/E0075.rs:14:1 + --> $DIR/E0075.rs:4:1 | LL | struct Bad; //~ ERROR E0075 | ^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0076.rs b/src/test/ui/error-codes/E0076.rs index b159cf107ce..a27072eb71e 100644 --- a/src/test/ui/error-codes/E0076.rs +++ b/src/test/ui/error-codes/E0076.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd)] #[repr(simd)] diff --git a/src/test/ui/error-codes/E0076.stderr b/src/test/ui/error-codes/E0076.stderr index ae349403810..2c2842d152b 100644 --- a/src/test/ui/error-codes/E0076.stderr +++ b/src/test/ui/error-codes/E0076.stderr @@ -1,5 +1,5 @@ error[E0076]: SIMD vector should be homogeneous - --> $DIR/E0076.rs:14:1 + --> $DIR/E0076.rs:4:1 | LL | struct Bad(u16, u32, u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ SIMD elements must have the same type diff --git a/src/test/ui/error-codes/E0077.rs b/src/test/ui/error-codes/E0077.rs index b074e90b2c0..fa2d5e24fa3 100644 --- a/src/test/ui/error-codes/E0077.rs +++ b/src/test/ui/error-codes/E0077.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd)] #[repr(simd)] diff --git a/src/test/ui/error-codes/E0077.stderr b/src/test/ui/error-codes/E0077.stderr index 42a169f5a20..9f3e1fa5c35 100644 --- a/src/test/ui/error-codes/E0077.stderr +++ b/src/test/ui/error-codes/E0077.stderr @@ -1,5 +1,5 @@ error[E0077]: SIMD vector element type should be machine type - --> $DIR/E0077.rs:14:1 + --> $DIR/E0077.rs:4:1 | LL | struct Bad(String); //~ ERROR E0077 | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0080.rs b/src/test/ui/error-codes/E0080.rs index 2ab15dfedca..ac0e7737f43 100644 --- a/src/test/ui/error-codes/E0080.rs +++ b/src/test/ui/error-codes/E0080.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Enum { X = (1 << 500), //~ ERROR E0080 //~| shift left with overflow diff --git a/src/test/ui/error-codes/E0080.stderr b/src/test/ui/error-codes/E0080.stderr index e60c905587d..4d37881c1e1 100644 --- a/src/test/ui/error-codes/E0080.stderr +++ b/src/test/ui/error-codes/E0080.stderr @@ -1,11 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $DIR/E0080.rs:12:9 + --> $DIR/E0080.rs:2:9 | LL | X = (1 << 500), //~ ERROR E0080 | ^^^^^^^^^^ attempt to shift left with overflow error[E0080]: evaluation of constant value failed - --> $DIR/E0080.rs:14:9 + --> $DIR/E0080.rs:4:9 | LL | Y = (1 / 0) //~ ERROR E0080 | ^^^^^^^ attempt to divide by zero diff --git a/src/test/ui/error-codes/E0081.rs b/src/test/ui/error-codes/E0081.rs index c0cdad25868..33c8c14306b 100644 --- a/src/test/ui/error-codes/E0081.rs +++ b/src/test/ui/error-codes/E0081.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Enum { P = 3, X = 3, diff --git a/src/test/ui/error-codes/E0081.stderr b/src/test/ui/error-codes/E0081.stderr index 36150d7c526..0b3d351e1ac 100644 --- a/src/test/ui/error-codes/E0081.stderr +++ b/src/test/ui/error-codes/E0081.stderr @@ -1,5 +1,5 @@ error[E0081]: discriminant value `3` already exists - --> $DIR/E0081.rs:13:9 + --> $DIR/E0081.rs:3:9 | LL | P = 3, | - first use of `3` diff --git a/src/test/ui/error-codes/E0084.rs b/src/test/ui/error-codes/E0084.rs index 2be206c9702..a550e04129a 100644 --- a/src/test/ui/error-codes/E0084.rs +++ b/src/test/ui/error-codes/E0084.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[repr(i32)] //~ ERROR: E0084 enum Foo {} diff --git a/src/test/ui/error-codes/E0084.stderr b/src/test/ui/error-codes/E0084.stderr index d0bc519c996..353c825f528 100644 --- a/src/test/ui/error-codes/E0084.stderr +++ b/src/test/ui/error-codes/E0084.stderr @@ -1,5 +1,5 @@ error[E0084]: unsupported representation for zero-variant enum - --> $DIR/E0084.rs:11:1 + --> $DIR/E0084.rs:1:1 | LL | #[repr(i32)] //~ ERROR: E0084 | ^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0091.rs b/src/test/ui/error-codes/E0091.rs index da988dbf819..2427f5cfe13 100644 --- a/src/test/ui/error-codes/E0091.rs +++ b/src/test/ui/error-codes/E0091.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type Foo = u32; //~ ERROR E0091 type Foo2 = Box; //~ ERROR E0091 diff --git a/src/test/ui/error-codes/E0091.stderr b/src/test/ui/error-codes/E0091.stderr index 2116f8f6476..d32960f82cb 100644 --- a/src/test/ui/error-codes/E0091.stderr +++ b/src/test/ui/error-codes/E0091.stderr @@ -1,11 +1,11 @@ error[E0091]: type parameter `T` is unused - --> $DIR/E0091.rs:11:10 + --> $DIR/E0091.rs:1:10 | LL | type Foo = u32; //~ ERROR E0091 | ^ unused type parameter error[E0091]: type parameter `B` is unused - --> $DIR/E0091.rs:12:14 + --> $DIR/E0091.rs:2:14 | LL | type Foo2 = Box; //~ ERROR E0091 | ^ unused type parameter diff --git a/src/test/ui/error-codes/E0092.rs b/src/test/ui/error-codes/E0092.rs index b08164ac06d..ddaace98bd4 100644 --- a/src/test/ui/error-codes/E0092.rs +++ b/src/test/ui/error-codes/E0092.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(intrinsics)] extern "rust-intrinsic" { fn atomic_foo(); //~ ERROR E0092 diff --git a/src/test/ui/error-codes/E0092.stderr b/src/test/ui/error-codes/E0092.stderr index 50d6d63b99c..a4535177526 100644 --- a/src/test/ui/error-codes/E0092.stderr +++ b/src/test/ui/error-codes/E0092.stderr @@ -1,5 +1,5 @@ error[E0092]: unrecognized atomic operation function: `foo` - --> $DIR/E0092.rs:13:5 + --> $DIR/E0092.rs:3:5 | LL | fn atomic_foo(); //~ ERROR E0092 | ^^^^^^^^^^^^^^^^ unrecognized atomic operation diff --git a/src/test/ui/error-codes/E0093.rs b/src/test/ui/error-codes/E0093.rs index d84f9f64911..a2f0b1ae443 100644 --- a/src/test/ui/error-codes/E0093.rs +++ b/src/test/ui/error-codes/E0093.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(intrinsics)] extern "rust-intrinsic" { fn foo(); diff --git a/src/test/ui/error-codes/E0093.stderr b/src/test/ui/error-codes/E0093.stderr index f261b83a0b8..cb0305593a7 100644 --- a/src/test/ui/error-codes/E0093.stderr +++ b/src/test/ui/error-codes/E0093.stderr @@ -1,5 +1,5 @@ error[E0093]: unrecognized intrinsic function: `foo` - --> $DIR/E0093.rs:13:5 + --> $DIR/E0093.rs:3:5 | LL | fn foo(); | ^^^^^^^^^ unrecognized intrinsic diff --git a/src/test/ui/error-codes/E0094.rs b/src/test/ui/error-codes/E0094.rs index 3a31874b244..0d58e5a2862 100644 --- a/src/test/ui/error-codes/E0094.rs +++ b/src/test/ui/error-codes/E0094.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(intrinsics)] extern "rust-intrinsic" { fn size_of() -> usize; //~ ERROR E0094 diff --git a/src/test/ui/error-codes/E0094.stderr b/src/test/ui/error-codes/E0094.stderr index 322802fc44f..97bdbfbe5ab 100644 --- a/src/test/ui/error-codes/E0094.stderr +++ b/src/test/ui/error-codes/E0094.stderr @@ -1,5 +1,5 @@ error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1 - --> $DIR/E0094.rs:13:15 + --> $DIR/E0094.rs:3:15 | LL | fn size_of() -> usize; //~ ERROR E0094 | ^^^^^^ expected 1 type parameter diff --git a/src/test/ui/error-codes/E0106.rs b/src/test/ui/error-codes/E0106.rs index 0674930a11c..d6537d12363 100644 --- a/src/test/ui/error-codes/E0106.rs +++ b/src/test/ui/error-codes/E0106.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: &bool, //~^ ERROR E0106 diff --git a/src/test/ui/error-codes/E0106.stderr b/src/test/ui/error-codes/E0106.stderr index 9862dca3fde..cea9581e701 100644 --- a/src/test/ui/error-codes/E0106.stderr +++ b/src/test/ui/error-codes/E0106.stderr @@ -1,29 +1,29 @@ error[E0106]: missing lifetime specifier - --> $DIR/E0106.rs:12:8 + --> $DIR/E0106.rs:2:8 | LL | x: &bool, | ^ expected lifetime parameter error[E0106]: missing lifetime specifier - --> $DIR/E0106.rs:17:7 + --> $DIR/E0106.rs:7:7 | LL | B(&bool), | ^ expected lifetime parameter error[E0106]: missing lifetime specifier - --> $DIR/E0106.rs:20:14 + --> $DIR/E0106.rs:10:14 | LL | type MyStr = &str; | ^ expected lifetime parameter error[E0106]: missing lifetime specifier - --> $DIR/E0106.rs:27:10 + --> $DIR/E0106.rs:17:10 | LL | baz: Baz, | ^^^ expected lifetime parameter error[E0106]: missing lifetime specifiers - --> $DIR/E0106.rs:30:11 + --> $DIR/E0106.rs:20:11 | LL | buzz: Buzz, | ^^^^ expected 2 lifetime parameters diff --git a/src/test/ui/error-codes/E0107.rs b/src/test/ui/error-codes/E0107.rs index 815c7fefd2a..35173dcce30 100644 --- a/src/test/ui/error-codes/E0107.rs +++ b/src/test/ui/error-codes/E0107.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'a>(&'a str); struct Buzz<'a, 'b>(&'a str, &'b str); @@ -26,7 +16,8 @@ struct Baz<'a, 'b, 'c> { //~| unexpected lifetime argument foo2: Foo<'a, 'b, 'c>, //~^ ERROR E0107 - //~| 2 unexpected lifetime arguments + //~| unexpected lifetime argument + //~| unexpected lifetime argument } fn main() {} diff --git a/src/test/ui/error-codes/E0107.stderr b/src/test/ui/error-codes/E0107.stderr index 497fa91bd4f..486810ab113 100644 --- a/src/test/ui/error-codes/E0107.stderr +++ b/src/test/ui/error-codes/E0107.stderr @@ -1,20 +1,22 @@ error[E0107]: wrong number of lifetime arguments: expected 2, found 1 - --> $DIR/E0107.rs:21:11 + --> $DIR/E0107.rs:11:11 | LL | buzz: Buzz<'a>, | ^^^^^^^^ expected 2 lifetime arguments error[E0107]: wrong number of lifetime arguments: expected 0, found 1 - --> $DIR/E0107.rs:24:14 + --> $DIR/E0107.rs:14:14 | LL | bar: Bar<'a>, | ^^ unexpected lifetime argument error[E0107]: wrong number of lifetime arguments: expected 1, found 3 - --> $DIR/E0107.rs:27:11 + --> $DIR/E0107.rs:17:19 | LL | foo2: Foo<'a, 'b, 'c>, - | ^^^^^^^^^^^^^^^ 2 unexpected lifetime arguments + | ^^ ^^ unexpected lifetime argument + | | + | unexpected lifetime argument error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0109.rs b/src/test/ui/error-codes/E0109.rs index 9fc47842250..2e382564962 100644 --- a/src/test/ui/error-codes/E0109.rs +++ b/src/test/ui/error-codes/E0109.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type X = u32; //~ ERROR E0109 fn main() { diff --git a/src/test/ui/error-codes/E0109.stderr b/src/test/ui/error-codes/E0109.stderr index 6473517bfad..a5508f98085 100644 --- a/src/test/ui/error-codes/E0109.stderr +++ b/src/test/ui/error-codes/E0109.stderr @@ -1,8 +1,8 @@ -error[E0109]: type parameters are not allowed on this type - --> $DIR/E0109.rs:11:14 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/E0109.rs:1:14 | LL | type X = u32; //~ ERROR E0109 - | ^^^ type parameter not allowed + | ^^^ type argument not allowed error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0110.rs b/src/test/ui/error-codes/E0110.rs index fd169f4acc5..764b62b8dfe 100644 --- a/src/test/ui/error-codes/E0110.rs +++ b/src/test/ui/error-codes/E0110.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type X = u32<'static>; //~ ERROR E0110 -fn main() { -} +fn main() {} diff --git a/src/test/ui/error-codes/E0110.stderr b/src/test/ui/error-codes/E0110.stderr index 7f5b78684fb..a644ac92cef 100644 --- a/src/test/ui/error-codes/E0110.stderr +++ b/src/test/ui/error-codes/E0110.stderr @@ -1,8 +1,8 @@ -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/E0110.rs:11:14 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/E0110.rs:1:14 | LL | type X = u32<'static>; //~ ERROR E0110 - | ^^^^^^^ lifetime parameter not allowed + | ^^^^^^^ lifetime argument not allowed error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0116.rs b/src/test/ui/error-codes/E0116.rs index cd7d8dc3efb..898beb10b6c 100644 --- a/src/test/ui/error-codes/E0116.rs +++ b/src/test/ui/error-codes/E0116.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - impl Vec {} //~^ ERROR E0116 diff --git a/src/test/ui/error-codes/E0116.stderr b/src/test/ui/error-codes/E0116.stderr index 7c2f35a3305..a5ceeb4a55d 100644 --- a/src/test/ui/error-codes/E0116.stderr +++ b/src/test/ui/error-codes/E0116.stderr @@ -1,5 +1,5 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined - --> $DIR/E0116.rs:11:1 + --> $DIR/E0116.rs:1:1 | LL | impl Vec {} | ^^^^^^^^^^^^^^^ impl for type defined outside of crate. diff --git a/src/test/ui/error-codes/E0117.rs b/src/test/ui/error-codes/E0117.rs index 982f875c7b0..18dd809f3ff 100644 --- a/src/test/ui/error-codes/E0117.rs +++ b/src/test/ui/error-codes/E0117.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - impl Drop for u32 {} //~ ERROR E0117 //~| ERROR the Drop trait may only be implemented on structures //~| implementing Drop requires a struct diff --git a/src/test/ui/error-codes/E0117.stderr b/src/test/ui/error-codes/E0117.stderr index 045ae700955..b007ca05ab2 100644 --- a/src/test/ui/error-codes/E0117.stderr +++ b/src/test/ui/error-codes/E0117.stderr @@ -1,16 +1,16 @@ error[E0120]: the Drop trait may only be implemented on structures - --> $DIR/E0117.rs:11:15 + --> $DIR/E0117.rs:1:15 | LL | impl Drop for u32 {} //~ ERROR E0117 | ^^^ implementing Drop requires a struct error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/E0117.rs:11:1 + --> $DIR/E0117.rs:1:1 | LL | impl Drop for u32 {} //~ ERROR E0117 | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | - = note: the impl does not reference any types defined in this crate + = note: the impl does not reference only types defined in this crate = note: define and implement a trait or new type instead error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0118.rs b/src/test/ui/error-codes/E0118.rs index d37ff34b861..7bf36210f3a 100644 --- a/src/test/ui/error-codes/E0118.rs +++ b/src/test/ui/error-codes/E0118.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - impl (u8, u8) { //~ ERROR E0118 fn get_state(&self) -> String { String::new() diff --git a/src/test/ui/error-codes/E0118.stderr b/src/test/ui/error-codes/E0118.stderr index 896213e3487..787f8caec7f 100644 --- a/src/test/ui/error-codes/E0118.stderr +++ b/src/test/ui/error-codes/E0118.stderr @@ -1,5 +1,5 @@ error[E0118]: no base type found for inherent implementation - --> $DIR/E0118.rs:11:6 + --> $DIR/E0118.rs:1:6 | LL | impl (u8, u8) { //~ ERROR E0118 | ^^^^^^^^ impl requires a base type diff --git a/src/test/ui/error-codes/E0119.rs b/src/test/ui/error-codes/E0119.rs index 9528631b304..7f89e5a1a52 100644 --- a/src/test/ui/error-codes/E0119.rs +++ b/src/test/ui/error-codes/E0119.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait MyTrait { fn get(&self) -> usize; } diff --git a/src/test/ui/error-codes/E0119.stderr b/src/test/ui/error-codes/E0119.stderr index f1e942d4cf5..af9acb294bc 100644 --- a/src/test/ui/error-codes/E0119.stderr +++ b/src/test/ui/error-codes/E0119.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `MyTrait` for type `Foo`: - --> $DIR/E0119.rs:23:1 + --> $DIR/E0119.rs:13:1 | LL | impl MyTrait for T { | --------------------- first implementation here diff --git a/src/test/ui/error-codes/E0120.rs b/src/test/ui/error-codes/E0120.rs index 8d09b877f00..049707415e5 100644 --- a/src/test/ui/error-codes/E0120.rs +++ b/src/test/ui/error-codes/E0120.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait MyTrait { fn foo() {} } impl Drop for MyTrait { diff --git a/src/test/ui/error-codes/E0120.stderr b/src/test/ui/error-codes/E0120.stderr index 6237500c7ae..9b6603dbaca 100644 --- a/src/test/ui/error-codes/E0120.stderr +++ b/src/test/ui/error-codes/E0120.stderr @@ -1,5 +1,5 @@ error[E0120]: the Drop trait may only be implemented on structures - --> $DIR/E0120.rs:13:15 + --> $DIR/E0120.rs:3:15 | LL | impl Drop for MyTrait { | ^^^^^^^ implementing Drop requires a struct diff --git a/src/test/ui/error-codes/E0121.rs b/src/test/ui/error-codes/E0121.rs index b26b5f41bfe..f8b4d61b323 100644 --- a/src/test/ui/error-codes/E0121.rs +++ b/src/test/ui/error-codes/E0121.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() -> _ { 5 } //~ ERROR E0121 static BAR: _ = "test"; //~ ERROR E0121 diff --git a/src/test/ui/error-codes/E0121.stderr b/src/test/ui/error-codes/E0121.stderr index 019e637aa8c..75e03c659b7 100644 --- a/src/test/ui/error-codes/E0121.stderr +++ b/src/test/ui/error-codes/E0121.stderr @@ -1,11 +1,11 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/E0121.rs:11:13 + --> $DIR/E0121.rs:1:13 | LL | fn foo() -> _ { 5 } //~ ERROR E0121 | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/E0121.rs:13:13 + --> $DIR/E0121.rs:3:13 | LL | static BAR: _ = "test"; //~ ERROR E0121 | ^ not allowed in type signatures diff --git a/src/test/ui/error-codes/E0124.rs b/src/test/ui/error-codes/E0124.rs index 3ef20c6dd40..9d6a716a6da 100644 --- a/src/test/ui/error-codes/E0124.rs +++ b/src/test/ui/error-codes/E0124.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { field1: i32, field1: i32, diff --git a/src/test/ui/error-codes/E0124.stderr b/src/test/ui/error-codes/E0124.stderr index c95162c9d21..73819a89d75 100644 --- a/src/test/ui/error-codes/E0124.stderr +++ b/src/test/ui/error-codes/E0124.stderr @@ -1,5 +1,5 @@ error[E0124]: field `field1` is already declared - --> $DIR/E0124.rs:13:5 + --> $DIR/E0124.rs:3:5 | LL | field1: i32, | ----------- `field1` first declared here diff --git a/src/test/ui/error-codes/E0128.rs b/src/test/ui/error-codes/E0128.rs index 37071012825..f42c32b91cc 100644 --- a/src/test/ui/error-codes/E0128.rs +++ b/src/test/ui/error-codes/E0128.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { //~ ERROR E0128 field1: T, field2: U, diff --git a/src/test/ui/error-codes/E0128.stderr b/src/test/ui/error-codes/E0128.stderr index 81da580f0d5..9ea3c09e63f 100644 --- a/src/test/ui/error-codes/E0128.stderr +++ b/src/test/ui/error-codes/E0128.stderr @@ -1,5 +1,5 @@ error[E0128]: type parameters with a default cannot use forward declared identifiers - --> $DIR/E0128.rs:11:14 + --> $DIR/E0128.rs:1:14 | LL | struct Foo { //~ ERROR E0128 | ^ defaulted type parameters cannot be forward declared diff --git a/src/test/ui/error-codes/E0130.rs b/src/test/ui/error-codes/E0130.rs index d11b59cdf33..1ac546b9dbe 100644 --- a/src/test/ui/error-codes/E0130.rs +++ b/src/test/ui/error-codes/E0130.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { fn foo((a, b): (u32, u32)); //~^ ERROR E0130 diff --git a/src/test/ui/error-codes/E0130.stderr b/src/test/ui/error-codes/E0130.stderr index 3b54b1b8669..a45571f40a1 100644 --- a/src/test/ui/error-codes/E0130.stderr +++ b/src/test/ui/error-codes/E0130.stderr @@ -1,5 +1,5 @@ error[E0130]: patterns aren't allowed in foreign function declarations - --> $DIR/E0130.rs:12:12 + --> $DIR/E0130.rs:2:12 | LL | fn foo((a, b): (u32, u32)); | ^^^^^^ pattern not allowed in foreign function diff --git a/src/test/ui/error-codes/E0131.rs b/src/test/ui/error-codes/E0131.rs index c7e31edd301..3ed739949a0 100644 --- a/src/test/ui/error-codes/E0131.rs +++ b/src/test/ui/error-codes/E0131.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { //~^ ERROR E0131 } diff --git a/src/test/ui/error-codes/E0131.stderr b/src/test/ui/error-codes/E0131.stderr index 46bc872746c..4467e19e95d 100644 --- a/src/test/ui/error-codes/E0131.stderr +++ b/src/test/ui/error-codes/E0131.stderr @@ -1,5 +1,5 @@ error[E0131]: `main` function is not allowed to have generic parameters - --> $DIR/E0131.rs:11:8 + --> $DIR/E0131.rs:1:8 | LL | fn main() { | ^^^ `main` cannot have generic parameters diff --git a/src/test/ui/error-codes/E0132.rs b/src/test/ui/error-codes/E0132.rs index 25ccb344aba..fb5e5d7b95a 100644 --- a/src/test/ui/error-codes/E0132.rs +++ b/src/test/ui/error-codes/E0132.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(start)] #[start] diff --git a/src/test/ui/error-codes/E0132.stderr b/src/test/ui/error-codes/E0132.stderr index 80d1c29d50f..e19b421bfdb 100644 --- a/src/test/ui/error-codes/E0132.stderr +++ b/src/test/ui/error-codes/E0132.stderr @@ -1,5 +1,5 @@ error[E0132]: start function is not allowed to have type parameters - --> $DIR/E0132.rs:14:5 + --> $DIR/E0132.rs:4:5 | LL | fn f< T >() {} //~ ERROR E0132 | ^^^^^ start function cannot have type parameters diff --git a/src/test/ui/error-codes/E0133.rs b/src/test/ui/error-codes/E0133.rs index 2e54f65e7bf..52494ce6078 100644 --- a/src/test/ui/error-codes/E0133.rs +++ b/src/test/ui/error-codes/E0133.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - unsafe fn f() { return; } fn main() { diff --git a/src/test/ui/error-codes/E0133.stderr b/src/test/ui/error-codes/E0133.stderr index 9be80f8f21b..1eb696506f3 100644 --- a/src/test/ui/error-codes/E0133.stderr +++ b/src/test/ui/error-codes/E0133.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/E0133.rs:14:5 + --> $DIR/E0133.rs:4:5 | LL | f(); | ^^^ call to unsafe function diff --git a/src/test/ui/error-codes/E0137.rs b/src/test/ui/error-codes/E0137.rs index 067ebcc727c..b8299c71bdf 100644 --- a/src/test/ui/error-codes/E0137.rs +++ b/src/test/ui/error-codes/E0137.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(main)] #[main] diff --git a/src/test/ui/error-codes/E0137.stderr b/src/test/ui/error-codes/E0137.stderr index ab2f9ba5bea..a5f05d33a08 100644 --- a/src/test/ui/error-codes/E0137.stderr +++ b/src/test/ui/error-codes/E0137.stderr @@ -1,5 +1,5 @@ error[E0137]: multiple functions with a #[main] attribute - --> $DIR/E0137.rs:17:1 + --> $DIR/E0137.rs:7:1 | LL | fn foo() {} | ----------- first #[main] function diff --git a/src/test/ui/error-codes/E0138.rs b/src/test/ui/error-codes/E0138.rs index 856616c8570..6f3c36282e8 100644 --- a/src/test/ui/error-codes/E0138.rs +++ b/src/test/ui/error-codes/E0138.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(start)] #[start] diff --git a/src/test/ui/error-codes/E0138.stderr b/src/test/ui/error-codes/E0138.stderr index e713b11b37f..745dccfb175 100644 --- a/src/test/ui/error-codes/E0138.stderr +++ b/src/test/ui/error-codes/E0138.stderr @@ -1,5 +1,5 @@ error[E0138]: multiple 'start' functions - --> $DIR/E0138.rs:17:1 + --> $DIR/E0138.rs:7:1 | LL | fn foo(argc: isize, argv: *const *const u8) -> isize { 0 } | ---------------------------------------------------------- previous `start` function here diff --git a/src/test/ui/error-codes/E0152.rs b/src/test/ui/error-codes/E0152.rs index 96a4d51bd24..dcaf9208835 100644 --- a/src/test/ui/error-codes/E0152.rs +++ b/src/test/ui/error-codes/E0152.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(lang_items)] #[lang = "arc"] diff --git a/src/test/ui/error-codes/E0152.stderr b/src/test/ui/error-codes/E0152.stderr index a0530f24de6..401c1755fa8 100644 --- a/src/test/ui/error-codes/E0152.stderr +++ b/src/test/ui/error-codes/E0152.stderr @@ -1,5 +1,5 @@ error[E0152]: duplicate lang item found: `arc`. - --> $DIR/E0152.rs:14:1 + --> $DIR/E0152.rs:4:1 | LL | struct Foo; //~ ERROR E0152 | ^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0161.ast.stderr b/src/test/ui/error-codes/E0161.ast.stderr index 62e8676e631..536a81a4bc6 100644 --- a/src/test/ui/error-codes/E0161.ast.stderr +++ b/src/test/ui/error-codes/E0161.ast.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:32:9 + --> $DIR/E0161.rs:22:9 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.astul.stderr b/src/test/ui/error-codes/E0161.astul.stderr index 79080fb4eae..2baba998f12 100644 --- a/src/test/ui/error-codes/E0161.astul.stderr +++ b/src/test/ui/error-codes/E0161.astul.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:32:5 + --> $DIR/E0161.rs:22:5 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.edition.stderr b/src/test/ui/error-codes/E0161.edition.stderr index 62e8676e631..536a81a4bc6 100644 --- a/src/test/ui/error-codes/E0161.edition.stderr +++ b/src/test/ui/error-codes/E0161.edition.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:32:9 + --> $DIR/E0161.rs:22:9 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.editionul.stderr b/src/test/ui/error-codes/E0161.editionul.stderr index 79080fb4eae..2baba998f12 100644 --- a/src/test/ui/error-codes/E0161.editionul.stderr +++ b/src/test/ui/error-codes/E0161.editionul.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:32:5 + --> $DIR/E0161.rs:22:5 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.nll.stderr b/src/test/ui/error-codes/E0161.nll.stderr index 62e8676e631..536a81a4bc6 100644 --- a/src/test/ui/error-codes/E0161.nll.stderr +++ b/src/test/ui/error-codes/E0161.nll.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:32:9 + --> $DIR/E0161.rs:22:9 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.nllul.stderr b/src/test/ui/error-codes/E0161.nllul.stderr index 79080fb4eae..2baba998f12 100644 --- a/src/test/ui/error-codes/E0161.nllul.stderr +++ b/src/test/ui/error-codes/E0161.nllul.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:32:5 + --> $DIR/E0161.rs:22:5 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.rs b/src/test/ui/error-codes/E0161.rs index edc5a84a843..a6d2b245eb1 100644 --- a/src/test/ui/error-codes/E0161.rs +++ b/src/test/ui/error-codes/E0161.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-compare-mode-nll // Check that E0161 is a hard error in all possible configurations that might @@ -29,7 +19,15 @@ #![feature(box_syntax)] fn foo(x: Box<[i32]>) { - box *x; //~ ERROR E0161 + box *x; + //[ast]~^ ERROR E0161 + //[nll]~^^ ERROR E0161 + //[zflags]~^^^ ERROR E0161 + //[edition]~^^^^ ERROR E0161 + //[astul]~^^^^^ ERROR E0161 + //[nllul]~^^^^^^ ERROR E0161 + //[zflagsul]~^^^^^^^ ERROR E0161 + //[editionul]~^^^^^^^^ ERROR E0161 } fn main() {} diff --git a/src/test/ui/error-codes/E0161.zflags.stderr b/src/test/ui/error-codes/E0161.zflags.stderr index 62e8676e631..536a81a4bc6 100644 --- a/src/test/ui/error-codes/E0161.zflags.stderr +++ b/src/test/ui/error-codes/E0161.zflags.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:32:9 + --> $DIR/E0161.rs:22:9 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0161.zflagsul.stderr b/src/test/ui/error-codes/E0161.zflagsul.stderr index 79080fb4eae..2baba998f12 100644 --- a/src/test/ui/error-codes/E0161.zflagsul.stderr +++ b/src/test/ui/error-codes/E0161.zflagsul.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type [i32]: the size of [i32] cannot be statically determined - --> $DIR/E0161.rs:32:5 + --> $DIR/E0161.rs:22:5 | -LL | box *x; //~ ERROR E0161 +LL | box *x; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0162.rs b/src/test/ui/error-codes/E0162.rs deleted file mode 100644 index e13b0af6f79..00000000000 --- a/src/test/ui/error-codes/E0162.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct Irrefutable(i32); - -fn main() { - let irr = Irrefutable(0); - if let Irrefutable(x) = irr { //~ ERROR E0162 - println!("{}", x); - } -} diff --git a/src/test/ui/error-codes/E0162.stderr b/src/test/ui/error-codes/E0162.stderr deleted file mode 100644 index 91f402dad59..00000000000 --- a/src/test/ui/error-codes/E0162.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0162]: irrefutable if-let pattern - --> $DIR/E0162.rs:15:12 - | -LL | if let Irrefutable(x) = irr { //~ ERROR E0162 - | ^^^^^^^^^^^^^^ irrefutable pattern - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0162`. diff --git a/src/test/ui/error-codes/E0164.rs b/src/test/ui/error-codes/E0164.rs index a7f10ddb5a7..2d412f754ed 100644 --- a/src/test/ui/error-codes/E0164.rs +++ b/src/test/ui/error-codes/E0164.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - enum Foo {} impl Foo { diff --git a/src/test/ui/error-codes/E0164.stderr b/src/test/ui/error-codes/E0164.stderr index 6eabace9b14..0debc8092e8 100644 --- a/src/test/ui/error-codes/E0164.stderr +++ b/src/test/ui/error-codes/E0164.stderr @@ -1,5 +1,5 @@ error[E0164]: expected tuple struct/variant, found associated constant `::B` - --> $DIR/E0164.rs:20:9 + --> $DIR/E0164.rs:9:9 | LL | Foo::B(i) => i, //~ ERROR E0164 | ^^^^^^^^^ not a tuple variant or struct diff --git a/src/test/ui/error-codes/E0165.rs b/src/test/ui/error-codes/E0165.rs deleted file mode 100644 index 142635fc6ee..00000000000 --- a/src/test/ui/error-codes/E0165.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct Irrefutable(i32); - -fn main() { - let irr = Irrefutable(0); - while let Irrefutable(x) = irr { //~ ERROR E0165 - //~| irrefutable pattern - // ... - } -} diff --git a/src/test/ui/error-codes/E0165.stderr b/src/test/ui/error-codes/E0165.stderr deleted file mode 100644 index 66be95e38d2..00000000000 --- a/src/test/ui/error-codes/E0165.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0165]: irrefutable while-let pattern - --> $DIR/E0165.rs:15:15 - | -LL | while let Irrefutable(x) = irr { //~ ERROR E0165 - | ^^^^^^^^^^^^^^ irrefutable pattern - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0165`. diff --git a/src/test/ui/error-codes/E0184.rs b/src/test/ui/error-codes/E0184.rs index 5d72d00ffe8..0c448e4ad8b 100644 --- a/src/test/ui/error-codes/E0184.rs +++ b/src/test/ui/error-codes/E0184.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Copy)] //~ ERROR E0184 struct Foo; diff --git a/src/test/ui/error-codes/E0184.stderr b/src/test/ui/error-codes/E0184.stderr index eb6160bc005..471ba3870e2 100644 --- a/src/test/ui/error-codes/E0184.stderr +++ b/src/test/ui/error-codes/E0184.stderr @@ -1,5 +1,5 @@ error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor - --> $DIR/E0184.rs:11:10 + --> $DIR/E0184.rs:1:10 | LL | #[derive(Copy)] //~ ERROR E0184 | ^^^^ Copy not allowed on types with destructors diff --git a/src/test/ui/error-codes/E0185.rs b/src/test/ui/error-codes/E0185.rs index 0cd3d00a735..45eb8b0f239 100644 --- a/src/test/ui/error-codes/E0185.rs +++ b/src/test/ui/error-codes/E0185.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(); //~^ NOTE trait method declared without `&self` diff --git a/src/test/ui/error-codes/E0185.stderr b/src/test/ui/error-codes/E0185.stderr index e5c92abc521..8a99c0688e3 100644 --- a/src/test/ui/error-codes/E0185.stderr +++ b/src/test/ui/error-codes/E0185.stderr @@ -1,5 +1,5 @@ error[E0185]: method `foo` has a `&self` declaration in the impl, but not in the trait - --> $DIR/E0185.rs:19:5 + --> $DIR/E0185.rs:9:5 | LL | fn foo(); | --------- trait method declared without `&self` diff --git a/src/test/ui/error-codes/E0186.rs b/src/test/ui/error-codes/E0186.rs index 55a3490cac4..83ef78ef2c0 100644 --- a/src/test/ui/error-codes/E0186.rs +++ b/src/test/ui/error-codes/E0186.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(&self); //~ `&self` used in trait } diff --git a/src/test/ui/error-codes/E0186.stderr b/src/test/ui/error-codes/E0186.stderr index 0556ef700ac..7fed0426ee8 100644 --- a/src/test/ui/error-codes/E0186.stderr +++ b/src/test/ui/error-codes/E0186.stderr @@ -1,5 +1,5 @@ error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl - --> $DIR/E0186.rs:18:5 + --> $DIR/E0186.rs:8:5 | LL | fn foo(&self); //~ `&self` used in trait | -------------- `&self` used in trait diff --git a/src/test/ui/error-codes/E0191.rs b/src/test/ui/error-codes/E0191.rs index c35c7e10f5a..356110671e7 100644 --- a/src/test/ui/error-codes/E0191.rs +++ b/src/test/ui/error-codes/E0191.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait { type Bar; } diff --git a/src/test/ui/error-codes/E0191.stderr b/src/test/ui/error-codes/E0191.stderr index 08b0a845814..570b0ddc313 100644 --- a/src/test/ui/error-codes/E0191.stderr +++ b/src/test/ui/error-codes/E0191.stderr @@ -1,8 +1,11 @@ error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) must be specified - --> $DIR/E0191.rs:15:12 + --> $DIR/E0191.rs:5:12 | +LL | type Bar; + | --------- `Bar` defined here +... LL | type Foo = Trait; //~ ERROR E0191 - | ^^^^^ missing associated type `Bar` value + | ^^^^^ associated type `Bar` must be specified error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0192.rs b/src/test/ui/error-codes/E0192.rs index 92f5876ee04..c52977e49b4 100644 --- a/src/test/ui/error-codes/E0192.rs +++ b/src/test/ui/error-codes/E0192.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] trait Trait { diff --git a/src/test/ui/error-codes/E0192.stderr b/src/test/ui/error-codes/E0192.stderr index fd8976271a5..bdfe717afe2 100644 --- a/src/test/ui/error-codes/E0192.stderr +++ b/src/test/ui/error-codes/E0192.stderr @@ -1,5 +1,5 @@ error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) - --> $DIR/E0192.rs:19:1 + --> $DIR/E0192.rs:9:1 | LL | impl !Trait for Foo { } //~ ERROR E0192 | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0194.rs b/src/test/ui/error-codes/E0194.rs index 17e0751859d..71eff0e7465 100644 --- a/src/test/ui/error-codes/E0194.rs +++ b/src/test/ui/error-codes/E0194.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn do_something(&self) -> T; fn do_something_else(&self, bar: T); diff --git a/src/test/ui/error-codes/E0194.stderr b/src/test/ui/error-codes/E0194.stderr index 6869f3c96f7..ab4918a4e27 100644 --- a/src/test/ui/error-codes/E0194.stderr +++ b/src/test/ui/error-codes/E0194.stderr @@ -1,5 +1,5 @@ error[E0194]: type parameter `T` shadows another type parameter of the same name - --> $DIR/E0194.rs:13:26 + --> $DIR/E0194.rs:3:26 | LL | trait Foo { | - first `T` declared here diff --git a/src/test/ui/error-codes/E0195.rs b/src/test/ui/error-codes/E0195.rs index 4f4d7ce0dba..f712ee42b8c 100644 --- a/src/test/ui/error-codes/E0195.rs +++ b/src/test/ui/error-codes/E0195.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait { fn bar<'a,'b:'a>(x: &'a str, y: &'b str); //~^ NOTE lifetimes in impl do not match this method in trait diff --git a/src/test/ui/error-codes/E0195.stderr b/src/test/ui/error-codes/E0195.stderr index 3860c93a45f..57032c6b0c8 100644 --- a/src/test/ui/error-codes/E0195.stderr +++ b/src/test/ui/error-codes/E0195.stderr @@ -1,5 +1,5 @@ error[E0195]: lifetime parameters or bounds on method `bar` do not match the trait declaration - --> $DIR/E0195.rs:19:11 + --> $DIR/E0195.rs:9:11 | LL | fn bar<'a,'b:'a>(x: &'a str, y: &'b str); | ---------- lifetimes in impl do not match this method in trait diff --git a/src/test/ui/error-codes/E0197.rs b/src/test/ui/error-codes/E0197.rs index f25fa9b92b9..4025a1f6c33 100644 --- a/src/test/ui/error-codes/E0197.rs +++ b/src/test/ui/error-codes/E0197.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; unsafe impl Foo { } //~ ERROR E0197 diff --git a/src/test/ui/error-codes/E0197.stderr b/src/test/ui/error-codes/E0197.stderr index a18599e4f47..f58dcd791da 100644 --- a/src/test/ui/error-codes/E0197.stderr +++ b/src/test/ui/error-codes/E0197.stderr @@ -1,5 +1,5 @@ error[E0197]: inherent impls cannot be unsafe - --> $DIR/E0197.rs:13:1 + --> $DIR/E0197.rs:3:1 | LL | unsafe impl Foo { } //~ ERROR E0197 | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0198.rs b/src/test/ui/error-codes/E0198.rs index 1a779a41e66..00ab0c35623 100644 --- a/src/test/ui/error-codes/E0198.rs +++ b/src/test/ui/error-codes/E0198.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] struct Foo; diff --git a/src/test/ui/error-codes/E0198.stderr b/src/test/ui/error-codes/E0198.stderr index 41ea0565ccc..e182cbd2ec1 100644 --- a/src/test/ui/error-codes/E0198.stderr +++ b/src/test/ui/error-codes/E0198.stderr @@ -1,5 +1,5 @@ error[E0198]: negative impls cannot be unsafe - --> $DIR/E0198.rs:15:1 + --> $DIR/E0198.rs:5:1 | LL | unsafe impl !Send for Foo { } //~ ERROR E0198 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0199.rs b/src/test/ui/error-codes/E0199.rs index 1a5cd1941a9..c95afa3f97d 100644 --- a/src/test/ui/error-codes/E0199.rs +++ b/src/test/ui/error-codes/E0199.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] struct Foo; diff --git a/src/test/ui/error-codes/E0199.stderr b/src/test/ui/error-codes/E0199.stderr index b3cfd0d21dd..ba55c4a58e4 100644 --- a/src/test/ui/error-codes/E0199.stderr +++ b/src/test/ui/error-codes/E0199.stderr @@ -1,5 +1,5 @@ error[E0199]: implementing the trait `Bar` is not unsafe - --> $DIR/E0199.rs:16:1 + --> $DIR/E0199.rs:6:1 | LL | unsafe impl Bar for Foo { } //~ ERROR implementing the trait `Bar` is not unsafe [E0199] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0200.rs b/src/test/ui/error-codes/E0200.rs index 6bfea0e59d7..24806a6cbb0 100644 --- a/src/test/ui/error-codes/E0200.rs +++ b/src/test/ui/error-codes/E0200.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; unsafe trait Bar { } diff --git a/src/test/ui/error-codes/E0200.stderr b/src/test/ui/error-codes/E0200.stderr index 07f848b501e..f6a8f32d238 100644 --- a/src/test/ui/error-codes/E0200.stderr +++ b/src/test/ui/error-codes/E0200.stderr @@ -1,5 +1,5 @@ error[E0200]: the trait `Bar` requires an `unsafe impl` declaration - --> $DIR/E0200.rs:15:1 + --> $DIR/E0200.rs:5:1 | LL | impl Bar for Foo { } //~ ERROR E0200 | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0201.rs b/src/test/ui/error-codes/E0201.rs index ff6cb55f388..adefd4bcd46 100644 --- a/src/test/ui/error-codes/E0201.rs +++ b/src/test/ui/error-codes/E0201.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo(u8); impl Foo { diff --git a/src/test/ui/error-codes/E0201.stderr b/src/test/ui/error-codes/E0201.stderr index 2b9e51f76fd..5d2f9f3e362 100644 --- a/src/test/ui/error-codes/E0201.stderr +++ b/src/test/ui/error-codes/E0201.stderr @@ -1,5 +1,5 @@ error[E0201]: duplicate definitions with name `bar`: - --> $DIR/E0201.rs:15:5 + --> $DIR/E0201.rs:5:5 | LL | fn bar(&self) -> bool { self.0 > 5 } | ------------------------------------ previous definition of `bar` here @@ -7,7 +7,7 @@ LL | fn bar() {} //~ ERROR E0201 | ^^^^^^^^^^^ duplicate definition error[E0201]: duplicate definitions with name `baz`: - --> $DIR/E0201.rs:27:5 + --> $DIR/E0201.rs:17:5 | LL | fn baz(&self) -> bool { true } | ------------------------------ previous definition of `baz` here @@ -15,7 +15,7 @@ LL | fn baz(&self) -> bool { self.0 > 5 } //~ ERROR E0201 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definition error[E0201]: duplicate definitions with name `Quux`: - --> $DIR/E0201.rs:28:5 + --> $DIR/E0201.rs:18:5 | LL | type Quux = u32; | ---------------- previous definition of `Quux` here diff --git a/src/test/ui/error-codes/E0206.rs b/src/test/ui/error-codes/E0206.rs index 9b3d1b351dd..bace0467581 100644 --- a/src/test/ui/error-codes/E0206.rs +++ b/src/test/ui/error-codes/E0206.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type Foo = [u8; 256]; impl Copy for Foo { } diff --git a/src/test/ui/error-codes/E0206.stderr b/src/test/ui/error-codes/E0206.stderr index f2c23b0767a..a0c4b0149a0 100644 --- a/src/test/ui/error-codes/E0206.stderr +++ b/src/test/ui/error-codes/E0206.stderr @@ -1,22 +1,22 @@ error[E0206]: the trait `Copy` may not be implemented for this type - --> $DIR/E0206.rs:13:15 + --> $DIR/E0206.rs:3:15 | LL | impl Copy for Foo { } | ^^^ type is not a structure or enumeration error[E0206]: the trait `Copy` may not be implemented for this type - --> $DIR/E0206.rs:20:15 + --> $DIR/E0206.rs:10:15 | LL | impl Copy for &'static mut Bar { } | ^^^^^^^^^^^^^^^^ type is not a structure or enumeration error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/E0206.rs:13:1 + --> $DIR/E0206.rs:3:1 | LL | impl Copy for Foo { } | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | - = note: the impl does not reference any types defined in this crate + = note: the impl does not reference only types defined in this crate = note: define and implement a trait or new type instead error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0207.rs b/src/test/ui/error-codes/E0207.rs index bd87dbaf786..7f5d4ab5133 100644 --- a/src/test/ui/error-codes/E0207.rs +++ b/src/test/ui/error-codes/E0207.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; impl Foo { //~ ERROR E0207 diff --git a/src/test/ui/error-codes/E0207.stderr b/src/test/ui/error-codes/E0207.stderr index 6ecab44878d..c82859a9867 100644 --- a/src/test/ui/error-codes/E0207.stderr +++ b/src/test/ui/error-codes/E0207.stderr @@ -1,5 +1,5 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates - --> $DIR/E0207.rs:13:6 + --> $DIR/E0207.rs:3:6 | LL | impl Foo { //~ ERROR E0207 | ^ unconstrained type parameter diff --git a/src/test/ui/error-codes/E0214.rs b/src/test/ui/error-codes/E0214.rs index 2b090391c74..fd73189f970 100644 --- a/src/test/ui/error-codes/E0214.rs +++ b/src/test/ui/error-codes/E0214.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let v: Vec(&str) = vec!["foo"]; //~^ ERROR E0214 diff --git a/src/test/ui/error-codes/E0214.stderr b/src/test/ui/error-codes/E0214.stderr index c88e2d2077a..a10f2c00578 100644 --- a/src/test/ui/error-codes/E0214.stderr +++ b/src/test/ui/error-codes/E0214.stderr @@ -1,8 +1,11 @@ -error[E0214]: parenthesized parameters may only be used with a trait - --> $DIR/E0214.rs:12:15 +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/E0214.rs:2:15 | LL | let v: Vec(&str) = vec!["foo"]; - | ^^^^^^ only traits may use parentheses + | ^^^^^^ + | | + | only `Fn` traits may use parentheses + | help: use angle brackets instead: `<&str>` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0220.rs b/src/test/ui/error-codes/E0220.rs index 2866ffcd637..f4798042538 100644 --- a/src/test/ui/error-codes/E0220.rs +++ b/src/test/ui/error-codes/E0220.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait { type Bar; } diff --git a/src/test/ui/error-codes/E0220.stderr b/src/test/ui/error-codes/E0220.stderr index c8a587f2b53..0eb812a5ef0 100644 --- a/src/test/ui/error-codes/E0220.stderr +++ b/src/test/ui/error-codes/E0220.stderr @@ -1,14 +1,17 @@ error[E0220]: associated type `F` not found for `Trait` - --> $DIR/E0220.rs:15:18 + --> $DIR/E0220.rs:5:18 | LL | type Foo = Trait; //~ ERROR E0220 | ^^^^^ associated type `F` not found error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) must be specified - --> $DIR/E0220.rs:15:12 + --> $DIR/E0220.rs:5:12 | +LL | type Bar; + | --------- `Bar` defined here +... LL | type Foo = Trait; //~ ERROR E0220 - | ^^^^^^^^^^^^ missing associated type `Bar` value + | ^^^^^^^^^^^^ associated type `Bar` must be specified error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0221.rs b/src/test/ui/error-codes/E0221.rs index 99092465b0a..7c7e139a098 100644 --- a/src/test/ui/error-codes/E0221.rs +++ b/src/test/ui/error-codes/E0221.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait T1 {} trait T2 {} diff --git a/src/test/ui/error-codes/E0221.stderr b/src/test/ui/error-codes/E0221.stderr index fc9232e85ab..043f0c68bbc 100644 --- a/src/test/ui/error-codes/E0221.stderr +++ b/src/test/ui/error-codes/E0221.stderr @@ -1,5 +1,5 @@ error[E0221]: ambiguous associated type `A` in bounds of `Self` - --> $DIR/E0221.rs:21:16 + --> $DIR/E0221.rs:11:16 | LL | type A: T1; | ----------- ambiguous `A` from `Foo` @@ -11,7 +11,7 @@ LL | let _: Self::A; | ^^^^^^^ ambiguous associated type `A` error[E0221]: ambiguous associated type `Err` in bounds of `Self` - --> $DIR/E0221.rs:31:16 + --> $DIR/E0221.rs:21:16 | LL | type Err: T3; | ------------- ambiguous `Err` from `My` @@ -20,7 +20,7 @@ LL | let _: Self::Err; | ^^^^^^^^^ ambiguous associated type `Err` | note: associated type `Self` could derive from `std::str::FromStr` - --> $DIR/E0221.rs:31:16 + --> $DIR/E0221.rs:21:16 | LL | let _: Self::Err; | ^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0223.rs b/src/test/ui/error-codes/E0223.rs index 0683197b2b6..6031b682d72 100644 --- a/src/test/ui/error-codes/E0223.rs +++ b/src/test/ui/error-codes/E0223.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait MyTrait { type X; } fn main() { diff --git a/src/test/ui/error-codes/E0223.stderr b/src/test/ui/error-codes/E0223.stderr index 87736c10774..726f39e11f1 100644 --- a/src/test/ui/error-codes/E0223.stderr +++ b/src/test/ui/error-codes/E0223.stderr @@ -1,5 +1,5 @@ error[E0223]: ambiguous associated type - --> $DIR/E0223.rs:14:14 + --> $DIR/E0223.rs:4:14 | LL | let foo: MyTrait::X; | ^^^^^^^^^^ help: use fully-qualified syntax: `::X` diff --git a/src/test/ui/error-codes/E0225.rs b/src/test/ui/error-codes/E0225.rs index 6c77443c5ed..1789be1559d 100644 --- a/src/test/ui/error-codes/E0225.rs +++ b/src/test/ui/error-codes/E0225.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let _: Box; //~^ ERROR only auto traits can be used as additional traits in a trait object [E0225] diff --git a/src/test/ui/error-codes/E0225.stderr b/src/test/ui/error-codes/E0225.stderr index 6b9489c74c8..85a04708cb2 100644 --- a/src/test/ui/error-codes/E0225.stderr +++ b/src/test/ui/error-codes/E0225.stderr @@ -1,5 +1,5 @@ error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/E0225.rs:12:32 + --> $DIR/E0225.rs:2:32 | LL | let _: Box; | ^^^^^^^^^^^^^^ non-auto additional trait diff --git a/src/test/ui/error-codes/E0229.rs b/src/test/ui/error-codes/E0229.rs index b70fb092a54..4c1934107a6 100644 --- a/src/test/ui/error-codes/E0229.rs +++ b/src/test/ui/error-codes/E0229.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo { type A; fn boo(&self) -> ::A; diff --git a/src/test/ui/error-codes/E0229.stderr b/src/test/ui/error-codes/E0229.stderr index 218faf2dfdd..46793314bf9 100644 --- a/src/test/ui/error-codes/E0229.stderr +++ b/src/test/ui/error-codes/E0229.stderr @@ -1,5 +1,5 @@ error[E0229]: associated type bindings are not allowed here - --> $DIR/E0229.rs:23:25 + --> $DIR/E0229.rs:13:25 | LL | fn baz(x: &>::A) {} | ^^^^^ associated type not allowed here diff --git a/src/test/ui/error-codes/E0232.rs b/src/test/ui/error-codes/E0232.rs deleted file mode 100644 index 04657c65c8e..00000000000 --- a/src/test/ui/error-codes/E0232.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(on_unimplemented)] - -#[rustc_on_unimplemented] -//~^ ERROR E0232 -trait Bar {} - -fn main() { -} diff --git a/src/test/ui/error-codes/E0232.stderr b/src/test/ui/error-codes/E0232.stderr deleted file mode 100644 index 613b359c299..00000000000 --- a/src/test/ui/error-codes/E0232.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0232]: `#[rustc_on_unimplemented]` requires a value - --> $DIR/E0232.rs:13:1 - | -LL | #[rustc_on_unimplemented] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ value required here - | - = note: eg `#[rustc_on_unimplemented(message="foo")]` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0232`. diff --git a/src/test/ui/error-codes/E0252.rs b/src/test/ui/error-codes/E0252.rs index 6b353c8cd1a..6b5163417bf 100644 --- a/src/test/ui/error-codes/E0252.rs +++ b/src/test/ui/error-codes/E0252.rs @@ -1,12 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#![allow(non_camel_case_types)] use foo::baz; use bar::baz; //~ ERROR E0252 diff --git a/src/test/ui/error-codes/E0252.stderr b/src/test/ui/error-codes/E0252.stderr index 0d112a4f02e..bd06241fc76 100644 --- a/src/test/ui/error-codes/E0252.stderr +++ b/src/test/ui/error-codes/E0252.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `baz` is defined multiple times - --> $DIR/E0252.rs:12:5 + --> $DIR/E0252.rs:4:5 | LL | use foo::baz; | -------- previous import of the type `baz` here diff --git a/src/test/ui/error-codes/E0253.rs b/src/test/ui/error-codes/E0253.rs index 186d9019aae..284b16da8f2 100644 --- a/src/test/ui/error-codes/E0253.rs +++ b/src/test/ui/error-codes/E0253.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub trait MyTrait { fn do_something(); diff --git a/src/test/ui/error-codes/E0253.stderr b/src/test/ui/error-codes/E0253.stderr index 9ab6c30eaa0..8f21a0aaba5 100644 --- a/src/test/ui/error-codes/E0253.stderr +++ b/src/test/ui/error-codes/E0253.stderr @@ -1,5 +1,5 @@ error[E0253]: `do_something` is not directly importable - --> $DIR/E0253.rs:17:5 + --> $DIR/E0253.rs:7:5 | LL | use foo::MyTrait::do_something; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be imported directly diff --git a/src/test/ui/error-codes/E0254.rs b/src/test/ui/error-codes/E0254.rs index 46c74fe3735..706cd347e13 100644 --- a/src/test/ui/error-codes/E0254.rs +++ b/src/test/ui/error-codes/E0254.rs @@ -1,15 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(alloc)] -#![allow(unused_extern_crates)] +#![allow(unused_extern_crates, non_camel_case_types)] extern crate alloc; diff --git a/src/test/ui/error-codes/E0254.stderr b/src/test/ui/error-codes/E0254.stderr index 5e833f1ee39..c2d013da417 100644 --- a/src/test/ui/error-codes/E0254.stderr +++ b/src/test/ui/error-codes/E0254.stderr @@ -1,5 +1,5 @@ error[E0254]: the name `alloc` is defined multiple times - --> $DIR/E0254.rs:22:5 + --> $DIR/E0254.rs:12:5 | LL | extern crate alloc; | ------------------- previous import of the extern crate `alloc` here diff --git a/src/test/ui/error-codes/E0255.rs b/src/test/ui/error-codes/E0255.rs index e05c6bede7e..d1c21eb79de 100644 --- a/src/test/ui/error-codes/E0255.rs +++ b/src/test/ui/error-codes/E0255.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use bar::foo; fn foo() {} //~ ERROR E0255 diff --git a/src/test/ui/error-codes/E0255.stderr b/src/test/ui/error-codes/E0255.stderr index d01a4c002e7..a47aa7c6592 100644 --- a/src/test/ui/error-codes/E0255.stderr +++ b/src/test/ui/error-codes/E0255.stderr @@ -1,5 +1,5 @@ error[E0255]: the name `foo` is defined multiple times - --> $DIR/E0255.rs:13:1 + --> $DIR/E0255.rs:3:1 | LL | use bar::foo; | -------- previous import of the value `foo` here diff --git a/src/test/ui/error-codes/E0259.rs b/src/test/ui/error-codes/E0259.rs index 5a47541c708..cda3db34dfc 100644 --- a/src/test/ui/error-codes/E0259.rs +++ b/src/test/ui/error-codes/E0259.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(alloc, libc)] +#![feature(alloc, rustc_private)] #![allow(unused_extern_crates)] extern crate alloc; diff --git a/src/test/ui/error-codes/E0259.stderr b/src/test/ui/error-codes/E0259.stderr index 8c3e3f851ae..fd6a4087aec 100644 --- a/src/test/ui/error-codes/E0259.stderr +++ b/src/test/ui/error-codes/E0259.stderr @@ -1,5 +1,5 @@ error[E0259]: the name `alloc` is defined multiple times - --> $DIR/E0259.rs:16:1 + --> $DIR/E0259.rs:6:1 | LL | extern crate alloc; | ------------------- previous import of the extern crate `alloc` here diff --git a/src/test/ui/error-codes/E0260.rs b/src/test/ui/error-codes/E0260.rs index 1b01bb12203..80382c0d2fc 100644 --- a/src/test/ui/error-codes/E0260.rs +++ b/src/test/ui/error-codes/E0260.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(alloc)] #![allow(unused_extern_crates)] diff --git a/src/test/ui/error-codes/E0260.stderr b/src/test/ui/error-codes/E0260.stderr index 08792a33921..bfe2ed0cfc7 100644 --- a/src/test/ui/error-codes/E0260.stderr +++ b/src/test/ui/error-codes/E0260.stderr @@ -1,5 +1,5 @@ error[E0260]: the name `alloc` is defined multiple times - --> $DIR/E0260.rs:16:1 + --> $DIR/E0260.rs:6:1 | LL | extern crate alloc; | ------------------- previous import of the extern crate `alloc` here diff --git a/src/test/ui/error-codes/E0261.rs b/src/test/ui/error-codes/E0261.rs index 558c1c38144..f05e09aa0da 100644 --- a/src/test/ui/error-codes/E0261.rs +++ b/src/test/ui/error-codes/E0261.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(x: &'a str) { } //~ ERROR E0261 //~| undeclared lifetime diff --git a/src/test/ui/error-codes/E0261.stderr b/src/test/ui/error-codes/E0261.stderr index e9140ec2c74..9e64f6c3f14 100644 --- a/src/test/ui/error-codes/E0261.stderr +++ b/src/test/ui/error-codes/E0261.stderr @@ -1,11 +1,11 @@ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/E0261.rs:11:12 + --> $DIR/E0261.rs:1:12 | LL | fn foo(x: &'a str) { } //~ ERROR E0261 | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/E0261.rs:15:9 + --> $DIR/E0261.rs:5:9 | LL | x: &'a str, //~ ERROR E0261 | ^^ undeclared lifetime diff --git a/src/test/ui/error-codes/E0262.rs b/src/test/ui/error-codes/E0262.rs index 41b6acaee4a..55264f1387f 100644 --- a/src/test/ui/error-codes/E0262.rs +++ b/src/test/ui/error-codes/E0262.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo<'static>(x: &'static str) { } //~ ERROR E0262 //~| 'static is a reserved lifetime name diff --git a/src/test/ui/error-codes/E0262.stderr b/src/test/ui/error-codes/E0262.stderr index 1e5b5db692d..8f01889a470 100644 --- a/src/test/ui/error-codes/E0262.stderr +++ b/src/test/ui/error-codes/E0262.stderr @@ -1,5 +1,5 @@ error[E0262]: invalid lifetime parameter name: `'static` - --> $DIR/E0262.rs:11:8 + --> $DIR/E0262.rs:1:8 | LL | fn foo<'static>(x: &'static str) { } //~ ERROR E0262 | ^^^^^^^ 'static is a reserved lifetime name diff --git a/src/test/ui/error-codes/E0263.rs b/src/test/ui/error-codes/E0263.rs index 722f1c25e07..4376437823c 100644 --- a/src/test/ui/error-codes/E0263.rs +++ b/src/test/ui/error-codes/E0263.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { //~^ ERROR E0263 } diff --git a/src/test/ui/error-codes/E0263.stderr b/src/test/ui/error-codes/E0263.stderr index 1b52deea88d..4dae02b85c3 100644 --- a/src/test/ui/error-codes/E0263.stderr +++ b/src/test/ui/error-codes/E0263.stderr @@ -1,5 +1,5 @@ error[E0263]: lifetime name `'a` declared twice in the same scope - --> $DIR/E0263.rs:11:16 + --> $DIR/E0263.rs:1:16 | LL | fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { | -- ^^ declared twice diff --git a/src/test/ui/error-codes/E0264.rs b/src/test/ui/error-codes/E0264.rs index 92332977e76..6adaf01fb52 100644 --- a/src/test/ui/error-codes/E0264.rs +++ b/src/test/ui/error-codes/E0264.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(lang_items)] extern "C" { diff --git a/src/test/ui/error-codes/E0264.stderr b/src/test/ui/error-codes/E0264.stderr index 69863d7bb83..bc6a0d9f96c 100644 --- a/src/test/ui/error-codes/E0264.stderr +++ b/src/test/ui/error-codes/E0264.stderr @@ -1,5 +1,5 @@ error[E0264]: unknown external lang item: `cake` - --> $DIR/E0264.rs:15:5 + --> $DIR/E0264.rs:5:5 | LL | fn cake(); //~ ERROR E0264 | ^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0267.rs b/src/test/ui/error-codes/E0267.rs index 6287256e866..45e875a0a3c 100644 --- a/src/test/ui/error-codes/E0267.rs +++ b/src/test/ui/error-codes/E0267.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let w = || { break; }; //~ ERROR E0267 } diff --git a/src/test/ui/error-codes/E0267.stderr b/src/test/ui/error-codes/E0267.stderr index b72109f0644..3506c1c0f16 100644 --- a/src/test/ui/error-codes/E0267.stderr +++ b/src/test/ui/error-codes/E0267.stderr @@ -1,5 +1,5 @@ error[E0267]: `break` inside of a closure - --> $DIR/E0267.rs:12:18 + --> $DIR/E0267.rs:2:18 | LL | let w = || { break; }; //~ ERROR E0267 | ^^^^^ cannot break inside of a closure diff --git a/src/test/ui/error-codes/E0268.rs b/src/test/ui/error-codes/E0268.rs index 41e88e2f492..742ba5441d6 100644 --- a/src/test/ui/error-codes/E0268.rs +++ b/src/test/ui/error-codes/E0268.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { break; //~ ERROR E0268 } diff --git a/src/test/ui/error-codes/E0268.stderr b/src/test/ui/error-codes/E0268.stderr index e1b5b52085b..3e276bd1acb 100644 --- a/src/test/ui/error-codes/E0268.stderr +++ b/src/test/ui/error-codes/E0268.stderr @@ -1,5 +1,5 @@ error[E0268]: `break` outside of loop - --> $DIR/E0268.rs:12:5 + --> $DIR/E0268.rs:2:5 | LL | break; //~ ERROR E0268 | ^^^^^ cannot break outside of a loop diff --git a/src/test/ui/error-codes/E0271.rs b/src/test/ui/error-codes/E0271.rs index d322c8b1caf..f2719075434 100644 --- a/src/test/ui/error-codes/E0271.rs +++ b/src/test/ui/error-codes/E0271.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait { type AssociatedType; } fn foo(t: T) where T: Trait { diff --git a/src/test/ui/error-codes/E0271.stderr b/src/test/ui/error-codes/E0271.stderr index 04c7d244376..8fcb68e434f 100644 --- a/src/test/ui/error-codes/E0271.stderr +++ b/src/test/ui/error-codes/E0271.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving `::AssociatedType == u32` - --> $DIR/E0271.rs:20:5 + --> $DIR/E0271.rs:10:5 | LL | foo(3_i8); //~ ERROR E0271 | ^^^ expected reference, found u32 @@ -7,7 +7,7 @@ LL | foo(3_i8); //~ ERROR E0271 = note: expected type `&'static str` found type `u32` note: required by `foo` - --> $DIR/E0271.rs:13:1 + --> $DIR/E0271.rs:3:1 | LL | fn foo(t: T) where T: Trait { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0275.rs b/src/test/ui/error-codes/E0275.rs index 8dfd1d9b4af..28a9676f03e 100644 --- a/src/test/ui/error-codes/E0275.rs +++ b/src/test/ui/error-codes/E0275.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo {} struct Bar(T); diff --git a/src/test/ui/error-codes/E0275.stderr b/src/test/ui/error-codes/E0275.stderr index d5bcc94fb65..f2b0f392bc8 100644 --- a/src/test/ui/error-codes/E0275.stderr +++ b/src/test/ui/error-codes/E0275.stderr @@ -1,11 +1,10 @@ -error[E0275]: overflow evaluating the requirement `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: std::marker::Sized` - --> $DIR/E0275.rs:15:1 +error[E0275]: overflow evaluating the requirement `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` + --> $DIR/E0275.rs:5:1 | LL | impl Foo for T where Bar: Foo {} //~ ERROR E0275 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding a `#![recursion_limit="128"]` attribute to your crate - = note: required because of the requirements on the impl of `Foo` for `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` = note: required because of the requirements on the impl of `Foo` for `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` = note: required because of the requirements on the impl of `Foo` for `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` = note: required because of the requirements on the impl of `Foo` for `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` @@ -70,7 +69,7 @@ LL | impl Foo for T where Bar: Foo {} //~ ERROR E0275 = note: required because of the requirements on the impl of `Foo` for `Bar>` = note: required because of the requirements on the impl of `Foo` for `Bar` note: required by `Foo` - --> $DIR/E0275.rs:11:1 + --> $DIR/E0275.rs:1:1 | LL | trait Foo {} | ^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0276.rs b/src/test/ui/error-codes/E0276.rs index 62e43b02ca8..5e3d9f602ad 100644 --- a/src/test/ui/error-codes/E0276.rs +++ b/src/test/ui/error-codes/E0276.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(x: T); } diff --git a/src/test/ui/error-codes/E0276.stderr b/src/test/ui/error-codes/E0276.stderr index 4823adc250a..393ad8c81a0 100644 --- a/src/test/ui/error-codes/E0276.stderr +++ b/src/test/ui/error-codes/E0276.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/E0276.rs:16:5 + --> $DIR/E0276.rs:6:5 | LL | fn foo(x: T); | ---------------- definition of `foo` from trait diff --git a/src/test/ui/error-codes/E0277-2.rs b/src/test/ui/error-codes/E0277-2.rs index 313aa1f706e..428518705b8 100644 --- a/src/test/ui/error-codes/E0277-2.rs +++ b/src/test/ui/error-codes/E0277-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { bar: Bar } diff --git a/src/test/ui/error-codes/E0277-2.stderr b/src/test/ui/error-codes/E0277-2.stderr index 32776f028b4..a4db1c8b095 100644 --- a/src/test/ui/error-codes/E0277-2.stderr +++ b/src/test/ui/error-codes/E0277-2.stderr @@ -1,5 +1,5 @@ error[E0277]: `*const u8` cannot be sent between threads safely - --> $DIR/E0277-2.rs:26:5 + --> $DIR/E0277-2.rs:16:5 | LL | is_send::(); | ^^^^^^^^^^^^^^ `*const u8` cannot be sent between threads safely @@ -9,7 +9,7 @@ LL | is_send::(); = note: required because it appears within the type `Bar` = note: required because it appears within the type `Foo` note: required by `is_send` - --> $DIR/E0277-2.rs:23:1 + --> $DIR/E0277-2.rs:13:1 | LL | fn is_send() { } | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0277.rs b/src/test/ui/error-codes/E0277.rs index 80cb5eb7a4b..e60d83098b9 100644 --- a/src/test/ui/error-codes/E0277.rs +++ b/src/test/ui/error-codes/E0277.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no std::path use std::path::Path; diff --git a/src/test/ui/error-codes/E0277.stderr b/src/test/ui/error-codes/E0277.stderr index d0c089fa0f3..e5e416da883 100644 --- a/src/test/ui/error-codes/E0277.stderr +++ b/src/test/ui/error-codes/E0277.stderr @@ -1,23 +1,23 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/E0277.rs:23:6 + --> $DIR/E0277.rs:13:6 | LL | fn f(p: Path) { } | ^ borrow the `Path` instead | = help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `std::path::Path` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/E0277.rs:27:5 + --> $DIR/E0277.rs:17:5 | LL | some_func(5i32); | ^^^^^^^^^ the trait `Foo` is not implemented for `i32` | note: required by `some_func` - --> $DIR/E0277.rs:19:1 + --> $DIR/E0277.rs:9:1 | LL | fn some_func(foo: T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0282.rs b/src/test/ui/error-codes/E0282.rs index dfc702670ce..9bd16abb7bb 100644 --- a/src/test/ui/error-codes/E0282.rs +++ b/src/test/ui/error-codes/E0282.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = "hello".chars().rev().collect(); //~ ERROR E0282 } diff --git a/src/test/ui/error-codes/E0282.stderr b/src/test/ui/error-codes/E0282.stderr index 6862e2d8688..49165d1e42b 100644 --- a/src/test/ui/error-codes/E0282.stderr +++ b/src/test/ui/error-codes/E0282.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/E0282.rs:12:9 + --> $DIR/E0282.rs:2:9 | LL | let x = "hello".chars().rev().collect(); //~ ERROR E0282 | ^ diff --git a/src/test/ui/error-codes/E0283.rs b/src/test/ui/error-codes/E0283.rs index 844c47f41b8..9bdcc9ac42a 100644 --- a/src/test/ui/error-codes/E0283.rs +++ b/src/test/ui/error-codes/E0283.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Generator { fn create() -> u32; } diff --git a/src/test/ui/error-codes/E0283.stderr b/src/test/ui/error-codes/E0283.stderr index 3f63881b61e..598ec672ce6 100644 --- a/src/test/ui/error-codes/E0283.stderr +++ b/src/test/ui/error-codes/E0283.stderr @@ -1,11 +1,11 @@ error[E0283]: type annotations required: cannot resolve `_: Generator` - --> $DIR/E0283.rs:28:21 + --> $DIR/E0283.rs:18:21 | LL | let cont: u32 = Generator::create(); //~ ERROR E0283 | ^^^^^^^^^^^^^^^^^ | note: required by `Generator::create` - --> $DIR/E0283.rs:12:5 + --> $DIR/E0283.rs:2:5 | LL | fn create() -> u32; | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0296.rs b/src/test/ui/error-codes/E0296.rs deleted file mode 100644 index 562fd00a18a..00000000000 --- a/src/test/ui/error-codes/E0296.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![recursion_limit] //~ ERROR E0296 - -fn main() {} diff --git a/src/test/ui/error-codes/E0296.stderr b/src/test/ui/error-codes/E0296.stderr deleted file mode 100644 index 71db4b614a7..00000000000 --- a/src/test/ui/error-codes/E0296.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0296]: malformed recursion limit attribute, expected #![recursion_limit="N"] - --> $DIR/E0296.rs:11:1 - | -LL | #![recursion_limit] //~ ERROR E0296 - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0296`. diff --git a/src/test/ui/error-codes/E0297.rs b/src/test/ui/error-codes/E0297.rs index afe4444c7af..27c7960d977 100644 --- a/src/test/ui/error-codes/E0297.rs +++ b/src/test/ui/error-codes/E0297.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let xs : Vec> = vec![Some(1), None]; diff --git a/src/test/ui/error-codes/E0297.stderr b/src/test/ui/error-codes/E0297.stderr index d510fa99cae..f356a5b954d 100644 --- a/src/test/ui/error-codes/E0297.stderr +++ b/src/test/ui/error-codes/E0297.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in `for` loop binding: `None` not covered - --> $DIR/E0297.rs:14:9 + --> $DIR/E0297.rs:4:9 | LL | for Some(x) in xs {} | ^^^^^^^ pattern `None` not covered diff --git a/src/test/ui/error-codes/E0301.nll.stderr b/src/test/ui/error-codes/E0301.nll.stderr index f060eb90435..898c30a75b2 100644 --- a/src/test/ui/error-codes/E0301.nll.stderr +++ b/src/test/ui/error-codes/E0301.nll.stderr @@ -1,5 +1,5 @@ error[E0301]: cannot mutably borrow in a pattern guard - --> $DIR/E0301.rs:14:19 + --> $DIR/E0301.rs:4:19 | LL | option if option.take().is_none() => {}, //~ ERROR E0301 | ^^^^^^ borrowed mutably in pattern guard diff --git a/src/test/ui/error-codes/E0301.rs b/src/test/ui/error-codes/E0301.rs index 06e98289b0d..54372f8b6b4 100644 --- a/src/test/ui/error-codes/E0301.rs +++ b/src/test/ui/error-codes/E0301.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match Some(()) { None => { }, diff --git a/src/test/ui/error-codes/E0301.stderr b/src/test/ui/error-codes/E0301.stderr index 7d5100c516e..3cfacd5983f 100644 --- a/src/test/ui/error-codes/E0301.stderr +++ b/src/test/ui/error-codes/E0301.stderr @@ -1,5 +1,5 @@ error[E0301]: cannot mutably borrow in a pattern guard - --> $DIR/E0301.rs:14:19 + --> $DIR/E0301.rs:4:19 | LL | option if option.take().is_none() => {}, //~ ERROR E0301 | ^^^^^^ borrowed mutably in pattern guard diff --git a/src/test/ui/error-codes/E0302.rs b/src/test/ui/error-codes/E0302.rs index 6a5ad40b109..7c76eb30c1d 100644 --- a/src/test/ui/error-codes/E0302.rs +++ b/src/test/ui/error-codes/E0302.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match Some(()) { None => { }, diff --git a/src/test/ui/error-codes/E0302.stderr b/src/test/ui/error-codes/E0302.stderr index f55dd523f13..66b31361762 100644 --- a/src/test/ui/error-codes/E0302.stderr +++ b/src/test/ui/error-codes/E0302.stderr @@ -1,5 +1,5 @@ error[E0302]: cannot assign in a pattern guard - --> $DIR/E0302.rs:14:21 + --> $DIR/E0302.rs:4:21 | LL | option if { option = None; false } => { }, //~ ERROR E0302 | ^^^^^^^^^^^^^ assignment in pattern guard diff --git a/src/test/ui/error-codes/E0303.rs b/src/test/ui/error-codes/E0303.rs index 6027414fdbd..0530d43b653 100644 --- a/src/test/ui/error-codes/E0303.rs +++ b/src/test/ui/error-codes/E0303.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match Some("hi".to_string()) { ref op_string_ref @ Some(s) => {}, diff --git a/src/test/ui/error-codes/E0303.stderr b/src/test/ui/error-codes/E0303.stderr index b9da037df0e..d701b07de6b 100644 --- a/src/test/ui/error-codes/E0303.stderr +++ b/src/test/ui/error-codes/E0303.stderr @@ -1,5 +1,5 @@ error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/E0303.rs:13:34 + --> $DIR/E0303.rs:3:34 | LL | ref op_string_ref @ Some(s) => {}, | -------------------------^- @@ -8,7 +8,7 @@ LL | ref op_string_ref @ Some(s) => {}, | both by-ref and by-move used error[E0303]: pattern bindings are not allowed after an `@` - --> $DIR/E0303.rs:13:34 + --> $DIR/E0303.rs:3:34 | LL | ref op_string_ref @ Some(s) => {}, | ^ not allowed after `@` diff --git a/src/test/ui/error-codes/E0308-4.rs b/src/test/ui/error-codes/E0308-4.rs index 106c55817c1..aaf7ef5bd79 100644 --- a/src/test/ui/error-codes/E0308-4.rs +++ b/src/test/ui/error-codes/E0308-4.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = 1u8; match x { diff --git a/src/test/ui/error-codes/E0308-4.stderr b/src/test/ui/error-codes/E0308-4.stderr index 8943c7332e9..f69a3893365 100644 --- a/src/test/ui/error-codes/E0308-4.stderr +++ b/src/test/ui/error-codes/E0308-4.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types - --> $DIR/E0308-4.rs:14:9 + --> $DIR/E0308-4.rs:4:9 | +LL | match x { + | - this match expression has type `u8` LL | 0u8..=3i8 => (), //~ ERROR E0308 | ^^^^^^^^^ expected u8, found i8 diff --git a/src/test/ui/error-codes/E0308.rs b/src/test/ui/error-codes/E0308.rs index 078f1d3a9a1..fa79bee570e 100644 --- a/src/test/ui/error-codes/E0308.rs +++ b/src/test/ui/error-codes/E0308.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(intrinsics)] extern "rust-intrinsic" { diff --git a/src/test/ui/error-codes/E0308.stderr b/src/test/ui/error-codes/E0308.stderr index 438dd50f2bf..8c71747fbcd 100644 --- a/src/test/ui/error-codes/E0308.stderr +++ b/src/test/ui/error-codes/E0308.stderr @@ -1,5 +1,5 @@ error[E0308]: intrinsic has wrong type - --> $DIR/E0308.rs:14:5 + --> $DIR/E0308.rs:4:5 | LL | fn size_of(); //~ ERROR E0308 | ^^^^^^^^^^^^^^^^ expected (), found usize diff --git a/src/test/ui/error-codes/E0328.rs b/src/test/ui/error-codes/E0328.rs index e08532b0249..ef55f44dd6b 100644 --- a/src/test/ui/error-codes/E0328.rs +++ b/src/test/ui/error-codes/E0328.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unsize)] use std::marker::Unsize; diff --git a/src/test/ui/error-codes/E0328.stderr b/src/test/ui/error-codes/E0328.stderr index ad3a224279c..70e6baf69d3 100644 --- a/src/test/ui/error-codes/E0328.stderr +++ b/src/test/ui/error-codes/E0328.stderr @@ -1,5 +1,5 @@ error[E0328]: explicit impls for the `Unsize` trait are not permitted - --> $DIR/E0328.rs:17:1 + --> $DIR/E0328.rs:7:1 | LL | impl Unsize for MyType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of `Unsize` not allowed diff --git a/src/test/ui/error-codes/E0365.rs b/src/test/ui/error-codes/E0365.rs index 18a72b0ff9a..f12ff96bb8a 100644 --- a/src/test/ui/error-codes/E0365.rs +++ b/src/test/ui/error-codes/E0365.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub const X: u32 = 1; } diff --git a/src/test/ui/error-codes/E0365.stderr b/src/test/ui/error-codes/E0365.stderr index efa21aa2e22..c8fc59f8ba9 100644 --- a/src/test/ui/error-codes/E0365.stderr +++ b/src/test/ui/error-codes/E0365.stderr @@ -1,5 +1,5 @@ error[E0365]: `foo` is private, and cannot be re-exported - --> $DIR/E0365.rs:15:9 + --> $DIR/E0365.rs:5:9 | LL | pub use foo as foo2; | ^^^^^^^^^^^ re-export of private `foo` diff --git a/src/test/ui/error-codes/E0370.rs b/src/test/ui/error-codes/E0370.rs index cafe26c65ad..32a66b63bed 100644 --- a/src/test/ui/error-codes/E0370.rs +++ b/src/test/ui/error-codes/E0370.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #[deny(overflowing_literals)] diff --git a/src/test/ui/error-codes/E0370.stderr b/src/test/ui/error-codes/E0370.stderr index f85d2cf5d0b..cd1903bd7e2 100644 --- a/src/test/ui/error-codes/E0370.stderr +++ b/src/test/ui/error-codes/E0370.stderr @@ -1,5 +1,5 @@ error[E0370]: enum discriminant overflowed - --> $DIR/E0370.rs:17:5 + --> $DIR/E0370.rs:7:5 | LL | Y, //~ ERROR E0370 | ^ overflowed on value after 9223372036854775807 diff --git a/src/test/ui/error-codes/E0374.rs b/src/test/ui/error-codes/E0374.rs index 6c4782d230d..41fcedc328d 100644 --- a/src/test/ui/error-codes/E0374.rs +++ b/src/test/ui/error-codes/E0374.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(coerce_unsized)] use std::ops::CoerceUnsized; diff --git a/src/test/ui/error-codes/E0374.stderr b/src/test/ui/error-codes/E0374.stderr index 002e2b003af..9226ca0e478 100644 --- a/src/test/ui/error-codes/E0374.stderr +++ b/src/test/ui/error-codes/E0374.stderr @@ -1,5 +1,5 @@ error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced, none found - --> $DIR/E0374.rs:18:1 + --> $DIR/E0374.rs:8:1 | LL | / impl CoerceUnsized> for Foo //~ ERROR E0374 LL | | where T: CoerceUnsized {} diff --git a/src/test/ui/error-codes/E0375.rs b/src/test/ui/error-codes/E0375.rs index 094ed35cc2d..362854a53aa 100644 --- a/src/test/ui/error-codes/E0375.rs +++ b/src/test/ui/error-codes/E0375.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![feature(coerce_unsized)] diff --git a/src/test/ui/error-codes/E0375.stderr b/src/test/ui/error-codes/E0375.stderr index f3db697790c..18416e9b7d8 100644 --- a/src/test/ui/error-codes/E0375.stderr +++ b/src/test/ui/error-codes/E0375.stderr @@ -1,5 +1,5 @@ error[E0375]: implementing the trait `CoerceUnsized` requires multiple coercions - --> $DIR/E0375.rs:22:12 + --> $DIR/E0375.rs:12:12 | LL | impl CoerceUnsized> for Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^ requires multiple coercions diff --git a/src/test/ui/error-codes/E0376.rs b/src/test/ui/error-codes/E0376.rs index 65be358cc5f..f092eb02c2b 100644 --- a/src/test/ui/error-codes/E0376.rs +++ b/src/test/ui/error-codes/E0376.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(coerce_unsized)] use std::ops::CoerceUnsized; diff --git a/src/test/ui/error-codes/E0376.stderr b/src/test/ui/error-codes/E0376.stderr index c850d13e633..2894a919632 100644 --- a/src/test/ui/error-codes/E0376.stderr +++ b/src/test/ui/error-codes/E0376.stderr @@ -1,5 +1,5 @@ error[E0376]: the trait `CoerceUnsized` may only be implemented for a coercion between structures - --> $DIR/E0376.rs:18:1 + --> $DIR/E0376.rs:8:1 | LL | impl CoerceUnsized for Foo {} //~ ERROR E0376 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0388.nll.stderr b/src/test/ui/error-codes/E0388.nll.stderr index a048374a497..2bcda2ba8fb 100644 --- a/src/test/ui/error-codes/E0388.nll.stderr +++ b/src/test/ui/error-codes/E0388.nll.stderr @@ -1,28 +1,34 @@ error[E0017]: references in constants may only refer to immutable values - --> $DIR/E0388.rs:14:30 + --> $DIR/E0388.rs:4:30 | LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 | ^^^^^^ constants require immutable values +error: cannot mutate statics in the initializer of another static + --> $DIR/E0388.rs:5:39 + | +LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 + | ^^^^^^ + error[E0017]: references in statics may only refer to immutable values - --> $DIR/E0388.rs:15:39 + --> $DIR/E0388.rs:5:39 | LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 | ^^^^^^ statics require immutable values error[E0596]: cannot borrow immutable static item `X` as mutable - --> $DIR/E0388.rs:15:39 + --> $DIR/E0388.rs:5:39 | LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 | ^^^^^^ cannot borrow as mutable error[E0017]: references in statics may only refer to immutable values - --> $DIR/E0388.rs:17:38 + --> $DIR/E0388.rs:8:38 | LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 | ^^^^^^ statics require immutable values -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors Some errors occurred: E0017, E0596. For more information about an error, try `rustc --explain E0017`. diff --git a/src/test/ui/error-codes/E0388.rs b/src/test/ui/error-codes/E0388.rs index c002badfef6..817f2554ade 100644 --- a/src/test/ui/error-codes/E0388.rs +++ b/src/test/ui/error-codes/E0388.rs @@ -1,19 +1,10 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static X: i32 = 1; const C: i32 = 2; const CR: &'static mut i32 = &mut C; //~ ERROR E0017 static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 //~| ERROR cannot borrow + //~| ERROR cannot mutate statics static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 fn main() {} diff --git a/src/test/ui/error-codes/E0388.stderr b/src/test/ui/error-codes/E0388.stderr index d2263cd4034..f35d39c7bb2 100644 --- a/src/test/ui/error-codes/E0388.stderr +++ b/src/test/ui/error-codes/E0388.stderr @@ -1,28 +1,34 @@ error[E0017]: references in constants may only refer to immutable values - --> $DIR/E0388.rs:14:30 + --> $DIR/E0388.rs:4:30 | LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 | ^^^^^^ constants require immutable values +error: cannot mutate statics in the initializer of another static + --> $DIR/E0388.rs:5:39 + | +LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 + | ^^^^^^ + error[E0017]: references in statics may only refer to immutable values - --> $DIR/E0388.rs:15:39 + --> $DIR/E0388.rs:5:39 | LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 | ^^^^^^ statics require immutable values error[E0596]: cannot borrow immutable static item as mutable - --> $DIR/E0388.rs:15:44 + --> $DIR/E0388.rs:5:44 | LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 | ^ error[E0017]: references in statics may only refer to immutable values - --> $DIR/E0388.rs:17:38 + --> $DIR/E0388.rs:8:38 | LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 | ^^^^^^ statics require immutable values -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors Some errors occurred: E0017, E0596. For more information about an error, try `rustc --explain E0017`. diff --git a/src/test/ui/error-codes/E0389.nll.stderr b/src/test/ui/error-codes/E0389.nll.stderr index 66e46dfe29d..13d2f8cfaa5 100644 --- a/src/test/ui/error-codes/E0389.nll.stderr +++ b/src/test/ui/error-codes/E0389.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference - --> $DIR/E0389.rs:18:5 + --> $DIR/E0389.rs:8:5 | LL | let fancy_ref = &(&mut fancy); | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)` diff --git a/src/test/ui/error-codes/E0389.rs b/src/test/ui/error-codes/E0389.rs index 445831bf8d7..8b821330ebe 100644 --- a/src/test/ui/error-codes/E0389.rs +++ b/src/test/ui/error-codes/E0389.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct FancyNum { num: u8, } diff --git a/src/test/ui/error-codes/E0389.stderr b/src/test/ui/error-codes/E0389.stderr index 29e1ea9dd16..cc8914ef3a6 100644 --- a/src/test/ui/error-codes/E0389.stderr +++ b/src/test/ui/error-codes/E0389.stderr @@ -1,5 +1,5 @@ error[E0389]: cannot assign to data in a `&` reference - --> $DIR/E0389.rs:18:5 + --> $DIR/E0389.rs:8:5 | LL | fancy_ref.num = 6; //~ ERROR E0389 | ^^^^^^^^^^^^^^^^^ assignment into an immutable reference diff --git a/src/test/ui/error-codes/E0390.rs b/src/test/ui/error-codes/E0390.rs index cd530dbd6b4..4eb59a053b4 100644 --- a/src/test/ui/error-codes/E0390.rs +++ b/src/test/ui/error-codes/E0390.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: i32 } diff --git a/src/test/ui/error-codes/E0390.stderr b/src/test/ui/error-codes/E0390.stderr index fda2c2e2fe0..7632229360e 100644 --- a/src/test/ui/error-codes/E0390.stderr +++ b/src/test/ui/error-codes/E0390.stderr @@ -1,11 +1,11 @@ error[E0390]: only a single inherent implementation marked with `#[lang = "mut_ptr"]` is allowed for the `*mut T` primitive - --> $DIR/E0390.rs:15:1 + --> $DIR/E0390.rs:5:1 | LL | impl *mut Foo {} //~ ERROR E0390 | ^^^^^^^^^^^^^^^^ | help: consider using a trait to implement these methods - --> $DIR/E0390.rs:15:1 + --> $DIR/E0390.rs:5:1 | LL | impl *mut Foo {} //~ ERROR E0390 | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0392.rs b/src/test/ui/error-codes/E0392.rs index 4c3efcf4e8d..c98d900b62a 100644 --- a/src/test/ui/error-codes/E0392.rs +++ b/src/test/ui/error-codes/E0392.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { Bar } //~ ERROR E0392 fn main() { diff --git a/src/test/ui/error-codes/E0392.stderr b/src/test/ui/error-codes/E0392.stderr index cfa9c49b2ee..4bb3b87bb4a 100644 --- a/src/test/ui/error-codes/E0392.stderr +++ b/src/test/ui/error-codes/E0392.stderr @@ -1,5 +1,5 @@ error[E0392]: parameter `T` is never used - --> $DIR/E0392.rs:11:10 + --> $DIR/E0392.rs:1:10 | LL | enum Foo { Bar } //~ ERROR E0392 | ^ unused type parameter diff --git a/src/test/ui/error-codes/E0393.rs b/src/test/ui/error-codes/E0393.rs index 9165bc2837b..bdd4deafc83 100644 --- a/src/test/ui/error-codes/E0393.rs +++ b/src/test/ui/error-codes/E0393.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait A {} fn together_we_will_rule_the_galaxy(son: &A) {} diff --git a/src/test/ui/error-codes/E0393.stderr b/src/test/ui/error-codes/E0393.stderr index c0e282308c1..bf564ef1021 100644 --- a/src/test/ui/error-codes/E0393.stderr +++ b/src/test/ui/error-codes/E0393.stderr @@ -1,5 +1,5 @@ error[E0393]: the type parameter `T` must be explicitly specified - --> $DIR/E0393.rs:13:43 + --> $DIR/E0393.rs:3:43 | LL | fn together_we_will_rule_the_galaxy(son: &A) {} | ^ missing reference to `T` diff --git a/src/test/ui/error-codes/E0395.rs b/src/test/ui/error-codes/E0395.rs index 617050732b7..9657bbdeadc 100644 --- a/src/test/ui/error-codes/E0395.rs +++ b/src/test/ui/error-codes/E0395.rs @@ -1,18 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-const_compare_raw_pointers static FOO: i32 = 42; static BAR: i32 = 42; -static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020 +static BAZ: bool = unsafe { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020 fn main() { } diff --git a/src/test/ui/error-codes/E0395.stderr b/src/test/ui/error-codes/E0395.stderr index 0fb9a9e854d..cc7d94e22eb 100644 --- a/src/test/ui/error-codes/E0395.stderr +++ b/src/test/ui/error-codes/E0395.stderr @@ -1,8 +1,8 @@ error[E0658]: comparing raw pointers inside static (see issue #53020) - --> $DIR/E0395.rs:16:22 + --> $DIR/E0395.rs:6:29 | -LL | static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | static BAZ: bool = unsafe { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_compare_raw_pointers)] to the crate attributes to enable diff --git a/src/test/ui/error-codes/E0396-fixed.rs b/src/test/ui/error-codes/E0396-fixed.rs index 005f2c36688..1029c75f17d 100644 --- a/src/test/ui/error-codes/E0396-fixed.rs +++ b/src/test/ui/error-codes/E0396-fixed.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_raw_ptr_deref)] const REG_ADDR: *const u8 = 0x5f3759df as *const u8; diff --git a/src/test/ui/error-codes/E0396-fixed.stderr b/src/test/ui/error-codes/E0396-fixed.stderr index e868d5a33fa..2923d976628 100644 --- a/src/test/ui/error-codes/E0396-fixed.stderr +++ b/src/test/ui/error-codes/E0396-fixed.stderr @@ -1,5 +1,5 @@ error: any use of this value will cause an error - --> $DIR/E0396-fixed.rs:15:1 + --> $DIR/E0396-fixed.rs:5:1 | LL | const VALUE: u8 = unsafe { *REG_ADDR }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^^^ diff --git a/src/test/ui/error-codes/E0396.rs b/src/test/ui/error-codes/E0396.rs index 1ee8a74a465..b32853e483d 100644 --- a/src/test/ui/error-codes/E0396.rs +++ b/src/test/ui/error-codes/E0396.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-const_raw_ptr_deref const REG_ADDR: *const u8 = 0x5f3759df as *const u8; diff --git a/src/test/ui/error-codes/E0396.stderr b/src/test/ui/error-codes/E0396.stderr index a2a2e724358..1006ff6dc54 100644 --- a/src/test/ui/error-codes/E0396.stderr +++ b/src/test/ui/error-codes/E0396.stderr @@ -1,5 +1,5 @@ error[E0658]: dereferencing raw pointers in constants is unstable (see issue #51911) - --> $DIR/E0396.rs:15:28 + --> $DIR/E0396.rs:5:28 | LL | const VALUE: u8 = unsafe { *REG_ADDR }; | ^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0401.rs b/src/test/ui/error-codes/E0401.rs index 4fc74f5ef22..a120198b728 100644 --- a/src/test/ui/error-codes/E0401.rs +++ b/src/test/ui/error-codes/E0401.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Baz {} fn foo(x: T) { diff --git a/src/test/ui/error-codes/E0401.stderr b/src/test/ui/error-codes/E0401.stderr index 53eeb3e9c13..c94fa497678 100644 --- a/src/test/ui/error-codes/E0401.stderr +++ b/src/test/ui/error-codes/E0401.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use type parameters from outer function - --> $DIR/E0401.rs:14:39 + --> $DIR/E0401.rs:4:39 | LL | fn foo(x: T) { | - type variable from outer function @@ -9,7 +9,7 @@ LL | fn bfnr, W: Fn()>(y: T) { //~ ERROR E0401 | help: try using a local type parameter instead: `bfnr, W: Fn(), T>` error[E0401]: can't use type parameters from outer function - --> $DIR/E0401.rs:19:16 + --> $DIR/E0401.rs:9:16 | LL | fn foo(x: T) { | - type variable from outer function @@ -21,7 +21,7 @@ LL | (y: T) { //~ ERROR E0401 | ^ use of type variable from outer function error[E0401]: can't use type parameters from outer function - --> $DIR/E0401.rs:32:25 + --> $DIR/E0401.rs:22:25 | LL | impl Iterator for A { | ---- `Self` type implicitly declared here, by this `impl` diff --git a/src/test/ui/error-codes/E0403.rs b/src/test/ui/error-codes/E0403.rs index 6a68013dc6f..8bccb631af4 100644 --- a/src/test/ui/error-codes/E0403.rs +++ b/src/test/ui/error-codes/E0403.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(s: T, u: T) {} //~ ERROR E0403 fn main() { diff --git a/src/test/ui/error-codes/E0403.stderr b/src/test/ui/error-codes/E0403.stderr index f9ccc31654a..919a82dbe1a 100644 --- a/src/test/ui/error-codes/E0403.stderr +++ b/src/test/ui/error-codes/E0403.stderr @@ -1,5 +1,5 @@ error[E0403]: the name `T` is already used for a type parameter in this type parameter list - --> $DIR/E0403.rs:11:11 + --> $DIR/E0403.rs:1:11 | LL | fn foo(s: T, u: T) {} //~ ERROR E0403 | - ^ already used diff --git a/src/test/ui/error-codes/E0404.rs b/src/test/ui/error-codes/E0404.rs index 1c6ff5ae841..b1733372436 100644 --- a/src/test/ui/error-codes/E0404.rs +++ b/src/test/ui/error-codes/E0404.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; struct Bar; diff --git a/src/test/ui/error-codes/E0404.stderr b/src/test/ui/error-codes/E0404.stderr index afb748bedbe..f84fd52c851 100644 --- a/src/test/ui/error-codes/E0404.stderr +++ b/src/test/ui/error-codes/E0404.stderr @@ -1,11 +1,11 @@ error[E0404]: expected trait, found struct `Foo` - --> $DIR/E0404.rs:14:6 + --> $DIR/E0404.rs:4:6 | LL | impl Foo for Bar {} //~ ERROR E0404 | ^^^ not a trait error[E0404]: expected trait, found struct `Foo` - --> $DIR/E0404.rs:18:11 + --> $DIR/E0404.rs:8:11 | LL | fn baz(_: T) {} //~ ERROR E0404 | ^^^ not a trait diff --git a/src/test/ui/error-codes/E0405.rs b/src/test/ui/error-codes/E0405.rs index 45d4b219ba8..f03c4e19b09 100644 --- a/src/test/ui/error-codes/E0405.rs +++ b/src/test/ui/error-codes/E0405.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; impl SomeTrait for Foo {} //~ ERROR E0405 diff --git a/src/test/ui/error-codes/E0405.stderr b/src/test/ui/error-codes/E0405.stderr index 27190af1c6c..2f09a525e45 100644 --- a/src/test/ui/error-codes/E0405.stderr +++ b/src/test/ui/error-codes/E0405.stderr @@ -1,5 +1,5 @@ error[E0405]: cannot find trait `SomeTrait` in this scope - --> $DIR/E0405.rs:13:6 + --> $DIR/E0405.rs:3:6 | LL | impl SomeTrait for Foo {} //~ ERROR E0405 | ^^^^^^^^^ not found in this scope diff --git a/src/test/ui/error-codes/E0407.rs b/src/test/ui/error-codes/E0407.rs index 41d8b4513ce..962bd5741e7 100644 --- a/src/test/ui/error-codes/E0407.rs +++ b/src/test/ui/error-codes/E0407.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn a(); } diff --git a/src/test/ui/error-codes/E0407.stderr b/src/test/ui/error-codes/E0407.stderr index 1be04a992c2..567fc879040 100644 --- a/src/test/ui/error-codes/E0407.stderr +++ b/src/test/ui/error-codes/E0407.stderr @@ -1,5 +1,5 @@ error[E0407]: method `b` is not a member of trait `Foo` - --> $DIR/E0407.rs:19:5 + --> $DIR/E0407.rs:9:5 | LL | fn b() {} | ^^^^^^^^^ not a member of trait `Foo` diff --git a/src/test/ui/error-codes/E0408.rs b/src/test/ui/error-codes/E0408.rs index 8ddeb20afdc..e91a98f3857 100644 --- a/src/test/ui/error-codes/E0408.rs +++ b/src/test/ui/error-codes/E0408.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = Some(0); diff --git a/src/test/ui/error-codes/E0408.stderr b/src/test/ui/error-codes/E0408.stderr index 46845de1aad..dc0a41e6eb0 100644 --- a/src/test/ui/error-codes/E0408.stderr +++ b/src/test/ui/error-codes/E0408.stderr @@ -1,5 +1,5 @@ error[E0408]: variable `y` is not bound in all patterns - --> $DIR/E0408.rs:15:19 + --> $DIR/E0408.rs:5:19 | LL | Some(y) | None => {} //~ ERROR variable `y` is not bound in all patterns | - ^^^^ pattern doesn't bind `y` diff --git a/src/test/ui/error-codes/E0411.rs b/src/test/ui/error-codes/E0411.rs index 187986fbadb..872370f2a53 100644 --- a/src/test/ui/error-codes/E0411.rs +++ b/src/test/ui/error-codes/E0411.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { ::foo; //~ ERROR E0411 } diff --git a/src/test/ui/error-codes/E0411.stderr b/src/test/ui/error-codes/E0411.stderr index a5f2e3a7b93..fe78d8d957e 100644 --- a/src/test/ui/error-codes/E0411.stderr +++ b/src/test/ui/error-codes/E0411.stderr @@ -1,8 +1,8 @@ error[E0411]: cannot find type `Self` in this scope - --> $DIR/E0411.rs:12:6 + --> $DIR/E0411.rs:2:6 | LL | ::foo; //~ ERROR E0411 - | ^^^^ `Self` is only available in traits and impls + | ^^^^ `Self` is only available in impls, traits, and type definitions error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0412.rs b/src/test/ui/error-codes/E0412.rs index f62901cac31..5f922a50a68 100644 --- a/src/test/ui/error-codes/E0412.rs +++ b/src/test/ui/error-codes/E0412.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - impl Something {} //~ ERROR E0412 fn main() { diff --git a/src/test/ui/error-codes/E0412.stderr b/src/test/ui/error-codes/E0412.stderr index 61115c8b292..68d636ffae0 100644 --- a/src/test/ui/error-codes/E0412.stderr +++ b/src/test/ui/error-codes/E0412.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `Something` in this scope - --> $DIR/E0412.rs:11:6 + --> $DIR/E0412.rs:1:6 | LL | impl Something {} //~ ERROR E0412 | ^^^^^^^^^ not found in this scope diff --git a/src/test/ui/error-codes/E0415.rs b/src/test/ui/error-codes/E0415.rs index 2a5f0d3c229..6177ac35be8 100644 --- a/src/test/ui/error-codes/E0415.rs +++ b/src/test/ui/error-codes/E0415.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(f: i32, f: i32) {} //~ ERROR E0415 fn main() { diff --git a/src/test/ui/error-codes/E0415.stderr b/src/test/ui/error-codes/E0415.stderr index 3f036f3a534..6e848f9bfd3 100644 --- a/src/test/ui/error-codes/E0415.stderr +++ b/src/test/ui/error-codes/E0415.stderr @@ -1,5 +1,5 @@ error[E0415]: identifier `f` is bound more than once in this parameter list - --> $DIR/E0415.rs:11:16 + --> $DIR/E0415.rs:1:16 | LL | fn foo(f: i32, f: i32) {} //~ ERROR E0415 | ^ used as parameter more than once diff --git a/src/test/ui/error-codes/E0416.rs b/src/test/ui/error-codes/E0416.rs index 91077ab37f3..88eece07acd 100644 --- a/src/test/ui/error-codes/E0416.rs +++ b/src/test/ui/error-codes/E0416.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match (1, 2) { (x, x) => {} //~ ERROR E0416 diff --git a/src/test/ui/error-codes/E0416.stderr b/src/test/ui/error-codes/E0416.stderr index 8815bb2ad84..4baf5006cf4 100644 --- a/src/test/ui/error-codes/E0416.stderr +++ b/src/test/ui/error-codes/E0416.stderr @@ -1,5 +1,5 @@ error[E0416]: identifier `x` is bound more than once in the same pattern - --> $DIR/E0416.rs:13:13 + --> $DIR/E0416.rs:3:13 | LL | (x, x) => {} //~ ERROR E0416 | ^ used in a pattern more than once diff --git a/src/test/ui/error-codes/E0423.rs b/src/test/ui/error-codes/E0423.rs index 7d71499d318..2b26808d4bd 100644 --- a/src/test/ui/error-codes/E0423.rs +++ b/src/test/ui/error-codes/E0423.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main () { struct Foo { a: bool }; diff --git a/src/test/ui/error-codes/E0423.stderr b/src/test/ui/error-codes/E0423.stderr index 477c698ac9a..d0deb8ce7ea 100644 --- a/src/test/ui/error-codes/E0423.stderr +++ b/src/test/ui/error-codes/E0423.stderr @@ -1,47 +1,53 @@ error: expected type, found `1` - --> $DIR/E0423.rs:22:39 + --> $DIR/E0423.rs:12:39 | LL | if let S { x: _x, y: 2 } = S { x: 1, y: 2 } { println!("Ok"); } | ^ expecting a type here because of type ascription error: expected expression, found `==` - --> $DIR/E0423.rs:25:13 + --> $DIR/E0423.rs:15:13 | LL | if T {} == T {} { println!("Ok"); } | ^^ expected expression error: expected type, found `0` - --> $DIR/E0423.rs:31:39 + --> $DIR/E0423.rs:21:39 | LL | for _ in std::ops::Range { start: 0, end: 10 } {} | ^ expecting a type here because of type ascription error[E0423]: expected function, found struct `Foo` - --> $DIR/E0423.rs:14:13 + --> $DIR/E0423.rs:4:13 | LL | let f = Foo(); //~ ERROR E0423 | ^^^ | | - | did you mean `foo`? | did you mean `Foo { /* fields */ }`? + | help: a function with a similar name exists: `foo` error[E0423]: expected value, found struct `S` - --> $DIR/E0423.rs:22:32 + --> $DIR/E0423.rs:12:32 | LL | if let S { x: _x, y: 2 } = S { x: 1, y: 2 } { println!("Ok"); } - | ^ did you mean `(S { /* fields */ })`? + | ^--------------- + | | + | help: surround the struct literal with parenthesis: `(S { x: 1, y: 2 })` error[E0423]: expected value, found struct `T` - --> $DIR/E0423.rs:25:8 + --> $DIR/E0423.rs:15:8 | LL | if T {} == T {} { println!("Ok"); } - | ^ did you mean `(T { /* fields */ })`? + | ^--- + | | + | help: surround the struct literal with parenthesis: `(T {})` error[E0423]: expected value, found struct `std::ops::Range` - --> $DIR/E0423.rs:31:14 + --> $DIR/E0423.rs:21:14 | LL | for _ in std::ops::Range { start: 0, end: 10 } {} - | ^^^^^^^^^^^^^^^ did you mean `(std::ops::Range { /* fields */ })`? + | ^^^^^^^^^^^^^^^---------------------- + | | + | help: surround the struct literal with parenthesis: `(std::ops::Range { start: 0, end: 10 })` error: aborting due to 7 previous errors diff --git a/src/test/ui/error-codes/E0424.rs b/src/test/ui/error-codes/E0424.rs index 445d0c5f3ed..3c6a1d4f88f 100644 --- a/src/test/ui/error-codes/E0424.rs +++ b/src/test/ui/error-codes/E0424.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; impl Foo { @@ -19,4 +9,5 @@ impl Foo { } fn main () { + let self = "self"; //~ ERROR E0424 } diff --git a/src/test/ui/error-codes/E0424.stderr b/src/test/ui/error-codes/E0424.stderr index a1b7a5f6533..b91f061db34 100644 --- a/src/test/ui/error-codes/E0424.stderr +++ b/src/test/ui/error-codes/E0424.stderr @@ -1,9 +1,15 @@ error[E0424]: expected value, found module `self` - --> $DIR/E0424.rs:17:9 + --> $DIR/E0424.rs:7:9 | LL | self.bar(); //~ ERROR E0424 | ^^^^ `self` value is a keyword only available in methods with `self` parameter -error: aborting due to previous error +error[E0424]: expected unit struct/variant or constant, found module `self` + --> $DIR/E0424.rs:12:9 + | +LL | let self = "self"; //~ ERROR E0424 + | ^^^^ `self` value is a keyword and may not be bound to variables or shadowed + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0424`. diff --git a/src/test/ui/error-codes/E0425.rs b/src/test/ui/error-codes/E0425.rs index 3786282031f..ec234ae9906 100644 --- a/src/test/ui/error-codes/E0425.rs +++ b/src/test/ui/error-codes/E0425.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn bar() { elf; //~ ERROR E0425 diff --git a/src/test/ui/error-codes/E0425.stderr b/src/test/ui/error-codes/E0425.stderr index 72756baf8ef..391027a5184 100644 --- a/src/test/ui/error-codes/E0425.stderr +++ b/src/test/ui/error-codes/E0425.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `elf` in this scope - --> $DIR/E0425.rs:13:9 + --> $DIR/E0425.rs:3:9 | LL | elf; //~ ERROR E0425 | ^^^ not found in this scope diff --git a/src/test/ui/error-codes/E0426.rs b/src/test/ui/error-codes/E0426.rs index d6261d3a74e..7a1dcde49b6 100644 --- a/src/test/ui/error-codes/E0426.rs +++ b/src/test/ui/error-codes/E0426.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main () { loop { break 'a; diff --git a/src/test/ui/error-codes/E0426.stderr b/src/test/ui/error-codes/E0426.stderr index 29249ab3919..035f2eb86b9 100644 --- a/src/test/ui/error-codes/E0426.stderr +++ b/src/test/ui/error-codes/E0426.stderr @@ -1,5 +1,5 @@ error[E0426]: use of undeclared label `'a` - --> $DIR/E0426.rs:13:15 + --> $DIR/E0426.rs:3:15 | LL | break 'a; | ^^ undeclared label `'a` diff --git a/src/test/ui/error-codes/E0428.rs b/src/test/ui/error-codes/E0428.rs index 3c709f3a399..eb9594fb8b6 100644 --- a/src/test/ui/error-codes/E0428.rs +++ b/src/test/ui/error-codes/E0428.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Bar; //~ previous definition of the type `Bar` here struct Bar; //~ ERROR E0428 diff --git a/src/test/ui/error-codes/E0428.stderr b/src/test/ui/error-codes/E0428.stderr index ebfe866625d..2154cb0ead2 100644 --- a/src/test/ui/error-codes/E0428.stderr +++ b/src/test/ui/error-codes/E0428.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `Bar` is defined multiple times - --> $DIR/E0428.rs:12:1 + --> $DIR/E0428.rs:2:1 | LL | struct Bar; //~ previous definition of the type `Bar` here | ----------- previous definition of the type `Bar` here diff --git a/src/test/ui/error-codes/E0429.rs b/src/test/ui/error-codes/E0429.rs index f1cad200be6..e74b27a78b6 100644 --- a/src/test/ui/error-codes/E0429.rs +++ b/src/test/ui/error-codes/E0429.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::self; //~ ERROR E0429 fn main () { diff --git a/src/test/ui/error-codes/E0429.stderr b/src/test/ui/error-codes/E0429.stderr index d36155fb466..13cdb0d8861 100644 --- a/src/test/ui/error-codes/E0429.stderr +++ b/src/test/ui/error-codes/E0429.stderr @@ -1,5 +1,5 @@ error[E0429]: `self` imports are only allowed within a { } list - --> $DIR/E0429.rs:11:5 + --> $DIR/E0429.rs:1:5 | LL | use std::fmt::self; //~ ERROR E0429 | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0430.rs b/src/test/ui/error-codes/E0430.rs index 992876dd294..ba2f671d66c 100644 --- a/src/test/ui/error-codes/E0430.rs +++ b/src/test/ui/error-codes/E0430.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::{self, self}; //~ ERROR E0430 //~^ ERROR E0252 diff --git a/src/test/ui/error-codes/E0430.stderr b/src/test/ui/error-codes/E0430.stderr index 32198acec77..0151cde887f 100644 --- a/src/test/ui/error-codes/E0430.stderr +++ b/src/test/ui/error-codes/E0430.stderr @@ -1,5 +1,5 @@ error[E0430]: `self` import can only appear once in an import list - --> $DIR/E0430.rs:11:16 + --> $DIR/E0430.rs:1:16 | LL | use std::fmt::{self, self}; //~ ERROR E0430 | ^^^^ ---- another `self` import appears here @@ -7,7 +7,7 @@ LL | use std::fmt::{self, self}; //~ ERROR E0430 | can only appear once in an import list error[E0252]: the name `fmt` is defined multiple times - --> $DIR/E0430.rs:11:22 + --> $DIR/E0430.rs:1:22 | LL | use std::fmt::{self, self}; //~ ERROR E0430 | ---- ^^^^ `fmt` reimported here diff --git a/src/test/ui/error-codes/E0431.rs b/src/test/ui/error-codes/E0431.rs index 09ddc1efaf4..2e2ccba1715 100644 --- a/src/test/ui/error-codes/E0431.rs +++ b/src/test/ui/error-codes/E0431.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use {self}; //~ ERROR E0431 fn main () { diff --git a/src/test/ui/error-codes/E0431.stderr b/src/test/ui/error-codes/E0431.stderr index 75b8486aa5c..240e6bd4a82 100644 --- a/src/test/ui/error-codes/E0431.stderr +++ b/src/test/ui/error-codes/E0431.stderr @@ -1,5 +1,5 @@ error[E0431]: `self` import can only appear in an import list with a non-empty prefix - --> $DIR/E0431.rs:11:6 + --> $DIR/E0431.rs:1:6 | LL | use {self}; //~ ERROR E0431 | ^^^^ can only appear in an import list with a non-empty prefix diff --git a/src/test/ui/error-codes/E0432.rs b/src/test/ui/error-codes/E0432.rs index 08d699ee4ca..1fc95f94566 100644 --- a/src/test/ui/error-codes/E0432.rs +++ b/src/test/ui/error-codes/E0432.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use something::Foo; //~ ERROR E0432 fn main () { diff --git a/src/test/ui/error-codes/E0432.stderr b/src/test/ui/error-codes/E0432.stderr index d288cd086e7..bb6b31242cb 100644 --- a/src/test/ui/error-codes/E0432.stderr +++ b/src/test/ui/error-codes/E0432.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `something` - --> $DIR/E0432.rs:11:5 + --> $DIR/E0432.rs:1:5 | LL | use something::Foo; //~ ERROR E0432 | ^^^^^^^^^ maybe a missing `extern crate something;`? diff --git a/src/test/ui/error-codes/E0433.rs b/src/test/ui/error-codes/E0433.rs index 916d6220eb9..9b54ec8c5cf 100644 --- a/src/test/ui/error-codes/E0433.rs +++ b/src/test/ui/error-codes/E0433.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main () { let map = HashMap::new(); //~ ERROR E0433 } diff --git a/src/test/ui/error-codes/E0433.stderr b/src/test/ui/error-codes/E0433.stderr index 8a66e749ba8..7fbb7fa0413 100644 --- a/src/test/ui/error-codes/E0433.stderr +++ b/src/test/ui/error-codes/E0433.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: use of undeclared type or module `HashMap` - --> $DIR/E0433.rs:12:15 + --> $DIR/E0433.rs:2:15 | LL | let map = HashMap::new(); //~ ERROR E0433 | ^^^^^^^ use of undeclared type or module `HashMap` diff --git a/src/test/ui/error-codes/E0434.rs b/src/test/ui/error-codes/E0434.rs index 747d9f72c42..db7037ee115 100644 --- a/src/test/ui/error-codes/E0434.rs +++ b/src/test/ui/error-codes/E0434.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() { let y = 5; fn bar() -> u32 { diff --git a/src/test/ui/error-codes/E0434.stderr b/src/test/ui/error-codes/E0434.stderr index bbbc7d16e3b..0e2bc701b7f 100644 --- a/src/test/ui/error-codes/E0434.stderr +++ b/src/test/ui/error-codes/E0434.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/E0434.rs:14:9 + --> $DIR/E0434.rs:4:9 | LL | y //~ ERROR E0434 | ^ diff --git a/src/test/ui/error-codes/E0435.rs b/src/test/ui/error-codes/E0435.rs index 5246fda6aaf..620dd30a23b 100644 --- a/src/test/ui/error-codes/E0435.rs +++ b/src/test/ui/error-codes/E0435.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main () { let foo = 42u32; let _: [u8; foo]; //~ ERROR E0435 diff --git a/src/test/ui/error-codes/E0435.stderr b/src/test/ui/error-codes/E0435.stderr index 517fddfa1ac..09c9d19e114 100644 --- a/src/test/ui/error-codes/E0435.stderr +++ b/src/test/ui/error-codes/E0435.stderr @@ -1,5 +1,5 @@ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/E0435.rs:13:17 + --> $DIR/E0435.rs:3:17 | LL | let _: [u8; foo]; //~ ERROR E0435 | ^^^ non-constant value diff --git a/src/test/ui/error-codes/E0437.rs b/src/test/ui/error-codes/E0437.rs index 7440a82773e..f8c15007d4e 100644 --- a/src/test/ui/error-codes/E0437.rs +++ b/src/test/ui/error-codes/E0437.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo {} impl Foo for i32 { diff --git a/src/test/ui/error-codes/E0437.stderr b/src/test/ui/error-codes/E0437.stderr index 790e306f121..9470cbf176a 100644 --- a/src/test/ui/error-codes/E0437.stderr +++ b/src/test/ui/error-codes/E0437.stderr @@ -1,5 +1,5 @@ error[E0437]: type `Bar` is not a member of trait `Foo` - --> $DIR/E0437.rs:14:5 + --> $DIR/E0437.rs:4:5 | LL | type Bar = bool; //~ ERROR E0437 | ^^^^^^^^^^^^^^^^ not a member of trait `Foo` diff --git a/src/test/ui/error-codes/E0438.rs b/src/test/ui/error-codes/E0438.rs index 61d25134993..02898b886c8 100644 --- a/src/test/ui/error-codes/E0438.rs +++ b/src/test/ui/error-codes/E0438.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Bar {} impl Bar for i32 { diff --git a/src/test/ui/error-codes/E0438.stderr b/src/test/ui/error-codes/E0438.stderr index 5f311e9bca9..6a11577bb0f 100644 --- a/src/test/ui/error-codes/E0438.stderr +++ b/src/test/ui/error-codes/E0438.stderr @@ -1,5 +1,5 @@ error[E0438]: const `BAR` is not a member of trait `Bar` - --> $DIR/E0438.rs:15:5 + --> $DIR/E0438.rs:4:5 | LL | const BAR: bool = true; //~ ERROR E0438 | ^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Bar` diff --git a/src/test/ui/error-codes/E0439.rs b/src/test/ui/error-codes/E0439.rs index 52443432021..86e9cb55a9c 100644 --- a/src/test/ui/error-codes/E0439.rs +++ b/src/test/ui/error-codes/E0439.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(platform_intrinsics)] extern "platform-intrinsic" { diff --git a/src/test/ui/error-codes/E0439.stderr b/src/test/ui/error-codes/E0439.stderr index 1400633001a..e3b8fbfb253 100644 --- a/src/test/ui/error-codes/E0439.stderr +++ b/src/test/ui/error-codes/E0439.stderr @@ -1,5 +1,5 @@ error[E0439]: invalid `simd_shuffle`, needs length: `simd_shuffle` - --> $DIR/E0439.rs:14:5 + --> $DIR/E0439.rs:4:5 | LL | fn simd_shuffle(a: A, b: A, c: [u32; 8]) -> B; //~ ERROR E0439 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0440.rs b/src/test/ui/error-codes/E0440.rs deleted file mode 100644 index 04e7584008d..00000000000 --- a/src/test/ui/error-codes/E0440.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct f64x2(f64, f64); - -extern "platform-intrinsic" { - fn x86_mm_movemask_pd(x: f64x2) -> i32; //~ ERROR E0440 -} - -fn main () { -} diff --git a/src/test/ui/error-codes/E0440.stderr b/src/test/ui/error-codes/E0440.stderr deleted file mode 100644 index acaa948a331..00000000000 --- a/src/test/ui/error-codes/E0440.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0440]: platform-specific intrinsic has wrong number of type parameters: found 1, expected 0 - --> $DIR/E0440.rs:18:5 - | -LL | fn x86_mm_movemask_pd(x: f64x2) -> i32; //~ ERROR E0440 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0440`. diff --git a/src/test/ui/error-codes/E0441.rs b/src/test/ui/error-codes/E0441.rs deleted file mode 100644 index 967ff643272..00000000000 --- a/src/test/ui/error-codes/E0441.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); - -extern "platform-intrinsic" { - fn x86_mm_adds_ep16(x: i16x8, y: i16x8) -> i16x8; //~ ERROR E0441 -} - -fn main() {} diff --git a/src/test/ui/error-codes/E0441.stderr b/src/test/ui/error-codes/E0441.stderr deleted file mode 100644 index 8a01176dbbe..00000000000 --- a/src/test/ui/error-codes/E0441.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0441]: unrecognized platform-specific intrinsic function: `x86_mm_adds_ep16` - --> $DIR/E0441.rs:18:5 - | -LL | fn x86_mm_adds_ep16(x: i16x8, y: i16x8) -> i16x8; //~ ERROR E0441 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0441`. diff --git a/src/test/ui/error-codes/E0442.rs b/src/test/ui/error-codes/E0442.rs deleted file mode 100644 index ddd927054be..00000000000 --- a/src/test/ui/error-codes/E0442.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8, - i8, i8, i8, i8, i8, i8, i8, i8); -#[repr(simd)] -struct i32x4(i32, i32, i32, i32); -#[repr(simd)] -struct i64x2(i64, i64); - -extern "platform-intrinsic" { - fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2; - //~^ ERROR E0442 - //~| ERROR E0442 - //~| ERROR E0442 -} - -fn main() {} diff --git a/src/test/ui/error-codes/E0442.stderr b/src/test/ui/error-codes/E0442.stderr deleted file mode 100644 index 01881e1b5c3..00000000000 --- a/src/test/ui/error-codes/E0442.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0442]: intrinsic argument 1 has wrong type: found vector with length 16, expected length 8 - --> $DIR/E0442.rs:23:5 - | -LL | fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic argument 2 has wrong type: found vector with length 4, expected length 8 - --> $DIR/E0442.rs:23:5 - | -LL | fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic return value has wrong type: found vector with length 2, expected length 8 - --> $DIR/E0442.rs:23:5 - | -LL | fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0442`. diff --git a/src/test/ui/error-codes/E0443.rs b/src/test/ui/error-codes/E0443.rs deleted file mode 100644 index 24d1ee01dd4..00000000000 --- a/src/test/ui/error-codes/E0443.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); -#[repr(simd)] -struct i64x8(i64, i64, i64, i64, i64, i64, i64, i64); - -extern "platform-intrinsic" { - fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i64x8; //~ ERROR E0443 -} - -fn main() {} diff --git a/src/test/ui/error-codes/E0443.stderr b/src/test/ui/error-codes/E0443.stderr deleted file mode 100644 index b57c9423fce..00000000000 --- a/src/test/ui/error-codes/E0443.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0443]: intrinsic return value has wrong type: found `i64x8`, expected `i16x8` which was used for this vector type previously in this signature - --> $DIR/E0443.rs:20:5 - | -LL | fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i64x8; //~ ERROR E0443 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0443`. diff --git a/src/test/ui/error-codes/E0444.rs b/src/test/ui/error-codes/E0444.rs deleted file mode 100644 index a424a3ca20e..00000000000 --- a/src/test/ui/error-codes/E0444.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(repr_simd)] -#![feature(platform_intrinsics)] - -#[repr(simd)] -struct f64x2(f64, f64); - -extern "platform-intrinsic" { - fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; //~ ERROR E0444 -} - -fn main() {} diff --git a/src/test/ui/error-codes/E0444.stderr b/src/test/ui/error-codes/E0444.stderr deleted file mode 100644 index 338c9dac75e..00000000000 --- a/src/test/ui/error-codes/E0444.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0444]: platform-specific intrinsic has invalid number of arguments: found 3, expected 1 - --> $DIR/E0444.rs:18:5 - | -LL | fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; //~ ERROR E0444 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0444`. diff --git a/src/test/ui/error-codes/E0445.rs b/src/test/ui/error-codes/E0445.rs index bca1b52d17a..a9a3aee2500 100644 --- a/src/test/ui/error-codes/E0445.rs +++ b/src/test/ui/error-codes/E0445.rs @@ -1,25 +1,12 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn dummy(&self) { } } pub trait Bar : Foo {} //~^ ERROR private trait `Foo` in public interface [E0445] -//~| NOTE can't leak private trait pub struct Bar2(pub T); //~^ ERROR private trait `Foo` in public interface [E0445] -//~| NOTE can't leak private trait pub fn foo (t: T) {} //~^ ERROR private trait `Foo` in public interface [E0445] -//~| NOTE can't leak private trait fn main() {} diff --git a/src/test/ui/error-codes/E0445.stderr b/src/test/ui/error-codes/E0445.stderr index 552de83a65e..d0d6ebe16c7 100644 --- a/src/test/ui/error-codes/E0445.stderr +++ b/src/test/ui/error-codes/E0445.stderr @@ -1,17 +1,17 @@ error[E0445]: private trait `Foo` in public interface - --> $DIR/E0445.rs:15:1 + --> $DIR/E0445.rs:5:1 | LL | pub trait Bar : Foo {} | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `Foo` in public interface - --> $DIR/E0445.rs:18:1 + --> $DIR/E0445.rs:7:1 | LL | pub struct Bar2(pub T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `Foo` in public interface - --> $DIR/E0445.rs:21:1 + --> $DIR/E0445.rs:9:1 | LL | pub fn foo (t: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait diff --git a/src/test/ui/error-codes/E0446.rs b/src/test/ui/error-codes/E0446.rs index c5766618284..33bd6144716 100644 --- a/src/test/ui/error-codes/E0446.rs +++ b/src/test/ui/error-codes/E0446.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod Foo { struct Bar(u32); diff --git a/src/test/ui/error-codes/E0446.stderr b/src/test/ui/error-codes/E0446.stderr index 6c7f3785464..8f381320cf9 100644 --- a/src/test/ui/error-codes/E0446.stderr +++ b/src/test/ui/error-codes/E0446.stderr @@ -1,5 +1,5 @@ error[E0446]: private type `Foo::Bar` in public interface - --> $DIR/E0446.rs:14:5 + --> $DIR/E0446.rs:4:5 | LL | struct Bar(u32); | - `Foo::Bar` declared as private diff --git a/src/test/ui/error-codes/E0449.rs b/src/test/ui/error-codes/E0449.rs index ac365db33e5..eba0d479e97 100644 --- a/src/test/ui/error-codes/E0449.rs +++ b/src/test/ui/error-codes/E0449.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Bar; trait Foo { diff --git a/src/test/ui/error-codes/E0449.stderr b/src/test/ui/error-codes/E0449.stderr index df3b09ba7c9..d623c8abbd9 100644 --- a/src/test/ui/error-codes/E0449.stderr +++ b/src/test/ui/error-codes/E0449.stderr @@ -1,5 +1,5 @@ error[E0449]: unnecessary visibility qualifier - --> $DIR/E0449.rs:17:1 + --> $DIR/E0449.rs:7:1 | LL | pub impl Bar {} //~ ERROR E0449 | ^^^ `pub` not permitted here because it's implied @@ -7,13 +7,13 @@ LL | pub impl Bar {} //~ ERROR E0449 = note: place qualifiers on individual impl items instead error[E0449]: unnecessary visibility qualifier - --> $DIR/E0449.rs:19:1 + --> $DIR/E0449.rs:9:1 | LL | pub impl Foo for Bar { //~ ERROR E0449 | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/E0449.rs:20:5 + --> $DIR/E0449.rs:10:5 | LL | pub fn foo() {} //~ ERROR E0449 | ^^^ `pub` not permitted here because it's implied diff --git a/src/test/ui/error-codes/E0451.rs b/src/test/ui/error-codes/E0451.rs index af4e7d628bb..7c1c326fb5b 100644 --- a/src/test/ui/error-codes/E0451.rs +++ b/src/test/ui/error-codes/E0451.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod Bar { pub struct Foo { pub a: isize, diff --git a/src/test/ui/error-codes/E0451.stderr b/src/test/ui/error-codes/E0451.stderr index 4d54e17d507..11bc7e31803 100644 --- a/src/test/ui/error-codes/E0451.stderr +++ b/src/test/ui/error-codes/E0451.stderr @@ -1,11 +1,11 @@ error[E0451]: field `b` of struct `Bar::Foo` is private - --> $DIR/E0451.rs:24:23 + --> $DIR/E0451.rs:14:23 | LL | let Bar::Foo{a:a, b:b} = foo; //~ ERROR E0451 | ^^^ field `b` is private error[E0451]: field `b` of struct `Bar::Foo` is private - --> $DIR/E0451.rs:28:29 + --> $DIR/E0451.rs:18:29 | LL | let f = Bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451 | ^^^^ field `b` is private diff --git a/src/test/ui/error-codes/E0452.rs b/src/test/ui/error-codes/E0452.rs index 1665bbdd4c2..940b9f693ca 100644 --- a/src/test/ui/error-codes/E0452.rs +++ b/src/test/ui/error-codes/E0452.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(foo = "")] //~ ERROR E0452 fn main() { diff --git a/src/test/ui/error-codes/E0452.stderr b/src/test/ui/error-codes/E0452.stderr index a915ca1d674..62f268cd432 100644 --- a/src/test/ui/error-codes/E0452.stderr +++ b/src/test/ui/error-codes/E0452.stderr @@ -1,5 +1,5 @@ error[E0452]: malformed lint attribute - --> $DIR/E0452.rs:11:10 + --> $DIR/E0452.rs:1:10 | LL | #![allow(foo = "")] //~ ERROR E0452 | ^^^^^^^^ diff --git a/src/test/ui/error-codes/E0453.rs b/src/test/ui/error-codes/E0453.rs index 8e51b84bab8..46fa04843ea 100644 --- a/src/test/ui/error-codes/E0453.rs +++ b/src/test/ui/error-codes/E0453.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![forbid(non_snake_case)] #[allow(non_snake_case)] diff --git a/src/test/ui/error-codes/E0453.stderr b/src/test/ui/error-codes/E0453.stderr index 59e1a1cfdfc..03cc756d6ac 100644 --- a/src/test/ui/error-codes/E0453.stderr +++ b/src/test/ui/error-codes/E0453.stderr @@ -1,5 +1,5 @@ error[E0453]: allow(non_snake_case) overruled by outer forbid(non_snake_case) - --> $DIR/E0453.rs:13:9 + --> $DIR/E0453.rs:3:9 | LL | #![forbid(non_snake_case)] | -------------- `forbid` level set here diff --git a/src/test/ui/error-codes/E0454.rs b/src/test/ui/error-codes/E0454.rs index afd0f5f5e46..d62210c3f94 100644 --- a/src/test/ui/error-codes/E0454.rs +++ b/src/test/ui/error-codes/E0454.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link(name = "")] extern {} //~^ ERROR E0454 diff --git a/src/test/ui/error-codes/E0454.stderr b/src/test/ui/error-codes/E0454.stderr index 44dde538666..352c3baa83a 100644 --- a/src/test/ui/error-codes/E0454.stderr +++ b/src/test/ui/error-codes/E0454.stderr @@ -1,5 +1,5 @@ error[E0454]: #[link(name = "")] given with empty name - --> $DIR/E0454.rs:11:1 + --> $DIR/E0454.rs:1:1 | LL | #[link(name = "")] extern {} | ^^^^^^^^^^^^^^^^^^ empty name given diff --git a/src/test/ui/error-codes/E0458.rs b/src/test/ui/error-codes/E0458.rs index fea27ef8115..3d230358721 100644 --- a/src/test/ui/error-codes/E0458.rs +++ b/src/test/ui/error-codes/E0458.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458 //~| ERROR E0459 diff --git a/src/test/ui/error-codes/E0458.stderr b/src/test/ui/error-codes/E0458.stderr index fa99ba6a417..8b071e0b315 100644 --- a/src/test/ui/error-codes/E0458.stderr +++ b/src/test/ui/error-codes/E0458.stderr @@ -1,5 +1,5 @@ error[E0458]: unknown kind: `wonderful_unicorn` - --> $DIR/E0458.rs:11:1 + --> $DIR/E0458.rs:1:1 | LL | #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458 | ^^^^^^^--------------------------^^ @@ -7,7 +7,7 @@ LL | #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458 | unknown kind error[E0459]: #[link(...)] specified without `name = "foo"` - --> $DIR/E0458.rs:11:1 + --> $DIR/E0458.rs:1:1 | LL | #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument diff --git a/src/test/ui/error-codes/E0459.rs b/src/test/ui/error-codes/E0459.rs index dc7ac714f22..80a2fd35151 100644 --- a/src/test/ui/error-codes/E0459.rs +++ b/src/test/ui/error-codes/E0459.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link(kind = "dylib")] extern {} //~ ERROR E0459 fn main() { diff --git a/src/test/ui/error-codes/E0459.stderr b/src/test/ui/error-codes/E0459.stderr index 8f31e7b4b13..d3591cd5f60 100644 --- a/src/test/ui/error-codes/E0459.stderr +++ b/src/test/ui/error-codes/E0459.stderr @@ -1,5 +1,5 @@ error[E0459]: #[link(...)] specified without `name = "foo"` - --> $DIR/E0459.rs:11:1 + --> $DIR/E0459.rs:1:1 | LL | #[link(kind = "dylib")] extern {} //~ ERROR E0459 | ^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument diff --git a/src/test/ui/error-codes/E0463.rs b/src/test/ui/error-codes/E0463.rs index aae83975b22..683565281cf 100644 --- a/src/test/ui/error-codes/E0463.rs +++ b/src/test/ui/error-codes/E0463.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(plugin)] #![plugin(cookie_monster)] //~^ ERROR E0463 diff --git a/src/test/ui/error-codes/E0463.stderr b/src/test/ui/error-codes/E0463.stderr index 26403827e4a..1aa66e1ec88 100644 --- a/src/test/ui/error-codes/E0463.stderr +++ b/src/test/ui/error-codes/E0463.stderr @@ -1,5 +1,5 @@ error[E0463]: can't find crate for `cookie_monster` - --> $DIR/E0463.rs:12:11 + --> $DIR/E0463.rs:2:11 | LL | #![plugin(cookie_monster)] | ^^^^^^^^^^^^^^ can't find crate diff --git a/src/test/ui/error-codes/E0478.rs b/src/test/ui/error-codes/E0478.rs index 8eb4003fc97..1b5ca09d5a6 100644 --- a/src/test/ui/error-codes/E0478.rs +++ b/src/test/ui/error-codes/E0478.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Wedding<'t>: 't { } struct Prince<'kiss, 'SnowWhite> { diff --git a/src/test/ui/error-codes/E0478.stderr b/src/test/ui/error-codes/E0478.stderr index 0e778908058..5147bf24559 100644 --- a/src/test/ui/error-codes/E0478.stderr +++ b/src/test/ui/error-codes/E0478.stderr @@ -1,16 +1,16 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/E0478.rs:14:5 + --> $DIR/E0478.rs:4:5 | LL | child: Box + 'SnowWhite>, //~ ERROR E0478 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime 'SnowWhite as defined on the struct at 13:22 - --> $DIR/E0478.rs:13:22 +note: lifetime parameter instantiated with the lifetime 'SnowWhite as defined on the struct at 3:22 + --> $DIR/E0478.rs:3:22 | LL | struct Prince<'kiss, 'SnowWhite> { | ^^^^^^^^^^ -note: but lifetime parameter must outlive the lifetime 'kiss as defined on the struct at 13:15 - --> $DIR/E0478.rs:13:15 +note: but lifetime parameter must outlive the lifetime 'kiss as defined on the struct at 3:15 + --> $DIR/E0478.rs:3:15 | LL | struct Prince<'kiss, 'SnowWhite> { | ^^^^^ diff --git a/src/test/ui/error-codes/E0492.rs b/src/test/ui/error-codes/E0492.rs index 8e4964c97c5..2de4c12eb64 100644 --- a/src/test/ui/error-codes/E0492.rs +++ b/src/test/ui/error-codes/E0492.rs @@ -1,16 +1,6 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +use std::sync::atomic::AtomicUsize; -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT}; - -const A: AtomicUsize = ATOMIC_USIZE_INIT; +const A: AtomicUsize = AtomicUsize::new(0); static B: &'static AtomicUsize = &A; //~ ERROR E0492 fn main() { diff --git a/src/test/ui/error-codes/E0492.stderr b/src/test/ui/error-codes/E0492.stderr index 157a1929690..b73db6c975e 100644 --- a/src/test/ui/error-codes/E0492.stderr +++ b/src/test/ui/error-codes/E0492.stderr @@ -1,5 +1,5 @@ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead - --> $DIR/E0492.rs:14:34 + --> $DIR/E0492.rs:4:34 | LL | static B: &'static AtomicUsize = &A; //~ ERROR E0492 | ^^ diff --git a/src/test/ui/error-codes/E0496.rs b/src/test/ui/error-codes/E0496.rs index 4ca3cd9c13d..b57c9c79eaa 100644 --- a/src/test/ui/error-codes/E0496.rs +++ b/src/test/ui/error-codes/E0496.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'a> { a: &'a i32, } diff --git a/src/test/ui/error-codes/E0496.stderr b/src/test/ui/error-codes/E0496.stderr index 198daa512bd..515d71ba05e 100644 --- a/src/test/ui/error-codes/E0496.stderr +++ b/src/test/ui/error-codes/E0496.stderr @@ -1,5 +1,5 @@ error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope - --> $DIR/E0496.rs:16:10 + --> $DIR/E0496.rs:6:10 | LL | impl<'a> Foo<'a> { | -- first declared here diff --git a/src/test/ui/error-codes/E0499.nll.stderr b/src/test/ui/error-codes/E0499.nll.stderr index 39815ac6f17..c1acef10e6e 100644 --- a/src/test/ui/error-codes/E0499.nll.stderr +++ b/src/test/ui/error-codes/E0499.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `i` as mutable more than once at a time - --> $DIR/E0499.rs:14:17 + --> $DIR/E0499.rs:4:17 | LL | let mut x = &mut i; | ------ first mutable borrow occurs here diff --git a/src/test/ui/error-codes/E0499.rs b/src/test/ui/error-codes/E0499.rs index 9fb235eccdd..919f97c8a5c 100644 --- a/src/test/ui/error-codes/E0499.rs +++ b/src/test/ui/error-codes/E0499.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let mut i = 0; let mut x = &mut i; diff --git a/src/test/ui/error-codes/E0499.stderr b/src/test/ui/error-codes/E0499.stderr index 8f4fd445fc2..92157e4eba6 100644 --- a/src/test/ui/error-codes/E0499.stderr +++ b/src/test/ui/error-codes/E0499.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `i` as mutable more than once at a time - --> $DIR/E0499.rs:14:22 + --> $DIR/E0499.rs:4:22 | LL | let mut x = &mut i; | - first mutable borrow occurs here diff --git a/src/test/ui/error-codes/E0502.nll.stderr b/src/test/ui/error-codes/E0502.nll.stderr index ce082710246..64ca8f0e6b9 100644 --- a/src/test/ui/error-codes/E0502.nll.stderr +++ b/src/test/ui/error-codes/E0502.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immutable - --> $DIR/E0502.rs:14:5 + --> $DIR/E0502.rs:4:5 | LL | let ref y = a; | ----- immutable borrow occurs here diff --git a/src/test/ui/error-codes/E0502.rs b/src/test/ui/error-codes/E0502.rs index 86d9c130d87..958380ece45 100644 --- a/src/test/ui/error-codes/E0502.rs +++ b/src/test/ui/error-codes/E0502.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn bar(x: &mut i32) {} fn foo(a: &mut i32) { let ref y = a; diff --git a/src/test/ui/error-codes/E0502.stderr b/src/test/ui/error-codes/E0502.stderr index 8f0335c0662..9193886b009 100644 --- a/src/test/ui/error-codes/E0502.stderr +++ b/src/test/ui/error-codes/E0502.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*a` as mutable because `a` is also borrowed as immutable - --> $DIR/E0502.rs:14:9 + --> $DIR/E0502.rs:4:9 | LL | let ref y = a; | ----- immutable borrow occurs here diff --git a/src/test/ui/error-codes/E0503.nll.stderr b/src/test/ui/error-codes/E0503.nll.stderr index 54e2bdacfa9..7b483a5eaa5 100644 --- a/src/test/ui/error-codes/E0503.nll.stderr +++ b/src/test/ui/error-codes/E0503.nll.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `value` because it was mutably borrowed - --> $DIR/E0503.rs:14:16 + --> $DIR/E0503.rs:4:16 | LL | let _borrow = &mut value; | ---------- borrow of `value` occurs here diff --git a/src/test/ui/error-codes/E0503.rs b/src/test/ui/error-codes/E0503.rs index eacf5104145..88f5fc1bbcb 100644 --- a/src/test/ui/error-codes/E0503.rs +++ b/src/test/ui/error-codes/E0503.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let mut value = 3; let _borrow = &mut value; diff --git a/src/test/ui/error-codes/E0503.stderr b/src/test/ui/error-codes/E0503.stderr index 0342ebc4193..83391146b60 100644 --- a/src/test/ui/error-codes/E0503.stderr +++ b/src/test/ui/error-codes/E0503.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `value` because it was mutably borrowed - --> $DIR/E0503.rs:14:16 + --> $DIR/E0503.rs:4:16 | LL | let _borrow = &mut value; | ----- borrow of `value` occurs here diff --git a/src/test/ui/error-codes/E0504.nll.stderr b/src/test/ui/error-codes/E0504.nll.stderr index 6f4823326ff..8d7387e86e5 100644 --- a/src/test/ui/error-codes/E0504.nll.stderr +++ b/src/test/ui/error-codes/E0504.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `fancy_num` because it is borrowed - --> $DIR/E0504.rs:19:13 + --> $DIR/E0504.rs:9:13 | LL | let fancy_ref = &fancy_num; | ---------- borrow of `fancy_num` occurs here diff --git a/src/test/ui/error-codes/E0504.rs b/src/test/ui/error-codes/E0504.rs index c594f241520..06ae0848b7c 100644 --- a/src/test/ui/error-codes/E0504.rs +++ b/src/test/ui/error-codes/E0504.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct FancyNum { num: u8, } diff --git a/src/test/ui/error-codes/E0504.stderr b/src/test/ui/error-codes/E0504.stderr index cd1d3ec5ba4..7f4a611c5d5 100644 --- a/src/test/ui/error-codes/E0504.stderr +++ b/src/test/ui/error-codes/E0504.stderr @@ -1,5 +1,5 @@ error[E0504]: cannot move `fancy_num` into closure because it is borrowed - --> $DIR/E0504.rs:20:40 + --> $DIR/E0504.rs:10:40 | LL | let fancy_ref = &fancy_num; | --------- borrow of `fancy_num` occurs here diff --git a/src/test/ui/error-codes/E0505.nll.stderr b/src/test/ui/error-codes/E0505.nll.stderr index 94624cb9699..181e5e33d29 100644 --- a/src/test/ui/error-codes/E0505.nll.stderr +++ b/src/test/ui/error-codes/E0505.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/E0505.rs:19:13 + --> $DIR/E0505.rs:9:13 | LL | let _ref_to_val: &Value = &x; | -- borrow of `x` occurs here diff --git a/src/test/ui/error-codes/E0505.rs b/src/test/ui/error-codes/E0505.rs index 2ec4ac44b6e..941f5f2199d 100644 --- a/src/test/ui/error-codes/E0505.rs +++ b/src/test/ui/error-codes/E0505.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Value {} fn eat(val: Value) {} diff --git a/src/test/ui/error-codes/E0505.stderr b/src/test/ui/error-codes/E0505.stderr index 64558ba8c7c..268eb880192 100644 --- a/src/test/ui/error-codes/E0505.stderr +++ b/src/test/ui/error-codes/E0505.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/E0505.rs:19:13 + --> $DIR/E0505.rs:9:13 | LL | let _ref_to_val: &Value = &x; | - borrow of `x` occurs here diff --git a/src/test/ui/error-codes/E0507.rs b/src/test/ui/error-codes/E0507.rs index 87b1bf51bdb..bae90a44ce0 100644 --- a/src/test/ui/error-codes/E0507.rs +++ b/src/test/ui/error-codes/E0507.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cell::RefCell; struct TheDarkKnight; diff --git a/src/test/ui/error-codes/E0507.stderr b/src/test/ui/error-codes/E0507.stderr index 3d9d8a5145d..c24b8ecf61a 100644 --- a/src/test/ui/error-codes/E0507.stderr +++ b/src/test/ui/error-codes/E0507.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/E0507.rs:22:5 + --> $DIR/E0507.rs:12:5 | LL | x.borrow().nothing_is_true(); //~ ERROR E0507 | ^^^^^^^^^^ cannot move out of borrowed content diff --git a/src/test/ui/error-codes/E0509.nll.stderr b/src/test/ui/error-codes/E0509.nll.stderr index 723b083b904..0233c7d6d16 100644 --- a/src/test/ui/error-codes/E0509.nll.stderr +++ b/src/test/ui/error-codes/E0509.nll.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait - --> $DIR/E0509.rs:26:23 + --> $DIR/E0509.rs:16:23 | LL | let fancy_field = drop_struct.fancy; //~ ERROR E0509 | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0509.rs b/src/test/ui/error-codes/E0509.rs index b92024cd6e2..b2665c4cc92 100644 --- a/src/test/ui/error-codes/E0509.rs +++ b/src/test/ui/error-codes/E0509.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct FancyNum { num: usize } diff --git a/src/test/ui/error-codes/E0509.stderr b/src/test/ui/error-codes/E0509.stderr index 3952081a265..b1f256d2d9e 100644 --- a/src/test/ui/error-codes/E0509.stderr +++ b/src/test/ui/error-codes/E0509.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait - --> $DIR/E0509.rs:26:23 + --> $DIR/E0509.rs:16:23 | LL | let fancy_field = drop_struct.fancy; //~ ERROR E0509 | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0511.rs b/src/test/ui/error-codes/E0511.rs index c5c03f81825..3590f12e5f9 100644 --- a/src/test/ui/error-codes/E0511.rs +++ b/src/test/ui/error-codes/E0511.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(platform_intrinsics)] extern "platform-intrinsic" { diff --git a/src/test/ui/error-codes/E0511.stderr b/src/test/ui/error-codes/E0511.stderr index 1b8d125cf1a..f1e3c0135bf 100644 --- a/src/test/ui/error-codes/E0511.stderr +++ b/src/test/ui/error-codes/E0511.stderr @@ -1,5 +1,5 @@ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/E0511.rs:18:14 + --> $DIR/E0511.rs:8:14 | LL | unsafe { simd_add(0, 1); } //~ ERROR E0511 | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0512.rs b/src/test/ui/error-codes/E0512.rs index 25f96271641..e70992aee23 100644 --- a/src/test/ui/error-codes/E0512.rs +++ b/src/test/ui/error-codes/E0512.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn takes_u8(_: u8) {} fn main() { diff --git a/src/test/ui/error-codes/E0512.stderr b/src/test/ui/error-codes/E0512.stderr index c91f6ad8f0a..998f6403f0b 100644 --- a/src/test/ui/error-codes/E0512.stderr +++ b/src/test/ui/error-codes/E0512.stderr @@ -1,11 +1,11 @@ -error[E0512]: transmute called with types of different sizes - --> $DIR/E0512.rs:14:23 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/E0512.rs:4:23 | LL | unsafe { takes_u8(::std::mem::transmute(0u16)); } //~ ERROR E0512 | ^^^^^^^^^^^^^^^^^^^^^ | - = note: source type: u16 (16 bits) - = note: target type: u8 (8 bits) + = note: source type: `u16` (16 bits) + = note: target type: `u8` (8 bits) error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0516.rs b/src/test/ui/error-codes/E0516.rs index be2b89c5f39..834bb630989 100644 --- a/src/test/ui/error-codes/E0516.rs +++ b/src/test/ui/error-codes/E0516.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: typeof(92) = 92; //~ ERROR E0516 //~| reserved keyword diff --git a/src/test/ui/error-codes/E0516.stderr b/src/test/ui/error-codes/E0516.stderr index d298e288859..034c1793364 100644 --- a/src/test/ui/error-codes/E0516.stderr +++ b/src/test/ui/error-codes/E0516.stderr @@ -1,5 +1,5 @@ error[E0516]: `typeof` is a reserved keyword but unimplemented - --> $DIR/E0516.rs:12:12 + --> $DIR/E0516.rs:2:12 | LL | let x: typeof(92) = 92; //~ ERROR E0516 | ^^^^^^^^^^ reserved keyword diff --git a/src/test/ui/error-codes/E0517.rs b/src/test/ui/error-codes/E0517.rs index 561223ccdf1..1dcaa2d741f 100644 --- a/src/test/ui/error-codes/E0517.rs +++ b/src/test/ui/error-codes/E0517.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[repr(C)] //~ ERROR: E0517 type Foo = u8; diff --git a/src/test/ui/error-codes/E0517.stderr b/src/test/ui/error-codes/E0517.stderr index 4779fd08c68..366ab1bca63 100644 --- a/src/test/ui/error-codes/E0517.stderr +++ b/src/test/ui/error-codes/E0517.stderr @@ -1,5 +1,5 @@ error[E0517]: attribute should be applied to struct, enum or union - --> $DIR/E0517.rs:11:8 + --> $DIR/E0517.rs:1:8 | LL | #[repr(C)] //~ ERROR: E0517 | ^ @@ -7,7 +7,7 @@ LL | type Foo = u8; | -------------- not a struct, enum or union error[E0517]: attribute should be applied to struct or union - --> $DIR/E0517.rs:14:8 + --> $DIR/E0517.rs:4:8 | LL | #[repr(packed)] //~ ERROR: E0517 | ^^^^^^ @@ -15,7 +15,7 @@ LL | enum Foo2 {Bar, Baz} | -------------------- not a struct or union error[E0517]: attribute should be applied to enum - --> $DIR/E0517.rs:17:8 + --> $DIR/E0517.rs:7:8 | LL | #[repr(u8)] //~ ERROR: E0517 | ^^ @@ -23,7 +23,7 @@ LL | struct Foo3 {bar: bool, baz: bool} | ---------------------------------- not an enum error[E0517]: attribute should be applied to struct, enum or union - --> $DIR/E0517.rs:20:8 + --> $DIR/E0517.rs:10:8 | LL | #[repr(C)] //~ ERROR: E0517 | ^ diff --git a/src/test/ui/error-codes/E0518.rs b/src/test/ui/error-codes/E0518.rs index 6d5b6e48e0d..9c99702ada8 100644 --- a/src/test/ui/error-codes/E0518.rs +++ b/src/test/ui/error-codes/E0518.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[inline(always)] //~ ERROR: E0518 struct Foo; diff --git a/src/test/ui/error-codes/E0518.stderr b/src/test/ui/error-codes/E0518.stderr index 27d5d3645fd..6391a69c24e 100644 --- a/src/test/ui/error-codes/E0518.stderr +++ b/src/test/ui/error-codes/E0518.stderr @@ -1,5 +1,5 @@ error[E0518]: attribute should be applied to function or closure - --> $DIR/E0518.rs:11:1 + --> $DIR/E0518.rs:1:1 | LL | #[inline(always)] //~ ERROR: E0518 | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | struct Foo; | ----------- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/E0518.rs:14:1 + --> $DIR/E0518.rs:4:1 | LL | #[inline(never)] //~ ERROR: E0518 | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0520.rs b/src/test/ui/error-codes/E0520.rs index eae5b11a819..b746ca63590 100644 --- a/src/test/ui/error-codes/E0520.rs +++ b/src/test/ui/error-codes/E0520.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] trait SpaceLlama { diff --git a/src/test/ui/error-codes/E0520.stderr b/src/test/ui/error-codes/E0520.stderr index 67ec1d42715..72fc85ab1e7 100644 --- a/src/test/ui/error-codes/E0520.stderr +++ b/src/test/ui/error-codes/E0520.stderr @@ -1,5 +1,5 @@ error[E0520]: `fly` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/E0520.rs:26:5 + --> $DIR/E0520.rs:16:5 | LL | / impl SpaceLlama for T { LL | | fn fly(&self) {} diff --git a/src/test/ui/error-codes/E0522.rs b/src/test/ui/error-codes/E0522.rs index c50cb759e05..1414e82408c 100644 --- a/src/test/ui/error-codes/E0522.rs +++ b/src/test/ui/error-codes/E0522.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(lang_items)] #[lang = "cookie"] diff --git a/src/test/ui/error-codes/E0522.stderr b/src/test/ui/error-codes/E0522.stderr index 9f3f8968d73..0a8a41598da 100644 --- a/src/test/ui/error-codes/E0522.stderr +++ b/src/test/ui/error-codes/E0522.stderr @@ -1,5 +1,5 @@ error[E0522]: definition of an unknown language item: `cookie` - --> $DIR/E0522.rs:13:1 + --> $DIR/E0522.rs:3:1 | LL | #[lang = "cookie"] | ^^^^^^^^^^^^^^^^^^ definition of unknown language item `cookie` diff --git a/src/test/ui/error-codes/E0527.rs b/src/test/ui/error-codes/E0527.rs index a90ccec9cf5..af055ff269e 100644 --- a/src/test/ui/error-codes/E0527.rs +++ b/src/test/ui/error-codes/E0527.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let r = &[1, 2, 3, 4]; match r { diff --git a/src/test/ui/error-codes/E0527.stderr b/src/test/ui/error-codes/E0527.stderr index 1e764c18587..a2e6288b21b 100644 --- a/src/test/ui/error-codes/E0527.stderr +++ b/src/test/ui/error-codes/E0527.stderr @@ -1,5 +1,5 @@ error[E0527]: pattern requires 2 elements but array has 4 - --> $DIR/E0527.rs:14:10 + --> $DIR/E0527.rs:4:10 | LL | &[a, b] => { | ^^^^^^ expected 4 elements diff --git a/src/test/ui/error-codes/E0528.rs b/src/test/ui/error-codes/E0528.rs index e2aa2c067cb..f2681fa043d 100644 --- a/src/test/ui/error-codes/E0528.rs +++ b/src/test/ui/error-codes/E0528.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] fn main() { diff --git a/src/test/ui/error-codes/E0528.stderr b/src/test/ui/error-codes/E0528.stderr index ca9f8f45457..a7205af5054 100644 --- a/src/test/ui/error-codes/E0528.stderr +++ b/src/test/ui/error-codes/E0528.stderr @@ -1,5 +1,5 @@ error[E0528]: pattern requires at least 3 elements but array has 2 - --> $DIR/E0528.rs:16:10 + --> $DIR/E0528.rs:6:10 | LL | &[a, b, c, rest..] => { | ^^^^^^^^^^^^^^^^^ pattern cannot match array of 2 elements diff --git a/src/test/ui/error-codes/E0529.rs b/src/test/ui/error-codes/E0529.rs index 2459054da89..a82bc9ebcf4 100644 --- a/src/test/ui/error-codes/E0529.rs +++ b/src/test/ui/error-codes/E0529.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let r: f32 = 1.0; match r { diff --git a/src/test/ui/error-codes/E0529.stderr b/src/test/ui/error-codes/E0529.stderr index b2e7ae23fb0..96b22bb2263 100644 --- a/src/test/ui/error-codes/E0529.stderr +++ b/src/test/ui/error-codes/E0529.stderr @@ -1,5 +1,5 @@ error[E0529]: expected an array or slice, found `f32` - --> $DIR/E0529.rs:14:9 + --> $DIR/E0529.rs:4:9 | LL | [a, b] => { | ^^^^^^ pattern cannot match with input type `f32` diff --git a/src/test/ui/error-codes/E0530.rs b/src/test/ui/error-codes/E0530.rs index 4f674d0e671..5bc40964f64 100644 --- a/src/test/ui/error-codes/E0530.rs +++ b/src/test/ui/error-codes/E0530.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { static TEST: i32 = 0; diff --git a/src/test/ui/error-codes/E0530.stderr b/src/test/ui/error-codes/E0530.stderr index 96bc47a1afe..2ef80253eaf 100644 --- a/src/test/ui/error-codes/E0530.stderr +++ b/src/test/ui/error-codes/E0530.stderr @@ -1,5 +1,5 @@ error[E0530]: match bindings cannot shadow statics - --> $DIR/E0530.rs:16:9 + --> $DIR/E0530.rs:6:9 | LL | static TEST: i32 = 0; | --------------------- the static `TEST` is defined here diff --git a/src/test/ui/error-codes/E0532.rs b/src/test/ui/error-codes/E0532.rs index 5dc3b5f94f3..931ca4628fe 100644 --- a/src/test/ui/error-codes/E0532.rs +++ b/src/test/ui/error-codes/E0532.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let value = 1; diff --git a/src/test/ui/error-codes/E0532.stderr b/src/test/ui/error-codes/E0532.stderr index faccd10ec6d..887ede0a412 100644 --- a/src/test/ui/error-codes/E0532.stderr +++ b/src/test/ui/error-codes/E0532.stderr @@ -1,5 +1,5 @@ error[E0532]: expected tuple struct/variant, found constant `StructConst1` - --> $DIR/E0532.rs:15:9 + --> $DIR/E0532.rs:5:9 | LL | StructConst1(_) => { }, | ^^^^^^^^^^^^ not a tuple struct/variant diff --git a/src/test/ui/error-codes/E0534.rs b/src/test/ui/error-codes/E0534.rs index fc465b26869..a4242499419 100644 --- a/src/test/ui/error-codes/E0534.rs +++ b/src/test/ui/error-codes/E0534.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[inline()] //~ ERROR E0534 pub fn something() {} diff --git a/src/test/ui/error-codes/E0534.stderr b/src/test/ui/error-codes/E0534.stderr index 30890882cc3..d2829e1643b 100644 --- a/src/test/ui/error-codes/E0534.stderr +++ b/src/test/ui/error-codes/E0534.stderr @@ -1,5 +1,5 @@ error[E0534]: expected one argument - --> $DIR/E0534.rs:11:1 + --> $DIR/E0534.rs:1:1 | LL | #[inline()] //~ ERROR E0534 | ^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0558.rs b/src/test/ui/error-codes/E0558.rs deleted file mode 100644 index 64a6ee4cf58..00000000000 --- a/src/test/ui/error-codes/E0558.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[export_name] -//~^ ERROR E0558 - -pub fn something() {} - -fn main() {} diff --git a/src/test/ui/error-codes/E0558.stderr b/src/test/ui/error-codes/E0558.stderr deleted file mode 100644 index 0777c44058f..00000000000 --- a/src/test/ui/error-codes/E0558.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0558]: `export_name` attribute has invalid format - --> $DIR/E0558.rs:11:1 - | -LL | #[export_name] - | ^^^^^^^^^^^^^^ did you mean #[export_name="*"]? - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0558`. diff --git a/src/test/ui/error-codes/E0559.rs b/src/test/ui/error-codes/E0559.rs index da0f692cc28..c6d04ff148a 100644 --- a/src/test/ui/error-codes/E0559.rs +++ b/src/test/ui/error-codes/E0559.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Field { Fool { x: u32 }, } diff --git a/src/test/ui/error-codes/E0559.stderr b/src/test/ui/error-codes/E0559.stderr index cb9059ee538..63ee1cd7820 100644 --- a/src/test/ui/error-codes/E0559.stderr +++ b/src/test/ui/error-codes/E0559.stderr @@ -1,5 +1,5 @@ error[E0559]: variant `Field::Fool` has no field named `joke` - --> $DIR/E0559.rs:16:27 + --> $DIR/E0559.rs:6:27 | LL | let s = Field::Fool { joke: 0 }; | ^^^^ `Field::Fool` does not have this field diff --git a/src/test/ui/error-codes/E0560.rs b/src/test/ui/error-codes/E0560.rs index bbb7f08d62e..1d60f8948ab 100644 --- a/src/test/ui/error-codes/E0560.rs +++ b/src/test/ui/error-codes/E0560.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Simba { mother: u32, } diff --git a/src/test/ui/error-codes/E0560.stderr b/src/test/ui/error-codes/E0560.stderr index 66fb04111db..6b634f1855d 100644 --- a/src/test/ui/error-codes/E0560.stderr +++ b/src/test/ui/error-codes/E0560.stderr @@ -1,5 +1,5 @@ error[E0560]: struct `Simba` has no field named `father` - --> $DIR/E0560.rs:16:32 + --> $DIR/E0560.rs:6:32 | LL | let s = Simba { mother: 1, father: 0 }; | ^^^^^^ `Simba` does not have this field diff --git a/src/test/ui/error-codes/E0565-1.rs b/src/test/ui/error-codes/E0565-1.rs index d7cbb823013..30fba019199 100644 --- a/src/test/ui/error-codes/E0565-1.rs +++ b/src/test/ui/error-codes/E0565-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // deprecated doesn't currently support literals #[deprecated("since")] //~ ERROR E0565 fn f() { } diff --git a/src/test/ui/error-codes/E0565-1.stderr b/src/test/ui/error-codes/E0565-1.stderr index a2e099acd3c..c320918a3bf 100644 --- a/src/test/ui/error-codes/E0565-1.stderr +++ b/src/test/ui/error-codes/E0565-1.stderr @@ -1,5 +1,5 @@ error[E0565]: item in `deprecated` must be a key/value pair - --> $DIR/E0565-1.rs:12:14 + --> $DIR/E0565-1.rs:2:14 | LL | #[deprecated("since")] //~ ERROR E0565 | ^^^^^^^ diff --git a/src/test/ui/error-codes/E0565-2.rs b/src/test/ui/error-codes/E0565-2.rs index eb13e432751..0319ecb11f9 100644 --- a/src/test/ui/error-codes/E0565-2.rs +++ b/src/test/ui/error-codes/E0565-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // repr currently doesn't support literals #[deprecated(since = b"1.29", note = "hi")] //~ ERROR E0565 struct A { } diff --git a/src/test/ui/error-codes/E0565-2.stderr b/src/test/ui/error-codes/E0565-2.stderr index 68093e4e2f0..8e2ce09059a 100644 --- a/src/test/ui/error-codes/E0565-2.stderr +++ b/src/test/ui/error-codes/E0565-2.stderr @@ -1,5 +1,5 @@ error[E0565]: literal in `deprecated` value must be a string - --> $DIR/E0565-2.rs:12:22 + --> $DIR/E0565-2.rs:2:22 | LL | #[deprecated(since = b"1.29", note = "hi")] //~ ERROR E0565 | ^^^^^^^ help: consider removing the prefix: `"1.29"` diff --git a/src/test/ui/error-codes/E0565.rs b/src/test/ui/error-codes/E0565.rs index af8b10edab8..b09f5df5201 100644 --- a/src/test/ui/error-codes/E0565.rs +++ b/src/test/ui/error-codes/E0565.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // repr currently doesn't support literals #[repr("C")] //~ ERROR E0565 struct A { } diff --git a/src/test/ui/error-codes/E0565.stderr b/src/test/ui/error-codes/E0565.stderr index 04edff8ec69..2c172f81149 100644 --- a/src/test/ui/error-codes/E0565.stderr +++ b/src/test/ui/error-codes/E0565.stderr @@ -1,5 +1,5 @@ error[E0565]: meta item in `repr` must be an identifier - --> $DIR/E0565.rs:12:8 + --> $DIR/E0565.rs:2:8 | LL | #[repr("C")] //~ ERROR E0565 | ^^^ diff --git a/src/test/ui/error-codes/E0572.rs b/src/test/ui/error-codes/E0572.rs index bbaab102de7..cb842c9334d 100644 --- a/src/test/ui/error-codes/E0572.rs +++ b/src/test/ui/error-codes/E0572.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const FOO: u32 = return 0; //~ ERROR E0572 fn main() {} diff --git a/src/test/ui/error-codes/E0572.stderr b/src/test/ui/error-codes/E0572.stderr index b2896c3892d..295a518c336 100644 --- a/src/test/ui/error-codes/E0572.stderr +++ b/src/test/ui/error-codes/E0572.stderr @@ -1,5 +1,5 @@ error[E0572]: return statement outside of function body - --> $DIR/E0572.rs:11:18 + --> $DIR/E0572.rs:1:18 | LL | const FOO: u32 = return 0; //~ ERROR E0572 | ^^^^^^^^ diff --git a/src/test/ui/error-codes/E0582.rs b/src/test/ui/error-codes/E0582.rs index 5e6f65a18f4..ff25012d0f9 100644 --- a/src/test/ui/error-codes/E0582.rs +++ b/src/test/ui/error-codes/E0582.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test was derived from the wasm and parsell crates. They // stopped compiling when #32330 is fixed. diff --git a/src/test/ui/error-codes/E0582.stderr b/src/test/ui/error-codes/E0582.stderr index c92e0b9f137..81a2f004653 100644 --- a/src/test/ui/error-codes/E0582.stderr +++ b/src/test/ui/error-codes/E0582.stderr @@ -1,11 +1,11 @@ error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/E0582.rs:38:30 + --> $DIR/E0582.rs:28:30 | LL | where F: for<'a> Fn() -> Option<&'a i32> | ^^^^^^^^^^^^^^^ error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types - --> $DIR/E0582.rs:46:31 + --> $DIR/E0582.rs:36:31 | LL | where F: for<'a> Iterator | ^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0585.rs b/src/test/ui/error-codes/E0585.rs index 1acaf8c0b78..890b77b533a 100644 --- a/src/test/ui/error-codes/E0585.rs +++ b/src/test/ui/error-codes/E0585.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { /// Hello! I'm useless... //~^ ERROR E0585 diff --git a/src/test/ui/error-codes/E0585.stderr b/src/test/ui/error-codes/E0585.stderr index ef0825939c3..7a31c4896ee 100644 --- a/src/test/ui/error-codes/E0585.stderr +++ b/src/test/ui/error-codes/E0585.stderr @@ -1,5 +1,5 @@ error[E0585]: found a documentation comment that doesn't document anything - --> $DIR/E0585.rs:12:5 + --> $DIR/E0585.rs:2:5 | LL | /// Hello! I'm useless... | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0586.rs b/src/test/ui/error-codes/E0586.rs index c1bfc5c73a1..2ab8a2959e3 100644 --- a/src/test/ui/error-codes/E0586.rs +++ b/src/test/ui/error-codes/E0586.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let tmp = vec![0, 1, 2, 3, 4, 4, 3, 3, 2, 1]; let x = &tmp[1..=]; //~ ERROR E0586 diff --git a/src/test/ui/error-codes/E0586.stderr b/src/test/ui/error-codes/E0586.stderr index bd72fbee160..394b4be3340 100644 --- a/src/test/ui/error-codes/E0586.stderr +++ b/src/test/ui/error-codes/E0586.stderr @@ -1,5 +1,5 @@ error[E0586]: inclusive range with no end - --> $DIR/E0586.rs:13:22 + --> $DIR/E0586.rs:3:22 | LL | let x = &tmp[1..=]; //~ ERROR E0586 | ^ diff --git a/src/test/ui/error-codes/E0597.nll.stderr b/src/test/ui/error-codes/E0597.nll.stderr index 54a46f612b9..88a8a46930d 100644 --- a/src/test/ui/error-codes/E0597.nll.stderr +++ b/src/test/ui/error-codes/E0597.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `y` does not live long enough - --> $DIR/E0597.rs:18:16 + --> $DIR/E0597.rs:8:16 | LL | x.x = Some(&y); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/error-codes/E0597.rs b/src/test/ui/error-codes/E0597.rs index e70213e19c3..7217e351281 100644 --- a/src/test/ui/error-codes/E0597.rs +++ b/src/test/ui/error-codes/E0597.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'a> { x: Option<&'a u32>, } diff --git a/src/test/ui/error-codes/E0597.stderr b/src/test/ui/error-codes/E0597.stderr index 5897cc13c94..a5b0cc49d0c 100644 --- a/src/test/ui/error-codes/E0597.stderr +++ b/src/test/ui/error-codes/E0597.stderr @@ -1,5 +1,5 @@ error[E0597]: `y` does not live long enough - --> $DIR/E0597.rs:18:17 + --> $DIR/E0597.rs:8:17 | LL | x.x = Some(&y); | ^ borrowed value does not live long enough diff --git a/src/test/ui/error-codes/E0599.rs b/src/test/ui/error-codes/E0599.rs index 30fca2bac03..a2d7bb2dcbe 100644 --- a/src/test/ui/error-codes/E0599.rs +++ b/src/test/ui/error-codes/E0599.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; fn main() { diff --git a/src/test/ui/error-codes/E0599.stderr b/src/test/ui/error-codes/E0599.stderr index d118939d17a..85110889e9a 100644 --- a/src/test/ui/error-codes/E0599.stderr +++ b/src/test/ui/error-codes/E0599.stderr @@ -1,11 +1,11 @@ error[E0599]: no associated item named `NotEvenReal` found for type `Foo` in the current scope - --> $DIR/E0599.rs:14:15 + --> $DIR/E0599.rs:4:20 | LL | struct Foo; | ----------- associated item `NotEvenReal` not found for this ... LL | || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599 - | ^^^^^^^^^^^^^^^^^^ associated item not found in `Foo` + | -----^^^^^^^^^^^-- associated item not found in `Foo` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0600.rs b/src/test/ui/error-codes/E0600.rs index 5457ff26608..7731d861935 100644 --- a/src/test/ui/error-codes/E0600.rs +++ b/src/test/ui/error-codes/E0600.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { !"a"; //~ ERROR E0600 } diff --git a/src/test/ui/error-codes/E0600.stderr b/src/test/ui/error-codes/E0600.stderr index c29ec4fe6ae..6c6d922290f 100644 --- a/src/test/ui/error-codes/E0600.stderr +++ b/src/test/ui/error-codes/E0600.stderr @@ -1,5 +1,5 @@ error[E0600]: cannot apply unary operator `!` to type `&'static str` - --> $DIR/E0600.rs:12:5 + --> $DIR/E0600.rs:2:5 | LL | !"a"; //~ ERROR E0600 | ^^^^ cannot apply unary operator `!` diff --git a/src/test/ui/error-codes/E0601.rs b/src/test/ui/error-codes/E0601.rs index 37b3f523475..47feb7f8367 100644 --- a/src/test/ui/error-codes/E0601.rs +++ b/src/test/ui/error-codes/E0601.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for main function not found. diff --git a/src/test/ui/error-codes/E0602.rs b/src/test/ui/error-codes/E0602.rs index cc3e436d433..8fadce526d9 100644 --- a/src/test/ui/error-codes/E0602.rs +++ b/src/test/ui/error-codes/E0602.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-D bogus // error-pattern:E0602 diff --git a/src/test/ui/error-codes/E0603.rs b/src/test/ui/error-codes/E0603.rs index 1cc9f6bfa7d..24a9ba88763 100644 --- a/src/test/ui/error-codes/E0603.rs +++ b/src/test/ui/error-codes/E0603.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod SomeModule { const PRIVATE: u32 = 0x_a_bad_1dea_u32; } diff --git a/src/test/ui/error-codes/E0603.stderr b/src/test/ui/error-codes/E0603.stderr index 1159348d3db..ee8fd2809bc 100644 --- a/src/test/ui/error-codes/E0603.stderr +++ b/src/test/ui/error-codes/E0603.stderr @@ -1,5 +1,5 @@ error[E0603]: constant `PRIVATE` is private - --> $DIR/E0603.rs:16:17 + --> $DIR/E0603.rs:6:17 | LL | SomeModule::PRIVATE; //~ ERROR E0603 | ^^^^^^^ diff --git a/src/test/ui/error-codes/E0604.rs b/src/test/ui/error-codes/E0604.rs index c5bf3a77b6c..b9c0d1f924d 100644 --- a/src/test/ui/error-codes/E0604.rs +++ b/src/test/ui/error-codes/E0604.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { 1u32 as char; //~ ERROR E0604 } diff --git a/src/test/ui/error-codes/E0604.stderr b/src/test/ui/error-codes/E0604.stderr index 6aa176d1313..2bd92db86e3 100644 --- a/src/test/ui/error-codes/E0604.stderr +++ b/src/test/ui/error-codes/E0604.stderr @@ -1,5 +1,5 @@ error[E0604]: only `u8` can be cast as `char`, not `u32` - --> $DIR/E0604.rs:12:5 + --> $DIR/E0604.rs:2:5 | LL | 1u32 as char; //~ ERROR E0604 | ^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0605.rs b/src/test/ui/error-codes/E0605.rs index 4b5b8beb368..0e86e367e83 100644 --- a/src/test/ui/error-codes/E0605.rs +++ b/src/test/ui/error-codes/E0605.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = 0u8; x as Vec; //~ ERROR E0605 diff --git a/src/test/ui/error-codes/E0605.stderr b/src/test/ui/error-codes/E0605.stderr index e66e1c12d8f..4dc074b222a 100644 --- a/src/test/ui/error-codes/E0605.stderr +++ b/src/test/ui/error-codes/E0605.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `u8` as `std::vec::Vec` - --> $DIR/E0605.rs:13:5 + --> $DIR/E0605.rs:3:5 | LL | x as Vec; //~ ERROR E0605 | ^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | x as Vec; //~ ERROR E0605 = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait error[E0605]: non-primitive cast: `*const u8` as `&u8` - --> $DIR/E0605.rs:16:5 + --> $DIR/E0605.rs:6:5 | LL | v as &u8; //~ ERROR E0605 | ^^^^^^^^ diff --git a/src/test/ui/error-codes/E0606.rs b/src/test/ui/error-codes/E0606.rs index 55071736bfe..cb0d8cfc31e 100644 --- a/src/test/ui/error-codes/E0606.rs +++ b/src/test/ui/error-codes/E0606.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { &0u8 as u8; //~ ERROR E0606 } diff --git a/src/test/ui/error-codes/E0606.stderr b/src/test/ui/error-codes/E0606.stderr index bd5bc908f72..89ec4896a2b 100644 --- a/src/test/ui/error-codes/E0606.stderr +++ b/src/test/ui/error-codes/E0606.stderr @@ -1,14 +1,11 @@ error[E0606]: casting `&u8` as `u8` is invalid - --> $DIR/E0606.rs:12:5 + --> $DIR/E0606.rs:2:5 | LL | &0u8 as u8; //~ ERROR E0606 - | ^^^^^^^^^^ cannot cast `&u8` as `u8` - | -help: did you mean `*&0u8`? - --> $DIR/E0606.rs:12:5 - | -LL | &0u8 as u8; //~ ERROR E0606 - | ^^^^ + | ----^^^^^^ + | | + | cannot cast `&u8` as `u8` + | help: dereference the expression: `*&0u8` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0607.rs b/src/test/ui/error-codes/E0607.rs index fa761f2c178..ad9f8709b07 100644 --- a/src/test/ui/error-codes/E0607.rs +++ b/src/test/ui/error-codes/E0607.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let v = 0 as *const u8; v as *const [u8]; //~ ERROR E0607 diff --git a/src/test/ui/error-codes/E0607.stderr b/src/test/ui/error-codes/E0607.stderr index d109908bc74..1fbe4b9c5bc 100644 --- a/src/test/ui/error-codes/E0607.stderr +++ b/src/test/ui/error-codes/E0607.stderr @@ -1,5 +1,5 @@ error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]` - --> $DIR/E0607.rs:13:5 + --> $DIR/E0607.rs:3:5 | LL | v as *const [u8]; //~ ERROR E0607 | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0608.rs b/src/test/ui/error-codes/E0608.rs index d47356a97ee..1e342d6685f 100644 --- a/src/test/ui/error-codes/E0608.rs +++ b/src/test/ui/error-codes/E0608.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { 0u8[2]; //~ ERROR E0608 } diff --git a/src/test/ui/error-codes/E0608.stderr b/src/test/ui/error-codes/E0608.stderr index d5955d1b070..b228b2eddfd 100644 --- a/src/test/ui/error-codes/E0608.stderr +++ b/src/test/ui/error-codes/E0608.stderr @@ -1,5 +1,5 @@ error[E0608]: cannot index into a value of type `u8` - --> $DIR/E0608.rs:12:5 + --> $DIR/E0608.rs:2:5 | LL | 0u8[2]; //~ ERROR E0608 | ^^^^^^ diff --git a/src/test/ui/error-codes/E0609.rs b/src/test/ui/error-codes/E0609.rs index ddfd9d5f21a..e3a97f2fb26 100644 --- a/src/test/ui/error-codes/E0609.rs +++ b/src/test/ui/error-codes/E0609.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: u32, } diff --git a/src/test/ui/error-codes/E0609.stderr b/src/test/ui/error-codes/E0609.stderr index dd793b29feb..b5cf09b2201 100644 --- a/src/test/ui/error-codes/E0609.stderr +++ b/src/test/ui/error-codes/E0609.stderr @@ -1,5 +1,5 @@ error[E0609]: no field `foo` on type `Foo` - --> $DIR/E0609.rs:18:15 + --> $DIR/E0609.rs:8:15 | LL | let _ = x.foo; //~ ERROR E0609 | ^^^ unknown field @@ -7,7 +7,7 @@ LL | let _ = x.foo; //~ ERROR E0609 = note: available fields are: `x` error[E0609]: no field `1` on type `Bar` - --> $DIR/E0609.rs:21:7 + --> $DIR/E0609.rs:11:7 | LL | y.1; //~ ERROR E0609 | ^ unknown field diff --git a/src/test/ui/error-codes/E0610.rs b/src/test/ui/error-codes/E0610.rs index 522d8b0b943..de246f3712e 100644 --- a/src/test/ui/error-codes/E0610.rs +++ b/src/test/ui/error-codes/E0610.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = 0; let _ = x.foo; //~ ERROR E0610 diff --git a/src/test/ui/error-codes/E0610.stderr b/src/test/ui/error-codes/E0610.stderr index 3f1cda3b447..c46b1f2b2d5 100644 --- a/src/test/ui/error-codes/E0610.stderr +++ b/src/test/ui/error-codes/E0610.stderr @@ -1,5 +1,5 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields - --> $DIR/E0610.rs:13:15 + --> $DIR/E0610.rs:3:15 | LL | let _ = x.foo; //~ ERROR E0610 | ^^^ diff --git a/src/test/ui/error-codes/E0614.rs b/src/test/ui/error-codes/E0614.rs index 909f0eb8285..6b4817b692e 100644 --- a/src/test/ui/error-codes/E0614.rs +++ b/src/test/ui/error-codes/E0614.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let y = 0u32; *y; //~ ERROR E0614 diff --git a/src/test/ui/error-codes/E0614.stderr b/src/test/ui/error-codes/E0614.stderr index 571d6e76776..5b1a4a93c4c 100644 --- a/src/test/ui/error-codes/E0614.stderr +++ b/src/test/ui/error-codes/E0614.stderr @@ -1,5 +1,5 @@ error[E0614]: type `u32` cannot be dereferenced - --> $DIR/E0614.rs:13:5 + --> $DIR/E0614.rs:3:5 | LL | *y; //~ ERROR E0614 | ^^ diff --git a/src/test/ui/error-codes/E0615.rs b/src/test/ui/error-codes/E0615.rs index abfa93d2fd0..d04e4d5f7e1 100644 --- a/src/test/ui/error-codes/E0615.rs +++ b/src/test/ui/error-codes/E0615.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: u32, } diff --git a/src/test/ui/error-codes/E0615.stderr b/src/test/ui/error-codes/E0615.stderr index 88317a34ee3..d86ee5b9b4b 100644 --- a/src/test/ui/error-codes/E0615.stderr +++ b/src/test/ui/error-codes/E0615.stderr @@ -1,10 +1,8 @@ error[E0615]: attempted to take value of method `method` on type `Foo` - --> $DIR/E0615.rs:21:7 + --> $DIR/E0615.rs:11:7 | LL | f.method; //~ ERROR E0615 - | ^^^^^^ - | - = help: maybe a `()` to call it is missing? + | ^^^^^^ help: use parentheses to call the method: `method()` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0616.rs b/src/test/ui/error-codes/E0616.rs index 2fd9f94763d..98f87a83bc5 100644 --- a/src/test/ui/error-codes/E0616.rs +++ b/src/test/ui/error-codes/E0616.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { pub struct Foo { x: u32, diff --git a/src/test/ui/error-codes/E0616.stderr b/src/test/ui/error-codes/E0616.stderr index 26525863c0d..f600bfa8cd3 100644 --- a/src/test/ui/error-codes/E0616.stderr +++ b/src/test/ui/error-codes/E0616.stderr @@ -1,5 +1,5 @@ error[E0616]: field `x` of struct `a::Foo` is private - --> $DIR/E0616.rs:23:5 + --> $DIR/E0616.rs:13:5 | LL | f.x; //~ ERROR E0616 | ^^^ diff --git a/src/test/ui/error-codes/E0617.rs b/src/test/ui/error-codes/E0617.rs index 9375fd9cade..9eed1225ab8 100644 --- a/src/test/ui/error-codes/E0617.rs +++ b/src/test/ui/error-codes/E0617.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength extern { diff --git a/src/test/ui/error-codes/E0617.stderr b/src/test/ui/error-codes/E0617.stderr index 114220532c3..486ca1fa92f 100644 --- a/src/test/ui/error-codes/E0617.stderr +++ b/src/test/ui/error-codes/E0617.stderr @@ -1,35 +1,35 @@ error[E0617]: can't pass `f32` to variadic function - --> $DIR/E0617.rs:19:36 + --> $DIR/E0617.rs:9:36 | LL | printf(::std::ptr::null(), 0f32); | ^^^^ help: cast the value to `c_double`: `0f32 as c_double` error[E0617]: can't pass `i8` to variadic function - --> $DIR/E0617.rs:22:36 + --> $DIR/E0617.rs:12:36 | LL | printf(::std::ptr::null(), 0i8); | ^^^ help: cast the value to `c_int`: `0i8 as c_int` error[E0617]: can't pass `i16` to variadic function - --> $DIR/E0617.rs:25:36 + --> $DIR/E0617.rs:15:36 | LL | printf(::std::ptr::null(), 0i16); | ^^^^ help: cast the value to `c_int`: `0i16 as c_int` error[E0617]: can't pass `u8` to variadic function - --> $DIR/E0617.rs:28:36 + --> $DIR/E0617.rs:18:36 | LL | printf(::std::ptr::null(), 0u8); | ^^^ help: cast the value to `c_uint`: `0u8 as c_uint` error[E0617]: can't pass `u16` to variadic function - --> $DIR/E0617.rs:31:36 + --> $DIR/E0617.rs:21:36 | LL | printf(::std::ptr::null(), 0u16); | ^^^^ help: cast the value to `c_uint`: `0u16 as c_uint` error[E0617]: can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function - --> $DIR/E0617.rs:34:36 + --> $DIR/E0617.rs:24:36 | LL | printf(::std::ptr::null(), printf); | ^^^^^^ diff --git a/src/test/ui/error-codes/E0618.rs b/src/test/ui/error-codes/E0618.rs index f46bdb99801..2616e7134c5 100644 --- a/src/test/ui/error-codes/E0618.rs +++ b/src/test/ui/error-codes/E0618.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum X { Entry, } diff --git a/src/test/ui/error-codes/E0618.stderr b/src/test/ui/error-codes/E0618.stderr index 3bcc83e01c1..b691f09ad7a 100644 --- a/src/test/ui/error-codes/E0618.stderr +++ b/src/test/ui/error-codes/E0618.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found enum variant `X::Entry` - --> $DIR/E0618.rs:16:5 + --> $DIR/E0618.rs:6:5 | LL | Entry, | ----- `X::Entry` defined here @@ -14,7 +14,7 @@ LL | X::Entry; | ^^^^^^^^ error[E0618]: expected function, found `i32` - --> $DIR/E0618.rs:19:5 + --> $DIR/E0618.rs:9:5 | LL | let x = 0i32; | - `i32` defined here diff --git a/src/test/ui/error-codes/E0620.rs b/src/test/ui/error-codes/E0620.rs index 5e945dfa5c8..2831413eab0 100644 --- a/src/test/ui/error-codes/E0620.rs +++ b/src/test/ui/error-codes/E0620.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let _foo = &[1_usize, 2] as [usize]; //~ ERROR E0620 } diff --git a/src/test/ui/error-codes/E0620.stderr b/src/test/ui/error-codes/E0620.stderr index f7450a33138..f7319a878c2 100644 --- a/src/test/ui/error-codes/E0620.stderr +++ b/src/test/ui/error-codes/E0620.stderr @@ -1,11 +1,11 @@ error[E0620]: cast to unsized type: `&[usize; 2]` as `[usize]` - --> $DIR/E0620.rs:12:16 + --> $DIR/E0620.rs:2:16 | LL | let _foo = &[1_usize, 2] as [usize]; //~ ERROR E0620 | ^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using an implicit coercion to `&[usize]` instead - --> $DIR/E0620.rs:12:16 + --> $DIR/E0620.rs:2:16 | LL | let _foo = &[1_usize, 2] as [usize]; //~ ERROR E0620 | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.rs b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.rs index 980461bedae..c58744d386c 100644 --- a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.rs +++ b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we give the generic E0495 when one of the free regions is // bound in a closure (rather than suggesting a change to the signature // of the closure, which is not specified in `foo` but rather in `invoke`). diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr index 58f0ede6308..f763c82eff8 100644 --- a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr +++ b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/E0621-does-not-trigger-for-closures.rs:25:5 + --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5 | LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 | ^^^^^^ | -note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 25:16... - --> $DIR/E0621-does-not-trigger-for-closures.rs:25:16 +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 15:16... + --> $DIR/E0621-does-not-trigger-for-closures.rs:15:16 | LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...so that reference does not outlive borrowed content - --> $DIR/E0621-does-not-trigger-for-closures.rs:25:45 + --> $DIR/E0621-does-not-trigger-for-closures.rs:15:45 | LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 | ^ -note: but, the lifetime must be valid for the call at 25:5... - --> $DIR/E0621-does-not-trigger-for-closures.rs:25:5 +note: but, the lifetime must be valid for the call at 15:5... + --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5 | LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...so type `&i32` of expression is valid during the expression - --> $DIR/E0621-does-not-trigger-for-closures.rs:25:5 + --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5 | LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0622.rs b/src/test/ui/error-codes/E0622.rs index f2bde5b0364..ae7378a707e 100644 --- a/src/test/ui/error-codes/E0622.rs +++ b/src/test/ui/error-codes/E0622.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(intrinsics)] extern "rust-intrinsic" { pub static breakpoint : unsafe extern "rust-intrinsic" fn(); diff --git a/src/test/ui/error-codes/E0622.stderr b/src/test/ui/error-codes/E0622.stderr index ef13084dea0..8466dfe3848 100644 --- a/src/test/ui/error-codes/E0622.stderr +++ b/src/test/ui/error-codes/E0622.stderr @@ -1,5 +1,5 @@ error[E0622]: intrinsic must be a function - --> $DIR/E0622.rs:13:5 + --> $DIR/E0622.rs:3:5 | LL | pub static breakpoint : unsafe extern "rust-intrinsic" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected a function diff --git a/src/test/ui/error-codes/E0624.rs b/src/test/ui/error-codes/E0624.rs index 952e0b31c4c..45f72a565ca 100644 --- a/src/test/ui/error-codes/E0624.rs +++ b/src/test/ui/error-codes/E0624.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod inner { pub struct Foo; diff --git a/src/test/ui/error-codes/E0624.stderr b/src/test/ui/error-codes/E0624.stderr index ac911b9b7c0..31a2f607e58 100644 --- a/src/test/ui/error-codes/E0624.stderr +++ b/src/test/ui/error-codes/E0624.stderr @@ -1,5 +1,5 @@ error[E0624]: method `method` is private - --> $DIR/E0624.rs:21:9 + --> $DIR/E0624.rs:11:9 | LL | foo.method(); //~ ERROR method `method` is private [E0624] | ^^^^^^ diff --git a/src/test/ui/error-codes/E0637.rs b/src/test/ui/error-codes/E0637.rs index b4f769a749f..b4888d4af6a 100644 --- a/src/test/ui/error-codes/E0637.rs +++ b/src/test/ui/error-codes/E0637.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'a: '_>(&'a u8); //~ ERROR cannot be used here fn foo<'a: '_>(_: &'a u8) {} //~ ERROR cannot be used here diff --git a/src/test/ui/error-codes/E0637.stderr b/src/test/ui/error-codes/E0637.stderr index 2a4545fc43d..f744520ef6e 100644 --- a/src/test/ui/error-codes/E0637.stderr +++ b/src/test/ui/error-codes/E0637.stderr @@ -1,17 +1,17 @@ error[E0637]: `'_` cannot be used here - --> $DIR/E0637.rs:11:16 + --> $DIR/E0637.rs:1:16 | LL | struct Foo<'a: '_>(&'a u8); //~ ERROR cannot be used here | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/E0637.rs:12:12 + --> $DIR/E0637.rs:2:12 | LL | fn foo<'a: '_>(_: &'a u8) {} //~ ERROR cannot be used here | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/E0637.rs:15:10 + --> $DIR/E0637.rs:5:10 | LL | impl<'a: '_> Bar<'a> { //~ ERROR cannot be used here | ^^ `'_` is a reserved lifetime name diff --git a/src/test/ui/error-codes/E0646.rs b/src/test/ui/error-codes/E0646.rs index 5fc711d9408..bb62428f53f 100644 --- a/src/test/ui/error-codes/E0646.rs +++ b/src/test/ui/error-codes/E0646.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() where (): Copy {} //~ ERROR [E0646] diff --git a/src/test/ui/error-codes/E0646.stderr b/src/test/ui/error-codes/E0646.stderr index 7b2de775a10..502200c1d00 100644 --- a/src/test/ui/error-codes/E0646.stderr +++ b/src/test/ui/error-codes/E0646.stderr @@ -1,5 +1,5 @@ error[E0646]: `main` function is not allowed to have a `where` clause - --> $DIR/E0646.rs:11:17 + --> $DIR/E0646.rs:1:17 | LL | fn main() where (): Copy {} //~ ERROR [E0646] | ^^^^^^^^ `main` cannot have a `where` clause diff --git a/src/test/ui/error-codes/E0647.rs b/src/test/ui/error-codes/E0647.rs index 0a0ffefdf95..fc085511cbc 100644 --- a/src/test/ui/error-codes/E0647.rs +++ b/src/test/ui/error-codes/E0647.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] #![feature(start)] diff --git a/src/test/ui/error-codes/E0647.stderr b/src/test/ui/error-codes/E0647.stderr index afd37a7edf4..da9ba5bf34b 100644 --- a/src/test/ui/error-codes/E0647.stderr +++ b/src/test/ui/error-codes/E0647.stderr @@ -1,5 +1,5 @@ error[E0647]: start function is not allowed to have a `where` clause - --> $DIR/E0647.rs:17:56 + --> $DIR/E0647.rs:7:56 | LL | fn start(_: isize, _: *const *const u8) -> isize where (): Copy { //~ ERROR [E0647] | ^^^^^^^^ start function cannot have a `where` clause diff --git a/src/test/ui/error-codes/E0648.rs b/src/test/ui/error-codes/E0648.rs index d3eac60de99..8408a78c7a6 100644 --- a/src/test/ui/error-codes/E0648.rs +++ b/src/test/ui/error-codes/E0648.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[export_name="\0foo"] //~ ERROR E0648 pub fn bar() {} diff --git a/src/test/ui/error-codes/E0648.stderr b/src/test/ui/error-codes/E0648.stderr index 1e11705e9b9..090157fb0d7 100644 --- a/src/test/ui/error-codes/E0648.stderr +++ b/src/test/ui/error-codes/E0648.stderr @@ -1,5 +1,5 @@ error[E0648]: `export_name` may not contain null characters - --> $DIR/E0648.rs:11:1 + --> $DIR/E0648.rs:1:1 | LL | #[export_name="/0foo"] //~ ERROR E0648 | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-codes/E0657.rs b/src/test/ui/error-codes/E0657.rs index af91c9e2649..cb11de13f73 100644 --- a/src/test/ui/error-codes/E0657.rs +++ b/src/test/ui/error-codes/E0657.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![allow(warnings)] trait Id {} diff --git a/src/test/ui/error-codes/E0657.stderr b/src/test/ui/error-codes/E0657.stderr index 737ae3a163a..df76b45a589 100644 --- a/src/test/ui/error-codes/E0657.stderr +++ b/src/test/ui/error-codes/E0657.stderr @@ -1,11 +1,11 @@ error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level - --> $DIR/E0657.rs:19:31 + --> $DIR/E0657.rs:10:31 | LL | -> Box Id>> | ^^ error[E0657]: `impl Trait` can only capture lifetimes bound at the fn or impl level - --> $DIR/E0657.rs:28:35 + --> $DIR/E0657.rs:19:35 | LL | -> Box Id>> | ^^ diff --git a/src/test/ui/error-codes/E0658.rs b/src/test/ui/error-codes/E0658.rs index dcfa25e528a..9c9b95d70a7 100644 --- a/src/test/ui/error-codes/E0658.rs +++ b/src/test/ui/error-codes/E0658.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[repr(u128)] enum Foo { //~ ERROR E0658 Bar(u64), diff --git a/src/test/ui/error-codes/E0658.stderr b/src/test/ui/error-codes/E0658.stderr index b338b384a11..58802b23db3 100644 --- a/src/test/ui/error-codes/E0658.stderr +++ b/src/test/ui/error-codes/E0658.stderr @@ -1,5 +1,5 @@ error[E0658]: repr with 128-bit type is unstable (see issue #35118) - --> $DIR/E0658.rs:12:1 + --> $DIR/E0658.rs:2:1 | LL | / enum Foo { //~ ERROR E0658 LL | | Bar(u64), diff --git a/src/test/ui/error-codes/E0659.rs b/src/test/ui/error-codes/E0659.rs index 4bd452b0aac..c00026bb7a7 100644 --- a/src/test/ui/error-codes/E0659.rs +++ b/src/test/ui/error-codes/E0659.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod moon { pub fn foo() {} } diff --git a/src/test/ui/error-codes/E0659.stderr b/src/test/ui/error-codes/E0659.stderr index 7bfe159405b..b5aa1b21b09 100644 --- a/src/test/ui/error-codes/E0659.stderr +++ b/src/test/ui/error-codes/E0659.stderr @@ -1,17 +1,17 @@ error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) - --> $DIR/E0659.rs:25:15 + --> $DIR/E0659.rs:15:15 | LL | collider::foo(); //~ ERROR E0659 | ^^^ ambiguous name | note: `foo` could refer to the function imported here - --> $DIR/E0659.rs:20:13 + --> $DIR/E0659.rs:10:13 | LL | pub use moon::*; | ^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate note: `foo` could also refer to the function imported here - --> $DIR/E0659.rs:21:13 + --> $DIR/E0659.rs:11:13 | LL | pub use earth::*; | ^^^^^^^^ diff --git a/src/test/ui/error-codes/E0718.rs b/src/test/ui/error-codes/E0718.rs index ce74e35ac6b..82ab2d4af1b 100644 --- a/src/test/ui/error-codes/E0718.rs +++ b/src/test/ui/error-codes/E0718.rs @@ -1,17 +1,7 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(lang_items)] // Arc is expected to be a struct, so this will error. -#[lang = "arc"] +#[lang = "arc"] //~ ERROR language item must be applied to a struct static X: u32 = 42; fn main() {} diff --git a/src/test/ui/error-codes/E0718.stderr b/src/test/ui/error-codes/E0718.stderr index 8ce721d30a1..4f9734d1acf 100644 --- a/src/test/ui/error-codes/E0718.stderr +++ b/src/test/ui/error-codes/E0718.stderr @@ -1,7 +1,7 @@ error[E0718]: `arc` language item must be applied to a struct - --> $DIR/E0718.rs:14:1 + --> $DIR/E0718.rs:4:1 | -LL | #[lang = "arc"] +LL | #[lang = "arc"] //~ ERROR language item must be applied to a struct | ^^^^^^^^^^^^^^^ attribute should be applied to a struct, not a static item error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0719.rs b/src/test/ui/error-codes/E0719.rs index c7bfa85093f..6b572f49cee 100644 --- a/src/test/ui/error-codes/E0719.rs +++ b/src/test/ui/error-codes/E0719.rs @@ -1,18 +1,10 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo: Iterator {} +//~^ ERROR is already specified type Unit = (); fn test() -> Box> { +//~^ ERROR is already specified Box::new(None.into_iter()) } diff --git a/src/test/ui/error-codes/E0719.stderr b/src/test/ui/error-codes/E0719.stderr index 3a908fceced..209bfbae07f 100644 --- a/src/test/ui/error-codes/E0719.stderr +++ b/src/test/ui/error-codes/E0719.stderr @@ -1,5 +1,5 @@ error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified - --> $DIR/E0719.rs:11:33 + --> $DIR/E0719.rs:1:33 | LL | trait Foo: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -7,7 +7,7 @@ LL | trait Foo: Iterator {} | `Item` bound here first error[E0719]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) is already specified - --> $DIR/E0719.rs:15:38 + --> $DIR/E0719.rs:6:38 | LL | fn test() -> Box> { | --------- ^^^^^^^^^^^ re-bound here diff --git a/src/test/ui/error-codes/ex-E0611.rs b/src/test/ui/error-codes/ex-E0611.rs index 4e580242e64..8460341c44e 100644 --- a/src/test/ui/error-codes/ex-E0611.rs +++ b/src/test/ui/error-codes/ex-E0611.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { pub struct Foo(u32); diff --git a/src/test/ui/error-codes/ex-E0611.stderr b/src/test/ui/error-codes/ex-E0611.stderr index 2f5066542db..f8c7cd8c146 100644 --- a/src/test/ui/error-codes/ex-E0611.stderr +++ b/src/test/ui/error-codes/ex-E0611.stderr @@ -1,5 +1,5 @@ error[E0616]: field `0` of struct `a::Foo` is private - --> $DIR/ex-E0611.rs:21:4 + --> $DIR/ex-E0611.rs:11:4 | LL | y.0; //~ ERROR field `0` of struct `a::Foo` is private | ^^^ diff --git a/src/test/ui/error-codes/ex-E0612.rs b/src/test/ui/error-codes/ex-E0612.rs index 46e26c87e5f..c8ea53ae9d8 100644 --- a/src/test/ui/error-codes/ex-E0612.rs +++ b/src/test/ui/error-codes/ex-E0612.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo(u32); fn main() { diff --git a/src/test/ui/error-codes/ex-E0612.stderr b/src/test/ui/error-codes/ex-E0612.stderr index a07efc939ab..0f498d16439 100644 --- a/src/test/ui/error-codes/ex-E0612.stderr +++ b/src/test/ui/error-codes/ex-E0612.stderr @@ -1,8 +1,8 @@ error[E0609]: no field `1` on type `Foo` - --> $DIR/ex-E0612.rs:15:6 + --> $DIR/ex-E0612.rs:5:6 | LL | y.1; //~ ERROR no field `1` on type `Foo` - | ^ did you mean `0`? + | ^ help: a field with a similar name exists: `0` error: aborting due to previous error diff --git a/src/test/ui/error-festival.rs b/src/test/ui/error-festival.rs index c17e3c878b8..e462824cded 100644 --- a/src/test/ui/error-festival.rs +++ b/src/test/ui/error-festival.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Question { Yes, No, diff --git a/src/test/ui/error-festival.stderr b/src/test/ui/error-festival.stderr index 5f1e677ca67..ff6504e9688 100644 --- a/src/test/ui/error-festival.stderr +++ b/src/test/ui/error-festival.stderr @@ -1,17 +1,17 @@ error[E0425]: cannot find value `y` in this scope - --> $DIR/error-festival.rs:24:5 + --> $DIR/error-festival.rs:14:5 | LL | y = 2; - | ^ did you mean `x`? + | ^ help: a local variable with a similar name exists: `x` error[E0603]: constant `FOO` is private - --> $DIR/error-festival.rs:32:10 + --> $DIR/error-festival.rs:22:10 | LL | foo::FOO; | ^^^ error[E0368]: binary assignment operation `+=` cannot be applied to type `&str` - --> $DIR/error-festival.rs:22:5 + --> $DIR/error-festival.rs:12:5 | LL | x += 2; | -^^^^^ @@ -21,13 +21,13 @@ LL | x += 2; = note: an implementation of `std::ops::AddAssign` might be missing for `&str` error[E0599]: no method named `z` found for type `&str` in the current scope - --> $DIR/error-festival.rs:26:7 + --> $DIR/error-festival.rs:16:7 | LL | x.z(); | ^ error[E0600]: cannot apply unary operator `!` to type `Question` - --> $DIR/error-festival.rs:29:5 + --> $DIR/error-festival.rs:19:5 | LL | !Question::Yes; | ^^^^^^^^^^^^^^ cannot apply unary operator `!` @@ -35,13 +35,13 @@ LL | !Question::Yes; = note: an implementation of `std::ops::Not` might be missing for `Question` error[E0604]: only `u8` can be cast as `char`, not `u32` - --> $DIR/error-festival.rs:35:5 + --> $DIR/error-festival.rs:25:5 | LL | 0u32 as char; | ^^^^^^^^^^^^ error[E0605]: non-primitive cast: `u8` as `std::vec::Vec` - --> $DIR/error-festival.rs:39:5 + --> $DIR/error-festival.rs:29:5 | LL | x as Vec; | ^^^^^^^^^^^^ @@ -49,27 +49,22 @@ LL | x as Vec; = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait error[E0054]: cannot cast as `bool` - --> $DIR/error-festival.rs:43:24 + --> $DIR/error-festival.rs:33:24 | LL | let x_is_nonzero = x as bool; - | ^^^^^^^^^ unsupported cast - | - = help: compare with zero instead + | ^^^^^^^^^ help: compare with zero instead: `x != 0` error[E0606]: casting `&u8` as `u32` is invalid - --> $DIR/error-festival.rs:47:18 - | -LL | let y: u32 = x as u32; - | ^^^^^^^^ cannot cast `&u8` as `u32` - | -help: did you mean `*x`? - --> $DIR/error-festival.rs:47:18 + --> $DIR/error-festival.rs:37:18 | LL | let y: u32 = x as u32; - | ^ + | -^^^^^^^ + | | + | cannot cast `&u8` as `u32` + | help: dereference the expression: `*x` error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]` - --> $DIR/error-festival.rs:51:5 + --> $DIR/error-festival.rs:41:5 | LL | v as *const [u8]; | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/error-should-say-copy-not-pod.rs b/src/test/ui/error-should-say-copy-not-pod.rs index 8b1e2fc1966..be4e451ceb1 100644 --- a/src/test/ui/error-should-say-copy-not-pod.rs +++ b/src/test/ui/error-should-say-copy-not-pod.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that the error message uses the word Copy, not Pod. fn check_bound(_: T) {} diff --git a/src/test/ui/error-should-say-copy-not-pod.stderr b/src/test/ui/error-should-say-copy-not-pod.stderr index 704cd4f4838..d42fea70812 100644 --- a/src/test/ui/error-should-say-copy-not-pod.stderr +++ b/src/test/ui/error-should-say-copy-not-pod.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied - --> $DIR/error-should-say-copy-not-pod.rs:16:5 + --> $DIR/error-should-say-copy-not-pod.rs:6:5 | LL | check_bound("nocopy".to_string()); //~ ERROR : std::marker::Copy` is not satisfied | ^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | note: required by `check_bound` - --> $DIR/error-should-say-copy-not-pod.rs:13:1 + --> $DIR/error-should-say-copy-not-pod.rs:3:1 | LL | fn check_bound(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/estr-subtyping.rs b/src/test/ui/estr-subtyping.rs index b5c6db0cea9..9c5825fff85 100644 --- a/src/test/ui/estr-subtyping.rs +++ b/src/test/ui/estr-subtyping.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn wants_uniq(x: String) { } fn wants_slice(x: &str) { } diff --git a/src/test/ui/estr-subtyping.stderr b/src/test/ui/estr-subtyping.stderr index fcff9d0380e..7a7dce98f2d 100644 --- a/src/test/ui/estr-subtyping.stderr +++ b/src/test/ui/estr-subtyping.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/estr-subtyping.rs:20:15 + --> $DIR/estr-subtyping.rs:10:15 | LL | wants_uniq(x); //~ ERROR mismatched types | ^ diff --git a/src/test/ui/eval-enum.rs b/src/test/ui/eval-enum.rs index f8a87db88b1..cf49b961438 100644 --- a/src/test/ui/eval-enum.rs +++ b/src/test/ui/eval-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Test { DivZero = 1/0, //~^ attempt to divide by zero diff --git a/src/test/ui/eval-enum.stderr b/src/test/ui/eval-enum.stderr index 59c5ec10f6a..195eaddb71b 100644 --- a/src/test/ui/eval-enum.stderr +++ b/src/test/ui/eval-enum.stderr @@ -1,11 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $DIR/eval-enum.rs:12:15 + --> $DIR/eval-enum.rs:2:15 | LL | DivZero = 1/0, | ^^^ attempt to divide by zero error[E0080]: evaluation of constant value failed - --> $DIR/eval-enum.rs:15:15 + --> $DIR/eval-enum.rs:5:15 | LL | RemZero = 1%0, | ^^^ attempt to calculate the remainder with a divisor of zero diff --git a/src/test/ui/exclusive-drop-and-copy.rs b/src/test/ui/exclusive-drop-and-copy.rs index b4cb2469659..7a251671ee9 100644 --- a/src/test/ui/exclusive-drop-and-copy.rs +++ b/src/test/ui/exclusive-drop-and-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // issue #20126 #[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented diff --git a/src/test/ui/exclusive-drop-and-copy.stderr b/src/test/ui/exclusive-drop-and-copy.stderr index 1c5e62e21a8..2fbeaec23a7 100644 --- a/src/test/ui/exclusive-drop-and-copy.stderr +++ b/src/test/ui/exclusive-drop-and-copy.stderr @@ -1,11 +1,11 @@ error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor - --> $DIR/exclusive-drop-and-copy.rs:13:10 + --> $DIR/exclusive-drop-and-copy.rs:3:10 | LL | #[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented | ^^^^ Copy not allowed on types with destructors error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor - --> $DIR/exclusive-drop-and-copy.rs:20:10 + --> $DIR/exclusive-drop-and-copy.rs:10:10 | LL | #[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented | ^^^^ Copy not allowed on types with destructors diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.rs b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.rs index 69e5898ed4d..d95c4b09994 100644 --- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.rs +++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(exclusive_range_pattern)] fn main() { diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr index 6ccf7efbb88..01c7e881756 100644 --- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr +++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr @@ -1,5 +1,5 @@ error: unexpected token: `,` - --> $DIR/exclusive_range_pattern_syntax_collision.rs:15:15 + --> $DIR/exclusive_range_pattern_syntax_collision.rs:5:15 | LL | [_, 99.., _] => {}, //~ ERROR unexpected token: `,` | ^^ diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.rs b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.rs index 9212ea86118..95677e34dd7 100644 --- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.rs +++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(exclusive_range_pattern)] fn main() { diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr index d1863cbfb6f..91109a64566 100644 --- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr +++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr @@ -1,5 +1,5 @@ error: unexpected token: `]` - --> $DIR/exclusive_range_pattern_syntax_collision2.rs:15:15 + --> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:15 | LL | [_, 99..] => {}, //~ ERROR unexpected token: `]` | ^^ diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.rs b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.rs index d83305857ac..3bf5da710ef 100644 --- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.rs +++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(exclusive_range_pattern)] fn main() { diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr index 21b2d0c5c57..9c76a66c265 100644 --- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr +++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr @@ -1,5 +1,5 @@ error: expected one of `,` or `]`, found `9` - --> $DIR/exclusive_range_pattern_syntax_collision3.rs:15:12 + --> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:12 | LL | [..9, 99..100, _] => {}, //~ ERROR expected one of `,` or `]`, found `9` | ^ expected one of `,` or `]` here diff --git a/src/test/ui/exhaustive_integer_patterns.rs b/src/test/ui/exhaustive_integer_patterns.rs index 7825aaa2912..2570bc8a560 100644 --- a/src/test/ui/exhaustive_integer_patterns.rs +++ b/src/test/ui/exhaustive_integer_patterns.rs @@ -1,18 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(exhaustive_integer_patterns)] +#![feature(precise_pointer_size_matching)] #![feature(exclusive_range_pattern)] + #![deny(unreachable_patterns)] -use std::{char, usize, u8, u16, u32, u64, u128, isize, i8, i16, i32, i64, i128}; +use std::{char, u8, u16, u32, u64, u128, i8, i16, i32, i64, i128}; fn main() { let x: u8 = 0; @@ -68,10 +59,6 @@ fn main() { '\u{E000}' ..= '\u{10_FFFF}' => {} } - match 0usize { - 0 ..= usize::MAX => {} // ok - } - match 0u16 { 0 ..= u16::MAX => {} // ok } @@ -88,10 +75,6 @@ fn main() { 0 ..= u128::MAX => {} // ok } - match 0isize { - isize::MIN ..= isize::MAX => {} // ok - } - match 0i8 { -128 ..= 127 => {} // ok } diff --git a/src/test/ui/exhaustive_integer_patterns.stderr b/src/test/ui/exhaustive_integer_patterns.stderr index 44b05a12aeb..7b873f7ba42 100644 --- a/src/test/ui/exhaustive_integer_patterns.stderr +++ b/src/test/ui/exhaustive_integer_patterns.stderr @@ -1,83 +1,83 @@ error: unreachable pattern - --> $DIR/exhaustive_integer_patterns.rs:32:9 + --> $DIR/exhaustive_integer_patterns.rs:23:9 | LL | 200 => {} //~ ERROR unreachable pattern | ^^^ | note: lint level defined here - --> $DIR/exhaustive_integer_patterns.rs:13:9 + --> $DIR/exhaustive_integer_patterns.rs:4:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered - --> $DIR/exhaustive_integer_patterns.rs:37:11 + --> $DIR/exhaustive_integer_patterns.rs:28:11 | LL | match x { //~ ERROR non-exhaustive patterns | ^ pattern `128u8..=255u8` not covered error[E0004]: non-exhaustive patterns: `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered - --> $DIR/exhaustive_integer_patterns.rs:42:11 + --> $DIR/exhaustive_integer_patterns.rs:33:11 | LL | match x { //~ ERROR non-exhaustive patterns | ^ patterns `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered error: unreachable pattern - --> $DIR/exhaustive_integer_patterns.rs:53:9 + --> $DIR/exhaustive_integer_patterns.rs:44:9 | LL | -2..=20 => {} //~ ERROR unreachable pattern | ^^^^^^^ error[E0004]: non-exhaustive patterns: `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered - --> $DIR/exhaustive_integer_patterns.rs:50:11 + --> $DIR/exhaustive_integer_patterns.rs:41:11 | LL | match x { //~ ERROR non-exhaustive patterns | ^ patterns `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered error[E0004]: non-exhaustive patterns: `-128i8` not covered - --> $DIR/exhaustive_integer_patterns.rs:99:11 + --> $DIR/exhaustive_integer_patterns.rs:82:11 | LL | match 0i8 { //~ ERROR non-exhaustive patterns | ^^^ pattern `-128i8` not covered error[E0004]: non-exhaustive patterns: `0i16` not covered - --> $DIR/exhaustive_integer_patterns.rs:107:11 + --> $DIR/exhaustive_integer_patterns.rs:90:11 | LL | match 0i16 { //~ ERROR non-exhaustive patterns | ^^^^ pattern `0i16` not covered error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered - --> $DIR/exhaustive_integer_patterns.rs:125:11 + --> $DIR/exhaustive_integer_patterns.rs:108:11 | LL | match 0u8 { //~ ERROR non-exhaustive patterns | ^^^ pattern `128u8..=255u8` not covered error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered - --> $DIR/exhaustive_integer_patterns.rs:137:11 + --> $DIR/exhaustive_integer_patterns.rs:120:11 | LL | match (0u8, Some(())) { //~ ERROR non-exhaustive patterns | ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered error[E0004]: non-exhaustive patterns: `(126u8..=127u8, false)` not covered - --> $DIR/exhaustive_integer_patterns.rs:142:11 + --> $DIR/exhaustive_integer_patterns.rs:125:11 | LL | match (0u8, true) { //~ ERROR non-exhaustive patterns | ^^^^^^^^^^^ pattern `(126u8..=127u8, false)` not covered error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211455u128` not covered - --> $DIR/exhaustive_integer_patterns.rs:162:11 + --> $DIR/exhaustive_integer_patterns.rs:145:11 | LL | match 0u128 { //~ ERROR non-exhaustive patterns | ^^^^^ pattern `340282366920938463463374607431768211455u128` not covered error[E0004]: non-exhaustive patterns: `5u128..=340282366920938463463374607431768211455u128` not covered - --> $DIR/exhaustive_integer_patterns.rs:166:11 + --> $DIR/exhaustive_integer_patterns.rs:149:11 | LL | match 0u128 { //~ ERROR non-exhaustive patterns | ^^^^^ pattern `5u128..=340282366920938463463374607431768211455u128` not covered error[E0004]: non-exhaustive patterns: `0u128..=3u128` not covered - --> $DIR/exhaustive_integer_patterns.rs:170:11 + --> $DIR/exhaustive_integer_patterns.rs:153:11 | LL | match 0u128 { //~ ERROR non-exhaustive patterns | ^^^^^ pattern `0u128..=3u128` not covered diff --git a/src/test/ui/existential_types/auxiliary/cross_crate_ice.rs b/src/test/ui/existential_types/auxiliary/cross_crate_ice.rs new file mode 100644 index 00000000000..af2d209826e --- /dev/null +++ b/src/test/ui/existential_types/auxiliary/cross_crate_ice.rs @@ -0,0 +1,12 @@ +// Crate that exports an existential type. Used for testing cross-crate. + +#![crate_type="rlib"] + +#![feature(existential_type)] + +pub existential type Foo: std::fmt::Debug; + +pub fn foo() -> Foo { + 5 +} + diff --git a/src/test/ui/existential_types/auxiliary/cross_crate_ice2.rs b/src/test/ui/existential_types/auxiliary/cross_crate_ice2.rs new file mode 100644 index 00000000000..39ec5394feb --- /dev/null +++ b/src/test/ui/existential_types/auxiliary/cross_crate_ice2.rs @@ -0,0 +1,21 @@ +// Crate that exports an existential type. Used for testing cross-crate. + +#![crate_type="rlib"] + +#![feature(existential_type)] + +pub trait View { + type Tmp: Iterator; + + fn test(&self) -> Self::Tmp; +} + +pub struct X; + +impl View for X { + existential type Tmp: Iterator; + + fn test(&self) -> Self::Tmp { + vec![1,2,3].into_iter() + } +} diff --git a/src/test/ui/existential_types/bound_reduction.rs b/src/test/ui/existential_types/bound_reduction.rs index 2e42c92ab30..c1c0c60d59e 100644 --- a/src/test/ui/existential_types/bound_reduction.rs +++ b/src/test/ui/existential_types/bound_reduction.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(warnings)] diff --git a/src/test/ui/existential_types/bound_reduction2.rs b/src/test/ui/existential_types/bound_reduction2.rs index d098a4ef4c8..d8ade50c79c 100644 --- a/src/test/ui/existential_types/bound_reduction2.rs +++ b/src/test/ui/existential_types/bound_reduction2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(existential_type)] fn main() { diff --git a/src/test/ui/existential_types/bound_reduction2.stderr b/src/test/ui/existential_types/bound_reduction2.stderr index 33b8b71bffb..8e822ca6d8b 100644 --- a/src/test/ui/existential_types/bound_reduction2.stderr +++ b/src/test/ui/existential_types/bound_reduction2.stderr @@ -1,5 +1,5 @@ error: non-defining existential type use in defining scope - --> $DIR/bound_reduction2.rs:26:1 + --> $DIR/bound_reduction2.rs:16:1 | LL | / fn foo_desugared(_: T) -> Foo { //~ ERROR non-defining LL | | () @@ -7,7 +7,7 @@ LL | | } | |_^ | note: used non-generic type ::Assoc for generic parameter - --> $DIR/bound_reduction2.rs:20:22 + --> $DIR/bound_reduction2.rs:10:22 | LL | existential type Foo: Trait; | ^ diff --git a/src/test/ui/existential_types/cross_crate_ice.rs b/src/test/ui/existential_types/cross_crate_ice.rs new file mode 100644 index 00000000000..c5d5ca916a4 --- /dev/null +++ b/src/test/ui/existential_types/cross_crate_ice.rs @@ -0,0 +1,16 @@ +// aux-build:cross_crate_ice.rs +// compile-pass + +extern crate cross_crate_ice; + +struct Bar(cross_crate_ice::Foo); + +impl Bar { + fn zero(&self) -> &cross_crate_ice::Foo { + &self.0 + } +} + +fn main() { + let _ = cross_crate_ice::foo(); +} diff --git a/src/test/ui/existential_types/cross_crate_ice2.rs b/src/test/ui/existential_types/cross_crate_ice2.rs new file mode 100644 index 00000000000..a0f3933ce33 --- /dev/null +++ b/src/test/ui/existential_types/cross_crate_ice2.rs @@ -0,0 +1,11 @@ +// aux-build:cross_crate_ice2.rs +// compile-pass + +extern crate cross_crate_ice2; + +use cross_crate_ice2::View; + +fn main() { + let v = cross_crate_ice2::X; + v.test(); +} diff --git a/src/test/ui/existential_types/declared_but_never_defined.rs b/src/test/ui/existential_types/declared_but_never_defined.rs index c0f08fe057f..ff253391f2a 100644 --- a/src/test/ui/existential_types/declared_but_never_defined.rs +++ b/src/test/ui/existential_types/declared_but_never_defined.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/declared_but_never_defined.stderr b/src/test/ui/existential_types/declared_but_never_defined.stderr index 29ae10c1c48..681b1cf0fa7 100644 --- a/src/test/ui/existential_types/declared_but_never_defined.stderr +++ b/src/test/ui/existential_types/declared_but_never_defined.stderr @@ -1,5 +1,5 @@ error: could not find defining uses - --> $DIR/declared_but_never_defined.rs:17:1 + --> $DIR/declared_but_never_defined.rs:6:1 | LL | existential type Bar: std::fmt::Debug; //~ ERROR could not find defining uses | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/existential_types/declared_but_not_defined_in_scope.rs b/src/test/ui/existential_types/declared_but_not_defined_in_scope.rs index 6d0a9b80a3f..a6311ee964d 100644 --- a/src/test/ui/existential_types/declared_but_not_defined_in_scope.rs +++ b/src/test/ui/existential_types/declared_but_not_defined_in_scope.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/declared_but_not_defined_in_scope.stderr b/src/test/ui/existential_types/declared_but_not_defined_in_scope.stderr index fcd8e2a7f84..e9cc92d78ea 100644 --- a/src/test/ui/existential_types/declared_but_not_defined_in_scope.stderr +++ b/src/test/ui/existential_types/declared_but_not_defined_in_scope.stderr @@ -1,5 +1,5 @@ error: could not find defining uses - --> $DIR/declared_but_not_defined_in_scope.rs:18:5 + --> $DIR/declared_but_not_defined_in_scope.rs:7:5 | LL | pub existential type Boo: ::std::fmt::Debug; //~ ERROR could not find defining uses | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/existential_types/different_defining_uses.rs b/src/test/ui/existential_types/different_defining_uses.rs index c58ca3f6210..c51fca75a24 100644 --- a/src/test/ui/existential_types/different_defining_uses.rs +++ b/src/test/ui/existential_types/different_defining_uses.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/different_defining_uses.stderr b/src/test/ui/existential_types/different_defining_uses.stderr index 63177e8a123..f782a002297 100644 --- a/src/test/ui/existential_types/different_defining_uses.stderr +++ b/src/test/ui/existential_types/different_defining_uses.stderr @@ -1,5 +1,5 @@ error: defining existential type use differs from previous - --> $DIR/different_defining_uses.rs:23:1 + --> $DIR/different_defining_uses.rs:12:1 | LL | / fn bar() -> Foo { //~ ERROR defining existential type use differs from previous LL | | 42i32 @@ -7,7 +7,7 @@ LL | | } | |_^ | note: previous use here - --> $DIR/different_defining_uses.rs:19:1 + --> $DIR/different_defining_uses.rs:8:1 | LL | / fn foo() -> Foo { LL | | "" diff --git a/src/test/ui/existential_types/different_defining_uses_never_type.rs b/src/test/ui/existential_types/different_defining_uses_never_type.rs index 5bf46ef91bf..c6c6ae8d2dc 100644 --- a/src/test/ui/existential_types/different_defining_uses_never_type.rs +++ b/src/test/ui/existential_types/different_defining_uses_never_type.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/different_defining_uses_never_type.stderr b/src/test/ui/existential_types/different_defining_uses_never_type.stderr index f0e9f505f6e..04b0cf27784 100644 --- a/src/test/ui/existential_types/different_defining_uses_never_type.stderr +++ b/src/test/ui/existential_types/different_defining_uses_never_type.stderr @@ -1,5 +1,5 @@ error: defining existential type use differs from previous - --> $DIR/different_defining_uses_never_type.rs:23:1 + --> $DIR/different_defining_uses_never_type.rs:12:1 | LL | / fn bar() -> Foo { //~ ERROR defining existential type use differs from previous LL | | panic!() @@ -7,7 +7,7 @@ LL | | } | |_^ | note: previous use here - --> $DIR/different_defining_uses_never_type.rs:19:1 + --> $DIR/different_defining_uses_never_type.rs:8:1 | LL | / fn foo() -> Foo { LL | | "" @@ -15,7 +15,7 @@ LL | | } | |_^ error: defining existential type use differs from previous - --> $DIR/different_defining_uses_never_type.rs:27:1 + --> $DIR/different_defining_uses_never_type.rs:16:1 | LL | / fn boo() -> Foo { //~ ERROR defining existential type use differs from previous LL | | loop {} @@ -23,7 +23,7 @@ LL | | } | |_^ | note: previous use here - --> $DIR/different_defining_uses_never_type.rs:19:1 + --> $DIR/different_defining_uses_never_type.rs:8:1 | LL | / fn foo() -> Foo { LL | | "" diff --git a/src/test/ui/existential_types/different_defining_uses_never_type2.rs b/src/test/ui/existential_types/different_defining_uses_never_type2.rs index 0e40221d829..2953f1745ee 100644 --- a/src/test/ui/existential_types/different_defining_uses_never_type2.rs +++ b/src/test/ui/existential_types/different_defining_uses_never_type2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(existential_type)] diff --git a/src/test/ui/existential_types/existential-associated-type.rs b/src/test/ui/existential_types/existential-associated-type.rs index af393febfbc..299ae91b843 100644 --- a/src/test/ui/existential_types/existential-associated-type.rs +++ b/src/test/ui/existential_types/existential-associated-type.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(existential_type)] // compile-pass diff --git a/src/test/ui/existential_types/generic_different_defining_uses.rs b/src/test/ui/existential_types/generic_different_defining_uses.rs index 109f1cd9132..3bd104251fb 100644 --- a/src/test/ui/existential_types/generic_different_defining_uses.rs +++ b/src/test/ui/existential_types/generic_different_defining_uses.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/generic_different_defining_uses.stderr b/src/test/ui/existential_types/generic_different_defining_uses.stderr index bc71af4c9af..234bcf232ae 100644 --- a/src/test/ui/existential_types/generic_different_defining_uses.stderr +++ b/src/test/ui/existential_types/generic_different_defining_uses.stderr @@ -1,5 +1,5 @@ error: defining existential type use differs from previous - --> $DIR/generic_different_defining_uses.rs:22:1 + --> $DIR/generic_different_defining_uses.rs:11:1 | LL | / fn my_iter2(t: T) -> MyIter { //~ ERROR defining existential type use differs from previous LL | | Some(t).into_iter() @@ -7,7 +7,7 @@ LL | | } | |_^ | note: previous use here - --> $DIR/generic_different_defining_uses.rs:18:1 + --> $DIR/generic_different_defining_uses.rs:7:1 | LL | / fn my_iter(t: T) -> MyIter { LL | | std::iter::once(t) diff --git a/src/test/ui/existential_types/generic_duplicate_lifetime_param.rs b/src/test/ui/existential_types/generic_duplicate_lifetime_param.rs index 92b234aa6dc..e9943beddbf 100644 --- a/src/test/ui/existential_types/generic_duplicate_lifetime_param.rs +++ b/src/test/ui/existential_types/generic_duplicate_lifetime_param.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/generic_duplicate_lifetime_param.stderr b/src/test/ui/existential_types/generic_duplicate_lifetime_param.stderr index 0316832a1af..7b09d3ceab0 100644 --- a/src/test/ui/existential_types/generic_duplicate_lifetime_param.stderr +++ b/src/test/ui/existential_types/generic_duplicate_lifetime_param.stderr @@ -1,5 +1,5 @@ error: non-defining existential type use in defining scope - --> $DIR/generic_duplicate_lifetime_param.rs:18:1 + --> $DIR/generic_duplicate_lifetime_param.rs:7:1 | LL | / fn one<'a>(t: &'a ()) -> Two<'a, 'a> { //~ ERROR non-defining existential type use LL | | t @@ -7,7 +7,7 @@ LL | | } | |_^ | note: lifetime used multiple times - --> $DIR/generic_duplicate_lifetime_param.rs:16:22 + --> $DIR/generic_duplicate_lifetime_param.rs:5:22 | LL | existential type Two<'a, 'b>: std::fmt::Debug; | ^^ ^^ diff --git a/src/test/ui/existential_types/generic_duplicate_param_use.rs b/src/test/ui/existential_types/generic_duplicate_param_use.rs index 52e36fa9b61..380fbdeb8c2 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use.rs +++ b/src/test/ui/existential_types/generic_duplicate_param_use.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/generic_duplicate_param_use.stderr b/src/test/ui/existential_types/generic_duplicate_param_use.stderr index e4a92dba58f..66706c21054 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use.stderr @@ -1,5 +1,5 @@ error[E0091]: type parameter `U` is unused - --> $DIR/generic_duplicate_param_use.rs:16:25 + --> $DIR/generic_duplicate_param_use.rs:5:25 | LL | existential type Two: 'static; //~ ERROR type parameter `U` is unused | ^ unused type parameter diff --git a/src/test/ui/existential_types/generic_lifetime_param.rs b/src/test/ui/existential_types/generic_lifetime_param.rs index 3bdb69eec7f..a8bb0229f0e 100644 --- a/src/test/ui/existential_types/generic_lifetime_param.rs +++ b/src/test/ui/existential_types/generic_lifetime_param.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(existential_type)] diff --git a/src/test/ui/existential_types/generic_nondefining_use.rs b/src/test/ui/existential_types/generic_nondefining_use.rs index a4b74d6751b..caa8f0f2ee1 100644 --- a/src/test/ui/existential_types/generic_nondefining_use.rs +++ b/src/test/ui/existential_types/generic_nondefining_use.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/generic_nondefining_use.stderr b/src/test/ui/existential_types/generic_nondefining_use.stderr index 3c826708649..41877791e9a 100644 --- a/src/test/ui/existential_types/generic_nondefining_use.stderr +++ b/src/test/ui/existential_types/generic_nondefining_use.stderr @@ -1,5 +1,5 @@ error: non-defining existential type use in defining scope - --> $DIR/generic_nondefining_use.rs:19:1 + --> $DIR/generic_nondefining_use.rs:8:1 | LL | / fn cmp() -> Cmp { //~ ERROR non-defining existential type use in defining scope LL | | 5u32 @@ -7,7 +7,7 @@ LL | | } | |_^ | note: used non-generic type u32 for generic parameter - --> $DIR/generic_nondefining_use.rs:16:22 + --> $DIR/generic_nondefining_use.rs:5:22 | LL | existential type Cmp: 'static; | ^ diff --git a/src/test/ui/existential_types/generic_not_used.rs b/src/test/ui/existential_types/generic_not_used.rs index b090cf26b87..bfe7b8c4a1d 100644 --- a/src/test/ui/existential_types/generic_not_used.rs +++ b/src/test/ui/existential_types/generic_not_used.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/generic_not_used.stderr b/src/test/ui/existential_types/generic_not_used.stderr index 34d82c0ddb0..b22cffeea28 100644 --- a/src/test/ui/existential_types/generic_not_used.stderr +++ b/src/test/ui/existential_types/generic_not_used.stderr @@ -1,5 +1,5 @@ error: type parameter `V` is part of concrete type but not used in parameter list for existential type - --> $DIR/generic_not_used.rs:18:73 + --> $DIR/generic_not_used.rs:7:73 | LL | fn wrong_generic(_: U, v: V) -> WrongGeneric { | _________________________________________________________________________^ diff --git a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.rs b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.rs index 440fc2d1284..02bb151ccb6 100644 --- a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.rs +++ b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(existential_type)] fn main() { diff --git a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr index f1773b7c2fc..d9bb37328bd 100644 --- a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr +++ b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/generic_type_does_not_live_long_enough.rs:16:18 + --> $DIR/generic_type_does_not_live_long_enough.rs:6:18 | LL | let z: i32 = x; //~ ERROR mismatched types | ^ expected i32, found opaque type @@ -8,7 +8,7 @@ LL | let z: i32 = x; //~ ERROR mismatched types found type `WrongGeneric::<&{integer}>` error[E0310]: the parameter type `T` may not live long enough - --> $DIR/generic_type_does_not_live_long_enough.rs:19:1 + --> $DIR/generic_type_does_not_live_long_enough.rs:9:1 | LL | existential type WrongGeneric: 'static; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | fn wrong_generic(t: T) -> WrongGeneric { | - help: consider adding an explicit lifetime bound `T: 'static`... | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/generic_type_does_not_live_long_enough.rs:19:1 + --> $DIR/generic_type_does_not_live_long_enough.rs:9:1 | LL | existential type WrongGeneric: 'static; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/existential_types/generic_underconstrained.rs b/src/test/ui/existential_types/generic_underconstrained.rs index fdc7a7935a2..967faca067c 100644 --- a/src/test/ui/existential_types/generic_underconstrained.rs +++ b/src/test/ui/existential_types/generic_underconstrained.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/generic_underconstrained.stderr b/src/test/ui/existential_types/generic_underconstrained.stderr index 1454ba575b1..57924e0ce21 100644 --- a/src/test/ui/existential_types/generic_underconstrained.stderr +++ b/src/test/ui/existential_types/generic_underconstrained.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `T: Trait` is not satisfied - --> $DIR/generic_underconstrained.rs:17:1 + --> $DIR/generic_underconstrained.rs:6:1 | LL | existential type Underconstrained: 'static; //~ ERROR the trait bound `T: Trait` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` diff --git a/src/test/ui/existential_types/generic_underconstrained2.rs b/src/test/ui/existential_types/generic_underconstrained2.rs index bffb6b5ee10..98d9da832cf 100644 --- a/src/test/ui/existential_types/generic_underconstrained2.rs +++ b/src/test/ui/existential_types/generic_underconstrained2.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/generic_underconstrained2.stderr b/src/test/ui/existential_types/generic_underconstrained2.stderr index 78e79e7fc86..c7b6d6ade55 100644 --- a/src/test/ui/existential_types/generic_underconstrained2.stderr +++ b/src/test/ui/existential_types/generic_underconstrained2.stderr @@ -1,5 +1,5 @@ error[E0277]: `U` doesn't implement `std::fmt::Debug` - --> $DIR/generic_underconstrained2.rs:16:1 + --> $DIR/generic_underconstrained2.rs:5:1 | LL | existential type Underconstrained: 'static; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` @@ -9,7 +9,7 @@ LL | existential type Underconstrained: 'static; = note: the return type of a function must have a statically known size error[E0277]: `V` doesn't implement `std::fmt::Debug` - --> $DIR/generic_underconstrained2.rs:24:1 + --> $DIR/generic_underconstrained2.rs:13:1 | LL | existential type Underconstrained2: 'static; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` diff --git a/src/test/ui/existential_types/nested_existential_types.rs b/src/test/ui/existential_types/nested_existential_types.rs index aac72c71d03..62a47799914 100644 --- a/src/test/ui/existential_types/nested_existential_types.rs +++ b/src/test/ui/existential_types/nested_existential_types.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(existential_type)] // compile-pass mod my_mod { diff --git a/src/test/ui/existential_types/never_reveal_concrete_type.rs b/src/test/ui/existential_types/never_reveal_concrete_type.rs index 4517eca60ed..04da394848e 100644 --- a/src/test/ui/existential_types/never_reveal_concrete_type.rs +++ b/src/test/ui/existential_types/never_reveal_concrete_type.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/never_reveal_concrete_type.stderr b/src/test/ui/existential_types/never_reveal_concrete_type.stderr index ab937a9483c..33a71fc4356 100644 --- a/src/test/ui/existential_types/never_reveal_concrete_type.stderr +++ b/src/test/ui/existential_types/never_reveal_concrete_type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/never_reveal_concrete_type.rs:24:27 + --> $DIR/never_reveal_concrete_type.rs:13:27 | LL | let _: &'static str = x; //~ mismatched types | ^ expected reference, found opaque type @@ -8,7 +8,7 @@ LL | let _: &'static str = x; //~ mismatched types found type `NoReveal` error[E0605]: non-primitive cast: `NoReveal` as `&'static str` - --> $DIR/never_reveal_concrete_type.rs:25:13 + --> $DIR/never_reveal_concrete_type.rs:14:13 | LL | let _ = x as &'static str; //~ non-primitive cast | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/existential_types/no_inferrable_concrete_type.rs b/src/test/ui/existential_types/no_inferrable_concrete_type.rs index d2365035619..6bbe8bdc0cd 100644 --- a/src/test/ui/existential_types/no_inferrable_concrete_type.rs +++ b/src/test/ui/existential_types/no_inferrable_concrete_type.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 52985: Cause cycle error if user code provides no use case that allows an existential type // to be inferred to a concrete type. This results in an infinite cycle during type normalization. diff --git a/src/test/ui/existential_types/no_inferrable_concrete_type.stderr b/src/test/ui/existential_types/no_inferrable_concrete_type.stderr index 06e40fd6ab5..fab61bd9ed0 100644 --- a/src/test/ui/existential_types/no_inferrable_concrete_type.stderr +++ b/src/test/ui/existential_types/no_inferrable_concrete_type.stderr @@ -1,15 +1,26 @@ error[E0391]: cycle detected when processing `Foo` - --> $DIR/no_inferrable_concrete_type.rs:16:1 + --> $DIR/no_inferrable_concrete_type.rs:6:1 | LL | existential type Foo: Copy; //~ cycle detected | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...which requires processing `bar`... - --> $DIR/no_inferrable_concrete_type.rs:19:23 + --> $DIR/no_inferrable_concrete_type.rs:9:23 | LL | fn bar(x: Foo) -> Foo { x } | ^^^^^ = note: ...which again requires processing `Foo`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/no_inferrable_concrete_type.rs:4:1 + | +LL | / #![feature(existential_type)] +LL | | +LL | | existential type Foo: Copy; //~ cycle detected +LL | | +... | +LL | | let _: Foo = std::mem::transmute(0u8); +LL | | } + | |_^ error: aborting due to previous error diff --git a/src/test/ui/existential_types/no_revealing_outside_defining_module.rs b/src/test/ui/existential_types/no_revealing_outside_defining_module.rs index f646891b3b4..142f2f6d751 100644 --- a/src/test/ui/existential_types/no_revealing_outside_defining_module.rs +++ b/src/test/ui/existential_types/no_revealing_outside_defining_module.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![feature(existential_type)] fn main() {} diff --git a/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr b/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr index 3f03174a491..4ffce58f8de 100644 --- a/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr +++ b/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/no_revealing_outside_defining_module.rs:26:19 + --> $DIR/no_revealing_outside_defining_module.rs:15:19 | LL | let _: &str = bomp(); //~ ERROR mismatched types | ^^^^^^ expected &str, found opaque type @@ -8,7 +8,7 @@ LL | let _: &str = bomp(); //~ ERROR mismatched types found type `Boo` error[E0308]: mismatched types - --> $DIR/no_revealing_outside_defining_module.rs:30:5 + --> $DIR/no_revealing_outside_defining_module.rs:19:5 | LL | fn bomp() -> boo::Boo { | -------- expected `Boo` because of return type diff --git a/src/test/ui/existential_types/not_well_formed.rs b/src/test/ui/existential_types/not_well_formed.rs index b3d38aee8c5..073fa90cb35 100644 --- a/src/test/ui/existential_types/not_well_formed.rs +++ b/src/test/ui/existential_types/not_well_formed.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(existential_type)] fn main() { diff --git a/src/test/ui/existential_types/not_well_formed.stderr b/src/test/ui/existential_types/not_well_formed.stderr index 6b7d1be98a7..17ea57805d2 100644 --- a/src/test/ui/existential_types/not_well_formed.stderr +++ b/src/test/ui/existential_types/not_well_formed.stderr @@ -1,5 +1,5 @@ error[E0220]: associated type `Assoc` not found for `V` - --> $DIR/not_well_formed.rs:20:32 + --> $DIR/not_well_formed.rs:10:32 | LL | existential type Foo: Trait; //~ associated type `Assoc` not found for `V` | ^^^^^^^^ associated type `Assoc` not found diff --git a/src/test/ui/existential_types/private_unused.rs b/src/test/ui/existential_types/private_unused.rs new file mode 100644 index 00000000000..736d812bc0a --- /dev/null +++ b/src/test/ui/existential_types/private_unused.rs @@ -0,0 +1,13 @@ +// compile-pass + +#[deny(warnings)] + +enum Empty { } +trait Bar {} +impl Bar for () {} + +fn boo() -> impl Bar {} + +fn main() { + boo(); +} diff --git a/src/test/ui/existential_types/unused_generic_param.rs b/src/test/ui/existential_types/unused_generic_param.rs index 420ce89cc37..bd7b343b402 100644 --- a/src/test/ui/existential_types/unused_generic_param.rs +++ b/src/test/ui/existential_types/unused_generic_param.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(existential_type)] fn main() { diff --git a/src/test/ui/existential_types/unused_generic_param.stderr b/src/test/ui/existential_types/unused_generic_param.stderr index 7ad5eab0b0a..348aed3c439 100644 --- a/src/test/ui/existential_types/unused_generic_param.stderr +++ b/src/test/ui/existential_types/unused_generic_param.stderr @@ -1,11 +1,11 @@ error[E0091]: type parameter `T` is unused - --> $DIR/unused_generic_param.rs:16:35 + --> $DIR/unused_generic_param.rs:6:35 | LL | existential type PartiallyDefined: 'static; //~ `T` is unused | ^ unused type parameter error[E0091]: type parameter `T` is unused - --> $DIR/unused_generic_param.rs:22:36 + --> $DIR/unused_generic_param.rs:12:36 | LL | existential type PartiallyDefined2: 'static; //~ `T` is unused | ^ unused type parameter diff --git a/src/test/ui/expanded-cfg.rs b/src/test/ui/expanded-cfg.rs index 9fd9f7b85af..fbae093f2ac 100644 --- a/src/test/ui/expanded-cfg.rs +++ b/src/test/ui/expanded-cfg.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // skip-codegen // compile-pass #![feature(custom_attribute)] diff --git a/src/test/ui/explain.rs b/src/test/ui/explain.rs index 88fc3f7f017..3622ba77645 100644 --- a/src/test/ui/explain.rs +++ b/src/test/ui/explain.rs @@ -1,12 +1,2 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --explain E0591 // compile-pass diff --git a/src/test/ui/explicit/explicit-call-to-dtor.rs b/src/test/ui/explicit/explicit-call-to-dtor.rs index 90030488dd6..a6f9acc37a1 100644 --- a/src/test/ui/explicit/explicit-call-to-dtor.rs +++ b/src/test/ui/explicit/explicit-call-to-dtor.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: isize } diff --git a/src/test/ui/explicit/explicit-call-to-dtor.stderr b/src/test/ui/explicit/explicit-call-to-dtor.stderr index 264d820042b..db09b23bf26 100644 --- a/src/test/ui/explicit/explicit-call-to-dtor.stderr +++ b/src/test/ui/explicit/explicit-call-to-dtor.stderr @@ -1,5 +1,5 @@ error[E0040]: explicit use of destructor method - --> $DIR/explicit-call-to-dtor.rs:23:7 + --> $DIR/explicit-call-to-dtor.rs:13:7 | LL | x.drop(); //~ ERROR explicit use of destructor method | ^^^^ explicit destructor calls not allowed diff --git a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.rs b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.rs index 63ed74dfa49..ff56b9a8ae4 100644 --- a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.rs +++ b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: isize } diff --git a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr index 0d0ae629def..dfd122b3ea4 100644 --- a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr +++ b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr @@ -1,5 +1,5 @@ error[E0040]: explicit use of destructor method - --> $DIR/explicit-call-to-supertrait-dtor.rs:27:14 + --> $DIR/explicit-call-to-supertrait-dtor.rs:17:14 | LL | self.drop(); //~ ERROR explicit use of destructor method | ^^^^ explicit destructor calls not allowed diff --git a/src/test/ui/explicit/explicit-self-lifetime-mismatch.rs b/src/test/ui/explicit/explicit-self-lifetime-mismatch.rs index eac134ff3cc..82c64bcf6a7 100644 --- a/src/test/ui/explicit/explicit-self-lifetime-mismatch.rs +++ b/src/test/ui/explicit/explicit-self-lifetime-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'a,'b> { x: &'a isize, y: &'b isize, diff --git a/src/test/ui/explicit/explicit-self-lifetime-mismatch.stderr b/src/test/ui/explicit/explicit-self-lifetime-mismatch.stderr index 6a22d20467b..e6f9eded9a4 100644 --- a/src/test/ui/explicit/explicit-self-lifetime-mismatch.stderr +++ b/src/test/ui/explicit/explicit-self-lifetime-mismatch.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched method receiver - --> $DIR/explicit-self-lifetime-mismatch.rs:18:12 + --> $DIR/explicit-self-lifetime-mismatch.rs:8:12 | LL | Foo<'b,'a> | ^^^^^^^^^^ lifetime mismatch | = note: expected type `Foo<'a, 'b>` found type `Foo<'b, 'a>` -note: the lifetime 'b as defined on the impl at 16:9... - --> $DIR/explicit-self-lifetime-mismatch.rs:16:9 +note: the lifetime 'b as defined on the impl at 6:9... + --> $DIR/explicit-self-lifetime-mismatch.rs:6:9 | LL | impl<'a,'b> Foo<'a,'b> { | ^^ -note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 16:6 - --> $DIR/explicit-self-lifetime-mismatch.rs:16:6 +note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 6:6 + --> $DIR/explicit-self-lifetime-mismatch.rs:6:6 | LL | impl<'a,'b> Foo<'a,'b> { | ^^ error[E0308]: mismatched method receiver - --> $DIR/explicit-self-lifetime-mismatch.rs:18:12 + --> $DIR/explicit-self-lifetime-mismatch.rs:8:12 | LL | Foo<'b,'a> | ^^^^^^^^^^ lifetime mismatch | = note: expected type `Foo<'a, 'b>` found type `Foo<'b, 'a>` -note: the lifetime 'a as defined on the impl at 16:6... - --> $DIR/explicit-self-lifetime-mismatch.rs:16:6 +note: the lifetime 'a as defined on the impl at 6:6... + --> $DIR/explicit-self-lifetime-mismatch.rs:6:6 | LL | impl<'a,'b> Foo<'a,'b> { | ^^ -note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 16:9 - --> $DIR/explicit-self-lifetime-mismatch.rs:16:9 +note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 6:9 + --> $DIR/explicit-self-lifetime-mismatch.rs:6:9 | LL | impl<'a,'b> Foo<'a,'b> { | ^^ diff --git a/src/test/compile-fail-fulldeps/explore-issue-38412.rs b/src/test/ui/explore-issue-38412.rs similarity index 83% rename from src/test/compile-fail-fulldeps/explore-issue-38412.rs rename to src/test/ui/explore-issue-38412.rs index 4b9a5b71618..cd0a69b0d8b 100644 --- a/src/test/compile-fail-fulldeps/explore-issue-38412.rs +++ b/src/test/ui/explore-issue-38412.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:pub_and_stability.rs #![feature(unused_feature)] diff --git a/src/test/ui/explore-issue-38412.stderr b/src/test/ui/explore-issue-38412.stderr new file mode 100644 index 00000000000..e3ce6c1317f --- /dev/null +++ b/src/test/ui/explore-issue-38412.stderr @@ -0,0 +1,132 @@ +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:21:63 + | +LL | let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_undeclared_pub: _, .. } = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:30:5 + | +LL | r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0616]: field `b_crate` of struct `pub_and_stability::Record` is private + --> $DIR/explore-issue-38412.rs:31:5 + | +LL | r.b_crate; //~ ERROR is private + | ^^^^^^^^^ + +error[E0616]: field `c_mod` of struct `pub_and_stability::Record` is private + --> $DIR/explore-issue-38412.rs:32:5 + | +LL | r.c_mod; //~ ERROR is private + | ^^^^^^^ + +error[E0616]: field `d_priv` of struct `pub_and_stability::Record` is private + --> $DIR/explore-issue-38412.rs:33:5 + | +LL | r.d_priv; //~ ERROR is private + | ^^^^^^^^ + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:37:5 + | +LL | t.2; //~ ERROR use of unstable library feature + | ^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0616]: field `3` of struct `pub_and_stability::Tuple` is private + --> $DIR/explore-issue-38412.rs:38:5 + | +LL | t.3; //~ ERROR is private + | ^^^ + +error[E0616]: field `4` of struct `pub_and_stability::Tuple` is private + --> $DIR/explore-issue-38412.rs:39:5 + | +LL | t.4; //~ ERROR is private + | ^^^ + +error[E0616]: field `5` of struct `pub_and_stability::Tuple` is private + --> $DIR/explore-issue-38412.rs:40:5 + | +LL | t.5; //~ ERROR is private + | ^^^ + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:44:7 + | +LL | r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:48:7 + | +LL | r.unstable_undeclared(); //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0624]: method `pub_crate` is private + --> $DIR/explore-issue-38412.rs:50:7 + | +LL | r.pub_crate(); //~ ERROR `pub_crate` is private + | ^^^^^^^^^ + +error[E0624]: method `pub_mod` is private + --> $DIR/explore-issue-38412.rs:51:7 + | +LL | r.pub_mod(); //~ ERROR `pub_mod` is private + | ^^^^^^^ + +error[E0624]: method `private` is private + --> $DIR/explore-issue-38412.rs:52:7 + | +LL | r.private(); //~ ERROR `private` is private + | ^^^^^^^ + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:57:7 + | +LL | t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) + --> $DIR/explore-issue-38412.rs:61:7 + | +LL | t.unstable_undeclared(); //~ ERROR use of unstable library feature + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unstable_undeclared)] to the crate attributes to enable + +error[E0624]: method `pub_crate` is private + --> $DIR/explore-issue-38412.rs:63:7 + | +LL | t.pub_crate(); //~ ERROR `pub_crate` is private + | ^^^^^^^^^ + +error[E0624]: method `pub_mod` is private + --> $DIR/explore-issue-38412.rs:64:7 + | +LL | t.pub_mod(); //~ ERROR `pub_mod` is private + | ^^^^^^^ + +error[E0624]: method `private` is private + --> $DIR/explore-issue-38412.rs:65:7 + | +LL | t.private(); //~ ERROR `private` is private + | ^^^^^^^ + +error: aborting due to 19 previous errors + +Some errors occurred: E0616, E0624, E0658. +For more information about an error, try `rustc --explain E0616`. diff --git a/src/test/ui/export-fully-qualified.rs b/src/test/ui/export-fully-qualified.rs index 422cd251de4..99cb558908c 100644 --- a/src/test/ui/export-fully-qualified.rs +++ b/src/test/ui/export-fully-qualified.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // In this test baz isn't resolved when called as foo.baz even though // it's called from inside foo. This is somewhat surprising and may // want to change eventually. diff --git a/src/test/ui/export-fully-qualified.stderr b/src/test/ui/export-fully-qualified.stderr index 477cb4b1dd1..dd7e3219c76 100644 --- a/src/test/ui/export-fully-qualified.stderr +++ b/src/test/ui/export-fully-qualified.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: use of undeclared type or module `foo` - --> $DIR/export-fully-qualified.rs:16:20 + --> $DIR/export-fully-qualified.rs:6:20 | LL | pub fn bar() { foo::baz(); } //~ ERROR failed to resolve: use of undeclared type or module `foo` | ^^^ use of undeclared type or module `foo` diff --git a/src/test/ui/export-import.rs b/src/test/ui/export-import.rs index 3877250126d..3f543636064 100644 --- a/src/test/ui/export-import.rs +++ b/src/test/ui/export-import.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use m::unexported; //~^ ERROR: is private diff --git a/src/test/ui/export-import.stderr b/src/test/ui/export-import.stderr index dcadad82f29..e02952e0fe0 100644 --- a/src/test/ui/export-import.stderr +++ b/src/test/ui/export-import.stderr @@ -1,5 +1,5 @@ error[E0603]: function `unexported` is private - --> $DIR/export-import.rs:11:8 + --> $DIR/export-import.rs:1:8 | LL | use m::unexported; | ^^^^^^^^^^ diff --git a/src/test/ui/export-tag-variant.rs b/src/test/ui/export-tag-variant.rs index b6e8cf71ddd..46c10067ce2 100644 --- a/src/test/ui/export-tag-variant.rs +++ b/src/test/ui/export-tag-variant.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub fn x() { } - enum y { y1, } + enum Y { Y1 } } -fn main() { let z = foo::y::y1; } //~ ERROR: enum `y` is private +fn main() { let z = foo::Y::Y1; } //~ ERROR: enum `Y` is private diff --git a/src/test/ui/export-tag-variant.stderr b/src/test/ui/export-tag-variant.stderr index e835c29fda3..eb202b3b31b 100644 --- a/src/test/ui/export-tag-variant.stderr +++ b/src/test/ui/export-tag-variant.stderr @@ -1,7 +1,7 @@ -error[E0603]: enum `y` is private - --> $DIR/export-tag-variant.rs:17:26 +error[E0603]: enum `Y` is private + --> $DIR/export-tag-variant.rs:7:26 | -LL | fn main() { let z = foo::y::y1; } //~ ERROR: enum `y` is private +LL | fn main() { let z = foo::Y::Y1; } //~ ERROR: enum `Y` is private | ^ error: aborting due to previous error diff --git a/src/test/ui/export.rs b/src/test/ui/export.rs index c28ea70c752..73ceec6803a 100644 --- a/src/test/ui/export.rs +++ b/src/test/ui/export.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub fn x(y: isize) { log(debug, y); } //~^ ERROR cannot find function `log` in this scope diff --git a/src/test/ui/export.stderr b/src/test/ui/export.stderr index bed650b8c51..ff7763bbd89 100644 --- a/src/test/ui/export.stderr +++ b/src/test/ui/export.stderr @@ -1,29 +1,29 @@ error[E0425]: cannot find function `log` in this scope - --> $DIR/export.rs:12:26 + --> $DIR/export.rs:2:26 | LL | pub fn x(y: isize) { log(debug, y); } | ^^^ not found in this scope error[E0425]: cannot find value `debug` in this scope - --> $DIR/export.rs:12:30 + --> $DIR/export.rs:2:30 | LL | pub fn x(y: isize) { log(debug, y); } | ^^^^^ not found in this scope error[E0425]: cannot find function `log` in this scope - --> $DIR/export.rs:15:22 + --> $DIR/export.rs:5:22 | LL | fn z(y: isize) { log(debug, y); } | ^^^ not found in this scope error[E0425]: cannot find value `debug` in this scope - --> $DIR/export.rs:15:26 + --> $DIR/export.rs:5:26 | LL | fn z(y: isize) { log(debug, y); } | ^^^^^ not found in this scope error[E0603]: function `z` is private - --> $DIR/export.rs:20:18 + --> $DIR/export.rs:10:18 | LL | fn main() { foo::z(10); } //~ ERROR function `z` is private | ^ diff --git a/src/test/ui/export2.rs b/src/test/ui/export2.rs index 4cc9762d975..811d96f26d0 100644 --- a/src/test/ui/export2.rs +++ b/src/test/ui/export2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub fn x() { bar::x(); } //~ ERROR failed to resolve: use of undeclared type or module `bar` } diff --git a/src/test/ui/export2.stderr b/src/test/ui/export2.stderr index 7659183c8e0..6233c6d074e 100644 --- a/src/test/ui/export2.stderr +++ b/src/test/ui/export2.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: use of undeclared type or module `bar` - --> $DIR/export2.rs:12:18 + --> $DIR/export2.rs:2:18 | LL | pub fn x() { bar::x(); } //~ ERROR failed to resolve: use of undeclared type or module `bar` | ^^^ use of undeclared type or module `bar` diff --git a/src/test/ui/expr_attr_paren_order.rs b/src/test/ui/expr_attr_paren_order.rs index 49b2fa0e350..65f2b67d22b 100644 --- a/src/test/ui/expr_attr_paren_order.rs +++ b/src/test/ui/expr_attr_paren_order.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(stmt_expr_attributes)] fn main() { diff --git a/src/test/ui/expr_attr_paren_order.stderr b/src/test/ui/expr_attr_paren_order.stderr index 938ff51b37d..8155514191c 100644 --- a/src/test/ui/expr_attr_paren_order.stderr +++ b/src/test/ui/expr_attr_paren_order.stderr @@ -1,11 +1,11 @@ -error: variable `X` should have a snake case name such as `x` - --> $DIR/expr_attr_paren_order.rs:29:17 +error: variable `X` should have a snake case name + --> $DIR/expr_attr_paren_order.rs:19:17 | LL | let X = 0; //~ ERROR snake case name - | ^ + | ^ help: convert the identifier to snake case: `x` | note: lint level defined here - --> $DIR/expr_attr_paren_order.rs:27:17 + --> $DIR/expr_attr_paren_order.rs:17:17 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/ext-nonexistent.rs b/src/test/ui/ext-nonexistent.rs index a5bf7960624..e65b1654302 100644 --- a/src/test/ui/ext-nonexistent.rs +++ b/src/test/ui/ext-nonexistent.rs @@ -1,12 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:cannot find macro fn main() { iamnotanextensionthatexists!(""); } diff --git a/src/test/ui/ext-nonexistent.stderr b/src/test/ui/ext-nonexistent.stderr index ff027f18476..3fbbb495264 100644 --- a/src/test/ui/ext-nonexistent.stderr +++ b/src/test/ui/ext-nonexistent.stderr @@ -1,5 +1,5 @@ error: cannot find macro `iamnotanextensionthatexists!` in this scope - --> $DIR/ext-nonexistent.rs:12:13 + --> $DIR/ext-nonexistent.rs:2:13 | LL | fn main() { iamnotanextensionthatexists!(""); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/extenv/extenv-arg-2-not-string-literal.rs b/src/test/ui/extenv/extenv-arg-2-not-string-literal.rs index c2362689721..66dced478f9 100644 --- a/src/test/ui/extenv/extenv-arg-2-not-string-literal.rs +++ b/src/test/ui/extenv/extenv-arg-2-not-string-literal.rs @@ -1,11 +1 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { env!("one", 10); } //~ ERROR: expected string literal diff --git a/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr b/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr index 4a10deb4bdd..92c04f9fe8a 100644 --- a/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr +++ b/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr @@ -1,5 +1,5 @@ error: expected string literal - --> $DIR/extenv-arg-2-not-string-literal.rs:11:25 + --> $DIR/extenv-arg-2-not-string-literal.rs:1:25 | LL | fn main() { env!("one", 10); } //~ ERROR: expected string literal | ^^ diff --git a/src/test/ui/extenv/extenv-no-args.rs b/src/test/ui/extenv/extenv-no-args.rs index afa47dbe744..9f221ed10d7 100644 --- a/src/test/ui/extenv/extenv-no-args.rs +++ b/src/test/ui/extenv/extenv-no-args.rs @@ -1,11 +1 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { env!(); } //~ ERROR: env! takes 1 or 2 arguments diff --git a/src/test/ui/extenv/extenv-no-args.stderr b/src/test/ui/extenv/extenv-no-args.stderr index ebd97c014f1..7ae8a6f1858 100644 --- a/src/test/ui/extenv/extenv-no-args.stderr +++ b/src/test/ui/extenv/extenv-no-args.stderr @@ -1,5 +1,5 @@ error: env! takes 1 or 2 arguments - --> $DIR/extenv-no-args.rs:11:13 + --> $DIR/extenv-no-args.rs:1:13 | LL | fn main() { env!(); } //~ ERROR: env! takes 1 or 2 arguments | ^^^^^^^ diff --git a/src/test/ui/extenv/extenv-not-defined-custom.rs b/src/test/ui/extenv/extenv-not-defined-custom.rs index 485b6c09f0a..30b72783f5c 100644 --- a/src/test/ui/extenv/extenv-not-defined-custom.rs +++ b/src/test/ui/extenv/extenv-not-defined-custom.rs @@ -1,11 +1 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); } //~ ERROR: my error message diff --git a/src/test/ui/extenv/extenv-not-defined-custom.stderr b/src/test/ui/extenv/extenv-not-defined-custom.stderr index 845f87df916..34e5b7f9f23 100644 --- a/src/test/ui/extenv/extenv-not-defined-custom.stderr +++ b/src/test/ui/extenv/extenv-not-defined-custom.stderr @@ -1,5 +1,5 @@ error: my error message - --> $DIR/extenv-not-defined-custom.rs:11:13 + --> $DIR/extenv-not-defined-custom.rs:1:13 | LL | fn main() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); } //~ ERROR: my error message | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/extenv/extenv-not-defined-default.rs b/src/test/ui/extenv/extenv-not-defined-default.rs index d99d4dc33a2..30a06a25465 100644 --- a/src/test/ui/extenv/extenv-not-defined-default.rs +++ b/src/test/ui/extenv/extenv-not-defined-default.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { env!("__HOPEFULLY_NOT_DEFINED__"); //~^ ERROR: environment variable `__HOPEFULLY_NOT_DEFINED__` not defined diff --git a/src/test/ui/extenv/extenv-not-defined-default.stderr b/src/test/ui/extenv/extenv-not-defined-default.stderr index 0db6f536edb..4bfe330f592 100644 --- a/src/test/ui/extenv/extenv-not-defined-default.stderr +++ b/src/test/ui/extenv/extenv-not-defined-default.stderr @@ -1,5 +1,5 @@ error: environment variable `__HOPEFULLY_NOT_DEFINED__` not defined - --> $DIR/extenv-not-defined-default.rs:12:5 + --> $DIR/extenv-not-defined-default.rs:2:5 | LL | env!("__HOPEFULLY_NOT_DEFINED__"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/extenv/extenv-not-string-literal.rs b/src/test/ui/extenv/extenv-not-string-literal.rs index 07ce47a14d8..3eaa0b5daaf 100644 --- a/src/test/ui/extenv/extenv-not-string-literal.rs +++ b/src/test/ui/extenv/extenv-not-string-literal.rs @@ -1,11 +1 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { env!(10, "two"); } //~ ERROR: expected string literal diff --git a/src/test/ui/extenv/extenv-not-string-literal.stderr b/src/test/ui/extenv/extenv-not-string-literal.stderr index 1660d8665dc..66645b24a49 100644 --- a/src/test/ui/extenv/extenv-not-string-literal.stderr +++ b/src/test/ui/extenv/extenv-not-string-literal.stderr @@ -1,5 +1,5 @@ error: expected string literal - --> $DIR/extenv-not-string-literal.rs:11:18 + --> $DIR/extenv-not-string-literal.rs:1:18 | LL | fn main() { env!(10, "two"); } //~ ERROR: expected string literal | ^^ diff --git a/src/test/ui/extenv/extenv-too-many-args.rs b/src/test/ui/extenv/extenv-too-many-args.rs index c6c4f0ec6b8..1adbee583db 100644 --- a/src/test/ui/extenv/extenv-too-many-args.rs +++ b/src/test/ui/extenv/extenv-too-many-args.rs @@ -1,11 +1 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { env!("one", "two", "three"); } //~ ERROR: env! takes 1 or 2 arguments diff --git a/src/test/ui/extenv/extenv-too-many-args.stderr b/src/test/ui/extenv/extenv-too-many-args.stderr index e4eda9e9e9a..43695d88eaf 100644 --- a/src/test/ui/extenv/extenv-too-many-args.stderr +++ b/src/test/ui/extenv/extenv-too-many-args.stderr @@ -1,5 +1,5 @@ error: env! takes 1 or 2 arguments - --> $DIR/extenv-too-many-args.rs:11:13 + --> $DIR/extenv-too-many-args.rs:1:13 | LL | fn main() { env!("one", "two", "three"); } //~ ERROR: env! takes 1 or 2 arguments | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/extenv/issue-55897.rs b/src/test/ui/extenv/issue-55897.rs new file mode 100644 index 00000000000..bd151c8a4e4 --- /dev/null +++ b/src/test/ui/extenv/issue-55897.rs @@ -0,0 +1,15 @@ +use prelude::*; //~ ERROR unresolved import `prelude` + +mod unresolved_env { + use env; + + include!(concat!(env!("NON_EXISTENT"), "/data.rs")); + //~^ ERROR cannot determine resolution for the macro `env` +} + +mod nonexistent_env { + include!(concat!(env!("NON_EXISTENT"), "/data.rs")); + //~^ ERROR environment variable `NON_EXISTENT` not defined +} + +fn main() {} diff --git a/src/test/ui/extenv/issue-55897.stderr b/src/test/ui/extenv/issue-55897.stderr new file mode 100644 index 00000000000..4d2e35dff46 --- /dev/null +++ b/src/test/ui/extenv/issue-55897.stderr @@ -0,0 +1,23 @@ +error: environment variable `NON_EXISTENT` not defined + --> $DIR/issue-55897.rs:11:22 + | +LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs")); + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0432]: unresolved import `prelude` + --> $DIR/issue-55897.rs:1:5 + | +LL | use prelude::*; //~ ERROR unresolved import `prelude` + | ^^^^^^^ did you mean `std::prelude`? + +error: cannot determine resolution for the macro `env` + --> $DIR/issue-55897.rs:6:22 + | +LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs")); + | ^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/extern/auxiliary/invalid-utf8.txt b/src/test/ui/extern/auxiliary/invalid-utf8.txt new file mode 100644 index 00000000000..dc1115b82db --- /dev/null +++ b/src/test/ui/extern/auxiliary/invalid-utf8.txt @@ -0,0 +1 @@ +�( \ No newline at end of file diff --git a/src/test/ui/extern/auxiliary/m1.rs b/src/test/ui/extern/auxiliary/m1.rs index b61667cfd88..b76b4321d62 100644 --- a/src/test/ui/extern/auxiliary/m1.rs +++ b/src/test/ui/extern/auxiliary/m1.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} diff --git a/src/test/ui/extern/auxiliary/m2.rs b/src/test/ui/extern/auxiliary/m2.rs index 94ff5e4497f..c5c0bc606cd 100644 --- a/src/test/ui/extern/auxiliary/m2.rs +++ b/src/test/ui/extern/auxiliary/m2.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn bar() {} diff --git a/src/test/ui/extern/extern-const.fixed b/src/test/ui/extern/extern-const.fixed index dca5698a70c..fb17934fa9b 100644 --- a/src/test/ui/extern/extern-const.fixed +++ b/src/test/ui/extern/extern-const.fixed @@ -7,7 +7,7 @@ // run-rustfix // ignore-wasm32 no external library to link to. // compile-flags: -g -Z continue-parse-after-error -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; #[link(name = "rust_test_helpers", kind = "static")] diff --git a/src/test/ui/extern/extern-const.rs b/src/test/ui/extern/extern-const.rs index 07dbe545a85..f2585f5199e 100644 --- a/src/test/ui/extern/extern-const.rs +++ b/src/test/ui/extern/extern-const.rs @@ -7,7 +7,7 @@ // run-rustfix // ignore-wasm32 no external library to link to. // compile-flags: -g -Z continue-parse-after-error -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; #[link(name = "rust_test_helpers", kind = "static")] diff --git a/src/test/ui/extern/extern-crate-rename.rs b/src/test/ui/extern/extern-crate-rename.rs index b58149fb0b8..fc8afc3e134 100644 --- a/src/test/ui/extern/extern-crate-rename.rs +++ b/src/test/ui/extern/extern-crate-rename.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:m1.rs // aux-build:m2.rs diff --git a/src/test/ui/extern/extern-crate-rename.stderr b/src/test/ui/extern/extern-crate-rename.stderr index f8a5de3654c..204e7dd64df 100644 --- a/src/test/ui/extern/extern-crate-rename.stderr +++ b/src/test/ui/extern/extern-crate-rename.stderr @@ -1,5 +1,5 @@ error[E0259]: the name `m1` is defined multiple times - --> $DIR/extern-crate-rename.rs:16:1 + --> $DIR/extern-crate-rename.rs:6:1 | LL | extern crate m1; | ---------------- previous import of the extern crate `m1` here diff --git a/src/test/ui/extern/extern-crate-visibility.rs b/src/test/ui/extern/extern-crate-visibility.rs index 6bb88e40910..b51e4439031 100644 --- a/src/test/ui/extern/extern-crate-visibility.rs +++ b/src/test/ui/extern/extern-crate-visibility.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { extern crate core; } diff --git a/src/test/ui/extern/extern-crate-visibility.stderr b/src/test/ui/extern/extern-crate-visibility.stderr index 02ecf0ce6f2..8baac1a902b 100644 --- a/src/test/ui/extern/extern-crate-visibility.stderr +++ b/src/test/ui/extern/extern-crate-visibility.stderr @@ -1,11 +1,11 @@ error[E0603]: extern crate `core` is private - --> $DIR/extern-crate-visibility.rs:16:10 + --> $DIR/extern-crate-visibility.rs:6:10 | LL | use foo::core::cell; //~ ERROR extern crate `core` is private | ^^^^ error[E0603]: extern crate `core` is private - --> $DIR/extern-crate-visibility.rs:19:10 + --> $DIR/extern-crate-visibility.rs:9:10 | LL | foo::core::cell::Cell::new(0); //~ ERROR extern crate `core` is private | ^^^^ diff --git a/src/test/ui/extern/extern-macro.rs b/src/test/ui/extern/extern-macro.rs index 88a72778a85..ab974e628ff 100644 --- a/src/test/ui/extern/extern-macro.rs +++ b/src/test/ui/extern/extern-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // #41719 fn main() { diff --git a/src/test/ui/extern/extern-macro.stderr b/src/test/ui/extern/extern-macro.stderr index 6123d970166..d70b6ef79ea 100644 --- a/src/test/ui/extern/extern-macro.stderr +++ b/src/test/ui/extern/extern-macro.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: partially resolved path in a macro - --> $DIR/extern-macro.rs:15:13 + --> $DIR/extern-macro.rs:5:13 | LL | let _ = Foo::bar!(); //~ ERROR failed to resolve: partially resolved path in a macro | ^^^^^^^^ partially resolved path in a macro diff --git a/src/test/ui/extern/extern-main-fn.rs b/src/test/ui/extern/extern-main-fn.rs index d9bdb4ecd04..dacebfbecf5 100644 --- a/src/test/ui/extern/extern-main-fn.rs +++ b/src/test/ui/extern/extern-main-fn.rs @@ -1,11 +1 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern fn main() {} //~ ERROR: main function has wrong type [E0580] diff --git a/src/test/ui/extern/extern-main-fn.stderr b/src/test/ui/extern/extern-main-fn.stderr index 24e9d138693..f2134701dee 100644 --- a/src/test/ui/extern/extern-main-fn.stderr +++ b/src/test/ui/extern/extern-main-fn.stderr @@ -1,5 +1,5 @@ error[E0580]: main function has wrong type - --> $DIR/extern-main-fn.rs:11:1 + --> $DIR/extern-main-fn.rs:1:1 | LL | extern fn main() {} //~ ERROR: main function has wrong type [E0580] | ^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn diff --git a/src/test/ui/extern/extern-types-distinct-types.rs b/src/test/ui/extern/extern-types-distinct-types.rs index 8b434bbfc6d..000ba5432e4 100644 --- a/src/test/ui/extern/extern-types-distinct-types.rs +++ b/src/test/ui/extern/extern-types-distinct-types.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(extern_types)] extern { diff --git a/src/test/ui/extern/extern-types-distinct-types.stderr b/src/test/ui/extern/extern-types-distinct-types.stderr index 6c74f63744f..b7b6f2cf04a 100644 --- a/src/test/ui/extern/extern-types-distinct-types.stderr +++ b/src/test/ui/extern/extern-types-distinct-types.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/extern-types-distinct-types.rs:19:5 + --> $DIR/extern-types-distinct-types.rs:9:5 | LL | r //~ ERROR mismatched types | ^ expected extern type `B`, found extern type `A` diff --git a/src/test/ui/extern/extern-types-not-sync-send.rs b/src/test/ui/extern/extern-types-not-sync-send.rs index 10abb80a2f7..3af8b9bf4aa 100644 --- a/src/test/ui/extern/extern-types-not-sync-send.rs +++ b/src/test/ui/extern/extern-types-not-sync-send.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure extern types are !Sync and !Send. #![feature(extern_types)] diff --git a/src/test/ui/extern/extern-types-not-sync-send.stderr b/src/test/ui/extern/extern-types-not-sync-send.stderr index f076aa0fd68..bc9d96df776 100644 --- a/src/test/ui/extern/extern-types-not-sync-send.stderr +++ b/src/test/ui/extern/extern-types-not-sync-send.stderr @@ -1,25 +1,25 @@ error[E0277]: `A` cannot be shared between threads safely - --> $DIR/extern-types-not-sync-send.rs:23:5 + --> $DIR/extern-types-not-sync-send.rs:13:5 | LL | assert_sync::(); | ^^^^^^^^^^^^^^^^ `A` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `A` note: required by `assert_sync` - --> $DIR/extern-types-not-sync-send.rs:19:1 + --> $DIR/extern-types-not-sync-send.rs:9:1 | LL | fn assert_sync() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `A` cannot be sent between threads safely - --> $DIR/extern-types-not-sync-send.rs:26:5 + --> $DIR/extern-types-not-sync-send.rs:16:5 | LL | assert_send::(); | ^^^^^^^^^^^^^^^^ `A` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `A` note: required by `assert_send` - --> $DIR/extern-types-not-sync-send.rs:20:1 + --> $DIR/extern-types-not-sync-send.rs:10:1 | LL | fn assert_send() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/extern/extern-types-unsized.rs b/src/test/ui/extern/extern-types-unsized.rs index f2db4553868..a296ae0739f 100644 --- a/src/test/ui/extern/extern-types-unsized.rs +++ b/src/test/ui/extern/extern-types-unsized.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure extern types are !Sized. #![feature(extern_types)] diff --git a/src/test/ui/extern/extern-types-unsized.stderr b/src/test/ui/extern/extern-types-unsized.stderr index 19df7bdd347..4e4f5550fe8 100644 --- a/src/test/ui/extern/extern-types-unsized.stderr +++ b/src/test/ui/extern/extern-types-unsized.stderr @@ -1,59 +1,59 @@ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/extern-types-unsized.rs:32:5 + --> $DIR/extern-types-unsized.rs:22:5 | LL | assert_sized::(); | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `A` - = note: to learn more, visit + = note: to learn more, visit note: required by `assert_sized` - --> $DIR/extern-types-unsized.rs:29:1 + --> $DIR/extern-types-unsized.rs:19:1 | LL | fn assert_sized() { } | ^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/extern-types-unsized.rs:35:5 + --> $DIR/extern-types-unsized.rs:25:5 | LL | assert_sized::(); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Foo`, the trait `std::marker::Sized` is not implemented for `A` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `Foo` note: required by `assert_sized` - --> $DIR/extern-types-unsized.rs:29:1 + --> $DIR/extern-types-unsized.rs:19:1 | LL | fn assert_sized() { } | ^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/extern-types-unsized.rs:38:5 + --> $DIR/extern-types-unsized.rs:28:5 | LL | assert_sized::>(); | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Bar`, the trait `std::marker::Sized` is not implemented for `A` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `Bar` note: required by `assert_sized` - --> $DIR/extern-types-unsized.rs:29:1 + --> $DIR/extern-types-unsized.rs:19:1 | LL | fn assert_sized() { } | ^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `A` cannot be known at compilation time - --> $DIR/extern-types-unsized.rs:41:5 + --> $DIR/extern-types-unsized.rs:31:5 | LL | assert_sized::>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Bar>`, the trait `std::marker::Sized` is not implemented for `A` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `Bar` = note: required because it appears within the type `Bar>` note: required by `assert_sized` - --> $DIR/extern-types-unsized.rs:29:1 + --> $DIR/extern-types-unsized.rs:19:1 | LL | fn assert_sized() { } | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/extern/extern-with-type-bounds.rs b/src/test/ui/extern/extern-with-type-bounds.rs index 9493a1ae892..8f9683e4a74 100644 --- a/src/test/ui/extern/extern-with-type-bounds.rs +++ b/src/test/ui/extern/extern-with-type-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(intrinsics)] extern "rust-intrinsic" { diff --git a/src/test/ui/extern/extern-with-type-bounds.stderr b/src/test/ui/extern/extern-with-type-bounds.stderr index 4b62a12d36b..acd0596422f 100644 --- a/src/test/ui/extern/extern-with-type-bounds.stderr +++ b/src/test/ui/extern/extern-with-type-bounds.stderr @@ -1,5 +1,5 @@ error[E0405]: cannot find trait `NoSuchTrait` in this scope - --> $DIR/extern-with-type-bounds.rs:26:20 + --> $DIR/extern-with-type-bounds.rs:16:20 | LL | fn align_of() -> usize; | ^^^^^^^^^^^ not found in this scope diff --git a/src/test/ui/extern/extern-wrong-value-type.rs b/src/test/ui/extern/extern-wrong-value-type.rs index ea313385c10..aba52427eb0 100644 --- a/src/test/ui/extern/extern-wrong-value-type.rs +++ b/src/test/ui/extern/extern-wrong-value-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern fn f() { } diff --git a/src/test/ui/extern/extern-wrong-value-type.stderr b/src/test/ui/extern/extern-wrong-value-type.stderr index 0d8185839cc..dce33f3d632 100644 --- a/src/test/ui/extern/extern-wrong-value-type.stderr +++ b/src/test/ui/extern/extern-wrong-value-type.stderr @@ -1,5 +1,5 @@ error[E0277]: expected a `std::ops::Fn<()>` closure, found `extern "C" fn() {f}` - --> $DIR/extern-wrong-value-type.rs:19:5 + --> $DIR/extern-wrong-value-type.rs:9:5 | LL | is_fn(f); | ^^^^^ expected an `Fn<()>` closure, found `extern "C" fn() {f}` @@ -7,7 +7,7 @@ LL | is_fn(f); = help: the trait `std::ops::Fn<()>` is not implemented for `extern "C" fn() {f}` = note: wrap the `extern "C" fn() {f}` in a closure with no arguments: `|| { /* code */ } note: required by `is_fn` - --> $DIR/extern-wrong-value-type.rs:14:1 + --> $DIR/extern-wrong-value-type.rs:4:1 | LL | fn is_fn(_: F) where F: Fn() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/extern/external-doc-error.rs b/src/test/ui/extern/external-doc-error.rs index 5c6f6e49b3d..e17dda65568 100644 --- a/src/test/ui/extern/external-doc-error.rs +++ b/src/test/ui/extern/external-doc-error.rs @@ -2,7 +2,31 @@ #![feature(external_doc)] -#[doc(include = "not-a-file.md")] //~ ERROR: couldn't read -pub struct SomeStruct; +#[doc(include = "not-a-file.md")] +pub struct SomeStruct; //~^ ERROR couldn't read + //~| HELP external doc paths are relative to the crate root + +#[doc(include = "auxiliary/invalid-utf8.txt")] +pub struct InvalidUtf8; //~^ ERROR wasn't a utf-8 file + +#[doc(include)] +pub struct MissingPath; //~^ ERROR expected path + //~| HELP provide a file path with `=` + //~| SUGGESTION include = "" + +#[doc(include("../README.md"))] +pub struct InvalidPathSyntax; //~^ ERROR expected path + //~| HELP provide a file path with `=` + //~| SUGGESTION include = "../README.md" + +#[doc(include = 123)] +pub struct InvalidPathType; //~^ ERROR expected path + //~| HELP provide a file path with `=` + //~| SUGGESTION include = "" + +#[doc(include(123))] +pub struct InvalidPathSyntaxAndType; //~^ ERROR expected path + //~| HELP provide a file path with `=` + //~| SUGGESTION include = "" fn main() {} diff --git a/src/test/ui/extern/external-doc-error.stderr b/src/test/ui/extern/external-doc-error.stderr index 5cc7551ee03..a3be3277de5 100644 --- a/src/test/ui/extern/external-doc-error.stderr +++ b/src/test/ui/extern/external-doc-error.stderr @@ -1,8 +1,40 @@ error: couldn't read $DIR/not-a-file.md: $FILE_NOT_FOUND_MSG (os error 2) - --> $DIR/external-doc-error.rs:5:1 + --> $DIR/external-doc-error.rs:5:17 | -LL | #[doc(include = "not-a-file.md")] //~ ERROR: couldn't read - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[doc(include = "not-a-file.md")] + | ^^^^^^^^^^^^^^^ couldn't read file + | + = help: external doc paths are relative to the crate root + +error: $DIR/auxiliary/invalid-utf8.txt wasn't a utf-8 file + --> $DIR/external-doc-error.rs:9:17 + | +LL | #[doc(include = "auxiliary/invalid-utf8.txt")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ contains invalid utf-8 + +error: expected path to external documentation + --> $DIR/external-doc-error.rs:12:7 + | +LL | #[doc(include)] + | ^^^^^^^ help: provide a file path with `=`: `include = ""` + +error: expected path to external documentation + --> $DIR/external-doc-error.rs:17:7 + | +LL | #[doc(include("../README.md"))] + | ^^^^^^^^^^^^^^^^^^^^^^^ help: provide a file path with `=`: `include = "../README.md"` + +error: expected path to external documentation + --> $DIR/external-doc-error.rs:22:7 + | +LL | #[doc(include = 123)] + | ^^^^^^^^^^^^^ help: provide a file path with `=`: `include = ""` + +error: expected path to external documentation + --> $DIR/external-doc-error.rs:27:7 + | +LL | #[doc(include(123))] + | ^^^^^^^^^^^^ help: provide a file path with `=`: `include = ""` -error: aborting due to previous error +error: aborting due to 6 previous errors diff --git a/src/test/ui/extoption_env-no-args.rs b/src/test/ui/extoption_env-no-args.rs index fd56756584a..bc5f77bc62e 100644 --- a/src/test/ui/extoption_env-no-args.rs +++ b/src/test/ui/extoption_env-no-args.rs @@ -1,11 +1 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { option_env!(); } //~ ERROR: option_env! takes 1 argument diff --git a/src/test/ui/extoption_env-no-args.stderr b/src/test/ui/extoption_env-no-args.stderr index d01aefe46b1..34fe289cd98 100644 --- a/src/test/ui/extoption_env-no-args.stderr +++ b/src/test/ui/extoption_env-no-args.stderr @@ -1,5 +1,5 @@ error: option_env! takes 1 argument - --> $DIR/extoption_env-no-args.rs:11:13 + --> $DIR/extoption_env-no-args.rs:1:13 | LL | fn main() { option_env!(); } //~ ERROR: option_env! takes 1 argument | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/extoption_env-not-string-literal.rs b/src/test/ui/extoption_env-not-string-literal.rs index 6371a5c711d..27c3a8e83db 100644 --- a/src/test/ui/extoption_env-not-string-literal.rs +++ b/src/test/ui/extoption_env-not-string-literal.rs @@ -1,11 +1 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { option_env!(10); } //~ ERROR: argument must be a string literal diff --git a/src/test/ui/extoption_env-not-string-literal.stderr b/src/test/ui/extoption_env-not-string-literal.stderr index af4163259ea..8c97b57e0ab 100644 --- a/src/test/ui/extoption_env-not-string-literal.stderr +++ b/src/test/ui/extoption_env-not-string-literal.stderr @@ -1,5 +1,5 @@ error: argument must be a string literal - --> $DIR/extoption_env-not-string-literal.rs:11:25 + --> $DIR/extoption_env-not-string-literal.rs:1:25 | LL | fn main() { option_env!(10); } //~ ERROR: argument must be a string literal | ^^ diff --git a/src/test/ui/extoption_env-too-many-args.rs b/src/test/ui/extoption_env-too-many-args.rs index b31e857c14e..ecc8b61ac85 100644 --- a/src/test/ui/extoption_env-too-many-args.rs +++ b/src/test/ui/extoption_env-too-many-args.rs @@ -1,11 +1 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { option_env!("one", "two"); } //~ ERROR: option_env! takes 1 argument diff --git a/src/test/ui/extoption_env-too-many-args.stderr b/src/test/ui/extoption_env-too-many-args.stderr index 0e4569d7a01..6b5ade6daef 100644 --- a/src/test/ui/extoption_env-too-many-args.stderr +++ b/src/test/ui/extoption_env-too-many-args.stderr @@ -1,5 +1,5 @@ error: option_env! takes 1 argument - --> $DIR/extoption_env-too-many-args.rs:11:13 + --> $DIR/extoption_env-too-many-args.rs:1:13 | LL | fn main() { option_env!("one", "two"); } //~ ERROR: option_env! takes 1 argument | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/fail-no-dead-code-core.rs b/src/test/ui/fail-no-dead-code-core.rs index aed76e36fca..bc74e807783 100644 --- a/src/test/ui/fail-no-dead-code-core.rs +++ b/src/test/ui/fail-no-dead-code-core.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(dead_code)] #![allow(unreachable_code)] diff --git a/src/test/ui/fail-no-dead-code-core.stderr b/src/test/ui/fail-no-dead-code-core.stderr index d2af77a28d3..b78aed45683 100644 --- a/src/test/ui/fail-no-dead-code-core.stderr +++ b/src/test/ui/fail-no-dead-code-core.stderr @@ -1,11 +1,11 @@ error: function is never used: `foo` - --> $DIR/fail-no-dead-code-core.rs:17:1 + --> $DIR/fail-no-dead-code-core.rs:7:1 | LL | fn foo() { //~ ERROR function is never used | ^^^^^^^^ | note: lint level defined here - --> $DIR/fail-no-dead-code-core.rs:11:9 + --> $DIR/fail-no-dead-code-core.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ diff --git a/src/test/ui/fail-no-dead-code.rs b/src/test/ui/fail-no-dead-code.rs index 6e5d3a31355..2b69985d33d 100644 --- a/src/test/ui/fail-no-dead-code.rs +++ b/src/test/ui/fail-no-dead-code.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(dead_code)] #![allow(unreachable_code)] diff --git a/src/test/ui/fail-no-dead-code.stderr b/src/test/ui/fail-no-dead-code.stderr index f355c7dd731..a4358295931 100644 --- a/src/test/ui/fail-no-dead-code.stderr +++ b/src/test/ui/fail-no-dead-code.stderr @@ -1,11 +1,11 @@ error: function is never used: `foo` - --> $DIR/fail-no-dead-code.rs:14:1 + --> $DIR/fail-no-dead-code.rs:4:1 | LL | fn foo() { //~ ERROR function is never used | ^^^^^^^^ | note: lint level defined here - --> $DIR/fail-no-dead-code.rs:11:9 + --> $DIR/fail-no-dead-code.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ diff --git a/src/test/ui/fail-simple.rs b/src/test/ui/fail-simple.rs index a20ff864705..cd81a5d0a0f 100644 --- a/src/test/ui/fail-simple.rs +++ b/src/test/ui/fail-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { panic!(@); //~ ERROR no rules expected the token `@` } diff --git a/src/test/ui/fail-simple.stderr b/src/test/ui/fail-simple.stderr index 4a4aec5b6ac..31be4e2c87a 100644 --- a/src/test/ui/fail-simple.stderr +++ b/src/test/ui/fail-simple.stderr @@ -1,8 +1,8 @@ error: no rules expected the token `@` - --> $DIR/fail-simple.rs:12:12 + --> $DIR/fail-simple.rs:2:12 | LL | panic!(@); //~ ERROR no rules expected the token `@` - | ^ no rules expected the token `@` + | ^ no rules expected this token in macro call error: aborting due to previous error diff --git a/src/test/ui/fat-ptr-cast.rs b/src/test/ui/fat-ptr-cast.rs index 0802963ad22..eb419ba2036 100644 --- a/src/test/ui/fat-ptr-cast.rs +++ b/src/test/ui/fat-ptr-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait {} // Make sure casts between thin-pointer <-> fat pointer obey RFC401 diff --git a/src/test/ui/fat-ptr-cast.stderr b/src/test/ui/fat-ptr-cast.stderr index 778a4cf1fa0..936cdc559bd 100644 --- a/src/test/ui/fat-ptr-cast.stderr +++ b/src/test/ui/fat-ptr-cast.stderr @@ -1,5 +1,5 @@ error[E0606]: casting `&[i32]` as `usize` is invalid - --> $DIR/fat-ptr-cast.rs:20:5 + --> $DIR/fat-ptr-cast.rs:10:5 | LL | a as usize; //~ ERROR casting | ^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | a as usize; //~ ERROR casting = help: cast through a raw pointer first error[E0606]: casting `&[i32]` as `isize` is invalid - --> $DIR/fat-ptr-cast.rs:21:5 + --> $DIR/fat-ptr-cast.rs:11:5 | LL | a as isize; //~ ERROR casting | ^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | a as isize; //~ ERROR casting = help: cast through a raw pointer first error[E0606]: casting `&[i32]` as `i16` is invalid - --> $DIR/fat-ptr-cast.rs:22:5 + --> $DIR/fat-ptr-cast.rs:12:5 | LL | a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid | ^^^^^^^^ @@ -23,7 +23,7 @@ LL | a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid = help: cast through a raw pointer first error[E0606]: casting `&[i32]` as `u32` is invalid - --> $DIR/fat-ptr-cast.rs:23:5 + --> $DIR/fat-ptr-cast.rs:13:5 | LL | a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid | ^^^^^^^^ @@ -31,7 +31,7 @@ LL | a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid = help: cast through a raw pointer first error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize` - --> $DIR/fat-ptr-cast.rs:24:5 + --> $DIR/fat-ptr-cast.rs:14:5 | LL | b as usize; //~ ERROR non-primitive cast | ^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | b as usize; //~ ERROR non-primitive cast = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait error[E0606]: casting `*const [i32]` as `usize` is invalid - --> $DIR/fat-ptr-cast.rs:25:5 + --> $DIR/fat-ptr-cast.rs:15:5 | LL | p as usize; | ^^^^^^^^^^ @@ -47,19 +47,19 @@ LL | p as usize; = help: cast through a thin pointer first error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]` - --> $DIR/fat-ptr-cast.rs:29:5 + --> $DIR/fat-ptr-cast.rs:19:5 | LL | q as *const [i32]; //~ ERROR cannot cast | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `usize` as `*mut (dyn Trait + 'static)` is invalid - --> $DIR/fat-ptr-cast.rs:32:37 + --> $DIR/fat-ptr-cast.rs:22:37 | LL | let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR casting | ^^^^^^^^^^^ error[E0606]: casting `usize` as `*const str` is invalid - --> $DIR/fat-ptr-cast.rs:33:32 + --> $DIR/fat-ptr-cast.rs:23:32 | LL | let mut fail: *const str = 0 as *const str; //~ ERROR casting | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gate-custom_test_frameworks.rs b/src/test/ui/feature-gate-custom_test_frameworks.rs deleted file mode 100644 index 7c9f7dd0402..00000000000 --- a/src/test/ui/feature-gate-custom_test_frameworks.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![test_runner(main)] //~ ERROR custom test frameworks are an unstable feature - -fn main() {} diff --git a/src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.rs b/src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.rs deleted file mode 100644 index 6207d99dc36..00000000000 --- a/src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[cfg(rustdoc)] //~ ERROR: `cfg(rustdoc)` is experimental and subject to change -pub struct SomeStruct; - -fn main() {} diff --git a/src/test/ui/feature-gate-exhaustive_integer_patterns.rs b/src/test/ui/feature-gate-exhaustive_integer_patterns.rs deleted file mode 100644 index 3aa15229455..00000000000 --- a/src/test/ui/feature-gate-exhaustive_integer_patterns.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - let x: u8 = 0; - match x { //~ ERROR non-exhaustive patterns: `_` not covered - 0 ..= 255 => {} - } -} diff --git a/src/test/ui/feature-gate-exhaustive_integer_patterns.stderr b/src/test/ui/feature-gate-exhaustive_integer_patterns.stderr deleted file mode 100644 index 63d98f6b5eb..00000000000 --- a/src/test/ui/feature-gate-exhaustive_integer_patterns.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0004]: non-exhaustive patterns: `_` not covered - --> $DIR/feature-gate-exhaustive_integer_patterns.rs:13:11 - | -LL | match x { //~ ERROR non-exhaustive patterns: `_` not covered - | ^ pattern `_` not covered - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0004`. diff --git a/src/test/ui/feature-gate-optimize_attribute.rs b/src/test/ui/feature-gate-optimize_attribute.rs new file mode 100644 index 00000000000..c1f75100141 --- /dev/null +++ b/src/test/ui/feature-gate-optimize_attribute.rs @@ -0,0 +1,18 @@ +#![crate_type="rlib"] +#![optimize(speed)] //~ ERROR #54882 + +#[optimize(size)] //~ ERROR #54882 +mod module { + +#[optimize(size)] //~ ERROR #54882 +fn size() {} + +#[optimize(speed)] //~ ERROR #54882 +fn speed() {} + +#[optimize(banana)] +//~^ ERROR #54882 +//~| ERROR E0722 +fn not_known() {} + +} diff --git a/src/test/ui/feature-gate-optimize_attribute.stderr b/src/test/ui/feature-gate-optimize_attribute.stderr new file mode 100644 index 00000000000..ddd4c457d73 --- /dev/null +++ b/src/test/ui/feature-gate-optimize_attribute.stderr @@ -0,0 +1,50 @@ +error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) + --> $DIR/feature-gate-optimize_attribute.rs:7:1 + | +LL | #[optimize(size)] //~ ERROR #54882 + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(optimize_attribute)] to the crate attributes to enable + +error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) + --> $DIR/feature-gate-optimize_attribute.rs:10:1 + | +LL | #[optimize(speed)] //~ ERROR #54882 + | ^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(optimize_attribute)] to the crate attributes to enable + +error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) + --> $DIR/feature-gate-optimize_attribute.rs:13:1 + | +LL | #[optimize(banana)] + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(optimize_attribute)] to the crate attributes to enable + +error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) + --> $DIR/feature-gate-optimize_attribute.rs:4:1 + | +LL | #[optimize(size)] //~ ERROR #54882 + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(optimize_attribute)] to the crate attributes to enable + +error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) + --> $DIR/feature-gate-optimize_attribute.rs:2:1 + | +LL | #![optimize(speed)] //~ ERROR #54882 + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(optimize_attribute)] to the crate attributes to enable + +error[E0722]: invalid argument + --> $DIR/feature-gate-optimize_attribute.rs:13:12 + | +LL | #[optimize(banana)] + | ^^^^^^ + +error: aborting due to 6 previous errors + +Some errors occurred: E0658, E0722. +For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gate-underscore_const_names.rs b/src/test/ui/feature-gate-underscore_const_names.rs deleted file mode 100644 index b283e286514..00000000000 --- a/src/test/ui/feature-gate-underscore_const_names.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012-2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -#![feature(const_let)] - -trait Trt {} -struct Str {} - -impl Trt for Str {} - -const _ : () = { - use std::marker::PhantomData; - struct ImplementsTrait(PhantomData); - let _ = ImplementsTrait::(PhantomData); - () -}; - -fn main() {} diff --git a/src/test/ui/feature-gate-unsized_locals.rs b/src/test/ui/feature-gate-unsized_locals.rs deleted file mode 100644 index 7f1f22fa38f..00000000000 --- a/src/test/ui/feature-gate-unsized_locals.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn f(f: FnOnce()) {} -//~^ ERROR E0277 - -fn main() { -} diff --git a/src/test/ui/feature-gate/duplicate-features.rs b/src/test/ui/feature-gate/duplicate-features.rs index 163a28772a5..d8f7818054a 100644 --- a/src/test/ui/feature-gate/duplicate-features.rs +++ b/src/test/ui/feature-gate/duplicate-features.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(stable_features)] #![feature(rust1)] diff --git a/src/test/ui/feature-gate/duplicate-features.stderr b/src/test/ui/feature-gate/duplicate-features.stderr index d55297bdd0e..18adf3a880a 100644 --- a/src/test/ui/feature-gate/duplicate-features.stderr +++ b/src/test/ui/feature-gate/duplicate-features.stderr @@ -1,11 +1,11 @@ error[E0636]: the feature `if_let` has already been declared - --> $DIR/duplicate-features.rs:17:12 + --> $DIR/duplicate-features.rs:7:12 | LL | #![feature(if_let)] //~ ERROR the feature `if_let` has already been declared | ^^^^^^ error[E0636]: the feature `rust1` has already been declared - --> $DIR/duplicate-features.rs:14:12 + --> $DIR/duplicate-features.rs:4:12 | LL | #![feature(rust1)] //~ ERROR the feature `rust1` has already been declared | ^^^^^ diff --git a/src/test/ui/feature-gate/feature-gate-static-nobundle-2.rs b/src/test/ui/feature-gate/feature-gate-static-nobundle-2.rs new file mode 100644 index 00000000000..92844f9306d --- /dev/null +++ b/src/test/ui/feature-gate/feature-gate-static-nobundle-2.rs @@ -0,0 +1,6 @@ +//~ ERROR kind="static-nobundle" is feature gated +// Test the behavior of rustc when non-existent library is statically linked + +// compile-flags: -l static-nobundle=nonexistent + +fn main() {} diff --git a/src/test/ui/feature-gate/feature-gate-static-nobundle-2.stderr b/src/test/ui/feature-gate/feature-gate-static-nobundle-2.stderr new file mode 100644 index 00000000000..419c21901a0 --- /dev/null +++ b/src/test/ui/feature-gate/feature-gate-static-nobundle-2.stderr @@ -0,0 +1,7 @@ +error[E0658]: kind="static-nobundle" is feature gated (see issue #37403) + | + = help: add #![feature(static_nobundle)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-bench.rs b/src/test/ui/feature-gate/issue-43106-gating-of-bench.rs index d0adcf4025f..2d8868995f4 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-bench.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-bench.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: `main` function not found // At time of authorship, a crate-level #![bench] with no `--test` diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs index 3f340145acf..b1a8cba1676 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test enumerates as many compiler-builtin ungated attributes as // possible (that is, all the mutually compatible ones), and checks // that we get "expected" (*) warnings for each in the various weird @@ -40,75 +30,71 @@ // inputs are handled by each, and (2.) to ease searching for related // occurrences in the source text. -// skip-codegen #![warn(unused_attributes, unknown_lints)] -#![allow(dead_code)] #![allow(stable_features)] // UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES -#![warn (x5400)] //~ WARN unknown lint: `x5400` -#![allow (x5300)] //~ WARN unknown lint: `x5300` -#![forbid (x5200)] //~ WARN unknown lint: `x5200` -#![deny (x5100)] //~ WARN unknown lint: `x5100` +#![warn(x5400)] //~ WARN unknown lint: `x5400` +#![allow(x5300)] //~ WARN unknown lint: `x5300` +#![forbid(x5200)] //~ WARN unknown lint: `x5200` +#![deny(x5100)] //~ WARN unknown lint: `x5100` #![macro_use] // (allowed if no argument; see issue-43160-gating-of-macro_use.rs) -#![macro_export = "4800"] //~ WARN unused attribute -#![plugin_registrar = "4700"] //~ WARN unused attribute +#![macro_export] //~ WARN unused attribute +#![plugin_registrar] //~ WARN unused attribute // skipping testing of cfg // skipping testing of cfg_attr -#![main = "x4400"] //~ WARN unused attribute -#![start = "x4300"] //~ WARN unused attribute +#![main] //~ WARN unused attribute +#![start] //~ WARN unused attribute // see issue-43106-gating-of-test.rs for crate-level; but non crate-level is below at "4200" // see issue-43106-gating-of-bench.rs for crate-level; but non crate-level is below at "4100" -#![repr = "3900"] +#![repr()] //~^ WARN unused attribute -//~| WARN `repr` attribute isn't configurable with a literal -#![path = "3800"] //~ WARN unused attribute -#![abi = "3700"] //~ WARN unused attribute -#![automatically_derived = "3600"] //~ WARN unused attribute -#![no_mangle = "3500"] -#![no_link = "3400"] //~ WARN unused attribute +#![path = "3800"] //~ WARN unused attribute +#![automatically_derived] //~ WARN unused attribute +#![no_mangle] +#![no_link] //~ WARN unused attribute // see issue-43106-gating-of-derive.rs -#![should_panic = "3200"] //~ WARN unused attribute -#![ignore = "3100"] //~ WARN unused attribute -#![no_implicit_prelude = "3000"] +#![should_panic] //~ WARN unused attribute +#![ignore] //~ WARN unused attribute +#![no_implicit_prelude] #![reexport_test_harness_main = "2900"] // see gated-link-args.rs // see issue-43106-gating-of-macro_escape.rs for crate-level; but non crate-level is below at "2700" // (cannot easily test gating of crate-level #[no_std]; but non crate-level is below at "2600") -#![proc_macro_derive = "2500"] //~ WARN unused attribute -#![doc = "2400"] -#![cold = "2300"] -#![export_name = "2200"] +#![proc_macro_derive()] //~ WARN unused attribute +#![doc = "2400"] +#![cold] +#![export_name = "2200"] // see issue-43106-gating-of-inline.rs -#![link = "2000"] -#![link_name = "1900"] -#![link_section = "1800"] -#![no_builtins = "1700"] // Yikes, dupe'd on BUILTIN_ATTRIBUTES list (see "0300") -#![no_mangle = "1600"] // Yikes, dupe'd on BUILTIN_ATTRIBUTES list (see "3500") +#![link()] +#![link_name = "1900"] +#![link_section = "1800"] +#![no_builtins] // Yikes, dupe'd on BUILTIN_ATTRIBUTES list (see "0300") +#![no_mangle] // Yikes, dupe'd on BUILTIN_ATTRIBUTES list (see "3500") // see issue-43106-gating-of-rustc_deprecated.rs -#![must_use = "1400"] +#![must_use] // see issue-43106-gating-of-stable.rs // see issue-43106-gating-of-unstable.rs // see issue-43106-gating-of-deprecated.rs -#![windows_subsystem = "1000"] +#![windows_subsystem = "1000"] // UNGATED CRATE-LEVEL BUILT-IN ATTRIBUTES -#![crate_name = "0900"] -#![crate_type = "bin"] // cannot pass "0800" here +#![crate_name = "0900"] +#![crate_type = "bin"] // cannot pass "0800" here // For #![crate_id], see issue #43142. (I cannot bear to enshrine current behavior in a test) // FIXME(#44232) we should warn that this isn't used. -#![feature ( rust1)] +#![feature(rust1)] // For #![no_start], see issue #43144. (I cannot bear to enshrine current behavior in a test) // (cannot easily gating state of crate-level #[no_main]; but non crate-level is below at "0400") -#![no_builtins = "0300"] -#![recursion_limit = "0200"] -#![type_length_limit = "0100"] +#![no_builtins] +#![recursion_limit = "0200"] +#![type_length_limit = "0100"] // USES OF BUILT-IN ATTRIBUTES IN OTHER ("UNUSUAL") PLACES @@ -205,84 +191,84 @@ mod macro_use { //~^ WARN unused attribute } -#[macro_export = "4800"] +#[macro_export] //~^ WARN unused attribute mod macro_export { - mod inner { #![macro_export="4800"] } + mod inner { #![macro_export] } //~^ WARN unused attribute - #[macro_export = "4800"] fn f() { } + #[macro_export] fn f() { } //~^ WARN unused attribute - #[macro_export = "4800"] struct S; + #[macro_export] struct S; //~^ WARN unused attribute - #[macro_export = "4800"] type T = S; + #[macro_export] type T = S; //~^ WARN unused attribute - #[macro_export = "4800"] impl S { } + #[macro_export] impl S { } //~^ WARN unused attribute } -#[plugin_registrar = "4700"] +#[plugin_registrar] //~^ WARN unused attribute mod plugin_registrar { - mod inner { #![plugin_registrar="4700"] } + mod inner { #![plugin_registrar] } //~^ WARN unused attribute // for `fn f()` case, see gated-plugin_registrar.rs - #[plugin_registrar = "4700"] struct S; + #[plugin_registrar] struct S; //~^ WARN unused attribute - #[plugin_registrar = "4700"] type T = S; + #[plugin_registrar] type T = S; //~^ WARN unused attribute - #[plugin_registrar = "4700"] impl S { } + #[plugin_registrar] impl S { } //~^ WARN unused attribute } -#[main = "4400"] +#[main] //~^ WARN unused attribute mod main { - mod inner { #![main="4300"] } + mod inner { #![main] } //~^ WARN unused attribute // for `fn f()` case, see feature-gate-main.rs - #[main = "4400"] struct S; + #[main] struct S; //~^ WARN unused attribute - #[main = "4400"] type T = S; + #[main] type T = S; //~^ WARN unused attribute - #[main = "4400"] impl S { } + #[main] impl S { } //~^ WARN unused attribute } -#[start = "4300"] +#[start] //~^ WARN unused attribute mod start { - mod inner { #![start="4300"] } + mod inner { #![start] } //~^ WARN unused attribute // for `fn f()` case, see feature-gate-start.rs - #[start = "4300"] struct S; + #[start] struct S; //~^ WARN unused attribute - #[start = "4300"] type T = S; + #[start] type T = S; //~^ WARN unused attribute - #[start = "4300"] impl S { } + #[start] impl S { } //~^ WARN unused attribute } // At time of unit test authorship, if compiling without `--test` then // non-crate-level #[test] attributes seem to be ignored. -#[test = "4200"] -mod test { mod inner { #![test="4200"] } +#[test] +mod test { mod inner { #![test] } fn f() { } @@ -296,41 +282,31 @@ mod test { mod inner { #![test="4200"] } // At time of unit test authorship, if compiling without `--test` then // non-crate-level #[bench] attributes seem to be ignored. -#[bench = "4100"] +#[bench] mod bench { - mod inner { #![bench="4100"] } + mod inner { #![bench] } - #[bench = "4100"] + #[bench] struct S; - #[bench = "4100"] + #[bench] type T = S; - #[bench = "4100"] + #[bench] impl S { } } -#[repr = "3900"] -//~^ WARN unused attribute -//~| WARN `repr` attribute isn't configurable with a literal +#[repr()] mod repr { - mod inner { #![repr="3900"] } - //~^ WARN unused attribute - //~| WARN `repr` attribute isn't configurable with a literal + mod inner { #![repr()] } - #[repr = "3900"] fn f() { } - //~^ WARN unused attribute - //~| WARN `repr` attribute isn't configurable with a literal + #[repr()] fn f() { } struct S; - #[repr = "3900"] type T = S; - //~^ WARN unused attribute - //~| WARN `repr` attribute isn't configurable with a literal + #[repr()] type T = S; - #[repr = "3900"] impl S { } - //~^ WARN unused attribute - //~| WARN `repr` attribute isn't configurable with a literal + #[repr()] impl S { } } #[path = "3800"] @@ -350,130 +326,111 @@ mod path { //~^ WARN unused attribute } -#[abi = "3700"] -//~^ WARN unused attribute -mod abi { - mod inner { #![abi="3700"] } - //~^ WARN unused attribute - - #[abi = "3700"] fn f() { } - //~^ WARN unused attribute - - #[abi = "3700"] struct S; - //~^ WARN unused attribute - - #[abi = "3700"] type T = S; - //~^ WARN unused attribute - - #[abi = "3700"] impl S { } - //~^ WARN unused attribute -} - -#[automatically_derived = "3600"] +#[automatically_derived] //~^ WARN unused attribute mod automatically_derived { - mod inner { #![automatically_derived="3600"] } + mod inner { #![automatically_derived] } //~^ WARN unused attribute - #[automatically_derived = "3600"] fn f() { } + #[automatically_derived] fn f() { } //~^ WARN unused attribute - #[automatically_derived = "3600"] struct S; + #[automatically_derived] struct S; //~^ WARN unused attribute - #[automatically_derived = "3600"] type T = S; + #[automatically_derived] type T = S; //~^ WARN unused attribute - #[automatically_derived = "3600"] impl S { } + #[automatically_derived] impl S { } //~^ WARN unused attribute } -#[no_mangle = "3500"] +#[no_mangle] mod no_mangle { - mod inner { #![no_mangle="3500"] } + mod inner { #![no_mangle] } - #[no_mangle = "3500"] fn f() { } + #[no_mangle] fn f() { } - #[no_mangle = "3500"] struct S; + #[no_mangle] struct S; - #[no_mangle = "3500"] type T = S; + #[no_mangle] type T = S; - #[no_mangle = "3500"] impl S { } + #[no_mangle] impl S { } } -#[no_link = "3400"] +#[no_link] //~^ WARN unused attribute mod no_link { - mod inner { #![no_link="3400"] } + mod inner { #![no_link] } //~^ WARN unused attribute - #[no_link = "3400"] fn f() { } + #[no_link] fn f() { } //~^ WARN unused attribute - #[no_link = "3400"] struct S; + #[no_link] struct S; //~^ WARN unused attribute - #[no_link = "3400"]type T = S; + #[no_link]type T = S; //~^ WARN unused attribute - #[no_link = "3400"] impl S { } + #[no_link] impl S { } //~^ WARN unused attribute } -#[should_panic = "3200"] +#[should_panic] //~^ WARN unused attribute mod should_panic { - mod inner { #![should_panic="3200"] } + mod inner { #![should_panic] } //~^ WARN unused attribute - #[should_panic = "3200"] fn f() { } + #[should_panic] fn f() { } //~^ WARN unused attribute - #[should_panic = "3200"] struct S; + #[should_panic] struct S; //~^ WARN unused attribute - #[should_panic = "3200"] type T = S; + #[should_panic] type T = S; //~^ WARN unused attribute - #[should_panic = "3200"] impl S { } + #[should_panic] impl S { } //~^ WARN unused attribute } -#[ignore = "3100"] +#[ignore] //~^ WARN unused attribute mod ignore { - mod inner { #![ignore="3100"] } + mod inner { #![ignore] } //~^ WARN unused attribute - #[ignore = "3100"] fn f() { } + #[ignore] fn f() { } //~^ WARN unused attribute - #[ignore = "3100"] struct S; + #[ignore] struct S; //~^ WARN unused attribute - #[ignore = "3100"] type T = S; + #[ignore] type T = S; //~^ WARN unused attribute - #[ignore = "3100"] impl S { } + #[ignore] impl S { } //~^ WARN unused attribute } -#[no_implicit_prelude = "3000"] +#[no_implicit_prelude] //~^ WARN unused attribute mod no_implicit_prelude { - mod inner { #![no_implicit_prelude="3000"] } + mod inner { #![no_implicit_prelude] } //~^ WARN unused attribute - #[no_implicit_prelude = "3000"] fn f() { } + #[no_implicit_prelude] fn f() { } //~^ WARN unused attribute - #[no_implicit_prelude = "3000"] struct S; + #[no_implicit_prelude] struct S; //~^ WARN unused attribute - #[no_implicit_prelude = "3000"] type T = S; + #[no_implicit_prelude] type T = S; //~^ WARN unused attribute - #[no_implicit_prelude = "3000"] impl S { } + #[no_implicit_prelude] impl S { } //~^ WARN unused attribute } @@ -516,27 +473,27 @@ mod macro_escape { //~^ WARN unused attribute } -#[no_std = "2600"] +#[no_std] //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute mod no_std { - mod inner { #![no_std="2600"] } + mod inner { #![no_std] } //~^ WARN unused attribute //~| WARN crate-level attribute should be in the root module - #[no_std = "2600"] fn f() { } + #[no_std] fn f() { } //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute - #[no_std = "2600"] struct S; + #[no_std] struct S; //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute - #[no_std = "2600"] type T = S; + #[no_std] type T = S; //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute - #[no_std = "2600"] impl S { } + #[no_std] impl S { } //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute } @@ -558,17 +515,17 @@ mod doc { #[doc = "2400"] impl S { } } -#[cold = "2300"] +#[cold] mod cold { - mod inner { #![cold="2300"] } + mod inner { #![cold] } - #[cold = "2300"] fn f() { } + #[cold] fn f() { } - #[cold = "2300"] struct S; + #[cold] struct S; - #[cold = "2300"] type T = S; + #[cold] type T = S; - #[cold = "2300"] impl S { } + #[cold] impl S { } } #[export_name = "2200"] @@ -589,17 +546,17 @@ mod export_name { // out that we allow them at non-crate-level (though I do not know // whether they have the same effect here as at crate-level). -#[link = "2000"] +#[link()] mod link { - mod inner { #![link="2000"] } + mod inner { #![link()] } - #[link = "2000"] fn f() { } + #[link()] fn f() { } - #[link = "2000"] struct S; + #[link()] struct S; - #[link = "2000"] type T = S; + #[link()] type T = S; - #[link = "2000"] impl S { } + #[link()] impl S { } } #[link_name = "1900"] @@ -630,30 +587,30 @@ mod link_section { struct StructForDeprecated; -#[deprecated = "1500"] +#[deprecated] mod deprecated { - mod inner { #![deprecated="1500"] } + mod inner { #![deprecated] } - #[deprecated = "1500"] fn f() { } + #[deprecated] fn f() { } - #[deprecated = "1500"] struct S1; + #[deprecated] struct S1; - #[deprecated = "1500"] type T = super::StructForDeprecated; + #[deprecated] type T = super::StructForDeprecated; - #[deprecated = "1500"] impl super::StructForDeprecated { } + #[deprecated] impl super::StructForDeprecated { } } -#[must_use = "1400"] +#[must_use] mod must_use { - mod inner { #![must_use="1400"] } + mod inner { #![must_use] } - #[must_use = "1400"] fn f() { } + #[must_use] fn f() { } - #[must_use = "1400"] struct S; + #[must_use] struct S; - #[must_use = "1400"] type T = S; + #[must_use] type T = S; - #[must_use = "1400"] impl S { } + #[must_use] impl S { } } #[windows_subsystem = "1000"] @@ -747,42 +704,42 @@ mod feature { } -#[no_main = "0400"] +#[no_main] //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute mod no_main_1 { - mod inner { #![no_main="0400"] } + mod inner { #![no_main] } //~^ WARN unused attribute //~| WARN crate-level attribute should be in the root module - #[no_main = "0400"] fn f() { } + #[no_main] fn f() { } //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute - #[no_main = "0400"] struct S; + #[no_main] struct S; //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute - #[no_main = "0400"] type T = S; + #[no_main] type T = S; //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute - #[no_main = "0400"] impl S { } + #[no_main] impl S { } //~^ WARN unused attribute //~| WARN crate-level attribute should be an inner attribute } -#[no_builtins = "0300"] +#[no_builtins] mod no_builtins { - mod inner { #![no_builtins="0200"] } + mod inner { #![no_builtins] } - #[no_builtins = "0300"] fn f() { } + #[no_builtins] fn f() { } - #[no_builtins = "0300"] struct S; + #[no_builtins] struct S; - #[no_builtins = "0300"] type T = S; + #[no_builtins] type T = S; - #[no_builtins = "0300"] impl S { } + #[no_builtins] impl S { } } #[recursion_limit="0200"] @@ -835,12 +792,4 @@ mod type_length_limit { //~| WARN crate-level attribute should be an inner attribute } - - - - - - -fn main() { - println!("Hello World"); -} +fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index 59e327bc1ba..4d15ccb300a 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -1,1307 +1,1180 @@ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:50:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:38:9 | -LL | #![warn (x5400)] //~ WARN unknown lint: `x5400` - | ^^^^^ +LL | #![warn(x5400)] //~ WARN unknown lint: `x5400` + | ^^^^^ | note: lint level defined here - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:44:28 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:33:28 | LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:51:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:39:10 | -LL | #![allow (x5300)] //~ WARN unknown lint: `x5300` - | ^^^^^ +LL | #![allow(x5300)] //~ WARN unknown lint: `x5300` + | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:52:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:40:11 | -LL | #![forbid (x5200)] //~ WARN unknown lint: `x5200` - | ^^^^^ +LL | #![forbid(x5200)] //~ WARN unknown lint: `x5200` + | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:41:9 | -LL | #![deny (x5100)] //~ WARN unknown lint: `x5100` - | ^^^^^ +LL | #![deny(x5100)] //~ WARN unknown lint: `x5100` + | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:115:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:101:8 | LL | #[warn(x5400)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:118:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:104:25 | LL | mod inner { #![warn(x5400)] } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:121:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:107:12 | LL | #[warn(x5400)] fn f() { } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:124:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:110:12 | LL | #[warn(x5400)] struct S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:127:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:113:12 | LL | #[warn(x5400)] type T = S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:130:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:116:12 | LL | #[warn(x5400)] impl S { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:134:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:120:9 | LL | #[allow(x5300)] | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:137:26 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:123:26 | LL | mod inner { #![allow(x5300)] } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:140:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:126:13 | LL | #[allow(x5300)] fn f() { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:143:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:129:13 | LL | #[allow(x5300)] struct S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:146:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:132:13 | LL | #[allow(x5300)] type T = S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:149:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:135:13 | LL | #[allow(x5300)] impl S { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:153:10 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:139:10 | LL | #[forbid(x5200)] | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:156:27 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:142:27 | LL | mod inner { #![forbid(x5200)] } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:159:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:145:14 | LL | #[forbid(x5200)] fn f() { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:162:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:148:14 | LL | #[forbid(x5200)] struct S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:165:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:151:14 | LL | #[forbid(x5200)] type T = S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:168:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:154:14 | LL | #[forbid(x5200)] impl S { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:172:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:158:8 | LL | #[deny(x5100)] | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:175:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:161:25 | LL | mod inner { #![deny(x5100)] } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:178:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:164:12 | LL | #[deny(x5100)] fn f() { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:181:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:167:12 | LL | #[deny(x5100)] struct S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:184:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:170:12 | LL | #[deny(x5100)] type T = S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:187:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:173:12 | LL | #[deny(x5100)] impl S { } | ^^^^^ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:500:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:457:1 | LL | #[macro_escape] | ^^^^^^^^^^^^^^^ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:503:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:460:17 | LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ | = help: consider an outer attribute, #[macro_use] mod ... -warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:317:17 - | -LL | mod inner { #![repr="3900"] } - | ^^^^^^^^^^^^^^^ needs a hint - | - = note: #[warn(bad_repr)] on by default - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit - -warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:321:5 - | -LL | #[repr = "3900"] fn f() { } - | ^^^^^^^^^^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit - -warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:327:5 - | -LL | #[repr = "3900"] type T = S; - | ^^^^^^^^^^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit - -warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:331:5 - | -LL | #[repr = "3900"] impl S { } - | ^^^^^^^^^^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit - -warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:313:1 - | -LL | #[repr = "3900"] - | ^^^^^^^^^^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit - -warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:63:1 - | -LL | #![repr = "3900"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit - warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:195:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:181:5 | LL | #[macro_use] fn f() { } | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:44:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:33:9 | LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:198:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:184:5 | LL | #[macro_use] struct S; | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:201:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:187:5 | LL | #[macro_use] type T = S; | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:204:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:190:5 | LL | #[macro_use] impl S { } | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:211:17 - | -LL | mod inner { #![macro_export="4800"] } - | ^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:214:5 - | -LL | #[macro_export = "4800"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:217:5 - | -LL | #[macro_export = "4800"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:220:5 - | -LL | #[macro_export = "4800"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:223:5 - | -LL | #[macro_export = "4800"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:208:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:197:17 | -LL | #[macro_export = "4800"] - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![macro_export] } + | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:230:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:200:5 | -LL | mod inner { #![plugin_registrar="4700"] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_export] fn f() { } + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:235:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:203:5 | -LL | #[plugin_registrar = "4700"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_export] struct S; + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:238:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:206:5 | -LL | #[plugin_registrar = "4700"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_export] type T = S; + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:241:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:209:5 | -LL | #[plugin_registrar = "4700"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_export] impl S { } + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:227:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:194:1 | -LL | #[plugin_registrar = "4700"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_export] + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:248:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:216:17 | -LL | mod inner { #![main="4300"] } - | ^^^^^^^^^^^^^^^ +LL | mod inner { #![plugin_registrar] } + | ^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:253:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:221:5 | -LL | #[main = "4400"] struct S; - | ^^^^^^^^^^^^^^^^ +LL | #[plugin_registrar] struct S; + | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:256:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:224:5 | -LL | #[main = "4400"] type T = S; - | ^^^^^^^^^^^^^^^^ +LL | #[plugin_registrar] type T = S; + | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:259:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:227:5 | -LL | #[main = "4400"] impl S { } - | ^^^^^^^^^^^^^^^^ +LL | #[plugin_registrar] impl S { } + | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:245:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:213:1 | -LL | #[main = "4400"] - | ^^^^^^^^^^^^^^^^ +LL | #[plugin_registrar] + | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:266:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:234:17 | -LL | mod inner { #![start="4300"] } - | ^^^^^^^^^^^^^^^^ +LL | mod inner { #![main] } + | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:271:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:239:5 | -LL | #[start = "4300"] struct S; - | ^^^^^^^^^^^^^^^^^ +LL | #[main] struct S; + | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:274:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:242:5 | -LL | #[start = "4300"] type T = S; - | ^^^^^^^^^^^^^^^^^ +LL | #[main] type T = S; + | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:277:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:245:5 | -LL | #[start = "4300"] impl S { } - | ^^^^^^^^^^^^^^^^^ +LL | #[main] impl S { } + | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:263:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:231:1 | -LL | #[start = "4300"] - | ^^^^^^^^^^^^^^^^^ +LL | #[main] + | ^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:317:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:252:17 | -LL | mod inner { #![repr="3900"] } - | ^^^^^^^^^^^^^^^ +LL | mod inner { #![start] } + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:321:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:257:5 | -LL | #[repr = "3900"] fn f() { } - | ^^^^^^^^^^^^^^^^ +LL | #[start] struct S; + | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:327:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:260:5 | -LL | #[repr = "3900"] type T = S; - | ^^^^^^^^^^^^^^^^ +LL | #[start] type T = S; + | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:331:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:263:5 | -LL | #[repr = "3900"] impl S { } - | ^^^^^^^^^^^^^^^^ +LL | #[start] impl S { } + | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:313:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:249:1 | -LL | #[repr = "3900"] - | ^^^^^^^^^^^^^^^^ +LL | #[start] + | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:340:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:316:5 | LL | #[path = "3800"] fn f() { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:343:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:319:5 | LL | #[path = "3800"] struct S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:346:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:322:5 | LL | #[path = "3800"] type T = S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:349:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:325:5 | LL | #[path = "3800"] impl S { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:356:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:332:17 | -LL | mod inner { #![abi="3700"] } - | ^^^^^^^^^^^^^^ +LL | mod inner { #![automatically_derived] } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:359:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:335:5 | -LL | #[abi = "3700"] fn f() { } - | ^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:362:5 - | -LL | #[abi = "3700"] struct S; - | ^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:365:5 - | -LL | #[abi = "3700"] type T = S; - | ^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:368:5 - | -LL | #[abi = "3700"] impl S { } - | ^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:353:1 - | -LL | #[abi = "3700"] - | ^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:375:17 - | -LL | mod inner { #![automatically_derived="3600"] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:378:5 - | -LL | #[automatically_derived = "3600"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[automatically_derived] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:381:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:338:5 | -LL | #[automatically_derived = "3600"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[automatically_derived] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:384:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:341:5 | -LL | #[automatically_derived = "3600"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[automatically_derived] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:387:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:344:5 | -LL | #[automatically_derived = "3600"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[automatically_derived] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:372:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:329:1 | -LL | #[automatically_derived = "3600"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[automatically_derived] + | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:407:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:364:17 | -LL | mod inner { #![no_link="3400"] } - | ^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![no_link] } + | ^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:410:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:367:5 | -LL | #[no_link = "3400"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_link] fn f() { } + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:413:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:370:5 | -LL | #[no_link = "3400"] struct S; - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_link] struct S; + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:416:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:373:5 | -LL | #[no_link = "3400"]type T = S; - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_link]type T = S; + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:419:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:376:5 | -LL | #[no_link = "3400"] impl S { } - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_link] impl S { } + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:404:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:361:1 | -LL | #[no_link = "3400"] - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_link] + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:426:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:383:17 | -LL | mod inner { #![should_panic="3200"] } - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![should_panic] } + | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:429:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:386:5 | -LL | #[should_panic = "3200"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[should_panic] fn f() { } + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:432:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:389:5 | -LL | #[should_panic = "3200"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[should_panic] struct S; + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:435:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:392:5 | -LL | #[should_panic = "3200"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[should_panic] type T = S; + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:438:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:5 | -LL | #[should_panic = "3200"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[should_panic] impl S { } + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:423:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:380:1 | -LL | #[should_panic = "3200"] - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[should_panic] + | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:445:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:402:17 | -LL | mod inner { #![ignore="3100"] } - | ^^^^^^^^^^^^^^^^^ +LL | mod inner { #![ignore] } + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:448:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:405:5 | -LL | #[ignore = "3100"] fn f() { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[ignore] fn f() { } + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:451:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:5 | -LL | #[ignore = "3100"] struct S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[ignore] struct S; + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:454:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:411:5 | -LL | #[ignore = "3100"] type T = S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[ignore] type T = S; + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:457:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:5 | -LL | #[ignore = "3100"] impl S { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[ignore] impl S { } + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:442:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:399:1 | -LL | #[ignore = "3100"] - | ^^^^^^^^^^^^^^^^^^ +LL | #[ignore] + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:464:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:421:17 | -LL | mod inner { #![no_implicit_prelude="3000"] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![no_implicit_prelude] } + | ^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:467:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:424:5 | -LL | #[no_implicit_prelude = "3000"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[no_implicit_prelude] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:427:5 | -LL | #[no_implicit_prelude = "3000"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[no_implicit_prelude] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:473:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:430:5 | -LL | #[no_implicit_prelude = "3000"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[no_implicit_prelude] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:433:5 | -LL | #[no_implicit_prelude = "3000"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[no_implicit_prelude] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:461:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:418:1 | -LL | #[no_implicit_prelude = "3000"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[no_implicit_prelude] + | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:440:17 | LL | mod inner { #![reexport_test_harness_main="2900"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:486:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:443:5 | LL | #[reexport_test_harness_main = "2900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:489:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:446:5 | LL | #[reexport_test_harness_main = "2900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:449:5 | LL | #[reexport_test_harness_main = "2900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:495:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:452:5 | LL | #[reexport_test_harness_main = "2900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:480:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:437:1 | LL | #[reexport_test_harness_main = "2900"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:506:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:463:5 | LL | #[macro_escape] fn f() { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:509:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:466:5 | LL | #[macro_escape] struct S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:512:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:469:5 | LL | #[macro_escape] type T = S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:515:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:472:5 | LL | #[macro_escape] impl S { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:480:17 | -LL | mod inner { #![no_std="2600"] } - | ^^^^^^^^^^^^^^^^^ +LL | mod inner { #![no_std] } + | ^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:480:17 | -LL | mod inner { #![no_std="2600"] } - | ^^^^^^^^^^^^^^^^^ +LL | mod inner { #![no_std] } + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:484:5 | -LL | #[no_std = "2600"] fn f() { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] fn f() { } + | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:484:5 | -LL | #[no_std = "2600"] fn f() { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] fn f() { } + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:531:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5 | -LL | #[no_std = "2600"] struct S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] struct S; + | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:531:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:488:5 | -LL | #[no_std = "2600"] struct S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] struct S; + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:535:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:5 | -LL | #[no_std = "2600"] type T = S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] type T = S; + | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:535:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:5 | -LL | #[no_std = "2600"] type T = S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] type T = S; + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:539:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 | -LL | #[no_std = "2600"] impl S { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] impl S { } + | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:539:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 | -LL | #[no_std = "2600"] impl S { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] impl S { } + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:519:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:1 | -LL | #[no_std = "2600"] - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] + | ^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:519:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:1 | -LL | #[no_std = "2600"] - | ^^^^^^^^^^^^^^^^^^ +LL | #[no_std] + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:678:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:635:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:678:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:635:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:639:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:686:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:686:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:643:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:690:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:647:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:690:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:647:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:651:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:651:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:631:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:631:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:660:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:664:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:668:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:672:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:672:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:676:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:676:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:656:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:656:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:685:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:732:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:732:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:689:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:693:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:693:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:697:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:701:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:681:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:681:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:754:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:17 | -LL | mod inner { #![no_main="0400"] } - | ^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![no_main] } + | ^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:754:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:17 | -LL | mod inner { #![no_main="0400"] } - | ^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![no_main] } + | ^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:758:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 | -LL | #[no_main = "0400"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] fn f() { } + | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:758:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 | -LL | #[no_main = "0400"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] fn f() { } + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:762:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 | -LL | #[no_main = "0400"] struct S; - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] struct S; + | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:762:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 | -LL | #[no_main = "0400"] struct S; - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] struct S; + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:766:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:5 | -LL | #[no_main = "0400"] type T = S; - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] type T = S; + | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:766:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:723:5 | -LL | #[no_main = "0400"] type T = S; - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] type T = S; + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:727:5 | -LL | #[no_main = "0400"] impl S { } - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] impl S { } + | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:727:5 | -LL | #[no_main = "0400"] impl S { } - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] impl S { } + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:1 | -LL | #[no_main = "0400"] - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] + | ^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:1 | -LL | #[no_main = "0400"] - | ^^^^^^^^^^^^^^^^^^^ +LL | #[no_main] + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:792:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:749:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:792:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:749:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:796:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:753:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:796:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:753:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:800:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:757:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:800:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:757:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:804:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:761:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:804:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:761:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:808:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:765:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:808:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:765:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:788:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:788:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:817:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:817:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:774:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:821:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:821:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:778:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:825:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:825:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:782:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:829:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:829:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:833:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:790:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:833:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:790:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:813:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:813:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:55:1 - | -LL | #![macro_export = "4800"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:43:1 | -LL | #![plugin_registrar = "4700"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![macro_export] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:44:1 | -LL | #![main = "x4400"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![plugin_registrar] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:60:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:47:1 | -LL | #![start = "x4300"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![main] //~ WARN unused attribute + | ^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:63:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:48:1 | -LL | #![repr = "3900"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![start] //~ WARN unused attribute + | ^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:66:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:51:1 | -LL | #![path = "3800"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![repr()] + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:67:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1 | -LL | #![abi = "3700"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![path = "3800"] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:68:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:54:1 | -LL | #![automatically_derived = "3600"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![automatically_derived] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:70:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1 | -LL | #![no_link = "3400"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![no_link] //~ WARN unused attribute + | ^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:72:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:58:1 | -LL | #![should_panic = "3200"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![should_panic] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:73:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1 | -LL | #![ignore = "3100"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![ignore] //~ WARN unused attribute + | ^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:79:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:65:1 | -LL | #![proc_macro_derive = "2500"] //~ WARN unused attribute - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![proc_macro_derive()] //~ WARN unused attribute + | ^^^^^^^^^^^^^^^^^^^^^^^ error: invalid windows subsystem `1000`, only `windows` and `console` are allowed diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs b/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs index 3f423a415cf..360d570b650 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-deprecated.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test just shows that a crate-level `#![deprecated]` does not // signal a warning or error. (This file sits on its own because a // crate-level `#![deprecated]` causes all that crate's item @@ -17,15 +7,7 @@ // compile-pass // skip-codegen -#![allow(dead_code)] -#![deprecated = "1100"] - -// Since we expect for the mix of attributes used here to compile -// successfully, and we are just testing for the expected warnings of -// various (mis)uses of attributes, we use the `rustc_error` attribute -// on the `fn main()`. +#![deprecated] -fn main() { - println!("Hello World"); -} +fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.rs b/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.rs index 2dbc6cb140d..5f276f6b65e 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test checks cases where the derive-macro does not exist. mod derive { @@ -23,3 +13,5 @@ mod derive { //~^ ERROR cannot find derive macro `x3300` in this scope struct S; } + +fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.stderr index 8f63b16b0cf..be3536aa789 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-derive-2.stderr @@ -1,17 +1,17 @@ error: cannot find derive macro `x3300` in this scope - --> $DIR/issue-43106-gating-of-derive-2.rs:14:14 + --> $DIR/issue-43106-gating-of-derive-2.rs:4:14 | LL | #[derive(x3300)] | ^^^^^ error: cannot find derive macro `x3300` in this scope - --> $DIR/issue-43106-gating-of-derive-2.rs:18:14 + --> $DIR/issue-43106-gating-of-derive-2.rs:8:14 | LL | #[derive(x3300)] | ^^^^^ error: cannot find derive macro `x3300` in this scope - --> $DIR/issue-43106-gating-of-derive-2.rs:22:14 + --> $DIR/issue-43106-gating-of-derive-2.rs:12:14 | LL | #[derive(x3300)] | ^^^^^ diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-derive.rs b/src/test/ui/feature-gate/issue-43106-gating-of-derive.rs index e5293ebb94d..13974129884 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-derive.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-derive.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // `#![derive]` raises errors when it occurs at contexts other than ADT // definitions. @@ -41,3 +31,5 @@ mod derive { //~^ ERROR `derive` may only be applied to structs, enums and unions impl S { } } + +fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-derive.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-derive.stderr index 6f5df6beba3..25f160983d3 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-derive.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-derive.stderr @@ -1,35 +1,35 @@ error: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-43106-gating-of-derive.rs:14:1 + --> $DIR/issue-43106-gating-of-derive.rs:4:1 | LL | #![derive(Debug)] | ^^^^^^^^^^^^^^^^^ help: try an outer attribute: `#[derive(Debug)]` error: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-43106-gating-of-derive.rs:17:1 + --> $DIR/issue-43106-gating-of-derive.rs:7:1 | LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-43106-gating-of-derive.rs:20:17 + --> $DIR/issue-43106-gating-of-derive.rs:10:17 | LL | mod inner { #![derive(Debug)] } | ^^^^^^^^^^^^^^^^^ help: try an outer attribute: `#[derive(Debug)]` error: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-43106-gating-of-derive.rs:23:5 + --> $DIR/issue-43106-gating-of-derive.rs:13:5 | LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-43106-gating-of-derive.rs:36:5 + --> $DIR/issue-43106-gating-of-derive.rs:26:5 | LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-43106-gating-of-derive.rs:40:5 + --> $DIR/issue-43106-gating-of-derive.rs:30:5 | LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs b/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs index b03faad988e..bb9e6d4ca83 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is testing whether `#[inline]` signals an error or warning // when put in "weird" places. // @@ -16,23 +6,25 @@ // issue-43106-gating-of-builtin-attrs.rs) // Crate-level is accepted, though it is almost certainly unused? -#![inline = "2100"] +#![inline] -#[inline = "2100"] +#[inline] //~^ ERROR attribute should be applied to function or closure mod inline { - mod inner { #![inline="2100"] } + mod inner { #![inline] } //~^ ERROR attribute should be applied to function or closure #[inline = "2100"] fn f() { } + //~^ WARN attribute must be of the form + //~| WARN this was previously accepted - #[inline = "2100"] struct S; + #[inline] struct S; //~^ ERROR attribute should be applied to function or closure - #[inline = "2100"] type T = S; + #[inline] type T = S; //~^ ERROR attribute should be applied to function or closure - #[inline = "2100"] impl S { } + #[inline] impl S { } //~^ ERROR attribute should be applied to function or closure } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr index 4d63c3f5012..71e8f11ff07 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr @@ -1,11 +1,21 @@ +warning: attribute must be of the form `#[inline]` or `#[inline(always|never)]` + --> $DIR/issue-43106-gating-of-inline.rs:17:5 + | +LL | #[inline = "2100"] fn f() { } + | ^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(ill_formed_attribute_input)] on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57571 + error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-inline.rs:21:1 + --> $DIR/issue-43106-gating-of-inline.rs:11:1 | -LL | #[inline = "2100"] - | ^^^^^^^^^^^^^^^^^^ +LL | #[inline] + | ^^^^^^^^^ LL | //~^ ERROR attribute should be applied to function or closure LL | / mod inline { -LL | | mod inner { #![inline="2100"] } +LL | | mod inner { #![inline] } LL | | //~^ ERROR attribute should be applied to function or closure LL | | ... | @@ -14,28 +24,28 @@ LL | | } | |_- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-inline.rs:24:17 + --> $DIR/issue-43106-gating-of-inline.rs:14:17 | -LL | mod inner { #![inline="2100"] } - | ------------^^^^^^^^^^^^^^^^^-- not a function or closure +LL | mod inner { #![inline] } + | ------------^^^^^^^^^^-- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-inline.rs:29:5 + --> $DIR/issue-43106-gating-of-inline.rs:21:5 | -LL | #[inline = "2100"] struct S; - | ^^^^^^^^^^^^^^^^^^ --------- not a function or closure +LL | #[inline] struct S; + | ^^^^^^^^^ --------- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-inline.rs:32:5 + --> $DIR/issue-43106-gating-of-inline.rs:24:5 | -LL | #[inline = "2100"] type T = S; - | ^^^^^^^^^^^^^^^^^^ ----------- not a function or closure +LL | #[inline] type T = S; + | ^^^^^^^^^ ----------- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-inline.rs:35:5 + --> $DIR/issue-43106-gating-of-inline.rs:27:5 | -LL | #[inline = "2100"] impl S { } - | ^^^^^^^^^^^^^^^^^^ ---------- not a function or closure +LL | #[inline] impl S { } + | ^^^^^^^^^ ---------- not a function or closure error: aborting due to 5 previous errors diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs index 620874e5c2d..98ca3444c91 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Testing that crate-level `#![macro_escape]` is not gated beyond a // depecation warning. This file sits on its own, because crate-level // `#![macro_escape]` is incompatible with crate-level `#![macro_use]` diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr index d19720397e6..9fb9633d9a8 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr @@ -1,5 +1,5 @@ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-macro_escape.rs:18:1 + --> $DIR/issue-43106-gating-of-macro_escape.rs:8:1 | LL | #![macro_escape] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs index cf5619da3c7..725f2e0b9d0 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.rs @@ -1,33 +1,25 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is just a check-list of the cases where feeding arguments to // `#[macro_use]` is rejected. (The cases where no error is emitted // corresponds to cases where the attribute is currently unused, so we // get that warning; see issue-43106-gating-of-builtin-attrs.rs -#![macro_use = "4900"] //~ ERROR arguments to macro_use are not allowed here +#![macro_use(my_macro)] +//~^ ERROR arguments to macro_use are not allowed here -#[macro_use = "2700"] +#[macro_use(my_macro)] //~^ ERROR arguments to macro_use are not allowed here mod macro_escape { - mod inner { #![macro_use="2700"] } + mod inner { #![macro_use(my_macro)] } //~^ ERROR arguments to macro_use are not allowed here - #[macro_use = "2700"] fn f() { } - #[macro_use = "2700"] struct S; + //~^ ERROR attribute must be of the form + + #[macro_use] fn f() { } - #[macro_use = "2700"] type T = S; + #[macro_use] type T = S; - #[macro_use = "2700"] impl S { } + #[macro_use] impl S { } } fn main() { } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr index 0a491cd3b56..8074528c0e0 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_use.stderr @@ -1,20 +1,26 @@ error: arguments to macro_use are not allowed here - --> $DIR/issue-43106-gating-of-macro_use.rs:16:1 + --> $DIR/issue-43106-gating-of-macro_use.rs:6:1 | -LL | #![macro_use = "4900"] //~ ERROR arguments to macro_use are not allowed here - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![macro_use(my_macro)] + | ^^^^^^^^^^^^^^^^^^^^^^^ error: arguments to macro_use are not allowed here - --> $DIR/issue-43106-gating-of-macro_use.rs:18:1 + --> $DIR/issue-43106-gating-of-macro_use.rs:9:1 | -LL | #[macro_use = "2700"] - | ^^^^^^^^^^^^^^^^^^^^^ +LL | #[macro_use(my_macro)] + | ^^^^^^^^^^^^^^^^^^^^^^ error: arguments to macro_use are not allowed here - --> $DIR/issue-43106-gating-of-macro_use.rs:21:17 + --> $DIR/issue-43106-gating-of-macro_use.rs:12:17 | -LL | mod inner { #![macro_use="2700"] } - | ^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![macro_use(my_macro)] } + | ^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: attribute must be of the form `#[macro_use]` or `#[macro_use(name1, name2, ...)]` + --> $DIR/issue-43106-gating-of-macro_use.rs:15:5 + | +LL | #[macro_use = "2700"] struct S; + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs index c23b43dfff7..a94ffd602ef 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // At time of authorship, #[proc_macro_derive = "2500"] will emit an // error when it occurs on a mod (apart from crate-level), but will // not descend further into the mod for other occurrences of the same @@ -17,27 +7,27 @@ // signal errors, making it incompatible with the "warnings only" // nature of issue-43106-gating-of-builtin-attrs.rs -#[proc_macro_derive = "2500"] +#[proc_macro_derive()] //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions mod proc_macro_derive1 { - mod inner { #![proc_macro_derive="2500"] } + mod inner { #![proc_macro_derive()] } // (no error issued here if there was one on outer module) } mod proc_macro_derive2 { - mod inner { #![proc_macro_derive="2500"] } + mod inner { #![proc_macro_derive()] } //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions - #[proc_macro_derive = "2500"] fn f() { } + #[proc_macro_derive()] fn f() { } //~^ ERROR the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` - #[proc_macro_derive = "2500"] struct S; + #[proc_macro_derive()] struct S; //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions - #[proc_macro_derive = "2500"] type T = S; + #[proc_macro_derive()] type T = S; //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions - #[proc_macro_derive = "2500"] impl S { } + #[proc_macro_derive()] impl S { } //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr index 419efb6825a..e202b472d9c 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr @@ -1,38 +1,38 @@ error: the `#[proc_macro_derive]` attribute may only be used on bare functions - --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:20:1 + --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:10:1 | -LL | #[proc_macro_derive = "2500"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[proc_macro_derive()] + | ^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute may only be used on bare functions - --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:28:17 + --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:18:17 | -LL | mod inner { #![proc_macro_derive="2500"] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![proc_macro_derive()] } + | ^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:31:5 + --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:21:5 | -LL | #[proc_macro_derive = "2500"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[proc_macro_derive()] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute may only be used on bare functions - --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:34:5 + --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:24:5 | -LL | #[proc_macro_derive = "2500"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[proc_macro_derive()] struct S; + | ^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute may only be used on bare functions - --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:37:5 + --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:27:5 | -LL | #[proc_macro_derive = "2500"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[proc_macro_derive()] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute may only be used on bare functions - --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:40:5 + --> $DIR/issue-43106-gating-of-proc_macro_derive.rs:30:5 | -LL | #[proc_macro_derive = "2500"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[proc_macro_derive()] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs index 0c6cfb5da56..60873f9cc75 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs @@ -1,38 +1,28 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Testing gating of `#[rustc_deprecated]` in "weird" places. // // This file sits on its own because these signal errors, making // this test incompatible with the "warnings only" nature of // issue-43106-gating-of-builtin-attrs.rs -#![rustc_deprecated = "1500"] +#![rustc_deprecated()] //~^ ERROR stability attributes may not be used outside of the standard library -#[rustc_deprecated = "1500"] +#[rustc_deprecated()] //~^ ERROR stability attributes may not be used outside of the standard library mod rustc_deprecated { - mod inner { #![rustc_deprecated="1500"] } + mod inner { #![rustc_deprecated()] } //~^ ERROR stability attributes may not be used outside of the standard library - #[rustc_deprecated = "1500"] fn f() { } + #[rustc_deprecated()] fn f() { } //~^ ERROR stability attributes may not be used outside of the standard library - #[rustc_deprecated = "1500"] struct S; + #[rustc_deprecated()] struct S; //~^ ERROR stability attributes may not be used outside of the standard library - #[rustc_deprecated = "1500"] type T = S; + #[rustc_deprecated()] type T = S; //~^ ERROR stability attributes may not be used outside of the standard library - #[rustc_deprecated = "1500"] impl S { } + #[rustc_deprecated()] impl S { } //~^ ERROR stability attributes may not be used outside of the standard library } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr index 35c15cb6b1e..4eead369103 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr @@ -1,44 +1,44 @@ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:17:1 + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:7:1 | -LL | #![rustc_deprecated = "1500"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:20:1 + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:10:1 | -LL | #[rustc_deprecated = "1500"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] + | ^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:23:17 + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:13:17 | -LL | mod inner { #![rustc_deprecated="1500"] } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![rustc_deprecated()] } + | ^^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:26:5 + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:16:5 | -LL | #[rustc_deprecated = "1500"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] fn f() { } + | ^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:29:5 + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:19:5 | -LL | #[rustc_deprecated = "1500"] struct S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] struct S; + | ^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:32:5 + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:22:5 | -LL | #[rustc_deprecated = "1500"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] type T = S; + | ^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:35:5 + --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:25:5 | -LL | #[rustc_deprecated = "1500"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] impl S { } + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs b/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs index 6415243d087..e3ac2749306 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs @@ -1,38 +1,28 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Testing gating of `#[stable]` in "weird" places. // // This file sits on its own because these signal errors, making // this test incompatible with the "warnings only" nature of // issue-43106-gating-of-builtin-attrs.rs -#![stable = "1300"] +#![stable()] //~^ ERROR stability attributes may not be used outside of the standard library -#[stable = "1300"] +#[stable()] //~^ ERROR stability attributes may not be used outside of the standard library mod stable { - mod inner { #![stable="1300"] } + mod inner { #![stable()] } //~^ ERROR stability attributes may not be used outside of the standard library - #[stable = "1300"] fn f() { } + #[stable()] fn f() { } //~^ ERROR stability attributes may not be used outside of the standard library - #[stable = "1300"] struct S; + #[stable()] struct S; //~^ ERROR stability attributes may not be used outside of the standard library - #[stable = "1300"] type T = S; + #[stable()] type T = S; //~^ ERROR stability attributes may not be used outside of the standard library - #[stable = "1300"] impl S { } + #[stable()] impl S { } //~^ ERROR stability attributes may not be used outside of the standard library } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr index 21543d1b20a..03410eabe36 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr @@ -1,44 +1,44 @@ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:17:1 + --> $DIR/issue-43106-gating-of-stable.rs:7:1 | -LL | #![stable = "1300"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![stable()] + | ^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:20:1 + --> $DIR/issue-43106-gating-of-stable.rs:10:1 | -LL | #[stable = "1300"] - | ^^^^^^^^^^^^^^^^^^ +LL | #[stable()] + | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:23:17 + --> $DIR/issue-43106-gating-of-stable.rs:13:17 | -LL | mod inner { #![stable="1300"] } - | ^^^^^^^^^^^^^^^^^ +LL | mod inner { #![stable()] } + | ^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:26:5 + --> $DIR/issue-43106-gating-of-stable.rs:16:5 | -LL | #[stable = "1300"] fn f() { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[stable()] fn f() { } + | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:29:5 + --> $DIR/issue-43106-gating-of-stable.rs:19:5 | -LL | #[stable = "1300"] struct S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[stable()] struct S; + | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:32:5 + --> $DIR/issue-43106-gating-of-stable.rs:22:5 | -LL | #[stable = "1300"] type T = S; - | ^^^^^^^^^^^^^^^^^^ +LL | #[stable()] type T = S; + | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-stable.rs:35:5 + --> $DIR/issue-43106-gating-of-stable.rs:25:5 | -LL | #[stable = "1300"] impl S { } - | ^^^^^^^^^^^^^^^^^^ +LL | #[stable()] impl S { } + | ^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-test.rs b/src/test/ui/feature-gate/issue-43106-gating-of-test.rs index 06632396249..c0c49d35300 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-test.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-test.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: `main` function not found // At time of authorship, crate-level #[test] attribute with no diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs index 140474d82c8..8d519c3106c 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs @@ -1,38 +1,28 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Testing gating of `#[unstable]` in "weird" places. // // This file sits on its own because these signal errors, making // this test incompatible with the "warnings only" nature of // issue-43106-gating-of-builtin-attrs.rs -#![unstable = "1200"] +#![unstable()] //~^ ERROR stability attributes may not be used outside of the standard library -#[unstable = "1200"] +#[unstable()] //~^ ERROR stability attributes may not be used outside of the standard library mod unstable { - mod inner { #![unstable="1200"] } + mod inner { #![unstable()] } //~^ ERROR stability attributes may not be used outside of the standard library - #[unstable = "1200"] fn f() { } + #[unstable()] fn f() { } //~^ ERROR stability attributes may not be used outside of the standard library - #[unstable = "1200"] struct S; + #[unstable()] struct S; //~^ ERROR stability attributes may not be used outside of the standard library - #[unstable = "1200"] type T = S; + #[unstable()] type T = S; //~^ ERROR stability attributes may not be used outside of the standard library - #[unstable = "1200"] impl S { } + #[unstable()] impl S { } //~^ ERROR stability attributes may not be used outside of the standard library } diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr index 6124e16f418..5952b3836aa 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr @@ -1,44 +1,44 @@ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:17:1 + --> $DIR/issue-43106-gating-of-unstable.rs:7:1 | -LL | #![unstable = "1200"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![unstable()] + | ^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:20:1 + --> $DIR/issue-43106-gating-of-unstable.rs:10:1 | -LL | #[unstable = "1200"] - | ^^^^^^^^^^^^^^^^^^^^ +LL | #[unstable()] + | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:23:17 + --> $DIR/issue-43106-gating-of-unstable.rs:13:17 | -LL | mod inner { #![unstable="1200"] } - | ^^^^^^^^^^^^^^^^^^^ +LL | mod inner { #![unstable()] } + | ^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:26:5 + --> $DIR/issue-43106-gating-of-unstable.rs:16:5 | -LL | #[unstable = "1200"] fn f() { } - | ^^^^^^^^^^^^^^^^^^^^ +LL | #[unstable()] fn f() { } + | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:29:5 + --> $DIR/issue-43106-gating-of-unstable.rs:19:5 | -LL | #[unstable = "1200"] struct S; - | ^^^^^^^^^^^^^^^^^^^^ +LL | #[unstable()] struct S; + | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:32:5 + --> $DIR/issue-43106-gating-of-unstable.rs:22:5 | -LL | #[unstable = "1200"] type T = S; - | ^^^^^^^^^^^^^^^^^^^^ +LL | #[unstable()] type T = S; + | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/issue-43106-gating-of-unstable.rs:35:5 + --> $DIR/issue-43106-gating-of-unstable.rs:25:5 | -LL | #[unstable = "1200"] impl S { } - | ^^^^^^^^^^^^^^^^^^^^ +LL | #[unstable()] impl S { } + | ^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/feature-gate/issue-49983-see-issue-0.rs b/src/test/ui/feature-gate/issue-49983-see-issue-0.rs index 1e0039aba04..eeb80d014b2 100644 --- a/src/test/ui/feature-gate/issue-49983-see-issue-0.rs +++ b/src/test/ui/feature-gate/issue-49983-see-issue-0.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate core; // error should not say "(see issue #0)" diff --git a/src/test/ui/feature-gate/issue-49983-see-issue-0.stderr b/src/test/ui/feature-gate/issue-49983-see-issue-0.stderr index 986a2d88e00..22ad8c8b77e 100644 --- a/src/test/ui/feature-gate/issue-49983-see-issue-0.stderr +++ b/src/test/ui/feature-gate/issue-49983-see-issue-0.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'ptr_internals': use NonNull instead and consider PhantomData (if you also use #[may_dangle]), Send, and/or Sync - --> $DIR/issue-49983-see-issue-0.rs:14:30 + --> $DIR/issue-49983-see-issue-0.rs:4:30 | LL | #[allow(unused_imports)] use core::ptr::Unique; //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gate/stability-attribute-consistency.rs b/src/test/ui/feature-gate/stability-attribute-consistency.rs index 94bc57d10e5..caafd8b8854 100644 --- a/src/test/ui/feature-gate/stability-attribute-consistency.rs +++ b/src/test/ui/feature-gate/stability-attribute-consistency.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![stable(feature = "stable_test_feature", since = "1.0.0")] #![feature(staged_api)] diff --git a/src/test/ui/feature-gate/stability-attribute-consistency.stderr b/src/test/ui/feature-gate/stability-attribute-consistency.stderr index 1b2fdd6014e..191b25db3e0 100644 --- a/src/test/ui/feature-gate/stability-attribute-consistency.stderr +++ b/src/test/ui/feature-gate/stability-attribute-consistency.stderr @@ -1,11 +1,11 @@ error[E0711]: feature `foo` is declared stable since 1.29.0, but was previously declared stable since 1.0.0 - --> $DIR/stability-attribute-consistency.rs:18:1 + --> $DIR/stability-attribute-consistency.rs:8:1 | LL | #[stable(feature = "foo", since = "1.29.0")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0711]: feature `foo` is declared unstable, but was previously declared stable - --> $DIR/stability-attribute-consistency.rs:22:1 + --> $DIR/stability-attribute-consistency.rs:12:1 | LL | #[unstable(feature = "foo", issue = "0")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gate/unknown-feature.rs b/src/test/ui/feature-gate/unknown-feature.rs index da1b257f634..20fd932d4c2 100644 --- a/src/test/ui/feature-gate/unknown-feature.rs +++ b/src/test/ui/feature-gate/unknown-feature.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unknown_rust_feature)] //~ ERROR unknown feature fn main() {} diff --git a/src/test/ui/feature-gate/unknown-feature.stderr b/src/test/ui/feature-gate/unknown-feature.stderr index f44aaeec032..2f8bf20ce46 100644 --- a/src/test/ui/feature-gate/unknown-feature.stderr +++ b/src/test/ui/feature-gate/unknown-feature.stderr @@ -1,5 +1,5 @@ error[E0635]: unknown feature `unknown_rust_feature` - --> $DIR/unknown-feature.rs:11:12 + --> $DIR/unknown-feature.rs:1:12 | LL | #![feature(unknown_rust_feature)] //~ ERROR unknown feature | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gated-feature-in-macro-arg.rs b/src/test/ui/feature-gated-feature-in-macro-arg.rs index ae342af4a52..1285cca6b8b 100644 --- a/src/test/ui/feature-gated-feature-in-macro-arg.rs +++ b/src/test/ui/feature-gated-feature-in-macro-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // tests that input to a macro is checked for use of gated features. If this // test succeeds due to the acceptance of a feature, pick a new feature to // test. Not ideal, but oh well :( diff --git a/src/test/ui/feature-gated-feature-in-macro-arg.stderr b/src/test/ui/feature-gated-feature-in-macro-arg.stderr index 41b3e3eaf10..b262a6f7005 100644 --- a/src/test/ui/feature-gated-feature-in-macro-arg.stderr +++ b/src/test/ui/feature-gated-feature-in-macro-arg.stderr @@ -1,5 +1,5 @@ error[E0658]: intrinsics are subject to change - --> $DIR/feature-gated-feature-in-macro-arg.rs:18:9 + --> $DIR/feature-gated-feature-in-macro-arg.rs:8:9 | LL | / extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change LL | | fn atomic_fence(); diff --git a/src/test/ui/feature-gates/auxiliary/cfg-target-thread-local.rs b/src/test/ui/feature-gates/auxiliary/cfg-target-thread-local.rs index d1971a5e1ae..bd5c8f81c00 100644 --- a/src/test/ui/feature-gates/auxiliary/cfg-target-thread-local.rs +++ b/src/test/ui/feature-gates/auxiliary/cfg-target-thread-local.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(thread_local)] #![feature(cfg_target_thread_local)] #![crate_type = "lib"] diff --git a/src/test/ui/feature-gates/auxiliary/re_rebalance_coherence_lib.rs b/src/test/ui/feature-gates/auxiliary/re_rebalance_coherence_lib.rs new file mode 100644 index 00000000000..c8d027b25c7 --- /dev/null +++ b/src/test/ui/feature-gates/auxiliary/re_rebalance_coherence_lib.rs @@ -0,0 +1,23 @@ + +pub trait Backend{} +pub trait SupportsDefaultKeyword {} + +impl SupportsDefaultKeyword for Postgres {} + +pub struct Postgres; + +impl Backend for Postgres {} + +pub struct AstPass(::std::marker::PhantomData); + +pub trait QueryFragment {} + + +#[derive(Debug, Clone, Copy)] +pub struct BatchInsert<'a, T: 'a, Tab> { + _marker: ::std::marker::PhantomData<(&'a T, Tab)>, +} + +impl<'a, T:'a, Tab, DB> QueryFragment for BatchInsert<'a, T, Tab> +where DB: SupportsDefaultKeyword + Backend, +{} diff --git a/src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs b/src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs index 030e37475c0..37c39b6384d 100644 --- a/src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs +++ b/src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the MSP430 interrupt ABI cannot be used when msp430_interrupt // feature gate is not used. diff --git a/src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr b/src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr index 26babb8c3ff..6b3c169c99d 100644 --- a/src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr +++ b/src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr @@ -1,5 +1,5 @@ error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) - --> $DIR/feature-gate-abi-msp430-interrupt.rs:14:1 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:4:1 | LL | extern "msp430-interrupt" fn foo() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-abi.rs b/src/test/ui/feature-gates/feature-gate-abi.rs index db008b83797..41c9f79bfe3 100644 --- a/src/test/ui/feature-gates/feature-gate-abi.rs +++ b/src/test/ui/feature-gates/feature-gate-abi.rs @@ -1,12 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// only-x86_64 // ignore-tidy-linelength // gate-test-intrinsics // gate-test-platform_intrinsics diff --git a/src/test/ui/feature-gates/feature-gate-abi.stderr b/src/test/ui/feature-gates/feature-gate-abi.stderr index eb68391ba35..d528788f7c2 100644 --- a/src/test/ui/feature-gates/feature-gate-abi.stderr +++ b/src/test/ui/feature-gates/feature-gate-abi.stderr @@ -1,5 +1,5 @@ error[E0658]: intrinsics are subject to change - --> $DIR/feature-gate-abi.rs:20:1 + --> $DIR/feature-gate-abi.rs:12:1 | LL | extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to chan = help: add #![feature(intrinsics)] to the crate attributes to enable error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) - --> $DIR/feature-gate-abi.rs:21:1 + --> $DIR/feature-gate-abi.rs:13:1 | LL | extern "platform-intrinsic" fn f2() {} //~ ERROR platform intrinsics are experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | extern "platform-intrinsic" fn f2() {} //~ ERROR platform intrinsics are ex = help: add #![feature(platform_intrinsics)] to the crate attributes to enable error[E0658]: vectorcall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:22:1 + --> $DIR/feature-gate-abi.rs:14:1 | LL | extern "vectorcall" fn f3() {} //~ ERROR vectorcall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | extern "vectorcall" fn f3() {} //~ ERROR vectorcall is experimental and sub = help: add #![feature(abi_vectorcall)] to the crate attributes to enable error[E0658]: rust-call ABI is subject to change (see issue #29625) - --> $DIR/feature-gate-abi.rs:23:1 + --> $DIR/feature-gate-abi.rs:15:1 | LL | extern "rust-call" fn f4() {} //~ ERROR rust-call ABI is subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | extern "rust-call" fn f4() {} //~ ERROR rust-call ABI is subject to change = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) - --> $DIR/feature-gate-abi.rs:24:1 + --> $DIR/feature-gate-abi.rs:16:1 | LL | extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is expe = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) - --> $DIR/feature-gate-abi.rs:25:1 + --> $DIR/feature-gate-abi.rs:17:1 | LL | extern "ptx-kernel" fn f6() {} //~ ERROR PTX ABIs are experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | extern "ptx-kernel" fn f6() {} //~ ERROR PTX ABIs are experimental and subj = help: add #![feature(abi_ptx)] to the crate attributes to enable error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) - --> $DIR/feature-gate-abi.rs:26:1 + --> $DIR/feature-gate-abi.rs:18:1 | LL | extern "x86-interrupt" fn f7() {} //~ ERROR x86-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | extern "x86-interrupt" fn f7() {} //~ ERROR x86-interrupt ABI is experiment = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:27:1 + --> $DIR/feature-gate-abi.rs:19:1 | LL | extern "thiscall" fn f8() {} //~ ERROR thiscall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ LL | extern "thiscall" fn f8() {} //~ ERROR thiscall is experimental and subject = help: add #![feature(abi_thiscall)] to the crate attributes to enable error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) - --> $DIR/feature-gate-abi.rs:28:1 + --> $DIR/feature-gate-abi.rs:20:1 | LL | extern "amdgpu-kernel" fn f9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ LL | extern "amdgpu-kernel" fn f9() {} //~ ERROR amdgpu-kernel ABI is experiment = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable error[E0658]: intrinsics are subject to change - --> $DIR/feature-gate-abi.rs:32:5 + --> $DIR/feature-gate-abi.rs:24:5 | LL | extern "rust-intrinsic" fn m1(); //~ ERROR intrinsics are subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ LL | extern "rust-intrinsic" fn m1(); //~ ERROR intrinsics are subject to ch = help: add #![feature(intrinsics)] to the crate attributes to enable error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) - --> $DIR/feature-gate-abi.rs:33:5 + --> $DIR/feature-gate-abi.rs:25:5 | LL | extern "platform-intrinsic" fn m2(); //~ ERROR platform intrinsics are experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -87,7 +87,7 @@ LL | extern "platform-intrinsic" fn m2(); //~ ERROR platform intrinsics are = help: add #![feature(platform_intrinsics)] to the crate attributes to enable error[E0658]: vectorcall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:34:5 + --> $DIR/feature-gate-abi.rs:26:5 | LL | extern "vectorcall" fn m3(); //~ ERROR vectorcall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ LL | extern "vectorcall" fn m3(); //~ ERROR vectorcall is experimental and s = help: add #![feature(abi_vectorcall)] to the crate attributes to enable error[E0658]: rust-call ABI is subject to change (see issue #29625) - --> $DIR/feature-gate-abi.rs:35:5 + --> $DIR/feature-gate-abi.rs:27:5 | LL | extern "rust-call" fn m4(); //~ ERROR rust-call ABI is subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | extern "rust-call" fn m4(); //~ ERROR rust-call ABI is subject to chang = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) - --> $DIR/feature-gate-abi.rs:36:5 + --> $DIR/feature-gate-abi.rs:28:5 | LL | extern "msp430-interrupt" fn m5(); //~ ERROR msp430-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ LL | extern "msp430-interrupt" fn m5(); //~ ERROR msp430-interrupt ABI is ex = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) - --> $DIR/feature-gate-abi.rs:37:5 + --> $DIR/feature-gate-abi.rs:29:5 | LL | extern "ptx-kernel" fn m6(); //~ ERROR PTX ABIs are experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ LL | extern "ptx-kernel" fn m6(); //~ ERROR PTX ABIs are experimental and su = help: add #![feature(abi_ptx)] to the crate attributes to enable error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) - --> $DIR/feature-gate-abi.rs:38:5 + --> $DIR/feature-gate-abi.rs:30:5 | LL | extern "x86-interrupt" fn m7(); //~ ERROR x86-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -127,7 +127,7 @@ LL | extern "x86-interrupt" fn m7(); //~ ERROR x86-interrupt ABI is experime = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:39:5 + --> $DIR/feature-gate-abi.rs:31:5 | LL | extern "thiscall" fn m8(); //~ ERROR thiscall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -135,7 +135,7 @@ LL | extern "thiscall" fn m8(); //~ ERROR thiscall is experimental and subje = help: add #![feature(abi_thiscall)] to the crate attributes to enable error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) - --> $DIR/feature-gate-abi.rs:40:5 + --> $DIR/feature-gate-abi.rs:32:5 | LL | extern "amdgpu-kernel" fn m9(); //~ ERROR amdgpu-kernel ABI is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -143,7 +143,7 @@ LL | extern "amdgpu-kernel" fn m9(); //~ ERROR amdgpu-kernel ABI is experime = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable error[E0658]: intrinsics are subject to change - --> $DIR/feature-gate-abi.rs:42:5 + --> $DIR/feature-gate-abi.rs:34:5 | LL | extern "rust-intrinsic" fn dm1() {} //~ ERROR intrinsics are subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -151,7 +151,7 @@ LL | extern "rust-intrinsic" fn dm1() {} //~ ERROR intrinsics are subject to = help: add #![feature(intrinsics)] to the crate attributes to enable error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) - --> $DIR/feature-gate-abi.rs:43:5 + --> $DIR/feature-gate-abi.rs:35:5 | LL | extern "platform-intrinsic" fn dm2() {} //~ ERROR platform intrinsics are experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -159,7 +159,7 @@ LL | extern "platform-intrinsic" fn dm2() {} //~ ERROR platform intrinsics a = help: add #![feature(platform_intrinsics)] to the crate attributes to enable error[E0658]: vectorcall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:44:5 + --> $DIR/feature-gate-abi.rs:36:5 | LL | extern "vectorcall" fn dm3() {} //~ ERROR vectorcall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -167,7 +167,7 @@ LL | extern "vectorcall" fn dm3() {} //~ ERROR vectorcall is experimental an = help: add #![feature(abi_vectorcall)] to the crate attributes to enable error[E0658]: rust-call ABI is subject to change (see issue #29625) - --> $DIR/feature-gate-abi.rs:45:5 + --> $DIR/feature-gate-abi.rs:37:5 | LL | extern "rust-call" fn dm4() {} //~ ERROR rust-call ABI is subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -175,7 +175,7 @@ LL | extern "rust-call" fn dm4() {} //~ ERROR rust-call ABI is subject to ch = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) - --> $DIR/feature-gate-abi.rs:46:5 + --> $DIR/feature-gate-abi.rs:38:5 | LL | extern "msp430-interrupt" fn dm5() {} //~ ERROR msp430-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -183,7 +183,7 @@ LL | extern "msp430-interrupt" fn dm5() {} //~ ERROR msp430-interrupt ABI is = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) - --> $DIR/feature-gate-abi.rs:47:5 + --> $DIR/feature-gate-abi.rs:39:5 | LL | extern "ptx-kernel" fn dm6() {} //~ ERROR PTX ABIs are experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -191,7 +191,7 @@ LL | extern "ptx-kernel" fn dm6() {} //~ ERROR PTX ABIs are experimental and = help: add #![feature(abi_ptx)] to the crate attributes to enable error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) - --> $DIR/feature-gate-abi.rs:48:5 + --> $DIR/feature-gate-abi.rs:40:5 | LL | extern "x86-interrupt" fn dm7() {} //~ ERROR x86-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -199,7 +199,7 @@ LL | extern "x86-interrupt" fn dm7() {} //~ ERROR x86-interrupt ABI is exper = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:49:5 + --> $DIR/feature-gate-abi.rs:41:5 | LL | extern "thiscall" fn dm8() {} //~ ERROR thiscall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -207,7 +207,7 @@ LL | extern "thiscall" fn dm8() {} //~ ERROR thiscall is experimental and su = help: add #![feature(abi_thiscall)] to the crate attributes to enable error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) - --> $DIR/feature-gate-abi.rs:50:5 + --> $DIR/feature-gate-abi.rs:42:5 | LL | extern "amdgpu-kernel" fn dm9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -215,7 +215,7 @@ LL | extern "amdgpu-kernel" fn dm9() {} //~ ERROR amdgpu-kernel ABI is exper = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable error[E0658]: intrinsics are subject to change - --> $DIR/feature-gate-abi.rs:57:5 + --> $DIR/feature-gate-abi.rs:49:5 | LL | extern "rust-intrinsic" fn m1() {} //~ ERROR intrinsics are subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -223,7 +223,7 @@ LL | extern "rust-intrinsic" fn m1() {} //~ ERROR intrinsics are subject to = help: add #![feature(intrinsics)] to the crate attributes to enable error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) - --> $DIR/feature-gate-abi.rs:58:5 + --> $DIR/feature-gate-abi.rs:50:5 | LL | extern "platform-intrinsic" fn m2() {} //~ ERROR platform intrinsics are experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -231,7 +231,7 @@ LL | extern "platform-intrinsic" fn m2() {} //~ ERROR platform intrinsics ar = help: add #![feature(platform_intrinsics)] to the crate attributes to enable error[E0658]: vectorcall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:59:5 + --> $DIR/feature-gate-abi.rs:51:5 | LL | extern "vectorcall" fn m3() {} //~ ERROR vectorcall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -239,7 +239,7 @@ LL | extern "vectorcall" fn m3() {} //~ ERROR vectorcall is experimental and = help: add #![feature(abi_vectorcall)] to the crate attributes to enable error[E0658]: rust-call ABI is subject to change (see issue #29625) - --> $DIR/feature-gate-abi.rs:60:5 + --> $DIR/feature-gate-abi.rs:52:5 | LL | extern "rust-call" fn m4() {} //~ ERROR rust-call ABI is subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -247,7 +247,7 @@ LL | extern "rust-call" fn m4() {} //~ ERROR rust-call ABI is subject to cha = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) - --> $DIR/feature-gate-abi.rs:61:5 + --> $DIR/feature-gate-abi.rs:53:5 | LL | extern "msp430-interrupt" fn m5() {} //~ ERROR msp430-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -255,7 +255,7 @@ LL | extern "msp430-interrupt" fn m5() {} //~ ERROR msp430-interrupt ABI is = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) - --> $DIR/feature-gate-abi.rs:62:5 + --> $DIR/feature-gate-abi.rs:54:5 | LL | extern "ptx-kernel" fn m6() {} //~ ERROR PTX ABIs are experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -263,7 +263,7 @@ LL | extern "ptx-kernel" fn m6() {} //~ ERROR PTX ABIs are experimental and = help: add #![feature(abi_ptx)] to the crate attributes to enable error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) - --> $DIR/feature-gate-abi.rs:63:5 + --> $DIR/feature-gate-abi.rs:55:5 | LL | extern "x86-interrupt" fn m7() {} //~ ERROR x86-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -271,7 +271,7 @@ LL | extern "x86-interrupt" fn m7() {} //~ ERROR x86-interrupt ABI is experi = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:64:5 + --> $DIR/feature-gate-abi.rs:56:5 | LL | extern "thiscall" fn m8() {} //~ ERROR thiscall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -279,7 +279,7 @@ LL | extern "thiscall" fn m8() {} //~ ERROR thiscall is experimental and sub = help: add #![feature(abi_thiscall)] to the crate attributes to enable error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) - --> $DIR/feature-gate-abi.rs:65:5 + --> $DIR/feature-gate-abi.rs:57:5 | LL | extern "amdgpu-kernel" fn m9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -287,7 +287,7 @@ LL | extern "amdgpu-kernel" fn m9() {} //~ ERROR amdgpu-kernel ABI is experi = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable error[E0658]: intrinsics are subject to change - --> $DIR/feature-gate-abi.rs:70:5 + --> $DIR/feature-gate-abi.rs:62:5 | LL | extern "rust-intrinsic" fn im1() {} //~ ERROR intrinsics are subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -295,7 +295,7 @@ LL | extern "rust-intrinsic" fn im1() {} //~ ERROR intrinsics are subject to = help: add #![feature(intrinsics)] to the crate attributes to enable error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) - --> $DIR/feature-gate-abi.rs:71:5 + --> $DIR/feature-gate-abi.rs:63:5 | LL | extern "platform-intrinsic" fn im2() {} //~ ERROR platform intrinsics are experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -303,7 +303,7 @@ LL | extern "platform-intrinsic" fn im2() {} //~ ERROR platform intrinsics a = help: add #![feature(platform_intrinsics)] to the crate attributes to enable error[E0658]: vectorcall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:72:5 + --> $DIR/feature-gate-abi.rs:64:5 | LL | extern "vectorcall" fn im3() {} //~ ERROR vectorcall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -311,7 +311,7 @@ LL | extern "vectorcall" fn im3() {} //~ ERROR vectorcall is experimental an = help: add #![feature(abi_vectorcall)] to the crate attributes to enable error[E0658]: rust-call ABI is subject to change (see issue #29625) - --> $DIR/feature-gate-abi.rs:73:5 + --> $DIR/feature-gate-abi.rs:65:5 | LL | extern "rust-call" fn im4() {} //~ ERROR rust-call ABI is subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -319,7 +319,7 @@ LL | extern "rust-call" fn im4() {} //~ ERROR rust-call ABI is subject to ch = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) - --> $DIR/feature-gate-abi.rs:74:5 + --> $DIR/feature-gate-abi.rs:66:5 | LL | extern "msp430-interrupt" fn im5() {} //~ ERROR msp430-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -327,7 +327,7 @@ LL | extern "msp430-interrupt" fn im5() {} //~ ERROR msp430-interrupt ABI is = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) - --> $DIR/feature-gate-abi.rs:75:5 + --> $DIR/feature-gate-abi.rs:67:5 | LL | extern "ptx-kernel" fn im6() {} //~ ERROR PTX ABIs are experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -335,7 +335,7 @@ LL | extern "ptx-kernel" fn im6() {} //~ ERROR PTX ABIs are experimental and = help: add #![feature(abi_ptx)] to the crate attributes to enable error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) - --> $DIR/feature-gate-abi.rs:76:5 + --> $DIR/feature-gate-abi.rs:68:5 | LL | extern "x86-interrupt" fn im7() {} //~ ERROR x86-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -343,7 +343,7 @@ LL | extern "x86-interrupt" fn im7() {} //~ ERROR x86-interrupt ABI is exper = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:77:5 + --> $DIR/feature-gate-abi.rs:69:5 | LL | extern "thiscall" fn im8() {} //~ ERROR thiscall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -351,7 +351,7 @@ LL | extern "thiscall" fn im8() {} //~ ERROR thiscall is experimental and su = help: add #![feature(abi_thiscall)] to the crate attributes to enable error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) - --> $DIR/feature-gate-abi.rs:78:5 + --> $DIR/feature-gate-abi.rs:70:5 | LL | extern "amdgpu-kernel" fn im9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -359,7 +359,7 @@ LL | extern "amdgpu-kernel" fn im9() {} //~ ERROR amdgpu-kernel ABI is exper = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable error[E0658]: intrinsics are subject to change - --> $DIR/feature-gate-abi.rs:82:11 + --> $DIR/feature-gate-abi.rs:74:11 | LL | type A1 = extern "rust-intrinsic" fn(); //~ ERROR intrinsics are subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -367,7 +367,7 @@ LL | type A1 = extern "rust-intrinsic" fn(); //~ ERROR intrinsics are subject to = help: add #![feature(intrinsics)] to the crate attributes to enable error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) - --> $DIR/feature-gate-abi.rs:83:11 + --> $DIR/feature-gate-abi.rs:75:11 | LL | type A2 = extern "platform-intrinsic" fn(); //~ ERROR platform intrinsics are experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -375,7 +375,7 @@ LL | type A2 = extern "platform-intrinsic" fn(); //~ ERROR platform intrinsics a = help: add #![feature(platform_intrinsics)] to the crate attributes to enable error[E0658]: vectorcall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:84:11 + --> $DIR/feature-gate-abi.rs:76:11 | LL | type A3 = extern "vectorcall" fn(); //~ ERROR vectorcall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -383,7 +383,7 @@ LL | type A3 = extern "vectorcall" fn(); //~ ERROR vectorcall is experimental an = help: add #![feature(abi_vectorcall)] to the crate attributes to enable error[E0658]: rust-call ABI is subject to change (see issue #29625) - --> $DIR/feature-gate-abi.rs:85:11 + --> $DIR/feature-gate-abi.rs:77:11 | LL | type A4 = extern "rust-call" fn(); //~ ERROR rust-call ABI is subject to change | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -391,7 +391,7 @@ LL | type A4 = extern "rust-call" fn(); //~ ERROR rust-call ABI is subject to ch = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) - --> $DIR/feature-gate-abi.rs:86:11 + --> $DIR/feature-gate-abi.rs:78:11 | LL | type A5 = extern "msp430-interrupt" fn(); //~ ERROR msp430-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -399,7 +399,7 @@ LL | type A5 = extern "msp430-interrupt" fn(); //~ ERROR msp430-interrupt ABI is = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) - --> $DIR/feature-gate-abi.rs:87:11 + --> $DIR/feature-gate-abi.rs:79:11 | LL | type A6 = extern "ptx-kernel" fn (); //~ ERROR PTX ABIs are experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -407,7 +407,7 @@ LL | type A6 = extern "ptx-kernel" fn (); //~ ERROR PTX ABIs are experimental an = help: add #![feature(abi_ptx)] to the crate attributes to enable error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) - --> $DIR/feature-gate-abi.rs:88:11 + --> $DIR/feature-gate-abi.rs:80:11 | LL | type A7 = extern "x86-interrupt" fn(); //~ ERROR x86-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -415,7 +415,7 @@ LL | type A7 = extern "x86-interrupt" fn(); //~ ERROR x86-interrupt ABI is exper = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:89:11 + --> $DIR/feature-gate-abi.rs:81:11 | LL | type A8 = extern "thiscall" fn(); //~ ERROR thiscall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^ @@ -423,7 +423,7 @@ LL | type A8 = extern "thiscall" fn(); //~ ERROR thiscall is experimental and su = help: add #![feature(abi_thiscall)] to the crate attributes to enable error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) - --> $DIR/feature-gate-abi.rs:90:11 + --> $DIR/feature-gate-abi.rs:82:11 | LL | type A9 = extern "amdgpu-kernel" fn(); //~ ERROR amdgpu-kernel ABI is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -431,7 +431,7 @@ LL | type A9 = extern "amdgpu-kernel" fn(); //~ ERROR amdgpu-kernel ABI is exper = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable error[E0658]: intrinsics are subject to change - --> $DIR/feature-gate-abi.rs:93:1 + --> $DIR/feature-gate-abi.rs:85:1 | LL | extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -439,7 +439,7 @@ LL | extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change = help: add #![feature(intrinsics)] to the crate attributes to enable error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) - --> $DIR/feature-gate-abi.rs:94:1 + --> $DIR/feature-gate-abi.rs:86:1 | LL | extern "platform-intrinsic" {} //~ ERROR platform intrinsics are experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -447,7 +447,7 @@ LL | extern "platform-intrinsic" {} //~ ERROR platform intrinsics are experiment = help: add #![feature(platform_intrinsics)] to the crate attributes to enable error[E0658]: vectorcall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:95:1 + --> $DIR/feature-gate-abi.rs:87:1 | LL | extern "vectorcall" {} //~ ERROR vectorcall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^ @@ -455,7 +455,7 @@ LL | extern "vectorcall" {} //~ ERROR vectorcall is experimental and subject to = help: add #![feature(abi_vectorcall)] to the crate attributes to enable error[E0658]: rust-call ABI is subject to change (see issue #29625) - --> $DIR/feature-gate-abi.rs:96:1 + --> $DIR/feature-gate-abi.rs:88:1 | LL | extern "rust-call" {} //~ ERROR rust-call ABI is subject to change | ^^^^^^^^^^^^^^^^^^^^^ @@ -463,7 +463,7 @@ LL | extern "rust-call" {} //~ ERROR rust-call ABI is subject to change = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) - --> $DIR/feature-gate-abi.rs:97:1 + --> $DIR/feature-gate-abi.rs:89:1 | LL | extern "msp430-interrupt" {} //~ ERROR msp430-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -471,7 +471,7 @@ LL | extern "msp430-interrupt" {} //~ ERROR msp430-interrupt ABI is experimental = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) - --> $DIR/feature-gate-abi.rs:98:1 + --> $DIR/feature-gate-abi.rs:90:1 | LL | extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^ @@ -479,7 +479,7 @@ LL | extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental and subject to c = help: add #![feature(abi_ptx)] to the crate attributes to enable error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) - --> $DIR/feature-gate-abi.rs:99:1 + --> $DIR/feature-gate-abi.rs:91:1 | LL | extern "x86-interrupt" {} //~ ERROR x86-interrupt ABI is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -487,7 +487,7 @@ LL | extern "x86-interrupt" {} //~ ERROR x86-interrupt ABI is experimental = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable error[E0658]: thiscall is experimental and subject to change - --> $DIR/feature-gate-abi.rs:100:1 + --> $DIR/feature-gate-abi.rs:92:1 | LL | extern "thiscall" {} //~ ERROR thiscall is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^ @@ -495,7 +495,7 @@ LL | extern "thiscall" {} //~ ERROR thiscall is experimental and subject to chan = help: add #![feature(abi_thiscall)] to the crate attributes to enable error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) - --> $DIR/feature-gate-abi.rs:101:1 + --> $DIR/feature-gate-abi.rs:93:1 | LL | extern "amdgpu-kernel" {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-abi_unadjusted.rs b/src/test/ui/feature-gates/feature-gate-abi_unadjusted.rs index 501f4451ed8..35a7d73288b 100644 --- a/src/test/ui/feature-gates/feature-gate-abi_unadjusted.rs +++ b/src/test/ui/feature-gates/feature-gate-abi_unadjusted.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern "unadjusted" fn foo() { //~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable } diff --git a/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr b/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr index 467102d1847..707b6bc75b1 100644 --- a/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr +++ b/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr @@ -1,5 +1,5 @@ error[E0658]: unadjusted ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi_unadjusted.rs:11:1 + --> $DIR/feature-gate-abi_unadjusted.rs:1:1 | LL | / extern "unadjusted" fn foo() { LL | | //~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable diff --git a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs index 66691af2d03..daa2bb5d6fa 100644 --- a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs +++ b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort #![no_std] @@ -19,3 +9,6 @@ use core::alloc::Layout; fn oom(info: Layout) -> ! { loop {} } + +#[panic_handler] +fn panic(_: &core::panic::PanicInfo) -> ! { loop {} } diff --git a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr index 255d5b06c17..c20b21fa43d 100644 --- a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr +++ b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr @@ -1,5 +1,5 @@ error[E0658]: #[alloc_error_handler] is an unstable feature (see issue #51540) - --> $DIR/feature-gate-alloc-error-handler.rs:18:1 + --> $DIR/feature-gate-alloc-error-handler.rs:8:1 | LL | #[alloc_error_handler] //~ ERROR #[alloc_error_handler] is an unstable feature (see issue #51540) | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-allocator_internals.rs b/src/test/ui/feature-gates/feature-gate-allocator_internals.rs index b519a985ec5..2045857e4cb 100644 --- a/src/test/ui/feature-gates/feature-gate-allocator_internals.rs +++ b/src/test/ui/feature-gates/feature-gate-allocator_internals.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![default_lib_allocator] //~ ERROR: attribute is an experimental feature fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr b/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr index a9667e8011a..5103b7214f5 100644 --- a/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr +++ b/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[default_lib_allocator]` attribute is an experimental feature - --> $DIR/feature-gate-allocator_internals.rs:11:1 + --> $DIR/feature-gate-allocator_internals.rs:1:1 | LL | #![default_lib_allocator] //~ ERROR: attribute is an experimental feature | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.rs b/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.rs index 590dc619f2f..9f604aafdf8 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.rs +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-allow_internal_unsafe #![allow(unused_macros)] diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr index 97e41411854..1cadfb28214 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr @@ -1,5 +1,5 @@ error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint - --> $DIR/feature-gate-allow-internal-unsafe-nested-macro.rs:18:9 + --> $DIR/feature-gate-allow-internal-unsafe-nested-macro.rs:8:9 | LL | #[allow_internal_unsafe] //~ ERROR allow_internal_unsafe side-steps | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.rs b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.rs index 9af501b1419..cf320b2747c 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.rs +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-allow_internal_unstable #![allow(unused_macros)] diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr index 2ecaaae89d1..7cdf743b279 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr @@ -1,5 +1,5 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks - --> $DIR/feature-gate-allow-internal-unstable-nested-macro.rs:18:9 + --> $DIR/feature-gate-allow-internal-unstable-nested-macro.rs:8:9 | LL | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs index b186278ef8b..c9ea6c338b5 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // checks that this attribute is caught on non-macro items. // this needs a different test since this is done after expansion diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr index 4ff5162b0c0..485c00ad42b 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr @@ -1,5 +1,5 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks - --> $DIR/feature-gate-allow-internal-unstable-struct.rs:14:1 + --> $DIR/feature-gate-allow-internal-unstable-struct.rs:4:1 | LL | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.rs b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.rs index 61a362cb37f..bea60fc012e 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.rs +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_macros)] #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr index b691eed60d3..0533d071de3 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr @@ -1,5 +1,5 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks - --> $DIR/feature-gate-allow-internal-unstable.rs:13:1 + --> $DIR/feature-gate-allow-internal-unstable.rs:3:1 | LL | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-allow_fail.rs b/src/test/ui/feature-gates/feature-gate-allow_fail.rs index 11247402809..f9ad4855141 100644 --- a/src/test/ui/feature-gates/feature-gate-allow_fail.rs +++ b/src/test/ui/feature-gates/feature-gate-allow_fail.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that #[allow_fail] is feature-gated #[allow_fail] //~ ERROR allow_fail attribute is currently unstable @@ -15,3 +5,4 @@ fn ok_to_fail() { assert!(false); } +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-allow_fail.stderr b/src/test/ui/feature-gates/feature-gate-allow_fail.stderr index 736fad44b8b..18c7ac9c3c9 100644 --- a/src/test/ui/feature-gates/feature-gate-allow_fail.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow_fail.stderr @@ -1,5 +1,5 @@ error[E0658]: allow_fail attribute is currently unstable (see issue #46488) - --> $DIR/feature-gate-allow_fail.rs:13:1 + --> $DIR/feature-gate-allow_fail.rs:3:1 | LL | #[allow_fail] //~ ERROR allow_fail attribute is currently unstable | ^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs index ff0306f1993..6e0b71bc1ee 100644 --- a/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs +++ b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs @@ -1,27 +1,29 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::rc::Rc; +use std::{ + ops::Deref, +}; + +struct Ptr(Box); + +impl Deref for Ptr { + type Target = T; + + fn deref(&self) -> &T { + &*self.0 + } +} trait Foo { - fn foo(self: Rc>); //~ ERROR arbitrary `self` types are unstable + fn foo(self: Ptr); //~ ERROR `Ptr` cannot be used as the type of `self` without } struct Bar; impl Foo for Bar { - fn foo(self: Rc>) {} //~ ERROR arbitrary `self` types are unstable + fn foo(self: Ptr) {} //~ ERROR `Ptr` cannot be used as the type of `self` without } impl Bar { - fn bar(self: Box>) {} //~ ERROR arbitrary `self` types are unstable + fn bar(self: Box>) {} //~ ERROR `std::boxed::Box>` cannot be used as the } fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr index ea259aa22ad..8ec3c682850 100644 --- a/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr +++ b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr @@ -1,26 +1,26 @@ -error[E0658]: arbitrary `self` types are unstable (see issue #44874) - --> $DIR/feature-gate-arbitrary-self-types.rs:14:18 +error[E0658]: `Ptr` cannot be used as the type of `self` without the `arbitrary_self_types` feature (see issue #44874) + --> $DIR/feature-gate-arbitrary-self-types.rs:16:18 | -LL | fn foo(self: Rc>); //~ ERROR arbitrary `self` types are unstable - | ^^^^^^^^^^^^^ +LL | fn foo(self: Ptr); //~ ERROR `Ptr` cannot be used as the type of `self` without + | ^^^^^^^^^ | = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box` -error[E0658]: arbitrary `self` types are unstable (see issue #44874) - --> $DIR/feature-gate-arbitrary-self-types.rs:20:18 +error[E0658]: `Ptr` cannot be used as the type of `self` without the `arbitrary_self_types` feature (see issue #44874) + --> $DIR/feature-gate-arbitrary-self-types.rs:22:18 | -LL | fn foo(self: Rc>) {} //~ ERROR arbitrary `self` types are unstable - | ^^^^^^^^^^^^^ +LL | fn foo(self: Ptr) {} //~ ERROR `Ptr` cannot be used as the type of `self` without + | ^^^^^^^^^ | = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box` -error[E0658]: arbitrary `self` types are unstable (see issue #44874) - --> $DIR/feature-gate-arbitrary-self-types.rs:24:18 +error[E0658]: `std::boxed::Box>` cannot be used as the type of `self` without the `arbitrary_self_types` feature (see issue #44874) + --> $DIR/feature-gate-arbitrary-self-types.rs:26:18 | -LL | fn bar(self: Box>) {} //~ ERROR arbitrary `self` types are unstable - | ^^^^^^^^^^^^^ +LL | fn bar(self: Box>) {} //~ ERROR `std::boxed::Box>` cannot be used as the + | ^^^^^^^^^^^^^^ | = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box` diff --git a/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.rs b/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.rs index 29e51727edc..f7e94117e12 100644 --- a/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.rs +++ b/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.rs @@ -1,28 +1,18 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; impl Foo { fn foo(self: *const Self) {} - //~^ ERROR raw pointer `self` is unstable + //~^ ERROR `*const Foo` cannot be used as the type of `self` without } trait Bar { fn bar(self: *const Self); - //~^ ERROR raw pointer `self` is unstable + //~^ ERROR `*const Self` cannot be used as the type of `self` without } impl Bar for () { fn bar(self: *const Self) {} - //~^ ERROR raw pointer `self` is unstable + //~^ ERROR `*const ()` cannot be used as the type of `self` without } fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr b/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr index 5ed9a0f4ed0..f35438f42f4 100644 --- a/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr +++ b/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr @@ -1,5 +1,5 @@ -error[E0658]: raw pointer `self` is unstable (see issue #44874) - --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:19:18 +error[E0658]: `*const Self` cannot be used as the type of `self` without the `arbitrary_self_types` feature (see issue #44874) + --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:9:18 | LL | fn bar(self: *const Self); | ^^^^^^^^^^^ @@ -7,8 +7,8 @@ LL | fn bar(self: *const Self); = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box` -error[E0658]: raw pointer `self` is unstable (see issue #44874) - --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:14:18 +error[E0658]: `*const Foo` cannot be used as the type of `self` without the `arbitrary_self_types` feature (see issue #44874) + --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:4:18 | LL | fn foo(self: *const Self) {} | ^^^^^^^^^^^ @@ -16,8 +16,8 @@ LL | fn foo(self: *const Self) {} = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box` -error[E0658]: raw pointer `self` is unstable (see issue #44874) - --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:24:18 +error[E0658]: `*const ()` cannot be used as the type of `self` without the `arbitrary_self_types` feature (see issue #44874) + --> $DIR/feature-gate-arbitrary_self_types-raw-pointer.rs:14:18 | LL | fn bar(self: *const Self) {} | ^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-asm.rs b/src/test/ui/feature-gates/feature-gate-asm.rs index 8d053bdae78..572d9f26cae 100644 --- a/src/test/ui/feature-gates/feature-gate-asm.rs +++ b/src/test/ui/feature-gates/feature-gate-asm.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { unsafe { asm!(""); //~ ERROR inline assembly is not stable enough diff --git a/src/test/ui/feature-gates/feature-gate-asm.stderr b/src/test/ui/feature-gates/feature-gate-asm.stderr index 3fab7c0ece5..eee38e12c2a 100644 --- a/src/test/ui/feature-gates/feature-gate-asm.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm.stderr @@ -1,5 +1,5 @@ error[E0658]: inline assembly is not stable enough for use and is subject to change (see issue #29722) - --> $DIR/feature-gate-asm.rs:13:9 + --> $DIR/feature-gate-asm.rs:3:9 | LL | asm!(""); //~ ERROR inline assembly is not stable enough | ^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-asm2.rs b/src/test/ui/feature-gates/feature-gate-asm2.rs index 222190de9fe..259b0a14e5c 100644 --- a/src/test/ui/feature-gates/feature-gate-asm2.rs +++ b/src/test/ui/feature-gates/feature-gate-asm2.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-asm fn main() { unsafe { - println!("{}", asm!("")); //~ ERROR inline assembly is not stable + println!("{:?}", asm!("")); //~ ERROR inline assembly is not stable } } diff --git a/src/test/ui/feature-gates/feature-gate-asm2.stderr b/src/test/ui/feature-gates/feature-gate-asm2.stderr index a0e881a3b99..fc4aa57718c 100644 --- a/src/test/ui/feature-gates/feature-gate-asm2.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm2.stderr @@ -1,8 +1,8 @@ error[E0658]: inline assembly is not stable enough for use and is subject to change (see issue #29722) - --> $DIR/feature-gate-asm2.rs:15:24 + --> $DIR/feature-gate-asm2.rs:5:26 | -LL | println!("{}", asm!("")); //~ ERROR inline assembly is not stable - | ^^^^^^^^ +LL | println!("{:?}", asm!("")); //~ ERROR inline assembly is not stable + | ^^^^^^^^ | = help: add #![feature(asm)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.rs b/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.rs index de3521eb0f2..d7c6a9f97ad 100644 --- a/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.rs +++ b/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-associated_type_defaults trait Foo { diff --git a/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr b/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr index 86431842a83..a23962fe318 100644 --- a/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr +++ b/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr @@ -1,5 +1,5 @@ error[E0658]: associated type defaults are unstable (see issue #29661) - --> $DIR/feature-gate-assoc-type-defaults.rs:14:5 + --> $DIR/feature-gate-assoc-type-defaults.rs:4:5 | LL | type Bar = u8; //~ ERROR associated type defaults are unstable | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs index 5b865e9c1c7..84dd1b9f814 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs +++ b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2015 #![feature(futures_api)] @@ -16,5 +6,5 @@ async fn foo() {} //~ ERROR async fn is unstable fn main() { let _ = async {}; //~ ERROR cannot find struct, variant or union type `async` - let _ = async || {}; //~ ERROR cannot find value `async` in this scope + let _ = async || { true }; //~ ERROR cannot find value `async` in this scope } diff --git a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr index 3db90a48e90..450b2c42f11 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr +++ b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr @@ -1,17 +1,17 @@ error[E0422]: cannot find struct, variant or union type `async` in this scope - --> $DIR/feature-gate-async-await-2015-edition.rs:18:13 + --> $DIR/feature-gate-async-await-2015-edition.rs:8:13 | LL | let _ = async {}; //~ ERROR cannot find struct, variant or union type `async` | ^^^^^ not found in this scope error[E0425]: cannot find value `async` in this scope - --> $DIR/feature-gate-async-await-2015-edition.rs:19:13 + --> $DIR/feature-gate-async-await-2015-edition.rs:9:13 | -LL | let _ = async || {}; //~ ERROR cannot find value `async` in this scope +LL | let _ = async || { true }; //~ ERROR cannot find value `async` in this scope | ^^^^^ not found in this scope error[E0658]: async fn is unstable (see issue #50547) - --> $DIR/feature-gate-async-await-2015-edition.rs:15:1 + --> $DIR/feature-gate-async-await-2015-edition.rs:5:1 | LL | async fn foo() {} //~ ERROR async fn is unstable | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-async-await.rs b/src/test/ui/feature-gates/feature-gate-async-await.rs index be34842dea3..7ee035644bc 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await.rs +++ b/src/test/ui/feature-gates/feature-gate-async-await.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 #![feature(futures_api)] diff --git a/src/test/ui/feature-gates/feature-gate-async-await.stderr b/src/test/ui/feature-gates/feature-gate-async-await.stderr index 79ed5c4d008..3a3165ba3e6 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await.stderr +++ b/src/test/ui/feature-gates/feature-gate-async-await.stderr @@ -1,5 +1,5 @@ error[E0658]: async fn is unstable (see issue #50547) - --> $DIR/feature-gate-async-await.rs:15:1 + --> $DIR/feature-gate-async-await.rs:5:1 | LL | async fn foo() {} //~ ERROR async fn is unstable | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | async fn foo() {} //~ ERROR async fn is unstable = help: add #![feature(async_await)] to the crate attributes to enable error[E0658]: async blocks are unstable (see issue #50547) - --> $DIR/feature-gate-async-await.rs:18:13 + --> $DIR/feature-gate-async-await.rs:8:13 | LL | let _ = async {}; //~ ERROR async blocks are unstable | ^^^^^^^^ @@ -15,7 +15,7 @@ LL | let _ = async {}; //~ ERROR async blocks are unstable = help: add #![feature(async_await)] to the crate attributes to enable error[E0658]: async closures are unstable (see issue #50547) - --> $DIR/feature-gate-async-await.rs:19:13 + --> $DIR/feature-gate-async-await.rs:9:13 | LL | let _ = async || {}; //~ ERROR async closures are unstable | ^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-box-expr.rs b/src/test/ui/feature-gates/feature-gate-box-expr.rs index 65d437d0c0d..870253d2f05 100644 --- a/src/test/ui/feature-gates/feature-gate-box-expr.rs +++ b/src/test/ui/feature-gates/feature-gate-box-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-box_syntax // Check that `box EXPR` is feature-gated. diff --git a/src/test/ui/feature-gates/feature-gate-box-expr.stderr b/src/test/ui/feature-gates/feature-gate-box-expr.stderr index 7b235da7ed7..9ebff2e044c 100644 --- a/src/test/ui/feature-gates/feature-gate-box-expr.stderr +++ b/src/test/ui/feature-gates/feature-gate-box-expr.stderr @@ -1,5 +1,5 @@ error[E0658]: box expression syntax is experimental; you can call `Box::new` instead. (see issue #49733) - --> $DIR/feature-gate-box-expr.rs:22:13 + --> $DIR/feature-gate-box-expr.rs:12:13 | LL | let x = box 'c'; //~ ERROR box expression syntax is experimental | ^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-box_patterns.rs b/src/test/ui/feature-gates/feature-gate-box_patterns.rs index e64081823e7..8bec16a974e 100644 --- a/src/test/ui/feature-gates/feature-gate-box_patterns.rs +++ b/src/test/ui/feature-gates/feature-gate-box_patterns.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental println!("x: {}", x); diff --git a/src/test/ui/feature-gates/feature-gate-box_patterns.stderr b/src/test/ui/feature-gates/feature-gate-box_patterns.stderr index a8edb842cfc..1379ba526f5 100644 --- a/src/test/ui/feature-gates/feature-gate-box_patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-box_patterns.stderr @@ -1,5 +1,5 @@ error[E0658]: box pattern syntax is experimental (see issue #29641) - --> $DIR/feature-gate-box_patterns.rs:12:9 + --> $DIR/feature-gate-box_patterns.rs:2:9 | LL | let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental | ^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-box_syntax.rs b/src/test/ui/feature-gates/feature-gate-box_syntax.rs index a2643fe02b8..df0c604b2a8 100644 --- a/src/test/ui/feature-gates/feature-gate-box_syntax.rs +++ b/src/test/ui/feature-gates/feature-gate-box_syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the use of the box syntax is gated by `box_syntax` feature gate. fn main() { diff --git a/src/test/ui/feature-gates/feature-gate-box_syntax.stderr b/src/test/ui/feature-gates/feature-gate-box_syntax.stderr index d45dee2970b..f144d11d89b 100644 --- a/src/test/ui/feature-gates/feature-gate-box_syntax.stderr +++ b/src/test/ui/feature-gates/feature-gate-box_syntax.stderr @@ -1,5 +1,5 @@ error[E0658]: box expression syntax is experimental; you can call `Box::new` instead. (see issue #49733) - --> $DIR/feature-gate-box_syntax.rs:14:13 + --> $DIR/feature-gate-box_syntax.rs:4:13 | LL | let x = box 3; | ^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-1.rs b/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-1.rs deleted file mode 100644 index 9515380bc28..00000000000 --- a/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-1.rs +++ /dev/null @@ -1,5 +0,0 @@ -// gate-test-cfg_attr_multi - -#![cfg_attr(all(), warn(nonstandard_style), allow(unused_attributes))] -//~^ ERROR cfg_attr with zero or more than one attributes is experimental -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-1.stderr b/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-1.stderr deleted file mode 100644 index 088e6df1a1a..00000000000 --- a/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-1.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: cfg_attr with zero or more than one attributes is experimental (see issue #54881) - --> $DIR/feature-gate-cfg-attr-multi-1.rs:3:1 - | -LL | #![cfg_attr(all(), warn(nonstandard_style), allow(unused_attributes))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(cfg_attr_multi)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-2.rs b/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-2.rs deleted file mode 100644 index cf02432274b..00000000000 --- a/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-2.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![cfg_attr(all(),)] -//~^ ERROR cfg_attr with zero or more than one attributes is experimental -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-2.stderr b/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-2.stderr deleted file mode 100644 index a01876114dd..00000000000 --- a/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: cfg_attr with zero or more than one attributes is experimental (see issue #54881) - --> $DIR/feature-gate-cfg-attr-multi-2.rs:1:1 - | -LL | #![cfg_attr(all(),)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(cfg_attr_multi)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-bootstrap-1.rs b/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-bootstrap-1.rs deleted file mode 100644 index e4737926e7a..00000000000 --- a/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-bootstrap-1.rs +++ /dev/null @@ -1,7 +0,0 @@ -// Test that settingt the featute gate while using its functionality doesn't error. - -// compile-pass - -#![cfg_attr(all(), feature(cfg_attr_multi), crate_type="bin")] - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-bootstrap-2.rs b/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-bootstrap-2.rs deleted file mode 100644 index df740541f55..00000000000 --- a/src/test/ui/feature-gates/feature-gate-cfg-attr-multi-bootstrap-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -// Test that settingt the featute gate while using its functionality doesn't error. -// Specifically, if there's a cfg-attr *before* the feature gate. - -// compile-pass - -#![cfg_attr(all(),)] -#![cfg_attr(all(), feature(cfg_attr_multi), crate_type="bin")] - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs b/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs index 6b70c1ea294..db1a7dad06b 100644 --- a/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs +++ b/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs @@ -1,12 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#![feature(intrinsics, lang_items, no_core)] #![crate_type="rlib"] #![no_core] diff --git a/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.stderr b/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.stderr index 81f20112a12..a2d5669bcdc 100644 --- a/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.stderr +++ b/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.stderr @@ -1,5 +1,5 @@ error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:23:7 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:15:7 | LL | #[cfg(target_has_atomic = "8")] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #[cfg(target_has_atomic = "8")] = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:29:7 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:21:7 | LL | #[cfg(target_has_atomic = "8")] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | #[cfg(target_has_atomic = "8")] = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:34:7 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:26:7 | LL | #[cfg(target_has_atomic = "16")] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | #[cfg(target_has_atomic = "16")] = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:39:7 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:31:7 | LL | #[cfg(target_has_atomic = "16")] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | #[cfg(target_has_atomic = "16")] = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:44:7 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:36:7 | LL | #[cfg(target_has_atomic = "32")] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | #[cfg(target_has_atomic = "32")] = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:49:7 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:41:7 | LL | #[cfg(target_has_atomic = "32")] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | #[cfg(target_has_atomic = "32")] = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:54:7 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:46:7 | LL | #[cfg(target_has_atomic = "64")] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | #[cfg(target_has_atomic = "64")] = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:59:7 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:51:7 | LL | #[cfg(target_has_atomic = "64")] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ LL | #[cfg(target_has_atomic = "64")] = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:64:7 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:56:7 | LL | #[cfg(target_has_atomic = "128")] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ LL | #[cfg(target_has_atomic = "128")] = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:69:7 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:61:7 | LL | #[cfg(target_has_atomic = "128")] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ LL | #[cfg(target_has_atomic = "128")] = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:74:7 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:66:7 | LL | #[cfg(target_has_atomic = "ptr")] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -87,7 +87,7 @@ LL | #[cfg(target_has_atomic = "ptr")] = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:79:7 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:71:7 | LL | #[cfg(target_has_atomic = "ptr")] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ LL | #[cfg(target_has_atomic = "ptr")] = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:86:10 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:78:10 | LL | cfg!(target_has_atomic = "8"); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | cfg!(target_has_atomic = "8"); = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:88:10 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:80:10 | LL | cfg!(target_has_atomic = "16"); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ LL | cfg!(target_has_atomic = "16"); = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:90:10 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:82:10 | LL | cfg!(target_has_atomic = "32"); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ LL | cfg!(target_has_atomic = "32"); = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:92:10 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:84:10 | LL | cfg!(target_has_atomic = "64"); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -127,7 +127,7 @@ LL | cfg!(target_has_atomic = "64"); = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:94:10 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:86:10 | LL | cfg!(target_has_atomic = "128"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -135,7 +135,7 @@ LL | cfg!(target_has_atomic = "128"); = help: add #![feature(cfg_target_has_atomic)] to the crate attributes to enable error[E0658]: `cfg(target_has_atomic)` is experimental and subject to change (see issue #32976) - --> $DIR/feature-gate-cfg-target-has-atomic.rs:96:10 + --> $DIR/feature-gate-cfg-target-has-atomic.rs:88:10 | LL | cfg!(target_has_atomic = "ptr"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.rs b/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.rs index 985bd8320e0..54db7500583 100644 --- a/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.rs +++ b/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows // aux-build:cfg-target-thread-local.rs diff --git a/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.stderr b/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.stderr index 3467d4e482d..672fb14871a 100644 --- a/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.stderr +++ b/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.stderr @@ -1,5 +1,5 @@ error[E0658]: `cfg(target_thread_local)` is experimental and subject to change (see issue #29594) - --> $DIR/feature-gate-cfg-target-thread-local.rs:19:16 + --> $DIR/feature-gate-cfg-target-thread-local.rs:9:16 | LL | #[cfg_attr(target_thread_local, thread_local)] | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.rs b/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.rs deleted file mode 100644 index e68a84d3553..00000000000 --- a/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[cfg(target_vendor = "x")] //~ ERROR `cfg(target_vendor)` is experimental -#[cfg_attr(target_vendor = "x", x)] //~ ERROR `cfg(target_vendor)` is experimental -struct Foo(u64, u64); - -#[cfg(not(any(all(target_vendor = "x"))))] //~ ERROR `cfg(target_vendor)` is experimental -fn foo() {} - -fn main() { - cfg!(target_vendor = "x"); - //~^ ERROR `cfg(target_vendor)` is experimental and subject to change -} diff --git a/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.stderr b/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.stderr deleted file mode 100644 index a625c7e4b24..00000000000 --- a/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718) - --> $DIR/feature-gate-cfg-target-vendor.rs:12:12 - | -LL | #[cfg_attr(target_vendor = "x", x)] //~ ERROR `cfg(target_vendor)` is experimental - | ^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable - -error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718) - --> $DIR/feature-gate-cfg-target-vendor.rs:11:7 - | -LL | #[cfg(target_vendor = "x")] //~ ERROR `cfg(target_vendor)` is experimental - | ^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable - -error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718) - --> $DIR/feature-gate-cfg-target-vendor.rs:15:19 - | -LL | #[cfg(not(any(all(target_vendor = "x"))))] //~ ERROR `cfg(target_vendor)` is experimental - | ^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable - -error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718) - --> $DIR/feature-gate-cfg-target-vendor.rs:19:10 - | -LL | cfg!(target_vendor = "x"); - | ^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(cfg_target_vendor)] to the crate attributes to enable - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-compiler-builtins.rs b/src/test/ui/feature-gates/feature-gate-compiler-builtins.rs index f9334f1d3b0..10a9749ee5c 100644 --- a/src/test/ui/feature-gates/feature-gate-compiler-builtins.rs +++ b/src/test/ui/feature-gates/feature-gate-compiler-builtins.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![compiler_builtins] //~ ERROR the `#[compiler_builtins]` attribute is fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr b/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr index 5330d83c284..5bda76e2bfe 100644 --- a/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr +++ b/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate which contains compiler-rt intrinsics and will never be stable - --> $DIR/feature-gate-compiler-builtins.rs:11:1 + --> $DIR/feature-gate-compiler-builtins.rs:1:1 | LL | #![compiler_builtins] //~ ERROR the `#[compiler_builtins]` attribute is | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents.rs b/src/test/ui/feature-gates/feature-gate-concat_idents.rs index f4d97445725..68caf3d71e9 100644 --- a/src/test/ui/feature-gates/feature-gate-concat_idents.rs +++ b/src/test/ui/feature-gates/feature-gate-concat_idents.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const XY_1: i32 = 10; fn main() { diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents.stderr index 2f1e3fe6a7d..d465512527a 100644 --- a/src/test/ui/feature-gates/feature-gate-concat_idents.stderr +++ b/src/test/ui/feature-gates/feature-gate-concat_idents.stderr @@ -1,5 +1,5 @@ error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) - --> $DIR/feature-gate-concat_idents.rs:15:13 + --> $DIR/feature-gate-concat_idents.rs:5:13 | LL | let a = concat_idents!(X, Y_1); //~ ERROR `concat_idents` is not stable | ^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | let a = concat_idents!(X, Y_1); //~ ERROR `concat_idents` is not stable = help: add #![feature(concat_idents)] to the crate attributes to enable error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) - --> $DIR/feature-gate-concat_idents.rs:16:13 + --> $DIR/feature-gate-concat_idents.rs:6:13 | LL | let b = concat_idents!(X, Y_2); //~ ERROR `concat_idents` is not stable | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents2.rs b/src/test/ui/feature-gates/feature-gate-concat_idents2.rs index af288a97904..0cc6c577e8d 100644 --- a/src/test/ui/feature-gates/feature-gate-concat_idents2.rs +++ b/src/test/ui/feature-gates/feature-gate-concat_idents2.rs @@ -1,15 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-concat_idents fn main() { concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough + //~| ERROR cannot find value `ab` in this scope } diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr index 9312a6f5b36..cae409019f7 100644 --- a/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr +++ b/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr @@ -1,11 +1,18 @@ error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) - --> $DIR/feature-gate-concat_idents2.rs:14:5 + --> $DIR/feature-gate-concat_idents2.rs:4:5 | LL | concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(concat_idents)] to the crate attributes to enable -error: aborting due to previous error +error[E0425]: cannot find value `ab` in this scope + --> $DIR/feature-gate-concat_idents2.rs:4:5 + | +LL | concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough + | ^^^^^^^^^^^^^^^^^^^^^ not found in this scope + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0425, E0658. +For more information about an error, try `rustc --explain E0425`. diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents3.rs b/src/test/ui/feature-gates/feature-gate-concat_idents3.rs index 5a9ffe98c93..2882e7a8008 100644 --- a/src/test/ui/feature-gates/feature-gate-concat_idents3.rs +++ b/src/test/ui/feature-gates/feature-gate-concat_idents3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-concat_idents const XY_1: i32 = 10; diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr index 1a86032d8a3..e9b9f240e8c 100644 --- a/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr +++ b/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr @@ -1,5 +1,5 @@ error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) - --> $DIR/feature-gate-concat_idents3.rs:17:20 + --> $DIR/feature-gate-concat_idents3.rs:7:20 | LL | assert_eq!(10, concat_idents!(X, Y_1)); //~ ERROR `concat_idents` is not stable | ^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | assert_eq!(10, concat_idents!(X, Y_1)); //~ ERROR `concat_idents` is no = help: add #![feature(concat_idents)] to the crate attributes to enable error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) - --> $DIR/feature-gate-concat_idents3.rs:18:20 + --> $DIR/feature-gate-concat_idents3.rs:8:20 | LL | assert_eq!(20, concat_idents!(X, Y_2)); //~ ERROR `concat_idents` is not stable | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-const-indexing.rs b/src/test/ui/feature-gates/feature-gate-const-indexing.rs index c89cbd0420d..4df1c7d6ed2 100644 --- a/src/test/ui/feature-gates/feature-gate-const-indexing.rs +++ b/src/test/ui/feature-gates/feature-gate-const-indexing.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass fn main() { diff --git a/src/test/ui/feature-gates/feature-gate-const_fn.rs b/src/test/ui/feature-gates/feature-gate-const_fn.rs index e52331fa92a..f46d1dc13d3 100644 --- a/src/test/ui/feature-gates/feature-gate-const_fn.rs +++ b/src/test/ui/feature-gates/feature-gate-const_fn.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test use of advanced const fn without the `const_fn` feature gate. const fn foo() -> usize { 0 } // ok @@ -19,14 +9,16 @@ trait Foo { //~| ERROR trait fns cannot be declared const } -impl Foo { - const fn baz() -> u32 { 0 } // ok -} - impl Foo for u32 { const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const } +trait Bar {} + +impl dyn Bar { + const fn baz() -> u32 { 0 } // ok +} + static FOO: usize = foo(); const BAR: usize = foo(); diff --git a/src/test/ui/feature-gates/feature-gate-const_fn.stderr b/src/test/ui/feature-gates/feature-gate-const_fn.stderr index 150a702d105..be5237fbfcf 100644 --- a/src/test/ui/feature-gates/feature-gate-const_fn.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_fn.stderr @@ -1,31 +1,31 @@ error[E0379]: trait fns cannot be declared const - --> $DIR/feature-gate-const_fn.rs:16:5 + --> $DIR/feature-gate-const_fn.rs:6:5 | LL | const fn foo() -> u32; //~ ERROR const fn is unstable | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const - --> $DIR/feature-gate-const_fn.rs:18:5 + --> $DIR/feature-gate-const_fn.rs:8:5 | LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const - --> $DIR/feature-gate-const_fn.rs:27:5 + --> $DIR/feature-gate-const_fn.rs:13:5 | LL | const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const | ^^^^^ trait fns cannot be const -error[E0658]: const fn is unstable (see issue #24111) - --> $DIR/feature-gate-const_fn.rs:16:5 +error[E0658]: const fn is unstable (see issue #57563) + --> $DIR/feature-gate-const_fn.rs:6:5 | LL | const fn foo() -> u32; //~ ERROR const fn is unstable | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable -error[E0658]: const fn is unstable (see issue #24111) - --> $DIR/feature-gate-const_fn.rs:18:5 +error[E0658]: const fn is unstable (see issue #57563) + --> $DIR/feature-gate-const_fn.rs:8:5 | LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-const_let.rs b/src/test/ui/feature-gates/feature-gate-const_let.rs deleted file mode 100644 index 05d02e62bc8..00000000000 --- a/src/test/ui/feature-gates/feature-gate-const_let.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test use of const let without feature gate. - -#![feature(const_fn)] - -const fn foo() -> usize { - let x = 42; - //~^ ERROR statements in constant functions are unstable - //~| ERROR: let bindings in constant functions are unstable - 42 -} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-const_let.stderr b/src/test/ui/feature-gates/feature-gate-const_let.stderr deleted file mode 100644 index 6a7f6255678..00000000000 --- a/src/test/ui/feature-gates/feature-gate-const_let.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0658]: let bindings in constant functions are unstable (see issue #48821) - --> $DIR/feature-gate-const_let.rs:16:13 - | -LL | let x = 42; - | ^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constant functions are unstable (see issue #48821) - --> $DIR/feature-gate-const_let.rs:16:13 - | -LL | let x = 42; - | ^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-const_transmute.rs b/src/test/ui/feature-gates/feature-gate-const_transmute.rs index c879ab52a3f..3c4e6de0b1e 100644 --- a/src/test/ui/feature-gates/feature-gate-const_transmute.rs +++ b/src/test/ui/feature-gates/feature-gate-const_transmute.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem; #[repr(transparent)] diff --git a/src/test/ui/feature-gates/feature-gate-const_transmute.stderr b/src/test/ui/feature-gates/feature-gate-const_transmute.stderr index bb09b933d2e..2e07a9e7ddb 100644 --- a/src/test/ui/feature-gates/feature-gate-const_transmute.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_transmute.stderr @@ -1,5 +1,5 @@ error[E0658]: The use of std::mem::transmute() is gated in constants (see issue #53605) - --> $DIR/feature-gate-const_transmute.rs:16:38 + --> $DIR/feature-gate-const_transmute.rs:6:38 | LL | const TRANSMUTED_U32: u32 = unsafe { mem::transmute(Foo(3)) }; | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.rs b/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.rs index a2937d6de31..0e3f6b168be 100644 --- a/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.rs +++ b/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - crate struct Bender { //~ ERROR `crate` visibility modifier is experimental earth: bool, fire: bool, diff --git a/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr b/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr index e1c1dcbcd79..2b28bbca645 100644 --- a/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr +++ b/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr @@ -1,5 +1,5 @@ error[E0658]: `crate` visibility modifier is experimental (see issue #53120) - --> $DIR/feature-gate-crate_visibility_modifier.rs:11:1 + --> $DIR/feature-gate-crate_visibility_modifier.rs:1:1 | LL | crate struct Bender { //~ ERROR `crate` visibility modifier is experimental | ^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-custom_attribute.rs b/src/test/ui/feature-gates/feature-gate-custom_attribute.rs index 4371de57776..f31c9d5afc4 100644 --- a/src/test/ui/feature-gates/feature-gate-custom_attribute.rs +++ b/src/test/ui/feature-gates/feature-gate-custom_attribute.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that literals in attributes parse just fine. diff --git a/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr b/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr index e60e9a342a9..51fefcfaff7 100644 --- a/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr +++ b/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr @@ -1,5 +1,5 @@ error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:17:3 + --> $DIR/feature-gate-custom_attribute.rs:7:3 | LL | #[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown | ^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:18:3 + --> $DIR/feature-gate-custom_attribute.rs:8:3 | LL | #[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown | ^^^^^^^^^ @@ -15,7 +15,7 @@ LL | #[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:19:3 + --> $DIR/feature-gate-custom_attribute.rs:9:3 | LL | #[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown | ^^^^^^^^^ @@ -23,7 +23,7 @@ LL | #[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:20:3 + --> $DIR/feature-gate-custom_attribute.rs:10:3 | LL | #[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown | ^^^^^^^^^ @@ -31,7 +31,7 @@ LL | #[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:21:3 + --> $DIR/feature-gate-custom_attribute.rs:11:3 | LL | #[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown | ^^^^^^^^^ @@ -39,7 +39,7 @@ LL | #[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently u = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:22:3 + --> $DIR/feature-gate-custom_attribute.rs:12:3 | LL | #[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown | ^^^^^^^^^ @@ -47,7 +47,7 @@ LL | #[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:23:3 + --> $DIR/feature-gate-custom_attribute.rs:13:3 | LL | #[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown | ^^^^^^^^^ @@ -55,7 +55,7 @@ LL | #[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is cu = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:24:3 + --> $DIR/feature-gate-custom_attribute.rs:14:3 | LL | #[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown | ^^^^^^^^^ @@ -63,7 +63,7 @@ LL | #[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is curr = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:25:3 + --> $DIR/feature-gate-custom_attribute.rs:15:3 | LL | #[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown | ^^^^^^^^^ @@ -71,7 +71,7 @@ LL | #[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_at = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:26:3 + --> $DIR/feature-gate-custom_attribute.rs:16:3 | LL | #[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown | ^^^^^^^^^ @@ -79,7 +79,7 @@ LL | #[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:27:3 + --> $DIR/feature-gate-custom_attribute.rs:17:3 | LL | #[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown | ^^^^^^^^^ @@ -87,7 +87,7 @@ LL | #[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unk = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:28:3 + --> $DIR/feature-gate-custom_attribute.rs:18:3 | LL | #[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown | ^^^^^^^^^ @@ -95,7 +95,7 @@ LL | #[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `fake_doc` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute.rs:29:3 + --> $DIR/feature-gate-custom_attribute.rs:19:3 | LL | #[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown | ^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-custom_attribute2.rs b/src/test/ui/feature-gates/feature-gate-custom_attribute2.rs index 30fd89f091b..2137a2a003a 100644 --- a/src/test/ui/feature-gates/feature-gate-custom_attribute2.rs +++ b/src/test/ui/feature-gates/feature-gate-custom_attribute2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test ensures that attributes on formals in generic parameter // lists are included when we are checking for unstable attributes. diff --git a/src/test/ui/feature-gates/feature-gate-custom_attribute2.stderr b/src/test/ui/feature-gates/feature-gate-custom_attribute2.stderr index 1c1f50366d6..560ceda3486 100644 --- a/src/test/ui/feature-gates/feature-gate-custom_attribute2.stderr +++ b/src/test/ui/feature-gates/feature-gate-custom_attribute2.stderr @@ -1,5 +1,5 @@ error[E0658]: The attribute `lt_struct` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:16:13 + --> $DIR/feature-gate-custom_attribute2.rs:6:13 | LL | struct StLt<#[lt_struct] 'a>(&'a u32); | ^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | struct StLt<#[lt_struct] 'a>(&'a u32); = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `ty_struct` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:18:13 + --> $DIR/feature-gate-custom_attribute2.rs:8:13 | LL | struct StTy<#[ty_struct] I>(I); | ^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | struct StTy<#[ty_struct] I>(I); = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `lt_enum` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:21:11 + --> $DIR/feature-gate-custom_attribute2.rs:11:11 | LL | enum EnLt<#[lt_enum] 'b> { A(&'b u32), B } | ^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | enum EnLt<#[lt_enum] 'b> { A(&'b u32), B } = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `ty_enum` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:23:11 + --> $DIR/feature-gate-custom_attribute2.rs:13:11 | LL | enum EnTy<#[ty_enum] J> { A(J), B } | ^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | enum EnTy<#[ty_enum] J> { A(J), B } = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `lt_trait` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:26:12 + --> $DIR/feature-gate-custom_attribute2.rs:16:12 | LL | trait TrLt<#[lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; } | ^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | trait TrLt<#[lt_trait] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; } = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `ty_trait` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:28:12 + --> $DIR/feature-gate-custom_attribute2.rs:18:12 | LL | trait TrTy<#[ty_trait] K> { fn foo(&self, _: K); } | ^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | trait TrTy<#[ty_trait] K> { fn foo(&self, _: K); } = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `lt_type` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:31:11 + --> $DIR/feature-gate-custom_attribute2.rs:21:11 | LL | type TyLt<#[lt_type] 'd> = &'d u32; | ^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | type TyLt<#[lt_type] 'd> = &'d u32; = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `ty_type` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:33:11 + --> $DIR/feature-gate-custom_attribute2.rs:23:11 | LL | type TyTy<#[ty_type] L> = (L, ); | ^^^^^^^^^^ @@ -63,7 +63,7 @@ LL | type TyTy<#[ty_type] L> = (L, ); = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `lt_inherent` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:36:6 + --> $DIR/feature-gate-custom_attribute2.rs:26:6 | LL | impl<#[lt_inherent] 'e> StLt<'e> { } | ^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ LL | impl<#[lt_inherent] 'e> StLt<'e> { } = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `ty_inherent` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:38:6 + --> $DIR/feature-gate-custom_attribute2.rs:28:6 | LL | impl<#[ty_inherent] M> StTy { } | ^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ LL | impl<#[ty_inherent] M> StTy { } = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `lt_impl_for` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:41:6 + --> $DIR/feature-gate-custom_attribute2.rs:31:6 | LL | impl<#[lt_impl_for] 'f> TrLt<'f> for StLt<'f> { | ^^^^^^^^^^^^^^ @@ -87,7 +87,7 @@ LL | impl<#[lt_impl_for] 'f> TrLt<'f> for StLt<'f> { = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `ty_impl_for` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:45:6 + --> $DIR/feature-gate-custom_attribute2.rs:35:6 | LL | impl<#[ty_impl_for] N> TrTy for StTy { | ^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ LL | impl<#[ty_impl_for] N> TrTy for StTy { = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `lt_fn` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:50:9 + --> $DIR/feature-gate-custom_attribute2.rs:40:9 | LL | fn f_lt<#[lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } } | ^^^^^^^^ @@ -103,7 +103,7 @@ LL | fn f_lt<#[lt_fn] 'g>(_: &'g [u32]) -> &'g u32 { loop { } } = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `ty_fn` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:52:9 + --> $DIR/feature-gate-custom_attribute2.rs:42:9 | LL | fn f_ty<#[ty_fn] O>(_: O) { } | ^^^^^^^^ @@ -111,7 +111,7 @@ LL | fn f_ty<#[ty_fn] O>(_: O) { } = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `lt_meth` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:56:13 + --> $DIR/feature-gate-custom_attribute2.rs:46:13 | LL | fn m_lt<#[lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } } | ^^^^^^^^^^ @@ -119,7 +119,7 @@ LL | fn m_lt<#[lt_meth] 'h>(_: &'h [u32]) -> &'h u32 { loop { } } = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `ty_meth` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:58:13 + --> $DIR/feature-gate-custom_attribute2.rs:48:13 | LL | fn m_ty<#[ty_meth] P>(_: P) { } | ^^^^^^^^^^ @@ -127,7 +127,7 @@ LL | fn m_ty<#[ty_meth] P>(_: P) { } = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: The attribute `lt_hof` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/feature-gate-custom_attribute2.rs:63:19 + --> $DIR/feature-gate-custom_attribute2.rs:53:19 | LL | where Q: for <#[lt_hof] 'i> Fn(&'i [u32]) -> &'i u32 | ^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-custom_derive.rs b/src/test/ui/feature-gates/feature-gate-custom_derive.rs deleted file mode 100644 index 0b1b3141f5b..00000000000 --- a/src/test/ui/feature-gates/feature-gate-custom_derive.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[derive_Clone] -//~^ ERROR attributes of the form `#[derive_*]` are reserved -struct Test; - -pub fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-custom_derive.stderr b/src/test/ui/feature-gates/feature-gate-custom_derive.stderr deleted file mode 100644 index 0979372daea..00000000000 --- a/src/test/ui/feature-gates/feature-gate-custom_derive.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644) - --> $DIR/feature-gate-custom_derive.rs:11:3 - | -LL | #[derive_Clone] - | ^^^^^^^^^^^^ - | - = help: add #![feature(custom_derive)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.rs b/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.rs new file mode 100644 index 00000000000..0a200497939 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.rs @@ -0,0 +1,3 @@ +#![test_runner(main)] //~ ERROR custom test frameworks are an unstable feature + +fn main() {} diff --git a/src/test/ui/feature-gate-custom_test_frameworks.stderr b/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.stderr similarity index 87% rename from src/test/ui/feature-gate-custom_test_frameworks.stderr rename to src/test/ui/feature-gates/feature-gate-custom_test_frameworks.stderr index bfcbab50067..1aec87f0669 100644 --- a/src/test/ui/feature-gate-custom_test_frameworks.stderr +++ b/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.stderr @@ -1,5 +1,5 @@ error[E0658]: custom test frameworks are an unstable feature (see issue #50297) - --> $DIR/feature-gate-custom_test_frameworks.rs:11:1 + --> $DIR/feature-gate-custom_test_frameworks.rs:1:1 | LL | #![test_runner(main)] //~ ERROR custom test frameworks are an unstable feature | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-decl_macro.rs b/src/test/ui/feature-gates/feature-gate-decl_macro.rs index 4cb34c8274d..ca0dafd0bf7 100644 --- a/src/test/ui/feature-gates/feature-gate-decl_macro.rs +++ b/src/test/ui/feature-gates/feature-gate-decl_macro.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_macros)] macro m() {} //~ ERROR `macro` is experimental (see issue #39412) diff --git a/src/test/ui/feature-gates/feature-gate-decl_macro.stderr b/src/test/ui/feature-gates/feature-gate-decl_macro.stderr index 56c0dea0236..01ec3d8b2e2 100644 --- a/src/test/ui/feature-gates/feature-gate-decl_macro.stderr +++ b/src/test/ui/feature-gates/feature-gate-decl_macro.stderr @@ -1,5 +1,5 @@ error[E0658]: `macro` is experimental (see issue #39412) - --> $DIR/feature-gate-decl_macro.rs:13:1 + --> $DIR/feature-gate-decl_macro.rs:3:1 | LL | macro m() {} //~ ERROR `macro` is experimental (see issue #39412) | ^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-default_type_parameter_fallback.rs b/src/test/ui/feature-gates/feature-gate-default_type_parameter_fallback.rs index ccc5ec49f13..33038e24bc6 100644 --- a/src/test/ui/feature-gates/feature-gate-default_type_parameter_fallback.rs +++ b/src/test/ui/feature-gates/feature-gate-default_type_parameter_fallback.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] fn avg(_: T) {} diff --git a/src/test/ui/feature-gates/feature-gate-default_type_parameter_fallback.stderr b/src/test/ui/feature-gates/feature-gate-default_type_parameter_fallback.stderr index 134bf29d2aa..ac8cd101767 100644 --- a/src/test/ui/feature-gates/feature-gate-default_type_parameter_fallback.stderr +++ b/src/test/ui/feature-gates/feature-gate-default_type_parameter_fallback.stderr @@ -1,5 +1,5 @@ error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions. - --> $DIR/feature-gate-default_type_parameter_fallback.rs:13:8 + --> $DIR/feature-gate-default_type_parameter_fallback.rs:3:8 | LL | fn avg(_: T) {} | ^ @@ -9,7 +9,7 @@ LL | fn avg(_: T) {} = note: for more information, see issue #36887 error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions. - --> $DIR/feature-gate-default_type_parameter_fallback.rs:18:6 + --> $DIR/feature-gate-default_type_parameter_fallback.rs:8:6 | LL | impl S {} | ^ diff --git a/src/test/ui/feature-gates/feature-gate-doc_alias.rs b/src/test/ui/feature-gates/feature-gate-doc_alias.rs index 1503dfe81fb..d7980f882d9 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_alias.rs +++ b/src/test/ui/feature-gates/feature-gate-doc_alias.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[doc(alias = "foo")] //~ ERROR: #[doc(alias = "...")] is experimental pub struct Foo; diff --git a/src/test/ui/feature-gates/feature-gate-doc_alias.stderr b/src/test/ui/feature-gates/feature-gate-doc_alias.stderr index a987e03c0aa..91845329534 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_alias.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_alias.stderr @@ -1,5 +1,5 @@ error[E0658]: #[doc(alias = "...")] is experimental (see issue #50146) - --> $DIR/feature-gate-doc_alias.rs:11:1 + --> $DIR/feature-gate-doc_alias.rs:1:1 | LL | #[doc(alias = "foo")] //~ ERROR: #[doc(alias = "...")] is experimental | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.rs b/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.rs new file mode 100644 index 00000000000..17ea5823191 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.rs @@ -0,0 +1,4 @@ +#[cfg(rustdoc)] //~ ERROR: `cfg(rustdoc)` is experimental and subject to change +pub struct SomeStruct; + +fn main() {} diff --git a/src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.stderr b/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr similarity index 87% rename from src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.stderr rename to src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr index be2c263af04..5bc56adb8ad 100644 --- a/src/test/ui/feature-gate-doc_cfg-cfg-rustdoc.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr @@ -1,5 +1,5 @@ error[E0658]: `cfg(rustdoc)` is experimental and subject to change (see issue #43781) - --> $DIR/feature-gate-doc_cfg-cfg-rustdoc.rs:11:7 + --> $DIR/feature-gate-doc_cfg-cfg-rustdoc.rs:1:7 | LL | #[cfg(rustdoc)] //~ ERROR: `cfg(rustdoc)` is experimental and subject to change | ^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-doc_cfg.rs b/src/test/ui/feature-gates/feature-gate-doc_cfg.rs index 1a77d918014..f13129888b4 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_cfg.rs +++ b/src/test/ui/feature-gates/feature-gate-doc_cfg.rs @@ -1,12 +1,2 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[doc(cfg(unix))] //~ ERROR: #[doc(cfg(...))] is experimental fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr b/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr index 5839e1dd611..20e3a4dbbca 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr @@ -1,5 +1,5 @@ error[E0658]: #[doc(cfg(...))] is experimental (see issue #43781) - --> $DIR/feature-gate-doc_cfg.rs:11:1 + --> $DIR/feature-gate-doc_cfg.rs:1:1 | LL | #[doc(cfg(unix))] //~ ERROR: #[doc(cfg(...))] is experimental | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-doc_keyword.rs b/src/test/ui/feature-gates/feature-gate-doc_keyword.rs index 2ff44626ccd..b08940e28f4 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_keyword.rs +++ b/src/test/ui/feature-gates/feature-gate-doc_keyword.rs @@ -1,13 +1,5 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[doc(keyword = "match")] //~ ERROR: #[doc(keyword = "...")] is experimental /// wonderful mod foo{} + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr b/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr index e4f5109afc3..96f165d5a51 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr @@ -1,5 +1,5 @@ error[E0658]: #[doc(keyword = "...")] is experimental (see issue #51315) - --> $DIR/feature-gate-doc_keyword.rs:11:1 + --> $DIR/feature-gate-doc_keyword.rs:1:1 | LL | #[doc(keyword = "match")] //~ ERROR: #[doc(keyword = "...")] is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-doc_masked.rs b/src/test/ui/feature-gates/feature-gate-doc_masked.rs index bb5be9d6971..034c5cf52ee 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_masked.rs +++ b/src/test/ui/feature-gates/feature-gate-doc_masked.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[doc(masked)] //~ ERROR: #[doc(masked)] is experimental extern crate std as realstd; diff --git a/src/test/ui/feature-gates/feature-gate-doc_masked.stderr b/src/test/ui/feature-gates/feature-gate-doc_masked.stderr index 043397efde2..044f21a9833 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_masked.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_masked.stderr @@ -1,5 +1,5 @@ error[E0658]: #[doc(masked)] is experimental (see issue #44027) - --> $DIR/feature-gate-doc_masked.rs:11:1 + --> $DIR/feature-gate-doc_masked.rs:1:1 | LL | #[doc(masked)] //~ ERROR: #[doc(masked)] is experimental | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-doc_spotlight.rs b/src/test/ui/feature-gates/feature-gate-doc_spotlight.rs index 6369358538d..28b689b4d98 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_spotlight.rs +++ b/src/test/ui/feature-gates/feature-gate-doc_spotlight.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[doc(spotlight)] //~ ERROR: #[doc(spotlight)] is experimental trait SomeTrait {} diff --git a/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr b/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr index 98e7f38a441..c7101b436e2 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr @@ -1,5 +1,5 @@ error[E0658]: #[doc(spotlight)] is experimental (see issue #45040) - --> $DIR/feature-gate-doc_spotlight.rs:11:1 + --> $DIR/feature-gate-doc_spotlight.rs:1:1 | LL | #[doc(spotlight)] //~ ERROR: #[doc(spotlight)] is experimental | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.rs b/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.rs index 70ec561439c..33252019e71 100644 --- a/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.rs +++ b/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(deprecated)] #![feature(dropck_parametricity)] diff --git a/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr b/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr index d3d5bd498cf..b6a474575c6 100644 --- a/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr +++ b/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr @@ -1,11 +1,11 @@ error: use of deprecated attribute `dropck_parametricity`: unsafe_destructor_blind_to_params has been replaced by may_dangle and will be removed in the future. See https://github.com/rust-lang/rust/issues/34761 - --> $DIR/feature-gate-dropck-ugeh-2.rs:17:5 + --> $DIR/feature-gate-dropck-ugeh-2.rs:7:5 | LL | #[unsafe_destructor_blind_to_params] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this attribute with `#[may_dangle]` | note: lint level defined here - --> $DIR/feature-gate-dropck-ugeh-2.rs:11:9 + --> $DIR/feature-gate-dropck-ugeh-2.rs:1:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs b/src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs index 360895d30b0..a2377cda9bd 100644 --- a/src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs +++ b/src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs @@ -1,24 +1,11 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-dropck_parametricity // Ensure that attempts to use the unsafe attribute are feature-gated. - // Example adapted from RFC 1238 text (just left out the feature gate). // https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md // #example-of-the-unguarded-escape-hatch -// #![feature(dropck_parametricity)] - use std::cell::Cell; struct Concrete<'a>(u32, Cell>>); @@ -28,6 +15,7 @@ struct Foo { data: Vec } impl Drop for Foo { #[unsafe_destructor_blind_to_params] // This is the UGEH attribute //~^ ERROR unsafe_destructor_blind_to_params has been replaced + //~| WARN use of deprecated attribute `dropck_parametricity` fn drop(&mut self) { } } @@ -39,4 +27,3 @@ fn main() { foo.data[0].1.set(Some(&foo.data[1])); foo.data[1].1.set(Some(&foo.data[0])); } - diff --git a/src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr b/src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr index 33bb5f2d989..bc62fc01b44 100644 --- a/src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr +++ b/src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr @@ -1,11 +1,19 @@ error[E0658]: unsafe_destructor_blind_to_params has been replaced by may_dangle and will be removed in the future (see issue #28498) - --> $DIR/feature-gate-dropck-ugeh.rs:29:5 + --> $DIR/feature-gate-dropck-ugeh.rs:16:5 | LL | #[unsafe_destructor_blind_to_params] // This is the UGEH attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(dropck_parametricity)] to the crate attributes to enable +warning: use of deprecated attribute `dropck_parametricity`: unsafe_destructor_blind_to_params has been replaced by may_dangle and will be removed in the future. See https://github.com/rust-lang/rust/issues/34761 + --> $DIR/feature-gate-dropck-ugeh.rs:16:5 + | +LL | #[unsafe_destructor_blind_to_params] // This is the UGEH attribute + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this attribute with `#[may_dangle]` + | + = note: #[warn(deprecated)] on by default + error: aborting due to previous error For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.rs b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.rs index e0b6d5986ff..ded08b93fe8 100644 --- a/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.rs +++ b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { match 22 { 0 .. 3 => {} //~ ERROR exclusive range pattern syntax is experimental diff --git a/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr index 27fd49edcc6..2b43a480c6b 100644 --- a/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr +++ b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr @@ -1,5 +1,5 @@ error[E0658]: exclusive range pattern syntax is experimental (see issue #37854) - --> $DIR/feature-gate-exclusive-range-pattern.rs:13:9 + --> $DIR/feature-gate-exclusive-range-pattern.rs:3:9 | LL | 0 .. 3 => {} //~ ERROR exclusive range pattern syntax is experimental | ^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.rs b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.rs index c83d9b56bc3..dce8cf46ff9 100644 --- a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.rs +++ b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(never_type)] fn foo() -> Result { Ok(123) diff --git a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr index 4afe5b5d5e0..cbe6d567755 100644 --- a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered - --> $DIR/feature-gate-exhaustive-patterns.rs:16:9 + --> $DIR/feature-gate-exhaustive-patterns.rs:7:9 | LL | let Ok(_x) = foo(); //~ ERROR refutable pattern in local binding | ^^^^^^ pattern `Err(_)` not covered diff --git a/src/test/ui/feature-gates/feature-gate-existential-type.rs b/src/test/ui/feature-gates/feature-gate-existential-type.rs index b35a3916377..6dfd2d10870 100644 --- a/src/test/ui/feature-gates/feature-gate-existential-type.rs +++ b/src/test/ui/feature-gates/feature-gate-existential-type.rs @@ -1,25 +1,17 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that existential types must be ungated to use the `existential` keyword - - existential type Foo: std::fmt::Debug; //~ ERROR existential types are unstable trait Bar { type Baa: std::fmt::Debug; + fn define() -> Self::Baa; } impl Bar for () { existential type Baa: std::fmt::Debug; //~ ERROR existential types are unstable + fn define() -> Self::Baa { 0 } } +fn define() -> Foo { 0 } + fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-existential-type.stderr b/src/test/ui/feature-gates/feature-gate-existential-type.stderr index 6db5fa2ce6b..e83d5cdbde1 100644 --- a/src/test/ui/feature-gates/feature-gate-existential-type.stderr +++ b/src/test/ui/feature-gates/feature-gate-existential-type.stderr @@ -1,5 +1,5 @@ error[E0658]: existential types are unstable (see issue #34511) - --> $DIR/feature-gate-existential-type.rs:15:1 + --> $DIR/feature-gate-existential-type.rs:3:1 | LL | existential type Foo: std::fmt::Debug; //~ ERROR existential types are unstable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | existential type Foo: std::fmt::Debug; //~ ERROR existential types are unst = help: add #![feature(existential_type)] to the crate attributes to enable error[E0658]: existential types are unstable (see issue #34511) - --> $DIR/feature-gate-existential-type.rs:22:5 + --> $DIR/feature-gate-existential-type.rs:11:5 | LL | existential type Baa: std::fmt::Debug; //~ ERROR existential types are unstable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.rs b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.rs index 40fdbf0bbdb..cff273ce2c5 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.rs +++ b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core::default; //~ ERROR unresolved import `core` fn main() { diff --git a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr index 7c94200f00f..1629547acb1 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr +++ b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr @@ -1,11 +1,11 @@ error[E0432]: unresolved import `core` - --> $DIR/feature-gate-extern_absolute_paths.rs:11:5 + --> $DIR/feature-gate-extern_absolute_paths.rs:1:5 | LL | use core::default; //~ ERROR unresolved import `core` | ^^^^ maybe a missing `extern crate core;`? error[E0433]: failed to resolve: maybe a missing `extern crate core;`? - --> $DIR/feature-gate-extern_absolute_paths.rs:14:19 + --> $DIR/feature-gate-extern_absolute_paths.rs:4:19 | LL | let _: u8 = ::core::default::Default(); //~ ERROR failed to resolve | ^^^^ maybe a missing `extern crate core;`? diff --git a/src/test/ui/feature-gates/feature-gate-extern_in_paths.rs b/src/test/ui/feature-gates/feature-gate-extern_in_paths.rs deleted file mode 100644 index 3c01fcf6833..00000000000 --- a/src/test/ui/feature-gates/feature-gate-extern_in_paths.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct S; - -fn main() { - let _ = extern::std::vec::Vec::new(); //~ ERROR `extern` in paths is experimental -} diff --git a/src/test/ui/feature-gates/feature-gate-extern_in_paths.stderr b/src/test/ui/feature-gates/feature-gate-extern_in_paths.stderr deleted file mode 100644 index a73533b6178..00000000000 --- a/src/test/ui/feature-gates/feature-gate-extern_in_paths.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: `extern` in paths is experimental (see issue #55600) - --> $DIR/feature-gate-extern_in_paths.rs:14:13 - | -LL | let _ = extern::std::vec::Vec::new(); //~ ERROR `extern` in paths is experimental - | ^^^^^^ - | - = help: add #![feature(extern_in_paths)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-extern_prelude.rs b/src/test/ui/feature-gates/feature-gate-extern_prelude.rs index 8d3a30305bd..237099e7901 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_prelude.rs +++ b/src/test/ui/feature-gates/feature-gate-extern_prelude.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - can-only-test-this-in-run-make-fulldeps //~ ERROR expected one of `!` or `::`, found `-` diff --git a/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr b/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr index 5abf369baf9..7a13f61a27e 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr +++ b/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr @@ -1,5 +1,5 @@ error: expected one of `!` or `::`, found `-` - --> $DIR/feature-gate-extern_prelude.rs:11:4 + --> $DIR/feature-gate-extern_prelude.rs:1:4 | LL | can-only-test-this-in-run-make-fulldeps //~ ERROR expected one of `!` or `::`, found `-` | ^ expected one of `!` or `::` here diff --git a/src/test/ui/feature-gates/feature-gate-extern_types.rs b/src/test/ui/feature-gates/feature-gate-extern_types.rs index 1203b598df3..6bdc96f55d6 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_types.rs +++ b/src/test/ui/feature-gates/feature-gate-extern_types.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { type T; //~ ERROR extern types are experimental } diff --git a/src/test/ui/feature-gates/feature-gate-extern_types.stderr b/src/test/ui/feature-gates/feature-gate-extern_types.stderr index 47c74bda177..70ba06cde45 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_types.stderr +++ b/src/test/ui/feature-gates/feature-gate-extern_types.stderr @@ -1,5 +1,5 @@ error[E0658]: extern types are experimental (see issue #43467) - --> $DIR/feature-gate-extern_types.rs:12:5 + --> $DIR/feature-gate-extern_types.rs:2:5 | LL | type T; //~ ERROR extern types are experimental | ^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-external_doc.rs b/src/test/ui/feature-gates/feature-gate-external_doc.rs index fa0a2a29078..e3ffb88819b 100644 --- a/src/test/ui/feature-gates/feature-gate-external_doc.rs +++ b/src/test/ui/feature-gates/feature-gate-external_doc.rs @@ -1,12 +1,2 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[doc(include="asdf.md")] //~ ERROR: #[doc(include = "...")] is experimental fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-external_doc.stderr b/src/test/ui/feature-gates/feature-gate-external_doc.stderr index 272380f2336..b5cb9f564a3 100644 --- a/src/test/ui/feature-gates/feature-gate-external_doc.stderr +++ b/src/test/ui/feature-gates/feature-gate-external_doc.stderr @@ -1,5 +1,5 @@ error[E0658]: #[doc(include = "...")] is experimental (see issue #44732) - --> $DIR/feature-gate-external_doc.rs:11:1 + --> $DIR/feature-gate-external_doc.rs:1:1 | LL | #[doc(include="asdf.md")] //~ ERROR: #[doc(include = "...")] is experimental | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-feature-gate.rs b/src/test/ui/feature-gates/feature-gate-feature-gate.rs index b903b29658b..3c98e16a136 100644 --- a/src/test/ui/feature-gates/feature-gate-feature-gate.rs +++ b/src/test/ui/feature-gates/feature-gate-feature-gate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![forbid(unstable_features)] #![feature(intrinsics)] //~ ERROR unstable feature diff --git a/src/test/ui/feature-gates/feature-gate-feature-gate.stderr b/src/test/ui/feature-gates/feature-gate-feature-gate.stderr index 256cf47c120..aee4f7ba47d 100644 --- a/src/test/ui/feature-gates/feature-gate-feature-gate.stderr +++ b/src/test/ui/feature-gates/feature-gate-feature-gate.stderr @@ -1,11 +1,11 @@ error: unstable feature - --> $DIR/feature-gate-feature-gate.rs:12:12 + --> $DIR/feature-gate-feature-gate.rs:2:12 | LL | #![feature(intrinsics)] //~ ERROR unstable feature | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/feature-gate-feature-gate.rs:11:11 + --> $DIR/feature-gate-feature-gate.rs:1:11 | LL | #![forbid(unstable_features)] | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-format_args_nl.rs b/src/test/ui/feature-gates/feature-gate-format_args_nl.rs index b976d57f9c1..aeee2fbad90 100644 --- a/src/test/ui/feature-gates/feature-gate-format_args_nl.rs +++ b/src/test/ui/feature-gates/feature-gate-format_args_nl.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { format_args_nl!(""); //~ ERROR `format_args_nl` is only for internal language use } diff --git a/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr b/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr index a79535641a6..135ec5eb0c0 100644 --- a/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr +++ b/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr @@ -1,5 +1,5 @@ error[E0658]: `format_args_nl` is only for internal language use and is subject to change - --> $DIR/feature-gate-format_args_nl.rs:12:5 + --> $DIR/feature-gate-format_args_nl.rs:2:5 | LL | format_args_nl!(""); //~ ERROR `format_args_nl` is only for internal language use | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-fundamental.rs b/src/test/ui/feature-gates/feature-gate-fundamental.rs index 18718a0d0be..70e0133929c 100644 --- a/src/test/ui/feature-gates/feature-gate-fundamental.rs +++ b/src/test/ui/feature-gates/feature-gate-fundamental.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[fundamental] //~ ERROR the `#[fundamental]` attribute is an experimental feature struct Fundamental; diff --git a/src/test/ui/feature-gates/feature-gate-fundamental.stderr b/src/test/ui/feature-gates/feature-gate-fundamental.stderr index ac8430d7c1c..47cf241cc3f 100644 --- a/src/test/ui/feature-gates/feature-gate-fundamental.stderr +++ b/src/test/ui/feature-gates/feature-gate-fundamental.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[fundamental]` attribute is an experimental feature (see issue #29635) - --> $DIR/feature-gate-fundamental.rs:11:1 + --> $DIR/feature-gate-fundamental.rs:1:1 | LL | #[fundamental] //~ ERROR the `#[fundamental]` attribute is an experimental feature | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-generators.rs b/src/test/ui/feature-gates/feature-gate-generators.rs index 3754f92d8cd..cee930fd785 100644 --- a/src/test/ui/feature-gates/feature-gate-generators.rs +++ b/src/test/ui/feature-gates/feature-gate-generators.rs @@ -1,13 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { yield true; //~ ERROR yield syntax is experimental + //~^ ERROR yield statement outside of generator literal } diff --git a/src/test/ui/feature-gates/feature-gate-generators.stderr b/src/test/ui/feature-gates/feature-gate-generators.stderr index 0c2337e27a7..aea1e00d698 100644 --- a/src/test/ui/feature-gates/feature-gate-generators.stderr +++ b/src/test/ui/feature-gates/feature-gate-generators.stderr @@ -1,11 +1,18 @@ error[E0658]: yield syntax is experimental (see issue #43122) - --> $DIR/feature-gate-generators.rs:12:5 + --> $DIR/feature-gate-generators.rs:2:5 | LL | yield true; //~ ERROR yield syntax is experimental | ^^^^^^^^^^ | = help: add #![feature(generators)] to the crate attributes to enable -error: aborting due to previous error +error[E0627]: yield statement outside of generator literal + --> $DIR/feature-gate-generators.rs:2:5 + | +LL | yield true; //~ ERROR yield syntax is experimental + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0627, E0658. +For more information about an error, try `rustc --explain E0627`. diff --git a/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs b/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs index bbaae1ef449..17548d7b9e8 100644 --- a/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs +++ b/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Deref; trait PointerFamily { @@ -21,9 +11,9 @@ trait PointerFamily { struct Foo; impl PointerFamily for Foo { - type Pointer = Box; + type Pointer = Box; //~^ ERROR generic associated types are unstable - type Pointer2 = Box; + type Pointer2 = Box; //~^ ERROR generic associated types are unstable } diff --git a/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr b/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr index f12cbe727fb..8a207c966cd 100644 --- a/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr +++ b/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr @@ -1,5 +1,5 @@ error[E0658]: generic associated types are unstable (see issue #44265) - --> $DIR/feature-gate-generic_associated_types.rs:14:5 + --> $DIR/feature-gate-generic_associated_types.rs:4:5 | LL | type Pointer: Deref; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | type Pointer: Deref; = help: add #![feature(generic_associated_types)] to the crate attributes to enable error[E0658]: generic associated types are unstable (see issue #44265) - --> $DIR/feature-gate-generic_associated_types.rs:16:5 + --> $DIR/feature-gate-generic_associated_types.rs:6:5 | LL | type Pointer2: Deref where T: Clone, U: Clone; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | type Pointer2: Deref where T: Clone, U: Clone; = help: add #![feature(generic_associated_types)] to the crate attributes to enable error[E0658]: where clauses on associated types are unstable (see issue #44265) - --> $DIR/feature-gate-generic_associated_types.rs:16:5 + --> $DIR/feature-gate-generic_associated_types.rs:6:5 | LL | type Pointer2: Deref where T: Clone, U: Clone; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,23 +23,23 @@ LL | type Pointer2: Deref where T: Clone, U: Clone; = help: add #![feature(generic_associated_types)] to the crate attributes to enable error[E0658]: generic associated types are unstable (see issue #44265) - --> $DIR/feature-gate-generic_associated_types.rs:24:5 + --> $DIR/feature-gate-generic_associated_types.rs:14:5 | -LL | type Pointer = Box; +LL | type Pointer = Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(generic_associated_types)] to the crate attributes to enable error[E0658]: generic associated types are unstable (see issue #44265) - --> $DIR/feature-gate-generic_associated_types.rs:26:5 + --> $DIR/feature-gate-generic_associated_types.rs:16:5 | -LL | type Pointer2 = Box; +LL | type Pointer2 = Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(generic_associated_types)] to the crate attributes to enable error[E0658]: where clauses on associated types are unstable (see issue #44265) - --> $DIR/feature-gate-generic_associated_types.rs:31:5 + --> $DIR/feature-gate-generic_associated_types.rs:21:5 | LL | type Assoc where Self: Sized; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | type Assoc where Self: Sized; = help: add #![feature(generic_associated_types)] to the crate attributes to enable error[E0658]: where clauses on associated types are unstable (see issue #44265) - --> $DIR/feature-gate-generic_associated_types.rs:36:5 + --> $DIR/feature-gate-generic_associated_types.rs:26:5 | LL | type Assoc where Self: Sized = Foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-global_asm.rs b/src/test/ui/feature-gates/feature-gate-global_asm.rs index 77f61ba47b0..8c9f22e9752 100644 --- a/src/test/ui/feature-gates/feature-gate-global_asm.rs +++ b/src/test/ui/feature-gates/feature-gate-global_asm.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - global_asm!(""); //~ ERROR `global_asm!` is not stable fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-global_asm.stderr b/src/test/ui/feature-gates/feature-gate-global_asm.stderr index 2219d49a263..b698777f623 100644 --- a/src/test/ui/feature-gates/feature-gate-global_asm.stderr +++ b/src/test/ui/feature-gates/feature-gate-global_asm.stderr @@ -1,5 +1,5 @@ error[E0658]: `global_asm!` is not stable enough for use and is subject to change (see issue #35119) - --> $DIR/feature-gate-global_asm.rs:11:1 + --> $DIR/feature-gate-global_asm.rs:1:1 | LL | global_asm!(""); //~ ERROR `global_asm!` is not stable | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-if_while_or_patterns.rs b/src/test/ui/feature-gates/feature-gate-if_while_or_patterns.rs deleted file mode 100644 index 3df140c77fc..00000000000 --- a/src/test/ui/feature-gates/feature-gate-if_while_or_patterns.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - if let 0 | 1 = 0 { //~ ERROR multiple patterns in `if let` and `while let` are unstable - ; - } - while let 0 | 1 = 1 { //~ ERROR multiple patterns in `if let` and `while let` are unstable - break; - } -} diff --git a/src/test/ui/feature-gates/feature-gate-if_while_or_patterns.stderr b/src/test/ui/feature-gates/feature-gate-if_while_or_patterns.stderr deleted file mode 100644 index 909046812d3..00000000000 --- a/src/test/ui/feature-gates/feature-gate-if_while_or_patterns.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0658]: multiple patterns in `if let` and `while let` are unstable (see issue #48215) - --> $DIR/feature-gate-if_while_or_patterns.rs:12:5 - | -LL | / if let 0 | 1 = 0 { //~ ERROR multiple patterns in `if let` and `while let` are unstable -LL | | ; -LL | | } - | |_____^ - | - = help: add #![feature(if_while_or_patterns)] to the crate attributes to enable - -error[E0658]: multiple patterns in `if let` and `while let` are unstable (see issue #48215) - --> $DIR/feature-gate-if_while_or_patterns.rs:15:5 - | -LL | / while let 0 | 1 = 1 { //~ ERROR multiple patterns in `if let` and `while let` are unstable -LL | | break; -LL | | } - | |_____^ - | - = help: add #![feature(if_while_or_patterns)] to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.rs b/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.rs index 9c76719e26c..39cc64f11a7 100644 --- a/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.rs +++ b/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.rs @@ -1,17 +1,11 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const FOO: impl Copy = 42; +//~^ ERROR `impl Trait` not allowed static BAR: impl Copy = 42; +//~^ ERROR `impl Trait` not allowed fn main() { let foo = impl Copy = 42; +//~^ ERROR expected expression, found keyword `impl` + let foo: impl Copy = 42; } diff --git a/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.stderr b/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.stderr index 82bc6194483..a54e7e1b3bf 100644 --- a/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.stderr +++ b/src/test/ui/feature-gates/feature-gate-impl_trait_in_bindings.stderr @@ -1,11 +1,11 @@ error: expected expression, found keyword `impl` - --> $DIR/feature-gate-impl_trait_in_bindings.rs:16:15 + --> $DIR/feature-gate-impl_trait_in_bindings.rs:8:15 | LL | let foo = impl Copy = 42; | ^^^^ expected expression error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/feature-gate-impl_trait_in_bindings.rs:11:12 + --> $DIR/feature-gate-impl_trait_in_bindings.rs:1:12 | LL | const FOO: impl Copy = 42; | ^^^^^^^^^ @@ -13,7 +13,7 @@ LL | const FOO: impl Copy = 42; = help: add #![feature(impl_trait_in_bindings)] to the crate attributes to enable error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/feature-gate-impl_trait_in_bindings.rs:13:13 + --> $DIR/feature-gate-impl_trait_in_bindings.rs:4:13 | LL | static BAR: impl Copy = 42; | ^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs index ae1f81c2f57..0e5f968892f 100644 --- a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs +++ b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] fn foo(x: &'x u8) -> &'x u8 { x } diff --git a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr index cc0855306e1..5c64bf6539c 100644 --- a/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr +++ b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr @@ -1,101 +1,101 @@ error[E0261]: use of undeclared lifetime name `'x` - --> $DIR/feature-gate-in_band_lifetimes.rs:13:12 + --> $DIR/feature-gate-in_band_lifetimes.rs:3:12 | LL | fn foo(x: &'x u8) -> &'x u8 { x } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'x` - --> $DIR/feature-gate-in_band_lifetimes.rs:13:23 + --> $DIR/feature-gate-in_band_lifetimes.rs:3:23 | LL | fn foo(x: &'x u8) -> &'x u8 { x } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:25:12 + --> $DIR/feature-gate-in_band_lifetimes.rs:15:12 | LL | impl<'a> X<'b> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:27:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:17:27 | LL | fn inner_2(&self) -> &'b u8 { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:33:8 + --> $DIR/feature-gate-in_band_lifetimes.rs:23:8 | LL | impl X<'b> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:35:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:25:27 | LL | fn inner_3(&self) -> &'b u8 { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:43:9 + --> $DIR/feature-gate-in_band_lifetimes.rs:33:9 | LL | impl Y<&'a u8> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:45:25 + --> $DIR/feature-gate-in_band_lifetimes.rs:35:25 | LL | fn inner(&self) -> &'a u8 { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:53:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:43:27 | LL | fn any_lifetime() -> &'b u8; | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:55:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:45:27 | LL | fn borrowed_lifetime(&'b self) -> &'b u8; | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:55:40 + --> $DIR/feature-gate-in_band_lifetimes.rs:45:40 | LL | fn borrowed_lifetime(&'b self) -> &'b u8; | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:60:14 + --> $DIR/feature-gate-in_band_lifetimes.rs:50:14 | LL | impl MyTrait<'a> for Y<&'a u8> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:60:25 + --> $DIR/feature-gate-in_band_lifetimes.rs:50:25 | LL | impl MyTrait<'a> for Y<&'a u8> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:63:31 + --> $DIR/feature-gate-in_band_lifetimes.rs:53:31 | LL | fn my_lifetime(&self) -> &'a u8 { self.0 } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:65:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:55:27 | LL | fn any_lifetime() -> &'b u8 { &0 } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:67:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:57:27 | LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:67:40 + --> $DIR/feature-gate-in_band_lifetimes.rs:57:40 | LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } | ^^ undeclared lifetime diff --git a/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.rs b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.rs index 7b68449859e..65792a74ea4 100644 --- a/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.rs +++ b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.rs @@ -1,18 +1,8 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Needs an explicit where clause stating outlives condition. (RFC 2093) // Type T needs to outlive lifetime 'static. struct Foo { - bar: Bar //~ ERROR 15:5: 15:16: the parameter type `U` may not live long enough [E0310] + bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] } struct Bar { x: T, diff --git a/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr index 13022b901a7..9f60a047cb4 100644 --- a/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr +++ b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr @@ -1,15 +1,15 @@ error[E0310]: the parameter type `U` may not live long enough - --> $DIR/feature-gate-infer_static_outlives_requirements.rs:15:5 + --> $DIR/feature-gate-infer_static_outlives_requirements.rs:5:5 | LL | struct Foo { | - help: consider adding an explicit lifetime bound `U: 'static`... -LL | bar: Bar //~ ERROR 15:5: 15:16: the parameter type `U` may not live long enough [E0310] +LL | bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] | ^^^^^^^^^^^ | note: ...so that the type `U` will meet its required lifetime bounds - --> $DIR/feature-gate-infer_static_outlives_requirements.rs:15:5 + --> $DIR/feature-gate-infer_static_outlives_requirements.rs:5:5 | -LL | bar: Bar //~ ERROR 15:5: 15:16: the parameter type `U` may not live long enough [E0310] +LL | bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-intrinsics.rs b/src/test/ui/feature-gates/feature-gate-intrinsics.rs index a4c09b21c90..d1da9433828 100644 --- a/src/test/ui/feature-gates/feature-gate-intrinsics.rs +++ b/src/test/ui/feature-gates/feature-gate-intrinsics.rs @@ -1,19 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change - fn bar(); + fn bar(); //~ ERROR unrecognized intrinsic function: `bar` } -extern "rust-intrinsic" fn baz() { //~ ERROR intrinsics are subject to change -} +extern "rust-intrinsic" fn baz() {} //~ ERROR intrinsics are subject to change -fn main() { -} +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-intrinsics.stderr b/src/test/ui/feature-gates/feature-gate-intrinsics.stderr index e583569cb99..092cb98a2f9 100644 --- a/src/test/ui/feature-gates/feature-gate-intrinsics.stderr +++ b/src/test/ui/feature-gates/feature-gate-intrinsics.stderr @@ -1,22 +1,28 @@ error[E0658]: intrinsics are subject to change - --> $DIR/feature-gate-intrinsics.rs:11:1 + --> $DIR/feature-gate-intrinsics.rs:1:1 | LL | / extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change -LL | | fn bar(); +LL | | fn bar(); //~ ERROR unrecognized intrinsic function: `bar` LL | | } | |_^ | = help: add #![feature(intrinsics)] to the crate attributes to enable error[E0658]: intrinsics are subject to change - --> $DIR/feature-gate-intrinsics.rs:15:1 + --> $DIR/feature-gate-intrinsics.rs:5:1 | -LL | / extern "rust-intrinsic" fn baz() { //~ ERROR intrinsics are subject to change -LL | | } - | |_^ +LL | extern "rust-intrinsic" fn baz() {} //~ ERROR intrinsics are subject to change + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable -error: aborting due to 2 previous errors +error[E0093]: unrecognized intrinsic function: `bar` + --> $DIR/feature-gate-intrinsics.rs:2:5 + | +LL | fn bar(); //~ ERROR unrecognized intrinsic function: `bar` + | ^^^^^^^^^ unrecognized intrinsic + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0093, E0658. +For more information about an error, try `rustc --explain E0093`. diff --git a/src/test/ui/feature-gates/feature-gate-is_sorted.rs b/src/test/ui/feature-gates/feature-gate-is_sorted.rs new file mode 100644 index 00000000000..078ecc57761 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-is_sorted.rs @@ -0,0 +1,13 @@ +fn main() { + // Assert `Iterator` methods are feature gated + assert!([1, 2, 2, 9].iter().is_sorted()); + //~^ ERROR: use of unstable library feature 'is_sorted': new API + assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs())); + //~^ ERROR: use of unstable library feature 'is_sorted': new API + + // Assert `[T]` methods are feature gated + assert!([1, 2, 2, 9].is_sorted()); + //~^ ERROR: use of unstable library feature 'is_sorted': new API + assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs())); + //~^ ERROR: use of unstable library feature 'is_sorted': new API +} diff --git a/src/test/ui/feature-gates/feature-gate-is_sorted.stderr b/src/test/ui/feature-gates/feature-gate-is_sorted.stderr new file mode 100644 index 00000000000..8230c1e3a38 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-is_sorted.stderr @@ -0,0 +1,35 @@ +error[E0658]: use of unstable library feature 'is_sorted': new API (see issue #53485) + --> $DIR/feature-gate-is_sorted.rs:3:33 + | +LL | assert!([1, 2, 2, 9].iter().is_sorted()); + | ^^^^^^^^^ + | + = help: add #![feature(is_sorted)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'is_sorted': new API (see issue #53485) + --> $DIR/feature-gate-is_sorted.rs:5:39 + | +LL | assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs())); + | ^^^^^^^^^^^^^^^^ + | + = help: add #![feature(is_sorted)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'is_sorted': new API (see issue #53485) + --> $DIR/feature-gate-is_sorted.rs:9:26 + | +LL | assert!([1, 2, 2, 9].is_sorted()); + | ^^^^^^^^^ + | + = help: add #![feature(is_sorted)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'is_sorted': new API (see issue #53485) + --> $DIR/feature-gate-is_sorted.rs:11:32 + | +LL | assert!(![-2i32, -1, 0, 3].is_sorted_by_key(|n| n.abs())); + | ^^^^^^^^^^^^^^^^ + | + = help: add #![feature(is_sorted)] to the crate attributes to enable + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-label_break_value.rs b/src/test/ui/feature-gates/feature-gate-label_break_value.rs index dcda7580bda..6fc38f45517 100644 --- a/src/test/ui/feature-gates/feature-gate-label_break_value.rs +++ b/src/test/ui/feature-gates/feature-gate-label_break_value.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { 'a: { //~ ERROR labels on blocks are unstable break 'a; diff --git a/src/test/ui/feature-gates/feature-gate-label_break_value.stderr b/src/test/ui/feature-gates/feature-gate-label_break_value.stderr index 8e8f31e7871..347b8a9710e 100644 --- a/src/test/ui/feature-gates/feature-gate-label_break_value.stderr +++ b/src/test/ui/feature-gates/feature-gate-label_break_value.stderr @@ -1,5 +1,5 @@ error[E0658]: labels on blocks are unstable (see issue #48594) - --> $DIR/feature-gate-label_break_value.rs:12:5 + --> $DIR/feature-gate-label_break_value.rs:2:5 | LL | 'a: { //~ ERROR labels on blocks are unstable | ^^ diff --git a/src/test/ui/feature-gates/feature-gate-lang-items.rs b/src/test/ui/feature-gates/feature-gate-lang-items.rs index 0435ff4c332..93262f2171b 100644 --- a/src/test/ui/feature-gates/feature-gate-lang-items.rs +++ b/src/test/ui/feature-gates/feature-gate-lang-items.rs @@ -1,15 +1,5 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[lang="foo"] //~ ERROR language items are subject to change +#[lang = "foo"] //~ ERROR language items are subject to change + //~^ ERROR definition of an unknown language item: `foo` trait Foo {} -fn main() { -} +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-lang-items.stderr b/src/test/ui/feature-gates/feature-gate-lang-items.stderr index ef3e7947280..ccbb711fe6d 100644 --- a/src/test/ui/feature-gates/feature-gate-lang-items.stderr +++ b/src/test/ui/feature-gates/feature-gate-lang-items.stderr @@ -1,11 +1,18 @@ error[E0658]: language items are subject to change - --> $DIR/feature-gate-lang-items.rs:11:1 + --> $DIR/feature-gate-lang-items.rs:1:1 | -LL | #[lang="foo"] //~ ERROR language items are subject to change - | ^^^^^^^^^^^^^ +LL | #[lang = "foo"] //~ ERROR language items are subject to change + | ^^^^^^^^^^^^^^^ | = help: add #![feature(lang_items)] to the crate attributes to enable -error: aborting due to previous error +error[E0522]: definition of an unknown language item: `foo` + --> $DIR/feature-gate-lang-items.rs:1:1 + | +LL | #[lang = "foo"] //~ ERROR language items are subject to change + | ^^^^^^^^^^^^^^^ definition of unknown language item `foo` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0522, E0658. +For more information about an error, try `rustc --explain E0522`. diff --git a/src/test/ui/feature-gates/feature-gate-link_args.rs b/src/test/ui/feature-gates/feature-gate-link_args.rs index bd48ac673dd..49948dab1ee 100644 --- a/src/test/ui/feature-gates/feature-gate-link_args.rs +++ b/src/test/ui/feature-gates/feature-gate-link_args.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `#[link_args]` attribute is gated by `link_args` // feature gate, both when it occurs where expected (atop // `extern { }` blocks) and where unexpected. diff --git a/src/test/ui/feature-gates/feature-gate-link_args.stderr b/src/test/ui/feature-gates/feature-gate-link_args.stderr index 86a2818b344..c43377fe630 100644 --- a/src/test/ui/feature-gates/feature-gate-link_args.stderr +++ b/src/test/ui/feature-gates/feature-gate-link_args.stderr @@ -1,5 +1,5 @@ error[E0658]: the `link_args` attribute is experimental and not portable across platforms, it is recommended to use `#[link(name = "foo")] instead (see issue #29596) - --> $DIR/feature-gate-link_args.rs:22:1 + --> $DIR/feature-gate-link_args.rs:12:1 | LL | #[link_args = "-l expected_use_case"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #[link_args = "-l expected_use_case"] = help: add #![feature(link_args)] to the crate attributes to enable error[E0658]: the `link_args` attribute is experimental and not portable across platforms, it is recommended to use `#[link(name = "foo")] instead (see issue #29596) - --> $DIR/feature-gate-link_args.rs:26:1 + --> $DIR/feature-gate-link_args.rs:16:1 | LL | #[link_args = "-l unexected_use_on_non_extern_item"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | #[link_args = "-l unexected_use_on_non_extern_item"] = help: add #![feature(link_args)] to the crate attributes to enable error[E0658]: the `link_args` attribute is experimental and not portable across platforms, it is recommended to use `#[link(name = "foo")] instead (see issue #29596) - --> $DIR/feature-gate-link_args.rs:19:1 + --> $DIR/feature-gate-link_args.rs:9:1 | LL | #![link_args = "-l unexpected_use_as_inner_attr_on_mod"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-link_cfg.rs b/src/test/ui/feature-gates/feature-gate-link_cfg.rs index 27918a27caf..1905346e2b5 100644 --- a/src/test/ui/feature-gates/feature-gate-link_cfg.rs +++ b/src/test/ui/feature-gates/feature-gate-link_cfg.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link(name = "foo", cfg(foo))] //~^ ERROR: is feature gated extern {} diff --git a/src/test/ui/feature-gates/feature-gate-link_cfg.stderr b/src/test/ui/feature-gates/feature-gate-link_cfg.stderr index 1da8c3e922d..b5ac5fdb86a 100644 --- a/src/test/ui/feature-gates/feature-gate-link_cfg.stderr +++ b/src/test/ui/feature-gates/feature-gate-link_cfg.stderr @@ -1,5 +1,5 @@ error[E0658]: is feature gated (see issue #37406) - --> $DIR/feature-gate-link_cfg.rs:11:1 + --> $DIR/feature-gate-link_cfg.rs:1:1 | LL | #[link(name = "foo", cfg(foo))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.rs b/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.rs index 92a1b071437..1c7f3313328 100644 --- a/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.rs +++ b/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { #[link_name = "llvm.sqrt.f32"] fn sqrt(x: f32) -> f32; diff --git a/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.stderr b/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.stderr index 7a9c5955958..a6cfc99ecd2 100644 --- a/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.stderr +++ b/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.stderr @@ -1,5 +1,5 @@ error[E0658]: linking to LLVM intrinsics is experimental (see issue #29602) - --> $DIR/feature-gate-link_llvm_intrinsics.rs:13:5 + --> $DIR/feature-gate-link_llvm_intrinsics.rs:3:5 | LL | fn sqrt(x: f32) -> f32; | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-linkage.rs b/src/test/ui/feature-gates/feature-gate-linkage.rs index 555cc2b9a7a..70f33cc0c6c 100644 --- a/src/test/ui/feature-gates/feature-gate-linkage.rs +++ b/src/test/ui/feature-gates/feature-gate-linkage.rs @@ -1,14 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { #[linkage = "extern_weak"] static foo: isize; //~^ ERROR: the `linkage` attribute is experimental and not portable } + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-linkage.stderr b/src/test/ui/feature-gates/feature-gate-linkage.stderr index 2fc1a3e1ae5..1399a84faf6 100644 --- a/src/test/ui/feature-gates/feature-gate-linkage.stderr +++ b/src/test/ui/feature-gates/feature-gate-linkage.stderr @@ -1,5 +1,5 @@ error[E0658]: the `linkage` attribute is experimental and not portable across platforms (see issue #29603) - --> $DIR/feature-gate-linkage.rs:12:5 + --> $DIR/feature-gate-linkage.rs:2:5 | LL | #[linkage = "extern_weak"] static foo: isize; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-linker-flavor.rs b/src/test/ui/feature-gates/feature-gate-linker-flavor.rs deleted file mode 100644 index 711159647b7..00000000000 --- a/src/test/ui/feature-gates/feature-gate-linker-flavor.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// This is a fake compile fail test as there's no way to generate a -// `#![feature(linker_flavor)]` error. The only reason we have a `linker_flavor` -// feature gate is to be able to document `-Z linker-flavor` in the unstable -// book - -#[used] -fn foo() {} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-linker-flavor.stderr b/src/test/ui/feature-gates/feature-gate-linker-flavor.stderr deleted file mode 100644 index 7019a666548..00000000000 --- a/src/test/ui/feature-gates/feature-gate-linker-flavor.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: attribute must be applied to a `static` variable - --> $DIR/feature-gate-linker-flavor.rs:16:1 - | -LL | #[used] - | ^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/feature-gates/feature-gate-log_syntax.rs b/src/test/ui/feature-gates/feature-gate-log_syntax.rs index 63c66e53c5e..181f66cb08e 100644 --- a/src/test/ui/feature-gates/feature-gate-log_syntax.rs +++ b/src/test/ui/feature-gates/feature-gate-log_syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { log_syntax!() //~ ERROR `log_syntax!` is not stable enough } diff --git a/src/test/ui/feature-gates/feature-gate-log_syntax.stderr b/src/test/ui/feature-gates/feature-gate-log_syntax.stderr index d9934be778e..33d1f07aa36 100644 --- a/src/test/ui/feature-gates/feature-gate-log_syntax.stderr +++ b/src/test/ui/feature-gates/feature-gate-log_syntax.stderr @@ -1,5 +1,5 @@ error[E0658]: `log_syntax!` is not stable enough for use and is subject to change (see issue #29598) - --> $DIR/feature-gate-log_syntax.rs:12:5 + --> $DIR/feature-gate-log_syntax.rs:2:5 | LL | log_syntax!() //~ ERROR `log_syntax!` is not stable enough | ^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-log_syntax.stdout b/src/test/ui/feature-gates/feature-gate-log_syntax.stdout new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-log_syntax.stdout @@ -0,0 +1 @@ + diff --git a/src/test/ui/feature-gates/feature-gate-log_syntax2.rs b/src/test/ui/feature-gates/feature-gate-log_syntax2.rs index dcbe7eefee5..a3906dcc16e 100644 --- a/src/test/ui/feature-gates/feature-gate-log_syntax2.rs +++ b/src/test/ui/feature-gates/feature-gate-log_syntax2.rs @@ -1,15 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-log_syntax fn main() { - println!("{}", log_syntax!()); //~ ERROR `log_syntax!` is not stable + println!("{:?}", log_syntax!()); //~ ERROR `log_syntax!` is not stable } diff --git a/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr b/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr index 19e7de1a824..bdcd922c6e1 100644 --- a/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr +++ b/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr @@ -1,8 +1,8 @@ error[E0658]: `log_syntax!` is not stable enough for use and is subject to change (see issue #29598) - --> $DIR/feature-gate-log_syntax2.rs:14:20 + --> $DIR/feature-gate-log_syntax2.rs:4:22 | -LL | println!("{}", log_syntax!()); //~ ERROR `log_syntax!` is not stable - | ^^^^^^^^^^^^^ +LL | println!("{:?}", log_syntax!()); //~ ERROR `log_syntax!` is not stable + | ^^^^^^^^^^^^^ | = help: add #![feature(log_syntax)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-log_syntax2.stdout b/src/test/ui/feature-gates/feature-gate-log_syntax2.stdout new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-log_syntax2.stdout @@ -0,0 +1 @@ + diff --git a/src/test/ui/feature-gates/feature-gate-macro-literal-matcher.rs b/src/test/ui/feature-gates/feature-gate-macro-literal-matcher.rs deleted file mode 100644 index db5cca193ab..00000000000 --- a/src/test/ui/feature-gates/feature-gate-macro-literal-matcher.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that the :lifetime macro fragment cannot be used when macro_lifetime_matcher -// feature gate is not used. - -macro_rules! m { ($lt:literal) => {} } -//~^ ERROR :literal fragment specifier is experimental and subject to change - -fn main() { - m!("some string literal"); -} diff --git a/src/test/ui/feature-gates/feature-gate-macro-literal-matcher.stderr b/src/test/ui/feature-gates/feature-gate-macro-literal-matcher.stderr deleted file mode 100644 index f714b916966..00000000000 --- a/src/test/ui/feature-gates/feature-gate-macro-literal-matcher.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: :literal fragment specifier is experimental and subject to change (see issue #35625) - --> $DIR/feature-gate-macro-literal-matcher.rs:14:19 - | -LL | macro_rules! m { ($lt:literal) => {} } - | ^^^^^^^^^^^ - | - = help: add #![feature(macro_literal_matcher)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-macros_in_extern.rs b/src/test/ui/feature-gates/feature-gate-macros_in_extern.rs index 77080e3c348..125af64fef0 100644 --- a/src/test/ui/feature-gates/feature-gate-macros_in_extern.rs +++ b/src/test/ui/feature-gates/feature-gate-macros_in_extern.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] macro_rules! returns_isize( @@ -33,3 +23,5 @@ extern { emits_nothing!(); //~^ ERROR macro invocations in `extern {}` blocks are experimental } + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-macros_in_extern.stderr b/src/test/ui/feature-gates/feature-gate-macros_in_extern.stderr index 23b63078dbf..affef0fe7d3 100644 --- a/src/test/ui/feature-gates/feature-gate-macros_in_extern.stderr +++ b/src/test/ui/feature-gates/feature-gate-macros_in_extern.stderr @@ -1,5 +1,5 @@ error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) - --> $DIR/feature-gate-macros_in_extern.rs:29:5 + --> $DIR/feature-gate-macros_in_extern.rs:19:5 | LL | returns_isize!(rust_get_test_int); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | returns_isize!(rust_get_test_int); = help: add #![feature(macros_in_extern)] to the crate attributes to enable error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) - --> $DIR/feature-gate-macros_in_extern.rs:31:5 + --> $DIR/feature-gate-macros_in_extern.rs:21:5 | LL | takes_u32_returns_u32!(rust_dbg_extern_identity_u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | takes_u32_returns_u32!(rust_dbg_extern_identity_u32); = help: add #![feature(macros_in_extern)] to the crate attributes to enable error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) - --> $DIR/feature-gate-macros_in_extern.rs:33:5 + --> $DIR/feature-gate-macros_in_extern.rs:23:5 | LL | emits_nothing!(); | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-main.rs b/src/test/ui/feature-gates/feature-gate-main.rs index db1c1a94417..681bdca3925 100644 --- a/src/test/ui/feature-gates/feature-gate-main.rs +++ b/src/test/ui/feature-gates/feature-gate-main.rs @@ -1,12 +1,2 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[main] fn foo() {} //~ ERROR: declaration of a nonstandard #[main] function may change over time diff --git a/src/test/ui/feature-gates/feature-gate-main.stderr b/src/test/ui/feature-gates/feature-gate-main.stderr index 34c9fd15f7c..c92887eded6 100644 --- a/src/test/ui/feature-gates/feature-gate-main.stderr +++ b/src/test/ui/feature-gates/feature-gate-main.stderr @@ -1,5 +1,5 @@ error[E0658]: declaration of a nonstandard #[main] function may change over time, for now a top-level `fn main()` is required (see issue #29634) - --> $DIR/feature-gate-main.rs:12:1 + --> $DIR/feature-gate-main.rs:2:1 | LL | fn foo() {} //~ ERROR: declaration of a nonstandard #[main] function may change over time | ^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-marker_trait_attr.rs b/src/test/ui/feature-gates/feature-gate-marker_trait_attr.rs index 508ffe3845b..2b1b5bba6e1 100644 --- a/src/test/ui/feature-gates/feature-gate-marker_trait_attr.rs +++ b/src/test/ui/feature-gates/feature-gate-marker_trait_attr.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::{Debug, Display}; #[marker] trait ExplicitMarker {} diff --git a/src/test/ui/feature-gates/feature-gate-marker_trait_attr.stderr b/src/test/ui/feature-gates/feature-gate-marker_trait_attr.stderr index 4023a04000a..e916df18b66 100644 --- a/src/test/ui/feature-gates/feature-gate-marker_trait_attr.stderr +++ b/src/test/ui/feature-gates/feature-gate-marker_trait_attr.stderr @@ -1,5 +1,5 @@ error[E0658]: marker traits is an experimental feature (see issue #29864) - --> $DIR/feature-gate-marker_trait_attr.rs:13:1 + --> $DIR/feature-gate-marker_trait_attr.rs:3:1 | LL | #[marker] trait ExplicitMarker {} | ^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-may-dangle.rs b/src/test/ui/feature-gates/feature-gate-may-dangle.rs index a67ece04488..20896e426f6 100644 --- a/src/test/ui/feature-gates/feature-gate-may-dangle.rs +++ b/src/test/ui/feature-gates/feature-gate-may-dangle.rs @@ -1,19 +1,11 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-dropck_eyepatch // Check that `may_dangle` is rejected if `dropck_eyepatch` feature gate is absent. struct Pt(A); -impl<#[may_dangle] A> Drop for Pt { +unsafe impl<#[may_dangle] A> Drop for Pt { //~^ ERROR may_dangle has unstable semantics and may be removed in the future fn drop(&mut self) { } } + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-may-dangle.stderr b/src/test/ui/feature-gates/feature-gate-may-dangle.stderr index aad725dfe65..6d21147c9ee 100644 --- a/src/test/ui/feature-gates/feature-gate-may-dangle.stderr +++ b/src/test/ui/feature-gates/feature-gate-may-dangle.stderr @@ -1,8 +1,8 @@ error[E0658]: may_dangle has unstable semantics and may be removed in the future (see issue #34761) - --> $DIR/feature-gate-may-dangle.rs:16:6 + --> $DIR/feature-gate-may-dangle.rs:6:13 | -LL | impl<#[may_dangle] A> Drop for Pt { - | ^^^^^^^^^^^^^ +LL | unsafe impl<#[may_dangle] A> Drop for Pt { + | ^^^^^^^^^^^^^ | = help: add #![feature(dropck_eyepatch)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-min_const_fn.rs b/src/test/ui/feature-gates/feature-gate-min_const_fn.rs index 40cb75316ef..669631df2ad 100644 --- a/src/test/ui/feature-gates/feature-gate-min_const_fn.rs +++ b/src/test/ui/feature-gates/feature-gate-min_const_fn.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test use of min_const_fn without feature gate. const fn foo() -> usize { 0 } // stabilized @@ -19,14 +9,16 @@ trait Foo { //~| ERROR trait fns cannot be declared const } -impl Foo { - const fn baz() -> u32 { 0 } // stabilized -} - impl Foo for u32 { const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const } +trait Bar {} + +impl dyn Bar { + const fn baz() -> u32 { 0 } // stabilized +} + static FOO: usize = foo(); const BAR: usize = foo(); diff --git a/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr b/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr index 34526746db8..056e33111f0 100644 --- a/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr +++ b/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr @@ -1,31 +1,31 @@ error[E0379]: trait fns cannot be declared const - --> $DIR/feature-gate-min_const_fn.rs:16:5 + --> $DIR/feature-gate-min_const_fn.rs:6:5 | LL | const fn foo() -> u32; //~ ERROR const fn is unstable | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const - --> $DIR/feature-gate-min_const_fn.rs:18:5 + --> $DIR/feature-gate-min_const_fn.rs:8:5 | LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const - --> $DIR/feature-gate-min_const_fn.rs:27:5 + --> $DIR/feature-gate-min_const_fn.rs:13:5 | LL | const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const | ^^^^^ trait fns cannot be const -error[E0658]: const fn is unstable (see issue #24111) - --> $DIR/feature-gate-min_const_fn.rs:16:5 +error[E0658]: const fn is unstable (see issue #57563) + --> $DIR/feature-gate-min_const_fn.rs:6:5 | LL | const fn foo() -> u32; //~ ERROR const fn is unstable | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable -error[E0658]: const fn is unstable (see issue #24111) - --> $DIR/feature-gate-min_const_fn.rs:18:5 +error[E0658]: const fn is unstable (see issue #57563) + --> $DIR/feature-gate-min_const_fn.rs:8:5 | LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-naked_functions.rs b/src/test/ui/feature-gates/feature-gate-naked_functions.rs index ceb475e1192..16a51a1e82f 100644 --- a/src/test/ui/feature-gates/feature-gate-naked_functions.rs +++ b/src/test/ui/feature-gates/feature-gate-naked_functions.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[naked] //~^ the `#[naked]` attribute is an experimental feature fn naked() {} @@ -17,3 +7,5 @@ fn naked() {} fn naked_2() -> isize { 0 } + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-naked_functions.stderr b/src/test/ui/feature-gates/feature-gate-naked_functions.stderr index a2d3dfc83ae..2ff5ef101e0 100644 --- a/src/test/ui/feature-gates/feature-gate-naked_functions.stderr +++ b/src/test/ui/feature-gates/feature-gate-naked_functions.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[naked]` attribute is an experimental feature (see issue #32408) - --> $DIR/feature-gate-naked_functions.rs:11:1 + --> $DIR/feature-gate-naked_functions.rs:1:1 | LL | #[naked] | ^^^^^^^^ @@ -7,7 +7,7 @@ LL | #[naked] = help: add #![feature(naked_functions)] to the crate attributes to enable error[E0658]: the `#[naked]` attribute is an experimental feature (see issue #32408) - --> $DIR/feature-gate-naked_functions.rs:15:1 + --> $DIR/feature-gate-naked_functions.rs:5:1 | LL | #[naked] | ^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-needs-allocator.rs b/src/test/ui/feature-gates/feature-gate-needs-allocator.rs index 1809564f5de..a3f91d02b3e 100644 --- a/src/test/ui/feature-gates/feature-gate-needs-allocator.rs +++ b/src/test/ui/feature-gates/feature-gate-needs-allocator.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![needs_allocator] //~ ERROR the `#[needs_allocator]` attribute is fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr b/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr index 13665b2a0eb..8897f393dbd 100644 --- a/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr +++ b/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[needs_allocator]` attribute is an experimental feature - --> $DIR/feature-gate-needs-allocator.rs:11:1 + --> $DIR/feature-gate-needs-allocator.rs:1:1 | LL | #![needs_allocator] //~ ERROR the `#[needs_allocator]` attribute is | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-negate-unsigned.rs b/src/test/ui/feature-gates/feature-gate-negate-unsigned.rs index 599e31341f2..05e04f3e2b4 100644 --- a/src/test/ui/feature-gates/feature-gate-negate-unsigned.rs +++ b/src/test/ui/feature-gates/feature-gate-negate-unsigned.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that negating unsigned integers doesn't compile struct S; diff --git a/src/test/ui/feature-gates/feature-gate-negate-unsigned.stderr b/src/test/ui/feature-gates/feature-gate-negate-unsigned.stderr index 85e9b56e4af..aa84c27e40f 100644 --- a/src/test/ui/feature-gates/feature-gate-negate-unsigned.stderr +++ b/src/test/ui/feature-gates/feature-gate-negate-unsigned.stderr @@ -1,5 +1,5 @@ error[E0600]: cannot apply unary operator `-` to type `usize` - --> $DIR/feature-gate-negate-unsigned.rs:20:23 + --> $DIR/feature-gate-negate-unsigned.rs:10:23 | LL | let _max: usize = -1; | ^^ cannot apply unary operator `-` @@ -7,7 +7,7 @@ LL | let _max: usize = -1; = note: unsigned values cannot be negated error[E0600]: cannot apply unary operator `-` to type `u8` - --> $DIR/feature-gate-negate-unsigned.rs:24:14 + --> $DIR/feature-gate-negate-unsigned.rs:14:14 | LL | let _y = -x; | ^^ cannot apply unary operator `-` diff --git a/src/test/ui/feature-gates/feature-gate-never_type.rs b/src/test/ui/feature-gates/feature-gate-never_type.rs index ebbe17a821f..be8c27dbb1b 100644 --- a/src/test/ui/feature-gates/feature-gate-never_type.rs +++ b/src/test/ui/feature-gates/feature-gate-never_type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that ! errors when used in illegal positions with feature(never_type) disabled trait Foo { @@ -16,8 +6,8 @@ trait Foo { type Ma = (u32, !, i32); //~ ERROR type is experimental type Meeshka = Vec; //~ ERROR type is experimental -type Mow = &fn(!) -> !; //~ ERROR type is experimental -type Skwoz = &mut !; //~ ERROR type is experimental +type Mow = &'static fn(!) -> !; //~ ERROR type is experimental +type Skwoz = &'static mut !; //~ ERROR type is experimental impl Foo for Meeshka { type Wub = !; //~ ERROR type is experimental diff --git a/src/test/ui/feature-gates/feature-gate-never_type.stderr b/src/test/ui/feature-gates/feature-gate-never_type.stderr index 187be6d8291..c4f8771171e 100644 --- a/src/test/ui/feature-gates/feature-gate-never_type.stderr +++ b/src/test/ui/feature-gates/feature-gate-never_type.stderr @@ -1,5 +1,5 @@ error[E0658]: The `!` type is experimental (see issue #35121) - --> $DIR/feature-gate-never_type.rs:17:17 + --> $DIR/feature-gate-never_type.rs:7:17 | LL | type Ma = (u32, !, i32); //~ ERROR type is experimental | ^ @@ -7,7 +7,7 @@ LL | type Ma = (u32, !, i32); //~ ERROR type is experimental = help: add #![feature(never_type)] to the crate attributes to enable error[E0658]: The `!` type is experimental (see issue #35121) - --> $DIR/feature-gate-never_type.rs:18:20 + --> $DIR/feature-gate-never_type.rs:8:20 | LL | type Meeshka = Vec; //~ ERROR type is experimental | ^ @@ -15,23 +15,23 @@ LL | type Meeshka = Vec; //~ ERROR type is experimental = help: add #![feature(never_type)] to the crate attributes to enable error[E0658]: The `!` type is experimental (see issue #35121) - --> $DIR/feature-gate-never_type.rs:19:16 + --> $DIR/feature-gate-never_type.rs:9:24 | -LL | type Mow = &fn(!) -> !; //~ ERROR type is experimental - | ^ +LL | type Mow = &'static fn(!) -> !; //~ ERROR type is experimental + | ^ | = help: add #![feature(never_type)] to the crate attributes to enable error[E0658]: The `!` type is experimental (see issue #35121) - --> $DIR/feature-gate-never_type.rs:20:19 + --> $DIR/feature-gate-never_type.rs:10:27 | -LL | type Skwoz = &mut !; //~ ERROR type is experimental - | ^ +LL | type Skwoz = &'static mut !; //~ ERROR type is experimental + | ^ | = help: add #![feature(never_type)] to the crate attributes to enable error[E0658]: The `!` type is experimental (see issue #35121) - --> $DIR/feature-gate-never_type.rs:23:16 + --> $DIR/feature-gate-never_type.rs:13:16 | LL | type Wub = !; //~ ERROR type is experimental | ^ diff --git a/src/test/ui/feature-gates/feature-gate-no-debug-2.rs b/src/test/ui/feature-gates/feature-gate-no-debug-2.rs index b663c136ee5..b399bd2cc0f 100644 --- a/src/test/ui/feature-gates/feature-gate-no-debug-2.rs +++ b/src/test/ui/feature-gates/feature-gate-no-debug-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(deprecated)] #![feature(no_debug)] diff --git a/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr b/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr index 183feae2232..9299ac739ce 100644 --- a/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr +++ b/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr @@ -1,11 +1,11 @@ error: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721 - --> $DIR/feature-gate-no-debug-2.rs:14:1 + --> $DIR/feature-gate-no-debug-2.rs:4:1 | LL | #[no_debug] //~ ERROR use of deprecated attribute `no_debug` | ^^^^^^^^^^^ help: remove this attribute | note: lint level defined here - --> $DIR/feature-gate-no-debug-2.rs:11:9 + --> $DIR/feature-gate-no-debug-2.rs:1:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-no-debug.rs b/src/test/ui/feature-gates/feature-gate-no-debug.rs index d21493de50a..a472c4c7663 100644 --- a/src/test/ui/feature-gates/feature-gate-no-debug.rs +++ b/src/test/ui/feature-gates/feature-gate-no-debug.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(deprecated)] #[no_debug] //~ ERROR the `#[no_debug]` attribute was diff --git a/src/test/ui/feature-gates/feature-gate-no-debug.stderr b/src/test/ui/feature-gates/feature-gate-no-debug.stderr index 55fad0d99cf..bdb732af7d2 100644 --- a/src/test/ui/feature-gates/feature-gate-no-debug.stderr +++ b/src/test/ui/feature-gates/feature-gate-no-debug.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand (see issue #29721) - --> $DIR/feature-gate-no-debug.rs:13:1 + --> $DIR/feature-gate-no-debug.rs:3:1 | LL | #[no_debug] //~ ERROR the `#[no_debug]` attribute was | ^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-no_core.rs b/src/test/ui/feature-gates/feature-gate-no_core.rs index 0a55a8a78ce..40178edd74b 100644 --- a/src/test/ui/feature-gates/feature-gate-no_core.rs +++ b/src/test/ui/feature-gates/feature-gate-no_core.rs @@ -1,13 +1,5 @@ -// Copyright 2105 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#![crate_type = "rlib"] #![no_core] //~ ERROR no_core is experimental -fn main() {} +pub struct S {} diff --git a/src/test/ui/feature-gates/feature-gate-no_core.stderr b/src/test/ui/feature-gates/feature-gate-no_core.stderr index c8813dcd991..7390051b95d 100644 --- a/src/test/ui/feature-gates/feature-gate-no_core.stderr +++ b/src/test/ui/feature-gates/feature-gate-no_core.stderr @@ -1,5 +1,5 @@ error[E0658]: no_core is experimental (see issue #29639) - --> $DIR/feature-gate-no_core.rs:11:1 + --> $DIR/feature-gate-no_core.rs:3:1 | LL | #![no_core] //~ ERROR no_core is experimental | ^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-non_ascii_idents.rs b/src/test/ui/feature-gates/feature-gate-non_ascii_idents.rs index 9e042c3a7d5..11ff5405848 100644 --- a/src/test/ui/feature-gates/feature-gate-non_ascii_idents.rs +++ b/src/test/ui/feature-gates/feature-gate-non_ascii_idents.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate core as bäz; //~ ERROR non-ascii idents use föö::bar; //~ ERROR non-ascii idents diff --git a/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr b/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr index a2853570d6d..5c441189ea7 100644 --- a/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr +++ b/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr @@ -1,101 +1,101 @@ -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:11:22 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:1:22 | LL | extern crate core as bäz; //~ ERROR non-ascii idents | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:13:5 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:3:5 | LL | use föö::bar; //~ ERROR non-ascii idents | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:15:5 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:5:5 | LL | mod föö { //~ ERROR non-ascii idents | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:19:4 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:9:4 | LL | fn bär( //~ ERROR non-ascii idents | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:20:5 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:10:5 | LL | bäz: isize //~ ERROR non-ascii idents | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:22:9 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:12:9 | LL | let _ö: isize; //~ ERROR non-ascii idents | ^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:25:10 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:15:10 | LL | (_ä, _) => {} //~ ERROR non-ascii idents | ^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:29:8 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:19:8 | LL | struct Föö { //~ ERROR non-ascii idents | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:30:5 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:20:5 | LL | föö: isize //~ ERROR non-ascii idents | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:33:6 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:23:6 | LL | enum Bär { //~ ERROR non-ascii idents | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:34:5 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:24:5 | LL | Bäz { //~ ERROR non-ascii idents | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:35:9 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:25:9 | LL | qüx: isize //~ ERROR non-ascii idents | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/feature-gate-non_ascii_idents.rs:40:8 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/feature-gate-non_ascii_idents.rs:30:8 | LL | fn qüx(); //~ ERROR non-ascii idents | ^^^ diff --git a/src/test/ui/feature-gates/feature-gate-non_exhaustive.rs b/src/test/ui/feature-gates/feature-gate-non_exhaustive.rs index d2711084a4d..b3e2e3d95f5 100644 --- a/src/test/ui/feature-gates/feature-gate-non_exhaustive.rs +++ b/src/test/ui/feature-gates/feature-gate-non_exhaustive.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //#![feature(non_exhaustive)] #[non_exhaustive] //~ERROR non exhaustive is an experimental feature (see issue #44109) diff --git a/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr b/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr index 67f103d852a..9b45e19c3a3 100644 --- a/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr +++ b/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr @@ -1,5 +1,5 @@ error[E0658]: non exhaustive is an experimental feature (see issue #44109) - --> $DIR/feature-gate-non_exhaustive.rs:13:1 + --> $DIR/feature-gate-non_exhaustive.rs:3:1 | LL | #[non_exhaustive] //~ERROR non exhaustive is an experimental feature (see issue #44109) | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs b/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs index a837a7f213e..66bf7973832 100644 --- a/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs +++ b/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs @@ -1,12 +1,2 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[omit_gdb_pretty_printer_section] //~ ERROR the `#[omit_gdb_pretty_printer_section]` attribute is fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr b/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr index 253811400ef..de1f03cc170 100644 --- a/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr +++ b/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite - --> $DIR/feature-gate-omit-gdb-pretty-printer-section.rs:11:1 + --> $DIR/feature-gate-omit-gdb-pretty-printer-section.rs:1:1 | LL | #[omit_gdb_pretty_printer_section] //~ ERROR the `#[omit_gdb_pretty_printer_section]` attribute is | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-on-unimplemented.rs b/src/test/ui/feature-gates/feature-gate-on-unimplemented.rs index 5d32bba6a76..bec1531c533 100644 --- a/src/test/ui/feature-gates/feature-gate-on-unimplemented.rs +++ b/src/test/ui/feature-gates/feature-gate-on-unimplemented.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `#[rustc_on_unimplemented]` is gated by `on_unimplemented` feature // gate. diff --git a/src/test/ui/feature-gates/feature-gate-on-unimplemented.stderr b/src/test/ui/feature-gates/feature-gate-on-unimplemented.stderr index a059f5e3c4d..32bfb20d5ed 100644 --- a/src/test/ui/feature-gates/feature-gate-on-unimplemented.stderr +++ b/src/test/ui/feature-gates/feature-gate-on-unimplemented.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[rustc_on_unimplemented]` attribute is an experimental feature (see issue #29628) - --> $DIR/feature-gate-on-unimplemented.rs:14:1 + --> $DIR/feature-gate-on-unimplemented.rs:4:1 | LL | #[rustc_on_unimplemented = "test error `{Self}` with `{Bar}`"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.rs b/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.rs index ab3313af16d..35c05b75d36 100644 --- a/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.rs +++ b/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.rs @@ -1,26 +1,12 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that default and negative trait implementations are gated by // `optin_builtin_traits` feature gate struct DummyStruct; -trait DummyTrait { - fn dummy(&self) {} -} - auto trait AutoDummyTrait {} //~^ ERROR auto traits are experimental and possibly buggy -impl !DummyTrait for DummyStruct {} +impl !AutoDummyTrait for DummyStruct {} //~^ ERROR negative trait bounds are not yet fully implemented; use marker types for now fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.stderr b/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.stderr index 8bd07ffd122..e5d0a8681fb 100644 --- a/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.stderr +++ b/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.stderr @@ -1,5 +1,5 @@ error[E0658]: auto traits are experimental and possibly buggy (see issue #13231) - --> $DIR/feature-gate-optin-builtin-traits.rs:20:1 + --> $DIR/feature-gate-optin-builtin-traits.rs:6:1 | LL | auto trait AutoDummyTrait {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,10 +7,10 @@ LL | auto trait AutoDummyTrait {} = help: add #![feature(optin_builtin_traits)] to the crate attributes to enable error[E0658]: negative trait bounds are not yet fully implemented; use marker types for now (see issue #13231) - --> $DIR/feature-gate-optin-builtin-traits.rs:23:1 + --> $DIR/feature-gate-optin-builtin-traits.rs:9:1 | -LL | impl !DummyTrait for DummyStruct {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl !AutoDummyTrait for DummyStruct {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(optin_builtin_traits)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-overlapping_marker_traits.rs b/src/test/ui/feature-gates/feature-gate-overlapping_marker_traits.rs index d2aa4e59b5b..6922d6f8387 100644 --- a/src/test/ui/feature-gates/feature-gate-overlapping_marker_traits.rs +++ b/src/test/ui/feature-gates/feature-gate-overlapping_marker_traits.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::{Debug, Display}; trait MyMarker {} diff --git a/src/test/ui/feature-gates/feature-gate-overlapping_marker_traits.stderr b/src/test/ui/feature-gates/feature-gate-overlapping_marker_traits.stderr index 040ad019b9f..5ce4c5cccb3 100644 --- a/src/test/ui/feature-gates/feature-gate-overlapping_marker_traits.stderr +++ b/src/test/ui/feature-gates/feature-gate-overlapping_marker_traits.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `MyMarker`: - --> $DIR/feature-gate-overlapping_marker_traits.rs:16:1 + --> $DIR/feature-gate-overlapping_marker_traits.rs:6:1 | LL | impl MyMarker for T {} | ------------------------------- first implementation here diff --git a/src/test/ui/feature-gates/feature-gate-plugin.rs b/src/test/ui/feature-gates/feature-gate-plugin.rs index 3b5d7626ce3..977a5556899 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin.rs +++ b/src/test/ui/feature-gates/feature-gate-plugin.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `#![plugin(...)]` attribute is gated by `plugin` feature gate #![plugin(foo)] diff --git a/src/test/ui/feature-gates/feature-gate-plugin.stderr b/src/test/ui/feature-gates/feature-gate-plugin.stderr index 366e293c182..0feebb6f0e0 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin.stderr +++ b/src/test/ui/feature-gates/feature-gate-plugin.stderr @@ -1,5 +1,5 @@ error[E0658]: compiler plugins are experimental and possibly buggy (see issue #29597) - --> $DIR/feature-gate-plugin.rs:13:1 + --> $DIR/feature-gate-plugin.rs:3:1 | LL | #![plugin(foo)] | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs b/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs index 9cdebde7b7b..0e357f89d14 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs +++ b/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `#[plugin_registrar]` attribute is gated by `plugin_registrar` // feature gate. diff --git a/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr b/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr index 3e6ffb6ef1a..6464d4087be 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr +++ b/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr @@ -1,5 +1,5 @@ error[E0658]: compiler plugins are experimental and possibly buggy (see issue #29597) - --> $DIR/feature-gate-plugin_registrar.rs:16:1 + --> $DIR/feature-gate-plugin_registrar.rs:6:1 | LL | pub fn registrar() {} | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs new file mode 100644 index 00000000000..1208552d256 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.rs @@ -0,0 +1,14 @@ +#![feature(exclusive_range_pattern)] + +use std::usize::MAX; + +fn main() { + match 0usize { //~ERROR non-exhaustive patterns: `_` not covered + 0..=MAX => {} + } + + match 0isize { //~ERROR non-exhaustive patterns: `_` not covered + 1..=20 => {} + -5..3 => {} + } +} diff --git a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr new file mode 100644 index 00000000000..5806f6f0391 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr @@ -0,0 +1,15 @@ +error[E0004]: non-exhaustive patterns: `_` not covered + --> $DIR/feature-gate-precise_pointer_size_matching.rs:6:11 + | +LL | match 0usize { //~ERROR non-exhaustive patterns: `_` not covered + | ^^^^^^ pattern `_` not covered + +error[E0004]: non-exhaustive patterns: `_` not covered + --> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11 + | +LL | match 0isize { //~ERROR non-exhaustive patterns: `_` not covered + | ^^^^^^ pattern `_` not covered + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0004`. diff --git a/src/test/ui/feature-gates/feature-gate-prelude_import.rs b/src/test/ui/feature-gates/feature-gate-prelude_import.rs index 8bc3df247ec..a338bf97399 100644 --- a/src/test/ui/feature-gates/feature-gate-prelude_import.rs +++ b/src/test/ui/feature-gates/feature-gate-prelude_import.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[prelude_import] //~ ERROR `#[prelude_import]` is for use by rustc only use std::prelude::v1::*; diff --git a/src/test/ui/feature-gates/feature-gate-prelude_import.stderr b/src/test/ui/feature-gates/feature-gate-prelude_import.stderr index 6841df54067..c0016d24f35 100644 --- a/src/test/ui/feature-gates/feature-gate-prelude_import.stderr +++ b/src/test/ui/feature-gates/feature-gate-prelude_import.stderr @@ -1,5 +1,5 @@ error[E0658]: `#[prelude_import]` is for use by rustc only - --> $DIR/feature-gate-prelude_import.rs:11:1 + --> $DIR/feature-gate-prelude_import.rs:1:1 | LL | #[prelude_import] //~ ERROR `#[prelude_import]` is for use by rustc only | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-profiler-runtime.rs b/src/test/ui/feature-gates/feature-gate-profiler-runtime.rs index c6b2cb2eb07..f8a70963481 100644 --- a/src/test/ui/feature-gates/feature-gate-profiler-runtime.rs +++ b/src/test/ui/feature-gates/feature-gate-profiler-runtime.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![profiler_runtime] //~ ERROR the `#[profiler_runtime]` attribute is fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr b/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr index dd395742b4f..2d6ef277572 100644 --- a/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr +++ b/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate which contains the profiler runtime and will never be stable - --> $DIR/feature-gate-profiler-runtime.rs:11:1 + --> $DIR/feature-gate-profiler-runtime.rs:1:1 | LL | #![profiler_runtime] //~ ERROR the `#[profiler_runtime]` attribute is | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs new file mode 100644 index 00000000000..505a45379cd --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.rs @@ -0,0 +1,13 @@ +// Test that the use of the box syntax is gated by `re-rebalance-coherence` feature gate. + +// aux-build:re_rebalance_coherence_lib.rs + +extern crate re_rebalance_coherence_lib as lib; +use lib::*; + +struct Oracle; +impl Backend for Oracle {} +impl<'a, T:'a, Tab> QueryFragment for BatchInsert<'a, T, Tab> {} +//~^ ERROR E0210 + +fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr new file mode 100644 index 00000000000..5972e610e47 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-re-rebalance-coherence.stderr @@ -0,0 +1,11 @@ +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/feature-gate-re-rebalance-coherence.rs:10:1 + | +LL | impl<'a, T:'a, Tab> QueryFragment for BatchInsert<'a, T, Tab> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type + | + = note: only traits defined in the current crate can be implemented for a type parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0210`. diff --git a/src/test/ui/feature-gates/feature-gate-repr-simd.rs b/src/test/ui/feature-gates/feature-gate-repr-simd.rs index a70f2758abb..9d28f437415 100644 --- a/src/test/ui/feature-gates/feature-gate-repr-simd.rs +++ b/src/test/ui/feature-gates/feature-gate-repr-simd.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[repr(simd)] //~ error: SIMD types are experimental struct Foo(u64, u64); -#[repr(C)] +#[repr(C)] //~ warn: conflicting representation hints #[repr(simd)] //~ error: SIMD types are experimental struct Bar(u64, u64); diff --git a/src/test/ui/feature-gates/feature-gate-repr-simd.stderr b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr index 2f98bd24d4f..20cdbceeb68 100644 --- a/src/test/ui/feature-gates/feature-gate-repr-simd.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr @@ -1,5 +1,5 @@ error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) - --> $DIR/feature-gate-repr-simd.rs:11:1 + --> $DIR/feature-gate-repr-simd.rs:1:1 | LL | #[repr(simd)] //~ error: SIMD types are experimental | ^^^^^^^^^^^^^ @@ -7,13 +7,22 @@ LL | #[repr(simd)] //~ error: SIMD types are experimental = help: add #![feature(repr_simd)] to the crate attributes to enable error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) - --> $DIR/feature-gate-repr-simd.rs:15:1 + --> $DIR/feature-gate-repr-simd.rs:5:1 | LL | #[repr(simd)] //~ error: SIMD types are experimental | ^^^^^^^^^^^^^ | = help: add #![feature(repr_simd)] to the crate attributes to enable +warning[E0566]: conflicting representation hints + --> $DIR/feature-gate-repr-simd.rs:4:8 + | +LL | #[repr(C)] //~ warn: conflicting representation hints + | ^ +LL | #[repr(simd)] //~ error: SIMD types are experimental + | ^^^^ + error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0566, E0658. +For more information about an error, try `rustc --explain E0566`. diff --git a/src/test/ui/feature-gates/feature-gate-repr128.rs b/src/test/ui/feature-gates/feature-gate-repr128.rs index f5753f1c7fb..0290874dd27 100644 --- a/src/test/ui/feature-gates/feature-gate-repr128.rs +++ b/src/test/ui/feature-gates/feature-gate-repr128.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[repr(u128)] enum A { //~ ERROR repr with 128-bit type is unstable A(u64) diff --git a/src/test/ui/feature-gates/feature-gate-repr128.stderr b/src/test/ui/feature-gates/feature-gate-repr128.stderr index 29cba831f54..ddd11f6daab 100644 --- a/src/test/ui/feature-gates/feature-gate-repr128.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr128.stderr @@ -1,5 +1,5 @@ error[E0658]: repr with 128-bit type is unstable (see issue #35118) - --> $DIR/feature-gate-repr128.rs:12:1 + --> $DIR/feature-gate-repr128.rs:2:1 | LL | / enum A { //~ ERROR repr with 128-bit type is unstable LL | | A(u64) diff --git a/src/test/ui/feature-gates/feature-gate-repr_packed.rs b/src/test/ui/feature-gates/feature-gate-repr_packed.rs deleted file mode 100644 index 65e3be288fd..00000000000 --- a/src/test/ui/feature-gates/feature-gate-repr_packed.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental -struct Foo(u64); - -#[repr(C)] -#[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental -struct Bar(u64); - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-repr_packed.stderr b/src/test/ui/feature-gates/feature-gate-repr_packed.stderr deleted file mode 100644 index ed89a3f6b31..00000000000 --- a/src/test/ui/feature-gates/feature-gate-repr_packed.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0658]: the `#[repr(packed(n))]` attribute is experimental (see issue #33158) - --> $DIR/feature-gate-repr_packed.rs:11:1 - | -LL | #[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental - | ^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(repr_packed)] to the crate attributes to enable - -error[E0658]: the `#[repr(packed(n))]` attribute is experimental (see issue #33158) - --> $DIR/feature-gate-repr_packed.rs:15:1 - | -LL | #[repr(packed(1))] //~ error: the `#[repr(packed(n))]` attribute is experimental - | ^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(repr_packed)] to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.rs b/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.rs index 7295de80db5..2b23388fdc9 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.rs +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // Test that `#[rustc_*]` attributes are gated by `rustc_attrs` feature gate. @@ -15,4 +5,4 @@ #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable #[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable -fn main() {} +fn main() {} //~ ERROR [] diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr b/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr index 54a580ce9f9..31e24f5b99f 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable (see issue #29642) - --> $DIR/feature-gate-rustc-attrs-1.rs:15:1 + --> $DIR/feature-gate-rustc-attrs-1.rs:5:1 | LL | #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable | ^^^^^^^^^^^^^^^^^ @@ -7,13 +7,20 @@ LL | #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used = help: add #![feature(rustc_attrs)] to the crate attributes to enable error[E0658]: the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable (see issue #29642) - --> $DIR/feature-gate-rustc-attrs-1.rs:16:1 + --> $DIR/feature-gate-rustc-attrs-1.rs:6:1 | LL | #[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable | ^^^^^^^^^^^^^^ | = help: add #![feature(rustc_attrs)] to the crate attributes to enable -error: aborting due to 2 previous errors +error[E0208]: [] + --> $DIR/feature-gate-rustc-attrs-1.rs:8:1 + | +LL | fn main() {} //~ ERROR [] + | ^^^^^^^^^^^^ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0208, E0658. +For more information about an error, try `rustc --explain E0208`. diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs b/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs index 99bc51b69c6..5ec413cc71d 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs @@ -1,18 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-tidy-linelength - // Test that `#[rustc_*]` attributes are gated by `rustc_attrs` feature gate. #[rustc_foo] -//~^ ERROR unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics +//~^ ERROR unless otherwise specified, attributes with the prefix `rustc_` are reserved fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr b/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr index 882549c1eaf..40e6d6d9256 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr @@ -1,5 +1,5 @@ error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642) - --> $DIR/feature-gate-rustc-attrs.rs:15:3 + --> $DIR/feature-gate-rustc-attrs.rs:3:3 | LL | #[rustc_foo] | ^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-rustc-diagnostic-macros.rs b/src/test/ui/feature-gates/feature-gate-rustc-diagnostic-macros.rs index bbdf248780f..63c2c31fd30 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-diagnostic-macros.rs +++ b/src/test/ui/feature-gates/feature-gate-rustc-diagnostic-macros.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that diagnostic macros are gated by `rustc_diagnostic_macros` feature // gate diff --git a/src/test/ui/feature-gates/feature-gate-rustc-diagnostic-macros.stderr b/src/test/ui/feature-gates/feature-gate-rustc-diagnostic-macros.stderr index 70b66db6083..478bc09f291 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-diagnostic-macros.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc-diagnostic-macros.stderr @@ -1,17 +1,17 @@ error: cannot find macro `__build_diagnostic_array!` in this scope - --> $DIR/feature-gate-rustc-diagnostic-macros.rs:22:1 + --> $DIR/feature-gate-rustc-diagnostic-macros.rs:12:1 | LL | __build_diagnostic_array!(DIAGNOSTICS); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: cannot find macro `__register_diagnostic!` in this scope - --> $DIR/feature-gate-rustc-diagnostic-macros.rs:14:1 + --> $DIR/feature-gate-rustc-diagnostic-macros.rs:4:1 | LL | __register_diagnostic!(E0001); | ^^^^^^^^^^^^^^^^^^^^^ error: cannot find macro `__diagnostic_used!` in this scope - --> $DIR/feature-gate-rustc-diagnostic-macros.rs:18:5 + --> $DIR/feature-gate-rustc-diagnostic-macros.rs:8:5 | LL | __diagnostic_used!(E0001); | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.rs b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.rs index 38a3e15fd7e..a85f2f4ad30 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.rs +++ b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test internal const fn feature gate. #![feature(staged_api)] diff --git a/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr index fa3f9807a04..52d9b8db2fb 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[rustc_const_unstable]` attribute is an internal feature - --> $DIR/feature-gate-rustc_const_unstable.rs:18:1 + --> $DIR/feature-gate-rustc_const_unstable.rs:8:1 | LL | #[rustc_const_unstable(feature="fzzzzzt")] //~ERROR internal feature | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.rs b/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.rs index a18641d8246..3b972c117a6 100644 --- a/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.rs +++ b/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![sanitizer_runtime] //~ ERROR the `#[sanitizer_runtime]` attribute is fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr b/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr index fc93e103005..37e9b35c0ba 100644 --- a/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr +++ b/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[sanitizer_runtime]` attribute is used to identify crates that contain the runtime of a sanitizer and will never be stable - --> $DIR/feature-gate-sanitizer-runtime.rs:11:1 + --> $DIR/feature-gate-sanitizer-runtime.rs:1:1 | LL | #![sanitizer_runtime] //~ ERROR the `#[sanitizer_runtime]` attribute is | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-self-struct-ctor.rs b/src/test/ui/feature-gates/feature-gate-self-struct-ctor.rs deleted file mode 100644 index 98eab394913..00000000000 --- a/src/test/ui/feature-gates/feature-gate-self-struct-ctor.rs +++ /dev/null @@ -1,22 +0,0 @@ -struct ST1(i32, i32); - -impl ST1 { - fn ctor() -> Self { - Self(1,2) - //~^ ERROR: `Self` struct constructors are unstable (see issue #51994) [E0658] - } -} - -struct ST2; - -impl ST2 { - fn ctor() -> Self { - Self - //~^ ERROR: `Self` struct constructors are unstable (see issue #51994) [E0658] - } -} - -fn main() { - let _ = ST1::ctor(); - let _ = ST2::ctor(); -} diff --git a/src/test/ui/feature-gates/feature-gate-self-struct-ctor.stderr b/src/test/ui/feature-gates/feature-gate-self-struct-ctor.stderr deleted file mode 100644 index 6061a0db76e..00000000000 --- a/src/test/ui/feature-gates/feature-gate-self-struct-ctor.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0658]: `Self` struct constructors are unstable (see issue #51994) - --> $DIR/feature-gate-self-struct-ctor.rs:5:9 - | -LL | Self(1,2) - | ^^^^ - | - = help: add #![feature(self_struct_ctor)] to the crate attributes to enable - -error[E0658]: `Self` struct constructors are unstable (see issue #51994) - --> $DIR/feature-gate-self-struct-ctor.rs:14:9 - | -LL | Self - | ^^^^ - | - = help: add #![feature(self_struct_ctor)] to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-self_in_typedefs.rs b/src/test/ui/feature-gates/feature-gate-self_in_typedefs.rs deleted file mode 100644 index 4b476a0a645..00000000000 --- a/src/test/ui/feature-gates/feature-gate-self_in_typedefs.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum StackList<'a, T: 'a> { - Nil, - Cons(T, &'a Self) - //~^ ERROR cannot find type `Self` in this scope - //~| `Self` is only available in traits and impls -} - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-self_in_typedefs.stderr b/src/test/ui/feature-gates/feature-gate-self_in_typedefs.stderr deleted file mode 100644 index ab04953f3e5..00000000000 --- a/src/test/ui/feature-gates/feature-gate-self_in_typedefs.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0411]: cannot find type `Self` in this scope - --> $DIR/feature-gate-self_in_typedefs.rs:13:17 - | -LL | Cons(T, &'a Self) - | ^^^^ `Self` is only available in traits and impls - | - = help: add #![feature(self_in_typedefs)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0411`. diff --git a/src/test/ui/feature-gates/feature-gate-simd-ffi.rs b/src/test/ui/feature-gates/feature-gate-simd-ffi.rs index a603658d316..0425e39e677 100644 --- a/src/test/ui/feature-gates/feature-gate-simd-ffi.rs +++ b/src/test/ui/feature-gates/feature-gate-simd-ffi.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd)] #![allow(dead_code)] diff --git a/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr b/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr index f7b17aa4e6a..01005138a60 100644 --- a/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr +++ b/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr @@ -1,5 +1,5 @@ error: use of SIMD type `LocalSimd` in FFI is highly experimental and may result in invalid code - --> $DIR/feature-gate-simd-ffi.rs:19:17 + --> $DIR/feature-gate-simd-ffi.rs:9:17 | LL | fn baz() -> LocalSimd; //~ ERROR use of SIMD type | ^^^^^^^^^ @@ -7,7 +7,7 @@ LL | fn baz() -> LocalSimd; //~ ERROR use of SIMD type = help: add #![feature(simd_ffi)] to the crate attributes to enable error: use of SIMD type `LocalSimd` in FFI is highly experimental and may result in invalid code - --> $DIR/feature-gate-simd-ffi.rs:20:15 + --> $DIR/feature-gate-simd-ffi.rs:10:15 | LL | fn qux(x: LocalSimd); //~ ERROR use of SIMD type | ^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-simd.rs b/src/test/ui/feature-gates/feature-gate-simd.rs index 025eaca5533..d01d33de289 100644 --- a/src/test/ui/feature-gates/feature-gate-simd.rs +++ b/src/test/ui/feature-gates/feature-gate-simd.rs @@ -1,14 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // pretty-expanded FIXME #23616 #[repr(simd)] //~ ERROR SIMD types are experimental diff --git a/src/test/ui/feature-gates/feature-gate-simd.stderr b/src/test/ui/feature-gates/feature-gate-simd.stderr index 414a5d9eb5d..ad5ffa5e785 100644 --- a/src/test/ui/feature-gates/feature-gate-simd.stderr +++ b/src/test/ui/feature-gates/feature-gate-simd.stderr @@ -1,5 +1,5 @@ error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) - --> $DIR/feature-gate-simd.rs:14:1 + --> $DIR/feature-gate-simd.rs:3:1 | LL | #[repr(simd)] //~ ERROR SIMD types are experimental | ^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-slice-patterns.rs b/src/test/ui/feature-gates/feature-gate-slice-patterns.rs index fd058f65172..0165321debe 100644 --- a/src/test/ui/feature-gates/feature-gate-slice-patterns.rs +++ b/src/test/ui/feature-gates/feature-gate-slice-patterns.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that slice pattern syntax with `..` is gated by `slice_patterns` feature gate fn main() { diff --git a/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr b/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr index d560dcd54ee..65dec6e1099 100644 --- a/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr @@ -1,5 +1,5 @@ error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) - --> $DIR/feature-gate-slice-patterns.rs:16:16 + --> $DIR/feature-gate-slice-patterns.rs:6:16 | LL | [1, 2, ..] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized | ^^ @@ -7,7 +7,7 @@ LL | [1, 2, ..] => {} //~ ERROR syntax for subslices in slice patterns i = help: add #![feature(slice_patterns)] to the crate attributes to enable error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) - --> $DIR/feature-gate-slice-patterns.rs:17:13 + --> $DIR/feature-gate-slice-patterns.rs:7:13 | LL | [1, .., 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized | ^^ @@ -15,7 +15,7 @@ LL | [1, .., 5] => {} //~ ERROR syntax for subslices in slice patterns i = help: add #![feature(slice_patterns)] to the crate attributes to enable error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) - --> $DIR/feature-gate-slice-patterns.rs:18:10 + --> $DIR/feature-gate-slice-patterns.rs:8:10 | LL | [.., 4, 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized | ^^ @@ -23,7 +23,7 @@ LL | [.., 4, 5] => {} //~ ERROR syntax for subslices in slice patterns i = help: add #![feature(slice_patterns)] to the crate attributes to enable error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) - --> $DIR/feature-gate-slice-patterns.rs:23:11 + --> $DIR/feature-gate-slice-patterns.rs:13:11 | LL | [ xs.., 4, 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized | ^^ @@ -31,7 +31,7 @@ LL | [ xs.., 4, 5 ] => {} //~ ERROR syntax for subslices in slice patter = help: add #![feature(slice_patterns)] to the crate attributes to enable error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) - --> $DIR/feature-gate-slice-patterns.rs:24:14 + --> $DIR/feature-gate-slice-patterns.rs:14:14 | LL | [ 1, xs.., 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized | ^^ @@ -39,7 +39,7 @@ LL | [ 1, xs.., 5 ] => {} //~ ERROR syntax for subslices in slice patter = help: add #![feature(slice_patterns)] to the crate attributes to enable error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) - --> $DIR/feature-gate-slice-patterns.rs:25:17 + --> $DIR/feature-gate-slice-patterns.rs:15:17 | LL | [ 1, 2, xs.. ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized | ^^ diff --git a/src/test/ui/feature-gates/feature-gate-staged_api.rs b/src/test/ui/feature-gates/feature-gate-staged_api.rs index 014a0aaaf68..2571ab5d1b4 100644 --- a/src/test/ui/feature-gates/feature-gate-staged_api.rs +++ b/src/test/ui/feature-gates/feature-gate-staged_api.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![stable(feature = "a", since = "b")] //~^ ERROR stability attributes may not be used outside of the standard library mod inner_private_module { diff --git a/src/test/ui/feature-gates/feature-gate-staged_api.stderr b/src/test/ui/feature-gates/feature-gate-staged_api.stderr index 7b395ffb74b..f0db47fe8a8 100644 --- a/src/test/ui/feature-gates/feature-gate-staged_api.stderr +++ b/src/test/ui/feature-gates/feature-gate-staged_api.stderr @@ -1,11 +1,11 @@ error: stability attributes may not be used outside of the standard library - --> $DIR/feature-gate-staged_api.rs:11:1 + --> $DIR/feature-gate-staged_api.rs:1:1 | LL | #![stable(feature = "a", since = "b")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/feature-gate-staged_api.rs:18:1 + --> $DIR/feature-gate-staged_api.rs:8:1 | LL | #[stable(feature = "a", since = "b")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-start.rs b/src/test/ui/feature-gates/feature-gate-start.rs index 7a0924d8adf..46a1279a3fb 100644 --- a/src/test/ui/feature-gates/feature-gate-start.rs +++ b/src/test/ui/feature-gates/feature-gate-start.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[start] -fn foo() {} //~ ERROR: a #[start] function is an experimental feature +fn foo(_: isize, _: *const *const u8) -> isize { 0 } +//~^ ERROR a #[start] function is an experimental feature diff --git a/src/test/ui/feature-gates/feature-gate-start.stderr b/src/test/ui/feature-gates/feature-gate-start.stderr index cf590d2a0e3..d39e5f35555 100644 --- a/src/test/ui/feature-gates/feature-gate-start.stderr +++ b/src/test/ui/feature-gates/feature-gate-start.stderr @@ -1,8 +1,8 @@ error[E0658]: a #[start] function is an experimental feature whose signature may change over time (see issue #29633) - --> $DIR/feature-gate-start.rs:12:1 + --> $DIR/feature-gate-start.rs:2:1 | -LL | fn foo() {} //~ ERROR: a #[start] function is an experimental feature - | ^^^^^^^^^^^ +LL | fn foo(_: isize, _: *const *const u8) -> isize { 0 } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(start)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle.rs b/src/test/ui/feature-gates/feature-gate-static-nobundle.rs index 0d13a4937c4..1ce6c54aa4d 100644 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle.rs +++ b/src/test/ui/feature-gates/feature-gate-static-nobundle.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link(name="foo", kind="static-nobundle")] //~^ ERROR: kind="static-nobundle" is feature gated extern {} diff --git a/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr b/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr index fd9f2b371f6..2e80275f3f7 100644 --- a/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr +++ b/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr @@ -1,5 +1,5 @@ error[E0658]: kind="static-nobundle" is feature gated (see issue #37403) - --> $DIR/feature-gate-static-nobundle.rs:11:1 + --> $DIR/feature-gate-static-nobundle.rs:1:1 | LL | #[link(name="foo", kind="static-nobundle")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-stmt_expr_attributes.rs b/src/test/ui/feature-gates/feature-gate-stmt_expr_attributes.rs index 55706938ae8..3e5b6260d74 100644 --- a/src/test/ui/feature-gates/feature-gate-stmt_expr_attributes.rs +++ b/src/test/ui/feature-gates/feature-gate-stmt_expr_attributes.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const X: i32 = #[allow(dead_code)] 8; //~^ ERROR attributes on expressions are experimental. (see issue #15701) diff --git a/src/test/ui/feature-gates/feature-gate-stmt_expr_attributes.stderr b/src/test/ui/feature-gates/feature-gate-stmt_expr_attributes.stderr index ad5c263403d..4318edd9230 100644 --- a/src/test/ui/feature-gates/feature-gate-stmt_expr_attributes.stderr +++ b/src/test/ui/feature-gates/feature-gate-stmt_expr_attributes.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental. (see issue #15701) - --> $DIR/feature-gate-stmt_expr_attributes.rs:11:16 + --> $DIR/feature-gate-stmt_expr_attributes.rs:1:16 | LL | const X: i32 = #[allow(dead_code)] 8; | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-thread_local.rs b/src/test/ui/feature-gates/feature-gate-thread_local.rs index f355c6562c8..0efae1f6bc3 100644 --- a/src/test/ui/feature-gates/feature-gate-thread_local.rs +++ b/src/test/ui/feature-gates/feature-gate-thread_local.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `#[thread_local]` attribute is gated by `thread_local` // feature gate. // @@ -18,8 +8,4 @@ #[thread_local] //~ ERROR `#[thread_local]` is an experimental feature static FOO: i32 = 3; -pub fn main() { - FOO.with(|x| { - println!("x: {}", x); - }); -} +pub fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-thread_local.stderr b/src/test/ui/feature-gates/feature-gate-thread_local.stderr index 9b44c3f9590..dc7d67a2053 100644 --- a/src/test/ui/feature-gates/feature-gate-thread_local.stderr +++ b/src/test/ui/feature-gates/feature-gate-thread_local.stderr @@ -1,5 +1,5 @@ error[E0658]: `#[thread_local]` is an experimental feature, and does not currently handle destructors. (see issue #29594) - --> $DIR/feature-gate-thread_local.rs:18:1 + --> $DIR/feature-gate-thread_local.rs:8:1 | LL | #[thread_local] //~ ERROR `#[thread_local]` is an experimental feature | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-trace_macros.rs b/src/test/ui/feature-gates/feature-gate-trace_macros.rs index 367ee6df50d..07159b7b542 100644 --- a/src/test/ui/feature-gates/feature-gate-trace_macros.rs +++ b/src/test/ui/feature-gates/feature-gate-trace_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { trace_macros!(true); //~ ERROR: `trace_macros` is not stable } diff --git a/src/test/ui/feature-gates/feature-gate-trace_macros.stderr b/src/test/ui/feature-gates/feature-gate-trace_macros.stderr index a31f618bbbe..9f4b01e45b6 100644 --- a/src/test/ui/feature-gates/feature-gate-trace_macros.stderr +++ b/src/test/ui/feature-gates/feature-gate-trace_macros.stderr @@ -1,5 +1,5 @@ error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) - --> $DIR/feature-gate-trace_macros.rs:12:5 + --> $DIR/feature-gate-trace_macros.rs:2:5 | LL | trace_macros!(true); //~ ERROR: `trace_macros` is not stable | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-trait-alias.rs b/src/test/ui/feature-gates/feature-gate-trait-alias.rs index a2a183f80f9..819085addda 100644 --- a/src/test/ui/feature-gates/feature-gate-trait-alias.rs +++ b/src/test/ui/feature-gates/feature-gate-trait-alias.rs @@ -1,13 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo = Default; +//~^ ERROR trait aliases are experimental fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-trait-alias.stderr b/src/test/ui/feature-gates/feature-gate-trait-alias.stderr index e02dfe27805..bb833c4e732 100644 --- a/src/test/ui/feature-gates/feature-gate-trait-alias.stderr +++ b/src/test/ui/feature-gates/feature-gate-trait-alias.stderr @@ -1,5 +1,5 @@ error[E0658]: trait aliases are experimental (see issue #41517) - --> $DIR/feature-gate-trait-alias.rs:11:1 + --> $DIR/feature-gate-trait-alias.rs:1:1 | LL | trait Foo = Default; | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds-lint.rs b/src/test/ui/feature-gates/feature-gate-trivial_bounds-lint.rs index 2d2d491bd4d..8f68d5d6dd2 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds-lint.rs +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds-lint.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(unused)] diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs b/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs index dba66e0b69b..e5028f2f8aa 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] #![allow(type_alias_bounds)] diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr index 14764b4e9f0..1f35efa59b6 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/feature-gate-trivial_bounds.rs:20:1 + --> $DIR/feature-gate-trivial_bounds.rs:10:1 | LL | enum E where i32: Foo { V } //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` @@ -8,7 +8,7 @@ LL | enum E where i32: Foo { V } //~ ERROR = help: add #![feature(trivial_bounds)] to the crate attributes to enable error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/feature-gate-trivial_bounds.rs:22:1 + --> $DIR/feature-gate-trivial_bounds.rs:12:1 | LL | struct S where i32: Foo; //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` @@ -17,7 +17,7 @@ LL | struct S where i32: Foo; //~ ERROR = help: add #![feature(trivial_bounds)] to the crate attributes to enable error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/feature-gate-trivial_bounds.rs:24:1 + --> $DIR/feature-gate-trivial_bounds.rs:14:1 | LL | trait T where i32: Foo {} //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` @@ -26,7 +26,7 @@ LL | trait T where i32: Foo {} //~ ERROR = help: add #![feature(trivial_bounds)] to the crate attributes to enable error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/feature-gate-trivial_bounds.rs:26:1 + --> $DIR/feature-gate-trivial_bounds.rs:16:1 | LL | union U where i32: Foo { f: i32 } //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` @@ -35,7 +35,7 @@ LL | union U where i32: Foo { f: i32 } //~ ERROR = help: add #![feature(trivial_bounds)] to the crate attributes to enable error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/feature-gate-trivial_bounds.rs:30:1 + --> $DIR/feature-gate-trivial_bounds.rs:20:1 | LL | / impl Foo for () where i32: Foo { //~ ERROR LL | | fn test(&self) { @@ -50,7 +50,7 @@ LL | | } = help: add #![feature(trivial_bounds)] to the crate attributes to enable error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/feature-gate-trivial_bounds.rs:38:1 + --> $DIR/feature-gate-trivial_bounds.rs:28:1 | LL | / fn f() where i32: Foo //~ ERROR LL | | { @@ -65,7 +65,7 @@ LL | | } = help: add #![feature(trivial_bounds)] to the crate attributes to enable error[E0277]: the trait bound `std::string::String: std::ops::Neg` is not satisfied - --> $DIR/feature-gate-trivial_bounds.rs:46:1 + --> $DIR/feature-gate-trivial_bounds.rs:36:1 | LL | / fn use_op(s: String) -> String where String: ::std::ops::Neg { //~ ERROR LL | | -s @@ -76,7 +76,7 @@ LL | | } = help: add #![feature(trivial_bounds)] to the crate attributes to enable error[E0277]: `i32` is not an iterator - --> $DIR/feature-gate-trivial_bounds.rs:50:1 + --> $DIR/feature-gate-trivial_bounds.rs:40:1 | LL | / fn use_for() where i32: Iterator { //~ ERROR LL | | for _ in 2i32 {} @@ -89,18 +89,18 @@ LL | | } = help: add #![feature(trivial_bounds)] to the crate attributes to enable error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/feature-gate-trivial_bounds.rs:62:1 + --> $DIR/feature-gate-trivial_bounds.rs:52:1 | LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time - --> $DIR/feature-gate-trivial_bounds.rs:65:1 + --> $DIR/feature-gate-trivial_bounds.rs:55:1 | LL | / fn unsized_local() where Dst: Sized { //~ ERROR LL | | let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); @@ -108,13 +108,13 @@ LL | | } | |_^ doesn't have a size known at compile-time | = help: within `Dst<(dyn A + 'static)>`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `Dst<(dyn A + 'static)>` = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/feature-gate-trivial_bounds.rs:69:1 + --> $DIR/feature-gate-trivial_bounds.rs:59:1 | LL | / fn return_str() -> str where str: Sized { //~ ERROR LL | | *"Sized".to_string().into_boxed_str() @@ -122,7 +122,7 @@ LL | | } | |_^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = help: see issue #48214 = help: add #![feature(trivial_bounds)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-try_blocks.rs b/src/test/ui/feature-gates/feature-gate-try_blocks.rs index 6536280c71f..06cadd82c07 100644 --- a/src/test/ui/feature-gates/feature-gate-try_blocks.rs +++ b/src/test/ui/feature-gates/feature-gate-try_blocks.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --edition 2018 pub fn main() { diff --git a/src/test/ui/feature-gates/feature-gate-try_blocks.stderr b/src/test/ui/feature-gates/feature-gate-try_blocks.stderr index 29ef2f87b9d..209a445194d 100644 --- a/src/test/ui/feature-gates/feature-gate-try_blocks.stderr +++ b/src/test/ui/feature-gates/feature-gate-try_blocks.stderr @@ -1,5 +1,5 @@ error[E0658]: `try` expression is experimental (see issue #31436) - --> $DIR/feature-gate-try_blocks.rs:14:33 + --> $DIR/feature-gate-try_blocks.rs:4:33 | LL | let try_result: Option<_> = try { //~ ERROR `try` expression is experimental | _________________________________^ diff --git a/src/test/ui/feature-gates/feature-gate-try_reserve.rs b/src/test/ui/feature-gates/feature-gate-try_reserve.rs index 9322dbd272f..a19dd58da11 100644 --- a/src/test/ui/feature-gates/feature-gate-try_reserve.rs +++ b/src/test/ui/feature-gates/feature-gate-try_reserve.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let v = Vec::new(); v.try_reserve(10); //~ ERROR: use of unstable library feature 'try_reserve' diff --git a/src/test/ui/feature-gates/feature-gate-try_reserve.stderr b/src/test/ui/feature-gates/feature-gate-try_reserve.stderr index 928d266b37a..4ced5037f38 100644 --- a/src/test/ui/feature-gates/feature-gate-try_reserve.stderr +++ b/src/test/ui/feature-gates/feature-gate-try_reserve.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'try_reserve': new API (see issue #48043) - --> $DIR/feature-gate-try_reserve.rs:13:7 + --> $DIR/feature-gate-try_reserve.rs:3:7 | LL | v.try_reserve(10); //~ ERROR: use of unstable library feature 'try_reserve' | ^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.rs b/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.rs new file mode 100644 index 00000000000..c7d3304a128 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.rs @@ -0,0 +1,19 @@ +enum Foo { + Bar(i32), + Baz { i: i32 }, +} + +type Alias = Foo; + +fn main() { + let t = Alias::Bar(0); + //~^ ERROR enum variants on type aliases are experimental + let t = Alias::Baz { i: 0 }; + //~^ ERROR enum variants on type aliases are experimental + match t { + Alias::Bar(_i) => {} + //~^ ERROR enum variants on type aliases are experimental + Alias::Baz { i: _i } => {} + //~^ ERROR enum variants on type aliases are experimental + } +} diff --git a/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.stderr b/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.stderr new file mode 100644 index 00000000000..43535af7c69 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-type_alias_enum_variants.stderr @@ -0,0 +1,34 @@ +error: enum variants on type aliases are experimental + --> $DIR/feature-gate-type_alias_enum_variants.rs:9:13 + | +LL | let t = Alias::Bar(0); + | ^^^^^^^^^^ + | + = help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable + +error: enum variants on type aliases are experimental + --> $DIR/feature-gate-type_alias_enum_variants.rs:11:13 + | +LL | let t = Alias::Baz { i: 0 }; + | ^^^^^^^^^^ + | + = help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable + +error: enum variants on type aliases are experimental + --> $DIR/feature-gate-type_alias_enum_variants.rs:14:9 + | +LL | Alias::Bar(_i) => {} + | ^^^^^^^^^^^^^^ + | + = help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable + +error: enum variants on type aliases are experimental + --> $DIR/feature-gate-type_alias_enum_variants.rs:16:9 + | +LL | Alias::Baz { i: _i } => {} + | ^^^^^^^^^^ + | + = help: add `#![feature(type_alias_enum_variants)]` to the crate attributes to enable + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/feature-gates/feature-gate-type_ascription.rs b/src/test/ui/feature-gates/feature-gate-type_ascription.rs index d3c07d653f4..e42e3405506 100644 --- a/src/test/ui/feature-gates/feature-gate-type_ascription.rs +++ b/src/test/ui/feature-gates/feature-gate-type_ascription.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Type ascription is feature gated fn main() { diff --git a/src/test/ui/feature-gates/feature-gate-type_ascription.stderr b/src/test/ui/feature-gates/feature-gate-type_ascription.stderr index 2bd475b68b2..4cf1f29f1ab 100644 --- a/src/test/ui/feature-gates/feature-gate-type_ascription.stderr +++ b/src/test/ui/feature-gates/feature-gate-type_ascription.stderr @@ -1,5 +1,5 @@ error[E0658]: type ascription is experimental (see issue #23416) - --> $DIR/feature-gate-type_ascription.rs:14:13 + --> $DIR/feature-gate-type_ascription.rs:4:13 | LL | let a = 10: u8; //~ ERROR type ascription is experimental | ^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs b/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs index 5df309321d3..ff6e2b82903 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs @@ -1,37 +1,31 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that manual impls of the `Fn` traits are not possible without // a feature gate. In fact, the specialized check for these cases // never triggers (yet), because they encounter other problems around // angle bracket vs parentheses notation. -#![allow(dead_code)] +#![feature(fn_traits)] struct Foo; impl Fn<()> for Foo { +//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change extern "rust-call" fn call(self, args: ()) -> () {} //~^ ERROR rust-call ABI is subject to change } struct Foo1; impl FnOnce() for Foo1 { +//~^ ERROR associated type bindings are not allowed here extern "rust-call" fn call_once(self, args: ()) -> () {} //~^ ERROR rust-call ABI is subject to change } struct Bar; impl FnMut<()> for Bar { +//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change extern "rust-call" fn call_mut(&self, args: ()) -> () {} //~^ ERROR rust-call ABI is subject to change } struct Baz; impl FnOnce<()> for Baz { +//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change extern "rust-call" fn call_once(&self, args: ()) -> () {} //~^ ERROR rust-call ABI is subject to change } diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index 6dfcdfc2567..865b87e7dd5 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -1,5 +1,5 @@ error[E0658]: rust-call ABI is subject to change (see issue #29625) - --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:20:5 + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:11:5 | LL | extern "rust-call" fn call(self, args: ()) -> () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {} = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0658]: rust-call ABI is subject to change (see issue #29625) - --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:25:5 + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:17:5 | LL | extern "rust-call" fn call_once(self, args: ()) -> () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | extern "rust-call" fn call_once(self, args: ()) -> () {} = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0658]: rust-call ABI is subject to change (see issue #29625) - --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:30:5 + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:23:5 | LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,13 +23,44 @@ LL | extern "rust-call" fn call_mut(&self, args: ()) -> () {} = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0658]: rust-call ABI is subject to change (see issue #29625) - --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:5 + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:29:5 | LL | extern "rust-call" fn call_once(&self, args: ()) -> () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable -error: aborting due to 4 previous errors +error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:9:6 + | +LL | impl Fn<()> for Foo { + | ^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error[E0229]: associated type bindings are not allowed here + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:15:12 + | +LL | impl FnOnce() for Foo1 { + | ^^ associated type not allowed here + +error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:21:6 + | +LL | impl FnMut<()> for Bar { + | ^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625) + --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:27:6 + | +LL | impl FnOnce<()> for Baz { + | ^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: aborting due to 8 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0229, E0658. +For more information about an error, try `rustc --explain E0229`. diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs b/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs index 253d1633b1c..42f7c5f0fba 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] fn foo(mut f: F) { diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr index cc8615d3620..8730bf678fd 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) - --> $DIR/feature-gate-unboxed-closures-method-calls.rs:14:7 + --> $DIR/feature-gate-unboxed-closures-method-calls.rs:4:7 | LL | f.call(()); //~ ERROR use of unstable library feature 'fn_traits' | ^^^^ @@ -7,7 +7,7 @@ LL | f.call(()); //~ ERROR use of unstable library feature 'fn_traits' = help: add #![feature(fn_traits)] to the crate attributes to enable error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) - --> $DIR/feature-gate-unboxed-closures-method-calls.rs:15:7 + --> $DIR/feature-gate-unboxed-closures-method-calls.rs:5:7 | LL | f.call_mut(()); //~ ERROR use of unstable library feature 'fn_traits' | ^^^^^^^^ @@ -15,7 +15,7 @@ LL | f.call_mut(()); //~ ERROR use of unstable library feature 'fn_traits' = help: add #![feature(fn_traits)] to the crate attributes to enable error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) - --> $DIR/feature-gate-unboxed-closures-method-calls.rs:16:7 + --> $DIR/feature-gate-unboxed-closures-method-calls.rs:6:7 | LL | f.call_once(()); //~ ERROR use of unstable library feature 'fn_traits' | ^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs b/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs index 902b3c1774c..25c90492eb8 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] fn foo(mut f: F) { diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr index 26dd983e877..266775484a9 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) - --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:14:5 + --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:4:5 | LL | Fn::call(&f, ()); //~ ERROR use of unstable library feature 'fn_traits' | ^^^^^^^^ @@ -7,7 +7,7 @@ LL | Fn::call(&f, ()); //~ ERROR use of unstable library feature 'fn_traits' = help: add #![feature(fn_traits)] to the crate attributes to enable error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) - --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:15:5 + --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:5:5 | LL | FnMut::call_mut(&mut f, ()); //~ ERROR use of unstable library feature 'fn_traits' | ^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | FnMut::call_mut(&mut f, ()); //~ ERROR use of unstable library feature = help: add #![feature(fn_traits)] to the crate attributes to enable error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) - --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:16:5 + --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:6:5 | LL | FnOnce::call_once(f, ()); //~ ERROR use of unstable library feature 'fn_traits' | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures.rs b/src/test/ui/feature-gates/feature-gate-unboxed-closures.rs index 40050217744..c3f5c99dcb4 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures.rs +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures.rs @@ -1,16 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#![feature(fn_traits)] struct Test; impl FnOnce<(u32, u32)> for Test { +//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change type Output = u32; extern "rust-call" fn call_once(self, (a, b): (u32, u32)) -> u32 { diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures.stderr index a5b1ed9bbc4..e7b1fc589bb 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures.stderr +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures.stderr @@ -1,5 +1,5 @@ error[E0658]: rust-call ABI is subject to change (see issue #29625) - --> $DIR/feature-gate-unboxed-closures.rs:16:5 + --> $DIR/feature-gate-unboxed-closures.rs:9:5 | LL | / extern "rust-call" fn call_once(self, (a, b): (u32, u32)) -> u32 { LL | | a + b @@ -8,6 +8,14 @@ LL | | } | = help: add #![feature(unboxed_closures)] to the crate attributes to enable -error: aborting due to previous error +error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625) + --> $DIR/feature-gate-unboxed-closures.rs:5:6 + | +LL | impl FnOnce<(u32, u32)> for Test { + | ^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(unboxed_closures)] to the crate attributes to enable + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-underscore-imports.rs b/src/test/ui/feature-gates/feature-gate-underscore-imports.rs deleted file mode 100644 index ceb8afe124a..00000000000 --- a/src/test/ui/feature-gates/feature-gate-underscore-imports.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern crate std as _; //~ ERROR renaming extern crates with `_` is unstable -use std::vec as _; //~ ERROR renaming imports with `_` is unstable - -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-underscore-imports.stderr b/src/test/ui/feature-gates/feature-gate-underscore-imports.stderr deleted file mode 100644 index 2eea95260d5..00000000000 --- a/src/test/ui/feature-gates/feature-gate-underscore-imports.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0658]: renaming extern crates with `_` is unstable (see issue #48216) - --> $DIR/feature-gate-underscore-imports.rs:11:1 - | -LL | extern crate std as _; //~ ERROR renaming extern crates with `_` is unstable - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(underscore_imports)] to the crate attributes to enable - -error[E0658]: renaming imports with `_` is unstable (see issue #48216) - --> $DIR/feature-gate-underscore-imports.rs:12:5 - | -LL | use std::vec as _; //~ ERROR renaming imports with `_` is unstable - | ^^^^^^^^^^^^^ - | - = help: add #![feature(underscore_imports)] to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-underscore_const_names.rs b/src/test/ui/feature-gates/feature-gate-underscore_const_names.rs new file mode 100644 index 00000000000..6b97c24a47e --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-underscore_const_names.rs @@ -0,0 +1,14 @@ +trait Trt {} +struct Str {} + +impl Trt for Str {} + +const _ : () = { +//~^ ERROR is unstable + use std::marker::PhantomData; + struct ImplementsTrait(PhantomData); + let _ = ImplementsTrait::(PhantomData); + () +}; + +fn main() {} diff --git a/src/test/ui/feature-gate-underscore_const_names.stderr b/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr similarity index 85% rename from src/test/ui/feature-gate-underscore_const_names.stderr rename to src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr index ab90ef8f11f..d608f3d37cf 100644 --- a/src/test/ui/feature-gate-underscore_const_names.stderr +++ b/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr @@ -1,7 +1,8 @@ error[E0658]: naming constants with `_` is unstable (see issue #54912) - --> $DIR/feature-gate-underscore_const_names.rs:17:1 + --> $DIR/feature-gate-underscore_const_names.rs:6:1 | LL | / const _ : () = { +LL | | //~^ ERROR is unstable LL | | use std::marker::PhantomData; LL | | struct ImplementsTrait(PhantomData); LL | | let _ = ImplementsTrait::(PhantomData); diff --git a/src/test/ui/feature-gates/feature-gate-uniform-paths.rs b/src/test/ui/feature-gates/feature-gate-uniform-paths.rs deleted file mode 100644 index ca1cc1d2fd0..00000000000 --- a/src/test/ui/feature-gates/feature-gate-uniform-paths.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// edition:2018 - -pub mod foo { - pub use bar::Bar; //~ ERROR imports can only refer to extern crate names - - pub mod bar { - pub struct Bar; - } -} - -use inline; //~ ERROR imports can only refer to extern crate names - -use Vec; //~ ERROR imports can only refer to extern crate names - -use vec; //~ ERROR imports can only refer to extern crate names - -fn main() { - let _ = foo::Bar; -} diff --git a/src/test/ui/feature-gates/feature-gate-uniform-paths.stderr b/src/test/ui/feature-gates/feature-gate-uniform-paths.stderr deleted file mode 100644 index ec8937bbc5f..00000000000 --- a/src/test/ui/feature-gates/feature-gate-uniform-paths.stderr +++ /dev/null @@ -1,62 +0,0 @@ -error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130) - --> $DIR/feature-gate-uniform-paths.rs:14:13 - | -LL | pub use bar::Bar; //~ ERROR imports can only refer to extern crate names - | ^^^ -LL | -LL | / pub mod bar { -LL | | pub struct Bar; -LL | | } - | |_____- not an extern crate passed with `--extern` - | - = help: add #![feature(uniform_paths)] to the crate attributes to enable -note: this import refers to the module defined here - --> $DIR/feature-gate-uniform-paths.rs:16:5 - | -LL | / pub mod bar { -LL | | pub struct Bar; -LL | | } - | |_____^ - -error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130) - --> $DIR/feature-gate-uniform-paths.rs:21:5 - | -LL | use inline; //~ ERROR imports can only refer to extern crate names - | ^^^^^^ not an extern crate passed with `--extern` - | - = help: add #![feature(uniform_paths)] to the crate attributes to enable -note: this import refers to the built-in attribute imported here - --> $DIR/feature-gate-uniform-paths.rs:21:5 - | -LL | use inline; //~ ERROR imports can only refer to extern crate names - | ^^^^^^ - -error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130) - --> $DIR/feature-gate-uniform-paths.rs:23:5 - | -LL | use Vec; //~ ERROR imports can only refer to extern crate names - | ^^^ not an extern crate passed with `--extern` - | - = help: add #![feature(uniform_paths)] to the crate attributes to enable -note: this import refers to the struct imported here - --> $DIR/feature-gate-uniform-paths.rs:23:5 - | -LL | use Vec; //~ ERROR imports can only refer to extern crate names - | ^^^ - -error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130) - --> $DIR/feature-gate-uniform-paths.rs:25:5 - | -LL | use vec; //~ ERROR imports can only refer to extern crate names - | ^^^ not an extern crate passed with `--extern` - | - = help: add #![feature(uniform_paths)] to the crate attributes to enable -note: this import refers to the macro imported here - --> $DIR/feature-gate-uniform-paths.rs:25:5 - | -LL | use vec; //~ ERROR imports can only refer to extern crate names - | ^^^ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.rs b/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.rs index daebbe658a2..181c8592c54 100644 --- a/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.rs +++ b/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(custom_attribute)] #[my_attr(a b c d)] diff --git a/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.stderr b/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.stderr index cc5694b1598..1ddf2ff6d64 100644 --- a/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.stderr +++ b/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.stderr @@ -1,17 +1,17 @@ error: expected one of `(`, `)`, `,`, `::`, or `=`, found `b` - --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:13:13 + --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:3:13 | LL | #[my_attr(a b c d)] | ^ expected one of `(`, `)`, `,`, `::`, or `=` here error: expected one of `(`, `)`, `,`, `::`, or `=`, found `c` - --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:13:15 + --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:3:15 | LL | #[my_attr(a b c d)] | ^ expected one of `(`, `)`, `,`, `::`, or `=` here error: expected one of `(`, `)`, `,`, `::`, or `=`, found `d` - --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:13:17 + --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:3:17 | LL | #[my_attr(a b c d)] | ^ expected one of `(`, `)`, `,`, `::`, or `=` here diff --git a/src/test/ui/feature-gates/feature-gate-unsized_locals.rs b/src/test/ui/feature-gates/feature-gate-unsized_locals.rs new file mode 100644 index 00000000000..a8f81f3f113 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-unsized_locals.rs @@ -0,0 +1,5 @@ +fn f(f: FnOnce()) {} +//~^ ERROR E0277 + +fn main() { +} diff --git a/src/test/ui/feature-gate-unsized_locals.stderr b/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr similarity index 81% rename from src/test/ui/feature-gate-unsized_locals.stderr rename to src/test/ui/feature-gates/feature-gate-unsized_locals.stderr index a0440a373d2..bde39cbeaeb 100644 --- a/src/test/ui/feature-gate-unsized_locals.stderr +++ b/src/test/ui/feature-gates/feature-gate-unsized_locals.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `(dyn std::ops::FnOnce() + 'static)` cannot be known at compilation time - --> $DIR/feature-gate-unsized_locals.rs:11:6 + --> $DIR/feature-gate-unsized_locals.rs:1:6 | LL | fn f(f: FnOnce()) {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::FnOnce() + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs index 8a43e75494d..f781bc9aedd 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs +++ b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let _ : &(Send,) = &((),); //~^ ERROR unsized tuple coercion is not stable enough diff --git a/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr index 08c15855a6a..c2f5df48fed 100644 --- a/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr +++ b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr @@ -1,5 +1,5 @@ error[E0658]: unsized tuple coercion is not stable enough for use and is subject to change (see issue #42877) - --> $DIR/feature-gate-unsized_tuple_coercion.rs:12:24 + --> $DIR/feature-gate-unsized_tuple_coercion.rs:2:24 | LL | let _ : &(Send,) = &((),); | ^^^^^^ diff --git a/src/test/ui/feature-gates/feature-gate-untagged_unions.rs b/src/test/ui/feature-gates/feature-gate-untagged_unions.rs index 6533fddd947..3bac3d853e9 100644 --- a/src/test/ui/feature-gates/feature-gate-untagged_unions.rs +++ b/src/test/ui/feature-gates/feature-gate-untagged_unions.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - union U1 { // OK a: u8, } diff --git a/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr b/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr index e0c845b7768..f9f8cfe9171 100644 --- a/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr +++ b/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr @@ -1,5 +1,5 @@ error[E0658]: unions with non-`Copy` fields are unstable (see issue #32836) - --> $DIR/feature-gate-untagged_unions.rs:19:1 + --> $DIR/feature-gate-untagged_unions.rs:9:1 | LL | / union U3 { //~ ERROR unions with non-`Copy` fields are unstable LL | | a: String, @@ -9,7 +9,7 @@ LL | | } = help: add #![feature(untagged_unions)] to the crate attributes to enable error[E0658]: unions with non-`Copy` fields are unstable (see issue #32836) - --> $DIR/feature-gate-untagged_unions.rs:23:1 + --> $DIR/feature-gate-untagged_unions.rs:13:1 | LL | / union U4 { //~ ERROR unions with non-`Copy` fields are unstable LL | | a: T, @@ -19,7 +19,7 @@ LL | | } = help: add #![feature(untagged_unions)] to the crate attributes to enable error[E0658]: unions with `Drop` implementations are unstable (see issue #32836) - --> $DIR/feature-gate-untagged_unions.rs:27:1 + --> $DIR/feature-gate-untagged_unions.rs:17:1 | LL | / union U5 { //~ ERROR unions with `Drop` implementations are unstable LL | | a: u8, diff --git a/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs b/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs index 681842e30e0..e0cb9c88219 100644 --- a/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs +++ b/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C no-prepopulate-passes -Cpasses=name-anon-globals #![crate_type = "lib"] @@ -18,7 +8,7 @@ extern { fn extern_fn(); // CHECK-NOT: Function Attrs: nounwind // CHECK: declare void @unwinding_extern_fn - #[unwind] //~ ERROR #[unwind] is experimental + #[unwind(allowed)] //~ ERROR #[unwind] is experimental fn unwinding_extern_fn(); } diff --git a/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr b/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr index 4c6e6f420de..918d40d681b 100644 --- a/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr +++ b/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr @@ -1,8 +1,8 @@ error[E0658]: #[unwind] is experimental - --> $DIR/feature-gate-unwind-attributes.rs:21:5 + --> $DIR/feature-gate-unwind-attributes.rs:11:5 | -LL | #[unwind] //~ ERROR #[unwind] is experimental - | ^^^^^^^^^ +LL | #[unwind(allowed)] //~ ERROR #[unwind] is experimental + | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unwind_attributes)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-without_gate_irrefutable_pattern.rs b/src/test/ui/feature-gates/feature-gate-without_gate_irrefutable_pattern.rs deleted file mode 100644 index 7bcddbb6a2f..00000000000 --- a/src/test/ui/feature-gates/feature-gate-without_gate_irrefutable_pattern.rs +++ /dev/null @@ -1,17 +0,0 @@ -// gate-test-irrefutable_let_patterns - -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[allow(irrefutable_let_patterns)] -fn main() { - if let _ = 5 {} - //~^ ERROR 15:12: 15:13: irrefutable if-let pattern [E0162] -} diff --git a/src/test/ui/feature-gates/feature-gate-without_gate_irrefutable_pattern.stderr b/src/test/ui/feature-gates/feature-gate-without_gate_irrefutable_pattern.stderr deleted file mode 100644 index 2b23962a304..00000000000 --- a/src/test/ui/feature-gates/feature-gate-without_gate_irrefutable_pattern.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0162]: irrefutable if-let pattern - --> $DIR/feature-gate-without_gate_irrefutable_pattern.rs:15:12 - | -LL | if let _ = 5 {} - | ^ irrefutable pattern - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0162`. diff --git a/src/test/ui/feature-gates/underscore_const_names_feature_gate.rs b/src/test/ui/feature-gates/underscore_const_names_feature_gate.rs new file mode 100644 index 00000000000..e50bbf5b649 --- /dev/null +++ b/src/test/ui/feature-gates/underscore_const_names_feature_gate.rs @@ -0,0 +1,3 @@ +const _: () = (); //~ ERROR is unstable + +fn main() {} diff --git a/src/test/ui/feature-gates/underscore_const_names_feature_gate.stderr b/src/test/ui/feature-gates/underscore_const_names_feature_gate.stderr new file mode 100644 index 00000000000..a42b8e579c9 --- /dev/null +++ b/src/test/ui/feature-gates/underscore_const_names_feature_gate.stderr @@ -0,0 +1,11 @@ +error[E0658]: naming constants with `_` is unstable (see issue #54912) + --> $DIR/underscore_const_names_feature_gate.rs:1:1 + | +LL | const _: () = (); //~ ERROR is unstable + | ^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(underscore_const_names)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/float-literal-inference-restrictions.rs b/src/test/ui/float-literal-inference-restrictions.rs index 1e58df69f16..34079b61e67 100644 --- a/src/test/ui/float-literal-inference-restrictions.rs +++ b/src/test/ui/float-literal-inference-restrictions.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: f32 = 1; //~ ERROR mismatched types let y: f32 = 1f64; //~ ERROR mismatched types diff --git a/src/test/ui/float-literal-inference-restrictions.stderr b/src/test/ui/float-literal-inference-restrictions.stderr index da8f6ed42f9..a69c13507e6 100644 --- a/src/test/ui/float-literal-inference-restrictions.stderr +++ b/src/test/ui/float-literal-inference-restrictions.stderr @@ -1,17 +1,17 @@ error[E0308]: mismatched types - --> $DIR/float-literal-inference-restrictions.rs:12:18 + --> $DIR/float-literal-inference-restrictions.rs:2:18 | LL | let x: f32 = 1; //~ ERROR mismatched types | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `1.0` | = note: expected type `f32` found type `{integer}` error[E0308]: mismatched types - --> $DIR/float-literal-inference-restrictions.rs:13:18 + --> $DIR/float-literal-inference-restrictions.rs:3:18 | LL | let y: f32 = 1f64; //~ ERROR mismatched types | ^^^^ expected f32, found f64 diff --git a/src/test/ui/fmt/format-string-error-2.rs b/src/test/ui/fmt/format-string-error-2.rs new file mode 100644 index 00000000000..5c25ae502ff --- /dev/null +++ b/src/test/ui/fmt/format-string-error-2.rs @@ -0,0 +1,87 @@ +// ignore-tidy-tab + +fn main() { + format!("{ + a"); + //~^ ERROR invalid format string + format!("{ \ + + b"); + //~^ ERROR invalid format string + format!(r#"{ \ + + rawc"#); + //~^^^ ERROR invalid format string + format!(r#"{ \n +\n + rawd"#); + //~^^^ ERROR invalid format string + format!("{ \n +\n + e"); + //~^ ERROR invalid format string + format!(" + { + a"); + //~^ ERROR invalid format string + format!(" + { + a + "); + //~^^ ERROR invalid format string + format!(" \ + { \ + \ + b"); + //~^ ERROR invalid format string + format!(" \ + { \ + \ + b \ + + "); + //~^^^ ERROR invalid format string + format!(r#" +raw { \ + + c"#); + //~^^^ ERROR invalid format string + format!(r#" +raw { \n +\n + d"#); + //~^^^ ERROR invalid format string + format!(" + { \n +\n + e"); + //~^ ERROR invalid format string + + format!(" + {asdf + } + ", asdf=1); + // ok - this is supported + format!(" + { + asdf} + ", asdf=1); + //~^^ ERROR invalid format string + println!("\t{}"); + //~^ ERROR 1 positional argument in format string + + // note: `\x7B` is `{` + println!("\x7B}\u{8} {", 1); + //~^ ERROR invalid format string: expected `'}'` but string was terminated + + println!("\x7B}\u8 {", 1); + //~^ ERROR incorrect unicode escape sequence + //~| ERROR argument never used + + // note: raw strings don't escape `\xFF` and `\u{FF}` sequences + println!(r#"\x7B}\u{8} {"#, 1); + //~^ ERROR invalid format string: unmatched `}` found + + println!(r#"\x7B}\u8 {"#, 1); + //~^ ERROR invalid format string: unmatched `}` found +} diff --git a/src/test/ui/fmt/format-string-error-2.stderr b/src/test/ui/fmt/format-string-error-2.stderr new file mode 100644 index 00000000000..baab8529940 --- /dev/null +++ b/src/test/ui/fmt/format-string-error-2.stderr @@ -0,0 +1,185 @@ +error: incorrect unicode escape sequence + --> $DIR/format-string-error-2.rs:77:20 + | +LL | println!("/x7B}/u8 {", 1); + | ^^- + | | + | help: format of unicode escape sequences uses braces: `/u{8}` + +error: invalid format string: expected `'}'`, found `'a'` + --> $DIR/format-string-error-2.rs:5:5 + | +LL | format!("{ + | - because of this opening brace +LL | a"); + | ^ expected `}` in format string + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'b'` + --> $DIR/format-string-error-2.rs:9:5 + | +LL | format!("{ / + | - because of this opening brace +LL | +LL | b"); + | ^ expected `}` in format string + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'/'` + --> $DIR/format-string-error-2.rs:11:18 + | +LL | format!(r#"{ / + | - ^ expected `}` in format string + | | + | because of this opening brace + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'/'` + --> $DIR/format-string-error-2.rs:15:18 + | +LL | format!(r#"{ /n + | - ^ expected `}` in format string + | | + | because of this opening brace + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'e'` + --> $DIR/format-string-error-2.rs:21:5 + | +LL | format!("{ /n + | - because of this opening brace +LL | /n +LL | e"); + | ^ expected `}` in format string + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'a'` + --> $DIR/format-string-error-2.rs:25:5 + | +LL | { + | - because of this opening brace +LL | a"); + | ^ expected `}` in format string + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'a'` + --> $DIR/format-string-error-2.rs:29:5 + | +LL | { + | - because of this opening brace +LL | a + | ^ expected `}` in format string + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'b'` + --> $DIR/format-string-error-2.rs:35:5 + | +LL | { / + | - because of this opening brace +LL | / +LL | b"); + | ^ expected `}` in format string + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'b'` + --> $DIR/format-string-error-2.rs:40:5 + | +LL | { / + | - because of this opening brace +LL | / +LL | b / + | ^ expected `}` in format string + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'/'` + --> $DIR/format-string-error-2.rs:45:8 + | +LL | raw { / + | - ^ expected `}` in format string + | | + | because of this opening brace + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'/'` + --> $DIR/format-string-error-2.rs:50:8 + | +LL | raw { /n + | - ^ expected `}` in format string + | | + | because of this opening brace + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'e'` + --> $DIR/format-string-error-2.rs:57:5 + | +LL | { /n + | - because of this opening brace +LL | /n +LL | e"); + | ^ expected `}` in format string + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: invalid format string: expected `'}'`, found `'a'` + --> $DIR/format-string-error-2.rs:67:5 + | +LL | { + | - because of this opening brace +LL | asdf} + | ^ expected `}` in format string + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: 1 positional argument in format string, but no arguments were given + --> $DIR/format-string-error-2.rs:70:17 + | +LL | println!("/t{}"); + | ^^ + +error: invalid format string: expected `'}'` but string was terminated + --> $DIR/format-string-error-2.rs:74:27 + | +LL | println!("/x7B}/u{8} {", 1); + | -^ expected `'}'` in format string + | | + | because of this opening brace + | + = note: if you intended to print `{`, you can escape it using `{{` + +error: argument never used + --> $DIR/format-string-error-2.rs:77:28 + | +LL | println!("/x7B}/u8 {", 1); + | ------------ ^ argument never used + | | + | formatting specifier missing + +error: invalid format string: unmatched `}` found + --> $DIR/format-string-error-2.rs:82:21 + | +LL | println!(r#"/x7B}/u{8} {"#, 1); + | ^ unmatched `}` in format string + | + = note: if you intended to print `}`, you can escape it using `}}` + +error: invalid format string: unmatched `}` found + --> $DIR/format-string-error-2.rs:85:21 + | +LL | println!(r#"/x7B}/u8 {"#, 1); + | ^ unmatched `}` in format string + | + = note: if you intended to print `}`, you can escape it using `}}` + +error: aborting due to 19 previous errors + diff --git a/src/test/ui/fmt/format-string-error.rs b/src/test/ui/fmt/format-string-error.rs index f39110ebc5d..cca949aab63 100644 --- a/src/test/ui/fmt/format-string-error.rs +++ b/src/test/ui/fmt/format-string-error.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-tab fn main() { @@ -41,7 +31,7 @@ fn main() { { "###); - //~^^ ERROR invalid format string + //~^ ERROR invalid format string let _ = format!(r###" diff --git a/src/test/ui/fmt/format-string-error.stderr b/src/test/ui/fmt/format-string-error.stderr index 9c84fd25218..86ab163591e 100644 --- a/src/test/ui/fmt/format-string-error.stderr +++ b/src/test/ui/fmt/format-string-error.stderr @@ -1,13 +1,15 @@ error: invalid format string: expected `'}'` but string was terminated - --> $DIR/format-string-error.rs:14:16 + --> $DIR/format-string-error.rs:4:16 | LL | println!("{"); - | ^ expected `'}'` in format string + | -^ expected `'}'` in format string + | | + | because of this opening brace | = note: if you intended to print `{`, you can escape it using `{{` error: invalid format string: unmatched `}` found - --> $DIR/format-string-error.rs:17:15 + --> $DIR/format-string-error.rs:7:15 | LL | println!("}"); | ^ unmatched `}` in format string @@ -15,7 +17,7 @@ LL | println!("}"); = note: if you intended to print `}`, you can escape it using `}}` error: invalid format string: invalid argument name `_foo` - --> $DIR/format-string-error.rs:19:23 + --> $DIR/format-string-error.rs:9:23 | LL | let _ = format!("{_foo}", _foo = 6usize); | ^^^^ invalid argument name in format string @@ -23,7 +25,7 @@ LL | let _ = format!("{_foo}", _foo = 6usize); = note: argument names cannot start with an underscore error: invalid format string: invalid argument name `_` - --> $DIR/format-string-error.rs:21:23 + --> $DIR/format-string-error.rs:11:23 | LL | let _ = format!("{_}", _ = 6usize); | ^ invalid argument name in format string @@ -31,15 +33,17 @@ LL | let _ = format!("{_}", _ = 6usize); = note: argument names cannot start with an underscore error: invalid format string: expected `'}'` but string was terminated - --> $DIR/format-string-error.rs:23:23 + --> $DIR/format-string-error.rs:13:23 | LL | let _ = format!("{"); - | ^ expected `'}'` in format string + | -^ expected `'}'` in format string + | | + | because of this opening brace | = note: if you intended to print `{`, you can escape it using `{{` error: invalid format string: unmatched `}` found - --> $DIR/format-string-error.rs:25:22 + --> $DIR/format-string-error.rs:15:22 | LL | let _ = format!("}"); | ^ unmatched `}` in format string @@ -47,37 +51,48 @@ LL | let _ = format!("}"); = note: if you intended to print `}`, you can escape it using `}}` error: invalid format string: expected `'}'`, found `'/'` - --> $DIR/format-string-error.rs:27:23 + --> $DIR/format-string-error.rs:17:23 | LL | let _ = format!("{/}"); - | ^ expected `}` in format string + | -^ expected `}` in format string + | | + | because of this opening brace + | + = note: if you intended to print `{`, you can escape it using `{{` error: invalid format string: expected `'}'` but string was terminated - --> $DIR/format-string-error.rs:29:29 + --> $DIR/format-string-error.rs:19:35 | LL | let _ = format!("/n/n/n{/n/n/n"); - | ^ expected `'}'` in format string + | - ^ expected `'}'` in format string + | | + | because of this opening brace | = note: if you intended to print `{`, you can escape it using `{{` error: invalid format string: expected `'}'` but string was terminated - --> $DIR/format-string-error.rs:35:3 + --> $DIR/format-string-error.rs:25:3 | LL | {"###); - | ^ expected `'}'` in format string + | -^ expected `'}'` in format string + | | + | because of this opening brace | = note: if you intended to print `{`, you can escape it using `{{` error: invalid format string: expected `'}'` but string was terminated - --> $DIR/format-string-error.rs:42:1 + --> $DIR/format-string-error.rs:33:1 | +LL | { + | - because of this opening brace LL | +LL | "###); | ^ expected `'}'` in format string | = note: if you intended to print `{`, you can escape it using `{{` error: invalid format string: unmatched `}` found - --> $DIR/format-string-error.rs:49:2 + --> $DIR/format-string-error.rs:39:2 | LL | } | ^ unmatched `}` in format string @@ -85,7 +100,7 @@ LL | } = note: if you intended to print `}`, you can escape it using `}}` error: invalid format string: unmatched `}` found - --> $DIR/format-string-error.rs:57:9 + --> $DIR/format-string-error.rs:47:9 | LL | } | ^ unmatched `}` in format string diff --git a/src/test/ui/fmt/send-sync.rs b/src/test/ui/fmt/send-sync.rs index 424919a0eba..95ec68d1d5e 100644 --- a/src/test/ui/fmt/send-sync.rs +++ b/src/test/ui/fmt/send-sync.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn send(_: T) {} fn sync(_: T) {} diff --git a/src/test/ui/fmt/send-sync.stderr b/src/test/ui/fmt/send-sync.stderr index 0d9239d7227..5abe0d0c50b 100644 --- a/src/test/ui/fmt/send-sync.stderr +++ b/src/test/ui/fmt/send-sync.stderr @@ -1,5 +1,5 @@ error[E0277]: `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely - --> $DIR/send-sync.rs:18:5 + --> $DIR/send-sync.rs:8:5 | LL | send(format_args!("{:?}", c)); //~ ERROR E0277 | ^^^^ `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely @@ -13,13 +13,13 @@ LL | send(format_args!("{:?}", c)); //~ ERROR E0277 = note: required because of the requirements on the impl of `std::marker::Send` for `&[std::fmt::ArgumentV1<'_>]` = note: required because it appears within the type `std::fmt::Arguments<'_>` note: required by `send` - --> $DIR/send-sync.rs:11:1 + --> $DIR/send-sync.rs:1:1 | LL | fn send(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely - --> $DIR/send-sync.rs:19:5 + --> $DIR/send-sync.rs:9:5 | LL | sync(format_args!("{:?}", c)); //~ ERROR E0277 | ^^^^ `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely @@ -33,7 +33,7 @@ LL | sync(format_args!("{:?}", c)); //~ ERROR E0277 = note: required because it appears within the type `&[std::fmt::ArgumentV1<'_>]` = note: required because it appears within the type `std::fmt::Arguments<'_>` note: required by `sync` - --> $DIR/send-sync.rs:12:1 + --> $DIR/send-sync.rs:2:1 | LL | fn sync(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/fn/fn-bad-block-type.rs b/src/test/ui/fn/fn-bad-block-type.rs index c5c355cfbce..01dcff05881 100644 --- a/src/test/ui/fn/fn-bad-block-type.rs +++ b/src/test/ui/fn/fn-bad-block-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:mismatched types fn f() -> isize { true } diff --git a/src/test/ui/fn/fn-bad-block-type.stderr b/src/test/ui/fn/fn-bad-block-type.stderr index 23d76e54531..5abee94653a 100644 --- a/src/test/ui/fn/fn-bad-block-type.stderr +++ b/src/test/ui/fn/fn-bad-block-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/fn-bad-block-type.rs:13:19 + --> $DIR/fn-bad-block-type.rs:3:19 | LL | fn f() -> isize { true } | ----- ^^^^ expected isize, found bool diff --git a/src/test/ui/fn/fn-closure-mutable-capture.nll.stderr b/src/test/ui/fn/fn-closure-mutable-capture.nll.stderr index ff06256088f..f7ab56da8de 100644 --- a/src/test/ui/fn/fn-closure-mutable-capture.nll.stderr +++ b/src/test/ui/fn/fn-closure-mutable-capture.nll.stderr @@ -1,11 +1,11 @@ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure - --> $DIR/fn-closure-mutable-capture.rs:15:17 + --> $DIR/fn-closure-mutable-capture.rs:5:17 | LL | bar(move || x = 1); | ^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/fn-closure-mutable-capture.rs:15:9 + --> $DIR/fn-closure-mutable-capture.rs:5:9 | LL | bar(move || x = 1); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/fn/fn-closure-mutable-capture.rs b/src/test/ui/fn/fn-closure-mutable-capture.rs index 385efebd590..a37eceffb9d 100644 --- a/src/test/ui/fn/fn-closure-mutable-capture.rs +++ b/src/test/ui/fn/fn-closure-mutable-capture.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn bar(_f: F) {} pub fn foo() { diff --git a/src/test/ui/fn/fn-closure-mutable-capture.stderr b/src/test/ui/fn/fn-closure-mutable-capture.stderr index a58d663dc0a..84a5989c28c 100644 --- a/src/test/ui/fn/fn-closure-mutable-capture.stderr +++ b/src/test/ui/fn/fn-closure-mutable-capture.stderr @@ -1,12 +1,12 @@ error[E0594]: cannot assign to captured outer variable in an `Fn` closure - --> $DIR/fn-closure-mutable-capture.rs:15:17 + --> $DIR/fn-closure-mutable-capture.rs:5:17 | LL | bar(move || x = 1); | ^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications help: consider changing this closure to take self by mutable reference - --> $DIR/fn-closure-mutable-capture.rs:15:9 + --> $DIR/fn-closure-mutable-capture.rs:5:9 | LL | bar(move || x = 1); | ^^^^^^^^^^^^^ diff --git a/src/test/ui/fn/fn-compare-mismatch.rs b/src/test/ui/fn/fn-compare-mismatch.rs index 27be1ada445..d734d54e8b0 100644 --- a/src/test/ui/fn/fn-compare-mismatch.rs +++ b/src/test/ui/fn/fn-compare-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { fn f() { } fn g() { } diff --git a/src/test/ui/fn/fn-compare-mismatch.stderr b/src/test/ui/fn/fn-compare-mismatch.stderr index 995a17e01bf..54dae525ffd 100644 --- a/src/test/ui/fn/fn-compare-mismatch.stderr +++ b/src/test/ui/fn/fn-compare-mismatch.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `fn() {main::f}` - --> $DIR/fn-compare-mismatch.rs:14:13 + --> $DIR/fn-compare-mismatch.rs:4:13 | LL | let x = f == g; | ^^^^^^ @@ -7,7 +7,7 @@ LL | let x = f == g; = note: an implementation of `std::cmp::PartialEq` might be missing for `fn() {main::f}` error[E0308]: mismatched types - --> $DIR/fn-compare-mismatch.rs:14:18 + --> $DIR/fn-compare-mismatch.rs:4:18 | LL | let x = f == g; | ^ expected fn item, found a different fn item diff --git a/src/test/ui/fn/fn-item-type.rs b/src/test/ui/fn/fn-item-type.rs index 6217a9f16b9..e71172d7229 100644 --- a/src/test/ui/fn/fn-item-type.rs +++ b/src/test/ui/fn/fn-item-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the types of distinct fn items are not compatible by // default. See also `run-pass/fn-item-type-*.rs`. diff --git a/src/test/ui/fn/fn-item-type.stderr b/src/test/ui/fn/fn-item-type.stderr index 59dd4b294aa..d52646c0c4b 100644 --- a/src/test/ui/fn/fn-item-type.stderr +++ b/src/test/ui/fn/fn-item-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/fn-item-type.rs:23:19 + --> $DIR/fn-item-type.rs:13:19 | LL | eq(foo::, bar::); | ^^^^^^^^^ expected fn item, found a different fn item @@ -8,7 +8,7 @@ LL | eq(foo::, bar::); found type `fn(isize) -> isize {bar::}` error[E0308]: mismatched types - --> $DIR/fn-item-type.rs:29:19 + --> $DIR/fn-item-type.rs:19:19 | LL | eq(foo::, foo::); | ^^^^^^^^^ expected u8, found i8 @@ -17,7 +17,7 @@ LL | eq(foo::, foo::); found type `fn(isize) -> isize {foo::}` error[E0308]: mismatched types - --> $DIR/fn-item-type.rs:33:23 + --> $DIR/fn-item-type.rs:23:23 | LL | eq(bar::, bar::>); | ^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `std::vec::Vec` @@ -26,7 +26,7 @@ LL | eq(bar::, bar::>); found type `fn(isize) -> isize {bar::>}` error[E0308]: mismatched types - --> $DIR/fn-item-type.rs:40:26 + --> $DIR/fn-item-type.rs:30:26 | LL | eq(::foo, ::foo); | ^^^^^^^^^^^^^^^^^ expected u8, found u16 diff --git a/src/test/ui/fn/fn-trait-formatting.rs b/src/test/ui/fn/fn-trait-formatting.rs index ac7b0a60984..21da39dd400 100644 --- a/src/test/ui/fn/fn-trait-formatting.rs +++ b/src/test/ui/fn/fn-trait-formatting.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn needs_fn(x: F) where F: Fn(isize) -> isize {} diff --git a/src/test/ui/fn/fn-trait-formatting.stderr b/src/test/ui/fn/fn-trait-formatting.stderr index 198b343cdd3..bbccb57a1e2 100644 --- a/src/test/ui/fn/fn-trait-formatting.stderr +++ b/src/test/ui/fn/fn-trait-formatting.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/fn-trait-formatting.rs:16:17 + --> $DIR/fn-trait-formatting.rs:6:17 | LL | let _: () = (box |_: isize| {}) as Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` @@ -8,7 +8,7 @@ LL | let _: () = (box |_: isize| {}) as Box; found type `std::boxed::Box` error[E0308]: mismatched types - --> $DIR/fn-trait-formatting.rs:20:17 + --> $DIR/fn-trait-formatting.rs:10:17 | LL | let _: () = (box |_: isize, isize| {}) as Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` @@ -17,7 +17,7 @@ LL | let _: () = (box |_: isize, isize| {}) as Box; found type `std::boxed::Box` error[E0308]: mismatched types - --> $DIR/fn-trait-formatting.rs:24:17 + --> $DIR/fn-trait-formatting.rs:14:17 | LL | let _: () = (box || -> isize { unimplemented!() }) as Box isize>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box` @@ -26,14 +26,14 @@ LL | let _: () = (box || -> isize { unimplemented!() }) as Box is found type `std::boxed::Box isize>` error[E0277]: expected a `std::ops::Fn<(isize,)>` closure, found `{integer}` - --> $DIR/fn-trait-formatting.rs:29:5 + --> $DIR/fn-trait-formatting.rs:19:5 | LL | needs_fn(1); | ^^^^^^^^ expected an `Fn<(isize,)>` closure, found `{integer}` | = help: the trait `std::ops::Fn<(isize,)>` is not implemented for `{integer}` note: required by `needs_fn` - --> $DIR/fn-trait-formatting.rs:13:1 + --> $DIR/fn-trait-formatting.rs:3:1 | LL | fn needs_fn(x: F) where F: Fn(isize) -> isize {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/fn_must_use.rs b/src/test/ui/fn_must_use.rs index e3e20bc89b4..8519cf741a3 100644 --- a/src/test/ui/fn_must_use.rs +++ b/src/test/ui/fn_must_use.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![warn(unused_must_use)] diff --git a/src/test/ui/fn_must_use.stderr b/src/test/ui/fn_must_use.stderr index 57e80982d74..4bba638c4e9 100644 --- a/src/test/ui/fn_must_use.stderr +++ b/src/test/ui/fn_must_use.stderr @@ -1,24 +1,24 @@ warning: unused return value of `need_to_use_this_value` that must be used - --> $DIR/fn_must_use.rs:65:5 + --> $DIR/fn_must_use.rs:55:5 | LL | need_to_use_this_value(); //~ WARN unused return value | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/fn_must_use.rs:13:9 + --> $DIR/fn_must_use.rs:3:9 | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ = note: it's important warning: unused return value of `MyStruct::need_to_use_this_method_value` that must be used - --> $DIR/fn_must_use.rs:70:5 + --> $DIR/fn_must_use.rs:60:5 | LL | m.need_to_use_this_method_value(); //~ WARN unused return value | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused return value of `EvenNature::is_even` that must be used - --> $DIR/fn_must_use.rs:71:5 + --> $DIR/fn_must_use.rs:61:5 | LL | m.is_even(); // trait method! | ^^^^^^^^^^^^ @@ -26,31 +26,31 @@ LL | m.is_even(); // trait method! = note: no side effects warning: unused return value of `MyStruct::need_to_use_this_associated_function_value` that must be used - --> $DIR/fn_must_use.rs:74:5 + --> $DIR/fn_must_use.rs:64:5 | LL | MyStruct::need_to_use_this_associated_function_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused return value of `std::cmp::PartialEq::eq` that must be used - --> $DIR/fn_must_use.rs:80:5 + --> $DIR/fn_must_use.rs:70:5 | LL | 2.eq(&3); //~ WARN unused return value | ^^^^^^^^^ warning: unused return value of `std::cmp::PartialEq::eq` that must be used - --> $DIR/fn_must_use.rs:81:5 + --> $DIR/fn_must_use.rs:71:5 | LL | m.eq(&n); //~ WARN unused return value | ^^^^^^^^^ warning: unused comparison that must be used - --> $DIR/fn_must_use.rs:84:5 + --> $DIR/fn_must_use.rs:74:5 | LL | 2 == 3; //~ WARN unused comparison | ^^^^^^ warning: unused comparison that must be used - --> $DIR/fn_must_use.rs:85:5 + --> $DIR/fn_must_use.rs:75:5 | LL | m == n; //~ WARN unused comparison | ^^^^^^ diff --git a/src/test/ui/for/for-c-in-str.rs b/src/test/ui/for/for-c-in-str.rs index 83ec6c2db9b..43b1a04c22d 100644 --- a/src/test/ui/for/for-c-in-str.rs +++ b/src/test/ui/for/for-c-in-str.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // E0277 should point exclusively at line 14, not the entire for loop span fn main() { diff --git a/src/test/ui/for/for-c-in-str.stderr b/src/test/ui/for/for-c-in-str.stderr index d3db935166e..9185399804d 100644 --- a/src/test/ui/for/for-c-in-str.stderr +++ b/src/test/ui/for/for-c-in-str.stderr @@ -1,5 +1,5 @@ error[E0277]: `&str` is not an iterator - --> $DIR/for-c-in-str.rs:14:14 + --> $DIR/for-c-in-str.rs:4:14 | LL | for c in "asdf" { | ^^^^^^ `&str` is not an iterator; try calling `.chars()` or `.bytes()` diff --git a/src/test/ui/for/for-expn.rs b/src/test/ui/for/for-expn.rs index 7e9d4df005d..b9c4bbedac9 100644 --- a/src/test/ui/for/for-expn.rs +++ b/src/test/ui/for/for-expn.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that an error on a sub-expresson in a for loop has the correct span. fn main() { diff --git a/src/test/ui/for/for-expn.stderr b/src/test/ui/for/for-expn.stderr index 14c2c1a6d3d..b598032e4c9 100644 --- a/src/test/ui/for/for-expn.stderr +++ b/src/test/ui/for/for-expn.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `foo` in this scope - --> $DIR/for-expn.rs:16:7 + --> $DIR/for-expn.rs:6:7 | LL | foo //~ ERROR cannot find value `foo` in this scope | ^^^ not found in this scope diff --git a/src/test/ui/for/for-loop-bogosity.rs b/src/test/ui/for/for-loop-bogosity.rs index b54d445ae37..9341dea0974 100644 --- a/src/test/ui/for/for-loop-bogosity.rs +++ b/src/test/ui/for/for-loop-bogosity.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct MyStruct { x: isize, y: isize, diff --git a/src/test/ui/for/for-loop-bogosity.stderr b/src/test/ui/for/for-loop-bogosity.stderr index 1aaf12c5da0..fe6ac529b43 100644 --- a/src/test/ui/for/for-loop-bogosity.stderr +++ b/src/test/ui/for/for-loop-bogosity.stderr @@ -1,5 +1,5 @@ error[E0277]: `MyStruct` is not an iterator - --> $DIR/for-loop-bogosity.rs:27:14 + --> $DIR/for-loop-bogosity.rs:17:14 | LL | for x in bogus { | ^^^^^ `MyStruct` is not an iterator diff --git a/src/test/ui/for/for-loop-refutable-pattern-error-message.rs b/src/test/ui/for/for-loop-refutable-pattern-error-message.rs index 81c4db68628..221951c874d 100644 --- a/src/test/ui/for/for-loop-refutable-pattern-error-message.rs +++ b/src/test/ui/for/for-loop-refutable-pattern-error-message.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { for &1 in [1].iter() {} //~ ERROR refutable pattern in `for` loop binding } diff --git a/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr b/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr index b76c2ffc240..88d82187716 100644 --- a/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr +++ b/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr @@ -1,8 +1,8 @@ -error[E0005]: refutable pattern in `for` loop binding: `&_` not covered - --> $DIR/for-loop-refutable-pattern-error-message.rs:12:9 +error[E0005]: refutable pattern in `for` loop binding: `&-2147483648i32..=0i32` not covered + --> $DIR/for-loop-refutable-pattern-error-message.rs:2:9 | LL | for &1 in [1].iter() {} //~ ERROR refutable pattern in `for` loop binding - | ^^ pattern `&_` not covered + | ^^ pattern `&-2147483648i32..=0i32` not covered error: aborting due to previous error diff --git a/src/test/ui/for/for-loop-type-error.rs b/src/test/ui/for/for-loop-type-error.rs index 7f0e40128f5..879fa47549e 100644 --- a/src/test/ui/for/for-loop-type-error.rs +++ b/src/test/ui/for/for-loop-type-error.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let x = () + (); //~ ERROR binary operation diff --git a/src/test/ui/for/for-loop-type-error.stderr b/src/test/ui/for/for-loop-type-error.stderr index f80a457dce3..b5a4a5240d9 100644 --- a/src/test/ui/for/for-loop-type-error.stderr +++ b/src/test/ui/for/for-loop-type-error.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `+` cannot be applied to type `()` - --> $DIR/for-loop-type-error.rs:12:13 + --> $DIR/for-loop-type-error.rs:2:13 | LL | let x = () + (); //~ ERROR binary operation | ^^^^^^^ diff --git a/src/test/ui/for/for-loop-unconstrained-element-type.rs b/src/test/ui/for/for-loop-unconstrained-element-type.rs index fb5553166ba..0c7a3516a14 100644 --- a/src/test/ui/for/for-loop-unconstrained-element-type.rs +++ b/src/test/ui/for/for-loop-unconstrained-element-type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `for` loops don't introduce artificial // constraints on the type of the binding (`i`). // Subtle changes in the desugaring can cause the diff --git a/src/test/ui/for/for-loop-unconstrained-element-type.stderr b/src/test/ui/for/for-loop-unconstrained-element-type.stderr index c3723c52fda..aaaad658de7 100644 --- a/src/test/ui/for/for-loop-unconstrained-element-type.stderr +++ b/src/test/ui/for/for-loop-unconstrained-element-type.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/for-loop-unconstrained-element-type.rs:18:14 + --> $DIR/for-loop-unconstrained-element-type.rs:8:14 | LL | for i in Vec::new() { } //~ ERROR type annotations needed | ^^^^^^^^^^ diff --git a/src/test/ui/foreign-fn-return-lifetime.fixed b/src/test/ui/foreign-fn-return-lifetime.fixed index 9fc35eae705..143d6343d26 100644 --- a/src/test/ui/foreign-fn-return-lifetime.fixed +++ b/src/test/ui/foreign-fn-return-lifetime.fixed @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix extern "C" { diff --git a/src/test/ui/foreign-fn-return-lifetime.rs b/src/test/ui/foreign-fn-return-lifetime.rs index 941e7e05a36..76fe50a340a 100644 --- a/src/test/ui/foreign-fn-return-lifetime.rs +++ b/src/test/ui/foreign-fn-return-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix extern "C" { diff --git a/src/test/ui/foreign-fn-return-lifetime.stderr b/src/test/ui/foreign-fn-return-lifetime.stderr index 583487656f2..00fda5dbd0c 100644 --- a/src/test/ui/foreign-fn-return-lifetime.stderr +++ b/src/test/ui/foreign-fn-return-lifetime.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/foreign-fn-return-lifetime.rs:15:19 + --> $DIR/foreign-fn-return-lifetime.rs:5:19 | LL | pub fn f() -> &u8; //~ ERROR missing lifetime specifier | ^ help: consider giving it a 'static lifetime: `&'static` diff --git a/src/test/ui/foreign-unsafe-fn-called.rs b/src/test/ui/foreign-unsafe-fn-called.rs index 5fad4c3677c..9352efaf2f0 100644 --- a/src/test/ui/foreign-unsafe-fn-called.rs +++ b/src/test/ui/foreign-unsafe-fn-called.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - mod test { extern { pub fn free(); diff --git a/src/test/ui/foreign-unsafe-fn-called.stderr b/src/test/ui/foreign-unsafe-fn-called.stderr index 498dd04e08f..afc9632de7c 100644 --- a/src/test/ui/foreign-unsafe-fn-called.stderr +++ b/src/test/ui/foreign-unsafe-fn-called.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/foreign-unsafe-fn-called.rs:19:5 + --> $DIR/foreign-unsafe-fn-called.rs:8:5 | LL | test::free(); | ^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name1.rs b/src/test/ui/fully-qualified-type/fully-qualified-type-name1.rs index 1a7ceb2e763..7e5b884103e 100644 --- a/src/test/ui/fully-qualified-type/fully-qualified-type-name1.rs +++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we use fully-qualified type names in error messages. fn main() { @@ -16,5 +6,5 @@ fn main() { //~^ ERROR mismatched types //~| expected type `std::option::Option` //~| found type `{integer}` - //~| expected enum `std::option::Option`, found integral variable + //~| expected enum `std::option::Option`, found integer } diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr b/src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr index 55553c084c9..62ded3e255a 100644 --- a/src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr +++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr @@ -1,10 +1,10 @@ error[E0308]: mismatched types - --> $DIR/fully-qualified-type-name1.rs:15:9 + --> $DIR/fully-qualified-type-name1.rs:5:9 | LL | x = 5; | ^ | | - | expected enum `std::option::Option`, found integral variable + | expected enum `std::option::Option`, found integer | help: try using a variant of the expected type: `Some(5)` | = note: expected type `std::option::Option` diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name2.rs b/src/test/ui/fully-qualified-type/fully-qualified-type-name2.rs index 9ba8a11d536..21eda1a9012 100644 --- a/src/test/ui/fully-qualified-type/fully-qualified-type-name2.rs +++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name2.rs @@ -1,29 +1,19 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we use fully-qualified type names in error messages. mod x { - pub enum foo { } + pub enum Foo { } } mod y { - pub enum foo { } + pub enum Foo { } } -fn bar(x: x::foo) -> y::foo { +fn bar(x: x::Foo) -> y::Foo { return x; //~^ ERROR mismatched types - //~| expected type `y::foo` - //~| found type `x::foo` - //~| expected enum `y::foo`, found enum `x::foo` + //~| expected type `y::Foo` + //~| found type `x::Foo` + //~| expected enum `y::Foo`, found enum `x::Foo` } fn main() { diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name2.stderr b/src/test/ui/fully-qualified-type/fully-qualified-type-name2.stderr index f2881894b0a..47bb5e475b4 100644 --- a/src/test/ui/fully-qualified-type/fully-qualified-type-name2.stderr +++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name2.stderr @@ -1,11 +1,13 @@ error[E0308]: mismatched types - --> $DIR/fully-qualified-type-name2.rs:22:12 + --> $DIR/fully-qualified-type-name2.rs:12:12 | +LL | fn bar(x: x::Foo) -> y::Foo { + | ------ expected `y::Foo` because of return type LL | return x; - | ^ expected enum `y::foo`, found enum `x::foo` + | ^ expected enum `y::Foo`, found enum `x::Foo` | - = note: expected type `y::foo` - found type `x::foo` + = note: expected type `y::Foo` + found type `x::Foo` error: aborting due to previous error diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name3.rs b/src/test/ui/fully-qualified-type/fully-qualified-type-name3.rs index dc0c9a093ff..22faa66d9fb 100644 --- a/src/test/ui/fully-qualified-type/fully-qualified-type-name3.rs +++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name3.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we use fully-qualified type names in error messages. // ignore-test diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name4.rs b/src/test/ui/fully-qualified-type/fully-qualified-type-name4.rs index 3c8fde751f1..88910a7bb20 100644 --- a/src/test/ui/fully-qualified-type/fully-qualified-type-name4.rs +++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name4.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we use fully-qualified type names in error messages. use std::option::Option; diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr b/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr index eb855484468..b341879ab91 100644 --- a/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr +++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types - --> $DIR/fully-qualified-type-name4.rs:16:12 + --> $DIR/fully-qualified-type-name4.rs:6:12 | +LL | fn bar(x: usize) -> Option { + | ------------- expected `std::option::Option` because of return type LL | return x; | ^ expected enum `std::option::Option`, found usize | diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr index 832b570512a..67cca25ac0c 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr +++ b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `A`, which implements the `Drop` trait - --> $DIR/functional-struct-update-noncopyable.rs:22:14 + --> $DIR/functional-struct-update-noncopyable.rs:12:14 | LL | let _b = A { y: Arc::new(3), ..a }; //~ ERROR cannot move out of type `A` | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.rs b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.rs index 7ce32bbc975..a9d7d9c8aa9 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.rs +++ b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // issue 7327 use std::sync::Arc; diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr index ad4fb97ae09..a3497c59a52 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr +++ b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr @@ -1,5 +1,5 @@ error[E0509]: cannot move out of type `A`, which implements the `Drop` trait - --> $DIR/functional-struct-update-noncopyable.rs:22:36 + --> $DIR/functional-struct-update-noncopyable.rs:12:36 | LL | let _b = A { y: Arc::new(3), ..a }; //~ ERROR cannot move out of type `A` | ^ cannot move out of here diff --git a/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs index 3f41401eb69..00606af9048 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs +++ b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // RFC 736 (and Issue 21407): functional struct update should respect privacy. // The `foo` module attempts to maintains an invariant that each `S` diff --git a/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.stderr b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.stderr index 35a2f8460b6..2aeffc3e5e4 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.stderr +++ b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.stderr @@ -1,5 +1,5 @@ error[E0451]: field `secret_uid` of struct `foo::S` is private - --> $DIR/functional-struct-update-respects-privacy.rs:38:49 + --> $DIR/functional-struct-update-respects-privacy.rs:28:49 | LL | let s_2 = foo::S { b: format!("ess two"), ..s_1 }; // FRU ... | ^^^ field `secret_uid` is private diff --git a/src/test/ui/future-incompatible-lint-group.rs b/src/test/ui/future-incompatible-lint-group.rs index 5f320135edf..3630f08c937 100644 --- a/src/test/ui/future-incompatible-lint-group.rs +++ b/src/test/ui/future-incompatible-lint-group.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(future_incompatible)] trait Tr { diff --git a/src/test/ui/future-incompatible-lint-group.stderr b/src/test/ui/future-incompatible-lint-group.stderr index c239131ee16..79183fca9d3 100644 --- a/src/test/ui/future-incompatible-lint-group.stderr +++ b/src/test/ui/future-incompatible-lint-group.stderr @@ -1,11 +1,11 @@ error: anonymous parameters are deprecated and will be removed in the next edition. - --> $DIR/future-incompatible-lint-group.rs:14:10 + --> $DIR/future-incompatible-lint-group.rs:4:10 | LL | fn f(u8) {} //~ ERROR anonymous parameters are deprecated | ^^ help: Try naming the parameter or explicitly ignoring it: `_: u8` | note: lint level defined here - --> $DIR/future-incompatible-lint-group.rs:11:9 + --> $DIR/future-incompatible-lint-group.rs:1:9 | LL | #![deny(future_incompatible)] | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/gated-bad-feature.rs b/src/test/ui/gated-bad-feature.rs index 0d74f9011c3..fb4cc94f779 100644 --- a/src/test/ui/gated-bad-feature.rs +++ b/src/test/ui/gated-bad-feature.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature( foo_bar_baz, foo(bar), @@ -16,8 +6,8 @@ //~^^^ ERROR: malformed feature //~^^^ ERROR: malformed feature -#![feature] //~ ERROR: malformed feature -#![feature = "foo"] //~ ERROR: malformed feature +#![feature] //~ ERROR: attribute must be of the form +#![feature = "foo"] //~ ERROR: attribute must be of the form #![feature(test_removed_feature)] //~ ERROR: feature has been removed diff --git a/src/test/ui/gated-bad-feature.stderr b/src/test/ui/gated-bad-feature.stderr index 68be49a7277..141c51609b7 100644 --- a/src/test/ui/gated-bad-feature.stderr +++ b/src/test/ui/gated-bad-feature.stderr @@ -1,34 +1,34 @@ error[E0556]: malformed feature, expected just one word - --> $DIR/gated-bad-feature.rs:13:5 + --> $DIR/gated-bad-feature.rs:3:5 | LL | foo(bar), | ^^^^^^^^ error[E0556]: malformed feature, expected just one word - --> $DIR/gated-bad-feature.rs:14:5 + --> $DIR/gated-bad-feature.rs:4:5 | LL | foo = "baz" | ^^^^^^^^^^^ -error[E0555]: malformed feature attribute, expected #![feature(...)] - --> $DIR/gated-bad-feature.rs:19:1 +error[E0557]: feature has been removed + --> $DIR/gated-bad-feature.rs:12:12 | -LL | #![feature] //~ ERROR: malformed feature - | ^^^^^^^^^^^ +LL | #![feature(test_removed_feature)] //~ ERROR: feature has been removed + | ^^^^^^^^^^^^^^^^^^^^ -error[E0555]: malformed feature attribute, expected #![feature(...)] - --> $DIR/gated-bad-feature.rs:20:1 +error: attribute must be of the form `#[feature(name1, name1, ...)]` + --> $DIR/gated-bad-feature.rs:9:1 | -LL | #![feature = "foo"] //~ ERROR: malformed feature - | ^^^^^^^^^^^^^^^^^^^ +LL | #![feature] //~ ERROR: attribute must be of the form + | ^^^^^^^^^^^ -error[E0557]: feature has been removed - --> $DIR/gated-bad-feature.rs:22:12 +error: attribute must be of the form `#[feature(name1, name1, ...)]` + --> $DIR/gated-bad-feature.rs:10:1 | -LL | #![feature(test_removed_feature)] //~ ERROR: feature has been removed - | ^^^^^^^^^^^^^^^^^^^^ +LL | #![feature = "foo"] //~ ERROR: attribute must be of the form + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors -Some errors occurred: E0555, E0556, E0557. -For more information about an error, try `rustc --explain E0555`. +Some errors occurred: E0556, E0557. +For more information about an error, try `rustc --explain E0556`. diff --git a/src/test/ui/generator-yielding-or-returning-itself.rs b/src/test/ui/generator-yielding-or-returning-itself.rs index 13abdf616b2..30788e3c186 100644 --- a/src/test/ui/generator-yielding-or-returning-itself.rs +++ b/src/test/ui/generator-yielding-or-returning-itself.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generator_trait)] #![feature(generators)] diff --git a/src/test/ui/generator-yielding-or-returning-itself.stderr b/src/test/ui/generator-yielding-or-returning-itself.stderr index a52e717ebae..5834aed2450 100644 --- a/src/test/ui/generator-yielding-or-returning-itself.stderr +++ b/src/test/ui/generator-yielding-or-returning-itself.stderr @@ -1,5 +1,5 @@ -error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:25:34: 29:6 _] as std::ops::Generator>::Return == [generator@$DIR/generator-yielding-or-returning-itself.rs:25:34: 29:6 _]` - --> $DIR/generator-yielding-or-returning-itself.rs:25:5 +error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 19:6 _] as std::ops::Generator>::Return == [generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 19:6 _]` + --> $DIR/generator-yielding-or-returning-itself.rs:15:5 | LL | want_cyclic_generator_return(|| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size @@ -8,7 +8,7 @@ LL | want_cyclic_generator_return(|| { this error may be the result of a recent compiler bug-fix, see https://github.com/rust-lang/rust/issues/46062 for more details note: required by `want_cyclic_generator_return` - --> $DIR/generator-yielding-or-returning-itself.rs:19:1 + --> $DIR/generator-yielding-or-returning-itself.rs:9:1 | LL | / pub fn want_cyclic_generator_return(_: T) LL | | where T: Generator @@ -16,8 +16,8 @@ LL | | { LL | | } | |_^ -error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:38:33: 42:6 _] as std::ops::Generator>::Yield == [generator@$DIR/generator-yielding-or-returning-itself.rs:38:33: 42:6 _]` - --> $DIR/generator-yielding-or-returning-itself.rs:38:5 +error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 32:6 _] as std::ops::Generator>::Yield == [generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 32:6 _]` + --> $DIR/generator-yielding-or-returning-itself.rs:28:5 | LL | want_cyclic_generator_yield(|| { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size @@ -26,7 +26,7 @@ LL | want_cyclic_generator_yield(|| { this error may be the result of a recent compiler bug-fix, see https://github.com/rust-lang/rust/issues/46062 for more details note: required by `want_cyclic_generator_yield` - --> $DIR/generator-yielding-or-returning-itself.rs:32:1 + --> $DIR/generator-yielding-or-returning-itself.rs:22:1 | LL | / pub fn want_cyclic_generator_yield(_: T) LL | | where T: Generator diff --git a/src/test/ui/generator/auto-trait-regions.rs b/src/test/ui/generator/auto-trait-regions.rs index ac2a414b742..46d72899438 100644 --- a/src/test/ui/generator/auto-trait-regions.rs +++ b/src/test/ui/generator/auto-trait-regions.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators)] #![feature(optin_builtin_traits)] @@ -37,7 +27,8 @@ fn main() { yield; assert_foo(x); }; - assert_foo(gen); //~ ERROR the trait bound `No: Foo` is not satisfied + assert_foo(gen); + //~^ ERROR implementation of `Foo` is not general enough // Allow impls which matches any lifetime let x = &OnlyFooIfRef(No); @@ -54,5 +45,6 @@ fn main() { yield; assert_foo(a); }; - assert_foo(gen); //~ ERROR the requirement `for<'r, 's> 'r : 's` is not satisfied + assert_foo(gen); + //~^ ERROR not general enough } diff --git a/src/test/ui/generator/auto-trait-regions.stderr b/src/test/ui/generator/auto-trait-regions.stderr index dd78baf9275..92f92e2a32a 100644 --- a/src/test/ui/generator/auto-trait-regions.stderr +++ b/src/test/ui/generator/auto-trait-regions.stderr @@ -1,37 +1,20 @@ -error[E0277]: the trait bound `No: Foo` is not satisfied in `[generator@$DIR/auto-trait-regions.rs:35:15: 39:6 x:&&OnlyFooIfStaticRef for<'r> {&'r OnlyFooIfStaticRef, ()}]` - --> $DIR/auto-trait-regions.rs:40:5 +error: implementation of `Foo` is not general enough + --> $DIR/auto-trait-regions.rs:30:5 | -LL | assert_foo(gen); //~ ERROR the trait bound `No: Foo` is not satisfied - | ^^^^^^^^^^ within `[generator@$DIR/auto-trait-regions.rs:35:15: 39:6 x:&&OnlyFooIfStaticRef for<'r> {&'r OnlyFooIfStaticRef, ()}]`, the trait `Foo` is not implemented for `No` - | - = help: the following implementations were found: - - = note: required because it appears within the type `OnlyFooIfStaticRef` - = note: required because it appears within the type `&OnlyFooIfStaticRef` - = note: required because it appears within the type `for<'r> {&'r OnlyFooIfStaticRef, ()}` - = note: required because it appears within the type `[generator@$DIR/auto-trait-regions.rs:35:15: 39:6 x:&&OnlyFooIfStaticRef for<'r> {&'r OnlyFooIfStaticRef, ()}]` -note: required by `assert_foo` - --> $DIR/auto-trait-regions.rs:30:1 +LL | assert_foo(gen); + | ^^^^^^^^^^ | -LL | fn assert_foo(f: T) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `Foo` would have to be implemented for the type `&'0 OnlyFooIfStaticRef`, for any lifetime `'0` + = note: but `Foo` is actually implemented for the type `&'1 OnlyFooIfStaticRef`, for some specific lifetime `'1` -error[E0279]: the requirement `for<'r, 's> 'r : 's` is not satisfied (`expected bound lifetime parameter, found concrete lifetime`) - --> $DIR/auto-trait-regions.rs:57:5 +error: implementation of `Foo` is not general enough + --> $DIR/auto-trait-regions.rs:48:5 | -LL | assert_foo(gen); //~ ERROR the requirement `for<'r, 's> 'r : 's` is not satisfied +LL | assert_foo(gen); | ^^^^^^^^^^ | - = note: required because of the requirements on the impl of `for<'r, 's> Foo` for `A<'_, '_>` - = note: required because it appears within the type `for<'r, 's> {A<'r, 's>, ()}` - = note: required because it appears within the type `[generator@$DIR/auto-trait-regions.rs:52:15: 56:6 for<'r, 's> {A<'r, 's>, ()}]` -note: required by `assert_foo` - --> $DIR/auto-trait-regions.rs:30:1 - | -LL | fn assert_foo(f: T) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1` + = note: but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2` error: aborting due to 2 previous errors -Some errors occurred: E0277, E0279. -For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/generator/borrowing.nll.stderr b/src/test/ui/generator/borrowing.nll.stderr index 52b5c9d891b..3c9221d28e7 100644 --- a/src/test/ui/generator/borrowing.nll.stderr +++ b/src/test/ui/generator/borrowing.nll.stderr @@ -1,12 +1,12 @@ error[E0597]: `a` does not live long enough - --> $DIR/borrowing.rs:18:29 + --> $DIR/borrowing.rs:9:33 | -LL | unsafe { (|| yield &a).resume() } - | -----------^- - | || | - | || borrowed value does not live long enough - | |value captured here by generator - | a temporary with access to the borrow is created here ... +LL | Pin::new(&mut || yield &a).resume() + | ----------^ + | | | + | | borrowed value does not live long enough + | value captured here by generator + | a temporary with access to the borrow is created here ... LL | //~^ ERROR: `a` does not live long enough LL | }; | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator @@ -16,7 +16,7 @@ LL | }; = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block. error[E0597]: `a` does not live long enough - --> $DIR/borrowing.rs:25:20 + --> $DIR/borrowing.rs:16:20 | LL | let _b = { | -- borrow later stored here diff --git a/src/test/ui/generator/borrowing.rs b/src/test/ui/generator/borrowing.rs index e56927d8182..9f8fc7483f6 100644 --- a/src/test/ui/generator/borrowing.rs +++ b/src/test/ui/generator/borrowing.rs @@ -1,21 +1,12 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators, generator_trait)] use std::ops::Generator; +use std::pin::Pin; fn main() { let _b = { let a = 3; - unsafe { (|| yield &a).resume() } + Pin::new(&mut || yield &a).resume() //~^ ERROR: `a` does not live long enough }; diff --git a/src/test/ui/generator/borrowing.stderr b/src/test/ui/generator/borrowing.stderr index 45d950b5aef..169e4a8561c 100644 --- a/src/test/ui/generator/borrowing.stderr +++ b/src/test/ui/generator/borrowing.stderr @@ -1,10 +1,10 @@ error[E0597]: `a` does not live long enough - --> $DIR/borrowing.rs:18:29 + --> $DIR/borrowing.rs:9:33 | -LL | unsafe { (|| yield &a).resume() } - | -- ^ borrowed value does not live long enough - | | - | capture occurs here +LL | Pin::new(&mut || yield &a).resume() + | -- ^ borrowed value does not live long enough + | | + | capture occurs here LL | //~^ ERROR: `a` does not live long enough LL | }; | - borrowed value only lives until here @@ -13,7 +13,7 @@ LL | } | - borrowed value needs to live until here error[E0597]: `a` does not live long enough - --> $DIR/borrowing.rs:25:20 + --> $DIR/borrowing.rs:16:20 | LL | || { | -- capture occurs here diff --git a/src/test/ui/generator/dropck.nll.stderr b/src/test/ui/generator/dropck.nll.stderr index 078aaf6176a..a90a47fe9aa 100644 --- a/src/test/ui/generator/dropck.nll.stderr +++ b/src/test/ui/generator/dropck.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `*cell` does not live long enough - --> $DIR/dropck.rs:19:40 + --> $DIR/dropck.rs:10:40 | LL | let ref_ = Box::leak(Box::new(Some(cell.borrow_mut()))); | ^^^^ borrowed value does not live long enough @@ -13,7 +13,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are defined error[E0597]: `ref_` does not live long enough - --> $DIR/dropck.rs:24:18 + --> $DIR/dropck.rs:15:18 | LL | gen = || { | -- value captured here by generator diff --git a/src/test/ui/generator/dropck.rs b/src/test/ui/generator/dropck.rs index 992a31a7320..65c61fbaac4 100644 --- a/src/test/ui/generator/dropck.rs +++ b/src/test/ui/generator/dropck.rs @@ -1,17 +1,8 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators, generator_trait, box_leak)] use std::cell::RefCell; use std::ops::Generator; +use std::pin::Pin; fn main() { let (mut gen, cell); @@ -24,6 +15,6 @@ fn main() { let _d = ref_.take(); //~ ERROR `ref_` does not live long enough yield; }; - unsafe { gen.resume(); } + Pin::new(&mut gen).resume(); // drops the RefCell and then the Ref, leading to use-after-free } diff --git a/src/test/ui/generator/dropck.stderr b/src/test/ui/generator/dropck.stderr index 1a6fed2dd35..fdaa5cfbae3 100644 --- a/src/test/ui/generator/dropck.stderr +++ b/src/test/ui/generator/dropck.stderr @@ -1,5 +1,5 @@ error[E0597]: `*cell` does not live long enough - --> $DIR/dropck.rs:19:40 + --> $DIR/dropck.rs:10:40 | LL | let ref_ = Box::leak(Box::new(Some(cell.borrow_mut()))); | ^^^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `ref_` does not live long enough - --> $DIR/dropck.rs:24:18 + --> $DIR/dropck.rs:15:18 | LL | gen = || { | -- capture occurs here diff --git a/src/test/ui/generator/generator-region-requirements.ast.stderr b/src/test/ui/generator/generator-region-requirements.ast.stderr index 6a423aea7ec..8a96d187f6b 100644 --- a/src/test/ui/generator/generator-region-requirements.ast.stderr +++ b/src/test/ui/generator/generator-region-requirements.ast.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/generator-region-requirements.rs:15:51 + --> $DIR/generator-region-requirements.rs:16:51 | LL | fn dangle(x: &mut i32) -> &'static mut i32 { | -------- help: add explicit lifetime `'static` to the type of `x`: `&'static mut i32` diff --git a/src/test/ui/generator/generator-region-requirements.nll.stderr b/src/test/ui/generator/generator-region-requirements.nll.stderr index 6a423aea7ec..8a96d187f6b 100644 --- a/src/test/ui/generator/generator-region-requirements.nll.stderr +++ b/src/test/ui/generator/generator-region-requirements.nll.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/generator-region-requirements.rs:15:51 + --> $DIR/generator-region-requirements.rs:16:51 | LL | fn dangle(x: &mut i32) -> &'static mut i32 { | -------- help: add explicit lifetime `'static` to the type of `x`: `&'static mut i32` diff --git a/src/test/ui/generator/generator-region-requirements.rs b/src/test/ui/generator/generator-region-requirements.rs index 59e7841309c..9738f6c3932 100644 --- a/src/test/ui/generator/generator-region-requirements.rs +++ b/src/test/ui/generator/generator-region-requirements.rs @@ -4,6 +4,7 @@ #![feature(generators, generator_trait)] #![cfg_attr(nll, feature(nll))] use std::ops::{Generator, GeneratorState}; +use std::pin::Pin; fn dangle(x: &mut i32) -> &'static mut i32 { let mut g = || { @@ -11,8 +12,10 @@ fn dangle(x: &mut i32) -> &'static mut i32 { x }; loop { - match unsafe { g.resume() } { + match Pin::new(&mut g).resume() { GeneratorState::Complete(c) => return c, +//[nll]~^ ERROR explicit lifetime required +//[ast]~^^ ERROR explicit lifetime required GeneratorState::Yielded(_) => (), } } diff --git a/src/test/ui/generator/generator-with-nll.rs b/src/test/ui/generator/generator-with-nll.rs index fdfe9e2c562..87afa57ab51 100644 --- a/src/test/ui/generator/generator-with-nll.rs +++ b/src/test/ui/generator/generator-with-nll.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators)] #![feature(nll)] diff --git a/src/test/ui/generator/generator-with-nll.stderr b/src/test/ui/generator/generator-with-nll.stderr index 1dc663d8bcb..c683ea1a309 100644 --- a/src/test/ui/generator/generator-with-nll.stderr +++ b/src/test/ui/generator/generator-with-nll.stderr @@ -1,5 +1,5 @@ error[E0626]: borrow may still be in use when generator yields - --> $DIR/generator-with-nll.rs:18:17 + --> $DIR/generator-with-nll.rs:8:17 | LL | let b = &mut true; | ^^^^^^^^^ diff --git a/src/test/ui/generator/issue-48048.rs b/src/test/ui/generator/issue-48048.rs index 89739bd591c..992bbc97a9f 100644 --- a/src/test/ui/generator/issue-48048.rs +++ b/src/test/ui/generator/issue-48048.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators)] fn main() { diff --git a/src/test/ui/generator/issue-48048.stderr b/src/test/ui/generator/issue-48048.stderr index f0654685deb..aeea1022509 100644 --- a/src/test/ui/generator/issue-48048.stderr +++ b/src/test/ui/generator/issue-48048.stderr @@ -1,5 +1,5 @@ error[E0626]: borrow may still be in use when generator yields - --> $DIR/issue-48048.rs:19:9 + --> $DIR/issue-48048.rs:9:9 | LL | x.0({ //~ ERROR borrow may still be in use when generator yields | ^^^ diff --git a/src/test/ui/generator/no-arguments-on-generators.rs b/src/test/ui/generator/no-arguments-on-generators.rs index a7e98fe4509..344c1179be9 100644 --- a/src/test/ui/generator/no-arguments-on-generators.rs +++ b/src/test/ui/generator/no-arguments-on-generators.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators)] fn main() { diff --git a/src/test/ui/generator/no-arguments-on-generators.stderr b/src/test/ui/generator/no-arguments-on-generators.stderr index 6520f8b2023..521001293af 100644 --- a/src/test/ui/generator/no-arguments-on-generators.stderr +++ b/src/test/ui/generator/no-arguments-on-generators.stderr @@ -1,5 +1,5 @@ error[E0628]: generators cannot have explicit arguments - --> $DIR/no-arguments-on-generators.rs:14:15 + --> $DIR/no-arguments-on-generators.rs:4:15 | LL | let gen = |start| { //~ ERROR generators cannot have explicit arguments | ^^^^^^^ diff --git a/src/test/ui/generator/not-send-sync.rs b/src/test/ui/generator/not-send-sync.rs index f0df05ebfdf..ae0a288bbb4 100644 --- a/src/test/ui/generator/not-send-sync.rs +++ b/src/test/ui/generator/not-send-sync.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators)] use std::cell::Cell; diff --git a/src/test/ui/generator/not-send-sync.stderr b/src/test/ui/generator/not-send-sync.stderr index edf7151f7c4..7ea9832c99a 100644 --- a/src/test/ui/generator/not-send-sync.stderr +++ b/src/test/ui/generator/not-send-sync.stderr @@ -1,29 +1,29 @@ error[E0277]: `std::cell::Cell` cannot be shared between threads safely - --> $DIR/not-send-sync.rs:26:5 + --> $DIR/not-send-sync.rs:16:5 | LL | assert_send(|| { | ^^^^^^^^^^^ `std::cell::Cell` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::cell::Cell` = note: required because of the requirements on the impl of `std::marker::Send` for `&std::cell::Cell` - = note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:26:17: 30:6 a:&std::cell::Cell _]` + = note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:16:17: 20:6 a:&std::cell::Cell _]` note: required by `main::assert_send` - --> $DIR/not-send-sync.rs:17:5 + --> $DIR/not-send-sync.rs:7:5 | LL | fn assert_send(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `std::cell::Cell` cannot be shared between threads safely - --> $DIR/not-send-sync.rs:19:5 + --> $DIR/not-send-sync.rs:9:5 | LL | assert_sync(|| { | ^^^^^^^^^^^ `std::cell::Cell` cannot be shared between threads safely | - = help: within `[generator@$DIR/not-send-sync.rs:19:17: 23:6 {std::cell::Cell, ()}]`, the trait `std::marker::Sync` is not implemented for `std::cell::Cell` + = help: within `[generator@$DIR/not-send-sync.rs:9:17: 13:6 {std::cell::Cell, ()}]`, the trait `std::marker::Sync` is not implemented for `std::cell::Cell` = note: required because it appears within the type `{std::cell::Cell, ()}` - = note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:19:17: 23:6 {std::cell::Cell, ()}]` + = note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:9:17: 13:6 {std::cell::Cell, ()}]` note: required by `main::assert_sync` - --> $DIR/not-send-sync.rs:16:5 + --> $DIR/not-send-sync.rs:6:5 | LL | fn assert_sync(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/generator/pattern-borrow.rs b/src/test/ui/generator/pattern-borrow.rs index 2c4c682d8cc..d1936370819 100644 --- a/src/test/ui/generator/pattern-borrow.rs +++ b/src/test/ui/generator/pattern-borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators)] enum Test { A(i32), B, } diff --git a/src/test/ui/generator/pattern-borrow.stderr b/src/test/ui/generator/pattern-borrow.stderr index 48f23486a31..50442828d8d 100644 --- a/src/test/ui/generator/pattern-borrow.stderr +++ b/src/test/ui/generator/pattern-borrow.stderr @@ -1,5 +1,5 @@ error[E0626]: borrow may still be in use when generator yields - --> $DIR/pattern-borrow.rs:19:24 + --> $DIR/pattern-borrow.rs:9:24 | LL | if let Test::A(ref _a) = test { //~ ERROR borrow may still be in use when generator yields | ^^^^^^ diff --git a/src/test/ui/generator/ref-escapes-but-not-over-yield.nll.stderr b/src/test/ui/generator/ref-escapes-but-not-over-yield.nll.stderr index b9096c42a0d..01eea627351 100644 --- a/src/test/ui/generator/ref-escapes-but-not-over-yield.nll.stderr +++ b/src/test/ui/generator/ref-escapes-but-not-over-yield.nll.stderr @@ -1,5 +1,5 @@ error[E0521]: borrowed data escapes outside of generator - --> $DIR/ref-escapes-but-not-over-yield.rs:24:9 + --> $DIR/ref-escapes-but-not-over-yield.rs:11:9 | LL | let mut a = &3; | ----- `a` is declared here, outside of the generator body diff --git a/src/test/ui/generator/ref-escapes-but-not-over-yield.rs b/src/test/ui/generator/ref-escapes-but-not-over-yield.rs index 989949cd9d7..8c576581ad8 100644 --- a/src/test/ui/generator/ref-escapes-but-not-over-yield.rs +++ b/src/test/ui/generator/ref-escapes-but-not-over-yield.rs @@ -1,17 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(generators, generator_trait)] - -use std::ops::{GeneratorState, Generator}; -use std::cell::Cell; +#![feature(generators)] fn foo(x: &i32) { // In this case, a reference to `b` escapes the generator, but not diff --git a/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr b/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr index 65817e30c4d..29299b2405a 100644 --- a/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr +++ b/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr @@ -1,5 +1,5 @@ error[E0597]: `b` does not live long enough - --> $DIR/ref-escapes-but-not-over-yield.rs:24:14 + --> $DIR/ref-escapes-but-not-over-yield.rs:11:14 | LL | a = &b; | ^ borrowed value does not live long enough diff --git a/src/test/ui/generator/sized-yield.rs b/src/test/ui/generator/sized-yield.rs index 461da94dde0..f64849b3149 100644 --- a/src/test/ui/generator/sized-yield.rs +++ b/src/test/ui/generator/sized-yield.rs @@ -1,16 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators, generator_trait)] use std::ops::Generator; +use std::pin::Pin; fn main() { let s = String::from("foo"); @@ -18,6 +9,6 @@ fn main() { //~^ ERROR the size for values of type yield s[..]; }; - unsafe { gen.resume(); } + Pin::new(&mut gen).resume(); //~^ ERROR the size for values of type } diff --git a/src/test/ui/generator/sized-yield.stderr b/src/test/ui/generator/sized-yield.stderr index d91db6763ab..c98f42e6216 100644 --- a/src/test/ui/generator/sized-yield.stderr +++ b/src/test/ui/generator/sized-yield.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/sized-yield.rs:17:26 + --> $DIR/sized-yield.rs:8:26 | LL | let mut gen = move || { | __________________________^ @@ -9,17 +9,17 @@ LL | | }; | |____^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: the yield type of a generator must have a statically known size error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/sized-yield.rs:21:17 + --> $DIR/sized-yield.rs:12:23 | -LL | unsafe { gen.resume(); } - | ^^^^^^ doesn't have a size known at compile-time +LL | Pin::new(&mut gen).resume(); + | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit error: aborting due to 2 previous errors diff --git a/src/test/ui/generator/static-not-unpin.rs b/src/test/ui/generator/static-not-unpin.rs new file mode 100644 index 00000000000..b271e982fb4 --- /dev/null +++ b/src/test/ui/generator/static-not-unpin.rs @@ -0,0 +1,15 @@ +#![feature(generators)] + +// normalize-stderr-test "std::pin::Unpin" -> "std::marker::Unpin" + +use std::marker::Unpin; + +fn assert_unpin(_: T) { +} + +fn main() { + let mut generator = static || { + yield; + }; + assert_unpin(generator); //~ ERROR std::marker::Unpin` is not satisfied +} diff --git a/src/test/ui/generator/static-not-unpin.stderr b/src/test/ui/generator/static-not-unpin.stderr new file mode 100644 index 00000000000..caf92f0ec69 --- /dev/null +++ b/src/test/ui/generator/static-not-unpin.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6 _]: std::marker::Unpin` is not satisfied + --> $DIR/static-not-unpin.rs:14:5 + | +LL | assert_unpin(generator); //~ ERROR std::marker::Unpin` is not satisfied + | ^^^^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6 _]` + | +note: required by `assert_unpin` + --> $DIR/static-not-unpin.rs:7:1 + | +LL | fn assert_unpin(_: T) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/generator/yield-in-args.nll.stderr b/src/test/ui/generator/yield-in-args.nll.stderr index 6242ec0f548..f753daafa97 100644 --- a/src/test/ui/generator/yield-in-args.nll.stderr +++ b/src/test/ui/generator/yield-in-args.nll.stderr @@ -1,5 +1,5 @@ error[E0626]: borrow may still be in use when generator yields - --> $DIR/yield-in-args.rs:18:13 + --> $DIR/yield-in-args.rs:8:13 | LL | foo(&b, yield); //~ ERROR | ^^ ----- possible yield occurs here diff --git a/src/test/ui/generator/yield-in-args.rs b/src/test/ui/generator/yield-in-args.rs index faeb4b1feb2..80110af55ab 100644 --- a/src/test/ui/generator/yield-in-args.rs +++ b/src/test/ui/generator/yield-in-args.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators)] fn foo(_b: &bool, _a: ()) {} diff --git a/src/test/ui/generator/yield-in-args.stderr b/src/test/ui/generator/yield-in-args.stderr index 3219939e89b..f53677b5312 100644 --- a/src/test/ui/generator/yield-in-args.stderr +++ b/src/test/ui/generator/yield-in-args.stderr @@ -1,5 +1,5 @@ error[E0626]: borrow may still be in use when generator yields - --> $DIR/yield-in-args.rs:18:14 + --> $DIR/yield-in-args.rs:8:14 | LL | foo(&b, yield); //~ ERROR | ^ ----- possible yield occurs here diff --git a/src/test/ui/generator/yield-in-const.rs b/src/test/ui/generator/yield-in-const.rs index 8636a66ae00..f6f11b9cb13 100644 --- a/src/test/ui/generator/yield-in-const.rs +++ b/src/test/ui/generator/yield-in-const.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators)] const A: u8 = { yield 3u8; 3u8}; diff --git a/src/test/ui/generator/yield-in-const.stderr b/src/test/ui/generator/yield-in-const.stderr index 874edce5931..e531bd6ef9f 100644 --- a/src/test/ui/generator/yield-in-const.stderr +++ b/src/test/ui/generator/yield-in-const.stderr @@ -1,5 +1,5 @@ error[E0627]: yield statement outside of generator literal - --> $DIR/yield-in-const.rs:13:17 + --> $DIR/yield-in-const.rs:3:17 | LL | const A: u8 = { yield 3u8; 3u8}; | ^^^^^^^^^ diff --git a/src/test/ui/generator/yield-in-function.rs b/src/test/ui/generator/yield-in-function.rs index 2f6c5a9ef75..b737d3b2240 100644 --- a/src/test/ui/generator/yield-in-function.rs +++ b/src/test/ui/generator/yield-in-function.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators)] fn main() { yield; } diff --git a/src/test/ui/generator/yield-in-function.stderr b/src/test/ui/generator/yield-in-function.stderr index 35be1fcd28d..981c9f8339f 100644 --- a/src/test/ui/generator/yield-in-function.stderr +++ b/src/test/ui/generator/yield-in-function.stderr @@ -1,5 +1,5 @@ error[E0627]: yield statement outside of generator literal - --> $DIR/yield-in-function.rs:13:13 + --> $DIR/yield-in-function.rs:3:13 | LL | fn main() { yield; } | ^^^^^ diff --git a/src/test/ui/generator/yield-in-static.rs b/src/test/ui/generator/yield-in-static.rs index 21601f47f67..12c9ccea4cb 100644 --- a/src/test/ui/generator/yield-in-static.rs +++ b/src/test/ui/generator/yield-in-static.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators)] static B: u8 = { yield 3u8; 3u8}; diff --git a/src/test/ui/generator/yield-in-static.stderr b/src/test/ui/generator/yield-in-static.stderr index 35d1ebaabdc..46d341f3dcf 100644 --- a/src/test/ui/generator/yield-in-static.stderr +++ b/src/test/ui/generator/yield-in-static.stderr @@ -1,5 +1,5 @@ error[E0627]: yield statement outside of generator literal - --> $DIR/yield-in-static.rs:13:18 + --> $DIR/yield-in-static.rs:3:18 | LL | static B: u8 = { yield 3u8; 3u8}; | ^^^^^^^^^ diff --git a/src/test/ui/generator/yield-while-iterating.nll.stderr b/src/test/ui/generator/yield-while-iterating.nll.stderr index 2f0a0589844..2dc12f843b2 100644 --- a/src/test/ui/generator/yield-while-iterating.nll.stderr +++ b/src/test/ui/generator/yield-while-iterating.nll.stderr @@ -1,5 +1,5 @@ error[E0626]: borrow may still be in use when generator yields - --> $DIR/yield-while-iterating.rs:22:18 + --> $DIR/yield-while-iterating.rs:13:18 | LL | for p in &x { //~ ERROR | ^^ @@ -7,7 +7,7 @@ LL | yield(); | ------- possible yield occurs here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/yield-while-iterating.rs:67:20 + --> $DIR/yield-while-iterating.rs:58:20 | LL | let mut b = || { | -- mutable borrow occurs here @@ -16,8 +16,8 @@ LL | for p in &mut x { ... LL | println!("{}", x[0]); //~ ERROR | ^ immutable borrow occurs here -LL | b.resume(); - | - mutable borrow later used here +LL | Pin::new(&mut b).resume(); + | ------ mutable borrow later used here error: aborting due to 2 previous errors diff --git a/src/test/ui/generator/yield-while-iterating.rs b/src/test/ui/generator/yield-while-iterating.rs index b8a67a0e7b6..e42781d1279 100644 --- a/src/test/ui/generator/yield-while-iterating.rs +++ b/src/test/ui/generator/yield-while-iterating.rs @@ -1,17 +1,8 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators, generator_trait)] use std::ops::{GeneratorState, Generator}; use std::cell::Cell; +use std::pin::Pin; fn yield_during_iter_owned_data(x: Vec) { // The generator owns `x`, so we error out when yielding with a @@ -43,7 +34,7 @@ fn yield_during_iter_borrowed_slice_2() { println!("{:?}", x); } -unsafe fn yield_during_iter_borrowed_slice_3() { +fn yield_during_iter_borrowed_slice_3() { // OK to take a mutable ref to `x` and yield // up pointers from it: let mut x = vec![22_i32]; @@ -52,10 +43,10 @@ unsafe fn yield_during_iter_borrowed_slice_3() { yield p; } }; - b.resume(); + Pin::new(&mut b).resume(); } -unsafe fn yield_during_iter_borrowed_slice_4() { +fn yield_during_iter_borrowed_slice_4() { // ...but not OK to do that while reading // from `x` too let mut x = vec![22_i32]; @@ -65,10 +56,10 @@ unsafe fn yield_during_iter_borrowed_slice_4() { } }; println!("{}", x[0]); //~ ERROR - b.resume(); + Pin::new(&mut b).resume(); } -unsafe fn yield_during_range_iter() { +fn yield_during_range_iter() { // Should be OK. let mut b = || { let v = vec![1,2,3]; @@ -78,7 +69,7 @@ unsafe fn yield_during_range_iter() { yield x; } }; - b.resume(); + Pin::new(&mut b).resume(); } fn main() { } diff --git a/src/test/ui/generator/yield-while-iterating.stderr b/src/test/ui/generator/yield-while-iterating.stderr index c20b1348e27..1e3e31470e9 100644 --- a/src/test/ui/generator/yield-while-iterating.stderr +++ b/src/test/ui/generator/yield-while-iterating.stderr @@ -1,5 +1,5 @@ error[E0626]: borrow may still be in use when generator yields - --> $DIR/yield-while-iterating.rs:22:19 + --> $DIR/yield-while-iterating.rs:13:19 | LL | for p in &x { //~ ERROR | ^ @@ -7,7 +7,7 @@ LL | yield(); | ------- possible yield occurs here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/yield-while-iterating.rs:67:20 + --> $DIR/yield-while-iterating.rs:58:20 | LL | let mut b = || { | -- mutable borrow occurs here @@ -16,7 +16,7 @@ LL | for p in &mut x { ... LL | println!("{}", x[0]); //~ ERROR | ^ immutable borrow occurs here -LL | b.resume(); +LL | Pin::new(&mut b).resume(); LL | } | - mutable borrow ends here diff --git a/src/test/ui/generator/yield-while-local-borrowed.rs b/src/test/ui/generator/yield-while-local-borrowed.rs index 3dc2650a2ec..38061e71358 100644 --- a/src/test/ui/generator/yield-while-local-borrowed.rs +++ b/src/test/ui/generator/yield-while-local-borrowed.rs @@ -1,21 +1,12 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z borrowck=compare #![feature(generators, generator_trait)] use std::ops::{GeneratorState, Generator}; use std::cell::Cell; +use std::pin::Pin; -unsafe fn borrow_local_inline() { +fn borrow_local_inline() { // Not OK to yield with a borrow of a temporary. // // (This error occurs because the region shows up in the type of @@ -27,10 +18,10 @@ unsafe fn borrow_local_inline() { yield(); println!("{}", a); }; - b.resume(); + Pin::new(&mut b).resume(); } -unsafe fn borrow_local_inline_done() { +fn borrow_local_inline_done() { // No error here -- `a` is not in scope at the point of `yield`. let mut b = move || { { @@ -38,10 +29,10 @@ unsafe fn borrow_local_inline_done() { } yield(); }; - b.resume(); + Pin::new(&mut b).resume(); } -unsafe fn borrow_local() { +fn borrow_local() { // Not OK to yield with a borrow of a temporary. // // (This error occurs because the region shows up in the type of @@ -56,7 +47,7 @@ unsafe fn borrow_local() { println!("{}", b); } }; - b.resume(); + Pin::new(&mut b).resume(); } fn main() { } diff --git a/src/test/ui/generator/yield-while-local-borrowed.stderr b/src/test/ui/generator/yield-while-local-borrowed.stderr index a7f9862a726..56f425b7e70 100644 --- a/src/test/ui/generator/yield-while-local-borrowed.stderr +++ b/src/test/ui/generator/yield-while-local-borrowed.stderr @@ -1,5 +1,5 @@ error[E0626]: borrow may still be in use when generator yields (Ast) - --> $DIR/yield-while-local-borrowed.rs:24:22 + --> $DIR/yield-while-local-borrowed.rs:15:22 | LL | let a = &mut 3; | ^ @@ -8,7 +8,7 @@ LL | yield(); | ------- possible yield occurs here error[E0626]: borrow may still be in use when generator yields (Ast) - --> $DIR/yield-while-local-borrowed.rs:52:22 + --> $DIR/yield-while-local-borrowed.rs:43:22 | LL | let b = &a; | ^ @@ -17,7 +17,7 @@ LL | yield(); | ------- possible yield occurs here error[E0626]: borrow may still be in use when generator yields (Mir) - --> $DIR/yield-while-local-borrowed.rs:24:17 + --> $DIR/yield-while-local-borrowed.rs:15:17 | LL | let a = &mut 3; | ^^^^^^ @@ -26,7 +26,7 @@ LL | yield(); | ------- possible yield occurs here error[E0626]: borrow may still be in use when generator yields (Mir) - --> $DIR/yield-while-local-borrowed.rs:52:21 + --> $DIR/yield-while-local-borrowed.rs:43:21 | LL | let b = &a; | ^^ diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr b/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr index 8dabb3c2505..d0d6a98301e 100644 --- a/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr +++ b/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr @@ -1,5 +1,5 @@ error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access - --> $DIR/yield-while-ref-reborrowed.rs:45:20 + --> $DIR/yield-while-ref-reborrowed.rs:36:20 | LL | let mut b = || { | -- generator construction occurs here @@ -7,9 +7,9 @@ LL | let a = &mut *x; | - first borrow occurs due to use of `x` in generator ... LL | println!("{}", x); //~ ERROR - | ^ borrow occurs here -LL | b.resume(); - | - first borrow later used here + | ^ second borrow occurs here +LL | Pin::new(&mut b).resume(); + | ------ first borrow later used here error: aborting due to previous error diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.rs b/src/test/ui/generator/yield-while-ref-reborrowed.rs index 573dd4377bb..f54a4f468f6 100644 --- a/src/test/ui/generator/yield-while-ref-reborrowed.rs +++ b/src/test/ui/generator/yield-while-ref-reborrowed.rs @@ -1,19 +1,10 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators, generator_trait)] use std::ops::{GeneratorState, Generator}; use std::cell::Cell; +use std::pin::Pin; -unsafe fn reborrow_shared_ref(x: &i32) { +fn reborrow_shared_ref(x: &i32) { // This is OK -- we have a borrow live over the yield, but it's of // data that outlives the generator. let mut b = move || { @@ -21,10 +12,10 @@ unsafe fn reborrow_shared_ref(x: &i32) { yield(); println!("{}", a); }; - b.resume(); + Pin::new(&mut b).resume(); } -unsafe fn reborrow_mutable_ref(x: &mut i32) { +fn reborrow_mutable_ref(x: &mut i32) { // This is OK -- we have a borrow live over the yield, but it's of // data that outlives the generator. let mut b = move || { @@ -32,10 +23,10 @@ unsafe fn reborrow_mutable_ref(x: &mut i32) { yield(); println!("{}", a); }; - b.resume(); + Pin::new(&mut b).resume(); } -unsafe fn reborrow_mutable_ref_2(x: &mut i32) { +fn reborrow_mutable_ref_2(x: &mut i32) { // ...but not OK to go on using `x`. let mut b = || { let a = &mut *x; @@ -43,7 +34,7 @@ unsafe fn reborrow_mutable_ref_2(x: &mut i32) { println!("{}", a); }; println!("{}", x); //~ ERROR - b.resume(); + Pin::new(&mut b).resume(); } fn main() { } diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.stderr b/src/test/ui/generator/yield-while-ref-reborrowed.stderr index 8139814c7f2..5c9de279c02 100644 --- a/src/test/ui/generator/yield-while-ref-reborrowed.stderr +++ b/src/test/ui/generator/yield-while-ref-reborrowed.stderr @@ -1,5 +1,5 @@ error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access - --> $DIR/yield-while-ref-reborrowed.rs:45:20 + --> $DIR/yield-while-ref-reborrowed.rs:36:20 | LL | let mut b = || { | -- closure construction occurs here @@ -8,7 +8,7 @@ LL | let a = &mut *x; ... LL | println!("{}", x); //~ ERROR | ^ borrow occurs here -LL | b.resume(); +LL | Pin::new(&mut b).resume(); LL | } | - borrow from closure ends here diff --git a/src/test/ui/generic/generic-arg-mismatch-recover.rs b/src/test/ui/generic/generic-arg-mismatch-recover.rs index b8883ff9c83..f4e15fbebce 100644 --- a/src/test/ui/generic/generic-arg-mismatch-recover.rs +++ b/src/test/ui/generic/generic-arg-mismatch-recover.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'a, T: 'a>(&'a T); struct Bar<'a>(&'a ()); diff --git a/src/test/ui/generic/generic-arg-mismatch-recover.stderr b/src/test/ui/generic/generic-arg-mismatch-recover.stderr index 5cbaa29794f..37f6c61f06d 100644 --- a/src/test/ui/generic/generic-arg-mismatch-recover.stderr +++ b/src/test/ui/generic/generic-arg-mismatch-recover.stderr @@ -1,26 +1,26 @@ error[E0107]: wrong number of lifetime arguments: expected 1, found 2 - --> $DIR/generic-arg-mismatch-recover.rs:16:20 + --> $DIR/generic-arg-mismatch-recover.rs:6:20 | LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments | ^^^^^^^ unexpected lifetime argument error[E0308]: mismatched types - --> $DIR/generic-arg-mismatch-recover.rs:16:33 + --> $DIR/generic-arg-mismatch-recover.rs:6:33 | LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments - | ^^ expected (), found integral variable + | ^^ expected (), found integer | = note: expected type `&'static ()` found type `&{integer}` error[E0107]: wrong number of lifetime arguments: expected 1, found 2 - --> $DIR/generic-arg-mismatch-recover.rs:19:20 + --> $DIR/generic-arg-mismatch-recover.rs:9:20 | LL | Bar::<'static, 'static, ()>(&()); //~ ERROR wrong number of lifetime arguments | ^^^^^^^ unexpected lifetime argument error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/generic-arg-mismatch-recover.rs:19:29 + --> $DIR/generic-arg-mismatch-recover.rs:9:29 | LL | Bar::<'static, 'static, ()>(&()); //~ ERROR wrong number of lifetime arguments | ^^ unexpected type argument diff --git a/src/test/ui/generic/generic-extern-lifetime.rs b/src/test/ui/generic/generic-extern-lifetime.rs index fa2d4743937..22bcd44a14d 100644 --- a/src/test/ui/generic/generic-extern-lifetime.rs +++ b/src/test/ui/generic/generic-extern-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test to make sure the names of the lifetimes are correctly resolved // in extern blocks. diff --git a/src/test/ui/generic/generic-extern-lifetime.stderr b/src/test/ui/generic/generic-extern-lifetime.stderr index 9276ae0d412..b31d2a88044 100644 --- a/src/test/ui/generic/generic-extern-lifetime.stderr +++ b/src/test/ui/generic/generic-extern-lifetime.stderr @@ -1,17 +1,17 @@ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/generic-extern-lifetime.rs:16:24 + --> $DIR/generic-extern-lifetime.rs:6:24 | LL | pub fn life2<'b>(x:&'a i32, y:&'b i32); //~ ERROR use of undeclared lifetime name `'a` | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/generic-extern-lifetime.rs:18:36 + --> $DIR/generic-extern-lifetime.rs:8:36 | LL | pub fn life4<'b>(x: for<'c> fn(&'a i32)); //~ ERROR use of undeclared lifetime name `'a` | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/generic-extern-lifetime.rs:21:38 + --> $DIR/generic-extern-lifetime.rs:11:38 | LL | pub fn life7<'b>() -> for<'c> fn(&'a i32); //~ ERROR use of undeclared lifetime name `'a` | ^^ undeclared lifetime diff --git a/src/test/ui/generic/generic-extern.rs b/src/test/ui/generic/generic-extern.rs index a7140d1be87..e52a88592ff 100644 --- a/src/test/ui/generic/generic-extern.rs +++ b/src/test/ui/generic/generic-extern.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { fn foo(); //~ ERROR foreign items may not have type parameters } diff --git a/src/test/ui/generic/generic-extern.stderr b/src/test/ui/generic/generic-extern.stderr index c1ba2cced54..1c978245f9c 100644 --- a/src/test/ui/generic/generic-extern.stderr +++ b/src/test/ui/generic/generic-extern.stderr @@ -1,5 +1,5 @@ error[E0044]: foreign items may not have type parameters - --> $DIR/generic-extern.rs:12:5 + --> $DIR/generic-extern.rs:2:5 | LL | fn foo(); //~ ERROR foreign items may not have type parameters | ^^^^^^^^^^^^ can't have type parameters diff --git a/src/test/ui/generic/generic-impl-less-params-with-defaults.rs b/src/test/ui/generic/generic-impl-less-params-with-defaults.rs index 3f5f7bb3a53..abbf6405820 100644 --- a/src/test/ui/generic/generic-impl-less-params-with-defaults.rs +++ b/src/test/ui/generic/generic-impl-less-params-with-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; struct Foo( diff --git a/src/test/ui/generic/generic-impl-less-params-with-defaults.stderr b/src/test/ui/generic/generic-impl-less-params-with-defaults.stderr index 94ae02a7b4b..22b00e1dea4 100644 --- a/src/test/ui/generic/generic-impl-less-params-with-defaults.stderr +++ b/src/test/ui/generic/generic-impl-less-params-with-defaults.stderr @@ -1,5 +1,5 @@ error[E0107]: wrong number of type arguments: expected at least 2, found 1 - --> $DIR/generic-impl-less-params-with-defaults.rs:21:5 + --> $DIR/generic-impl-less-params-with-defaults.rs:11:5 | LL | Foo::::new(); | ^^^^^^^^^^^^^^^^^ expected at least 2 type arguments diff --git a/src/test/ui/generic/generic-impl-more-params-with-defaults.rs b/src/test/ui/generic/generic-impl-more-params-with-defaults.rs index 31411992089..a14fb7064c9 100644 --- a/src/test/ui/generic/generic-impl-more-params-with-defaults.rs +++ b/src/test/ui/generic/generic-impl-more-params-with-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; struct Heap; diff --git a/src/test/ui/generic/generic-impl-more-params-with-defaults.stderr b/src/test/ui/generic/generic-impl-more-params-with-defaults.stderr index 43a7413856b..66950d450a1 100644 --- a/src/test/ui/generic/generic-impl-more-params-with-defaults.stderr +++ b/src/test/ui/generic/generic-impl-more-params-with-defaults.stderr @@ -1,5 +1,5 @@ error[E0107]: wrong number of type arguments: expected at most 2, found 3 - --> $DIR/generic-impl-more-params-with-defaults.rs:23:5 + --> $DIR/generic-impl-more-params-with-defaults.rs:13:5 | LL | Vec::::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments diff --git a/src/test/ui/generic/generic-lifetime-trait-impl.rs b/src/test/ui/generic/generic-lifetime-trait-impl.rs index 9b9f09f4777..6ffaba19d78 100644 --- a/src/test/ui/generic/generic-lifetime-trait-impl.rs +++ b/src/test/ui/generic/generic-lifetime-trait-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This code used to produce an ICE on the definition of trait Bar // with the following message: // diff --git a/src/test/ui/generic/generic-lifetime-trait-impl.stderr b/src/test/ui/generic/generic-lifetime-trait-impl.stderr index 182eab0a69b..8f4a0f23670 100644 --- a/src/test/ui/generic/generic-lifetime-trait-impl.stderr +++ b/src/test/ui/generic/generic-lifetime-trait-impl.stderr @@ -1,5 +1,5 @@ error[E0195]: lifetime parameters or bounds on method `bar` do not match the trait declaration - --> $DIR/generic-lifetime-trait-impl.rs:29:11 + --> $DIR/generic-lifetime-trait-impl.rs:19:11 | LL | fn bar<'b, T: Bar<'b>>(self) -> &'b str; | ---------------- lifetimes in impl do not match this method in trait diff --git a/src/test/ui/generic/generic-no-mangle.rs b/src/test/ui/generic/generic-no-mangle.rs index 2b4c94d281f..15e662a41de 100644 --- a/src/test/ui/generic/generic-no-mangle.rs +++ b/src/test/ui/generic/generic-no-mangle.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(no_mangle_generic_items)] #[no_mangle] diff --git a/src/test/ui/generic/generic-no-mangle.stderr b/src/test/ui/generic/generic-no-mangle.stderr index 4eaa3973329..639ee199101 100644 --- a/src/test/ui/generic/generic-no-mangle.stderr +++ b/src/test/ui/generic/generic-no-mangle.stderr @@ -1,5 +1,5 @@ error: functions generic over types must be mangled - --> $DIR/generic-no-mangle.rs:14:1 + --> $DIR/generic-no-mangle.rs:4:1 | LL | #[no_mangle] | ------------ help: remove this attribute @@ -7,13 +7,13 @@ LL | pub fn foo() {} //~ ERROR functions generic over types must be mangled | ^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/generic-no-mangle.rs:11:9 + --> $DIR/generic-no-mangle.rs:1:9 | LL | #![deny(no_mangle_generic_items)] | ^^^^^^^^^^^^^^^^^^^^^^^ error: functions generic over types must be mangled - --> $DIR/generic-no-mangle.rs:17:1 + --> $DIR/generic-no-mangle.rs:7:1 | LL | #[no_mangle] | ------------ help: remove this attribute diff --git a/src/test/ui/generic/generic-non-trailing-defaults.rs b/src/test/ui/generic/generic-non-trailing-defaults.rs index 13b7753082c..8d9883dc7a9 100644 --- a/src/test/ui/generic/generic-non-trailing-defaults.rs +++ b/src/test/ui/generic/generic-non-trailing-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Heap; struct Vec(A, T); diff --git a/src/test/ui/generic/generic-non-trailing-defaults.stderr b/src/test/ui/generic/generic-non-trailing-defaults.stderr index ce8badf6d30..fb359f673a9 100644 --- a/src/test/ui/generic/generic-non-trailing-defaults.stderr +++ b/src/test/ui/generic/generic-non-trailing-defaults.stderr @@ -1,17 +1,17 @@ error: type parameters with a default must be trailing - --> $DIR/generic-non-trailing-defaults.rs:13:12 + --> $DIR/generic-non-trailing-defaults.rs:3:12 | LL | struct Vec(A, T); | ^ error: type parameters with a default must be trailing - --> $DIR/generic-non-trailing-defaults.rs:16:15 + --> $DIR/generic-non-trailing-defaults.rs:6:15 | LL | struct Foo, C>(A, B, C); | ^ error[E0128]: type parameters with a default cannot use forward declared identifiers - --> $DIR/generic-non-trailing-defaults.rs:16:23 + --> $DIR/generic-non-trailing-defaults.rs:6:23 | LL | struct Foo, C>(A, B, C); | ^ defaulted type parameters cannot be forward declared diff --git a/src/test/ui/generic/generic-param-attrs.rs b/src/test/ui/generic/generic-param-attrs.rs index 81113d949e1..601d2a9e0a3 100644 --- a/src/test/ui/generic/generic-param-attrs.rs +++ b/src/test/ui/generic/generic-param-attrs.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test previously ensured that attributes on formals in generic parameter // lists are rejected without a feature gate. // diff --git a/src/test/ui/generic/generic-type-less-params-with-defaults.rs b/src/test/ui/generic/generic-type-less-params-with-defaults.rs index 295f0fbc77e..3aa03392ff2 100644 --- a/src/test/ui/generic/generic-type-less-params-with-defaults.rs +++ b/src/test/ui/generic/generic-type-less-params-with-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; struct Heap; diff --git a/src/test/ui/generic/generic-type-less-params-with-defaults.stderr b/src/test/ui/generic/generic-type-less-params-with-defaults.stderr index b024be55c8d..a4cc8325a04 100644 --- a/src/test/ui/generic/generic-type-less-params-with-defaults.stderr +++ b/src/test/ui/generic/generic-type-less-params-with-defaults.stderr @@ -1,5 +1,5 @@ error[E0107]: wrong number of type arguments: expected at least 1, found 0 - --> $DIR/generic-type-less-params-with-defaults.rs:19:12 + --> $DIR/generic-type-less-params-with-defaults.rs:9:12 | LL | let _: Vec; | ^^^ expected at least 1 type argument diff --git a/src/test/ui/generic/generic-type-more-params-with-defaults.rs b/src/test/ui/generic/generic-type-more-params-with-defaults.rs index 84c3a2f2230..2713f088dcb 100644 --- a/src/test/ui/generic/generic-type-more-params-with-defaults.rs +++ b/src/test/ui/generic/generic-type-more-params-with-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; struct Heap; diff --git a/src/test/ui/generic/generic-type-more-params-with-defaults.stderr b/src/test/ui/generic/generic-type-more-params-with-defaults.stderr index 2d3e1c5970c..5031930b1bb 100644 --- a/src/test/ui/generic/generic-type-more-params-with-defaults.stderr +++ b/src/test/ui/generic/generic-type-more-params-with-defaults.stderr @@ -1,5 +1,5 @@ error[E0107]: wrong number of type arguments: expected at most 2, found 3 - --> $DIR/generic-type-more-params-with-defaults.rs:19:12 + --> $DIR/generic-type-more-params-with-defaults.rs:9:12 | LL | let _: Vec; | ^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments diff --git a/src/test/ui/generic/generic-type-params-forward-mention.rs b/src/test/ui/generic/generic-type-params-forward-mention.rs index bfa6af0da43..ac0cab20d78 100644 --- a/src/test/ui/generic/generic-type-params-forward-mention.rs +++ b/src/test/ui/generic/generic-type-params-forward-mention.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensure that we get an error and not an ICE for this problematic case. struct Foo, U = bool>(T, U); //~^ ERROR type parameters with a default cannot use forward declared identifiers diff --git a/src/test/ui/generic/generic-type-params-forward-mention.stderr b/src/test/ui/generic/generic-type-params-forward-mention.stderr index 542716326f1..97389c337fc 100644 --- a/src/test/ui/generic/generic-type-params-forward-mention.stderr +++ b/src/test/ui/generic/generic-type-params-forward-mention.stderr @@ -1,5 +1,5 @@ error[E0128]: type parameters with a default cannot use forward declared identifiers - --> $DIR/generic-type-params-forward-mention.rs:12:23 + --> $DIR/generic-type-params-forward-mention.rs:2:23 | LL | struct Foo, U = bool>(T, U); | ^ defaulted type parameters cannot be forward declared diff --git a/src/test/ui/generic/generic-type-params-name-repr.rs b/src/test/ui/generic/generic-type-params-name-repr.rs index 71d7cf792e4..7e074aa2a6b 100644 --- a/src/test/ui/generic/generic-type-params-name-repr.rs +++ b/src/test/ui/generic/generic-type-params-name-repr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; struct A; diff --git a/src/test/ui/generic/generic-type-params-name-repr.stderr b/src/test/ui/generic/generic-type-params-name-repr.stderr index 1c65aeadae6..2aa9cafb8bf 100644 --- a/src/test/ui/generic/generic-type-params-name-repr.stderr +++ b/src/test/ui/generic/generic-type-params-name-repr.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/generic-type-params-name-repr.rs:23:25 + --> $DIR/generic-type-params-name-repr.rs:13:25 | LL | let _: Foo = (); | ^^ expected struct `Foo`, found () @@ -8,7 +8,7 @@ LL | let _: Foo = (); found type `()` error[E0308]: mismatched types - --> $DIR/generic-type-params-name-repr.rs:30:31 + --> $DIR/generic-type-params-name-repr.rs:20:31 | LL | let _: Foo = (); | ^^ expected struct `Foo`, found () @@ -17,7 +17,7 @@ LL | let _: Foo = (); found type `()` error[E0308]: mismatched types - --> $DIR/generic-type-params-name-repr.rs:37:37 + --> $DIR/generic-type-params-name-repr.rs:27:37 | LL | let _: HashMap = (); | ^^ expected struct `HashMap`, found () @@ -26,7 +26,7 @@ LL | let _: HashMap = (); found type `()` error[E0308]: mismatched types - --> $DIR/generic-type-params-name-repr.rs:42:51 + --> $DIR/generic-type-params-name-repr.rs:32:51 | LL | let _: HashMap> = (); | ^^ expected struct `HashMap`, found () @@ -35,7 +35,7 @@ LL | let _: HashMap> = (); found type `()` error[E0308]: mismatched types - --> $DIR/generic-type-params-name-repr.rs:49:31 + --> $DIR/generic-type-params-name-repr.rs:39:31 | LL | let _: Foo = (); | ^^ expected struct `Foo`, found () @@ -44,7 +44,7 @@ LL | let _: Foo = (); found type `()` error[E0308]: mismatched types - --> $DIR/generic-type-params-name-repr.rs:56:27 + --> $DIR/generic-type-params-name-repr.rs:46:27 | LL | let _: Foo = (); | ^^ expected struct `Foo`, found () diff --git a/src/test/ui/glob-cycles.rs b/src/test/ui/glob-cycles.rs index d57dad074b2..84f9e5d8436 100644 --- a/src/test/ui/glob-cycles.rs +++ b/src/test/ui/glob-cycles.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen mod foo { diff --git a/src/test/ui/glob-resolve1.rs b/src/test/ui/glob-resolve1.rs index 2723b4ce256..63c435cc206 100644 --- a/src/test/ui/glob-resolve1.rs +++ b/src/test/ui/glob-resolve1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure that globs only bring in public things. use bar::*; diff --git a/src/test/ui/glob-resolve1.stderr b/src/test/ui/glob-resolve1.stderr index 650dd2c3b19..10a57aa6ca6 100644 --- a/src/test/ui/glob-resolve1.stderr +++ b/src/test/ui/glob-resolve1.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find function `fpriv` in this scope - --> $DIR/glob-resolve1.rs:32:5 + --> $DIR/glob-resolve1.rs:22:5 | LL | fpriv(); //~ ERROR cannot find function `fpriv` in this scope | ^^^^^ not found in this scope @@ -9,7 +9,7 @@ LL | use bar::fpriv; | error[E0425]: cannot find function `epriv` in this scope - --> $DIR/glob-resolve1.rs:33:5 + --> $DIR/glob-resolve1.rs:23:5 | LL | epriv(); //~ ERROR cannot find function `epriv` in this scope | ^^^^^ not found in this scope @@ -19,7 +19,7 @@ LL | use bar::epriv; | error[E0423]: expected value, found enum `B` - --> $DIR/glob-resolve1.rs:34:5 + --> $DIR/glob-resolve1.rs:24:5 | LL | B; //~ ERROR expected value, found enum `B` | ^ @@ -28,7 +28,7 @@ LL | B; //~ ERROR expected value, found enum `B` - `B::B1` error[E0425]: cannot find value `C` in this scope - --> $DIR/glob-resolve1.rs:35:5 + --> $DIR/glob-resolve1.rs:25:5 | LL | C; //~ ERROR cannot find value `C` in this scope | ^ not found in this scope @@ -38,36 +38,48 @@ LL | use bar::C; | error[E0425]: cannot find function `import` in this scope - --> $DIR/glob-resolve1.rs:36:5 + --> $DIR/glob-resolve1.rs:26:5 | LL | import(); //~ ERROR: cannot find function `import` in this scope | ^^^^^^ not found in this scope error[E0412]: cannot find type `A` in this scope - --> $DIR/glob-resolve1.rs:38:11 + --> $DIR/glob-resolve1.rs:28:11 | LL | foo::(); //~ ERROR: cannot find type `A` in this scope - | ^ did you mean `B`? + | ^ +help: an enum with a similar name exists + | +LL | foo::(); //~ ERROR: cannot find type `A` in this scope + | ^ help: possible candidate is found in another module, you can import it into scope | LL | use bar::A; | error[E0412]: cannot find type `C` in this scope - --> $DIR/glob-resolve1.rs:39:11 + --> $DIR/glob-resolve1.rs:29:11 | LL | foo::(); //~ ERROR: cannot find type `C` in this scope - | ^ did you mean `B`? + | ^ +help: an enum with a similar name exists + | +LL | foo::(); //~ ERROR: cannot find type `C` in this scope + | ^ help: possible candidate is found in another module, you can import it into scope | LL | use bar::C; | error[E0412]: cannot find type `D` in this scope - --> $DIR/glob-resolve1.rs:40:11 + --> $DIR/glob-resolve1.rs:30:11 | LL | foo::(); //~ ERROR: cannot find type `D` in this scope - | ^ did you mean `B`? + | ^ +help: an enum with a similar name exists + | +LL | foo::(); //~ ERROR: cannot find type `D` in this scope + | ^ help: possible candidate is found in another module, you can import it into scope | LL | use bar::D; diff --git a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr index 61a28bfd17b..cff58af3775 100644 --- a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr +++ b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable - --> $DIR/hashmap-iter-value-lifetime.rs:17:5 + --> $DIR/hashmap-iter-value-lifetime.rs:7:5 | LL | let (_, thing) = my_stuff.iter().next().unwrap(); | -------- immutable borrow occurs here diff --git a/src/test/ui/hashmap-iter-value-lifetime.rs b/src/test/ui/hashmap-iter-value-lifetime.rs index 9cf145a1ff3..260ea8c7ae1 100644 --- a/src/test/ui/hashmap-iter-value-lifetime.rs +++ b/src/test/ui/hashmap-iter-value-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let mut my_stuff = std::collections::HashMap::new(); my_stuff.insert(0, 42); diff --git a/src/test/ui/hashmap-iter-value-lifetime.stderr b/src/test/ui/hashmap-iter-value-lifetime.stderr index 16e9c527391..99761dd1cd7 100644 --- a/src/test/ui/hashmap-iter-value-lifetime.stderr +++ b/src/test/ui/hashmap-iter-value-lifetime.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable - --> $DIR/hashmap-iter-value-lifetime.rs:17:5 + --> $DIR/hashmap-iter-value-lifetime.rs:7:5 | LL | let (_, thing) = my_stuff.iter().next().unwrap(); | -------- immutable borrow occurs here diff --git a/src/test/ui/hashmap-lifetimes.nll.stderr b/src/test/ui/hashmap-lifetimes.nll.stderr index 4cf87ee8dc7..08b8e3e443a 100644 --- a/src/test/ui/hashmap-lifetimes.nll.stderr +++ b/src/test/ui/hashmap-lifetimes.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable - --> $DIR/hashmap-lifetimes.rs:18:5 + --> $DIR/hashmap-lifetimes.rs:6:5 | LL | let mut it = my_stuff.iter(); | -------- immutable borrow occurs here diff --git a/src/test/ui/hashmap-lifetimes.rs b/src/test/ui/hashmap-lifetimes.rs index eb7404e7b78..295bf3b0e66 100644 --- a/src/test/ui/hashmap-lifetimes.rs +++ b/src/test/ui/hashmap-lifetimes.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - fn main() { let mut my_stuff = std::collections::HashMap::new(); my_stuff.insert(0, 42); diff --git a/src/test/ui/hashmap-lifetimes.stderr b/src/test/ui/hashmap-lifetimes.stderr index 187c98ab298..81b2304f381 100644 --- a/src/test/ui/hashmap-lifetimes.stderr +++ b/src/test/ui/hashmap-lifetimes.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable - --> $DIR/hashmap-lifetimes.rs:18:5 + --> $DIR/hashmap-lifetimes.rs:6:5 | LL | let mut it = my_stuff.iter(); | -------- immutable borrow occurs here diff --git a/src/test/ui/hello_world/main.rs b/src/test/ui/hello_world/main.rs index bf6e5225124..f790af64b4d 100644 --- a/src/test/ui/hello_world/main.rs +++ b/src/test/ui/hello_world/main.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // Test that compiling hello world succeeds with no output of any kind. diff --git a/src/test/ui/hidden-rt-injection.rs b/src/test/ui/hidden-rt-injection.rs index a27a8464707..3ca04f93493 100644 --- a/src/test/ui/hidden-rt-injection.rs +++ b/src/test/ui/hidden-rt-injection.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is testing that users can't access the runtime crate. mod m { diff --git a/src/test/ui/hidden-rt-injection.stderr b/src/test/ui/hidden-rt-injection.stderr index 103cdf05485..6d63344882b 100644 --- a/src/test/ui/hidden-rt-injection.stderr +++ b/src/test/ui/hidden-rt-injection.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `native` - --> $DIR/hidden-rt-injection.rs:15:9 + --> $DIR/hidden-rt-injection.rs:5:9 | LL | use native; //~ ERROR unresolved import | ^^^^^^ no `native` in the root diff --git a/src/test/ui/hidden-rt-injection2.rs b/src/test/ui/hidden-rt-injection2.rs index fa6584ddd98..2af113c05e0 100644 --- a/src/test/ui/hidden-rt-injection2.rs +++ b/src/test/ui/hidden-rt-injection2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is testing that users can't access the runtime crate. mod m { diff --git a/src/test/ui/hidden-rt-injection2.stderr b/src/test/ui/hidden-rt-injection2.stderr index df0527f307a..bbb45552f2c 100644 --- a/src/test/ui/hidden-rt-injection2.stderr +++ b/src/test/ui/hidden-rt-injection2.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `rt` - --> $DIR/hidden-rt-injection2.rs:15:9 + --> $DIR/hidden-rt-injection2.rs:5:9 | LL | use rt; //~ ERROR unresolved import | ^^ no `rt` in the root diff --git a/src/test/ui/higher-lifetime-bounds.rs b/src/test/ui/higher-lifetime-bounds.rs index 70b3b34fbd8..546f4d43663 100644 --- a/src/test/ui/higher-lifetime-bounds.rs +++ b/src/test/ui/higher-lifetime-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code, non_camel_case_types)] // Test that bounds on higher-kinded lifetime binders are rejected. diff --git a/src/test/ui/higher-lifetime-bounds.stderr b/src/test/ui/higher-lifetime-bounds.stderr index 82c00747436..431a89f5eb8 100644 --- a/src/test/ui/higher-lifetime-bounds.stderr +++ b/src/test/ui/higher-lifetime-bounds.stderr @@ -1,65 +1,65 @@ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:18:22 + --> $DIR/higher-lifetime-bounds.rs:8:22 | LL | f: for<'xa, 'xb: 'xa+'xa> fn(&'xa i32, &'xb i32) -> &'xa i32) | ^^^ ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:26:34 + --> $DIR/higher-lifetime-bounds.rs:16:34 | LL | fn bar2<'a, 'b, F: for<'xa, 'xb: 'xa> Fn(&'xa i32, &'xb i32) -> &'xa i32>( | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:41:28 + --> $DIR/higher-lifetime-bounds.rs:31:28 | LL | where F: for<'xa, 'xb: 'xa> Fn(&'xa i32, &'xb i32) -> &'xa i32 | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:53:25 + --> $DIR/higher-lifetime-bounds.rs:43:25 | LL | where for<'xa, 'xb: 'xa> F: Fn(&'xa i32, &'xb i32) -> &'xa i32 | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:61:28 + --> $DIR/higher-lifetime-bounds.rs:51:28 | LL | struct S1 Fn(&'xa i32, &'xb i32) -> &'xa i32>(F); | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:63:40 + --> $DIR/higher-lifetime-bounds.rs:53:40 | LL | struct S2(F) where F: for<'xa, 'xb: 'xa> Fn(&'xa i32, &'xb i32) -> &'xa i32; | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:65:37 + --> $DIR/higher-lifetime-bounds.rs:55:37 | LL | struct S3(F) where for<'xa, 'xb: 'xa> F: Fn(&'xa i32, &'xb i32) -> &'xa i32; | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:68:29 + --> $DIR/higher-lifetime-bounds.rs:58:29 | LL | struct S_fnty(for<'xa, 'xb: 'xa> fn(&'xa i32, &'xb i32) -> &'xa i32); | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:71:29 + --> $DIR/higher-lifetime-bounds.rs:61:29 | LL | type T1 = Box Fn(&'xa i32, &'xb i32) -> &'xa i32>; | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:75:34 + --> $DIR/higher-lifetime-bounds.rs:65:34 | LL | let _ : Option fn(&'xa i32, &'xb i32) -> &'xa i32> = None; | ^^^ error: lifetime bounds cannot be used in this context - --> $DIR/higher-lifetime-bounds.rs:77:38 + --> $DIR/higher-lifetime-bounds.rs:67:38 | LL | let _ : Option Fn(&'xa i32, &'xb i32) -> &'xa i32>> = None; | ^^^ diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr index d668a931459..bdfabdabbeb 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/hr-subtype.rs:49:26 + --> $DIR/hr-subtype.rs:39:26 | LL | gimme::<$t1>(None::<$t2>); - | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a + | ^^^^^^^^^^^ one type is more general than the other ... LL | / check! { bound_a_b_ret_a_vs_bound_a_ret_a: (for<'a,'b> fn(&'a u32, &'b u32) -> &'a u32, LL | | for<'a> fn(&'a u32, &'a u32) -> &'a u32) } diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr index 23854f9c147..25b74d855bb 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr @@ -1,16 +1,14 @@ -error[E0308]: mismatched types - --> $DIR/hr-subtype.rs:49:26 +error: compilation successful + --> $DIR/hr-subtype.rs:96:1 | -LL | gimme::<$t1>(None::<$t2>); - | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a -... -LL | / check! { bound_a_b_vs_bound_a: (for<'a,'b> fn(&'a u32, &'b u32), -LL | | for<'a> fn(&'a u32, &'a u32)) } - | |__________________________________________________________________- in this macro invocation - | - = note: expected type `std::option::Option fn(&'a u32, &'b u32)>` - found type `std::option::Option fn(&'a u32, &'a u32)>` +LL | / fn main() { +LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful +LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful +LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful +... | +LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful +LL | | } + | |_^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr index 01a9f578fbc..25b74d855bb 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr @@ -1,12 +1,12 @@ error: compilation successful - --> $DIR/hr-subtype.rs:110:1 + --> $DIR/hr-subtype.rs:96:1 | LL | / fn main() { LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful -LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful -LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful +... | +LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful LL | | } | |_^ diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr index 01a9f578fbc..25b74d855bb 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr @@ -1,12 +1,12 @@ error: compilation successful - --> $DIR/hr-subtype.rs:110:1 + --> $DIR/hr-subtype.rs:96:1 | LL | / fn main() { LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful -LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful -LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful +... | +LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful LL | | } | |_^ diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr index 14e498593f3..74b8c89b6e8 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/hr-subtype.rs:49:26 + --> $DIR/hr-subtype.rs:39:26 | LL | gimme::<$t1>(None::<$t2>); - | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a + | ^^^^^^^^^^^ one type is more general than the other ... LL | / check! { bound_a_vs_free_x: (for<'a> fn(&'a u32), LL | | fn(&'x u32)) } diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr index a66a4ace910..25b74d855bb 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr @@ -1,16 +1,14 @@ -error[E0308]: mismatched types - --> $DIR/hr-subtype.rs:49:26 +error: compilation successful + --> $DIR/hr-subtype.rs:96:1 | -LL | gimme::<$t1>(None::<$t2>); - | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a -... -LL | / check! { bound_co_a_b_vs_bound_co_a: (for<'a,'b> fn(Co<'a>, Co<'b>), -LL | | for<'a> fn(Co<'a>, Co<'a>)) } - | |______________________________________________________________________- in this macro invocation - | - = note: expected type `std::option::Option fn(Co<'a>, Co<'b>)>` - found type `std::option::Option fn(Co<'a>, Co<'a>)>` +LL | / fn main() { +LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful +LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful +LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful +... | +LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful +LL | | } + | |_^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr index 9f94b45140c..25b74d855bb 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr @@ -1,16 +1,14 @@ -error[E0308]: mismatched types - --> $DIR/hr-subtype.rs:49:26 +error: compilation successful + --> $DIR/hr-subtype.rs:96:1 | -LL | gimme::<$t1>(None::<$t2>); - | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a -... -LL | / check! { bound_co_a_co_b_ret_contra_a: (for<'a,'b> fn(Co<'a>, Co<'b>) -> Contra<'a>, -LL | | for<'a> fn(Co<'a>, Co<'a>) -> Contra<'a>) } - | |______________________________________________________________________________________- in this macro invocation - | - = note: expected type `std::option::Option fn(Co<'a>, Co<'b>) -> Contra<'a>>` - found type `std::option::Option fn(Co<'a>, Co<'a>) -> Contra<'a>>` +LL | / fn main() { +LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful +LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful +LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful +... | +LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful +LL | | } + | |_^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr index 01a9f578fbc..25b74d855bb 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr @@ -1,12 +1,12 @@ error: compilation successful - --> $DIR/hr-subtype.rs:110:1 + --> $DIR/hr-subtype.rs:96:1 | LL | / fn main() { LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful -LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful -LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful +... | +LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful LL | | } | |_^ diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr index 511369703ba..25b74d855bb 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr @@ -1,16 +1,14 @@ -error[E0308]: mismatched types - --> $DIR/hr-subtype.rs:49:26 +error: compilation successful + --> $DIR/hr-subtype.rs:96:1 | -LL | gimme::<$t1>(None::<$t2>); - | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a -... -LL | / check! { bound_contra_a_contra_b_ret_co_a: (for<'a,'b> fn(Contra<'a>, Contra<'b>) -> Co<'a>, -LL | | for<'a> fn(Contra<'a>, Contra<'a>) -> Co<'a>) } - | |______________________________________________________________________________________________- in this macro invocation - | - = note: expected type `std::option::Option fn(Contra<'a>, Contra<'b>) -> Co<'a>>` - found type `std::option::Option fn(Contra<'a>, Contra<'a>) -> Co<'a>>` +LL | / fn main() { +LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful +LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful +LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful +... | +LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful +LL | | } + | |_^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr index d39d5f76a6e..8168941e277 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/hr-subtype.rs:49:26 + --> $DIR/hr-subtype.rs:39:26 | LL | gimme::<$t1>(None::<$t2>); - | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a + | ^^^^^^^^^^^ one type is more general than the other ... LL | / check! { bound_inv_a_b_vs_bound_inv_a: (for<'a,'b> fn(Inv<'a>, Inv<'b>), LL | | for<'a> fn(Inv<'a>, Inv<'a>)) } diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_vs_bound_inv_b.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_vs_bound_inv_b.stderr index 01a9f578fbc..25b74d855bb 100644 --- a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_vs_bound_inv_b.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_vs_bound_inv_b.stderr @@ -1,12 +1,12 @@ error: compilation successful - --> $DIR/hr-subtype.rs:110:1 + --> $DIR/hr-subtype.rs:96:1 | LL | / fn main() { LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful -LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful -LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful +... | +LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful LL | | } | |_^ diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr index bf562700bb4..979f64fcd90 100644 --- a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/hr-subtype.rs:43:26 + --> $DIR/hr-subtype.rs:33:26 | LL | gimme::<$t2>(None::<$t1>); | ^^^^^^^^^^^ lifetime mismatch @@ -10,8 +10,8 @@ LL | | fn(Inv<'y>)) } | = note: expected type `std::option::Option)>` found type `std::option::Option)>` -note: the lifetime 'x as defined on the function body at 42:20... - --> $DIR/hr-subtype.rs:42:20 +note: the lifetime 'x as defined on the function body at 32:20... + --> $DIR/hr-subtype.rs:32:20 | LL | fn subtype<'x,'y:'x,'z:'y>() { | ^^ @@ -19,8 +19,8 @@ LL | fn subtype<'x,'y:'x,'z:'y>() { LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>), LL | | fn(Inv<'y>)) } | |__________________________________________________- in this macro invocation -note: ...does not necessarily outlive the lifetime 'y as defined on the function body at 42:23 - --> $DIR/hr-subtype.rs:42:23 +note: ...does not necessarily outlive the lifetime 'y as defined on the function body at 32:23 + --> $DIR/hr-subtype.rs:32:23 | LL | fn subtype<'x,'y:'x,'z:'y>() { | ^^ @@ -30,7 +30,7 @@ LL | | fn(Inv<'y>)) } | |__________________________________________________- in this macro invocation error[E0308]: mismatched types - --> $DIR/hr-subtype.rs:49:26 + --> $DIR/hr-subtype.rs:39:26 | LL | gimme::<$t1>(None::<$t2>); | ^^^^^^^^^^^ lifetime mismatch @@ -41,8 +41,8 @@ LL | | fn(Inv<'y>)) } | = note: expected type `std::option::Option)>` found type `std::option::Option)>` -note: the lifetime 'x as defined on the function body at 48:22... - --> $DIR/hr-subtype.rs:48:22 +note: the lifetime 'x as defined on the function body at 38:22... + --> $DIR/hr-subtype.rs:38:22 | LL | fn supertype<'x,'y:'x,'z:'y>() { | ^^ @@ -50,8 +50,8 @@ LL | fn supertype<'x,'y:'x,'z:'y>() { LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>), LL | | fn(Inv<'y>)) } | |__________________________________________________- in this macro invocation -note: ...does not necessarily outlive the lifetime 'y as defined on the function body at 48:25 - --> $DIR/hr-subtype.rs:48:25 +note: ...does not necessarily outlive the lifetime 'y as defined on the function body at 38:25 + --> $DIR/hr-subtype.rs:38:25 | LL | fn supertype<'x,'y:'x,'z:'y>() { | ^^ diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_x.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_x.stderr index 01a9f578fbc..25b74d855bb 100644 --- a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_x.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_x.stderr @@ -1,12 +1,12 @@ error: compilation successful - --> $DIR/hr-subtype.rs:110:1 + --> $DIR/hr-subtype.rs:96:1 | LL | / fn main() { LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful -LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful -LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful +... | +LL | | //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful LL | | } | |_^ diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr index 228f6db38fb..3b6aff52169 100644 --- a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr +++ b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/hr-subtype.rs:49:26 + --> $DIR/hr-subtype.rs:39:26 | LL | gimme::<$t1>(None::<$t2>); | ^^^^^^^^^^^ lifetime mismatch @@ -10,8 +10,8 @@ LL | | fn(&'y u32)) } | = note: expected type `std::option::Option` found type `std::option::Option` -note: the lifetime 'x as defined on the function body at 48:22... - --> $DIR/hr-subtype.rs:48:22 +note: the lifetime 'x as defined on the function body at 38:22... + --> $DIR/hr-subtype.rs:38:22 | LL | fn supertype<'x,'y:'x,'z:'y>() { | ^^ @@ -19,8 +19,8 @@ LL | fn supertype<'x,'y:'x,'z:'y>() { LL | / check! { free_x_vs_free_y: (fn(&'x u32), LL | | fn(&'y u32)) } | |__________________________________________- in this macro invocation -note: ...does not necessarily outlive the lifetime 'y as defined on the function body at 48:25 - --> $DIR/hr-subtype.rs:48:25 +note: ...does not necessarily outlive the lifetime 'y as defined on the function body at 38:25 + --> $DIR/hr-subtype.rs:38:25 | LL | fn supertype<'x,'y:'x,'z:'y>() { | ^^ diff --git a/src/test/ui/hr-subtype/hr-subtype.rs b/src/test/ui/hr-subtype/hr-subtype.rs index 86df2382732..ad4f39f8405 100644 --- a/src/test/ui/hr-subtype/hr-subtype.rs +++ b/src/test/ui/hr-subtype/hr-subtype.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Targeted tests for the higher-ranked subtyping code. #![feature(rustc_attrs)] @@ -41,21 +31,17 @@ macro_rules! check { #[cfg($rev)] fn subtype<'x,'y:'x,'z:'y>() { gimme::<$t2>(None::<$t1>); - //[free_inv_x_vs_free_inv_y]~^ ERROR mismatched types + //[free_inv_x_vs_free_inv_y]~^ ERROR } #[cfg($rev)] fn supertype<'x,'y:'x,'z:'y>() { gimme::<$t1>(None::<$t2>); - //[bound_a_vs_free_x]~^ ERROR mismatched types - //[free_x_vs_free_y]~^^ ERROR mismatched types - //[bound_inv_a_b_vs_bound_inv_a]~^^^ ERROR mismatched types - //[bound_a_b_ret_a_vs_bound_a_ret_a]~^^^^ ERROR mismatched types - //[free_inv_x_vs_free_inv_y]~^^^^^ ERROR mismatched types - //[bound_a_b_vs_bound_a]~^^^^^^ ERROR mismatched types - //[bound_co_a_b_vs_bound_co_a]~^^^^^^^ ERROR mismatched types - //[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^ ERROR mismatched types - //[bound_co_a_co_b_ret_contra_a]~^^^^^^^^^ ERROR mismatched types + //[bound_a_vs_free_x]~^ ERROR + //[free_x_vs_free_y]~^^ ERROR + //[bound_inv_a_b_vs_bound_inv_a]~^^^ ERROR + //[bound_a_b_ret_a_vs_bound_a_ret_a]~^^^^ ERROR + //[free_inv_x_vs_free_inv_y]~^^^^^ ERROR } } } @@ -113,4 +99,8 @@ fn main() { //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful //[free_x_vs_free_x]~^^^^^ ERROR compilation successful +//[bound_a_b_vs_bound_a]~^^^^^^ ERROR compilation successful +//[bound_co_a_co_b_ret_contra_a]~^^^^^^^ ERROR compilation successful +//[bound_co_a_b_vs_bound_co_a]~^^^^^^^^ ERROR compilation successful +//[bound_contra_a_contra_b_ret_co_a]~^^^^^^^^^ ERROR compilation successful } diff --git a/src/test/ui/hrtb/hrtb-cache-issue-54302.rs b/src/test/ui/hrtb/hrtb-cache-issue-54302.rs new file mode 100644 index 00000000000..a20d03c7747 --- /dev/null +++ b/src/test/ui/hrtb/hrtb-cache-issue-54302.rs @@ -0,0 +1,24 @@ +// Regression test for #54302. +// +// We were incorrectly using the "evaluation cache" (which ignored +// region results) to conclude that `&'static str: Deserialize`, even +// though it would require that `for<'de> 'de: 'static`, which is +// clearly false. + +trait Deserialize<'de> {} + +trait DeserializeOwned: for<'de> Deserialize<'de> {} +impl DeserializeOwned for T where T: for<'de> Deserialize<'de> {} + +// Based on this impl, `&'static str` only implements Deserialize<'static>. +// It does not implement for<'de> Deserialize<'de>. +impl<'de: 'a, 'a> Deserialize<'de> for &'a str {} + +fn main() { + fn assert_deserialize_owned() {} + assert_deserialize_owned::<&'static str>(); //~ ERROR + + // It correctly does not implement for<'de> Deserialize<'de>. + // fn assert_hrtb Deserialize<'de>>() {} + // assert_hrtb::<&'static str>(); +} diff --git a/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr b/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr new file mode 100644 index 00000000000..21d154eb231 --- /dev/null +++ b/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr @@ -0,0 +1,11 @@ +error: implementation of `Deserialize` is not general enough + --> $DIR/hrtb-cache-issue-54302.rs:19:5 + | +LL | assert_deserialize_owned::<&'static str>(); //~ ERROR + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `&'static str` must implement `Deserialize<'0>`, for any lifetime `'0` + = note: but `&str` actually implements `Deserialize<'1>`, for some specific lifetime `'1` + +error: aborting due to previous error + diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.rs b/src/test/ui/hrtb/hrtb-conflate-regions.rs index 845429d4b0c..391303676d7 100644 --- a/src/test/ui/hrtb/hrtb-conflate-regions.rs +++ b/src/test/ui/hrtb/hrtb-conflate-regions.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that an impl with only one bound region `'a` cannot be used to // satisfy a constraint where there are two bound regions. @@ -35,6 +25,6 @@ impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct } fn a() { want_foo1::(); } // OK -- foo wants just one region -fn b() { want_foo2::(); } //~ ERROR E0277 +fn b() { want_foo2::(); } //~ ERROR fn main() { } diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.stderr b/src/test/ui/hrtb/hrtb-conflate-regions.stderr index 42778c12960..630dda2694f 100644 --- a/src/test/ui/hrtb/hrtb-conflate-regions.stderr +++ b/src/test/ui/hrtb/hrtb-conflate-regions.stderr @@ -1,20 +1,12 @@ -error[E0277]: the trait bound `for<'a, 'b> SomeStruct: Foo<(&'a isize, &'b isize)>` is not satisfied - --> $DIR/hrtb-conflate-regions.rs:38:10 +error: implementation of `Foo` is not general enough + --> $DIR/hrtb-conflate-regions.rs:28:10 | -LL | fn b() { want_foo2::(); } //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Foo<(&'a isize, &'b isize)>` is not implemented for `SomeStruct` +LL | fn b() { want_foo2::(); } //~ ERROR + | ^^^^^^^^^^^^^^^^^^^^^^^ | - = help: the following implementations were found: - > -note: required by `want_foo2` - --> $DIR/hrtb-conflate-regions.rs:18:1 - | -LL | / fn want_foo2() -LL | | where T : for<'a,'b> Foo<(&'a isize, &'b isize)> -LL | | { -LL | | } - | |_^ + = note: Due to a where-clause on `want_foo2`, + = note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1` + = note: but `SomeStruct` actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr index 10d028b05a7..80ecc4741a2 100644 --- a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr +++ b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time - --> $DIR/hrtb-debruijn-in-receiver.rs:27:5 + --> $DIR/hrtb-debruijn-in-receiver.rs:17:5 | LL | foo.insert(); | --- first mutable borrow occurs here diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs index 2365f494075..05d3e1a434e 100644 --- a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs +++ b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test the case where the `Self` type has a bound lifetime that must // be adjusted in the fn signature. Issue #19537. diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr index 9a560caf5e9..85bff4ce791 100644 --- a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr +++ b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time - --> $DIR/hrtb-debruijn-in-receiver.rs:27:5 + --> $DIR/hrtb-debruijn-in-receiver.rs:17:5 | LL | foo.insert(); | --- first mutable borrow occurs here diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.rs b/src/test/ui/hrtb/hrtb-exists-forall-fn.rs new file mode 100644 index 00000000000..828331cb950 --- /dev/null +++ b/src/test/ui/hrtb/hrtb-exists-forall-fn.rs @@ -0,0 +1,18 @@ +// Test a `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! +// +// In particular, we test this pattern in trait solving, where it is not connected +// to any part of the source code. + +fn foo<'a>() -> fn(&'a u32) { + panic!() +} + +fn main() { + // Here, proving that `fn(&'a u32) <: for<'b> fn(&'b u32)`: + // + // - instantiates `'b` with a placeholder `!b`, + // - requires that `&!b u32 <: &'a u32` and hence that `!b: 'a`, + // - but we can never know this. + + let _: for<'b> fn(&'b u32) = foo(); //~ ERROR mismatched types +} diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr b/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr new file mode 100644 index 00000000000..6301ed45ac2 --- /dev/null +++ b/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/hrtb-exists-forall-fn.rs:17:34 + | +LL | let _: for<'b> fn(&'b u32) = foo(); //~ ERROR mismatched types + | ^^^^^ one type is more general than the other + | + = note: expected type `for<'b> fn(&'b u32)` + found type `fn(&u32)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs new file mode 100644 index 00000000000..8801760056e --- /dev/null +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-contravariant.rs @@ -0,0 +1,35 @@ +// Test a `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! +// +// In particular, we test this pattern in trait solving, where it is not connected +// to any part of the source code. +// +// compile-pass + +trait Trait {} + +fn foo() +where + T: Trait fn(&'b u32)>, +{ +} + +impl<'a> Trait for () {} + +fn main() { + // Here, proving that `(): Trait fn(&'b u32)>` uses the impl: + // + // - The impl provides the clause `forall<'a> { (): Trait }` + // - We instantiate `'a` existentially to get `(): Trait` + // - We unify `fn(&?a u32)` with `for<'b> fn(&'b u32)` -- this does a + // "bidirectional" subtyping check, so we wind up with: + // - `fn(&?a u32) <: for<'b> fn(&'b u32)` :- + // - `&'!b u32 <: &?a u32` + // - `!'b: ?a` -- solveable if `?a` is inferred to `'empty` + // - `for<'b> fn(&'b u32) <: fn(&?a u32)` :- + // - `&?a u32 u32 <: &?b u32` + // - `?a: ?b` -- solveable if `?b` is also inferred to `'empty` + // - So the subtyping check succeeds, somewhat surprisingly. + // This is because we can use `'empty`. + + foo::<()>(); +} diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.rs b/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.rs new file mode 100644 index 00000000000..da1bb7cd5fd --- /dev/null +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-covariant.rs @@ -0,0 +1,37 @@ +// Test a `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! +// +// In particular, we test this pattern in trait solving, where it is not connected +// to any part of the source code. +// +// compile-pass + +trait Trait {} + +fn foo() +where + T: Trait fn(fn(&'b u32))>, +{ +} + +impl<'a> Trait for () {} + +fn main() { + // Here, proving that `(): Trait fn(&'b u32)>` uses the impl: + // + // - The impl provides the clause `forall<'a> { (): Trait }` + // - We instantiate `'a` existentially to get `(): Trait` + // - We unify `fn(fn(&?a u32))` with `for<'b> fn(fn(&'b u32))` -- this does a + // "bidirectional" subtyping check, so we wind up with: + // - `fn(fn(&?a u32)) <: for<'b> fn(fn(&'b u32))` :- + // - `fn(&!b u32) <: fn(&?a u32)` + // - `&?a u32 <: &!b u32` + // - `?a: !'b` -- solveable if `?a` is inferred to `'static` + // - `for<'b> fn(fn(&'b u32)) <: fn(fn(&?a u32))` :- + // - `fn(&?a u32) <: fn(&?b u32)` + // - `&?b u32 <: &?a u32` + // - `?b: ?a` -- solveable if `?b` is inferred to `'static` + // - So the subtyping check succeeds, somewhat surprisingly. + // This is because we can use `'static`. + + foo::<()>(); +} diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs new file mode 100644 index 00000000000..da3f8ad1b89 --- /dev/null +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.rs @@ -0,0 +1,29 @@ +// Test a `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile! +// +// In particular, we test this pattern in trait solving, where it is not connected +// to any part of the source code. + +use std::cell::Cell; + +trait Trait {} + +fn foo() +where + T: Trait fn(Cell<&'b u32>)>, +{ +} + +impl<'a> Trait)> for () {} + +fn main() { + // Here, proving that `(): Trait fn(&'b u32)>` uses the impl: + // + // - The impl provides the clause `forall<'a> { (): Trait }` + // - We instantiate `'a` existentially to get `(): Trait` + // - We unify `fn(&?a u32)` with `for<'b> fn(&'b u32)` + // - This requires (among other things) instantiating `'b` universally, + // yielding `fn(&!b u32)`, in a fresh universe U1 + // - So we get `?a = !b` but the universe U0 assigned to `?a` cannot name `!b`. + + foo::<()>(); //~ ERROR not general enough +} diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr new file mode 100644 index 00000000000..a44837a1e26 --- /dev/null +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr @@ -0,0 +1,12 @@ +error: implementation of `Trait` is not general enough + --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5 + | +LL | foo::<()>(); //~ ERROR not general enough + | ^^^^^^^^^ + | + = note: Due to a where-clause on `foo`, + = note: `()` must implement `Trait fn(std::cell::Cell<&'b u32>)>` + = note: but `()` actually implements `Trait)>`, for some specific lifetime `'0` + +error: aborting due to previous error + diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.rs b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.rs index b55dccec2d5..f9ae1429ee4 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.rs +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test HRTB supertraits with several levels of expansion required. trait Foo<'tcx> @@ -54,7 +44,7 @@ fn want_qux(b: &B) where B : Qux { want_foo_for_any_tcx(b); - want_bar_for_any_ccx(b); //~ ERROR E0277 + want_bar_for_any_ccx(b); //~ ERROR } fn main() {} diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr index dca9feab201..0d7b5cbf823 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr @@ -1,19 +1,12 @@ -error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied - --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:57:5 +error[E0308]: mismatched types + --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:47:5 | -LL | want_bar_for_any_ccx(b); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` +LL | want_bar_for_any_ccx(b); //~ ERROR + | ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | - = help: consider adding a `where for<'ccx> B: Bar<'ccx>` bound -note: required by `want_bar_for_any_ccx` - --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:41:1 - | -LL | / fn want_bar_for_any_ccx(b: &B) -LL | | where B : for<'ccx> Bar<'ccx> -LL | | { -LL | | } - | |_^ + = note: expected type `for<'ccx> Bar<'ccx>` + found type `Bar<'static>` error: aborting due to previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs index 4c5add4acea..3d2d403462d 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a trait (`Bar`) with a higher-ranked supertrait. trait Foo<'tcx> @@ -25,7 +15,7 @@ fn want_foo_for_some_tcx<'x,F>(f: &'x F) where F : Foo<'x> { want_foo_for_some_tcx(f); - want_foo_for_any_tcx(f); //~ ERROR E0277 + want_foo_for_any_tcx(f); //~ ERROR E0308 } fn want_foo_for_any_tcx(f: &F) @@ -42,7 +32,7 @@ fn want_bar_for_some_ccx<'x,B>(b: &B) want_foo_for_any_tcx(b); want_bar_for_some_ccx(b); - want_bar_for_any_ccx(b); //~ ERROR E0277 + want_bar_for_any_ccx(b); //~ ERROR E0308 } fn want_bar_for_any_ccx(b: &B) diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr index ad069e10182..31dbeec2a55 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr @@ -1,40 +1,21 @@ -error[E0277]: the trait bound `for<'tcx> F: Foo<'tcx>` is not satisfied - --> $DIR/hrtb-higher-ranker-supertraits.rs:28:5 +error[E0308]: mismatched types + --> $DIR/hrtb-higher-ranker-supertraits.rs:18:5 | -LL | want_foo_for_any_tcx(f); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F` +LL | want_foo_for_any_tcx(f); //~ ERROR E0308 + | ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | - = help: consider adding a `where for<'tcx> F: Foo<'tcx>` bound -note: required by `want_foo_for_any_tcx` - --> $DIR/hrtb-higher-ranker-supertraits.rs:31:1 - | -LL | / fn want_foo_for_any_tcx(f: &F) -LL | | where F : for<'tcx> Foo<'tcx> -LL | | { -LL | | want_foo_for_some_tcx(f); -LL | | want_foo_for_any_tcx(f); -LL | | } - | |_^ + = note: expected type `for<'tcx> Foo<'tcx>` + found type `Foo<'x>` -error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied - --> $DIR/hrtb-higher-ranker-supertraits.rs:45:5 - | -LL | want_bar_for_any_ccx(b); //~ ERROR E0277 - | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` +error[E0308]: mismatched types + --> $DIR/hrtb-higher-ranker-supertraits.rs:35:5 | - = help: consider adding a `where for<'ccx> B: Bar<'ccx>` bound -note: required by `want_bar_for_any_ccx` - --> $DIR/hrtb-higher-ranker-supertraits.rs:48:1 +LL | want_bar_for_any_ccx(b); //~ ERROR E0308 + | ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other | -LL | / fn want_bar_for_any_ccx(b: &B) -LL | | where B : for<'ccx> Bar<'ccx> -LL | | { -LL | | want_foo_for_some_tcx(b); -... | -LL | | want_bar_for_any_ccx(b); -LL | | } - | |_^ + = note: expected type `for<'ccx> Bar<'ccx>` + found type `Bar<'x>` error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.nll.stderr b/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.nll.stderr index e533ecc6eb0..bbb95e8c8d4 100644 --- a/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.nll.stderr +++ b/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/hrtb-identity-fn-borrows.rs:27:5 + --> $DIR/hrtb-identity-fn-borrows.rs:17:5 | LL | let y = f.call(&x); | -- borrow of `x` occurs here diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.stderr b/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.stderr index 6888ec9bddb..f6f9200a354 100644 --- a/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.stderr +++ b/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/hrtb-identity-fn-borrows.rs:27:5 + --> $DIR/hrtb-identity-fn-borrows.rs:17:5 | LL | let y = f.call(&x); | - borrow of `x` occurs here diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.mir.stderr b/src/test/ui/hrtb/hrtb-identity-fn-borrows.mir.stderr index e533ecc6eb0..bbb95e8c8d4 100644 --- a/src/test/ui/hrtb/hrtb-identity-fn-borrows.mir.stderr +++ b/src/test/ui/hrtb/hrtb-identity-fn-borrows.mir.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/hrtb-identity-fn-borrows.rs:27:5 + --> $DIR/hrtb-identity-fn-borrows.rs:17:5 | LL | let y = f.call(&x); | -- borrow of `x` occurs here diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs b/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs index e98cf4eb2ab..35b39a9a69d 100644 --- a/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs +++ b/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the `'a` in the where clause correctly links the region // of the output to the region of the input. diff --git a/src/test/ui/hrtb/hrtb-just-for-static.rs b/src/test/ui/hrtb/hrtb-just-for-static.rs index aec950f992c..88d5ce8e640 100644 --- a/src/test/ui/hrtb/hrtb-just-for-static.rs +++ b/src/test/ui/hrtb/hrtb-just-for-static.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a case where you have an impl of `Foo` for all `X` that // is being applied to `for<'a> Foo<&'a mut X>`. Issue #19730. @@ -31,7 +21,13 @@ fn give_any() { struct StaticInt; impl Foo<&'static isize> for StaticInt { } fn give_static() { - want_hrtb::() //~ ERROR `for<'a> StaticInt: Foo<&'a isize>` is not satisfied + want_hrtb::() //~ ERROR +} + +// AnyInt implements Foo<&'a isize> for any 'a, so it is a match. +impl<'a> Foo<&'a isize> for &'a u32 { } +fn give_some<'a>() { + want_hrtb::<&'a u32>() //~ ERROR } fn main() { } diff --git a/src/test/ui/hrtb/hrtb-just-for-static.stderr b/src/test/ui/hrtb/hrtb-just-for-static.stderr index 615a8b3bde5..99c87f13672 100644 --- a/src/test/ui/hrtb/hrtb-just-for-static.stderr +++ b/src/test/ui/hrtb/hrtb-just-for-static.stderr @@ -1,20 +1,22 @@ -error[E0277]: the trait bound `for<'a> StaticInt: Foo<&'a isize>` is not satisfied - --> $DIR/hrtb-just-for-static.rs:34:5 +error: implementation of `Foo` is not general enough + --> $DIR/hrtb-just-for-static.rs:24:5 | -LL | want_hrtb::() //~ ERROR `for<'a> StaticInt: Foo<&'a isize>` is not satisfied - | ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo<&'a isize>` is not implemented for `StaticInt` +LL | want_hrtb::() //~ ERROR + | ^^^^^^^^^^^^^^^^^^^^^^ | - = help: the following implementations were found: - > -note: required by `want_hrtb` - --> $DIR/hrtb-just-for-static.rs:18:1 + = note: Due to a where-clause on `want_hrtb`, + = note: `StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0` + = note: but `StaticInt` actually implements `Foo<&'1 isize>`, for some specific lifetime `'1` + +error: implementation of `Foo` is not general enough + --> $DIR/hrtb-just-for-static.rs:30:5 + | +LL | want_hrtb::<&'a u32>() //~ ERROR + | ^^^^^^^^^^^^^^^^^^^^ | -LL | / fn want_hrtb() -LL | | where T : for<'a> Foo<&'a isize> -LL | | { -LL | | } - | |_^ + = note: Due to a where-clause on `want_hrtb`, + = note: `Foo<&'0 isize>` would have to be implemented for the type `&'a u32`, for any lifetime `'0` + = note: but `Foo<&'1 isize>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.rs b/src/test/ui/hrtb/hrtb-perfect-forwarding.rs index fcfbeefced0..0094091c6bd 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.rs +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a case where you have an impl of `Foo` for all `X` that // is being applied to `for<'a> Foo<&'a mut X>`. Issue #19730. @@ -53,7 +43,7 @@ fn foo_hrtb_bar_not<'b,T>(mut t: T) // be implemented. Thus to satisfy `&mut T : for<'a> Foo<&'a // isize>`, we require `T : for<'a> Bar<&'a isize>`, but the where // clause only specifies `T : Bar<&'b isize>`. - foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T: Bar<&'a isize>` is not satisfied + foo_hrtb_bar_not(&mut t); //~ ERROR not general enough } fn foo_hrtb_bar_hrtb(mut t: T) diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr index 5e8674df053..c7be3790aa1 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr @@ -1,23 +1,12 @@ -error[E0277]: the trait bound `for<'a> T: Bar<&'a isize>` is not satisfied - --> $DIR/hrtb-perfect-forwarding.rs:56:5 +error: implementation of `Foo` is not general enough + --> $DIR/hrtb-perfect-forwarding.rs:46:5 | -LL | foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T: Bar<&'a isize>` is not satisfied - | ^^^^^^^^^^^^^^^^ the trait `for<'a> Bar<&'a isize>` is not implemented for `T` +LL | foo_hrtb_bar_not(&mut t); //~ ERROR not general enough + | ^^^^^^^^^^^^^^^^ | - = help: consider adding a `where for<'a> T: Bar<&'a isize>` bound - = note: required because of the requirements on the impl of `for<'a> Foo<&'a isize>` for `&mut T` -note: required by `foo_hrtb_bar_not` - --> $DIR/hrtb-perfect-forwarding.rs:49:1 - | -LL | / fn foo_hrtb_bar_not<'b,T>(mut t: T) -LL | | where T : for<'a> Foo<&'a isize> + Bar<&'b isize> -LL | | { -LL | | // Not OK -- The forwarding impl for `Foo` requires that `Bar` also -... | -LL | | foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T: Bar<&'a isize>` is not satisfied -LL | | } - | |_^ + = note: Due to a where-clause on `foo_hrtb_bar_not`, + = note: `&mut T` must implement `Foo<&'0 isize>`, for any lifetime `'0` + = note: but `&mut T` actually implements `Foo<&'1 isize>`, for some specific lifetime `'1` error: aborting due to previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/huge-array-simple.rs b/src/test/ui/huge-array-simple.rs index 54340cf7ac4..5fa874c1fa0 100644 --- a/src/test/ui/huge-array-simple.rs +++ b/src/test/ui/huge-array-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // FIXME (#23926): the error output is not consistent between a // self-hosted and a cross-compiled setup. Skipping for now. diff --git a/src/test/ui/huge-array.rs b/src/test/ui/huge-array.rs index 7de84802e1d..0608b23dac6 100644 --- a/src/test/ui/huge-array.rs +++ b/src/test/ui/huge-array.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:; 1518600000 fn generic(t: T) { diff --git a/src/test/ui/huge-enum.rs b/src/test/ui/huge-enum.rs index 17e20766bab..71c8fd55b23 100644 --- a/src/test/ui/huge-enum.rs +++ b/src/test/ui/huge-enum.rs @@ -1,17 +1,5 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern: Option -// normalize-stderr-test "<\[u32; \d+\]>" -> "<[u32; N]>" - -// FIXME: work properly with higher limits +// normalize-stderr-test "std::option::Option<\[u32; \d+\]>" -> "TYPE" +// normalize-stderr-test "\[u32; \d+\]" -> "TYPE" #[cfg(target_pointer_width = "32")] fn main() { diff --git a/src/test/ui/huge-enum.stderr b/src/test/ui/huge-enum.stderr index b7cf2550461..67cae3d52ed 100644 --- a/src/test/ui/huge-enum.stderr +++ b/src/test/ui/huge-enum.stderr @@ -1,4 +1,4 @@ -error: the type `std::option::Option<[u32; N]>` is too big for the current architecture +error: the type `TYPE` is too big for the current architecture error: aborting due to previous error diff --git a/src/test/ui/huge-struct.rs b/src/test/ui/huge-struct.rs index c935ad92e44..74e43cc6472 100644 --- a/src/test/ui/huge-struct.rs +++ b/src/test/ui/huge-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // normalize-stderr-test "S32" -> "SXX" // normalize-stderr-test "S1M" -> "SXX" // error-pattern: too big for the current diff --git a/src/test/ui/hygiene/arguments.rs b/src/test/ui/hygiene/arguments.rs index 958133e7ec5..f0f732f4c6f 100644 --- a/src/test/ui/hygiene/arguments.rs +++ b/src/test/ui/hygiene/arguments.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] diff --git a/src/test/ui/hygiene/arguments.stderr b/src/test/ui/hygiene/arguments.stderr index 1b0c23eff29..4cf35be22fa 100644 --- a/src/test/ui/hygiene/arguments.stderr +++ b/src/test/ui/hygiene/arguments.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `S` in this scope - --> $DIR/arguments.rs:26:8 + --> $DIR/arguments.rs:16:8 | LL | m!(S, S); //~ ERROR cannot find type `S` in this scope | ^ not found in this scope diff --git a/src/test/ui/hygiene/assoc_item_ctxt.rs b/src/test/ui/hygiene/assoc_item_ctxt.rs index e336b0df13f..65593d1d560 100644 --- a/src/test/ui/hygiene/assoc_item_ctxt.rs +++ b/src/test/ui/hygiene/assoc_item_ctxt.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] diff --git a/src/test/ui/hygiene/assoc_item_ctxt.stderr b/src/test/ui/hygiene/assoc_item_ctxt.stderr index 8b410405ae5..d89f395d8c1 100644 --- a/src/test/ui/hygiene/assoc_item_ctxt.stderr +++ b/src/test/ui/hygiene/assoc_item_ctxt.stderr @@ -1,5 +1,5 @@ error[E0407]: method `method` is not a member of trait `Tr` - --> $DIR/assoc_item_ctxt.rs:45:13 + --> $DIR/assoc_item_ctxt.rs:35:13 | LL | fn method() {} //~ ERROR method `method` is not a member of trait `Tr` | ^^^^^^^^^^^^^^ not a member of trait `Tr` @@ -8,7 +8,7 @@ LL | mac_trait_impl!(); | ------------------ in this macro invocation error[E0046]: not all trait items implemented, missing: `method` - --> $DIR/assoc_item_ctxt.rs:44:9 + --> $DIR/assoc_item_ctxt.rs:34:9 | LL | fn method(); | ------------ `method` from trait diff --git a/src/test/ui/hygiene/assoc_ty_bindings.rs b/src/test/ui/hygiene/assoc_ty_bindings.rs index bdf591ba7ab..eb0ca6a7d5f 100644 --- a/src/test/ui/hygiene/assoc_ty_bindings.rs +++ b/src/test/ui/hygiene/assoc_ty_bindings.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-pretty pretty-printing is unhygienic #![feature(decl_macro, associated_type_defaults)] diff --git a/src/test/ui/hygiene/auxiliary/intercrate.rs b/src/test/ui/hygiene/auxiliary/intercrate.rs index f917fabbe0c..10d399ba54e 100644 --- a/src/test/ui/hygiene/auxiliary/intercrate.rs +++ b/src/test/ui/hygiene/auxiliary/intercrate.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] pub mod foo { diff --git a/src/test/ui/hygiene/auxiliary/local_inner_macros.rs b/src/test/ui/hygiene/auxiliary/local_inner_macros.rs index caa2903cc70..4296ae2fddf 100644 --- a/src/test/ui/hygiene/auxiliary/local_inner_macros.rs +++ b/src/test/ui/hygiene/auxiliary/local_inner_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! helper1 { () => ( struct S; ) diff --git a/src/test/ui/hygiene/auxiliary/transparent-basic.rs b/src/test/ui/hygiene/auxiliary/transparent-basic.rs index ba65c5f4da8..0d045d09d2c 100644 --- a/src/test/ui/hygiene/auxiliary/transparent-basic.rs +++ b/src/test/ui/hygiene/auxiliary/transparent-basic.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro, rustc_attrs)] #[rustc_transparent_macro] diff --git a/src/test/ui/hygiene/dollar-crate-modern.rs b/src/test/ui/hygiene/dollar-crate-modern.rs index 6e536ab1422..380ad20486e 100644 --- a/src/test/ui/hygiene/dollar-crate-modern.rs +++ b/src/test/ui/hygiene/dollar-crate-modern.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure `$crate` and `crate` work in for basic cases of nested macros. // compile-pass diff --git a/src/test/ui/hygiene/dollar-crate-modern.stderr b/src/test/ui/hygiene/dollar-crate-modern.stderr index 5fa7d8eda1d..69bbc52ee0d 100644 --- a/src/test/ui/hygiene/dollar-crate-modern.stderr +++ b/src/test/ui/hygiene/dollar-crate-modern.stderr @@ -1,5 +1,5 @@ warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/dollar-crate-modern.rs:16:24 + --> $DIR/dollar-crate-modern.rs:6:24 | LL | #![feature(decl_macro, crate_in_paths)] | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/hygiene/expansion-info-reset.rs b/src/test/ui/hygiene/expansion-info-reset.rs index d80c1129b29..5c384c4ada9 100644 --- a/src/test/ui/hygiene/expansion-info-reset.rs +++ b/src/test/ui/hygiene/expansion-info-reset.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // FIXME: Investigate why expansion info for a single expansion id is reset from // `MacroBang(format_args)` to `MacroAttribute(derive(Clone))` (issue #52363). diff --git a/src/test/ui/hygiene/expansion-info-reset.stderr b/src/test/ui/hygiene/expansion-info-reset.stderr index 02a7b0d1b02..9dd954b16cd 100644 --- a/src/test/ui/hygiene/expansion-info-reset.stderr +++ b/src/test/ui/hygiene/expansion-info-reset.stderr @@ -1,5 +1,5 @@ error: format argument must be a string literal - --> $DIR/expansion-info-reset.rs:15:18 + --> $DIR/expansion-info-reset.rs:5:18 | LL | format_args!({ #[derive(Clone)] struct S; }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/hygiene/fields-definition.rs b/src/test/ui/hygiene/fields-definition.rs index c92bf55a723..173c357bd69 100644 --- a/src/test/ui/hygiene/fields-definition.rs +++ b/src/test/ui/hygiene/fields-definition.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] macro modern($a: ident) { diff --git a/src/test/ui/hygiene/fields-definition.stderr b/src/test/ui/hygiene/fields-definition.stderr index 73f524b7d2a..d6d25d7fa0c 100644 --- a/src/test/ui/hygiene/fields-definition.stderr +++ b/src/test/ui/hygiene/fields-definition.stderr @@ -1,5 +1,5 @@ error[E0124]: field `a` is already declared - --> $DIR/fields-definition.rs:24:17 + --> $DIR/fields-definition.rs:14:17 | LL | a: u8, | ----- `a` first declared here diff --git a/src/test/ui/hygiene/fields-move.nll.stderr b/src/test/ui/hygiene/fields-move.nll.stderr index 9b25a865f92..f72a52e2535 100644 --- a/src/test/ui/hygiene/fields-move.nll.stderr +++ b/src/test/ui/hygiene/fields-move.nll.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `foo.x` - --> $DIR/fields-move.rs:28:9 + --> $DIR/fields-move.rs:18:9 | LL | $foo.x //~ ERROR use of moved value: `foo.x` | ^^^^^^ value used here after move @@ -12,7 +12,7 @@ LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved val = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait error[E0382]: use of moved value: `foo.x` - --> $DIR/fields-move.rs:38:42 + --> $DIR/fields-move.rs:28:42 | LL | $foo.x | ------ value moved here @@ -23,7 +23,7 @@ LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved val = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait error[E0382]: use of moved value: `foo.x` - --> $DIR/fields-move.rs:39:42 + --> $DIR/fields-move.rs:29:42 | LL | $foo.x //~ ERROR use of moved value: `foo.x` | ------ value moved here diff --git a/src/test/ui/hygiene/fields-move.rs b/src/test/ui/hygiene/fields-move.rs index a6e3b2b2d8b..401ad97e3b8 100644 --- a/src/test/ui/hygiene/fields-move.rs +++ b/src/test/ui/hygiene/fields-move.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // issue #46314 #![feature(decl_macro)] diff --git a/src/test/ui/hygiene/fields-move.stderr b/src/test/ui/hygiene/fields-move.stderr index ba9de09f9d2..a5eeadff4dc 100644 --- a/src/test/ui/hygiene/fields-move.stderr +++ b/src/test/ui/hygiene/fields-move.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `foo.x` - --> $DIR/fields-move.rs:38:42 + --> $DIR/fields-move.rs:28:42 | LL | $foo.x | ------ value moved here @@ -10,7 +10,7 @@ LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved val = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait error[E0382]: use of moved value: `foo.x` - --> $DIR/fields-move.rs:28:9 + --> $DIR/fields-move.rs:18:9 | LL | $foo.x | ------ value moved here @@ -24,7 +24,7 @@ LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved val = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait error[E0382]: use of moved value: `foo.x` - --> $DIR/fields-move.rs:39:42 + --> $DIR/fields-move.rs:29:42 | LL | $foo.x | ------ value moved here diff --git a/src/test/ui/hygiene/fields-numeric-borrowck.nll.stderr b/src/test/ui/hygiene/fields-numeric-borrowck.nll.stderr index 4130ad7639f..fb90825c0d9 100644 --- a/src/test/ui/hygiene/fields-numeric-borrowck.nll.stderr +++ b/src/test/ui/hygiene/fields-numeric-borrowck.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `s.0` as mutable more than once at a time - --> $DIR/fields-numeric-borrowck.rs:16:16 + --> $DIR/fields-numeric-borrowck.rs:6:16 | LL | let borrow1 = &mut s.0; | -------- first mutable borrow occurs here diff --git a/src/test/ui/hygiene/fields-numeric-borrowck.rs b/src/test/ui/hygiene/fields-numeric-borrowck.rs index 7e14c811a30..9536babc25e 100644 --- a/src/test/ui/hygiene/fields-numeric-borrowck.rs +++ b/src/test/ui/hygiene/fields-numeric-borrowck.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S(u8); fn main() { diff --git a/src/test/ui/hygiene/fields-numeric-borrowck.stderr b/src/test/ui/hygiene/fields-numeric-borrowck.stderr index d0156cfa671..11b5fd70aff 100644 --- a/src/test/ui/hygiene/fields-numeric-borrowck.stderr +++ b/src/test/ui/hygiene/fields-numeric-borrowck.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `s.0` as mutable more than once at a time - --> $DIR/fields-numeric-borrowck.rs:16:16 + --> $DIR/fields-numeric-borrowck.rs:6:16 | LL | let borrow1 = &mut s.0; | --- first mutable borrow occurs here diff --git a/src/test/ui/hygiene/fields.rs b/src/test/ui/hygiene/fields.rs index 64217770b13..597019cb1ee 100644 --- a/src/test/ui/hygiene/fields.rs +++ b/src/test/ui/hygiene/fields.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] diff --git a/src/test/ui/hygiene/fields.stderr b/src/test/ui/hygiene/fields.stderr index c4be1834c04..6d5b60fcb5b 100644 --- a/src/test/ui/hygiene/fields.stderr +++ b/src/test/ui/hygiene/fields.stderr @@ -1,5 +1,5 @@ error: type `foo::S` is private - --> $DIR/fields.rs:25:17 + --> $DIR/fields.rs:15:17 | LL | let s = S { x: 0 }; //~ ERROR type `foo::S` is private | ^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let s = foo::m!(S, x); | ------------- in this macro invocation error: type `foo::S` is private - --> $DIR/fields.rs:26:17 + --> $DIR/fields.rs:16:17 | LL | let _ = s.x; //~ ERROR type `foo::S` is private | ^ @@ -17,7 +17,7 @@ LL | let s = foo::m!(S, x); | ------------- in this macro invocation error: type `foo::T` is private - --> $DIR/fields.rs:28:17 + --> $DIR/fields.rs:18:17 | LL | let t = T(0); //~ ERROR type `foo::T` is private | ^^^^ @@ -26,7 +26,7 @@ LL | let s = foo::m!(S, x); | ------------- in this macro invocation error: type `foo::T` is private - --> $DIR/fields.rs:29:17 + --> $DIR/fields.rs:19:17 | LL | let _ = t.0; //~ ERROR type `foo::T` is private | ^ diff --git a/src/test/ui/hygiene/for-loop.rs b/src/test/ui/hygiene/for-loop.rs index d9386421970..2e5ae43a9ce 100644 --- a/src/test/ui/hygiene/for-loop.rs +++ b/src/test/ui/hygiene/for-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // for-loops are expanded in the front end, and use an `iter` ident in their expansion. Check that // `iter` is not accessible inside the for loop. diff --git a/src/test/ui/hygiene/for-loop.stderr b/src/test/ui/hygiene/for-loop.stderr index 7e606b2358c..755bf3e55f7 100644 --- a/src/test/ui/hygiene/for-loop.stderr +++ b/src/test/ui/hygiene/for-loop.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `iter` in this scope - --> $DIR/for-loop.rs:16:9 + --> $DIR/for-loop.rs:6:9 | LL | iter.next(); //~ ERROR cannot find value `iter` in this scope | ^^^^ not found in this scope diff --git a/src/test/ui/hygiene/generate-mod.rs b/src/test/ui/hygiene/generate-mod.rs index efb3696cf85..089d74f123e 100644 --- a/src/test/ui/hygiene/generate-mod.rs +++ b/src/test/ui/hygiene/generate-mod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is an equivalent of issue #50504, but for declarative macros. #![feature(decl_macro, rustc_attrs)] diff --git a/src/test/ui/hygiene/generate-mod.stderr b/src/test/ui/hygiene/generate-mod.stderr index f86444bae77..d9342d91159 100644 --- a/src/test/ui/hygiene/generate-mod.stderr +++ b/src/test/ui/hygiene/generate-mod.stderr @@ -1,17 +1,17 @@ error[E0412]: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:45:13 + --> $DIR/generate-mod.rs:35:13 | LL | genmod!(FromOutside, Outer); //~ ERROR cannot find type `FromOutside` in this scope | ^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `Outer` in this scope - --> $DIR/generate-mod.rs:45:26 + --> $DIR/generate-mod.rs:35:26 | LL | genmod!(FromOutside, Outer); //~ ERROR cannot find type `FromOutside` in this scope | ^^^^^ not found in this scope error[E0412]: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:29:18 + --> $DIR/generate-mod.rs:19:18 | LL | type A = FromOutside; //~ ERROR cannot find type `FromOutside` in this scope | ^^^^^^^^^^^ not found in this scope @@ -20,7 +20,7 @@ LL | genmod_transparent!(); | ---------------------- in this macro invocation error[E0412]: cannot find type `Outer` in this scope - --> $DIR/generate-mod.rs:30:22 + --> $DIR/generate-mod.rs:20:22 | LL | type Inner = Outer; //~ ERROR cannot find type `Outer` in this scope | ^^^^^ not found in this scope @@ -29,7 +29,7 @@ LL | genmod_transparent!(); | ---------------------- in this macro invocation error[E0412]: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:38:18 + --> $DIR/generate-mod.rs:28:18 | LL | type A = FromOutside; //~ ERROR cannot find type `FromOutside` in this scope | ^^^^^^^^^^^ not found in this scope @@ -38,7 +38,7 @@ LL | genmod_legacy!(); | ----------------- in this macro invocation error[E0412]: cannot find type `Outer` in this scope - --> $DIR/generate-mod.rs:39:22 + --> $DIR/generate-mod.rs:29:22 | LL | type Inner = Outer; //~ ERROR cannot find type `Outer` in this scope | ^^^^^ not found in this scope diff --git a/src/test/ui/hygiene/globs.rs b/src/test/ui/hygiene/globs.rs index 9785ce6c004..a3f466ef435 100644 --- a/src/test/ui/hygiene/globs.rs +++ b/src/test/ui/hygiene/globs.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] mod foo { diff --git a/src/test/ui/hygiene/globs.stderr b/src/test/ui/hygiene/globs.stderr index 7df2e31f9a7..ad62b976251 100644 --- a/src/test/ui/hygiene/globs.stderr +++ b/src/test/ui/hygiene/globs.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find function `f` in this scope - --> $DIR/globs.rs:32:9 + --> $DIR/globs.rs:22:9 | LL | f(); //~ ERROR cannot find function `f` in this scope | ^ not found in this scope @@ -13,7 +13,7 @@ LL | use foo::f; | error[E0425]: cannot find function `g` in this scope - --> $DIR/globs.rs:25:5 + --> $DIR/globs.rs:15:5 | LL | g(); //~ ERROR cannot find function `g` in this scope | ^ not found in this scope @@ -37,7 +37,7 @@ LL | use foo::test::g; and 2 other candidates error[E0425]: cannot find function `f` in this scope - --> $DIR/globs.rs:71:12 + --> $DIR/globs.rs:61:12 | LL | n!(f); | ------ in this macro invocation @@ -46,7 +46,7 @@ LL | n!(f); //~ ERROR cannot find function `f` in this scope | ^ not found in this scope error[E0425]: cannot find function `f` in this scope - --> $DIR/globs.rs:75:17 + --> $DIR/globs.rs:65:17 | LL | n!(f); | ------ in this macro invocation diff --git a/src/test/ui/hygiene/hygienic-label-1.rs b/src/test/ui/hygiene/hygienic-label-1.rs index 305b43402da..66361eec21a 100644 --- a/src/test/ui/hygiene/hygienic-label-1.rs +++ b/src/test/ui/hygiene/hygienic-label-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo { () => { break 'x; } //~ ERROR use of undeclared label `'x` } diff --git a/src/test/ui/hygiene/hygienic-label-1.stderr b/src/test/ui/hygiene/hygienic-label-1.stderr index 051466b183d..9a55965d85f 100644 --- a/src/test/ui/hygiene/hygienic-label-1.stderr +++ b/src/test/ui/hygiene/hygienic-label-1.stderr @@ -1,5 +1,5 @@ error[E0426]: use of undeclared label `'x` - --> $DIR/hygienic-label-1.rs:12:19 + --> $DIR/hygienic-label-1.rs:2:19 | LL | () => { break 'x; } //~ ERROR use of undeclared label `'x` | ^^ did you mean `'x`? diff --git a/src/test/ui/hygiene/hygienic-label-2.rs b/src/test/ui/hygiene/hygienic-label-2.rs index 24194d7bbe9..43e01a93477 100644 --- a/src/test/ui/hygiene/hygienic-label-2.rs +++ b/src/test/ui/hygiene/hygienic-label-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo { ($e: expr) => { 'x: loop { $e } } } diff --git a/src/test/ui/hygiene/hygienic-label-2.stderr b/src/test/ui/hygiene/hygienic-label-2.stderr index 081c1c7e69e..b7cb91d94f1 100644 --- a/src/test/ui/hygiene/hygienic-label-2.stderr +++ b/src/test/ui/hygiene/hygienic-label-2.stderr @@ -1,5 +1,5 @@ error[E0426]: use of undeclared label `'x` - --> $DIR/hygienic-label-2.rs:16:16 + --> $DIR/hygienic-label-2.rs:6:16 | LL | foo!(break 'x); //~ ERROR use of undeclared label `'x` | ^^ did you mean `'x`? diff --git a/src/test/ui/hygiene/hygienic-label-3.rs b/src/test/ui/hygiene/hygienic-label-3.rs index b107b71024d..a81eb842259 100644 --- a/src/test/ui/hygiene/hygienic-label-3.rs +++ b/src/test/ui/hygiene/hygienic-label-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo { () => { break 'x; } //~ ERROR use of undeclared label `'x` } diff --git a/src/test/ui/hygiene/hygienic-label-3.stderr b/src/test/ui/hygiene/hygienic-label-3.stderr index e5593df49f4..227a39512b7 100644 --- a/src/test/ui/hygiene/hygienic-label-3.stderr +++ b/src/test/ui/hygiene/hygienic-label-3.stderr @@ -1,5 +1,5 @@ error[E0426]: use of undeclared label `'x` - --> $DIR/hygienic-label-3.rs:12:19 + --> $DIR/hygienic-label-3.rs:2:19 | LL | () => { break 'x; } //~ ERROR use of undeclared label `'x` | ^^ did you mean `'x`? diff --git a/src/test/ui/hygiene/hygienic-label-4.rs b/src/test/ui/hygiene/hygienic-label-4.rs index 5bfcb6360e4..a7e1f0e78b7 100644 --- a/src/test/ui/hygiene/hygienic-label-4.rs +++ b/src/test/ui/hygiene/hygienic-label-4.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo { ($e: expr) => { 'x: for _ in 0..1 { $e } } } diff --git a/src/test/ui/hygiene/hygienic-label-4.stderr b/src/test/ui/hygiene/hygienic-label-4.stderr index 60351386a0b..4f9a68ca831 100644 --- a/src/test/ui/hygiene/hygienic-label-4.stderr +++ b/src/test/ui/hygiene/hygienic-label-4.stderr @@ -1,5 +1,5 @@ error[E0426]: use of undeclared label `'x` - --> $DIR/hygienic-label-4.rs:16:16 + --> $DIR/hygienic-label-4.rs:6:16 | LL | foo!(break 'x); //~ ERROR use of undeclared label `'x` | ^^ did you mean `'x`? diff --git a/src/test/ui/hygiene/impl_items.rs b/src/test/ui/hygiene/impl_items.rs index cdba559445d..37794c6e077 100644 --- a/src/test/ui/hygiene/impl_items.rs +++ b/src/test/ui/hygiene/impl_items.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-pretty pretty-printing is unhygienic #![feature(decl_macro)] diff --git a/src/test/ui/hygiene/impl_items.stderr b/src/test/ui/hygiene/impl_items.stderr index dbcf53554cf..cb3705e5513 100644 --- a/src/test/ui/hygiene/impl_items.stderr +++ b/src/test/ui/hygiene/impl_items.stderr @@ -1,5 +1,5 @@ error: type `for<'r> fn(&'r foo::S) {foo::S::f}` is private - --> $DIR/impl_items.rs:22:23 + --> $DIR/impl_items.rs:12:23 | LL | let _: () = S.f(); //~ ERROR type `for<'r> fn(&'r foo::S) {foo::S::f}` is private | ^ diff --git a/src/test/ui/hygiene/intercrate.rs b/src/test/ui/hygiene/intercrate.rs index f27eed59b8f..2acbc893cf5 100644 --- a/src/test/ui/hygiene/intercrate.rs +++ b/src/test/ui/hygiene/intercrate.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-pretty pretty-printing is unhygienic // aux-build:intercrate.rs diff --git a/src/test/ui/hygiene/intercrate.stderr b/src/test/ui/hygiene/intercrate.stderr index b0792412aa0..30a5570b2ad 100644 --- a/src/test/ui/hygiene/intercrate.stderr +++ b/src/test/ui/hygiene/intercrate.stderr @@ -1,5 +1,5 @@ error: type `fn() -> u32 {intercrate::foo::bar::f}` is private - --> $DIR/intercrate.rs:20:16 + --> $DIR/intercrate.rs:10:16 | LL | assert_eq!(intercrate::foo::m!(), 1); | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/hygiene/local_inner_macros.rs b/src/test/ui/hygiene/local_inner_macros.rs index 92e10c190aa..f4c1a931f68 100644 --- a/src/test/ui/hygiene/local_inner_macros.rs +++ b/src/test/ui/hygiene/local_inner_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // aux-build:local_inner_macros.rs diff --git a/src/test/ui/hygiene/nested_macro_privacy.rs b/src/test/ui/hygiene/nested_macro_privacy.rs index 6612359649c..bee90e2bb88 100644 --- a/src/test/ui/hygiene/nested_macro_privacy.rs +++ b/src/test/ui/hygiene/nested_macro_privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] macro n($foo:ident, $S:ident, $i:ident, $m:ident) { diff --git a/src/test/ui/hygiene/nested_macro_privacy.stderr b/src/test/ui/hygiene/nested_macro_privacy.stderr index 1179065b94c..4fca86d521b 100644 --- a/src/test/ui/hygiene/nested_macro_privacy.stderr +++ b/src/test/ui/hygiene/nested_macro_privacy.stderr @@ -1,5 +1,5 @@ error[E0616]: field `i` of struct `foo::S` is private - --> $DIR/nested_macro_privacy.rs:25:5 + --> $DIR/nested_macro_privacy.rs:15:5 | LL | S::default().i; //~ ERROR field `i` of struct `foo::S` is private | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/hygiene/no_implicit_prelude.rs b/src/test/ui/hygiene/no_implicit_prelude.rs index 5b6041945ab..20da78f08dd 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.rs +++ b/src/test/ui/hygiene/no_implicit_prelude.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] mod foo { diff --git a/src/test/ui/hygiene/no_implicit_prelude.stderr b/src/test/ui/hygiene/no_implicit_prelude.stderr index 73a63a2c7f5..7c9404cee2b 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.stderr +++ b/src/test/ui/hygiene/no_implicit_prelude.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: use of undeclared type or module `Vec` - --> $DIR/no_implicit_prelude.rs:21:9 + --> $DIR/no_implicit_prelude.rs:11:9 | LL | fn f() { ::bar::m!(); } | ------------ in this macro invocation @@ -8,7 +8,7 @@ LL | Vec::new(); //~ ERROR failed to resolve | ^^^ use of undeclared type or module `Vec` error[E0599]: no method named `clone` found for type `()` in the current scope - --> $DIR/no_implicit_prelude.rs:22:12 + --> $DIR/no_implicit_prelude.rs:12:12 | LL | fn f() { ::bar::m!(); } | ------------ in this macro invocation diff --git a/src/test/ui/hygiene/pattern-macro.rs b/src/test/ui/hygiene/pattern-macro.rs index 26d411c9154..e5d6a3aa1a0 100644 --- a/src/test/ui/hygiene/pattern-macro.rs +++ b/src/test/ui/hygiene/pattern-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo { () => ( x ) } fn main() { diff --git a/src/test/ui/hygiene/pattern-macro.stderr b/src/test/ui/hygiene/pattern-macro.stderr index b26084db02e..8a170dccd5c 100644 --- a/src/test/ui/hygiene/pattern-macro.stderr +++ b/src/test/ui/hygiene/pattern-macro.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `x` in this scope - --> $DIR/pattern-macro.rs:15:5 + --> $DIR/pattern-macro.rs:5:5 | LL | x + 1; //~ ERROR cannot find value `x` in this scope | ^ not found in this scope diff --git a/src/test/ui/hygiene/privacy.rs b/src/test/ui/hygiene/privacy.rs index 987cad187d4..78d2555539d 100644 --- a/src/test/ui/hygiene/privacy.rs +++ b/src/test/ui/hygiene/privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] mod foo { diff --git a/src/test/ui/hygiene/privacy.stderr b/src/test/ui/hygiene/privacy.stderr index b93d4da3a86..bc056c7cf3c 100644 --- a/src/test/ui/hygiene/privacy.stderr +++ b/src/test/ui/hygiene/privacy.stderr @@ -1,5 +1,5 @@ error[E0603]: function `f` is private - --> $DIR/privacy.rs:26:14 + --> $DIR/privacy.rs:16:14 | LL | foo::f() //~ ERROR `f` is private | ^ diff --git a/src/test/ui/hygiene/trait_items.rs b/src/test/ui/hygiene/trait_items.rs index 3bd19cbc0ac..a116c5b38ce 100644 --- a/src/test/ui/hygiene/trait_items.rs +++ b/src/test/ui/hygiene/trait_items.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] mod foo { diff --git a/src/test/ui/hygiene/trait_items.stderr b/src/test/ui/hygiene/trait_items.stderr index 1b2975bcf1c..677bd08b6af 100644 --- a/src/test/ui/hygiene/trait_items.stderr +++ b/src/test/ui/hygiene/trait_items.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `f` found for type `()` in the current scope - --> $DIR/trait_items.rs:27:24 + --> $DIR/trait_items.rs:17:24 | LL | fn f() { ::baz::m!(); } | ------------ in this macro invocation diff --git a/src/test/ui/hygiene/transparent-basic.rs b/src/test/ui/hygiene/transparent-basic.rs index 81ece1f11bc..0a86234fdba 100644 --- a/src/test/ui/hygiene/transparent-basic.rs +++ b/src/test/ui/hygiene/transparent-basic.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // aux-build:transparent-basic.rs diff --git a/src/test/ui/if-else-type-mismatch.rs b/src/test/ui/if-else-type-mismatch.rs new file mode 100644 index 00000000000..583c3d0b765 --- /dev/null +++ b/src/test/ui/if-else-type-mismatch.rs @@ -0,0 +1,46 @@ +fn main() { + let _ = if true { + 1i32 + } else { + 2u32 + }; + //~^^ ERROR if and else have incompatible types + let _ = if true { 42i32 } else { 42u32 }; + //~^ ERROR if and else have incompatible types + let _ = if true { + 3u32; + } else { + 4u32 + }; + //~^^ ERROR if and else have incompatible types + let _ = if true { + 5u32 + } else { + 6u32; + }; + //~^^ ERROR if and else have incompatible types + let _ = if true { + 7i32; + } else { + 8u32 + }; + //~^^ ERROR if and else have incompatible types + let _ = if true { + 9i32 + } else { + 10u32; + }; + //~^^ ERROR if and else have incompatible types + let _ = if true { + + } else { + 11u32 + }; + //~^^ ERROR if and else have incompatible types + let _ = if true { + 12i32 + } else { + + }; + //~^^^ ERROR if and else have incompatible types +} diff --git a/src/test/ui/if-else-type-mismatch.stderr b/src/test/ui/if-else-type-mismatch.stderr new file mode 100644 index 00000000000..b418c961189 --- /dev/null +++ b/src/test/ui/if-else-type-mismatch.stderr @@ -0,0 +1,130 @@ +error[E0308]: if and else have incompatible types + --> $DIR/if-else-type-mismatch.rs:5:9 + | +LL | let _ = if true { + | _____________- +LL | | 1i32 + | | ---- expected because of this +LL | | } else { +LL | | 2u32 + | | ^^^^ expected i32, found u32 +LL | | }; + | |_____- if and else have incompatible types + | + = note: expected type `i32` + found type `u32` + +error[E0308]: if and else have incompatible types + --> $DIR/if-else-type-mismatch.rs:8:38 + | +LL | let _ = if true { 42i32 } else { 42u32 }; + | ----- ^^^^^ expected i32, found u32 + | | + | expected because of this + | + = note: expected type `i32` + found type `u32` + +error[E0308]: if and else have incompatible types + --> $DIR/if-else-type-mismatch.rs:13:9 + | +LL | let _ = if true { + | _____________- +LL | | 3u32; + | | ----- + | | | | + | | | help: consider removing this semicolon + | | expected because of this +LL | | } else { +LL | | 4u32 + | | ^^^^ expected (), found u32 +LL | | }; + | |_____- if and else have incompatible types + | + = note: expected type `()` + found type `u32` + +error[E0308]: if and else have incompatible types + --> $DIR/if-else-type-mismatch.rs:19:9 + | +LL | let _ = if true { + | _____________- +LL | | 5u32 + | | ---- expected because of this +LL | | } else { +LL | | 6u32; + | | ^^^^- + | | | | + | | | help: consider removing this semicolon + | | expected u32, found () +LL | | }; + | |_____- if and else have incompatible types + | + = note: expected type `u32` + found type `()` + +error[E0308]: if and else have incompatible types + --> $DIR/if-else-type-mismatch.rs:25:9 + | +LL | let _ = if true { + | _____________- +LL | | 7i32; + | | ----- expected because of this +LL | | } else { +LL | | 8u32 + | | ^^^^ expected (), found u32 +LL | | }; + | |_____- if and else have incompatible types + | + = note: expected type `()` + found type `u32` + +error[E0308]: if and else have incompatible types + --> $DIR/if-else-type-mismatch.rs:31:9 + | +LL | let _ = if true { + | _____________- +LL | | 9i32 + | | ---- expected because of this +LL | | } else { +LL | | 10u32; + | | ^^^^^^ expected i32, found () +LL | | }; + | |_____- if and else have incompatible types + | + = note: expected type `i32` + found type `()` + +error[E0308]: if and else have incompatible types + --> $DIR/if-else-type-mismatch.rs:37:9 + | +LL | let _ = if true { + | _____________________- +LL | | +LL | | } else { + | |_____- expected because of this +LL | 11u32 + | ^^^^^ expected (), found u32 + | + = note: expected type `()` + found type `u32` + +error[E0308]: if and else have incompatible types + --> $DIR/if-else-type-mismatch.rs:42:12 + | +LL | let _ = if true { + | ------- if and else have incompatible types +LL | 12i32 + | ----- expected because of this +LL | } else { + | ____________^ +LL | | +LL | | }; + | |_____^ expected i32, found () + | + = note: expected type `i32` + found type `()` + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/if/if-branch-types.rs b/src/test/ui/if/if-branch-types.rs index ca9803f66b2..b79a49eb5de 100644 --- a/src/test/ui/if/if-branch-types.rs +++ b/src/test/ui/if/if-branch-types.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = if true { 10i32 } else { 10u32 }; //~^ ERROR if and else have incompatible types diff --git a/src/test/ui/if/if-branch-types.stderr b/src/test/ui/if/if-branch-types.stderr index cefd94dc99b..74b925f72ff 100644 --- a/src/test/ui/if/if-branch-types.stderr +++ b/src/test/ui/if/if-branch-types.stderr @@ -1,8 +1,10 @@ error[E0308]: if and else have incompatible types - --> $DIR/if-branch-types.rs:12:13 + --> $DIR/if-branch-types.rs:2:38 | LL | let x = if true { 10i32 } else { 10u32 }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found u32 + | ----- ^^^^^ expected i32, found u32 + | | + | expected because of this | = note: expected type `i32` found type `u32` diff --git a/src/test/ui/if/if-let-arm-types.rs b/src/test/ui/if/if-let-arm-types.rs index 331fdc444ca..749c089ae97 100644 --- a/src/test/ui/if/if-let-arm-types.rs +++ b/src/test/ui/if/if-let-arm-types.rs @@ -1,16 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { if let Some(b) = None { //~ ERROR: `if let` arms have incompatible types - //~^ expected (), found integral variable + //~^ expected (), found integer //~| expected type `()` //~| found type `{integer}` () diff --git a/src/test/ui/if/if-let-arm-types.stderr b/src/test/ui/if/if-let-arm-types.stderr index 2e6b71dadf1..fcf9e4695f6 100644 --- a/src/test/ui/if/if-let-arm-types.stderr +++ b/src/test/ui/if/if-let-arm-types.stderr @@ -1,19 +1,19 @@ error[E0308]: `if let` arms have incompatible types - --> $DIR/if-let-arm-types.rs:12:5 + --> $DIR/if-let-arm-types.rs:2:5 | LL | / if let Some(b) = None { //~ ERROR: `if let` arms have incompatible types -LL | | //~^ expected (), found integral variable +LL | | //~^ expected (), found integer LL | | //~| expected type `()` LL | | //~| found type `{integer}` ... | LL | | 1 LL | | }; - | |_____^ expected (), found integral variable + | |_____^ expected (), found integer | = note: expected type `()` found type `{integer}` note: `if let` arm with an incompatible type - --> $DIR/if-let-arm-types.rs:17:12 + --> $DIR/if-let-arm-types.rs:7:12 | LL | } else { | ____________^ diff --git a/src/test/ui/if/if-let.rs b/src/test/ui/if/if-let.rs index 1e9144910b0..741685fe9b6 100644 --- a/src/test/ui/if/if-let.rs +++ b/src/test/ui/if/if-let.rs @@ -1,12 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// compile-pass fn macros() { macro_rules! foo{ @@ -20,20 +12,20 @@ fn macros() { }} } - foo!(a, 1, { //~ ERROR irrefutable if-let + foo!(a, 1, { //~ WARN irrefutable if-let println!("irrefutable pattern"); }); - bar!(a, 1, { //~ ERROR irrefutable if-let + bar!(a, 1, { //~ WARN irrefutable if-let println!("irrefutable pattern"); }); } pub fn main() { - if let a = 1 { //~ ERROR irrefutable if-let + if let a = 1 { //~ WARN irrefutable if-let println!("irrefutable pattern"); } - if let a = 1 { //~ ERROR irrefutable if-let + if let a = 1 { //~ WARN irrefutable if-let println!("irrefutable pattern"); } else if true { println!("else-if in irrefutable if-let"); @@ -43,13 +35,13 @@ pub fn main() { if let 1 = 2 { println!("refutable pattern"); - } else if let a = 1 { //~ ERROR irrefutable if-let + } else if let a = 1 { //~ WARN irrefutable if-let println!("irrefutable pattern"); } if true { println!("if"); - } else if let a = 1 { //~ ERROR irrefutable if-let + } else if let a = 1 { //~ WARN irrefutable if-let println!("irrefutable pattern"); } } diff --git a/src/test/ui/if/if-let.stderr b/src/test/ui/if/if-let.stderr index de8d6feb3c4..b2a104bfacf 100644 --- a/src/test/ui/if/if-let.stderr +++ b/src/test/ui/if/if-let.stderr @@ -1,39 +1,62 @@ -error[E0162]: irrefutable if-let pattern - --> $DIR/if-let.rs:23:10 +warning: irrefutable if-let pattern + --> $DIR/if-let.rs:6:13 | -LL | foo!(a, 1, { //~ ERROR irrefutable if-let - | ^ irrefutable pattern - -error[E0162]: irrefutable if-let pattern - --> $DIR/if-let.rs:26:10 +LL | if let $p = $e $b + | ^^ +... +LL | / foo!(a, 1, { //~ WARN irrefutable if-let +LL | | println!("irrefutable pattern"); +LL | | }); + | |_______- in this macro invocation | -LL | bar!(a, 1, { //~ ERROR irrefutable if-let - | ^ irrefutable pattern + = note: #[warn(irrefutable_let_patterns)] on by default -error[E0162]: irrefutable if-let pattern - --> $DIR/if-let.rs:32:12 +warning: irrefutable if-let pattern + --> $DIR/if-let.rs:6:13 | -LL | if let a = 1 { //~ ERROR irrefutable if-let - | ^ irrefutable pattern +LL | if let $p = $e $b + | ^^ +... +LL | / bar!(a, 1, { //~ WARN irrefutable if-let +LL | | println!("irrefutable pattern"); +LL | | }); + | |_______- in this macro invocation -error[E0162]: irrefutable if-let pattern - --> $DIR/if-let.rs:36:12 +warning: irrefutable if-let pattern + --> $DIR/if-let.rs:24:5 | -LL | if let a = 1 { //~ ERROR irrefutable if-let - | ^ irrefutable pattern +LL | / if let a = 1 { //~ WARN irrefutable if-let +LL | | println!("irrefutable pattern"); +LL | | } + | |_____^ -error[E0162]: irrefutable if-let pattern - --> $DIR/if-let.rs:46:19 +warning: irrefutable if-let pattern + --> $DIR/if-let.rs:28:5 | -LL | } else if let a = 1 { //~ ERROR irrefutable if-let - | ^ irrefutable pattern +LL | / if let a = 1 { //~ WARN irrefutable if-let +LL | | println!("irrefutable pattern"); +LL | | } else if true { +LL | | println!("else-if in irrefutable if-let"); +LL | | } else { +LL | | println!("else in irrefutable if-let"); +LL | | } + | |_____^ -error[E0162]: irrefutable if-let pattern - --> $DIR/if-let.rs:52:19 +warning: irrefutable if-let pattern + --> $DIR/if-let.rs:38:12 | -LL | } else if let a = 1 { //~ ERROR irrefutable if-let - | ^ irrefutable pattern +LL | } else if let a = 1 { //~ WARN irrefutable if-let + | ____________^ +LL | | println!("irrefutable pattern"); +LL | | } + | |_____^ -error: aborting due to 6 previous errors +warning: irrefutable if-let pattern + --> $DIR/if-let.rs:44:12 + | +LL | } else if let a = 1 { //~ WARN irrefutable if-let + | ____________^ +LL | | println!("irrefutable pattern"); +LL | | } + | |_____^ -For more information about this error, try `rustc --explain E0162`. diff --git a/src/test/ui/if/if-loop.rs b/src/test/ui/if/if-loop.rs index a52bb7f8a28..c799df23800 100644 --- a/src/test/ui/if/if-loop.rs +++ b/src/test/ui/if/if-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(warnings)] diff --git a/src/test/ui/if/if-typeck.rs b/src/test/ui/if/if-typeck.rs index d5d7d2005be..d8c262bd6b3 100644 --- a/src/test/ui/if/if-typeck.rs +++ b/src/test/ui/if/if-typeck.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:mismatched types // issue #513 diff --git a/src/test/ui/if/if-typeck.stderr b/src/test/ui/if/if-typeck.stderr index 6d96f8bf223..714d3ebcdb0 100644 --- a/src/test/ui/if/if-typeck.stderr +++ b/src/test/ui/if/if-typeck.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/if-typeck.rs:19:8 + --> $DIR/if-typeck.rs:9:8 | LL | if f { } | ^ expected bool, found fn item diff --git a/src/test/ui/if/if-without-block.rs b/src/test/ui/if/if-without-block.rs index db81f00a9e3..3dde0ed7c71 100644 --- a/src/test/ui/if/if-without-block.rs +++ b/src/test/ui/if/if-without-block.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let n = 1; if 5 == { diff --git a/src/test/ui/if/if-without-block.stderr b/src/test/ui/if/if-without-block.stderr index c94dac8871d..1e45045adec 100644 --- a/src/test/ui/if/if-without-block.stderr +++ b/src/test/ui/if/if-without-block.stderr @@ -1,5 +1,5 @@ error: expected `{`, found `}` - --> $DIR/if-without-block.rs:17:1 + --> $DIR/if-without-block.rs:7:1 | LL | if 5 == { | -- this `if` statement has a condition, but no block diff --git a/src/test/ui/if/if-without-else-result.rs b/src/test/ui/if/if-without-else-result.rs index 95bcce5a847..cd7fde40fe8 100644 --- a/src/test/ui/if/if-without-else-result.rs +++ b/src/test/ui/if/if-without-else-result.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let a = if true { true }; //~^ ERROR if may be missing an else clause [E0317] diff --git a/src/test/ui/if/if-without-else-result.stderr b/src/test/ui/if/if-without-else-result.stderr index ab97f6c81f7..2134781088c 100644 --- a/src/test/ui/if/if-without-else-result.stderr +++ b/src/test/ui/if/if-without-else-result.stderr @@ -1,5 +1,5 @@ error[E0317]: if may be missing an else clause - --> $DIR/if-without-else-result.rs:12:13 + --> $DIR/if-without-else-result.rs:2:13 | LL | let a = if true { true }; | ^^^^^^^^^^^^^^^^ expected (), found bool diff --git a/src/test/ui/if/ifmt-bad-arg.rs b/src/test/ui/if/ifmt-bad-arg.rs index 6f051b40e8b..a57221af916 100644 --- a/src/test/ui/if/ifmt-bad-arg.rs +++ b/src/test/ui/if/ifmt-bad-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { // bad arguments to the format! call diff --git a/src/test/ui/if/ifmt-bad-arg.stderr b/src/test/ui/if/ifmt-bad-arg.stderr index 7e71707c22b..d4153ac94ac 100644 --- a/src/test/ui/if/ifmt-bad-arg.stderr +++ b/src/test/ui/if/ifmt-bad-arg.stderr @@ -1,11 +1,11 @@ error: 1 positional argument in format string, but no arguments were given - --> $DIR/ifmt-bad-arg.rs:16:14 + --> $DIR/ifmt-bad-arg.rs:6:14 | LL | format!("{}"); | ^^ error: invalid reference to positional argument 1 (there is 1 argument) - --> $DIR/ifmt-bad-arg.rs:19:14 + --> $DIR/ifmt-bad-arg.rs:9:14 | LL | format!("{1}", 1); | ^^^ @@ -13,21 +13,21 @@ LL | format!("{1}", 1); = note: positional arguments are zero-based error: argument never used - --> $DIR/ifmt-bad-arg.rs:19:20 + --> $DIR/ifmt-bad-arg.rs:9:20 | LL | format!("{1}", 1); - | ----- ^ + | ----- ^ argument never used | | | formatting specifier missing error: 2 positional arguments in format string, but no arguments were given - --> $DIR/ifmt-bad-arg.rs:23:14 + --> $DIR/ifmt-bad-arg.rs:13:14 | LL | format!("{} {}"); | ^^ ^^ error: invalid reference to positional argument 1 (there is 1 argument) - --> $DIR/ifmt-bad-arg.rs:26:18 + --> $DIR/ifmt-bad-arg.rs:16:18 | LL | format!("{0} {1}", 1); | ^^^ @@ -35,7 +35,7 @@ LL | format!("{0} {1}", 1); = note: positional arguments are zero-based error: invalid reference to positional argument 2 (there are 2 arguments) - --> $DIR/ifmt-bad-arg.rs:29:22 + --> $DIR/ifmt-bad-arg.rs:19:22 | LL | format!("{0} {1} {2}", 1, 2); | ^^^ @@ -43,7 +43,7 @@ LL | format!("{0} {1} {2}", 1, 2); = note: positional arguments are zero-based error: invalid reference to positional argument 2 (there are 2 arguments) - --> $DIR/ifmt-bad-arg.rs:32:28 + --> $DIR/ifmt-bad-arg.rs:22:28 | LL | format!("{} {value} {} {}", 1, value=2); | ^^ @@ -51,7 +51,7 @@ LL | format!("{} {value} {} {}", 1, value=2); = note: positional arguments are zero-based error: invalid reference to positional arguments 3, 4 and 5 (there are 3 arguments) - --> $DIR/ifmt-bad-arg.rs:34:38 + --> $DIR/ifmt-bad-arg.rs:24:38 | LL | format!("{name} {value} {} {} {} {} {} {}", 0, name=1, value=2); | ^^ ^^ ^^ @@ -59,121 +59,125 @@ LL | format!("{name} {value} {} {} {} {} {} {}", 0, name=1, value=2); = note: positional arguments are zero-based error: there is no argument named `foo` - --> $DIR/ifmt-bad-arg.rs:37:17 + --> $DIR/ifmt-bad-arg.rs:27:17 | LL | format!("{} {foo} {} {bar} {}", 1, 2, 3); | ^^^^^ error: there is no argument named `bar` - --> $DIR/ifmt-bad-arg.rs:37:26 + --> $DIR/ifmt-bad-arg.rs:27:26 | LL | format!("{} {foo} {} {bar} {}", 1, 2, 3); | ^^^^^ error: there is no argument named `foo` - --> $DIR/ifmt-bad-arg.rs:41:14 + --> $DIR/ifmt-bad-arg.rs:31:14 | LL | format!("{foo}"); //~ ERROR: no argument named `foo` | ^^^^^ error: multiple unused formatting arguments - --> $DIR/ifmt-bad-arg.rs:42:17 + --> $DIR/ifmt-bad-arg.rs:32:17 | LL | format!("", 1, 2); //~ ERROR: multiple unused formatting arguments - | -- ^ ^ - | | + | -- ^ ^ argument never used + | | | + | | argument never used | multiple missing formatting specifiers error: argument never used - --> $DIR/ifmt-bad-arg.rs:43:22 + --> $DIR/ifmt-bad-arg.rs:33:22 | LL | format!("{}", 1, 2); //~ ERROR: argument never used - | ---- ^ + | ---- ^ argument never used | | | formatting specifier missing error: argument never used - --> $DIR/ifmt-bad-arg.rs:44:20 + --> $DIR/ifmt-bad-arg.rs:34:20 | LL | format!("{1}", 1, 2); //~ ERROR: argument never used - | ----- ^ + | ----- ^ argument never used | | | formatting specifier missing error: named argument never used - --> $DIR/ifmt-bad-arg.rs:45:26 + --> $DIR/ifmt-bad-arg.rs:35:26 | LL | format!("{}", 1, foo=2); //~ ERROR: named argument never used - | ---- ^ + | ---- ^ named argument never used | | | formatting specifier missing error: argument never used - --> $DIR/ifmt-bad-arg.rs:46:22 + --> $DIR/ifmt-bad-arg.rs:36:22 | LL | format!("{foo}", 1, foo=2); //~ ERROR: argument never used - | ------- ^ + | ------- ^ argument never used | | | formatting specifier missing error: named argument never used - --> $DIR/ifmt-bad-arg.rs:47:21 + --> $DIR/ifmt-bad-arg.rs:37:21 | LL | format!("", foo=2); //~ ERROR: named argument never used - | -- ^ + | -- ^ named argument never used | | | formatting specifier missing error: multiple unused formatting arguments - --> $DIR/ifmt-bad-arg.rs:48:32 + --> $DIR/ifmt-bad-arg.rs:38:32 | LL | format!("{} {}", 1, 2, foo=1, bar=2); //~ ERROR: multiple unused formatting arguments - | ------- ^ ^ - | | + | ------- ^ ^ named argument never used + | | | + | | named argument never used | multiple missing formatting specifiers error: duplicate argument named `foo` - --> $DIR/ifmt-bad-arg.rs:50:33 + --> $DIR/ifmt-bad-arg.rs:40:33 | LL | format!("{foo}", foo=1, foo=2); //~ ERROR: duplicate argument | ^ | note: previously here - --> $DIR/ifmt-bad-arg.rs:50:26 + --> $DIR/ifmt-bad-arg.rs:40:26 | LL | format!("{foo}", foo=1, foo=2); //~ ERROR: duplicate argument | ^ error: expected ident, positional arguments cannot follow named arguments - --> $DIR/ifmt-bad-arg.rs:51:24 + --> $DIR/ifmt-bad-arg.rs:41:24 | LL | format!("", foo=1, 2); //~ ERROR: positional arguments cannot follow | ^ error: there is no argument named `valueb` - --> $DIR/ifmt-bad-arg.rs:55:23 + --> $DIR/ifmt-bad-arg.rs:45:23 | LL | format!("{valuea} {valueb}", valuea=5, valuec=7); | ^^^^^^^^ error: named argument never used - --> $DIR/ifmt-bad-arg.rs:55:51 + --> $DIR/ifmt-bad-arg.rs:45:51 | LL | format!("{valuea} {valueb}", valuea=5, valuec=7); - | ------------------- ^ + | ------------------- ^ named argument never used | | | formatting specifier missing error: invalid format string: expected `'}'` but string was terminated - --> $DIR/ifmt-bad-arg.rs:61:15 + --> $DIR/ifmt-bad-arg.rs:51:15 | LL | format!("{"); //~ ERROR: expected `'}'` but string was terminated - | ^ expected `'}'` in format string + | -^ expected `'}'` in format string + | | + | because of this opening brace | = note: if you intended to print `{`, you can escape it using `{{` error: invalid format string: unmatched `}` found - --> $DIR/ifmt-bad-arg.rs:63:18 + --> $DIR/ifmt-bad-arg.rs:53:18 | LL | format!("foo } bar"); //~ ERROR: unmatched `}` found | ^ unmatched `}` in format string @@ -181,7 +185,7 @@ LL | format!("foo } bar"); //~ ERROR: unmatched `}` found = note: if you intended to print `}`, you can escape it using `}}` error: invalid format string: unmatched `}` found - --> $DIR/ifmt-bad-arg.rs:64:18 + --> $DIR/ifmt-bad-arg.rs:54:18 | LL | format!("foo }"); //~ ERROR: unmatched `}` found | ^ unmatched `}` in format string @@ -189,26 +193,30 @@ LL | format!("foo }"); //~ ERROR: unmatched `}` found = note: if you intended to print `}`, you can escape it using `}}` error: argument never used - --> $DIR/ifmt-bad-arg.rs:66:27 + --> $DIR/ifmt-bad-arg.rs:56:27 | LL | format!("foo %s baz", "bar"); //~ ERROR: argument never used - | -- ^^^^^ + | -- ^^^^^ argument never used | | | help: format specifiers use curly braces: `{}` | = note: printf formatting not supported; see the documentation for `std::fmt` error: there is no argument named `foo` - --> $DIR/ifmt-bad-arg.rs:70:9 + --> $DIR/ifmt-bad-arg.rs:60:9 | LL | {foo} | ^^^^^ error: invalid format string: expected `'}'`, found `'t'` - --> $DIR/ifmt-bad-arg.rs:85:1 + --> $DIR/ifmt-bad-arg.rs:75:1 | +LL | ninth number: { + | - because of this opening brace LL | tenth number: {}", | ^ expected `}` in format string + | + = note: if you intended to print `{`, you can escape it using `{{` error: aborting due to 28 previous errors diff --git a/src/test/ui/if/ifmt-bad-format-args.rs b/src/test/ui/if/ifmt-bad-format-args.rs index 8bd3cb0f60b..ba7301561bd 100644 --- a/src/test/ui/if/ifmt-bad-format-args.rs +++ b/src/test/ui/if/ifmt-bad-format-args.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { format_args!(); //~ ERROR: requires at least a format string argument format_args!(|| {}); //~ ERROR: must be a string literal diff --git a/src/test/ui/if/ifmt-bad-format-args.stderr b/src/test/ui/if/ifmt-bad-format-args.stderr index d2fe12925d7..966c8d916a3 100644 --- a/src/test/ui/if/ifmt-bad-format-args.stderr +++ b/src/test/ui/if/ifmt-bad-format-args.stderr @@ -1,11 +1,11 @@ error: requires at least a format string argument - --> $DIR/ifmt-bad-format-args.rs:12:5 + --> $DIR/ifmt-bad-format-args.rs:2:5 | LL | format_args!(); //~ ERROR: requires at least a format string argument | ^^^^^^^^^^^^^^^ error: format argument must be a string literal - --> $DIR/ifmt-bad-format-args.rs:13:18 + --> $DIR/ifmt-bad-format-args.rs:3:18 | LL | format_args!(|| {}); //~ ERROR: must be a string literal | ^^^^^ diff --git a/src/test/ui/if/ifmt-unimpl.rs b/src/test/ui/if/ifmt-unimpl.rs index 9b9bae92c33..65daae4b25e 100644 --- a/src/test/ui/if/ifmt-unimpl.rs +++ b/src/test/ui/if/ifmt-unimpl.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { format!("{:X}", "3"); //~^ ERROR: `str: std::fmt::UpperHex` is not satisfied diff --git a/src/test/ui/if/ifmt-unimpl.stderr b/src/test/ui/if/ifmt-unimpl.stderr index fbb3136693a..7a7e4b34d25 100644 --- a/src/test/ui/if/ifmt-unimpl.stderr +++ b/src/test/ui/if/ifmt-unimpl.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `str: std::fmt::UpperHex` is not satisfied - --> $DIR/ifmt-unimpl.rs:12:21 + --> $DIR/ifmt-unimpl.rs:2:21 | LL | format!("{:X}", "3"); | ^^^ the trait `std::fmt::UpperHex` is not implemented for `str` diff --git a/src/test/ui/if/ifmt-unknown-trait.rs b/src/test/ui/if/ifmt-unknown-trait.rs index d90b3d3cf81..158152c89a4 100644 --- a/src/test/ui/if/ifmt-unknown-trait.rs +++ b/src/test/ui/if/ifmt-unknown-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { format!("{:notimplemented}", "3"); //~^ ERROR: unknown format trait `notimplemented` diff --git a/src/test/ui/if/ifmt-unknown-trait.stderr b/src/test/ui/if/ifmt-unknown-trait.stderr index 3c746e4c53b..9ea367c81ec 100644 --- a/src/test/ui/if/ifmt-unknown-trait.stderr +++ b/src/test/ui/if/ifmt-unknown-trait.stderr @@ -1,5 +1,5 @@ error: unknown format trait `notimplemented` - --> $DIR/ifmt-unknown-trait.rs:12:34 + --> $DIR/ifmt-unknown-trait.rs:2:34 | LL | format!("{:notimplemented}", "3"); | ^^^ diff --git a/src/test/ui/illegal-ufcs-drop.rs b/src/test/ui/illegal-ufcs-drop.rs index f4c653bd573..5c072663eda 100644 --- a/src/test/ui/illegal-ufcs-drop.rs +++ b/src/test/ui/illegal-ufcs-drop.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - struct Foo; impl Drop for Foo { diff --git a/src/test/ui/illegal-ufcs-drop.stderr b/src/test/ui/illegal-ufcs-drop.stderr index f82c54664a9..d8e2dc6e870 100644 --- a/src/test/ui/illegal-ufcs-drop.stderr +++ b/src/test/ui/illegal-ufcs-drop.stderr @@ -1,5 +1,5 @@ error[E0040]: explicit use of destructor method - --> $DIR/illegal-ufcs-drop.rs:19:5 + --> $DIR/illegal-ufcs-drop.rs:8:5 | LL | Drop::drop(&mut Foo) //~ ERROR explicit use of destructor method | ^^^^^^^^^^ explicit destructor calls not allowed diff --git a/src/test/ui/immut-function-arguments.ast.nll.stderr b/src/test/ui/immut-function-arguments.ast.nll.stderr index d33814a0fc5..f0163390ae0 100644 --- a/src/test/ui/immut-function-arguments.ast.nll.stderr +++ b/src/test/ui/immut-function-arguments.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable - --> $DIR/immut-function-arguments.rs:15:5 + --> $DIR/immut-function-arguments.rs:5:5 | LL | fn f(y: Box) { | - help: consider changing this to be mutable: `mut y` @@ -7,7 +7,7 @@ LL | *y = 5; //[ast]~ ERROR cannot assign | ^^^^^^ cannot assign error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable - --> $DIR/immut-function-arguments.rs:20:35 + --> $DIR/immut-function-arguments.rs:10:35 | LL | let _frob = |q: Box| { *q = 2; }; //[ast]~ ERROR cannot assign | - ^^^^^^ cannot assign diff --git a/src/test/ui/immut-function-arguments.ast.stderr b/src/test/ui/immut-function-arguments.ast.stderr index 7b2061950f3..1ffe569d828 100644 --- a/src/test/ui/immut-function-arguments.ast.stderr +++ b/src/test/ui/immut-function-arguments.ast.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to immutable `Box` content `*y` - --> $DIR/immut-function-arguments.rs:15:5 + --> $DIR/immut-function-arguments.rs:5:5 | LL | fn f(y: Box) { | - help: make this binding mutable: `mut y` @@ -7,7 +7,7 @@ LL | *y = 5; //[ast]~ ERROR cannot assign | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable `Box` content `*q` - --> $DIR/immut-function-arguments.rs:20:35 + --> $DIR/immut-function-arguments.rs:10:35 | LL | let _frob = |q: Box| { *q = 2; }; //[ast]~ ERROR cannot assign | - ^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/immut-function-arguments.mir.stderr b/src/test/ui/immut-function-arguments.mir.stderr index d33814a0fc5..f0163390ae0 100644 --- a/src/test/ui/immut-function-arguments.mir.stderr +++ b/src/test/ui/immut-function-arguments.mir.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable - --> $DIR/immut-function-arguments.rs:15:5 + --> $DIR/immut-function-arguments.rs:5:5 | LL | fn f(y: Box) { | - help: consider changing this to be mutable: `mut y` @@ -7,7 +7,7 @@ LL | *y = 5; //[ast]~ ERROR cannot assign | ^^^^^^ cannot assign error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable - --> $DIR/immut-function-arguments.rs:20:35 + --> $DIR/immut-function-arguments.rs:10:35 | LL | let _frob = |q: Box| { *q = 2; }; //[ast]~ ERROR cannot assign | - ^^^^^^ cannot assign diff --git a/src/test/ui/immut-function-arguments.rs b/src/test/ui/immut-function-arguments.rs index 61a074952ef..2cc9c694ef1 100644 --- a/src/test/ui/immut-function-arguments.rs +++ b/src/test/ui/immut-function-arguments.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/impl-bounds-checking.rs b/src/test/ui/impl-bounds-checking.rs index f90365b71ae..5e65a27bf14 100644 --- a/src/test/ui/impl-bounds-checking.rs +++ b/src/test/ui/impl-bounds-checking.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Clone2 { fn clone(&self) -> Self; } diff --git a/src/test/ui/impl-bounds-checking.stderr b/src/test/ui/impl-bounds-checking.stderr index 80666131b2c..618a9f94aa4 100644 --- a/src/test/ui/impl-bounds-checking.stderr +++ b/src/test/ui/impl-bounds-checking.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `isize: Clone2` is not satisfied - --> $DIR/impl-bounds-checking.rs:20:6 + --> $DIR/impl-bounds-checking.rs:10:6 | LL | impl Getter for isize { //~ ERROR `isize: Clone2` is not satisfied | ^^^^^^^^^^^^^ the trait `Clone2` is not implemented for `isize` diff --git a/src/test/ui/impl-duplicate-methods.rs b/src/test/ui/impl-duplicate-methods.rs index 88499140751..adb09d7f56e 100644 --- a/src/test/ui/impl-duplicate-methods.rs +++ b/src/test/ui/impl-duplicate-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; impl Foo { diff --git a/src/test/ui/impl-duplicate-methods.stderr b/src/test/ui/impl-duplicate-methods.stderr index 99e1e56e323..b6dc4882fc8 100644 --- a/src/test/ui/impl-duplicate-methods.stderr +++ b/src/test/ui/impl-duplicate-methods.stderr @@ -1,5 +1,5 @@ error[E0201]: duplicate definitions with name `orange`: - --> $DIR/impl-duplicate-methods.rs:15:5 + --> $DIR/impl-duplicate-methods.rs:5:5 | LL | fn orange(&self) {} | ------------------- previous definition of `orange` here diff --git a/src/test/ui/impl-header-lifetime-elision/assoc-type.rs b/src/test/ui/impl-header-lifetime-elision/assoc-type.rs index 49f528df8f6..44c46e444d6 100644 --- a/src/test/ui/impl-header-lifetime-elision/assoc-type.rs +++ b/src/test/ui/impl-header-lifetime-elision/assoc-type.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we do not yet support elision in associated types, even // when there is just one name we could take from the impl header. diff --git a/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr b/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr index 022b8bc717b..492ca872187 100644 --- a/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr +++ b/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr @@ -1,11 +1,11 @@ error[E0106]: missing lifetime specifier - --> $DIR/assoc-type.rs:21:19 + --> $DIR/assoc-type.rs:11:19 | LL | type Output = &i32; | ^ expected lifetime parameter error[E0106]: missing lifetime specifier - --> $DIR/assoc-type.rs:26:20 + --> $DIR/assoc-type.rs:16:20 | LL | type Output = &'_ i32; | ^^ expected lifetime parameter diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs b/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs index 384c08ff5bb..d4ad706d01b 100644 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `impl MyTrait<'_> for &i32` is equivalent to `impl<'a, // 'b> MyTrait<'a> for &'b i32`. diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr index f0e174a1207..53cd2b14411 100644 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr @@ -1,11 +1,11 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/dyn-trait.rs:30:16 + --> $DIR/dyn-trait.rs:20:16 | LL | static_val(x); //~ ERROR cannot infer | ^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 29:26... - --> $DIR/dyn-trait.rs:29:26 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 19:26... + --> $DIR/dyn-trait.rs:19:26 | LL | fn with_dyn_debug_static<'a>(x: Box) { | ^^ diff --git a/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs b/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs index c0d454d9426..6301ac4a323 100644 --- a/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs +++ b/src/test/ui/impl-header-lifetime-elision/explicit-and-elided-same-header.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![allow(warnings)] diff --git a/src/test/ui/impl-header-lifetime-elision/inherent-impl.rs b/src/test/ui/impl-header-lifetime-elision/inherent-impl.rs index d4b8acd6010..20d778d20ae 100644 --- a/src/test/ui/impl-header-lifetime-elision/inherent-impl.rs +++ b/src/test/ui/impl-header-lifetime-elision/inherent-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass struct Foo<'a>(&'a u8); diff --git a/src/test/ui/impl-header-lifetime-elision/path-elided.rs b/src/test/ui/impl-header-lifetime-elision/path-elided.rs index b68a0f375f6..6532b0aebe7 100644 --- a/src/test/ui/impl-header-lifetime-elision/path-elided.rs +++ b/src/test/ui/impl-header-lifetime-elision/path-elided.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![allow(warnings)] trait MyTrait { } diff --git a/src/test/ui/impl-header-lifetime-elision/path-elided.stderr b/src/test/ui/impl-header-lifetime-elision/path-elided.stderr index 03e8f8c9ad5..c9287ffba96 100644 --- a/src/test/ui/impl-header-lifetime-elision/path-elided.stderr +++ b/src/test/ui/impl-header-lifetime-elision/path-elided.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/path-elided.rs:16:18 + --> $DIR/path-elided.rs:7:18 | LL | impl MyTrait for Foo { | ^^^ expected lifetime parameter diff --git a/src/test/ui/impl-header-lifetime-elision/path-underscore.rs b/src/test/ui/impl-header-lifetime-elision/path-underscore.rs index b2c7a415efe..f39ba573384 100644 --- a/src/test/ui/impl-header-lifetime-elision/path-underscore.rs +++ b/src/test/ui/impl-header-lifetime-elision/path-underscore.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `impl MyTrait for Foo<'_>` works. // run-pass diff --git a/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs b/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs index e62e7dc56a4..5be04d08a09 100644 --- a/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs +++ b/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `impl MyTrait for &i32` works and is equivalent to any lifetime. // run-pass diff --git a/src/test/ui/impl-header-lifetime-elision/trait-elided.rs b/src/test/ui/impl-header-lifetime-elision/trait-elided.rs index 1fb57b96ba9..3979eda740a 100644 --- a/src/test/ui/impl-header-lifetime-elision/trait-elided.rs +++ b/src/test/ui/impl-header-lifetime-elision/trait-elided.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![allow(warnings)] trait MyTrait<'a> { } diff --git a/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr b/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr index 7138b321f97..b742db1c75c 100644 --- a/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr +++ b/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/trait-elided.rs:14:6 + --> $DIR/trait-elided.rs:5:6 | LL | impl MyTrait for u32 { | ^^^^^^^ expected lifetime parameter diff --git a/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs b/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs index 54d23f5f4de..3e13b0426ec 100644 --- a/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs +++ b/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `impl MyTrait<'_> for &i32` is equivalent to `impl<'a, // 'b> MyTrait<'a> for &'b i32`. // diff --git a/src/test/ui/impl-trait/associated-existential-type-generic-trait.rs b/src/test/ui/impl-trait/associated-existential-type-generic-trait.rs index c9bf7b87ef4..26bd435cbac 100644 --- a/src/test/ui/impl-trait/associated-existential-type-generic-trait.rs +++ b/src/test/ui/impl-trait/associated-existential-type-generic-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(existential_type)] // compile-pass diff --git a/src/test/ui/impl-trait/associated-existential-type-trivial.rs b/src/test/ui/impl-trait/associated-existential-type-trivial.rs index 78593fe319c..cc974ffea7b 100644 --- a/src/test/ui/impl-trait/associated-existential-type-trivial.rs +++ b/src/test/ui/impl-trait/associated-existential-type-trivial.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(existential_type)] // compile-pass diff --git a/src/test/ui/impl-trait/associated-existential-type.rs b/src/test/ui/impl-trait/associated-existential-type.rs index d880428411f..38511bd062c 100644 --- a/src/test/ui/impl-trait/associated-existential-type.rs +++ b/src/test/ui/impl-trait/associated-existential-type.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(existential_type)] // compile-pass diff --git a/src/test/ui/impl-trait/auto-trait-leak.rs b/src/test/ui/impl-trait/auto-trait-leak.rs index a241ba53461..ea0be0b346c 100644 --- a/src/test/ui/impl-trait/auto-trait-leak.rs +++ b/src/test/ui/impl-trait/auto-trait-leak.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength use std::cell::Cell; diff --git a/src/test/ui/impl-trait/auto-trait-leak.stderr b/src/test/ui/impl-trait/auto-trait-leak.stderr index 10711d1cd8c..b936fed85f4 100644 --- a/src/test/ui/impl-trait/auto-trait-leak.stderr +++ b/src/test/ui/impl-trait/auto-trait-leak.stderr @@ -1,54 +1,76 @@ error[E0391]: cycle detected when processing `cycle1::{{impl-Trait}}` - --> $DIR/auto-trait-leak.rs:24:16 + --> $DIR/auto-trait-leak.rs:14:16 | LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^ | note: ...which requires processing `cycle1`... - --> $DIR/auto-trait-leak.rs:24:1 + --> $DIR/auto-trait-leak.rs:14:1 | LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`... + = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`... note: ...which requires processing `cycle2::{{impl-Trait}}`... - --> $DIR/auto-trait-leak.rs:33:16 + --> $DIR/auto-trait-leak.rs:23:16 | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^ note: ...which requires processing `cycle2`... - --> $DIR/auto-trait-leak.rs:33:1 + --> $DIR/auto-trait-leak.rs:23:1 | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`... + = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`... = note: ...which again requires processing `cycle1::{{impl-Trait}}`, completing the cycle +note: cycle used when checking item types in top-level module + --> $DIR/auto-trait-leak.rs:3:1 + | +LL | / use std::cell::Cell; +LL | | use std::rc::Rc; +LL | | +LL | | fn send(_: T) {} +... | +LL | | Rc::new(String::from("foo")) +LL | | } + | |_^ error[E0391]: cycle detected when processing `cycle1::{{impl-Trait}}` - --> $DIR/auto-trait-leak.rs:24:16 + --> $DIR/auto-trait-leak.rs:14:16 | LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^ | note: ...which requires processing `cycle1`... - --> $DIR/auto-trait-leak.rs:24:1 + --> $DIR/auto-trait-leak.rs:14:1 | LL | fn cycle1() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`... + = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`... note: ...which requires processing `cycle2::{{impl-Trait}}`... - --> $DIR/auto-trait-leak.rs:33:16 + --> $DIR/auto-trait-leak.rs:23:16 | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^ note: ...which requires processing `cycle2`... - --> $DIR/auto-trait-leak.rs:33:1 + --> $DIR/auto-trait-leak.rs:23:1 | LL | fn cycle2() -> impl Clone { | ^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which again requires processing `cycle1::{{impl-Trait}}`, completing the cycle +note: cycle used when checking item types in top-level module + --> $DIR/auto-trait-leak.rs:3:1 + | +LL | / use std::cell::Cell; +LL | | use std::rc::Rc; +LL | | +LL | | fn send(_: T) {} +... | +LL | | Rc::new(String::from("foo")) +LL | | } + | |_^ error[E0277]: `std::rc::Rc` cannot be sent between threads safely - --> $DIR/auto-trait-leak.rs:27:5 + --> $DIR/auto-trait-leak.rs:17:5 | LL | send(cycle2().clone()); | ^^^^ `std::rc::Rc` cannot be sent between threads safely @@ -56,7 +78,7 @@ LL | send(cycle2().clone()); = help: within `impl std::clone::Clone`, the trait `std::marker::Send` is not implemented for `std::rc::Rc` = note: required because it appears within the type `impl std::clone::Clone` note: required by `send` - --> $DIR/auto-trait-leak.rs:16:1 + --> $DIR/auto-trait-leak.rs:6:1 | LL | fn send(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/auto-trait-leak2.rs b/src/test/ui/impl-trait/auto-trait-leak2.rs index 3c61543a711..a373edcfcf9 100644 --- a/src/test/ui/impl-trait/auto-trait-leak2.rs +++ b/src/test/ui/impl-trait/auto-trait-leak2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength use std::cell::Cell; diff --git a/src/test/ui/impl-trait/auto-trait-leak2.stderr b/src/test/ui/impl-trait/auto-trait-leak2.stderr index fb00c41f79c..4e427d3d6b3 100644 --- a/src/test/ui/impl-trait/auto-trait-leak2.stderr +++ b/src/test/ui/impl-trait/auto-trait-leak2.stderr @@ -1,29 +1,29 @@ error[E0277]: `std::rc::Rc>` cannot be sent between threads safely - --> $DIR/auto-trait-leak2.rs:25:5 + --> $DIR/auto-trait-leak2.rs:15:5 | LL | send(before()); | ^^^^ `std::rc::Rc>` cannot be sent between threads safely | = help: within `impl std::ops::Fn<(i32,)>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc>` - = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:19:5: 19:22 p:std::rc::Rc>]` + = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:9:5: 9:22 p:std::rc::Rc>]` = note: required because it appears within the type `impl std::ops::Fn<(i32,)>` note: required by `send` - --> $DIR/auto-trait-leak2.rs:22:1 + --> $DIR/auto-trait-leak2.rs:12:1 | LL | fn send(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `std::rc::Rc>` cannot be sent between threads safely - --> $DIR/auto-trait-leak2.rs:28:5 + --> $DIR/auto-trait-leak2.rs:18:5 | LL | send(after()); | ^^^^ `std::rc::Rc>` cannot be sent between threads safely | = help: within `impl std::ops::Fn<(i32,)>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc>` - = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:36:5: 36:22 p:std::rc::Rc>]` + = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:26:5: 26:22 p:std::rc::Rc>]` = note: required because it appears within the type `impl std::ops::Fn<(i32,)>` note: required by `send` - --> $DIR/auto-trait-leak2.rs:22:1 + --> $DIR/auto-trait-leak2.rs:12:1 | LL | fn send(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/auxiliary/no_method_suggested_traits.rs b/src/test/ui/impl-trait/auxiliary/no_method_suggested_traits.rs index 20cebb9be17..cefb17e0fd4 100644 --- a/src/test/ui/impl-trait/auxiliary/no_method_suggested_traits.rs +++ b/src/test/ui/impl-trait/auxiliary/no_method_suggested_traits.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use reexport::Reexported; pub struct Foo; diff --git a/src/test/ui/impl-trait/bindings-opaque.rs b/src/test/ui/impl-trait/bindings-opaque.rs index 88b7a52af7f..5f623321943 100644 --- a/src/test/ui/impl-trait/bindings-opaque.rs +++ b/src/test/ui/impl-trait/bindings-opaque.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(impl_trait_in_bindings)] const FOO: impl Copy = 42; @@ -18,6 +8,9 @@ fn main() { let foo: impl Copy = 42; let _ = FOO.count_ones(); +//~^ ERROR no method let _ = BAR.count_ones(); +//~^ ERROR no method let _ = foo.count_ones(); +//~^ ERROR no method } diff --git a/src/test/ui/impl-trait/bindings-opaque.stderr b/src/test/ui/impl-trait/bindings-opaque.stderr index 00358ee502e..8b2514c0501 100644 --- a/src/test/ui/impl-trait/bindings-opaque.stderr +++ b/src/test/ui/impl-trait/bindings-opaque.stderr @@ -1,17 +1,17 @@ error[E0599]: no method named `count_ones` found for type `impl std::marker::Copy` in the current scope - --> $DIR/bindings-opaque.rs:20:17 + --> $DIR/bindings-opaque.rs:10:17 | LL | let _ = FOO.count_ones(); | ^^^^^^^^^^ error[E0599]: no method named `count_ones` found for type `impl std::marker::Copy` in the current scope - --> $DIR/bindings-opaque.rs:21:17 + --> $DIR/bindings-opaque.rs:12:17 | LL | let _ = BAR.count_ones(); | ^^^^^^^^^^ error[E0599]: no method named `count_ones` found for type `impl std::marker::Copy` in the current scope - --> $DIR/bindings-opaque.rs:22:17 + --> $DIR/bindings-opaque.rs:14:17 | LL | let _ = foo.count_ones(); | ^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/bindings.rs b/src/test/ui/impl-trait/bindings.rs index 571571aa751..899303646d6 100644 --- a/src/test/ui/impl-trait/bindings.rs +++ b/src/test/ui/impl-trait/bindings.rs @@ -1,34 +1,28 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(impl_trait_in_bindings)] fn a(x: T) { const foo: impl Clone = x; +//~^ ERROR can't capture dynamic environment in a fn item } fn b(x: T) { let _ = move || { const foo: impl Clone = x; +//~^ ERROR can't capture dynamic environment in a fn item }; } trait Foo { fn a(x: T) { const foo: impl Clone = x; +//~^ ERROR can't capture dynamic environment in a fn item } } impl Foo for i32 { fn a(x: T) { const foo: impl Clone = x; +//~^ ERROR can't capture dynamic environment in a fn item } } diff --git a/src/test/ui/impl-trait/bindings.stderr b/src/test/ui/impl-trait/bindings.stderr index 70a736d2fd1..2a9be7a270a 100644 --- a/src/test/ui/impl-trait/bindings.stderr +++ b/src/test/ui/impl-trait/bindings.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/bindings.rs:14:29 + --> $DIR/bindings.rs:4:29 | LL | const foo: impl Clone = x; | ^ @@ -7,7 +7,7 @@ LL | const foo: impl Clone = x; = help: use the `|| { ... }` closure form instead error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/bindings.rs:19:33 + --> $DIR/bindings.rs:10:33 | LL | const foo: impl Clone = x; | ^ @@ -15,7 +15,7 @@ LL | const foo: impl Clone = x; = help: use the `|| { ... }` closure form instead error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/bindings.rs:25:33 + --> $DIR/bindings.rs:17:33 | LL | const foo: impl Clone = x; | ^ @@ -23,7 +23,7 @@ LL | const foo: impl Clone = x; = help: use the `|| { ... }` closure form instead error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/bindings.rs:31:33 + --> $DIR/bindings.rs:24:33 | LL | const foo: impl Clone = x; | ^ diff --git a/src/test/ui/impl-trait/equality.rs b/src/test/ui/impl-trait/equality.rs index 71fccc022b7..f6b0853284d 100644 --- a/src/test/ui/impl-trait/equality.rs +++ b/src/test/ui/impl-trait/equality.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] trait Foo: Copy + ToString {} diff --git a/src/test/ui/impl-trait/equality.stderr b/src/test/ui/impl-trait/equality.stderr index e277d4e28cb..6cd9d07748c 100644 --- a/src/test/ui/impl-trait/equality.stderr +++ b/src/test/ui/impl-trait/equality.stderr @@ -1,6 +1,12 @@ error[E0308]: mismatched types - --> $DIR/equality.rs:25:5 + --> $DIR/equality.rs:15:5 | +LL | fn two(x: bool) -> impl Foo { + | -------- expected because this return type... +LL | if x { +LL | return 1_i32; + | ----- ...is found to be `i32` here +LL | } LL | 0_u32 | ^^^^^ expected i32, found u32 | @@ -8,7 +14,7 @@ LL | 0_u32 found type `u32` error[E0277]: cannot add `impl Foo` to `u32` - --> $DIR/equality.rs:34:11 + --> $DIR/equality.rs:24:11 | LL | n + sum_to(n - 1) | ^ no implementation for `u32 + impl Foo` diff --git a/src/test/ui/impl-trait/equality2.rs b/src/test/ui/impl-trait/equality2.rs index 2ce24cf789d..a01779e8fcd 100644 --- a/src/test/ui/impl-trait/equality2.rs +++ b/src/test/ui/impl-trait/equality2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] trait Foo: Copy + ToString {} diff --git a/src/test/ui/impl-trait/equality2.stderr b/src/test/ui/impl-trait/equality2.stderr index da51e35947a..3e6181adec0 100644 --- a/src/test/ui/impl-trait/equality2.stderr +++ b/src/test/ui/impl-trait/equality2.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/equality2.rs:35:18 + --> $DIR/equality2.rs:25:18 | LL | let _: u32 = hide(0_u32); | ^^^^^^^^^^^ expected u32, found opaque type @@ -8,7 +8,7 @@ LL | let _: u32 = hide(0_u32); found type `impl Foo` error[E0308]: mismatched types - --> $DIR/equality2.rs:41:18 + --> $DIR/equality2.rs:31:18 | LL | let _: i32 = Leak::leak(hide(0_i32)); | ^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found associated type @@ -17,7 +17,7 @@ LL | let _: i32 = Leak::leak(hide(0_i32)); found type `::T` error[E0308]: mismatched types - --> $DIR/equality2.rs:48:10 + --> $DIR/equality2.rs:38:10 | LL | x = (x.1, | ^^^ expected u32, found i32 @@ -26,7 +26,7 @@ LL | x = (x.1, found type `impl Foo` (i32) error[E0308]: mismatched types - --> $DIR/equality2.rs:51:10 + --> $DIR/equality2.rs:41:10 | LL | x.0); | ^^^ expected i32, found u32 diff --git a/src/test/ui/impl-trait/existential-minimal.rs b/src/test/ui/impl-trait/existential-minimal.rs index ff9209251aa..c93c6a499bc 100644 --- a/src/test/ui/impl-trait/existential-minimal.rs +++ b/src/test/ui/impl-trait/existential-minimal.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass fn main() {} diff --git a/src/test/ui/impl-trait/existential_type_in_fn_body.rs b/src/test/ui/impl-trait/existential_type_in_fn_body.rs index 20f9e0d77c3..b29ae064b76 100644 --- a/src/test/ui/impl-trait/existential_type_in_fn_body.rs +++ b/src/test/ui/impl-trait/existential_type_in_fn_body.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(existential_type)] diff --git a/src/test/ui/impl-trait/impl-generic-mismatch-ab.rs b/src/test/ui/impl-trait/impl-generic-mismatch-ab.rs index 23549918ff1..6c9b119de74 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch-ab.rs +++ b/src/test/ui/impl-trait/impl-generic-mismatch-ab.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Debug; trait Foo { diff --git a/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr b/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr index 77ecdf2f5ac..357e6b026e2 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr +++ b/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr @@ -1,5 +1,5 @@ error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/impl-generic-mismatch-ab.rs:18:32 + --> $DIR/impl-generic-mismatch-ab.rs:8:32 | LL | fn foo(&self, a: &A, b: &impl Debug); | -- type in trait diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.rs b/src/test/ui/impl-trait/impl-generic-mismatch.rs index 6cf8000f6ad..f4fba4c34c1 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch.rs +++ b/src/test/ui/impl-trait/impl-generic-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-musl // ignore-x86 diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.stderr b/src/test/ui/impl-trait/impl-generic-mismatch.stderr index d777779a881..fae8da9861f 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch.stderr +++ b/src/test/ui/impl-trait/impl-generic-mismatch.stderr @@ -1,5 +1,5 @@ error[E0643]: method `foo` has incompatible signature for trait - --> $DIR/impl-generic-mismatch.rs:21:12 + --> $DIR/impl-generic-mismatch.rs:11:12 | LL | fn foo(&self, _: &impl Debug); | ---------- declaration in trait here @@ -12,7 +12,7 @@ LL | fn foo(&self, _: &impl Debug) { } | -- ^^^^^^^^^^ error[E0643]: method `bar` has incompatible signature for trait - --> $DIR/impl-generic-mismatch.rs:30:23 + --> $DIR/impl-generic-mismatch.rs:20:23 | LL | fn bar(&self, _: &U); | - declaration in trait here @@ -25,7 +25,7 @@ LL | fn bar(&self, _: &U) { } | ^^^^^^^^^^ ^ error[E0643]: method `hash` has incompatible signature for trait - --> $DIR/impl-generic-mismatch.rs:41:33 + --> $DIR/impl-generic-mismatch.rs:31:33 | LL | fn hash(&self, hasher: &mut impl Hasher) {} | ^^^^^^^^^^^ expected generic parameter, found `impl Trait` diff --git a/src/test/ui/impl-trait/impl-trait-plus-priority.rs b/src/test/ui/impl-trait/impl-trait-plus-priority.rs index f451123ca27..2e4f048a4e4 100644 --- a/src/test/ui/impl-trait/impl-trait-plus-priority.rs +++ b/src/test/ui/impl-trait/impl-trait-plus-priority.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z parse-only -Z continue-parse-after-error fn f() -> impl A + {} // OK diff --git a/src/test/ui/impl-trait/impl-trait-plus-priority.stderr b/src/test/ui/impl-trait/impl-trait-plus-priority.stderr index 2a9199b25bc..205d9b0b75e 100644 --- a/src/test/ui/impl-trait/impl-trait-plus-priority.stderr +++ b/src/test/ui/impl-trait/impl-trait-plus-priority.stderr @@ -1,65 +1,65 @@ error: ambiguous `+` in a type - --> $DIR/impl-trait-plus-priority.rs:33:18 + --> $DIR/impl-trait-plus-priority.rs:23:18 | LL | type A = fn() -> impl A +; | ^^^^^^^^ help: use parentheses to disambiguate: `(impl A)` error: ambiguous `+` in a type - --> $DIR/impl-trait-plus-priority.rs:35:18 + --> $DIR/impl-trait-plus-priority.rs:25:18 | LL | type A = fn() -> impl A + B; | ^^^^^^^^^^ help: use parentheses to disambiguate: `(impl A + B)` error: ambiguous `+` in a type - --> $DIR/impl-trait-plus-priority.rs:37:18 + --> $DIR/impl-trait-plus-priority.rs:27:18 | LL | type A = fn() -> dyn A + B; | ^^^^^^^^^ help: use parentheses to disambiguate: `(dyn A + B)` error[E0178]: expected a path on the left-hand side of `+`, not `fn() -> A` - --> $DIR/impl-trait-plus-priority.rs:39:10 + --> $DIR/impl-trait-plus-priority.rs:29:10 | LL | type A = fn() -> A + B; | ^^^^^^^^^^^^^ perhaps you forgot parentheses? error: ambiguous `+` in a type - --> $DIR/impl-trait-plus-priority.rs:42:18 + --> $DIR/impl-trait-plus-priority.rs:32:18 | LL | type A = Fn() -> impl A +; | ^^^^^^^^ help: use parentheses to disambiguate: `(impl A)` error: ambiguous `+` in a type - --> $DIR/impl-trait-plus-priority.rs:44:18 + --> $DIR/impl-trait-plus-priority.rs:34:18 | LL | type A = Fn() -> impl A + B; | ^^^^^^^^^^ help: use parentheses to disambiguate: `(impl A + B)` error: ambiguous `+` in a type - --> $DIR/impl-trait-plus-priority.rs:46:18 + --> $DIR/impl-trait-plus-priority.rs:36:18 | LL | type A = Fn() -> dyn A + B; | ^^^^^^^^^ help: use parentheses to disambiguate: `(dyn A + B)` error: ambiguous `+` in a type - --> $DIR/impl-trait-plus-priority.rs:50:11 + --> $DIR/impl-trait-plus-priority.rs:40:11 | LL | type A = &impl A +; | ^^^^^^^^ help: use parentheses to disambiguate: `(impl A)` error: ambiguous `+` in a type - --> $DIR/impl-trait-plus-priority.rs:52:11 + --> $DIR/impl-trait-plus-priority.rs:42:11 | LL | type A = &impl A + B; | ^^^^^^^^^^ help: use parentheses to disambiguate: `(impl A + B)` error: ambiguous `+` in a type - --> $DIR/impl-trait-plus-priority.rs:54:11 + --> $DIR/impl-trait-plus-priority.rs:44:11 | LL | type A = &dyn A + B; | ^^^^^^^^^ help: use parentheses to disambiguate: `(dyn A + B)` error[E0178]: expected a path on the left-hand side of `+`, not `&A` - --> $DIR/impl-trait-plus-priority.rs:56:10 + --> $DIR/impl-trait-plus-priority.rs:46:10 | LL | type A = &A + B; | ^^^^^^ help: try adding parentheses: `&(A + B)` diff --git a/src/test/ui/impl-trait/impl_trait_projections.rs b/src/test/ui/impl-trait/impl_trait_projections.rs index 57a0040600a..fd0986d7c0a 100644 --- a/src/test/ui/impl-trait/impl_trait_projections.rs +++ b/src/test/ui/impl-trait/impl_trait_projections.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. use std::fmt::Debug; use std::option; diff --git a/src/test/ui/impl-trait/impl_trait_projections.stderr b/src/test/ui/impl-trait/impl_trait_projections.stderr index a6daf898e30..4e9bcf32e13 100644 --- a/src/test/ui/impl-trait/impl_trait_projections.stderr +++ b/src/test/ui/impl-trait/impl_trait_projections.stderr @@ -1,29 +1,29 @@ error[E0667]: `impl Trait` is not allowed in path parameters - --> $DIR/impl_trait_projections.rs:21:51 + --> $DIR/impl_trait_projections.rs:12:51 | LL | fn projection_is_disallowed(x: impl Iterator) -> ::Item { | ^^^^^^^^^^^^^ error[E0667]: `impl Trait` is not allowed in path parameters - --> $DIR/impl_trait_projections.rs:28:9 + --> $DIR/impl_trait_projections.rs:19:9 | LL | -> ::Item | ^^^^^^^^^^^^^ error[E0667]: `impl Trait` is not allowed in path parameters - --> $DIR/impl_trait_projections.rs:35:27 + --> $DIR/impl_trait_projections.rs:26:27 | LL | -> <::std::ops::Range as Iterator>::Item | ^^^^^^^^^^ error[E0667]: `impl Trait` is not allowed in path parameters - --> $DIR/impl_trait_projections.rs:42:29 + --> $DIR/impl_trait_projections.rs:33:29 | LL | -> as Iterator>::Item | ^^^^^^^^^^ error[E0223]: ambiguous associated type - --> $DIR/impl_trait_projections.rs:21:50 + --> $DIR/impl_trait_projections.rs:12:50 | LL | fn projection_is_disallowed(x: impl Iterator) -> ::Item { | ^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `::Item` diff --git a/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.rs b/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.rs index 653ef1723e0..150a8015cbc 100644 --- a/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.rs +++ b/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.rs @@ -1,29 +1,17 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that attempts to construct infinite types via impl trait fail // in a graceful way. // // Regression test for #38064. -// error-pattern:overflow evaluating the requirement `impl Quux` - trait Quux {} -fn foo() -> impl Quux { +fn foo() -> impl Quux { //~ opaque type expands to a recursive type struct Foo(T); impl Quux for Foo {} Foo(bar()) } -fn bar() -> impl Quux { +fn bar() -> impl Quux { //~ opaque type expands to a recursive type struct Bar(T); impl Quux for Bar {} Bar(foo()) diff --git a/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr b/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr index f260cce647b..99c8fe35c66 100644 --- a/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr +++ b/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr @@ -1,7 +1,19 @@ -error[E0275]: overflow evaluating the requirement `impl Quux` +error[E0720]: opaque type expands to a recursive type + --> $DIR/infinite-impl-trait-issue-38064.rs:8:13 | - = help: consider adding a `#![recursion_limit="128"]` attribute to your crate +LL | fn foo() -> impl Quux { //~ opaque type expands to a recursive type + | ^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `foo::Foo>` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/infinite-impl-trait-issue-38064.rs:14:13 + | +LL | fn bar() -> impl Quux { //~ opaque type expands to a recursive type + | ^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `bar::Bar>` -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0275`. +For more information about this error, try `rustc --explain E0720`. diff --git a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs index 79d487493e8..2bff01be9b8 100644 --- a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs +++ b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(&self, a: A) -> A { a diff --git a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr index 89bc5388494..666418f6ee2 100644 --- a/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr +++ b/src/test/ui/impl-trait/issue-21659-show-relevant-trait-impls-3.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `foo` found for type `Bar` in the current scope - --> $DIR/issue-21659-show-relevant-trait-impls-3.rs:30:8 + --> $DIR/issue-21659-show-relevant-trait-impls-3.rs:20:8 | LL | struct Bar; | ----------- method `foo` not found for this diff --git a/src/test/ui/impl-trait/issue-42479.rs b/src/test/ui/impl-trait/issue-42479.rs index fbf2c3f8a4e..2da15ac5b6e 100644 --- a/src/test/ui/impl-trait/issue-42479.rs +++ b/src/test/ui/impl-trait/issue-42479.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass use std::iter::once; diff --git a/src/test/ui/impl-trait/issue-49376.rs b/src/test/ui/impl-trait/issue-49376.rs index 1dfea0b9573..13671b8dbf4 100644 --- a/src/test/ui/impl-trait/issue-49376.rs +++ b/src/test/ui/impl-trait/issue-49376.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // Tests for nested self-reference which caused a stack overflow. @@ -19,9 +9,11 @@ fn gen() -> impl PartialOrd + PartialEq + Debug { } struct Bar {} trait Foo {} +trait FooNested> {} impl Foo for Bar {} +impl FooNested for Bar {} -fn foo() -> impl Foo { +fn foo() -> impl Foo + FooNested { Bar {} } diff --git a/src/test/ui/impl-trait/issue-52128.rs b/src/test/ui/impl-trait/issue-52128.rs index e68637b35d1..eb4456a0d59 100644 --- a/src/test/ui/impl-trait/issue-52128.rs +++ b/src/test/ui/impl-trait/issue-52128.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![deny(warnings)] diff --git a/src/test/ui/impl-trait/method-suggestion-no-duplication.rs b/src/test/ui/impl-trait/method-suggestion-no-duplication.rs index 28028922e32..32f35171673 100644 --- a/src/test/ui/impl-trait/method-suggestion-no-duplication.rs +++ b/src/test/ui/impl-trait/method-suggestion-no-duplication.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // issue #21405 // ignore-tidy-linelength diff --git a/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr b/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr index f7aaab4242c..8da1ce41a0f 100644 --- a/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr +++ b/src/test/ui/impl-trait/method-suggestion-no-duplication.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `is_empty` found for type `Foo` in the current scope - --> $DIR/method-suggestion-no-duplication.rs:19:15 + --> $DIR/method-suggestion-no-duplication.rs:9:15 | LL | struct Foo; | ----------- method `is_empty` not found for this diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.rs b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.rs index 537fc975bcf..ef1b976ae33 100644 --- a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.rs +++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Debug; fn elided(x: &i32) -> impl Copy { x } diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr index 48686cbcaf2..8a477e42a66 100644 --- a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr +++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/must_outlive_least_region_or_bound.rs:13:23 + --> $DIR/must_outlive_least_region_or_bound.rs:3:23 | LL | fn elided(x: &i32) -> impl Copy { x } | ---- ^^^^^^^^^ lifetime `'static` required @@ -7,43 +7,43 @@ LL | fn elided(x: &i32) -> impl Copy { x } | help: add explicit lifetime `'static` to the type of `x`: `&'static i32` error: cannot infer an appropriate lifetime - --> $DIR/must_outlive_least_region_or_bound.rs:16:44 + --> $DIR/must_outlive_least_region_or_bound.rs:6:44 | LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x } | --------- ^ ...but this borrow... | | | this return type evaluates to the `'static` lifetime... | -note: ...can't outlive the lifetime 'a as defined on the function body at 16:13 - --> $DIR/must_outlive_least_region_or_bound.rs:16:13 +note: ...can't outlive the lifetime 'a as defined on the function body at 6:13 + --> $DIR/must_outlive_least_region_or_bound.rs:6:13 | LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x } | ^^ -help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime 'a as defined on the function body at 16:13 +help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime 'a as defined on the function body at 6:13 | LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x } | ^^^^^^^^^^^^^^ error: cannot infer an appropriate lifetime - --> $DIR/must_outlive_least_region_or_bound.rs:22:69 + --> $DIR/must_outlive_least_region_or_bound.rs:12:69 | LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } | -------------------------------- ^ ...but this borrow... | | | this return type evaluates to the `'static` lifetime... | -note: ...can't outlive the lifetime 'a as defined on the function body at 22:15 - --> $DIR/must_outlive_least_region_or_bound.rs:22:15 +note: ...can't outlive the lifetime 'a as defined on the function body at 12:15 + --> $DIR/must_outlive_least_region_or_bound.rs:12:15 | LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } | ^^ -help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime 'a as defined on the function body at 22:15 +help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime 'a as defined on the function body at 12:15 | LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static + 'a { x } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0623]: lifetime mismatch - --> $DIR/must_outlive_least_region_or_bound.rs:27:61 + --> $DIR/must_outlive_least_region_or_bound.rs:17:61 | LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) { | ------- ^^^^^^^^^^^^^^^^ @@ -52,7 +52,7 @@ LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32 | this parameter and the return type are declared with different lifetimes... error[E0310]: the parameter type `T` may not live long enough - --> $DIR/must_outlive_least_region_or_bound.rs:32:51 + --> $DIR/must_outlive_least_region_or_bound.rs:22:51 | LL | fn ty_param_wont_outlive_static(x: T) -> impl Debug + 'static { | -- ^^^^^^^^^^^^^^^^^^^^ @@ -60,7 +60,7 @@ LL | fn ty_param_wont_outlive_static(x: T) -> impl Debug + 'static { | help: consider adding an explicit lifetime bound `T: 'static`... | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/must_outlive_least_region_or_bound.rs:32:51 + --> $DIR/must_outlive_least_region_or_bound.rs:22:51 | LL | fn ty_param_wont_outlive_static(x: T) -> impl Debug + 'static { | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/needs_least_region_or_bound.rs b/src/test/ui/impl-trait/needs_least_region_or_bound.rs index 6c0a0b800ce..2a5b365559e 100644 --- a/src/test/ui/impl-trait/needs_least_region_or_bound.rs +++ b/src/test/ui/impl-trait/needs_least_region_or_bound.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Debug; trait MultiRegionTrait<'a, 'b> {} diff --git a/src/test/ui/impl-trait/needs_least_region_or_bound.stderr b/src/test/ui/impl-trait/needs_least_region_or_bound.stderr index fd2665dc762..f1b4d9c58f3 100644 --- a/src/test/ui/impl-trait/needs_least_region_or_bound.stderr +++ b/src/test/ui/impl-trait/needs_least_region_or_bound.stderr @@ -1,5 +1,5 @@ error: ambiguous lifetime bound in `impl Trait` - --> $DIR/needs_least_region_or_bound.rs:16:55 + --> $DIR/needs_least_region_or_bound.rs:6:55 | LL | fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ neither `'a` nor `'b` outlives the other diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.rs b/src/test/ui/impl-trait/no-method-suggested-traits.rs index 07c0e6f529f..c912873a6c0 100644 --- a/src/test/ui/impl-trait/no-method-suggested-traits.rs +++ b/src/test/ui/impl-trait/no-method-suggested-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:no_method_suggested_traits.rs extern crate no_method_suggested_traits; diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.stderr b/src/test/ui/impl-trait/no-method-suggested-traits.stderr index bc4afb93109..a3b118efa62 100644 --- a/src/test/ui/impl-trait/no-method-suggested-traits.stderr +++ b/src/test/ui/impl-trait/no-method-suggested-traits.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `method` found for type `u32` in the current scope - --> $DIR/no-method-suggested-traits.rs:33:10 + --> $DIR/no-method-suggested-traits.rs:23:10 | LL | 1u32.method(); | ^^^^^^ @@ -17,7 +17,7 @@ LL | use no_method_suggested_traits::Reexported; | error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&u32>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:36:44 + --> $DIR/no-method-suggested-traits.rs:26:44 | LL | std::rc::Rc::new(&mut Box::new(&1u32)).method(); | ^^^^^^ @@ -35,7 +35,7 @@ LL | use no_method_suggested_traits::Reexported; | error[E0599]: no method named `method` found for type `char` in the current scope - --> $DIR/no-method-suggested-traits.rs:40:9 + --> $DIR/no-method-suggested-traits.rs:30:9 | LL | 'a'.method(); | ^^^^^^ @@ -47,7 +47,7 @@ LL | use foo::Bar; | error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&char>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:42:43 + --> $DIR/no-method-suggested-traits.rs:32:43 | LL | std::rc::Rc::new(&mut Box::new(&'a')).method(); | ^^^^^^ @@ -59,7 +59,7 @@ LL | use foo::Bar; | error[E0599]: no method named `method` found for type `i32` in the current scope - --> $DIR/no-method-suggested-traits.rs:45:10 + --> $DIR/no-method-suggested-traits.rs:35:10 | LL | 1i32.method(); | ^^^^^^ @@ -71,7 +71,7 @@ LL | use no_method_suggested_traits::foo::PubPub; | error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&i32>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:47:44 + --> $DIR/no-method-suggested-traits.rs:37:44 | LL | std::rc::Rc::new(&mut Box::new(&1i32)).method(); | ^^^^^^ @@ -83,7 +83,7 @@ LL | use no_method_suggested_traits::foo::PubPub; | error[E0599]: no method named `method` found for type `Foo` in the current scope - --> $DIR/no-method-suggested-traits.rs:50:9 + --> $DIR/no-method-suggested-traits.rs:40:9 | LL | struct Foo; | ----------- method `method` not found for this @@ -99,7 +99,7 @@ LL | Foo.method(); candidate #4: `no_method_suggested_traits::Reexported` error[E0599]: no method named `method` found for type `std::rc::Rc<&mut std::boxed::Box<&Foo>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:52:43 + --> $DIR/no-method-suggested-traits.rs:42:43 | LL | std::rc::Rc::new(&mut Box::new(&Foo)).method(); | ^^^^^^ @@ -112,7 +112,7 @@ LL | std::rc::Rc::new(&mut Box::new(&Foo)).method(); candidate #4: `no_method_suggested_traits::Reexported` error[E0599]: no method named `method2` found for type `u64` in the current scope - --> $DIR/no-method-suggested-traits.rs:55:10 + --> $DIR/no-method-suggested-traits.rs:45:10 | LL | 1u64.method2(); | ^^^^^^^ @@ -122,7 +122,7 @@ LL | 1u64.method2(); candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&u64>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:57:44 + --> $DIR/no-method-suggested-traits.rs:47:44 | LL | std::rc::Rc::new(&mut Box::new(&1u64)).method2(); | ^^^^^^^ @@ -132,7 +132,7 @@ LL | std::rc::Rc::new(&mut Box::new(&1u64)).method2(); candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `no_method_suggested_traits::Foo` in the current scope - --> $DIR/no-method-suggested-traits.rs:60:37 + --> $DIR/no-method-suggested-traits.rs:50:37 | LL | no_method_suggested_traits::Foo.method2(); | ^^^^^^^ @@ -142,7 +142,7 @@ LL | no_method_suggested_traits::Foo.method2(); candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:62:71 + --> $DIR/no-method-suggested-traits.rs:52:71 | LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2(); | ^^^^^^^ @@ -152,7 +152,7 @@ LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).metho candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `no_method_suggested_traits::Bar` in the current scope - --> $DIR/no-method-suggested-traits.rs:64:40 + --> $DIR/no-method-suggested-traits.rs:54:40 | LL | no_method_suggested_traits::Bar::X.method2(); | ^^^^^^^ @@ -162,7 +162,7 @@ LL | no_method_suggested_traits::Bar::X.method2(); candidate #1: `foo::Bar` error[E0599]: no method named `method2` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:66:74 + --> $DIR/no-method-suggested-traits.rs:56:74 | LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2(); | ^^^^^^^ @@ -172,7 +172,7 @@ LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).me candidate #1: `foo::Bar` error[E0599]: no method named `method3` found for type `Foo` in the current scope - --> $DIR/no-method-suggested-traits.rs:69:9 + --> $DIR/no-method-suggested-traits.rs:59:9 | LL | struct Foo; | ----------- method `method3` not found for this @@ -185,7 +185,7 @@ LL | Foo.method3(); candidate #1: `no_method_suggested_traits::foo::PubPub` error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&Foo>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:71:43 + --> $DIR/no-method-suggested-traits.rs:61:43 | LL | std::rc::Rc::new(&mut Box::new(&Foo)).method3(); | ^^^^^^^ @@ -195,7 +195,7 @@ LL | std::rc::Rc::new(&mut Box::new(&Foo)).method3(); candidate #1: `no_method_suggested_traits::foo::PubPub` error[E0599]: no method named `method3` found for type `Bar` in the current scope - --> $DIR/no-method-suggested-traits.rs:73:12 + --> $DIR/no-method-suggested-traits.rs:63:12 | LL | enum Bar { X } | -------- method `method3` not found for this @@ -208,7 +208,7 @@ LL | Bar::X.method3(); candidate #1: `no_method_suggested_traits::foo::PubPub` error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&Bar>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:75:46 + --> $DIR/no-method-suggested-traits.rs:65:46 | LL | std::rc::Rc::new(&mut Box::new(&Bar::X)).method3(); | ^^^^^^^ @@ -218,37 +218,37 @@ LL | std::rc::Rc::new(&mut Box::new(&Bar::X)).method3(); candidate #1: `no_method_suggested_traits::foo::PubPub` error[E0599]: no method named `method3` found for type `usize` in the current scope - --> $DIR/no-method-suggested-traits.rs:79:13 + --> $DIR/no-method-suggested-traits.rs:69:13 | LL | 1_usize.method3(); //~ ERROR no method named | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&usize>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:80:47 + --> $DIR/no-method-suggested-traits.rs:70:47 | LL | std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named | ^^^^^^^ error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Foo` in the current scope - --> $DIR/no-method-suggested-traits.rs:81:37 + --> $DIR/no-method-suggested-traits.rs:71:37 | LL | no_method_suggested_traits::Foo.method3(); //~ ERROR no method named | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:82:71 + --> $DIR/no-method-suggested-traits.rs:72:71 | LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3(); | ^^^^^^^ error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Bar` in the current scope - --> $DIR/no-method-suggested-traits.rs:84:40 + --> $DIR/no-method-suggested-traits.rs:74:40 | LL | no_method_suggested_traits::Bar::X.method3(); //~ ERROR no method named | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope - --> $DIR/no-method-suggested-traits.rs:85:74 + --> $DIR/no-method-suggested-traits.rs:75:74 | LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3(); | ^^^^^^^ diff --git a/src/test/ui/impl-trait/no-trait.rs b/src/test/ui/impl-trait/no-trait.rs index 5299ba297d0..9ce668f4672 100644 --- a/src/test/ui/impl-trait/no-trait.rs +++ b/src/test/ui/impl-trait/no-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f() -> impl 'static {} //~ ERROR at least one trait must be specified fn main() {} diff --git a/src/test/ui/impl-trait/no-trait.stderr b/src/test/ui/impl-trait/no-trait.stderr index fdd01c87d1c..84ac1bd5ca4 100644 --- a/src/test/ui/impl-trait/no-trait.stderr +++ b/src/test/ui/impl-trait/no-trait.stderr @@ -1,5 +1,5 @@ error: at least one trait must be specified - --> $DIR/no-trait.rs:11:11 + --> $DIR/no-trait.rs:1:11 | LL | fn f() -> impl 'static {} //~ ERROR at least one trait must be specified | ^^^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type.rs b/src/test/ui/impl-trait/recursive-impl-trait-type.rs new file mode 100644 index 00000000000..facb191a370 --- /dev/null +++ b/src/test/ui/impl-trait/recursive-impl-trait-type.rs @@ -0,0 +1,81 @@ +// Test that impl trait does not allow creating recursive types that are +// otherwise forbidden. + +#![feature(await_macro, async_await, futures_api, generators)] + +fn option(i: i32) -> impl Sized { //~ ERROR + if i < 0 { + None + } else { + Some((option(i - 1), i)) + } +} + +fn tuple() -> impl Sized { //~ ERROR + (tuple(),) +} + +fn array() -> impl Sized { //~ ERROR + [array()] +} + +fn ptr() -> impl Sized { //~ ERROR + &ptr() as *const _ +} + +fn fn_ptr() -> impl Sized { //~ ERROR + fn_ptr as fn() -> _ +} + +fn closure_capture() -> impl Sized { //~ ERROR + let x = closure_capture(); + move || { x; } +} + +fn closure_ref_capture() -> impl Sized { //~ ERROR + let x = closure_ref_capture(); + move || { &x; } +} + +fn closure_sig() -> impl Sized { //~ ERROR + || closure_sig() +} + +fn generator_sig() -> impl Sized { //~ ERROR + || generator_sig() +} + +fn generator_capture() -> impl Sized { //~ ERROR + let x = generator_capture(); + move || { yield; x; } +} + +fn substs_change() -> impl Sized { //~ ERROR + (substs_change::<&T>(),) +} + +fn generator_hold() -> impl Sized { //~ ERROR + move || { + let x = generator_hold(); + yield; + x; + } +} + +async fn recursive_async_function() -> () { //~ ERROR + await!(recursive_async_function()); +} + +fn use_fn_ptr() -> impl Sized { // OK, error already reported + fn_ptr() +} + +fn mutual_recursion() -> impl Sync { //~ ERROR + mutual_recursion_b() +} + +fn mutual_recursion_b() -> impl Sized { //~ ERROR + mutual_recursion() +} + +fn main() {} diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type.stderr b/src/test/ui/impl-trait/recursive-impl-trait-type.stderr new file mode 100644 index 00000000000..8a878912057 --- /dev/null +++ b/src/test/ui/impl-trait/recursive-impl-trait-type.stderr @@ -0,0 +1,123 @@ +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:6:22 + | +LL | fn option(i: i32) -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `std::option::Option<(impl Sized, i32)>` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:14:15 + | +LL | fn tuple() -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `(impl Sized,)` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:18:15 + | +LL | fn array() -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `[impl Sized; 1]` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:22:13 + | +LL | fn ptr() -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `*const impl Sized` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:26:16 + | +LL | fn fn_ptr() -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `fn() -> impl Sized` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:30:25 + | +LL | fn closure_capture() -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `[closure@$DIR/recursive-impl-trait-type.rs:32:5: 32:19 x:impl Sized]` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:35:29 + | +LL | fn closure_ref_capture() -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `[closure@$DIR/recursive-impl-trait-type.rs:37:5: 37:20 x:impl Sized]` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:40:21 + | +LL | fn closure_sig() -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `[closure@$DIR/recursive-impl-trait-type.rs:41:5: 41:21]` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:44:23 + | +LL | fn generator_sig() -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `[closure@$DIR/recursive-impl-trait-type.rs:45:5: 45:23]` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:48:27 + | +LL | fn generator_capture() -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `[generator@$DIR/recursive-impl-trait-type.rs:50:5: 50:26 x:impl Sized {()}]` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:53:26 + | +LL | fn substs_change() -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `(impl Sized,)` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:57:24 + | +LL | fn generator_hold() -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: expanded type is `[generator@$DIR/recursive-impl-trait-type.rs:58:5: 62:6 {impl Sized, ()}]` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:65:40 + | +LL | async fn recursive_async_function() -> () { //~ ERROR + | ^^ expands to self-referential type + | + = note: expanded type is `std::future::GenFuture<[static generator@$DIR/recursive-impl-trait-type.rs:65:43: 67:2 {impl std::future::Future, ()}]>` + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:73:26 + | +LL | fn mutual_recursion() -> impl Sync { //~ ERROR + | ^^^^^^^^^ expands to self-referential type + | + = note: type resolves to itself + +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-impl-trait-type.rs:77:28 + | +LL | fn mutual_recursion_b() -> impl Sized { //~ ERROR + | ^^^^^^^^^^ expands to self-referential type + | + = note: type resolves to itself + +error: aborting due to 15 previous errors + +For more information about this error, try `rustc --explain E0720`. diff --git a/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs b/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs index 78ae922c751..cb40d90ae55 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // In contrast to `region-escape-via-bound-invariant`, in this case we // *can* return a value of type `&'x u32`, even though `'x` does not // appear in the bounds. This is because `&` is contravariant, and so diff --git a/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs b/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs index 972461c2ffd..e2310a3907f 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // In contrast to `region-escape-via-bound-invariant`, in this case we // *can* return a value of type `&'x u32`, even though `'x` does not // appear in the bounds. This is because `&` is contravariant, and so diff --git a/src/test/ui/impl-trait/region-escape-via-bound.rs b/src/test/ui/impl-trait/region-escape-via-bound.rs index c40c5f4cc31..d62aec800e8 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we do not allow the region `'x` to escape in the impl // trait **even though** `'y` escapes, which outlives `'x`. // diff --git a/src/test/ui/impl-trait/region-escape-via-bound.stderr b/src/test/ui/impl-trait/region-escape-via-bound.stderr index 92464a24301..81b44b7eba7 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.stderr +++ b/src/test/ui/impl-trait/region-escape-via-bound.stderr @@ -1,11 +1,11 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds - --> $DIR/region-escape-via-bound.rs:26:29 + --> $DIR/region-escape-via-bound.rs:16:29 | LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y> | ^^^^^^^^^^^^^^ | -note: hidden type `std::cell::Cell<&'x u32>` captures the lifetime 'x as defined on the function body at 28:7 - --> $DIR/region-escape-via-bound.rs:28:7 +note: hidden type `std::cell::Cell<&'x u32>` captures the lifetime 'x as defined on the function body at 18:7 + --> $DIR/region-escape-via-bound.rs:18:7 | LL | where 'x: 'y | ^^ diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.rs b/src/test/ui/impl-trait/static-return-lifetime-infered.rs index a05c8895282..96f3652c226 100644 --- a/src/test/ui/impl-trait/static-return-lifetime-infered.rs +++ b/src/test/ui/impl-trait/static-return-lifetime-infered.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct A { x: [(u32, u32); 10] } diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.stderr b/src/test/ui/impl-trait/static-return-lifetime-infered.stderr index 083ad03ff85..0bc0180e78a 100644 --- a/src/test/ui/impl-trait/static-return-lifetime-infered.stderr +++ b/src/test/ui/impl-trait/static-return-lifetime-infered.stderr @@ -1,5 +1,5 @@ error: cannot infer an appropriate lifetime - --> $DIR/static-return-lifetime-infered.rs:17:16 + --> $DIR/static-return-lifetime-infered.rs:7:16 | LL | fn iter_values_anon(&self) -> impl Iterator { | ----------------------- this return type evaluates to the `'static` lifetime... @@ -8,20 +8,20 @@ LL | self.x.iter().map(|a| a.0) | | | ...but this borrow... | -note: ...can't outlive the anonymous lifetime #1 defined on the method body at 16:5 - --> $DIR/static-return-lifetime-infered.rs:16:5 +note: ...can't outlive the anonymous lifetime #1 defined on the method body at 6:5 + --> $DIR/static-return-lifetime-infered.rs:6:5 | LL | / fn iter_values_anon(&self) -> impl Iterator { LL | | self.x.iter().map(|a| a.0) LL | | } | |_____^ -help: you can add a constraint to the return type to make it last less than `'static` and match the anonymous lifetime #1 defined on the method body at 16:5 +help: you can add a constraint to the return type to make it last less than `'static` and match the anonymous lifetime #1 defined on the method body at 6:5 | LL | fn iter_values_anon(&self) -> impl Iterator + '_ { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: cannot infer an appropriate lifetime - --> $DIR/static-return-lifetime-infered.rs:21:16 + --> $DIR/static-return-lifetime-infered.rs:11:16 | LL | fn iter_values<'a>(&'a self) -> impl Iterator { | ----------------------- this return type evaluates to the `'static` lifetime... @@ -30,12 +30,12 @@ LL | self.x.iter().map(|a| a.0) | | | ...but this borrow... | -note: ...can't outlive the lifetime 'a as defined on the method body at 20:20 - --> $DIR/static-return-lifetime-infered.rs:20:20 +note: ...can't outlive the lifetime 'a as defined on the method body at 10:20 + --> $DIR/static-return-lifetime-infered.rs:10:20 | LL | fn iter_values<'a>(&'a self) -> impl Iterator { | ^^ -help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime 'a as defined on the method body at 20:20 +help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime 'a as defined on the method body at 10:20 | LL | fn iter_values<'a>(&'a self) -> impl Iterator + 'a { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/trait_type.rs b/src/test/ui/impl-trait/trait_type.rs index 7eefa5c6006..638fefc46d1 100644 --- a/src/test/ui/impl-trait/trait_type.rs +++ b/src/test/ui/impl-trait/trait_type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct MyType; struct MyType2; struct MyType3; diff --git a/src/test/ui/impl-trait/trait_type.stderr b/src/test/ui/impl-trait/trait_type.stderr index c91ebb705de..a1f6b73abff 100644 --- a/src/test/ui/impl-trait/trait_type.stderr +++ b/src/test/ui/impl-trait/trait_type.stderr @@ -1,5 +1,5 @@ error[E0053]: method `fmt` has an incompatible type for trait - --> $DIR/trait_type.rs:17:4 + --> $DIR/trait_type.rs:7:4 | LL | fn fmt(&self, x: &str) -> () { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability @@ -8,7 +8,7 @@ LL | fn fmt(&self, x: &str) -> () { } found type `fn(&MyType, &str)` error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2 - --> $DIR/trait_type.rs:22:11 + --> $DIR/trait_type.rs:12:11 | LL | fn fmt(&self) -> () { } | ^^^^^ expected 2 parameters, found 1 @@ -16,7 +16,7 @@ LL | fn fmt(&self) -> () { } = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` error[E0186]: method `fmt` has a `&self` declaration in the trait, but not in the impl - --> $DIR/trait_type.rs:27:4 + --> $DIR/trait_type.rs:17:4 | LL | fn fmt() -> () { } | ^^^^^^^^^^^^^^ expected `&self` in impl @@ -24,7 +24,7 @@ LL | fn fmt() -> () { } = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` error[E0046]: not all trait items implemented, missing: `fmt` - --> $DIR/trait_type.rs:31:1 + --> $DIR/trait_type.rs:21:1 | LL | impl std::fmt::Display for MyType4 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation diff --git a/src/test/ui/impl-trait/type_parameters_captured.rs b/src/test/ui/impl-trait/type_parameters_captured.rs index 7c3430ab90e..6c9c9d4a42a 100644 --- a/src/test/ui/impl-trait/type_parameters_captured.rs +++ b/src/test/ui/impl-trait/type_parameters_captured.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Debug; trait Any {} diff --git a/src/test/ui/impl-trait/type_parameters_captured.stderr b/src/test/ui/impl-trait/type_parameters_captured.stderr index 3b9b0e08a45..708b479ab17 100644 --- a/src/test/ui/impl-trait/type_parameters_captured.stderr +++ b/src/test/ui/impl-trait/type_parameters_captured.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/type_parameters_captured.rs:17:20 + --> $DIR/type_parameters_captured.rs:7:20 | LL | fn foo(x: T) -> impl Any + 'static { | - ^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | fn foo(x: T) -> impl Any + 'static { | help: consider adding an explicit lifetime bound `T: 'static`... | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/type_parameters_captured.rs:17:20 + --> $DIR/type_parameters_captured.rs:7:20 | LL | fn foo(x: T) -> impl Any + 'static { | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/universal-issue-48703.rs b/src/test/ui/impl-trait/universal-issue-48703.rs index e017b37b7b7..e434e10bf89 100644 --- a/src/test/ui/impl-trait/universal-issue-48703.rs +++ b/src/test/ui/impl-trait/universal-issue-48703.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(universal_impl_trait)] use std::fmt::Debug; diff --git a/src/test/ui/impl-trait/universal-issue-48703.stderr b/src/test/ui/impl-trait/universal-issue-48703.stderr index ea509684f9e..920b44fc909 100644 --- a/src/test/ui/impl-trait/universal-issue-48703.stderr +++ b/src/test/ui/impl-trait/universal-issue-48703.stderr @@ -1,5 +1,5 @@ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. - --> $DIR/universal-issue-48703.rs:18:5 + --> $DIR/universal-issue-48703.rs:8:5 | LL | foo::('a'); //~ ERROR cannot provide explicit type parameters | ^^^^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/universal-mismatched-type.rs b/src/test/ui/impl-trait/universal-mismatched-type.rs index 6a62eb36c30..e9129bbd713 100644 --- a/src/test/ui/impl-trait/universal-mismatched-type.rs +++ b/src/test/ui/impl-trait/universal-mismatched-type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Debug; fn foo(x: impl Debug) -> String { diff --git a/src/test/ui/impl-trait/universal-mismatched-type.stderr b/src/test/ui/impl-trait/universal-mismatched-type.stderr index 031db511ff3..55e1216d3a8 100644 --- a/src/test/ui/impl-trait/universal-mismatched-type.stderr +++ b/src/test/ui/impl-trait/universal-mismatched-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/universal-mismatched-type.rs:14:5 + --> $DIR/universal-mismatched-type.rs:4:5 | LL | fn foo(x: impl Debug) -> String { | ------ expected `std::string::String` because of return type diff --git a/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.rs b/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.rs index ac53612d2da..d3d561621fc 100644 --- a/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.rs +++ b/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::any::Any; pub struct EventHandler { } diff --git a/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.stderr b/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.stderr index fec3f78535d..b7fc4d149e3 100644 --- a/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.stderr +++ b/src/test/ui/impl-trait/universal-turbofish-in-method-issue-50950.stderr @@ -1,5 +1,5 @@ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. - --> $DIR/universal-turbofish-in-method-issue-50950.rs:24:9 + --> $DIR/universal-turbofish-in-method-issue-50950.rs:14:9 | LL | evt.handle_event::(|_evt| { | ^^^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/universal-two-impl-traits.rs b/src/test/ui/impl-trait/universal-two-impl-traits.rs index 5ecef1fee65..1ed47d8f49e 100644 --- a/src/test/ui/impl-trait/universal-two-impl-traits.rs +++ b/src/test/ui/impl-trait/universal-two-impl-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Debug; fn foo(x: impl Debug, y: impl Debug) -> String { diff --git a/src/test/ui/impl-trait/universal-two-impl-traits.stderr b/src/test/ui/impl-trait/universal-two-impl-traits.stderr index ed406895fc6..43bf2862fee 100644 --- a/src/test/ui/impl-trait/universal-two-impl-traits.stderr +++ b/src/test/ui/impl-trait/universal-two-impl-traits.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/universal-two-impl-traits.rs:15:9 + --> $DIR/universal-two-impl-traits.rs:5:9 | LL | a = y; //~ ERROR mismatched | ^ expected type parameter, found a different type parameter diff --git a/src/test/ui/impl-trait/universal_wrong_bounds.rs b/src/test/ui/impl-trait/universal_wrong_bounds.rs index 63d000c0568..56a13ea257e 100644 --- a/src/test/ui/impl-trait/universal_wrong_bounds.rs +++ b/src/test/ui/impl-trait/universal_wrong_bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Display; fn foo(f: impl Display + Clone) -> String { diff --git a/src/test/ui/impl-trait/universal_wrong_bounds.stderr b/src/test/ui/impl-trait/universal_wrong_bounds.stderr index 68a318e2ac4..f0b685bd5ee 100644 --- a/src/test/ui/impl-trait/universal_wrong_bounds.stderr +++ b/src/test/ui/impl-trait/universal_wrong_bounds.stderr @@ -1,5 +1,5 @@ error[E0405]: cannot find trait `Debug` in this scope - --> $DIR/universal_wrong_bounds.rs:19:24 + --> $DIR/universal_wrong_bounds.rs:9:24 | LL | fn wants_debug(g: impl Debug) { } //~ ERROR cannot find | ^^^^^ not found in this scope @@ -9,7 +9,7 @@ LL | use std::fmt::Debug; | error[E0405]: cannot find trait `Debug` in this scope - --> $DIR/universal_wrong_bounds.rs:20:26 + --> $DIR/universal_wrong_bounds.rs:10:26 | LL | fn wants_display(g: impl Debug) { } //~ ERROR cannot find | ^^^^^ not found in this scope diff --git a/src/test/ui/impl-trait/where-allowed.rs b/src/test/ui/impl-trait/where-allowed.rs index 4c5592c119c..31bc9f449a0 100644 --- a/src/test/ui/impl-trait/where-allowed.rs +++ b/src/test/ui/impl-trait/where-allowed.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A simple test for testing many permutations of allowedness of //! impl Trait use std::fmt::Debug; diff --git a/src/test/ui/impl-trait/where-allowed.stderr b/src/test/ui/impl-trait/where-allowed.stderr index c43271c7371..7218e829229 100644 --- a/src/test/ui/impl-trait/where-allowed.stderr +++ b/src/test/ui/impl-trait/where-allowed.stderr @@ -1,5 +1,5 @@ error[E0666]: nested `impl Trait` is not allowed - --> $DIR/where-allowed.rs:60:51 + --> $DIR/where-allowed.rs:50:51 | LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() } | --------^^^^^^^^^^- @@ -8,7 +8,7 @@ LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() } | outer `impl Trait` error[E0666]: nested `impl Trait` is not allowed - --> $DIR/where-allowed.rs:69:57 + --> $DIR/where-allowed.rs:59:57 | LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() } | --------^^^^^^^^^^- @@ -17,217 +17,217 @@ LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic | outer `impl Trait` error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:28:40 + --> $DIR/where-allowed.rs:18:40 | LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:32:42 + --> $DIR/where-allowed.rs:22:42 | LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:36:38 + --> $DIR/where-allowed.rs:26:38 | LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:40:40 + --> $DIR/where-allowed.rs:30:40 | LL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:44:49 + --> $DIR/where-allowed.rs:34:49 | LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:48:51 + --> $DIR/where-allowed.rs:38:51 | LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:52:55 + --> $DIR/where-allowed.rs:42:55 | LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:56:57 + --> $DIR/where-allowed.rs:46:57 | LL | fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:60:51 + --> $DIR/where-allowed.rs:50:51 | LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:65:53 + --> $DIR/where-allowed.rs:55:53 | LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:69:57 + --> $DIR/where-allowed.rs:59:57 | LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:74:59 + --> $DIR/where-allowed.rs:64:59 | LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:78:38 + --> $DIR/where-allowed.rs:68:38 | LL | fn in_Fn_parameter_in_generics (_: F) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:82:40 + --> $DIR/where-allowed.rs:72:40 | LL | fn in_Fn_return_in_generics impl Debug> (_: F) { panic!() } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:95:32 + --> $DIR/where-allowed.rs:85:32 | LL | struct InBraceStructField { x: impl Debug } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:99:41 + --> $DIR/where-allowed.rs:89:41 | LL | struct InAdtInBraceStructField { x: Vec } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:103:27 + --> $DIR/where-allowed.rs:93:27 | LL | struct InTupleStructField(impl Debug); | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:108:25 + --> $DIR/where-allowed.rs:98:25 | LL | InBraceVariant { x: impl Debug }, | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:110:20 + --> $DIR/where-allowed.rs:100:20 | LL | InTupleVariant(impl Debug), | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:121:23 + --> $DIR/where-allowed.rs:111:23 | LL | fn in_return() -> impl Debug; | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:132:16 + --> $DIR/where-allowed.rs:122:16 | LL | type Out = impl Debug; | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:138:34 + --> $DIR/where-allowed.rs:128:34 | LL | fn in_trait_impl_return() -> impl Debug { () } | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:151:33 + --> $DIR/where-allowed.rs:141:33 | LL | fn in_foreign_parameters(_: impl Debug); | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:154:31 + --> $DIR/where-allowed.rs:144:31 | LL | fn in_foreign_return() -> impl Debug; | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:167:23 + --> $DIR/where-allowed.rs:157:23 | LL | type InTypeAlias = impl Debug; | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:170:39 + --> $DIR/where-allowed.rs:160:39 | LL | type InReturnInTypeAlias = fn() -> impl Debug; | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:174:16 + --> $DIR/where-allowed.rs:164:16 | LL | impl PartialEq for () { | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:179:24 + --> $DIR/where-allowed.rs:169:24 | LL | impl PartialEq<()> for impl Debug { | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:184:6 + --> $DIR/where-allowed.rs:174:6 | LL | impl impl Debug { | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:190:24 + --> $DIR/where-allowed.rs:180:24 | LL | impl InInherentImplAdt { | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:196:11 + --> $DIR/where-allowed.rs:186:11 | LL | where impl Debug: Debug | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:203:15 + --> $DIR/where-allowed.rs:193:15 | LL | where Vec: Debug | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:210:24 + --> $DIR/where-allowed.rs:200:24 | LL | where T: PartialEq | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:217:17 + --> $DIR/where-allowed.rs:207:17 | LL | where T: Fn(impl Debug) | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:224:22 + --> $DIR/where-allowed.rs:214:22 | LL | where T: Fn() -> impl Debug | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:230:29 + --> $DIR/where-allowed.rs:220:29 | LL | let _in_local_variable: impl Fn() = || {}; | ^^^^^^^^^ @@ -235,7 +235,7 @@ LL | let _in_local_variable: impl Fn() = || {}; = help: add #![feature(impl_trait_in_bindings)] to the crate attributes to enable error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/where-allowed.rs:232:46 + --> $DIR/where-allowed.rs:222:46 | LL | let _in_return_in_local_variable = || -> impl Fn() { || {} }; | ^^^^^^^^^ diff --git a/src/test/ui/impl-unused-rps-in-assoc-type.rs b/src/test/ui/impl-unused-rps-in-assoc-type.rs index 23401db21d8..ea41997a698 100644 --- a/src/test/ui/impl-unused-rps-in-assoc-type.rs +++ b/src/test/ui/impl-unused-rps-in-assoc-type.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that lifetime parameters must be constrained if they appear in // an associated type def'n. Issue #22077. diff --git a/src/test/ui/impl-unused-rps-in-assoc-type.stderr b/src/test/ui/impl-unused-rps-in-assoc-type.stderr index 1f7f790b1e4..80fc0504558 100644 --- a/src/test/ui/impl-unused-rps-in-assoc-type.stderr +++ b/src/test/ui/impl-unused-rps-in-assoc-type.stderr @@ -1,5 +1,5 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-rps-in-assoc-type.rs:21:6 + --> $DIR/impl-unused-rps-in-assoc-type.rs:11:6 | LL | impl<'a> Fun for Holder { //~ ERROR E0207 | ^^ unconstrained lifetime parameter diff --git a/src/test/ui/impl-unused-tps-inherent.rs b/src/test/ui/impl-unused-tps-inherent.rs index 3803bb9b045..83a228e551a 100644 --- a/src/test/ui/impl-unused-tps-inherent.rs +++ b/src/test/ui/impl-unused-tps-inherent.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct MyType; struct MyType1(T); diff --git a/src/test/ui/impl-unused-tps-inherent.stderr b/src/test/ui/impl-unused-tps-inherent.stderr index c1f31deb858..43f63cf968c 100644 --- a/src/test/ui/impl-unused-tps-inherent.stderr +++ b/src/test/ui/impl-unused-tps-inherent.stderr @@ -1,11 +1,11 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-tps-inherent.rs:19:6 + --> $DIR/impl-unused-tps-inherent.rs:9:6 | LL | impl MyType { | ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-tps-inherent.rs:27:8 + --> $DIR/impl-unused-tps-inherent.rs:17:8 | LL | impl MyType1 { | ^ unconstrained type parameter diff --git a/src/test/ui/impl-unused-tps.rs b/src/test/ui/impl-unused-tps.rs index c9399afbb93..7cc1ae613bc 100644 --- a/src/test/ui/impl-unused-tps.rs +++ b/src/test/ui/impl-unused-tps.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn get(&self, A: &A) { } } diff --git a/src/test/ui/impl-unused-tps.stderr b/src/test/ui/impl-unused-tps.stderr index f50cc00b2f6..053ab91c893 100644 --- a/src/test/ui/impl-unused-tps.stderr +++ b/src/test/ui/impl-unused-tps.stderr @@ -1,29 +1,29 @@ error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-tps.rs:23:8 + --> $DIR/impl-unused-tps.rs:13:8 | LL | impl Foo for [isize;1] { | ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-tps.rs:40:8 + --> $DIR/impl-unused-tps.rs:30:8 | LL | impl Bar for T { | ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-tps.rs:48:8 + --> $DIR/impl-unused-tps.rs:38:8 | LL | impl Bar for T | ^ unconstrained type parameter error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-tps.rs:56:8 + --> $DIR/impl-unused-tps.rs:46:8 | LL | impl Foo for T | ^ unconstrained type parameter error[E0207]: the type parameter `V` is not constrained by the impl trait, self type, or predicates - --> $DIR/impl-unused-tps.rs:56:10 + --> $DIR/impl-unused-tps.rs:46:10 | LL | impl Foo for T | ^ unconstrained type parameter diff --git a/src/test/ui/implicit-method-bind.rs b/src/test/ui/implicit-method-bind.rs index e116966670d..5e27516a89a 100644 --- a/src/test/ui/implicit-method-bind.rs +++ b/src/test/ui/implicit-method-bind.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let _f = 10i32.abs; //~ ERROR attempted to take value of method } diff --git a/src/test/ui/implicit-method-bind.stderr b/src/test/ui/implicit-method-bind.stderr index 5de9e58807c..7c70709c6b9 100644 --- a/src/test/ui/implicit-method-bind.stderr +++ b/src/test/ui/implicit-method-bind.stderr @@ -1,10 +1,8 @@ error[E0615]: attempted to take value of method `abs` on type `i32` - --> $DIR/implicit-method-bind.rs:12:20 + --> $DIR/implicit-method-bind.rs:2:20 | LL | let _f = 10i32.abs; //~ ERROR attempted to take value of method - | ^^^ - | - = help: maybe a `()` to call it is missing? + | ^^^ help: use parentheses to call the method: `abs()` error: aborting due to previous error diff --git a/src/test/ui/import.rs b/src/test/ui/import.rs index 81a5334ed7a..540258daaec 100644 --- a/src/test/ui/import.rs +++ b/src/test/ui/import.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use zed::bar; use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432] //~^ no `baz` in `zed`. Did you mean to use `bar`? diff --git a/src/test/ui/import.stderr b/src/test/ui/import.stderr index 4cd559f5f4a..737d10cdecb 100644 --- a/src/test/ui/import.stderr +++ b/src/test/ui/import.stderr @@ -1,17 +1,17 @@ error[E0432]: unresolved import `zed::baz` - --> $DIR/import.rs:12:5 + --> $DIR/import.rs:2:5 | LL | use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432] | ^^^^^^^^ no `baz` in `zed`. Did you mean to use `bar`? error[E0432]: unresolved import `foo` - --> $DIR/import.rs:18:9 + --> $DIR/import.rs:8:9 | LL | use foo; //~ ERROR unresolved import `foo` [E0432] | ^^^ no `foo` in the root error[E0603]: unresolved item `foo` is private - --> $DIR/import.rs:23:10 + --> $DIR/import.rs:13:10 | LL | zed::foo(); //~ ERROR `foo` is private | ^^^ diff --git a/src/test/ui/import2.rs b/src/test/ui/import2.rs index d3bbdf15cd0..036d6bc07e2 100644 --- a/src/test/ui/import2.rs +++ b/src/test/ui/import2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use baz::zed::bar; //~ ERROR unresolved import `baz::zed` [E0432] //~^ could not find `zed` in `baz` diff --git a/src/test/ui/import2.stderr b/src/test/ui/import2.stderr index b1973937701..f0509204f2c 100644 --- a/src/test/ui/import2.stderr +++ b/src/test/ui/import2.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `baz::zed` - --> $DIR/import2.rs:11:10 + --> $DIR/import2.rs:1:10 | LL | use baz::zed::bar; //~ ERROR unresolved import `baz::zed` [E0432] | ^^^ could not find `zed` in `baz` diff --git a/src/test/ui/import3.rs b/src/test/ui/import3.rs index 0a7827587a6..2c6ac9a00e1 100644 --- a/src/test/ui/import3.rs +++ b/src/test/ui/import3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: unresolved use main::bar; diff --git a/src/test/ui/import3.stderr b/src/test/ui/import3.stderr index a4c367fb073..73b9b27b57c 100644 --- a/src/test/ui/import3.stderr +++ b/src/test/ui/import3.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `main` - --> $DIR/import3.rs:12:5 + --> $DIR/import3.rs:2:5 | LL | use main::bar; | ^^^^ maybe a missing `extern crate main;`? diff --git a/src/test/ui/import4.rs b/src/test/ui/import4.rs index 5f3163e9390..ba3b7fbf535 100644 --- a/src/test/ui/import4.rs +++ b/src/test/ui/import4.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: import diff --git a/src/test/ui/import4.stderr b/src/test/ui/import4.stderr index d74e781ad4a..e0b478f1aec 100644 --- a/src/test/ui/import4.stderr +++ b/src/test/ui/import4.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `a::foo` - --> $DIR/import4.rs:15:17 + --> $DIR/import4.rs:5:17 | LL | mod b { pub use a::foo; } | ^^^^^^ no `foo` in `a` diff --git a/src/test/ui/imports/auxiliary/glob-conflict.rs b/src/test/ui/imports/auxiliary/glob-conflict.rs index ac12ed9c81c..c83db64c643 100644 --- a/src/test/ui/imports/auxiliary/glob-conflict.rs +++ b/src/test/ui/imports/auxiliary/glob-conflict.rs @@ -7,3 +7,7 @@ mod m2 { pub use m1::*; pub use m2::*; + +pub mod glob { + pub use *; +} diff --git a/src/test/ui/imports/auxiliary/import_crate_var.rs b/src/test/ui/imports/auxiliary/import_crate_var.rs index a8a55afa41a..a273b103a1b 100644 --- a/src/test/ui/imports/auxiliary/import_crate_var.rs +++ b/src/test/ui/imports/auxiliary/import_crate_var.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn f() {} #[macro_export] diff --git a/src/test/ui/imports/auxiliary/issue-55811.rs b/src/test/ui/imports/auxiliary/issue-55811.rs new file mode 100644 index 00000000000..877e4cdb0bd --- /dev/null +++ b/src/test/ui/imports/auxiliary/issue-55811.rs @@ -0,0 +1,5 @@ +mod m {} + +// These two imports should not conflict when this crate is loaded from some other crate. +use m::{}; +use m::{}; diff --git a/src/test/ui/imports/auxiliary/issue-56125.rs b/src/test/ui/imports/auxiliary/issue-56125.rs new file mode 100644 index 00000000000..8e079758297 --- /dev/null +++ b/src/test/ui/imports/auxiliary/issue-56125.rs @@ -0,0 +1,11 @@ +pub mod issue_56125 {} + +pub mod last_segment { + pub mod issue_56125 {} +} + +pub mod non_last_segment { + pub mod non_last_segment { + pub mod issue_56125 {} + } +} diff --git a/src/test/ui/imports/auxiliary/two_macros.rs b/src/test/ui/imports/auxiliary/two_macros.rs index 2ac8e3ef983..92c211467d8 100644 --- a/src/test/ui/imports/auxiliary/two_macros.rs +++ b/src/test/ui/imports/auxiliary/two_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! m { ($($t:tt)*) => { $($t)* } } diff --git a/src/test/ui/imports/duplicate.rs b/src/test/ui/imports/duplicate.rs index dd2dcbe2e68..db6538969ec 100644 --- a/src/test/ui/imports/duplicate.rs +++ b/src/test/ui/imports/duplicate.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { pub fn foo() {} } @@ -43,11 +33,11 @@ mod g { fn main() { e::foo(); f::foo(); //~ ERROR `foo` is ambiguous - g::foo(); //~ ERROR `foo` is ambiguous + g::foo(); } mod ambiguous_module_errors { - pub mod m1 { pub use super::m1 as foo; } + pub mod m1 { pub use super::m1 as foo; pub fn bar() {} } pub mod m2 { pub use super::m2 as foo; } use self::m1::*; diff --git a/src/test/ui/imports/duplicate.stderr b/src/test/ui/imports/duplicate.stderr index f53ba9cd5de..acd66826fdf 100644 --- a/src/test/ui/imports/duplicate.stderr +++ b/src/test/ui/imports/duplicate.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `foo` is defined multiple times - --> $DIR/duplicate.rs:25:9 + --> $DIR/duplicate.rs:15:9 | LL | use a::foo; | ------ previous import of the value `foo` here @@ -13,82 +13,63 @@ LL | use a::foo as other_foo; //~ ERROR the name `foo` is defined multiple t | ^^^^^^^^^^^^^^^^^^^ error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) - --> $DIR/duplicate.rs:56:15 + --> $DIR/duplicate.rs:46:15 | LL | use self::foo::bar; //~ ERROR `foo` is ambiguous | ^^^ ambiguous name | note: `foo` could refer to the module imported here - --> $DIR/duplicate.rs:53:9 + --> $DIR/duplicate.rs:43:9 | LL | use self::m1::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate note: `foo` could also refer to the module imported here - --> $DIR/duplicate.rs:54:9 + --> $DIR/duplicate.rs:44:9 | LL | use self::m2::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) - --> $DIR/duplicate.rs:45:8 + --> $DIR/duplicate.rs:35:8 | LL | f::foo(); //~ ERROR `foo` is ambiguous | ^^^ ambiguous name | note: `foo` could refer to the function imported here - --> $DIR/duplicate.rs:34:13 + --> $DIR/duplicate.rs:24:13 | LL | pub use a::*; | ^^^^ = help: consider adding an explicit import of `foo` to disambiguate note: `foo` could also refer to the function imported here - --> $DIR/duplicate.rs:35:13 + --> $DIR/duplicate.rs:25:13 | LL | pub use b::*; | ^^^^ = help: consider adding an explicit import of `foo` to disambiguate error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) - --> $DIR/duplicate.rs:46:8 - | -LL | g::foo(); //~ ERROR `foo` is ambiguous - | ^^^ ambiguous name - | -note: `foo` could refer to the function imported here - --> $DIR/duplicate.rs:39:13 - | -LL | pub use a::*; - | ^^^^ - = help: consider adding an explicit import of `foo` to disambiguate -note: `foo` could also refer to the unresolved item imported here - --> $DIR/duplicate.rs:40:13 - | -LL | pub use f::*; - | ^^^^ - = help: consider adding an explicit import of `foo` to disambiguate - -error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) - --> $DIR/duplicate.rs:59:9 + --> $DIR/duplicate.rs:49:9 | LL | foo::bar(); //~ ERROR `foo` is ambiguous | ^^^ ambiguous name | note: `foo` could refer to the module imported here - --> $DIR/duplicate.rs:53:9 + --> $DIR/duplicate.rs:43:9 | LL | use self::m1::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate note: `foo` could also refer to the module imported here - --> $DIR/duplicate.rs:54:9 + --> $DIR/duplicate.rs:44:9 | LL | use self::m2::*; | ^^^^^^^^^^^ = help: consider adding an explicit import of `foo` to disambiguate -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors Some errors occurred: E0252, E0659. For more information about an error, try `rustc --explain E0252`. diff --git a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.rs b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.rs new file mode 100644 index 00000000000..defa0e294bd --- /dev/null +++ b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.rs @@ -0,0 +1,6 @@ +extern crate self; //~ ERROR `extern crate self;` requires renaming + +#[macro_use] //~ ERROR `macro_use` is not supported on `extern crate self` +extern crate self as foo; + +fn main() {} diff --git a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr new file mode 100644 index 00000000000..b47d10343f6 --- /dev/null +++ b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr @@ -0,0 +1,14 @@ +error: `extern crate self;` requires renaming + --> $DIR/extern-crate-self-fail.rs:1:1 + | +LL | extern crate self; //~ ERROR `extern crate self;` requires renaming + | ^^^^^^^^^^^^^^^^^^ help: try: `extern crate self as name;` + +error: `macro_use` is not supported on `extern crate self` + --> $DIR/extern-crate-self-fail.rs:3:1 + | +LL | #[macro_use] //~ ERROR `macro_use` is not supported on `extern crate self` + | ^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/imports/extern-crate-self/extern-crate-self-macro-alias.rs b/src/test/ui/imports/extern-crate-self/extern-crate-self-macro-alias.rs new file mode 100644 index 00000000000..79683522888 --- /dev/null +++ b/src/test/ui/imports/extern-crate-self/extern-crate-self-macro-alias.rs @@ -0,0 +1,16 @@ +// run-pass + +// Test that a macro can correctly expand the alias +// in an `extern crate self as ALIAS` item. + +fn the_answer() -> usize { 42 } + +macro_rules! alias_self { + ($alias:ident) => { extern crate self as $alias; } +} + +alias_self!(the_alias); + +fn main() { + assert_eq!(the_alias::the_answer(), 42); +} diff --git a/src/test/ui/imports/extern-crate-self/extern-crate-self-macro-item.rs b/src/test/ui/imports/extern-crate-self/extern-crate-self-macro-item.rs new file mode 100644 index 00000000000..9c9397999ff --- /dev/null +++ b/src/test/ui/imports/extern-crate-self/extern-crate-self-macro-item.rs @@ -0,0 +1,12 @@ +// compile-pass + +// Test that `extern crate self;` is accepted +// syntactically as an item for use in a macro. + +macro_rules! accept_item { ($x:item) => {} } + +accept_item! { + extern crate self; +} + +fn main() {} diff --git a/src/test/ui/imports/extern-crate-self/extern-crate-self-macro-self.rs b/src/test/ui/imports/extern-crate-self/extern-crate-self-macro-self.rs new file mode 100644 index 00000000000..009a92e8776 --- /dev/null +++ b/src/test/ui/imports/extern-crate-self/extern-crate-self-macro-self.rs @@ -0,0 +1,16 @@ +// run-pass + +// Test that a macro can correctly expand `self` in +// an `extern crate self as ALIAS` item. + +fn the_answer() -> usize { 42 } + +macro_rules! extern_something { + ($alias:ident) => { extern crate $alias as the_alias; } +} + +extern_something!(self); + +fn main() { + assert_eq!(the_alias::the_answer(), 42); +} diff --git a/src/test/ui/imports/extern-crate-self/extern-crate-self-pass.rs b/src/test/ui/imports/extern-crate-self/extern-crate-self-pass.rs new file mode 100644 index 00000000000..6f6343a6148 --- /dev/null +++ b/src/test/ui/imports/extern-crate-self/extern-crate-self-pass.rs @@ -0,0 +1,13 @@ +// compile-pass + +extern crate self as foo; + +struct S; + +mod m { + fn check() { + foo::S; // OK + } +} + +fn main() {} diff --git a/src/test/ui/imports/extern-crate-used.rs b/src/test/ui/imports/extern-crate-used.rs new file mode 100644 index 00000000000..2d91cbc00f2 --- /dev/null +++ b/src/test/ui/imports/extern-crate-used.rs @@ -0,0 +1,28 @@ +// Extern crate items are marked as used if they are used +// through extern prelude entries introduced by them. + +// edition:2018 + +#![deny(unused_extern_crates)] + +extern crate core as iso1; //~ ERROR `extern crate` is not idiomatic in the new edition +extern crate core as iso2; //~ ERROR `extern crate` is not idiomatic in the new edition +extern crate core as iso3; //~ ERROR `extern crate` is not idiomatic in the new edition +extern crate core as iso4; //~ ERROR `extern crate` is not idiomatic in the new edition + +// Doesn't introduce its extern prelude entry, so it's still considered unused. +extern crate core; //~ ERROR unused extern crate + +mod m { + use iso1::any as are_you_okay1; + use ::iso2::any as are_you_okay2; + type AreYouOkay1 = iso3::any::Any; + type AreYouOkay2 = ::iso4::any::Any; + + use core::any as are_you_okay3; + use ::core::any as are_you_okay4; + type AreYouOkay3 = core::any::Any; + type AreYouOkay4 = ::core::any::Any; +} + +fn main() {} diff --git a/src/test/ui/imports/extern-crate-used.stderr b/src/test/ui/imports/extern-crate-used.stderr new file mode 100644 index 00000000000..3f9aab9dc79 --- /dev/null +++ b/src/test/ui/imports/extern-crate-used.stderr @@ -0,0 +1,38 @@ +error: `extern crate` is not idiomatic in the new edition + --> $DIR/extern-crate-used.rs:8:1 + | +LL | extern crate core as iso1; //~ ERROR `extern crate` is not idiomatic in the new edition + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` + | +note: lint level defined here + --> $DIR/extern-crate-used.rs:6:9 + | +LL | #![deny(unused_extern_crates)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: `extern crate` is not idiomatic in the new edition + --> $DIR/extern-crate-used.rs:9:1 + | +LL | extern crate core as iso2; //~ ERROR `extern crate` is not idiomatic in the new edition + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` + +error: `extern crate` is not idiomatic in the new edition + --> $DIR/extern-crate-used.rs:10:1 + | +LL | extern crate core as iso3; //~ ERROR `extern crate` is not idiomatic in the new edition + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` + +error: `extern crate` is not idiomatic in the new edition + --> $DIR/extern-crate-used.rs:11:1 + | +LL | extern crate core as iso4; //~ ERROR `extern crate` is not idiomatic in the new edition + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` + +error: unused extern crate + --> $DIR/extern-crate-used.rs:14:1 + | +LL | extern crate core; //~ ERROR unused extern crate + | ^^^^^^^^^^^^^^^^^^ help: remove it + +error: aborting due to 5 previous errors + diff --git a/src/test/ui/imports/glob-conflict-cross-crate.rs b/src/test/ui/imports/glob-conflict-cross-crate.rs index e02148b19f7..c8b18525d80 100644 --- a/src/test/ui/imports/glob-conflict-cross-crate.rs +++ b/src/test/ui/imports/glob-conflict-cross-crate.rs @@ -4,4 +4,5 @@ extern crate glob_conflict; fn main() { glob_conflict::f(); //~ ERROR cannot find function `f` in module `glob_conflict` + glob_conflict::glob::f(); //~ ERROR cannot find function `f` in module `glob_conflict::glob` } diff --git a/src/test/ui/imports/glob-conflict-cross-crate.stderr b/src/test/ui/imports/glob-conflict-cross-crate.stderr index f64637fd6f6..f5a82ef1b3b 100644 --- a/src/test/ui/imports/glob-conflict-cross-crate.stderr +++ b/src/test/ui/imports/glob-conflict-cross-crate.stderr @@ -4,6 +4,12 @@ error[E0425]: cannot find function `f` in module `glob_conflict` LL | glob_conflict::f(); //~ ERROR cannot find function `f` in module `glob_conflict` | ^ not found in `glob_conflict` -error: aborting due to previous error +error[E0425]: cannot find function `f` in module `glob_conflict::glob` + --> $DIR/glob-conflict-cross-crate.rs:7:26 + | +LL | glob_conflict::glob::f(); //~ ERROR cannot find function `f` in module `glob_conflict::glob` + | ^ not found in `glob_conflict::glob` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/imports/glob-shadowing.rs b/src/test/ui/imports/glob-shadowing.rs index e4f55137e66..3a33b592b00 100644 --- a/src/test/ui/imports/glob-shadowing.rs +++ b/src/test/ui/imports/glob-shadowing.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] mod m { diff --git a/src/test/ui/imports/glob-shadowing.stderr b/src/test/ui/imports/glob-shadowing.stderr index 6a4774facd7..c43ab00e718 100644 --- a/src/test/ui/imports/glob-shadowing.stderr +++ b/src/test/ui/imports/glob-shadowing.stderr @@ -1,12 +1,12 @@ error[E0659]: `env` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) - --> $DIR/glob-shadowing.rs:21:17 + --> $DIR/glob-shadowing.rs:11:17 | LL | let x = env!("PATH"); //~ ERROR `env` is ambiguous | ^^^ ambiguous name | = note: `env` could refer to a built-in macro note: `env` could also refer to the macro imported here - --> $DIR/glob-shadowing.rs:19:9 + --> $DIR/glob-shadowing.rs:9:9 | LL | use m::*; | ^^^^ @@ -14,33 +14,33 @@ LL | use m::*; = help: or use `self::env` to refer to this macro unambiguously error[E0659]: `env` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) - --> $DIR/glob-shadowing.rs:29:21 + --> $DIR/glob-shadowing.rs:19:21 | LL | let x = env!("PATH"); //~ ERROR `env` is ambiguous | ^^^ ambiguous name | = note: `env` could refer to a built-in macro note: `env` could also refer to the macro imported here - --> $DIR/glob-shadowing.rs:27:13 + --> $DIR/glob-shadowing.rs:17:13 | LL | use m::*; | ^^^^ = help: consider adding an explicit import of `env` to disambiguate error[E0659]: `fenv` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) - --> $DIR/glob-shadowing.rs:39:21 + --> $DIR/glob-shadowing.rs:29:21 | LL | let x = fenv!(); //~ ERROR `fenv` is ambiguous | ^^^^ ambiguous name | note: `fenv` could refer to the macro imported here - --> $DIR/glob-shadowing.rs:37:13 + --> $DIR/glob-shadowing.rs:27:13 | LL | use m::*; | ^^^^ = help: consider adding an explicit import of `fenv` to disambiguate note: `fenv` could also refer to the macro defined here - --> $DIR/glob-shadowing.rs:35:5 + --> $DIR/glob-shadowing.rs:25:5 | LL | pub macro fenv($e: expr) { $e } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/imports/import-crate-var.rs b/src/test/ui/imports/import-crate-var.rs index 663e1379b40..ab260500bb3 100644 --- a/src/test/ui/imports/import-crate-var.rs +++ b/src/test/ui/imports/import-crate-var.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:import_crate_var.rs // compile-pass diff --git a/src/test/ui/imports/import-crate-var.stderr b/src/test/ui/imports/import-crate-var.stderr index ce4ffe796f3..928256543bc 100644 --- a/src/test/ui/imports/import-crate-var.stderr +++ b/src/test/ui/imports/import-crate-var.stderr @@ -1,5 +1,5 @@ warning: `$crate` may not be imported - --> $DIR/import-crate-var.rs:19:5 + --> $DIR/import-crate-var.rs:9:5 | LL | m!(); | ^^^^^ diff --git a/src/test/ui/imports/import-from-missing.rs b/src/test/ui/imports/import-from-missing.rs index 220b255bde4..8eae700208f 100644 --- a/src/test/ui/imports/import-from-missing.rs +++ b/src/test/ui/imports/import-from-missing.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use spam::{ham, eggs}; //~ ERROR unresolved import `spam::eggs` [E0432] //~^ no `eggs` in `spam` diff --git a/src/test/ui/imports/import-from-missing.stderr b/src/test/ui/imports/import-from-missing.stderr index 1b40fe45c7f..0524b167564 100644 --- a/src/test/ui/imports/import-from-missing.stderr +++ b/src/test/ui/imports/import-from-missing.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `spam::eggs` - --> $DIR/import-from-missing.rs:11:17 + --> $DIR/import-from-missing.rs:1:17 | LL | use spam::{ham, eggs}; //~ ERROR unresolved import `spam::eggs` [E0432] | ^^^^ no `eggs` in `spam` diff --git a/src/test/ui/imports/import-glob-0.rs b/src/test/ui/imports/import-glob-0.rs index 774eaf174d9..37a0d15456c 100644 --- a/src/test/ui/imports/import-glob-0.rs +++ b/src/test/ui/imports/import-glob-0.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use module_of_many_things::*; mod module_of_many_things { diff --git a/src/test/ui/imports/import-glob-0.stderr b/src/test/ui/imports/import-glob-0.stderr index 91cae30776d..4fecf80bff2 100644 --- a/src/test/ui/imports/import-glob-0.stderr +++ b/src/test/ui/imports/import-glob-0.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find function `f999` in this scope - --> $DIR/import-glob-0.rs:24:5 + --> $DIR/import-glob-0.rs:14:5 | LL | f999(); //~ ERROR cannot find function `f999` in this scope | ^^^^ not found in this scope diff --git a/src/test/ui/imports/import-glob-circular.rs b/src/test/ui/imports/import-glob-circular.rs index b2e92fe0e1b..e47fa870c06 100644 --- a/src/test/ui/imports/import-glob-circular.rs +++ b/src/test/ui/imports/import-glob-circular.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod circ1 { pub use circ2::f2; pub fn f1() { println!("f1"); } diff --git a/src/test/ui/imports/import-glob-circular.stderr b/src/test/ui/imports/import-glob-circular.stderr index fdff04cc241..30586132c35 100644 --- a/src/test/ui/imports/import-glob-circular.stderr +++ b/src/test/ui/imports/import-glob-circular.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find function `f1066` in this scope - --> $DIR/import-glob-circular.rs:26:17 + --> $DIR/import-glob-circular.rs:16:17 | LL | fn test() { f1066(); } //~ ERROR cannot find function `f1066` in this scope | ^^^^^ not found in this scope diff --git a/src/test/ui/imports/import-loop-2.rs b/src/test/ui/imports/import-loop-2.rs index 0bc968872db..14a85dd083c 100644 --- a/src/test/ui/imports/import-loop-2.rs +++ b/src/test/ui/imports/import-loop-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:import mod a { diff --git a/src/test/ui/imports/import-loop-2.stderr b/src/test/ui/imports/import-loop-2.stderr index 09c2e7918f3..1abfcde03df 100644 --- a/src/test/ui/imports/import-loop-2.stderr +++ b/src/test/ui/imports/import-loop-2.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `a::x` - --> $DIR/import-loop-2.rs:18:13 + --> $DIR/import-loop-2.rs:8:13 | LL | pub use a::x; | ^^^^ no `x` in `a` diff --git a/src/test/ui/imports/import-loop.rs b/src/test/ui/imports/import-loop.rs index f9b57f00776..b4878340145 100644 --- a/src/test/ui/imports/import-loop.rs +++ b/src/test/ui/imports/import-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:import use y::x; diff --git a/src/test/ui/imports/import-loop.stderr b/src/test/ui/imports/import-loop.stderr index b9a1204bb73..b87bfb1be52 100644 --- a/src/test/ui/imports/import-loop.stderr +++ b/src/test/ui/imports/import-loop.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `y::x` - --> $DIR/import-loop.rs:16:13 + --> $DIR/import-loop.rs:6:13 | LL | pub use y::x; | ^^^^ no `x` in `y` diff --git a/src/test/ui/imports/import-prefix-macro-1.rs b/src/test/ui/imports/import-prefix-macro-1.rs index beb15a11a96..91cfd376886 100644 --- a/src/test/ui/imports/import-prefix-macro-1.rs +++ b/src/test/ui/imports/import-prefix-macro-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { pub mod b { pub mod c { diff --git a/src/test/ui/imports/import-prefix-macro-1.stderr b/src/test/ui/imports/import-prefix-macro-1.stderr index e3f436e4ea8..76e543a9f27 100644 --- a/src/test/ui/imports/import-prefix-macro-1.stderr +++ b/src/test/ui/imports/import-prefix-macro-1.stderr @@ -1,5 +1,5 @@ error: expected one of `::`, `;`, or `as`, found `{` - --> $DIR/import-prefix-macro-1.rs:21:27 + --> $DIR/import-prefix-macro-1.rs:11:27 | LL | ($p: path) => (use $p {S, Z}); //~ERROR expected one of `::`, `;`, or `as`, found `{` | ^ expected one of `::`, `;`, or `as` here diff --git a/src/test/ui/imports/import-prefix-macro-2.rs b/src/test/ui/imports/import-prefix-macro-2.rs index 56c6273aa9a..952d161e83f 100644 --- a/src/test/ui/imports/import-prefix-macro-2.rs +++ b/src/test/ui/imports/import-prefix-macro-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { pub mod b { pub mod c { diff --git a/src/test/ui/imports/import-prefix-macro-2.stderr b/src/test/ui/imports/import-prefix-macro-2.stderr index ab9e32afdf0..fa3c90d9ed2 100644 --- a/src/test/ui/imports/import-prefix-macro-2.stderr +++ b/src/test/ui/imports/import-prefix-macro-2.stderr @@ -1,5 +1,5 @@ error: expected identifier, found `a::b::c` - --> $DIR/import-prefix-macro-2.rs:21:26 + --> $DIR/import-prefix-macro-2.rs:11:26 | LL | ($p: path) => (use ::$p {S, Z}); //~ERROR expected identifier, found `a::b::c` | ^^ expected identifier diff --git a/src/test/ui/imports/import-trait-method.rs b/src/test/ui/imports/import-trait-method.rs index 75081b10d86..97dd68f1e76 100644 --- a/src/test/ui/imports/import-trait-method.rs +++ b/src/test/ui/imports/import-trait-method.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(); } diff --git a/src/test/ui/imports/import-trait-method.stderr b/src/test/ui/imports/import-trait-method.stderr index 917a68a7c8b..00cfb42ddd4 100644 --- a/src/test/ui/imports/import-trait-method.stderr +++ b/src/test/ui/imports/import-trait-method.stderr @@ -1,5 +1,5 @@ error[E0253]: `foo` is not directly importable - --> $DIR/import-trait-method.rs:15:5 + --> $DIR/import-trait-method.rs:5:5 | LL | use Foo::foo; //~ ERROR not directly importable | ^^^^^^^^ cannot be imported directly diff --git a/src/test/ui/imports/issue-53140.rs b/src/test/ui/imports/issue-53140.rs index dcfa054f251..dbfba2c9433 100644 --- a/src/test/ui/imports/issue-53140.rs +++ b/src/test/ui/imports/issue-53140.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass mod m { diff --git a/src/test/ui/imports/issue-53269.rs b/src/test/ui/imports/issue-53269.rs index 1b21e3ba5f3..444a16f7e7a 100644 --- a/src/test/ui/imports/issue-53269.rs +++ b/src/test/ui/imports/issue-53269.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ambiguity between a `macro_rules` macro and a non-existent import recovered as `Def::Err` macro_rules! mac { () => () } diff --git a/src/test/ui/imports/issue-53269.stderr b/src/test/ui/imports/issue-53269.stderr index 0ed26ea6fe6..0163ee8bceb 100644 --- a/src/test/ui/imports/issue-53269.stderr +++ b/src/test/ui/imports/issue-53269.stderr @@ -1,22 +1,22 @@ error[E0432]: unresolved import `nonexistent_module` - --> $DIR/issue-53269.rs:16:9 + --> $DIR/issue-53269.rs:6:9 | LL | use nonexistent_module::mac; //~ ERROR unresolved import `nonexistent_module` | ^^^^^^^^^^^^^^^^^^ maybe a missing `extern crate nonexistent_module;`? error[E0659]: `mac` is ambiguous (`macro_rules` vs non-`macro_rules` from other module) - --> $DIR/issue-53269.rs:18:5 + --> $DIR/issue-53269.rs:8:5 | LL | mac!(); //~ ERROR `mac` is ambiguous | ^^^ ambiguous name | note: `mac` could refer to the macro defined here - --> $DIR/issue-53269.rs:13:1 + --> $DIR/issue-53269.rs:3:1 | LL | macro_rules! mac { () => () } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `mac` could also refer to the unresolved item imported here - --> $DIR/issue-53269.rs:16:9 + --> $DIR/issue-53269.rs:6:9 | LL | use nonexistent_module::mac; //~ ERROR unresolved import `nonexistent_module` | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/imports/issue-53512.rs b/src/test/ui/imports/issue-53512.rs index 82ae75e8198..61d93531a15 100644 --- a/src/test/ui/imports/issue-53512.rs +++ b/src/test/ui/imports/issue-53512.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Macro from prelude is shadowed by non-existent import recovered as `Def::Err`. use std::assert; //~ ERROR unresolved import `std::assert` diff --git a/src/test/ui/imports/issue-53512.stderr b/src/test/ui/imports/issue-53512.stderr index e79e759f6c6..a733013be5f 100644 --- a/src/test/ui/imports/issue-53512.stderr +++ b/src/test/ui/imports/issue-53512.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `std::assert` - --> $DIR/issue-53512.rs:13:5 + --> $DIR/issue-53512.rs:3:5 | LL | use std::assert; //~ ERROR unresolved import `std::assert` | ^^^^^^^^^^^ no `assert` in the root diff --git a/src/test/ui/imports/issue-55811.rs b/src/test/ui/imports/issue-55811.rs new file mode 100644 index 00000000000..95316777fab --- /dev/null +++ b/src/test/ui/imports/issue-55811.rs @@ -0,0 +1,6 @@ +// compile-pass +// aux-build:issue-55811.rs + +extern crate issue_55811; + +fn main() {} diff --git a/src/test/ui/imports/issue-56125.rs b/src/test/ui/imports/issue-56125.rs new file mode 100644 index 00000000000..ec5747b4bca --- /dev/null +++ b/src/test/ui/imports/issue-56125.rs @@ -0,0 +1,21 @@ +// edition:2018 +// compile-flags:--extern issue_56125 +// aux-build:issue-56125.rs + +mod m1 { + use issue_56125::last_segment::*; + //~^ ERROR `issue_56125` is ambiguous +} + +mod m2 { + use issue_56125::non_last_segment::non_last_segment::*; + //~^ ERROR `issue_56125` is ambiguous +} + +mod m3 { + mod empty {} + use empty::issue_56125; //~ ERROR unresolved import `empty::issue_56125` + use issue_56125::*; //~ ERROR `issue_56125` is ambiguous +} + +fn main() {} diff --git a/src/test/ui/imports/issue-56125.stderr b/src/test/ui/imports/issue-56125.stderr new file mode 100644 index 00000000000..844962b910a --- /dev/null +++ b/src/test/ui/imports/issue-56125.stderr @@ -0,0 +1,55 @@ +error[E0432]: unresolved import `empty::issue_56125` + --> $DIR/issue-56125.rs:17:9 + | +LL | use empty::issue_56125; //~ ERROR unresolved import `empty::issue_56125` + | ^^^^^^^^^^^^^^^^^^ no `issue_56125` in `m3::empty` + +error[E0659]: `issue_56125` is ambiguous (name vs any other name during import resolution) + --> $DIR/issue-56125.rs:6:9 + | +LL | use issue_56125::last_segment::*; + | ^^^^^^^^^^^ ambiguous name + | + = note: `issue_56125` could refer to an extern crate passed with `--extern` + = help: use `::issue_56125` to refer to this extern crate unambiguously +note: `issue_56125` could also refer to the module imported here + --> $DIR/issue-56125.rs:6:9 + | +LL | use issue_56125::last_segment::*; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: use `self::issue_56125` to refer to this module unambiguously + +error[E0659]: `issue_56125` is ambiguous (name vs any other name during import resolution) + --> $DIR/issue-56125.rs:11:9 + | +LL | use issue_56125::non_last_segment::non_last_segment::*; + | ^^^^^^^^^^^ ambiguous name + | + = note: `issue_56125` could refer to an extern crate passed with `--extern` + = help: use `::issue_56125` to refer to this extern crate unambiguously +note: `issue_56125` could also refer to the module imported here + --> $DIR/issue-56125.rs:11:9 + | +LL | use issue_56125::non_last_segment::non_last_segment::*; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: use `self::issue_56125` to refer to this module unambiguously + +error[E0659]: `issue_56125` is ambiguous (name vs any other name during import resolution) + --> $DIR/issue-56125.rs:18:9 + | +LL | use issue_56125::*; //~ ERROR `issue_56125` is ambiguous + | ^^^^^^^^^^^ ambiguous name + | + = note: `issue_56125` could refer to an extern crate passed with `--extern` + = help: use `::issue_56125` to refer to this extern crate unambiguously +note: `issue_56125` could also refer to the module imported here + --> $DIR/issue-56125.rs:18:9 + | +LL | use issue_56125::*; //~ ERROR `issue_56125` is ambiguous + | ^^^^^^^^^^^^^^ + = help: use `self::issue_56125` to refer to this module unambiguously + +error: aborting due to 4 previous errors + +Some errors occurred: E0432, E0659. +For more information about an error, try `rustc --explain E0432`. diff --git a/src/test/ui/imports/issue-56263.rs b/src/test/ui/imports/issue-56263.rs new file mode 100644 index 00000000000..4113d4390c3 --- /dev/null +++ b/src/test/ui/imports/issue-56263.rs @@ -0,0 +1,8 @@ +// compile-pass +// edition:2018 + +use ::std; + +fn main() { + let std = 10; +} diff --git a/src/test/ui/imports/issue-57015.rs b/src/test/ui/imports/issue-57015.rs new file mode 100644 index 00000000000..27688fd34f6 --- /dev/null +++ b/src/test/ui/imports/issue-57015.rs @@ -0,0 +1,13 @@ +mod glob_ok { + pub mod something { + pub mod something_else {} + } +} + +mod single_err {} + +use glob_ok::*; // glob_ok::something +use single_err::something; //~ ERROR unresolved import `single_err::something` +use something::something_else; + +fn main() {} diff --git a/src/test/ui/imports/issue-57015.stderr b/src/test/ui/imports/issue-57015.stderr new file mode 100644 index 00000000000..b0fcf5bec6a --- /dev/null +++ b/src/test/ui/imports/issue-57015.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `single_err::something` + --> $DIR/issue-57015.rs:10:5 + | +LL | use single_err::something; //~ ERROR unresolved import `single_err::something` + | ^^^^^^^^^^^^^^^^^^^^^ no `something` in `single_err` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/imports/issue-57539.rs b/src/test/ui/imports/issue-57539.rs new file mode 100644 index 00000000000..90b74eb4647 --- /dev/null +++ b/src/test/ui/imports/issue-57539.rs @@ -0,0 +1,8 @@ +// edition:2018 + +mod core { + use core; //~ ERROR `core` is ambiguous + use crate::*; +} + +fn main() {} diff --git a/src/test/ui/imports/issue-57539.stderr b/src/test/ui/imports/issue-57539.stderr new file mode 100644 index 00000000000..3f745fd8204 --- /dev/null +++ b/src/test/ui/imports/issue-57539.stderr @@ -0,0 +1,18 @@ +error[E0659]: `core` is ambiguous (name vs any other name during import resolution) + --> $DIR/issue-57539.rs:4:9 + | +LL | use core; //~ ERROR `core` is ambiguous + | ^^^^ ambiguous name + | + = note: `core` could refer to a built-in extern crate + = help: use `::core` to refer to this extern crate unambiguously +note: `core` could also refer to the module imported here + --> $DIR/issue-57539.rs:5:9 + | +LL | use crate::*; + | ^^^^^^^^ + = help: use `self::core` to refer to this module unambiguously + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/imports/local-modularized-tricky-fail-1.rs b/src/test/ui/imports/local-modularized-tricky-fail-1.rs index fb05b95a96d..d1cb6b07d75 100644 --- a/src/test/ui/imports/local-modularized-tricky-fail-1.rs +++ b/src/test/ui/imports/local-modularized-tricky-fail-1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] macro_rules! define_exported { () => { @@ -43,6 +33,7 @@ mod inner2 { fn main() { panic!(); //~ ERROR `panic` is ambiguous + //~| ERROR `panic` is ambiguous } mod inner3 { diff --git a/src/test/ui/imports/local-modularized-tricky-fail-1.stderr b/src/test/ui/imports/local-modularized-tricky-fail-1.stderr index 962294e48ca..21f75afb3f7 100644 --- a/src/test/ui/imports/local-modularized-tricky-fail-1.stderr +++ b/src/test/ui/imports/local-modularized-tricky-fail-1.stderr @@ -1,11 +1,11 @@ error[E0659]: `exported` is ambiguous (glob import vs macro-expanded name in the same module during import/macro resolution) - --> $DIR/local-modularized-tricky-fail-1.rs:38:1 + --> $DIR/local-modularized-tricky-fail-1.rs:28:1 | LL | exported!(); //~ ERROR `exported` is ambiguous | ^^^^^^^^ ambiguous name | note: `exported` could refer to the macro defined here - --> $DIR/local-modularized-tricky-fail-1.rs:15:5 + --> $DIR/local-modularized-tricky-fail-1.rs:5:5 | LL | / macro_rules! exported { LL | | () => () @@ -15,21 +15,21 @@ LL | | } LL | define_exported!(); | ------------------- in this macro invocation note: `exported` could also refer to the macro imported here - --> $DIR/local-modularized-tricky-fail-1.rs:32:5 + --> $DIR/local-modularized-tricky-fail-1.rs:22:5 | LL | use inner1::*; | ^^^^^^^^^ = help: consider adding an explicit import of `exported` to disambiguate error[E0659]: `include` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/local-modularized-tricky-fail-1.rs:56:1 + --> $DIR/local-modularized-tricky-fail-1.rs:47:1 | LL | include!(); //~ ERROR `include` is ambiguous | ^^^^^^^ ambiguous name | = note: `include` could refer to a built-in macro note: `include` could also refer to the macro defined here - --> $DIR/local-modularized-tricky-fail-1.rs:27:5 + --> $DIR/local-modularized-tricky-fail-1.rs:17:5 | LL | / macro_rules! include { LL | | () => () @@ -38,17 +38,17 @@ LL | | } ... LL | define_include!(); | ------------------ in this macro invocation - = help: use `self::include` to refer to this macro unambiguously + = help: use `crate::include` to refer to this macro unambiguously error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/local-modularized-tricky-fail-1.rs:45:5 + --> $DIR/local-modularized-tricky-fail-1.rs:35:5 | LL | panic!(); //~ ERROR `panic` is ambiguous | ^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude note: `panic` could also refer to the macro defined here - --> $DIR/local-modularized-tricky-fail-1.rs:21:5 + --> $DIR/local-modularized-tricky-fail-1.rs:11:5 | LL | / macro_rules! panic { LL | | () => () @@ -57,17 +57,17 @@ LL | | } ... LL | define_panic!(); | ---------------- in this macro invocation - = help: use `self::panic` to refer to this macro unambiguously + = help: use `crate::panic` to refer to this macro unambiguously error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> <::std::macros::panic macros>:1:13 + --> $DIR/local-modularized-tricky-fail-1.rs:35:5 | -LL | ( ) => ( { panic ! ( "explicit panic" ) } ) ; ( $ msg : expr ) => ( - | ^^^^^ ambiguous name +LL | panic!(); //~ ERROR `panic` is ambiguous + | ^^^^^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude note: `panic` could also refer to the macro defined here - --> $DIR/local-modularized-tricky-fail-1.rs:21:5 + --> $DIR/local-modularized-tricky-fail-1.rs:11:5 | LL | / macro_rules! panic { LL | | () => () @@ -76,7 +76,8 @@ LL | | } ... LL | define_panic!(); | ---------------- in this macro invocation - = help: use `self::panic` to refer to this macro unambiguously + = help: use `crate::panic` to refer to this macro unambiguously + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to 4 previous errors diff --git a/src/test/ui/imports/local-modularized-tricky-fail-2.rs b/src/test/ui/imports/local-modularized-tricky-fail-2.rs index 1ae7ed268eb..e637edadb00 100644 --- a/src/test/ui/imports/local-modularized-tricky-fail-2.rs +++ b/src/test/ui/imports/local-modularized-tricky-fail-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // `#[macro_export] macro_rules` that doesn't originate from macro expansions can be placed // into the root module soon enough to act as usual items and shadow globs and preludes. diff --git a/src/test/ui/imports/local-modularized-tricky-fail-2.stderr b/src/test/ui/imports/local-modularized-tricky-fail-2.stderr index 5681dd59628..40cb10ced16 100644 --- a/src/test/ui/imports/local-modularized-tricky-fail-2.stderr +++ b/src/test/ui/imports/local-modularized-tricky-fail-2.stderr @@ -1,5 +1,5 @@ -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/local-modularized-tricky-fail-2.rs:30:32 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/local-modularized-tricky-fail-2.rs:20:32 | LL | exported!(); | ------------ in this macro invocation @@ -9,8 +9,8 @@ LL | () => ( struct Б; ) //~ ERROR non-ascii idents are not ful | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/local-modularized-tricky-fail-2.rs:46:24 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/local-modularized-tricky-fail-2.rs:36:24 | LL | panic!(); | --------- in this macro invocation @@ -20,8 +20,8 @@ LL | () => ( struct Г; ) //~ ERROR non-ascii idents are not fully suppo | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/local-modularized-tricky-fail-2.rs:56:24 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/local-modularized-tricky-fail-2.rs:46:24 | LL | include!(); | ----------- in this macro invocation diff --git a/src/test/ui/imports/local-modularized-tricky-fail-3.rs b/src/test/ui/imports/local-modularized-tricky-fail-3.rs index 1cd7cc56a40..386de88bc3d 100644 --- a/src/test/ui/imports/local-modularized-tricky-fail-3.rs +++ b/src/test/ui/imports/local-modularized-tricky-fail-3.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Crate-local macro expanded `macro_export` macros cannot be accessed with module-relative paths. macro_rules! define_exported { () => { diff --git a/src/test/ui/imports/local-modularized-tricky-fail-3.stderr b/src/test/ui/imports/local-modularized-tricky-fail-3.stderr index 6c5c789e5ee..6bece2b17ce 100644 --- a/src/test/ui/imports/local-modularized-tricky-fail-3.stderr +++ b/src/test/ui/imports/local-modularized-tricky-fail-3.stderr @@ -1,5 +1,5 @@ error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths - --> $DIR/local-modularized-tricky-fail-3.rs:23:9 + --> $DIR/local-modularized-tricky-fail-3.rs:13:9 | LL | use exported; | ^^^^^^^^ @@ -8,7 +8,7 @@ LL | use exported; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #52234 note: the macro is defined here - --> $DIR/local-modularized-tricky-fail-3.rs:15:5 + --> $DIR/local-modularized-tricky-fail-3.rs:5:5 | LL | / macro_rules! exported { LL | | () => () @@ -19,7 +19,7 @@ LL | define_exported!(); | ------------------- in this macro invocation error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths - --> $DIR/local-modularized-tricky-fail-3.rs:29:5 + --> $DIR/local-modularized-tricky-fail-3.rs:19:5 | LL | ::exported!(); | ^^^^^^^^^^ @@ -27,7 +27,7 @@ LL | ::exported!(); = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #52234 note: the macro is defined here - --> $DIR/local-modularized-tricky-fail-3.rs:15:5 + --> $DIR/local-modularized-tricky-fail-3.rs:5:5 | LL | / macro_rules! exported { LL | | () => () diff --git a/src/test/ui/imports/local-modularized-tricky-pass.rs b/src/test/ui/imports/local-modularized-tricky-pass.rs index 9392473eace..59aac952b92 100644 --- a/src/test/ui/imports/local-modularized-tricky-pass.rs +++ b/src/test/ui/imports/local-modularized-tricky-pass.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass macro_rules! define_exported { () => { diff --git a/src/test/ui/imports/local-modularized.rs b/src/test/ui/imports/local-modularized.rs index 260a406ef75..a073fe26eb6 100644 --- a/src/test/ui/imports/local-modularized.rs +++ b/src/test/ui/imports/local-modularized.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #[macro_export(local_inner_macros)] diff --git a/src/test/ui/imports/macro-paths.rs b/src/test/ui/imports/macro-paths.rs index 50cfd2d2170..cc584e05a6b 100644 --- a/src/test/ui/imports/macro-paths.rs +++ b/src/test/ui/imports/macro-paths.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:two_macros.rs extern crate two_macros; diff --git a/src/test/ui/imports/macro-paths.stderr b/src/test/ui/imports/macro-paths.stderr index 8e8742f849b..36290b2d93e 100644 --- a/src/test/ui/imports/macro-paths.stderr +++ b/src/test/ui/imports/macro-paths.stderr @@ -1,40 +1,40 @@ error[E0659]: `bar` is ambiguous (glob import vs macro-expanded name in the same module during import/macro resolution) - --> $DIR/macro-paths.rs:23:5 + --> $DIR/macro-paths.rs:13:5 | LL | bar::m! { //~ ERROR ambiguous | ^^^ ambiguous name | note: `bar` could refer to the module defined here - --> $DIR/macro-paths.rs:24:9 + --> $DIR/macro-paths.rs:14:9 | LL | mod bar { pub use two_macros::m; } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `bar` could also refer to the module imported here - --> $DIR/macro-paths.rs:22:9 + --> $DIR/macro-paths.rs:12:9 | LL | use foo::*; | ^^^^^^ = help: consider adding an explicit import of `bar` to disambiguate error[E0659]: `baz` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/macro-paths.rs:33:5 + --> $DIR/macro-paths.rs:23:5 | LL | baz::m! { //~ ERROR ambiguous | ^^^ ambiguous name | note: `baz` could refer to the module defined here - --> $DIR/macro-paths.rs:34:9 + --> $DIR/macro-paths.rs:24:9 | LL | mod baz { pub use two_macros::m; } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `baz` could also refer to the module defined here - --> $DIR/macro-paths.rs:28:1 + --> $DIR/macro-paths.rs:18:1 | LL | / pub mod baz { LL | | pub use two_macros::m; LL | | } | |_^ - = help: use `self::baz` to refer to this module unambiguously + = help: use `crate::baz` to refer to this module unambiguously error: aborting due to 2 previous errors diff --git a/src/test/ui/imports/macros.rs b/src/test/ui/imports/macros.rs index f7dc7ac9eac..f2a22ad620b 100644 --- a/src/test/ui/imports/macros.rs +++ b/src/test/ui/imports/macros.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:two_macros.rs extern crate two_macros; // two identity macros `m` and `n` diff --git a/src/test/ui/imports/macros.stderr b/src/test/ui/imports/macros.stderr index 77a0311fa60..5a15bf0ae71 100644 --- a/src/test/ui/imports/macros.stderr +++ b/src/test/ui/imports/macros.stderr @@ -1,34 +1,34 @@ error[E0659]: `m` is ambiguous (glob import vs macro-expanded name in the same module during import/macro resolution) - --> $DIR/macros.rs:26:5 + --> $DIR/macros.rs:16:5 | LL | m! { //~ ERROR ambiguous | ^ ambiguous name | note: `m` could refer to the macro imported here - --> $DIR/macros.rs:27:13 + --> $DIR/macros.rs:17:13 | LL | use foo::m; | ^^^^^^ note: `m` could also refer to the macro imported here - --> $DIR/macros.rs:25:9 + --> $DIR/macros.rs:15:9 | LL | use two_macros::*; | ^^^^^^^^^^^^^ = help: consider adding an explicit import of `m` to disambiguate error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/macros.rs:39:9 + --> $DIR/macros.rs:29:9 | LL | m! { //~ ERROR ambiguous | ^ ambiguous name | note: `m` could refer to the macro imported here - --> $DIR/macros.rs:40:17 + --> $DIR/macros.rs:30:17 | LL | use two_macros::n as m; | ^^^^^^^^^^^^^^^^^^ note: `m` could also refer to the macro imported here - --> $DIR/macros.rs:32:9 + --> $DIR/macros.rs:22:9 | LL | use two_macros::m; | ^^^^^^^^^^^^^ diff --git a/src/test/ui/imports/reexports.rs b/src/test/ui/imports/reexports.rs index f50b5b0e849..b0a591b08ac 100644 --- a/src/test/ui/imports/reexports.rs +++ b/src/test/ui/imports/reexports.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { fn foo() {} mod foo {} diff --git a/src/test/ui/imports/reexports.stderr b/src/test/ui/imports/reexports.stderr index 9ed3b02591c..964e847392a 100644 --- a/src/test/ui/imports/reexports.stderr +++ b/src/test/ui/imports/reexports.stderr @@ -1,29 +1,29 @@ error[E0364]: `foo` is private, and cannot be re-exported - --> $DIR/reexports.rs:16:17 + --> $DIR/reexports.rs:6:17 | LL | pub use super::foo; //~ ERROR cannot be re-exported | ^^^^^^^^^^ | note: consider marking `foo` as `pub` in the imported module - --> $DIR/reexports.rs:16:17 + --> $DIR/reexports.rs:6:17 | LL | pub use super::foo; //~ ERROR cannot be re-exported | ^^^^^^^^^^ error: A non-empty glob must import something with the glob's visibility - --> $DIR/reexports.rs:17:17 + --> $DIR/reexports.rs:7:17 | LL | pub use super::*; //~ ERROR must import something with the glob's visibility | ^^^^^^^^ error[E0603]: module `foo` is private - --> $DIR/reexports.rs:38:15 + --> $DIR/reexports.rs:28:15 | LL | use b::a::foo::S; //~ ERROR `foo` | ^^^ error[E0603]: module `foo` is private - --> $DIR/reexports.rs:39:15 + --> $DIR/reexports.rs:29:15 | LL | use b::b::foo::S as T; //~ ERROR `foo` | ^^^ diff --git a/src/test/ui/imports/rfc-1560-warning-cycle.rs b/src/test/ui/imports/rfc-1560-warning-cycle.rs index 5b62c5fcd3f..cfa7179fb6b 100644 --- a/src/test/ui/imports/rfc-1560-warning-cycle.rs +++ b/src/test/ui/imports/rfc-1560-warning-cycle.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo; mod bar { diff --git a/src/test/ui/imports/rfc-1560-warning-cycle.stderr b/src/test/ui/imports/rfc-1560-warning-cycle.stderr index 946dc084cd0..16caf68e14f 100644 --- a/src/test/ui/imports/rfc-1560-warning-cycle.stderr +++ b/src/test/ui/imports/rfc-1560-warning-cycle.stderr @@ -1,17 +1,17 @@ error[E0659]: `Foo` is ambiguous (glob import vs glob import in the same module) - --> $DIR/rfc-1560-warning-cycle.rs:19:17 + --> $DIR/rfc-1560-warning-cycle.rs:9:17 | LL | fn f(_: Foo) {} //~ ERROR `Foo` is ambiguous | ^^^ ambiguous name | note: `Foo` could refer to the struct imported here - --> $DIR/rfc-1560-warning-cycle.rs:17:13 + --> $DIR/rfc-1560-warning-cycle.rs:7:13 | LL | use *; | ^ = help: consider adding an explicit import of `Foo` to disambiguate note: `Foo` could also refer to the struct imported here - --> $DIR/rfc-1560-warning-cycle.rs:18:13 + --> $DIR/rfc-1560-warning-cycle.rs:8:13 | LL | use bar::*; | ^^^^^^ diff --git a/src/test/ui/imports/shadow_builtin_macros.rs b/src/test/ui/imports/shadow_builtin_macros.rs index ec3f4107e38..02c27d5ce33 100644 --- a/src/test/ui/imports/shadow_builtin_macros.rs +++ b/src/test/ui/imports/shadow_builtin_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:two_macros.rs mod foo { diff --git a/src/test/ui/imports/shadow_builtin_macros.stderr b/src/test/ui/imports/shadow_builtin_macros.stderr index b53b7e2700d..db4ee1128f4 100644 --- a/src/test/ui/imports/shadow_builtin_macros.stderr +++ b/src/test/ui/imports/shadow_builtin_macros.stderr @@ -1,12 +1,12 @@ error[E0659]: `panic` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) - --> $DIR/shadow_builtin_macros.rs:25:14 + --> $DIR/shadow_builtin_macros.rs:15:14 | LL | fn f() { panic!(); } //~ ERROR ambiguous | ^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude note: `panic` could also refer to the macro imported here - --> $DIR/shadow_builtin_macros.rs:24:9 + --> $DIR/shadow_builtin_macros.rs:14:9 | LL | use foo::*; | ^^^^^^ @@ -14,28 +14,28 @@ LL | use foo::*; = help: or use `self::panic` to refer to this macro unambiguously error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/shadow_builtin_macros.rs:30:14 + --> $DIR/shadow_builtin_macros.rs:20:14 | LL | fn f() { panic!(); } //~ ERROR ambiguous | ^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude note: `panic` could also refer to the macro imported here - --> $DIR/shadow_builtin_macros.rs:29:26 + --> $DIR/shadow_builtin_macros.rs:19:26 | LL | ::two_macros::m!(use foo::panic;); | ^^^^^^^^^^ = help: use `self::panic` to refer to this macro unambiguously error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/shadow_builtin_macros.rs:43:5 + --> $DIR/shadow_builtin_macros.rs:33:5 | LL | panic!(); //~ ERROR `panic` is ambiguous | ^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude note: `panic` could also refer to the macro defined here - --> $DIR/shadow_builtin_macros.rs:40:9 + --> $DIR/shadow_builtin_macros.rs:30:9 | LL | macro_rules! panic { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -44,20 +44,20 @@ LL | m!(); | ----- in this macro invocation error[E0659]: `n` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) - --> $DIR/shadow_builtin_macros.rs:59:5 + --> $DIR/shadow_builtin_macros.rs:49:5 | LL | n!(); //~ ERROR ambiguous | ^ ambiguous name | note: `n` could refer to the macro imported here - --> $DIR/shadow_builtin_macros.rs:58:9 + --> $DIR/shadow_builtin_macros.rs:48:9 | LL | use bar::*; | ^^^^^^ = help: consider adding an explicit import of `n` to disambiguate = help: or use `self::n` to refer to this macro unambiguously note: `n` could also refer to the macro imported here - --> $DIR/shadow_builtin_macros.rs:46:13 + --> $DIR/shadow_builtin_macros.rs:36:13 | LL | #[macro_use(n)] | ^ diff --git a/src/test/ui/imports/unused-macro-use.rs b/src/test/ui/imports/unused-macro-use.rs index 365521970cd..9f63eb4b4ec 100644 --- a/src/test/ui/imports/unused-macro-use.rs +++ b/src/test/ui/imports/unused-macro-use.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused)] #[macro_use] //~ ERROR unused `#[macro_use]` import diff --git a/src/test/ui/imports/unused-macro-use.stderr b/src/test/ui/imports/unused-macro-use.stderr index 0920b5c6d1e..2d20b311442 100644 --- a/src/test/ui/imports/unused-macro-use.stderr +++ b/src/test/ui/imports/unused-macro-use.stderr @@ -1,18 +1,18 @@ error: unused `#[macro_use]` import - --> $DIR/unused-macro-use.rs:13:1 + --> $DIR/unused-macro-use.rs:3:1 | LL | #[macro_use] //~ ERROR unused `#[macro_use]` import | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/unused-macro-use.rs:11:9 + --> $DIR/unused-macro-use.rs:1:9 | LL | #![deny(unused)] | ^^^^^^ = note: #[deny(unused_imports)] implied by #[deny(unused)] error: unused `#[macro_use]` import - --> $DIR/unused-macro-use.rs:17:5 + --> $DIR/unused-macro-use.rs:7:5 | LL | panic //~ ERROR unused `#[macro_use]` import | ^^^^^ diff --git a/src/test/ui/imports/unused.rs b/src/test/ui/imports/unused.rs index 1eb756fe9e4..c22e95ec330 100644 --- a/src/test/ui/imports/unused.rs +++ b/src/test/ui/imports/unused.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused)] mod foo { @@ -23,7 +13,7 @@ mod foo { } mod m3 { - pub(super) use super::f; // Check that this is counted as used (c.f. #36249). + pub(super) use super::f; // Check that this is counted as used (cf. issue #36249). } pub mod m4 { diff --git a/src/test/ui/imports/unused.stderr b/src/test/ui/imports/unused.stderr index ff5c937aa83..b56e930158c 100644 --- a/src/test/ui/imports/unused.stderr +++ b/src/test/ui/imports/unused.stderr @@ -1,11 +1,11 @@ error: unused import: `super::f` - --> $DIR/unused.rs:17:24 + --> $DIR/unused.rs:7:24 | LL | pub(super) use super::f; //~ ERROR unused | ^^^^^^^^ | note: lint level defined here - --> $DIR/unused.rs:11:9 + --> $DIR/unused.rs:1:9 | LL | #![deny(unused)] | ^^^^^^ diff --git a/src/test/ui/impossible_range.rs b/src/test/ui/impossible_range.rs index 073ed867bdb..6345af00111 100644 --- a/src/test/ui/impossible_range.rs +++ b/src/test/ui/impossible_range.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure that invalid ranges generate an error during HIR lowering, not an ICE pub fn main() { diff --git a/src/test/ui/impossible_range.stderr b/src/test/ui/impossible_range.stderr index cfeaa53a6bb..1d26030625f 100644 --- a/src/test/ui/impossible_range.stderr +++ b/src/test/ui/impossible_range.stderr @@ -1,5 +1,5 @@ error[E0586]: inclusive range with no end - --> $DIR/impossible_range.rs:18:8 + --> $DIR/impossible_range.rs:8:8 | LL | ..=; //~ERROR inclusive range with no end | ^ @@ -7,7 +7,7 @@ LL | ..=; //~ERROR inclusive range with no end = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error[E0586]: inclusive range with no end - --> $DIR/impossible_range.rs:25:9 + --> $DIR/impossible_range.rs:15:9 | LL | 0..=; //~ERROR inclusive range with no end | ^ diff --git a/src/test/ui/in-band-lifetimes/E0687.rs b/src/test/ui/in-band-lifetimes/E0687.rs index 4eddebb15e1..2e262ddaea3 100644 --- a/src/test/ui/in-band-lifetimes/E0687.rs +++ b/src/test/ui/in-band-lifetimes/E0687.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(in_band_lifetimes)] diff --git a/src/test/ui/in-band-lifetimes/E0687.stderr b/src/test/ui/in-band-lifetimes/E0687.stderr index 441494d738a..74245e16e7f 100644 --- a/src/test/ui/in-band-lifetimes/E0687.stderr +++ b/src/test/ui/in-band-lifetimes/E0687.stderr @@ -1,23 +1,23 @@ error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687.rs:14:15 + --> $DIR/E0687.rs:4:15 | LL | fn foo(x: fn(&'a u32)) {} //~ ERROR must be explicitly | ^^ in-band lifetime definition error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687.rs:16:16 + --> $DIR/E0687.rs:6:16 | LL | fn bar(x: &Fn(&'a u32)) {} //~ ERROR must be explicitly | ^^ in-band lifetime definition error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687.rs:18:15 + --> $DIR/E0687.rs:8:15 | LL | fn baz(x: fn(&'a u32), y: &'a u32) {} //~ ERROR must be explicitly | ^^ in-band lifetime definition error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687.rs:23:26 + --> $DIR/E0687.rs:13:26 | LL | fn bar(&self, x: fn(&'a u32)) {} //~ ERROR must be explicitly | ^^ in-band lifetime definition diff --git a/src/test/ui/in-band-lifetimes/E0687_where.rs b/src/test/ui/in-band-lifetimes/E0687_where.rs index c1b268eac70..6cf8053287d 100644 --- a/src/test/ui/in-band-lifetimes/E0687_where.rs +++ b/src/test/ui/in-band-lifetimes/E0687_where.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(in_band_lifetimes)] diff --git a/src/test/ui/in-band-lifetimes/E0687_where.stderr b/src/test/ui/in-band-lifetimes/E0687_where.stderr index a2ad5cf0f83..4533c3b10f7 100644 --- a/src/test/ui/in-band-lifetimes/E0687_where.stderr +++ b/src/test/ui/in-band-lifetimes/E0687_where.stderr @@ -1,11 +1,11 @@ error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687_where.rs:14:31 + --> $DIR/E0687_where.rs:4:31 | LL | fn bar(x: &F) where F: Fn(&'a u32) {} //~ ERROR must be explicitly | ^^ in-band lifetime definition error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders - --> $DIR/E0687_where.rs:16:21 + --> $DIR/E0687_where.rs:6:21 | LL | fn baz(x: &impl Fn(&'a u32)) {} //~ ERROR must be explicitly | ^^ in-band lifetime definition diff --git a/src/test/ui/in-band-lifetimes/E0688.rs b/src/test/ui/in-band-lifetimes/E0688.rs index 29b954e9a83..a4e1f01c178 100644 --- a/src/test/ui/in-band-lifetimes/E0688.rs +++ b/src/test/ui/in-band-lifetimes/E0688.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(in_band_lifetimes)] diff --git a/src/test/ui/in-band-lifetimes/E0688.stderr b/src/test/ui/in-band-lifetimes/E0688.stderr index 66dca227941..f02b8db4669 100644 --- a/src/test/ui/in-band-lifetimes/E0688.stderr +++ b/src/test/ui/in-band-lifetimes/E0688.stderr @@ -1,5 +1,5 @@ error[E0688]: cannot mix in-band and explicit lifetime definitions - --> $DIR/E0688.rs:14:28 + --> $DIR/E0688.rs:4:28 | LL | fn foo<'a>(x: &'a u32, y: &'b u32) {} //~ ERROR cannot mix | -- ^^ in-band lifetime definition here @@ -7,7 +7,7 @@ LL | fn foo<'a>(x: &'a u32, y: &'b u32) {} //~ ERROR cannot mix | explicit lifetime definition here error[E0688]: cannot mix in-band and explicit lifetime definitions - --> $DIR/E0688.rs:19:44 + --> $DIR/E0688.rs:9:44 | LL | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} //~ ERROR cannot mix | -- ^^ in-band lifetime definition here @@ -15,7 +15,7 @@ LL | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} //~ ERROR cannot mix | explicit lifetime definition here error[E0688]: cannot mix in-band and explicit lifetime definitions - --> $DIR/E0688.rs:22:14 + --> $DIR/E0688.rs:12:14 | LL | impl<'b> Foo<'a> { //~ ERROR cannot mix | -- ^^ in-band lifetime definition here diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed b/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed index 153e5003746..29c570daefd 100644 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed +++ b/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix // edition:2018 diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.rs b/src/test/ui/in-band-lifetimes/elided-lifetimes.rs index 41aa7e1a7b7..e59c9b4367f 100644 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.rs +++ b/src/test/ui/in-band-lifetimes/elided-lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix // edition:2018 diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr b/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr index e7a1b42b8c9..5c50d7e2aac 100644 --- a/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr +++ b/src/test/ui/in-band-lifetimes/elided-lifetimes.stderr @@ -1,35 +1,35 @@ error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:23:12 + --> $DIR/elided-lifetimes.rs:13:12 | LL | fn foo(x: &Foo) { | ^^^- help: indicate the anonymous lifetime: `<'_>` | note: lint level defined here - --> $DIR/elided-lifetimes.rs:15:9 + --> $DIR/elided-lifetimes.rs:5:9 | LL | #![deny(elided_lifetimes_in_paths)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:42:29 + --> $DIR/elided-lifetimes.rs:32:29 | LL | fn wrap_gift(gift: &str) -> Wrapped { | ^^^^^^^- help: indicate the anonymous lifetime: `<'_>` error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:48:38 + --> $DIR/elided-lifetimes.rs:38:38 | LL | fn wrap_gift_with_bow(gift: &str) -> WrappedWithBow { | ^^^^^^^^^^^^^^- help: indicate the anonymous lifetime: `<'_>` error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:54:29 + --> $DIR/elided-lifetimes.rs:44:29 | LL | fn inspect_matched_set(set: MatchedSet) { | ^^^^^^^^^^- help: indicate the anonymous lifetimes: `<'_, '_>` error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:66:36 + --> $DIR/elided-lifetimes.rs:56:36 | LL | fn $fn_name(gift: &str) -> $type_name { | ^^^^^^^^^^- help: indicate the anonymous lifetime: `<'_>` @@ -38,13 +38,13 @@ LL | autowrapper!(Autowrapped, autowrap_gift, 'a); | --------------------------------------------- in this macro invocation error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:88:18 + --> $DIR/elided-lifetimes.rs:78:18 | LL | let loyalty: Ref<(u32, char)> = honesty.borrow(); | ^^^^^^^^^^^^^^^^ help: indicate the anonymous lifetime: `Ref<'_, (u32, char)>` error: hidden lifetime parameters in types are deprecated - --> $DIR/elided-lifetimes.rs:80:9 + --> $DIR/elided-lifetimes.rs:70:9 | LL | Ref<($($types),*)> | ^^^^^^^^^^^^^^^^^^ help: indicate the anonymous lifetime: `Ref<'_, ($($types),*)>` diff --git a/src/test/ui/in-band-lifetimes/mismatched.rs b/src/test/ui/in-band-lifetimes/mismatched.rs index 80bc56c0f44..11c41eae954 100644 --- a/src/test/ui/in-band-lifetimes/mismatched.rs +++ b/src/test/ui/in-band-lifetimes/mismatched.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(in_band_lifetimes)] diff --git a/src/test/ui/in-band-lifetimes/mismatched.stderr b/src/test/ui/in-band-lifetimes/mismatched.stderr index ed932a97ba4..abc6d42910f 100644 --- a/src/test/ui/in-band-lifetimes/mismatched.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/mismatched.rs:14:42 + --> $DIR/mismatched.rs:4:42 | LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required | ---- ^ lifetime `'a` required @@ -7,7 +7,7 @@ LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime re | help: add explicit lifetime `'a` to the type of `y`: `&'a u32` error[E0623]: lifetime mismatch - --> $DIR/mismatched.rs:16:46 + --> $DIR/mismatched.rs:6:46 | LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch | ------- ------- ^ ...but data from `y` is returned here diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait.rs b/src/test/ui/in-band-lifetimes/mismatched_trait.rs index bc175803ebd..221f4fc271b 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait.rs +++ b/src/test/ui/in-band-lifetimes/mismatched_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(in_band_lifetimes)] diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait.stderr index 745b82c20b4..dd28aa226b7 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/mismatched_trait.rs:16:9 + --> $DIR/mismatched_trait.rs:6:9 | LL | fn baz(&self, x: &'a u32, y: &u32) -> &'a u32 { | ---- help: add explicit lifetime `'a` to the type of `y`: `&'a u32` diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs index ff04cfe99c0..d4535ac4425 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Deref; trait Trait {} diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr index 169369c304e..fbd312a632f 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr @@ -1,11 +1,11 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter in generic type due to conflicting requirements - --> $DIR/mismatched_trait_impl-2.rs:18:5 + --> $DIR/mismatched_trait_impl-2.rs:8:5 | LL | fn deref(&self) -> &Trait { | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 18:5... - --> $DIR/mismatched_trait_impl-2.rs:18:5 +note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 8:5... + --> $DIR/mismatched_trait_impl-2.rs:8:5 | LL | / fn deref(&self) -> &Trait { LL | | unimplemented!(); diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.rs b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.rs index 52641059b1f..654d2bddfd0 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.rs +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(in_band_lifetimes)] diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr index f2c6155fd98..4af991cede4 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr @@ -1,18 +1,18 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements - --> $DIR/mismatched_trait_impl.rs:19:5 + --> $DIR/mismatched_trait_impl.rs:9:5 | LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 19:5... - --> $DIR/mismatched_trait_impl.rs:19:5 +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 9:5... + --> $DIR/mismatched_trait_impl.rs:9:5 | LL | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer LL | | x LL | | } | |_____^ -note: ...but the lifetime must also be valid for the lifetime 'a as defined on the method body at 19:32... - --> $DIR/mismatched_trait_impl.rs:19:32 +note: ...but the lifetime must also be valid for the lifetime 'a as defined on the method body at 9:32... + --> $DIR/mismatched_trait_impl.rs:9:32 | LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer | ^^ diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr b/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr index 546d7b0ed5c..3f5dbb850cc 100644 --- a/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr +++ b/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `p` because it is borrowed - --> $DIR/mut_while_borrow.rs:19:5 + --> $DIR/mut_while_borrow.rs:9:5 | LL | let r = foo(&p); | -- borrow of `p` occurs here diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.rs b/src/test/ui/in-band-lifetimes/mut_while_borrow.rs index 08ce13d0bcc..97e8ed0d281 100644 --- a/src/test/ui/in-band-lifetimes/mut_while_borrow.rs +++ b/src/test/ui/in-band-lifetimes/mut_while_borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(in_band_lifetimes)] diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr b/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr index 1498eb7ac1d..e710986c721 100644 --- a/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr +++ b/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `p` because it is borrowed - --> $DIR/mut_while_borrow.rs:19:5 + --> $DIR/mut_while_borrow.rs:9:5 | LL | let r = foo(&p); | - borrow of `p` occurs here diff --git a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.rs b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.rs index 0d3e6ba644e..9b0c0cda772 100644 --- a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.rs +++ b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(in_band_lifetimes)] diff --git a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr index da46cb7f22e..9076bdc946a 100644 --- a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr +++ b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr @@ -1,11 +1,11 @@ error[E0261]: use of undeclared lifetime name `'test` - --> $DIR/no_in_band_in_struct.rs:15:9 + --> $DIR/no_in_band_in_struct.rs:5:9 | LL | x: &'test u32, //~ ERROR undeclared lifetime | ^^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'test` - --> $DIR/no_in_band_in_struct.rs:19:10 + --> $DIR/no_in_band_in_struct.rs:9:10 | LL | Baz(&'test u32), //~ ERROR undeclared lifetime | ^^^^^ undeclared lifetime diff --git a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs index eaa082a35da..c1c40afdbab 100644 --- a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs +++ b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(in_band_lifetimes)] diff --git a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr index d53b71907a4..932dea5b2a9 100644 --- a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr +++ b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr @@ -1,11 +1,11 @@ error[E0261]: use of undeclared lifetime name `'test` - --> $DIR/no_introducing_in_band_in_locals.rs:15:13 + --> $DIR/no_introducing_in_band_in_locals.rs:5:13 | LL | let y: &'test u32 = x; //~ ERROR use of undeclared lifetime | ^^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'test` - --> $DIR/no_introducing_in_band_in_locals.rs:20:16 + --> $DIR/no_introducing_in_band_in_locals.rs:10:16 | LL | let y: fn(&'test u32) = foo2; //~ ERROR use of undeclared lifetime | ^^^^^ undeclared lifetime diff --git a/src/test/ui/in-band-lifetimes/shadow.rs b/src/test/ui/in-band-lifetimes/shadow.rs index b6438f01af5..27b5d57488c 100644 --- a/src/test/ui/in-band-lifetimes/shadow.rs +++ b/src/test/ui/in-band-lifetimes/shadow.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(in_band_lifetimes)] diff --git a/src/test/ui/in-band-lifetimes/shadow.stderr b/src/test/ui/in-band-lifetimes/shadow.stderr index 0ee228fca31..ac5bd5b5a33 100644 --- a/src/test/ui/in-band-lifetimes/shadow.stderr +++ b/src/test/ui/in-band-lifetimes/shadow.stderr @@ -1,5 +1,5 @@ error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scope - --> $DIR/shadow.rs:17:12 + --> $DIR/shadow.rs:7:12 | LL | impl Foo<&'s u8> { | -- first declared here @@ -7,7 +7,7 @@ LL | fn bar<'s>(&self, x: &'s u8) {} //~ ERROR shadows a lifetime name | ^^ lifetime 's already in scope error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scope - --> $DIR/shadow.rs:18:19 + --> $DIR/shadow.rs:8:19 | LL | impl Foo<&'s u8> { | -- first declared here diff --git a/src/test/ui/inaccessible-test-modules.rs b/src/test/ui/inaccessible-test-modules.rs index bfc1ac2daef..7095ec290f8 100644 --- a/src/test/ui/inaccessible-test-modules.rs +++ b/src/test/ui/inaccessible-test-modules.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--test // the `--test` harness creates modules with these textual names, but diff --git a/src/test/ui/inaccessible-test-modules.stderr b/src/test/ui/inaccessible-test-modules.stderr index 5b964c1a14b..636ef818705 100644 --- a/src/test/ui/inaccessible-test-modules.stderr +++ b/src/test/ui/inaccessible-test-modules.stderr @@ -1,11 +1,11 @@ error[E0432]: unresolved import `__test` - --> $DIR/inaccessible-test-modules.rs:15:5 + --> $DIR/inaccessible-test-modules.rs:5:5 | LL | use __test as x; //~ ERROR unresolved import `__test` | ^^^^^^^^^^^ no `__test` in the root. Did you mean to use `test`? error[E0432]: unresolved import `__test_reexports` - --> $DIR/inaccessible-test-modules.rs:16:5 + --> $DIR/inaccessible-test-modules.rs:6:5 | LL | use __test_reexports as y; //~ ERROR unresolved import `__test_reexports` | ^^^^^^^^^^^^^^^^^^^^^ no `__test_reexports` in the root. Did you mean to use `__test_reexports`? diff --git a/src/test/ui/include-macros/mismatched-types.rs b/src/test/ui/include-macros/mismatched-types.rs index aca1b071644..83fa378a3ae 100644 --- a/src/test/ui/include-macros/mismatched-types.rs +++ b/src/test/ui/include-macros/mismatched-types.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let b: &[u8] = include_str!("file.txt"); //~ ERROR mismatched types let s: &str = include_bytes!("file.txt"); //~ ERROR mismatched types diff --git a/src/test/ui/include-macros/mismatched-types.stderr b/src/test/ui/include-macros/mismatched-types.stderr index 05286f2ca57..1ee223b23f0 100644 --- a/src/test/ui/include-macros/mismatched-types.stderr +++ b/src/test/ui/include-macros/mismatched-types.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/mismatched-types.rs:12:20 + --> $DIR/mismatched-types.rs:2:20 | LL | let b: &[u8] = include_str!("file.txt"); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found str @@ -8,7 +8,7 @@ LL | let b: &[u8] = include_str!("file.txt"); //~ ERROR mismatched types found type `&'static str` error[E0308]: mismatched types - --> $DIR/mismatched-types.rs:13:19 + --> $DIR/mismatched-types.rs:3:19 | LL | let s: &str = include_bytes!("file.txt"); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found array of 0 elements diff --git a/src/test/ui/index-bot.rs b/src/test/ui/index-bot.rs index fc88ff6f47b..e69c4019f61 100644 --- a/src/test/ui/index-bot.rs +++ b/src/test/ui/index-bot.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { (return)[0]; //~ ERROR cannot index into a value of type `!` } diff --git a/src/test/ui/index-bot.stderr b/src/test/ui/index-bot.stderr index 1086196d6ae..2e2a98d1d80 100644 --- a/src/test/ui/index-bot.stderr +++ b/src/test/ui/index-bot.stderr @@ -1,5 +1,5 @@ error[E0608]: cannot index into a value of type `!` - --> $DIR/index-bot.rs:12:5 + --> $DIR/index-bot.rs:2:5 | LL | (return)[0]; //~ ERROR cannot index into a value of type `!` | ^^^^^^^^^^^ diff --git a/src/test/ui/index-help.rs b/src/test/ui/index-help.rs index 4a64d6c4cc5..66571ec41a0 100644 --- a/src/test/ui/index-help.rs +++ b/src/test/ui/index-help.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = vec![1]; x[0i32]; //~ ERROR E0277 diff --git a/src/test/ui/index-help.stderr b/src/test/ui/index-help.stderr index 669c0837fda..4c585a958c1 100644 --- a/src/test/ui/index-help.stderr +++ b/src/test/ui/index-help.stderr @@ -1,5 +1,5 @@ -error[E0277]: the trait bound `i32: std::slice::SliceIndex<[{integer}]>` is not satisfied - --> $DIR/index-help.rs:13:5 +error[E0277]: the type `[{integer}]` cannot be indexed by `i32` + --> $DIR/index-help.rs:3:5 | LL | x[0i32]; //~ ERROR E0277 | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` diff --git a/src/test/ui/index_message.rs b/src/test/ui/index_message.rs index b9daad936c3..87e0cde5919 100644 --- a/src/test/ui/index_message.rs +++ b/src/test/ui/index_message.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let z = (); let _ = z[0]; //~ ERROR cannot index into a value of type `()` diff --git a/src/test/ui/index_message.stderr b/src/test/ui/index_message.stderr index 208d33e9cd5..62a14523fe9 100644 --- a/src/test/ui/index_message.stderr +++ b/src/test/ui/index_message.stderr @@ -1,5 +1,5 @@ error[E0608]: cannot index into a value of type `()` - --> $DIR/index_message.rs:13:13 + --> $DIR/index_message.rs:3:13 | LL | let _ = z[0]; //~ ERROR cannot index into a value of type `()` | ^^^^ help: to access tuple elements, use: `z.0` diff --git a/src/test/ui/indexing-requires-a-uint.rs b/src/test/ui/indexing-requires-a-uint.rs index 624944f7344..dbe9b44a138 100644 --- a/src/test/ui/indexing-requires-a-uint.rs +++ b/src/test/ui/indexing-requires-a-uint.rs @@ -1,19 +1,9 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure that indexing an array is only valid with a `usize`, not any other // integral type. fn main() { fn bar(_: T) {} - [0][0u8]; //~ ERROR: the trait bound `u8: std::slice::SliceIndex<[{integer}]>` is not satisfied + [0][0u8]; //~ ERROR: the type `[{integer}]` cannot be indexed by `u8` [0][0]; // should infer to be a usize diff --git a/src/test/ui/indexing-requires-a-uint.stderr b/src/test/ui/indexing-requires-a-uint.stderr index e9608e0b235..363c3d0d458 100644 --- a/src/test/ui/indexing-requires-a-uint.stderr +++ b/src/test/ui/indexing-requires-a-uint.stderr @@ -1,14 +1,14 @@ -error[E0277]: the trait bound `u8: std::slice::SliceIndex<[{integer}]>` is not satisfied - --> $DIR/indexing-requires-a-uint.rs:16:5 +error[E0277]: the type `[{integer}]` cannot be indexed by `u8` + --> $DIR/indexing-requires-a-uint.rs:6:5 | -LL | [0][0u8]; //~ ERROR: the trait bound `u8: std::slice::SliceIndex<[{integer}]>` is not satisfied +LL | [0][0u8]; //~ ERROR: the type `[{integer}]` cannot be indexed by `u8` | ^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[{integer}]>` is not implemented for `u8` = note: required because of the requirements on the impl of `std::ops::Index` for `[{integer}]` error[E0308]: mismatched types - --> $DIR/indexing-requires-a-uint.rs:22:18 + --> $DIR/indexing-requires-a-uint.rs:12:18 | LL | bar::(i); // i should not be re-coerced back to an isize | ^ expected isize, found usize diff --git a/src/test/ui/inference/auxiliary/inference_unstable_iterator.rs b/src/test/ui/inference/auxiliary/inference_unstable_iterator.rs index b73346e6332..0dc09704e7f 100644 --- a/src/test/ui/inference/auxiliary/inference_unstable_iterator.rs +++ b/src/test/ui/inference/auxiliary/inference_unstable_iterator.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(staged_api)] #![stable(feature = "ipu_iterator", since = "1.0.0")] diff --git a/src/test/ui/inference/auxiliary/inference_unstable_itertools.rs b/src/test/ui/inference/auxiliary/inference_unstable_itertools.rs index 2ad264ee3d8..964f35ddade 100644 --- a/src/test/ui/inference/auxiliary/inference_unstable_itertools.rs +++ b/src/test/ui/inference/auxiliary/inference_unstable_itertools.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait IpuItertools { fn ipu_flatten(&self) -> u32 { 1 diff --git a/src/test/ui/inference/inference-variable-behind-raw-pointer.rs b/src/test/ui/inference/inference-variable-behind-raw-pointer.rs index 88dc85f1620..513b15ed088 100644 --- a/src/test/ui/inference/inference-variable-behind-raw-pointer.rs +++ b/src/test/ui/inference/inference-variable-behind-raw-pointer.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // tests that the following code compiles, but produces a future-compatibility warning diff --git a/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr b/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr index fe6dc0b0748..52cf68ae2a6 100644 --- a/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr +++ b/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr @@ -1,5 +1,5 @@ warning: type annotations needed - --> $DIR/inference-variable-behind-raw-pointer.rs:18:13 + --> $DIR/inference-variable-behind-raw-pointer.rs:8:13 | LL | if data.is_null() {} | ^^^^^^^ diff --git a/src/test/ui/inference/inference_unstable.rs b/src/test/ui/inference/inference_unstable.rs index 5a70dffd4c8..0b957700182 100644 --- a/src/test/ui/inference/inference_unstable.rs +++ b/src/test/ui/inference/inference_unstable.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensures #[unstable] functions without opting in the corresponding #![feature] // will not break inference. diff --git a/src/test/ui/inference/inference_unstable.stderr b/src/test/ui/inference/inference_unstable.stderr index 2851af4891e..dda203bbc51 100644 --- a/src/test/ui/inference/inference_unstable.stderr +++ b/src/test/ui/inference/inference_unstable.stderr @@ -1,5 +1,5 @@ warning: a method with this name may be added to the standard library in the future - --> $DIR/inference_unstable.rs:26:20 + --> $DIR/inference_unstable.rs:16:20 | LL | assert_eq!('x'.ipu_flatten(), 1); | ^^^^^^^^^^^ diff --git a/src/test/ui/inference/inference_unstable_featured.rs b/src/test/ui/inference/inference_unstable_featured.rs index f5c49bedc71..792b29aaadc 100644 --- a/src/test/ui/inference/inference_unstable_featured.rs +++ b/src/test/ui/inference/inference_unstable_featured.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // There should be E0034 "multiple applicable items in scope" if we opt-in for // the feature. diff --git a/src/test/ui/inference/inference_unstable_featured.stderr b/src/test/ui/inference/inference_unstable_featured.stderr index cb5f3623291..5f025785127 100644 --- a/src/test/ui/inference/inference_unstable_featured.stderr +++ b/src/test/ui/inference/inference_unstable_featured.stderr @@ -1,5 +1,5 @@ error[E0034]: multiple applicable items in scope - --> $DIR/inference_unstable_featured.rs:26:20 + --> $DIR/inference_unstable_featured.rs:16:20 | LL | assert_eq!('x'.ipu_flatten(), 0); //~ ERROR E0034 | ^^^^^^^^^^^ multiple `ipu_flatten` found diff --git a/src/test/ui/inference/inference_unstable_forced.rs b/src/test/ui/inference/inference_unstable_forced.rs index 82ce4034ce2..649b3ed2a6f 100644 --- a/src/test/ui/inference/inference_unstable_forced.rs +++ b/src/test/ui/inference/inference_unstable_forced.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // If the unstable API is the only possible solution, // still emit E0658 "use of unstable library feature". diff --git a/src/test/ui/inference/inference_unstable_forced.stderr b/src/test/ui/inference/inference_unstable_forced.stderr index 00eb81cd9a2..3c07085a648 100644 --- a/src/test/ui/inference/inference_unstable_forced.stderr +++ b/src/test/ui/inference/inference_unstable_forced.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'ipu_flatten' (see issue #99999) - --> $DIR/inference_unstable_forced.rs:21:20 + --> $DIR/inference_unstable_forced.rs:11:20 | LL | assert_eq!('x'.ipu_flatten(), 0); //~ ERROR E0658 | ^^^^^^^^^^^ diff --git a/src/test/ui/infinite/infinite-autoderef.rs b/src/test/ui/infinite/infinite-autoderef.rs index 3635c4dbb02..6d6908ef7f6 100644 --- a/src/test/ui/infinite/infinite-autoderef.rs +++ b/src/test/ui/infinite/infinite-autoderef.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: reached the recursion limit while auto-dereferencing #![feature(box_syntax)] diff --git a/src/test/ui/infinite/infinite-autoderef.stderr b/src/test/ui/infinite/infinite-autoderef.stderr index b5e20ea5cbf..9e4b0a029ab 100644 --- a/src/test/ui/infinite/infinite-autoderef.stderr +++ b/src/test/ui/infinite/infinite-autoderef.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/infinite-autoderef.rs:30:13 + --> $DIR/infinite-autoderef.rs:20:13 | LL | x = box x; | ^^^^^ @@ -7,16 +7,16 @@ LL | x = box x; | cyclic type of infinite size | help: try using a conversion method: `box x.to_string()` -error[E0055]: reached the recursion limit while auto-dereferencing Foo - --> $DIR/infinite-autoderef.rs:35:5 +error[E0055]: reached the recursion limit while auto-dereferencing `Foo` + --> $DIR/infinite-autoderef.rs:25:5 | LL | Foo.foo; | ^^^^^^^ deref recursion limit reached | = help: consider adding a `#![recursion_limit="128"]` attribute to your crate -error[E0055]: reached the recursion limit while auto-dereferencing Foo - --> $DIR/infinite-autoderef.rs:35:9 +error[E0055]: reached the recursion limit while auto-dereferencing `Foo` + --> $DIR/infinite-autoderef.rs:25:9 | LL | Foo.foo; | ^^^ deref recursion limit reached @@ -24,13 +24,13 @@ LL | Foo.foo; = help: consider adding a `#![recursion_limit="128"]` attribute to your crate error[E0609]: no field `foo` on type `Foo` - --> $DIR/infinite-autoderef.rs:35:9 + --> $DIR/infinite-autoderef.rs:25:9 | LL | Foo.foo; | ^^^ unknown field -error[E0055]: reached the recursion limit while auto-dereferencing Foo - --> $DIR/infinite-autoderef.rs:36:9 +error[E0055]: reached the recursion limit while auto-dereferencing `Foo` + --> $DIR/infinite-autoderef.rs:26:9 | LL | Foo.bar(); | ^^^ deref recursion limit reached @@ -38,7 +38,7 @@ LL | Foo.bar(); = help: consider adding a `#![recursion_limit="128"]` attribute to your crate error[E0599]: no method named `bar` found for type `Foo` in the current scope - --> $DIR/infinite-autoderef.rs:36:9 + --> $DIR/infinite-autoderef.rs:26:9 | LL | struct Foo; | ----------- method `bar` not found for this diff --git a/src/test/ui/infinite/infinite-instantiation.rs b/src/test/ui/infinite/infinite-instantiation.rs index 08e6bf24691..4220c8837d2 100644 --- a/src/test/ui/infinite/infinite-instantiation.rs +++ b/src/test/ui/infinite/infinite-instantiation.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // // We get an error message at the top of file (dummy span). // This is not helpful, but also kind of annoying to prevent, diff --git a/src/test/ui/infinite/infinite-instantiation.stderr b/src/test/ui/infinite/infinite-instantiation.stderr index 483605fc389..42be1411b68 100644 --- a/src/test/ui/infinite/infinite-instantiation.stderr +++ b/src/test/ui/infinite/infinite-instantiation.stderr @@ -1,5 +1,5 @@ error: reached the recursion limit while instantiating `function::>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/infinite-instantiation.rs:33:1 + --> $DIR/infinite-instantiation.rs:23:1 | LL | / fn function(counter: usize, t: T) { LL | | //~^ ERROR reached the recursion limit while instantiating `function:: or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! recursive { () => (recursive!()) //~ ERROR recursion limit reached while expanding the macro `recursive` } diff --git a/src/test/ui/infinite/infinite-macro-expansion.stderr b/src/test/ui/infinite/infinite-macro-expansion.stderr index 79216693475..9b64fba8b94 100644 --- a/src/test/ui/infinite/infinite-macro-expansion.stderr +++ b/src/test/ui/infinite/infinite-macro-expansion.stderr @@ -1,5 +1,5 @@ error: recursion limit reached while expanding the macro `recursive` - --> $DIR/infinite-macro-expansion.rs:12:12 + --> $DIR/infinite-macro-expansion.rs:2:12 | LL | () => (recursive!()) //~ ERROR recursion limit reached while expanding the macro `recursive` | ^^^^^^^^^^^^ diff --git a/src/test/ui/infinite/infinite-recursion-const-fn.rs b/src/test/ui/infinite/infinite-recursion-const-fn.rs index ccf67ca3138..020c417bf61 100644 --- a/src/test/ui/infinite/infinite-recursion-const-fn.rs +++ b/src/test/ui/infinite/infinite-recursion-const-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //https://github.com/rust-lang/rust/issues/31364 const fn a() -> usize { b() } //~ ERROR evaluation of constant value failed diff --git a/src/test/ui/infinite/infinite-recursion-const-fn.stderr b/src/test/ui/infinite/infinite-recursion-const-fn.stderr index 4246ec2dad3..3ed7957d14d 100644 --- a/src/test/ui/infinite/infinite-recursion-const-fn.stderr +++ b/src/test/ui/infinite/infinite-recursion-const-fn.stderr @@ -1,65 +1,65 @@ error[E0080]: evaluation of constant value failed - --> $DIR/infinite-recursion-const-fn.rs:13:25 + --> $DIR/infinite-recursion-const-fn.rs:3:25 | LL | const fn a() -> usize { b() } //~ ERROR evaluation of constant value failed | ^^^ | | | reached the configured maximum number of stack frames - | inside call to `b` at $DIR/infinite-recursion-const-fn.rs:13:25 + | inside call to `b` at $DIR/infinite-recursion-const-fn.rs:3:25 LL | const fn b() -> usize { a() } | --- | | - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 - | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:14:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 + | inside call to `a` at $DIR/infinite-recursion-const-fn.rs:4:25 LL | const ARR: [i32; a()] = [5; 6]; - | --- inside call to `a` at $DIR/infinite-recursion-const-fn.rs:15:18 + | --- inside call to `a` at $DIR/infinite-recursion-const-fn.rs:5:18 error: aborting due to previous error diff --git a/src/test/ui/infinite/infinite-tag-type-recursion.rs b/src/test/ui/infinite/infinite-tag-type-recursion.rs index c9a7f731aea..87a9e08dd38 100644 --- a/src/test/ui/infinite/infinite-tag-type-recursion.rs +++ b/src/test/ui/infinite/infinite-tag-type-recursion.rs @@ -1,14 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +enum MList { Cons(isize, MList), Nil } +//~^ ERROR recursive type `MList` has infinite size -enum mlist { cons(isize, mlist), nil, } -//~^ ERROR recursive type `mlist` has infinite size - -fn main() { let a = mlist::cons(10, mlist::cons(11, mlist::nil)); } +fn main() { let a = MList::Cons(10, MList::Cons(11, MList::Nil)); } diff --git a/src/test/ui/infinite/infinite-tag-type-recursion.stderr b/src/test/ui/infinite/infinite-tag-type-recursion.stderr index e1fa3dec64c..88dad0033dd 100644 --- a/src/test/ui/infinite/infinite-tag-type-recursion.stderr +++ b/src/test/ui/infinite/infinite-tag-type-recursion.stderr @@ -1,12 +1,12 @@ -error[E0072]: recursive type `mlist` has infinite size - --> $DIR/infinite-tag-type-recursion.rs:11:1 +error[E0072]: recursive type `MList` has infinite size + --> $DIR/infinite-tag-type-recursion.rs:1:1 | -LL | enum mlist { cons(isize, mlist), nil, } +LL | enum MList { Cons(isize, MList), Nil } | ^^^^^^^^^^ ----- recursive without indirection | | | recursive type has infinite size | - = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `mlist` representable + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `MList` representable error: aborting due to previous error diff --git a/src/test/ui/infinite/infinite-vec-type-recursion.rs b/src/test/ui/infinite/infinite-vec-type-recursion.rs index 42c80b54313..35681822598 100644 --- a/src/test/ui/infinite/infinite-vec-type-recursion.rs +++ b/src/test/ui/infinite/infinite-vec-type-recursion.rs @@ -1,14 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -type x = Vec; +type X = Vec; //~^ ERROR cycle detected -fn main() { let b: x = Vec::new(); } +fn main() { let b: X = Vec::new(); } diff --git a/src/test/ui/infinite/infinite-vec-type-recursion.stderr b/src/test/ui/infinite/infinite-vec-type-recursion.stderr index 3e2d3d6d726..daa18a7e9b1 100644 --- a/src/test/ui/infinite/infinite-vec-type-recursion.stderr +++ b/src/test/ui/infinite/infinite-vec-type-recursion.stderr @@ -1,10 +1,18 @@ -error[E0391]: cycle detected when processing `x` - --> $DIR/infinite-vec-type-recursion.rs:11:14 +error[E0391]: cycle detected when processing `X` + --> $DIR/infinite-vec-type-recursion.rs:1:14 | -LL | type x = Vec; +LL | type X = Vec; | ^ | - = note: ...which again requires processing `x`, completing the cycle + = note: ...which again requires processing `X`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/infinite-vec-type-recursion.rs:1:1 + | +LL | / type X = Vec; +LL | | //~^ ERROR cycle detected +LL | | +LL | | fn main() { let b: X = Vec::new(); } + | |____________________________________^ error: aborting due to previous error diff --git a/src/test/ui/inhabitedness-infinite-loop.rs b/src/test/ui/inhabitedness-infinite-loop.rs deleted file mode 100644 index d11aacec196..00000000000 --- a/src/test/ui/inhabitedness-infinite-loop.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:reached recursion limit - -#![feature(never_type)] -#![feature(exhaustive_patterns)] - -struct Foo<'a, T: 'a> { - ph: std::marker::PhantomData, - foo: &'a Foo<'a, (T, T)>, -} - -fn wub(f: Foo) { - match f {} -} - -fn main() {} - diff --git a/src/test/ui/inhabitedness-infinite-loop.stderr b/src/test/ui/inhabitedness-infinite-loop.stderr deleted file mode 100644 index 24237f3a1b6..00000000000 --- a/src/test/ui/inhabitedness-infinite-loop.stderr +++ /dev/null @@ -1,4 +0,0 @@ -error: reached recursion limit while checking inhabitedness of `Foo<'_, (((((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))))), ((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))))), (((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))))), ((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))))))), ((((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))))), ((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))))), (((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))))), ((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))))))))>` - -error: aborting due to previous error - diff --git a/src/test/ui/init-unsafe.rs b/src/test/ui/init-unsafe.rs index 9e599cebd7a..92b21c4efa3 100644 --- a/src/test/ui/init-unsafe.rs +++ b/src/test/ui/init-unsafe.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(core_intrinsics)] use std::intrinsics::{init}; diff --git a/src/test/ui/init-unsafe.stderr b/src/test/ui/init-unsafe.stderr index f3d041fde01..dba8cc43ff2 100644 --- a/src/test/ui/init-unsafe.stderr +++ b/src/test/ui/init-unsafe.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/init-unsafe.rs:17:17 + --> $DIR/init-unsafe.rs:7:17 | LL | let stuff = init::(); //~ ERROR call to unsafe function is unsafe | ^^^^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/inline-asm-bad-constraint.rs b/src/test/ui/inline-asm-bad-constraint.rs index 5a08a097fd0..cf72afff50b 100644 --- a/src/test/ui/inline-asm-bad-constraint.rs +++ b/src/test/ui/inline-asm-bad-constraint.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the compiler will catch invalid inline assembly constraints. // ignore-emscripten diff --git a/src/test/ui/inline-asm-bad-constraint.stderr b/src/test/ui/inline-asm-bad-constraint.stderr index 44facff0805..1f63d4c2a48 100644 --- a/src/test/ui/inline-asm-bad-constraint.stderr +++ b/src/test/ui/inline-asm-bad-constraint.stderr @@ -1,17 +1,17 @@ error[E0668]: malformed inline assembly - --> $DIR/inline-asm-bad-constraint.rs:31:9 + --> $DIR/inline-asm-bad-constraint.rs:21:9 | LL | asm!("" :"={rax"(rax)) //~ ERROR E0668 | ^^^^^^^^^^^^^^^^^^^^^^ error[E0668]: malformed inline assembly - --> $DIR/inline-asm-bad-constraint.rs:39:9 + --> $DIR/inline-asm-bad-constraint.rs:29:9 | LL | asm!("callq $0" : : "0"(foo)) //~ ERROR E0668 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0668]: malformed inline assembly - --> $DIR/inline-asm-bad-constraint.rs:46:9 + --> $DIR/inline-asm-bad-constraint.rs:36:9 | LL | asm!("addb $1, $0" : "={rax}"((0i32, rax))); //~ ERROR E0668 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/inline-asm-bad-operand.rs b/src/test/ui/inline-asm-bad-operand.rs index 0ee4080fd0c..4cfe100d85b 100644 --- a/src/test/ui/inline-asm-bad-operand.rs +++ b/src/test/ui/inline-asm-bad-operand.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the compiler will catch passing invalid values to inline assembly // operands. diff --git a/src/test/ui/inline-asm-bad-operand.stderr b/src/test/ui/inline-asm-bad-operand.stderr index 1a99aa28f58..f1de38efc03 100644 --- a/src/test/ui/inline-asm-bad-operand.stderr +++ b/src/test/ui/inline-asm-bad-operand.stderr @@ -1,41 +1,41 @@ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:31:24 + --> $DIR/inline-asm-bad-operand.rs:21:24 | LL | asm!("" :: "r"("")); //~ ERROR E0669 | ^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:36:32 + --> $DIR/inline-asm-bad-operand.rs:26:32 | LL | asm!("ret" : : "{rdi}"(target)); //~ ERROR E0669 | ^^^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:43:29 + --> $DIR/inline-asm-bad-operand.rs:33:29 | LL | unsafe { asm!("" :: "i"(hello)) }; //~ ERROR E0669 | ^^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:51:38 + --> $DIR/inline-asm-bad-operand.rs:41:38 | LL | asm!("movups $1, %xmm0"::"m"(arr)); //~ ERROR E0669 | ^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:58:32 + --> $DIR/inline-asm-bad-operand.rs:48:32 | LL | asm!("mov sp, $0"::"r"(addr)); //~ ERROR E0669 | ^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:65:32 + --> $DIR/inline-asm-bad-operand.rs:55:32 | LL | asm!("mov sp, $0"::"r"(addr), //~ ERROR E0669 | ^^^^ error[E0669]: invalid value for constraint in inline assembly - --> $DIR/inline-asm-bad-operand.rs:66:32 + --> $DIR/inline-asm-bad-operand.rs:56:32 | LL | "r"("hello e0669")); //~ ERROR E0669 | ^^^^^^^^^^^^^ diff --git a/src/test/ui/inner-static-type-parameter.rs b/src/test/ui/inner-static-type-parameter.rs index 4d763017c0f..60b4c5b8131 100644 --- a/src/test/ui/inner-static-type-parameter.rs +++ b/src/test/ui/inner-static-type-parameter.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // see #9186 enum Bar { What } //~ ERROR parameter `T` is never used diff --git a/src/test/ui/inner-static-type-parameter.stderr b/src/test/ui/inner-static-type-parameter.stderr index 1820e5c57dd..2f2856edb0c 100644 --- a/src/test/ui/inner-static-type-parameter.stderr +++ b/src/test/ui/inner-static-type-parameter.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use type parameters from outer function - --> $DIR/inner-static-type-parameter.rs:16:19 + --> $DIR/inner-static-type-parameter.rs:6:19 | LL | fn foo() { | --- - type variable from outer function @@ -9,7 +9,7 @@ LL | static a: Bar = Bar::What; | ^ use of type variable from outer function error[E0392]: parameter `T` is never used - --> $DIR/inner-static-type-parameter.rs:13:10 + --> $DIR/inner-static-type-parameter.rs:3:10 | LL | enum Bar { What } //~ ERROR parameter `T` is never used | ^ unused type parameter diff --git a/src/test/ui/integer-literal-suffix-inference.rs b/src/test/ui/integer-literal-suffix-inference.rs index 7a850d90a87..2da3286c700 100644 --- a/src/test/ui/integer-literal-suffix-inference.rs +++ b/src/test/ui/integer-literal-suffix-inference.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { // the smallest positive values that need these types diff --git a/src/test/ui/integer-literal-suffix-inference.stderr b/src/test/ui/integer-literal-suffix-inference.stderr index 1c5d656020c..04c8633c8b5 100644 --- a/src/test/ui/integer-literal-suffix-inference.stderr +++ b/src/test/ui/integer-literal-suffix-inference.stderr @@ -1,23 +1,23 @@ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:42:11 + --> $DIR/integer-literal-suffix-inference.rs:32:11 | LL | id_i8(a16); | ^^^ expected i8, found i16 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:45:11 + --> $DIR/integer-literal-suffix-inference.rs:35:11 | LL | id_i8(a32); | ^^^ expected i8, found i32 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:48:11 + --> $DIR/integer-literal-suffix-inference.rs:38:11 | LL | id_i8(a64); | ^^^ expected i8, found i64 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:52:12 + --> $DIR/integer-literal-suffix-inference.rs:42:12 | LL | id_i16(a8); | ^^ expected i16, found i8 @@ -27,19 +27,19 @@ LL | id_i16(a8.into()); | ^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:56:12 + --> $DIR/integer-literal-suffix-inference.rs:46:12 | LL | id_i16(a32); | ^^^ expected i16, found i32 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:59:12 + --> $DIR/integer-literal-suffix-inference.rs:49:12 | LL | id_i16(a64); | ^^^ expected i16, found i64 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:63:12 + --> $DIR/integer-literal-suffix-inference.rs:53:12 | LL | id_i32(a8); | ^^ expected i32, found i8 @@ -49,7 +49,7 @@ LL | id_i32(a8.into()); | ^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:66:12 + --> $DIR/integer-literal-suffix-inference.rs:56:12 | LL | id_i32(a16); | ^^^ expected i32, found i16 @@ -59,13 +59,13 @@ LL | id_i32(a16.into()); | ^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:70:12 + --> $DIR/integer-literal-suffix-inference.rs:60:12 | LL | id_i32(a64); | ^^^ expected i32, found i64 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:74:12 + --> $DIR/integer-literal-suffix-inference.rs:64:12 | LL | id_i64(a8); | ^^ expected i64, found i8 @@ -75,7 +75,7 @@ LL | id_i64(a8.into()); | ^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:77:12 + --> $DIR/integer-literal-suffix-inference.rs:67:12 | LL | id_i64(a16); | ^^^ expected i64, found i16 @@ -85,7 +85,7 @@ LL | id_i64(a16.into()); | ^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:80:12 + --> $DIR/integer-literal-suffix-inference.rs:70:12 | LL | id_i64(a32); | ^^^ expected i64, found i32 @@ -95,25 +95,25 @@ LL | id_i64(a32.into()); | ^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:86:11 + --> $DIR/integer-literal-suffix-inference.rs:76:11 | LL | id_i8(c16); | ^^^ expected i8, found i16 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:89:11 + --> $DIR/integer-literal-suffix-inference.rs:79:11 | LL | id_i8(c32); | ^^^ expected i8, found i32 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:92:11 + --> $DIR/integer-literal-suffix-inference.rs:82:11 | LL | id_i8(c64); | ^^^ expected i8, found i64 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:96:12 + --> $DIR/integer-literal-suffix-inference.rs:86:12 | LL | id_i16(c8); | ^^ expected i16, found i8 @@ -123,19 +123,19 @@ LL | id_i16(c8.into()); | ^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:100:12 + --> $DIR/integer-literal-suffix-inference.rs:90:12 | LL | id_i16(c32); | ^^^ expected i16, found i32 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:103:12 + --> $DIR/integer-literal-suffix-inference.rs:93:12 | LL | id_i16(c64); | ^^^ expected i16, found i64 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:107:12 + --> $DIR/integer-literal-suffix-inference.rs:97:12 | LL | id_i32(c8); | ^^ expected i32, found i8 @@ -145,7 +145,7 @@ LL | id_i32(c8.into()); | ^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:110:12 + --> $DIR/integer-literal-suffix-inference.rs:100:12 | LL | id_i32(c16); | ^^^ expected i32, found i16 @@ -155,13 +155,13 @@ LL | id_i32(c16.into()); | ^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:114:12 + --> $DIR/integer-literal-suffix-inference.rs:104:12 | LL | id_i32(c64); | ^^^ expected i32, found i64 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:118:12 + --> $DIR/integer-literal-suffix-inference.rs:108:12 | LL | id_i64(a8); | ^^ expected i64, found i8 @@ -171,7 +171,7 @@ LL | id_i64(a8.into()); | ^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:121:12 + --> $DIR/integer-literal-suffix-inference.rs:111:12 | LL | id_i64(a16); | ^^^ expected i64, found i16 @@ -181,7 +181,7 @@ LL | id_i64(a16.into()); | ^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:124:12 + --> $DIR/integer-literal-suffix-inference.rs:114:12 | LL | id_i64(a32); | ^^^ expected i64, found i32 @@ -191,25 +191,25 @@ LL | id_i64(a32.into()); | ^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:130:11 + --> $DIR/integer-literal-suffix-inference.rs:120:11 | LL | id_u8(b16); | ^^^ expected u8, found u16 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:133:11 + --> $DIR/integer-literal-suffix-inference.rs:123:11 | LL | id_u8(b32); | ^^^ expected u8, found u32 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:136:11 + --> $DIR/integer-literal-suffix-inference.rs:126:11 | LL | id_u8(b64); | ^^^ expected u8, found u64 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:140:12 + --> $DIR/integer-literal-suffix-inference.rs:130:12 | LL | id_u16(b8); | ^^ expected u16, found u8 @@ -219,19 +219,19 @@ LL | id_u16(b8.into()); | ^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:144:12 + --> $DIR/integer-literal-suffix-inference.rs:134:12 | LL | id_u16(b32); | ^^^ expected u16, found u32 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:147:12 + --> $DIR/integer-literal-suffix-inference.rs:137:12 | LL | id_u16(b64); | ^^^ expected u16, found u64 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:151:12 + --> $DIR/integer-literal-suffix-inference.rs:141:12 | LL | id_u32(b8); | ^^ expected u32, found u8 @@ -241,7 +241,7 @@ LL | id_u32(b8.into()); | ^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:154:12 + --> $DIR/integer-literal-suffix-inference.rs:144:12 | LL | id_u32(b16); | ^^^ expected u32, found u16 @@ -251,13 +251,13 @@ LL | id_u32(b16.into()); | ^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:158:12 + --> $DIR/integer-literal-suffix-inference.rs:148:12 | LL | id_u32(b64); | ^^^ expected u32, found u64 error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:162:12 + --> $DIR/integer-literal-suffix-inference.rs:152:12 | LL | id_u64(b8); | ^^ expected u64, found u8 @@ -267,7 +267,7 @@ LL | id_u64(b8.into()); | ^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:165:12 + --> $DIR/integer-literal-suffix-inference.rs:155:12 | LL | id_u64(b16); | ^^^ expected u64, found u16 @@ -277,7 +277,7 @@ LL | id_u64(b16.into()); | ^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:168:12 + --> $DIR/integer-literal-suffix-inference.rs:158:12 | LL | id_u64(b32); | ^^^ expected u64, found u32 diff --git a/src/test/ui/integral-indexing.rs b/src/test/ui/integral-indexing.rs index 4b01afb8131..f076dfcb0a4 100644 --- a/src/test/ui/integral-indexing.rs +++ b/src/test/ui/integral-indexing.rs @@ -1,26 +1,16 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let v: Vec = vec![0, 1, 2, 3, 4, 5]; let s: String = "abcdef".to_string(); v[3_usize]; v[3]; - v[3u8]; //~ERROR : std::slice::SliceIndex<[isize]>` is not satisfied - v[3i8]; //~ERROR : std::slice::SliceIndex<[isize]>` is not satisfied - v[3u32]; //~ERROR : std::slice::SliceIndex<[isize]>` is not satisfied - v[3i32]; //~ERROR : std::slice::SliceIndex<[isize]>` is not satisfied + v[3u8]; //~ERROR : the type `[isize]` cannot be indexed by `u8` + v[3i8]; //~ERROR : the type `[isize]` cannot be indexed by `i8` + v[3u32]; //~ERROR : the type `[isize]` cannot be indexed by `u32` + v[3i32]; //~ERROR : the type `[isize]` cannot be indexed by `i32` s.as_bytes()[3_usize]; s.as_bytes()[3]; - s.as_bytes()[3u8]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied - s.as_bytes()[3i8]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied - s.as_bytes()[3u32]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied - s.as_bytes()[3i32]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied + s.as_bytes()[3u8]; //~ERROR : the type `[u8]` cannot be indexed by `u8` + s.as_bytes()[3i8]; //~ERROR : the type `[u8]` cannot be indexed by `i8` + s.as_bytes()[3u32]; //~ERROR : the type `[u8]` cannot be indexed by `u32` + s.as_bytes()[3i32]; //~ERROR : the type `[u8]` cannot be indexed by `i32` } diff --git a/src/test/ui/integral-indexing.stderr b/src/test/ui/integral-indexing.stderr index d86421a7985..efbad86c4d3 100644 --- a/src/test/ui/integral-indexing.stderr +++ b/src/test/ui/integral-indexing.stderr @@ -1,70 +1,70 @@ -error[E0277]: the trait bound `u8: std::slice::SliceIndex<[isize]>` is not satisfied - --> $DIR/integral-indexing.rs:16:5 +error[E0277]: the type `[isize]` cannot be indexed by `u8` + --> $DIR/integral-indexing.rs:6:5 | -LL | v[3u8]; //~ERROR : std::slice::SliceIndex<[isize]>` is not satisfied +LL | v[3u8]; //~ERROR : the type `[isize]` cannot be indexed by `u8` | ^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `u8` = note: required because of the requirements on the impl of `std::ops::Index` for `std::vec::Vec` -error[E0277]: the trait bound `i8: std::slice::SliceIndex<[isize]>` is not satisfied - --> $DIR/integral-indexing.rs:17:5 +error[E0277]: the type `[isize]` cannot be indexed by `i8` + --> $DIR/integral-indexing.rs:7:5 | -LL | v[3i8]; //~ERROR : std::slice::SliceIndex<[isize]>` is not satisfied +LL | v[3i8]; //~ERROR : the type `[isize]` cannot be indexed by `i8` | ^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `i8` = note: required because of the requirements on the impl of `std::ops::Index` for `std::vec::Vec` -error[E0277]: the trait bound `u32: std::slice::SliceIndex<[isize]>` is not satisfied - --> $DIR/integral-indexing.rs:18:5 +error[E0277]: the type `[isize]` cannot be indexed by `u32` + --> $DIR/integral-indexing.rs:8:5 | -LL | v[3u32]; //~ERROR : std::slice::SliceIndex<[isize]>` is not satisfied +LL | v[3u32]; //~ERROR : the type `[isize]` cannot be indexed by `u32` | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `u32` = note: required because of the requirements on the impl of `std::ops::Index` for `std::vec::Vec` -error[E0277]: the trait bound `i32: std::slice::SliceIndex<[isize]>` is not satisfied - --> $DIR/integral-indexing.rs:19:5 +error[E0277]: the type `[isize]` cannot be indexed by `i32` + --> $DIR/integral-indexing.rs:9:5 | -LL | v[3i32]; //~ERROR : std::slice::SliceIndex<[isize]>` is not satisfied +LL | v[3i32]; //~ERROR : the type `[isize]` cannot be indexed by `i32` | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `i32` = note: required because of the requirements on the impl of `std::ops::Index` for `std::vec::Vec` -error[E0277]: the trait bound `u8: std::slice::SliceIndex<[u8]>` is not satisfied - --> $DIR/integral-indexing.rs:22:5 +error[E0277]: the type `[u8]` cannot be indexed by `u8` + --> $DIR/integral-indexing.rs:12:5 | -LL | s.as_bytes()[3u8]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied +LL | s.as_bytes()[3u8]; //~ERROR : the type `[u8]` cannot be indexed by `u8` | ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `u8` = note: required because of the requirements on the impl of `std::ops::Index` for `[u8]` -error[E0277]: the trait bound `i8: std::slice::SliceIndex<[u8]>` is not satisfied - --> $DIR/integral-indexing.rs:23:5 +error[E0277]: the type `[u8]` cannot be indexed by `i8` + --> $DIR/integral-indexing.rs:13:5 | -LL | s.as_bytes()[3i8]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied +LL | s.as_bytes()[3i8]; //~ERROR : the type `[u8]` cannot be indexed by `i8` | ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `i8` = note: required because of the requirements on the impl of `std::ops::Index` for `[u8]` -error[E0277]: the trait bound `u32: std::slice::SliceIndex<[u8]>` is not satisfied - --> $DIR/integral-indexing.rs:24:5 +error[E0277]: the type `[u8]` cannot be indexed by `u32` + --> $DIR/integral-indexing.rs:14:5 | -LL | s.as_bytes()[3u32]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied +LL | s.as_bytes()[3u32]; //~ERROR : the type `[u8]` cannot be indexed by `u32` | ^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `u32` = note: required because of the requirements on the impl of `std::ops::Index` for `[u8]` -error[E0277]: the trait bound `i32: std::slice::SliceIndex<[u8]>` is not satisfied - --> $DIR/integral-indexing.rs:25:5 +error[E0277]: the type `[u8]` cannot be indexed by `i32` + --> $DIR/integral-indexing.rs:15:5 | -LL | s.as_bytes()[3i32]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied +LL | s.as_bytes()[3i32]; //~ERROR : the type `[u8]` cannot be indexed by `i32` | ^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `i32` diff --git a/src/test/ui/integral-variable-unification-error.rs b/src/test/ui/integral-variable-unification-error.rs index f2686ae4d19..3eefcdea3d9 100644 --- a/src/test/ui/integral-variable-unification-error.rs +++ b/src/test/ui/integral-variable-unification-error.rs @@ -1,18 +1,8 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let mut x = 2; x = 5.0; //~^ ERROR mismatched types //~| expected type `{integer}` //~| found type `{float}` - //~| expected integral variable, found floating-point variable + //~| expected integer, found floating-point number } diff --git a/src/test/ui/integral-variable-unification-error.stderr b/src/test/ui/integral-variable-unification-error.stderr index bbaa6030866..262203b7b8e 100644 --- a/src/test/ui/integral-variable-unification-error.stderr +++ b/src/test/ui/integral-variable-unification-error.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/integral-variable-unification-error.rs:13:9 + --> $DIR/integral-variable-unification-error.rs:3:9 | LL | x = 5.0; - | ^^^ expected integral variable, found floating-point variable + | ^^^ expected integer, found floating-point number | = note: expected type `{integer}` found type `{float}` diff --git a/src/test/ui/interior-mutability/interior-mutability.rs b/src/test/ui/interior-mutability/interior-mutability.rs index b0288463e91..ddc882cccf3 100644 --- a/src/test/ui/interior-mutability/interior-mutability.rs +++ b/src/test/ui/interior-mutability/interior-mutability.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cell::Cell; use std::panic::catch_unwind; fn main() { diff --git a/src/test/ui/interior-mutability/interior-mutability.stderr b/src/test/ui/interior-mutability/interior-mutability.stderr index f2aecc55ccb..31390bc6cce 100644 --- a/src/test/ui/interior-mutability/interior-mutability.stderr +++ b/src/test/ui/interior-mutability/interior-mutability.stderr @@ -1,5 +1,5 @@ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/interior-mutability.rs:15:5 + --> $DIR/interior-mutability.rs:5:5 | LL | catch_unwind(|| { x.set(23); }); | ^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary @@ -7,7 +7,7 @@ LL | catch_unwind(|| { x.set(23); }); = help: within `std::cell::Cell`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell` = note: required because it appears within the type `std::cell::Cell` = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `&std::cell::Cell` - = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:15:18: 15:35 x:&std::cell::Cell]` + = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:5:18: 5:35 x:&std::cell::Cell]` = note: required by `std::panic::catch_unwind` error: aborting due to previous error diff --git a/src/test/ui/internal/auxiliary/internal_unstable.rs b/src/test/ui/internal/auxiliary/internal_unstable.rs index a4cd487eb65..7cf54c3e6a6 100644 --- a/src/test/ui/internal/auxiliary/internal_unstable.rs +++ b/src/test/ui/internal/auxiliary/internal_unstable.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(staged_api, allow_internal_unstable)] #![stable(feature = "stable", since = "1.0.0")] diff --git a/src/test/ui/internal/internal-unstable-noallow.rs b/src/test/ui/internal/internal-unstable-noallow.rs index 2e42e9d3b01..616f6668d02 100644 --- a/src/test/ui/internal/internal-unstable-noallow.rs +++ b/src/test/ui/internal/internal-unstable-noallow.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // this has to be separate to internal-unstable.rs because these tests // have error messages pointing deep into the internals of the // cross-crate macros, and hence need to use error-pattern instead of diff --git a/src/test/ui/internal/internal-unstable-noallow.stderr b/src/test/ui/internal/internal-unstable-noallow.stderr index fc8100525e9..7247f68fa43 100644 --- a/src/test/ui/internal/internal-unstable-noallow.stderr +++ b/src/test/ui/internal/internal-unstable-noallow.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'function' - --> $DIR/internal-unstable-noallow.rs:26:5 + --> $DIR/internal-unstable-noallow.rs:16:5 | LL | call_unstable_noallow!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | call_unstable_noallow!(); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error[E0658]: use of unstable library feature 'struct_field' - --> $DIR/internal-unstable-noallow.rs:28:5 + --> $DIR/internal-unstable-noallow.rs:18:5 | LL | construct_unstable_noallow!(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | construct_unstable_noallow!(0); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error[E0658]: use of unstable library feature 'method' - --> $DIR/internal-unstable-noallow.rs:30:35 + --> $DIR/internal-unstable-noallow.rs:20:35 | LL | |x: internal_unstable::Foo| { call_method_noallow!(x) }; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | |x: internal_unstable::Foo| { call_method_noallow!(x) }; = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error[E0658]: use of unstable library feature 'struct2_field' - --> $DIR/internal-unstable-noallow.rs:32:35 + --> $DIR/internal-unstable-noallow.rs:22:35 | LL | |x: internal_unstable::Bar| { access_field_noallow!(x) }; | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/internal/internal-unstable-thread-local.rs b/src/test/ui/internal/internal-unstable-thread-local.rs index 74526fb3d83..b9194c6b370 100644 --- a/src/test/ui/internal/internal-unstable-thread-local.rs +++ b/src/test/ui/internal/internal-unstable-thread-local.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:internal_unstable.rs #![allow(dead_code)] diff --git a/src/test/ui/internal/internal-unstable-thread-local.stderr b/src/test/ui/internal/internal-unstable-thread-local.stderr index b77b94663ff..0e25592b103 100644 --- a/src/test/ui/internal/internal-unstable-thread-local.stderr +++ b/src/test/ui/internal/internal-unstable-thread-local.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'function' - --> $DIR/internal-unstable-thread-local.rs:19:32 + --> $DIR/internal-unstable-thread-local.rs:9:32 | LL | thread_local!(static BAR: () = internal_unstable::unstable()); //~ ERROR use of unstable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/internal/internal-unstable.rs b/src/test/ui/internal/internal-unstable.rs index e01259f0deb..34fef33bfeb 100644 --- a/src/test/ui/internal/internal-unstable.rs +++ b/src/test/ui/internal/internal-unstable.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:internal_unstable.rs #![feature(allow_internal_unstable)] diff --git a/src/test/ui/internal/internal-unstable.stderr b/src/test/ui/internal/internal-unstable.stderr index ec4f0725c34..3e1a44f082e 100644 --- a/src/test/ui/internal/internal-unstable.stderr +++ b/src/test/ui/internal/internal-unstable.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'function' - --> $DIR/internal-unstable.rs:43:25 + --> $DIR/internal-unstable.rs:33:25 | LL | pass_through_allow!(internal_unstable::unstable()); //~ ERROR use of unstable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | pass_through_allow!(internal_unstable::unstable()); //~ ERROR use of un = help: add #![feature(function)] to the crate attributes to enable error[E0658]: use of unstable library feature 'function' - --> $DIR/internal-unstable.rs:45:27 + --> $DIR/internal-unstable.rs:35:27 | LL | pass_through_noallow!(internal_unstable::unstable()); //~ ERROR use of unstable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | pass_through_noallow!(internal_unstable::unstable()); //~ ERROR use of = help: add #![feature(function)] to the crate attributes to enable error[E0658]: use of unstable library feature 'function' - --> $DIR/internal-unstable.rs:49:22 + --> $DIR/internal-unstable.rs:39:22 | LL | println!("{:?}", internal_unstable::unstable()); //~ ERROR use of unstable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | println!("{:?}", internal_unstable::unstable()); //~ ERROR use of unsta = help: add #![feature(function)] to the crate attributes to enable error[E0658]: use of unstable library feature 'function' - --> $DIR/internal-unstable.rs:51:10 + --> $DIR/internal-unstable.rs:41:10 | LL | bar!(internal_unstable::unstable()); //~ ERROR use of unstable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | bar!(internal_unstable::unstable()); //~ ERROR use of unstable = help: add #![feature(function)] to the crate attributes to enable error[E0658]: use of unstable library feature 'function' - --> $DIR/internal-unstable.rs:22:9 + --> $DIR/internal-unstable.rs:12:9 | LL | internal_unstable::unstable(); //~ ERROR use of unstable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/intrinsic-invalid-number-of-arguments.rs b/src/test/ui/intrinsic-invalid-number-of-arguments.rs deleted file mode 100644 index a224690af76..00000000000 --- a/src/test/ui/intrinsic-invalid-number-of-arguments.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test number of arguments in platform-specific intrinsic function -// This is the error E0444 - -#![feature(repr_simd, platform_intrinsics)] - -#[repr(simd)] -struct f64x2(f64, f64); - -extern "platform-intrinsic" { - fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; //~ platform-specific intrinsic -} - -pub fn main() { -} diff --git a/src/test/ui/intrinsic-invalid-number-of-arguments.stderr b/src/test/ui/intrinsic-invalid-number-of-arguments.stderr deleted file mode 100644 index af852b669c4..00000000000 --- a/src/test/ui/intrinsic-invalid-number-of-arguments.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0444]: platform-specific intrinsic has invalid number of arguments: found 3, expected 1 - --> $DIR/intrinsic-invalid-number-of-arguments.rs:20:5 - | -LL | fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; //~ platform-specific intrinsic - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0444`. diff --git a/src/test/ui/invalid-module-declaration/auxiliary/foo/bar.rs b/src/test/ui/invalid-module-declaration/auxiliary/foo/bar.rs index 4b6b4f5ebf8..bcfd7dc0ade 100644 --- a/src/test/ui/invalid-module-declaration/auxiliary/foo/bar.rs +++ b/src/test/ui/invalid-module-declaration/auxiliary/foo/bar.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod baz; diff --git a/src/test/ui/invalid-module-declaration/auxiliary/foo/mod.rs b/src/test/ui/invalid-module-declaration/auxiliary/foo/mod.rs index 6d77fb60a35..46f285ca47d 100644 --- a/src/test/ui/invalid-module-declaration/auxiliary/foo/mod.rs +++ b/src/test/ui/invalid-module-declaration/auxiliary/foo/mod.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod bar; diff --git a/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs b/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs index 229b005ec7d..3b1cd9fbdc8 100644 --- a/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs +++ b/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength mod auxiliary { diff --git a/src/test/ui/invalid-module-declaration/invalid-module-declaration.stderr b/src/test/ui/invalid-module-declaration/invalid-module-declaration.stderr index 2dd62ec0500..c95df5b4534 100644 --- a/src/test/ui/invalid-module-declaration/invalid-module-declaration.stderr +++ b/src/test/ui/invalid-module-declaration/invalid-module-declaration.stderr @@ -1,5 +1,5 @@ error[E0583]: file not found for module `baz` - --> $DIR/auxiliary/foo/bar.rs:11:9 + --> $DIR/auxiliary/foo/bar.rs:1:9 | LL | pub mod baz; | ^^^ diff --git a/src/test/ui/invalid-self-argument/bare-fn-start.rs b/src/test/ui/invalid-self-argument/bare-fn-start.rs new file mode 100644 index 00000000000..741ba5f41ce --- /dev/null +++ b/src/test/ui/invalid-self-argument/bare-fn-start.rs @@ -0,0 +1,5 @@ +fn a(&self) { } +//~^ ERROR unexpected `self` argument in function +//~| NOTE `self` is only valid as the first argument of an associated function + +fn main() { } diff --git a/src/test/ui/invalid-self-argument/bare-fn-start.stderr b/src/test/ui/invalid-self-argument/bare-fn-start.stderr new file mode 100644 index 00000000000..6a878b619d8 --- /dev/null +++ b/src/test/ui/invalid-self-argument/bare-fn-start.stderr @@ -0,0 +1,8 @@ +error: unexpected `self` argument in function + --> $DIR/bare-fn-start.rs:1:7 + | +LL | fn a(&self) { } + | ^^^^ `self` is only valid as the first argument of an associated function + +error: aborting due to previous error + diff --git a/src/test/ui/invalid-self-argument/bare-fn.rs b/src/test/ui/invalid-self-argument/bare-fn.rs new file mode 100644 index 00000000000..704fa996ca6 --- /dev/null +++ b/src/test/ui/invalid-self-argument/bare-fn.rs @@ -0,0 +1,5 @@ +fn b(foo: u32, &mut self) { } +//~^ ERROR unexpected `self` argument in function +//~| NOTE `self` is only valid as the first argument of an associated function + +fn main() { } diff --git a/src/test/ui/invalid-self-argument/bare-fn.stderr b/src/test/ui/invalid-self-argument/bare-fn.stderr new file mode 100644 index 00000000000..b13f746a4ec --- /dev/null +++ b/src/test/ui/invalid-self-argument/bare-fn.stderr @@ -0,0 +1,8 @@ +error: unexpected `self` argument in function + --> $DIR/bare-fn.rs:1:21 + | +LL | fn b(foo: u32, &mut self) { } + | ^^^^ `self` is only valid as the first argument of an associated function + +error: aborting due to previous error + diff --git a/src/test/ui/invalid-self-argument/trait-fn.rs b/src/test/ui/invalid-self-argument/trait-fn.rs new file mode 100644 index 00000000000..31e867bc764 --- /dev/null +++ b/src/test/ui/invalid-self-argument/trait-fn.rs @@ -0,0 +1,11 @@ +struct Foo {} + +impl Foo { + fn c(foo: u32, self) {} + //~^ ERROR unexpected `self` argument in function + //~| NOTE `self` is only valid as the first argument of an associated function + + fn good(&mut self, foo: u32) {} +} + +fn main() { } diff --git a/src/test/ui/invalid-self-argument/trait-fn.stderr b/src/test/ui/invalid-self-argument/trait-fn.stderr new file mode 100644 index 00000000000..b3c2cc5b5eb --- /dev/null +++ b/src/test/ui/invalid-self-argument/trait-fn.stderr @@ -0,0 +1,8 @@ +error: unexpected `self` argument in function + --> $DIR/trait-fn.rs:4:20 + | +LL | fn c(foo: u32, self) {} + | ^^^^ `self` is only valid as the first argument of an associated function + +error: aborting due to previous error + diff --git a/src/test/ui/invalid/invalid-crate-type.rs b/src/test/ui/invalid/invalid-crate-type.rs index e7f4e32dc7c..6c44c3b4f2b 100644 --- a/src/test/ui/invalid/invalid-crate-type.rs +++ b/src/test/ui/invalid/invalid-crate-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // regression test for issue 11256 #![crate_type="foo"] //~ ERROR invalid `crate_type` value diff --git a/src/test/ui/invalid/invalid-crate-type.stderr b/src/test/ui/invalid/invalid-crate-type.stderr index c82da865f33..63edd04650b 100644 --- a/src/test/ui/invalid/invalid-crate-type.stderr +++ b/src/test/ui/invalid/invalid-crate-type.stderr @@ -1,5 +1,5 @@ error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:12:15 + --> $DIR/invalid-crate-type.rs:2:15 | LL | #![crate_type="foo"] //~ ERROR invalid `crate_type` value | ^^^^^ @@ -7,49 +7,49 @@ LL | #![crate_type="foo"] //~ ERROR invalid `crate_type` value = note: #[deny(unknown_crate_types)] on by default error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:16:15 + --> $DIR/invalid-crate-type.rs:6:15 | LL | #![crate_type="statoclib"] | ^^^^^^^^^^^ help: did you mean: `"staticlib"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:21:15 + --> $DIR/invalid-crate-type.rs:11:15 | LL | #![crate_type="procmacro"] | ^^^^^^^^^^^ help: did you mean: `"proc-macro"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:26:15 + --> $DIR/invalid-crate-type.rs:16:15 | LL | #![crate_type="static-lib"] | ^^^^^^^^^^^^ help: did you mean: `"staticlib"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:31:15 + --> $DIR/invalid-crate-type.rs:21:15 | LL | #![crate_type="drylib"] | ^^^^^^^^ help: did you mean: `"dylib"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:36:15 + --> $DIR/invalid-crate-type.rs:26:15 | LL | #![crate_type="dlib"] | ^^^^^^ help: did you mean: `"rlib"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:41:15 + --> $DIR/invalid-crate-type.rs:31:15 | LL | #![crate_type="lob"] | ^^^^^ help: did you mean: `"lib"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:46:15 + --> $DIR/invalid-crate-type.rs:36:15 | LL | #![crate_type="bon"] | ^^^^^ help: did you mean: `"bin"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:51:15 + --> $DIR/invalid-crate-type.rs:41:15 | LL | #![crate_type="cdalib"] | ^^^^^^^^ help: did you mean: `"cdylib"` diff --git a/src/test/ui/invalid/invalid-inline.rs b/src/test/ui/invalid/invalid-inline.rs index 93b985b4fb0..8aa8f99f522 100644 --- a/src/test/ui/invalid/invalid-inline.rs +++ b/src/test/ui/invalid/invalid-inline.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![allow(dead_code)] #[inline(please_no)] //~ ERROR invalid argument diff --git a/src/test/ui/invalid/invalid-inline.stderr b/src/test/ui/invalid/invalid-inline.stderr index d4861c23aee..fdbd25070f7 100644 --- a/src/test/ui/invalid/invalid-inline.stderr +++ b/src/test/ui/invalid/invalid-inline.stderr @@ -1,17 +1,17 @@ error[E0535]: invalid argument - --> $DIR/invalid-inline.rs:12:10 + --> $DIR/invalid-inline.rs:3:10 | LL | #[inline(please_no)] //~ ERROR invalid argument | ^^^^^^^^^ error[E0534]: expected one argument - --> $DIR/invalid-inline.rs:16:1 + --> $DIR/invalid-inline.rs:7:1 | LL | #[inline(please,no)] //~ ERROR expected one argument | ^^^^^^^^^^^^^^^^^^^^ error[E0534]: expected one argument - --> $DIR/invalid-inline.rs:20:1 + --> $DIR/invalid-inline.rs:11:1 | LL | #[inline()] //~ ERROR expected one argument | ^^^^^^^^^^^ diff --git a/src/test/ui/invalid/invalid-macro-matcher.rs b/src/test/ui/invalid/invalid-macro-matcher.rs index d710f5647dd..ff79d4e1a92 100644 --- a/src/test/ui/invalid/invalid-macro-matcher.rs +++ b/src/test/ui/invalid/invalid-macro-matcher.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_macros)] macro_rules! invalid { diff --git a/src/test/ui/invalid/invalid-macro-matcher.stderr b/src/test/ui/invalid/invalid-macro-matcher.stderr index d3ddb613f94..5d6c70fa30b 100644 --- a/src/test/ui/invalid/invalid-macro-matcher.stderr +++ b/src/test/ui/invalid/invalid-macro-matcher.stderr @@ -1,5 +1,5 @@ error: invalid macro matcher; matchers must be contained in balanced delimiters - --> $DIR/invalid-macro-matcher.rs:14:5 + --> $DIR/invalid-macro-matcher.rs:4:5 | LL | _ => (); //~ ERROR invalid macro matcher | ^ diff --git a/src/test/ui/invalid/invalid-path-in-const.rs b/src/test/ui/invalid/invalid-path-in-const.rs index ab839e7630d..51eb8607211 100644 --- a/src/test/ui/invalid/invalid-path-in-const.rs +++ b/src/test/ui/invalid/invalid-path-in-const.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { fn f(a: [u8; u32::DOESNOTEXIST]) {} //~^ ERROR no associated item named `DOESNOTEXIST` found for type `u32` diff --git a/src/test/ui/invalid/invalid-path-in-const.stderr b/src/test/ui/invalid/invalid-path-in-const.stderr index 9214800b93a..13176b8b8fb 100644 --- a/src/test/ui/invalid/invalid-path-in-const.stderr +++ b/src/test/ui/invalid/invalid-path-in-const.stderr @@ -1,8 +1,10 @@ error[E0599]: no associated item named `DOESNOTEXIST` found for type `u32` in the current scope - --> $DIR/invalid-path-in-const.rs:12:18 + --> $DIR/invalid-path-in-const.rs:2:23 | LL | fn f(a: [u8; u32::DOESNOTEXIST]) {} - | ^^^^^^^^^^^^^^^^^ associated item not found in `u32` + | -----^^^^^^^^^^^^ + | | + | associated item not found in `u32` error: aborting due to previous error diff --git a/src/test/ui/invalid/invalid-plugin-attr.rs b/src/test/ui/invalid/invalid-plugin-attr.rs index 3bf09e10ae8..2cbd5233861 100644 --- a/src/test/ui/invalid/invalid-plugin-attr.rs +++ b/src/test/ui/invalid/invalid-plugin-attr.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused_attributes)] #![feature(plugin)] diff --git a/src/test/ui/invalid/invalid-plugin-attr.stderr b/src/test/ui/invalid/invalid-plugin-attr.stderr index a5d321ea9bd..2d7ae1f5cfe 100644 --- a/src/test/ui/invalid/invalid-plugin-attr.stderr +++ b/src/test/ui/invalid/invalid-plugin-attr.stderr @@ -1,17 +1,17 @@ error: unused attribute - --> $DIR/invalid-plugin-attr.rs:14:1 + --> $DIR/invalid-plugin-attr.rs:4:1 | LL | #[plugin(bla)] //~ ERROR unused attribute | ^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/invalid-plugin-attr.rs:11:9 + --> $DIR/invalid-plugin-attr.rs:1:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/invalid-plugin-attr.rs:14:1 + --> $DIR/invalid-plugin-attr.rs:4:1 | LL | #[plugin(bla)] //~ ERROR unused attribute | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/invalid/invalid-variadic-function.rs b/src/test/ui/invalid/invalid-variadic-function.rs index 3d421e00b08..aea630e7c26 100644 --- a/src/test/ui/invalid/invalid-variadic-function.rs +++ b/src/test/ui/invalid/invalid-variadic-function.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern "C" fn foo(x: u8, ...); //~^ ERROR only foreign functions are allowed to be variadic //~| ERROR expected one of `->`, `where`, or `{`, found `;` diff --git a/src/test/ui/invalid/invalid-variadic-function.stderr b/src/test/ui/invalid/invalid-variadic-function.stderr index 13678d10ef5..7a0b8066fd5 100644 --- a/src/test/ui/invalid/invalid-variadic-function.stderr +++ b/src/test/ui/invalid/invalid-variadic-function.stderr @@ -1,11 +1,11 @@ error: only foreign functions are allowed to be variadic - --> $DIR/invalid-variadic-function.rs:11:26 + --> $DIR/invalid-variadic-function.rs:1:26 | LL | extern "C" fn foo(x: u8, ...); | ^^^ error: expected one of `->`, `where`, or `{`, found `;` - --> $DIR/invalid-variadic-function.rs:11:30 + --> $DIR/invalid-variadic-function.rs:1:30 | LL | extern "C" fn foo(x: u8, ...); | ^ expected one of `->`, `where`, or `{` here diff --git a/src/test/ui/invalid_crate_type_syntax.rs b/src/test/ui/invalid_crate_type_syntax.rs index 904a9acf9e5..8157ccdcbf0 100644 --- a/src/test/ui/invalid_crate_type_syntax.rs +++ b/src/test/ui/invalid_crate_type_syntax.rs @@ -1,15 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // regression test for issue 16974 -#![crate_type(lib)] //~ ERROR `crate_type` requires a value +#![crate_type(lib)] //~ ERROR attribute must be of the form fn my_lib_fn() {} diff --git a/src/test/ui/invalid_crate_type_syntax.stderr b/src/test/ui/invalid_crate_type_syntax.stderr index 6f02f96faca..8d6948b583c 100644 --- a/src/test/ui/invalid_crate_type_syntax.stderr +++ b/src/test/ui/invalid_crate_type_syntax.stderr @@ -1,10 +1,8 @@ -error: `crate_type` requires a value - --> $DIR/invalid_crate_type_syntax.rs:12:1 +error: attribute must be of the form `#[crate_type = "bin|lib|..."]` + --> $DIR/invalid_crate_type_syntax.rs:2:1 | -LL | #![crate_type(lib)] //~ ERROR `crate_type` requires a value +LL | #![crate_type(lib)] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^^^^^^ - | - = note: for example: `#![crate_type="lib"]` error: aborting due to previous error diff --git a/src/test/ui/invalid_dispatch_from_dyn_impls.rs b/src/test/ui/invalid_dispatch_from_dyn_impls.rs index 1cf5c73ab13..c4716893fbc 100644 --- a/src/test/ui/invalid_dispatch_from_dyn_impls.rs +++ b/src/test/ui/invalid_dispatch_from_dyn_impls.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unsize, dispatch_from_dyn)] use std::{ diff --git a/src/test/ui/invalid_dispatch_from_dyn_impls.stderr b/src/test/ui/invalid_dispatch_from_dyn_impls.stderr index 82186b67d97..8ee0a40a529 100644 --- a/src/test/ui/invalid_dispatch_from_dyn_impls.stderr +++ b/src/test/ui/invalid_dispatch_from_dyn_impls.stderr @@ -1,5 +1,5 @@ error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs containing the field being coerced, `PhantomData` fields, and nothing else - --> $DIR/invalid_dispatch_from_dyn_impls.rs:20:1 + --> $DIR/invalid_dispatch_from_dyn_impls.rs:10:1 | LL | / impl DispatchFromDyn> for WrapperWithExtraField LL | | where @@ -10,7 +10,7 @@ LL | | {} //~^^^ ERROR [E0378] = note: extra field `1` of type `i32` is not allowed error[E0378]: implementing the `DispatchFromDyn` trait requires multiple coercions - --> $DIR/invalid_dispatch_from_dyn_impls.rs:31:1 + --> $DIR/invalid_dispatch_from_dyn_impls.rs:21:1 | LL | / impl DispatchFromDyn> for MultiplePointers LL | | where @@ -22,13 +22,13 @@ LL | | {} //~^^^ ERROR [E0378] = note: currently, 2 fields need coercions: `ptr1` (`*const T` to `*const U`), `ptr2` (`*const T` to `*const U`) error[E0378]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced, none found - --> $DIR/invalid_dispatch_from_dyn_impls.rs:41:1 + --> $DIR/invalid_dispatch_from_dyn_impls.rs:31:1 | LL | impl DispatchFromDyn> for NothingToCoerce {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0378]: structs implementing `DispatchFromDyn` may not have `#[repr(packed)]` or `#[repr(C)]` - --> $DIR/invalid_dispatch_from_dyn_impls.rs:47:1 + --> $DIR/invalid_dispatch_from_dyn_impls.rs:37:1 | LL | / impl DispatchFromDyn> for HasReprC LL | | where diff --git a/src/test/ui/issue-18986.rs b/src/test/ui/issue-18986.rs new file mode 100644 index 00000000000..1c431a45ab2 --- /dev/null +++ b/src/test/ui/issue-18986.rs @@ -0,0 +1,10 @@ +// aux-build:use_from_trait_xc.rs + +extern crate use_from_trait_xc; +pub use use_from_trait_xc::Trait; + +fn main() { + match () { + Trait { x: 42 } => () //~ ERROR expected struct, variant or union type, found trait `Trait` + } +} diff --git a/src/test/ui/issue-18986.stderr b/src/test/ui/issue-18986.stderr new file mode 100644 index 00000000000..440782b0b1f --- /dev/null +++ b/src/test/ui/issue-18986.stderr @@ -0,0 +1,9 @@ +error[E0574]: expected struct, variant or union type, found trait `Trait` + --> $DIR/issue-18986.rs:8:9 + | +LL | Trait { x: 42 } => () //~ ERROR expected struct, variant or union type, found trait `Trait` + | ^^^^^ not a struct, variant or union type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0574`. diff --git a/src/test/ui/issue-53787-inline-assembler-macro.rs b/src/test/ui/issue-53787-inline-assembler-macro.rs new file mode 100644 index 00000000000..937bce1b655 --- /dev/null +++ b/src/test/ui/issue-53787-inline-assembler-macro.rs @@ -0,0 +1,23 @@ +// Regression test for Issue #53787: Fix ICE when creating a label in inline assembler with macros. + +#![feature(asm)] + +macro_rules! fake_jump { + ($id:expr) => { + unsafe { + asm!( + " + jmp $0 + lea eax, [ebx] + xor eax, 0xDEADBEEF + retn + $0: + "::"0"($id)::"volatile", "intel"); + } + }; +} + +fn main() { + fake_jump!("FirstFunc"); //~ ERROR invalid value for constraint in inline assembly + println!("Hello, world!"); +} diff --git a/src/test/ui/issue-53787-inline-assembler-macro.stderr b/src/test/ui/issue-53787-inline-assembler-macro.stderr new file mode 100644 index 00000000000..69f380bdc9c --- /dev/null +++ b/src/test/ui/issue-53787-inline-assembler-macro.stderr @@ -0,0 +1,9 @@ +error[E0669]: invalid value for constraint in inline assembly + --> $DIR/issue-53787-inline-assembler-macro.rs:21:16 + | +LL | fake_jump!("FirstFunc"); //~ ERROR invalid value for constraint in inline assembly + | ^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0669`. diff --git a/src/test/ui/issue-54943-1.rs b/src/test/ui/issue-54943-1.rs new file mode 100644 index 00000000000..7750e340361 --- /dev/null +++ b/src/test/ui/issue-54943-1.rs @@ -0,0 +1,15 @@ +#![feature(nll)] + +// This test is a minimal version of an ICE in the dropck-eyepatch tests +// found in the fix for #54943. + +// compile-pass + +fn foo(_t: T) { +} + +fn main() { + struct A<'a, B: 'a>(&'a B); + let (a1, a2): (String, A<_>) = (String::from("auto"), A(&"this")); + foo((a1, a2)); +} diff --git a/src/test/ui/issue-54943-2.rs b/src/test/ui/issue-54943-2.rs new file mode 100644 index 00000000000..f829c38c35d --- /dev/null +++ b/src/test/ui/issue-54943-2.rs @@ -0,0 +1,18 @@ +#![feature(nll)] + +// This test is a minimal version of an ICE in the dropck-eyepatch tests +// found in the fix for #54943. In particular, this test is in unreachable +// code as the initial fix for this ICE only worked if the code was reachable. + +// compile-pass + +fn foo(_t: T) { +} + +fn main() { + return; + + struct A<'a, B: 'a>(&'a B); + let (a1, a2): (String, A<_>) = (String::from("auto"), A(&"this")); + foo((a1, a2)); +} diff --git a/src/test/ui/issue-54943-3.rs b/src/test/ui/issue-54943-3.rs new file mode 100644 index 00000000000..185077bd684 --- /dev/null +++ b/src/test/ui/issue-54943-3.rs @@ -0,0 +1,21 @@ +// compile-pass +// FIXME(#54943) This test targets the scenario where proving the WF requirements requires +// knowing the value of the `_` type present in the user type annotation - unfortunately, figuring +// out the value of that `_` requires type-checking the surrounding code, but that code is dead, +// so our NLL region checker doesn't have access to it. This test should actually fail to compile. + +#![feature(nll)] +#![allow(warnings)] + +use std::fmt::Debug; + +fn foo(_: T) { } + +fn bar<'a>() { + return; + + let _x = foo::>(Vec::<&'a u32>::new()); + //~^ ERROR the type `&'a u32` does not fulfill the required lifetime [E0477] +} + +fn main() {} diff --git a/src/test/ui/issue-54943.rs b/src/test/ui/issue-54943.rs new file mode 100644 index 00000000000..ce4e0106743 --- /dev/null +++ b/src/test/ui/issue-54943.rs @@ -0,0 +1,13 @@ +#![feature(nll)] +#![allow(warnings)] + +fn foo() { } + +fn boo<'a>() { + return; + + let x = foo::<&'a u32>(); + //~^ ERROR lifetime may not live long enough +} + +fn main() {} diff --git a/src/test/ui/issue-54943.stderr b/src/test/ui/issue-54943.stderr new file mode 100644 index 00000000000..aa68177bcdb --- /dev/null +++ b/src/test/ui/issue-54943.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-54943.rs:9:13 + | +LL | fn boo<'a>() { + | -- lifetime `'a` defined here +... +LL | let x = foo::<&'a u32>(); + | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/issue-55511.nll.stderr b/src/test/ui/issue-55511.nll.stderr new file mode 100644 index 00000000000..bf3e58e8cdb --- /dev/null +++ b/src/test/ui/issue-55511.nll.stderr @@ -0,0 +1,15 @@ +error[E0597]: `a` does not live long enough + --> $DIR/issue-55511.rs:13:28 + | +LL | let b = Some(Cell::new(&a)); + | ^^ borrowed value does not live long enough +... +LL | <() as Foo<'static>>::C => { } + | ----------------------- type annotation requires that `a` is borrowed for `'static` +... +LL | } + | - `a` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/issue-55511.rs b/src/test/ui/issue-55511.rs new file mode 100644 index 00000000000..4b9475ba627 --- /dev/null +++ b/src/test/ui/issue-55511.rs @@ -0,0 +1,19 @@ +use std::cell::Cell; + +trait Foo<'a> { + const C: Option>; +} + +impl<'a, T> Foo<'a> for T { + const C: Option> = None; +} + +fn main() { + let a = 22; + let b = Some(Cell::new(&a)); + //~^ ERROR `a` does not live long enough [E0597] + match b { + <() as Foo<'static>>::C => { } + _ => { } + } +} diff --git a/src/test/ui/issue-55511.stderr b/src/test/ui/issue-55511.stderr new file mode 100644 index 00000000000..24668f04551 --- /dev/null +++ b/src/test/ui/issue-55511.stderr @@ -0,0 +1,14 @@ +error[E0597]: `a` does not live long enough + --> $DIR/issue-55511.rs:13:29 + | +LL | let b = Some(Cell::new(&a)); + | ^ borrowed value does not live long enough +... +LL | } + | - borrowed value only lives until here + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/issue-55846.rs b/src/test/ui/issue-55846.rs new file mode 100644 index 00000000000..bd766752360 --- /dev/null +++ b/src/test/ui/issue-55846.rs @@ -0,0 +1,39 @@ +// run-pass + +// Regression test for #55846, which once caused an ICE. + +use std::marker::PhantomData; + +struct Foo; + +struct Bar { + a: PhantomData, +} + +impl Fooifier for Foo { + type Assoc = Foo; +} + +trait Fooifier { + type Assoc; +} + +trait Barifier { + fn barify(); +} + +impl Barifier for Bar { + fn barify() { + println!("All correct!"); + } +} + +impl Bar<::Assoc> { + fn this_shouldnt_crash() { + ::Assoc>>::barify(); + } +} + +fn main() { + Bar::::this_shouldnt_crash(); +} diff --git a/src/test/ui/issues/auxiliary/empty-struct.rs b/src/test/ui/issues/auxiliary/empty-struct.rs index 4a302865634..3fb40f6bfa9 100644 --- a/src/test/ui/issues/auxiliary/empty-struct.rs +++ b/src/test/ui/issues/auxiliary/empty-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct XEmpty1 {} pub struct XEmpty2; pub struct XEmpty6(); diff --git a/src/test/ui/issues/auxiliary/issue-11680.rs b/src/test/ui/issues/auxiliary/issue-11680.rs index 18f78750b15..74abbf0bf8c 100644 --- a/src/test/ui/issues/auxiliary/issue-11680.rs +++ b/src/test/ui/issues/auxiliary/issue-11680.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { Bar(isize) } diff --git a/src/test/ui/issues/auxiliary/issue-16725.rs b/src/test/ui/issues/auxiliary/issue-16725.rs index b3b04b4a5ac..b75b5e2d8d7 100644 --- a/src/test/ui/issues/auxiliary/issue-16725.rs +++ b/src/test/ui/issues/auxiliary/issue-16725.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { fn bar(); } diff --git a/src/test/ui/issues/auxiliary/issue-17718-const-privacy.rs b/src/test/ui/issues/auxiliary/issue-17718-const-privacy.rs index 3901d73382f..93cf4bf3ecc 100644 --- a/src/test/ui/issues/auxiliary/issue-17718-const-privacy.rs +++ b/src/test/ui/issues/auxiliary/issue-17718-const-privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub use foo::FOO2; pub const FOO: usize = 3; diff --git a/src/test/ui/issues/auxiliary/issue-19163.rs b/src/test/ui/issues/auxiliary/issue-19163.rs index 76c5cdafd7c..0c0d9e43c1d 100644 --- a/src/test/ui/issues/auxiliary/issue-19163.rs +++ b/src/test/ui/issues/auxiliary/issue-19163.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #[macro_export] diff --git a/src/test/ui/issues/auxiliary/issue-1920.rs b/src/test/ui/issues/auxiliary/issue-1920.rs index 55065174ca7..1548cb99563 100644 --- a/src/test/ui/issues/auxiliary/issue-1920.rs +++ b/src/test/ui/issues/auxiliary/issue-1920.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Just exporting some type to test for correct diagnostics when this // crate is pulled in at a non-root location in client crate. diff --git a/src/test/ui/issues/auxiliary/issue-21146-inc.rs b/src/test/ui/issues/auxiliary/issue-21146-inc.rs index 1b740d112e9..32a3b9dcc35 100644 --- a/src/test/ui/issues/auxiliary/issue-21146-inc.rs +++ b/src/test/ui/issues/auxiliary/issue-21146-inc.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // include file for issue-21146.rs parse_error diff --git a/src/test/ui/issues/auxiliary/issue-21202.rs b/src/test/ui/issues/auxiliary/issue-21202.rs index afdbf78aa82..e3daa1ba0d5 100644 --- a/src/test/ui/issues/auxiliary/issue-21202.rs +++ b/src/test/ui/issues/auxiliary/issue-21202.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod A { pub struct Foo; impl Foo { diff --git a/src/test/ui/issues/auxiliary/issue-29181.rs b/src/test/ui/issues/auxiliary/issue-29181.rs index 361f1ea5509..bd1a9be4ef1 100644 --- a/src/test/ui/issues/auxiliary/issue-29181.rs +++ b/src/test/ui/issues/auxiliary/issue-29181.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub mod foo { diff --git a/src/test/ui/issues/auxiliary/issue-30123-aux.rs b/src/test/ui/issues/auxiliary/issue-30123-aux.rs index f60311a9400..07c743eb2aa 100644 --- a/src/test/ui/issues/auxiliary/issue-30123-aux.rs +++ b/src/test/ui/issues/auxiliary/issue-30123-aux.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker::PhantomData; pub struct Directed; diff --git a/src/test/ui/issues/auxiliary/issue-30535.rs b/src/test/ui/issues/auxiliary/issue-30535.rs index 8d44e8d1016..3608d4a2f14 100644 --- a/src/test/ui/issues/auxiliary/issue-30535.rs +++ b/src/test/ui/issues/auxiliary/issue-30535.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub enum Foo { diff --git a/src/test/ui/issues/auxiliary/issue-36708.rs b/src/test/ui/issues/auxiliary/issue-36708.rs index e64e63a2139..bd8580f9782 100644 --- a/src/test/ui/issues/auxiliary/issue-36708.rs +++ b/src/test/ui/issues/auxiliary/issue-36708.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] pub trait Foo { diff --git a/src/test/ui/issues/auxiliary/issue-36881-aux.rs b/src/test/ui/issues/auxiliary/issue-36881-aux.rs index 33ac11feb2d..e373b64384f 100644 --- a/src/test/ui/issues/auxiliary/issue-36881-aux.rs +++ b/src/test/ui/issues/auxiliary/issue-36881-aux.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo {} diff --git a/src/test/ui/issues/auxiliary/issue-41549.rs b/src/test/ui/issues/auxiliary/issue-41549.rs index 5a6db789282..b7bd375250f 100644 --- a/src/test/ui/issues/auxiliary/issue-41549.rs +++ b/src/test/ui/issues/auxiliary/issue-41549.rs @@ -1,14 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub trait Trait { const CONST: u32; } diff --git a/src/test/ui/issues/auxiliary/issue-52489.rs b/src/test/ui/issues/auxiliary/issue-52489.rs index 68d1ef8d776..c649930c2b4 100644 --- a/src/test/ui/issues/auxiliary/issue-52489.rs +++ b/src/test/ui/issues/auxiliary/issue-52489.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] #![unstable(feature = "issue_52489_unstable", issue = "0")] #![feature(staged_api)] diff --git a/src/test/ui/issues/auxiliary/issue-56943.rs b/src/test/ui/issues/auxiliary/issue-56943.rs new file mode 100644 index 00000000000..65b9beb91f9 --- /dev/null +++ b/src/test/ui/issues/auxiliary/issue-56943.rs @@ -0,0 +1,3 @@ +pub struct S; +mod m { pub struct S; } +pub use crate::m::S as S2; diff --git a/src/test/ui/issues/auxiliary/issue-5844-aux.rs b/src/test/ui/issues/auxiliary/issue-5844-aux.rs index 7fa937e93b3..ea83378cad6 100644 --- a/src/test/ui/issues/auxiliary/issue-5844-aux.rs +++ b/src/test/ui/issues/auxiliary/issue-5844-aux.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern "C" { pub fn rand() -> u32; } diff --git a/src/test/ui/issues/auxiliary/lint-stability.rs b/src/test/ui/issues/auxiliary/lint-stability.rs index 5547458abbe..3188d706ab0 100644 --- a/src/test/ui/issues/auxiliary/lint-stability.rs +++ b/src/test/ui/issues/auxiliary/lint-stability.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="lint_stability"] #![crate_type = "lib"] #![feature(staged_api)] diff --git a/src/test/ui/issues/auxiliary/private-trait-xc.rs b/src/test/ui/issues/auxiliary/private-trait-xc.rs index 37ee10c8d37..481a48a7cd8 100644 --- a/src/test/ui/issues/auxiliary/private-trait-xc.rs +++ b/src/test/ui/issues/auxiliary/private-trait-xc.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo {} diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs b/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs index 95b2d62e426..9ab570fd170 100644 --- a/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs +++ b/src/test/ui/issues/auxiliary/xcrate-issue-43189-a.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs b/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs index a396c31e21d..31dfb050b27 100644 --- a/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs +++ b/src/test/ui/issues/auxiliary/xcrate-issue-43189-b.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub extern crate xcrate_issue_43189_a; diff --git a/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs b/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs index 80f877f834d..2b517b5784a 100644 --- a/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs +++ b/src/test/ui/issues/auxiliary/xcrate-issue-46112-rexport-core.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type="lib"] pub extern crate core; diff --git a/src/test/ui/issues/issue-10176.rs b/src/test/ui/issues/issue-10176.rs index c968844ae21..ff0619b489d 100644 --- a/src/test/ui/issues/issue-10176.rs +++ b/src/test/ui/issues/issue-10176.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f() -> isize { (return 1, return 2) //~^ ERROR mismatched types diff --git a/src/test/ui/issues/issue-10176.stderr b/src/test/ui/issues/issue-10176.stderr index 02e0b899b3f..45482447ebe 100644 --- a/src/test/ui/issues/issue-10176.stderr +++ b/src/test/ui/issues/issue-10176.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-10176.rs:12:5 + --> $DIR/issue-10176.rs:2:5 | LL | fn f() -> isize { | ----- expected `isize` because of return type diff --git a/src/test/ui/issues/issue-10200.rs b/src/test/ui/issues/issue-10200.rs index 8c58ef6261e..12867a878f3 100644 --- a/src/test/ui/issues/issue-10200.rs +++ b/src/test/ui/issues/issue-10200.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo(bool); fn foo(_: usize) -> Foo { Foo(false) } diff --git a/src/test/ui/issues/issue-10200.stderr b/src/test/ui/issues/issue-10200.stderr index 4eb07827628..ac1ad118a71 100644 --- a/src/test/ui/issues/issue-10200.stderr +++ b/src/test/ui/issues/issue-10200.stderr @@ -1,8 +1,8 @@ error[E0532]: expected tuple struct/variant, found function `foo` - --> $DIR/issue-10200.rs:16:9 + --> $DIR/issue-10200.rs:6:9 | LL | foo(x) //~ ERROR expected tuple struct/variant, found function `foo` - | ^^^ did you mean `Foo`? + | ^^^ help: a tuple struct with a similar name exists: `Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-10291.rs b/src/test/ui/issues/issue-10291.rs index d4e7dc7e9a3..877b0aba473 100644 --- a/src/test/ui/issues/issue-10291.rs +++ b/src/test/ui/issues/issue-10291.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn test<'x>(x: &'x isize) { drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { x //~ ERROR E0312 diff --git a/src/test/ui/issues/issue-10291.stderr b/src/test/ui/issues/issue-10291.stderr index af5929782f6..9bd42895017 100644 --- a/src/test/ui/issues/issue-10291.stderr +++ b/src/test/ui/issues/issue-10291.stderr @@ -1,19 +1,19 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/issue-10291.rs:13:9 + --> $DIR/issue-10291.rs:3:9 | LL | x //~ ERROR E0312 | ^ | -note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 12:65... - --> $DIR/issue-10291.rs:12:65 +note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 2:65... + --> $DIR/issue-10291.rs:2:65 | LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | _________________________________________________________________^ LL | | x //~ ERROR E0312 LL | | })); | |_____^ -note: ...but the borrowed content is only valid for the lifetime 'x as defined on the function body at 11:9 - --> $DIR/issue-10291.rs:11:9 +note: ...but the borrowed content is only valid for the lifetime 'x as defined on the function body at 1:9 + --> $DIR/issue-10291.rs:1:9 | LL | fn test<'x>(x: &'x isize) { | ^^ diff --git a/src/test/ui/issues/issue-10396.rs b/src/test/ui/issues/issue-10396.rs index 4b4571f99db..d8e9aec8180 100644 --- a/src/test/ui/issues/issue-10396.rs +++ b/src/test/ui/issues/issue-10396.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #[derive(Debug)] diff --git a/src/test/ui/issues/issue-10398.nll.stderr b/src/test/ui/issues/issue-10398.nll.stderr index d13e843b94b..f5f4974265b 100644 --- a/src/test/ui/issues/issue-10398.nll.stderr +++ b/src/test/ui/issues/issue-10398.nll.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/issue-10398.rs:17:14 + --> $DIR/issue-10398.rs:7:14 | LL | let _a = x; | - value moved here diff --git a/src/test/ui/issues/issue-10398.rs b/src/test/ui/issues/issue-10398.rs index 08e8effc626..0405b2d01e2 100644 --- a/src/test/ui/issues/issue-10398.rs +++ b/src/test/ui/issues/issue-10398.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn main() { diff --git a/src/test/ui/issues/issue-10398.stderr b/src/test/ui/issues/issue-10398.stderr index e3b816df3f4..ceb2cfe2b75 100644 --- a/src/test/ui/issues/issue-10398.stderr +++ b/src/test/ui/issues/issue-10398.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/issue-10398.rs:17:14 + --> $DIR/issue-10398.rs:7:14 | LL | let _a = x; | -- value moved here diff --git a/src/test/ui/issues/issue-10401.rs b/src/test/ui/issues/issue-10401.rs index e36193aee25..d77ff381e1a 100644 --- a/src/test/ui/issues/issue-10401.rs +++ b/src/test/ui/issues/issue-10401.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let mut a = "a"; a += { "b" }; diff --git a/src/test/ui/issues/issue-10401.stderr b/src/test/ui/issues/issue-10401.stderr index 94d13d5f268..1f68abcfb43 100644 --- a/src/test/ui/issues/issue-10401.stderr +++ b/src/test/ui/issues/issue-10401.stderr @@ -1,5 +1,5 @@ error[E0368]: binary assignment operation `+=` cannot be applied to type `&str` - --> $DIR/issue-10401.rs:13:5 + --> $DIR/issue-10401.rs:3:5 | LL | a += { "b" }; | -^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-10412.rs b/src/test/ui/issues/issue-10412.rs index ee553730a35..a0bc2fc2f3c 100644 --- a/src/test/ui/issues/issue-10412.rs +++ b/src/test/ui/issues/issue-10412.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names fn serialize(val : &'self T) -> Vec; //~ ERROR lifetimes cannot use keyword names fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names diff --git a/src/test/ui/issues/issue-10412.stderr b/src/test/ui/issues/issue-10412.stderr index 7f2f2dbf509..8128ba22fde 100644 --- a/src/test/ui/issues/issue-10412.stderr +++ b/src/test/ui/issues/issue-10412.stderr @@ -1,47 +1,47 @@ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:11:20 + --> $DIR/issue-10412.rs:1:20 | LL | trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:12:25 + --> $DIR/issue-10412.rs:2:25 | LL | fn serialize(val : &'self T) -> Vec; //~ ERROR lifetimes cannot use keyword names | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:13:38 + --> $DIR/issue-10412.rs:3:38 | LL | fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:16:6 + --> $DIR/issue-10412.rs:6:6 | LL | impl<'self> Serializable for &'self str { //~ ERROR lifetimes cannot use keyword names | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:16:36 + --> $DIR/issue-10412.rs:6:36 | LL | impl<'self> Serializable for &'self str { //~ ERROR lifetimes cannot use keyword names | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:19:25 + --> $DIR/issue-10412.rs:9:25 | LL | fn serialize(val : &'self str) -> Vec { //~ ERROR lifetimes cannot use keyword names | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/issue-10412.rs:22:37 + --> $DIR/issue-10412.rs:12:37 | LL | fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names | ^^^^^ error[E0106]: missing lifetime specifier - --> $DIR/issue-10412.rs:16:13 + --> $DIR/issue-10412.rs:6:13 | LL | impl<'self> Serializable for &'self str { //~ ERROR lifetimes cannot use keyword names | ^^^^^^^^^^^^^^^^^ expected lifetime parameter diff --git a/src/test/ui/issues/issue-10456.rs b/src/test/ui/issues/issue-10456.rs index ed8c5e96570..4b548362f4a 100644 --- a/src/test/ui/issues/issue-10456.rs +++ b/src/test/ui/issues/issue-10456.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-10465.rs b/src/test/ui/issues/issue-10465.rs index ed91e935407..d899c3ffa91 100644 --- a/src/test/ui/issues/issue-10465.rs +++ b/src/test/ui/issues/issue-10465.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod a { pub trait A { fn foo(&self); diff --git a/src/test/ui/issues/issue-10465.stderr b/src/test/ui/issues/issue-10465.stderr index add4b832e83..41613cfa010 100644 --- a/src/test/ui/issues/issue-10465.stderr +++ b/src/test/ui/issues/issue-10465.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `foo` found for type `&b::B` in the current scope - --> $DIR/issue-10465.rs:27:15 + --> $DIR/issue-10465.rs:17:15 | LL | b.foo(); //~ ERROR: no method named `foo` found | ^^^ diff --git a/src/test/ui/issues/issue-10536.rs b/src/test/ui/issues/issue-10536.rs index 2b71fb5c67f..95c8c2b0585 100644 --- a/src/test/ui/issues/issue-10536.rs +++ b/src/test/ui/issues/issue-10536.rs @@ -1,18 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We only want to assert that this doesn't ICE, we don't particularly care // about whether it nor it fails to compile. -// error-pattern: - macro_rules! foo{ () => {{ macro_rules! bar{() => (())} @@ -25,9 +13,11 @@ pub fn main() { assert!({one! two()}); //~^ ERROR macros that expand to items must either be surrounded with braces or followed by a + //~| ERROR cannot find macro `one!` in this scope + //~| ERROR mismatched types // regardless of whether nested macro_rules works, the following should at // least throw a conventional error. assert!({one! two}); - //~^ ERROR expected + //~^ ERROR expected `(` or `{`, found `}` } diff --git a/src/test/ui/issues/issue-10536.stderr b/src/test/ui/issues/issue-10536.stderr index ba404d0dd3f..d5caf777cd4 100644 --- a/src/test/ui/issues/issue-10536.stderr +++ b/src/test/ui/issues/issue-10536.stderr @@ -1,14 +1,30 @@ error: macros that expand to items must either be surrounded with braces or followed by a semicolon - --> $DIR/issue-10536.rs:26:22 + --> $DIR/issue-10536.rs:14:22 | LL | assert!({one! two()}); | ^^ error: expected `(` or `{`, found `}` - --> $DIR/issue-10536.rs:31:22 + --> $DIR/issue-10536.rs:21:22 | LL | assert!({one! two}); | ^ expected `(` or `{` -error: aborting due to 2 previous errors +error: cannot find macro `one!` in this scope + --> $DIR/issue-10536.rs:14:14 + | +LL | assert!({one! two()}); + | ^^^ + +error[E0308]: mismatched types + --> $DIR/issue-10536.rs:14:13 + | +LL | assert!({one! two()}); + | ^^^^^^^^^^^^ expected bool, found () + | + = note: expected type `bool` + found type `()` + +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-10545.rs b/src/test/ui/issues/issue-10545.rs index 708eea39a95..acd07149619 100644 --- a/src/test/ui/issues/issue-10545.rs +++ b/src/test/ui/issues/issue-10545.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - mod a { struct S; impl S { } diff --git a/src/test/ui/issues/issue-10545.stderr b/src/test/ui/issues/issue-10545.stderr index 93a09843253..e486a17bda9 100644 --- a/src/test/ui/issues/issue-10545.stderr +++ b/src/test/ui/issues/issue-10545.stderr @@ -1,5 +1,5 @@ error[E0603]: struct `S` is private - --> $DIR/issue-10545.rs:17:14 + --> $DIR/issue-10545.rs:6:14 | LL | fn foo(_: a::S) { //~ ERROR: struct `S` is private | ^ diff --git a/src/test/ui/issues/issue-10656.rs b/src/test/ui/issues/issue-10656.rs index 7fd5a0d1348..8918dadb47a 100644 --- a/src/test/ui/issues/issue-10656.rs +++ b/src/test/ui/issues/issue-10656.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(missing_docs)] #![crate_type="lib"] //~^^ ERROR missing documentation for crate diff --git a/src/test/ui/issues/issue-10656.stderr b/src/test/ui/issues/issue-10656.stderr index d67463f0263..818457f5079 100644 --- a/src/test/ui/issues/issue-10656.stderr +++ b/src/test/ui/issues/issue-10656.stderr @@ -1,12 +1,12 @@ error: missing documentation for crate - --> $DIR/issue-10656.rs:11:1 + --> $DIR/issue-10656.rs:1:1 | LL | / #![deny(missing_docs)] LL | | #![crate_type="lib"] | |____________________^ | note: lint level defined here - --> $DIR/issue-10656.rs:11:9 + --> $DIR/issue-10656.rs:1:9 | LL | #![deny(missing_docs)] | ^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-10763.rs b/src/test/ui/issues/issue-10763.rs index 08653b1c696..f2d4c5b47d7 100644 --- a/src/test/ui/issues/issue-10763.rs +++ b/src/test/ui/issues/issue-10763.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-10764.rs b/src/test/ui/issues/issue-10764.rs index cd4ec495556..8fa3607815a 100644 --- a/src/test/ui/issues/issue-10764.rs +++ b/src/test/ui/issues/issue-10764.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f(_: extern "Rust" fn()) {} extern fn bar() {} diff --git a/src/test/ui/issues/issue-10764.stderr b/src/test/ui/issues/issue-10764.stderr index 6aacbef0897..c5f1887b796 100644 --- a/src/test/ui/issues/issue-10764.stderr +++ b/src/test/ui/issues/issue-10764.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-10764.rs:14:15 + --> $DIR/issue-10764.rs:4:15 | LL | fn main() { f(bar) } | ^^^ expected "Rust" fn, found "C" fn diff --git a/src/test/ui/issues/issue-10853.rs b/src/test/ui/issues/issue-10853.rs index 6e2aea4d1ab..0b74eaddcdd 100644 --- a/src/test/ui/issues/issue-10853.rs +++ b/src/test/ui/issues/issue-10853.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-10877.rs b/src/test/ui/issues/issue-10877.rs index 39f25b837cd..b57929be284 100644 --- a/src/test/ui/issues/issue-10877.rs +++ b/src/test/ui/issues/issue-10877.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: isize } extern { fn foo(1: ()); diff --git a/src/test/ui/issues/issue-10877.stderr b/src/test/ui/issues/issue-10877.stderr index 6db0bf6dc65..0f9dc211cea 100644 --- a/src/test/ui/issues/issue-10877.stderr +++ b/src/test/ui/issues/issue-10877.stderr @@ -1,23 +1,23 @@ error[E0130]: patterns aren't allowed in foreign function declarations - --> $DIR/issue-10877.rs:13:12 + --> $DIR/issue-10877.rs:3:12 | LL | fn foo(1: ()); | ^ pattern not allowed in foreign function error[E0130]: patterns aren't allowed in foreign function declarations - --> $DIR/issue-10877.rs:15:12 + --> $DIR/issue-10877.rs:5:12 | LL | fn bar((): isize); | ^^ pattern not allowed in foreign function error[E0130]: patterns aren't allowed in foreign function declarations - --> $DIR/issue-10877.rs:17:12 + --> $DIR/issue-10877.rs:7:12 | LL | fn baz(Foo { x }: isize); | ^^^^^^^^^ pattern not allowed in foreign function error[E0130]: patterns aren't allowed in foreign function declarations - --> $DIR/issue-10877.rs:19:12 + --> $DIR/issue-10877.rs:9:12 | LL | fn qux((x,y): ()); | ^^^^^ pattern not allowed in foreign function diff --git a/src/test/ui/issues/issue-10902.rs b/src/test/ui/issues/issue-10902.rs index 24bf90b2d9d..672386bc8a6 100644 --- a/src/test/ui/issues/issue-10902.rs +++ b/src/test/ui/issues/issue-10902.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-10969.rs b/src/test/ui/issues/issue-10969.rs index 4ab4a8b579a..0b78fc1bb7f 100644 --- a/src/test/ui/issues/issue-10969.rs +++ b/src/test/ui/issues/issue-10969.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn func(i: i32) { i(); //~ERROR expected function, found `i32` } diff --git a/src/test/ui/issues/issue-10969.stderr b/src/test/ui/issues/issue-10969.stderr index d04108ca39e..0eaed9464b4 100644 --- a/src/test/ui/issues/issue-10969.stderr +++ b/src/test/ui/issues/issue-10969.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `i32` - --> $DIR/issue-10969.rs:12:5 + --> $DIR/issue-10969.rs:2:5 | LL | fn func(i: i32) { | - `i32` defined here @@ -9,7 +9,7 @@ LL | i(); //~ERROR expected function, found `i32` | call expression requires function error[E0618]: expected function, found `i32` - --> $DIR/issue-10969.rs:16:5 + --> $DIR/issue-10969.rs:6:5 | LL | let i = 0i32; | - `i32` defined here diff --git a/src/test/ui/issues/issue-10991.rs b/src/test/ui/issues/issue-10991.rs index 2d00f339f33..c36829fdf5b 100644 --- a/src/test/ui/issues/issue-10991.rs +++ b/src/test/ui/issues/issue-10991.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let nil = (); let _t = nil as usize; //~ ERROR: non-primitive cast: `()` as `usize` diff --git a/src/test/ui/issues/issue-10991.stderr b/src/test/ui/issues/issue-10991.stderr index 3ae3bbe06cb..c91b15cb3fb 100644 --- a/src/test/ui/issues/issue-10991.stderr +++ b/src/test/ui/issues/issue-10991.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `()` as `usize` - --> $DIR/issue-10991.rs:13:14 + --> $DIR/issue-10991.rs:3:14 | LL | let _t = nil as usize; //~ ERROR: non-primitive cast: `()` as `usize` | ^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-11004.rs b/src/test/ui/issues/issue-11004.rs index 503fa647512..10ef1f5e3b5 100644 --- a/src/test/ui/issues/issue-11004.rs +++ b/src/test/ui/issues/issue-11004.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem; struct A { x: i32, y: f64 } diff --git a/src/test/ui/issues/issue-11004.stderr b/src/test/ui/issues/issue-11004.stderr index 215120c9c25..a5c63e9c31d 100644 --- a/src/test/ui/issues/issue-11004.stderr +++ b/src/test/ui/issues/issue-11004.stderr @@ -1,14 +1,18 @@ error[E0609]: no field `x` on type `*mut A` - --> $DIR/issue-11004.rs:17:21 + --> $DIR/issue-11004.rs:7:21 | LL | let x : i32 = n.x; //~ no field `x` on type `*mut A` - | ^ help: `n` is a native pointer; try dereferencing it: `(*n).x` + | --^ + | | + | help: `n` is a raw pointer; try dereferencing it: `(*n).x` error[E0609]: no field `y` on type `*mut A` - --> $DIR/issue-11004.rs:18:21 + --> $DIR/issue-11004.rs:8:21 | LL | let y : f64 = n.y; //~ no field `y` on type `*mut A` - | ^ help: `n` is a native pointer; try dereferencing it: `(*n).y` + | --^ + | | + | help: `n` is a raw pointer; try dereferencing it: `(*n).y` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-11154.rs b/src/test/ui/issues/issue-11154.rs index 1ff68123374..7513abd8a5b 100644 --- a/src/test/ui/issues/issue-11154.rs +++ b/src/test/ui/issues/issue-11154.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C lto -C prefer-dynamic // error-pattern: cannot prefer dynamic linking diff --git a/src/test/ui/issues/issue-11192.nll.stderr b/src/test/ui/issues/issue-11192.nll.stderr index 4d4320083e4..2a9d913171c 100644 --- a/src/test/ui/issues/issue-11192.nll.stderr +++ b/src/test/ui/issues/issue-11192.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable - --> $DIR/issue-11192.rs:30:10 + --> $DIR/issue-11192.rs:20:10 | LL | let mut test = |foo: &Foo| { | ----------- mutable borrow occurs here diff --git a/src/test/ui/issues/issue-11192.rs b/src/test/ui/issues/issue-11192.rs index 7d8a1528aba..3bf91675ec3 100644 --- a/src/test/ui/issues/issue-11192.rs +++ b/src/test/ui/issues/issue-11192.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] struct Foo { diff --git a/src/test/ui/issues/issue-11192.stderr b/src/test/ui/issues/issue-11192.stderr index e9853ac0ca8..37ae73685b4 100644 --- a/src/test/ui/issues/issue-11192.stderr +++ b/src/test/ui/issues/issue-11192.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*ptr` as immutable because `ptr` is also borrowed as mutable - --> $DIR/issue-11192.rs:30:11 + --> $DIR/issue-11192.rs:20:11 | LL | let mut test = |foo: &Foo| { | ----------- mutable borrow occurs here diff --git a/src/test/ui/issues/issue-11319.rs b/src/test/ui/issues/issue-11319.rs index 20636ed1ea9..ea901205544 100644 --- a/src/test/ui/issues/issue-11319.rs +++ b/src/test/ui/issues/issue-11319.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match Some(10) { //~^ ERROR match arms have incompatible types diff --git a/src/test/ui/issues/issue-11319.stderr b/src/test/ui/issues/issue-11319.stderr index 8189cf5ea17..44d63ba3e68 100644 --- a/src/test/ui/issues/issue-11319.stderr +++ b/src/test/ui/issues/issue-11319.stderr @@ -1,5 +1,5 @@ error[E0308]: match arms have incompatible types - --> $DIR/issue-11319.rs:12:5 + --> $DIR/issue-11319.rs:2:5 | LL | / match Some(10) { LL | | //~^ ERROR match arms have incompatible types diff --git a/src/test/ui/issues/issue-11374.rs b/src/test/ui/issues/issue-11374.rs index 1e444a6bebf..f00da0acf81 100644 --- a/src/test/ui/issues/issue-11374.rs +++ b/src/test/ui/issues/issue-11374.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::io::{self, Read}; use std::vec; diff --git a/src/test/ui/issues/issue-11374.stderr b/src/test/ui/issues/issue-11374.stderr index 3465069129b..6cd552f86e1 100644 --- a/src/test/ui/issues/issue-11374.stderr +++ b/src/test/ui/issues/issue-11374.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-11374.rs:36:15 + --> $DIR/issue-11374.rs:26:15 | LL | c.read_to(v); //~ ERROR E0308 | ^ diff --git a/src/test/ui/issues/issue-11384.rs b/src/test/ui/issues/issue-11384.rs index af4e7fc389e..59d85b175cf 100644 --- a/src/test/ui/issues/issue-11384.rs +++ b/src/test/ui/issues/issue-11384.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-11493.ast.stderr b/src/test/ui/issues/issue-11493.ast.stderr index 99b996387e7..a5f8aefd194 100644 --- a/src/test/ui/issues/issue-11493.ast.stderr +++ b/src/test/ui/issues/issue-11493.ast.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough (Ast) - --> $DIR/issue-11493.rs:20:35 + --> $DIR/issue-11493.rs:10:35 | LL | let y = x.as_ref().unwrap_or(&id(5)); | ^^^^^ - temporary value dropped here while still borrowed diff --git a/src/test/ui/issues/issue-11493.mir.stderr b/src/test/ui/issues/issue-11493.mir.stderr index 99b996387e7..a5f8aefd194 100644 --- a/src/test/ui/issues/issue-11493.mir.stderr +++ b/src/test/ui/issues/issue-11493.mir.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough (Ast) - --> $DIR/issue-11493.rs:20:35 + --> $DIR/issue-11493.rs:10:35 | LL | let y = x.as_ref().unwrap_or(&id(5)); | ^^^^^ - temporary value dropped here while still borrowed diff --git a/src/test/ui/issues/issue-11493.rs b/src/test/ui/issues/issue-11493.rs index 80ecc24543e..4fdc32b42c2 100644 --- a/src/test/ui/issues/issue-11493.rs +++ b/src/test/ui/issues/issue-11493.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file must never have a trailing newline // // revisions: ast mir diff --git a/src/test/ui/issues/issue-11515.rs b/src/test/ui/issues/issue-11515.rs index 7afb8314ea6..7eab2a26178 100644 --- a/src/test/ui/issues/issue-11515.rs +++ b/src/test/ui/issues/issue-11515.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] struct Test { diff --git a/src/test/ui/issues/issue-11515.stderr b/src/test/ui/issues/issue-11515.stderr index 25e2a45438e..d7d51a32414 100644 --- a/src/test/ui/issues/issue-11515.stderr +++ b/src/test/ui/issues/issue-11515.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-11515.rs:19:33 + --> $DIR/issue-11515.rs:9:33 | LL | let test = box Test { func: closure }; //~ ERROR mismatched types | ^^^^^^^ expected trait `std::ops::FnMut`, found trait `std::ops::Fn` diff --git a/src/test/ui/issues/issue-11592.rs b/src/test/ui/issues/issue-11592.rs index 11c6fecd78d..e2028bd56f9 100644 --- a/src/test/ui/issues/issue-11592.rs +++ b/src/test/ui/issues/issue-11592.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass //! Ensure the private trait Bar isn't complained about. diff --git a/src/test/ui/issues/issue-11593.rs b/src/test/ui/issues/issue-11593.rs index f962704dc75..8bf034e8203 100644 --- a/src/test/ui/issues/issue-11593.rs +++ b/src/test/ui/issues/issue-11593.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:private-trait-xc.rs extern crate private_trait_xc; diff --git a/src/test/ui/issues/issue-11593.stderr b/src/test/ui/issues/issue-11593.stderr index bb5303cb581..c3e4412b042 100644 --- a/src/test/ui/issues/issue-11593.stderr +++ b/src/test/ui/issues/issue-11593.stderr @@ -1,5 +1,5 @@ error[E0603]: trait `Foo` is private - --> $DIR/issue-11593.rs:17:24 + --> $DIR/issue-11593.rs:7:24 | LL | impl private_trait_xc::Foo for Bar {} | ^^^ diff --git a/src/test/ui/issues/issue-11612.rs b/src/test/ui/issues/issue-11612.rs index 293dd6dfaaa..4d6f4656d58 100644 --- a/src/test/ui/issues/issue-11612.rs +++ b/src/test/ui/issues/issue-11612.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // #11612 diff --git a/src/test/ui/issues/issue-11680.rs b/src/test/ui/issues/issue-11680.rs index 209b63104fa..bfa8f5c5a1b 100644 --- a/src/test/ui/issues/issue-11680.rs +++ b/src/test/ui/issues/issue-11680.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-11680.rs extern crate issue_11680 as other; diff --git a/src/test/ui/issues/issue-11680.stderr b/src/test/ui/issues/issue-11680.stderr index 4dfd0bf15b9..35cb2476992 100644 --- a/src/test/ui/issues/issue-11680.stderr +++ b/src/test/ui/issues/issue-11680.stderr @@ -1,11 +1,11 @@ error[E0603]: enum `Foo` is private - --> $DIR/issue-11680.rs:16:21 + --> $DIR/issue-11680.rs:6:21 | LL | let _b = other::Foo::Bar(1); | ^^^ error[E0603]: enum `Foo` is private - --> $DIR/issue-11680.rs:19:27 + --> $DIR/issue-11680.rs:9:27 | LL | let _b = other::test::Foo::Bar(1); | ^^^ diff --git a/src/test/ui/issues/issue-11681.nll.stderr b/src/test/ui/issues/issue-11681.nll.stderr index 0ea60fdf461..a3c71ffe95a 100644 --- a/src/test/ui/issues/issue-11681.nll.stderr +++ b/src/test/ui/issues/issue-11681.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing temporary value - --> $DIR/issue-11681.rs:23:10 + --> $DIR/issue-11681.rs:13:10 | LL | let testValue = &Test; //~ ERROR borrowed value does not live long enough | ---- temporary value created here diff --git a/src/test/ui/issues/issue-11681.rs b/src/test/ui/issues/issue-11681.rs index 71f1d5dcc9a..8294ca6b22e 100644 --- a/src/test/ui/issues/issue-11681.rs +++ b/src/test/ui/issues/issue-11681.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This tests verifies that unary structs and enum variants // are treated as rvalues and their lifetime is not bounded to // the static scope. diff --git a/src/test/ui/issues/issue-11681.stderr b/src/test/ui/issues/issue-11681.stderr index ef3d24c6657..210c6dc5a00 100644 --- a/src/test/ui/issues/issue-11681.stderr +++ b/src/test/ui/issues/issue-11681.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/issue-11681.rs:22:20 + --> $DIR/issue-11681.rs:12:20 | LL | let testValue = &Test; //~ ERROR borrowed value does not live long enough | ^^^^ temporary value does not live long enough @@ -7,8 +7,8 @@ LL | return testValue; LL | } | - temporary value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:15... - --> $DIR/issue-11681.rs:21:15 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 11:15... + --> $DIR/issue-11681.rs:11:15 | LL | fn createTest<'a>() -> &'a Test { | ^^ diff --git a/src/test/ui/issues/issue-11692-1.rs b/src/test/ui/issues/issue-11692-1.rs index ff6009da72f..70b712c5608 100644 --- a/src/test/ui/issues/issue-11692-1.rs +++ b/src/test/ui/issues/issue-11692-1.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { - print!(testo!()); - //~^ ERROR: format argument must be a string literal + print!(testo!()); //~ ERROR cannot find macro `testo!` in this scope } diff --git a/src/test/ui/issues/issue-11692-1.stderr b/src/test/ui/issues/issue-11692-1.stderr index 61ff455d16c..57a6a999544 100644 --- a/src/test/ui/issues/issue-11692-1.stderr +++ b/src/test/ui/issues/issue-11692-1.stderr @@ -1,11 +1,7 @@ -error: format argument must be a string literal - --> $DIR/issue-11692-1.rs:12:12 +error: cannot find macro `testo!` in this scope + --> $DIR/issue-11692-1.rs:2:12 | -LL | print!(testo!()); - | ^^^^^^^^ -help: you might be missing a string literal to format with - | -LL | print!("{}", testo!()); +LL | print!(testo!()); //~ ERROR cannot find macro `testo!` in this scope | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-11692-2.rs b/src/test/ui/issues/issue-11692-2.rs index a4b8b48384d..61be284d732 100644 --- a/src/test/ui/issues/issue-11692-2.rs +++ b/src/test/ui/issues/issue-11692-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { concat!(test!()); //~ ERROR cannot find macro `test!` in this scope } diff --git a/src/test/ui/issues/issue-11692-2.stderr b/src/test/ui/issues/issue-11692-2.stderr index 85f600dbff2..5d4467080f1 100644 --- a/src/test/ui/issues/issue-11692-2.stderr +++ b/src/test/ui/issues/issue-11692-2.stderr @@ -1,5 +1,5 @@ error: cannot find macro `test!` in this scope - --> $DIR/issue-11692-2.rs:12:13 + --> $DIR/issue-11692-2.rs:2:13 | LL | concat!(test!()); //~ ERROR cannot find macro `test!` in this scope | ^^^^ diff --git a/src/test/ui/issues/issue-11740.rs b/src/test/ui/issues/issue-11740.rs index b41d81f332c..47bdf085ee5 100644 --- a/src/test/ui/issues/issue-11740.rs +++ b/src/test/ui/issues/issue-11740.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(warnings)] diff --git a/src/test/ui/issues/issue-11771.rs b/src/test/ui/issues/issue-11771.rs index 69899105bc3..c69cd1e79e3 100644 --- a/src/test/ui/issues/issue-11771.rs +++ b/src/test/ui/issues/issue-11771.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = (); 1 + diff --git a/src/test/ui/issues/issue-11771.stderr b/src/test/ui/issues/issue-11771.stderr index a31c4fa008d..e78d8423e83 100644 --- a/src/test/ui/issues/issue-11771.stderr +++ b/src/test/ui/issues/issue-11771.stderr @@ -1,5 +1,5 @@ error[E0277]: cannot add `()` to `{integer}` - --> $DIR/issue-11771.rs:13:7 + --> $DIR/issue-11771.rs:3:7 | LL | 1 + | ^ no implementation for `{integer} + ()` @@ -7,7 +7,7 @@ LL | 1 + = help: the trait `std::ops::Add<()>` is not implemented for `{integer}` error[E0277]: cannot add `()` to `{integer}` - --> $DIR/issue-11771.rs:18:7 + --> $DIR/issue-11771.rs:8:7 | LL | 1 + | ^ no implementation for `{integer} + ()` diff --git a/src/test/ui/issues/issue-11844.rs b/src/test/ui/issues/issue-11844.rs index a6dbe954ec0..bb06f00d5cf 100644 --- a/src/test/ui/issues/issue-11844.rs +++ b/src/test/ui/issues/issue-11844.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn main() { diff --git a/src/test/ui/issues/issue-11844.stderr b/src/test/ui/issues/issue-11844.stderr index d773e88d01c..683ad48ff52 100644 --- a/src/test/ui/issues/issue-11844.stderr +++ b/src/test/ui/issues/issue-11844.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types - --> $DIR/issue-11844.rs:16:9 + --> $DIR/issue-11844.rs:6:9 | +LL | match a { + | - this match expression has type `std::option::Option>` LL | Ok(a) => //~ ERROR: mismatched types | ^^^^^ expected enum `std::option::Option`, found enum `std::result::Result` | diff --git a/src/test/ui/issues/issue-11869.rs b/src/test/ui/issues/issue-11869.rs index 102b79ac203..e62879f1f29 100644 --- a/src/test/ui/issues/issue-11869.rs +++ b/src/test/ui/issues/issue-11869.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-11873.nll.stderr b/src/test/ui/issues/issue-11873.nll.stderr index bf4fed06dee..e5abf074202 100644 --- a/src/test/ui/issues/issue-11873.nll.stderr +++ b/src/test/ui/issues/issue-11873.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `v` because it is borrowed - --> $DIR/issue-11873.rs:14:14 + --> $DIR/issue-11873.rs:4:14 | LL | let mut f = || v.push(2); | -- - borrow occurs due to use in closure diff --git a/src/test/ui/issues/issue-11873.rs b/src/test/ui/issues/issue-11873.rs index 4618851529a..d3bd05caf38 100644 --- a/src/test/ui/issues/issue-11873.rs +++ b/src/test/ui/issues/issue-11873.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let mut v = vec![1]; let mut f = || v.push(2); diff --git a/src/test/ui/issues/issue-11873.stderr b/src/test/ui/issues/issue-11873.stderr index f4da011f572..1e44754c707 100644 --- a/src/test/ui/issues/issue-11873.stderr +++ b/src/test/ui/issues/issue-11873.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `v` because it is borrowed - --> $DIR/issue-11873.rs:14:9 + --> $DIR/issue-11873.rs:4:9 | LL | let mut f = || v.push(2); | -- borrow of `v` occurs here diff --git a/src/test/ui/issues/issue-12028.rs b/src/test/ui/issues/issue-12028.rs index 980385ce4cc..d55354529a9 100644 --- a/src/test/ui/issues/issue-12028.rs +++ b/src/test/ui/issues/issue-12028.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test an example where we fail to infer the type parameter H. This // is because there is really nothing constraining it. At one time, we // would infer based on the where clauses in scope, but that no longer diff --git a/src/test/ui/issues/issue-12028.stderr b/src/test/ui/issues/issue-12028.stderr index f756e0a29d1..7b0850581ce 100644 --- a/src/test/ui/issues/issue-12028.stderr +++ b/src/test/ui/issues/issue-12028.stderr @@ -1,5 +1,5 @@ error[E0284]: type annotations required: cannot resolve `<_ as StreamHasher>::S == ::S` - --> $DIR/issue-12028.rs:39:14 + --> $DIR/issue-12028.rs:29:14 | LL | self.input_stream(&mut stream); //~ ERROR type annotations required | ^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-12041.nll.stderr b/src/test/ui/issues/issue-12041.nll.stderr index a0b90c7a34a..d95cc89ce99 100644 --- a/src/test/ui/issues/issue-12041.nll.stderr +++ b/src/test/ui/issues/issue-12041.nll.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `tx` - --> $DIR/issue-12041.rs:18:22 + --> $DIR/issue-12041.rs:8:22 | LL | let tx = tx; | ^^ value moved here, in previous iteration of loop diff --git a/src/test/ui/issues/issue-12041.rs b/src/test/ui/issues/issue-12041.rs index f0f4bf5ca71..091e8fe8b2a 100644 --- a/src/test/ui/issues/issue-12041.rs +++ b/src/test/ui/issues/issue-12041.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::sync::mpsc::channel; use std::thread; diff --git a/src/test/ui/issues/issue-12041.stderr b/src/test/ui/issues/issue-12041.stderr index 6172d78b513..48544c073ef 100644 --- a/src/test/ui/issues/issue-12041.stderr +++ b/src/test/ui/issues/issue-12041.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `tx` - --> $DIR/issue-12041.rs:18:17 + --> $DIR/issue-12041.rs:8:17 | LL | let tx = tx; | ^^ value moved here in previous iteration of loop diff --git a/src/test/ui/issues/issue-12116.rs b/src/test/ui/issues/issue-12116.rs index a8d2c552553..8b391cd95d7 100644 --- a/src/test/ui/issues/issue-12116.rs +++ b/src/test/ui/issues/issue-12116.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_patterns)] #![feature(box_syntax)] #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-12116.stderr b/src/test/ui/issues/issue-12116.stderr index 3bf0984b256..10db4f1c031 100644 --- a/src/test/ui/issues/issue-12116.stderr +++ b/src/test/ui/issues/issue-12116.stderr @@ -1,11 +1,11 @@ error: unreachable pattern - --> $DIR/issue-12116.rs:25:9 + --> $DIR/issue-12116.rs:15:9 | LL | &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, box IntList::Nil), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-12116.rs:15:9 + --> $DIR/issue-12116.rs:5:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-12127.rs b/src/test/ui/issues/issue-12127.rs index 5565a9a5761..bb2c2734583 100644 --- a/src/test/ui/issues/issue-12127.rs +++ b/src/test/ui/issues/issue-12127.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax, unboxed_closures)] fn to_fn_once>(f: F) -> F { f } diff --git a/src/test/ui/issues/issue-12127.stderr b/src/test/ui/issues/issue-12127.stderr index afd483823a6..2283b1275d0 100644 --- a/src/test/ui/issues/issue-12127.stderr +++ b/src/test/ui/issues/issue-12127.stderr @@ -1,12 +1,12 @@ error[E0382]: use of moved value: `f` - --> $DIR/issue-12127.rs:21:9 + --> $DIR/issue-12127.rs:11:9 | LL | f(); | - value moved here LL | f(); | ^ value used here after move | - = note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:18:24: 18:41 x:std::boxed::Box]`, which does not implement the `Copy` trait + = note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:8:24: 8:41 x:std::boxed::Box]`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/issues/issue-12187-1.rs b/src/test/ui/issues/issue-12187-1.rs index c429b73bc95..37ff468e032 100644 --- a/src/test/ui/issues/issue-12187-1.rs +++ b/src/test/ui/issues/issue-12187-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn new() -> &'static T { panic!() } diff --git a/src/test/ui/issues/issue-12187-1.stderr b/src/test/ui/issues/issue-12187-1.stderr index 94afd6aab57..f8df4f82e7e 100644 --- a/src/test/ui/issues/issue-12187-1.stderr +++ b/src/test/ui/issues/issue-12187-1.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-12187-1.rs:16:10 + --> $DIR/issue-12187-1.rs:6:10 | LL | let &v = new(); | -^ diff --git a/src/test/ui/issues/issue-12187-2.rs b/src/test/ui/issues/issue-12187-2.rs index 733f597e7ac..a1cdb849779 100644 --- a/src/test/ui/issues/issue-12187-2.rs +++ b/src/test/ui/issues/issue-12187-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn new<'r, T>() -> &'r T { panic!() } diff --git a/src/test/ui/issues/issue-12187-2.stderr b/src/test/ui/issues/issue-12187-2.stderr index 90b41e397c6..c40ae0461ec 100644 --- a/src/test/ui/issues/issue-12187-2.stderr +++ b/src/test/ui/issues/issue-12187-2.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-12187-2.rs:16:10 + --> $DIR/issue-12187-2.rs:6:10 | LL | let &v = new(); | -^ diff --git a/src/test/ui/issues/issue-12369.rs b/src/test/ui/issues/issue-12369.rs index 1b9af393ccc..8df8efefd05 100644 --- a/src/test/ui/issues/issue-12369.rs +++ b/src/test/ui/issues/issue-12369.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] #![deny(unreachable_patterns)] diff --git a/src/test/ui/issues/issue-12369.stderr b/src/test/ui/issues/issue-12369.stderr index 2e8cd840fb7..6906c7b7920 100644 --- a/src/test/ui/issues/issue-12369.stderr +++ b/src/test/ui/issues/issue-12369.stderr @@ -1,11 +1,11 @@ error: unreachable pattern - --> $DIR/issue-12369.rs:20:9 + --> $DIR/issue-12369.rs:10:9 | LL | &[10,a, ref rest..] => 10 //~ ERROR: unreachable pattern | ^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-12369.rs:12:9 + --> $DIR/issue-12369.rs:2:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-12470.nll.stderr b/src/test/ui/issues/issue-12470.nll.stderr index af4fa8de0e9..27878e7718b 100644 --- a/src/test/ui/issues/issue-12470.nll.stderr +++ b/src/test/ui/issues/issue-12470.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local data `*b` - --> $DIR/issue-12470.rs:39:5 + --> $DIR/issue-12470.rs:29:5 | LL | let bb: &B = &*b; //~ ERROR does not live long enough | --- `*b` is borrowed here diff --git a/src/test/ui/issues/issue-12470.rs b/src/test/ui/issues/issue-12470.rs index 93785817e14..acf1b764fd9 100644 --- a/src/test/ui/issues/issue-12470.rs +++ b/src/test/ui/issues/issue-12470.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] trait X { diff --git a/src/test/ui/issues/issue-12470.stderr b/src/test/ui/issues/issue-12470.stderr index 91788e96297..59056aaca90 100644 --- a/src/test/ui/issues/issue-12470.stderr +++ b/src/test/ui/issues/issue-12470.stderr @@ -1,5 +1,5 @@ error[E0597]: `*b` does not live long enough - --> $DIR/issue-12470.rs:38:19 + --> $DIR/issue-12470.rs:28:19 | LL | let bb: &B = &*b; //~ ERROR does not live long enough | ^^ borrowed value does not live long enough @@ -7,8 +7,8 @@ LL | make_a(bb) LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 36:16... - --> $DIR/issue-12470.rs:36:16 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 26:16... + --> $DIR/issue-12470.rs:26:16 | LL | fn make_make_a<'a>() -> A<'a> { | ^^ diff --git a/src/test/ui/issues/issue-1251.rs b/src/test/ui/issues/issue-1251.rs index b42404ce773..84a14a8c09b 100644 --- a/src/test/ui/issues/issue-1251.rs +++ b/src/test/ui/issues/issue-1251.rs @@ -1,20 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_attributes)] #![allow(dead_code)] // pretty-expanded FIXME #23616 // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] #![crate_id="rust_get_test_int"] diff --git a/src/test/ui/issues/issue-12511.rs b/src/test/ui/issues/issue-12511.rs index 83359bf1675..ea83e3fd9dc 100644 --- a/src/test/ui/issues/issue-12511.rs +++ b/src/test/ui/issues/issue-12511.rs @@ -1,18 +1,8 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait t1 : t2 { +trait T1 : T2 { //~^ ERROR cycle detected } -trait t2 : t1 { +trait T2 : T1 { } fn main() { } diff --git a/src/test/ui/issues/issue-12511.stderr b/src/test/ui/issues/issue-12511.stderr index 345d7b30d47..37e38ff60ae 100644 --- a/src/test/ui/issues/issue-12511.stderr +++ b/src/test/ui/issues/issue-12511.stderr @@ -1,15 +1,20 @@ -error[E0391]: cycle detected when computing the supertraits of `t1` - --> $DIR/issue-12511.rs:11:12 +error[E0391]: cycle detected when computing the supertraits of `T1` + --> $DIR/issue-12511.rs:1:12 | -LL | trait t1 : t2 { +LL | trait T1 : T2 { | ^^ | -note: ...which requires computing the supertraits of `t2`... - --> $DIR/issue-12511.rs:15:12 +note: ...which requires computing the supertraits of `T2`... + --> $DIR/issue-12511.rs:5:12 | -LL | trait t2 : t1 { +LL | trait T2 : T1 { | ^^ - = note: ...which again requires computing the supertraits of `t1`, completing the cycle + = note: ...which again requires computing the supertraits of `T1`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/issue-12511.rs:1:1 + | +LL | trait T1 : T2 { + | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-12552.rs b/src/test/ui/issues/issue-12552.rs index e4788bac256..b7f71dd1ce3 100644 --- a/src/test/ui/issues/issue-12552.rs +++ b/src/test/ui/issues/issue-12552.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // this code used to cause an ICE fn main() { diff --git a/src/test/ui/issues/issue-12552.stderr b/src/test/ui/issues/issue-12552.stderr index 9a3d5ef02c6..768d11bf899 100644 --- a/src/test/ui/issues/issue-12552.stderr +++ b/src/test/ui/issues/issue-12552.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types - --> $DIR/issue-12552.rs:16:5 + --> $DIR/issue-12552.rs:6:5 | +LL | match t { + | - this match expression has type `std::result::Result<_, {integer}>` LL | Some(k) => match k { //~ ERROR mismatched types | ^^^^^^^ expected enum `std::result::Result`, found enum `std::option::Option` | @@ -8,7 +10,7 @@ LL | Some(k) => match k { //~ ERROR mismatched types found type `std::option::Option<_>` error[E0308]: mismatched types - --> $DIR/issue-12552.rs:19:5 + --> $DIR/issue-12552.rs:9:5 | LL | None => () //~ ERROR mismatched types | ^^^^ expected enum `std::result::Result`, found enum `std::option::Option` diff --git a/src/test/ui/issues/issue-12567.nll.stderr b/src/test/ui/issues/issue-12567.nll.stderr index 72d21d47d86..17388df91d1 100644 --- a/src/test/ui/issues/issue-12567.nll.stderr +++ b/src/test/ui/issues/issue-12567.nll.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[T]`, a non-copy slice - --> $DIR/issue-12567.rs:14:11 + --> $DIR/issue-12567.rs:4:11 | LL | match (l1, l2) { | ^^^^^^^^ cannot move out of here @@ -11,7 +11,7 @@ LL | (&[hd1, ..], &[hd2, ..]) | --- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/issue-12567.rs:16:17 + --> $DIR/issue-12567.rs:6:17 | LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) | ^^ @@ -20,7 +20,7 @@ LL | (&[hd1, ..], &[hd2, ..]) | ^^^ error[E0508]: cannot move out of type `[T]`, a non-copy slice - --> $DIR/issue-12567.rs:14:11 + --> $DIR/issue-12567.rs:4:11 | LL | match (l1, l2) { | ^^^^^^^^ cannot move out of here @@ -32,7 +32,7 @@ LL | (&[hd1, ..], &[hd2, ..]) | --- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/issue-12567.rs:16:17 + --> $DIR/issue-12567.rs:6:17 | LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) | ^^ diff --git a/src/test/ui/issues/issue-12567.rs b/src/test/ui/issues/issue-12567.rs index 30cdd07b399..1e1debe31ce 100644 --- a/src/test/ui/issues/issue-12567.rs +++ b/src/test/ui/issues/issue-12567.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) { diff --git a/src/test/ui/issues/issue-12567.stderr b/src/test/ui/issues/issue-12567.stderr index 60acffdcb06..15f723f1cee 100644 --- a/src/test/ui/issues/issue-12567.stderr +++ b/src/test/ui/issues/issue-12567.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[T]`, a non-copy slice - --> $DIR/issue-12567.rs:16:16 + --> $DIR/issue-12567.rs:6:16 | LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) | ^--^^^^^ @@ -8,7 +8,7 @@ LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) | cannot move out of here error[E0508]: cannot move out of type `[T]`, a non-copy slice - --> $DIR/issue-12567.rs:16:30 + --> $DIR/issue-12567.rs:6:30 | LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) | ^--^^^^^ @@ -17,7 +17,7 @@ LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) | cannot move out of here error[E0508]: cannot move out of type `[T]`, a non-copy slice - --> $DIR/issue-12567.rs:20:11 + --> $DIR/issue-12567.rs:10:11 | LL | (&[hd1, ..], &[hd2, ..]) | ^---^^^^^ @@ -26,7 +26,7 @@ LL | (&[hd1, ..], &[hd2, ..]) | cannot move out of here error[E0508]: cannot move out of type `[T]`, a non-copy slice - --> $DIR/issue-12567.rs:20:23 + --> $DIR/issue-12567.rs:10:23 | LL | (&[hd1, ..], &[hd2, ..]) | ^---^^^^^ diff --git a/src/test/ui/issues/issue-12729.rs b/src/test/ui/issues/issue-12729.rs index 2447bceeea6..c2572c78280 100644 --- a/src/test/ui/issues/issue-12729.rs +++ b/src/test/ui/issues/issue-12729.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-12796.rs b/src/test/ui/issues/issue-12796.rs index 0c3c82a99f2..acd4584c737 100644 --- a/src/test/ui/issues/issue-12796.rs +++ b/src/test/ui/issues/issue-12796.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait { fn outer(&self) { fn inner(_: &Self) { diff --git a/src/test/ui/issues/issue-12796.stderr b/src/test/ui/issues/issue-12796.stderr index 0c369c6ab97..4bc29fd37dc 100644 --- a/src/test/ui/issues/issue-12796.stderr +++ b/src/test/ui/issues/issue-12796.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use type parameters from outer function - --> $DIR/issue-12796.rs:13:22 + --> $DIR/issue-12796.rs:3:22 | LL | fn inner(_: &Self) { | ^^^^ diff --git a/src/test/ui/issues/issue-12863.rs b/src/test/ui/issues/issue-12863.rs index d3432410c54..d7941a70d51 100644 --- a/src/test/ui/issues/issue-12863.rs +++ b/src/test/ui/issues/issue-12863.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub fn bar() {} } fn main() { diff --git a/src/test/ui/issues/issue-12863.stderr b/src/test/ui/issues/issue-12863.stderr index eb2957a8225..3f1a6bf598d 100644 --- a/src/test/ui/issues/issue-12863.stderr +++ b/src/test/ui/issues/issue-12863.stderr @@ -1,5 +1,5 @@ error[E0532]: expected unit struct/variant or constant, found function `foo::bar` - --> $DIR/issue-12863.rs:15:9 + --> $DIR/issue-12863.rs:5:9 | LL | foo::bar => {} //~ ERROR expected unit struct/variant or constant, found function `foo::bar` | ^^^^^^^^ not a unit struct/variant or constant diff --git a/src/test/ui/issues/issue-12997-1.rs b/src/test/ui/issues/issue-12997-1.rs index 2d8d7857c99..d00980e72f5 100644 --- a/src/test/ui/issues/issue-12997-1.rs +++ b/src/test/ui/issues/issue-12997-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test //! Test that makes sure wrongly-typed bench functions aren't ignored diff --git a/src/test/ui/issues/issue-12997-1.stderr b/src/test/ui/issues/issue-12997-1.stderr index 856538417d9..050e753dd1a 100644 --- a/src/test/ui/issues/issue-12997-1.stderr +++ b/src/test/ui/issues/issue-12997-1.stderr @@ -1,11 +1,11 @@ error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination` - --> $DIR/issue-12997-1.rs:16:1 + --> $DIR/issue-12997-1.rs:6:1 | LL | fn foo() { } //~ ERROR functions used as benches | ^^^^^^^^^^^^ error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination` - --> $DIR/issue-12997-1.rs:19:1 + --> $DIR/issue-12997-1.rs:9:1 | LL | fn bar(x: isize, y: isize) { } //~ ERROR functions used as benches | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-12997-2.rs b/src/test/ui/issues/issue-12997-2.rs index 8d3df68577b..8bf1a375bb4 100644 --- a/src/test/ui/issues/issue-12997-2.rs +++ b/src/test/ui/issues/issue-12997-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test //! Test that makes sure wrongly-typed bench functions are rejected diff --git a/src/test/ui/issues/issue-12997-2.stderr b/src/test/ui/issues/issue-12997-2.stderr index 853a2a0f1b4..e608c42a43b 100644 --- a/src/test/ui/issues/issue-12997-2.stderr +++ b/src/test/ui/issues/issue-12997-2.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-12997-2.rs:16:1 + --> $DIR/issue-12997-2.rs:6:1 | LL | fn bar(x: isize) { } | ^^^^^^^^^^^^^^^^^^^^ expected isize, found mutable reference diff --git a/src/test/ui/issues/issue-13033.rs b/src/test/ui/issues/issue-13033.rs index f1fd617717a..a6c9e9712c0 100644 --- a/src/test/ui/issues/issue-13033.rs +++ b/src/test/ui/issues/issue-13033.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn bar(&mut self, other: &mut Foo); } diff --git a/src/test/ui/issues/issue-13033.stderr b/src/test/ui/issues/issue-13033.stderr index f06d7360d85..d1e8eb31c88 100644 --- a/src/test/ui/issues/issue-13033.stderr +++ b/src/test/ui/issues/issue-13033.stderr @@ -1,5 +1,5 @@ error[E0053]: method `bar` has an incompatible type for trait - --> $DIR/issue-13033.rs:18:30 + --> $DIR/issue-13033.rs:8:30 | LL | fn bar(&mut self, other: &mut Foo); | -------- type in trait diff --git a/src/test/ui/issues/issue-13058.rs b/src/test/ui/issues/issue-13058.rs index cabf0219477..a5806feb720 100644 --- a/src/test/ui/issues/issue-13058.rs +++ b/src/test/ui/issues/issue-13058.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Range; trait Itble<'r, T, I: Iterator> { fn iter(&'r self) -> I; } @@ -22,7 +12,7 @@ impl<'r> Itble<'r, usize, Range> for (usize, usize) { fn check<'r, I: Iterator, T: Itble<'r, usize, I>>(cont: &T) -> bool { let cont_iter = cont.iter(); -//~^ ERROR 24:26: 24:30: explicit lifetime required in the type of `cont` [E0621] +//~^ ERROR explicit lifetime required in the type of `cont` [E0621] let result = cont_iter.fold(Some(0), |state, val| { state.map_or(None, |mask| { let bit = 1 << val; diff --git a/src/test/ui/issues/issue-13058.stderr b/src/test/ui/issues/issue-13058.stderr index ee39678736c..53a2c987c52 100644 --- a/src/test/ui/issues/issue-13058.stderr +++ b/src/test/ui/issues/issue-13058.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `cont` - --> $DIR/issue-13058.rs:24:26 + --> $DIR/issue-13058.rs:14:26 | LL | fn check<'r, I: Iterator, T: Itble<'r, usize, I>>(cont: &T) -> bool | -- help: add explicit lifetime `'r` to the type of `cont`: `&'r T` diff --git a/src/test/ui/issues/issue-13105.rs b/src/test/ui/issues/issue-13105.rs index 78e0caca0ba..0e118043d55 100644 --- a/src/test/ui/issues/issue-13105.rs +++ b/src/test/ui/issues/issue-13105.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-13167.rs b/src/test/ui/issues/issue-13167.rs index e44ac88566c..dcc25a446fa 100644 --- a/src/test/ui/issues/issue-13167.rs +++ b/src/test/ui/issues/issue-13167.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-13214.rs b/src/test/ui/issues/issue-13214.rs index b22942652c4..af2d95c5e42 100644 --- a/src/test/ui/issues/issue-13214.rs +++ b/src/test/ui/issues/issue-13214.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // defining static with struct that contains enum diff --git a/src/test/ui/issues/issue-13352.rs b/src/test/ui/issues/issue-13352.rs index e9d76c758cd..c711e3b713f 100644 --- a/src/test/ui/issues/issue-13352.rs +++ b/src/test/ui/issues/issue-13352.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no std::process fn foo(_: Box) {} diff --git a/src/test/ui/issues/issue-13352.stderr b/src/test/ui/issues/issue-13352.stderr index 5324eb21186..58ac74be3e3 100644 --- a/src/test/ui/issues/issue-13352.stderr +++ b/src/test/ui/issues/issue-13352.stderr @@ -1,5 +1,5 @@ error[E0277]: cannot add `()` to `usize` - --> $DIR/issue-13352.rs:19:13 + --> $DIR/issue-13352.rs:9:13 | LL | 2_usize + (loop {}); | ^ no implementation for `usize + ()` diff --git a/src/test/ui/issues/issue-13359.rs b/src/test/ui/issues/issue-13359.rs index e33859e8c19..7409426dc39 100644 --- a/src/test/ui/issues/issue-13359.rs +++ b/src/test/ui/issues/issue-13359.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(_s: i16) { } fn bar(_s: u32) { } diff --git a/src/test/ui/issues/issue-13359.stderr b/src/test/ui/issues/issue-13359.stderr index 77f10be982b..00b7fbd4564 100644 --- a/src/test/ui/issues/issue-13359.stderr +++ b/src/test/ui/issues/issue-13359.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/issue-13359.rs:16:9 + --> $DIR/issue-13359.rs:6:9 | LL | foo(1*(1 as isize)); | ^^^^^^^^^^^^^^ expected i16, found isize error[E0308]: mismatched types - --> $DIR/issue-13359.rs:20:9 + --> $DIR/issue-13359.rs:10:9 | LL | bar(1*(1 as usize)); | ^^^^^^^^^^^^^^ expected u32, found usize diff --git a/src/test/ui/issues/issue-13404.rs b/src/test/ui/issues/issue-13404.rs index 0059e92e07f..c5af827d50c 100644 --- a/src/test/ui/issues/issue-13404.rs +++ b/src/test/ui/issues/issue-13404.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use a::f; use b::f; //~ ERROR: unresolved import `b::f` [E0432] //~^ no `f` in `b` diff --git a/src/test/ui/issues/issue-13404.stderr b/src/test/ui/issues/issue-13404.stderr index b71d3ceab5b..45cddffef71 100644 --- a/src/test/ui/issues/issue-13404.stderr +++ b/src/test/ui/issues/issue-13404.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `b::f` - --> $DIR/issue-13404.rs:12:5 + --> $DIR/issue-13404.rs:2:5 | LL | use b::f; //~ ERROR: unresolved import `b::f` [E0432] | ^^^^ no `f` in `b` diff --git a/src/test/ui/issues/issue-13405.rs b/src/test/ui/issues/issue-13405.rs index ed35d3edccf..32965cb0c6d 100644 --- a/src/test/ui/issues/issue-13405.rs +++ b/src/test/ui/issues/issue-13405.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/issues/issue-13407.rs b/src/test/ui/issues/issue-13407.rs index afb2e867f45..322e67cc131 100644 --- a/src/test/ui/issues/issue-13407.rs +++ b/src/test/ui/issues/issue-13407.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod A { struct C; } diff --git a/src/test/ui/issues/issue-13407.stderr b/src/test/ui/issues/issue-13407.stderr index 90d5ca59e1e..1f4c7dfb0da 100644 --- a/src/test/ui/issues/issue-13407.stderr +++ b/src/test/ui/issues/issue-13407.stderr @@ -1,20 +1,20 @@ error[E0603]: unit struct `C` is private - --> $DIR/issue-13407.rs:16:8 + --> $DIR/issue-13407.rs:6:8 | LL | A::C = 1; | ^ error[E0308]: mismatched types - --> $DIR/issue-13407.rs:16:12 + --> $DIR/issue-13407.rs:6:12 | LL | A::C = 1; - | ^ expected struct `A::C`, found integral variable + | ^ expected struct `A::C`, found integer | = note: expected type `A::C` found type `{integer}` error[E0070]: invalid left-hand side expression - --> $DIR/issue-13407.rs:16:5 + --> $DIR/issue-13407.rs:6:5 | LL | A::C = 1; | ^^^^^^^^ left-hand of expression not valid diff --git a/src/test/ui/issues/issue-13446.rs b/src/test/ui/issues/issue-13446.rs index 6607e1903b6..9f1fc42774f 100644 --- a/src/test/ui/issues/issue-13446.rs +++ b/src/test/ui/issues/issue-13446.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // Used to cause ICE static VEC: [u32; 256] = vec![]; diff --git a/src/test/ui/issues/issue-13446.stderr b/src/test/ui/issues/issue-13446.stderr index 110bb4b83db..a27bfeda64c 100644 --- a/src/test/ui/issues/issue-13446.stderr +++ b/src/test/ui/issues/issue-13446.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-13446.rs:14:26 + --> $DIR/issue-13446.rs:3:26 | LL | static VEC: [u32; 256] = vec![]; | ^^^^^^ expected array of 256 elements, found struct `std::vec::Vec` diff --git a/src/test/ui/issues/issue-13466.rs b/src/test/ui/issues/issue-13466.rs index abddf6ba7a3..c285bfa107d 100644 --- a/src/test/ui/issues/issue-13466.rs +++ b/src/test/ui/issues/issue-13466.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #13466 pub fn main() { diff --git a/src/test/ui/issues/issue-13466.stderr b/src/test/ui/issues/issue-13466.stderr index be845fb8e22..66255891f46 100644 --- a/src/test/ui/issues/issue-13466.stderr +++ b/src/test/ui/issues/issue-13466.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types - --> $DIR/issue-13466.rs:18:9 + --> $DIR/issue-13466.rs:8:9 | +LL | let _x: usize = match Some(1) { + | ------- this match expression has type `std::option::Option<{integer}>` LL | Ok(u) => u, | ^^^^^ expected enum `std::option::Option`, found enum `std::result::Result` | @@ -8,8 +10,11 @@ LL | Ok(u) => u, found type `std::result::Result<_, _>` error[E0308]: mismatched types - --> $DIR/issue-13466.rs:24:9 + --> $DIR/issue-13466.rs:14:9 | +LL | let _x: usize = match Some(1) { + | ------- this match expression has type `std::option::Option<{integer}>` +... LL | Err(e) => panic!(e) | ^^^^^^ expected enum `std::option::Option`, found enum `std::result::Result` | diff --git a/src/test/ui/issues/issue-13482-2.rs b/src/test/ui/issues/issue-13482-2.rs index fe7fbb176cc..bbcb954afcc 100644 --- a/src/test/ui/issues/issue-13482-2.rs +++ b/src/test/ui/issues/issue-13482-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Z verbose fn main() { diff --git a/src/test/ui/issues/issue-13482-2.stderr b/src/test/ui/issues/issue-13482-2.stderr index 1ecae3b867a..0c036f1d0e6 100644 --- a/src/test/ui/issues/issue-13482-2.stderr +++ b/src/test/ui/issues/issue-13482-2.stderr @@ -1,5 +1,5 @@ error[E0527]: pattern requires 0 elements but array has 2 - --> $DIR/issue-13482-2.rs:16:9 + --> $DIR/issue-13482-2.rs:6:9 | LL | [] => None, //~ ERROR pattern requires 0 elements but array has 2 | ^^ expected 2 elements diff --git a/src/test/ui/issues/issue-13482.rs b/src/test/ui/issues/issue-13482.rs index 32a63b79a32..244b3237e02 100644 --- a/src/test/ui/issues/issue-13482.rs +++ b/src/test/ui/issues/issue-13482.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = [1,2]; let y = match x { diff --git a/src/test/ui/issues/issue-13482.stderr b/src/test/ui/issues/issue-13482.stderr index 95273bb46bc..5776dedf0a2 100644 --- a/src/test/ui/issues/issue-13482.stderr +++ b/src/test/ui/issues/issue-13482.stderr @@ -1,5 +1,5 @@ error[E0527]: pattern requires 0 elements but array has 2 - --> $DIR/issue-13482.rs:14:5 + --> $DIR/issue-13482.rs:4:5 | LL | [] => None, //~ ERROR pattern requires 0 elements but array has 2 | ^^ expected 2 elements diff --git a/src/test/ui/issues/issue-13483.rs b/src/test/ui/issues/issue-13483.rs index c44465b221c..cb53523b3b0 100644 --- a/src/test/ui/issues/issue-13483.rs +++ b/src/test/ui/issues/issue-13483.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { if true { } else if { //~ ERROR missing condition diff --git a/src/test/ui/issues/issue-13483.stderr b/src/test/ui/issues/issue-13483.stderr index afcb8b8da17..1ab67d285c0 100644 --- a/src/test/ui/issues/issue-13483.stderr +++ b/src/test/ui/issues/issue-13483.stderr @@ -1,11 +1,11 @@ error: missing condition for `if` statemement - --> $DIR/issue-13483.rs:13:14 + --> $DIR/issue-13483.rs:3:14 | LL | } else if { //~ ERROR missing condition | ^ expected if condition here error: missing condition for `if` statemement - --> $DIR/issue-13483.rs:20:14 + --> $DIR/issue-13483.rs:10:14 | LL | } else if { //~ ERROR missing condition | ^ expected if condition here diff --git a/src/test/ui/issues/issue-13497-2.nll.stderr b/src/test/ui/issues/issue-13497-2.nll.stderr index e66afef9314..fb0d606690d 100644 --- a/src/test/ui/issues/issue-13497-2.nll.stderr +++ b/src/test/ui/issues/issue-13497-2.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local variable `rawLines` - --> $DIR/issue-13497-2.rs:13:5 + --> $DIR/issue-13497-2.rs:3:5 | LL | rawLines //~ ERROR `rawLines` does not live long enough | ^------- diff --git a/src/test/ui/issues/issue-13497-2.rs b/src/test/ui/issues/issue-13497-2.rs index 31716837493..a39ae4f1cf3 100644 --- a/src/test/ui/issues/issue-13497-2.rs +++ b/src/test/ui/issues/issue-13497-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn read_lines_borrowed<'a>() -> Vec<&'a str> { let rawLines: Vec = vec!["foo ".to_string(), " bar".to_string()]; rawLines //~ ERROR `rawLines` does not live long enough diff --git a/src/test/ui/issues/issue-13497-2.stderr b/src/test/ui/issues/issue-13497-2.stderr index 72770f8c84c..c91ab789fe8 100644 --- a/src/test/ui/issues/issue-13497-2.stderr +++ b/src/test/ui/issues/issue-13497-2.stderr @@ -1,5 +1,5 @@ error[E0597]: `rawLines` does not live long enough - --> $DIR/issue-13497-2.rs:13:5 + --> $DIR/issue-13497-2.rs:3:5 | LL | rawLines //~ ERROR `rawLines` does not live long enough | ^^^^^^^^ borrowed value does not live long enough @@ -7,8 +7,8 @@ LL | .iter().map(|l| l.trim()).collect() LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 11:24... - --> $DIR/issue-13497-2.rs:11:24 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 1:24... + --> $DIR/issue-13497-2.rs:1:24 | LL | fn read_lines_borrowed<'a>() -> Vec<&'a str> { | ^^ diff --git a/src/test/ui/issues/issue-13497.rs b/src/test/ui/issues/issue-13497.rs index d544a92d9c3..4b2795aa841 100644 --- a/src/test/ui/issues/issue-13497.rs +++ b/src/test/ui/issues/issue-13497.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn read_lines_borrowed1() -> Vec< &str //~ ERROR missing lifetime specifier > { diff --git a/src/test/ui/issues/issue-13497.stderr b/src/test/ui/issues/issue-13497.stderr index e592452b899..eb053c1003e 100644 --- a/src/test/ui/issues/issue-13497.stderr +++ b/src/test/ui/issues/issue-13497.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-13497.rs:12:5 + --> $DIR/issue-13497.rs:2:5 | LL | &str //~ ERROR missing lifetime specifier | ^ help: consider giving it a 'static lifetime: `&'static` diff --git a/src/test/ui/issues/issue-1362.rs b/src/test/ui/issues/issue-1362.rs index d51db479599..6fd43f50e4d 100644 --- a/src/test/ui/issues/issue-1362.rs +++ b/src/test/ui/issues/issue-1362.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #1362 - without that fix the span will be bogus // no-reformat fn main() { diff --git a/src/test/ui/issues/issue-1362.stderr b/src/test/ui/issues/issue-1362.stderr index c19e256eb92..dd97e0cf04a 100644 --- a/src/test/ui/issues/issue-1362.stderr +++ b/src/test/ui/issues/issue-1362.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-1362.rs:14:16 + --> $DIR/issue-1362.rs:4:16 | LL | let x: u32 = 20i32; //~ ERROR mismatched types | ^^^^^ expected u32, found i32 diff --git a/src/test/ui/issues/issue-13641.rs b/src/test/ui/issues/issue-13641.rs index 3b690e08f61..198cea4289c 100644 --- a/src/test/ui/issues/issue-13641.rs +++ b/src/test/ui/issues/issue-13641.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { struct Foo; impl Foo { pub fn new() {} } diff --git a/src/test/ui/issues/issue-13641.stderr b/src/test/ui/issues/issue-13641.stderr index cbbceb72af3..8e5001e3b69 100644 --- a/src/test/ui/issues/issue-13641.stderr +++ b/src/test/ui/issues/issue-13641.stderr @@ -1,11 +1,11 @@ error[E0603]: struct `Foo` is private - --> $DIR/issue-13641.rs:19:8 + --> $DIR/issue-13641.rs:9:8 | LL | a::Foo::new(); | ^^^ error[E0603]: enum `Bar` is private - --> $DIR/issue-13641.rs:21:8 + --> $DIR/issue-13641.rs:11:8 | LL | a::Bar::new(); | ^^^ diff --git a/src/test/ui/issues/issue-13703.rs b/src/test/ui/issues/issue-13703.rs index e954f94b664..212fff7bcec 100644 --- a/src/test/ui/issues/issue-13703.rs +++ b/src/test/ui/issues/issue-13703.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-13727.rs b/src/test/ui/issues/issue-13727.rs index 2e815548e89..7fb565ef3bf 100644 --- a/src/test/ui/issues/issue-13727.rs +++ b/src/test/ui/issues/issue-13727.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(overflowing_literals)] #![deny(unreachable_patterns)] diff --git a/src/test/ui/issues/issue-13727.stderr b/src/test/ui/issues/issue-13727.stderr index 47b9a0211a9..0c2ce9f8b48 100644 --- a/src/test/ui/issues/issue-13727.stderr +++ b/src/test/ui/issues/issue-13727.stderr @@ -1,11 +1,11 @@ error: unreachable pattern - --> $DIR/issue-13727.rs:17:5 + --> $DIR/issue-13727.rs:7:5 | LL | 512 => print!("0b1111/n"), | ^^^ | note: lint level defined here - --> $DIR/issue-13727.rs:12:9 + --> $DIR/issue-13727.rs:2:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-13775.rs b/src/test/ui/issues/issue-13775.rs index 27fcbf78941..39e42dc2c0d 100644 --- a/src/test/ui/issues/issue-13775.rs +++ b/src/test/ui/issues/issue-13775.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-13837.rs b/src/test/ui/issues/issue-13837.rs index 1e67964093b..d475ce1d833 100644 --- a/src/test/ui/issues/issue-13837.rs +++ b/src/test/ui/issues/issue-13837.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-13847.rs b/src/test/ui/issues/issue-13847.rs index 0314f109a7c..06a0304ae49 100644 --- a/src/test/ui/issues/issue-13847.rs +++ b/src/test/ui/issues/issue-13847.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { return.is_failure //~ ERROR no field `is_failure` on type `!` } diff --git a/src/test/ui/issues/issue-13847.stderr b/src/test/ui/issues/issue-13847.stderr index fad3245034d..9199199d730 100644 --- a/src/test/ui/issues/issue-13847.stderr +++ b/src/test/ui/issues/issue-13847.stderr @@ -1,5 +1,5 @@ error[E0609]: no field `is_failure` on type `!` - --> $DIR/issue-13847.rs:12:12 + --> $DIR/issue-13847.rs:2:12 | LL | return.is_failure //~ ERROR no field `is_failure` on type `!` | ^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-13853-2.rs b/src/test/ui/issues/issue-13853-2.rs index 1635a8f69a6..b58f2bd3b3b 100644 --- a/src/test/ui/issues/issue-13853-2.rs +++ b/src/test/ui/issues/issue-13853-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait FromStructReader<'a> { } trait ResponseHook { fn get(&self); diff --git a/src/test/ui/issues/issue-13853-2.stderr b/src/test/ui/issues/issue-13853-2.stderr index c15290fb1d9..3e711243b4e 100644 --- a/src/test/ui/issues/issue-13853-2.stderr +++ b/src/test/ui/issues/issue-13853-2.stderr @@ -1,10 +1,8 @@ error[E0615]: attempted to take value of method `get` on type `std::boxed::Box<(dyn ResponseHook + 'static)>` - --> $DIR/issue-13853-2.rs:15:39 + --> $DIR/issue-13853-2.rs:5:39 | LL | fn foo(res : Box) { res.get } //~ ERROR attempted to take value of method - | ^^^ - | - = help: maybe a `()` to call it is missing? + | ^^^ help: use parentheses to call the method: `get()` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13853-5.rs b/src/test/ui/issues/issue-13853-5.rs index 78b079a7c44..2afdf95aacf 100644 --- a/src/test/ui/issues/issue-13853-5.rs +++ b/src/test/ui/issues/issue-13853-5.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Deserializer<'a> { } trait Deserializable { diff --git a/src/test/ui/issues/issue-13853-5.stderr b/src/test/ui/issues/issue-13853-5.stderr index e93b03b43ee..3d8f824ec94 100644 --- a/src/test/ui/issues/issue-13853-5.stderr +++ b/src/test/ui/issues/issue-13853-5.stderr @@ -1,5 +1,5 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-13853-5.rs:17:10 + --> $DIR/issue-13853-5.rs:7:10 | LL | impl<'a, T: Deserializable> Deserializable for &'a str { | ^ unconstrained type parameter diff --git a/src/test/ui/issues/issue-13853.rs b/src/test/ui/issues/issue-13853.rs index 86a6bdfd4dd..ac9886d2e72 100644 --- a/src/test/ui/issues/issue-13853.rs +++ b/src/test/ui/issues/issue-13853.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Node { fn zomg(); } diff --git a/src/test/ui/issues/issue-13853.stderr b/src/test/ui/issues/issue-13853.stderr index 188bfd59301..6da5da04fb1 100644 --- a/src/test/ui/issues/issue-13853.stderr +++ b/src/test/ui/issues/issue-13853.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-13853.rs:24:9 + --> $DIR/issue-13853.rs:14:9 | LL | fn nodes<'a, I: Iterator>(&self) -> I | - expected `I` because of return type @@ -11,13 +11,13 @@ LL | self.iter() //~ ERROR mismatched types found type `std::slice::Iter<'_, N>` error[E0599]: no method named `iter` found for type `&G` in the current scope - --> $DIR/issue-13853.rs:37:23 + --> $DIR/issue-13853.rs:27:23 | LL | for node in graph.iter() { //~ ERROR no method named `iter` found | ^^^^ error[E0308]: mismatched types - --> $DIR/issue-13853.rs:47:13 + --> $DIR/issue-13853.rs:37:13 | LL | iterate(graph); //~ ERROR mismatched types | ^^^^^ diff --git a/src/test/ui/issues/issue-14082.rs b/src/test/ui/issues/issue-14082.rs index 5a1452fe357..4849077c144 100644 --- a/src/test/ui/issues/issue-14082.rs +++ b/src/test/ui/issues/issue-14082.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-14091-2.rs b/src/test/ui/issues/issue-14091-2.rs index a4351733a87..e2f6b183372 100644 --- a/src/test/ui/issues/issue-14091-2.rs +++ b/src/test/ui/issues/issue-14091-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // // Very diff --git a/src/test/ui/issues/issue-14091-2.stderr b/src/test/ui/issues/issue-14091-2.stderr index ccabd801c85..2d6e9567d26 100644 --- a/src/test/ui/issues/issue-14091-2.stderr +++ b/src/test/ui/issues/issue-14091-2.stderr @@ -1,5 +1,5 @@ error[E0600]: cannot apply unary operator `!` to type `BytePos` - --> $DIR/issue-14091-2.rs:25:5 + --> $DIR/issue-14091-2.rs:15:5 | LL | assert!(x, x); | ^^^^^^^^^^^^^^ cannot apply unary operator `!` diff --git a/src/test/ui/issues/issue-14091.rs b/src/test/ui/issues/issue-14091.rs index 9e436b8e629..0ee20de9053 100644 --- a/src/test/ui/issues/issue-14091.rs +++ b/src/test/ui/issues/issue-14091.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main(){ assert!(1,1); //~^ ERROR mismatched types diff --git a/src/test/ui/issues/issue-14091.stderr b/src/test/ui/issues/issue-14091.stderr index 9db2a0e2a86..24a076624ed 100644 --- a/src/test/ui/issues/issue-14091.stderr +++ b/src/test/ui/issues/issue-14091.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/issue-14091.rs:12:5 + --> $DIR/issue-14091.rs:2:5 | LL | assert!(1,1); - | ^^^^^^^^^^^^^ expected bool, found integral variable + | ^^^^^^^^^^^^^ expected bool, found integer | = note: expected type `bool` found type `{integer}` diff --git a/src/test/ui/issues/issue-14092.rs b/src/test/ui/issues/issue-14092.rs index fdce4b7a31d..77da6badde9 100644 --- a/src/test/ui/issues/issue-14092.rs +++ b/src/test/ui/issues/issue-14092.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn fn1(0: Box) {} //~^ ERROR wrong number of type arguments: expected 1, found 0 [E0107] diff --git a/src/test/ui/issues/issue-14092.stderr b/src/test/ui/issues/issue-14092.stderr index 98f18d75448..626830ece8c 100644 --- a/src/test/ui/issues/issue-14092.stderr +++ b/src/test/ui/issues/issue-14092.stderr @@ -1,5 +1,5 @@ error[E0107]: wrong number of type arguments: expected 1, found 0 - --> $DIR/issue-14092.rs:11:11 + --> $DIR/issue-14092.rs:1:11 | LL | fn fn1(0: Box) {} | ^^^ expected 1 type argument diff --git a/src/test/ui/issues/issue-14221.rs b/src/test/ui/issues/issue-14221.rs index d11fe99c07f..282c4111369 100644 --- a/src/test/ui/issues/issue-14221.rs +++ b/src/test/ui/issues/issue-14221.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unreachable_patterns)] #![allow(unused_variables)] #![allow(non_snake_case)] diff --git a/src/test/ui/issues/issue-14221.stderr b/src/test/ui/issues/issue-14221.stderr index 9252a4f304f..bf12480a5d3 100644 --- a/src/test/ui/issues/issue-14221.stderr +++ b/src/test/ui/issues/issue-14221.stderr @@ -1,17 +1,17 @@ warning[E0170]: pattern binding `A` is named the same as one of the variants of the type `E` - --> $DIR/issue-14221.rs:23:13 + --> $DIR/issue-14221.rs:13:13 | LL | A => "A", | ^ help: to match on the variant, qualify the path: `E::A` warning[E0170]: pattern binding `B` is named the same as one of the variants of the type `E` - --> $DIR/issue-14221.rs:25:13 + --> $DIR/issue-14221.rs:15:13 | LL | B => "B", //~ ERROR: unreachable pattern | ^ help: to match on the variant, qualify the path: `E::B` error: unreachable pattern - --> $DIR/issue-14221.rs:25:13 + --> $DIR/issue-14221.rs:15:13 | LL | A => "A", | - matches any value @@ -20,7 +20,7 @@ LL | B => "B", //~ ERROR: unreachable pattern | ^ unreachable pattern | note: lint level defined here - --> $DIR/issue-14221.rs:11:9 + --> $DIR/issue-14221.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-14227.rs b/src/test/ui/issues/issue-14227.rs index 857db50edbb..5de3867f95c 100644 --- a/src/test/ui/issues/issue-14227.rs +++ b/src/test/ui/issues/issue-14227.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(safe_extern_statics, warnings)] extern { diff --git a/src/test/ui/issues/issue-14227.stderr b/src/test/ui/issues/issue-14227.stderr index dc6c72d8a72..88e99e213bf 100644 --- a/src/test/ui/issues/issue-14227.stderr +++ b/src/test/ui/issues/issue-14227.stderr @@ -1,5 +1,5 @@ error[E0080]: could not evaluate static initializer - --> $DIR/issue-14227.rs:16:21 + --> $DIR/issue-14227.rs:6:21 | LL | static CRASH: u32 = symbol; | ^^^^^^ tried to read from foreign (extern) static diff --git a/src/test/ui/issues/issue-14254.rs b/src/test/ui/issues/issue-14254.rs index 033b7341db1..3ad388dc2d7 100644 --- a/src/test/ui/issues/issue-14254.rs +++ b/src/test/ui/issues/issue-14254.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-14285.rs b/src/test/ui/issues/issue-14285.rs index dceecee6ca7..934d72a67ca 100644 --- a/src/test/ui/issues/issue-14285.rs +++ b/src/test/ui/issues/issue-14285.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn dummy(&self) { } } @@ -19,7 +9,7 @@ impl Foo for A {} struct B<'a>(&'a (Foo+'a)); fn foo<'a>(a: &Foo) -> B<'a> { - B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of `a` [E0621] + B(a) //~ ERROR explicit lifetime required in the type of `a` [E0621] } fn main() { diff --git a/src/test/ui/issues/issue-14285.stderr b/src/test/ui/issues/issue-14285.stderr index 52163f81b7b..e5d0ab0684a 100644 --- a/src/test/ui/issues/issue-14285.stderr +++ b/src/test/ui/issues/issue-14285.stderr @@ -1,9 +1,9 @@ error[E0621]: explicit lifetime required in the type of `a` - --> $DIR/issue-14285.rs:22:5 + --> $DIR/issue-14285.rs:12:5 | LL | fn foo<'a>(a: &Foo) -> B<'a> { | ---- help: add explicit lifetime `'a` to the type of `a`: `&'a (dyn Foo + 'a)` -LL | B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of `a` [E0621] +LL | B(a) //~ ERROR explicit lifetime required in the type of `a` [E0621] | ^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14309.rs b/src/test/ui/issues/issue-14309.rs index f76fa3e4a8e..d0e532a2646 100644 --- a/src/test/ui/issues/issue-14309.rs +++ b/src/test/ui/issues/issue-14309.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(improper_ctypes)] #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-14309.stderr b/src/test/ui/issues/issue-14309.stderr index e062c633ee6..b8d82aadd48 100644 --- a/src/test/ui/issues/issue-14309.stderr +++ b/src/test/ui/issues/issue-14309.stderr @@ -1,17 +1,17 @@ error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout - --> $DIR/issue-14309.rs:40:15 + --> $DIR/issue-14309.rs:30:15 | LL | fn foo(x: A); //~ ERROR type `A` which is not FFI-safe | ^ | note: lint level defined here - --> $DIR/issue-14309.rs:11:9 + --> $DIR/issue-14309.rs:1:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct note: type defined here - --> $DIR/issue-14309.rs:14:1 + --> $DIR/issue-14309.rs:4:1 | LL | / struct A { LL | | x: i32 @@ -19,14 +19,14 @@ LL | | } | |_^ error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout - --> $DIR/issue-14309.rs:41:15 + --> $DIR/issue-14309.rs:31:15 | LL | fn bar(x: B); //~ ERROR type `A` | ^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct note: type defined here - --> $DIR/issue-14309.rs:14:1 + --> $DIR/issue-14309.rs:4:1 | LL | / struct A { LL | | x: i32 @@ -34,14 +34,14 @@ LL | | } | |_^ error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout - --> $DIR/issue-14309.rs:43:15 + --> $DIR/issue-14309.rs:33:15 | LL | fn qux(x: A2); //~ ERROR type `A` | ^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct note: type defined here - --> $DIR/issue-14309.rs:14:1 + --> $DIR/issue-14309.rs:4:1 | LL | / struct A { LL | | x: i32 @@ -49,14 +49,14 @@ LL | | } | |_^ error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout - --> $DIR/issue-14309.rs:44:16 + --> $DIR/issue-14309.rs:34:16 | LL | fn quux(x: B2); //~ ERROR type `A` | ^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct note: type defined here - --> $DIR/issue-14309.rs:14:1 + --> $DIR/issue-14309.rs:4:1 | LL | / struct A { LL | | x: i32 @@ -64,14 +64,14 @@ LL | | } | |_^ error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout - --> $DIR/issue-14309.rs:46:16 + --> $DIR/issue-14309.rs:36:16 | LL | fn fred(x: D); //~ ERROR type `A` | ^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct note: type defined here - --> $DIR/issue-14309.rs:14:1 + --> $DIR/issue-14309.rs:4:1 | LL | / struct A { LL | | x: i32 diff --git a/src/test/ui/issues/issue-14330.rs b/src/test/ui/issues/issue-14330.rs index edba1a3bd8f..d8f225eb07c 100644 --- a/src/test/ui/issues/issue-14330.rs +++ b/src/test/ui/issues/issue-14330.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_imports)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-14366.rs b/src/test/ui/issues/issue-14366.rs index 0b154d0a3ea..a6298f25d47 100644 --- a/src/test/ui/issues/issue-14366.rs +++ b/src/test/ui/issues/issue-14366.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let _x = "test" as &::std::any::Any; //~^ ERROR the size for values of type diff --git a/src/test/ui/issues/issue-14366.stderr b/src/test/ui/issues/issue-14366.stderr index 3c3ecd23bef..a3588bb8ebe 100644 --- a/src/test/ui/issues/issue-14366.stderr +++ b/src/test/ui/issues/issue-14366.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/issue-14366.rs:12:14 + --> $DIR/issue-14366.rs:2:14 | LL | let _x = "test" as &::std::any::Any; | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: required for the cast to the object type `dyn std::any::Any` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-1448-2.rs b/src/test/ui/issues/issue-1448-2.rs index ddfed3647c2..829e81b9c24 100644 --- a/src/test/ui/issues/issue-1448-2.rs +++ b/src/test/ui/issues/issue-1448-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #1448 and #1386 fn foo(a: u32) -> u32 { a } diff --git a/src/test/ui/issues/issue-1448-2.stderr b/src/test/ui/issues/issue-1448-2.stderr index 5769b0c3b9f..b06a6162712 100644 --- a/src/test/ui/issues/issue-1448-2.stderr +++ b/src/test/ui/issues/issue-1448-2.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-1448-2.rs:16:24 + --> $DIR/issue-1448-2.rs:6:24 | LL | println!("{}", foo(10i32)); //~ ERROR mismatched types | ^^^^^ expected u32, found i32 diff --git a/src/test/ui/issues/issue-14541.rs b/src/test/ui/issues/issue-14541.rs index 84c600d2201..705c3d326c6 100644 --- a/src/test/ui/issues/issue-14541.rs +++ b/src/test/ui/issues/issue-14541.rs @@ -1,22 +1,12 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +struct Vec2 { y: f32 } +struct Vec3 { y: f32, z: f32 } -struct vec2 { y: f32 } -struct vec3 { y: f32, z: f32 } - -fn make(v: vec2) { - let vec3 { y: _, z: _ } = v; +fn make(v: Vec2) { + let Vec3 { y: _, z: _ } = v; //~^ ERROR mismatched types - //~| expected type `vec2` - //~| found type `vec3` - //~| expected struct `vec2`, found struct `vec3` + //~| expected type `Vec2` + //~| found type `Vec3` + //~| expected struct `Vec2`, found struct `Vec3` } fn main() { } diff --git a/src/test/ui/issues/issue-14541.stderr b/src/test/ui/issues/issue-14541.stderr index fcff500cfda..aa0ae5ce443 100644 --- a/src/test/ui/issues/issue-14541.stderr +++ b/src/test/ui/issues/issue-14541.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/issue-14541.rs:15:9 + --> $DIR/issue-14541.rs:5:9 | -LL | let vec3 { y: _, z: _ } = v; - | ^^^^^^^^^^^^^^^^^^^ expected struct `vec2`, found struct `vec3` +LL | let Vec3 { y: _, z: _ } = v; + | ^^^^^^^^^^^^^^^^^^^ expected struct `Vec2`, found struct `Vec3` | - = note: expected type `vec2` - found type `vec3` + = note: expected type `Vec2` + found type `Vec3` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14721.rs b/src/test/ui/issues/issue-14721.rs index 58e8e10ee37..a5c47dd8cb3 100644 --- a/src/test/ui/issues/issue-14721.rs +++ b/src/test/ui/issues/issue-14721.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let foo = "str"; println!("{}", foo.desc); //~ no field `desc` on type `&str` diff --git a/src/test/ui/issues/issue-14721.stderr b/src/test/ui/issues/issue-14721.stderr index 93e51140caa..8029318419a 100644 --- a/src/test/ui/issues/issue-14721.stderr +++ b/src/test/ui/issues/issue-14721.stderr @@ -1,5 +1,5 @@ error[E0609]: no field `desc` on type `&str` - --> $DIR/issue-14721.rs:13:24 + --> $DIR/issue-14721.rs:3:24 | LL | println!("{}", foo.desc); //~ no field `desc` on type `&str` | ^^^^ diff --git a/src/test/ui/issues/issue-1476.rs b/src/test/ui/issues/issue-1476.rs index 48bf71f5892..138570a93c4 100644 --- a/src/test/ui/issues/issue-1476.rs +++ b/src/test/ui/issues/issue-1476.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("{}", x); //~ ERROR cannot find value `x` in this scope } diff --git a/src/test/ui/issues/issue-1476.stderr b/src/test/ui/issues/issue-1476.stderr index afdda3e15da..a0c0a8fb1f2 100644 --- a/src/test/ui/issues/issue-1476.stderr +++ b/src/test/ui/issues/issue-1476.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `x` in this scope - --> $DIR/issue-1476.rs:12:20 + --> $DIR/issue-1476.rs:2:20 | LL | println!("{}", x); //~ ERROR cannot find value `x` in this scope | ^ not found in this scope diff --git a/src/test/ui/issues/issue-14772.rs b/src/test/ui/issues/issue-14772.rs index aaaad67be52..8f6745246fd 100644 --- a/src/test/ui/issues/issue-14772.rs +++ b/src/test/ui/issues/issue-14772.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test #[test] diff --git a/src/test/ui/issues/issue-14772.stderr b/src/test/ui/issues/issue-14772.stderr index 1116cd38edf..a7448ad5b88 100644 --- a/src/test/ui/issues/issue-14772.stderr +++ b/src/test/ui/issues/issue-14772.stderr @@ -1,5 +1,5 @@ error: only functions may be used as tests - --> $DIR/issue-14772.rs:14:1 + --> $DIR/issue-14772.rs:4:1 | LL | mod foo {} //~ ERROR only functions may be used as tests | ^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-14837.rs b/src/test/ui/issues/issue-14837.rs index 0c6617e0ab7..54387804aff 100644 --- a/src/test/ui/issues/issue-14837.rs +++ b/src/test/ui/issues/issue-14837.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-14845.rs b/src/test/ui/issues/issue-14845.rs index 74f0833e8d1..d9b20e1f688 100644 --- a/src/test/ui/issues/issue-14845.rs +++ b/src/test/ui/issues/issue-14845.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - struct X { a: [u8; 1] } diff --git a/src/test/ui/issues/issue-14845.stderr b/src/test/ui/issues/issue-14845.stderr index a994026946e..94e7ac74ff0 100644 --- a/src/test/ui/issues/issue-14845.stderr +++ b/src/test/ui/issues/issue-14845.stderr @@ -1,11 +1,11 @@ error[E0606]: casting `&[u8; 1]` as `*mut u8` is invalid - --> $DIR/issue-14845.rs:18:14 + --> $DIR/issue-14845.rs:7:14 | LL | let _f = &x.a as *mut u8; //~ ERROR casting | ^^^^^^^^^^^^^^^ error[E0606]: casting `&[u8; 1]` as `*mut u8` is invalid - --> $DIR/issue-14845.rs:21:14 + --> $DIR/issue-14845.rs:10:14 | LL | let _v = &local as *mut u8; //~ ERROR casting | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-14853.rs b/src/test/ui/issues/issue-14853.rs index e4da3e4fa43..4ce6e3174d0 100644 --- a/src/test/ui/issues/issue-14853.rs +++ b/src/test/ui/issues/issue-14853.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Debug; trait Str {} diff --git a/src/test/ui/issues/issue-14853.stderr b/src/test/ui/issues/issue-14853.stderr index 6c2f6bb9c69..6fc10550492 100644 --- a/src/test/ui/issues/issue-14853.stderr +++ b/src/test/ui/issues/issue-14853.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/issue-14853.rs:22:5 + --> $DIR/issue-14853.rs:12:5 | LL | fn yay(_: Option, thing: &[T]); | ----------------------------------------------- definition of `yay` from trait diff --git a/src/test/ui/issues/issue-14901.rs b/src/test/ui/issues/issue-14901.rs index 18a6cfde3bd..61b2b64ddf0 100644 --- a/src/test/ui/issues/issue-14901.rs +++ b/src/test/ui/issues/issue-14901.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub trait Reader {} diff --git a/src/test/ui/issues/issue-14915.rs b/src/test/ui/issues/issue-14915.rs index 810d6656a8f..294533f0cbb 100644 --- a/src/test/ui/issues/issue-14915.rs +++ b/src/test/ui/issues/issue-14915.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn main() { diff --git a/src/test/ui/issues/issue-14915.stderr b/src/test/ui/issues/issue-14915.stderr index aa418f5df86..411d7a34552 100644 --- a/src/test/ui/issues/issue-14915.stderr +++ b/src/test/ui/issues/issue-14915.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `+` cannot be applied to type `std::boxed::Box` - --> $DIR/issue-14915.rs:16:20 + --> $DIR/issue-14915.rs:6:20 | LL | println!("{}", x + 1); | ^^^^^ diff --git a/src/test/ui/issues/issue-14933.rs b/src/test/ui/issues/issue-14933.rs index 54a2ca8c9ed..9249ba3d646 100644 --- a/src/test/ui/issues/issue-14933.rs +++ b/src/test/ui/issues/issue-14933.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-14936.rs b/src/test/ui/issues/issue-14936.rs index d90814daf5f..bd3c99ad8d7 100644 --- a/src/test/ui/issues/issue-14936.rs +++ b/src/test/ui/issues/issue-14936.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_macros)] #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-14959.rs b/src/test/ui/issues/issue-14959.rs index 8b56b424019..78ae21e2837 100644 --- a/src/test/ui/issues/issue-14959.rs +++ b/src/test/ui/issues/issue-14959.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-15034.rs b/src/test/ui/issues/issue-15034.rs index a62e46820d3..9ea6ed89ca2 100644 --- a/src/test/ui/issues/issue-15034.rs +++ b/src/test/ui/issues/issue-15034.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Lexer<'a> { input: &'a str, } @@ -25,7 +15,7 @@ struct Parser<'a> { impl<'a> Parser<'a> { pub fn new(lexer: &'a mut Lexer) -> Parser<'a> { Parser { lexer: lexer } - //~^ ERROR 27:25: 27:30: explicit lifetime required in the type of `lexer` [E0621] + //~^ ERROR explicit lifetime required in the type of `lexer` [E0621] } } diff --git a/src/test/ui/issues/issue-15034.stderr b/src/test/ui/issues/issue-15034.stderr index c87bec00d95..3ede5ba4fa3 100644 --- a/src/test/ui/issues/issue-15034.stderr +++ b/src/test/ui/issues/issue-15034.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `lexer` - --> $DIR/issue-15034.rs:27:25 + --> $DIR/issue-15034.rs:17:25 | LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> { | ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>` diff --git a/src/test/ui/issues/issue-15094.rs b/src/test/ui/issues/issue-15094.rs index 1dd6763cbe5..dea85df5efe 100644 --- a/src/test/ui/issues/issue-15094.rs +++ b/src/test/ui/issues/issue-15094.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(fn_traits, unboxed_closures)] use std::{fmt, ops}; diff --git a/src/test/ui/issues/issue-15094.stderr b/src/test/ui/issues/issue-15094.stderr index 7928a6be350..07e147132f7 100644 --- a/src/test/ui/issues/issue-15094.stderr +++ b/src/test/ui/issues/issue-15094.stderr @@ -1,5 +1,5 @@ error[E0053]: method `call_once` has an incompatible type for trait - --> $DIR/issue-15094.rs:21:5 + --> $DIR/issue-15094.rs:11:5 | LL | fn call_once(self, _args: ()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "rust-call" fn, found "Rust" fn diff --git a/src/test/ui/issues/issue-15108.rs b/src/test/ui/issues/issue-15108.rs index e650db05a6b..d2b56c0949d 100644 --- a/src/test/ui/issues/issue-15108.rs +++ b/src/test/ui/issues/issue-15108.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-15129.rs b/src/test/ui/issues/issue-15129.rs index 7a7ba46de74..ed134c175ed 100644 --- a/src/test/ui/issues/issue-15129.rs +++ b/src/test/ui/issues/issue-15129.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum T { T1(()), T2(()) diff --git a/src/test/ui/issues/issue-15129.stderr b/src/test/ui/issues/issue-15129.stderr index e65e6516222..7ee36908520 100644 --- a/src/test/ui/issues/issue-15129.stderr +++ b/src/test/ui/issues/issue-15129.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `(T1(()), V2(_))` not covered - --> $DIR/issue-15129.rs:22:11 + --> $DIR/issue-15129.rs:12:11 | LL | match (T::T1(()), V::V2(true)) { | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `(T1(()), V2(_))` not covered diff --git a/src/test/ui/issues/issue-15167.rs b/src/test/ui/issues/issue-15167.rs index d224b8a548c..a2653c10ea4 100644 --- a/src/test/ui/issues/issue-15167.rs +++ b/src/test/ui/issues/issue-15167.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // macro f should not be able to inject a reference to 'n'. macro_rules! f { () => (n) } diff --git a/src/test/ui/issues/issue-15167.stderr b/src/test/ui/issues/issue-15167.stderr index b15c493ad69..1c488bf6fba 100644 --- a/src/test/ui/issues/issue-15167.stderr +++ b/src/test/ui/issues/issue-15167.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `n` in this scope - --> $DIR/issue-15167.rs:13:25 + --> $DIR/issue-15167.rs:3:25 | LL | macro_rules! f { () => (n) } | ^ not found in this scope @@ -8,7 +8,7 @@ LL | println!("{}", f!()); | ---- in this macro invocation error[E0425]: cannot find value `n` in this scope - --> $DIR/issue-15167.rs:13:25 + --> $DIR/issue-15167.rs:3:25 | LL | macro_rules! f { () => (n) } | ^ not found in this scope @@ -17,7 +17,7 @@ LL | println!("{}", f!()); | ---- in this macro invocation error[E0425]: cannot find value `n` in this scope - --> $DIR/issue-15167.rs:13:25 + --> $DIR/issue-15167.rs:3:25 | LL | macro_rules! f { () => (n) } | ^ not found in this scope @@ -26,7 +26,7 @@ LL | println!("{}", f!()); | ---- in this macro invocation error[E0425]: cannot find value `n` in this scope - --> $DIR/issue-15167.rs:13:25 + --> $DIR/issue-15167.rs:3:25 | LL | macro_rules! f { () => (n) } | ^ not found in this scope diff --git a/src/test/ui/issues/issue-15207.rs b/src/test/ui/issues/issue-15207.rs index 70da8cf4169..356e55ac912 100644 --- a/src/test/ui/issues/issue-15207.rs +++ b/src/test/ui/issues/issue-15207.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { loop { break.push(1) //~ ERROR no method named `push` found for type `!` diff --git a/src/test/ui/issues/issue-15207.stderr b/src/test/ui/issues/issue-15207.stderr index 77e52012277..7149444b566 100644 --- a/src/test/ui/issues/issue-15207.stderr +++ b/src/test/ui/issues/issue-15207.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `push` found for type `!` in the current scope - --> $DIR/issue-15207.rs:13:15 + --> $DIR/issue-15207.rs:3:15 | LL | break.push(1) //~ ERROR no method named `push` found for type `!` | ^^^^ diff --git a/src/test/ui/issues/issue-15260.rs b/src/test/ui/issues/issue-15260.rs index 6356ea81660..64fc3df3d23 100644 --- a/src/test/ui/issues/issue-15260.rs +++ b/src/test/ui/issues/issue-15260.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { a: usize, } diff --git a/src/test/ui/issues/issue-15260.stderr b/src/test/ui/issues/issue-15260.stderr index 10cb79e0fc5..4a3041122b2 100644 --- a/src/test/ui/issues/issue-15260.stderr +++ b/src/test/ui/issues/issue-15260.stderr @@ -1,5 +1,5 @@ error[E0025]: field `a` bound multiple times in the pattern - --> $DIR/issue-15260.rs:18:9 + --> $DIR/issue-15260.rs:8:9 | LL | a: _, | ---- first use of `a` @@ -7,7 +7,7 @@ LL | a: _ | ^^^^ multiple uses of `a` in pattern error[E0025]: field `a` bound multiple times in the pattern - --> $DIR/issue-15260.rs:24:9 + --> $DIR/issue-15260.rs:14:9 | LL | a, | - first use of `a` @@ -15,7 +15,7 @@ LL | a: _ | ^^^^ multiple uses of `a` in pattern error[E0025]: field `a` bound multiple times in the pattern - --> $DIR/issue-15260.rs:30:9 + --> $DIR/issue-15260.rs:20:9 | LL | a, | - first use of `a` @@ -23,7 +23,7 @@ LL | a: _, | ^^^^ multiple uses of `a` in pattern error[E0025]: field `a` bound multiple times in the pattern - --> $DIR/issue-15260.rs:32:9 + --> $DIR/issue-15260.rs:22:9 | LL | a, | - first use of `a` diff --git a/src/test/ui/issues/issue-15261.rs b/src/test/ui/issues/issue-15261.rs index f5f9978ed9b..4119cb055c5 100644 --- a/src/test/ui/issues/issue-15261.rs +++ b/src/test/ui/issues/issue-15261.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/ui/issues/issue-15381.rs b/src/test/ui/issues/issue-15381.rs index 1cdd803971b..e58c866119f 100644 --- a/src/test/ui/issues/issue-15381.rs +++ b/src/test/ui/issues/issue-15381.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let values: Vec = vec![1,2,3,4,5,6,7,8]; diff --git a/src/test/ui/issues/issue-15381.stderr b/src/test/ui/issues/issue-15381.stderr index 7a936a82108..8152737256c 100644 --- a/src/test/ui/issues/issue-15381.stderr +++ b/src/test/ui/issues/issue-15381.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in `for` loop binding: `&[]` not covered - --> $DIR/issue-15381.rs:14:9 + --> $DIR/issue-15381.rs:4:9 | LL | for &[x,y,z] in values.chunks(3).filter(|&xs| xs.len() == 3) { | ^^^^^^^^ pattern `&[]` not covered diff --git a/src/test/ui/issues/issue-15524.rs b/src/test/ui/issues/issue-15524.rs index 7e696c97595..eb7ec419c2e 100644 --- a/src/test/ui/issues/issue-15524.rs +++ b/src/test/ui/issues/issue-15524.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const N: isize = 1; enum Foo { diff --git a/src/test/ui/issues/issue-15524.stderr b/src/test/ui/issues/issue-15524.stderr index a116e621a95..1702dad34ca 100644 --- a/src/test/ui/issues/issue-15524.stderr +++ b/src/test/ui/issues/issue-15524.stderr @@ -1,5 +1,5 @@ error[E0081]: discriminant value `1` already exists - --> $DIR/issue-15524.rs:15:9 + --> $DIR/issue-15524.rs:5:9 | LL | A = 1, | - first use of `1` @@ -7,7 +7,7 @@ LL | B = 1, | ^ enum already has `1` error[E0081]: discriminant value `1` already exists - --> $DIR/issue-15524.rs:18:5 + --> $DIR/issue-15524.rs:8:5 | LL | A = 1, | - first use of `1` @@ -16,7 +16,7 @@ LL | D, | ^ enum already has `1` error[E0081]: discriminant value `1` already exists - --> $DIR/issue-15524.rs:21:9 + --> $DIR/issue-15524.rs:11:9 | LL | A = 1, | - first use of `1` diff --git a/src/test/ui/issues/issue-15689-2.rs b/src/test/ui/issues/issue-15689-2.rs index 30bde2aa858..4a132611391 100644 --- a/src/test/ui/issues/issue-15689-2.rs +++ b/src/test/ui/issues/issue-15689-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-15735.rs b/src/test/ui/issues/issue-15735.rs index fbe39b27efc..20634cc3881 100644 --- a/src/test/ui/issues/issue-15735.rs +++ b/src/test/ui/issues/issue-15735.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] struct A<'a> { diff --git a/src/test/ui/issues/issue-15756.rs b/src/test/ui/issues/issue-15756.rs index c123e85a0e0..e0861dee61e 100644 --- a/src/test/ui/issues/issue-15756.rs +++ b/src/test/ui/issues/issue-15756.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::slice::Chunks; use std::slice::ChunksMut; diff --git a/src/test/ui/issues/issue-15756.stderr b/src/test/ui/issues/issue-15756.stderr index 877e0eaedf1..987bc512163 100644 --- a/src/test/ui/issues/issue-15756.stderr +++ b/src/test/ui/issues/issue-15756.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `[T]` cannot be known at compilation time - --> $DIR/issue-15756.rs:17:10 + --> $DIR/issue-15756.rs:7:10 | LL | &mut something | ^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[T]` - = note: to learn more, visit + = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/issues/issue-15783.rs b/src/test/ui/issues/issue-15783.rs index 37a2f1582bf..77eae914fa1 100644 --- a/src/test/ui/issues/issue-15783.rs +++ b/src/test/ui/issues/issue-15783.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo(params: Option<&[&str]>) -> usize { params.unwrap().first().unwrap().len() } diff --git a/src/test/ui/issues/issue-15783.stderr b/src/test/ui/issues/issue-15783.stderr index d565bad2448..595fe4025ad 100644 --- a/src/test/ui/issues/issue-15783.stderr +++ b/src/test/ui/issues/issue-15783.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-15783.rs:18:19 + --> $DIR/issue-15783.rs:8:19 | LL | let msg = foo(x); | ^ expected slice, found array of 1 elements diff --git a/src/test/ui/issues/issue-15896.rs b/src/test/ui/issues/issue-15896.rs index 35ef9ba2b4b..3054af7b930 100644 --- a/src/test/ui/issues/issue-15896.rs +++ b/src/test/ui/issues/issue-15896.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #15896. It used to ICE rustc. fn main() { diff --git a/src/test/ui/issues/issue-15896.stderr b/src/test/ui/issues/issue-15896.stderr index b41848c8cdf..de9757d5d32 100644 --- a/src/test/ui/issues/issue-15896.stderr +++ b/src/test/ui/issues/issue-15896.stderr @@ -1,6 +1,9 @@ error[E0308]: mismatched types - --> $DIR/issue-15896.rs:21:11 + --> $DIR/issue-15896.rs:11:11 | +LL | let u = match e { + | - this match expression has type `main::R` +LL | E::B( LL | Tau{t: x}, | ^^^^^^^^^ expected enum `main::R`, found struct `main::Tau` | diff --git a/src/test/ui/issues/issue-15919.rs b/src/test/ui/issues/issue-15919.rs index f3719951909..19ecf2f657e 100644 --- a/src/test/ui/issues/issue-15919.rs +++ b/src/test/ui/issues/issue-15919.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: too big for the current architecture // normalize-stderr-test "\[usize; \d+\]" -> "[usize; N]" diff --git a/src/test/ui/issues/issue-15965.rs b/src/test/ui/issues/issue-15965.rs index 76ba5a0f4b3..eef4900d432 100644 --- a/src/test/ui/issues/issue-15965.rs +++ b/src/test/ui/issues/issue-15965.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { return { return () } diff --git a/src/test/ui/issues/issue-15965.stderr b/src/test/ui/issues/issue-15965.stderr index 3162556986e..904656cb3b1 100644 --- a/src/test/ui/issues/issue-15965.stderr +++ b/src/test/ui/issues/issue-15965.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-15965.rs:13:9 + --> $DIR/issue-15965.rs:3:9 | LL | / { return () } LL | | //~^ ERROR type annotations needed [E0282] diff --git a/src/test/ui/issues/issue-16048.rs b/src/test/ui/issues/issue-16048.rs index cda83fe54b0..5910481bf7e 100644 --- a/src/test/ui/issues/issue-16048.rs +++ b/src/test/ui/issues/issue-16048.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait NoLifetime { fn get<'p, T : Test<'p>>(&self) -> T; //~^ NOTE lifetimes in impl do not match this method in trait diff --git a/src/test/ui/issues/issue-16048.stderr b/src/test/ui/issues/issue-16048.stderr index 97883fb2a95..18e59bd2410 100644 --- a/src/test/ui/issues/issue-16048.stderr +++ b/src/test/ui/issues/issue-16048.stderr @@ -1,5 +1,5 @@ error[E0195]: lifetime parameters or bounds on method `get` do not match the trait declaration - --> $DIR/issue-16048.rs:31:11 + --> $DIR/issue-16048.rs:21:11 | LL | fn get<'p, T : Test<'p>>(&self) -> T; | ------------------ lifetimes in impl do not match this method in trait diff --git a/src/test/ui/issues/issue-16098.rs b/src/test/ui/issues/issue-16098.rs index 68ac19b383f..a1131f80e90 100644 --- a/src/test/ui/issues/issue-16098.rs +++ b/src/test/ui/issues/issue-16098.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! prob1 { (0) => { 0 diff --git a/src/test/ui/issues/issue-16098.stderr b/src/test/ui/issues/issue-16098.stderr index 31162ca50cc..4a62cea20b8 100644 --- a/src/test/ui/issues/issue-16098.stderr +++ b/src/test/ui/issues/issue-16098.stderr @@ -1,5 +1,5 @@ error: recursion limit reached while expanding the macro `prob1` - --> $DIR/issue-16098.rs:17:18 + --> $DIR/issue-16098.rs:7:18 | LL | $n + prob1!($n - 1); //~ ERROR recursion limit reached while expanding the macro `prob1` | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-16149.rs b/src/test/ui/issues/issue-16149.rs index 60117bd88d4..7f0cad96a58 100644 --- a/src/test/ui/issues/issue-16149.rs +++ b/src/test/ui/issues/issue-16149.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { static externalValue: isize; } diff --git a/src/test/ui/issues/issue-16149.stderr b/src/test/ui/issues/issue-16149.stderr index 284ed035526..bb809840b2a 100644 --- a/src/test/ui/issues/issue-16149.stderr +++ b/src/test/ui/issues/issue-16149.stderr @@ -1,5 +1,5 @@ error[E0530]: match bindings cannot shadow statics - --> $DIR/issue-16149.rs:17:9 + --> $DIR/issue-16149.rs:7:9 | LL | static externalValue: isize; | ---------------------------- the static `externalValue` is defined here diff --git a/src/test/ui/issues/issue-16250.rs b/src/test/ui/issues/issue-16250.rs index f9d01003005..bf01627adfc 100644 --- a/src/test/ui/issues/issue-16250.rs +++ b/src/test/ui/issues/issue-16250.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(warnings)] pub struct Foo; diff --git a/src/test/ui/issues/issue-16250.stderr b/src/test/ui/issues/issue-16250.stderr index c826b20b65f..fc6f26f0439 100644 --- a/src/test/ui/issues/issue-16250.stderr +++ b/src/test/ui/issues/issue-16250.stderr @@ -1,18 +1,18 @@ error: `extern` block uses type `Foo` which is not FFI-safe: this struct has unspecified layout - --> $DIR/issue-16250.rs:16:20 + --> $DIR/issue-16250.rs:6:20 | LL | pub fn foo(x: (Foo)); //~ ERROR unspecified layout | ^^^ | note: lint level defined here - --> $DIR/issue-16250.rs:11:9 + --> $DIR/issue-16250.rs:1:9 | LL | #![deny(warnings)] | ^^^^^^^^ = note: #[deny(improper_ctypes)] implied by #[deny(warnings)] = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct note: type defined here - --> $DIR/issue-16250.rs:13:1 + --> $DIR/issue-16250.rs:3:1 | LL | pub struct Foo; | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-16338.rs b/src/test/ui/issues/issue-16338.rs index 438073e3b2f..7567740f28b 100644 --- a/src/test/ui/issues/issue-16338.rs +++ b/src/test/ui/issues/issue-16338.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Slice { data: *const T, len: usize, diff --git a/src/test/ui/issues/issue-16338.stderr b/src/test/ui/issues/issue-16338.stderr index c670f1e3e9c..af8c39d24ec 100644 --- a/src/test/ui/issues/issue-16338.stderr +++ b/src/test/ui/issues/issue-16338.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-16338.rs:17:9 + --> $DIR/issue-16338.rs:7:9 | LL | let Slice { data: data, len: len } = "foo"; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found struct `Slice` diff --git a/src/test/ui/issues/issue-16401.rs b/src/test/ui/issues/issue-16401.rs index 3060bbea43c..7135b7d82ef 100644 --- a/src/test/ui/issues/issue-16401.rs +++ b/src/test/ui/issues/issue-16401.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Slice { data: *const T, len: usize, diff --git a/src/test/ui/issues/issue-16401.stderr b/src/test/ui/issues/issue-16401.stderr index 179415c7621..1779d0befd8 100644 --- a/src/test/ui/issues/issue-16401.stderr +++ b/src/test/ui/issues/issue-16401.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types - --> $DIR/issue-16401.rs:18:9 + --> $DIR/issue-16401.rs:8:9 | +LL | match () { + | -- this match expression has type `()` LL | Slice { data: data, len: len } => (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `Slice` | diff --git a/src/test/ui/issues/issue-16538.rs b/src/test/ui/issues/issue-16538.rs index cc652119377..a990c078a79 100644 --- a/src/test/ui/issues/issue-16538.rs +++ b/src/test/ui/issues/issue-16538.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(safe_extern_statics)] mod Y { diff --git a/src/test/ui/issues/issue-16538.stderr b/src/test/ui/issues/issue-16538.stderr index 9bc3590ebab..78c7d310ba2 100644 --- a/src/test/ui/issues/issue-16538.stderr +++ b/src/test/ui/issues/issue-16538.stderr @@ -1,11 +1,11 @@ error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue-16538.rs:23:27 + --> $DIR/issue-16538.rs:13:27 | LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `*const usize` cannot be shared between threads safely - --> $DIR/issue-16538.rs:23:1 + --> $DIR/issue-16538.rs:13:1 | LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const usize` cannot be shared between threads safely diff --git a/src/test/ui/issues/issue-16562.rs b/src/test/ui/issues/issue-16562.rs index a400263a243..e16a35158c3 100644 --- a/src/test/ui/issues/issue-16562.rs +++ b/src/test/ui/issues/issue-16562.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait MatrixShape {} struct Col { diff --git a/src/test/ui/issues/issue-16562.stderr b/src/test/ui/issues/issue-16562.stderr index a4525033e25..3fe7507e8a4 100644 --- a/src/test/ui/issues/issue-16562.stderr +++ b/src/test/ui/issues/issue-16562.stderr @@ -1,5 +1,5 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-16562.rs:20:6 + --> $DIR/issue-16562.rs:10:6 | LL | impl Collection for Col { | ^ unconstrained type parameter diff --git a/src/test/ui/issues/issue-16596.rs b/src/test/ui/issues/issue-16596.rs index 01383c07806..3aa6c20ec57 100644 --- a/src/test/ui/issues/issue-16596.rs +++ b/src/test/ui/issues/issue-16596.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-16668.rs b/src/test/ui/issues/issue-16668.rs index d8af3762178..f69ca4677c9 100644 --- a/src/test/ui/issues/issue-16668.rs +++ b/src/test/ui/issues/issue-16668.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] struct Parser<'a, I, O> { diff --git a/src/test/ui/issues/issue-16683.rs b/src/test/ui/issues/issue-16683.rs index fcbf8a3d351..bbbd4daa4c5 100644 --- a/src/test/ui/issues/issue-16683.rs +++ b/src/test/ui/issues/issue-16683.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait T<'a> { fn a(&'a self) -> &'a bool; fn b(&self) { diff --git a/src/test/ui/issues/issue-16683.stderr b/src/test/ui/issues/issue-16683.stderr index ceb5347ca80..23e67bb2de9 100644 --- a/src/test/ui/issues/issue-16683.stderr +++ b/src/test/ui/issues/issue-16683.stderr @@ -1,23 +1,23 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements - --> $DIR/issue-16683.rs:14:14 + --> $DIR/issue-16683.rs:4:14 | LL | self.a(); //~ ERROR cannot infer | ^ | -note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 13:5... - --> $DIR/issue-16683.rs:13:5 +note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 3:5... + --> $DIR/issue-16683.rs:3:5 | LL | / fn b(&self) { LL | | self.a(); //~ ERROR cannot infer LL | | } | |_____^ note: ...so that reference does not outlive borrowed content - --> $DIR/issue-16683.rs:14:9 + --> $DIR/issue-16683.rs:4:9 | LL | self.a(); //~ ERROR cannot infer | ^^^^ -note: but, the lifetime must be valid for the lifetime 'a as defined on the trait at 11:9... - --> $DIR/issue-16683.rs:11:9 +note: but, the lifetime must be valid for the lifetime 'a as defined on the trait at 1:9... + --> $DIR/issue-16683.rs:1:9 | LL | trait T<'a> { | ^^ diff --git a/src/test/ui/issues/issue-16725.rs b/src/test/ui/issues/issue-16725.rs index 659ffb2c984..2cf8a60697d 100644 --- a/src/test/ui/issues/issue-16725.rs +++ b/src/test/ui/issues/issue-16725.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-16725.rs extern crate issue_16725 as foo; diff --git a/src/test/ui/issues/issue-16725.stderr b/src/test/ui/issues/issue-16725.stderr index ba36f9b5582..562ad940423 100644 --- a/src/test/ui/issues/issue-16725.stderr +++ b/src/test/ui/issues/issue-16725.stderr @@ -1,5 +1,5 @@ error[E0603]: function `bar` is private - --> $DIR/issue-16725.rs:16:19 + --> $DIR/issue-16725.rs:6:19 | LL | unsafe { foo::bar(); } | ^^^ diff --git a/src/test/ui/issues/issue-16922.rs b/src/test/ui/issues/issue-16922.rs index 1768c834cb3..1e865515c4b 100644 --- a/src/test/ui/issues/issue-16922.rs +++ b/src/test/ui/issues/issue-16922.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::any::Any; fn foo(value: &T) -> Box { diff --git a/src/test/ui/issues/issue-16922.stderr b/src/test/ui/issues/issue-16922.stderr index 3406d534896..1f3b3fe739c 100644 --- a/src/test/ui/issues/issue-16922.stderr +++ b/src/test/ui/issues/issue-16922.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `value` - --> $DIR/issue-16922.rs:14:5 + --> $DIR/issue-16922.rs:4:5 | LL | fn foo(value: &T) -> Box { | -- help: add explicit lifetime `'static` to the type of `value`: `&'static T` diff --git a/src/test/ui/issues/issue-16939.rs b/src/test/ui/issues/issue-16939.rs index e16c58b8a6c..ad724834391 100644 --- a/src/test/ui/issues/issue-16939.rs +++ b/src/test/ui/issues/issue-16939.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure we don't ICE when making an overloaded call with the // wrong arity. diff --git a/src/test/ui/issues/issue-16939.stderr b/src/test/ui/issues/issue-16939.stderr index 23848049370..7281f6a7355 100644 --- a/src/test/ui/issues/issue-16939.stderr +++ b/src/test/ui/issues/issue-16939.stderr @@ -1,5 +1,5 @@ error[E0057]: this function takes 0 parameters but 1 parameter was supplied - --> $DIR/issue-16939.rs:15:9 + --> $DIR/issue-16939.rs:5:9 | LL | |t| f(t); //~ ERROR E0057 | ^^^^ expected 0 parameters diff --git a/src/test/ui/issues/issue-16966.rs b/src/test/ui/issues/issue-16966.rs index 38b102c7e3e..9c6188350e3 100644 --- a/src/test/ui/issues/issue-16966.rs +++ b/src/test/ui/issues/issue-16966.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { panic!(std::default::Default::default()); //~^ ERROR type annotations needed diff --git a/src/test/ui/issues/issue-16966.stderr b/src/test/ui/issues/issue-16966.stderr index a26910e0146..13e77fe3073 100644 --- a/src/test/ui/issues/issue-16966.stderr +++ b/src/test/ui/issues/issue-16966.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-16966.rs:12:5 + --> $DIR/issue-16966.rs:2:5 | LL | panic!(std::default::Default::default()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for `M` diff --git a/src/test/ui/issues/issue-1697.rs b/src/test/ui/issues/issue-1697.rs index 43f92d8c3de..30b2558dce9 100644 --- a/src/test/ui/issues/issue-1697.rs +++ b/src/test/ui/issues/issue-1697.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Testing that we don't fail abnormally after hitting the errors use unresolved::*; //~ ERROR unresolved import `unresolved` [E0432] diff --git a/src/test/ui/issues/issue-1697.stderr b/src/test/ui/issues/issue-1697.stderr index b588c883264..00e136cb1ce 100644 --- a/src/test/ui/issues/issue-1697.stderr +++ b/src/test/ui/issues/issue-1697.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `unresolved` - --> $DIR/issue-1697.rs:13:5 + --> $DIR/issue-1697.rs:3:5 | LL | use unresolved::*; //~ ERROR unresolved import `unresolved` [E0432] | ^^^^^^^^^^ maybe a missing `extern crate unresolved;`? diff --git a/src/test/ui/issues/issue-16994.rs b/src/test/ui/issues/issue-16994.rs index d1d129c918a..d356ce8a4da 100644 --- a/src/test/ui/issues/issue-16994.rs +++ b/src/test/ui/issues/issue-16994.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen fn cb<'a,T>(_x: Box, bool))) -> T>) -> T { diff --git a/src/test/ui/issues/issue-17001.rs b/src/test/ui/issues/issue-17001.rs index 413e8b464ff..68cb2865fdc 100644 --- a/src/test/ui/issues/issue-17001.rs +++ b/src/test/ui/issues/issue-17001.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo {} fn main() { diff --git a/src/test/ui/issues/issue-17001.stderr b/src/test/ui/issues/issue-17001.stderr index a8e0cd8591b..bdd08249638 100644 --- a/src/test/ui/issues/issue-17001.stderr +++ b/src/test/ui/issues/issue-17001.stderr @@ -1,5 +1,5 @@ error[E0574]: expected struct, variant or union type, found module `foo` - --> $DIR/issue-17001.rs:14:13 + --> $DIR/issue-17001.rs:4:13 | LL | let p = foo { x: () }; //~ ERROR expected struct, variant or union type, found module `foo` | ^^^ not a struct, variant or union type diff --git a/src/test/ui/issues/issue-17025.rs b/src/test/ui/issues/issue-17025.rs index f250103b144..6b7b6d010aa 100644 --- a/src/test/ui/issues/issue-17025.rs +++ b/src/test/ui/issues/issue-17025.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test the unsized enum no longer compiles enum A { diff --git a/src/test/ui/issues/issue-17033.rs b/src/test/ui/issues/issue-17033.rs index 1cd43cbb0f8..d39b5683fee 100644 --- a/src/test/ui/issues/issue-17033.rs +++ b/src/test/ui/issues/issue-17033.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f<'r>(p: &'r mut fn(p: &mut ())) { (*p)(()) //~ ERROR mismatched types //~| expected type `&mut ()` diff --git a/src/test/ui/issues/issue-17033.stderr b/src/test/ui/issues/issue-17033.stderr index d6884f18881..181a9992c6d 100644 --- a/src/test/ui/issues/issue-17033.stderr +++ b/src/test/ui/issues/issue-17033.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-17033.rs:12:10 + --> $DIR/issue-17033.rs:2:10 | LL | (*p)(()) //~ ERROR mismatched types | ^^ diff --git a/src/test/ui/issues/issue-17121.rs b/src/test/ui/issues/issue-17121.rs index f280d60e1ce..706350fc1e2 100644 --- a/src/test/ui/issues/issue-17121.rs +++ b/src/test/ui/issues/issue-17121.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-17252.rs b/src/test/ui/issues/issue-17252.rs index 1c3e6890c8e..7141e4874c0 100644 --- a/src/test/ui/issues/issue-17252.rs +++ b/src/test/ui/issues/issue-17252.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const FOO: usize = FOO; //~ ERROR E0391 fn main() { diff --git a/src/test/ui/issues/issue-17252.stderr b/src/test/ui/issues/issue-17252.stderr index 8f97a841666..e333e150651 100644 --- a/src/test/ui/issues/issue-17252.stderr +++ b/src/test/ui/issues/issue-17252.stderr @@ -1,12 +1,12 @@ error[E0391]: cycle detected when processing `FOO` - --> $DIR/issue-17252.rs:11:20 + --> $DIR/issue-17252.rs:1:20 | LL | const FOO: usize = FOO; //~ ERROR E0391 | ^^^ | = note: ...which again requires processing `FOO`, completing the cycle note: cycle used when processing `main::{{constant}}` - --> $DIR/issue-17252.rs:14:18 + --> $DIR/issue-17252.rs:4:18 | LL | let _x: [u8; FOO]; // caused stack overflow prior to fix | ^^^ diff --git a/src/test/ui/issues/issue-17263.ast.stderr b/src/test/ui/issues/issue-17263.ast.stderr index 3d42dcb52f5..823f2c747d6 100644 --- a/src/test/ui/issues/issue-17263.ast.stderr +++ b/src/test/ui/issues/issue-17263.ast.stderr @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `foo` (via `foo.b`) as immutable because `foo` is al --> $DIR/issue-17263.rs:21:32 | LL | let (c, d) = (&mut foo.a, &foo.b); - | ----- ^^^^^ immutable borrow occurs here (via `foo.b`) + | ----- ^^^^^ immutable borrow of `foo.b` -- which overlaps with `foo.a` -- occurs here | | | mutable borrow occurs here (via `foo.a`) ... diff --git a/src/test/ui/issues/issue-17336.rs b/src/test/ui/issues/issue-17336.rs index b1cbdb87bcd..e2c0e8b91cc 100644 --- a/src/test/ui/issues/issue-17336.rs +++ b/src/test/ui/issues/issue-17336.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_must_use)] #[allow(dead_code)] diff --git a/src/test/ui/issues/issue-17337.rs b/src/test/ui/issues/issue-17337.rs index 8642396c380..1126ab7a206 100644 --- a/src/test/ui/issues/issue-17337.rs +++ b/src/test/ui/issues/issue-17337.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(staged_api)] #![deny(deprecated)] diff --git a/src/test/ui/issues/issue-17337.stderr b/src/test/ui/issues/issue-17337.stderr index 03215473745..4c3ffe92ccc 100644 --- a/src/test/ui/issues/issue-17337.stderr +++ b/src/test/ui/issues/issue-17337.stderr @@ -1,11 +1,11 @@ error: use of deprecated item 'Foo::foo': text - --> $DIR/issue-17337.rs:26:6 + --> $DIR/issue-17337.rs:16:6 | LL | .foo(); //~ ERROR use of deprecated item | ^^^ | note: lint level defined here - --> $DIR/issue-17337.rs:12:9 + --> $DIR/issue-17337.rs:2:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-17373.rs b/src/test/ui/issues/issue-17373.rs index f6e6a8a0852..dc3be48a7ea 100644 --- a/src/test/ui/issues/issue-17373.rs +++ b/src/test/ui/issues/issue-17373.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { *return //~ ERROR type `!` cannot be dereferenced ; diff --git a/src/test/ui/issues/issue-17373.stderr b/src/test/ui/issues/issue-17373.stderr index 38e93e65bdc..e1a9f097b22 100644 --- a/src/test/ui/issues/issue-17373.stderr +++ b/src/test/ui/issues/issue-17373.stderr @@ -1,5 +1,5 @@ error[E0614]: type `!` cannot be dereferenced - --> $DIR/issue-17373.rs:12:5 + --> $DIR/issue-17373.rs:2:5 | LL | *return //~ ERROR type `!` cannot be dereferenced | ^^^^^^^ diff --git a/src/test/ui/issues/issue-17385.nll.stderr b/src/test/ui/issues/issue-17385.nll.stderr index cdc5a047c07..20198f19dd5 100644 --- a/src/test/ui/issues/issue-17385.nll.stderr +++ b/src/test/ui/issues/issue-17385.nll.stderr @@ -1,23 +1,23 @@ error[E0382]: use of moved value: `foo` - --> $DIR/issue-17385.rs:29:11 + --> $DIR/issue-17385.rs:19:11 | +LL | let foo = X(1); + | --- move occurs because `foo` has type `X`, which does not implement the `Copy` trait LL | drop(foo); | --- value moved here LL | match foo { //~ ERROR use of moved value LL | X(1) => (), | ^ value used here after move - | - = note: move occurs because `foo` has type `X`, which does not implement the `Copy` trait error[E0382]: use of moved value: `e` - --> $DIR/issue-17385.rs:35:11 + --> $DIR/issue-17385.rs:25:11 | +LL | let e = Enum::Variant2; + | - move occurs because `e` has type `Enum`, which does not implement the `Copy` trait LL | drop(e); | - value moved here LL | match e { //~ ERROR use of moved value | ^ value used here after move - | - = note: move occurs because `e` has type `Enum`, which does not implement the `Copy` trait error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-17385.rs b/src/test/ui/issues/issue-17385.rs index eb293c79247..7400aadb059 100644 --- a/src/test/ui/issues/issue-17385.rs +++ b/src/test/ui/issues/issue-17385.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct X(isize); enum Enum { diff --git a/src/test/ui/issues/issue-17385.stderr b/src/test/ui/issues/issue-17385.stderr index 01d6d1a2720..5f28a3c2c27 100644 --- a/src/test/ui/issues/issue-17385.stderr +++ b/src/test/ui/issues/issue-17385.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `foo` - --> $DIR/issue-17385.rs:28:11 + --> $DIR/issue-17385.rs:18:11 | LL | drop(foo); | --- value moved here @@ -9,7 +9,7 @@ LL | match foo { //~ ERROR use of moved value = note: move occurs because `foo` has type `X`, which does not implement the `Copy` trait error[E0382]: use of moved value: `e` - --> $DIR/issue-17385.rs:35:11 + --> $DIR/issue-17385.rs:25:11 | LL | drop(e); | - value moved here diff --git a/src/test/ui/issues/issue-17405.rs b/src/test/ui/issues/issue-17405.rs index 5a6bd5ed588..14781a7d3f7 100644 --- a/src/test/ui/issues/issue-17405.rs +++ b/src/test/ui/issues/issue-17405.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { Bar(isize) } diff --git a/src/test/ui/issues/issue-17405.stderr b/src/test/ui/issues/issue-17405.stderr index bcccfd301b7..2bfc85cc7de 100644 --- a/src/test/ui/issues/issue-17405.stderr +++ b/src/test/ui/issues/issue-17405.stderr @@ -1,5 +1,5 @@ error[E0574]: expected struct, variant or union type, found enum `Foo` - --> $DIR/issue-17405.rs:17:9 + --> $DIR/issue-17405.rs:7:9 | LL | Foo { i } => () //~ ERROR expected struct, variant or union type, found enum `Foo` | ^^^ not a struct, variant or union type diff --git a/src/test/ui/issues/issue-17431-1.rs b/src/test/ui/issues/issue-17431-1.rs index 260cc366fae..3b692cc0eeb 100644 --- a/src/test/ui/issues/issue-17431-1.rs +++ b/src/test/ui/issues/issue-17431-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { foo: Option> } //~^ ERROR recursive type `Foo` has infinite size diff --git a/src/test/ui/issues/issue-17431-1.stderr b/src/test/ui/issues/issue-17431-1.stderr index fb27693c85e..eb5a1366e89 100644 --- a/src/test/ui/issues/issue-17431-1.stderr +++ b/src/test/ui/issues/issue-17431-1.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `Foo` has infinite size - --> $DIR/issue-17431-1.rs:11:1 + --> $DIR/issue-17431-1.rs:1:1 | LL | struct Foo { foo: Option> } | ^^^^^^^^^^ ------------------------ recursive without indirection diff --git a/src/test/ui/issues/issue-17431-2.rs b/src/test/ui/issues/issue-17431-2.rs index f39fb0e31c6..9ed97f63177 100644 --- a/src/test/ui/issues/issue-17431-2.rs +++ b/src/test/ui/issues/issue-17431-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Baz { q: Option } //~^ ERROR recursive type `Baz` has infinite size diff --git a/src/test/ui/issues/issue-17431-2.stderr b/src/test/ui/issues/issue-17431-2.stderr index 7e87babe93e..3a7b0e9ce79 100644 --- a/src/test/ui/issues/issue-17431-2.stderr +++ b/src/test/ui/issues/issue-17431-2.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `Baz` has infinite size - --> $DIR/issue-17431-2.rs:11:1 + --> $DIR/issue-17431-2.rs:1:1 | LL | struct Baz { q: Option } | ^^^^^^^^^^ -------------- recursive without indirection @@ -9,7 +9,7 @@ LL | struct Baz { q: Option } = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Baz` representable error[E0072]: recursive type `Foo` has infinite size - --> $DIR/issue-17431-2.rs:14:1 + --> $DIR/issue-17431-2.rs:4:1 | LL | struct Foo { q: Option } | ^^^^^^^^^^ -------------- recursive without indirection diff --git a/src/test/ui/issues/issue-17431-3.rs b/src/test/ui/issues/issue-17431-3.rs index 9ba085591f0..83a63a88b72 100644 --- a/src/test/ui/issues/issue-17431-3.rs +++ b/src/test/ui/issues/issue-17431-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::sync::Mutex; struct Foo { foo: Mutex> } diff --git a/src/test/ui/issues/issue-17431-3.stderr b/src/test/ui/issues/issue-17431-3.stderr index c12a4c11c2c..675a2e27142 100644 --- a/src/test/ui/issues/issue-17431-3.stderr +++ b/src/test/ui/issues/issue-17431-3.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `Foo` has infinite size - --> $DIR/issue-17431-3.rs:13:1 + --> $DIR/issue-17431-3.rs:3:1 | LL | struct Foo { foo: Mutex> } | ^^^^^^^^^^ ----------------------- recursive without indirection diff --git a/src/test/ui/issues/issue-17431-4.rs b/src/test/ui/issues/issue-17431-4.rs index 665c3cf8fe6..48f0dba2aec 100644 --- a/src/test/ui/issues/issue-17431-4.rs +++ b/src/test/ui/issues/issue-17431-4.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; struct Foo { foo: Option>>, marker: marker::PhantomData } diff --git a/src/test/ui/issues/issue-17431-4.stderr b/src/test/ui/issues/issue-17431-4.stderr index acfd688b622..aff9071095c 100644 --- a/src/test/ui/issues/issue-17431-4.stderr +++ b/src/test/ui/issues/issue-17431-4.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `Foo` has infinite size - --> $DIR/issue-17431-4.rs:13:1 + --> $DIR/issue-17431-4.rs:3:1 | LL | struct Foo { foo: Option>>, marker: marker::PhantomData } | ^^^^^^^^^^^^^ --------------------------- recursive without indirection diff --git a/src/test/ui/issues/issue-17431-5.rs b/src/test/ui/issues/issue-17431-5.rs index 85ed4d5d634..0fd6ee61156 100644 --- a/src/test/ui/issues/issue-17431-5.rs +++ b/src/test/ui/issues/issue-17431-5.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; struct Foo { foo: Bar } diff --git a/src/test/ui/issues/issue-17431-5.stderr b/src/test/ui/issues/issue-17431-5.stderr index ddfea58a857..537f9f34f55 100644 --- a/src/test/ui/issues/issue-17431-5.stderr +++ b/src/test/ui/issues/issue-17431-5.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `Bar` has infinite size - --> $DIR/issue-17431-5.rs:15:1 + --> $DIR/issue-17431-5.rs:5:1 | LL | struct Bar { x: Bar , marker: marker::PhantomData } | ^^^^^^^^^^^^^ ----------- recursive without indirection diff --git a/src/test/ui/issues/issue-17431-6.rs b/src/test/ui/issues/issue-17431-6.rs index 4c1e82c3d6a..b7e49873da8 100644 --- a/src/test/ui/issues/issue-17431-6.rs +++ b/src/test/ui/issues/issue-17431-6.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::sync::Mutex; enum Foo { X(Mutex>) } diff --git a/src/test/ui/issues/issue-17431-6.stderr b/src/test/ui/issues/issue-17431-6.stderr index ab2cc439f17..cb2dab95014 100644 --- a/src/test/ui/issues/issue-17431-6.stderr +++ b/src/test/ui/issues/issue-17431-6.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `Foo` has infinite size - --> $DIR/issue-17431-6.rs:13:1 + --> $DIR/issue-17431-6.rs:3:1 | LL | enum Foo { X(Mutex>) } | ^^^^^^^^ ------------------ recursive without indirection diff --git a/src/test/ui/issues/issue-17431-7.rs b/src/test/ui/issues/issue-17431-7.rs index 71b85da29fc..4fd7862781b 100644 --- a/src/test/ui/issues/issue-17431-7.rs +++ b/src/test/ui/issues/issue-17431-7.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { Voo(Option>) } //~^ ERROR recursive type `Foo` has infinite size diff --git a/src/test/ui/issues/issue-17431-7.stderr b/src/test/ui/issues/issue-17431-7.stderr index 7f9118860b9..de70851da4b 100644 --- a/src/test/ui/issues/issue-17431-7.stderr +++ b/src/test/ui/issues/issue-17431-7.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `Foo` has infinite size - --> $DIR/issue-17431-7.rs:11:1 + --> $DIR/issue-17431-7.rs:1:1 | LL | enum Foo { Voo(Option>) } | ^^^^^^^^ ------------------- recursive without indirection diff --git a/src/test/ui/issues/issue-17441.rs b/src/test/ui/issues/issue-17441.rs index 5432d5f5ed9..cfb2fe674ed 100644 --- a/src/test/ui/issues/issue-17441.rs +++ b/src/test/ui/issues/issue-17441.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let _foo = &[1_usize, 2] as [usize]; //~^ ERROR cast to unsized type: `&[usize; 2]` as `[usize]` diff --git a/src/test/ui/issues/issue-17441.stderr b/src/test/ui/issues/issue-17441.stderr index 6c7e883f9f9..436ee7325f8 100644 --- a/src/test/ui/issues/issue-17441.stderr +++ b/src/test/ui/issues/issue-17441.stderr @@ -1,17 +1,17 @@ error[E0620]: cast to unsized type: `&[usize; 2]` as `[usize]` - --> $DIR/issue-17441.rs:12:16 + --> $DIR/issue-17441.rs:2:16 | LL | let _foo = &[1_usize, 2] as [usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using an implicit coercion to `&[usize]` instead - --> $DIR/issue-17441.rs:12:16 + --> $DIR/issue-17441.rs:2:16 | LL | let _foo = &[1_usize, 2] as [usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0620]: cast to unsized type: `std::boxed::Box` as `dyn std::fmt::Debug` - --> $DIR/issue-17441.rs:15:16 + --> $DIR/issue-17441.rs:5:16 | LL | let _bar = Box::new(1_usize) as std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^^--------------- @@ -19,25 +19,25 @@ LL | let _bar = Box::new(1_usize) as std::fmt::Debug; | help: try casting to a `Box` instead: `Box` error[E0620]: cast to unsized type: `usize` as `dyn std::fmt::Debug` - --> $DIR/issue-17441.rs:18:16 + --> $DIR/issue-17441.rs:8:16 | LL | let _baz = 1_usize as std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using a box or reference as appropriate - --> $DIR/issue-17441.rs:18:16 + --> $DIR/issue-17441.rs:8:16 | LL | let _baz = 1_usize as std::fmt::Debug; | ^^^^^^^ error[E0620]: cast to unsized type: `[usize; 2]` as `[usize]` - --> $DIR/issue-17441.rs:21:17 + --> $DIR/issue-17441.rs:11:17 | LL | let _quux = [1_usize, 2] as [usize]; | ^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using a box or reference as appropriate - --> $DIR/issue-17441.rs:21:17 + --> $DIR/issue-17441.rs:11:17 | LL | let _quux = [1_usize, 2] as [usize]; | ^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-17444.rs b/src/test/ui/issues/issue-17444.rs index dafcff23838..906b443c9fa 100644 --- a/src/test/ui/issues/issue-17444.rs +++ b/src/test/ui/issues/issue-17444.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Test { Foo = 0 } diff --git a/src/test/ui/issues/issue-17444.stderr b/src/test/ui/issues/issue-17444.stderr index 3f87d806e7e..1097079dfc1 100644 --- a/src/test/ui/issues/issue-17444.stderr +++ b/src/test/ui/issues/issue-17444.stderr @@ -1,5 +1,5 @@ error[E0606]: casting `Test` as `*const isize` is invalid - --> $DIR/issue-17444.rs:16:14 + --> $DIR/issue-17444.rs:6:14 | LL | let _x = Test::Foo as *const isize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-17450.rs b/src/test/ui/issues/issue-17450.rs index f5af630cd18..70f33e3e661 100644 --- a/src/test/ui/issues/issue-17450.rs +++ b/src/test/ui/issues/issue-17450.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code, warnings)] diff --git a/src/test/ui/issues/issue-17458.rs b/src/test/ui/issues/issue-17458.rs index 354d389158d..444e94d829b 100644 --- a/src/test/ui/issues/issue-17458.rs +++ b/src/test/ui/issues/issue-17458.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -static X: usize = 0 as *const usize as usize; +static X: usize = unsafe { 0 as *const usize as usize }; //~^ ERROR: casting pointers to integers in statics is unstable fn main() { diff --git a/src/test/ui/issues/issue-17458.stderr b/src/test/ui/issues/issue-17458.stderr index 0303e4bddb5..a1a8ed9f0cd 100644 --- a/src/test/ui/issues/issue-17458.stderr +++ b/src/test/ui/issues/issue-17458.stderr @@ -1,8 +1,8 @@ error[E0658]: casting pointers to integers in statics is unstable (see issue #51910) - --> $DIR/issue-17458.rs:11:19 + --> $DIR/issue-17458.rs:1:28 | -LL | static X: usize = 0 as *const usize as usize; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | static X: usize = unsafe { 0 as *const usize as usize }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-17545.nll.stderr b/src/test/ui/issues/issue-17545.nll.stderr index b64bbe10477..527f8df9ccb 100644 --- a/src/test/ui/issues/issue-17545.nll.stderr +++ b/src/test/ui/issues/issue-17545.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-17545.rs:17:10 + --> $DIR/issue-17545.rs:7:10 | LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) { | -- lifetime `'a` defined here diff --git a/src/test/ui/issues/issue-17545.rs b/src/test/ui/issues/issue-17545.rs index 9264305e6ea..d62c0b9f32c 100644 --- a/src/test/ui/issues/issue-17545.rs +++ b/src/test/ui/issues/issue-17545.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(fn_traits)] fn id(x: T) -> T { x } diff --git a/src/test/ui/issues/issue-17545.stderr b/src/test/ui/issues/issue-17545.stderr index ce698665583..62ec25e1d1a 100644 --- a/src/test/ui/issues/issue-17545.stderr +++ b/src/test/ui/issues/issue-17545.stderr @@ -1,13 +1,13 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/issue-17545.rs:17:10 + --> $DIR/issue-17545.rs:7:10 | LL | &id(()), //~ ERROR borrowed value does not live long enough | ^^^^^^ temporary value does not live long enough LL | )); | - temporary value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:12... - --> $DIR/issue-17545.rs:15:12 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 5:12... + --> $DIR/issue-17545.rs:5:12 | LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) { | ^^ diff --git a/src/test/ui/issues/issue-17546.rs b/src/test/ui/issues/issue-17546.rs index fe125b973d9..dbfdad25e5b 100644 --- a/src/test/ui/issues/issue-17546.rs +++ b/src/test/ui/issues/issue-17546.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use foo::MyEnum::Result; use foo::NoResult; // Through a re-export diff --git a/src/test/ui/issues/issue-17546.stderr b/src/test/ui/issues/issue-17546.stderr index 39f7d5fcc04..1fbb229ed98 100644 --- a/src/test/ui/issues/issue-17546.stderr +++ b/src/test/ui/issues/issue-17546.stderr @@ -1,14 +1,19 @@ error[E0573]: expected type, found variant `NoResult` - --> $DIR/issue-17546.rs:22:17 + --> $DIR/issue-17546.rs:12:17 | LL | fn new() -> NoResult { - | --------^^^^^^^^^^^^^^^^ - | | - | did you mean `Result`? - | help: you can try using the variant's enum: `foo::MyEnum` + | ^^^^^^^^^^^^^^^^^^^^^^^^ +help: try using the variant's enum + | +LL | fn new() -> foo::MyEnum { + | ^^^^^^^^^^^ +help: an enum with a similar name exists + | +LL | fn new() -> Result { + | ^^^^^^ error[E0573]: expected type, found variant `Result` - --> $DIR/issue-17546.rs:32:17 + --> $DIR/issue-17546.rs:22:17 | LL | fn new() -> Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type @@ -25,7 +30,7 @@ LL | use std::result::Result; and 1 other candidates error[E0573]: expected type, found variant `Result` - --> $DIR/issue-17546.rs:38:13 + --> $DIR/issue-17546.rs:28:13 | LL | fn new() -> Result { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a type @@ -42,13 +47,18 @@ LL | use std::result::Result; and 1 other candidates error[E0573]: expected type, found variant `NoResult` - --> $DIR/issue-17546.rs:43:15 + --> $DIR/issue-17546.rs:33:15 | LL | fn newer() -> NoResult { - | --------^^^^^^^^^^^^^^^^^^^^^ - | | - | did you mean `Result`? - | help: you can try using the variant's enum: `foo::MyEnum` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: try using the variant's enum + | +LL | fn newer() -> foo::MyEnum { + | ^^^^^^^^^^^ +help: an enum with a similar name exists + | +LL | fn newer() -> Result { + | ^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-17551.rs b/src/test/ui/issues/issue-17551.rs index b55863f0dda..a65957ce074 100644 --- a/src/test/ui/issues/issue-17551.rs +++ b/src/test/ui/issues/issue-17551.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; struct B(marker::PhantomData); diff --git a/src/test/ui/issues/issue-17551.stderr b/src/test/ui/issues/issue-17551.stderr index 0cdee0337d8..df693591e7c 100644 --- a/src/test/ui/issues/issue-17551.stderr +++ b/src/test/ui/issues/issue-17551.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-17551.rs:16:15 + --> $DIR/issue-17551.rs:6:15 | LL | let foo = B(marker::PhantomData); //~ ERROR type annotations needed | --- ^ cannot infer type for `T` diff --git a/src/test/ui/issues/issue-17651.rs b/src/test/ui/issues/issue-17651.rs index cbd0da4b53c..7629a5a3be1 100644 --- a/src/test/ui/issues/issue-17651.rs +++ b/src/test/ui/issues/issue-17651.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that moves of unsized values within closures are caught // and rejected. diff --git a/src/test/ui/issues/issue-17651.stderr b/src/test/ui/issues/issue-17651.stderr index 3e5679bdc3b..72c40ff4b3a 100644 --- a/src/test/ui/issues/issue-17651.stderr +++ b/src/test/ui/issues/issue-17651.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time - --> $DIR/issue-17651.rs:15:9 + --> $DIR/issue-17651.rs:5:9 | LL | (|| Box::new(*(&[0][..])))(); | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[{integer}]` - = note: to learn more, visit + = note: to learn more, visit = note: required by `>::new` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17718-const-bad-values.rs b/src/test/ui/issues/issue-17718-const-bad-values.rs index 16cf4fd1b32..97657f88481 100644 --- a/src/test/ui/issues/issue-17718-const-bad-values.rs +++ b/src/test/ui/issues/issue-17718-const-bad-values.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const C1: &'static mut [usize] = &mut []; //~^ ERROR: references in constants may only refer to immutable values diff --git a/src/test/ui/issues/issue-17718-const-bad-values.stderr b/src/test/ui/issues/issue-17718-const-bad-values.stderr index 85424e5b73e..25b1cfb0ffb 100644 --- a/src/test/ui/issues/issue-17718-const-bad-values.stderr +++ b/src/test/ui/issues/issue-17718-const-bad-values.stderr @@ -1,17 +1,17 @@ error[E0017]: references in constants may only refer to immutable values - --> $DIR/issue-17718-const-bad-values.rs:11:34 + --> $DIR/issue-17718-const-bad-values.rs:1:34 | LL | const C1: &'static mut [usize] = &mut []; | ^^^^^^^ constants require immutable values error[E0013]: constants cannot refer to statics, use a constant instead - --> $DIR/issue-17718-const-bad-values.rs:15:41 + --> $DIR/issue-17718-const-bad-values.rs:5:41 | LL | const C2: &'static mut usize = unsafe { &mut S }; | ^^^^^^ error[E0017]: references in constants may only refer to immutable values - --> $DIR/issue-17718-const-bad-values.rs:15:41 + --> $DIR/issue-17718-const-bad-values.rs:5:41 | LL | const C2: &'static mut usize = unsafe { &mut S }; | ^^^^^^ constants require immutable values diff --git a/src/test/ui/issues/issue-17718-const-borrow.rs b/src/test/ui/issues/issue-17718-const-borrow.rs index 07123c69492..8a31bd0c66a 100644 --- a/src/test/ui/issues/issue-17718-const-borrow.rs +++ b/src/test/ui/issues/issue-17718-const-borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cell::UnsafeCell; const A: UnsafeCell = UnsafeCell::new(1); diff --git a/src/test/ui/issues/issue-17718-const-borrow.stderr b/src/test/ui/issues/issue-17718-const-borrow.stderr index 3b0217060f7..b4330049689 100644 --- a/src/test/ui/issues/issue-17718-const-borrow.stderr +++ b/src/test/ui/issues/issue-17718-const-borrow.stderr @@ -1,17 +1,17 @@ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead - --> $DIR/issue-17718-const-borrow.rs:14:39 + --> $DIR/issue-17718-const-borrow.rs:4:39 | LL | const B: &'static UnsafeCell = &A; | ^^ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead - --> $DIR/issue-17718-const-borrow.rs:19:39 + --> $DIR/issue-17718-const-borrow.rs:9:39 | LL | const E: &'static UnsafeCell = &D.a; | ^^^^ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead - --> $DIR/issue-17718-const-borrow.rs:21:23 + --> $DIR/issue-17718-const-borrow.rs:11:23 | LL | const F: &'static C = &D; | ^^ diff --git a/src/test/ui/issues/issue-17718-const-destructors.rs b/src/test/ui/issues/issue-17718-const-destructors.rs index da7a9f13ef2..133420b688e 100644 --- a/src/test/ui/issues/issue-17718-const-destructors.rs +++ b/src/test/ui/issues/issue-17718-const-destructors.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] struct A; diff --git a/src/test/ui/issues/issue-17718-const-naming.rs b/src/test/ui/issues/issue-17718-const-naming.rs index 4857c2fb446..d30b95843f3 100644 --- a/src/test/ui/issues/issue-17718-const-naming.rs +++ b/src/test/ui/issues/issue-17718-const-naming.rs @@ -1,18 +1,8 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![warn(unused)] -#[deny(warnings)] +#![deny(warnings)] const foo: isize = 3; -//~^ ERROR: should have an upper case name such as +//~^ ERROR: should have an upper case name //~^^ ERROR: constant item is never used fn main() {} diff --git a/src/test/ui/issues/issue-17718-const-naming.stderr b/src/test/ui/issues/issue-17718-const-naming.stderr index 9636db31390..b92acecb83e 100644 --- a/src/test/ui/issues/issue-17718-const-naming.stderr +++ b/src/test/ui/issues/issue-17718-const-naming.stderr @@ -1,27 +1,27 @@ error: constant item is never used: `foo` - --> $DIR/issue-17718-const-naming.rs:14:1 + --> $DIR/issue-17718-const-naming.rs:4:1 | LL | const foo: isize = 3; | ^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-17718-const-naming.rs:12:8 + --> $DIR/issue-17718-const-naming.rs:2:9 | -LL | #[deny(warnings)] - | ^^^^^^^^ +LL | #![deny(warnings)] + | ^^^^^^^^ = note: #[deny(dead_code)] implied by #[deny(warnings)] -error: constant `foo` should have an upper case name such as `FOO` - --> $DIR/issue-17718-const-naming.rs:14:1 +error: constant `foo` should have an upper case name + --> $DIR/issue-17718-const-naming.rs:4:7 | LL | const foo: isize = 3; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^ help: convert the identifier to upper case: `FOO` | note: lint level defined here - --> $DIR/issue-17718-const-naming.rs:12:8 + --> $DIR/issue-17718-const-naming.rs:2:9 | -LL | #[deny(warnings)] - | ^^^^^^^^ +LL | #![deny(warnings)] + | ^^^^^^^^ = note: #[deny(non_upper_case_globals)] implied by #[deny(warnings)] error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-17718-const-privacy.rs b/src/test/ui/issues/issue-17718-const-privacy.rs index 60eb4b7126d..6ab3a60df87 100644 --- a/src/test/ui/issues/issue-17718-const-privacy.rs +++ b/src/test/ui/issues/issue-17718-const-privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-17718-const-privacy.rs extern crate issue_17718_const_privacy as other; diff --git a/src/test/ui/issues/issue-17718-const-privacy.stderr b/src/test/ui/issues/issue-17718-const-privacy.stderr index 7d65a97ec1d..5025aaca777 100644 --- a/src/test/ui/issues/issue-17718-const-privacy.stderr +++ b/src/test/ui/issues/issue-17718-const-privacy.stderr @@ -1,11 +1,11 @@ error[E0603]: constant `B` is private - --> $DIR/issue-17718-const-privacy.rs:15:8 + --> $DIR/issue-17718-const-privacy.rs:5:8 | LL | use a::B; //~ ERROR: constant `B` is private | ^ error[E0603]: constant `BAR` is private - --> $DIR/issue-17718-const-privacy.rs:18:5 + --> $DIR/issue-17718-const-privacy.rs:8:5 | LL | BAR, //~ ERROR: constant `BAR` is private | ^^^ diff --git a/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr b/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr index b59bd5a0f97..8f3acae7139 100644 --- a/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr +++ b/src/test/ui/issues/issue-17718-constants-not-static.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to temporary value - --> $DIR/issue-17718-constants-not-static.rs:15:30 + --> $DIR/issue-17718-constants-not-static.rs:5:30 | LL | fn foo() -> &'static usize { &id(FOO) } | ^------- diff --git a/src/test/ui/issues/issue-17718-constants-not-static.rs b/src/test/ui/issues/issue-17718-constants-not-static.rs index 9b7ed463499..e857b906efa 100644 --- a/src/test/ui/issues/issue-17718-constants-not-static.rs +++ b/src/test/ui/issues/issue-17718-constants-not-static.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn id(x: T) -> T { x } const FOO: usize = 3; diff --git a/src/test/ui/issues/issue-17718-constants-not-static.stderr b/src/test/ui/issues/issue-17718-constants-not-static.stderr index 61d8399aba9..2a5b9d72223 100644 --- a/src/test/ui/issues/issue-17718-constants-not-static.stderr +++ b/src/test/ui/issues/issue-17718-constants-not-static.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/issue-17718-constants-not-static.rs:15:31 + --> $DIR/issue-17718-constants-not-static.rs:5:31 | LL | fn foo() -> &'static usize { &id(FOO) } | ^^^^^^^ - temporary value only lives until here diff --git a/src/test/ui/issues/issue-17718-patterns.rs b/src/test/ui/issues/issue-17718-patterns.rs index b9f5e98b6fa..2ca0f67f80e 100644 --- a/src/test/ui/issues/issue-17718-patterns.rs +++ b/src/test/ui/issues/issue-17718-patterns.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static A1: usize = 1; static mut A2: usize = 1; const A3: usize = 1; diff --git a/src/test/ui/issues/issue-17718-patterns.stderr b/src/test/ui/issues/issue-17718-patterns.stderr index c49613eb33c..698bd857a58 100644 --- a/src/test/ui/issues/issue-17718-patterns.stderr +++ b/src/test/ui/issues/issue-17718-patterns.stderr @@ -1,5 +1,5 @@ error[E0530]: match bindings cannot shadow statics - --> $DIR/issue-17718-patterns.rs:17:9 + --> $DIR/issue-17718-patterns.rs:7:9 | LL | static A1: usize = 1; | --------------------- the static `A1` is defined here @@ -8,7 +8,7 @@ LL | A1 => {} //~ ERROR: match bindings cannot shadow statics | ^^ cannot be named the same as a static error[E0530]: match bindings cannot shadow statics - --> $DIR/issue-17718-patterns.rs:18:9 + --> $DIR/issue-17718-patterns.rs:8:9 | LL | static mut A2: usize = 1; | ------------------------- the static `A2` is defined here diff --git a/src/test/ui/issues/issue-17718-references.rs b/src/test/ui/issues/issue-17718-references.rs index 586cfebcd16..03d5f8bb3f1 100644 --- a/src/test/ui/issues/issue-17718-references.rs +++ b/src/test/ui/issues/issue-17718-references.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] struct Struct { a: usize } diff --git a/src/test/ui/issues/issue-17718-references.stderr b/src/test/ui/issues/issue-17718-references.stderr index 6e89a83b308..ef49dcfeef9 100644 --- a/src/test/ui/issues/issue-17718-references.stderr +++ b/src/test/ui/issues/issue-17718-references.stderr @@ -1,17 +1,17 @@ error[E0013]: constants cannot refer to statics, use a constant instead - --> $DIR/issue-17718-references.rs:19:28 + --> $DIR/issue-17718-references.rs:9:28 | LL | const T2: &'static usize = &S; //~ ERROR: constants cannot refer to statics | ^^ error[E0013]: constants cannot refer to statics, use a constant instead - --> $DIR/issue-17718-references.rs:24:19 + --> $DIR/issue-17718-references.rs:14:19 | LL | const T6: usize = S; //~ ERROR: constants cannot refer to statics | ^ error[E0013]: constants cannot refer to statics, use a constant instead - --> $DIR/issue-17718-references.rs:29:33 + --> $DIR/issue-17718-references.rs:19:33 | LL | const T10: Struct = Struct { a: S }; | ^ diff --git a/src/test/ui/issues/issue-17718-static-move.nll.stderr b/src/test/ui/issues/issue-17718-static-move.nll.stderr index f8da3c3d598..86e7a184910 100644 --- a/src/test/ui/issues/issue-17718-static-move.nll.stderr +++ b/src/test/ui/issues/issue-17718-static-move.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of static item - --> $DIR/issue-17718-static-move.rs:16:14 + --> $DIR/issue-17718-static-move.rs:6:14 | LL | let _a = FOO; //~ ERROR: cannot move out of static item | ^^^ diff --git a/src/test/ui/issues/issue-17718-static-move.rs b/src/test/ui/issues/issue-17718-static-move.rs index a5a7117956f..015487a06aa 100644 --- a/src/test/ui/issues/issue-17718-static-move.rs +++ b/src/test/ui/issues/issue-17718-static-move.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; const INIT: Foo = Foo; static FOO: Foo = INIT; diff --git a/src/test/ui/issues/issue-17718-static-move.stderr b/src/test/ui/issues/issue-17718-static-move.stderr index a6384cfce8f..dd473f0a4c4 100644 --- a/src/test/ui/issues/issue-17718-static-move.stderr +++ b/src/test/ui/issues/issue-17718-static-move.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of static item - --> $DIR/issue-17718-static-move.rs:16:14 + --> $DIR/issue-17718-static-move.rs:6:14 | LL | let _a = FOO; //~ ERROR: cannot move out of static item | ^^^ diff --git a/src/test/ui/issues/issue-17718-static-sync.rs b/src/test/ui/issues/issue-17718-static-sync.rs index c5349d4e82b..dccbde6a3c5 100644 --- a/src/test/ui/issues/issue-17718-static-sync.rs +++ b/src/test/ui/issues/issue-17718-static-sync.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] use std::marker::Sync; diff --git a/src/test/ui/issues/issue-17718-static-sync.stderr b/src/test/ui/issues/issue-17718-static-sync.stderr index d6816826a00..7f162a9985f 100644 --- a/src/test/ui/issues/issue-17718-static-sync.stderr +++ b/src/test/ui/issues/issue-17718-static-sync.stderr @@ -1,5 +1,5 @@ error[E0277]: `Foo` cannot be shared between threads safely - --> $DIR/issue-17718-static-sync.rs:19:1 + --> $DIR/issue-17718-static-sync.rs:9:1 | LL | static BAR: Foo = Foo; | ^^^^^^^^^^^^^^^^^^^^^^ `Foo` cannot be shared between threads safely diff --git a/src/test/ui/issues/issue-17728.rs b/src/test/ui/issues/issue-17728.rs index 8516a8ea52e..0f13ae3304d 100644 --- a/src/test/ui/issues/issue-17728.rs +++ b/src/test/ui/issues/issue-17728.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::{Debug, Formatter, Error}; use std::collections::HashMap; @@ -23,7 +13,7 @@ trait TraversesWorld { let maybe_room = room.direction_to_room.get(&direction); match maybe_room { Some(entry) => Ok(entry), - //~^ ERROR 25:28: 25:37: lifetime mismatch [E0623] + //~^ ERROR lifetime mismatch [E0623] _ => Err("Direction does not exist in room.") } } diff --git a/src/test/ui/issues/issue-17728.stderr b/src/test/ui/issues/issue-17728.stderr index e46c48c4c39..355868f0569 100644 --- a/src/test/ui/issues/issue-17728.stderr +++ b/src/test/ui/issues/issue-17728.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/issue-17728.rs:25:28 + --> $DIR/issue-17728.rs:15:28 | LL | fn attemptTraverse(&self, room: &Room, directionStr: &str) -> Result<&Room, &str> { | ----- ------------------- @@ -10,7 +10,7 @@ LL | Some(entry) => Ok(entry), | ^^^^^^^^^ ...but data from `room` is returned here error[E0308]: match arms have incompatible types - --> $DIR/issue-17728.rs:110:5 + --> $DIR/issue-17728.rs:100:5 | LL | / match to_parse { //~ ERROR match arms have incompatible types LL | | "w" | "west" => RoomDirection::West, diff --git a/src/test/ui/issues/issue-17732.rs b/src/test/ui/issues/issue-17732.rs index e5b4a2e3edd..7993bbb38bb 100644 --- a/src/test/ui/issues/issue-17732.rs +++ b/src/test/ui/issues/issue-17732.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-17740.rs b/src/test/ui/issues/issue-17740.rs index 1d5ef4360dc..c131b895849 100644 --- a/src/test/ui/issues/issue-17740.rs +++ b/src/test/ui/issues/issue-17740.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'a> { data: &'a[u8], } diff --git a/src/test/ui/issues/issue-17740.stderr b/src/test/ui/issues/issue-17740.stderr index e4f5485953c..c7a76c558ee 100644 --- a/src/test/ui/issues/issue-17740.stderr +++ b/src/test/ui/issues/issue-17740.stderr @@ -1,13 +1,13 @@ error[E0308]: mismatched method receiver - --> $DIR/issue-17740.rs:16:18 + --> $DIR/issue-17740.rs:6:18 | LL | fn bar(self: &mut Foo) { | ^^^^^^^^ lifetime mismatch | = note: expected type `Foo<'a>` found type `Foo<'_>` -note: the anonymous lifetime #2 defined on the method body at 16:5... - --> $DIR/issue-17740.rs:16:5 +note: the anonymous lifetime #2 defined on the method body at 6:5... + --> $DIR/issue-17740.rs:6:5 | LL | / fn bar(self: &mut Foo) { LL | | //~^ mismatched method receiver @@ -17,27 +17,27 @@ LL | | //~| found type `Foo<'_>` LL | | //~| lifetime mismatch LL | | } | |_____^ -note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 15:7 - --> $DIR/issue-17740.rs:15:7 +note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 5:7 + --> $DIR/issue-17740.rs:5:7 | LL | impl <'a> Foo<'a>{ | ^^ error[E0308]: mismatched method receiver - --> $DIR/issue-17740.rs:16:18 + --> $DIR/issue-17740.rs:6:18 | LL | fn bar(self: &mut Foo) { | ^^^^^^^^ lifetime mismatch | = note: expected type `Foo<'a>` found type `Foo<'_>` -note: the lifetime 'a as defined on the impl at 15:7... - --> $DIR/issue-17740.rs:15:7 +note: the lifetime 'a as defined on the impl at 5:7... + --> $DIR/issue-17740.rs:5:7 | LL | impl <'a> Foo<'a>{ | ^^ -note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 16:5 - --> $DIR/issue-17740.rs:16:5 +note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 6:5 + --> $DIR/issue-17740.rs:6:5 | LL | / fn bar(self: &mut Foo) { LL | | //~^ mismatched method receiver diff --git a/src/test/ui/issues/issue-17746.rs b/src/test/ui/issues/issue-17746.rs index 18299c6acb3..45c5b858ecd 100644 --- a/src/test/ui/issues/issue-17746.rs +++ b/src/test/ui/issues/issue-17746.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Regression test for #17746 diff --git a/src/test/ui/issues/issue-17758.rs b/src/test/ui/issues/issue-17758.rs index a47f5c16a46..d0dbd3455df 100644 --- a/src/test/ui/issues/issue-17758.rs +++ b/src/test/ui/issues/issue-17758.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that regionck suggestions in a provided method of a trait // don't ICE diff --git a/src/test/ui/issues/issue-17758.stderr b/src/test/ui/issues/issue-17758.stderr index 3d78b2e2d7f..b376757091d 100644 --- a/src/test/ui/issues/issue-17758.stderr +++ b/src/test/ui/issues/issue-17758.stderr @@ -1,11 +1,11 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements - --> $DIR/issue-17758.rs:17:14 + --> $DIR/issue-17758.rs:7:14 | LL | self.foo(); | ^^^ | -note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 16:5... - --> $DIR/issue-17758.rs:16:5 +note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 6:5... + --> $DIR/issue-17758.rs:6:5 | LL | / fn bar(&self) { LL | | self.foo(); @@ -13,12 +13,12 @@ LL | | //~^ ERROR cannot infer LL | | } | |_____^ note: ...so that reference does not outlive borrowed content - --> $DIR/issue-17758.rs:17:9 + --> $DIR/issue-17758.rs:7:9 | LL | self.foo(); | ^^^^ -note: but, the lifetime must be valid for the lifetime 'a as defined on the trait at 14:11... - --> $DIR/issue-17758.rs:14:11 +note: but, the lifetime must be valid for the lifetime 'a as defined on the trait at 4:11... + --> $DIR/issue-17758.rs:4:11 | LL | trait Foo<'a> { | ^^ diff --git a/src/test/ui/issues/issue-17800.rs b/src/test/ui/issues/issue-17800.rs index 8ccf34f2456..45879d68b35 100644 --- a/src/test/ui/issues/issue-17800.rs +++ b/src/test/ui/issues/issue-17800.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum MyOption { MySome(T), MyNone, diff --git a/src/test/ui/issues/issue-17800.stderr b/src/test/ui/issues/issue-17800.stderr index e1c48e8a0e8..b4234245bfb 100644 --- a/src/test/ui/issues/issue-17800.stderr +++ b/src/test/ui/issues/issue-17800.stderr @@ -1,5 +1,5 @@ error[E0026]: variant `MyOption::MySome` does not have a field named `x` - --> $DIR/issue-17800.rs:18:28 + --> $DIR/issue-17800.rs:8:28 | LL | MyOption::MySome { x: 42 } => (), | ^^^^^ diff --git a/src/test/ui/issues/issue-17904-2.rs b/src/test/ui/issues/issue-17904-2.rs index a15ccb71aa7..9603da097b1 100644 --- a/src/test/ui/issues/issue-17904-2.rs +++ b/src/test/ui/issues/issue-17904-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can parse a unit struct with a where clause, even if // it leads to an error later on since `T` is unused. diff --git a/src/test/ui/issues/issue-17904-2.stderr b/src/test/ui/issues/issue-17904-2.stderr index 00013d4d52b..b4f97452574 100644 --- a/src/test/ui/issues/issue-17904-2.stderr +++ b/src/test/ui/issues/issue-17904-2.stderr @@ -1,5 +1,5 @@ error[E0392]: parameter `T` is never used - --> $DIR/issue-17904-2.rs:14:12 + --> $DIR/issue-17904-2.rs:4:12 | LL | struct Foo where T: Copy; //~ ERROR parameter `T` is never used | ^ unused type parameter diff --git a/src/test/ui/issues/issue-17904.rs b/src/test/ui/issues/issue-17904.rs index 8de0f6d2922..2fe54957b3c 100644 --- a/src/test/ui/issues/issue-17904.rs +++ b/src/test/ui/issues/issue-17904.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Test that we can parse where clauses on various forms of tuple diff --git a/src/test/ui/issues/issue-17905-2.rs b/src/test/ui/issues/issue-17905-2.rs index 7b4a40e26b1..259d9450189 100644 --- a/src/test/ui/issues/issue-17905-2.rs +++ b/src/test/ui/issues/issue-17905-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Debug)] struct Pair (T, V); @@ -16,6 +6,8 @@ impl Pair< isize > { fn say(self: &Pair<&str, isize>) { +//~^ ERROR mismatched method receiver +//~| ERROR mismatched method receiver println!("{:?}", self); } } diff --git a/src/test/ui/issues/issue-17905-2.stderr b/src/test/ui/issues/issue-17905-2.stderr index f6f23be2ab8..39e5f8ffc9f 100644 --- a/src/test/ui/issues/issue-17905-2.stderr +++ b/src/test/ui/issues/issue-17905-2.stderr @@ -1,41 +1,45 @@ error[E0308]: mismatched method receiver - --> $DIR/issue-17905-2.rs:18:18 + --> $DIR/issue-17905-2.rs:8:18 | LL | fn say(self: &Pair<&str, isize>) { | ^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Pair<&'_ str, _>` found type `Pair<&str, _>` -note: the anonymous lifetime #2 defined on the method body at 18:5... - --> $DIR/issue-17905-2.rs:18:5 +note: the anonymous lifetime #2 defined on the method body at 8:5... + --> $DIR/issue-17905-2.rs:8:5 | LL | / fn say(self: &Pair<&str, isize>) { +LL | | //~^ ERROR mismatched method receiver +LL | | //~| ERROR mismatched method receiver LL | | println!("{:?}", self); LL | | } | |_____^ -note: ...does not necessarily outlive the lifetime '_ as defined on the impl at 15:5 - --> $DIR/issue-17905-2.rs:15:5 +note: ...does not necessarily outlive the lifetime '_ as defined on the impl at 5:5 + --> $DIR/issue-17905-2.rs:5:5 | LL | &str, | ^ error[E0308]: mismatched method receiver - --> $DIR/issue-17905-2.rs:18:18 + --> $DIR/issue-17905-2.rs:8:18 | LL | fn say(self: &Pair<&str, isize>) { | ^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Pair<&'_ str, _>` found type `Pair<&str, _>` -note: the lifetime '_ as defined on the impl at 15:5... - --> $DIR/issue-17905-2.rs:15:5 +note: the lifetime '_ as defined on the impl at 5:5... + --> $DIR/issue-17905-2.rs:5:5 | LL | &str, | ^ -note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 18:5 - --> $DIR/issue-17905-2.rs:18:5 +note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 8:5 + --> $DIR/issue-17905-2.rs:8:5 | LL | / fn say(self: &Pair<&str, isize>) { +LL | | //~^ ERROR mismatched method receiver +LL | | //~| ERROR mismatched method receiver LL | | println!("{:?}", self); LL | | } | |_____^ diff --git a/src/test/ui/issues/issue-17905.rs b/src/test/ui/issues/issue-17905.rs index fc5069d9443..95133a45844 100644 --- a/src/test/ui/issues/issue-17905.rs +++ b/src/test/ui/issues/issue-17905.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #[derive(Debug)] diff --git a/src/test/ui/issues/issue-17913.rs b/src/test/ui/issues/issue-17913.rs index 9b9159994ac..b0c4ef54b16 100644 --- a/src/test/ui/issues/issue-17913.rs +++ b/src/test/ui/issues/issue-17913.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // normalize-stderr-test "\[&usize; \d+\]" -> "[&usize; N]" // error-pattern: too big for the current architecture diff --git a/src/test/ui/issues/issue-17933.rs b/src/test/ui/issues/issue-17933.rs index 049a0665c54..c649b64dcd4 100644 --- a/src/test/ui/issues/issue-17933.rs +++ b/src/test/ui/issues/issue-17933.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub static X: usize = 1; fn main() { diff --git a/src/test/ui/issues/issue-17933.stderr b/src/test/ui/issues/issue-17933.stderr index ec0f4785c8f..e48a65087f4 100644 --- a/src/test/ui/issues/issue-17933.stderr +++ b/src/test/ui/issues/issue-17933.stderr @@ -1,5 +1,5 @@ error[E0532]: expected unit struct/variant or constant, found static `self::X` - --> $DIR/issue-17933.rs:15:9 + --> $DIR/issue-17933.rs:5:9 | LL | self::X => { }, | ^^^^^^^ not a unit struct/variant or constant diff --git a/src/test/ui/issues/issue-17954.nll.stderr b/src/test/ui/issues/issue-17954.nll.stderr index 67a5e3eaec7..e08375fee1f 100644 --- a/src/test/ui/issues/issue-17954.nll.stderr +++ b/src/test/ui/issues/issue-17954.nll.stderr @@ -1,5 +1,5 @@ error[E0712]: thread-local variable borrowed past end of function - --> $DIR/issue-17954.rs:17:13 + --> $DIR/issue-17954.rs:7:13 | LL | let a = &FOO; | ^^^^ thread-local variables cannot be borrowed beyond the end of the function diff --git a/src/test/ui/issues/issue-17954.rs b/src/test/ui/issues/issue-17954.rs index 5f003436951..a8fbf2372b0 100644 --- a/src/test/ui/issues/issue-17954.rs +++ b/src/test/ui/issues/issue-17954.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(thread_local)] #[thread_local] diff --git a/src/test/ui/issues/issue-17954.stderr b/src/test/ui/issues/issue-17954.stderr index 020e544ad10..458bef54992 100644 --- a/src/test/ui/issues/issue-17954.stderr +++ b/src/test/ui/issues/issue-17954.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/issue-17954.rs:17:14 + --> $DIR/issue-17954.rs:7:14 | LL | let a = &FOO; | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/issues/issue-17959.rs b/src/test/ui/issues/issue-17959.rs index 37c8173c4f6..d56f346ecd4 100644 --- a/src/test/ui/issues/issue-17959.rs +++ b/src/test/ui/issues/issue-17959.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate core; use core::ops::Drop; diff --git a/src/test/ui/issues/issue-17959.stderr b/src/test/ui/issues/issue-17959.stderr index 626b670ae35..790e8f7c798 100644 --- a/src/test/ui/issues/issue-17959.stderr +++ b/src/test/ui/issues/issue-17959.stderr @@ -1,5 +1,5 @@ error[E0367]: The requirement `T: std::marker::Sized` is added only by the Drop impl. - --> $DIR/issue-17959.rs:21:1 + --> $DIR/issue-17959.rs:11:1 | LL | / impl Drop for G { LL | | //~^ ERROR: The requirement `T: std::marker::Sized` is added only by the Drop impl. [E0367] @@ -11,7 +11,7 @@ LL | | } | |_^ | note: The same requirement must be part of the struct/enum definition - --> $DIR/issue-17959.rs:17:1 + --> $DIR/issue-17959.rs:7:1 | LL | / struct G { LL | | _ptr: *const T diff --git a/src/test/ui/issues/issue-17994.rs b/src/test/ui/issues/issue-17994.rs index 25141b9b825..39b0a7ebe74 100644 --- a/src/test/ui/issues/issue-17994.rs +++ b/src/test/ui/issues/issue-17994.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Tr {} type Huh where T: Tr = isize; //~ ERROR type parameter `T` is unused fn main() {} diff --git a/src/test/ui/issues/issue-17994.stderr b/src/test/ui/issues/issue-17994.stderr index 77bcc469538..e22b2c07197 100644 --- a/src/test/ui/issues/issue-17994.stderr +++ b/src/test/ui/issues/issue-17994.stderr @@ -1,5 +1,5 @@ error[E0091]: type parameter `T` is unused - --> $DIR/issue-17994.rs:12:10 + --> $DIR/issue-17994.rs:2:10 | LL | type Huh where T: Tr = isize; //~ ERROR type parameter `T` is unused | ^ unused type parameter diff --git a/src/test/ui/issues/issue-17999.rs b/src/test/ui/issues/issue-17999.rs index 88945f80eae..941f1e7755a 100644 --- a/src/test/ui/issues/issue-17999.rs +++ b/src/test/ui/issues/issue-17999.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused_variables)] fn main() { diff --git a/src/test/ui/issues/issue-17999.stderr b/src/test/ui/issues/issue-17999.stderr index 1a24015da54..51c0c757a80 100644 --- a/src/test/ui/issues/issue-17999.stderr +++ b/src/test/ui/issues/issue-17999.stderr @@ -1,20 +1,20 @@ error: unused variable: `x` - --> $DIR/issue-17999.rs:15:13 + --> $DIR/issue-17999.rs:5:13 | LL | let x = (); //~ ERROR: unused variable: `x` - | ^ help: consider using `_x` instead + | ^ help: consider prefixing with an underscore: `_x` | note: lint level defined here - --> $DIR/issue-17999.rs:11:9 + --> $DIR/issue-17999.rs:1:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ error: unused variable: `a` - --> $DIR/issue-17999.rs:17:13 + --> $DIR/issue-17999.rs:7:13 | LL | a => {} //~ ERROR: unused variable: `a` - | ^ help: consider using `_a` instead + | ^ help: consider prefixing with an underscore: `_a` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-18058.rs b/src/test/ui/issues/issue-18058.rs index 4c815e689d4..cced66717e1 100644 --- a/src/test/ui/issues/issue-18058.rs +++ b/src/test/ui/issues/issue-18058.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - impl Undefined {} //~^ ERROR cannot find type `Undefined` in this scope diff --git a/src/test/ui/issues/issue-18058.stderr b/src/test/ui/issues/issue-18058.stderr index ded375a9332..18159ffc238 100644 --- a/src/test/ui/issues/issue-18058.stderr +++ b/src/test/ui/issues/issue-18058.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `Undefined` in this scope - --> $DIR/issue-18058.rs:11:6 + --> $DIR/issue-18058.rs:1:6 | LL | impl Undefined {} | ^^^^^^^^^ not found in this scope diff --git a/src/test/ui/issues/issue-18083.rs b/src/test/ui/issues/issue-18083.rs index c370b3605f8..c2cf2919ff0 100644 --- a/src/test/ui/issues/issue-18083.rs +++ b/src/test/ui/issues/issue-18083.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/test/ui/issues/issue-18088.rs b/src/test/ui/issues/issue-18088.rs index 74014fde36b..67000d9a6ec 100644 --- a/src/test/ui/issues/issue-18088.rs +++ b/src/test/ui/issues/issue-18088.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub trait Indexable: std::ops::Index { diff --git a/src/test/ui/issues/issue-18107.rs b/src/test/ui/issues/issue-18107.rs index 260038b7add..184d122d5cd 100644 --- a/src/test/ui/issues/issue-18107.rs +++ b/src/test/ui/issues/issue-18107.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait AbstractRenderer {} fn _create_render(_: &()) -> diff --git a/src/test/ui/issues/issue-18107.stderr b/src/test/ui/issues/issue-18107.stderr index c813e290b9e..23b58c3f6df 100644 --- a/src/test/ui/issues/issue-18107.stderr +++ b/src/test/ui/issues/issue-18107.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `(dyn AbstractRenderer + 'static)` cannot be known at compilation time - --> $DIR/issue-18107.rs:14:5 + --> $DIR/issue-18107.rs:4:5 | LL | AbstractRenderer | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn AbstractRenderer + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: the return type of a function must have a statically known size error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18118-2.rs b/src/test/ui/issues/issue-18118-2.rs index 6efe532b5fd..6d52156b3d2 100644 --- a/src/test/ui/issues/issue-18118-2.rs +++ b/src/test/ui/issues/issue-18118-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { const z: &'static isize = { static p: isize = 3; diff --git a/src/test/ui/issues/issue-18118-2.stderr b/src/test/ui/issues/issue-18118-2.stderr index c0b306140c5..4e848c261be 100644 --- a/src/test/ui/issues/issue-18118-2.stderr +++ b/src/test/ui/issues/issue-18118-2.stderr @@ -1,5 +1,5 @@ error[E0013]: constants cannot refer to statics, use a constant instead - --> $DIR/issue-18118-2.rs:14:9 + --> $DIR/issue-18118-2.rs:4:9 | LL | &p | ^^ diff --git a/src/test/ui/issues/issue-18118.nll.stderr b/src/test/ui/issues/issue-18118.nll.stderr index 9e680e87f79..1920e1637d1 100644 --- a/src/test/ui/issues/issue-18118.nll.stderr +++ b/src/test/ui/issues/issue-18118.nll.stderr @@ -1,68 +1,14 @@ -error[E0658]: let bindings in constants are unstable (see issue #48821) - --> $DIR/issue-18118.rs:15:17 - | -LL | let p = 3; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue-18118.rs:15:17 - | -LL | let p = 3; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constants are unstable (see issue #48821) - --> $DIR/issue-18118.rs:18:9 - | -LL | &p //~ ERROR `p` does not live long enough - | ^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constants are unstable (see issue #48821) - --> $DIR/issue-18118.rs:12:5 - | -LL | / const z: &'static isize = { -LL | | //~^ ERROR let bindings in constants are unstable -LL | | //~| ERROR statements in constants are unstable -LL | | let p = 3; -... | -LL | | //~^ ERROR let bindings in constants are unstable -LL | | }; - | |______^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue-18118.rs:12:5 - | -LL | / const z: &'static isize = { -LL | | //~^ ERROR let bindings in constants are unstable -LL | | //~| ERROR statements in constants are unstable -LL | | let p = 3; -... | -LL | | //~^ ERROR let bindings in constants are unstable -LL | | }; - | |______^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - error[E0597]: `p` does not live long enough - --> $DIR/issue-18118.rs:18:9 + --> $DIR/issue-18118.rs:4:9 | LL | &p //~ ERROR `p` does not live long enough | ^^ | | | borrowed value does not live long enough | using this value as a constant requires that `p` is borrowed for `'static` -LL | //~^ ERROR let bindings in constants are unstable LL | }; | - `p` dropped here while still borrowed -error: aborting due to 6 previous errors +error: aborting due to previous error -Some errors occurred: E0597, E0658. -For more information about an error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/issues/issue-18118.rs b/src/test/ui/issues/issue-18118.rs index 7194c159c1e..f58a3de281f 100644 --- a/src/test/ui/issues/issue-18118.rs +++ b/src/test/ui/issues/issue-18118.rs @@ -1,21 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { const z: &'static isize = { - //~^ ERROR let bindings in constants are unstable - //~| ERROR statements in constants are unstable let p = 3; - //~^ ERROR let bindings in constants are unstable - //~| ERROR statements in constants are unstable &p //~ ERROR `p` does not live long enough - //~^ ERROR let bindings in constants are unstable }; } diff --git a/src/test/ui/issues/issue-18118.stderr b/src/test/ui/issues/issue-18118.stderr index 2d83b86e5f4..9b21ece341a 100644 --- a/src/test/ui/issues/issue-18118.stderr +++ b/src/test/ui/issues/issue-18118.stderr @@ -1,67 +1,13 @@ -error[E0658]: let bindings in constants are unstable (see issue #48821) - --> $DIR/issue-18118.rs:15:17 - | -LL | let p = 3; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue-18118.rs:15:17 - | -LL | let p = 3; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constants are unstable (see issue #48821) - --> $DIR/issue-18118.rs:18:9 - | -LL | &p //~ ERROR `p` does not live long enough - | ^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constants are unstable (see issue #48821) - --> $DIR/issue-18118.rs:12:5 - | -LL | / const z: &'static isize = { -LL | | //~^ ERROR let bindings in constants are unstable -LL | | //~| ERROR statements in constants are unstable -LL | | let p = 3; -... | -LL | | //~^ ERROR let bindings in constants are unstable -LL | | }; - | |______^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue-18118.rs:12:5 - | -LL | / const z: &'static isize = { -LL | | //~^ ERROR let bindings in constants are unstable -LL | | //~| ERROR statements in constants are unstable -LL | | let p = 3; -... | -LL | | //~^ ERROR let bindings in constants are unstable -LL | | }; - | |______^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - error[E0597]: `p` does not live long enough - --> $DIR/issue-18118.rs:18:10 + --> $DIR/issue-18118.rs:4:10 | LL | &p //~ ERROR `p` does not live long enough | ^ borrowed value does not live long enough -LL | //~^ ERROR let bindings in constants are unstable LL | }; | - borrowed value only lives until here | = note: borrowed value must be valid for the static lifetime... -error: aborting due to 6 previous errors +error: aborting due to previous error -Some errors occurred: E0597, E0658. -For more information about an error, try `rustc --explain E0597`. +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/issues/issue-18119.rs b/src/test/ui/issues/issue-18119.rs index 412f7566f47..e48dc51a2c6 100644 --- a/src/test/ui/issues/issue-18119.rs +++ b/src/test/ui/issues/issue-18119.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const X: u8 = 1; static Y: u8 = 1; fn foo() {} diff --git a/src/test/ui/issues/issue-18119.stderr b/src/test/ui/issues/issue-18119.stderr index e0e2d089b7b..ddee5a9da7a 100644 --- a/src/test/ui/issues/issue-18119.stderr +++ b/src/test/ui/issues/issue-18119.stderr @@ -1,17 +1,17 @@ error[E0573]: expected type, found constant `X` - --> $DIR/issue-18119.rs:15:6 + --> $DIR/issue-18119.rs:5:6 | LL | impl X {} | ^ not a type error[E0573]: expected type, found static `Y` - --> $DIR/issue-18119.rs:17:6 + --> $DIR/issue-18119.rs:7:6 | LL | impl Y {} | ^ not a type error[E0573]: expected type, found function `foo` - --> $DIR/issue-18119.rs:19:6 + --> $DIR/issue-18119.rs:9:6 | LL | impl foo {} | ^^^ not a type diff --git a/src/test/ui/issues/issue-18159.rs b/src/test/ui/issues/issue-18159.rs index 8991eded3d6..bd347d63298 100644 --- a/src/test/ui/issues/issue-18159.rs +++ b/src/test/ui/issues/issue-18159.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x; //~ ERROR type annotations needed } diff --git a/src/test/ui/issues/issue-18159.stderr b/src/test/ui/issues/issue-18159.stderr index 084e859111b..25b7051a880 100644 --- a/src/test/ui/issues/issue-18159.stderr +++ b/src/test/ui/issues/issue-18159.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-18159.rs:12:9 + --> $DIR/issue-18159.rs:2:9 | LL | let x; //~ ERROR type annotations needed | ^ diff --git a/src/test/ui/issues/issue-18183.rs b/src/test/ui/issues/issue-18183.rs index 2cad4a3175f..64476d1c109 100644 --- a/src/test/ui/issues/issue-18183.rs +++ b/src/test/ui/issues/issue-18183.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo(Bar); //~ ERROR E0128 pub struct Baz(Foo); fn main() {} diff --git a/src/test/ui/issues/issue-18183.stderr b/src/test/ui/issues/issue-18183.stderr index 169a3019d52..cf33124bc95 100644 --- a/src/test/ui/issues/issue-18183.stderr +++ b/src/test/ui/issues/issue-18183.stderr @@ -1,5 +1,5 @@ error[E0128]: type parameters with a default cannot use forward declared identifiers - --> $DIR/issue-18183.rs:11:20 + --> $DIR/issue-18183.rs:1:20 | LL | pub struct Foo(Bar); //~ ERROR E0128 | ^^^ defaulted type parameters cannot be forward declared diff --git a/src/test/ui/issues/issue-18188.rs b/src/test/ui/issues/issue-18188.rs index b047ee4a4d6..8e39dc15597 100644 --- a/src/test/ui/issues/issue-18188.rs +++ b/src/test/ui/issues/issue-18188.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-1821.rs b/src/test/ui/issues/issue-1821.rs index 8518547ac25..0177b70a698 100644 --- a/src/test/ui/issues/issue-1821.rs +++ b/src/test/ui/issues/issue-1821.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/ui/issues/issue-18294.rs b/src/test/ui/issues/issue-18294.rs index 28dc6846f69..1c2229fb9ea 100644 --- a/src/test/ui/issues/issue-18294.rs +++ b/src/test/ui/issues/issue-18294.rs @@ -1,15 +1,5 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { const X: u32 = 1; - const Y: usize = &X as *const u32 as usize; //~ ERROR is unstable + const Y: usize = unsafe { &X as *const u32 as usize }; //~ ERROR is unstable println!("{}", Y); } diff --git a/src/test/ui/issues/issue-18294.stderr b/src/test/ui/issues/issue-18294.stderr index 0b94e778d37..f3e8ab1a313 100644 --- a/src/test/ui/issues/issue-18294.stderr +++ b/src/test/ui/issues/issue-18294.stderr @@ -1,8 +1,8 @@ error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) - --> $DIR/issue-18294.rs:13:22 + --> $DIR/issue-18294.rs:3:31 | -LL | const Y: usize = &X as *const u32 as usize; //~ ERROR is unstable - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | const Y: usize = unsafe { &X as *const u32 as usize }; //~ ERROR is unstable + | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-18389.rs b/src/test/ui/issues/issue-18389.rs index aad3d52153a..654dfb63b88 100644 --- a/src/test/ui/issues/issue-18389.rs +++ b/src/test/ui/issues/issue-18389.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::any::Any; use std::any::TypeId; diff --git a/src/test/ui/issues/issue-18389.stderr b/src/test/ui/issues/issue-18389.stderr index 6f067301d04..02ff6b6d5bf 100644 --- a/src/test/ui/issues/issue-18389.stderr +++ b/src/test/ui/issues/issue-18389.stderr @@ -1,6 +1,9 @@ error[E0445]: private trait `Private<::P, ::R>` in public interface - --> $DIR/issue-18389.rs:17:1 + --> $DIR/issue-18389.rs:7:1 | +LL | trait Private { + | - `Private<::P, ::R>` declared as private +... LL | / pub trait Public: Private< LL | | //~^ ERROR private trait `Private<::P, ::R>` in public interface LL | | ::P, diff --git a/src/test/ui/issues/issue-18400.rs b/src/test/ui/issues/issue-18400.rs index dd17189aeea..fdd11512da3 100644 --- a/src/test/ui/issues/issue-18400.rs +++ b/src/test/ui/issues/issue-18400.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Set { fn contains(&self, _: T) -> bool; fn set(&mut self, _: T); diff --git a/src/test/ui/issues/issue-18400.stderr b/src/test/ui/issues/issue-18400.stderr index 2426d429ca1..9c496cac88e 100644 --- a/src/test/ui/issues/issue-18400.stderr +++ b/src/test/ui/issues/issue-18400.stderr @@ -1,5 +1,5 @@ error[E0275]: overflow evaluating the requirement `_: std::marker::Sized` - --> $DIR/issue-18400.rs:34:7 + --> $DIR/issue-18400.rs:24:7 | LL | 0.contains(bits); | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-18423.rs b/src/test/ui/issues/issue-18423.rs index f550dc6f310..c072e6b5d22 100644 --- a/src/test/ui/issues/issue-18423.rs +++ b/src/test/ui/issues/issue-18423.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `Box` cannot be used with a lifetime argument. struct Foo<'a> { diff --git a/src/test/ui/issues/issue-18423.stderr b/src/test/ui/issues/issue-18423.stderr index 49afd513092..96652767a05 100644 --- a/src/test/ui/issues/issue-18423.stderr +++ b/src/test/ui/issues/issue-18423.stderr @@ -1,5 +1,5 @@ error[E0107]: wrong number of lifetime arguments: expected 0, found 1 - --> $DIR/issue-18423.rs:14:12 + --> $DIR/issue-18423.rs:4:12 | LL | x: Box<'a, isize> //~ ERROR wrong number of lifetime arguments | ^^ unexpected lifetime argument diff --git a/src/test/ui/issues/issue-18446-2.rs b/src/test/ui/issues/issue-18446-2.rs index 90cc9b4bc43..2f05ece3197 100644 --- a/src/test/ui/issues/issue-18446-2.rs +++ b/src/test/ui/issues/issue-18446-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Test that methods in trait impls should override default methods. diff --git a/src/test/ui/issues/issue-18446.rs b/src/test/ui/issues/issue-18446.rs index 60afea5a621..64c89df3868 100644 --- a/src/test/ui/issues/issue-18446.rs +++ b/src/test/ui/issues/issue-18446.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that name clashes between the method in an impl for the type // and the method in the trait when both are in the same scope. diff --git a/src/test/ui/issues/issue-18446.stderr b/src/test/ui/issues/issue-18446.stderr index d1914fc14f8..8aff0309aa7 100644 --- a/src/test/ui/issues/issue-18446.stderr +++ b/src/test/ui/issues/issue-18446.stderr @@ -1,16 +1,16 @@ error[E0034]: multiple applicable items in scope - --> $DIR/issue-18446.rs:28:7 + --> $DIR/issue-18446.rs:18:7 | LL | x.foo(); //~ ERROR multiple applicable items in scope [E0034] | ^^^ multiple `foo` found | note: candidate #1 is defined in an impl for the type `dyn T` - --> $DIR/issue-18446.rs:19:5 + --> $DIR/issue-18446.rs:9:5 | LL | fn foo(&self) {} | ^^^^^^^^^^^^^ note: candidate #2 is defined in the trait `T` - --> $DIR/issue-18446.rs:15:5 + --> $DIR/issue-18446.rs:5:5 | LL | fn foo(&self); | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-18532.rs b/src/test/ui/issues/issue-18532.rs index 2be5fdcac4e..31fd87961dc 100644 --- a/src/test/ui/issues/issue-18532.rs +++ b/src/test/ui/issues/issue-18532.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that overloaded call parameter checking does not ICE // when a type error or unconstrained type variable propagates // into it. diff --git a/src/test/ui/issues/issue-18532.stderr b/src/test/ui/issues/issue-18532.stderr index c297c20069e..400890348a1 100644 --- a/src/test/ui/issues/issue-18532.stderr +++ b/src/test/ui/issues/issue-18532.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `!` - --> $DIR/issue-18532.rs:16:5 + --> $DIR/issue-18532.rs:6:5 | LL | (return)((),()); //~ ERROR expected function, found `!` | ^^^^^^^^------- diff --git a/src/test/ui/issues/issue-18566.nll.stderr b/src/test/ui/issues/issue-18566.nll.stderr index c815ad9049f..8db78935f83 100644 --- a/src/test/ui/issues/issue-18566.nll.stderr +++ b/src/test/ui/issues/issue-18566.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*s` as mutable more than once at a time - --> $DIR/issue-18566.rs:33:19 + --> $DIR/issue-18566.rs:23:19 | LL | MyPtr(s).poke(s); | - ---- ^ second mutable borrow occurs here diff --git a/src/test/ui/issues/issue-18566.rs b/src/test/ui/issues/issue-18566.rs index 41e82d0cd89..9da904acf1f 100644 --- a/src/test/ui/issues/issue-18566.rs +++ b/src/test/ui/issues/issue-18566.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Deref; struct MyPtr<'a>(&'a mut usize); diff --git a/src/test/ui/issues/issue-18566.stderr b/src/test/ui/issues/issue-18566.stderr index e07fde114f2..90c3af48eb4 100644 --- a/src/test/ui/issues/issue-18566.stderr +++ b/src/test/ui/issues/issue-18566.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*s` as mutable more than once at a time - --> $DIR/issue-18566.rs:33:19 + --> $DIR/issue-18566.rs:23:19 | LL | MyPtr(s).poke(s); | - ^- first borrow ends here diff --git a/src/test/ui/issues/issue-18611.rs b/src/test/ui/issues/issue-18611.rs index a3ad76e1be0..91a765f34ef 100644 --- a/src/test/ui/issues/issue-18611.rs +++ b/src/test/ui/issues/issue-18611.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn add_state(op: ::State) { //~^ ERROR `isize: HasState` is not satisfied } diff --git a/src/test/ui/issues/issue-18611.stderr b/src/test/ui/issues/issue-18611.stderr index d890a322f0c..8fa7694dc6c 100644 --- a/src/test/ui/issues/issue-18611.stderr +++ b/src/test/ui/issues/issue-18611.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `isize: HasState` is not satisfied - --> $DIR/issue-18611.rs:11:1 + --> $DIR/issue-18611.rs:1:1 | LL | / fn add_state(op: ::State) { LL | | //~^ ERROR `isize: HasState` is not satisfied diff --git a/src/test/ui/issues/issue-1866.rs b/src/test/ui/issues/issue-1866.rs index eb670b4a582..3de547bfe6f 100644 --- a/src/test/ui/issues/issue-1866.rs +++ b/src/test/ui/issues/issue-1866.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/ui/issues/issue-1871.rs b/src/test/ui/issues/issue-1871.rs index e4d132c8641..f7a2bdd5659 100644 --- a/src/test/ui/issues/issue-1871.rs +++ b/src/test/ui/issues/issue-1871.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that we don't generate a spurious error about f.honk's type // being undeterminable fn main() { diff --git a/src/test/ui/issues/issue-1871.stderr b/src/test/ui/issues/issue-1871.stderr index 0546848df9b..10b0825c34e 100644 --- a/src/test/ui/issues/issue-1871.stderr +++ b/src/test/ui/issues/issue-1871.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `honk` found for type `{integer}` in the current scope - --> $DIR/issue-1871.rs:17:9 + --> $DIR/issue-1871.rs:7:9 | LL | f.honk() //~ ERROR no method named `honk` found | ^^^^ diff --git a/src/test/ui/issues/issue-18738.rs b/src/test/ui/issues/issue-18738.rs index defd8f97cbc..c3bd022fa44 100644 --- a/src/test/ui/issues/issue-18738.rs +++ b/src/test/ui/issues/issue-18738.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #[derive(Eq, PartialEq, PartialOrd, Ord)] diff --git a/src/test/ui/issues/issue-18783.nll.stderr b/src/test/ui/issues/issue-18783.nll.stderr index 023021eccb9..f49a2d7a2b2 100644 --- a/src/test/ui/issues/issue-18783.nll.stderr +++ b/src/test/ui/issues/issue-18783.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `y` as mutable more than once at a time - --> $DIR/issue-18783.rs:17:21 + --> $DIR/issue-18783.rs:7:21 | LL | c.push(Box::new(|| y = 0)); | -- - first borrow occurs due to use of `y` in closure @@ -14,7 +14,7 @@ LL | } | - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell>>` error[E0499]: cannot borrow `y` as mutable more than once at a time - --> $DIR/issue-18783.rs:26:29 + --> $DIR/issue-18783.rs:16:29 | LL | Push::push(&c, Box::new(|| y = 0)); | -- - first borrow occurs due to use of `y` in closure diff --git a/src/test/ui/issues/issue-18783.rs b/src/test/ui/issues/issue-18783.rs index 9a7b3781f1e..b84a1adb425 100644 --- a/src/test/ui/issues/issue-18783.rs +++ b/src/test/ui/issues/issue-18783.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cell::RefCell; fn main() { diff --git a/src/test/ui/issues/issue-18783.stderr b/src/test/ui/issues/issue-18783.stderr index 64d2809a36a..68eb5167ecb 100644 --- a/src/test/ui/issues/issue-18783.stderr +++ b/src/test/ui/issues/issue-18783.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `y` as mutable more than once at a time - --> $DIR/issue-18783.rs:17:21 + --> $DIR/issue-18783.rs:7:21 | LL | c.push(Box::new(|| y = 0)); | -- - previous borrow occurs due to use of `y` in closure @@ -14,7 +14,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `y` as mutable more than once at a time - --> $DIR/issue-18783.rs:26:29 + --> $DIR/issue-18783.rs:16:29 | LL | Push::push(&c, Box::new(|| y = 0)); | -- - previous borrow occurs due to use of `y` in closure diff --git a/src/test/ui/issues/issue-18809.rs b/src/test/ui/issues/issue-18809.rs index f4ce51b677a..fb31666b22e 100644 --- a/src/test/ui/issues/issue-18809.rs +++ b/src/test/ui/issues/issue-18809.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass trait Tup { type T0; diff --git a/src/test/ui/issues/issue-18819.rs b/src/test/ui/issues/issue-18819.rs index c6f60f1cbba..80db056e7dd 100644 --- a/src/test/ui/issues/issue-18819.rs +++ b/src/test/ui/issues/issue-18819.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { type Item; } diff --git a/src/test/ui/issues/issue-18819.stderr b/src/test/ui/issues/issue-18819.stderr index 86926863598..eb7e4ad405f 100644 --- a/src/test/ui/issues/issue-18819.stderr +++ b/src/test/ui/issues/issue-18819.stderr @@ -1,5 +1,5 @@ error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/issue-18819.rs:26:5 + --> $DIR/issue-18819.rs:16:5 | LL | fn print_x(_: &Foo, extra: &str) { | ------------------------------------------- defined here diff --git a/src/test/ui/issues/issue-18906.rs b/src/test/ui/issues/issue-18906.rs index 15701a2a45a..0b9625b1868 100644 --- a/src/test/ui/issues/issue-18906.rs +++ b/src/test/ui/issues/issue-18906.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-18919.rs b/src/test/ui/issues/issue-18919.rs index cc87a0977a0..9db30849182 100644 --- a/src/test/ui/issues/issue-18919.rs +++ b/src/test/ui/issues/issue-18919.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type FuncType<'f> = Fn(&isize) -> isize + 'f; fn ho_func(f: Option) { diff --git a/src/test/ui/issues/issue-18919.stderr b/src/test/ui/issues/issue-18919.stderr index 0e71b0bbedd..ca717a3c49b 100644 --- a/src/test/ui/issues/issue-18919.stderr +++ b/src/test/ui/issues/issue-18919.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `dyn for<'r> std::ops::Fn(&'r isize) -> isize` cannot be known at compilation time - --> $DIR/issue-18919.rs:13:1 + --> $DIR/issue-18919.rs:3:1 | LL | / fn ho_func(f: Option) { LL | | //~^ ERROR the size for values of type @@ -7,7 +7,7 @@ LL | | } | |_^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn for<'r> std::ops::Fn(&'r isize) -> isize` - = note: to learn more, visit + = note: to learn more, visit = note: required by `std::option::Option` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18937.rs b/src/test/ui/issues/issue-18937.rs index f7f84e6452d..f3824765f23 100644 --- a/src/test/ui/issues/issue-18937.rs +++ b/src/test/ui/issues/issue-18937.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #18937. use std::fmt; diff --git a/src/test/ui/issues/issue-18937.stderr b/src/test/ui/issues/issue-18937.stderr index 7b4c35e0dbe..91182224ad0 100644 --- a/src/test/ui/issues/issue-18937.stderr +++ b/src/test/ui/issues/issue-18937.stderr @@ -1,5 +1,5 @@ error[E0276]: impl has stricter requirements than trait - --> $DIR/issue-18937.rs:29:5 + --> $DIR/issue-18937.rs:19:5 | LL | / fn foo(&mut self, f: F) LL | | where F: fmt::Debug + 'a, diff --git a/src/test/ui/issues/issue-18959.rs b/src/test/ui/issues/issue-18959.rs index 7a6d012a3b6..b07800928bc 100644 --- a/src/test/ui/issues/issue-18959.rs +++ b/src/test/ui/issues/issue-18959.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo { fn foo(&self, ext_thing: &T); } pub trait Bar: Foo { } impl Bar for T { } diff --git a/src/test/ui/issues/issue-18959.stderr b/src/test/ui/issues/issue-18959.stderr index 42a1c2d4d03..939390102c3 100644 --- a/src/test/ui/issues/issue-18959.stderr +++ b/src/test/ui/issues/issue-18959.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/issue-18959.rs:21:1 + --> $DIR/issue-18959.rs:11:1 | LL | fn foo(b: &Bar) { | ^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object diff --git a/src/test/ui/issues/issue-18988.rs b/src/test/ui/issues/issue-18988.rs index 6aadef69138..e0393486649 100644 --- a/src/test/ui/issues/issue-18988.rs +++ b/src/test/ui/issues/issue-18988.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] pub trait Foo : Send { } diff --git a/src/test/ui/issues/issue-1900.rs b/src/test/ui/issues/issue-1900.rs index e41bb0030ae..761bd317027 100644 --- a/src/test/ui/issues/issue-1900.rs +++ b/src/test/ui/issues/issue-1900.rs @@ -1,12 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { } //~^ ERROR `main` function is not allowed to have generic parameters diff --git a/src/test/ui/issues/issue-1900.stderr b/src/test/ui/issues/issue-1900.stderr index 512a923fadd..ce413662f0d 100644 --- a/src/test/ui/issues/issue-1900.stderr +++ b/src/test/ui/issues/issue-1900.stderr @@ -1,5 +1,5 @@ error[E0131]: `main` function is not allowed to have generic parameters - --> $DIR/issue-1900.rs:11:8 + --> $DIR/issue-1900.rs:1:8 | LL | fn main() { } | ^^^ `main` cannot have generic parameters diff --git a/src/test/ui/issues/issue-19037.rs b/src/test/ui/issues/issue-19037.rs index 59b7d40ae0d..4efc0719ffb 100644 --- a/src/test/ui/issues/issue-19037.rs +++ b/src/test/ui/issues/issue-19037.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-19081.rs b/src/test/ui/issues/issue-19081.rs index 4188670f8f6..b487cdd5c75 100644 --- a/src/test/ui/issues/issue-19081.rs +++ b/src/test/ui/issues/issue-19081.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub trait Hasher { type State; diff --git a/src/test/ui/issues/issue-19086.rs b/src/test/ui/issues/issue-19086.rs index ba571ce17fd..9802814a87a 100644 --- a/src/test/ui/issues/issue-19086.rs +++ b/src/test/ui/issues/issue-19086.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use Foo::FooB; enum Foo { diff --git a/src/test/ui/issues/issue-19086.stderr b/src/test/ui/issues/issue-19086.stderr index b71d40065c3..d2b9b90890e 100644 --- a/src/test/ui/issues/issue-19086.stderr +++ b/src/test/ui/issues/issue-19086.stderr @@ -1,5 +1,5 @@ error[E0532]: expected tuple struct/variant, found struct variant `FooB` - --> $DIR/issue-19086.rs:20:9 + --> $DIR/issue-19086.rs:10:9 | LL | FooB(a, b) => println!("{} {}", a, b), | ^^^^ did you mean `FooB { /* fields */ }`? diff --git a/src/test/ui/issues/issue-19097.rs b/src/test/ui/issues/issue-19097.rs index 8198a40b0c1..8055e106251 100644 --- a/src/test/ui/issues/issue-19097.rs +++ b/src/test/ui/issues/issue-19097.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // regression test for #19097 diff --git a/src/test/ui/issues/issue-19098.rs b/src/test/ui/issues/issue-19098.rs index c985f7aad14..690fe944097 100644 --- a/src/test/ui/issues/issue-19098.rs +++ b/src/test/ui/issues/issue-19098.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub trait Handler { fn handle(&self, _: &mut String); diff --git a/src/test/ui/issues/issue-19100.fixed b/src/test/ui/issues/issue-19100.fixed index 3ced913ae11..6dc8f7ddbc9 100644 --- a/src/test/ui/issues/issue-19100.fixed +++ b/src/test/ui/issues/issue-19100.fixed @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // run-rustfix diff --git a/src/test/ui/issues/issue-19100.rs b/src/test/ui/issues/issue-19100.rs index e073bf90761..cfdc7c9e754 100644 --- a/src/test/ui/issues/issue-19100.rs +++ b/src/test/ui/issues/issue-19100.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // run-rustfix diff --git a/src/test/ui/issues/issue-19100.stderr b/src/test/ui/issues/issue-19100.stderr index 34dc29c63df..1ab13477e37 100644 --- a/src/test/ui/issues/issue-19100.stderr +++ b/src/test/ui/issues/issue-19100.stderr @@ -1,11 +1,11 @@ warning[E0170]: pattern binding `Bar` is named the same as one of the variants of the type `Foo` - --> $DIR/issue-19100.rs:28:1 + --> $DIR/issue-19100.rs:18:1 | LL | Bar if true | ^^^ help: to match on the variant, qualify the path: `Foo::Bar` warning[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo` - --> $DIR/issue-19100.rs:32:1 + --> $DIR/issue-19100.rs:22:1 | LL | Baz if false | ^^^ help: to match on the variant, qualify the path: `Foo::Baz` diff --git a/src/test/ui/issues/issue-19102.rs b/src/test/ui/issues/issue-19102.rs index 48b5fece1df..962cd8d3f6f 100644 --- a/src/test/ui/issues/issue-19102.rs +++ b/src/test/ui/issues/issue-19102.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_imports)] #![deny(unused_qualifications)] diff --git a/src/test/ui/issues/issue-19129-1.rs b/src/test/ui/issues/issue-19129-1.rs index 97bd20be7d7..4be2cc6d179 100644 --- a/src/test/ui/issues/issue-19129-1.rs +++ b/src/test/ui/issues/issue-19129-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-19129-2.rs b/src/test/ui/issues/issue-19129-2.rs index 9b1bc2b8ec4..d11ef8af709 100644 --- a/src/test/ui/issues/issue-19129-2.rs +++ b/src/test/ui/issues/issue-19129-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_variables)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-19163.nll.stderr b/src/test/ui/issues/issue-19163.nll.stderr index 32059bf0af1..af509aa59d4 100644 --- a/src/test/ui/issues/issue-19163.nll.stderr +++ b/src/test/ui/issues/issue-19163.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/issue-19163.rs:19:14 + --> $DIR/issue-19163.rs:9:14 | LL | mywrite!(&v, "Hello world"); | ^^ cannot borrow as mutable diff --git a/src/test/ui/issues/issue-19163.rs b/src/test/ui/issues/issue-19163.rs index cd6f7c4fd8f..20d3244027d 100644 --- a/src/test/ui/issues/issue-19163.rs +++ b/src/test/ui/issues/issue-19163.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-19163.rs #[macro_use] extern crate issue_19163; diff --git a/src/test/ui/issues/issue-19163.stderr b/src/test/ui/issues/issue-19163.stderr index f7e65e18326..242ceaedcb0 100644 --- a/src/test/ui/issues/issue-19163.stderr +++ b/src/test/ui/issues/issue-19163.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable borrowed content as mutable - --> $DIR/issue-19163.rs:19:14 + --> $DIR/issue-19163.rs:9:14 | LL | mywrite!(&v, "Hello world"); | ^^ cannot borrow as mutable diff --git a/src/test/ui/issues/issue-1920-1.rs b/src/test/ui/issues/issue-1920-1.rs index 7ba65580582..996052d7495 100644 --- a/src/test/ui/issues/issue-1920-1.rs +++ b/src/test/ui/issues/issue-1920-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Test that absolute path names are correct when a crate is not linked into the root namespace // aux-build:issue-1920.rs diff --git a/src/test/ui/issues/issue-1920-1.stderr b/src/test/ui/issues/issue-1920-1.stderr index bd823ad6fb6..b3ac05031b0 100644 --- a/src/test/ui/issues/issue-1920-1.stderr +++ b/src/test/ui/issues/issue-1920-1.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `foo::issue_1920::S: std::clone::Clone` is not satisfied - --> $DIR/issue-1920-1.rs:22:5 + --> $DIR/issue-1920-1.rs:12:5 | LL | assert_clone::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `foo::issue_1920::S` | note: required by `assert_clone` - --> $DIR/issue-1920-1.rs:19:1 + --> $DIR/issue-1920-1.rs:9:1 | LL | fn assert_clone() where T : Clone { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-1920-2.rs b/src/test/ui/issues/issue-1920-2.rs index bf4817aaf34..56d842ec4a0 100644 --- a/src/test/ui/issues/issue-1920-2.rs +++ b/src/test/ui/issues/issue-1920-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Test that when a crate is linked under another name that name is used in global paths // aux-build:issue-1920.rs diff --git a/src/test/ui/issues/issue-1920-2.stderr b/src/test/ui/issues/issue-1920-2.stderr index cf98a893a18..a000a87302b 100644 --- a/src/test/ui/issues/issue-1920-2.stderr +++ b/src/test/ui/issues/issue-1920-2.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `bar::S: std::clone::Clone` is not satisfied - --> $DIR/issue-1920-2.rs:20:5 + --> $DIR/issue-1920-2.rs:10:5 | LL | assert_clone::(); | ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `bar::S` | note: required by `assert_clone` - --> $DIR/issue-1920-2.rs:17:1 + --> $DIR/issue-1920-2.rs:7:1 | LL | fn assert_clone() where T : Clone { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-1920-3.rs b/src/test/ui/issues/issue-1920-3.rs index a70e958630f..83f3fdb9eb3 100644 --- a/src/test/ui/issues/issue-1920-3.rs +++ b/src/test/ui/issues/issue-1920-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Test that when a crate is linked multiple times that the shortest absolute path name is used // aux-build:issue-1920.rs diff --git a/src/test/ui/issues/issue-1920-3.stderr b/src/test/ui/issues/issue-1920-3.stderr index 6f5efd0dc4e..62e47a6866e 100644 --- a/src/test/ui/issues/issue-1920-3.stderr +++ b/src/test/ui/issues/issue-1920-3.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `issue_1920::S: std::clone::Clone` is not satisfied - --> $DIR/issue-1920-3.rs:24:5 + --> $DIR/issue-1920-3.rs:14:5 | LL | assert_clone::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `issue_1920::S` | note: required by `assert_clone` - --> $DIR/issue-1920-3.rs:21:1 + --> $DIR/issue-1920-3.rs:11:1 | LL | fn assert_clone() where T : Clone { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-19244-1.rs b/src/test/ui/issues/issue-19244-1.rs index df34aab4b8f..77fab7cfa32 100644 --- a/src/test/ui/issues/issue-19244-1.rs +++ b/src/test/ui/issues/issue-19244-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const TUP: (usize,) = (42,); fn main() { diff --git a/src/test/ui/issues/issue-19244-1.stderr b/src/test/ui/issues/issue-19244-1.stderr index 28e66b2d974..1eb530542c0 100644 --- a/src/test/ui/issues/issue-19244-1.stderr +++ b/src/test/ui/issues/issue-19244-1.stderr @@ -1,5 +1,5 @@ error[E0609]: no field `1` on type `(usize,)` - --> $DIR/issue-19244-1.rs:14:24 + --> $DIR/issue-19244-1.rs:4:24 | LL | let a: [isize; TUP.1]; | ^ diff --git a/src/test/ui/issues/issue-19244-2.rs b/src/test/ui/issues/issue-19244-2.rs index 864f8f6b54e..c9a68b05c5b 100644 --- a/src/test/ui/issues/issue-19244-2.rs +++ b/src/test/ui/issues/issue-19244-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct MyStruct { field: usize } const STRUCT: MyStruct = MyStruct { field: 42 }; diff --git a/src/test/ui/issues/issue-19244-2.stderr b/src/test/ui/issues/issue-19244-2.stderr index 3969c77f24d..54529fdf5ba 100644 --- a/src/test/ui/issues/issue-19244-2.stderr +++ b/src/test/ui/issues/issue-19244-2.stderr @@ -1,5 +1,5 @@ error[E0609]: no field `nonexistent_field` on type `MyStruct` - --> $DIR/issue-19244-2.rs:15:27 + --> $DIR/issue-19244-2.rs:5:27 | LL | let a: [isize; STRUCT.nonexistent_field]; | ^^^^^^^^^^^^^^^^^ unknown field diff --git a/src/test/ui/issues/issue-19380.rs b/src/test/ui/issues/issue-19380.rs index 322952ffef1..efbc5a0346a 100644 --- a/src/test/ui/issues/issue-19380.rs +++ b/src/test/ui/issues/issue-19380.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Qiz { fn qiz(); } diff --git a/src/test/ui/issues/issue-19380.stderr b/src/test/ui/issues/issue-19380.stderr index a251d3b2990..060e160f2e4 100644 --- a/src/test/ui/issues/issue-19380.stderr +++ b/src/test/ui/issues/issue-19380.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Qiz` cannot be made into an object - --> $DIR/issue-19380.rs:21:3 + --> $DIR/issue-19380.rs:11:3 | LL | foos: &'static [&'static (Qiz + 'static)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qiz` cannot be made into an object diff --git a/src/test/ui/issues/issue-19398.rs b/src/test/ui/issues/issue-19398.rs index c8a7292b243..5daa14b7cb7 100644 --- a/src/test/ui/issues/issue-19398.rs +++ b/src/test/ui/issues/issue-19398.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-19404.rs b/src/test/ui/issues/issue-19404.rs index f74b2eb1065..cdec74fe968 100644 --- a/src/test/ui/issues/issue-19404.rs +++ b/src/test/ui/issues/issue-19404.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/issues/issue-19479.rs b/src/test/ui/issues/issue-19479.rs index fae040a092f..8b78952a6e2 100644 --- a/src/test/ui/issues/issue-19479.rs +++ b/src/test/ui/issues/issue-19479.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-19482.rs b/src/test/ui/issues/issue-19482.rs index b54f008f8ce..6ba33490549 100644 --- a/src/test/ui/issues/issue-19482.rs +++ b/src/test/ui/issues/issue-19482.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a partially specified trait object with unspecified associated // type does not type-check. diff --git a/src/test/ui/issues/issue-19482.stderr b/src/test/ui/issues/issue-19482.stderr index 5e2d427ab72..a8894f84e74 100644 --- a/src/test/ui/issues/issue-19482.stderr +++ b/src/test/ui/issues/issue-19482.stderr @@ -1,8 +1,11 @@ error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified - --> $DIR/issue-19482.rs:20:12 + --> $DIR/issue-19482.rs:10:12 | +LL | type A; + | ------- `A` defined here +... LL | fn bar(x: &Foo) {} - | ^^^ missing associated type `A` value + | ^^^ associated type `A` must be specified error: aborting due to previous error diff --git a/src/test/ui/issues/issue-19498.rs b/src/test/ui/issues/issue-19498.rs index 30eea2efd15..5fe6742f55e 100644 --- a/src/test/ui/issues/issue-19498.rs +++ b/src/test/ui/issues/issue-19498.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use self::A; use self::B; mod A {} //~ ERROR the name `A` is defined multiple times diff --git a/src/test/ui/issues/issue-19498.stderr b/src/test/ui/issues/issue-19498.stderr index e4cefe9d7a4..fd5e48bde16 100644 --- a/src/test/ui/issues/issue-19498.stderr +++ b/src/test/ui/issues/issue-19498.stderr @@ -1,5 +1,5 @@ error[E0255]: the name `A` is defined multiple times - --> $DIR/issue-19498.rs:13:1 + --> $DIR/issue-19498.rs:3:1 | LL | use self::A; | ------- previous import of the module `A` here @@ -14,7 +14,7 @@ LL | use self::A as OtherA; | ^^^^^^^^^^^^^^^^^ error[E0255]: the name `B` is defined multiple times - --> $DIR/issue-19498.rs:15:1 + --> $DIR/issue-19498.rs:5:1 | LL | use self::B; | ------- previous import of the module `B` here @@ -29,7 +29,7 @@ LL | use self::B as OtherB; | ^^^^^^^^^^^^^^^^^ error[E0255]: the name `D` is defined multiple times - --> $DIR/issue-19498.rs:19:5 + --> $DIR/issue-19498.rs:9:5 | LL | use C::D; | ---- previous import of the module `D` here diff --git a/src/test/ui/issues/issue-19521.rs b/src/test/ui/issues/issue-19521.rs index 93d95ca0b0f..a2a32a21a22 100644 --- a/src/test/ui/issues/issue-19521.rs +++ b/src/test/ui/issues/issue-19521.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { "".homura()(); //~ ERROR no method named `homura` found } diff --git a/src/test/ui/issues/issue-19521.stderr b/src/test/ui/issues/issue-19521.stderr index 8f81bcbd4c4..9005317736a 100644 --- a/src/test/ui/issues/issue-19521.stderr +++ b/src/test/ui/issues/issue-19521.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `homura` found for type `&'static str` in the current scope - --> $DIR/issue-19521.rs:12:8 + --> $DIR/issue-19521.rs:2:8 | LL | "".homura()(); //~ ERROR no method named `homura` found | ^^^^^^ diff --git a/src/test/ui/issues/issue-19538.rs b/src/test/ui/issues/issue-19538.rs index a6190500582..9f0b08d6c35 100644 --- a/src/test/ui/issues/issue-19538.rs +++ b/src/test/ui/issues/issue-19538.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(&self, val: T); } diff --git a/src/test/ui/issues/issue-19538.stderr b/src/test/ui/issues/issue-19538.stderr index 3cd73ad9d45..d0f05a41d4d 100644 --- a/src/test/ui/issues/issue-19538.stderr +++ b/src/test/ui/issues/issue-19538.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/issue-19538.rs:27:15 + --> $DIR/issue-19538.rs:17:15 | LL | let test: &mut Bar = &mut thing; | ^^^^^^^^ the trait `Bar` cannot be made into an object @@ -7,7 +7,7 @@ LL | let test: &mut Bar = &mut thing; = note: method `foo` has generic type parameters error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/issue-19538.rs:27:26 + --> $DIR/issue-19538.rs:17:26 | LL | let test: &mut Bar = &mut thing; | ^^^^^^^^^^ the trait `Bar` cannot be made into an object diff --git a/src/test/ui/issues/issue-19601.rs b/src/test/ui/issues/issue-19601.rs index d76ded9e679..faaa2db370e 100644 --- a/src/test/ui/issues/issue-19601.rs +++ b/src/test/ui/issues/issue-19601.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(warnings)] diff --git a/src/test/ui/issues/issue-1962.rs b/src/test/ui/issues/issue-1962.rs index 9de3040bb61..e9ab3b5f99b 100644 --- a/src/test/ui/issues/issue-1962.rs +++ b/src/test/ui/issues/issue-1962.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -D while-true fn main() { let mut i = 0; diff --git a/src/test/ui/issues/issue-1962.stderr b/src/test/ui/issues/issue-1962.stderr index b7c2bd84481..f2c540b7451 100644 --- a/src/test/ui/issues/issue-1962.stderr +++ b/src/test/ui/issues/issue-1962.stderr @@ -1,5 +1,5 @@ error: denote infinite loops with `loop { ... }` - --> $DIR/issue-1962.rs:14:3 + --> $DIR/issue-1962.rs:4:3 | LL | while true { //~ ERROR denote infinite loops with `loop | ^^^^^^^^^^ help: use `loop` diff --git a/src/test/ui/issues/issue-19631.rs b/src/test/ui/issues/issue-19631.rs index c46cb2c87df..8c58331e581 100644 --- a/src/test/ui/issues/issue-19631.rs +++ b/src/test/ui/issues/issue-19631.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-19632.rs b/src/test/ui/issues/issue-19632.rs index c641aee2940..b032b67c1eb 100644 --- a/src/test/ui/issues/issue-19632.rs +++ b/src/test/ui/issues/issue-19632.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-19660.rs b/src/test/ui/issues/issue-19660.rs index c4b871a28c5..400ac310b96 100644 --- a/src/test/ui/issues/issue-19660.rs +++ b/src/test/ui/issues/issue-19660.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: requires `copy` lang_item #![feature(lang_items, start, no_core)] diff --git a/src/test/ui/issues/issue-19692.rs b/src/test/ui/issues/issue-19692.rs index ca1715445e5..99eccc8a817 100644 --- a/src/test/ui/issues/issue-19692.rs +++ b/src/test/ui/issues/issue-19692.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Homura; fn akemi(homura: Homura) { diff --git a/src/test/ui/issues/issue-19692.stderr b/src/test/ui/issues/issue-19692.stderr index 33361ff8488..1ed19676674 100644 --- a/src/test/ui/issues/issue-19692.stderr +++ b/src/test/ui/issues/issue-19692.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `kaname` found for type `Homura` in the current scope - --> $DIR/issue-19692.rs:14:40 + --> $DIR/issue-19692.rs:4:40 | LL | struct Homura; | -------------- method `kaname` not found for this diff --git a/src/test/ui/issues/issue-19707.rs b/src/test/ui/issues/issue-19707.rs index 377aef2f7d7..6bc7132af3c 100644 --- a/src/test/ui/issues/issue-19707.rs +++ b/src/test/ui/issues/issue-19707.rs @@ -1,16 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] -type foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier +type Foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier fn bar &u8>(f: &F) {} //~ ERROR missing lifetime specifier diff --git a/src/test/ui/issues/issue-19707.stderr b/src/test/ui/issues/issue-19707.stderr index 56088d38aaf..7ba683a6891 100644 --- a/src/test/ui/issues/issue-19707.stderr +++ b/src/test/ui/issues/issue-19707.stderr @@ -1,13 +1,13 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-19707.rs:13:28 + --> $DIR/issue-19707.rs:3:28 | -LL | type foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier +LL | type Foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 error[E0106]: missing lifetime specifier - --> $DIR/issue-19707.rs:15:27 + --> $DIR/issue-19707.rs:5:27 | LL | fn bar &u8>(f: &F) {} //~ ERROR missing lifetime specifier | ^ expected lifetime parameter diff --git a/src/test/ui/issues/issue-19734.rs b/src/test/ui/issues/issue-19734.rs index a3820d20aac..b730e19a1e6 100644 --- a/src/test/ui/issues/issue-19734.rs +++ b/src/test/ui/issues/issue-19734.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} struct Type; diff --git a/src/test/ui/issues/issue-19734.stderr b/src/test/ui/issues/issue-19734.stderr index 1d07f4dedc3..fc1a7d0381b 100644 --- a/src/test/ui/issues/issue-19734.stderr +++ b/src/test/ui/issues/issue-19734.stderr @@ -1,5 +1,5 @@ error: cannot find macro `undef!` in this scope - --> $DIR/issue-19734.rs:16:5 + --> $DIR/issue-19734.rs:6:5 | LL | undef!(); | ^^^^^ diff --git a/src/test/ui/issues/issue-19850.rs b/src/test/ui/issues/issue-19850.rs index 179135baf25..fb64ef89405 100644 --- a/src/test/ui/issues/issue-19850.rs +++ b/src/test/ui/issues/issue-19850.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_variables)] // Test that `::Output` and `Self::Output` are accepted as type annotations in let diff --git a/src/test/ui/issues/issue-19883.rs b/src/test/ui/issues/issue-19883.rs index 9b6a87702a9..5cf422043a5 100644 --- a/src/test/ui/issues/issue-19883.rs +++ b/src/test/ui/issues/issue-19883.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait From { type Output; diff --git a/src/test/ui/issues/issue-19883.stderr b/src/test/ui/issues/issue-19883.stderr index b4262b4cdb3..e370b2ec1cb 100644 --- a/src/test/ui/issues/issue-19883.stderr +++ b/src/test/ui/issues/issue-19883.stderr @@ -1,5 +1,5 @@ error[E0576]: cannot find associated type `Dst` in trait `From` - --> $DIR/issue-19883.rs:19:30 + --> $DIR/issue-19883.rs:9:30 | LL | >::Dst | ^^^ not found in `From` diff --git a/src/test/ui/issues/issue-19922.rs b/src/test/ui/issues/issue-19922.rs index a8350fe0986..fede86f22af 100644 --- a/src/test/ui/issues/issue-19922.rs +++ b/src/test/ui/issues/issue-19922.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Homura { Akemi { madoka: () } } diff --git a/src/test/ui/issues/issue-19922.stderr b/src/test/ui/issues/issue-19922.stderr index a5bc579e192..826b2ac049b 100644 --- a/src/test/ui/issues/issue-19922.stderr +++ b/src/test/ui/issues/issue-19922.stderr @@ -1,5 +1,5 @@ error[E0559]: variant `Homura::Akemi` has no field named `kaname` - --> $DIR/issue-19922.rs:16:34 + --> $DIR/issue-19922.rs:6:34 | LL | let homura = Homura::Akemi { kaname: () }; | ^^^^^^ `Homura::Akemi` does not have this field diff --git a/src/test/ui/issues/issue-19982.rs b/src/test/ui/issues/issue-19982.rs index 3de817c28a8..6b5a4b2c10e 100644 --- a/src/test/ui/issues/issue-19982.rs +++ b/src/test/ui/issues/issue-19982.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(fn_traits, unboxed_closures)] diff --git a/src/test/ui/issues/issue-19991.rs b/src/test/ui/issues/issue-19991.rs index e07dfaf9fe5..e9094ecc015 100644 --- a/src/test/ui/issues/issue-19991.rs +++ b/src/test/ui/issues/issue-19991.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test if the sugared if-let construct correctly prints "missing an else clause" when an else // clause does not exist, instead of the unsympathetic "match arms have incompatible types" @@ -15,7 +5,7 @@ fn main() { if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause //~| expected type `()` //~| found type `{integer}` - //~| expected (), found integral variable + //~| expected (), found integer 765 }; } diff --git a/src/test/ui/issues/issue-19991.stderr b/src/test/ui/issues/issue-19991.stderr index 45b2ef8b280..ee5d363c4bd 100644 --- a/src/test/ui/issues/issue-19991.stderr +++ b/src/test/ui/issues/issue-19991.stderr @@ -1,13 +1,13 @@ error[E0317]: if may be missing an else clause - --> $DIR/issue-19991.rs:15:5 + --> $DIR/issue-19991.rs:5:5 | LL | / if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause LL | | //~| expected type `()` LL | | //~| found type `{integer}` -LL | | //~| expected (), found integral variable +LL | | //~| expected (), found integer LL | | 765 LL | | }; - | |_____^ expected (), found integral variable + | |_____^ expected (), found integer | = note: expected type `()` found type `{integer}` diff --git a/src/test/ui/issues/issue-20005.rs b/src/test/ui/issues/issue-20005.rs index 8db09182fa3..6d63c9e5b61 100644 --- a/src/test/ui/issues/issue-20005.rs +++ b/src/test/ui/issues/issue-20005.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait From { type Result; diff --git a/src/test/ui/issues/issue-20005.stderr b/src/test/ui/issues/issue-20005.stderr index b0b38c97462..672d78f65e9 100644 --- a/src/test/ui/issues/issue-20005.stderr +++ b/src/test/ui/issues/issue-20005.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/issue-20005.rs:18:5 + --> $DIR/issue-20005.rs:8:5 | LL | / fn to( //~ ERROR the size for values of type LL | | self @@ -9,10 +9,10 @@ LL | | } | |_____^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Self` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where Self: std::marker::Sized` bound note: required by `From` - --> $DIR/issue-20005.rs:11:1 + --> $DIR/issue-20005.rs:1:1 | LL | trait From { | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-20009.rs b/src/test/ui/issues/issue-20009.rs index a08bd49f599..6228d044ad1 100644 --- a/src/test/ui/issues/issue-20009.rs +++ b/src/test/ui/issues/issue-20009.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // Check that associated types are `Sized` diff --git a/src/test/ui/issues/issue-20091.rs b/src/test/ui/issues/issue-20091.rs index cd90e828889..4d86a17b6f1 100644 --- a/src/test/ui/issues/issue-20091.rs +++ b/src/test/ui/issues/issue-20091.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(stable_features)] diff --git a/src/test/ui/issues/issue-20162.rs b/src/test/ui/issues/issue-20162.rs index b2f3a2da516..b7f9caee894 100644 --- a/src/test/ui/issues/issue-20162.rs +++ b/src/test/ui/issues/issue-20162.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct X { x: i32 } fn main() { diff --git a/src/test/ui/issues/issue-20162.stderr b/src/test/ui/issues/issue-20162.stderr index 0fb7009d574..1d0d6d5c5d7 100644 --- a/src/test/ui/issues/issue-20162.stderr +++ b/src/test/ui/issues/issue-20162.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `X: std::cmp::Ord` is not satisfied - --> $DIR/issue-20162.rs:15:7 + --> $DIR/issue-20162.rs:5:7 | LL | b.sort(); | ^^^^ the trait `std::cmp::Ord` is not implemented for `X` diff --git a/src/test/ui/issues/issue-20186.rs b/src/test/ui/issues/issue-20186.rs index fddb1391017..98d856e172a 100644 --- a/src/test/ui/issues/issue-20186.rs +++ b/src/test/ui/issues/issue-20186.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/issues/issue-20225.rs b/src/test/ui/issues/issue-20225.rs index da98f21e461..b15f2a631fd 100644 --- a/src/test/ui/issues/issue-20225.rs +++ b/src/test/ui/issues/issue-20225.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(fn_traits, unboxed_closures)] struct Foo; diff --git a/src/test/ui/issues/issue-20225.stderr b/src/test/ui/issues/issue-20225.stderr index 7813dc5c11d..5ab23cb55bc 100644 --- a/src/test/ui/issues/issue-20225.stderr +++ b/src/test/ui/issues/issue-20225.stderr @@ -1,5 +1,5 @@ error[E0053]: method `call` has an incompatible type for trait - --> $DIR/issue-20225.rs:16:3 + --> $DIR/issue-20225.rs:6:3 | LL | extern "rust-call" fn call(&self, (_,): (T,)) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter @@ -8,7 +8,7 @@ LL | extern "rust-call" fn call(&self, (_,): (T,)) {} found type `extern "rust-call" fn(&Foo, (T,))` error[E0053]: method `call_mut` has an incompatible type for trait - --> $DIR/issue-20225.rs:22:3 + --> $DIR/issue-20225.rs:12:3 | LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter @@ -17,7 +17,7 @@ LL | extern "rust-call" fn call_mut(&mut self, (_,): (T,)) {} found type `extern "rust-call" fn(&mut Foo, (T,))` error[E0053]: method `call_once` has an incompatible type for trait - --> $DIR/issue-20225.rs:30:3 + --> $DIR/issue-20225.rs:20:3 | LL | extern "rust-call" fn call_once(self, (_,): (T,)) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found type parameter diff --git a/src/test/ui/issues/issue-20261.rs b/src/test/ui/issues/issue-20261.rs index bb4dbdcd0cb..528393606f3 100644 --- a/src/test/ui/issues/issue-20261.rs +++ b/src/test/ui/issues/issue-20261.rs @@ -1,15 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { - // NB: this (almost) typechecks when default binding modes are enabled. + // N.B., this (almost) typechecks when default binding modes are enabled. for (ref i,) in [].iter() { i.clone(); //~^ ERROR type annotations needed diff --git a/src/test/ui/issues/issue-20261.stderr b/src/test/ui/issues/issue-20261.stderr index 6cdddcff929..5665f5893f4 100644 --- a/src/test/ui/issues/issue-20261.stderr +++ b/src/test/ui/issues/issue-20261.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-20261.rs:14:11 + --> $DIR/issue-20261.rs:4:11 | LL | for (ref i,) in [].iter() { | --------- the element type for this iterator is not specified diff --git a/src/test/ui/issues/issue-20313.rs b/src/test/ui/issues/issue-20313.rs index dfb23c05036..4149ab4a302 100644 --- a/src/test/ui/issues/issue-20313.rs +++ b/src/test/ui/issues/issue-20313.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { #[link_name = "llvm.sqrt.f32"] fn sqrt(x: f32) -> f32; //~ ERROR linking to LLVM intrinsics is experimental diff --git a/src/test/ui/issues/issue-20313.stderr b/src/test/ui/issues/issue-20313.stderr index 95afda1b514..01673630cf1 100644 --- a/src/test/ui/issues/issue-20313.stderr +++ b/src/test/ui/issues/issue-20313.stderr @@ -1,5 +1,5 @@ error[E0658]: linking to LLVM intrinsics is experimental (see issue #29602) - --> $DIR/issue-20313.rs:13:5 + --> $DIR/issue-20313.rs:3:5 | LL | fn sqrt(x: f32) -> f32; //~ ERROR linking to LLVM intrinsics is experimental | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-20396.rs b/src/test/ui/issues/issue-20396.rs index 13e0347cb08..b6dfffbd69e 100644 --- a/src/test/ui/issues/issue-20396.rs +++ b/src/test/ui/issues/issue-20396.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-20413.rs b/src/test/ui/issues/issue-20413.rs index a48c03aa178..34094fe6a44 100644 --- a/src/test/ui/issues/issue-20413.rs +++ b/src/test/ui/issues/issue-20413.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn answer(self); } diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index bfb2665e867..1c353fec8aa 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -1,13 +1,13 @@ error[E0392]: parameter `T` is never used - --> $DIR/issue-20413.rs:15:15 + --> $DIR/issue-20413.rs:5:15 | LL | struct NoData; | ^ unused type parameter | = help: consider removing `T` or using a marker such as `std::marker::PhantomData` -error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: std::marker::Sized` - --> $DIR/issue-20413.rs:18:1 +error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` + --> $DIR/issue-20413.rs:8:1 | LL | / impl Foo for T where NoData: Foo { LL | | //~^ ERROR: overflow evaluating the requirement @@ -18,7 +18,6 @@ LL | | } | |_^ | = help: consider adding a `#![recursion_limit="128"]` attribute to your crate - = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` @@ -83,7 +82,7 @@ LL | | } = note: required because of the requirements on the impl of `Foo` for `NoData>` = note: required because of the requirements on the impl of `Foo` for `NoData` note: required by `Foo` - --> $DIR/issue-20413.rs:11:1 + --> $DIR/issue-20413.rs:1:1 | LL | trait Foo { | ^^^^^^^^^ diff --git a/src/test/ui/issues/issue-20414.rs b/src/test/ui/issues/issue-20414.rs index 72be151a3bc..1653a9da004 100644 --- a/src/test/ui/issues/issue-20414.rs +++ b/src/test/ui/issues/issue-20414.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-20433.rs b/src/test/ui/issues/issue-20433.rs index f760cd59968..a663239ccab 100644 --- a/src/test/ui/issues/issue-20433.rs +++ b/src/test/ui/issues/issue-20433.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} struct The; diff --git a/src/test/ui/issues/issue-20433.stderr b/src/test/ui/issues/issue-20433.stderr index 9800c9b3b58..f7cb28edd62 100644 --- a/src/test/ui/issues/issue-20433.stderr +++ b/src/test/ui/issues/issue-20433.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation time - --> $DIR/issue-20433.rs:16:5 + --> $DIR/issue-20433.rs:6:5 | LL | fn iceman(c: Vec<[i32]>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[i32]` - = note: to learn more, visit + = note: to learn more, visit = note: required by `std::vec::Vec` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20454.rs b/src/test/ui/issues/issue-20454.rs index ba15236324e..d4920c0c759 100644 --- a/src/test/ui/issues/issue-20454.rs +++ b/src/test/ui/issues/issue-20454.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_must_use)] use std::thread; diff --git a/src/test/ui/issues/issue-20605.rs b/src/test/ui/issues/issue-20605.rs index 60d012ab134..11a2a573ea6 100644 --- a/src/test/ui/issues/issue-20605.rs +++ b/src/test/ui/issues/issue-20605.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn changer<'a>(mut things: Box>) { for item in *things { *item = 0 } //~^ ERROR the size for values of type diff --git a/src/test/ui/issues/issue-20605.stderr b/src/test/ui/issues/issue-20605.stderr index fb32283ddf7..f779fe51bf2 100644 --- a/src/test/ui/issues/issue-20605.stderr +++ b/src/test/ui/issues/issue-20605.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `dyn std::iter::Iterator` cannot be known at compilation time - --> $DIR/issue-20605.rs:12:17 + --> $DIR/issue-20605.rs:2:17 | LL | for item in *things { *item = 0 } | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `dyn std::iter::Iterator` - = note: to learn more, visit + = note: to learn more, visit = note: required by `std::iter::IntoIterator::into_iter` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20616-1.rs b/src/test/ui/issues/issue-20616-1.rs index 3e29383d62c..49e9cb310c1 100644 --- a/src/test/ui/issues/issue-20616-1.rs +++ b/src/test/ui/issues/issue-20616-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time diff --git a/src/test/ui/issues/issue-20616-1.stderr b/src/test/ui/issues/issue-20616-1.stderr index 1ee965d2186..522db412412 100644 --- a/src/test/ui/issues/issue-20616-1.stderr +++ b/src/test/ui/issues/issue-20616-1.stderr @@ -1,5 +1,5 @@ error: expected one of `,`, `:`, or `>`, found `T` - --> $DIR/issue-20616-1.rs:19:16 + --> $DIR/issue-20616-1.rs:9:16 | LL | type Type_1<'a T> = &'a T; //~ error: expected one of `,`, `:`, or `>`, found `T` | ^ expected one of `,`, `:`, or `>` here diff --git a/src/test/ui/issues/issue-20616-2.rs b/src/test/ui/issues/issue-20616-2.rs index 1ec7a74559a..2f2c6903a9f 100644 --- a/src/test/ui/issues/issue-20616-2.rs +++ b/src/test/ui/issues/issue-20616-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time diff --git a/src/test/ui/issues/issue-20616-2.stderr b/src/test/ui/issues/issue-20616-2.stderr index 1c103b21a18..544219eb6cf 100644 --- a/src/test/ui/issues/issue-20616-2.stderr +++ b/src/test/ui/issues/issue-20616-2.stderr @@ -1,5 +1,5 @@ error: expected one of `,` or `>`, found `(` - --> $DIR/issue-20616-2.rs:22:31 + --> $DIR/issue-20616-2.rs:12:31 | LL | type Type_2 = Type_1_<'static ()>; //~ error: expected one of `,` or `>`, found `(` | ^ expected one of `,` or `>` here diff --git a/src/test/ui/issues/issue-20616-3.rs b/src/test/ui/issues/issue-20616-3.rs index 885fd246547..e84506ee249 100644 --- a/src/test/ui/issues/issue-20616-3.rs +++ b/src/test/ui/issues/issue-20616-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time diff --git a/src/test/ui/issues/issue-20616-3.stderr b/src/test/ui/issues/issue-20616-3.stderr index b4b40b3637d..5247298b7cc 100644 --- a/src/test/ui/issues/issue-20616-3.stderr +++ b/src/test/ui/issues/issue-20616-3.stderr @@ -1,5 +1,5 @@ error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-3.rs:25:24 + --> $DIR/issue-20616-3.rs:15:24 | LL | type Type_3 = Box; //~ error: expected one of `>`, identifier, lifetime, or type, found `,` | ^ expected one of `>`, identifier, lifetime, or type here diff --git a/src/test/ui/issues/issue-20616-4.rs b/src/test/ui/issues/issue-20616-4.rs index 0dbe92fc1bc..785a6fa7d9a 100644 --- a/src/test/ui/issues/issue-20616-4.rs +++ b/src/test/ui/issues/issue-20616-4.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time diff --git a/src/test/ui/issues/issue-20616-4.stderr b/src/test/ui/issues/issue-20616-4.stderr index 0a734e4fdcd..74c38d9e97d 100644 --- a/src/test/ui/issues/issue-20616-4.stderr +++ b/src/test/ui/issues/issue-20616-4.stderr @@ -1,5 +1,5 @@ error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-4.rs:28:34 + --> $DIR/issue-20616-4.rs:18:34 | LL | type Type_4 = Type_1_<'static,, T>; | ^ expected one of `>`, identifier, lifetime, or type here diff --git a/src/test/ui/issues/issue-20616-5.rs b/src/test/ui/issues/issue-20616-5.rs index 794e5178f4b..71dcc1f3a02 100644 --- a/src/test/ui/issues/issue-20616-5.rs +++ b/src/test/ui/issues/issue-20616-5.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time diff --git a/src/test/ui/issues/issue-20616-5.stderr b/src/test/ui/issues/issue-20616-5.stderr index 504be1632ba..38457beadc4 100644 --- a/src/test/ui/issues/issue-20616-5.stderr +++ b/src/test/ui/issues/issue-20616-5.stderr @@ -1,5 +1,5 @@ error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-5.rs:34:34 + --> $DIR/issue-20616-5.rs:24:34 | LL | type Type_5<'a> = Type_1_<'a, (),,>; | ^ expected one of `>`, identifier, lifetime, or type here diff --git a/src/test/ui/issues/issue-20616-6.rs b/src/test/ui/issues/issue-20616-6.rs index fe91751a4a0..da32da48852 100644 --- a/src/test/ui/issues/issue-20616-6.rs +++ b/src/test/ui/issues/issue-20616-6.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time diff --git a/src/test/ui/issues/issue-20616-6.stderr b/src/test/ui/issues/issue-20616-6.stderr index 41dea4137af..55b1d031a39 100644 --- a/src/test/ui/issues/issue-20616-6.stderr +++ b/src/test/ui/issues/issue-20616-6.stderr @@ -1,5 +1,5 @@ error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-6.rs:37:26 + --> $DIR/issue-20616-6.rs:27:26 | LL | type Type_6 = Type_5_<'a,,>; | ^ expected one of `>`, identifier, lifetime, or type here diff --git a/src/test/ui/issues/issue-20616-7.rs b/src/test/ui/issues/issue-20616-7.rs index 184ad027102..feaaff2c890 100644 --- a/src/test/ui/issues/issue-20616-7.rs +++ b/src/test/ui/issues/issue-20616-7.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time diff --git a/src/test/ui/issues/issue-20616-7.stderr b/src/test/ui/issues/issue-20616-7.stderr index caf66895fab..8b5f67c703f 100644 --- a/src/test/ui/issues/issue-20616-7.stderr +++ b/src/test/ui/issues/issue-20616-7.stderr @@ -1,5 +1,5 @@ error: expected one of `>`, identifier, lifetime, or type, found `,` - --> $DIR/issue-20616-7.rs:40:22 + --> $DIR/issue-20616-7.rs:30:22 | LL | type Type_7 = Box<(),,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,` | ^ expected one of `>`, identifier, lifetime, or type here diff --git a/src/test/ui/issues/issue-20616-8.rs b/src/test/ui/issues/issue-20616-8.rs index 5cdec33e94b..2fc7243559a 100644 --- a/src/test/ui/issues/issue-20616-8.rs +++ b/src/test/ui/issues/issue-20616-8.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time diff --git a/src/test/ui/issues/issue-20616-8.stderr b/src/test/ui/issues/issue-20616-8.stderr index 6d840fc562b..cdeb544f07c 100644 --- a/src/test/ui/issues/issue-20616-8.stderr +++ b/src/test/ui/issues/issue-20616-8.stderr @@ -1,5 +1,5 @@ error: expected one of `>`, identifier, or lifetime, found `,` - --> $DIR/issue-20616-8.rs:43:16 + --> $DIR/issue-20616-8.rs:33:16 | LL | type Type_8<'a,,> = &'a (); //~ error: expected one of `>`, identifier, or lifetime, found `,` | ^ expected one of `>`, identifier, or lifetime here diff --git a/src/test/ui/issues/issue-20616-9.rs b/src/test/ui/issues/issue-20616-9.rs index 7995addb692..b14a5b0ff36 100644 --- a/src/test/ui/issues/issue-20616-9.rs +++ b/src/test/ui/issues/issue-20616-9.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We need all these 9 issue-20616-N.rs files // because we can only catch one parsing error at a time diff --git a/src/test/ui/issues/issue-20616-9.stderr b/src/test/ui/issues/issue-20616-9.stderr index f9cc4e0b480..dfe705c6f12 100644 --- a/src/test/ui/issues/issue-20616-9.stderr +++ b/src/test/ui/issues/issue-20616-9.stderr @@ -1,5 +1,5 @@ error: expected one of `>`, identifier, or lifetime, found `,` - --> $DIR/issue-20616-9.rs:46:15 + --> $DIR/issue-20616-9.rs:36:15 | LL | type Type_9 = Box; //~ error: expected one of `>`, identifier, or lifetime, found `,` | ^ expected one of `>`, identifier, or lifetime here diff --git a/src/test/ui/issues/issue-2063-resource.rs b/src/test/ui/issues/issue-2063-resource.rs index bfe2d7acde6..6ed3e027ffa 100644 --- a/src/test/ui/issues/issue-2063-resource.rs +++ b/src/test/ui/issues/issue-2063-resource.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // test that autoderef of a type like this does not diff --git a/src/test/ui/issues/issue-20644.rs b/src/test/ui/issues/issue-20644.rs index 8e50c0becb3..db32344864c 100644 --- a/src/test/ui/issues/issue-20644.rs +++ b/src/test/ui/issues/issue-20644.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/test/ui/issues/issue-20692.rs b/src/test/ui/issues/issue-20692.rs index 0a4e7c8ee6b..ea89bca78d0 100644 --- a/src/test/ui/issues/issue-20692.rs +++ b/src/test/ui/issues/issue-20692.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Array: Sized {} fn f(x: &T) { diff --git a/src/test/ui/issues/issue-20692.stderr b/src/test/ui/issues/issue-20692.stderr index 156ebd920f0..acc223c0b2d 100644 --- a/src/test/ui/issues/issue-20692.stderr +++ b/src/test/ui/issues/issue-20692.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Array` cannot be made into an object - --> $DIR/issue-20692.rs:17:5 + --> $DIR/issue-20692.rs:7:5 | LL | &Array; | ^^^^^^ the trait `Array` cannot be made into an object @@ -7,7 +7,7 @@ LL | &Array; = note: the trait cannot require that `Self : Sized` error[E0038]: the trait `Array` cannot be made into an object - --> $DIR/issue-20692.rs:14:13 + --> $DIR/issue-20692.rs:4:13 | LL | let _ = x | ^ the trait `Array` cannot be made into an object diff --git a/src/test/ui/issues/issue-20714.rs b/src/test/ui/issues/issue-20714.rs index cb322f00723..0a4817c1164 100644 --- a/src/test/ui/issues/issue-20714.rs +++ b/src/test/ui/issues/issue-20714.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct G; fn main() { diff --git a/src/test/ui/issues/issue-20714.stderr b/src/test/ui/issues/issue-20714.stderr index 70a9736d2a2..9cd6a27c12a 100644 --- a/src/test/ui/issues/issue-20714.stderr +++ b/src/test/ui/issues/issue-20714.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `G` - --> $DIR/issue-20714.rs:14:13 + --> $DIR/issue-20714.rs:4:13 | LL | struct G; | --------- `G` defined here diff --git a/src/test/ui/issues/issue-20763-1.rs b/src/test/ui/issues/issue-20763-1.rs index bebbc914a45..c5b28520945 100644 --- a/src/test/ui/issues/issue-20763-1.rs +++ b/src/test/ui/issues/issue-20763-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-20763-2.rs b/src/test/ui/issues/issue-20763-2.rs index 87f4e54a6ad..cfa252b095e 100644 --- a/src/test/ui/issues/issue-20763-2.rs +++ b/src/test/ui/issues/issue-20763-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-20772.rs b/src/test/ui/issues/issue-20772.rs index d67c76a1525..36551e7014f 100644 --- a/src/test/ui/issues/issue-20772.rs +++ b/src/test/ui/issues/issue-20772.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait T : Iterator //~^ ERROR cycle detected //~| ERROR associated type `Item` not found for `Self` diff --git a/src/test/ui/issues/issue-20772.stderr b/src/test/ui/issues/issue-20772.stderr index b898962c9cc..7dc4e43fd57 100644 --- a/src/test/ui/issues/issue-20772.stderr +++ b/src/test/ui/issues/issue-20772.stderr @@ -1,5 +1,5 @@ error[E0391]: cycle detected when computing the supertraits of `T` - --> $DIR/issue-20772.rs:11:1 + --> $DIR/issue-20772.rs:1:1 | LL | / trait T : Iterator LL | | //~^ ERROR cycle detected @@ -8,9 +8,17 @@ LL | | {} | |__^ | = note: ...which again requires computing the supertraits of `T`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/issue-20772.rs:1:1 + | +LL | / trait T : Iterator +LL | | //~^ ERROR cycle detected +LL | | //~| ERROR associated type `Item` not found for `Self` +LL | | {} + | |__^ error[E0220]: associated type `Item` not found for `Self` - --> $DIR/issue-20772.rs:11:25 + --> $DIR/issue-20772.rs:1:25 | LL | trait T : Iterator | ^^^^^^^^^^ associated type `Item` not found diff --git a/src/test/ui/issues/issue-20797.rs b/src/test/ui/issues/issue-20797.rs index 70be78ee7b2..ce8564ffe43 100644 --- a/src/test/ui/issues/issue-20797.rs +++ b/src/test/ui/issues/issue-20797.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // ignore-cloudabi no std::fs diff --git a/src/test/ui/issues/issue-20801.nll.stderr b/src/test/ui/issues/issue-20801.nll.stderr index 362778b26c8..adcbe55aa32 100644 --- a/src/test/ui/issues/issue-20801.nll.stderr +++ b/src/test/ui/issues/issue-20801.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-20801.rs:36:22 + --> $DIR/issue-20801.rs:26:22 | LL | let a = unsafe { *mut_ref() }; | ^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | let a = unsafe { *mut_ref() }; | help: consider removing the `*`: `mut_ref()` error[E0507]: cannot move out of borrowed content - --> $DIR/issue-20801.rs:39:22 + --> $DIR/issue-20801.rs:29:22 | LL | let b = unsafe { *imm_ref() }; | ^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | let b = unsafe { *imm_ref() }; | help: consider removing the `*`: `imm_ref()` error[E0507]: cannot move out of dereference of raw pointer - --> $DIR/issue-20801.rs:42:22 + --> $DIR/issue-20801.rs:32:22 | LL | let c = unsafe { *mut_ptr() }; | ^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | let c = unsafe { *mut_ptr() }; | help: consider removing the `*`: `mut_ptr()` error[E0507]: cannot move out of dereference of raw pointer - --> $DIR/issue-20801.rs:45:22 + --> $DIR/issue-20801.rs:35:22 | LL | let d = unsafe { *const_ptr() }; | ^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-20801.rs b/src/test/ui/issues/issue-20801.rs index d3b97a9c058..6f8ce66d8f2 100644 --- a/src/test/ui/issues/issue-20801.rs +++ b/src/test/ui/issues/issue-20801.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // We used to ICE when moving out of a `*mut T` or `*const T`. struct T(u8); diff --git a/src/test/ui/issues/issue-20801.stderr b/src/test/ui/issues/issue-20801.stderr index 3989957b7b4..3e273919bb9 100644 --- a/src/test/ui/issues/issue-20801.stderr +++ b/src/test/ui/issues/issue-20801.stderr @@ -1,23 +1,23 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-20801.rs:36:22 + --> $DIR/issue-20801.rs:26:22 | LL | let a = unsafe { *mut_ref() }; | ^^^^^^^^^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/issue-20801.rs:39:22 + --> $DIR/issue-20801.rs:29:22 | LL | let b = unsafe { *imm_ref() }; | ^^^^^^^^^^ cannot move out of borrowed content error[E0507]: cannot move out of dereference of raw pointer - --> $DIR/issue-20801.rs:42:22 + --> $DIR/issue-20801.rs:32:22 | LL | let c = unsafe { *mut_ptr() }; | ^^^^^^^^^^ cannot move out of dereference of raw pointer error[E0507]: cannot move out of dereference of raw pointer - --> $DIR/issue-20801.rs:45:22 + --> $DIR/issue-20801.rs:35:22 | LL | let d = unsafe { *const_ptr() }; | ^^^^^^^^^^^^ cannot move out of dereference of raw pointer diff --git a/src/test/ui/issues/issue-20825-2.rs b/src/test/ui/issues/issue-20825-2.rs index fe2756e2814..cceed542186 100644 --- a/src/test/ui/issues/issue-20825-2.rs +++ b/src/test/ui/issues/issue-20825-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub trait Subscriber { type Input; diff --git a/src/test/ui/issues/issue-20825.rs b/src/test/ui/issues/issue-20825.rs index cbb987cd512..516c304d8b3 100644 --- a/src/test/ui/issues/issue-20825.rs +++ b/src/test/ui/issues/issue-20825.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Subscriber { type Input; } diff --git a/src/test/ui/issues/issue-20825.stderr b/src/test/ui/issues/issue-20825.stderr index e49e3668536..5f9709d1c64 100644 --- a/src/test/ui/issues/issue-20825.stderr +++ b/src/test/ui/issues/issue-20825.stderr @@ -1,10 +1,15 @@ error[E0391]: cycle detected when computing the supertraits of `Processor` - --> $DIR/issue-20825.rs:15:1 + --> $DIR/issue-20825.rs:5:1 | LL | pub trait Processor: Subscriber { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: ...which again requires computing the supertraits of `Processor`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/issue-20825.rs:5:1 + | +LL | pub trait Processor: Subscriber { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20831-debruijn.rs b/src/test/ui/issues/issue-20831-debruijn.rs index 6ad97d072df..6d3c7331a45 100644 --- a/src/test/ui/issues/issue-20831-debruijn.rs +++ b/src/test/ui/issues/issue-20831-debruijn.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #20831: debruijn index account was thrown off // by the (anonymous) lifetime in `::Output` // below. Note that changing to a named lifetime made the problem go diff --git a/src/test/ui/issues/issue-20831-debruijn.stderr b/src/test/ui/issues/issue-20831-debruijn.stderr index 556d8b402c4..fa7704cf17e 100644 --- a/src/test/ui/issues/issue-20831-debruijn.stderr +++ b/src/test/ui/issues/issue-20831-debruijn.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-20831-debruijn.rs:38:5 + --> $DIR/issue-20831-debruijn.rs:28:5 | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ @@ -12,8 +12,8 @@ LL | | } | = note: expected type `'a` found type `` -note: the anonymous lifetime #2 defined on the method body at 38:5... - --> $DIR/issue-20831-debruijn.rs:38:5 +note: the anonymous lifetime #2 defined on the method body at 28:5... + --> $DIR/issue-20831-debruijn.rs:28:5 | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ @@ -23,14 +23,14 @@ LL | | //~| ERROR mismatched types LL | | self.sub = t; LL | | } | |_____^ -note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 36:6 - --> $DIR/issue-20831-debruijn.rs:36:6 +note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 26:6 + --> $DIR/issue-20831-debruijn.rs:26:6 | LL | impl<'a> Publisher<'a> for MyStruct<'a> { | ^^ error[E0308]: mismatched types - --> $DIR/issue-20831-debruijn.rs:38:5 + --> $DIR/issue-20831-debruijn.rs:28:5 | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ @@ -43,13 +43,13 @@ LL | | } | = note: expected type `'a` found type `` -note: the lifetime 'a as defined on the impl at 36:6... - --> $DIR/issue-20831-debruijn.rs:36:6 +note: the lifetime 'a as defined on the impl at 26:6... + --> $DIR/issue-20831-debruijn.rs:26:6 | LL | impl<'a> Publisher<'a> for MyStruct<'a> { | ^^ -note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 38:5 - --> $DIR/issue-20831-debruijn.rs:38:5 +note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 28:5 + --> $DIR/issue-20831-debruijn.rs:28:5 | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ @@ -61,7 +61,7 @@ LL | | } | |_____^ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/issue-20831-debruijn.rs:38:5 + --> $DIR/issue-20831-debruijn.rs:28:5 | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ @@ -72,8 +72,8 @@ LL | | self.sub = t; LL | | } | |_____^ | -note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 38:5... - --> $DIR/issue-20831-debruijn.rs:38:5 +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 28:5... + --> $DIR/issue-20831-debruijn.rs:28:5 | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ @@ -83,8 +83,8 @@ LL | | //~| ERROR mismatched types LL | | self.sub = t; LL | | } | |_____^ -note: ...but the lifetime must also be valid for the lifetime 'a as defined on the impl at 36:6... - --> $DIR/issue-20831-debruijn.rs:36:6 +note: ...but the lifetime must also be valid for the lifetime 'a as defined on the impl at 26:6... + --> $DIR/issue-20831-debruijn.rs:26:6 | LL | impl<'a> Publisher<'a> for MyStruct<'a> { | ^^ diff --git a/src/test/ui/issues/issue-20939.rs b/src/test/ui/issues/issue-20939.rs index 5282ce4bb88..259fff2e6c2 100644 --- a/src/test/ui/issues/issue-20939.rs +++ b/src/test/ui/issues/issue-20939.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo {} impl<'a> Foo for Foo+'a {} diff --git a/src/test/ui/issues/issue-20939.stderr b/src/test/ui/issues/issue-20939.stderr index c8f7e58540b..d15a5196667 100644 --- a/src/test/ui/issues/issue-20939.stderr +++ b/src/test/ui/issues/issue-20939.stderr @@ -1,5 +1,5 @@ error[E0371]: the object type `(dyn Foo + 'a)` automatically implements the trait `Foo` - --> $DIR/issue-20939.rs:13:1 + --> $DIR/issue-20939.rs:3:1 | LL | impl<'a> Foo for Foo+'a {} | ^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Foo + 'a)` automatically implements trait `Foo` diff --git a/src/test/ui/issues/issue-2111.rs b/src/test/ui/issues/issue-2111.rs index 8180ce52bdb..7e5835e8697 100644 --- a/src/test/ui/issues/issue-2111.rs +++ b/src/test/ui/issues/issue-2111.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(a: Option, b: Option) { match (a,b) { //~^ ERROR: non-exhaustive patterns: `(None, None)` not covered diff --git a/src/test/ui/issues/issue-2111.stderr b/src/test/ui/issues/issue-2111.stderr index 5aa1b02779b..348ad153c80 100644 --- a/src/test/ui/issues/issue-2111.stderr +++ b/src/test/ui/issues/issue-2111.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `(None, None)` not covered - --> $DIR/issue-2111.rs:12:9 + --> $DIR/issue-2111.rs:2:9 | LL | match (a,b) { | ^^^^^ pattern `(None, None)` not covered diff --git a/src/test/ui/issues/issue-21140.rs b/src/test/ui/issues/issue-21140.rs index fd04b7fcee8..86d4e63670f 100644 --- a/src/test/ui/issues/issue-21140.rs +++ b/src/test/ui/issues/issue-21140.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub trait Trait where Self::Out: std::fmt::Display { type Out; diff --git a/src/test/ui/issues/issue-21146.rs b/src/test/ui/issues/issue-21146.rs index 457d40e62b0..19eaffc3edd 100644 --- a/src/test/ui/issues/issue-21146.rs +++ b/src/test/ui/issues/issue-21146.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: expected one of `!` or `::`, found `` include!("auxiliary/issue-21146-inc.rs"); fn main() {} diff --git a/src/test/ui/issues/issue-21146.stderr b/src/test/ui/issues/issue-21146.stderr index fab38123ea8..2798196ea00 100644 --- a/src/test/ui/issues/issue-21146.stderr +++ b/src/test/ui/issues/issue-21146.stderr @@ -1,5 +1,5 @@ error: expected one of `!` or `::`, found `` - --> $DIR/auxiliary/issue-21146-inc.rs:13:1 + --> $DIR/auxiliary/issue-21146-inc.rs:3:1 | LL | parse_error | ^^^^^^^^^^^ expected one of `!` or `::` here diff --git a/src/test/ui/issues/issue-21160.rs b/src/test/ui/issues/issue-21160.rs index 0de0ab2269b..46733566cf3 100644 --- a/src/test/ui/issues/issue-21160.rs +++ b/src/test/ui/issues/issue-21160.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Bar; impl Bar { diff --git a/src/test/ui/issues/issue-21160.stderr b/src/test/ui/issues/issue-21160.stderr index 75ed9988b89..e32343e9682 100644 --- a/src/test/ui/issues/issue-21160.stderr +++ b/src/test/ui/issues/issue-21160.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Bar: std::hash::Hash` is not satisfied - --> $DIR/issue-21160.rs:18:12 + --> $DIR/issue-21160.rs:8:12 | LL | struct Foo(Bar); | ^^^ the trait `std::hash::Hash` is not implemented for `Bar` diff --git a/src/test/ui/issues/issue-21174-2.rs b/src/test/ui/issues/issue-21174-2.rs index e7524a942b2..145b062baf6 100644 --- a/src/test/ui/issues/issue-21174-2.rs +++ b/src/test/ui/issues/issue-21174-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/issues/issue-21174.rs b/src/test/ui/issues/issue-21174.rs index 9d9b7e48043..07827425116 100644 --- a/src/test/ui/issues/issue-21174.rs +++ b/src/test/ui/issues/issue-21174.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait<'a> { type A; type B; @@ -15,7 +5,7 @@ trait Trait<'a> { fn foo<'a, T: Trait<'a>>(value: T::A) { let new: T::B = unsafe { std::mem::transmute(value) }; -//~^ ERROR: transmute called with types of different sizes +//~^ ERROR: cannot transmute between types of different sizes, or dependently-sized types } fn main() { } diff --git a/src/test/ui/issues/issue-21174.stderr b/src/test/ui/issues/issue-21174.stderr index 391ed1e7698..5ac5a8665bc 100644 --- a/src/test/ui/issues/issue-21174.stderr +++ b/src/test/ui/issues/issue-21174.stderr @@ -1,11 +1,11 @@ -error[E0512]: transmute called with types of different sizes - --> $DIR/issue-21174.rs:17:30 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/issue-21174.rs:7:30 | LL | let new: T::B = unsafe { std::mem::transmute(value) }; | ^^^^^^^^^^^^^^^^^^^ | - = note: source type: >::A (size can vary because of ::A) - = note: target type: >::B (size can vary because of ::B) + = note: source type: `>::A` (size can vary because of ::A) + = note: target type: `>::B` (size can vary because of ::B) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-21177.rs b/src/test/ui/issues/issue-21177.rs index 9da57877a09..9d153696b88 100644 --- a/src/test/ui/issues/issue-21177.rs +++ b/src/test/ui/issues/issue-21177.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait { type A; type B; diff --git a/src/test/ui/issues/issue-21177.stderr b/src/test/ui/issues/issue-21177.stderr index c924fb2ee94..c3d2c6f48af 100644 --- a/src/test/ui/issues/issue-21177.stderr +++ b/src/test/ui/issues/issue-21177.stderr @@ -1,18 +1,18 @@ error[E0391]: cycle detected when computing the bounds for type parameter `T` - --> $DIR/issue-21177.rs:16:21 + --> $DIR/issue-21177.rs:6:21 | LL | fn foo>() { } | ^^^^ | = note: ...which again requires computing the bounds for type parameter `T`, completing the cycle note: cycle used when processing `foo` - --> $DIR/issue-21177.rs:16:21 + --> $DIR/issue-21177.rs:6:21 | LL | fn foo>() { } | ^^^^ error[E0220]: associated type `B` not found for `T` - --> $DIR/issue-21177.rs:16:21 + --> $DIR/issue-21177.rs:6:21 | LL | fn foo>() { } | ^^^^ associated type `B` not found diff --git a/src/test/ui/issues/issue-21202.rs b/src/test/ui/issues/issue-21202.rs index fa4b515c81c..2c5f1394449 100644 --- a/src/test/ui/issues/issue-21202.rs +++ b/src/test/ui/issues/issue-21202.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-21202.rs extern crate issue_21202 as crate1; diff --git a/src/test/ui/issues/issue-21202.stderr b/src/test/ui/issues/issue-21202.stderr index 9d17ff64769..d19e42d8d9c 100644 --- a/src/test/ui/issues/issue-21202.stderr +++ b/src/test/ui/issues/issue-21202.stderr @@ -1,5 +1,5 @@ error[E0624]: method `foo` is private - --> $DIR/issue-21202.rs:20:9 + --> $DIR/issue-21202.rs:10:9 | LL | Foo::foo(&f); | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-21245.rs b/src/test/ui/issues/issue-21245.rs index 64b322f472b..edf482afc53 100644 --- a/src/test/ui/issues/issue-21245.rs +++ b/src/test/ui/issues/issue-21245.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Regression test for issue #21245. Check that we are able to infer diff --git a/src/test/ui/issues/issue-21332.rs b/src/test/ui/issues/issue-21332.rs index db3334834d4..db157f095a9 100644 --- a/src/test/ui/issues/issue-21332.rs +++ b/src/test/ui/issues/issue-21332.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S; impl Iterator for S { diff --git a/src/test/ui/issues/issue-21332.stderr b/src/test/ui/issues/issue-21332.stderr index b5fbb71f8ca..693b2be6c00 100644 --- a/src/test/ui/issues/issue-21332.stderr +++ b/src/test/ui/issues/issue-21332.stderr @@ -1,5 +1,5 @@ error[E0053]: method `next` has an incompatible type for trait - --> $DIR/issue-21332.rs:15:5 + --> $DIR/issue-21332.rs:5:5 | LL | fn next(&mut self) -> Result { Ok(7) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found enum `std::result::Result` diff --git a/src/test/ui/issues/issue-21356.rs b/src/test/ui/issues/issue-21356.rs index f66c09291cc..ae623929d63 100644 --- a/src/test/ui/issues/issue-21356.rs +++ b/src/test/ui/issues/issue-21356.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_macros)] macro_rules! test { ($wrong:t_ty ..) => () } diff --git a/src/test/ui/issues/issue-21356.stderr b/src/test/ui/issues/issue-21356.stderr index 924767fb5e1..17014c6ceee 100644 --- a/src/test/ui/issues/issue-21356.stderr +++ b/src/test/ui/issues/issue-21356.stderr @@ -1,5 +1,5 @@ error: invalid fragment specifier `t_ty` - --> $DIR/issue-21356.rs:13:22 + --> $DIR/issue-21356.rs:3:22 | LL | macro_rules! test { ($wrong:t_ty ..) => () } | ^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-21363.rs b/src/test/ui/issues/issue-21363.rs index 06c5ccbb6cc..5e30db17c6d 100644 --- a/src/test/ui/issues/issue-21363.rs +++ b/src/test/ui/issues/issue-21363.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-21402.rs b/src/test/ui/issues/issue-21402.rs index 32633469ea4..518d3cfe5a6 100644 --- a/src/test/ui/issues/issue-21402.rs +++ b/src/test/ui/issues/issue-21402.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-21449.rs b/src/test/ui/issues/issue-21449.rs index cc44cf88f09..00ce2b7fffa 100644 --- a/src/test/ui/issues/issue-21449.rs +++ b/src/test/ui/issues/issue-21449.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod MyMod {} fn main() { diff --git a/src/test/ui/issues/issue-21449.stderr b/src/test/ui/issues/issue-21449.stderr index d84b3b99c1f..ecaf6faba42 100644 --- a/src/test/ui/issues/issue-21449.stderr +++ b/src/test/ui/issues/issue-21449.stderr @@ -1,5 +1,5 @@ error[E0574]: expected struct, variant or union type, found module `MyMod` - --> $DIR/issue-21449.rs:14:17 + --> $DIR/issue-21449.rs:4:17 | LL | let myVar = MyMod { T: 0 }; | ^^^^^ not a struct, variant or union type diff --git a/src/test/ui/issues/issue-2149.rs b/src/test/ui/issues/issue-2149.rs index 256c5d8e6f7..d46f0e61793 100644 --- a/src/test/ui/issues/issue-2149.rs +++ b/src/test/ui/issues/issue-2149.rs @@ -1,18 +1,8 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait vec_monad { +trait VecMonad { fn bind(&self, f: F) where F: FnMut(A) -> Vec; } -impl vec_monad for Vec { +impl VecMonad for Vec { fn bind(&self, mut f: F) where F: FnMut(A) -> Vec { let mut r = panic!(); for elt in self { r = r + f(*elt); } diff --git a/src/test/ui/issues/issue-2149.stderr b/src/test/ui/issues/issue-2149.stderr index 4ae9032cd1a..82dbf34cc88 100644 --- a/src/test/ui/issues/issue-2149.stderr +++ b/src/test/ui/issues/issue-2149.stderr @@ -1,5 +1,5 @@ error[E0277]: cannot add `std::vec::Vec` to `()` - --> $DIR/issue-2149.rs:18:33 + --> $DIR/issue-2149.rs:8:33 | LL | for elt in self { r = r + f(*elt); } | ^ no implementation for `() + std::vec::Vec` @@ -7,14 +7,14 @@ LL | for elt in self { r = r + f(*elt); } = help: the trait `std::ops::Add>` is not implemented for `()` error[E0599]: no method named `bind` found for type `[&str; 1]` in the current scope - --> $DIR/issue-2149.rs:23:12 + --> $DIR/issue-2149.rs:13:12 | LL | ["hi"].bind(|x| [x] ); | ^^^^ | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `bind`, perhaps you need to implement it: - candidate #1: `vec_monad` + candidate #1: `VecMonad` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-2150.rs b/src/test/ui/issues/issue-2150.rs index 8b109b0a5c0..baa1dde0fc2 100644 --- a/src/test/ui/issues/issue-2150.rs +++ b/src/test/ui/issues/issue-2150.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unreachable_code)] #![allow(unused_variables)] #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-2150.stderr b/src/test/ui/issues/issue-2150.stderr index c1944efab8b..59000f3dd53 100644 --- a/src/test/ui/issues/issue-2150.stderr +++ b/src/test/ui/issues/issue-2150.stderr @@ -1,11 +1,11 @@ error: unreachable statement - --> $DIR/issue-2150.rs:18:5 + --> $DIR/issue-2150.rs:8:5 | LL | for x in &v { i += 1; } | ^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-2150.rs:11:9 + --> $DIR/issue-2150.rs:1:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-2151.rs b/src/test/ui/issues/issue-2151.rs index 3cf971f3f8d..32fba4cb217 100644 --- a/src/test/ui/issues/issue-2151.rs +++ b/src/test/ui/issues/issue-2151.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = panic!(); x.clone(); //~ ERROR type annotations needed diff --git a/src/test/ui/issues/issue-2151.stderr b/src/test/ui/issues/issue-2151.stderr index 516c5287b31..23f3c58653e 100644 --- a/src/test/ui/issues/issue-2151.stderr +++ b/src/test/ui/issues/issue-2151.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-2151.rs:13:5 + --> $DIR/issue-2151.rs:3:5 | LL | let x = panic!(); | - consider giving `x` a type diff --git a/src/test/ui/issues/issue-21520.rs b/src/test/ui/issues/issue-21520.rs index aac41196215..450448f1a11 100644 --- a/src/test/ui/issues/issue-21520.rs +++ b/src/test/ui/issues/issue-21520.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Test that the requirement (in `Bar`) that `T::Bar : 'static` does diff --git a/src/test/ui/issues/issue-21546.rs b/src/test/ui/issues/issue-21546.rs index da1669bc913..9f3974b4314 100644 --- a/src/test/ui/issues/issue-21546.rs +++ b/src/test/ui/issues/issue-21546.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Also works as a test for #14564 #[allow(non_snake_case)] diff --git a/src/test/ui/issues/issue-21546.stderr b/src/test/ui/issues/issue-21546.stderr index bff79e52aa1..5fd06fc6733 100644 --- a/src/test/ui/issues/issue-21546.stderr +++ b/src/test/ui/issues/issue-21546.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-21546.rs:17:1 + --> $DIR/issue-21546.rs:7:1 | LL | mod Foo { } | ------- previous definition of the module `Foo` here @@ -10,7 +10,7 @@ LL | struct Foo; = note: `Foo` must be defined only once in the type namespace of this module error[E0428]: the name `Bar` is defined multiple times - --> $DIR/issue-21546.rs:24:1 + --> $DIR/issue-21546.rs:14:1 | LL | mod Bar { } | ------- previous definition of the module `Bar` here @@ -21,7 +21,7 @@ LL | struct Bar(i32); = note: `Bar` must be defined only once in the type namespace of this module error[E0428]: the name `Baz` is defined multiple times - --> $DIR/issue-21546.rs:32:1 + --> $DIR/issue-21546.rs:22:1 | LL | struct Baz(i32); | ---------------- previous definition of the type `Baz` here @@ -32,7 +32,7 @@ LL | mod Baz { } = note: `Baz` must be defined only once in the type namespace of this module error[E0428]: the name `Qux` is defined multiple times - --> $DIR/issue-21546.rs:40:1 + --> $DIR/issue-21546.rs:30:1 | LL | struct Qux { x: bool } | ---------- previous definition of the type `Qux` here @@ -43,7 +43,7 @@ LL | mod Qux { } = note: `Qux` must be defined only once in the type namespace of this module error[E0428]: the name `Quux` is defined multiple times - --> $DIR/issue-21546.rs:48:1 + --> $DIR/issue-21546.rs:38:1 | LL | struct Quux; | ------------ previous definition of the type `Quux` here @@ -54,7 +54,7 @@ LL | mod Quux { } = note: `Quux` must be defined only once in the type namespace of this module error[E0428]: the name `Corge` is defined multiple times - --> $DIR/issue-21546.rs:56:1 + --> $DIR/issue-21546.rs:46:1 | LL | enum Corge { A, B } | ---------- previous definition of the type `Corge` here diff --git a/src/test/ui/issues/issue-21554.rs b/src/test/ui/issues/issue-21554.rs index 1b87862a056..c176b1247ce 100644 --- a/src/test/ui/issues/issue-21554.rs +++ b/src/test/ui/issues/issue-21554.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Inches(i32); fn main() { diff --git a/src/test/ui/issues/issue-21554.stderr b/src/test/ui/issues/issue-21554.stderr index 104970ea448..6ea552a26a5 100644 --- a/src/test/ui/issues/issue-21554.stderr +++ b/src/test/ui/issues/issue-21554.stderr @@ -1,5 +1,5 @@ error[E0606]: casting `fn(i32) -> Inches {Inches}` as `f32` is invalid - --> $DIR/issue-21554.rs:14:5 + --> $DIR/issue-21554.rs:4:5 | LL | Inches as f32; | ^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-21562.rs b/src/test/ui/issues/issue-21562.rs index 2cf97cec31c..e31316d0709 100644 --- a/src/test/ui/issues/issue-21562.rs +++ b/src/test/ui/issues/issue-21562.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/ui/issues/issue-21600.nll.stderr b/src/test/ui/issues/issue-21600.nll.stderr index 5fe8dc45ccc..05837e92cdb 100644 --- a/src/test/ui/issues/issue-21600.nll.stderr +++ b/src/test/ui/issues/issue-21600.nll.stderr @@ -1,17 +1,17 @@ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/issue-21600.rs:24:20 + --> $DIR/issue-21600.rs:14:20 | LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer | ^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/issue-21600.rs:24:17 + --> $DIR/issue-21600.rs:14:17 | LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer | ^^^^^^^^^^^^^^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/issue-21600.rs:24:17 + --> $DIR/issue-21600.rs:14:17 | LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer | ^^ - mutable borrow occurs due to use of `x` in closure @@ -19,7 +19,7 @@ LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a | cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/issue-21600.rs:22:13 + --> $DIR/issue-21600.rs:12:13 | LL | call_it(|| { | _____________^ diff --git a/src/test/ui/issues/issue-21600.rs b/src/test/ui/issues/issue-21600.rs index e4dfad2433c..1efc873bee2 100644 --- a/src/test/ui/issues/issue-21600.rs +++ b/src/test/ui/issues/issue-21600.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn call_it(f: F) where F: Fn() { f(); } struct A; diff --git a/src/test/ui/issues/issue-21600.stderr b/src/test/ui/issues/issue-21600.stderr index 873dc7448be..ccb75f4cc00 100644 --- a/src/test/ui/issues/issue-21600.stderr +++ b/src/test/ui/issues/issue-21600.stderr @@ -1,11 +1,11 @@ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure - --> $DIR/issue-21600.rs:24:17 + --> $DIR/issue-21600.rs:14:17 | LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer | ^^ | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/issue-21600.rs:22:13 + --> $DIR/issue-21600.rs:12:13 | LL | call_it(|| { | _____________^ @@ -16,13 +16,13 @@ LL | | }); | |_____^ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure - --> $DIR/issue-21600.rs:24:20 + --> $DIR/issue-21600.rs:14:20 | LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer | ^ | help: consider changing this closure to take self by mutable reference - --> $DIR/issue-21600.rs:24:17 + --> $DIR/issue-21600.rs:14:17 | LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-21622.rs b/src/test/ui/issues/issue-21622.rs index 880b3524e10..2b80f2f36c5 100644 --- a/src/test/ui/issues/issue-21622.rs +++ b/src/test/ui/issues/issue-21622.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/issues/issue-21634.rs b/src/test/ui/issues/issue-21634.rs index d21f5623953..8941bb1c243 100644 --- a/src/test/ui/issues/issue-21634.rs +++ b/src/test/ui/issues/issue-21634.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(stable_features)] diff --git a/src/test/ui/issues/issue-21701.rs b/src/test/ui/issues/issue-21701.rs index f24de2ffe6b..fb2d5a4ad2a 100644 --- a/src/test/ui/issues/issue-21701.rs +++ b/src/test/ui/issues/issue-21701.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(t: U) { let y = t(); //~^ ERROR: expected function, found `U` diff --git a/src/test/ui/issues/issue-21701.stderr b/src/test/ui/issues/issue-21701.stderr index b94e0833a58..77bb3802d86 100644 --- a/src/test/ui/issues/issue-21701.stderr +++ b/src/test/ui/issues/issue-21701.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `U` - --> $DIR/issue-21701.rs:12:13 + --> $DIR/issue-21701.rs:2:13 | LL | fn foo(t: U) { | - `U` defined here @@ -9,7 +9,7 @@ LL | let y = t(); | call expression requires function error[E0618]: expected function, found `Bar` - --> $DIR/issue-21701.rs:19:13 + --> $DIR/issue-21701.rs:9:13 | LL | struct Bar; | ----------- `Bar` defined here diff --git a/src/test/ui/issues/issue-21726.rs b/src/test/ui/issues/issue-21726.rs index b25fe1bc954..f2065976b35 100644 --- a/src/test/ui/issues/issue-21726.rs +++ b/src/test/ui/issues/issue-21726.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Regression test for #21726: an issue arose around the rules for diff --git a/src/test/ui/issues/issue-21763.rs b/src/test/ui/issues/issue-21763.rs index b4f952c87d4..29ee5f91717 100644 --- a/src/test/ui/issues/issue-21763.rs +++ b/src/test/ui/issues/issue-21763.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for HashMap only impl'ing Send/Sync if its contents do use std::collections::HashMap; diff --git a/src/test/ui/issues/issue-21763.stderr b/src/test/ui/issues/issue-21763.stderr index 91db16e0f6d..62cc8877688 100644 --- a/src/test/ui/issues/issue-21763.stderr +++ b/src/test/ui/issues/issue-21763.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely - --> $DIR/issue-21763.rs:19:5 + --> $DIR/issue-21763.rs:9:5 | LL | foo::, Rc<()>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely @@ -10,7 +10,7 @@ LL | foo::, Rc<()>>>(); = note: required because it appears within the type `std::collections::hash::table::RawTable, std::rc::Rc<()>>` = note: required because it appears within the type `std::collections::HashMap, std::rc::Rc<()>>` note: required by `foo` - --> $DIR/issue-21763.rs:16:1 + --> $DIR/issue-21763.rs:6:1 | LL | fn foo() {} | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-21837.rs b/src/test/ui/issues/issue-21837.rs index 86506de1ea9..213119bd21c 100644 --- a/src/test/ui/issues/issue-21837.rs +++ b/src/test/ui/issues/issue-21837.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Bound {} pub struct Foo(T); diff --git a/src/test/ui/issues/issue-21837.stderr b/src/test/ui/issues/issue-21837.stderr index bbdebeefdd6..464a65fa695 100644 --- a/src/test/ui/issues/issue-21837.stderr +++ b/src/test/ui/issues/issue-21837.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `T: Bound` is not satisfied - --> $DIR/issue-21837.rs:18:9 + --> $DIR/issue-21837.rs:8:9 | LL | impl Trait2 for Foo {} //~ ERROR the trait bound `T: Bound` is not satisfied | ^^^^^^ the trait `Bound` is not implemented for `T` | = help: consider adding a `where T: Bound` bound note: required by `Foo` - --> $DIR/issue-21837.rs:12:1 + --> $DIR/issue-21837.rs:2:1 | LL | pub struct Foo(T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-21891.rs b/src/test/ui/issues/issue-21891.rs index d83cf08d173..9b1e44c1817 100644 --- a/src/test/ui/issues/issue-21891.rs +++ b/src/test/ui/issues/issue-21891.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/ui/issues/issue-21946.rs b/src/test/ui/issues/issue-21946.rs index 0d652be5c26..d7a6c656df9 100644 --- a/src/test/ui/issues/issue-21946.rs +++ b/src/test/ui/issues/issue-21946.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { type A; } diff --git a/src/test/ui/issues/issue-21946.stderr b/src/test/ui/issues/issue-21946.stderr index ebb0c0c9ce0..7a178bee6ae 100644 --- a/src/test/ui/issues/issue-21946.stderr +++ b/src/test/ui/issues/issue-21946.stderr @@ -1,5 +1,5 @@ error[E0275]: overflow evaluating the requirement `::A` - --> $DIR/issue-21946.rs:17:6 + --> $DIR/issue-21946.rs:7:6 | LL | impl Foo for FooStruct { | ^^^ diff --git a/src/test/ui/issues/issue-21950.rs b/src/test/ui/issues/issue-21950.rs index f9328a58d09..0f78b37fedb 100644 --- a/src/test/ui/issues/issue-21950.rs +++ b/src/test/ui/issues/issue-21950.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength use std::ops::Add; diff --git a/src/test/ui/issues/issue-21950.stderr b/src/test/ui/issues/issue-21950.stderr index a2f74a29aab..5f401d13feb 100644 --- a/src/test/ui/issues/issue-21950.stderr +++ b/src/test/ui/issues/issue-21950.stderr @@ -1,5 +1,5 @@ error[E0393]: the type parameter `RHS` must be explicitly specified - --> $DIR/issue-21950.rs:17:14 + --> $DIR/issue-21950.rs:7:14 | LL | &Add; | ^^^ missing reference to `RHS` @@ -7,10 +7,10 @@ LL | &Add; = note: because of the default `Self` reference, type parameters must be specified on object types error[E0191]: the value of the associated type `Output` (from the trait `std::ops::Add`) must be specified - --> $DIR/issue-21950.rs:17:14 + --> $DIR/issue-21950.rs:7:14 | LL | &Add; - | ^^^ missing associated type `Output` value + | ^^^ associated type `Output` must be specified error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-21974.rs b/src/test/ui/issues/issue-21974.rs index 6ddfa4c8e3e..f49eb230b40 100644 --- a/src/test/ui/issues/issue-21974.rs +++ b/src/test/ui/issues/issue-21974.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that (for now) we report an ambiguity error here, because // specific trait relationships are ignored for the purposes of trait // matching. This behavior should likely be improved such that this diff --git a/src/test/ui/issues/issue-21974.stderr b/src/test/ui/issues/issue-21974.stderr index 4cc28c9ceb5..d5c48db4500 100644 --- a/src/test/ui/issues/issue-21974.stderr +++ b/src/test/ui/issues/issue-21974.stderr @@ -1,5 +1,5 @@ error[E0283]: type annotations required: cannot resolve `&'a T: Foo` - --> $DIR/issue-21974.rs:20:1 + --> $DIR/issue-21974.rs:10:1 | LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required LL | | where &'a T : Foo, @@ -11,7 +11,7 @@ LL | | } | |_^ | note: required by `Foo` - --> $DIR/issue-21974.rs:16:1 + --> $DIR/issue-21974.rs:6:1 | LL | trait Foo { | ^^^^^^^^^ diff --git a/src/test/ui/issues/issue-22034.rs b/src/test/ui/issues/issue-22034.rs index 2708de2c13a..75ac78ad24f 100644 --- a/src/test/ui/issues/issue-22034.rs +++ b/src/test/ui/issues/issue-22034.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/ui/issues/issue-22034.stderr b/src/test/ui/issues/issue-22034.stderr index da376fedbb9..de2d315ff5c 100644 --- a/src/test/ui/issues/issue-22034.stderr +++ b/src/test/ui/issues/issue-22034.stderr @@ -1,5 +1,5 @@ error[E0277]: expected a `std::ops::Fn<()>` closure, found `()` - --> $DIR/issue-22034.rs:18:16 + --> $DIR/issue-22034.rs:8:16 | LL | &mut *(ptr as *mut Fn()) | ^^^ expected an `Fn<()>` closure, found `()` diff --git a/src/test/ui/issues/issue-22037.rs b/src/test/ui/issues/issue-22037.rs index ffa881b49c5..b9eb41b6ea6 100644 --- a/src/test/ui/issues/issue-22037.rs +++ b/src/test/ui/issues/issue-22037.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait A { type Output; fn a(&self) -> ::X; diff --git a/src/test/ui/issues/issue-22037.stderr b/src/test/ui/issues/issue-22037.stderr index ae739afc704..615628558f0 100644 --- a/src/test/ui/issues/issue-22037.stderr +++ b/src/test/ui/issues/issue-22037.stderr @@ -1,5 +1,5 @@ error[E0576]: cannot find associated type `X` in trait `A` - --> $DIR/issue-22037.rs:13:33 + --> $DIR/issue-22037.rs:3:33 | LL | fn a(&self) -> ::X; | ^ not found in `A` diff --git a/src/test/ui/issues/issue-22066.rs b/src/test/ui/issues/issue-22066.rs index 76dae2a2602..8c0b664d78a 100644 --- a/src/test/ui/issues/issue-22066.rs +++ b/src/test/ui/issues/issue-22066.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub trait LineFormatter<'a> { type Iter: Iterator + 'a; diff --git a/src/test/ui/issues/issue-22289.rs b/src/test/ui/issues/issue-22289.rs index c23fc4f3344..b683834de44 100644 --- a/src/test/ui/issues/issue-22289.rs +++ b/src/test/ui/issues/issue-22289.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { 0 as &std::any::Any; //~ ERROR non-primitive cast } diff --git a/src/test/ui/issues/issue-22289.stderr b/src/test/ui/issues/issue-22289.stderr index 202b25f1a5b..5214ec1ad16 100644 --- a/src/test/ui/issues/issue-22289.stderr +++ b/src/test/ui/issues/issue-22289.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `i32` as `&(dyn std::any::Any + 'static)` - --> $DIR/issue-22289.rs:12:5 + --> $DIR/issue-22289.rs:2:5 | LL | 0 as &std::any::Any; //~ ERROR non-primitive cast | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-22312.rs b/src/test/ui/issues/issue-22312.rs index 2128c420630..f7ebdb0372a 100644 --- a/src/test/ui/issues/issue-22312.rs +++ b/src/test/ui/issues/issue-22312.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Index; pub trait Array2D: Index { diff --git a/src/test/ui/issues/issue-22312.stderr b/src/test/ui/issues/issue-22312.stderr index abd712e5c29..d8987a37f7e 100644 --- a/src/test/ui/issues/issue-22312.stderr +++ b/src/test/ui/issues/issue-22312.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `Self` as `&dyn std::ops::Index>::Output>` - --> $DIR/issue-22312.rs:21:24 + --> $DIR/issue-22312.rs:11:24 | LL | let indexer = &(*self as &Index>::Output>); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-22356.rs b/src/test/ui/issues/issue-22356.rs index 87ea53a3f20..3f3b1d3e5f1 100644 --- a/src/test/ui/issues/issue-22356.rs +++ b/src/test/ui/issues/issue-22356.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(type_alias_bounds)] diff --git a/src/test/ui/issues/issue-22370.rs b/src/test/ui/issues/issue-22370.rs index 4613c5977fd..44eef2da83c 100644 --- a/src/test/ui/issues/issue-22370.rs +++ b/src/test/ui/issues/issue-22370.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength trait A {} diff --git a/src/test/ui/issues/issue-22370.stderr b/src/test/ui/issues/issue-22370.stderr index b3691503fc1..5d76d84d11e 100644 --- a/src/test/ui/issues/issue-22370.stderr +++ b/src/test/ui/issues/issue-22370.stderr @@ -1,5 +1,5 @@ error[E0393]: the type parameter `T` must be explicitly specified - --> $DIR/issue-22370.rs:15:10 + --> $DIR/issue-22370.rs:5:10 | LL | fn f(a: &A) {} | ^ missing reference to `T` diff --git a/src/test/ui/issues/issue-22375.rs b/src/test/ui/issues/issue-22375.rs index a30f5f76387..bae7b2bfab4 100644 --- a/src/test/ui/issues/issue-22375.rs +++ b/src/test/ui/issues/issue-22375.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass trait A> {} diff --git a/src/test/ui/issues/issue-22384.rs b/src/test/ui/issues/issue-22384.rs index ae7fb01e057..98988f27ecc 100644 --- a/src/test/ui/issues/issue-22384.rs +++ b/src/test/ui/issues/issue-22384.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait { fn foo(); } diff --git a/src/test/ui/issues/issue-22384.stderr b/src/test/ui/issues/issue-22384.stderr index b8cc1e643e5..1f767a443d0 100644 --- a/src/test/ui/issues/issue-22384.stderr +++ b/src/test/ui/issues/issue-22384.stderr @@ -1,5 +1,5 @@ error[E0576]: cannot find associated type `foobar` in trait `Copy` - --> $DIR/issue-22384.rs:16:21 + --> $DIR/issue-22384.rs:6:21 | LL | <::foobar as Trait>::foo(); | ^^^^^^ not found in `Copy` diff --git a/src/test/ui/issues/issue-22434.rs b/src/test/ui/issues/issue-22434.rs index 6effd02bac8..0d7d67cbc1b 100644 --- a/src/test/ui/issues/issue-22434.rs +++ b/src/test/ui/issues/issue-22434.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo { type A; } diff --git a/src/test/ui/issues/issue-22434.stderr b/src/test/ui/issues/issue-22434.stderr index 914da801ad4..bbdbeb6ae98 100644 --- a/src/test/ui/issues/issue-22434.stderr +++ b/src/test/ui/issues/issue-22434.stderr @@ -1,8 +1,11 @@ error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified - --> $DIR/issue-22434.rs:15:19 + --> $DIR/issue-22434.rs:5:19 | +LL | type A; + | ------- `A` defined here +... LL | type I<'a> = &'a (Foo + 'a); - | ^^^^^^^^ missing associated type `A` value + | ^^^^^^^^ associated type `A` must be specified error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22468.rs b/src/test/ui/issues/issue-22468.rs index 50e5dd2955d..197a19c038c 100644 --- a/src/test/ui/issues/issue-22468.rs +++ b/src/test/ui/issues/issue-22468.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let foo = "bar"; let x = foo("baz"); diff --git a/src/test/ui/issues/issue-22468.stderr b/src/test/ui/issues/issue-22468.stderr index af32c0e20ce..8d8601b3111 100644 --- a/src/test/ui/issues/issue-22468.stderr +++ b/src/test/ui/issues/issue-22468.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `&str` - --> $DIR/issue-22468.rs:13:13 + --> $DIR/issue-22468.rs:3:13 | LL | let foo = "bar"; | --- `&str` defined here diff --git a/src/test/ui/issues/issue-22471.rs b/src/test/ui/issues/issue-22471.rs index c13b9dd9248..a22c7e6173e 100644 --- a/src/test/ui/issues/issue-22471.rs +++ b/src/test/ui/issues/issue-22471.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(type_alias_bounds)] diff --git a/src/test/ui/issues/issue-22560.rs b/src/test/ui/issues/issue-22560.rs index b1c636f2ef6..d91211e556b 100644 --- a/src/test/ui/issues/issue-22560.rs +++ b/src/test/ui/issues/issue-22560.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength use std::ops::{Add, Sub}; diff --git a/src/test/ui/issues/issue-22560.stderr b/src/test/ui/issues/issue-22560.stderr index b5524036fae..c6de479aac0 100644 --- a/src/test/ui/issues/issue-22560.stderr +++ b/src/test/ui/issues/issue-22560.stderr @@ -1,5 +1,5 @@ error[E0393]: the type parameter `RHS` must be explicitly specified - --> $DIR/issue-22560.rs:15:13 + --> $DIR/issue-22560.rs:5:13 | LL | type Test = Add + | ^^^ missing reference to `RHS` @@ -7,7 +7,7 @@ LL | type Test = Add + = note: because of the default `Self` reference, type parameters must be specified on object types error[E0393]: the type parameter `RHS` must be explicitly specified - --> $DIR/issue-22560.rs:18:13 + --> $DIR/issue-22560.rs:8:13 | LL | Sub; | ^^^ missing reference to `RHS` @@ -15,20 +15,20 @@ LL | Sub; = note: because of the default `Self` reference, type parameters must be specified on object types error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/issue-22560.rs:18:13 + --> $DIR/issue-22560.rs:8:13 | LL | Sub; | ^^^ non-auto additional trait error[E0191]: the value of the associated type `Output` (from the trait `std::ops::Add`) must be specified - --> $DIR/issue-22560.rs:15:13 + --> $DIR/issue-22560.rs:5:13 | LL | type Test = Add + | _____________^ LL | | //~^ ERROR E0393 LL | | //~| ERROR E0191 LL | | Sub; - | |_______________^ missing associated type `Output` value + | |_______________^ associated type `Output` must be specified error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-22599.rs b/src/test/ui/issues/issue-22599.rs index b9ea3583296..05096e5c185 100644 --- a/src/test/ui/issues/issue-22599.rs +++ b/src/test/ui/issues/issue-22599.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused_variables)] fn f(_: i32) {} diff --git a/src/test/ui/issues/issue-22599.stderr b/src/test/ui/issues/issue-22599.stderr index 19c9b94a430..bc4949da6f7 100644 --- a/src/test/ui/issues/issue-22599.stderr +++ b/src/test/ui/issues/issue-22599.stderr @@ -1,11 +1,11 @@ error: unused variable: `a` - --> $DIR/issue-22599.rs:18:19 + --> $DIR/issue-22599.rs:8:19 | LL | v = match 0 { a => 0 }; //~ ERROR: unused variable: `a` - | ^ help: consider using `_a` instead + | ^ help: consider prefixing with an underscore: `_a` | note: lint level defined here - --> $DIR/issue-22599.rs:11:9 + --> $DIR/issue-22599.rs:1:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-22603.rs b/src/test/ui/issues/issue-22603.rs index 271230ee427..e298316f3b9 100644 --- a/src/test/ui/issues/issue-22603.rs +++ b/src/test/ui/issues/issue-22603.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // skip-codegen // compile-pass #![feature(unboxed_closures, fn_traits)] diff --git a/src/test/ui/issues/issue-22638.rs b/src/test/ui/issues/issue-22638.rs index 10ea1077ede..fab24404eba 100644 --- a/src/test/ui/issues/issue-22638.rs +++ b/src/test/ui/issues/issue-22638.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // normalize-stderr-test: "<\[closure@.+`" -> "$$CLOSURE`" #![allow(unused)] diff --git a/src/test/ui/issues/issue-22638.stderr b/src/test/ui/issues/issue-22638.stderr index 299d74b08b8..ba7d5f07017 100644 --- a/src/test/ui/issues/issue-22638.stderr +++ b/src/test/ui/issues/issue-22638.stderr @@ -1,5 +1,5 @@ error: reached the type-length limit while instantiating `D::matches::$CLOSURE` - --> $DIR/issue-22638.rs:62:5 + --> $DIR/issue-22638.rs:52:5 | LL | / pub fn matches(&self, f: &F) { LL | | //~^ ERROR reached the type-length limit while instantiating `D::matches::<[closure diff --git a/src/test/ui/issues/issue-22644.rs b/src/test/ui/issues/issue-22644.rs index f787e43dbdf..9244ff5931d 100644 --- a/src/test/ui/issues/issue-22644.rs +++ b/src/test/ui/issues/issue-22644.rs @@ -1,15 +1,7 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#![feature(type_ascription)] fn main() { - let a : u32 = 0; + let a : usize = 0; let long_name : usize = 0; println!("{}", a as usize > long_name); diff --git a/src/test/ui/issues/issue-22644.stderr b/src/test/ui/issues/issue-22644.stderr index aeb465b2ab2..de97b2271b1 100644 --- a/src/test/ui/issues/issue-22644.stderr +++ b/src/test/ui/issues/issue-22644.stderr @@ -1,5 +1,5 @@ error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:16:31 + --> $DIR/issue-22644.rs:8:31 | LL | println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as a start of generic | ---------- ^ --------- interpreted as generic arguments @@ -8,7 +8,7 @@ LL | println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as | help: try comparing the cast value: `(a as usize)` error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:17:33 + --> $DIR/issue-22644.rs:9:33 | LL | println!("{}{}", a as usize < long_name, long_name); | ---------- ^ -------------------- interpreted as generic arguments @@ -17,7 +17,7 @@ LL | println!("{}{}", a as usize < long_name, long_name); | help: try comparing the cast value: `(a as usize)` error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:19:31 + --> $DIR/issue-22644.rs:11:31 | LL | println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start of generic | ---------- ^ - interpreted as generic arguments @@ -26,7 +26,7 @@ LL | println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start | help: try comparing the cast value: `(a as usize)` error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:21:31 + --> $DIR/issue-22644.rs:13:31 | LL | println!("{}{}", a: usize < long_name, long_name); | -------- ^ -------------------- interpreted as generic arguments @@ -35,7 +35,7 @@ LL | println!("{}{}", a: usize < long_name, long_name); | help: try comparing the cast value: `(a: usize)` error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:23:29 + --> $DIR/issue-22644.rs:15:29 | LL | println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start of generic | -------- ^ - interpreted as generic arguments @@ -44,7 +44,7 @@ LL | println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start o | help: try comparing the cast value: `(a: usize)` error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:28:20 + --> $DIR/issue-22644.rs:20:20 | LL | < //~ ERROR `<` is interpreted as a start of generic | ^ not interpreted as comparison @@ -58,7 +58,7 @@ LL | usize) | error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:37:20 + --> $DIR/issue-22644.rs:29:20 | LL | < //~ ERROR `<` is interpreted as a start of generic | ^ not interpreted as comparison @@ -75,7 +75,7 @@ LL | ... error: `<` is interpreted as a start of generic arguments for `usize`, not a shift - --> $DIR/issue-22644.rs:40:31 + --> $DIR/issue-22644.rs:32:31 | LL | println!("{}", a as usize << long_name); //~ ERROR `<` is interpreted as a start of generic | ---------- ^^ --------- interpreted as generic arguments @@ -84,7 +84,7 @@ LL | println!("{}", a as usize << long_name); //~ ERROR `<` is interpreted a | help: try shifting the cast value: `(a as usize)` error: expected type, found `4` - --> $DIR/issue-22644.rs:42:28 + --> $DIR/issue-22644.rs:34:28 | LL | println!("{}", a: &mut 4); //~ ERROR expected type, found `4` | ^ expecting a type here because of type ascription diff --git a/src/test/ui/issues/issue-22673.rs b/src/test/ui/issues/issue-22673.rs index 2396007c3df..ba8057b684d 100644 --- a/src/test/ui/issues/issue-22673.rs +++ b/src/test/ui/issues/issue-22673.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Expr : PartialEq { //~^ ERROR: cycle detected type Item; diff --git a/src/test/ui/issues/issue-22673.stderr b/src/test/ui/issues/issue-22673.stderr index 7e5b80c3711..9e7e4b218b1 100644 --- a/src/test/ui/issues/issue-22673.stderr +++ b/src/test/ui/issues/issue-22673.stderr @@ -1,10 +1,15 @@ error[E0391]: cycle detected when computing the supertraits of `Expr` - --> $DIR/issue-22673.rs:11:1 + --> $DIR/issue-22673.rs:1:1 | LL | trait Expr : PartialEq { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: ...which again requires computing the supertraits of `Expr`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/issue-22673.rs:1:1 + | +LL | trait Expr : PartialEq { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22684.rs b/src/test/ui/issues/issue-22684.rs index a791758ad17..a5b042706ed 100644 --- a/src/test/ui/issues/issue-22684.rs +++ b/src/test/ui/issues/issue-22684.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub struct Foo; impl Foo { diff --git a/src/test/ui/issues/issue-22684.stderr b/src/test/ui/issues/issue-22684.stderr index 2c868bc8778..6e2b2357a05 100644 --- a/src/test/ui/issues/issue-22684.stderr +++ b/src/test/ui/issues/issue-22684.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-22684.rs:27:17 + --> $DIR/issue-22684.rs:17:17 | LL | let _: () = foo::Foo.bar(); //~ ERROR mismatched types | ^^^^^^^^^^^^^^ expected (), found bool diff --git a/src/test/ui/issues/issue-22706.rs b/src/test/ui/issues/issue-22706.rs index 3d9ec0a6581..413a0d9a494 100644 --- a/src/test/ui/issues/issue-22706.rs +++ b/src/test/ui/issues/issue-22706.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn is_copy::Copy>() {} -//~^ ERROR type parameters are not allowed on this type [E0109] +//~^ ERROR type arguments are not allowed on this entity [E0109] fn main() {} diff --git a/src/test/ui/issues/issue-22706.stderr b/src/test/ui/issues/issue-22706.stderr index 2bbb3e5acad..a3cf716903d 100644 --- a/src/test/ui/issues/issue-22706.stderr +++ b/src/test/ui/issues/issue-22706.stderr @@ -1,8 +1,8 @@ -error[E0109]: type parameters are not allowed on this type - --> $DIR/issue-22706.rs:11:29 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/issue-22706.rs:1:29 | LL | fn is_copy::Copy>() {} - | ^^^ type parameter not allowed + | ^^^ type argument not allowed error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22777.rs b/src/test/ui/issues/issue-22777.rs index c97c10073e3..f9b264623d6 100644 --- a/src/test/ui/issues/issue-22777.rs +++ b/src/test/ui/issues/issue-22777.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // This test is reduced from libsyntax. It is just checking that we // can successfully deal with a "deep" structure, which the drop-check diff --git a/src/test/ui/issues/issue-22781.rs b/src/test/ui/issues/issue-22781.rs index 21e6138e496..5df3d88b168 100644 --- a/src/test/ui/issues/issue-22781.rs +++ b/src/test/ui/issues/issue-22781.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_variables)] use std::collections::HashMap; diff --git a/src/test/ui/issues/issue-22789.rs b/src/test/ui/issues/issue-22789.rs index 9b4c9eb2d43..e6680124f85 100644 --- a/src/test/ui/issues/issue-22789.rs +++ b/src/test/ui/issues/issue-22789.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![feature(unboxed_closures, fn_traits)] diff --git a/src/test/ui/issues/issue-2281-part1.rs b/src/test/ui/issues/issue-2281-part1.rs index e3fd9c48a52..8340ade2239 100644 --- a/src/test/ui/issues/issue-2281-part1.rs +++ b/src/test/ui/issues/issue-2281-part1.rs @@ -1,11 +1 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("{}", foobar); } //~ ERROR cannot find value `foobar` in this scope diff --git a/src/test/ui/issues/issue-2281-part1.stderr b/src/test/ui/issues/issue-2281-part1.stderr index e88cfe2b2ac..faf31c7bd4a 100644 --- a/src/test/ui/issues/issue-2281-part1.stderr +++ b/src/test/ui/issues/issue-2281-part1.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `foobar` in this scope - --> $DIR/issue-2281-part1.rs:11:28 + --> $DIR/issue-2281-part1.rs:1:28 | LL | fn main() { println!("{}", foobar); } //~ ERROR cannot find value `foobar` in this scope | ^^^^^^ not found in this scope diff --git a/src/test/ui/issues/issue-22814.rs b/src/test/ui/issues/issue-22814.rs index 0d11484d968..b008c751064 100644 --- a/src/test/ui/issues/issue-22814.rs +++ b/src/test/ui/issues/issue-22814.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass trait Test {} diff --git a/src/test/ui/issues/issue-22872.rs b/src/test/ui/issues/issue-22872.rs index 7a83b098e78..8ef4af15bd4 100644 --- a/src/test/ui/issues/issue-22872.rs +++ b/src/test/ui/issues/issue-22872.rs @@ -18,6 +18,7 @@ pub trait Process<'a> { fn push_process

(process: P) where P: Process<'static> { let _: Box Wrap<'b>> = Box::new(Wrapper(process)); +//~^ ERROR is not an iterator } fn main() {} diff --git a/src/test/ui/issues/issue-22872.stderr b/src/test/ui/issues/issue-22872.stderr index 231080add9b..ebd096f1dde 100644 --- a/src/test/ui/issues/issue-22872.stderr +++ b/src/test/ui/issues/issue-22872.stderr @@ -1,23 +1,14 @@ -error[E0277]: the trait bound `for<'b> P: Process<'b>` is not satisfied +error[E0277]: `

>::Item` is not an iterator --> $DIR/issue-22872.rs:20:36 | LL | let _: Box Wrap<'b>> = Box::new(Wrapper(process)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'b> Process<'b>` is not implemented for `P` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `

>::Item` is not an iterator | - = help: consider adding a `where for<'b> P: Process<'b>` bound + = help: the trait `std::iter::Iterator` is not implemented for `

>::Item` + = help: consider adding a `where

>::Item: std::iter::Iterator` bound = note: required because of the requirements on the impl of `for<'b> Wrap<'b>` for `Wrapper

` = note: required for the cast to the object type `dyn for<'b> Wrap<'b>` -error[E0277]: `

>::Item` is not an iterator - --> $DIR/issue-22872.rs:20:36 - | -LL | let _: Box Wrap<'b>> = Box::new(Wrapper(process)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `

>::Item` is not an iterator - | - = help: the trait `for<'b> std::iter::Iterator` is not implemented for `

>::Item` - = note: required because of the requirements on the impl of `for<'b> Wrap<'b>` for `Wrapper

` - = note: required for the cast to the object type `dyn for<'b> Wrap<'b>` - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-22874.rs b/src/test/ui/issues/issue-22874.rs index e0a87b3a174..37c6c814352 100644 --- a/src/test/ui/issues/issue-22874.rs +++ b/src/test/ui/issues/issue-22874.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Table { rows: [[String]], //~^ ERROR the size for values of type diff --git a/src/test/ui/issues/issue-22874.stderr b/src/test/ui/issues/issue-22874.stderr index a69ee7c9ff0..229f99f9064 100644 --- a/src/test/ui/issues/issue-22874.stderr +++ b/src/test/ui/issues/issue-22874.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `[std::string::String]` cannot be known at compilation time - --> $DIR/issue-22874.rs:12:5 + --> $DIR/issue-22874.rs:2:5 | LL | rows: [[String]], | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[std::string::String]` - = note: to learn more, visit + = note: to learn more, visit = note: slice and array elements must have `Sized` type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22886.rs b/src/test/ui/issues/issue-22886.rs index 4aa2571cad0..f8b576e094d 100644 --- a/src/test/ui/issues/issue-22886.rs +++ b/src/test/ui/issues/issue-22886.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #22886. fn crash_please() { diff --git a/src/test/ui/issues/issue-22886.stderr b/src/test/ui/issues/issue-22886.stderr index 0e05cbfa7ee..ff206e8113e 100644 --- a/src/test/ui/issues/issue-22886.stderr +++ b/src/test/ui/issues/issue-22886.stderr @@ -1,5 +1,5 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-22886.rs:23:6 + --> $DIR/issue-22886.rs:13:6 | LL | impl<'a> Iterator for Newtype { //~ ERROR E0207 | ^^ unconstrained lifetime parameter diff --git a/src/test/ui/issues/issue-22894.rs b/src/test/ui/issues/issue-22894.rs index f5ecd17d788..f5b26de54f5 100644 --- a/src/test/ui/issues/issue-22894.rs +++ b/src/test/ui/issues/issue-22894.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #[allow(dead_code)] static X: &'static str = &*""; diff --git a/src/test/ui/issues/issue-22933-1.rs b/src/test/ui/issues/issue-22933-1.rs index 41bd5d7188f..1bf8cb01cf7 100644 --- a/src/test/ui/issues/issue-22933-1.rs +++ b/src/test/ui/issues/issue-22933-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(warnings)] diff --git a/src/test/ui/issues/issue-22933-2.rs b/src/test/ui/issues/issue-22933-2.rs index e887c7760d6..68d9ef2cfa8 100644 --- a/src/test/ui/issues/issue-22933-2.rs +++ b/src/test/ui/issues/issue-22933-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Delicious { Pie = 0x1, Apple = 0x2, diff --git a/src/test/ui/issues/issue-22933-2.stderr b/src/test/ui/issues/issue-22933-2.stderr index 435a89b716f..97962adc2d2 100644 --- a/src/test/ui/issues/issue-22933-2.stderr +++ b/src/test/ui/issues/issue-22933-2.stderr @@ -1,11 +1,13 @@ error[E0599]: no variant named `PIE` found for type `Delicious` in the current scope - --> $DIR/issue-22933-2.rs:14:44 + --> $DIR/issue-22933-2.rs:4:55 | LL | enum Delicious { | -------------- variant `PIE` not found here ... LL | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, - | ^^^^^^^^^^^^^^ variant not found in `Delicious` + | -----------^^^ + | | + | variant not found in `Delicious` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22933-3.rs b/src/test/ui/issues/issue-22933-3.rs index 62adae41adf..8518ed34aee 100644 --- a/src/test/ui/issues/issue-22933-3.rs +++ b/src/test/ui/issues/issue-22933-3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const FOO: [u32; u8::MIN as usize] = []; //~^ ERROR no associated item named `MIN` found for type `u8` diff --git a/src/test/ui/issues/issue-22933-3.stderr b/src/test/ui/issues/issue-22933-3.stderr index 3d4d2df4d32..aa0052f9701 100644 --- a/src/test/ui/issues/issue-22933-3.stderr +++ b/src/test/ui/issues/issue-22933-3.stderr @@ -1,8 +1,10 @@ error[E0599]: no associated item named `MIN` found for type `u8` in the current scope - --> $DIR/issue-22933-3.rs:11:18 + --> $DIR/issue-22933-3.rs:1:22 | LL | const FOO: [u32; u8::MIN as usize] = []; - | ^^^^^^^ associated item not found in `u8` + | ----^^^ + | | + | associated item not found in `u8` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23024.rs b/src/test/ui/issues/issue-23024.rs index 1c2c815ea9c..0639ce30aa0 100644 --- a/src/test/ui/issues/issue-23024.rs +++ b/src/test/ui/issues/issue-23024.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] use std::any::Any; diff --git a/src/test/ui/issues/issue-23024.stderr b/src/test/ui/issues/issue-23024.stderr index 129d0945303..a972b36b804 100644 --- a/src/test/ui/issues/issue-23024.stderr +++ b/src/test/ui/issues/issue-23024.stderr @@ -1,5 +1,5 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625) - --> $DIR/issue-23024.rs:19:35 + --> $DIR/issue-23024.rs:9:35 | LL | println!("{:?}",(vfnfer[0] as Fn)(3)); | ^^ @@ -7,16 +7,16 @@ LL | println!("{:?}",(vfnfer[0] as Fn)(3)); = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0107]: wrong number of type arguments: expected 1, found 0 - --> $DIR/issue-23024.rs:19:35 + --> $DIR/issue-23024.rs:9:35 | LL | println!("{:?}",(vfnfer[0] as Fn)(3)); | ^^ expected 1 type argument error[E0191]: the value of the associated type `Output` (from the trait `std::ops::FnOnce`) must be specified - --> $DIR/issue-23024.rs:19:35 + --> $DIR/issue-23024.rs:9:35 | LL | println!("{:?}",(vfnfer[0] as Fn)(3)); - | ^^ missing associated type `Output` value + | ^^ associated type `Output` must be specified error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-23041.rs b/src/test/ui/issues/issue-23041.rs index 1a9bb4c29f3..a18e85806d9 100644 --- a/src/test/ui/issues/issue-23041.rs +++ b/src/test/ui/issues/issue-23041.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::any::Any; fn main() { diff --git a/src/test/ui/issues/issue-23041.stderr b/src/test/ui/issues/issue-23041.stderr index e97a97fec09..aa6ffdd2570 100644 --- a/src/test/ui/issues/issue-23041.stderr +++ b/src/test/ui/issues/issue-23041.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-23041.rs:16:22 + --> $DIR/issue-23041.rs:6:22 | LL | b.downcast_ref::_>(); //~ ERROR E0282 | ^^^^^^^^ cannot infer type diff --git a/src/test/ui/issues/issue-23046.rs b/src/test/ui/issues/issue-23046.rs index 670706b7a9a..898654b7b59 100644 --- a/src/test/ui/issues/issue-23046.rs +++ b/src/test/ui/issues/issue-23046.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum Expr<'var, VAR> { Let(Box>, Box Fn(Expr<'v, VAR>) -> Expr<'v, VAR> + 'var>) diff --git a/src/test/ui/issues/issue-23046.stderr b/src/test/ui/issues/issue-23046.stderr index 3e5b4ec91d7..9b7599e1e35 100644 --- a/src/test/ui/issues/issue-23046.stderr +++ b/src/test/ui/issues/issue-23046.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-23046.rs:27:15 + --> $DIR/issue-23046.rs:17:15 | LL | let ex = |x| { //~ ERROR type annotations needed | ^ consider giving this closure parameter a type diff --git a/src/test/ui/issues/issue-23073.rs b/src/test/ui/issues/issue-23073.rs index 2d219177a80..a0ca91336c3 100644 --- a/src/test/ui/issues/issue-23073.rs +++ b/src/test/ui/issues/issue-23073.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_type_defaults)] trait Foo { type T; } diff --git a/src/test/ui/issues/issue-23073.stderr b/src/test/ui/issues/issue-23073.stderr index ef2430561ec..e3ddd190d4f 100644 --- a/src/test/ui/issues/issue-23073.stderr +++ b/src/test/ui/issues/issue-23073.stderr @@ -1,5 +1,5 @@ error[E0223]: ambiguous associated type - --> $DIR/issue-23073.rs:16:17 + --> $DIR/issue-23073.rs:6:17 | LL | type FooT = <::Foo>::T; //~ ERROR ambiguous associated type | ^^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<::Foo as Trait>::T` diff --git a/src/test/ui/issues/issue-23080-2.rs b/src/test/ui/issues/issue-23080-2.rs index fc365a4b9aa..750b7e19d89 100644 --- a/src/test/ui/issues/issue-23080-2.rs +++ b/src/test/ui/issues/issue-23080-2.rs @@ -1,16 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength -//~^^^^^^^^^^^^ ERROR +//~^^ ERROR #![feature(optin_builtin_traits)] diff --git a/src/test/ui/issues/issue-23080-2.stderr b/src/test/ui/issues/issue-23080-2.stderr index dda7fbd69cf..db9a6488851 100644 --- a/src/test/ui/issues/issue-23080-2.stderr +++ b/src/test/ui/issues/issue-23080-2.stderr @@ -1,5 +1,5 @@ error[E0380]: auto traits cannot have methods or associated items - --> $DIR/issue-23080-2.rs:17:1 + --> $DIR/issue-23080-2.rs:7:1 | LL | / unsafe auto trait Trait { LL | | //~^ ERROR E0380 diff --git a/src/test/ui/issues/issue-23080.rs b/src/test/ui/issues/issue-23080.rs index 153b6fd07e6..e25a2d916f5 100644 --- a/src/test/ui/issues/issue-23080.rs +++ b/src/test/ui/issues/issue-23080.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![feature(optin_builtin_traits)] diff --git a/src/test/ui/issues/issue-23080.stderr b/src/test/ui/issues/issue-23080.stderr index 43e6f296033..cace9a57507 100644 --- a/src/test/ui/issues/issue-23080.stderr +++ b/src/test/ui/issues/issue-23080.stderr @@ -1,5 +1,5 @@ error[E0380]: auto traits cannot have methods or associated items - --> $DIR/issue-23080.rs:15:1 + --> $DIR/issue-23080.rs:5:1 | LL | / unsafe auto trait Trait { LL | | //~^ ERROR E0380 diff --git a/src/test/ui/issues/issue-2311-2.rs b/src/test/ui/issues/issue-2311-2.rs index cc6376eb668..40cda23186a 100644 --- a/src/test/ui/issues/issue-2311-2.rs +++ b/src/test/ui/issues/issue-2311-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/ui/issues/issue-2311.rs b/src/test/ui/issues/issue-2311.rs index 77e014e2785..07b9951e68d 100644 --- a/src/test/ui/issues/issue-2311.rs +++ b/src/test/ui/issues/issue-2311.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(non_camel_case_types)] diff --git a/src/test/ui/issues/issue-2312.rs b/src/test/ui/issues/issue-2312.rs index 0de460a30ab..1fc7b5a3f34 100644 --- a/src/test/ui/issues/issue-2312.rs +++ b/src/test/ui/issues/issue-2312.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/ui/issues/issue-23122-1.rs b/src/test/ui/issues/issue-23122-1.rs index 36d8450848d..a882aa36af7 100644 --- a/src/test/ui/issues/issue-23122-1.rs +++ b/src/test/ui/issues/issue-23122-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Next { type Next: Next; } diff --git a/src/test/ui/issues/issue-23122-1.stderr b/src/test/ui/issues/issue-23122-1.stderr index a0e5386c111..39dd424a86c 100644 --- a/src/test/ui/issues/issue-23122-1.stderr +++ b/src/test/ui/issues/issue-23122-1.stderr @@ -1,5 +1,5 @@ error[E0275]: overflow evaluating the requirement ` as Next>::Next` - --> $DIR/issue-23122-1.rs:17:15 + --> $DIR/issue-23122-1.rs:7:15 | LL | impl Next for GetNext { | ^^^^ diff --git a/src/test/ui/issues/issue-23122-2.rs b/src/test/ui/issues/issue-23122-2.rs index faaf78f894b..b8411200343 100644 --- a/src/test/ui/issues/issue-23122-2.rs +++ b/src/test/ui/issues/issue-23122-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Next { type Next: Next; } diff --git a/src/test/ui/issues/issue-23122-2.stderr b/src/test/ui/issues/issue-23122-2.stderr index 9620f893386..85928775811 100644 --- a/src/test/ui/issues/issue-23122-2.stderr +++ b/src/test/ui/issues/issue-23122-2.stderr @@ -1,5 +1,5 @@ error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: std::marker::Sized` - --> $DIR/issue-23122-2.rs:17:15 + --> $DIR/issue-23122-2.rs:7:15 | LL | impl Next for GetNext { | ^^^^ diff --git a/src/test/ui/issues/issue-23173.rs b/src/test/ui/issues/issue-23173.rs index 17e5317b9fe..2922ebddf4c 100644 --- a/src/test/ui/issues/issue-23173.rs +++ b/src/test/ui/issues/issue-23173.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } struct Struct { a: usize, diff --git a/src/test/ui/issues/issue-23173.stderr b/src/test/ui/issues/issue-23173.stderr index d58a4d2b8f8..98c4f867ad6 100644 --- a/src/test/ui/issues/issue-23173.stderr +++ b/src/test/ui/issues/issue-23173.stderr @@ -1,38 +1,46 @@ error[E0599]: no variant named `Homura` found for type `Token` in the current scope - --> $DIR/issue-23173.rs:19:16 + --> $DIR/issue-23173.rs:9:23 | LL | enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ } | ---------- variant `Homura` not found here ... LL | use_token(&Token::Homura); - | ^^^^^^^^^^^^^ variant not found in `Token` + | -------^^^^^^ + | | + | variant not found in `Token` error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope - --> $DIR/issue-23173.rs:21:5 + --> $DIR/issue-23173.rs:11:13 | LL | struct Struct { | ------------- function or associated item `method` not found for this ... LL | Struct::method(); - | ^^^^^^^^^^^^^^ function or associated item not found in `Struct` + | --------^^^^^^ + | | + | function or associated item not found in `Struct` error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope - --> $DIR/issue-23173.rs:23:5 + --> $DIR/issue-23173.rs:13:13 | LL | struct Struct { | ------------- function or associated item `method` not found for this ... LL | Struct::method; - | ^^^^^^^^^^^^^^ function or associated item not found in `Struct` + | --------^^^^^^ + | | + | function or associated item not found in `Struct` error[E0599]: no associated item named `Assoc` found for type `Struct` in the current scope - --> $DIR/issue-23173.rs:25:5 + --> $DIR/issue-23173.rs:15:13 | LL | struct Struct { | ------------- associated item `Assoc` not found for this ... LL | Struct::Assoc; - | ^^^^^^^^^^^^^ associated item not found in `Struct` + | --------^^^^^ + | | + | associated item not found in `Struct` error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-23189.rs b/src/test/ui/issues/issue-23189.rs index 7a475d1a6ab..e5526357cb0 100644 --- a/src/test/ui/issues/issue-23189.rs +++ b/src/test/ui/issues/issue-23189.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod module {} fn main() { diff --git a/src/test/ui/issues/issue-23189.stderr b/src/test/ui/issues/issue-23189.stderr index c7bbab4524d..82c6ed9c062 100644 --- a/src/test/ui/issues/issue-23189.stderr +++ b/src/test/ui/issues/issue-23189.stderr @@ -1,5 +1,5 @@ error[E0574]: expected struct, variant or union type, found module `module` - --> $DIR/issue-23189.rs:14:13 + --> $DIR/issue-23189.rs:4:13 | LL | let _ = module { x: 0 }; //~ERROR expected struct | ^^^^^^ not a struct, variant or union type diff --git a/src/test/ui/issues/issue-23217.rs b/src/test/ui/issues/issue-23217.rs index dc51adf42aa..11426df6177 100644 --- a/src/test/ui/issues/issue-23217.rs +++ b/src/test/ui/issues/issue-23217.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum SomeEnum { B = SomeEnum::A, //~^ ERROR no variant named `A` found for type `SomeEnum` diff --git a/src/test/ui/issues/issue-23217.stderr b/src/test/ui/issues/issue-23217.stderr index d87f239bca6..9cad002036f 100644 --- a/src/test/ui/issues/issue-23217.stderr +++ b/src/test/ui/issues/issue-23217.stderr @@ -1,12 +1,13 @@ error[E0599]: no variant named `A` found for type `SomeEnum` in the current scope - --> $DIR/issue-23217.rs:12:9 + --> $DIR/issue-23217.rs:2:19 | LL | pub enum SomeEnum { | ----------------- variant `A` not found here LL | B = SomeEnum::A, - | ^^^^^^^^^^^ variant not found in `SomeEnum` - | - = note: did you mean `SomeEnum::B`? + | ----------^ + | | | + | | help: did you mean: `B` + | variant not found in `SomeEnum` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23253.rs b/src/test/ui/issues/issue-23253.rs index 626604a87a7..22b55c28581 100644 --- a/src/test/ui/issues/issue-23253.rs +++ b/src/test/ui/issues/issue-23253.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { Bar } fn main() { diff --git a/src/test/ui/issues/issue-23253.stderr b/src/test/ui/issues/issue-23253.stderr index f14ee510bd8..be5714cd91a 100644 --- a/src/test/ui/issues/issue-23253.stderr +++ b/src/test/ui/issues/issue-23253.stderr @@ -1,5 +1,5 @@ error[E0609]: no field `a` on type `Foo` - --> $DIR/issue-23253.rs:14:14 + --> $DIR/issue-23253.rs:4:14 | LL | Foo::Bar.a; | ^ diff --git a/src/test/ui/issues/issue-23281.rs b/src/test/ui/issues/issue-23281.rs index 5de00eb8f68..98a0495451d 100644 --- a/src/test/ui/issues/issue-23281.rs +++ b/src/test/ui/issues/issue-23281.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength pub struct Struct; diff --git a/src/test/ui/issues/issue-23281.stderr b/src/test/ui/issues/issue-23281.stderr index 78db19d6b06..1e57774afe5 100644 --- a/src/test/ui/issues/issue-23281.stderr +++ b/src/test/ui/issues/issue-23281.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `(dyn std::ops::Fn() + 'static)` cannot be known at compilation time - --> $DIR/issue-23281.rs:16:5 + --> $DIR/issue-23281.rs:6:5 | LL | pub fn function(funs: Vec ()>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: required by `std::vec::Vec` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2330.rs b/src/test/ui/issues/issue-2330.rs index f1a282695ac..4560caba0cf 100644 --- a/src/test/ui/issues/issue-2330.rs +++ b/src/test/ui/issues/issue-2330.rs @@ -1,21 +1,11 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +enum Chan { } -enum chan { } - -trait channel { +trait Channel { fn send(&self, v: T); } -// `chan` is not a trait, it's an enum -impl chan for isize { //~ ERROR expected trait, found enum `chan` +// `Chan` is not a trait, it's an enum +impl Chan for isize { //~ ERROR expected trait, found enum `Chan` fn send(&self, v: isize) { panic!() } } diff --git a/src/test/ui/issues/issue-2330.stderr b/src/test/ui/issues/issue-2330.stderr index 6b1d5e3b219..472ad199a63 100644 --- a/src/test/ui/issues/issue-2330.stderr +++ b/src/test/ui/issues/issue-2330.stderr @@ -1,7 +1,7 @@ -error[E0404]: expected trait, found enum `chan` - --> $DIR/issue-2330.rs:18:6 +error[E0404]: expected trait, found enum `Chan` + --> $DIR/issue-2330.rs:8:6 | -LL | impl chan for isize { //~ ERROR expected trait, found enum `chan` +LL | impl Chan for isize { //~ ERROR expected trait, found enum `Chan` | ^^^^ not a trait error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23302-1.rs b/src/test/ui/issues/issue-23302-1.rs index 10a53830116..24e79dc5811 100644 --- a/src/test/ui/issues/issue-23302-1.rs +++ b/src/test/ui/issues/issue-23302-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that an enum with recursion in the discriminant throws // the appropriate error (rather than, say, blowing the stack). enum X { diff --git a/src/test/ui/issues/issue-23302-1.stderr b/src/test/ui/issues/issue-23302-1.stderr index dcf021de57e..ed422e10c98 100644 --- a/src/test/ui/issues/issue-23302-1.stderr +++ b/src/test/ui/issues/issue-23302-1.stderr @@ -1,12 +1,12 @@ error[E0391]: cycle detected when processing `X::A::{{constant}}` - --> $DIR/issue-23302-1.rs:14:9 + --> $DIR/issue-23302-1.rs:4:9 | LL | A = X::A as isize, //~ ERROR E0391 | ^^^^^^^^^^^^^ | = note: ...which again requires processing `X::A::{{constant}}`, completing the cycle note: cycle used when const-evaluating `X::A::{{constant}}` - --> $DIR/issue-23302-1.rs:14:9 + --> $DIR/issue-23302-1.rs:4:9 | LL | A = X::A as isize, //~ ERROR E0391 | ^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-23302-2.rs b/src/test/ui/issues/issue-23302-2.rs index d1af19eb579..e89c7eab503 100644 --- a/src/test/ui/issues/issue-23302-2.rs +++ b/src/test/ui/issues/issue-23302-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Since `Y::B` here defaults to `Y::A+1`, this is also a // recursive definition. enum Y { diff --git a/src/test/ui/issues/issue-23302-2.stderr b/src/test/ui/issues/issue-23302-2.stderr index 146f86127c5..b6d44ceec9d 100644 --- a/src/test/ui/issues/issue-23302-2.stderr +++ b/src/test/ui/issues/issue-23302-2.stderr @@ -1,12 +1,12 @@ error[E0391]: cycle detected when processing `Y::A::{{constant}}` - --> $DIR/issue-23302-2.rs:14:9 + --> $DIR/issue-23302-2.rs:4:9 | LL | A = Y::B as isize, //~ ERROR E0391 | ^^^^^^^^^^^^^ | = note: ...which again requires processing `Y::A::{{constant}}`, completing the cycle note: cycle used when const-evaluating `Y::A::{{constant}}` - --> $DIR/issue-23302-2.rs:14:9 + --> $DIR/issue-23302-2.rs:4:9 | LL | A = Y::B as isize, //~ ERROR E0391 | ^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-23302-3.rs b/src/test/ui/issues/issue-23302-3.rs index c3664e0abe1..da75f330798 100644 --- a/src/test/ui/issues/issue-23302-3.rs +++ b/src/test/ui/issues/issue-23302-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const A: i32 = B; //~ ERROR cycle detected const B: i32 = A; diff --git a/src/test/ui/issues/issue-23302-3.stderr b/src/test/ui/issues/issue-23302-3.stderr index 54edf42679a..392769b4c56 100644 --- a/src/test/ui/issues/issue-23302-3.stderr +++ b/src/test/ui/issues/issue-23302-3.stderr @@ -1,21 +1,21 @@ error[E0391]: cycle detected when const checking if rvalue is promotable to static `A` - --> $DIR/issue-23302-3.rs:11:1 + --> $DIR/issue-23302-3.rs:1:1 | LL | const A: i32 = B; //~ ERROR cycle detected | ^^^^^^^^^^^^^^^^^ | note: ...which requires checking which parts of `A` are promotable to static... - --> $DIR/issue-23302-3.rs:11:16 + --> $DIR/issue-23302-3.rs:1:16 | LL | const A: i32 = B; //~ ERROR cycle detected | ^ note: ...which requires const checking if rvalue is promotable to static `B`... - --> $DIR/issue-23302-3.rs:13:1 + --> $DIR/issue-23302-3.rs:3:1 | LL | const B: i32 = A; | ^^^^^^^^^^^^^^^^^ note: ...which requires checking which parts of `B` are promotable to static... - --> $DIR/issue-23302-3.rs:13:16 + --> $DIR/issue-23302-3.rs:3:16 | LL | const B: i32 = A; | ^ diff --git a/src/test/ui/issues/issue-23406.rs b/src/test/ui/issues/issue-23406.rs index eef35fe6f24..9d77af0914f 100644 --- a/src/test/ui/issues/issue-23406.rs +++ b/src/test/ui/issues/issue-23406.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] trait Inner { diff --git a/src/test/ui/issues/issue-23442.rs b/src/test/ui/issues/issue-23442.rs index 9907cf6b687..c3b613a06cd 100644 --- a/src/test/ui/issues/issue-23442.rs +++ b/src/test/ui/issues/issue-23442.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] use std::marker::PhantomData; diff --git a/src/test/ui/issues/issue-23477.rs b/src/test/ui/issues/issue-23477.rs index 6d4fdcd08b6..f363e6a0f47 100644 --- a/src/test/ui/issues/issue-23477.rs +++ b/src/test/ui/issues/issue-23477.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // compiler-flags: -g diff --git a/src/test/ui/issues/issue-23543.rs b/src/test/ui/issues/issue-23543.rs index 4ed44154c47..843e1a8a83a 100644 --- a/src/test/ui/issues/issue-23543.rs +++ b/src/test/ui/issues/issue-23543.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait A: Copy {} struct Foo; diff --git a/src/test/ui/issues/issue-23543.stderr b/src/test/ui/issues/issue-23543.stderr index ea443f1cbbb..ebb70afe316 100644 --- a/src/test/ui/issues/issue-23543.stderr +++ b/src/test/ui/issues/issue-23543.stderr @@ -1,5 +1,5 @@ error[E0229]: associated type bindings are not allowed here - --> $DIR/issue-23543.rs:17:17 + --> $DIR/issue-23543.rs:7:17 | LL | where T: A; | ^^^^^^^^^^^ associated type not allowed here diff --git a/src/test/ui/issues/issue-23544.rs b/src/test/ui/issues/issue-23544.rs index 1d7c2187045..6ad00b2fba4 100644 --- a/src/test/ui/issues/issue-23544.rs +++ b/src/test/ui/issues/issue-23544.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait A: Copy {} pub trait D { diff --git a/src/test/ui/issues/issue-23544.stderr b/src/test/ui/issues/issue-23544.stderr index 147e2a212ed..c912baccb49 100644 --- a/src/test/ui/issues/issue-23544.stderr +++ b/src/test/ui/issues/issue-23544.stderr @@ -1,5 +1,5 @@ error[E0229]: associated type bindings are not allowed here - --> $DIR/issue-23544.rs:15:17 + --> $DIR/issue-23544.rs:5:17 | LL | where T: A; | ^^^^^^^^^^^^^^^^^^^^^^^ associated type not allowed here diff --git a/src/test/ui/issues/issue-23550.rs b/src/test/ui/issues/issue-23550.rs index e5b672bc3e7..370d5c5aa3e 100644 --- a/src/test/ui/issues/issue-23550.rs +++ b/src/test/ui/issues/issue-23550.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(core_intrinsics)] #![allow(warnings)] diff --git a/src/test/ui/issues/issue-23589.rs b/src/test/ui/issues/issue-23589.rs index 1c1d42da029..1c640af8d02 100644 --- a/src/test/ui/issues/issue-23589.rs +++ b/src/test/ui/issues/issue-23589.rs @@ -1,14 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let v: Vec(&str) = vec!['1', '2']; - //~^ ERROR parenthesized parameters may only be used with a trait + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait + //~| ERROR mismatched types } diff --git a/src/test/ui/issues/issue-23589.stderr b/src/test/ui/issues/issue-23589.stderr index f0c07b380b4..bc2007ba39c 100644 --- a/src/test/ui/issues/issue-23589.stderr +++ b/src/test/ui/issues/issue-23589.stderr @@ -1,9 +1,22 @@ -error[E0214]: parenthesized parameters may only be used with a trait - --> $DIR/issue-23589.rs:12:15 +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-23589.rs:2:15 | LL | let v: Vec(&str) = vec!['1', '2']; - | ^^^^^^ only traits may use parentheses + | ^^^^^^ + | | + | only `Fn` traits may use parentheses + | help: use angle brackets instead: `<&str>` -error: aborting due to previous error +error[E0308]: mismatched types + --> $DIR/issue-23589.rs:2:29 + | +LL | let v: Vec(&str) = vec!['1', '2']; + | ^^^ expected &str, found char + | + = note: expected type `&str` + found type `char` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0214`. +Some errors occurred: E0214, E0308. +For more information about an error, try `rustc --explain E0214`. diff --git a/src/test/ui/issues/issue-23595-2.rs b/src/test/ui/issues/issue-23595-2.rs index 6a3ce03fce5..2bfee7a35fa 100644 --- a/src/test/ui/issues/issue-23595-2.rs +++ b/src/test/ui/issues/issue-23595-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_type_defaults)] pub struct C {a:AType} diff --git a/src/test/ui/issues/issue-23595-2.stderr b/src/test/ui/issues/issue-23595-2.stderr index 5ddaab6abfe..f1004db0b09 100644 --- a/src/test/ui/issues/issue-23595-2.stderr +++ b/src/test/ui/issues/issue-23595-2.stderr @@ -1,5 +1,5 @@ error[E0220]: associated type `anything_here_kills_it` not found for `Self` - --> $DIR/issue-23595-2.rs:16:16 + --> $DIR/issue-23595-2.rs:6:16 | LL | type B = C; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `anything_here_kills_it` not found diff --git a/src/test/ui/issues/issue-23649-3.rs b/src/test/ui/issues/issue-23649-3.rs index b2c9183c16c..718fe606b80 100644 --- a/src/test/ui/issues/issue-23649-3.rs +++ b/src/test/ui/issues/issue-23649-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #[derive(PartialEq)] struct Slice { slice: [u8] } diff --git a/src/test/ui/issues/issue-23716.rs b/src/test/ui/issues/issue-23716.rs index 7b72e5689ba..e9139c0aa14 100644 --- a/src/test/ui/issues/issue-23716.rs +++ b/src/test/ui/issues/issue-23716.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static foo: i32 = 0; fn bar(foo: i32) {} diff --git a/src/test/ui/issues/issue-23716.stderr b/src/test/ui/issues/issue-23716.stderr index c175f197034..e7bebfbbcb5 100644 --- a/src/test/ui/issues/issue-23716.stderr +++ b/src/test/ui/issues/issue-23716.stderr @@ -1,5 +1,5 @@ error[E0530]: function parameters cannot shadow statics - --> $DIR/issue-23716.rs:13:8 + --> $DIR/issue-23716.rs:3:8 | LL | static foo: i32 = 0; | -------------------- the static `foo` is defined here @@ -8,7 +8,7 @@ LL | fn bar(foo: i32) {} | ^^^ cannot be named the same as a static error[E0530]: function parameters cannot shadow statics - --> $DIR/issue-23716.rs:23:13 + --> $DIR/issue-23716.rs:13:13 | LL | use self::submod::answer; | -------------------- the static `answer` is imported here diff --git a/src/test/ui/issues/issue-23966.rs b/src/test/ui/issues/issue-23966.rs index 544d3c8af20..5fdec28ac2c 100644 --- a/src/test/ui/issues/issue-23966.rs +++ b/src/test/ui/issues/issue-23966.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { "".chars().fold(|_, _| (), ()); //~^ ERROR E0277 diff --git a/src/test/ui/issues/issue-23966.stderr b/src/test/ui/issues/issue-23966.stderr index 0418933180c..ac64067db10 100644 --- a/src/test/ui/issues/issue-23966.stderr +++ b/src/test/ui/issues/issue-23966.stderr @@ -1,5 +1,5 @@ error[E0277]: expected a `std::ops::FnMut<(_, char)>` closure, found `()` - --> $DIR/issue-23966.rs:12:16 + --> $DIR/issue-23966.rs:2:16 | LL | "".chars().fold(|_, _| (), ()); | ^^^^ expected an `FnMut<(_, char)>` closure, found `()` diff --git a/src/test/ui/issues/issue-24013.rs b/src/test/ui/issues/issue-24013.rs index a7232781f6f..c6d30167127 100644 --- a/src/test/ui/issues/issue-24013.rs +++ b/src/test/ui/issues/issue-24013.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { use std::mem::{transmute, swap}; let a = 1; diff --git a/src/test/ui/issues/issue-24013.stderr b/src/test/ui/issues/issue-24013.stderr index 5729bdf2064..4e3cb88297d 100644 --- a/src/test/ui/issues/issue-24013.stderr +++ b/src/test/ui/issues/issue-24013.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-24013.rs:15:20 + --> $DIR/issue-24013.rs:5:20 | LL | unsafe {swap::<&mut _>(transmute(&a), transmute(&b))}; | ^^^^^^ cannot infer type diff --git a/src/test/ui/issues/issue-24036.rs b/src/test/ui/issues/issue-24036.rs index 94ac17de4c0..3642085934a 100644 --- a/src/test/ui/issues/issue-24036.rs +++ b/src/test/ui/issues/issue-24036.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn closure_to_loc() { let mut x = |c| c + 1; x = |c| c + 1; diff --git a/src/test/ui/issues/issue-24036.stderr b/src/test/ui/issues/issue-24036.stderr index 24995be773e..9f799c9b450 100644 --- a/src/test/ui/issues/issue-24036.stderr +++ b/src/test/ui/issues/issue-24036.stderr @@ -1,16 +1,16 @@ error[E0308]: mismatched types - --> $DIR/issue-24036.rs:13:9 + --> $DIR/issue-24036.rs:3:9 | LL | x = |c| c + 1; | ^^^^^^^^^ expected closure, found a different closure | - = note: expected type `[closure@$DIR/issue-24036.rs:12:17: 12:26]` - found type `[closure@$DIR/issue-24036.rs:13:9: 13:18]` + = note: expected type `[closure@$DIR/issue-24036.rs:2:17: 2:26]` + found type `[closure@$DIR/issue-24036.rs:3:9: 3:18]` = note: no two closures, even if identical, have the same type = help: consider boxing your closure and/or using it as a trait object error[E0308]: match arms have incompatible types - --> $DIR/issue-24036.rs:18:13 + --> $DIR/issue-24036.rs:8:13 | LL | let x = match 1usize { | _____________^ @@ -22,8 +22,8 @@ LL | | _ => |c| c - 1 LL | | }; | |_____^ expected closure, found a different closure | - = note: expected type `[closure@$DIR/issue-24036.rs:20:14: 20:23]` - found type `[closure@$DIR/issue-24036.rs:21:14: 21:23]` + = note: expected type `[closure@$DIR/issue-24036.rs:10:14: 10:23]` + found type `[closure@$DIR/issue-24036.rs:11:14: 11:23]` = note: no two closures, even if identical, have the same type = help: consider boxing your closure and/or using it as a trait object diff --git a/src/test/ui/issues/issue-24081.rs b/src/test/ui/issues/issue-24081.rs index 16530c509f2..10983ce11b5 100644 --- a/src/test/ui/issues/issue-24081.rs +++ b/src/test/ui/issues/issue-24081.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Add; use std::ops::Sub; use std::ops::Mul; diff --git a/src/test/ui/issues/issue-24081.stderr b/src/test/ui/issues/issue-24081.stderr index f9a97ac7c99..999ac0d5570 100644 --- a/src/test/ui/issues/issue-24081.stderr +++ b/src/test/ui/issues/issue-24081.stderr @@ -1,5 +1,5 @@ error[E0255]: the name `Add` is defined multiple times - --> $DIR/issue-24081.rs:17:1 + --> $DIR/issue-24081.rs:7:1 | LL | use std::ops::Add; | ------------- previous import of the trait `Add` here @@ -14,7 +14,7 @@ LL | use std::ops::Add as OtherAdd; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0255]: the name `Sub` is defined multiple times - --> $DIR/issue-24081.rs:19:1 + --> $DIR/issue-24081.rs:9:1 | LL | use std::ops::Sub; | ------------- previous import of the trait `Sub` here @@ -29,7 +29,7 @@ LL | use std::ops::Sub as OtherSub; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0255]: the name `Mul` is defined multiple times - --> $DIR/issue-24081.rs:21:1 + --> $DIR/issue-24081.rs:11:1 | LL | use std::ops::Mul; | ------------- previous import of the trait `Mul` here @@ -44,7 +44,7 @@ LL | use std::ops::Mul as OtherMul; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0255]: the name `Div` is defined multiple times - --> $DIR/issue-24081.rs:23:1 + --> $DIR/issue-24081.rs:13:1 | LL | use std::ops::Div; | ------------- previous import of the trait `Div` here @@ -59,7 +59,7 @@ LL | use std::ops::Div as OtherDiv; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0255]: the name `Rem` is defined multiple times - --> $DIR/issue-24081.rs:25:1 + --> $DIR/issue-24081.rs:15:1 | LL | use std::ops::Rem; | ------------- previous import of the trait `Rem` here diff --git a/src/test/ui/issues/issue-24085.rs b/src/test/ui/issues/issue-24085.rs index e74f993df67..d06647762a9 100644 --- a/src/test/ui/issues/issue-24085.rs +++ b/src/test/ui/issues/issue-24085.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Regression test for #24085. Errors were occurring in region diff --git a/src/test/ui/issues/issue-24161.rs b/src/test/ui/issues/issue-24161.rs index fb50f4dc8db..99b09ba74d5 100644 --- a/src/test/ui/issues/issue-24161.rs +++ b/src/test/ui/issues/issue-24161.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #[derive(Copy,Clone)] diff --git a/src/test/ui/issues/issue-24204.rs b/src/test/ui/issues/issue-24204.rs index 2a012da0083..61671b32e9b 100644 --- a/src/test/ui/issues/issue-24204.rs +++ b/src/test/ui/issues/issue-24204.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] trait MultiDispatch { diff --git a/src/test/ui/issues/issue-24204.stderr b/src/test/ui/issues/issue-24204.stderr index 809db284032..8e04c0ddcce 100644 --- a/src/test/ui/issues/issue-24204.stderr +++ b/src/test/ui/issues/issue-24204.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving `<::A as MultiDispatch>::O == T` - --> $DIR/issue-24204.rs:24:1 + --> $DIR/issue-24204.rs:14:1 | LL | fn test>(b: i32) -> T where T::A: MultiDispatch { T::new(b) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found type parameter @@ -7,7 +7,7 @@ LL | fn test>(b: i32) -> T where T::A: MultiDispatch { T::n = note: expected type `<::A as MultiDispatch>::O` found type `T` note: required by `Trait` - --> $DIR/issue-24204.rs:17:1 + --> $DIR/issue-24204.rs:7:1 | LL | trait Trait: Sized { | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-24227.rs b/src/test/ui/issues/issue-24227.rs index f2c67e19eef..83e12caff6d 100644 --- a/src/test/ui/issues/issue-24227.rs +++ b/src/test/ui/issues/issue-24227.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // This resulted in an ICE. Test for future-proofing // Issue #24227 diff --git a/src/test/ui/issues/issue-24267-flow-exit.nll.stderr b/src/test/ui/issues/issue-24267-flow-exit.nll.stderr index cf3553c6b0d..52e637a3f0b 100644 --- a/src/test/ui/issues/issue-24267-flow-exit.nll.stderr +++ b/src/test/ui/issues/issue-24267-flow-exit.nll.stderr @@ -1,11 +1,11 @@ error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/issue-24267-flow-exit.rs:22:20 + --> $DIR/issue-24267-flow-exit.rs:12:20 | LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/issue-24267-flow-exit.rs:28:20 + --> $DIR/issue-24267-flow-exit.rs:18:20 | LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/issues/issue-24267-flow-exit.rs b/src/test/ui/issues/issue-24267-flow-exit.rs index 4aca6bf38e1..ce3a799fb38 100644 --- a/src/test/ui/issues/issue-24267-flow-exit.rs +++ b/src/test/ui/issues/issue-24267-flow-exit.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensure that we reject code when a nonlocal exit (`break`, // `continue`) causes us to pop over a needed assignment. diff --git a/src/test/ui/issues/issue-24267-flow-exit.stderr b/src/test/ui/issues/issue-24267-flow-exit.stderr index 7d1d5ac7df6..0d226e01809 100644 --- a/src/test/ui/issues/issue-24267-flow-exit.stderr +++ b/src/test/ui/issues/issue-24267-flow-exit.stderr @@ -1,11 +1,11 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/issue-24267-flow-exit.rs:22:20 + --> $DIR/issue-24267-flow-exit.rs:12:20 | LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/issue-24267-flow-exit.rs:28:20 + --> $DIR/issue-24267-flow-exit.rs:18:20 | LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/issues/issue-24322.rs b/src/test/ui/issues/issue-24322.rs index bb726aca921..6567fcab46c 100644 --- a/src/test/ui/issues/issue-24322.rs +++ b/src/test/ui/issues/issue-24322.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct B; impl B { diff --git a/src/test/ui/issues/issue-24322.stderr b/src/test/ui/issues/issue-24322.stderr index d2cad8d3464..b4285438751 100644 --- a/src/test/ui/issues/issue-24322.stderr +++ b/src/test/ui/issues/issue-24322.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-24322.rs:18:29 + --> $DIR/issue-24322.rs:8:29 | LL | let x: &fn(&B) -> u32 = &B::func; //~ ERROR mismatched types | ^^^^^^^^ expected fn pointer, found fn item diff --git a/src/test/ui/issues/issue-24338.rs b/src/test/ui/issues/issue-24338.rs index 0c5db8f1f9d..fafeff06426 100644 --- a/src/test/ui/issues/issue-24338.rs +++ b/src/test/ui/issues/issue-24338.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // compile-pass diff --git a/src/test/ui/issues/issue-24352.rs b/src/test/ui/issues/issue-24352.rs index 4b077314056..5c8246d179f 100644 --- a/src/test/ui/issues/issue-24352.rs +++ b/src/test/ui/issues/issue-24352.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { 1.0f64 - 1.0; 1.0f64 - 1 //~ ERROR E0277 diff --git a/src/test/ui/issues/issue-24352.stderr b/src/test/ui/issues/issue-24352.stderr index 8a4169055e7..835706d015b 100644 --- a/src/test/ui/issues/issue-24352.stderr +++ b/src/test/ui/issues/issue-24352.stderr @@ -1,5 +1,5 @@ error[E0277]: cannot subtract `{integer}` from `f64` - --> $DIR/issue-24352.rs:13:12 + --> $DIR/issue-24352.rs:3:12 | LL | 1.0f64 - 1 //~ ERROR E0277 | ^ no implementation for `f64 - {integer}` diff --git a/src/test/ui/issues/issue-24357.nll.stderr b/src/test/ui/issues/issue-24357.nll.stderr index e35f443548d..310535434cd 100644 --- a/src/test/ui/issues/issue-24357.nll.stderr +++ b/src/test/ui/issues/issue-24357.nll.stderr @@ -1,6 +1,8 @@ error[E0382]: use of moved value: `x` - --> $DIR/issue-24357.rs:16:12 + --> $DIR/issue-24357.rs:6:12 | +LL | let x = NoCopy; + | - move occurs because `x` has type `NoCopy`, which does not implement the `Copy` trait LL | let f = move || { let y = x; }; | ------- - variable moved due to use in closure | | @@ -8,8 +10,6 @@ LL | let f = move || { let y = x; }; LL | //~^ NOTE value moved (into closure) here LL | let z = x; | ^ value used here after move - | - = note: move occurs because `x` has type `NoCopy`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/issues/issue-24357.rs b/src/test/ui/issues/issue-24357.rs index 016ce93a0bd..84f263ff649 100644 --- a/src/test/ui/issues/issue-24357.rs +++ b/src/test/ui/issues/issue-24357.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct NoCopy; fn main() { let x = NoCopy; diff --git a/src/test/ui/issues/issue-24357.stderr b/src/test/ui/issues/issue-24357.stderr index be531ec8567..3bc84cba0f5 100644 --- a/src/test/ui/issues/issue-24357.stderr +++ b/src/test/ui/issues/issue-24357.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/issue-24357.rs:16:8 + --> $DIR/issue-24357.rs:6:8 | LL | let f = move || { let y = x; }; | ------- value moved (into closure) here diff --git a/src/test/ui/issues/issue-24363.rs b/src/test/ui/issues/issue-24363.rs index 619ad74ad00..a5b45f13e74 100644 --- a/src/test/ui/issues/issue-24363.rs +++ b/src/test/ui/issues/issue-24363.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { 1.create_a_type_error[ //~ `{integer}` is a primitive type and therefore doesn't have fields ()+() //~ ERROR binary operation `+` cannot be applied diff --git a/src/test/ui/issues/issue-24363.stderr b/src/test/ui/issues/issue-24363.stderr index 2695d6acea8..ff02887a153 100644 --- a/src/test/ui/issues/issue-24363.stderr +++ b/src/test/ui/issues/issue-24363.stderr @@ -1,11 +1,11 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields - --> $DIR/issue-24363.rs:12:7 + --> $DIR/issue-24363.rs:2:7 | LL | 1.create_a_type_error[ //~ `{integer}` is a primitive type and therefore doesn't have fields | ^^^^^^^^^^^^^^^^^^^ error[E0369]: binary operation `+` cannot be applied to type `()` - --> $DIR/issue-24363.rs:13:9 + --> $DIR/issue-24363.rs:3:9 | LL | ()+() //~ ERROR binary operation `+` cannot be applied | ^^^^^ diff --git a/src/test/ui/issues/issue-24365.rs b/src/test/ui/issues/issue-24365.rs index 72df6fb5999..eca104b6f1d 100644 --- a/src/test/ui/issues/issue-24365.rs +++ b/src/test/ui/issues/issue-24365.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum Attribute { Code {attr_name_idx: u16}, } diff --git a/src/test/ui/issues/issue-24365.stderr b/src/test/ui/issues/issue-24365.stderr index 0ad4674ca86..7d02f117f9f 100644 --- a/src/test/ui/issues/issue-24365.stderr +++ b/src/test/ui/issues/issue-24365.stderr @@ -1,17 +1,17 @@ error[E0609]: no field `b` on type `Foo` - --> $DIR/issue-24365.rs:20:22 + --> $DIR/issue-24365.rs:10:22 | LL | println!("{}", a.b); //~ no field `b` on type `Foo` | ^ error[E0609]: no field `attr_name_idx` on type `&Attribute` - --> $DIR/issue-24365.rs:27:18 + --> $DIR/issue-24365.rs:17:18 | LL | let z = (&x).attr_name_idx; //~ no field `attr_name_idx` on type `&Attribute` | ^^^^^^^^^^^^^ error[E0609]: no field `attr_name_idx` on type `Attribute` - --> $DIR/issue-24365.rs:28:15 + --> $DIR/issue-24365.rs:18:15 | LL | let y = x.attr_name_idx; //~ no field `attr_name_idx` on type `Attribute` | ^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-24389.rs b/src/test/ui/issues/issue-24389.rs index 704a71dbb1e..da48a76e200 100644 --- a/src/test/ui/issues/issue-24389.rs +++ b/src/test/ui/issues/issue-24389.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-24424.rs b/src/test/ui/issues/issue-24424.rs index 8e9f675b575..8b8c5bc23e4 100644 --- a/src/test/ui/issues/issue-24424.rs +++ b/src/test/ui/issues/issue-24424.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait1<'l0, T0> {} trait Trait0<'l0> {} diff --git a/src/test/ui/issues/issue-24424.stderr b/src/test/ui/issues/issue-24424.stderr index 7bcf67a5048..4c6ac0180a8 100644 --- a/src/test/ui/issues/issue-24424.stderr +++ b/src/test/ui/issues/issue-24424.stderr @@ -1,11 +1,11 @@ error[E0283]: type annotations required: cannot resolve `T0: Trait0<'l0>` - --> $DIR/issue-24424.rs:14:1 + --> $DIR/issue-24424.rs:4:1 | LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by `Trait0` - --> $DIR/issue-24424.rs:12:1 + --> $DIR/issue-24424.rs:2:1 | LL | trait Trait0<'l0> {} | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-24434.rs b/src/test/ui/issues/issue-24434.rs index 490d6dfadec..7b270ceb688 100644 --- a/src/test/ui/issues/issue-24434.rs +++ b/src/test/ui/issues/issue-24434.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_attributes)] // compile-flags:--cfg set1 diff --git a/src/test/ui/issues/issue-24446.rs b/src/test/ui/issues/issue-24446.rs index 7c44319db0d..c5e1b49e5ed 100644 --- a/src/test/ui/issues/issue-24446.rs +++ b/src/test/ui/issues/issue-24446.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { static foo: Fn() -> u32 = || -> u32 { //~^ ERROR the size for values of type diff --git a/src/test/ui/issues/issue-24446.stderr b/src/test/ui/issues/issue-24446.stderr index d4921443cad..ffec73b1ab4 100644 --- a/src/test/ui/issues/issue-24446.stderr +++ b/src/test/ui/issues/issue-24446.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `(dyn std::ops::Fn() -> u32 + 'static)` cannot be known at compilation time - --> $DIR/issue-24446.rs:12:17 + --> $DIR/issue-24446.rs:2:17 | LL | static foo: Fn() -> u32 = || -> u32 { | ^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() -> u32 + 'static)` - = note: to learn more, visit + = note: to learn more, visit error: aborting due to previous error diff --git a/src/test/ui/issues/issue-24682.rs b/src/test/ui/issues/issue-24682.rs index 0e872f71df4..0d1ab73417c 100644 --- a/src/test/ui/issues/issue-24682.rs +++ b/src/test/ui/issues/issue-24682.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait A: Sized { type N; fn x() -> diff --git a/src/test/ui/issues/issue-24682.stderr b/src/test/ui/issues/issue-24682.stderr index 1e16cb72a09..f6d03f6c18f 100644 --- a/src/test/ui/issues/issue-24682.stderr +++ b/src/test/ui/issues/issue-24682.stderr @@ -1,18 +1,18 @@ error[E0229]: associated type bindings are not allowed here - --> $DIR/issue-24682.rs:15:11 + --> $DIR/issue-24682.rs:5:11 | LL | / N= //~ ERROR associated type bindings are not allowed here LL | | Self::N> { | |_________________^ associated type not allowed here error[E0229]: associated type bindings are not allowed here - --> $DIR/issue-24682.rs:21:13 + --> $DIR/issue-24682.rs:11:13 | LL | //~ ERROR associated type bindings are not allowed here | ^^^^ associated type not allowed here error[E0229]: associated type bindings are not allowed here - --> $DIR/issue-24682.rs:25:13 + --> $DIR/issue-24682.rs:15:13 | LL | u32 //~ ERROR associated type bindings are not allowed here | ^^^^ associated type not allowed here diff --git a/src/test/ui/issues/issue-24819.rs b/src/test/ui/issues/issue-24819.rs index 52f5f1cd079..1155e8d5d54 100644 --- a/src/test/ui/issues/issue-24819.rs +++ b/src/test/ui/issues/issue-24819.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::HashSet; fn main() { diff --git a/src/test/ui/issues/issue-24819.stderr b/src/test/ui/issues/issue-24819.stderr index 33034b7072b..5f1cd0a255f 100644 --- a/src/test/ui/issues/issue-24819.stderr +++ b/src/test/ui/issues/issue-24819.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-24819.rs:15:9 + --> $DIR/issue-24819.rs:5:9 | LL | foo(&mut v); | ^^^^^^ expected struct `std::collections::HashSet`, found struct `std::vec::Vec` diff --git a/src/test/ui/issues/issue-2487-a.rs b/src/test/ui/issues/issue-2487-a.rs index bff4eb92806..36e121ddb7a 100644 --- a/src/test/ui/issues/issue-2487-a.rs +++ b/src/test/ui/issues/issue-2487-a.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/ui/issues/issue-24883.rs b/src/test/ui/issues/issue-24883.rs index f047d6e7fff..1aa62d3a3b6 100644 --- a/src/test/ui/issues/issue-24883.rs +++ b/src/test/ui/issues/issue-24883.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen mod a { diff --git a/src/test/ui/issues/issue-2502.rs b/src/test/ui/issues/issue-2502.rs index 24ba19c4b7f..29b68c94c2e 100644 --- a/src/test/ui/issues/issue-2502.rs +++ b/src/test/ui/issues/issue-2502.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/ui/issues/issue-25076.rs b/src/test/ui/issues/issue-25076.rs index 1c255b4e631..6c5a5539245 100644 --- a/src/test/ui/issues/issue-25076.rs +++ b/src/test/ui/issues/issue-25076.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S; trait InOut { type Out; } diff --git a/src/test/ui/issues/issue-25076.stderr b/src/test/ui/issues/issue-25076.stderr index 13ee70fdd9b..8793475e6d4 100644 --- a/src/test/ui/issues/issue-25076.stderr +++ b/src/test/ui/issues/issue-25076.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `(): InOut<_>` is not satisfied - --> $DIR/issue-25076.rs:20:5 + --> $DIR/issue-25076.rs:10:5 | LL | do_fold(bot(), ()); //~ ERROR `(): InOut<_>` is not satisfied | ^^^^^^^ the trait `InOut<_>` is not implemented for `()` | note: required by `do_fold` - --> $DIR/issue-25076.rs:15:1 + --> $DIR/issue-25076.rs:5:1 | LL | fn do_fold>(init: B, f: F) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-25180.rs b/src/test/ui/issues/issue-25180.rs index 5f15393dacc..739d571d727 100644 --- a/src/test/ui/issues/issue-25180.rs +++ b/src/test/ui/issues/issue-25180.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/ui/issues/issue-25368.rs b/src/test/ui/issues/issue-25368.rs index e70c0050221..8b4dbb6e460 100644 --- a/src/test/ui/issues/issue-25368.rs +++ b/src/test/ui/issues/issue-25368.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::sync::mpsc::channel; use std::thread::spawn; use std::marker::PhantomData; diff --git a/src/test/ui/issues/issue-25368.stderr b/src/test/ui/issues/issue-25368.stderr index 56cbef7b89c..2e6a02e7389 100644 --- a/src/test/ui/issues/issue-25368.stderr +++ b/src/test/ui/issues/issue-25368.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-25368.rs:21:17 + --> $DIR/issue-25368.rs:11:17 | LL | let (tx, rx) = channel(); | -------- consider giving the pattern a type diff --git a/src/test/ui/issues/issue-25385.rs b/src/test/ui/issues/issue-25385.rs index aa941bc5691..adad6c35a3f 100644 --- a/src/test/ui/issues/issue-25385.rs +++ b/src/test/ui/issues/issue-25385.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - macro_rules! foo { ($e:expr) => { $e.foo() } //~^ ERROR no method named `foo` found for type `i32` in the current scope diff --git a/src/test/ui/issues/issue-25385.stderr b/src/test/ui/issues/issue-25385.stderr index f12388d4b45..e170a9d383b 100644 --- a/src/test/ui/issues/issue-25385.stderr +++ b/src/test/ui/issues/issue-25385.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `foo` found for type `i32` in the current scope - --> $DIR/issue-25385.rs:13:23 + --> $DIR/issue-25385.rs:2:23 | LL | ($e:expr) => { $e.foo() } | ^^^ @@ -8,7 +8,7 @@ LL | foo!(a); | -------- in this macro invocation error[E0599]: no method named `foo` found for type `i32` in the current scope - --> $DIR/issue-25385.rs:21:15 + --> $DIR/issue-25385.rs:10:15 | LL | foo!(1i32.foo()); | ^^^ diff --git a/src/test/ui/issues/issue-25386.rs b/src/test/ui/issues/issue-25386.rs index b2775db5e75..607c9fceab8 100644 --- a/src/test/ui/issues/issue-25386.rs +++ b/src/test/ui/issues/issue-25386.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod stuff { pub struct Item { c_object: Box, diff --git a/src/test/ui/issues/issue-25386.stderr b/src/test/ui/issues/issue-25386.stderr index 986961d36c9..eabb139b97d 100644 --- a/src/test/ui/issues/issue-25386.stderr +++ b/src/test/ui/issues/issue-25386.stderr @@ -1,5 +1,5 @@ error[E0616]: field `c_object` of struct `stuff::Item` is private - --> $DIR/issue-25386.rs:29:11 + --> $DIR/issue-25386.rs:19:11 | LL | (*$var.c_object).$member.is_some() | ^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | println!("{}", check_ptr_exist!(item, name)); | ---------------------------- in this macro invocation error[E0616]: field `name` of struct `stuff::CObj` is private - --> $DIR/issue-25386.rs:29:9 + --> $DIR/issue-25386.rs:19:9 | LL | (*$var.c_object).$member.is_some() | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-25394.rs b/src/test/ui/issues/issue-25394.rs index eaa44623f40..d1638aa98a0 100644 --- a/src/test/ui/issues/issue-25394.rs +++ b/src/test/ui/issues/issue-25394.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #[derive(Debug)] diff --git a/src/test/ui/issues/issue-25396.rs b/src/test/ui/issues/issue-25396.rs index 7cfcbc5471a..301658d2344 100644 --- a/src/test/ui/issues/issue-25396.rs +++ b/src/test/ui/issues/issue-25396.rs @@ -1,12 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#![allow(non_camel_case_types)] use foo::baz; use bar::baz; //~ ERROR the name `baz` is defined multiple times diff --git a/src/test/ui/issues/issue-25396.stderr b/src/test/ui/issues/issue-25396.stderr index 33e7c378821..aae62b688d4 100644 --- a/src/test/ui/issues/issue-25396.stderr +++ b/src/test/ui/issues/issue-25396.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `baz` is defined multiple times - --> $DIR/issue-25396.rs:12:5 + --> $DIR/issue-25396.rs:4:5 | LL | use foo::baz; | -------- previous import of the module `baz` here @@ -13,7 +13,7 @@ LL | use bar::baz as other_baz; //~ ERROR the name `baz` is defined multiple tim | ^^^^^^^^^^^^^^^^^^^^^ error[E0252]: the name `Quux` is defined multiple times - --> $DIR/issue-25396.rs:15:5 + --> $DIR/issue-25396.rs:7:5 | LL | use foo::Quux; | --------- previous import of the trait `Quux` here @@ -27,7 +27,7 @@ LL | use bar::Quux as OtherQuux; //~ ERROR the name `Quux` is defined multiple t | ^^^^^^^^^^^^^^^^^^^^^^ error[E0252]: the name `blah` is defined multiple times - --> $DIR/issue-25396.rs:18:5 + --> $DIR/issue-25396.rs:10:5 | LL | use foo::blah; | --------- previous import of the type `blah` here @@ -41,7 +41,7 @@ LL | use bar::blah as other_blah; //~ ERROR the name `blah` is defined multiple | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0252]: the name `WOMP` is defined multiple times - --> $DIR/issue-25396.rs:21:5 + --> $DIR/issue-25396.rs:13:5 | LL | use foo::WOMP; | --------- previous import of the value `WOMP` here diff --git a/src/test/ui/issues/issue-25439.rs b/src/test/ui/issues/issue-25439.rs index 6e33fd5ae71..4f73ff3e38b 100644 --- a/src/test/ui/issues/issue-25439.rs +++ b/src/test/ui/issues/issue-25439.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Helper<'a, F: 'a>(&'a F); fn fix(f: F) -> i32 where F: Fn(Helper, i32) -> i32 { diff --git a/src/test/ui/issues/issue-25439.stderr b/src/test/ui/issues/issue-25439.stderr index 467bb1ad28e..9e9ab4e39d3 100644 --- a/src/test/ui/issues/issue-25439.stderr +++ b/src/test/ui/issues/issue-25439.stderr @@ -1,5 +1,5 @@ error[E0644]: closure/generator type that references itself - --> $DIR/issue-25439.rs:18:9 + --> $DIR/issue-25439.rs:8:9 | LL | fix(|_, x| x); //~ ERROR closure/generator type that references itself [E0644] | ^^^^^^^^ cyclic type of infinite size diff --git a/src/test/ui/issues/issue-25579.ast.nll.stderr b/src/test/ui/issues/issue-25579.ast.nll.stderr index 9f698e4d582..b791f600f50 100644 --- a/src/test/ui/issues/issue-25579.ast.nll.stderr +++ b/src/test/ui/issues/issue-25579.ast.nll.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/issue-25579.rs:31:1 + --> $DIR/issue-25579.rs:21:1 | LL | / fn main() { //[mir]~ ERROR compilation successful LL | | } diff --git a/src/test/ui/issues/issue-25579.ast.stderr b/src/test/ui/issues/issue-25579.ast.stderr index 49b483d7503..3de7f565b7b 100644 --- a/src/test/ui/issues/issue-25579.ast.stderr +++ b/src/test/ui/issues/issue-25579.ast.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `l.0` as mutable more than once at a time - --> $DIR/issue-25579.rs:24:32 + --> $DIR/issue-25579.rs:14:32 | LL | &mut Sexpression::Cons(ref mut expr) => { //[ast]~ ERROR [E0499] | ^^^^^^^^^^^^ mutable borrow starts here in previous iteration of loop @@ -8,7 +8,7 @@ LL | } | - mutable borrow ends here error[E0506]: cannot assign to `l` because it is borrowed - --> $DIR/issue-25579.rs:25:13 + --> $DIR/issue-25579.rs:15:13 | LL | &mut Sexpression::Cons(ref mut expr) => { //[ast]~ ERROR [E0499] | ------------ borrow of `l` occurs here diff --git a/src/test/ui/issues/issue-25579.mir.stderr b/src/test/ui/issues/issue-25579.mir.stderr index 9f698e4d582..b791f600f50 100644 --- a/src/test/ui/issues/issue-25579.mir.stderr +++ b/src/test/ui/issues/issue-25579.mir.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/issue-25579.rs:31:1 + --> $DIR/issue-25579.rs:21:1 | LL | / fn main() { //[mir]~ ERROR compilation successful LL | | } diff --git a/src/test/ui/issues/issue-25579.rs b/src/test/ui/issues/issue-25579.rs index 71c1d63cf5a..1813253332f 100644 --- a/src/test/ui/issues/issue-25579.rs +++ b/src/test/ui/issues/issue-25579.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/issues/issue-25700.nll.stderr b/src/test/ui/issues/issue-25700.nll.stderr new file mode 100644 index 00000000000..ba5403cca4d --- /dev/null +++ b/src/test/ui/issues/issue-25700.nll.stderr @@ -0,0 +1,13 @@ +error[E0382]: use of moved value: `t` + --> $DIR/issue-25700.rs:13:10 + | +LL | let t = S::<()>(None); + | - move occurs because `t` has type `S<()>`, which does not implement the `Copy` trait +LL | drop(t); + | - value moved here +LL | drop(t); //~ ERROR use of moved value + | ^ value used here after move + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/issues/issue-25700.rs b/src/test/ui/issues/issue-25700.rs index 477c3237f84..45c452d618d 100644 --- a/src/test/ui/issues/issue-25700.rs +++ b/src/test/ui/issues/issue-25700.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S(Option<&'static T>); trait Tr { type Out; } diff --git a/src/test/ui/issues/issue-25700.stderr b/src/test/ui/issues/issue-25700.stderr index 786620ab750..d4cf89d0abd 100644 --- a/src/test/ui/issues/issue-25700.stderr +++ b/src/test/ui/issues/issue-25700.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `t` - --> $DIR/issue-25700.rs:23:10 + --> $DIR/issue-25700.rs:13:10 | LL | drop(t); | - value moved here diff --git a/src/test/ui/issues/issue-25793.nll.stderr b/src/test/ui/issues/issue-25793.nll.stderr index f3d855feca2..daea9cd8cd7 100644 --- a/src/test/ui/issues/issue-25793.nll.stderr +++ b/src/test/ui/issues/issue-25793.nll.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `self.width` because it was mutably borrowed - --> $DIR/issue-25793.rs:13:9 + --> $DIR/issue-25793.rs:4:9 | LL | $this.width.unwrap() | ^^^^^^^^^^^ use of borrowed `*self` diff --git a/src/test/ui/issues/issue-25793.rs b/src/test/ui/issues/issue-25793.rs index 2939646342a..6c8dacc2248 100644 --- a/src/test/ui/issues/issue-25793.rs +++ b/src/test/ui/issues/issue-25793.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(rustc_attrs)] macro_rules! width( ($this:expr) => { diff --git a/src/test/ui/issues/issue-25793.stderr b/src/test/ui/issues/issue-25793.stderr index fb83d767c50..e8d208c19aa 100644 --- a/src/test/ui/issues/issue-25793.stderr +++ b/src/test/ui/issues/issue-25793.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `self.width` because it was mutably borrowed - --> $DIR/issue-25793.rs:13:9 + --> $DIR/issue-25793.rs:4:9 | LL | $this.width.unwrap() | ^^^^^^^^^^^ use of borrowed `*self` diff --git a/src/test/ui/issues/issue-25826.rs b/src/test/ui/issues/issue-25826.rs index 6b9caba0218..36a69cf4c22 100644 --- a/src/test/ui/issues/issue-25826.rs +++ b/src/test/ui/issues/issue-25826.rs @@ -1,16 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn id(t: T) -> T { t } fn main() { - const A: bool = id:: as *const () < id:: as *const (); + const A: bool = unsafe { id:: as *const () < id:: as *const () }; //~^ ERROR comparing raw pointers inside constant println!("{}", A); } diff --git a/src/test/ui/issues/issue-25826.stderr b/src/test/ui/issues/issue-25826.stderr index a5ab7cfa6d3..dc547f7c32c 100644 --- a/src/test/ui/issues/issue-25826.stderr +++ b/src/test/ui/issues/issue-25826.stderr @@ -1,8 +1,8 @@ error[E0658]: comparing raw pointers inside constant (see issue #53020) - --> $DIR/issue-25826.rs:13:21 + --> $DIR/issue-25826.rs:3:30 | -LL | const A: bool = id:: as *const () < id:: as *const (); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | const A: bool = unsafe { id:: as *const () < id:: as *const () }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_compare_raw_pointers)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-2590.nll.stderr b/src/test/ui/issues/issue-2590.nll.stderr index fa2df26498a..1252578419a 100644 --- a/src/test/ui/issues/issue-2590.nll.stderr +++ b/src/test/ui/issues/issue-2590.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-2590.rs:22:9 + --> $DIR/issue-2590.rs:11:9 | LL | self.tokens //~ ERROR cannot move out of borrowed content | ^^^^^^^^^^^ cannot move out of borrowed content diff --git a/src/test/ui/issues/issue-2590.rs b/src/test/ui/issues/issue-2590.rs index d7e438d1049..28d023db4f5 100644 --- a/src/test/ui/issues/issue-2590.rs +++ b/src/test/ui/issues/issue-2590.rs @@ -1,23 +1,12 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -struct parser { +struct Parser { tokens: Vec , } -trait parse { +trait Parse { fn parse(&self) -> Vec ; } -impl parse for parser { +impl Parse for Parser { fn parse(&self) -> Vec { self.tokens //~ ERROR cannot move out of borrowed content } diff --git a/src/test/ui/issues/issue-2590.stderr b/src/test/ui/issues/issue-2590.stderr index 59ec66d42cd..f93b5db3adf 100644 --- a/src/test/ui/issues/issue-2590.stderr +++ b/src/test/ui/issues/issue-2590.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-2590.rs:22:9 + --> $DIR/issue-2590.rs:11:9 | LL | self.tokens //~ ERROR cannot move out of borrowed content | ^^^^ cannot move out of borrowed content diff --git a/src/test/ui/issues/issue-25901.rs b/src/test/ui/issues/issue-25901.rs index 72fb2a682eb..a139ad0d3e3 100644 --- a/src/test/ui/issues/issue-25901.rs +++ b/src/test/ui/issues/issue-25901.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct A; struct B; diff --git a/src/test/ui/issues/issue-25901.stderr b/src/test/ui/issues/issue-25901.stderr index 8c20df5a230..d6eb3760cdf 100644 --- a/src/test/ui/issues/issue-25901.stderr +++ b/src/test/ui/issues/issue-25901.stderr @@ -1,5 +1,5 @@ error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue-25901.rs:14:24 + --> $DIR/issue-25901.rs:4:24 | LL | static S: &'static B = &A; | ^^ diff --git a/src/test/ui/issues/issue-26056.rs b/src/test/ui/issues/issue-26056.rs index 2dad2351440..0d9973b4548 100644 --- a/src/test/ui/issues/issue-26056.rs +++ b/src/test/ui/issues/issue-26056.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait MapLookup { type MapValue; } diff --git a/src/test/ui/issues/issue-26056.stderr b/src/test/ui/issues/issue-26056.stderr index 51a48af81a1..44fabd0db19 100644 --- a/src/test/ui/issues/issue-26056.stderr +++ b/src/test/ui/issues/issue-26056.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Map` cannot be made into an object - --> $DIR/issue-26056.rs:30:13 + --> $DIR/issue-26056.rs:20:13 | LL | as &Map; | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Map` cannot be made into an object diff --git a/src/test/ui/issues/issue-26093.rs b/src/test/ui/issues/issue-26093.rs index 22751c4a37c..7895c90068f 100644 --- a/src/test/ui/issues/issue-26093.rs +++ b/src/test/ui/issues/issue-26093.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! not_a_place { ($thing:expr) => { $thing = 42; diff --git a/src/test/ui/issues/issue-26093.stderr b/src/test/ui/issues/issue-26093.stderr index 1abe313bbf6..947c52f08d2 100644 --- a/src/test/ui/issues/issue-26093.stderr +++ b/src/test/ui/issues/issue-26093.stderr @@ -1,5 +1,5 @@ error[E0070]: invalid left-hand side expression - --> $DIR/issue-26093.rs:13:9 + --> $DIR/issue-26093.rs:3:9 | LL | $thing = 42; | ^^^^^^^^^^^ left-hand of expression not valid diff --git a/src/test/ui/issues/issue-26094.rs b/src/test/ui/issues/issue-26094.rs index 99add95e806..b9433849853 100644 --- a/src/test/ui/issues/issue-26094.rs +++ b/src/test/ui/issues/issue-26094.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! some_macro { ($other: expr) => ({ $other(None) diff --git a/src/test/ui/issues/issue-26094.stderr b/src/test/ui/issues/issue-26094.stderr index bf902e16c0c..36b2d3d074b 100644 --- a/src/test/ui/issues/issue-26094.stderr +++ b/src/test/ui/issues/issue-26094.stderr @@ -1,5 +1,5 @@ error[E0061]: this function takes 0 parameters but 1 parameter was supplied - --> $DIR/issue-26094.rs:13:9 + --> $DIR/issue-26094.rs:3:9 | LL | $other(None) | ^^^^^^^^^^^^ expected 0 parameters diff --git a/src/test/ui/issues/issue-26095.rs b/src/test/ui/issues/issue-26095.rs index cf33cf3cb6e..707cf1df512 100644 --- a/src/test/ui/issues/issue-26095.rs +++ b/src/test/ui/issues/issue-26095.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/ui/issues/issue-2611-3.rs b/src/test/ui/issues/issue-2611-3.rs index 29a8200104a..5d4b65628de 100644 --- a/src/test/ui/issues/issue-2611-3.rs +++ b/src/test/ui/issues/issue-2611-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Tests that impls are allowed to have looser, more permissive bounds diff --git a/src/test/ui/issues/issue-26158.rs b/src/test/ui/issues/issue-26158.rs index 54f5313aed1..11f47b6d02a 100644 --- a/src/test/ui/issues/issue-26158.rs +++ b/src/test/ui/issues/issue-26158.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] fn main() { diff --git a/src/test/ui/issues/issue-26158.stderr b/src/test/ui/issues/issue-26158.stderr index 07b968c8e78..868ffd191cb 100644 --- a/src/test/ui/issues/issue-26158.stderr +++ b/src/test/ui/issues/issue-26158.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding: `&[]` not covered - --> $DIR/issue-26158.rs:15:9 + --> $DIR/issue-26158.rs:5:9 | LL | let &[[ref _a, ref _b..]..] = x; //~ ERROR refutable pattern | ^^^^^^^^^^^^^^^^^^^^^^^ pattern `&[]` not covered diff --git a/src/test/ui/issues/issue-26205.rs b/src/test/ui/issues/issue-26205.rs index ccadee45750..01b71652c05 100644 --- a/src/test/ui/issues/issue-26205.rs +++ b/src/test/ui/issues/issue-26205.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] use std::ops::{Deref, DerefMut}; diff --git a/src/test/ui/issues/issue-26217.rs b/src/test/ui/issues/issue-26217.rs index 06a8fe52588..a700807d7f2 100644 --- a/src/test/ui/issues/issue-26217.rs +++ b/src/test/ui/issues/issue-26217.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() where for<'a> T: 'a {} fn main<'a>() { diff --git a/src/test/ui/issues/issue-26217.stderr b/src/test/ui/issues/issue-26217.stderr index f581826440e..be9da569f8b 100644 --- a/src/test/ui/issues/issue-26217.stderr +++ b/src/test/ui/issues/issue-26217.stderr @@ -1,5 +1,5 @@ error[E0477]: the type `&'a i32` does not fulfill the required lifetime - --> $DIR/issue-26217.rs:14:5 + --> $DIR/issue-26217.rs:4:5 | LL | foo::<&'a i32>(); | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-26237.rs b/src/test/ui/issues/issue-26237.rs index ffffe6d3ab5..71e96677d4b 100644 --- a/src/test/ui/issues/issue-26237.rs +++ b/src/test/ui/issues/issue-26237.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! macro_panic { ($not_a_function:expr, $some_argument:ident) => { $not_a_function($some_argument) diff --git a/src/test/ui/issues/issue-26237.stderr b/src/test/ui/issues/issue-26237.stderr index 7f481c230ba..f58c1bfe644 100644 --- a/src/test/ui/issues/issue-26237.stderr +++ b/src/test/ui/issues/issue-26237.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `{integer}` - --> $DIR/issue-26237.rs:20:18 + --> $DIR/issue-26237.rs:10:18 | LL | $not_a_function($some_argument) | ------------------------------- call expression requires function diff --git a/src/test/ui/issues/issue-26262.rs b/src/test/ui/issues/issue-26262.rs index 8d79fd4570d..41135db9104 100644 --- a/src/test/ui/issues/issue-26262.rs +++ b/src/test/ui/issues/issue-26262.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that projections don't count as constraining type parameters. struct S(T); diff --git a/src/test/ui/issues/issue-26262.stderr b/src/test/ui/issues/issue-26262.stderr index 2e0a211d061..90e2d0d9301 100644 --- a/src/test/ui/issues/issue-26262.stderr +++ b/src/test/ui/issues/issue-26262.stderr @@ -1,11 +1,11 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-26262.rs:17:6 + --> $DIR/issue-26262.rs:7:6 | LL | impl S { | ^ unconstrained type parameter error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-26262.rs:27:6 + --> $DIR/issue-26262.rs:17:6 | LL | impl<'a,T: Trait2<'a>> Trait1<>::Foo> for T { | ^^ unconstrained lifetime parameter diff --git a/src/test/ui/issues/issue-26459.rs b/src/test/ui/issues/issue-26459.rs index 8be3d88bd5c..79791e0e06a 100644 --- a/src/test/ui/issues/issue-26459.rs +++ b/src/test/ui/issues/issue-26459.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match 'a' { char{ch} => true diff --git a/src/test/ui/issues/issue-26459.stderr b/src/test/ui/issues/issue-26459.stderr index d497c1c9209..187369263a4 100644 --- a/src/test/ui/issues/issue-26459.stderr +++ b/src/test/ui/issues/issue-26459.stderr @@ -1,5 +1,5 @@ error[E0574]: expected struct, variant or union type, found builtin type `char` - --> $DIR/issue-26459.rs:13:9 + --> $DIR/issue-26459.rs:3:9 | LL | char{ch} => true | ^^^^ not a struct, variant or union type diff --git a/src/test/ui/issues/issue-26472.rs b/src/test/ui/issues/issue-26472.rs index 9b25eb72f3d..4eb38d10a70 100644 --- a/src/test/ui/issues/issue-26472.rs +++ b/src/test/ui/issues/issue-26472.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod sub { pub struct S { len: usize } impl S { @@ -18,6 +8,6 @@ mod sub { fn main() { let s = sub::S::new(); - let v = s.len; - //~^ ERROR field `len` of struct `sub::S` is private + let v = s.len; //~ ERROR field `len` of struct `sub::S` is private + s.len = v; //~ ERROR field `len` of struct `sub::S` is private } diff --git a/src/test/ui/issues/issue-26472.stderr b/src/test/ui/issues/issue-26472.stderr index 26f54f61a7e..8c261d2a3f3 100644 --- a/src/test/ui/issues/issue-26472.stderr +++ b/src/test/ui/issues/issue-26472.stderr @@ -1,11 +1,17 @@ error[E0616]: field `len` of struct `sub::S` is private - --> $DIR/issue-26472.rs:21:13 + --> $DIR/issue-26472.rs:11:13 | -LL | let v = s.len; - | ^^^^^ +LL | let v = s.len; //~ ERROR field `len` of struct `sub::S` is private + | ^^--- + | | + | help: a method `len` also exists, call it with parentheses: `len()` + +error[E0616]: field `len` of struct `sub::S` is private + --> $DIR/issue-26472.rs:12:5 | - = note: a method `len` also exists, perhaps you wish to call it +LL | s.len = v; //~ ERROR field `len` of struct `sub::S` is private + | ^^^^^ -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0616`. diff --git a/src/test/ui/issues/issue-26548.rs b/src/test/ui/issues/issue-26548.rs index 85ddf8d9493..5b6c77d0bd1 100644 --- a/src/test/ui/issues/issue-26548.rs +++ b/src/test/ui/issues/issue-26548.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//~^^^^^^^^^^ ERROR cycle detected when computing layout of +//~ ERROR cycle detected when computing layout of //~| NOTE ...which requires computing layout of //~| NOTE ...which again requires computing layout of diff --git a/src/test/ui/issues/issue-26548.stderr b/src/test/ui/issues/issue-26548.stderr index 7ebeb76b657..ff197eeeb0f 100644 --- a/src/test/ui/issues/issue-26548.stderr +++ b/src/test/ui/issues/issue-26548.stderr @@ -1,9 +1,9 @@ error[E0391]: cycle detected when computing layout of `std::option::Option` | -note: ...which requires computing layout of `S`... + = note: ...which requires computing layout of `S`... = note: ...which again requires computing layout of `std::option::Option`, completing the cycle note: cycle used when processing `main` - --> $DIR/issue-26548.rs:19:1 + --> $DIR/issue-26548.rs:9:1 | LL | fn main() { //~ NOTE cycle used when processing `main` | ^^^^^^^^^ diff --git a/src/test/ui/issues/issue-26614.rs b/src/test/ui/issues/issue-26614.rs index c930f26acf4..11c22020733 100644 --- a/src/test/ui/issues/issue-26614.rs +++ b/src/test/ui/issues/issue-26614.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(warnings)] diff --git a/src/test/ui/issues/issue-26638.rs b/src/test/ui/issues/issue-26638.rs index 85a10588975..0f5ed5caa74 100644 --- a/src/test/ui/issues/issue-26638.rs +++ b/src/test/ui/issues/issue-26638.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn parse_type(iter: Box+'static>) -> &str { iter.next() } //~^ ERROR missing lifetime specifier [E0106] diff --git a/src/test/ui/issues/issue-26638.stderr b/src/test/ui/issues/issue-26638.stderr index 0ac6316f0dc..64c2cd43264 100644 --- a/src/test/ui/issues/issue-26638.stderr +++ b/src/test/ui/issues/issue-26638.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:11:58 + --> $DIR/issue-26638.rs:1:58 | LL | fn parse_type(iter: Box+'static>) -> &str { iter.next() } | ^ expected lifetime parameter @@ -7,7 +7,7 @@ LL | fn parse_type(iter: Box+'static>) -> &str { iter.next() = help: this function's return type contains a borrowed value, but the signature does not say which one of `iter`'s 2 lifetimes it is borrowed from error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:14:40 + --> $DIR/issue-26638.rs:4:40 | LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } | ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static` @@ -15,7 +15,7 @@ LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:17:22 + --> $DIR/issue-26638.rs:7:22 | LL | fn parse_type_3() -> &str { unimplemented!() } | ^ help: consider giving it a 'static lifetime: `&'static` diff --git a/src/test/ui/issues/issue-26646.rs b/src/test/ui/issues/issue-26646.rs index a587db00dcf..6aa5e03996b 100644 --- a/src/test/ui/issues/issue-26646.rs +++ b/src/test/ui/issues/issue-26646.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![deny(unused_attributes)] diff --git a/src/test/ui/issues/issue-26812.rs b/src/test/ui/issues/issue-26812.rs index 1dd00881078..b2494a91a3f 100644 --- a/src/test/ui/issues/issue-26812.rs +++ b/src/test/ui/issues/issue-26812.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(default_type_parameter_fallback)] fn avg(_: T) {} diff --git a/src/test/ui/issues/issue-26812.stderr b/src/test/ui/issues/issue-26812.stderr index 82cc17b7665..8d507a7ea01 100644 --- a/src/test/ui/issues/issue-26812.stderr +++ b/src/test/ui/issues/issue-26812.stderr @@ -1,5 +1,5 @@ error[E0128]: type parameters with a default cannot use forward declared identifiers - --> $DIR/issue-26812.rs:13:10 + --> $DIR/issue-26812.rs:3:10 | LL | fn avg(_: T) {} | ^^^^^^^ defaulted type parameters cannot be forward declared diff --git a/src/test/ui/issues/issue-26886.rs b/src/test/ui/issues/issue-26886.rs index 24ef7cb74c8..6e6d406c656 100644 --- a/src/test/ui/issues/issue-26886.rs +++ b/src/test/ui/issues/issue-26886.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::sync::{self, Arc}; use std::sync::Arc; //~ ERROR the name `Arc` is defined multiple times //~| `Arc` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-26886.stderr b/src/test/ui/issues/issue-26886.stderr index f2a43b0db79..08faa9c9ca2 100644 --- a/src/test/ui/issues/issue-26886.stderr +++ b/src/test/ui/issues/issue-26886.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `Arc` is defined multiple times - --> $DIR/issue-26886.rs:12:5 + --> $DIR/issue-26886.rs:2:5 | LL | use std::sync::{self, Arc}; | --- previous import of the type `Arc` here @@ -13,7 +13,7 @@ LL | use std::sync::Arc as OtherArc; //~ ERROR the name `Arc` is defined multipl | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0252]: the name `sync` is defined multiple times - --> $DIR/issue-26886.rs:14:5 + --> $DIR/issue-26886.rs:4:5 | LL | use std::sync::{self, Arc}; | ---- previous import of the module `sync` here diff --git a/src/test/ui/issues/issue-26905.rs b/src/test/ui/issues/issue-26905.rs index 3b8fac832a4..0cd166f4ac6 100644 --- a/src/test/ui/issues/issue-26905.rs +++ b/src/test/ui/issues/issue-26905.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unsize, coerce_unsized)] // Verfies that non-PhantomData ZSTs still cause coercions to fail. diff --git a/src/test/ui/issues/issue-26905.stderr b/src/test/ui/issues/issue-26905.stderr index 7feabef5660..93b4d7e36e8 100644 --- a/src/test/ui/issues/issue-26905.stderr +++ b/src/test/ui/issues/issue-26905.stderr @@ -1,5 +1,5 @@ error[E0375]: implementing the trait `CoerceUnsized` requires multiple coercions - --> $DIR/issue-26905.rs:26:40 + --> $DIR/issue-26905.rs:16:40 | LL | impl, U: ?Sized> CoerceUnsized> for MyRc{ } //~ERROR | ^^^^^^^^^^^^^^^^^^^^^^ requires multiple coercions diff --git a/src/test/ui/issues/issue-26930.rs b/src/test/ui/issues/issue-26930.rs index 9751dae26be..abf6b933c3b 100644 --- a/src/test/ui/issues/issue-26930.rs +++ b/src/test/ui/issues/issue-26930.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(unused)] diff --git a/src/test/ui/issues/issue-26948.rs b/src/test/ui/issues/issue-26948.rs index c63cb5defb7..832c9641daa 100644 --- a/src/test/ui/issues/issue-26948.rs +++ b/src/test/ui/issues/issue-26948.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { enum Foo { A { x: u32 } } let orig = Foo::A { x: 5 }; diff --git a/src/test/ui/issues/issue-26948.stderr b/src/test/ui/issues/issue-26948.stderr index 982ce1d6c7b..faede168767 100644 --- a/src/test/ui/issues/issue-26948.stderr +++ b/src/test/ui/issues/issue-26948.stderr @@ -1,5 +1,5 @@ error[E0436]: functional record update syntax requires a struct - --> $DIR/issue-26948.rs:14:22 + --> $DIR/issue-26948.rs:4:22 | LL | Foo::A { x: 6, ..orig }; | ^^^^ diff --git a/src/test/ui/issues/issue-26997.rs b/src/test/ui/issues/issue-26997.rs index 1a4850d2459..dd48440720f 100644 --- a/src/test/ui/issues/issue-26997.rs +++ b/src/test/ui/issues/issue-26997.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] pub struct Foo { diff --git a/src/test/ui/issues/issue-27008.rs b/src/test/ui/issues/issue-27008.rs index f80135848e0..b37ea6f01ba 100644 --- a/src/test/ui/issues/issue-27008.rs +++ b/src/test/ui/issues/issue-27008.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S; fn main() { diff --git a/src/test/ui/issues/issue-27008.stderr b/src/test/ui/issues/issue-27008.stderr index 79831463664..c45d757ff0a 100644 --- a/src/test/ui/issues/issue-27008.stderr +++ b/src/test/ui/issues/issue-27008.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-27008.rs:14:17 + --> $DIR/issue-27008.rs:4:17 | LL | let b = [0; S]; | ^ expected usize, found struct `S` diff --git a/src/test/ui/issues/issue-27033.rs b/src/test/ui/issues/issue-27033.rs index b8552aaee90..a23819a20f9 100644 --- a/src/test/ui/issues/issue-27033.rs +++ b/src/test/ui/issues/issue-27033.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match Some(1) { None @ _ => {} //~ ERROR match bindings cannot shadow unit variants diff --git a/src/test/ui/issues/issue-27033.stderr b/src/test/ui/issues/issue-27033.stderr index dfd635d36e8..b343924bb02 100644 --- a/src/test/ui/issues/issue-27033.stderr +++ b/src/test/ui/issues/issue-27033.stderr @@ -1,11 +1,11 @@ error[E0530]: match bindings cannot shadow unit variants - --> $DIR/issue-27033.rs:13:9 + --> $DIR/issue-27033.rs:3:9 | LL | None @ _ => {} //~ ERROR match bindings cannot shadow unit variants | ^^^^ cannot be named the same as a unit variant error[E0530]: match bindings cannot shadow constants - --> $DIR/issue-27033.rs:17:9 + --> $DIR/issue-27033.rs:7:9 | LL | const C: u8 = 1; | ---------------- the constant `C` is defined here diff --git a/src/test/ui/issues/issue-27042.rs b/src/test/ui/issues/issue-27042.rs index 23afa4b6296..8c7758597f0 100644 --- a/src/test/ui/issues/issue-27042.rs +++ b/src/test/ui/issues/issue-27042.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #27042. Test that a loop's label is included in its span. fn main() { diff --git a/src/test/ui/issues/issue-27042.stderr b/src/test/ui/issues/issue-27042.stderr index 48113445582..bcefb29c18b 100644 --- a/src/test/ui/issues/issue-27042.stderr +++ b/src/test/ui/issues/issue-27042.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-27042.rs:16:16 + --> $DIR/issue-27042.rs:6:16 | LL | loop { break }; //~ ERROR mismatched types | ^^^^^ expected (), found i32 @@ -8,7 +8,7 @@ LL | loop { break }; //~ ERROR mismatched types found type `i32` error[E0308]: mismatched types - --> $DIR/issue-27042.rs:18:9 + --> $DIR/issue-27042.rs:8:9 | LL | / 'b: //~ ERROR mismatched types LL | | while true { break }; // but here we cite the whole loop @@ -18,7 +18,7 @@ LL | | while true { break }; // but here we cite the whole loop found type `()` error[E0308]: mismatched types - --> $DIR/issue-27042.rs:21:9 + --> $DIR/issue-27042.rs:11:9 | LL | / 'c: //~ ERROR mismatched types LL | | for _ in None { break }; // but here we cite the whole loop @@ -28,7 +28,7 @@ LL | | for _ in None { break }; // but here we cite the whole loop found type `()` error[E0308]: mismatched types - --> $DIR/issue-27042.rs:24:9 + --> $DIR/issue-27042.rs:14:9 | LL | / 'd: //~ ERROR mismatched types LL | | while let Some(_) = None { break }; diff --git a/src/test/ui/issues/issue-27060-2.rs b/src/test/ui/issues/issue-27060-2.rs index 619616adda6..a001ce1e0ac 100644 --- a/src/test/ui/issues/issue-27060-2.rs +++ b/src/test/ui/issues/issue-27060-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[repr(packed)] pub struct Bad { data: T, //~ ERROR the size for values of type diff --git a/src/test/ui/issues/issue-27060-2.stderr b/src/test/ui/issues/issue-27060-2.stderr index c9a29ac2199..b95c298b6e6 100644 --- a/src/test/ui/issues/issue-27060-2.stderr +++ b/src/test/ui/issues/issue-27060-2.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/issue-27060-2.rs:13:5 + --> $DIR/issue-27060-2.rs:3:5 | LL | data: T, //~ ERROR the size for values of type | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: the last field of a packed struct may only have a dynamically sized type if it does not need drop to be run diff --git a/src/test/ui/issues/issue-27060.rs b/src/test/ui/issues/issue-27060.rs index f88c2137e77..4caad03a361 100644 --- a/src/test/ui/issues/issue-27060.rs +++ b/src/test/ui/issues/issue-27060.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[repr(packed)] pub struct Good { data: &'static u32, diff --git a/src/test/ui/issues/issue-27060.stderr b/src/test/ui/issues/issue-27060.stderr index bd01f75d8fb..023f90eb9fe 100644 --- a/src/test/ui/issues/issue-27060.stderr +++ b/src/test/ui/issues/issue-27060.stderr @@ -1,11 +1,11 @@ error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) - --> $DIR/issue-27060.rs:36:13 + --> $DIR/issue-27060.rs:26:13 | LL | let _ = &good.data; //~ ERROR borrow of packed field is unsafe | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-27060.rs:23:8 + --> $DIR/issue-27060.rs:13:8 | LL | #[deny(safe_packed_borrows)] | ^^^^^^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL | #[deny(safe_packed_borrows)] = note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) - --> $DIR/issue-27060.rs:38:13 + --> $DIR/issue-27060.rs:28:13 | LL | let _ = &good.data2[0]; //~ ERROR borrow of packed field is unsafe | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-27078.rs b/src/test/ui/issues/issue-27078.rs index 294c288a970..ae6ec62be38 100644 --- a/src/test/ui/issues/issue-27078.rs +++ b/src/test/ui/issues/issue-27078.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_consts)] trait Foo { diff --git a/src/test/ui/issues/issue-27078.stderr b/src/test/ui/issues/issue-27078.stderr index 269a69dde33..76cc3e7b0a3 100644 --- a/src/test/ui/issues/issue-27078.stderr +++ b/src/test/ui/issues/issue-27078.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation time - --> $DIR/issue-27078.rs:15:12 + --> $DIR/issue-27078.rs:5:12 | LL | fn foo(self) -> &'static i32 { | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Self` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where Self: std::marker::Sized` bound = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/issues/issue-27105.rs b/src/test/ui/issues/issue-27105.rs index c2a0baaba28..5f0dff12aec 100644 --- a/src/test/ui/issues/issue-27105.rs +++ b/src/test/ui/issues/issue-27105.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass use std::cell::RefCell; use std::rc::Rc; diff --git a/src/test/ui/issues/issue-2718-a.rs b/src/test/ui/issues/issue-2718-a.rs index 6de28cbbf35..188168bb94c 100644 --- a/src/test/ui/issues/issue-2718-a.rs +++ b/src/test/ui/issues/issue-2718-a.rs @@ -1,22 +1,12 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct send_packet { +pub struct SendPacket { p: T } mod pingpong { - use send_packet; - pub type ping = send_packet; - pub struct pong(send_packet); - //~^ ERROR recursive type `pingpong::pong` has infinite size + use SendPacket; + pub type Ping = SendPacket; + pub struct Pong(SendPacket); + //~^ ERROR recursive type `pingpong::Pong` has infinite size } fn main() {} diff --git a/src/test/ui/issues/issue-2718-a.stderr b/src/test/ui/issues/issue-2718-a.stderr index a60e5d04455..0f52c791928 100644 --- a/src/test/ui/issues/issue-2718-a.stderr +++ b/src/test/ui/issues/issue-2718-a.stderr @@ -1,13 +1,13 @@ -error[E0072]: recursive type `pingpong::pong` has infinite size - --> $DIR/issue-2718-a.rs:18:5 +error[E0072]: recursive type `pingpong::Pong` has infinite size + --> $DIR/issue-2718-a.rs:8:5 | -LL | pub struct pong(send_packet); - | ^^^^^^^^^^^^^^^^-----------------^^ +LL | pub struct Pong(SendPacket); + | ^^^^^^^^^^^^^^^^----------------^^ | | | | | recursive without indirection | recursive type has infinite size | - = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `pingpong::pong` representable + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `pingpong::Pong` representable error: aborting due to previous error diff --git a/src/test/ui/issues/issue-27281.rs b/src/test/ui/issues/issue-27281.rs index 1dfbe21921e..8403d9b4507 100644 --- a/src/test/ui/issues/issue-27281.rs +++ b/src/test/ui/issues/issue-27281.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub trait Trait<'a> { type T; diff --git a/src/test/ui/issues/issue-27282-move-match-input-into-guard.rs b/src/test/ui/issues/issue-27282-move-match-input-into-guard.rs index 769e5474e00..0721b051bcb 100644 --- a/src/test/ui/issues/issue-27282-move-match-input-into-guard.rs +++ b/src/test/ui/issues/issue-27282-move-match-input-into-guard.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 27282: Example 2: This sidesteps the AST checks disallowing // mutable borrows in match guards by hiding the mutable borrow in a // guard behind a move (of the mutably borrowed match input) within a diff --git a/src/test/ui/issues/issue-27282-move-match-input-into-guard.stderr b/src/test/ui/issues/issue-27282-move-match-input-into-guard.stderr index 5f3b07bd1e8..6993419326c 100644 --- a/src/test/ui/issues/issue-27282-move-match-input-into-guard.stderr +++ b/src/test/ui/issues/issue-27282-move-match-input-into-guard.stderr @@ -1,6 +1,9 @@ error[E0382]: use of moved value: `b` - --> $DIR/issue-27282-move-match-input-into-guard.rs:28:14 + --> $DIR/issue-27282-move-match-input-into-guard.rs:18:14 | +LL | let b = &mut true; + | - move occurs because `b` has type `&mut bool`, which does not implement the `Copy` trait +... LL | _ if { (|| { let bar = b; *bar = false; })(); | -- - variable moved due to use in closure | | diff --git a/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.rs b/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.rs index 5b4c746a1b6..1312aff30fe 100644 --- a/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.rs +++ b/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 27282: Example 1: This sidesteps the AST checks disallowing // mutable borrows in match guards by hiding the mutable borrow in a // guard behind a move (of the ref mut pattern id) within a closure. diff --git a/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.stderr b/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.stderr index f6ffa90069c..b5973ba8bd5 100644 --- a/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.stderr +++ b/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-27282-move-ref-mut-into-guard.rs:24:18 + --> $DIR/issue-27282-move-ref-mut-into-guard.rs:14:18 | LL | if { (|| { let bar = foo; bar.take() })(); false } => {}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content diff --git a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.rs b/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.rs index 2ebfb995d8c..3fb13d66ccb 100644 --- a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.rs +++ b/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is testing an attempt to corrupt the discriminant of the match // arm in a guard, followed by an attempt to continue matching on that // corrupted discriminant in the remaining match arms. diff --git a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.stderr b/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.stderr index 2ecbb25fd3e..199407ad774 100644 --- a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.stderr +++ b/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.stderr @@ -1,5 +1,5 @@ error[E0510]: cannot mutably borrow `x` in match guard - --> $DIR/issue-27282-mutate-before-diverging-arm-1.rs:33:14 + --> $DIR/issue-27282-mutate-before-diverging-arm-1.rs:23:14 | LL | match x { | - value is immutable in match guard diff --git a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-2.rs b/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-2.rs index 6b50973e04d..f5eaae925db 100644 --- a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-2.rs +++ b/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is testing an attempt to corrupt the discriminant of the match // arm in a guard, followed by an attempt to continue matching on that // corrupted discriminant in the remaining match arms. diff --git a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-2.stderr b/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-2.stderr index 6feef95300e..3c72cb02015 100644 --- a/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-2.stderr +++ b/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-2.stderr @@ -1,5 +1,5 @@ error[E0510]: cannot mutably borrow `x` in match guard - --> $DIR/issue-27282-mutate-before-diverging-arm-2.rs:38:18 + --> $DIR/issue-27282-mutate-before-diverging-arm-2.rs:28:18 | LL | match x { | - value is immutable in match guard diff --git a/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs b/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs index 6cbd493b991..c79b1873241 100644 --- a/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs +++ b/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 27282: This is a variation on issue-27282-move-ref-mut-into-guard.rs // // It reborrows instead of moving the `ref mut` pattern borrow. This diff --git a/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.stderr b/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.stderr index 660902880ac..3a10928981c 100644 --- a/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.stderr +++ b/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `r` as mutable, as it is immutable for the pattern guard - --> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:26:25 + --> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:16:25 | LL | ref mut r if { (|| { let bar = &mut *r; **bar = false; })(); | ^^ - mutable borrow occurs due to use of `r` in closure diff --git a/src/test/ui/issues/issue-27340.rs b/src/test/ui/issues/issue-27340.rs index ce3fa487d4e..61c77cc1ff3 100644 --- a/src/test/ui/issues/issue-27340.rs +++ b/src/test/ui/issues/issue-27340.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; #[derive(Copy, Clone)] //~^ ERROR the trait `Copy` may not be implemented for this type diff --git a/src/test/ui/issues/issue-27340.stderr b/src/test/ui/issues/issue-27340.stderr index bae47b3d2a3..634a31a89d5 100644 --- a/src/test/ui/issues/issue-27340.stderr +++ b/src/test/ui/issues/issue-27340.stderr @@ -1,5 +1,5 @@ error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/issue-27340.rs:12:10 + --> $DIR/issue-27340.rs:2:10 | LL | #[derive(Copy, Clone)] | ^^^^ diff --git a/src/test/ui/issues/issue-27433.rs b/src/test/ui/issues/issue-27433.rs index 782b2057438..2cc7d05e7c6 100644 --- a/src/test/ui/issues/issue-27433.rs +++ b/src/test/ui/issues/issue-27433.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let foo = 42u32; const FOO : u32 = foo; diff --git a/src/test/ui/issues/issue-27433.stderr b/src/test/ui/issues/issue-27433.stderr index 0fc04b082e5..78a193dd99a 100644 --- a/src/test/ui/issues/issue-27433.stderr +++ b/src/test/ui/issues/issue-27433.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/issue-27433.rs:13:23 + --> $DIR/issue-27433.rs:3:23 | LL | const FOO : u32 = foo; | ^^^ diff --git a/src/test/ui/issues/issue-2748-a.rs b/src/test/ui/issues/issue-2748-a.rs index 8c8d3c557fc..683a931cc3d 100644 --- a/src/test/ui/issues/issue-2748-a.rs +++ b/src/test/ui/issues/issue-2748-a.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_snake_case)] diff --git a/src/test/ui/issues/issue-27583.rs b/src/test/ui/issues/issue-27583.rs index c0a981f60ee..763e9ebe24b 100644 --- a/src/test/ui/issues/issue-27583.rs +++ b/src/test/ui/issues/issue-27583.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // Regression test for issue #27583. Unclear how useful this will be // going forward, since the issue in question was EXTREMELY sensitive diff --git a/src/test/ui/issues/issue-27592.nll.stderr b/src/test/ui/issues/issue-27592.nll.stderr index 630eab8613d..9d3eaa9705d 100644 --- a/src/test/ui/issues/issue-27592.nll.stderr +++ b/src/test/ui/issues/issue-27592.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing temporary value - --> $DIR/issue-27592.rs:26:14 + --> $DIR/issue-27592.rs:16:14 | LL | write(|| format_args!("{}", String::from("Hello world"))); | ^^^^^^^^^^^^^^^^^^^---------------------------^ @@ -8,7 +8,7 @@ LL | write(|| format_args!("{}", String::from("Hello world"))); | returns a value referencing data owned by the current function error[E0515]: cannot return value referencing temporary value - --> $DIR/issue-27592.rs:26:14 + --> $DIR/issue-27592.rs:16:14 | LL | write(|| format_args!("{}", String::from("Hello world"))); | ^^^^^^^^^^^^^----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-27592.rs b/src/test/ui/issues/issue-27592.rs index 731d4fb2bf6..6006f9a7c51 100644 --- a/src/test/ui/issues/issue-27592.rs +++ b/src/test/ui/issues/issue-27592.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #27592. fn write<'a, F: ::std::ops::FnOnce()->::std::fmt::Arguments<'a> + 'a>(fcn: F) { diff --git a/src/test/ui/issues/issue-27592.stderr b/src/test/ui/issues/issue-27592.stderr index 74b0541c01b..0f62abee1ca 100644 --- a/src/test/ui/issues/issue-27592.stderr +++ b/src/test/ui/issues/issue-27592.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/issue-27592.rs:26:27 + --> $DIR/issue-27592.rs:16:27 | LL | write(|| format_args!("{}", String::from("Hello world"))); | ^^^^ -- temporary value needs to live until here @@ -8,7 +8,7 @@ LL | write(|| format_args!("{}", String::from("Hello world"))); | temporary value does not live long enough error[E0597]: borrowed value does not live long enough - --> $DIR/issue-27592.rs:26:33 + --> $DIR/issue-27592.rs:16:33 | LL | write(|| format_args!("{}", String::from("Hello world"))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^-- temporary value needs to live until here diff --git a/src/test/ui/issues/issue-27815.rs b/src/test/ui/issues/issue-27815.rs index d9840abf0ca..9e53014f455 100644 --- a/src/test/ui/issues/issue-27815.rs +++ b/src/test/ui/issues/issue-27815.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod A {} fn main() { diff --git a/src/test/ui/issues/issue-27815.stderr b/src/test/ui/issues/issue-27815.stderr index 987feaee9eb..fbddd3be9dc 100644 --- a/src/test/ui/issues/issue-27815.stderr +++ b/src/test/ui/issues/issue-27815.stderr @@ -1,23 +1,23 @@ error[E0574]: expected struct, variant or union type, found module `A` - --> $DIR/issue-27815.rs:14:13 + --> $DIR/issue-27815.rs:4:13 | LL | let u = A { x: 1 }; //~ ERROR expected struct, variant or union type, found module `A` | ^ not a struct, variant or union type error[E0574]: expected struct, variant or union type, found builtin type `u32` - --> $DIR/issue-27815.rs:15:13 + --> $DIR/issue-27815.rs:5:13 | LL | let v = u32 { x: 1 }; //~ ERROR expected struct, variant or union type, found builtin type `u32` | ^^^ not a struct, variant or union type error[E0574]: expected struct, variant or union type, found module `A` - --> $DIR/issue-27815.rs:17:9 + --> $DIR/issue-27815.rs:7:9 | LL | A { x: 1 } => {} | ^ not a struct, variant or union type error[E0574]: expected struct, variant or union type, found builtin type `u32` - --> $DIR/issue-27815.rs:19:9 + --> $DIR/issue-27815.rs:9:9 | LL | u32 { x: 1 } => {} | ^^^ not a struct, variant or union type diff --git a/src/test/ui/issues/issue-27842.rs b/src/test/ui/issues/issue-27842.rs index d9dc3458a4a..3bcfa133070 100644 --- a/src/test/ui/issues/issue-27842.rs +++ b/src/test/ui/issues/issue-27842.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let tup = (0, 1, 2); // the case where we show a suggestion diff --git a/src/test/ui/issues/issue-27842.stderr b/src/test/ui/issues/issue-27842.stderr index 026594811e4..784666a639e 100644 --- a/src/test/ui/issues/issue-27842.stderr +++ b/src/test/ui/issues/issue-27842.stderr @@ -1,16 +1,16 @@ error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})` - --> $DIR/issue-27842.rs:14:13 + --> $DIR/issue-27842.rs:4:13 | LL | let _ = tup[0]; | ^^^^^^ help: to access tuple elements, use: `tup.0` error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer})` - --> $DIR/issue-27842.rs:19:13 + --> $DIR/issue-27842.rs:9:13 | LL | let _ = tup[i]; | ^^^^^^ | - = help: to access tuple elements, use tuple indexing syntax (e.g. `tuple.0`) + = help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`) error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-27889.rs b/src/test/ui/issues/issue-27889.rs index 4e4ef64c5b6..22de7c7cfa5 100644 --- a/src/test/ui/issues/issue-27889.rs +++ b/src/test/ui/issues/issue-27889.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_assignments)] #![allow(unused_variables)] diff --git a/src/test/ui/issues/issue-27895.rs b/src/test/ui/issues/issue-27895.rs index 6063755c04f..0018ac1bdf1 100644 --- a/src/test/ui/issues/issue-27895.rs +++ b/src/test/ui/issues/issue-27895.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let i = 5; let index = 6; diff --git a/src/test/ui/issues/issue-27895.stderr b/src/test/ui/issues/issue-27895.stderr index 395c806fbdb..55bd938b0bf 100644 --- a/src/test/ui/issues/issue-27895.stderr +++ b/src/test/ui/issues/issue-27895.stderr @@ -1,5 +1,5 @@ error[E0080]: runtime values cannot be referenced in patterns - --> $DIR/issue-27895.rs:16:13 + --> $DIR/issue-27895.rs:6:13 | LL | 0..=index => println!("winner"), | ^^^^^ diff --git a/src/test/ui/issues/issue-27942.rs b/src/test/ui/issues/issue-27942.rs index 2234aede00d..34b34de3879 100644 --- a/src/test/ui/issues/issue-27942.rs +++ b/src/test/ui/issues/issue-27942.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Resources<'a> {} pub trait Buffer<'a, R: Resources<'a>> { diff --git a/src/test/ui/issues/issue-27942.stderr b/src/test/ui/issues/issue-27942.stderr index 5e2ecbb05ae..e03959598b8 100644 --- a/src/test/ui/issues/issue-27942.stderr +++ b/src/test/ui/issues/issue-27942.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched types - --> $DIR/issue-27942.rs:15:5 + --> $DIR/issue-27942.rs:5:5 | LL | fn select(&self) -> BufferViewHandle; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Resources<'_>` found type `Resources<'a>` -note: the anonymous lifetime #1 defined on the method body at 15:5... - --> $DIR/issue-27942.rs:15:5 +note: the anonymous lifetime #1 defined on the method body at 5:5... + --> $DIR/issue-27942.rs:5:5 | LL | fn select(&self) -> BufferViewHandle; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...does not necessarily outlive the lifetime 'a as defined on the trait at 13:18 - --> $DIR/issue-27942.rs:13:18 +note: ...does not necessarily outlive the lifetime 'a as defined on the trait at 3:18 + --> $DIR/issue-27942.rs:3:18 | LL | pub trait Buffer<'a, R: Resources<'a>> { | ^^ error[E0308]: mismatched types - --> $DIR/issue-27942.rs:15:5 + --> $DIR/issue-27942.rs:5:5 | LL | fn select(&self) -> BufferViewHandle; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Resources<'_>` found type `Resources<'a>` -note: the lifetime 'a as defined on the trait at 13:18... - --> $DIR/issue-27942.rs:13:18 +note: the lifetime 'a as defined on the trait at 3:18... + --> $DIR/issue-27942.rs:3:18 | LL | pub trait Buffer<'a, R: Resources<'a>> { | ^^ -note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 15:5 - --> $DIR/issue-27942.rs:15:5 +note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 5:5 + --> $DIR/issue-27942.rs:5:5 | LL | fn select(&self) -> BufferViewHandle; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-2804-2.rs b/src/test/ui/issues/issue-2804-2.rs index 1894d50ed99..d5157420617 100644 --- a/src/test/ui/issues/issue-2804-2.rs +++ b/src/test/ui/issues/issue-2804-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Minimized version of issue-2804.rs. Both check that callee IDs don't diff --git a/src/test/ui/issues/issue-28075.rs b/src/test/ui/issues/issue-28075.rs index 494b446dd3f..6b4ea46f361 100644 --- a/src/test/ui/issues/issue-28075.rs +++ b/src/test/ui/issues/issue-28075.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unstable entities should be caught in import lists // aux-build:lint-stability.rs diff --git a/src/test/ui/issues/issue-28075.stderr b/src/test/ui/issues/issue-28075.stderr index b42a322cbb4..323be5cc2cf 100644 --- a/src/test/ui/issues/issue-28075.stderr +++ b/src/test/ui/issues/issue-28075.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/issue-28075.rs:19:22 + --> $DIR/issue-28075.rs:9:22 | LL | use lint_stability::{unstable, deprecated}; | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-28098.rs b/src/test/ui/issues/issue-28098.rs index 11990c34fba..c4addaccefc 100644 --- a/src/test/ui/issues/issue-28098.rs +++ b/src/test/ui/issues/issue-28098.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let _ = Iterator::next(&mut ()); //~^ ERROR `()` is not an iterator diff --git a/src/test/ui/issues/issue-28098.stderr b/src/test/ui/issues/issue-28098.stderr index c7537065b32..30f7819b96d 100644 --- a/src/test/ui/issues/issue-28098.stderr +++ b/src/test/ui/issues/issue-28098.stderr @@ -1,5 +1,5 @@ error[E0277]: `()` is not an iterator - --> $DIR/issue-28098.rs:12:13 + --> $DIR/issue-28098.rs:2:13 | LL | let _ = Iterator::next(&mut ()); | ^^^^^^^^^^^^^^ `()` is not an iterator @@ -8,7 +8,7 @@ LL | let _ = Iterator::next(&mut ()); = note: required by `std::iter::Iterator::next` error[E0277]: `bool` is not an iterator - --> $DIR/issue-28098.rs:15:14 + --> $DIR/issue-28098.rs:5:14 | LL | for _ in false {} | ^^^^^ `bool` is not an iterator @@ -17,7 +17,7 @@ LL | for _ in false {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `()` is not an iterator - --> $DIR/issue-28098.rs:18:13 + --> $DIR/issue-28098.rs:8:13 | LL | let _ = Iterator::next(&mut ()); | ^^^^^^^^^^^^^^ `()` is not an iterator @@ -26,7 +26,7 @@ LL | let _ = Iterator::next(&mut ()); = note: required by `std::iter::Iterator::next` error[E0277]: `()` is not an iterator - --> $DIR/issue-28098.rs:27:13 + --> $DIR/issue-28098.rs:17:13 | LL | let _ = Iterator::next(&mut ()); | ^^^^^^^^^^^^^^ `()` is not an iterator @@ -35,7 +35,7 @@ LL | let _ = Iterator::next(&mut ()); = note: required by `std::iter::Iterator::next` error[E0277]: `()` is not an iterator - --> $DIR/issue-28098.rs:30:13 + --> $DIR/issue-28098.rs:20:13 | LL | let _ = Iterator::next(&mut ()); | ^^^^^^^^^^^^^^ `()` is not an iterator @@ -44,7 +44,7 @@ LL | let _ = Iterator::next(&mut ()); = note: required by `std::iter::Iterator::next` error[E0277]: `bool` is not an iterator - --> $DIR/issue-28098.rs:33:14 + --> $DIR/issue-28098.rs:23:14 | LL | for _ in false {} | ^^^^^ `bool` is not an iterator diff --git a/src/test/ui/issues/issue-28105.rs b/src/test/ui/issues/issue-28105.rs index 8e58d1aaf24..6026cbb82ae 100644 --- a/src/test/ui/issues/issue-28105.rs +++ b/src/test/ui/issues/issue-28105.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure that a continue span actually contains the keyword. fn main() { diff --git a/src/test/ui/issues/issue-28105.stderr b/src/test/ui/issues/issue-28105.stderr index eb05dbea2be..900bc43bfc8 100644 --- a/src/test/ui/issues/issue-28105.stderr +++ b/src/test/ui/issues/issue-28105.stderr @@ -1,11 +1,11 @@ error[E0268]: `continue` outside of loop - --> $DIR/issue-28105.rs:14:5 + --> $DIR/issue-28105.rs:4:5 | LL | continue //~ ERROR `continue` outside of loop | ^^^^^^^^ cannot break outside of a loop error[E0268]: `break` outside of loop - --> $DIR/issue-28105.rs:16:5 + --> $DIR/issue-28105.rs:6:5 | LL | break //~ ERROR `break` outside of loop | ^^^^^ cannot break outside of a loop diff --git a/src/test/ui/issues/issue-28109.rs b/src/test/ui/issues/issue-28109.rs index 0d372d30015..755a539b500 100644 --- a/src/test/ui/issues/issue-28109.rs +++ b/src/test/ui/issues/issue-28109.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure that label for continue and break is spanned correctly fn main() { diff --git a/src/test/ui/issues/issue-28109.stderr b/src/test/ui/issues/issue-28109.stderr index 902fe2390b9..91a82972564 100644 --- a/src/test/ui/issues/issue-28109.stderr +++ b/src/test/ui/issues/issue-28109.stderr @@ -1,11 +1,11 @@ error[E0426]: use of undeclared label `'b` - --> $DIR/issue-28109.rs:16:9 + --> $DIR/issue-28109.rs:6:9 | LL | 'b //~ ERROR use of undeclared label | ^^ undeclared label `'b` error[E0426]: use of undeclared label `'c` - --> $DIR/issue-28109.rs:19:9 + --> $DIR/issue-28109.rs:9:9 | LL | 'c //~ ERROR use of undeclared label | ^^ undeclared label `'c` diff --git a/src/test/ui/issues/issue-28113.rs b/src/test/ui/issues/issue-28113.rs index 7d2541966a4..e5bd7aafe41 100644 --- a/src/test/ui/issues/issue-28113.rs +++ b/src/test/ui/issues/issue-28113.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] const X: u8 = diff --git a/src/test/ui/issues/issue-28113.stderr b/src/test/ui/issues/issue-28113.stderr index 633257f1a4b..3d274d777b0 100644 --- a/src/test/ui/issues/issue-28113.stderr +++ b/src/test/ui/issues/issue-28113.stderr @@ -1,5 +1,5 @@ error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue-28113.rs:14:5 + --> $DIR/issue-28113.rs:4:5 | LL | || -> u8 { 5 }() | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-28134.rs b/src/test/ui/issues/issue-28134.rs index 333b073503c..2bd4f93791d 100644 --- a/src/test/ui/issues/issue-28134.rs +++ b/src/test/ui/issues/issue-28134.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test #![test] //~ ERROR only functions may be used as tests diff --git a/src/test/ui/issues/issue-28134.stderr b/src/test/ui/issues/issue-28134.stderr index cecbe5b9365..5b967b31c29 100644 --- a/src/test/ui/issues/issue-28134.stderr +++ b/src/test/ui/issues/issue-28134.stderr @@ -1,5 +1,5 @@ error: only functions may be used as tests - --> $DIR/issue-28134.rs:13:1 + --> $DIR/issue-28134.rs:3:1 | LL | #![test] //~ ERROR only functions may be used as tests | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-2823.rs b/src/test/ui/issues/issue-2823.rs index 631bcb7bd9e..7b443b41526 100644 --- a/src/test/ui/issues/issue-2823.rs +++ b/src/test/ui/issues/issue-2823.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct C { x: isize, } diff --git a/src/test/ui/issues/issue-2823.stderr b/src/test/ui/issues/issue-2823.stderr index 5a5cae7aab4..b51ff611dbd 100644 --- a/src/test/ui/issues/issue-2823.stderr +++ b/src/test/ui/issues/issue-2823.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `clone` found for type `C` in the current scope - --> $DIR/issue-2823.rs:23:16 + --> $DIR/issue-2823.rs:13:16 | LL | struct C { | -------- method `clone` not found for this diff --git a/src/test/ui/issues/issue-28279.rs b/src/test/ui/issues/issue-28279.rs index c3f2c73e845..c770c509859 100644 --- a/src/test/ui/issues/issue-28279.rs +++ b/src/test/ui/issues/issue-28279.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] use std::rc::Rc; diff --git a/src/test/ui/issues/issue-28324.rs b/src/test/ui/issues/issue-28324.rs index af73db2b4d2..73e8cd6ab0d 100644 --- a/src/test/ui/issues/issue-28324.rs +++ b/src/test/ui/issues/issue-28324.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(safe_extern_statics)] extern { diff --git a/src/test/ui/issues/issue-28324.stderr b/src/test/ui/issues/issue-28324.stderr index c62d8bddf00..bbd02ba03f4 100644 --- a/src/test/ui/issues/issue-28324.stderr +++ b/src/test/ui/issues/issue-28324.stderr @@ -1,5 +1,5 @@ error[E0080]: could not evaluate static initializer - --> $DIR/issue-28324.rs:17:23 + --> $DIR/issue-28324.rs:7:23 | LL | pub static BAZ: u32 = *&error_message_count; | ^^^^^^^^^^^^^^^^^^^^^ tried to read from foreign (extern) static diff --git a/src/test/ui/issues/issue-28344.rs b/src/test/ui/issues/issue-28344.rs index d28c3146404..4da7ee21baa 100644 --- a/src/test/ui/issues/issue-28344.rs +++ b/src/test/ui/issues/issue-28344.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::BitXor; fn main() { diff --git a/src/test/ui/issues/issue-28344.stderr b/src/test/ui/issues/issue-28344.stderr index 7ef2e906422..b6f520c644b 100644 --- a/src/test/ui/issues/issue-28344.stderr +++ b/src/test/ui/issues/issue-28344.stderr @@ -1,30 +1,32 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::ops::BitXor`) must be specified - --> $DIR/issue-28344.rs:14:17 + --> $DIR/issue-28344.rs:4:17 | LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); - | ^^^^^^^^^^^^^ missing associated type `Output` value + | ^^^^^^^^^^^^^ associated type `Output` must be specified error[E0599]: no function or associated item named `bitor` found for type `dyn std::ops::BitXor<_>` in the current scope - --> $DIR/issue-28344.rs:14:17 + --> $DIR/issue-28344.rs:4:25 | LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); - | ^^^^^^^^^^^^^ function or associated item not found in `dyn std::ops::BitXor<_>` - | - = help: did you mean `bitxor`? + | --------^^^^^ + | | + | function or associated item not found in `dyn std::ops::BitXor<_>` + | help: did you mean: `bitxor` error[E0191]: the value of the associated type `Output` (from the trait `std::ops::BitXor`) must be specified - --> $DIR/issue-28344.rs:18:13 + --> $DIR/issue-28344.rs:8:13 | LL | let g = BitXor::bitor; - | ^^^^^^^^^^^^^ missing associated type `Output` value + | ^^^^^^^^^^^^^ associated type `Output` must be specified error[E0599]: no function or associated item named `bitor` found for type `dyn std::ops::BitXor<_>` in the current scope - --> $DIR/issue-28344.rs:18:13 + --> $DIR/issue-28344.rs:8:21 | LL | let g = BitXor::bitor; - | ^^^^^^^^^^^^^ function or associated item not found in `dyn std::ops::BitXor<_>` - | - = help: did you mean `bitxor`? + | --------^^^^^ + | | + | function or associated item not found in `dyn std::ops::BitXor<_>` + | help: did you mean: `bitxor` error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-28388-1.rs b/src/test/ui/issues/issue-28388-1.rs index b0418a513e3..14de621405d 100644 --- a/src/test/ui/issues/issue-28388-1.rs +++ b/src/test/ui/issues/issue-28388-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Prefix in imports with empty braces should be resolved and checked privacy, stability, etc. use foo::{}; //~ ERROR unresolved import `foo` diff --git a/src/test/ui/issues/issue-28388-1.stderr b/src/test/ui/issues/issue-28388-1.stderr index f93252f1d7d..6aabf653512 100644 --- a/src/test/ui/issues/issue-28388-1.stderr +++ b/src/test/ui/issues/issue-28388-1.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `foo` - --> $DIR/issue-28388-1.rs:13:5 + --> $DIR/issue-28388-1.rs:3:5 | LL | use foo::{}; //~ ERROR unresolved import `foo` | ^^^^^^^ no `foo` in the root diff --git a/src/test/ui/issues/issue-28388-2.rs b/src/test/ui/issues/issue-28388-2.rs index 4ed5bfab06f..024b0388bc6 100644 --- a/src/test/ui/issues/issue-28388-2.rs +++ b/src/test/ui/issues/issue-28388-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Prefix in imports with empty braces should be resolved and checked privacy, stability, etc. mod m { diff --git a/src/test/ui/issues/issue-28388-2.stderr b/src/test/ui/issues/issue-28388-2.stderr index 02ffc4b1758..7bbe0bc5ff1 100644 --- a/src/test/ui/issues/issue-28388-2.stderr +++ b/src/test/ui/issues/issue-28388-2.stderr @@ -1,5 +1,5 @@ error[E0603]: module `n` is private - --> $DIR/issue-28388-2.rs:17:8 + --> $DIR/issue-28388-2.rs:7:8 | LL | use m::n::{}; | ^ diff --git a/src/test/ui/issues/issue-28388-3.rs b/src/test/ui/issues/issue-28388-3.rs index 7593bb35add..7ba99350121 100644 --- a/src/test/ui/issues/issue-28388-3.rs +++ b/src/test/ui/issues/issue-28388-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Prefix in imports with empty braces should be resolved and checked privacy, stability, etc. // aux-build:lint-stability.rs diff --git a/src/test/ui/issues/issue-28388-3.stderr b/src/test/ui/issues/issue-28388-3.stderr index 653fdb5a4d4..2eb8249250e 100644 --- a/src/test/ui/issues/issue-28388-3.stderr +++ b/src/test/ui/issues/issue-28388-3.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/issue-28388-3.rs:17:5 + --> $DIR/issue-28388-3.rs:7:5 | LL | use lint_stability::UnstableEnum::{}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-28433.rs b/src/test/ui/issues/issue-28433.rs index 9253a490733..a87ac63784f 100644 --- a/src/test/ui/issues/issue-28433.rs +++ b/src/test/ui/issues/issue-28433.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z continue-parse-after-error enum bird { diff --git a/src/test/ui/issues/issue-28433.stderr b/src/test/ui/issues/issue-28433.stderr index bde01ef3746..d3cba3aae71 100644 --- a/src/test/ui/issues/issue-28433.stderr +++ b/src/test/ui/issues/issue-28433.stderr @@ -1,11 +1,15 @@ error: expected identifier, found keyword `pub` - --> $DIR/issue-28433.rs:14:5 + --> $DIR/issue-28433.rs:4:5 | LL | pub duck, | ^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | r#pub duck, + | ^^^^^ error: expected one of `(`, `,`, `=`, `{`, or `}`, found `duck` - --> $DIR/issue-28433.rs:14:9 + --> $DIR/issue-28433.rs:4:9 | LL | pub duck, | ^^^^ expected one of `(`, `,`, `=`, `{`, or `}` here diff --git a/src/test/ui/issues/issue-28472.rs b/src/test/ui/issues/issue-28472.rs index 837de8eddcf..17d74ea0cf4 100644 --- a/src/test/ui/issues/issue-28472.rs +++ b/src/test/ui/issues/issue-28472.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that the visibility modifier is included in the span of foreign items. extern { diff --git a/src/test/ui/issues/issue-28472.stderr b/src/test/ui/issues/issue-28472.stderr index 37c04a7a774..8288a1d9bb7 100644 --- a/src/test/ui/issues/issue-28472.stderr +++ b/src/test/ui/issues/issue-28472.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `foo` is defined multiple times - --> $DIR/issue-28472.rs:16:3 + --> $DIR/issue-28472.rs:6:3 | LL | fn foo(); | --------- previous definition of the value `foo` here @@ -11,7 +11,7 @@ LL | | fn foo(); = note: `foo` must be defined only once in the value namespace of this module error[E0428]: the name `foo` is defined multiple times - --> $DIR/issue-28472.rs:19:3 + --> $DIR/issue-28472.rs:9:3 | LL | fn foo(); | --------- previous definition of the value `foo` here diff --git a/src/test/ui/issues/issue-2848.rs b/src/test/ui/issues/issue-2848.rs index f3fc94434d3..e0049bf8fbb 100644 --- a/src/test/ui/issues/issue-2848.rs +++ b/src/test/ui/issues/issue-2848.rs @@ -1,12 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#[allow(non_camel_case_types)] mod bar { pub enum foo { diff --git a/src/test/ui/issues/issue-2848.stderr b/src/test/ui/issues/issue-2848.stderr index 8f7ebbf95dd..d9466405dd2 100644 --- a/src/test/ui/issues/issue-2848.stderr +++ b/src/test/ui/issues/issue-2848.stderr @@ -1,5 +1,5 @@ error[E0408]: variable `beta` is not bound in all patterns - --> $DIR/issue-2848.rs:22:7 + --> $DIR/issue-2848.rs:14:7 | LL | alpha | beta => {} //~ ERROR variable `beta` is not bound in all patterns | ^^^^^ ---- variable not in all patterns diff --git a/src/test/ui/issues/issue-2849.rs b/src/test/ui/issues/issue-2849.rs index 203b28bd5e4..787ab0e2896 100644 --- a/src/test/ui/issues/issue-2849.rs +++ b/src/test/ui/issues/issue-2849.rs @@ -1,18 +1,8 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum foo { alpha, beta(isize) } +enum Foo { Alpha, Beta(isize) } fn main() { - match foo::alpha { - foo::alpha | foo::beta(i) => {} + match Foo::Alpha { + Foo::Alpha | Foo::Beta(i) => {} //~^ ERROR variable `i` is not bound in all patterns } } diff --git a/src/test/ui/issues/issue-2849.stderr b/src/test/ui/issues/issue-2849.stderr index ffd15a58880..9027098d2d1 100644 --- a/src/test/ui/issues/issue-2849.stderr +++ b/src/test/ui/issues/issue-2849.stderr @@ -1,7 +1,7 @@ error[E0408]: variable `i` is not bound in all patterns - --> $DIR/issue-2849.rs:15:7 + --> $DIR/issue-2849.rs:5:7 | -LL | foo::alpha | foo::beta(i) => {} +LL | Foo::Alpha | Foo::Beta(i) => {} | ^^^^^^^^^^ - variable not in all patterns | | | pattern doesn't bind `i` diff --git a/src/test/ui/issues/issue-28561.rs b/src/test/ui/issues/issue-28561.rs index 28fac2cba0f..9dcce9991f7 100644 --- a/src/test/ui/issues/issue-28561.rs +++ b/src/test/ui/issues/issue-28561.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #[derive(Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] struct Array { diff --git a/src/test/ui/issues/issue-28568.rs b/src/test/ui/issues/issue-28568.rs index e8c34198852..ce511158f00 100644 --- a/src/test/ui/issues/issue-28568.rs +++ b/src/test/ui/issues/issue-28568.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct MyStruct; impl Drop for MyStruct { diff --git a/src/test/ui/issues/issue-28568.stderr b/src/test/ui/issues/issue-28568.stderr index 3208074642f..7729b9d240d 100644 --- a/src/test/ui/issues/issue-28568.stderr +++ b/src/test/ui/issues/issue-28568.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `MyStruct`: - --> $DIR/issue-28568.rs:17:1 + --> $DIR/issue-28568.rs:7:1 | LL | impl Drop for MyStruct { | ---------------------- first implementation here diff --git a/src/test/ui/issues/issue-28576.rs b/src/test/ui/issues/issue-28576.rs index bd7186708a6..de665d5aa16 100644 --- a/src/test/ui/issues/issue-28576.rs +++ b/src/test/ui/issues/issue-28576.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo { type Assoc; } diff --git a/src/test/ui/issues/issue-28576.stderr b/src/test/ui/issues/issue-28576.stderr index 80f0f1ba1b1..b04715f23f4 100644 --- a/src/test/ui/issues/issue-28576.stderr +++ b/src/test/ui/issues/issue-28576.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/issue-28576.rs:17:12 + --> $DIR/issue-28576.rs:7:12 | LL | / Bar //~ ERROR the trait `Bar` cannot be made into an object LL | | diff --git a/src/test/ui/issues/issue-28586.rs b/src/test/ui/issues/issue-28586.rs index b8571d2e85e..4d286be1e33 100644 --- a/src/test/ui/issues/issue-28586.rs +++ b/src/test/ui/issues/issue-28586.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #28586 pub trait Foo {} diff --git a/src/test/ui/issues/issue-28586.stderr b/src/test/ui/issues/issue-28586.stderr index 9820d64909e..eccb474c15e 100644 --- a/src/test/ui/issues/issue-28586.stderr +++ b/src/test/ui/issues/issue-28586.stderr @@ -1,8 +1,10 @@ error[E0599]: no associated item named `BYTES` found for type `usize` in the current scope - --> $DIR/issue-28586.rs:14:19 + --> $DIR/issue-28586.rs:4:26 | LL | impl Foo for [u8; usize::BYTES] {} - | ^^^^^^^^^^^^ associated item not found in `usize` + | -------^^^^^ + | | + | associated item not found in `usize` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-28600.rs b/src/test/ui/issues/issue-28600.rs index 88842ad9ca5..44a85924e3d 100644 --- a/src/test/ui/issues/issue-28600.rs +++ b/src/test/ui/issues/issue-28600.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // #28600 ICE: pub extern fn with parameter type &str inside struct impl diff --git a/src/test/ui/issues/issue-28625.rs b/src/test/ui/issues/issue-28625.rs index 273629a90fc..15a6a63d5ef 100644 --- a/src/test/ui/issues/issue-28625.rs +++ b/src/test/ui/issues/issue-28625.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // normalize-stderr-test "\d+ bits" -> "N bits" trait Bar { @@ -19,7 +9,7 @@ struct ArrayPeano { } fn foo(a: &ArrayPeano) -> &[T] where T: Bar { - unsafe { std::mem::transmute(a) } //~ ERROR transmute called with types of different sizes + unsafe { std::mem::transmute(a) } //~ ERROR cannot transmute between types of different sizes } impl Bar for () { diff --git a/src/test/ui/issues/issue-28625.stderr b/src/test/ui/issues/issue-28625.stderr index 22f8db4d387..36cb47944f2 100644 --- a/src/test/ui/issues/issue-28625.stderr +++ b/src/test/ui/issues/issue-28625.stderr @@ -1,11 +1,11 @@ -error[E0512]: transmute called with types of different sizes - --> $DIR/issue-28625.rs:22:14 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/issue-28625.rs:12:14 | -LL | unsafe { std::mem::transmute(a) } //~ ERROR transmute called with types of different sizes +LL | unsafe { std::mem::transmute(a) } //~ ERROR cannot transmute between types of different sizes | ^^^^^^^^^^^^^^^^^^^ | - = note: source type: &ArrayPeano (N bits) - = note: target type: &[T] (N bits) + = note: source type: `&ArrayPeano` (N bits) + = note: target type: `&[T]` (N bits) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-28776.rs b/src/test/ui/issues/issue-28776.rs index 196c4bd2728..e564ebcd110 100644 --- a/src/test/ui/issues/issue-28776.rs +++ b/src/test/ui/issues/issue-28776.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ptr; fn main() { diff --git a/src/test/ui/issues/issue-28776.stderr b/src/test/ui/issues/issue-28776.stderr index aef0d9cd1d8..7faac88e26a 100644 --- a/src/test/ui/issues/issue-28776.stderr +++ b/src/test/ui/issues/issue-28776.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-28776.rs:14:5 + --> $DIR/issue-28776.rs:4:5 | LL | (&ptr::write)(1 as *mut _, 42); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/issues/issue-28822.rs b/src/test/ui/issues/issue-28822.rs index 03b91a13224..7381c348cd6 100644 --- a/src/test/ui/issues/issue-28822.rs +++ b/src/test/ui/issues/issue-28822.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-28837.rs b/src/test/ui/issues/issue-28837.rs index 91ea18a8c6c..114473f3acf 100644 --- a/src/test/ui/issues/issue-28837.rs +++ b/src/test/ui/issues/issue-28837.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct A; fn main() { diff --git a/src/test/ui/issues/issue-28837.stderr b/src/test/ui/issues/issue-28837.stderr index 88994eaeb93..833493e5cda 100644 --- a/src/test/ui/issues/issue-28837.stderr +++ b/src/test/ui/issues/issue-28837.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `+` cannot be applied to type `A` - --> $DIR/issue-28837.rs:16:5 + --> $DIR/issue-28837.rs:6:5 | LL | a + a; //~ ERROR binary operation `+` cannot be applied to type `A` | ^^^^^ @@ -7,7 +7,7 @@ LL | a + a; //~ ERROR binary operation `+` cannot be applied to type `A` = note: an implementation of `std::ops::Add` might be missing for `A` error[E0369]: binary operation `-` cannot be applied to type `A` - --> $DIR/issue-28837.rs:18:5 + --> $DIR/issue-28837.rs:8:5 | LL | a - a; //~ ERROR binary operation `-` cannot be applied to type `A` | ^^^^^ @@ -15,7 +15,7 @@ LL | a - a; //~ ERROR binary operation `-` cannot be applied to type `A` = note: an implementation of `std::ops::Sub` might be missing for `A` error[E0369]: binary operation `*` cannot be applied to type `A` - --> $DIR/issue-28837.rs:20:5 + --> $DIR/issue-28837.rs:10:5 | LL | a * a; //~ ERROR binary operation `*` cannot be applied to type `A` | ^^^^^ @@ -23,7 +23,7 @@ LL | a * a; //~ ERROR binary operation `*` cannot be applied to type `A` = note: an implementation of `std::ops::Mul` might be missing for `A` error[E0369]: binary operation `/` cannot be applied to type `A` - --> $DIR/issue-28837.rs:22:5 + --> $DIR/issue-28837.rs:12:5 | LL | a / a; //~ ERROR binary operation `/` cannot be applied to type `A` | ^^^^^ @@ -31,7 +31,7 @@ LL | a / a; //~ ERROR binary operation `/` cannot be applied to type `A` = note: an implementation of `std::ops::Div` might be missing for `A` error[E0369]: binary operation `%` cannot be applied to type `A` - --> $DIR/issue-28837.rs:24:5 + --> $DIR/issue-28837.rs:14:5 | LL | a % a; //~ ERROR binary operation `%` cannot be applied to type `A` | ^^^^^ @@ -39,7 +39,7 @@ LL | a % a; //~ ERROR binary operation `%` cannot be applied to type `A` = note: an implementation of `std::ops::Rem` might be missing for `A` error[E0369]: binary operation `&` cannot be applied to type `A` - --> $DIR/issue-28837.rs:26:5 + --> $DIR/issue-28837.rs:16:5 | LL | a & a; //~ ERROR binary operation `&` cannot be applied to type `A` | ^^^^^ @@ -47,7 +47,7 @@ LL | a & a; //~ ERROR binary operation `&` cannot be applied to type `A` = note: an implementation of `std::ops::BitAnd` might be missing for `A` error[E0369]: binary operation `|` cannot be applied to type `A` - --> $DIR/issue-28837.rs:28:5 + --> $DIR/issue-28837.rs:18:5 | LL | a | a; //~ ERROR binary operation `|` cannot be applied to type `A` | ^^^^^ @@ -55,7 +55,7 @@ LL | a | a; //~ ERROR binary operation `|` cannot be applied to type `A` = note: an implementation of `std::ops::BitOr` might be missing for `A` error[E0369]: binary operation `<<` cannot be applied to type `A` - --> $DIR/issue-28837.rs:30:5 + --> $DIR/issue-28837.rs:20:5 | LL | a << a; //~ ERROR binary operation `<<` cannot be applied to type `A` | ^^^^^^ @@ -63,7 +63,7 @@ LL | a << a; //~ ERROR binary operation `<<` cannot be applied to type `A` = note: an implementation of `std::ops::Shl` might be missing for `A` error[E0369]: binary operation `>>` cannot be applied to type `A` - --> $DIR/issue-28837.rs:32:5 + --> $DIR/issue-28837.rs:22:5 | LL | a >> a; //~ ERROR binary operation `>>` cannot be applied to type `A` | ^^^^^^ @@ -71,7 +71,7 @@ LL | a >> a; //~ ERROR binary operation `>>` cannot be applied to type `A` = note: an implementation of `std::ops::Shr` might be missing for `A` error[E0369]: binary operation `==` cannot be applied to type `A` - --> $DIR/issue-28837.rs:34:5 + --> $DIR/issue-28837.rs:24:5 | LL | a == a; //~ ERROR binary operation `==` cannot be applied to type `A` | ^^^^^^ @@ -79,7 +79,7 @@ LL | a == a; //~ ERROR binary operation `==` cannot be applied to type `A` = note: an implementation of `std::cmp::PartialEq` might be missing for `A` error[E0369]: binary operation `!=` cannot be applied to type `A` - --> $DIR/issue-28837.rs:36:5 + --> $DIR/issue-28837.rs:26:5 | LL | a != a; //~ ERROR binary operation `!=` cannot be applied to type `A` | ^^^^^^ @@ -87,7 +87,7 @@ LL | a != a; //~ ERROR binary operation `!=` cannot be applied to type `A` = note: an implementation of `std::cmp::PartialEq` might be missing for `A` error[E0369]: binary operation `<` cannot be applied to type `A` - --> $DIR/issue-28837.rs:38:5 + --> $DIR/issue-28837.rs:28:5 | LL | a < a; //~ ERROR binary operation `<` cannot be applied to type `A` | ^^^^^ @@ -95,7 +95,7 @@ LL | a < a; //~ ERROR binary operation `<` cannot be applied to type `A` = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` error[E0369]: binary operation `<=` cannot be applied to type `A` - --> $DIR/issue-28837.rs:40:5 + --> $DIR/issue-28837.rs:30:5 | LL | a <= a; //~ ERROR binary operation `<=` cannot be applied to type `A` | ^^^^^^ @@ -103,7 +103,7 @@ LL | a <= a; //~ ERROR binary operation `<=` cannot be applied to type `A` = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` error[E0369]: binary operation `>` cannot be applied to type `A` - --> $DIR/issue-28837.rs:42:5 + --> $DIR/issue-28837.rs:32:5 | LL | a > a; //~ ERROR binary operation `>` cannot be applied to type `A` | ^^^^^ @@ -111,7 +111,7 @@ LL | a > a; //~ ERROR binary operation `>` cannot be applied to type `A` = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` error[E0369]: binary operation `>=` cannot be applied to type `A` - --> $DIR/issue-28837.rs:44:5 + --> $DIR/issue-28837.rs:34:5 | LL | a >= a; //~ ERROR binary operation `>=` cannot be applied to type `A` | ^^^^^^ diff --git a/src/test/ui/issues/issue-28848.rs b/src/test/ui/issues/issue-28848.rs index 1a06d59f0b1..a6250239030 100644 --- a/src/test/ui/issues/issue-28848.rs +++ b/src/test/ui/issues/issue-28848.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'a, 'b: 'a>(&'a &'b ()); impl<'a, 'b> Foo<'a, 'b> { diff --git a/src/test/ui/issues/issue-28848.stderr b/src/test/ui/issues/issue-28848.stderr index 738a1c0c6f6..d9cdccac9fc 100644 --- a/src/test/ui/issues/issue-28848.stderr +++ b/src/test/ui/issues/issue-28848.stderr @@ -1,16 +1,16 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/issue-28848.rs:20:5 + --> $DIR/issue-28848.rs:10:5 | LL | Foo::<'a, 'b>::xmute(u) //~ ERROR lifetime bound not satisfied | ^^^^^^^^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime 'b as defined on the function body at 19:16 - --> $DIR/issue-28848.rs:19:16 +note: lifetime parameter instantiated with the lifetime 'b as defined on the function body at 9:16 + --> $DIR/issue-28848.rs:9:16 | LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | ^^ -note: but lifetime parameter must outlive the lifetime 'a as defined on the function body at 19:12 - --> $DIR/issue-28848.rs:19:12 +note: but lifetime parameter must outlive the lifetime 'a as defined on the function body at 9:12 + --> $DIR/issue-28848.rs:9:12 | LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | ^^ diff --git a/src/test/ui/issues/issue-28871.rs b/src/test/ui/issues/issue-28871.rs index 0602b9b2297..b7e02b85878 100644 --- a/src/test/ui/issues/issue-28871.rs +++ b/src/test/ui/issues/issue-28871.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // Regression test for #28871. The problem is that rustc encountered // two ways to project, one from a where clause and one from the where diff --git a/src/test/ui/issues/issue-28936.rs b/src/test/ui/issues/issue-28936.rs index fd053838795..5365adf3e80 100644 --- a/src/test/ui/issues/issue-28936.rs +++ b/src/test/ui/issues/issue-28936.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub type Session = i32; pub struct StreamParser<'a, T> { diff --git a/src/test/ui/issues/issue-28971.rs b/src/test/ui/issues/issue-28971.rs index e553fee5a62..3f0d2fafb04 100644 --- a/src/test/ui/issues/issue-28971.rs +++ b/src/test/ui/issues/issue-28971.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This should not cause an ICE enum Foo { diff --git a/src/test/ui/issues/issue-28971.stderr b/src/test/ui/issues/issue-28971.stderr index c04e21f7c58..77d0b53ad21 100644 --- a/src/test/ui/issues/issue-28971.stderr +++ b/src/test/ui/issues/issue-28971.stderr @@ -1,13 +1,14 @@ error[E0599]: no variant named `Baz` found for type `Foo` in the current scope - --> $DIR/issue-28971.rs:19:13 + --> $DIR/issue-28971.rs:9:18 | LL | enum Foo { | -------- variant `Baz` not found here ... LL | Foo::Baz(..) => (), - | ^^^^^^^^^^^^ variant not found in `Foo` - | - = note: did you mean `Foo::Bar`? + | -----^^^---- + | | | + | | help: did you mean: `Bar` + | variant not found in `Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-28992-empty.rs b/src/test/ui/issues/issue-28992-empty.rs index 536784508b7..22961fc61d1 100644 --- a/src/test/ui/issues/issue-28992-empty.rs +++ b/src/test/ui/issues/issue-28992-empty.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Can't use constants as tuple struct patterns diff --git a/src/test/ui/issues/issue-28992-empty.stderr b/src/test/ui/issues/issue-28992-empty.stderr index 9b5e42f8eb9..1eb1c67d106 100644 --- a/src/test/ui/issues/issue-28992-empty.stderr +++ b/src/test/ui/issues/issue-28992-empty.stderr @@ -1,11 +1,11 @@ error[E0532]: expected tuple struct/variant, found constant `C1` - --> $DIR/issue-28992-empty.rs:23:12 + --> $DIR/issue-28992-empty.rs:13:12 | LL | if let C1(..) = 0 {} //~ ERROR expected tuple struct/variant, found constant `C1` | ^^ not a tuple struct/variant error[E0164]: expected tuple struct/variant, found associated constant `::C2` - --> $DIR/issue-28992-empty.rs:24:12 + --> $DIR/issue-28992-empty.rs:14:12 | LL | if let S::C2(..) = 0 {} | ^^^^^^^^^ not a tuple variant or struct diff --git a/src/test/ui/issues/issue-28999.rs b/src/test/ui/issues/issue-28999.rs index 7f4ccc971b7..4f6fa412e8b 100644 --- a/src/test/ui/issues/issue-28999.rs +++ b/src/test/ui/issues/issue-28999.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub struct Xyz<'a, V> { pub v: (V, &'a u32), diff --git a/src/test/ui/issues/issue-29030.rs b/src/test/ui/issues/issue-29030.rs index 08460e18c13..9ac7742e4f8 100644 --- a/src/test/ui/issues/issue-29030.rs +++ b/src/test/ui/issues/issue-29030.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #[derive(Debug)] diff --git a/src/test/ui/issues/issue-29037.rs b/src/test/ui/issues/issue-29037.rs index cb15e4048b9..e0eb71f5de6 100644 --- a/src/test/ui/issues/issue-29037.rs +++ b/src/test/ui/issues/issue-29037.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // This test ensures that each pointer type `P` is covariant in `X`. diff --git a/src/test/ui/issues/issue-2904.rs b/src/test/ui/issues/issue-2904.rs index 2e91979a517..7755b7ecee3 100644 --- a/src/test/ui/issues/issue-2904.rs +++ b/src/test/ui/issues/issue-2904.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_must_use)] #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-29048.rs b/src/test/ui/issues/issue-29048.rs index cbd0eab8b1c..6c4b6183c37 100644 --- a/src/test/ui/issues/issue-29048.rs +++ b/src/test/ui/issues/issue-29048.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub struct Chan; pub struct ChanSelect<'c, T> { diff --git a/src/test/ui/issues/issue-29071.rs b/src/test/ui/issues/issue-29071.rs index 874978826ca..1ea4a54226c 100644 --- a/src/test/ui/issues/issue-29071.rs +++ b/src/test/ui/issues/issue-29071.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/ui/issues/issue-29084.rs b/src/test/ui/issues/issue-29084.rs index 6cb6bbf1893..86b348d8285 100644 --- a/src/test/ui/issues/issue-29084.rs +++ b/src/test/ui/issues/issue-29084.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo { ($d:expr) => {{ fn bar(d: u8) { } diff --git a/src/test/ui/issues/issue-29084.stderr b/src/test/ui/issues/issue-29084.stderr index 3f1f18dabd0..cb4bf6a08ef 100644 --- a/src/test/ui/issues/issue-29084.stderr +++ b/src/test/ui/issues/issue-29084.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-29084.rs:14:13 + --> $DIR/issue-29084.rs:4:13 | LL | bar(&mut $d); | ^^^^^^^ expected u8, found &mut u8 diff --git a/src/test/ui/issues/issue-29124.rs b/src/test/ui/issues/issue-29124.rs index 77fa8192b97..1cd3f84f7a2 100644 --- a/src/test/ui/issues/issue-29124.rs +++ b/src/test/ui/issues/issue-29124.rs @@ -1,29 +1,19 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +struct Ret; +struct Obj; -struct ret; -struct obj; - -impl obj { - fn func() -> ret { - ret +impl Obj { + fn func() -> Ret { + Ret } } -fn func() -> ret { - ret +fn func() -> Ret { + Ret } fn main() { - obj::func.x(); - //~^ ERROR no method named `x` found for type `fn() -> ret {obj::func}` in the current scope + Obj::func.x(); + //~^ ERROR no method named `x` found for type `fn() -> Ret {Obj::func}` in the current scope func.x(); - //~^ ERROR no method named `x` found for type `fn() -> ret {func}` in the current scope + //~^ ERROR no method named `x` found for type `fn() -> Ret {func}` in the current scope } diff --git a/src/test/ui/issues/issue-29124.stderr b/src/test/ui/issues/issue-29124.stderr index bd00772dfd2..3beb7289788 100644 --- a/src/test/ui/issues/issue-29124.stderr +++ b/src/test/ui/issues/issue-29124.stderr @@ -1,13 +1,13 @@ -error[E0599]: no method named `x` found for type `fn() -> ret {obj::func}` in the current scope - --> $DIR/issue-29124.rs:25:15 +error[E0599]: no method named `x` found for type `fn() -> Ret {Obj::func}` in the current scope + --> $DIR/issue-29124.rs:15:15 | -LL | obj::func.x(); +LL | Obj::func.x(); | ^ | - = note: obj::func is a function, perhaps you wish to call it + = note: Obj::func is a function, perhaps you wish to call it -error[E0599]: no method named `x` found for type `fn() -> ret {func}` in the current scope - --> $DIR/issue-29124.rs:27:10 +error[E0599]: no method named `x` found for type `fn() -> Ret {func}` in the current scope + --> $DIR/issue-29124.rs:17:10 | LL | func.x(); | ^ diff --git a/src/test/ui/issues/issue-29147.rs b/src/test/ui/issues/issue-29147.rs index 0ecaa409412..7ec96b97eef 100644 --- a/src/test/ui/issues/issue-29147.rs +++ b/src/test/ui/issues/issue-29147.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![recursion_limit="1024"] pub struct S0(T,T); diff --git a/src/test/ui/issues/issue-29147.stderr b/src/test/ui/issues/issue-29147.stderr index d0ad0c99aa0..c6d850925ec 100644 --- a/src/test/ui/issues/issue-29147.stderr +++ b/src/test/ui/issues/issue-29147.stderr @@ -1,11 +1,11 @@ error[E0283]: type annotations required: cannot resolve `S5<_>: Foo` - --> $DIR/issue-29147.rs:31:13 + --> $DIR/issue-29147.rs:21:13 | LL | let _ = >::xxx; //~ ERROR cannot resolve `S5<_>: Foo` | ^^^^^^^^^^^^ | note: required by `Foo::xxx` - --> $DIR/issue-29147.rs:20:13 + --> $DIR/issue-29147.rs:10:13 | LL | trait Foo { fn xxx(&self); } | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-29161.rs b/src/test/ui/issues/issue-29161.rs index 97ba222fe45..d80405aa856 100644 --- a/src/test/ui/issues/issue-29161.rs +++ b/src/test/ui/issues/issue-29161.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { struct A; diff --git a/src/test/ui/issues/issue-29161.stderr b/src/test/ui/issues/issue-29161.stderr index 7d3bd03ba23..e0215157b36 100644 --- a/src/test/ui/issues/issue-29161.stderr +++ b/src/test/ui/issues/issue-29161.stderr @@ -1,11 +1,11 @@ error[E0449]: unnecessary visibility qualifier - --> $DIR/issue-29161.rs:15:9 + --> $DIR/issue-29161.rs:5:9 | LL | pub fn default() -> A { //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0603]: struct `A` is private - --> $DIR/issue-29161.rs:23:8 + --> $DIR/issue-29161.rs:13:8 | LL | a::A::default(); | ^ diff --git a/src/test/ui/issues/issue-29181.rs b/src/test/ui/issues/issue-29181.rs index 2fcec51912e..45752ad4f62 100644 --- a/src/test/ui/issues/issue-29181.rs +++ b/src/test/ui/issues/issue-29181.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-29181.rs extern crate issue_29181 as foo; diff --git a/src/test/ui/issues/issue-29181.stderr b/src/test/ui/issues/issue-29181.stderr index 5dda7848926..b277753608a 100644 --- a/src/test/ui/issues/issue-29181.stderr +++ b/src/test/ui/issues/issue-29181.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `homura` found for type `{integer}` in the current scope - --> $DIR/issue-29181.rs:16:7 + --> $DIR/issue-29181.rs:6:7 | LL | 0.homura(); //~ ERROR no method named `homura` found | ^^^^^^ diff --git a/src/test/ui/issues/issue-29184.rs b/src/test/ui/issues/issue-29184.rs index 98fe12c1b9d..c77e364c3b8 100644 --- a/src/test/ui/issues/issue-29184.rs +++ b/src/test/ui/issues/issue-29184.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: typeof(92) = 92; //~ ERROR `typeof` is a reserved keyword } diff --git a/src/test/ui/issues/issue-29184.stderr b/src/test/ui/issues/issue-29184.stderr index 72d7bb8d5f6..6c1eeb9c0dc 100644 --- a/src/test/ui/issues/issue-29184.stderr +++ b/src/test/ui/issues/issue-29184.stderr @@ -1,5 +1,5 @@ error[E0516]: `typeof` is a reserved keyword but unimplemented - --> $DIR/issue-29184.rs:12:12 + --> $DIR/issue-29184.rs:2:12 | LL | let x: typeof(92) = 92; //~ ERROR `typeof` is a reserved keyword | ^^^^^^^^^^ reserved keyword diff --git a/src/test/ui/issues/issue-29276.rs b/src/test/ui/issues/issue-29276.rs index 4ea720bfb7c..2a0358bc52a 100644 --- a/src/test/ui/issues/issue-29276.rs +++ b/src/test/ui/issues/issue-29276.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] struct S([u8; { struct Z; 0 }]); diff --git a/src/test/ui/issues/issue-2937.rs b/src/test/ui/issues/issue-2937.rs index 0d684ec5ae1..335df5c07e2 100644 --- a/src/test/ui/issues/issue-2937.rs +++ b/src/test/ui/issues/issue-2937.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use m::f as x; //~ ERROR unresolved import `m::f` [E0432] //~^ no `f` in `m` diff --git a/src/test/ui/issues/issue-2937.stderr b/src/test/ui/issues/issue-2937.stderr index 8c0125c7522..e63ee42d99c 100644 --- a/src/test/ui/issues/issue-2937.stderr +++ b/src/test/ui/issues/issue-2937.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `m::f` - --> $DIR/issue-2937.rs:11:5 + --> $DIR/issue-2937.rs:1:5 | LL | use m::f as x; //~ ERROR unresolved import `m::f` [E0432] | ^^^^^^^^^ no `f` in `m` diff --git a/src/test/ui/issues/issue-2951.rs b/src/test/ui/issues/issue-2951.rs index 11ff7ab2476..e0ae3ffa624 100644 --- a/src/test/ui/issues/issue-2951.rs +++ b/src/test/ui/issues/issue-2951.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(x: T, y: U) { let mut xx = x; xx = y; diff --git a/src/test/ui/issues/issue-2951.stderr b/src/test/ui/issues/issue-2951.stderr index 8c166807c46..58e28c1a9dc 100644 --- a/src/test/ui/issues/issue-2951.stderr +++ b/src/test/ui/issues/issue-2951.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-2951.rs:13:10 + --> $DIR/issue-2951.rs:3:10 | LL | xx = y; | ^ expected type parameter, found a different type parameter diff --git a/src/test/ui/issues/issue-29516.rs b/src/test/ui/issues/issue-29516.rs index 8315585e15e..8082694e15c 100644 --- a/src/test/ui/issues/issue-29516.rs +++ b/src/test/ui/issues/issue-29516.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(optin_builtin_traits)] diff --git a/src/test/ui/issues/issue-29540.rs b/src/test/ui/issues/issue-29540.rs index 0dbd830c135..b68205eda86 100644 --- a/src/test/ui/issues/issue-29540.rs +++ b/src/test/ui/issues/issue-29540.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #[derive(Debug)] pub struct Config { diff --git a/src/test/ui/issues/issue-29710.rs b/src/test/ui/issues/issue-29710.rs index 971aac8f694..58907e78e48 100644 --- a/src/test/ui/issues/issue-29710.rs +++ b/src/test/ui/issues/issue-29710.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![deny(unused_results)] #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-29723.rs b/src/test/ui/issues/issue-29723.rs index f31e965ae01..41db52a1fad 100644 --- a/src/test/ui/issues/issue-29723.rs +++ b/src/test/ui/issues/issue-29723.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] // test for https://github.com/rust-lang/rust/issues/29723 diff --git a/src/test/ui/issues/issue-29723.stderr b/src/test/ui/issues/issue-29723.stderr index 48e50b9dea9..7928af5d5a5 100644 --- a/src/test/ui/issues/issue-29723.stderr +++ b/src/test/ui/issues/issue-29723.stderr @@ -1,13 +1,14 @@ error[E0382]: use of moved value: `s` - --> $DIR/issue-29723.rs:22:13 + --> $DIR/issue-29723.rs:12:13 | +LL | let s = String::new(); + | - move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait +LL | let _s = match 0 { LL | 0 if { drop(s); false } => String::from("oops"), | - value moved here ... LL | s | ^ value used here after move - | - = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/issues/issue-29740.rs b/src/test/ui/issues/issue-29740.rs index e383b712f24..f37d868ab7e 100644 --- a/src/test/ui/issues/issue-29740.rs +++ b/src/test/ui/issues/issue-29740.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Regression test for #29740. Inefficient MIR matching algorithms diff --git a/src/test/ui/issues/issue-29743.rs b/src/test/ui/issues/issue-29743.rs index e563bf0a412..5bc3b0c537a 100644 --- a/src/test/ui/issues/issue-29743.rs +++ b/src/test/ui/issues/issue-29743.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // compile-pass diff --git a/src/test/ui/issues/issue-29857.rs b/src/test/ui/issues/issue-29857.rs index be28bf0d272..5aff968bb6a 100644 --- a/src/test/ui/issues/issue-29857.rs +++ b/src/test/ui/issues/issue-29857.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen diff --git a/src/test/ui/issues/issue-29861.rs b/src/test/ui/issues/issue-29861.rs index 79514ad376b..58f8eb5362c 100644 --- a/src/test/ui/issues/issue-29861.rs +++ b/src/test/ui/issues/issue-29861.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait MakeRef<'a> { type Ref; } diff --git a/src/test/ui/issues/issue-29861.stderr b/src/test/ui/issues/issue-29861.stderr index 27453337b10..d9d3cf360df 100644 --- a/src/test/ui/issues/issue-29861.stderr +++ b/src/test/ui/issues/issue-29861.stderr @@ -1,5 +1,5 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-29861.rs:21:6 + --> $DIR/issue-29861.rs:11:6 | LL | impl<'a, T: 'a> MakeRef2 for T { | ^^ unconstrained lifetime parameter diff --git a/src/test/ui/issues/issue-2995.rs b/src/test/ui/issues/issue-2995.rs index d735e184d5c..0da7909480d 100644 --- a/src/test/ui/issues/issue-2995.rs +++ b/src/test/ui/issues/issue-2995.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn bad (p: *const isize) { let _q: &isize = p as &isize; //~ ERROR non-primitive cast } diff --git a/src/test/ui/issues/issue-2995.stderr b/src/test/ui/issues/issue-2995.stderr index b52bbbead91..68cb283e453 100644 --- a/src/test/ui/issues/issue-2995.stderr +++ b/src/test/ui/issues/issue-2995.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `*const isize` as `&isize` - --> $DIR/issue-2995.rs:12:22 + --> $DIR/issue-2995.rs:2:22 | LL | let _q: &isize = p as &isize; //~ ERROR non-primitive cast | ^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-30007.rs b/src/test/ui/issues/issue-30007.rs index c17833ee830..918a821bae9 100644 --- a/src/test/ui/issues/issue-30007.rs +++ b/src/test/ui/issues/issue-30007.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! t { () => ( String ; ); //~ ERROR macro expansion ignores token `;` } diff --git a/src/test/ui/issues/issue-30007.stderr b/src/test/ui/issues/issue-30007.stderr index 028ed048d65..fb069e8ff98 100644 --- a/src/test/ui/issues/issue-30007.stderr +++ b/src/test/ui/issues/issue-30007.stderr @@ -1,5 +1,5 @@ error: macro expansion ignores token `;` and any following - --> $DIR/issue-30007.rs:12:20 + --> $DIR/issue-30007.rs:2:20 | LL | () => ( String ; ); //~ ERROR macro expansion ignores token `;` | ^ diff --git a/src/test/ui/issues/issue-30079.rs b/src/test/ui/issues/issue-30079.rs index 04ae8f6d255..a02a932d057 100644 --- a/src/test/ui/issues/issue-30079.rs +++ b/src/test/ui/issues/issue-30079.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct SemiPriv; mod m1 { diff --git a/src/test/ui/issues/issue-30079.stderr b/src/test/ui/issues/issue-30079.stderr index dadaf3db24e..b62482add30 100644 --- a/src/test/ui/issues/issue-30079.stderr +++ b/src/test/ui/issues/issue-30079.stderr @@ -1,5 +1,5 @@ warning: private type `m1::Priv` in public interface (error E0446) - --> $DIR/issue-30079.rs:16:9 + --> $DIR/issue-30079.rs:6:9 | LL | pub fn f(_: Priv) {} //~ WARN private type `m1::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | pub fn f(_: Priv) {} //~ WARN private type `m1::Priv` in public int = note: for more information, see issue #34537 error[E0446]: private type `m2::Priv` in public interface - --> $DIR/issue-30079.rs:28:9 + --> $DIR/issue-30079.rs:18:9 | LL | struct Priv; | - `m2::Priv` declared as private @@ -18,7 +18,7 @@ LL | type Target = Priv; //~ ERROR private type `m2::Priv` in public int | ^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `m3::Priv` in public interface - --> $DIR/issue-30079.rs:45:9 + --> $DIR/issue-30079.rs:35:9 | LL | struct Priv; | - `m3::Priv` declared as private diff --git a/src/test/ui/issues/issue-3008-1.rs b/src/test/ui/issues/issue-3008-1.rs index 89de27326b4..1124969e6d0 100644 --- a/src/test/ui/issues/issue-3008-1.rs +++ b/src/test/ui/issues/issue-3008-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { Foo_(Bar) } diff --git a/src/test/ui/issues/issue-3008-1.stderr b/src/test/ui/issues/issue-3008-1.stderr index fe3e294d9e3..f12274134ee 100644 --- a/src/test/ui/issues/issue-3008-1.stderr +++ b/src/test/ui/issues/issue-3008-1.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `Bar` has infinite size - --> $DIR/issue-3008-1.rs:15:1 + --> $DIR/issue-3008-1.rs:5:1 | LL | enum Bar { | ^^^^^^^^ recursive type has infinite size diff --git a/src/test/ui/issues/issue-3008-2.rs b/src/test/ui/issues/issue-3008-2.rs index b627656c91a..5846c69da41 100644 --- a/src/test/ui/issues/issue-3008-2.rs +++ b/src/test/ui/issues/issue-3008-2.rs @@ -1,15 +1,5 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum foo { foo_(bar) } -struct bar { x: bar } +enum Foo { Foo_(Bar) } +struct Bar { x: Bar } //~^ ERROR E0072 fn main() { diff --git a/src/test/ui/issues/issue-3008-2.stderr b/src/test/ui/issues/issue-3008-2.stderr index d02fb45be49..acc15f4b57c 100644 --- a/src/test/ui/issues/issue-3008-2.stderr +++ b/src/test/ui/issues/issue-3008-2.stderr @@ -1,12 +1,12 @@ -error[E0072]: recursive type `bar` has infinite size - --> $DIR/issue-3008-2.rs:12:1 +error[E0072]: recursive type `Bar` has infinite size + --> $DIR/issue-3008-2.rs:2:1 | -LL | struct bar { x: bar } +LL | struct Bar { x: Bar } | ^^^^^^^^^^ ------ recursive without indirection | | | recursive type has infinite size | - = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `bar` representable + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3008-3.rs b/src/test/ui/issues/issue-3008-3.rs index 66bfab003e9..212eb2eb8e0 100644 --- a/src/test/ui/issues/issue-3008-3.rs +++ b/src/test/ui/issues/issue-3008-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; enum E1 { V1(E2), } diff --git a/src/test/ui/issues/issue-3008-3.stderr b/src/test/ui/issues/issue-3008-3.stderr index 22c0871fb0c..d08a3d9708d 100644 --- a/src/test/ui/issues/issue-3008-3.stderr +++ b/src/test/ui/issues/issue-3008-3.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `E2` has infinite size - --> $DIR/issue-3008-3.rs:14:1 + --> $DIR/issue-3008-3.rs:4:1 | LL | enum E2 { V2(E2, marker::PhantomData), } | ^^^^^^^^^^ ------ recursive without indirection diff --git a/src/test/ui/issues/issue-30123.rs b/src/test/ui/issues/issue-30123.rs index 39278cffa12..4fc32e0de8d 100644 --- a/src/test/ui/issues/issue-30123.rs +++ b/src/test/ui/issues/issue-30123.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-30123-aux.rs extern crate issue_30123_aux; diff --git a/src/test/ui/issues/issue-30123.stderr b/src/test/ui/issues/issue-30123.stderr index 094c962de29..555bdb1236f 100644 --- a/src/test/ui/issues/issue-30123.stderr +++ b/src/test/ui/issues/issue-30123.stderr @@ -1,8 +1,10 @@ error[E0599]: no function or associated item named `new_undirected` found for type `issue_30123_aux::Graph` in the current scope - --> $DIR/issue-30123.rs:17:14 + --> $DIR/issue-30123.rs:7:33 | LL | let ug = Graph::::new_undirected(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `issue_30123_aux::Graph` + | -------------------^^^^^^^^^^^^^^ + | | + | function or associated item not found in `issue_30123_aux::Graph` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3021-b.rs b/src/test/ui/issues/issue-3021-b.rs index 2b0a24cfdb3..f1630afe173 100644 --- a/src/test/ui/issues/issue-3021-b.rs +++ b/src/test/ui/issues/issue-3021-b.rs @@ -1,20 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn siphash(k0 : u64) { - struct siphash { + struct SipHash { v0: u64, } - impl siphash { + impl SipHash { pub fn reset(&mut self) { self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment } diff --git a/src/test/ui/issues/issue-3021-b.stderr b/src/test/ui/issues/issue-3021-b.stderr index dfc80e5ca52..375da43c197 100644 --- a/src/test/ui/issues/issue-3021-b.stderr +++ b/src/test/ui/issues/issue-3021-b.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/issue-3021-b.rs:19:22 + --> $DIR/issue-3021-b.rs:9:22 | LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment | ^^ diff --git a/src/test/ui/issues/issue-3021-c.rs b/src/test/ui/issues/issue-3021-c.rs index 55975cc8e86..491336206ca 100644 --- a/src/test/ui/issues/issue-3021-c.rs +++ b/src/test/ui/issues/issue-3021-c.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn siphash() { - trait t { + trait U { fn g(&self, x: T) -> T; //~ ERROR can't use type parameters from outer function //~^ ERROR can't use type parameters from outer function } diff --git a/src/test/ui/issues/issue-3021-c.stderr b/src/test/ui/issues/issue-3021-c.stderr index 4a250e76af3..323ce4fa306 100644 --- a/src/test/ui/issues/issue-3021-c.stderr +++ b/src/test/ui/issues/issue-3021-c.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use type parameters from outer function - --> $DIR/issue-3021-c.rs:14:24 + --> $DIR/issue-3021-c.rs:4:24 | LL | fn siphash() { | - type variable from outer function @@ -10,7 +10,7 @@ LL | fn g(&self, x: T) -> T; //~ ERROR can't use type parameters from o | help: try using a local type parameter instead: `g` error[E0401]: can't use type parameters from outer function - --> $DIR/issue-3021-c.rs:14:30 + --> $DIR/issue-3021-c.rs:4:30 | LL | fn siphash() { | - type variable from outer function diff --git a/src/test/ui/issues/issue-3021-d.rs b/src/test/ui/issues/issue-3021-d.rs index c23e12e713a..1fb0002b2fc 100644 --- a/src/test/ui/issues/issue-3021-d.rs +++ b/src/test/ui/issues/issue-3021-d.rs @@ -1,14 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait siphash { +trait SipHash { fn result(&self) -> u64; fn reset(&self); } @@ -26,7 +16,7 @@ fn siphash(k0 : u64, k1 : u64) { return v0 ^ v1; } - impl siphash for SipState { + impl SipHash for SipState { fn reset(&self) { self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment self.v1 = k1 ^ 0x646f72616e646f6d; //~ ERROR can't capture dynamic environment diff --git a/src/test/ui/issues/issue-3021-d.stderr b/src/test/ui/issues/issue-3021-d.stderr index ab5ad94a031..ffefab19725 100644 --- a/src/test/ui/issues/issue-3021-d.stderr +++ b/src/test/ui/issues/issue-3021-d.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/issue-3021-d.rs:31:23 + --> $DIR/issue-3021-d.rs:21:23 | LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment | ^^ @@ -7,7 +7,7 @@ LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dyna = help: use the `|| { ... }` closure form instead error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/issue-3021-d.rs:32:23 + --> $DIR/issue-3021-d.rs:22:23 | LL | self.v1 = k1 ^ 0x646f72616e646f6d; //~ ERROR can't capture dynamic environment | ^^ diff --git a/src/test/ui/issues/issue-3021.rs b/src/test/ui/issues/issue-3021.rs index f93a333d2ae..a672261f8d6 100644 --- a/src/test/ui/issues/issue-3021.rs +++ b/src/test/ui/issues/issue-3021.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait SipHash { fn reset(&self); } diff --git a/src/test/ui/issues/issue-3021.stderr b/src/test/ui/issues/issue-3021.stderr index 312b9f3b864..38c5bd2b94a 100644 --- a/src/test/ui/issues/issue-3021.stderr +++ b/src/test/ui/issues/issue-3021.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/issue-3021.rs:22:22 + --> $DIR/issue-3021.rs:12:22 | LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment | ^^ diff --git a/src/test/ui/issues/issue-30225.rs b/src/test/ui/issues/issue-30225.rs index 7acbbfb8826..42315332c20 100644 --- a/src/test/ui/issues/issue-30225.rs +++ b/src/test/ui/issues/issue-30225.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #30225, which was an ICE that would trigger as // a result of a poor interaction between trait result caching and // type inference. Specifically, at that time, unification could cause diff --git a/src/test/ui/issues/issue-30225.stderr b/src/test/ui/issues/issue-30225.stderr index b3bbf233257..64a56e3237d 100644 --- a/src/test/ui/issues/issue-30225.stderr +++ b/src/test/ui/issues/issue-30225.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-30225.rs:41:9 + --> $DIR/issue-30225.rs:31:9 | LL | u = v; // mark $0 and $1 in a subtype relationship | ^ expected struct `A`, found struct `B` diff --git a/src/test/ui/issues/issue-30236.rs b/src/test/ui/issues/issue-30236.rs index 45a5cd09337..02f899be09c 100644 --- a/src/test/ui/issues/issue-30236.rs +++ b/src/test/ui/issues/issue-30236.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type Foo< Unused //~ ERROR type parameter `Unused` is unused > = u8; diff --git a/src/test/ui/issues/issue-30236.stderr b/src/test/ui/issues/issue-30236.stderr index 3a9f075d480..e60babd9559 100644 --- a/src/test/ui/issues/issue-30236.stderr +++ b/src/test/ui/issues/issue-30236.stderr @@ -1,5 +1,5 @@ error[E0091]: type parameter `Unused` is unused - --> $DIR/issue-30236.rs:12:5 + --> $DIR/issue-30236.rs:2:5 | LL | Unused //~ ERROR type parameter `Unused` is unused | ^^^^^^ unused type parameter diff --git a/src/test/ui/issues/issue-30240-b.rs b/src/test/ui/issues/issue-30240-b.rs index cf6935b9ba6..2df06842e18 100644 --- a/src/test/ui/issues/issue-30240-b.rs +++ b/src/test/ui/issues/issue-30240-b.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unreachable_patterns)] fn main() { diff --git a/src/test/ui/issues/issue-30240-b.stderr b/src/test/ui/issues/issue-30240-b.stderr index 535d1a92ed9..5613a18f404 100644 --- a/src/test/ui/issues/issue-30240-b.stderr +++ b/src/test/ui/issues/issue-30240-b.stderr @@ -1,11 +1,11 @@ error: unreachable pattern - --> $DIR/issue-30240-b.rs:22:9 + --> $DIR/issue-30240-b.rs:12:9 | LL | "hello" => {} //~ ERROR unreachable pattern | ^^^^^^^ | note: lint level defined here - --> $DIR/issue-30240-b.rs:11:9 + --> $DIR/issue-30240-b.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-30240.rs b/src/test/ui/issues/issue-30240.rs index 60fb307d4e1..a0c0d1626ec 100644 --- a/src/test/ui/issues/issue-30240.rs +++ b/src/test/ui/issues/issue-30240.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match "world" { //~ ERROR non-exhaustive patterns: `&_` "hello" => {} diff --git a/src/test/ui/issues/issue-30240.stderr b/src/test/ui/issues/issue-30240.stderr index 9acb53ff911..973c59c5852 100644 --- a/src/test/ui/issues/issue-30240.stderr +++ b/src/test/ui/issues/issue-30240.stderr @@ -1,11 +1,11 @@ error[E0004]: non-exhaustive patterns: `&_` not covered - --> $DIR/issue-30240.rs:12:11 + --> $DIR/issue-30240.rs:2:11 | LL | match "world" { //~ ERROR non-exhaustive patterns: `&_` | ^^^^^^^ pattern `&_` not covered error[E0004]: non-exhaustive patterns: `&_` not covered - --> $DIR/issue-30240.rs:16:11 + --> $DIR/issue-30240.rs:6:11 | LL | match "world" { //~ ERROR non-exhaustive patterns: `&_` | ^^^^^^^ pattern `&_` not covered diff --git a/src/test/ui/issues/issue-30255.rs b/src/test/ui/issues/issue-30255.rs index 64f70ef2b6f..6970a122b71 100644 --- a/src/test/ui/issues/issue-30255.rs +++ b/src/test/ui/issues/issue-30255.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // Test that lifetime elision error messages correctly omit parameters // with no elided lifetimes diff --git a/src/test/ui/issues/issue-30255.stderr b/src/test/ui/issues/issue-30255.stderr index 9556f6d9e23..c53129b7f29 100644 --- a/src/test/ui/issues/issue-30255.stderr +++ b/src/test/ui/issues/issue-30255.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-30255.rs:18:24 + --> $DIR/issue-30255.rs:9:24 | LL | fn f(a: &S, b: i32) -> &i32 { | ^ expected lifetime parameter @@ -7,7 +7,7 @@ LL | fn f(a: &S, b: i32) -> &i32 { = help: this function's return type contains a borrowed value, but the signature does not say which one of `a`'s 2 lifetimes it is borrowed from error[E0106]: missing lifetime specifier - --> $DIR/issue-30255.rs:23:34 + --> $DIR/issue-30255.rs:14:34 | LL | fn g(a: &S, b: bool, c: &i32) -> &i32 { | ^ expected lifetime parameter @@ -15,7 +15,7 @@ LL | fn g(a: &S, b: bool, c: &i32) -> &i32 { = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from one of `a`'s 2 lifetimes or `c` error[E0106]: missing lifetime specifier - --> $DIR/issue-30255.rs:28:44 + --> $DIR/issue-30255.rs:19:44 | LL | fn h(a: &bool, b: bool, c: &S, d: &i32) -> &i32 { | ^ expected lifetime parameter diff --git a/src/test/ui/issues/issue-30302.rs b/src/test/ui/issues/issue-30302.rs index 51c76713a76..c37d4f29d10 100644 --- a/src/test/ui/issues/issue-30302.rs +++ b/src/test/ui/issues/issue-30302.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_variables)] #![allow(non_snake_case)] diff --git a/src/test/ui/issues/issue-30302.stderr b/src/test/ui/issues/issue-30302.stderr index fa3cb92b180..193a8c4916c 100644 --- a/src/test/ui/issues/issue-30302.stderr +++ b/src/test/ui/issues/issue-30302.stderr @@ -1,11 +1,11 @@ warning[E0170]: pattern binding `Nil` is named the same as one of the variants of the type `Stack` - --> $DIR/issue-30302.rs:23:9 + --> $DIR/issue-30302.rs:13:9 | LL | Nil => true, | ^^^ help: to match on the variant, qualify the path: `Stack::Nil` error: unreachable pattern - --> $DIR/issue-30302.rs:25:9 + --> $DIR/issue-30302.rs:15:9 | LL | Nil => true, | --- matches any value @@ -14,7 +14,7 @@ LL | _ => false | ^ unreachable pattern | note: lint level defined here - --> $DIR/issue-30302.rs:14:9 + --> $DIR/issue-30302.rs:4:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-30355.nll.stderr b/src/test/ui/issues/issue-30355.nll.stderr deleted file mode 100644 index fdf8157dcf8..00000000000 --- a/src/test/ui/issues/issue-30355.nll.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0161]: cannot move a value of type X: the size of X cannot be statically determined - --> $DIR/issue-30355.rs:15:6 - | -LL | &X(*Y) - | ^^^^^ - -error[E0161]: cannot move a value of type [u8]: the size of [u8] cannot be statically determined - --> $DIR/issue-30355.rs:15:8 - | -LL | &X(*Y) - | ^^ - -error[E0508]: cannot move out of type `[u8]`, a non-copy slice - --> $DIR/issue-30355.rs:15:8 - | -LL | &X(*Y) - | ^^ cannot move out of here - -error: aborting due to 3 previous errors - -Some errors occurred: E0161, E0508. -For more information about an error, try `rustc --explain E0161`. diff --git a/src/test/ui/issues/issue-30355.rs b/src/test/ui/issues/issue-30355.rs index ee19d040318..6ff5b37f6e5 100644 --- a/src/test/ui/issues/issue-30355.rs +++ b/src/test/ui/issues/issue-30355.rs @@ -1,21 +1,9 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct X([u8]); pub static Y: &'static X = { const Y: &'static [u8] = b""; &X(*Y) - //~^ ERROR cannot move out - //~^^ ERROR cannot move a - //~^^^ ERROR cannot move a + //~^ ERROR E0277 }; fn main() {} diff --git a/src/test/ui/issues/issue-30355.stderr b/src/test/ui/issues/issue-30355.stderr index 7e843688035..48b151c73c9 100644 --- a/src/test/ui/issues/issue-30355.stderr +++ b/src/test/ui/issues/issue-30355.stderr @@ -1,22 +1,14 @@ -error[E0161]: cannot move a value of type X: the size of X cannot be statically determined - --> $DIR/issue-30355.rs:15:6 +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/issue-30355.rs:5:6 | LL | &X(*Y) - | ^^^^^ - -error[E0161]: cannot move a value of type [u8]: the size of [u8] cannot be statically determined - --> $DIR/issue-30355.rs:15:8 + | ^ doesn't have a size known at compile-time | -LL | &X(*Y) - | ^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/issue-30355.rs:15:8 - | -LL | &X(*Y) - | ^^ cannot move out of borrowed content + = help: the trait `std::marker::Sized` is not implemented for `[u8]` + = note: to learn more, visit + = note: all function arguments must have a statically known size + = help: unsized locals are gated as an unstable feature -error: aborting due to 3 previous errors +error: aborting due to previous error -Some errors occurred: E0161, E0507. -For more information about an error, try `rustc --explain E0161`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-3038.rs b/src/test/ui/issues/issue-3038.rs index 1eec62df788..cf3ba009f00 100644 --- a/src/test/ui/issues/issue-3038.rs +++ b/src/test/ui/issues/issue-3038.rs @@ -1,30 +1,20 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +enum F { G(isize, isize) } -enum f { g(isize, isize) } +enum H { I(J, K) } -enum h { i(j, k) } - -enum j { l(isize, isize) } -enum k { m(isize, isize) } +enum J { L(isize, isize) } +enum K { M(isize, isize) } fn main() { - let _z = match f::g(1, 2) { - f::g(x, x) => { println!("{}", x + x); } + let _z = match F::G(1, 2) { + F::G(x, x) => { println!("{}", x + x); } //~^ ERROR identifier `x` is bound more than once in the same pattern }; - let _z = match h::i(j::l(1, 2), k::m(3, 4)) { - h::i(j::l(x, _), k::m(_, x)) + let _z = match H::I(J::L(1, 2), K::M(3, 4)) { + H::I(J::L(x, _), K::M(_, x)) //~^ ERROR identifier `x` is bound more than once in the same pattern => { println!("{}", x + x); } }; diff --git a/src/test/ui/issues/issue-3038.stderr b/src/test/ui/issues/issue-3038.stderr index 17ad9936149..8638c196524 100644 --- a/src/test/ui/issues/issue-3038.stderr +++ b/src/test/ui/issues/issue-3038.stderr @@ -1,17 +1,17 @@ error[E0416]: identifier `x` is bound more than once in the same pattern - --> $DIR/issue-3038.rs:22:15 + --> $DIR/issue-3038.rs:12:15 | -LL | f::g(x, x) => { println!("{}", x + x); } +LL | F::G(x, x) => { println!("{}", x + x); } | ^ used in a pattern more than once error[E0416]: identifier `x` is bound more than once in the same pattern - --> $DIR/issue-3038.rs:27:32 + --> $DIR/issue-3038.rs:17:32 | -LL | h::i(j::l(x, _), k::m(_, x)) +LL | H::I(J::L(x, _), K::M(_, x)) | ^ used in a pattern more than once error[E0416]: identifier `x` is bound more than once in the same pattern - --> $DIR/issue-3038.rs:33:13 + --> $DIR/issue-3038.rs:23:13 | LL | (x, x) => { x } //~ ERROR identifier `x` is bound more than once in the same pattern | ^ used in a pattern more than once diff --git a/src/test/ui/issues/issue-30438-a.nll.stderr b/src/test/ui/issues/issue-30438-a.nll.stderr index 8f7afc8a78d..53845af82fb 100644 --- a/src/test/ui/issues/issue-30438-a.nll.stderr +++ b/src/test/ui/issues/issue-30438-a.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to temporary value - --> $DIR/issue-30438-a.rs:22:16 + --> $DIR/issue-30438-a.rs:12:16 | LL | return &Test { s: &self.s}; | ^------------------ diff --git a/src/test/ui/issues/issue-30438-a.rs b/src/test/ui/issues/issue-30438-a.rs index 441815de81d..8900821090b 100644 --- a/src/test/ui/issues/issue-30438-a.rs +++ b/src/test/ui/issues/issue-30438-a.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Original regression test for Issue #30438. use std::ops::Index; diff --git a/src/test/ui/issues/issue-30438-a.stderr b/src/test/ui/issues/issue-30438-a.stderr index 5f4a51a927a..94aca7f0319 100644 --- a/src/test/ui/issues/issue-30438-a.stderr +++ b/src/test/ui/issues/issue-30438-a.stderr @@ -1,13 +1,13 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/issue-30438-a.rs:22:17 + --> $DIR/issue-30438-a.rs:12:17 | LL | return &Test { s: &self.s}; | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here | | | temporary value does not live long enough | -note: borrowed value must be valid for the anonymous lifetime #1 defined on the method body at 21:5... - --> $DIR/issue-30438-a.rs:21:5 +note: borrowed value must be valid for the anonymous lifetime #1 defined on the method body at 11:5... + --> $DIR/issue-30438-a.rs:11:5 | LL | / fn index(&self, _: usize) -> &Self::Output { LL | | return &Test { s: &self.s}; diff --git a/src/test/ui/issues/issue-30438-b.nll.stderr b/src/test/ui/issues/issue-30438-b.nll.stderr index 6be8180e007..fd6bd25b1da 100644 --- a/src/test/ui/issues/issue-30438-b.nll.stderr +++ b/src/test/ui/issues/issue-30438-b.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to temporary value - --> $DIR/issue-30438-b.rs:23:9 + --> $DIR/issue-30438-b.rs:13:9 | LL | &Test { s: &self.s} | ^------------------ diff --git a/src/test/ui/issues/issue-30438-b.rs b/src/test/ui/issues/issue-30438-b.rs index 981b196c4ae..b84211bec67 100644 --- a/src/test/ui/issues/issue-30438-b.rs +++ b/src/test/ui/issues/issue-30438-b.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Modified regression test for Issue #30438 that exposed an // independent issue (see discussion on ticket). diff --git a/src/test/ui/issues/issue-30438-b.stderr b/src/test/ui/issues/issue-30438-b.stderr index 651ff9f2ae1..b99801dad81 100644 --- a/src/test/ui/issues/issue-30438-b.stderr +++ b/src/test/ui/issues/issue-30438-b.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/issue-30438-b.rs:23:10 + --> $DIR/issue-30438-b.rs:13:10 | LL | &Test { s: &self.s} | ^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -7,8 +7,8 @@ LL | //~^ ERROR: borrowed value does not live long enough LL | } | - temporary value only lives until here | -note: borrowed value must be valid for the anonymous lifetime #1 defined on the method body at 22:5... - --> $DIR/issue-30438-b.rs:22:5 +note: borrowed value must be valid for the anonymous lifetime #1 defined on the method body at 12:5... + --> $DIR/issue-30438-b.rs:12:5 | LL | / fn index(&self, _: usize) -> &Self::Output { LL | | &Test { s: &self.s} diff --git a/src/test/ui/issues/issue-30438-c.nll.stderr b/src/test/ui/issues/issue-30438-c.nll.stderr index bce4bc4812a..7c001088097 100644 --- a/src/test/ui/issues/issue-30438-c.nll.stderr +++ b/src/test/ui/issues/issue-30438-c.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-30438-c.rs:19:5 + --> $DIR/issue-30438-c.rs:9:5 | LL | &x | ^^ returns a reference to data owned by the current function diff --git a/src/test/ui/issues/issue-30438-c.rs b/src/test/ui/issues/issue-30438-c.rs index 2b4d0dc339b..75caf0a75df 100644 --- a/src/test/ui/issues/issue-30438-c.rs +++ b/src/test/ui/issues/issue-30438-c.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Simplified regression test for #30438, inspired by arielb1. trait Trait { type Out; } diff --git a/src/test/ui/issues/issue-30438-c.stderr b/src/test/ui/issues/issue-30438-c.stderr index dc6e1c52be1..71c2ed9dfc9 100644 --- a/src/test/ui/issues/issue-30438-c.stderr +++ b/src/test/ui/issues/issue-30438-c.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/issue-30438-c.rs:19:6 + --> $DIR/issue-30438-c.rs:9:6 | LL | &x | ^ borrowed value does not live long enough @@ -7,8 +7,8 @@ LL | //~^ ERROR: `x` does not live long enough LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'y as defined on the function body at 17:10... - --> $DIR/issue-30438-c.rs:17:10 +note: borrowed value must be valid for the lifetime 'y as defined on the function body at 7:10... + --> $DIR/issue-30438-c.rs:7:10 | LL | fn silly<'y, 'z>(_s: &'y Test<'z>) -> &'y as Trait>::Out where 'z: 'static { | ^^ diff --git a/src/test/ui/issues/issue-3044.rs b/src/test/ui/issues/issue-3044.rs index 5708f160a41..26db04b69b4 100644 --- a/src/test/ui/issues/issue-3044.rs +++ b/src/test/ui/issues/issue-3044.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn main() { let needlesArr: Vec = vec!['a', 'f']; needlesArr.iter().fold(|x, y| { diff --git a/src/test/ui/issues/issue-3044.stderr b/src/test/ui/issues/issue-3044.stderr index cdca9be48ac..35a85b604b2 100644 --- a/src/test/ui/issues/issue-3044.stderr +++ b/src/test/ui/issues/issue-3044.stderr @@ -1,5 +1,5 @@ error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/issue-3044.rs:14:23 + --> $DIR/issue-3044.rs:3:23 | LL | needlesArr.iter().fold(|x, y| { | ^^^^ expected 2 parameters diff --git a/src/test/ui/issues/issue-30535.rs b/src/test/ui/issues/issue-30535.rs index 90f5220a623..d48f00d5aca 100644 --- a/src/test/ui/issues/issue-30535.rs +++ b/src/test/ui/issues/issue-30535.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-30535.rs extern crate issue_30535 as foo; diff --git a/src/test/ui/issues/issue-30535.stderr b/src/test/ui/issues/issue-30535.stderr index c3838fdb9cf..b93ed8d9c2a 100644 --- a/src/test/ui/issues/issue-30535.stderr +++ b/src/test/ui/issues/issue-30535.stderr @@ -1,10 +1,11 @@ error[E0573]: expected type, found variant `foo::Foo::FooV` - --> $DIR/issue-30535.rs:16:8 + --> $DIR/issue-30535.rs:6:8 | LL | _: foo::Foo::FooV //~ ERROR expected type, found variant `foo::Foo::FooV` - | ^^^^^^^^^^^^^^ not a type - | - = help: there is an enum variant `foo::Foo::FooV`, try using `foo::Foo`? + | ^^^^^^^^^^^^^^ + | | + | not a type + | help: try using the variant's enum: `foo::Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-30560.rs b/src/test/ui/issues/issue-30560.rs index f033666220d..c848a1c51ca 100644 --- a/src/test/ui/issues/issue-30560.rs +++ b/src/test/ui/issues/issue-30560.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type Alias = (); use Alias::*; //~^ ERROR unresolved import `Alias` [E0432] diff --git a/src/test/ui/issues/issue-30560.stderr b/src/test/ui/issues/issue-30560.stderr index 880c565cf9f..27fa9e16bf2 100644 --- a/src/test/ui/issues/issue-30560.stderr +++ b/src/test/ui/issues/issue-30560.stderr @@ -1,17 +1,17 @@ error: items in traits are not importable. - --> $DIR/issue-30560.rs:20:5 + --> $DIR/issue-30560.rs:10:5 | LL | use T::*; //~ ERROR items in traits are not importable | ^^^^ error[E0432]: unresolved import `Alias` - --> $DIR/issue-30560.rs:12:5 + --> $DIR/issue-30560.rs:2:5 | LL | use Alias::*; | ^^^^^ not a module `Alias` error[E0432]: unresolved import `std::io::Result` - --> $DIR/issue-30560.rs:15:14 + --> $DIR/issue-30560.rs:5:14 | LL | use std::io::Result::*; | ^^^^^^ not a module `Result` diff --git a/src/test/ui/issues/issue-30589.rs b/src/test/ui/issues/issue-30589.rs index 61721fe58b3..94eb5839958 100644 --- a/src/test/ui/issues/issue-30589.rs +++ b/src/test/ui/issues/issue-30589.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; impl fmt::Display for DecoderError { //~ ERROR cannot find type `DecoderError` in this scope diff --git a/src/test/ui/issues/issue-30589.stderr b/src/test/ui/issues/issue-30589.stderr index 8174af83230..17ba4051fb4 100644 --- a/src/test/ui/issues/issue-30589.stderr +++ b/src/test/ui/issues/issue-30589.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `DecoderError` in this scope - --> $DIR/issue-30589.rs:13:23 + --> $DIR/issue-30589.rs:3:23 | LL | impl fmt::Display for DecoderError { //~ ERROR cannot find type `DecoderError` in this scope | ^^^^^^^^^^^^ not found in this scope diff --git a/src/test/ui/issues/issue-30730.rs b/src/test/ui/issues/issue-30730.rs index c57a34a90df..d6be90c8148 100644 --- a/src/test/ui/issues/issue-30730.rs +++ b/src/test/ui/issues/issue-30730.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![warn(unused)] #![deny(warnings)] use std::thread; diff --git a/src/test/ui/issues/issue-30730.stderr b/src/test/ui/issues/issue-30730.stderr index 696c3acce72..0a901076f46 100644 --- a/src/test/ui/issues/issue-30730.stderr +++ b/src/test/ui/issues/issue-30730.stderr @@ -1,11 +1,11 @@ error: unused import: `std::thread` - --> $DIR/issue-30730.rs:13:5 + --> $DIR/issue-30730.rs:3:5 | LL | use std::thread; | ^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-30730.rs:12:9 + --> $DIR/issue-30730.rs:2:9 | LL | #![deny(warnings)] | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-3080.rs b/src/test/ui/issues/issue-3080.rs index fb16dad3960..883f3bfd24e 100644 --- a/src/test/ui/issues/issue-3080.rs +++ b/src/test/ui/issues/issue-3080.rs @@ -1,18 +1,8 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct x(()); -impl x { +struct X(()); +impl X { pub unsafe fn with(&self) { } } fn main() { - x(()).with(); //~ ERROR requires unsafe function or block + X(()).with(); //~ ERROR requires unsafe function or block } diff --git a/src/test/ui/issues/issue-3080.stderr b/src/test/ui/issues/issue-3080.stderr index 3a966e3f315..44f16c708e0 100644 --- a/src/test/ui/issues/issue-3080.stderr +++ b/src/test/ui/issues/issue-3080.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-3080.rs:17:5 + --> $DIR/issue-3080.rs:7:5 | -LL | x(()).with(); //~ ERROR requires unsafe function or block +LL | X(()).with(); //~ ERROR requires unsafe function or block | ^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/issues/issue-3096-1.rs b/src/test/ui/issues/issue-3096-1.rs index 62c2639836b..edc3b322305 100644 --- a/src/test/ui/issues/issue-3096-1.rs +++ b/src/test/ui/issues/issue-3096-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match () { } //~ ERROR non-exhaustive } diff --git a/src/test/ui/issues/issue-3096-1.stderr b/src/test/ui/issues/issue-3096-1.stderr index b2bfe6b5e8c..7ced0d36805 100644 --- a/src/test/ui/issues/issue-3096-1.stderr +++ b/src/test/ui/issues/issue-3096-1.stderr @@ -1,11 +1,11 @@ -error[E0004]: non-exhaustive patterns: type () is non-empty - --> $DIR/issue-3096-1.rs:12:11 +error[E0004]: non-exhaustive patterns: type `()` is non-empty + --> $DIR/issue-3096-1.rs:2:11 | LL | match () { } //~ ERROR non-exhaustive | ^^ | help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/issue-3096-1.rs:12:11 + --> $DIR/issue-3096-1.rs:2:11 | LL | match () { } //~ ERROR non-exhaustive | ^^ diff --git a/src/test/ui/issues/issue-3096-2.rs b/src/test/ui/issues/issue-3096-2.rs index 2d1ad9a2692..a26e425809f 100644 --- a/src/test/ui/issues/issue-3096-2.rs +++ b/src/test/ui/issues/issue-3096-2.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum bottom { } +enum Bottom { } fn main() { - let x = &() as *const () as *const bottom; + let x = &() as *const () as *const Bottom; match x { } //~ ERROR non-exhaustive patterns } diff --git a/src/test/ui/issues/issue-3096-2.stderr b/src/test/ui/issues/issue-3096-2.stderr index bb9dfabe7be..df876794489 100644 --- a/src/test/ui/issues/issue-3096-2.stderr +++ b/src/test/ui/issues/issue-3096-2.stderr @@ -1,11 +1,11 @@ -error[E0004]: non-exhaustive patterns: type *const bottom is non-empty - --> $DIR/issue-3096-2.rs:15:11 +error[E0004]: non-exhaustive patterns: type `*const Bottom` is non-empty + --> $DIR/issue-3096-2.rs:5:11 | LL | match x { } //~ ERROR non-exhaustive patterns | ^ | help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/issue-3096-2.rs:15:11 + --> $DIR/issue-3096-2.rs:5:11 | LL | match x { } //~ ERROR non-exhaustive patterns | ^ diff --git a/src/test/ui/issues/issue-3099-a.rs b/src/test/ui/issues/issue-3099-a.rs index db60d70ca9b..9c3d8cf5a55 100644 --- a/src/test/ui/issues/issue-3099-a.rs +++ b/src/test/ui/issues/issue-3099-a.rs @@ -1,15 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +enum A { B, C } -enum a { b, c } - -enum a { d, e } //~ ERROR the name `a` is defined multiple times +enum A { D, E } //~ ERROR the name `A` is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-3099-a.stderr b/src/test/ui/issues/issue-3099-a.stderr index 6a194593c3f..d3da944cb53 100644 --- a/src/test/ui/issues/issue-3099-a.stderr +++ b/src/test/ui/issues/issue-3099-a.stderr @@ -1,13 +1,13 @@ -error[E0428]: the name `a` is defined multiple times - --> $DIR/issue-3099-a.rs:13:1 +error[E0428]: the name `A` is defined multiple times + --> $DIR/issue-3099-a.rs:3:1 | -LL | enum a { b, c } - | ------ previous definition of the type `a` here +LL | enum A { B, C } + | ------ previous definition of the type `A` here LL | -LL | enum a { d, e } //~ ERROR the name `a` is defined multiple times - | ^^^^^^ `a` redefined here +LL | enum A { D, E } //~ ERROR the name `A` is defined multiple times + | ^^^^^^ `A` redefined here | - = note: `a` must be defined only once in the type namespace of this module + = note: `A` must be defined only once in the type namespace of this module error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3099-b.rs b/src/test/ui/issues/issue-3099-b.rs index 956d2186752..71952c3b060 100644 --- a/src/test/ui/issues/issue-3099-b.rs +++ b/src/test/ui/issues/issue-3099-b.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod a {} pub mod a {} //~ ERROR the name `a` is defined multiple times diff --git a/src/test/ui/issues/issue-3099-b.stderr b/src/test/ui/issues/issue-3099-b.stderr index 226d99e3b82..cc49325805e 100644 --- a/src/test/ui/issues/issue-3099-b.stderr +++ b/src/test/ui/issues/issue-3099-b.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `a` is defined multiple times - --> $DIR/issue-3099-b.rs:13:1 + --> $DIR/issue-3099-b.rs:3:1 | LL | pub mod a {} | --------- previous definition of the module `a` here diff --git a/src/test/ui/issues/issue-3099.rs b/src/test/ui/issues/issue-3099.rs index 42766533556..ee75b359388 100644 --- a/src/test/ui/issues/issue-3099.rs +++ b/src/test/ui/issues/issue-3099.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn a(x: String) -> String { format!("First function with {}", x) } diff --git a/src/test/ui/issues/issue-3099.stderr b/src/test/ui/issues/issue-3099.stderr index a5f29e7b6c3..a650d3caa64 100644 --- a/src/test/ui/issues/issue-3099.stderr +++ b/src/test/ui/issues/issue-3099.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `a` is defined multiple times - --> $DIR/issue-3099.rs:15:1 + --> $DIR/issue-3099.rs:5:1 | LL | fn a(x: String) -> String { | ------------------------- previous definition of the value `a` here diff --git a/src/test/ui/issues/issue-31011.rs b/src/test/ui/issues/issue-31011.rs index 716b0bbe772..4dead04c2ca 100644 --- a/src/test/ui/issues/issue-31011.rs +++ b/src/test/ui/issues/issue-31011.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! log { ( $ctx:expr, $( $args:expr),* ) => { if $ctx.trace { diff --git a/src/test/ui/issues/issue-31011.stderr b/src/test/ui/issues/issue-31011.stderr index c2e7c9876cb..ab0069510fc 100644 --- a/src/test/ui/issues/issue-31011.stderr +++ b/src/test/ui/issues/issue-31011.stderr @@ -1,5 +1,5 @@ error[E0609]: no field `trace` on type `&T` - --> $DIR/issue-31011.rs:13:17 + --> $DIR/issue-31011.rs:3:17 | LL | if $ctx.trace { | ^^^^^ diff --git a/src/test/ui/issues/issue-31109.rs b/src/test/ui/issues/issue-31109.rs index 74121e3a420..37c23905819 100644 --- a/src/test/ui/issues/issue-31109.rs +++ b/src/test/ui/issues/issue-31109.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { // FIXME(#31407) this error should go away, but in the meantime we test that it // is accompanied by a somewhat useful error message. diff --git a/src/test/ui/issues/issue-31109.stderr b/src/test/ui/issues/issue-31109.stderr index c66a4f0b175..d354f61a501 100644 --- a/src/test/ui/issues/issue-31109.stderr +++ b/src/test/ui/issues/issue-31109.stderr @@ -1,5 +1,5 @@ error: could not evaluate float literal (see issue #31407) - --> $DIR/issue-31109.rs:14:18 + --> $DIR/issue-31109.rs:4:18 | LL | let _: f64 = 1234567890123456789012345678901234567890e-340; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-31173.rs b/src/test/ui/issues/issue-31173.rs index fb1e3cc87e8..6df80664575 100644 --- a/src/test/ui/issues/issue-31173.rs +++ b/src/test/ui/issues/issue-31173.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::vec::IntoIter; pub fn get_tok(it: &mut IntoIter) { diff --git a/src/test/ui/issues/issue-31173.stderr b/src/test/ui/issues/issue-31173.stderr index e2630b5b8ce..76f245a22cf 100644 --- a/src/test/ui/issues/issue-31173.stderr +++ b/src/test/ui/issues/issue-31173.stderr @@ -1,5 +1,5 @@ -error[E0271]: type mismatch resolving `, [closure@$DIR/issue-31173.rs:16:39: 19:6 found_e:_]> as std::iter::Iterator>::Item == &_` - --> $DIR/issue-31173.rs:20:10 +error[E0271]: type mismatch resolving `, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]> as std::iter::Iterator>::Item == &_` + --> $DIR/issue-31173.rs:10:10 | LL | .cloned() | ^^^^^^ expected u8, found reference @@ -7,15 +7,15 @@ LL | .cloned() = note: expected type `u8` found type `&_` -error[E0599]: no method named `collect` found for type `std::iter::Cloned, [closure@$DIR/issue-31173.rs:16:39: 19:6 found_e:_]>>` in the current scope - --> $DIR/issue-31173.rs:24:10 +error[E0599]: no method named `collect` found for type `std::iter::Cloned, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>>` in the current scope + --> $DIR/issue-31173.rs:14:10 | LL | .collect(); //~ ERROR no method named `collect` | ^^^^^^^ | = note: the method `collect` exists but the following trait bounds were not satisfied: - `std::iter::Cloned, [closure@$DIR/issue-31173.rs:16:39: 19:6 found_e:_]>> : std::iter::Iterator` - `&mut std::iter::Cloned, [closure@$DIR/issue-31173.rs:16:39: 19:6 found_e:_]>> : std::iter::Iterator` + `&mut std::iter::Cloned, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>> : std::iter::Iterator` + `std::iter::Cloned, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>> : std::iter::Iterator` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-31212.rs b/src/test/ui/issues/issue-31212.rs index 8dc58eee5fb..556f0d18f9f 100644 --- a/src/test/ui/issues/issue-31212.rs +++ b/src/test/ui/issues/issue-31212.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This checks that a path that cannot be resolved because of an indeterminate import // does not trigger an ICE. diff --git a/src/test/ui/issues/issue-31212.stderr b/src/test/ui/issues/issue-31212.stderr index 17cf2e81236..d964b702f22 100644 --- a/src/test/ui/issues/issue-31212.stderr +++ b/src/test/ui/issues/issue-31212.stderr @@ -1,11 +1,11 @@ error[E0432]: unresolved import `self::*` - --> $DIR/issue-31212.rs:15:13 + --> $DIR/issue-31212.rs:5:13 | LL | pub use self::*; //~ ERROR unresolved | ^^^^^^^ Cannot glob-import a module into itself. error[E0425]: cannot find function `f` in module `foo` - --> $DIR/issue-31212.rs:19:10 + --> $DIR/issue-31212.rs:9:10 | LL | foo::f(); //~ ERROR cannot find function `f` in module `foo` | ^ not found in `foo` diff --git a/src/test/ui/issues/issue-31221.rs b/src/test/ui/issues/issue-31221.rs index ca15a869a9c..e03f1ec5bc2 100644 --- a/src/test/ui/issues/issue-31221.rs +++ b/src/test/ui/issues/issue-31221.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![allow(unused_variables)] #![allow(non_snake_case)] diff --git a/src/test/ui/issues/issue-31221.stderr b/src/test/ui/issues/issue-31221.stderr index 56c7b8ab6e7..0f3b4ba7d97 100644 --- a/src/test/ui/issues/issue-31221.stderr +++ b/src/test/ui/issues/issue-31221.stderr @@ -1,5 +1,5 @@ error: unreachable pattern - --> $DIR/issue-31221.rs:28:9 + --> $DIR/issue-31221.rs:18:9 | LL | Var3 => (), | ---- matches any value @@ -7,13 +7,13 @@ LL | Var2 => (), | ^^^^ unreachable pattern | note: lint level defined here - --> $DIR/issue-31221.rs:14:9 + --> $DIR/issue-31221.rs:4:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/issue-31221.rs:34:9 + --> $DIR/issue-31221.rs:24:9 | LL | &Var3 => (), | ----- matches any value @@ -21,7 +21,7 @@ LL | &Var2 => (), | ^^^^^ unreachable pattern error: unreachable pattern - --> $DIR/issue-31221.rs:41:9 + --> $DIR/issue-31221.rs:31:9 | LL | (c, d) => (), | ------ matches any value diff --git a/src/test/ui/issues/issue-31260.rs b/src/test/ui/issues/issue-31260.rs index 085a6e19eb1..f7e717c59ac 100644 --- a/src/test/ui/issues/issue-31260.rs +++ b/src/test/ui/issues/issue-31260.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] pub struct Struct { diff --git a/src/test/ui/issues/issue-3149.rs b/src/test/ui/issues/issue-3149.rs index 507af2f6c2a..c9a6f537757 100644 --- a/src/test/ui/issues/issue-3149.rs +++ b/src/test/ui/issues/issue-3149.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_snake_case)] diff --git a/src/test/ui/issues/issue-31511.rs b/src/test/ui/issues/issue-31511.rs index dd1af2f4448..53fecb01663 100644 --- a/src/test/ui/issues/issue-31511.rs +++ b/src/test/ui/issues/issue-31511.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn cast_thin_to_fat(x: *const ()) { x as *const [u8]; //~^ ERROR: cannot cast thin pointer `*const ()` to fat pointer `*const [u8]` diff --git a/src/test/ui/issues/issue-31511.stderr b/src/test/ui/issues/issue-31511.stderr index 7d4c9426da1..cb2991809dd 100644 --- a/src/test/ui/issues/issue-31511.stderr +++ b/src/test/ui/issues/issue-31511.stderr @@ -1,5 +1,5 @@ error[E0607]: cannot cast thin pointer `*const ()` to fat pointer `*const [u8]` - --> $DIR/issue-31511.rs:12:5 + --> $DIR/issue-31511.rs:2:5 | LL | x as *const [u8]; | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-3154.rs b/src/test/ui/issues/issue-3154.rs index 519e9d06d1b..91c7203c1d0 100644 --- a/src/test/ui/issues/issue-3154.rs +++ b/src/test/ui/issues/issue-3154.rs @@ -1,19 +1,9 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct thing<'a, Q:'a> { +struct Thing<'a, Q:'a> { x: &'a Q } -fn thing<'a,Q>(x: &Q) -> thing<'a,Q> { - thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621] +fn thing<'a,Q>(x: &Q) -> Thing<'a,Q> { + Thing { x: x } //~ ERROR explicit lifetime required in the type of `x` [E0621] } fn main() { diff --git a/src/test/ui/issues/issue-3154.stderr b/src/test/ui/issues/issue-3154.stderr index 01299d74808..6f3b37a8a3f 100644 --- a/src/test/ui/issues/issue-3154.stderr +++ b/src/test/ui/issues/issue-3154.stderr @@ -1,10 +1,10 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/issue-3154.rs:16:5 + --> $DIR/issue-3154.rs:6:5 | -LL | fn thing<'a,Q>(x: &Q) -> thing<'a,Q> { +LL | fn thing<'a,Q>(x: &Q) -> Thing<'a,Q> { | -- help: add explicit lifetime `'a` to the type of `x`: `&'a Q` -LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621] - | ^^^^^^^^^^^^^ lifetime `'a` required +LL | Thing { x: x } //~ ERROR explicit lifetime required in the type of `x` [E0621] + | ^^^^^^^^^^^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/issues/issue-31561.rs b/src/test/ui/issues/issue-31561.rs index f8645c4d3a7..87b19fe5ea7 100644 --- a/src/test/ui/issues/issue-31561.rs +++ b/src/test/ui/issues/issue-31561.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Thing { Foo(u8), Bar, diff --git a/src/test/ui/issues/issue-31561.stderr b/src/test/ui/issues/issue-31561.stderr index 4608a95459b..c95fc36cea6 100644 --- a/src/test/ui/issues/issue-31561.stderr +++ b/src/test/ui/issues/issue-31561.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding: `Bar` not covered - --> $DIR/issue-31561.rs:18:9 + --> $DIR/issue-31561.rs:8:9 | LL | let Thing::Foo(y) = Thing::Foo(1); | ^^^^^^^^^^^^^ pattern `Bar` not covered diff --git a/src/test/ui/issues/issue-31597.rs b/src/test/ui/issues/issue-31597.rs index 163b7385c8b..3962f13fe9b 100644 --- a/src/test/ui/issues/issue-31597.rs +++ b/src/test/ui/issues/issue-31597.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] trait Make { diff --git a/src/test/ui/issues/issue-31769.rs b/src/test/ui/issues/issue-31769.rs index 2bd45deeab4..794c1d19893 100644 --- a/src/test/ui/issues/issue-31769.rs +++ b/src/test/ui/issues/issue-31769.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { #[inline] struct Foo; //~ ERROR attribute should be applied to function or closure #[repr(C)] fn foo() {} //~ ERROR attribute should be applied to struct, enum or union diff --git a/src/test/ui/issues/issue-31769.stderr b/src/test/ui/issues/issue-31769.stderr index 1f1904e3c2c..7e5e5673baf 100644 --- a/src/test/ui/issues/issue-31769.stderr +++ b/src/test/ui/issues/issue-31769.stderr @@ -1,11 +1,11 @@ error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-31769.rs:12:5 + --> $DIR/issue-31769.rs:2:5 | LL | #[inline] struct Foo; //~ ERROR attribute should be applied to function or closure | ^^^^^^^^^ ----------- not a function or closure error[E0517]: attribute should be applied to struct, enum or union - --> $DIR/issue-31769.rs:13:12 + --> $DIR/issue-31769.rs:3:12 | LL | #[repr(C)] fn foo() {} //~ ERROR attribute should be applied to struct, enum or union | ^ ----------- not a struct, enum or union diff --git a/src/test/ui/issues/issue-31804.rs b/src/test/ui/issues/issue-31804.rs index cea52b11c5d..d056b77cf09 100644 --- a/src/test/ui/issues/issue-31804.rs +++ b/src/test/ui/issues/issue-31804.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that error recovery in the parser to an EOF does not give an infinite // spew of errors. diff --git a/src/test/ui/issues/issue-31804.stderr b/src/test/ui/issues/issue-31804.stderr index e0ac2f631ba..67e2f2bf2ec 100644 --- a/src/test/ui/issues/issue-31804.stderr +++ b/src/test/ui/issues/issue-31804.stderr @@ -1,5 +1,5 @@ error: expected pattern, found `}` - --> $DIR/issue-31804.rs:16:1 + --> $DIR/issue-31804.rs:6:1 | LL | } //~ ERROR expected pattern, found `}` | ^ expected pattern diff --git a/src/test/ui/issues/issue-31845.rs b/src/test/ui/issues/issue-31845.rs index 418754b9a24..f6dc11502ba 100644 --- a/src/test/ui/issues/issue-31845.rs +++ b/src/test/ui/issues/issue-31845.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks lexical scopes cannot see through normal module boundaries fn f() { diff --git a/src/test/ui/issues/issue-31845.stderr b/src/test/ui/issues/issue-31845.stderr index 9fb8f2ead87..7ee1a41a387 100644 --- a/src/test/ui/issues/issue-31845.stderr +++ b/src/test/ui/issues/issue-31845.stderr @@ -1,8 +1,8 @@ error[E0425]: cannot find function `g` in this scope - --> $DIR/issue-31845.rs:17:12 + --> $DIR/issue-31845.rs:7:12 | LL | g(); //~ ERROR cannot find function `g` in this scope - | ^ did you mean `h`? + | ^ help: a function with a similar name exists: `h` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-31910.rs b/src/test/ui/issues/issue-31910.rs index 7524049c5df..c62ed89c4ad 100644 --- a/src/test/ui/issues/issue-31910.rs +++ b/src/test/ui/issues/issue-31910.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - enum Enum { X = Trait::Number, //~^ ERROR mismatched types diff --git a/src/test/ui/issues/issue-31910.stderr b/src/test/ui/issues/issue-31910.stderr index da5aa154450..c58702da97b 100644 --- a/src/test/ui/issues/issue-31910.stderr +++ b/src/test/ui/issues/issue-31910.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-31910.rs:13:9 + --> $DIR/issue-31910.rs:2:9 | LL | X = Trait::Number, | ^^^^^^^^^^^^^ expected isize, found i32 diff --git a/src/test/ui/issues/issue-31924-non-snake-ffi.rs b/src/test/ui/issues/issue-31924-non-snake-ffi.rs index f869c89b79c..5e2336cce2c 100644 --- a/src/test/ui/issues/issue-31924-non-snake-ffi.rs +++ b/src/test/ui/issues/issue-31924-non-snake-ffi.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![deny(non_snake_case)] diff --git a/src/test/ui/issues/issue-32004.rs b/src/test/ui/issues/issue-32004.rs index 7e1f4c28d21..aeddb00e2b0 100644 --- a/src/test/ui/issues/issue-32004.rs +++ b/src/test/ui/issues/issue-32004.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { Bar(i32), Baz diff --git a/src/test/ui/issues/issue-32004.stderr b/src/test/ui/issues/issue-32004.stderr index c409d4bb612..f8c418b25a0 100644 --- a/src/test/ui/issues/issue-32004.stderr +++ b/src/test/ui/issues/issue-32004.stderr @@ -1,13 +1,13 @@ error[E0532]: expected unit struct/variant or constant, found tuple variant `Foo::Bar` - --> $DIR/issue-32004.rs:20:9 + --> $DIR/issue-32004.rs:10:9 | LL | Foo::Bar => {} | ^^^^^--- | | - | did you mean `Baz`? + | help: a unit variant with a similar name exists: `Baz` error[E0532]: expected tuple struct/variant, found unit struct `S` - --> $DIR/issue-32004.rs:26:9 + --> $DIR/issue-32004.rs:16:9 | LL | S(()) => {} | ^ not a tuple struct/variant diff --git a/src/test/ui/issues/issue-32086.rs b/src/test/ui/issues/issue-32086.rs index dd236b76a67..3188377584d 100644 --- a/src/test/ui/issues/issue-32086.rs +++ b/src/test/ui/issues/issue-32086.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S(u8); const C: S = S(10); diff --git a/src/test/ui/issues/issue-32086.stderr b/src/test/ui/issues/issue-32086.stderr index 28d21708b21..bb2cc7c101b 100644 --- a/src/test/ui/issues/issue-32086.stderr +++ b/src/test/ui/issues/issue-32086.stderr @@ -1,14 +1,14 @@ error[E0532]: expected tuple struct/variant, found constant `C` - --> $DIR/issue-32086.rs:15:9 + --> $DIR/issue-32086.rs:5:9 | LL | let C(a) = S(11); //~ ERROR expected tuple struct/variant, found constant `C` - | ^ did you mean `S`? + | ^ help: a tuple struct with a similar name exists: `S` error[E0532]: expected tuple struct/variant, found constant `C` - --> $DIR/issue-32086.rs:16:9 + --> $DIR/issue-32086.rs:6:9 | LL | let C(..) = S(11); //~ ERROR expected tuple struct/variant, found constant `C` - | ^ did you mean `S`? + | ^ help: a tuple struct with a similar name exists: `S` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-32119.rs b/src/test/ui/issues/issue-32119.rs index f96f1ae6921..ea8824b7966 100644 --- a/src/test/ui/issues/issue-32119.rs +++ b/src/test/ui/issues/issue-32119.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-3214.rs b/src/test/ui/issues/issue-3214.rs index 9a769c39eca..85eae2686e6 100644 --- a/src/test/ui/issues/issue-3214.rs +++ b/src/test/ui/issues/issue-3214.rs @@ -1,19 +1,9 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() { - struct foo { + struct Foo { x: T, //~ ERROR can't use type parameters from outer function } - impl Drop for foo { + impl Drop for Foo { //~^ ERROR wrong number of type arguments fn drop(&mut self) {} } diff --git a/src/test/ui/issues/issue-3214.stderr b/src/test/ui/issues/issue-3214.stderr index d831be9ad3e..4ecea4f9800 100644 --- a/src/test/ui/issues/issue-3214.stderr +++ b/src/test/ui/issues/issue-3214.stderr @@ -1,18 +1,18 @@ error[E0401]: can't use type parameters from outer function - --> $DIR/issue-3214.rs:13:12 + --> $DIR/issue-3214.rs:3:12 | LL | fn foo() { | --- - type variable from outer function | | | try adding a local type parameter in this method instead -LL | struct foo { +LL | struct Foo { LL | x: T, //~ ERROR can't use type parameters from outer function | ^ use of type variable from outer function error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/issue-3214.rs:16:26 + --> $DIR/issue-3214.rs:6:26 | -LL | impl Drop for foo { +LL | impl Drop for Foo { | ^ unexpected type argument error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-32201.rs b/src/test/ui/issues/issue-32201.rs index bf9f8ecbc80..e22c1604165 100644 --- a/src/test/ui/issues/issue-32201.rs +++ b/src/test/ui/issues/issue-32201.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { fn foo(a: i32, ...); } diff --git a/src/test/ui/issues/issue-32201.stderr b/src/test/ui/issues/issue-32201.stderr index 986c2f0890c..cedb5878466 100644 --- a/src/test/ui/issues/issue-32201.stderr +++ b/src/test/ui/issues/issue-32201.stderr @@ -1,5 +1,5 @@ error[E0617]: can't pass `fn(*const u8) {bar}` to variadic function - --> $DIR/issue-32201.rs:19:16 + --> $DIR/issue-32201.rs:9:16 | LL | foo(0, bar); | ^^^ help: cast the value to `fn(*const u8)`: `bar as fn(*const u8)` diff --git a/src/test/ui/issues/issue-32222.rs b/src/test/ui/issues/issue-32222.rs index c4e8450fabc..91f53ab2805 100644 --- a/src/test/ui/issues/issue-32222.rs +++ b/src/test/ui/issues/issue-32222.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(warnings)] diff --git a/src/test/ui/issues/issue-32323.rs b/src/test/ui/issues/issue-32323.rs index e5cb8130327..5078f5523c9 100644 --- a/src/test/ui/issues/issue-32323.rs +++ b/src/test/ui/issues/issue-32323.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Tr<'a> { type Out; } diff --git a/src/test/ui/issues/issue-32323.stderr b/src/test/ui/issues/issue-32323.stderr index 09ac1553b3a..0339fdc55b9 100644 --- a/src/test/ui/issues/issue-32323.stderr +++ b/src/test/ui/issues/issue-32323.stderr @@ -1,8 +1,10 @@ error[E0308]: mismatched types - --> $DIR/issue-32323.rs:15:49 + --> $DIR/issue-32323.rs:5:30 | LL | pub fn f<'a, T: Tr<'a>>() -> >::Out {} - | ^^ expected associated type, found () + | - ^^^^^^^^^^^^^^^^^^ expected associated type, found () + | | + | this function's body doesn't return | = note: expected type `>::Out` found type `()` diff --git a/src/test/ui/issues/issue-32324.rs b/src/test/ui/issues/issue-32324.rs index 92d88d543a5..9abbe321604 100644 --- a/src/test/ui/issues/issue-32324.rs +++ b/src/test/ui/issues/issue-32324.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-32326.rs b/src/test/ui/issues/issue-32326.rs index 8af243afc22..e928c66e2cc 100644 --- a/src/test/ui/issues/issue-32326.rs +++ b/src/test/ui/issues/issue-32326.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #32326. We ran out of memory because we // attempted to expand this case up to the recursion limit, and 2^N is // too big. diff --git a/src/test/ui/issues/issue-32326.stderr b/src/test/ui/issues/issue-32326.stderr index b7e359af64a..0f56e94bd19 100644 --- a/src/test/ui/issues/issue-32326.stderr +++ b/src/test/ui/issues/issue-32326.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `Expr` has infinite size - --> $DIR/issue-32326.rs:15:1 + --> $DIR/issue-32326.rs:5:1 | LL | enum Expr { //~ ERROR E0072 | ^^^^^^^^^ recursive type has infinite size diff --git a/src/test/ui/issues/issue-32354-suggest-import-rename.fixed b/src/test/ui/issues/issue-32354-suggest-import-rename.fixed index 251f7eb9a24..27f1b8964e2 100644 --- a/src/test/ui/issues/issue-32354-suggest-import-rename.fixed +++ b/src/test/ui/issues/issue-32354-suggest-import-rename.fixed @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![allow(unused_imports)] diff --git a/src/test/ui/issues/issue-32354-suggest-import-rename.rs b/src/test/ui/issues/issue-32354-suggest-import-rename.rs index 57cbeb47a1e..5a7f234d5fa 100644 --- a/src/test/ui/issues/issue-32354-suggest-import-rename.rs +++ b/src/test/ui/issues/issue-32354-suggest-import-rename.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![allow(unused_imports)] diff --git a/src/test/ui/issues/issue-32354-suggest-import-rename.stderr b/src/test/ui/issues/issue-32354-suggest-import-rename.stderr index f3acd65e6a2..9e115143fbd 100644 --- a/src/test/ui/issues/issue-32354-suggest-import-rename.stderr +++ b/src/test/ui/issues/issue-32354-suggest-import-rename.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `ConstructorExtension` is defined multiple times - --> $DIR/issue-32354-suggest-import-rename.rs:24:5 + --> $DIR/issue-32354-suggest-import-rename.rs:14:5 | LL | use extension1::ConstructorExtension; | -------------------------------- previous import of the trait `ConstructorExtension` here diff --git a/src/test/ui/issues/issue-32377.rs b/src/test/ui/issues/issue-32377.rs index 425dcc6b21e..555f6abd791 100644 --- a/src/test/ui/issues/issue-32377.rs +++ b/src/test/ui/issues/issue-32377.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // normalize-stderr-test "\d+ bits" -> "N bits" use std::mem; @@ -23,7 +13,7 @@ struct Bar { fn foo(x: [usize; 2]) -> Bar { unsafe { mem::transmute(x) } - //~^ ERROR transmute called with types of different sizes + //~^ ERROR cannot transmute between types of different sizes, or dependently-sized types } fn main() {} diff --git a/src/test/ui/issues/issue-32377.stderr b/src/test/ui/issues/issue-32377.stderr index 7168a000a02..5e870eb3e8d 100644 --- a/src/test/ui/issues/issue-32377.stderr +++ b/src/test/ui/issues/issue-32377.stderr @@ -1,11 +1,11 @@ -error[E0512]: transmute called with types of different sizes - --> $DIR/issue-32377.rs:25:14 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/issue-32377.rs:15:14 | LL | unsafe { mem::transmute(x) } | ^^^^^^^^^^^^^^ | - = note: source type: [usize; 2] (N bits) - = note: target type: Bar (N bits) + = note: source type: `[usize; 2]` (N bits) + = note: target type: `Bar` (N bits) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-32655.rs b/src/test/ui/issues/issue-32655.rs index 25ecd5d0862..4634179d4e1 100644 --- a/src/test/ui/issues/issue-32655.rs +++ b/src/test/ui/issues/issue-32655.rs @@ -1,19 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![feature(rustc_attrs)] macro_rules! foo ( () => ( - #[derive_Clone] //~ ERROR attributes of the form + #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown struct T; ); ); @@ -25,7 +15,7 @@ macro_rules! bar ( foo!(); bar!( - #[derive_Clone] //~ ERROR attributes of the form + #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown struct S; ); diff --git a/src/test/ui/issues/issue-32655.stderr b/src/test/ui/issues/issue-32655.stderr index f930217fe9e..ae0cf49a791 100644 --- a/src/test/ui/issues/issue-32655.stderr +++ b/src/test/ui/issues/issue-32655.stderr @@ -1,21 +1,21 @@ -error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644) - --> $DIR/issue-32655.rs:16:11 +error[E0658]: The attribute `derive_Clone` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/issue-32655.rs:6:11 | -LL | #[derive_Clone] //~ ERROR attributes of the form +LL | #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown | ^^^^^^^^^^^^ ... LL | foo!(); | ------- in this macro invocation | - = help: add #![feature(custom_derive)] to the crate attributes to enable + = help: add #![feature(custom_attribute)] to the crate attributes to enable -error[E0658]: attributes of the form `#[derive_*]` are reserved for the compiler (see issue #29644) - --> $DIR/issue-32655.rs:28:7 +error[E0658]: The attribute `derive_Clone` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/issue-32655.rs:18:7 | -LL | #[derive_Clone] //~ ERROR attributes of the form +LL | #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown | ^^^^^^^^^^^^ | - = help: add #![feature(custom_derive)] to the crate attributes to enable + = help: add #![feature(custom_attribute)] to the crate attributes to enable error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-32709.rs b/src/test/ui/issues/issue-32709.rs index 09538818dcd..c05bfdc4cfd 100644 --- a/src/test/ui/issues/issue-32709.rs +++ b/src/test/ui/issues/issue-32709.rs @@ -1,17 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure that the span of try shorthand does not include the trailing // semicolon; fn a() -> Result { - Err(5)?; //~ ERROR 14:5: 14:12 + Err(5)?; //~ ERROR Ok(1) } diff --git a/src/test/ui/issues/issue-32709.stderr b/src/test/ui/issues/issue-32709.stderr index 8da4be2ba2b..9161e64ef0a 100644 --- a/src/test/ui/issues/issue-32709.stderr +++ b/src/test/ui/issues/issue-32709.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `(): std::convert::From<{integer}>` is not satisfied - --> $DIR/issue-32709.rs:14:5 + --> $DIR/issue-32709.rs:4:5 | -LL | Err(5)?; //~ ERROR 14:5: 14:12 +LL | Err(5)?; //~ ERROR | ^^^^^^^ the trait `std::convert::From<{integer}>` is not implemented for `()` | = note: required by `std::convert::From::from` diff --git a/src/test/ui/issues/issue-32782.rs b/src/test/ui/issues/issue-32782.rs index 696ea0ef547..e3aa9f3bf2f 100644 --- a/src/test/ui/issues/issue-32782.rs +++ b/src/test/ui/issues/issue-32782.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! bar ( () => () ); diff --git a/src/test/ui/issues/issue-32782.stderr b/src/test/ui/issues/issue-32782.stderr index 8b486000a45..5d583ee843f 100644 --- a/src/test/ui/issues/issue-32782.stderr +++ b/src/test/ui/issues/issue-32782.stderr @@ -1,5 +1,5 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks - --> $DIR/issue-32782.rs:17:9 + --> $DIR/issue-32782.rs:7:9 | LL | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-32797.rs b/src/test/ui/issues/issue-32797.rs index 1061ffe11e1..5ceb7f49331 100644 --- a/src/test/ui/issues/issue-32797.rs +++ b/src/test/ui/issues/issue-32797.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen diff --git a/src/test/ui/issues/issue-32829-2.rs b/src/test/ui/issues/issue-32829-2.rs index 2b223bac8e6..c93c84b5fb7 100644 --- a/src/test/ui/issues/issue-32829-2.rs +++ b/src/test/ui/issues/issue-32829-2.rs @@ -1,21 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength -#![feature(const_fn)] - const bad : u32 = { { 5; - //~^ ERROR statements in constants are unstable 0 } }; @@ -23,8 +10,7 @@ const bad : u32 = { const bad_two : u32 = { { invalid(); - //~^ ERROR statements in constants are unstable - //~^^ ERROR: calls in constants are limited to constant functions, tuple structs and tuple variants + //~^ ERROR: calls in constants are limited to constant functions, tuple structs and tuple variants 0 } }; @@ -32,7 +18,6 @@ const bad_two : u32 = { const bad_three : u32 = { { valid(); - //~^ ERROR statements in constants are unstable 0 } }; @@ -40,7 +25,6 @@ const bad_three : u32 = { static bad_four : u32 = { { 5; - //~^ ERROR statements in statics are unstable 0 } }; @@ -49,7 +33,6 @@ static bad_five : u32 = { { invalid(); //~^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants - //~| ERROR statements in statics are unstable 0 } }; @@ -57,7 +40,6 @@ static bad_five : u32 = { static bad_six : u32 = { { valid(); - //~^ ERROR statements in statics are unstable 0 } }; @@ -65,7 +47,6 @@ static bad_six : u32 = { static mut bad_seven : u32 = { { 5; - //~^ ERROR statements in statics are unstable 0 } }; @@ -73,8 +54,7 @@ static mut bad_seven : u32 = { static mut bad_eight : u32 = { { invalid(); - //~^ ERROR statements in statics are unstable - //~| ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants + //~^ ERROR: calls in statics are limited to constant functions, tuple structs and tuple variants 0 } }; @@ -82,7 +62,6 @@ static mut bad_eight : u32 = { static mut bad_nine : u32 = { { valid(); - //~^ ERROR statements in statics are unstable 0 } }; diff --git a/src/test/ui/issues/issue-32829-2.stderr b/src/test/ui/issues/issue-32829-2.stderr index 6d6b94ca4bc..8d7423f29ae 100644 --- a/src/test/ui/issues/issue-32829-2.stderr +++ b/src/test/ui/issues/issue-32829-2.stderr @@ -1,94 +1,21 @@ -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue-32829-2.rs:17:9 - | -LL | 5; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue-32829-2.rs:25:9 + --> $DIR/issue-32829-2.rs:12:9 | LL | invalid(); | ^^^^^^^^^ -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue-32829-2.rs:25:9 - | -LL | invalid(); - | ^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constants are unstable (see issue #48821) - --> $DIR/issue-32829-2.rs:34:9 - | -LL | valid(); - | ^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue-32829-2.rs:42:9 - | -LL | 5; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue-32829-2.rs:50:9 - | -LL | invalid(); - | ^^^^^^^^^ - -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue-32829-2.rs:50:9 + --> $DIR/issue-32829-2.rs:34:9 | LL | invalid(); | ^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue-32829-2.rs:59:9 - | -LL | valid(); - | ^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue-32829-2.rs:67:9 - | -LL | 5; - | ^ - | - = help: add #![feature(const_let)] to the crate attributes to enable error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue-32829-2.rs:75:9 + --> $DIR/issue-32829-2.rs:56:9 | LL | invalid(); | ^^^^^^^^^ -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue-32829-2.rs:75:9 - | -LL | invalid(); - | ^^^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/issue-32829-2.rs:84:9 - | -LL | valid(); - | ^^^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error: aborting due to 12 previous errors +error: aborting due to 3 previous errors -Some errors occurred: E0015, E0658. -For more information about an error, try `rustc --explain E0015`. +For more information about this error, try `rustc --explain E0015`. diff --git a/src/test/ui/issues/issue-32829.rs b/src/test/ui/issues/issue-32829.rs index 2d333f324c4..adfee7b925c 100644 --- a/src/test/ui/issues/issue-32829.rs +++ b/src/test/ui/issues/issue-32829.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static S : u64 = { { panic!("foo"); 0 } }; //~^ ERROR panicking in statics is unstable diff --git a/src/test/ui/issues/issue-32829.stderr b/src/test/ui/issues/issue-32829.stderr index 55ee6d80d1f..037f5416fa5 100644 --- a/src/test/ui/issues/issue-32829.stderr +++ b/src/test/ui/issues/issue-32829.stderr @@ -1,5 +1,5 @@ error[E0658]: panicking in statics is unstable (see issue #51999) - --> $DIR/issue-32829.rs:11:22 + --> $DIR/issue-32829.rs:1:22 | LL | static S : u64 = { { panic!("foo"); 0 } }; | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-32833.rs b/src/test/ui/issues/issue-32833.rs index 41383e93603..379eedde726 100644 --- a/src/test/ui/issues/issue-32833.rs +++ b/src/test/ui/issues/issue-32833.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use bar::Foo; //~ ERROR unresolved import `bar::Foo` [E0432] //~^ no `Foo` in `bar` mod bar { diff --git a/src/test/ui/issues/issue-32833.stderr b/src/test/ui/issues/issue-32833.stderr index 11af5d56766..c7f0eb1a432 100644 --- a/src/test/ui/issues/issue-32833.stderr +++ b/src/test/ui/issues/issue-32833.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `bar::Foo` - --> $DIR/issue-32833.rs:11:5 + --> $DIR/issue-32833.rs:1:5 | LL | use bar::Foo; //~ ERROR unresolved import `bar::Foo` [E0432] | ^^^^^^^^ no `Foo` in `bar` diff --git a/src/test/ui/issues/issue-32922.rs b/src/test/ui/issues/issue-32922.rs index c0b14da9b2c..b06b63cbdc3 100644 --- a/src/test/ui/issues/issue-32922.rs +++ b/src/test/ui/issues/issue-32922.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(warnings)] diff --git a/src/test/ui/issues/issue-32950.rs b/src/test/ui/issues/issue-32950.rs index 4e5cdd50b2a..27d68a11c1f 100644 --- a/src/test/ui/issues/issue-32950.rs +++ b/src/test/ui/issues/issue-32950.rs @@ -1,18 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(concat_idents)] #[derive(Debug)] struct Baz( concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros + //~^ ERROR cannot find type `FooBar` in this scope ); fn main() {} diff --git a/src/test/ui/issues/issue-32950.stderr b/src/test/ui/issues/issue-32950.stderr index 0363bf05f00..13aed4a1756 100644 --- a/src/test/ui/issues/issue-32950.stderr +++ b/src/test/ui/issues/issue-32950.stderr @@ -1,8 +1,15 @@ error: `derive` cannot be used on items with type macros - --> $DIR/issue-32950.rs:15:5 + --> $DIR/issue-32950.rs:5:5 | LL | concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros | ^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error[E0412]: cannot find type `FooBar` in this scope + --> $DIR/issue-32950.rs:5:5 + | +LL | concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros + | ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/issues/issue-32963.rs b/src/test/ui/issues/issue-32963.rs index 24db822f89c..be59d3522b8 100644 --- a/src/test/ui/issues/issue-32963.rs +++ b/src/test/ui/issues/issue-32963.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem; trait Misc {} diff --git a/src/test/ui/issues/issue-32963.stderr b/src/test/ui/issues/issue-32963.stderr index dff7c9f2b8b..3e22ea7b289 100644 --- a/src/test/ui/issues/issue-32963.stderr +++ b/src/test/ui/issues/issue-32963.stderr @@ -1,17 +1,17 @@ error[E0225]: only auto traits can be used as additional traits in a trait object - --> $DIR/issue-32963.rs:18:25 + --> $DIR/issue-32963.rs:8:25 | LL | size_of_copy::(); | ^^^^ non-auto additional trait error[E0277]: the trait bound `dyn Misc: std::marker::Copy` is not satisfied - --> $DIR/issue-32963.rs:18:5 + --> $DIR/issue-32963.rs:8:5 | LL | size_of_copy::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `dyn Misc` | note: required by `size_of_copy` - --> $DIR/issue-32963.rs:15:1 + --> $DIR/issue-32963.rs:5:1 | LL | fn size_of_copy() -> usize { mem::size_of::() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-32995-2.rs b/src/test/ui/issues/issue-32995-2.rs index 18424fcc9e0..2234f68f246 100644 --- a/src/test/ui/issues/issue-32995-2.rs +++ b/src/test/ui/issues/issue-32995-2.rs @@ -1,22 +1,12 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] fn main() { { fn f() {} } - //~^ ERROR parenthesized parameters may only be used with a trait + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted { fn f() -> impl ::std::marker()::Send { } } - //~^ ERROR parenthesized parameters may only be used with a trait + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted } @@ -24,5 +14,5 @@ fn main() { struct X; impl ::std::marker()::Copy for X {} -//~^ ERROR parenthesized parameters may only be used with a trait +//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted diff --git a/src/test/ui/issues/issue-32995-2.stderr b/src/test/ui/issues/issue-32995-2.stderr index 68eda14f81d..104b76cba2d 100644 --- a/src/test/ui/issues/issue-32995-2.stderr +++ b/src/test/ui/issues/issue-32995-2.stderr @@ -1,5 +1,5 @@ -error: parenthesized parameters may only be used with a trait - --> $DIR/issue-32995-2.rs:14:28 +error: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995-2.rs:4:28 | LL | { fn f() {} } | ^^ @@ -8,8 +8,8 @@ LL | { fn f() {} } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 -error: parenthesized parameters may only be used with a trait - --> $DIR/issue-32995-2.rs:18:35 +error: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995-2.rs:8:35 | LL | { fn f() -> impl ::std::marker()::Send { } } | ^^ @@ -17,8 +17,8 @@ LL | { fn f() -> impl ::std::marker()::Send { } } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 -error: parenthesized parameters may only be used with a trait - --> $DIR/issue-32995-2.rs:26:19 +error: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995-2.rs:16:19 | LL | impl ::std::marker()::Copy for X {} | ^^ diff --git a/src/test/ui/issues/issue-32995.rs b/src/test/ui/issues/issue-32995.rs index ffbd0c0c22a..c32fb63f1e5 100644 --- a/src/test/ui/issues/issue-32995.rs +++ b/src/test/ui/issues/issue-32995.rs @@ -1,43 +1,33 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] fn main() { let x: usize() = 1; - //~^ ERROR parenthesized parameters may only be used with a trait + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted let b: ::std::boxed()::Box<_> = Box::new(1); - //~^ ERROR parenthesized parameters may only be used with a trait + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted let p = ::std::str::()::from_utf8(b"foo").unwrap(); - //~^ ERROR parenthesized parameters may only be used with a trait + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted let p = ::std::str::from_utf8::()(b"foo").unwrap(); - //~^ ERROR parenthesized parameters may only be used with a trait + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted let o : Box<::std::marker()::Send> = Box::new(1); - //~^ ERROR parenthesized parameters may only be used with a trait + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted let o : Box = Box::new(1); - //~^ ERROR parenthesized parameters may only be used with a trait + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted } fn foo() { let d : X() = Default::default(); - //~^ ERROR parenthesized parameters may only be used with a trait + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted } diff --git a/src/test/ui/issues/issue-32995.stderr b/src/test/ui/issues/issue-32995.stderr index f427964135c..97b4b7fa76c 100644 --- a/src/test/ui/issues/issue-32995.stderr +++ b/src/test/ui/issues/issue-32995.stderr @@ -1,5 +1,5 @@ -error: parenthesized parameters may only be used with a trait - --> $DIR/issue-32995.rs:14:17 +error: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:4:17 | LL | let x: usize() = 1; | ^^ @@ -8,8 +8,8 @@ LL | let x: usize() = 1; = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 -error: parenthesized parameters may only be used with a trait - --> $DIR/issue-32995.rs:18:24 +error: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:8:24 | LL | let b: ::std::boxed()::Box<_> = Box::new(1); | ^^ @@ -17,26 +17,26 @@ LL | let b: ::std::boxed()::Box<_> = Box::new(1); = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 -error: parenthesized parameters may only be used with a trait - --> $DIR/issue-32995.rs:22:23 +error: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:12:25 | LL | let p = ::std::str::()::from_utf8(b"foo").unwrap(); - | ^^^^ + | ^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 -error: parenthesized parameters may only be used with a trait - --> $DIR/issue-32995.rs:26:34 +error: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:16:36 | LL | let p = ::std::str::from_utf8::()(b"foo").unwrap(); - | ^^^^ + | ^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 -error: parenthesized parameters may only be used with a trait - --> $DIR/issue-32995.rs:30:30 +error: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:20:30 | LL | let o : Box<::std::marker()::Send> = Box::new(1); | ^^ @@ -44,8 +44,8 @@ LL | let o : Box<::std::marker()::Send> = Box::new(1); = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 -error: parenthesized parameters may only be used with a trait - --> $DIR/issue-32995.rs:34:37 +error: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:24:37 | LL | let o : Box = Box::new(1); | ^^ @@ -53,8 +53,8 @@ LL | let o : Box = Box::new(1); = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 -error: parenthesized parameters may only be used with a trait - --> $DIR/issue-32995.rs:40:14 +error: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/issue-32995.rs:30:14 | LL | let d : X() = Default::default(); | ^^ diff --git a/src/test/ui/issues/issue-33140-hack-boundaries.rs b/src/test/ui/issues/issue-33140-hack-boundaries.rs new file mode 100644 index 00000000000..fbdef51c132 --- /dev/null +++ b/src/test/ui/issues/issue-33140-hack-boundaries.rs @@ -0,0 +1,80 @@ +#![feature(optin_builtin_traits)] +#![allow(order_dependent_trait_objects)] + +// Check that the issue #33140 hack does not allow unintended things. + +// OK +trait Trait0 { +} + +impl Trait0 for dyn Send {} +impl Trait0 for dyn Send {} + +// Problem 1: associated types +trait Trait1 { + fn my_fn(&self) {} +} + +impl Trait1 for dyn Send {} +impl Trait1 for dyn Send {} +//~^ ERROR E0119 + +// Problem 2: negative impl +trait Trait2 { +} + +impl Trait2 for dyn Send {} +impl !Trait2 for dyn Send {} +//~^ ERROR E0119 + + +// Problem 3: type parameter +trait Trait3 { +} + +impl Trait3 for dyn Send {} +impl Trait3 for dyn Send {} +//~^ ERROR E0119 + +// Problem 4a: not a trait object - generic +trait Trait4a { +} + +impl Trait4a for T {} +impl Trait4a for dyn Send {} +//~^ ERROR E0119 + +// Problem 4b: not a trait object - misc +trait Trait4b { +} + +impl Trait4b for () {} +impl Trait4b for () {} +//~^ ERROR E0119 + +// Problem 4c: not a principal-less trait object +trait Trait4c { +} + +impl Trait4c for dyn Trait1 + Send {} +impl Trait4c for dyn Trait1 + Send {} +//~^ ERROR E0119 + +// Problem 4d: lifetimes +trait Trait4d { +} + +impl<'a> Trait4d for dyn Send + 'a {} +impl<'a> Trait4d for dyn Send + 'a {} +//~^ ERROR E0119 + + +// Problem 5: where-clauses +trait Trait5 { +} + +impl Trait5 for dyn Send {} +impl Trait5 for dyn Send where u32: Copy {} +//~^ ERROR E0119 + +fn main() {} diff --git a/src/test/ui/issues/issue-33140-hack-boundaries.stderr b/src/test/ui/issues/issue-33140-hack-boundaries.stderr new file mode 100644 index 00000000000..95aaa55ba7c --- /dev/null +++ b/src/test/ui/issues/issue-33140-hack-boundaries.stderr @@ -0,0 +1,67 @@ +error[E0119]: conflicting implementations of trait `Trait1` for type `(dyn std::marker::Send + 'static)`: + --> $DIR/issue-33140-hack-boundaries.rs:19:1 + | +LL | impl Trait1 for dyn Send {} + | ------------------------ first implementation here +LL | impl Trait1 for dyn Send {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` + +error[E0119]: conflicting implementations of trait `Trait2` for type `(dyn std::marker::Send + 'static)`: + --> $DIR/issue-33140-hack-boundaries.rs:27:1 + | +LL | impl Trait2 for dyn Send {} + | ------------------------ first implementation here +LL | impl !Trait2 for dyn Send {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` + +error[E0119]: conflicting implementations of trait `Trait3<(dyn std::marker::Sync + 'static)>` for type `(dyn std::marker::Send + 'static)`: + --> $DIR/issue-33140-hack-boundaries.rs:36:1 + | +LL | impl Trait3 for dyn Send {} + | ---------------------------------- first implementation here +LL | impl Trait3 for dyn Send {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` + +error[E0119]: conflicting implementations of trait `Trait4a` for type `(dyn std::marker::Send + 'static)`: + --> $DIR/issue-33140-hack-boundaries.rs:44:1 + | +LL | impl Trait4a for T {} + | ----------------------------- first implementation here +LL | impl Trait4a for dyn Send {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` + +error[E0119]: conflicting implementations of trait `Trait4b` for type `()`: + --> $DIR/issue-33140-hack-boundaries.rs:52:1 + | +LL | impl Trait4b for () {} + | ------------------- first implementation here +LL | impl Trait4b for () {} + | ^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` + +error[E0119]: conflicting implementations of trait `Trait4c` for type `(dyn Trait1 + std::marker::Send + 'static)`: + --> $DIR/issue-33140-hack-boundaries.rs:60:1 + | +LL | impl Trait4c for dyn Trait1 + Send {} + | ---------------------------------- first implementation here +LL | impl Trait4c for dyn Trait1 + Send {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn Trait1 + std::marker::Send + 'static)` + +error[E0119]: conflicting implementations of trait `Trait4d` for type `dyn std::marker::Send`: + --> $DIR/issue-33140-hack-boundaries.rs:68:1 + | +LL | impl<'a> Trait4d for dyn Send + 'a {} + | ---------------------------------- first implementation here +LL | impl<'a> Trait4d for dyn Send + 'a {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `dyn std::marker::Send` + +error[E0119]: conflicting implementations of trait `Trait5` for type `(dyn std::marker::Send + 'static)`: + --> $DIR/issue-33140-hack-boundaries.rs:77:1 + | +LL | impl Trait5 for dyn Send {} + | ------------------------ first implementation here +LL | impl Trait5 for dyn Send where u32: Copy {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` + +error: aborting due to 8 previous errors + +For more information about this error, try `rustc --explain E0119`. diff --git a/src/test/ui/issues/issue-33140-traitobject-crate.rs b/src/test/ui/issues/issue-33140-traitobject-crate.rs new file mode 100644 index 00000000000..2b644817df1 --- /dev/null +++ b/src/test/ui/issues/issue-33140-traitobject-crate.rs @@ -0,0 +1,101 @@ +// compile-pass + +#![warn(order_dependent_trait_objects)] + +// Check that traitobject 0.1.0 compiles + +//! # traitobject +//! +//! Unsafe helpers for working with raw TraitObjects. + +/// A trait implemented for all trait objects. +/// +/// Implementations for all traits in std are provided. +pub unsafe trait Trait {} + +unsafe impl Trait for ::std::any::Any + Send { } +unsafe impl Trait for ::std::any::Any + Sync { } +unsafe impl Trait for ::std::any::Any + Send + Sync { } +unsafe impl Trait for ::std::borrow::Borrow + Send { } +unsafe impl Trait for ::std::borrow::Borrow + Sync { } +unsafe impl Trait for ::std::borrow::Borrow + Send + Sync { } +unsafe impl Trait for ::std::borrow::BorrowMut + Send { } +unsafe impl Trait for ::std::borrow::BorrowMut + Sync { } +unsafe impl Trait for ::std::borrow::BorrowMut + Send + Sync { } +unsafe impl Trait for ::std::convert::AsMut + Send { } +unsafe impl Trait for ::std::convert::AsMut + Sync { } +unsafe impl Trait for ::std::convert::AsMut + Send + Sync { } +unsafe impl Trait for ::std::convert::AsRef + Send { } +unsafe impl Trait for ::std::convert::AsRef + Sync { } +unsafe impl Trait for ::std::convert::AsRef + Send + Sync { } +unsafe impl Trait for ::std::error::Error + Send { } +unsafe impl Trait for ::std::error::Error + Sync { } +unsafe impl Trait for ::std::error::Error + Send + Sync { } +unsafe impl Trait for ::std::fmt::Binary + Send { } +unsafe impl Trait for ::std::fmt::Binary + Sync { } +unsafe impl Trait for ::std::fmt::Binary + Send + Sync { } +unsafe impl Trait for ::std::fmt::Debug + Send { } +unsafe impl Trait for ::std::fmt::Debug + Sync { } +unsafe impl Trait for ::std::fmt::Debug + Send + Sync { } +unsafe impl Trait for ::std::fmt::Display + Send { } +unsafe impl Trait for ::std::fmt::Display + Sync { } +unsafe impl Trait for ::std::fmt::Display + Send + Sync { } +unsafe impl Trait for ::std::fmt::LowerExp + Send { } +unsafe impl Trait for ::std::fmt::LowerExp + Sync { } +unsafe impl Trait for ::std::fmt::LowerExp + Send + Sync { } +unsafe impl Trait for ::std::fmt::LowerHex + Send { } +unsafe impl Trait for ::std::fmt::LowerHex + Sync { } +unsafe impl Trait for ::std::fmt::LowerHex + Send + Sync { } +unsafe impl Trait for ::std::fmt::Octal + Send { } +unsafe impl Trait for ::std::fmt::Octal + Sync { } +unsafe impl Trait for ::std::fmt::Octal + Send + Sync { } +unsafe impl Trait for ::std::fmt::Pointer + Send { } +unsafe impl Trait for ::std::fmt::Pointer + Sync { } +unsafe impl Trait for ::std::fmt::Pointer + Send + Sync { } +unsafe impl Trait for ::std::fmt::UpperExp + Send { } +unsafe impl Trait for ::std::fmt::UpperExp + Sync { } +unsafe impl Trait for ::std::fmt::UpperExp + Send + Sync { } +unsafe impl Trait for ::std::fmt::UpperHex + Send { } +unsafe impl Trait for ::std::fmt::UpperHex + Sync { } +unsafe impl Trait for ::std::fmt::UpperHex + Send + Sync { } +unsafe impl Trait for ::std::fmt::Write + Send { } +unsafe impl Trait for ::std::fmt::Write + Sync { } +unsafe impl Trait for ::std::fmt::Write + Send + Sync { } +unsafe impl Trait for ::std::hash::Hasher + Send { } +unsafe impl Trait for ::std::hash::Hasher + Sync { } +unsafe impl Trait for ::std::hash::Hasher + Send + Sync { } +unsafe impl Trait for ::std::io::BufRead + Send { } +unsafe impl Trait for ::std::io::BufRead + Sync { } +unsafe impl Trait for ::std::io::BufRead + Send + Sync { } +unsafe impl Trait for ::std::io::Read + Send { } +unsafe impl Trait for ::std::io::Read + Sync { } +unsafe impl Trait for ::std::io::Read + Send + Sync { } +unsafe impl Trait for ::std::io::Seek + Send { } +unsafe impl Trait for ::std::io::Seek + Sync { } +unsafe impl Trait for ::std::io::Seek + Send + Sync { } +unsafe impl Trait for ::std::io::Write + Send { } +unsafe impl Trait for ::std::io::Write + Sync { } +unsafe impl Trait for ::std::io::Write + Send + Sync { } +unsafe impl Trait for ::std::iter::IntoIterator { } +unsafe impl Trait for ::std::iter::Iterator + Send { } +unsafe impl Trait for ::std::iter::Iterator + Sync { } +unsafe impl Trait for ::std::iter::Iterator + Send + Sync { } +unsafe impl Trait for ::std::marker::Send + Send { } +unsafe impl Trait for ::std::marker::Send + Sync { } +unsafe impl Trait for ::std::marker::Send + Send + Sync { } +unsafe impl Trait for ::std::marker::Sync + Send { } +unsafe impl Trait for ::std::marker::Sync + Sync { } +unsafe impl Trait for ::std::marker::Sync + Send + Sync { } +unsafe impl Trait for ::std::ops::Drop + Send { } +unsafe impl Trait for ::std::ops::Drop + Sync { } +unsafe impl Trait for ::std::ops::Drop + Send + Sync { } +unsafe impl Trait for ::std::string::ToString + Send { } +unsafe impl Trait for ::std::string::ToString + Sync { } +unsafe impl Trait for ::std::string::ToString + Send + Sync { } +fn assert_trait() {} + +fn main() { + assert_trait::(); + assert_trait::(); + assert_trait::(); +} diff --git a/src/test/ui/issues/issue-33140-traitobject-crate.stderr b/src/test/ui/issues/issue-33140-traitobject-crate.stderr new file mode 100644 index 00000000000..6f71e79d0ee --- /dev/null +++ b/src/test/ui/issues/issue-33140-traitobject-crate.stderr @@ -0,0 +1,39 @@ +warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) + --> $DIR/issue-33140-traitobject-crate.rs:85:1 + | +LL | unsafe impl Trait for ::std::marker::Send + Sync { } + | ------------------------------------------------ first implementation here +LL | unsafe impl Trait for ::std::marker::Send + Send + Sync { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` + | +note: lint level defined here + --> $DIR/issue-33140-traitobject-crate.rs:3:9 + | +LL | #![warn(order_dependent_trait_objects)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #56484 + +warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) + --> $DIR/issue-33140-traitobject-crate.rs:86:1 + | +LL | unsafe impl Trait for ::std::marker::Send + Send + Sync { } + | ------------------------------------------------------- first implementation here +LL | unsafe impl Trait for ::std::marker::Sync + Send { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #56484 + +warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) + --> $DIR/issue-33140-traitobject-crate.rs:88:1 + | +LL | unsafe impl Trait for ::std::marker::Sync + Send { } + | ------------------------------------------------ first implementation here +LL | unsafe impl Trait for ::std::marker::Sync + Sync { } +LL | unsafe impl Trait for ::std::marker::Sync + Send + Sync { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #56484 + diff --git a/src/test/ui/issues/issue-33140.rs b/src/test/ui/issues/issue-33140.rs new file mode 100644 index 00000000000..930e24218ac --- /dev/null +++ b/src/test/ui/issues/issue-33140.rs @@ -0,0 +1,47 @@ +trait Trait { + fn xyz() -> bool; +} + +impl Trait for dyn Send + Sync { + fn xyz() -> bool { false } +} + +impl Trait for dyn Sync + Send { +//~^ ERROR conflicting implementations + fn xyz() -> bool { true } +} + +trait Trait2 { + fn uvw() -> bool; +} + +impl Trait2 for dyn Send + Sync { + fn uvw() -> bool { false } +} + +impl Trait2 for dyn Sync + Send + Sync { +//~^ ERROR conflicting implementations + fn uvw() -> bool { true } +} + +struct Foo(T); +impl Foo { + fn abc() -> bool { //~ ERROR duplicate definitions with name `abc` + false + } +} + +impl Foo { + fn abc() -> bool { + true + } +} + +fn main() { + assert_eq!(::xyz(), false); + assert_eq!(::xyz(), true); + assert_eq!(::uvw(), false); + assert_eq!(::uvw(), true); + assert_eq!(>::abc(), false); + assert_eq!(>::abc(), true); +} diff --git a/src/test/ui/issues/issue-33140.stderr b/src/test/ui/issues/issue-33140.stderr new file mode 100644 index 00000000000..e2631e971c5 --- /dev/null +++ b/src/test/ui/issues/issue-33140.stderr @@ -0,0 +1,35 @@ +error[E0119]: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: + --> $DIR/issue-33140.rs:9:1 + | +LL | impl Trait for dyn Send + Sync { + | ------------------------------ first implementation here +... +LL | impl Trait for dyn Sync + Send { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` + +error[E0119]: conflicting implementations of trait `Trait2` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: + --> $DIR/issue-33140.rs:22:1 + | +LL | impl Trait2 for dyn Send + Sync { + | ------------------------------- first implementation here +... +LL | impl Trait2 for dyn Sync + Send + Sync { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` + +error[E0592]: duplicate definitions with name `abc` + --> $DIR/issue-33140.rs:29:5 + | +LL | / fn abc() -> bool { //~ ERROR duplicate definitions with name `abc` +LL | | false +LL | | } + | |_____^ duplicate definitions for `abc` +... +LL | / fn abc() -> bool { +LL | | true +LL | | } + | |_____- other definition for `abc` + +error: aborting due to 3 previous errors + +Some errors occurred: E0119, E0592. +For more information about an error, try `rustc --explain E0119`. diff --git a/src/test/ui/issues/issue-33241.rs b/src/test/ui/issues/issue-33241.rs index 858c9f4ae3f..4c5052a60d3 100644 --- a/src/test/ui/issues/issue-33241.rs +++ b/src/test/ui/issues/issue-33241.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen diff --git a/src/test/ui/issues/issue-33264.rs b/src/test/ui/issues/issue-33264.rs index 9b17dae0eef..7cba4df7d82 100644 --- a/src/test/ui/issues/issue-33264.rs +++ b/src/test/ui/issues/issue-33264.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // only-x86_64 diff --git a/src/test/ui/issues/issue-33287.rs b/src/test/ui/issues/issue-33287.rs index 1816d7d4f88..c6e1f4d1eb2 100644 --- a/src/test/ui/issues/issue-33287.rs +++ b/src/test/ui/issues/issue-33287.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/issues/issue-33293.rs b/src/test/ui/issues/issue-33293.rs index 801ba7afcd6..d3670374284 100644 --- a/src/test/ui/issues/issue-33293.rs +++ b/src/test/ui/issues/issue-33293.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match 0 { aaa::bbb(_) => () diff --git a/src/test/ui/issues/issue-33293.stderr b/src/test/ui/issues/issue-33293.stderr index dc288fa71ce..6b7333f22fe 100644 --- a/src/test/ui/issues/issue-33293.stderr +++ b/src/test/ui/issues/issue-33293.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: use of undeclared type or module `aaa` - --> $DIR/issue-33293.rs:13:9 + --> $DIR/issue-33293.rs:3:9 | LL | aaa::bbb(_) => () | ^^^ use of undeclared type or module `aaa` diff --git a/src/test/ui/issues/issue-3344.rs b/src/test/ui/issues/issue-3344.rs index 73532cb768a..de764b3d075 100644 --- a/src/test/ui/issues/issue-3344.rs +++ b/src/test/ui/issues/issue-3344.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(PartialEq)] -struct thing(usize); -impl PartialOrd for thing { //~ ERROR not all trait items implemented, missing: `partial_cmp` - fn le(&self, other: &thing) -> bool { true } - fn ge(&self, other: &thing) -> bool { true } +struct Thing(usize); +impl PartialOrd for Thing { //~ ERROR not all trait items implemented, missing: `partial_cmp` + fn le(&self, other: &Thing) -> bool { true } + fn ge(&self, other: &Thing) -> bool { true } } fn main() {} diff --git a/src/test/ui/issues/issue-3344.stderr b/src/test/ui/issues/issue-3344.stderr index eb6caa7307e..8e4a14fb4fa 100644 --- a/src/test/ui/issues/issue-3344.stderr +++ b/src/test/ui/issues/issue-3344.stderr @@ -1,7 +1,7 @@ error[E0046]: not all trait items implemented, missing: `partial_cmp` - --> $DIR/issue-3344.rs:13:1 + --> $DIR/issue-3344.rs:3:1 | -LL | impl PartialOrd for thing { //~ ERROR not all trait items implemented, missing: `partial_cmp` +LL | impl PartialOrd for Thing { //~ ERROR not all trait items implemented, missing: `partial_cmp` | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `partial_cmp` in implementation | = note: `partial_cmp` from trait: `fn(&Self, &Rhs) -> std::option::Option` diff --git a/src/test/ui/issues/issue-33464.rs b/src/test/ui/issues/issue-33464.rs index b7dbaf20eca..a0edb5fdb6f 100644 --- a/src/test/ui/issues/issue-33464.rs +++ b/src/test/ui/issues/issue-33464.rs @@ -1,20 +1,10 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure that the spans of import errors are correct. use abc::one_el; -//~^ ERROR 13:5: 13:8 +//~^ ERROR use abc::{a, bbb, cccccc}; -//~^ ERROR 15:5: 15:8 +//~^ ERROR use a_very_long_name::{el, el2}; -//~^ ERROR 17:5: 17:21 +//~^ ERROR fn main() {} diff --git a/src/test/ui/issues/issue-33464.stderr b/src/test/ui/issues/issue-33464.stderr index f41a3973625..bbf8d21cf65 100644 --- a/src/test/ui/issues/issue-33464.stderr +++ b/src/test/ui/issues/issue-33464.stderr @@ -1,17 +1,17 @@ error[E0432]: unresolved import `abc` - --> $DIR/issue-33464.rs:13:5 + --> $DIR/issue-33464.rs:3:5 | LL | use abc::one_el; | ^^^ maybe a missing `extern crate abc;`? error[E0432]: unresolved import `abc` - --> $DIR/issue-33464.rs:15:5 + --> $DIR/issue-33464.rs:5:5 | LL | use abc::{a, bbb, cccccc}; | ^^^ maybe a missing `extern crate abc;`? error[E0432]: unresolved import `a_very_long_name` - --> $DIR/issue-33464.rs:17:5 + --> $DIR/issue-33464.rs:7:5 | LL | use a_very_long_name::{el, el2}; | ^^^^^^^^^^^^^^^^ maybe a missing `extern crate a_very_long_name;`? diff --git a/src/test/ui/issues/issue-33504.rs b/src/test/ui/issues/issue-33504.rs index 1e1994357c7..89cc06ede5e 100644 --- a/src/test/ui/issues/issue-33504.rs +++ b/src/test/ui/issues/issue-33504.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Shadowing a unit-like enum in a closure struct Test; diff --git a/src/test/ui/issues/issue-33504.stderr b/src/test/ui/issues/issue-33504.stderr index ecf8076b2b3..716aa8a8632 100644 --- a/src/test/ui/issues/issue-33504.stderr +++ b/src/test/ui/issues/issue-33504.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/issue-33504.rs:17:13 + --> $DIR/issue-33504.rs:7:13 | LL | let Test = 1; //~ ERROR mismatched types - | ^^^^ expected integral variable, found struct `Test` + | ^^^^ expected integer, found struct `Test` | = note: expected type `{integer}` found type `Test` diff --git a/src/test/ui/issues/issue-33525.rs b/src/test/ui/issues/issue-33525.rs index 0589618a82f..74f21eff20f 100644 --- a/src/test/ui/issues/issue-33525.rs +++ b/src/test/ui/issues/issue-33525.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { a; //~ ERROR cannot find value `a` "".lorem; //~ ERROR no field diff --git a/src/test/ui/issues/issue-33525.stderr b/src/test/ui/issues/issue-33525.stderr index 2b365e1cc98..2c97a39a183 100644 --- a/src/test/ui/issues/issue-33525.stderr +++ b/src/test/ui/issues/issue-33525.stderr @@ -1,17 +1,17 @@ error[E0425]: cannot find value `a` in this scope - --> $DIR/issue-33525.rs:12:5 + --> $DIR/issue-33525.rs:2:5 | LL | a; //~ ERROR cannot find value `a` | ^ not found in this scope error[E0609]: no field `lorem` on type `&'static str` - --> $DIR/issue-33525.rs:13:8 + --> $DIR/issue-33525.rs:3:8 | LL | "".lorem; //~ ERROR no field | ^^^^^ error[E0609]: no field `ipsum` on type `&'static str` - --> $DIR/issue-33525.rs:14:8 + --> $DIR/issue-33525.rs:4:8 | LL | "".ipsum; //~ ERROR no field | ^^^^^ diff --git a/src/test/ui/issues/issue-33571.rs b/src/test/ui/issues/issue-33571.rs index 5dfc41c8f4a..223bbc3ff5e 100644 --- a/src/test/ui/issues/issue-33571.rs +++ b/src/test/ui/issues/issue-33571.rs @@ -1,14 +1,6 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Clone, Sync, //~ ERROR this unsafe trait should be implemented explicitly Copy)] enum Foo {} + +fn main() {} diff --git a/src/test/ui/issues/issue-33571.stderr b/src/test/ui/issues/issue-33571.stderr index be45f377c1f..2fae447c5e8 100644 --- a/src/test/ui/issues/issue-33571.stderr +++ b/src/test/ui/issues/issue-33571.stderr @@ -1,5 +1,5 @@ error: this unsafe trait should be implemented explicitly - --> $DIR/issue-33571.rs:12:10 + --> $DIR/issue-33571.rs:2:10 | LL | Sync, //~ ERROR this unsafe trait should be implemented explicitly | ^^^^ diff --git a/src/test/ui/issues/issue-33819.nll.stderr b/src/test/ui/issues/issue-33819.nll.stderr index 78ad31a04c8..8bc2d82cd3f 100644 --- a/src/test/ui/issues/issue-33819.nll.stderr +++ b/src/test/ui/issues/issue-33819.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable - --> $DIR/issue-33819.rs:13:34 + --> $DIR/issue-33819.rs:4:34 | LL | Some(ref v) => { let a = &mut v; }, | ^^^^^^ diff --git a/src/test/ui/issues/issue-33819.rs b/src/test/ui/issues/issue-33819.rs index 499e7e54947..7f25ebd18ff 100644 --- a/src/test/ui/issues/issue-33819.rs +++ b/src/test/ui/issues/issue-33819.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. fn main() { let mut op = Some(2); match op { diff --git a/src/test/ui/issues/issue-33819.stderr b/src/test/ui/issues/issue-33819.stderr index bb8a542b12b..09b8835a8a6 100644 --- a/src/test/ui/issues/issue-33819.stderr +++ b/src/test/ui/issues/issue-33819.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `v` as mutable - --> $DIR/issue-33819.rs:13:39 + --> $DIR/issue-33819.rs:4:39 | LL | Some(ref v) => { let a = &mut v; }, | ^ cannot borrow mutably diff --git a/src/test/ui/issues/issue-33903.rs b/src/test/ui/issues/issue-33903.rs index bcbb73ce65b..98544aca5f9 100644 --- a/src/test/ui/issues/issue-33903.rs +++ b/src/test/ui/issues/issue-33903.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Issue 33903: diff --git a/src/test/ui/issues/issue-33941.rs b/src/test/ui/issues/issue-33941.rs index 21c169c6638..ccaa6334856 100644 --- a/src/test/ui/issues/issue-33941.rs +++ b/src/test/ui/issues/issue-33941.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::HashMap; fn main() { diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr index f20b87fa371..43cd7af81d9 100644 --- a/src/test/ui/issues/issue-33941.stderr +++ b/src/test/ui/issues/issue-33941.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == &_` - --> $DIR/issue-33941.rs:14:36 + --> $DIR/issue-33941.rs:4:36 | LL | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch | ^^^^^^ expected tuple, found reference @@ -8,7 +8,7 @@ LL | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch found type `&_` error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == &_` - --> $DIR/issue-33941.rs:14:14 + --> $DIR/issue-33941.rs:4:14 | LL | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference diff --git a/src/test/ui/issues/issue-34028.rs b/src/test/ui/issues/issue-34028.rs index 10ae2b8e6dc..8ebc730755f 100644 --- a/src/test/ui/issues/issue-34028.rs +++ b/src/test/ui/issues/issue-34028.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen diff --git a/src/test/ui/issues/issue-34047.rs b/src/test/ui/issues/issue-34047.rs index db284102503..55196177f69 100644 --- a/src/test/ui/issues/issue-34047.rs +++ b/src/test/ui/issues/issue-34047.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const C: u8 = 0; fn main() { diff --git a/src/test/ui/issues/issue-34047.stderr b/src/test/ui/issues/issue-34047.stderr index 10e4e9c1c12..8d552f24cd6 100644 --- a/src/test/ui/issues/issue-34047.stderr +++ b/src/test/ui/issues/issue-34047.stderr @@ -1,5 +1,5 @@ error[E0530]: match bindings cannot shadow constants - --> $DIR/issue-34047.rs:15:13 + --> $DIR/issue-34047.rs:5:13 | LL | const C: u8 = 0; | ---------------- the constant `C` is defined here diff --git a/src/test/ui/issues/issue-34171.rs b/src/test/ui/issues/issue-34171.rs index 55fec30cdde..25a5f72e803 100644 --- a/src/test/ui/issues/issue-34171.rs +++ b/src/test/ui/issues/issue-34171.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen diff --git a/src/test/ui/issues/issue-34194.rs b/src/test/ui/issues/issue-34194.rs index 986048a03ee..b65de91d69b 100644 --- a/src/test/ui/issues/issue-34194.rs +++ b/src/test/ui/issues/issue-34194.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-34209.rs b/src/test/ui/issues/issue-34209.rs index b3cb7d4cc30..50095be7740 100644 --- a/src/test/ui/issues/issue-34209.rs +++ b/src/test/ui/issues/issue-34209.rs @@ -1,21 +1,11 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum S { A, } fn bug(l: S) { match l { - S::B{ } => { }, - //~^ ERROR ambiguous associated type + S::B { } => { }, + //~^ ERROR no variant `B` on enum `S` } } diff --git a/src/test/ui/issues/issue-34209.stderr b/src/test/ui/issues/issue-34209.stderr index 0dfdd8b5886..79aba89c148 100644 --- a/src/test/ui/issues/issue-34209.stderr +++ b/src/test/ui/issues/issue-34209.stderr @@ -1,9 +1,8 @@ -error[E0223]: ambiguous associated type - --> $DIR/issue-34209.rs:17:9 +error: no variant `B` on enum `S` + --> $DIR/issue-34209.rs:7:9 | -LL | S::B{ } => { }, - | ^^^^ help: use fully-qualified syntax: `::B` +LL | S::B { } => { }, + | ^^^^ help: did you mean: `S::A` error: aborting due to previous error -For more information about this error, try `rustc --explain E0223`. diff --git a/src/test/ui/issues/issue-34222-1.rs b/src/test/ui/issues/issue-34222-1.rs index 6c85414860f..d36dddc97bb 100644 --- a/src/test/ui/issues/issue-34222-1.rs +++ b/src/test/ui/issues/issue-34222-1.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { /// comment //~ ERROR found a documentation comment that doesn't document anything } diff --git a/src/test/ui/issues/issue-34222-1.stderr b/src/test/ui/issues/issue-34222-1.stderr index ef68d41da3c..beb6b589766 100644 --- a/src/test/ui/issues/issue-34222-1.stderr +++ b/src/test/ui/issues/issue-34222-1.stderr @@ -1,5 +1,5 @@ error[E0585]: found a documentation comment that doesn't document anything - --> $DIR/issue-34222-1.rs:12:5 + --> $DIR/issue-34222-1.rs:2:5 | LL | /// comment //~ ERROR found a documentation comment that doesn't document anything | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-34229.rs b/src/test/ui/issues/issue-34229.rs index bcdfcc767fb..13e627a492f 100644 --- a/src/test/ui/issues/issue-34229.rs +++ b/src/test/ui/issues/issue-34229.rs @@ -1,4 +1,5 @@ #[derive(PartialEq)] struct Comparable; #[derive(PartialEq, PartialOrd)] struct Nope(Comparable); +//~^ ERROR can't compare `Comparable` fn main() {} diff --git a/src/test/ui/issues/issue-3424.rs b/src/test/ui/issues/issue-3424.rs index 7bf0c4393c3..a9ba5f5408b 100644 --- a/src/test/ui/issues/issue-3424.rs +++ b/src/test/ui/issues/issue-3424.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/ui/issues/issue-34334.rs b/src/test/ui/issues/issue-34334.rs index a752a36ade2..5c4f5c86a7f 100644 --- a/src/test/ui/issues/issue-34334.rs +++ b/src/test/ui/issues/issue-34334.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main () { let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `,` or `>`, found `=` let sr2: Vec<(u32, _, _)> = sr.iter().map(|(faction, th_sender, th_receiver)| {}).collect(); diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr index 240df196ae7..9571d043635 100644 --- a/src/test/ui/issues/issue-34334.stderr +++ b/src/test/ui/issues/issue-34334.stderr @@ -1,5 +1,5 @@ error: expected one of `,` or `>`, found `=` - --> $DIR/issue-34334.rs:12:29 + --> $DIR/issue-34334.rs:2:29 | LL | let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `,` or `>`, found `=` | -- ^ expected one of `,` or `>` here diff --git a/src/test/ui/issues/issue-34349.rs b/src/test/ui/issues/issue-34349.rs index 591753181db..d861802610a 100644 --- a/src/test/ui/issues/issue-34349.rs +++ b/src/test/ui/issues/issue-34349.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is a regression test for a problem encountered around upvar // inference and trait caching: in particular, we were entering a // temporary closure kind during inference, and then caching results diff --git a/src/test/ui/issues/issue-34349.stderr b/src/test/ui/issues/issue-34349.stderr index 8683962b24d..f0cd8f94881 100644 --- a/src/test/ui/issues/issue-34349.stderr +++ b/src/test/ui/issues/issue-34349.stderr @@ -1,5 +1,5 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut` - --> $DIR/issue-34349.rs:26:17 + --> $DIR/issue-34349.rs:16:17 | LL | let diary = || { //~ ERROR E0525 | ^^ this closure implements `FnMut`, not `Fn` diff --git a/src/test/ui/issues/issue-34373.rs b/src/test/ui/issues/issue-34373.rs index 4d7238ad76f..ca24e37d9bb 100644 --- a/src/test/ui/issues/issue-34373.rs +++ b/src/test/ui/issues/issue-34373.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] trait Trait { diff --git a/src/test/ui/issues/issue-34373.stderr b/src/test/ui/issues/issue-34373.stderr index ea80111b5e2..07ac421455c 100644 --- a/src/test/ui/issues/issue-34373.stderr +++ b/src/test/ui/issues/issue-34373.stderr @@ -1,15 +1,26 @@ error[E0391]: cycle detected when processing `Foo::T` - --> $DIR/issue-34373.rs:17:30 + --> $DIR/issue-34373.rs:7:30 | LL | pub struct Foo>>; //~ ERROR cycle detected | ^^^^^^^^^^ | note: ...which requires processing `DefaultFoo`... - --> $DIR/issue-34373.rs:18:19 + --> $DIR/issue-34373.rs:8:19 | LL | type DefaultFoo = Foo; | ^^^ = note: ...which again requires processing `Foo::T`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/issue-34373.rs:1:1 + | +LL | / #![allow(warnings)] +LL | | +LL | | trait Trait { +LL | | fn foo(_: T) {} +... | +LL | | fn main() { +LL | | } + | |_^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-34418.rs b/src/test/ui/issues/issue-34418.rs index 394a85f8c89..6a86c277eaf 100644 --- a/src/test/ui/issues/issue-34418.rs +++ b/src/test/ui/issues/issue-34418.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(unused)] diff --git a/src/test/ui/issues/issue-34721.rs b/src/test/ui/issues/issue-34721.rs new file mode 100644 index 00000000000..226c21446b1 --- /dev/null +++ b/src/test/ui/issues/issue-34721.rs @@ -0,0 +1,34 @@ +#![feature(nll)] + +pub trait Foo { + fn zero(self) -> Self; +} + +impl Foo for u32 { + fn zero(self) -> u32 { 0u32 } +} + +pub mod bar { + pub use Foo; + pub fn bar(x: T) -> T { + x.zero() + } +} + +mod baz { + use bar; + use Foo; + pub fn baz(x: T) -> T { + if 0 == 1 { + bar::bar(x.zero()) + } else { + x.zero() + }; + x.zero() + //~^ ERROR use of moved value + } +} + +fn main() { + let _ = baz::baz(0u32); +} diff --git a/src/test/ui/issues/issue-34721.stderr b/src/test/ui/issues/issue-34721.stderr new file mode 100644 index 00000000000..2ed7b543e71 --- /dev/null +++ b/src/test/ui/issues/issue-34721.stderr @@ -0,0 +1,20 @@ +error[E0382]: use of moved value: `x` + --> $DIR/issue-34721.rs:27:9 + | +LL | pub fn baz(x: T) -> T { + | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | if 0 == 1 { +LL | bar::bar(x.zero()) + | - value moved here +LL | } else { +LL | x.zero() + | - value moved here +LL | }; +LL | x.zero() + | ^ value used here after move + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/issues/issue-34751.rs b/src/test/ui/issues/issue-34751.rs index e39e3c3b309..cca06c573e0 100644 --- a/src/test/ui/issues/issue-34751.rs +++ b/src/test/ui/issues/issue-34751.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // #34751 ICE: 'rustc' panicked at 'assertion failed: !substs.has_regions_escaping_depth(0)' diff --git a/src/test/ui/issues/issue-3477.rs b/src/test/ui/issues/issue-3477.rs index 0bad7372a12..ae17e7d1e41 100644 --- a/src/test/ui/issues/issue-3477.rs +++ b/src/test/ui/issues/issue-3477.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let _p: char = 100; //~^ ERROR mismatched types diff --git a/src/test/ui/issues/issue-3477.stderr b/src/test/ui/issues/issue-3477.stderr index 4207828693a..1b7f597d50e 100644 --- a/src/test/ui/issues/issue-3477.stderr +++ b/src/test/ui/issues/issue-3477.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-3477.rs:12:20 + --> $DIR/issue-3477.rs:2:20 | LL | let _p: char = 100; | ^^^ expected char, found u8 diff --git a/src/test/ui/issues/issue-34780.rs b/src/test/ui/issues/issue-34780.rs index 90b462a7432..bfe444e5d3f 100644 --- a/src/test/ui/issues/issue-34780.rs +++ b/src/test/ui/issues/issue-34780.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(stable_features)] #![feature(associated_consts)] diff --git a/src/test/ui/issues/issue-34839.rs b/src/test/ui/issues/issue-34839.rs index 8aad248dc50..01669f01e2f 100644 --- a/src/test/ui/issues/issue-34839.rs +++ b/src/test/ui/issues/issue-34839.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-35075.rs b/src/test/ui/issues/issue-35075.rs index 9943cfb9bca..0e54131c245 100644 --- a/src/test/ui/issues/issue-35075.rs +++ b/src/test/ui/issues/issue-35075.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Bar { inner: Foo //~ ERROR cannot find type `Foo` in this scope } diff --git a/src/test/ui/issues/issue-35075.stderr b/src/test/ui/issues/issue-35075.stderr index 9b2f17f038b..5372996d1cb 100644 --- a/src/test/ui/issues/issue-35075.stderr +++ b/src/test/ui/issues/issue-35075.stderr @@ -1,20 +1,22 @@ error[E0412]: cannot find type `Foo` in this scope - --> $DIR/issue-35075.rs:12:12 + --> $DIR/issue-35075.rs:2:12 | LL | inner: Foo //~ ERROR cannot find type `Foo` in this scope - | ^^^--- - | | - | not found in this scope - | help: you can try using the variant's enum: `Baz` + | ^^^ not found in this scope +help: there is an enum variant `Baz::Foo`; try using the variant's enum + | +LL | inner: Baz //~ ERROR cannot find type `Foo` in this scope + | ^^^ error[E0412]: cannot find type `Foo` in this scope - --> $DIR/issue-35075.rs:16:9 + --> $DIR/issue-35075.rs:6:9 | LL | Foo(Foo) //~ ERROR cannot find type `Foo` in this scope - | ^^^--- - | | - | not found in this scope - | help: you can try using the variant's enum: `Baz` + | ^^^ not found in this scope +help: there is an enum variant `Baz::Foo`; try using the variant's enum + | +LL | Foo(Baz) //~ ERROR cannot find type `Foo` in this scope + | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-35139.rs b/src/test/ui/issues/issue-35139.rs index 67f0e7aaf97..1ee00fc7ec2 100644 --- a/src/test/ui/issues/issue-35139.rs +++ b/src/test/ui/issues/issue-35139.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; pub trait MethodType { diff --git a/src/test/ui/issues/issue-35139.stderr b/src/test/ui/issues/issue-35139.stderr index 7ec1459dd16..1e3d24fa514 100644 --- a/src/test/ui/issues/issue-35139.stderr +++ b/src/test/ui/issues/issue-35139.stderr @@ -1,5 +1,5 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates - --> $DIR/issue-35139.rs:19:6 + --> $DIR/issue-35139.rs:9:6 | LL | impl<'a> MethodType for MTFn { //~ ERROR E0207 | ^^ unconstrained lifetime parameter diff --git a/src/test/ui/issues/issue-3521-2.rs b/src/test/ui/issues/issue-3521-2.rs index 1742cb4fb72..39f7fcb8337 100644 --- a/src/test/ui/issues/issue-3521-2.rs +++ b/src/test/ui/issues/issue-3521-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let foo = 100; diff --git a/src/test/ui/issues/issue-3521-2.stderr b/src/test/ui/issues/issue-3521-2.stderr index 07c37fadbba..1464fd74bba 100644 --- a/src/test/ui/issues/issue-3521-2.stderr +++ b/src/test/ui/issues/issue-3521-2.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/issue-3521-2.rs:14:23 + --> $DIR/issue-3521-2.rs:4:23 | LL | static y: isize = foo + 1; | ^^^ diff --git a/src/test/ui/issues/issue-3521.rs b/src/test/ui/issues/issue-3521.rs index 78af11a0b58..9e72dd29a40 100644 --- a/src/test/ui/issues/issue-3521.rs +++ b/src/test/ui/issues/issue-3521.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let foo = 100; diff --git a/src/test/ui/issues/issue-3521.stderr b/src/test/ui/issues/issue-3521.stderr index f4a1ef5cefa..ae199875269 100644 --- a/src/test/ui/issues/issue-3521.stderr +++ b/src/test/ui/issues/issue-3521.stderr @@ -1,5 +1,5 @@ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/issue-3521.rs:16:15 + --> $DIR/issue-3521.rs:6:15 | LL | Bar = foo | ^^^ non-constant value diff --git a/src/test/ui/issues/issue-35241.rs b/src/test/ui/issues/issue-35241.rs index 4616f25bdfb..2fa762475da 100644 --- a/src/test/ui/issues/issue-35241.rs +++ b/src/test/ui/issues/issue-35241.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo(u32); fn test() -> Foo { Foo } //~ ERROR mismatched types diff --git a/src/test/ui/issues/issue-35241.stderr b/src/test/ui/issues/issue-35241.stderr index 4404f88de31..022bc7baa34 100644 --- a/src/test/ui/issues/issue-35241.stderr +++ b/src/test/ui/issues/issue-35241.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-35241.rs:13:20 + --> $DIR/issue-35241.rs:3:20 | LL | fn test() -> Foo { Foo } //~ ERROR mismatched types | --- ^^^ diff --git a/src/test/ui/issues/issue-35376.rs b/src/test/ui/issues/issue-35376.rs index 0265a5845f9..2a80c9f05d8 100644 --- a/src/test/ui/issues/issue-35376.rs +++ b/src/test/ui/issues/issue-35376.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(specialization)] diff --git a/src/test/ui/issues/issue-35450.rs b/src/test/ui/issues/issue-35450.rs index 5f54f269c6c..ac4c16306cd 100644 --- a/src/test/ui/issues/issue-35450.rs +++ b/src/test/ui/issues/issue-35450.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! m { ($($t:tt)*) => { $($t)* } } fn main() { diff --git a/src/test/ui/issues/issue-35450.stderr b/src/test/ui/issues/issue-35450.stderr index b8fc7d2054c..7edee5c41e6 100644 --- a/src/test/ui/issues/issue-35450.stderr +++ b/src/test/ui/issues/issue-35450.stderr @@ -1,5 +1,5 @@ error: expected expression, found `$` - --> $DIR/issue-35450.rs:14:8 + --> $DIR/issue-35450.rs:4:8 | LL | m!($t); //~ ERROR expected expression | ^ expected expression diff --git a/src/test/ui/issues/issue-35546.rs b/src/test/ui/issues/issue-35546.rs index 79680565ee1..19c0491e4bc 100644 --- a/src/test/ui/issues/issue-35546.rs +++ b/src/test/ui/issues/issue-35546.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Regression test for #35546. Check that we are able to codegen diff --git a/src/test/ui/issues/issue-35570.rs b/src/test/ui/issues/issue-35570.rs index 57ca2c73d8e..e809b46bcdc 100644 --- a/src/test/ui/issues/issue-35570.rs +++ b/src/test/ui/issues/issue-35570.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen diff --git a/src/test/ui/issues/issue-3563-2.rs b/src/test/ui/issues/issue-3563-2.rs index 916adc83223..48f7c845d5e 100644 --- a/src/test/ui/issues/issue-3563-2.rs +++ b/src/test/ui/issues/issue-3563-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-35668.rs b/src/test/ui/issues/issue-35668.rs index 17fd77b6df3..1b8ada57ed6 100644 --- a/src/test/ui/issues/issue-35668.rs +++ b/src/test/ui/issues/issue-35668.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn func<'a, T>(a: &'a [T]) -> impl Iterator { a.iter().map(|a| a*a) //~^ ERROR binary operation `*` cannot be applied to type `&T` diff --git a/src/test/ui/issues/issue-35668.stderr b/src/test/ui/issues/issue-35668.stderr index 51d6b040240..08ce2faff10 100644 --- a/src/test/ui/issues/issue-35668.stderr +++ b/src/test/ui/issues/issue-35668.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `*` cannot be applied to type `&T` - --> $DIR/issue-35668.rs:12:22 + --> $DIR/issue-35668.rs:2:22 | LL | a.iter().map(|a| a*a) | ^^^ diff --git a/src/test/ui/issues/issue-35675.rs b/src/test/ui/issues/issue-35675.rs index f3495468151..fae5cdc0733 100644 --- a/src/test/ui/issues/issue-35675.rs +++ b/src/test/ui/issues/issue-35675.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // these two HELPs are actually in a new line between this line and the `enum Fruit` line enum Fruit { Apple(i64), diff --git a/src/test/ui/issues/issue-35675.stderr b/src/test/ui/issues/issue-35675.stderr index fef8de3a28d..3e4fd5593ca 100644 --- a/src/test/ui/issues/issue-35675.stderr +++ b/src/test/ui/issues/issue-35675.stderr @@ -1,14 +1,15 @@ error[E0412]: cannot find type `Apple` in this scope - --> $DIR/issue-35675.rs:17:29 + --> $DIR/issue-35675.rs:7:29 | LL | fn should_return_fruit() -> Apple { + | ^^^^^ not found in this scope +help: there is an enum variant `Fruit::Apple`; try using the variant's enum + | +LL | fn should_return_fruit() -> Fruit { | ^^^^^ - | | - | not found in this scope - | help: you can try using the variant's enum: `Fruit` error[E0425]: cannot find function `Apple` in this scope - --> $DIR/issue-35675.rs:19:5 + --> $DIR/issue-35675.rs:9:5 | LL | Apple(5) | ^^^^^ not found in this scope @@ -18,16 +19,16 @@ LL | use Fruit::Apple; | error[E0573]: expected type, found variant `Fruit::Apple` - --> $DIR/issue-35675.rs:23:33 + --> $DIR/issue-35675.rs:13:33 | LL | fn should_return_fruit_too() -> Fruit::Apple { | ^^^^^^^^^^^^ | | | not a type - | help: you can try using the variant's enum: `Fruit` + | help: try using the variant's enum: `Fruit` error[E0425]: cannot find function `Apple` in this scope - --> $DIR/issue-35675.rs:25:5 + --> $DIR/issue-35675.rs:15:5 | LL | Apple(5) | ^^^^^ not found in this scope @@ -37,31 +38,32 @@ LL | use Fruit::Apple; | error[E0573]: expected type, found variant `Ok` - --> $DIR/issue-35675.rs:29:13 + --> $DIR/issue-35675.rs:19:13 | LL | fn foo() -> Ok { - | ^^ not a type - | - = help: there is an enum variant `std::prelude::v1::Ok`, try using `std::prelude::v1`? - = help: there is an enum variant `std::result::Result::Ok`, try using `std::result::Result`? + | ^^ + | | + | not a type + | help: try using the variant's enum: `std::result::Result` error[E0412]: cannot find type `Variant3` in this scope - --> $DIR/issue-35675.rs:34:13 + --> $DIR/issue-35675.rs:24:13 | LL | fn bar() -> Variant3 { - | ^^^^^^^^ - | | - | not found in this scope - | help: you can try using the variant's enum: `x::Enum` + | ^^^^^^^^ not found in this scope +help: there is an enum variant `x::Enum::Variant3`; try using the variant's enum + | +LL | fn bar() -> x::Enum { + | ^^^^^^^ error[E0573]: expected type, found variant `Some` - --> $DIR/issue-35675.rs:38:13 + --> $DIR/issue-35675.rs:28:13 | LL | fn qux() -> Some { - | ^^^^ not a type - | - = help: there is an enum variant `std::prelude::v1::Option::Some`, try using `std::prelude::v1::Option`? - = help: there is an enum variant `std::prelude::v1::Some`, try using `std::prelude::v1`? + | ^^^^ + | | + | not a type + | help: try using the variant's enum: `Option` error: aborting due to 7 previous errors diff --git a/src/test/ui/issues/issue-35677.rs b/src/test/ui/issues/issue-35677.rs new file mode 100644 index 00000000000..71e2125ffd2 --- /dev/null +++ b/src/test/ui/issues/issue-35677.rs @@ -0,0 +1,7 @@ +use std::collections::HashMap; +fn intersect_map(this: &mut HashMap, other: HashMap) -> bool { + this.drain() + //~^ ERROR no method named +} + +fn main() {} diff --git a/src/test/ui/issues/issue-35677.stderr b/src/test/ui/issues/issue-35677.stderr new file mode 100644 index 00000000000..61ddb75b3b5 --- /dev/null +++ b/src/test/ui/issues/issue-35677.stderr @@ -0,0 +1,13 @@ +error[E0599]: no method named `drain` found for type `&mut std::collections::HashMap` in the current scope + --> $DIR/issue-35677.rs:3:10 + | +LL | this.drain() + | ^^^^^ + | + = note: the method `drain` exists but the following trait bounds were not satisfied: + `K : std::cmp::Eq` + `K : std::hash::Hash` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/src/test/ui/issues/issue-35869.rs b/src/test/ui/issues/issue-35869.rs index 7bab22edcf6..b9b4c972e58 100644 --- a/src/test/ui/issues/issue-35869.rs +++ b/src/test/ui/issues/issue-35869.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(_: fn(u8) -> ()); fn bar(_: Option); diff --git a/src/test/ui/issues/issue-35869.stderr b/src/test/ui/issues/issue-35869.stderr index 1930dd5bbcb..4ef840d019f 100644 --- a/src/test/ui/issues/issue-35869.stderr +++ b/src/test/ui/issues/issue-35869.stderr @@ -1,5 +1,5 @@ error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/issue-35869.rs:21:15 + --> $DIR/issue-35869.rs:11:15 | LL | fn foo(_: fn(u8) -> ()); | ------------ type in trait @@ -11,7 +11,7 @@ LL | fn foo(_: fn(u16) -> ()) {} found type `fn(fn(u16))` error[E0053]: method `bar` has an incompatible type for trait - --> $DIR/issue-35869.rs:23:15 + --> $DIR/issue-35869.rs:13:15 | LL | fn bar(_: Option); | ---------- type in trait @@ -23,7 +23,7 @@ LL | fn bar(_: Option) {} found type `fn(std::option::Option)` error[E0053]: method `baz` has an incompatible type for trait - --> $DIR/issue-35869.rs:25:15 + --> $DIR/issue-35869.rs:15:15 | LL | fn baz(_: (u8, u16)); | --------- type in trait @@ -35,7 +35,7 @@ LL | fn baz(_: (u16, u16)) {} found type `fn((u16, u16))` error[E0053]: method `qux` has an incompatible type for trait - --> $DIR/issue-35869.rs:27:17 + --> $DIR/issue-35869.rs:17:17 | LL | fn qux() -> u8; | -- type in trait diff --git a/src/test/ui/issues/issue-35976.rs b/src/test/ui/issues/issue-35976.rs index d45b0c5a041..95c0cc95bb2 100644 --- a/src/test/ui/issues/issue-35976.rs +++ b/src/test/ui/issues/issue-35976.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod private { pub trait Future { fn wait(&self) where Self: Sized; diff --git a/src/test/ui/issues/issue-35976.stderr b/src/test/ui/issues/issue-35976.stderr index f97ba33dfd3..d12198de5e1 100644 --- a/src/test/ui/issues/issue-35976.stderr +++ b/src/test/ui/issues/issue-35976.stderr @@ -1,5 +1,5 @@ error: the `wait` method cannot be invoked on a trait object - --> $DIR/issue-35976.rs:24:9 + --> $DIR/issue-35976.rs:14:9 | LL | arg.wait(); | ^^^^ diff --git a/src/test/ui/issues/issue-35988.rs b/src/test/ui/issues/issue-35988.rs index 5909322ff1f..5cf2f8e5212 100644 --- a/src/test/ui/issues/issue-35988.rs +++ b/src/test/ui/issues/issue-35988.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum E { V([Box]), //~^ ERROR the size for values of type diff --git a/src/test/ui/issues/issue-35988.stderr b/src/test/ui/issues/issue-35988.stderr index 0b9d8469247..825c0de5e53 100644 --- a/src/test/ui/issues/issue-35988.stderr +++ b/src/test/ui/issues/issue-35988.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `[std::boxed::Box]` cannot be known at compilation time - --> $DIR/issue-35988.rs:12:7 + --> $DIR/issue-35988.rs:2:7 | LL | V([Box]), | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[std::boxed::Box]` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3601.rs b/src/test/ui/issues/issue-3601.rs index cc69a76e043..e33359beccd 100644 --- a/src/test/ui/issues/issue-3601.rs +++ b/src/test/ui/issues/issue-3601.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/ui/issues/issue-3601.stderr b/src/test/ui/issues/issue-3601.stderr index 6c28ccb2ee8..0b5242ee528 100644 --- a/src/test/ui/issues/issue-3601.stderr +++ b/src/test/ui/issues/issue-3601.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `_` not covered - --> $DIR/issue-3601.rs:40:44 + --> $DIR/issue-3601.rs:30:44 | LL | box NodeKind::Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns | ^^^^^^^ pattern `_` not covered diff --git a/src/test/ui/issues/issue-36075.rs b/src/test/ui/issues/issue-36075.rs index fdc10ae936b..c9ca2f71341 100644 --- a/src/test/ui/issues/issue-36075.rs +++ b/src/test/ui/issues/issue-36075.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] trait DeclarationParser { diff --git a/src/test/ui/issues/issue-36082.ast.nll.stderr b/src/test/ui/issues/issue-36082.ast.nll.stderr index 7fa7cee0aec..6b3b13aa291 100644 --- a/src/test/ui/issues/issue-36082.ast.nll.stderr +++ b/src/test/ui/issues/issue-36082.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-36082.rs:23:19 + --> $DIR/issue-36082.rs:11:19 | LL | let val: &_ = x.borrow().0; | ^^^^^^^^^^ - temporary value is freed at the end of this statement diff --git a/src/test/ui/issues/issue-36082.ast.stderr b/src/test/ui/issues/issue-36082.ast.stderr index b79958de5cb..56e50e55ed3 100644 --- a/src/test/ui/issues/issue-36082.ast.stderr +++ b/src/test/ui/issues/issue-36082.ast.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/issue-36082.rs:23:19 + --> $DIR/issue-36082.rs:11:19 | LL | let val: &_ = x.borrow().0; | ^^^^^^^^^^ - temporary value dropped here while still borrowed diff --git a/src/test/ui/issues/issue-36082.mir.stderr b/src/test/ui/issues/issue-36082.mir.stderr index 7fa7cee0aec..6b3b13aa291 100644 --- a/src/test/ui/issues/issue-36082.mir.stderr +++ b/src/test/ui/issues/issue-36082.mir.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-36082.rs:23:19 + --> $DIR/issue-36082.rs:11:19 | LL | let val: &_ = x.borrow().0; | ^^^^^^^^^^ - temporary value is freed at the end of this statement diff --git a/src/test/ui/issues/issue-36082.rs b/src/test/ui/issues/issue-36082.rs index b8a498a4dc8..2658ef0ddaa 100644 --- a/src/test/ui/issues/issue-36082.rs +++ b/src/test/ui/issues/issue-36082.rs @@ -1,18 +1,6 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir -// FIXME(#49821) -- No tip about using a let binding - use std::cell::RefCell; fn main() { diff --git a/src/test/ui/issues/issue-3609.rs b/src/test/ui/issues/issue-3609.rs index 070b2e538d7..c76c183821e 100644 --- a/src/test/ui/issues/issue-3609.rs +++ b/src/test/ui/issues/issue-3609.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_must_use)] #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-36116.rs b/src/test/ui/issues/issue-36116.rs index d16aa1acee0..f4fe96cf75b 100644 --- a/src/test/ui/issues/issue-36116.rs +++ b/src/test/ui/issues/issue-36116.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unnecessary path disambiguator is ok // compile-pass diff --git a/src/test/ui/issues/issue-36116.stderr b/src/test/ui/issues/issue-36116.stderr index 5819ea78e24..e8f9a472b07 100644 --- a/src/test/ui/issues/issue-36116.stderr +++ b/src/test/ui/issues/issue-36116.stderr @@ -1,11 +1,11 @@ warning: unnecessary path disambiguator - --> $DIR/issue-36116.rs:30:50 + --> $DIR/issue-36116.rs:20:50 | LL | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::); //~ WARN unnecessary path disambiguator | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/issue-36116.rs:31:15 + --> $DIR/issue-36116.rs:21:15 | LL | let g: Foo:: = Foo { _a: 42 }; //~ WARN unnecessary path disambiguator | ^^ try removing `::` diff --git a/src/test/ui/issues/issue-36163.rs b/src/test/ui/issues/issue-36163.rs index 4c74d9d9173..340d2c3997c 100644 --- a/src/test/ui/issues/issue-36163.rs +++ b/src/test/ui/issues/issue-36163.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const A: isize = Foo::B as isize; enum Foo { diff --git a/src/test/ui/issues/issue-36163.stderr b/src/test/ui/issues/issue-36163.stderr index 5623437669f..c114e58e4d9 100644 --- a/src/test/ui/issues/issue-36163.stderr +++ b/src/test/ui/issues/issue-36163.stderr @@ -1,17 +1,17 @@ error[E0391]: cycle detected when processing `Foo::B::{{constant}}` - --> $DIR/issue-36163.rs:14:9 + --> $DIR/issue-36163.rs:4:9 | LL | B = A, //~ ERROR E0391 | ^ | note: ...which requires processing `A`... - --> $DIR/issue-36163.rs:11:18 + --> $DIR/issue-36163.rs:1:18 | LL | const A: isize = Foo::B as isize; | ^^^^^^^^^^^^^^^ = note: ...which again requires processing `Foo::B::{{constant}}`, completing the cycle note: cycle used when const-evaluating `Foo::B::{{constant}}` - --> $DIR/issue-36163.rs:14:9 + --> $DIR/issue-36163.rs:4:9 | LL | B = A, //~ ERROR E0391 | ^ diff --git a/src/test/ui/issues/issue-36299.rs b/src/test/ui/issues/issue-36299.rs index 88ac74cb09e..7b68420b71c 100644 --- a/src/test/ui/issues/issue-36299.rs +++ b/src/test/ui/issues/issue-36299.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'a, A> {} //~^ ERROR parameter `'a` is never used //~| ERROR parameter `A` is never used diff --git a/src/test/ui/issues/issue-36299.stderr b/src/test/ui/issues/issue-36299.stderr index faa20253b9b..dce4bd31ca3 100644 --- a/src/test/ui/issues/issue-36299.stderr +++ b/src/test/ui/issues/issue-36299.stderr @@ -1,5 +1,5 @@ error[E0392]: parameter `'a` is never used - --> $DIR/issue-36299.rs:11:12 + --> $DIR/issue-36299.rs:1:12 | LL | struct Foo<'a, A> {} | ^^ unused type parameter @@ -7,7 +7,7 @@ LL | struct Foo<'a, A> {} = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` error[E0392]: parameter `A` is never used - --> $DIR/issue-36299.rs:11:16 + --> $DIR/issue-36299.rs:1:16 | LL | struct Foo<'a, A> {} | ^ unused type parameter diff --git a/src/test/ui/issues/issue-36379.rs b/src/test/ui/issues/issue-36379.rs index e2f8c00dfb9..b2da65131fb 100644 --- a/src/test/ui/issues/issue-36379.rs +++ b/src/test/ui/issues/issue-36379.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen diff --git a/src/test/ui/issues/issue-36400.nll.stderr b/src/test/ui/issues/issue-36400.nll.stderr index e4347f0ece8..e260fab7791 100644 --- a/src/test/ui/issues/issue-36400.nll.stderr +++ b/src/test/ui/issues/issue-36400.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable - --> $DIR/issue-36400.rs:15:7 + --> $DIR/issue-36400.rs:5:7 | LL | let x = Box::new(3); | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/issues/issue-36400.rs b/src/test/ui/issues/issue-36400.rs index fa4361e42aa..5ba9eb2333b 100644 --- a/src/test/ui/issues/issue-36400.rs +++ b/src/test/ui/issues/issue-36400.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f(x: &mut u32) {} fn main() { diff --git a/src/test/ui/issues/issue-36400.stderr b/src/test/ui/issues/issue-36400.stderr index b0aadf3a514..d9394277050 100644 --- a/src/test/ui/issues/issue-36400.stderr +++ b/src/test/ui/issues/issue-36400.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable `Box` content `*x` as mutable - --> $DIR/issue-36400.rs:15:12 + --> $DIR/issue-36400.rs:5:12 | LL | let x = Box::new(3); | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/issues/issue-36617.rs b/src/test/ui/issues/issue-36617.rs index 9f5eeb1a45d..87092689a28 100644 --- a/src/test/ui/issues/issue-36617.rs +++ b/src/test/ui/issues/issue-36617.rs @@ -1,11 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions + +fn main() {} diff --git a/src/test/ui/issues/issue-36617.stderr b/src/test/ui/issues/issue-36617.stderr index efd58235282..7685b84bea7 100644 --- a/src/test/ui/issues/issue-36617.stderr +++ b/src/test/ui/issues/issue-36617.stderr @@ -1,5 +1,5 @@ error: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-36617.rs:11:1 + --> $DIR/issue-36617.rs:1:1 | LL | #![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^ help: try an outer attribute: `#[derive(Copy)]` diff --git a/src/test/ui/issues/issue-36638.rs b/src/test/ui/issues/issue-36638.rs index 5e43536ef3f..1d006fbdee4 100644 --- a/src/test/ui/issues/issue-36638.rs +++ b/src/test/ui/issues/issue-36638.rs @@ -1,17 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z continue-parse-after-error struct Foo(Self); //~^ ERROR expected identifier, found keyword `Self` +//~^^ ERROR E0392 trait Bar {} //~^ ERROR expected identifier, found keyword `Self` diff --git a/src/test/ui/issues/issue-36638.stderr b/src/test/ui/issues/issue-36638.stderr index d111fb469bf..17134309014 100644 --- a/src/test/ui/issues/issue-36638.stderr +++ b/src/test/ui/issues/issue-36638.stderr @@ -1,14 +1,23 @@ error: expected identifier, found keyword `Self` - --> $DIR/issue-36638.rs:13:12 + --> $DIR/issue-36638.rs:3:12 | LL | struct Foo(Self); | ^^^^ expected identifier, found keyword error: expected identifier, found keyword `Self` - --> $DIR/issue-36638.rs:16:11 + --> $DIR/issue-36638.rs:7:11 | LL | trait Bar {} | ^^^^ expected identifier, found keyword -error: aborting due to 2 previous errors +error[E0392]: parameter `Self` is never used + --> $DIR/issue-36638.rs:3:12 + | +LL | struct Foo(Self); + | ^^^^ unused type parameter + | + = help: consider removing `Self` or using a marker such as `std::marker::PhantomData` + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0392`. diff --git a/src/test/ui/issues/issue-3668-2.rs b/src/test/ui/issues/issue-3668-2.rs index fe46877e8d3..265a884ded7 100644 --- a/src/test/ui/issues/issue-3668-2.rs +++ b/src/test/ui/issues/issue-3668-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f(x:isize) { static child: isize = x + 1; //~^ ERROR can't capture dynamic environment diff --git a/src/test/ui/issues/issue-3668-2.stderr b/src/test/ui/issues/issue-3668-2.stderr index e78a2791907..8dd6f49d8de 100644 --- a/src/test/ui/issues/issue-3668-2.stderr +++ b/src/test/ui/issues/issue-3668-2.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/issue-3668-2.rs:12:27 + --> $DIR/issue-3668-2.rs:2:27 | LL | static child: isize = x + 1; | ^ diff --git a/src/test/ui/issues/issue-3668.rs b/src/test/ui/issues/issue-3668.rs index 00f64414a9e..3f61b1b02e7 100644 --- a/src/test/ui/issues/issue-3668.rs +++ b/src/test/ui/issues/issue-3668.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct P { child: Option> } trait PTrait { fn getChildOption(&self) -> Option>; diff --git a/src/test/ui/issues/issue-3668.stderr b/src/test/ui/issues/issue-3668.stderr index 73eaf57c955..7f974de9da8 100644 --- a/src/test/ui/issues/issue-3668.stderr +++ b/src/test/ui/issues/issue-3668.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/issue-3668.rs:18:34 + --> $DIR/issue-3668.rs:8:34 | LL | static childVal: Box

= self.child.get(); | ^^^^ diff --git a/src/test/ui/issues/issue-36708.rs b/src/test/ui/issues/issue-36708.rs index 92a724a7e96..c9d9f2a6d50 100644 --- a/src/test/ui/issues/issue-36708.rs +++ b/src/test/ui/issues/issue-36708.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-36708.rs extern crate issue_36708 as lib; diff --git a/src/test/ui/issues/issue-36708.stderr b/src/test/ui/issues/issue-36708.stderr index 4e28a769f50..835094c4fdc 100644 --- a/src/test/ui/issues/issue-36708.stderr +++ b/src/test/ui/issues/issue-36708.stderr @@ -1,5 +1,5 @@ error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters - --> $DIR/issue-36708.rs:18:11 + --> $DIR/issue-36708.rs:8:11 | LL | fn foo() {} | ^^^ found 1 type parameter, expected 0 diff --git a/src/test/ui/issues/issue-36744-without-calls.rs b/src/test/ui/issues/issue-36744-without-calls.rs index 8a47ebbd0a8..57d63e67f3c 100644 --- a/src/test/ui/issues/issue-36744-without-calls.rs +++ b/src/test/ui/issues/issue-36744-without-calls.rs @@ -1,17 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // Tests for an LLVM abort when storing a lifetime-parametric fn into // context that is expecting one that is not lifetime-parametric -// (i.e. has no `for <'_>`). +// (i.e., has no `for <'_>`). pub struct A<'a>(&'a ()); pub struct S(T); diff --git a/src/test/ui/issues/issue-3680.rs b/src/test/ui/issues/issue-3680.rs index e698e6da529..3604203082d 100644 --- a/src/test/ui/issues/issue-3680.rs +++ b/src/test/ui/issues/issue-3680.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match None { Err(_) => () diff --git a/src/test/ui/issues/issue-3680.stderr b/src/test/ui/issues/issue-3680.stderr index 4fea4789dbd..51903cfadab 100644 --- a/src/test/ui/issues/issue-3680.stderr +++ b/src/test/ui/issues/issue-3680.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types - --> $DIR/issue-3680.rs:13:9 + --> $DIR/issue-3680.rs:3:9 | +LL | match None { + | ---- this match expression has type `std::option::Option<_>` LL | Err(_) => () | ^^^^^^ expected enum `std::option::Option`, found enum `std::result::Result` | diff --git a/src/test/ui/issues/issue-36839.rs b/src/test/ui/issues/issue-36839.rs index 9396b7ad1b1..0944d07896e 100644 --- a/src/test/ui/issues/issue-36839.rs +++ b/src/test/ui/issues/issue-36839.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen diff --git a/src/test/ui/issues/issue-36881.rs b/src/test/ui/issues/issue-36881.rs index 0f5aa24926b..2b0508d08ea 100644 --- a/src/test/ui/issues/issue-36881.rs +++ b/src/test/ui/issues/issue-36881.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-36881-aux.rs fn main() { diff --git a/src/test/ui/issues/issue-36881.stderr b/src/test/ui/issues/issue-36881.stderr index 27effe9e342..b08b229384d 100644 --- a/src/test/ui/issues/issue-36881.stderr +++ b/src/test/ui/issues/issue-36881.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `issue_36881_aux` - --> $DIR/issue-36881.rs:16:9 + --> $DIR/issue-36881.rs:6:9 | LL | use issue_36881_aux::Foo; //~ ERROR unresolved import | ^^^^^^^^^^^^^^^ maybe a missing `extern crate issue_36881_aux;`? diff --git a/src/test/ui/issues/issue-3702-2.rs b/src/test/ui/issues/issue-3702-2.rs index 325f05841f4..c3a92a23cef 100644 --- a/src/test/ui/issues/issue-3702-2.rs +++ b/src/test/ui/issues/issue-3702-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait ToPrimitive { fn to_int(&self) -> isize { 0 } } diff --git a/src/test/ui/issues/issue-3702-2.stderr b/src/test/ui/issues/issue-3702-2.stderr index 9ec400db47f..11d24b38061 100644 --- a/src/test/ui/issues/issue-3702-2.stderr +++ b/src/test/ui/issues/issue-3702-2.stderr @@ -1,16 +1,16 @@ error[E0034]: multiple applicable items in scope - --> $DIR/issue-3702-2.rs:26:14 + --> $DIR/issue-3702-2.rs:16:14 | LL | self.to_int() + other.to_int() //~ ERROR multiple applicable items in scope | ^^^^^^ multiple `to_int` found | note: candidate #1 is defined in an impl of the trait `ToPrimitive` for the type `isize` - --> $DIR/issue-3702-2.rs:12:5 + --> $DIR/issue-3702-2.rs:2:5 | LL | fn to_int(&self) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl of the trait `Add` for the type `isize` - --> $DIR/issue-3702-2.rs:24:5 + --> $DIR/issue-3702-2.rs:14:5 | LL | fn to_int(&self) -> isize { *self } | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-37026.rs b/src/test/ui/issues/issue-37026.rs index 95fd5d1222e..fd678a717d0 100644 --- a/src/test/ui/issues/issue-37026.rs +++ b/src/test/ui/issues/issue-37026.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:empty-struct.rs extern crate empty_struct; diff --git a/src/test/ui/issues/issue-37026.stderr b/src/test/ui/issues/issue-37026.stderr index c53ec5b55ce..39a500cf565 100644 --- a/src/test/ui/issues/issue-37026.stderr +++ b/src/test/ui/issues/issue-37026.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-37026.rs:16:9 + --> $DIR/issue-37026.rs:6:9 | LL | let empty_struct::XEmpty2 = (); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `empty_struct::XEmpty2` @@ -8,7 +8,7 @@ LL | let empty_struct::XEmpty2 = (); //~ ERROR mismatched types found type `empty_struct::XEmpty2` error[E0308]: mismatched types - --> $DIR/issue-37026.rs:17:9 + --> $DIR/issue-37026.rs:7:9 | LL | let empty_struct::XEmpty6(..) = (); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `empty_struct::XEmpty6` diff --git a/src/test/ui/issues/issue-37051.rs b/src/test/ui/issues/issue-37051.rs index adbd0c4b7ab..1ccf5b97801 100644 --- a/src/test/ui/issues/issue-37051.rs +++ b/src/test/ui/issues/issue-37051.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![feature(associated_type_defaults)] diff --git a/src/test/ui/issues/issue-3707.rs b/src/test/ui/issues/issue-3707.rs index ad56b125b08..844a2dc0069 100644 --- a/src/test/ui/issues/issue-3707.rs +++ b/src/test/ui/issues/issue-3707.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Obj { member: usize } diff --git a/src/test/ui/issues/issue-3707.stderr b/src/test/ui/issues/issue-3707.stderr index c6d28fecaf9..436dcbee862 100644 --- a/src/test/ui/issues/issue-3707.stderr +++ b/src/test/ui/issues/issue-3707.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `boom` found for type `&Obj` in the current scope - --> $DIR/issue-3707.rs:20:14 + --> $DIR/issue-3707.rs:10:14 | LL | self.boom(); //~ ERROR no method named `boom` found for type `&Obj` in the current scope | -----^^^^ @@ -9,7 +9,7 @@ LL | self.boom(); //~ ERROR no method named `boom` found for type `&Obj` | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Obj` - --> $DIR/issue-3707.rs:16:5 + --> $DIR/issue-3707.rs:6:5 | LL | pub fn boom() -> bool { | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-37131.rs b/src/test/ui/issues/issue-37131.rs index efb0b249a8a..aa3b6ea86bb 100644 --- a/src/test/ui/issues/issue-37131.rs +++ b/src/test/ui/issues/issue-37131.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that compiling for a target which is not installed will result in a helpful // error message. diff --git a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.rs b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.rs index 1e05bdb0c60..9a8dafe1394 100644 --- a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.rs +++ b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Mirror { type Image; } diff --git a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr index a563c844359..fa1ee227f0b 100644 --- a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr +++ b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr @@ -1,5 +1,5 @@ error: reached the type-length limit while instantiating `<(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&()...` - --> $DIR/issue-37311.rs:23:5 + --> $DIR/issue-37311.rs:13:5 | LL | / fn recurse(&self) { //~ ERROR reached the type-length limit LL | | (self, self).recurse(); diff --git a/src/test/ui/issues/issue-37323.rs b/src/test/ui/issues/issue-37323.rs index 24ed7ce92bf..a7cf0cd1bd5 100644 --- a/src/test/ui/issues/issue-37323.rs +++ b/src/test/ui/issues/issue-37323.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(rustc_attrs)] diff --git a/src/test/ui/issues/issue-37366.rs b/src/test/ui/issues/issue-37366.rs index 3486403f54a..1c27960e9af 100644 --- a/src/test/ui/issues/issue-37366.rs +++ b/src/test/ui/issues/issue-37366.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // compile-pass // skip-codegen diff --git a/src/test/ui/issues/issue-37510.rs b/src/test/ui/issues/issue-37510.rs index 44fcc899837..465e6809957 100644 --- a/src/test/ui/issues/issue-37510.rs +++ b/src/test/ui/issues/issue-37510.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen diff --git a/src/test/ui/issues/issue-37515.rs b/src/test/ui/issues/issue-37515.rs index 9ceefaf57b7..090b9bbf1ec 100644 --- a/src/test/ui/issues/issue-37515.rs +++ b/src/test/ui/issues/issue-37515.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // skip-codegen // compile-pass #![warn(unused)] diff --git a/src/test/ui/issues/issue-37515.stderr b/src/test/ui/issues/issue-37515.stderr index 3a6e35bb12e..1b496559484 100644 --- a/src/test/ui/issues/issue-37515.stderr +++ b/src/test/ui/issues/issue-37515.stderr @@ -1,11 +1,11 @@ warning: type alias is never used: `Z` - --> $DIR/issue-37515.rs:14:1 + --> $DIR/issue-37515.rs:5:1 | LL | type Z = for<'x> Send; | ^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-37515.rs:12:9 + --> $DIR/issue-37515.rs:3:9 | LL | #![warn(unused)] | ^^^^^^ diff --git a/src/test/ui/issues/issue-37534.rs b/src/test/ui/issues/issue-37534.rs index 70c8f92de63..9386b4516a3 100644 --- a/src/test/ui/issues/issue-37534.rs +++ b/src/test/ui/issues/issue-37534.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { } //~^ ERROR cannot find trait `Hash` in this scope //~^^ ERROR parameter `T` is never used diff --git a/src/test/ui/issues/issue-37534.stderr b/src/test/ui/issues/issue-37534.stderr index c4fc9db31f5..fe143540b73 100644 --- a/src/test/ui/issues/issue-37534.stderr +++ b/src/test/ui/issues/issue-37534.stderr @@ -1,5 +1,5 @@ error[E0405]: cannot find trait `Hash` in this scope - --> $DIR/issue-37534.rs:11:16 + --> $DIR/issue-37534.rs:1:16 | LL | struct Foo { } | ^^^^ not found in this scope @@ -9,13 +9,13 @@ LL | use std::hash::Hash; | warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default. Only `?Sized` is supported - --> $DIR/issue-37534.rs:11:12 + --> $DIR/issue-37534.rs:1:12 | LL | struct Foo { } | ^ error[E0392]: parameter `T` is never used - --> $DIR/issue-37534.rs:11:12 + --> $DIR/issue-37534.rs:1:12 | LL | struct Foo { } | ^ unused type parameter diff --git a/src/test/ui/issues/issue-37550.rs b/src/test/ui/issues/issue-37550.rs index af1f6ef5ed4..505c030b967 100644 --- a/src/test/ui/issues/issue-37550.rs +++ b/src/test/ui/issues/issue-37550.rs @@ -1,22 +1,6 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(const_fn)] - const fn x() { let t = true; - //~^ ERROR let bindings in constant functions are unstable - //~| ERROR statements in constant functions are unstable - let x = || t; - //~^ ERROR let bindings in constant functions are unstable - //~| ERROR statements in constant functions are unstable + let x = || t; //~ ERROR function pointers in const fn are unstable } fn main() {} diff --git a/src/test/ui/issues/issue-37550.stderr b/src/test/ui/issues/issue-37550.stderr index 7468510de6a..d2b03416cb7 100644 --- a/src/test/ui/issues/issue-37550.stderr +++ b/src/test/ui/issues/issue-37550.stderr @@ -1,35 +1,8 @@ -error[E0658]: let bindings in constant functions are unstable (see issue #48821) - --> $DIR/issue-37550.rs:14:13 +error: function pointers in const fn are unstable + --> $DIR/issue-37550.rs:3:9 | -LL | let t = true; - | ^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constant functions are unstable (see issue #48821) - --> $DIR/issue-37550.rs:14:13 - | -LL | let t = true; - | ^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: let bindings in constant functions are unstable (see issue #48821) - --> $DIR/issue-37550.rs:17:13 - | -LL | let x = || t; - | ^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable - -error[E0658]: statements in constant functions are unstable (see issue #48821) - --> $DIR/issue-37550.rs:17:13 - | -LL | let x = || t; - | ^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable +LL | let x = || t; //~ ERROR function pointers in const fn are unstable + | ^ -error: aborting due to 4 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issues/issue-37576.rs b/src/test/ui/issues/issue-37576.rs index e3c1ada878d..e7f933ab22e 100644 --- a/src/test/ui/issues/issue-37576.rs +++ b/src/test/ui/issues/issue-37576.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { 'test_1: while break 'test_1 {} while break {} diff --git a/src/test/ui/issues/issue-37576.stderr b/src/test/ui/issues/issue-37576.stderr index b663c8b8a28..d19e1f45393 100644 --- a/src/test/ui/issues/issue-37576.stderr +++ b/src/test/ui/issues/issue-37576.stderr @@ -1,47 +1,47 @@ error[E0590]: `break` or `continue` with no label in the condition of a `while` loop - --> $DIR/issue-37576.rs:13:11 + --> $DIR/issue-37576.rs:3:11 | LL | while break {} | ^^^^^ unlabeled `break` in the condition of a `while` loop error[E0590]: `break` or `continue` with no label in the condition of a `while` loop - --> $DIR/issue-37576.rs:17:22 + --> $DIR/issue-37576.rs:7:22 | LL | while let true = break {} | ^^^^^ unlabeled `break` in the condition of a `while` loop error[E0590]: `break` or `continue` with no label in the condition of a `while` loop - --> $DIR/issue-37576.rs:21:18 + --> $DIR/issue-37576.rs:11:18 | LL | loop { while break {} } | ^^^^^ unlabeled `break` in the condition of a `while` loop error[E0590]: `break` or `continue` with no label in the condition of a `while` loop - --> $DIR/issue-37576.rs:29:15 + --> $DIR/issue-37576.rs:19:15 | LL | while break {} | ^^^^^ unlabeled `break` in the condition of a `while` loop error[E0590]: `break` or `continue` with no label in the condition of a `while` loop - --> $DIR/issue-37576.rs:35:11 + --> $DIR/issue-37576.rs:25:11 | LL | while continue {} | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop error[E0590]: `break` or `continue` with no label in the condition of a `while` loop - --> $DIR/issue-37576.rs:39:22 + --> $DIR/issue-37576.rs:29:22 | LL | while let true = continue {} | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop error[E0590]: `break` or `continue` with no label in the condition of a `while` loop - --> $DIR/issue-37576.rs:43:18 + --> $DIR/issue-37576.rs:33:18 | LL | loop { while continue {} } | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop error[E0590]: `break` or `continue` with no label in the condition of a `while` loop - --> $DIR/issue-37576.rs:51:15 + --> $DIR/issue-37576.rs:41:15 | LL | while continue {} | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop diff --git a/src/test/ui/issues/issue-37598.rs b/src/test/ui/issues/issue-37598.rs index 9956301dcc9..209f797b15c 100644 --- a/src/test/ui/issues/issue-37598.rs +++ b/src/test/ui/issues/issue-37598.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![feature(slice_patterns)] diff --git a/src/test/ui/issues/issue-3763.rs b/src/test/ui/issues/issue-3763.rs index 851f5dfeabe..5d17a30ab36 100644 --- a/src/test/ui/issues/issue-3763.rs +++ b/src/test/ui/issues/issue-3763.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod my_mod { pub struct MyStruct { priv_field: isize diff --git a/src/test/ui/issues/issue-3763.stderr b/src/test/ui/issues/issue-3763.stderr index 0dd7d6819e8..f37b923d5dc 100644 --- a/src/test/ui/issues/issue-3763.stderr +++ b/src/test/ui/issues/issue-3763.stderr @@ -1,29 +1,29 @@ error[E0616]: field `priv_field` of struct `my_mod::MyStruct` is private - --> $DIR/issue-3763.rs:25:19 + --> $DIR/issue-3763.rs:15:19 | LL | let _woohoo = (&my_struct).priv_field; | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0616]: field `priv_field` of struct `my_mod::MyStruct` is private - --> $DIR/issue-3763.rs:28:19 + --> $DIR/issue-3763.rs:18:19 | LL | let _woohoo = (Box::new(my_struct)).priv_field; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0624]: method `happyfun` is private - --> $DIR/issue-3763.rs:31:18 + --> $DIR/issue-3763.rs:21:18 | LL | (&my_struct).happyfun(); //~ ERROR method `happyfun` is private | ^^^^^^^^ error[E0624]: method `happyfun` is private - --> $DIR/issue-3763.rs:33:27 + --> $DIR/issue-3763.rs:23:27 | LL | (Box::new(my_struct)).happyfun(); //~ ERROR method `happyfun` is private | ^^^^^^^^ error[E0616]: field `priv_field` of struct `my_mod::MyStruct` is private - --> $DIR/issue-3763.rs:34:16 + --> $DIR/issue-3763.rs:24:16 | LL | let nope = my_struct.priv_field; | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-37655.rs b/src/test/ui/issues/issue-37655.rs index 472b3383727..bfc6406b921 100644 --- a/src/test/ui/issues/issue-37655.rs +++ b/src/test/ui/issues/issue-37655.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // Regression test for #37655. The problem was a false edge created by // coercion that wound up requiring that `'a` (in `split()`) outlive diff --git a/src/test/ui/issues/issue-37665.rs b/src/test/ui/issues/issue-37665.rs index 81ed4375e77..c20782a7eb4 100644 --- a/src/test/ui/issues/issue-37665.rs +++ b/src/test/ui/issues/issue-37665.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z unpretty=mir // ignore-cloudabi no std::path diff --git a/src/test/ui/issues/issue-37665.stderr b/src/test/ui/issues/issue-37665.stderr index cdf9129c002..c3599fab685 100644 --- a/src/test/ui/issues/issue-37665.stderr +++ b/src/test/ui/issues/issue-37665.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/issue-37665.rs:20:17 + --> $DIR/issue-37665.rs:10:17 | LL | let x: () = 0; //~ ERROR: mismatched types - | ^ expected (), found integral variable + | ^ expected (), found integer | = note: expected type `()` found type `{integer}` diff --git a/src/test/ui/issues/issue-37725.rs b/src/test/ui/issues/issue-37725.rs index fa5bb362c9f..a572781f092 100644 --- a/src/test/ui/issues/issue-37725.rs +++ b/src/test/ui/issues/issue-37725.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] trait Foo { diff --git a/src/test/ui/issues/issue-37733.rs b/src/test/ui/issues/issue-37733.rs index 04a4c19785b..2dcb0cd8cee 100644 --- a/src/test/ui/issues/issue-37733.rs +++ b/src/test/ui/issues/issue-37733.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] type A = for<> fn(); diff --git a/src/test/ui/issues/issue-3779.rs b/src/test/ui/issues/issue-3779.rs index 7490960da36..901c1be80ca 100644 --- a/src/test/ui/issues/issue-3779.rs +++ b/src/test/ui/issues/issue-3779.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S { //~^ ERROR E0072 element: Option diff --git a/src/test/ui/issues/issue-3779.stderr b/src/test/ui/issues/issue-3779.stderr index f5e89638f16..3538cb199c3 100644 --- a/src/test/ui/issues/issue-3779.stderr +++ b/src/test/ui/issues/issue-3779.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `S` has infinite size - --> $DIR/issue-3779.rs:11:1 + --> $DIR/issue-3779.rs:1:1 | LL | struct S { | ^^^^^^^^ recursive type has infinite size diff --git a/src/test/ui/issues/issue-37884.rs b/src/test/ui/issues/issue-37884.rs index ea6403a3eef..ee37481b23f 100644 --- a/src/test/ui/issues/issue-37884.rs +++ b/src/test/ui/issues/issue-37884.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct RepeatMut<'a, T>(T, &'a ()); impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { diff --git a/src/test/ui/issues/issue-37884.stderr b/src/test/ui/issues/issue-37884.stderr index f01b623aced..f791c6df72f 100644 --- a/src/test/ui/issues/issue-37884.stderr +++ b/src/test/ui/issues/issue-37884.stderr @@ -1,5 +1,5 @@ error[E0308]: method not compatible with trait - --> $DIR/issue-37884.rs:16:5 + --> $DIR/issue-37884.rs:6:5 | LL | / fn next(&'a mut self) -> Option LL | | //~^ ERROR method not compatible with trait @@ -11,8 +11,8 @@ LL | | } | = note: expected type `fn(&mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` found type `fn(&'a mut RepeatMut<'a, T>) -> std::option::Option<&mut T>` -note: the anonymous lifetime #1 defined on the method body at 16:5... - --> $DIR/issue-37884.rs:16:5 +note: the anonymous lifetime #1 defined on the method body at 6:5... + --> $DIR/issue-37884.rs:6:5 | LL | / fn next(&'a mut self) -> Option LL | | //~^ ERROR method not compatible with trait @@ -21,8 +21,8 @@ LL | | { LL | | Some(&mut self.0) LL | | } | |_____^ -note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 13:6 - --> $DIR/issue-37884.rs:13:6 +note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 3:6 + --> $DIR/issue-37884.rs:3:6 | LL | impl<'a, T: 'a> Iterator for RepeatMut<'a, T> { | ^^ diff --git a/src/test/ui/issues/issue-37887.rs b/src/test/ui/issues/issue-37887.rs index f120bbbfc9f..58f0c6b651a 100644 --- a/src/test/ui/issues/issue-37887.rs +++ b/src/test/ui/issues/issue-37887.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { extern crate libc; //~ ERROR use of unstable use libc::*; //~ ERROR unresolved import diff --git a/src/test/ui/issues/issue-37887.stderr b/src/test/ui/issues/issue-37887.stderr index 48fb6c2e6fa..3b3ce8b39bc 100644 --- a/src/test/ui/issues/issue-37887.stderr +++ b/src/test/ui/issues/issue-37887.stderr @@ -1,16 +1,16 @@ error[E0432]: unresolved import `libc` - --> $DIR/issue-37887.rs:13:9 + --> $DIR/issue-37887.rs:3:9 | LL | use libc::*; //~ ERROR unresolved import | ^^^^ maybe a missing `extern crate libc;`? -error[E0658]: use of unstable library feature 'libc': use `libc` from crates.io (see issue #27783) - --> $DIR/issue-37887.rs:12:5 +error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) + --> $DIR/issue-37887.rs:2:5 | LL | extern crate libc; //~ ERROR use of unstable | ^^^^^^^^^^^^^^^^^^ | - = help: add #![feature(libc)] to the crate attributes to enable + = help: add #![feature(rustc_private)] to the crate attributes to enable error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-38160.rs b/src/test/ui/issues/issue-38160.rs index 30552c03cde..a454211c4df 100644 --- a/src/test/ui/issues/issue-38160.rs +++ b/src/test/ui/issues/issue-38160.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![feature(associated_consts)] diff --git a/src/test/ui/issues/issue-3820.rs b/src/test/ui/issues/issue-3820.rs index 28de76f18da..fbf60ce278d 100644 --- a/src/test/ui/issues/issue-3820.rs +++ b/src/test/ui/issues/issue-3820.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Thing { x: isize } diff --git a/src/test/ui/issues/issue-3820.stderr b/src/test/ui/issues/issue-3820.stderr index cdd14e9da7b..0a36ac7616b 100644 --- a/src/test/ui/issues/issue-3820.stderr +++ b/src/test/ui/issues/issue-3820.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `*` cannot be applied to type `Thing` - --> $DIR/issue-3820.rs:24:13 + --> $DIR/issue-3820.rs:14:13 | LL | let w = u * 3; //~ ERROR binary operation `*` cannot be applied to type `Thing` | ^^^^^ diff --git a/src/test/ui/issues/issue-38293.rs b/src/test/ui/issues/issue-38293.rs index 1867bafa7e3..3b1393600ba 100644 --- a/src/test/ui/issues/issue-38293.rs +++ b/src/test/ui/issues/issue-38293.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `fn foo::bar::{self}` only imports `bar` in the type namespace. mod foo { diff --git a/src/test/ui/issues/issue-38293.stderr b/src/test/ui/issues/issue-38293.stderr index 73f5425cfc0..409670074d9 100644 --- a/src/test/ui/issues/issue-38293.stderr +++ b/src/test/ui/issues/issue-38293.stderr @@ -1,11 +1,11 @@ error[E0432]: unresolved import `foo::f` - --> $DIR/issue-38293.rs:16:14 + --> $DIR/issue-38293.rs:6:14 | LL | use foo::f::{self}; //~ ERROR unresolved import `foo::f` | ^^^^ no `f` in `foo` error[E0423]: expected function, found module `baz` - --> $DIR/issue-38293.rs:25:5 + --> $DIR/issue-38293.rs:15:5 | LL | baz(); //~ ERROR expected function, found module `baz` | ^^^ not a function diff --git a/src/test/ui/issues/issue-38381.rs b/src/test/ui/issues/issue-38381.rs index b0b79c1f49d..135137690e5 100644 --- a/src/test/ui/issues/issue-38381.rs +++ b/src/test/ui/issues/issue-38381.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen diff --git a/src/test/ui/issues/issue-38404.rs b/src/test/ui/issues/issue-38404.rs index a2b0d0a60c0..cddd75e267c 100644 --- a/src/test/ui/issues/issue-38404.rs +++ b/src/test/ui/issues/issue-38404.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait A: std::ops::Add + Sized {} trait B: A {} trait C: A> {} diff --git a/src/test/ui/issues/issue-38404.stderr b/src/test/ui/issues/issue-38404.stderr index ac55be75f5b..06bcf220f18 100644 --- a/src/test/ui/issues/issue-38404.stderr +++ b/src/test/ui/issues/issue-38404.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `B` cannot be made into an object - --> $DIR/issue-38404.rs:13:15 + --> $DIR/issue-38404.rs:3:15 | LL | trait C: A> {} | ^^^^^^^^^^^^^^^^^^ the trait `B` cannot be made into an object diff --git a/src/test/ui/issues/issue-38412.rs b/src/test/ui/issues/issue-38412.rs index b4feadbacf7..a7c818d9bcb 100644 --- a/src/test/ui/issues/issue-38412.rs +++ b/src/test/ui/issues/issue-38412.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let Box(a) = loop { }; //~^ ERROR expected tuple struct/variant, found struct `Box` diff --git a/src/test/ui/issues/issue-38412.stderr b/src/test/ui/issues/issue-38412.stderr index 96851436d6c..c44a0bfc8b0 100644 --- a/src/test/ui/issues/issue-38412.stderr +++ b/src/test/ui/issues/issue-38412.stderr @@ -1,5 +1,5 @@ error[E0532]: expected tuple struct/variant, found struct `Box` - --> $DIR/issue-38412.rs:12:9 + --> $DIR/issue-38412.rs:2:9 | LL | let Box(a) = loop { }; | ^^^ constructor is not visible here due to private fields diff --git a/src/test/ui/issues/issue-38458.rs b/src/test/ui/issues/issue-38458.rs index 56eb5f874cd..665a8fdf8e2 100644 --- a/src/test/ui/issues/issue-38458.rs +++ b/src/test/ui/issues/issue-38458.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const x: () = { return; //~ ERROR return statement outside of function body }; diff --git a/src/test/ui/issues/issue-38458.stderr b/src/test/ui/issues/issue-38458.stderr index d870da63d89..541a36233ca 100644 --- a/src/test/ui/issues/issue-38458.stderr +++ b/src/test/ui/issues/issue-38458.stderr @@ -1,5 +1,5 @@ error[E0572]: return statement outside of function body - --> $DIR/issue-38458.rs:12:5 + --> $DIR/issue-38458.rs:2:5 | LL | return; //~ ERROR return statement outside of function body | ^^^^^^ diff --git a/src/test/ui/issues/issue-38604.rs b/src/test/ui/issues/issue-38604.rs index c1939a7707f..c172595a245 100644 --- a/src/test/ui/issues/issue-38604.rs +++ b/src/test/ui/issues/issue-38604.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Q {} trait Foo where u32: Q { fn foo(&self); diff --git a/src/test/ui/issues/issue-38604.stderr b/src/test/ui/issues/issue-38604.stderr index 78aee9172f5..30b4d2b53ff 100644 --- a/src/test/ui/issues/issue-38604.stderr +++ b/src/test/ui/issues/issue-38604.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/issue-38604.rs:24:13 + --> $DIR/issue-38604.rs:14:13 | LL | let _f: Box = //~ ERROR `Foo` cannot be made into an object | ^^^^^^^^ the trait `Foo` cannot be made into an object @@ -7,7 +7,7 @@ LL | let _f: Box = //~ ERROR `Foo` cannot be made into an object = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/issue-38604.rs:25:9 + --> $DIR/issue-38604.rs:15:9 | LL | Box::new(()); //~ ERROR `Foo` cannot be made into an object | ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object diff --git a/src/test/ui/issues/issue-38715.rs b/src/test/ui/issues/issue-38715.rs index 5c745d1fab3..850ffcdabe4 100644 --- a/src/test/ui/issues/issue-38715.rs +++ b/src/test/ui/issues/issue-38715.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! foo { ($i:ident) => {} } diff --git a/src/test/ui/issues/issue-38715.stderr b/src/test/ui/issues/issue-38715.stderr index 67b27cc83cc..21d96d36e27 100644 --- a/src/test/ui/issues/issue-38715.stderr +++ b/src/test/ui/issues/issue-38715.stderr @@ -1,5 +1,5 @@ error: a macro named `foo` has already been exported - --> $DIR/issue-38715.rs:15:1 + --> $DIR/issue-38715.rs:5:1 | LL | macro_rules! foo { () => {} } //~ ERROR a macro named `foo` has already been exported | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `foo` already exported @@ -8,7 +8,7 @@ LL | macro_rules! foo { () => {} } //~ ERROR a macro named `foo` has already bee = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! = note: for more information, see issue #35896 note: previous macro export is now shadowed - --> $DIR/issue-38715.rs:12:1 + --> $DIR/issue-38715.rs:2:1 | LL | macro_rules! foo { ($i:ident) => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-38727.rs b/src/test/ui/issues/issue-38727.rs index 5774d08473a..d9f32637a90 100644 --- a/src/test/ui/issues/issue-38727.rs +++ b/src/test/ui/issues/issue-38727.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #[repr(u64)] diff --git a/src/test/ui/issues/issue-3874.rs b/src/test/ui/issues/issue-3874.rs index 791a4bb8af0..8a7eaf29539 100644 --- a/src/test/ui/issues/issue-3874.rs +++ b/src/test/ui/issues/issue-3874.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-38821.rs b/src/test/ui/issues/issue-38821.rs index 63de780e109..6753860e9ff 100644 --- a/src/test/ui/issues/issue-38821.rs +++ b/src/test/ui/issues/issue-38821.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Nullable(T); pub trait NotNull {} diff --git a/src/test/ui/issues/issue-38821.stderr b/src/test/ui/issues/issue-38821.stderr index f23f0ae99e9..dbd204ec299 100644 --- a/src/test/ui/issues/issue-38821.stderr +++ b/src/test/ui/issues/issue-38821.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `

::SqlType: NotNull` is not satisfied - --> $DIR/issue-38821.rs:33:17 + --> $DIR/issue-38821.rs:23:17 | LL | #[derive(Debug, Copy, Clone)] | ^^^^ the trait `NotNull` is not implemented for `::SqlType` diff --git a/src/test/ui/issues/issue-38857.rs b/src/test/ui/issues/issue-38857.rs index 5217ddb9acb..81d881c100b 100644 --- a/src/test/ui/issues/issue-38857.rs +++ b/src/test/ui/issues/issue-38857.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() }; //~^ ERROR failed to resolve: could not find `imp` in `sys` [E0433] diff --git a/src/test/ui/issues/issue-38857.stderr b/src/test/ui/issues/issue-38857.stderr index 65026344feb..9385dc56af9 100644 --- a/src/test/ui/issues/issue-38857.stderr +++ b/src/test/ui/issues/issue-38857.stderr @@ -1,11 +1,11 @@ error[E0433]: failed to resolve: could not find `imp` in `sys` - --> $DIR/issue-38857.rs:12:23 + --> $DIR/issue-38857.rs:2:23 | LL | let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() }; | ^^^ could not find `imp` in `sys` error[E0603]: module `sys` is private - --> $DIR/issue-38857.rs:12:18 + --> $DIR/issue-38857.rs:2:18 | LL | let a = std::sys::imp::process::process_common::StdioPipes { ..panic!() }; | ^^^ diff --git a/src/test/ui/issues/issue-38868.rs b/src/test/ui/issues/issue-38868.rs index c7e1da7094f..b0e5c371345 100644 --- a/src/test/ui/issues/issue-38868.rs +++ b/src/test/ui/issues/issue-38868.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct List { head: T, } diff --git a/src/test/ui/issues/issue-38868.stderr b/src/test/ui/issues/issue-38868.stderr index 3a8ffe7d5e9..ae975ca78c1 100644 --- a/src/test/ui/issues/issue-38868.stderr +++ b/src/test/ui/issues/issue-38868.stderr @@ -1,5 +1,5 @@ error[E0366]: Implementations of Drop cannot be specialized - --> $DIR/issue-38868.rs:15:1 + --> $DIR/issue-38868.rs:5:1 | LL | / impl Drop for List { //~ ERROR E0366 LL | | fn drop(&mut self) { @@ -9,7 +9,7 @@ LL | | } | |_^ | note: Use same sequence of generic type and region parameters that is on the struct/enum definition - --> $DIR/issue-38868.rs:11:1 + --> $DIR/issue-38868.rs:1:1 | LL | / pub struct List { LL | | head: T, diff --git a/src/test/ui/issues/issue-38875/auxiliary/issue-38875-b.rs b/src/test/ui/issues/issue-38875/auxiliary/issue-38875-b.rs index dd58735209b..e9f7fefb6fb 100644 --- a/src/test/ui/issues/issue-38875/auxiliary/issue-38875-b.rs +++ b/src/test/ui/issues/issue-38875/auxiliary/issue-38875-b.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub const FOO: usize = *&0; diff --git a/src/test/ui/issues/issue-38875/issue-38875.rs b/src/test/ui/issues/issue-38875/issue-38875.rs index 74db92cb828..df321b8dcbb 100644 --- a/src/test/ui/issues/issue-38875/issue-38875.rs +++ b/src/test/ui/issues/issue-38875/issue-38875.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-38875-b.rs // compile-pass diff --git a/src/test/ui/issues/issue-3888-2.rs b/src/test/ui/issues/issue-3888-2.rs index 79b206799ad..27d05b470be 100644 --- a/src/test/ui/issues/issue-3888-2.rs +++ b/src/test/ui/issues/issue-3888-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-38919.rs b/src/test/ui/issues/issue-38919.rs index e6cee4afd59..60a8793b4e6 100644 --- a/src/test/ui/issues/issue-38919.rs +++ b/src/test/ui/issues/issue-38919.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() { T::Item; //~ ERROR no associated item named `Item` found for type `T` in the current scope } diff --git a/src/test/ui/issues/issue-38919.stderr b/src/test/ui/issues/issue-38919.stderr index b80367d7c6c..8c094364795 100644 --- a/src/test/ui/issues/issue-38919.stderr +++ b/src/test/ui/issues/issue-38919.stderr @@ -1,8 +1,10 @@ error[E0599]: no associated item named `Item` found for type `T` in the current scope - --> $DIR/issue-38919.rs:12:5 + --> $DIR/issue-38919.rs:2:8 | LL | T::Item; //~ ERROR no associated item named `Item` found for type `T` in the current scope - | ^^^^^^^ associated item not found in `T` + | ---^^^^ + | | + | associated item not found in `T` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-38940.rs b/src/test/ui/issues/issue-38940.rs index 7f9b141e02e..1c785949547 100644 --- a/src/test/ui/issues/issue-38940.rs +++ b/src/test/ui/issues/issue-38940.rs @@ -42,5 +42,5 @@ fn main() { let t = Top::new(); let x: &Bottom = &t; //~^ ERROR mismatched types - //~| ERROR reached the recursion limit while auto-dereferencing I + //~| ERROR reached the recursion limit while auto-dereferencing `I` } diff --git a/src/test/ui/issues/issue-38940.stderr b/src/test/ui/issues/issue-38940.stderr index 2d3cfda9a5f..d94a7101c0a 100644 --- a/src/test/ui/issues/issue-38940.stderr +++ b/src/test/ui/issues/issue-38940.stderr @@ -1,4 +1,4 @@ -error[E0055]: reached the recursion limit while auto-dereferencing I +error[E0055]: reached the recursion limit while auto-dereferencing `I` --> $DIR/issue-38940.rs:43:22 | LL | let x: &Bottom = &t; diff --git a/src/test/ui/issues/issue-38954.rs b/src/test/ui/issues/issue-38954.rs index 7f01ed3f820..61df411b1f9 100644 --- a/src/test/ui/issues/issue-38954.rs +++ b/src/test/ui/issues/issue-38954.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn _test(ref _p: str) {} //~^ ERROR the size for values of type diff --git a/src/test/ui/issues/issue-38954.stderr b/src/test/ui/issues/issue-38954.stderr index 9bc937b97c9..a74d6353c31 100644 --- a/src/test/ui/issues/issue-38954.stderr +++ b/src/test/ui/issues/issue-38954.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/issue-38954.rs:11:23 + --> $DIR/issue-38954.rs:1:23 | LL | fn _test(ref _p: str) {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/issues/issue-39089.rs b/src/test/ui/issues/issue-39089.rs index f6acc4b814d..77be9d2c76b 100644 --- a/src/test/ui/issues/issue-39089.rs +++ b/src/test/ui/issues/issue-39089.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] fn f Sized>() {} diff --git a/src/test/ui/issues/issue-39175.rs b/src/test/ui/issues/issue-39175.rs index efe59c31263..25225ca6e7c 100644 --- a/src/test/ui/issues/issue-39175.rs +++ b/src/test/ui/issues/issue-39175.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test ignores some platforms as the particular extension trait used // to demonstrate the issue is only available on unix. This is fine as // the fix to suggested paths is not platform-dependent and will apply on @@ -22,4 +12,5 @@ use std::process::Command; fn main() { Command::new("echo").arg("hello").exec(); +//~^ ERROR no method named `exec` } diff --git a/src/test/ui/issues/issue-39175.stderr b/src/test/ui/issues/issue-39175.stderr index f5611e2e97b..6aee474fe74 100644 --- a/src/test/ui/issues/issue-39175.stderr +++ b/src/test/ui/issues/issue-39175.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `exec` found for type `&mut std::process::Command` in the current scope - --> $DIR/issue-39175.rs:24:39 + --> $DIR/issue-39175.rs:14:39 | LL | Command::new("echo").arg("hello").exec(); | ^^^^ diff --git a/src/test/ui/issues/issue-39211.rs b/src/test/ui/issues/issue-39211.rs index 96ba1c83997..db101ae248c 100644 --- a/src/test/ui/issues/issue-39211.rs +++ b/src/test/ui/issues/issue-39211.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_consts)] trait VecN { diff --git a/src/test/ui/issues/issue-39211.stderr b/src/test/ui/issues/issue-39211.stderr index 6859c6caeb0..b9134445455 100644 --- a/src/test/ui/issues/issue-39211.stderr +++ b/src/test/ui/issues/issue-39211.stderr @@ -1,5 +1,5 @@ error[E0220]: associated type `Row` not found for `M` - --> $DIR/issue-39211.rs:21:17 + --> $DIR/issue-39211.rs:11:17 | LL | let a = [3; M::Row::DIM]; //~ ERROR associated type `Row` not found for `M` | ^^^^^^^^^^^ associated type `Row` not found diff --git a/src/test/ui/issues/issue-39362.rs b/src/test/ui/issues/issue-39362.rs index 9d8abbfc65d..ea3c8f88e0b 100644 --- a/src/test/ui/issues/issue-39362.rs +++ b/src/test/ui/issues/issue-39362.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { Bar { bar: Bar, id: usize } } diff --git a/src/test/ui/issues/issue-39362.stderr b/src/test/ui/issues/issue-39362.stderr index 3e613553dea..06385127e94 100644 --- a/src/test/ui/issues/issue-39362.stderr +++ b/src/test/ui/issues/issue-39362.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered - --> $DIR/issue-39362.rs:20:11 + --> $DIR/issue-39362.rs:10:11 | LL | match f { | ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered diff --git a/src/test/ui/issues/issue-39388.rs b/src/test/ui/issues/issue-39388.rs index 15eef429eab..e5b1cd93614 100644 --- a/src/test/ui/issues/issue-39388.rs +++ b/src/test/ui/issues/issue-39388.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_macros)] macro_rules! assign { diff --git a/src/test/ui/issues/issue-39388.stderr b/src/test/ui/issues/issue-39388.stderr index dc19487f3af..00d6598aeaf 100644 --- a/src/test/ui/issues/issue-39388.stderr +++ b/src/test/ui/issues/issue-39388.stderr @@ -1,5 +1,5 @@ error: expected `*` or `+` - --> $DIR/issue-39388.rs:14:22 + --> $DIR/issue-39388.rs:4:22 | LL | (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected `*` or `+` | ^^^^^^^ diff --git a/src/test/ui/issues/issue-39404.rs b/src/test/ui/issues/issue-39404.rs index 56bfe27a4ff..2229f2c3900 100644 --- a/src/test/ui/issues/issue-39404.rs +++ b/src/test/ui/issues/issue-39404.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] macro_rules! m { ($i) => {} } diff --git a/src/test/ui/issues/issue-39404.stderr b/src/test/ui/issues/issue-39404.stderr index 435a03c2858..bffea49362a 100644 --- a/src/test/ui/issues/issue-39404.stderr +++ b/src/test/ui/issues/issue-39404.stderr @@ -1,5 +1,5 @@ error: missing fragment specifier - --> $DIR/issue-39404.rs:13:19 + --> $DIR/issue-39404.rs:3:19 | LL | macro_rules! m { ($i) => {} } | ^^ diff --git a/src/test/ui/issues/issue-39467.rs b/src/test/ui/issues/issue-39467.rs index 417b3160a4d..077e5cefd52 100644 --- a/src/test/ui/issues/issue-39467.rs +++ b/src/test/ui/issues/issue-39467.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] macro_rules! expr { () => { () } } diff --git a/src/test/ui/issues/issue-39559-2.rs b/src/test/ui/issues/issue-39559-2.rs index f01fd1fd8f1..3a52e4d6216 100644 --- a/src/test/ui/issues/issue-39559-2.rs +++ b/src/test/ui/issues/issue-39559-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Dim { fn dim() -> usize; } diff --git a/src/test/ui/issues/issue-39559-2.stderr b/src/test/ui/issues/issue-39559-2.stderr index 57e9f23e0b3..700dbe36474 100644 --- a/src/test/ui/issues/issue-39559-2.stderr +++ b/src/test/ui/issues/issue-39559-2.stderr @@ -1,23 +1,23 @@ error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue-39559-2.rs:24:24 + --> $DIR/issue-39559-2.rs:14:24 | LL | let array: [usize; Dim3::dim()] | ^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $DIR/issue-39559-2.rs:24:24 + --> $DIR/issue-39559-2.rs:14:24 | LL | let array: [usize; Dim3::dim()] | ^^^^^^^^^^^ calling non-const function `::dim` error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue-39559-2.rs:27:15 + --> $DIR/issue-39559-2.rs:17:15 | LL | = [0; Dim3::dim()]; | ^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $DIR/issue-39559-2.rs:27:15 + --> $DIR/issue-39559-2.rs:17:15 | LL | = [0; Dim3::dim()]; | ^^^^^^^^^^^ calling non-const function `::dim` diff --git a/src/test/ui/issues/issue-39559.rs b/src/test/ui/issues/issue-39559.rs index 2da21fb14bd..5af48ca4c0d 100644 --- a/src/test/ui/issues/issue-39559.rs +++ b/src/test/ui/issues/issue-39559.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Dim { fn dim() -> usize; } diff --git a/src/test/ui/issues/issue-39559.stderr b/src/test/ui/issues/issue-39559.stderr index 2ce6dfdbe44..e851e79faee 100644 --- a/src/test/ui/issues/issue-39559.stderr +++ b/src/test/ui/issues/issue-39559.stderr @@ -1,8 +1,10 @@ error[E0599]: no function or associated item named `dim` found for type `D` in the current scope - --> $DIR/issue-39559.rs:24:18 + --> $DIR/issue-39559.rs:14:21 | LL | entries: [T; D::dim()], - | ^^^^^^ function or associated item not found in `D` + | ---^^^ + | | + | function or associated item not found in `D` | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `dim`, perhaps you need to implement it: diff --git a/src/test/ui/issues/issue-39616.rs b/src/test/ui/issues/issue-39616.rs index 13b4c0896e7..3d8e28e5c2f 100644 --- a/src/test/ui/issues/issue-39616.rs +++ b/src/test/ui/issues/issue-39616.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0` //~| ERROR expected one of `)`, `,`, `->`, `where`, or `{`, found `]` // FIXME(jseyfried): avoid emitting the second error (preexisting) diff --git a/src/test/ui/issues/issue-39616.stderr b/src/test/ui/issues/issue-39616.stderr index eebf47afb54..082c3a6853a 100644 --- a/src/test/ui/issues/issue-39616.stderr +++ b/src/test/ui/issues/issue-39616.stderr @@ -1,11 +1,11 @@ error: expected type, found `0` - --> $DIR/issue-39616.rs:11:12 + --> $DIR/issue-39616.rs:1:12 | LL | fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0` | ^ error: expected one of `)`, `,`, `->`, `where`, or `{`, found `]` - --> $DIR/issue-39616.rs:11:16 + --> $DIR/issue-39616.rs:1:16 | LL | fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0` | ^ expected one of `)`, `,`, `->`, `where`, or `{` here diff --git a/src/test/ui/issues/issue-39687.rs b/src/test/ui/issues/issue-39687.rs index 404465e6a0f..cbb721fbb57 100644 --- a/src/test/ui/issues/issue-39687.rs +++ b/src/test/ui/issues/issue-39687.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(fn_traits)] fn main() { diff --git a/src/test/ui/issues/issue-39687.stderr b/src/test/ui/issues/issue-39687.stderr index 9f8d0910d87..886de1d6faf 100644 --- a/src/test/ui/issues/issue-39687.stderr +++ b/src/test/ui/issues/issue-39687.stderr @@ -1,5 +1,5 @@ error[E0229]: associated type bindings are not allowed here - --> $DIR/issue-39687.rs:14:16 + --> $DIR/issue-39687.rs:4:16 | LL | ::call; | ^^ associated type not allowed here diff --git a/src/test/ui/issues/issue-3973.rs b/src/test/ui/issues/issue-3973.rs index 67a934fccce..4e00915683a 100644 --- a/src/test/ui/issues/issue-3973.rs +++ b/src/test/ui/issues/issue-3973.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Point { x: f64, y: f64, diff --git a/src/test/ui/issues/issue-3973.stderr b/src/test/ui/issues/issue-3973.stderr index 9be07614ec1..8e46d880181 100644 --- a/src/test/ui/issues/issue-3973.stderr +++ b/src/test/ui/issues/issue-3973.stderr @@ -1,5 +1,5 @@ error[E0407]: method `new` is not a member of trait `ToString_` - --> $DIR/issue-3973.rs:21:5 + --> $DIR/issue-3973.rs:11:5 | LL | / fn new(x: f64, y: f64) -> Point { LL | | //~^ ERROR method `new` is not a member of trait `ToString_` @@ -8,13 +8,15 @@ LL | | } | |_____^ not a member of trait `ToString_` error[E0599]: no function or associated item named `new` found for type `Point` in the current scope - --> $DIR/issue-3973.rs:32:13 + --> $DIR/issue-3973.rs:22:20 | LL | struct Point { | ------------ function or associated item `new` not found for this ... LL | let p = Point::new(0.0, 0.0); - | ^^^^^^^^^^ function or associated item not found in `Point` + | -------^^^ + | | + | function or associated item not found in `Point` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3979-2.rs b/src/test/ui/issues/issue-3979-2.rs index adfd5873ea7..eec8c85f276 100644 --- a/src/test/ui/issues/issue-3979-2.rs +++ b/src/test/ui/issues/issue-3979-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-39848.rs b/src/test/ui/issues/issue-39848.rs index d5ca009d310..5d1db7be857 100644 --- a/src/test/ui/issues/issue-39848.rs +++ b/src/test/ui/issues/issue-39848.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! get_opt { ($tgt:expr, $field:ident) => { if $tgt.has_$field() {} diff --git a/src/test/ui/issues/issue-39848.stderr b/src/test/ui/issues/issue-39848.stderr index a5d30b8561a..6eda03c1a08 100644 --- a/src/test/ui/issues/issue-39848.stderr +++ b/src/test/ui/issues/issue-39848.stderr @@ -1,5 +1,5 @@ error: expected `{`, found `foo` - --> $DIR/issue-39848.rs:18:19 + --> $DIR/issue-39848.rs:8:19 | LL | if $tgt.has_$field() {} | -- - help: try placing this code inside a block: `{ foo(); }` diff --git a/src/test/ui/issues/issue-3991.rs b/src/test/ui/issues/issue-3991.rs index 90fa1f8c3e0..bc63aae0b9e 100644 --- a/src/test/ui/issues/issue-3991.rs +++ b/src/test/ui/issues/issue-3991.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-3993.rs b/src/test/ui/issues/issue-3993.rs index fae5eb51272..9dea54ea779 100644 --- a/src/test/ui/issues/issue-3993.rs +++ b/src/test/ui/issues/issue-3993.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use zoo::fly; //~ ERROR: function `fly` is private mod zoo { diff --git a/src/test/ui/issues/issue-3993.stderr b/src/test/ui/issues/issue-3993.stderr index 52f1985c4fb..090bca3a759 100644 --- a/src/test/ui/issues/issue-3993.stderr +++ b/src/test/ui/issues/issue-3993.stderr @@ -1,5 +1,5 @@ error[E0603]: function `fly` is private - --> $DIR/issue-3993.rs:11:10 + --> $DIR/issue-3993.rs:1:10 | LL | use zoo::fly; //~ ERROR: function `fly` is private | ^^^ diff --git a/src/test/ui/issues/issue-39970.rs b/src/test/ui/issues/issue-39970.rs index 65ea1baa4a1..f51e3b522e1 100644 --- a/src/test/ui/issues/issue-39970.rs +++ b/src/test/ui/issues/issue-39970.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Array<'a> { type Element: 'a; } diff --git a/src/test/ui/issues/issue-39970.stderr b/src/test/ui/issues/issue-39970.stderr index 397d7b8e650..e4f15870645 100644 --- a/src/test/ui/issues/issue-39970.stderr +++ b/src/test/ui/issues/issue-39970.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving `for<'a> <() as Array<'a>>::Element == ()` - --> $DIR/issue-39970.rs:29:5 + --> $DIR/issue-39970.rs:19:5 | LL | <() as Visit>::visit(); | ^^^^^^^^^^^^^^^^^^^^ expected &(), found () @@ -8,7 +8,7 @@ LL | <() as Visit>::visit(); found type `()` = note: required because of the requirements on the impl of `Visit` for `()` note: required by `Visit::visit` - --> $DIR/issue-39970.rs:16:5 + --> $DIR/issue-39970.rs:6:5 | LL | fn visit() {} | ^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-39974.rs b/src/test/ui/issues/issue-39974.rs index 6f6b775a2a3..5c89a0dc0be 100644 --- a/src/test/ui/issues/issue-39974.rs +++ b/src/test/ui/issues/issue-39974.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const LENGTH: f64 = 2; struct Thing { diff --git a/src/test/ui/issues/issue-39974.stderr b/src/test/ui/issues/issue-39974.stderr index ddd149ccba8..41bfb6dbb85 100644 --- a/src/test/ui/issues/issue-39974.stderr +++ b/src/test/ui/issues/issue-39974.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-39974.rs:14:19 + --> $DIR/issue-39974.rs:4:19 | LL | f: [[f64; 2]; LENGTH], | ^^^^^^ expected usize, found f64 diff --git a/src/test/ui/issues/issue-39984.rs b/src/test/ui/issues/issue-39984.rs index cd4b32688d3..5018b1c62c7 100644 --- a/src/test/ui/issues/issue-39984.rs +++ b/src/test/ui/issues/issue-39984.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(unreachable_code)] diff --git a/src/test/ui/issues/issue-40000.rs b/src/test/ui/issues/issue-40000.rs index 7daf4bcbaa4..320992c0764 100644 --- a/src/test/ui/issues/issue-40000.rs +++ b/src/test/ui/issues/issue-40000.rs @@ -1,18 +1,7 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let bar: fn(&mut u32) = |_| {}; fn foo(x: Box) {} let bar = Box::new(|x: &i32| {}) as Box; - foo(bar); //~ ERROR mismatched types - //~| expected concrete lifetime, found bound lifetime parameter + foo(bar); //~ ERROR E0308 } diff --git a/src/test/ui/issues/issue-40000.stderr b/src/test/ui/issues/issue-40000.stderr index 26e52a7ecdb..d7966cea52b 100644 --- a/src/test/ui/issues/issue-40000.stderr +++ b/src/test/ui/issues/issue-40000.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/issue-40000.rs:16:9 + --> $DIR/issue-40000.rs:6:9 | -LL | foo(bar); //~ ERROR mismatched types - | ^^^ expected concrete lifetime, found bound lifetime parameter +LL | foo(bar); //~ ERROR E0308 + | ^^^ one type is more general than the other | - = note: expected type `std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r i32) + 'static)>` - found type `std::boxed::Box` + = note: expected type `dyn for<'r> std::ops::Fn(&'r i32)` + found type `dyn std::ops::Fn(&i32)` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40136.rs b/src/test/ui/issues/issue-40136.rs index 77f4466ae54..0849f54374b 100644 --- a/src/test/ui/issues/issue-40136.rs +++ b/src/test/ui/issues/issue-40136.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-4025.rs b/src/test/ui/issues/issue-4025.rs index 470dd1e430f..fc036f3edd8 100644 --- a/src/test/ui/issues/issue-4025.rs +++ b/src/test/ui/issues/issue-4025.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(unused_mut)] diff --git a/src/test/ui/issues/issue-40288-2.rs b/src/test/ui/issues/issue-40288-2.rs index e16a7ecf6b9..032a2e65ff0 100644 --- a/src/test/ui/issues/issue-40288-2.rs +++ b/src/test/ui/issues/issue-40288-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn prove_static(_: &'static T) {} fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { @@ -17,7 +7,7 @@ fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { slice[0] = y; } out[0] - //~^ ERROR 19:5: 19:11: explicit lifetime required in the type of `y` [E0621] + //~^ ERROR explicit lifetime required in the type of `y` [E0621] } struct Struct { @@ -32,7 +22,7 @@ fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { dst.head = y; } out.head - //~^ ERROR 34:5: 34:13: explicit lifetime required in the type of `y` [E0621] + //~^ ERROR explicit lifetime required in the type of `y` [E0621] } fn main() { diff --git a/src/test/ui/issues/issue-40288-2.stderr b/src/test/ui/issues/issue-40288-2.stderr index fd0b4c01636..2c64856b08f 100644 --- a/src/test/ui/issues/issue-40288-2.stderr +++ b/src/test/ui/issues/issue-40288-2.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/issue-40288-2.rs:19:5 + --> $DIR/issue-40288-2.rs:9:5 | LL | fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` @@ -8,7 +8,7 @@ LL | out[0] | ^^^^^^ lifetime `'a` required error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/issue-40288-2.rs:34:5 + --> $DIR/issue-40288-2.rs:24:5 | LL | fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` diff --git a/src/test/ui/issues/issue-40288.nll.stderr b/src/test/ui/issues/issue-40288.nll.stderr index bd4efa10f3d..bb4110948d5 100644 --- a/src/test/ui/issues/issue-40288.nll.stderr +++ b/src/test/ui/issues/issue-40288.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `*refr` because it is borrowed - --> $DIR/issue-40288.rs:26:5 + --> $DIR/issue-40288.rs:16:5 | LL | save_ref(&*refr, &mut out); | ------ borrow of `*refr` occurs here diff --git a/src/test/ui/issues/issue-40288.rs b/src/test/ui/issues/issue-40288.rs index b5418e85bec..60204c11754 100644 --- a/src/test/ui/issues/issue-40288.rs +++ b/src/test/ui/issues/issue-40288.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn save_ref<'a>(refr: &'a i32, to: &mut [&'a i32]) { for val in &mut *to { *val = refr; diff --git a/src/test/ui/issues/issue-40288.stderr b/src/test/ui/issues/issue-40288.stderr index e69c3bc83a6..2ac5964f5da 100644 --- a/src/test/ui/issues/issue-40288.stderr +++ b/src/test/ui/issues/issue-40288.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `*refr` because it is borrowed - --> $DIR/issue-40288.rs:26:5 + --> $DIR/issue-40288.rs:16:5 | LL | save_ref(&*refr, &mut out); | ----- borrow of `*refr` occurs here diff --git a/src/test/ui/issues/issue-40350.rs b/src/test/ui/issues/issue-40350.rs index 0d4ba99c45f..b2cc0047bb8 100644 --- a/src/test/ui/issues/issue-40350.rs +++ b/src/test/ui/issues/issue-40350.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // skip-codegen #![allow(warnings)] diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr index 9020d3778c3..a4847568ba0 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-40402-1.rs:19:13 + --> $DIR/issue-40402-1.rs:9:13 | LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content | ^^^^^^ diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.rs b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.rs index f2de2030bd1..6bb0b6f1cfb 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.rs +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we do not suggest `ref f` here in the `main()` function. struct Foo { pub v: Vec, diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr index 70be30e4f71..87b98bbcedb 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of indexed content - --> $DIR/issue-40402-1.rs:19:13 + --> $DIR/issue-40402-1.rs:9:13 | LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content | ^^^^^^ diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr index a80e9a5fe09..5c23021ee2c 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-40402-2.rs:15:18 + --> $DIR/issue-40402-2.rs:5:18 | LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content | - - ^^^^ @@ -10,7 +10,7 @@ LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content | data moved here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/issue-40402-2.rs:15:10 + --> $DIR/issue-40402-2.rs:5:10 | LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content | ^ ^ diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.rs b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.rs index 894923605c0..0b8f40c5eff 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.rs +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we do suggest `(ref a, ref b)` here, since `a` and `b` // are nested within a pattern fn main() { diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr index 4ed28963b5b..d64cd96e959 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of indexed content - --> $DIR/issue-40402-2.rs:15:18 + --> $DIR/issue-40402-2.rs:5:18 | LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content | - - ^^^^ cannot move out of indexed content diff --git a/src/test/ui/issues/issue-40510-1.nll.stderr b/src/test/ui/issues/issue-40510-1.nll.stderr index 723b6f3111c..44234cbc881 100644 --- a/src/test/ui/issues/issue-40510-1.nll.stderr +++ b/src/test/ui/issues/issue-40510-1.nll.stderr @@ -1,5 +1,5 @@ warning: captured variable cannot escape `FnMut` closure body - --> $DIR/issue-40510-1.rs:18:9 + --> $DIR/issue-40510-1.rs:8:9 | LL | || { | - inferred to be a `FnMut` closure @@ -8,7 +8,6 @@ LL | &mut x | = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future diff --git a/src/test/ui/issues/issue-40510-1.rs b/src/test/ui/issues/issue-40510-1.rs index b053f8e7d80..dd8a6bc5ab2 100644 --- a/src/test/ui/issues/issue-40510-1.rs +++ b/src/test/ui/issues/issue-40510-1.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused)] diff --git a/src/test/ui/issues/issue-40510-2.rs b/src/test/ui/issues/issue-40510-2.rs index 74c855476f2..2304badd17d 100644 --- a/src/test/ui/issues/issue-40510-2.rs +++ b/src/test/ui/issues/issue-40510-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused)] diff --git a/src/test/ui/issues/issue-40510-3.nll.stderr b/src/test/ui/issues/issue-40510-3.nll.stderr index e8e82ee8fda..1297e141898 100644 --- a/src/test/ui/issues/issue-40510-3.nll.stderr +++ b/src/test/ui/issues/issue-40510-3.nll.stderr @@ -1,5 +1,5 @@ warning: captured variable cannot escape `FnMut` closure body - --> $DIR/issue-40510-3.rs:18:9 + --> $DIR/issue-40510-3.rs:8:9 | LL | || { | - inferred to be a `FnMut` closure @@ -10,7 +10,6 @@ LL | | } | = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future diff --git a/src/test/ui/issues/issue-40510-3.rs b/src/test/ui/issues/issue-40510-3.rs index d4d1d28a137..bc95c461d1e 100644 --- a/src/test/ui/issues/issue-40510-3.rs +++ b/src/test/ui/issues/issue-40510-3.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused)] diff --git a/src/test/ui/issues/issue-40510-4.rs b/src/test/ui/issues/issue-40510-4.rs index 6059f2b82c1..45cd4fd94ef 100644 --- a/src/test/ui/issues/issue-40510-4.rs +++ b/src/test/ui/issues/issue-40510-4.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused)] diff --git a/src/test/ui/issues/issue-40610.rs b/src/test/ui/issues/issue-40610.rs index aec20b4ad87..104cf7f54e5 100644 --- a/src/test/ui/issues/issue-40610.rs +++ b/src/test/ui/issues/issue-40610.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f(_: &[f32]) {} fn main() { diff --git a/src/test/ui/issues/issue-40610.stderr b/src/test/ui/issues/issue-40610.stderr index faf1a4d1c38..f441d65b91e 100644 --- a/src/test/ui/issues/issue-40610.stderr +++ b/src/test/ui/issues/issue-40610.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `+` cannot be applied to type `()` - --> $DIR/issue-40610.rs:14:5 + --> $DIR/issue-40610.rs:4:5 | LL | () + f(&[1.0]); | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-40749.rs b/src/test/ui/issues/issue-40749.rs index 261ed49d10c..14908c3653e 100644 --- a/src/test/ui/issues/issue-40749.rs +++ b/src/test/ui/issues/issue-40749.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { [0; ..10]; //~^ ERROR mismatched types diff --git a/src/test/ui/issues/issue-40749.stderr b/src/test/ui/issues/issue-40749.stderr index b76d469d116..be050d4470c 100644 --- a/src/test/ui/issues/issue-40749.stderr +++ b/src/test/ui/issues/issue-40749.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-40749.rs:12:9 + --> $DIR/issue-40749.rs:2:9 | LL | [0; ..10]; | ^^^^ expected usize, found struct `std::ops::RangeTo` diff --git a/src/test/ui/issues/issue-40782.rs b/src/test/ui/issues/issue-40782.rs index 10dc177c7e9..55fec04e0e0 100644 --- a/src/test/ui/issues/issue-40782.rs +++ b/src/test/ui/issues/issue-40782.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { for i 0..2 { //~ ERROR missing `in` } diff --git a/src/test/ui/issues/issue-40782.stderr b/src/test/ui/issues/issue-40782.stderr index bd646d7ce8c..03f051adc6e 100644 --- a/src/test/ui/issues/issue-40782.stderr +++ b/src/test/ui/issues/issue-40782.stderr @@ -1,5 +1,5 @@ error: missing `in` in `for` loop - --> $DIR/issue-40782.rs:12:10 + --> $DIR/issue-40782.rs:2:10 | LL | for i 0..2 { //~ ERROR missing `in` | ^ help: try adding `in` here diff --git a/src/test/ui/issues/issue-40827.rs b/src/test/ui/issues/issue-40827.rs index 4b079ace3ca..6e42c506169 100644 --- a/src/test/ui/issues/issue-40827.rs +++ b/src/test/ui/issues/issue-40827.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::rc::Rc; use std::sync::Arc; diff --git a/src/test/ui/issues/issue-40827.stderr b/src/test/ui/issues/issue-40827.stderr index dd0ebf96d19..96b411bfb1d 100644 --- a/src/test/ui/issues/issue-40827.stderr +++ b/src/test/ui/issues/issue-40827.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::rc::Rc` cannot be sent between threads safely - --> $DIR/issue-40827.rs:24:5 + --> $DIR/issue-40827.rs:14:5 | LL | f(Foo(Arc::new(Bar::B(None)))); | ^ `std::rc::Rc` cannot be sent between threads safely @@ -9,13 +9,13 @@ LL | f(Foo(Arc::new(Bar::B(None)))); = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc` = note: required because it appears within the type `Foo` note: required by `f` - --> $DIR/issue-40827.rs:21:1 + --> $DIR/issue-40827.rs:11:1 | LL | fn f(_: T) {} | ^^^^^^^^^^^^^^^^^^^ error[E0277]: `std::rc::Rc` cannot be shared between threads safely - --> $DIR/issue-40827.rs:24:5 + --> $DIR/issue-40827.rs:14:5 | LL | f(Foo(Arc::new(Bar::B(None)))); | ^ `std::rc::Rc` cannot be shared between threads safely @@ -25,7 +25,7 @@ LL | f(Foo(Arc::new(Bar::B(None)))); = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc` = note: required because it appears within the type `Foo` note: required by `f` - --> $DIR/issue-40827.rs:21:1 + --> $DIR/issue-40827.rs:11:1 | LL | fn f(_: T) {} | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-40845.rs b/src/test/ui/issues/issue-40845.rs index c5604a0427b..c9102f4417c 100644 --- a/src/test/ui/issues/issue-40845.rs +++ b/src/test/ui/issues/issue-40845.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait T { m!(); } //~ ERROR cannot find macro `m!` in this scope struct S; diff --git a/src/test/ui/issues/issue-40845.stderr b/src/test/ui/issues/issue-40845.stderr index 2e8f008a52d..a8d75025279 100644 --- a/src/test/ui/issues/issue-40845.stderr +++ b/src/test/ui/issues/issue-40845.stderr @@ -1,11 +1,11 @@ error: cannot find macro `m!` in this scope - --> $DIR/issue-40845.rs:14:10 + --> $DIR/issue-40845.rs:4:10 | LL | impl S { m!(); } //~ ERROR cannot find macro `m!` in this scope | ^ error: cannot find macro `m!` in this scope - --> $DIR/issue-40845.rs:11:11 + --> $DIR/issue-40845.rs:1:11 | LL | trait T { m!(); } //~ ERROR cannot find macro `m!` in this scope | ^ diff --git a/src/test/ui/issues/issue-40861.rs b/src/test/ui/issues/issue-40861.rs index 75d58c58538..d8a8384a544 100644 --- a/src/test/ui/issues/issue-40861.rs +++ b/src/test/ui/issues/issue-40861.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f(_: &[f32]) {} fn main() { diff --git a/src/test/ui/issues/issue-40861.stderr b/src/test/ui/issues/issue-40861.stderr index dbde40fb25e..84e38b9bb05 100644 --- a/src/test/ui/issues/issue-40861.stderr +++ b/src/test/ui/issues/issue-40861.stderr @@ -1,10 +1,10 @@ error[E0608]: cannot index into a value of type `()` - --> $DIR/issue-40861.rs:14:5 + --> $DIR/issue-40861.rs:4:5 | LL | ()[f(&[1.0])]; | ^^^^^^^^^^^^^ | - = help: to access tuple elements, use tuple indexing syntax (e.g. `tuple.0`) + = help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`) error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40962.rs b/src/test/ui/issues/issue-40962.rs index 8b2a53f4032..50d9276e79a 100644 --- a/src/test/ui/issues/issue-40962.rs +++ b/src/test/ui/issues/issue-40962.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass macro_rules! m { ($i:meta) => { diff --git a/src/test/ui/issues/issue-41139.nll.stderr b/src/test/ui/issues/issue-41139.nll.stderr index 3f79c66252a..4dd017b0a91 100644 --- a/src/test/ui/issues/issue-41139.nll.stderr +++ b/src/test/ui/issues/issue-41139.nll.stderr @@ -1,5 +1,5 @@ error[E0161]: cannot move a value of type dyn Trait: the size of dyn Trait cannot be statically determined - --> $DIR/issue-41139.rs:16:23 + --> $DIR/issue-41139.rs:6:23 | LL | let t : &Trait = &get_function()(); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-41139.rs b/src/test/ui/issues/issue-41139.rs index 0509a4387ba..0bfbea11b0e 100644 --- a/src/test/ui/issues/issue-41139.rs +++ b/src/test/ui/issues/issue-41139.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait {} fn get_function<'a>() -> &'a Fn() -> Trait { panic!("") } diff --git a/src/test/ui/issues/issue-41139.stderr b/src/test/ui/issues/issue-41139.stderr index 9d0e19df3f2..3e3de7b7cf1 100644 --- a/src/test/ui/issues/issue-41139.stderr +++ b/src/test/ui/issues/issue-41139.stderr @@ -1,5 +1,5 @@ error[E0161]: cannot move a value of type (dyn Trait + 'static): the size of (dyn Trait + 'static) cannot be statically determined - --> $DIR/issue-41139.rs:16:23 + --> $DIR/issue-41139.rs:6:23 | LL | let t : &Trait = &get_function()(); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-41229-ref-str.rs b/src/test/ui/issues/issue-41229-ref-str.rs index 5d7546e1bc4..fe5e6cd6ec5 100644 --- a/src/test/ui/issues/issue-41229-ref-str.rs +++ b/src/test/ui/issues/issue-41229-ref-str.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn example(ref s: str) {} //~^ ERROR the size for values of type diff --git a/src/test/ui/issues/issue-41229-ref-str.stderr b/src/test/ui/issues/issue-41229-ref-str.stderr index e4a34fdaf48..bcca911c5a5 100644 --- a/src/test/ui/issues/issue-41229-ref-str.stderr +++ b/src/test/ui/issues/issue-41229-ref-str.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/issue-41229-ref-str.rs:11:28 + --> $DIR/issue-41229-ref-str.rs:1:28 | LL | pub fn example(ref s: str) {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/issues/issue-41255.rs b/src/test/ui/issues/issue-41255.rs index 29912de37eb..395ab8601bc 100644 --- a/src/test/ui/issues/issue-41255.rs +++ b/src/test/ui/issues/issue-41255.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Matching against float literals should result in a linter error #![feature(exclusive_range_pattern)] diff --git a/src/test/ui/issues/issue-41255.stderr b/src/test/ui/issues/issue-41255.stderr index 03100b6db76..05e930de27a 100644 --- a/src/test/ui/issues/issue-41255.stderr +++ b/src/test/ui/issues/issue-41255.stderr @@ -1,11 +1,11 @@ error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:20:9 + --> $DIR/issue-41255.rs:10:9 | LL | 5.0 => {}, //~ ERROR floating-point types cannot be used in patterns | ^^^ | note: lint level defined here - --> $DIR/issue-41255.rs:15:11 + --> $DIR/issue-41255.rs:5:11 | LL | #![forbid(illegal_floating_point_literal_pattern)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | #![forbid(illegal_floating_point_literal_pattern)] = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:22:9 + --> $DIR/issue-41255.rs:12:9 | LL | 5.0f32 => {}, //~ ERROR floating-point types cannot be used in patterns | ^^^^^^ @@ -22,7 +22,7 @@ LL | 5.0f32 => {}, //~ ERROR floating-point types cannot be used in patt = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:24:10 + --> $DIR/issue-41255.rs:14:10 | LL | -5.0 => {}, //~ ERROR floating-point types cannot be used in patterns | ^^^ @@ -31,7 +31,7 @@ LL | -5.0 => {}, //~ ERROR floating-point types cannot be used in patter = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:26:9 + --> $DIR/issue-41255.rs:16:9 | LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in patterns | ^^^ @@ -40,7 +40,7 @@ LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:26:16 + --> $DIR/issue-41255.rs:16:16 | LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in patterns | ^^^^ @@ -49,7 +49,7 @@ LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:30:9 + --> $DIR/issue-41255.rs:20:9 | LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used in patterns | ^^^^ @@ -58,7 +58,7 @@ LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:30:18 + --> $DIR/issue-41255.rs:20:18 | LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used in patterns | ^^^^ @@ -67,7 +67,7 @@ LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:39:10 + --> $DIR/issue-41255.rs:29:10 | LL | (3.14, 1) => {}, //~ ERROR floating-point types cannot be used | ^^^^ @@ -76,7 +76,7 @@ LL | (3.14, 1) => {}, //~ ERROR floating-point types cannot be used = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:46:18 + --> $DIR/issue-41255.rs:36:18 | LL | Foo { x: 2.0 } => {}, //~ ERROR floating-point types cannot be used | ^^^ diff --git a/src/test/ui/issues/issue-41272.rs b/src/test/ui/issues/issue-41272.rs index ff8c234ae5e..4a43e11f47f 100644 --- a/src/test/ui/issues/issue-41272.rs +++ b/src/test/ui/issues/issue-41272.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] struct Foo; diff --git a/src/test/ui/issues/issue-41298.rs b/src/test/ui/issues/issue-41298.rs index 808e6a7f05f..e8eeabaf3a9 100644 --- a/src/test/ui/issues/issue-41298.rs +++ b/src/test/ui/issues/issue-41298.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] struct Function { t: T, f: F } diff --git a/src/test/ui/issues/issue-41394.rs b/src/test/ui/issues/issue-41394.rs index 539b8d2aab3..45318f6efb8 100644 --- a/src/test/ui/issues/issue-41394.rs +++ b/src/test/ui/issues/issue-41394.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { A = "" + 1 //~^ ERROR binary operation `+` cannot be applied to type `&str` diff --git a/src/test/ui/issues/issue-41394.stderr b/src/test/ui/issues/issue-41394.stderr index 4f170f0ce3d..bc5c6e798e8 100644 --- a/src/test/ui/issues/issue-41394.stderr +++ b/src/test/ui/issues/issue-41394.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `+` cannot be applied to type `&str` - --> $DIR/issue-41394.rs:12:9 + --> $DIR/issue-41394.rs:2:9 | LL | A = "" + 1 | ^^^^^^ @@ -7,7 +7,7 @@ LL | A = "" + 1 = note: an implementation of `std::ops::Add` might be missing for `&str` error[E0080]: evaluation of constant value failed - --> $DIR/issue-41394.rs:17:9 + --> $DIR/issue-41394.rs:7:9 | LL | A = Foo::A as isize | ^^^^^^^^^^^^^^^ referenced constant has errors diff --git a/src/test/ui/issues/issue-41549.rs b/src/test/ui/issues/issue-41549.rs index de52fcfe327..d19926a541a 100644 --- a/src/test/ui/issues/issue-41549.rs +++ b/src/test/ui/issues/issue-41549.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-41549.rs diff --git a/src/test/ui/issues/issue-41549.stderr b/src/test/ui/issues/issue-41549.stderr index e5362727d94..b144387ac44 100644 --- a/src/test/ui/issues/issue-41549.stderr +++ b/src/test/ui/issues/issue-41549.stderr @@ -1,5 +1,5 @@ error[E0326]: implemented const `CONST` has an incompatible type for trait - --> $DIR/issue-41549.rs:19:18 + --> $DIR/issue-41549.rs:9:18 | LL | const CONST: () = (); //~ ERROR incompatible type for trait | ^^ expected u32, found () diff --git a/src/test/ui/issues/issue-41628.rs b/src/test/ui/issues/issue-41628.rs index ac626f0ba38..b837a1e2346 100644 --- a/src/test/ui/issues/issue-41628.rs +++ b/src/test/ui/issues/issue-41628.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![deny(dead_code)] diff --git a/src/test/ui/issues/issue-41652/auxiliary/issue-41652-b.rs b/src/test/ui/issues/issue-41652/auxiliary/issue-41652-b.rs index 0b714432f16..2ce21b0366e 100644 --- a/src/test/ui/issues/issue-41652/auxiliary/issue-41652-b.rs +++ b/src/test/ui/issues/issue-41652/auxiliary/issue-41652-b.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Tr { // Note: The function needs to be declared over multiple lines to reproduce // the crash. DO NOT reformat. diff --git a/src/test/ui/issues/issue-41652/issue-41652.rs b/src/test/ui/issues/issue-41652/issue-41652.rs index 4b42c0475eb..d8a6f4c8d9d 100644 --- a/src/test/ui/issues/issue-41652/issue-41652.rs +++ b/src/test/ui/issues/issue-41652/issue-41652.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-41652-b.rs extern crate issue_41652_b; diff --git a/src/test/ui/issues/issue-41652/issue-41652.stderr b/src/test/ui/issues/issue-41652/issue-41652.stderr index ed5eb360298..3c71536de2e 100644 --- a/src/test/ui/issues/issue-41652/issue-41652.stderr +++ b/src/test/ui/issues/issue-41652/issue-41652.stderr @@ -1,5 +1,5 @@ error[E0689]: can't call method `f` on ambiguous numeric type `{integer}` - --> $DIR/issue-41652.rs:19:11 + --> $DIR/issue-41652.rs:9:11 | LL | 3.f() | ^ diff --git a/src/test/ui/issues/issue-41726.nll.stderr b/src/test/ui/issues/issue-41726.nll.stderr index 9f727881bea..087f557a0d4 100644 --- a/src/test/ui/issues/issue-41726.nll.stderr +++ b/src/test/ui/issues/issue-41726.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/issue-41726.rs:15:9 + --> $DIR/issue-41726.rs:5:9 | LL | things[src.as_str()].sort(); //~ ERROR cannot borrow immutable | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/issues/issue-41726.rs b/src/test/ui/issues/issue-41726.rs index c8cd9209bce..41dcaa8e280 100644 --- a/src/test/ui/issues/issue-41726.rs +++ b/src/test/ui/issues/issue-41726.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::HashMap; fn main() { let things: HashMap> = HashMap::new(); diff --git a/src/test/ui/issues/issue-41726.stderr b/src/test/ui/issues/issue-41726.stderr index c79196e0140..e6b92dc9dfe 100644 --- a/src/test/ui/issues/issue-41726.stderr +++ b/src/test/ui/issues/issue-41726.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable indexed content as mutable - --> $DIR/issue-41726.rs:15:9 + --> $DIR/issue-41726.rs:5:9 | LL | things[src.as_str()].sort(); //~ ERROR cannot borrow immutable | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/issues/issue-41742.rs b/src/test/ui/issues/issue-41742.rs index 067531e036a..afe311b4d17 100644 --- a/src/test/ui/issues/issue-41742.rs +++ b/src/test/ui/issues/issue-41742.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::{Index, IndexMut}; struct S; diff --git a/src/test/ui/issues/issue-41742.stderr b/src/test/ui/issues/issue-41742.stderr index 314b44f603a..03a9710f679 100644 --- a/src/test/ui/issues/issue-41742.stderr +++ b/src/test/ui/issues/issue-41742.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-41742.rs:34:7 + --> $DIR/issue-41742.rs:24:7 | LL | H["?"].f(); //~ ERROR mismatched types | ^^^ expected u32, found reference diff --git a/src/test/ui/issues/issue-41776.rs b/src/test/ui/issues/issue-41776.rs index 5f108e0a1ed..24696d86d0f 100644 --- a/src/test/ui/issues/issue-41776.rs +++ b/src/test/ui/issues/issue-41776.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { include!(line!()); //~ ERROR argument must be a string literal } diff --git a/src/test/ui/issues/issue-41776.stderr b/src/test/ui/issues/issue-41776.stderr index 9742f091f04..1806f68f14a 100644 --- a/src/test/ui/issues/issue-41776.stderr +++ b/src/test/ui/issues/issue-41776.stderr @@ -1,5 +1,5 @@ error: argument must be a string literal - --> $DIR/issue-41776.rs:12:14 + --> $DIR/issue-41776.rs:2:14 | LL | include!(line!()); //~ ERROR argument must be a string literal | ^^^^^^^ diff --git a/src/test/ui/issues/issue-41880.rs b/src/test/ui/issues/issue-41880.rs index 23a2b78a769..16facc5a78f 100644 --- a/src/test/ui/issues/issue-41880.rs +++ b/src/test/ui/issues/issue-41880.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn iterate(initial: T, f: F) -> Iterate { Iterate { state: initial, diff --git a/src/test/ui/issues/issue-41880.stderr b/src/test/ui/issues/issue-41880.stderr index fa9fdbd8194..359a2340240 100644 --- a/src/test/ui/issues/issue-41880.stderr +++ b/src/test/ui/issues/issue-41880.stderr @@ -1,5 +1,5 @@ -error[E0599]: no method named `iter` found for type `Iterate<{integer}, [closure@$DIR/issue-41880.rs:36:24: 36:31]>` in the current scope - --> $DIR/issue-41880.rs:37:24 +error[E0599]: no method named `iter` found for type `Iterate<{integer}, [closure@$DIR/issue-41880.rs:26:24: 26:31]>` in the current scope + --> $DIR/issue-41880.rs:27:24 | LL | pub struct Iterate { | ------------------------ method `iter` not found for this diff --git a/src/test/ui/issues/issue-41936-variance-coerce-unsized-cycle.rs b/src/test/ui/issues/issue-41936-variance-coerce-unsized-cycle.rs index 96c9a565233..4dddc484d33 100644 --- a/src/test/ui/issues/issue-41936-variance-coerce-unsized-cycle.rs +++ b/src/test/ui/issues/issue-41936-variance-coerce-unsized-cycle.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Regression test for #41936. The coerce-unsized trait check in diff --git a/src/test/ui/issues/issue-41974.rs b/src/test/ui/issues/issue-41974.rs index 5c9077783c7..7875b432d7b 100644 --- a/src/test/ui/issues/issue-41974.rs +++ b/src/test/ui/issues/issue-41974.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Copy, Clone)] struct Flags; diff --git a/src/test/ui/issues/issue-41974.stderr b/src/test/ui/issues/issue-41974.stderr index eca40ed4355..68712e0f054 100644 --- a/src/test/ui/issues/issue-41974.stderr +++ b/src/test/ui/issues/issue-41974.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `std::boxed::Box<_>`: - --> $DIR/issue-41974.rs:17:1 + --> $DIR/issue-41974.rs:7:1 | LL | impl Drop for T where T: A { //~ ERROR E0119 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -10,13 +10,13 @@ LL | impl Drop for T where T: A { //~ ERROR E0119 = note: downstream crates may implement trait `A` for type `std::boxed::Box<_>` error[E0120]: the Drop trait may only be implemented on structures - --> $DIR/issue-41974.rs:17:18 + --> $DIR/issue-41974.rs:7:18 | LL | impl Drop for T where T: A { //~ ERROR E0119 | ^ implementing Drop requires a struct -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/issue-41974.rs:17:1 +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/issue-41974.rs:7:1 | LL | impl Drop for T where T: A { //~ ERROR E0119 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/issues/issue-41998.rs b/src/test/ui/issues/issue-41998.rs index 57af617c5ff..e54bc201c1d 100644 --- a/src/test/ui/issues/issue-41998.rs +++ b/src/test/ui/issues/issue-41998.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass diff --git a/src/test/ui/issues/issue-4201.rs b/src/test/ui/issues/issue-4201.rs index b1f668d9c5e..2f1d6d2177e 100644 --- a/src/test/ui/issues/issue-4201.rs +++ b/src/test/ui/issues/issue-4201.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let a = if true { 0 @@ -15,7 +5,7 @@ fn main() { //~^ ERROR if may be missing an else clause //~| expected type `()` //~| found type `{integer}` -//~| expected (), found integral variable +//~| expected (), found integer 1 }; } diff --git a/src/test/ui/issues/issue-4201.stderr b/src/test/ui/issues/issue-4201.stderr index 40de077ce76..4f8ec96d531 100644 --- a/src/test/ui/issues/issue-4201.stderr +++ b/src/test/ui/issues/issue-4201.stderr @@ -1,15 +1,15 @@ error[E0317]: if may be missing an else clause - --> $DIR/issue-4201.rs:14:12 + --> $DIR/issue-4201.rs:4:12 | LL | } else if false { | ____________^ LL | | //~^ ERROR if may be missing an else clause LL | | //~| expected type `()` LL | | //~| found type `{integer}` -LL | | //~| expected (), found integral variable +LL | | //~| expected (), found integer LL | | 1 LL | | }; - | |_____^ expected (), found integral variable + | |_____^ expected (), found integer | = note: expected type `()` found type `{integer}` diff --git a/src/test/ui/issues/issue-42060.rs b/src/test/ui/issues/issue-42060.rs index 23df42d03c4..da7c03032eb 100644 --- a/src/test/ui/issues/issue-42060.rs +++ b/src/test/ui/issues/issue-42060.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let thing = (); let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant diff --git a/src/test/ui/issues/issue-42060.stderr b/src/test/ui/issues/issue-42060.stderr index 69abac8ee7e..cad2bb2a67b 100644 --- a/src/test/ui/issues/issue-42060.stderr +++ b/src/test/ui/issues/issue-42060.stderr @@ -1,23 +1,23 @@ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/issue-42060.rs:13:23 + --> $DIR/issue-42060.rs:3:23 | LL | let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant | ^^^^^ non-constant value error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/issue-42060.rs:19:13 + --> $DIR/issue-42060.rs:9:13 | LL | ::N //~ ERROR attempt to use a non-constant value in a constant | ^ non-constant value error[E0516]: `typeof` is a reserved keyword but unimplemented - --> $DIR/issue-42060.rs:13:16 + --> $DIR/issue-42060.rs:3:16 | LL | let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant | ^^^^^^^^^^^^^ reserved keyword error[E0516]: `typeof` is a reserved keyword but unimplemented - --> $DIR/issue-42060.rs:19:6 + --> $DIR/issue-42060.rs:9:6 | LL | ::N //~ ERROR attempt to use a non-constant value in a constant | ^^^^^^^^^ reserved keyword diff --git a/src/test/ui/issues/issue-42106.nll.stderr b/src/test/ui/issues/issue-42106.nll.stderr index 5750b1761e5..3a31e439c07 100644 --- a/src/test/ui/issues/issue-42106.nll.stderr +++ b/src/test/ui/issues/issue-42106.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*collection` as mutable because it is also borrowed as immutable - --> $DIR/issue-42106.rs:13:5 + --> $DIR/issue-42106.rs:3:5 | LL | let _a = &collection; | ----------- immutable borrow occurs here diff --git a/src/test/ui/issues/issue-42106.rs b/src/test/ui/issues/issue-42106.rs index b177a14af33..5e688693bf9 100644 --- a/src/test/ui/issues/issue-42106.rs +++ b/src/test/ui/issues/issue-42106.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn do_something(collection: &mut Vec) { let _a = &collection; collection.swap(1, 2); //~ ERROR also borrowed as immutable diff --git a/src/test/ui/issues/issue-42106.stderr b/src/test/ui/issues/issue-42106.stderr index d77ff315ce7..e1018a89d20 100644 --- a/src/test/ui/issues/issue-42106.stderr +++ b/src/test/ui/issues/issue-42106.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*collection` as mutable because `collection` is also borrowed as immutable - --> $DIR/issue-42106.rs:13:5 + --> $DIR/issue-42106.rs:3:5 | LL | let _a = &collection; | ---------- immutable borrow occurs here diff --git a/src/test/ui/issues/issue-42312.rs b/src/test/ui/issues/issue-42312.rs index f7705297dfd..b1c651f665b 100644 --- a/src/test/ui/issues/issue-42312.rs +++ b/src/test/ui/issues/issue-42312.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Deref; pub trait Foo { diff --git a/src/test/ui/issues/issue-42312.stderr b/src/test/ui/issues/issue-42312.stderr index 912d791b6bc..20c8d085cbc 100644 --- a/src/test/ui/issues/issue-42312.stderr +++ b/src/test/ui/issues/issue-42312.stderr @@ -1,23 +1,23 @@ error[E0277]: the size for values of type `::Target` cannot be known at compilation time - --> $DIR/issue-42312.rs:14:29 + --> $DIR/issue-42312.rs:4:29 | LL | fn baz(_: Self::Target) where Self: Deref {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `::Target` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where ::Target: std::marker::Sized` bound = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `(dyn std::string::ToString + 'static)` cannot be known at compilation time - --> $DIR/issue-42312.rs:18:23 + --> $DIR/issue-42312.rs:8:23 | LL | pub fn f(_: ToString) {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::string::ToString + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: all function arguments must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/issues/issue-42344.nll.stderr b/src/test/ui/issues/issue-42344.nll.stderr index 1abc448dbb0..9770d26fb12 100644 --- a/src/test/ui/issues/issue-42344.nll.stderr +++ b/src/test/ui/issues/issue-42344.nll.stderr @@ -1,5 +1,5 @@ -error[E0596]: cannot borrow `*TAB[..]` as mutable, as `TAB` is an immutable static item - --> $DIR/issue-42344.rs:14:5 +error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable static item + --> $DIR/issue-42344.rs:4:5 | LL | TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389] | ^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/issues/issue-42344.rs b/src/test/ui/issues/issue-42344.rs index 2f11ff402be..5f1bb4f91bb 100644 --- a/src/test/ui/issues/issue-42344.rs +++ b/src/test/ui/issues/issue-42344.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static TAB: [&mut [u8]; 0] = []; pub unsafe fn test() { diff --git a/src/test/ui/issues/issue-42344.stderr b/src/test/ui/issues/issue-42344.stderr index 92bbe70d9ce..cb0fe78d102 100644 --- a/src/test/ui/issues/issue-42344.stderr +++ b/src/test/ui/issues/issue-42344.stderr @@ -1,5 +1,5 @@ error[E0389]: cannot borrow data mutably in a `&` reference - --> $DIR/issue-42344.rs:14:5 + --> $DIR/issue-42344.rs:4:5 | LL | TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389] | ^^^^^^ assignment into an immutable reference diff --git a/src/test/ui/issues/issue-42467.rs b/src/test/ui/issues/issue-42467.rs index 2acefd718c9..9ad515bdf5a 100644 --- a/src/test/ui/issues/issue-42467.rs +++ b/src/test/ui/issues/issue-42467.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] struct Foo(T); diff --git a/src/test/ui/issues/issue-4265.rs b/src/test/ui/issues/issue-4265.rs index 62db68dcbb2..2596079d379 100644 --- a/src/test/ui/issues/issue-4265.rs +++ b/src/test/ui/issues/issue-4265.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { baz: usize } diff --git a/src/test/ui/issues/issue-4265.stderr b/src/test/ui/issues/issue-4265.stderr index 8f22c6757c2..b5fce14914d 100644 --- a/src/test/ui/issues/issue-4265.stderr +++ b/src/test/ui/issues/issue-4265.stderr @@ -1,5 +1,5 @@ error[E0201]: duplicate definitions with name `bar`: - --> $DIR/issue-4265.rs:20:5 + --> $DIR/issue-4265.rs:10:5 | LL | / fn bar() { LL | | Foo { baz: 0 }.bar(); diff --git a/src/test/ui/issues/issue-42755.rs b/src/test/ui/issues/issue-42755.rs index a8458ccacc3..65796fc24e1 100644 --- a/src/test/ui/issues/issue-42755.rs +++ b/src/test/ui/issues/issue-42755.rs @@ -1,14 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - macro_rules! foo { ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree } diff --git a/src/test/ui/issues/issue-42755.stderr b/src/test/ui/issues/issue-42755.stderr index bdbb99de460..4b490f8e87f 100644 --- a/src/test/ui/issues/issue-42755.stderr +++ b/src/test/ui/issues/issue-42755.stderr @@ -1,5 +1,5 @@ error: repetition matches empty token tree - --> $DIR/issue-42755.rs:13:7 + --> $DIR/issue-42755.rs:2:7 | LL | ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-42796.nll.stderr b/src/test/ui/issues/issue-42796.nll.stderr index fda7cf9ae8e..23cc88bab52 100644 --- a/src/test/ui/issues/issue-42796.nll.stderr +++ b/src/test/ui/issues/issue-42796.nll.stderr @@ -1,13 +1,13 @@ error[E0382]: borrow of moved value: `s` - --> $DIR/issue-42796.rs:28:20 + --> $DIR/issue-42796.rs:18:20 | +LL | let s = "Hello!".to_owned(); + | - move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait LL | let mut s_copy = s; | - value moved here ... LL | println!("{}", s); //~ ERROR use of moved value | ^ value borrowed here after move - | - = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42796.rs b/src/test/ui/issues/issue-42796.rs index b07c23c3fc7..98b91270b7d 100644 --- a/src/test/ui/issues/issue-42796.rs +++ b/src/test/ui/issues/issue-42796.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Mirror { type Image; } diff --git a/src/test/ui/issues/issue-42796.stderr b/src/test/ui/issues/issue-42796.stderr index 9c2481b2f90..530eedd68e6 100644 --- a/src/test/ui/issues/issue-42796.stderr +++ b/src/test/ui/issues/issue-42796.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `s` - --> $DIR/issue-42796.rs:28:20 + --> $DIR/issue-42796.rs:18:20 | LL | let mut s_copy = s; | ---------- value moved here diff --git a/src/test/ui/issues/issue-42880.rs b/src/test/ui/issues/issue-42880.rs index ebb1ec425d1..b61ba80e27a 100644 --- a/src/test/ui/issues/issue-42880.rs +++ b/src/test/ui/issues/issue-42880.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type Value = String; fn main() { diff --git a/src/test/ui/issues/issue-42880.stderr b/src/test/ui/issues/issue-42880.stderr index cf1c3022a22..36b9e8a1e8a 100644 --- a/src/test/ui/issues/issue-42880.stderr +++ b/src/test/ui/issues/issue-42880.stderr @@ -1,8 +1,8 @@ error[E0599]: no associated item named `String` found for type `std::string::String` in the current scope - --> $DIR/issue-42880.rs:14:15 + --> $DIR/issue-42880.rs:4:22 | LL | let f = |&Value::String(_)| (); //~ ERROR no associated item named - | ^^^^^^^^^^^^^^^^ associated item not found in `std::string::String` + | -------^^^^^^--- associated item not found in `std::string::String` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42954.fixed b/src/test/ui/issues/issue-42954.fixed index d05996fb8b9..a73054c9257 100644 --- a/src/test/ui/issues/issue-42954.fixed +++ b/src/test/ui/issues/issue-42954.fixed @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![allow(unused_must_use, unused_comparisons)] diff --git a/src/test/ui/issues/issue-42954.rs b/src/test/ui/issues/issue-42954.rs index 8226cedc0c4..5f9b0e31da5 100644 --- a/src/test/ui/issues/issue-42954.rs +++ b/src/test/ui/issues/issue-42954.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![allow(unused_must_use, unused_comparisons)] diff --git a/src/test/ui/issues/issue-42954.stderr b/src/test/ui/issues/issue-42954.stderr index aa332602f9e..6a89724de5f 100644 --- a/src/test/ui/issues/issue-42954.stderr +++ b/src/test/ui/issues/issue-42954.stderr @@ -1,5 +1,5 @@ error: `<` is interpreted as a start of generic arguments for `u32`, not a comparison - --> $DIR/issue-42954.rs:17:19 + --> $DIR/issue-42954.rs:7:19 | LL | $i as u32 < 0 //~ `<` is interpreted as a start of generic arguments | --------- ^ - interpreted as generic arguments diff --git a/src/test/ui/issues/issue-42956.rs b/src/test/ui/issues/issue-42956.rs index 9dff9f66282..34cb04657eb 100644 --- a/src/test/ui/issues/issue-42956.rs +++ b/src/test/ui/issues/issue-42956.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(stable_features)] diff --git a/src/test/ui/issues/issue-43023.rs b/src/test/ui/issues/issue-43023.rs index 6a5f7a1136a..072243d881c 100644 --- a/src/test/ui/issues/issue-43023.rs +++ b/src/test/ui/issues/issue-43023.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S; impl S { @@ -26,3 +16,5 @@ trait Tr2 { #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions type F; } + +fn main() {} diff --git a/src/test/ui/issues/issue-43023.stderr b/src/test/ui/issues/issue-43023.stderr index 2aa1efa9ca8..b620cc5d74e 100644 --- a/src/test/ui/issues/issue-43023.stderr +++ b/src/test/ui/issues/issue-43023.stderr @@ -1,17 +1,17 @@ error: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-43023.rs:14:5 + --> $DIR/issue-43023.rs:4:5 | LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-43023.rs:21:5 + --> $DIR/issue-43023.rs:11:5 | LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-43023.rs:26:5 + --> $DIR/issue-43023.rs:16:5 | LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-43057.rs b/src/test/ui/issues/issue-43057.rs index ba363e9e29e..3ed64bba904 100644 --- a/src/test/ui/issues/issue-43057.rs +++ b/src/test/ui/issues/issue-43057.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused)] diff --git a/src/test/ui/issues/issue-43105.rs b/src/test/ui/issues/issue-43105.rs index 60b18a66f1a..f61b65baac4 100644 --- a/src/test/ui/issues/issue-43105.rs +++ b/src/test/ui/issues/issue-43105.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn xyz() -> u8 { 42 } const NUM: u8 = xyz(); diff --git a/src/test/ui/issues/issue-43105.stderr b/src/test/ui/issues/issue-43105.stderr index f26447ed2b9..3cc0440d2c7 100644 --- a/src/test/ui/issues/issue-43105.stderr +++ b/src/test/ui/issues/issue-43105.stderr @@ -1,11 +1,11 @@ error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue-43105.rs:13:17 + --> $DIR/issue-43105.rs:3:17 | LL | const NUM: u8 = xyz(); | ^^^^^ error: any use of this value will cause an error - --> $DIR/issue-43105.rs:13:1 + --> $DIR/issue-43105.rs:3:1 | LL | const NUM: u8 = xyz(); | ^^^^^^^^^^^^^^^^-----^ @@ -15,7 +15,7 @@ LL | const NUM: u8 = xyz(); = note: #[deny(const_err)] on by default error: could not evaluate constant pattern - --> $DIR/issue-43105.rs:19:9 + --> $DIR/issue-43105.rs:9:9 | LL | NUM => unimplemented!(), | ^^^ diff --git a/src/test/ui/issues/issue-43162.rs b/src/test/ui/issues/issue-43162.rs index b236283f757..782eb42293a 100644 --- a/src/test/ui/issues/issue-43162.rs +++ b/src/test/ui/issues/issue-43162.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() -> bool { //~^ ERROR E0308 break true; //~ ERROR E0268 diff --git a/src/test/ui/issues/issue-43162.stderr b/src/test/ui/issues/issue-43162.stderr index 4b3b4638f26..3fc5317830e 100644 --- a/src/test/ui/issues/issue-43162.stderr +++ b/src/test/ui/issues/issue-43162.stderr @@ -1,25 +1,25 @@ error[E0268]: `break` outside of loop - --> $DIR/issue-43162.rs:13:5 + --> $DIR/issue-43162.rs:3:5 | LL | break true; //~ ERROR E0268 | ^^^^^^^^^^ cannot break outside of a loop error[E0268]: `break` outside of loop - --> $DIR/issue-43162.rs:17:5 + --> $DIR/issue-43162.rs:7:5 | LL | break {}; //~ ERROR E0268 | ^^^^^^^^ cannot break outside of a loop error[E0308]: mismatched types - --> $DIR/issue-43162.rs:11:18 + --> $DIR/issue-43162.rs:1:13 | -LL | fn foo() -> bool { - | __________________^ -LL | | //~^ ERROR E0308 -LL | | break true; //~ ERROR E0268 - | | - help: consider removing this semicolon -LL | | } - | |_^ expected bool, found () +LL | fn foo() -> bool { + | --- ^^^^ expected bool, found () + | | + | this function's body doesn't return +LL | //~^ ERROR E0308 +LL | break true; //~ ERROR E0268 + | - help: consider removing this semicolon | = note: expected type `bool` found type `()` diff --git a/src/test/ui/issues/issue-43189.rs b/src/test/ui/issues/issue-43189.rs index 7018198aff5..f4f4dce7682 100644 --- a/src/test/ui/issues/issue-43189.rs +++ b/src/test/ui/issues/issue-43189.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 46112: An extern crate pub re-exporting libcore was causing // paths rooted from `std` to be misrendered in the diagnostic output. diff --git a/src/test/ui/issues/issue-43189.stderr b/src/test/ui/issues/issue-43189.stderr index b2a02401c59..e364650da40 100644 --- a/src/test/ui/issues/issue-43189.stderr +++ b/src/test/ui/issues/issue-43189.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `a` found for type `()` in the current scope - --> $DIR/issue-43189.rs:20:8 + --> $DIR/issue-43189.rs:10:8 | LL | ().a(); | ^ diff --git a/src/test/ui/issues/issue-43196.rs b/src/test/ui/issues/issue-43196.rs index ff53c9a5a54..81e5205ce33 100644 --- a/src/test/ui/issues/issue-43196.rs +++ b/src/test/ui/issues/issue-43196.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { | } diff --git a/src/test/ui/issues/issue-43196.stderr b/src/test/ui/issues/issue-43196.stderr index 2418f517168..32efe23c72b 100644 --- a/src/test/ui/issues/issue-43196.stderr +++ b/src/test/ui/issues/issue-43196.stderr @@ -1,5 +1,5 @@ error: expected `|`, found `}` - --> $DIR/issue-43196.rs:13:1 + --> $DIR/issue-43196.rs:3:1 | LL | | | - expected `|` here @@ -7,7 +7,7 @@ LL | } | ^ unexpected token error: expected item, found `|` - --> $DIR/issue-43196.rs:15:1 + --> $DIR/issue-43196.rs:5:1 | LL | | | ^ expected item diff --git a/src/test/ui/issues/issue-4321.rs b/src/test/ui/issues/issue-4321.rs index d589680b0ec..9715f2eba2f 100644 --- a/src/test/ui/issues/issue-4321.rs +++ b/src/test/ui/issues/issue-4321.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let tup = (true, true); println!("foo {:}", match tup { //~ ERROR non-exhaustive patterns: `(true, false)` not covered diff --git a/src/test/ui/issues/issue-4321.stderr b/src/test/ui/issues/issue-4321.stderr index db52cd557f1..7817fdcbce9 100644 --- a/src/test/ui/issues/issue-4321.stderr +++ b/src/test/ui/issues/issue-4321.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `(true, false)` not covered - --> $DIR/issue-4321.rs:13:31 + --> $DIR/issue-4321.rs:3:31 | LL | println!("foo {:}", match tup { //~ ERROR non-exhaustive patterns: `(true, false)` not covered | ^^^ pattern `(true, false)` not covered diff --git a/src/test/ui/issues/issue-43250.rs b/src/test/ui/issues/issue-43250.rs index e1d34f339dc..24d70d2964b 100644 --- a/src/test/ui/issues/issue-43250.rs +++ b/src/test/ui/issues/issue-43250.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let mut y; const C: u32 = 0; diff --git a/src/test/ui/issues/issue-43250.stderr b/src/test/ui/issues/issue-43250.stderr index a05d4d41cc7..f729c5cf10c 100644 --- a/src/test/ui/issues/issue-43250.stderr +++ b/src/test/ui/issues/issue-43250.stderr @@ -1,11 +1,11 @@ error: arbitrary expressions aren't allowed in patterns - --> $DIR/issue-43250.rs:19:8 + --> $DIR/issue-43250.rs:9:8 | LL | m!(y); | ^ error: arbitrary expressions aren't allowed in patterns - --> $DIR/issue-43250.rs:21:8 + --> $DIR/issue-43250.rs:11:8 | LL | m!(C); | ^ diff --git a/src/test/ui/issues/issue-4335.nll.stderr b/src/test/ui/issues/issue-4335.nll.stderr index d31eddfa5b6..5ac3bdb805c 100644 --- a/src/test/ui/issues/issue-4335.nll.stderr +++ b/src/test/ui/issues/issue-4335.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/issue-4335.rs:16:20 + --> $DIR/issue-4335.rs:6:20 | LL | fn f<'r, T>(v: &'r T) -> Box T + 'r> { | - captured outer variable @@ -7,7 +7,7 @@ LL | id(Box::new(|| *v)) | ^^ cannot move out of captured variable in an `FnMut` closure error[E0373]: closure may outlive the current function, but it borrows `v`, which is owned by the current function - --> $DIR/issue-4335.rs:16:17 + --> $DIR/issue-4335.rs:6:17 | LL | id(Box::new(|| *v)) | ^^ - `v` is borrowed here @@ -15,7 +15,7 @@ LL | id(Box::new(|| *v)) | may outlive borrowed value `v` | note: closure is returned here - --> $DIR/issue-4335.rs:16:5 + --> $DIR/issue-4335.rs:6:5 | LL | id(Box::new(|| *v)) | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-4335.rs b/src/test/ui/issues/issue-4335.rs index 540504eb07e..d3c9954cdb0 100644 --- a/src/test/ui/issues/issue-4335.rs +++ b/src/test/ui/issues/issue-4335.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(fn_traits)] fn id(t: T) -> T { t } diff --git a/src/test/ui/issues/issue-4335.stderr b/src/test/ui/issues/issue-4335.stderr index 80f5b445bb6..9ef8e16bbd3 100644 --- a/src/test/ui/issues/issue-4335.stderr +++ b/src/test/ui/issues/issue-4335.stderr @@ -1,5 +1,5 @@ error[E0373]: closure may outlive the current function, but it borrows `v`, which is owned by the current function - --> $DIR/issue-4335.rs:16:17 + --> $DIR/issue-4335.rs:6:17 | LL | id(Box::new(|| *v)) | ^^ - `v` is borrowed here @@ -11,7 +11,7 @@ LL | id(Box::new(move || *v)) | ^^^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/issue-4335.rs:16:20 + --> $DIR/issue-4335.rs:6:20 | LL | id(Box::new(|| *v)) | ^^ cannot move out of borrowed content diff --git a/src/test/ui/issues/issue-43355.rs b/src/test/ui/issues/issue-43355.rs index d793a78799a..809300d6d19 100644 --- a/src/test/ui/issues/issue-43355.rs +++ b/src/test/ui/issues/issue-43355.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Trait1 { type Output; } diff --git a/src/test/ui/issues/issue-43355.stderr b/src/test/ui/issues/issue-43355.stderr index dbcf1b52b89..039f10447c0 100644 --- a/src/test/ui/issues/issue-43355.stderr +++ b/src/test/ui/issues/issue-43355.stderr @@ -1,5 +1,5 @@ error: conflicting implementations of trait `Trait1>` for type `A`: (E0119) - --> $DIR/issue-43355.rs:23:1 + --> $DIR/issue-43355.rs:13:1 | LL | impl Trait1 for T where T: Trait2 { | --------------------------------------------- first implementation here diff --git a/src/test/ui/issues/issue-43357.rs b/src/test/ui/issues/issue-43357.rs index d42f0de4849..6b8e7de8509 100644 --- a/src/test/ui/issues/issue-43357.rs +++ b/src/test/ui/issues/issue-43357.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] trait Trait { diff --git a/src/test/ui/issues/issue-43420-no-over-suggest.rs b/src/test/ui/issues/issue-43420-no-over-suggest.rs index 8c5bde45bae..4365bff5af5 100644 --- a/src/test/ui/issues/issue-43420-no-over-suggest.rs +++ b/src/test/ui/issues/issue-43420-no-over-suggest.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that we substitute type parameters before we suggest anything - otherwise // we would suggest function such as `as_slice` for the `&[u16]`. diff --git a/src/test/ui/issues/issue-43420-no-over-suggest.stderr b/src/test/ui/issues/issue-43420-no-over-suggest.stderr index 80bbdd11289..bd51d7e1169 100644 --- a/src/test/ui/issues/issue-43420-no-over-suggest.stderr +++ b/src/test/ui/issues/issue-43420-no-over-suggest.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-43420-no-over-suggest.rs:18:9 + --> $DIR/issue-43420-no-over-suggest.rs:8:9 | LL | foo(&a); //~ ERROR mismatched types | ^^ expected slice, found struct `std::vec::Vec` diff --git a/src/test/ui/issues/issue-43424.rs b/src/test/ui/issues/issue-43424.rs index 431fc8a5aa2..b3f76d8b049 100644 --- a/src/test/ui/issues/issue-43424.rs +++ b/src/test/ui/issues/issue-43424.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] macro_rules! m { diff --git a/src/test/ui/issues/issue-43424.stderr b/src/test/ui/issues/issue-43424.stderr index 3a9a3164703..c81ea20170c 100644 --- a/src/test/ui/issues/issue-43424.stderr +++ b/src/test/ui/issues/issue-43424.stderr @@ -1,5 +1,5 @@ error: unexpected generic arguments in path - --> $DIR/issue-43424.rs:20:4 + --> $DIR/issue-43424.rs:10:4 | LL | m!(inline); //~ ERROR: unexpected generic arguments in path | ^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-43431.rs b/src/test/ui/issues/issue-43431.rs index 1e6366e068a..e7ec35105f7 100644 --- a/src/test/ui/issues/issue-43431.rs +++ b/src/test/ui/issues/issue-43431.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(fn_traits)] trait CallSingle { diff --git a/src/test/ui/issues/issue-43431.stderr b/src/test/ui/issues/issue-43431.stderr index 3eb8fac6c0f..4edb528699d 100644 --- a/src/test/ui/issues/issue-43431.stderr +++ b/src/test/ui/issues/issue-43431.stderr @@ -1,5 +1,5 @@ error[E0229]: associated type bindings are not allowed here - --> $DIR/issue-43431.rs:19:27 + --> $DIR/issue-43431.rs:9:27 | LL | B>::call(self, (a,)) | ^ associated type not allowed here diff --git a/src/test/ui/issues/issue-43483.rs b/src/test/ui/issues/issue-43483.rs index 9622265ce2e..a123ae48496 100644 --- a/src/test/ui/issues/issue-43483.rs +++ b/src/test/ui/issues/issue-43483.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/issues/issue-4366-2.rs b/src/test/ui/issues/issue-4366-2.rs index 33abc196a6b..c777b750252 100644 --- a/src/test/ui/issues/issue-4366-2.rs +++ b/src/test/ui/issues/issue-4366-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ensures that 'use foo:*' doesn't import non-public item use m1::*; @@ -18,12 +8,12 @@ mod foo { mod a { pub mod b { use foo::foo; - type bar = isize; + type Bar = isize; } pub mod sub { use a::b::*; - fn sub() -> bar { 1 } - //~^ ERROR cannot find type `bar` in this scope + fn sub() -> Bar { 1 } + //~^ ERROR cannot find type `Bar` in this scope } } diff --git a/src/test/ui/issues/issue-4366-2.stderr b/src/test/ui/issues/issue-4366-2.stderr index 1c9a9eb25c3..8cf0e3bd520 100644 --- a/src/test/ui/issues/issue-4366-2.stderr +++ b/src/test/ui/issues/issue-4366-2.stderr @@ -1,15 +1,15 @@ -error[E0412]: cannot find type `bar` in this scope - --> $DIR/issue-4366-2.rs:25:21 +error[E0412]: cannot find type `Bar` in this scope + --> $DIR/issue-4366-2.rs:15:21 | -LL | fn sub() -> bar { 1 } +LL | fn sub() -> Bar { 1 } | ^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | -LL | use a::b::bar; +LL | use a::b::Bar; | error[E0423]: expected function, found module `foo` - --> $DIR/issue-4366-2.rs:35:5 + --> $DIR/issue-4366-2.rs:25:5 | LL | foo(); //~ ERROR expected function, found module `foo` | ^^^ not a function diff --git a/src/test/ui/issues/issue-4366.rs b/src/test/ui/issues/issue-4366.rs index 47fd426592c..9ec2e58ecad 100644 --- a/src/test/ui/issues/issue-4366.rs +++ b/src/test/ui/issues/issue-4366.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // regression test for issue 4366 // ensures that 'use foo:*' doesn't import non-public 'use' statements in the @@ -21,7 +11,7 @@ mod foo { mod a { pub mod b { use foo::foo; - type bar = isize; + type Bar = isize; } pub mod sub { use a::b::*; diff --git a/src/test/ui/issues/issue-4366.stderr b/src/test/ui/issues/issue-4366.stderr index e78aec9d0e8..2bad7b17d64 100644 --- a/src/test/ui/issues/issue-4366.stderr +++ b/src/test/ui/issues/issue-4366.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find function `foo` in this scope - --> $DIR/issue-4366.rs:28:29 + --> $DIR/issue-4366.rs:18:29 | LL | fn sub() -> isize { foo(); 1 } //~ ERROR cannot find function `foo` in this scope | ^^^ not found in this scope diff --git a/src/test/ui/issues/issue-43733.rs b/src/test/ui/issues/issue-43733.rs index 7b1364ff41c..91192e3360c 100644 --- a/src/test/ui/issues/issue-43733.rs +++ b/src/test/ui/issues/issue-43733.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_fn)] #![feature(thread_local)] #![feature(cfg_target_thread_local, thread_local_internals)] diff --git a/src/test/ui/issues/issue-43733.stderr b/src/test/ui/issues/issue-43733.stderr index 5f91d3d2266..38fa93d4461 100644 --- a/src/test/ui/issues/issue-43733.stderr +++ b/src/test/ui/issues/issue-43733.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-43733.rs:30:5 + --> $DIR/issue-43733.rs:20:5 | LL | __KEY.get() //~ ERROR call to unsafe function is unsafe | ^^^^^^^^^^^ call to unsafe function @@ -7,7 +7,7 @@ LL | __KEY.get() //~ ERROR call to unsafe function is unsafe = note: consult the function's documentation for information on how to avoid undefined behavior error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-43733.rs:34:5 + --> $DIR/issue-43733.rs:24:5 | LL | std::thread::LocalKey::new(__getit, Default::default); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/issues/issue-43784-associated-type.rs b/src/test/ui/issues/issue-43784-associated-type.rs index 1ff1238ec54..fb58ad6600f 100644 --- a/src/test/ui/issues/issue-43784-associated-type.rs +++ b/src/test/ui/issues/issue-43784-associated-type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Partial: Copy { } diff --git a/src/test/ui/issues/issue-43784-associated-type.stderr b/src/test/ui/issues/issue-43784-associated-type.stderr index 18e97e24b73..4beb854b0f3 100644 --- a/src/test/ui/issues/issue-43784-associated-type.stderr +++ b/src/test/ui/issues/issue-43784-associated-type.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/issue-43784-associated-type.rs:23:9 + --> $DIR/issue-43784-associated-type.rs:13:9 | LL | impl Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` diff --git a/src/test/ui/issues/issue-43784-supertrait.rs b/src/test/ui/issues/issue-43784-supertrait.rs index 30132c3be88..3c03433a268 100644 --- a/src/test/ui/issues/issue-43784-supertrait.rs +++ b/src/test/ui/issues/issue-43784-supertrait.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Partial: Copy { } diff --git a/src/test/ui/issues/issue-43784-supertrait.stderr b/src/test/ui/issues/issue-43784-supertrait.stderr index 422075f62aa..7771f9abfb8 100644 --- a/src/test/ui/issues/issue-43784-supertrait.stderr +++ b/src/test/ui/issues/issue-43784-supertrait.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/issue-43784-supertrait.rs:18:9 + --> $DIR/issue-43784-supertrait.rs:8:9 | LL | impl Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` diff --git a/src/test/ui/issues/issue-43806.rs b/src/test/ui/issues/issue-43806.rs index 7757a503c7e..cbfbfa35afb 100644 --- a/src/test/ui/issues/issue-43806.rs +++ b/src/test/ui/issues/issue-43806.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![deny(unused_results)] diff --git a/src/test/ui/issues/issue-43925.rs b/src/test/ui/issues/issue-43925.rs index 7875c16c0e4..1f3bee38e8c 100644 --- a/src/test/ui/issues/issue-43925.rs +++ b/src/test/ui/issues/issue-43925.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)` extern {} diff --git a/src/test/ui/issues/issue-43925.stderr b/src/test/ui/issues/issue-43925.stderr index e93ea9c7bc7..e73c2122a03 100644 --- a/src/test/ui/issues/issue-43925.stderr +++ b/src/test/ui/issues/issue-43925.stderr @@ -1,5 +1,5 @@ error: invalid argument for `cfg(..)` - --> $DIR/issue-43925.rs:11:24 + --> $DIR/issue-43925.rs:1:24 | LL | #[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)` | ^^^^^^ diff --git a/src/test/ui/issues/issue-43926.rs b/src/test/ui/issues/issue-43926.rs index 5d510b643a3..c56a796187a 100644 --- a/src/test/ui/issues/issue-43926.rs +++ b/src/test/ui/issues/issue-43926.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link(name="foo", cfg())] //~ ERROR `cfg()` must have an argument extern {} diff --git a/src/test/ui/issues/issue-43926.stderr b/src/test/ui/issues/issue-43926.stderr index 80d8c5c9814..9dc9cfe5db2 100644 --- a/src/test/ui/issues/issue-43926.stderr +++ b/src/test/ui/issues/issue-43926.stderr @@ -1,5 +1,5 @@ error: `cfg()` must have an argument - --> $DIR/issue-43926.rs:11:20 + --> $DIR/issue-43926.rs:1:20 | LL | #[link(name="foo", cfg())] //~ ERROR `cfg()` must have an argument | ^^^^^ diff --git a/src/test/ui/issues/issue-43988.rs b/src/test/ui/issues/issue-43988.rs index 6361af76482..74667d74334 100644 --- a/src/test/ui/issues/issue-43988.rs +++ b/src/test/ui/issues/issue-43988.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(stmt_expr_attributes)] fn main() { @@ -34,8 +24,7 @@ fn main() { #[repr] let _y = "123"; //~^^ ERROR attribute should not be applied to a statement - //~| WARN `repr` attribute must have a hint - + //~| ERROR attribute must be of the form fn foo() {} @@ -45,5 +34,5 @@ fn main() { let _z = #[repr] 1; //~^ ERROR attribute should not be applied to an expression - //~| WARN `repr` attribute must have a hint + //~| ERROR attribute must be of the form } diff --git a/src/test/ui/issues/issue-43988.stderr b/src/test/ui/issues/issue-43988.stderr index 7237851f778..6fe41a3de29 100644 --- a/src/test/ui/issues/issue-43988.stderr +++ b/src/test/ui/issues/issue-43988.stderr @@ -1,24 +1,17 @@ -warning: `repr` attribute must have a hint - --> $DIR/issue-43988.rs:34:5 +error: attribute must be of the form `#[repr(C, packed, ...)]` + --> $DIR/issue-43988.rs:24:5 | LL | #[repr] - | ^^^^^^^ needs a hint - | - = note: #[warn(bad_repr)] on by default - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit + | ^^^^^^^ -warning: `repr` attribute must have a hint - --> $DIR/issue-43988.rs:46:14 +error: attribute must be of the form `#[repr(C, packed, ...)]` + --> $DIR/issue-43988.rs:35:14 | LL | let _z = #[repr] 1; - | ^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit + | ^^^^^^^ error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43988.rs:15:5 + --> $DIR/issue-43988.rs:5:5 | LL | #[inline] | ^^^^^^^^^ @@ -26,7 +19,7 @@ LL | let _a = 4; | ----------- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43988.rs:20:5 + --> $DIR/issue-43988.rs:10:5 | LL | #[inline(XYZ)] | ^^^^^^^^^^^^^^ @@ -34,7 +27,7 @@ LL | let _b = 4; | ----------- not a function or closure error[E0517]: attribute should not be applied to a statement - --> $DIR/issue-43988.rs:24:5 + --> $DIR/issue-43988.rs:14:5 | LL | #[repr(nothing)] | ^^^^^^^^^^^^^^^^ @@ -42,7 +35,7 @@ LL | let _x = 0; | ----------- not a struct, enum or union error[E0517]: attribute should not be applied to an expression - --> $DIR/issue-43988.rs:28:5 + --> $DIR/issue-43988.rs:18:5 | LL | #[repr(something_not_real)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -52,7 +45,7 @@ LL | | }; | |_____- not defining a struct, enum or union error[E0517]: attribute should not be applied to a statement - --> $DIR/issue-43988.rs:34:5 + --> $DIR/issue-43988.rs:24:5 | LL | #[repr] | ^^^^^^^ @@ -60,7 +53,7 @@ LL | let _y = "123"; | --------------- not a struct, enum or union error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43988.rs:42:5 + --> $DIR/issue-43988.rs:31:5 | LL | #[inline(ABC)] | ^^^^^^^^^^^^^^ @@ -68,12 +61,12 @@ LL | foo(); | ----- not a function or closure error[E0517]: attribute should not be applied to an expression - --> $DIR/issue-43988.rs:46:14 + --> $DIR/issue-43988.rs:35:14 | LL | let _z = #[repr] 1; | ^^^^^^^ - not defining a struct, enum or union -error: aborting due to 7 previous errors +error: aborting due to 9 previous errors Some errors occurred: E0517, E0518. For more information about an error, try `rustc --explain E0517`. diff --git a/src/test/ui/issues/issue-44005.rs b/src/test/ui/issues/issue-44005.rs index c3599294e37..e2625fd9379 100644 --- a/src/test/ui/issues/issue-44005.rs +++ b/src/test/ui/issues/issue-44005.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass pub trait Foo<'a> { type Bar; diff --git a/src/test/ui/issues/issue-44021.rs b/src/test/ui/issues/issue-44021.rs index b6ec21b94c7..0b9558cc91e 100644 --- a/src/test/ui/issues/issue-44021.rs +++ b/src/test/ui/issues/issue-44021.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct MyStruct; impl MyStruct { fn f() {|x, y} //~ ERROR expected one of `:`, `@`, or `|`, found `}` diff --git a/src/test/ui/issues/issue-44021.stderr b/src/test/ui/issues/issue-44021.stderr index 2c74531cf24..03f11312d46 100644 --- a/src/test/ui/issues/issue-44021.stderr +++ b/src/test/ui/issues/issue-44021.stderr @@ -1,5 +1,5 @@ error: expected one of `:`, `@`, or `|`, found `}` - --> $DIR/issue-44021.rs:13:18 + --> $DIR/issue-44021.rs:3:18 | LL | fn f() {|x, y} //~ ERROR expected one of `:`, `@`, or `|`, found `}` | ^ expected one of `:`, `@`, or `|` here diff --git a/src/test/ui/issues/issue-44023.rs b/src/test/ui/issues/issue-44023.rs index 97b82dc58dc..4c38ddfcdf1 100644 --- a/src/test/ui/issues/issue-44023.rs +++ b/src/test/ui/issues/issue-44023.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(non_ascii_idents)] pub fn main () {} diff --git a/src/test/ui/issues/issue-44023.stderr b/src/test/ui/issues/issue-44023.stderr index 3baf7ec0277..f1962a86ee0 100644 --- a/src/test/ui/issues/issue-44023.stderr +++ b/src/test/ui/issues/issue-44023.stderr @@ -1,10 +1,10 @@ error[E0308]: mismatched types - --> $DIR/issue-44023.rs:15:42 + --> $DIR/issue-44023.rs:5:36 | -LL | fn საჭმელად_გემრიელი_სადილი ( ) -> isize { //~ ERROR mismatched types - | __________________________________________^ -LL | | } - | |_^ expected isize, found () +LL | fn საჭმელად_გემრიელი_სადილი ( ) -> isize { //~ ERROR mismatched types + | ------------------------ ^^^^^ expected isize, found () + | | + | this function's body doesn't return | = note: expected type `isize` found type `()` diff --git a/src/test/ui/issues/issue-44056.rs b/src/test/ui/issues/issue-44056.rs index b2f0e917749..8ed371485c2 100644 --- a/src/test/ui/issues/issue-44056.rs +++ b/src/test/ui/issues/issue-44056.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // only-x86_64 // no-prefer-dynamic diff --git a/src/test/ui/issues/issue-44078.rs b/src/test/ui/issues/issue-44078.rs index 356a7be0b41..b8c0e285ffc 100644 --- a/src/test/ui/issues/issue-44078.rs +++ b/src/test/ui/issues/issue-44078.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { "😊""; //~ ERROR unterminated double quote } diff --git a/src/test/ui/issues/issue-44078.stderr b/src/test/ui/issues/issue-44078.stderr index e8dce656f65..e7f46130f11 100644 --- a/src/test/ui/issues/issue-44078.stderr +++ b/src/test/ui/issues/issue-44078.stderr @@ -1,5 +1,5 @@ error: unterminated double quote string - --> $DIR/issue-44078.rs:12:8 + --> $DIR/issue-44078.rs:2:8 | LL | "😊""; //~ ERROR unterminated double quote | _________^ diff --git a/src/test/ui/issues/issue-44239.rs b/src/test/ui/issues/issue-44239.rs index 131c6526642..99a865f75a4 100644 --- a/src/test/ui/issues/issue-44239.rs +++ b/src/test/ui/issues/issue-44239.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let n = 0; diff --git a/src/test/ui/issues/issue-44239.stderr b/src/test/ui/issues/issue-44239.stderr index 43d4968a89f..bc5a6a03f03 100644 --- a/src/test/ui/issues/issue-44239.stderr +++ b/src/test/ui/issues/issue-44239.stderr @@ -1,5 +1,5 @@ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/issue-44239.rs:16:26 + --> $DIR/issue-44239.rs:6:26 | LL | const N: usize = n; | ^ non-constant value diff --git a/src/test/ui/issues/issue-44247.rs b/src/test/ui/issues/issue-44247.rs index 29c4b977d65..b45d541f212 100644 --- a/src/test/ui/issues/issue-44247.rs +++ b/src/test/ui/issues/issue-44247.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] trait T { diff --git a/src/test/ui/issues/issue-44373-2.rs b/src/test/ui/issues/issue-44373-2.rs index ccc99f0ecc4..ab92bf458fb 100644 --- a/src/test/ui/issues/issue-44373-2.rs +++ b/src/test/ui/issues/issue-44373-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // compile-flags: -Z borrowck=compare diff --git a/src/test/ui/issues/issue-44373.nll.stderr b/src/test/ui/issues/issue-44373.nll.stderr index f214d466159..8359e5af2b8 100644 --- a/src/test/ui/issues/issue-44373.nll.stderr +++ b/src/test/ui/issues/issue-44373.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-44373.rs:15:42 + --> $DIR/issue-44373.rs:4:42 | LL | let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough | ----------------------- ^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/issues/issue-44373.rs b/src/test/ui/issues/issue-44373.rs index d744ad11c5c..13e9fa9ea67 100644 --- a/src/test/ui/issues/issue-44373.rs +++ b/src/test/ui/issues/issue-44373.rs @@ -1,14 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - static FOO: u32 = 50; fn main() { diff --git a/src/test/ui/issues/issue-44373.stderr b/src/test/ui/issues/issue-44373.stderr index 17a634ba747..5a4bf18f3d5 100644 --- a/src/test/ui/issues/issue-44373.stderr +++ b/src/test/ui/issues/issue-44373.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/issue-44373.rs:15:42 + --> $DIR/issue-44373.rs:4:42 | LL | let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough | ^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/issues/issue-44402.rs b/src/test/ui/issues/issue-44402.rs index f44f261041a..7a2eaac1fd2 100644 --- a/src/test/ui/issues/issue-44402.rs +++ b/src/test/ui/issues/issue-44402.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![feature(never_type)] @@ -33,7 +23,10 @@ fn test_a() { fn test_b() { let x: Option = None; - match x { None => () } + match x { + Some(_) => (), + None => () + } } fn main() { } diff --git a/src/test/ui/issues/issue-44406.rs b/src/test/ui/issues/issue-44406.rs index 8e99caff4ef..83bbf884a4f 100644 --- a/src/test/ui/issues/issue-44406.rs +++ b/src/test/ui/issues/issue-44406.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo { ($rest: tt) => { bar(baz: $rest) diff --git a/src/test/ui/issues/issue-44406.stderr b/src/test/ui/issues/issue-44406.stderr index 5cd9b3f065e..105dbb677dc 100644 --- a/src/test/ui/issues/issue-44406.stderr +++ b/src/test/ui/issues/issue-44406.stderr @@ -1,11 +1,15 @@ error: expected identifier, found keyword `true` - --> $DIR/issue-44406.rs:18:10 + --> $DIR/issue-44406.rs:8:10 | LL | foo!(true); //~ ERROR expected type, found keyword | ^^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | foo!(r#true); //~ ERROR expected type, found keyword + | ^^^^^^ error: expected type, found keyword `true` - --> $DIR/issue-44406.rs:18:10 + --> $DIR/issue-44406.rs:8:10 | LL | bar(baz: $rest) | - help: try using a semicolon: `;` diff --git a/src/test/ui/issues/issue-44415.rs b/src/test/ui/issues/issue-44415.rs index 6d55422dea0..763f8574873 100644 --- a/src/test/ui/issues/issue-44415.rs +++ b/src/test/ui/issues/issue-44415.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(core_intrinsics)] use std::intrinsics; diff --git a/src/test/ui/issues/issue-44415.stderr b/src/test/ui/issues/issue-44415.stderr index e70dfe7ad4e..3f377fd27e7 100644 --- a/src/test/ui/issues/issue-44415.stderr +++ b/src/test/ui/issues/issue-44415.stderr @@ -1,24 +1,24 @@ error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}` - --> $DIR/issue-44415.rs:16:17 + --> $DIR/issue-44415.rs:6:17 | LL | bytes: [u8; unsafe { intrinsics::size_of::() }], | ^^^^^^ | note: ...which requires const-evaluating `Foo::bytes::{{constant}}`... - --> $DIR/issue-44415.rs:16:26 + --> $DIR/issue-44415.rs:6:26 | LL | bytes: [u8; unsafe { intrinsics::size_of::() }], | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires computing layout of `Foo`... -note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`... + = note: ...which requires computing layout of `Foo`... + = note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All, def_id: None }, value: [u8; _] }`... note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}`... - --> $DIR/issue-44415.rs:16:17 + --> $DIR/issue-44415.rs:6:17 | LL | bytes: [u8; unsafe { intrinsics::size_of::() }], | ^^^^^^ = note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}`, completing the cycle note: cycle used when processing `Foo` - --> $DIR/issue-44415.rs:15:1 + --> $DIR/issue-44415.rs:5:1 | LL | struct Foo { | ^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-4464.rs b/src/test/ui/issues/issue-4464.rs index a1b2040450a..c20c1cad669 100644 --- a/src/test/ui/issues/issue-4464.rs +++ b/src/test/ui/issues/issue-4464.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-44730.rs b/src/test/ui/issues/issue-44730.rs index 61b266e2b7e..7dae6c8123b 100644 --- a/src/test/ui/issues/issue-44730.rs +++ b/src/test/ui/issues/issue-44730.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass //! dox diff --git a/src/test/ui/issues/issue-44851.rs b/src/test/ui/issues/issue-44851.rs index 4a302be05e7..697b4dcf427 100644 --- a/src/test/ui/issues/issue-44851.rs +++ b/src/test/ui/issues/issue-44851.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass macro_rules! a { () => { "a" } diff --git a/src/test/ui/issues/issue-45087-unreachable-unsafe.rs b/src/test/ui/issues/issue-45087-unreachable-unsafe.rs index 5af0bf6be56..5edf7a47e2f 100644 --- a/src/test/ui/issues/issue-45087-unreachable-unsafe.rs +++ b/src/test/ui/issues/issue-45087-unreachable-unsafe.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { return; *(1 as *mut u32) = 42; diff --git a/src/test/ui/issues/issue-45087-unreachable-unsafe.stderr b/src/test/ui/issues/issue-45087-unreachable-unsafe.stderr index 8a967838bc3..d112d7f4661 100644 --- a/src/test/ui/issues/issue-45087-unreachable-unsafe.stderr +++ b/src/test/ui/issues/issue-45087-unreachable-unsafe.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45087-unreachable-unsafe.rs:13:5 + --> $DIR/issue-45087-unreachable-unsafe.rs:3:5 | LL | *(1 as *mut u32) = 42; | ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer diff --git a/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.rs b/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.rs index 2fce8d723d3..de275ff701a 100644 --- a/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.rs +++ b/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[deny(unused_unsafe)] fn main() { let mut v = Vec::::with_capacity(24); diff --git a/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr b/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr index eaf7569100a..3510112daf0 100644 --- a/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr +++ b/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr @@ -1,5 +1,5 @@ error: unnecessary `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:17:13 + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:7:13 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -8,13 +8,13 @@ LL | unsafe { //~ ERROR unnecessary `unsafe` | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:11:8 + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:1:8 | LL | #[deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:19:38 + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:9:38 | LL | unsafe { | ------ because it's nested under this `unsafe` block @@ -23,7 +23,7 @@ LL | |w: &mut Vec| { unsafe { //~ ERROR unnecessary `unsafe | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:23:34 + --> $DIR/issue-45107-unnecessary-unsafe-in-closure.rs:13:34 | LL | unsafe { | ------ because it's nested under this `unsafe` block diff --git a/src/test/ui/issues/issue-45157.rs b/src/test/ui/issues/issue-45157.rs index a906d193d99..22ea254a769 100644 --- a/src/test/ui/issues/issue-45157.rs +++ b/src/test/ui/issues/issue-45157.rs @@ -1,16 +1,8 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] #![feature(nll)] +// ignore-tidy-linelength + #[derive(Clone, Copy, Default)] struct S { a: u8, @@ -35,8 +27,7 @@ fn main() { *mref = 22; let nref = &u.z.c; - //~^ ERROR cannot borrow `u.z.c` as immutable because it is also borrowed as mutable [E0502] + //~^ ERROR cannot borrow `u` (via `u.z.c`) as immutable because it is also borrowed as mutable (via `u.s.a`) [E0502] println!("{} {}", mref, nref) } } - diff --git a/src/test/ui/issues/issue-45157.stderr b/src/test/ui/issues/issue-45157.stderr index 1512ea53a07..3b15a8dbd9e 100644 --- a/src/test/ui/issues/issue-45157.stderr +++ b/src/test/ui/issues/issue-45157.stderr @@ -1,14 +1,16 @@ -error[E0502]: cannot borrow `u.z.c` as immutable because it is also borrowed as mutable - --> $DIR/issue-45157.rs:37:20 +error[E0502]: cannot borrow `u` (via `u.z.c`) as immutable because it is also borrowed as mutable (via `u.s.a`) + --> $DIR/issue-45157.rs:29:20 | LL | let mref = &mut u.s.a; - | ---------- mutable borrow occurs here + | ---------- mutable borrow occurs here (via `u.s.a`) ... LL | let nref = &u.z.c; - | ^^^^^^ immutable borrow occurs here -LL | //~^ ERROR cannot borrow `u.z.c` as immutable because it is also borrowed as mutable [E0502] + | ^^^^^^ immutable borrow of `u.z.c` -- which overlaps with `u.s.a` -- occurs here +LL | //~^ ERROR cannot borrow `u` (via `u.z.c`) as immutable because it is also borrowed as mutable (via `u.s.a`) [E0502] LL | println!("{} {}", mref, nref) | ---- mutable borrow later used here + | + = note: `u.z.c` is a field of the union `U`, so it overlaps the field `u.s.a` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-4517.rs b/src/test/ui/issues/issue-4517.rs index fbd8972cbfa..bbe81f3fc78 100644 --- a/src/test/ui/issues/issue-4517.rs +++ b/src/test/ui/issues/issue-4517.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn bar(int_param: usize) {} fn main() { diff --git a/src/test/ui/issues/issue-4517.stderr b/src/test/ui/issues/issue-4517.stderr index ca96c396fd0..7d88e550440 100644 --- a/src/test/ui/issues/issue-4517.stderr +++ b/src/test/ui/issues/issue-4517.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-4517.rs:15:9 + --> $DIR/issue-4517.rs:5:9 | LL | bar(foo); | ^^^ expected usize, found array of 4 elements diff --git a/src/test/ui/issues/issue-45199.ast.nll.stderr b/src/test/ui/issues/issue-45199.ast.nll.stderr index 3c7e92e2bc9..6d6af835982 100644 --- a/src/test/ui/issues/issue-45199.ast.nll.stderr +++ b/src/test/ui/issues/issue-45199.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `b` - --> $DIR/issue-45199.rs:20:5 + --> $DIR/issue-45199.rs:10:5 | LL | let b: Box; | - help: make this binding mutable: `mut b` @@ -11,7 +11,7 @@ LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable var | ^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `b` - --> $DIR/issue-45199.rs:31:5 + --> $DIR/issue-45199.rs:21:5 | LL | let b = Box::new(1); //[ast]~ NOTE first assignment | - @@ -23,7 +23,7 @@ LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable | ^ cannot assign twice to immutable variable error[E0384]: cannot assign to immutable argument `b` - --> $DIR/issue-45199.rs:40:5 + --> $DIR/issue-45199.rs:30:5 | LL | fn test_args(b: Box) { //[ast]~ NOTE first assignment | - help: make this binding mutable: `mut b` diff --git a/src/test/ui/issues/issue-45199.ast.stderr b/src/test/ui/issues/issue-45199.ast.stderr index cf8ceacca57..fa9d8e09af5 100644 --- a/src/test/ui/issues/issue-45199.ast.stderr +++ b/src/test/ui/issues/issue-45199.ast.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `b` - --> $DIR/issue-45199.rs:20:5 + --> $DIR/issue-45199.rs:10:5 | LL | b = Box::new(1); //[ast]~ NOTE first assignment | --------------- first assignment to `b` @@ -8,7 +8,7 @@ LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable var | ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `b` - --> $DIR/issue-45199.rs:31:5 + --> $DIR/issue-45199.rs:21:5 | LL | let b = Box::new(1); //[ast]~ NOTE first assignment | - first assignment to `b` @@ -17,7 +17,7 @@ LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable | ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `b` - --> $DIR/issue-45199.rs:40:5 + --> $DIR/issue-45199.rs:30:5 | LL | fn test_args(b: Box) { //[ast]~ NOTE first assignment | - first assignment to `b` diff --git a/src/test/ui/issues/issue-45199.mir.stderr b/src/test/ui/issues/issue-45199.mir.stderr index 3c7e92e2bc9..6d6af835982 100644 --- a/src/test/ui/issues/issue-45199.mir.stderr +++ b/src/test/ui/issues/issue-45199.mir.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `b` - --> $DIR/issue-45199.rs:20:5 + --> $DIR/issue-45199.rs:10:5 | LL | let b: Box; | - help: make this binding mutable: `mut b` @@ -11,7 +11,7 @@ LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable var | ^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `b` - --> $DIR/issue-45199.rs:31:5 + --> $DIR/issue-45199.rs:21:5 | LL | let b = Box::new(1); //[ast]~ NOTE first assignment | - @@ -23,7 +23,7 @@ LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable | ^ cannot assign twice to immutable variable error[E0384]: cannot assign to immutable argument `b` - --> $DIR/issue-45199.rs:40:5 + --> $DIR/issue-45199.rs:30:5 | LL | fn test_args(b: Box) { //[ast]~ NOTE first assignment | - help: make this binding mutable: `mut b` diff --git a/src/test/ui/issues/issue-45199.rs b/src/test/ui/issues/issue-45199.rs index 90a4960cb63..bb55534c132 100644 --- a/src/test/ui/issues/issue-45199.rs +++ b/src/test/ui/issues/issue-45199.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Zborrowck=mir diff --git a/src/test/ui/issues/issue-45296.rs b/src/test/ui/issues/issue-45296.rs index 965747cfa05..f242c1d2937 100644 --- a/src/test/ui/issues/issue-45296.rs +++ b/src/test/ui/issues/issue-45296.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let unused = (); diff --git a/src/test/ui/issues/issue-45296.stderr b/src/test/ui/issues/issue-45296.stderr index 96ee3ccc89d..afea28fb7aa 100644 --- a/src/test/ui/issues/issue-45296.stderr +++ b/src/test/ui/issues/issue-45296.stderr @@ -1,5 +1,5 @@ error: an inner attribute is not permitted in this context - --> $DIR/issue-45296.rs:14:7 + --> $DIR/issue-45296.rs:4:7 | LL | #![allow(unused_variables)] //~ ERROR not permitted in this context | ^ diff --git a/src/test/ui/issues/issue-45425.rs b/src/test/ui/issues/issue-45425.rs index 2b5b7ff1815..a2ef85a2a02 100644 --- a/src/test/ui/issues/issue-45425.rs +++ b/src/test/ui/issues/issue-45425.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] use std::ops::Add; diff --git a/src/test/ui/issues/issue-45562.fixed b/src/test/ui/issues/issue-45562.fixed index 7c01f0d1ee5..c23f5909bbe 100644 --- a/src/test/ui/issues/issue-45562.fixed +++ b/src/test/ui/issues/issue-45562.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #[no_mangle] pub static RAH: usize = 5; diff --git a/src/test/ui/issues/issue-45562.rs b/src/test/ui/issues/issue-45562.rs index c27d52fcdd3..8ac4f6794f6 100644 --- a/src/test/ui/issues/issue-45562.rs +++ b/src/test/ui/issues/issue-45562.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #[no_mangle] pub const RAH: usize = 5; diff --git a/src/test/ui/issues/issue-45562.stderr b/src/test/ui/issues/issue-45562.stderr index d9e624cadc7..b97b9cd6727 100644 --- a/src/test/ui/issues/issue-45562.stderr +++ b/src/test/ui/issues/issue-45562.stderr @@ -1,5 +1,5 @@ error: const items should never be #[no_mangle] - --> $DIR/issue-45562.rs:13:14 + --> $DIR/issue-45562.rs:3:14 | LL | #[no_mangle] pub const RAH: usize = 5; | ---------^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-45696-long-live-borrows-in-boxes.rs b/src/test/ui/issues/issue-45696-long-live-borrows-in-boxes.rs index 881f37c2e0b..9f86caeaea9 100644 --- a/src/test/ui/issues/issue-45696-long-live-borrows-in-boxes.rs +++ b/src/test/ui/issues/issue-45696-long-live-borrows-in-boxes.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // rust-lang/rust#45696: This test is checking that we can return // mutable borrows owned by boxes even when the boxes are dropped. // diff --git a/src/test/ui/issues/issue-45696-no-variant-box-recur.rs b/src/test/ui/issues/issue-45696-no-variant-box-recur.rs index 8624dbd28dc..867da22221a 100644 --- a/src/test/ui/issues/issue-45696-no-variant-box-recur.rs +++ b/src/test/ui/issues/issue-45696-no-variant-box-recur.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // rust-lang/rust#45696: This test checks the compiler won't infinite // loop when you declare a variable of type `struct A(Box, ...);` // (which is impossible to construct but *is* possible to declare; see diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr index 6172a5e35a8..1992e32bf84 100644 --- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr +++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:89:1 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:82:1 | LL | / fn main() { //[ast]~ ERROR compilation successful LL | | //[migrate]~^ ERROR compilation successful diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr index 00df5c859bf..129c6292b15 100644 --- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr +++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr @@ -1,5 +1,5 @@ warning[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:63:5 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:53:5 | LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 { | -- lifetime `'a` defined here @@ -9,12 +9,11 @@ LL | &mut *s.0 //[nll]~ ERROR borrow may still be in use when destructor run LL | } | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future warning[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:73:5 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:64:5 | LL | fn boxed_scribbled<'a>(s: Box>) -> &'a mut u32 { | -- lifetime `'a` defined here @@ -24,12 +23,11 @@ LL | &mut *(*s).0 //[nll]~ ERROR borrow may still be in use when destructor LL | } | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future warning[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:83:5 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:75:5 | LL | fn boxed_boxed_scribbled<'a>(s: Box>>) -> &'a mut u32 { | -- lifetime `'a` defined here @@ -39,12 +37,11 @@ LL | &mut *(**s).0 //[nll]~ ERROR borrow may still be in use when destructor LL | } | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future error: compilation successful - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:89:1 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:82:1 | LL | / fn main() { //[ast]~ ERROR compilation successful LL | | //[migrate]~^ ERROR compilation successful diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr index 5640dbd4e8c..2cb07f0ad00 100644 --- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr +++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr @@ -1,5 +1,5 @@ error[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:63:5 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:53:5 | LL | fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 { | -- lifetime `'a` defined here @@ -10,7 +10,7 @@ LL | } | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait error[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:73:5 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:64:5 | LL | fn boxed_scribbled<'a>(s: Box>) -> &'a mut u32 { | -- lifetime `'a` defined here @@ -21,7 +21,7 @@ LL | } | - here, drop of `s` needs exclusive access to `*s.0`, because the type `Scribble<'_>` implements the `Drop` trait error[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:83:5 + --> $DIR/issue-45696-scribble-on-boxed-borrow.rs:75:5 | LL | fn boxed_boxed_scribbled<'a>(s: Box>>) -> &'a mut u32 { | -- lifetime `'a` defined here diff --git a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs index 2af05172d24..fc56a2a8b70 100644 --- a/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs +++ b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // rust-lang/rust#45696: This test is checking that we *cannot* return // mutable borrows that would be scribbled over by destructors before // the return occurs. @@ -62,7 +52,8 @@ fn boxed_boxed_borrowed_scribble<'a>(s: Box>) -> &'a mut u fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 { &mut *s.0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713] //[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713] - //[migrate]~| WARNING This error has been downgraded to a warning for backwards compatibility + //[migrate]~| WARNING this error has been downgraded to a warning for backwards compatibility + //[migrate]~| WARNING this represents potential undefined behavior in your code } // This, by analogy to previous case, is *also* not okay. @@ -72,7 +63,8 @@ fn scribbled<'a>(s: Scribble<'a>) -> &'a mut u32 { fn boxed_scribbled<'a>(s: Box>) -> &'a mut u32 { &mut *(*s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713] //[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713] - //[migrate]~| WARNING This error has been downgraded to a warning for backwards compatibility + //[migrate]~| WARNING this error has been downgraded to a warning for backwards compatibility + //[migrate]~| WARNING this represents potential undefined behavior in your code } // This, by analogy to previous case, is *also* not okay. @@ -82,7 +74,8 @@ fn boxed_scribbled<'a>(s: Box>) -> &'a mut u32 { fn boxed_boxed_scribbled<'a>(s: Box>>) -> &'a mut u32 { &mut *(**s).0 //[nll]~ ERROR borrow may still be in use when destructor runs [E0713] //[migrate]~^ WARNING borrow may still be in use when destructor runs [E0713] - //[migrate]~| WARNING This error has been downgraded to a warning for backwards compatibility + //[migrate]~| WARNING this error has been downgraded to a warning for backwards compatibility + //[migrate]~| WARNING this represents potential undefined behavior in your code } #[rustc_error] diff --git a/src/test/ui/issues/issue-45697-1.rs b/src/test/ui/issues/issue-45697-1.rs index b8be209833a..c9b267ca5a1 100644 --- a/src/test/ui/issues/issue-45697-1.rs +++ b/src/test/ui/issues/issue-45697-1.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that assignments to an `&mut` pointer which is found in a // borrowed (but otherwise non-aliasable) location is illegal. -// compile-flags: -Z emit-end-regions -Z borrowck=compare -C overflow-checks=on +// compile-flags: -Z borrowck=compare -C overflow-checks=on struct S<'a> { pointer: &'a mut isize diff --git a/src/test/ui/issues/issue-45697-1.stderr b/src/test/ui/issues/issue-45697-1.stderr index cf108691a0e..8d390720608 100644 --- a/src/test/ui/issues/issue-45697-1.stderr +++ b/src/test/ui/issues/issue-45697-1.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Ast) - --> $DIR/issue-45697-1.rs:30:9 + --> $DIR/issue-45697-1.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); | - borrow of `*y.pointer` occurs here @@ -7,7 +7,7 @@ LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here error[E0503]: cannot use `*y.pointer` because it was mutably borrowed (Mir) - --> $DIR/issue-45697-1.rs:30:9 + --> $DIR/issue-45697-1.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); | ------ borrow of `y` occurs here @@ -18,7 +18,7 @@ LL | *z.pointer += 1; | --------------- borrow later used here error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir) - --> $DIR/issue-45697-1.rs:30:9 + --> $DIR/issue-45697-1.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); | ------ borrow of `*y.pointer` occurs here diff --git a/src/test/ui/issues/issue-45697.rs b/src/test/ui/issues/issue-45697.rs index 27acc2c89f7..5bb30432fed 100644 --- a/src/test/ui/issues/issue-45697.rs +++ b/src/test/ui/issues/issue-45697.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that assignments to an `&mut` pointer which is found in a // borrowed (but otherwise non-aliasable) location is illegal. -// compile-flags: -Z emit-end-regions -Z borrowck=compare -C overflow-checks=off +// compile-flags: -Z borrowck=compare -C overflow-checks=off struct S<'a> { pointer: &'a mut isize diff --git a/src/test/ui/issues/issue-45697.stderr b/src/test/ui/issues/issue-45697.stderr index a85972fcd7a..5085d36feba 100644 --- a/src/test/ui/issues/issue-45697.stderr +++ b/src/test/ui/issues/issue-45697.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Ast) - --> $DIR/issue-45697.rs:30:9 + --> $DIR/issue-45697.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); | - borrow of `*y.pointer` occurs here @@ -7,7 +7,7 @@ LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here error[E0503]: cannot use `*y.pointer` because it was mutably borrowed (Mir) - --> $DIR/issue-45697.rs:30:9 + --> $DIR/issue-45697.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); | ------ borrow of `y` occurs here @@ -18,7 +18,7 @@ LL | *z.pointer += 1; | --------------- borrow later used here error[E0506]: cannot assign to `*y.pointer` because it is borrowed (Mir) - --> $DIR/issue-45697.rs:30:9 + --> $DIR/issue-45697.rs:20:9 | LL | let z = copy_borrowed_ptr(&mut y); | ------ borrow of `*y.pointer` occurs here diff --git a/src/test/ui/issues/issue-45729-unsafe-in-generator.rs b/src/test/ui/issues/issue-45729-unsafe-in-generator.rs index b42ced07583..638a1994bb5 100644 --- a/src/test/ui/issues/issue-45729-unsafe-in-generator.rs +++ b/src/test/ui/issues/issue-45729-unsafe-in-generator.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators)] fn main() { diff --git a/src/test/ui/issues/issue-45729-unsafe-in-generator.stderr b/src/test/ui/issues/issue-45729-unsafe-in-generator.stderr index 3fad5209fd5..2aab6807aaa 100644 --- a/src/test/ui/issues/issue-45729-unsafe-in-generator.stderr +++ b/src/test/ui/issues/issue-45729-unsafe-in-generator.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-45729-unsafe-in-generator.rs:15:9 + --> $DIR/issue-45729-unsafe-in-generator.rs:5:9 | LL | *(1 as *mut u32) = 42; | ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer diff --git a/src/test/ui/issues/issue-45730.rs b/src/test/ui/issues/issue-45730.rs index d733c8e6de2..5709125e5f0 100644 --- a/src/test/ui/issues/issue-45730.rs +++ b/src/test/ui/issues/issue-45730.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt; fn main() { let x: *const _ = 0 as _; //~ ERROR cannot cast diff --git a/src/test/ui/issues/issue-45730.stderr b/src/test/ui/issues/issue-45730.stderr index aa5773e3dbf..4f2784c6c36 100644 --- a/src/test/ui/issues/issue-45730.stderr +++ b/src/test/ui/issues/issue-45730.stderr @@ -1,5 +1,5 @@ error[E0641]: cannot cast to a pointer of an unknown kind - --> $DIR/issue-45730.rs:13:23 + --> $DIR/issue-45730.rs:3:23 | LL | let x: *const _ = 0 as _; //~ ERROR cannot cast | ^^^^^- @@ -9,7 +9,7 @@ LL | let x: *const _ = 0 as _; //~ ERROR cannot cast = note: The type information given here is insufficient to check whether the pointer cast is valid error[E0641]: cannot cast to a pointer of an unknown kind - --> $DIR/issue-45730.rs:15:23 + --> $DIR/issue-45730.rs:5:23 | LL | let x: *const _ = 0 as *const _; //~ ERROR cannot cast | ^^^^^-------- @@ -19,7 +19,7 @@ LL | let x: *const _ = 0 as *const _; //~ ERROR cannot cast = note: The type information given here is insufficient to check whether the pointer cast is valid error[E0641]: cannot cast to a pointer of an unknown kind - --> $DIR/issue-45730.rs:18:13 + --> $DIR/issue-45730.rs:8:13 | LL | let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------ diff --git a/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed b/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed index e3287030408..b463848ae94 100644 --- a/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed +++ b/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix extern crate std as other_std; diff --git a/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs b/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs index f47ea474d51..1b491ac7efe 100644 --- a/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs +++ b/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix extern crate std; diff --git a/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr b/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr index 99c15976666..25aca4cb7ec 100644 --- a/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr +++ b/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr @@ -1,5 +1,5 @@ error[E0259]: the name `std` is defined multiple times - --> $DIR/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs:13:1 + --> $DIR/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs:3:1 | LL | extern crate std; | ^^^^^^^^^^^^^^^^^ `std` reimported here diff --git a/src/test/ui/issues/issue-45801.rs b/src/test/ui/issues/issue-45801.rs index 7823a7d6ba8..780baa89667 100644 --- a/src/test/ui/issues/issue-45801.rs +++ b/src/test/ui/issues/issue-45801.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Params; pub trait Plugin { diff --git a/src/test/ui/issues/issue-45801.stderr b/src/test/ui/issues/issue-45801.stderr index 91c14be8833..099cf4e3834 100644 --- a/src/test/ui/issues/issue-45801.stderr +++ b/src/test/ui/issues/issue-45801.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Params: Plugin` is not satisfied - --> $DIR/issue-45801.rs:31:9 + --> $DIR/issue-45801.rs:21:9 | LL | req.get_ref::(); | ^^^^^^^ the trait `Plugin` is not implemented for `Params` diff --git a/src/test/ui/issues/issue-45829/auxiliary/issue-45829-a.rs b/src/test/ui/issues/issue-45829/auxiliary/issue-45829-a.rs index 56eb1541e1f..e9f7fefb6fb 100644 --- a/src/test/ui/issues/issue-45829/auxiliary/issue-45829-a.rs +++ b/src/test/ui/issues/issue-45829/auxiliary/issue-45829-a.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub const FOO: usize = *&0; diff --git a/src/test/ui/issues/issue-45829/auxiliary/issue-45829-b.rs b/src/test/ui/issues/issue-45829/auxiliary/issue-45829-b.rs index 56eb1541e1f..e9f7fefb6fb 100644 --- a/src/test/ui/issues/issue-45829/auxiliary/issue-45829-b.rs +++ b/src/test/ui/issues/issue-45829/auxiliary/issue-45829-b.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub const FOO: usize = *&0; diff --git a/src/test/ui/issues/issue-45829/import-self.rs b/src/test/ui/issues/issue-45829/import-self.rs index 8b13ffd0076..6cb18e1cdb7 100644 --- a/src/test/ui/issues/issue-45829/import-self.rs +++ b/src/test/ui/issues/issue-45829/import-self.rs @@ -1,22 +1,19 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub struct A; pub struct B; } use foo::{self}; +//~^ ERROR is defined multiple times use foo as self; +//~^ ERROR expected identifier use foo::self; +//~^ ERROR `self` imports are only allowed within a { } list + +use foo::A; +use foo::{self as A}; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/import-self.stderr b/src/test/ui/issues/issue-45829/import-self.stderr index 985dc4e7131..2a7277bd1e9 100644 --- a/src/test/ui/issues/issue-45829/import-self.stderr +++ b/src/test/ui/issues/issue-45829/import-self.stderr @@ -1,17 +1,17 @@ error: expected identifier, found keyword `self` - --> $DIR/import-self.rs:18:12 + --> $DIR/import-self.rs:9:12 | LL | use foo as self; | ^^^^ expected identifier, found keyword error[E0429]: `self` imports are only allowed within a { } list - --> $DIR/import-self.rs:20:5 + --> $DIR/import-self.rs:12:5 | LL | use foo::self; | ^^^^^^^^^ error[E0255]: the name `foo` is defined multiple times - --> $DIR/import-self.rs:16:11 + --> $DIR/import-self.rs:6:11 | LL | mod foo { | ------- previous definition of the module `foo` here @@ -25,7 +25,21 @@ help: you can use `as` to change the binding name of the import LL | use foo::{self as other_foo}; | ^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error[E0252]: the name `A` is defined multiple times + --> $DIR/import-self.rs:16:11 + | +LL | use foo::A; + | ------ previous import of the type `A` here +LL | use foo::{self as A}; + | ^^^^^^^^^ `A` reimported here + | + = note: `A` must be defined only once in the type namespace of this module +help: you can use `as` to change the binding name of the import + | +LL | use foo::{self as OtherA}; + | ^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors -Some errors occurred: E0255, E0429. -For more information about an error, try `rustc --explain E0255`. +Some errors occurred: E0252, E0255, E0429. +For more information about an error, try `rustc --explain E0252`. diff --git a/src/test/ui/issues/issue-45829/import-twice.rs b/src/test/ui/issues/issue-45829/import-twice.rs index 785932e5ef4..e5a8bb7adf6 100644 --- a/src/test/ui/issues/issue-45829/import-twice.rs +++ b/src/test/ui/issues/issue-45829/import-twice.rs @@ -1,18 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub struct A; pub struct B; } use foo::{A, A}; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/import-twice.stderr b/src/test/ui/issues/issue-45829/import-twice.stderr index 566d47965f8..374b809647e 100644 --- a/src/test/ui/issues/issue-45829/import-twice.stderr +++ b/src/test/ui/issues/issue-45829/import-twice.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `A` is defined multiple times - --> $DIR/import-twice.rs:16:14 + --> $DIR/import-twice.rs:6:14 | LL | use foo::{A, A}; | - ^ `A` reimported here diff --git a/src/test/ui/issues/issue-45829/issue-45829.rs b/src/test/ui/issues/issue-45829/issue-45829.rs index eca46484699..1e76e4b140e 100644 --- a/src/test/ui/issues/issue-45829/issue-45829.rs +++ b/src/test/ui/issues/issue-45829/issue-45829.rs @@ -1,18 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub struct A; pub struct B; } use foo::{A, B as A}; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/issue-45829.stderr b/src/test/ui/issues/issue-45829/issue-45829.stderr index 872379d9fc3..a7ebc7171bc 100644 --- a/src/test/ui/issues/issue-45829/issue-45829.stderr +++ b/src/test/ui/issues/issue-45829/issue-45829.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `A` is defined multiple times - --> $DIR/issue-45829.rs:16:14 + --> $DIR/issue-45829.rs:6:14 | LL | use foo::{A, B as A}; | - ^^^^^^ `A` reimported here diff --git a/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs b/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs index 6befee331d5..aef7aa35cf5 100644 --- a/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs +++ b/src/test/ui/issues/issue-45829/rename-extern-vs-use.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-45829-b.rs mod foo { @@ -16,5 +6,6 @@ mod foo { use foo::bar; extern crate issue_45829_b as bar; +//~^ ERROR the name `bar` is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename-extern-vs-use.stderr b/src/test/ui/issues/issue-45829/rename-extern-vs-use.stderr index 6a513e90d95..98fd8a623fe 100644 --- a/src/test/ui/issues/issue-45829/rename-extern-vs-use.stderr +++ b/src/test/ui/issues/issue-45829/rename-extern-vs-use.stderr @@ -1,5 +1,5 @@ error[E0254]: the name `bar` is defined multiple times - --> $DIR/rename-extern-vs-use.rs:18:1 + --> $DIR/rename-extern-vs-use.rs:8:1 | LL | use foo::bar; | -------- previous import of the module `bar` here diff --git a/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs b/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs index 61c7e915fe8..0da8b826c90 100644 --- a/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs +++ b/src/test/ui/issues/issue-45829/rename-extern-with-tab.rs @@ -1,17 +1,8 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-45829-a.rs // aux-build:issue-45829-b.rs extern crate issue_45829_a; extern crate issue_45829_b as issue_45829_a; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename-extern-with-tab.stderr b/src/test/ui/issues/issue-45829/rename-extern-with-tab.stderr index 769be545706..2c4e8ce996b 100644 --- a/src/test/ui/issues/issue-45829/rename-extern-with-tab.stderr +++ b/src/test/ui/issues/issue-45829/rename-extern-with-tab.stderr @@ -1,5 +1,5 @@ error[E0259]: the name `issue_45829_a` is defined multiple times - --> $DIR/rename-extern-with-tab.rs:15:1 + --> $DIR/rename-extern-with-tab.rs:5:1 | LL | extern crate issue_45829_a; | --------------------------- previous import of the extern crate `issue_45829_a` here diff --git a/src/test/ui/issues/issue-45829/rename-extern.rs b/src/test/ui/issues/issue-45829/rename-extern.rs index 41e3e8bbe14..7dbda69322e 100644 --- a/src/test/ui/issues/issue-45829/rename-extern.rs +++ b/src/test/ui/issues/issue-45829/rename-extern.rs @@ -1,17 +1,8 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-45829-a.rs // aux-build:issue-45829-b.rs extern crate issue_45829_a; extern crate issue_45829_b as issue_45829_a; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename-extern.stderr b/src/test/ui/issues/issue-45829/rename-extern.stderr index ab77e592b4a..209ae2201f9 100644 --- a/src/test/ui/issues/issue-45829/rename-extern.stderr +++ b/src/test/ui/issues/issue-45829/rename-extern.stderr @@ -1,5 +1,5 @@ error[E0259]: the name `issue_45829_a` is defined multiple times - --> $DIR/rename-extern.rs:15:1 + --> $DIR/rename-extern.rs:5:1 | LL | extern crate issue_45829_a; | --------------------------- previous import of the extern crate `issue_45829_a` here diff --git a/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs b/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs index 9a2ec7a5273..0cf3a77fd7c 100644 --- a/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs +++ b/src/test/ui/issues/issue-45829/rename-use-vs-extern.rs @@ -1,16 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue-45829-b.rs extern crate issue_45829_b; use std as issue_45829_b; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename-use-vs-extern.stderr b/src/test/ui/issues/issue-45829/rename-use-vs-extern.stderr index 1395fbeea3b..6b917d55747 100644 --- a/src/test/ui/issues/issue-45829/rename-use-vs-extern.stderr +++ b/src/test/ui/issues/issue-45829/rename-use-vs-extern.stderr @@ -1,5 +1,5 @@ error[E0254]: the name `issue_45829_b` is defined multiple times - --> $DIR/rename-use-vs-extern.rs:14:5 + --> $DIR/rename-use-vs-extern.rs:4:5 | LL | extern crate issue_45829_b; | --------------------------- previous import of the extern crate `issue_45829_b` here diff --git a/src/test/ui/issues/issue-45829/rename-use-with-tabs.rs b/src/test/ui/issues/issue-45829/rename-use-with-tabs.rs index c1e4d908906..86c5fa00fdb 100644 --- a/src/test/ui/issues/issue-45829/rename-use-with-tabs.rs +++ b/src/test/ui/issues/issue-45829/rename-use-with-tabs.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub struct A; @@ -17,5 +7,6 @@ mod foo { } use foo::{A, bar::B as A}; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename-use-with-tabs.stderr b/src/test/ui/issues/issue-45829/rename-use-with-tabs.stderr index b80a692028a..3baad6cd72f 100644 --- a/src/test/ui/issues/issue-45829/rename-use-with-tabs.stderr +++ b/src/test/ui/issues/issue-45829/rename-use-with-tabs.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `A` is defined multiple times - --> $DIR/rename-use-with-tabs.rs:19:14 + --> $DIR/rename-use-with-tabs.rs:9:14 | LL | use foo::{A, bar::B as A}; | - ^^^^^^^^^^^^^^^^^ `A` reimported here diff --git a/src/test/ui/issues/issue-45829/rename-with-path.rs b/src/test/ui/issues/issue-45829/rename-with-path.rs index dbe8733735e..e278a878937 100644 --- a/src/test/ui/issues/issue-45829/rename-with-path.rs +++ b/src/test/ui/issues/issue-45829/rename-with-path.rs @@ -1,13 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::{collections::HashMap as A, sync::Arc as A}; +//~^ ERROR is defined multiple times fn main() {} diff --git a/src/test/ui/issues/issue-45829/rename-with-path.stderr b/src/test/ui/issues/issue-45829/rename-with-path.stderr index 2bc45f0a62d..ba83eeaa813 100644 --- a/src/test/ui/issues/issue-45829/rename-with-path.stderr +++ b/src/test/ui/issues/issue-45829/rename-with-path.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `A` is defined multiple times - --> $DIR/rename-with-path.rs:11:38 + --> $DIR/rename-with-path.rs:1:38 | LL | use std::{collections::HashMap as A, sync::Arc as A}; | ------------------------- ^^^^^^^^^^^^^^ `A` reimported here diff --git a/src/test/ui/issues/issue-45829/rename.rs b/src/test/ui/issues/issue-45829/rename.rs index 7c6d87b1d20..1c45956c66a 100644 --- a/src/test/ui/issues/issue-45829/rename.rs +++ b/src/test/ui/issues/issue-45829/rename.rs @@ -1,15 +1,6 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use core; use std as core; +//~^ ERROR is defined multiple times fn main() { 1 + 1; diff --git a/src/test/ui/issues/issue-45829/rename.stderr b/src/test/ui/issues/issue-45829/rename.stderr index ce13b457490..8f12d92d6fb 100644 --- a/src/test/ui/issues/issue-45829/rename.stderr +++ b/src/test/ui/issues/issue-45829/rename.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `core` is defined multiple times - --> $DIR/rename.rs:12:5 + --> $DIR/rename.rs:2:5 | LL | use core; | ---- previous import of the module `core` here diff --git a/src/test/ui/issues/issue-45965.rs b/src/test/ui/issues/issue-45965.rs index 0b82f2b32ff..15649f777e0 100644 --- a/src/test/ui/issues/issue-45965.rs +++ b/src/test/ui/issues/issue-45965.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let a = |r: f64| if r != 0.0(r != 0.0) { 1.0 } else { 0.0 }; //~^ ERROR expected function, found `{float}` diff --git a/src/test/ui/issues/issue-45965.stderr b/src/test/ui/issues/issue-45965.stderr index b7b5f76395a..f3eaa91769f 100644 --- a/src/test/ui/issues/issue-45965.stderr +++ b/src/test/ui/issues/issue-45965.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `{float}` - --> $DIR/issue-45965.rs:12:30 + --> $DIR/issue-45965.rs:2:30 | LL | let a = |r: f64| if r != 0.0(r != 0.0) { 1.0 } else { 0.0 }; | ^^^---------- diff --git a/src/test/ui/issues/issue-46023.ast.nll.stderr b/src/test/ui/issues/issue-46023.ast.nll.stderr index bda629d48af..05dbe42732b 100644 --- a/src/test/ui/issues/issue-46023.ast.nll.stderr +++ b/src/test/ui/issues/issue-46023.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-46023.rs:18:9 + --> $DIR/issue-46023.rs:8:9 | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/issues/issue-46023.ast.stderr b/src/test/ui/issues/issue-46023.ast.stderr index 42fe73d88e6..ace48f8be6b 100644 --- a/src/test/ui/issues/issue-46023.ast.stderr +++ b/src/test/ui/issues/issue-46023.ast.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure - --> $DIR/issue-46023.rs:18:9 + --> $DIR/issue-46023.rs:8:9 | LL | let x = 0; | - help: consider making `x` mutable: `mut x` diff --git a/src/test/ui/issues/issue-46023.mir.stderr b/src/test/ui/issues/issue-46023.mir.stderr index bda629d48af..05dbe42732b 100644 --- a/src/test/ui/issues/issue-46023.mir.stderr +++ b/src/test/ui/issues/issue-46023.mir.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-46023.rs:18:9 + --> $DIR/issue-46023.rs:8:9 | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/issues/issue-46023.rs b/src/test/ui/issues/issue-46023.rs index d5c8cd6d0f8..a9ecbbeea47 100644 --- a/src/test/ui/issues/issue-46023.rs +++ b/src/test/ui/issues/issue-46023.rs @@ -1,15 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir -//[mir]compile-flags: -Z emit-end-regions -Z borrowck=mir +//[mir]compile-flags: -Z borrowck=mir fn main() { let x = 0; diff --git a/src/test/ui/issues/issue-46036.rs b/src/test/ui/issues/issue-46036.rs index b5cdded4d30..c517bbe57e8 100644 --- a/src/test/ui/issues/issue-46036.rs +++ b/src/test/ui/issues/issue-46036.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 46036: [NLL] false edges on infinite loops // Infinite loops should create false edges to the cleanup block. #![feature(nll)] diff --git a/src/test/ui/issues/issue-46036.stderr b/src/test/ui/issues/issue-46036.stderr index 55f13a699d0..40a77f925b9 100644 --- a/src/test/ui/issues/issue-46036.stderr +++ b/src/test/ui/issues/issue-46036.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/issue-46036.rs:19:24 + --> $DIR/issue-46036.rs:9:24 | LL | let foo = Foo { x: &a }; //~ ERROR E0597 | ^^ diff --git a/src/test/ui/issues/issue-46112.rs b/src/test/ui/issues/issue-46112.rs index 202c67e584c..0cdd2c27ff7 100644 --- a/src/test/ui/issues/issue-46112.rs +++ b/src/test/ui/issues/issue-46112.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 46112: An extern crate pub re-exporting libcore was causing // paths rooted from `std` to be misrendered in the diagnostic output. diff --git a/src/test/ui/issues/issue-46112.stderr b/src/test/ui/issues/issue-46112.stderr index 796187b93aa..939d945c191 100644 --- a/src/test/ui/issues/issue-46112.stderr +++ b/src/test/ui/issues/issue-46112.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-46112.rs:19:21 + --> $DIR/issue-46112.rs:9:21 | LL | fn main() { test(Ok(())); } | ^^ diff --git a/src/test/ui/issues/issue-46186.rs b/src/test/ui/issues/issue-46186.rs index 1440b9e8cdc..9dfd61fdf3f 100644 --- a/src/test/ui/issues/issue-46186.rs +++ b/src/test/ui/issues/issue-46186.rs @@ -1,15 +1,6 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Struct { a: usize, -}; //~ ERROR expected item, found `;` +}; +//~^ ERROR expected item, found `;` fn main() {} diff --git a/src/test/ui/issues/issue-46186.stderr b/src/test/ui/issues/issue-46186.stderr index c64d5c68a79..eb0dbb8aa41 100644 --- a/src/test/ui/issues/issue-46186.stderr +++ b/src/test/ui/issues/issue-46186.stderr @@ -1,8 +1,8 @@ error: expected item, found `;` - --> $DIR/issue-46186.rs:13:2 + --> $DIR/issue-46186.rs:3:2 | -LL | }; //~ ERROR expected item, found `;` - | ^ help: consider removing this semicolon +LL | }; + | ^ help: remove this semicolon | = help: braced struct declarations are not followed by a semicolon diff --git a/src/test/ui/issues/issue-46302.rs b/src/test/ui/issues/issue-46302.rs index 6ae6b549b07..ba681d84eff 100644 --- a/src/test/ui/issues/issue-46302.rs +++ b/src/test/ui/issues/issue-46302.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() { let s = "abc"; let u: &str = if true { s[..2] } else { s }; diff --git a/src/test/ui/issues/issue-46302.stderr b/src/test/ui/issues/issue-46302.stderr index 8e399136fad..8eb3a4dda34 100644 --- a/src/test/ui/issues/issue-46302.stderr +++ b/src/test/ui/issues/issue-46302.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-46302.rs:13:27 + --> $DIR/issue-46302.rs:3:27 | LL | let u: &str = if true { s[..2] } else { s }; | ^^^^^^ diff --git a/src/test/ui/issues/issue-46311.rs b/src/test/ui/issues/issue-46311.rs index 82f55f2c142..1233a49c582 100644 --- a/src/test/ui/issues/issue-46311.rs +++ b/src/test/ui/issues/issue-46311.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { 'break: loop { //~ ERROR invalid label name `'break` } diff --git a/src/test/ui/issues/issue-46311.stderr b/src/test/ui/issues/issue-46311.stderr index 790399c75ee..8ceb1d62c25 100644 --- a/src/test/ui/issues/issue-46311.stderr +++ b/src/test/ui/issues/issue-46311.stderr @@ -1,5 +1,5 @@ error: invalid label name `'break` - --> $DIR/issue-46311.rs:12:5 + --> $DIR/issue-46311.rs:2:5 | LL | 'break: loop { //~ ERROR invalid label name `'break` | ^^^^^^ diff --git a/src/test/ui/issues/issue-46332.rs b/src/test/ui/issues/issue-46332.rs index d094497e246..bed74e3138a 100644 --- a/src/test/ui/issues/issue-46332.rs +++ b/src/test/ui/issues/issue-46332.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Original Levenshtein distance for both of this is 1. We improved accuracy with // additional case insensitive comparison. diff --git a/src/test/ui/issues/issue-46332.stderr b/src/test/ui/issues/issue-46332.stderr index 06553767cc9..812a50000d1 100644 --- a/src/test/ui/issues/issue-46332.stderr +++ b/src/test/ui/issues/issue-46332.stderr @@ -1,8 +1,8 @@ error[E0422]: cannot find struct, variant or union type `TyUInt` in this scope - --> $DIR/issue-46332.rs:19:5 + --> $DIR/issue-46332.rs:9:5 | LL | TyUInt {}; - | ^^^^^^ did you mean `TyUint`? + | ^^^^^^ help: a struct with a similar name exists: `TyUint` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-46438.rs b/src/test/ui/issues/issue-46438.rs index d84b5813385..d78b958463f 100644 --- a/src/test/ui/issues/issue-46438.rs +++ b/src/test/ui/issues/issue-46438.rs @@ -1,20 +1,10 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! m { ($my_type: ty) => { impl $my_type for u8 {} } } -trait Trait {} +trait Tr {} m!(Tr); diff --git a/src/test/ui/issues/issue-46438.stderr b/src/test/ui/issues/issue-46438.stderr index b0d6229d24b..c670459c781 100644 --- a/src/test/ui/issues/issue-46438.stderr +++ b/src/test/ui/issues/issue-46438.stderr @@ -1,5 +1,5 @@ error: expected a trait, found type - --> $DIR/issue-46438.rs:21:4 + --> $DIR/issue-46438.rs:11:4 | LL | m!(&'static u8); //~ ERROR expected a trait, found type | ^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-46471-1.rs b/src/test/ui/issues/issue-46471-1.rs index 0dbcdea89f9..3cf3f352849 100644 --- a/src/test/ui/issues/issue-46471-1.rs +++ b/src/test/ui/issues/issue-46471-1.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z emit-end-regions -Z borrowck=compare +// compile-flags: -Z borrowck=compare fn main() { let y = { diff --git a/src/test/ui/issues/issue-46471-1.stderr b/src/test/ui/issues/issue-46471-1.stderr index 3f098fa37ce..51026c9f2d8 100644 --- a/src/test/ui/issues/issue-46471-1.stderr +++ b/src/test/ui/issues/issue-46471-1.stderr @@ -1,5 +1,5 @@ error[E0597]: `z` does not live long enough (Ast) - --> $DIR/issue-46471-1.rs:16:14 + --> $DIR/issue-46471-1.rs:6:14 | LL | &mut z | ^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } | - borrowed value needs to live until here error[E0597]: `z` does not live long enough (Mir) - --> $DIR/issue-46471-1.rs:16:9 + --> $DIR/issue-46471-1.rs:6:9 | LL | &mut z | ^^^^^^ diff --git a/src/test/ui/issues/issue-46471.rs b/src/test/ui/issues/issue-46471.rs index 654a3d8f964..0905c8bb1eb 100644 --- a/src/test/ui/issues/issue-46471.rs +++ b/src/test/ui/issues/issue-46471.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z emit-end-regions -Z borrowck=compare +// compile-flags: -Z borrowck=compare fn foo() -> &'static u32 { let x = 0; diff --git a/src/test/ui/issues/issue-46471.stderr b/src/test/ui/issues/issue-46471.stderr index e6ec6831fe9..903b6585e8a 100644 --- a/src/test/ui/issues/issue-46471.stderr +++ b/src/test/ui/issues/issue-46471.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough (Ast) - --> $DIR/issue-46471.rs:15:6 + --> $DIR/issue-46471.rs:5:6 | LL | &x | ^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0515]: cannot return reference to local variable `x` (Mir) - --> $DIR/issue-46471.rs:15:5 + --> $DIR/issue-46471.rs:5:5 | LL | &x | ^^ returns a reference to data owned by the current function diff --git a/src/test/ui/issues/issue-46472.rs b/src/test/ui/issues/issue-46472.rs index 8137cd2dd89..88f97e99aea 100644 --- a/src/test/ui/issues/issue-46472.rs +++ b/src/test/ui/issues/issue-46472.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z emit-end-regions -Z borrowck=compare +// compile-flags: -Z borrowck=compare fn bar<'a>() -> &'a mut u32 { &mut 4 diff --git a/src/test/ui/issues/issue-46472.stderr b/src/test/ui/issues/issue-46472.stderr index b1d34ff24d4..2d81fa09cc2 100644 --- a/src/test/ui/issues/issue-46472.stderr +++ b/src/test/ui/issues/issue-46472.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough (Ast) - --> $DIR/issue-46472.rs:14:10 + --> $DIR/issue-46472.rs:4:10 | LL | &mut 4 | ^ temporary value does not live long enough @@ -7,14 +7,14 @@ LL | &mut 4 LL | } | - temporary value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:8... - --> $DIR/issue-46472.rs:13:8 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 3:8... + --> $DIR/issue-46472.rs:3:8 | LL | fn bar<'a>() -> &'a mut u32 { | ^^ error[E0515]: cannot return reference to temporary value (Mir) - --> $DIR/issue-46472.rs:14:5 + --> $DIR/issue-46472.rs:4:5 | LL | &mut 4 | ^^^^^- diff --git a/src/test/ui/issues/issue-46576.rs b/src/test/ui/issues/issue-46576.rs index 636a1e9a064..821d2724bc3 100644 --- a/src/test/ui/issues/issue-46576.rs +++ b/src/test/ui/issues/issue-46576.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no std::fs support #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-46576.stderr b/src/test/ui/issues/issue-46576.stderr index 0590de0bd35..4b66219dd3d 100644 --- a/src/test/ui/issues/issue-46576.stderr +++ b/src/test/ui/issues/issue-46576.stderr @@ -1,11 +1,11 @@ error: unused import: `BufRead` - --> $DIR/issue-46576.rs:17:15 + --> $DIR/issue-46576.rs:7:15 | LL | use std::io::{BufRead, BufReader, Read}; | ^^^^^^^ | note: lint level defined here - --> $DIR/issue-46576.rs:14:9 + --> $DIR/issue-46576.rs:4:9 | LL | #![deny(unused_imports)] | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-46604.ast.nll.stderr b/src/test/ui/issues/issue-46604.ast.nll.stderr index a4ee0d4e2a3..4f73a0f9d54 100644 --- a/src/test/ui/issues/issue-46604.ast.nll.stderr +++ b/src/test/ui/issues/issue-46604.ast.nll.stderr @@ -1,11 +1,11 @@ error[E0017]: references in statics may only refer to immutable values - --> $DIR/issue-46604.rs:14:25 + --> $DIR/issue-46604.rs:4:25 | LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //[ast]~ ERROR E0017 | ^^^^^^^^^^^^^^^^^^^^ statics require immutable values -error[E0594]: cannot assign to `buf[..]`, as `buf` is an immutable static item - --> $DIR/issue-46604.rs:20:5 +error[E0594]: cannot assign to `buf[_]`, as `buf` is an immutable static item + --> $DIR/issue-46604.rs:10:5 | LL | buf[0]=2; //[ast]~ ERROR E0389 | ^^^^^^^^ cannot assign diff --git a/src/test/ui/issues/issue-46604.ast.stderr b/src/test/ui/issues/issue-46604.ast.stderr index 713ba476a1c..14b9242ba0c 100644 --- a/src/test/ui/issues/issue-46604.ast.stderr +++ b/src/test/ui/issues/issue-46604.ast.stderr @@ -1,11 +1,11 @@ error[E0017]: references in statics may only refer to immutable values - --> $DIR/issue-46604.rs:14:25 + --> $DIR/issue-46604.rs:4:25 | LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //[ast]~ ERROR E0017 | ^^^^^^^^^^^^^^^^^^^^ statics require immutable values error[E0389]: cannot assign to data in a `&` reference - --> $DIR/issue-46604.rs:20:5 + --> $DIR/issue-46604.rs:10:5 | LL | buf[0]=2; //[ast]~ ERROR E0389 | ^^^^^^^^ assignment into an immutable reference diff --git a/src/test/ui/issues/issue-46604.mir.stderr b/src/test/ui/issues/issue-46604.mir.stderr index a4ee0d4e2a3..4f73a0f9d54 100644 --- a/src/test/ui/issues/issue-46604.mir.stderr +++ b/src/test/ui/issues/issue-46604.mir.stderr @@ -1,11 +1,11 @@ error[E0017]: references in statics may only refer to immutable values - --> $DIR/issue-46604.rs:14:25 + --> $DIR/issue-46604.rs:4:25 | LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7]; //[ast]~ ERROR E0017 | ^^^^^^^^^^^^^^^^^^^^ statics require immutable values -error[E0594]: cannot assign to `buf[..]`, as `buf` is an immutable static item - --> $DIR/issue-46604.rs:20:5 +error[E0594]: cannot assign to `buf[_]`, as `buf` is an immutable static item + --> $DIR/issue-46604.rs:10:5 | LL | buf[0]=2; //[ast]~ ERROR E0389 | ^^^^^^^^ cannot assign diff --git a/src/test/ui/issues/issue-46604.rs b/src/test/ui/issues/issue-46604.rs index dc14eca1e67..34fe3af3ab6 100644 --- a/src/test/ui/issues/issue-46604.rs +++ b/src/test/ui/issues/issue-46604.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed index 77171cad6e7..8668d8acd5b 100644 --- a/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed +++ b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![allow(unused)] diff --git a/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs index e5ea9b5ed09..c8494612ca3 100644 --- a/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs +++ b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![allow(unused)] diff --git a/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr index 9c492751ca1..1eeca3e75b0 100644 --- a/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr +++ b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:22:42 + --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:12:42 | LL | light_flows_our_war_of_mocking_words(behold as usize); | ^^^^^^^^^^^^^^^ @@ -11,7 +11,7 @@ LL | light_flows_our_war_of_mocking_words(behold as usize); found type `usize` error[E0308]: mismatched types - --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:24:42 + --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:14:42 | LL | light_flows_our_war_of_mocking_words(with_tears + 4); | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-46771.rs b/src/test/ui/issues/issue-46771.rs index f8bcd8861f3..2b5241e5ff6 100644 --- a/src/test/ui/issues/issue-46771.rs +++ b/src/test/ui/issues/issue-46771.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { struct Foo; (1 .. 2).find(|_| Foo(0) == 0); //~ ERROR expected function, found `main::Foo` diff --git a/src/test/ui/issues/issue-46771.stderr b/src/test/ui/issues/issue-46771.stderr index 90adb3ed73f..3c9c679ece4 100644 --- a/src/test/ui/issues/issue-46771.stderr +++ b/src/test/ui/issues/issue-46771.stderr @@ -1,5 +1,5 @@ error[E0618]: expected function, found `main::Foo` - --> $DIR/issue-46771.rs:13:23 + --> $DIR/issue-46771.rs:3:23 | LL | struct Foo; | ----------- `main::Foo` defined here diff --git a/src/test/ui/issues/issue-46843.rs b/src/test/ui/issues/issue-46843.rs index d88b4e568b0..a310de624d2 100644 --- a/src/test/ui/issues/issue-46843.rs +++ b/src/test/ui/issues/issue-46843.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Thing { This, That } fn non_const() -> Thing { diff --git a/src/test/ui/issues/issue-46843.stderr b/src/test/ui/issues/issue-46843.stderr index 9b752f41f59..d02561e4a27 100644 --- a/src/test/ui/issues/issue-46843.stderr +++ b/src/test/ui/issues/issue-46843.stderr @@ -1,11 +1,11 @@ error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants - --> $DIR/issue-46843.rs:17:26 + --> $DIR/issue-46843.rs:7:26 | LL | pub const Q: i32 = match non_const() { //~ ERROR E0015 | ^^^^^^^^^^^ error[E0019]: constant contains unimplemented expression type - --> $DIR/issue-46843.rs:18:5 + --> $DIR/issue-46843.rs:8:5 | LL | Thing::This => 1, //~ ERROR unimplemented expression type | ^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-46959.rs b/src/test/ui/issues/issue-46959.rs index 0e585378fa7..e1147ac99ac 100644 --- a/src/test/ui/issues/issue-46959.rs +++ b/src/test/ui/issues/issue-46959.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![deny(non_camel_case_types)] diff --git a/src/test/ui/issues/issue-46964.rs b/src/test/ui/issues/issue-46964.rs index 61c5a1a56ce..4688c9b0a1f 100644 --- a/src/test/ui/issues/issue-46964.rs +++ b/src/test/ui/issues/issue-46964.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass mod my_mod { #[derive(Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash)] diff --git a/src/test/ui/issues/issue-46983.rs b/src/test/ui/issues/issue-46983.rs index ebbd474b1c2..a5c1e17a58c 100644 --- a/src/test/ui/issues/issue-46983.rs +++ b/src/test/ui/issues/issue-46983.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] fn foo(x: &u32) -> &'static u32 { diff --git a/src/test/ui/issues/issue-46983.stderr b/src/test/ui/issues/issue-46983.stderr index c4f2b3eba7d..43d351ec905 100644 --- a/src/test/ui/issues/issue-46983.stderr +++ b/src/test/ui/issues/issue-46983.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/issue-46983.rs:14:5 + --> $DIR/issue-46983.rs:4:5 | LL | fn foo(x: &u32) -> &'static u32 { | ---- help: add explicit lifetime `'static` to the type of `x`: `&'static u32` diff --git a/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs b/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs index c59a9bc4170..6cd1f144359 100644 --- a/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs +++ b/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - type Guilty = bool; type FineDollars = u32; diff --git a/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr b/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr index 4a1c9b554a9..5e1b816defd 100644 --- a/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr +++ b/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr @@ -1,11 +1,11 @@ error[E0609]: no field `00` on type `Verdict` - --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:18:30 + --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:8:30 | LL | let _condemned = justice.00; - | ^^ did you mean `0`? + | ^^ help: a field with a similar name exists: `0` error[E0609]: no field `001` on type `Verdict` - --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:20:31 + --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:10:31 | LL | let _punishment = justice.001; | ^^^ unknown field diff --git a/src/test/ui/issues/issue-47094.rs b/src/test/ui/issues/issue-47094.rs index 2b78c7d9b70..6c78a3ba964 100644 --- a/src/test/ui/issues/issue-47094.rs +++ b/src/test/ui/issues/issue-47094.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #[repr(C,u8)] diff --git a/src/test/ui/issues/issue-47094.stderr b/src/test/ui/issues/issue-47094.stderr index f4b622a00fe..16bcec0c7bb 100644 --- a/src/test/ui/issues/issue-47094.stderr +++ b/src/test/ui/issues/issue-47094.stderr @@ -1,11 +1,11 @@ warning[E0566]: conflicting representation hints - --> $DIR/issue-47094.rs:13:8 + --> $DIR/issue-47094.rs:3:8 | LL | #[repr(C,u8)] | ^ ^^ warning[E0566]: conflicting representation hints - --> $DIR/issue-47094.rs:19:8 + --> $DIR/issue-47094.rs:9:8 | LL | #[repr(C)] | ^ diff --git a/src/test/ui/issues/issue-47184.rs b/src/test/ui/issues/issue-47184.rs index 95d9d858ecd..04f1146a8f8 100644 --- a/src/test/ui/issues/issue-47184.rs +++ b/src/test/ui/issues/issue-47184.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] fn main() { diff --git a/src/test/ui/issues/issue-47184.stderr b/src/test/ui/issues/issue-47184.stderr index 62ca682b1e3..2b4d576e726 100644 --- a/src/test/ui/issues/issue-47184.stderr +++ b/src/test/ui/issues/issue-47184.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-47184.rs:14:44 + --> $DIR/issue-47184.rs:4:44 | LL | let _vec: Vec<&'static String> = vec![&String::new()]; | -------------------- ^^^^^^^^^^^^^ - temporary value is freed at the end of this statement diff --git a/src/test/ui/issues/issue-47309.rs b/src/test/ui/issues/issue-47309.rs index 1b9ff36f714..a9aeecb61b6 100644 --- a/src/test/ui/issues/issue-47309.rs +++ b/src/test/ui/issues/issue-47309.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure that the mono-item collector does not crash when trying to // instantiate a default impl of a method with lifetime parameters. // See https://github.com/rust-lang/rust/issues/47309 diff --git a/src/test/ui/issues/issue-4736.rs b/src/test/ui/issues/issue-4736.rs index 19803079d02..799d2d48098 100644 --- a/src/test/ui/issues/issue-4736.rs +++ b/src/test/ui/issues/issue-4736.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct NonCopyable(()); fn main() { diff --git a/src/test/ui/issues/issue-4736.stderr b/src/test/ui/issues/issue-4736.stderr index 6c0acc0b63f..39c649ba3e0 100644 --- a/src/test/ui/issues/issue-4736.stderr +++ b/src/test/ui/issues/issue-4736.stderr @@ -1,8 +1,8 @@ error[E0560]: struct `NonCopyable` has no field named `p` - --> $DIR/issue-4736.rs:14:26 + --> $DIR/issue-4736.rs:4:26 | LL | let z = NonCopyable{ p: () }; //~ ERROR struct `NonCopyable` has no field named `p` - | ^ field does not exist - did you mean `0`? + | ^ help: a field with a similar name exists: `0` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-47377.rs b/src/test/ui/issues/issue-47377.rs index f294008cfd0..7a2e0fe6d21 100644 --- a/src/test/ui/issues/issue-47377.rs +++ b/src/test/ui/issues/issue-47377.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // ignore-tidy-tab fn main() { let b = "hello"; diff --git a/src/test/ui/issues/issue-47377.stderr b/src/test/ui/issues/issue-47377.stderr index 66c4a1277a0..1e945727746 100644 --- a/src/test/ui/issues/issue-47377.stderr +++ b/src/test/ui/issues/issue-47377.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `+` cannot be applied to type `&str` - --> $DIR/issue-47377.rs:13:12 + --> $DIR/issue-47377.rs:4:12 | LL | let _a = b + ", World!"; | ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings diff --git a/src/test/ui/issues/issue-47380.rs b/src/test/ui/issues/issue-47380.rs index e43a967253c..61e09662225 100644 --- a/src/test/ui/issues/issue-47380.rs +++ b/src/test/ui/issues/issue-47380.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. fn main() { let b = "hello"; println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!"; diff --git a/src/test/ui/issues/issue-47380.stderr b/src/test/ui/issues/issue-47380.stderr index 585a2ec64d0..84c5df3ca89 100644 --- a/src/test/ui/issues/issue-47380.stderr +++ b/src/test/ui/issues/issue-47380.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `+` cannot be applied to type `&str` - --> $DIR/issue-47380.rs:12:33 + --> $DIR/issue-47380.rs:3:33 | LL | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!"; | ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings diff --git a/src/test/ui/issues/issue-47412.rs b/src/test/ui/issues/issue-47412.rs index 683ef876f4e..2d1ea72280b 100644 --- a/src/test/ui/issues/issue-47412.rs +++ b/src/test/ui/issues/issue-47412.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Copy, Clone)] enum Void {} diff --git a/src/test/ui/issues/issue-47412.stderr b/src/test/ui/issues/issue-47412.stderr index d8a47efc0aa..0f003c44b70 100644 --- a/src/test/ui/issues/issue-47412.stderr +++ b/src/test/ui/issues/issue-47412.stderr @@ -1,5 +1,5 @@ error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/issue-47412.rs:21:11 + --> $DIR/issue-47412.rs:11:11 | LL | match u.void {} | ^^^^^^ access to union field @@ -7,7 +7,7 @@ LL | match u.void {} = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/issue-47412.rs:27:11 + --> $DIR/issue-47412.rs:17:11 | LL | match *ptr {} | ^^^^ dereference of raw pointer diff --git a/src/test/ui/issues/issue-47511.rs b/src/test/ui/issues/issue-47511.rs index df4ff301bc9..0f33b52577b 100644 --- a/src/test/ui/issues/issue-47511.rs +++ b/src/test/ui/issues/issue-47511.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #47511: anonymous lifetimes can appear // unconstrained in a return type, but only if they appear just once // in the input, as the input to a projection. diff --git a/src/test/ui/issues/issue-47511.stderr b/src/test/ui/issues/issue-47511.stderr index 6ee71fc6c73..42f2cd1bb14 100644 --- a/src/test/ui/issues/issue-47511.stderr +++ b/src/test/ui/issues/issue-47511.stderr @@ -1,5 +1,5 @@ error[E0581]: return type references an anonymous lifetime which is not constrained by the fn input types - --> $DIR/issue-47511.rs:15:15 + --> $DIR/issue-47511.rs:5:15 | LL | fn f(_: X) -> X { | ^ @@ -7,7 +7,7 @@ LL | fn f(_: X) -> X { = note: lifetimes appearing in an associated type are not considered constrained error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types - --> $DIR/issue-47511.rs:20:23 + --> $DIR/issue-47511.rs:10:23 | LL | fn g<'a>(_: X<'a>) -> X<'a> { | ^^^^^ diff --git a/src/test/ui/issues/issue-47623.rs b/src/test/ui/issues/issue-47623.rs index 0c886fdb52f..ad8aa4c1a2b 100644 --- a/src/test/ui/issues/issue-47623.rs +++ b/src/test/ui/issues/issue-47623.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use self; //~ERROR `self` imports are only allowed within a { } list fn main() {} diff --git a/src/test/ui/issues/issue-47623.stderr b/src/test/ui/issues/issue-47623.stderr index 8cbed1c293e..eb160ff86ae 100644 --- a/src/test/ui/issues/issue-47623.stderr +++ b/src/test/ui/issues/issue-47623.stderr @@ -1,5 +1,5 @@ error[E0429]: `self` imports are only allowed within a { } list - --> $DIR/issue-47623.rs:11:5 + --> $DIR/issue-47623.rs:1:5 | LL | use self; //~ERROR `self` imports are only allowed within a { } list | ^^^^ diff --git a/src/test/ui/issues/issue-47646.rs b/src/test/ui/issues/issue-47646.rs index 7a6d6dd3fe1..c3c07bf6411 100644 --- a/src/test/ui/issues/issue-47646.rs +++ b/src/test/ui/issues/issue-47646.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(nll)] diff --git a/src/test/ui/issues/issue-47646.stderr b/src/test/ui/issues/issue-47646.stderr index 116cb3be6b5..c30fedeea73 100644 --- a/src/test/ui/issues/issue-47646.stderr +++ b/src/test/ui/issues/issue-47646.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `heap` as immutable because it is also borrowed as mutable - --> $DIR/issue-47646.rs:22:30 + --> $DIR/issue-47646.rs:12:30 | LL | let borrow = heap.peek_mut(); | ---- mutable borrow occurs here diff --git a/src/test/ui/issues/issue-47673.rs b/src/test/ui/issues/issue-47673.rs index 7cef527acd7..6d7b8f9cc1b 100644 --- a/src/test/ui/issues/issue-47673.rs +++ b/src/test/ui/issues/issue-47673.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_imports)] diff --git a/src/test/ui/issues/issue-47703-1.rs b/src/test/ui/issues/issue-47703-1.rs index 446ca27a53e..9add314fdaf 100644 --- a/src/test/ui/issues/issue-47703-1.rs +++ b/src/test/ui/issues/issue-47703-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![feature(nll)] diff --git a/src/test/ui/issues/issue-47703-tuple.rs b/src/test/ui/issues/issue-47703-tuple.rs index c2b4673a09f..850771cffd0 100644 --- a/src/test/ui/issues/issue-47703-tuple.rs +++ b/src/test/ui/issues/issue-47703-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![feature(nll)] diff --git a/src/test/ui/issues/issue-47703.rs b/src/test/ui/issues/issue-47703.rs index 084eab05d68..06b17e931a9 100644 --- a/src/test/ui/issues/issue-47703.rs +++ b/src/test/ui/issues/issue-47703.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![feature(nll)] diff --git a/src/test/ui/issues/issue-47706-trait.rs b/src/test/ui/issues/issue-47706-trait.rs index 4ce653547da..8fb4e085568 100644 --- a/src/test/ui/issues/issue-47706-trait.rs +++ b/src/test/ui/issues/issue-47706-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait T { fn f(&self, _: ()) { None::<()>.map(Self::f); diff --git a/src/test/ui/issues/issue-47706-trait.stderr b/src/test/ui/issues/issue-47706-trait.stderr index 717b3eb0b56..5f8f8564249 100644 --- a/src/test/ui/issues/issue-47706-trait.stderr +++ b/src/test/ui/issues/issue-47706-trait.stderr @@ -1,5 +1,5 @@ error[E0593]: function is expected to take a single 0-tuple as argument, but it takes 2 distinct arguments - --> $DIR/issue-47706-trait.rs:13:20 + --> $DIR/issue-47706-trait.rs:3:20 | LL | fn f(&self, _: ()) { | ------------------ takes 2 distinct arguments diff --git a/src/test/ui/issues/issue-47706.rs b/src/test/ui/issues/issue-47706.rs index 9c521dd6479..f47c1e69444 100644 --- a/src/test/ui/issues/issue-47706.rs +++ b/src/test/ui/issues/issue-47706.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo { foo: Option, } diff --git a/src/test/ui/issues/issue-47706.stderr b/src/test/ui/issues/issue-47706.stderr index 0a5c8beccd1..fa2e00cde4d 100644 --- a/src/test/ui/issues/issue-47706.stderr +++ b/src/test/ui/issues/issue-47706.stderr @@ -1,5 +1,5 @@ error[E0593]: function is expected to take 1 argument, but it takes 2 arguments - --> $DIR/issue-47706.rs:21:18 + --> $DIR/issue-47706.rs:11:18 | LL | pub fn new(foo: Option, _: ()) -> Foo { | ------------------------------------------ takes 2 arguments @@ -8,7 +8,7 @@ LL | self.foo.map(Foo::new) | ^^^ expected function that takes 1 argument error[E0593]: function is expected to take 0 arguments, but it takes 1 argument - --> $DIR/issue-47706.rs:37:5 + --> $DIR/issue-47706.rs:27:5 | LL | Bar(i32), | -------- takes 1 argument @@ -17,7 +17,7 @@ LL | foo(Qux::Bar); | ^^^ expected function that takes 0 arguments | note: required by `foo` - --> $DIR/issue-47706.rs:30:1 + --> $DIR/issue-47706.rs:20:1 | LL | / fn foo(f: F) LL | | where diff --git a/src/test/ui/issues/issue-47715.rs b/src/test/ui/issues/issue-47715.rs index b6b720f088a..478ac6a2e89 100644 --- a/src/test/ui/issues/issue-47715.rs +++ b/src/test/ui/issues/issue-47715.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo {} trait Bar {} diff --git a/src/test/ui/issues/issue-47715.stderr b/src/test/ui/issues/issue-47715.stderr index 29b6afe7d07..296de362db1 100644 --- a/src/test/ui/issues/issue-47715.stderr +++ b/src/test/ui/issues/issue-47715.stderr @@ -1,23 +1,23 @@ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/issue-47715.rs:19:37 + --> $DIR/issue-47715.rs:9:37 | LL | struct Container> { | ^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/issue-47715.rs:24:30 + --> $DIR/issue-47715.rs:14:30 | LL | enum Enum> { | ^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/issue-47715.rs:29:32 + --> $DIR/issue-47715.rs:19:32 | LL | union Union + Copy> { | ^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/issue-47715.rs:34:30 + --> $DIR/issue-47715.rs:24:30 | LL | type Type> = T; | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-47722.rs b/src/test/ui/issues/issue-47722.rs index 39fbe33d823..c9bc6147aa9 100644 --- a/src/test/ui/issues/issue-47722.rs +++ b/src/test/ui/issues/issue-47722.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-47789.rs b/src/test/ui/issues/issue-47789.rs index 57957aed3db..d15a27a2a2e 100644 --- a/src/test/ui/issues/issue-47789.rs +++ b/src/test/ui/issues/issue-47789.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/ui/issues/issue-48131.rs b/src/test/ui/issues/issue-48131.rs index 9eb567a5d3e..b3cc350acf5 100644 --- a/src/test/ui/issues/issue-48131.rs +++ b/src/test/ui/issues/issue-48131.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This note is annotated because the purpose of the test // is to ensure that certain other notes are not generated. #![deny(unused_unsafe)] //~ NOTE diff --git a/src/test/ui/issues/issue-48131.stderr b/src/test/ui/issues/issue-48131.stderr index d0ba1a1c37d..6e454173f8b 100644 --- a/src/test/ui/issues/issue-48131.stderr +++ b/src/test/ui/issues/issue-48131.stderr @@ -1,17 +1,17 @@ error: unnecessary `unsafe` block - --> $DIR/issue-48131.rs:18:9 + --> $DIR/issue-48131.rs:8:9 | LL | unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe` | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here - --> $DIR/issue-48131.rs:13:9 + --> $DIR/issue-48131.rs:3:9 | LL | #![deny(unused_unsafe)] //~ NOTE | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/issue-48131.rs:29:13 + --> $DIR/issue-48131.rs:19:13 | LL | unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe` | ^^^^^^ unnecessary `unsafe` block diff --git a/src/test/ui/issues/issue-48132.rs b/src/test/ui/issues/issue-48132.rs index 87fee986de7..b3cef78f3e6 100644 --- a/src/test/ui/issues/issue-48132.rs +++ b/src/test/ui/issues/issue-48132.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #48132. This was failing due to problems around // the projection caching and dropck type enumeration. diff --git a/src/test/ui/issues/issue-48179.rs b/src/test/ui/issues/issue-48179.rs index 745b59e0658..245f13b2b60 100644 --- a/src/test/ui/issues/issue-48179.rs +++ b/src/test/ui/issues/issue-48179.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #48132. This was failing due to problems around // the projection caching and dropck type enumeration. diff --git a/src/test/ui/issues/issue-48276.rs b/src/test/ui/issues/issue-48276.rs index 30d11a2e37f..f55c056fa67 100644 --- a/src/test/ui/issues/issue-48276.rs +++ b/src/test/ui/issues/issue-48276.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #48276 - ICE when self type does not match what is // required by a trait and regions are involved. diff --git a/src/test/ui/issues/issue-48276.stderr b/src/test/ui/issues/issue-48276.stderr index db4894aa691..370905ee0df 100644 --- a/src/test/ui/issues/issue-48276.stderr +++ b/src/test/ui/issues/issue-48276.stderr @@ -1,5 +1,5 @@ error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait - --> $DIR/issue-48276.rs:21:5 + --> $DIR/issue-48276.rs:11:5 | LL | fn from(a: A) -> Self; | ---------------------- trait method declared without `&self` @@ -8,7 +8,7 @@ LL | fn from(self: &'a Self) -> &'b str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait - --> $DIR/issue-48276.rs:30:5 + --> $DIR/issue-48276.rs:20:5 | LL | fn from(&self) -> B { | ^^^^^^^^^^^^^^^^^^^ `&self` used in impl @@ -16,7 +16,7 @@ LL | fn from(&self) -> B { = note: `from` from trait: `fn(T) -> Self` error[E0185]: method `from` has a `&self` declaration in the impl, but not in the trait - --> $DIR/issue-48276.rs:37:5 + --> $DIR/issue-48276.rs:27:5 | LL | fn from(&self) -> &'static str { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl diff --git a/src/test/ui/issues/issue-4830.rs b/src/test/ui/issues/issue-4830.rs index 274305dfa78..cf94094a798 100644 --- a/src/test/ui/issues/issue-4830.rs +++ b/src/test/ui/issues/issue-4830.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-48364.rs b/src/test/ui/issues/issue-48364.rs index 82cb722a656..14ee75e7c9c 100644 --- a/src/test/ui/issues/issue-48364.rs +++ b/src/test/ui/issues/issue-48364.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() -> bool { b"".starts_with(stringify!(foo)) //~^ ERROR mismatched types diff --git a/src/test/ui/issues/issue-48364.stderr b/src/test/ui/issues/issue-48364.stderr index b420654a32d..7a1ba5bb193 100644 --- a/src/test/ui/issues/issue-48364.stderr +++ b/src/test/ui/issues/issue-48364.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-48364.rs:12:21 + --> $DIR/issue-48364.rs:2:21 | LL | b"".starts_with(stringify!(foo)) | ^^^^^^^^^^^^^^^ expected slice, found str diff --git a/src/test/ui/issues/issue-48551.rs b/src/test/ui/issues/issue-48551.rs index 2da1059d74a..b5dd673b047 100644 --- a/src/test/ui/issues/issue-48551.rs +++ b/src/test/ui/issues/issue-48551.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // Regression test for #48551. Covers a case where duplicate candidates // arose during associated type projection. diff --git a/src/test/ui/issues/issue-48636.fixed b/src/test/ui/issues/issue-48636.fixed index 0ff33c42b1c..39e6c98b1f5 100644 --- a/src/test/ui/issues/issue-48636.fixed +++ b/src/test/ui/issues/issue-48636.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-48636.rs b/src/test/ui/issues/issue-48636.rs index 2ac41211347..bcf57772b51 100644 --- a/src/test/ui/issues/issue-48636.rs +++ b/src/test/ui/issues/issue-48636.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-48636.stderr b/src/test/ui/issues/issue-48636.stderr index c4706f982ed..de335d2c29b 100644 --- a/src/test/ui/issues/issue-48636.stderr +++ b/src/test/ui/issues/issue-48636.stderr @@ -1,5 +1,5 @@ error[E0585]: found a documentation comment that doesn't document anything - --> $DIR/issue-48636.rs:17:5 + --> $DIR/issue-48636.rs:7:5 | LL | x: u8 | - help: missing comma here: `,` diff --git a/src/test/ui/issues/issue-48728.rs b/src/test/ui/issues/issue-48728.rs index 251ebf5d418..8405a30478b 100644 --- a/src/test/ui/issues/issue-48728.rs +++ b/src/test/ui/issues/issue-48728.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #48728, an ICE that occurred computing // coherence "help" information. diff --git a/src/test/ui/issues/issue-48728.stderr b/src/test/ui/issues/issue-48728.stderr index 937266d6d55..e2f549ac425 100644 --- a/src/test/ui/issues/issue-48728.stderr +++ b/src/test/ui/issues/issue-48728.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::clone::Clone` for type `Node<[_]>`: - --> $DIR/issue-48728.rs:14:10 + --> $DIR/issue-48728.rs:4:10 | LL | #[derive(Clone)] //~ ERROR conflicting implementations of trait `std::clone::Clone` | ^^^^^ conflicting implementation for `Node<[_]>` diff --git a/src/test/ui/issues/issue-48803.rs b/src/test/ui/issues/issue-48803.rs index c6d14ace8b3..bc1bc29c98f 100644 --- a/src/test/ui/issues/issue-48803.rs +++ b/src/test/ui/issues/issue-48803.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] fn flatten<'a, 'b, T>(x: &'a &'b T) -> &'a T { diff --git a/src/test/ui/issues/issue-48803.stderr b/src/test/ui/issues/issue-48803.stderr index b37e2c07d23..2635520ef07 100644 --- a/src/test/ui/issues/issue-48803.stderr +++ b/src/test/ui/issues/issue-48803.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/issue-48803.rs:22:5 + --> $DIR/issue-48803.rs:12:5 | LL | let y = &x; | -- borrow of `x` occurs here diff --git a/src/test/ui/issues/issue-48838.rs b/src/test/ui/issues/issue-48838.rs index ab52a32869f..057a424dfef 100644 --- a/src/test/ui/issues/issue-48838.rs +++ b/src/test/ui/issues/issue-48838.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Functions { Square = |x| x, //~ ERROR mismatched types } diff --git a/src/test/ui/issues/issue-48838.stderr b/src/test/ui/issues/issue-48838.stderr index 2c7e682a982..32eea5e5fbb 100644 --- a/src/test/ui/issues/issue-48838.stderr +++ b/src/test/ui/issues/issue-48838.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/issue-48838.rs:12:14 + --> $DIR/issue-48838.rs:2:14 | LL | Square = |x| x, //~ ERROR mismatched types | ^^^^^ expected isize, found closure | = note: expected type `isize` - found type `[closure@$DIR/issue-48838.rs:12:14: 12:19]` + found type `[closure@$DIR/issue-48838.rs:2:14: 2:19]` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-49040.rs b/src/test/ui/issues/issue-49040.rs index 866ecd9e1d9..a5f05d2824e 100644 --- a/src/test/ui/issues/issue-49040.rs +++ b/src/test/ui/issues/issue-49040.rs @@ -1,12 +1,2 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)]; //~ ERROR expected item, found `;` -fn main() {} +fn foo() {} diff --git a/src/test/ui/issues/issue-49040.stderr b/src/test/ui/issues/issue-49040.stderr index b6f624dac7d..12e78e2f3bc 100644 --- a/src/test/ui/issues/issue-49040.stderr +++ b/src/test/ui/issues/issue-49040.stderr @@ -1,8 +1,13 @@ error: expected item, found `;` - --> $DIR/issue-49040.rs:11:28 + --> $DIR/issue-49040.rs:1:28 | LL | #![allow(unused_variables)]; //~ ERROR expected item, found `;` - | ^ help: consider removing this semicolon + | ^ help: remove this semicolon -error: aborting due to previous error +error[E0601]: `main` function not found in crate `issue_49040` + | + = note: consider adding a `main` function to `$DIR/issue-49040.rs` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/issues/issue-49074.rs b/src/test/ui/issues/issue-49074.rs index d255fac5427..ad66e421c6b 100644 --- a/src/test/ui/issues/issue-49074.rs +++ b/src/test/ui/issues/issue-49074.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that unknown attribute error is shown even if there are unresolved macros. #[marco_use] // typo @@ -19,5 +9,5 @@ mod foo { } fn main() { - bar!(); + bar!(); //~ ERROR cannot find macro `bar!` in this scope } diff --git a/src/test/ui/issues/issue-49074.stderr b/src/test/ui/issues/issue-49074.stderr index 6c9d1eac356..a25d8ee3526 100644 --- a/src/test/ui/issues/issue-49074.stderr +++ b/src/test/ui/issues/issue-49074.stderr @@ -1,11 +1,19 @@ error[E0658]: The attribute `marco_use` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/issue-49074.rs:13:3 + --> $DIR/issue-49074.rs:3:3 | LL | #[marco_use] // typo - | ^^^^^^^^^ + | ^^^^^^^^^ help: a built-in attribute with a similar name exists: `macro_use` | = help: add #![feature(custom_attribute)] to the crate attributes to enable -error: aborting due to previous error +error: cannot find macro `bar!` in this scope + --> $DIR/issue-49074.rs:12:4 + | +LL | bar!(); //~ ERROR cannot find macro `bar!` in this scope + | ^^^ + | + = help: have you added the `#[macro_use]` on the module/import? + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issues/issue-49257.rs b/src/test/ui/issues/issue-49257.rs index f288a2b2174..a7fa19d52fd 100644 --- a/src/test/ui/issues/issue-49257.rs +++ b/src/test/ui/issues/issue-49257.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for #49257: // emits good diagnostics for `..` pattern fragments not in the last position. diff --git a/src/test/ui/issues/issue-49257.stderr b/src/test/ui/issues/issue-49257.stderr index 40179832b49..0bccfbbf7e5 100644 --- a/src/test/ui/issues/issue-49257.stderr +++ b/src/test/ui/issues/issue-49257.stderr @@ -1,5 +1,5 @@ error: expected `}`, found `,` - --> $DIR/issue-49257.rs:20:19 + --> $DIR/issue-49257.rs:10:19 | LL | let Point { .., y, } = p; //~ ERROR expected `}`, found `,` | --^ @@ -8,11 +8,11 @@ LL | let Point { .., y, } = p; //~ ERROR expected `}`, found `,` | `..` must be at the end and cannot have a trailing comma help: move the `..` to the end of the field list | -LL | let Point { y, .. } = p; //~ ERROR expected `}`, found `,` - | -- ^^^^ +LL | let Point { y, .. } = p; //~ ERROR expected `}`, found `,` + | -- ^^^^ error: expected `}`, found `,` - --> $DIR/issue-49257.rs:21:19 + --> $DIR/issue-49257.rs:11:19 | LL | let Point { .., y } = p; //~ ERROR expected `}`, found `,` | --^ @@ -21,11 +21,11 @@ LL | let Point { .., y } = p; //~ ERROR expected `}`, found `,` | `..` must be at the end and cannot have a trailing comma help: move the `..` to the end of the field list | -LL | let Point { y , .. } = p; //~ ERROR expected `}`, found `,` - | -- ^^^^^^ +LL | let Point { y , .. } = p; //~ ERROR expected `}`, found `,` + | -- ^^^^^^ error: expected `}`, found `,` - --> $DIR/issue-49257.rs:22:19 + --> $DIR/issue-49257.rs:12:19 | LL | let Point { .., } = p; //~ ERROR expected `}`, found `,` | --^ diff --git a/src/test/ui/issues/issue-4935.rs b/src/test/ui/issues/issue-4935.rs index 5b6e2c75a1c..3b258c35682 100644 --- a/src/test/ui/issues/issue-4935.rs +++ b/src/test/ui/issues/issue-4935.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #4935 fn foo(a: usize) {} diff --git a/src/test/ui/issues/issue-4935.stderr b/src/test/ui/issues/issue-4935.stderr index 25efd54443a..42869ab4831 100644 --- a/src/test/ui/issues/issue-4935.stderr +++ b/src/test/ui/issues/issue-4935.stderr @@ -1,5 +1,5 @@ error[E0061]: this function takes 1 parameter but 2 parameters were supplied - --> $DIR/issue-4935.rs:15:13 + --> $DIR/issue-4935.rs:5:13 | LL | fn foo(a: usize) {} | ---------------- defined here diff --git a/src/test/ui/issues/issue-49556.rs b/src/test/ui/issues/issue-49556.rs index 7f7b349c3a0..b8fcc645a59 100644 --- a/src/test/ui/issues/issue-49556.rs +++ b/src/test/ui/issues/issue-49556.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass fn iter<'a>(data: &'a [usize]) -> impl Iterator + 'a { data.iter() diff --git a/src/test/ui/issues/issue-49579.rs b/src/test/ui/issues/issue-49579.rs index 83ebc923155..34f277af01e 100644 --- a/src/test/ui/issues/issue-49579.rs +++ b/src/test/ui/issues/issue-49579.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // ignore-emscripten no i128 support diff --git a/src/test/ui/issues/issue-4968.rs b/src/test/ui/issues/issue-4968.rs index 77588e5c221..383b9ecd466 100644 --- a/src/test/ui/issues/issue-4968.rs +++ b/src/test/ui/issues/issue-4968.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #4968 const A: (isize,isize) = (4,2); @@ -16,5 +6,5 @@ fn main() { //~^ ERROR mismatched types //~| expected type `{integer}` //~| found type `(isize, isize)` - //~| expected integral variable, found tuple + //~| expected integer, found tuple } diff --git a/src/test/ui/issues/issue-4968.stderr b/src/test/ui/issues/issue-4968.stderr index a9d58eda6e8..a925783723b 100644 --- a/src/test/ui/issues/issue-4968.stderr +++ b/src/test/ui/issues/issue-4968.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/issue-4968.rs:15:16 + --> $DIR/issue-4968.rs:5:16 | LL | match 42 { A => () } - | ^ expected integral variable, found tuple + | ^ expected integer, found tuple | = note: expected type `{integer}` found type `(isize, isize)` diff --git a/src/test/ui/issues/issue-4972.rs b/src/test/ui/issues/issue-4972.rs index f384dba7c9e..9c95a979476 100644 --- a/src/test/ui/issues/issue-4972.rs +++ b/src/test/ui/issues/issue-4972.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/ui/issues/issue-4972.stderr b/src/test/ui/issues/issue-4972.stderr index e9c1bdb6f86..30664c90ce8 100644 --- a/src/test/ui/issues/issue-4972.stderr +++ b/src/test/ui/issues/issue-4972.stderr @@ -1,5 +1,5 @@ error[E0033]: type `std::boxed::Box<(dyn MyTrait + 'static)>` cannot be dereferenced - --> $DIR/issue-4972.rs:24:25 + --> $DIR/issue-4972.rs:14:25 | LL | TraitWrapper::A(box ref map) => map, //~ ERROR cannot be dereferenced | ^^^^^^^^^^^ type `std::boxed::Box<(dyn MyTrait + 'static)>` cannot be dereferenced diff --git a/src/test/ui/issues/issue-49824.nll.stderr b/src/test/ui/issues/issue-49824.nll.stderr index 555558c99d9..4e2f3f59a64 100644 --- a/src/test/ui/issues/issue-49824.nll.stderr +++ b/src/test/ui/issues/issue-49824.nll.stderr @@ -1,5 +1,5 @@ warning: captured variable cannot escape `FnMut` closure body - --> $DIR/issue-49824.rs:22:9 + --> $DIR/issue-49824.rs:12:9 | LL | || { | - inferred to be a `FnMut` closure @@ -10,12 +10,11 @@ LL | | } | = note: `FnMut` closures only have access to their captured variables while they are executing... = note: ...therefore, they cannot allow references to captured variables to escape - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future error: compilation successful - --> $DIR/issue-49824.rs:18:1 + --> $DIR/issue-49824.rs:8:1 | LL | / fn main() { LL | | //~^ compilation successful diff --git a/src/test/ui/issues/issue-49824.rs b/src/test/ui/issues/issue-49824.rs index 1f3e5752884..58cada5d31e 100644 --- a/src/test/ui/issues/issue-49824.rs +++ b/src/test/ui/issues/issue-49824.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] // This test checks that a failure occurs with NLL but does not fail with the diff --git a/src/test/ui/issues/issue-49824.stderr b/src/test/ui/issues/issue-49824.stderr index b6cafe5e9e9..f487c363ea6 100644 --- a/src/test/ui/issues/issue-49824.stderr +++ b/src/test/ui/issues/issue-49824.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/issue-49824.rs:18:1 + --> $DIR/issue-49824.rs:8:1 | LL | / fn main() { LL | | //~^ compilation successful diff --git a/src/test/ui/issues/issue-49851/compiler-builtins-error.rs b/src/test/ui/issues/issue-49851/compiler-builtins-error.rs index db82f22c6d9..0163da0771e 100644 --- a/src/test/ui/issues/issue-49851/compiler-builtins-error.rs +++ b/src/test/ui/issues/issue-49851/compiler-builtins-error.rs @@ -1,13 +1,6 @@ //~ ERROR 1:1: 1:1: can't find crate for `core` [E0463] -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // compile-flags: --target thumbv7em-none-eabihf #![deny(unsafe_code)] diff --git a/src/test/ui/issues/issue-49934.rs b/src/test/ui/issues/issue-49934.rs index 3e30e7a6450..59ca6cc292d 100644 --- a/src/test/ui/issues/issue-49934.rs +++ b/src/test/ui/issues/issue-49934.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(stmt_expr_attributes)] diff --git a/src/test/ui/issues/issue-49934.stderr b/src/test/ui/issues/issue-49934.stderr index 298230b8b29..295f4f1b559 100644 --- a/src/test/ui/issues/issue-49934.stderr +++ b/src/test/ui/issues/issue-49934.stderr @@ -1,5 +1,5 @@ warning: `#[derive]` does nothing on macro invocations - --> $DIR/issue-49934.rs:30:5 + --> $DIR/issue-49934.rs:20:5 | LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ @@ -7,43 +7,43 @@ LL | #[derive(Debug)] = note: this may become a hard error in a future release warning: unused attribute - --> $DIR/issue-49934.rs:16:8 + --> $DIR/issue-49934.rs:6:8 | LL | fn foo<#[derive(Debug)] T>() { //~ WARN unused attribute | ^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-49934.rs:14:9 + --> $DIR/issue-49934.rs:4:9 | LL | #![warn(unused_attributes)] //~ NOTE lint level defined here | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-49934.rs:18:9 + --> $DIR/issue-49934.rs:8:9 | LL | #[derive(Debug)] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-49934.rs:36:5 + --> $DIR/issue-49934.rs:26:5 | LL | #[derive(Debug)] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-49934.rs:40:5 + --> $DIR/issue-49934.rs:30:5 | LL | #[derive(Debug)] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-49934.rs:44:13 + --> $DIR/issue-49934.rs:34:13 | LL | let _ = #[derive(Debug)] "Hello, world!"; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-49934.rs:49:9 + --> $DIR/issue-49934.rs:39:9 | LL | #[derive(Debug)] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-50187.rs b/src/test/ui/issues/issue-50187.rs index ccb2742841c..cda1c4d5faa 100644 --- a/src/test/ui/issues/issue-50187.rs +++ b/src/test/ui/issues/issue-50187.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(decl_macro)] diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.rs index 4c67fb3bef1..f82eafcaffa 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.rs +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(inner_deref)] fn main() { diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr index 3e255ca6539..e916b7d7d34 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/option-deref.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `deref` found for type `std::option::Option<{integer}>` in the current scope - --> $DIR/option-deref.rs:14:29 + --> $DIR/option-deref.rs:4:29 | LL | let _result = &Some(42).deref(); | ^^^^^ diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.rs index 5d1e7472d8f..4be2000f058 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.rs +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(inner_deref)] fn main() { diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr index 57b5d07afb4..96d6814b0fe 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-err.stderr @@ -1,12 +1,11 @@ error[E0599]: no method named `deref_err` found for type `std::result::Result<_, {integer}>` in the current scope - --> $DIR/result-deref-err.rs:14:28 + --> $DIR/result-deref-err.rs:4:28 | LL | let _result = &Err(41).deref_err(); - | ^^^^^^^^^ + | ^^^^^^^^^ help: did you mean: `deref_ok` | = note: the method `deref_err` exists but the following trait bounds were not satisfied: `{integer} : std::ops::Deref` - = help: did you mean `deref_ok`? error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.rs index bee8e0c062b..a706cde7348 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.rs +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(inner_deref)] fn main() { diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr index ee0c439715b..59370512354 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref-ok.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `deref_ok` found for type `std::result::Result<{integer}, _>` in the current scope - --> $DIR/result-deref-ok.rs:14:27 + --> $DIR/result-deref-ok.rs:4:27 | LL | let _result = &Ok(42).deref_ok(); | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.rs index 73bdf0b9209..43a68e37dd0 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.rs +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(inner_deref)] fn main() { diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr index 46fee660f66..05baa7907fa 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-deref.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `deref` found for type `std::result::Result<{integer}, _>` in the current scope - --> $DIR/result-deref.rs:14:27 + --> $DIR/result-deref.rs:4:27 | LL | let _result = &Ok(42).deref(); | ^^^^^ diff --git a/src/test/ui/issues/issue-50403.rs b/src/test/ui/issues/issue-50403.rs index 8d4c6c5140f..012057fc280 100644 --- a/src/test/ui/issues/issue-50403.rs +++ b/src/test/ui/issues/issue-50403.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(concat_idents)] fn main() { diff --git a/src/test/ui/issues/issue-50403.stderr b/src/test/ui/issues/issue-50403.stderr index f2871c72e25..f84d9d7769d 100644 --- a/src/test/ui/issues/issue-50403.stderr +++ b/src/test/ui/issues/issue-50403.stderr @@ -1,5 +1,5 @@ error: concat_idents! takes 1 or more arguments. - --> $DIR/issue-50403.rs:14:13 + --> $DIR/issue-50403.rs:4:13 | LL | let x = concat_idents!(); //~ ERROR concat_idents! takes 1 or more arguments | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-50471.rs b/src/test/ui/issues/issue-50471.rs index ce2947144af..6868d481962 100644 --- a/src/test/ui/issues/issue-50471.rs +++ b/src/test/ui/issues/issue-50471.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass fn main() { diff --git a/src/test/ui/issues/issue-50480.rs b/src/test/ui/issues/issue-50480.rs index 565ba8dd4de..31dbb75ec1c 100644 --- a/src/test/ui/issues/issue-50480.rs +++ b/src/test/ui/issues/issue-50480.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Clone, Copy)] //~^ ERROR the trait `Copy` may not be implemented for this type struct Foo(NotDefined, ::Item, Vec, String); diff --git a/src/test/ui/issues/issue-50480.stderr b/src/test/ui/issues/issue-50480.stderr index cbff927ac74..240a0f22286 100644 --- a/src/test/ui/issues/issue-50480.stderr +++ b/src/test/ui/issues/issue-50480.stderr @@ -1,11 +1,11 @@ error[E0412]: cannot find type `NotDefined` in this scope - --> $DIR/issue-50480.rs:13:12 + --> $DIR/issue-50480.rs:3:12 | LL | struct Foo(NotDefined, ::Item, Vec, String); | ^^^^^^^^^^ not found in this scope error[E0277]: `i32` is not an iterator - --> $DIR/issue-50480.rs:13:24 + --> $DIR/issue-50480.rs:3:24 | LL | struct Foo(NotDefined, ::Item, Vec, String); | ^^^^^^^^^^^^^^^^^^^^^^^ `i32` is not an iterator @@ -14,7 +14,7 @@ LL | struct Foo(NotDefined, ::Item, Vec, String); = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/issue-50480.rs:11:17 + --> $DIR/issue-50480.rs:1:17 | LL | #[derive(Clone, Copy)] | ^^^^ diff --git a/src/test/ui/issues/issue-50576.rs b/src/test/ui/issues/issue-50576.rs index b2032fb226b..e0c36b8273a 100644 --- a/src/test/ui/issues/issue-50576.rs +++ b/src/test/ui/issues/issue-50576.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { |bool: [u8; break 'L]| 0; //~^ ERROR [E0426] diff --git a/src/test/ui/issues/issue-50576.stderr b/src/test/ui/issues/issue-50576.stderr index e661be21339..98624d141a6 100644 --- a/src/test/ui/issues/issue-50576.stderr +++ b/src/test/ui/issues/issue-50576.stderr @@ -1,17 +1,17 @@ error[E0426]: use of undeclared label `'L` - --> $DIR/issue-50576.rs:12:23 + --> $DIR/issue-50576.rs:2:23 | LL | |bool: [u8; break 'L]| 0; | ^^ undeclared label `'L` error[E0268]: `break` outside of loop - --> $DIR/issue-50576.rs:12:17 + --> $DIR/issue-50576.rs:2:17 | LL | |bool: [u8; break 'L]| 0; | ^^^^^^^^ cannot break outside of a loop error[E0268]: `break` outside of loop - --> $DIR/issue-50576.rs:15:16 + --> $DIR/issue-50576.rs:5:16 | LL | Vec::<[u8; break]>::new(); //~ ERROR [E0268] | ^^^^^ cannot break outside of a loop diff --git a/src/test/ui/issues/issue-50577.rs b/src/test/ui/issues/issue-50577.rs index 6fd680c1519..f0f1dc6c286 100644 --- a/src/test/ui/issues/issue-50577.rs +++ b/src/test/ui/issues/issue-50577.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { enum Foo { Drop = assert_eq!(1, 1) diff --git a/src/test/ui/issues/issue-50577.stderr b/src/test/ui/issues/issue-50577.stderr index 8751303a0db..f26f5a9a9ba 100644 --- a/src/test/ui/issues/issue-50577.stderr +++ b/src/test/ui/issues/issue-50577.stderr @@ -1,5 +1,5 @@ error[E0317]: if may be missing an else clause - --> $DIR/issue-50577.rs:13:16 + --> $DIR/issue-50577.rs:3:16 | LL | Drop = assert_eq!(1, 1) | ^^^^^^^^^^^^^^^^ expected (), found isize diff --git a/src/test/ui/issues/issue-50581.rs b/src/test/ui/issues/issue-50581.rs index 97b3f81eaf5..12bb9930eca 100644 --- a/src/test/ui/issues/issue-50581.rs +++ b/src/test/ui/issues/issue-50581.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { |_: [u8; break]| (); //~ ERROR [E0268] } diff --git a/src/test/ui/issues/issue-50581.stderr b/src/test/ui/issues/issue-50581.stderr index 38a87b1e78a..70ac9ecc9ed 100644 --- a/src/test/ui/issues/issue-50581.stderr +++ b/src/test/ui/issues/issue-50581.stderr @@ -1,5 +1,5 @@ error[E0268]: `break` outside of loop - --> $DIR/issue-50581.rs:12:14 + --> $DIR/issue-50581.rs:2:14 | LL | |_: [u8; break]| (); //~ ERROR [E0268] | ^^^^^ cannot break outside of a loop diff --git a/src/test/ui/issues/issue-50585.rs b/src/test/ui/issues/issue-50585.rs index 0c063d4cdb0..ca2ece8d53b 100644 --- a/src/test/ui/issues/issue-50585.rs +++ b/src/test/ui/issues/issue-50585.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { |y: Vec<[(); for x in 0..2 {}]>| {}; //~^ ERROR mismatched types diff --git a/src/test/ui/issues/issue-50585.stderr b/src/test/ui/issues/issue-50585.stderr index e4edc18c3f8..4c41da8fc33 100644 --- a/src/test/ui/issues/issue-50585.stderr +++ b/src/test/ui/issues/issue-50585.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-50585.rs:12:18 + --> $DIR/issue-50585.rs:2:18 | LL | |y: Vec<[(); for x in 0..2 {}]>| {}; | ^^^^^^^^^^^^^^^^ expected usize, found () diff --git a/src/test/ui/issues/issue-50599.rs b/src/test/ui/issues/issue-50599.rs index 417f8c8848e..78a20cf8ebb 100644 --- a/src/test/ui/issues/issue-50599.rs +++ b/src/test/ui/issues/issue-50599.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { const N: u32 = 1_000; const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; //~ ERROR cannot find value diff --git a/src/test/ui/issues/issue-50599.stderr b/src/test/ui/issues/issue-50599.stderr index 5338f333d21..cf2f309340d 100644 --- a/src/test/ui/issues/issue-50599.stderr +++ b/src/test/ui/issues/issue-50599.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `LOG10_2` in module `std::f64` - --> $DIR/issue-50599.rs:13:48 + --> $DIR/issue-50599.rs:3:48 | LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; //~ ERROR cannot find value | ^^^^^^^ not found in `std::f64` @@ -11,7 +11,7 @@ LL | use std::f64::consts::LOG10_2; | error[E0080]: evaluation of constant value failed - --> $DIR/issue-50599.rs:14:29 + --> $DIR/issue-50599.rs:4:29 | LL | let mut digits = [0u32; M]; | ^ referenced constant has errors diff --git a/src/test/ui/issues/issue-50600.rs b/src/test/ui/issues/issue-50600.rs index 6169a7770bf..963e607afcf 100644 --- a/src/test/ui/issues/issue-50600.rs +++ b/src/test/ui/issues/issue-50600.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo ( fn([u8; |x: u8| {}]), //~ ERROR mismatched types ); diff --git a/src/test/ui/issues/issue-50600.stderr b/src/test/ui/issues/issue-50600.stderr index a72dbace248..36219390c51 100644 --- a/src/test/ui/issues/issue-50600.stderr +++ b/src/test/ui/issues/issue-50600.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/issue-50600.rs:12:13 + --> $DIR/issue-50600.rs:2:13 | LL | fn([u8; |x: u8| {}]), //~ ERROR mismatched types | ^^^^^^^^^^ expected usize, found closure | = note: expected type `usize` - found type `[closure@$DIR/issue-50600.rs:12:13: 12:23]` + found type `[closure@$DIR/issue-50600.rs:2:13: 2:23]` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50618.rs b/src/test/ui/issues/issue-50618.rs index ed427c293df..5f762bc431e 100644 --- a/src/test/ui/issues/issue-50618.rs +++ b/src/test/ui/issues/issue-50618.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Point { pub x: u64, pub y: u64, diff --git a/src/test/ui/issues/issue-50618.stderr b/src/test/ui/issues/issue-50618.stderr index 07cc5a1318a..1ac5dde66e9 100644 --- a/src/test/ui/issues/issue-50618.stderr +++ b/src/test/ui/issues/issue-50618.stderr @@ -1,5 +1,5 @@ error[E0560]: struct `Point` has no field named `nonexistent` - --> $DIR/issue-50618.rs:24:13 + --> $DIR/issue-50618.rs:14:13 | LL | nonexistent: 0, | ^^^^^^^^^^^ `Point` does not have this field diff --git a/src/test/ui/issues/issue-5062.rs b/src/test/ui/issues/issue-5062.rs index ebfa4975d4d..2db0a8e25b4 100644 --- a/src/test/ui/issues/issue-5062.rs +++ b/src/test/ui/issues/issue-5062.rs @@ -1,12 +1,2 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { format!("{:?}", None); } //~^ ERROR type annotations needed [E0282] diff --git a/src/test/ui/issues/issue-5062.stderr b/src/test/ui/issues/issue-5062.stderr index 988c5c137b4..0f5c6d8d4bf 100644 --- a/src/test/ui/issues/issue-5062.stderr +++ b/src/test/ui/issues/issue-5062.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-5062.rs:11:29 + --> $DIR/issue-5062.rs:1:29 | LL | fn main() { format!("{:?}", None); } | ^^^^ cannot infer type for `T` diff --git a/src/test/ui/issues/issue-5067.rs b/src/test/ui/issues/issue-5067.rs index 267362f902d..616fd09907a 100644 --- a/src/test/ui/issues/issue-5067.rs +++ b/src/test/ui/issues/issue-5067.rs @@ -1,47 +1,59 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_macros)] +// Tests that repetition matchers cannot match the empty token tree (since that would be +// ambiguous). + +// edition:2018 + macro_rules! foo { ( $()* ) => {}; //~^ ERROR repetition matches empty token tree ( $()+ ) => {}; //~^ ERROR repetition matches empty token tree - + ( $()? ) => {}; + //~^ ERROR repetition matches empty token tree ( $(),* ) => {}; // PASS ( $(),+ ) => {}; // PASS - + // `?` cannot have a separator... ( [$()*] ) => {}; //~^ ERROR repetition matches empty token tree ( [$()+] ) => {}; //~^ ERROR repetition matches empty token tree - + ( [$()?] ) => {}; + //~^ ERROR repetition matches empty token tree ( [$(),*] ) => {}; // PASS ( [$(),+] ) => {}; // PASS - + // `?` cannot have a separator... ( $($()* $(),* $(a)* $(a),* )* ) => {}; //~^ ERROR repetition matches empty token tree ( $($()* $(),* $(a)* $(a),* )+ ) => {}; //~^ ERROR repetition matches empty token tree - + ( $($()* $(),* $(a)* $(a),* )? ) => {}; + //~^ ERROR repetition matches empty token tree + ( $($()? $(),* $(a)? $(a),* )* ) => {}; + //~^ ERROR repetition matches empty token tree + ( $($()? $(),* $(a)? $(a),* )+ ) => {}; + //~^ ERROR repetition matches empty token tree + ( $($()? $(),* $(a)? $(a),* )? ) => {}; + //~^ ERROR repetition matches empty token tree ( $(a $(),* $(a)* $(a),* )* ) => {}; // PASS ( $($(a)+ $(),* $(a)* $(a),* )+ ) => {}; // PASS + ( $($(a)+ $(),* $(a)* $(a),* )? ) => {}; // PASS + + ( $(a $(),* $(a)? $(a),* )* ) => {}; // PASS + ( $($(a)+ $(),* $(a)? $(a),* )+ ) => {}; // PASS + ( $($(a)+ $(),* $(a)? $(a),* )? ) => {}; // PASS ( $(a $()+)* ) => {}; //~^ ERROR repetition matches empty token tree ( $(a $()*)+ ) => {}; //~^ ERROR repetition matches empty token tree + ( $(a $()+)? ) => {}; + //~^ ERROR repetition matches empty token tree + ( $(a $()?)+ ) => {}; + //~^ ERROR repetition matches empty token tree } - // --- Original Issue --- // macro_rules! make_vec { @@ -53,11 +65,10 @@ fn main() { let _ = make_vec![a 1, a 2, a 3]; } - // --- Minified Issue --- // macro_rules! m { - ( $()* ) => {} + ( $()* ) => {}; //~^ ERROR repetition matches empty token tree } diff --git a/src/test/ui/issues/issue-5067.stderr b/src/test/ui/issues/issue-5067.stderr index 2ea3ea5204c..7ffc6071407 100644 --- a/src/test/ui/issues/issue-5067.stderr +++ b/src/test/ui/issues/issue-5067.stderr @@ -1,62 +1,110 @@ error: repetition matches empty token tree - --> $DIR/issue-5067.rs:14:8 + --> $DIR/issue-5067.rs:9:8 | LL | ( $()* ) => {}; | ^^ error: repetition matches empty token tree - --> $DIR/issue-5067.rs:16:8 + --> $DIR/issue-5067.rs:11:8 | LL | ( $()+ ) => {}; | ^^ error: repetition matches empty token tree - --> $DIR/issue-5067.rs:22:9 + --> $DIR/issue-5067.rs:13:8 + | +LL | ( $()? ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:18:9 | LL | ( [$()*] ) => {}; | ^^ error: repetition matches empty token tree - --> $DIR/issue-5067.rs:24:9 + --> $DIR/issue-5067.rs:20:9 | LL | ( [$()+] ) => {}; | ^^ error: repetition matches empty token tree - --> $DIR/issue-5067.rs:30:8 + --> $DIR/issue-5067.rs:22:9 + | +LL | ( [$()?] ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:27:8 | LL | ( $($()* $(),* $(a)* $(a),* )* ) => {}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree - --> $DIR/issue-5067.rs:32:8 + --> $DIR/issue-5067.rs:29:8 | LL | ( $($()* $(),* $(a)* $(a),* )+ ) => {}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree - --> $DIR/issue-5067.rs:38:12 + --> $DIR/issue-5067.rs:31:8 + | +LL | ( $($()* $(),* $(a)* $(a),* )? ) => {}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:33:8 + | +LL | ( $($()? $(),* $(a)? $(a),* )* ) => {}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:35:8 + | +LL | ( $($()? $(),* $(a)? $(a),* )+ ) => {}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:37:8 + | +LL | ( $($()? $(),* $(a)? $(a),* )? ) => {}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:47:12 | LL | ( $(a $()+)* ) => {}; | ^^ error: repetition matches empty token tree - --> $DIR/issue-5067.rs:40:12 + --> $DIR/issue-5067.rs:49:12 | LL | ( $(a $()*)+ ) => {}; | ^^ error: repetition matches empty token tree - --> $DIR/issue-5067.rs:48:18 + --> $DIR/issue-5067.rs:51:12 + | +LL | ( $(a $()+)? ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:53:12 + | +LL | ( $(a $()?)+ ) => {}; + | ^^ + +error: repetition matches empty token tree + --> $DIR/issue-5067.rs:60:18 | LL | (a $e1:expr $($(, a $e2:expr)*)*) => ([$e1 $($(, $e2)*)*]); | ^^^^^^^^^^^^^^^^^^ error: repetition matches empty token tree - --> $DIR/issue-5067.rs:60:8 + --> $DIR/issue-5067.rs:71:8 | -LL | ( $()* ) => {} +LL | ( $()* ) => {}; | ^^ -error: aborting due to 10 previous errors +error: aborting due to 18 previous errors diff --git a/src/test/ui/issues/issue-50688.rs b/src/test/ui/issues/issue-50688.rs index ff45cf639de..88f898b86f9 100644 --- a/src/test/ui/issues/issue-50688.rs +++ b/src/test/ui/issues/issue-50688.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { [1; || {}]; //~ ERROR mismatched types } diff --git a/src/test/ui/issues/issue-50688.stderr b/src/test/ui/issues/issue-50688.stderr index 094b0e1ec89..2a1315c9a01 100644 --- a/src/test/ui/issues/issue-50688.stderr +++ b/src/test/ui/issues/issue-50688.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/issue-50688.rs:12:9 + --> $DIR/issue-50688.rs:2:9 | LL | [1; || {}]; //~ ERROR mismatched types | ^^^^^ expected usize, found closure | = note: expected type `usize` - found type `[closure@$DIR/issue-50688.rs:12:9: 12:14]` + found type `[closure@$DIR/issue-50688.rs:2:9: 2:14]` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50714-1.rs b/src/test/ui/issues/issue-50714-1.rs index f0e496a88fb..31de3f3c0a1 100644 --- a/src/test/ui/issues/issue-50714-1.rs +++ b/src/test/ui/issues/issue-50714-1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue 50714, make sure that this isn't a linker error. #![no_std] diff --git a/src/test/ui/issues/issue-50714-1.stderr b/src/test/ui/issues/issue-50714-1.stderr index 5c92516cbc5..e5fdd18d332 100644 --- a/src/test/ui/issues/issue-50714-1.stderr +++ b/src/test/ui/issues/issue-50714-1.stderr @@ -1,5 +1,5 @@ error[E0647]: start function is not allowed to have a `where` clause - --> $DIR/issue-50714-1.rs:19:56 + --> $DIR/issue-50714-1.rs:9:56 | LL | fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { //~ ERROR [E0647] | ^^^^^^^^^^^ start function cannot have a `where` clause diff --git a/src/test/ui/issues/issue-50714.rs b/src/test/ui/issues/issue-50714.rs index 08d975326df..3683d4bdacc 100644 --- a/src/test/ui/issues/issue-50714.rs +++ b/src/test/ui/issues/issue-50714.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue 50714, make sure that this isn't a linker error. fn main() where fn(&()): Eq {} //~ ERROR [E0646] diff --git a/src/test/ui/issues/issue-50714.stderr b/src/test/ui/issues/issue-50714.stderr index e2c99980e1b..d7631adc7b2 100644 --- a/src/test/ui/issues/issue-50714.stderr +++ b/src/test/ui/issues/issue-50714.stderr @@ -1,5 +1,5 @@ error[E0646]: `main` function is not allowed to have a `where` clause - --> $DIR/issue-50714.rs:13:17 + --> $DIR/issue-50714.rs:3:17 | LL | fn main() where fn(&()): Eq {} //~ ERROR [E0646] | ^^^^^^^^^^^ `main` cannot have a `where` clause diff --git a/src/test/ui/issues/issue-50761.rs b/src/test/ui/issues/issue-50761.rs index 6c87d520934..bcf3ebcd60a 100644 --- a/src/test/ui/issues/issue-50761.rs +++ b/src/test/ui/issues/issue-50761.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Confirm that we don't accidentally divide or mod by zero in llvm_type // compile-pass diff --git a/src/test/ui/issues/issue-50781.rs b/src/test/ui/issues/issue-50781.rs index 43830869da7..edf8d82b480 100644 --- a/src/test/ui/issues/issue-50781.rs +++ b/src/test/ui/issues/issue-50781.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(where_clauses_object_safety)] trait Trait {} diff --git a/src/test/ui/issues/issue-50781.stderr b/src/test/ui/issues/issue-50781.stderr index 047b847e67e..11de59f9f00 100644 --- a/src/test/ui/issues/issue-50781.stderr +++ b/src/test/ui/issues/issue-50781.stderr @@ -1,11 +1,11 @@ error: the trait `X` cannot be made into an object - --> $DIR/issue-50781.rs:16:5 + --> $DIR/issue-50781.rs:6:5 | LL | fn foo(&self) where Self: Trait; //~ ERROR the trait `X` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-50781.rs:11:9 + --> $DIR/issue-50781.rs:1:9 | LL | #![deny(where_clauses_object_safety)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-50802.rs b/src/test/ui/issues/issue-50802.rs index 6342d0757ee..dece55968b6 100644 --- a/src/test/ui/issues/issue-50802.rs +++ b/src/test/ui/issues/issue-50802.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[allow(unreachable_code)] fn main() { diff --git a/src/test/ui/issues/issue-50802.stderr b/src/test/ui/issues/issue-50802.stderr index 9da2648b376..9a2ae794293 100644 --- a/src/test/ui/issues/issue-50802.stderr +++ b/src/test/ui/issues/issue-50802.stderr @@ -1,5 +1,5 @@ error[E0590]: `break` or `continue` with no label in the condition of a `while` loop - --> $DIR/issue-50802.rs:15:21 + --> $DIR/issue-50802.rs:5:21 | LL | break while continue { //~ ERROR E0590 | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop diff --git a/src/test/ui/issues/issue-50825-1.rs b/src/test/ui/issues/issue-50825-1.rs index 1eee9b7c883..ee4316029a8 100644 --- a/src/test/ui/issues/issue-50825-1.rs +++ b/src/test/ui/issues/issue-50825-1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // regression test for issue #50825 // Make sure that the `impl` bound (): X is preferred over diff --git a/src/test/ui/issues/issue-50825.rs b/src/test/ui/issues/issue-50825.rs index e45156b96cd..1ece2e9fc84 100644 --- a/src/test/ui/issues/issue-50825.rs +++ b/src/test/ui/issues/issue-50825.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // regression test for issue #50825 // Make sure that the built-in bound {integer}: Sized is preferred over diff --git a/src/test/ui/issues/issue-5099.rs b/src/test/ui/issues/issue-5099.rs index 1bb6f34b8e9..d00fff32809 100644 --- a/src/test/ui/issues/issue-5099.rs +++ b/src/test/ui/issues/issue-5099.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait B < A > { fn a() -> A { this.a } } //~ ERROR cannot find value `this` in this scope fn main() {} diff --git a/src/test/ui/issues/issue-5099.stderr b/src/test/ui/issues/issue-5099.stderr index 26a26f731cf..d103c968979 100644 --- a/src/test/ui/issues/issue-5099.stderr +++ b/src/test/ui/issues/issue-5099.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `this` in this scope - --> $DIR/issue-5099.rs:12:31 + --> $DIR/issue-5099.rs:1:31 | LL | trait B < A > { fn a() -> A { this.a } } //~ ERROR cannot find value `this` in this scope | ^^^^ not found in this scope diff --git a/src/test/ui/issues/issue-50993.rs b/src/test/ui/issues/issue-50993.rs index d6cdd738001..772c45dee11 100644 --- a/src/test/ui/issues/issue-50993.rs +++ b/src/test/ui/issues/issue-50993.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type dylib --target thumbv7em-none-eabihf // compile-pass // error-pattern: dropping unsupported crate type `dylib` for target `thumbv7em-none-eabihf` diff --git a/src/test/ui/issues/issue-5100.rs b/src/test/ui/issues/issue-5100.rs index 9ef780aac8e..505dfbb27de 100644 --- a/src/test/ui/issues/issue-5100.rs +++ b/src/test/ui/issues/issue-5100.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/ui/issues/issue-5100.stderr b/src/test/ui/issues/issue-5100.stderr index 305ee2f5471..0a918a78970 100644 --- a/src/test/ui/issues/issue-5100.stderr +++ b/src/test/ui/issues/issue-5100.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-5100.rs:18:9 + --> $DIR/issue-5100.rs:8:9 | LL | A::B => (), | ^^^^ expected tuple, found enum `A` @@ -8,7 +8,7 @@ LL | A::B => (), found type `A` error[E0308]: mismatched types - --> $DIR/issue-5100.rs:27:9 + --> $DIR/issue-5100.rs:17:9 | LL | (true, false, false) => () | ^^^^^^^^^^^^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements @@ -17,7 +17,7 @@ LL | (true, false, false) => () found type `(_, _, _)` error[E0308]: mismatched types - --> $DIR/issue-5100.rs:35:9 + --> $DIR/issue-5100.rs:25:9 | LL | (true, false, false) => () | ^^^^^^^^^^^^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements @@ -26,8 +26,10 @@ LL | (true, false, false) => () found type `(_, _, _)` error[E0308]: mismatched types - --> $DIR/issue-5100.rs:43:9 + --> $DIR/issue-5100.rs:33:9 | +LL | match (true, false) { + | ------------- this match expression has type `(bool, bool)` LL | box (true, false) => () | ^^^^^^^^^^^^^^^^^ expected tuple, found struct `std::boxed::Box` | @@ -35,7 +37,7 @@ LL | box (true, false) => () found type `std::boxed::Box<_>` error[E0308]: mismatched types - --> $DIR/issue-5100.rs:50:9 + --> $DIR/issue-5100.rs:40:9 | LL | &(true, false) => () | ^^^^^^^^^^^^^^ expected tuple, found reference @@ -44,7 +46,7 @@ LL | &(true, false) => () found type `&_` error[E0618]: expected function, found `(char, char)` - --> $DIR/issue-5100.rs:58:14 + --> $DIR/issue-5100.rs:48:14 | LL | let v = [('a', 'b') //~ ERROR expected function, found `(char, char)` | ______________-^^^^^^^^^ @@ -52,7 +54,7 @@ LL | | ('c', 'd'), | |_______________________- call expression requires function error[E0308]: mismatched types - --> $DIR/issue-5100.rs:65:19 + --> $DIR/issue-5100.rs:55:19 | LL | let x: char = true; //~ ERROR mismatched types | ^^^^ expected char, found bool diff --git a/src/test/ui/issues/issue-51022.rs b/src/test/ui/issues/issue-51022.rs index 831c3e5fda0..cebdfe00c1b 100644 --- a/src/test/ui/issues/issue-51022.rs +++ b/src/test/ui/issues/issue-51022.rs @@ -1,12 +1,2 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main<'a>() { } //~^ ERROR `main` function is not allowed to have generic parameters [E0131] diff --git a/src/test/ui/issues/issue-51022.stderr b/src/test/ui/issues/issue-51022.stderr index 1daa8dfbba6..5e196bd4e25 100644 --- a/src/test/ui/issues/issue-51022.stderr +++ b/src/test/ui/issues/issue-51022.stderr @@ -1,5 +1,5 @@ error[E0131]: `main` function is not allowed to have generic parameters - --> $DIR/issue-51022.rs:11:8 + --> $DIR/issue-51022.rs:1:8 | LL | fn main<'a>() { } | ^^^^ `main` cannot have generic parameters diff --git a/src/test/ui/issues/issue-51044.rs b/src/test/ui/issues/issue-51044.rs index 6424c4229bd..628d7876965 100644 --- a/src/test/ui/issues/issue-51044.rs +++ b/src/test/ui/issues/issue-51044.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // regression test for issue #50825 // Check that the feature gate normalizes associated types. diff --git a/src/test/ui/issues/issue-51102.rs b/src/test/ui/issues/issue-51102.rs index c8f106687ae..41446cd29b0 100644 --- a/src/test/ui/issues/issue-51102.rs +++ b/src/test/ui/issues/issue-51102.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum SimpleEnum { NoState, } diff --git a/src/test/ui/issues/issue-51102.stderr b/src/test/ui/issues/issue-51102.stderr index a4bd0fb914f..1b2948db2d6 100644 --- a/src/test/ui/issues/issue-51102.stderr +++ b/src/test/ui/issues/issue-51102.stderr @@ -1,11 +1,11 @@ error[E0026]: struct `SimpleStruct` does not have a field named `state` - --> $DIR/issue-51102.rs:23:17 + --> $DIR/issue-51102.rs:13:17 | LL | state: 0, | ^^^^^^^^ struct `SimpleStruct` does not have this field error[E0025]: field `no_state_here` bound multiple times in the pattern - --> $DIR/issue-51102.rs:34:17 + --> $DIR/issue-51102.rs:24:17 | LL | no_state_here: 0, | ---------------- first use of `no_state_here` @@ -13,7 +13,7 @@ LL | no_state_here: 1 | ^^^^^^^^^^^^^^^^ multiple uses of `no_state_here` in pattern error[E0026]: variant `SimpleEnum::NoState` does not have a field named `state` - --> $DIR/issue-51102.rs:43:17 + --> $DIR/issue-51102.rs:33:17 | LL | state: 0 | ^^^^^^^^ variant `SimpleEnum::NoState` does not have this field diff --git a/src/test/ui/issues/issue-51116.rs b/src/test/ui/issues/issue-51116.rs index c01559b1126..c0a74a679ef 100644 --- a/src/test/ui/issues/issue-51116.rs +++ b/src/test/ui/issues/issue-51116.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let tiles = Default::default(); for row in &mut tiles { diff --git a/src/test/ui/issues/issue-51116.stderr b/src/test/ui/issues/issue-51116.stderr index fc84ee9028d..4c1870eb8c9 100644 --- a/src/test/ui/issues/issue-51116.stderr +++ b/src/test/ui/issues/issue-51116.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-51116.rs:16:13 + --> $DIR/issue-51116.rs:6:13 | LL | for tile in row { | --- the element type for this iterator is not specified diff --git a/src/test/ui/issues/issue-51244.nll.stderr b/src/test/ui/issues/issue-51244.nll.stderr index ce02ae2aec2..7a4935fafc6 100644 --- a/src/test/ui/issues/issue-51244.nll.stderr +++ b/src/test/ui/issues/issue-51244.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*my_ref` which is behind a `&` reference - --> $DIR/issue-51244.rs:13:5 + --> $DIR/issue-51244.rs:3:5 | LL | let ref my_ref @ _ = 0; | -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _` diff --git a/src/test/ui/issues/issue-51244.rs b/src/test/ui/issues/issue-51244.rs index 50a21184a98..d3651810131 100644 --- a/src/test/ui/issues/issue-51244.rs +++ b/src/test/ui/issues/issue-51244.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let ref my_ref @ _ = 0; *my_ref = 0; //~ ERROR cannot assign to immutable borrowed content `*my_ref` [E0594] diff --git a/src/test/ui/issues/issue-51244.stderr b/src/test/ui/issues/issue-51244.stderr index 997a74295e5..a5b06aa2282 100644 --- a/src/test/ui/issues/issue-51244.stderr +++ b/src/test/ui/issues/issue-51244.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to immutable borrowed content `*my_ref` - --> $DIR/issue-51244.rs:13:5 + --> $DIR/issue-51244.rs:3:5 | LL | let ref my_ref @ _ = 0; | -------------- help: use a mutable reference instead: `ref mut my_ref @ _` diff --git a/src/test/ui/issues/issue-51279.rs b/src/test/ui/issues/issue-51279.rs index 4639d73e44d..f8f3626caab 100644 --- a/src/test/ui/issues/issue-51279.rs +++ b/src/test/ui/issues/issue-51279.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct X<#[cfg(none)] 'a, #[cfg(none)] T>(&'a T); //~^ ERROR #[cfg] cannot be applied on a generic parameter //~^^ ERROR #[cfg] cannot be applied on a generic parameter @@ -25,10 +15,13 @@ pub struct Y<#[cfg(none)] T>(T); // shouldn't care when the entire item is strip struct M(*const T); -unsafe impl<#[cfg_attr(none, may_dangle)] T> Drop for M { +impl<#[cfg_attr(none, may_dangle)] T> Drop for M { //~^ ERROR #[cfg_attr] cannot be applied on a generic parameter fn drop(&mut self) {} } type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>; //~^ ERROR #[cfg] cannot be applied on a generic parameter +//~| ERROR attribute `ignored` is currently unknown to the compiler + +fn main() {} diff --git a/src/test/ui/issues/issue-51279.stderr b/src/test/ui/issues/issue-51279.stderr index 38d5a5acc50..bc33eacac99 100644 --- a/src/test/ui/issues/issue-51279.stderr +++ b/src/test/ui/issues/issue-51279.stderr @@ -1,50 +1,59 @@ error: #[cfg] cannot be applied on a generic parameter - --> $DIR/issue-51279.rs:11:14 + --> $DIR/issue-51279.rs:1:14 | LL | pub struct X<#[cfg(none)] 'a, #[cfg(none)] T>(&'a T); | ^^^^^^^^^^^^ error: #[cfg] cannot be applied on a generic parameter - --> $DIR/issue-51279.rs:11:31 + --> $DIR/issue-51279.rs:1:31 | LL | pub struct X<#[cfg(none)] 'a, #[cfg(none)] T>(&'a T); | ^^^^^^^^^^^^ error: #[cfg] cannot be applied on a generic parameter - --> $DIR/issue-51279.rs:15:6 + --> $DIR/issue-51279.rs:5:6 | LL | impl<#[cfg(none)] 'a, #[cfg(none)] T> X<'a, T> {} | ^^^^^^^^^^^^ error: #[cfg] cannot be applied on a generic parameter - --> $DIR/issue-51279.rs:15:23 + --> $DIR/issue-51279.rs:5:23 | LL | impl<#[cfg(none)] 'a, #[cfg(none)] T> X<'a, T> {} | ^^^^^^^^^^^^ error: #[cfg] cannot be applied on a generic parameter - --> $DIR/issue-51279.rs:19:10 + --> $DIR/issue-51279.rs:9:10 | LL | pub fn f<#[cfg(none)] 'a, #[cfg(none)] T>(_: &'a T) {} | ^^^^^^^^^^^^ error: #[cfg] cannot be applied on a generic parameter - --> $DIR/issue-51279.rs:19:27 + --> $DIR/issue-51279.rs:9:27 | LL | pub fn f<#[cfg(none)] 'a, #[cfg(none)] T>(_: &'a T) {} | ^^^^^^^^^^^^ error: #[cfg_attr] cannot be applied on a generic parameter - --> $DIR/issue-51279.rs:28:13 + --> $DIR/issue-51279.rs:18:6 | -LL | unsafe impl<#[cfg_attr(none, may_dangle)] T> Drop for M { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl<#[cfg_attr(none, may_dangle)] T> Drop for M { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: #[cfg] cannot be applied on a generic parameter - --> $DIR/issue-51279.rs:33:23 + --> $DIR/issue-51279.rs:23:23 | LL | type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>; | ^^^^^^^^^^^^ -error: aborting due to 8 previous errors +error[E0658]: The attribute `ignored` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/issue-51279.rs:23:8 + | +LL | type Z<#[ignored] 'a, #[cfg(none)] T> = X<'a, T>; + | ^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: aborting due to 9 previous errors +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issues/issue-51515.rs b/src/test/ui/issues/issue-51515.rs index 3e0a3b757a3..64d9822bab4 100644 --- a/src/test/ui/issues/issue-51515.rs +++ b/src/test/ui/issues/issue-51515.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] fn main() { diff --git a/src/test/ui/issues/issue-51515.stderr b/src/test/ui/issues/issue-51515.stderr index 3e7349b5aca..bcfed6d3bf8 100644 --- a/src/test/ui/issues/issue-51515.stderr +++ b/src/test/ui/issues/issue-51515.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*foo` which is behind a `&` reference - --> $DIR/issue-51515.rs:17:5 + --> $DIR/issue-51515.rs:7:5 | LL | let foo = &16; | --- help: consider changing this to be a mutable reference: `&mut 16` @@ -8,7 +8,7 @@ LL | *foo = 32; | ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*bar` which is behind a `&` reference - --> $DIR/issue-51515.rs:22:5 + --> $DIR/issue-51515.rs:12:5 | LL | let bar = foo; | --- help: consider changing this to be a mutable reference: `&mut i32` diff --git a/src/test/ui/issues/issue-5153.rs b/src/test/ui/issues/issue-5153.rs index 9b49886961d..551880ae009 100644 --- a/src/test/ui/issues/issue-5153.rs +++ b/src/test/ui/issues/issue-5153.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(self: Box); } diff --git a/src/test/ui/issues/issue-5153.stderr b/src/test/ui/issues/issue-5153.stderr index 6f8dce109e1..48adfee0dec 100644 --- a/src/test/ui/issues/issue-5153.stderr +++ b/src/test/ui/issues/issue-5153.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `foo` found for type `&dyn Foo` in the current scope - --> $DIR/issue-5153.rs:20:23 + --> $DIR/issue-5153.rs:10:23 | LL | (&5isize as &Foo).foo(); | ^^^ diff --git a/src/test/ui/issues/issue-51602.rs b/src/test/ui/issues/issue-51602.rs index a3edecb94f7..0e96ca914a9 100644 --- a/src/test/ui/issues/issue-51602.rs +++ b/src/test/ui/issues/issue-51602.rs @@ -1,15 +1,6 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main(){ if i in 1..10 { +//~^ ERROR expected `{`, found keyword `in` break; } } diff --git a/src/test/ui/issues/issue-51602.stderr b/src/test/ui/issues/issue-51602.stderr index d50ee64cf52..1ad69c0191b 100644 --- a/src/test/ui/issues/issue-51602.stderr +++ b/src/test/ui/issues/issue-51602.stderr @@ -1,5 +1,5 @@ error: expected `{`, found keyword `in` - --> $DIR/issue-51602.rs:12:10 + --> $DIR/issue-51602.rs:2:10 | LL | if i in 1..10 { | -- ^^ expected `{` diff --git a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.rs b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.rs index 32ea715b64f..bb74f0e0dc3 100644 --- a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.rs +++ b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] fn missing_discourses() -> Result { diff --git a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr index 590cbff67a4..8f36a3f9618 100644 --- a/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr +++ b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr @@ -1,5 +1,5 @@ error[E0308]: try expression alternatives have incompatible types - --> $DIR/issue-51632-try-desugar-incompatible-types.rs:18:5 + --> $DIR/issue-51632-try-desugar-incompatible-types.rs:8:5 | LL | missing_discourses()? | ^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found isize diff --git a/src/test/ui/issues/issue-51655.rs b/src/test/ui/issues/issue-51655.rs index d8c69fd3d55..989fcc041a0 100644 --- a/src/test/ui/issues/issue-51655.rs +++ b/src/test/ui/issues/issue-51655.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-51714.rs b/src/test/ui/issues/issue-51714.rs index 2b9d51f81b9..4885e4a2db7 100644 --- a/src/test/ui/issues/issue-51714.rs +++ b/src/test/ui/issues/issue-51714.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { |_: [_; return || {}] | {}; //~^ ERROR return statement outside of function body @@ -20,5 +10,5 @@ fn main() { [(); return while let Some(n) = Some(0) {}]; //~^ ERROR return statement outside of function body - //~^^ ERROR irrefutable while-let pattern + //~^^ WARN irrefutable while-let pattern } diff --git a/src/test/ui/issues/issue-51714.stderr b/src/test/ui/issues/issue-51714.stderr index ddc70bfb38e..df11f6b7f5a 100644 --- a/src/test/ui/issues/issue-51714.stderr +++ b/src/test/ui/issues/issue-51714.stderr @@ -1,34 +1,35 @@ error[E0572]: return statement outside of function body - --> $DIR/issue-51714.rs:12:14 + --> $DIR/issue-51714.rs:2:14 | LL | |_: [_; return || {}] | {}; | ^^^^^^^^^^^^ error[E0572]: return statement outside of function body - --> $DIR/issue-51714.rs:15:10 + --> $DIR/issue-51714.rs:5:10 | LL | [(); return || {}]; | ^^^^^^^^^^^^ error[E0572]: return statement outside of function body - --> $DIR/issue-51714.rs:18:10 + --> $DIR/issue-51714.rs:8:10 | LL | [(); return |ice| {}]; | ^^^^^^^^^^^^^^^ error[E0572]: return statement outside of function body - --> $DIR/issue-51714.rs:21:10 + --> $DIR/issue-51714.rs:11:10 | LL | [(); return while let Some(n) = Some(0) {}]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0165]: irrefutable while-let pattern - --> $DIR/issue-51714.rs:21:27 +warning: irrefutable while-let pattern + --> $DIR/issue-51714.rs:11:17 | LL | [(); return while let Some(n) = Some(0) {}]; - | ^^^^^^^ irrefutable pattern + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(irrefutable_let_patterns)] on by default -error: aborting due to 5 previous errors +error: aborting due to 4 previous errors -Some errors occurred: E0165, E0572. -For more information about an error, try `rustc --explain E0165`. +For more information about this error, try `rustc --explain E0572`. diff --git a/src/test/ui/issues/issue-51848.rs b/src/test/ui/issues/issue-51848.rs index ec90d3f62d2..4792bdd64f0 100644 --- a/src/test/ui/issues/issue-51848.rs +++ b/src/test/ui/issues/issue-51848.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // In case of macro expansion, the errors should be matched using the deepest callsite in the // macro call stack whose span is in the current file diff --git a/src/test/ui/issues/issue-51848.stderr b/src/test/ui/issues/issue-51848.stderr index 8e5001dca33..1bb6f3c1f1f 100644 --- a/src/test/ui/issues/issue-51848.stderr +++ b/src/test/ui/issues/issue-51848.stderr @@ -1,8 +1,10 @@ error: invalid format string: expected `'}'` but string was terminated - --> $DIR/issue-51848.rs:16:20 + --> $DIR/issue-51848.rs:6:20 | LL | println!("{"); //~ ERROR invalid - | ^ expected `'}'` in format string + | -^ expected `'}'` in format string + | | + | because of this opening brace ... LL | macro_with_error!(); | -------------------- in this macro invocation @@ -10,7 +12,7 @@ LL | macro_with_error!(); = note: if you intended to print `{`, you can escape it using `{{` error: invalid format string: unmatched `}` found - --> $DIR/issue-51848.rs:28:15 + --> $DIR/issue-51848.rs:18:15 | LL | println!("}"); //~ ERROR invalid | ^ unmatched `}` in format string diff --git a/src/test/ui/issues/issue-51874.rs b/src/test/ui/issues/issue-51874.rs index 63425274d4c..d9d7e36b50e 100644 --- a/src/test/ui/issues/issue-51874.rs +++ b/src/test/ui/issues/issue-51874.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let a = (1.0).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type } diff --git a/src/test/ui/issues/issue-51874.stderr b/src/test/ui/issues/issue-51874.stderr index 86746453571..38c380c4bab 100644 --- a/src/test/ui/issues/issue-51874.stderr +++ b/src/test/ui/issues/issue-51874.stderr @@ -1,5 +1,5 @@ error[E0689]: can't call method `pow` on ambiguous numeric type `{float}` - --> $DIR/issue-51874.rs:12:19 + --> $DIR/issue-51874.rs:2:19 | LL | let a = (1.0).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type | ^^^ diff --git a/src/test/ui/issues/issue-51947.rs b/src/test/ui/issues/issue-51947.rs index 3e0c3c002f6..7b79807e4d7 100644 --- a/src/test/ui/issues/issue-51947.rs +++ b/src/test/ui/issues/issue-51947.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![crate_type = "lib"] diff --git a/src/test/ui/issues/issue-52023-array-size-pointer-cast.rs b/src/test/ui/issues/issue-52023-array-size-pointer-cast.rs index 46cbdb6ac22..63f1128f106 100644 --- a/src/test/ui/issues/issue-52023-array-size-pointer-cast.rs +++ b/src/test/ui/issues/issue-52023-array-size-pointer-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants //~^ ERROR it is undefined behavior to use this value diff --git a/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr b/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr index a4c22841614..f687be5edb0 100644 --- a/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr +++ b/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr @@ -1,5 +1,5 @@ error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) - --> $DIR/issue-52023-array-size-pointer-cast.rs:12:17 + --> $DIR/issue-52023-array-size-pointer-cast.rs:2:17 | LL | let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable error[E0080]: it is undefined behavior to use this value - --> $DIR/issue-52023-array-size-pointer-cast.rs:12:17 + --> $DIR/issue-52023-array-size-pointer-cast.rs:2:17 | LL | let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes diff --git a/src/test/ui/issues/issue-52049.nll.stderr b/src/test/ui/issues/issue-52049.nll.stderr index d64332bf07c..55929d85da4 100644 --- a/src/test/ui/issues/issue-52049.nll.stderr +++ b/src/test/ui/issues/issue-52049.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-52049.rs:16:10 + --> $DIR/issue-52049.rs:6:10 | LL | foo(&unpromotable(5u32)); | -----^^^^^^^^^^^^^^^^^^- diff --git a/src/test/ui/issues/issue-52049.rs b/src/test/ui/issues/issue-52049.rs index daff2258d36..23b21cf4e61 100644 --- a/src/test/ui/issues/issue-52049.rs +++ b/src/test/ui/issues/issue-52049.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(_: &'static u32) {} fn unpromotable(t: T) -> T { t } diff --git a/src/test/ui/issues/issue-52049.stderr b/src/test/ui/issues/issue-52049.stderr index e1e501023fc..45381765f8c 100644 --- a/src/test/ui/issues/issue-52049.stderr +++ b/src/test/ui/issues/issue-52049.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/issue-52049.rs:16:10 + --> $DIR/issue-52049.rs:6:10 | LL | foo(&unpromotable(5u32)); | ^^^^^^^^^^^^^^^^^^ - temporary value only lives until here diff --git a/src/test/ui/issues/issue-52057.rs b/src/test/ui/issues/issue-52057.rs index 533623fd389..356efd5dfed 100644 --- a/src/test/ui/issues/issue-52057.rs +++ b/src/test/ui/issues/issue-52057.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #52057. There is an implied bound // that `I: 'a` where `'a` is the lifetime of `self` in `parse_first`; // but to observe that, one must normalize first. diff --git a/src/test/ui/issues/issue-52060.stderr b/src/test/ui/issues/issue-52060.stderr index 988bfd480e6..7c3f7695549 100644 --- a/src/test/ui/issues/issue-52060.stderr +++ b/src/test/ui/issues/issue-52060.stderr @@ -10,7 +10,7 @@ error: `core::slice::::len` is not yet stable as a const fn LL | static B: [u32; 1] = [0; A.len()]; | ^^^^^^^ | - = help: in Nightly builds, add `#![feature(const_slice_len)]` to the crate attributes to enable + = help: add `#![feature(const_slice_len)]` to the crate attributes to enable error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr b/src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr index 2165d951102..8332cf1b3a3 100644 --- a/src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr +++ b/src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `line` does not live long enough - --> $DIR/issue-52126-assign-op-invariance.rs:44:28 + --> $DIR/issue-52126-assign-op-invariance.rs:34:28 | LL | let v: Vec<&str> = line.split_whitespace().collect(); | ^^^^ borrowed value does not live long enough diff --git a/src/test/ui/issues/issue-52126-assign-op-invariance.rs b/src/test/ui/issues/issue-52126-assign-op-invariance.rs index 1a353f9ea7c..b974a8d4bda 100644 --- a/src/test/ui/issues/issue-52126-assign-op-invariance.rs +++ b/src/test/ui/issues/issue-52126-assign-op-invariance.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 52126: With respect to variance, the assign-op's like += were // accidentally lumped together with other binary op's. In both cases // we were coercing the LHS of the op to the expected supertype. diff --git a/src/test/ui/issues/issue-52126-assign-op-invariance.stderr b/src/test/ui/issues/issue-52126-assign-op-invariance.stderr index a4ea8085c12..b07b8d5281e 100644 --- a/src/test/ui/issues/issue-52126-assign-op-invariance.stderr +++ b/src/test/ui/issues/issue-52126-assign-op-invariance.stderr @@ -1,5 +1,5 @@ error[E0597]: `line` does not live long enough - --> $DIR/issue-52126-assign-op-invariance.rs:44:28 + --> $DIR/issue-52126-assign-op-invariance.rs:34:28 | LL | let v: Vec<&str> = line.split_whitespace().collect(); | ^^^^ borrowed value does not live long enough diff --git a/src/test/ui/issues/issue-5216.rs b/src/test/ui/issues/issue-5216.rs index 81424577d49..fd490884fa1 100644 --- a/src/test/ui/issues/issue-5216.rs +++ b/src/test/ui/issues/issue-5216.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f() { } struct S(Box); pub static C: S = S(f); //~ ERROR mismatched types diff --git a/src/test/ui/issues/issue-5216.stderr b/src/test/ui/issues/issue-5216.stderr index 7ea329749a0..5afea5873d5 100644 --- a/src/test/ui/issues/issue-5216.stderr +++ b/src/test/ui/issues/issue-5216.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-5216.rs:13:21 + --> $DIR/issue-5216.rs:3:21 | LL | pub static C: S = S(f); //~ ERROR mismatched types | ^ expected struct `std::boxed::Box`, found fn item @@ -8,7 +8,7 @@ LL | pub static C: S = S(f); //~ ERROR mismatched types found type `fn() {f}` error[E0308]: mismatched types - --> $DIR/issue-5216.rs:18:19 + --> $DIR/issue-5216.rs:8:19 | LL | pub static D: T = g; //~ ERROR mismatched types | ^ expected struct `std::boxed::Box`, found fn item diff --git a/src/test/ui/issues/issue-52213.rs b/src/test/ui/issues/issue-52213.rs index 810379c63d3..c4ce4946b2e 100644 --- a/src/test/ui/issues/issue-52213.rs +++ b/src/test/ui/issues/issue-52213.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { match (&t,) { //~ ERROR cannot infer an appropriate lifetime ((u,),) => u, diff --git a/src/test/ui/issues/issue-52213.stderr b/src/test/ui/issues/issue-52213.stderr index 3c650881d7b..4d3346f325d 100644 --- a/src/test/ui/issues/issue-52213.stderr +++ b/src/test/ui/issues/issue-52213.stderr @@ -1,24 +1,24 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/issue-52213.rs:12:11 + --> $DIR/issue-52213.rs:2:11 | LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime | ^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 11:23... - --> $DIR/issue-52213.rs:11:23 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 1:23... + --> $DIR/issue-52213.rs:1:23 | LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { | ^^ = note: ...so that the types are compatible: expected (&&(T,),) found (&&'a (T,),) -note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 11:27... - --> $DIR/issue-52213.rs:11:27 +note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 1:27... + --> $DIR/issue-52213.rs:1:27 | LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/issue-52213.rs:13:20 + --> $DIR/issue-52213.rs:3:20 | LL | ((u,),) => u, | ^ diff --git a/src/test/ui/issues/issue-5239-1.rs b/src/test/ui/issues/issue-5239-1.rs index f88b6931344..708ae34c6c6 100644 --- a/src/test/ui/issues/issue-5239-1.rs +++ b/src/test/ui/issues/issue-5239-1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #5239 fn main() { diff --git a/src/test/ui/issues/issue-5239-1.stderr b/src/test/ui/issues/issue-5239-1.stderr index f9191a9fd82..a95014fb12d 100644 --- a/src/test/ui/issues/issue-5239-1.stderr +++ b/src/test/ui/issues/issue-5239-1.stderr @@ -1,5 +1,5 @@ error[E0368]: binary assignment operation `+=` cannot be applied to type `&isize` - --> $DIR/issue-5239-1.rs:14:30 + --> $DIR/issue-5239-1.rs:4:30 | LL | let x = |ref x: isize| { x += 1; }; | -^^^^^ diff --git a/src/test/ui/issues/issue-52489.rs b/src/test/ui/issues/issue-52489.rs index f26392e82ac..8efe216989a 100644 --- a/src/test/ui/issues/issue-52489.rs +++ b/src/test/ui/issues/issue-52489.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // aux-build:issue-52489.rs // compile-flags:--extern issue_52489 diff --git a/src/test/ui/issues/issue-52489.stderr b/src/test/ui/issues/issue-52489.stderr index b8c41d82643..339877f87ea 100644 --- a/src/test/ui/issues/issue-52489.stderr +++ b/src/test/ui/issues/issue-52489.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'issue_52489_unstable' - --> $DIR/issue-52489.rs:15:5 + --> $DIR/issue-52489.rs:5:5 | LL | use issue_52489; | ^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-52496.rs b/src/test/ui/issues/issue-52496.rs new file mode 100644 index 00000000000..4e945365373 --- /dev/null +++ b/src/test/ui/issues/issue-52496.rs @@ -0,0 +1,12 @@ +struct Foo { bar: f64, baz: i64, bat: i64 } + +fn main() { + let _ = Foo { bar: .5, baz: 42 }; + //~^ ERROR float literals must have an integer part + //~| ERROR missing field `bat` in initializer of `Foo` + let bar = 1.5f32; + let _ = Foo { bar.into(), bat: -1, . }; + //~^ ERROR expected one of + //~| ERROR missing fields `bar`, `baz` in initializer of `Foo` + //~| ERROR expected identifier, found `.` +} diff --git a/src/test/ui/issues/issue-52496.stderr b/src/test/ui/issues/issue-52496.stderr new file mode 100644 index 00000000000..43009a15bd4 --- /dev/null +++ b/src/test/ui/issues/issue-52496.stderr @@ -0,0 +1,37 @@ +error: float literals must have an integer part + --> $DIR/issue-52496.rs:4:24 + | +LL | let _ = Foo { bar: .5, baz: 42 }; + | ^^ help: must have an integer part: `0.5` + +error: expected one of `,` or `}`, found `.` + --> $DIR/issue-52496.rs:8:22 + | +LL | let _ = Foo { bar.into(), bat: -1, . }; + | --- ^ expected one of `,` or `}` here + | | + | while parsing this struct + +error: expected identifier, found `.` + --> $DIR/issue-52496.rs:8:40 + | +LL | let _ = Foo { bar.into(), bat: -1, . }; + | --- ^ expected identifier + | | + | while parsing this struct + +error[E0063]: missing field `bat` in initializer of `Foo` + --> $DIR/issue-52496.rs:4:13 + | +LL | let _ = Foo { bar: .5, baz: 42 }; + | ^^^ missing `bat` + +error[E0063]: missing fields `bar`, `baz` in initializer of `Foo` + --> $DIR/issue-52496.rs:8:13 + | +LL | let _ = Foo { bar.into(), bat: -1, . }; + | ^^^ missing `bar`, `baz` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0063`. diff --git a/src/test/ui/issues/issue-52533-1.rs b/src/test/ui/issues/issue-52533-1.rs index 22af5a86702..c80f43237fc 100644 --- a/src/test/ui/issues/issue-52533-1.rs +++ b/src/test/ui/issues/issue-52533-1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] struct Foo<'a, 'b, T: 'a + 'b> { x: &'a T, y: &'b T } diff --git a/src/test/ui/issues/issue-52533-1.stderr b/src/test/ui/issues/issue-52533-1.stderr index 38deb7d66de..c719c00ef22 100644 --- a/src/test/ui/issues/issue-52533-1.stderr +++ b/src/test/ui/issues/issue-52533-1.stderr @@ -1,18 +1,18 @@ error[E0308]: mismatched types - --> $DIR/issue-52533-1.rs:19:18 + --> $DIR/issue-52533-1.rs:9:18 | LL | gimme(|x, y| y) | ^ lifetime mismatch | = note: expected type `&Foo<'_, '_, u32>` found type `&Foo<'_, '_, u32>` -note: the anonymous lifetime #4 defined on the body at 19:11... - --> $DIR/issue-52533-1.rs:19:11 +note: the anonymous lifetime #4 defined on the body at 9:11... + --> $DIR/issue-52533-1.rs:9:11 | LL | gimme(|x, y| y) | ^^^^^^^^ -note: ...does not necessarily outlive the anonymous lifetime #3 defined on the body at 19:11 - --> $DIR/issue-52533-1.rs:19:11 +note: ...does not necessarily outlive the anonymous lifetime #3 defined on the body at 9:11 + --> $DIR/issue-52533-1.rs:9:11 | LL | gimme(|x, y| y) | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-52533.rs b/src/test/ui/issues/issue-52533.rs index 08f2805cefd..a35f5a80a87 100644 --- a/src/test/ui/issues/issue-52533.rs +++ b/src/test/ui/issues/issue-52533.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(_: impl for<'a> FnOnce(&'a u32, &u32) -> &'a u32) { } diff --git a/src/test/ui/issues/issue-52533.stderr b/src/test/ui/issues/issue-52533.stderr index 76a2470a2e0..58654800207 100644 --- a/src/test/ui/issues/issue-52533.stderr +++ b/src/test/ui/issues/issue-52533.stderr @@ -1,16 +1,16 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/issue-52533.rs:15:16 + --> $DIR/issue-52533.rs:5:16 | LL | foo(|a, b| b) | ^ | -note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 15:9... - --> $DIR/issue-52533.rs:15:9 +note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 5:9... + --> $DIR/issue-52533.rs:5:9 | LL | foo(|a, b| b) | ^^^^^^^^ -note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined on the body at 15:9 - --> $DIR/issue-52533.rs:15:9 +note: ...but the borrowed content is only valid for the anonymous lifetime #3 defined on the body at 5:9 + --> $DIR/issue-52533.rs:5:9 | LL | foo(|a, b| b) | ^^^^^^^^ diff --git a/src/test/ui/issues/issue-52717.rs b/src/test/ui/issues/issue-52717.rs index d40e2bd3d53..f83232a4a26 100644 --- a/src/test/ui/issues/issue-52717.rs +++ b/src/test/ui/issues/issue-52717.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. enum A { A { foo: usize, @@ -17,5 +8,6 @@ fn main() { let x = A::A { foo: 3 }; match x { A::A { fob } => { println!("{}", fob); } +//~^ ERROR does not have a field named `fob` } } diff --git a/src/test/ui/issues/issue-52717.stderr b/src/test/ui/issues/issue-52717.stderr index 0ef5a84671d..408819813b0 100644 --- a/src/test/ui/issues/issue-52717.stderr +++ b/src/test/ui/issues/issue-52717.stderr @@ -1,5 +1,5 @@ error[E0026]: variant `A::A` does not have a field named `fob` - --> $DIR/issue-52717.rs:19:12 + --> $DIR/issue-52717.rs:10:12 | LL | A::A { fob } => { println!("{}", fob); } | ^^^ diff --git a/src/test/ui/issues/issue-52992.rs b/src/test/ui/issues/issue-52992.rs index 2ece0ee9fee..0fdf077d2fc 100644 --- a/src/test/ui/issues/issue-52992.rs +++ b/src/test/ui/issues/issue-52992.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for an NLL-related ICE (#52992) -- computing // implied bounds was causing outlives relations that were not // properly handled. diff --git a/src/test/ui/issues/issue-53251.rs b/src/test/ui/issues/issue-53251.rs index 8c75ea45a61..0751b0a635b 100644 --- a/src/test/ui/issues/issue-53251.rs +++ b/src/test/ui/issues/issue-53251.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S; impl S { diff --git a/src/test/ui/issues/issue-53251.stderr b/src/test/ui/issues/issue-53251.stderr index 51ea745bedb..9fbffaf39e5 100644 --- a/src/test/ui/issues/issue-53251.stderr +++ b/src/test/ui/issues/issue-53251.stderr @@ -1,5 +1,5 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/issue-53251.rs:21:24 + --> $DIR/issue-53251.rs:11:24 | LL | S::f::(); | ^^^ unexpected type argument diff --git a/src/test/ui/issues/issue-53300.rs b/src/test/ui/issues/issue-53300.rs index d055a6f12c1..09f0fe9d935 100644 --- a/src/test/ui/issues/issue-53300.rs +++ b/src/test/ui/issues/issue-53300.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // issue 53300 pub trait A { diff --git a/src/test/ui/issues/issue-53300.stderr b/src/test/ui/issues/issue-53300.stderr index 920287a32d6..2fedef7d23d 100644 --- a/src/test/ui/issues/issue-53300.stderr +++ b/src/test/ui/issues/issue-53300.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `Wrapper` in this scope - --> $DIR/issue-53300.rs:17:18 + --> $DIR/issue-53300.rs:7:18 | LL | fn addition() -> Wrapper {} | ^^^^^^^ not found in this scope diff --git a/src/test/ui/issues/issue-53348.rs b/src/test/ui/issues/issue-53348.rs index 46ab07dad6e..733413f0e17 100644 --- a/src/test/ui/issues/issue-53348.rs +++ b/src/test/ui/issues/issue-53348.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let mut v = vec!["hello", "this", "is", "a", "test"]; diff --git a/src/test/ui/issues/issue-53348.stderr b/src/test/ui/issues/issue-53348.stderr index 9aab4928ffa..ca07b1de435 100644 --- a/src/test/ui/issues/issue-53348.stderr +++ b/src/test/ui/issues/issue-53348.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-53348.rs:20:13 + --> $DIR/issue-53348.rs:10:13 | LL | a = *i.to_string(); | ^^^^^^^^^^^^^^ expected struct `std::string::String`, found str diff --git a/src/test/ui/issues/issue-53419.rs b/src/test/ui/issues/issue-53419.rs index 0dd5a851285..fc2a926f90f 100644 --- a/src/test/ui/issues/issue-53419.rs +++ b/src/test/ui/issues/issue-53419.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //compile-pass struct Foo { diff --git a/src/test/ui/issues/issue-5353.rs b/src/test/ui/issues/issue-5353.rs index 0c5de871f09..808b73ec72f 100644 --- a/src/test/ui/issues/issue-5353.rs +++ b/src/test/ui/issues/issue-5353.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-53565.rs b/src/test/ui/issues/issue-53565.rs index 2bf38296f26..114a53a92ca 100644 --- a/src/test/ui/issues/issue-53565.rs +++ b/src/test/ui/issues/issue-53565.rs @@ -1,14 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. use std::time::{foo, bar, buzz}; +//~^ ERROR unresolved imports use std::time::{abc, def}; +//~^ ERROR unresolved imports fn main(){ - println!("Hello World!"); + println!("Hello World!"); } diff --git a/src/test/ui/issues/issue-53565.stderr b/src/test/ui/issues/issue-53565.stderr index 945f5efe4a8..71c3b2aaaf2 100644 --- a/src/test/ui/issues/issue-53565.stderr +++ b/src/test/ui/issues/issue-53565.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved imports `std::time::foo`, `std::time::bar`, `std::time::buzz` - --> $DIR/issue-53565.rs:10:17 + --> $DIR/issue-53565.rs:1:17 | LL | use std::time::{foo, bar, buzz}; | ^^^ ^^^ ^^^^ no `buzz` in `time` @@ -8,7 +8,7 @@ LL | use std::time::{foo, bar, buzz}; | no `foo` in `time` error[E0432]: unresolved imports `std::time::abc`, `std::time::def` - --> $DIR/issue-53565.rs:11:17 + --> $DIR/issue-53565.rs:3:17 | LL | use std::time::{abc, def}; | ^^^ ^^^ no `def` in `time` diff --git a/src/test/ui/issues/issue-53568.rs b/src/test/ui/issues/issue-53568.rs index 6b479f75172..60a6e16492c 100644 --- a/src/test/ui/issues/issue-53568.rs +++ b/src/test/ui/issues/issue-53568.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for an NLL-related ICE (#53568) -- we failed to // resolve inference variables in "custom type-ops". // diff --git a/src/test/ui/issues/issue-5358-1.rs b/src/test/ui/issues/issue-5358-1.rs index d8aad54fd3e..6b23be2030d 100644 --- a/src/test/ui/issues/issue-5358-1.rs +++ b/src/test/ui/issues/issue-5358-1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Either { Left(T), Right(U) } struct S(Either); diff --git a/src/test/ui/issues/issue-5358-1.stderr b/src/test/ui/issues/issue-5358-1.stderr index abaea462fcc..649a0c1581a 100644 --- a/src/test/ui/issues/issue-5358-1.stderr +++ b/src/test/ui/issues/issue-5358-1.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types - --> $DIR/issue-5358-1.rs:16:9 + --> $DIR/issue-5358-1.rs:6:9 | +LL | match S(Either::Left(5)) { + | ------------------ this match expression has type `S` LL | Either::Right(_) => {} | ^^^^^^^^^^^^^^^^ expected struct `S`, found enum `Either` | diff --git a/src/test/ui/issues/issue-53692.rs b/src/test/ui/issues/issue-53692.rs index 0b6cc36fa52..30f344e4282 100644 --- a/src/test/ui/issues/issue-53692.rs +++ b/src/test/ui/issues/issue-53692.rs @@ -1,22 +1,15 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. fn main() { let items = vec![1, 2, 3]; let ref_items: &[i32] = &items; let items_clone: Vec = ref_items.clone(); +//~^ ERROR mismatched types // in that case no suggestion will be triggered let items_clone_2:Vec = items.clone(); let s = "hi"; let string: String = s.clone(); +//~^ ERROR mismatched types // in that case no suggestion will be triggered let s2 = "hi"; diff --git a/src/test/ui/issues/issue-53692.stderr b/src/test/ui/issues/issue-53692.stderr index 9cd8a536155..2928d4461c5 100644 --- a/src/test/ui/issues/issue-53692.stderr +++ b/src/test/ui/issues/issue-53692.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-53692.rs:13:37 + --> $DIR/issue-53692.rs:4:37 | LL | let items_clone: Vec = ref_items.clone(); | ^^^^^^^^^^^^^^^^^ @@ -11,7 +11,7 @@ LL | let items_clone: Vec = ref_items.clone(); found type `&[i32]` error[E0308]: mismatched types - --> $DIR/issue-53692.rs:19:30 + --> $DIR/issue-53692.rs:11:30 | LL | let string: String = s.clone(); | ^^^^^^^^^ diff --git a/src/test/ui/issues/issue-53840.rs b/src/test/ui/issues/issue-53840.rs index ece3caf78e2..e854d24ab97 100644 --- a/src/test/ui/issues/issue-53840.rs +++ b/src/test/ui/issues/issue-53840.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. enum E { Foo(String, String, String), } @@ -20,8 +11,10 @@ fn main() { let bar = Bar { a: "1".to_string(), b: "2".to_string() }; match E::Foo("".into(), "".into(), "".into()) { E::Foo(a, b, ref c) => {} +//~^ ERROR cannot bind by-move and by-ref in the same pattern } match bar { Bar {a, ref b} => {} +//~^ ERROR cannot bind by-move and by-ref in the same pattern } } diff --git a/src/test/ui/issues/issue-53840.stderr b/src/test/ui/issues/issue-53840.stderr index 961e4c0ff62..0032f60a221 100644 --- a/src/test/ui/issues/issue-53840.stderr +++ b/src/test/ui/issues/issue-53840.stderr @@ -1,5 +1,5 @@ error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/issue-53840.rs:22:16 + --> $DIR/issue-53840.rs:13:16 | LL | E::Foo(a, b, ref c) => {} | ^ ^ ----- both by-ref and by-move used @@ -8,7 +8,7 @@ LL | E::Foo(a, b, ref c) => {} | by-move pattern here error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/issue-53840.rs:25:14 + --> $DIR/issue-53840.rs:17:14 | LL | Bar {a, ref b} => {} | ^ ----- both by-ref and by-move used diff --git a/src/test/ui/issues/issue-54302-cases.rs b/src/test/ui/issues/issue-54302-cases.rs index 6d1c61c80f0..faa116269ee 100644 --- a/src/test/ui/issues/issue-54302-cases.rs +++ b/src/test/ui/issues/issue-54302-cases.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Mirror { type Image; fn coerce(self) -> Self::Image; @@ -71,25 +61,25 @@ impl RefFoo for T where for<'a> &'a T: Foo<'static, T> { fn coerce_lifetime1(a: &u32) -> &'static u32 { >::ref_foo(a) - //~^ ERROR the trait bound `for<'a> &'a u32: Foo2<'_, u32>` is not satisfied + //~^ ERROR not general enough } fn coerce_lifetime2(a: &i32) -> &'static i32 { >::ref_foo(a) - //~^ ERROR the requirement `for<'a> 'a : ` is not satisfied + //~^ ERROR not general enough } fn coerce_lifetime3(a: &u64) -> &'static u64 { >::ref_foo(a) - //~^ ERROR type mismatch resolving `for<'a> <&'a u64 as Mirror>::Image == &u64` + //~^ ERROR not general enough } fn coerce_lifetime4(a: &i64) -> &'static i64 { >::ref_foo(a) - //~^ ERROR type mismatch resolving `for<'a> <&'a i64 as Mirror>::Image == &i64` + //~^ ERROR not general enough } fn main() {} diff --git a/src/test/ui/issues/issue-54302-cases.stderr b/src/test/ui/issues/issue-54302-cases.stderr index 9603f7a973c..98637611b79 100644 --- a/src/test/ui/issues/issue-54302-cases.stderr +++ b/src/test/ui/issues/issue-54302-cases.stderr @@ -1,65 +1,38 @@ -error[E0277]: the trait bound `for<'a> &'a u32: Foo2<'_, u32>` is not satisfied - --> $DIR/issue-54302-cases.rs:73:5 +error: implementation of `Foo` is not general enough + --> $DIR/issue-54302-cases.rs:63:5 | LL | >::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo2<'_, u32>` is not implemented for `&'a u32` - | - = help: the following implementations were found: - <&'x u32 as Foo2<'x, u32>> - = note: required because of the requirements on the impl of `for<'a> Foo<'static, u32>` for `&'a u32` - = note: required because of the requirements on the impl of `RefFoo` for `u32` -note: required by `RefFoo::ref_foo` - --> $DIR/issue-54302-cases.rs:61:5 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `Foo<'static, u32>` would have to be implemented for the type `&'0 u32`, for any lifetime `'0` + = note: but `Foo<'_, u32>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` -error[E0279]: the requirement `for<'a> 'a : ` is not satisfied (`expected bound lifetime parameter 'a, found concrete lifetime`) - --> $DIR/issue-54302-cases.rs:79:5 +error: implementation of `Foo` is not general enough + --> $DIR/issue-54302-cases.rs:69:5 | LL | >::ref_foo(a) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: required because of the requirements on the impl of `for<'a> Foo2<'_, i32>` for `&'a i32` - = note: required because of the requirements on the impl of `for<'a> Foo<'static, i32>` for `&'a i32` - = note: required because of the requirements on the impl of `RefFoo` for `i32` -note: required by `RefFoo::ref_foo` - --> $DIR/issue-54302-cases.rs:61:5 - | -LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `Foo<'static, i32>` would have to be implemented for the type `&'0 i32`, for any lifetime `'0` + = note: but `Foo<'_, i32>` is actually implemented for the type `&'1 i32`, for some specific lifetime `'1` -error[E0271]: type mismatch resolving `for<'a> <&'a u64 as Mirror>::Image == &u64` - --> $DIR/issue-54302-cases.rs:85:5 +error: implementation of `Foo` is not general enough + --> $DIR/issue-54302-cases.rs:75:5 | LL | >::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'a, found concrete lifetime - | - = note: required because of the requirements on the impl of `for<'a> Foo2<'_, u64>` for `&'a u64` - = note: required because of the requirements on the impl of `for<'a> Foo<'static, u64>` for `&'a u64` - = note: required because of the requirements on the impl of `RefFoo` for `u64` -note: required by `RefFoo::ref_foo` - --> $DIR/issue-54302-cases.rs:61:5 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `Foo<'static, u64>` would have to be implemented for the type `&'0 u64`, for any lifetime `'0` + = note: but `Foo<'_, u64>` is actually implemented for the type `&'1 u64`, for some specific lifetime `'1` -error[E0271]: type mismatch resolving `for<'a> <&'a i64 as Mirror>::Image == &i64` - --> $DIR/issue-54302-cases.rs:91:5 +error: implementation of `Foo` is not general enough + --> $DIR/issue-54302-cases.rs:81:5 | LL | >::ref_foo(a) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'a, found concrete lifetime - | - = note: required because of the requirements on the impl of `for<'a> Foo2<'_, i64>` for `&'a i64` - = note: required because of the requirements on the impl of `for<'a> Foo<'static, i64>` for `&'a i64` - = note: required because of the requirements on the impl of `RefFoo` for `i64` -note: required by `RefFoo::ref_foo` - --> $DIR/issue-54302-cases.rs:61:5 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -LL | fn ref_foo(&self) -> &'static T; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `Foo<'static, i64>` would have to be implemented for the type `&'0 i64`, for any lifetime `'0` + = note: but `Foo<'_, i64>` is actually implemented for the type `&'1 i64`, for some specific lifetime `'1` error: aborting due to 4 previous errors -Some errors occurred: E0271, E0277, E0279. -For more information about an error, try `rustc --explain E0271`. diff --git a/src/test/ui/issues/issue-54302.rs b/src/test/ui/issues/issue-54302.rs index 969d19cac2d..1bfaebc3895 100644 --- a/src/test/ui/issues/issue-54302.rs +++ b/src/test/ui/issues/issue-54302.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Deserialize<'de> {} trait DeserializeOwned: for<'de> Deserialize<'de> {} @@ -21,7 +11,7 @@ fn main() { // Then why does it implement DeserializeOwned? This compiles. fn assert_deserialize_owned() {} assert_deserialize_owned::<&'static str>(); - //~^ ERROR the requirement `for<'de> 'de : ` is not satisfied + //~^ ERROR not general enough // It correctly does not implement for<'de> Deserialize<'de>. //fn assert_hrtb Deserialize<'de>>() {} diff --git a/src/test/ui/issues/issue-54302.stderr b/src/test/ui/issues/issue-54302.stderr index f122daeecf6..c6d0805f3ab 100644 --- a/src/test/ui/issues/issue-54302.stderr +++ b/src/test/ui/issues/issue-54302.stderr @@ -1,17 +1,11 @@ -error[E0279]: the requirement `for<'de> 'de : ` is not satisfied (`expected bound lifetime parameter 'de, found concrete lifetime`) - --> $DIR/issue-54302.rs:23:5 +error: implementation of `Deserialize` is not general enough + --> $DIR/issue-54302.rs:13:5 | LL | assert_deserialize_owned::<&'static str>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: required because of the requirements on the impl of `for<'de> Deserialize<'de>` for `&'static str` - = note: required because of the requirements on the impl of `DeserializeOwned` for `&'static str` -note: required by `main::assert_deserialize_owned` - --> $DIR/issue-54302.rs:22:5 - | -LL | fn assert_deserialize_owned() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: `&'static str` must implement `Deserialize<'0>`, for any lifetime `'0` + = note: but `&str` actually implements `Deserialize<'1>`, for some specific lifetime `'1` error: aborting due to previous error -For more information about this error, try `rustc --explain E0279`. diff --git a/src/test/ui/issues/issue-54348.rs b/src/test/ui/issues/issue-54348.rs index b980290391d..68d83805477 100644 --- a/src/test/ui/issues/issue-54348.rs +++ b/src/test/ui/issues/issue-54348.rs @@ -1,5 +1,5 @@ fn main() { [1][0u64 as usize]; - [1][1.5 as usize]; // ERROR index out of bounds - [1][1u64 as usize]; // ERROR index out of bounds + [1][1.5 as usize]; //~ ERROR index out of bounds + [1][1u64 as usize]; //~ ERROR index out of bounds } diff --git a/src/test/ui/issues/issue-54348.stderr b/src/test/ui/issues/issue-54348.stderr index a9f1b494258..d4ee94aa411 100644 --- a/src/test/ui/issues/issue-54348.stderr +++ b/src/test/ui/issues/issue-54348.stderr @@ -1,7 +1,7 @@ error: index out of bounds: the len is 1 but the index is 1 --> $DIR/issue-54348.rs:3:5 | -LL | [1][1.5 as usize]; // ERROR index out of bounds +LL | [1][1.5 as usize]; //~ ERROR index out of bounds | ^^^^^^^^^^^^^^^^^ | = note: #[deny(const_err)] on by default @@ -9,7 +9,7 @@ LL | [1][1.5 as usize]; // ERROR index out of bounds error: index out of bounds: the len is 1 but the index is 1 --> $DIR/issue-54348.rs:4:5 | -LL | [1][1u64 as usize]; // ERROR index out of bounds +LL | [1][1u64 as usize]; //~ ERROR index out of bounds | ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-5439.rs b/src/test/ui/issues/issue-5439.rs index 4e618f3d858..cd039506f38 100644 --- a/src/test/ui/issues/issue-5439.rs +++ b/src/test/ui/issues/issue-5439.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] struct Foo { diff --git a/src/test/ui/issues/issue-5439.stderr b/src/test/ui/issues/issue-5439.stderr index 87e20f3a03d..847bc769580 100644 --- a/src/test/ui/issues/issue-5439.stderr +++ b/src/test/ui/issues/issue-5439.stderr @@ -1,5 +1,5 @@ error[E0560]: struct `Foo` has no field named `nonexistent` - --> $DIR/issue-5439.rs:23:26 + --> $DIR/issue-5439.rs:13:26 | LL | return box Foo { nonexistent: self, foo: i }; //~ ERROR: no field named | ^^^^^^^^^^^ `Foo` does not have this field diff --git a/src/test/ui/issues/issue-54410.stderr b/src/test/ui/issues/issue-54410.stderr index ae6888f067e..992c691bf21 100644 --- a/src/test/ui/issues/issue-54410.stderr +++ b/src/test/ui/issues/issue-54410.stderr @@ -5,7 +5,7 @@ LL | pub static mut symbol: [i8]; | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[i8]` - = note: to learn more, visit + = note: to learn more, visit error: aborting due to previous error diff --git a/src/test/ui/issues/issue-54521-1.rs b/src/test/ui/issues/issue-54521-1.rs new file mode 100644 index 00000000000..d6a14a6e11f --- /dev/null +++ b/src/test/ui/issues/issue-54521-1.rs @@ -0,0 +1,16 @@ +// compile-pass + +// This test checks that the `remove extra angle brackets` error doesn't happen for some +// potential edge-cases.. + +struct X { + len: u32, +} + +fn main() { + let x = X { len: 3 }; + + let _ = x.len > (3); + + let _ = x.len >> (3); +} diff --git a/src/test/ui/issues/issue-54521-2.fixed b/src/test/ui/issues/issue-54521-2.fixed new file mode 100644 index 00000000000..a91c4fe43ea --- /dev/null +++ b/src/test/ui/issues/issue-54521-2.fixed @@ -0,0 +1,22 @@ +// run-rustfix + +// This test checks that the following error is emitted and the suggestion works: +// +// ``` +// let _ = Vec::>>::new(); +// ^^ help: remove extra angle brackets +// ``` + +fn main() { + let _ = Vec::::new(); + //~^ ERROR unmatched angle bracket + + let _ = Vec::::new(); + //~^ ERROR unmatched angle bracket + + let _ = Vec::::new(); + //~^ ERROR unmatched angle bracket + + let _ = Vec::::new(); + //~^ ERROR unmatched angle bracket +} diff --git a/src/test/ui/issues/issue-54521-2.rs b/src/test/ui/issues/issue-54521-2.rs new file mode 100644 index 00000000000..3639aac87ee --- /dev/null +++ b/src/test/ui/issues/issue-54521-2.rs @@ -0,0 +1,22 @@ +// run-rustfix + +// This test checks that the following error is emitted and the suggestion works: +// +// ``` +// let _ = Vec::>>::new(); +// ^^ help: remove extra angle brackets +// ``` + +fn main() { + let _ = Vec::>>>>::new(); + //~^ ERROR unmatched angle bracket + + let _ = Vec::>>>::new(); + //~^ ERROR unmatched angle bracket + + let _ = Vec::>>::new(); + //~^ ERROR unmatched angle bracket + + let _ = Vec::>::new(); + //~^ ERROR unmatched angle bracket +} diff --git a/src/test/ui/issues/issue-54521-2.stderr b/src/test/ui/issues/issue-54521-2.stderr new file mode 100644 index 00000000000..9556b83b730 --- /dev/null +++ b/src/test/ui/issues/issue-54521-2.stderr @@ -0,0 +1,26 @@ +error: unmatched angle brackets + --> $DIR/issue-54521-2.rs:11:25 + | +LL | let _ = Vec::>>>>::new(); + | ^^^^ help: remove extra angle brackets + +error: unmatched angle brackets + --> $DIR/issue-54521-2.rs:14:25 + | +LL | let _ = Vec::>>>::new(); + | ^^^ help: remove extra angle brackets + +error: unmatched angle brackets + --> $DIR/issue-54521-2.rs:17:25 + | +LL | let _ = Vec::>>::new(); + | ^^ help: remove extra angle brackets + +error: unmatched angle bracket + --> $DIR/issue-54521-2.rs:20:25 + | +LL | let _ = Vec::>::new(); + | ^ help: remove extra angle bracket + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/issues/issue-54521.fixed b/src/test/ui/issues/issue-54521.fixed new file mode 100644 index 00000000000..84ab6866cf1 --- /dev/null +++ b/src/test/ui/issues/issue-54521.fixed @@ -0,0 +1,22 @@ +// run-rustfix + +// This test checks that the following error is emitted and the suggestion works: +// +// ``` +// let _ = vec![1, 2, 3].into_iter().collect::>>>(); +// ^^ help: remove extra angle brackets +// ``` + +fn main() { + let _ = vec![1, 2, 3].into_iter().collect::>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::>(); + //~^ ERROR unmatched angle bracket +} diff --git a/src/test/ui/issues/issue-54521.rs b/src/test/ui/issues/issue-54521.rs new file mode 100644 index 00000000000..f1d68504178 --- /dev/null +++ b/src/test/ui/issues/issue-54521.rs @@ -0,0 +1,22 @@ +// run-rustfix + +// This test checks that the following error is emitted and the suggestion works: +// +// ``` +// let _ = vec![1, 2, 3].into_iter().collect::>>>(); +// ^^ help: remove extra angle brackets +// ``` + +fn main() { + let _ = vec![1, 2, 3].into_iter().collect::>>>>>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::>>>>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::>>>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::>>(); + //~^ ERROR unmatched angle bracket +} diff --git a/src/test/ui/issues/issue-54521.stderr b/src/test/ui/issues/issue-54521.stderr new file mode 100644 index 00000000000..ffefbfd0348 --- /dev/null +++ b/src/test/ui/issues/issue-54521.stderr @@ -0,0 +1,26 @@ +error: unmatched angle brackets + --> $DIR/issue-54521.rs:11:60 + | +LL | let _ = vec![1, 2, 3].into_iter().collect::>>>>>(); + | ^^^^ help: remove extra angle brackets + +error: unmatched angle brackets + --> $DIR/issue-54521.rs:14:60 + | +LL | let _ = vec![1, 2, 3].into_iter().collect::>>>>(); + | ^^^ help: remove extra angle brackets + +error: unmatched angle brackets + --> $DIR/issue-54521.rs:17:60 + | +LL | let _ = vec![1, 2, 3].into_iter().collect::>>>(); + | ^^ help: remove extra angle brackets + +error: unmatched angle bracket + --> $DIR/issue-54521.rs:20:60 + | +LL | let _ = vec![1, 2, 3].into_iter().collect::>>(); + | ^ help: remove extra angle bracket + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/issues/issue-54582.rs b/src/test/ui/issues/issue-54582.rs new file mode 100644 index 00000000000..c2dbf361911 --- /dev/null +++ b/src/test/ui/issues/issue-54582.rs @@ -0,0 +1,16 @@ +// run-pass + +pub trait Stage: Sync {} + +pub enum Enum { + A, + B, +} + +impl Stage for Enum {} + +pub static ARRAY: [(&Stage, &str); 1] = [ + (&Enum::A, ""), +]; + +fn main() {} diff --git a/src/test/ui/issues/issue-5500-1.ast.stderr b/src/test/ui/issues/issue-5500-1.ast.stderr index 5ea18af7c68..681ccbc4276 100644 --- a/src/test/ui/issues/issue-5500-1.ast.stderr +++ b/src/test/ui/issues/issue-5500-1.ast.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to field `_iter.node` of immutable binding - --> $DIR/issue-5500-1.rs:22:5 + --> $DIR/issue-5500-1.rs:12:5 | LL | let _iter = TrieMapIterator{node: &a}; | ----- help: make this binding mutable: `mut _iter` diff --git a/src/test/ui/issues/issue-5500-1.mir.stderr b/src/test/ui/issues/issue-5500-1.mir.stderr index 5cb72794961..67ca23ca297 100644 --- a/src/test/ui/issues/issue-5500-1.mir.stderr +++ b/src/test/ui/issues/issue-5500-1.mir.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to field `_iter.node` of immutable binding (Ast) - --> $DIR/issue-5500-1.rs:22:5 + --> $DIR/issue-5500-1.rs:12:5 | LL | let _iter = TrieMapIterator{node: &a}; | ----- help: make this binding mutable: `mut _iter` diff --git a/src/test/ui/issues/issue-5500-1.rs b/src/test/ui/issues/issue-5500-1.rs index 8d6efa774a3..e8043563c73 100644 --- a/src/test/ui/issues/issue-5500-1.rs +++ b/src/test/ui/issues/issue-5500-1.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-compare-mode-nll // revisions: ast mir //[mir]compile-flags: -Z borrowck=compare diff --git a/src/test/ui/issues/issue-5572.rs b/src/test/ui/issues/issue-5572.rs index 90465668d81..e5963a7c435 100644 --- a/src/test/ui/issues/issue-5572.rs +++ b/src/test/ui/issues/issue-5572.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-55796.rs b/src/test/ui/issues/issue-55796.rs index b48d4a9c022..efdea5c9b1e 100644 --- a/src/test/ui/issues/issue-55796.rs +++ b/src/test/ui/issues/issue-55796.rs @@ -14,9 +14,13 @@ pub trait Graph<'a> { fn out_neighbors(&'a self, u: &Self::Node) -> Box> { Box::new(self.out_edges(u).map(|e| e.target())) +//~^ ERROR cannot infer } fn in_neighbors(&'a self, u: &Self::Node) -> Box> { Box::new(self.in_edges(u).map(|e| e.target())) +//~^ ERROR cannot infer } } + +fn main() {} diff --git a/src/test/ui/issues/issue-55796.stderr b/src/test/ui/issues/issue-55796.stderr index 60ce8293a5c..c05f8b85d0e 100644 --- a/src/test/ui/issues/issue-55796.stderr +++ b/src/test/ui/issues/issue-55796.stderr @@ -1,7 +1,3 @@ -error[E0601]: `main` function not found in crate `issue_55796` - | - = note: consider adding a `main` function to `$DIR/issue-55796.rs` - error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/issue-55796.rs:16:9 | @@ -24,7 +20,7 @@ LL | Box::new(self.out_edges(u).map(|e| e.target())) found std::boxed::Box>::Node>> error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/issue-55796.rs:20:9 + --> $DIR/issue-55796.rs:21:9 | LL | Box::new(self.in_edges(u).map(|e| e.target())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -34,8 +30,8 @@ note: first, the lifetime cannot outlive the lifetime 'a as defined on the trait | LL | pub trait Graph<'a> { | ^^ -note: ...so that the type `std::iter::Map<>::EdgesIter, [closure@$DIR/issue-55796.rs:20:39: 20:53]>` will meet its required lifetime bounds - --> $DIR/issue-55796.rs:20:9 +note: ...so that the type `std::iter::Map<>::EdgesIter, [closure@$DIR/issue-55796.rs:21:39: 21:53]>` will meet its required lifetime bounds + --> $DIR/issue-55796.rs:21:9 | LL | Box::new(self.in_edges(u).map(|e| e.target())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -44,7 +40,6 @@ LL | Box::new(self.in_edges(u).map(|e| e.target())) expected std::boxed::Box<(dyn std::iter::Iterator>::Node> + 'static)> found std::boxed::Box>::Node>> -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors occurred: E0495, E0601. -For more information about an error, try `rustc --explain E0495`. +For more information about this error, try `rustc --explain E0495`. diff --git a/src/test/ui/issues/issue-56128.rs b/src/test/ui/issues/issue-56128.rs new file mode 100644 index 00000000000..3a3eccdc33c --- /dev/null +++ b/src/test/ui/issues/issue-56128.rs @@ -0,0 +1,15 @@ +// Regression test for #56128. When this `pub(super) use...` gets +// exploded in the HIR, we were not handling ids correctly. +// +// compile-pass + +mod bar { + pub(super) use self::baz::{x, y}; + + mod baz { + pub fn x() { } + pub fn y() { } + } +} + +fn main() { } diff --git a/src/test/ui/issues/issue-56199.rs b/src/test/ui/issues/issue-56199.rs new file mode 100644 index 00000000000..ba11582a9d5 --- /dev/null +++ b/src/test/ui/issues/issue-56199.rs @@ -0,0 +1,22 @@ +enum Foo {} +struct Bar {} + +impl Foo { + fn foo() { + let _ = Self; + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + let _ = Self(); + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + } +} + +impl Bar { + fn bar() { + let _ = Self; + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + let _ = Self(); + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-56199.stderr b/src/test/ui/issues/issue-56199.stderr new file mode 100644 index 00000000000..7aaf8e4ac2f --- /dev/null +++ b/src/test/ui/issues/issue-56199.stderr @@ -0,0 +1,30 @@ +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56199.rs:6:17 + | +LL | let _ = Self; + | ^^^^ + | + = help: did you mean to use one of the enum's variants? + +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56199.rs:8:17 + | +LL | let _ = Self(); + | ^^^^ + | + = help: did you mean to use one of the enum's variants? + +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56199.rs:15:17 + | +LL | let _ = Self; + | ^^^^ help: use curly brackets: `Self { /* fields */ }` + +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56199.rs:17:17 + | +LL | let _ = Self(); + | ^^^^ help: use curly brackets: `Self { /* fields */ }` + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/issues/issue-56202.rs b/src/test/ui/issues/issue-56202.rs new file mode 100644 index 00000000000..bd222b7fe98 --- /dev/null +++ b/src/test/ui/issues/issue-56202.rs @@ -0,0 +1,17 @@ +// compile-pass + +trait FooTrait {} + +trait BarTrait { + fn foo(_: T) -> Self; +} + +struct FooStruct(u32); + +impl BarTrait for FooStruct { + fn foo(_: T) -> Self { + Self(u32::default()) + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-56411.rs b/src/test/ui/issues/issue-56411.rs new file mode 100644 index 00000000000..3561c21cc7e --- /dev/null +++ b/src/test/ui/issues/issue-56411.rs @@ -0,0 +1,17 @@ +macro_rules! import { + ( $($name:ident),* ) => { + $( + mod $name; + pub use self::$name; + //~^ ERROR the name `issue_56411_aux` is defined multiple times + //~| ERROR `issue_56411_aux` is private, and cannot be re-exported + + )* + } +} + +import!(issue_56411_aux); + +fn main() { + println!("Hello, world!"); +} diff --git a/src/test/ui/issues/issue-56411.stderr b/src/test/ui/issues/issue-56411.stderr new file mode 100644 index 00000000000..dd05852c091 --- /dev/null +++ b/src/test/ui/issues/issue-56411.stderr @@ -0,0 +1,31 @@ +error[E0255]: the name `issue_56411_aux` is defined multiple times + --> $DIR/issue-56411.rs:5:21 + | +LL | mod $name; + | ---------- previous definition of the module `issue_56411_aux` here +LL | pub use self::$name; + | ^^^^^^^^^^^ + | | + | `issue_56411_aux` reimported here + | you can use `as` to change the binding name of the import +... +LL | import!(issue_56411_aux); + | ------------------------- in this macro invocation + | + = note: `issue_56411_aux` must be defined only once in the type namespace of this module + +error[E0365]: `issue_56411_aux` is private, and cannot be re-exported + --> $DIR/issue-56411.rs:5:21 + | +LL | pub use self::$name; + | ^^^^^^^^^^^ re-export of private `issue_56411_aux` +... +LL | import!(issue_56411_aux); + | ------------------------- in this macro invocation + | + = note: consider declaring type or module `issue_56411_aux` with `pub` + +error: aborting due to 2 previous errors + +Some errors occurred: E0255, E0365. +For more information about an error, try `rustc --explain E0255`. diff --git a/src/test/ui/issues/issue-56488.rs b/src/test/ui/issues/issue-56488.rs new file mode 100644 index 00000000000..e2f3996927b --- /dev/null +++ b/src/test/ui/issues/issue-56488.rs @@ -0,0 +1,13 @@ +// run-pass + +#![feature(trait_alias)] + +mod alpha { + pub trait A {} + pub trait C = A; +} + +#[allow(unused_imports)] +use alpha::C; + +fn main() {} diff --git a/src/test/ui/issues/issue-56685.rs b/src/test/ui/issues/issue-56685.rs new file mode 100644 index 00000000000..f320c99ed15 --- /dev/null +++ b/src/test/ui/issues/issue-56685.rs @@ -0,0 +1,44 @@ +#![allow(dead_code)] +#![deny(unused_variables)] + +// This test aims to check that unused variable suggestions update bindings in all +// match arms. + +fn main() { + enum E { + A(i32,), + B(i32,), + } + + match E::A(1) { + E::A(x) | E::B(x) => {} + //~^ ERROR unused variable: `x` + } + + enum F { + A(i32, i32,), + B(i32, i32,), + C(i32, i32,), + } + + let _ = match F::A(1, 2) { + F::A(x, y) | F::B(x, y) => { y }, + //~^ ERROR unused variable: `x` + F::C(a, b) => { 3 } + //~^ ERROR unused variable: `a` + //~^^ ERROR unused variable: `b` + }; + + let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { + //~^ ERROR unused variable: `x` + y + } else { + 3 + }; + + while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { + //~^ ERROR unused variable: `x` + let _ = y; + break; + } +} diff --git a/src/test/ui/issues/issue-56685.stderr b/src/test/ui/issues/issue-56685.stderr new file mode 100644 index 00000000000..4a461c72b24 --- /dev/null +++ b/src/test/ui/issues/issue-56685.stderr @@ -0,0 +1,60 @@ +error: unused variable: `x` + --> $DIR/issue-56685.rs:14:14 + | +LL | E::A(x) | E::B(x) => {} + | ^ ^ + | +note: lint level defined here + --> $DIR/issue-56685.rs:2:9 + | +LL | #![deny(unused_variables)] + | ^^^^^^^^^^^^^^^^ +help: consider prefixing with an underscore + | +LL | E::A(_x) | E::B(_x) => {} + | ^^ ^^ + +error: unused variable: `x` + --> $DIR/issue-56685.rs:25:14 + | +LL | F::A(x, y) | F::B(x, y) => { y }, + | ^ ^ +help: consider prefixing with an underscore + | +LL | F::A(_x, y) | F::B(_x, y) => { y }, + | ^^ ^^ + +error: unused variable: `a` + --> $DIR/issue-56685.rs:27:14 + | +LL | F::C(a, b) => { 3 } + | ^ help: consider prefixing with an underscore: `_a` + +error: unused variable: `b` + --> $DIR/issue-56685.rs:27:17 + | +LL | F::C(a, b) => { 3 } + | ^ help: consider prefixing with an underscore: `_b` + +error: unused variable: `x` + --> $DIR/issue-56685.rs:32:25 + | +LL | let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { + | ^ ^ +help: consider prefixing with an underscore + | +LL | let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { + | ^^ ^^ + +error: unused variable: `x` + --> $DIR/issue-56685.rs:39:20 + | +LL | while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { + | ^ ^ +help: consider prefixing with an underscore + | +LL | while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { + | ^^ ^^ + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/issues/issue-56762.rs b/src/test/ui/issues/issue-56762.rs new file mode 100644 index 00000000000..97b66b2c7c9 --- /dev/null +++ b/src/test/ui/issues/issue-56762.rs @@ -0,0 +1,18 @@ +// only-x86_64 +const HUGE_SIZE: usize = !0usize / 8; + + +pub struct TooBigArray { + arr: [u8; HUGE_SIZE], +} + +impl TooBigArray { + pub const fn new() -> Self { + TooBigArray { arr: [0x00; HUGE_SIZE], } + } +} + +static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new(); +static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE]; + +fn main() { } diff --git a/src/test/ui/issues/issue-56762.stderr b/src/test/ui/issues/issue-56762.stderr new file mode 100644 index 00000000000..83d5dc62e61 --- /dev/null +++ b/src/test/ui/issues/issue-56762.stderr @@ -0,0 +1,4 @@ +error: the type `[u8; 2305843009213693951]` is too big for the current architecture + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-56806.rs b/src/test/ui/issues/issue-56806.rs new file mode 100644 index 00000000000..b6454e578e6 --- /dev/null +++ b/src/test/ui/issues/issue-56806.rs @@ -0,0 +1,7 @@ +pub trait Trait { + fn dyn_instead_of_self(self: Box); + //~^ ERROR invalid method receiver type: std::boxed::Box<(dyn Trait + 'static)> +} + +pub fn main() { +} diff --git a/src/test/ui/issues/issue-56806.stderr b/src/test/ui/issues/issue-56806.stderr new file mode 100644 index 00000000000..2dd3add8f60 --- /dev/null +++ b/src/test/ui/issues/issue-56806.stderr @@ -0,0 +1,12 @@ +error[E0307]: invalid method receiver type: std::boxed::Box<(dyn Trait + 'static)> + --> $DIR/issue-56806.rs:2:34 + | +LL | fn dyn_instead_of_self(self: Box); + | ^^^^^^^^^^^^^^ + | + = note: type must be `Self` or a type that dereferences to it + = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0307`. diff --git a/src/test/ui/issues/issue-56835.rs b/src/test/ui/issues/issue-56835.rs new file mode 100644 index 00000000000..4f976da680e --- /dev/null +++ b/src/test/ui/issues/issue-56835.rs @@ -0,0 +1,9 @@ +pub struct Foo {} + +impl Foo { + fn bar(Self(foo): Self) {} + //~^ ERROR the `Self` constructor can only be used with tuple or unit structs + //~^^ ERROR expected tuple struct/variant, found self constructor `Self` [E0164] +} + +fn main() {} diff --git a/src/test/ui/issues/issue-56835.stderr b/src/test/ui/issues/issue-56835.stderr new file mode 100644 index 00000000000..f9fdf23af97 --- /dev/null +++ b/src/test/ui/issues/issue-56835.stderr @@ -0,0 +1,15 @@ +error: the `Self` constructor can only be used with tuple or unit structs + --> $DIR/issue-56835.rs:4:12 + | +LL | fn bar(Self(foo): Self) {} + | ^^^^^^^^^ help: use curly brackets: `Self { /* fields */ }` + +error[E0164]: expected tuple struct/variant, found self constructor `Self` + --> $DIR/issue-56835.rs:4:12 + | +LL | fn bar(Self(foo): Self) {} + | ^^^^^^^^^ not a tuple variant or struct + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0164`. diff --git a/src/test/ui/issues/issue-56943.rs b/src/test/ui/issues/issue-56943.rs new file mode 100644 index 00000000000..8fc77abdbf5 --- /dev/null +++ b/src/test/ui/issues/issue-56943.rs @@ -0,0 +1,8 @@ +// aux-build:issue-56943.rs + +extern crate issue_56943; + +fn main() { + let _: issue_56943::S = issue_56943::S2; + //~^ ERROR mismatched types [E0308] +} diff --git a/src/test/ui/issues/issue-56943.stderr b/src/test/ui/issues/issue-56943.stderr new file mode 100644 index 00000000000..27202051524 --- /dev/null +++ b/src/test/ui/issues/issue-56943.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/issue-56943.rs:6:29 + | +LL | let _: issue_56943::S = issue_56943::S2; + | ^^^^^^^^^^^^^^^ expected struct `issue_56943::S`, found struct `issue_56943::S2` + | + = note: expected type `issue_56943::S` + found type `issue_56943::S2` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-57156.rs b/src/test/ui/issues/issue-57156.rs new file mode 100644 index 00000000000..f20b0f41c7f --- /dev/null +++ b/src/test/ui/issues/issue-57156.rs @@ -0,0 +1,23 @@ +// compile-pass + +trait Foo { + type Output; +} + +trait Bar<'a, T>: for<'s> Foo<&'s T, Output=bool> { + fn cb(&self) -> Box>; +} + +impl<'s> Foo<&'s ()> for () { + type Output = bool; +} + +impl<'a> Bar<'a, ()> for () { + fn cb(&self) -> Box> { + Box::new(*self) + } +} + +fn main() { + let _t = ().cb(); +} diff --git a/src/test/ui/issues/issue-57162.rs b/src/test/ui/issues/issue-57162.rs new file mode 100644 index 00000000000..abe0887e927 --- /dev/null +++ b/src/test/ui/issues/issue-57162.rs @@ -0,0 +1,7 @@ +// compile-pass + +trait Foo {} +impl Foo for dyn Send {} + +impl Foo for T {} +fn main() {} diff --git a/src/test/ui/issues/issue-57198-pass.rs b/src/test/ui/issues/issue-57198-pass.rs new file mode 100644 index 00000000000..3857def9824 --- /dev/null +++ b/src/test/ui/issues/issue-57198-pass.rs @@ -0,0 +1,9 @@ +// run-pass + +mod m { + pub fn r#for() {} +} + +fn main() { + m::r#for(); +} diff --git a/src/test/ui/issues/issue-57198.rs b/src/test/ui/issues/issue-57198.rs new file mode 100644 index 00000000000..714a46cbc9f --- /dev/null +++ b/src/test/ui/issues/issue-57198.rs @@ -0,0 +1,8 @@ +mod m { + pub fn r#for() {} +} + +fn main() { + m::for(); + //~^ ERROR expected identifier, found keyword `for` +} diff --git a/src/test/ui/issues/issue-57198.stderr b/src/test/ui/issues/issue-57198.stderr new file mode 100644 index 00000000000..2ab552ccbd3 --- /dev/null +++ b/src/test/ui/issues/issue-57198.stderr @@ -0,0 +1,12 @@ +error: expected identifier, found keyword `for` + --> $DIR/issue-57198.rs:6:8 + | +LL | m::for(); + | ^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | m::r#for(); + | ^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-57362-1.rs b/src/test/ui/issues/issue-57362-1.rs new file mode 100644 index 00000000000..fe6b69f0097 --- /dev/null +++ b/src/test/ui/issues/issue-57362-1.rs @@ -0,0 +1,23 @@ +// Test for issue #57362, ensuring that the self ty is shown in cases of higher-ranked lifetimes +// conflicts: the `expected` and `found` trait refs would otherwise be printed the same, leading +// to confusing notes such as: +// = note: expected type `Trait` +// found type `Trait` + +// from issue #57362 +trait Trait { + fn f(self); +} + +impl Trait for fn(&T) { + fn f(self) { + println!("f"); + } +} + +fn f() { + let a: fn(_) = |_: &u8| {}; + a.f(); //~ ERROR not general enough +} + +fn main() {} diff --git a/src/test/ui/issues/issue-57362-1.stderr b/src/test/ui/issues/issue-57362-1.stderr new file mode 100644 index 00000000000..06946bcf744 --- /dev/null +++ b/src/test/ui/issues/issue-57362-1.stderr @@ -0,0 +1,11 @@ +error: implementation of `Trait` is not general enough + --> $DIR/issue-57362-1.rs:20:7 + | +LL | a.f(); //~ ERROR not general enough + | ^ + | + = note: `Trait` would have to be implemented for the type `fn(&'0 u8)`, for some specific lifetime `'0` + = note: but `Trait` is actually implemented for the type `for<'r> fn(&'r u8)` + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-57362-2.rs b/src/test/ui/issues/issue-57362-2.rs new file mode 100644 index 00000000000..436a4a90457 --- /dev/null +++ b/src/test/ui/issues/issue-57362-2.rs @@ -0,0 +1,25 @@ +// Test for issue #57362, ensuring that the self ty is shown in cases of higher-ranked lifetimes +// conflicts: the `expected` and `found` trait refs would otherwise be printed the same, leading +// to confusing notes such as: +// = note: expected type `Trait` +// found type `Trait` + +// extracted from a similar issue: #57642 +trait X { + type G; + fn make_g() -> Self::G; +} + +impl<'a> X for fn(&'a ()) { + type G = &'a (); + + fn make_g() -> Self::G { + &() + } +} + +fn g() { + let x = ::make_g(); //~ ERROR not general enough +} + +fn main() {} diff --git a/src/test/ui/issues/issue-57362-2.stderr b/src/test/ui/issues/issue-57362-2.stderr new file mode 100644 index 00000000000..14b7f52bb87 --- /dev/null +++ b/src/test/ui/issues/issue-57362-2.stderr @@ -0,0 +1,11 @@ +error: implementation of `X` is not general enough + --> $DIR/issue-57362-2.rs:22:13 + | +LL | let x = ::make_g(); //~ ERROR not general enough + | ^^^^^^^^^^^^^^^^^^ + | + = note: `X` would have to be implemented for the type `for<'r> fn(&'r ())` + = note: but `X` is actually implemented for the type `fn(&'0 ())`, for some specific lifetime `'0` + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-57472.rs b/src/test/ui/issues/issue-57472.rs new file mode 100644 index 00000000000..1131006374c --- /dev/null +++ b/src/test/ui/issues/issue-57472.rs @@ -0,0 +1,35 @@ +#![crate_type="lib"] +#![deny(unreachable_patterns)] + +mod test_struct { + // Test the exact copy of the minimal example + // posted in the issue. + pub struct Punned { + foo: [u8; 1], + bar: [u8; 1], + } + + pub fn test(punned: Punned) { + match punned { + Punned { foo: [_], .. } => println!("foo"), + Punned { bar: [_], .. } => println!("bar"), + //~^ ERROR unreachable pattern [unreachable_patterns] + } + } +} + +mod test_union { + // Test the same thing using a union. + pub union Punned { + foo: [u8; 1], + bar: [u8; 1], + } + + pub fn test(punned: Punned) { + match punned { + Punned { foo: [_] } => println!("foo"), + Punned { bar: [_] } => println!("bar"), + //~^ ERROR unreachable pattern [unreachable_patterns] + } + } +} diff --git a/src/test/ui/issues/issue-57472.stderr b/src/test/ui/issues/issue-57472.stderr new file mode 100644 index 00000000000..b6dd7e24941 --- /dev/null +++ b/src/test/ui/issues/issue-57472.stderr @@ -0,0 +1,20 @@ +error: unreachable pattern + --> $DIR/issue-57472.rs:15:13 + | +LL | Punned { bar: [_], .. } => println!("bar"), + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/issue-57472.rs:2:9 + | +LL | #![deny(unreachable_patterns)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unreachable pattern + --> $DIR/issue-57472.rs:31:13 + | +LL | Punned { bar: [_] } => println!("bar"), + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/issues/issue-5754.rs b/src/test/ui/issues/issue-5754.rs index d60edcad0db..78e87013359 100644 --- a/src/test/ui/issues/issue-5754.rs +++ b/src/test/ui/issues/issue-5754.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(improper_ctypes)] diff --git a/src/test/ui/issues/issue-57597.rs b/src/test/ui/issues/issue-57597.rs new file mode 100644 index 00000000000..ebeb3fe07ad --- /dev/null +++ b/src/test/ui/issues/issue-57597.rs @@ -0,0 +1,80 @@ +// Regression test for #57597. +// +// Make sure that nested matchers work correctly rather than causing an infinite loop or crash. + +// edition:2018 + +macro_rules! foo1 { + ($($($i:ident)?)+) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo2 { + ($($($i:ident)?)*) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo3 { + ($($($i:ident)?)?) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo4 { + ($($($($i:ident)?)?)?) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo5 { + ($($($($i:ident)*)?)?) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo6 { + ($($($($i:ident)?)*)?) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo7 { + ($($($($i:ident)?)?)*) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo8 { + ($($($($i:ident)*)*)?) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo9 { + ($($($($i:ident)?)*)*) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo10 { + ($($($($i:ident)?)*)+) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo11 { + ($($($($i:ident)+)?)*) => {}; + //~^ ERROR repetition matches empty token tree +} + +macro_rules! foo12 { + ($($($($i:ident)+)*)?) => {}; + //~^ ERROR repetition matches empty token tree +} + +fn main() { + foo1!(); + foo2!(); + foo3!(); + foo4!(); + foo5!(); + foo6!(); + foo7!(); + foo8!(); + foo9!(); + foo10!(); + foo11!(); + foo12!(); +} diff --git a/src/test/ui/issues/issue-57597.stderr b/src/test/ui/issues/issue-57597.stderr new file mode 100644 index 00000000000..0a02ac8c499 --- /dev/null +++ b/src/test/ui/issues/issue-57597.stderr @@ -0,0 +1,74 @@ +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:8:7 + | +LL | ($($($i:ident)?)+) => {}; + | ^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:13:7 + | +LL | ($($($i:ident)?)*) => {}; + | ^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:18:7 + | +LL | ($($($i:ident)?)?) => {}; + | ^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:23:7 + | +LL | ($($($($i:ident)?)?)?) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:28:7 + | +LL | ($($($($i:ident)*)?)?) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:33:7 + | +LL | ($($($($i:ident)?)*)?) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:38:7 + | +LL | ($($($($i:ident)?)?)*) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:43:7 + | +LL | ($($($($i:ident)*)*)?) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:48:7 + | +LL | ($($($($i:ident)?)*)*) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:53:7 + | +LL | ($($($($i:ident)?)*)+) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:58:7 + | +LL | ($($($($i:ident)+)?)*) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: repetition matches empty token tree + --> $DIR/issue-57597.rs:63:7 + | +LL | ($($($($i:ident)+)*)?) => {}; + | ^^^^^^^^^^^^^^^^^^ + +error: aborting due to 12 previous errors + diff --git a/src/test/ui/issues/issue-57684.fixed b/src/test/ui/issues/issue-57684.fixed new file mode 100644 index 00000000000..4a432206d51 --- /dev/null +++ b/src/test/ui/issues/issue-57684.fixed @@ -0,0 +1,37 @@ +// run-rustfix + +#![allow(warnings)] + +// This test checks that the following error is emitted when a `=` character is used to initialize +// a struct field when a `:` is expected. +// +// ``` +// error: struct fields are initialized with a colon +// --> $DIR/issue-57684.rs:12:20 +// | +// LL | let _ = X { f1 = 5 }; +// | ^ help: replace equals symbol with a colon: `:` +// ``` + +struct X { + f1: i32, +} + +struct Y { + f1: i32, + f2: i32, + f3: i32, +} + +fn main() { + let _ = X { f1: 5 }; + //~^ ERROR expected `:`, found `=` + + let f3 = 3; + let _ = Y { + f1: 5, + //~^ ERROR expected `:`, found `=` + f2: 4, + f3, + }; +} diff --git a/src/test/ui/issues/issue-57684.rs b/src/test/ui/issues/issue-57684.rs new file mode 100644 index 00000000000..7a62785e32f --- /dev/null +++ b/src/test/ui/issues/issue-57684.rs @@ -0,0 +1,37 @@ +// run-rustfix + +#![allow(warnings)] + +// This test checks that the following error is emitted when a `=` character is used to initialize +// a struct field when a `:` is expected. +// +// ``` +// error: struct fields are initialized with a colon +// --> $DIR/issue-57684.rs:12:20 +// | +// LL | let _ = X { f1 = 5 }; +// | ^ help: replace equals symbol with a colon: `:` +// ``` + +struct X { + f1: i32, +} + +struct Y { + f1: i32, + f2: i32, + f3: i32, +} + +fn main() { + let _ = X { f1 = 5 }; + //~^ ERROR expected `:`, found `=` + + let f3 = 3; + let _ = Y { + f1 = 5, + //~^ ERROR expected `:`, found `=` + f2: 4, + f3, + }; +} diff --git a/src/test/ui/issues/issue-57684.stderr b/src/test/ui/issues/issue-57684.stderr new file mode 100644 index 00000000000..514bbffde6b --- /dev/null +++ b/src/test/ui/issues/issue-57684.stderr @@ -0,0 +1,18 @@ +error: expected `:`, found `=` + --> $DIR/issue-57684.rs:27:20 + | +LL | let _ = X { f1 = 5 }; + | -^ + | | + | help: replace equals symbol with a colon: `:` + +error: expected `:`, found `=` + --> $DIR/issue-57684.rs:32:12 + | +LL | f1 = 5, + | -^ + | | + | help: replace equals symbol with a colon: `:` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/issues/issue-57741-1.rs b/src/test/ui/issues/issue-57741-1.rs new file mode 100644 index 00000000000..d0aae23b2fc --- /dev/null +++ b/src/test/ui/issues/issue-57741-1.rs @@ -0,0 +1,18 @@ +#![allow(warnings)] + +// This tests that the `help: consider dereferencing the boxed value` suggestion isn't made +// because the box doesn't deref to the type of the arm. + +enum S { + A { a: usize }, + B { b: usize }, +} + +fn main() { + let x = Box::new(3u32); + let y = match x { + S::A { a } | S::B { b: a } => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; +} diff --git a/src/test/ui/issues/issue-57741-1.stderr b/src/test/ui/issues/issue-57741-1.stderr new file mode 100644 index 00000000000..d36424b83b4 --- /dev/null +++ b/src/test/ui/issues/issue-57741-1.stderr @@ -0,0 +1,25 @@ +error[E0308]: mismatched types + --> $DIR/issue-57741-1.rs:14:9 + | +LL | let y = match x { + | - this match expression has type `std::boxed::Box` +LL | S::A { a } | S::B { b: a } => a, + | ^^^^^^^^^^ expected struct `std::boxed::Box`, found enum `S` + | + = note: expected type `std::boxed::Box` + found type `S` + +error[E0308]: mismatched types + --> $DIR/issue-57741-1.rs:14:22 + | +LL | let y = match x { + | - this match expression has type `std::boxed::Box` +LL | S::A { a } | S::B { b: a } => a, + | ^^^^^^^^^^^^^ expected struct `std::boxed::Box`, found enum `S` + | + = note: expected type `std::boxed::Box` + found type `S` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-57741.fixed b/src/test/ui/issues/issue-57741.fixed new file mode 100644 index 00000000000..4cae080033c --- /dev/null +++ b/src/test/ui/issues/issue-57741.fixed @@ -0,0 +1,31 @@ +// run-rustfix + +#![allow(warnings)] + +// This tests that the `help: consider dereferencing the boxed value` suggestion is made and works. + +enum S { + A { a: usize }, + B { b: usize }, +} + +enum T { + A(usize), + B(usize), +} + +fn main() { + let x = Box::new(T::A(3)); + let y = match *x { + T::A(a) | T::B(a) => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; + + let x = Box::new(S::A { a: 3 }); + let y = match *x { + S::A { a } | S::B { b: a } => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; +} diff --git a/src/test/ui/issues/issue-57741.rs b/src/test/ui/issues/issue-57741.rs new file mode 100644 index 00000000000..e2658295af7 --- /dev/null +++ b/src/test/ui/issues/issue-57741.rs @@ -0,0 +1,31 @@ +// run-rustfix + +#![allow(warnings)] + +// This tests that the `help: consider dereferencing the boxed value` suggestion is made and works. + +enum S { + A { a: usize }, + B { b: usize }, +} + +enum T { + A(usize), + B(usize), +} + +fn main() { + let x = Box::new(T::A(3)); + let y = match x { + T::A(a) | T::B(a) => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; + + let x = Box::new(S::A { a: 3 }); + let y = match x { + S::A { a } | S::B { b: a } => a, + //~^ ERROR mismatched types [E0308] + //~^^ ERROR mismatched types [E0308] + }; +} diff --git a/src/test/ui/issues/issue-57741.stderr b/src/test/ui/issues/issue-57741.stderr new file mode 100644 index 00000000000..a26b1d20ca3 --- /dev/null +++ b/src/test/ui/issues/issue-57741.stderr @@ -0,0 +1,59 @@ +error[E0308]: mismatched types + --> $DIR/issue-57741.rs:20:9 + | +LL | let y = match x { + | - + | | + | this match expression has type `std::boxed::Box` + | help: consider dereferencing the boxed value: `*x` +LL | T::A(a) | T::B(a) => a, + | ^^^^^^^ expected struct `std::boxed::Box`, found enum `T` + | + = note: expected type `std::boxed::Box` + found type `T` + +error[E0308]: mismatched types + --> $DIR/issue-57741.rs:20:19 + | +LL | let y = match x { + | - + | | + | this match expression has type `std::boxed::Box` + | help: consider dereferencing the boxed value: `*x` +LL | T::A(a) | T::B(a) => a, + | ^^^^^^^ expected struct `std::boxed::Box`, found enum `T` + | + = note: expected type `std::boxed::Box` + found type `T` + +error[E0308]: mismatched types + --> $DIR/issue-57741.rs:27:9 + | +LL | let y = match x { + | - + | | + | this match expression has type `std::boxed::Box` + | help: consider dereferencing the boxed value: `*x` +LL | S::A { a } | S::B { b: a } => a, + | ^^^^^^^^^^ expected struct `std::boxed::Box`, found enum `S` + | + = note: expected type `std::boxed::Box` + found type `S` + +error[E0308]: mismatched types + --> $DIR/issue-57741.rs:27:22 + | +LL | let y = match x { + | - + | | + | this match expression has type `std::boxed::Box` + | help: consider dereferencing the boxed value: `*x` +LL | S::A { a } | S::B { b: a } => a, + | ^^^^^^^^^^^^^ expected struct `std::boxed::Box`, found enum `S` + | + = note: expected type `std::boxed::Box` + found type `S` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-57819.fixed b/src/test/ui/issues/issue-57819.fixed new file mode 100644 index 00000000000..3fab21db2d0 --- /dev/null +++ b/src/test/ui/issues/issue-57819.fixed @@ -0,0 +1,47 @@ +// run-rustfix + +#![allow(warnings)] + +// This test checks that the following error is emitted and the suggestion works: +// +// ``` +// let _ = vec![1, 2, 3].into_iter().collect::<<>(); +// ^^ help: remove extra angle brackets +// ``` + +trait Foo { + type Output; +} + +fn foo() { + // More complex cases with more than one correct leading `<` character: + + bar::<::Output>(); + //~^ ERROR unmatched angle bracket + + bar::<::Output>(); + //~^ ERROR unmatched angle bracket + + bar::<::Output>(); + //~^ ERROR unmatched angle bracket + + bar::<::Output>(); +} + +fn bar() {} + +fn main() { + let _ = vec![1, 2, 3].into_iter().collect::>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::>(); +} diff --git a/src/test/ui/issues/issue-57819.rs b/src/test/ui/issues/issue-57819.rs new file mode 100644 index 00000000000..5cafbf439be --- /dev/null +++ b/src/test/ui/issues/issue-57819.rs @@ -0,0 +1,47 @@ +// run-rustfix + +#![allow(warnings)] + +// This test checks that the following error is emitted and the suggestion works: +// +// ``` +// let _ = vec![1, 2, 3].into_iter().collect::<<>(); +// ^^ help: remove extra angle brackets +// ``` + +trait Foo { + type Output; +} + +fn foo() { + // More complex cases with more than one correct leading `<` character: + + bar::<<<<::Output>(); + //~^ ERROR unmatched angle bracket + + bar::<<<::Output>(); + //~^ ERROR unmatched angle bracket + + bar::<<::Output>(); + //~^ ERROR unmatched angle bracket + + bar::<::Output>(); +} + +fn bar() {} + +fn main() { + let _ = vec![1, 2, 3].into_iter().collect::<<<<>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::<<<>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::<<>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::<>(); + //~^ ERROR unmatched angle bracket + + let _ = vec![1, 2, 3].into_iter().collect::>(); +} diff --git a/src/test/ui/issues/issue-57819.stderr b/src/test/ui/issues/issue-57819.stderr new file mode 100644 index 00000000000..493e9835b1c --- /dev/null +++ b/src/test/ui/issues/issue-57819.stderr @@ -0,0 +1,44 @@ +error: unmatched angle brackets + --> $DIR/issue-57819.rs:19:10 + | +LL | bar::<<<<::Output>(); + | ^^^ help: remove extra angle brackets + +error: unmatched angle brackets + --> $DIR/issue-57819.rs:22:10 + | +LL | bar::<<<::Output>(); + | ^^ help: remove extra angle brackets + +error: unmatched angle bracket + --> $DIR/issue-57819.rs:25:10 + | +LL | bar::<<::Output>(); + | ^ help: remove extra angle bracket + +error: unmatched angle brackets + --> $DIR/issue-57819.rs:34:48 + | +LL | let _ = vec![1, 2, 3].into_iter().collect::<<<<>(); + | ^^^^ help: remove extra angle brackets + +error: unmatched angle brackets + --> $DIR/issue-57819.rs:37:48 + | +LL | let _ = vec![1, 2, 3].into_iter().collect::<<<>(); + | ^^^ help: remove extra angle brackets + +error: unmatched angle brackets + --> $DIR/issue-57819.rs:40:48 + | +LL | let _ = vec![1, 2, 3].into_iter().collect::<<>(); + | ^^ help: remove extra angle brackets + +error: unmatched angle bracket + --> $DIR/issue-57819.rs:43:48 + | +LL | let _ = vec![1, 2, 3].into_iter().collect::<>(); + | ^ help: remove extra angle bracket + +error: aborting due to 7 previous errors + diff --git a/src/test/ui/issues/issue-57866.rs b/src/test/ui/issues/issue-57866.rs new file mode 100644 index 00000000000..77c50e53868 --- /dev/null +++ b/src/test/ui/issues/issue-57866.rs @@ -0,0 +1,26 @@ +// compile-pass + +#![feature(type_alias_enum_variants)] + +enum Outer { + A(T) +} + +enum Inner { + A(i32) +} + +type OuterAlias = Outer; + +fn ice(x: OuterAlias) { + // Fine + match x { + OuterAlias::A(Inner::A(_)) => (), + } + // Not fine + match x { + OuterAlias::A(Inner::A(y)) => (), + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-58006.rs b/src/test/ui/issues/issue-58006.rs new file mode 100644 index 00000000000..1fb5fefa759 --- /dev/null +++ b/src/test/ui/issues/issue-58006.rs @@ -0,0 +1,15 @@ +#![feature(type_alias_enum_variants)] +pub enum Enum { + A(usize), +} + +impl Enum { + fn foo(&self) -> () { + match self { + Self::A => (), + //~^ ERROR expected unit struct/variant or constant, found tuple variant + } + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-58006.stderr b/src/test/ui/issues/issue-58006.stderr new file mode 100644 index 00000000000..c65e3e2777f --- /dev/null +++ b/src/test/ui/issues/issue-58006.stderr @@ -0,0 +1,9 @@ +error[E0533]: expected unit struct/variant or constant, found tuple variant `::A` + --> $DIR/issue-58006.rs:9:13 + | +LL | Self::A => (), + | ^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0533`. diff --git a/src/test/ui/issues/issue-5844.rs b/src/test/ui/issues/issue-5844.rs index 329bfd1dde0..b855e87e3f5 100644 --- a/src/test/ui/issues/issue-5844.rs +++ b/src/test/ui/issues/issue-5844.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //aux-build:issue-5844-aux.rs extern crate issue_5844_aux; diff --git a/src/test/ui/issues/issue-5844.stderr b/src/test/ui/issues/issue-5844.stderr index 05b0b63439f..876151fb25c 100644 --- a/src/test/ui/issues/issue-5844.stderr +++ b/src/test/ui/issues/issue-5844.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/issue-5844.rs:16:5 + --> $DIR/issue-5844.rs:6:5 | LL | issue_5844_aux::rand(); //~ ERROR: requires unsafe | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/issues/issue-5883.rs b/src/test/ui/issues/issue-5883.rs index a91f5d281dd..b4a73ba99c5 100644 --- a/src/test/ui/issues/issue-5883.rs +++ b/src/test/ui/issues/issue-5883.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait A {} struct Struct { diff --git a/src/test/ui/issues/issue-5883.stderr b/src/test/ui/issues/issue-5883.stderr index 63dabd86ca8..ad463d4c478 100644 --- a/src/test/ui/issues/issue-5883.stderr +++ b/src/test/ui/issues/issue-5883.stderr @@ -1,22 +1,22 @@ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time - --> $DIR/issue-5883.rs:17:15 + --> $DIR/issue-5883.rs:7:15 | LL | fn new_struct(r: A+'static) | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time - --> $DIR/issue-5883.rs:18:8 + --> $DIR/issue-5883.rs:8:8 | LL | -> Struct { //~^ ERROR the size for values of type | ^^^^^^ doesn't have a size known at compile-time | = help: within `Struct`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `Struct` = note: the return type of a function must have a statically known size diff --git a/src/test/ui/issues/issue-5884.rs b/src/test/ui/issues/issue-5884.rs index d0c898e3f36..ad7067bb9b1 100644 --- a/src/test/ui/issues/issue-5884.rs +++ b/src/test/ui/issues/issue-5884.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-5900.rs b/src/test/ui/issues/issue-5900.rs index 4dc5a612388..5ac7acc8e39 100644 --- a/src/test/ui/issues/issue-5900.rs +++ b/src/test/ui/issues/issue-5900.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-5927.rs b/src/test/ui/issues/issue-5927.rs index bb802f353af..847936cc954 100644 --- a/src/test/ui/issues/issue-5927.rs +++ b/src/test/ui/issues/issue-5927.rs @@ -1,14 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn main() { let z = match 3 { x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope diff --git a/src/test/ui/issues/issue-5927.stderr b/src/test/ui/issues/issue-5927.stderr index f8b9b15678d..189eefe51b9 100644 --- a/src/test/ui/issues/issue-5927.stderr +++ b/src/test/ui/issues/issue-5927.stderr @@ -1,11 +1,11 @@ error[E0531]: cannot find tuple struct/variant `x` in this scope - --> $DIR/issue-5927.rs:14:9 + --> $DIR/issue-5927.rs:3:9 | LL | x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope | ^ not found in this scope error[E0425]: cannot find function `x` in this scope - --> $DIR/issue-5927.rs:14:17 + --> $DIR/issue-5927.rs:3:17 | LL | x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope | ^ not found in this scope diff --git a/src/test/ui/issues/issue-5950.rs b/src/test/ui/issues/issue-5950.rs index 6cdd36efaa7..19e0cfc7f27 100644 --- a/src/test/ui/issues/issue-5950.rs +++ b/src/test/ui/issues/issue-5950.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-5997-enum.rs b/src/test/ui/issues/issue-5997-enum.rs index 463fdaa1069..0987117ecd4 100644 --- a/src/test/ui/issues/issue-5997-enum.rs +++ b/src/test/ui/issues/issue-5997-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f() -> bool { enum E { V(Z) } //~^ ERROR can't use type parameters from outer function diff --git a/src/test/ui/issues/issue-5997-enum.stderr b/src/test/ui/issues/issue-5997-enum.stderr index 9f26f653ebd..5c26dc92c85 100644 --- a/src/test/ui/issues/issue-5997-enum.stderr +++ b/src/test/ui/issues/issue-5997-enum.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use type parameters from outer function - --> $DIR/issue-5997-enum.rs:12:16 + --> $DIR/issue-5997-enum.rs:2:16 | LL | fn f() -> bool { | - - type variable from outer function diff --git a/src/test/ui/issues/issue-5997-struct.rs b/src/test/ui/issues/issue-5997-struct.rs index af9e66b770b..04ac489a55c 100644 --- a/src/test/ui/issues/issue-5997-struct.rs +++ b/src/test/ui/issues/issue-5997-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f() -> bool { struct S(T); //~ ERROR can't use type parameters from outer function diff --git a/src/test/ui/issues/issue-5997-struct.stderr b/src/test/ui/issues/issue-5997-struct.stderr index fd6d67bd128..1d05d13242e 100644 --- a/src/test/ui/issues/issue-5997-struct.stderr +++ b/src/test/ui/issues/issue-5997-struct.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use type parameters from outer function - --> $DIR/issue-5997-struct.rs:12:14 + --> $DIR/issue-5997-struct.rs:2:14 | LL | fn f() -> bool { | - - type variable from outer function diff --git a/src/test/ui/issues/issue-6341.rs b/src/test/ui/issues/issue-6341.rs index 758e33536bd..2b23ccd2586 100644 --- a/src/test/ui/issues/issue-6341.rs +++ b/src/test/ui/issues/issue-6341.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-6458-2.rs b/src/test/ui/issues/issue-6458-2.rs index 87cf2b3f740..b18cae3ed1a 100644 --- a/src/test/ui/issues/issue-6458-2.rs +++ b/src/test/ui/issues/issue-6458-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { // Unconstrained type: format!("{:?}", None); diff --git a/src/test/ui/issues/issue-6458-2.stderr b/src/test/ui/issues/issue-6458-2.stderr index e192c2c3be3..b5da2bf096c 100644 --- a/src/test/ui/issues/issue-6458-2.stderr +++ b/src/test/ui/issues/issue-6458-2.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-6458-2.rs:13:21 + --> $DIR/issue-6458-2.rs:3:21 | LL | format!("{:?}", None); | ^^^^ cannot infer type for `T` diff --git a/src/test/ui/issues/issue-6458-3.rs b/src/test/ui/issues/issue-6458-3.rs index 038f6043fa6..d4f8886e9b0 100644 --- a/src/test/ui/issues/issue-6458-3.rs +++ b/src/test/ui/issues/issue-6458-3.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem; fn main() { diff --git a/src/test/ui/issues/issue-6458-3.stderr b/src/test/ui/issues/issue-6458-3.stderr index c09b2643dfa..784497c959d 100644 --- a/src/test/ui/issues/issue-6458-3.stderr +++ b/src/test/ui/issues/issue-6458-3.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-6458-3.rs:14:5 + --> $DIR/issue-6458-3.rs:4:5 | LL | mem::transmute(0); | ^^^^^^^^^^^^^^ cannot infer type for `U` diff --git a/src/test/ui/issues/issue-6458-4.rs b/src/test/ui/issues/issue-6458-4.rs index 45934d03ed4..054a5c15c3f 100644 --- a/src/test/ui/issues/issue-6458-4.rs +++ b/src/test/ui/issues/issue-6458-4.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(b: bool) -> Result { //~ ERROR mismatched types Err("bar".to_string()); } diff --git a/src/test/ui/issues/issue-6458-4.stderr b/src/test/ui/issues/issue-6458-4.stderr index 13b0ace6465..c087292e978 100644 --- a/src/test/ui/issues/issue-6458-4.stderr +++ b/src/test/ui/issues/issue-6458-4.stderr @@ -1,12 +1,12 @@ error[E0308]: mismatched types - --> $DIR/issue-6458-4.rs:11:40 + --> $DIR/issue-6458-4.rs:1:20 | -LL | fn foo(b: bool) -> Result { //~ ERROR mismatched types - | ________________________________________^ -LL | | Err("bar".to_string()); - | | - help: consider removing this semicolon -LL | | } - | |_^ expected enum `std::result::Result`, found () +LL | fn foo(b: bool) -> Result { //~ ERROR mismatched types + | --- ^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found () + | | + | this function's body doesn't return +LL | Err("bar".to_string()); + | - help: consider removing this semicolon | = note: expected type `std::result::Result` found type `()` diff --git a/src/test/ui/issues/issue-6458.rs b/src/test/ui/issues/issue-6458.rs index b4e7c0c40cf..16718e90deb 100644 --- a/src/test/ui/issues/issue-6458.rs +++ b/src/test/ui/issues/issue-6458.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; pub struct TypeWithState(marker::PhantomData); diff --git a/src/test/ui/issues/issue-6458.stderr b/src/test/ui/issues/issue-6458.stderr index 701795c748d..d59d872ba93 100644 --- a/src/test/ui/issues/issue-6458.stderr +++ b/src/test/ui/issues/issue-6458.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-6458.rs:19:4 + --> $DIR/issue-6458.rs:9:4 | LL | foo(TypeWithState(marker::PhantomData)); | ^^^ cannot infer type for `State` diff --git a/src/test/ui/issues/issue-6470.rs b/src/test/ui/issues/issue-6470.rs index 00eb3b6348d..49a313f90de 100644 --- a/src/test/ui/issues/issue-6470.rs +++ b/src/test/ui/issues/issue-6470.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(improper_ctypes)] diff --git a/src/test/ui/issues/issue-6557.rs b/src/test/ui/issues/issue-6557.rs index ddec8b3f934..aa091ca594a 100644 --- a/src/test/ui/issues/issue-6557.rs +++ b/src/test/ui/issues/issue-6557.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-6596-1.rs b/src/test/ui/issues/issue-6596-1.rs index ce8a3a80e1f..5da54451346 100644 --- a/src/test/ui/issues/issue-6596-1.rs +++ b/src/test/ui/issues/issue-6596-1.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - macro_rules! e { ($inp:ident) => ( $nonexistent diff --git a/src/test/ui/issues/issue-6596-1.stderr b/src/test/ui/issues/issue-6596-1.stderr index b7055ab19d0..2a4ece2f242 100644 --- a/src/test/ui/issues/issue-6596-1.stderr +++ b/src/test/ui/issues/issue-6596-1.stderr @@ -1,5 +1,5 @@ error: unknown macro variable `nonexistent` - --> $DIR/issue-6596-1.rs:14:9 + --> $DIR/issue-6596-1.rs:3:9 | LL | $nonexistent | ^^^^^^^^^^^^ unknown macro variable diff --git a/src/test/ui/issues/issue-6596-2.rs b/src/test/ui/issues/issue-6596-2.rs index 3e18de6178a..b19700efe5a 100644 --- a/src/test/ui/issues/issue-6596-2.rs +++ b/src/test/ui/issues/issue-6596-2.rs @@ -1,23 +1,13 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(macro_rules)] macro_rules! g { ($inp:ident) => ( { $inp $nonexistent } //~^ ERROR unknown macro variable `nonexistent` - //~| ERROR expected one of ); } fn main() { + let foo = 0; g!(foo); } diff --git a/src/test/ui/issues/issue-6596-2.stderr b/src/test/ui/issues/issue-6596-2.stderr index f2ed17f35e6..20fbe0fab01 100644 --- a/src/test/ui/issues/issue-6596-2.stderr +++ b/src/test/ui/issues/issue-6596-2.stderr @@ -1,5 +1,5 @@ error: unknown macro variable `nonexistent` - --> $DIR/issue-6596-2.rs:15:16 + --> $DIR/issue-6596-2.rs:5:16 | LL | { $inp $nonexistent } | ^^^^^^^^^^^^ unknown macro variable @@ -7,14 +7,5 @@ LL | { $inp $nonexistent } LL | g!(foo); | -------- in this macro invocation -error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `nonexistent` - --> $DIR/issue-6596-2.rs:15:16 - | -LL | { $inp $nonexistent } - | ^^^^^^^^^^^^ expected one of 8 possible tokens here -... -LL | g!(foo); - | -------- in this macro invocation - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/src/test/ui/issues/issue-6642.rs b/src/test/ui/issues/issue-6642.rs index 1fe10ba7a27..f80f6fffe89 100644 --- a/src/test/ui/issues/issue-6642.rs +++ b/src/test/ui/issues/issue-6642.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct A; impl A { fn m(&self) { diff --git a/src/test/ui/issues/issue-6642.stderr b/src/test/ui/issues/issue-6642.stderr index 1762af52eb0..a99d9b3cd77 100644 --- a/src/test/ui/issues/issue-6642.stderr +++ b/src/test/ui/issues/issue-6642.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/issue-6642.rs:15:13 + --> $DIR/issue-6642.rs:5:13 | LL | self.m() //~ ERROR can't capture dynamic environment in a fn item | ^^^^ diff --git a/src/test/ui/issues/issue-6738.rs b/src/test/ui/issues/issue-6738.rs index 447d0e061ee..a2f8dfe9c49 100644 --- a/src/test/ui/issues/issue-6738.rs +++ b/src/test/ui/issues/issue-6738.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: T, } diff --git a/src/test/ui/issues/issue-6738.stderr b/src/test/ui/issues/issue-6738.stderr index 8c0aff9d9ab..82b670bd03b 100644 --- a/src/test/ui/issues/issue-6738.stderr +++ b/src/test/ui/issues/issue-6738.stderr @@ -1,5 +1,5 @@ error[E0368]: binary assignment operation `+=` cannot be applied to type `T` - --> $DIR/issue-6738.rs:16:9 + --> $DIR/issue-6738.rs:6:9 | LL | self.x += v.x; | ------^^^^^^^ diff --git a/src/test/ui/issues/issue-6801.nll.stderr b/src/test/ui/issues/issue-6801.nll.stderr index 3ca2f39470d..2c0fedf351a 100644 --- a/src/test/ui/issues/issue-6801.nll.stderr +++ b/src/test/ui/issues/issue-6801.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/issue-6801.rs:29:13 + --> $DIR/issue-6801.rs:19:13 | LL | let sq = || { *x * *x }; | -- - borrow occurs due to use in closure diff --git a/src/test/ui/issues/issue-6801.rs b/src/test/ui/issues/issue-6801.rs index 792d27c179b..694d86feb5a 100644 --- a/src/test/ui/issues/issue-6801.rs +++ b/src/test/ui/issues/issue-6801.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Creating a stack closure which references a box and then // transferring ownership of the box before invoking the stack // closure results in a crash. diff --git a/src/test/ui/issues/issue-6801.stderr b/src/test/ui/issues/issue-6801.stderr index 8a1c669f0b2..fa0e1928ba4 100644 --- a/src/test/ui/issues/issue-6801.stderr +++ b/src/test/ui/issues/issue-6801.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/issue-6801.rs:29:13 + --> $DIR/issue-6801.rs:19:13 | LL | let sq = || { *x * *x }; | -- borrow of `x` occurs here diff --git a/src/test/ui/issues/issue-6804.rs b/src/test/ui/issues/issue-6804.rs index fffa27ab842..da73e2bd397 100644 --- a/src/test/ui/issues/issue-6804.rs +++ b/src/test/ui/issues/issue-6804.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Matching against NaN should result in a warning #![allow(unused)] diff --git a/src/test/ui/issues/issue-6804.stderr b/src/test/ui/issues/issue-6804.stderr index 45eefbfaf8e..965148d478e 100644 --- a/src/test/ui/issues/issue-6804.stderr +++ b/src/test/ui/issues/issue-6804.stderr @@ -1,11 +1,11 @@ error: floating-point types cannot be used in patterns - --> $DIR/issue-6804.rs:21:9 + --> $DIR/issue-6804.rs:11:9 | LL | NAN => {}, //~ ERROR floating-point types cannot be used | ^^^ | note: lint level defined here - --> $DIR/issue-6804.rs:14:9 + --> $DIR/issue-6804.rs:4:9 | LL | #![deny(illegal_floating_point_literal_pattern)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | #![deny(illegal_floating_point_literal_pattern)] = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-6804.rs:27:10 + --> $DIR/issue-6804.rs:17:10 | LL | [NAN, _] => {}, //~ ERROR floating-point types cannot be used | ^^^ diff --git a/src/test/ui/issues/issue-6898.rs b/src/test/ui/issues/issue-6898.rs index 20174f241a4..608c0c80716 100644 --- a/src/test/ui/issues/issue-6898.rs +++ b/src/test/ui/issues/issue-6898.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-6936.rs b/src/test/ui/issues/issue-6936.rs index 8eb16edcbd3..26531bba9ec 100644 --- a/src/test/ui/issues/issue-6936.rs +++ b/src/test/ui/issues/issue-6936.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct T; mod t1 { diff --git a/src/test/ui/issues/issue-6936.stderr b/src/test/ui/issues/issue-6936.stderr index 48fcbf40622..b3fe1ddc483 100644 --- a/src/test/ui/issues/issue-6936.stderr +++ b/src/test/ui/issues/issue-6936.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-6936.rs:15:5 + --> $DIR/issue-6936.rs:5:5 | LL | type Foo = ::T; | --------------- previous definition of the type `Foo` here @@ -9,7 +9,7 @@ LL | mod Foo {} //~ ERROR the name `Foo` is defined multiple times = note: `Foo` must be defined only once in the type namespace of this module error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-6936.rs:20:5 + --> $DIR/issue-6936.rs:10:5 | LL | type Foo = ::T; | --------------- previous definition of the type `Foo` here @@ -19,7 +19,7 @@ LL | struct Foo; //~ ERROR the name `Foo` is defined multiple times = note: `Foo` must be defined only once in the type namespace of this module error[E0428]: the name `Foo` is defined multiple times - --> $DIR/issue-6936.rs:25:5 + --> $DIR/issue-6936.rs:15:5 | LL | type Foo = ::T; | --------------- previous definition of the type `Foo` here @@ -29,7 +29,7 @@ LL | enum Foo {} //~ ERROR the name `Foo` is defined multiple times = note: `Foo` must be defined only once in the type namespace of this module error[E0428]: the name `Bar` is defined multiple times - --> $DIR/issue-6936.rs:35:5 + --> $DIR/issue-6936.rs:25:5 | LL | type Bar = T; | ---------------- previous definition of the type `Bar` here diff --git a/src/test/ui/issues/issue-6991.rs b/src/test/ui/issues/issue-6991.rs index 1de1f8b1a86..e835edea113 100644 --- a/src/test/ui/issues/issue-6991.rs +++ b/src/test/ui/issues/issue-6991.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/ui/issues/issue-7013.rs b/src/test/ui/issues/issue-7013.rs index 0c19780bcb4..ee68aa8623b 100644 --- a/src/test/ui/issues/issue-7013.rs +++ b/src/test/ui/issues/issue-7013.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] use std::cell::RefCell; diff --git a/src/test/ui/issues/issue-7013.stderr b/src/test/ui/issues/issue-7013.stderr index fec6e06a699..22185c7da34 100644 --- a/src/test/ui/issues/issue-7013.stderr +++ b/src/test/ui/issues/issue-7013.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::rc::Rc>` cannot be sent between threads safely - --> $DIR/issue-7013.rs:36:19 + --> $DIR/issue-7013.rs:26:19 | LL | let a = A {v: box B{v: None} as Box}; | ^^^^^^^^^^^^^^ `std::rc::Rc>` cannot be sent between threads safely diff --git a/src/test/ui/issues/issue-7044.rs b/src/test/ui/issues/issue-7044.rs index 9b72c249356..a6e22bc5237 100644 --- a/src/test/ui/issues/issue-7044.rs +++ b/src/test/ui/issues/issue-7044.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static X: isize = 0; struct X; //~ ERROR the name `X` is defined multiple times diff --git a/src/test/ui/issues/issue-7044.stderr b/src/test/ui/issues/issue-7044.stderr index 02707b2d21e..46c5d164e42 100644 --- a/src/test/ui/issues/issue-7044.stderr +++ b/src/test/ui/issues/issue-7044.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `X` is defined multiple times - --> $DIR/issue-7044.rs:12:1 + --> $DIR/issue-7044.rs:2:1 | LL | static X: isize = 0; | -------------------- previous definition of the value `X` here diff --git a/src/test/ui/issues/issue-7061.rs b/src/test/ui/issues/issue-7061.rs index b99f5b707ee..66ae90034e7 100644 --- a/src/test/ui/issues/issue-7061.rs +++ b/src/test/ui/issues/issue-7061.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct BarStruct; impl<'a> BarStruct { diff --git a/src/test/ui/issues/issue-7061.stderr b/src/test/ui/issues/issue-7061.stderr index 4f142ba95bc..96c539f629e 100644 --- a/src/test/ui/issues/issue-7061.stderr +++ b/src/test/ui/issues/issue-7061.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-7061.rs:14:46 + --> $DIR/issue-7061.rs:4:46 | LL | fn foo(&'a mut self) -> Box { self } | -------------- ^^^^ expected struct `std::boxed::Box`, found mutable reference diff --git a/src/test/ui/issues/issue-7092.rs b/src/test/ui/issues/issue-7092.rs index 26e1597b1db..b49a262f896 100644 --- a/src/test/ui/issues/issue-7092.rs +++ b/src/test/ui/issues/issue-7092.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Whatever { } diff --git a/src/test/ui/issues/issue-7092.stderr b/src/test/ui/issues/issue-7092.stderr index 3c816098289..7bb68202874 100644 --- a/src/test/ui/issues/issue-7092.stderr +++ b/src/test/ui/issues/issue-7092.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types - --> $DIR/issue-7092.rs:16:9 + --> $DIR/issue-7092.rs:6:9 | +LL | match x { + | - this match expression has type `Whatever` LL | Some(field) => | ^^^^^^^^^^^ expected enum `Whatever`, found enum `std::option::Option` | diff --git a/src/test/ui/issues/issue-7246.rs b/src/test/ui/issues/issue-7246.rs index 7e8d431bf19..bf2794eb632 100644 --- a/src/test/ui/issues/issue-7246.rs +++ b/src/test/ui/issues/issue-7246.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unreachable_code)] #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-7246.stderr b/src/test/ui/issues/issue-7246.stderr index 75c716e5a04..5b8652597d3 100644 --- a/src/test/ui/issues/issue-7246.stderr +++ b/src/test/ui/issues/issue-7246.stderr @@ -1,11 +1,11 @@ error: unreachable statement - --> $DIR/issue-7246.rs:17:5 + --> $DIR/issue-7246.rs:7:5 | LL | if *ptr::null() {}; //~ ERROR unreachable | ^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-7246.rs:11:9 + --> $DIR/issue-7246.rs:1:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-7268.rs b/src/test/ui/issues/issue-7268.rs index b4d0255fa10..0b94fabf385 100644 --- a/src/test/ui/issues/issue-7268.rs +++ b/src/test/ui/issues/issue-7268.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-7364.rs b/src/test/ui/issues/issue-7364.rs index 801a1301ad7..52ec9e42be7 100644 --- a/src/test/ui/issues/issue-7364.rs +++ b/src/test/ui/issues/issue-7364.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] use std::cell::RefCell; @@ -16,5 +6,6 @@ use std::cell::RefCell; static boxed: Box> = box RefCell::new(0); //~^ ERROR allocations are not allowed in statics //~| ERROR `std::cell::RefCell` cannot be shared between threads safely [E0277] +//~| ERROR static contains unimplemented expression type fn main() { } diff --git a/src/test/ui/issues/issue-7364.stderr b/src/test/ui/issues/issue-7364.stderr index b0d732bdb6f..52a99ce36b8 100644 --- a/src/test/ui/issues/issue-7364.stderr +++ b/src/test/ui/issues/issue-7364.stderr @@ -1,11 +1,17 @@ error[E0010]: allocations are not allowed in statics - --> $DIR/issue-7364.rs:16:37 + --> $DIR/issue-7364.rs:6:37 | LL | static boxed: Box> = box RefCell::new(0); | ^^^^^^^^^^^^^^^^^^^ allocation not allowed in statics +error[E0019]: static contains unimplemented expression type + --> $DIR/issue-7364.rs:6:41 + | +LL | static boxed: Box> = box RefCell::new(0); + | ^^^^^^^^^^^^^^^ + error[E0277]: `std::cell::RefCell` cannot be shared between threads safely - --> $DIR/issue-7364.rs:16:1 + --> $DIR/issue-7364.rs:6:1 | LL | static boxed: Box> = box RefCell::new(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::RefCell` cannot be shared between threads safely @@ -15,7 +21,7 @@ LL | static boxed: Box> = box RefCell::new(0); = note: required because it appears within the type `std::boxed::Box>` = note: shared static variables must have a type that implements `Sync` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors -Some errors occurred: E0010, E0277. +Some errors occurred: E0010, E0019, E0277. For more information about an error, try `rustc --explain E0010`. diff --git a/src/test/ui/issues/issue-7607-1.rs b/src/test/ui/issues/issue-7607-1.rs index 9bcdd690187..5221f2c529b 100644 --- a/src/test/ui/issues/issue-7607-1.rs +++ b/src/test/ui/issues/issue-7607-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: isize } diff --git a/src/test/ui/issues/issue-7607-1.stderr b/src/test/ui/issues/issue-7607-1.stderr index bebf1c1ae98..aa0a6c761bf 100644 --- a/src/test/ui/issues/issue-7607-1.stderr +++ b/src/test/ui/issues/issue-7607-1.stderr @@ -1,8 +1,8 @@ error[E0412]: cannot find type `Fo` in this scope - --> $DIR/issue-7607-1.rs:15:6 + --> $DIR/issue-7607-1.rs:5:6 | LL | impl Fo { //~ ERROR cannot find type `Fo` in this scope - | ^^ did you mean `Fn`? + | ^^ help: a trait with a similar name exists: `Fn` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-7607-2.rs b/src/test/ui/issues/issue-7607-2.rs index 9c05717c1d7..8b5c8505d3a 100644 --- a/src/test/ui/issues/issue-7607-2.rs +++ b/src/test/ui/issues/issue-7607-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs b/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs index d3af62e8836..7dd6b07177f 100644 --- a/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs +++ b/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-7813.rs b/src/test/ui/issues/issue-7813.rs index 39a87bfaf74..ce549bde601 100644 --- a/src/test/ui/issues/issue-7813.rs +++ b/src/test/ui/issues/issue-7813.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let v = &[]; //~ ERROR type annotations needed let it = v.iter(); diff --git a/src/test/ui/issues/issue-7813.stderr b/src/test/ui/issues/issue-7813.stderr index 3ab01982057..da5fc6357a6 100644 --- a/src/test/ui/issues/issue-7813.stderr +++ b/src/test/ui/issues/issue-7813.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-7813.rs:12:13 + --> $DIR/issue-7813.rs:2:13 | LL | let v = &[]; //~ ERROR type annotations needed | - ^^^ cannot infer type diff --git a/src/test/ui/issues/issue-7867.rs b/src/test/ui/issues/issue-7867.rs index 016df6cb6ef..a1997fbf19a 100644 --- a/src/test/ui/issues/issue-7867.rs +++ b/src/test/ui/issues/issue-7867.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum A { B, C } mod foo { pub fn bar() {} } diff --git a/src/test/ui/issues/issue-7867.stderr b/src/test/ui/issues/issue-7867.stderr index 03ab54d112f..1d3a0ff0659 100644 --- a/src/test/ui/issues/issue-7867.stderr +++ b/src/test/ui/issues/issue-7867.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-7867.rs:17:9 + --> $DIR/issue-7867.rs:7:9 | LL | A::B => (), | ^^^^ expected tuple, found enum `A` diff --git a/src/test/ui/issues/issue-7950.rs b/src/test/ui/issues/issue-7950.rs index dd3a48cb155..7add8afee43 100644 --- a/src/test/ui/issues/issue-7950.rs +++ b/src/test/ui/issues/issue-7950.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // tests the good error message, not "missing module Foo" or something else unexpected struct Foo; diff --git a/src/test/ui/issues/issue-7950.stderr b/src/test/ui/issues/issue-7950.stderr index 750127981b1..e30f0475376 100644 --- a/src/test/ui/issues/issue-7950.stderr +++ b/src/test/ui/issues/issue-7950.stderr @@ -1,11 +1,13 @@ error[E0599]: no function or associated item named `bar` found for type `Foo` in the current scope - --> $DIR/issue-7950.rs:16:5 + --> $DIR/issue-7950.rs:6:10 | LL | struct Foo; | ----------- function or associated item `bar` not found for this ... LL | Foo::bar(); - | ^^^^^^^^ function or associated item not found in `Foo` + | -----^^^ + | | + | function or associated item not found in `Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-7970a.rs b/src/test/ui/issues/issue-7970a.rs index b97c3037770..dae906410ed 100644 --- a/src/test/ui/issues/issue-7970a.rs +++ b/src/test/ui/issues/issue-7970a.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! one_arg_macro { ($fmt:expr) => (print!(concat!($fmt, "\n"))); } diff --git a/src/test/ui/issues/issue-7970a.stderr b/src/test/ui/issues/issue-7970a.stderr index 96fb374b58c..5cfb62f3d05 100644 --- a/src/test/ui/issues/issue-7970a.stderr +++ b/src/test/ui/issues/issue-7970a.stderr @@ -1,11 +1,11 @@ error: unexpected end of macro invocation - --> $DIR/issue-7970a.rs:16:5 + --> $DIR/issue-7970a.rs:6:5 | LL | macro_rules! one_arg_macro { | -------------------------- when calling this macro ... LL | one_arg_macro!(); - | ^^^^^^^^^^^^^^^^^ unexpected end of macro invocation + | ^^^^^^^^^^^^^^^^^ missing tokens in macro arguments error: aborting due to previous error diff --git a/src/test/ui/issues/issue-7970b.rs b/src/test/ui/issues/issue-7970b.rs index 0cff90f281b..1c4abce3959 100644 --- a/src/test/ui/issues/issue-7970b.rs +++ b/src/test/ui/issues/issue-7970b.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() {} macro_rules! test {} diff --git a/src/test/ui/issues/issue-7970b.stderr b/src/test/ui/issues/issue-7970b.stderr index b2feb677863..a62226a8a4d 100644 --- a/src/test/ui/issues/issue-7970b.stderr +++ b/src/test/ui/issues/issue-7970b.stderr @@ -1,8 +1,8 @@ error: unexpected end of macro invocation - --> $DIR/issue-7970b.rs:13:1 + --> $DIR/issue-7970b.rs:3:1 | LL | macro_rules! test {} - | ^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments error: aborting due to previous error diff --git a/src/test/ui/issues/issue-8153.rs b/src/test/ui/issues/issue-8153.rs index 457918b54d4..81a8f5338eb 100644 --- a/src/test/ui/issues/issue-8153.rs +++ b/src/test/ui/issues/issue-8153.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that duplicate methods in impls are not allowed struct Foo; diff --git a/src/test/ui/issues/issue-8153.stderr b/src/test/ui/issues/issue-8153.stderr index 03fb89f8ccc..800b0277c9a 100644 --- a/src/test/ui/issues/issue-8153.stderr +++ b/src/test/ui/issues/issue-8153.stderr @@ -1,5 +1,5 @@ error[E0201]: duplicate definitions with name `bar`: - --> $DIR/issue-8153.rs:21:5 + --> $DIR/issue-8153.rs:11:5 | LL | fn bar(&self) -> isize {1} | -------------------------- previous definition of `bar` here diff --git a/src/test/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs b/src/test/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs index 27859e1a2ae..e4dafc073ab 100644 --- a/src/test/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs +++ b/src/test/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-8208.rs b/src/test/ui/issues/issue-8208.rs index 670b6bd46e7..ad94f99098d 100644 --- a/src/test/ui/issues/issue-8208.rs +++ b/src/test/ui/issues/issue-8208.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use self::*; //~ ERROR: unresolved import `self::*` [E0432] //~^ Cannot glob-import a module into itself. diff --git a/src/test/ui/issues/issue-8208.stderr b/src/test/ui/issues/issue-8208.stderr index 73a9a6a51be..6de95fb953a 100644 --- a/src/test/ui/issues/issue-8208.stderr +++ b/src/test/ui/issues/issue-8208.stderr @@ -1,17 +1,17 @@ error[E0432]: unresolved import `self::*` - --> $DIR/issue-8208.rs:11:5 + --> $DIR/issue-8208.rs:1:5 | LL | use self::*; //~ ERROR: unresolved import `self::*` [E0432] | ^^^^^^^ Cannot glob-import a module into itself. error[E0432]: unresolved import `foo::*` - --> $DIR/issue-8208.rs:15:9 + --> $DIR/issue-8208.rs:5:9 | LL | use foo::*; //~ ERROR: unresolved import `foo::*` [E0432] | ^^^^^^ Cannot glob-import a module into itself. error[E0432]: unresolved import `super::bar::*` - --> $DIR/issue-8208.rs:19:13 + --> $DIR/issue-8208.rs:9:13 | LL | use super::bar::*; | ^^^^^^^^^^^^^ Cannot glob-import a module into itself. diff --git a/src/test/ui/issues/issue-8398.rs b/src/test/ui/issues/issue-8398.rs index 36c24be5fce..bd37b8582b2 100644 --- a/src/test/ui/issues/issue-8398.rs +++ b/src/test/ui/issues/issue-8398.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-8460-const.rs b/src/test/ui/issues/issue-8460-const.rs index b0d6cb5df87..611d280f774 100644 --- a/src/test/ui/issues/issue-8460-const.rs +++ b/src/test/ui/issues/issue-8460-const.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(const_err)] use std::{isize, i8, i16, i32, i64}; diff --git a/src/test/ui/issues/issue-8460-const.stderr b/src/test/ui/issues/issue-8460-const.stderr index db35cde7569..31b1da4f804 100644 --- a/src/test/ui/issues/issue-8460-const.stderr +++ b/src/test/ui/issues/issue-8460-const.stderr @@ -1,245 +1,245 @@ error: attempt to divide with overflow - --> $DIR/issue-8460-const.rs:17:36 + --> $DIR/issue-8460-const.rs:7:36 | LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-8460-const.rs:11:9 + --> $DIR/issue-8460-const.rs:1:9 | LL | #![deny(const_err)] | ^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 + --> $DIR/issue-8460-const.rs:7:36 | LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to divide with overflow error: attempt to divide with overflow - --> $DIR/issue-8460-const.rs:20:36 + --> $DIR/issue-8460-const.rs:10:36 | LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:20:36 + --> $DIR/issue-8460-const.rs:10:36 | LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^ attempt to divide with overflow error: attempt to divide with overflow - --> $DIR/issue-8460-const.rs:23:36 + --> $DIR/issue-8460-const.rs:13:36 | LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 + --> $DIR/issue-8460-const.rs:13:36 | LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to divide with overflow error: attempt to divide with overflow - --> $DIR/issue-8460-const.rs:26:36 + --> $DIR/issue-8460-const.rs:16:36 | LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:26:36 + --> $DIR/issue-8460-const.rs:16:36 | LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to divide with overflow error: attempt to divide with overflow - --> $DIR/issue-8460-const.rs:29:36 + --> $DIR/issue-8460-const.rs:19:36 | LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 + --> $DIR/issue-8460-const.rs:19:36 | LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to divide with overflow error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:32:36 + --> $DIR/issue-8460-const.rs:22:36 | LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:32:36 + --> $DIR/issue-8460-const.rs:22:36 | LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); | ^^^^^^^^^^ attempt to divide by zero error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:35:36 + --> $DIR/issue-8460-const.rs:25:36 | LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); | ^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 + --> $DIR/issue-8460-const.rs:25:36 | LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); | ^^^^^^^ attempt to divide by zero error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:38:36 + --> $DIR/issue-8460-const.rs:28:36 | LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); | ^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:38:36 + --> $DIR/issue-8460-const.rs:28:36 | LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); | ^^^^^^^^ attempt to divide by zero error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:41:36 + --> $DIR/issue-8460-const.rs:31:36 | LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); | ^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 + --> $DIR/issue-8460-const.rs:31:36 | LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); | ^^^^^^^^ attempt to divide by zero error: attempt to divide by zero - --> $DIR/issue-8460-const.rs:44:36 + --> $DIR/issue-8460-const.rs:34:36 | LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); | ^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:44:36 + --> $DIR/issue-8460-const.rs:34:36 | LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); | ^^^^^^^^ attempt to divide by zero error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:47:36 + --> $DIR/issue-8460-const.rs:37:36 | LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 + --> $DIR/issue-8460-const.rs:37:36 | LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:50:36 + --> $DIR/issue-8460-const.rs:40:36 | LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:50:36 + --> $DIR/issue-8460-const.rs:40:36 | LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:53:36 + --> $DIR/issue-8460-const.rs:43:36 | LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:53:36 + --> $DIR/issue-8460-const.rs:43:36 | LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:56:36 + --> $DIR/issue-8460-const.rs:46:36 | LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:56:36 + --> $DIR/issue-8460-const.rs:46:36 | LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with overflow - --> $DIR/issue-8460-const.rs:59:36 + --> $DIR/issue-8460-const.rs:49:36 | LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:59:36 + --> $DIR/issue-8460-const.rs:49:36 | LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); | ^^^^^^^^^^^^^ attempt to calculate the remainder with overflow error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:62:36 + --> $DIR/issue-8460-const.rs:52:36 | LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); | ^^^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:62:36 + --> $DIR/issue-8460-const.rs:52:36 | LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); | ^^^^^^^^^^ attempt to calculate the remainder with a divisor of zero error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:65:36 + --> $DIR/issue-8460-const.rs:55:36 | LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); | ^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:65:36 + --> $DIR/issue-8460-const.rs:55:36 | LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); | ^^^^^^^ attempt to calculate the remainder with a divisor of zero error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:68:36 + --> $DIR/issue-8460-const.rs:58:36 | LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); | ^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:68:36 + --> $DIR/issue-8460-const.rs:58:36 | LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:71:36 + --> $DIR/issue-8460-const.rs:61:36 | LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); | ^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:71:36 + --> $DIR/issue-8460-const.rs:61:36 | LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero error: attempt to calculate the remainder with a divisor of zero - --> $DIR/issue-8460-const.rs:74:36 + --> $DIR/issue-8460-const.rs:64:36 | LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); | ^^^^^^^^ error: this expression will panic at runtime - --> $DIR/issue-8460-const.rs:74:36 + --> $DIR/issue-8460-const.rs:64:36 | LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); | ^^^^^^^^ attempt to calculate the remainder with a divisor of zero diff --git a/src/test/ui/issues/issue-8521.rs b/src/test/ui/issues/issue-8521.rs index 724ac962f3b..7007c8a3a98 100644 --- a/src/test/ui/issues/issue-8521.rs +++ b/src/test/ui/issues/issue-8521.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass trait Foo1 {} diff --git a/src/test/ui/issues/issue-8578.rs b/src/test/ui/issues/issue-8578.rs index 0c5cbf24700..4cc21234796 100644 --- a/src/test/ui/issues/issue-8578.rs +++ b/src/test/ui/issues/issue-8578.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/ui/issues/issue-8640.rs b/src/test/ui/issues/issue-8640.rs index c4ca3acf080..51a02a32ec8 100644 --- a/src/test/ui/issues/issue-8640.rs +++ b/src/test/ui/issues/issue-8640.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[allow(unused_imports)] mod foo { diff --git a/src/test/ui/issues/issue-8640.stderr b/src/test/ui/issues/issue-8640.stderr index 029f76d152a..4ce63945464 100644 --- a/src/test/ui/issues/issue-8640.stderr +++ b/src/test/ui/issues/issue-8640.stderr @@ -1,5 +1,5 @@ error[E0255]: the name `bar` is defined multiple times - --> $DIR/issue-8640.rs:15:5 + --> $DIR/issue-8640.rs:5:5 | LL | use baz::bar; | -------- previous import of the module `bar` here diff --git a/src/test/ui/issues/issue-8727.rs b/src/test/ui/issues/issue-8727.rs index 01c02ff8a48..473d237cd87 100644 --- a/src/test/ui/issues/issue-8727.rs +++ b/src/test/ui/issues/issue-8727.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Verify the compiler fails with an error on infinite function // recursions. diff --git a/src/test/ui/issues/issue-8727.stderr b/src/test/ui/issues/issue-8727.stderr index bcf644debbc..dd23830ea35 100644 --- a/src/test/ui/issues/issue-8727.stderr +++ b/src/test/ui/issues/issue-8727.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-8727.rs:14:1 + --> $DIR/issue-8727.rs:4:1 | LL | fn generic() { | ^^^^^^^^^^^^^^^ cannot return without recursing @@ -10,7 +10,7 @@ LL | generic::>(); = help: a `loop` may express intention better if this is on purpose error: reached the recursion limit while instantiating `generic::>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/issue-8727.rs:14:1 + --> $DIR/issue-8727.rs:4:1 | LL | / fn generic() { LL | | generic::>(); diff --git a/src/test/ui/issues/issue-8761.rs b/src/test/ui/issues/issue-8761.rs index f8424ea64ef..e69927c8457 100644 --- a/src/test/ui/issues/issue-8761.rs +++ b/src/test/ui/issues/issue-8761.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { A = 1i64, //~^ ERROR mismatched types diff --git a/src/test/ui/issues/issue-8761.stderr b/src/test/ui/issues/issue-8761.stderr index b8144df3835..fc0c1407601 100644 --- a/src/test/ui/issues/issue-8761.stderr +++ b/src/test/ui/issues/issue-8761.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/issue-8761.rs:12:9 + --> $DIR/issue-8761.rs:2:9 | LL | A = 1i64, | ^^^^ expected isize, found i64 error[E0308]: mismatched types - --> $DIR/issue-8761.rs:15:9 + --> $DIR/issue-8761.rs:5:9 | LL | B = 2u8 | ^^^ expected isize, found u8 diff --git a/src/test/ui/issues/issue-8767.rs b/src/test/ui/issues/issue-8767.rs index 926cae788aa..972101a0bc3 100644 --- a/src/test/ui/issues/issue-8767.rs +++ b/src/test/ui/issues/issue-8767.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - impl B { //~ ERROR cannot find type `B` in this scope } diff --git a/src/test/ui/issues/issue-8767.stderr b/src/test/ui/issues/issue-8767.stderr index d03e20ba270..80280f8c535 100644 --- a/src/test/ui/issues/issue-8767.stderr +++ b/src/test/ui/issues/issue-8767.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `B` in this scope - --> $DIR/issue-8767.rs:11:6 + --> $DIR/issue-8767.rs:1:6 | LL | impl B { //~ ERROR cannot find type `B` in this scope | ^ not found in this scope diff --git a/src/test/ui/issues/issue-9110.rs b/src/test/ui/issues/issue-9110.rs index 86314659fcb..30acd61a34a 100644 --- a/src/test/ui/issues/issue-9110.rs +++ b/src/test/ui/issues/issue-9110.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-9243.rs b/src/test/ui/issues/issue-9243.rs index 3f5721a3df7..e877dd64922 100644 --- a/src/test/ui/issues/issue-9243.rs +++ b/src/test/ui/issues/issue-9243.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // Regression test for issue 9243 diff --git a/src/test/ui/issues/issue-9249.rs b/src/test/ui/issues/issue-9249.rs index 3013fde84dc..e4e9c459719 100644 --- a/src/test/ui/issues/issue-9249.rs +++ b/src/test/ui/issues/issue-9249.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-9575.rs b/src/test/ui/issues/issue-9575.rs index 9295eeb1779..bac4ac1d208 100644 --- a/src/test/ui/issues/issue-9575.rs +++ b/src/test/ui/issues/issue-9575.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(start)] #[start] diff --git a/src/test/ui/issues/issue-9575.stderr b/src/test/ui/issues/issue-9575.stderr index d52669777bd..1483e427a6a 100644 --- a/src/test/ui/issues/issue-9575.stderr +++ b/src/test/ui/issues/issue-9575.stderr @@ -1,5 +1,5 @@ error[E0308]: start function has wrong type - --> $DIR/issue-9575.rs:14:1 + --> $DIR/issue-9575.rs:4:1 | LL | fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters diff --git a/src/test/ui/issues/issue-9719.rs b/src/test/ui/issues/issue-9719.rs index c3845dd6106..96865344e74 100644 --- a/src/test/ui/issues/issue-9719.rs +++ b/src/test/ui/issues/issue-9719.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/ui/issues/issue-9725.rs b/src/test/ui/issues/issue-9725.rs index f53122d19c1..360effbd119 100644 --- a/src/test/ui/issues/issue-9725.rs +++ b/src/test/ui/issues/issue-9725.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct A { foo: isize } fn main() { diff --git a/src/test/ui/issues/issue-9725.stderr b/src/test/ui/issues/issue-9725.stderr index 1d7fdad82a0..eafe92e4688 100644 --- a/src/test/ui/issues/issue-9725.stderr +++ b/src/test/ui/issues/issue-9725.stderr @@ -1,11 +1,11 @@ error[E0416]: identifier `foo` is bound more than once in the same pattern - --> $DIR/issue-9725.rs:14:18 + --> $DIR/issue-9725.rs:4:18 | LL | let A { foo, foo } = A { foo: 3 }; | ^^^ used in a pattern more than once error[E0025]: field `foo` bound multiple times in the pattern - --> $DIR/issue-9725.rs:14:18 + --> $DIR/issue-9725.rs:4:18 | LL | let A { foo, foo } = A { foo: 3 }; | --- ^^^ multiple uses of `foo` in pattern diff --git a/src/test/ui/issues/issue-9814.rs b/src/test/ui/issues/issue-9814.rs index 226734b84d6..a87478e221b 100644 --- a/src/test/ui/issues/issue-9814.rs +++ b/src/test/ui/issues/issue-9814.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Verify that single-variant enums can't be de-referenced // Regression test for issue #9814 diff --git a/src/test/ui/issues/issue-9814.stderr b/src/test/ui/issues/issue-9814.stderr index 2e85bd46fe6..fe105a9c3ce 100644 --- a/src/test/ui/issues/issue-9814.stderr +++ b/src/test/ui/issues/issue-9814.stderr @@ -1,5 +1,5 @@ error[E0614]: type `Foo` cannot be dereferenced - --> $DIR/issue-9814.rs:17:13 + --> $DIR/issue-9814.rs:7:13 | LL | let _ = *Foo::Bar(2); //~ ERROR type `Foo` cannot be dereferenced | ^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-pr29383.rs b/src/test/ui/issues/issue-pr29383.rs index b60c537e1e6..334fdacb81e 100644 --- a/src/test/ui/issues/issue-pr29383.rs +++ b/src/test/ui/issues/issue-pr29383.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum E { A, B, diff --git a/src/test/ui/issues/issue-pr29383.stderr b/src/test/ui/issues/issue-pr29383.stderr index 9b8956da7a2..1fe49f8fb14 100644 --- a/src/test/ui/issues/issue-pr29383.stderr +++ b/src/test/ui/issues/issue-pr29383.stderr @@ -1,11 +1,11 @@ error[E0532]: expected tuple struct/variant, found unit variant `E::A` - --> $DIR/issue-pr29383.rs:19:14 + --> $DIR/issue-pr29383.rs:9:14 | LL | Some(E::A(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::A` | ^^^^ not a tuple struct/variant error[E0532]: expected tuple struct/variant, found unit variant `E::B` - --> $DIR/issue-pr29383.rs:20:14 + --> $DIR/issue-pr29383.rs:10:14 | LL | Some(E::B(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::B` | ^^^^ not a tuple struct/variant diff --git a/src/test/ui/issues/issue_56411_aux.rs b/src/test/ui/issues/issue_56411_aux.rs new file mode 100644 index 00000000000..bd689e913ab --- /dev/null +++ b/src/test/ui/issues/issue_56411_aux.rs @@ -0,0 +1,5 @@ +// compile-pass + +struct T {} + +fn main() {} diff --git a/src/test/ui/iterators/array-of-ranges.rs b/src/test/ui/iterators/array-of-ranges.rs index a7d6e80bae5..d2dfc7ec327 100644 --- a/src/test/ui/iterators/array-of-ranges.rs +++ b/src/test/ui/iterators/array-of-ranges.rs @@ -1,14 +1,23 @@ fn main() { for _ in [0..1] {} +//~^ ERROR is not an iterator for _ in [0..=1] {} +//~^ ERROR is not an iterator for _ in [0..] {} +//~^ ERROR is not an iterator for _ in [..1] {} +//~^ ERROR is not an iterator for _ in [..=1] {} +//~^ ERROR is not an iterator let start = 0; let end = 0; for _ in [start..end] {} +//~^ ERROR is not an iterator let array_of_range = [start..end]; for _ in array_of_range {} +//~^ ERROR is not an iterator for _ in [0..1, 2..3] {} +//~^ ERROR is not an iterator for _ in [0..=1] {} +//~^ ERROR is not an iterator } diff --git a/src/test/ui/iterators/array-of-ranges.stderr b/src/test/ui/iterators/array-of-ranges.stderr index fbe7e0ee748..3dbed9a1065 100644 --- a/src/test/ui/iterators/array-of-ranges.stderr +++ b/src/test/ui/iterators/array-of-ranges.stderr @@ -9,7 +9,7 @@ LL | for _ in [0..1] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::RangeInclusive<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:3:14 + --> $DIR/array-of-ranges.rs:4:14 | LL | for _ in [0..=1] {} | ^^^^^^^ if you meant to iterate between two values, remove the square brackets @@ -19,7 +19,7 @@ LL | for _ in [0..=1] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::RangeFrom<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:4:14 + --> $DIR/array-of-ranges.rs:6:14 | LL | for _ in [0..] {} | ^^^^^ if you meant to iterate from a value onwards, remove the square brackets @@ -29,7 +29,7 @@ LL | for _ in [0..] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::RangeTo<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:5:14 + --> $DIR/array-of-ranges.rs:8:14 | LL | for _ in [..1] {} | ^^^^^ if you meant to iterate until a value, remove the square brackets and add a starting value @@ -39,7 +39,7 @@ LL | for _ in [..1] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::RangeToInclusive<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:6:14 + --> $DIR/array-of-ranges.rs:10:14 | LL | for _ in [..=1] {} | ^^^^^^ if you meant to iterate until a value (including it), remove the square brackets and add a starting value @@ -49,7 +49,7 @@ LL | for _ in [..=1] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:9:14 + --> $DIR/array-of-ranges.rs:14:14 | LL | for _ in [start..end] {} | ^^^^^^^^^^^^ if you meant to iterate between two values, remove the square brackets @@ -59,7 +59,7 @@ LL | for _ in [start..end] {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::Range<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:11:14 + --> $DIR/array-of-ranges.rs:17:14 | LL | for _ in array_of_range {} | ^^^^^^^^^^^^^^ if you meant to iterate between two values, remove the square brackets @@ -69,17 +69,17 @@ LL | for _ in array_of_range {} = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::Range<{integer}>; 2]` is not an iterator - --> $DIR/array-of-ranges.rs:12:14 + --> $DIR/array-of-ranges.rs:19:14 | LL | for _ in [0..1, 2..3] {} | ^^^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it | = help: the trait `std::iter::Iterator` is not implemented for `[std::ops::Range<{integer}>; 2]` - = note: arrays are not an iterators, but slices like the following are: `&[1, 2, 3]` + = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[std::ops::RangeInclusive<{integer}>; 1]` is not an iterator - --> $DIR/array-of-ranges.rs:13:14 + --> $DIR/array-of-ranges.rs:21:14 | LL | for _ in [0..=1] {} | ^^^^^^^ if you meant to iterate between two values, remove the square brackets diff --git a/src/test/ui/iterators/array.rs b/src/test/ui/iterators/array.rs index f54bb812743..33c84f6fa35 100644 --- a/src/test/ui/iterators/array.rs +++ b/src/test/ui/iterators/array.rs @@ -1,6 +1,9 @@ fn main() { for _ in [1, 2] {} +//~^ ERROR is not an iterator let x = [1, 2]; for _ in x {} +//~^ ERROR is not an iterator for _ in [1.0, 2.0] {} +//~^ ERROR is not an iterator } diff --git a/src/test/ui/iterators/array.stderr b/src/test/ui/iterators/array.stderr index fd74cd7a727..94731f1c745 100644 --- a/src/test/ui/iterators/array.stderr +++ b/src/test/ui/iterators/array.stderr @@ -5,27 +5,27 @@ LL | for _ in [1, 2] {} | ^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it | = help: the trait `std::iter::Iterator` is not implemented for `[{integer}; 2]` - = note: arrays are not an iterators, but slices like the following are: `&[1, 2, 3]` + = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[{integer}; 2]` is not an iterator - --> $DIR/array.rs:4:14 + --> $DIR/array.rs:5:14 | LL | for _ in x {} | ^ borrow the array with `&` or call `.iter()` on it to iterate over it | = help: the trait `std::iter::Iterator` is not implemented for `[{integer}; 2]` - = note: arrays are not an iterators, but slices like the following are: `&[1, 2, 3]` + = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: required by `std::iter::IntoIterator::into_iter` error[E0277]: `[{float}; 2]` is not an iterator - --> $DIR/array.rs:5:14 + --> $DIR/array.rs:7:14 | LL | for _ in [1.0, 2.0] {} | ^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it | = help: the trait `std::iter::Iterator` is not implemented for `[{float}; 2]` - = note: arrays are not an iterators, but slices like the following are: `&[1, 2, 3]` + = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]` = note: required by `std::iter::IntoIterator::into_iter` error: aborting due to 3 previous errors diff --git a/src/test/ui/iterators/bound.rs b/src/test/ui/iterators/bound.rs index 78285b8161c..bdd99ef8d17 100644 --- a/src/test/ui/iterators/bound.rs +++ b/src/test/ui/iterators/bound.rs @@ -1,3 +1,4 @@ struct S(I); struct T(S); +//~^ ERROR is not an iterator fn main() {} diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.rs b/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.rs new file mode 100644 index 00000000000..b738eb4c703 --- /dev/null +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.rs @@ -0,0 +1,3 @@ +fn main() { + let s = extern::foo::Bar; //~ ERROR expected expression, found keyword `extern` +} diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr new file mode 100644 index 00000000000..150fc88e7ef --- /dev/null +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr @@ -0,0 +1,8 @@ +error: expected expression, found keyword `extern` + --> $DIR/keyword-extern-as-identifier-expr.rs:2:13 + | +LL | let s = extern::foo::Bar; //~ ERROR expected expression, found keyword `extern` + | ^^^^^^ expected expression + +error: aborting due to previous error + diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.rs b/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.rs new file mode 100644 index 00000000000..f9b6bad7c25 --- /dev/null +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.rs @@ -0,0 +1,3 @@ +fn main() { + let extern = 0; //~ ERROR expected pattern, found keyword `extern` +} diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr new file mode 100644 index 00000000000..426b4eef056 --- /dev/null +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr @@ -0,0 +1,8 @@ +error: expected pattern, found keyword `extern` + --> $DIR/keyword-extern-as-identifier-pat.rs:2:9 + | +LL | let extern = 0; //~ ERROR expected pattern, found keyword `extern` + | ^^^^^^ expected pattern + +error: aborting due to previous error + diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.rs b/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.rs new file mode 100644 index 00000000000..3845a9aa017 --- /dev/null +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.rs @@ -0,0 +1,3 @@ +type A = extern::foo::bar; //~ ERROR expected `fn`, found `::` + +fn main() {} diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.stderr new file mode 100644 index 00000000000..97b641fbea5 --- /dev/null +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.stderr @@ -0,0 +1,8 @@ +error: expected `fn`, found `::` + --> $DIR/keyword-extern-as-identifier-type.rs:1:16 + | +LL | type A = extern::foo::bar; //~ ERROR expected `fn`, found `::` + | ^^ expected `fn` here + +error: aborting due to previous error + diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.rs b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.rs new file mode 100644 index 00000000000..b07de3e341c --- /dev/null +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.rs @@ -0,0 +1,3 @@ +use extern::foo; //~ ERROR expected identifier, found keyword `extern` + +fn main() {} diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr new file mode 100644 index 00000000000..31b575a92e0 --- /dev/null +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr @@ -0,0 +1,12 @@ +error: expected identifier, found keyword `extern` + --> $DIR/keyword-extern-as-identifier-use.rs:1:5 + | +LL | use extern::foo; //~ ERROR expected identifier, found keyword `extern` + | ^^^^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | use r#extern::foo; //~ ERROR expected identifier, found keyword `extern` + | ^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/keyword/keyword-extern-as-identifier.rs b/src/test/ui/keyword/keyword-extern-as-identifier.rs deleted file mode 100644 index 3e445853957..00000000000 --- a/src/test/ui/keyword/keyword-extern-as-identifier.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(extern_in_paths)] - -fn main() { - let extern = 0; //~ ERROR cannot find unit struct/variant or constant `extern` in this scope -} diff --git a/src/test/ui/keyword/keyword-extern-as-identifier.stderr b/src/test/ui/keyword/keyword-extern-as-identifier.stderr deleted file mode 100644 index 523da8d32c4..00000000000 --- a/src/test/ui/keyword/keyword-extern-as-identifier.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0531]: cannot find unit struct/variant or constant `extern` in this scope - --> $DIR/keyword-extern-as-identifier.rs:14:9 - | -LL | let extern = 0; //~ ERROR cannot find unit struct/variant or constant `extern` in this scope - | ^^^^^^ not found in this scope - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0531`. diff --git a/src/test/ui/keyword/keyword-false-as-identifier.rs b/src/test/ui/keyword/keyword-false-as-identifier.rs index f246d6e75df..6382f841b04 100644 --- a/src/test/ui/keyword/keyword-false-as-identifier.rs +++ b/src/test/ui/keyword/keyword-false-as-identifier.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let false = 22; //~ error: mismatched types } diff --git a/src/test/ui/keyword/keyword-false-as-identifier.stderr b/src/test/ui/keyword/keyword-false-as-identifier.stderr index 13f675404f6..6c8dffa7e22 100644 --- a/src/test/ui/keyword/keyword-false-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-false-as-identifier.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/keyword-false-as-identifier.rs:12:9 + --> $DIR/keyword-false-as-identifier.rs:2:9 | LL | let false = 22; //~ error: mismatched types - | ^^^^^ expected integral variable, found bool + | ^^^^^ expected integer, found bool | = note: expected type `{integer}` found type `bool` diff --git a/src/test/ui/keyword/keyword-self-as-identifier.rs b/src/test/ui/keyword/keyword-self-as-identifier.rs index ad5b8fb6434..b30002cddaf 100644 --- a/src/test/ui/keyword/keyword-self-as-identifier.rs +++ b/src/test/ui/keyword/keyword-self-as-identifier.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let Self = 22; //~ ERROR cannot find unit struct/variant or constant `Self` in this scope - //~^ ERROR `Self` struct constructors are unstable (see issue #51994) } diff --git a/src/test/ui/keyword/keyword-self-as-identifier.stderr b/src/test/ui/keyword/keyword-self-as-identifier.stderr index 296269819f8..6ea19620a66 100644 --- a/src/test/ui/keyword/keyword-self-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-self-as-identifier.stderr @@ -1,18 +1,9 @@ error[E0531]: cannot find unit struct/variant or constant `Self` in this scope - --> $DIR/keyword-self-as-identifier.rs:12:9 + --> $DIR/keyword-self-as-identifier.rs:2:9 | LL | let Self = 22; //~ ERROR cannot find unit struct/variant or constant `Self` in this scope | ^^^^ not found in this scope -error[E0658]: `Self` struct constructors are unstable (see issue #51994) - --> $DIR/keyword-self-as-identifier.rs:12:9 - | -LL | let Self = 22; //~ ERROR cannot find unit struct/variant or constant `Self` in this scope - | ^^^^ - | - = help: add #![feature(self_struct_ctor)] to the crate attributes to enable - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0531, E0658. -For more information about an error, try `rustc --explain E0531`. +For more information about this error, try `rustc --explain E0531`. diff --git a/src/test/ui/keyword/keyword-super-as-identifier.rs b/src/test/ui/keyword/keyword-super-as-identifier.rs index d8941f3e532..d728b4fe3e2 100644 --- a/src/test/ui/keyword/keyword-super-as-identifier.rs +++ b/src/test/ui/keyword/keyword-super-as-identifier.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let super = 22; //~ ERROR failed to resolve: there are too many initial `super`s } diff --git a/src/test/ui/keyword/keyword-super-as-identifier.stderr b/src/test/ui/keyword/keyword-super-as-identifier.stderr index 9b665748794..b0973bd170e 100644 --- a/src/test/ui/keyword/keyword-super-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-super-as-identifier.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: there are too many initial `super`s. - --> $DIR/keyword-super-as-identifier.rs:12:9 + --> $DIR/keyword-super-as-identifier.rs:2:9 | LL | let super = 22; //~ ERROR failed to resolve: there are too many initial `super`s | ^^^^^ there are too many initial `super`s. diff --git a/src/test/ui/keyword/keyword-super.rs b/src/test/ui/keyword/keyword-super.rs index 87640630818..a43e1e39b67 100644 --- a/src/test/ui/keyword/keyword-super.rs +++ b/src/test/ui/keyword/keyword-super.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let super: isize; //~ ERROR failed to resolve: there are too many initial `super`s } diff --git a/src/test/ui/keyword/keyword-super.stderr b/src/test/ui/keyword/keyword-super.stderr index 690b684c133..5ec33ae30a6 100644 --- a/src/test/ui/keyword/keyword-super.stderr +++ b/src/test/ui/keyword/keyword-super.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: there are too many initial `super`s. - --> $DIR/keyword-super.rs:12:9 + --> $DIR/keyword-super.rs:2:9 | LL | let super: isize; //~ ERROR failed to resolve: there are too many initial `super`s | ^^^^^ there are too many initial `super`s. diff --git a/src/test/ui/keyword/keyword-true-as-identifier.rs b/src/test/ui/keyword/keyword-true-as-identifier.rs index b09d09db560..8c4ad7e2a66 100644 --- a/src/test/ui/keyword/keyword-true-as-identifier.rs +++ b/src/test/ui/keyword/keyword-true-as-identifier.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let true = 22; //~ error: mismatched types } diff --git a/src/test/ui/keyword/keyword-true-as-identifier.stderr b/src/test/ui/keyword/keyword-true-as-identifier.stderr index 776470ba77c..e5d3938e54a 100644 --- a/src/test/ui/keyword/keyword-true-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-true-as-identifier.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/keyword-true-as-identifier.rs:12:9 + --> $DIR/keyword-true-as-identifier.rs:2:9 | LL | let true = 22; //~ error: mismatched types - | ^^^^ expected integral variable, found bool + | ^^^^ expected integer, found bool | = note: expected type `{integer}` found type `bool` diff --git a/src/test/ui/kindck/kindck-copy.rs b/src/test/ui/kindck/kindck-copy.rs index 747fe2d2046..dadeb956964 100644 --- a/src/test/ui/kindck/kindck-copy.rs +++ b/src/test/ui/kindck/kindck-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test which of the builtin types are considered POD. use std::rc::Rc; diff --git a/src/test/ui/kindck/kindck-copy.stderr b/src/test/ui/kindck/kindck-copy.stderr index 8d72d912689..65c06b8308c 100644 --- a/src/test/ui/kindck/kindck-copy.stderr +++ b/src/test/ui/kindck/kindck-copy.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `&'static mut isize: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:37:5 + --> $DIR/kindck-copy.rs:27:5 | LL | assert_copy::<&'static mut isize>(); //~ ERROR : std::marker::Copy` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'static mut isize` @@ -7,13 +7,13 @@ LL | assert_copy::<&'static mut isize>(); //~ ERROR : std::marker::Copy` is = help: the following implementations were found: note: required by `assert_copy` - --> $DIR/kindck-copy.rs:15:1 + --> $DIR/kindck-copy.rs:5:1 | LL | fn assert_copy() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `&'a mut isize: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:38:5 + --> $DIR/kindck-copy.rs:28:5 | LL | assert_copy::<&'a mut isize>(); //~ ERROR : std::marker::Copy` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut isize` @@ -21,115 +21,115 @@ LL | assert_copy::<&'a mut isize>(); //~ ERROR : std::marker::Copy` is not = help: the following implementations were found: note: required by `assert_copy` - --> $DIR/kindck-copy.rs:15:1 + --> $DIR/kindck-copy.rs:5:1 | LL | fn assert_copy() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:41:5 + --> $DIR/kindck-copy.rs:31:5 | LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` - --> $DIR/kindck-copy.rs:15:1 + --> $DIR/kindck-copy.rs:5:1 | LL | fn assert_copy() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:42:5 + --> $DIR/kindck-copy.rs:32:5 | LL | assert_copy::(); //~ ERROR : std::marker::Copy` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | note: required by `assert_copy` - --> $DIR/kindck-copy.rs:15:1 + --> $DIR/kindck-copy.rs:5:1 | LL | fn assert_copy() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::vec::Vec: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:43:5 + --> $DIR/kindck-copy.rs:33:5 | LL | assert_copy:: >(); //~ ERROR : std::marker::Copy` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::vec::Vec` | note: required by `assert_copy` - --> $DIR/kindck-copy.rs:15:1 + --> $DIR/kindck-copy.rs:5:1 | LL | fn assert_copy() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::boxed::Box<&'a mut isize>: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:44:5 + --> $DIR/kindck-copy.rs:34:5 | LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<&'a mut isize>` | note: required by `assert_copy` - --> $DIR/kindck-copy.rs:15:1 + --> $DIR/kindck-copy.rs:5:1 | LL | fn assert_copy() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:52:5 + --> $DIR/kindck-copy.rs:42:5 | LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` - --> $DIR/kindck-copy.rs:15:1 + --> $DIR/kindck-copy.rs:5:1 | LL | fn assert_copy() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:53:5 + --> $DIR/kindck-copy.rs:43:5 | LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` - --> $DIR/kindck-copy.rs:15:1 + --> $DIR/kindck-copy.rs:5:1 | LL | fn assert_copy() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `&'a mut (dyn Dummy + std::marker::Send + 'a): std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:56:5 + --> $DIR/kindck-copy.rs:46:5 | LL | assert_copy::<&'a mut (Dummy+Send)>(); //~ ERROR : std::marker::Copy` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut (dyn Dummy + std::marker::Send + 'a)` | note: required by `assert_copy` - --> $DIR/kindck-copy.rs:15:1 + --> $DIR/kindck-copy.rs:5:1 | LL | fn assert_copy() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `MyNoncopyStruct: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:74:5 + --> $DIR/kindck-copy.rs:64:5 | LL | assert_copy::(); //~ ERROR : std::marker::Copy` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `MyNoncopyStruct` | note: required by `assert_copy` - --> $DIR/kindck-copy.rs:15:1 + --> $DIR/kindck-copy.rs:5:1 | LL | fn assert_copy() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::rc::Rc: std::marker::Copy` is not satisfied - --> $DIR/kindck-copy.rs:77:5 + --> $DIR/kindck-copy.rs:67:5 | LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc` | note: required by `assert_copy` - --> $DIR/kindck-copy.rs:15:1 + --> $DIR/kindck-copy.rs:5:1 | LL | fn assert_copy() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/kindck/kindck-impl-type-params-2.rs b/src/test/ui/kindck/kindck-impl-type-params-2.rs index 21aefc4f9c1..ac9cc1a08f3 100644 --- a/src/test/ui/kindck/kindck-impl-type-params-2.rs +++ b/src/test/ui/kindck/kindck-impl-type-params-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] trait Foo { diff --git a/src/test/ui/kindck/kindck-impl-type-params-2.stderr b/src/test/ui/kindck/kindck-impl-type-params-2.stderr index e4c02085ddb..bd971c90372 100644 --- a/src/test/ui/kindck/kindck-impl-type-params-2.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params-2.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `std::boxed::Box<{integer}>: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params-2.rs:23:5 + --> $DIR/kindck-impl-type-params-2.rs:13:5 | LL | take_param(&x); | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>` | = note: required because of the requirements on the impl of `Foo` for `std::boxed::Box<{integer}>` note: required by `take_param` - --> $DIR/kindck-impl-type-params-2.rs:19:1 + --> $DIR/kindck-impl-type-params-2.rs:9:1 | LL | fn take_param(foo: &T) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/kindck/kindck-impl-type-params.rs b/src/test/ui/kindck/kindck-impl-type-params.rs index 3a0e66f58e0..a47e418709d 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.rs +++ b/src/test/ui/kindck/kindck-impl-type-params.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #14061: tests the interaction between generic implementation // parameter bounds and trait objects. diff --git a/src/test/ui/kindck/kindck-impl-type-params.stderr b/src/test/ui/kindck/kindck-impl-type-params.stderr index b938d40c765..03cd480babe 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.stderr @@ -1,5 +1,5 @@ error[E0277]: `T` cannot be sent between threads safely - --> $DIR/kindck-impl-type-params.rs:28:13 + --> $DIR/kindck-impl-type-params.rs:18:13 | LL | let a = &t as &Gettable; | ^^ `T` cannot be sent between threads safely @@ -10,7 +10,7 @@ LL | let a = &t as &Gettable; = note: required for the cast to the object type `dyn Gettable` error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:28:13 + --> $DIR/kindck-impl-type-params.rs:18:13 | LL | let a = &t as &Gettable; | ^^ the trait `std::marker::Copy` is not implemented for `T` @@ -20,7 +20,7 @@ LL | let a = &t as &Gettable; = note: required for the cast to the object type `dyn Gettable` error[E0277]: `T` cannot be sent between threads safely - --> $DIR/kindck-impl-type-params.rs:35:27 + --> $DIR/kindck-impl-type-params.rs:25:27 | LL | let a: &Gettable = &t; | ^^ `T` cannot be sent between threads safely @@ -31,7 +31,7 @@ LL | let a: &Gettable = &t; = note: required for the cast to the object type `dyn Gettable` error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:35:27 + --> $DIR/kindck-impl-type-params.rs:25:27 | LL | let a: &Gettable = &t; | ^^ the trait `std::marker::Copy` is not implemented for `T` @@ -41,7 +41,7 @@ LL | let a: &Gettable = &t; = note: required for the cast to the object type `dyn Gettable` error[E0477]: the type `&'a isize` does not fulfill the required lifetime - --> $DIR/kindck-impl-type-params.rs:42:13 + --> $DIR/kindck-impl-type-params.rs:32:13 | LL | let a = &t as &Gettable<&'a isize>; | ^^ @@ -49,7 +49,7 @@ LL | let a = &t as &Gettable<&'a isize>; = note: type must satisfy the static lifetime error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:48:13 + --> $DIR/kindck-impl-type-params.rs:38:13 | LL | let a = t as Box>; | ^ the trait `std::marker::Copy` is not implemented for `std::string::String` @@ -58,7 +58,7 @@ LL | let a = t as Box>; = note: required for the cast to the object type `dyn Gettable` error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied - --> $DIR/kindck-impl-type-params.rs:56:33 + --> $DIR/kindck-impl-type-params.rs:46:33 | LL | let a: Box> = t; | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo` diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.rs b/src/test/ui/kindck/kindck-inherited-copy-bound.rs index 0731fbaf01c..0134636fa0d 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.rs +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that Copy bounds inherited by trait are checked. #![feature(box_syntax)] diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr index 542ecc0c004..fe8e02e3547 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr @@ -1,18 +1,18 @@ error[E0277]: the trait bound `std::boxed::Box<{integer}>: std::marker::Copy` is not satisfied - --> $DIR/kindck-inherited-copy-bound.rs:28:5 + --> $DIR/kindck-inherited-copy-bound.rs:18:5 | LL | take_param(&x); //~ ERROR E0277 | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>` | = note: required because of the requirements on the impl of `Foo` for `std::boxed::Box<{integer}>` note: required by `take_param` - --> $DIR/kindck-inherited-copy-bound.rs:24:1 + --> $DIR/kindck-inherited-copy-bound.rs:14:1 | LL | fn take_param(foo: &T) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/kindck-inherited-copy-bound.rs:34:19 + --> $DIR/kindck-inherited-copy-bound.rs:24:19 | LL | let z = &x as &Foo; | ^^^^ the trait `Foo` cannot be made into an object @@ -20,7 +20,7 @@ LL | let z = &x as &Foo; = note: the trait cannot require that `Self : Sized` error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/kindck-inherited-copy-bound.rs:34:13 + --> $DIR/kindck-inherited-copy-bound.rs:24:13 | LL | let z = &x as &Foo; | ^^ the trait `Foo` cannot be made into an object diff --git a/src/test/ui/kindck/kindck-nonsendable-1.rs b/src/test/ui/kindck/kindck-nonsendable-1.rs index 43c212b2af5..eaff5b1b994 100644 --- a/src/test/ui/kindck/kindck-nonsendable-1.rs +++ b/src/test/ui/kindck/kindck-nonsendable-1.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::rc::Rc; fn foo(_x: Rc) {} diff --git a/src/test/ui/kindck/kindck-nonsendable-1.stderr b/src/test/ui/kindck/kindck-nonsendable-1.stderr index a8aa02e1d62..2aacd2741d3 100644 --- a/src/test/ui/kindck/kindck-nonsendable-1.stderr +++ b/src/test/ui/kindck/kindck-nonsendable-1.stderr @@ -1,13 +1,13 @@ error[E0277]: `std::rc::Rc` cannot be sent between threads safely - --> $DIR/kindck-nonsendable-1.rs:20:5 + --> $DIR/kindck-nonsendable-1.rs:9:5 | LL | bar(move|| foo(x)); | ^^^ `std::rc::Rc` cannot be sent between threads safely | - = help: within `[closure@$DIR/kindck-nonsendable-1.rs:20:9: 20:22 x:std::rc::Rc]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc` - = note: required because it appears within the type `[closure@$DIR/kindck-nonsendable-1.rs:20:9: 20:22 x:std::rc::Rc]` + = help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22 x:std::rc::Rc]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc` + = note: required because it appears within the type `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22 x:std::rc::Rc]` note: required by `bar` - --> $DIR/kindck-nonsendable-1.rs:16:1 + --> $DIR/kindck-nonsendable-1.rs:5:1 | LL | fn bar(_: F) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/kindck/kindck-send-object.rs b/src/test/ui/kindck/kindck-send-object.rs index 82b97878549..97f46c3953d 100644 --- a/src/test/ui/kindck/kindck-send-object.rs +++ b/src/test/ui/kindck/kindck-send-object.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test which of the builtin types are considered sendable. The tests // in this file all test the "kind" violates detected during kindck. // See all `regions-bounded-by-send.rs` diff --git a/src/test/ui/kindck/kindck-send-object.stderr b/src/test/ui/kindck/kindck-send-object.stderr index e342352d590..8d993566029 100644 --- a/src/test/ui/kindck/kindck-send-object.stderr +++ b/src/test/ui/kindck/kindck-send-object.stderr @@ -1,5 +1,5 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely - --> $DIR/kindck-send-object.rs:22:5 + --> $DIR/kindck-send-object.rs:12:5 | LL | assert_send::<&'static (Dummy+'static)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely @@ -7,13 +7,13 @@ LL | assert_send::<&'static (Dummy+'static)>(); = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'static)` = note: required because of the requirements on the impl of `std::marker::Send` for `&'static (dyn Dummy + 'static)` note: required by `assert_send` - --> $DIR/kindck-send-object.rs:15:1 + --> $DIR/kindck-send-object.rs:5:1 | LL | fn assert_send() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `dyn Dummy` cannot be sent between threads safely - --> $DIR/kindck-send-object.rs:27:5 + --> $DIR/kindck-send-object.rs:17:5 | LL | assert_send::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely @@ -22,7 +22,7 @@ LL | assert_send::>(); = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique` = note: required because it appears within the type `std::boxed::Box` note: required by `assert_send` - --> $DIR/kindck-send-object.rs:15:1 + --> $DIR/kindck-send-object.rs:5:1 | LL | fn assert_send() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/kindck/kindck-send-object1.rs b/src/test/ui/kindck/kindck-send-object1.rs index 853630aa416..341985467de 100644 --- a/src/test/ui/kindck/kindck-send-object1.rs +++ b/src/test/ui/kindck/kindck-send-object1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test which object types are considered sendable. This test // is broken into two parts because some errors occur in distinct // phases in the compiler. See kindck-send-object2.rs as well! diff --git a/src/test/ui/kindck/kindck-send-object1.stderr b/src/test/ui/kindck/kindck-send-object1.stderr index d906b7d9e16..4f2d09a60f5 100644 --- a/src/test/ui/kindck/kindck-send-object1.stderr +++ b/src/test/ui/kindck/kindck-send-object1.stderr @@ -1,5 +1,5 @@ error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely - --> $DIR/kindck-send-object1.rs:20:5 + --> $DIR/kindck-send-object1.rs:10:5 | LL | assert_send::<&'a Dummy>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely @@ -7,13 +7,13 @@ LL | assert_send::<&'a Dummy>(); = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'a)` = note: required because of the requirements on the impl of `std::marker::Send` for `&'a (dyn Dummy + 'a)` note: required by `assert_send` - --> $DIR/kindck-send-object1.rs:15:1 + --> $DIR/kindck-send-object1.rs:5:1 | LL | fn assert_send() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0477]: the type `&'a (dyn Dummy + std::marker::Sync + 'a)` does not fulfill the required lifetime - --> $DIR/kindck-send-object1.rs:24:5 + --> $DIR/kindck-send-object1.rs:14:5 | LL | assert_send::<&'a (Dummy+Sync)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -21,7 +21,7 @@ LL | assert_send::<&'a (Dummy+Sync)>(); = note: type must satisfy the static lifetime error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely - --> $DIR/kindck-send-object1.rs:39:5 + --> $DIR/kindck-send-object1.rs:29:5 | LL | assert_send::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely @@ -30,7 +30,7 @@ LL | assert_send::>(); = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(dyn Dummy + 'a)>` = note: required because it appears within the type `std::boxed::Box<(dyn Dummy + 'a)>` note: required by `assert_send` - --> $DIR/kindck-send-object1.rs:15:1 + --> $DIR/kindck-send-object1.rs:5:1 | LL | fn assert_send() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/kindck/kindck-send-object2.rs b/src/test/ui/kindck/kindck-send-object2.rs index 0265f888e7c..911ad988081 100644 --- a/src/test/ui/kindck/kindck-send-object2.rs +++ b/src/test/ui/kindck/kindck-send-object2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Continue kindck-send-object1.rs. fn assert_send() { } diff --git a/src/test/ui/kindck/kindck-send-object2.stderr b/src/test/ui/kindck/kindck-send-object2.stderr index 475159cd400..db79989dc5f 100644 --- a/src/test/ui/kindck/kindck-send-object2.stderr +++ b/src/test/ui/kindck/kindck-send-object2.stderr @@ -1,5 +1,5 @@ error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely - --> $DIR/kindck-send-object2.rs:17:5 + --> $DIR/kindck-send-object2.rs:7:5 | LL | assert_send::<&'static Dummy>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely @@ -7,13 +7,13 @@ LL | assert_send::<&'static Dummy>(); = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'static)` = note: required because of the requirements on the impl of `std::marker::Send` for `&'static (dyn Dummy + 'static)` note: required by `assert_send` - --> $DIR/kindck-send-object2.rs:13:1 + --> $DIR/kindck-send-object2.rs:3:1 | LL | fn assert_send() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `dyn Dummy` cannot be sent between threads safely - --> $DIR/kindck-send-object2.rs:22:5 + --> $DIR/kindck-send-object2.rs:12:5 | LL | assert_send::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely @@ -22,7 +22,7 @@ LL | assert_send::>(); = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique` = note: required because it appears within the type `std::boxed::Box` note: required by `assert_send` - --> $DIR/kindck-send-object2.rs:13:1 + --> $DIR/kindck-send-object2.rs:3:1 | LL | fn assert_send() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/kindck/kindck-send-owned.rs b/src/test/ui/kindck/kindck-send-owned.rs index e48460a8753..65efb69041d 100644 --- a/src/test/ui/kindck/kindck-send-owned.rs +++ b/src/test/ui/kindck/kindck-send-owned.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test which of the builtin types are considered sendable. fn assert_send() { } diff --git a/src/test/ui/kindck/kindck-send-owned.stderr b/src/test/ui/kindck/kindck-send-owned.stderr index f5781bd968e..75c757dc546 100644 --- a/src/test/ui/kindck/kindck-send-owned.stderr +++ b/src/test/ui/kindck/kindck-send-owned.stderr @@ -1,5 +1,5 @@ error[E0277]: `*mut u8` cannot be sent between threads safely - --> $DIR/kindck-send-owned.rs:22:5 + --> $DIR/kindck-send-owned.rs:12:5 | LL | assert_send::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut u8` cannot be sent between threads safely @@ -8,7 +8,7 @@ LL | assert_send::>(); = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<*mut u8>` = note: required because it appears within the type `std::boxed::Box<*mut u8>` note: required by `assert_send` - --> $DIR/kindck-send-owned.rs:13:1 + --> $DIR/kindck-send-owned.rs:3:1 | LL | fn assert_send() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/kindck/kindck-send-unsafe.rs b/src/test/ui/kindck/kindck-send-unsafe.rs index 99b995b0906..4ef30a71fa3 100644 --- a/src/test/ui/kindck/kindck-send-unsafe.rs +++ b/src/test/ui/kindck/kindck-send-unsafe.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate core; fn assert_send() { } diff --git a/src/test/ui/kindck/kindck-send-unsafe.rs~rust-lang_master b/src/test/ui/kindck/kindck-send-unsafe.rs~rust-lang_master index a9bbfcfa262..3f0444ec9c8 100644 --- a/src/test/ui/kindck/kindck-send-unsafe.rs~rust-lang_master +++ b/src/test/ui/kindck/kindck-send-unsafe.rs~rust-lang_master @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn assert_send() { } // unsafe ptrs are ok unless they point at unsendable things diff --git a/src/test/ui/kindck/kindck-send-unsafe.stderr b/src/test/ui/kindck/kindck-send-unsafe.stderr index 846de09ba3c..2fbb07a0df5 100644 --- a/src/test/ui/kindck/kindck-send-unsafe.stderr +++ b/src/test/ui/kindck/kindck-send-unsafe.stderr @@ -1,12 +1,12 @@ error[E0277]: `*mut &'a isize` cannot be sent between threads safely - --> $DIR/kindck-send-unsafe.rs:16:5 + --> $DIR/kindck-send-unsafe.rs:6:5 | LL | assert_send::<*mut &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut &'a isize` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `*mut &'a isize` note: required by `assert_send` - --> $DIR/kindck-send-unsafe.rs:13:1 + --> $DIR/kindck-send-unsafe.rs:3:1 | LL | fn assert_send() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/label/label-static.rs b/src/test/ui/label/label-static.rs index a0fb25ea06e..95e764d0187 100644 --- a/src/test/ui/label/label-static.rs +++ b/src/test/ui/label/label-static.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { 'static: loop { //~ ERROR invalid label name `'static` break 'static //~ ERROR invalid label name `'static` diff --git a/src/test/ui/label/label-static.stderr b/src/test/ui/label/label-static.stderr index f5b6eba0089..52ab547aa7b 100644 --- a/src/test/ui/label/label-static.stderr +++ b/src/test/ui/label/label-static.stderr @@ -1,11 +1,11 @@ error: invalid label name `'static` - --> $DIR/label-static.rs:12:5 + --> $DIR/label-static.rs:2:5 | LL | 'static: loop { //~ ERROR invalid label name `'static` | ^^^^^^^ error: invalid label name `'static` - --> $DIR/label-static.rs:13:15 + --> $DIR/label-static.rs:3:15 | LL | break 'static //~ ERROR invalid label name `'static` | ^^^^^^^ diff --git a/src/test/ui/label/label-underscore.rs b/src/test/ui/label/label-underscore.rs index 30411bf8789..de67f3d2c3e 100644 --- a/src/test/ui/label/label-underscore.rs +++ b/src/test/ui/label/label-underscore.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { '_: loop { //~ ERROR invalid label name `'_` break '_ //~ ERROR invalid label name `'_` diff --git a/src/test/ui/label/label-underscore.stderr b/src/test/ui/label/label-underscore.stderr index 9a567094c82..a4925c8619e 100644 --- a/src/test/ui/label/label-underscore.stderr +++ b/src/test/ui/label/label-underscore.stderr @@ -1,11 +1,11 @@ error: invalid label name `'_` - --> $DIR/label-underscore.rs:12:5 + --> $DIR/label-underscore.rs:2:5 | LL | '_: loop { //~ ERROR invalid label name `'_` | ^^ error: invalid label name `'_` - --> $DIR/label-underscore.rs:13:15 + --> $DIR/label-underscore.rs:3:15 | LL | break '_ //~ ERROR invalid label name `'_` | ^^ diff --git a/src/test/ui/label/label_break_value_continue.rs b/src/test/ui/label/label_break_value_continue.rs index 4a505dff3d4..e0deb30c950 100644 --- a/src/test/ui/label/label_break_value_continue.rs +++ b/src/test/ui/label/label_break_value_continue.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(label_break_value)] #![allow(unused_labels)] diff --git a/src/test/ui/label/label_break_value_continue.stderr b/src/test/ui/label/label_break_value_continue.stderr index 12a21a8a594..c0decc82552 100644 --- a/src/test/ui/label/label_break_value_continue.stderr +++ b/src/test/ui/label/label_break_value_continue.stderr @@ -1,17 +1,17 @@ error[E0695]: unlabeled `continue` inside of a labeled block - --> $DIR/label_break_value_continue.rs:17:9 + --> $DIR/label_break_value_continue.rs:7:9 | LL | continue; //~ ERROR unlabeled `continue` inside of a labeled block | ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label error[E0696]: `continue` pointing to a labeled block - --> $DIR/label_break_value_continue.rs:24:9 + --> $DIR/label_break_value_continue.rs:14:9 | LL | continue 'b; //~ ERROR `continue` pointing to a labeled block | ^^^^^^^^^^^ labeled blocks cannot be `continue`'d | note: labeled block the continue points to - --> $DIR/label_break_value_continue.rs:23:5 + --> $DIR/label_break_value_continue.rs:13:5 | LL | / 'b: { LL | | continue 'b; //~ ERROR `continue` pointing to a labeled block @@ -19,7 +19,7 @@ LL | | } | |_____^ error[E0695]: unlabeled `continue` inside of a labeled block - --> $DIR/label_break_value_continue.rs:32:13 + --> $DIR/label_break_value_continue.rs:22:13 | LL | continue; //~ ERROR unlabeled `continue` inside of a labeled block | ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label diff --git a/src/test/ui/label/label_break_value_illegal_uses.rs b/src/test/ui/label/label_break_value_illegal_uses.rs index 8315104d37f..81cb1774380 100644 --- a/src/test/ui/label/label_break_value_illegal_uses.rs +++ b/src/test/ui/label/label_break_value_illegal_uses.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(label_break_value)] // These are forbidden occurrences of label-break-value diff --git a/src/test/ui/label/label_break_value_illegal_uses.stderr b/src/test/ui/label/label_break_value_illegal_uses.stderr index 02fa541d6a4..889df17de44 100644 --- a/src/test/ui/label/label_break_value_illegal_uses.stderr +++ b/src/test/ui/label/label_break_value_illegal_uses.stderr @@ -1,11 +1,11 @@ error: expected one of `extern`, `fn`, or `{`, found `'b` - --> $DIR/label_break_value_illegal_uses.rs:16:12 + --> $DIR/label_break_value_illegal_uses.rs:6:12 | LL | unsafe 'b: {} //~ ERROR expected one of `extern`, `fn`, or `{` | ^^ expected one of `extern`, `fn`, or `{` here error: expected `{`, found `'b` - --> $DIR/label_break_value_illegal_uses.rs:20:13 + --> $DIR/label_break_value_illegal_uses.rs:10:13 | LL | if true 'b: {} //~ ERROR expected `{`, found `'b` | -- ^^---- @@ -15,7 +15,7 @@ LL | if true 'b: {} //~ ERROR expected `{`, found `'b` | this `if` statement has a condition, but no block error: expected `{`, found `'b` - --> $DIR/label_break_value_illegal_uses.rs:24:21 + --> $DIR/label_break_value_illegal_uses.rs:14:21 | LL | if true {} else 'b: {} //~ ERROR expected `{`, found `'b` | ^^---- @@ -24,7 +24,7 @@ LL | if true {} else 'b: {} //~ ERROR expected `{`, found `'b` | help: try placing this code inside a block: `{ 'b: { } }` error: expected one of `.`, `?`, `{`, or an operator, found `'b` - --> $DIR/label_break_value_illegal_uses.rs:28:17 + --> $DIR/label_break_value_illegal_uses.rs:18:17 | LL | match false 'b: {} //~ ERROR expected one of `.`, `?`, `{`, or an operator | ----- ^^ expected one of `.`, `?`, `{`, or an operator here diff --git a/src/test/ui/label/label_break_value_unlabeled_break.rs b/src/test/ui/label/label_break_value_unlabeled_break.rs index 454ebd4c6cf..fa0c70edc78 100644 --- a/src/test/ui/label/label_break_value_unlabeled_break.rs +++ b/src/test/ui/label/label_break_value_unlabeled_break.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(label_break_value)] #![allow(unused_labels)] diff --git a/src/test/ui/label/label_break_value_unlabeled_break.stderr b/src/test/ui/label/label_break_value_unlabeled_break.stderr index 62c4a12231b..1d6e27d4c3d 100644 --- a/src/test/ui/label/label_break_value_unlabeled_break.stderr +++ b/src/test/ui/label/label_break_value_unlabeled_break.stderr @@ -1,11 +1,11 @@ error[E0695]: unlabeled `break` inside of a labeled block - --> $DIR/label_break_value_unlabeled_break.rs:17:9 + --> $DIR/label_break_value_unlabeled_break.rs:7:9 | LL | break; //~ ERROR unlabeled `break` inside of a labeled block | ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label error[E0695]: unlabeled `break` inside of a labeled block - --> $DIR/label_break_value_unlabeled_break.rs:25:13 + --> $DIR/label_break_value_unlabeled_break.rs:15:13 | LL | break; //~ ERROR unlabeled `break` inside of a labeled block | ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label diff --git a/src/test/ui/lang-item-missing.rs b/src/test/ui/lang-item-missing.rs index ce2fa2548c3..4e26343242e 100644 --- a/src/test/ui/lang-item-missing.rs +++ b/src/test/ui/lang-item-missing.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a missing lang item (in this case `sized`) does not cause an ICE, // see #17392. diff --git a/src/test/ui/layout/homogeneous-aggr-zero-sized-c-struct.rs b/src/test/ui/layout/homogeneous-aggr-zero-sized-c-struct.rs new file mode 100644 index 00000000000..622709e7de5 --- /dev/null +++ b/src/test/ui/layout/homogeneous-aggr-zero-sized-c-struct.rs @@ -0,0 +1,36 @@ +#![feature(rustc_attrs)] + +// Show that `homogeneous_aggregate` code ignores zero-length C +// arrays. This matches the recent C standard, though not the +// behavior of all older compilers, which somtimes consider `T[0]` to +// be a "flexible array member" (see discussion on #56877 for +// details). + +#[repr(C)] +pub struct Foo { + x: u32 +} + +#[repr(C)] +pub struct Middle { + pub a: f32, + pub foo: [Foo; 0], + pub b: f32, +} + +#[rustc_layout(homogeneous_aggregate)] +pub type TestMiddle = Middle; +//~^ ERROR homogeneous_aggregate: Homogeneous + +#[repr(C)] +pub struct Final { + pub a: f32, + pub b: f32, + pub foo: [Foo; 0], +} + +#[rustc_layout(homogeneous_aggregate)] +pub type TestFinal = Final; +//~^ ERROR homogeneous_aggregate: Homogeneous + +fn main() { } diff --git a/src/test/ui/layout/homogeneous-aggr-zero-sized-c-struct.stderr b/src/test/ui/layout/homogeneous-aggr-zero-sized-c-struct.stderr new file mode 100644 index 00000000000..0d442606351 --- /dev/null +++ b/src/test/ui/layout/homogeneous-aggr-zero-sized-c-struct.stderr @@ -0,0 +1,14 @@ +error: homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + --> $DIR/homogeneous-aggr-zero-sized-c-struct.rs:22:1 + | +LL | pub type TestMiddle = Middle; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + --> $DIR/homogeneous-aggr-zero-sized-c-struct.rs:33:1 + | +LL | pub type TestFinal = Final; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/layout/homogeneous-aggr-zero-sized-repr-rust.rs b/src/test/ui/layout/homogeneous-aggr-zero-sized-repr-rust.rs new file mode 100644 index 00000000000..4b429412aeb --- /dev/null +++ b/src/test/ui/layout/homogeneous-aggr-zero-sized-repr-rust.rs @@ -0,0 +1,73 @@ +#![feature(rustc_attrs)] + +// Regression test for #56877. We want to ensure that the presence of +// `PhantomData` does not prevent `Bar` from being considered a +// homogeneous aggregate. + +#[repr(C)] +pub struct BaseCase { + pub a: f32, + pub b: f32, +} + +#[repr(C)] +pub struct WithPhantomData { + pub a: f32, + pub b: f32, + pub _unit: std::marker::PhantomData<()>, +} + +pub struct EmptyRustStruct { +} + +#[repr(C)] +pub struct WithEmptyRustStruct { + pub a: f32, + pub b: f32, + pub _unit: EmptyRustStruct, +} + +pub struct TransitivelyEmptyRustStruct { + field: EmptyRustStruct, + array: [u32; 0], +} + +#[repr(C)] +pub struct WithTransitivelyEmptyRustStruct { + pub a: f32, + pub b: f32, + pub _unit: TransitivelyEmptyRustStruct, +} + +pub enum EmptyRustEnum { + Dummy, +} + +#[repr(C)] +pub struct WithEmptyRustEnum { + pub a: f32, + pub b: f32, + pub _unit: EmptyRustEnum, +} + +#[rustc_layout(homogeneous_aggregate)] +pub type Test1 = BaseCase; +//~^ ERROR homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + +#[rustc_layout(homogeneous_aggregate)] +pub type Test2 = WithPhantomData; +//~^ ERROR homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + +#[rustc_layout(homogeneous_aggregate)] +pub type Test3 = WithEmptyRustStruct; +//~^ ERROR homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + +#[rustc_layout(homogeneous_aggregate)] +pub type Test4 = WithTransitivelyEmptyRustStruct; +//~^ ERROR homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + +#[rustc_layout(homogeneous_aggregate)] +pub type Test5 = WithEmptyRustEnum; +//~^ ERROR homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + +fn main() { } diff --git a/src/test/ui/layout/homogeneous-aggr-zero-sized-repr-rust.stderr b/src/test/ui/layout/homogeneous-aggr-zero-sized-repr-rust.stderr new file mode 100644 index 00000000000..be04ba3e7f6 --- /dev/null +++ b/src/test/ui/layout/homogeneous-aggr-zero-sized-repr-rust.stderr @@ -0,0 +1,32 @@ +error: homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + --> $DIR/homogeneous-aggr-zero-sized-repr-rust.rs:54:1 + | +LL | pub type Test1 = BaseCase; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + --> $DIR/homogeneous-aggr-zero-sized-repr-rust.rs:58:1 + | +LL | pub type Test2 = WithPhantomData; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + --> $DIR/homogeneous-aggr-zero-sized-repr-rust.rs:62:1 + | +LL | pub type Test3 = WithEmptyRustStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + --> $DIR/homogeneous-aggr-zero-sized-repr-rust.rs:66:1 + | +LL | pub type Test4 = WithTransitivelyEmptyRustStruct; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + --> $DIR/homogeneous-aggr-zero-sized-repr-rust.rs:70:1 + | +LL | pub type Test5 = WithEmptyRustEnum; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 5 previous errors + diff --git a/src/test/ui/layout/zero-sized-array-union.rs b/src/test/ui/layout/zero-sized-array-union.rs new file mode 100644 index 00000000000..68b218249eb --- /dev/null +++ b/src/test/ui/layout/zero-sized-array-union.rs @@ -0,0 +1,95 @@ +#![feature(rustc_attrs)] + +// Various tests around the behavior of zero-sized arrays and +// unions. This matches the behavior of modern C compilers, though +// older compilers (and sometimes clang) treat `T[0]` as a "flexible +// array member". See more +// details in #56877. + +#[derive(Copy, Clone)] +#[repr(C)] +struct Empty { } + +#[derive(Copy, Clone)] +#[repr(C)] +struct Empty2 { + e: Empty +} + +#[derive(Copy, Clone)] +#[repr(C)] +struct Empty3 { + z: [f32; 0], +} + +#[derive(Copy, Clone)] +#[repr(C)] +struct Empty4 { + e: Empty3 +} + +#[repr(C)] +union U1 { + s: Empty +} + +#[repr(C)] +union U2 { + s: Empty2 +} + +#[repr(C)] +union U3 { + s: Empty3 +} + +#[repr(C)] +union U4 { + s: Empty4 +} + +#[repr(C)] +struct Baz1 { + x: f32, + y: f32, + u: U1, +} + +#[rustc_layout(homogeneous_aggregate)] +type TestBaz1 = Baz1; +//~^ ERROR homogeneous_aggregate: Homogeneous + +#[repr(C)] +struct Baz2 { + x: f32, + y: f32, + u: U2, +} + +#[rustc_layout(homogeneous_aggregate)] +type TestBaz2 = Baz2; +//~^ ERROR homogeneous_aggregate: Homogeneous + +#[repr(C)] +struct Baz3 { + x: f32, + y: f32, + u: U3, +} + +#[rustc_layout(homogeneous_aggregate)] +type TestBaz3 = Baz3; +//~^ ERROR homogeneous_aggregate: Homogeneous + +#[repr(C)] +struct Baz4 { + x: f32, + y: f32, + u: U4, +} + +#[rustc_layout(homogeneous_aggregate)] +type TestBaz4 = Baz4; +//~^ ERROR homogeneous_aggregate: Homogeneous + +fn main() { } diff --git a/src/test/ui/layout/zero-sized-array-union.stderr b/src/test/ui/layout/zero-sized-array-union.stderr new file mode 100644 index 00000000000..1bb31aaf7b7 --- /dev/null +++ b/src/test/ui/layout/zero-sized-array-union.stderr @@ -0,0 +1,26 @@ +error: homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + --> $DIR/zero-sized-array-union.rs:59:1 + | +LL | type TestBaz1 = Baz1; + | ^^^^^^^^^^^^^^^^^^^^^ + +error: homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + --> $DIR/zero-sized-array-union.rs:70:1 + | +LL | type TestBaz2 = Baz2; + | ^^^^^^^^^^^^^^^^^^^^^ + +error: homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + --> $DIR/zero-sized-array-union.rs:81:1 + | +LL | type TestBaz3 = Baz3; + | ^^^^^^^^^^^^^^^^^^^^^ + +error: homogeneous_aggregate: Homogeneous(Reg { kind: Float, size: Size { raw: 4 } }) + --> $DIR/zero-sized-array-union.rs:92:1 + | +LL | type TestBaz4 = Baz4; + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/lexical-scopes.rs b/src/test/ui/lexical-scopes.rs index 39da0d47a95..46cfdf1efa8 100644 --- a/src/test/ui/lexical-scopes.rs +++ b/src/test/ui/lexical-scopes.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct T { i: i32 } fn f() { let t = T { i: 0 }; //~ ERROR expected struct, variant or union type, found type parameter `T` diff --git a/src/test/ui/lexical-scopes.stderr b/src/test/ui/lexical-scopes.stderr index 3a6ae52c68d..51313033a02 100644 --- a/src/test/ui/lexical-scopes.stderr +++ b/src/test/ui/lexical-scopes.stderr @@ -1,5 +1,5 @@ error[E0574]: expected struct, variant or union type, found type parameter `T` - --> $DIR/lexical-scopes.rs:13:13 + --> $DIR/lexical-scopes.rs:3:13 | LL | let t = T { i: 0 }; //~ ERROR expected struct, variant or union type, found type parameter `T` | ^ not a struct, variant or union type @@ -9,10 +9,12 @@ LL | use T; | error[E0599]: no function or associated item named `f` found for type `Foo` in the current scope - --> $DIR/lexical-scopes.rs:20:5 + --> $DIR/lexical-scopes.rs:10:10 | LL | Foo::f(); //~ ERROR no function or associated item named `f` - | ^^^^^^ function or associated item not found in `Foo` + | -----^ + | | + | function or associated item not found in `Foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/lifetime-before-type-params.rs b/src/test/ui/lifetime-before-type-params.rs new file mode 100644 index 00000000000..9b905d4883a --- /dev/null +++ b/src/test/ui/lifetime-before-type-params.rs @@ -0,0 +1,9 @@ +#![allow(unused)] +fn first() {} +//~^ ERROR lifetime parameters must be declared prior to type parameters +fn second<'a, T, 'b>() {} +//~^ ERROR lifetime parameters must be declared prior to type parameters +fn third() {} +//~^ ERROR lifetime parameters must be declared prior to type parameters +fn fourth<'a, T, 'b, U, 'c, V>() {} +//~^ ERROR lifetime parameters must be declared prior to type parameters diff --git a/src/test/ui/lifetime-before-type-params.stderr b/src/test/ui/lifetime-before-type-params.stderr new file mode 100644 index 00000000000..7ac8dffdfbe --- /dev/null +++ b/src/test/ui/lifetime-before-type-params.stderr @@ -0,0 +1,47 @@ +error: lifetime parameters must be declared prior to type parameters + --> $DIR/lifetime-before-type-params.rs:2:13 + | +LL | fn first() {} + | ^^ ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | fn first<'a, 'b, T>() {} + | ^^^ ^^^ -- + +error: lifetime parameters must be declared prior to type parameters + --> $DIR/lifetime-before-type-params.rs:4:18 + | +LL | fn second<'a, T, 'b>() {} + | ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | fn second<'a, 'b, T>() {} + | ^^^ -- + +error: lifetime parameters must be declared prior to type parameters + --> $DIR/lifetime-before-type-params.rs:6:16 + | +LL | fn third() {} + | ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | fn third<'a, T, U>() {} + | ^^^ -- + +error: lifetime parameters must be declared prior to type parameters + --> $DIR/lifetime-before-type-params.rs:8:18 + | +LL | fn fourth<'a, T, 'b, U, 'c, V>() {} + | ^^ ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | fn fourth<'a, 'b, 'c, T, U, V>() {} + | ^^^ ^^^ -- -- + +error[E0601]: `main` function not found in crate `lifetime_before_type_params` + | + = note: consider adding a `main` function to `$DIR/lifetime-before-type-params.rs` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/lifetime_starts_expressions.rs b/src/test/ui/lifetime_starts_expressions.rs index ffe1d7c353b..e0098793e1f 100644 --- a/src/test/ui/lifetime_starts_expressions.rs +++ b/src/test/ui/lifetime_starts_expressions.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() -> u32 { return 'label: loop { break 'label 42; }; } diff --git a/src/test/ui/lifetime_starts_expressions.stderr b/src/test/ui/lifetime_starts_expressions.stderr index de42f1daa1e..fa0a7ac002b 100644 --- a/src/test/ui/lifetime_starts_expressions.stderr +++ b/src/test/ui/lifetime_starts_expressions.stderr @@ -1,11 +1,15 @@ error: expected identifier, found keyword `loop` - --> $DIR/lifetime_starts_expressions.rs:16:26 + --> $DIR/lifetime_starts_expressions.rs:6:26 | LL | loop { break 'label: loop { break 'label 42; }; } | ^^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | loop { break 'label: r#loop { break 'label 42; }; } + | ^^^^^^ error: expected type, found keyword `loop` - --> $DIR/lifetime_starts_expressions.rs:16:26 + --> $DIR/lifetime_starts_expressions.rs:6:26 | LL | loop { break 'label: loop { break 'label 42; }; } | ^^^^ expecting a type here because of type ascription diff --git a/src/test/ui/lifetimes/auxiliary/lifetime_bound_will_change_warning_lib.rs b/src/test/ui/lifetimes/auxiliary/lifetime_bound_will_change_warning_lib.rs index 95f8b39c487..58f1b81cf4d 100644 --- a/src/test/ui/lifetimes/auxiliary/lifetime_bound_will_change_warning_lib.rs +++ b/src/test/ui/lifetimes/auxiliary/lifetime_bound_will_change_warning_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] // Helper for testing that we get suitable warnings when lifetime diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr index 38a711bcefb..d70524b2387 100644 --- a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr +++ b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-let-suggestion.rs:12:17 + --> $DIR/borrowck-let-suggestion.rs:2:17 | LL | let mut x = vec![1].iter(); | ^^^^^^^ - temporary value is freed at the end of this statement diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.rs b/src/test/ui/lifetimes/borrowck-let-suggestion.rs index 37d6e351828..1deb0457e95 100644 --- a/src/test/ui/lifetimes/borrowck-let-suggestion.rs +++ b/src/test/ui/lifetimes/borrowck-let-suggestion.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f() { let mut x = vec![1].iter(); //~^ ERROR borrowed value does not live long enough diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.stderr b/src/test/ui/lifetimes/borrowck-let-suggestion.stderr index a7ff1fd9d0a..7a95137ac92 100644 --- a/src/test/ui/lifetimes/borrowck-let-suggestion.stderr +++ b/src/test/ui/lifetimes/borrowck-let-suggestion.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-let-suggestion.rs:12:17 + --> $DIR/borrowck-let-suggestion.rs:2:17 | LL | let mut x = vec![1].iter(); | ^^^^^^^ - temporary value dropped here while still borrowed diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs index cd0ba5e4a0a..5461f875af6 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lifetime_bound_will_change_warning_lib.rs // Test that various corner cases cause an error. These are tests diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr index 01f215c97f2..a283a0b29e6 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr @@ -1,28 +1,28 @@ error[E0308]: mismatched types - --> $DIR/lifetime-bound-will-change-warning.rs:44:13 + --> $DIR/lifetime-bound-will-change-warning.rs:34:13 | LL | ref_obj(x) //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `&std::boxed::Box<(dyn std::ops::Fn() + 'static)>` found type `&std::boxed::Box<(dyn std::ops::Fn() + 'a)>` -note: the lifetime 'a as defined on the function body at 42:10... - --> $DIR/lifetime-bound-will-change-warning.rs:42:10 +note: the lifetime 'a as defined on the function body at 32:10... + --> $DIR/lifetime-bound-will-change-warning.rs:32:10 | LL | fn test2<'a>(x: &'a Box) { | ^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/lifetime-bound-will-change-warning.rs:49:18 + --> $DIR/lifetime-bound-will-change-warning.rs:39:18 | LL | lib::ref_obj(x) //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `&std::boxed::Box<(dyn std::ops::Fn() + 'static)>` found type `&std::boxed::Box<(dyn std::ops::Fn() + 'a)>` -note: the lifetime 'a as defined on the function body at 47:12... - --> $DIR/lifetime-bound-will-change-warning.rs:47:12 +note: the lifetime 'a as defined on the function body at 37:12... + --> $DIR/lifetime-bound-will-change-warning.rs:37:12 | LL | fn test2cc<'a>(x: &'a Box) { | ^^ diff --git a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.rs b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.rs index 7bc83fd7507..d2b782c92f3 100644 --- a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.rs +++ b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait ListItem<'a> { fn list_name() -> &'a str; } diff --git a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr index db8d57bb19d..d4ca1aec697 100644 --- a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr +++ b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:29:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:19:5 | LL | struct Foo { | - help: consider adding an explicit lifetime bound `T: 'static`... @@ -7,13 +7,13 @@ LL | foo: &'static T | ^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:29:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:19:5 | LL | foo: &'static T | ^^^^^^^^^^^^^^^ error[E0309]: the parameter type `K` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:34:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:24:5 | LL | trait X: Sized { | - help: consider adding an explicit lifetime bound `K: 'a`... @@ -21,26 +21,26 @@ LL | fn foo<'a, L: X<&'a Nested>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a Nested` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:34:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:24:5 | LL | fn foo<'a, L: X<&'a Nested>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `Self` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:38:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5 | LL | fn bar<'a, L: X<&'a Nested>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `Self: 'a`... note: ...so that the reference type `&'a Nested` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:38:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5 | LL | fn bar<'a, L: X<&'a Nested>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `L` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:42:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:32:5 | LL | fn baz<'a, L, M: X<&'a Nested>>() { | ^ - help: consider adding an explicit lifetime bound `L: 'a`... @@ -51,7 +51,7 @@ LL | | } | |_____^ | note: ...so that the reference type `&'a Nested` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:42:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:32:5 | LL | / fn baz<'a, L, M: X<&'a Nested>>() { LL | | //~^ ERROR may not live long enough @@ -59,7 +59,7 @@ LL | | } | |_____^ error[E0309]: the parameter type `K` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:51:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:41:5 | LL | impl Nested { | - help: consider adding an explicit lifetime bound `K: 'a`... @@ -69,7 +69,7 @@ LL | | } | |_____^ | note: ...so that the reference type `&'a Nested` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:51:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:41:5 | LL | / fn generic_in_parent<'a, L: X<&'a Nested>>() { LL | | //~^ ERROR may not live long enough @@ -77,7 +77,7 @@ LL | | } | |_____^ error[E0309]: the parameter type `M` may not live long enough - --> $DIR/lifetime-doesnt-live-long-enough.rs:54:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:44:5 | LL | fn generic_in_child<'a, 'b, L: X<&'a Nested>, M: 'b>() { | ^ -- help: consider adding an explicit lifetime bound `M: 'a`... @@ -88,7 +88,7 @@ LL | | } | |_____^ | note: ...so that the reference type `&'a Nested` does not outlive the data it points at - --> $DIR/lifetime-doesnt-live-long-enough.rs:54:5 + --> $DIR/lifetime-doesnt-live-long-enough.rs:44:5 | LL | / fn generic_in_child<'a, 'b, L: X<&'a Nested>, M: 'b>() { LL | | //~^ ERROR may not live long enough diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs index a5fada7869e..7a2eba518fe 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Lifetime annotation needed because we have no arguments. fn f() -> &isize { //~ ERROR missing lifetime specifier panic!() diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr index 4c7a1b5ea9f..cf825c52f56 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:12:11 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:2:11 | LL | fn f() -> &isize { //~ ERROR missing lifetime specifier | ^ help: consider giving it a 'static lifetime: `&'static` @@ -7,7 +7,7 @@ LL | fn f() -> &isize { //~ ERROR missing lifetime specifier = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:17:33 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:7:33 | LL | fn g(_x: &isize, _y: &isize) -> &isize { //~ ERROR missing lifetime specifier | ^ expected lifetime parameter @@ -15,7 +15,7 @@ LL | fn g(_x: &isize, _y: &isize) -> &isize { //~ ERROR missing lifetime spec = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_x` or `_y` error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:27:19 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:17:19 | LL | fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier | ^ expected lifetime parameter @@ -23,7 +23,7 @@ LL | fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier = help: this function's return type contains a borrowed value, but the signature does not say which one of `_x`'s 2 lifetimes it is borrowed from error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:31:20 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:21:20 | LL | fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier | ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static` @@ -31,7 +31,7 @@ LL | fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:44:24 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:34:24 | LL | fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier | ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static` @@ -39,7 +39,7 @@ LL | fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:50:49 + --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:40:49 | LL | fn k<'a, T: WithLifetime<'a>>(_x: T::Output) -> &isize { | ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static` diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs index eb959bfbcb5..1c288a7e44f 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs @@ -6,6 +6,7 @@ trait Future { use std::error::Error; fn foo() -> impl Future> { +//~^ ERROR missing lifetime Ok(()) } diff --git a/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.rs b/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.rs index 5ded42e7c97..b0c09c7514e 100644 --- a/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.rs +++ b/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { field: i32, } diff --git a/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr b/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr index b886450336d..6211a9a1141 100644 --- a/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/42701_one_named_and_one_anonymous.rs:20:9 + --> $DIR/42701_one_named_and_one_anonymous.rs:10:9 | LL | fn foo2<'a>(a: &'a Foo, x: &i32) -> &'a i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.rs index 1705767834f..35f70dd1982 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Clone)] enum Foo<'a> { Bar(&'a str), diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr index 5847f755b3c..9fe1679936d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `other` - --> $DIR/ex1-return-one-existing-name-early-bound-in-struct.rs:21:21 + --> $DIR/ex1-return-one-existing-name-early-bound-in-struct.rs:11:21 | LL | fn bar(&self, other: Foo) -> Foo<'a> { | --- help: add explicit lifetime `'a` to the type of `other`: `Foo<'a>` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.rs index 964f2f1c003..9b15b378dc1 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { if x > y { x } else { y } //~ ERROR explicit lifetime } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr index a4e1fe5e183..94ec5248eb0 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/ex1-return-one-existing-name-if-else-2.rs:12:16 + --> $DIR/ex1-return-one-existing-name-if-else-2.rs:2:16 | LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.rs index 96d5c5bb161..6b062125cc0 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo<'a>((x, y): (&'a i32, &i32)) -> &'a i32 { if x > y { x } else { y } //~ ERROR explicit lifetime } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr index a260c7bf7e9..4be638bf4c2 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in parameter type - --> $DIR/ex1-return-one-existing-name-if-else-3.rs:12:27 + --> $DIR/ex1-return-one-existing-name-if-else-3.rs:2:27 | LL | fn foo<'a>((x, y): (&'a i32, &i32)) -> &'a i32 { | --------------- help: add explicit lifetime `'a` to type: `(&'a i32, &'a i32)` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.rs index 5cf52fe79f0..7bc3fa623ee 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr index 8eac8761bd4..d61271b81ac 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/ex1-return-one-existing-name-if-else-using-impl-2.rs:14:15 + --> $DIR/ex1-return-one-existing-name-if-else-using-impl-2.rs:4:15 | LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs index 3727ddf9129..a1126d6bb15 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { field: i32 } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr index 0ae98aeb843..15642be44b7 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:18:36 + --> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:8:36 | LL | fn foo<'a>(&'a self, x: &i32) -> &i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs index cec73d79ec2..12024bd1080 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32; diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr index 0eb8afbb26b..1eaa9c8339f 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:21:20 + --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:11:20 | LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | ---- ------- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.rs index 5ee2663317e..f72d567bbd8 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 { if x > y { x } else { y } //~ ERROR explicit lifetime } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr index b68b90e77de..d48adf16808 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/ex1-return-one-existing-name-if-else.rs:12:27 + --> $DIR/ex1-return-one-existing-name-if-else.rs:2:27 | LL | fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 { | ---- help: add explicit lifetime `'a` to the type of `y`: `&'a i32` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs index 4d57c61ba9e..ef5dd1160fb 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { field: i32 } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr index b6dfdff60be..f4b2efa8438 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:18:5 + --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:8:5 | LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { | ------- ---- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs index a6ccf4a53d1..597d20dbacd 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { field: i32, } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr index 6c32adc11ce..328c69bb658 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18:30 + --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:8:30 | LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { | ----- ------- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.rs b/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.rs index 7f5b23728fd..d1263a4acb2 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(x: &i32, y: &i32) -> &i32 { //~ ERROR missing lifetime if x > y { x } else { y } } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr index 4710ebfa967..9fc1124685c 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/ex1b-return-no-names-if-else.rs:11:29 + --> $DIR/ex1b-return-no-names-if-else.rs:1:29 | LL | fn foo(x: &i32, y: &i32) -> &i32 { //~ ERROR missing lifetime | ^ expected lifetime parameter diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.rs index f35a7555d70..998a48ce20c 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Ref<'a, T: 'a> { data: &'a T } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr index 6f0a5179d6b..3df29e62a28 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/ex2a-push-one-existing-name-2.rs:16:12 + --> $DIR/ex2a-push-one-existing-name-2.rs:6:12 | LL | fn foo<'a>(x: Ref, y: &mut Vec>) { | -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs index cad0a3c6ac1..d18b50d0d0c 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. trait Foo<'a> {} impl<'a, T> Foo<'a> for T {} diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr index a8286ba2952..0fd085c39f2 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/ex2a-push-one-existing-name-early-bound.rs:17:12 + --> $DIR/ex2a-push-one-existing-name-early-bound.rs:8:12 | LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T) | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.rs b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.rs index 1834395bd3b..5188ea1cc9c 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Ref<'a, T: 'a> { data: &'a T } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr index ebe465aa581..a669e33ab09 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `y` - --> $DIR/ex2a-push-one-existing-name.rs:16:12 + --> $DIR/ex2a-push-one-existing-name.rs:6:12 | LL | fn foo<'a>(x: &mut Vec>, y: Ref) { | -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.rs b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.rs index 6cf626adf82..82e0c9bc26e 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Ref<'a, T: 'a> { data: &'a T } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr index 9884c0f3511..7ac61df4954 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex2b-push-no-existing-names.rs:16:12 + --> $DIR/ex2b-push-no-existing-names.rs:6:12 | LL | fn foo(x: &mut Vec>, y: Ref) { | -------- -------- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.rs b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.rs index 36bd1c32286..7f15aee5f08 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Ref<'a, T: 'a> { data: &'a T } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr index 114024c2fb0..bfa9c0d15f0 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex2c-push-inference-variable.rs:17:12 + --> $DIR/ex2c-push-inference-variable.rs:7:12 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs index 96316819e93..ee77d9e7fde 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Ref<'a, T: 'a> { data: &'a T } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr index 32fc8b42f42..2db81f8aba6 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex2d-push-inference-variable-2.rs:16:33 + --> $DIR/ex2d-push-inference-variable-2.rs:6:33 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs index 9352ebc77f5..e2a795a071c 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Ref<'a, T: 'a> { data: &'a T } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr index f62848ffa8c..85a6dba9289 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex2e-push-inference-variable-3.rs:16:33 + --> $DIR/ex2e-push-inference-variable-3.rs:6:33 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs index 62d7d56f9f7..1ff96aadd93 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) { *v = x; //~ ERROR lifetime mismatch } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr index 5e110b43fb4..b8f97d14577 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-2.rs:12:10 + --> $DIR/ex3-both-anon-regions-2.rs:2:10 | LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.rs index fe6b40c05a6..c04b5d3a3eb 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { z.push((x,y)); //~ ERROR lifetime mismatch //~^ ERROR lifetime mismatch diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr index 5a584296d3b..acfe809b678 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-3.rs:12:13 + --> $DIR/ex3-both-anon-regions-3.rs:2:13 | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { | --- --- these two types are declared with different lifetimes... @@ -7,7 +7,7 @@ LL | z.push((x,y)); //~ ERROR lifetime mismatch | ^ ...but data flows into `z` here error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-3.rs:12:15 + --> $DIR/ex3-both-anon-regions-3.rs:2:15 | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs index f16120ddc22..94bb8092407 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. struct Ref<'a, 'b> { a: &'a u32, b: &'b u32, diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr index 158f40f2969..cb1ca5e1485 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:16:11 + --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:7:11 | LL | fn foo(mut x: Ref, y: Ref) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs index 78e6dc2d3e7..3b22aef6f32 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. struct Ref<'a, 'b> { a: &'a u32, b: &'b u32, diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr index 546789eedcb..863ec9806fc 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:16:11 + --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:7:11 | LL | fn foo(mut x: Ref) { | --- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs index ffec0e8d5bb..87f9cc17726 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. struct Ref<'a> { x: &'a u32, } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr index f69bcb64297..57174385b4d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:18:12 + --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:9:12 | LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) | ------- ------- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs index 16d18f30951..4be76c2a0da 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. struct Ref<'a> { x: &'a u32, } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr index f9530c436a0..caa7397979b 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:15:12 + --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:6:12 | LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) { | ------- ------- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs index 3b90b3474a1..8fbb405a23d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. struct Ref<'a> { x: &'a u32, } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr index 243103e2d18..27d5f5da7e5 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:12 + --> $DIR/ex3-both-anon-regions-both-are-structs.rs:6:12 | LL | fn foo(mut x: Vec, y: Ref) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs index 966b4f0b6c3..7938d11a905 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { x.push(y); //~ ERROR lifetime mismatch } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr index c4dd2823431..97da7f8ac6d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-latebound-regions.rs:12:12 + --> $DIR/ex3-both-anon-regions-latebound-regions.rs:2:12 | LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { | ------ ------ these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs index 055c3f80468..1e6425cf5ca 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } fn foo(mut x: Ref, y: &u32) { diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr index 52293e45306..8c4e3daed4c 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:9 + --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:4:9 | LL | fn foo(mut x: Ref, y: &u32) { | --- ---- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs index 474da4a7d16..02838362c80 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } fn foo(mut y: Ref, x: &u32) { diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr index b5d10e573c4..b443707bbae 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:14:11 + --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:4:11 | LL | fn foo(mut y: Ref, x: &u32) { | --- ---- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs index 474da4a7d16..02838362c80 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } fn foo(mut y: Ref, x: &u32) { diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr index 08913299520..77d43cd17c8 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14:11 + --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:4:11 | LL | fn foo(mut y: Ref, x: &u32) { | --- ---- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs index 1ffaec7ba00..7c827510be8 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Ref<'a, 'b> { a: &'a u32, b: &'b u32, diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr index 133611ae489..eef3aa50e0f 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-one-is-struct.rs:17:11 + --> $DIR/ex3-both-anon-regions-one-is-struct.rs:7:11 | LL | fn foo(mut x: Ref, y: &u32) { | --- ---- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs index 97af3598010..09852403d93 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { field: i32 } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr index 01ea885b63e..917b90fd47f 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5 + --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:7:5 | LL | fn foo<'a>(&self, x: &i32) -> &i32 { | ---- ---- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs index e6f4f0966ca..33aa199938f 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { field: i32, } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr index aa5ab540295..a2ba41ef4f0 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-self-is-anon.rs:17:19 + --> $DIR/ex3-both-anon-regions-self-is-anon.rs:7:19 | LL | fn foo<'a>(&self, x: &Foo) -> &Foo { | ---- ---- diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs index db53acf5afc..f9f1a75df58 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { y.push(z); //~ ERROR lifetime mismatch } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr index 8a9ee9a05b8..43e54d64085 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-using-fn-items.rs:11:10 + --> $DIR/ex3-both-anon-regions-using-fn-items.rs:2:10 | LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs index b3ef06f1898..6f95d5a710d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. trait Foo { fn foo<'a>(x: &mut Vec<&u8>, y: &u8); } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr index 65c9ea4e757..39896a3c8a0 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-using-impl-items.rs:15:16 + --> $DIR/ex3-both-anon-regions-using-impl-items.rs:6:16 | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs index ebde6a3b53f..324a5846c94 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. fn foo(x:Box , y: Vec<&u8>, z: &u8) { y.push(z); //~ ERROR lifetime mismatch } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr index 43ca5cd603f..46eca5ea64f 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:11:10 + --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:2:10 | LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.rs index f88eca494eb..44195dadbb9 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.rs +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(x: &mut Vec<&u8>, y: &u8) { x.push(y); //~ ERROR lifetime mismatch } diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr index 57187a47239..07d6cafd633 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions.rs:12:12 + --> $DIR/ex3-both-anon-regions.rs:2:12 | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { | --- --- these two types are declared with different lifetimes... diff --git a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs index 6b0ca2ce9e0..99949e17b6f 100644 --- a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs +++ b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // FIXME: Change to UI Test // Check notes are placed on an assignment that can actually precede the current assignment // Don't emit a first assignment for assignment in a loop. diff --git a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr index fd3ae53d6ed..f66bd3b35f7 100644 --- a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `x` (Ast) - --> $DIR/liveness-assign-imm-local-notes.rs:23:9 + --> $DIR/liveness-assign-imm-local-notes.rs:13:9 | LL | x = 2; | ----- first assignment to `x` @@ -7,7 +7,7 @@ LL | x = 3; //~ ERROR (Ast) [E0384] | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Ast) - --> $DIR/liveness-assign-imm-local-notes.rs:35:13 + --> $DIR/liveness-assign-imm-local-notes.rs:25:13 | LL | x = 2; | ----- first assignment to `x` @@ -15,13 +15,13 @@ LL | x = 3; //~ ERROR (Ast) [E0384] | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Ast) - --> $DIR/liveness-assign-imm-local-notes.rs:45:13 + --> $DIR/liveness-assign-imm-local-notes.rs:35:13 | LL | x = 1; //~ ERROR (Ast) [E0384] | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Ast) - --> $DIR/liveness-assign-imm-local-notes.rs:48:13 + --> $DIR/liveness-assign-imm-local-notes.rs:38:13 | LL | x = 1; //~ ERROR (Ast) [E0384] | ----- first assignment to `x` @@ -30,7 +30,7 @@ LL | x = 2; //~ ERROR (Ast) [E0384] | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) - --> $DIR/liveness-assign-imm-local-notes.rs:23:9 + --> $DIR/liveness-assign-imm-local-notes.rs:13:9 | LL | let x; | - help: make this binding mutable: `mut x` @@ -41,7 +41,7 @@ LL | x = 3; //~ ERROR (Ast) [E0384] | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) - --> $DIR/liveness-assign-imm-local-notes.rs:35:13 + --> $DIR/liveness-assign-imm-local-notes.rs:25:13 | LL | let x; | - help: make this binding mutable: `mut x` @@ -52,7 +52,7 @@ LL | x = 3; //~ ERROR (Ast) [E0384] | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) - --> $DIR/liveness-assign-imm-local-notes.rs:45:13 + --> $DIR/liveness-assign-imm-local-notes.rs:35:13 | LL | let x; | - help: make this binding mutable: `mut x` @@ -61,7 +61,7 @@ LL | x = 1; //~ ERROR (Ast) [E0384] | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) - --> $DIR/liveness-assign-imm-local-notes.rs:48:13 + --> $DIR/liveness-assign-imm-local-notes.rs:38:13 | LL | let x; | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/lifetimes/lifetime-no-keyword.rs b/src/test/ui/lifetimes/lifetime-no-keyword.rs index d583c4fc6c6..f466f44f5a5 100644 --- a/src/test/ui/lifetimes/lifetime-no-keyword.rs +++ b/src/test/ui/lifetimes/lifetime-no-keyword.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo<'a>(a: &'a isize) { } fn bar(a: &'static isize) { } fn baz<'let>(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names diff --git a/src/test/ui/lifetimes/lifetime-no-keyword.stderr b/src/test/ui/lifetimes/lifetime-no-keyword.stderr index 1dcbe336c69..912befff01c 100644 --- a/src/test/ui/lifetimes/lifetime-no-keyword.stderr +++ b/src/test/ui/lifetimes/lifetime-no-keyword.stderr @@ -1,23 +1,23 @@ error: lifetimes cannot use keyword names - --> $DIR/lifetime-no-keyword.rs:13:8 + --> $DIR/lifetime-no-keyword.rs:3:8 | LL | fn baz<'let>(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names | ^^^^ error: lifetimes cannot use keyword names - --> $DIR/lifetime-no-keyword.rs:13:18 + --> $DIR/lifetime-no-keyword.rs:3:18 | LL | fn baz<'let>(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names | ^^^^ error: lifetimes cannot use keyword names - --> $DIR/lifetime-no-keyword.rs:15:8 + --> $DIR/lifetime-no-keyword.rs:5:8 | LL | fn zab<'self>(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names | ^^^^^ error: lifetimes cannot use keyword names - --> $DIR/lifetime-no-keyword.rs:15:19 + --> $DIR/lifetime-no-keyword.rs:5:19 | LL | fn zab<'self>(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names | ^^^^^ diff --git a/src/test/ui/linkage2.rs b/src/test/ui/linkage2.rs index afae4a451d6..6d1410a90bd 100644 --- a/src/test/ui/linkage2.rs +++ b/src/test/ui/linkage2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(linkage)] extern { diff --git a/src/test/ui/linkage2.stderr b/src/test/ui/linkage2.stderr index d9edac160da..64213f1270a 100644 --- a/src/test/ui/linkage2.stderr +++ b/src/test/ui/linkage2.stderr @@ -1,5 +1,5 @@ error: must have type `*const T` or `*mut T` - --> $DIR/linkage2.rs:14:32 + --> $DIR/linkage2.rs:4:32 | LL | #[linkage = "extern_weak"] static foo: i32; | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/linkage3.rs b/src/test/ui/linkage3.rs index c222989ed66..f094a0d53e9 100644 --- a/src/test/ui/linkage3.rs +++ b/src/test/ui/linkage3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(linkage)] extern { diff --git a/src/test/ui/linkage3.stderr b/src/test/ui/linkage3.stderr index 3429ced8ce4..a03593ff2c6 100644 --- a/src/test/ui/linkage3.stderr +++ b/src/test/ui/linkage3.stderr @@ -1,5 +1,5 @@ error: invalid linkage specified - --> $DIR/linkage3.rs:14:24 + --> $DIR/linkage3.rs:4:24 | LL | #[linkage = "foo"] static foo: *const i32; | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/linkage4.rs b/src/test/ui/linkage4.rs index 1cf6e90d6c8..3b935f9723d 100644 --- a/src/test/ui/linkage4.rs +++ b/src/test/ui/linkage4.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[linkage = "external"] static foo: isize = 0; //~^^ ERROR: the `linkage` attribute is experimental and not portable diff --git a/src/test/ui/linkage4.stderr b/src/test/ui/linkage4.stderr index c04f88d37a5..fd86671204e 100644 --- a/src/test/ui/linkage4.stderr +++ b/src/test/ui/linkage4.stderr @@ -1,5 +1,5 @@ error[E0658]: the `linkage` attribute is experimental and not portable across platforms (see issue #29603) - --> $DIR/linkage4.rs:11:1 + --> $DIR/linkage4.rs:1:1 | LL | #[linkage = "external"] | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/auxiliary/inherited_stability.rs b/src/test/ui/lint/auxiliary/inherited_stability.rs index f690cbd029d..57af0d3ec9c 100644 --- a/src/test/ui/lint/auxiliary/inherited_stability.rs +++ b/src/test/ui/lint/auxiliary/inherited_stability.rs @@ -1,12 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![crate_name="inherited_stability"] #![crate_type = "lib"] #![unstable(feature = "unstable_test_feature", issue = "0")] diff --git a/src/test/ui/lint/auxiliary/lint_output_format.rs b/src/test/ui/lint/auxiliary/lint_output_format.rs index 6ba66f3e45f..5facb556122 100644 --- a/src/test/ui/lint/auxiliary/lint_output_format.rs +++ b/src/test/ui/lint/auxiliary/lint_output_format.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="lint_output_format"] #![crate_type = "lib"] #![feature(staged_api)] diff --git a/src/test/ui/lint/auxiliary/lint_stability.rs b/src/test/ui/lint/auxiliary/lint_stability.rs index 5547458abbe..3188d706ab0 100644 --- a/src/test/ui/lint/auxiliary/lint_stability.rs +++ b/src/test/ui/lint/auxiliary/lint_stability.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="lint_stability"] #![crate_type = "lib"] #![feature(staged_api)] diff --git a/src/test/ui/lint/auxiliary/lint_stability_fields.rs b/src/test/ui/lint/auxiliary/lint_stability_fields.rs index 6b79c36fc05..2787da7cb71 100644 --- a/src/test/ui/lint/auxiliary/lint_stability_fields.rs +++ b/src/test/ui/lint/auxiliary/lint_stability_fields.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(staged_api)] #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/test/ui/lint/auxiliary/lint_unused_extern_crate.rs b/src/test/ui/lint/auxiliary/lint_unused_extern_crate.rs index 2661b1f4eb4..b76b4321d62 100644 --- a/src/test/ui/lint/auxiliary/lint_unused_extern_crate.rs +++ b/src/test/ui/lint/auxiliary/lint_unused_extern_crate.rs @@ -1,11 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} diff --git a/src/test/ui/lint/auxiliary/lint_unused_extern_crate2.rs b/src/test/ui/lint/auxiliary/lint_unused_extern_crate2.rs index b61667cfd88..b76b4321d62 100644 --- a/src/test/ui/lint/auxiliary/lint_unused_extern_crate2.rs +++ b/src/test/ui/lint/auxiliary/lint_unused_extern_crate2.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} diff --git a/src/test/ui/lint/auxiliary/lint_unused_extern_crate3.rs b/src/test/ui/lint/auxiliary/lint_unused_extern_crate3.rs index b61667cfd88..b76b4321d62 100644 --- a/src/test/ui/lint/auxiliary/lint_unused_extern_crate3.rs +++ b/src/test/ui/lint/auxiliary/lint_unused_extern_crate3.rs @@ -1,11 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} diff --git a/src/test/ui/lint/auxiliary/lint_unused_extern_crate4.rs b/src/test/ui/lint/auxiliary/lint_unused_extern_crate4.rs index fc4bca865c9..d11c69f812a 100644 --- a/src/test/ui/lint/auxiliary/lint_unused_extern_crate4.rs +++ b/src/test/ui/lint/auxiliary/lint_unused_extern_crate4.rs @@ -1,9 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// intentionally empty diff --git a/src/test/ui/lint/auxiliary/lint_unused_extern_crate5.rs b/src/test/ui/lint/auxiliary/lint_unused_extern_crate5.rs index fc4bca865c9..d11c69f812a 100644 --- a/src/test/ui/lint/auxiliary/lint_unused_extern_crate5.rs +++ b/src/test/ui/lint/auxiliary/lint_unused_extern_crate5.rs @@ -1,9 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// intentionally empty diff --git a/src/test/ui/lint/auxiliary/lints-in-foreign-macros.rs b/src/test/ui/lint/auxiliary/lints-in-foreign-macros.rs index cf8e9c18de3..b969d9dbaa3 100644 --- a/src/test/ui/lint/auxiliary/lints-in-foreign-macros.rs +++ b/src/test/ui/lint/auxiliary/lints-in-foreign-macros.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! bar { () => {use std::string::ToString;} diff --git a/src/test/ui/lint/auxiliary/stability_cfg1.rs b/src/test/ui/lint/auxiliary/stability_cfg1.rs index c839993b047..2e027cc272f 100644 --- a/src/test/ui/lint/auxiliary/stability_cfg1.rs +++ b/src/test/ui/lint/auxiliary/stability_cfg1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![cfg_attr(foo, experimental)] #![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))] #![feature(staged_api)] diff --git a/src/test/ui/lint/auxiliary/stability_cfg2.rs b/src/test/ui/lint/auxiliary/stability_cfg2.rs index a59f4b4e8f4..8a2899584b9 100644 --- a/src/test/ui/lint/auxiliary/stability_cfg2.rs +++ b/src/test/ui/lint/auxiliary/stability_cfg2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:--cfg foo #![cfg_attr(foo, unstable(feature = "unstable_test_feature", issue = "0"))] diff --git a/src/test/ui/lint/command-line-lint-group-allow.rs b/src/test/ui/lint/command-line-lint-group-allow.rs index 4e12067f994..ac98724d037 100644 --- a/src/test/ui/lint/command-line-lint-group-allow.rs +++ b/src/test/ui/lint/command-line-lint-group-allow.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -A bad-style // compile-pass diff --git a/src/test/ui/lint/command-line-lint-group-deny.rs b/src/test/ui/lint/command-line-lint-group-deny.rs index 6ffc9b5aa17..da999f33e20 100644 --- a/src/test/ui/lint/command-line-lint-group-deny.rs +++ b/src/test/ui/lint/command-line-lint-group-deny.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -D bad-style fn main() { diff --git a/src/test/ui/lint/command-line-lint-group-deny.stderr b/src/test/ui/lint/command-line-lint-group-deny.stderr index 45a20434dd2..3250a41ee0e 100644 --- a/src/test/ui/lint/command-line-lint-group-deny.stderr +++ b/src/test/ui/lint/command-line-lint-group-deny.stderr @@ -1,8 +1,8 @@ -error: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing` - --> $DIR/command-line-lint-group-deny.rs:14:9 +error: variable `_InappropriateCamelCasing` should have a snake case name + --> $DIR/command-line-lint-group-deny.rs:4:9 | LL | let _InappropriateCamelCasing = true; //~ ERROR should have a snake - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing` | = note: `-D non-snake-case` implied by `-D bad-style` diff --git a/src/test/ui/lint/command-line-lint-group-forbid.rs b/src/test/ui/lint/command-line-lint-group-forbid.rs index eb4645a4fc8..4e5c2aca5e0 100644 --- a/src/test/ui/lint/command-line-lint-group-forbid.rs +++ b/src/test/ui/lint/command-line-lint-group-forbid.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -F bad-style fn main() { diff --git a/src/test/ui/lint/command-line-lint-group-forbid.stderr b/src/test/ui/lint/command-line-lint-group-forbid.stderr index 1fe51c62786..39f6da400c4 100644 --- a/src/test/ui/lint/command-line-lint-group-forbid.stderr +++ b/src/test/ui/lint/command-line-lint-group-forbid.stderr @@ -1,8 +1,8 @@ -error: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing` - --> $DIR/command-line-lint-group-forbid.rs:14:9 +error: variable `_InappropriateCamelCasing` should have a snake case name + --> $DIR/command-line-lint-group-forbid.rs:4:9 | LL | let _InappropriateCamelCasing = true; //~ ERROR should have a snake - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing` | = note: `-F non-snake-case` implied by `-F bad-style` diff --git a/src/test/ui/lint/command-line-lint-group-warn.rs b/src/test/ui/lint/command-line-lint-group-warn.rs index 76cee225b7c..73dd656f60c 100644 --- a/src/test/ui/lint/command-line-lint-group-warn.rs +++ b/src/test/ui/lint/command-line-lint-group-warn.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -W bad-style // compile-pass diff --git a/src/test/ui/lint/command-line-lint-group-warn.stderr b/src/test/ui/lint/command-line-lint-group-warn.stderr index e4628509635..42a198fe7e3 100644 --- a/src/test/ui/lint/command-line-lint-group-warn.stderr +++ b/src/test/ui/lint/command-line-lint-group-warn.stderr @@ -1,8 +1,8 @@ -warning: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing` - --> $DIR/command-line-lint-group-warn.rs:15:9 +warning: variable `_InappropriateCamelCasing` should have a snake case name + --> $DIR/command-line-lint-group-warn.rs:5:9 | LL | let _InappropriateCamelCasing = true; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing` | = note: `-W non-snake-case` implied by `-W bad-style` diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.fixed b/src/test/ui/lint/inclusive-range-pattern-syntax.fixed index f0aee8a51f1..d52c651ce38 100644 --- a/src/test/ui/lint/inclusive-range-pattern-syntax.fixed +++ b/src/test/ui/lint/inclusive-range-pattern-syntax.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // run-rustfix diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.rs b/src/test/ui/lint/inclusive-range-pattern-syntax.rs index 97bc04faa77..5174a8b8b7e 100644 --- a/src/test/ui/lint/inclusive-range-pattern-syntax.rs +++ b/src/test/ui/lint/inclusive-range-pattern-syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // run-rustfix diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.stderr b/src/test/ui/lint/inclusive-range-pattern-syntax.stderr index b13afdbc023..7ad92a4bc5e 100644 --- a/src/test/ui/lint/inclusive-range-pattern-syntax.stderr +++ b/src/test/ui/lint/inclusive-range-pattern-syntax.stderr @@ -1,17 +1,17 @@ warning: `...` range patterns are deprecated - --> $DIR/inclusive-range-pattern-syntax.rs:19:10 + --> $DIR/inclusive-range-pattern-syntax.rs:9:10 | LL | 1...2 => {} | ^^^ help: use `..=` for an inclusive range | note: lint level defined here - --> $DIR/inclusive-range-pattern-syntax.rs:14:9 + --> $DIR/inclusive-range-pattern-syntax.rs:4:9 | LL | #![warn(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `...` range patterns are deprecated - --> $DIR/inclusive-range-pattern-syntax.rs:25:9 + --> $DIR/inclusive-range-pattern-syntax.rs:15:9 | LL | &1...2 => {} | ^^^^^^ help: use `..=` for an inclusive range: `&(1..=2)` diff --git a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs index bac3f00ffc7..7d3fd441ae5 100644 --- a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs +++ b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(box_syntax)] diff --git a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr index a8b0e3e4250..8fd98e0a3db 100644 --- a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr +++ b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr @@ -1,42 +1,42 @@ warning: unused variable: `i_think_continually` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:36:9 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:26:9 | LL | let i_think_continually = 2; - | ^^^^^^^^^^^^^^^^^^^ help: consider using `_i_think_continually` instead + | ^^^^^^^^^^^^^^^^^^^ help: consider prefixing with an underscore: `_i_think_continually` | note: lint level defined here - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:15:9 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:5:9 | LL | #![warn(unused)] // UI tests pass `-A unused` (#43896) | ^^^^^^ = note: #[warn(unused_variables)] implied by #[warn(unused)] warning: unused variable: `mut_unused_var` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:43:13 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:33:13 | LL | let mut mut_unused_var = 1; - | ^^^^^^^^^^^^^^ help: consider using `_mut_unused_var` instead + | ^^^^^^^^^^^^^^ help: consider prefixing with an underscore: `_mut_unused_var` warning: unused variable: `var` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:45:14 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:35:14 | LL | let (mut var, unused_var) = (1, 2); - | ^^^ help: consider using `_var` instead + | ^^^ help: consider prefixing with an underscore: `_var` warning: unused variable: `unused_var` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:45:19 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:35:19 | LL | let (mut var, unused_var) = (1, 2); - | ^^^^^^^^^^ help: consider using `_unused_var` instead + | ^^^^^^^^^^ help: consider prefixing with an underscore: `_unused_var` warning: unused variable: `corridors_of_light` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:47:26 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:26 | LL | if let SoulHistory { corridors_of_light, | ^^^^^^^^^^^^^^^^^^ help: try ignoring the field: `corridors_of_light: _` warning: variable `hours_are_suns` is assigned to, but never used - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:48:30 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:38:30 | LL | mut hours_are_suns, | ^^^^^^^^^^^^^^ @@ -44,62 +44,63 @@ LL | mut hours_are_suns, = note: consider using `_hours_are_suns` instead warning: value assigned to `hours_are_suns` is never read - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:50:9 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:40:9 | LL | hours_are_suns = false; | ^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:15:9 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:5:9 | LL | #![warn(unused)] // UI tests pass `-A unused` (#43896) | ^^^^^^ = note: #[warn(unused_assignments)] implied by #[warn(unused)] + = help: maybe it is overwritten before being read? warning: unused variable: `fire` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:54:32 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:44:32 | LL | let LovelyAmbition { lips, fire } = the_spirit; | ^^^^ help: try ignoring the field: `fire: _` warning: unused variable: `case` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:63:23 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:53:23 | LL | Large::Suit { case } => {} | ^^^^ help: try ignoring the field: `case: _` warning: unused variable: `case` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:68:24 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:58:24 | LL | &Large::Suit { case } => {} | ^^^^ help: try ignoring the field: `case: _` warning: unused variable: `case` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:73:27 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:63:27 | LL | box Large::Suit { case } => {} | ^^^^ help: try ignoring the field: `case: _` warning: unused variable: `case` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:78:24 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:68:24 | LL | (Large::Suit { case },) => {} | ^^^^ help: try ignoring the field: `case: _` warning: unused variable: `case` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:83:24 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:73:24 | LL | [Large::Suit { case }] => {} | ^^^^ help: try ignoring the field: `case: _` warning: unused variable: `case` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:88:29 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:78:29 | LL | Tuple(Large::Suit { case }, ()) => {} | ^^^^ help: try ignoring the field: `case: _` warning: variable does not need to be mutable - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:43:9 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:33:9 | LL | let mut mut_unused_var = 1; | ----^^^^^^^^^^^^^^ @@ -107,14 +108,14 @@ LL | let mut mut_unused_var = 1; | help: remove this `mut` | note: lint level defined here - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:15:9 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:5:9 | LL | #![warn(unused)] // UI tests pass `-A unused` (#43896) | ^^^^^^ = note: #[warn(unused_mut)] implied by #[warn(unused)] warning: variable does not need to be mutable - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:45:10 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:35:10 | LL | let (mut var, unused_var) = (1, 2); | ----^^^ diff --git a/src/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs b/src/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs index 7f623727aac..8872c0047fd 100644 --- a/src/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs +++ b/src/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![warn(unused_parens)] diff --git a/src/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.stderr b/src/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.stderr index ac5df471c55..57cdcd70e9d 100644 --- a/src/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.stderr +++ b/src/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.stderr @@ -1,5 +1,5 @@ warning: unnecessary parentheses around function argument - --> $DIR/issue-47775-nested-macro-unnecessary-parens-arg.rs:32:83 + --> $DIR/issue-47775-nested-macro-unnecessary-parens-arg.rs:22:83 | LL | #[allow(dead_code)] fn the_night_for_the_morrow() -> Option { Some((2)) } | ^^^ help: remove these parentheses @@ -8,7 +8,7 @@ LL | and_the_heavens_reject_not!(); | ------------------------------ in this macro invocation | note: lint level defined here - --> $DIR/issue-47775-nested-macro-unnecessary-parens-arg.rs:13:9 + --> $DIR/issue-47775-nested-macro-unnecessary-parens-arg.rs:3:9 | LL | #![warn(unused_parens)] | ^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/issue-54538-unused-parens-lint.rs b/src/test/ui/lint/issue-54538-unused-parens-lint.rs index 97a2dd59a62..6ca53816e3c 100644 --- a/src/test/ui/lint/issue-54538-unused-parens-lint.rs +++ b/src/test/ui/lint/issue-54538-unused-parens-lint.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unreachable_patterns)] diff --git a/src/test/ui/lint/issue-54538-unused-parens-lint.stderr b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr index b76b969fd2b..fd55ffbdf43 100644 --- a/src/test/ui/lint/issue-54538-unused-parens-lint.stderr +++ b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr @@ -1,41 +1,41 @@ warning: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:19:9 + --> $DIR/issue-54538-unused-parens-lint.rs:9:9 | LL | (_) => {} //~ WARNING: unnecessary parentheses around pattern | ^^^ help: remove these parentheses | note: lint level defined here - --> $DIR/issue-54538-unused-parens-lint.rs:15:9 + --> $DIR/issue-54538-unused-parens-lint.rs:5:9 | LL | #![warn(unused_parens)] | ^^^^^^^^^^^^^ warning: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:20:9 + --> $DIR/issue-54538-unused-parens-lint.rs:10:9 | LL | (y) => {} //~ WARNING: unnecessary parentheses around pattern | ^^^ help: remove these parentheses warning: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:21:9 + --> $DIR/issue-54538-unused-parens-lint.rs:11:9 | LL | (ref r) => {} //~ WARNING: unnecessary parentheses around pattern | ^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:22:9 + --> $DIR/issue-54538-unused-parens-lint.rs:12:9 | LL | (e @ 1..=2) => {} //~ WARNING: unnecessary parentheses around outer pattern | ^^^^^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:28:9 + --> $DIR/issue-54538-unused-parens-lint.rs:18:9 | LL | (e @ &(1...2)) => {} //~ WARNING: unnecessary parentheses around outer pattern | ^^^^^^^^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around pattern - --> $DIR/issue-54538-unused-parens-lint.rs:29:10 + --> $DIR/issue-54538-unused-parens-lint.rs:19:10 | LL | &(_) => {} //~ WARNING: unnecessary parentheses around pattern | ^^^ help: remove these parentheses diff --git a/src/test/ui/lint/lint-attr-non-item-node.rs b/src/test/ui/lint/lint-attr-non-item-node.rs index 930f69e51e1..3f05e83a77d 100644 --- a/src/test/ui/lint/lint-attr-non-item-node.rs +++ b/src/test/ui/lint/lint-attr-non-item-node.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks that lint attributes work on non-item AST nodes fn main() { diff --git a/src/test/ui/lint/lint-attr-non-item-node.stderr b/src/test/ui/lint/lint-attr-non-item-node.stderr index 33d096c5bcf..2c95831f375 100644 --- a/src/test/ui/lint/lint-attr-non-item-node.stderr +++ b/src/test/ui/lint/lint-attr-non-item-node.stderr @@ -1,11 +1,11 @@ error: unreachable statement - --> $DIR/lint-attr-non-item-node.rs:17:9 + --> $DIR/lint-attr-non-item-node.rs:7:9 | LL | "unreachable"; //~ ERROR unreachable statement | ^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-attr-non-item-node.rs:14:12 + --> $DIR/lint-attr-non-item-node.rs:4:12 | LL | #[deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-change-warnings.rs b/src/test/ui/lint/lint-change-warnings.rs index 19e253e3b8e..37af3b7612c 100644 --- a/src/test/ui/lint/lint-change-warnings.rs +++ b/src/test/ui/lint/lint-change-warnings.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(warnings)] #![allow(dead_code)] diff --git a/src/test/ui/lint/lint-change-warnings.stderr b/src/test/ui/lint/lint-change-warnings.stderr index 353802f5c28..7d7a066613a 100644 --- a/src/test/ui/lint/lint-change-warnings.stderr +++ b/src/test/ui/lint/lint-change-warnings.stderr @@ -1,18 +1,18 @@ error: denote infinite loops with `loop { ... }` - --> $DIR/lint-change-warnings.rs:15:5 + --> $DIR/lint-change-warnings.rs:5:5 | LL | while true {} //~ ERROR: infinite | ^^^^^^^^^^ help: use `loop` | note: lint level defined here - --> $DIR/lint-change-warnings.rs:11:9 + --> $DIR/lint-change-warnings.rs:1:9 | LL | #![deny(warnings)] | ^^^^^^^^ = note: #[deny(while_true)] implied by #[deny(warnings)] warning: denote infinite loops with `loop { ... }` - --> $DIR/lint-change-warnings.rs:25:5 + --> $DIR/lint-change-warnings.rs:15:5 | LL | while true {} //~ WARNING: infinite | ^^^^^^^^^^ help: use `loop` @@ -20,13 +20,13 @@ LL | while true {} //~ WARNING: infinite = note: #[warn(while_true)] on by default error: denote infinite loops with `loop { ... }` - --> $DIR/lint-change-warnings.rs:30:5 + --> $DIR/lint-change-warnings.rs:20:5 | LL | while true {} //~ ERROR: infinite | ^^^^^^^^^^ help: use `loop` | note: lint level defined here - --> $DIR/lint-change-warnings.rs:28:10 + --> $DIR/lint-change-warnings.rs:18:10 | LL | #[forbid(warnings)] | ^^^^^^^^ diff --git a/src/test/ui/lint/lint-ctypes-enum.rs b/src/test/ui/lint/lint-ctypes-enum.rs index 7b7ffd8fc10..f347c2761c3 100644 --- a/src/test/ui/lint/lint-ctypes-enum.rs +++ b/src/test/ui/lint/lint-ctypes-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(improper_ctypes)] #![allow(dead_code)] diff --git a/src/test/ui/lint/lint-ctypes-enum.stderr b/src/test/ui/lint/lint-ctypes-enum.stderr index 9b1c04b2a1d..dd33cc77458 100644 --- a/src/test/ui/lint/lint-ctypes-enum.stderr +++ b/src/test/ui/lint/lint-ctypes-enum.stderr @@ -1,43 +1,43 @@ error: `extern` block uses type `U` which is not FFI-safe: enum has no representation hint - --> $DIR/lint-ctypes-enum.rs:30:13 + --> $DIR/lint-ctypes-enum.rs:20:13 | LL | fn uf(x: U); //~ ERROR enum has no representation hint | ^ | note: lint level defined here - --> $DIR/lint-ctypes-enum.rs:11:9 + --> $DIR/lint-ctypes-enum.rs:1:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ = help: consider adding a #[repr(...)] attribute to this enum note: type defined here - --> $DIR/lint-ctypes-enum.rs:15:1 + --> $DIR/lint-ctypes-enum.rs:5:1 | LL | enum U { A } | ^^^^^^^^^^^^ error: `extern` block uses type `B` which is not FFI-safe: enum has no representation hint - --> $DIR/lint-ctypes-enum.rs:31:13 + --> $DIR/lint-ctypes-enum.rs:21:13 | LL | fn bf(x: B); //~ ERROR enum has no representation hint | ^ | = help: consider adding a #[repr(...)] attribute to this enum note: type defined here - --> $DIR/lint-ctypes-enum.rs:16:1 + --> $DIR/lint-ctypes-enum.rs:6:1 | LL | enum B { C, D } | ^^^^^^^^^^^^^^^ error: `extern` block uses type `T` which is not FFI-safe: enum has no representation hint - --> $DIR/lint-ctypes-enum.rs:32:13 + --> $DIR/lint-ctypes-enum.rs:22:13 | LL | fn tf(x: T); //~ ERROR enum has no representation hint | ^ | = help: consider adding a #[repr(...)] attribute to this enum note: type defined here - --> $DIR/lint-ctypes-enum.rs:17:1 + --> $DIR/lint-ctypes-enum.rs:7:1 | LL | enum T { E, F, G } | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-ctypes.rs b/src/test/ui/lint/lint-ctypes.rs index e09aabaf692..816177abdea 100644 --- a/src/test/ui/lint/lint-ctypes.rs +++ b/src/test/ui/lint/lint-ctypes.rs @@ -1,15 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(improper_ctypes)] -#![feature(libc)] +#![feature(rustc_private)] #![allow(private_in_public)] diff --git a/src/test/ui/lint/lint-ctypes.stderr b/src/test/ui/lint/lint-ctypes.stderr index b243c49316f..51211c87631 100644 --- a/src/test/ui/lint/lint-ctypes.stderr +++ b/src/test/ui/lint/lint-ctypes.stderr @@ -1,36 +1,36 @@ error: `extern` block uses type `Foo` which is not FFI-safe: this struct has unspecified layout - --> $DIR/lint-ctypes.rs:56:28 + --> $DIR/lint-ctypes.rs:46:28 | LL | pub fn ptr_type1(size: *const Foo); //~ ERROR: uses type `Foo` | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-ctypes.rs:11:9 + --> $DIR/lint-ctypes.rs:1:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct note: type defined here - --> $DIR/lint-ctypes.rs:34:1 + --> $DIR/lint-ctypes.rs:24:1 | LL | pub struct Foo; | ^^^^^^^^^^^^^^^ error: `extern` block uses type `Foo` which is not FFI-safe: this struct has unspecified layout - --> $DIR/lint-ctypes.rs:57:28 + --> $DIR/lint-ctypes.rs:47:28 | LL | pub fn ptr_type2(size: *const Foo); //~ ERROR: uses type `Foo` | ^^^^^^^^^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct note: type defined here - --> $DIR/lint-ctypes.rs:34:1 + --> $DIR/lint-ctypes.rs:24:1 | LL | pub struct Foo; | ^^^^^^^^^^^^^^^ error: `extern` block uses type `[u32]` which is not FFI-safe: slices have no C equivalent - --> $DIR/lint-ctypes.rs:58:26 + --> $DIR/lint-ctypes.rs:48:26 | LL | pub fn slice_type(p: &[u32]); //~ ERROR: uses type `[u32]` | ^^^^^^ @@ -38,7 +38,7 @@ LL | pub fn slice_type(p: &[u32]); //~ ERROR: uses type `[u32]` = help: consider using a raw pointer instead error: `extern` block uses type `str` which is not FFI-safe: string slices have no C equivalent - --> $DIR/lint-ctypes.rs:59:24 + --> $DIR/lint-ctypes.rs:49:24 | LL | pub fn str_type(p: &str); //~ ERROR: uses type `str` | ^^^^ @@ -46,7 +46,7 @@ LL | pub fn str_type(p: &str); //~ ERROR: uses type `str` = help: consider using `*const u8` and a length instead error: `extern` block uses type `std::boxed::Box` which is not FFI-safe: this struct has unspecified layout - --> $DIR/lint-ctypes.rs:60:24 + --> $DIR/lint-ctypes.rs:50:24 | LL | pub fn box_type(p: Box); //~ ERROR uses type `std::boxed::Box` | ^^^^^^^^ @@ -54,7 +54,7 @@ LL | pub fn box_type(p: Box); //~ ERROR uses type `std::boxed::Box = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct error: `extern` block uses type `char` which is not FFI-safe: the `char` type has no C equivalent - --> $DIR/lint-ctypes.rs:61:25 + --> $DIR/lint-ctypes.rs:51:25 | LL | pub fn char_type(p: char); //~ ERROR uses type `char` | ^^^^ @@ -62,25 +62,25 @@ LL | pub fn char_type(p: char); //~ ERROR uses type `char` = help: consider using `u32` or `libc::wchar_t` instead error: `extern` block uses type `i128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI - --> $DIR/lint-ctypes.rs:62:25 + --> $DIR/lint-ctypes.rs:52:25 | LL | pub fn i128_type(p: i128); //~ ERROR uses type `i128` | ^^^^ error: `extern` block uses type `u128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI - --> $DIR/lint-ctypes.rs:63:25 + --> $DIR/lint-ctypes.rs:53:25 | LL | pub fn u128_type(p: u128); //~ ERROR uses type `u128` | ^^^^ error: `extern` block uses type `dyn std::clone::Clone` which is not FFI-safe: trait objects have no C equivalent - --> $DIR/lint-ctypes.rs:64:26 + --> $DIR/lint-ctypes.rs:54:26 | LL | pub fn trait_type(p: &Clone); //~ ERROR uses type `dyn std::clone::Clone` | ^^^^^^ error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout - --> $DIR/lint-ctypes.rs:65:26 + --> $DIR/lint-ctypes.rs:55:26 | LL | pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)` | ^^^^^^^^^^ @@ -88,7 +88,7 @@ LL | pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)` = help: consider using a struct instead error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout - --> $DIR/lint-ctypes.rs:66:27 + --> $DIR/lint-ctypes.rs:56:27 | LL | pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)` | ^^^^^^^ @@ -96,32 +96,32 @@ LL | pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)` = help: consider using a struct instead error: `extern` block uses type `ZeroSize` which is not FFI-safe: this struct has no fields - --> $DIR/lint-ctypes.rs:67:25 + --> $DIR/lint-ctypes.rs:57:25 | LL | pub fn zero_size(p: ZeroSize); //~ ERROR struct has no fields | ^^^^^^^^ | = help: consider adding a member to this struct note: type defined here - --> $DIR/lint-ctypes.rs:30:1 + --> $DIR/lint-ctypes.rs:20:1 | LL | pub struct ZeroSize; | ^^^^^^^^^^^^^^^^^^^^ error: `extern` block uses type `ZeroSizeWithPhantomData` which is not FFI-safe: composed only of PhantomData - --> $DIR/lint-ctypes.rs:68:33 + --> $DIR/lint-ctypes.rs:58:33 | LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); //~ ERROR composed only of PhantomData | ^^^^^^^^^^^^^^^^^^^^^^^ error: `extern` block uses type `std::marker::PhantomData` which is not FFI-safe: composed only of PhantomData - --> $DIR/lint-ctypes.rs:70:12 + --> $DIR/lint-ctypes.rs:60:12 | LL | -> ::std::marker::PhantomData; //~ ERROR: composed only of PhantomData | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `extern` block uses type `fn()` which is not FFI-safe: this function pointer has Rust-specific calling convention - --> $DIR/lint-ctypes.rs:71:23 + --> $DIR/lint-ctypes.rs:61:23 | LL | pub fn fn_type(p: RustFn); //~ ERROR function pointer has Rust-specific | ^^^^^^ @@ -129,7 +129,7 @@ LL | pub fn fn_type(p: RustFn); //~ ERROR function pointer has Rust-specific = help: consider using an `extern fn(...) -> ...` function pointer instead error: `extern` block uses type `fn()` which is not FFI-safe: this function pointer has Rust-specific calling convention - --> $DIR/lint-ctypes.rs:72:24 + --> $DIR/lint-ctypes.rs:62:24 | LL | pub fn fn_type2(p: fn()); //~ ERROR function pointer has Rust-specific | ^^^^ @@ -137,7 +137,7 @@ LL | pub fn fn_type2(p: fn()); //~ ERROR function pointer has Rust-specific = help: consider using an `extern fn(...) -> ...` function pointer instead error: `extern` block uses type `std::boxed::Box` which is not FFI-safe: this struct has unspecified layout - --> $DIR/lint-ctypes.rs:73:28 + --> $DIR/lint-ctypes.rs:63:28 | LL | pub fn fn_contained(p: RustBadRet); //~ ERROR: uses type `std::boxed::Box` | ^^^^^^^^^^ @@ -145,13 +145,13 @@ LL | pub fn fn_contained(p: RustBadRet); //~ ERROR: uses type `std::boxed::B = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct error: `extern` block uses type `i128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI - --> $DIR/lint-ctypes.rs:74:32 + --> $DIR/lint-ctypes.rs:64:32 | LL | pub fn transparent_i128(p: TransparentI128); //~ ERROR: uses type `i128` | ^^^^^^^^^^^^^^^ error: `extern` block uses type `str` which is not FFI-safe: string slices have no C equivalent - --> $DIR/lint-ctypes.rs:75:31 + --> $DIR/lint-ctypes.rs:65:31 | LL | pub fn transparent_str(p: TransparentStr); //~ ERROR: uses type `str` | ^^^^^^^^^^^^^^ @@ -159,7 +159,7 @@ LL | pub fn transparent_str(p: TransparentStr); //~ ERROR: uses type `str` = help: consider using `*const u8` and a length instead error: `extern` block uses type `std::boxed::Box` which is not FFI-safe: this struct has unspecified layout - --> $DIR/lint-ctypes.rs:76:30 + --> $DIR/lint-ctypes.rs:66:30 | LL | pub fn transparent_fn(p: TransparentBadFn); //~ ERROR: uses type `std::boxed::Box` | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-dead-code-1.rs b/src/test/ui/lint/lint-dead-code-1.rs index 944d57b5ba8..09977f8df51 100644 --- a/src/test/ui/lint/lint-dead-code-1.rs +++ b/src/test/ui/lint/lint-dead-code-1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] #![allow(unused_variables)] #![allow(non_camel_case_types)] diff --git a/src/test/ui/lint/lint-dead-code-1.stderr b/src/test/ui/lint/lint-dead-code-1.stderr index 9d8e44c25d8..6d0295002f1 100644 --- a/src/test/ui/lint/lint-dead-code-1.stderr +++ b/src/test/ui/lint/lint-dead-code-1.stderr @@ -1,65 +1,65 @@ error: struct is never constructed: `Bar` - --> $DIR/lint-dead-code-1.rs:22:5 + --> $DIR/lint-dead-code-1.rs:12:5 | LL | pub struct Bar; //~ ERROR: struct is never constructed | ^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-dead-code-1.rs:15:9 + --> $DIR/lint-dead-code-1.rs:5:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ error: static item is never used: `priv_static` - --> $DIR/lint-dead-code-1.rs:30:1 + --> $DIR/lint-dead-code-1.rs:20:1 | LL | static priv_static: isize = 0; //~ ERROR: static item is never used | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: constant item is never used: `priv_const` - --> $DIR/lint-dead-code-1.rs:37:1 + --> $DIR/lint-dead-code-1.rs:27:1 | LL | const priv_const: isize = 0; //~ ERROR: constant item is never used | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: struct is never constructed: `PrivStruct` - --> $DIR/lint-dead-code-1.rs:45:1 + --> $DIR/lint-dead-code-1.rs:35:1 | LL | struct PrivStruct; //~ ERROR: struct is never constructed | ^^^^^^^^^^^^^^^^^^ error: enum is never used: `priv_enum` - --> $DIR/lint-dead-code-1.rs:74:1 + --> $DIR/lint-dead-code-1.rs:64:1 | LL | enum priv_enum { foo2, bar2 } //~ ERROR: enum is never used | ^^^^^^^^^^^^^^ error: variant is never constructed: `bar3` - --> $DIR/lint-dead-code-1.rs:77:5 + --> $DIR/lint-dead-code-1.rs:67:5 | LL | bar3 //~ ERROR variant is never constructed | ^^^^ error: function is never used: `priv_fn` - --> $DIR/lint-dead-code-1.rs:98:1 + --> $DIR/lint-dead-code-1.rs:88:1 | LL | fn priv_fn() { //~ ERROR: function is never used | ^^^^^^^^^^^^ error: function is never used: `foo` - --> $DIR/lint-dead-code-1.rs:103:1 + --> $DIR/lint-dead-code-1.rs:93:1 | LL | fn foo() { //~ ERROR: function is never used | ^^^^^^^^ error: function is never used: `bar` - --> $DIR/lint-dead-code-1.rs:108:1 + --> $DIR/lint-dead-code-1.rs:98:1 | LL | fn bar() { //~ ERROR: function is never used | ^^^^^^^^ error: function is never used: `baz` - --> $DIR/lint-dead-code-1.rs:112:1 + --> $DIR/lint-dead-code-1.rs:102:1 | LL | fn baz() -> impl Copy { //~ ERROR: function is never used | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-dead-code-2.rs b/src/test/ui/lint/lint-dead-code-2.rs index 4a0e4f4319e..88db4f88c3f 100644 --- a/src/test/ui/lint/lint-dead-code-2.rs +++ b/src/test/ui/lint/lint-dead-code-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![deny(dead_code)] #![feature(main, start)] diff --git a/src/test/ui/lint/lint-dead-code-2.stderr b/src/test/ui/lint/lint-dead-code-2.stderr index 6e713c84f16..d17149104db 100644 --- a/src/test/ui/lint/lint-dead-code-2.stderr +++ b/src/test/ui/lint/lint-dead-code-2.stderr @@ -1,23 +1,23 @@ error: function is never used: `dead_fn` - --> $DIR/lint-dead-code-2.rs:32:1 + --> $DIR/lint-dead-code-2.rs:22:1 | LL | fn dead_fn() {} //~ ERROR: function is never used | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-dead-code-2.rs:12:9 + --> $DIR/lint-dead-code-2.rs:2:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ error: function is never used: `dead_fn2` - --> $DIR/lint-dead-code-2.rs:35:1 + --> $DIR/lint-dead-code-2.rs:25:1 | LL | fn dead_fn2() {} //~ ERROR: function is never used | ^^^^^^^^^^^^^ error: function is never used: `main` - --> $DIR/lint-dead-code-2.rs:48:1 + --> $DIR/lint-dead-code-2.rs:38:1 | LL | fn main() { //~ ERROR: function is never used | ^^^^^^^^^ diff --git a/src/test/ui/lint/lint-dead-code-3.rs b/src/test/ui/lint/lint-dead-code-3.rs index 112d3630952..00b250f83dd 100644 --- a/src/test/ui/lint/lint-dead-code-3.rs +++ b/src/test/ui/lint/lint-dead-code-3.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(non_camel_case_types)] #![deny(dead_code)] diff --git a/src/test/ui/lint/lint-dead-code-3.stderr b/src/test/ui/lint/lint-dead-code-3.stderr index 994e93e8557..72bcac22de8 100644 --- a/src/test/ui/lint/lint-dead-code-3.stderr +++ b/src/test/ui/lint/lint-dead-code-3.stderr @@ -1,35 +1,35 @@ error: struct is never constructed: `Foo` - --> $DIR/lint-dead-code-3.rs:23:1 + --> $DIR/lint-dead-code-3.rs:13:1 | LL | struct Foo; //~ ERROR: struct is never constructed | ^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-dead-code-3.rs:13:9 + --> $DIR/lint-dead-code-3.rs:3:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ error: method is never used: `foo` - --> $DIR/lint-dead-code-3.rs:25:5 + --> $DIR/lint-dead-code-3.rs:15:5 | LL | fn foo(&self) { //~ ERROR: method is never used | ^^^^^^^^^^^^^ error: function is never used: `bar` - --> $DIR/lint-dead-code-3.rs:30:1 + --> $DIR/lint-dead-code-3.rs:20:1 | LL | fn bar() { //~ ERROR: function is never used | ^^^^^^^^ error: enum is never used: `c_void` - --> $DIR/lint-dead-code-3.rs:69:1 + --> $DIR/lint-dead-code-3.rs:59:1 | LL | enum c_void {} //~ ERROR: enum is never used | ^^^^^^^^^^^ error: foreign function is never used: `free` - --> $DIR/lint-dead-code-3.rs:71:5 + --> $DIR/lint-dead-code-3.rs:61:5 | LL | fn free(p: *const c_void); //~ ERROR: foreign function is never used | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-dead-code-4.rs b/src/test/ui/lint/lint-dead-code-4.rs index 1296cf46e6f..3f4a9e21040 100644 --- a/src/test/ui/lint/lint-dead-code-4.rs +++ b/src/test/ui/lint/lint-dead-code-4.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(non_camel_case_types)] #![deny(dead_code)] diff --git a/src/test/ui/lint/lint-dead-code-4.stderr b/src/test/ui/lint/lint-dead-code-4.stderr index fce2cf76898..62de048d5e9 100644 --- a/src/test/ui/lint/lint-dead-code-4.stderr +++ b/src/test/ui/lint/lint-dead-code-4.stderr @@ -1,23 +1,23 @@ error: field is never used: `b` - --> $DIR/lint-dead-code-4.rs:17:5 + --> $DIR/lint-dead-code-4.rs:7:5 | LL | b: bool, //~ ERROR: field is never used | ^^^^^^^ | note: lint level defined here - --> $DIR/lint-dead-code-4.rs:13:9 + --> $DIR/lint-dead-code-4.rs:3:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ error: variant is never constructed: `X` - --> $DIR/lint-dead-code-4.rs:25:5 + --> $DIR/lint-dead-code-4.rs:15:5 | LL | X, //~ ERROR variant is never constructed | ^ error: variant is never constructed: `Y` - --> $DIR/lint-dead-code-4.rs:26:5 + --> $DIR/lint-dead-code-4.rs:16:5 | LL | / Y { //~ ERROR variant is never constructed LL | | a: String, @@ -27,43 +27,43 @@ LL | | }, | |_____^ error: enum is never used: `ABC` - --> $DIR/lint-dead-code-4.rs:34:1 + --> $DIR/lint-dead-code-4.rs:24:1 | LL | enum ABC { //~ ERROR enum is never used | ^^^^^^^^ error: variant is never constructed: `I` - --> $DIR/lint-dead-code-4.rs:46:5 + --> $DIR/lint-dead-code-4.rs:36:5 | LL | I, //~ ERROR variant is never constructed | ^ error: field is never used: `b` - --> $DIR/lint-dead-code-4.rs:49:9 + --> $DIR/lint-dead-code-4.rs:39:9 | LL | b: i32, //~ ERROR field is never used | ^^^^^^ error: field is never used: `c` - --> $DIR/lint-dead-code-4.rs:50:9 + --> $DIR/lint-dead-code-4.rs:40:9 | LL | c: i32, //~ ERROR field is never used | ^^^^^^ error: variant is never constructed: `K` - --> $DIR/lint-dead-code-4.rs:52:5 + --> $DIR/lint-dead-code-4.rs:42:5 | LL | K //~ ERROR variant is never constructed | ^ error: field is never used: `x` - --> $DIR/lint-dead-code-4.rs:71:5 + --> $DIR/lint-dead-code-4.rs:61:5 | LL | x: usize, //~ ERROR: field is never used | ^^^^^^^^ error: field is never used: `c` - --> $DIR/lint-dead-code-4.rs:73:5 + --> $DIR/lint-dead-code-4.rs:63:5 | LL | c: bool, //~ ERROR: field is never used | ^^^^^^^ diff --git a/src/test/ui/lint/lint-dead-code-5.rs b/src/test/ui/lint/lint-dead-code-5.rs index ee5cf24823d..764a23e4e49 100644 --- a/src/test/ui/lint/lint-dead-code-5.rs +++ b/src/test/ui/lint/lint-dead-code-5.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![deny(dead_code)] diff --git a/src/test/ui/lint/lint-dead-code-5.stderr b/src/test/ui/lint/lint-dead-code-5.stderr index 37ca0f479f5..e6c2354783a 100644 --- a/src/test/ui/lint/lint-dead-code-5.stderr +++ b/src/test/ui/lint/lint-dead-code-5.stderr @@ -1,29 +1,29 @@ error: variant is never constructed: `Variant2` - --> $DIR/lint-dead-code-5.rs:16:5 + --> $DIR/lint-dead-code-5.rs:6:5 | LL | Variant2 //~ ERROR: variant is never constructed | ^^^^^^^^ | note: lint level defined here - --> $DIR/lint-dead-code-5.rs:12:9 + --> $DIR/lint-dead-code-5.rs:2:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ error: variant is never constructed: `Variant5` - --> $DIR/lint-dead-code-5.rs:23:5 + --> $DIR/lint-dead-code-5.rs:13:5 | LL | Variant5 { _x: isize }, //~ ERROR: variant is never constructed: `Variant5` | ^^^^^^^^^^^^^^^^^^^^^^ error: variant is never constructed: `Variant6` - --> $DIR/lint-dead-code-5.rs:24:5 + --> $DIR/lint-dead-code-5.rs:14:5 | LL | Variant6(isize), //~ ERROR: variant is never constructed: `Variant6` | ^^^^^^^^^^^^^^^ error: enum is never used: `Enum3` - --> $DIR/lint-dead-code-5.rs:28:1 + --> $DIR/lint-dead-code-5.rs:18:1 | LL | enum Enum3 { //~ ERROR: enum is never used | ^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-dead-code-type-alias.rs b/src/test/ui/lint/lint-dead-code-type-alias.rs index aaa01aa6bbe..86daf3ea04d 100644 --- a/src/test/ui/lint/lint-dead-code-type-alias.rs +++ b/src/test/ui/lint/lint-dead-code-type-alias.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(dead_code)] type Used = u8; diff --git a/src/test/ui/lint/lint-dead-code-type-alias.stderr b/src/test/ui/lint/lint-dead-code-type-alias.stderr index bd11e64c781..a4d4727be7c 100644 --- a/src/test/ui/lint/lint-dead-code-type-alias.stderr +++ b/src/test/ui/lint/lint-dead-code-type-alias.stderr @@ -1,11 +1,11 @@ error: type alias is never used: `Unused` - --> $DIR/lint-dead-code-type-alias.rs:14:1 + --> $DIR/lint-dead-code-type-alias.rs:4:1 | LL | type Unused = u8; //~ ERROR type alias is never used | ^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-dead-code-type-alias.rs:11:9 + --> $DIR/lint-dead-code-type-alias.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ diff --git a/src/test/ui/lint/lint-dead-code-variant.rs b/src/test/ui/lint/lint-dead-code-variant.rs index 3301560c315..295ed16d4cf 100644 --- a/src/test/ui/lint/lint-dead-code-variant.rs +++ b/src/test/ui/lint/lint-dead-code-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(dead_code)] #[derive(Clone)] diff --git a/src/test/ui/lint/lint-dead-code-variant.stderr b/src/test/ui/lint/lint-dead-code-variant.stderr index 05b7e35337a..b9465e73b0d 100644 --- a/src/test/ui/lint/lint-dead-code-variant.stderr +++ b/src/test/ui/lint/lint-dead-code-variant.stderr @@ -1,11 +1,11 @@ error: variant is never constructed: `Variant1` - --> $DIR/lint-dead-code-variant.rs:15:5 + --> $DIR/lint-dead-code-variant.rs:5:5 | LL | Variant1, //~ ERROR: variant is never constructed | ^^^^^^^^ | note: lint level defined here - --> $DIR/lint-dead-code-variant.rs:11:9 + --> $DIR/lint-dead-code-variant.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ diff --git a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.rs b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.rs index 18159aec708..e5cb0d3df0e 100644 --- a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.rs +++ b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused_imports)] #![allow(non_upper_case_globals)] diff --git a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr index 2c4602ae20b..170b98a12a8 100644 --- a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr +++ b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr @@ -1,23 +1,23 @@ error: unused import: `a::x` - --> $DIR/lint-directives-on-use-items-issue-10534.rs:22:9 + --> $DIR/lint-directives-on-use-items-issue-10534.rs:12:9 | LL | use a::x; //~ ERROR: unused import | ^^^^ | note: lint level defined here - --> $DIR/lint-directives-on-use-items-issue-10534.rs:11:9 + --> $DIR/lint-directives-on-use-items-issue-10534.rs:1:9 | LL | #![deny(unused_imports)] | ^^^^^^^^^^^^^^ error: unused import: `a::y` - --> $DIR/lint-directives-on-use-items-issue-10534.rs:31:9 + --> $DIR/lint-directives-on-use-items-issue-10534.rs:21:9 | LL | use a::y; //~ ERROR: unused import | ^^^^ | note: lint level defined here - --> $DIR/lint-directives-on-use-items-issue-10534.rs:30:12 + --> $DIR/lint-directives-on-use-items-issue-10534.rs:20:12 | LL | #[deny(unused_imports)] | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.rs b/src/test/ui/lint/lint-exceeding-bitshifts.rs index 5ebfcc4926b..0f397a7efe8 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.rs +++ b/src/test/ui/lint/lint-exceeding-bitshifts.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(exceeding_bitshifts, const_err)] #![allow(unused_variables)] #![allow(dead_code)] diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.stderr index 5124a69195a..be739eb41bd 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.stderr @@ -1,113 +1,113 @@ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:17:15 + --> $DIR/lint-exceeding-bitshifts.rs:7:15 | LL | let n = 1u8 << 8; //~ ERROR: attempt to shift left with overflow | ^^^^^^^^ | note: lint level defined here - --> $DIR/lint-exceeding-bitshifts.rs:11:9 + --> $DIR/lint-exceeding-bitshifts.rs:1:9 | LL | #![deny(exceeding_bitshifts, const_err)] | ^^^^^^^^^^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:19:15 + --> $DIR/lint-exceeding-bitshifts.rs:9:15 | LL | let n = 1u16 << 16; //~ ERROR: attempt to shift left with overflow | ^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:21:15 + --> $DIR/lint-exceeding-bitshifts.rs:11:15 | LL | let n = 1u32 << 32; //~ ERROR: attempt to shift left with overflow | ^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:23:15 + --> $DIR/lint-exceeding-bitshifts.rs:13:15 | LL | let n = 1u64 << 64; //~ ERROR: attempt to shift left with overflow | ^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:25:15 + --> $DIR/lint-exceeding-bitshifts.rs:15:15 | LL | let n = 1i8 << 8; //~ ERROR: attempt to shift left with overflow | ^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:27:15 + --> $DIR/lint-exceeding-bitshifts.rs:17:15 | LL | let n = 1i16 << 16; //~ ERROR: attempt to shift left with overflow | ^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:29:15 + --> $DIR/lint-exceeding-bitshifts.rs:19:15 | LL | let n = 1i32 << 32; //~ ERROR: attempt to shift left with overflow | ^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:31:15 + --> $DIR/lint-exceeding-bitshifts.rs:21:15 | LL | let n = 1i64 << 64; //~ ERROR: attempt to shift left with overflow | ^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:34:15 + --> $DIR/lint-exceeding-bitshifts.rs:24:15 | LL | let n = 1u8 >> 8; //~ ERROR: attempt to shift right with overflow | ^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:36:15 + --> $DIR/lint-exceeding-bitshifts.rs:26:15 | LL | let n = 1u16 >> 16; //~ ERROR: attempt to shift right with overflow | ^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:38:15 + --> $DIR/lint-exceeding-bitshifts.rs:28:15 | LL | let n = 1u32 >> 32; //~ ERROR: attempt to shift right with overflow | ^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:40:15 + --> $DIR/lint-exceeding-bitshifts.rs:30:15 | LL | let n = 1u64 >> 64; //~ ERROR: attempt to shift right with overflow | ^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:42:15 + --> $DIR/lint-exceeding-bitshifts.rs:32:15 | LL | let n = 1i8 >> 8; //~ ERROR: attempt to shift right with overflow | ^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:44:15 + --> $DIR/lint-exceeding-bitshifts.rs:34:15 | LL | let n = 1i16 >> 16; //~ ERROR: attempt to shift right with overflow | ^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:46:15 + --> $DIR/lint-exceeding-bitshifts.rs:36:15 | LL | let n = 1i32 >> 32; //~ ERROR: attempt to shift right with overflow | ^^^^^^^^^^ error: attempt to shift right with overflow - --> $DIR/lint-exceeding-bitshifts.rs:48:15 + --> $DIR/lint-exceeding-bitshifts.rs:38:15 | LL | let n = 1i64 >> 64; //~ ERROR: attempt to shift right with overflow | ^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:52:15 + --> $DIR/lint-exceeding-bitshifts.rs:42:15 | LL | let n = n << 8; //~ ERROR: attempt to shift left with overflow | ^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts.rs:54:15 + --> $DIR/lint-exceeding-bitshifts.rs:44:15 | LL | let n = 1u8 << -8; //~ ERROR: attempt to shift left with overflow | ^^^^^^^^^ diff --git a/src/test/ui/lint/lint-exceeding-bitshifts2.rs b/src/test/ui/lint/lint-exceeding-bitshifts2.rs index 3ba300eb7c4..bde4865aa3f 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts2.rs +++ b/src/test/ui/lint/lint-exceeding-bitshifts2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(exceeding_bitshifts, const_err)] #![allow(unused_variables)] #![allow(dead_code)] diff --git a/src/test/ui/lint/lint-exceeding-bitshifts2.stderr b/src/test/ui/lint/lint-exceeding-bitshifts2.stderr index 17b4235a73f..0adcde02acb 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts2.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts2.stderr @@ -1,23 +1,23 @@ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts2.rs:17:15 + --> $DIR/lint-exceeding-bitshifts2.rs:7:15 | LL | let n = 1u8 << (4+4); //~ ERROR: attempt to shift left with overflow | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-exceeding-bitshifts2.rs:11:9 + --> $DIR/lint-exceeding-bitshifts2.rs:1:9 | LL | #![deny(exceeding_bitshifts, const_err)] | ^^^^^^^^^^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts2.rs:25:15 + --> $DIR/lint-exceeding-bitshifts2.rs:15:15 | LL | let n = 1_isize << BITS; //~ ERROR: attempt to shift left with overflow | ^^^^^^^^^^^^^^^ error: attempt to shift left with overflow - --> $DIR/lint-exceeding-bitshifts2.rs:26:15 + --> $DIR/lint-exceeding-bitshifts2.rs:16:15 | LL | let n = 1_usize << BITS; //~ ERROR: attempt to shift left with overflow | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-forbid-attr.rs b/src/test/ui/lint/lint-forbid-attr.rs index 65e01600c10..082b5430bf4 100644 --- a/src/test/ui/lint/lint-forbid-attr.rs +++ b/src/test/ui/lint/lint-forbid-attr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![forbid(deprecated)] #[allow(deprecated)] diff --git a/src/test/ui/lint/lint-forbid-attr.stderr b/src/test/ui/lint/lint-forbid-attr.stderr index aa0c0c1f5c2..6e1e2b3e147 100644 --- a/src/test/ui/lint/lint-forbid-attr.stderr +++ b/src/test/ui/lint/lint-forbid-attr.stderr @@ -1,5 +1,5 @@ error[E0453]: allow(deprecated) overruled by outer forbid(deprecated) - --> $DIR/lint-forbid-attr.rs:13:9 + --> $DIR/lint-forbid-attr.rs:3:9 | LL | #![forbid(deprecated)] | ---------- `forbid` level set here diff --git a/src/test/ui/lint/lint-forbid-cmdline.rs b/src/test/ui/lint/lint-forbid-cmdline.rs index 6a4d17b33de..150685c3186 100644 --- a/src/test/ui/lint/lint-forbid-cmdline.rs +++ b/src/test/ui/lint/lint-forbid-cmdline.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -F deprecated #[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated) diff --git a/src/test/ui/lint/lint-forbid-cmdline.stderr b/src/test/ui/lint/lint-forbid-cmdline.stderr index 37a2699e898..35539f0e877 100644 --- a/src/test/ui/lint/lint-forbid-cmdline.stderr +++ b/src/test/ui/lint/lint-forbid-cmdline.stderr @@ -1,5 +1,5 @@ error[E0453]: allow(deprecated) overruled by outer forbid(deprecated) - --> $DIR/lint-forbid-cmdline.rs:13:9 + --> $DIR/lint-forbid-cmdline.rs:3:9 | LL | #[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated) | ^^^^^^^^^^ overruled by previous forbid diff --git a/src/test/ui/lint/lint-forbid-internal-unsafe.rs b/src/test/ui/lint/lint-forbid-internal-unsafe.rs new file mode 100644 index 00000000000..b08fbf6f845 --- /dev/null +++ b/src/test/ui/lint/lint-forbid-internal-unsafe.rs @@ -0,0 +1,16 @@ +#![forbid(unsafe_code)] +#![feature(allow_internal_unsafe)] + +#[allow_internal_unsafe] +//~^ ERROR: `allow_internal_unsafe` allows defining +macro_rules! evil { + ($e:expr) => { + unsafe { + $e + } + } +} + +fn main() { + println!("{}", evil!(*(0 as *const u8))); +} diff --git a/src/test/ui/lint/lint-forbid-internal-unsafe.stderr b/src/test/ui/lint/lint-forbid-internal-unsafe.stderr new file mode 100644 index 00000000000..59dab119682 --- /dev/null +++ b/src/test/ui/lint/lint-forbid-internal-unsafe.stderr @@ -0,0 +1,14 @@ +error: `allow_internal_unsafe` allows defining macros using unsafe without triggering the `unsafe_code` lint at their call site + --> $DIR/lint-forbid-internal-unsafe.rs:4:1 + | +LL | #[allow_internal_unsafe] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint-forbid-internal-unsafe.rs:1:11 + | +LL | #![forbid(unsafe_code)] + | ^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/lint/lint-group-nonstandard-style.rs b/src/test/ui/lint/lint-group-nonstandard-style.rs index 55d6168e6e0..0386daaa59b 100644 --- a/src/test/ui/lint/lint-group-nonstandard-style.rs +++ b/src/test/ui/lint/lint-group-nonstandard-style.rs @@ -1,13 +1,3 @@ -// Copyright 2014–2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(nonstandard_style)] #![allow(dead_code)] diff --git a/src/test/ui/lint/lint-group-nonstandard-style.stderr b/src/test/ui/lint/lint-group-nonstandard-style.stderr index 6979510e500..f3c7d70054b 100644 --- a/src/test/ui/lint/lint-group-nonstandard-style.stderr +++ b/src/test/ui/lint/lint-group-nonstandard-style.stderr @@ -1,67 +1,67 @@ -error: function `CamelCase` should have a snake case name such as `camel_case` - --> $DIR/lint-group-nonstandard-style.rs:14:1 +warning: type `snake_case` should have a camel case name + --> $DIR/lint-group-nonstandard-style.rs:22:16 + | +LL | struct snake_case; //~ WARN should have a camel + | ^^^^^^^^^^ help: convert the identifier to camel case: `SnakeCase` + | +note: lint level defined here + --> $DIR/lint-group-nonstandard-style.rs:18:17 + | +LL | #![warn(nonstandard_style)] + | ^^^^^^^^^^^^^^^^^ + = note: #[warn(non_camel_case_types)] implied by #[warn(nonstandard_style)] + +error: function `CamelCase` should have a snake case name + --> $DIR/lint-group-nonstandard-style.rs:4:4 | LL | fn CamelCase() {} //~ ERROR should have a snake - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | note: lint level defined here - --> $DIR/lint-group-nonstandard-style.rs:11:9 + --> $DIR/lint-group-nonstandard-style.rs:1:9 | LL | #![deny(nonstandard_style)] | ^^^^^^^^^^^^^^^^^ = note: #[deny(non_snake_case)] implied by #[deny(nonstandard_style)] -error: function `CamelCase` should have a snake case name such as `camel_case` - --> $DIR/lint-group-nonstandard-style.rs:22:9 +error: function `CamelCase` should have a snake case name + --> $DIR/lint-group-nonstandard-style.rs:12:12 | LL | fn CamelCase() {} //~ ERROR should have a snake - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | note: lint level defined here - --> $DIR/lint-group-nonstandard-style.rs:20:14 + --> $DIR/lint-group-nonstandard-style.rs:10:14 | LL | #[forbid(nonstandard_style)] | ^^^^^^^^^^^^^^^^^ = note: #[forbid(non_snake_case)] implied by #[forbid(nonstandard_style)] -error: static variable `bad` should have an upper case name such as `BAD` - --> $DIR/lint-group-nonstandard-style.rs:24:9 +error: static variable `bad` should have an upper case name + --> $DIR/lint-group-nonstandard-style.rs:14:16 | LL | static bad: isize = 1; //~ ERROR should have an upper - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^ help: convert the identifier to upper case: `BAD` | note: lint level defined here - --> $DIR/lint-group-nonstandard-style.rs:20:14 + --> $DIR/lint-group-nonstandard-style.rs:10:14 | LL | #[forbid(nonstandard_style)] | ^^^^^^^^^^^^^^^^^ = note: #[forbid(non_upper_case_globals)] implied by #[forbid(nonstandard_style)] -warning: function `CamelCase` should have a snake case name such as `camel_case` - --> $DIR/lint-group-nonstandard-style.rs:30:9 +warning: function `CamelCase` should have a snake case name + --> $DIR/lint-group-nonstandard-style.rs:20:12 | LL | fn CamelCase() {} //~ WARN should have a snake - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | note: lint level defined here - --> $DIR/lint-group-nonstandard-style.rs:28:17 + --> $DIR/lint-group-nonstandard-style.rs:18:17 | LL | #![warn(nonstandard_style)] | ^^^^^^^^^^^^^^^^^ = note: #[warn(non_snake_case)] implied by #[warn(nonstandard_style)] -warning: type `snake_case` should have a camel case name such as `SnakeCase` - --> $DIR/lint-group-nonstandard-style.rs:32:9 - | -LL | struct snake_case; //~ WARN should have a camel - | ^^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/lint-group-nonstandard-style.rs:28:17 - | -LL | #![warn(nonstandard_style)] - | ^^^^^^^^^^^^^^^^^ - = note: #[warn(non_camel_case_types)] implied by #[warn(nonstandard_style)] - error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/lint-impl-fn.rs b/src/test/ui/lint/lint-impl-fn.rs index 54a720d75b5..46874d95c32 100644 --- a/src/test/ui/lint/lint-impl-fn.rs +++ b/src/test/ui/lint/lint-impl-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(while_true)] #![allow(dead_code)] diff --git a/src/test/ui/lint/lint-impl-fn.stderr b/src/test/ui/lint/lint-impl-fn.stderr index ed37e877875..b0a3f619784 100644 --- a/src/test/ui/lint/lint-impl-fn.stderr +++ b/src/test/ui/lint/lint-impl-fn.stderr @@ -1,35 +1,35 @@ error: denote infinite loops with `loop { ... }` - --> $DIR/lint-impl-fn.rs:20:21 + --> $DIR/lint-impl-fn.rs:10:21 | LL | fn bar(&self) { while true {} } //~ ERROR: infinite loops | ^^^^^^^^^^ help: use `loop` | note: lint level defined here - --> $DIR/lint-impl-fn.rs:19:12 + --> $DIR/lint-impl-fn.rs:9:12 | LL | #[deny(while_true)] | ^^^^^^^^^^ error: denote infinite loops with `loop { ... }` - --> $DIR/lint-impl-fn.rs:28:25 + --> $DIR/lint-impl-fn.rs:18:25 | LL | fn foo(&self) { while true {} } //~ ERROR: infinite loops | ^^^^^^^^^^ help: use `loop` | note: lint level defined here - --> $DIR/lint-impl-fn.rs:23:8 + --> $DIR/lint-impl-fn.rs:13:8 | LL | #[deny(while_true)] | ^^^^^^^^^^ error: denote infinite loops with `loop { ... }` - --> $DIR/lint-impl-fn.rs:37:5 + --> $DIR/lint-impl-fn.rs:27:5 | LL | while true {} //~ ERROR: infinite loops | ^^^^^^^^^^ help: use `loop` | note: lint level defined here - --> $DIR/lint-impl-fn.rs:35:8 + --> $DIR/lint-impl-fn.rs:25:8 | LL | #[deny(while_true)] | ^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-incoherent-auto-trait-objects.rs b/src/test/ui/lint/lint-incoherent-auto-trait-objects.rs new file mode 100644 index 00000000000..0d18965ee73 --- /dev/null +++ b/src/test/ui/lint/lint-incoherent-auto-trait-objects.rs @@ -0,0 +1,21 @@ +// ignore-tidy-linelength + +trait Foo {} + +impl Foo for dyn Send {} + +impl Foo for dyn Send + Send {} +//~^ ERROR conflicting implementations +//~| hard error + +impl Foo for dyn Send + Sync {} + +impl Foo for dyn Sync + Send {} +//~^ ERROR conflicting implementations +//~| hard error + +impl Foo for dyn Send + Sync + Send {} +//~^ ERROR conflicting implementations +//~| hard error + +fn main() {} diff --git a/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr b/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr new file mode 100644 index 00000000000..928c92ef916 --- /dev/null +++ b/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr @@ -0,0 +1,39 @@ +error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + 'static)`: (E0119) + --> $DIR/lint-incoherent-auto-trait-objects.rs:7:1 + | +LL | impl Foo for dyn Send {} + | --------------------- first implementation here +LL | +LL | impl Foo for dyn Send + Send {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` + | + = note: #[deny(order_dependent_trait_objects)] on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #56484 + +error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) + --> $DIR/lint-incoherent-auto-trait-objects.rs:13:1 + | +LL | impl Foo for dyn Send + Sync {} + | ---------------------------- first implementation here +LL | +LL | impl Foo for dyn Sync + Send {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #56484 + +error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) + --> $DIR/lint-incoherent-auto-trait-objects.rs:17:1 + | +LL | impl Foo for dyn Sync + Send {} + | ---------------------------- first implementation here +... +LL | impl Foo for dyn Send + Sync + Send {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #56484 + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/lint/lint-lowercase-static-const-pattern-rename.rs b/src/test/ui/lint/lint-lowercase-static-const-pattern-rename.rs new file mode 100644 index 00000000000..8ca5af21630 --- /dev/null +++ b/src/test/ui/lint/lint-lowercase-static-const-pattern-rename.rs @@ -0,0 +1,63 @@ +// compile-pass +// Issue #7526: lowercase static constants in patterns look like bindings + +// This is similar to lint-lowercase-static-const-pattern.rs, except it +// shows the expected usual workaround (choosing a different name for +// the static definition) and also demonstrates that one can work +// around this problem locally by renaming the constant in the `use` +// form to an uppercase identifier that placates the lint. + +#![deny(non_upper_case_globals)] + +pub const A : isize = 97; + +fn f() { + let r = match (0,0) { + (0, A) => 0, + (x, y) => 1 + x + y, + }; + assert_eq!(r, 1); + let r = match (0,97) { + (0, A) => 0, + (x, y) => 1 + x + y, + }; + assert_eq!(r, 0); +} + +mod m { + #[allow(non_upper_case_globals)] + pub const aha : isize = 7; +} + +fn g() { + use self::m::aha as AHA; + let r = match (0,0) { + (0, AHA) => 0, + (x, y) => 1 + x + y, + }; + assert_eq!(r, 1); + let r = match (0,7) { + (0, AHA) => 0, + (x, y) => 1 + x + y, + }; + assert_eq!(r, 0); +} + +fn h() { + let r = match (0,0) { + (0, self::m::aha) => 0, + (x, y) => 1 + x + y, + }; + assert_eq!(r, 1); + let r = match (0,7) { + (0, self::m::aha) => 0, + (x, y) => 1 + x + y, + }; + assert_eq!(r, 0); +} + +pub fn main () { + f(); + g(); + h(); +} diff --git a/src/test/ui/lint/lint-lowercase-static-const-pattern.rs b/src/test/ui/lint/lint-lowercase-static-const-pattern.rs new file mode 100644 index 00000000000..c2e159eec1b --- /dev/null +++ b/src/test/ui/lint/lint-lowercase-static-const-pattern.rs @@ -0,0 +1,51 @@ +// Issue #7526: lowercase static constants in patterns look like bindings + +#![allow(dead_code)] +#![deny(non_upper_case_globals)] + +#[allow(non_upper_case_globals)] +pub const a : isize = 97; + +fn f() { + let r = match (0,0) { + (0, a) => 0, + //~^ ERROR constant in pattern `a` should have an upper case name + (x, y) => 1 + x + y, + }; + assert_eq!(r, 1); +} + +mod m { + #[allow(non_upper_case_globals)] + pub const aha : isize = 7; +} + +fn g() { + use self::m::aha; + let r = match (0,0) { + (0, aha) => 0, + //~^ ERROR constant in pattern `aha` should have an upper case name + (x, y) => 1 + x + y, + }; + assert_eq!(r, 1); +} + +mod n { + pub const OKAY : isize = 8; +} + +fn h() { + use self::n::OKAY as not_okay; + let r = match (0,0) { + (0, not_okay) => 0, +//~^ ERROR constant in pattern `not_okay` should have an upper case name + (x, y) => 1 + x + y, + }; + assert_eq!(r, 1); +} + +fn main () { + f(); + g(); + h(); +} diff --git a/src/test/ui/lint/lint-lowercase-static-const-pattern.stderr b/src/test/ui/lint/lint-lowercase-static-const-pattern.stderr new file mode 100644 index 00000000000..d95510ccd2d --- /dev/null +++ b/src/test/ui/lint/lint-lowercase-static-const-pattern.stderr @@ -0,0 +1,26 @@ +error: constant in pattern `a` should have an upper case name + --> $DIR/lint-lowercase-static-const-pattern.rs:11:13 + | +LL | (0, a) => 0, + | ^ help: convert the identifier to upper case: `A` + | +note: lint level defined here + --> $DIR/lint-lowercase-static-const-pattern.rs:4:9 + | +LL | #![deny(non_upper_case_globals)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: constant in pattern `aha` should have an upper case name + --> $DIR/lint-lowercase-static-const-pattern.rs:26:13 + | +LL | (0, aha) => 0, + | ^^^ help: convert the identifier to upper case: `AHA` + +error: constant in pattern `not_okay` should have an upper case name + --> $DIR/lint-lowercase-static-const-pattern.rs:40:13 + | +LL | (0, not_okay) => 0, + | ^^^^^^^^ help: convert the identifier to upper case: `NOT_OKAY` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/lint/lint-malformed.rs b/src/test/ui/lint/lint-malformed.rs index ad5e3aa3f06..c97a4320f1d 100644 --- a/src/test/ui/lint/lint-malformed.rs +++ b/src/test/ui/lint/lint-malformed.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![deny = "foo"] //~ ERROR malformed lint attribute +#![deny = "foo"] //~ ERROR attribute must be of the form #![allow(bar = "baz")] //~ ERROR malformed lint attribute fn main() { } diff --git a/src/test/ui/lint/lint-malformed.stderr b/src/test/ui/lint/lint-malformed.stderr index 7b8155cb410..98a7cecc2bb 100644 --- a/src/test/ui/lint/lint-malformed.stderr +++ b/src/test/ui/lint/lint-malformed.stderr @@ -1,15 +1,15 @@ error[E0452]: malformed lint attribute - --> $DIR/lint-malformed.rs:11:1 - | -LL | #![deny = "foo"] //~ ERROR malformed lint attribute - | ^^^^^^^^^^^^^^^^ - -error[E0452]: malformed lint attribute - --> $DIR/lint-malformed.rs:12:10 + --> $DIR/lint-malformed.rs:2:10 | LL | #![allow(bar = "baz")] //~ ERROR malformed lint attribute | ^^^^^^^^^^^ +error: attribute must be of the form `#[deny(lint1, lint2, ..., /*opt*/ reason = "...")]` + --> $DIR/lint-malformed.rs:1:1 + | +LL | #![deny = "foo"] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^ + error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0452`. diff --git a/src/test/ui/lint/lint-misplaced-attr.rs b/src/test/ui/lint/lint-misplaced-attr.rs index 18ea5a383f6..e5ad7a53e0c 100644 --- a/src/test/ui/lint/lint-misplaced-attr.rs +++ b/src/test/ui/lint/lint-misplaced-attr.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. diff --git a/src/test/ui/lint/lint-misplaced-attr.stderr b/src/test/ui/lint/lint-misplaced-attr.stderr index 17f29a6ba79..2a28d54619c 100644 --- a/src/test/ui/lint/lint-misplaced-attr.stderr +++ b/src/test/ui/lint/lint-misplaced-attr.stderr @@ -1,29 +1,29 @@ error: unused attribute - --> $DIR/lint-misplaced-attr.rs:17:5 + --> $DIR/lint-misplaced-attr.rs:7:5 | LL | #![crate_type = "bin"] //~ ERROR unused attribute | ^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-misplaced-attr.rs:14:9 + --> $DIR/lint-misplaced-attr.rs:4:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: crate-level attribute should be in the root module - --> $DIR/lint-misplaced-attr.rs:17:5 + --> $DIR/lint-misplaced-attr.rs:7:5 | LL | #![crate_type = "bin"] //~ ERROR unused attribute | ^^^^^^^^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/lint-misplaced-attr.rs:21:1 + --> $DIR/lint-misplaced-attr.rs:11:1 | LL | #[crate_type = "bin"] fn main() {} //~ ERROR unused attribute | ^^^^^^^^^^^^^^^^^^^^^ error: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/lint-misplaced-attr.rs:21:1 + --> $DIR/lint-misplaced-attr.rs:11:1 | LL | #[crate_type = "bin"] fn main() {} //~ ERROR unused attribute | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-missing-copy-implementations.rs b/src/test/ui/lint/lint-missing-copy-implementations.rs index 94a11aac067..918f40de153 100644 --- a/src/test/ui/lint/lint-missing-copy-implementations.rs +++ b/src/test/ui/lint/lint-missing-copy-implementations.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // See issue 19712 #![deny(missing_copy_implementations)] diff --git a/src/test/ui/lint/lint-missing-copy-implementations.stderr b/src/test/ui/lint/lint-missing-copy-implementations.stderr index 3cb89ef794a..30da3ac879e 100644 --- a/src/test/ui/lint/lint-missing-copy-implementations.stderr +++ b/src/test/ui/lint/lint-missing-copy-implementations.stderr @@ -1,5 +1,5 @@ error: type could implement `Copy`; consider adding `impl Copy` - --> $DIR/lint-missing-copy-implementations.rs:16:5 + --> $DIR/lint-missing-copy-implementations.rs:6:5 | LL | / pub struct Foo { //~ ERROR type could implement `Copy`; consider adding `impl Copy` LL | | pub field: i32 @@ -7,7 +7,7 @@ LL | | } | |_____^ | note: lint level defined here - --> $DIR/lint-missing-copy-implementations.rs:13:9 + --> $DIR/lint-missing-copy-implementations.rs:3:9 | LL | #![deny(missing_copy_implementations)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-missing-doc.rs b/src/test/ui/lint/lint-missing-doc.rs index 4add67f61e0..a2466d28fb0 100644 --- a/src/test/ui/lint/lint-missing-doc.rs +++ b/src/test/ui/lint/lint-missing-doc.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. #![deny(missing_docs)] diff --git a/src/test/ui/lint/lint-missing-doc.stderr b/src/test/ui/lint/lint-missing-doc.stderr index e61d56d8518..ea5a14bca7c 100644 --- a/src/test/ui/lint/lint-missing-doc.stderr +++ b/src/test/ui/lint/lint-missing-doc.stderr @@ -1,119 +1,119 @@ error: missing documentation for a type alias - --> $DIR/lint-missing-doc.rs:21:1 + --> $DIR/lint-missing-doc.rs:11:1 | LL | pub type PubTypedef = String; //~ ERROR: missing documentation for a type alias | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-missing-doc.rs:13:9 + --> $DIR/lint-missing-doc.rs:3:9 | LL | #![deny(missing_docs)] | ^^^^^^^^^^^^ error: missing documentation for a struct - --> $DIR/lint-missing-doc.rs:28:1 + --> $DIR/lint-missing-doc.rs:18:1 | LL | pub struct PubFoo { //~ ERROR: missing documentation for a struct | ^^^^^^^^^^^^^^^^^ error: missing documentation for a struct field - --> $DIR/lint-missing-doc.rs:29:5 + --> $DIR/lint-missing-doc.rs:19:5 | LL | pub a: isize, //~ ERROR: missing documentation for a struct field | ^^^^^^^^^^^^ error: missing documentation for a module - --> $DIR/lint-missing-doc.rs:40:1 + --> $DIR/lint-missing-doc.rs:30:1 | LL | pub mod pub_module_no_dox {} //~ ERROR: missing documentation for a module | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/lint-missing-doc.rs:44:1 + --> $DIR/lint-missing-doc.rs:34:1 | LL | pub fn foo2() {} //~ ERROR: missing documentation for a function | ^^^^^^^^^^^^^ error: missing documentation for a trait - --> $DIR/lint-missing-doc.rs:62:1 + --> $DIR/lint-missing-doc.rs:52:1 | LL | pub trait C { //~ ERROR: missing documentation for a trait | ^^^^^^^^^^^ error: missing documentation for a trait method - --> $DIR/lint-missing-doc.rs:63:5 + --> $DIR/lint-missing-doc.rs:53:5 | LL | fn foo(&self); //~ ERROR: missing documentation for a trait method | ^^^^^^^^^^^^^^ error: missing documentation for a trait method - --> $DIR/lint-missing-doc.rs:64:5 + --> $DIR/lint-missing-doc.rs:54:5 | LL | fn foo_with_impl(&self) {} //~ ERROR: missing documentation for a trait method | ^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type - --> $DIR/lint-missing-doc.rs:74:5 + --> $DIR/lint-missing-doc.rs:64:5 | LL | type AssociatedType; //~ ERROR: missing documentation for an associated type | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type - --> $DIR/lint-missing-doc.rs:75:5 + --> $DIR/lint-missing-doc.rs:65:5 | LL | type AssociatedTypeDef = Self; //~ ERROR: missing documentation for an associated type | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a method - --> $DIR/lint-missing-doc.rs:91:5 + --> $DIR/lint-missing-doc.rs:81:5 | LL | pub fn foo() {} //~ ERROR: missing documentation for a method | ^^^^^^^^^^^^ error: missing documentation for an enum - --> $DIR/lint-missing-doc.rs:128:1 + --> $DIR/lint-missing-doc.rs:118:1 | LL | pub enum PubBaz { //~ ERROR: missing documentation for an enum | ^^^^^^^^^^^^^^^ error: missing documentation for a variant - --> $DIR/lint-missing-doc.rs:129:5 + --> $DIR/lint-missing-doc.rs:119:5 | LL | PubBazA { //~ ERROR: missing documentation for a variant | ^^^^^^^ error: missing documentation for a struct field - --> $DIR/lint-missing-doc.rs:130:9 + --> $DIR/lint-missing-doc.rs:120:9 | LL | a: isize, //~ ERROR: missing documentation for a struct field | ^^^^^^^^ error: missing documentation for a constant - --> $DIR/lint-missing-doc.rs:161:1 + --> $DIR/lint-missing-doc.rs:151:1 | LL | pub const FOO4: u32 = 0; //~ ERROR: missing documentation for a const | ^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static - --> $DIR/lint-missing-doc.rs:171:1 + --> $DIR/lint-missing-doc.rs:161:1 | LL | pub static BAR4: u32 = 0; //~ ERROR: missing documentation for a static | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/lint-missing-doc.rs:177:5 + --> $DIR/lint-missing-doc.rs:167:5 | LL | pub fn undocumented1() {} //~ ERROR: missing documentation for a function | ^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/lint-missing-doc.rs:178:5 + --> $DIR/lint-missing-doc.rs:168:5 | LL | pub fn undocumented2() {} //~ ERROR: missing documentation for a function | ^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function - --> $DIR/lint-missing-doc.rs:184:9 + --> $DIR/lint-missing-doc.rs:174:9 | LL | pub fn also_undocumented1() {} //~ ERROR: missing documentation for a function | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-non-camel-case-types.rs b/src/test/ui/lint/lint-non-camel-case-types.rs index 2f0b6c57d55..bca1992605b 100644 --- a/src/test/ui/lint/lint-non-camel-case-types.rs +++ b/src/test/ui/lint/lint-non-camel-case-types.rs @@ -1,42 +1,32 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![forbid(non_camel_case_types)] #![allow(dead_code)] struct ONE_TWO_THREE; -//~^ ERROR type `ONE_TWO_THREE` should have a camel case name such as `OneTwoThree` +//~^ ERROR type `ONE_TWO_THREE` should have a camel case name -struct foo { //~ ERROR type `foo` should have a camel case name such as `Foo` +struct foo { //~ ERROR type `foo` should have a camel case name bar: isize, } -enum foo2 { //~ ERROR type `foo2` should have a camel case name such as `Foo2` +enum foo2 { //~ ERROR type `foo2` should have a camel case name Bar } -struct foo3 { //~ ERROR type `foo3` should have a camel case name such as `Foo3` +struct foo3 { //~ ERROR type `foo3` should have a camel case name bar: isize } -type foo4 = isize; //~ ERROR type `foo4` should have a camel case name such as `Foo4` +type foo4 = isize; //~ ERROR type `foo4` should have a camel case name enum Foo5 { - bar //~ ERROR variant `bar` should have a camel case name such as `Bar` + bar //~ ERROR variant `bar` should have a camel case name } -trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6` +trait foo6 { //~ ERROR trait `foo6` should have a camel case name fn dummy(&self) { } } -fn f(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty` +fn f(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name #[repr(C)] struct foo7 { @@ -45,10 +35,10 @@ struct foo7 { struct X86_64; -struct X86__64; //~ ERROR type `X86__64` should have a camel case name such as `X86_64` +struct X86__64; //~ ERROR type `X86__64` should have a camel case name -struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name such as `Abc123` +struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name -struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name such as `A1B2C3` +struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name fn main() { } diff --git a/src/test/ui/lint/lint-non-camel-case-types.stderr b/src/test/ui/lint/lint-non-camel-case-types.stderr index 05834a66cd0..74f9a5993b8 100644 --- a/src/test/ui/lint/lint-non-camel-case-types.stderr +++ b/src/test/ui/lint/lint-non-camel-case-types.stderr @@ -1,82 +1,74 @@ -error: type `ONE_TWO_THREE` should have a camel case name such as `OneTwoThree` - --> $DIR/lint-non-camel-case-types.rs:14:1 +error: type `ONE_TWO_THREE` should have a camel case name + --> $DIR/lint-non-camel-case-types.rs:4:8 | LL | struct ONE_TWO_THREE; - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ help: convert the identifier to camel case: `OneTwoThree` | note: lint level defined here - --> $DIR/lint-non-camel-case-types.rs:11:11 + --> $DIR/lint-non-camel-case-types.rs:1:11 | LL | #![forbid(non_camel_case_types)] | ^^^^^^^^^^^^^^^^^^^^ -error: type `foo` should have a camel case name such as `Foo` - --> $DIR/lint-non-camel-case-types.rs:17:1 +error: type `foo` should have a camel case name + --> $DIR/lint-non-camel-case-types.rs:7:8 | -LL | / struct foo { //~ ERROR type `foo` should have a camel case name such as `Foo` -LL | | bar: isize, -LL | | } - | |_^ +LL | struct foo { //~ ERROR type `foo` should have a camel case name + | ^^^ help: convert the identifier to camel case: `Foo` -error: type `foo2` should have a camel case name such as `Foo2` - --> $DIR/lint-non-camel-case-types.rs:21:1 +error: type `foo2` should have a camel case name + --> $DIR/lint-non-camel-case-types.rs:11:6 | -LL | / enum foo2 { //~ ERROR type `foo2` should have a camel case name such as `Foo2` -LL | | Bar -LL | | } - | |_^ +LL | enum foo2 { //~ ERROR type `foo2` should have a camel case name + | ^^^^ help: convert the identifier to camel case: `Foo2` -error: type `foo3` should have a camel case name such as `Foo3` - --> $DIR/lint-non-camel-case-types.rs:25:1 +error: type `foo3` should have a camel case name + --> $DIR/lint-non-camel-case-types.rs:15:8 | -LL | / struct foo3 { //~ ERROR type `foo3` should have a camel case name such as `Foo3` -LL | | bar: isize -LL | | } - | |_^ +LL | struct foo3 { //~ ERROR type `foo3` should have a camel case name + | ^^^^ help: convert the identifier to camel case: `Foo3` -error: type `foo4` should have a camel case name such as `Foo4` - --> $DIR/lint-non-camel-case-types.rs:29:1 +error: type `foo4` should have a camel case name + --> $DIR/lint-non-camel-case-types.rs:19:6 | -LL | type foo4 = isize; //~ ERROR type `foo4` should have a camel case name such as `Foo4` - | ^^^^^^^^^^^^^^^^^^ +LL | type foo4 = isize; //~ ERROR type `foo4` should have a camel case name + | ^^^^ help: convert the identifier to camel case: `Foo4` -error: variant `bar` should have a camel case name such as `Bar` - --> $DIR/lint-non-camel-case-types.rs:32:5 +error: variant `bar` should have a camel case name + --> $DIR/lint-non-camel-case-types.rs:22:5 | -LL | bar //~ ERROR variant `bar` should have a camel case name such as `Bar` - | ^^^ +LL | bar //~ ERROR variant `bar` should have a camel case name + | ^^^ help: convert the identifier to camel case: `Bar` -error: trait `foo6` should have a camel case name such as `Foo6` - --> $DIR/lint-non-camel-case-types.rs:35:1 +error: trait `foo6` should have a camel case name + --> $DIR/lint-non-camel-case-types.rs:25:7 | -LL | / trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6` -LL | | fn dummy(&self) { } -LL | | } - | |_^ +LL | trait foo6 { //~ ERROR trait `foo6` should have a camel case name + | ^^^^ help: convert the identifier to camel case: `Foo6` -error: type parameter `ty` should have a camel case name such as `Ty` - --> $DIR/lint-non-camel-case-types.rs:39:6 +error: type parameter `ty` should have a camel case name + --> $DIR/lint-non-camel-case-types.rs:29:6 | -LL | fn f(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty` - | ^^ +LL | fn f(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name + | ^^ help: convert the identifier to camel case: `Ty` -error: type `X86__64` should have a camel case name such as `X86_64` - --> $DIR/lint-non-camel-case-types.rs:48:1 +error: type `X86__64` should have a camel case name + --> $DIR/lint-non-camel-case-types.rs:38:8 | -LL | struct X86__64; //~ ERROR type `X86__64` should have a camel case name such as `X86_64` - | ^^^^^^^^^^^^^^^ +LL | struct X86__64; //~ ERROR type `X86__64` should have a camel case name + | ^^^^^^^ help: convert the identifier to camel case: `X86_64` -error: type `Abc_123` should have a camel case name such as `Abc123` - --> $DIR/lint-non-camel-case-types.rs:50:1 +error: type `Abc_123` should have a camel case name + --> $DIR/lint-non-camel-case-types.rs:40:8 | -LL | struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name such as `Abc123` - | ^^^^^^^^^^^^^^^ +LL | struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name + | ^^^^^^^ help: convert the identifier to camel case: `Abc123` -error: type `A1_b2_c3` should have a camel case name such as `A1B2C3` - --> $DIR/lint-non-camel-case-types.rs:52:1 +error: type `A1_b2_c3` should have a camel case name + --> $DIR/lint-non-camel-case-types.rs:42:8 | -LL | struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name such as `A1B2C3` - | ^^^^^^^^^^^^^^^^ +LL | struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name + | ^^^^^^^^ help: convert the identifier to camel case: `A1B2C3` error: aborting due to 11 previous errors diff --git a/src/test/ui/lint/lint-non-camel-case-variant.rs b/src/test/ui/lint/lint-non-camel-case-variant.rs new file mode 100644 index 00000000000..1f06b283984 --- /dev/null +++ b/src/test/ui/lint/lint-non-camel-case-variant.rs @@ -0,0 +1,10 @@ +// compile-pass + +#![deny(non_camel_case_types)] + +pub enum Foo { + #[allow(non_camel_case_types)] + bar +} + +fn main() {} diff --git a/src/test/ui/lint/lint-non-camel-case-with-trailing-underscores.rs b/src/test/ui/lint/lint-non-camel-case-with-trailing-underscores.rs new file mode 100644 index 00000000000..c2fdfb4fe42 --- /dev/null +++ b/src/test/ui/lint/lint-non-camel-case-with-trailing-underscores.rs @@ -0,0 +1,11 @@ +// compile-pass + +#![allow(dead_code)] +// This is ok because we often use the trailing underscore to mean 'prime' + +// pretty-expanded FIXME #23616 + +#[forbid(non_camel_case_types)] +type Foo_ = isize; + +pub fn main() { } diff --git a/src/test/ui/lint/lint-non-snake-case-crate-2.rs b/src/test/ui/lint/lint-non-snake-case-crate-2.rs index fe22c21df24..1b763a9d868 100644 --- a/src/test/ui/lint/lint-non-snake-case-crate-2.rs +++ b/src/test/ui/lint/lint-non-snake-case-crate-2.rs @@ -1,15 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-name NonSnakeCase -// error-pattern: crate `NonSnakeCase` should have a snake case name such as `non_snake_case` +// error-pattern: crate `NonSnakeCase` should have a snake case name #![deny(non_snake_case)] diff --git a/src/test/ui/lint/lint-non-snake-case-crate-2.stderr b/src/test/ui/lint/lint-non-snake-case-crate-2.stderr index ce49d9a0b80..f3303191a06 100644 --- a/src/test/ui/lint/lint-non-snake-case-crate-2.stderr +++ b/src/test/ui/lint/lint-non-snake-case-crate-2.stderr @@ -1,10 +1,11 @@ -error: crate `NonSnakeCase` should have a snake case name such as `non_snake_case` +error: crate `NonSnakeCase` should have a snake case name | note: lint level defined here - --> $DIR/lint-non-snake-case-crate-2.rs:14:9 + --> $DIR/lint-non-snake-case-crate-2.rs:4:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ + = help: convert the identifier to snake case: `non_snake_case` error: aborting due to previous error diff --git a/src/test/ui/lint/lint-non-snake-case-crate.rs b/src/test/ui/lint/lint-non-snake-case-crate.rs index 9ca0a34e6ff..e4e84261a4e 100644 --- a/src/test/ui/lint/lint-non-snake-case-crate.rs +++ b/src/test/ui/lint/lint-non-snake-case-crate.rs @@ -1,15 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "NonSnakeCase"] -//~^ ERROR crate `NonSnakeCase` should have a snake case name such as `non_snake_case` +//~^ ERROR crate `NonSnakeCase` should have a snake case name #![deny(non_snake_case)] fn main() {} diff --git a/src/test/ui/lint/lint-non-snake-case-crate.stderr b/src/test/ui/lint/lint-non-snake-case-crate.stderr index 4d55661daa0..5cfd60a76e4 100644 --- a/src/test/ui/lint/lint-non-snake-case-crate.stderr +++ b/src/test/ui/lint/lint-non-snake-case-crate.stderr @@ -1,11 +1,11 @@ -error: crate `NonSnakeCase` should have a snake case name such as `non_snake_case` - --> $DIR/lint-non-snake-case-crate.rs:11:1 +error: crate `NonSnakeCase` should have a snake case name + --> $DIR/lint-non-snake-case-crate.rs:1:18 | LL | #![crate_name = "NonSnakeCase"] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case` | note: lint level defined here - --> $DIR/lint-non-snake-case-crate.rs:13:9 + --> $DIR/lint-non-snake-case-crate.rs:3:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-non-snake-case-functions.rs b/src/test/ui/lint/lint-non-snake-case-functions.rs index 6cfdc6ad90b..fa64a9f980e 100644 --- a/src/test/ui/lint/lint-non-snake-case-functions.rs +++ b/src/test/ui/lint/lint-non-snake-case-functions.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(non_snake_case)] #![allow(dead_code)] @@ -15,28 +5,28 @@ struct Foo; impl Foo { fn Foo_Method() {} - //~^ ERROR method `Foo_Method` should have a snake case name such as `foo_method` + //~^ ERROR method `Foo_Method` should have a snake case name // Don't allow two underscores in a row fn foo__method(&self) {} - //~^ ERROR method `foo__method` should have a snake case name such as `foo_method` + //~^ ERROR method `foo__method` should have a snake case name pub fn xyZ(&mut self) {} - //~^ ERROR method `xyZ` should have a snake case name such as `xy_z` + //~^ ERROR method `xyZ` should have a snake case name fn render_HTML() {} - //~^ ERROR method `render_HTML` should have a snake case name such as `render_html` + //~^ ERROR method `render_HTML` should have a snake case name } trait X { fn ABC(); - //~^ ERROR trait method `ABC` should have a snake case name such as `abc` + //~^ ERROR trait method `ABC` should have a snake case name fn a_b_C(&self) {} - //~^ ERROR trait method `a_b_C` should have a snake case name such as `a_b_c` + //~^ ERROR trait method `a_b_C` should have a snake case name fn something__else(&mut self); - //~^ ERROR trait method `something__else` should have a snake case name such as `something_else` + //~^ ERROR trait method `something__else` should have a snake case name } impl X for Foo { @@ -46,9 +36,9 @@ impl X for Foo { } fn Cookie() {} -//~^ ERROR function `Cookie` should have a snake case name such as `cookie` +//~^ ERROR function `Cookie` should have a snake case name pub fn bi_S_Cuit() {} -//~^ ERROR function `bi_S_Cuit` should have a snake case name such as `bi_s_cuit` +//~^ ERROR function `bi_S_Cuit` should have a snake case name fn main() { } diff --git a/src/test/ui/lint/lint-non-snake-case-functions.stderr b/src/test/ui/lint/lint-non-snake-case-functions.stderr index f7ac48da901..49cbfa94126 100644 --- a/src/test/ui/lint/lint-non-snake-case-functions.stderr +++ b/src/test/ui/lint/lint-non-snake-case-functions.stderr @@ -1,62 +1,62 @@ -error: method `Foo_Method` should have a snake case name such as `foo_method` - --> $DIR/lint-non-snake-case-functions.rs:17:5 +error: method `Foo_Method` should have a snake case name + --> $DIR/lint-non-snake-case-functions.rs:7:8 | LL | fn Foo_Method() {} - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ help: convert the identifier to snake case: `foo_method` | note: lint level defined here - --> $DIR/lint-non-snake-case-functions.rs:11:9 + --> $DIR/lint-non-snake-case-functions.rs:1:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ -error: method `foo__method` should have a snake case name such as `foo_method` - --> $DIR/lint-non-snake-case-functions.rs:21:5 +error: method `foo__method` should have a snake case name + --> $DIR/lint-non-snake-case-functions.rs:11:8 | LL | fn foo__method(&self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ help: convert the identifier to snake case: `foo_method` -error: method `xyZ` should have a snake case name such as `xy_z` - --> $DIR/lint-non-snake-case-functions.rs:24:5 +error: method `xyZ` should have a snake case name + --> $DIR/lint-non-snake-case-functions.rs:14:12 | LL | pub fn xyZ(&mut self) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^ help: convert the identifier to snake case: `xy_z` -error: method `render_HTML` should have a snake case name such as `render_html` - --> $DIR/lint-non-snake-case-functions.rs:27:5 +error: method `render_HTML` should have a snake case name + --> $DIR/lint-non-snake-case-functions.rs:17:8 | LL | fn render_HTML() {} - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^ help: convert the identifier to snake case: `render_html` -error: trait method `ABC` should have a snake case name such as `abc` - --> $DIR/lint-non-snake-case-functions.rs:32:5 +error: trait method `ABC` should have a snake case name + --> $DIR/lint-non-snake-case-functions.rs:22:8 | LL | fn ABC(); - | ^^^^^^^^^ + | ^^^ help: convert the identifier to snake case: `abc` -error: trait method `a_b_C` should have a snake case name such as `a_b_c` - --> $DIR/lint-non-snake-case-functions.rs:35:5 +error: trait method `a_b_C` should have a snake case name + --> $DIR/lint-non-snake-case-functions.rs:25:8 | LL | fn a_b_C(&self) {} - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^ help: convert the identifier to snake case: `a_b_c` -error: trait method `something__else` should have a snake case name such as `something_else` - --> $DIR/lint-non-snake-case-functions.rs:38:5 +error: trait method `something__else` should have a snake case name + --> $DIR/lint-non-snake-case-functions.rs:28:8 | LL | fn something__else(&mut self); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `something_else` -error: function `Cookie` should have a snake case name such as `cookie` - --> $DIR/lint-non-snake-case-functions.rs:48:1 +error: function `Cookie` should have a snake case name + --> $DIR/lint-non-snake-case-functions.rs:38:4 | LL | fn Cookie() {} - | ^^^^^^^^^^^^^^ + | ^^^^^^ help: convert the identifier to snake case: `cookie` -error: function `bi_S_Cuit` should have a snake case name such as `bi_s_cuit` - --> $DIR/lint-non-snake-case-functions.rs:51:1 +error: function `bi_S_Cuit` should have a snake case name + --> $DIR/lint-non-snake-case-functions.rs:41:8 | LL | pub fn bi_S_Cuit() {} - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^ help: convert the identifier to snake case: `bi_s_cuit` error: aborting due to 9 previous errors diff --git a/src/test/ui/lint/lint-non-snake-case-lifetimes.rs b/src/test/ui/lint/lint-non-snake-case-lifetimes.rs index 64669d90d06..de76d2dbef2 100644 --- a/src/test/ui/lint/lint-non-snake-case-lifetimes.rs +++ b/src/test/ui/lint/lint-non-snake-case-lifetimes.rs @@ -1,17 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(non_snake_case)] #![allow(dead_code)] -fn f<'FooBar>( //~ ERROR lifetime `'FooBar` should have a snake case name such as `'foo_bar` +fn f<'FooBar>( //~ ERROR lifetime `'FooBar` should have a snake case name _: &'FooBar () ) {} diff --git a/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr b/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr index dc9b5b8cd75..970666ebcfd 100644 --- a/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr +++ b/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr @@ -1,11 +1,11 @@ -error: lifetime `'FooBar` should have a snake case name such as `'foo_bar` - --> $DIR/lint-non-snake-case-lifetimes.rs:14:6 +error: lifetime `'FooBar` should have a snake case name + --> $DIR/lint-non-snake-case-lifetimes.rs:4:6 | -LL | fn f<'FooBar>( //~ ERROR lifetime `'FooBar` should have a snake case name such as `'foo_bar` - | ^^^^^^^ +LL | fn f<'FooBar>( //~ ERROR lifetime `'FooBar` should have a snake case name + | ^^^^^^^ help: convert the identifier to snake case: `'foo_bar` | note: lint level defined here - --> $DIR/lint-non-snake-case-lifetimes.rs:11:9 + --> $DIR/lint-non-snake-case-lifetimes.rs:1:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-non-snake-case-modules.rs b/src/test/ui/lint/lint-non-snake-case-modules.rs index 5bc84698ec9..73f12332172 100644 --- a/src/test/ui/lint/lint-non-snake-case-modules.rs +++ b/src/test/ui/lint/lint-non-snake-case-modules.rs @@ -1,17 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(non_snake_case)] #![allow(dead_code)] -mod FooBar { //~ ERROR module `FooBar` should have a snake case name such as `foo_bar` +mod FooBar { //~ ERROR module `FooBar` should have a snake case name pub struct S; } diff --git a/src/test/ui/lint/lint-non-snake-case-modules.stderr b/src/test/ui/lint/lint-non-snake-case-modules.stderr index d55d80f31b5..651132e49d9 100644 --- a/src/test/ui/lint/lint-non-snake-case-modules.stderr +++ b/src/test/ui/lint/lint-non-snake-case-modules.stderr @@ -1,13 +1,11 @@ -error: module `FooBar` should have a snake case name such as `foo_bar` - --> $DIR/lint-non-snake-case-modules.rs:14:1 +error: module `FooBar` should have a snake case name + --> $DIR/lint-non-snake-case-modules.rs:4:5 | -LL | / mod FooBar { //~ ERROR module `FooBar` should have a snake case name such as `foo_bar` -LL | | pub struct S; -LL | | } - | |_^ +LL | mod FooBar { //~ ERROR module `FooBar` should have a snake case name + | ^^^^^^ help: convert the identifier to snake case: `foo_bar` | note: lint level defined here - --> $DIR/lint-non-snake-case-modules.rs:11:9 + --> $DIR/lint-non-snake-case-modules.rs:1:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-non-snake-case-no-lowercase-equivalent.rs b/src/test/ui/lint/lint-non-snake-case-no-lowercase-equivalent.rs new file mode 100644 index 00000000000..9a6487d2542 --- /dev/null +++ b/src/test/ui/lint/lint-non-snake-case-no-lowercase-equivalent.rs @@ -0,0 +1,12 @@ +// compile-pass + +#![allow(dead_code)] +// pretty-expanded FIXME #23616 + +#![feature(non_ascii_idents)] +#![deny(non_snake_case)] + +// This name is neither upper nor lower case +fn 你好() {} + +fn main() {} diff --git a/src/test/ui/lint/lint-non-uppercase-associated-const.rs b/src/test/ui/lint/lint-non-uppercase-associated-const.rs new file mode 100644 index 00000000000..7b0d9396077 --- /dev/null +++ b/src/test/ui/lint/lint-non-uppercase-associated-const.rs @@ -0,0 +1,11 @@ +#![deny(non_upper_case_globals)] +#![allow(dead_code)] + +struct Foo; + +impl Foo { + const not_upper: bool = true; +} +//~^^ ERROR associated constant `not_upper` should have an upper case name + +fn main() {} diff --git a/src/test/ui/lint/lint-non-uppercase-associated-const.stderr b/src/test/ui/lint/lint-non-uppercase-associated-const.stderr new file mode 100644 index 00000000000..2185d5a0ab4 --- /dev/null +++ b/src/test/ui/lint/lint-non-uppercase-associated-const.stderr @@ -0,0 +1,14 @@ +error: associated constant `not_upper` should have an upper case name + --> $DIR/lint-non-uppercase-associated-const.rs:7:11 + | +LL | const not_upper: bool = true; + | ^^^^^^^^^ help: convert the identifier to upper case: `NOT_UPPER` + | +note: lint level defined here + --> $DIR/lint-non-uppercase-associated-const.rs:1:9 + | +LL | #![deny(non_upper_case_globals)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/lint/lint-non-uppercase-statics.rs b/src/test/ui/lint/lint-non-uppercase-statics.rs index 84cc24a0010..5bd1430328b 100644 --- a/src/test/ui/lint/lint-non-uppercase-statics.rs +++ b/src/test/ui/lint/lint-non-uppercase-statics.rs @@ -1,20 +1,9 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![forbid(non_upper_case_globals)] #![allow(dead_code)] -static foo: isize = 1; //~ ERROR static variable `foo` should have an upper case name such as `FOO` +static foo: isize = 1; //~ ERROR static variable `foo` should have an upper case name -static mut bar: isize = 1; - //~^ ERROR static variable `bar` should have an upper case name such as `BAR` +static mut bar: isize = 1; //~ ERROR static variable `bar` should have an upper case name #[no_mangle] pub static extern_foo: isize = 1; // OK, because #[no_mangle] supersedes the warning diff --git a/src/test/ui/lint/lint-non-uppercase-statics.stderr b/src/test/ui/lint/lint-non-uppercase-statics.stderr index 0d56c577734..f5bba5f145d 100644 --- a/src/test/ui/lint/lint-non-uppercase-statics.stderr +++ b/src/test/ui/lint/lint-non-uppercase-statics.stderr @@ -1,20 +1,20 @@ -error: static variable `foo` should have an upper case name such as `FOO` - --> $DIR/lint-non-uppercase-statics.rs:14:1 +error: static variable `foo` should have an upper case name + --> $DIR/lint-non-uppercase-statics.rs:4:8 | -LL | static foo: isize = 1; //~ ERROR static variable `foo` should have an upper case name such as `FOO` - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | static foo: isize = 1; //~ ERROR static variable `foo` should have an upper case name + | ^^^ help: convert the identifier to upper case: `FOO` | note: lint level defined here - --> $DIR/lint-non-uppercase-statics.rs:11:11 + --> $DIR/lint-non-uppercase-statics.rs:1:11 | LL | #![forbid(non_upper_case_globals)] | ^^^^^^^^^^^^^^^^^^^^^^ -error: static variable `bar` should have an upper case name such as `BAR` - --> $DIR/lint-non-uppercase-statics.rs:16:1 +error: static variable `bar` should have an upper case name + --> $DIR/lint-non-uppercase-statics.rs:6:12 | -LL | static mut bar: isize = 1; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | static mut bar: isize = 1; //~ ERROR static variable `bar` should have an upper case name + | ^^^ help: convert the identifier to upper case: `BAR` error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-nonstandard-style-unicode.rs b/src/test/ui/lint/lint-nonstandard-style-unicode.rs new file mode 100644 index 00000000000..a0b4130c3e9 --- /dev/null +++ b/src/test/ui/lint/lint-nonstandard-style-unicode.rs @@ -0,0 +1,16 @@ +// compile-pass + +#![allow(dead_code)] + +#![forbid(non_camel_case_types)] +#![forbid(non_upper_case_globals)] +#![feature(non_ascii_idents)] + +// Some scripts (e.g., hiragana) don't have a concept of +// upper/lowercase + +struct ヒ; + +static ラ: usize = 0; + +pub fn main() {} diff --git a/src/test/ui/lint/lint-obsolete-attr.rs b/src/test/ui/lint/lint-obsolete-attr.rs index b234f08d04a..149948b5a6d 100644 --- a/src/test/ui/lint/lint-obsolete-attr.rs +++ b/src/test/ui/lint/lint-obsolete-attr.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. diff --git a/src/test/ui/lint/lint-obsolete-attr.stderr b/src/test/ui/lint/lint-obsolete-attr.stderr index 4a8a55e260e..c71bde54acf 100644 --- a/src/test/ui/lint/lint-obsolete-attr.stderr +++ b/src/test/ui/lint/lint-obsolete-attr.stderr @@ -1,17 +1,17 @@ error: unused attribute - --> $DIR/lint-obsolete-attr.rs:18:1 + --> $DIR/lint-obsolete-attr.rs:8:1 | LL | #[ab_isize="stdcall"] extern {} //~ ERROR unused attribute | ^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-obsolete-attr.rs:14:9 + --> $DIR/lint-obsolete-attr.rs:4:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/lint-obsolete-attr.rs:20:1 + --> $DIR/lint-obsolete-attr.rs:10:1 | LL | #[fixed_stack_segment] fn f() {} //~ ERROR unused attribute | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-output-format-2.rs b/src/test/ui/lint/lint-output-format-2.rs index d29019309ab..c9b33f06e21 100644 --- a/src/test/ui/lint/lint-output-format-2.rs +++ b/src/test/ui/lint/lint-output-format-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lint_output_format.rs #![feature(unstable_test_feature)] diff --git a/src/test/ui/lint/lint-output-format-2.stderr b/src/test/ui/lint/lint-output-format-2.stderr index a5718fd74b3..f4e6b062034 100644 --- a/src/test/ui/lint/lint-output-format-2.stderr +++ b/src/test/ui/lint/lint-output-format-2.stderr @@ -1,5 +1,5 @@ warning: use of deprecated item 'lint_output_format::foo': text - --> $DIR/lint-output-format-2.rs:17:26 + --> $DIR/lint-output-format-2.rs:7:26 | LL | use lint_output_format::{foo, bar}; | ^^^ @@ -7,7 +7,7 @@ LL | use lint_output_format::{foo, bar}; = note: #[warn(deprecated)] on by default warning: use of deprecated item 'lint_output_format::foo': text - --> $DIR/lint-output-format-2.rs:22:14 + --> $DIR/lint-output-format-2.rs:12:14 | LL | let _x = foo(); | ^^^ diff --git a/src/test/ui/lint/lint-output-format.rs b/src/test/ui/lint/lint-output-format.rs index 81e0b708b87..169a98c9483 100644 --- a/src/test/ui/lint/lint-output-format.rs +++ b/src/test/ui/lint/lint-output-format.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -F unused_features // aux-build:lint_output_format.rs diff --git a/src/test/ui/lint/lint-output-format.stderr b/src/test/ui/lint/lint-output-format.stderr index bcc279929c6..4dcd8c23164 100644 --- a/src/test/ui/lint/lint-output-format.stderr +++ b/src/test/ui/lint/lint-output-format.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-output-format.rs:16:1 + --> $DIR/lint-output-format.rs:6:1 | LL | extern crate lint_output_format; //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | extern crate lint_output_format; //~ ERROR use of unstable library feature = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-output-format.rs:17:31 + --> $DIR/lint-output-format.rs:7:31 | LL | use lint_output_format::{foo, bar}; //~ ERROR use of unstable library feature | ^^^ @@ -15,7 +15,7 @@ LL | use lint_output_format::{foo, bar}; //~ ERROR use of unstable library featu = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-output-format.rs:21:14 + --> $DIR/lint-output-format.rs:11:14 | LL | let _y = bar(); //~ ERROR use of unstable library feature | ^^^ diff --git a/src/test/ui/lint/lint-owned-heap-memory.rs b/src/test/ui/lint/lint-owned-heap-memory.rs index 9c68da8beaf..7ef18c28c1a 100644 --- a/src/test/ui/lint/lint-owned-heap-memory.rs +++ b/src/test/ui/lint/lint-owned-heap-memory.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![forbid(box_pointers)] #![feature(box_syntax)] diff --git a/src/test/ui/lint/lint-owned-heap-memory.stderr b/src/test/ui/lint/lint-owned-heap-memory.stderr index 5b61d30fd39..572b82b3366 100644 --- a/src/test/ui/lint/lint-owned-heap-memory.stderr +++ b/src/test/ui/lint/lint-owned-heap-memory.stderr @@ -1,17 +1,17 @@ error: type uses owned (Box type) pointers: std::boxed::Box - --> $DIR/lint-owned-heap-memory.rs:16:5 + --> $DIR/lint-owned-heap-memory.rs:6:5 | LL | x: Box //~ ERROR type uses owned | ^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-owned-heap-memory.rs:12:11 + --> $DIR/lint-owned-heap-memory.rs:2:11 | LL | #![forbid(box_pointers)] | ^^^^^^^^^^^^ error: type uses owned (Box type) pointers: std::boxed::Box - --> $DIR/lint-owned-heap-memory.rs:20:29 + --> $DIR/lint-owned-heap-memory.rs:10:29 | LL | let _x : Foo = Foo {x : box 10}; | ^^^^^^ diff --git a/src/test/ui/lint/lint-qualification.rs b/src/test/ui/lint/lint-qualification.rs index 57c2166565f..2aa4526b816 100644 --- a/src/test/ui/lint/lint-qualification.rs +++ b/src/test/ui/lint/lint-qualification.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused_qualifications)] mod foo { diff --git a/src/test/ui/lint/lint-qualification.stderr b/src/test/ui/lint/lint-qualification.stderr index f4c8186caf7..953ff0f5f65 100644 --- a/src/test/ui/lint/lint-qualification.stderr +++ b/src/test/ui/lint/lint-qualification.stderr @@ -1,11 +1,11 @@ error: unnecessary qualification - --> $DIR/lint-qualification.rs:19:5 + --> $DIR/lint-qualification.rs:9:5 | LL | foo::bar(); //~ ERROR: unnecessary qualification | ^^^^^^^^ | note: lint level defined here - --> $DIR/lint-qualification.rs:11:9 + --> $DIR/lint-qualification.rs:1:9 | LL | #![deny(unused_qualifications)] | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-removed-allow.rs b/src/test/ui/lint/lint-removed-allow.rs index 9f84190ea18..30ba4f02f06 100644 --- a/src/test/ui/lint/lint-removed-allow.rs +++ b/src/test/ui/lint/lint-removed-allow.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // No warnings about removed lint when // allow(renamed_and_removed_lints) diff --git a/src/test/ui/lint/lint-removed-allow.stderr b/src/test/ui/lint/lint-removed-allow.stderr index 8f4c757e54b..f796a14d637 100644 --- a/src/test/ui/lint/lint-removed-allow.stderr +++ b/src/test/ui/lint/lint-removed-allow.stderr @@ -1,11 +1,11 @@ error: unused variable: `unused` - --> $DIR/lint-removed-allow.rs:18:17 + --> $DIR/lint-removed-allow.rs:8:17 | LL | fn main() { let unused = (); } //~ ERROR unused - | ^^^^^^ help: consider using `_unused` instead + | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here - --> $DIR/lint-removed-allow.rs:17:8 + --> $DIR/lint-removed-allow.rs:7:8 | LL | #[deny(unused_variables)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-removed-cmdline.rs b/src/test/ui/lint/lint-removed-cmdline.rs index 09725b20146..462beabb945 100644 --- a/src/test/ui/lint/lint-removed-cmdline.rs +++ b/src/test/ui/lint/lint-removed-cmdline.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The raw_pointer_derived lint warns about its removal // cc #30346 diff --git a/src/test/ui/lint/lint-removed-cmdline.stderr b/src/test/ui/lint/lint-removed-cmdline.stderr index 86faeec9542..d46ef6b9237 100644 --- a/src/test/ui/lint/lint-removed-cmdline.stderr +++ b/src/test/ui/lint/lint-removed-cmdline.stderr @@ -3,13 +3,13 @@ warning: lint `raw_pointer_derive` has been removed: `using derive with raw poin = note: requested on the command line with `-D raw_pointer_derive` error: unused variable: `unused` - --> $DIR/lint-removed-cmdline.rs:22:17 + --> $DIR/lint-removed-cmdline.rs:12:17 | LL | fn main() { let unused = (); } - | ^^^^^^ help: consider using `_unused` instead + | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here - --> $DIR/lint-removed-cmdline.rs:21:8 + --> $DIR/lint-removed-cmdline.rs:11:8 | LL | #[deny(warnings)] | ^^^^^^^^ diff --git a/src/test/ui/lint/lint-removed.rs b/src/test/ui/lint/lint-removed.rs index 4e53852008f..92f4372c2bc 100644 --- a/src/test/ui/lint/lint-removed.rs +++ b/src/test/ui/lint/lint-removed.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The raw_pointer_derived lint was removed, but is now reported by // the renamed_and_removed_lints lint, which means it's a warning by // default, and allowed in cargo dependency builds. diff --git a/src/test/ui/lint/lint-removed.stderr b/src/test/ui/lint/lint-removed.stderr index 7d66186f349..55f010348fe 100644 --- a/src/test/ui/lint/lint-removed.stderr +++ b/src/test/ui/lint/lint-removed.stderr @@ -1,5 +1,5 @@ warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok` - --> $DIR/lint-removed.rs:16:8 + --> $DIR/lint-removed.rs:6:8 | LL | #[deny(raw_pointer_derive)] //~ WARN `raw_pointer_derive` has been removed | ^^^^^^^^^^^^^^^^^^ @@ -7,13 +7,13 @@ LL | #[deny(raw_pointer_derive)] //~ WARN `raw_pointer_derive` has been removed = note: #[warn(renamed_and_removed_lints)] on by default error: unused variable: `unused` - --> $DIR/lint-removed.rs:18:17 + --> $DIR/lint-removed.rs:8:17 | LL | fn main() { let unused = (); } //~ ERROR unused - | ^^^^^^ help: consider using `_unused` instead + | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here - --> $DIR/lint-removed.rs:17:8 + --> $DIR/lint-removed.rs:7:8 | LL | #[deny(unused_variables)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-renamed-allow.rs b/src/test/ui/lint/lint-renamed-allow.rs index f6b94e89826..9cf6f329c6c 100644 --- a/src/test/ui/lint/lint-renamed-allow.rs +++ b/src/test/ui/lint/lint-renamed-allow.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // No warnings about renamed lint when // allow(renamed_and_removed_lints) diff --git a/src/test/ui/lint/lint-renamed-allow.stderr b/src/test/ui/lint/lint-renamed-allow.stderr index 6b2eb272701..b2eeeae8f8e 100644 --- a/src/test/ui/lint/lint-renamed-allow.stderr +++ b/src/test/ui/lint/lint-renamed-allow.stderr @@ -1,11 +1,11 @@ error: unused variable: `unused` - --> $DIR/lint-renamed-allow.rs:18:17 + --> $DIR/lint-renamed-allow.rs:8:17 | LL | fn main() { let unused = (); } //~ ERROR unused - | ^^^^^^ help: consider using `_unused` instead + | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here - --> $DIR/lint-renamed-allow.rs:17:8 + --> $DIR/lint-renamed-allow.rs:7:8 | LL | #[deny(unused)] | ^^^^^^ diff --git a/src/test/ui/lint/lint-renamed-cmdline.rs b/src/test/ui/lint/lint-renamed-cmdline.rs index f5abf2733b9..c873771e308 100644 --- a/src/test/ui/lint/lint-renamed-cmdline.rs +++ b/src/test/ui/lint/lint-renamed-cmdline.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-D bare_trait_object // error-pattern:lint `bare_trait_object` has been renamed to `bare_trait_objects` diff --git a/src/test/ui/lint/lint-renamed-cmdline.stderr b/src/test/ui/lint/lint-renamed-cmdline.stderr index 5e154a0033d..6247ee0aff8 100644 --- a/src/test/ui/lint/lint-renamed-cmdline.stderr +++ b/src/test/ui/lint/lint-renamed-cmdline.stderr @@ -3,13 +3,13 @@ warning: lint `bare_trait_object` has been renamed to `bare_trait_objects` = note: requested on the command line with `-D bare_trait_object` error: unused variable: `unused` - --> $DIR/lint-renamed-cmdline.rs:18:17 + --> $DIR/lint-renamed-cmdline.rs:8:17 | LL | fn main() { let unused = (); } - | ^^^^^^ help: consider using `_unused` instead + | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here - --> $DIR/lint-renamed-cmdline.rs:17:8 + --> $DIR/lint-renamed-cmdline.rs:7:8 | LL | #[deny(unused)] | ^^^^^^ diff --git a/src/test/ui/lint/lint-renamed.rs b/src/test/ui/lint/lint-renamed.rs index c147ec5cf95..ca329943053 100644 --- a/src/test/ui/lint/lint-renamed.rs +++ b/src/test/ui/lint/lint-renamed.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[deny(bare_trait_object)] //~^ WARN lint `bare_trait_object` has been renamed to `bare_trait_objects` #[deny(unused)] diff --git a/src/test/ui/lint/lint-renamed.stderr b/src/test/ui/lint/lint-renamed.stderr index a87efc9e92c..b140a93ab38 100644 --- a/src/test/ui/lint/lint-renamed.stderr +++ b/src/test/ui/lint/lint-renamed.stderr @@ -1,5 +1,5 @@ warning: lint `bare_trait_object` has been renamed to `bare_trait_objects` - --> $DIR/lint-renamed.rs:11:8 + --> $DIR/lint-renamed.rs:1:8 | LL | #[deny(bare_trait_object)] | ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects` @@ -7,13 +7,13 @@ LL | #[deny(bare_trait_object)] = note: #[warn(renamed_and_removed_lints)] on by default error: unused variable: `unused` - --> $DIR/lint-renamed.rs:14:17 + --> $DIR/lint-renamed.rs:4:17 | LL | fn main() { let unused = (); } //~ ERROR unused - | ^^^^^^ help: consider using `_unused` instead + | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here - --> $DIR/lint-renamed.rs:13:8 + --> $DIR/lint-renamed.rs:3:8 | LL | #[deny(unused)] | ^^^^^^ diff --git a/src/test/ui/lint/lint-shorthand-field.rs b/src/test/ui/lint/lint-shorthand-field.rs index 1e37ac0dc58..5e756d14dc8 100644 --- a/src/test/ui/lint/lint-shorthand-field.rs +++ b/src/test/ui/lint/lint-shorthand-field.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(nonstandard_style, unused_variables)] #![deny(non_shorthand_field_patterns)] diff --git a/src/test/ui/lint/lint-shorthand-field.stderr b/src/test/ui/lint/lint-shorthand-field.stderr index 516be532f5d..32c69fdddcb 100644 --- a/src/test/ui/lint/lint-shorthand-field.stderr +++ b/src/test/ui/lint/lint-shorthand-field.stderr @@ -1,5 +1,5 @@ error: the `x:` in this pattern is redundant - --> $DIR/lint-shorthand-field.rs:22:13 + --> $DIR/lint-shorthand-field.rs:12:13 | LL | x: x, //~ ERROR the `x:` in this pattern is redundant | --^^ @@ -7,13 +7,13 @@ LL | x: x, //~ ERROR the `x:` in this pattern is redundant | help: remove this | note: lint level defined here - --> $DIR/lint-shorthand-field.rs:12:9 + --> $DIR/lint-shorthand-field.rs:2:9 | LL | #![deny(non_shorthand_field_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `y:` in this pattern is redundant - --> $DIR/lint-shorthand-field.rs:23:13 + --> $DIR/lint-shorthand-field.rs:13:13 | LL | y: ref y, //~ ERROR the `y:` in this pattern is redundant | --^^^^^^ diff --git a/src/test/ui/lint/lint-stability-2.rs b/src/test/ui/lint/lint-stability-2.rs index 1f2fa077caf..12e7b086d35 100644 --- a/src/test/ui/lint/lint-stability-2.rs +++ b/src/test/ui/lint/lint-stability-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lint_stability.rs // aux-build:stability_cfg1.rs diff --git a/src/test/ui/lint/lint-stability-2.stderr b/src/test/ui/lint/lint-stability-2.stderr index e87e0514433..4142ce5af79 100644 --- a/src/test/ui/lint/lint-stability-2.stderr +++ b/src/test/ui/lint/lint-stability-2.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:50:13 + --> $DIR/lint-stability-2.rs:40:13 | LL | foo.method_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | foo.method_deprecated_unstable(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:52:9 + --> $DIR/lint-stability-2.rs:42:9 | LL | Foo::method_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | Foo::method_deprecated_unstable(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:54:9 + --> $DIR/lint-stability-2.rs:44:9 | LL | ::method_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | ::method_deprecated_unstable(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:56:13 + --> $DIR/lint-stability-2.rs:46:13 | LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | foo.trait_deprecated_unstable(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:58:9 + --> $DIR/lint-stability-2.rs:48:9 | LL | ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | ::trait_deprecated_unstable(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:61:13 + --> $DIR/lint-stability-2.rs:51:13 | LL | foo.method_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | foo.method_deprecated_unstable_text(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:63:9 + --> $DIR/lint-stability-2.rs:53:9 | LL | Foo::method_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | Foo::method_deprecated_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:65:9 + --> $DIR/lint-stability-2.rs:55:9 | LL | ::method_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ LL | ::method_deprecated_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:67:13 + --> $DIR/lint-stability-2.rs:57:13 | LL | foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ LL | foo.trait_deprecated_unstable_text(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:69:9 + --> $DIR/lint-stability-2.rs:59:9 | LL | ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ LL | ::trait_deprecated_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:72:13 + --> $DIR/lint-stability-2.rs:62:13 | LL | foo.method_unstable(); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^ @@ -87,7 +87,7 @@ LL | foo.method_unstable(); //~ ERROR use of unstable library feature = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:73:9 + --> $DIR/lint-stability-2.rs:63:9 | LL | Foo::method_unstable(&foo); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ LL | Foo::method_unstable(&foo); //~ ERROR use of unstable library featu = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:74:9 + --> $DIR/lint-stability-2.rs:64:9 | LL | ::method_unstable(&foo); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | ::method_unstable(&foo); //~ ERROR use of unstable library fea = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:75:13 + --> $DIR/lint-stability-2.rs:65:13 | LL | foo.trait_unstable(); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ LL | foo.trait_unstable(); //~ ERROR use of unstable library feature = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:76:9 + --> $DIR/lint-stability-2.rs:66:9 | LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feat = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability-2.rs:78:13 + --> $DIR/lint-stability-2.rs:68:13 | LL | foo.method_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^ @@ -127,7 +127,7 @@ LL | foo.method_unstable_text(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability-2.rs:80:9 + --> $DIR/lint-stability-2.rs:70:9 | LL | Foo::method_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -135,7 +135,7 @@ LL | Foo::method_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability-2.rs:82:9 + --> $DIR/lint-stability-2.rs:72:9 | LL | ::method_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -143,7 +143,7 @@ LL | ::method_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability-2.rs:84:13 + --> $DIR/lint-stability-2.rs:74:13 | LL | foo.trait_unstable_text(); | ^^^^^^^^^^^^^^^^^^^ @@ -151,7 +151,7 @@ LL | foo.trait_unstable_text(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability-2.rs:86:9 + --> $DIR/lint-stability-2.rs:76:9 | LL | ::trait_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -159,7 +159,7 @@ LL | ::trait_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:141:13 + --> $DIR/lint-stability-2.rs:131:13 | LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -167,7 +167,7 @@ LL | foo.trait_deprecated_unstable(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:143:9 + --> $DIR/lint-stability-2.rs:133:9 | LL | ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -175,7 +175,7 @@ LL | ::trait_deprecated_unstable(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:145:13 + --> $DIR/lint-stability-2.rs:135:13 | LL | foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -183,7 +183,7 @@ LL | foo.trait_deprecated_unstable_text(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:147:9 + --> $DIR/lint-stability-2.rs:137:9 | LL | ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -191,7 +191,7 @@ LL | ::trait_deprecated_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:149:13 + --> $DIR/lint-stability-2.rs:139:13 | LL | foo.trait_unstable(); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^ @@ -199,7 +199,7 @@ LL | foo.trait_unstable(); //~ ERROR use of unstable library feature = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:150:9 + --> $DIR/lint-stability-2.rs:140:9 | LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^ @@ -207,7 +207,7 @@ LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feat = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability-2.rs:151:13 + --> $DIR/lint-stability-2.rs:141:13 | LL | foo.trait_unstable_text(); | ^^^^^^^^^^^^^^^^^^^ @@ -215,7 +215,7 @@ LL | foo.trait_unstable_text(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability-2.rs:153:9 + --> $DIR/lint-stability-2.rs:143:9 | LL | ::trait_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -223,7 +223,7 @@ LL | ::trait_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:164:13 + --> $DIR/lint-stability-2.rs:154:13 | LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -231,7 +231,7 @@ LL | foo.trait_deprecated_unstable(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:166:13 + --> $DIR/lint-stability-2.rs:156:13 | LL | foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -239,7 +239,7 @@ LL | foo.trait_deprecated_unstable_text(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-2.rs:168:13 + --> $DIR/lint-stability-2.rs:158:13 | LL | foo.trait_unstable(); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^ @@ -247,7 +247,7 @@ LL | foo.trait_unstable(); //~ ERROR use of unstable library feature = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability-2.rs:169:13 + --> $DIR/lint-stability-2.rs:159:13 | LL | foo.trait_unstable_text(); | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-stability-deprecated.rs b/src/test/ui/lint/lint-stability-deprecated.rs index 459eaa14737..8f6425bcc77 100644 --- a/src/test/ui/lint/lint-stability-deprecated.rs +++ b/src/test/ui/lint/lint-stability-deprecated.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // aux-build:lint_stability.rs // aux-build:inherited_stability.rs diff --git a/src/test/ui/lint/lint-stability-deprecated.stderr b/src/test/ui/lint/lint-stability-deprecated.stderr index a763a994a88..a1748ac59fb 100644 --- a/src/test/ui/lint/lint-stability-deprecated.stderr +++ b/src/test/ui/lint/lint-stability-deprecated.stderr @@ -1,635 +1,635 @@ warning: use of deprecated item 'lint_stability::deprecated': text - --> $DIR/lint-stability-deprecated.rs:36:9 + --> $DIR/lint-stability-deprecated.rs:26:9 | LL | deprecated(); //~ WARN use of deprecated item 'lint_stability::deprecated' | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-stability-deprecated.rs:17:9 + --> $DIR/lint-stability-deprecated.rs:7:9 | LL | #![warn(deprecated)] | ^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:41:9 + --> $DIR/lint-stability-deprecated.rs:31:9 | LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:43:9 + --> $DIR/lint-stability-deprecated.rs:33:9 | LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:45:9 + --> $DIR/lint-stability-deprecated.rs:35:9 | LL | deprecated_text(); //~ WARN use of deprecated item 'lint_stability::deprecated_text': text | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:50:9 + --> $DIR/lint-stability-deprecated.rs:40:9 | LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:52:9 + --> $DIR/lint-stability-deprecated.rs:42:9 | LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:54:9 + --> $DIR/lint-stability-deprecated.rs:44:9 | LL | deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:59:9 + --> $DIR/lint-stability-deprecated.rs:49:9 | LL | Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:61:9 + --> $DIR/lint-stability-deprecated.rs:51:9 | LL | ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:63:9 + --> $DIR/lint-stability-deprecated.rs:53:9 | LL | deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:68:9 + --> $DIR/lint-stability-deprecated.rs:58:9 | LL | Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:70:9 + --> $DIR/lint-stability-deprecated.rs:60:9 | LL | ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedStruct': text - --> $DIR/lint-stability-deprecated.rs:117:17 + --> $DIR/lint-stability-deprecated.rs:107:17 | LL | let _ = DeprecatedStruct { //~ WARN use of deprecated item 'lint_stability::DeprecatedStruct' | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnstableStruct': text - --> $DIR/lint-stability-deprecated.rs:120:17 + --> $DIR/lint-stability-deprecated.rs:110:17 | LL | let _ = DeprecatedUnstableStruct { | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnitStruct': text - --> $DIR/lint-stability-deprecated.rs:127:17 + --> $DIR/lint-stability-deprecated.rs:117:17 | LL | let _ = DeprecatedUnitStruct; //~ WARN use of deprecated item 'lint_stability::DeprecatedUnitStruct' | ^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnstableUnitStruct': text - --> $DIR/lint-stability-deprecated.rs:128:17 + --> $DIR/lint-stability-deprecated.rs:118:17 | LL | let _ = DeprecatedUnstableUnitStruct; //~ WARN use of deprecated item 'lint_stability::DeprecatedUnstableUnitStruct' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Enum::DeprecatedVariant': text - --> $DIR/lint-stability-deprecated.rs:132:17 + --> $DIR/lint-stability-deprecated.rs:122:17 | LL | let _ = Enum::DeprecatedVariant; //~ WARN use of deprecated item 'lint_stability::Enum::DeprecatedVariant' | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Enum::DeprecatedUnstableVariant': text - --> $DIR/lint-stability-deprecated.rs:133:17 + --> $DIR/lint-stability-deprecated.rs:123:17 | LL | let _ = Enum::DeprecatedUnstableVariant; //~ WARN use of deprecated item 'lint_stability::Enum::DeprecatedUnstableVariant' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedTupleStruct': text - --> $DIR/lint-stability-deprecated.rs:137:17 + --> $DIR/lint-stability-deprecated.rs:127:17 | LL | let _ = DeprecatedTupleStruct (1); //~ WARN use of deprecated item 'lint_stability::DeprecatedTupleStruct' | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnstableTupleStruct': text - --> $DIR/lint-stability-deprecated.rs:138:17 + --> $DIR/lint-stability-deprecated.rs:128:17 | LL | let _ = DeprecatedUnstableTupleStruct (1); //~ WARN use of deprecated item 'lint_stability::DeprecatedUnstableTupleStruct' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:147:25 + --> $DIR/lint-stability-deprecated.rs:137:25 | LL | macro_test_arg!(deprecated_text()); //~ WARN use of deprecated item 'lint_stability::deprecated_text': text | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:148:25 + --> $DIR/lint-stability-deprecated.rs:138:25 | LL | macro_test_arg!(deprecated_unstable_text()); //~ WARN use of deprecated item 'lint_stability::deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:149:41 + --> $DIR/lint-stability-deprecated.rs:139:41 | LL | macro_test_arg!(macro_test_arg!(deprecated_text())); //~ WARN use of deprecated item 'lint_stability::deprecated_text': text | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:154:9 + --> $DIR/lint-stability-deprecated.rs:144:9 | LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:156:9 + --> $DIR/lint-stability-deprecated.rs:146:9 | LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:158:9 + --> $DIR/lint-stability-deprecated.rs:148:9 | LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:160:9 + --> $DIR/lint-stability-deprecated.rs:150:9 | LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:162:9 + --> $DIR/lint-stability-deprecated.rs:152:9 | LL | Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:164:9 + --> $DIR/lint-stability-deprecated.rs:154:9 | LL | ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:166:9 + --> $DIR/lint-stability-deprecated.rs:156:9 | LL | Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:168:9 + --> $DIR/lint-stability-deprecated.rs:158:9 | LL | ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedTrait': text - --> $DIR/lint-stability-deprecated.rs:196:10 + --> $DIR/lint-stability-deprecated.rs:186:10 | LL | impl DeprecatedTrait for S {} //~ WARN use of deprecated item 'lint_stability::DeprecatedTrait': text | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedTrait': text - --> $DIR/lint-stability-deprecated.rs:198:25 + --> $DIR/lint-stability-deprecated.rs:188:25 | LL | trait LocalTrait2 : DeprecatedTrait { } //~ WARN use of deprecated item 'lint_stability::DeprecatedTrait': text | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'inheritance::inherited_stability::unstable_mod::deprecated': text - --> $DIR/lint-stability-deprecated.rs:217:9 + --> $DIR/lint-stability-deprecated.rs:207:9 | LL | unstable_mod::deprecated(); //~ WARN use of deprecated item 'inheritance::inherited_stability::unstable_mod::deprecated': text | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::deprecated': text - --> $DIR/lint-stability-deprecated.rs:339:9 + --> $DIR/lint-stability-deprecated.rs:329:9 | LL | deprecated(); //~ WARN use of deprecated item 'this_crate::deprecated' | ^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:344:9 + --> $DIR/lint-stability-deprecated.rs:334:9 | LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:346:9 + --> $DIR/lint-stability-deprecated.rs:336:9 | LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:348:9 + --> $DIR/lint-stability-deprecated.rs:338:9 | LL | deprecated_text(); //~ WARN use of deprecated item 'this_crate::deprecated_text': text | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:353:9 + --> $DIR/lint-stability-deprecated.rs:343:9 | LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:355:9 + --> $DIR/lint-stability-deprecated.rs:345:9 | LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedStruct': text - --> $DIR/lint-stability-deprecated.rs:393:17 + --> $DIR/lint-stability-deprecated.rs:383:17 | LL | let _ = DeprecatedStruct { | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedUnitStruct': text - --> $DIR/lint-stability-deprecated.rs:400:17 + --> $DIR/lint-stability-deprecated.rs:390:17 | LL | let _ = DeprecatedUnitStruct; //~ WARN use of deprecated item 'this_crate::DeprecatedUnitStruct' | ^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Enum::DeprecatedVariant': text - --> $DIR/lint-stability-deprecated.rs:404:17 + --> $DIR/lint-stability-deprecated.rs:394:17 | LL | let _ = Enum::DeprecatedVariant; //~ WARN use of deprecated item 'this_crate::Enum::DeprecatedVariant' | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedTupleStruct': text - --> $DIR/lint-stability-deprecated.rs:408:17 + --> $DIR/lint-stability-deprecated.rs:398:17 | LL | let _ = DeprecatedTupleStruct (1); //~ WARN use of deprecated item 'this_crate::DeprecatedTupleStruct' | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:415:9 + --> $DIR/lint-stability-deprecated.rs:405:9 | LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:417:9 + --> $DIR/lint-stability-deprecated.rs:407:9 | LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:419:9 + --> $DIR/lint-stability-deprecated.rs:409:9 | LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:421:9 + --> $DIR/lint-stability-deprecated.rs:411:9 | LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::test_fn_body::fn_in_body': text - --> $DIR/lint-stability-deprecated.rs:448:9 + --> $DIR/lint-stability-deprecated.rs:438:9 | LL | fn_in_body(); //~ WARN use of deprecated item 'this_crate::test_fn_body::fn_in_body': text | ^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedTrait': text - --> $DIR/lint-stability-deprecated.rs:468:10 + --> $DIR/lint-stability-deprecated.rs:458:10 | LL | impl DeprecatedTrait for S { } //~ WARN use of deprecated item 'this_crate::DeprecatedTrait' | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedTrait': text - --> $DIR/lint-stability-deprecated.rs:470:24 + --> $DIR/lint-stability-deprecated.rs:460:24 | LL | trait LocalTrait : DeprecatedTrait { } //~ WARN use of deprecated item 'this_crate::DeprecatedTrait' | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::test_method_body::fn_in_body': text - --> $DIR/lint-stability-deprecated.rs:456:13 + --> $DIR/lint-stability-deprecated.rs:446:13 | LL | fn_in_body(); //~ WARN use of deprecated item 'this_crate::MethodTester::test_method_body::fn_in_body': text | ^^^^^^^^^^ warning: use of deprecated item 'lint_stability::TraitWithAssociatedTypes::TypeDeprecated': text - --> $DIR/lint-stability-deprecated.rs:109:48 + --> $DIR/lint-stability-deprecated.rs:99:48 | LL | struct S2(T::TypeDeprecated); | ^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::TraitWithAssociatedTypes::TypeDeprecated': text - --> $DIR/lint-stability-deprecated.rs:113:13 + --> $DIR/lint-stability-deprecated.rs:103:13 | LL | TypeDeprecated = u16, | ^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated': text - --> $DIR/lint-stability-deprecated.rs:37:13 + --> $DIR/lint-stability-deprecated.rs:27:13 | LL | foo.method_deprecated(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated' | ^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated': text - --> $DIR/lint-stability-deprecated.rs:38:9 + --> $DIR/lint-stability-deprecated.rs:28:9 | LL | Foo::method_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated': text - --> $DIR/lint-stability-deprecated.rs:39:9 + --> $DIR/lint-stability-deprecated.rs:29:9 | LL | ::method_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:40:13 + --> $DIR/lint-stability-deprecated.rs:30:13 | LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:42:9 + --> $DIR/lint-stability-deprecated.rs:32:9 | LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:46:13 + --> $DIR/lint-stability-deprecated.rs:36:13 | LL | foo.method_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:47:9 + --> $DIR/lint-stability-deprecated.rs:37:9 | LL | Foo::method_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:48:9 + --> $DIR/lint-stability-deprecated.rs:38:9 | LL | ::method_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:49:13 + --> $DIR/lint-stability-deprecated.rs:39:13 | LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:51:9 + --> $DIR/lint-stability-deprecated.rs:41:9 | LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:55:13 + --> $DIR/lint-stability-deprecated.rs:45:13 | LL | foo.method_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:56:9 + --> $DIR/lint-stability-deprecated.rs:46:9 | LL | Foo::method_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:57:9 + --> $DIR/lint-stability-deprecated.rs:47:9 | LL | ::method_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:58:13 + --> $DIR/lint-stability-deprecated.rs:48:13 | LL | foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:60:9 + --> $DIR/lint-stability-deprecated.rs:50:9 | LL | ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:64:13 + --> $DIR/lint-stability-deprecated.rs:54:13 | LL | foo.method_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:65:9 + --> $DIR/lint-stability-deprecated.rs:55:9 | LL | Foo::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:66:9 + --> $DIR/lint-stability-deprecated.rs:56:9 | LL | ::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:67:13 + --> $DIR/lint-stability-deprecated.rs:57:13 | LL | foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:69:9 + --> $DIR/lint-stability-deprecated.rs:59:9 | LL | ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedStruct::i': text - --> $DIR/lint-stability-deprecated.rs:118:13 + --> $DIR/lint-stability-deprecated.rs:108:13 | LL | i: 0 //~ WARN use of deprecated item 'lint_stability::DeprecatedStruct::i' | ^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnstableStruct::i': text - --> $DIR/lint-stability-deprecated.rs:122:13 + --> $DIR/lint-stability-deprecated.rs:112:13 | LL | i: 0 //~ WARN use of deprecated item 'lint_stability::DeprecatedUnstableStruct::i' | ^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:153:13 + --> $DIR/lint-stability-deprecated.rs:143:13 | LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:155:9 + --> $DIR/lint-stability-deprecated.rs:145:9 | LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:157:13 + --> $DIR/lint-stability-deprecated.rs:147:13 | LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:159:9 + --> $DIR/lint-stability-deprecated.rs:149:9 | LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:161:13 + --> $DIR/lint-stability-deprecated.rs:151:13 | LL | foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:163:9 + --> $DIR/lint-stability-deprecated.rs:153:9 | LL | ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:165:13 + --> $DIR/lint-stability-deprecated.rs:155:13 | LL | foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:167:9 + --> $DIR/lint-stability-deprecated.rs:157:9 | LL | ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:184:13 + --> $DIR/lint-stability-deprecated.rs:174:13 | LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:185:13 + --> $DIR/lint-stability-deprecated.rs:175:13 | LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text - --> $DIR/lint-stability-deprecated.rs:186:13 + --> $DIR/lint-stability-deprecated.rs:176:13 | LL | foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text - --> $DIR/lint-stability-deprecated.rs:187:13 + --> $DIR/lint-stability-deprecated.rs:177:13 | LL | foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated': text - --> $DIR/lint-stability-deprecated.rs:340:13 + --> $DIR/lint-stability-deprecated.rs:330:13 | LL | foo.method_deprecated(); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated' | ^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated': text - --> $DIR/lint-stability-deprecated.rs:341:9 + --> $DIR/lint-stability-deprecated.rs:331:9 | LL | Foo::method_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated': text - --> $DIR/lint-stability-deprecated.rs:342:9 + --> $DIR/lint-stability-deprecated.rs:332:9 | LL | ::method_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:343:13 + --> $DIR/lint-stability-deprecated.rs:333:13 | LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:345:9 + --> $DIR/lint-stability-deprecated.rs:335:9 | LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:349:13 + --> $DIR/lint-stability-deprecated.rs:339:13 | LL | foo.method_deprecated_text(); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:350:9 + --> $DIR/lint-stability-deprecated.rs:340:9 | LL | Foo::method_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:351:9 + --> $DIR/lint-stability-deprecated.rs:341:9 | LL | ::method_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:352:13 + --> $DIR/lint-stability-deprecated.rs:342:13 | LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:354:9 + --> $DIR/lint-stability-deprecated.rs:344:9 | LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedStruct::i': text - --> $DIR/lint-stability-deprecated.rs:395:13 + --> $DIR/lint-stability-deprecated.rs:385:13 | LL | i: 0 //~ WARN use of deprecated item 'this_crate::DeprecatedStruct::i' | ^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:414:13 + --> $DIR/lint-stability-deprecated.rs:404:13 | LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:416:9 + --> $DIR/lint-stability-deprecated.rs:406:9 | LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:418:13 + --> $DIR/lint-stability-deprecated.rs:408:13 | LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:420:9 + --> $DIR/lint-stability-deprecated.rs:410:9 | LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text - --> $DIR/lint-stability-deprecated.rs:437:13 + --> $DIR/lint-stability-deprecated.rs:427:13 | LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text - --> $DIR/lint-stability-deprecated.rs:438:13 + --> $DIR/lint-stability-deprecated.rs:428:13 | LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-stability-fields-deprecated.rs b/src/test/ui/lint/lint-stability-fields-deprecated.rs index 0ad4466d0e2..9d5b7c51cc8 100644 --- a/src/test/ui/lint/lint-stability-fields-deprecated.rs +++ b/src/test/ui/lint/lint-stability-fields-deprecated.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lint_stability_fields.rs #![deny(deprecated)] diff --git a/src/test/ui/lint/lint-stability-fields-deprecated.stderr b/src/test/ui/lint/lint-stability-fields-deprecated.stderr index f7bc87ee9d9..488be75ae52 100644 --- a/src/test/ui/lint/lint-stability-fields-deprecated.stderr +++ b/src/test/ui/lint/lint-stability-fields-deprecated.stderr @@ -1,377 +1,377 @@ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated': text - --> $DIR/lint-stability-fields-deprecated.rs:104:17 + --> $DIR/lint-stability-fields-deprecated.rs:94:17 | LL | let x = Deprecated { | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-stability-fields-deprecated.rs:13:9 + --> $DIR/lint-stability-fields-deprecated.rs:3:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated': text - --> $DIR/lint-stability-fields-deprecated.rs:121:13 + --> $DIR/lint-stability-fields-deprecated.rs:111:13 | LL | let Deprecated { | ^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated': text - --> $DIR/lint-stability-fields-deprecated.rs:131:13 + --> $DIR/lint-stability-fields-deprecated.rs:121:13 | LL | let Deprecated | ^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2': text - --> $DIR/lint-stability-fields-deprecated.rs:136:17 + --> $DIR/lint-stability-fields-deprecated.rs:126:17 | LL | let x = Deprecated2(1, 2, 3); | ^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2': text - --> $DIR/lint-stability-fields-deprecated.rs:146:13 + --> $DIR/lint-stability-fields-deprecated.rs:136:13 | LL | let Deprecated2 | ^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2': text - --> $DIR/lint-stability-fields-deprecated.rs:155:13 + --> $DIR/lint-stability-fields-deprecated.rs:145:13 | LL | let Deprecated2 | ^^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated': text - --> $DIR/lint-stability-fields-deprecated.rs:291:17 + --> $DIR/lint-stability-fields-deprecated.rs:281:17 | LL | let x = Deprecated { | ^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated': text - --> $DIR/lint-stability-fields-deprecated.rs:308:13 + --> $DIR/lint-stability-fields-deprecated.rs:298:13 | LL | let Deprecated { | ^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated': text - --> $DIR/lint-stability-fields-deprecated.rs:318:13 + --> $DIR/lint-stability-fields-deprecated.rs:308:13 | LL | let Deprecated | ^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated2': text - --> $DIR/lint-stability-fields-deprecated.rs:323:17 + --> $DIR/lint-stability-fields-deprecated.rs:313:17 | LL | let x = Deprecated2(1, 2, 3); | ^^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated2': text - --> $DIR/lint-stability-fields-deprecated.rs:333:13 + --> $DIR/lint-stability-fields-deprecated.rs:323:13 | LL | let Deprecated2 | ^^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated2': text - --> $DIR/lint-stability-fields-deprecated.rs:342:13 + --> $DIR/lint-stability-fields-deprecated.rs:332:13 | LL | let Deprecated2 | ^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Stable::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:28:13 + --> $DIR/lint-stability-fields-deprecated.rs:18:13 | LL | override2: 3, | ^^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Stable::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:34:17 + --> $DIR/lint-stability-fields-deprecated.rs:24:17 | LL | let _ = x.override2; | ^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Stable::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:40:13 + --> $DIR/lint-stability-fields-deprecated.rs:30:13 | LL | override2: _ | ^^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Stable2::2': text - --> $DIR/lint-stability-fields-deprecated.rs:50:17 + --> $DIR/lint-stability-fields-deprecated.rs:40:17 | LL | let _ = x.2; | ^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Stable2::2': text - --> $DIR/lint-stability-fields-deprecated.rs:55:20 + --> $DIR/lint-stability-fields-deprecated.rs:45:20 | LL | _) | ^ error: use of deprecated item 'cross_crate::lint_stability_fields::Unstable::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:65:13 + --> $DIR/lint-stability-fields-deprecated.rs:55:13 | LL | override2: 3, | ^^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Unstable::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:71:17 + --> $DIR/lint-stability-fields-deprecated.rs:61:17 | LL | let _ = x.override2; | ^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Unstable::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:77:13 + --> $DIR/lint-stability-fields-deprecated.rs:67:13 | LL | override2: _ | ^^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Unstable2::2': text - --> $DIR/lint-stability-fields-deprecated.rs:90:17 + --> $DIR/lint-stability-fields-deprecated.rs:80:17 | LL | let _ = x.2; | ^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Unstable2::2': text - --> $DIR/lint-stability-fields-deprecated.rs:96:14 + --> $DIR/lint-stability-fields-deprecated.rs:86:14 | LL | _) | ^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::inherit': text - --> $DIR/lint-stability-fields-deprecated.rs:106:13 + --> $DIR/lint-stability-fields-deprecated.rs:96:13 | LL | inherit: 1, | ^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::override1': text - --> $DIR/lint-stability-fields-deprecated.rs:108:13 + --> $DIR/lint-stability-fields-deprecated.rs:98:13 | LL | override1: 2, | ^^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:110:13 + --> $DIR/lint-stability-fields-deprecated.rs:100:13 | LL | override2: 3, | ^^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::inherit': text - --> $DIR/lint-stability-fields-deprecated.rs:114:17 + --> $DIR/lint-stability-fields-deprecated.rs:104:17 | LL | let _ = x.inherit; | ^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::override1': text - --> $DIR/lint-stability-fields-deprecated.rs:116:17 + --> $DIR/lint-stability-fields-deprecated.rs:106:17 | LL | let _ = x.override1; | ^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:118:17 + --> $DIR/lint-stability-fields-deprecated.rs:108:17 | LL | let _ = x.override2; | ^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::inherit': text - --> $DIR/lint-stability-fields-deprecated.rs:123:13 + --> $DIR/lint-stability-fields-deprecated.rs:113:13 | LL | inherit: _, | ^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::override1': text - --> $DIR/lint-stability-fields-deprecated.rs:125:13 + --> $DIR/lint-stability-fields-deprecated.rs:115:13 | LL | override1: _, | ^^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:127:13 + --> $DIR/lint-stability-fields-deprecated.rs:117:13 | LL | override2: _ | ^^^^^^^^^^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2::0': text - --> $DIR/lint-stability-fields-deprecated.rs:139:17 + --> $DIR/lint-stability-fields-deprecated.rs:129:17 | LL | let _ = x.0; | ^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2::1': text - --> $DIR/lint-stability-fields-deprecated.rs:141:17 + --> $DIR/lint-stability-fields-deprecated.rs:131:17 | LL | let _ = x.1; | ^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2::2': text - --> $DIR/lint-stability-fields-deprecated.rs:143:17 + --> $DIR/lint-stability-fields-deprecated.rs:133:17 | LL | let _ = x.2; | ^^^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2::0': text - --> $DIR/lint-stability-fields-deprecated.rs:148:14 + --> $DIR/lint-stability-fields-deprecated.rs:138:14 | LL | (_, | ^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2::1': text - --> $DIR/lint-stability-fields-deprecated.rs:150:14 + --> $DIR/lint-stability-fields-deprecated.rs:140:14 | LL | _, | ^ error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2::2': text - --> $DIR/lint-stability-fields-deprecated.rs:152:14 + --> $DIR/lint-stability-fields-deprecated.rs:142:14 | LL | _) | ^ error: use of deprecated item 'this_crate::Stable::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:215:13 + --> $DIR/lint-stability-fields-deprecated.rs:205:13 | LL | override2: 3, | ^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Stable::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:221:17 + --> $DIR/lint-stability-fields-deprecated.rs:211:17 | LL | let _ = x.override2; | ^^^^^^^^^^^ error: use of deprecated item 'this_crate::Stable::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:227:13 + --> $DIR/lint-stability-fields-deprecated.rs:217:13 | LL | override2: _ | ^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Stable2::2': text - --> $DIR/lint-stability-fields-deprecated.rs:237:17 + --> $DIR/lint-stability-fields-deprecated.rs:227:17 | LL | let _ = x.2; | ^^^ error: use of deprecated item 'this_crate::Stable2::2': text - --> $DIR/lint-stability-fields-deprecated.rs:242:20 + --> $DIR/lint-stability-fields-deprecated.rs:232:20 | LL | _) | ^ error: use of deprecated item 'this_crate::Unstable::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:252:13 + --> $DIR/lint-stability-fields-deprecated.rs:242:13 | LL | override2: 3, | ^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Unstable::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:258:17 + --> $DIR/lint-stability-fields-deprecated.rs:248:17 | LL | let _ = x.override2; | ^^^^^^^^^^^ error: use of deprecated item 'this_crate::Unstable::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:264:13 + --> $DIR/lint-stability-fields-deprecated.rs:254:13 | LL | override2: _ | ^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Unstable2::2': text - --> $DIR/lint-stability-fields-deprecated.rs:277:17 + --> $DIR/lint-stability-fields-deprecated.rs:267:17 | LL | let _ = x.2; | ^^^ error: use of deprecated item 'this_crate::Unstable2::2': text - --> $DIR/lint-stability-fields-deprecated.rs:283:14 + --> $DIR/lint-stability-fields-deprecated.rs:273:14 | LL | _) | ^ error: use of deprecated item 'this_crate::Deprecated::inherit': text - --> $DIR/lint-stability-fields-deprecated.rs:293:13 + --> $DIR/lint-stability-fields-deprecated.rs:283:13 | LL | inherit: 1, | ^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated::override1': text - --> $DIR/lint-stability-fields-deprecated.rs:295:13 + --> $DIR/lint-stability-fields-deprecated.rs:285:13 | LL | override1: 2, | ^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:297:13 + --> $DIR/lint-stability-fields-deprecated.rs:287:13 | LL | override2: 3, | ^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated::inherit': text - --> $DIR/lint-stability-fields-deprecated.rs:301:17 + --> $DIR/lint-stability-fields-deprecated.rs:291:17 | LL | let _ = x.inherit; | ^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated::override1': text - --> $DIR/lint-stability-fields-deprecated.rs:303:17 + --> $DIR/lint-stability-fields-deprecated.rs:293:17 | LL | let _ = x.override1; | ^^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:305:17 + --> $DIR/lint-stability-fields-deprecated.rs:295:17 | LL | let _ = x.override2; | ^^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated::inherit': text - --> $DIR/lint-stability-fields-deprecated.rs:310:13 + --> $DIR/lint-stability-fields-deprecated.rs:300:13 | LL | inherit: _, | ^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated::override1': text - --> $DIR/lint-stability-fields-deprecated.rs:312:13 + --> $DIR/lint-stability-fields-deprecated.rs:302:13 | LL | override1: _, | ^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated::override2': text - --> $DIR/lint-stability-fields-deprecated.rs:314:13 + --> $DIR/lint-stability-fields-deprecated.rs:304:13 | LL | override2: _ | ^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Deprecated2::0': text - --> $DIR/lint-stability-fields-deprecated.rs:326:17 + --> $DIR/lint-stability-fields-deprecated.rs:316:17 | LL | let _ = x.0; | ^^^ error: use of deprecated item 'this_crate::Deprecated2::1': text - --> $DIR/lint-stability-fields-deprecated.rs:328:17 + --> $DIR/lint-stability-fields-deprecated.rs:318:17 | LL | let _ = x.1; | ^^^ error: use of deprecated item 'this_crate::Deprecated2::2': text - --> $DIR/lint-stability-fields-deprecated.rs:330:17 + --> $DIR/lint-stability-fields-deprecated.rs:320:17 | LL | let _ = x.2; | ^^^ error: use of deprecated item 'this_crate::Deprecated2::0': text - --> $DIR/lint-stability-fields-deprecated.rs:335:14 + --> $DIR/lint-stability-fields-deprecated.rs:325:14 | LL | (_, | ^ error: use of deprecated item 'this_crate::Deprecated2::1': text - --> $DIR/lint-stability-fields-deprecated.rs:337:14 + --> $DIR/lint-stability-fields-deprecated.rs:327:14 | LL | _, | ^ error: use of deprecated item 'this_crate::Deprecated2::2': text - --> $DIR/lint-stability-fields-deprecated.rs:339:14 + --> $DIR/lint-stability-fields-deprecated.rs:329:14 | LL | _) | ^ diff --git a/src/test/ui/lint/lint-stability-fields.rs b/src/test/ui/lint/lint-stability-fields.rs index db6b64dabfe..9be8710bd4c 100644 --- a/src/test/ui/lint/lint-stability-fields.rs +++ b/src/test/ui/lint/lint-stability-fields.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lint_stability_fields.rs #![allow(deprecated)] #![allow(dead_code)] diff --git a/src/test/ui/lint/lint-stability-fields.stderr b/src/test/ui/lint/lint-stability-fields.stderr index 2f176062c30..93f8075b2b2 100644 --- a/src/test/ui/lint/lint-stability-fields.stderr +++ b/src/test/ui/lint/lint-stability-fields.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:61:17 + --> $DIR/lint-stability-fields.rs:51:17 | LL | let x = Unstable { //~ ERROR use of unstable | ^^^^^^^^ @@ -7,7 +7,7 @@ LL | let x = Unstable { //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:71:13 + --> $DIR/lint-stability-fields.rs:61:13 | LL | let Unstable { //~ ERROR use of unstable | ^^^^^^^^ @@ -15,7 +15,7 @@ LL | let Unstable { //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:77:13 + --> $DIR/lint-stability-fields.rs:67:13 | LL | let Unstable //~ ERROR use of unstable | ^^^^^^^^ @@ -23,7 +23,7 @@ LL | let Unstable //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:82:17 + --> $DIR/lint-stability-fields.rs:72:17 | LL | let x = reexport::Unstable2(1, 2, 3); //~ ERROR use of unstable | ^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | let x = reexport::Unstable2(1, 2, 3); //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:84:17 + --> $DIR/lint-stability-fields.rs:74:17 | LL | let x = Unstable2(1, 2, 3); //~ ERROR use of unstable | ^^^^^^^^^ @@ -39,7 +39,7 @@ LL | let x = Unstable2(1, 2, 3); //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:90:13 + --> $DIR/lint-stability-fields.rs:80:13 | LL | let Unstable2 //~ ERROR use of unstable | ^^^^^^^^^ @@ -47,7 +47,7 @@ LL | let Unstable2 //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:95:13 + --> $DIR/lint-stability-fields.rs:85:13 | LL | let Unstable2 //~ ERROR use of unstable | ^^^^^^^^^ @@ -55,7 +55,7 @@ LL | let Unstable2 //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:100:17 + --> $DIR/lint-stability-fields.rs:90:17 | LL | let x = Deprecated { //~ ERROR use of unstable | ^^^^^^^^^^ @@ -63,7 +63,7 @@ LL | let x = Deprecated { //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:110:13 + --> $DIR/lint-stability-fields.rs:100:13 | LL | let Deprecated { //~ ERROR use of unstable | ^^^^^^^^^^ @@ -71,7 +71,7 @@ LL | let Deprecated { //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:116:13 + --> $DIR/lint-stability-fields.rs:106:13 | LL | let Deprecated //~ ERROR use of unstable | ^^^^^^^^^^ @@ -79,7 +79,7 @@ LL | let Deprecated //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:120:17 + --> $DIR/lint-stability-fields.rs:110:17 | LL | let x = Deprecated2(1, 2, 3); //~ ERROR use of unstable | ^^^^^^^^^^^ @@ -87,7 +87,7 @@ LL | let x = Deprecated2(1, 2, 3); //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:126:13 + --> $DIR/lint-stability-fields.rs:116:13 | LL | let Deprecated2 //~ ERROR use of unstable | ^^^^^^^^^^^ @@ -95,7 +95,7 @@ LL | let Deprecated2 //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:131:13 + --> $DIR/lint-stability-fields.rs:121:13 | LL | let Deprecated2 //~ ERROR use of unstable | ^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | let Deprecated2 //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:31:13 + --> $DIR/lint-stability-fields.rs:21:13 | LL | override1: 2, //~ ERROR use of unstable | ^^^^^^^^^^^^ @@ -111,7 +111,7 @@ LL | override1: 2, //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:32:13 + --> $DIR/lint-stability-fields.rs:22:13 | LL | override2: 3, //~ ERROR use of unstable | ^^^^^^^^^^^^ @@ -119,7 +119,7 @@ LL | override2: 3, //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:36:17 + --> $DIR/lint-stability-fields.rs:26:17 | LL | let _ = x.override1; //~ ERROR use of unstable | ^^^^^^^^^^^ @@ -127,7 +127,7 @@ LL | let _ = x.override1; //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:37:17 + --> $DIR/lint-stability-fields.rs:27:17 | LL | let _ = x.override2; //~ ERROR use of unstable | ^^^^^^^^^^^ @@ -135,7 +135,7 @@ LL | let _ = x.override2; //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:41:13 + --> $DIR/lint-stability-fields.rs:31:13 | LL | override1: _, //~ ERROR use of unstable | ^^^^^^^^^^^^ @@ -143,7 +143,7 @@ LL | override1: _, //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:42:13 + --> $DIR/lint-stability-fields.rs:32:13 | LL | override2: _ //~ ERROR use of unstable | ^^^^^^^^^^^^ @@ -151,7 +151,7 @@ LL | override2: _ //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:50:17 + --> $DIR/lint-stability-fields.rs:40:17 | LL | let _ = x.1; //~ ERROR use of unstable | ^^^ @@ -159,7 +159,7 @@ LL | let _ = x.1; //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:51:17 + --> $DIR/lint-stability-fields.rs:41:17 | LL | let _ = x.2; //~ ERROR use of unstable | ^^^ @@ -167,7 +167,7 @@ LL | let _ = x.2; //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:54:20 + --> $DIR/lint-stability-fields.rs:44:20 | LL | _, //~ ERROR use of unstable | ^ @@ -175,7 +175,7 @@ LL | _, //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:55:20 + --> $DIR/lint-stability-fields.rs:45:20 | LL | _) //~ ERROR use of unstable | ^ @@ -183,7 +183,7 @@ LL | _) //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:62:13 + --> $DIR/lint-stability-fields.rs:52:13 | LL | inherit: 1, //~ ERROR use of unstable | ^^^^^^^^^^ @@ -191,7 +191,7 @@ LL | inherit: 1, //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:64:13 + --> $DIR/lint-stability-fields.rs:54:13 | LL | override2: 3, //~ ERROR use of unstable | ^^^^^^^^^^^^ @@ -199,7 +199,7 @@ LL | override2: 3, //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:67:17 + --> $DIR/lint-stability-fields.rs:57:17 | LL | let _ = x.inherit; //~ ERROR use of unstable | ^^^^^^^^^ @@ -207,7 +207,7 @@ LL | let _ = x.inherit; //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:69:17 + --> $DIR/lint-stability-fields.rs:59:17 | LL | let _ = x.override2; //~ ERROR use of unstable | ^^^^^^^^^^^ @@ -215,7 +215,7 @@ LL | let _ = x.override2; //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:72:13 + --> $DIR/lint-stability-fields.rs:62:13 | LL | inherit: _, //~ ERROR use of unstable | ^^^^^^^^^^ @@ -223,7 +223,7 @@ LL | inherit: _, //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:74:13 + --> $DIR/lint-stability-fields.rs:64:13 | LL | override2: _ //~ ERROR use of unstable | ^^^^^^^^^^^^ @@ -231,7 +231,7 @@ LL | override2: _ //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:86:17 + --> $DIR/lint-stability-fields.rs:76:17 | LL | let _ = x.0; //~ ERROR use of unstable | ^^^ @@ -239,7 +239,7 @@ LL | let _ = x.0; //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:88:17 + --> $DIR/lint-stability-fields.rs:78:17 | LL | let _ = x.2; //~ ERROR use of unstable | ^^^ @@ -247,7 +247,7 @@ LL | let _ = x.2; //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:91:14 + --> $DIR/lint-stability-fields.rs:81:14 | LL | (_, //~ ERROR use of unstable | ^ @@ -255,7 +255,7 @@ LL | (_, //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:93:14 + --> $DIR/lint-stability-fields.rs:83:14 | LL | _) //~ ERROR use of unstable | ^ @@ -263,7 +263,7 @@ LL | _) //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:101:13 + --> $DIR/lint-stability-fields.rs:91:13 | LL | inherit: 1, //~ ERROR use of unstable | ^^^^^^^^^^ @@ -271,7 +271,7 @@ LL | inherit: 1, //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:103:13 + --> $DIR/lint-stability-fields.rs:93:13 | LL | override2: 3, //~ ERROR use of unstable | ^^^^^^^^^^^^ @@ -279,7 +279,7 @@ LL | override2: 3, //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:106:17 + --> $DIR/lint-stability-fields.rs:96:17 | LL | let _ = x.inherit; //~ ERROR use of unstable | ^^^^^^^^^ @@ -287,7 +287,7 @@ LL | let _ = x.inherit; //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:108:17 + --> $DIR/lint-stability-fields.rs:98:17 | LL | let _ = x.override2; //~ ERROR use of unstable | ^^^^^^^^^^^ @@ -295,7 +295,7 @@ LL | let _ = x.override2; //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:111:13 + --> $DIR/lint-stability-fields.rs:101:13 | LL | inherit: _, //~ ERROR use of unstable | ^^^^^^^^^^ @@ -303,7 +303,7 @@ LL | inherit: _, //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:113:13 + --> $DIR/lint-stability-fields.rs:103:13 | LL | override2: _ //~ ERROR use of unstable | ^^^^^^^^^^^^ @@ -311,7 +311,7 @@ LL | override2: _ //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:122:17 + --> $DIR/lint-stability-fields.rs:112:17 | LL | let _ = x.0; //~ ERROR use of unstable | ^^^ @@ -319,7 +319,7 @@ LL | let _ = x.0; //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:124:17 + --> $DIR/lint-stability-fields.rs:114:17 | LL | let _ = x.2; //~ ERROR use of unstable | ^^^ @@ -327,7 +327,7 @@ LL | let _ = x.2; //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:127:14 + --> $DIR/lint-stability-fields.rs:117:14 | LL | (_, //~ ERROR use of unstable | ^ @@ -335,7 +335,7 @@ LL | (_, //~ ERROR use of unstable = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability-fields.rs:129:14 + --> $DIR/lint-stability-fields.rs:119:14 | LL | _) //~ ERROR use of unstable | ^ diff --git a/src/test/ui/lint/lint-stability.rs b/src/test/ui/lint/lint-stability.rs index 720b1235d47..6ff79083f46 100644 --- a/src/test/ui/lint/lint-stability.rs +++ b/src/test/ui/lint/lint-stability.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lint_stability.rs // aux-build:inherited_stability.rs // aux-build:stability_cfg1.rs diff --git a/src/test/ui/lint/lint-stability.stderr b/src/test/ui/lint/lint-stability.stderr index 893c70f85f1..03c42e59c67 100644 --- a/src/test/ui/lint/lint-stability.stderr +++ b/src/test/ui/lint/lint-stability.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:27:5 + --> $DIR/lint-stability.rs:17:5 | LL | extern crate stability_cfg2; //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | extern crate stability_cfg2; //~ ERROR use of unstable library feature = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:55:9 + --> $DIR/lint-stability.rs:45:9 | LL | deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | deprecated_unstable(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:57:9 + --> $DIR/lint-stability.rs:47:9 | LL | Trait::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | Trait::trait_deprecated_unstable(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:59:9 + --> $DIR/lint-stability.rs:49:9 | LL | ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | ::trait_deprecated_unstable(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:62:9 + --> $DIR/lint-stability.rs:52:9 | LL | deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | deprecated_unstable_text(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:64:9 + --> $DIR/lint-stability.rs:54:9 | LL | Trait::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | Trait::trait_deprecated_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:66:9 + --> $DIR/lint-stability.rs:56:9 | LL | ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | ::trait_deprecated_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:69:9 + --> $DIR/lint-stability.rs:59:9 | LL | unstable(); //~ ERROR use of unstable library feature | ^^^^^^^^ @@ -63,7 +63,7 @@ LL | unstable(); //~ ERROR use of unstable library feature = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:70:9 + --> $DIR/lint-stability.rs:60:9 | LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feat = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:71:9 + --> $DIR/lint-stability.rs:61:9 | LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ LL | ::trait_unstable(&foo); //~ ERROR use of unstable lib = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability.rs:73:9 + --> $DIR/lint-stability.rs:63:9 | LL | unstable_text(); | ^^^^^^^^^^^^^ @@ -87,7 +87,7 @@ LL | unstable_text(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability.rs:75:9 + --> $DIR/lint-stability.rs:65:9 | LL | Trait::trait_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ LL | Trait::trait_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability.rs:77:9 + --> $DIR/lint-stability.rs:67:9 | LL | ::trait_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | ::trait_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:109:17 + --> $DIR/lint-stability.rs:99:17 | LL | let _ = DeprecatedUnstableStruct { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ LL | let _ = DeprecatedUnstableStruct { = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:113:17 + --> $DIR/lint-stability.rs:103:17 | LL | let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ LL | let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable library = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:117:17 + --> $DIR/lint-stability.rs:107:17 | LL | let _ = DeprecatedUnstableUnitStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -127,7 +127,7 @@ LL | let _ = DeprecatedUnstableUnitStruct; = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:119:17 + --> $DIR/lint-stability.rs:109:17 | LL | let _ = UnstableUnitStruct; //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^ @@ -135,7 +135,7 @@ LL | let _ = UnstableUnitStruct; //~ ERROR use of unstable library featu = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:123:17 + --> $DIR/lint-stability.rs:113:17 | LL | let _ = Enum::DeprecatedUnstableVariant; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -143,7 +143,7 @@ LL | let _ = Enum::DeprecatedUnstableVariant; = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:125:17 + --> $DIR/lint-stability.rs:115:17 | LL | let _ = Enum::UnstableVariant; //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^ @@ -151,7 +151,7 @@ LL | let _ = Enum::UnstableVariant; //~ ERROR use of unstable library fe = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:129:17 + --> $DIR/lint-stability.rs:119:17 | LL | let _ = DeprecatedUnstableTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -159,7 +159,7 @@ LL | let _ = DeprecatedUnstableTupleStruct (1); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:131:17 + --> $DIR/lint-stability.rs:121:17 | LL | let _ = UnstableTupleStruct (1); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^ @@ -167,7 +167,7 @@ LL | let _ = UnstableTupleStruct (1); //~ ERROR use of unstable library = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:140:25 + --> $DIR/lint-stability.rs:130:25 | LL | macro_test_arg!(deprecated_unstable_text()); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -175,7 +175,7 @@ LL | macro_test_arg!(deprecated_unstable_text()); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:154:9 + --> $DIR/lint-stability.rs:144:9 | LL | Trait::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -183,7 +183,7 @@ LL | Trait::trait_deprecated_unstable(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:156:9 + --> $DIR/lint-stability.rs:146:9 | LL | ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -191,7 +191,7 @@ LL | ::trait_deprecated_unstable(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:158:9 + --> $DIR/lint-stability.rs:148:9 | LL | Trait::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -199,7 +199,7 @@ LL | Trait::trait_deprecated_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:160:9 + --> $DIR/lint-stability.rs:150:9 | LL | ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -207,7 +207,7 @@ LL | ::trait_deprecated_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:162:9 + --> $DIR/lint-stability.rs:152:9 | LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^ @@ -215,7 +215,7 @@ LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feat = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:163:9 + --> $DIR/lint-stability.rs:153:9 | LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -223,7 +223,7 @@ LL | ::trait_unstable(&foo); //~ ERROR use of unstable lib = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability.rs:164:9 + --> $DIR/lint-stability.rs:154:9 | LL | Trait::trait_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -231,7 +231,7 @@ LL | Trait::trait_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': text - --> $DIR/lint-stability.rs:166:9 + --> $DIR/lint-stability.rs:156:9 | LL | ::trait_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -239,7 +239,7 @@ LL | ::trait_unstable_text(&foo); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:182:10 + --> $DIR/lint-stability.rs:172:10 | LL | impl UnstableTrait for S { } //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^ @@ -247,7 +247,7 @@ LL | impl UnstableTrait for S { } //~ ERROR use of unstable library feature = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:184:24 + --> $DIR/lint-stability.rs:174:24 | LL | trait LocalTrait : UnstableTrait { } //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^ @@ -255,7 +255,7 @@ LL | trait LocalTrait : UnstableTrait { } //~ ERROR use of unstable library = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:189:9 + --> $DIR/lint-stability.rs:179:9 | LL | fn trait_unstable(&self) {} //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -263,7 +263,7 @@ LL | fn trait_unstable(&self) {} //~ ERROR use of unstable library featu = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:194:5 + --> $DIR/lint-stability.rs:184:5 | LL | extern crate inherited_stability; //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -271,7 +271,7 @@ LL | extern crate inherited_stability; //~ ERROR use of unstable library fea = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:195:9 + --> $DIR/lint-stability.rs:185:9 | LL | use self::inherited_stability::*; //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -279,7 +279,7 @@ LL | use self::inherited_stability::*; //~ ERROR use of unstable library fea = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:198:9 + --> $DIR/lint-stability.rs:188:9 | LL | unstable(); //~ ERROR use of unstable library feature | ^^^^^^^^ @@ -287,7 +287,7 @@ LL | unstable(); //~ ERROR use of unstable library feature = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:201:9 + --> $DIR/lint-stability.rs:191:9 | LL | stable_mod::unstable(); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^ @@ -295,7 +295,7 @@ LL | stable_mod::unstable(); //~ ERROR use of unstable library feature = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:205:9 + --> $DIR/lint-stability.rs:195:9 | LL | unstable_mod::unstable(); //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^^ @@ -303,7 +303,7 @@ LL | unstable_mod::unstable(); //~ ERROR use of unstable library feature = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:207:17 + --> $DIR/lint-stability.rs:197:17 | LL | let _ = Unstable::UnstableVariant; //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -311,7 +311,7 @@ LL | let _ = Unstable::UnstableVariant; //~ ERROR use of unstable librar = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:98:48 + --> $DIR/lint-stability.rs:88:48 | LL | struct S1(T::TypeUnstable); | ^^^^^^^^^^^^^^^ @@ -319,7 +319,7 @@ LL | struct S1(T::TypeUnstable); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-stability.rs:102:13 + --> $DIR/lint-stability.rs:92:13 | LL | TypeUnstable = u8, //~ ERROR use of unstable library feature | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-stability2.rs b/src/test/ui/lint/lint-stability2.rs index d2ec00d6495..9710d0826c7 100644 --- a/src/test/ui/lint/lint-stability2.rs +++ b/src/test/ui/lint/lint-stability2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lint_stability.rs // error-pattern: use of deprecated item diff --git a/src/test/ui/lint/lint-stability2.stderr b/src/test/ui/lint/lint-stability2.stderr index 5585fc9f83a..6599da564f5 100644 --- a/src/test/ui/lint/lint-stability2.stderr +++ b/src/test/ui/lint/lint-stability2.stderr @@ -1,11 +1,11 @@ error: use of deprecated item 'lint_stability::deprecated': text - --> $DIR/lint-stability2.rs:22:5 + --> $DIR/lint-stability2.rs:12:5 | LL | macro_test!(); | ^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-stability2.rs:14:9 + --> $DIR/lint-stability2.rs:4:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-stability3.rs b/src/test/ui/lint/lint-stability3.rs index 44a36f215f3..3d2cc6890b8 100644 --- a/src/test/ui/lint/lint-stability3.rs +++ b/src/test/ui/lint/lint-stability3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lint_stability.rs // error-pattern: use of deprecated item diff --git a/src/test/ui/lint/lint-stability3.stderr b/src/test/ui/lint/lint-stability3.stderr index 722223f6243..84274e64069 100644 --- a/src/test/ui/lint/lint-stability3.stderr +++ b/src/test/ui/lint/lint-stability3.stderr @@ -1,11 +1,11 @@ error: use of deprecated item 'lint_stability::deprecated_text': text - --> $DIR/lint-stability3.rs:23:5 + --> $DIR/lint-stability3.rs:13:5 | LL | macro_test_arg_nested!(deprecated_text); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-stability3.rs:14:9 + --> $DIR/lint-stability3.rs:4:9 | LL | #![deny(deprecated)] | ^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-type-limits.rs b/src/test/ui/lint/lint-type-limits.rs index 29929c120c3..2b140f86964 100644 --- a/src/test/ui/lint/lint-type-limits.rs +++ b/src/test/ui/lint/lint-type-limits.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // compile-flags: -D unused-comparisons diff --git a/src/test/ui/lint/lint-type-limits.stderr b/src/test/ui/lint/lint-type-limits.stderr index 49b379a9901..14ef953d294 100644 --- a/src/test/ui/lint/lint-type-limits.stderr +++ b/src/test/ui/lint/lint-type-limits.stderr @@ -1,5 +1,5 @@ error: comparison is useless due to type limits - --> $DIR/lint-type-limits.rs:18:11 + --> $DIR/lint-type-limits.rs:8:11 | LL | while i >= 0 { //~ ERROR comparison is useless due to type limits | ^^^^^^ @@ -7,49 +7,49 @@ LL | while i >= 0 { //~ ERROR comparison is useless due to type limits = note: requested on the command line with `-D unused-comparisons` error: comparison is useless due to type limits - --> $DIR/lint-type-limits.rs:29:13 + --> $DIR/lint-type-limits.rs:19:13 | LL | let _ = u > 255; //~ ERROR comparison is useless due to type limits | ^^^^^^^ error: comparison is useless due to type limits - --> $DIR/lint-type-limits.rs:30:13 + --> $DIR/lint-type-limits.rs:20:13 | LL | let _ = 255 < u; //~ ERROR comparison is useless due to type limits | ^^^^^^^ error: comparison is useless due to type limits - --> $DIR/lint-type-limits.rs:31:13 + --> $DIR/lint-type-limits.rs:21:13 | LL | let _ = u < 0; //~ ERROR comparison is useless due to type limits | ^^^^^ error: comparison is useless due to type limits - --> $DIR/lint-type-limits.rs:32:13 + --> $DIR/lint-type-limits.rs:22:13 | LL | let _ = 0 > u; //~ ERROR comparison is useless due to type limits | ^^^^^ error: comparison is useless due to type limits - --> $DIR/lint-type-limits.rs:33:13 + --> $DIR/lint-type-limits.rs:23:13 | LL | let _ = u <= 255; //~ ERROR comparison is useless due to type limits | ^^^^^^^^ error: comparison is useless due to type limits - --> $DIR/lint-type-limits.rs:34:13 + --> $DIR/lint-type-limits.rs:24:13 | LL | let _ = 255 >= u; //~ ERROR comparison is useless due to type limits | ^^^^^^^^ error: comparison is useless due to type limits - --> $DIR/lint-type-limits.rs:35:13 + --> $DIR/lint-type-limits.rs:25:13 | LL | let _ = u >= 0; //~ ERROR comparison is useless due to type limits | ^^^^^^ error: comparison is useless due to type limits - --> $DIR/lint-type-limits.rs:36:13 + --> $DIR/lint-type-limits.rs:26:13 | LL | let _ = 0 <= u; //~ ERROR comparison is useless due to type limits | ^^^^^^ diff --git a/src/test/ui/lint/lint-type-limits2.rs b/src/test/ui/lint/lint-type-limits2.rs index 8fc18d16469..9c69ba12cf7 100644 --- a/src/test/ui/lint/lint-type-limits2.rs +++ b/src/test/ui/lint/lint-type-limits2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // compile-flags: -D unused-comparisons diff --git a/src/test/ui/lint/lint-type-limits2.stderr b/src/test/ui/lint/lint-type-limits2.stderr index a7abf7ad364..3118bcec05e 100644 --- a/src/test/ui/lint/lint-type-limits2.stderr +++ b/src/test/ui/lint/lint-type-limits2.stderr @@ -1,5 +1,5 @@ error: comparison is useless due to type limits - --> $DIR/lint-type-limits2.rs:22:5 + --> $DIR/lint-type-limits2.rs:12:5 | LL | 128 > bar() //~ ERROR comparison is useless due to type limits | ^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | 128 > bar() //~ ERROR comparison is useless due to type limits = note: requested on the command line with `-D unused-comparisons` warning: literal out of range for i8 - --> $DIR/lint-type-limits2.rs:22:5 + --> $DIR/lint-type-limits2.rs:12:5 | LL | 128 > bar() //~ ERROR comparison is useless due to type limits | ^^^ diff --git a/src/test/ui/lint/lint-type-limits3.rs b/src/test/ui/lint/lint-type-limits3.rs index b09dc0acdbf..3e95ad212eb 100644 --- a/src/test/ui/lint/lint-type-limits3.rs +++ b/src/test/ui/lint/lint-type-limits3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // compile-flags: -D unused-comparisons diff --git a/src/test/ui/lint/lint-type-limits3.stderr b/src/test/ui/lint/lint-type-limits3.stderr index b6e14ac64e5..5e30b1646a7 100644 --- a/src/test/ui/lint/lint-type-limits3.stderr +++ b/src/test/ui/lint/lint-type-limits3.stderr @@ -1,5 +1,5 @@ error: comparison is useless due to type limits - --> $DIR/lint-type-limits3.rs:18:11 + --> $DIR/lint-type-limits3.rs:8:11 | LL | while 200 != i { //~ ERROR comparison is useless due to type limits | ^^^^^^^^ @@ -7,7 +7,7 @@ LL | while 200 != i { //~ ERROR comparison is useless due to type limits = note: requested on the command line with `-D unused-comparisons` warning: literal out of range for i8 - --> $DIR/lint-type-limits3.rs:18:11 + --> $DIR/lint-type-limits3.rs:8:11 | LL | while 200 != i { //~ ERROR comparison is useless due to type limits | ^^^ diff --git a/src/test/ui/lint/lint-type-overflow.rs b/src/test/ui/lint/lint-type-overflow.rs index ce336905c01..847cdf31dc7 100644 --- a/src/test/ui/lint/lint-type-overflow.rs +++ b/src/test/ui/lint/lint-type-overflow.rs @@ -1,12 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // #![deny(overflowing_literals)] diff --git a/src/test/ui/lint/lint-type-overflow.stderr b/src/test/ui/lint/lint-type-overflow.stderr index 67f4537e1e6..987ee8a640c 100644 --- a/src/test/ui/lint/lint-type-overflow.stderr +++ b/src/test/ui/lint/lint-type-overflow.stderr @@ -1,113 +1,113 @@ error: literal out of range for u8 - --> $DIR/lint-type-overflow.rs:21:18 + --> $DIR/lint-type-overflow.rs:12:18 | LL | let x1: u8 = 256; //~ error: literal out of range for u8 | ^^^ | note: lint level defined here - --> $DIR/lint-type-overflow.rs:12:9 + --> $DIR/lint-type-overflow.rs:3:9 | LL | #![deny(overflowing_literals)] | ^^^^^^^^^^^^^^^^^^^^ error: literal out of range for u8 - --> $DIR/lint-type-overflow.rs:24:14 + --> $DIR/lint-type-overflow.rs:15:14 | LL | let x1 = 256_u8; //~ error: literal out of range for u8 | ^^^^^^ error: literal out of range for i8 - --> $DIR/lint-type-overflow.rs:27:18 + --> $DIR/lint-type-overflow.rs:18:18 | LL | let x1: i8 = 128; //~ error: literal out of range for i8 | ^^^ error: literal out of range for i8 - --> $DIR/lint-type-overflow.rs:29:19 + --> $DIR/lint-type-overflow.rs:20:19 | LL | let x3: i8 = -129; //~ error: literal out of range for i8 | ^^^ error: literal out of range for i8 - --> $DIR/lint-type-overflow.rs:30:19 + --> $DIR/lint-type-overflow.rs:21:19 | LL | let x3: i8 = -(129); //~ error: literal out of range for i8 | ^^^^^ error: literal out of range for i8 - --> $DIR/lint-type-overflow.rs:31:20 + --> $DIR/lint-type-overflow.rs:22:20 | LL | let x3: i8 = -{129}; //~ error: literal out of range for i8 | ^^^ error: literal out of range for i8 - --> $DIR/lint-type-overflow.rs:33:10 + --> $DIR/lint-type-overflow.rs:24:10 | LL | test(1000); //~ error: literal out of range for i8 | ^^^^ error: literal out of range for i8 - --> $DIR/lint-type-overflow.rs:35:13 + --> $DIR/lint-type-overflow.rs:26:13 | LL | let x = 128_i8; //~ error: literal out of range for i8 | ^^^^^^ error: literal out of range for i8 - --> $DIR/lint-type-overflow.rs:39:14 + --> $DIR/lint-type-overflow.rs:30:14 | LL | let x = -129_i8; //~ error: literal out of range for i8 | ^^^^^^ error: literal out of range for i32 - --> $DIR/lint-type-overflow.rs:43:18 + --> $DIR/lint-type-overflow.rs:34:18 | LL | let x: i32 = 2147483648; //~ error: literal out of range for i32 | ^^^^^^^^^^ error: literal out of range for i32 - --> $DIR/lint-type-overflow.rs:44:13 + --> $DIR/lint-type-overflow.rs:35:13 | LL | let x = 2147483648_i32; //~ error: literal out of range for i32 | ^^^^^^^^^^^^^^ error: literal out of range for i32 - --> $DIR/lint-type-overflow.rs:47:19 + --> $DIR/lint-type-overflow.rs:38:19 | LL | let x: i32 = -2147483649; //~ error: literal out of range for i32 | ^^^^^^^^^^ error: literal out of range for i32 - --> $DIR/lint-type-overflow.rs:48:14 + --> $DIR/lint-type-overflow.rs:39:14 | LL | let x = -2147483649_i32; //~ error: literal out of range for i32 | ^^^^^^^^^^^^^^ error: literal out of range for i32 - --> $DIR/lint-type-overflow.rs:49:13 + --> $DIR/lint-type-overflow.rs:40:13 | LL | let x = 2147483648; //~ error: literal out of range for i32 | ^^^^^^^^^^ error: literal out of range for i64 - --> $DIR/lint-type-overflow.rs:51:13 + --> $DIR/lint-type-overflow.rs:42:13 | LL | let x = 9223372036854775808_i64; //~ error: literal out of range for i64 | ^^^^^^^^^^^^^^^^^^^^^^^ error: literal out of range for i64 - --> $DIR/lint-type-overflow.rs:53:13 + --> $DIR/lint-type-overflow.rs:44:13 | LL | let x = 18446744073709551615_i64; //~ error: literal out of range for i64 | ^^^^^^^^^^^^^^^^^^^^^^^^ error: literal out of range for i64 - --> $DIR/lint-type-overflow.rs:54:19 + --> $DIR/lint-type-overflow.rs:45:19 | LL | let x: i64 = -9223372036854775809; //~ error: literal out of range for i64 | ^^^^^^^^^^^^^^^^^^^ error: literal out of range for i64 - --> $DIR/lint-type-overflow.rs:55:14 + --> $DIR/lint-type-overflow.rs:46:14 | LL | let x = -9223372036854775809_i64; //~ error: literal out of range for i64 | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-type-overflow2.rs b/src/test/ui/lint/lint-type-overflow2.rs index 82ec3be1596..507e8d07349 100644 --- a/src/test/ui/lint/lint-type-overflow2.rs +++ b/src/test/ui/lint/lint-type-overflow2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -O #![warn(overflowing_literals)] #![warn(const_err)] diff --git a/src/test/ui/lint/lint-type-overflow2.stderr b/src/test/ui/lint/lint-type-overflow2.stderr index 1fb63ac7595..5f63ce49680 100644 --- a/src/test/ui/lint/lint-type-overflow2.stderr +++ b/src/test/ui/lint/lint-type-overflow2.stderr @@ -1,47 +1,47 @@ warning: literal out of range for i8 - --> $DIR/lint-type-overflow2.rs:19:20 + --> $DIR/lint-type-overflow2.rs:9:20 | LL | let x2: i8 = --128; //~ warn: literal out of range for i8 | ^^^ | note: lint level defined here - --> $DIR/lint-type-overflow2.rs:12:9 + --> $DIR/lint-type-overflow2.rs:2:9 | LL | #![warn(overflowing_literals)] | ^^^^^^^^^^^^^^^^^^^^ warning: literal out of range for f32 - --> $DIR/lint-type-overflow2.rs:21:14 + --> $DIR/lint-type-overflow2.rs:11:14 | LL | let x = -3.40282357e+38_f32; //~ warn: literal out of range for f32 | ^^^^^^^^^^^^^^^^^^ warning: literal out of range for f32 - --> $DIR/lint-type-overflow2.rs:22:14 + --> $DIR/lint-type-overflow2.rs:12:14 | LL | let x = 3.40282357e+38_f32; //~ warn: literal out of range for f32 | ^^^^^^^^^^^^^^^^^^ warning: literal out of range for f64 - --> $DIR/lint-type-overflow2.rs:23:14 + --> $DIR/lint-type-overflow2.rs:13:14 | LL | let x = -1.7976931348623159e+308_f64; //~ warn: literal out of range for f64 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: literal out of range for f64 - --> $DIR/lint-type-overflow2.rs:24:14 + --> $DIR/lint-type-overflow2.rs:14:14 | LL | let x = 1.7976931348623159e+308_f64; //~ warn: literal out of range for f64 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: this expression will panic at runtime - --> $DIR/lint-type-overflow2.rs:19:18 + --> $DIR/lint-type-overflow2.rs:9:18 | LL | let x2: i8 = --128; //~ warn: literal out of range for i8 | ^^^^^ attempt to negate with overflow | note: lint level defined here - --> $DIR/lint-type-overflow2.rs:13:9 + --> $DIR/lint-type-overflow2.rs:3:9 | LL | #![warn(const_err)] | ^^^^^^^^^ diff --git a/src/test/ui/lint/lint-unconditional-recursion.rs b/src/test/ui/lint/lint-unconditional-recursion.rs index 7ca9b6874e7..44af1179097 100644 --- a/src/test/ui/lint/lint-unconditional-recursion.rs +++ b/src/test/ui/lint/lint-unconditional-recursion.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unconditional_recursion)] #![allow(dead_code)] diff --git a/src/test/ui/lint/lint-unconditional-recursion.stderr b/src/test/ui/lint/lint-unconditional-recursion.stderr index d0fbdd18ed3..50daa537591 100644 --- a/src/test/ui/lint/lint-unconditional-recursion.stderr +++ b/src/test/ui/lint/lint-unconditional-recursion.stderr @@ -1,5 +1,5 @@ error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:14:1 + --> $DIR/lint-unconditional-recursion.rs:4:1 | LL | fn foo() { //~ ERROR function cannot return without recursing | ^^^^^^^^ cannot return without recursing @@ -7,14 +7,14 @@ LL | foo(); | ----- recursive call site | note: lint level defined here - --> $DIR/lint-unconditional-recursion.rs:11:9 + --> $DIR/lint-unconditional-recursion.rs:1:9 | LL | #![deny(unconditional_recursion)] | ^^^^^^^^^^^^^^^^^^^^^^^ = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:24:1 + --> $DIR/lint-unconditional-recursion.rs:14:1 | LL | fn baz() { //~ ERROR function cannot return without recursing | ^^^^^^^^ cannot return without recursing @@ -28,7 +28,7 @@ LL | baz() = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:36:1 + --> $DIR/lint-unconditional-recursion.rs:26:1 | LL | fn quz() -> bool { //~ ERROR function cannot return without recursing | ^^^^^^^^^^^^^^^^ cannot return without recursing @@ -42,7 +42,7 @@ LL | loop { quz(); } = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:47:5 + --> $DIR/lint-unconditional-recursion.rs:37:5 | LL | fn bar(&self) { //~ ERROR function cannot return without recursing | ^^^^^^^^^^^^^ cannot return without recursing @@ -52,7 +52,7 @@ LL | self.bar() = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:53:5 + --> $DIR/lint-unconditional-recursion.rs:43:5 | LL | fn bar(&self) { //~ ERROR function cannot return without recursing | ^^^^^^^^^^^^^ cannot return without recursing @@ -63,7 +63,7 @@ LL | self.bar() = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:62:5 + --> $DIR/lint-unconditional-recursion.rs:52:5 | LL | fn bar(&self) { //~ ERROR function cannot return without recursing | ^^^^^^^^^^^^^ cannot return without recursing @@ -73,7 +73,7 @@ LL | 0.bar() = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:75:5 + --> $DIR/lint-unconditional-recursion.rs:65:5 | LL | fn bar(&self) { //~ ERROR function cannot return without recursing | ^^^^^^^^^^^^^ cannot return without recursing @@ -83,7 +83,7 @@ LL | Foo2::bar(self) = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:81:5 + --> $DIR/lint-unconditional-recursion.rs:71:5 | LL | fn bar(&self) { //~ ERROR function cannot return without recursing | ^^^^^^^^^^^^^ cannot return without recursing @@ -94,7 +94,7 @@ LL | Foo2::bar(self) = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:91:5 + --> $DIR/lint-unconditional-recursion.rs:81:5 | LL | fn qux(&self) { //~ ERROR function cannot return without recursing | ^^^^^^^^^^^^^ cannot return without recursing @@ -104,7 +104,7 @@ LL | self.qux(); = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:96:5 + --> $DIR/lint-unconditional-recursion.rs:86:5 | LL | fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recursing | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -114,7 +114,7 @@ LL | Baz::as_ref(self) = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:103:5 + --> $DIR/lint-unconditional-recursion.rs:93:5 | LL | fn default() -> Baz { //~ ERROR function cannot return without recursing | ^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -124,7 +124,7 @@ LL | let x = Default::default(); = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:112:5 + --> $DIR/lint-unconditional-recursion.rs:102:5 | LL | fn deref(&self) -> &() { //~ ERROR function cannot return without recursing | ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -134,7 +134,7 @@ LL | &**self = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:119:5 + --> $DIR/lint-unconditional-recursion.rs:109:5 | LL | fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recursing | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -144,7 +144,7 @@ LL | &self[x] = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing - --> $DIR/lint-unconditional-recursion.rs:128:5 + --> $DIR/lint-unconditional-recursion.rs:118:5 | LL | fn deref(&self) -> &Baz { //~ ERROR function cannot return without recursing | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing diff --git a/src/test/ui/lint/lint-unexported-no-mangle.rs b/src/test/ui/lint/lint-unexported-no-mangle.rs index 8188c2c455e..5945c90023c 100644 --- a/src/test/ui/lint/lint-unexported-no-mangle.rs +++ b/src/test/ui/lint/lint-unexported-no-mangle.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-F private_no_mangle_fns -F no_mangle_const_items -F private_no_mangle_statics #[no_mangle] diff --git a/src/test/ui/lint/lint-unexported-no-mangle.stderr b/src/test/ui/lint/lint-unexported-no-mangle.stderr index 063915d5b5f..f6a1087635a 100644 --- a/src/test/ui/lint/lint-unexported-no-mangle.stderr +++ b/src/test/ui/lint/lint-unexported-no-mangle.stderr @@ -1,13 +1,13 @@ -warning: lint `private_no_mangle_fns` has been removed: `no longer an warning, #[no_mangle] functions always exported` +warning: lint `private_no_mangle_fns` has been removed: `no longer a warning, #[no_mangle] functions always exported` | = note: requested on the command line with `-F private_no_mangle_fns` -warning: lint `private_no_mangle_statics` has been removed: `no longer an warning, #[no_mangle] statics always exported` +warning: lint `private_no_mangle_statics` has been removed: `no longer a warning, #[no_mangle] statics always exported` | = note: requested on the command line with `-F private_no_mangle_statics` error: const items should never be #[no_mangle] - --> $DIR/lint-unexported-no-mangle.rs:19:1 + --> $DIR/lint-unexported-no-mangle.rs:9:1 | LL | const FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle] | -----^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | const FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle] = note: requested on the command line with `-F no-mangle-const-items` error: const items should never be #[no_mangle] - --> $DIR/lint-unexported-no-mangle.rs:22:1 + --> $DIR/lint-unexported-no-mangle.rs:12:1 | LL | pub const PUB_FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle] | ---------^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-unknown-attr.rs b/src/test/ui/lint/lint-unknown-attr.rs index af4e81be195..828b869c12e 100644 --- a/src/test/ui/lint/lint-unknown-attr.rs +++ b/src/test/ui/lint/lint-unknown-attr.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // When denying at the crate level, be sure to not get random warnings from the // injected intrinsics by the compiler. diff --git a/src/test/ui/lint/lint-unknown-attr.stderr b/src/test/ui/lint/lint-unknown-attr.stderr index 5f915232c14..435b03b1f65 100644 --- a/src/test/ui/lint/lint-unknown-attr.stderr +++ b/src/test/ui/lint/lint-unknown-attr.stderr @@ -1,23 +1,23 @@ error: unused attribute - --> $DIR/lint-unknown-attr.rs:19:1 + --> $DIR/lint-unknown-attr.rs:9:1 | LL | #[dance] mod a {} //~ ERROR unused attribute | ^^^^^^^^ | note: lint level defined here - --> $DIR/lint-unknown-attr.rs:15:9 + --> $DIR/lint-unknown-attr.rs:5:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/lint-unknown-attr.rs:21:1 + --> $DIR/lint-unknown-attr.rs:11:1 | LL | #[dance] fn main() {} //~ ERROR unused attribute | ^^^^^^^^ error: unused attribute - --> $DIR/lint-unknown-attr.rs:17:1 + --> $DIR/lint-unknown-attr.rs:7:1 | LL | #![mutable_doc] //~ ERROR unused attribute | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-unknown-feature-default.rs b/src/test/ui/lint/lint-unknown-feature-default.rs index cfab640ad4e..e04363faf4b 100644 --- a/src/test/ui/lint/lint-unknown-feature-default.rs +++ b/src/test/ui/lint/lint-unknown-feature-default.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests the default for the unused_features lint #![allow(stable_features)] diff --git a/src/test/ui/lint/lint-unknown-feature.rs b/src/test/ui/lint/lint-unknown-feature.rs index 7c5878e1729..c372a980bed 100644 --- a/src/test/ui/lint/lint-unknown-feature.rs +++ b/src/test/ui/lint/lint-unknown-feature.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![warn(unused_features)] #![allow(stable_features)] diff --git a/src/test/ui/lint/lint-unknown-lint-cmdline.rs b/src/test/ui/lint/lint-unknown-lint-cmdline.rs index 0c41959f8a7..7f3f55fbad0 100644 --- a/src/test/ui/lint/lint-unknown-lint-cmdline.rs +++ b/src/test/ui/lint/lint-unknown-lint-cmdline.rs @@ -1,16 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// compile-flags:-D bogus -D dead_cod -// compile-flags:-D bogus - -// error-pattern:unknown lint +// error-pattern:unknown lint: `bogus` // error-pattern:requested on the command line with `-D bogus` +// error-pattern:unknown lint: `dead_cod` +// error-pattern:requested on the command line with `-D dead_cod` +// error-pattern:did you mean: `dead_code` fn main() { } diff --git a/src/test/ui/lint/lint-unknown-lint-cmdline.stderr b/src/test/ui/lint/lint-unknown-lint-cmdline.stderr index 86360041026..58fdae3333c 100644 --- a/src/test/ui/lint/lint-unknown-lint-cmdline.stderr +++ b/src/test/ui/lint/lint-unknown-lint-cmdline.stderr @@ -2,6 +2,11 @@ error[E0602]: unknown lint: `bogus` | = note: requested on the command line with `-D bogus` -error: aborting due to previous error +error[E0602]: unknown lint: `dead_cod` + | + = help: did you mean: `dead_code` + = note: requested on the command line with `-D dead_cod` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0602`. diff --git a/src/test/ui/lint/lint-unknown-lint.rs b/src/test/ui/lint/lint-unknown-lint.rs index 2de8d849d19..c36a8b2a4bf 100644 --- a/src/test/ui/lint/lint-unknown-lint.rs +++ b/src/test/ui/lint/lint-unknown-lint.rs @@ -1,13 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#![deny(unknown_lints)] -#![allow(not_a_real_lint)] //~ WARN unknown lint -#![deny(unused)] -fn main() { let unused = (); } //~ ERROR unused variable +#![allow(not_a_real_lint)] //~ ERROR unknown lint + +#![deny(dead_cod)] //~ ERROR unknown lint + //~| HELP did you mean + //~| SUGGESTION dead_code + +fn main() {} diff --git a/src/test/ui/lint/lint-unknown-lint.stderr b/src/test/ui/lint/lint-unknown-lint.stderr index b398a2f3690..976c88c11d0 100644 --- a/src/test/ui/lint/lint-unknown-lint.stderr +++ b/src/test/ui/lint/lint-unknown-lint.stderr @@ -1,23 +1,20 @@ -warning: unknown lint: `not_a_real_lint` - --> $DIR/lint-unknown-lint.rs:11:10 +error: unknown lint: `not_a_real_lint` + --> $DIR/lint-unknown-lint.rs:3:10 | -LL | #![allow(not_a_real_lint)] //~ WARN unknown lint +LL | #![allow(not_a_real_lint)] //~ ERROR unknown lint | ^^^^^^^^^^^^^^^ | - = note: #[warn(unknown_lints)] on by default - -error: unused variable: `unused` - --> $DIR/lint-unknown-lint.rs:13:17 - | -LL | fn main() { let unused = (); } //~ ERROR unused variable - | ^^^^^^ help: consider using `_unused` instead - | note: lint level defined here - --> $DIR/lint-unknown-lint.rs:12:9 + --> $DIR/lint-unknown-lint.rs:1:9 + | +LL | #![deny(unknown_lints)] + | ^^^^^^^^^^^^^ + +error: unknown lint: `dead_cod` + --> $DIR/lint-unknown-lint.rs:5:9 | -LL | #![deny(unused)] - | ^^^^^^ - = note: #[deny(unused_variables)] implied by #[deny(unused)] +LL | #![deny(dead_cod)] //~ ERROR unknown lint + | ^^^^^^^^ help: did you mean: `dead_code` -error: aborting due to previous error +error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-unnecessary-import-braces.rs b/src/test/ui/lint/lint-unnecessary-import-braces.rs index 214a03c13f4..9a3398a8734 100644 --- a/src/test/ui/lint/lint-unnecessary-import-braces.rs +++ b/src/test/ui/lint/lint-unnecessary-import-braces.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused_import_braces)] use test::{A}; //~ ERROR braces around A is unnecessary diff --git a/src/test/ui/lint/lint-unnecessary-import-braces.stderr b/src/test/ui/lint/lint-unnecessary-import-braces.stderr index a4fd474e5cc..40e7ab4dd13 100644 --- a/src/test/ui/lint/lint-unnecessary-import-braces.stderr +++ b/src/test/ui/lint/lint-unnecessary-import-braces.stderr @@ -1,11 +1,11 @@ error: braces around A is unnecessary - --> $DIR/lint-unnecessary-import-braces.rs:13:1 + --> $DIR/lint-unnecessary-import-braces.rs:3:1 | LL | use test::{A}; //~ ERROR braces around A is unnecessary | ^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-unnecessary-import-braces.rs:11:9 + --> $DIR/lint-unnecessary-import-braces.rs:1:9 | LL | #![deny(unused_import_braces)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-unnecessary-parens.rs b/src/test/ui/lint/lint-unnecessary-parens.rs index 7cd0a6bbf0f..dc74d69bd8d 100644 --- a/src/test/ui/lint/lint-unnecessary-parens.rs +++ b/src/test/ui/lint/lint-unnecessary-parens.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused_parens)] #[derive(Eq, PartialEq)] diff --git a/src/test/ui/lint/lint-unnecessary-parens.stderr b/src/test/ui/lint/lint-unnecessary-parens.stderr index 8861524b185..c14ebb6be97 100644 --- a/src/test/ui/lint/lint-unnecessary-parens.stderr +++ b/src/test/ui/lint/lint-unnecessary-parens.stderr @@ -1,77 +1,77 @@ error: unnecessary parentheses around `return` value - --> $DIR/lint-unnecessary-parens.rs:20:12 + --> $DIR/lint-unnecessary-parens.rs:10:12 | LL | return (1); //~ ERROR unnecessary parentheses around `return` value | ^^^ help: remove these parentheses | note: lint level defined here - --> $DIR/lint-unnecessary-parens.rs:11:9 + --> $DIR/lint-unnecessary-parens.rs:1:9 | LL | #![deny(unused_parens)] | ^^^^^^^^^^^^^ error: unnecessary parentheses around `return` value - --> $DIR/lint-unnecessary-parens.rs:23:12 + --> $DIR/lint-unnecessary-parens.rs:13:12 | LL | return (X { y }); //~ ERROR unnecessary parentheses around `return` value | ^^^^^^^^^ help: remove these parentheses error: unnecessary parentheses around function argument - --> $DIR/lint-unnecessary-parens.rs:28:9 + --> $DIR/lint-unnecessary-parens.rs:18:9 | LL | bar((true)); //~ ERROR unnecessary parentheses around function argument | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around `if` condition - --> $DIR/lint-unnecessary-parens.rs:30:8 + --> $DIR/lint-unnecessary-parens.rs:20:8 | LL | if (true) {} //~ ERROR unnecessary parentheses around `if` condition | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around `while` condition - --> $DIR/lint-unnecessary-parens.rs:31:11 + --> $DIR/lint-unnecessary-parens.rs:21:11 | LL | while (true) {} //~ ERROR unnecessary parentheses around `while` condition | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around `match` head expression - --> $DIR/lint-unnecessary-parens.rs:32:11 + --> $DIR/lint-unnecessary-parens.rs:22:11 | LL | match (true) { //~ ERROR unnecessary parentheses around `match` head expression | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around `if let` head expression - --> $DIR/lint-unnecessary-parens.rs:35:16 + --> $DIR/lint-unnecessary-parens.rs:25:16 | LL | if let 1 = (1) {} //~ ERROR unnecessary parentheses around `if let` head expression | ^^^ help: remove these parentheses error: unnecessary parentheses around `while let` head expression - --> $DIR/lint-unnecessary-parens.rs:36:19 + --> $DIR/lint-unnecessary-parens.rs:26:19 | LL | while let 1 = (2) {} //~ ERROR unnecessary parentheses around `while let` head expression | ^^^ help: remove these parentheses error: unnecessary parentheses around method argument - --> $DIR/lint-unnecessary-parens.rs:50:24 + --> $DIR/lint-unnecessary-parens.rs:40:24 | LL | X { y: false }.foo((true)); //~ ERROR unnecessary parentheses around method argument | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:52:18 + --> $DIR/lint-unnecessary-parens.rs:42:18 | LL | let mut _a = (0); //~ ERROR unnecessary parentheses around assigned value | ^^^ help: remove these parentheses error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:53:10 + --> $DIR/lint-unnecessary-parens.rs:43:10 | LL | _a = (0); //~ ERROR unnecessary parentheses around assigned value | ^^^ help: remove these parentheses error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:54:11 + --> $DIR/lint-unnecessary-parens.rs:44:11 | LL | _a += (1); //~ ERROR unnecessary parentheses around assigned value | ^^^ help: remove these parentheses diff --git a/src/test/ui/lint/lint-unsafe-code.rs b/src/test/ui/lint/lint-unsafe-code.rs index 10f245aaaf9..735f33f601f 100644 --- a/src/test/ui/lint/lint-unsafe-code.rs +++ b/src/test/ui/lint/lint-unsafe-code.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_unsafe)] #![allow(dead_code)] #![deny(unsafe_code)] diff --git a/src/test/ui/lint/lint-unsafe-code.stderr b/src/test/ui/lint/lint-unsafe-code.stderr index ee2aba066ec..e2dd45e2c8a 100644 --- a/src/test/ui/lint/lint-unsafe-code.stderr +++ b/src/test/ui/lint/lint-unsafe-code.stderr @@ -1,89 +1,89 @@ error: declaration of an `unsafe` function - --> $DIR/lint-unsafe-code.rs:33:1 + --> $DIR/lint-unsafe-code.rs:23:1 | LL | unsafe fn baz() {} //~ ERROR: declaration of an `unsafe` function | ^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-unsafe-code.rs:13:9 + --> $DIR/lint-unsafe-code.rs:3:9 | LL | #![deny(unsafe_code)] | ^^^^^^^^^^^ error: declaration of an `unsafe` trait - --> $DIR/lint-unsafe-code.rs:34:1 + --> $DIR/lint-unsafe-code.rs:24:1 | LL | unsafe trait Foo {} //~ ERROR: declaration of an `unsafe` trait | ^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` trait - --> $DIR/lint-unsafe-code.rs:35:1 + --> $DIR/lint-unsafe-code.rs:25:1 | LL | unsafe impl Foo for Bar {} //~ ERROR: implementation of an `unsafe` trait | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: declaration of an `unsafe` method - --> $DIR/lint-unsafe-code.rs:38:5 + --> $DIR/lint-unsafe-code.rs:28:5 | LL | unsafe fn baz(&self); //~ ERROR: declaration of an `unsafe` method | ^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method - --> $DIR/lint-unsafe-code.rs:39:5 + --> $DIR/lint-unsafe-code.rs:29:5 | LL | unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method - --> $DIR/lint-unsafe-code.rs:40:5 + --> $DIR/lint-unsafe-code.rs:30:5 | LL | unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method - --> $DIR/lint-unsafe-code.rs:44:5 + --> $DIR/lint-unsafe-code.rs:34:5 | LL | unsafe fn baz(&self) {} //~ ERROR: implementation of an `unsafe` method | ^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method - --> $DIR/lint-unsafe-code.rs:45:5 + --> $DIR/lint-unsafe-code.rs:35:5 | LL | unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method - --> $DIR/lint-unsafe-code.rs:64:5 + --> $DIR/lint-unsafe-code.rs:54:5 | LL | unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method - --> $DIR/lint-unsafe-code.rs:75:5 + --> $DIR/lint-unsafe-code.rs:65:5 | LL | unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method - --> $DIR/lint-unsafe-code.rs:81:5 + --> $DIR/lint-unsafe-code.rs:71:5 | LL | unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method - --> $DIR/lint-unsafe-code.rs:85:5 + --> $DIR/lint-unsafe-code.rs:75:5 | LL | unsafe fn baz(&self) {} //~ ERROR: implementation of an `unsafe` method | ^^^^^^^^^^^^^^^^^^^^^^^ error: usage of an `unsafe` block - --> $DIR/lint-unsafe-code.rs:96:5 + --> $DIR/lint-unsafe-code.rs:86:5 | LL | unsafe {} //~ ERROR: usage of an `unsafe` block | ^^^^^^^^^ error: usage of an `unsafe` block - --> $DIR/lint-unsafe-code.rs:29:9 + --> $DIR/lint-unsafe-code.rs:19:9 | LL | unsafe {} //~ ERROR: usage of an `unsafe` block | ^^^^^^^^^ diff --git a/src/test/ui/lint/lint-unused-extern-crate.rs b/src/test/ui/lint/lint-unused-extern-crate.rs index 4ef185ee71c..d5e4da526a1 100644 --- a/src/test/ui/lint/lint-unused-extern-crate.rs +++ b/src/test/ui/lint/lint-unused-extern-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lint_unused_extern_crate.rs // aux-build:lint_unused_extern_crate2.rs // aux-build:lint_unused_extern_crate3.rs diff --git a/src/test/ui/lint/lint-unused-extern-crate.stderr b/src/test/ui/lint/lint-unused-extern-crate.stderr index 3a488b1e073..46499515fa7 100644 --- a/src/test/ui/lint/lint-unused-extern-crate.stderr +++ b/src/test/ui/lint/lint-unused-extern-crate.stderr @@ -1,17 +1,17 @@ error: unused extern crate - --> $DIR/lint-unused-extern-crate.rs:21:1 + --> $DIR/lint-unused-extern-crate.rs:11:1 | LL | extern crate lint_unused_extern_crate5; //~ ERROR: unused extern crate | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | note: lint level defined here - --> $DIR/lint-unused-extern-crate.rs:17:9 + --> $DIR/lint-unused-extern-crate.rs:7:9 | LL | #![deny(unused_extern_crates)] | ^^^^^^^^^^^^^^^^^^^^ error: unused extern crate - --> $DIR/lint-unused-extern-crate.rs:39:5 + --> $DIR/lint-unused-extern-crate.rs:29:5 | LL | extern crate lint_unused_extern_crate2; //~ ERROR unused extern crate | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it diff --git a/src/test/ui/lint/lint-unused-imports.rs b/src/test/ui/lint/lint-unused-imports.rs index 5bb2ab75c53..489252479fe 100644 --- a/src/test/ui/lint/lint-unused-imports.rs +++ b/src/test/ui/lint/lint-unused-imports.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused_imports)] #![allow(dead_code)] @@ -81,7 +71,7 @@ fn g() { } } -// c.f. issue #35135 +// cf. issue #35135. #[allow(unused_variables)] fn h() { use test2::foo; //~ ERROR unused import: `test2::foo` diff --git a/src/test/ui/lint/lint-unused-imports.stderr b/src/test/ui/lint/lint-unused-imports.stderr index a0292b6907e..214f4a472dc 100644 --- a/src/test/ui/lint/lint-unused-imports.stderr +++ b/src/test/ui/lint/lint-unused-imports.stderr @@ -1,53 +1,53 @@ error: unused import: `use std::fmt::{};` - --> $DIR/lint-unused-imports.rs:18:1 + --> $DIR/lint-unused-imports.rs:8:1 | LL | use std::fmt::{}; | ^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-unused-imports.rs:11:9 + --> $DIR/lint-unused-imports.rs:1:9 | LL | #![deny(unused_imports)] | ^^^^^^^^^^^^^^ error: unused imports: `None`, `Some` - --> $DIR/lint-unused-imports.rs:22:27 + --> $DIR/lint-unused-imports.rs:12:27 | LL | use std::option::Option::{Some, None}; | ^^^^ ^^^^ error: unused import: `test::A` - --> $DIR/lint-unused-imports.rs:25:5 + --> $DIR/lint-unused-imports.rs:15:5 | LL | use test::A; //~ ERROR unused import: `test::A` | ^^^^^^^ error: unused import: `bar` - --> $DIR/lint-unused-imports.rs:34:18 + --> $DIR/lint-unused-imports.rs:24:18 | LL | use test2::{foo, bar}; //~ ERROR unused import: `bar` | ^^^ error: unused import: `foo::Square` - --> $DIR/lint-unused-imports.rs:62:13 + --> $DIR/lint-unused-imports.rs:52:13 | LL | use foo::Square; //~ ERROR unused import: `foo::Square` | ^^^^^^^^^^^ error: unused import: `self::g` - --> $DIR/lint-unused-imports.rs:78:9 + --> $DIR/lint-unused-imports.rs:68:9 | LL | use self::g; //~ ERROR unused import: `self::g` | ^^^^^^^ error: unused import: `test2::foo` - --> $DIR/lint-unused-imports.rs:87:9 + --> $DIR/lint-unused-imports.rs:77:9 | LL | use test2::foo; //~ ERROR unused import: `test2::foo` | ^^^^^^^^^^ error: unused import: `test::B2` - --> $DIR/lint-unused-imports.rs:30:5 + --> $DIR/lint-unused-imports.rs:20:5 | LL | use test::B2; //~ ERROR unused import: `test::B2` | ^^^^^^^^ diff --git a/src/test/ui/lint/lint-unused-mut-self.rs b/src/test/ui/lint/lint-unused-mut-self.rs index 370f664e430..3c709d07939 100644 --- a/src/test/ui/lint/lint-unused-mut-self.rs +++ b/src/test/ui/lint/lint-unused-mut-self.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_assignments)] #![allow(unused_variables)] #![allow(dead_code)] diff --git a/src/test/ui/lint/lint-unused-mut-self.stderr b/src/test/ui/lint/lint-unused-mut-self.stderr index af2baaa2e0a..62be0c8f159 100644 --- a/src/test/ui/lint/lint-unused-mut-self.stderr +++ b/src/test/ui/lint/lint-unused-mut-self.stderr @@ -1,5 +1,5 @@ error: variable does not need to be mutable - --> $DIR/lint-unused-mut-self.rs:18:12 + --> $DIR/lint-unused-mut-self.rs:8:12 | LL | fn foo(mut self) {} //~ ERROR: variable does not need to be mutable | ----^^^^ @@ -7,13 +7,13 @@ LL | fn foo(mut self) {} //~ ERROR: variable does not need to be mutable | help: remove this `mut` | note: lint level defined here - --> $DIR/lint-unused-mut-self.rs:14:9 + --> $DIR/lint-unused-mut-self.rs:4:9 | LL | #![deny(unused_mut)] | ^^^^^^^^^^ error: variable does not need to be mutable - --> $DIR/lint-unused-mut-self.rs:19:12 + --> $DIR/lint-unused-mut-self.rs:9:12 | LL | fn bar(mut self: Box) {} //~ ERROR: variable does not need to be mutable | ----^^^^ diff --git a/src/test/ui/lint/lint-unused-mut-variables.rs b/src/test/ui/lint/lint-unused-mut-variables.rs index a2005ba9f72..da0236ac450 100644 --- a/src/test/ui/lint/lint-unused-mut-variables.rs +++ b/src/test/ui/lint/lint-unused-mut-variables.rs @@ -1,16 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - // Exercise the unused_mut attribute in some positive and negative cases #![allow(unused_assignments)] diff --git a/src/test/ui/lint/lint-unused-mut-variables.stderr b/src/test/ui/lint/lint-unused-mut-variables.stderr index 60e8400c428..a90cc964a84 100644 --- a/src/test/ui/lint/lint-unused-mut-variables.stderr +++ b/src/test/ui/lint/lint-unused-mut-variables.stderr @@ -1,5 +1,5 @@ error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:59:14 + --> $DIR/lint-unused-mut-variables.rs:46:14 | LL | let x = |mut y: isize| 10; //~ ERROR: variable does not need to be mutable | ----^ @@ -7,13 +7,13 @@ LL | let x = |mut y: isize| 10; //~ ERROR: variable does not need to be muta | help: remove this `mut` | note: lint level defined here - --> $DIR/lint-unused-mut-variables.rs:19:9 + --> $DIR/lint-unused-mut-variables.rs:6:9 | LL | #![deny(unused_mut)] | ^^^^^^^^^^ error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:24:9 + --> $DIR/lint-unused-mut-variables.rs:11:9 | LL | let mut a = 3; //~ ERROR: variable does not need to be mutable | ----^ @@ -21,7 +21,7 @@ LL | let mut a = 3; //~ ERROR: variable does not need to be mutable | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:26:9 + --> $DIR/lint-unused-mut-variables.rs:13:9 | LL | let mut a = 2; //~ ERROR: variable does not need to be mutable | ----^ @@ -29,7 +29,7 @@ LL | let mut a = 2; //~ ERROR: variable does not need to be mutable | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:28:9 + --> $DIR/lint-unused-mut-variables.rs:15:9 | LL | let mut b = 3; //~ ERROR: variable does not need to be mutable | ----^ @@ -37,7 +37,7 @@ LL | let mut b = 3; //~ ERROR: variable does not need to be mutable | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:30:9 + --> $DIR/lint-unused-mut-variables.rs:17:9 | LL | let mut a = vec![3]; //~ ERROR: variable does not need to be mutable | ----^ @@ -45,7 +45,7 @@ LL | let mut a = vec![3]; //~ ERROR: variable does not need to be mutable | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:32:10 + --> $DIR/lint-unused-mut-variables.rs:19:10 | LL | let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutable | ----^ @@ -53,7 +53,7 @@ LL | let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutabl | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:34:9 + --> $DIR/lint-unused-mut-variables.rs:21:9 | LL | let mut a; //~ ERROR: variable does not need to be mutable | ----^ @@ -61,7 +61,7 @@ LL | let mut a; //~ ERROR: variable does not need to be mutable | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:38:9 + --> $DIR/lint-unused-mut-variables.rs:25:9 | LL | let mut b; //~ ERROR: variable does not need to be mutable | ----^ @@ -69,7 +69,7 @@ LL | let mut b; //~ ERROR: variable does not need to be mutable | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:47:9 + --> $DIR/lint-unused-mut-variables.rs:34:9 | LL | mut x => {} //~ ERROR: variable does not need to be mutable | ----^ @@ -77,7 +77,7 @@ LL | mut x => {} //~ ERROR: variable does not need to be mutable | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:51:8 + --> $DIR/lint-unused-mut-variables.rs:38:8 | LL | (mut x, 1) | //~ ERROR: variable does not need to be mutable | ----^ @@ -85,7 +85,7 @@ LL | (mut x, 1) | //~ ERROR: variable does not need to be mutable | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:64:9 + --> $DIR/lint-unused-mut-variables.rs:51:9 | LL | let mut a = &mut 5; //~ ERROR: variable does not need to be mutable | ----^ @@ -93,7 +93,7 @@ LL | let mut a = &mut 5; //~ ERROR: variable does not need to be mutable | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:69:9 + --> $DIR/lint-unused-mut-variables.rs:56:9 | LL | let mut b = (&mut a,); //~ ERROR: variable does not need to be mutable | ----^ @@ -101,7 +101,7 @@ LL | let mut b = (&mut a,); //~ ERROR: variable does not need to be mutable | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:72:9 + --> $DIR/lint-unused-mut-variables.rs:59:9 | LL | let mut x = &mut 1; //~ ERROR: variable does not need to be mutable | ----^ @@ -109,7 +109,7 @@ LL | let mut x = &mut 1; //~ ERROR: variable does not need to be mutable | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:84:9 + --> $DIR/lint-unused-mut-variables.rs:71:9 | LL | let mut v : &mut Vec<()> = &mut vec![]; //~ ERROR: variable does not need to be mutable | ----^ @@ -117,7 +117,7 @@ LL | let mut v : &mut Vec<()> = &mut vec![]; //~ ERROR: variable does not ne | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:61:13 + --> $DIR/lint-unused-mut-variables.rs:48:13 | LL | fn what(mut foo: isize) {} //~ ERROR: variable does not need to be mutable | ----^^^ @@ -125,7 +125,7 @@ LL | fn what(mut foo: isize) {} //~ ERROR: variable does not need to be muta | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:79:20 + --> $DIR/lint-unused-mut-variables.rs:66:20 | LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { | ----^^^ @@ -133,7 +133,7 @@ LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:143:9 + --> $DIR/lint-unused-mut-variables.rs:130:9 | LL | let mut b = vec![2]; //~ ERROR: variable does not need to be mutable | ----^ @@ -141,7 +141,7 @@ LL | let mut b = vec![2]; //~ ERROR: variable does not need to be mutable | help: remove this `mut` | note: lint level defined here - --> $DIR/lint-unused-mut-variables.rs:139:8 + --> $DIR/lint-unused-mut-variables.rs:126:8 | LL | #[deny(unused_mut)] | ^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-uppercase-variables.rs b/src/test/ui/lint/lint-uppercase-variables.rs index 1d947684792..86a39502a81 100644 --- a/src/test/ui/lint/lint-uppercase-variables.rs +++ b/src/test/ui/lint/lint-uppercase-variables.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![warn(unused)] #![allow(dead_code)] #![deny(non_snake_case)] @@ -17,20 +7,20 @@ mod foo { } struct Something { - X: usize //~ ERROR structure field `X` should have a snake case name such as `x` + X: usize //~ ERROR structure field `X` should have a snake case name } -fn test(Xx: usize) { //~ ERROR variable `Xx` should have a snake case name such as `xx` +fn test(Xx: usize) { //~ ERROR variable `Xx` should have a snake case name println!("{}", Xx); } fn main() { - let Test: usize = 0; //~ ERROR variable `Test` should have a snake case name such as `test` + let Test: usize = 0; //~ ERROR variable `Test` should have a snake case name println!("{}", Test); match foo::Foo::Foo { Foo => {} -//~^ ERROR variable `Foo` should have a snake case name such as `foo` +//~^ ERROR variable `Foo` should have a snake case name //~^^ WARN `Foo` is named the same as one of the variants of the type `foo::Foo` //~^^^ WARN unused variable: `Foo` } diff --git a/src/test/ui/lint/lint-uppercase-variables.stderr b/src/test/ui/lint/lint-uppercase-variables.stderr index c8381d89adc..f2267f351dd 100644 --- a/src/test/ui/lint/lint-uppercase-variables.stderr +++ b/src/test/ui/lint/lint-uppercase-variables.stderr @@ -1,51 +1,51 @@ warning[E0170]: pattern binding `Foo` is named the same as one of the variants of the type `foo::Foo` - --> $DIR/lint-uppercase-variables.rs:32:9 + --> $DIR/lint-uppercase-variables.rs:22:9 | LL | Foo => {} | ^^^ help: to match on the variant, qualify the path: `foo::Foo::Foo` warning: unused variable: `Foo` - --> $DIR/lint-uppercase-variables.rs:32:9 + --> $DIR/lint-uppercase-variables.rs:22:9 | LL | Foo => {} - | ^^^ help: consider using `_Foo` instead + | ^^^ help: consider prefixing with an underscore: `_Foo` | note: lint level defined here - --> $DIR/lint-uppercase-variables.rs:11:9 + --> $DIR/lint-uppercase-variables.rs:1:9 | LL | #![warn(unused)] | ^^^^^^ = note: #[warn(unused_variables)] implied by #[warn(unused)] -error: structure field `X` should have a snake case name such as `x` - --> $DIR/lint-uppercase-variables.rs:20:5 +error: structure field `X` should have a snake case name + --> $DIR/lint-uppercase-variables.rs:10:5 | -LL | X: usize //~ ERROR structure field `X` should have a snake case name such as `x` - | ^^^^^^^^ +LL | X: usize //~ ERROR structure field `X` should have a snake case name + | ^ help: convert the identifier to snake case: `x` | note: lint level defined here - --> $DIR/lint-uppercase-variables.rs:13:9 + --> $DIR/lint-uppercase-variables.rs:3:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ -error: variable `Xx` should have a snake case name such as `xx` - --> $DIR/lint-uppercase-variables.rs:23:9 +error: variable `Xx` should have a snake case name + --> $DIR/lint-uppercase-variables.rs:13:9 | -LL | fn test(Xx: usize) { //~ ERROR variable `Xx` should have a snake case name such as `xx` - | ^^ +LL | fn test(Xx: usize) { //~ ERROR variable `Xx` should have a snake case name + | ^^ help: convert the identifier to snake case: `xx` -error: variable `Test` should have a snake case name such as `test` - --> $DIR/lint-uppercase-variables.rs:28:9 +error: variable `Test` should have a snake case name + --> $DIR/lint-uppercase-variables.rs:18:9 | -LL | let Test: usize = 0; //~ ERROR variable `Test` should have a snake case name such as `test` - | ^^^^ +LL | let Test: usize = 0; //~ ERROR variable `Test` should have a snake case name + | ^^^^ help: convert the identifier to snake case: `test` -error: variable `Foo` should have a snake case name such as `foo` - --> $DIR/lint-uppercase-variables.rs:32:9 +error: variable `Foo` should have a snake case name + --> $DIR/lint-uppercase-variables.rs:22:9 | LL | Foo => {} - | ^^^ + | ^^^ help: convert the identifier to snake case: `foo` error: aborting due to 4 previous errors diff --git a/src/test/ui/lint/lints-in-foreign-macros.rs b/src/test/ui/lint/lints-in-foreign-macros.rs index 3785968df87..adef2f9e769 100644 --- a/src/test/ui/lint/lints-in-foreign-macros.rs +++ b/src/test/ui/lint/lints-in-foreign-macros.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lints-in-foreign-macros.rs // compile-pass diff --git a/src/test/ui/lint/lints-in-foreign-macros.stderr b/src/test/ui/lint/lints-in-foreign-macros.stderr index 2ddca778123..8287ca5692b 100644 --- a/src/test/ui/lint/lints-in-foreign-macros.stderr +++ b/src/test/ui/lint/lints-in-foreign-macros.stderr @@ -1,5 +1,5 @@ warning: unused import: `std::string::ToString` - --> $DIR/lints-in-foreign-macros.rs:21:16 + --> $DIR/lints-in-foreign-macros.rs:11:16 | LL | () => {use std::string::ToString;} //~ WARN: unused import | ^^^^^^^^^^^^^^^^^^^^^ @@ -8,25 +8,25 @@ LL | mod a { foo!(); } | ------- in this macro invocation | note: lint level defined here - --> $DIR/lints-in-foreign-macros.rs:14:9 + --> $DIR/lints-in-foreign-macros.rs:4:9 | LL | #![warn(unused_imports)] //~ missing documentation for crate [missing_docs] | ^^^^^^^^^^^^^^ warning: unused import: `std::string::ToString` - --> $DIR/lints-in-foreign-macros.rs:26:18 + --> $DIR/lints-in-foreign-macros.rs:16:18 | LL | mod c { baz!(use std::string::ToString;); } //~ WARN: unused import | ^^^^^^^^^^^^^^^^^^^^^ warning: unused import: `std::string::ToString` - --> $DIR/lints-in-foreign-macros.rs:27:19 + --> $DIR/lints-in-foreign-macros.rs:17:19 | LL | mod d { baz2!(use std::string::ToString;); } //~ WARN: unused import | ^^^^^^^^^^^^^^^^^^^^^ warning: missing documentation for crate - --> $DIR/lints-in-foreign-macros.rs:14:1 + --> $DIR/lints-in-foreign-macros.rs:4:1 | LL | / #![warn(unused_imports)] //~ missing documentation for crate [missing_docs] LL | | #![warn(missing_docs)] @@ -38,19 +38,19 @@ LL | | fn main() {} | |____________^ | note: lint level defined here - --> $DIR/lints-in-foreign-macros.rs:15:9 + --> $DIR/lints-in-foreign-macros.rs:5:9 | LL | #![warn(missing_docs)] | ^^^^^^^^^^^^ warning: missing documentation for a function - --> $DIR/lints-in-foreign-macros.rs:28:6 + --> $DIR/lints-in-foreign-macros.rs:18:6 | LL | baz!(pub fn undocumented() {}); //~ WARN: missing documentation for a function | ^^^^^^^^^^^^^^^^^^^^^ warning: missing documentation for a function - --> $DIR/lints-in-foreign-macros.rs:29:7 + --> $DIR/lints-in-foreign-macros.rs:19:7 | LL | baz2!(pub fn undocumented2() {}); //~ WARN: missing documentation for a function | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/must-use-ops.rs b/src/test/ui/lint/must-use-ops.rs index c0575f817c8..60baa234987 100644 --- a/src/test/ui/lint/must-use-ops.rs +++ b/src/test/ui/lint/must-use-ops.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #50124 - Test warning for unused operator expressions // compile-pass diff --git a/src/test/ui/lint/must-use-ops.stderr b/src/test/ui/lint/must-use-ops.stderr index 0f8bd975251..febb4c193ef 100644 --- a/src/test/ui/lint/must-use-ops.stderr +++ b/src/test/ui/lint/must-use-ops.stderr @@ -1,131 +1,131 @@ warning: unused comparison that must be used - --> $DIR/must-use-ops.rs:22:5 + --> $DIR/must-use-ops.rs:12:5 | LL | val == 1; | ^^^^^^^^ | note: lint level defined here - --> $DIR/must-use-ops.rs:15:9 + --> $DIR/must-use-ops.rs:5:9 | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ warning: unused comparison that must be used - --> $DIR/must-use-ops.rs:23:5 + --> $DIR/must-use-ops.rs:13:5 | LL | val < 1; | ^^^^^^^ warning: unused comparison that must be used - --> $DIR/must-use-ops.rs:24:5 + --> $DIR/must-use-ops.rs:14:5 | LL | val <= 1; | ^^^^^^^^ warning: unused comparison that must be used - --> $DIR/must-use-ops.rs:25:5 + --> $DIR/must-use-ops.rs:15:5 | LL | val != 1; | ^^^^^^^^ warning: unused comparison that must be used - --> $DIR/must-use-ops.rs:26:5 + --> $DIR/must-use-ops.rs:16:5 | LL | val >= 1; | ^^^^^^^^ warning: unused comparison that must be used - --> $DIR/must-use-ops.rs:27:5 + --> $DIR/must-use-ops.rs:17:5 | LL | val > 1; | ^^^^^^^ warning: unused arithmetic operation that must be used - --> $DIR/must-use-ops.rs:30:5 + --> $DIR/must-use-ops.rs:20:5 | LL | val + 2; | ^^^^^^^ warning: unused arithmetic operation that must be used - --> $DIR/must-use-ops.rs:31:5 + --> $DIR/must-use-ops.rs:21:5 | LL | val - 2; | ^^^^^^^ warning: unused arithmetic operation that must be used - --> $DIR/must-use-ops.rs:32:5 + --> $DIR/must-use-ops.rs:22:5 | LL | val / 2; | ^^^^^^^ warning: unused arithmetic operation that must be used - --> $DIR/must-use-ops.rs:33:5 + --> $DIR/must-use-ops.rs:23:5 | LL | val * 2; | ^^^^^^^ warning: unused arithmetic operation that must be used - --> $DIR/must-use-ops.rs:34:5 + --> $DIR/must-use-ops.rs:24:5 | LL | val % 2; | ^^^^^^^ warning: unused logical operation that must be used - --> $DIR/must-use-ops.rs:37:5 + --> $DIR/must-use-ops.rs:27:5 | LL | true && true; | ^^^^^^^^^^^^ warning: unused logical operation that must be used - --> $DIR/must-use-ops.rs:38:5 + --> $DIR/must-use-ops.rs:28:5 | LL | false || true; | ^^^^^^^^^^^^^ warning: unused bitwise operation that must be used - --> $DIR/must-use-ops.rs:41:5 + --> $DIR/must-use-ops.rs:31:5 | LL | 5 ^ val; | ^^^^^^^ warning: unused bitwise operation that must be used - --> $DIR/must-use-ops.rs:42:5 + --> $DIR/must-use-ops.rs:32:5 | LL | 5 & val; | ^^^^^^^ warning: unused bitwise operation that must be used - --> $DIR/must-use-ops.rs:43:5 + --> $DIR/must-use-ops.rs:33:5 | LL | 5 | val; | ^^^^^^^ warning: unused bitwise operation that must be used - --> $DIR/must-use-ops.rs:44:5 + --> $DIR/must-use-ops.rs:34:5 | LL | 5 << val; | ^^^^^^^^ warning: unused bitwise operation that must be used - --> $DIR/must-use-ops.rs:45:5 + --> $DIR/must-use-ops.rs:35:5 | LL | 5 >> val; | ^^^^^^^^ warning: unused unary operation that must be used - --> $DIR/must-use-ops.rs:48:5 + --> $DIR/must-use-ops.rs:38:5 | LL | !val; | ^^^^ warning: unused unary operation that must be used - --> $DIR/must-use-ops.rs:49:5 + --> $DIR/must-use-ops.rs:39:5 | LL | -val; | ^^^^ warning: unused unary operation that must be used - --> $DIR/must-use-ops.rs:50:5 + --> $DIR/must-use-ops.rs:40:5 | LL | *val_pointer; | ^^^^^^^^^^^^ diff --git a/src/test/ui/lint/not_found.rs b/src/test/ui/lint/not_found.rs index fa3b491db62..0b5a4eb7851 100644 --- a/src/test/ui/lint/not_found.rs +++ b/src/test/ui/lint/not_found.rs @@ -1,13 +1,3 @@ -// Copyright 2014–2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // this tests the `unknown_lint` lint, especially the suggestions diff --git a/src/test/ui/lint/not_found.stderr b/src/test/ui/lint/not_found.stderr index 603b5410444..266cf10af82 100644 --- a/src/test/ui/lint/not_found.stderr +++ b/src/test/ui/lint/not_found.stderr @@ -1,5 +1,5 @@ warning: unknown lint: `FOO_BAR` - --> $DIR/not_found.rs:16:9 + --> $DIR/not_found.rs:6:9 | LL | #[allow(FOO_BAR)] | ^^^^^^^ @@ -7,14 +7,14 @@ LL | #[allow(FOO_BAR)] = note: #[warn(unknown_lints)] on by default warning: unknown lint: `DEAD_CODE` - --> $DIR/not_found.rs:18:8 + --> $DIR/not_found.rs:8:8 | LL | #[warn(DEAD_CODE)] - | ^^^^^^^^^ help: lowercase the lint name: `dead_code` + | ^^^^^^^^^ help: did you mean: `dead_code` warning: unknown lint: `Warnings` - --> $DIR/not_found.rs:20:8 + --> $DIR/not_found.rs:10:8 | LL | #[deny(Warnings)] - | ^^^^^^^^ help: lowercase the lint name: `warnings` + | ^^^^^^^^ help: did you mean: `warnings` diff --git a/src/test/ui/lint/outer-forbid.rs b/src/test/ui/lint/outer-forbid.rs index 23e98cc22fc..950533cca1a 100644 --- a/src/test/ui/lint/outer-forbid.rs +++ b/src/test/ui/lint/outer-forbid.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Forbidding a group (here, `unused`) overrules subsequent allowance of both // the group, and an individual lint in the group (here, `unused_variables`); // and, forbidding an individual lint (here, `non_snake_case`) overrules diff --git a/src/test/ui/lint/outer-forbid.stderr b/src/test/ui/lint/outer-forbid.stderr index c011b49eaee..57ad55a37f0 100644 --- a/src/test/ui/lint/outer-forbid.stderr +++ b/src/test/ui/lint/outer-forbid.stderr @@ -1,5 +1,5 @@ error[E0453]: allow(unused_variables) overruled by outer forbid(unused) - --> $DIR/outer-forbid.rs:19:9 + --> $DIR/outer-forbid.rs:9:9 | LL | #![forbid(unused, non_snake_case)] | ------ `forbid` level set here @@ -8,7 +8,7 @@ LL | #[allow(unused_variables)] //~ ERROR overruled | ^^^^^^^^^^^^^^^^ overruled by previous forbid error[E0453]: allow(unused) overruled by outer forbid(unused) - --> $DIR/outer-forbid.rs:22:9 + --> $DIR/outer-forbid.rs:12:9 | LL | #![forbid(unused, non_snake_case)] | ------ `forbid` level set here @@ -17,7 +17,7 @@ LL | #[allow(unused)] //~ ERROR overruled | ^^^^^^ overruled by previous forbid error[E0453]: allow(nonstandard_style) overruled by outer forbid(non_snake_case) - --> $DIR/outer-forbid.rs:25:9 + --> $DIR/outer-forbid.rs:15:9 | LL | #![forbid(unused, non_snake_case)] | -------------- `forbid` level set here diff --git a/src/test/ui/lint/reasons.stderr b/src/test/ui/lint/reasons.stderr index df0f9cb9b61..3bb1480a301 100644 --- a/src/test/ui/lint/reasons.stderr +++ b/src/test/ui/lint/reasons.stderr @@ -11,11 +11,11 @@ note: lint level defined here LL | #![warn(elided_lifetimes_in_paths, | ^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: variable `Social_exchange_psychology` should have a snake case name such as `social_exchange_psychology` +warning: variable `Social_exchange_psychology` should have a snake case name --> $DIR/reasons.rs:30:9 | LL | let Social_exchange_psychology = CheaterDetectionMechanism {}; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `social_exchange_psychology` | = note: people shouldn't have to change their usual style habits to contribute to our project diff --git a/src/test/ui/lint/suggestions.rs b/src/test/ui/lint/suggestions.rs index 77d546a00ec..a497953d73a 100644 --- a/src/test/ui/lint/suggestions.rs +++ b/src/test/ui/lint/suggestions.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-tab #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896 diff --git a/src/test/ui/lint/suggestions.stderr b/src/test/ui/lint/suggestions.stderr index 73704614815..c70f17f95d0 100644 --- a/src/test/ui/lint/suggestions.stderr +++ b/src/test/ui/lint/suggestions.stderr @@ -1,17 +1,17 @@ warning: unnecessary parentheses around assigned value - --> $DIR/suggestions.rs:59:31 + --> $DIR/suggestions.rs:49:31 | LL | let mut registry_no = (format!("NX-{}", 74205)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses | note: lint level defined here - --> $DIR/suggestions.rs:13:21 + --> $DIR/suggestions.rs:3:21 | LL | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896 | ^^^^^^^^^^^^^ warning: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721 - --> $DIR/suggestions.rs:52:1 + --> $DIR/suggestions.rs:42:1 | LL | #[no_debug] // should suggest removal of deprecated attribute | ^^^^^^^^^^^ help: remove this attribute @@ -19,7 +19,7 @@ LL | #[no_debug] // should suggest removal of deprecated attribute = note: #[warn(deprecated)] on by default warning: variable does not need to be mutable - --> $DIR/suggestions.rs:59:13 + --> $DIR/suggestions.rs:49:13 | LL | let mut registry_no = (format!("NX-{}", 74205)); | ----^^^^^^^^^^^ @@ -27,13 +27,13 @@ LL | let mut registry_no = (format!("NX-{}", 74205)); | help: remove this `mut` | note: lint level defined here - --> $DIR/suggestions.rs:13:9 + --> $DIR/suggestions.rs:3:9 | LL | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896 | ^^^^^^^^^^ warning: variable does not need to be mutable - --> $DIR/suggestions.rs:65:13 + --> $DIR/suggestions.rs:55:13 | LL | let mut | _____________^ @@ -45,7 +45,7 @@ LL | || b = 1; | help: remove this `mut` error: const items should never be #[no_mangle] - --> $DIR/suggestions.rs:16:14 + --> $DIR/suggestions.rs:6:14 | LL | #[no_mangle] const DISCOVERY: usize = 1; | -----^^^^^^^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | #[no_mangle] const DISCOVERY: usize = 1; = note: #[deny(no_mangle_const_items)] on by default warning: functions generic over types must be mangled - --> $DIR/suggestions.rs:22:1 + --> $DIR/suggestions.rs:12:1 | LL | #[no_mangle] | ------------ help: remove this attribute @@ -66,7 +66,7 @@ LL | pub fn defiant(_t: T) {} = note: #[warn(no_mangle_generic_items)] on by default error: const items should never be #[no_mangle] - --> $DIR/suggestions.rs:32:18 + --> $DIR/suggestions.rs:22:18 | LL | #[no_mangle] pub const DAUNTLESS: bool = true; | ---------^^^^^^^^^^^^^^^^^^^^^^^^ @@ -74,7 +74,7 @@ LL | #[no_mangle] pub const DAUNTLESS: bool = true; | help: try a static value: `pub static` warning: functions generic over types must be mangled - --> $DIR/suggestions.rs:35:18 + --> $DIR/suggestions.rs:25:18 | LL | #[no_mangle] pub fn val_jean() {} | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ @@ -82,7 +82,7 @@ LL | #[no_mangle] pub fn val_jean() {} | help: remove this attribute error: const items should never be #[no_mangle] - --> $DIR/suggestions.rs:40:18 + --> $DIR/suggestions.rs:30:18 | LL | #[no_mangle] pub(crate) const VETAR: bool = true; | ----------------^^^^^^^^^^^^^^^^^^^^ @@ -90,7 +90,7 @@ LL | #[no_mangle] pub(crate) const VETAR: bool = true; | help: try a static value: `pub static` warning: functions generic over types must be mangled - --> $DIR/suggestions.rs:43:18 + --> $DIR/suggestions.rs:33:18 | LL | #[no_mangle] pub(crate) fn crossfield() {} | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -98,7 +98,7 @@ LL | #[no_mangle] pub(crate) fn crossfield() {} | help: remove this attribute warning: denote infinite loops with `loop { ... }` - --> $DIR/suggestions.rs:56:5 + --> $DIR/suggestions.rs:46:5 | LL | while true { | ^^^^^^^^^^ help: use `loop` @@ -106,7 +106,7 @@ LL | while true { = note: #[warn(while_true)] on by default warning: the `warp_factor:` in this pattern is redundant - --> $DIR/suggestions.rs:71:23 + --> $DIR/suggestions.rs:61:23 | LL | Equinox { warp_factor: warp_factor } => {} | ------------^^^^^^^^^^^^ diff --git a/src/test/ui/lint/test-inner-fn.rs b/src/test/ui/lint/test-inner-fn.rs index a7727c69e4c..d419cc6fa45 100644 --- a/src/test/ui/lint/test-inner-fn.rs +++ b/src/test/ui/lint/test-inner-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test -D unnameable_test_items #[test] diff --git a/src/test/ui/lint/test-inner-fn.stderr b/src/test/ui/lint/test-inner-fn.stderr index 182fb31a9aa..12838cec024 100644 --- a/src/test/ui/lint/test-inner-fn.stderr +++ b/src/test/ui/lint/test-inner-fn.stderr @@ -1,5 +1,5 @@ error: cannot test inner items - --> $DIR/test-inner-fn.rs:15:5 + --> $DIR/test-inner-fn.rs:5:5 | LL | #[test] //~ ERROR cannot test inner items [unnameable_test_items] | ^^^^^^^ @@ -7,7 +7,7 @@ LL | #[test] //~ ERROR cannot test inner items [unnameable_test_items] = note: requested on the command line with `-D unnameable-test-items` error: cannot test inner items - --> $DIR/test-inner-fn.rs:23:9 + --> $DIR/test-inner-fn.rs:13:9 | LL | #[test] //~ ERROR cannot test inner items [unnameable_test_items] | ^^^^^^^ diff --git a/src/test/ui/lint/trivial-casts-featuring-type-ascription.rs b/src/test/ui/lint/trivial-casts-featuring-type-ascription.rs index fba3724ae49..96bf2dcfbbf 100644 --- a/src/test/ui/lint/trivial-casts-featuring-type-ascription.rs +++ b/src/test/ui/lint/trivial-casts-featuring-type-ascription.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(trivial_casts, trivial_numeric_casts)] #![feature(type_ascription)] diff --git a/src/test/ui/lint/trivial-casts-featuring-type-ascription.stderr b/src/test/ui/lint/trivial-casts-featuring-type-ascription.stderr index a77135c875d..c1a4b393cd6 100644 --- a/src/test/ui/lint/trivial-casts-featuring-type-ascription.stderr +++ b/src/test/ui/lint/trivial-casts-featuring-type-ascription.stderr @@ -1,24 +1,24 @@ error: trivial numeric cast: `i32` as `i32` - --> $DIR/trivial-casts-featuring-type-ascription.rs:15:22 + --> $DIR/trivial-casts-featuring-type-ascription.rs:5:22 | LL | let lugubrious = 12i32 as i32; | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/trivial-casts-featuring-type-ascription.rs:11:24 + --> $DIR/trivial-casts-featuring-type-ascription.rs:1:24 | LL | #![deny(trivial_casts, trivial_numeric_casts)] | ^^^^^^^^^^^^^^^^^^^^^ = help: cast can be replaced by coercion; this might require type ascription or a temporary variable error: trivial cast: `&u32` as `*const u32` - --> $DIR/trivial-casts-featuring-type-ascription.rs:18:13 + --> $DIR/trivial-casts-featuring-type-ascription.rs:8:13 | LL | let _ = haunted as *const u32; | ^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/trivial-casts-featuring-type-ascription.rs:11:9 + --> $DIR/trivial-casts-featuring-type-ascription.rs:1:9 | LL | #![deny(trivial_casts, trivial_numeric_casts)] | ^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/trivial-casts.rs b/src/test/ui/lint/trivial-casts.rs index 759b282c0da..b17de624acb 100644 --- a/src/test/ui/lint/trivial-casts.rs +++ b/src/test/ui/lint/trivial-casts.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(trivial_casts, trivial_numeric_casts)] fn main() { diff --git a/src/test/ui/lint/trivial-casts.stderr b/src/test/ui/lint/trivial-casts.stderr index d52869f4bed..f411db1ab0e 100644 --- a/src/test/ui/lint/trivial-casts.stderr +++ b/src/test/ui/lint/trivial-casts.stderr @@ -1,24 +1,24 @@ error: trivial numeric cast: `i32` as `i32` - --> $DIR/trivial-casts.rs:14:22 + --> $DIR/trivial-casts.rs:4:22 | LL | let lugubrious = 12i32 as i32; | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/trivial-casts.rs:11:24 + --> $DIR/trivial-casts.rs:1:24 | LL | #![deny(trivial_casts, trivial_numeric_casts)] | ^^^^^^^^^^^^^^^^^^^^^ = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&u32` as `*const u32` - --> $DIR/trivial-casts.rs:17:13 + --> $DIR/trivial-casts.rs:7:13 | LL | let _ = haunted as *const u32; | ^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/trivial-casts.rs:11:9 + --> $DIR/trivial-casts.rs:1:9 | LL | #![deny(trivial_casts, trivial_numeric_casts)] | ^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/type-overflow.rs b/src/test/ui/lint/type-overflow.rs index 6e1e3ee8f43..2ccc52a0413 100644 --- a/src/test/ui/lint/type-overflow.rs +++ b/src/test/ui/lint/type-overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass fn main() { diff --git a/src/test/ui/lint/type-overflow.stderr b/src/test/ui/lint/type-overflow.stderr index 6f5d3d07aea..3c4a37c4adf 100644 --- a/src/test/ui/lint/type-overflow.stderr +++ b/src/test/ui/lint/type-overflow.stderr @@ -1,5 +1,5 @@ warning: literal out of range for i8 - --> $DIR/type-overflow.rs:14:17 + --> $DIR/type-overflow.rs:4:17 | LL | let error = 255i8; //~WARNING literal out of range for i8 | ^^^^^ @@ -7,7 +7,7 @@ LL | let error = 255i8; //~WARNING literal out of range for i8 = note: #[warn(overflowing_literals)] on by default warning: literal out of range for i8 - --> $DIR/type-overflow.rs:19:16 + --> $DIR/type-overflow.rs:9:16 | LL | let fail = 0b1000_0001i8; //~WARNING literal out of range for i8 | ^^^^^^^^^^^^^ help: consider using `u8` instead: `0b1000_0001u8` @@ -15,7 +15,7 @@ LL | let fail = 0b1000_0001i8; //~WARNING literal out of range for i8 = note: the literal `0b1000_0001i8` (decimal `129`) does not fit into an `i8` and will become `-127i8` warning: literal out of range for i64 - --> $DIR/type-overflow.rs:21:16 + --> $DIR/type-overflow.rs:11:16 | LL | let fail = 0x8000_0000_0000_0000i64; //~WARNING literal out of range for i64 | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `u64` instead: `0x8000_0000_0000_0000u64` @@ -23,7 +23,7 @@ LL | let fail = 0x8000_0000_0000_0000i64; //~WARNING literal out of range fo = note: the literal `0x8000_0000_0000_0000i64` (decimal `9223372036854775808`) does not fit into an `i64` and will become `-9223372036854775808i64` warning: literal out of range for u32 - --> $DIR/type-overflow.rs:23:16 + --> $DIR/type-overflow.rs:13:16 | LL | let fail = 0x1_FFFF_FFFFu32; //~WARNING literal out of range for u32 | ^^^^^^^^^^^^^^^^ help: consider using `u64` instead: `0x1_FFFF_FFFFu64` @@ -31,7 +31,7 @@ LL | let fail = 0x1_FFFF_FFFFu32; //~WARNING literal out of range for u32 = note: the literal `0x1_FFFF_FFFFu32` (decimal `8589934591`) does not fit into an `u32` and will become `4294967295u32` warning: literal out of range for i128 - --> $DIR/type-overflow.rs:25:22 + --> $DIR/type-overflow.rs:15:22 | LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -40,7 +40,7 @@ LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; = help: consider using `u128` instead warning: literal out of range for i32 - --> $DIR/type-overflow.rs:28:16 + --> $DIR/type-overflow.rs:18:16 | LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; //~WARNING literal out of range for i32 | ^^^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; //~WARNING literal out of range for i = help: consider using `i128` instead warning: literal out of range for i8 - --> $DIR/type-overflow.rs:30:17 + --> $DIR/type-overflow.rs:20:17 | LL | let fail = -0b1111_1111i8; //~WARNING literal out of range for i8 | ^^^^^^^^^^^^^ help: consider using `i16` instead: `0b1111_1111i16` diff --git a/src/test/ui/lint/unreachable_pub-pub_crate.rs b/src/test/ui/lint/unreachable_pub-pub_crate.rs index b58bbe74c97..6739c7f096b 100644 --- a/src/test/ui/lint/unreachable_pub-pub_crate.rs +++ b/src/test/ui/lint/unreachable_pub-pub_crate.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is just like unreachable_pub.rs, but without the // `crate_visibility_modifier` feature (so that we can test the suggestions to // use `pub(crate)` that are given when that feature is off, as opposed to the diff --git a/src/test/ui/lint/unreachable_pub-pub_crate.stderr b/src/test/ui/lint/unreachable_pub-pub_crate.stderr index ed45ba8e85d..2b3f74a18af 100644 --- a/src/test/ui/lint/unreachable_pub-pub_crate.stderr +++ b/src/test/ui/lint/unreachable_pub-pub_crate.stderr @@ -1,5 +1,5 @@ warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:25:5 + --> $DIR/unreachable_pub-pub_crate.rs:15:5 | LL | pub use std::fmt; | ---^^^^^^^^^^^^^^ @@ -7,14 +7,14 @@ LL | pub use std::fmt; | help: consider restricting its visibility: `pub(crate)` | note: lint level defined here - --> $DIR/unreachable_pub-pub_crate.rs:21:9 + --> $DIR/unreachable_pub-pub_crate.rs:11:9 | LL | #![warn(unreachable_pub)] | ^^^^^^^^^^^^^^^ = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:26:24 + --> $DIR/unreachable_pub-pub_crate.rs:16:24 | LL | pub use std::env::{Args}; // braced-use has different item spans than unbraced | --- ^^^^ @@ -24,7 +24,7 @@ LL | pub use std::env::{Args}; // braced-use has different item spans than u = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:28:5 + --> $DIR/unreachable_pub-pub_crate.rs:18:5 | LL | pub struct Hydrogen { | ---^^^^^^^^^^^^^^^^ @@ -34,7 +34,7 @@ LL | pub struct Hydrogen { = help: or consider exporting it for use by other crates warning: unreachable `pub` field - --> $DIR/unreachable_pub-pub_crate.rs:30:9 + --> $DIR/unreachable_pub-pub_crate.rs:20:9 | LL | pub neutrons: usize, | ---^^^^^^^^^^^^^^^^ @@ -42,7 +42,7 @@ LL | pub neutrons: usize, | help: consider restricting its visibility: `pub(crate)` warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:36:9 + --> $DIR/unreachable_pub-pub_crate.rs:26:9 | LL | pub fn count_neutrons(&self) -> usize { self.neutrons } | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -50,7 +50,7 @@ LL | pub fn count_neutrons(&self) -> usize { self.neutrons } | help: consider restricting its visibility: `pub(crate)` warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:40:5 + --> $DIR/unreachable_pub-pub_crate.rs:30:5 | LL | pub enum Helium {} | ---^^^^^^^^^^^^ @@ -60,7 +60,7 @@ LL | pub enum Helium {} = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:41:5 + --> $DIR/unreachable_pub-pub_crate.rs:31:5 | LL | pub union Lithium { c1: usize, c2: u8 } | ---^^^^^^^^^^^^^^ @@ -70,7 +70,7 @@ LL | pub union Lithium { c1: usize, c2: u8 } = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:42:5 + --> $DIR/unreachable_pub-pub_crate.rs:32:5 | LL | pub fn beryllium() {} | ---^^^^^^^^^^^^^^^ @@ -80,7 +80,7 @@ LL | pub fn beryllium() {} = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:43:5 + --> $DIR/unreachable_pub-pub_crate.rs:33:5 | LL | pub trait Boron {} | ---^^^^^^^^^^^^ @@ -90,7 +90,7 @@ LL | pub trait Boron {} = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:44:5 + --> $DIR/unreachable_pub-pub_crate.rs:34:5 | LL | pub const CARBON: usize = 1; | ---^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -100,7 +100,7 @@ LL | pub const CARBON: usize = 1; = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:45:5 + --> $DIR/unreachable_pub-pub_crate.rs:35:5 | LL | pub static NITROGEN: usize = 2; | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -110,7 +110,7 @@ LL | pub static NITROGEN: usize = 2; = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:46:5 + --> $DIR/unreachable_pub-pub_crate.rs:36:5 | LL | pub type Oxygen = bool; | ---^^^^^^^^^^^^^^^^^^^^ @@ -120,7 +120,7 @@ LL | pub type Oxygen = bool; = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:49:47 + --> $DIR/unreachable_pub-pub_crate.rs:39:47 | LL | ($visibility: vis, $name: ident) => { $visibility struct $name {} } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -134,7 +134,7 @@ LL | define_empty_struct_with_visibility!(pub, Fluorine); = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:54:9 + --> $DIR/unreachable_pub-pub_crate.rs:44:9 | LL | pub fn catalyze() -> bool; | ---^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/unreachable_pub.rs b/src/test/ui/lint/unreachable_pub.rs index 217e26e4404..12726b6ecae 100644 --- a/src/test/ui/lint/unreachable_pub.rs +++ b/src/test/ui/lint/unreachable_pub.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(crate_visibility_modifier)] diff --git a/src/test/ui/lint/unreachable_pub.stderr b/src/test/ui/lint/unreachable_pub.stderr index e1d00d13717..6352f3e2c5c 100644 --- a/src/test/ui/lint/unreachable_pub.stderr +++ b/src/test/ui/lint/unreachable_pub.stderr @@ -1,5 +1,5 @@ warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:20:5 + --> $DIR/unreachable_pub.rs:10:5 | LL | pub use std::fmt; | ---^^^^^^^^^^^^^^ @@ -7,14 +7,14 @@ LL | pub use std::fmt; | help: consider restricting its visibility: `crate` | note: lint level defined here - --> $DIR/unreachable_pub.rs:16:9 + --> $DIR/unreachable_pub.rs:6:9 | LL | #![warn(unreachable_pub)] | ^^^^^^^^^^^^^^^ = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:21:24 + --> $DIR/unreachable_pub.rs:11:24 | LL | pub use std::env::{Args}; // braced-use has different item spans than unbraced | --- ^^^^ @@ -24,7 +24,7 @@ LL | pub use std::env::{Args}; // braced-use has different item spans than u = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:23:5 + --> $DIR/unreachable_pub.rs:13:5 | LL | pub struct Hydrogen { | ---^^^^^^^^^^^^^^^^ @@ -34,7 +34,7 @@ LL | pub struct Hydrogen { = help: or consider exporting it for use by other crates warning: unreachable `pub` field - --> $DIR/unreachable_pub.rs:25:9 + --> $DIR/unreachable_pub.rs:15:9 | LL | pub neutrons: usize, | ---^^^^^^^^^^^^^^^^ @@ -42,7 +42,7 @@ LL | pub neutrons: usize, | help: consider restricting its visibility: `crate` warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:31:9 + --> $DIR/unreachable_pub.rs:21:9 | LL | pub fn count_neutrons(&self) -> usize { self.neutrons } | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -50,7 +50,7 @@ LL | pub fn count_neutrons(&self) -> usize { self.neutrons } | help: consider restricting its visibility: `crate` warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:35:5 + --> $DIR/unreachable_pub.rs:25:5 | LL | pub enum Helium {} | ---^^^^^^^^^^^^ @@ -60,7 +60,7 @@ LL | pub enum Helium {} = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:36:5 + --> $DIR/unreachable_pub.rs:26:5 | LL | pub union Lithium { c1: usize, c2: u8 } | ---^^^^^^^^^^^^^^ @@ -70,7 +70,7 @@ LL | pub union Lithium { c1: usize, c2: u8 } = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:37:5 + --> $DIR/unreachable_pub.rs:27:5 | LL | pub fn beryllium() {} | ---^^^^^^^^^^^^^^^ @@ -80,7 +80,7 @@ LL | pub fn beryllium() {} = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:38:5 + --> $DIR/unreachable_pub.rs:28:5 | LL | pub trait Boron {} | ---^^^^^^^^^^^^ @@ -90,7 +90,7 @@ LL | pub trait Boron {} = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:39:5 + --> $DIR/unreachable_pub.rs:29:5 | LL | pub const CARBON: usize = 1; | ---^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -100,7 +100,7 @@ LL | pub const CARBON: usize = 1; = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:40:5 + --> $DIR/unreachable_pub.rs:30:5 | LL | pub static NITROGEN: usize = 2; | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -110,7 +110,7 @@ LL | pub static NITROGEN: usize = 2; = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:41:5 + --> $DIR/unreachable_pub.rs:31:5 | LL | pub type Oxygen = bool; | ---^^^^^^^^^^^^^^^^^^^^ @@ -120,7 +120,7 @@ LL | pub type Oxygen = bool; = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:44:47 + --> $DIR/unreachable_pub.rs:34:47 | LL | ($visibility: vis, $name: ident) => { $visibility struct $name {} } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -134,7 +134,7 @@ LL | define_empty_struct_with_visibility!(pub, Fluorine); = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:49:9 + --> $DIR/unreachable_pub.rs:39:9 | LL | pub fn catalyze() -> bool; | ---^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/unused_labels.rs b/src/test/ui/lint/unused_labels.rs index 23add604da6..26ab9fbe5c8 100644 --- a/src/test/ui/lint/unused_labels.rs +++ b/src/test/ui/lint/unused_labels.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The output should warn when a loop label is not used. However, it // should also deal with the edge cases where a label is shadowed, // within nested loops diff --git a/src/test/ui/lint/unused_labels.stderr b/src/test/ui/lint/unused_labels.stderr index 825f5e281f0..39d0a7850ef 100644 --- a/src/test/ui/lint/unused_labels.stderr +++ b/src/test/ui/lint/unused_labels.stderr @@ -1,59 +1,59 @@ warning: unused label - --> $DIR/unused_labels.rs:21:5 + --> $DIR/unused_labels.rs:11:5 | LL | 'unused_while_label: while 0 == 0 { | ^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/unused_labels.rs:18:9 + --> $DIR/unused_labels.rs:8:9 | LL | #![warn(unused_labels)] | ^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:26:5 + --> $DIR/unused_labels.rs:16:5 | LL | 'unused_while_let_label: while let Some(_) = opt { | ^^^^^^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:30:5 + --> $DIR/unused_labels.rs:20:5 | LL | 'unused_for_label: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:46:9 + --> $DIR/unused_labels.rs:36:9 | LL | 'unused_loop_label_inner_2: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:52:5 + --> $DIR/unused_labels.rs:42:5 | LL | 'unused_loop_label_outer_3: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:70:5 + --> $DIR/unused_labels.rs:60:5 | LL | 'many_used_shadowed: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:82:5 + --> $DIR/unused_labels.rs:72:5 | LL | 'unused_loop_label: loop { | ^^^^^^^^^^^^^^^^^^ warning: unused label - --> $DIR/unused_labels.rs:88:5 + --> $DIR/unused_labels.rs:78:5 | LL | 'unused_block_label: { | ^^^^^^^^^^^^^^^^^^^ warning: label name `'many_used_shadowed` shadows a label name that is already in scope - --> $DIR/unused_labels.rs:72:9 + --> $DIR/unused_labels.rs:62:9 | LL | 'many_used_shadowed: for _ in 0..10 { | ------------------- first declared here diff --git a/src/test/ui/lint/unused_parens_json_suggestion.rs b/src/test/ui/lint/unused_parens_json_suggestion.rs index 9eda59614f4..4462c53152a 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.rs +++ b/src/test/ui/lint/unused_parens_json_suggestion.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --error-format pretty-json -Zunstable-options // compile-pass diff --git a/src/test/ui/lint/unused_parens_json_suggestion.stderr b/src/test/ui/lint/unused_parens_json_suggestion.stderr index 2a9bd2948ff..07d96d5c482 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_json_suggestion.stderr @@ -8,10 +8,10 @@ "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 1043, - "byte_end": 1056, - "line_start": 25, - "line_end": 25, + "byte_start": 576, + "byte_end": 589, + "line_start": 15, + "line_end": 15, "column_start": 14, "column_end": 27, "is_primary": true, @@ -36,10 +36,10 @@ "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 889, - "byte_end": 902, - "line_start": 20, - "line_end": 20, + "byte_start": 422, + "byte_end": 435, + "line_start": 10, + "line_end": 10, "column_start": 9, "column_end": 22, "is_primary": true, @@ -66,10 +66,10 @@ "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 1043, - "byte_end": 1056, - "line_start": 25, - "line_end": 25, + "byte_start": 576, + "byte_end": 589, + "line_start": 15, + "line_end": 15, "column_start": 14, "column_end": 27, "is_primary": true, @@ -91,13 +91,13 @@ } ], "rendered": "warning: unnecessary parentheses around assigned value - --> $DIR/unused_parens_json_suggestion.rs:25:14 + --> $DIR/unused_parens_json_suggestion.rs:15:14 | LL | let _a = (1 / (2 + 3)); | ^^^^^^^^^^^^^ help: remove these parentheses | note: lint level defined here - --> $DIR/unused_parens_json_suggestion.rs:20:9 + --> $DIR/unused_parens_json_suggestion.rs:10:9 | LL | #![warn(unused_parens)] | ^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/use_suggestion_json.rs b/src/test/ui/lint/use_suggestion_json.rs index c097a8f1342..3bdbaa55f2d 100644 --- a/src/test/ui/lint/use_suggestion_json.rs +++ b/src/test/ui/lint/use_suggestion_json.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi // compile-flags: --error-format pretty-json -Zunstable-options diff --git a/src/test/ui/lint/use_suggestion_json.stderr b/src/test/ui/lint/use_suggestion_json.stderr index ce2657a4495..dee7f2f9b16 100644 --- a/src/test/ui/lint/use_suggestion_json.stderr +++ b/src/test/ui/lint/use_suggestion_json.stderr @@ -73,10 +73,10 @@ mod foo { "spans": [ { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 907, - "byte_end": 911, - "line_start": 21, - "line_end": 21, + "byte_start": 440, + "byte_end": 444, + "line_start": 11, + "line_end": 11, "column_start": 12, "column_end": 16, "is_primary": true, @@ -101,10 +101,10 @@ mod foo { "spans": [ { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 884, - "byte_end": 884, - "line_start": 20, - "line_end": 20, + "byte_start": 417, + "byte_end": 417, + "line_start": 10, + "line_end": 10, "column_start": 1, "column_end": 1, "is_primary": true, @@ -124,10 +124,10 @@ mod foo { }, { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 884, - "byte_end": 884, - "line_start": 20, - "line_end": 20, + "byte_start": 417, + "byte_end": 417, + "line_start": 10, + "line_end": 10, "column_start": 1, "column_end": 1, "is_primary": true, @@ -147,10 +147,10 @@ mod foo { }, { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 884, - "byte_end": 884, - "line_start": 20, - "line_end": 20, + "byte_start": 417, + "byte_end": 417, + "line_start": 10, + "line_end": 10, "column_start": 1, "column_end": 1, "is_primary": true, @@ -170,10 +170,10 @@ mod foo { }, { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 884, - "byte_end": 884, - "line_start": 20, - "line_end": 20, + "byte_start": 417, + "byte_end": 417, + "line_start": 10, + "line_end": 10, "column_start": 1, "column_end": 1, "is_primary": true, @@ -193,10 +193,10 @@ mod foo { }, { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 884, - "byte_end": 884, - "line_start": 20, - "line_end": 20, + "byte_start": 417, + "byte_end": 417, + "line_start": 10, + "line_end": 10, "column_start": 1, "column_end": 1, "is_primary": true, @@ -216,10 +216,10 @@ mod foo { }, { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 884, - "byte_end": 884, - "line_start": 20, - "line_end": 20, + "byte_start": 417, + "byte_end": 417, + "line_start": 10, + "line_end": 10, "column_start": 1, "column_end": 1, "is_primary": true, @@ -239,10 +239,10 @@ mod foo { }, { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 884, - "byte_end": 884, - "line_start": 20, - "line_end": 20, + "byte_start": 417, + "byte_end": 417, + "line_start": 10, + "line_end": 10, "column_start": 1, "column_end": 1, "is_primary": true, @@ -262,10 +262,10 @@ mod foo { }, { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 884, - "byte_end": 884, - "line_start": 20, - "line_end": 20, + "byte_start": 417, + "byte_end": 417, + "line_start": 10, + "line_end": 10, "column_start": 1, "column_end": 1, "is_primary": true, @@ -285,10 +285,10 @@ mod foo { }, { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 884, - "byte_end": 884, - "line_start": 20, - "line_end": 20, + "byte_start": 417, + "byte_end": 417, + "line_start": 10, + "line_end": 10, "column_start": 1, "column_end": 1, "is_primary": true, @@ -308,10 +308,10 @@ mod foo { }, { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 884, - "byte_end": 884, - "line_start": 20, - "line_end": 20, + "byte_start": 417, + "byte_end": 417, + "line_start": 10, + "line_end": 10, "column_start": 1, "column_end": 1, "is_primary": true, @@ -331,10 +331,10 @@ mod foo { }, { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 884, - "byte_end": 884, - "line_start": 20, - "line_end": 20, + "byte_start": 417, + "byte_end": 417, + "line_start": 10, + "line_end": 10, "column_start": 1, "column_end": 1, "is_primary": true, @@ -354,10 +354,10 @@ mod foo { }, { "file_name": "$DIR/use_suggestion_json.rs", - "byte_start": 884, - "byte_end": 884, - "line_start": 20, - "line_end": 20, + "byte_start": 417, + "byte_end": 417, + "line_start": 10, + "line_end": 10, "column_start": 1, "column_end": 1, "is_primary": true, @@ -381,7 +381,7 @@ mod foo { } ], "rendered": "error[E0412]: cannot find type `Iter` in this scope - --> $DIR/use_suggestion_json.rs:21:12 + --> $DIR/use_suggestion_json.rs:11:12 | LL | let x: Iter; | ^^^^ not found in this scope diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.nll.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.nll.stderr index b23225adbb4..9d245700573 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.nll.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/liveness-assign-imm-local-in-loop.rs:19:9 + --> $DIR/liveness-assign-imm-local-in-loop.rs:9:9 | LL | let v: isize; | - help: make this binding mutable: `mut v` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.stderr index 54135ca78ea..20003b73d39 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/liveness-assign-imm-local-in-loop.rs:19:9 + --> $DIR/liveness-assign-imm-local-in-loop.rs:9:9 | LL | v = 1; //[ast]~ ERROR cannot assign twice to immutable variable | ^^^^^ cannot assign twice to immutable variable diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.mir.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.mir.stderr index b23225adbb4..9d245700573 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.mir.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.mir.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/liveness-assign-imm-local-in-loop.rs:19:9 + --> $DIR/liveness-assign-imm-local-in-loop.rs:9:9 | LL | let v: isize; | - help: make this binding mutable: `mut v` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs index 6f44d67e823..59447ba3d75 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Zborrowck=mir diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.nll.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.nll.stderr index 3dabbcb816b..47b9b029d31 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.nll.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/liveness-assign-imm-local-in-op-eq.rs:20:5 + --> $DIR/liveness-assign-imm-local-in-op-eq.rs:10:5 | LL | let v: isize; | - help: make this binding mutable: `mut v` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.stderr index 266fb63c7c7..4ab254beb2d 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/liveness-assign-imm-local-in-op-eq.rs:20:5 + --> $DIR/liveness-assign-imm-local-in-op-eq.rs:10:5 | LL | v = 2; //[ast]~ NOTE first assignment | ----- first assignment to `v` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.mir.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.mir.stderr index 3dabbcb816b..47b9b029d31 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.mir.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.mir.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/liveness-assign-imm-local-in-op-eq.rs:20:5 + --> $DIR/liveness-assign-imm-local-in-op-eq.rs:10:5 | LL | let v: isize; | - help: make this binding mutable: `mut v` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs index f585da8a3a5..a2677f4e223 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Zborrowck=mir diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.nll.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.nll.stderr index 4a2b3b5d5fe..08a1e9d2bb4 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.nll.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `b` - --> $DIR/liveness-assign-imm-local-with-drop.rs:20:5 + --> $DIR/liveness-assign-imm-local-with-drop.rs:10:5 | LL | let b = Box::new(1); //[ast]~ NOTE first assignment | - diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.stderr index 94799d919ae..d543fb9ac6b 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `b` - --> $DIR/liveness-assign-imm-local-with-drop.rs:20:5 + --> $DIR/liveness-assign-imm-local-with-drop.rs:10:5 | LL | let b = Box::new(1); //[ast]~ NOTE first assignment | - first assignment to `b` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.mir.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.mir.stderr index 4a2b3b5d5fe..08a1e9d2bb4 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.mir.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.mir.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `b` - --> $DIR/liveness-assign-imm-local-with-drop.rs:20:5 + --> $DIR/liveness-assign-imm-local-with-drop.rs:10:5 | LL | let b = Box::new(1); //[ast]~ NOTE first assignment | - diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs index c32d2c4bb0f..4a81dcd3cfb 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Zborrowck=mir diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.nll.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.nll.stderr index 6137c9f5882..3c1a5692fec 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.nll.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/liveness-assign-imm-local-with-init.rs:20:5 + --> $DIR/liveness-assign-imm-local-with-init.rs:10:5 | LL | let v: isize = 1; //[ast]~ NOTE first assignment | - diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.stderr index d48608684a2..cf293ae9f2f 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/liveness-assign-imm-local-with-init.rs:20:5 + --> $DIR/liveness-assign-imm-local-with-init.rs:10:5 | LL | let v: isize = 1; //[ast]~ NOTE first assignment | - first assignment to `v` diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.mir.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.mir.stderr index 6137c9f5882..3c1a5692fec 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.mir.stderr +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.mir.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `v` - --> $DIR/liveness-assign-imm-local-with-init.rs:20:5 + --> $DIR/liveness-assign-imm-local-with-init.rs:10:5 | LL | let v: isize = 1; //[ast]~ NOTE first assignment | - diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs index 158eb7d428c..2c59aaf4f92 100644 --- a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs +++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Zborrowck=mir diff --git a/src/test/ui/liveness/liveness-closure-require-ret.rs b/src/test/ui/liveness/liveness-closure-require-ret.rs index 17cd8231222..b86d1fe4a66 100644 --- a/src/test/ui/liveness/liveness-closure-require-ret.rs +++ b/src/test/ui/liveness/liveness-closure-require-ret.rs @@ -1,12 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn force(f: F) -> isize where F: FnOnce() -> isize { f() } fn main() { println!("{}", force(|| {})); } //~ ERROR mismatched types diff --git a/src/test/ui/liveness/liveness-closure-require-ret.stderr b/src/test/ui/liveness/liveness-closure-require-ret.stderr index 569640c9e20..3133efdedd7 100644 --- a/src/test/ui/liveness/liveness-closure-require-ret.stderr +++ b/src/test/ui/liveness/liveness-closure-require-ret.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/liveness-closure-require-ret.rs:12:37 + --> $DIR/liveness-closure-require-ret.rs:2:37 | LL | fn main() { println!("{}", force(|| {})); } //~ ERROR mismatched types | ^^ expected isize, found () diff --git a/src/test/ui/liveness/liveness-dead.rs b/src/test/ui/liveness/liveness-dead.rs index ddd8fc68c43..004663c85ee 100644 --- a/src/test/ui/liveness/liveness-dead.rs +++ b/src/test/ui/liveness/liveness-dead.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![deny(unused_assignments)] @@ -37,4 +27,13 @@ fn f5(mut x: i32) { x = 4; //~ ERROR: value assigned to `x` is never read } +// #22630 +fn f6() { + let mut done = false; + while !done { + done = true; // no error + continue; + } +} + fn main() {} diff --git a/src/test/ui/liveness/liveness-dead.stderr b/src/test/ui/liveness/liveness-dead.stderr index 6709fee0abb..c89135e5135 100644 --- a/src/test/ui/liveness/liveness-dead.stderr +++ b/src/test/ui/liveness/liveness-dead.stderr @@ -1,32 +1,39 @@ error: value assigned to `x` is never read - --> $DIR/liveness-dead.rs:19:13 + --> $DIR/liveness-dead.rs:9:13 | LL | let mut x: isize = 3; //~ ERROR: value assigned to `x` is never read | ^ | note: lint level defined here - --> $DIR/liveness-dead.rs:12:9 + --> $DIR/liveness-dead.rs:2:9 | LL | #![deny(unused_assignments)] | ^^^^^^^^^^^^^^^^^^ + = help: maybe it is overwritten before being read? error: value assigned to `x` is never read - --> $DIR/liveness-dead.rs:27:5 + --> $DIR/liveness-dead.rs:17:5 | LL | x = 4; //~ ERROR: value assigned to `x` is never read | ^ + | + = help: maybe it is overwritten before being read? error: value passed to `x` is never read - --> $DIR/liveness-dead.rs:30:11 + --> $DIR/liveness-dead.rs:20:11 | LL | fn f4(mut x: i32) { //~ ERROR: value passed to `x` is never read | ^ + | + = help: maybe it is overwritten before being read? error: value assigned to `x` is never read - --> $DIR/liveness-dead.rs:37:5 + --> $DIR/liveness-dead.rs:27:5 | LL | x = 4; //~ ERROR: value assigned to `x` is never read | ^ + | + = help: maybe it is overwritten before being read? error: aborting due to 4 previous errors diff --git a/src/test/ui/liveness/liveness-forgot-ret.rs b/src/test/ui/liveness/liveness-forgot-ret.rs index 1ee4be08a1c..b8c2bc73438 100644 --- a/src/test/ui/liveness/liveness-forgot-ret.rs +++ b/src/test/ui/liveness/liveness-forgot-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn god_exists(a: isize) -> bool { return god_exists(a); } fn f(a: isize) -> isize { if god_exists(a) { return 5; }; } diff --git a/src/test/ui/liveness/liveness-forgot-ret.stderr b/src/test/ui/liveness/liveness-forgot-ret.stderr index 8da489bc9ab..a970b80fdbb 100644 --- a/src/test/ui/liveness/liveness-forgot-ret.stderr +++ b/src/test/ui/liveness/liveness-forgot-ret.stderr @@ -1,8 +1,10 @@ error[E0308]: mismatched types - --> $DIR/liveness-forgot-ret.rs:13:25 + --> $DIR/liveness-forgot-ret.rs:3:19 | LL | fn f(a: isize) -> isize { if god_exists(a) { return 5; }; } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected isize, found () + | - ^^^^^ expected isize, found () + | | + | this function's body doesn't return | = note: expected type `isize` found type `()` diff --git a/src/test/ui/liveness/liveness-issue-2163.rs b/src/test/ui/liveness/liveness-issue-2163.rs index 69bceec8c32..a632b5b9c93 100644 --- a/src/test/ui/liveness/liveness-issue-2163.rs +++ b/src/test/ui/liveness/liveness-issue-2163.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::vec::Vec; fn main() { diff --git a/src/test/ui/liveness/liveness-issue-2163.stderr b/src/test/ui/liveness/liveness-issue-2163.stderr index 66cd67821be..e91994d9a22 100644 --- a/src/test/ui/liveness/liveness-issue-2163.stderr +++ b/src/test/ui/liveness/liveness-issue-2163.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/liveness-issue-2163.rs:15:30 + --> $DIR/liveness-issue-2163.rs:5:30 | LL | a.iter().all(|_| -> bool { | ______________________________^ diff --git a/src/test/ui/liveness/liveness-missing-ret2.rs b/src/test/ui/liveness/liveness-missing-ret2.rs index a35eb1af4f3..a18669f725e 100644 --- a/src/test/ui/liveness/liveness-missing-ret2.rs +++ b/src/test/ui/liveness/liveness-missing-ret2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f() -> isize { //~ ERROR mismatched types // Make sure typestate doesn't interpret this match expression as // the function result diff --git a/src/test/ui/liveness/liveness-missing-ret2.stderr b/src/test/ui/liveness/liveness-missing-ret2.stderr index b7bbea6225d..58d0249ee3b 100644 --- a/src/test/ui/liveness/liveness-missing-ret2.stderr +++ b/src/test/ui/liveness/liveness-missing-ret2.stderr @@ -1,13 +1,10 @@ error[E0308]: mismatched types - --> $DIR/liveness-missing-ret2.rs:11:17 + --> $DIR/liveness-missing-ret2.rs:1:11 | -LL | fn f() -> isize { //~ ERROR mismatched types - | _________________^ -LL | | // Make sure typestate doesn't interpret this match expression as -LL | | // the function result -LL | | match true { true => { } _ => {} }; -LL | | } - | |_^ expected isize, found () +LL | fn f() -> isize { //~ ERROR mismatched types + | - ^^^^^ expected isize, found () + | | + | this function's body doesn't return | = note: expected type `isize` found type `()` diff --git a/src/test/ui/liveness/liveness-move-call-arg.nll.stderr b/src/test/ui/liveness/liveness-move-call-arg.nll.stderr index 40add8d51f1..521304d5605 100644 --- a/src/test/ui/liveness/liveness-move-call-arg.nll.stderr +++ b/src/test/ui/liveness/liveness-move-call-arg.nll.stderr @@ -1,10 +1,11 @@ error[E0382]: use of moved value: `x` - --> $DIR/liveness-move-call-arg.rs:19:14 + --> $DIR/liveness-move-call-arg.rs:9:14 | +LL | let x: Box = box 25; + | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait +LL | loop { LL | take(x); //~ ERROR use of moved value: `x` | ^ value moved here, in previous iteration of loop - | - = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-move-call-arg.rs b/src/test/ui/liveness/liveness-move-call-arg.rs index 9340964c1fb..98d12f5747a 100644 --- a/src/test/ui/liveness/liveness-move-call-arg.rs +++ b/src/test/ui/liveness/liveness-move-call-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn take(_x: Box) {} diff --git a/src/test/ui/liveness/liveness-move-call-arg.stderr b/src/test/ui/liveness/liveness-move-call-arg.stderr index f3423b8f5fa..21d285463e3 100644 --- a/src/test/ui/liveness/liveness-move-call-arg.stderr +++ b/src/test/ui/liveness/liveness-move-call-arg.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/liveness-move-call-arg.rs:19:14 + --> $DIR/liveness-move-call-arg.rs:9:14 | LL | take(x); //~ ERROR use of moved value: `x` | ^ value moved here in previous iteration of loop diff --git a/src/test/ui/liveness/liveness-move-in-loop.nll.stderr b/src/test/ui/liveness/liveness-move-in-loop.nll.stderr index e2719256bdf..b7e973bc914 100644 --- a/src/test/ui/liveness/liveness-move-in-loop.nll.stderr +++ b/src/test/ui/liveness/liveness-move-in-loop.nll.stderr @@ -1,10 +1,11 @@ error[E0382]: use of moved value: `y` - --> $DIR/liveness-move-in-loop.rs:21:25 + --> $DIR/liveness-move-in-loop.rs:11:25 | +LL | let y: Box = box 42; + | - move occurs because `y` has type `std::boxed::Box`, which does not implement the `Copy` trait +... LL | x = y; //~ ERROR use of moved value | ^ value moved here, in previous iteration of loop - | - = note: move occurs because `y` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-move-in-loop.rs b/src/test/ui/liveness/liveness-move-in-loop.rs index 65ccaceac08..eb3288a28e2 100644 --- a/src/test/ui/liveness/liveness-move-in-loop.rs +++ b/src/test/ui/liveness/liveness-move-in-loop.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn main() { diff --git a/src/test/ui/liveness/liveness-move-in-loop.stderr b/src/test/ui/liveness/liveness-move-in-loop.stderr index decc7659a64..d00c2d6ac35 100644 --- a/src/test/ui/liveness/liveness-move-in-loop.stderr +++ b/src/test/ui/liveness/liveness-move-in-loop.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `y` - --> $DIR/liveness-move-in-loop.rs:21:25 + --> $DIR/liveness-move-in-loop.rs:11:25 | LL | x = y; //~ ERROR use of moved value | ^ value moved here in previous iteration of loop diff --git a/src/test/ui/liveness/liveness-move-in-while.nll.stderr b/src/test/ui/liveness/liveness-move-in-while.nll.stderr index 065e65702b4..167dcc6b643 100644 --- a/src/test/ui/liveness/liveness-move-in-while.nll.stderr +++ b/src/test/ui/liveness/liveness-move-in-while.nll.stderr @@ -1,12 +1,13 @@ error[E0382]: borrow of moved value: `y` - --> $DIR/liveness-move-in-while.rs:17:24 + --> $DIR/liveness-move-in-while.rs:7:24 | +LL | let y: Box = box 42; + | - move occurs because `y` has type `std::boxed::Box`, which does not implement the `Copy` trait +... LL | println!("{}", y); //~ ERROR use of moved value: `y` | ^ value borrowed here after move LL | while true { while true { while true { x = y; x.clone(); } } } | - value moved here, in previous iteration of loop - | - = note: move occurs because `y` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-move-in-while.rs b/src/test/ui/liveness/liveness-move-in-while.rs index cadfd487121..a43e75982a1 100644 --- a/src/test/ui/liveness/liveness-move-in-while.rs +++ b/src/test/ui/liveness/liveness-move-in-while.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn main() { diff --git a/src/test/ui/liveness/liveness-move-in-while.stderr b/src/test/ui/liveness/liveness-move-in-while.stderr index 7ac3ea38cb5..91f722cb422 100644 --- a/src/test/ui/liveness/liveness-move-in-while.stderr +++ b/src/test/ui/liveness/liveness-move-in-while.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `y` - --> $DIR/liveness-move-in-while.rs:17:24 + --> $DIR/liveness-move-in-while.rs:7:24 | LL | println!("{}", y); //~ ERROR use of moved value: `y` | ^ value used here after move @@ -9,7 +9,7 @@ LL | while true { while true { while true { x = y; x.clone(); } } } = note: move occurs because `y` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `y` - --> $DIR/liveness-move-in-while.rs:18:52 + --> $DIR/liveness-move-in-while.rs:8:52 | LL | while true { while true { while true { x = y; x.clone(); } } } | ^ value moved here in previous iteration of loop diff --git a/src/test/ui/liveness/liveness-return-last-stmt-semi.rs b/src/test/ui/liveness/liveness-return-last-stmt-semi.rs index 663c0275b82..e8909c4a5ae 100644 --- a/src/test/ui/liveness/liveness-return-last-stmt-semi.rs +++ b/src/test/ui/liveness/liveness-return-last-stmt-semi.rs @@ -1,12 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // regression test for #8005 diff --git a/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr b/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr index 1fa001879a0..c6d166d8b31 100644 --- a/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr +++ b/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/liveness-return-last-stmt-semi.rs:13:45 + --> $DIR/liveness-return-last-stmt-semi.rs:4:41 | LL | macro_rules! test { () => { fn foo() -> i32 { 1; } } } - | ^^^-^^ - | | | - | | help: consider removing this semicolon - | expected i32, found () + | --- ^^^ - help: consider removing this semicolon + | | | + | | expected i32, found () + | this function's body doesn't return ... LL | test!(); | -------- in this macro invocation @@ -14,35 +14,36 @@ LL | test!(); found type `()` error[E0308]: mismatched types - --> $DIR/liveness-return-last-stmt-semi.rs:16:23 + --> $DIR/liveness-return-last-stmt-semi.rs:7:19 | LL | fn no_return() -> i32 {} //~ ERROR mismatched types - | ^^ expected i32, found () + | --------- ^^^ expected i32, found () + | | + | this function's body doesn't return | = note: expected type `i32` found type `()` error[E0308]: mismatched types - --> $DIR/liveness-return-last-stmt-semi.rs:18:23 + --> $DIR/liveness-return-last-stmt-semi.rs:9:19 | -LL | fn bar(x: u32) -> u32 { //~ ERROR mismatched types - | _______________________^ -LL | | x * 2; - | | - help: consider removing this semicolon -LL | | } - | |_^ expected u32, found () +LL | fn bar(x: u32) -> u32 { //~ ERROR mismatched types + | --- ^^^ expected u32, found () + | | + | this function's body doesn't return +LL | x * 2; + | - help: consider removing this semicolon | = note: expected type `u32` found type `()` error[E0308]: mismatched types - --> $DIR/liveness-return-last-stmt-semi.rs:22:23 + --> $DIR/liveness-return-last-stmt-semi.rs:13:19 | -LL | fn baz(x: u64) -> u32 { //~ ERROR mismatched types - | _______________________^ -LL | | x * 2; -LL | | } - | |_^ expected u32, found () +LL | fn baz(x: u64) -> u32 { //~ ERROR mismatched types + | --- ^^^ expected u32, found () + | | + | this function's body doesn't return | = note: expected type `u32` found type `()` diff --git a/src/test/ui/liveness/liveness-unused.rs b/src/test/ui/liveness/liveness-unused.rs index d056d6be806..9c7be15fcc8 100644 --- a/src/test/ui/liveness/liveness-unused.rs +++ b/src/test/ui/liveness/liveness-unused.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![warn(unused)] #![deny(unused_variables)] #![deny(unused_assignments)] diff --git a/src/test/ui/liveness/liveness-unused.stderr b/src/test/ui/liveness/liveness-unused.stderr index 2846f242fbe..49795faa59c 100644 --- a/src/test/ui/liveness/liveness-unused.stderr +++ b/src/test/ui/liveness/liveness-unused.stderr @@ -1,48 +1,48 @@ warning: unreachable statement - --> $DIR/liveness-unused.rs:102:9 + --> $DIR/liveness-unused.rs:92:9 | LL | drop(*x as i32); //~ WARNING unreachable statement | ^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/liveness-unused.rs:11:9 + --> $DIR/liveness-unused.rs:1:9 | LL | #![warn(unused)] | ^^^^^^ = note: #[warn(unreachable_code)] implied by #[warn(unused)] error: unused variable: `x` - --> $DIR/liveness-unused.rs:18:7 + --> $DIR/liveness-unused.rs:8:7 | LL | fn f1(x: isize) { - | ^ help: consider using `_x` instead + | ^ help: consider prefixing with an underscore: `_x` | note: lint level defined here - --> $DIR/liveness-unused.rs:12:9 + --> $DIR/liveness-unused.rs:2:9 | LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ error: unused variable: `x` - --> $DIR/liveness-unused.rs:22:8 + --> $DIR/liveness-unused.rs:12:8 | LL | fn f1b(x: &mut isize) { - | ^ help: consider using `_x` instead + | ^ help: consider prefixing with an underscore: `_x` error: unused variable: `x` - --> $DIR/liveness-unused.rs:30:9 + --> $DIR/liveness-unused.rs:20:9 | LL | let x: isize; - | ^ help: consider using `_x` instead + | ^ help: consider prefixing with an underscore: `_x` error: unused variable: `x` - --> $DIR/liveness-unused.rs:35:9 + --> $DIR/liveness-unused.rs:25:9 | LL | let x = 3; - | ^ help: consider using `_x` instead + | ^ help: consider prefixing with an underscore: `_x` error: variable `x` is assigned to, but never used - --> $DIR/liveness-unused.rs:40:13 + --> $DIR/liveness-unused.rs:30:13 | LL | let mut x = 3; | ^ @@ -50,19 +50,20 @@ LL | let mut x = 3; = note: consider using `_x` instead error: value assigned to `x` is never read - --> $DIR/liveness-unused.rs:42:5 + --> $DIR/liveness-unused.rs:32:5 | LL | x += 4; | ^ | note: lint level defined here - --> $DIR/liveness-unused.rs:13:9 + --> $DIR/liveness-unused.rs:3:9 | LL | #![deny(unused_assignments)] | ^^^^^^^^^^^^^^^^^^ + = help: maybe it is overwritten before being read? error: variable `z` is assigned to, but never used - --> $DIR/liveness-unused.rs:47:13 + --> $DIR/liveness-unused.rs:37:13 | LL | let mut z = 3; | ^ @@ -70,31 +71,31 @@ LL | let mut z = 3; = note: consider using `_z` instead error: unused variable: `i` - --> $DIR/liveness-unused.rs:69:12 + --> $DIR/liveness-unused.rs:59:12 | LL | Some(i) => { - | ^ help: consider using `_i` instead + | ^ help: consider prefixing with an underscore: `_i` error: unused variable: `x` - --> $DIR/liveness-unused.rs:89:9 + --> $DIR/liveness-unused.rs:79:9 | LL | for x in 1..10 { } - | ^ help: consider using `_x` instead + | ^ help: consider prefixing with an underscore: `_x` error: unused variable: `x` - --> $DIR/liveness-unused.rs:94:10 + --> $DIR/liveness-unused.rs:84:10 | LL | for (x, _) in [1, 2, 3].iter().enumerate() { } - | ^ help: consider using `_x` instead + | ^ help: consider prefixing with an underscore: `_x` error: unused variable: `x` - --> $DIR/liveness-unused.rs:99:13 + --> $DIR/liveness-unused.rs:89:13 | LL | for (_, x) in [1, 2, 3].iter().enumerate() { - | ^ help: consider using `_x` instead + | ^ help: consider prefixing with an underscore: `_x` error: variable `x` is assigned to, but never used - --> $DIR/liveness-unused.rs:122:9 + --> $DIR/liveness-unused.rs:112:9 | LL | let x; | ^ @@ -102,10 +103,12 @@ LL | let x; = note: consider using `_x` instead error: value assigned to `x` is never read - --> $DIR/liveness-unused.rs:126:9 + --> $DIR/liveness-unused.rs:116:9 | LL | x = 0; //~ ERROR value assigned to `x` is never read | ^ + | + = help: maybe it is overwritten before being read? error: aborting due to 13 previous errors diff --git a/src/test/ui/liveness/liveness-use-after-move.nll.stderr b/src/test/ui/liveness/liveness-use-after-move.nll.stderr index 463a64f4bec..36c25882ccd 100644 --- a/src/test/ui/liveness/liveness-use-after-move.nll.stderr +++ b/src/test/ui/liveness/liveness-use-after-move.nll.stderr @@ -1,6 +1,8 @@ error[E0382]: borrow of moved value: `x` - --> $DIR/liveness-use-after-move.rs:16:20 + --> $DIR/liveness-use-after-move.rs:6:20 | +LL | let x: Box<_> = box 5; + | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | let y = x; | - value moved here LL | println!("{}", *x); //~ ERROR use of moved value: `*x` diff --git a/src/test/ui/liveness/liveness-use-after-move.rs b/src/test/ui/liveness/liveness-use-after-move.rs index 6fcab380030..157587c7a7b 100644 --- a/src/test/ui/liveness/liveness-use-after-move.rs +++ b/src/test/ui/liveness/liveness-use-after-move.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn main() { diff --git a/src/test/ui/liveness/liveness-use-after-move.stderr b/src/test/ui/liveness/liveness-use-after-move.stderr index be6f89c7357..62475943d0e 100644 --- a/src/test/ui/liveness/liveness-use-after-move.stderr +++ b/src/test/ui/liveness/liveness-use-after-move.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `*x` - --> $DIR/liveness-use-after-move.rs:16:20 + --> $DIR/liveness-use-after-move.rs:6:20 | LL | let y = x; | - value moved here diff --git a/src/test/ui/liveness/liveness-use-after-send.nll.stderr b/src/test/ui/liveness/liveness-use-after-send.nll.stderr index dbffe6c9135..d9367c87116 100644 --- a/src/test/ui/liveness/liveness-use-after-send.nll.stderr +++ b/src/test/ui/liveness/liveness-use-after-send.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: borrow of moved value: `message` - --> $DIR/liveness-use-after-send.rs:26:20 + --> $DIR/liveness-use-after-send.rs:16:20 | +LL | fn test00_start(ch: Chan>, message: Box, _count: Box) { + | ------- move occurs because `message` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | send(ch, message); | ------- value moved here LL | println!("{}", message); //~ ERROR use of moved value: `message` | ^^^^^^^ value borrowed here after move - | - = note: move occurs because `message` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-use-after-send.rs b/src/test/ui/liveness/liveness-use-after-send.rs index 03d8d62e0b4..7f2cc3c00f4 100644 --- a/src/test/ui/liveness/liveness-use-after-send.rs +++ b/src/test/ui/liveness/liveness-use-after-send.rs @@ -1,27 +1,17 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; -fn send(ch: _chan, data: T) { +fn send(ch: Chan, data: T) { println!("{:?}", ch); println!("{:?}", data); panic!(); } #[derive(Debug)] -struct _chan(isize, marker::PhantomData); +struct Chan(isize, marker::PhantomData); // Tests that "log(debug, message);" is flagged as using // message after the send deinitializes it -fn test00_start(ch: _chan>, message: Box, _count: Box) { +fn test00_start(ch: Chan>, message: Box, _count: Box) { send(ch, message); println!("{}", message); //~ ERROR use of moved value: `message` } diff --git a/src/test/ui/liveness/liveness-use-after-send.stderr b/src/test/ui/liveness/liveness-use-after-send.stderr index 94499aabb97..1fdb1d3ec39 100644 --- a/src/test/ui/liveness/liveness-use-after-send.stderr +++ b/src/test/ui/liveness/liveness-use-after-send.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `message` - --> $DIR/liveness-use-after-send.rs:26:20 + --> $DIR/liveness-use-after-send.rs:16:20 | LL | send(ch, message); | ------- value moved here diff --git a/src/test/ui/loops/loop-break-value-no-repeat.rs b/src/test/ui/loops/loop-break-value-no-repeat.rs index f24840eca54..1c0b7a0181f 100644 --- a/src/test/ui/loops/loop-break-value-no-repeat.rs +++ b/src/test/ui/loops/loop-break-value-no-repeat.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] use std::ptr; diff --git a/src/test/ui/loops/loop-break-value-no-repeat.stderr b/src/test/ui/loops/loop-break-value-no-repeat.stderr index 68a2bab1674..f5c6544a815 100644 --- a/src/test/ui/loops/loop-break-value-no-repeat.stderr +++ b/src/test/ui/loops/loop-break-value-no-repeat.stderr @@ -1,5 +1,5 @@ error[E0571]: `break` with value from a `for` loop - --> $DIR/loop-break-value-no-repeat.rs:22:9 + --> $DIR/loop-break-value-no-repeat.rs:12:9 | LL | break 22 //~ ERROR `break` with value from a `for` loop | ^^^^^^^^ can only break with a value inside `loop` or breakable block diff --git a/src/test/ui/loops/loop-break-value.rs b/src/test/ui/loops/loop-break-value.rs index 938f7fba2a0..b80c847deb9 100644 --- a/src/test/ui/loops/loop-break-value.rs +++ b/src/test/ui/loops/loop-break-value.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(never_type)] fn main() { diff --git a/src/test/ui/loops/loop-break-value.stderr b/src/test/ui/loops/loop-break-value.stderr index ca286285c38..3e009c007e0 100644 --- a/src/test/ui/loops/loop-break-value.stderr +++ b/src/test/ui/loops/loop-break-value.stderr @@ -1,5 +1,5 @@ error[E0571]: `break` with value from a `while` loop - --> $DIR/loop-break-value.rs:38:9 + --> $DIR/loop-break-value.rs:28:9 | LL | break (); //~ ERROR `break` with value from a `while` loop | ^^^^^^^^ can only break with a value inside `loop` or breakable block @@ -9,7 +9,7 @@ LL | break; //~ ERROR `break` with value from a `while` loop | ^^^^^ error[E0571]: `break` with value from a `while` loop - --> $DIR/loop-break-value.rs:40:13 + --> $DIR/loop-break-value.rs:30:13 | LL | break 'while_loop 123; | ^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block @@ -19,7 +19,7 @@ LL | break; | ^^^^^ error[E0571]: `break` with value from a `while let` loop - --> $DIR/loop-break-value.rs:48:12 + --> $DIR/loop-break-value.rs:38:12 | LL | if break () { //~ ERROR `break` with value from a `while let` loop | ^^^^^^^^ can only break with a value inside `loop` or breakable block @@ -29,7 +29,7 @@ LL | if break { //~ ERROR `break` with value from a `while let` loop | ^^^^^ error[E0571]: `break` with value from a `while let` loop - --> $DIR/loop-break-value.rs:53:9 + --> $DIR/loop-break-value.rs:43:9 | LL | break None; | ^^^^^^^^^^ can only break with a value inside `loop` or breakable block @@ -39,7 +39,7 @@ LL | break; | ^^^^^ error[E0571]: `break` with value from a `while let` loop - --> $DIR/loop-break-value.rs:59:13 + --> $DIR/loop-break-value.rs:49:13 | LL | break 'while_let_loop "nope"; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block @@ -49,7 +49,7 @@ LL | break; | ^^^^^ error[E0571]: `break` with value from a `for` loop - --> $DIR/loop-break-value.rs:66:9 + --> $DIR/loop-break-value.rs:56:9 | LL | break (); //~ ERROR `break` with value from a `for` loop | ^^^^^^^^ can only break with a value inside `loop` or breakable block @@ -59,7 +59,7 @@ LL | break; //~ ERROR `break` with value from a `for` loop | ^^^^^ error[E0571]: `break` with value from a `for` loop - --> $DIR/loop-break-value.rs:67:9 + --> $DIR/loop-break-value.rs:57:9 | LL | break [()]; | ^^^^^^^^^^ can only break with a value inside `loop` or breakable block @@ -69,7 +69,7 @@ LL | break; | ^^^^^ error[E0571]: `break` with value from a `for` loop - --> $DIR/loop-break-value.rs:74:13 + --> $DIR/loop-break-value.rs:64:13 | LL | break 'for_loop Some(17); | ^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block @@ -79,7 +79,7 @@ LL | break; | ^^^^^ error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:14:31 + --> $DIR/loop-break-value.rs:4:31 | LL | let val: ! = loop { break break; }; | ^^^^^ expected (), found ! @@ -88,16 +88,16 @@ LL | let val: ! = loop { break break; }; found type `!` error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:21:19 + --> $DIR/loop-break-value.rs:11:19 | LL | break 123; //~ ERROR mismatched types - | ^^^ expected &str, found integral variable + | ^^^ expected &str, found integer | = note: expected type `&str` found type `{integer}` error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:26:15 + --> $DIR/loop-break-value.rs:16:15 | LL | break "asdf"; //~ ERROR mismatched types | ^^^^^^ expected i32, found reference @@ -106,7 +106,7 @@ LL | break "asdf"; //~ ERROR mismatched types found type `&'static str` error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:31:31 + --> $DIR/loop-break-value.rs:21:31 | LL | break 'outer_loop "nope"; //~ ERROR mismatched types | ^^^^^^ expected i32, found reference @@ -115,16 +115,16 @@ LL | break 'outer_loop "nope"; //~ ERROR mismatched types found type `&'static str` error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:83:26 + --> $DIR/loop-break-value.rs:73:26 | LL | break 'c 123; //~ ERROR mismatched types - | ^^^ expected (), found integral variable + | ^^^ expected (), found integer | = note: expected type `()` found type `{integer}` error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:90:15 + --> $DIR/loop-break-value.rs:80:15 | LL | break (break, break); //~ ERROR mismatched types | ^^^^^^^^^^^^^^ expected (), found tuple @@ -133,19 +133,19 @@ LL | break (break, break); //~ ERROR mismatched types found type `(!, !)` error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:95:15 + --> $DIR/loop-break-value.rs:85:15 | LL | break 2; //~ ERROR mismatched types - | ^ expected (), found integral variable + | ^ expected (), found integer | = note: expected type `()` found type `{integer}` error[E0308]: mismatched types - --> $DIR/loop-break-value.rs:100:9 + --> $DIR/loop-break-value.rs:90:9 | LL | break; //~ ERROR mismatched types - | ^^^^^ expected (), found integral variable + | ^^^^^ expected (), found integer | = note: expected type `()` found type `{integer}` diff --git a/src/test/ui/loops/loop-labeled-break-value.rs b/src/test/ui/loops/loop-labeled-break-value.rs index f0792c145d2..3488b057bc5 100644 --- a/src/test/ui/loops/loop-labeled-break-value.rs +++ b/src/test/ui/loops/loop-labeled-break-value.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { loop { let _: i32 = loop { break }; //~ ERROR mismatched types diff --git a/src/test/ui/loops/loop-labeled-break-value.stderr b/src/test/ui/loops/loop-labeled-break-value.stderr index 7d140aa8aac..5cfd86ea504 100644 --- a/src/test/ui/loops/loop-labeled-break-value.stderr +++ b/src/test/ui/loops/loop-labeled-break-value.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/loop-labeled-break-value.rs:13:29 + --> $DIR/loop-labeled-break-value.rs:3:29 | LL | let _: i32 = loop { break }; //~ ERROR mismatched types | ^^^^^ expected (), found i32 @@ -8,7 +8,7 @@ LL | let _: i32 = loop { break }; //~ ERROR mismatched types found type `i32` error[E0308]: mismatched types - --> $DIR/loop-labeled-break-value.rs:16:37 + --> $DIR/loop-labeled-break-value.rs:6:37 | LL | let _: i32 = 'inner: loop { break 'inner }; //~ ERROR mismatched types | ^^^^^^^^^^^^ expected (), found i32 @@ -17,7 +17,7 @@ LL | let _: i32 = 'inner: loop { break 'inner }; //~ ERROR mismatched ty found type `i32` error[E0308]: mismatched types - --> $DIR/loop-labeled-break-value.rs:19:45 + --> $DIR/loop-labeled-break-value.rs:9:45 | LL | let _: i32 = 'inner2: loop { loop { break 'inner2 } }; //~ ERROR mismatched types | ^^^^^^^^^^^^^ expected (), found i32 diff --git a/src/test/ui/loops/loop-proper-liveness.nll.stderr b/src/test/ui/loops/loop-proper-liveness.nll.stderr index cbf7094d837..745f0876b40 100644 --- a/src/test/ui/loops/loop-proper-liveness.nll.stderr +++ b/src/test/ui/loops/loop-proper-liveness.nll.stderr @@ -1,5 +1,5 @@ error[E0381]: borrow of possibly uninitialized variable: `x` - --> $DIR/loop-proper-liveness.rs:19:22 + --> $DIR/loop-proper-liveness.rs:9:22 | LL | println!("{:?}", x); //~ ERROR use of possibly uninitialized variable | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/loops/loop-proper-liveness.rs b/src/test/ui/loops/loop-proper-liveness.rs index e411313c273..fd9d6612220 100644 --- a/src/test/ui/loops/loop-proper-liveness.rs +++ b/src/test/ui/loops/loop-proper-liveness.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn test1() { // In this test the outer 'a loop may terminate without `x` getting initialised. Although the // `x = loop { ... }` statement is reached, the value itself ends up never being computed and diff --git a/src/test/ui/loops/loop-proper-liveness.stderr b/src/test/ui/loops/loop-proper-liveness.stderr index 554abea91e3..b8fb3fe00ee 100644 --- a/src/test/ui/loops/loop-proper-liveness.stderr +++ b/src/test/ui/loops/loop-proper-liveness.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `x` - --> $DIR/loop-proper-liveness.rs:19:22 + --> $DIR/loop-proper-liveness.rs:9:22 | LL | println!("{:?}", x); //~ ERROR use of possibly uninitialized variable | ^ use of possibly uninitialized `x` diff --git a/src/test/ui/loops/loop-properly-diverging-2.rs b/src/test/ui/loops/loop-properly-diverging-2.rs index c22091ce63c..97b3972c135 100644 --- a/src/test/ui/loops/loop-properly-diverging-2.rs +++ b/src/test/ui/loops/loop-properly-diverging-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn forever2() -> i32 { let x: i32 = loop { break }; //~ ERROR mismatched types x diff --git a/src/test/ui/loops/loop-properly-diverging-2.stderr b/src/test/ui/loops/loop-properly-diverging-2.stderr index f9836538382..5bd088fa011 100644 --- a/src/test/ui/loops/loop-properly-diverging-2.stderr +++ b/src/test/ui/loops/loop-properly-diverging-2.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/loop-properly-diverging-2.rs:12:23 + --> $DIR/loop-properly-diverging-2.rs:2:23 | LL | let x: i32 = loop { break }; //~ ERROR mismatched types | ^^^^^ expected (), found i32 diff --git a/src/test/ui/loops/loops-reject-duplicate-labels-2.rs b/src/test/ui/loops/loops-reject-duplicate-labels-2.rs index 42b4a72a46c..93f322ab368 100644 --- a/src/test/ui/loops/loops-reject-duplicate-labels-2.rs +++ b/src/test/ui/loops/loops-reject-duplicate-labels-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // ignore-tidy-linelength diff --git a/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr b/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr index 442f1918bd1..4d1a29f7165 100644 --- a/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr +++ b/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr @@ -1,5 +1,5 @@ warning: label name `'fl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:24:7 + --> $DIR/loops-reject-duplicate-labels-2.rs:14:7 | LL | { 'fl: for _ in 0..10 { break; } } | --- first declared here @@ -7,7 +7,7 @@ LL | { 'fl: loop { break; } } //~ WARN label name `'fl` shadows | ^^^ lifetime 'fl already in scope warning: label name `'lf` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:26:7 + --> $DIR/loops-reject-duplicate-labels-2.rs:16:7 | LL | { 'lf: loop { break; } } | --- first declared here @@ -15,7 +15,7 @@ LL | { 'lf: for _ in 0..10 { break; } } //~ WARN label name `'lf` shadows | ^^^ lifetime 'lf already in scope warning: label name `'wl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:28:7 + --> $DIR/loops-reject-duplicate-labels-2.rs:18:7 | LL | { 'wl: while 2 > 1 { break; } } | --- first declared here @@ -23,7 +23,7 @@ LL | { 'wl: loop { break; } } //~ WARN label name `'wl` shadows | ^^^ lifetime 'wl already in scope warning: label name `'lw` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:30:7 + --> $DIR/loops-reject-duplicate-labels-2.rs:20:7 | LL | { 'lw: loop { break; } } | --- first declared here @@ -31,7 +31,7 @@ LL | { 'lw: while 2 > 1 { break; } } //~ WARN label name `'lw` shadows | ^^^ lifetime 'lw already in scope warning: label name `'fw` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:32:7 + --> $DIR/loops-reject-duplicate-labels-2.rs:22:7 | LL | { 'fw: for _ in 0..10 { break; } } | --- first declared here @@ -39,7 +39,7 @@ LL | { 'fw: while 2 > 1 { break; } } //~ WARN label name `'fw` shadows | ^^^ lifetime 'fw already in scope warning: label name `'wf` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:34:7 + --> $DIR/loops-reject-duplicate-labels-2.rs:24:7 | LL | { 'wf: while 2 > 1 { break; } } | --- first declared here @@ -47,7 +47,7 @@ LL | { 'wf: for _ in 0..10 { break; } } //~ WARN label name `'wf` shadows | ^^^ lifetime 'wf already in scope warning: label name `'tl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:36:7 + --> $DIR/loops-reject-duplicate-labels-2.rs:26:7 | LL | { 'tl: while let Some(_) = None:: { break; } } | --- first declared here @@ -55,7 +55,7 @@ LL | { 'tl: loop { break; } } //~ WARN label name `'tl` shadows | ^^^ lifetime 'tl already in scope warning: label name `'lt` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels-2.rs:38:7 + --> $DIR/loops-reject-duplicate-labels-2.rs:28:7 | LL | { 'lt: loop { break; } } | --- first declared here diff --git a/src/test/ui/loops/loops-reject-duplicate-labels.rs b/src/test/ui/loops/loops-reject-duplicate-labels.rs index 63cb947b49b..27f9862f70d 100644 --- a/src/test/ui/loops/loops-reject-duplicate-labels.rs +++ b/src/test/ui/loops/loops-reject-duplicate-labels.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // ignore-tidy-linelength diff --git a/src/test/ui/loops/loops-reject-duplicate-labels.stderr b/src/test/ui/loops/loops-reject-duplicate-labels.stderr index 7d556f4f227..f9a19ad57f0 100644 --- a/src/test/ui/loops/loops-reject-duplicate-labels.stderr +++ b/src/test/ui/loops/loops-reject-duplicate-labels.stderr @@ -1,5 +1,5 @@ warning: label name `'fl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:21:5 + --> $DIR/loops-reject-duplicate-labels.rs:11:5 | LL | 'fl: for _ in 0..10 { break; } | --- first declared here @@ -7,7 +7,7 @@ LL | 'fl: loop { break; } //~ WARN label name `'fl` shadows a labe | ^^^ lifetime 'fl already in scope warning: label name `'lf` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:24:5 + --> $DIR/loops-reject-duplicate-labels.rs:14:5 | LL | 'lf: loop { break; } | --- first declared here @@ -15,7 +15,7 @@ LL | 'lf: for _ in 0..10 { break; } //~ WARN label name `'lf` shadows a labe | ^^^ lifetime 'lf already in scope warning: label name `'wl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:26:5 + --> $DIR/loops-reject-duplicate-labels.rs:16:5 | LL | 'wl: while 2 > 1 { break; } | --- first declared here @@ -23,7 +23,7 @@ LL | 'wl: loop { break; } //~ WARN label name `'wl` shadows a labe | ^^^ lifetime 'wl already in scope warning: label name `'lw` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:28:5 + --> $DIR/loops-reject-duplicate-labels.rs:18:5 | LL | 'lw: loop { break; } | --- first declared here @@ -31,7 +31,7 @@ LL | 'lw: while 2 > 1 { break; } //~ WARN label name `'lw` shadows a labe | ^^^ lifetime 'lw already in scope warning: label name `'fw` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:30:5 + --> $DIR/loops-reject-duplicate-labels.rs:20:5 | LL | 'fw: for _ in 0..10 { break; } | --- first declared here @@ -39,7 +39,7 @@ LL | 'fw: while 2 > 1 { break; } //~ WARN label name `'fw` shadows a labe | ^^^ lifetime 'fw already in scope warning: label name `'wf` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:32:5 + --> $DIR/loops-reject-duplicate-labels.rs:22:5 | LL | 'wf: while 2 > 1 { break; } | --- first declared here @@ -47,7 +47,7 @@ LL | 'wf: for _ in 0..10 { break; } //~ WARN label name `'wf` shadows a labe | ^^^ lifetime 'wf already in scope warning: label name `'tl` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:34:5 + --> $DIR/loops-reject-duplicate-labels.rs:24:5 | LL | 'tl: while let Some(_) = None:: { break; } | --- first declared here @@ -55,7 +55,7 @@ LL | 'tl: loop { break; } //~ WARN label name `'tl` shadows a labe | ^^^ lifetime 'tl already in scope warning: label name `'lt` shadows a label name that is already in scope - --> $DIR/loops-reject-duplicate-labels.rs:36:5 + --> $DIR/loops-reject-duplicate-labels.rs:26:5 | LL | 'lt: loop { break; } | --- first declared here diff --git a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs b/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs index 56f8288fa2f..435ad3391a0 100644 --- a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs +++ b/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #21633: reject duplicate loop labels in function bodies. // This is testing interaction between lifetime-params and labels. diff --git a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr b/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr index d7d3cdb78e1..e9f93abb627 100644 --- a/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr +++ b/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr @@ -1,5 +1,5 @@ warning: label name `'a` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:20:9 + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:10:9 | LL | fn foo<'a>() { | -- first declared here @@ -7,7 +7,7 @@ LL | 'a: loop { break 'a; } | ^^ lifetime 'a already in scope warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:45:13 + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:35:13 | LL | impl<'bad, 'c> Struct<'bad, 'c> { | ---- first declared here @@ -16,7 +16,7 @@ LL | 'bad: loop { break 'bad; } | ^^^^ lifetime 'bad already in scope warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:52:13 + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:42:13 | LL | impl<'b, 'bad> Struct<'b, 'bad> { | ---- first declared here @@ -25,7 +25,7 @@ LL | 'bad: loop { break 'bad; } | ^^^^ lifetime 'bad already in scope warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:59:13 + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:49:13 | LL | fn meth_bad3<'bad>(x: &'bad i8) { | ---- first declared here @@ -33,7 +33,7 @@ LL | 'bad: loop { break 'bad; } | ^^^^ lifetime 'bad already in scope warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:64:13 + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:54:13 | LL | fn meth_bad4<'a,'bad>(x: &'a i8, y: &'bad i8) { | ---- first declared here @@ -41,7 +41,7 @@ LL | 'bad: loop { break 'bad; } | ^^^^ lifetime 'bad already in scope warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:71:13 + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:61:13 | LL | impl <'bad, 'e> Enum<'bad, 'e> { | ---- first declared here @@ -50,7 +50,7 @@ LL | 'bad: loop { break 'bad; } | ^^^^ lifetime 'bad already in scope warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:77:13 + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:67:13 | LL | impl <'d, 'bad> Enum<'d, 'bad> { | ---- first declared here @@ -59,7 +59,7 @@ LL | 'bad: loop { break 'bad; } | ^^^^ lifetime 'bad already in scope warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:83:13 + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:73:13 | LL | fn meth_bad3<'bad>(x: &'bad i8) { | ---- first declared here @@ -67,7 +67,7 @@ LL | 'bad: loop { break 'bad; } | ^^^^ lifetime 'bad already in scope warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:88:13 + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:78:13 | LL | fn meth_bad4<'a,'bad>(x: &'bad i8) { | ---- first declared here @@ -75,7 +75,7 @@ LL | 'bad: loop { break 'bad; } | ^^^^ lifetime 'bad already in scope warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:98:13 + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:88:13 | LL | trait HasDefaultMethod1<'bad> { | ---- first declared here @@ -84,7 +84,7 @@ LL | 'bad: loop { break 'bad; } | ^^^^ lifetime 'bad already in scope warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:104:13 + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:94:13 | LL | trait HasDefaultMethod2<'a,'bad> { | ---- first declared here @@ -93,7 +93,7 @@ LL | 'bad: loop { break 'bad; } | ^^^^ lifetime 'bad already in scope warning: label name `'bad` shadows a lifetime name that is already in scope - --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:110:13 + --> $DIR/loops-reject-labels-shadowing-lifetimes.rs:100:13 | LL | fn meth_bad<'bad>(&self) { | ---- first declared here diff --git a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs index 09b2c24e2a6..f48e9848456 100644 --- a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs +++ b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code, unused_variables)] diff --git a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr index ac5c59c044a..4c4d9218ec9 100644 --- a/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr +++ b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr @@ -1,5 +1,5 @@ warning: lifetime name `'a` shadows a label name that is already in scope - --> $DIR/loops-reject-lifetime-shadowing-label.rs:31:51 + --> $DIR/loops-reject-lifetime-shadowing-label.rs:21:51 | LL | 'a: loop { | -- first declared here diff --git a/src/test/ui/loud_ui.rs b/src/test/ui/loud_ui.rs new file mode 100644 index 00000000000..6a151fa49f8 --- /dev/null +++ b/src/test/ui/loud_ui.rs @@ -0,0 +1,6 @@ +// should-fail + +// this test ensures that when we forget to use +// any `//~ ERROR` comments whatsoever, that the test doesn't succeed + +fn main() {} diff --git a/src/test/ui/lto-duplicate-symbols.rs b/src/test/ui/lto-duplicate-symbols.rs index 9c1dbfc2af9..c95e9fbf406 100644 --- a/src/test/ui/lto-duplicate-symbols.rs +++ b/src/test/ui/lto-duplicate-symbols.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:lto-duplicate-symbols1.rs // aux-build:lto-duplicate-symbols2.rs // error-pattern:Linking globals named 'foo': symbol multiply defined! diff --git a/src/test/ui/lub-glb/old-lub-glb-hr.rs b/src/test/ui/lub-glb/old-lub-glb-hr.rs index 7526b2f946c..324dc86bd92 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr.rs +++ b/src/test/ui/lub-glb/old-lub-glb-hr.rs @@ -1,21 +1,16 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we give a note when the old LUB/GLB algorithm would have -// succeeded but the new code (which is stricter) gives an error. +// succeeded but the new code (which requires equality) gives an +// error. However, now that we handle subtyping correctly, we no +// longer get an error, because we recognize these two types as +// equivalent! +// +// compile-pass fn foo( x: fn(&u8, &u8), y: for<'a> fn(&'a u8, &'a u8), ) { - let z = match 22 { //~ ERROR incompatible types + let z = match 22 { 0 => x, _ => y, }; diff --git a/src/test/ui/lub-glb/old-lub-glb-hr.stderr b/src/test/ui/lub-glb/old-lub-glb-hr.stderr deleted file mode 100644 index 4182b525888..00000000000 --- a/src/test/ui/lub-glb/old-lub-glb-hr.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0308]: match arms have incompatible types - --> $DIR/old-lub-glb-hr.rs:18:13 - | -LL | let z = match 22 { //~ ERROR incompatible types - | _____________^ -LL | | 0 => x, -LL | | _ => y, - | | - match arm with an incompatible type -LL | | }; - | |_____^ expected bound lifetime parameter, found concrete lifetime - | - = note: expected type `for<'r, 's> fn(&'r u8, &'s u8)` - found type `for<'a> fn(&'a u8, &'a u8)` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/lub-glb/old-lub-glb-object.rs b/src/test/ui/lub-glb/old-lub-glb-object.rs index 63dcfa3fc1e..9be7a813603 100644 --- a/src/test/ui/lub-glb/old-lub-glb-object.rs +++ b/src/test/ui/lub-glb/old-lub-glb-object.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we give a note when the old LUB/GLB algorithm would have // succeeded but the new code (which is stricter) gives an error. @@ -17,7 +7,7 @@ fn foo( x: &for<'a, 'b> Foo<&'a u8, &'b u8>, y: &for<'a> Foo<&'a u8, &'a u8>, ) { - let z = match 22 { //~ ERROR incompatible types + let z = match 22 { //~ ERROR E0308 0 => x, _ => y, }; diff --git a/src/test/ui/lub-glb/old-lub-glb-object.stderr b/src/test/ui/lub-glb/old-lub-glb-object.stderr index bb8cb45eec3..17d3648156b 100644 --- a/src/test/ui/lub-glb/old-lub-glb-object.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-object.stderr @@ -1,16 +1,15 @@ -error[E0308]: match arms have incompatible types - --> $DIR/old-lub-glb-object.rs:20:13 +error[E0308]: mismatched types + --> $DIR/old-lub-glb-object.rs:10:13 | -LL | let z = match 22 { //~ ERROR incompatible types +LL | let z = match 22 { //~ ERROR E0308 | _____________^ LL | | 0 => x, LL | | _ => y, - | | - match arm with an incompatible type LL | | }; - | |_____^ expected bound lifetime parameter 'a, found concrete lifetime + | |_____^ one type is more general than the other | - = note: expected type `&dyn for<'a, 'b> Foo<&'a u8, &'b u8>` - found type `&dyn for<'a> Foo<&'a u8, &'a u8>` + = note: expected type `dyn for<'a, 'b> Foo<&'a u8, &'b u8>` + found type `dyn for<'a> Foo<&'a u8, &'a u8>` error: aborting due to previous error diff --git a/src/test/ui/lub-if.rs b/src/test/ui/lub-if.rs index 8d2a0fd07e8..132b83810ea 100644 --- a/src/test/ui/lub-if.rs +++ b/src/test/ui/lub-if.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we correctly consider the type of `match` to be the LUB // of the various arms, particularly in the case where regions are // involved. diff --git a/src/test/ui/lub-if.stderr b/src/test/ui/lub-if.stderr index 4a436810170..2cf12ba6041 100644 --- a/src/test/ui/lub-if.stderr +++ b/src/test/ui/lub-if.stderr @@ -1,25 +1,25 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/lub-if.rs:38:9 + --> $DIR/lub-if.rs:28:9 | LL | s //~ ERROR E0312 | ^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 33:17 - --> $DIR/lub-if.rs:33:17 +note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 23:17 + --> $DIR/lub-if.rs:23:17 | LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { | ^^ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/lub-if.rs:45:9 + --> $DIR/lub-if.rs:35:9 | LL | s //~ ERROR E0312 | ^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 42:17 - --> $DIR/lub-if.rs:42:17 +note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 32:17 + --> $DIR/lub-if.rs:32:17 | LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { | ^^ diff --git a/src/test/ui/lub-match.rs b/src/test/ui/lub-match.rs index b9423feb5c1..1cd4a02a3ef 100644 --- a/src/test/ui/lub-match.rs +++ b/src/test/ui/lub-match.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we correctly consider the type of `match` to be the LUB // of the various arms, particularly in the case where regions are // involved. diff --git a/src/test/ui/lub-match.stderr b/src/test/ui/lub-match.stderr index 3543676ad2f..0db27f91717 100644 --- a/src/test/ui/lub-match.stderr +++ b/src/test/ui/lub-match.stderr @@ -1,25 +1,25 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/lub-match.rs:40:13 + --> $DIR/lub-match.rs:30:13 | LL | s //~ ERROR E0312 | ^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 35:17 - --> $DIR/lub-match.rs:35:17 +note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 25:17 + --> $DIR/lub-match.rs:25:17 | LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { | ^^ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/lub-match.rs:49:13 + --> $DIR/lub-match.rs:39:13 | LL | s //~ ERROR E0312 | ^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 45:17 - --> $DIR/lub-match.rs:45:17 +note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 35:17 + --> $DIR/lub-match.rs:35:17 | LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { | ^^ diff --git a/src/test/ui/macro_backtrace/auxiliary/ping.rs b/src/test/ui/macro_backtrace/auxiliary/ping.rs index e4131dde8f7..efddb209cda 100644 --- a/src/test/ui/macro_backtrace/auxiliary/ping.rs +++ b/src/test/ui/macro_backtrace/auxiliary/ping.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the macro backtrace facility works (supporting file) // a non-local macro diff --git a/src/test/ui/macro_backtrace/main.rs b/src/test/ui/macro_backtrace/main.rs index 72a5c0d5e37..8fcd497f87b 100644 --- a/src/test/ui/macro_backtrace/main.rs +++ b/src/test/ui/macro_backtrace/main.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the macro backtrace facility works // aux-build:ping.rs // compile-flags: -Z external-macro-backtrace @@ -22,6 +12,9 @@ macro_rules! pong { //~| ERROR expected one of //~| ERROR expected one of +#[allow(non_camel_case_types)] +struct syntax; + fn main() { pong!(); ping!(); diff --git a/src/test/ui/macro_backtrace/main.stderr b/src/test/ui/macro_backtrace/main.stderr index 8cecef508a2..239b53f2338 100644 --- a/src/test/ui/macro_backtrace/main.stderr +++ b/src/test/ui/macro_backtrace/main.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` - --> $DIR/main.rs:19:20 + --> $DIR/main.rs:9:20 | LL | / macro_rules! pong { LL | | () => { syntax error }; @@ -11,7 +11,7 @@ LL | pong!(); | -------- in this macro invocation error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` - --> $DIR/main.rs:19:20 + --> $DIR/main.rs:9:20 | LL | / macro_rules! pong { LL | | () => { syntax error }; @@ -31,7 +31,7 @@ LL | ( ) => { pong ! ( ) ; } | in this expansion of `ping!` error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `error` - --> $DIR/main.rs:19:20 + --> $DIR/main.rs:9:20 | LL | / macro_rules! pong { LL | | () => { syntax error }; diff --git a/src/test/ui/macros/assert.rs b/src/test/ui/macros/assert.rs new file mode 100644 index 00000000000..71b0dbb19e2 --- /dev/null +++ b/src/test/ui/macros/assert.rs @@ -0,0 +1,6 @@ +fn main() { + assert!(); //~ ERROR requires a boolean expression + assert!(struct); //~ ERROR expected expression + debug_assert!(); //~ ERROR requires a boolean expression + debug_assert!(struct); //~ ERROR expected expression +} diff --git a/src/test/ui/macros/assert.stderr b/src/test/ui/macros/assert.stderr new file mode 100644 index 00000000000..2cfcebabcb9 --- /dev/null +++ b/src/test/ui/macros/assert.stderr @@ -0,0 +1,28 @@ +error: macro requires a boolean expression as an argument + --> $DIR/assert.rs:2:5 + | +LL | assert!(); //~ ERROR requires a boolean expression + | ^^^^^^^^^^ boolean expression required + +error: expected expression, found keyword `struct` + --> $DIR/assert.rs:3:13 + | +LL | assert!(struct); //~ ERROR expected expression + | ^^^^^^ expected expression + +error: macro requires a boolean expression as an argument + --> $DIR/assert.rs:4:5 + | +LL | debug_assert!(); //~ ERROR requires a boolean expression + | ^^^^^^^^^^^^^^^^ boolean expression required + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: expected expression, found keyword `struct` + --> $DIR/assert.rs:5:19 + | +LL | debug_assert!(struct); //~ ERROR expected expression + | ^^^^^^ expected expression + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/macros/auxiliary/macro-in-other-crate.rs b/src/test/ui/macros/auxiliary/macro-in-other-crate.rs index 7f716c5012e..db8e9201865 100644 --- a/src/test/ui/macros/auxiliary/macro-in-other-crate.rs +++ b/src/test/ui/macros/auxiliary/macro-in-other-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! mac { ($ident:ident) => { let $ident = 42; } diff --git a/src/test/ui/macros/auxiliary/macro_crate_nonterminal.rs b/src/test/ui/macros/auxiliary/macro_crate_nonterminal.rs index 4f75e2b5d75..2e2440462ae 100644 --- a/src/test/ui/macros/auxiliary/macro_crate_nonterminal.rs +++ b/src/test/ui/macros/auxiliary/macro_crate_nonterminal.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn increment(x: usize) -> usize { x + 1 } diff --git a/src/test/ui/macros/auxiliary/two_macros.rs b/src/test/ui/macros/auxiliary/two_macros.rs index 060960f0dbc..2330c75c8e0 100644 --- a/src/test/ui/macros/auxiliary/two_macros.rs +++ b/src/test/ui/macros/auxiliary/two_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! macro_one { () => ("one") } diff --git a/src/test/ui/macros/auxiliary/unstable-macros.rs b/src/test/ui/macros/auxiliary/unstable-macros.rs index 836164a721a..b8d580702c9 100644 --- a/src/test/ui/macros/auxiliary/unstable-macros.rs +++ b/src/test/ui/macros/auxiliary/unstable-macros.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(staged_api)] #![stable(feature = "unit_test", since = "1.0.0")] diff --git a/src/test/ui/macros/bad-concat.rs b/src/test/ui/macros/bad-concat.rs index e7adee8ce85..263cd074d5a 100644 --- a/src/test/ui/macros/bad-concat.rs +++ b/src/test/ui/macros/bad-concat.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: u32 = 42; let y: f64 = 3.14; diff --git a/src/test/ui/macros/bad-concat.stderr b/src/test/ui/macros/bad-concat.stderr index b97e4f26824..4316fd312c7 100644 --- a/src/test/ui/macros/bad-concat.stderr +++ b/src/test/ui/macros/bad-concat.stderr @@ -1,5 +1,5 @@ error: expected a literal - --> $DIR/bad-concat.rs:15:21 + --> $DIR/bad-concat.rs:5:21 | LL | let _ = concat!(x, y, z, "bar"); | ^ ^ ^ diff --git a/src/test/ui/macros/bad_hello.rs b/src/test/ui/macros/bad_hello.rs index cccaf7998c9..aaa9e243a2d 100644 --- a/src/test/ui/macros/bad_hello.rs +++ b/src/test/ui/macros/bad_hello.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!(3 + 4); //~^ ERROR format argument must be a string literal diff --git a/src/test/ui/macros/bad_hello.stderr b/src/test/ui/macros/bad_hello.stderr index c675eede215..ab3cbf058ba 100644 --- a/src/test/ui/macros/bad_hello.stderr +++ b/src/test/ui/macros/bad_hello.stderr @@ -1,5 +1,5 @@ error: format argument must be a string literal - --> $DIR/bad_hello.rs:12:14 + --> $DIR/bad_hello.rs:2:14 | LL | println!(3 + 4); | ^^^^^ @@ -9,7 +9,7 @@ LL | println!("{}", 3 + 4); | ^^^^^ error: format argument must be a string literal - --> $DIR/bad_hello.rs:14:14 + --> $DIR/bad_hello.rs:4:14 | LL | println!(3, 4); | ^ diff --git a/src/test/ui/macros/cfg.rs b/src/test/ui/macros/cfg.rs new file mode 100644 index 00000000000..222161a8183 --- /dev/null +++ b/src/test/ui/macros/cfg.rs @@ -0,0 +1,5 @@ +fn main() { + cfg!(); //~ ERROR macro requires a cfg-pattern + cfg!(123); //~ ERROR expected identifier + cfg!(foo = 123); //~ ERROR literal in `cfg` predicate value must be a string +} diff --git a/src/test/ui/macros/cfg.stderr b/src/test/ui/macros/cfg.stderr new file mode 100644 index 00000000000..a7aca88f3e5 --- /dev/null +++ b/src/test/ui/macros/cfg.stderr @@ -0,0 +1,21 @@ +error: macro requires a cfg-pattern as an argument + --> $DIR/cfg.rs:2:5 + | +LL | cfg!(); //~ ERROR macro requires a cfg-pattern + | ^^^^^^^ cfg-pattern required + +error: expected identifier, found `123` + --> $DIR/cfg.rs:3:10 + | +LL | cfg!(123); //~ ERROR expected identifier + | ^^^ expected identifier + +error[E0565]: literal in `cfg` predicate value must be a string + --> $DIR/cfg.rs:4:16 + | +LL | cfg!(foo = 123); //~ ERROR literal in `cfg` predicate value must be a string + | ^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0565`. diff --git a/src/test/ui/macros/format-foreign.rs b/src/test/ui/macros/format-foreign.rs index ac00ce3af96..ac65838f21d 100644 --- a/src/test/ui/macros/format-foreign.rs +++ b/src/test/ui/macros/format-foreign.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("%.*3$s %s!\n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments println!("%1$*2$.*3$f", 123.456); //~ ERROR never used diff --git a/src/test/ui/macros/format-foreign.stderr b/src/test/ui/macros/format-foreign.stderr index d5e2b514c40..0b8bfcbdc17 100644 --- a/src/test/ui/macros/format-foreign.stderr +++ b/src/test/ui/macros/format-foreign.stderr @@ -1,9 +1,11 @@ error: multiple unused formatting arguments - --> $DIR/format-foreign.rs:12:30 + --> $DIR/format-foreign.rs:2:30 | LL | println!("%.*3$s %s!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments - | -------------- ^^^^^^^^ ^^^^^^^ ^ - | | + | -------------- ^^^^^^^^ ^^^^^^^ ^ argument never used + | | | | + | | | argument never used + | | argument never used | multiple missing formatting specifiers | = note: printf formatting not supported; see the documentation for `std::fmt` @@ -13,24 +15,26 @@ LL | println!("{:.2$} {}!/n", "Hello,", "World", 4); //~ ERROR multiple unus | ^^^^^^ ^^ error: argument never used - --> $DIR/format-foreign.rs:13:29 + --> $DIR/format-foreign.rs:3:29 | LL | println!("%1$*2$.*3$f", 123.456); //~ ERROR never used - | ----------- ^^^^^^^ + | ----------- ^^^^^^^ argument never used | | | help: format specifiers use curly braces: `{0:1$.2$}` | = note: printf formatting not supported; see the documentation for `std::fmt` error: multiple unused formatting arguments - --> $DIR/format-foreign.rs:16:7 + --> $DIR/format-foreign.rs:6:7 | LL | println!(r###"%.*3$s | ______________- LL | | %s!/n LL | | "###, "Hello,", "World", 4); - | | - ^^^^^^^^ ^^^^^^^ ^ - | |____| + | | - ^^^^^^^^ ^^^^^^^ ^ argument never used + | | | | | + | | | | argument never used + | |____| argument never used | multiple missing formatting specifiers | = note: printf formatting not supported; see the documentation for `std::fmt` @@ -41,29 +45,31 @@ LL | {}!/n | error: argument never used - --> $DIR/format-foreign.rs:22:30 + --> $DIR/format-foreign.rs:12:30 | LL | println!("{} %f", "one", 2.0); //~ ERROR never used - | ------- ^^^ + | ------- ^^^ argument never used | | | formatting specifier missing error: named argument never used - --> $DIR/format-foreign.rs:24:39 + --> $DIR/format-foreign.rs:14:39 | LL | println!("Hi there, $NAME.", NAME="Tim"); //~ ERROR never used - | ----- ^^^^^ + | ----- ^^^^^ named argument never used | | | help: format specifiers use curly braces: `{NAME}` | = note: shell formatting not supported; see the documentation for `std::fmt` error: multiple unused formatting arguments - --> $DIR/format-foreign.rs:25:32 + --> $DIR/format-foreign.rs:15:32 | LL | println!("$1 $0 $$ $NAME", 1, 2, NAME=3); - | ---------------- ^ ^ ^ - | | + | ---------------- ^ ^ ^ named argument never used + | | | | + | | | argument never used + | | argument never used | multiple missing formatting specifiers | = note: shell formatting not supported; see the documentation for `std::fmt` diff --git a/src/test/ui/macros/format-parse-errors.rs b/src/test/ui/macros/format-parse-errors.rs new file mode 100644 index 00000000000..96aee5e6aee --- /dev/null +++ b/src/test/ui/macros/format-parse-errors.rs @@ -0,0 +1,11 @@ +fn main() { + format!(); //~ ERROR requires at least a format string argument + format!(struct); //~ ERROR expected expression + format!("s", name =); //~ ERROR expected expression + format!("s", foo = foo, bar); //~ ERROR expected `=` + format!("s", foo = struct); //~ ERROR expected expression + format!("s", struct); //~ ERROR expected expression + + // This error should come after parsing errors to ensure they are non-fatal. + format!(123); //~ ERROR format argument must be a string literal +} diff --git a/src/test/ui/macros/format-parse-errors.stderr b/src/test/ui/macros/format-parse-errors.stderr new file mode 100644 index 00000000000..a3d2786bce1 --- /dev/null +++ b/src/test/ui/macros/format-parse-errors.stderr @@ -0,0 +1,50 @@ +error: requires at least a format string argument + --> $DIR/format-parse-errors.rs:2:5 + | +LL | format!(); //~ ERROR requires at least a format string argument + | ^^^^^^^^^^ + | + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: expected expression, found keyword `struct` + --> $DIR/format-parse-errors.rs:3:13 + | +LL | format!(struct); //~ ERROR expected expression + | ^^^^^^ expected expression + +error: expected expression, found `` + --> $DIR/format-parse-errors.rs:4:23 + | +LL | format!("s", name =); //~ ERROR expected expression + | ^ expected expression + +error: expected `=`, found `` + --> $DIR/format-parse-errors.rs:5:29 + | +LL | format!("s", foo = foo, bar); //~ ERROR expected `=` + | ^^^ expected `=` + +error: expected expression, found keyword `struct` + --> $DIR/format-parse-errors.rs:6:24 + | +LL | format!("s", foo = struct); //~ ERROR expected expression + | ^^^^^^ expected expression + +error: expected expression, found keyword `struct` + --> $DIR/format-parse-errors.rs:7:18 + | +LL | format!("s", struct); //~ ERROR expected expression + | ^^^^^^ expected expression + +error: format argument must be a string literal + --> $DIR/format-parse-errors.rs:10:13 + | +LL | format!(123); //~ ERROR format argument must be a string literal + | ^^^ +help: you might be missing a string literal to format with + | +LL | format!("{}", 123); //~ ERROR format argument must be a string literal + | ^^^^^ + +error: aborting due to 7 previous errors + diff --git a/src/test/ui/macros/format-unused-lables.rs b/src/test/ui/macros/format-unused-lables.rs index 3347a1215ce..56382b1011c 100644 --- a/src/test/ui/macros/format-unused-lables.rs +++ b/src/test/ui/macros/format-unused-lables.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("Test", 123, 456, 789); //~^ ERROR multiple unused formatting arguments diff --git a/src/test/ui/macros/format-unused-lables.stderr b/src/test/ui/macros/format-unused-lables.stderr index 67ffeec67cc..0a5e379a4ad 100644 --- a/src/test/ui/macros/format-unused-lables.stderr +++ b/src/test/ui/macros/format-unused-lables.stderr @@ -1,33 +1,35 @@ error: multiple unused formatting arguments - --> $DIR/format-unused-lables.rs:12:22 + --> $DIR/format-unused-lables.rs:2:22 | LL | println!("Test", 123, 456, 789); - | ------ ^^^ ^^^ ^^^ - | | + | ------ ^^^ ^^^ ^^^ argument never used + | | | | + | | | argument never used + | | argument never used | multiple missing formatting specifiers error: multiple unused formatting arguments - --> $DIR/format-unused-lables.rs:16:9 + --> $DIR/format-unused-lables.rs:6:9 | LL | println!("Test2", | ------- multiple missing formatting specifiers LL | 123, //~ ERROR multiple unused formatting arguments - | ^^^ + | ^^^ argument never used LL | 456, - | ^^^ + | ^^^ argument never used LL | 789 - | ^^^ + | ^^^ argument never used error: named argument never used - --> $DIR/format-unused-lables.rs:21:35 + --> $DIR/format-unused-lables.rs:11:35 | LL | println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used - | ------------ ^^^^^^ + | ------------ ^^^^^^ named argument never used | | | formatting specifier missing error: multiple unused formatting arguments - --> $DIR/format-unused-lables.rs:24:9 + --> $DIR/format-unused-lables.rs:14:9 | LL | println!("Some more $STUFF", | ------------------ @@ -35,12 +37,12 @@ LL | println!("Some more $STUFF", | | help: format specifiers use curly braces: `{STUFF}` | multiple missing formatting specifiers LL | "woo!", //~ ERROR multiple unused formatting arguments - | ^^^^^^ + | ^^^^^^ argument never used LL | STUFF= LL | "things" - | ^^^^^^^^ + | ^^^^^^^^ named argument never used LL | , UNUSED="args"); - | ^^^^^^ + | ^^^^^^ named argument never used | = note: shell formatting not supported; see the documentation for `std::fmt` diff --git a/src/test/ui/macros/global-asm.rs b/src/test/ui/macros/global-asm.rs new file mode 100644 index 00000000000..8402afa5085 --- /dev/null +++ b/src/test/ui/macros/global-asm.rs @@ -0,0 +1,7 @@ +#![feature(global_asm)] + +fn main() { + global_asm!(); //~ ERROR requires a string literal as an argument + global_asm!(struct); //~ ERROR expected expression + global_asm!(123); //~ ERROR inline assembly must be a string literal +} diff --git a/src/test/ui/macros/global-asm.stderr b/src/test/ui/macros/global-asm.stderr new file mode 100644 index 00000000000..94664c96db3 --- /dev/null +++ b/src/test/ui/macros/global-asm.stderr @@ -0,0 +1,20 @@ +error: macro requires a string literal as an argument + --> $DIR/global-asm.rs:4:5 + | +LL | global_asm!(); //~ ERROR requires a string literal as an argument + | ^^^^^^^^^^^^^^ string literal required + +error: expected expression, found keyword `struct` + --> $DIR/global-asm.rs:5:17 + | +LL | global_asm!(struct); //~ ERROR expected expression + | ^^^^^^ expected expression + +error: inline assembly must be a string literal + --> $DIR/global-asm.rs:6:17 + | +LL | global_asm!(123); //~ ERROR inline assembly must be a string literal + | ^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/macros/issue-30143.rs b/src/test/ui/macros/issue-30143.rs index b7fb5b3af99..ac4c1da5cb7 100644 --- a/src/test/ui/macros/issue-30143.rs +++ b/src/test/ui/macros/issue-30143.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::fmt::Write; fn main() { diff --git a/src/test/ui/macros/issue-30143.stderr b/src/test/ui/macros/issue-30143.stderr index 56834f68f84..f0c604a23ff 100644 --- a/src/test/ui/macros/issue-30143.stderr +++ b/src/test/ui/macros/issue-30143.stderr @@ -1,5 +1,5 @@ error: format argument must be a string literal - --> $DIR/issue-30143.rs:14:14 + --> $DIR/issue-30143.rs:4:14 | LL | println!(0); | ^ @@ -9,7 +9,7 @@ LL | println!("{}", 0); | ^^^^^ error: format argument must be a string literal - --> $DIR/issue-30143.rs:16:15 + --> $DIR/issue-30143.rs:6:15 | LL | eprintln!('a'); | ^^^ @@ -19,7 +19,7 @@ LL | eprintln!("{}", 'a'); | ^^^^^ error: format argument must be a string literal - --> $DIR/issue-30143.rs:19:17 + --> $DIR/issue-30143.rs:9:17 | LL | writeln!(s, true).unwrap(); | ^^^^ diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs deleted file mode 100644 index 63a4ef16a25..00000000000 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test behavior of `?` macro _kleene op_ under the 2015 edition. Namely, it doesn't exist, even -// with the feature flag. - -// gate-test-macro_at_most_once_rep -// edition:2015 - -#![feature(macro_at_most_once_rep)] - -macro_rules! bar { - ($(a)?) => {} //~ERROR expected `*` or `+` -} - -macro_rules! baz { - ($(a),?) => {} //~ERROR expected `*` or `+` -} - -fn main() {} - diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.stderr b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.stderr deleted file mode 100644 index 5f687900421..00000000000 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: expected `*` or `+` - --> $DIR/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs:20:10 - | -LL | ($(a)?) => {} //~ERROR expected `*` or `+` - | ^ - | - = note: `?` is not a macro repetition operator - -error: expected `*` or `+` - --> $DIR/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs:24:11 - | -LL | ($(a),?) => {} //~ERROR expected `*` or `+` - | ^ - | - = note: `?` is not a macro repetition operator - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.rs b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.rs index 64848d050cb..2d8d2ecf9d7 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.rs +++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test behavior of `?` macro _kleene op_ under the 2015 edition. Namely, it doesn't exist. // edition:2015 diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr index 8681b5d5be5..b27b60459d6 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr +++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr @@ -1,5 +1,5 @@ error: expected `*` or `+` - --> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:16:10 + --> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:6:10 | LL | ($(a)?) => {} //~ERROR expected `*` or `+` | ^ @@ -7,7 +7,7 @@ LL | ($(a)?) => {} //~ERROR expected `*` or `+` = note: `?` is not a macro repetition operator error: expected `*` or `+` - --> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:20:11 + --> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:10:11 | LL | ($(a),?) => {} //~ERROR expected `*` or `+` | ^ diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs index a7857991079..c8c920ff3f8 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs +++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test behavior of `?` macro _separator_ under the 2015 edition. Namely, `?` can be used as a // separator, but you get a migration warning for the edition. diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr index db1872c2413..b171cf8b34d 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr +++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr @@ -1,11 +1,11 @@ warning: using `?` as a separator is deprecated and will be a hard error in an upcoming edition - --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:20:10 + --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:10:10 | LL | ($(a)?*) => {} //~WARN using `?` as a separator | ^ | note: lint level defined here - --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:17:9 + --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:7:9 | LL | #![warn(rust_2018_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL | #![warn(rust_2018_compatibility)] = note: for more information, see issue #48075 warning: using `?` as a separator is deprecated and will be a hard error in an upcoming edition - --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:25:10 + --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:15:10 | LL | ($(a)?+) => {} //~WARN using `?` as a separator | ^ diff --git a/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.rs b/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.rs deleted file mode 100644 index ffabf9bcdf6..00000000000 --- a/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Feature gate test for macro_at_most_once_rep under 2018 edition. - -// gate-test-macro_at_most_once_rep -// edition:2018 - -macro_rules! foo { - ($(a)?) => {} - //~^ERROR using the `?` macro Kleene operator for - //~|ERROR expected `*` or `+` -} - -macro_rules! baz { - ($(a),?) => {} //~ERROR expected `*` or `+` -} - -macro_rules! barplus { - ($(a)?+) => {} - //~^ERROR using the `?` macro Kleene operator for - //~|ERROR expected `*` or `+` -} - -macro_rules! barstar { - ($(a)?*) => {} - //~^ERROR using the `?` macro Kleene operator for - //~|ERROR expected `*` or `+` -} - -pub fn main() { - foo!(); - foo!(a); - foo!(a?); //~ ERROR no rules expected the token `?` - foo!(a?a); //~ ERROR no rules expected the token `?` - foo!(a?a?a); //~ ERROR no rules expected the token `?` -} - diff --git a/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.stderr b/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.stderr deleted file mode 100644 index 7705ba3b11e..00000000000 --- a/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.stderr +++ /dev/null @@ -1,80 +0,0 @@ -error[E0658]: using the `?` macro Kleene operator for "at most one" repetition is unstable (see issue #48075) - --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:17:10 - | -LL | ($(a)?) => {} - | ^ - | - = help: add #![feature(macro_at_most_once_rep)] to the crate attributes to enable - -error: expected `*` or `+` - --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:17:10 - | -LL | ($(a)?) => {} - | ^ - -error: expected `*` or `+` - --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:23:11 - | -LL | ($(a),?) => {} //~ERROR expected `*` or `+` - | ^ - | - = note: `?` is not a macro repetition operator - -error[E0658]: using the `?` macro Kleene operator for "at most one" repetition is unstable (see issue #48075) - --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:27:10 - | -LL | ($(a)?+) => {} - | ^ - | - = help: add #![feature(macro_at_most_once_rep)] to the crate attributes to enable - -error: expected `*` or `+` - --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:27:10 - | -LL | ($(a)?+) => {} - | ^ - -error[E0658]: using the `?` macro Kleene operator for "at most one" repetition is unstable (see issue #48075) - --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:33:10 - | -LL | ($(a)?*) => {} - | ^ - | - = help: add #![feature(macro_at_most_once_rep)] to the crate attributes to enable - -error: expected `*` or `+` - --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:33:10 - | -LL | ($(a)?*) => {} - | ^ - -error: no rules expected the token `?` - --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:41:11 - | -LL | macro_rules! foo { - | ---------------- when calling this macro -... -LL | foo!(a?); //~ ERROR no rules expected the token `?` - | ^ no rules expected the token `?` - -error: no rules expected the token `?` - --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:42:11 - | -LL | macro_rules! foo { - | ---------------- when calling this macro -... -LL | foo!(a?a); //~ ERROR no rules expected the token `?` - | ^ no rules expected the token `?` - -error: no rules expected the token `?` - --> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:43:11 - | -LL | macro_rules! foo { - | ---------------- when calling this macro -... -LL | foo!(a?a?a); //~ ERROR no rules expected the token `?` - | ^ no rules expected the token `?` - -error: aborting due to 10 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/macros/macro-at-most-once-rep-2018.rs b/src/test/ui/macros/macro-at-most-once-rep-2018.rs index 5dabe8d9528..da072adec15 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2018.rs +++ b/src/test/ui/macros/macro-at-most-once-rep-2018.rs @@ -1,33 +1,21 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that `?` is a Kleene op and not a macro separator in the 2018 edition. // edition:2018 -#![feature(macro_at_most_once_rep)] - macro_rules! foo { - ($(a)?) => {} + ($(a)?) => {}; } macro_rules! baz { - ($(a),?) => {} //~ERROR the `?` macro repetition operator + ($(a),?) => {}; //~ERROR the `?` macro repetition operator } macro_rules! barplus { - ($(a)?+) => {} // ok. matches "a+" and "+" + ($(a)?+) => {}; // ok. matches "a+" and "+" } macro_rules! barstar { - ($(a)?*) => {} // ok. matches "a*" and "*" + ($(a)?*) => {}; // ok. matches "a*" and "*" } pub fn main() { diff --git a/src/test/ui/macros/macro-at-most-once-rep-2018.stderr b/src/test/ui/macros/macro-at-most-once-rep-2018.stderr index 25dd66b81f5..657c7e54d97 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2018.stderr +++ b/src/test/ui/macros/macro-at-most-once-rep-2018.stderr @@ -1,107 +1,107 @@ error: the `?` macro repetition operator does not take a separator - --> $DIR/macro-at-most-once-rep-2018.rs:22:10 + --> $DIR/macro-at-most-once-rep-2018.rs:10:10 | -LL | ($(a),?) => {} //~ERROR the `?` macro repetition operator +LL | ($(a),?) => {}; //~ERROR the `?` macro repetition operator | ^ error: no rules expected the token `?` - --> $DIR/macro-at-most-once-rep-2018.rs:36:11 + --> $DIR/macro-at-most-once-rep-2018.rs:24:11 | LL | macro_rules! foo { | ---------------- when calling this macro ... LL | foo!(a?); //~ ERROR no rules expected the token `?` - | ^ no rules expected the token `?` + | ^ no rules expected this token in macro call error: no rules expected the token `?` - --> $DIR/macro-at-most-once-rep-2018.rs:37:11 + --> $DIR/macro-at-most-once-rep-2018.rs:25:11 | LL | macro_rules! foo { | ---------------- when calling this macro ... LL | foo!(a?a); //~ ERROR no rules expected the token `?` - | ^ no rules expected the token `?` + | ^ no rules expected this token in macro call error: no rules expected the token `?` - --> $DIR/macro-at-most-once-rep-2018.rs:38:11 + --> $DIR/macro-at-most-once-rep-2018.rs:26:11 | LL | macro_rules! foo { | ---------------- when calling this macro ... LL | foo!(a?a?a); //~ ERROR no rules expected the token `?` - | ^ no rules expected the token `?` + | ^ no rules expected this token in macro call error: unexpected end of macro invocation - --> $DIR/macro-at-most-once-rep-2018.rs:40:5 + --> $DIR/macro-at-most-once-rep-2018.rs:28:5 | LL | macro_rules! barplus { | -------------------- when calling this macro ... LL | barplus!(); //~ERROR unexpected end of macro invocation - | ^^^^^^^^^^^ unexpected end of macro invocation + | ^^^^^^^^^^^ missing tokens in macro arguments error: unexpected end of macro invocation - --> $DIR/macro-at-most-once-rep-2018.rs:41:14 + --> $DIR/macro-at-most-once-rep-2018.rs:29:15 | LL | macro_rules! barplus { | -------------------- when calling this macro ... LL | barplus!(a); //~ERROR unexpected end of macro invocation - | ^ unexpected end of macro invocation + | ^ missing tokens in macro arguments error: no rules expected the token `?` - --> $DIR/macro-at-most-once-rep-2018.rs:42:15 + --> $DIR/macro-at-most-once-rep-2018.rs:30:15 | LL | macro_rules! barplus { | -------------------- when calling this macro ... LL | barplus!(a?); //~ ERROR no rules expected the token `?` - | ^ no rules expected the token `?` + | ^ no rules expected this token in macro call error: no rules expected the token `?` - --> $DIR/macro-at-most-once-rep-2018.rs:43:15 + --> $DIR/macro-at-most-once-rep-2018.rs:31:15 | LL | macro_rules! barplus { | -------------------- when calling this macro ... LL | barplus!(a?a); //~ ERROR no rules expected the token `?` - | ^ no rules expected the token `?` + | ^ no rules expected this token in macro call error: unexpected end of macro invocation - --> $DIR/macro-at-most-once-rep-2018.rs:47:5 + --> $DIR/macro-at-most-once-rep-2018.rs:35:5 | LL | macro_rules! barstar { | -------------------- when calling this macro ... LL | barstar!(); //~ERROR unexpected end of macro invocation - | ^^^^^^^^^^^ unexpected end of macro invocation + | ^^^^^^^^^^^ missing tokens in macro arguments error: unexpected end of macro invocation - --> $DIR/macro-at-most-once-rep-2018.rs:48:14 + --> $DIR/macro-at-most-once-rep-2018.rs:36:15 | LL | macro_rules! barstar { | -------------------- when calling this macro ... LL | barstar!(a); //~ERROR unexpected end of macro invocation - | ^ unexpected end of macro invocation + | ^ missing tokens in macro arguments error: no rules expected the token `?` - --> $DIR/macro-at-most-once-rep-2018.rs:49:15 + --> $DIR/macro-at-most-once-rep-2018.rs:37:15 | LL | macro_rules! barstar { | -------------------- when calling this macro ... LL | barstar!(a?); //~ ERROR no rules expected the token `?` - | ^ no rules expected the token `?` + | ^ no rules expected this token in macro call error: no rules expected the token `?` - --> $DIR/macro-at-most-once-rep-2018.rs:50:15 + --> $DIR/macro-at-most-once-rep-2018.rs:38:15 | LL | macro_rules! barstar { | -------------------- when calling this macro ... LL | barstar!(a?a); //~ ERROR no rules expected the token `?` - | ^ no rules expected the token `?` + | ^ no rules expected this token in macro call error: aborting due to 12 previous errors diff --git a/src/test/ui/macros/macro-attribute.rs b/src/test/ui/macros/macro-attribute.rs index 111375b3693..7ddac2745c5 100644 --- a/src/test/ui/macros/macro-attribute.rs +++ b/src/test/ui/macros/macro-attribute.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unrestricted_attribute_tokens)] #[doc = $not_there] //~ ERROR expected `]`, found `not_there` diff --git a/src/test/ui/macros/macro-attribute.stderr b/src/test/ui/macros/macro-attribute.stderr index c403872ecb3..fd4e7252d53 100644 --- a/src/test/ui/macros/macro-attribute.stderr +++ b/src/test/ui/macros/macro-attribute.stderr @@ -1,5 +1,5 @@ error: expected `]`, found `not_there` - --> $DIR/macro-attribute.rs:13:10 + --> $DIR/macro-attribute.rs:3:10 | LL | #[doc = $not_there] //~ ERROR expected `]`, found `not_there` | ^^^^^^^^^ expected `]` diff --git a/src/test/ui/macros/macro-backtrace-invalid-internals.rs b/src/test/ui/macros/macro-backtrace-invalid-internals.rs index 0bc2dd5a601..9501e7cd07c 100644 --- a/src/test/ui/macros/macro-backtrace-invalid-internals.rs +++ b/src/test/ui/macros/macro-backtrace-invalid-internals.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Macros in statement vs expression position handle backtraces differently. macro_rules! fake_method_stmt { diff --git a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr index ec8eee65739..353ae1d0ea6 100644 --- a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr +++ b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `fake` found for type `{integer}` in the current scope - --> $DIR/macro-backtrace-invalid-internals.rs:15:13 + --> $DIR/macro-backtrace-invalid-internals.rs:5:13 | LL | 1.fake() //~ ERROR no method | ^^^^ @@ -8,7 +8,7 @@ LL | fake_method_stmt!(); | -------------------- in this macro invocation error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields - --> $DIR/macro-backtrace-invalid-internals.rs:21:13 + --> $DIR/macro-backtrace-invalid-internals.rs:11:13 | LL | 1.fake //~ ERROR doesn't have fields | ^^^^ @@ -17,7 +17,7 @@ LL | fake_field_stmt!(); | ------------------- in this macro invocation error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields - --> $DIR/macro-backtrace-invalid-internals.rs:27:15 + --> $DIR/macro-backtrace-invalid-internals.rs:17:15 | LL | (1).0 //~ ERROR doesn't have fields | ^ @@ -26,7 +26,7 @@ LL | fake_anon_field_stmt!(); | ------------------------ in this macro invocation error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` - --> $DIR/macro-backtrace-invalid-internals.rs:51:15 + --> $DIR/macro-backtrace-invalid-internals.rs:41:15 | LL | 2.0.neg() //~ ERROR can't call method `neg` on ambiguous numeric type `{float}` | ^^^ @@ -39,7 +39,7 @@ LL | 2.0_f32.neg() //~ ERROR can't call method `neg` on ambiguous nume | ^^^^^^^ error[E0599]: no method named `fake` found for type `{integer}` in the current scope - --> $DIR/macro-backtrace-invalid-internals.rs:33:13 + --> $DIR/macro-backtrace-invalid-internals.rs:23:13 | LL | 1.fake() //~ ERROR no method | ^^^^ @@ -48,7 +48,7 @@ LL | let _ = fake_method_expr!(); | ------------------- in this macro invocation error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields - --> $DIR/macro-backtrace-invalid-internals.rs:39:13 + --> $DIR/macro-backtrace-invalid-internals.rs:29:13 | LL | 1.fake //~ ERROR doesn't have fields | ^^^^ @@ -57,7 +57,7 @@ LL | let _ = fake_field_expr!(); | ------------------ in this macro invocation error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields - --> $DIR/macro-backtrace-invalid-internals.rs:45:15 + --> $DIR/macro-backtrace-invalid-internals.rs:35:15 | LL | (1).0 //~ ERROR doesn't have fields | ^ @@ -66,7 +66,7 @@ LL | let _ = fake_anon_field_expr!(); | ----------------------- in this macro invocation error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` - --> $DIR/macro-backtrace-invalid-internals.rs:57:15 + --> $DIR/macro-backtrace-invalid-internals.rs:47:15 | LL | 2.0.neg() //~ ERROR can't call method `neg` on ambiguous numeric type `{float}` | ^^^ diff --git a/src/test/ui/macros/macro-backtrace-nested.rs b/src/test/ui/macros/macro-backtrace-nested.rs index d261633c60c..13d80163dd8 100644 --- a/src/test/ui/macros/macro-backtrace-nested.rs +++ b/src/test/ui/macros/macro-backtrace-nested.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // In expression position, but not statement position, when we expand a macro, // we replace the span of the expanded expression with that of the call site. diff --git a/src/test/ui/macros/macro-backtrace-nested.stderr b/src/test/ui/macros/macro-backtrace-nested.stderr index a4fe702c0d9..61a11231efe 100644 --- a/src/test/ui/macros/macro-backtrace-nested.stderr +++ b/src/test/ui/macros/macro-backtrace-nested.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `fake` in this scope - --> $DIR/macro-backtrace-nested.rs:15:12 + --> $DIR/macro-backtrace-nested.rs:5:12 | LL | () => (fake) //~ ERROR cannot find | ^^^^ not found in this scope @@ -8,7 +8,7 @@ LL | 1 + call_nested_expr!(); | ------------------- in this macro invocation error[E0425]: cannot find value `fake` in this scope - --> $DIR/macro-backtrace-nested.rs:15:12 + --> $DIR/macro-backtrace-nested.rs:5:12 | LL | () => (fake) //~ ERROR cannot find | ^^^^ not found in this scope diff --git a/src/test/ui/macros/macro-backtrace-println.rs b/src/test/ui/macros/macro-backtrace-println.rs index 6f035bc9d23..859dd019dcb 100644 --- a/src/test/ui/macros/macro-backtrace-println.rs +++ b/src/test/ui/macros/macro-backtrace-println.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The `format_args!` syntax extension issues errors before code expansion // has completed, but we still need a backtrace. diff --git a/src/test/ui/macros/macro-backtrace-println.stderr b/src/test/ui/macros/macro-backtrace-println.stderr index 8f2eb0173a4..c24a88c4159 100644 --- a/src/test/ui/macros/macro-backtrace-println.stderr +++ b/src/test/ui/macros/macro-backtrace-println.stderr @@ -1,5 +1,5 @@ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-backtrace-println.rs:24:30 + --> $DIR/macro-backtrace-println.rs:14:30 | LL | ($fmt:expr) => (myprint!(concat!($fmt, "/n"))); //~ ERROR no arguments were given | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/macros/macro-comma-behavior.core.stderr b/src/test/ui/macros/macro-comma-behavior.core.stderr index 5ff31f05079..dd0cac659fd 100644 --- a/src/test/ui/macros/macro-comma-behavior.core.stderr +++ b/src/test/ui/macros/macro-comma-behavior.core.stderr @@ -1,41 +1,41 @@ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:27:23 + --> $DIR/macro-comma-behavior.rs:21:23 | LL | assert_eq!(1, 1, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:30:23 + --> $DIR/macro-comma-behavior.rs:24:23 | LL | assert_ne!(1, 2, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:36:29 + --> $DIR/macro-comma-behavior.rs:30:29 | LL | debug_assert_eq!(1, 1, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:39:29 + --> $DIR/macro-comma-behavior.rs:33:29 | LL | debug_assert_ne!(1, 2, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:60:19 + --> $DIR/macro-comma-behavior.rs:54:19 | LL | format_args!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:78:21 + --> $DIR/macro-comma-behavior.rs:72:21 | LL | unimplemented!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:87:24 + --> $DIR/macro-comma-behavior.rs:81:24 | LL | write!(f, "{}",)?; | ^^ diff --git a/src/test/ui/macros/macro-comma-behavior.rs b/src/test/ui/macros/macro-comma-behavior.rs index 620e57b463d..006319aa9f5 100644 --- a/src/test/ui/macros/macro-comma-behavior.rs +++ b/src/test/ui/macros/macro-comma-behavior.rs @@ -1,22 +1,16 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Companion test to the similarly-named file in run-pass. // compile-flags: -C debug_assertions=yes // revisions: std core +#![feature(lang_items)] #![cfg_attr(core, no_std)] #[cfg(std)] use std::fmt; #[cfg(core)] use core::fmt; +#[cfg(core)] #[lang = "eh_personality"] fn eh_personality() {} +#[cfg(core)] #[lang = "eh_unwind_resume"] fn eh_unwind_resume() {} +#[cfg(core)] #[lang = "panic_impl"] fn panic_impl(panic: &core::panic::PanicInfo) -> ! { loop {} } // (see documentation of the similarly-named test in run-pass) fn to_format_or_not_to_format() { diff --git a/src/test/ui/macros/macro-comma-behavior.std.stderr b/src/test/ui/macros/macro-comma-behavior.std.stderr index a87271ed026..4372d89fbf5 100644 --- a/src/test/ui/macros/macro-comma-behavior.std.stderr +++ b/src/test/ui/macros/macro-comma-behavior.std.stderr @@ -1,59 +1,59 @@ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:27:23 + --> $DIR/macro-comma-behavior.rs:21:23 | LL | assert_eq!(1, 1, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:30:23 + --> $DIR/macro-comma-behavior.rs:24:23 | LL | assert_ne!(1, 2, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:36:29 + --> $DIR/macro-comma-behavior.rs:30:29 | LL | debug_assert_eq!(1, 1, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:39:29 + --> $DIR/macro-comma-behavior.rs:33:29 | LL | debug_assert_ne!(1, 2, "{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:44:18 + --> $DIR/macro-comma-behavior.rs:38:18 | LL | eprint!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:56:18 + --> $DIR/macro-comma-behavior.rs:50:18 | LL | format!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:60:19 + --> $DIR/macro-comma-behavior.rs:54:19 | LL | format_args!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:67:17 + --> $DIR/macro-comma-behavior.rs:61:17 | LL | print!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:78:21 + --> $DIR/macro-comma-behavior.rs:72:21 | LL | unimplemented!("{}",); | ^^ error: 1 positional argument in format string, but no arguments were given - --> $DIR/macro-comma-behavior.rs:87:24 + --> $DIR/macro-comma-behavior.rs:81:24 | LL | write!(f, "{}",)?; | ^^ diff --git a/src/test/ui/macros/macro-comma-support.rs b/src/test/ui/macros/macro-comma-support.rs index e5fe9b4dd7f..7df5b62339f 100644 --- a/src/test/ui/macros/macro-comma-support.rs +++ b/src/test/ui/macros/macro-comma-support.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is a companion to the similarly-named test in run-pass. // // It tests macros that unavoidably produce compile errors. diff --git a/src/test/ui/macros/macro-comma-support.stderr b/src/test/ui/macros/macro-comma-support.stderr index 2ebba22d7a1..a4bb8a9b32f 100644 --- a/src/test/ui/macros/macro-comma-support.stderr +++ b/src/test/ui/macros/macro-comma-support.stderr @@ -1,11 +1,11 @@ error: lel - --> $DIR/macro-comma-support.rs:16:5 + --> $DIR/macro-comma-support.rs:6:5 | LL | compile_error!("lel"); //~ ERROR lel | ^^^^^^^^^^^^^^^^^^^^^^ error: lel - --> $DIR/macro-comma-support.rs:17:5 + --> $DIR/macro-comma-support.rs:7:5 | LL | compile_error!("lel",); //~ ERROR lel | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/macros/macro-context.rs b/src/test/ui/macros/macro-context.rs index 56b3d5d0def..9130c3d921c 100644 --- a/src/test/ui/macros/macro-context.rs +++ b/src/test/ui/macros/macro-context.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // (typeof used because it's surprisingly hard to find an unparsed token after a stmt) macro_rules! m { () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` diff --git a/src/test/ui/macros/macro-context.stderr b/src/test/ui/macros/macro-context.stderr index 005e1d1c8e7..9a4a8e31985 100644 --- a/src/test/ui/macros/macro-context.stderr +++ b/src/test/ui/macros/macro-context.stderr @@ -1,5 +1,5 @@ error: macro expansion ignores token `;` and any following - --> $DIR/macro-context.rs:13:15 + --> $DIR/macro-context.rs:3:15 | LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` | ^ @@ -10,7 +10,7 @@ LL | let a: m!(); = note: the usage of `m!` is likely invalid in type context error: macro expansion ignores token `typeof` and any following - --> $DIR/macro-context.rs:13:17 + --> $DIR/macro-context.rs:3:17 | LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` | ^^^^^^ @@ -21,7 +21,7 @@ LL | let i = m!(); = note: the usage of `m!` is likely invalid in expression context error: macro expansion ignores token `;` and any following - --> $DIR/macro-context.rs:13:15 + --> $DIR/macro-context.rs:3:15 | LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` | ^ @@ -32,7 +32,7 @@ LL | m!() => {} = note: the usage of `m!` is likely invalid in pattern context error: expected expression, found reserved keyword `typeof` - --> $DIR/macro-context.rs:13:17 + --> $DIR/macro-context.rs:3:17 | LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` | ^^^^^^ expected expression diff --git a/src/test/ui/macros/macro-crate-nonterminal-non-root.rs b/src/test/ui/macros/macro-crate-nonterminal-non-root.rs index 76211b88bd7..67899556f8a 100644 --- a/src/test/ui/macros/macro-crate-nonterminal-non-root.rs +++ b/src/test/ui/macros/macro-crate-nonterminal-non-root.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:macro_crate_nonterminal.rs mod foo { diff --git a/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr b/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr index 029128ae92a..a1af9ba1758 100644 --- a/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr +++ b/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr @@ -1,5 +1,5 @@ error[E0468]: an `extern crate` loading macros must be at the crate root - --> $DIR/macro-crate-nonterminal-non-root.rs:15:5 + --> $DIR/macro-crate-nonterminal-non-root.rs:5:5 | LL | extern crate macro_crate_nonterminal; //~ ERROR must be at the crate root | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/macros/macro-error.rs b/src/test/ui/macros/macro-error.rs index 82a5aa48729..59ed79e91f0 100644 --- a/src/test/ui/macros/macro-error.rs +++ b/src/test/ui/macros/macro-error.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo { ($a:expr) => a; //~ ERROR macro rhs must be delimited } diff --git a/src/test/ui/macros/macro-error.stderr b/src/test/ui/macros/macro-error.stderr index 42808eb2a6b..f56b67e7cd0 100644 --- a/src/test/ui/macros/macro-error.stderr +++ b/src/test/ui/macros/macro-error.stderr @@ -1,11 +1,11 @@ error: macro rhs must be delimited - --> $DIR/macro-error.rs:12:18 + --> $DIR/macro-error.rs:2:18 | LL | ($a:expr) => a; //~ ERROR macro rhs must be delimited | ^ error: non-type macro in type position: cfg - --> $DIR/macro-error.rs:18:12 + --> $DIR/macro-error.rs:8:12 | LL | let _: cfg!(foo) = (); //~ ERROR non-type macro in type position | ^^^ diff --git a/src/test/ui/macros/macro-expanded-include/foo/mod.rs b/src/test/ui/macros/macro-expanded-include/foo/mod.rs index 888bdf5179a..a8bfa0299f6 100644 --- a/src/test/ui/macros/macro-expanded-include/foo/mod.rs +++ b/src/test/ui/macros/macro-expanded-include/foo/mod.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test macro_rules! m { diff --git a/src/test/ui/macros/macro-expanded-include/test.rs b/src/test/ui/macros/macro-expanded-include/test.rs index fa3737d6911..fe697db9fbe 100644 --- a/src/test/ui/macros/macro-expanded-include/test.rs +++ b/src/test/ui/macros/macro-expanded-include/test.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten no asm! support // compile-pass #![feature(asm)] diff --git a/src/test/ui/macros/macro-expansion-tests.rs b/src/test/ui/macros/macro-expansion-tests.rs index 06f2d86e5d9..38f4937c127 100644 --- a/src/test/ui/macros/macro-expansion-tests.rs +++ b/src/test/ui/macros/macro-expansion-tests.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_macros)] mod macros_cant_escape_fns { diff --git a/src/test/ui/macros/macro-expansion-tests.stderr b/src/test/ui/macros/macro-expansion-tests.stderr index a3d4f3cd348..4ad9ade95a0 100644 --- a/src/test/ui/macros/macro-expansion-tests.stderr +++ b/src/test/ui/macros/macro-expansion-tests.stderr @@ -1,5 +1,5 @@ error: cannot find macro `m!` in this scope - --> $DIR/macro-expansion-tests.rs:17:21 + --> $DIR/macro-expansion-tests.rs:7:21 | LL | fn g() -> i32 { m!() } | ^ @@ -7,7 +7,7 @@ LL | fn g() -> i32 { m!() } = help: have you added the `#[macro_use]` on the module/import? error: cannot find macro `m!` in this scope - --> $DIR/macro-expansion-tests.rs:25:21 + --> $DIR/macro-expansion-tests.rs:15:21 | LL | fn g() -> i32 { m!() } | ^ diff --git a/src/test/ui/macros/macro-follow.rs b/src/test/ui/macros/macro-follow.rs index 6e80e9b574b..f4a1931da5a 100644 --- a/src/test/ui/macros/macro-follow.rs +++ b/src/test/ui/macros/macro-follow.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // Check the macro follow sets (see corresponding rpass test). diff --git a/src/test/ui/macros/macro-follow.stderr b/src/test/ui/macros/macro-follow.stderr index 8760f6eb572..4aea5cc5de6 100644 --- a/src/test/ui/macros/macro-follow.stderr +++ b/src/test/ui/macros/macro-follow.stderr @@ -1,5 +1,5 @@ error: `$p:pat` is followed by `(`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:17:14 + --> $DIR/macro-follow.rs:8:14 | LL | ($p:pat ()) => {}; //~ERROR `$p:pat` is followed by `(` | ^ not allowed after `pat` fragments @@ -7,7 +7,7 @@ LL | ($p:pat ()) => {}; //~ERROR `$p:pat` is followed by `(` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `[`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:18:14 + --> $DIR/macro-follow.rs:9:14 | LL | ($p:pat []) => {}; //~ERROR `$p:pat` is followed by `[` | ^ not allowed after `pat` fragments @@ -15,7 +15,7 @@ LL | ($p:pat []) => {}; //~ERROR `$p:pat` is followed by `[` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `{`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:19:14 + --> $DIR/macro-follow.rs:10:14 | LL | ($p:pat {}) => {}; //~ERROR `$p:pat` is followed by `{` | ^ not allowed after `pat` fragments @@ -23,7 +23,7 @@ LL | ($p:pat {}) => {}; //~ERROR `$p:pat` is followed by `{` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `:`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:20:13 + --> $DIR/macro-follow.rs:11:13 | LL | ($p:pat :) => {}; //~ERROR `$p:pat` is followed by `:` | ^ not allowed after `pat` fragments @@ -31,7 +31,7 @@ LL | ($p:pat :) => {}; //~ERROR `$p:pat` is followed by `:` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `>`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:21:13 + --> $DIR/macro-follow.rs:12:13 | LL | ($p:pat >) => {}; //~ERROR `$p:pat` is followed by `>` | ^ not allowed after `pat` fragments @@ -39,7 +39,7 @@ LL | ($p:pat >) => {}; //~ERROR `$p:pat` is followed by `>` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `+`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:22:13 + --> $DIR/macro-follow.rs:13:13 | LL | ($p:pat +) => {}; //~ERROR `$p:pat` is followed by `+` | ^ not allowed after `pat` fragments @@ -47,7 +47,7 @@ LL | ($p:pat +) => {}; //~ERROR `$p:pat` is followed by `+` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `ident`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:23:13 + --> $DIR/macro-follow.rs:14:13 | LL | ($p:pat ident) => {}; //~ERROR `$p:pat` is followed by `ident` | ^^^^^ not allowed after `pat` fragments @@ -55,7 +55,7 @@ LL | ($p:pat ident) => {}; //~ERROR `$p:pat` is followed by `ident` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `$p:pat`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:24:13 + --> $DIR/macro-follow.rs:15:13 | LL | ($p:pat $p:pat) => {}; //~ERROR `$p:pat` is followed by `$p:pat` | ^^^^^^ not allowed after `pat` fragments @@ -63,7 +63,7 @@ LL | ($p:pat $p:pat) => {}; //~ERROR `$p:pat` is followed by `$p:pat` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `$e:expr`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:25:13 + --> $DIR/macro-follow.rs:16:13 | LL | ($p:pat $e:expr) => {}; //~ERROR `$p:pat` is followed by `$e:expr` | ^^^^^^^ not allowed after `pat` fragments @@ -71,7 +71,7 @@ LL | ($p:pat $e:expr) => {}; //~ERROR `$p:pat` is followed by `$e:expr` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `$t:ty`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:26:13 + --> $DIR/macro-follow.rs:17:13 | LL | ($p:pat $t:ty) => {}; //~ERROR `$p:pat` is followed by `$t:ty` | ^^^^^ not allowed after `pat` fragments @@ -79,7 +79,7 @@ LL | ($p:pat $t:ty) => {}; //~ERROR `$p:pat` is followed by `$t:ty` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `$s:stmt`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:27:13 + --> $DIR/macro-follow.rs:18:13 | LL | ($p:pat $s:stmt) => {}; //~ERROR `$p:pat` is followed by `$s:stmt` | ^^^^^^^ not allowed after `pat` fragments @@ -87,7 +87,7 @@ LL | ($p:pat $s:stmt) => {}; //~ERROR `$p:pat` is followed by `$s:stmt` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `$p:path`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:28:13 + --> $DIR/macro-follow.rs:19:13 | LL | ($p:pat $p:path) => {}; //~ERROR `$p:pat` is followed by `$p:path` | ^^^^^^^ not allowed after `pat` fragments @@ -95,7 +95,7 @@ LL | ($p:pat $p:path) => {}; //~ERROR `$p:pat` is followed by `$p:path` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `$b:block`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:29:13 + --> $DIR/macro-follow.rs:20:13 | LL | ($p:pat $b:block) => {}; //~ERROR `$p:pat` is followed by `$b:block` | ^^^^^^^^ not allowed after `pat` fragments @@ -103,7 +103,7 @@ LL | ($p:pat $b:block) => {}; //~ERROR `$p:pat` is followed by `$b:block` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `$i:ident`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:30:13 + --> $DIR/macro-follow.rs:21:13 | LL | ($p:pat $i:ident) => {}; //~ERROR `$p:pat` is followed by `$i:ident` | ^^^^^^^^ not allowed after `pat` fragments @@ -111,7 +111,7 @@ LL | ($p:pat $i:ident) => {}; //~ERROR `$p:pat` is followed by `$i:ident` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `$t:tt`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:31:13 + --> $DIR/macro-follow.rs:22:13 | LL | ($p:pat $t:tt) => {}; //~ERROR `$p:pat` is followed by `$t:tt` | ^^^^^ not allowed after `pat` fragments @@ -119,7 +119,7 @@ LL | ($p:pat $t:tt) => {}; //~ERROR `$p:pat` is followed by `$t:tt` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `$i:item`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:32:13 + --> $DIR/macro-follow.rs:23:13 | LL | ($p:pat $i:item) => {}; //~ERROR `$p:pat` is followed by `$i:item` | ^^^^^^^ not allowed after `pat` fragments @@ -127,7 +127,7 @@ LL | ($p:pat $i:item) => {}; //~ERROR `$p:pat` is followed by `$i:item` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$p:pat` is followed by `$m:meta`, which is not allowed for `pat` fragments - --> $DIR/macro-follow.rs:33:13 + --> $DIR/macro-follow.rs:24:13 | LL | ($p:pat $m:meta) => {}; //~ERROR `$p:pat` is followed by `$m:meta` | ^^^^^^^ not allowed after `pat` fragments @@ -135,7 +135,7 @@ LL | ($p:pat $m:meta) => {}; //~ERROR `$p:pat` is followed by `$m:meta` = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$e:expr` is followed by `(`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:37:15 + --> $DIR/macro-follow.rs:28:15 | LL | ($e:expr ()) => {}; //~ERROR `$e:expr` is followed by `(` | ^ not allowed after `expr` fragments @@ -143,7 +143,7 @@ LL | ($e:expr ()) => {}; //~ERROR `$e:expr` is followed by `(` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `[`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:38:15 + --> $DIR/macro-follow.rs:29:15 | LL | ($e:expr []) => {}; //~ERROR `$e:expr` is followed by `[` | ^ not allowed after `expr` fragments @@ -151,7 +151,7 @@ LL | ($e:expr []) => {}; //~ERROR `$e:expr` is followed by `[` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `{`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:39:15 + --> $DIR/macro-follow.rs:30:15 | LL | ($e:expr {}) => {}; //~ERROR `$e:expr` is followed by `{` | ^ not allowed after `expr` fragments @@ -159,7 +159,7 @@ LL | ($e:expr {}) => {}; //~ERROR `$e:expr` is followed by `{` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `=`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:40:14 + --> $DIR/macro-follow.rs:31:14 | LL | ($e:expr =) => {}; //~ERROR `$e:expr` is followed by `=` | ^ not allowed after `expr` fragments @@ -167,7 +167,7 @@ LL | ($e:expr =) => {}; //~ERROR `$e:expr` is followed by `=` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `|`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:41:14 + --> $DIR/macro-follow.rs:32:14 | LL | ($e:expr |) => {}; //~ERROR `$e:expr` is followed by `|` | ^ not allowed after `expr` fragments @@ -175,7 +175,7 @@ LL | ($e:expr |) => {}; //~ERROR `$e:expr` is followed by `|` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `:`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:42:14 + --> $DIR/macro-follow.rs:33:14 | LL | ($e:expr :) => {}; //~ERROR `$e:expr` is followed by `:` | ^ not allowed after `expr` fragments @@ -183,7 +183,7 @@ LL | ($e:expr :) => {}; //~ERROR `$e:expr` is followed by `:` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `>`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:43:14 + --> $DIR/macro-follow.rs:34:14 | LL | ($e:expr >) => {}; //~ERROR `$e:expr` is followed by `>` | ^ not allowed after `expr` fragments @@ -191,7 +191,7 @@ LL | ($e:expr >) => {}; //~ERROR `$e:expr` is followed by `>` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:44:14 + --> $DIR/macro-follow.rs:35:14 | LL | ($e:expr +) => {}; //~ERROR `$e:expr` is followed by `+` | ^ not allowed after `expr` fragments @@ -199,7 +199,7 @@ LL | ($e:expr +) => {}; //~ERROR `$e:expr` is followed by `+` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `ident`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:45:14 + --> $DIR/macro-follow.rs:36:14 | LL | ($e:expr ident) => {}; //~ERROR `$e:expr` is followed by `ident` | ^^^^^ not allowed after `expr` fragments @@ -207,7 +207,7 @@ LL | ($e:expr ident) => {}; //~ERROR `$e:expr` is followed by `ident` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `if`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:46:14 + --> $DIR/macro-follow.rs:37:14 | LL | ($e:expr if) => {}; //~ERROR `$e:expr` is followed by `if` | ^^ not allowed after `expr` fragments @@ -215,7 +215,7 @@ LL | ($e:expr if) => {}; //~ERROR `$e:expr` is followed by `if` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `in`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:47:14 + --> $DIR/macro-follow.rs:38:14 | LL | ($e:expr in) => {}; //~ERROR `$e:expr` is followed by `in` | ^^ not allowed after `expr` fragments @@ -223,7 +223,7 @@ LL | ($e:expr in) => {}; //~ERROR `$e:expr` is followed by `in` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$p:pat`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:48:14 + --> $DIR/macro-follow.rs:39:14 | LL | ($e:expr $p:pat) => {}; //~ERROR `$e:expr` is followed by `$p:pat` | ^^^^^^ not allowed after `expr` fragments @@ -231,7 +231,7 @@ LL | ($e:expr $p:pat) => {}; //~ERROR `$e:expr` is followed by `$p:pat` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$e:expr`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:49:14 + --> $DIR/macro-follow.rs:40:14 | LL | ($e:expr $e:expr) => {}; //~ERROR `$e:expr` is followed by `$e:expr` | ^^^^^^^ not allowed after `expr` fragments @@ -239,7 +239,7 @@ LL | ($e:expr $e:expr) => {}; //~ERROR `$e:expr` is followed by `$e:expr` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$t:ty`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:50:14 + --> $DIR/macro-follow.rs:41:14 | LL | ($e:expr $t:ty) => {}; //~ERROR `$e:expr` is followed by `$t:ty` | ^^^^^ not allowed after `expr` fragments @@ -247,7 +247,7 @@ LL | ($e:expr $t:ty) => {}; //~ERROR `$e:expr` is followed by `$t:ty` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$s:stmt`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:51:14 + --> $DIR/macro-follow.rs:42:14 | LL | ($e:expr $s:stmt) => {}; //~ERROR `$e:expr` is followed by `$s:stmt` | ^^^^^^^ not allowed after `expr` fragments @@ -255,7 +255,7 @@ LL | ($e:expr $s:stmt) => {}; //~ERROR `$e:expr` is followed by `$s:stmt` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$p:path`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:52:14 + --> $DIR/macro-follow.rs:43:14 | LL | ($e:expr $p:path) => {}; //~ERROR `$e:expr` is followed by `$p:path` | ^^^^^^^ not allowed after `expr` fragments @@ -263,7 +263,7 @@ LL | ($e:expr $p:path) => {}; //~ERROR `$e:expr` is followed by `$p:path` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$b:block`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:53:14 + --> $DIR/macro-follow.rs:44:14 | LL | ($e:expr $b:block) => {}; //~ERROR `$e:expr` is followed by `$b:block` | ^^^^^^^^ not allowed after `expr` fragments @@ -271,7 +271,7 @@ LL | ($e:expr $b:block) => {}; //~ERROR `$e:expr` is followed by `$b:block` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$i:ident`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:54:14 + --> $DIR/macro-follow.rs:45:14 | LL | ($e:expr $i:ident) => {}; //~ERROR `$e:expr` is followed by `$i:ident` | ^^^^^^^^ not allowed after `expr` fragments @@ -279,7 +279,7 @@ LL | ($e:expr $i:ident) => {}; //~ERROR `$e:expr` is followed by `$i:ident` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$t:tt`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:55:14 + --> $DIR/macro-follow.rs:46:14 | LL | ($e:expr $t:tt) => {}; //~ERROR `$e:expr` is followed by `$t:tt` | ^^^^^ not allowed after `expr` fragments @@ -287,7 +287,7 @@ LL | ($e:expr $t:tt) => {}; //~ERROR `$e:expr` is followed by `$t:tt` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$i:item`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:56:14 + --> $DIR/macro-follow.rs:47:14 | LL | ($e:expr $i:item) => {}; //~ERROR `$e:expr` is followed by `$i:item` | ^^^^^^^ not allowed after `expr` fragments @@ -295,7 +295,7 @@ LL | ($e:expr $i:item) => {}; //~ERROR `$e:expr` is followed by `$i:item` = note: allowed there are: `=>`, `,` or `;` error: `$e:expr` is followed by `$m:meta`, which is not allowed for `expr` fragments - --> $DIR/macro-follow.rs:57:14 + --> $DIR/macro-follow.rs:48:14 | LL | ($e:expr $m:meta) => {}; //~ERROR `$e:expr` is followed by `$m:meta` | ^^^^^^^ not allowed after `expr` fragments @@ -303,7 +303,7 @@ LL | ($e:expr $m:meta) => {}; //~ERROR `$e:expr` is followed by `$m:meta` = note: allowed there are: `=>`, `,` or `;` error: `$t:ty` is followed by `(`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:62:13 + --> $DIR/macro-follow.rs:53:13 | LL | ($t:ty ()) => {}; //~ERROR `$t:ty` is followed by `(` | ^ not allowed after `ty` fragments @@ -311,7 +311,7 @@ LL | ($t:ty ()) => {}; //~ERROR `$t:ty` is followed by `(` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `+`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:64:12 + --> $DIR/macro-follow.rs:55:12 | LL | ($t:ty +) => {}; //~ERROR `$t:ty` is followed by `+` | ^ not allowed after `ty` fragments @@ -319,7 +319,7 @@ LL | ($t:ty +) => {}; //~ERROR `$t:ty` is followed by `+` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `ident`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:65:12 + --> $DIR/macro-follow.rs:56:12 | LL | ($t:ty ident) => {}; //~ERROR `$t:ty` is followed by `ident` | ^^^^^ not allowed after `ty` fragments @@ -327,7 +327,7 @@ LL | ($t:ty ident) => {}; //~ERROR `$t:ty` is followed by `ident` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `if`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:66:12 + --> $DIR/macro-follow.rs:57:12 | LL | ($t:ty if) => {}; //~ERROR `$t:ty` is followed by `if` | ^^ not allowed after `ty` fragments @@ -335,7 +335,7 @@ LL | ($t:ty if) => {}; //~ERROR `$t:ty` is followed by `if` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$p:pat`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:67:12 + --> $DIR/macro-follow.rs:58:12 | LL | ($t:ty $p:pat) => {}; //~ERROR `$t:ty` is followed by `$p:pat` | ^^^^^^ not allowed after `ty` fragments @@ -343,7 +343,7 @@ LL | ($t:ty $p:pat) => {}; //~ERROR `$t:ty` is followed by `$p:pat` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$e:expr`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:68:12 + --> $DIR/macro-follow.rs:59:12 | LL | ($t:ty $e:expr) => {}; //~ERROR `$t:ty` is followed by `$e:expr` | ^^^^^^^ not allowed after `ty` fragments @@ -351,7 +351,7 @@ LL | ($t:ty $e:expr) => {}; //~ERROR `$t:ty` is followed by `$e:expr` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$t:ty`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:69:12 + --> $DIR/macro-follow.rs:60:12 | LL | ($t:ty $t:ty) => {}; //~ERROR `$t:ty` is followed by `$t:ty` | ^^^^^ not allowed after `ty` fragments @@ -359,7 +359,7 @@ LL | ($t:ty $t:ty) => {}; //~ERROR `$t:ty` is followed by `$t:ty` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$s:stmt`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:70:12 + --> $DIR/macro-follow.rs:61:12 | LL | ($t:ty $s:stmt) => {}; //~ERROR `$t:ty` is followed by `$s:stmt` | ^^^^^^^ not allowed after `ty` fragments @@ -367,7 +367,7 @@ LL | ($t:ty $s:stmt) => {}; //~ERROR `$t:ty` is followed by `$s:stmt` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$p:path`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:71:12 + --> $DIR/macro-follow.rs:62:12 | LL | ($t:ty $p:path) => {}; //~ERROR `$t:ty` is followed by `$p:path` | ^^^^^^^ not allowed after `ty` fragments @@ -375,7 +375,7 @@ LL | ($t:ty $p:path) => {}; //~ERROR `$t:ty` is followed by `$p:path` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$i:ident`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:73:12 + --> $DIR/macro-follow.rs:64:12 | LL | ($t:ty $i:ident) => {}; //~ERROR `$t:ty` is followed by `$i:ident` | ^^^^^^^^ not allowed after `ty` fragments @@ -383,7 +383,7 @@ LL | ($t:ty $i:ident) => {}; //~ERROR `$t:ty` is followed by `$i:ident` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$t:tt`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:74:12 + --> $DIR/macro-follow.rs:65:12 | LL | ($t:ty $t:tt) => {}; //~ERROR `$t:ty` is followed by `$t:tt` | ^^^^^ not allowed after `ty` fragments @@ -391,7 +391,7 @@ LL | ($t:ty $t:tt) => {}; //~ERROR `$t:ty` is followed by `$t:tt` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$i:item`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:75:12 + --> $DIR/macro-follow.rs:66:12 | LL | ($t:ty $i:item) => {}; //~ERROR `$t:ty` is followed by `$i:item` | ^^^^^^^ not allowed after `ty` fragments @@ -399,7 +399,7 @@ LL | ($t:ty $i:item) => {}; //~ERROR `$t:ty` is followed by `$i:item` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$t:ty` is followed by `$m:meta`, which is not allowed for `ty` fragments - --> $DIR/macro-follow.rs:76:12 + --> $DIR/macro-follow.rs:67:12 | LL | ($t:ty $m:meta) => {}; //~ERROR `$t:ty` is followed by `$m:meta` | ^^^^^^^ not allowed after `ty` fragments @@ -407,7 +407,7 @@ LL | ($t:ty $m:meta) => {}; //~ERROR `$t:ty` is followed by `$m:meta` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$s:stmt` is followed by `(`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:80:15 + --> $DIR/macro-follow.rs:71:15 | LL | ($s:stmt ()) => {}; //~ERROR `$s:stmt` is followed by `(` | ^ not allowed after `stmt` fragments @@ -415,7 +415,7 @@ LL | ($s:stmt ()) => {}; //~ERROR `$s:stmt` is followed by `(` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `[`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:81:15 + --> $DIR/macro-follow.rs:72:15 | LL | ($s:stmt []) => {}; //~ERROR `$s:stmt` is followed by `[` | ^ not allowed after `stmt` fragments @@ -423,7 +423,7 @@ LL | ($s:stmt []) => {}; //~ERROR `$s:stmt` is followed by `[` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `{`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:82:15 + --> $DIR/macro-follow.rs:73:15 | LL | ($s:stmt {}) => {}; //~ERROR `$s:stmt` is followed by `{` | ^ not allowed after `stmt` fragments @@ -431,7 +431,7 @@ LL | ($s:stmt {}) => {}; //~ERROR `$s:stmt` is followed by `{` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `=`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:83:14 + --> $DIR/macro-follow.rs:74:14 | LL | ($s:stmt =) => {}; //~ERROR `$s:stmt` is followed by `=` | ^ not allowed after `stmt` fragments @@ -439,7 +439,7 @@ LL | ($s:stmt =) => {}; //~ERROR `$s:stmt` is followed by `=` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `|`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:84:14 + --> $DIR/macro-follow.rs:75:14 | LL | ($s:stmt |) => {}; //~ERROR `$s:stmt` is followed by `|` | ^ not allowed after `stmt` fragments @@ -447,7 +447,7 @@ LL | ($s:stmt |) => {}; //~ERROR `$s:stmt` is followed by `|` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `:`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:85:14 + --> $DIR/macro-follow.rs:76:14 | LL | ($s:stmt :) => {}; //~ERROR `$s:stmt` is followed by `:` | ^ not allowed after `stmt` fragments @@ -455,7 +455,7 @@ LL | ($s:stmt :) => {}; //~ERROR `$s:stmt` is followed by `:` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `>`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:86:14 + --> $DIR/macro-follow.rs:77:14 | LL | ($s:stmt >) => {}; //~ERROR `$s:stmt` is followed by `>` | ^ not allowed after `stmt` fragments @@ -463,7 +463,7 @@ LL | ($s:stmt >) => {}; //~ERROR `$s:stmt` is followed by `>` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `+`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:87:14 + --> $DIR/macro-follow.rs:78:14 | LL | ($s:stmt +) => {}; //~ERROR `$s:stmt` is followed by `+` | ^ not allowed after `stmt` fragments @@ -471,7 +471,7 @@ LL | ($s:stmt +) => {}; //~ERROR `$s:stmt` is followed by `+` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `ident`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:88:14 + --> $DIR/macro-follow.rs:79:14 | LL | ($s:stmt ident) => {}; //~ERROR `$s:stmt` is followed by `ident` | ^^^^^ not allowed after `stmt` fragments @@ -479,7 +479,7 @@ LL | ($s:stmt ident) => {}; //~ERROR `$s:stmt` is followed by `ident` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `if`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:89:14 + --> $DIR/macro-follow.rs:80:14 | LL | ($s:stmt if) => {}; //~ERROR `$s:stmt` is followed by `if` | ^^ not allowed after `stmt` fragments @@ -487,7 +487,7 @@ LL | ($s:stmt if) => {}; //~ERROR `$s:stmt` is followed by `if` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `in`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:90:14 + --> $DIR/macro-follow.rs:81:14 | LL | ($s:stmt in) => {}; //~ERROR `$s:stmt` is followed by `in` | ^^ not allowed after `stmt` fragments @@ -495,7 +495,7 @@ LL | ($s:stmt in) => {}; //~ERROR `$s:stmt` is followed by `in` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$p:pat`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:91:14 + --> $DIR/macro-follow.rs:82:14 | LL | ($s:stmt $p:pat) => {}; //~ERROR `$s:stmt` is followed by `$p:pat` | ^^^^^^ not allowed after `stmt` fragments @@ -503,7 +503,7 @@ LL | ($s:stmt $p:pat) => {}; //~ERROR `$s:stmt` is followed by `$p:pat` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$e:expr`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:92:14 + --> $DIR/macro-follow.rs:83:14 | LL | ($s:stmt $e:expr) => {}; //~ERROR `$s:stmt` is followed by `$e:expr` | ^^^^^^^ not allowed after `stmt` fragments @@ -511,7 +511,7 @@ LL | ($s:stmt $e:expr) => {}; //~ERROR `$s:stmt` is followed by `$e:expr` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$t:ty`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:93:14 + --> $DIR/macro-follow.rs:84:14 | LL | ($s:stmt $t:ty) => {}; //~ERROR `$s:stmt` is followed by `$t:ty` | ^^^^^ not allowed after `stmt` fragments @@ -519,7 +519,7 @@ LL | ($s:stmt $t:ty) => {}; //~ERROR `$s:stmt` is followed by `$t:ty` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$s:stmt`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:94:14 + --> $DIR/macro-follow.rs:85:14 | LL | ($s:stmt $s:stmt) => {}; //~ERROR `$s:stmt` is followed by `$s:stmt` | ^^^^^^^ not allowed after `stmt` fragments @@ -527,7 +527,7 @@ LL | ($s:stmt $s:stmt) => {}; //~ERROR `$s:stmt` is followed by `$s:stmt` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$p:path`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:95:14 + --> $DIR/macro-follow.rs:86:14 | LL | ($s:stmt $p:path) => {}; //~ERROR `$s:stmt` is followed by `$p:path` | ^^^^^^^ not allowed after `stmt` fragments @@ -535,7 +535,7 @@ LL | ($s:stmt $p:path) => {}; //~ERROR `$s:stmt` is followed by `$p:path` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$b:block`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:96:14 + --> $DIR/macro-follow.rs:87:14 | LL | ($s:stmt $b:block) => {}; //~ERROR `$s:stmt` is followed by `$b:block` | ^^^^^^^^ not allowed after `stmt` fragments @@ -543,7 +543,7 @@ LL | ($s:stmt $b:block) => {}; //~ERROR `$s:stmt` is followed by `$b:block` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$i:ident`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:97:14 + --> $DIR/macro-follow.rs:88:14 | LL | ($s:stmt $i:ident) => {}; //~ERROR `$s:stmt` is followed by `$i:ident` | ^^^^^^^^ not allowed after `stmt` fragments @@ -551,7 +551,7 @@ LL | ($s:stmt $i:ident) => {}; //~ERROR `$s:stmt` is followed by `$i:ident` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$t:tt`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:98:14 + --> $DIR/macro-follow.rs:89:14 | LL | ($s:stmt $t:tt) => {}; //~ERROR `$s:stmt` is followed by `$t:tt` | ^^^^^ not allowed after `stmt` fragments @@ -559,7 +559,7 @@ LL | ($s:stmt $t:tt) => {}; //~ERROR `$s:stmt` is followed by `$t:tt` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$i:item`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:99:14 + --> $DIR/macro-follow.rs:90:14 | LL | ($s:stmt $i:item) => {}; //~ERROR `$s:stmt` is followed by `$i:item` | ^^^^^^^ not allowed after `stmt` fragments @@ -567,7 +567,7 @@ LL | ($s:stmt $i:item) => {}; //~ERROR `$s:stmt` is followed by `$i:item` = note: allowed there are: `=>`, `,` or `;` error: `$s:stmt` is followed by `$m:meta`, which is not allowed for `stmt` fragments - --> $DIR/macro-follow.rs:100:14 + --> $DIR/macro-follow.rs:91:14 | LL | ($s:stmt $m:meta) => {}; //~ERROR `$s:stmt` is followed by `$m:meta` | ^^^^^^^ not allowed after `stmt` fragments @@ -575,7 +575,7 @@ LL | ($s:stmt $m:meta) => {}; //~ERROR `$s:stmt` is followed by `$m:meta` = note: allowed there are: `=>`, `,` or `;` error: `$p:path` is followed by `(`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:104:15 + --> $DIR/macro-follow.rs:95:15 | LL | ($p:path ()) => {}; //~ERROR `$p:path` is followed by `(` | ^ not allowed after `path` fragments @@ -583,7 +583,7 @@ LL | ($p:path ()) => {}; //~ERROR `$p:path` is followed by `(` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `+`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:106:14 + --> $DIR/macro-follow.rs:97:14 | LL | ($p:path +) => {}; //~ERROR `$p:path` is followed by `+` | ^ not allowed after `path` fragments @@ -591,7 +591,7 @@ LL | ($p:path +) => {}; //~ERROR `$p:path` is followed by `+` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `ident`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:107:14 + --> $DIR/macro-follow.rs:98:14 | LL | ($p:path ident) => {}; //~ERROR `$p:path` is followed by `ident` | ^^^^^ not allowed after `path` fragments @@ -599,7 +599,7 @@ LL | ($p:path ident) => {}; //~ERROR `$p:path` is followed by `ident` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `if`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:108:14 + --> $DIR/macro-follow.rs:99:14 | LL | ($p:path if) => {}; //~ERROR `$p:path` is followed by `if` | ^^ not allowed after `path` fragments @@ -607,7 +607,7 @@ LL | ($p:path if) => {}; //~ERROR `$p:path` is followed by `if` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$p:pat`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:109:14 + --> $DIR/macro-follow.rs:100:14 | LL | ($p:path $p:pat) => {}; //~ERROR `$p:path` is followed by `$p:pat` | ^^^^^^ not allowed after `path` fragments @@ -615,7 +615,7 @@ LL | ($p:path $p:pat) => {}; //~ERROR `$p:path` is followed by `$p:pat` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$e:expr`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:110:14 + --> $DIR/macro-follow.rs:101:14 | LL | ($p:path $e:expr) => {}; //~ERROR `$p:path` is followed by `$e:expr` | ^^^^^^^ not allowed after `path` fragments @@ -623,7 +623,7 @@ LL | ($p:path $e:expr) => {}; //~ERROR `$p:path` is followed by `$e:expr` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$t:ty`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:111:14 + --> $DIR/macro-follow.rs:102:14 | LL | ($p:path $t:ty) => {}; //~ERROR `$p:path` is followed by `$t:ty` | ^^^^^ not allowed after `path` fragments @@ -631,7 +631,7 @@ LL | ($p:path $t:ty) => {}; //~ERROR `$p:path` is followed by `$t:ty` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$s:stmt`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:112:14 + --> $DIR/macro-follow.rs:103:14 | LL | ($p:path $s:stmt) => {}; //~ERROR `$p:path` is followed by `$s:stmt` | ^^^^^^^ not allowed after `path` fragments @@ -639,7 +639,7 @@ LL | ($p:path $s:stmt) => {}; //~ERROR `$p:path` is followed by `$s:stmt` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$p:path`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:113:14 + --> $DIR/macro-follow.rs:104:14 | LL | ($p:path $p:path) => {}; //~ERROR `$p:path` is followed by `$p:path` | ^^^^^^^ not allowed after `path` fragments @@ -647,7 +647,7 @@ LL | ($p:path $p:path) => {}; //~ERROR `$p:path` is followed by `$p:path` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$i:ident`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:115:14 + --> $DIR/macro-follow.rs:106:14 | LL | ($p:path $i:ident) => {}; //~ERROR `$p:path` is followed by `$i:ident` | ^^^^^^^^ not allowed after `path` fragments @@ -655,7 +655,7 @@ LL | ($p:path $i:ident) => {}; //~ERROR `$p:path` is followed by `$i:ident` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$t:tt`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:116:14 + --> $DIR/macro-follow.rs:107:14 | LL | ($p:path $t:tt) => {}; //~ERROR `$p:path` is followed by `$t:tt` | ^^^^^ not allowed after `path` fragments @@ -663,7 +663,7 @@ LL | ($p:path $t:tt) => {}; //~ERROR `$p:path` is followed by `$t:tt` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$i:item`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:117:14 + --> $DIR/macro-follow.rs:108:14 | LL | ($p:path $i:item) => {}; //~ERROR `$p:path` is followed by `$i:item` | ^^^^^^^ not allowed after `path` fragments @@ -671,7 +671,7 @@ LL | ($p:path $i:item) => {}; //~ERROR `$p:path` is followed by `$i:item` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$p:path` is followed by `$m:meta`, which is not allowed for `path` fragments - --> $DIR/macro-follow.rs:118:14 + --> $DIR/macro-follow.rs:109:14 | LL | ($p:path $m:meta) => {}; //~ERROR `$p:path` is followed by `$m:meta` | ^^^^^^^ not allowed after `path` fragments diff --git a/src/test/ui/macros/macro-followed-by-seq-bad.rs b/src/test/ui/macros/macro-followed-by-seq-bad.rs index 21cc946ded6..b73742f77ea 100644 --- a/src/test/ui/macros/macro-followed-by-seq-bad.rs +++ b/src/test/ui/macros/macro-followed-by-seq-bad.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #25436: check that things which can be // followed by any token also permit X* to come afterwards. diff --git a/src/test/ui/macros/macro-followed-by-seq-bad.stderr b/src/test/ui/macros/macro-followed-by-seq-bad.stderr index 2ad8990e115..18403fd248d 100644 --- a/src/test/ui/macros/macro-followed-by-seq-bad.stderr +++ b/src/test/ui/macros/macro-followed-by-seq-bad.stderr @@ -1,5 +1,5 @@ error: `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments - --> $DIR/macro-followed-by-seq-bad.rs:17:15 + --> $DIR/macro-followed-by-seq-bad.rs:7:15 | LL | ( $a:expr $($b:tt)* ) => { }; //~ ERROR not allowed for `expr` fragments | ^^^^^ not allowed after `expr` fragments @@ -7,7 +7,7 @@ LL | ( $a:expr $($b:tt)* ) => { }; //~ ERROR not allowed for `expr` fragments = note: allowed there are: `=>`, `,` or `;` error: `$a:ty` is followed by `$b:tt`, which is not allowed for `ty` fragments - --> $DIR/macro-followed-by-seq-bad.rs:18:13 + --> $DIR/macro-followed-by-seq-bad.rs:8:13 | LL | ( $a:ty $($b:tt)* ) => { }; //~ ERROR not allowed for `ty` fragments | ^^^^^ not allowed after `ty` fragments diff --git a/src/test/ui/macros/macro-in-expression-context-2.rs b/src/test/ui/macros/macro-in-expression-context-2.rs index cf8572aefa2..9423f0a359c 100644 --- a/src/test/ui/macros/macro-in-expression-context-2.rs +++ b/src/test/ui/macros/macro-in-expression-context-2.rs @@ -3,5 +3,6 @@ macro_rules! empty { () => () } fn main() { match 42 { _ => { empty!() } +//~^ ERROR macro expansion ends with an incomplete expression }; } diff --git a/src/test/ui/macros/macro-in-expression-context-2.stderr b/src/test/ui/macros/macro-in-expression-context-2.stderr index 80d5dbd66cc..672871c49ca 100644 --- a/src/test/ui/macros/macro-in-expression-context-2.stderr +++ b/src/test/ui/macros/macro-in-expression-context-2.stderr @@ -1,8 +1,11 @@ -error: expected expression, found `` +error: macro expansion ends with an incomplete expression: expected expression --> $DIR/macro-in-expression-context-2.rs:5:16 | +LL | macro_rules! empty { () => () } + | -- in this macro arm +... LL | _ => { empty!() } - | ^^^^^^^^ + | ^^^^^^^^ expected expression error: aborting due to previous error diff --git a/src/test/ui/macros/macro-inner-attributes.rs b/src/test/ui/macros/macro-inner-attributes.rs index 2a58fd55453..268ddda1b3c 100644 --- a/src/test/ui/macros/macro-inner-attributes.rs +++ b/src/test/ui/macros/macro-inner-attributes.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(custom_attribute)] macro_rules! test { ($nm:ident, diff --git a/src/test/ui/macros/macro-inner-attributes.stderr b/src/test/ui/macros/macro-inner-attributes.stderr index 47d9469779b..5e20f106a95 100644 --- a/src/test/ui/macros/macro-inner-attributes.stderr +++ b/src/test/ui/macros/macro-inner-attributes.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: use of undeclared type or module `a` - --> $DIR/macro-inner-attributes.rs:27:5 + --> $DIR/macro-inner-attributes.rs:17:5 | LL | a::bar(); | ^ use of undeclared type or module `a` diff --git a/src/test/ui/macros/macro-input-future-proofing.rs b/src/test/ui/macros/macro-input-future-proofing.rs index e5fdba63b0f..9a5bdb08a8e 100644 --- a/src/test/ui/macros/macro-input-future-proofing.rs +++ b/src/test/ui/macros/macro-input-future-proofing.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_macros)] macro_rules! errors_everywhere { diff --git a/src/test/ui/macros/macro-input-future-proofing.stderr b/src/test/ui/macros/macro-input-future-proofing.stderr index 4bb46e39562..fa39fc6a212 100644 --- a/src/test/ui/macros/macro-input-future-proofing.stderr +++ b/src/test/ui/macros/macro-input-future-proofing.stderr @@ -1,5 +1,5 @@ error: `$ty:ty` is followed by `<`, which is not allowed for `ty` fragments - --> $DIR/macro-input-future-proofing.rs:14:13 + --> $DIR/macro-input-future-proofing.rs:4:13 | LL | ($ty:ty <) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty` | ^ not allowed after `ty` fragments @@ -7,7 +7,7 @@ LL | ($ty:ty <) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not a = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$ty:ty` is followed by `<`, which is not allowed for `ty` fragments - --> $DIR/macro-input-future-proofing.rs:15:13 + --> $DIR/macro-input-future-proofing.rs:5:13 | LL | ($ty:ty < foo ,) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty` | ^ not allowed after `ty` fragments @@ -15,7 +15,7 @@ LL | ($ty:ty < foo ,) => (); //~ ERROR `$ty:ty` is followed by `<`, which is = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$pa:pat` is followed by `>`, which is not allowed for `pat` fragments - --> $DIR/macro-input-future-proofing.rs:21:14 + --> $DIR/macro-input-future-proofing.rs:11:14 | LL | ($pa:pat >) => (); //~ ERROR `$pa:pat` is followed by `>`, which is not allowed for `pat` | ^ not allowed after `pat` fragments @@ -23,7 +23,7 @@ LL | ($pa:pat >) => (); //~ ERROR `$pa:pat` is followed by `>`, which is not = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$pa:pat` is followed by `$pb:pat`, which is not allowed for `pat` fragments - --> $DIR/macro-input-future-proofing.rs:23:14 + --> $DIR/macro-input-future-proofing.rs:13:14 | LL | ($pa:pat $pb:pat $ty:ty ,) => (); | ^^^^^^^ not allowed after `pat` fragments @@ -31,7 +31,7 @@ LL | ($pa:pat $pb:pat $ty:ty ,) => (); = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$pb:pat` is followed by `$ty:ty`, which is not allowed for `pat` fragments - --> $DIR/macro-input-future-proofing.rs:23:22 + --> $DIR/macro-input-future-proofing.rs:13:22 | LL | ($pa:pat $pb:pat $ty:ty ,) => (); | ^^^^^^ not allowed after `pat` fragments @@ -39,7 +39,7 @@ LL | ($pa:pat $pb:pat $ty:ty ,) => (); = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` error: `$ty:ty` is followed by `-`, which is not allowed for `ty` fragments - --> $DIR/macro-input-future-proofing.rs:26:17 + --> $DIR/macro-input-future-proofing.rs:16:17 | LL | ($($ty:ty)* -) => (); //~ ERROR `$ty:ty` is followed by `-` | ^ not allowed after `ty` fragments @@ -47,7 +47,7 @@ LL | ($($ty:ty)* -) => (); //~ ERROR `$ty:ty` is followed by `-` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$b:ty` is followed by `-`, which is not allowed for `ty` fragments - --> $DIR/macro-input-future-proofing.rs:27:23 + --> $DIR/macro-input-future-proofing.rs:17:23 | LL | ($($a:ty, $b:ty)* -) => (); //~ ERROR `$b:ty` is followed by `-` | ^ not allowed after `ty` fragments @@ -55,7 +55,7 @@ LL | ($($a:ty, $b:ty)* -) => (); //~ ERROR `$b:ty` is followed by `-` = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$ty:ty` is followed by `-`, which is not allowed for `ty` fragments - --> $DIR/macro-input-future-proofing.rs:28:7 + --> $DIR/macro-input-future-proofing.rs:18:7 | LL | ($($ty:ty)-+) => (); //~ ERROR `$ty:ty` is followed by `-`, which is not allowed for `ty` | ^^^^^^^^ not allowed after `ty` fragments @@ -63,7 +63,7 @@ LL | ($($ty:ty)-+) => (); //~ ERROR `$ty:ty` is followed by `-`, which is no = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` error: `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments - --> $DIR/macro-input-future-proofing.rs:29:21 + --> $DIR/macro-input-future-proofing.rs:19:21 | LL | ( $($a:expr)* $($b:tt)* ) => { }; | ^^^^^ not allowed after `expr` fragments diff --git a/src/test/ui/macros/macro-invalid-fragment-spec.rs b/src/test/ui/macros/macro-invalid-fragment-spec.rs index 630e481f75e..dc4d75096af 100644 --- a/src/test/ui/macros/macro-invalid-fragment-spec.rs +++ b/src/test/ui/macros/macro-invalid-fragment-spec.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo( ($x:foo) => () //~^ ERROR invalid fragment specifier diff --git a/src/test/ui/macros/macro-invalid-fragment-spec.stderr b/src/test/ui/macros/macro-invalid-fragment-spec.stderr index e683d47cf54..b0473448265 100644 --- a/src/test/ui/macros/macro-invalid-fragment-spec.stderr +++ b/src/test/ui/macros/macro-invalid-fragment-spec.stderr @@ -1,5 +1,5 @@ error: invalid fragment specifier `foo` - --> $DIR/macro-invalid-fragment-spec.rs:12:6 + --> $DIR/macro-invalid-fragment-spec.rs:2:6 | LL | ($x:foo) => () | ^^^^^^ diff --git a/src/test/ui/macros/macro-local-data-key-priv.rs b/src/test/ui/macros/macro-local-data-key-priv.rs index 3ae629cd895..2e4f88f9aa9 100644 --- a/src/test/ui/macros/macro-local-data-key-priv.rs +++ b/src/test/ui/macros/macro-local-data-key-priv.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that the local data keys are private by default. mod bar { diff --git a/src/test/ui/macros/macro-local-data-key-priv.stderr b/src/test/ui/macros/macro-local-data-key-priv.stderr index b5ad50fbeba..9b44421808e 100644 --- a/src/test/ui/macros/macro-local-data-key-priv.stderr +++ b/src/test/ui/macros/macro-local-data-key-priv.stderr @@ -1,5 +1,5 @@ error[E0603]: constant `baz` is private - --> $DIR/macro-local-data-key-priv.rs:18:10 + --> $DIR/macro-local-data-key-priv.rs:8:10 | LL | bar::baz.with(|_| ()); | ^^^ diff --git a/src/test/ui/macros/macro-match-nonterminal.rs b/src/test/ui/macros/macro-match-nonterminal.rs index 6cca729e2c2..6d4b32c9bc9 100644 --- a/src/test/ui/macros/macro-match-nonterminal.rs +++ b/src/test/ui/macros/macro-match-nonterminal.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! test { ($a, $b) => (()); } //~ ERROR missing fragment fn main() { diff --git a/src/test/ui/macros/macro-match-nonterminal.stderr b/src/test/ui/macros/macro-match-nonterminal.stderr index 26648c443cb..15eafbde0a2 100644 --- a/src/test/ui/macros/macro-match-nonterminal.stderr +++ b/src/test/ui/macros/macro-match-nonterminal.stderr @@ -1,5 +1,5 @@ error: missing fragment specifier - --> $DIR/macro-match-nonterminal.rs:11:24 + --> $DIR/macro-match-nonterminal.rs:1:24 | LL | macro_rules! test { ($a, $b) => (()); } //~ ERROR missing fragment | ^ diff --git a/src/test/ui/macros/macro-missing-delimiters.rs b/src/test/ui/macros/macro-missing-delimiters.rs index eed2a207e89..290d7615e60 100644 --- a/src/test/ui/macros/macro-missing-delimiters.rs +++ b/src/test/ui/macros/macro-missing-delimiters.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! baz( baz => () //~ ERROR invalid macro matcher; ); diff --git a/src/test/ui/macros/macro-missing-delimiters.stderr b/src/test/ui/macros/macro-missing-delimiters.stderr index eb43e39ea56..63cf1826f77 100644 --- a/src/test/ui/macros/macro-missing-delimiters.stderr +++ b/src/test/ui/macros/macro-missing-delimiters.stderr @@ -1,5 +1,5 @@ error: invalid macro matcher; matchers must be contained in balanced delimiters - --> $DIR/macro-missing-delimiters.rs:12:5 + --> $DIR/macro-missing-delimiters.rs:2:5 | LL | baz => () //~ ERROR invalid macro matcher; | ^^^ diff --git a/src/test/ui/macros/macro-missing-fragment.rs b/src/test/ui/macros/macro-missing-fragment.rs index 66f4ce55be8..1d0b0889b4c 100644 --- a/src/test/ui/macros/macro-missing-fragment.rs +++ b/src/test/ui/macros/macro-missing-fragment.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! m { ( $( any_token $field_rust_type )* ) => {}; //~ ERROR missing fragment } diff --git a/src/test/ui/macros/macro-missing-fragment.stderr b/src/test/ui/macros/macro-missing-fragment.stderr index 48e07ed9dbd..8c4026760ca 100644 --- a/src/test/ui/macros/macro-missing-fragment.stderr +++ b/src/test/ui/macros/macro-missing-fragment.stderr @@ -1,5 +1,5 @@ error: missing fragment specifier - --> $DIR/macro-missing-fragment.rs:12:20 + --> $DIR/macro-missing-fragment.rs:2:20 | LL | ( $( any_token $field_rust_type )* ) => {}; //~ ERROR missing fragment | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/macros/macro-name-typo.rs b/src/test/ui/macros/macro-name-typo.rs index 7fadbf2a90b..1ddc419d302 100644 --- a/src/test/ui/macros/macro-name-typo.rs +++ b/src/test/ui/macros/macro-name-typo.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { printlx!("oh noes!"); //~ ERROR cannot find } diff --git a/src/test/ui/macros/macro-name-typo.stderr b/src/test/ui/macros/macro-name-typo.stderr index 4152d2eb96e..5af9828fd98 100644 --- a/src/test/ui/macros/macro-name-typo.stderr +++ b/src/test/ui/macros/macro-name-typo.stderr @@ -1,5 +1,5 @@ error: cannot find macro `printlx!` in this scope - --> $DIR/macro-name-typo.rs:12:5 + --> $DIR/macro-name-typo.rs:2:5 | LL | printlx!("oh noes!"); //~ ERROR cannot find | ^^^^^^^ help: you could try the macro: `println` diff --git a/src/test/ui/macros/macro-non-lifetime.rs b/src/test/ui/macros/macro-non-lifetime.rs index 647d7aaa759..c74aaf42bf2 100644 --- a/src/test/ui/macros/macro-non-lifetime.rs +++ b/src/test/ui/macros/macro-non-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for issue #50381: non-lifetime passed to :lifetime. #![feature(macro_lifetime_matcher)] diff --git a/src/test/ui/macros/macro-non-lifetime.stderr b/src/test/ui/macros/macro-non-lifetime.stderr index d526023d441..2cf1a792f9f 100644 --- a/src/test/ui/macros/macro-non-lifetime.stderr +++ b/src/test/ui/macros/macro-non-lifetime.stderr @@ -1,11 +1,11 @@ error: no rules expected the token `a` - --> $DIR/macro-non-lifetime.rs:18:8 + --> $DIR/macro-non-lifetime.rs:8:8 | LL | macro_rules! m { ($x:lifetime) => { } } | -------------- when calling this macro ... LL | m!(a); - | ^ no rules expected the token `a` + | ^ no rules expected this token in macro call error: aborting due to previous error diff --git a/src/test/ui/macros/macro-outer-attributes.rs b/src/test/ui/macros/macro-outer-attributes.rs index acb58596fe4..aa70060425f 100644 --- a/src/test/ui/macros/macro-outer-attributes.rs +++ b/src/test/ui/macros/macro-outer-attributes.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(custom_attribute)] macro_rules! test { ($nm:ident, diff --git a/src/test/ui/macros/macro-outer-attributes.stderr b/src/test/ui/macros/macro-outer-attributes.stderr index 4cc8cd5dc90..f9413250076 100644 --- a/src/test/ui/macros/macro-outer-attributes.stderr +++ b/src/test/ui/macros/macro-outer-attributes.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find function `bar` in module `a` - --> $DIR/macro-outer-attributes.rs:28:8 + --> $DIR/macro-outer-attributes.rs:18:8 | LL | a::bar(); //~ ERROR cannot find function `bar` in module `a` | ^^^ not found in `a` diff --git a/src/test/ui/macros/macro-parameter-span.rs b/src/test/ui/macros/macro-parameter-span.rs index 3b168fec953..5609f84e141 100644 --- a/src/test/ui/macros/macro-parameter-span.rs +++ b/src/test/ui/macros/macro-parameter-span.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo { ($id: ident) => { $id diff --git a/src/test/ui/macros/macro-parameter-span.stderr b/src/test/ui/macros/macro-parameter-span.stderr index 749221e9bf0..c7dcb12d3d1 100644 --- a/src/test/ui/macros/macro-parameter-span.stderr +++ b/src/test/ui/macros/macro-parameter-span.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `x` in this scope - --> $DIR/macro-parameter-span.rs:21:9 + --> $DIR/macro-parameter-span.rs:11:9 | LL | x //~ ERROR cannot find value `x` in this scope | ^ not found in this scope diff --git a/src/test/ui/macros/macro-path-prelude-fail-1.rs b/src/test/ui/macros/macro-path-prelude-fail-1.rs index bdf3ac0f69f..354c2bf8571 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-1.rs +++ b/src/test/ui/macros/macro-path-prelude-fail-1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(extern_prelude)] mod m { diff --git a/src/test/ui/macros/macro-path-prelude-fail-1.stderr b/src/test/ui/macros/macro-path-prelude-fail-1.stderr index 590e4f0fd06..4bf51bd893a 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-1.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-1.stderr @@ -1,11 +1,11 @@ error[E0433]: failed to resolve: not a module `Vec` - --> $DIR/macro-path-prelude-fail-1.rs:15:9 + --> $DIR/macro-path-prelude-fail-1.rs:5:9 | LL | Vec::clone!(); //~ ERROR failed to resolve: not a module `Vec` | ^^^ not a module `Vec` error[E0433]: failed to resolve: not a module `u8` - --> $DIR/macro-path-prelude-fail-1.rs:16:9 + --> $DIR/macro-path-prelude-fail-1.rs:6:9 | LL | u8::clone!(); //~ ERROR failed to resolve: not a module `u8` | ^^ not a module `u8` diff --git a/src/test/ui/macros/macro-path-prelude-fail-2.rs b/src/test/ui/macros/macro-path-prelude-fail-2.rs index e27c061e195..816a3c4ccc0 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-2.rs +++ b/src/test/ui/macros/macro-path-prelude-fail-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod m { fn check() { Result::Ok!(); //~ ERROR failed to resolve: partially resolved path in a macro diff --git a/src/test/ui/macros/macro-path-prelude-fail-2.stderr b/src/test/ui/macros/macro-path-prelude-fail-2.stderr index cf123f43fea..6b1a5b3741a 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-2.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-2.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: partially resolved path in a macro - --> $DIR/macro-path-prelude-fail-2.rs:13:9 + --> $DIR/macro-path-prelude-fail-2.rs:3:9 | LL | Result::Ok!(); //~ ERROR failed to resolve: partially resolved path in a macro | ^^^^^^^^^^ partially resolved path in a macro diff --git a/src/test/ui/macros/macro-path-prelude-pass.rs b/src/test/ui/macros/macro-path-prelude-pass.rs index 1f281d4a686..3d35d53f777 100644 --- a/src/test/ui/macros/macro-path-prelude-pass.rs +++ b/src/test/ui/macros/macro-path-prelude-pass.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(extern_prelude)] diff --git a/src/test/ui/macros/macro-path-prelude-pass.stderr b/src/test/ui/macros/macro-path-prelude-pass.stderr index edae6a3e3cd..3744e0198b4 100644 --- a/src/test/ui/macros/macro-path-prelude-pass.stderr +++ b/src/test/ui/macros/macro-path-prelude-pass.stderr @@ -1,5 +1,5 @@ warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/macro-path-prelude-pass.rs:13:12 + --> $DIR/macro-path-prelude-pass.rs:3:12 | LL | #![feature(extern_prelude)] | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/macros/macro-path-prelude-shadowing.rs b/src/test/ui/macros/macro-path-prelude-shadowing.rs index 6831cd81d7d..600b55c64d4 100644 --- a/src/test/ui/macros/macro-path-prelude-shadowing.rs +++ b/src/test/ui/macros/macro-path-prelude-shadowing.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:macro-in-other-crate.rs #![feature(decl_macro, extern_prelude)] diff --git a/src/test/ui/macros/macro-path-prelude-shadowing.stderr b/src/test/ui/macros/macro-path-prelude-shadowing.stderr index 904eed9f249..9c0214346a6 100644 --- a/src/test/ui/macros/macro-path-prelude-shadowing.stderr +++ b/src/test/ui/macros/macro-path-prelude-shadowing.stderr @@ -1,12 +1,12 @@ error[E0659]: `std` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) - --> $DIR/macro-path-prelude-shadowing.rs:39:9 + --> $DIR/macro-path-prelude-shadowing.rs:29:9 | LL | std::panic!(); //~ ERROR `std` is ambiguous | ^^^ ambiguous name | = note: `std` could refer to a built-in extern crate note: `std` could also refer to the module imported here - --> $DIR/macro-path-prelude-shadowing.rs:37:9 + --> $DIR/macro-path-prelude-shadowing.rs:27:9 | LL | use m2::*; // glob-import user-defined `std` | ^^^^^ diff --git a/src/test/ui/macros/macro-reexport-removed.rs b/src/test/ui/macros/macro-reexport-removed.rs index bab583da37b..fb33794a5ca 100644 --- a/src/test/ui/macros/macro-reexport-removed.rs +++ b/src/test/ui/macros/macro-reexport-removed.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:two_macros.rs #![feature(macro_reexport)] //~ ERROR feature has been removed diff --git a/src/test/ui/macros/macro-reexport-removed.stderr b/src/test/ui/macros/macro-reexport-removed.stderr index 8f954158a63..6cfec3ee762 100644 --- a/src/test/ui/macros/macro-reexport-removed.stderr +++ b/src/test/ui/macros/macro-reexport-removed.stderr @@ -1,20 +1,20 @@ error[E0557]: feature has been removed - --> $DIR/macro-reexport-removed.rs:13:12 + --> $DIR/macro-reexport-removed.rs:3:12 | LL | #![feature(macro_reexport)] //~ ERROR feature has been removed | ^^^^^^^^^^^^^^ | note: subsumed by `pub use` - --> $DIR/macro-reexport-removed.rs:13:12 + --> $DIR/macro-reexport-removed.rs:3:12 | LL | #![feature(macro_reexport)] //~ ERROR feature has been removed | ^^^^^^^^^^^^^^ error[E0658]: The attribute `macro_reexport` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/macro-reexport-removed.rs:15:3 + --> $DIR/macro-reexport-removed.rs:5:3 | LL | #[macro_reexport(macro_one)] //~ ERROR attribute `macro_reexport` is currently unknown - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^ help: a built-in attribute with a similar name exists: `macro_export` | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/macros/macro-shadowing-relaxed.rs b/src/test/ui/macros/macro-shadowing-relaxed.rs index 8d5b03b098f..2477226ce21 100644 --- a/src/test/ui/macros/macro-shadowing-relaxed.rs +++ b/src/test/ui/macros/macro-shadowing-relaxed.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // aux-build:macro-in-other-crate.rs diff --git a/src/test/ui/macros/macro-shadowing.rs b/src/test/ui/macros/macro-shadowing.rs index bf0a7fa21d3..7f956dd7d10 100644 --- a/src/test/ui/macros/macro-shadowing.rs +++ b/src/test/ui/macros/macro-shadowing.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:two_macros.rs #![allow(unused_macros)] diff --git a/src/test/ui/macros/macro-shadowing.stderr b/src/test/ui/macros/macro-shadowing.stderr index 6985dfcc6c2..c297f0ef52d 100644 --- a/src/test/ui/macros/macro-shadowing.stderr +++ b/src/test/ui/macros/macro-shadowing.stderr @@ -1,5 +1,5 @@ error: `macro_two` is already in scope - --> $DIR/macro-shadowing.rs:22:5 + --> $DIR/macro-shadowing.rs:12:5 | LL | #[macro_use] //~ ERROR `macro_two` is already in scope | ^^^^^^^^^^^^ @@ -10,13 +10,13 @@ LL | m1!(); = note: macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560) error[E0659]: `foo` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/macro-shadowing.rs:27:1 + --> $DIR/macro-shadowing.rs:17:1 | LL | foo!(); //~ ERROR `foo` is ambiguous | ^^^ ambiguous name | note: `foo` could refer to the macro defined here - --> $DIR/macro-shadowing.rs:20:5 + --> $DIR/macro-shadowing.rs:10:5 | LL | macro_rules! foo { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -24,7 +24,7 @@ LL | macro_rules! foo { () => {} } LL | m1!(); | ------ in this macro invocation note: `foo` could also refer to the macro defined here - --> $DIR/macro-shadowing.rs:15:1 + --> $DIR/macro-shadowing.rs:5:1 | LL | macro_rules! foo { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/macros/macro-stability.rs b/src/test/ui/macros/macro-stability.rs index a4b922c0fe1..7d1ee6a43b6 100644 --- a/src/test/ui/macros/macro-stability.rs +++ b/src/test/ui/macros/macro-stability.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:unstable-macros.rs #![feature(staged_api)] diff --git a/src/test/ui/macros/macro-stability.stderr b/src/test/ui/macros/macro-stability.stderr index 947133f287d..e5c535a08e1 100644 --- a/src/test/ui/macros/macro-stability.stderr +++ b/src/test/ui/macros/macro-stability.stderr @@ -1,5 +1,5 @@ error[E0658]: macro unstable_macro! is unstable - --> $DIR/macro-stability.rs:21:5 + --> $DIR/macro-stability.rs:11:5 | LL | unstable_macro!(); //~ ERROR: macro unstable_macro! is unstable | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/macros/macro-stmt-matchers.rs b/src/test/ui/macros/macro-stmt-matchers.rs index a1d77515f29..6e53eb05121 100644 --- a/src/test/ui/macros/macro-stmt-matchers.rs +++ b/src/test/ui/macros/macro-stmt-matchers.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass diff --git a/src/test/ui/macros/macro-tt-matchers.rs b/src/test/ui/macros/macro-tt-matchers.rs index 90ac95d54d7..17df72f36db 100644 --- a/src/test/ui/macros/macro-tt-matchers.rs +++ b/src/test/ui/macros/macro-tt-matchers.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code)] diff --git a/src/test/ui/macros/macro-use-bad-args-1.rs b/src/test/ui/macros/macro-use-bad-args-1.rs index fefc6ff6ca6..061c5cc7b3c 100644 --- a/src/test/ui/macros/macro-use-bad-args-1.rs +++ b/src/test/ui/macros/macro-use-bad-args-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] #[allow(unused_extern_crates)] diff --git a/src/test/ui/macros/macro-use-bad-args-1.stderr b/src/test/ui/macros/macro-use-bad-args-1.stderr index 308fb6c76e1..1eb8cc3f4c4 100644 --- a/src/test/ui/macros/macro-use-bad-args-1.stderr +++ b/src/test/ui/macros/macro-use-bad-args-1.stderr @@ -1,5 +1,5 @@ error[E0466]: bad macro import - --> $DIR/macro-use-bad-args-1.rs:14:13 + --> $DIR/macro-use-bad-args-1.rs:4:13 | LL | #[macro_use(foo(bar))] //~ ERROR bad macro import | ^^^^^^^^ diff --git a/src/test/ui/macros/macro-use-bad-args-2.rs b/src/test/ui/macros/macro-use-bad-args-2.rs index 81352cf2e42..cb231ce292a 100644 --- a/src/test/ui/macros/macro-use-bad-args-2.rs +++ b/src/test/ui/macros/macro-use-bad-args-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] #[allow(unused_extern_crates)] diff --git a/src/test/ui/macros/macro-use-bad-args-2.stderr b/src/test/ui/macros/macro-use-bad-args-2.stderr index 62e3c22fab3..7ed6b26b1b7 100644 --- a/src/test/ui/macros/macro-use-bad-args-2.stderr +++ b/src/test/ui/macros/macro-use-bad-args-2.stderr @@ -1,5 +1,5 @@ error[E0466]: bad macro import - --> $DIR/macro-use-bad-args-2.rs:14:13 + --> $DIR/macro-use-bad-args-2.rs:4:13 | LL | #[macro_use(foo="bar")] //~ ERROR bad macro import | ^^^^^^^^^ diff --git a/src/test/ui/macros/macro-use-scope.rs b/src/test/ui/macros/macro-use-scope.rs index b594085333b..03d57d22299 100644 --- a/src/test/ui/macros/macro-use-scope.rs +++ b/src/test/ui/macros/macro-use-scope.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:two_macros.rs // compile-pass diff --git a/src/test/ui/macros/macro-use-undef.rs b/src/test/ui/macros/macro-use-undef.rs index dd725aae95e..ae3054e7b82 100644 --- a/src/test/ui/macros/macro-use-undef.rs +++ b/src/test/ui/macros/macro-use-undef.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:two_macros.rs #[macro_use(macro_two, no_way)] //~ ERROR imported macro not found diff --git a/src/test/ui/macros/macro-use-undef.stderr b/src/test/ui/macros/macro-use-undef.stderr index 6fc57a34794..4d9fa3aeb13 100644 --- a/src/test/ui/macros/macro-use-undef.stderr +++ b/src/test/ui/macros/macro-use-undef.stderr @@ -1,5 +1,5 @@ error[E0469]: imported macro not found - --> $DIR/macro-use-undef.rs:13:24 + --> $DIR/macro-use-undef.rs:3:24 | LL | #[macro_use(macro_two, no_way)] //~ ERROR imported macro not found | ^^^^^^ diff --git a/src/test/ui/macros/macro-use-wrong-name.rs b/src/test/ui/macros/macro-use-wrong-name.rs index 143ecb4ce5e..d142b580003 100644 --- a/src/test/ui/macros/macro-use-wrong-name.rs +++ b/src/test/ui/macros/macro-use-wrong-name.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:two_macros.rs #[macro_use(macro_one)] diff --git a/src/test/ui/macros/macro-use-wrong-name.stderr b/src/test/ui/macros/macro-use-wrong-name.stderr index 26271a21623..d178d4e4a60 100644 --- a/src/test/ui/macros/macro-use-wrong-name.stderr +++ b/src/test/ui/macros/macro-use-wrong-name.stderr @@ -1,5 +1,5 @@ error: cannot find macro `macro_two!` in this scope - --> $DIR/macro-use-wrong-name.rs:17:5 + --> $DIR/macro-use-wrong-name.rs:7:5 | LL | macro_two!(); | ^^^^^^^^^ help: you could try the macro: `macro_one` diff --git a/src/test/ui/macros/macro_path_as_generic_bound.rs b/src/test/ui/macros/macro_path_as_generic_bound.rs index 85cf597489d..663f85688ec 100644 --- a/src/test/ui/macros/macro_path_as_generic_bound.rs +++ b/src/test/ui/macros/macro_path_as_generic_bound.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo {} macro_rules! foo(($t:path) => { diff --git a/src/test/ui/macros/macro_path_as_generic_bound.stderr b/src/test/ui/macros/macro_path_as_generic_bound.stderr index 8b4fe9f200d..2f0e67c1ba8 100644 --- a/src/test/ui/macros/macro_path_as_generic_bound.stderr +++ b/src/test/ui/macros/macro_path_as_generic_bound.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: use of undeclared type or module `m` - --> $DIR/macro_path_as_generic_bound.rs:17:6 + --> $DIR/macro_path_as_generic_bound.rs:7:6 | LL | foo!(m::m2::A); //~ ERROR failed to resolve | ^ use of undeclared type or module `m` diff --git a/src/test/ui/macros/macro_undefined.rs b/src/test/ui/macros/macro_undefined.rs index 4a812739a6b..6ca1eb56861 100644 --- a/src/test/ui/macros/macro_undefined.rs +++ b/src/test/ui/macros/macro_undefined.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test macro_undefined issue mod m { diff --git a/src/test/ui/macros/macro_undefined.stderr b/src/test/ui/macros/macro_undefined.stderr index 87b039f4834..b9a76e07a00 100644 --- a/src/test/ui/macros/macro_undefined.stderr +++ b/src/test/ui/macros/macro_undefined.stderr @@ -1,5 +1,5 @@ error: cannot find macro `k!` in this scope - --> $DIR/macro_undefined.rs:21:5 + --> $DIR/macro_undefined.rs:11:5 | LL | k!(); //~ ERROR cannot find | ^ help: you could try the macro: `kl` diff --git a/src/test/ui/macros/macros-in-extern.rs b/src/test/ui/macros/macros-in-extern.rs index 40053853b15..bba8b15cdb0 100644 --- a/src/test/ui/macros/macros-in-extern.rs +++ b/src/test/ui/macros/macros-in-extern.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32 #![feature(decl_macro)] diff --git a/src/test/ui/macros/macros-in-extern.stderr b/src/test/ui/macros/macros-in-extern.stderr index 60492d34451..1d0c28752bc 100644 --- a/src/test/ui/macros/macros-in-extern.stderr +++ b/src/test/ui/macros/macros-in-extern.stderr @@ -1,5 +1,5 @@ error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) - --> $DIR/macros-in-extern.rs:36:5 + --> $DIR/macros-in-extern.rs:26:5 | LL | returns_isize!(rust_get_test_int); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | returns_isize!(rust_get_test_int); = help: add #![feature(macros_in_extern)] to the crate attributes to enable error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) - --> $DIR/macros-in-extern.rs:38:5 + --> $DIR/macros-in-extern.rs:28:5 | LL | takes_u32_returns_u32!(rust_dbg_extern_identity_u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | takes_u32_returns_u32!(rust_dbg_extern_identity_u32); = help: add #![feature(macros_in_extern)] to the crate attributes to enable error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) - --> $DIR/macros-in-extern.rs:40:5 + --> $DIR/macros-in-extern.rs:30:5 | LL | emits_nothing!(); | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/macros/meta-item-absolute-path.rs b/src/test/ui/macros/meta-item-absolute-path.rs new file mode 100644 index 00000000000..14d23be059c --- /dev/null +++ b/src/test/ui/macros/meta-item-absolute-path.rs @@ -0,0 +1,4 @@ +#[derive(::Absolute)] //~ ERROR failed to resolve +struct S; + +fn main() {} diff --git a/src/test/ui/macros/meta-item-absolute-path.stderr b/src/test/ui/macros/meta-item-absolute-path.stderr new file mode 100644 index 00000000000..31b0a27bbc8 --- /dev/null +++ b/src/test/ui/macros/meta-item-absolute-path.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: maybe a missing `extern crate Absolute;`? + --> $DIR/meta-item-absolute-path.rs:1:12 + | +LL | #[derive(::Absolute)] //~ ERROR failed to resolve + | ^^^^^^^^ maybe a missing `extern crate Absolute;`? + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/macros/missing-comma.rs b/src/test/ui/macros/missing-comma.rs index 07e69b9619d..1e146875bcc 100644 --- a/src/test/ui/macros/missing-comma.rs +++ b/src/test/ui/macros/missing-comma.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo { ($a:ident) => (); ($a:ident, $b:ident) => (); diff --git a/src/test/ui/macros/missing-comma.stderr b/src/test/ui/macros/missing-comma.stderr index 1d6af44bd08..5881e0b7b68 100644 --- a/src/test/ui/macros/missing-comma.stderr +++ b/src/test/ui/macros/missing-comma.stderr @@ -1,50 +1,50 @@ error: expected token: `,` - --> $DIR/missing-comma.rs:20:19 + --> $DIR/missing-comma.rs:10:19 | LL | println!("{}" a); | ^ error: no rules expected the token `b` - --> $DIR/missing-comma.rs:22:12 + --> $DIR/missing-comma.rs:12:12 | LL | macro_rules! foo { | ---------------- when calling this macro ... LL | foo!(a b); - | -^ no rules expected the token `b` + | -^ no rules expected this token in macro call | | | help: missing comma here error: no rules expected the token `e` - --> $DIR/missing-comma.rs:24:21 + --> $DIR/missing-comma.rs:14:21 | LL | macro_rules! foo { | ---------------- when calling this macro ... LL | foo!(a, b, c, d e); - | -^ no rules expected the token `e` + | -^ no rules expected this token in macro call | | | help: missing comma here error: no rules expected the token `d` - --> $DIR/missing-comma.rs:26:18 + --> $DIR/missing-comma.rs:16:18 | LL | macro_rules! foo { | ---------------- when calling this macro ... LL | foo!(a, b, c d, e); - | -^ no rules expected the token `d` + | -^ no rules expected this token in macro call | | | help: missing comma here error: no rules expected the token `d` - --> $DIR/missing-comma.rs:28:18 + --> $DIR/missing-comma.rs:18:18 | LL | macro_rules! foo { | ---------------- when calling this macro ... LL | foo!(a, b, c d e); - | ^ no rules expected the token `d` + | ^ no rules expected this token in macro call error: aborting due to 5 previous errors diff --git a/src/test/ui/macros/must-use-in-macro-55516.rs b/src/test/ui/macros/must-use-in-macro-55516.rs index ad7cc37da52..10e5646dc3d 100644 --- a/src/test/ui/macros/must-use-in-macro-55516.rs +++ b/src/test/ui/macros/must-use-in-macro-55516.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // compile-flags: -Wunused diff --git a/src/test/ui/macros/must-use-in-macro-55516.stderr b/src/test/ui/macros/must-use-in-macro-55516.stderr index b03a5806da5..47874b80972 100644 --- a/src/test/ui/macros/must-use-in-macro-55516.stderr +++ b/src/test/ui/macros/must-use-in-macro-55516.stderr @@ -1,5 +1,5 @@ warning: unused `std::result::Result` that must be used - --> $DIR/must-use-in-macro-55516.rs:19:5 + --> $DIR/must-use-in-macro-55516.rs:9:5 | LL | write!(&mut example, "{}", 42); //~WARN must be used | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/macros/nonterminal-matching.rs b/src/test/ui/macros/nonterminal-matching.rs index 54d280a63e7..0ccdf6e5f2e 100644 --- a/src/test/ui/macros/nonterminal-matching.rs +++ b/src/test/ui/macros/nonterminal-matching.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we are refusing to match on complex nonterminals for which tokens are // unavailable and we'd have to go through AST comparisons. diff --git a/src/test/ui/macros/nonterminal-matching.stderr b/src/test/ui/macros/nonterminal-matching.stderr index 23853978d37..f2a191ae149 100644 --- a/src/test/ui/macros/nonterminal-matching.stderr +++ b/src/test/ui/macros/nonterminal-matching.stderr @@ -1,8 +1,8 @@ error: no rules expected the token `enum E { }` - --> $DIR/nonterminal-matching.rs:29:10 + --> $DIR/nonterminal-matching.rs:19:10 | LL | n!(a $nt_item b); //~ ERROR no rules expected the token `enum E { }` - | ^^^^^^^^ no rules expected the token `enum E { }` + | ^^^^^^^^ no rules expected this token in macro call ... LL | complex_nonterminal!(enum E {}); | -------------------------------- in this macro invocation diff --git a/src/test/ui/macros/restricted-shadowing-legacy.stderr b/src/test/ui/macros/restricted-shadowing-legacy.stderr index 2135d63c80e..9d61799713b 100644 --- a/src/test/ui/macros/restricted-shadowing-legacy.stderr +++ b/src/test/ui/macros/restricted-shadowing-legacy.stderr @@ -3,6 +3,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -26,6 +29,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -49,6 +55,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -72,6 +81,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -95,6 +107,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -118,6 +133,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -141,6 +159,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 @@ -164,6 +185,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-legacy.rs:88:9 diff --git a/src/test/ui/macros/restricted-shadowing-modern.stderr b/src/test/ui/macros/restricted-shadowing-modern.stderr index 2449e8512d3..398a7660d30 100644 --- a/src/test/ui/macros/restricted-shadowing-modern.stderr +++ b/src/test/ui/macros/restricted-shadowing-modern.stderr @@ -3,6 +3,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-modern.rs:91:9 @@ -26,6 +29,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | macro gen_invoc() { m!() } //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-modern.rs:91:9 @@ -49,6 +55,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-modern.rs:91:9 @@ -72,6 +81,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-modern.rs:91:9 @@ -95,6 +107,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | m!(); //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-modern.rs:91:9 @@ -118,6 +133,9 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name | LL | macro gen_invoc() { m!() } //~ ERROR `m` is ambiguous | ^ ambiguous name +... +LL | include!(); + | ----------- in this macro invocation | note: `m` could refer to the macro defined here --> $DIR/restricted-shadowing-modern.rs:91:9 diff --git a/src/test/ui/macros/span-covering-argument-1.nll.stderr b/src/test/ui/macros/span-covering-argument-1.nll.stderr index 3947f6c0f11..2ac881107b9 100644 --- a/src/test/ui/macros/span-covering-argument-1.nll.stderr +++ b/src/test/ui/macros/span-covering-argument-1.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `foo` as mutable, as it is not declared as mutable - --> $DIR/span-covering-argument-1.rs:15:14 + --> $DIR/span-covering-argument-1.rs:5:14 | LL | let $s = 0; | -- help: consider changing this to be mutable: `mut foo` diff --git a/src/test/ui/macros/span-covering-argument-1.rs b/src/test/ui/macros/span-covering-argument-1.rs index bfc137fc7b2..0256aaf901e 100644 --- a/src/test/ui/macros/span-covering-argument-1.rs +++ b/src/test/ui/macros/span-covering-argument-1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! bad { ($s:ident whatever) => { { diff --git a/src/test/ui/macros/span-covering-argument-1.stderr b/src/test/ui/macros/span-covering-argument-1.stderr index d3ba6fc005e..345b880ccad 100644 --- a/src/test/ui/macros/span-covering-argument-1.stderr +++ b/src/test/ui/macros/span-covering-argument-1.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `foo` as mutable - --> $DIR/span-covering-argument-1.rs:15:19 + --> $DIR/span-covering-argument-1.rs:5:19 | LL | let $s = 0; | -- help: make this binding mutable: `mut $s` diff --git a/src/test/ui/macros/trace-macro.rs b/src/test/ui/macros/trace-macro.rs index 996b172c87b..efd658dd2b9 100644 --- a/src/test/ui/macros/trace-macro.rs +++ b/src/test/ui/macros/trace-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z trace-macros // compile-pass diff --git a/src/test/ui/macros/trace-macro.stderr b/src/test/ui/macros/trace-macro.stderr index 4b716ff2744..ebfed41bc28 100644 --- a/src/test/ui/macros/trace-macro.stderr +++ b/src/test/ui/macros/trace-macro.stderr @@ -1,5 +1,5 @@ note: trace_macro - --> $DIR/trace-macro.rs:15:5 + --> $DIR/trace-macro.rs:5:5 | LL | println!("Hello, World!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/macros/trace_faulty_macros.rs b/src/test/ui/macros/trace_faulty_macros.rs index ced1a7f68fb..627d58abf4c 100644 --- a/src/test/ui/macros/trace_faulty_macros.rs +++ b/src/test/ui/macros/trace_faulty_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z trace-macros #![recursion_limit="4"] diff --git a/src/test/ui/macros/trace_faulty_macros.stderr b/src/test/ui/macros/trace_faulty_macros.stderr index 853eb5847c0..a645590f005 100644 --- a/src/test/ui/macros/trace_faulty_macros.stderr +++ b/src/test/ui/macros/trace_faulty_macros.stderr @@ -1,17 +1,17 @@ error: no rules expected the token `bcd` - --> $DIR/trace_faulty_macros.rs:17:26 + --> $DIR/trace_faulty_macros.rs:7:26 | LL | macro_rules! my_faulty_macro { | ---------------------------- when calling this macro LL | () => { LL | my_faulty_macro!(bcd); //~ ERROR no rules - | ^^^ no rules expected the token `bcd` + | ^^^ no rules expected this token in macro call ... LL | my_faulty_macro!(); | ------------------- in this macro invocation note: trace_macro - --> $DIR/trace_faulty_macros.rs:43:5 + --> $DIR/trace_faulty_macros.rs:33:5 | LL | my_faulty_macro!(); | ^^^^^^^^^^^^^^^^^^^ @@ -21,7 +21,7 @@ LL | my_faulty_macro!(); = note: expanding `my_faulty_macro! { bcd }` error: recursion limit reached while expanding the macro `my_recursive_macro` - --> $DIR/trace_faulty_macros.rs:32:9 + --> $DIR/trace_faulty_macros.rs:22:9 | LL | my_recursive_macro!(); //~ ERROR recursion limit | ^^^^^^^^^^^^^^^^^^^^^^ @@ -32,7 +32,7 @@ LL | my_recursive_macro!(); = help: consider adding a `#![recursion_limit="8"]` attribute to your crate note: trace_macro - --> $DIR/trace_faulty_macros.rs:44:5 + --> $DIR/trace_faulty_macros.rs:34:5 | LL | my_recursive_macro!(); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/main-wrong-location.rs b/src/test/ui/main-wrong-location.rs index 45be5f14787..d7ed5128195 100644 --- a/src/test/ui/main-wrong-location.rs +++ b/src/test/ui/main-wrong-location.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod m { // An inferred main entry point (that doesn't use #[main]) // must appear at the top of the crate diff --git a/src/test/ui/main-wrong-location.stderr b/src/test/ui/main-wrong-location.stderr index a5ef92f14bb..b30931f2f23 100644 --- a/src/test/ui/main-wrong-location.stderr +++ b/src/test/ui/main-wrong-location.stderr @@ -2,7 +2,7 @@ error[E0601]: `main` function not found in crate `main_wrong_location` | = note: the main function must be defined at the crate level but you have one or more functions named 'main' that are not defined at the crate level. Either move the definition or attach the `#[main]` attribute to override this behavior. note: here is a function named 'main' - --> $DIR/main-wrong-location.rs:14:5 + --> $DIR/main-wrong-location.rs:4:5 | LL | fn main() { } | ^^^^^^^^^^^^^ diff --git a/src/test/ui/main-wrong-type.rs b/src/test/ui/main-wrong-type.rs index 402cd3a2d31..dac4d4ac9aa 100644 --- a/src/test/ui/main-wrong-type.rs +++ b/src/test/ui/main-wrong-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S { x: isize, y: isize, diff --git a/src/test/ui/main-wrong-type.stderr b/src/test/ui/main-wrong-type.stderr index 15094bd1fbb..c00c67af572 100644 --- a/src/test/ui/main-wrong-type.stderr +++ b/src/test/ui/main-wrong-type.stderr @@ -1,5 +1,5 @@ error[E0580]: main function has wrong type - --> $DIR/main-wrong-type.rs:16:1 + --> $DIR/main-wrong-type.rs:6:1 | LL | fn main(foo: S) { | ^^^^^^^^^^^^^^^ incorrect number of function parameters diff --git a/src/test/ui/malformed/malformed-derive-entry.rs b/src/test/ui/malformed/malformed-derive-entry.rs index ac000628f2b..74d22102c66 100644 --- a/src/test/ui/malformed/malformed-derive-entry.rs +++ b/src/test/ui/malformed/malformed-derive-entry.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Copy(Bad))] //~^ ERROR expected one of `)`, `,`, or `::`, found `(` struct Test1; @@ -21,5 +11,7 @@ struct Test2; struct Test3; #[derive] -//~^ WARNING empty trait list +//~^ ERROR attribute must be of the form struct Test4; + +fn main() {} diff --git a/src/test/ui/malformed/malformed-derive-entry.stderr b/src/test/ui/malformed/malformed-derive-entry.stderr index b1984f52430..f546f74220a 100644 --- a/src/test/ui/malformed/malformed-derive-entry.stderr +++ b/src/test/ui/malformed/malformed-derive-entry.stderr @@ -1,26 +1,26 @@ error: expected one of `)`, `,`, or `::`, found `(` - --> $DIR/malformed-derive-entry.rs:11:14 + --> $DIR/malformed-derive-entry.rs:1:14 | LL | #[derive(Copy(Bad))] | ^ expected one of `)`, `,`, or `::` here error: expected one of `)`, `,`, or `::`, found `=` - --> $DIR/malformed-derive-entry.rs:15:14 + --> $DIR/malformed-derive-entry.rs:5:14 | LL | #[derive(Copy="bad")] | ^ expected one of `)`, `,`, or `::` here warning: empty trait list in `derive` - --> $DIR/malformed-derive-entry.rs:19:1 + --> $DIR/malformed-derive-entry.rs:9:1 | LL | #[derive()] | ^^^^^^^^^^^ -warning: empty trait list in `derive` - --> $DIR/malformed-derive-entry.rs:23:1 +error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]` + --> $DIR/malformed-derive-entry.rs:13:1 | LL | #[derive] | ^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors diff --git a/src/test/ui/malformed/malformed-plugin-1.rs b/src/test/ui/malformed/malformed-plugin-1.rs index 214a5e5e3eb..16e7a952ef2 100644 --- a/src/test/ui/malformed/malformed-plugin-1.rs +++ b/src/test/ui/malformed/malformed-plugin-1.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(plugin)] -#![plugin] //~ ERROR malformed plugin attribute +#![plugin] //~ ERROR attribute must be of the form fn main() {} diff --git a/src/test/ui/malformed/malformed-plugin-1.stderr b/src/test/ui/malformed/malformed-plugin-1.stderr index 5ceabc3b8ba..f42e66e2b32 100644 --- a/src/test/ui/malformed/malformed-plugin-1.stderr +++ b/src/test/ui/malformed/malformed-plugin-1.stderr @@ -1,9 +1,8 @@ -error[E0498]: malformed plugin attribute - --> $DIR/malformed-plugin-1.rs:12:1 +error: attribute must be of the form `#[plugin(name|name(args))]` + --> $DIR/malformed-plugin-1.rs:2:1 | -LL | #![plugin] //~ ERROR malformed plugin attribute +LL | #![plugin] //~ ERROR attribute must be of the form | ^^^^^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0498`. diff --git a/src/test/ui/malformed/malformed-plugin-2.rs b/src/test/ui/malformed/malformed-plugin-2.rs index 1b112608bee..70a1d7f85e8 100644 --- a/src/test/ui/malformed/malformed-plugin-2.rs +++ b/src/test/ui/malformed/malformed-plugin-2.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(plugin)] -#![plugin="bleh"] //~ ERROR malformed plugin attribute +#![plugin="bleh"] //~ ERROR attribute must be of the form fn main() {} diff --git a/src/test/ui/malformed/malformed-plugin-2.stderr b/src/test/ui/malformed/malformed-plugin-2.stderr index 56c87f9f8dd..923cbc18860 100644 --- a/src/test/ui/malformed/malformed-plugin-2.stderr +++ b/src/test/ui/malformed/malformed-plugin-2.stderr @@ -1,9 +1,8 @@ -error[E0498]: malformed plugin attribute - --> $DIR/malformed-plugin-2.rs:12:1 +error: attribute must be of the form `#[plugin(name|name(args))]` + --> $DIR/malformed-plugin-2.rs:2:1 | -LL | #![plugin="bleh"] //~ ERROR malformed plugin attribute +LL | #![plugin="bleh"] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0498`. diff --git a/src/test/ui/malformed/malformed-plugin-3.rs b/src/test/ui/malformed/malformed-plugin-3.rs index 0c948831de2..1b70ff3bdb7 100644 --- a/src/test/ui/malformed/malformed-plugin-3.rs +++ b/src/test/ui/malformed/malformed-plugin-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(plugin)] #![plugin(foo="bleh")] //~ ERROR malformed plugin attribute diff --git a/src/test/ui/malformed/malformed-plugin-3.stderr b/src/test/ui/malformed/malformed-plugin-3.stderr index fff52c649e8..6f19a117149 100644 --- a/src/test/ui/malformed/malformed-plugin-3.stderr +++ b/src/test/ui/malformed/malformed-plugin-3.stderr @@ -1,5 +1,5 @@ error[E0498]: malformed plugin attribute - --> $DIR/malformed-plugin-3.rs:12:1 + --> $DIR/malformed-plugin-3.rs:2:1 | LL | #![plugin(foo="bleh")] //~ ERROR malformed plugin attribute | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/malformed/malformed-regressions.rs b/src/test/ui/malformed/malformed-regressions.rs new file mode 100644 index 00000000000..b5c992440d4 --- /dev/null +++ b/src/test/ui/malformed/malformed-regressions.rs @@ -0,0 +1,8 @@ +// compile-pass + +#[doc] //~ WARN attribute must be of the form +#[ignore()] //~ WARN attribute must be of the form +#[inline = ""] //~ WARN attribute must be of the form +#[link] //~ WARN attribute must be of the form +#[link = ""] //~ WARN attribute must be of the form +fn main() {} diff --git a/src/test/ui/malformed/malformed-regressions.stderr b/src/test/ui/malformed/malformed-regressions.stderr new file mode 100644 index 00000000000..a3b2bda07f6 --- /dev/null +++ b/src/test/ui/malformed/malformed-regressions.stderr @@ -0,0 +1,48 @@ +warning: attribute must be of the form `#[doc(hidden|inline|...)]` or `#[doc = "string"]` + --> $DIR/malformed-regressions.rs:3:1 + | +LL | #[doc] //~ WARN attribute must be of the form + | ^^^^^^ + | + = note: #[warn(ill_formed_attribute_input)] on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57571 + +warning: attribute must be of the form `#[ignore]` or `#[ignore = "reason"]` + --> $DIR/malformed-regressions.rs:4:1 + | +LL | #[ignore()] //~ WARN attribute must be of the form + | ^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57571 + +warning: attribute must be of the form `#[inline]` or `#[inline(always|never)]` + --> $DIR/malformed-regressions.rs:5:1 + | +LL | #[inline = ""] //~ WARN attribute must be of the form + | ^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57571 + +warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", + /*opt*/ cfg = "...")]` + --> $DIR/malformed-regressions.rs:6:1 + | +LL | #[link] //~ WARN attribute must be of the form + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57571 + +warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", + /*opt*/ cfg = "...")]` + --> $DIR/malformed-regressions.rs:7:1 + | +LL | #[link = ""] //~ WARN attribute must be of the form + | ^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57571 + diff --git a/src/test/ui/malformed/malformed-special-attrs.rs b/src/test/ui/malformed/malformed-special-attrs.rs new file mode 100644 index 00000000000..f91c6bedb2b --- /dev/null +++ b/src/test/ui/malformed/malformed-special-attrs.rs @@ -0,0 +1,13 @@ +#[cfg_attr] //~ ERROR expected `(`, found `` +struct S1; + +#[cfg_attr = ""] //~ ERROR expected `(`, found `=` +struct S2; + +#[derive] //~ ERROR attribute must be of the form +struct S3; + +#[derive = ""] //~ ERROR attribute must be of the form +struct S4; + +fn main() {} diff --git a/src/test/ui/malformed/malformed-special-attrs.stderr b/src/test/ui/malformed/malformed-special-attrs.stderr new file mode 100644 index 00000000000..1653aa150d5 --- /dev/null +++ b/src/test/ui/malformed/malformed-special-attrs.stderr @@ -0,0 +1,25 @@ +error: expected `(`, found `` + +error: expected `(`, found `=` + --> $DIR/malformed-special-attrs.rs:4:12 + | +LL | #[cfg_attr] //~ ERROR expected `(`, found `` + | - expected `(` +... +LL | #[cfg_attr = ""] //~ ERROR expected `(`, found `=` + | ^ unexpected token + +error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]` + --> $DIR/malformed-special-attrs.rs:7:1 + | +LL | #[derive] //~ ERROR attribute must be of the form + | ^^^^^^^^^ + +error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]` + --> $DIR/malformed-special-attrs.rs:10:1 + | +LL | #[derive = ""] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/malformed_macro_lhs.rs b/src/test/ui/malformed_macro_lhs.rs index 0b437be5393..f57d2fb4dc9 100644 --- a/src/test/ui/malformed_macro_lhs.rs +++ b/src/test/ui/malformed_macro_lhs.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! my_precioooous { t => (1); //~ ERROR invalid macro matcher } diff --git a/src/test/ui/malformed_macro_lhs.stderr b/src/test/ui/malformed_macro_lhs.stderr index 6b4241890b1..ab09bc10b86 100644 --- a/src/test/ui/malformed_macro_lhs.stderr +++ b/src/test/ui/malformed_macro_lhs.stderr @@ -1,5 +1,5 @@ error: invalid macro matcher; matchers must be contained in balanced delimiters - --> $DIR/malformed_macro_lhs.rs:12:5 + --> $DIR/malformed_macro_lhs.rs:2:5 | LL | t => (1); //~ ERROR invalid macro matcher | ^ diff --git a/src/test/ui/manual/manual-link-bad-form.rs b/src/test/ui/manual/manual-link-bad-form.rs index fc4fa838a56..9d092ae6db4 100644 --- a/src/test/ui/manual/manual-link-bad-form.rs +++ b/src/test/ui/manual/manual-link-bad-form.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-l static= // error-pattern: empty library name given via `-l` diff --git a/src/test/ui/manual/manual-link-bad-kind.rs b/src/test/ui/manual/manual-link-bad-kind.rs index e9cbdb09948..86830a599b5 100644 --- a/src/test/ui/manual/manual-link-bad-kind.rs +++ b/src/test/ui/manual/manual-link-bad-kind.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-l bar=foo // error-pattern: unknown library kind `bar`, expected one of dylib, framework, or static diff --git a/src/test/ui/manual/manual-link-bad-search-path.rs b/src/test/ui/manual/manual-link-bad-search-path.rs index 2bf61cbe24c..0fe23b02aa9 100644 --- a/src/test/ui/manual/manual-link-bad-search-path.rs +++ b/src/test/ui/manual/manual-link-bad-search-path.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-L native= // error-pattern: empty search path given via `-L` diff --git a/src/test/ui/manual/manual-link-framework.rs b/src/test/ui/manual/manual-link-framework.rs index 1ecf63813e9..0474526fcc1 100644 --- a/src/test/ui/manual/manual-link-framework.rs +++ b/src/test/ui/manual/manual-link-framework.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-macos // ignore-ios // compile-flags:-l framework=foo diff --git a/src/test/ui/map-types.rs b/src/test/ui/map-types.rs index e8ff9e817af..dab7863415f 100644 --- a/src/test/ui/map-types.rs +++ b/src/test/ui/map-types.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] use std::collections::HashMap; diff --git a/src/test/ui/map-types.stderr b/src/test/ui/map-types.stderr index 722113c7525..9aa98044242 100644 --- a/src/test/ui/map-types.stderr +++ b/src/test/ui/map-types.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `std::boxed::Box>: Map` is not satisfied - --> $DIR/map-types.rs:27:37 + --> $DIR/map-types.rs:17:37 | LL | let y: Box> = Box::new(x); | ^^^^^^^^^^^ the trait `Map` is not implemented for `std::boxed::Box>` diff --git a/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.rs b/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.rs index 4c8003ce3d8..66156b6e53b 100644 --- a/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.rs +++ b/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(marker_trait_attr)] #[marker] //~ ERROR attribute can only be applied to a trait diff --git a/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr b/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr index 0e2586b9799..b88c125d968 100644 --- a/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr +++ b/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr @@ -1,5 +1,5 @@ error: attribute can only be applied to a trait - --> $DIR/marker-attribute-on-non-trait.rs:13:1 + --> $DIR/marker-attribute-on-non-trait.rs:3:1 | LL | #[marker] //~ ERROR attribute can only be applied to a trait | ^^^^^^^^^ @@ -7,7 +7,7 @@ LL | struct Struct {} | ---------------- not a trait error: attribute can only be applied to a trait - --> $DIR/marker-attribute-on-non-trait.rs:16:1 + --> $DIR/marker-attribute-on-non-trait.rs:6:1 | LL | #[marker] //~ ERROR attribute can only be applied to a trait | ^^^^^^^^^ @@ -15,7 +15,7 @@ LL | impl Struct {} | -------------- not a trait error: attribute can only be applied to a trait - --> $DIR/marker-attribute-on-non-trait.rs:19:1 + --> $DIR/marker-attribute-on-non-trait.rs:9:1 | LL | #[marker] //~ ERROR attribute can only be applied to a trait | ^^^^^^^^^ @@ -25,7 +25,7 @@ LL | | } | |_- not a trait error: attribute can only be applied to a trait - --> $DIR/marker-attribute-on-non-trait.rs:24:1 + --> $DIR/marker-attribute-on-non-trait.rs:14:1 | LL | #[marker] //~ ERROR attribute can only be applied to a trait | ^^^^^^^^^ @@ -33,7 +33,7 @@ LL | const CONST: usize = 10; | ------------------------ not a trait error: attribute can only be applied to a trait - --> $DIR/marker-attribute-on-non-trait.rs:27:1 + --> $DIR/marker-attribute-on-non-trait.rs:17:1 | LL | #[marker] //~ ERROR attribute can only be applied to a trait | ^^^^^^^^^ @@ -41,7 +41,7 @@ LL | fn function() {} | ---------------- not a trait error: attribute can only be applied to a trait - --> $DIR/marker-attribute-on-non-trait.rs:30:1 + --> $DIR/marker-attribute-on-non-trait.rs:20:1 | LL | #[marker] //~ ERROR attribute can only be applied to a trait | ^^^^^^^^^ diff --git a/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs b/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs index 6290481d60f..ea356d574f6 100644 --- a/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs +++ b/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs @@ -1,26 +1,16 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(marker_trait_attr)] #![feature(unrestricted_attribute_tokens)] #[marker(always)] trait Marker1 {} -//~^^ ERROR attribute should be empty +//~^^ ERROR attribute must be of the form #[marker("never")] trait Marker2 {} -//~^^ ERROR attribute should be empty +//~^^ ERROR attribute must be of the form #[marker(key = value)] trait Marker3 {} -//~^^ ERROR attribute should be empty +//~^^ ERROR expected unsuffixed literal or identifier, found value fn main() {} diff --git a/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr b/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr index 66bf2d1c502..c683b393d84 100644 --- a/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr +++ b/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr @@ -1,20 +1,20 @@ -error: attribute should be empty - --> $DIR/marker-attribute-with-values.rs:14:1 +error: attribute must be of the form `#[marker]` + --> $DIR/marker-attribute-with-values.rs:4:1 | LL | #[marker(always)] | ^^^^^^^^^^^^^^^^^ -error: attribute should be empty - --> $DIR/marker-attribute-with-values.rs:18:1 +error: attribute must be of the form `#[marker]` + --> $DIR/marker-attribute-with-values.rs:8:1 | LL | #[marker("never")] | ^^^^^^^^^^^^^^^^^^ -error: attribute should be empty - --> $DIR/marker-attribute-with-values.rs:22:1 +error: expected unsuffixed literal or identifier, found value + --> $DIR/marker-attribute-with-values.rs:12:10 | LL | #[marker(key = value)] - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.rs b/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.rs index b4677b68443..a6e00ecc9fc 100644 --- a/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.rs +++ b/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(marker_trait_attr)] #![feature(associated_type_defaults)] diff --git a/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.stderr b/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.stderr index dadf1f02b9a..68434c13110 100644 --- a/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.stderr +++ b/src/test/ui/marker_trait_attr/marker-trait-with-associated-items.stderr @@ -1,35 +1,35 @@ error[E0714]: marker traits cannot have associated items - --> $DIR/marker-trait-with-associated-items.rs:16:5 + --> $DIR/marker-trait-with-associated-items.rs:6:5 | LL | const N: usize; | ^^^^^^^^^^^^^^^ error[E0714]: marker traits cannot have associated items - --> $DIR/marker-trait-with-associated-items.rs:22:5 + --> $DIR/marker-trait-with-associated-items.rs:12:5 | LL | type Output; | ^^^^^^^^^^^^ error[E0714]: marker traits cannot have associated items - --> $DIR/marker-trait-with-associated-items.rs:28:5 + --> $DIR/marker-trait-with-associated-items.rs:18:5 | LL | fn foo(); | ^^^^^^^^^ error[E0714]: marker traits cannot have associated items - --> $DIR/marker-trait-with-associated-items.rs:34:5 + --> $DIR/marker-trait-with-associated-items.rs:24:5 | LL | const N: usize = 43; | ^^^^^^^^^^^^^^^^^^^^ error[E0714]: marker traits cannot have associated items - --> $DIR/marker-trait-with-associated-items.rs:40:5 + --> $DIR/marker-trait-with-associated-items.rs:30:5 | LL | type Output = (); | ^^^^^^^^^^^^^^^^^ error[E0714]: marker traits cannot have associated items - --> $DIR/marker-trait-with-associated-items.rs:46:5 + --> $DIR/marker-trait-with-associated-items.rs:36:5 | LL | fn foo() {} | ^^^^^^^^^^^ diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait.rs b/src/test/ui/marker_trait_attr/overlap-marker-trait.rs index a3b4fd6aeba..8794d42f411 100644 --- a/src/test/ui/marker_trait_attr/overlap-marker-trait.rs +++ b/src/test/ui/marker_trait_attr/overlap-marker-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for RFC 1268: we allow overlapping impls of marker traits, // that is, traits with #[marker]. In this case, a type `T` is // `MyMarker` if it is either `Debug` or `Display`. This test just diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr index a4c4f0629dd..4579ec26116 100644 --- a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr +++ b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied - --> $DIR/overlap-marker-trait.rs:37:5 + --> $DIR/overlap-marker-trait.rs:27:5 | LL | is_marker::(); //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` | note: required by `is_marker` - --> $DIR/overlap-marker-trait.rs:25:1 + --> $DIR/overlap-marker-trait.rs:15:1 | LL | fn is_marker() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/marker_trait_attr/override-item-on-marker-trait.rs b/src/test/ui/marker_trait_attr/override-item-on-marker-trait.rs index 4a9252b38f2..5376fc89d4f 100644 --- a/src/test/ui/marker_trait_attr/override-item-on-marker-trait.rs +++ b/src/test/ui/marker_trait_attr/override-item-on-marker-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(marker_trait_attr)] #[marker] diff --git a/src/test/ui/marker_trait_attr/override-item-on-marker-trait.stderr b/src/test/ui/marker_trait_attr/override-item-on-marker-trait.stderr index 43af997511e..1d30c6d5667 100644 --- a/src/test/ui/marker_trait_attr/override-item-on-marker-trait.stderr +++ b/src/test/ui/marker_trait_attr/override-item-on-marker-trait.stderr @@ -1,11 +1,11 @@ error[E0715]: impls for marker traits cannot contain items - --> $DIR/override-item-on-marker-trait.rs:20:1 + --> $DIR/override-item-on-marker-trait.rs:10:1 | LL | impl Marker for OverrideConst { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0715]: impls for marker traits cannot contain items - --> $DIR/override-item-on-marker-trait.rs:26:1 + --> $DIR/override-item-on-marker-trait.rs:16:1 | LL | impl Marker for OverrideFn { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/match/match-argm-statics-2.rs b/src/test/ui/match/match-argm-statics-2.rs index 70e148627c4..ad220d2f431 100644 --- a/src/test/ui/match/match-argm-statics-2.rs +++ b/src/test/ui/match/match-argm-statics-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use self::Direction::{North, East, South, West}; #[derive(PartialEq, Eq)] diff --git a/src/test/ui/match/match-argm-statics-2.stderr b/src/test/ui/match/match-argm-statics-2.stderr index 485b2a3202f..3e6f22ab875 100644 --- a/src/test/ui/match/match-argm-statics-2.stderr +++ b/src/test/ui/match/match-argm-statics-2.stderr @@ -1,17 +1,17 @@ error[E0004]: non-exhaustive patterns: `(true, false)` not covered - --> $DIR/match-argm-statics-2.rs:27:11 + --> $DIR/match-argm-statics-2.rs:17:11 | LL | match (true, false) { | ^^^^^^^^^^^^^ pattern `(true, false)` not covered error[E0004]: non-exhaustive patterns: `Some(Some(West))` not covered - --> $DIR/match-argm-statics-2.rs:39:11 + --> $DIR/match-argm-statics-2.rs:29:11 | LL | match Some(Some(North)) { | ^^^^^^^^^^^^^^^^^ pattern `Some(Some(West))` not covered error[E0004]: non-exhaustive patterns: `Foo { bar: Some(North), baz: NewBool(true) }` not covered - --> $DIR/match-argm-statics-2.rs:58:11 + --> $DIR/match-argm-statics-2.rs:48:11 | LL | match (Foo { bar: Some(North), baz: NewBool(true) }) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { bar: Some(North), baz: NewBool(true) }` not covered diff --git a/src/test/ui/match/match-arm-statics.rs b/src/test/ui/match/match-arm-statics.rs index 40d73ab51c7..91db76ebb9f 100644 --- a/src/test/ui/match/match-arm-statics.rs +++ b/src/test/ui/match/match-arm-statics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![deny(unreachable_patterns)] diff --git a/src/test/ui/match/match-arm-statics.stderr b/src/test/ui/match/match-arm-statics.stderr index 8862be2254f..3d9e900a4e9 100644 --- a/src/test/ui/match/match-arm-statics.stderr +++ b/src/test/ui/match/match-arm-statics.stderr @@ -1,23 +1,23 @@ error: unreachable pattern - --> $DIR/match-arm-statics.rs:35:9 + --> $DIR/match-arm-statics.rs:25:9 | LL | (true, true) => () | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/match-arm-statics.rs:12:9 + --> $DIR/match-arm-statics.rs:2:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/match-arm-statics.rs:50:9 + --> $DIR/match-arm-statics.rs:40:9 | LL | Some(Some(East)) => (), | ^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/match-arm-statics.rs:70:9 + --> $DIR/match-arm-statics.rs:60:9 | LL | Foo { bar: Some(EAST), baz: NewBool(false) } => () | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/match/match-byte-array-patterns-2.rs b/src/test/ui/match/match-byte-array-patterns-2.rs index abb770df107..a3a47d23bef 100644 --- a/src/test/ui/match/match-byte-array-patterns-2.rs +++ b/src/test/ui/match/match-byte-array-patterns-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let buf = &[0, 1, 2, 3]; diff --git a/src/test/ui/match/match-byte-array-patterns-2.stderr b/src/test/ui/match/match-byte-array-patterns-2.stderr index bc52376d824..4030cd39448 100644 --- a/src/test/ui/match/match-byte-array-patterns-2.stderr +++ b/src/test/ui/match/match-byte-array-patterns-2.stderr @@ -1,11 +1,11 @@ error[E0004]: non-exhaustive patterns: `&[_, _, _, _]` not covered - --> $DIR/match-byte-array-patterns-2.rs:14:11 + --> $DIR/match-byte-array-patterns-2.rs:4:11 | LL | match buf { //~ ERROR non-exhaustive | ^^^ pattern `&[_, _, _, _]` not covered error[E0004]: non-exhaustive patterns: `&[]`, `&[_]`, `&[_, _]` and 3 more not covered - --> $DIR/match-byte-array-patterns-2.rs:20:11 + --> $DIR/match-byte-array-patterns-2.rs:10:11 | LL | match buf { //~ ERROR non-exhaustive | ^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 3 more not covered diff --git a/src/test/ui/match/match-byte-array-patterns.rs b/src/test/ui/match/match-byte-array-patterns.rs index 9db4319b786..7541ea3e2e2 100644 --- a/src/test/ui/match/match-byte-array-patterns.rs +++ b/src/test/ui/match/match-byte-array-patterns.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] #![deny(unreachable_patterns)] diff --git a/src/test/ui/match/match-byte-array-patterns.stderr b/src/test/ui/match/match-byte-array-patterns.stderr index da3d57743aa..a23f1853666 100644 --- a/src/test/ui/match/match-byte-array-patterns.stderr +++ b/src/test/ui/match/match-byte-array-patterns.stderr @@ -1,53 +1,53 @@ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:19:9 + --> $DIR/match-byte-array-patterns.rs:9:9 | LL | &[0x41, 0x41, 0x41, 0x41] => {} //~ ERROR unreachable pattern | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/match-byte-array-patterns.rs:12:9 + --> $DIR/match-byte-array-patterns.rs:2:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:25:9 + --> $DIR/match-byte-array-patterns.rs:15:9 | LL | b"AAAA" => {}, //~ ERROR unreachable pattern | ^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:31:9 + --> $DIR/match-byte-array-patterns.rs:21:9 | LL | b"AAAA" => {}, //~ ERROR unreachable pattern | ^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:37:9 + --> $DIR/match-byte-array-patterns.rs:27:9 | LL | b"AAAA" => {}, //~ ERROR unreachable pattern | ^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:45:9 + --> $DIR/match-byte-array-patterns.rs:35:9 | LL | &[0x41, 0x41, 0x41, 0x41] => {} //~ ERROR unreachable pattern | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:51:9 + --> $DIR/match-byte-array-patterns.rs:41:9 | LL | b"AAAA" => {}, //~ ERROR unreachable pattern | ^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:57:9 + --> $DIR/match-byte-array-patterns.rs:47:9 | LL | b"AAAA" => {}, //~ ERROR unreachable pattern | ^^^^^^^ error: unreachable pattern - --> $DIR/match-byte-array-patterns.rs:63:9 + --> $DIR/match-byte-array-patterns.rs:53:9 | LL | b"AAAA" => {}, //~ ERROR unreachable pattern | ^^^^^^^ diff --git a/src/test/ui/match/match-ill-type2.rs b/src/test/ui/match/match-ill-type2.rs index aa47ea670fd..6612f6e392f 100644 --- a/src/test/ui/match/match-ill-type2.rs +++ b/src/test/ui/match/match-ill-type2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match 1i32 { 1i32 => 1, diff --git a/src/test/ui/match/match-ill-type2.stderr b/src/test/ui/match/match-ill-type2.stderr index b649a38476e..116d26ac712 100644 --- a/src/test/ui/match/match-ill-type2.stderr +++ b/src/test/ui/match/match-ill-type2.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/match-ill-type2.rs:14:9 + --> $DIR/match-ill-type2.rs:4:9 | LL | 2u32 => 1, //~ ERROR mismatched types | ^^^^ expected i32, found u32 diff --git a/src/test/ui/match/match-join.rs b/src/test/ui/match/match-join.rs index 888094fd016..b0f2593c853 100644 --- a/src/test/ui/match/match-join.rs +++ b/src/test/ui/match/match-join.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // a good test that we merge paths correctly in the presence of a // variable that's used before it's declared diff --git a/src/test/ui/match/match-join.stderr b/src/test/ui/match/match-join.stderr index a4a8a9d7174..6e08c92bedb 100644 --- a/src/test/ui/match/match-join.stderr +++ b/src/test/ui/match/match-join.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `x` in this scope - --> $DIR/match-join.rs:19:20 + --> $DIR/match-join.rs:9:20 | LL | println!("{}", x); //~ ERROR cannot find value `x` in this scope | ^ not found in this scope diff --git a/src/test/ui/match/match-no-arms-unreachable-after.rs b/src/test/ui/match/match-no-arms-unreachable-after.rs index db08f5e5e66..8f83fd1a318 100644 --- a/src/test/ui/match/match-no-arms-unreachable-after.rs +++ b/src/test/ui/match/match-no-arms-unreachable-after.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![deny(unreachable_code)] diff --git a/src/test/ui/match/match-no-arms-unreachable-after.stderr b/src/test/ui/match/match-no-arms-unreachable-after.stderr index 35fae051870..bd136245c1a 100644 --- a/src/test/ui/match/match-no-arms-unreachable-after.stderr +++ b/src/test/ui/match/match-no-arms-unreachable-after.stderr @@ -1,11 +1,11 @@ error: unreachable statement - --> $DIR/match-no-arms-unreachable-after.rs:18:5 + --> $DIR/match-no-arms-unreachable-after.rs:8:5 | LL | let x = 2; //~ ERROR unreachable | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/match-no-arms-unreachable-after.rs:12:9 + --> $DIR/match-no-arms-unreachable-after.rs:2:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/match/match-non-exhaustive.rs b/src/test/ui/match/match-non-exhaustive.rs index a24d2ed4b7f..3b210a115d2 100644 --- a/src/test/ui/match/match-non-exhaustive.rs +++ b/src/test/ui/match/match-non-exhaustive.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match 0 { 1 => () } //~ ERROR non-exhaustive patterns match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns diff --git a/src/test/ui/match/match-non-exhaustive.stderr b/src/test/ui/match/match-non-exhaustive.stderr index 04f09caceed..ab5ab18c328 100644 --- a/src/test/ui/match/match-non-exhaustive.stderr +++ b/src/test/ui/match/match-non-exhaustive.stderr @@ -1,11 +1,11 @@ -error[E0004]: non-exhaustive patterns: `_` not covered - --> $DIR/match-non-exhaustive.rs:12:11 +error[E0004]: non-exhaustive patterns: `-2147483648i32..=0i32` and `2i32..=2147483647i32` not covered + --> $DIR/match-non-exhaustive.rs:2:11 | LL | match 0 { 1 => () } //~ ERROR non-exhaustive patterns - | ^ pattern `_` not covered + | ^ patterns `-2147483648i32..=0i32` and `2i32..=2147483647i32` not covered error[E0004]: non-exhaustive patterns: `_` not covered - --> $DIR/match-non-exhaustive.rs:13:11 + --> $DIR/match-non-exhaustive.rs:3:11 | LL | match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns | ^ pattern `_` not covered diff --git a/src/test/ui/match/match-pattern-field-mismatch-2.rs b/src/test/ui/match/match-pattern-field-mismatch-2.rs index aed9130d60e..3351c756a31 100644 --- a/src/test/ui/match/match-pattern-field-mismatch-2.rs +++ b/src/test/ui/match/match-pattern-field-mismatch-2.rs @@ -1,26 +1,16 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { - enum color { - rgb(usize, usize, usize), - cmyk(usize, usize, usize, usize), - no_color, + enum Color { + Rgb(usize, usize, usize), + Cmyk(usize, usize, usize, usize), + NoColor, } - fn foo(c: color) { + fn foo(c: Color) { match c { - color::rgb(_, _, _) => { } - color::cmyk(_, _, _, _) => { } - color::no_color(_) => { } - //~^ ERROR expected tuple struct/variant, found unit variant `color::no_color` + Color::Rgb(_, _, _) => { } + Color::Cmyk(_, _, _, _) => { } + Color::NoColor(_) => { } + //~^ ERROR expected tuple struct/variant, found unit variant `Color::NoColor` } } } diff --git a/src/test/ui/match/match-pattern-field-mismatch-2.stderr b/src/test/ui/match/match-pattern-field-mismatch-2.stderr index b43fa9149bd..a42d62e8029 100644 --- a/src/test/ui/match/match-pattern-field-mismatch-2.stderr +++ b/src/test/ui/match/match-pattern-field-mismatch-2.stderr @@ -1,8 +1,8 @@ -error[E0532]: expected tuple struct/variant, found unit variant `color::no_color` - --> $DIR/match-pattern-field-mismatch-2.rs:22:11 +error[E0532]: expected tuple struct/variant, found unit variant `Color::NoColor` + --> $DIR/match-pattern-field-mismatch-2.rs:12:11 | -LL | color::no_color(_) => { } - | ^^^^^^^^^^^^^^^ not a tuple struct/variant +LL | Color::NoColor(_) => { } + | ^^^^^^^^^^^^^^ not a tuple struct/variant error: aborting due to previous error diff --git a/src/test/ui/match/match-pattern-field-mismatch.rs b/src/test/ui/match/match-pattern-field-mismatch.rs index ddd5d633170..1266aec6220 100644 --- a/src/test/ui/match/match-pattern-field-mismatch.rs +++ b/src/test/ui/match/match-pattern-field-mismatch.rs @@ -1,26 +1,16 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { - enum color { - rgb(usize, usize, usize), - cmyk(usize, usize, usize, usize), - no_color, + enum Color { + Rgb(usize, usize, usize), + Cmyk(usize, usize, usize, usize), + NoColor, } - fn foo(c: color) { + fn foo(c: Color) { match c { - color::rgb(_, _) => { } + Color::Rgb(_, _) => { } //~^ ERROR this pattern has 2 fields, but the corresponding tuple variant has 3 fields - color::cmyk(_, _, _, _) => { } - color::no_color => { } + Color::Cmyk(_, _, _, _) => { } + Color::NoColor => { } } } } diff --git a/src/test/ui/match/match-pattern-field-mismatch.stderr b/src/test/ui/match/match-pattern-field-mismatch.stderr index d975f9afc7c..663cd2cd24d 100644 --- a/src/test/ui/match/match-pattern-field-mismatch.stderr +++ b/src/test/ui/match/match-pattern-field-mismatch.stderr @@ -1,7 +1,7 @@ error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 3 fields - --> $DIR/match-pattern-field-mismatch.rs:20:11 + --> $DIR/match-pattern-field-mismatch.rs:10:11 | -LL | color::rgb(_, _) => { } +LL | Color::Rgb(_, _) => { } | ^^^^^^^^^^^^^^^^ expected 3 fields, found 2 error: aborting due to previous error diff --git a/src/test/ui/match/match-privately-empty.rs b/src/test/ui/match/match-privately-empty.rs index 8777ef2ffe3..315eb03d165 100644 --- a/src/test/ui/match/match-privately-empty.rs +++ b/src/test/ui/match/match-privately-empty.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(never_type)] #![feature(exhaustive_patterns)] diff --git a/src/test/ui/match/match-privately-empty.stderr b/src/test/ui/match/match-privately-empty.stderr index 04b4ce00e9b..23ca64e50af 100644 --- a/src/test/ui/match/match-privately-empty.stderr +++ b/src/test/ui/match/match-privately-empty.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered - --> $DIR/match-privately-empty.rs:23:11 + --> $DIR/match-privately-empty.rs:13:11 | LL | match private::DATA { | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered diff --git a/src/test/ui/match/match-range-fail-2.rs b/src/test/ui/match/match-range-fail-2.rs index b42e2ff919a..19e6e12958b 100644 --- a/src/test/ui/match/match-range-fail-2.rs +++ b/src/test/ui/match/match-range-fail-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(exclusive_range_pattern)] fn main() { diff --git a/src/test/ui/match/match-range-fail-2.stderr b/src/test/ui/match/match-range-fail-2.stderr index 616f74ed858..b9e4534fdf5 100644 --- a/src/test/ui/match/match-range-fail-2.stderr +++ b/src/test/ui/match/match-range-fail-2.stderr @@ -1,17 +1,17 @@ error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/match-range-fail-2.rs:15:9 + --> $DIR/match-range-fail-2.rs:5:9 | LL | 6 ..= 1 => { } | ^ lower bound larger than upper bound error[E0579]: lower range bound must be less than upper - --> $DIR/match-range-fail-2.rs:21:9 + --> $DIR/match-range-fail-2.rs:11:9 | LL | 0 .. 0 => { } | ^ error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/match-range-fail-2.rs:27:9 + --> $DIR/match-range-fail-2.rs:17:9 | LL | 0xFFFF_FFFF_FFFF_FFFF ..= 1 => { } | ^^^^^^^^^^^^^^^^^^^^^ lower bound larger than upper bound diff --git a/src/test/ui/match/match-range-fail-dominate.rs b/src/test/ui/match/match-range-fail-dominate.rs index 256aa180f4a..99069183e4e 100644 --- a/src/test/ui/match/match-range-fail-dominate.rs +++ b/src/test/ui/match/match-range-fail-dominate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //error-pattern: unreachable //error-pattern: unreachable //error-pattern: unreachable diff --git a/src/test/ui/match/match-range-fail-dominate.stderr b/src/test/ui/match/match-range-fail-dominate.stderr index d75630e09c5..d35394aa38b 100644 --- a/src/test/ui/match/match-range-fail-dominate.stderr +++ b/src/test/ui/match/match-range-fail-dominate.stderr @@ -1,35 +1,35 @@ error: unreachable pattern - --> $DIR/match-range-fail-dominate.rs:22:7 + --> $DIR/match-range-fail-dominate.rs:12:7 | LL | 5 ... 6 => { } | ^^^^^^^ | note: lint level defined here - --> $DIR/match-range-fail-dominate.rs:17:9 + --> $DIR/match-range-fail-dominate.rs:7:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/match-range-fail-dominate.rs:28:7 + --> $DIR/match-range-fail-dominate.rs:18:7 | LL | 4 ... 6 => { } | ^^^^^^^ error: unreachable pattern - --> $DIR/match-range-fail-dominate.rs:34:7 + --> $DIR/match-range-fail-dominate.rs:24:7 | LL | 4 ... 6 => { } | ^^^^^^^ error: unreachable pattern - --> $DIR/match-range-fail-dominate.rs:40:7 + --> $DIR/match-range-fail-dominate.rs:30:7 | LL | 'a' ... 'z' => {} | ^^^^^^^^^^^ warning: floating-point types cannot be used in patterns - --> $DIR/match-range-fail-dominate.rs:45:7 + --> $DIR/match-range-fail-dominate.rs:35:7 | LL | 0.01f64 ... 6.5f64 => {} | ^^^^^^^ @@ -39,7 +39,7 @@ LL | 0.01f64 ... 6.5f64 => {} = note: for more information, see issue #41620 warning: floating-point types cannot be used in patterns - --> $DIR/match-range-fail-dominate.rs:45:19 + --> $DIR/match-range-fail-dominate.rs:35:19 | LL | 0.01f64 ... 6.5f64 => {} | ^^^^^^ @@ -48,7 +48,7 @@ LL | 0.01f64 ... 6.5f64 => {} = note: for more information, see issue #41620 warning: floating-point types cannot be used in patterns - --> $DIR/match-range-fail-dominate.rs:46:7 + --> $DIR/match-range-fail-dominate.rs:36:7 | LL | 0.02f64 => {} | ^^^^^^^ @@ -57,7 +57,7 @@ LL | 0.02f64 => {} = note: for more information, see issue #41620 error: unreachable pattern - --> $DIR/match-range-fail-dominate.rs:46:7 + --> $DIR/match-range-fail-dominate.rs:36:7 | LL | 0.02f64 => {} | ^^^^^^^ diff --git a/src/test/ui/match/match-range-fail.rs b/src/test/ui/match/match-range-fail.rs index ca99b0c7b89..8a3678577b4 100644 --- a/src/test/ui/match/match-range-fail.rs +++ b/src/test/ui/match/match-range-fail.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match "wow" { "bar" ..= "foo" => { } diff --git a/src/test/ui/match/match-range-fail.stderr b/src/test/ui/match/match-range-fail.stderr index dbc251020a9..54969927433 100644 --- a/src/test/ui/match/match-range-fail.stderr +++ b/src/test/ui/match/match-range-fail.stderr @@ -1,5 +1,5 @@ error[E0029]: only char and numeric types are allowed in range patterns - --> $DIR/match-range-fail.rs:13:9 + --> $DIR/match-range-fail.rs:3:9 | LL | "bar" ..= "foo" => { } | ^^^^^^^^^^^^^^^ ranges require char or numeric types @@ -8,7 +8,7 @@ LL | "bar" ..= "foo" => { } = note: end type: &'static str error[E0029]: only char and numeric types are allowed in range patterns - --> $DIR/match-range-fail.rs:20:16 + --> $DIR/match-range-fail.rs:10:16 | LL | 10 ..= "what" => () | ^^^^^^ ranges require char or numeric types @@ -17,10 +17,10 @@ LL | 10 ..= "what" => () = note: end type: &'static str error[E0308]: mismatched types - --> $DIR/match-range-fail.rs:27:9 + --> $DIR/match-range-fail.rs:17:9 | LL | 'c' ..= 100 => { } - | ^^^^^^^^^^^ expected integral variable, found char + | ^^^^^^^^^^^ expected integer, found char | = note: expected type `{integer}` found type `char` diff --git a/src/test/ui/match/match-ref-ice.rs b/src/test/ui/match/match-ref-ice.rs index cb8f8fad532..dee110f96cd 100644 --- a/src/test/ui/match/match-ref-ice.rs +++ b/src/test/ui/match/match-ref-ice.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unreachable_patterns)] // The arity of `ref x` is always 1. If the pattern is compared to some non-structural type whose diff --git a/src/test/ui/match/match-ref-ice.stderr b/src/test/ui/match/match-ref-ice.stderr index 1dc87afddea..faefd9f2129 100644 --- a/src/test/ui/match/match-ref-ice.stderr +++ b/src/test/ui/match/match-ref-ice.stderr @@ -1,11 +1,11 @@ error: unreachable pattern - --> $DIR/match-ref-ice.rs:23:9 + --> $DIR/match-ref-ice.rs:13:9 | LL | [1, 2, 3] => (), //~ ERROR unreachable pattern | ^^^^^^^^^ | note: lint level defined here - --> $DIR/match-ref-ice.rs:11:9 + --> $DIR/match-ref-ice.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/match/match-ref-mut-invariance.rs b/src/test/ui/match/match-ref-mut-invariance.rs index c2b54a972bd..50b0ede09c2 100644 --- a/src/test/ui/match/match-ref-mut-invariance.rs +++ b/src/test/ui/match/match-ref-mut-invariance.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that when making a ref mut binding with type `&mut T`, the // type `T` must match precisely the type `U` of the value being // matched, and in particular cannot be some supertype of `U`. Issue diff --git a/src/test/ui/match/match-ref-mut-invariance.stderr b/src/test/ui/match/match-ref-mut-invariance.stderr index 24677fe8597..61552b44c27 100644 --- a/src/test/ui/match/match-ref-mut-invariance.stderr +++ b/src/test/ui/match/match-ref-mut-invariance.stderr @@ -1,18 +1,18 @@ error[E0308]: mismatched types - --> $DIR/match-ref-mut-invariance.rs:20:37 + --> $DIR/match-ref-mut-invariance.rs:10:37 | LL | match self.0 { ref mut x => x } //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `&'a mut &'a i32` found type `&'a mut &'b i32` -note: the lifetime 'a as defined on the method body at 19:12... - --> $DIR/match-ref-mut-invariance.rs:19:12 +note: the lifetime 'a as defined on the method body at 9:12... + --> $DIR/match-ref-mut-invariance.rs:9:12 | LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { | ^^ -note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 18:6 - --> $DIR/match-ref-mut-invariance.rs:18:6 +note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 8:6 + --> $DIR/match-ref-mut-invariance.rs:8:6 | LL | impl<'b> S<'b> { | ^^ diff --git a/src/test/ui/match/match-ref-mut-let-invariance.rs b/src/test/ui/match/match-ref-mut-let-invariance.rs index ea16c61dfd4..a62eb714a4d 100644 --- a/src/test/ui/match/match-ref-mut-let-invariance.rs +++ b/src/test/ui/match/match-ref-mut-let-invariance.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that when making a ref mut binding with type `&mut T`, the // type `T` must match precisely the type `U` of the value being // matched, and in particular cannot be some supertype of `U`. Issue diff --git a/src/test/ui/match/match-ref-mut-let-invariance.stderr b/src/test/ui/match/match-ref-mut-let-invariance.stderr index cc096d68ebd..26ec0697f41 100644 --- a/src/test/ui/match/match-ref-mut-let-invariance.stderr +++ b/src/test/ui/match/match-ref-mut-let-invariance.stderr @@ -1,18 +1,18 @@ error[E0308]: mismatched types - --> $DIR/match-ref-mut-let-invariance.rs:21:9 + --> $DIR/match-ref-mut-let-invariance.rs:11:9 | LL | x //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `&'a mut &'a i32` found type `&'a mut &'b i32` -note: the lifetime 'a as defined on the method body at 19:12... - --> $DIR/match-ref-mut-let-invariance.rs:19:12 +note: the lifetime 'a as defined on the method body at 9:12... + --> $DIR/match-ref-mut-let-invariance.rs:9:12 | LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 { | ^^ -note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 18:6 - --> $DIR/match-ref-mut-let-invariance.rs:18:6 +note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 8:6 + --> $DIR/match-ref-mut-let-invariance.rs:8:6 | LL | impl<'b> S<'b> { | ^^ diff --git a/src/test/ui/match/match-slice-patterns.rs b/src/test/ui/match/match-slice-patterns.rs index a8ec95da3d8..afbeb61e441 100644 --- a/src/test/ui/match/match-slice-patterns.rs +++ b/src/test/ui/match/match-slice-patterns.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] fn check(list: &[Option<()>]) { diff --git a/src/test/ui/match/match-slice-patterns.stderr b/src/test/ui/match/match-slice-patterns.stderr index cefd7df8b78..2b817498aba 100644 --- a/src/test/ui/match/match-slice-patterns.stderr +++ b/src/test/ui/match/match-slice-patterns.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `&[_, Some(_), None, _]` not covered - --> $DIR/match-slice-patterns.rs:14:11 + --> $DIR/match-slice-patterns.rs:4:11 | LL | match list { | ^^^^ pattern `&[_, Some(_), None, _]` not covered diff --git a/src/test/ui/match/match-static-const-lc.rs b/src/test/ui/match/match-static-const-lc.rs deleted file mode 100644 index afc858c0c29..00000000000 --- a/src/test/ui/match/match-static-const-lc.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Issue #7526: lowercase static constants in patterns look like bindings - -#![allow(dead_code)] -#![deny(non_upper_case_globals)] - -#[allow(non_upper_case_globals)] -pub const a : isize = 97; - -fn f() { - let r = match (0,0) { - (0, a) => 0, - //~^ ERROR constant in pattern `a` should have an upper case name such as `A` - (x, y) => 1 + x + y, - }; - assert_eq!(r, 1); -} - -mod m { - #[allow(non_upper_case_globals)] - pub const aha : isize = 7; -} - -fn g() { - use self::m::aha; - let r = match (0,0) { - (0, aha) => 0, - //~^ ERROR constant in pattern `aha` should have an upper case name such as `AHA` - (x, y) => 1 + x + y, - }; - assert_eq!(r, 1); -} - -mod n { - pub const OKAY : isize = 8; -} - -fn h() { - use self::n::OKAY as not_okay; - let r = match (0,0) { - (0, not_okay) => 0, -//~^ ERROR constant in pattern `not_okay` should have an upper case name such as `NOT_OKAY` - (x, y) => 1 + x + y, - }; - assert_eq!(r, 1); -} - -fn main () { - f(); - g(); - h(); -} diff --git a/src/test/ui/match/match-static-const-lc.stderr b/src/test/ui/match/match-static-const-lc.stderr deleted file mode 100644 index 08eb5712875..00000000000 --- a/src/test/ui/match/match-static-const-lc.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: constant in pattern `a` should have an upper case name such as `A` - --> $DIR/match-static-const-lc.rs:21:13 - | -LL | (0, a) => 0, - | ^ - | -note: lint level defined here - --> $DIR/match-static-const-lc.rs:14:9 - | -LL | #![deny(non_upper_case_globals)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: constant in pattern `aha` should have an upper case name such as `AHA` - --> $DIR/match-static-const-lc.rs:36:13 - | -LL | (0, aha) => 0, - | ^^^ - -error: constant in pattern `not_okay` should have an upper case name such as `NOT_OKAY` - --> $DIR/match-static-const-lc.rs:50:13 - | -LL | (0, not_okay) => 0, - | ^^^^^^^^ - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/match/match-struct.rs b/src/test/ui/match/match-struct.rs index 0dbdda1f9ba..5961e09a200 100644 --- a/src/test/ui/match/match-struct.rs +++ b/src/test/ui/match/match-struct.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - struct S { a: isize } enum E { C(isize) } diff --git a/src/test/ui/match/match-struct.stderr b/src/test/ui/match/match-struct.stderr index 43f17b2d747..2a24a293e98 100644 --- a/src/test/ui/match/match-struct.stderr +++ b/src/test/ui/match/match-struct.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types - --> $DIR/match-struct.rs:17:9 + --> $DIR/match-struct.rs:6:9 | +LL | match (S { a: 1 }) { + | ------------ this match expression has type `S` LL | E::C(_) => (), | ^^^^^^^ expected struct `S`, found enum `E` | diff --git a/src/test/ui/match/match-tag-nullary.rs b/src/test/ui/match/match-tag-nullary.rs index 0fb26200359..bb2f5996944 100644 --- a/src/test/ui/match/match-tag-nullary.rs +++ b/src/test/ui/match/match-tag-nullary.rs @@ -1,16 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +enum A { A } +enum B { B } -// error-pattern: mismatched types - -enum a { A, } -enum b { B, } - -fn main() { let x: a = a::A; match x { b::B => { } } } +fn main() { let x: A = A::A; match x { B::B => { } } } //~ ERROR mismatched types diff --git a/src/test/ui/match/match-tag-nullary.stderr b/src/test/ui/match/match-tag-nullary.stderr index 869d8ac7747..014581ea4bd 100644 --- a/src/test/ui/match/match-tag-nullary.stderr +++ b/src/test/ui/match/match-tag-nullary.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/match-tag-nullary.rs:16:40 + --> $DIR/match-tag-nullary.rs:4:40 | -LL | fn main() { let x: a = a::A; match x { b::B => { } } } - | ^^^^ expected enum `a`, found enum `b` +LL | fn main() { let x: A = A::A; match x { B::B => { } } } //~ ERROR mismatched types + | ^^^^ expected enum `A`, found enum `B` | - = note: expected type `a` - found type `b` + = note: expected type `A` + found type `B` error: aborting due to previous error diff --git a/src/test/ui/match/match-tag-unary.rs b/src/test/ui/match/match-tag-unary.rs index 48733fd423d..aedceafb439 100644 --- a/src/test/ui/match/match-tag-unary.rs +++ b/src/test/ui/match/match-tag-unary.rs @@ -1,16 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +enum A { A(isize) } +enum B { B(isize) } -// error-pattern: mismatched types - -enum a { A(isize), } -enum b { B(isize), } - -fn main() { let x: a = a::A(0); match x { b::B(y) => { } } } +fn main() { let x: A = A::A(0); match x { B::B(y) => { } } } //~ ERROR mismatched types diff --git a/src/test/ui/match/match-tag-unary.stderr b/src/test/ui/match/match-tag-unary.stderr index bb4deee2569..53b66351369 100644 --- a/src/test/ui/match/match-tag-unary.stderr +++ b/src/test/ui/match/match-tag-unary.stderr @@ -1,11 +1,13 @@ error[E0308]: mismatched types - --> $DIR/match-tag-unary.rs:16:43 + --> $DIR/match-tag-unary.rs:4:43 | -LL | fn main() { let x: a = a::A(0); match x { b::B(y) => { } } } - | ^^^^^^^ expected enum `a`, found enum `b` +LL | fn main() { let x: A = A::A(0); match x { B::B(y) => { } } } //~ ERROR mismatched types + | - ^^^^^^^ expected enum `A`, found enum `B` + | | + | this match expression has type `A` | - = note: expected type `a` - found type `b` + = note: expected type `A` + found type `B` error: aborting due to previous error diff --git a/src/test/ui/match/match-unresolved-one-arm.rs b/src/test/ui/match/match-unresolved-one-arm.rs index ea0f8db99e8..fa65d87b3ab 100644 --- a/src/test/ui/match/match-unresolved-one-arm.rs +++ b/src/test/ui/match/match-unresolved-one-arm.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() -> T { panic!("Rocks for my pillow") } fn main() { diff --git a/src/test/ui/match/match-unresolved-one-arm.stderr b/src/test/ui/match/match-unresolved-one-arm.stderr index fa689a8092b..b013933eaae 100644 --- a/src/test/ui/match/match-unresolved-one-arm.stderr +++ b/src/test/ui/match/match-unresolved-one-arm.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/match-unresolved-one-arm.rs:14:9 + --> $DIR/match-unresolved-one-arm.rs:4:9 | LL | let x = match () { //~ ERROR type annotations needed | ^ diff --git a/src/test/ui/match/match-vec-fixed.rs b/src/test/ui/match/match-vec-fixed.rs index 05971d70167..e611779dec2 100644 --- a/src/test/ui/match/match-vec-fixed.rs +++ b/src/test/ui/match/match-vec-fixed.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unreachable_patterns)] fn a() { diff --git a/src/test/ui/match/match-vec-fixed.stderr b/src/test/ui/match/match-vec-fixed.stderr index 1b85034ef6b..f4b426bea32 100644 --- a/src/test/ui/match/match-vec-fixed.stderr +++ b/src/test/ui/match/match-vec-fixed.stderr @@ -1,17 +1,17 @@ error: unreachable pattern - --> $DIR/match-vec-fixed.rs:17:9 + --> $DIR/match-vec-fixed.rs:7:9 | LL | [_, _, _] => {} //~ ERROR unreachable pattern | ^^^^^^^^^ | note: lint level defined here - --> $DIR/match-vec-fixed.rs:11:9 + --> $DIR/match-vec-fixed.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/match-vec-fixed.rs:21:9 + --> $DIR/match-vec-fixed.rs:11:9 | LL | [_, 1, _] => {} //~ ERROR unreachable pattern | ^^^^^^^^^ diff --git a/src/test/ui/match/match-vec-mismatch-2.rs b/src/test/ui/match/match-vec-mismatch-2.rs index 52c5375f4e7..553095837d3 100644 --- a/src/test/ui/match/match-vec-mismatch-2.rs +++ b/src/test/ui/match/match-vec-mismatch-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match () { [()] => { } diff --git a/src/test/ui/match/match-vec-mismatch-2.stderr b/src/test/ui/match/match-vec-mismatch-2.stderr index 66f58bdff32..5247bea62ce 100644 --- a/src/test/ui/match/match-vec-mismatch-2.stderr +++ b/src/test/ui/match/match-vec-mismatch-2.stderr @@ -1,5 +1,5 @@ error[E0529]: expected an array or slice, found `()` - --> $DIR/match-vec-mismatch-2.rs:13:9 + --> $DIR/match-vec-mismatch-2.rs:3:9 | LL | [()] => { } | ^^^^ pattern cannot match with input type `()` diff --git a/src/test/ui/match/match-vec-mismatch.rs b/src/test/ui/match/match-vec-mismatch.rs index d737aa0029b..5e61c1b22a0 100644 --- a/src/test/ui/match/match-vec-mismatch.rs +++ b/src/test/ui/match/match-vec-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] fn main() { diff --git a/src/test/ui/match/match-vec-mismatch.stderr b/src/test/ui/match/match-vec-mismatch.stderr index c30ddf9d0fa..93a407760a5 100644 --- a/src/test/ui/match/match-vec-mismatch.stderr +++ b/src/test/ui/match/match-vec-mismatch.stderr @@ -1,29 +1,29 @@ error[E0425]: cannot find value `does_not_exist` in this scope - --> $DIR/match-vec-mismatch.rs:38:11 + --> $DIR/match-vec-mismatch.rs:28:11 | LL | match does_not_exist { //~ ERROR cannot find value `does_not_exist` in this scope | ^^^^^^^^^^^^^^ not found in this scope error[E0529]: expected an array or slice, found `std::string::String` - --> $DIR/match-vec-mismatch.rs:15:9 + --> $DIR/match-vec-mismatch.rs:5:9 | LL | ['f', 'o', ..] => {} | ^^^^^^^^^^^^^^ pattern cannot match with input type `std::string::String` error[E0527]: pattern requires 1 elements but array has 3 - --> $DIR/match-vec-mismatch.rs:30:9 + --> $DIR/match-vec-mismatch.rs:20:9 | LL | [0] => {}, //~ ERROR pattern requires | ^^^ expected 3 elements error[E0528]: pattern requires at least 4 elements but array has 3 - --> $DIR/match-vec-mismatch.rs:35:9 + --> $DIR/match-vec-mismatch.rs:25:9 | LL | [0, 1, 2, 3, x..] => {} //~ ERROR pattern requires | ^^^^^^^^^^^^^^^^^ pattern cannot match array of 3 elements error[E0282]: type annotations needed - --> $DIR/match-vec-mismatch.rs:46:9 + --> $DIR/match-vec-mismatch.rs:36:9 | LL | [] => {} //~ ERROR type annotations needed | ^^ cannot infer type diff --git a/src/test/ui/match/match-vec-unreachable.rs b/src/test/ui/match/match-vec-unreachable.rs index d6e3fdbe088..9e167f37ba9 100644 --- a/src/test/ui/match/match-vec-unreachable.rs +++ b/src/test/ui/match/match-vec-unreachable.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] #![deny(unreachable_patterns)] diff --git a/src/test/ui/match/match-vec-unreachable.stderr b/src/test/ui/match/match-vec-unreachable.stderr index e8869e86bf9..71e3d8c5e31 100644 --- a/src/test/ui/match/match-vec-unreachable.stderr +++ b/src/test/ui/match/match-vec-unreachable.stderr @@ -1,23 +1,23 @@ error: unreachable pattern - --> $DIR/match-vec-unreachable.rs:19:9 + --> $DIR/match-vec-unreachable.rs:9:9 | LL | [(1, 2), (2, 3), b] => (), //~ ERROR unreachable pattern | ^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/match-vec-unreachable.rs:12:9 + --> $DIR/match-vec-unreachable.rs:2:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/match-vec-unreachable.rs:29:9 + --> $DIR/match-vec-unreachable.rs:19:9 | LL | [_, _, _, _, _] => { } //~ ERROR unreachable pattern | ^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/match-vec-unreachable.rs:37:9 + --> $DIR/match-vec-unreachable.rs:27:9 | LL | ['a', 'b', 'c'] => {} //~ ERROR unreachable pattern | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/maybe-bounds-where-cpass.rs b/src/test/ui/maybe-bounds-where-cpass.rs index 8ba6863167b..860de200f62 100644 --- a/src/test/ui/maybe-bounds-where-cpass.rs +++ b/src/test/ui/maybe-bounds-where-cpass.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass struct S(*const T) where T: ?Sized; diff --git a/src/test/ui/maybe-bounds-where.rs b/src/test/ui/maybe-bounds-where.rs index 211fac2ee23..cf011653c20 100644 --- a/src/test/ui/maybe-bounds-where.rs +++ b/src/test/ui/maybe-bounds-where.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S1(T) where (T): ?Sized; //~^ ERROR `?Trait` bounds are only permitted at the point where a type parameter is declared diff --git a/src/test/ui/maybe-bounds-where.stderr b/src/test/ui/maybe-bounds-where.stderr index 02aafecb7a4..562e597728e 100644 --- a/src/test/ui/maybe-bounds-where.stderr +++ b/src/test/ui/maybe-bounds-where.stderr @@ -1,41 +1,41 @@ error: `?Trait` bounds are only permitted at the point where a type parameter is declared - --> $DIR/maybe-bounds-where.rs:11:23 + --> $DIR/maybe-bounds-where.rs:1:23 | LL | struct S1(T) where (T): ?Sized; | ^^^ error: `?Trait` bounds are only permitted at the point where a type parameter is declared - --> $DIR/maybe-bounds-where.rs:14:23 + --> $DIR/maybe-bounds-where.rs:4:23 | LL | struct S2(T) where u8: ?Sized; | ^^ error: `?Trait` bounds are only permitted at the point where a type parameter is declared - --> $DIR/maybe-bounds-where.rs:17:23 + --> $DIR/maybe-bounds-where.rs:7:23 | LL | struct S3(T) where &'static T: ?Sized; | ^^^^^^^^^^ error: `?Trait` bounds are only permitted at the point where a type parameter is declared - --> $DIR/maybe-bounds-where.rs:22:31 + --> $DIR/maybe-bounds-where.rs:12:31 | LL | struct S4(T) where for<'a> T: ?Trait<'a>; | ^ error: `?Trait` bounds are only permitted at the point where a type parameter is declared - --> $DIR/maybe-bounds-where.rs:30:18 + --> $DIR/maybe-bounds-where.rs:20:18 | LL | fn f() where T: ?Sized {} | ^ error[E0203]: type parameter has more than one relaxed default bound, only one is supported - --> $DIR/maybe-bounds-where.rs:25:11 + --> $DIR/maybe-bounds-where.rs:15:11 | LL | struct S5(*const T) where T: ?Trait<'static> + ?Sized; | ^ warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default. Only `?Sized` is supported - --> $DIR/maybe-bounds-where.rs:25:11 + --> $DIR/maybe-bounds-where.rs:15:11 | LL | struct S5(*const T) where T: ?Trait<'static> + ?Sized; | ^ diff --git a/src/test/ui/maybe-bounds.rs b/src/test/ui/maybe-bounds.rs index ec8a6b8ffdc..3e07026fb7d 100644 --- a/src/test/ui/maybe-bounds.rs +++ b/src/test/ui/maybe-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits type A1 = Tr + (?Sized); //~ ERROR `?Trait` is not permitted in trait object types diff --git a/src/test/ui/maybe-bounds.stderr b/src/test/ui/maybe-bounds.stderr index db8f7ad8166..58f5b790c09 100644 --- a/src/test/ui/maybe-bounds.stderr +++ b/src/test/ui/maybe-bounds.stderr @@ -1,5 +1,5 @@ error: `?Trait` is not permitted in supertraits - --> $DIR/maybe-bounds.rs:11:11 + --> $DIR/maybe-bounds.rs:1:11 | LL | trait Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits | ^^^^^^ @@ -7,13 +7,13 @@ LL | trait Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits = note: traits are `?Sized` by default error: `?Trait` is not permitted in trait object types - --> $DIR/maybe-bounds.rs:13:16 + --> $DIR/maybe-bounds.rs:3:16 | LL | type A1 = Tr + (?Sized); //~ ERROR `?Trait` is not permitted in trait object types | ^^^^^^^^ error: `?Trait` is not permitted in trait object types - --> $DIR/maybe-bounds.rs:14:24 + --> $DIR/maybe-bounds.rs:4:24 | LL | type A2 = for<'a> Tr + (?Sized); //~ ERROR `?Trait` is not permitted in trait object types | ^^^^^^^^ diff --git a/src/test/ui/meta-expected-error-correct-rev.a.stderr b/src/test/ui/meta-expected-error-correct-rev.a.stderr index 20b93068c64..b561a9e5b3a 100644 --- a/src/test/ui/meta-expected-error-correct-rev.a.stderr +++ b/src/test/ui/meta-expected-error-correct-rev.a.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/meta-expected-error-correct-rev.rs:17:18 + --> $DIR/meta-expected-error-correct-rev.rs:7:18 | LL | let x: u32 = 22_usize; //[a]~ ERROR mismatched types | ^^^^^^^^ expected u32, found usize diff --git a/src/test/ui/meta-expected-error-correct-rev.rs b/src/test/ui/meta-expected-error-correct-rev.rs index bd70879d13e..b06a64b15c8 100644 --- a/src/test/ui/meta-expected-error-correct-rev.rs +++ b/src/test/ui/meta-expected-error-correct-rev.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: a // Counterpart to `meta-expected-error-wrong-rev.rs` diff --git a/src/test/ui/methods/auxiliary/ambig_impl_2_lib.rs b/src/test/ui/methods/auxiliary/ambig_impl_2_lib.rs index 4ba0ccdba9b..0ed68bf6901 100644 --- a/src/test/ui/methods/auxiliary/ambig_impl_2_lib.rs +++ b/src/test/ui/methods/auxiliary/ambig_impl_2_lib.rs @@ -1,14 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub trait me { +pub trait Me { fn me(&self) -> usize; } -impl me for usize { fn me(&self) -> usize { *self } } +impl Me for usize { fn me(&self) -> usize { *self } } diff --git a/src/test/ui/methods/auxiliary/macro-in-other-crate.rs b/src/test/ui/methods/auxiliary/macro-in-other-crate.rs index c787cedc2d0..feda084634a 100644 --- a/src/test/ui/methods/auxiliary/macro-in-other-crate.rs +++ b/src/test/ui/methods/auxiliary/macro-in-other-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! mac { ($ident:ident) => { let $ident = 42; } diff --git a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.rs b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.rs index 9acf5a52166..590e98dc353 100644 --- a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.rs +++ b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.rs @@ -1,26 +1,16 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that we invoking `foo()` successfully resolves to the trait `foo` +// Test that we invoking `foo()` successfully resolves to the trait `Foo` // (prompting the mismatched types error) but does not influence the choice // of what kind of `Vec` we have, eventually leading to a type error. -trait foo { +trait Foo { fn foo(&self) -> isize; } -impl foo for Vec { +impl Foo for Vec { fn foo(&self) -> isize {1} } -impl foo for Vec { +impl Foo for Vec { fn foo(&self) -> isize {2} } diff --git a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr index 7f034b9e53d..53a07f5196e 100644 --- a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr +++ b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/method-ambig-one-trait-unknown-int-type.rs:34:17 + --> $DIR/method-ambig-one-trait-unknown-int-type.rs:24:17 | LL | let mut x = Vec::new(); | ----- ^^^^^^^^ cannot infer type for `T` @@ -7,7 +7,7 @@ LL | let mut x = Vec::new(); | consider giving `x` a type error[E0308]: mismatched types - --> $DIR/method-ambig-one-trait-unknown-int-type.rs:43:20 + --> $DIR/method-ambig-one-trait-unknown-int-type.rs:33:20 | LL | let y: usize = x.foo(); //~ ERROR mismatched types | ^^^^^^^ expected usize, found isize diff --git a/src/test/ui/methods/method-ambig-two-traits-cross-crate.rs b/src/test/ui/methods/method-ambig-two-traits-cross-crate.rs index c1d4551fd9e..006e315b02c 100644 --- a/src/test/ui/methods/method-ambig-two-traits-cross-crate.rs +++ b/src/test/ui/methods/method-ambig-two-traits-cross-crate.rs @@ -1,21 +1,11 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test an ambiguity scenario where one copy of the method is available // from a trait imported from another crate. // aux-build:ambig_impl_2_lib.rs extern crate ambig_impl_2_lib; -use ambig_impl_2_lib::me; -trait me2 { +use ambig_impl_2_lib::Me; +trait Me2 { fn me(&self) -> usize; } -impl me2 for usize { fn me(&self) -> usize { *self } } +impl Me2 for usize { fn me(&self) -> usize { *self } } fn main() { 1_usize.me(); } //~ ERROR E0034 diff --git a/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr b/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr index 7a75f20f65a..15379194777 100644 --- a/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr @@ -1,15 +1,15 @@ error[E0034]: multiple applicable items in scope - --> $DIR/method-ambig-two-traits-cross-crate.rs:21:21 + --> $DIR/method-ambig-two-traits-cross-crate.rs:11:21 | LL | fn main() { 1_usize.me(); } //~ ERROR E0034 | ^^ multiple `me` found | -note: candidate #1 is defined in an impl of the trait `me2` for the type `usize` - --> $DIR/method-ambig-two-traits-cross-crate.rs:20:22 +note: candidate #1 is defined in an impl of the trait `Me2` for the type `usize` + --> $DIR/method-ambig-two-traits-cross-crate.rs:10:22 | -LL | impl me2 for usize { fn me(&self) -> usize { *self } } +LL | impl Me2 for usize { fn me(&self) -> usize { *self } } | ^^^^^^^^^^^^^^^^^^^^^ - = note: candidate #2 is defined in an impl of the trait `ambig_impl_2_lib::me` for the type `usize` + = note: candidate #2 is defined in an impl of the trait `ambig_impl_2_lib::Me` for the type `usize` error: aborting due to previous error diff --git a/src/test/ui/methods/method-ambig-two-traits-from-bounds.rs b/src/test/ui/methods/method-ambig-two-traits-from-bounds.rs index 184927c0135..e3cc5557f42 100644 --- a/src/test/ui/methods/method-ambig-two-traits-from-bounds.rs +++ b/src/test/ui/methods/method-ambig-two-traits-from-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait A { fn foo(&self); } trait B { fn foo(&self); } diff --git a/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr b/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr index 06003d900b7..a805ca3ca56 100644 --- a/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr @@ -1,17 +1,17 @@ error[E0034]: multiple applicable items in scope - --> $DIR/method-ambig-two-traits-from-bounds.rs:15:7 + --> $DIR/method-ambig-two-traits-from-bounds.rs:5:7 | LL | t.foo(); //~ ERROR E0034 | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `A` - --> $DIR/method-ambig-two-traits-from-bounds.rs:11:11 + --> $DIR/method-ambig-two-traits-from-bounds.rs:1:11 | LL | trait A { fn foo(&self); } | ^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `A::foo(t)` instead note: candidate #2 is defined in the trait `B` - --> $DIR/method-ambig-two-traits-from-bounds.rs:12:11 + --> $DIR/method-ambig-two-traits-from-bounds.rs:2:11 | LL | trait B { fn foo(&self); } | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/methods/method-ambig-two-traits-with-default-method.rs b/src/test/ui/methods/method-ambig-two-traits-with-default-method.rs index 17312fb1869..aa7094b9e6e 100644 --- a/src/test/ui/methods/method-ambig-two-traits-with-default-method.rs +++ b/src/test/ui/methods/method-ambig-two-traits-with-default-method.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we correctly report an ambiguity where two applicable traits // are in scope and the method being invoked is a default method not // defined directly in the impl. diff --git a/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr b/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr index d67e17d228f..cbb1754935a 100644 --- a/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr @@ -1,16 +1,16 @@ error[E0034]: multiple applicable items in scope - --> $DIR/method-ambig-two-traits-with-default-method.rs:22:13 + --> $DIR/method-ambig-two-traits-with-default-method.rs:12:13 | LL | 1_usize.method(); //~ ERROR E0034 | ^^^^^^ multiple `method` found | note: candidate #1 is defined in an impl of the trait `Foo` for the type `usize` - --> $DIR/method-ambig-two-traits-with-default-method.rs:15:13 + --> $DIR/method-ambig-two-traits-with-default-method.rs:5:13 | LL | trait Foo { fn method(&self) {} } | ^^^^^^^^^^^^^^^^ note: candidate #2 is defined in an impl of the trait `Bar` for the type `usize` - --> $DIR/method-ambig-two-traits-with-default-method.rs:16:13 + --> $DIR/method-ambig-two-traits-with-default-method.rs:6:13 | LL | trait Bar { fn method(&self) {} } | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/methods/method-call-err-msg.rs b/src/test/ui/methods/method-call-err-msg.rs index 3434cf96fce..e0dec0a4a70 100644 --- a/src/test/ui/methods/method-call-err-msg.rs +++ b/src/test/ui/methods/method-call-err-msg.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that parameter cardinality or missing method error gets span exactly. pub struct Foo; diff --git a/src/test/ui/methods/method-call-err-msg.stderr b/src/test/ui/methods/method-call-err-msg.stderr index 3e5bbdfa8f8..2113add63d6 100644 --- a/src/test/ui/methods/method-call-err-msg.stderr +++ b/src/test/ui/methods/method-call-err-msg.stderr @@ -1,5 +1,5 @@ error[E0061]: this function takes 0 parameters but 1 parameter was supplied - --> $DIR/method-call-err-msg.rs:22:7 + --> $DIR/method-call-err-msg.rs:12:7 | LL | fn zero(self) -> Foo { self } | -------------------- defined here @@ -8,7 +8,7 @@ LL | x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter | ^^^^ expected 0 parameters error[E0061]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/method-call-err-msg.rs:23:7 + --> $DIR/method-call-err-msg.rs:13:7 | LL | fn one(self, _: isize) -> Foo { self } | ----------------------------- defined here @@ -17,7 +17,7 @@ LL | .one() //~ ERROR this function takes 1 parameter but 0 parameters | ^^^ expected 1 parameter error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/method-call-err-msg.rs:24:7 + --> $DIR/method-call-err-msg.rs:14:7 | LL | fn two(self, _: isize, _: isize) -> Foo { self } | --------------------------------------- defined here @@ -26,7 +26,7 @@ LL | .two(0); //~ ERROR this function takes 2 parameters but 1 parameter | ^^^ expected 2 parameters error[E0599]: no method named `take` found for type `Foo` in the current scope - --> $DIR/method-call-err-msg.rs:28:7 + --> $DIR/method-call-err-msg.rs:18:7 | LL | pub struct Foo; | --------------- method `take` not found for this diff --git a/src/test/ui/methods/method-call-lifetime-args-fail.rs b/src/test/ui/methods/method-call-lifetime-args-fail.rs index 980ada9020c..938a7f5575e 100644 --- a/src/test/ui/methods/method-call-lifetime-args-fail.rs +++ b/src/test/ui/methods/method-call-lifetime-args-fail.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S; impl S { diff --git a/src/test/ui/methods/method-call-lifetime-args-fail.stderr b/src/test/ui/methods/method-call-lifetime-args-fail.stderr index ce283ec964e..74dab5f4400 100644 --- a/src/test/ui/methods/method-call-lifetime-args-fail.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-fail.stderr @@ -1,191 +1,191 @@ error[E0107]: wrong number of lifetime arguments: expected 2, found 1 - --> $DIR/method-call-lifetime-args-fail.rs:26:7 + --> $DIR/method-call-lifetime-args-fail.rs:16:7 | LL | S.early::<'static>(); | ^^^^^ expected 2 lifetime arguments error[E0107]: wrong number of lifetime arguments: expected 2, found 3 - --> $DIR/method-call-lifetime-args-fail.rs:28:33 + --> $DIR/method-call-lifetime-args-fail.rs:18:33 | LL | S.early::<'static, 'static, 'static>(); | ^^^^^^^ unexpected lifetime argument error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:37:15 + --> $DIR/method-call-lifetime-args-fail.rs:27:15 | LL | S::late::<'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:14:13 + --> $DIR/method-call-lifetime-args-fail.rs:4:13 | LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:39:15 + --> $DIR/method-call-lifetime-args-fail.rs:29:15 | LL | S::late::<'static, 'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:14:13 + --> $DIR/method-call-lifetime-args-fail.rs:4:13 | LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:41:15 + --> $DIR/method-call-lifetime-args-fail.rs:31:15 | LL | S::late::<'static, 'static, 'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:14:13 + --> $DIR/method-call-lifetime-args-fail.rs:4:13 | LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:44:21 + --> $DIR/method-call-lifetime-args-fail.rs:34:21 | LL | S::late_early::<'static, 'static>(S, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:17:19 + --> $DIR/method-call-lifetime-args-fail.rs:7:19 | LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} } | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:46:21 + --> $DIR/method-call-lifetime-args-fail.rs:36:21 | LL | S::late_early::<'static, 'static, 'static>(S, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:17:19 + --> $DIR/method-call-lifetime-args-fail.rs:7:19 | LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} } | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:50:24 + --> $DIR/method-call-lifetime-args-fail.rs:40:24 | LL | S::late_implicit::<'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:15:31 + --> $DIR/method-call-lifetime-args-fail.rs:5:31 | LL | fn late_implicit(self, _: &u8, _: &u8) {} | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:52:24 + --> $DIR/method-call-lifetime-args-fail.rs:42:24 | LL | S::late_implicit::<'static, 'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:15:31 + --> $DIR/method-call-lifetime-args-fail.rs:5:31 | LL | fn late_implicit(self, _: &u8, _: &u8) {} | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:54:24 + --> $DIR/method-call-lifetime-args-fail.rs:44:24 | LL | S::late_implicit::<'static, 'static, 'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:15:31 + --> $DIR/method-call-lifetime-args-fail.rs:5:31 | LL | fn late_implicit(self, _: &u8, _: &u8) {} | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:57:30 + --> $DIR/method-call-lifetime-args-fail.rs:47:30 | LL | S::late_implicit_early::<'static, 'static>(S, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:18:41 + --> $DIR/method-call-lifetime-args-fail.rs:8:41 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:59:30 + --> $DIR/method-call-lifetime-args-fail.rs:49:30 | LL | S::late_implicit_early::<'static, 'static, 'static>(S, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:18:41 + --> $DIR/method-call-lifetime-args-fail.rs:8:41 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:62:35 + --> $DIR/method-call-lifetime-args-fail.rs:52:35 | LL | S::late_implicit_self_early::<'static, 'static>(&S); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:19:37 + --> $DIR/method-call-lifetime-args-fail.rs:9:37 | LL | fn late_implicit_self_early<'b>(&self) -> &'b u8 { loop {} } | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:64:35 + --> $DIR/method-call-lifetime-args-fail.rs:54:35 | LL | S::late_implicit_self_early::<'static, 'static, 'static>(&S); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:19:37 + --> $DIR/method-call-lifetime-args-fail.rs:9:37 | LL | fn late_implicit_self_early<'b>(&self) -> &'b u8 { loop {} } | ^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:67:28 + --> $DIR/method-call-lifetime-args-fail.rs:57:28 | LL | S::late_unused_early::<'static, 'static>(S); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:20:26 + --> $DIR/method-call-lifetime-args-fail.rs:10:26 | LL | fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} } | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-fail.rs:69:28 + --> $DIR/method-call-lifetime-args-fail.rs:59:28 | LL | S::late_unused_early::<'static, 'static, 'static>(S); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args-fail.rs:20:26 + --> $DIR/method-call-lifetime-args-fail.rs:10:26 | LL | fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} } | ^^ error[E0107]: wrong number of lifetime arguments: expected 2, found 1 - --> $DIR/method-call-lifetime-args-fail.rs:73:5 + --> $DIR/method-call-lifetime-args-fail.rs:63:5 | LL | S::early::<'static>(S); | ^^^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments error[E0107]: wrong number of lifetime arguments: expected 2, found 3 - --> $DIR/method-call-lifetime-args-fail.rs:75:34 + --> $DIR/method-call-lifetime-args-fail.rs:65:34 | LL | S::early::<'static, 'static, 'static>(S); | ^^^^^^^ unexpected lifetime argument diff --git a/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs b/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs index b2a94e0af42..36a1a2fda69 100644 --- a/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs +++ b/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(late_bound_lifetime_arguments)] #![allow(unused)] diff --git a/src/test/ui/methods/method-call-lifetime-args-lint-fail.stderr b/src/test/ui/methods/method-call-lifetime-args-lint-fail.stderr index 34747edc2a0..b510a08ae37 100644 --- a/src/test/ui/methods/method-call-lifetime-args-lint-fail.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-lint-fail.stderr @@ -1,5 +1,5 @@ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:33:14 + --> $DIR/method-call-lifetime-args-lint-fail.rs:23:14 | LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | -- the late bound lifetime parameter is introduced here @@ -8,7 +8,7 @@ LL | S.late::<'static>(&0, &0); | ^^^^^^^ | note: lint level defined here - --> $DIR/method-call-lifetime-args-lint-fail.rs:11:9 + --> $DIR/method-call-lifetime-args-lint-fail.rs:1:9 | LL | #![deny(late_bound_lifetime_arguments)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | #![deny(late_bound_lifetime_arguments)] = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:36:14 + --> $DIR/method-call-lifetime-args-lint-fail.rs:26:14 | LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | -- the late bound lifetime parameter is introduced here @@ -28,7 +28,7 @@ LL | S.late::<'static, 'static>(&0, &0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:39:14 + --> $DIR/method-call-lifetime-args-lint-fail.rs:29:14 | LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | -- the late bound lifetime parameter is introduced here @@ -40,7 +40,7 @@ LL | S.late::<'static, 'static, 'static>(&0, &0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:43:20 + --> $DIR/method-call-lifetime-args-lint-fail.rs:33:20 | LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} } | -- the late bound lifetime parameter is introduced here @@ -52,7 +52,7 @@ LL | S.late_early::<'static>(&0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:46:20 + --> $DIR/method-call-lifetime-args-lint-fail.rs:36:20 | LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} } | -- the late bound lifetime parameter is introduced here @@ -64,7 +64,7 @@ LL | S.late_early::<'static, 'static>(&0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:49:20 + --> $DIR/method-call-lifetime-args-lint-fail.rs:39:20 | LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} } | -- the late bound lifetime parameter is introduced here @@ -76,7 +76,7 @@ LL | S.late_early::<'static, 'static, 'static>(&0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:54:23 + --> $DIR/method-call-lifetime-args-lint-fail.rs:44:23 | LL | fn late_implicit(self, _: &u8, _: &u8) {} | - the late bound lifetime parameter is introduced here @@ -88,7 +88,7 @@ LL | S.late_implicit::<'static>(&0, &0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:57:23 + --> $DIR/method-call-lifetime-args-lint-fail.rs:47:23 | LL | fn late_implicit(self, _: &u8, _: &u8) {} | - the late bound lifetime parameter is introduced here @@ -100,7 +100,7 @@ LL | S.late_implicit::<'static, 'static>(&0, &0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:60:23 + --> $DIR/method-call-lifetime-args-lint-fail.rs:50:23 | LL | fn late_implicit(self, _: &u8, _: &u8) {} | - the late bound lifetime parameter is introduced here @@ -112,7 +112,7 @@ LL | S.late_implicit::<'static, 'static, 'static>(&0, &0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:64:29 + --> $DIR/method-call-lifetime-args-lint-fail.rs:54:29 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } | - the late bound lifetime parameter is introduced here @@ -124,7 +124,7 @@ LL | S.late_implicit_early::<'static>(&0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:67:29 + --> $DIR/method-call-lifetime-args-lint-fail.rs:57:29 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } | - the late bound lifetime parameter is introduced here @@ -136,7 +136,7 @@ LL | S.late_implicit_early::<'static, 'static>(&0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:70:29 + --> $DIR/method-call-lifetime-args-lint-fail.rs:60:29 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } | - the late bound lifetime parameter is introduced here @@ -148,7 +148,7 @@ LL | S.late_implicit_early::<'static, 'static, 'static>(&0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:79:21 + --> $DIR/method-call-lifetime-args-lint-fail.rs:69:21 | LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} } | -- the late bound lifetime parameter is introduced here @@ -160,7 +160,7 @@ LL | S::late_early::<'static>(S, &0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:83:30 + --> $DIR/method-call-lifetime-args-lint-fail.rs:73:30 | LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} } | - the late bound lifetime parameter is introduced here @@ -172,7 +172,7 @@ LL | S::late_implicit_early::<'static>(S, &0); = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint-fail.rs:92:9 + --> $DIR/method-call-lifetime-args-lint-fail.rs:82:9 | LL | fn f<'early, 'late, T: 'early>() {} | ----- the late bound lifetime parameter is introduced here diff --git a/src/test/ui/methods/method-call-lifetime-args-lint.rs b/src/test/ui/methods/method-call-lifetime-args-lint.rs index f9a4f712e57..14729e1e27e 100644 --- a/src/test/ui/methods/method-call-lifetime-args-lint.rs +++ b/src/test/ui/methods/method-call-lifetime-args-lint.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(late_bound_lifetime_arguments)] #![allow(unused)] diff --git a/src/test/ui/methods/method-call-lifetime-args-lint.stderr b/src/test/ui/methods/method-call-lifetime-args-lint.stderr index 1cb6804fa47..eb1d4fe2e50 100644 --- a/src/test/ui/methods/method-call-lifetime-args-lint.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-lint.stderr @@ -1,5 +1,5 @@ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint.rs:22:14 + --> $DIR/method-call-lifetime-args-lint.rs:12:14 | LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | -- the late bound lifetime parameter is introduced here @@ -8,7 +8,7 @@ LL | S.late::<'static>(&0, &0); | ^^^^^^^ | note: lint level defined here - --> $DIR/method-call-lifetime-args-lint.rs:11:9 + --> $DIR/method-call-lifetime-args-lint.rs:1:9 | LL | #![deny(late_bound_lifetime_arguments)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | #![deny(late_bound_lifetime_arguments)] = note: for more information, see issue #42868 error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args-lint.rs:26:23 + --> $DIR/method-call-lifetime-args-lint.rs:16:23 | LL | fn late_implicit(self, _: &u8, _: &u8) {} | - the late bound lifetime parameter is introduced here diff --git a/src/test/ui/methods/method-call-lifetime-args-subst-index.rs b/src/test/ui/methods/method-call-lifetime-args-subst-index.rs index 43a18fba9b8..4ee09dcdf19 100644 --- a/src/test/ui/methods/method-call-lifetime-args-subst-index.rs +++ b/src/test/ui/methods/method-call-lifetime-args-subst-index.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused)] diff --git a/src/test/ui/methods/method-call-lifetime-args-unresolved.rs b/src/test/ui/methods/method-call-lifetime-args-unresolved.rs index 4910bfaf4f6..d16ba3df47b 100644 --- a/src/test/ui/methods/method-call-lifetime-args-unresolved.rs +++ b/src/test/ui/methods/method-call-lifetime-args-unresolved.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { 0.clone::<'a>(); //~ ERROR use of undeclared lifetime name `'a` } diff --git a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr index 8eb860d9474..25432177a85 100644 --- a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr @@ -1,5 +1,5 @@ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/method-call-lifetime-args-unresolved.rs:12:15 + --> $DIR/method-call-lifetime-args-unresolved.rs:2:15 | LL | 0.clone::<'a>(); //~ ERROR use of undeclared lifetime name `'a` | ^^ undeclared lifetime diff --git a/src/test/ui/methods/method-call-lifetime-args.rs b/src/test/ui/methods/method-call-lifetime-args.rs index 7ce3ebb8bee..3292e9fcdf8 100644 --- a/src/test/ui/methods/method-call-lifetime-args.rs +++ b/src/test/ui/methods/method-call-lifetime-args.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S; impl S { diff --git a/src/test/ui/methods/method-call-lifetime-args.stderr b/src/test/ui/methods/method-call-lifetime-args.stderr index 8bc48cc8e73..64ae79e9bb2 100644 --- a/src/test/ui/methods/method-call-lifetime-args.stderr +++ b/src/test/ui/methods/method-call-lifetime-args.stderr @@ -1,23 +1,23 @@ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args.rs:19:15 + --> $DIR/method-call-lifetime-args.rs:9:15 | LL | S::late::<'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args.rs:14:13 + --> $DIR/method-call-lifetime-args.rs:4:13 | LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {} | ^^ error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/method-call-lifetime-args.rs:21:24 + --> $DIR/method-call-lifetime-args.rs:11:24 | LL | S::late_implicit::<'static>(S, &0, &0); | ^^^^^^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/method-call-lifetime-args.rs:15:31 + --> $DIR/method-call-lifetime-args.rs:5:31 | LL | fn late_implicit(self, _: &u8, _: &u8) {} | ^ diff --git a/src/test/ui/methods/method-call-type-binding.rs b/src/test/ui/methods/method-call-type-binding.rs index 6c0793ee78f..f547ca8d1c2 100644 --- a/src/test/ui/methods/method-call-type-binding.rs +++ b/src/test/ui/methods/method-call-type-binding.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { 0.clone::(); //~ ERROR associated type bindings are not allowed here } diff --git a/src/test/ui/methods/method-call-type-binding.stderr b/src/test/ui/methods/method-call-type-binding.stderr index aafc84804b5..27d6f93490b 100644 --- a/src/test/ui/methods/method-call-type-binding.stderr +++ b/src/test/ui/methods/method-call-type-binding.stderr @@ -1,5 +1,5 @@ error[E0229]: associated type bindings are not allowed here - --> $DIR/method-call-type-binding.rs:12:15 + --> $DIR/method-call-type-binding.rs:2:15 | LL | 0.clone::(); //~ ERROR associated type bindings are not allowed here | ^^^^^^ associated type not allowed here diff --git a/src/test/ui/methods/method-macro-backtrace.rs b/src/test/ui/methods/method-macro-backtrace.rs index f3c227849dc..00fe32b7c15 100644 --- a/src/test/ui/methods/method-macro-backtrace.rs +++ b/src/test/ui/methods/method-macro-backtrace.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // forbid-output: in this expansion of macro_rules! make_method { diff --git a/src/test/ui/methods/method-macro-backtrace.stderr b/src/test/ui/methods/method-macro-backtrace.stderr index 28f46dba1cc..81098bbceb0 100644 --- a/src/test/ui/methods/method-macro-backtrace.stderr +++ b/src/test/ui/methods/method-macro-backtrace.stderr @@ -1,5 +1,5 @@ error[E0201]: duplicate definitions with name `bar`: - --> $DIR/method-macro-backtrace.rs:32:5 + --> $DIR/method-macro-backtrace.rs:22:5 | LL | fn bar(&self) { } | ----------------- previous definition of `bar` here diff --git a/src/test/ui/methods/method-missing-call.rs b/src/test/ui/methods/method-missing-call.rs index 7a6ea94d977..7ce1e9a4f1b 100644 --- a/src/test/ui/methods/method-missing-call.rs +++ b/src/test/ui/methods/method-missing-call.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests to make sure that parens are needed for method calls without arguments. // outputs text to make sure either an anonymous function is provided or // open-close '()' parens are given diff --git a/src/test/ui/methods/method-missing-call.stderr b/src/test/ui/methods/method-missing-call.stderr index 82d04cb06dd..886d92aa925 100644 --- a/src/test/ui/methods/method-missing-call.stderr +++ b/src/test/ui/methods/method-missing-call.stderr @@ -1,18 +1,14 @@ error[E0615]: attempted to take value of method `get_x` on type `Point` - --> $DIR/method-missing-call.rs:32:26 + --> $DIR/method-missing-call.rs:22:26 | LL | .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point` - | ^^^^^ - | - = help: maybe a `()` to call it is missing? + | ^^^^^ help: use parentheses to call the method: `get_x()` -error[E0615]: attempted to take value of method `filter_map` on type `std::iter::Filter, [closure@$DIR/method-missing-call.rs:37:20: 37:25]>, [closure@$DIR/method-missing-call.rs:38:23: 38:35]>` - --> $DIR/method-missing-call.rs:39:16 +error[E0615]: attempted to take value of method `filter_map` on type `std::iter::Filter, [closure@$DIR/method-missing-call.rs:27:20: 27:25]>, [closure@$DIR/method-missing-call.rs:28:23: 28:35]>` + --> $DIR/method-missing-call.rs:29:16 | LL | .filter_map; //~ ERROR attempted to take value of method `filter_map` on type - | ^^^^^^^^^^ - | - = help: maybe a `()` to call it is missing? + | ^^^^^^^^^^ help: use parentheses to call the method: `filter_map(...)` error: aborting due to 2 previous errors diff --git a/src/test/ui/methods/method-on-ambiguous-numeric-type.rs b/src/test/ui/methods/method-on-ambiguous-numeric-type.rs index 2b6e830ec59..82f47438d50 100644 --- a/src/test/ui/methods/method-on-ambiguous-numeric-type.rs +++ b/src/test/ui/methods/method-on-ambiguous-numeric-type.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:macro-in-other-crate.rs #[macro_use] extern crate macro_in_other_crate; diff --git a/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr index 796520e0ec7..40e765abe27 100644 --- a/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr +++ b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr @@ -1,5 +1,5 @@ error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` - --> $DIR/method-on-ambiguous-numeric-type.rs:20:17 + --> $DIR/method-on-ambiguous-numeric-type.rs:10:17 | LL | let x = 2.0.neg(); | ^^^ @@ -9,7 +9,7 @@ LL | let x = 2.0_f32.neg(); | ^^^^^^^ error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` - --> $DIR/method-on-ambiguous-numeric-type.rs:24:15 + --> $DIR/method-on-ambiguous-numeric-type.rs:14:15 | LL | let x = y.neg(); | ^^^ @@ -19,7 +19,7 @@ LL | let y: f32 = 2.0; | ^^^^^^ error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}` - --> $DIR/method-on-ambiguous-numeric-type.rs:29:26 + --> $DIR/method-on-ambiguous-numeric-type.rs:19:26 | LL | for i in 0..100 { | - you must specify a type for this binding, like `i32` @@ -27,7 +27,7 @@ LL | println!("{}", i.pow(2)); | ^^^ error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}` - --> $DIR/method-on-ambiguous-numeric-type.rs:34:15 + --> $DIR/method-on-ambiguous-numeric-type.rs:24:15 | LL | local_bar.pow(2); | ^^^ @@ -37,7 +37,7 @@ LL | ($ident:ident) => { let $ident: i32 = 42; } | ^^^^^^^^^^^ error[E0689]: can't call method `pow` on ambiguous numeric type `{integer}` - --> $DIR/method-on-ambiguous-numeric-type.rs:40:9 + --> $DIR/method-on-ambiguous-numeric-type.rs:30:9 | LL | mac!(bar); | ---------- you must specify a type for this binding, like `i32` diff --git a/src/test/ui/methods/method-path-in-pattern.rs b/src/test/ui/methods/method-path-in-pattern.rs index 671a518073c..fb1cf7f71e7 100644 --- a/src/test/ui/methods/method-path-in-pattern.rs +++ b/src/test/ui/methods/method-path-in-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; impl Foo { diff --git a/src/test/ui/methods/method-path-in-pattern.stderr b/src/test/ui/methods/method-path-in-pattern.stderr index 1fae336c79c..03d6509c915 100644 --- a/src/test/ui/methods/method-path-in-pattern.stderr +++ b/src/test/ui/methods/method-path-in-pattern.stderr @@ -1,17 +1,17 @@ error[E0533]: expected unit struct/variant or constant, found method `::bar` - --> $DIR/method-path-in-pattern.rs:25:9 + --> $DIR/method-path-in-pattern.rs:15:9 | LL | Foo::bar => {} | ^^^^^^^^ error[E0533]: expected unit struct/variant or constant, found method `::bar` - --> $DIR/method-path-in-pattern.rs:29:9 + --> $DIR/method-path-in-pattern.rs:19:9 | LL | ::bar => {} | ^^^^^^^^^^ error[E0533]: expected unit struct/variant or constant, found method `::trait_bar` - --> $DIR/method-path-in-pattern.rs:33:9 + --> $DIR/method-path-in-pattern.rs:23:9 | LL | ::trait_bar => {} | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/methods/method-resolvable-path-in-pattern.rs b/src/test/ui/methods/method-resolvable-path-in-pattern.rs index 4d8959466b9..1d373cfa6a7 100644 --- a/src/test/ui/methods/method-resolvable-path-in-pattern.rs +++ b/src/test/ui/methods/method-resolvable-path-in-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; trait MyTrait { diff --git a/src/test/ui/methods/method-resolvable-path-in-pattern.stderr b/src/test/ui/methods/method-resolvable-path-in-pattern.stderr index c86367dac08..f631c921720 100644 --- a/src/test/ui/methods/method-resolvable-path-in-pattern.stderr +++ b/src/test/ui/methods/method-resolvable-path-in-pattern.stderr @@ -1,5 +1,5 @@ error[E0532]: expected unit struct/variant or constant, found method `MyTrait::trait_bar` - --> $DIR/method-resolvable-path-in-pattern.rs:21:9 + --> $DIR/method-resolvable-path-in-pattern.rs:11:9 | LL | ::trait_bar => {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a unit struct/variant or constant diff --git a/src/test/ui/methods/method-self-arg-1.rs b/src/test/ui/methods/method-self-arg-1.rs index 4c8800878f0..4a78ad780c4 100644 --- a/src/test/ui/methods/method-self-arg-1.rs +++ b/src/test/ui/methods/method-self-arg-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test method calls with self as an argument cannot subvert type checking. struct Foo; @@ -25,5 +15,5 @@ fn main() { Foo::bar(&42); //~ ERROR mismatched types //~| expected type `&Foo` //~| found type `&{integer}` - //~| expected struct `Foo`, found integral variable + //~| expected struct `Foo`, found integer } diff --git a/src/test/ui/methods/method-self-arg-1.stderr b/src/test/ui/methods/method-self-arg-1.stderr index 4a5ac2b5aed..8c80d01b18c 100644 --- a/src/test/ui/methods/method-self-arg-1.stderr +++ b/src/test/ui/methods/method-self-arg-1.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/method-self-arg-1.rs:21:14 + --> $DIR/method-self-arg-1.rs:11:14 | LL | Foo::bar(x); //~ ERROR mismatched types | ^ @@ -11,10 +11,10 @@ LL | Foo::bar(x); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/method-self-arg-1.rs:25:14 + --> $DIR/method-self-arg-1.rs:15:14 | LL | Foo::bar(&42); //~ ERROR mismatched types - | ^^^ expected struct `Foo`, found integral variable + | ^^^ expected struct `Foo`, found integer | = note: expected type `&Foo` found type `&{integer}` diff --git a/src/test/ui/methods/method-self-arg-2.nll.stderr b/src/test/ui/methods/method-self-arg-2.nll.stderr index df2902c0674..8cfecdba41c 100644 --- a/src/test/ui/methods/method-self-arg-2.nll.stderr +++ b/src/test/ui/methods/method-self-arg-2.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/method-self-arg-2.rs:25:14 + --> $DIR/method-self-arg-2.rs:15:14 | LL | let y = &mut x; | ------ mutable borrow occurs here @@ -9,7 +9,7 @@ LL | y.use_mut(); | - mutable borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/method-self-arg-2.rs:30:14 + --> $DIR/method-self-arg-2.rs:20:14 | LL | let y = &mut x; | ------ first mutable borrow occurs here diff --git a/src/test/ui/methods/method-self-arg-2.rs b/src/test/ui/methods/method-self-arg-2.rs index cba4e6da6d9..0f8c048ac98 100644 --- a/src/test/ui/methods/method-self-arg-2.rs +++ b/src/test/ui/methods/method-self-arg-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test method calls with self as an argument cannot subvert borrow checking. diff --git a/src/test/ui/methods/method-self-arg-2.stderr b/src/test/ui/methods/method-self-arg-2.stderr index 0bfa6034135..9746ac316d9 100644 --- a/src/test/ui/methods/method-self-arg-2.stderr +++ b/src/test/ui/methods/method-self-arg-2.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/method-self-arg-2.rs:25:15 + --> $DIR/method-self-arg-2.rs:15:15 | LL | let y = &mut x; | - mutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - mutable borrow ends here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/method-self-arg-2.rs:30:19 + --> $DIR/method-self-arg-2.rs:20:19 | LL | let y = &mut x; | - first mutable borrow occurs here diff --git a/src/test/ui/minus-string.rs b/src/test/ui/minus-string.rs index 1ba30c67a03..946c587ce43 100644 --- a/src/test/ui/minus-string.rs +++ b/src/test/ui/minus-string.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:cannot apply unary operator `-` to type `std::string::String` fn main() { -"foo".to_string(); } diff --git a/src/test/ui/minus-string.stderr b/src/test/ui/minus-string.stderr index cbbb11ae33a..9177082cf0b 100644 --- a/src/test/ui/minus-string.stderr +++ b/src/test/ui/minus-string.stderr @@ -1,5 +1,5 @@ error[E0600]: cannot apply unary operator `-` to type `std::string::String` - --> $DIR/minus-string.rs:13:13 + --> $DIR/minus-string.rs:3:13 | LL | fn main() { -"foo".to_string(); } | ^^^^^^^^^^^^^^^^^^ cannot apply unary operator `-` diff --git a/src/test/ui/mir-dataflow/def-inits-1.rs b/src/test/ui/mir-dataflow/def-inits-1.rs index f5f0ede6864..07ac1900bc7 100644 --- a/src/test/ui/mir-dataflow/def-inits-1.rs +++ b/src/test/ui/mir-dataflow/def-inits-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // General test of maybe_uninits state computed by MIR dataflow. #![feature(nll)] diff --git a/src/test/ui/mir-dataflow/def-inits-1.stderr b/src/test/ui/mir-dataflow/def-inits-1.stderr index 84d3c66ac33..93debd6c15d 100644 --- a/src/test/ui/mir-dataflow/def-inits-1.stderr +++ b/src/test/ui/mir-dataflow/def-inits-1.stderr @@ -1,23 +1,23 @@ error: rustc_peek: bit not set - --> $DIR/def-inits-1.rs:25:14 + --> $DIR/def-inits-1.rs:15:14 | LL | unsafe { rustc_peek(&ret); } //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/def-inits-1.rs:41:14 + --> $DIR/def-inits-1.rs:31:14 | LL | unsafe { rustc_peek(&z); } //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/def-inits-1.rs:44:14 + --> $DIR/def-inits-1.rs:34:14 | LL | unsafe { rustc_peek(&y); } //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/def-inits-1.rs:52:14 + --> $DIR/def-inits-1.rs:42:14 | LL | unsafe { rustc_peek(&x); } //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/mir-dataflow/inits-1.rs b/src/test/ui/mir-dataflow/inits-1.rs index 595f01f7c94..13f900e4a75 100644 --- a/src/test/ui/mir-dataflow/inits-1.rs +++ b/src/test/ui/mir-dataflow/inits-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // General test of maybe_inits state computed by MIR dataflow. #![feature(nll)] diff --git a/src/test/ui/mir-dataflow/inits-1.stderr b/src/test/ui/mir-dataflow/inits-1.stderr index c39c9c8efba..7ee61e6be2c 100644 --- a/src/test/ui/mir-dataflow/inits-1.stderr +++ b/src/test/ui/mir-dataflow/inits-1.stderr @@ -1,17 +1,17 @@ error: rustc_peek: bit not set - --> $DIR/inits-1.rs:25:14 + --> $DIR/inits-1.rs:15:14 | LL | unsafe { rustc_peek(&ret); } //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/inits-1.rs:45:14 + --> $DIR/inits-1.rs:35:14 | LL | unsafe { rustc_peek(&y); } //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/inits-1.rs:53:14 + --> $DIR/inits-1.rs:43:14 | LL | unsafe { rustc_peek(&x); } //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/mir-dataflow/uninits-1.rs b/src/test/ui/mir-dataflow/uninits-1.rs index bb10c03254e..4c643596932 100644 --- a/src/test/ui/mir-dataflow/uninits-1.rs +++ b/src/test/ui/mir-dataflow/uninits-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // General test of maybe_uninits state computed by MIR dataflow. #![feature(nll)] diff --git a/src/test/ui/mir-dataflow/uninits-1.stderr b/src/test/ui/mir-dataflow/uninits-1.stderr index c76012404ef..21ad0b3c2c1 100644 --- a/src/test/ui/mir-dataflow/uninits-1.stderr +++ b/src/test/ui/mir-dataflow/uninits-1.stderr @@ -1,29 +1,29 @@ error: rustc_peek: bit not set - --> $DIR/uninits-1.rs:29:14 + --> $DIR/uninits-1.rs:19:14 | LL | unsafe { rustc_peek(&x) }; //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/uninits-1.rs:30:14 + --> $DIR/uninits-1.rs:20:14 | LL | unsafe { rustc_peek(&y) }; //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/uninits-1.rs:31:14 + --> $DIR/uninits-1.rs:21:14 | LL | unsafe { rustc_peek(&z) }; //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/uninits-1.rs:47:14 + --> $DIR/uninits-1.rs:37:14 | LL | unsafe { rustc_peek(&x); } //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set - --> $DIR/uninits-1.rs:55:14 + --> $DIR/uninits-1.rs:45:14 | LL | unsafe { rustc_peek(&ret); } //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/mir-dataflow/uninits-2.rs b/src/test/ui/mir-dataflow/uninits-2.rs index 9854ea779b3..2247e68d097 100644 --- a/src/test/ui/mir-dataflow/uninits-2.rs +++ b/src/test/ui/mir-dataflow/uninits-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // General test of maybe_uninits state computed by MIR dataflow. #![feature(nll)] diff --git a/src/test/ui/mir-dataflow/uninits-2.stderr b/src/test/ui/mir-dataflow/uninits-2.stderr index 8ed735111bd..08959ce3b13 100644 --- a/src/test/ui/mir-dataflow/uninits-2.stderr +++ b/src/test/ui/mir-dataflow/uninits-2.stderr @@ -1,5 +1,5 @@ error: rustc_peek: bit not set - --> $DIR/uninits-2.rs:25:14 + --> $DIR/uninits-2.rs:15:14 | LL | unsafe { rustc_peek(&x) }; //~ ERROR rustc_peek: bit not set | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/mir-unpretty.rs b/src/test/ui/mir-unpretty.rs index fa936502157..30620c69fea 100644 --- a/src/test/ui/mir-unpretty.rs +++ b/src/test/ui/mir-unpretty.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z unpretty=mir fn main() { diff --git a/src/test/ui/mir-unpretty.stderr b/src/test/ui/mir-unpretty.stderr index 5a53b69ebbb..59e8c0bf090 100644 --- a/src/test/ui/mir-unpretty.stderr +++ b/src/test/ui/mir-unpretty.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/mir-unpretty.rs:14:17 + --> $DIR/mir-unpretty.rs:4:17 | LL | let x: () = 0; //~ ERROR: mismatched types - | ^ expected (), found integral variable + | ^ expected (), found integer | = note: expected type `()` found type `{integer}` diff --git a/src/test/ui/mir_check_nonconst.rs b/src/test/ui/mir_check_nonconst.rs index 898ee8bbd44..b8ec0c3c449 100644 --- a/src/test/ui/mir_check_nonconst.rs +++ b/src/test/ui/mir_check_nonconst.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] struct Foo { a: u8 } diff --git a/src/test/ui/mir_check_nonconst.stderr b/src/test/ui/mir_check_nonconst.stderr index 1fddaf30576..30f68ba4372 100644 --- a/src/test/ui/mir_check_nonconst.stderr +++ b/src/test/ui/mir_check_nonconst.stderr @@ -1,5 +1,5 @@ error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/mir_check_nonconst.rs:18:19 + --> $DIR/mir_check_nonconst.rs:8:19 | LL | static foo: Foo = bar(); | ^^^^^ diff --git a/src/test/ui/mismatched_types/E0053.rs b/src/test/ui/mismatched_types/E0053.rs index c09d6673aeb..d3146ce5490 100644 --- a/src/test/ui/mismatched_types/E0053.rs +++ b/src/test/ui/mismatched_types/E0053.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(x: u16); fn bar(&self); diff --git a/src/test/ui/mismatched_types/E0053.stderr b/src/test/ui/mismatched_types/E0053.stderr index f707a600f29..582772d6fb3 100644 --- a/src/test/ui/mismatched_types/E0053.stderr +++ b/src/test/ui/mismatched_types/E0053.stderr @@ -1,5 +1,5 @@ error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/E0053.rs:19:15 + --> $DIR/E0053.rs:9:15 | LL | fn foo(x: u16); | --- type in trait @@ -11,7 +11,7 @@ LL | fn foo(x: i16) { } found type `fn(i16)` error[E0053]: method `bar` has an incompatible type for trait - --> $DIR/E0053.rs:21:12 + --> $DIR/E0053.rs:11:12 | LL | fn bar(&self); | ----- type in trait diff --git a/src/test/ui/mismatched_types/E0409.rs b/src/test/ui/mismatched_types/E0409.rs index 345020f2eae..3710534cc0e 100644 --- a/src/test/ui/mismatched_types/E0409.rs +++ b/src/test/ui/mismatched_types/E0409.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = (0, 2); diff --git a/src/test/ui/mismatched_types/E0409.stderr b/src/test/ui/mismatched_types/E0409.stderr index a1bfcafe053..08f132efd05 100644 --- a/src/test/ui/mismatched_types/E0409.stderr +++ b/src/test/ui/mismatched_types/E0409.stderr @@ -1,5 +1,5 @@ error[E0409]: variable `y` is bound in inconsistent ways within the same match arm - --> $DIR/E0409.rs:15:23 + --> $DIR/E0409.rs:5:23 | LL | (0, ref y) | (y, 0) => {} //~ ERROR E0409 | - ^ bound in different ways @@ -7,10 +7,10 @@ LL | (0, ref y) | (y, 0) => {} //~ ERROR E0409 | first binding error[E0308]: mismatched types - --> $DIR/E0409.rs:15:23 + --> $DIR/E0409.rs:5:23 | LL | (0, ref y) | (y, 0) => {} //~ ERROR E0409 - | ^ expected &{integer}, found integral variable + | ^ expected &{integer}, found integer | = note: expected type `&{integer}` found type `{integer}` diff --git a/src/test/ui/mismatched_types/E0631.rs b/src/test/ui/mismatched_types/E0631.rs index 7e5490b37c4..a2939465830 100644 --- a/src/test/ui/mismatched_types/E0631.rs +++ b/src/test/ui/mismatched_types/E0631.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] fn foo(_: F) {} diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr index 647e0a215aa..df320a2059b 100644 --- a/src/test/ui/mismatched_types/E0631.stderr +++ b/src/test/ui/mismatched_types/E0631.stderr @@ -1,5 +1,5 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/E0631.rs:17:5 + --> $DIR/E0631.rs:7:5 | LL | foo(|_: isize| {}); //~ ERROR type mismatch | ^^^ ---------- found signature of `fn(isize) -> _` @@ -7,13 +7,13 @@ LL | foo(|_: isize| {}); //~ ERROR type mismatch | expected signature of `fn(usize) -> _` | note: required by `foo` - --> $DIR/E0631.rs:13:1 + --> $DIR/E0631.rs:3:1 | LL | fn foo(_: F) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in closure arguments - --> $DIR/E0631.rs:18:5 + --> $DIR/E0631.rs:8:5 | LL | bar(|_: isize| {}); //~ ERROR type mismatch | ^^^ ---------- found signature of `fn(isize) -> _` @@ -21,13 +21,13 @@ LL | bar(|_: isize| {}); //~ ERROR type mismatch | expected signature of `fn(usize) -> _` | note: required by `bar` - --> $DIR/E0631.rs:14:1 + --> $DIR/E0631.rs:4:1 | LL | fn bar>(_: F) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in function arguments - --> $DIR/E0631.rs:19:5 + --> $DIR/E0631.rs:9:5 | LL | fn f(_: u64) {} | ------------ found signature of `fn(u64) -> _` @@ -36,13 +36,13 @@ LL | foo(f); //~ ERROR type mismatch | ^^^ expected signature of `fn(usize) -> _` | note: required by `foo` - --> $DIR/E0631.rs:13:1 + --> $DIR/E0631.rs:3:1 | LL | fn foo(_: F) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in function arguments - --> $DIR/E0631.rs:20:5 + --> $DIR/E0631.rs:10:5 | LL | fn f(_: u64) {} | ------------ found signature of `fn(u64) -> _` @@ -51,7 +51,7 @@ LL | bar(f); //~ ERROR type mismatch | ^^^ expected signature of `fn(usize) -> _` | note: required by `bar` - --> $DIR/E0631.rs:14:1 + --> $DIR/E0631.rs:4:1 | LL | fn bar>(_: F) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/mismatched_types/abridged.rs b/src/test/ui/mismatched_types/abridged.rs index f496df58f73..41ab6d4c578 100644 --- a/src/test/ui/mismatched_types/abridged.rs +++ b/src/test/ui/mismatched_types/abridged.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Bar { Qux, Zar, diff --git a/src/test/ui/mismatched_types/abridged.stderr b/src/test/ui/mismatched_types/abridged.stderr index 1b2ea514f3e..6a5cf7db4ee 100644 --- a/src/test/ui/mismatched_types/abridged.stderr +++ b/src/test/ui/mismatched_types/abridged.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/abridged.rs:26:5 + --> $DIR/abridged.rs:16:5 | LL | fn a() -> Foo { | --- expected `Foo` because of return type @@ -10,7 +10,7 @@ LL | Some(Foo { bar: 1 }) //~ ERROR mismatched types found type `std::option::Option` error[E0308]: mismatched types - --> $DIR/abridged.rs:30:5 + --> $DIR/abridged.rs:20:5 | LL | fn a2() -> Foo { | --- expected `Foo` because of return type @@ -21,7 +21,7 @@ LL | Ok(Foo { bar: 1}) //~ ERROR mismatched types found type `std::result::Result` error[E0308]: mismatched types - --> $DIR/abridged.rs:34:5 + --> $DIR/abridged.rs:24:5 | LL | fn b() -> Option { | ----------- expected `std::option::Option` because of return type @@ -32,7 +32,7 @@ LL | Foo { bar: 1 } //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/abridged.rs:38:5 + --> $DIR/abridged.rs:28:5 | LL | fn c() -> Result { | ---------------- expected `std::result::Result` because of return type @@ -43,25 +43,25 @@ LL | Foo { bar: 1 } //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/abridged.rs:49:5 + --> $DIR/abridged.rs:39:5 | LL | fn d() -> X, String> { | ---------------------------- expected `X, std::string::String>` because of return type ... LL | x //~ ERROR mismatched types - | ^ expected struct `std::string::String`, found integral variable + | ^ expected struct `std::string::String`, found integer | = note: expected type `X, std::string::String>` found type `X, {integer}>` error[E0308]: mismatched types - --> $DIR/abridged.rs:60:5 + --> $DIR/abridged.rs:50:5 | LL | fn e() -> X, String> { | ---------------------------- expected `X, std::string::String>` because of return type ... LL | x //~ ERROR mismatched types - | ^ expected struct `std::string::String`, found integral variable + | ^ expected struct `std::string::String`, found integer | = note: expected type `X, _>` found type `X, _>` diff --git a/src/test/ui/mismatched_types/binops.rs b/src/test/ui/mismatched_types/binops.rs index 86785f24f36..621599ddb8f 100644 --- a/src/test/ui/mismatched_types/binops.rs +++ b/src/test/ui/mismatched_types/binops.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { 1 + Some(1); //~ ERROR cannot add `std::option::Option<{integer}>` to `{integer}` 2 as usize - Some(1); //~ ERROR cannot subtract `std::option::Option<{integer}>` from `usize` diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index 4c6d95efadb..76ea0ab54c3 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -1,5 +1,5 @@ error[E0277]: cannot add `std::option::Option<{integer}>` to `{integer}` - --> $DIR/binops.rs:12:7 + --> $DIR/binops.rs:2:7 | LL | 1 + Some(1); //~ ERROR cannot add `std::option::Option<{integer}>` to `{integer}` | ^ no implementation for `{integer} + std::option::Option<{integer}>` @@ -7,7 +7,7 @@ LL | 1 + Some(1); //~ ERROR cannot add `std::option::Option<{integer}>` to ` = help: the trait `std::ops::Add>` is not implemented for `{integer}` error[E0277]: cannot subtract `std::option::Option<{integer}>` from `usize` - --> $DIR/binops.rs:13:16 + --> $DIR/binops.rs:3:16 | LL | 2 as usize - Some(1); //~ ERROR cannot subtract `std::option::Option<{integer}>` from `usize` | ^ no implementation for `usize - std::option::Option<{integer}>` @@ -15,7 +15,7 @@ LL | 2 as usize - Some(1); //~ ERROR cannot subtract `std::option::Option<{i = help: the trait `std::ops::Sub>` is not implemented for `usize` error[E0277]: cannot multiply `()` to `{integer}` - --> $DIR/binops.rs:14:7 + --> $DIR/binops.rs:4:7 | LL | 3 * (); //~ ERROR cannot multiply `()` to `{integer}` | ^ no implementation for `{integer} * ()` @@ -23,7 +23,7 @@ LL | 3 * (); //~ ERROR cannot multiply `()` to `{integer}` = help: the trait `std::ops::Mul<()>` is not implemented for `{integer}` error[E0277]: cannot divide `{integer}` by `&str` - --> $DIR/binops.rs:15:7 + --> $DIR/binops.rs:5:7 | LL | 4 / ""; //~ ERROR cannot divide `{integer}` by `&str` | ^ no implementation for `{integer} / &str` @@ -31,7 +31,7 @@ LL | 4 / ""; //~ ERROR cannot divide `{integer}` by `&str` = help: the trait `std::ops::Div<&str>` is not implemented for `{integer}` error[E0277]: can't compare `{integer}` with `std::string::String` - --> $DIR/binops.rs:16:7 + --> $DIR/binops.rs:6:7 | LL | 5 < String::new(); //~ ERROR can't compare `{integer}` with `std::string::String` | ^ no implementation for `{integer} < std::string::String` and `{integer} > std::string::String` @@ -39,7 +39,7 @@ LL | 5 < String::new(); //~ ERROR can't compare `{integer}` with `std::strin = help: the trait `std::cmp::PartialOrd` is not implemented for `{integer}` error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>` - --> $DIR/binops.rs:17:7 + --> $DIR/binops.rs:7:7 | LL | 6 == Ok(1); //~ ERROR can't compare `{integer}` with `std::result::Result<{integer}, _>` | ^^ no implementation for `{integer} == std::result::Result<{integer}, _>` diff --git a/src/test/ui/mismatched_types/cast-rfc0401.rs b/src/test/ui/mismatched_types/cast-rfc0401.rs index 6be6bb4391a..a5e03a18e6a 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.rs +++ b/src/test/ui/mismatched_types/cast-rfc0401.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn illegal_cast(u: *const U) -> *const V { u as *const V //~ ERROR is invalid diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 81fe4932811..76091f2d09e 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -1,5 +1,5 @@ error[E0606]: casting `*const U` as `*const V` is invalid - --> $DIR/cast-rfc0401.rs:13:5 + --> $DIR/cast-rfc0401.rs:3:5 | LL | u as *const V //~ ERROR is invalid | ^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | u as *const V //~ ERROR is invalid = note: vtable kinds may not match error[E0606]: casting `*const U` as `*const str` is invalid - --> $DIR/cast-rfc0401.rs:18:5 + --> $DIR/cast-rfc0401.rs:8:5 | LL | u as *const str //~ ERROR is invalid | ^^^^^^^^^^^^^^^ @@ -15,13 +15,13 @@ LL | u as *const str //~ ERROR is invalid = note: vtable kinds may not match error[E0609]: no field `f` on type `fn() {main}` - --> $DIR/cast-rfc0401.rs:75:18 + --> $DIR/cast-rfc0401.rs:65:18 | LL | let _ = main.f as *const u32; //~ ERROR no field | ^ error[E0605]: non-primitive cast: `*const u8` as `&u8` - --> $DIR/cast-rfc0401.rs:39:13 + --> $DIR/cast-rfc0401.rs:29:13 | LL | let _ = v as &u8; //~ ERROR non-primitive cast | ^^^^^^^^ @@ -29,7 +29,7 @@ LL | let _ = v as &u8; //~ ERROR non-primitive cast = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait error[E0605]: non-primitive cast: `*const u8` as `E` - --> $DIR/cast-rfc0401.rs:40:13 + --> $DIR/cast-rfc0401.rs:30:13 | LL | let _ = v as E; //~ ERROR non-primitive cast | ^^^^^^ @@ -37,7 +37,7 @@ LL | let _ = v as E; //~ ERROR non-primitive cast = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait error[E0605]: non-primitive cast: `*const u8` as `fn()` - --> $DIR/cast-rfc0401.rs:41:13 + --> $DIR/cast-rfc0401.rs:31:13 | LL | let _ = v as fn(); //~ ERROR non-primitive cast | ^^^^^^^^^ @@ -45,7 +45,7 @@ LL | let _ = v as fn(); //~ ERROR non-primitive cast = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait error[E0605]: non-primitive cast: `*const u8` as `(u32,)` - --> $DIR/cast-rfc0401.rs:42:13 + --> $DIR/cast-rfc0401.rs:32:13 | LL | let _ = v as (u32,); //~ ERROR non-primitive cast | ^^^^^^^^^^^ @@ -53,7 +53,7 @@ LL | let _ = v as (u32,); //~ ERROR non-primitive cast = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait error[E0605]: non-primitive cast: `std::option::Option<&*const u8>` as `*const u8` - --> $DIR/cast-rfc0401.rs:43:13 + --> $DIR/cast-rfc0401.rs:33:13 | LL | let _ = Some(&v) as *const u8; //~ ERROR non-primitive cast | ^^^^^^^^^^^^^^^^^^^^^ @@ -61,19 +61,19 @@ LL | let _ = Some(&v) as *const u8; //~ ERROR non-primitive cast = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait error[E0606]: casting `*const u8` as `f32` is invalid - --> $DIR/cast-rfc0401.rs:45:13 + --> $DIR/cast-rfc0401.rs:35:13 | LL | let _ = v as f32; //~ ERROR is invalid | ^^^^^^^^ error[E0606]: casting `fn() {main}` as `f64` is invalid - --> $DIR/cast-rfc0401.rs:46:13 + --> $DIR/cast-rfc0401.rs:36:13 | LL | let _ = main as f64; //~ ERROR is invalid | ^^^^^^^^^^^ error[E0606]: casting `&*const u8` as `usize` is invalid - --> $DIR/cast-rfc0401.rs:47:13 + --> $DIR/cast-rfc0401.rs:37:13 | LL | let _ = &v as usize; //~ ERROR is invalid | ^^^^^^^^^^^ @@ -81,35 +81,31 @@ LL | let _ = &v as usize; //~ ERROR is invalid = help: cast through a raw pointer first error[E0606]: casting `f32` as `*const u8` is invalid - --> $DIR/cast-rfc0401.rs:48:13 + --> $DIR/cast-rfc0401.rs:38:13 | LL | let _ = f as *const u8; //~ ERROR is invalid | ^^^^^^^^^^^^^^ error[E0054]: cannot cast as `bool` - --> $DIR/cast-rfc0401.rs:49:13 + --> $DIR/cast-rfc0401.rs:39:13 | LL | let _ = 3_i32 as bool; //~ ERROR cannot cast - | ^^^^^^^^^^^^^ unsupported cast - | - = help: compare with zero instead + | ^^^^^^^^^^^^^ help: compare with zero instead: `3_i32 != 0` error[E0054]: cannot cast as `bool` - --> $DIR/cast-rfc0401.rs:50:13 + --> $DIR/cast-rfc0401.rs:40:13 | LL | let _ = E::A as bool; //~ ERROR cannot cast | ^^^^^^^^^^^^ unsupported cast - | - = help: compare with zero instead error[E0604]: only `u8` can be cast as `char`, not `u32` - --> $DIR/cast-rfc0401.rs:51:13 + --> $DIR/cast-rfc0401.rs:41:13 | LL | let _ = 0x61u32 as char; //~ ERROR can be cast as | ^^^^^^^^^^^^^^^ error[E0606]: casting `bool` as `f32` is invalid - --> $DIR/cast-rfc0401.rs:53:13 + --> $DIR/cast-rfc0401.rs:43:13 | LL | let _ = false as f32; //~ ERROR is invalid | ^^^^^^^^^^^^ @@ -117,7 +113,7 @@ LL | let _ = false as f32; //~ ERROR is invalid = help: cast through an integer first error[E0606]: casting `E` as `f32` is invalid - --> $DIR/cast-rfc0401.rs:54:13 + --> $DIR/cast-rfc0401.rs:44:13 | LL | let _ = E::A as f32; //~ ERROR is invalid | ^^^^^^^^^^^ @@ -125,7 +121,7 @@ LL | let _ = E::A as f32; //~ ERROR is invalid = help: cast through an integer first error[E0606]: casting `char` as `f32` is invalid - --> $DIR/cast-rfc0401.rs:55:13 + --> $DIR/cast-rfc0401.rs:45:13 | LL | let _ = 'a' as f32; //~ ERROR is invalid | ^^^^^^^^^^ @@ -133,67 +129,67 @@ LL | let _ = 'a' as f32; //~ ERROR is invalid = help: cast through an integer first error[E0606]: casting `bool` as `*const u8` is invalid - --> $DIR/cast-rfc0401.rs:57:13 + --> $DIR/cast-rfc0401.rs:47:13 | LL | let _ = false as *const u8; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^^^ error[E0606]: casting `E` as `*const u8` is invalid - --> $DIR/cast-rfc0401.rs:58:13 + --> $DIR/cast-rfc0401.rs:48:13 | LL | let _ = E::A as *const u8; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `char` as `*const u8` is invalid - --> $DIR/cast-rfc0401.rs:59:13 + --> $DIR/cast-rfc0401.rs:49:13 | LL | let _ = 'a' as *const u8; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^ error[E0606]: casting `usize` as `*const [u8]` is invalid - --> $DIR/cast-rfc0401.rs:61:13 + --> $DIR/cast-rfc0401.rs:51:13 | LL | let _ = 42usize as *const [u8]; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^^^^^^^ error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]` - --> $DIR/cast-rfc0401.rs:62:13 + --> $DIR/cast-rfc0401.rs:52:13 | LL | let _ = v as *const [u8]; //~ ERROR cannot cast | ^^^^^^^^^^^^^^^^ error[E0606]: casting `&dyn Foo` as `*const str` is invalid - --> $DIR/cast-rfc0401.rs:64:13 + --> $DIR/cast-rfc0401.rs:54:13 | LL | let _ = foo as *const str; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `&dyn Foo` as `*mut str` is invalid - --> $DIR/cast-rfc0401.rs:65:13 + --> $DIR/cast-rfc0401.rs:55:13 | LL | let _ = foo as *mut str; //~ ERROR is invalid | ^^^^^^^^^^^^^^^ error[E0606]: casting `fn() {main}` as `*mut str` is invalid - --> $DIR/cast-rfc0401.rs:66:13 + --> $DIR/cast-rfc0401.rs:56:13 | LL | let _ = main as *mut str; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^ error[E0606]: casting `&f32` as `*mut f32` is invalid - --> $DIR/cast-rfc0401.rs:67:13 + --> $DIR/cast-rfc0401.rs:57:13 | LL | let _ = &f as *mut f32; //~ ERROR is invalid | ^^^^^^^^^^^^^^ error[E0606]: casting `&f32` as `*const f64` is invalid - --> $DIR/cast-rfc0401.rs:68:13 + --> $DIR/cast-rfc0401.rs:58:13 | LL | let _ = &f as *const f64; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^ error[E0606]: casting `*const [i8]` as `usize` is invalid - --> $DIR/cast-rfc0401.rs:69:13 + --> $DIR/cast-rfc0401.rs:59:13 | LL | let _ = fat_sv as usize; //~ ERROR is invalid | ^^^^^^^^^^^^^^^ @@ -201,7 +197,7 @@ LL | let _ = fat_sv as usize; //~ ERROR is invalid = help: cast through a thin pointer first error[E0606]: casting `*const dyn Foo` as `*const [u16]` is invalid - --> $DIR/cast-rfc0401.rs:78:13 + --> $DIR/cast-rfc0401.rs:68:13 | LL | let _ = cf as *const [u16]; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^^^ @@ -209,7 +205,7 @@ LL | let _ = cf as *const [u16]; //~ ERROR is invalid = note: vtable kinds may not match error[E0606]: casting `*const dyn Foo` as `*const dyn Bar` is invalid - --> $DIR/cast-rfc0401.rs:79:13 + --> $DIR/cast-rfc0401.rs:69:13 | LL | let _ = cf as *const Bar; //~ ERROR is invalid | ^^^^^^^^^^^^^^^^ @@ -217,36 +213,33 @@ LL | let _ = cf as *const Bar; //~ ERROR is invalid = note: vtable kinds may not match error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/cast-rfc0401.rs:63:13 + --> $DIR/cast-rfc0401.rs:53:13 | LL | let _ = fat_v as *const Foo; //~ ERROR the size for values of type | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit + = note: to learn more, visit = note: required for the cast to the object type `dyn Foo` error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/cast-rfc0401.rs:72:13 + --> $DIR/cast-rfc0401.rs:62:13 | LL | let _ = a as *const Foo; //~ ERROR the size for values of type | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: required for the cast to the object type `dyn Foo` error[E0606]: casting `&{float}` as `f32` is invalid - --> $DIR/cast-rfc0401.rs:81:30 - | -LL | vec![0.0].iter().map(|s| s as f32).collect::>(); //~ ERROR is invalid - | ^^^^^^^^ cannot cast `&{float}` as `f32` - | -help: did you mean `*s`? - --> $DIR/cast-rfc0401.rs:81:30 + --> $DIR/cast-rfc0401.rs:71:30 | LL | vec![0.0].iter().map(|s| s as f32).collect::>(); //~ ERROR is invalid - | ^ + | -^^^^^^^ + | | + | cannot cast `&{float}` as `f32` + | help: dereference the expression: `*s` error: aborting due to 34 previous errors diff --git a/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.fixed b/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.fixed index 1a7608fea6e..efba0543b48 100644 --- a/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.fixed +++ b/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.fixed @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #47244: in this specific scenario, when the // expected type indicated 1 argument but the closure takes two, we // would (early on) create type variables for the type of `b`. If the diff --git a/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.rs b/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.rs index 0ca0753490a..3ddb93d12f7 100644 --- a/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.rs +++ b/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #47244: in this specific scenario, when the // expected type indicated 1 argument but the closure takes two, we // would (early on) create type variables for the type of `b`. If the diff --git a/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr b/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr index c95d8157b0c..00a4f9d48ff 100644 --- a/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count-expected-type-issue-47244.stderr @@ -1,5 +1,5 @@ error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments - --> $DIR/closure-arg-count-expected-type-issue-47244.rs:26:23 + --> $DIR/closure-arg-count-expected-type-issue-47244.rs:16:23 | LL | let _n = m.iter().map(|_, b| { | ^^^ ------ takes 2 distinct arguments diff --git a/src/test/ui/mismatched_types/closure-arg-count.rs b/src/test/ui/mismatched_types/closure-arg-count.rs index 9eb11148a8b..e817631ad5d 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.rs +++ b/src/test/ui/mismatched_types/closure-arg-count.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] fn f>(_: F) {} @@ -22,6 +12,8 @@ fn main() { //~^ ERROR closure is expected to take f(|| panic!()); //~^ ERROR closure is expected to take + f( move || panic!()); + //~^ ERROR closure is expected to take let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i); //~^ ERROR closure is expected to take diff --git a/src/test/ui/mismatched_types/closure-arg-count.stderr b/src/test/ui/mismatched_types/closure-arg-count.stderr index 057cf6efa1d..25d5d25ec1d 100644 --- a/src/test/ui/mismatched_types/closure-arg-count.stderr +++ b/src/test/ui/mismatched_types/closure-arg-count.stderr @@ -1,5 +1,5 @@ error[E0593]: closure is expected to take 2 arguments, but it takes 0 arguments - --> $DIR/closure-arg-count.rs:15:15 + --> $DIR/closure-arg-count.rs:5:15 | LL | [1, 2, 3].sort_by(|| panic!()); | ^^^^^^^ -- takes 0 arguments @@ -11,7 +11,7 @@ LL | [1, 2, 3].sort_by(|_, _| panic!()); | ^^^^^^ error[E0593]: closure is expected to take 2 arguments, but it takes 1 argument - --> $DIR/closure-arg-count.rs:17:15 + --> $DIR/closure-arg-count.rs:7:15 | LL | [1, 2, 3].sort_by(|tuple| panic!()); | ^^^^^^^ ------- takes 1 argument @@ -19,7 +19,7 @@ LL | [1, 2, 3].sort_by(|tuple| panic!()); | expected closure that takes 2 arguments error[E0593]: closure is expected to take 2 distinct arguments, but it takes a single 2-tuple as argument - --> $DIR/closure-arg-count.rs:19:15 + --> $DIR/closure-arg-count.rs:9:15 | LL | [1, 2, 3].sort_by(|(tuple, tuple2)| panic!()); | ^^^^^^^ ----------------- takes a single 2-tuple as argument @@ -31,7 +31,7 @@ LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!()); | ^^^^^^^^^^^^^^^ error[E0593]: closure is expected to take 2 distinct arguments, but it takes a single 2-tuple as argument - --> $DIR/closure-arg-count.rs:21:15 + --> $DIR/closure-arg-count.rs:11:15 | LL | [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!()); | ^^^^^^^ ----------------------------- takes a single 2-tuple as argument @@ -43,7 +43,7 @@ LL | [1, 2, 3].sort_by(|tuple, tuple2| panic!()); | ^^^^^^^^^^^^^^^ error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments - --> $DIR/closure-arg-count.rs:23:5 + --> $DIR/closure-arg-count.rs:13:5 | LL | f(|| panic!()); | ^ -- takes 0 arguments @@ -51,7 +51,7 @@ LL | f(|| panic!()); | expected closure that takes 1 argument | note: required by `f` - --> $DIR/closure-arg-count.rs:13:1 + --> $DIR/closure-arg-count.rs:3:1 | LL | fn f>(_: F) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -60,8 +60,26 @@ help: consider changing the closure to take and ignore the expected argument LL | f(|_| panic!()); | ^^^ +error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments + --> $DIR/closure-arg-count.rs:15:5 + | +LL | f( move || panic!()); + | ^ ---------- takes 0 arguments + | | + | expected closure that takes 1 argument + | +note: required by `f` + --> $DIR/closure-arg-count.rs:3:1 + | +LL | fn f>(_: F) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^ +help: consider changing the closure to take and ignore the expected argument + | +LL | f( move |_| panic!()); + | ^^^ + error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments - --> $DIR/closure-arg-count.rs:26:53 + --> $DIR/closure-arg-count.rs:18:53 | LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i); | ^^^ ------ takes 2 distinct arguments @@ -73,7 +91,7 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i); | ^^^^^^^^ error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments - --> $DIR/closure-arg-count.rs:28:53 + --> $DIR/closure-arg-count.rs:20:53 | LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i); | ^^^ ------------- takes 2 distinct arguments @@ -85,7 +103,7 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|(i, x)| i); | ^^^^^^^^ error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments - --> $DIR/closure-arg-count.rs:30:53 + --> $DIR/closure-arg-count.rs:22:53 | LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i); | ^^^ --------- takes 3 distinct arguments @@ -93,7 +111,7 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i); | expected closure that takes a single 2-tuple as argument error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments - --> $DIR/closure-arg-count.rs:32:53 + --> $DIR/closure-arg-count.rs:24:53 | LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(foo); | ^^^ expected function that takes a single 2-tuple as argument @@ -102,7 +120,7 @@ LL | fn foo() {} | -------- takes 0 arguments error[E0593]: closure is expected to take a single 2-tuple as argument, but it takes 3 distinct arguments - --> $DIR/closure-arg-count.rs:35:53 + --> $DIR/closure-arg-count.rs:27:53 | LL | let bar = |i, x, y| i; | --------- takes 3 distinct arguments @@ -110,7 +128,7 @@ LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(bar); | ^^^ expected closure that takes a single 2-tuple as argument error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 2 distinct arguments - --> $DIR/closure-arg-count.rs:37:53 + --> $DIR/closure-arg-count.rs:29:53 | LL | let _it = vec![1, 2, 3].into_iter().enumerate().map(qux); | ^^^ expected function that takes a single 2-tuple as argument @@ -119,13 +137,13 @@ LL | fn qux(x: usize, y: usize) {} | -------------------------- takes 2 distinct arguments error[E0593]: function is expected to take 1 argument, but it takes 2 arguments - --> $DIR/closure-arg-count.rs:40:41 + --> $DIR/closure-arg-count.rs:32:41 | LL | let _it = vec![1, 2, 3].into_iter().map(usize::checked_add); | ^^^ expected function that takes 1 argument error[E0593]: function is expected to take 0 arguments, but it takes 1 argument - --> $DIR/closure-arg-count.rs:43:5 + --> $DIR/closure-arg-count.rs:35:5 | LL | call(Foo); | ^^^^ expected function that takes 0 arguments @@ -134,11 +152,11 @@ LL | struct Foo(u8); | --------------- takes 1 argument | note: required by `call` - --> $DIR/closure-arg-count.rs:50:1 + --> $DIR/closure-arg-count.rs:42:1 | LL | fn call(_: F) where F: FnOnce() -> R {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 13 previous errors +error: aborting due to 14 previous errors For more information about this error, try `rustc --explain E0593`. diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.rs b/src/test/ui/mismatched_types/closure-arg-type-mismatch.rs index 566998c374e..437150666be 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.rs +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let a = [(1u32, 2u32)]; a.iter().map(|_: (u32, u32)| 45); //~ ERROR type mismatch @@ -17,6 +7,6 @@ fn main() { fn baz(_: F) {} fn _test<'a>(f: fn(*mut &'a u32)) { - baz(f); //~ ERROR type mismatch - //~^ ERROR type mismatch + baz(f); //~ ERROR mismatched types + //~| ERROR mismatched types } diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index 62e646c8d39..a6628006587 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -1,5 +1,5 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/closure-arg-type-mismatch.rs:13:14 + --> $DIR/closure-arg-type-mismatch.rs:3:14 | LL | a.iter().map(|_: (u32, u32)| 45); //~ ERROR type mismatch | ^^^ ------------------ found signature of `fn((u32, u32)) -> _` @@ -7,7 +7,7 @@ LL | a.iter().map(|_: (u32, u32)| 45); //~ ERROR type mismatch | expected signature of `fn(&(u32, u32)) -> _` error[E0631]: type mismatch in closure arguments - --> $DIR/closure-arg-type-mismatch.rs:14:14 + --> $DIR/closure-arg-type-mismatch.rs:4:14 | LL | a.iter().map(|_: &(u16, u16)| 45); //~ ERROR type mismatch | ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _` @@ -15,41 +15,32 @@ LL | a.iter().map(|_: &(u16, u16)| 45); //~ ERROR type mismatch | expected signature of `fn(&(u32, u32)) -> _` error[E0631]: type mismatch in closure arguments - --> $DIR/closure-arg-type-mismatch.rs:15:14 + --> $DIR/closure-arg-type-mismatch.rs:5:14 | LL | a.iter().map(|_: (u16, u16)| 45); //~ ERROR type mismatch | ^^^ ------------------ found signature of `fn((u16, u16)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` -error[E0631]: type mismatch in function arguments - --> $DIR/closure-arg-type-mismatch.rs:20:5 +error[E0308]: mismatched types + --> $DIR/closure-arg-type-mismatch.rs:10:5 | -LL | baz(f); //~ ERROR type mismatch - | ^^^ - | | - | expected signature of `for<'r> fn(*mut &'r u32) -> _` - | found signature of `fn(*mut &'a u32) -> _` +LL | baz(f); //~ ERROR mismatched types + | ^^^ one type is more general than the other | -note: required by `baz` - --> $DIR/closure-arg-type-mismatch.rs:18:1 - | -LL | fn baz(_: F) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected type `for<'r> std::ops::Fn<(*mut &'r u32,)>` + found type `std::ops::Fn<(*mut &'a u32,)>` -error[E0271]: type mismatch resolving `for<'r> >::Output == ()` - --> $DIR/closure-arg-type-mismatch.rs:20:5 - | -LL | baz(f); //~ ERROR type mismatch - | ^^^ expected bound lifetime parameter, found concrete lifetime +error[E0308]: mismatched types + --> $DIR/closure-arg-type-mismatch.rs:10:5 | -note: required by `baz` - --> $DIR/closure-arg-type-mismatch.rs:18:1 +LL | baz(f); //~ ERROR mismatched types + | ^^^ one type is more general than the other | -LL | fn baz(_: F) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: expected type `std::ops::FnOnce<(*mut &u32,)>` + found type `std::ops::FnOnce<(*mut &'a u32,)>` error: aborting due to 5 previous errors -Some errors occurred: E0271, E0631. -For more information about an error, try `rustc --explain E0271`. +Some errors occurred: E0308, E0631. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/mismatched_types/closure-mismatch.rs b/src/test/ui/mismatched_types/closure-mismatch.rs index 5a74e8f933d..152a5254937 100644 --- a/src/test/ui/mismatched_types/closure-mismatch.rs +++ b/src/test/ui/mismatched_types/closure-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo {} impl Foo for T {} @@ -15,6 +5,5 @@ impl Foo for T {} fn baz(_: T) {} fn main() { - baz(|_| ()); //~ ERROR type mismatch - //~^ ERROR type mismatch + baz(|_| ()); //~ ERROR E0308 } diff --git a/src/test/ui/mismatched_types/closure-mismatch.stderr b/src/test/ui/mismatched_types/closure-mismatch.stderr index cb03d0ea4cc..0d87bc22875 100644 --- a/src/test/ui/mismatched_types/closure-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-mismatch.stderr @@ -1,32 +1,12 @@ -error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/closure-mismatch.rs:18:9: 18:15] as std::ops::FnOnce<(&'r (),)>>::Output == ()` - --> $DIR/closure-mismatch.rs:18:5 +error[E0308]: mismatched types + --> $DIR/closure-mismatch.rs:8:5 | -LL | baz(|_| ()); //~ ERROR type mismatch - | ^^^ expected bound lifetime parameter, found concrete lifetime +LL | baz(|_| ()); //~ ERROR E0308 + | ^^^ one type is more general than the other | - = note: required because of the requirements on the impl of `Foo` for `[closure@$DIR/closure-mismatch.rs:18:9: 18:15]` -note: required by `baz` - --> $DIR/closure-mismatch.rs:15:1 - | -LL | fn baz(_: T) {} - | ^^^^^^^^^^^^^^^^^^^^ - -error[E0631]: type mismatch in closure arguments - --> $DIR/closure-mismatch.rs:18:5 - | -LL | baz(|_| ()); //~ ERROR type mismatch - | ^^^ ------ found signature of `fn(_) -> _` - | | - | expected signature of `for<'r> fn(&'r ()) -> _` - | - = note: required because of the requirements on the impl of `Foo` for `[closure@$DIR/closure-mismatch.rs:18:9: 18:15]` -note: required by `baz` - --> $DIR/closure-mismatch.rs:15:1 - | -LL | fn baz(_: T) {} - | ^^^^^^^^^^^^^^^^^^^^ + = note: expected type `for<'r> std::ops::Fn<(&'r (),)>` + found type `std::ops::Fn<(&(),)>` -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0271, E0631. -For more information about an error, try `rustc --explain E0271`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/mismatched_types/const-fn-in-trait.rs b/src/test/ui/mismatched_types/const-fn-in-trait.rs index e0d5c19f125..7fcbd7e7e8b 100644 --- a/src/test/ui/mismatched_types/const-fn-in-trait.rs +++ b/src/test/ui/mismatched_types/const-fn-in-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // rustc-env:RUST_NEW_ERROR_FORMAT #![feature(const_fn)] diff --git a/src/test/ui/mismatched_types/const-fn-in-trait.stderr b/src/test/ui/mismatched_types/const-fn-in-trait.stderr index ba248e076d4..e1482d7c450 100644 --- a/src/test/ui/mismatched_types/const-fn-in-trait.stderr +++ b/src/test/ui/mismatched_types/const-fn-in-trait.stderr @@ -1,11 +1,11 @@ error[E0379]: trait fns cannot be declared const - --> $DIR/const-fn-in-trait.rs:17:5 + --> $DIR/const-fn-in-trait.rs:7:5 | LL | const fn g(); //~ ERROR cannot be declared const | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const - --> $DIR/const-fn-in-trait.rs:21:5 + --> $DIR/const-fn-in-trait.rs:11:5 | LL | const fn f() -> u32 { 22 } //~ ERROR cannot be declared const | ^^^^^ trait fns cannot be const diff --git a/src/test/ui/mismatched_types/fn-variance-1.rs b/src/test/ui/mismatched_types/fn-variance-1.rs index 2b797ef7681..b8a6c9a9b2b 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.rs +++ b/src/test/ui/mismatched_types/fn-variance-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn takes_imm(x: &isize) { } fn takes_mut(x: &mut isize) { } diff --git a/src/test/ui/mismatched_types/fn-variance-1.stderr b/src/test/ui/mismatched_types/fn-variance-1.stderr index 221ee79bd67..0fb1a5346f3 100644 --- a/src/test/ui/mismatched_types/fn-variance-1.stderr +++ b/src/test/ui/mismatched_types/fn-variance-1.stderr @@ -1,5 +1,5 @@ error[E0631]: type mismatch in function arguments - --> $DIR/fn-variance-1.rs:21:5 + --> $DIR/fn-variance-1.rs:11:5 | LL | fn takes_mut(x: &mut isize) { } | --------------------------- found signature of `for<'r> fn(&'r mut isize) -> _` @@ -8,13 +8,13 @@ LL | apply(&3, takes_mut); | ^^^^^ expected signature of `fn(&{integer}) -> _` | note: required by `apply` - --> $DIR/fn-variance-1.rs:15:1 + --> $DIR/fn-variance-1.rs:5:1 | LL | fn apply(t: T, f: F) where F: FnOnce(T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0631]: type mismatch in function arguments - --> $DIR/fn-variance-1.rs:25:5 + --> $DIR/fn-variance-1.rs:15:5 | LL | fn takes_imm(x: &isize) { } | ----------------------- found signature of `for<'r> fn(&'r isize) -> _` @@ -23,7 +23,7 @@ LL | apply(&mut 3, takes_imm); | ^^^^^ expected signature of `fn(&mut {integer}) -> _` | note: required by `apply` - --> $DIR/fn-variance-1.rs:15:1 + --> $DIR/fn-variance-1.rs:5:1 | LL | fn apply(t: T, f: F) where F: FnOnce(T) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/mismatched_types/for-loop-has-unit-body.rs b/src/test/ui/mismatched_types/for-loop-has-unit-body.rs index 4ffee75348a..a9433d7de6e 100644 --- a/src/test/ui/mismatched_types/for-loop-has-unit-body.rs +++ b/src/test/ui/mismatched_types/for-loop-has-unit-body.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { for x in 0..3 { x //~ ERROR mismatched types diff --git a/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr b/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr index 1fed5288397..25203d6f35d 100644 --- a/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr +++ b/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/for-loop-has-unit-body.rs:13:9 + --> $DIR/for-loop-has-unit-body.rs:3:9 | LL | x //~ ERROR mismatched types - | ^ expected (), found integral variable + | ^ expected (), found integer | = note: expected type `()` found type `{integer}` diff --git a/src/test/ui/mismatched_types/issue-19109.rs b/src/test/ui/mismatched_types/issue-19109.rs index 0f85218fcb8..030b7a40ca6 100644 --- a/src/test/ui/mismatched_types/issue-19109.rs +++ b/src/test/ui/mismatched_types/issue-19109.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait { } fn function(t: &mut Trait) { diff --git a/src/test/ui/mismatched_types/issue-19109.stderr b/src/test/ui/mismatched_types/issue-19109.stderr index 018ea941d12..db2d484edff 100644 --- a/src/test/ui/mismatched_types/issue-19109.stderr +++ b/src/test/ui/mismatched_types/issue-19109.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-19109.rs:14:5 + --> $DIR/issue-19109.rs:4:5 | LL | fn function(t: &mut Trait) { | - help: try adding a return type: `-> *mut dyn Trait` diff --git a/src/test/ui/mismatched_types/issue-26480.rs b/src/test/ui/mismatched_types/issue-26480.rs index 33c5e74fafa..d140e12b04d 100644 --- a/src/test/ui/mismatched_types/issue-26480.rs +++ b/src/test/ui/mismatched_types/issue-26480.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { fn write(fildes: i32, buf: *const i8, nbyte: u64) -> i64; } diff --git a/src/test/ui/mismatched_types/issue-26480.stderr b/src/test/ui/mismatched_types/issue-26480.stderr index ff047a28adc..11aa6cd7c1b 100644 --- a/src/test/ui/mismatched_types/issue-26480.stderr +++ b/src/test/ui/mismatched_types/issue-26480.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-26480.rs:26:19 + --> $DIR/issue-26480.rs:16:19 | LL | $arr.len() * size_of($arr[0])); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found usize @@ -8,7 +8,7 @@ LL | write!(hello); | -------------- in this macro invocation error[E0605]: non-primitive cast: `{integer}` as `()` - --> $DIR/issue-26480.rs:32:19 + --> $DIR/issue-26480.rs:22:19 | LL | ($x:expr) => ($x as ()) //~ ERROR non-primitive cast | ^^^^^^^^ diff --git a/src/test/ui/mismatched_types/issue-35030.rs b/src/test/ui/mismatched_types/issue-35030.rs index 503b2e08c39..91ea7ea80c3 100644 --- a/src/test/ui/mismatched_types/issue-35030.rs +++ b/src/test/ui/mismatched_types/issue-35030.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// rustc-env:RUST_NEW_ERROR_FORMAT +#![allow(non_camel_case_types)] trait Parser { fn parse(text: &str) -> Option; diff --git a/src/test/ui/mismatched_types/issue-35030.stderr b/src/test/ui/mismatched_types/issue-35030.stderr index 062bda4468a..6a3e7d930cf 100644 --- a/src/test/ui/mismatched_types/issue-35030.stderr +++ b/src/test/ui/mismatched_types/issue-35030.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-35030.rs:19:14 + --> $DIR/issue-35030.rs:9:14 | LL | Some(true) //~ ERROR mismatched types | ^^^^ expected type parameter, found bool diff --git a/src/test/ui/mismatched_types/issue-36053-2.rs b/src/test/ui/mismatched_types/issue-36053-2.rs index bf72e584b56..9035e3380b0 100644 --- a/src/test/ui/mismatched_types/issue-36053-2.rs +++ b/src/test/ui/mismatched_types/issue-36053-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #36053. ICE was caused due to obligations // being added to a special, dedicated fulfillment cx during // a probe. diff --git a/src/test/ui/mismatched_types/issue-36053-2.stderr b/src/test/ui/mismatched_types/issue-36053-2.stderr index 86a92a70287..e53e8c520e0 100644 --- a/src/test/ui/mismatched_types/issue-36053-2.stderr +++ b/src/test/ui/mismatched_types/issue-36053-2.stderr @@ -1,15 +1,15 @@ -error[E0599]: no method named `count` found for type `std::iter::Filter>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]>` in the current scope - --> $DIR/issue-36053-2.rs:17:55 +error[E0599]: no method named `count` found for type `std::iter::Filter>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]>` in the current scope + --> $DIR/issue-36053-2.rs:7:55 | LL | once::<&str>("str").fuse().filter(|a: &str| true).count(); | ^^^^^ | = note: the method `count` exists but the following trait bounds were not satisfied: - `std::iter::Filter>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator` - `&mut std::iter::Filter>, [closure@$DIR/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator` + `&mut std::iter::Filter>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]> : std::iter::Iterator` + `std::iter::Filter>, [closure@$DIR/issue-36053-2.rs:7:39: 7:53]> : std::iter::Iterator` error[E0631]: type mismatch in closure arguments - --> $DIR/issue-36053-2.rs:17:32 + --> $DIR/issue-36053-2.rs:7:32 | LL | once::<&str>("str").fuse().filter(|a: &str| true).count(); | ^^^^^^ -------------- found signature of `for<'r> fn(&'r str) -> _` diff --git a/src/test/ui/mismatched_types/issue-38371.rs b/src/test/ui/mismatched_types/issue-38371.rs index 8e613d4edba..d2cd2b88ab7 100644 --- a/src/test/ui/mismatched_types/issue-38371.rs +++ b/src/test/ui/mismatched_types/issue-38371.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { } diff --git a/src/test/ui/mismatched_types/issue-38371.stderr b/src/test/ui/mismatched_types/issue-38371.stderr index dd5da769075..f702a4f47f1 100644 --- a/src/test/ui/mismatched_types/issue-38371.stderr +++ b/src/test/ui/mismatched_types/issue-38371.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-38371.rs:14:8 + --> $DIR/issue-38371.rs:4:8 | LL | fn foo(&foo: Foo) { //~ ERROR mismatched types | ^^^^ expected struct `Foo`, found reference @@ -9,7 +9,7 @@ LL | fn foo(&foo: Foo) { //~ ERROR mismatched types = help: did you mean `foo: &Foo`? error[E0308]: mismatched types - --> $DIR/issue-38371.rs:28:9 + --> $DIR/issue-38371.rs:18:9 | LL | fn agh(&&bar: &u32) { //~ ERROR mismatched types | ^^^^ expected u32, found reference @@ -19,7 +19,7 @@ LL | fn agh(&&bar: &u32) { //~ ERROR mismatched types = help: did you mean `bar: &u32`? error[E0308]: mismatched types - --> $DIR/issue-38371.rs:31:8 + --> $DIR/issue-38371.rs:21:8 | LL | fn bgh(&&bar: u32) { //~ ERROR mismatched types | ^^^^^ expected u32, found reference @@ -28,7 +28,7 @@ LL | fn bgh(&&bar: u32) { //~ ERROR mismatched types found type `&_` error[E0529]: expected an array or slice, found `u32` - --> $DIR/issue-38371.rs:34:9 + --> $DIR/issue-38371.rs:24:9 | LL | fn ugh(&[bar]: &u32) { //~ ERROR expected an array or slice | ^^^^^ pattern cannot match with input type `u32` diff --git a/src/test/ui/mismatched_types/main.rs b/src/test/ui/mismatched_types/main.rs index 7cf1de7cfee..16c18ddda29 100644 --- a/src/test/ui/mismatched_types/main.rs +++ b/src/test/ui/mismatched_types/main.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: u32 = ( //~ ERROR mismatched types ); diff --git a/src/test/ui/mismatched_types/main.stderr b/src/test/ui/mismatched_types/main.stderr index ce6f2ee6e05..57e95e41333 100644 --- a/src/test/ui/mismatched_types/main.stderr +++ b/src/test/ui/mismatched_types/main.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/main.rs:12:18 + --> $DIR/main.rs:2:18 | LL | let x: u32 = ( //~ ERROR mismatched types | __________________^ diff --git a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.rs b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.rs index 2c7b8218de0..83cea168465 100644 --- a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.rs +++ b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; fn main() { diff --git a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr index 471c15f6d72..9721dc8ba4e 100644 --- a/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr +++ b/src/test/ui/mismatched_types/method-help-unsatisfied-bound.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `unwrap` found for type `std::result::Result<(), Foo>` in the current scope - --> $DIR/method-help-unsatisfied-bound.rs:15:7 + --> $DIR/method-help-unsatisfied-bound.rs:5:7 | LL | a.unwrap(); | ^^^^^^ diff --git a/src/test/ui/mismatched_types/numeric-literal-cast.rs b/src/test/ui/mismatched_types/numeric-literal-cast.rs index 516b2e8dd30..74a22117099 100644 --- a/src/test/ui/mismatched_types/numeric-literal-cast.rs +++ b/src/test/ui/mismatched_types/numeric-literal-cast.rs @@ -1,20 +1,13 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(_: u16) {} fn foo1(_: f64) {} fn foo2(_: i32) {} fn main() { foo(1u8); +//~^ ERROR mismatched types foo1(2f32); +//~^ ERROR mismatched types foo2(3i16); +//~^ ERROR mismatched types } diff --git a/src/test/ui/mismatched_types/numeric-literal-cast.stderr b/src/test/ui/mismatched_types/numeric-literal-cast.stderr index e2fe1a0914d..ec53f1f0ecc 100644 --- a/src/test/ui/mismatched_types/numeric-literal-cast.stderr +++ b/src/test/ui/mismatched_types/numeric-literal-cast.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/numeric-literal-cast.rs:16:9 + --> $DIR/numeric-literal-cast.rs:6:9 | LL | foo(1u8); | ^^^ expected u16, found u8 @@ -9,7 +9,7 @@ LL | foo(1u16); | ^^^^ error[E0308]: mismatched types - --> $DIR/numeric-literal-cast.rs:17:10 + --> $DIR/numeric-literal-cast.rs:8:10 | LL | foo1(2f32); | ^^^^ expected f64, found f32 @@ -19,7 +19,7 @@ LL | foo1(2f64); | ^^^^ error[E0308]: mismatched types - --> $DIR/numeric-literal-cast.rs:18:10 + --> $DIR/numeric-literal-cast.rs:10:10 | LL | foo2(3i16); | ^^^^ expected i32, found i16 diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.rs b/src/test/ui/mismatched_types/overloaded-calls-bad.rs index 00edc07db81..73e74a97f06 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.rs +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(fn_traits, unboxed_closures)] use std::ops::FnMut; diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr index d841a340431..51975abd720 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/overloaded-calls-bad.rs:38:17 + --> $DIR/overloaded-calls-bad.rs:28:17 | LL | let ans = s("what"); //~ ERROR mismatched types | ^^^^^^ expected isize, found reference @@ -8,13 +8,13 @@ LL | let ans = s("what"); //~ ERROR mismatched types found type `&'static str` error[E0057]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/overloaded-calls-bad.rs:39:15 + --> $DIR/overloaded-calls-bad.rs:29:15 | LL | let ans = s(); | ^^^ expected 1 parameter error[E0057]: this function takes 1 parameter but 2 parameters were supplied - --> $DIR/overloaded-calls-bad.rs:41:15 + --> $DIR/overloaded-calls-bad.rs:31:15 | LL | let ans = s("burma", "shave"); | ^^^^^^^^^^^^^^^^^^^ expected 1 parameter diff --git a/src/test/ui/mismatched_types/recovered-block.rs b/src/test/ui/mismatched_types/recovered-block.rs index 8166254e8a6..cb8ad8092dd 100644 --- a/src/test/ui/mismatched_types/recovered-block.rs +++ b/src/test/ui/mismatched_types/recovered-block.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no std::env support use std::env; diff --git a/src/test/ui/mismatched_types/recovered-block.stderr b/src/test/ui/mismatched_types/recovered-block.stderr index 75fb7b28a6e..7834750630b 100644 --- a/src/test/ui/mismatched_types/recovered-block.stderr +++ b/src/test/ui/mismatched_types/recovered-block.stderr @@ -1,5 +1,5 @@ error: missing `struct` for struct definition - --> $DIR/recovered-block.rs:23:8 + --> $DIR/recovered-block.rs:13:8 | LL | pub Foo { text } | ^ @@ -9,7 +9,7 @@ LL | pub struct Foo { text } | ^^^^^^ error: expected one of `(` or `<`, found `{` - --> $DIR/recovered-block.rs:29:9 + --> $DIR/recovered-block.rs:19:9 | LL | Foo { text: "".to_string() } | ^ expected one of `(` or `<` here diff --git a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs index b2aeabdc1e1..be5fab871b4 100644 --- a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs +++ b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Foo { fn dummy(&self) { } } diff --git a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr index 15c9fd6bf8f..a9b637c81a7 100644 --- a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr +++ b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/trait-bounds-cant-coerce.rs:24:7 + --> $DIR/trait-bounds-cant-coerce.rs:13:7 | LL | a(x); //~ ERROR mismatched types [E0308] | ^ expected trait `Foo + std::marker::Send`, found trait `Foo` diff --git a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs index 420b59a4df1..3547272e51b 100644 --- a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs +++ b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // rustc-env:RUST_NEW_ERROR_FORMAT trait Foo { diff --git a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr index 631af21cac5..4e54b35029a 100644 --- a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr +++ b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr @@ -1,5 +1,5 @@ error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/trait-impl-fn-incompatibility.rs:21:15 + --> $DIR/trait-impl-fn-incompatibility.rs:11:15 | LL | fn foo(x: u16); | --- type in trait @@ -11,7 +11,7 @@ LL | fn foo(x: i16) { } //~ ERROR incompatible type found type `fn(i16)` error[E0053]: method `bar` has an incompatible type for trait - --> $DIR/trait-impl-fn-incompatibility.rs:22:28 + --> $DIR/trait-impl-fn-incompatibility.rs:12:28 | LL | fn bar(&mut self, bar: &mut Bar); | -------- type in trait diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs index f2237e495a0..88bea979b97 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] use std::ops::FnMut; diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index 762f0744d80..8db81a8c683 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -1,5 +1,5 @@ error[E0631]: type mismatch in closure arguments - --> $DIR/unboxed-closures-vtable-mismatch.rs:25:13 + --> $DIR/unboxed-closures-vtable-mismatch.rs:15:13 | LL | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); | ----------------------------- found signature of `fn(usize, isize) -> _` @@ -8,7 +8,7 @@ LL | let z = call_it(3, f); | ^^^^^^^ expected signature of `fn(isize, isize) -> _` | note: required by `call_it` - --> $DIR/unboxed-closures-vtable-mismatch.rs:17:1 + --> $DIR/unboxed-closures-vtable-mismatch.rs:7:1 | LL | fn call_itisize>(y: isize, mut f: F) -> isize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/missing/auxiliary/two_macros.rs b/src/test/ui/missing/auxiliary/two_macros.rs index 060960f0dbc..2330c75c8e0 100644 --- a/src/test/ui/missing/auxiliary/two_macros.rs +++ b/src/test/ui/missing/auxiliary/two_macros.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! macro_one { () => ("one") } diff --git a/src/test/ui/missing/missing-alloc_error_handler.rs b/src/test/ui/missing/missing-alloc_error_handler.rs index 89c368456b1..de1bfb15e6f 100644 --- a/src/test/ui/missing/missing-alloc_error_handler.rs +++ b/src/test/ui/missing/missing-alloc_error_handler.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C panic=abort // no-prefer-dynamic diff --git a/src/test/ui/missing/missing-allocator.rs b/src/test/ui/missing/missing-allocator.rs index f4405d1f8fb..cd5d4fe1853 100644 --- a/src/test/ui/missing/missing-allocator.rs +++ b/src/test/ui/missing/missing-allocator.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -C panic=abort // no-prefer-dynamic diff --git a/src/test/ui/missing/missing-block-hint.rs b/src/test/ui/missing/missing-block-hint.rs index 777ff5b9b26..89db02a9cba 100644 --- a/src/test/ui/missing/missing-block-hint.rs +++ b/src/test/ui/missing/missing-block-hint.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { { if (foo) => {} //~ ERROR expected `{`, found `=>` diff --git a/src/test/ui/missing/missing-block-hint.stderr b/src/test/ui/missing/missing-block-hint.stderr index dbbfd10b795..576a6268a99 100644 --- a/src/test/ui/missing/missing-block-hint.stderr +++ b/src/test/ui/missing/missing-block-hint.stderr @@ -1,5 +1,5 @@ error: expected `{`, found `=>` - --> $DIR/missing-block-hint.rs:13:18 + --> $DIR/missing-block-hint.rs:3:18 | LL | if (foo) => {} //~ ERROR expected `{`, found `=>` | -- ^^ expected `{` @@ -7,7 +7,7 @@ LL | if (foo) => {} //~ ERROR expected `{`, found `=>` | this `if` statement has a condition, but no block error: expected `{`, found `bar` - --> $DIR/missing-block-hint.rs:17:13 + --> $DIR/missing-block-hint.rs:7:13 | LL | if (foo) | -- this `if` statement has a condition, but no block diff --git a/src/test/ui/missing/missing-comma-in-match.fixed b/src/test/ui/missing/missing-comma-in-match.fixed index 4832f35f42d..de1b9506af9 100644 --- a/src/test/ui/missing/missing-comma-in-match.fixed +++ b/src/test/ui/missing/missing-comma-in-match.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix fn main() { diff --git a/src/test/ui/missing/missing-comma-in-match.rs b/src/test/ui/missing/missing-comma-in-match.rs index e39b20e77ea..d7d16155cf2 100644 --- a/src/test/ui/missing/missing-comma-in-match.rs +++ b/src/test/ui/missing/missing-comma-in-match.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix fn main() { diff --git a/src/test/ui/missing/missing-comma-in-match.stderr b/src/test/ui/missing/missing-comma-in-match.stderr index 77935934107..ae46516f8d1 100644 --- a/src/test/ui/missing/missing-comma-in-match.stderr +++ b/src/test/ui/missing/missing-comma-in-match.stderr @@ -1,5 +1,5 @@ error: expected one of `,`, `.`, `?`, `}`, or an operator, found `=>` - --> $DIR/missing-comma-in-match.rs:16:18 + --> $DIR/missing-comma-in-match.rs:6:18 | LL | &None => 1 | - help: missing a comma here to end this `match` arm diff --git a/src/test/ui/missing/missing-derivable-attr.rs b/src/test/ui/missing/missing-derivable-attr.rs index 7eee51e4076..58c94de5059 100644 --- a/src/test/ui/missing/missing-derivable-attr.rs +++ b/src/test/ui/missing/missing-derivable-attr.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait MyEq { fn eq(&self, other: &Self) -> bool; } diff --git a/src/test/ui/missing/missing-derivable-attr.stderr b/src/test/ui/missing/missing-derivable-attr.stderr index cccba2f5f3f..e3e61bcb391 100644 --- a/src/test/ui/missing/missing-derivable-attr.stderr +++ b/src/test/ui/missing/missing-derivable-attr.stderr @@ -1,5 +1,5 @@ error[E0046]: not all trait items implemented, missing: `eq` - --> $DIR/missing-derivable-attr.rs:23:1 + --> $DIR/missing-derivable-attr.rs:13:1 | LL | fn eq(&self, other: &Self) -> bool; | ----------------------------------- `eq` from trait diff --git a/src/test/ui/missing/missing-fields-in-struct-pattern.rs b/src/test/ui/missing/missing-fields-in-struct-pattern.rs index dfde3799499..24b6b55db66 100644 --- a/src/test/ui/missing/missing-fields-in-struct-pattern.rs +++ b/src/test/ui/missing/missing-fields-in-struct-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S(usize, usize, usize, usize); fn main() { diff --git a/src/test/ui/missing/missing-fields-in-struct-pattern.stderr b/src/test/ui/missing/missing-fields-in-struct-pattern.stderr index d1c3260f11e..5d88a5d03e2 100644 --- a/src/test/ui/missing/missing-fields-in-struct-pattern.stderr +++ b/src/test/ui/missing/missing-fields-in-struct-pattern.stderr @@ -1,11 +1,11 @@ error[E0026]: struct `S` does not have fields named `a`, `b`, `c`, `d` - --> $DIR/missing-fields-in-struct-pattern.rs:14:16 + --> $DIR/missing-fields-in-struct-pattern.rs:4:16 | LL | if let S { a, b, c, d } = S(1, 2, 3, 4) { | ^ ^ ^ ^ struct `S` does not have these fields error[E0027]: pattern does not mention fields `0`, `1`, `2`, `3` - --> $DIR/missing-fields-in-struct-pattern.rs:14:12 + --> $DIR/missing-fields-in-struct-pattern.rs:4:12 | LL | if let S { a, b, c, d } = S(1, 2, 3, 4) { | ^^^^^^^^^^^^^^^^ missing fields `0`, `1`, `2`, `3` diff --git a/src/test/ui/missing/missing-items/auxiliary/m1.rs b/src/test/ui/missing/missing-items/auxiliary/m1.rs index 49fc586d6b5..7705066760c 100644 --- a/src/test/ui/missing/missing-items/auxiliary/m1.rs +++ b/src/test/ui/missing/missing-items/auxiliary/m1.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub trait X { const CONSTANT: u32; type Type; diff --git a/src/test/ui/missing/missing-items/issue-40221.rs b/src/test/ui/missing/missing-items/issue-40221.rs index 526fc3a8658..e1f7e975b80 100644 --- a/src/test/ui/missing/missing-items/issue-40221.rs +++ b/src/test/ui/missing/missing-items/issue-40221.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum P { C(PC), } diff --git a/src/test/ui/missing/missing-items/issue-40221.stderr b/src/test/ui/missing/missing-items/issue-40221.stderr index 81c9f40f6cf..437fb7bbc31 100644 --- a/src/test/ui/missing/missing-items/issue-40221.stderr +++ b/src/test/ui/missing/missing-items/issue-40221.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `C(QA)` not covered - --> $DIR/issue-40221.rs:21:11 + --> $DIR/issue-40221.rs:11:11 | LL | match proto { //~ ERROR non-exhaustive patterns | ^^^^^ pattern `C(QA)` not covered diff --git a/src/test/ui/missing/missing-items/m2.rs b/src/test/ui/missing/missing-items/m2.rs index f655047f6f5..c2a6914abc9 100644 --- a/src/test/ui/missing/missing-items/m2.rs +++ b/src/test/ui/missing/missing-items/m2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:m1.rs diff --git a/src/test/ui/missing/missing-items/m2.stderr b/src/test/ui/missing/missing-items/m2.stderr index 3f7a4039eb7..b2245750518 100644 --- a/src/test/ui/missing/missing-items/m2.stderr +++ b/src/test/ui/missing/missing-items/m2.stderr @@ -1,5 +1,5 @@ error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method` - --> $DIR/m2.rs:19:1 + --> $DIR/m2.rs:9:1 | LL | impl m1::X for X { //~ ERROR not all trait items implemented | ^^^^^^^^^^^^^^^^ missing `CONSTANT`, `Type`, `method` in implementation diff --git a/src/test/ui/missing/missing-items/missing-type-parameter.rs b/src/test/ui/missing/missing-items/missing-type-parameter.rs index f2d5359fb16..8a64053a4f0 100644 --- a/src/test/ui/missing/missing-items/missing-type-parameter.rs +++ b/src/test/ui/missing/missing-items/missing-type-parameter.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() { } fn main() { diff --git a/src/test/ui/missing/missing-items/missing-type-parameter.stderr b/src/test/ui/missing/missing-items/missing-type-parameter.stderr index a27e8aac28f..619377198e1 100644 --- a/src/test/ui/missing/missing-items/missing-type-parameter.stderr +++ b/src/test/ui/missing/missing-items/missing-type-parameter.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/missing-type-parameter.rs:14:5 + --> $DIR/missing-type-parameter.rs:4:5 | LL | foo(); //~ ERROR type annotations needed | ^^^ cannot infer type for `X` diff --git a/src/test/ui/missing/missing-macro-use.rs b/src/test/ui/missing/missing-macro-use.rs index bfe49ea0009..dff4c94fcf4 100644 --- a/src/test/ui/missing/missing-macro-use.rs +++ b/src/test/ui/missing/missing-macro-use.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:two_macros.rs extern crate two_macros; diff --git a/src/test/ui/missing/missing-macro-use.stderr b/src/test/ui/missing/missing-macro-use.stderr index 6986b4d5733..01a7beb3b05 100644 --- a/src/test/ui/missing/missing-macro-use.stderr +++ b/src/test/ui/missing/missing-macro-use.stderr @@ -1,5 +1,5 @@ error: cannot find macro `macro_two!` in this scope - --> $DIR/missing-macro-use.rs:16:5 + --> $DIR/missing-macro-use.rs:6:5 | LL | macro_two!(); | ^^^^^^^^^ diff --git a/src/test/ui/missing/missing-main.rs b/src/test/ui/missing/missing-main.rs index 2788a5c2d58..6ad54453309 100644 --- a/src/test/ui/missing/missing-main.rs +++ b/src/test/ui/missing/missing-main.rs @@ -1,12 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: `main` function not found fn mian() { } diff --git a/src/test/ui/missing/missing-return.rs b/src/test/ui/missing/missing-return.rs index efd0c827a35..6a171753d9e 100644 --- a/src/test/ui/missing/missing-return.rs +++ b/src/test/ui/missing/missing-return.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: return fn f() -> isize { } diff --git a/src/test/ui/missing/missing-return.stderr b/src/test/ui/missing/missing-return.stderr index d12a5832877..42466e2fc65 100644 --- a/src/test/ui/missing/missing-return.stderr +++ b/src/test/ui/missing/missing-return.stderr @@ -1,8 +1,10 @@ error[E0308]: mismatched types - --> $DIR/missing-return.rs:13:17 + --> $DIR/missing-return.rs:3:11 | LL | fn f() -> isize { } - | ^^^ expected isize, found () + | - ^^^^^ expected isize, found () + | | + | this function's body doesn't return | = note: expected type `isize` found type `()` diff --git a/src/test/ui/missing/missing-semicolon-warning.rs b/src/test/ui/missing/missing-semicolon-warning.rs index 219f68877be..11204af702a 100644 --- a/src/test/ui/missing/missing-semicolon-warning.rs +++ b/src/test/ui/missing/missing-semicolon-warning.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused)] diff --git a/src/test/ui/missing/missing-semicolon-warning.stderr b/src/test/ui/missing/missing-semicolon-warning.stderr index c294e3eaf9c..50627c3252d 100644 --- a/src/test/ui/missing/missing-semicolon-warning.stderr +++ b/src/test/ui/missing/missing-semicolon-warning.stderr @@ -1,5 +1,5 @@ warning: expected `;`, found keyword `let` - --> $DIR/missing-semicolon-warning.rs:16:12 + --> $DIR/missing-semicolon-warning.rs:6:12 | LL | $( let x = $e1 )*; //~ WARN expected `;` | ^^^ @@ -10,7 +10,7 @@ LL | fn main() { m!(0, 0; 0, 0); } = note: This was erroneously allowed and will become a hard error in a future release warning: expected `;`, found `println` - --> $DIR/missing-semicolon-warning.rs:17:12 + --> $DIR/missing-semicolon-warning.rs:7:12 | LL | $( println!("{}", $e2) )*; //~ WARN expected `;` | ^^^^^^^ diff --git a/src/test/ui/missing/missing-stability.rs b/src/test/ui/missing/missing-stability.rs index 1922efb5e19..86841706325 100644 --- a/src/test/ui/missing/missing-stability.rs +++ b/src/test/ui/missing/missing-stability.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks that exported items without stability attributes cause an error #![crate_type="lib"] diff --git a/src/test/ui/missing/missing-stability.stderr b/src/test/ui/missing/missing-stability.stderr index 6e2802e43c5..e55bd00e2c6 100644 --- a/src/test/ui/missing/missing-stability.stderr +++ b/src/test/ui/missing/missing-stability.stderr @@ -1,5 +1,5 @@ error: This node does not have a stability attribute - --> $DIR/missing-stability.rs:18:1 + --> $DIR/missing-stability.rs:8:1 | LL | / pub fn unmarked() { LL | | //~^ ERROR This node does not have a stability attribute @@ -8,7 +8,7 @@ LL | | } | |_^ error: This node does not have a stability attribute - --> $DIR/missing-stability.rs:32:5 + --> $DIR/missing-stability.rs:22:5 | LL | pub fn unmarked() {} | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/missing_debug_impls.rs b/src/test/ui/missing_debug_impls.rs index ddc9081e33b..ff919292ae2 100644 --- a/src/test/ui/missing_debug_impls.rs +++ b/src/test/ui/missing_debug_impls.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --crate-type lib #![deny(missing_debug_implementations)] #![allow(unused)] diff --git a/src/test/ui/missing_debug_impls.stderr b/src/test/ui/missing_debug_impls.stderr index 4b4c05f79f0..cceab4b4c0b 100644 --- a/src/test/ui/missing_debug_impls.stderr +++ b/src/test/ui/missing_debug_impls.stderr @@ -1,17 +1,17 @@ error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation - --> $DIR/missing_debug_impls.rs:17:1 + --> $DIR/missing_debug_impls.rs:7:1 | LL | pub enum A {} //~ ERROR type does not implement `fmt::Debug` | ^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/missing_debug_impls.rs:12:9 + --> $DIR/missing_debug_impls.rs:2:9 | LL | #![deny(missing_debug_implementations)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation - --> $DIR/missing_debug_impls.rs:30:1 + --> $DIR/missing_debug_impls.rs:20:1 | LL | pub struct Foo; //~ ERROR type does not implement `fmt::Debug` | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/missing_non_modrs_mod/foo.rs b/src/test/ui/missing_non_modrs_mod/foo.rs index 7262a26397c..4f41316c8f7 100644 --- a/src/test/ui/missing_non_modrs_mod/foo.rs +++ b/src/test/ui/missing_non_modrs_mod/foo.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // ignore-test this is just a helper for the real test in this dir diff --git a/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs index 84fa1f032d7..4ff975af67d 100644 --- a/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs +++ b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.rs @@ -1,12 +1,2 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo; fn main() {} diff --git a/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr index f494af0ff3e..98b74e5f5cb 100644 --- a/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr +++ b/src/test/ui/missing_non_modrs_mod/missing_non_modrs_mod.stderr @@ -1,5 +1,5 @@ error[E0583]: file not found for module `missing` - --> $DIR/foo.rs:13:5 + --> $DIR/foo.rs:4:5 | LL | mod missing; | ^^^^^^^ diff --git a/src/test/ui/mod-subitem-as-enum-variant.rs b/src/test/ui/mod-subitem-as-enum-variant.rs new file mode 100644 index 00000000000..ec809d44e94 --- /dev/null +++ b/src/test/ui/mod-subitem-as-enum-variant.rs @@ -0,0 +1,10 @@ + +mod Mod { + pub struct FakeVariant(pub T); +} + +fn main() { + Mod::FakeVariant::(0); + Mod::::FakeVariant(0); + //~^ ERROR type arguments are not allowed on this entity [E0109] +} diff --git a/src/test/ui/mod-subitem-as-enum-variant.stderr b/src/test/ui/mod-subitem-as-enum-variant.stderr new file mode 100644 index 00000000000..d62bad81c3d --- /dev/null +++ b/src/test/ui/mod-subitem-as-enum-variant.stderr @@ -0,0 +1,9 @@ +error[E0109]: type arguments are not allowed on this entity + --> $DIR/mod-subitem-as-enum-variant.rs:8:11 + | +LL | Mod::::FakeVariant(0); + | ^^^ type argument not allowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0109`. diff --git a/src/test/ui/mod/mod_file_aux.rs b/src/test/ui/mod/mod_file_aux.rs index b7470811f60..98f42c5cdb1 100644 --- a/src/test/ui/mod/mod_file_aux.rs +++ b/src/test/ui/mod/mod_file_aux.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test Not a test. Used by other tests pub fn foo() -> isize { 10 } diff --git a/src/test/ui/mod/mod_file_correct_spans.rs b/src/test/ui/mod/mod_file_correct_spans.rs index 1efd9ba8e55..c42d2eaa7bd 100644 --- a/src/test/ui/mod/mod_file_correct_spans.rs +++ b/src/test/ui/mod/mod_file_correct_spans.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Testing that the source_map is maintained correctly when parsing mods from external files mod mod_file_aux; diff --git a/src/test/ui/mod/mod_file_correct_spans.stderr b/src/test/ui/mod/mod_file_correct_spans.stderr index 6f5e4cc51eb..73044752b07 100644 --- a/src/test/ui/mod/mod_file_correct_spans.stderr +++ b/src/test/ui/mod/mod_file_correct_spans.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find function `bar` in module `mod_file_aux` - --> $DIR/mod_file_correct_spans.rs:16:27 + --> $DIR/mod_file_correct_spans.rs:6:27 | LL | assert!(mod_file_aux::bar() == 10); | ^^^ not found in `mod_file_aux` diff --git a/src/test/ui/mod/mod_file_disambig.rs b/src/test/ui/mod/mod_file_disambig.rs index 27c253234be..ef203ef082b 100644 --- a/src/test/ui/mod/mod_file_disambig.rs +++ b/src/test/ui/mod/mod_file_disambig.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - mod mod_file_disambig_aux; //~ ERROR file for module `mod_file_disambig_aux` found at both fn main() { diff --git a/src/test/ui/mod/mod_file_disambig.stderr b/src/test/ui/mod/mod_file_disambig.stderr index 16a013ebfdb..1720ca420ca 100644 --- a/src/test/ui/mod/mod_file_disambig.stderr +++ b/src/test/ui/mod/mod_file_disambig.stderr @@ -1,5 +1,5 @@ error[E0584]: file for module `mod_file_disambig_aux` found at both mod_file_disambig_aux.rs and mod_file_disambig_aux/mod.rs - --> $DIR/mod_file_disambig.rs:13:5 + --> $DIR/mod_file_disambig.rs:1:5 | LL | mod mod_file_disambig_aux; //~ ERROR file for module `mod_file_disambig_aux` found at both | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/mod/mod_file_disambig_aux.rs b/src/test/ui/mod/mod_file_disambig_aux.rs index f617b293463..3bf9609f4ed 100644 --- a/src/test/ui/mod/mod_file_disambig_aux.rs +++ b/src/test/ui/mod/mod_file_disambig_aux.rs @@ -1,11 +1 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test not a test. aux file diff --git a/src/test/ui/mod/mod_file_disambig_aux/mod.rs b/src/test/ui/mod/mod_file_disambig_aux/mod.rs index f617b293463..3bf9609f4ed 100644 --- a/src/test/ui/mod/mod_file_disambig_aux/mod.rs +++ b/src/test/ui/mod/mod_file_disambig_aux/mod.rs @@ -1,11 +1 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-test not a test. aux file diff --git a/src/test/ui/module-macro_use-arguments.rs b/src/test/ui/module-macro_use-arguments.rs index 6d3038b4820..6627b48eb6a 100644 --- a/src/test/ui/module-macro_use-arguments.rs +++ b/src/test/ui/module-macro_use-arguments.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_use(foo, bar)] //~ ERROR arguments to macro_use are not allowed here mod foo { } diff --git a/src/test/ui/module-macro_use-arguments.stderr b/src/test/ui/module-macro_use-arguments.stderr index c61288776dd..4dc6df39a47 100644 --- a/src/test/ui/module-macro_use-arguments.stderr +++ b/src/test/ui/module-macro_use-arguments.stderr @@ -1,5 +1,5 @@ error: arguments to macro_use are not allowed here - --> $DIR/module-macro_use-arguments.rs:11:1 + --> $DIR/module-macro_use-arguments.rs:1:1 | LL | #[macro_use(foo, bar)] //~ ERROR arguments to macro_use are not allowed here | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/moves/move-guard-same-consts.nll.stderr b/src/test/ui/moves/move-guard-same-consts.nll.stderr new file mode 100644 index 00000000000..43f99cabcae --- /dev/null +++ b/src/test/ui/moves/move-guard-same-consts.nll.stderr @@ -0,0 +1,14 @@ +error[E0382]: use of moved value: `x` + --> $DIR/move-guard-same-consts.rs:20:24 + | +LL | let x: Box<_> = box 1; + | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait +... +LL | (1, 2) if take(x) => (), + | - value moved here +LL | (1, 2) if take(x) => (), //~ ERROR use of moved value: `x` + | ^ value used here after move + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/moves/move-guard-same-consts.rs b/src/test/ui/moves/move-guard-same-consts.rs index 05fe48e0199..a2beb368b6e 100644 --- a/src/test/ui/moves/move-guard-same-consts.rs +++ b/src/test/ui/moves/move-guard-same-consts.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // #47295: We used to have a hack of special-casing adjacent amtch // arms whose patterns were composed solely of constants to not have // them linked in the cfg. diff --git a/src/test/ui/moves/move-guard-same-consts.stderr b/src/test/ui/moves/move-guard-same-consts.stderr index 71f90ee7e54..78a76a47b8a 100644 --- a/src/test/ui/moves/move-guard-same-consts.stderr +++ b/src/test/ui/moves/move-guard-same-consts.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/move-guard-same-consts.rs:30:24 + --> $DIR/move-guard-same-consts.rs:20:24 | LL | (1, 2) if take(x) => (), | - value moved here diff --git a/src/test/ui/moves/move-in-guard-1.nll.stderr b/src/test/ui/moves/move-in-guard-1.nll.stderr new file mode 100644 index 00000000000..41abe6fa72a --- /dev/null +++ b/src/test/ui/moves/move-in-guard-1.nll.stderr @@ -0,0 +1,14 @@ +error[E0382]: use of moved value: `x` + --> $DIR/move-in-guard-1.rs:10:24 + | +LL | let x: Box<_> = box 1; + | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait +... +LL | (1, _) if take(x) => (), + | - value moved here +LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` + | ^ value used here after move + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/moves/move-in-guard-1.rs b/src/test/ui/moves/move-in-guard-1.rs index 068bfa3cd7c..9c50782e640 100644 --- a/src/test/ui/moves/move-in-guard-1.rs +++ b/src/test/ui/moves/move-in-guard-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] pub fn main() { diff --git a/src/test/ui/moves/move-in-guard-1.stderr b/src/test/ui/moves/move-in-guard-1.stderr index 5dd46a61176..d4cb538e05d 100644 --- a/src/test/ui/moves/move-in-guard-1.stderr +++ b/src/test/ui/moves/move-in-guard-1.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/move-in-guard-1.rs:20:24 + --> $DIR/move-in-guard-1.rs:10:24 | LL | (1, _) if take(x) => (), | - value moved here diff --git a/src/test/ui/moves/move-in-guard-2.nll.stderr b/src/test/ui/moves/move-in-guard-2.nll.stderr index 2a53a98c0f2..0b14c1620d3 100644 --- a/src/test/ui/moves/move-in-guard-2.nll.stderr +++ b/src/test/ui/moves/move-in-guard-2.nll.stderr @@ -1,10 +1,11 @@ error[E0382]: use of moved value: `x` - --> $DIR/move-in-guard-2.rs:20:24 + --> $DIR/move-in-guard-2.rs:10:24 | +LL | let x: Box<_> = box 1; + | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait +... LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` | ^ value moved here, in previous iteration of loop - | - = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/moves/move-in-guard-2.rs b/src/test/ui/moves/move-in-guard-2.rs index 984963b2f83..f478625a83b 100644 --- a/src/test/ui/moves/move-in-guard-2.rs +++ b/src/test/ui/moves/move-in-guard-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] pub fn main() { diff --git a/src/test/ui/moves/move-in-guard-2.stderr b/src/test/ui/moves/move-in-guard-2.stderr index a12d9e98b1b..d4e747c9f61 100644 --- a/src/test/ui/moves/move-in-guard-2.stderr +++ b/src/test/ui/moves/move-in-guard-2.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/move-in-guard-2.rs:20:24 + --> $DIR/move-in-guard-2.rs:10:24 | LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` | ^ value moved here in previous iteration of loop diff --git a/src/test/ui/moves/move-into-dead-array-1.nll.stderr b/src/test/ui/moves/move-into-dead-array-1.nll.stderr index 42f43d3f661..e3a2a601246 100644 --- a/src/test/ui/moves/move-into-dead-array-1.nll.stderr +++ b/src/test/ui/moves/move-into-dead-array-1.nll.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `a` - --> $DIR/move-into-dead-array-1.rs:24:5 + --> $DIR/move-into-dead-array-1.rs:14:5 | LL | a[i] = d(); //~ ERROR use of possibly uninitialized variable: `a` | ^^^^ use of possibly uninitialized `a` diff --git a/src/test/ui/moves/move-into-dead-array-1.rs b/src/test/ui/moves/move-into-dead-array-1.rs index 61ccb694fd2..16a18da4a44 100644 --- a/src/test/ui/moves/move-into-dead-array-1.rs +++ b/src/test/ui/moves/move-into-dead-array-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensure that we cannot move into an uninitialized fixed-size array. struct D { _x: u8 } diff --git a/src/test/ui/moves/move-into-dead-array-1.stderr b/src/test/ui/moves/move-into-dead-array-1.stderr index ac18565f194..36f98a76b54 100644 --- a/src/test/ui/moves/move-into-dead-array-1.stderr +++ b/src/test/ui/moves/move-into-dead-array-1.stderr @@ -1,5 +1,5 @@ error[E0381]: use of possibly uninitialized variable: `a` - --> $DIR/move-into-dead-array-1.rs:24:5 + --> $DIR/move-into-dead-array-1.rs:14:5 | LL | a[i] = d(); //~ ERROR use of possibly uninitialized variable: `a` | ^^^^^^^^^^ use of possibly uninitialized `a` diff --git a/src/test/ui/moves/move-into-dead-array-2.nll.stderr b/src/test/ui/moves/move-into-dead-array-2.nll.stderr index cc6cc4211c0..20bfdc2bbac 100644 --- a/src/test/ui/moves/move-into-dead-array-2.nll.stderr +++ b/src/test/ui/moves/move-into-dead-array-2.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: use of moved value: `a` - --> $DIR/move-into-dead-array-2.rs:24:5 + --> $DIR/move-into-dead-array-2.rs:14:5 | +LL | fn foo(mut a: [D; 4], i: usize) { + | ----- move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait LL | drop(a); | - value moved here LL | a[i] = d(); //~ ERROR use of moved value: `a` | ^^^^ value used here after move - | - = note: move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/moves/move-into-dead-array-2.rs b/src/test/ui/moves/move-into-dead-array-2.rs index d484837c001..9b66ea35f56 100644 --- a/src/test/ui/moves/move-into-dead-array-2.rs +++ b/src/test/ui/moves/move-into-dead-array-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensure that we cannot move into an uninitialized fixed-size array. struct D { _x: u8 } diff --git a/src/test/ui/moves/move-into-dead-array-2.stderr b/src/test/ui/moves/move-into-dead-array-2.stderr index 0d999e67f98..417b1ab2054 100644 --- a/src/test/ui/moves/move-into-dead-array-2.stderr +++ b/src/test/ui/moves/move-into-dead-array-2.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `a` - --> $DIR/move-into-dead-array-2.rs:24:5 + --> $DIR/move-into-dead-array-2.rs:14:5 | LL | drop(a); | - value moved here diff --git a/src/test/ui/moves/move-out-of-array-1.rs b/src/test/ui/moves/move-out-of-array-1.rs index 796b13538b2..77cb73e47b7 100644 --- a/src/test/ui/moves/move-out-of-array-1.rs +++ b/src/test/ui/moves/move-out-of-array-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensure that we cannot move out of a fixed-size array (especially // when the element type has a destructor). diff --git a/src/test/ui/moves/move-out-of-array-1.stderr b/src/test/ui/moves/move-out-of-array-1.stderr index d015505a46b..677f0b42f5a 100644 --- a/src/test/ui/moves/move-out-of-array-1.stderr +++ b/src/test/ui/moves/move-out-of-array-1.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[D; 4]`, a non-copy array - --> $DIR/move-out-of-array-1.rs:27:5 + --> $DIR/move-out-of-array-1.rs:17:5 | LL | a[i] //~ ERROR cannot move out of type `[D; 4]`, a non-copy array | ^^^^ cannot move out of here diff --git a/src/test/ui/moves/move-out-of-slice-1.nll.stderr b/src/test/ui/moves/move-out-of-slice-1.nll.stderr index aa62b457ecd..c8c09b31d36 100644 --- a/src/test/ui/moves/move-out-of-slice-1.nll.stderr +++ b/src/test/ui/moves/move-out-of-slice-1.nll.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[A]`, a non-copy slice - --> $DIR/move-out-of-slice-1.rs:17:11 + --> $DIR/move-out-of-slice-1.rs:7:11 | LL | match a { | ^ cannot move out of here @@ -7,7 +7,7 @@ LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy | - data moved here | note: move occurs because `a` has type `A`, which does not implement the `Copy` trait - --> $DIR/move-out-of-slice-1.rs:18:14 + --> $DIR/move-out-of-slice-1.rs:8:14 | LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice | ^ diff --git a/src/test/ui/moves/move-out-of-slice-1.rs b/src/test/ui/moves/move-out-of-slice-1.rs index 5efbef549dd..3e0906060e6 100644 --- a/src/test/ui/moves/move-out-of-slice-1.rs +++ b/src/test/ui/moves/move-out-of-slice-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_patterns)] struct A; diff --git a/src/test/ui/moves/move-out-of-slice-1.stderr b/src/test/ui/moves/move-out-of-slice-1.stderr index 87e68140774..bfdf6419869 100644 --- a/src/test/ui/moves/move-out-of-slice-1.stderr +++ b/src/test/ui/moves/move-out-of-slice-1.stderr @@ -1,5 +1,5 @@ error[E0508]: cannot move out of type `[A]`, a non-copy slice - --> $DIR/move-out-of-slice-1.rs:18:13 + --> $DIR/move-out-of-slice-1.rs:8:13 | LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice | ^-^ diff --git a/src/test/ui/moves/move-out-of-tuple-field.nll.stderr b/src/test/ui/moves/move-out-of-tuple-field.nll.stderr index e18db1b48a1..2efdc84ca37 100644 --- a/src/test/ui/moves/move-out-of-tuple-field.nll.stderr +++ b/src/test/ui/moves/move-out-of-tuple-field.nll.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x.0` - --> $DIR/move-out-of-tuple-field.rs:18:13 + --> $DIR/move-out-of-tuple-field.rs:8:13 | LL | let y = x.0; | --- value moved here @@ -9,7 +9,7 @@ LL | let z = x.0; //~ ERROR use of moved value: `x.0` = note: move occurs because `x.0` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x.0` - --> $DIR/move-out-of-tuple-field.rs:22:13 + --> $DIR/move-out-of-tuple-field.rs:12:13 | LL | let y = x.0; | --- value moved here diff --git a/src/test/ui/moves/move-out-of-tuple-field.rs b/src/test/ui/moves/move-out-of-tuple-field.rs index b7393666719..e5a505bb88d 100644 --- a/src/test/ui/moves/move-out-of-tuple-field.rs +++ b/src/test/ui/moves/move-out-of-tuple-field.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] struct Foo(Box); diff --git a/src/test/ui/moves/move-out-of-tuple-field.stderr b/src/test/ui/moves/move-out-of-tuple-field.stderr index 1e8acf5a64b..6839c49c829 100644 --- a/src/test/ui/moves/move-out-of-tuple-field.stderr +++ b/src/test/ui/moves/move-out-of-tuple-field.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x.0` - --> $DIR/move-out-of-tuple-field.rs:18:9 + --> $DIR/move-out-of-tuple-field.rs:8:9 | LL | let y = x.0; | - value moved here @@ -9,7 +9,7 @@ LL | let z = x.0; //~ ERROR use of moved value: `x.0` = note: move occurs because `x.0` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x.0` - --> $DIR/move-out-of-tuple-field.rs:22:9 + --> $DIR/move-out-of-tuple-field.rs:12:9 | LL | let y = x.0; | - value moved here diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr index 39c7f0633e3..6ad9a2d414c 100644 --- a/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-access-to-field.rs:21:12 + --> $DIR/moves-based-on-type-access-to-field.rs:11:12 | +LL | let x = vec!["hi".to_string()]; + | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | consume(x.into_iter().next().unwrap()); | - value moved here LL | touch(&x[0]); //~ ERROR use of moved value: `x` | ^ value borrowed here after move - | - = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.rs b/src/test/ui/moves/moves-based-on-type-access-to-field.rs index 63fb4ff02a4..c7ea357a5d9 100644 --- a/src/test/ui/moves/moves-based-on-type-access-to-field.rs +++ b/src/test/ui/moves/moves-based-on-type-access-to-field.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that if you move from `x.f` or `x[0]`, `x` is inaccessible. // Also tests that we give a more specific error message. diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr index 81546511e03..882c1fe1706 100644 --- a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr +++ b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-access-to-field.rs:21:12 + --> $DIR/moves-based-on-type-access-to-field.rs:11:12 | LL | consume(x.into_iter().next().unwrap()); | - value moved here diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr index 1f22ab14818..6950a56a533 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/moves-based-on-type-block-bad.rs:34:19 + --> $DIR/moves-based-on-type-block-bad.rs:24:19 | LL | match hellothere.x { //~ ERROR cannot move out | ^^^^^^^^^^^^ @@ -11,7 +11,7 @@ LL | box E::Bar(x) => println!("{}", x.to_string()), | - data moved here | note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait - --> $DIR/moves-based-on-type-block-bad.rs:37:28 + --> $DIR/moves-based-on-type-block-bad.rs:27:28 | LL | box E::Bar(x) => println!("{}", x.to_string()), | ^ diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.rs b/src/test/ui/moves/moves-based-on-type-block-bad.rs index dd4c4c843ab..99928caa926 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.rs +++ b/src/test/ui/moves/moves-based-on-type-block-bad.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![feature(box_patterns)] diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.stderr index f1b88292410..4ecaed3b69b 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.stderr +++ b/src/test/ui/moves/moves-based-on-type-block-bad.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/moves-based-on-type-block-bad.rs:34:19 + --> $DIR/moves-based-on-type-block-bad.rs:24:19 | LL | match hellothere.x { //~ ERROR cannot move out | ^^^^^^^^^^ cannot move out of borrowed content diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr index 0081fa67b9d..bed0ae7275c 100644 --- a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr @@ -1,6 +1,8 @@ error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-capture-clause-bad.rs:18:20 + --> $DIR/moves-based-on-type-capture-clause-bad.rs:8:20 | +LL | let x = "Hello world!".to_string(); + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | thread::spawn(move|| { | ------ value moved into closure here LL | println!("{}", x); @@ -8,8 +10,6 @@ LL | println!("{}", x); LL | }); LL | println!("{}", x); //~ ERROR use of moved value | ^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.rs b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.rs index 32fa773ec80..d5f44a0b3f7 100644 --- a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.rs +++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::thread; fn main() { diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr index 54b25678819..88e58fdf58b 100644 --- a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr +++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-capture-clause-bad.rs:18:20 + --> $DIR/moves-based-on-type-capture-clause-bad.rs:8:20 | LL | thread::spawn(move|| { | ------ value moved (into closure) here diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr index 50b51c6f397..99550235f69 100644 --- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `node` - --> $DIR/moves-based-on-type-cyclic-types-issue-4821.rs:23:13 + --> $DIR/moves-based-on-type-cyclic-types-issue-4821.rs:13:13 | LL | Some(right) => consume(right), | ----- value moved here diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs index 0c4aae8cfad..4417fb926d9 100644 --- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs +++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for a subtle failure computing kinds of cyclic types, in which // temporary kinds wound up being stored in a cache and used later. // See rustc::ty::type_contents() for more information. diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr index 421d25721e4..7624ba5fe28 100644 --- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr +++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr @@ -1,5 +1,5 @@ error[E0382]: use of partially moved value: `node` - --> $DIR/moves-based-on-type-cyclic-types-issue-4821.rs:23:13 + --> $DIR/moves-based-on-type-cyclic-types-issue-4821.rs:13:13 | LL | Some(right) => consume(right), | ----- value moved here diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr index 82420730644..07f40274f9e 100644 --- a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr @@ -1,24 +1,24 @@ error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:21:11 + --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:11:11 | +LL | let x = "hi".to_string(); + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = Foo { f:x }; | - value moved here LL | //~^ NOTE value moved here LL | touch(&x); //~ ERROR use of moved value: `x` | ^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:30:11 + --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:20:11 | +LL | let x = "hi".to_string(); + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = Foo { f:(((x))) }; | ------- value moved here LL | //~^ NOTE value moved here LL | touch(&x); //~ ERROR use of moved value: `x` | ^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error: aborting due to 2 previous errors diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.rs b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.rs index 5329dcaaaf4..7c7ca0044e2 100644 --- a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.rs +++ b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that references to move-by-default values trigger moves when // they occur as part of various kinds of expressions. diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr index 8c40b4db4f7..374ac61e7f5 100644 --- a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr +++ b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:21:12 + --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:11:12 | LL | let _y = Foo { f:x }; | - value moved here @@ -10,7 +10,7 @@ LL | touch(&x); //~ ERROR use of moved value: `x` = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:30:12 + --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:20:12 | LL | let _y = Foo { f:(((x))) }; | ------- value moved here diff --git a/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr b/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr index aa248dab85c..162aec45f5f 100644 --- a/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr @@ -1,117 +1,122 @@ error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:22:11 + --> $DIR/moves-based-on-type-exprs.rs:12:11 | +LL | let x = "hi".to_string(); + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = Foo { f:x }; | - value moved here LL | touch(&x); //~ ERROR use of moved value: `x` | ^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:28:11 + --> $DIR/moves-based-on-type-exprs.rs:18:11 | +LL | let x = "hi".to_string(); + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = (x, 3); | - value moved here LL | touch(&x); //~ ERROR use of moved value: `x` | ^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:45:11 + --> $DIR/moves-based-on-type-exprs.rs:35:11 | +LL | let x = "hi".to_string(); + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait +... LL | x | - value moved here ... LL | touch(&x); //~ ERROR use of moved value: `x` | ^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `y` - --> $DIR/moves-based-on-type-exprs.rs:46:11 + --> $DIR/moves-based-on-type-exprs.rs:36:11 | +LL | let y = "ho".to_string(); + | - move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait +... LL | y | - value moved here ... LL | touch(&y); //~ ERROR use of moved value: `y` | ^^ value borrowed here after move - | - = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:56:11 + --> $DIR/moves-based-on-type-exprs.rs:46:11 | +LL | let x = "hi".to_string(); + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait +... LL | true => x, | - value moved here ... LL | touch(&x); //~ ERROR use of moved value: `x` | ^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `y` - --> $DIR/moves-based-on-type-exprs.rs:57:11 + --> $DIR/moves-based-on-type-exprs.rs:47:11 | +LL | let y = "ho".to_string(); + | - move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait +... LL | false => y | - value moved here ... LL | touch(&y); //~ ERROR use of moved value: `y` | ^^ value borrowed here after move - | - = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:68:11 + --> $DIR/moves-based-on-type-exprs.rs:58:11 | +LL | let x = "hi".to_string(); + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait +... LL | _ if guard(x) => 10, | - value moved here ... LL | touch(&x); //~ ERROR use of moved value: `x` | ^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:75:11 + --> $DIR/moves-based-on-type-exprs.rs:65:11 | +LL | let x = "hi".to_string(); + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = [x]; | - value moved here LL | touch(&x); //~ ERROR use of moved value: `x` | ^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:81:11 + --> $DIR/moves-based-on-type-exprs.rs:71:11 | +LL | let x = "hi".to_string(); + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = vec![x]; | - value moved here LL | touch(&x); //~ ERROR use of moved value: `x` | ^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:87:11 + --> $DIR/moves-based-on-type-exprs.rs:77:11 | +LL | let x = vec!["hi".to_string()]; + | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | let _y = x.into_iter().next().unwrap(); | - value moved here LL | touch(&x); //~ ERROR use of moved value: `x` | ^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:93:11 + --> $DIR/moves-based-on-type-exprs.rs:83:11 | +LL | let x = vec!["hi".to_string()]; + | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | let _y = [x.into_iter().next().unwrap(); 1]; | - value moved here LL | touch(&x); //~ ERROR use of moved value: `x` | ^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait error: aborting due to 11 previous errors diff --git a/src/test/ui/moves/moves-based-on-type-exprs.rs b/src/test/ui/moves/moves-based-on-type-exprs.rs index 194f278259b..b058f83291b 100644 --- a/src/test/ui/moves/moves-based-on-type-exprs.rs +++ b/src/test/ui/moves/moves-based-on-type-exprs.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that references to move-by-default values trigger moves when // they occur as part of various kinds of expressions. diff --git a/src/test/ui/moves/moves-based-on-type-exprs.stderr b/src/test/ui/moves/moves-based-on-type-exprs.stderr index 003ae017b58..e6177c6b6c8 100644 --- a/src/test/ui/moves/moves-based-on-type-exprs.stderr +++ b/src/test/ui/moves/moves-based-on-type-exprs.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:22:12 + --> $DIR/moves-based-on-type-exprs.rs:12:12 | LL | let _y = Foo { f:x }; | - value moved here @@ -9,7 +9,7 @@ LL | touch(&x); //~ ERROR use of moved value: `x` = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:28:12 + --> $DIR/moves-based-on-type-exprs.rs:18:12 | LL | let _y = (x, 3); | - value moved here @@ -19,7 +19,7 @@ LL | touch(&x); //~ ERROR use of moved value: `x` = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:45:12 + --> $DIR/moves-based-on-type-exprs.rs:35:12 | LL | x | - value moved here @@ -30,7 +30,7 @@ LL | touch(&x); //~ ERROR use of moved value: `x` = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `y` - --> $DIR/moves-based-on-type-exprs.rs:46:12 + --> $DIR/moves-based-on-type-exprs.rs:36:12 | LL | y | - value moved here @@ -41,7 +41,7 @@ LL | touch(&y); //~ ERROR use of moved value: `y` = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:56:12 + --> $DIR/moves-based-on-type-exprs.rs:46:12 | LL | true => x, | - value moved here @@ -52,7 +52,7 @@ LL | touch(&x); //~ ERROR use of moved value: `x` = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `y` - --> $DIR/moves-based-on-type-exprs.rs:57:12 + --> $DIR/moves-based-on-type-exprs.rs:47:12 | LL | false => y | - value moved here @@ -63,7 +63,7 @@ LL | touch(&y); //~ ERROR use of moved value: `y` = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:68:12 + --> $DIR/moves-based-on-type-exprs.rs:58:12 | LL | _ if guard(x) => 10, | - value moved here @@ -74,7 +74,7 @@ LL | touch(&x); //~ ERROR use of moved value: `x` = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:75:12 + --> $DIR/moves-based-on-type-exprs.rs:65:12 | LL | let _y = [x]; | - value moved here @@ -84,7 +84,7 @@ LL | touch(&x); //~ ERROR use of moved value: `x` = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:81:12 + --> $DIR/moves-based-on-type-exprs.rs:71:12 | LL | let _y = vec![x]; | - value moved here @@ -94,7 +94,7 @@ LL | touch(&x); //~ ERROR use of moved value: `x` = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:87:12 + --> $DIR/moves-based-on-type-exprs.rs:77:12 | LL | let _y = x.into_iter().next().unwrap(); | - value moved here @@ -104,7 +104,7 @@ LL | touch(&x); //~ ERROR use of moved value: `x` = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-exprs.rs:93:12 + --> $DIR/moves-based-on-type-exprs.rs:83:12 | LL | let _y = [x.into_iter().next().unwrap(); 1]; | - value moved here diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr index d5b18a6c962..481c492e164 100644 --- a/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr @@ -1,5 +1,5 @@ error[E0382]: borrow of moved value: `x` - --> $DIR/moves-based-on-type-match-bindings.rs:26:11 + --> $DIR/moves-based-on-type-match-bindings.rs:16:11 | LL | Foo {f} => {} | - value moved here diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.rs b/src/test/ui/moves/moves-based-on-type-match-bindings.rs index 1fd3d03570a..59e5a8f684e 100644 --- a/src/test/ui/moves/moves-based-on-type-match-bindings.rs +++ b/src/test/ui/moves/moves-based-on-type-match-bindings.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that bindings to move-by-default values trigger moves of the // discriminant. Also tests that the compiler explains the move in // terms of the binding, not the discriminant. diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.stderr index 62e16df583f..41ced9dfd93 100644 --- a/src/test/ui/moves/moves-based-on-type-match-bindings.stderr +++ b/src/test/ui/moves/moves-based-on-type-match-bindings.stderr @@ -1,5 +1,5 @@ error[E0382]: use of partially moved value: `x` - --> $DIR/moves-based-on-type-match-bindings.rs:26:12 + --> $DIR/moves-based-on-type-match-bindings.rs:16:12 | LL | Foo {f} => {} | - value moved here diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr index 13a6fc15ce3..7d410f6cabc 100644 --- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:21:28 + --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:11:28 | LL | let i = box 3; | - captured outer variable diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs index 4251be36ab4..5fcd3392d33 100644 --- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs +++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax, unboxed_closures)] use std::usize; diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr index 43de9016a7d..49113a57d2f 100644 --- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr +++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure - --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:21:28 + --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:11:28 | LL | let i = box 3; | - captured outer variable diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr index 3fc4fa3cac8..391dd67dbf6 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*f` as mutable more than once at a time - --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:30:27 + --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:20:27 | LL | (f.c)(f, true); | ----- ^ second mutable borrow occurs here @@ -8,14 +8,16 @@ LL | (f.c)(f, true); | first borrow later used by call error[E0382]: borrow of moved value: `f` - --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:42:5 + --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:32:5 | +LL | fn conspirator(mut f: F) where F: FnMut(&mut R, bool) { + | - ----- move occurs because `f` has type `F`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument LL | let mut r = R {c: Box::new(f)}; | - value moved here LL | f(&mut r, false) //~ ERROR use of moved value | ^ value borrowed here after move - | - = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait error: aborting due to 2 previous errors diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs index d5296065999..737a131c9bf 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests correct kind-checking of the reason stack closures without the :Copy // bound must be noncopyable. For details see // http://smallcultfollowing.com/babysteps/blog/2013/04/30/the-case-of-the-recurring-closure/ diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr index 65cea57f0ed..05ced7f0107 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*f` as mutable more than once at a time - --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:30:27 + --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:20:27 | LL | (f.c)(f, true); | ----- ^ - first borrow ends here @@ -8,7 +8,7 @@ LL | (f.c)(f, true); | first mutable borrow occurs here error[E0382]: use of moved value: `f` - --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:42:5 + --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:32:5 | LL | let mut r = R {c: Box::new(f)}; | - value moved here diff --git a/src/test/ui/moves/moves-based-on-type-tuple.rs b/src/test/ui/moves/moves-based-on-type-tuple.rs index 27903fee117..d99fe51931a 100644 --- a/src/test/ui/moves/moves-based-on-type-tuple.rs +++ b/src/test/ui/moves/moves-based-on-type-tuple.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] -// compile-flags: -Z emit-end-regions -Z borrowck=compare +// compile-flags: -Z borrowck=compare fn dup(x: Box) -> Box<(Box,Box)> { box (x, x) diff --git a/src/test/ui/moves/moves-based-on-type-tuple.stderr b/src/test/ui/moves/moves-based-on-type-tuple.stderr index b0a3b6bf1fd..c49dbdab402 100644 --- a/src/test/ui/moves/moves-based-on-type-tuple.stderr +++ b/src/test/ui/moves/moves-based-on-type-tuple.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` (Ast) - --> $DIR/moves-based-on-type-tuple.rs:16:13 + --> $DIR/moves-based-on-type-tuple.rs:6:13 | LL | box (x, x) | - ^ value used here after move @@ -9,14 +9,14 @@ LL | box (x, x) = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` (Mir) - --> $DIR/moves-based-on-type-tuple.rs:16:13 + --> $DIR/moves-based-on-type-tuple.rs:6:13 | +LL | fn dup(x: Box) -> Box<(Box,Box)> { + | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | box (x, x) | - ^ value used here after move | | | value moved here - | - = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to 2 previous errors diff --git a/src/test/ui/moves/moves-sru-moved-field.nll.stderr b/src/test/ui/moves/moves-sru-moved-field.nll.stderr index d1a528c50a1..e5daab36f6e 100644 --- a/src/test/ui/moves/moves-sru-moved-field.nll.stderr +++ b/src/test/ui/moves/moves-sru-moved-field.nll.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `f.moved` - --> $DIR/moves-sru-moved-field.rs:30:14 + --> $DIR/moves-sru-moved-field.rs:20:14 | LL | let _b = Foo {noncopyable: g, ..f}; | ------------------------- value moved here diff --git a/src/test/ui/moves/moves-sru-moved-field.rs b/src/test/ui/moves/moves-sru-moved-field.rs index 15977fbeb73..e620e5de923 100644 --- a/src/test/ui/moves/moves-sru-moved-field.rs +++ b/src/test/ui/moves/moves-sru-moved-field.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] type Noncopyable = Box; diff --git a/src/test/ui/moves/moves-sru-moved-field.stderr b/src/test/ui/moves/moves-sru-moved-field.stderr index 878dd7ba830..3d38faa20a1 100644 --- a/src/test/ui/moves/moves-sru-moved-field.stderr +++ b/src/test/ui/moves/moves-sru-moved-field.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `f.moved` - --> $DIR/moves-sru-moved-field.rs:30:37 + --> $DIR/moves-sru-moved-field.rs:20:37 | LL | let _b = Foo {noncopyable: g, ..f}; | - value moved here diff --git a/src/test/ui/multiple-main-2.rs b/src/test/ui/multiple-main-2.rs index d9c232d7dac..6bae664ab74 100644 --- a/src/test/ui/multiple-main-2.rs +++ b/src/test/ui/multiple-main-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(main)] #[main] diff --git a/src/test/ui/multiple-main-2.stderr b/src/test/ui/multiple-main-2.stderr index e63bbc5cc43..c761e74bb87 100644 --- a/src/test/ui/multiple-main-2.stderr +++ b/src/test/ui/multiple-main-2.stderr @@ -1,5 +1,5 @@ error[E0137]: multiple functions with a #[main] attribute - --> $DIR/multiple-main-2.rs:18:1 + --> $DIR/multiple-main-2.rs:8:1 | LL | / fn bar() { LL | | } diff --git a/src/test/ui/multiple-main-3.rs b/src/test/ui/multiple-main-3.rs index 866a59e7a4f..dbcf1ef4896 100644 --- a/src/test/ui/multiple-main-3.rs +++ b/src/test/ui/multiple-main-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(main)] #[main] diff --git a/src/test/ui/multiple-main-3.stderr b/src/test/ui/multiple-main-3.stderr index d489e34b875..2574f0ef6d8 100644 --- a/src/test/ui/multiple-main-3.stderr +++ b/src/test/ui/multiple-main-3.stderr @@ -1,5 +1,5 @@ error[E0137]: multiple functions with a #[main] attribute - --> $DIR/multiple-main-3.rs:19:5 + --> $DIR/multiple-main-3.rs:9:5 | LL | / fn main1() { LL | | } diff --git a/src/test/ui/multiple-plugin-registrars.rs b/src/test/ui/multiple-plugin-registrars.rs index f5ebf84b8e0..d211204b134 100644 --- a/src/test/ui/multiple-plugin-registrars.rs +++ b/src/test/ui/multiple-plugin-registrars.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: multiple plugin registration functions found #![feature(plugin_registrar)] diff --git a/src/test/ui/multiple-plugin-registrars.stderr b/src/test/ui/multiple-plugin-registrars.stderr index f1370df0f8b..0e8379841f9 100644 --- a/src/test/ui/multiple-plugin-registrars.stderr +++ b/src/test/ui/multiple-plugin-registrars.stderr @@ -1,12 +1,12 @@ error: multiple plugin registration functions found | note: one is here - --> $DIR/multiple-plugin-registrars.rs:17:1 + --> $DIR/multiple-plugin-registrars.rs:7:1 | LL | pub fn one() {} | ^^^^^^^^^^^^^^^ note: one is here - --> $DIR/multiple-plugin-registrars.rs:20:1 + --> $DIR/multiple-plugin-registrars.rs:10:1 | LL | pub fn two() {} | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/mut/mut-cant-alias.nll.stderr b/src/test/ui/mut/mut-cant-alias.nll.stderr index 7b5a63b267f..2d7104b39c4 100644 --- a/src/test/ui/mut/mut-cant-alias.nll.stderr +++ b/src/test/ui/mut/mut-cant-alias.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `b` as mutable more than once at a time - --> $DIR/mut-cant-alias.rs:19:20 + --> $DIR/mut-cant-alias.rs:9:20 | LL | let b1 = &mut *b; | - first mutable borrow occurs here diff --git a/src/test/ui/mut/mut-cant-alias.rs b/src/test/ui/mut/mut-cant-alias.rs index af7d0e2742a..9146b931a19 100644 --- a/src/test/ui/mut/mut-cant-alias.rs +++ b/src/test/ui/mut/mut-cant-alias.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cell::RefCell; diff --git a/src/test/ui/mut/mut-cant-alias.stderr b/src/test/ui/mut/mut-cant-alias.stderr index b15ffe649dd..ce942677bed 100644 --- a/src/test/ui/mut/mut-cant-alias.stderr +++ b/src/test/ui/mut/mut-cant-alias.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `b` as mutable more than once at a time - --> $DIR/mut-cant-alias.rs:19:20 + --> $DIR/mut-cant-alias.rs:9:20 | LL | let b1 = &mut *b; | - first mutable borrow occurs here diff --git a/src/test/ui/mut/mut-cross-borrowing.rs b/src/test/ui/mut/mut-cross-borrowing.rs index 73982fa2811..63e49c292ea 100644 --- a/src/test/ui/mut/mut-cross-borrowing.rs +++ b/src/test/ui/mut/mut-cross-borrowing.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn f(_: &mut isize) {} diff --git a/src/test/ui/mut/mut-cross-borrowing.stderr b/src/test/ui/mut/mut-cross-borrowing.stderr index be32f235be3..8708a135360 100644 --- a/src/test/ui/mut/mut-cross-borrowing.stderr +++ b/src/test/ui/mut/mut-cross-borrowing.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/mut-cross-borrowing.rs:17:7 + --> $DIR/mut-cross-borrowing.rs:7:7 | LL | f(x) //~ ERROR mismatched types | ^ diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.ast.nll.stderr b/src/test/ui/mut/mut-pattern-internal-mutability.ast.nll.stderr index 8b8414b8f1b..82a4628a0e6 100644 --- a/src/test/ui/mut/mut-pattern-internal-mutability.ast.nll.stderr +++ b/src/test/ui/mut/mut-pattern-internal-mutability.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/mut-pattern-internal-mutability.rs:18:5 + --> $DIR/mut-pattern-internal-mutability.rs:8:5 | LL | let &mut x = foo; | - @@ -10,7 +10,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable | ^^^^^^ cannot assign twice to immutable variable error[E0506]: cannot assign to `*foo` because it is borrowed - --> $DIR/mut-pattern-internal-mutability.rs:27:5 + --> $DIR/mut-pattern-internal-mutability.rs:17:5 | LL | let &mut ref x = foo; | ----- borrow of `*foo` occurs here diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.ast.stderr b/src/test/ui/mut/mut-pattern-internal-mutability.ast.stderr index 47a33e320bd..e3423d5388e 100644 --- a/src/test/ui/mut/mut-pattern-internal-mutability.ast.stderr +++ b/src/test/ui/mut/mut-pattern-internal-mutability.ast.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/mut-pattern-internal-mutability.rs:18:5 + --> $DIR/mut-pattern-internal-mutability.rs:8:5 | LL | let &mut x = foo; | - first assignment to `x` @@ -7,7 +7,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable | ^^^^^^ cannot assign twice to immutable variable error[E0506]: cannot assign to `*foo` because it is borrowed - --> $DIR/mut-pattern-internal-mutability.rs:27:5 + --> $DIR/mut-pattern-internal-mutability.rs:17:5 | LL | let &mut ref x = foo; | ----- borrow of `*foo` occurs here diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.mir.stderr b/src/test/ui/mut/mut-pattern-internal-mutability.mir.stderr index 8b8414b8f1b..82a4628a0e6 100644 --- a/src/test/ui/mut/mut-pattern-internal-mutability.mir.stderr +++ b/src/test/ui/mut/mut-pattern-internal-mutability.mir.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `x` - --> $DIR/mut-pattern-internal-mutability.rs:18:5 + --> $DIR/mut-pattern-internal-mutability.rs:8:5 | LL | let &mut x = foo; | - @@ -10,7 +10,7 @@ LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable | ^^^^^^ cannot assign twice to immutable variable error[E0506]: cannot assign to `*foo` because it is borrowed - --> $DIR/mut-pattern-internal-mutability.rs:27:5 + --> $DIR/mut-pattern-internal-mutability.rs:17:5 | LL | let &mut ref x = foo; | ----- borrow of `*foo` occurs here diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.rs b/src/test/ui/mut/mut-pattern-internal-mutability.rs index a05ee64937e..ffad623e572 100644 --- a/src/test/ui/mut/mut-pattern-internal-mutability.rs +++ b/src/test/ui/mut/mut-pattern-internal-mutability.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/mut/mut-pattern-mismatched.rs b/src/test/ui/mut/mut-pattern-mismatched.rs index 7685a5c0808..17bf75419b7 100644 --- a/src/test/ui/mut/mut-pattern-mismatched.rs +++ b/src/test/ui/mut/mut-pattern-mismatched.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let foo = &mut 1; diff --git a/src/test/ui/mut/mut-pattern-mismatched.stderr b/src/test/ui/mut/mut-pattern-mismatched.stderr index 20bd804addc..d50a1a8f273 100644 --- a/src/test/ui/mut/mut-pattern-mismatched.stderr +++ b/src/test/ui/mut/mut-pattern-mismatched.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/mut-pattern-mismatched.rs:16:10 + --> $DIR/mut-pattern-mismatched.rs:6:10 | LL | let &_ //~ ERROR mismatched types | ^^ types differ in mutability @@ -8,7 +8,7 @@ LL | let &_ //~ ERROR mismatched types found type `&_` error[E0308]: mismatched types - --> $DIR/mut-pattern-mismatched.rs:25:9 + --> $DIR/mut-pattern-mismatched.rs:15:9 | LL | let &mut _ //~ ERROR mismatched types | ^^^^^^ types differ in mutability diff --git a/src/test/ui/mut/mut-ref.rs b/src/test/ui/mut/mut-ref.rs index 715c4adf2e6..80990b2bfde 100644 --- a/src/test/ui/mut/mut-ref.rs +++ b/src/test/ui/mut/mut-ref.rs @@ -1,15 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let mut ref x = 10; //~ ERROR the order of `mut` and `ref` is incorrect let ref mut y = 11; diff --git a/src/test/ui/mut/mut-ref.stderr b/src/test/ui/mut/mut-ref.stderr index d2df58881a2..339da7f8a02 100644 --- a/src/test/ui/mut/mut-ref.stderr +++ b/src/test/ui/mut/mut-ref.stderr @@ -1,5 +1,5 @@ error: the order of `mut` and `ref` is incorrect - --> $DIR/mut-ref.rs:14:9 + --> $DIR/mut-ref.rs:2:9 | LL | let mut ref x = 10; //~ ERROR the order of `mut` and `ref` is incorrect | ^^^^^^^ help: try switching the order: `ref mut` diff --git a/src/test/ui/mut/mut-suggestion.nll.stderr b/src/test/ui/mut/mut-suggestion.nll.stderr index 9501294a5ab..61656db5ec2 100644 --- a/src/test/ui/mut/mut-suggestion.nll.stderr +++ b/src/test/ui/mut/mut-suggestion.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable - --> $DIR/mut-suggestion.rs:22:5 + --> $DIR/mut-suggestion.rs:12:5 | LL | fn func(arg: S) { | --- help: consider changing this to be mutable: `mut arg` @@ -8,7 +8,7 @@ LL | arg.mutate(); | ^^^ cannot borrow as mutable error[E0596]: cannot borrow `local` as mutable, as it is not declared as mutable - --> $DIR/mut-suggestion.rs:31:5 + --> $DIR/mut-suggestion.rs:21:5 | LL | let local = S; | ----- help: consider changing this to be mutable: `mut local` diff --git a/src/test/ui/mut/mut-suggestion.rs b/src/test/ui/mut/mut-suggestion.rs index af04927c713..0d95a8bc12a 100644 --- a/src/test/ui/mut/mut-suggestion.rs +++ b/src/test/ui/mut/mut-suggestion.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Copy, Clone)] struct S; diff --git a/src/test/ui/mut/mut-suggestion.stderr b/src/test/ui/mut/mut-suggestion.stderr index b4917887630..1998ec1eca9 100644 --- a/src/test/ui/mut/mut-suggestion.stderr +++ b/src/test/ui/mut/mut-suggestion.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable argument `arg` as mutable - --> $DIR/mut-suggestion.rs:22:5 + --> $DIR/mut-suggestion.rs:12:5 | LL | fn func(arg: S) { | --- help: make this binding mutable: `mut arg` @@ -8,7 +8,7 @@ LL | arg.mutate(); | ^^^ cannot borrow mutably error[E0596]: cannot borrow immutable local variable `local` as mutable - --> $DIR/mut-suggestion.rs:31:5 + --> $DIR/mut-suggestion.rs:21:5 | LL | let local = S; | ----- help: make this binding mutable: `mut local` diff --git a/src/test/ui/mut/mutable-class-fields-2.nll.stderr b/src/test/ui/mut/mutable-class-fields-2.nll.stderr index 3433f9f0b21..53127922263 100644 --- a/src/test/ui/mut/mutable-class-fields-2.nll.stderr +++ b/src/test/ui/mut/mutable-class-fields-2.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `self.how_hungry` which is behind a `&` reference - --> $DIR/mutable-class-fields-2.rs:19:5 + --> $DIR/mutable-class-fields-2.rs:9:5 | LL | pub fn eat(&self) { | ----- help: consider changing this to be a mutable reference: `&mut self` diff --git a/src/test/ui/mut/mutable-class-fields-2.rs b/src/test/ui/mut/mutable-class-fields-2.rs index 46af3a862c2..30e54dfc9cd 100644 --- a/src/test/ui/mut/mutable-class-fields-2.rs +++ b/src/test/ui/mut/mutable-class-fields-2.rs @@ -1,34 +1,24 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct cat { +struct Cat { meows : usize, how_hungry : isize, } -impl cat { +impl Cat { pub fn eat(&self) { self.how_hungry -= 5; //~ ERROR cannot assign } } -fn cat(in_x : usize, in_y : isize) -> cat { - cat { +fn cat(in_x : usize, in_y : isize) -> Cat { + Cat { meows: in_x, how_hungry: in_y } } fn main() { - let nyan : cat = cat(52, 99); + let nyan : Cat = cat(52, 99); nyan.eat(); } diff --git a/src/test/ui/mut/mutable-class-fields-2.stderr b/src/test/ui/mut/mutable-class-fields-2.stderr index aa588d8acaf..daeee1117bc 100644 --- a/src/test/ui/mut/mutable-class-fields-2.stderr +++ b/src/test/ui/mut/mutable-class-fields-2.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to field `self.how_hungry` of immutable binding - --> $DIR/mutable-class-fields-2.rs:19:5 + --> $DIR/mutable-class-fields-2.rs:9:5 | LL | pub fn eat(&self) { | ----- use `&mut self` here to make mutable diff --git a/src/test/ui/mut/mutable-class-fields.ast.nll.stderr b/src/test/ui/mut/mutable-class-fields.ast.nll.stderr index 033a3bd6cb4..6b36b29d460 100644 --- a/src/test/ui/mut/mutable-class-fields.ast.nll.stderr +++ b/src/test/ui/mut/mutable-class-fields.ast.nll.stderr @@ -1,7 +1,7 @@ error[E0594]: cannot assign to `nyan.how_hungry`, as `nyan` is not declared as mutable - --> $DIR/mutable-class-fields.rs:28:3 + --> $DIR/mutable-class-fields.rs:18:3 | -LL | let nyan : cat = cat(52, 99); +LL | let nyan : Cat = cat(52, 99); | ---- help: consider changing this to be mutable: `mut nyan` LL | nyan.how_hungry = 0; //[ast]~ ERROR cannot assign | ^^^^^^^^^^^^^^^^^^^ cannot assign diff --git a/src/test/ui/mut/mutable-class-fields.ast.stderr b/src/test/ui/mut/mutable-class-fields.ast.stderr index fc12e22815e..80185703a9e 100644 --- a/src/test/ui/mut/mutable-class-fields.ast.stderr +++ b/src/test/ui/mut/mutable-class-fields.ast.stderr @@ -1,7 +1,7 @@ error[E0594]: cannot assign to field `nyan.how_hungry` of immutable binding - --> $DIR/mutable-class-fields.rs:28:3 + --> $DIR/mutable-class-fields.rs:18:3 | -LL | let nyan : cat = cat(52, 99); +LL | let nyan : Cat = cat(52, 99); | ---- help: make this binding mutable: `mut nyan` LL | nyan.how_hungry = 0; //[ast]~ ERROR cannot assign | ^^^^^^^^^^^^^^^^^^^ cannot mutably borrow field of immutable binding diff --git a/src/test/ui/mut/mutable-class-fields.mir.stderr b/src/test/ui/mut/mutable-class-fields.mir.stderr index 033a3bd6cb4..6b36b29d460 100644 --- a/src/test/ui/mut/mutable-class-fields.mir.stderr +++ b/src/test/ui/mut/mutable-class-fields.mir.stderr @@ -1,7 +1,7 @@ error[E0594]: cannot assign to `nyan.how_hungry`, as `nyan` is not declared as mutable - --> $DIR/mutable-class-fields.rs:28:3 + --> $DIR/mutable-class-fields.rs:18:3 | -LL | let nyan : cat = cat(52, 99); +LL | let nyan : Cat = cat(52, 99); | ---- help: consider changing this to be mutable: `mut nyan` LL | nyan.how_hungry = 0; //[ast]~ ERROR cannot assign | ^^^^^^^^^^^^^^^^^^^ cannot assign diff --git a/src/test/ui/mut/mutable-class-fields.rs b/src/test/ui/mut/mutable-class-fields.rs index f138ae93f71..2a729a5f6e6 100644 --- a/src/test/ui/mut/mutable-class-fields.rs +++ b/src/test/ui/mut/mutable-class-fields.rs @@ -1,30 +1,20 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir -struct cat { +struct Cat { meows : usize, how_hungry : isize, } -fn cat(in_x : usize, in_y : isize) -> cat { - cat { +fn cat(in_x : usize, in_y : isize) -> Cat { + Cat { meows: in_x, how_hungry: in_y } } fn main() { - let nyan : cat = cat(52, 99); + let nyan : Cat = cat(52, 99); nyan.how_hungry = 0; //[ast]~ ERROR cannot assign //[mir]~^ ERROR cannot assign } diff --git a/src/test/ui/mut/mutable-enum-indirect.rs b/src/test/ui/mut/mutable-enum-indirect.rs index 9107745b0e9..611ff0d66a2 100644 --- a/src/test/ui/mut/mutable-enum-indirect.rs +++ b/src/test/ui/mut/mutable-enum-indirect.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that an `&` pointer to something inherently mutable is itself // to be considered mutable. diff --git a/src/test/ui/mut/mutable-enum-indirect.stderr b/src/test/ui/mut/mutable-enum-indirect.stderr index 1ad4b6a1517..1268e487f33 100644 --- a/src/test/ui/mut/mutable-enum-indirect.stderr +++ b/src/test/ui/mut/mutable-enum-indirect.stderr @@ -1,5 +1,5 @@ error[E0277]: `NoSync` cannot be shared between threads safely - --> $DIR/mutable-enum-indirect.rs:27:5 + --> $DIR/mutable-enum-indirect.rs:17:5 | LL | bar(&x); | ^^^ `NoSync` cannot be shared between threads safely @@ -8,7 +8,7 @@ LL | bar(&x); = note: required because it appears within the type `Foo` = note: required because it appears within the type `&Foo` note: required by `bar` - --> $DIR/mutable-enum-indirect.rs:23:1 + --> $DIR/mutable-enum-indirect.rs:13:1 | LL | fn bar(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/mutexguard-sync.rs b/src/test/ui/mutexguard-sync.rs index 2d4b50eb7b2..8e1370041dd 100644 --- a/src/test/ui/mutexguard-sync.rs +++ b/src/test/ui/mutexguard-sync.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // MutexGuard> must not be Sync, that would be unsound. use std::sync::Mutex; use std::cell::Cell; diff --git a/src/test/ui/mutexguard-sync.stderr b/src/test/ui/mutexguard-sync.stderr index 709829e484b..d1f7d139375 100644 --- a/src/test/ui/mutexguard-sync.stderr +++ b/src/test/ui/mutexguard-sync.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::cell::Cell` cannot be shared between threads safely - --> $DIR/mutexguard-sync.rs:21:5 + --> $DIR/mutexguard-sync.rs:11:5 | LL | test_sync(guard); | ^^^^^^^^^ `std::cell::Cell` cannot be shared between threads safely @@ -7,7 +7,7 @@ LL | test_sync(guard); = help: the trait `std::marker::Sync` is not implemented for `std::cell::Cell` = note: required because of the requirements on the impl of `std::marker::Sync` for `std::sync::MutexGuard<'_, std::cell::Cell>` note: required by `test_sync` - --> $DIR/mutexguard-sync.rs:15:1 + --> $DIR/mutexguard-sync.rs:5:1 | LL | fn test_sync(_t: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/namespace/auxiliary/namespace-mix.rs b/src/test/ui/namespace/auxiliary/namespace-mix.rs index d82e9bb7022..fb39d29f87f 100644 --- a/src/test/ui/namespace/auxiliary/namespace-mix.rs +++ b/src/test/ui/namespace/auxiliary/namespace-mix.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod c { pub struct S {} pub struct TS(); diff --git a/src/test/ui/namespace/auxiliary/namespaced_enums.rs b/src/test/ui/namespace/auxiliary/namespaced_enums.rs index 3bf39b788db..d3548c76cf2 100644 --- a/src/test/ui/namespace/auxiliary/namespaced_enums.rs +++ b/src/test/ui/namespace/auxiliary/namespaced_enums.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum Foo { A, B(isize), diff --git a/src/test/ui/namespace/namespace-mix.rs b/src/test/ui/namespace/namespace-mix.rs index c1c724fc431..b0f7e3c6225 100644 --- a/src/test/ui/namespace/namespace-mix.rs +++ b/src/test/ui/namespace/namespace-mix.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:namespace-mix.rs extern crate namespace_mix; @@ -26,7 +16,7 @@ mod c { pub struct Item; } -// Use something emitting the type argument name, e.g. unsatisfied bound. +// Use something emitting the type argument name, e.g., unsatisfied bound. trait Impossible {} fn check(_: T) {} diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index 0a297e58574..5ebb40e75b3 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -1,12 +1,14 @@ error[E0423]: expected value, found type alias `m1::S` - --> $DIR/namespace-mix.rs:44:11 + --> $DIR/namespace-mix.rs:34:11 | LL | check(m1::S); //~ ERROR expected value, found type alias `m1::S` - | ^^^^- - | | - | did you mean `TS`? + | ^^^^^ | = note: can't use a type alias as a constructor +help: a tuple struct with a similar name exists + | +LL | check(m1::TS); //~ ERROR expected value, found type alias `m1::S` + | ^^ help: possible better candidates are found in other modules, you can import them into scope | LL | use m2::S; @@ -15,14 +17,16 @@ LL | use namespace_mix::xm2::S; | error[E0423]: expected value, found type alias `xm1::S` - --> $DIR/namespace-mix.rs:50:11 + --> $DIR/namespace-mix.rs:40:11 | LL | check(xm1::S); //~ ERROR expected value, found type alias `xm1::S` - | ^^^^^- - | | - | did you mean `TS`? + | ^^^^^^ | = note: can't use a type alias as a constructor +help: a tuple struct with a similar name exists + | +LL | check(xm1::TS); //~ ERROR expected value, found type alias `xm1::S` + | ^^ help: possible better candidates are found in other modules, you can import them into scope | LL | use m2::S; @@ -31,13 +35,14 @@ LL | use namespace_mix::xm2::S; | error[E0423]: expected value, found struct variant `m7::V` - --> $DIR/namespace-mix.rs:110:11 + --> $DIR/namespace-mix.rs:100:11 | LL | check(m7::V); //~ ERROR expected value, found struct variant `m7::V` - | ^^^^- - | | | - | | did you mean `TV`? - | did you mean `m7::V { /* fields */ }`? + | ^^^^^ did you mean `m7::V { /* fields */ }`? +help: a tuple variant with a similar name exists + | +LL | check(m7::TV); //~ ERROR expected value, found struct variant `m7::V` + | ^^ help: possible better candidates are found in other modules, you can import them into scope | LL | use m8::V; @@ -46,13 +51,14 @@ LL | use namespace_mix::xm8::V; | error[E0423]: expected value, found struct variant `xm7::V` - --> $DIR/namespace-mix.rs:116:11 + --> $DIR/namespace-mix.rs:106:11 | LL | check(xm7::V); //~ ERROR expected value, found struct variant `xm7::V` - | ^^^^^- - | | | - | | did you mean `TV`? - | did you mean `xm7::V { /* fields */ }`? + | ^^^^^^ did you mean `xm7::V { /* fields */ }`? +help: a tuple variant with a similar name exists + | +LL | check(xm7::TV); //~ ERROR expected value, found struct variant `xm7::V` + | ^^ help: possible better candidates are found in other modules, you can import them into scope | LL | use m8::V; @@ -61,529 +67,529 @@ LL | use namespace_mix::xm8::V; | error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:43:5 + --> $DIR/namespace-mix.rs:33:5 | LL | check(m1::S{}); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::S: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:45:5 + --> $DIR/namespace-mix.rs:35:5 | LL | check(m2::S{}); //~ ERROR c::S | ^^^^^ the trait `Impossible` is not implemented for `c::S` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:46:5 + --> $DIR/namespace-mix.rs:36:5 | LL | check(m2::S); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:49:5 + --> $DIR/namespace-mix.rs:39:5 | LL | check(xm1::S{}); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::S: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:51:5 + --> $DIR/namespace-mix.rs:41:5 | LL | check(xm2::S{}); //~ ERROR c::S | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::S` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:52:5 + --> $DIR/namespace-mix.rs:42:5 | LL | check(xm2::S); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:65:5 + --> $DIR/namespace-mix.rs:55:5 | LL | check(m3::TS{}); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `fn() -> c::TS {c::TS}: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:66:5 + --> $DIR/namespace-mix.rs:56:5 | LL | check(m3::TS); //~ ERROR c::TS | ^^^^^ the trait `Impossible` is not implemented for `fn() -> c::TS {c::TS}` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::TS: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:67:5 + --> $DIR/namespace-mix.rs:57:5 | LL | check(m4::TS{}); //~ ERROR c::TS | ^^^^^ the trait `Impossible` is not implemented for `c::TS` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:68:5 + --> $DIR/namespace-mix.rs:58:5 | LL | check(m4::TS); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:71:5 + --> $DIR/namespace-mix.rs:61:5 | LL | check(xm3::TS{}); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:72:5 + --> $DIR/namespace-mix.rs:62:5 | LL | check(xm3::TS); //~ ERROR c::TS | ^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::TS: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:73:5 + --> $DIR/namespace-mix.rs:63:5 | LL | check(xm4::TS{}); //~ ERROR c::TS | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::TS` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:74:5 + --> $DIR/namespace-mix.rs:64:5 | LL | check(xm4::TS); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:87:5 + --> $DIR/namespace-mix.rs:77:5 | LL | check(m5::US{}); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::US: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:88:5 + --> $DIR/namespace-mix.rs:78:5 | LL | check(m5::US); //~ ERROR c::US | ^^^^^ the trait `Impossible` is not implemented for `c::US` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::US: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:89:5 + --> $DIR/namespace-mix.rs:79:5 | LL | check(m6::US{}); //~ ERROR c::US | ^^^^^ the trait `Impossible` is not implemented for `c::US` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:90:5 + --> $DIR/namespace-mix.rs:80:5 | LL | check(m6::US); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:93:5 + --> $DIR/namespace-mix.rs:83:5 | LL | check(xm5::US{}); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:94:5 + --> $DIR/namespace-mix.rs:84:5 | LL | check(xm5::US); //~ ERROR c::US | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:95:5 + --> $DIR/namespace-mix.rs:85:5 | LL | check(xm6::US{}); //~ ERROR c::US | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:96:5 + --> $DIR/namespace-mix.rs:86:5 | LL | check(xm6::US); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:109:5 + --> $DIR/namespace-mix.rs:99:5 | LL | check(m7::V{}); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:111:5 + --> $DIR/namespace-mix.rs:101:5 | LL | check(m8::V{}); //~ ERROR c::E | ^^^^^ the trait `Impossible` is not implemented for `c::E` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:112:5 + --> $DIR/namespace-mix.rs:102:5 | LL | check(m8::V); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:115:5 + --> $DIR/namespace-mix.rs:105:5 | LL | check(xm7::V{}); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:117:5 + --> $DIR/namespace-mix.rs:107:5 | LL | check(xm8::V{}); //~ ERROR c::E | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:118:5 + --> $DIR/namespace-mix.rs:108:5 | LL | check(xm8::V); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:131:5 + --> $DIR/namespace-mix.rs:121:5 | LL | check(m9::TV{}); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `fn() -> c::E {c::E::TV}: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:132:5 + --> $DIR/namespace-mix.rs:122:5 | LL | check(m9::TV); //~ ERROR c::E | ^^^^^ the trait `Impossible` is not implemented for `fn() -> c::E {c::E::TV}` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:133:5 + --> $DIR/namespace-mix.rs:123:5 | LL | check(mA::TV{}); //~ ERROR c::E | ^^^^^ the trait `Impossible` is not implemented for `c::E` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:134:5 + --> $DIR/namespace-mix.rs:124:5 | LL | check(mA::TV); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:137:5 + --> $DIR/namespace-mix.rs:127:5 | LL | check(xm9::TV{}); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `fn() -> namespace_mix::c::E {namespace_mix::c::E::TV}: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:138:5 + --> $DIR/namespace-mix.rs:128:5 | LL | check(xm9::TV); //~ ERROR c::E | ^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::E {namespace_mix::c::E::TV}` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:139:5 + --> $DIR/namespace-mix.rs:129:5 | LL | check(xmA::TV{}); //~ ERROR c::E | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:140:5 + --> $DIR/namespace-mix.rs:130:5 | LL | check(xmA::TV); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:153:5 + --> $DIR/namespace-mix.rs:143:5 | LL | check(mB::UV{}); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:154:5 + --> $DIR/namespace-mix.rs:144:5 | LL | check(mB::UV); //~ ERROR c::E | ^^^^^ the trait `Impossible` is not implemented for `c::E` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:155:5 + --> $DIR/namespace-mix.rs:145:5 | LL | check(mC::UV{}); //~ ERROR c::E | ^^^^^ the trait `Impossible` is not implemented for `c::E` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:156:5 + --> $DIR/namespace-mix.rs:146:5 | LL | check(mC::UV); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:159:5 + --> $DIR/namespace-mix.rs:149:5 | LL | check(xmB::UV{}); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:160:5 + --> $DIR/namespace-mix.rs:150:5 | LL | check(xmB::UV); //~ ERROR c::E | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:161:5 + --> $DIR/namespace-mix.rs:151:5 | LL | check(xmC::UV{}); //~ ERROR c::E | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied - --> $DIR/namespace-mix.rs:162:5 + --> $DIR/namespace-mix.rs:152:5 | LL | check(xmC::UV); //~ ERROR c::Item | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` - --> $DIR/namespace-mix.rs:31:1 + --> $DIR/namespace-mix.rs:21:1 | LL | fn check(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.rs b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.rs index 67800f8de4e..feb94b68184 100644 --- a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.rs +++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:namespaced_enums.rs extern crate namespaced_enums; diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr index 47ecb1248b2..691061f0510 100644 --- a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr +++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr @@ -1,23 +1,23 @@ error[E0425]: cannot find function `foo` in this scope - --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:21:5 + --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:11:5 | LL | foo(); //~ ERROR cannot find function `foo` in this scope | ^^^ not found in this scope error[E0425]: cannot find function `foo` in module `m` - --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:22:8 + --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:12:8 | LL | m::foo(); //~ ERROR cannot find function `foo` in module `m` | ^^^ not found in `m` error[E0425]: cannot find function `bar` in this scope - --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:23:5 + --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:13:5 | LL | bar(); //~ ERROR cannot find function `bar` in this scope | ^^^ not found in this scope error[E0425]: cannot find function `bar` in module `m` - --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:24:8 + --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:14:8 | LL | m::bar(); //~ ERROR cannot find function `bar` in module `m` | ^^^ not found in `m` diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.rs b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.rs index d5e659c236e..ab24f36f9a1 100644 --- a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.rs +++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod m2 { pub enum Foo { A, diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr index 916801df2e8..f53f299fe4d 100644 --- a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr +++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr @@ -1,23 +1,23 @@ error[E0425]: cannot find function `foo` in this scope - --> $DIR/namespaced-enum-glob-import-no-impls.rs:31:5 + --> $DIR/namespaced-enum-glob-import-no-impls.rs:21:5 | LL | foo(); //~ ERROR cannot find function `foo` in this scope | ^^^ not found in this scope error[E0425]: cannot find function `foo` in module `m` - --> $DIR/namespaced-enum-glob-import-no-impls.rs:32:8 + --> $DIR/namespaced-enum-glob-import-no-impls.rs:22:8 | LL | m::foo(); //~ ERROR cannot find function `foo` in module `m` | ^^^ not found in `m` error[E0425]: cannot find function `bar` in this scope - --> $DIR/namespaced-enum-glob-import-no-impls.rs:33:5 + --> $DIR/namespaced-enum-glob-import-no-impls.rs:23:5 | LL | bar(); //~ ERROR cannot find function `bar` in this scope | ^^^ not found in this scope error[E0425]: cannot find function `bar` in module `m` - --> $DIR/namespaced-enum-glob-import-no-impls.rs:34:8 + --> $DIR/namespaced-enum-glob-import-no-impls.rs:24:8 | LL | m::bar(); //~ ERROR cannot find function `bar` in module `m` | ^^^ not found in `m` diff --git a/src/test/ui/nested-cfg-attrs.rs b/src/test/ui/nested-cfg-attrs.rs index f0c41ff7854..c988d423373 100644 --- a/src/test/ui/nested-cfg-attrs.rs +++ b/src/test/ui/nested-cfg-attrs.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[cfg_attr(all(), cfg_attr(all(), cfg(foo)))] fn f() {} diff --git a/src/test/ui/nested-cfg-attrs.stderr b/src/test/ui/nested-cfg-attrs.stderr index 5501dc8c6ad..e7cd39114ed 100644 --- a/src/test/ui/nested-cfg-attrs.stderr +++ b/src/test/ui/nested-cfg-attrs.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find function `f` in this scope - --> $DIR/nested-cfg-attrs.rs:14:13 + --> $DIR/nested-cfg-attrs.rs:4:13 | LL | fn main() { f() } //~ ERROR cannot find function `f` in this scope | ^ not found in this scope diff --git a/src/test/ui/nested-ty-params.rs b/src/test/ui/nested-ty-params.rs index 2378cccf56f..102f8d02ee4 100644 --- a/src/test/ui/nested-ty-params.rs +++ b/src/test/ui/nested-ty-params.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:can't use type parameters from outer function fn hd(v: Vec ) -> U { fn hd1(w: [U]) -> U { return w[0]; } diff --git a/src/test/ui/nested-ty-params.stderr b/src/test/ui/nested-ty-params.stderr index 58b6cd18989..617eddf6525 100644 --- a/src/test/ui/nested-ty-params.stderr +++ b/src/test/ui/nested-ty-params.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use type parameters from outer function - --> $DIR/nested-ty-params.rs:13:16 + --> $DIR/nested-ty-params.rs:3:16 | LL | fn hd(v: Vec ) -> U { | - type variable from outer function @@ -9,7 +9,7 @@ LL | fn hd1(w: [U]) -> U { return w[0]; } | help: try using a local type parameter instead: `hd1` error[E0401]: can't use type parameters from outer function - --> $DIR/nested-ty-params.rs:13:23 + --> $DIR/nested-ty-params.rs:3:23 | LL | fn hd(v: Vec ) -> U { | - type variable from outer function diff --git a/src/test/ui/nested_impl_trait.rs b/src/test/ui/nested_impl_trait.rs index be0454472dd..be2c21a7743 100644 --- a/src/test/ui/nested_impl_trait.rs +++ b/src/test/ui/nested_impl_trait.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. use std::fmt::Debug; fn fine(x: impl Into) -> impl Into { x } diff --git a/src/test/ui/nested_impl_trait.stderr b/src/test/ui/nested_impl_trait.stderr index ee53194e2b4..60f57e56ba1 100644 --- a/src/test/ui/nested_impl_trait.stderr +++ b/src/test/ui/nested_impl_trait.stderr @@ -1,5 +1,5 @@ error[E0666]: nested `impl Trait` is not allowed - --> $DIR/nested_impl_trait.rs:14:56 + --> $DIR/nested_impl_trait.rs:5:56 | LL | fn bad_in_ret_position(x: impl Into) -> impl Into { x } | ----------^^^^^^^^^^- @@ -8,7 +8,7 @@ LL | fn bad_in_ret_position(x: impl Into) -> impl Into { x } | outer `impl Trait` error[E0666]: nested `impl Trait` is not allowed - --> $DIR/nested_impl_trait.rs:17:42 + --> $DIR/nested_impl_trait.rs:8:42 | LL | fn bad_in_fn_syntax(x: fn() -> impl Into) {} | ----------^^^^^^^^^^- @@ -17,7 +17,7 @@ LL | fn bad_in_fn_syntax(x: fn() -> impl Into) {} | outer `impl Trait` error[E0666]: nested `impl Trait` is not allowed - --> $DIR/nested_impl_trait.rs:21:37 + --> $DIR/nested_impl_trait.rs:12:37 | LL | fn bad_in_arg_position(_: impl Into) { } | ----------^^^^^^^^^^- @@ -26,7 +26,7 @@ LL | fn bad_in_arg_position(_: impl Into) { } | outer `impl Trait` error[E0666]: nested `impl Trait` is not allowed - --> $DIR/nested_impl_trait.rs:26:44 + --> $DIR/nested_impl_trait.rs:17:44 | LL | fn bad(x: impl Into) -> impl Into { x } | ----------^^^^^^^^^^- @@ -35,13 +35,13 @@ LL | fn bad(x: impl Into) -> impl Into { x } | outer `impl Trait` error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/nested_impl_trait.rs:17:32 + --> $DIR/nested_impl_trait.rs:8:32 | LL | fn bad_in_fn_syntax(x: fn() -> impl Into) {} | ^^^^^^^^^^^^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and inherent method return types - --> $DIR/nested_impl_trait.rs:34:42 + --> $DIR/nested_impl_trait.rs:25:42 | LL | fn allowed_in_ret_type() -> impl Fn() -> impl Into { | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/never-assign-dead-code.rs b/src/test/ui/never-assign-dead-code.rs index 0762e872072..6b047c35065 100644 --- a/src/test/ui/never-assign-dead-code.rs +++ b/src/test/ui/never-assign-dead-code.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that an assignment of type ! makes the rest of the block dead code. #![feature(never_type)] diff --git a/src/test/ui/never-assign-dead-code.stderr b/src/test/ui/never-assign-dead-code.stderr index a4fd7b1b296..bcc20a0d703 100644 --- a/src/test/ui/never-assign-dead-code.stderr +++ b/src/test/ui/never-assign-dead-code.stderr @@ -1,30 +1,30 @@ warning: unreachable statement - --> $DIR/never-assign-dead-code.rs:20:5 + --> $DIR/never-assign-dead-code.rs:10:5 | LL | drop(x); //~ WARN unreachable | ^^^^^^^^ | note: lint level defined here - --> $DIR/never-assign-dead-code.rs:15:9 + --> $DIR/never-assign-dead-code.rs:5:9 | LL | #![warn(unused)] | ^^^^^^ = note: #[warn(unreachable_code)] implied by #[warn(unused)] warning: unreachable expression - --> $DIR/never-assign-dead-code.rs:20:5 + --> $DIR/never-assign-dead-code.rs:10:5 | LL | drop(x); //~ WARN unreachable | ^^^^^^^ warning: unused variable: `x` - --> $DIR/never-assign-dead-code.rs:19:9 + --> $DIR/never-assign-dead-code.rs:9:9 | LL | let x: ! = panic!("aah"); //~ WARN unused - | ^ help: consider using `_x` instead + | ^ help: consider prefixing with an underscore: `_x` | note: lint level defined here - --> $DIR/never-assign-dead-code.rs:15:9 + --> $DIR/never-assign-dead-code.rs:5:9 | LL | #![warn(unused)] | ^^^^^^ diff --git a/src/test/ui/never-assign-wrong-type.rs b/src/test/ui/never-assign-wrong-type.rs index c0dd2cab749..67e26f5663f 100644 --- a/src/test/ui/never-assign-wrong-type.rs +++ b/src/test/ui/never-assign-wrong-type.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can't use another type in place of ! #![feature(never_type)] diff --git a/src/test/ui/never-assign-wrong-type.stderr b/src/test/ui/never-assign-wrong-type.stderr index 41afe88b384..bc61996db99 100644 --- a/src/test/ui/never-assign-wrong-type.stderr +++ b/src/test/ui/never-assign-wrong-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/never-assign-wrong-type.rs:17:16 + --> $DIR/never-assign-wrong-type.rs:7:16 | LL | let x: ! = "hello"; //~ ERROR mismatched types | ^^^^^^^ expected !, found reference diff --git a/src/test/ui/never_transmute_never.rs b/src/test/ui/never_transmute_never.rs index cbcc47f60c3..ef78eaa2120 100644 --- a/src/test/ui/never_transmute_never.rs +++ b/src/test/ui/never_transmute_never.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![crate_type="lib"] diff --git a/src/test/ui/nll/borrow-use-issue-46875.rs b/src/test/ui/nll/borrow-use-issue-46875.rs index 47d69fe8e97..03db28fc508 100644 --- a/src/test/ui/nll/borrow-use-issue-46875.rs +++ b/src/test/ui/nll/borrow-use-issue-46875.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] // run-pass diff --git a/src/test/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs b/src/test/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs index e35c8095fa1..59936a80925 100644 --- a/src/test/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs +++ b/src/test/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // run-pass // diff --git a/src/test/ui/nll/borrowed-local-error.rs b/src/test/ui/nll/borrowed-local-error.rs index 084d0c159ef..d37e61b63a8 100644 --- a/src/test/ui/nll/borrowed-local-error.rs +++ b/src/test/ui/nll/borrowed-local-error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] fn gimme(x: &(u32,)) -> &u32 { diff --git a/src/test/ui/nll/borrowed-local-error.stderr b/src/test/ui/nll/borrowed-local-error.stderr index 4da597791ef..318b62a0fdb 100644 --- a/src/test/ui/nll/borrowed-local-error.stderr +++ b/src/test/ui/nll/borrowed-local-error.stderr @@ -1,5 +1,5 @@ error[E0597]: `v` does not live long enough - --> $DIR/borrowed-local-error.rs:20:9 + --> $DIR/borrowed-local-error.rs:10:9 | LL | let x = gimme({ | ----- borrow later used by call diff --git a/src/test/ui/nll/borrowed-match-issue-45045.rs b/src/test/ui/nll/borrowed-match-issue-45045.rs index 8688bfa86dc..59516d8b444 100644 --- a/src/test/ui/nll/borrowed-match-issue-45045.rs +++ b/src/test/ui/nll/borrowed-match-issue-45045.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #45045 #![feature(nll)] diff --git a/src/test/ui/nll/borrowed-match-issue-45045.stderr b/src/test/ui/nll/borrowed-match-issue-45045.stderr index ded773165c6..f8d4d56621d 100644 --- a/src/test/ui/nll/borrowed-match-issue-45045.stderr +++ b/src/test/ui/nll/borrowed-match-issue-45045.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `e` because it was mutably borrowed - --> $DIR/borrowed-match-issue-45045.rs:25:9 + --> $DIR/borrowed-match-issue-45045.rs:15:9 | LL | let f = &mut e; | ------ borrow of `e` occurs here diff --git a/src/test/ui/nll/borrowed-referent-issue-38899.rs b/src/test/ui/nll/borrowed-referent-issue-38899.rs index d7c15851418..7bad6dc2cd3 100644 --- a/src/test/ui/nll/borrowed-referent-issue-38899.rs +++ b/src/test/ui/nll/borrowed-referent-issue-38899.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #38899 #![feature(nll)] diff --git a/src/test/ui/nll/borrowed-referent-issue-38899.stderr b/src/test/ui/nll/borrowed-referent-issue-38899.stderr index ff8a83024f1..1b58b21fff0 100644 --- a/src/test/ui/nll/borrowed-referent-issue-38899.stderr +++ b/src/test/ui/nll/borrowed-referent-issue-38899.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable - --> $DIR/borrowed-referent-issue-38899.rs:24:21 + --> $DIR/borrowed-referent-issue-38899.rs:14:21 | LL | let x = &mut block; | ---------- mutable borrow occurs here diff --git a/src/test/ui/nll/borrowed-temporary-error.rs b/src/test/ui/nll/borrowed-temporary-error.rs index 3bfb319ff31..5ad987c7214 100644 --- a/src/test/ui/nll/borrowed-temporary-error.rs +++ b/src/test/ui/nll/borrowed-temporary-error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] fn gimme(x: &(u32,)) -> &u32 { diff --git a/src/test/ui/nll/borrowed-temporary-error.stderr b/src/test/ui/nll/borrowed-temporary-error.stderr index 7f62f2ee52a..31d1dfde1ce 100644 --- a/src/test/ui/nll/borrowed-temporary-error.stderr +++ b/src/test/ui/nll/borrowed-temporary-error.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowed-temporary-error.rs:20:10 + --> $DIR/borrowed-temporary-error.rs:10:10 | LL | &(v,) | ^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/nll/borrowed-universal-error-2.rs b/src/test/ui/nll/borrowed-universal-error-2.rs index 283b32df99c..a10a62b470d 100644 --- a/src/test/ui/nll/borrowed-universal-error-2.rs +++ b/src/test/ui/nll/borrowed-universal-error-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #![allow(warnings)] diff --git a/src/test/ui/nll/borrowed-universal-error-2.stderr b/src/test/ui/nll/borrowed-universal-error-2.stderr index ae160338013..e89a77a2d36 100644 --- a/src/test/ui/nll/borrowed-universal-error-2.stderr +++ b/src/test/ui/nll/borrowed-universal-error-2.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to local variable `v` - --> $DIR/borrowed-universal-error-2.rs:16:5 + --> $DIR/borrowed-universal-error-2.rs:6:5 | LL | &v | ^^ returns a reference to data owned by the current function diff --git a/src/test/ui/nll/borrowed-universal-error.rs b/src/test/ui/nll/borrowed-universal-error.rs index 68a7237fdd6..18a0a72c4bb 100644 --- a/src/test/ui/nll/borrowed-universal-error.rs +++ b/src/test/ui/nll/borrowed-universal-error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #![allow(warnings)] diff --git a/src/test/ui/nll/borrowed-universal-error.stderr b/src/test/ui/nll/borrowed-universal-error.stderr index a5b3e6bcf35..4b76795943e 100644 --- a/src/test/ui/nll/borrowed-universal-error.stderr +++ b/src/test/ui/nll/borrowed-universal-error.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing temporary value - --> $DIR/borrowed-universal-error.rs:20:5 + --> $DIR/borrowed-universal-error.rs:10:5 | LL | gimme(&(v,)) | ^^^^^^^----^ diff --git a/src/test/ui/nll/cannot-move-block-spans.nll.stderr b/src/test/ui/nll/cannot-move-block-spans.nll.stderr index 6a4c8f2e8d8..30b4bf75af6 100644 --- a/src/test/ui/nll/cannot-move-block-spans.nll.stderr +++ b/src/test/ui/nll/cannot-move-block-spans.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/cannot-move-block-spans.rs:15:15 + --> $DIR/cannot-move-block-spans.rs:5:15 | LL | let x = { *r }; //~ ERROR | ^^ @@ -8,7 +8,7 @@ LL | let x = { *r }; //~ ERROR | help: consider removing the `*`: `r` error[E0507]: cannot move out of borrowed content - --> $DIR/cannot-move-block-spans.rs:16:22 + --> $DIR/cannot-move-block-spans.rs:6:22 | LL | let y = unsafe { *r }; //~ ERROR | ^^ @@ -17,7 +17,7 @@ LL | let y = unsafe { *r }; //~ ERROR | help: consider removing the `*`: `r` error[E0507]: cannot move out of borrowed content - --> $DIR/cannot-move-block-spans.rs:17:26 + --> $DIR/cannot-move-block-spans.rs:7:26 | LL | let z = loop { break *r; }; //~ ERROR | ^^ @@ -26,7 +26,7 @@ LL | let z = loop { break *r; }; //~ ERROR | help: consider removing the `*`: `r` error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array - --> $DIR/cannot-move-block-spans.rs:21:15 + --> $DIR/cannot-move-block-spans.rs:11:15 | LL | let x = { arr[0] }; //~ ERROR | ^^^^^^ @@ -35,7 +35,7 @@ LL | let x = { arr[0] }; //~ ERROR | help: consider borrowing here: `&arr[0]` error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array - --> $DIR/cannot-move-block-spans.rs:22:22 + --> $DIR/cannot-move-block-spans.rs:12:22 | LL | let y = unsafe { arr[0] }; //~ ERROR | ^^^^^^ @@ -44,7 +44,7 @@ LL | let y = unsafe { arr[0] }; //~ ERROR | help: consider borrowing here: `&arr[0]` error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array - --> $DIR/cannot-move-block-spans.rs:23:26 + --> $DIR/cannot-move-block-spans.rs:13:26 | LL | let z = loop { break arr[0]; }; //~ ERROR | ^^^^^^ @@ -53,7 +53,7 @@ LL | let z = loop { break arr[0]; }; //~ ERROR | help: consider borrowing here: `&arr[0]` error[E0507]: cannot move out of borrowed content - --> $DIR/cannot-move-block-spans.rs:27:38 + --> $DIR/cannot-move-block-spans.rs:17:38 | LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR | ^^ @@ -62,7 +62,7 @@ LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR | help: consider removing the `*`: `r` error[E0507]: cannot move out of borrowed content - --> $DIR/cannot-move-block-spans.rs:28:45 + --> $DIR/cannot-move-block-spans.rs:18:45 | LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR | ^^ @@ -71,7 +71,7 @@ LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR | help: consider removing the `*`: `r` error[E0507]: cannot move out of borrowed content - --> $DIR/cannot-move-block-spans.rs:29:49 + --> $DIR/cannot-move-block-spans.rs:19:49 | LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR | ^^ diff --git a/src/test/ui/nll/cannot-move-block-spans.rs b/src/test/ui/nll/cannot-move-block-spans.rs index 5a84a4ca48e..e994fd3d593 100644 --- a/src/test/ui/nll/cannot-move-block-spans.rs +++ b/src/test/ui/nll/cannot-move-block-spans.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the we point to the inner expression when moving out to initialize // a variable, and that we don't give a useless suggestion such as &{ *r }. diff --git a/src/test/ui/nll/cannot-move-block-spans.stderr b/src/test/ui/nll/cannot-move-block-spans.stderr index d4956900239..e37c6ff06f7 100644 --- a/src/test/ui/nll/cannot-move-block-spans.stderr +++ b/src/test/ui/nll/cannot-move-block-spans.stderr @@ -1,53 +1,53 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/cannot-move-block-spans.rs:15:15 + --> $DIR/cannot-move-block-spans.rs:5:15 | LL | let x = { *r }; //~ ERROR | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/cannot-move-block-spans.rs:16:22 + --> $DIR/cannot-move-block-spans.rs:6:22 | LL | let y = unsafe { *r }; //~ ERROR | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/cannot-move-block-spans.rs:17:26 + --> $DIR/cannot-move-block-spans.rs:7:26 | LL | let z = loop { break *r; }; //~ ERROR | ^^ cannot move out of borrowed content error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array - --> $DIR/cannot-move-block-spans.rs:21:15 + --> $DIR/cannot-move-block-spans.rs:11:15 | LL | let x = { arr[0] }; //~ ERROR | ^^^^^^ cannot move out of here error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array - --> $DIR/cannot-move-block-spans.rs:22:22 + --> $DIR/cannot-move-block-spans.rs:12:22 | LL | let y = unsafe { arr[0] }; //~ ERROR | ^^^^^^ cannot move out of here error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array - --> $DIR/cannot-move-block-spans.rs:23:26 + --> $DIR/cannot-move-block-spans.rs:13:26 | LL | let z = loop { break arr[0]; }; //~ ERROR | ^^^^^^ cannot move out of here error[E0507]: cannot move out of borrowed content - --> $DIR/cannot-move-block-spans.rs:27:38 + --> $DIR/cannot-move-block-spans.rs:17:38 | LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/cannot-move-block-spans.rs:28:45 + --> $DIR/cannot-move-block-spans.rs:18:45 | LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/cannot-move-block-spans.rs:29:49 + --> $DIR/cannot-move-block-spans.rs:19:49 | LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR | ^^ cannot move out of borrowed content diff --git a/src/test/ui/nll/capture-mut-ref.rs b/src/test/ui/nll/capture-mut-ref.rs index c3c5053af0c..222f4e71c52 100644 --- a/src/test/ui/nll/capture-mut-ref.rs +++ b/src/test/ui/nll/capture-mut-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that capturing a mutable reference by move and assigning to its // referent doesn't make the unused mut lint think that it is mutable. diff --git a/src/test/ui/nll/capture-mut-ref.stderr b/src/test/ui/nll/capture-mut-ref.stderr index 50a77ee10e5..327ce0c6e81 100644 --- a/src/test/ui/nll/capture-mut-ref.stderr +++ b/src/test/ui/nll/capture-mut-ref.stderr @@ -1,5 +1,5 @@ error: variable does not need to be mutable - --> $DIR/capture-mut-ref.rs:18:9 + --> $DIR/capture-mut-ref.rs:8:9 | LL | let mut x = &mut 0; | ----^ @@ -7,7 +7,7 @@ LL | let mut x = &mut 0; | help: remove this `mut` | note: lint level defined here - --> $DIR/capture-mut-ref.rs:15:9 + --> $DIR/capture-mut-ref.rs:5:9 | LL | #![deny(unused_mut)] | ^^^^^^^^^^ diff --git a/src/test/ui/nll/capture-ref-in-struct.rs b/src/test/ui/nll/capture-ref-in-struct.rs index f49e06bd9e8..bf2db32901e 100644 --- a/src/test/ui/nll/capture-ref-in-struct.rs +++ b/src/test/ui/nll/capture-ref-in-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a structure which tries to store a pointer to `y` into // `p` (indirectly) fails to compile. diff --git a/src/test/ui/nll/capture-ref-in-struct.stderr b/src/test/ui/nll/capture-ref-in-struct.stderr index 12a9adf6e0b..7fafb4474fd 100644 --- a/src/test/ui/nll/capture-ref-in-struct.stderr +++ b/src/test/ui/nll/capture-ref-in-struct.stderr @@ -1,5 +1,5 @@ error[E0597]: `y` does not live long enough - --> $DIR/capture-ref-in-struct.rs:31:16 + --> $DIR/capture-ref-in-struct.rs:21:16 | LL | y: &y, | ^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/closure-access-spans.rs b/src/test/ui/nll/closure-access-spans.rs index b49436fabcf..1e11b481818 100644 --- a/src/test/ui/nll/closure-access-spans.rs +++ b/src/test/ui/nll/closure-access-spans.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that accesses due to a closure capture give a special note #![feature(nll)] diff --git a/src/test/ui/nll/closure-access-spans.stderr b/src/test/ui/nll/closure-access-spans.stderr index 9306926bf38..3ca0aefb592 100644 --- a/src/test/ui/nll/closure-access-spans.stderr +++ b/src/test/ui/nll/closure-access-spans.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/closure-access-spans.rs:17:5 + --> $DIR/closure-access-spans.rs:7:5 | LL | let r = &mut x; | ------ mutable borrow occurs here @@ -11,7 +11,7 @@ LL | r.use_mut(); | - mutable borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/closure-access-spans.rs:23:5 + --> $DIR/closure-access-spans.rs:13:5 | LL | let r = &mut x; | ------ first mutable borrow occurs here @@ -23,7 +23,7 @@ LL | r.use_mut(); | - first borrow later used here error[E0500]: closure requires unique access to `x` but it is already borrowed - --> $DIR/closure-access-spans.rs:29:5 + --> $DIR/closure-access-spans.rs:19:5 | LL | let r = &mut x; | ------ borrow occurs here @@ -35,7 +35,7 @@ LL | r.use_mut(); | - first borrow later used here error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/closure-access-spans.rs:35:13 + --> $DIR/closure-access-spans.rs:25:13 | LL | let r = &mut x; | ------ borrow of `x` occurs here @@ -45,7 +45,7 @@ LL | r.use_ref(); | - borrow later used here error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/closure-access-spans.rs:41:5 + --> $DIR/closure-access-spans.rs:31:5 | LL | let r = &x; | -- borrow of `x` occurs here @@ -57,52 +57,52 @@ LL | r.use_ref(); | - borrow later used here error[E0382]: borrow of moved value: `x` - --> $DIR/closure-access-spans.rs:47:5 + --> $DIR/closure-access-spans.rs:37:5 | +LL | fn closure_imm_capture_moved(mut x: String) { + | ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let r = x; | - value moved here LL | || x.len(); //~ ERROR | ^^ - borrow occurs due to use in closure | | | value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/closure-access-spans.rs:52:5 + --> $DIR/closure-access-spans.rs:42:5 | +LL | fn closure_mut_capture_moved(mut x: String) { + | ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let r = x; | - value moved here LL | || x = String::new(); //~ ERROR | ^^ - borrow occurs due to use in closure | | | value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/closure-access-spans.rs:57:5 + --> $DIR/closure-access-spans.rs:47:5 | +LL | fn closure_unique_capture_moved(x: &mut String) { + | - move occurs because `x` has type `&mut std::string::String`, which does not implement the `Copy` trait LL | let r = x; | - value moved here LL | || *x = String::new(); //~ ERROR | ^^ - borrow occurs due to use in closure | | | value borrowed here after move - | - = note: move occurs because `x` has type `&mut std::string::String`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/closure-access-spans.rs:62:5 + --> $DIR/closure-access-spans.rs:52:5 | +LL | fn closure_move_capture_moved(x: &mut String) { + | - move occurs because `x` has type `&mut std::string::String`, which does not implement the `Copy` trait LL | let r = x; | - value moved here LL | || x; //~ ERROR | ^^ - use occurs due to use in closure | | | value used here after move - | - = note: move occurs because `x` has type `&mut std::string::String`, which does not implement the `Copy` trait error: aborting due to 9 previous errors diff --git a/src/test/ui/nll/closure-borrow-spans.rs b/src/test/ui/nll/closure-borrow-spans.rs index d62dc27dade..7fc301b7038 100644 --- a/src/test/ui/nll/closure-borrow-spans.rs +++ b/src/test/ui/nll/closure-borrow-spans.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that existing borrows due to a closure capture give a special note #![feature(nll)] diff --git a/src/test/ui/nll/closure-borrow-spans.stderr b/src/test/ui/nll/closure-borrow-spans.stderr index 3e423dadd19..cf88b309f74 100644 --- a/src/test/ui/nll/closure-borrow-spans.stderr +++ b/src/test/ui/nll/closure-borrow-spans.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/closure-borrow-spans.rs:17:13 + --> $DIR/closure-borrow-spans.rs:7:13 | LL | let f = || x.len(); | -- - borrow occurs due to use in closure @@ -11,7 +11,7 @@ LL | f.use_ref(); | - borrow later used here error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> $DIR/closure-borrow-spans.rs:23:13 + --> $DIR/closure-borrow-spans.rs:13:13 | LL | let f = || x; | -- - first borrow occurs due to use of `x` in closure @@ -23,7 +23,7 @@ LL | f.use_ref(); | - immutable borrow later used here error[E0597]: `x` does not live long enough - --> $DIR/closure-borrow-spans.rs:31:16 + --> $DIR/closure-borrow-spans.rs:21:16 | LL | f = || x; //~ ERROR | -- ^ borrowed value does not live long enough @@ -35,7 +35,7 @@ LL | f.use_ref(); | - borrow later used here error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/closure-borrow-spans.rs:38:5 + --> $DIR/closure-borrow-spans.rs:28:5 | LL | let f = || x; | -- - borrow occurs due to use in closure @@ -47,7 +47,7 @@ LL | f.use_ref(); | - borrow later used here error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/closure-borrow-spans.rs:44:13 + --> $DIR/closure-borrow-spans.rs:34:13 | LL | let f = || x = 0; | -- - borrow occurs due to use of `x` in closure @@ -59,7 +59,7 @@ LL | f.use_ref(); | - borrow later used here error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable - --> $DIR/closure-borrow-spans.rs:50:13 + --> $DIR/closure-borrow-spans.rs:40:13 | LL | let f = || x = 0; | -- - first borrow occurs due to use of `x` in closure @@ -71,7 +71,7 @@ LL | f.use_ref(); | - mutable borrow later used here error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/closure-borrow-spans.rs:56:13 + --> $DIR/closure-borrow-spans.rs:46:13 | LL | let f = || x = 0; | -- - first borrow occurs due to use of `x` in closure @@ -83,7 +83,7 @@ LL | f.use_ref(); | - first borrow later used here error[E0597]: `x` does not live long enough - --> $DIR/closure-borrow-spans.rs:64:16 + --> $DIR/closure-borrow-spans.rs:54:16 | LL | f = || x = 0; //~ ERROR | -- ^ borrowed value does not live long enough @@ -95,7 +95,7 @@ LL | f.use_ref(); | - borrow later used here error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/closure-borrow-spans.rs:71:5 + --> $DIR/closure-borrow-spans.rs:61:5 | LL | let f = || x = 0; | -- - borrow occurs due to use in closure @@ -107,7 +107,7 @@ LL | f.use_ref(); | - borrow later used here error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/closure-borrow-spans.rs:77:13 + --> $DIR/closure-borrow-spans.rs:67:13 | LL | let f = || *x = 0; | -- - borrow occurs due to use in closure @@ -119,31 +119,31 @@ LL | f.use_ref(); | - borrow later used here error[E0501]: cannot borrow `x` as immutable because previous closure requires unique access - --> $DIR/closure-borrow-spans.rs:83:13 + --> $DIR/closure-borrow-spans.rs:73:13 | LL | let f = || *x = 0; | -- - first borrow occurs due to use of `x` in closure | | | closure construction occurs here LL | let y = &x; //~ ERROR - | ^^ borrow occurs here + | ^^ second borrow occurs here LL | f.use_ref(); | - first borrow later used here error[E0501]: cannot borrow `x` as mutable because previous closure requires unique access - --> $DIR/closure-borrow-spans.rs:89:13 + --> $DIR/closure-borrow-spans.rs:79:13 | LL | let f = || *x = 0; | -- - first borrow occurs due to use of `x` in closure | | | closure construction occurs here LL | let y = &mut x; //~ ERROR - | ^^^^^^ borrow occurs here + | ^^^^^^ second borrow occurs here LL | f.use_ref(); | - first borrow later used here error[E0597]: `x` does not live long enough - --> $DIR/closure-borrow-spans.rs:98:17 + --> $DIR/closure-borrow-spans.rs:88:17 | LL | f = || *x = 0; //~ ERROR | -- ^ borrowed value does not live long enough @@ -155,7 +155,7 @@ LL | f.use_ref(); | - borrow later used here error[E0506]: cannot assign to `*x` because it is borrowed - --> $DIR/closure-borrow-spans.rs:105:5 + --> $DIR/closure-borrow-spans.rs:95:5 | LL | let f = || *x = 0; | -- - borrow occurs due to use in closure diff --git a/src/test/ui/nll/closure-captures.rs b/src/test/ui/nll/closure-captures.rs index 16385ca2499..3a01f86cad8 100644 --- a/src/test/ui/nll/closure-captures.rs +++ b/src/test/ui/nll/closure-captures.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Some cases with closures that might be problems #![allow(unused)] diff --git a/src/test/ui/nll/closure-captures.stderr b/src/test/ui/nll/closure-captures.stderr index a03e104a1b1..cdc055f2a37 100644 --- a/src/test/ui/nll/closure-captures.stderr +++ b/src/test/ui/nll/closure-captures.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/closure-captures.rs:20:5 + --> $DIR/closure-captures.rs:10:5 | LL | fn one_closure(x: i32) { | - help: consider changing this to be mutable: `mut x` @@ -8,7 +8,7 @@ LL | x = 1; //~ ERROR | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/closure-captures.rs:22:5 + --> $DIR/closure-captures.rs:12:5 | LL | fn one_closure(x: i32) { | - help: consider changing this to be mutable: `mut x` @@ -17,7 +17,7 @@ LL | x = 1; //~ ERROR | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/closure-captures.rs:28:9 + --> $DIR/closure-captures.rs:18:9 | LL | fn two_closures(x: i32) { | - help: consider changing this to be mutable: `mut x` @@ -26,7 +26,7 @@ LL | x = 1; //~ ERROR | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/closure-captures.rs:32:9 + --> $DIR/closure-captures.rs:22:9 | LL | fn two_closures(x: i32) { | - help: consider changing this to be mutable: `mut x` @@ -35,7 +35,7 @@ LL | x = 1; //~ ERROR | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/closure-captures.rs:40:9 + --> $DIR/closure-captures.rs:30:9 | LL | || //~ ERROR | ^^ cannot borrow as mutable @@ -43,7 +43,7 @@ LL | x = 1;} | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/closure-captures.rs:39:12 + --> $DIR/closure-captures.rs:29:12 | LL | fn_ref(|| { | ____________^ @@ -52,7 +52,7 @@ LL | | x = 1;} | |________________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/closure-captures.rs:44:9 + --> $DIR/closure-captures.rs:34:9 | LL | || //~ ERROR | ^^ cannot borrow as mutable @@ -60,7 +60,7 @@ LL | x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/closure-captures.rs:43:12 + --> $DIR/closure-captures.rs:33:12 | LL | fn_ref(move || { | ____________^ @@ -69,7 +69,7 @@ LL | | x = 1;}); | |___________^ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/closure-captures.rs:52:10 + --> $DIR/closure-captures.rs:42:10 | LL | fn two_closures_ref(x: i32) { | - help: consider changing this to be mutable: `mut x` @@ -78,7 +78,7 @@ LL | x = 1;} //~ ERROR | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/closure-captures.rs:51:9 + --> $DIR/closure-captures.rs:41:9 | LL | || //~ ERROR | ^^ cannot borrow as mutable @@ -86,7 +86,7 @@ LL | x = 1;} //~ ERROR | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/closure-captures.rs:50:12 + --> $DIR/closure-captures.rs:40:12 | LL | fn_ref(|| { | ____________^ @@ -95,7 +95,7 @@ LL | | x = 1;} //~ ERROR | |________________^ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/closure-captures.rs:56:5 + --> $DIR/closure-captures.rs:46:5 | LL | fn two_closures_ref(x: i32) { | - help: consider changing this to be mutable: `mut x` @@ -104,7 +104,7 @@ LL | x = 1;}); //~ ERROR | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/closure-captures.rs:55:9 + --> $DIR/closure-captures.rs:45:9 | LL | || //~ ERROR | ^^ cannot borrow as mutable @@ -112,7 +112,7 @@ LL | x = 1;}); //~ ERROR | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/closure-captures.rs:54:12 + --> $DIR/closure-captures.rs:44:12 | LL | fn_ref(move || { | ____________^ @@ -121,7 +121,7 @@ LL | | x = 1;}); //~ ERROR | |___________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/closure-captures.rs:61:9 + --> $DIR/closure-captures.rs:51:9 | LL | || //~ ERROR | ^^ cannot borrow as mutable @@ -129,7 +129,7 @@ LL | *x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/closure-captures.rs:60:12 + --> $DIR/closure-captures.rs:50:12 | LL | fn_ref(|| { | ____________^ @@ -138,7 +138,7 @@ LL | | *x = 1;}); | |________________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure - --> $DIR/closure-captures.rs:64:9 + --> $DIR/closure-captures.rs:54:9 | LL | || //~ ERROR | ^^ cannot borrow as mutable @@ -146,7 +146,7 @@ LL | *x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/closure-captures.rs:63:12 + --> $DIR/closure-captures.rs:53:12 | LL | fn_ref(move || { | ____________^ diff --git a/src/test/ui/nll/closure-move-spans.rs b/src/test/ui/nll/closure-move-spans.rs index 7e836275c8b..ffbfa9f8ae4 100644 --- a/src/test/ui/nll/closure-move-spans.rs +++ b/src/test/ui/nll/closure-move-spans.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that moves due to a closure capture give a special note #![feature(nll)] diff --git a/src/test/ui/nll/closure-move-spans.stderr b/src/test/ui/nll/closure-move-spans.stderr index 80b7b4246a7..6750c404760 100644 --- a/src/test/ui/nll/closure-move-spans.stderr +++ b/src/test/ui/nll/closure-move-spans.stderr @@ -1,38 +1,38 @@ error[E0382]: use of moved value: `x` - --> $DIR/closure-move-spans.rs:17:13 + --> $DIR/closure-move-spans.rs:7:13 | +LL | fn move_after_move(x: String) { + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | || x; | -- - variable moved due to use in closure | | | value moved into closure here LL | let y = x; //~ ERROR | ^ value used here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/closure-move-spans.rs:22:13 + --> $DIR/closure-move-spans.rs:12:13 | +LL | fn borrow_after_move(x: String) { + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | || x; | -- - variable moved due to use in closure | | | value moved into closure here LL | let y = &x; //~ ERROR | ^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` - --> $DIR/closure-move-spans.rs:27:13 + --> $DIR/closure-move-spans.rs:17:13 | +LL | fn borrow_mut_after_move(mut x: String) { + | ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | || x; | -- - variable moved due to use in closure | | | value moved into closure here LL | let y = &mut x; //~ ERROR | ^^^^^^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.rs b/src/test/ui/nll/closure-requirements/escape-argument-callee.rs index 3c417493bc5..9b3a49b7b7e 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument-callee.rs +++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test closure that: // // - takes an argument `y` with lifetime `'a` (in the code, it's anonymous) diff --git a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr index 1f9cb6d050f..8e407070342 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument-callee.stderr @@ -1,5 +1,5 @@ note: No external requirements - --> $DIR/escape-argument-callee.rs:36:38 + --> $DIR/escape-argument-callee.rs:26:38 | LL | let mut closure = expect_sig(|p, y| *p = y); | ^^^^^^^^^^^^^ @@ -9,8 +9,8 @@ LL | let mut closure = expect_sig(|p, y| *p = y); for<'r, 's, 't0> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) mut &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 't0)) i32)) ] -error: unsatisfied lifetime constraints - --> $DIR/escape-argument-callee.rs:36:45 +error: lifetime may not live long enough + --> $DIR/escape-argument-callee.rs:26:45 | LL | let mut closure = expect_sig(|p, y| *p = y); | - - ^^^^^^ assignment requires that `'1` must outlive `'2` @@ -19,7 +19,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y); | has type `&mut &'2 i32` note: No external requirements - --> $DIR/escape-argument-callee.rs:30:1 + --> $DIR/escape-argument-callee.rs:20:1 | LL | / fn test() { LL | | let x = 44; diff --git a/src/test/ui/nll/closure-requirements/escape-argument.rs b/src/test/ui/nll/closure-requirements/escape-argument.rs index 7a28cb26f35..6269659c453 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument.rs +++ b/src/test/ui/nll/closure-requirements/escape-argument.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test closure that: // // - takes an argument `y` diff --git a/src/test/ui/nll/closure-requirements/escape-argument.stderr b/src/test/ui/nll/closure-requirements/escape-argument.stderr index a830768b36e..9b66abc40f0 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument.stderr @@ -1,5 +1,5 @@ note: No external requirements - --> $DIR/escape-argument.rs:36:38 + --> $DIR/escape-argument.rs:26:38 | LL | let mut closure = expect_sig(|p, y| *p = y); | ^^^^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y); ] note: No external requirements - --> $DIR/escape-argument.rs:30:1 + --> $DIR/escape-argument.rs:20:1 | LL | / fn test() { LL | | let x = 44; @@ -24,7 +24,7 @@ LL | | } = note: defining type: DefId(0/0:3 ~ escape_argument[317d]::test[0]) with substs [] error[E0597]: `y` does not live long enough - --> $DIR/escape-argument.rs:37:25 + --> $DIR/escape-argument.rs:27:25 | LL | closure(&mut p, &y); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.rs b/src/test/ui/nll/closure-requirements/escape-upvar-nested.rs index ce44903e6e6..b94b3d607c9 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.rs +++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // As in `escape-upvar-ref.rs`, test closure that: // // - captures a variable `y` diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr index ed2ae2f27b5..8214ff1fcec 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/escape-upvar-nested.rs:31:32 + --> $DIR/escape-upvar-nested.rs:21:32 | LL | let mut closure1 = || p = &y; //~ ERROR `y` does not live long enough [E0597] | ^^^^^^^^^ @@ -14,7 +14,7 @@ LL | let mut closure1 = || p = &y; //~ ERROR `y` does not live long = note: where '_#3r: '_#2r note: External requirements - --> $DIR/escape-upvar-nested.rs:30:27 + --> $DIR/escape-upvar-nested.rs:20:27 | LL | let mut closure = || { | ___________________________^ @@ -33,7 +33,7 @@ LL | | }; = note: where '_#3r: '_#2r note: No external requirements - --> $DIR/escape-upvar-nested.rs:23:1 + --> $DIR/escape-upvar-nested.rs:13:1 | LL | / fn test() { LL | | let x = 44; @@ -47,7 +47,7 @@ LL | | } = note: defining type: DefId(0/0:3 ~ escape_upvar_nested[317d]::test[0]) with substs [] error[E0597]: `y` does not live long enough - --> $DIR/escape-upvar-nested.rs:31:40 + --> $DIR/escape-upvar-nested.rs:21:40 | LL | let mut closure = || { | -- value captured here diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs b/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs index 49d31bbc139..a916ccd6c21 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs +++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test closure that: // // - captures a variable `y` by reference diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr index 8db56deeb1f..55ede6ed4aa 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/escape-upvar-ref.rs:33:27 + --> $DIR/escape-upvar-ref.rs:23:27 | LL | let mut closure = || p = &y; | ^^^^^^^^^ @@ -14,7 +14,7 @@ LL | let mut closure = || p = &y; = note: where '_#3r: '_#2r note: No external requirements - --> $DIR/escape-upvar-ref.rs:27:1 + --> $DIR/escape-upvar-ref.rs:17:1 | LL | / fn test() { LL | | let x = 44; @@ -28,7 +28,7 @@ LL | | } = note: defining type: DefId(0/0:3 ~ escape_upvar_ref[317d]::test[0]) with substs [] error[E0597]: `y` does not live long enough - --> $DIR/escape-upvar-ref.rs:33:35 + --> $DIR/escape-upvar-ref.rs:23:35 | LL | let mut closure = || p = &y; | -- ^ borrowed value does not live long enough diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs index 4f2ec80b0d2..95355323cdc 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test where we fail to approximate due to demanding a postdom // relationship between our upper bounds. diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr index fa14d496a14..55e4573e60b 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr @@ -1,5 +1,5 @@ note: No external requirements - --> $DIR/propagate-approximated-fail-no-postdom.rs:53:9 + --> $DIR/propagate-approximated-fail-no-postdom.rs:43:9 | LL | / |_outlives1, _outlives2, _outlives3, x, y| { LL | | // Only works if 'x: 'y: @@ -16,8 +16,8 @@ LL | | }, = note: late-bound region is '_#5r = note: late-bound region is '_#6r -error: unsatisfied lifetime constraints - --> $DIR/propagate-approximated-fail-no-postdom.rs:56:13 +error: lifetime may not live long enough + --> $DIR/propagate-approximated-fail-no-postdom.rs:46:13 | LL | |_outlives1, _outlives2, _outlives3, x, y| { | ---------- ---------- has type `std::cell::Cell<&'2 &u32>` @@ -28,7 +28,7 @@ LL | demand_y(x, y, p) //~ ERROR | ^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` note: No external requirements - --> $DIR/propagate-approximated-fail-no-postdom.rs:48:1 + --> $DIR/propagate-approximated-fail-no-postdom.rs:38:1 | LL | / fn supply<'a, 'b, 'c>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>, cell_c: Cell<&'c u32>) { LL | | establish_relationships( diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs index 3f7e400ed43..1c409a14b72 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Rather convoluted setup where we infer a relationship between two // free regions in the closure signature (`'a` and `'b`) on the basis // of a relationship between two bound regions (`'x` and `'y`). @@ -51,10 +41,9 @@ fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u3 #[rustc_regions] fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { - // Only works if 'x: 'y: demand_y(x, y, x.get()) - //~^ ERROR unsatisfied lifetime constraints + //~^ ERROR lifetime may not live long enough }); } diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr index ef84820de38..5863b9bc840 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -1,12 +1,11 @@ note: External requirements - --> $DIR/propagate-approximated-ref.rs:53:47 + --> $DIR/propagate-approximated-ref.rs:43:47 | LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | _______________________________________________^ -LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR unsatisfied lifetime constraints +LL | | //~^ ERROR lifetime may not live long enough LL | | }); | |_____^ | @@ -20,21 +19,21 @@ LL | | }); = note: where '_#1r: '_#2r note: No external requirements - --> $DIR/propagate-approximated-ref.rs:52:1 + --> $DIR/propagate-approximated-ref.rs:42:1 | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -LL | | LL | | // Only works if 'x: 'y: -... | +LL | | demand_y(x, y, x.get()) +LL | | //~^ ERROR lifetime may not live long enough LL | | }); LL | | } | |_^ | = note: defining type: DefId(0/0:6 ~ propagate_approximated_ref[317d]::supply[0]) with substs [] -error: unsatisfied lifetime constraints - --> $DIR/propagate-approximated-ref.rs:56:9 +error: lifetime may not live long enough + --> $DIR/propagate-approximated-ref.rs:45:9 | LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs index 54f9453797e..ab0bfb956f4 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a case where we setup relationships like `'x: 'a` or `'a: 'x`, // where `'x` is bound in closure type but `'a` is free. This forces // us to approximate `'x` one way or the other. diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index 43b4844bbf9..a9aeee8a319 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -1,5 +1,5 @@ note: No external requirements - --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:31:15 + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:21:15 | LL | foo(cell, |cell_a, cell_x| { | _______________^ @@ -14,7 +14,7 @@ LL | | }) ] error[E0521]: borrowed data escapes outside of closure - --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:32:9 + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:22:9 | LL | foo(cell, |cell_a, cell_x| { | ------ ------ `cell_x` is a reference that is only valid in the closure body @@ -24,7 +24,7 @@ LL | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure | ^^^^^^^^^^^^^^^^^^^^^^^^ `cell_x` escapes the closure body here note: No external requirements - --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1 + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:18:1 | LL | / fn case1() { LL | | let a = 0; @@ -38,7 +38,7 @@ LL | | } = note: defining type: DefId(0/0:5 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs [] note: External requirements - --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:45:15 + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:35:15 | LL | foo(cell, |cell_a, cell_x| { | _______________^ @@ -54,7 +54,7 @@ LL | | }) = note: where '_#1r: '_#0r note: No external requirements - --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:38:1 + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1 | LL | / fn case2() { LL | | let a = 0; @@ -68,7 +68,7 @@ LL | | } = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs [] error[E0597]: `a` does not live long enough - --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:40:26 + --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26 | LL | let cell = Cell::new(&a); | ----------^^- diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs index 4bef6cf8cd1..779c3671ff5 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs @@ -1,20 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a case where we are trying to prove `'x: 'y` and are forced to // approximate the shorter end-point (`'y`) to with `'static`. This is // because `'y` is higher-ranked but we know of no relations to other // regions. Note that `'static` shows up in the stderr output as `'0`. -// -// FIXME(#45827) Because of shortcomings in the MIR type checker, -// these errors are not (yet) reported. // compile-flags:-Zborrowck=mir -Zverbose diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index f22dbdba934..daeb3b9ab5c 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:47 + --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:32:47 | LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | _______________________________________________^ @@ -20,7 +20,7 @@ LL | | }); = note: where '_#1r: '_#0r note: No external requirements - --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:44:1 + --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:31:1 | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { @@ -34,7 +34,7 @@ LL | | } = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]) with substs [] error[E0521]: borrowed data escapes outside of function - --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:5 + --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:32:5 | LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { | ------ `cell_a` is a reference that is only valid in the function body diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs index 05e9818b91e..fbf4be75504 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs @@ -1,21 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a case where we are trying to prove `'x: 'y` and are forced to // approximate the shorter end-point (`'y`) to with `'static`. This is // because `'y` is higher-ranked but we know of only irrelevant // relations to other regions. Note that `'static` shows up in the // stderr output as `'0`. -// -// FIXME(#45827) Because of shortcomings in the MIR type checker, -// these errors are not (yet) reported. // compile-flags:-Zborrowck=mir -Zverbose diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index 2b1cb5a30ce..95e5ce0ae74 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:47 + --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:35:47 | LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | _______________________________________________^ @@ -20,7 +20,7 @@ LL | | }); = note: where '_#1r: '_#0r note: No external requirements - --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:47:1 + --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:34:1 | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { @@ -34,7 +34,7 @@ LL | | } = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]) with substs [] error[E0521]: borrowed data escapes outside of function - --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:5 + --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:35:5 | LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { | ------ `cell_a` is a reference that is only valid in the function body diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs index 1a0531cbd42..233a5dcab08 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A simpler variant of `outlives-from-argument` where cells are // passed by value. // @@ -44,10 +34,9 @@ fn demand_y<'x, 'y>(_outlives1: Cell<&&'x u32>, _outlives2: Cell<&'y &u32>, _y: #[rustc_regions] fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { - // Only works if 'x: 'y: demand_y(outlives1, outlives2, x.get()) - //~^ ERROR unsatisfied lifetime constraints + //~^ ERROR lifetime may not live long enough }); } diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr index aa193682404..b6d9d8529cf 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -1,12 +1,11 @@ note: External requirements - --> $DIR/propagate-approximated-val.rs:46:45 + --> $DIR/propagate-approximated-val.rs:36:45 | LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { | _____________________________________________^ -LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(outlives1, outlives2, x.get()) -LL | | //~^ ERROR unsatisfied lifetime constraints +LL | | //~^ ERROR lifetime may not live long enough LL | | }); | |_____^ | @@ -20,21 +19,21 @@ LL | | }); = note: where '_#1r: '_#2r note: No external requirements - --> $DIR/propagate-approximated-val.rs:45:1 + --> $DIR/propagate-approximated-val.rs:35:1 | LL | / fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { -LL | | LL | | // Only works if 'x: 'y: -... | +LL | | demand_y(outlives1, outlives2, x.get()) +LL | | //~^ ERROR lifetime may not live long enough LL | | }); LL | | } | |_^ | = note: defining type: DefId(0/0:6 ~ propagate_approximated_val[317d]::test[0]) with substs [] -error: unsatisfied lifetime constraints - --> $DIR/propagate-approximated-val.rs:49:9 +error: lifetime may not live long enough + --> $DIR/propagate-approximated-val.rs:38:9 | LL | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs index c21c824b22c..d1945f4864c 100644 --- a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs +++ b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test where we might in theory be able to see that the relationship // between two bound regions is true within closure and hence have no // need to propagate; but in fact we do because identity of free diff --git a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr index a3f78507d8d..79f0df9a688 100644 --- a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/propagate-despite-same-free-region.rs:52:9 + --> $DIR/propagate-despite-same-free-region.rs:42:9 | LL | / |_outlives1, _outlives2, x, y| { LL | | // Only works if 'x: 'y: @@ -17,7 +17,7 @@ LL | | }, = note: where '_#1r: '_#2r note: No external requirements - --> $DIR/propagate-despite-same-free-region.rs:49:1 + --> $DIR/propagate-despite-same-free-region.rs:39:1 | LL | / fn supply<'a>(cell_a: Cell<&'a u32>) { LL | | establish_relationships( diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs index 31f38abf280..37d47135285 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Similarly to escape-argument-callee, a test case where the closure // requires a relationship between 2 unrelated higher-ranked regions, // with no helpful relations between the HRRs and free regions. diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr index 31cad6ba1b5..93eb93bdc06 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr @@ -1,5 +1,5 @@ note: No external requirements - --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:45:47 + --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:35:47 | LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | _______________________________________________^ @@ -16,8 +16,8 @@ LL | | }); = note: late-bound region is '_#2r = note: late-bound region is '_#3r -error: unsatisfied lifetime constraints - --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:47:9 +error: lifetime may not live long enough + --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:37:9 | LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | --------- - has type `&std::cell::Cell<&'1 u32>` @@ -28,7 +28,7 @@ LL | demand_y(x, y, x.get()) | ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` note: No external requirements - --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:44:1 + --> $DIR/propagate-fail-to-approximate-longer-no-bounds.rs:34:1 | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs index a4ff408b766..c1467fcc9b6 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Similarly to escape-argument-callee, a test case where the closure // requires a relationship between 2 unrelated higher-ranked regions, // with no helpful relations between the HRRs and free regions. diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr index 4e21816e8c0..c7809de88b9 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr @@ -1,5 +1,5 @@ note: No external requirements - --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:49:47 + --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:39:47 | LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | _______________________________________________^ @@ -16,8 +16,8 @@ LL | | }); = note: late-bound region is '_#3r = note: late-bound region is '_#4r -error: unsatisfied lifetime constraints - --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:51:9 +error: lifetime may not live long enough + --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:41:9 | LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | ---------- ---------- has type `&std::cell::Cell<&'2 &u32>` @@ -28,7 +28,7 @@ LL | demand_y(x, y, x.get()) | ^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` note: No external requirements - --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:48:1 + --> $DIR/propagate-fail-to-approximate-longer-wrong-bounds.rs:38:1 | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { diff --git a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.rs b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.rs index a6542d73fdb..a578e959148 100644 --- a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.rs +++ b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that regions which appear only in the closure's generics (in // this case, `'a`) are properly mapped to the creator's generics. In // this case, the closure constrains its type parameter `T` to outlive diff --git a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr index d1976b40df4..3bcd8e1e256 100644 --- a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/propagate-from-trait-match.rs:42:36 + --> $DIR/propagate-from-trait-match.rs:32:36 | LL | establish_relationships(value, |value| { | ____________________________________^ @@ -21,7 +21,7 @@ LL | | }); = note: where T: '_#1r note: No external requirements - --> $DIR/propagate-from-trait-match.rs:38:1 + --> $DIR/propagate-from-trait-match.rs:28:1 | LL | / fn supply<'a, T>(value: T) LL | | where @@ -38,7 +38,7 @@ LL | | } ] error[E0309]: the parameter type `T` may not live long enough - --> $DIR/propagate-from-trait-match.rs:42:36 + --> $DIR/propagate-from-trait-match.rs:32:36 | LL | establish_relationships(value, |value| { | ____________________________________^ diff --git a/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.rs b/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.rs new file mode 100644 index 00000000000..dbc659b4aee --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.rs @@ -0,0 +1,25 @@ +// Test that we propagate *all* requirements to the caller, not just the first +// one. + +#![feature(nll)] + +fn once U>(f: F, s: S, t: T) -> U { + f(s, t) +} + +pub fn dangle() -> &'static [i32] { + let other_local_arr = [0, 2, 4]; + let local_arr = other_local_arr; + let mut out: &mut &'static [i32] = &mut (&[1] as _); + once(|mut z: &[i32], mut out_val: &mut &[i32]| { + // We unfortunately point to the first use in the closure in the error + // message + z = &local_arr; //~ ERROR + *out_val = &local_arr; + }, &[] as &[_], &mut *out); + *out +} + +fn main() { + println!("{:?}", dangle()); +} diff --git a/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr b/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr new file mode 100644 index 00000000000..2ad4577869a --- /dev/null +++ b/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr @@ -0,0 +1,17 @@ +error[E0597]: `local_arr` does not live long enough + --> $DIR/propagate-multiple-requirements.rs:17:14 + | +LL | let mut out: &mut &'static [i32] = &mut (&[1] as _); + | ------------------- type annotation requires that `local_arr` is borrowed for `'static` +LL | once(|mut z: &[i32], mut out_val: &mut &[i32]| { + | ----------------------------------------- value captured here +... +LL | z = &local_arr; //~ ERROR + | ^^^^^^^^^ borrowed value does not live long enough +... +LL | } + | - `local_arr` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs index 4382be05f03..ac2943fc3a5 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs +++ b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for free regions in the NLL code. This test ought to // report an error due to a reborrowing constraint. Right now, we get // a variety of errors from the older, AST-based machinery (notably diff --git a/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr index 9962e801653..e813f21e01d 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr +++ b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5 + --> $DIR/region-lbr-anon-does-not-outlive-static.rs:9:5 | LL | fn foo(x: &u32) -> &'static u32 { | ---- help: add explicit lifetime `ReStatic` to the type of `x`: `&ReStatic u32` diff --git a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs index d2dcfd86ac0..ce75e0700b0 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs +++ b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for free regions in the NLL code. This test ought to // report an error due to a reborrowing constraint. Right now, we get // a variety of errors from the older, AST-based machinery (notably diff --git a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr index ff36017c3d0..d0a24a267fd 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr +++ b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr @@ -1,5 +1,5 @@ -error: unsatisfied lifetime constraints - --> $DIR/region-lbr-named-does-not-outlive-static.rs:19:5 +error: lifetime may not live long enough + --> $DIR/region-lbr-named-does-not-outlive-static.rs:9:5 | LL | fn foo<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs index d793b0ba0be..4d864c6e588 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs +++ b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for free regions in the NLL code. This test ought to // report an error due to a reborrowing constraint. Right now, we get // a variety of errors from the older, AST-based machinery (notably @@ -17,7 +7,7 @@ fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 { &*x - //~^ ERROR unsatisfied lifetime constraints + //~^ ERROR lifetime may not live long enough } -fn main() { } +fn main() {} diff --git a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr index 2392e75538d..6dc98a94408 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr +++ b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr @@ -1,5 +1,5 @@ -error: unsatisfied lifetime constraints - --> $DIR/region-lbr1-does-not-outlive-ebr2.rs:19:5 +error: lifetime may not live long enough + --> $DIR/region-lbr1-does-not-outlive-ebr2.rs:9:5 | LL | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs b/src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs index 6d2bb309802..66290f2ff23 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs +++ b/src/test/ui/nll/closure-requirements/region-lbr1-does-outlive-lbr2-because-implied-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for free regions in the NLL code. This test does not // report an error because of the (implied) bound that `'b: 'a`. diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs index d45b7182305..5ac00638ec1 100644 --- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs +++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test closure that takes two references and is supposed to return // the first, but actually returns the second. This should fail within // the closure. diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr index d3eb3d46d21..4a035d0c9cd 100644 --- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr +++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -1,5 +1,5 @@ note: No external requirements - --> $DIR/return-wrong-bound-region.rs:21:16 + --> $DIR/return-wrong-bound-region.rs:11:16 | LL | expect_sig(|a, b| b); // ought to return `a` | ^^^^^^^^ @@ -9,8 +9,8 @@ LL | expect_sig(|a, b| b); // ought to return `a` for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) i32, &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 's)) i32)) -> &ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) i32 ] -error: unsatisfied lifetime constraints - --> $DIR/return-wrong-bound-region.rs:21:23 +error: lifetime may not live long enough + --> $DIR/return-wrong-bound-region.rs:11:23 | LL | expect_sig(|a, b| b); // ought to return `a` | - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` @@ -19,7 +19,7 @@ LL | expect_sig(|a, b| b); // ought to return `a` | has type `&'2 i32` note: No external requirements - --> $DIR/return-wrong-bound-region.rs:20:1 + --> $DIR/return-wrong-bound-region.rs:10:1 | LL | / fn test() { LL | | expect_sig(|a, b| b); // ought to return `a` diff --git a/src/test/ui/nll/closure-use-spans.rs b/src/test/ui/nll/closure-use-spans.rs index 7ab382a96bb..c7cd519cffb 100644 --- a/src/test/ui/nll/closure-use-spans.rs +++ b/src/test/ui/nll/closure-use-spans.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that liveness due to a closure capture gives a special note #![feature(nll)] diff --git a/src/test/ui/nll/closure-use-spans.stderr b/src/test/ui/nll/closure-use-spans.stderr index 7e5f9621d09..b2abfcacd0e 100644 --- a/src/test/ui/nll/closure-use-spans.stderr +++ b/src/test/ui/nll/closure-use-spans.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/closure-use-spans.rs:17:5 + --> $DIR/closure-use-spans.rs:7:5 | LL | let y = &x; | -- borrow of `x` occurs here @@ -9,7 +9,7 @@ LL | || *y; | - borrow later captured here by closure error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/closure-use-spans.rs:23:5 + --> $DIR/closure-use-spans.rs:13:5 | LL | let y = &mut x; | ------ borrow of `x` occurs here @@ -19,7 +19,7 @@ LL | || *y = 1; | - borrow later captured here by closure error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/closure-use-spans.rs:29:5 + --> $DIR/closure-use-spans.rs:19:5 | LL | let y = &x; | -- borrow of `x` occurs here diff --git a/src/test/ui/nll/closures-in-loops.rs b/src/test/ui/nll/closures-in-loops.rs index c6113f3a9c5..d2afa564734 100644 --- a/src/test/ui/nll/closures-in-loops.rs +++ b/src/test/ui/nll/closures-in-loops.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test messages where a closure capture conflicts with itself because it's in // a loop. diff --git a/src/test/ui/nll/closures-in-loops.stderr b/src/test/ui/nll/closures-in-loops.stderr index cd7fdbdb6ed..6c9e1639f88 100644 --- a/src/test/ui/nll/closures-in-loops.stderr +++ b/src/test/ui/nll/closures-in-loops.stderr @@ -1,15 +1,16 @@ error[E0382]: use of moved value: `x` - --> $DIR/closures-in-loops.rs:18:9 + --> $DIR/closures-in-loops.rs:8:9 | +LL | fn repreated_move(x: String) { + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait +LL | for i in 0..10 { LL | || x; //~ ERROR | ^^ - use occurs due to use in closure | | | value moved into closure here, in previous iteration of loop - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0499]: cannot borrow `x` as mutable more than once at a time - --> $DIR/closures-in-loops.rs:25:16 + --> $DIR/closures-in-loops.rs:15:16 | LL | v.push(|| x = String::new()); //~ ERROR | ^^ - borrows occur due to use of `x` in closure @@ -17,7 +18,7 @@ LL | v.push(|| x = String::new()); //~ ERROR | mutable borrow starts here in previous iteration of loop error[E0524]: two closures require unique access to `x` at the same time - --> $DIR/closures-in-loops.rs:32:16 + --> $DIR/closures-in-loops.rs:22:16 | LL | v.push(|| *x = String::new()); //~ ERROR | ^^ - borrows occur due to use of `x` in closure diff --git a/src/test/ui/nll/constant-thread-locals-issue-47053.rs b/src/test/ui/nll/constant-thread-locals-issue-47053.rs index 7b1dd9265af..4dd01410c5e 100644 --- a/src/test/ui/nll/constant-thread-locals-issue-47053.rs +++ b/src/test/ui/nll/constant-thread-locals-issue-47053.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #47053 #![feature(nll)] diff --git a/src/test/ui/nll/constant-thread-locals-issue-47053.stderr b/src/test/ui/nll/constant-thread-locals-issue-47053.stderr index 3aa95fcad01..77cffbfa72d 100644 --- a/src/test/ui/nll/constant-thread-locals-issue-47053.stderr +++ b/src/test/ui/nll/constant-thread-locals-issue-47053.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to immutable static item `FOO` - --> $DIR/constant-thread-locals-issue-47053.rs:20:5 + --> $DIR/constant-thread-locals-issue-47053.rs:10:5 | LL | FOO = 6; //~ ERROR cannot assign to immutable static item `FOO` [E0594] | ^^^^^^^ cannot assign diff --git a/src/test/ui/nll/constant.rs b/src/test/ui/nll/constant.rs index 6e2c0ae7bba..2bc40fcb327 100644 --- a/src/test/ui/nll/constant.rs +++ b/src/test/ui/nll/constant.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that MIR borrowck and NLL analysis can handle constants of // arbitrary types without ICEs. diff --git a/src/test/ui/nll/decl-macro-illegal-copy.rs b/src/test/ui/nll/decl-macro-illegal-copy.rs index 1525791c881..38bdb7dd270 100644 --- a/src/test/ui/nll/decl-macro-illegal-copy.rs +++ b/src/test/ui/nll/decl-macro-illegal-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #46314 #![feature(nll)] diff --git a/src/test/ui/nll/decl-macro-illegal-copy.stderr b/src/test/ui/nll/decl-macro-illegal-copy.stderr index 8bc25c23e01..9232ff52393 100644 --- a/src/test/ui/nll/decl-macro-illegal-copy.stderr +++ b/src/test/ui/nll/decl-macro-illegal-copy.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `wrapper.inner` - --> $DIR/decl-macro-illegal-copy.rs:32:9 + --> $DIR/decl-macro-illegal-copy.rs:22:9 | LL | $wrapper.inner | -------------- value moved here diff --git a/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.rs b/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.rs index 2a4295fd90a..2a1321c2551 100644 --- a/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.rs +++ b/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the 'static bound from the Copy impl is respected. Regression test for #29149. #![feature(nll)] diff --git a/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr b/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr index fc4118a0998..db5a549106b 100644 --- a/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr +++ b/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr @@ -1,5 +1,5 @@ error[E0597]: `s` does not live long enough - --> $DIR/do-not-ignore-lifetime-bounds-in-copy.rs:20:17 + --> $DIR/do-not-ignore-lifetime-bounds-in-copy.rs:10:17 | LL | let a = Foo(&s); //~ ERROR `s` does not live long enough [E0597] | ^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/drop-may-dangle.rs b/src/test/ui/nll/drop-may-dangle.rs index b357b3facf9..5c72225b11f 100644 --- a/src/test/ui/nll/drop-may-dangle.rs +++ b/src/test/ui/nll/drop-may-dangle.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for liveness constraints: the region (`R1`) that appears // in the type of `p` includes the points after `&v[0]` up to (but not // including) the call to `use_x`. The `else` branch is not included. diff --git a/src/test/ui/nll/drop-no-may-dangle.rs b/src/test/ui/nll/drop-no-may-dangle.rs index 51360931631..23f7f6c265e 100644 --- a/src/test/ui/nll/drop-no-may-dangle.rs +++ b/src/test/ui/nll/drop-no-may-dangle.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for liveness constraints: the region (`R1`) that appears // in the type of `p` must include everything until `p` is dropped // because of destructor. (Note that the stderr also identifies this @@ -27,10 +17,10 @@ fn main() { use_x(*p.value); } else { use_x(22); - v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed + v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed } - v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed + v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed } struct WrapMayNotDangle { diff --git a/src/test/ui/nll/drop-no-may-dangle.stderr b/src/test/ui/nll/drop-no-may-dangle.stderr index 60862d0f229..efa825be295 100644 --- a/src/test/ui/nll/drop-no-may-dangle.stderr +++ b/src/test/ui/nll/drop-no-may-dangle.stderr @@ -1,23 +1,23 @@ -error[E0506]: cannot assign to `v[..]` because it is borrowed - --> $DIR/drop-no-may-dangle.rs:30:9 +error[E0506]: cannot assign to `v[_]` because it is borrowed + --> $DIR/drop-no-may-dangle.rs:20:9 | LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; - | ----- borrow of `v[..]` occurs here + | ----- borrow of `v[_]` occurs here ... -LL | v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed - | ^^^^^^^^^ assignment to borrowed `v[..]` occurs here +LL | v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed + | ^^^^^^^^^ assignment to borrowed `v[_]` occurs here ... LL | } | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle` -error[E0506]: cannot assign to `v[..]` because it is borrowed - --> $DIR/drop-no-may-dangle.rs:33:5 +error[E0506]: cannot assign to `v[_]` because it is borrowed + --> $DIR/drop-no-may-dangle.rs:23:5 | LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; - | ----- borrow of `v[..]` occurs here + | ----- borrow of `v[_]` occurs here ... -LL | v[0] += 1; //~ ERROR cannot assign to `v[..]` because it is borrowed - | ^^^^^^^^^ assignment to borrowed `v[..]` occurs here +LL | v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed + | ^^^^^^^^^ assignment to borrowed `v[_]` occurs here LL | } | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle` diff --git a/src/test/ui/nll/extra-unused-mut.rs b/src/test/ui/nll/extra-unused-mut.rs index 472ac2cf1e8..d5f0b0ddf18 100644 --- a/src/test/ui/nll/extra-unused-mut.rs +++ b/src/test/ui/nll/extra-unused-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // extra unused mut lint tests for #51918 // run-pass diff --git a/src/test/ui/nll/generator-distinct-lifetime.rs b/src/test/ui/nll/generator-distinct-lifetime.rs index 64f98456991..d479a61baa2 100644 --- a/src/test/ui/nll/generator-distinct-lifetime.rs +++ b/src/test/ui/nll/generator-distinct-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generators, nll)] // Test for issue #47189. Here, both `s` and `t` are live for the diff --git a/src/test/ui/nll/generator-upvar-mutability.rs b/src/test/ui/nll/generator-upvar-mutability.rs index a32e076cb93..fe4bc6bce1b 100644 --- a/src/test/ui/nll/generator-upvar-mutability.rs +++ b/src/test/ui/nll/generator-upvar-mutability.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that generators respect the muatability of their upvars. #![feature(generators, nll)] diff --git a/src/test/ui/nll/generator-upvar-mutability.stderr b/src/test/ui/nll/generator-upvar-mutability.stderr index 180a330a30e..31b061b61d1 100644 --- a/src/test/ui/nll/generator-upvar-mutability.stderr +++ b/src/test/ui/nll/generator-upvar-mutability.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/generator-upvar-mutability.rs:18:9 + --> $DIR/generator-upvar-mutability.rs:8:9 | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/nll/get_default.nll.stderr b/src/test/ui/nll/get_default.nll.stderr index 4f9c832d423..0f71452805d 100644 --- a/src/test/ui/nll/get_default.nll.stderr +++ b/src/test/ui/nll/get_default.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast) - --> $DIR/get_default.rs:33:17 + --> $DIR/get_default.rs:23:17 | LL | match map.get() { | --- immutable borrow occurs here @@ -11,7 +11,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast) - --> $DIR/get_default.rs:45:17 + --> $DIR/get_default.rs:35:17 | LL | match map.get() { | --- immutable borrow occurs here @@ -23,7 +23,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast) - --> $DIR/get_default.rs:51:17 + --> $DIR/get_default.rs:41:17 | LL | match map.get() { | --- immutable borrow occurs here @@ -35,7 +35,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir) - --> $DIR/get_default.rs:33:17 + --> $DIR/get_default.rs:23:17 | LL | fn ok(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` @@ -50,7 +50,7 @@ LL | map.set(String::new()); // Ideally, this would not error. | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir) - --> $DIR/get_default.rs:45:17 + --> $DIR/get_default.rs:35:17 | LL | fn err(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` @@ -65,7 +65,7 @@ LL | return v; | - returning this value requires that `*map` is borrowed for `'1` error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir) - --> $DIR/get_default.rs:51:17 + --> $DIR/get_default.rs:41:17 | LL | fn err(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/nll/get_default.rs b/src/test/ui/nll/get_default.rs index 1a417b1e28c..89f693bfb65 100644 --- a/src/test/ui/nll/get_default.rs +++ b/src/test/ui/nll/get_default.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for free regions in the NLL code. This test ought to // report an error due to a reborrowing constraint. Right now, we get // a variety of errors from the older, AST-based machinery (notably diff --git a/src/test/ui/nll/get_default.stderr b/src/test/ui/nll/get_default.stderr index 98112e8b862..abb5343845b 100644 --- a/src/test/ui/nll/get_default.stderr +++ b/src/test/ui/nll/get_default.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast) - --> $DIR/get_default.rs:33:17 + --> $DIR/get_default.rs:23:17 | LL | match map.get() { | --- immutable borrow occurs here @@ -11,7 +11,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast) - --> $DIR/get_default.rs:45:17 + --> $DIR/get_default.rs:35:17 | LL | match map.get() { | --- immutable borrow occurs here @@ -23,7 +23,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast) - --> $DIR/get_default.rs:51:17 + --> $DIR/get_default.rs:41:17 | LL | match map.get() { | --- immutable borrow occurs here @@ -35,7 +35,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir) - --> $DIR/get_default.rs:33:17 + --> $DIR/get_default.rs:23:17 | LL | fn ok(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` @@ -50,7 +50,7 @@ LL | map.set(String::new()); // Ideally, this would not error. | ^^^ mutable borrow occurs here error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir) - --> $DIR/get_default.rs:45:17 + --> $DIR/get_default.rs:35:17 | LL | fn err(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` @@ -65,7 +65,7 @@ LL | return v; | - returning this value requires that `*map` is borrowed for `'1` error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir) - --> $DIR/get_default.rs:51:17 + --> $DIR/get_default.rs:41:17 | LL | fn err(map: &mut Map) -> &String { | - let's call the lifetime of this reference `'1` diff --git a/src/test/ui/nll/guarantor-issue-46974.rs b/src/test/ui/nll/guarantor-issue-46974.rs index 09ce42ce1b5..d0af468cff6 100644 --- a/src/test/ui/nll/guarantor-issue-46974.rs +++ b/src/test/ui/nll/guarantor-issue-46974.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that NLL analysis propagates lifetimes correctly through // field accesses, Box accesses, etc. diff --git a/src/test/ui/nll/guarantor-issue-46974.stderr b/src/test/ui/nll/guarantor-issue-46974.stderr index 6fc48129986..b2ed4c8fcab 100644 --- a/src/test/ui/nll/guarantor-issue-46974.stderr +++ b/src/test/ui/nll/guarantor-issue-46974.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `*s` because it is borrowed - --> $DIR/guarantor-issue-46974.rs:19:5 + --> $DIR/guarantor-issue-46974.rs:9:5 | LL | let t = &mut *s; // this borrow should last for the entire function | ------- borrow of `*s` occurs here @@ -10,7 +10,7 @@ LL | *x | -- borrow later used here error[E0621]: explicit lifetime required in the type of `s` - --> $DIR/guarantor-issue-46974.rs:25:5 + --> $DIR/guarantor-issue-46974.rs:15:5 | LL | fn bar(s: &Box<(i32,)>) -> &'static i32 { | ------------ help: add explicit lifetime `'static` to the type of `s`: `&'static std::boxed::Box<(i32,)>` diff --git a/src/test/ui/nll/issue-16223.rs b/src/test/ui/nll/issue-16223.rs index b41376ef443..881e202acf8 100644 --- a/src/test/ui/nll/issue-16223.rs +++ b/src/test/ui/nll/issue-16223.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #16223: without NLL the `if let` construct together with // the nested box-structure of `Root` causes an unwanted collateral move. diff --git a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr index e29c44760a9..54c728e3d27 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr +++ b/src/test/ui/nll/issue-21232-partial-init-and-erroneous-use.stderr @@ -13,12 +13,12 @@ LL | d.x = 10; error[E0382]: assign of moved value: `d` --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:43:5 | +LL | let mut d = D { x: 0, s: S{ y: 0, z: 0 } }; + | ----- move occurs because `d` has type `D`, which does not implement the `Copy` trait LL | drop(d); | - value moved here LL | d.x = 10; | ^^^^^^^^ value assigned here after move - | - = note: move occurs because `d` has type `D`, which does not implement the `Copy` trait error[E0381]: assign to part of possibly uninitialized variable: `d` --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:49:5 @@ -35,12 +35,12 @@ LL | d.s.y = 20; error[E0382]: assign to part of moved value: `d` --> $DIR/issue-21232-partial-init-and-erroneous-use.rs:62:5 | +LL | let mut d = D { x: 0, s: S{ y: 0, z: 0} }; + | ----- move occurs because `d` has type `D`, which does not implement the `Copy` trait LL | drop(d); | - value moved here LL | d.s.y = 20; | ^^^^^^^^^^ value partially assigned here after move - | - = note: move occurs because `d` has type `D`, which does not implement the `Copy` trait error: aborting due to 6 previous errors diff --git a/src/test/ui/nll/issue-21232-partial-init-and-use.rs b/src/test/ui/nll/issue-21232-partial-init-and-use.rs index 186ecc54827..633cbdba2d4 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-use.rs +++ b/src/test/ui/nll/issue-21232-partial-init-and-use.rs @@ -61,7 +61,7 @@ impl R { fn new(f: F) -> Self { R { w: 0, f } } } // As a shorthand for the cases above, adding a numeric summary to // each test's fn name to denote each point on each axis. // -// E.g. 1000 = field fully init struct; 0211 = local void reinit tuple +// e.g., 1000 = field fully init struct; 0211 = local void reinit tuple // It got pretty monotonous writing the same code over and over, and I // feared I would forget details. So I abstracted some desiderata into diff --git a/src/test/ui/nll/issue-21232-partial-init-and-use.stderr b/src/test/ui/nll/issue-21232-partial-init-and-use.stderr index aec7f676fce..23da533252c 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-use.stderr +++ b/src/test/ui/nll/issue-21232-partial-init-and-use.stderr @@ -14,21 +14,21 @@ error[E0382]: assign to part of moved value: `s` --> $DIR/issue-21232-partial-init-and-use.rs:113:5 | LL | let mut s: S = S::new(); drop(s); - | - value moved here + | ----- - value moved here + | | + | move occurs because `s` has type `S>`, which does not implement the `Copy` trait LL | s.x = 10; s.y = Box::new(20); | ^^^^^^^^ value partially assigned here after move - | - = note: move occurs because `s` has type `S>`, which does not implement the `Copy` trait error[E0382]: assign to part of moved value: `t` --> $DIR/issue-21232-partial-init-and-use.rs:120:5 | LL | let mut t: T = (0, Box::new(0)); drop(t); - | - value moved here + | ----- - value moved here + | | + | move occurs because `t` has type `(u32, std::boxed::Box)`, which does not implement the `Copy` trait LL | t.0 = 10; t.1 = Box::new(20); | ^^^^^^^^ value partially assigned here after move - | - = note: move occurs because `t` has type `(u32, std::boxed::Box)`, which does not implement the `Copy` trait error[E0381]: assign to part of possibly uninitialized variable: `s` --> $DIR/issue-21232-partial-init-and-use.rs:127:5 @@ -46,21 +46,21 @@ error[E0382]: assign to part of moved value: `s` --> $DIR/issue-21232-partial-init-and-use.rs:141:5 | LL | let mut s: S = S::new(); drop(s); - | - value moved here + | ----- - value moved here + | | + | move occurs because `s` has type `S>`, which does not implement the `Copy` trait LL | s.x = 10; | ^^^^^^^^ value partially assigned here after move - | - = note: move occurs because `s` has type `S>`, which does not implement the `Copy` trait error[E0382]: assign to part of moved value: `t` --> $DIR/issue-21232-partial-init-and-use.rs:148:5 | LL | let mut t: T = (0, Box::new(0)); drop(t); - | - value moved here + | ----- - value moved here + | | + | move occurs because `t` has type `(u32, std::boxed::Box)`, which does not implement the `Copy` trait LL | t.0 = 10; | ^^^^^^^^ value partially assigned here after move - | - = note: move occurs because `t` has type `(u32, std::boxed::Box)`, which does not implement the `Copy` trait error[E0381]: assign to part of possibly uninitialized variable: `s` --> $DIR/issue-21232-partial-init-and-use.rs:155:5 @@ -153,22 +153,24 @@ LL | q.r.f.0 = 10; error[E0382]: assign to part of moved value: `c` --> $DIR/issue-21232-partial-init-and-use.rs:259:13 | +LL | let mut c = (1, "".to_owned()); + | ----- move occurs because `c` has type `(i32, std::string::String)`, which does not implement the `Copy` trait +LL | match c { LL | c2 => { | -- value moved here LL | c.0 = 2; //~ ERROR assign to part of moved value | ^^^^^^^ value partially assigned here after move - | - = note: move occurs because `c` has type `(i32, std::string::String)`, which does not implement the `Copy` trait error[E0382]: assign to part of moved value: `c` --> $DIR/issue-21232-partial-init-and-use.rs:269:13 | +LL | let mut c = (1, (1, "".to_owned())); + | ----- move occurs because `c` has type `(i32, (i32, std::string::String))`, which does not implement the `Copy` trait +LL | match c { LL | c2 => { | -- value moved here LL | (c.1).0 = 2; //~ ERROR assign to part of moved value | ^^^^^^^^^^^ value partially assigned here after move - | - = note: move occurs because `c` has type `(i32, (i32, std::string::String))`, which does not implement the `Copy` trait error[E0382]: assign to part of moved value: `c.1` --> $DIR/issue-21232-partial-init-and-use.rs:277:13 diff --git a/src/test/ui/nll/issue-27868.rs b/src/test/ui/nll/issue-27868.rs index 022917a5556..b5cf20bc9f9 100644 --- a/src/test/ui/nll/issue-27868.rs +++ b/src/test/ui/nll/issue-27868.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #27868 #![feature(nll)] diff --git a/src/test/ui/nll/issue-27868.stderr b/src/test/ui/nll/issue-27868.stderr index a376829e37b..4cbd74fe272 100644 --- a/src/test/ui/nll/issue-27868.stderr +++ b/src/test/ui/nll/issue-27868.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `vecvec` because it is borrowed - --> $DIR/issue-27868.rs:36:9 + --> $DIR/issue-27868.rs:26:9 | LL | vecvec[0] += { | ------ diff --git a/src/test/ui/nll/issue-30104.rs b/src/test/ui/nll/issue-30104.rs index 64c32a55d04..88e49bf8df7 100644 --- a/src/test/ui/nll/issue-30104.rs +++ b/src/test/ui/nll/issue-30104.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #30104 // compile-pass diff --git a/src/test/ui/nll/issue-31567.rs b/src/test/ui/nll/issue-31567.rs index 3508f3033e6..c57a07a54d5 100644 --- a/src/test/ui/nll/issue-31567.rs +++ b/src/test/ui/nll/issue-31567.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #31567: cached results of projections were // causing region relations not to be enforced at all the places where // they have to be enforced. diff --git a/src/test/ui/nll/issue-31567.stderr b/src/test/ui/nll/issue-31567.stderr index 106f53dcf70..c76365095df 100644 --- a/src/test/ui/nll/issue-31567.stderr +++ b/src/test/ui/nll/issue-31567.stderr @@ -1,5 +1,5 @@ error[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue-31567.rs:22:26 + --> $DIR/issue-31567.rs:12:26 | LL | fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/issue-43058.rs b/src/test/ui/nll/issue-43058.rs index aeb81636daf..c5bae7a12d7 100644 --- a/src/test/ui/nll/issue-43058.rs +++ b/src/test/ui/nll/issue-43058.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(nll)] diff --git a/src/test/ui/nll/issue-46589.rs b/src/test/ui/nll/issue-46589.rs new file mode 100644 index 00000000000..690f6f269eb --- /dev/null +++ b/src/test/ui/nll/issue-46589.rs @@ -0,0 +1,27 @@ +#![feature(nll)] + +struct Foo; + +impl Foo { + fn get_self(&mut self) -> Option<&mut Self> { + Some(self) + } + + fn new_self(&mut self) -> &mut Self { + self + } + + fn trigger_bug(&mut self) { + let other = &mut (&mut *self); + + *other = match (*other).get_self() { + Some(s) => s, + None => (*other).new_self() + //~^ ERROR cannot borrow `**other` as mutable more than once at a time [E0499] + }; + + let c = other; + } +} + +fn main() {} diff --git a/src/test/ui/nll/issue-46589.stderr b/src/test/ui/nll/issue-46589.stderr new file mode 100644 index 00000000000..7b02b905303 --- /dev/null +++ b/src/test/ui/nll/issue-46589.stderr @@ -0,0 +1,15 @@ +error[E0499]: cannot borrow `**other` as mutable more than once at a time + --> $DIR/issue-46589.rs:19:21 + | +LL | *other = match (*other).get_self() { + | -------- first mutable borrow occurs here +LL | Some(s) => s, +LL | None => (*other).new_self() + | ^^^^^^^^ + | | + | second mutable borrow occurs here + | first borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0499`. diff --git a/src/test/ui/nll/issue-47022.rs b/src/test/ui/nll/issue-47022.rs index 685823b25c6..c0f8efa2498 100644 --- a/src/test/ui/nll/issue-47022.rs +++ b/src/test/ui/nll/issue-47022.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(warnings)] diff --git a/src/test/ui/nll/issue-47388.rs b/src/test/ui/nll/issue-47388.rs index 39feea08aa4..df47baa3c17 100644 --- a/src/test/ui/nll/issue-47388.rs +++ b/src/test/ui/nll/issue-47388.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(nll)] struct FancyNum { num: u8, diff --git a/src/test/ui/nll/issue-47388.stderr b/src/test/ui/nll/issue-47388.stderr index 96e9f155414..dda324c2e98 100644 --- a/src/test/ui/nll/issue-47388.stderr +++ b/src/test/ui/nll/issue-47388.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference - --> $DIR/issue-47388.rs:18:5 + --> $DIR/issue-47388.rs:9:5 | LL | let fancy_ref = &(&mut fancy); | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)` diff --git a/src/test/ui/nll/issue-47470.rs b/src/test/ui/nll/issue-47470.rs index 38edb19a970..67150b46c35 100644 --- a/src/test/ui/nll/issue-47470.rs +++ b/src/test/ui/nll/issue-47470.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #47470: cached results of projections were // causing region relations not to be enforced at all the places where // they have to be enforced. diff --git a/src/test/ui/nll/issue-47470.stderr b/src/test/ui/nll/issue-47470.stderr index 143566413aa..ff1f1e2c1f1 100644 --- a/src/test/ui/nll/issue-47470.stderr +++ b/src/test/ui/nll/issue-47470.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to local variable `local` - --> $DIR/issue-47470.rs:27:9 + --> $DIR/issue-47470.rs:17:9 | LL | &local //~ ERROR cannot return reference to local variable `local` | ^^^^^^ returns a reference to data owned by the current function diff --git a/src/test/ui/nll/issue-48070.rs b/src/test/ui/nll/issue-48070.rs index 71d92c3702e..c69bd3dbe90 100644 --- a/src/test/ui/nll/issue-48070.rs +++ b/src/test/ui/nll/issue-48070.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // revisions: lxl nll diff --git a/src/test/ui/nll/issue-48238.rs b/src/test/ui/nll/issue-48238.rs index 7c5527ae1e7..2e64ea72db2 100644 --- a/src/test/ui/nll/issue-48238.rs +++ b/src/test/ui/nll/issue-48238.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #48238 #![feature(nll)] diff --git a/src/test/ui/nll/issue-48238.stderr b/src/test/ui/nll/issue-48238.stderr index a48516efdc2..7cb5eb736c0 100644 --- a/src/test/ui/nll/issue-48238.stderr +++ b/src/test/ui/nll/issue-48238.stderr @@ -1,5 +1,5 @@ -error: unsatisfied lifetime constraints - --> $DIR/issue-48238.rs:21:13 +error: lifetime may not live long enough + --> $DIR/issue-48238.rs:11:13 | LL | move || use_val(&orig); //~ ERROR | ------- ^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` diff --git a/src/test/ui/nll/issue-48697.rs b/src/test/ui/nll/issue-48697.rs index 69ff82e16a1..c60c265b813 100644 --- a/src/test/ui/nll/issue-48697.rs +++ b/src/test/ui/nll/issue-48697.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #48697 // compile-pass diff --git a/src/test/ui/nll/issue-50716-1.rs b/src/test/ui/nll/issue-50716-1.rs index ced9b1cde64..db7e6b30f27 100644 --- a/src/test/ui/nll/issue-50716-1.rs +++ b/src/test/ui/nll/issue-50716-1.rs @@ -1,12 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // An additional regression test for the issue #50716 “NLL ignores lifetimes // bounds derived from `Sized` requirements” that checks that the fixed compiler diff --git a/src/test/ui/nll/issue-50716.rs b/src/test/ui/nll/issue-50716.rs index beb2ff79e90..ce4bee36656 100644 --- a/src/test/ui/nll/issue-50716.rs +++ b/src/test/ui/nll/issue-50716.rs @@ -1,12 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // Regression test for the issue #50716: NLL ignores lifetimes bounds // derived from `Sized` requirements diff --git a/src/test/ui/nll/issue-50716.stderr b/src/test/ui/nll/issue-50716.stderr index eddad056995..229bb1777cc 100644 --- a/src/test/ui/nll/issue-50716.stderr +++ b/src/test/ui/nll/issue-50716.stderr @@ -1,5 +1,5 @@ -error: unsatisfied lifetime constraints - --> $DIR/issue-50716.rs:25:14 +error: lifetime may not live long enough + --> $DIR/issue-50716.rs:16:14 | LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>) | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/issue-51191.rs b/src/test/ui/nll/issue-51191.rs index 0f8372e094d..6704b648699 100644 --- a/src/test/ui/nll/issue-51191.rs +++ b/src/test/ui/nll/issue-51191.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] struct Struct; diff --git a/src/test/ui/nll/issue-51191.stderr b/src/test/ui/nll/issue-51191.stderr index 88c653effb4..e2348d36d33 100644 --- a/src/test/ui/nll/issue-51191.stderr +++ b/src/test/ui/nll/issue-51191.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/issue-51191.rs:16:5 + --> $DIR/issue-51191.rs:6:5 | LL | fn bar(self: &mut Self) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -11,7 +11,7 @@ LL | (&mut self).bar(); = help: a `loop` may express intention better if this is on purpose error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-51191.rs:18:9 + --> $DIR/issue-51191.rs:8:9 | LL | (&mut self).bar(); | ^^^^^^^^^^^ @@ -20,7 +20,7 @@ LL | (&mut self).bar(); | try removing `&mut` here error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-51191.rs:23:9 + --> $DIR/issue-51191.rs:13:9 | LL | fn imm(self) { | ---- help: consider changing this to be mutable: `mut self` @@ -28,19 +28,19 @@ LL | (&mut self).bar(); | ^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-51191.rs:32:9 + --> $DIR/issue-51191.rs:22:9 | LL | (&mut self).bar(); | ^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable - --> $DIR/issue-51191.rs:32:9 + --> $DIR/issue-51191.rs:22:9 | LL | (&mut self).bar(); | ^^^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable - --> $DIR/issue-51191.rs:38:9 + --> $DIR/issue-51191.rs:28:9 | LL | (&mut self).bar(); | ^^^^^^^^^^^ diff --git a/src/test/ui/nll/issue-51244.rs b/src/test/ui/nll/issue-51244.rs index f00ad3d6505..aaf98ddfa27 100644 --- a/src/test/ui/nll/issue-51244.rs +++ b/src/test/ui/nll/issue-51244.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] fn main() { diff --git a/src/test/ui/nll/issue-51244.stderr b/src/test/ui/nll/issue-51244.stderr index 4e04aec8fe1..69efb2ca847 100644 --- a/src/test/ui/nll/issue-51244.stderr +++ b/src/test/ui/nll/issue-51244.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*my_ref` which is behind a `&` reference - --> $DIR/issue-51244.rs:15:5 + --> $DIR/issue-51244.rs:5:5 | LL | let ref my_ref @ _ = 0; | -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _` diff --git a/src/test/ui/nll/issue-51268.rs b/src/test/ui/nll/issue-51268.rs index 6edd4a343c2..c14146a3de2 100644 --- a/src/test/ui/nll/issue-51268.rs +++ b/src/test/ui/nll/issue-51268.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![feature(nll)] diff --git a/src/test/ui/nll/issue-51268.stderr b/src/test/ui/nll/issue-51268.stderr index 44f7c52d257..ce93d3787ef 100644 --- a/src/test/ui/nll/issue-51268.stderr +++ b/src/test/ui/nll/issue-51268.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `self.thing` as mutable because it is also borrowed as immutable - --> $DIR/issue-51268.rs:28:9 + --> $DIR/issue-51268.rs:18:9 | LL | self.thing.bar(|| { | ^ --- -- immutable borrow occurs here diff --git a/src/test/ui/nll/issue-51351.rs b/src/test/ui/nll/issue-51351.rs index 62cc3f9692b..939993f154f 100644 --- a/src/test/ui/nll/issue-51351.rs +++ b/src/test/ui/nll/issue-51351.rs @@ -1,12 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // Regression test for #51351 and #52133: In the case of #51351, // late-bound regions (like 'a) that were unused within the arguments of diff --git a/src/test/ui/nll/issue-51512.rs b/src/test/ui/nll/issue-51512.rs index 43debec69b5..7e2e6e0a16c 100644 --- a/src/test/ui/nll/issue-51512.rs +++ b/src/test/ui/nll/issue-51512.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(nll)] diff --git a/src/test/ui/nll/issue-51512.stderr b/src/test/ui/nll/issue-51512.stderr index 49c419998a4..a84a236ca77 100644 --- a/src/test/ui/nll/issue-51512.stderr +++ b/src/test/ui/nll/issue-51512.stderr @@ -1,12 +1,12 @@ error[E0382]: use of moved value: `range` - --> $DIR/issue-51512.rs:17:13 + --> $DIR/issue-51512.rs:7:13 | +LL | let range = 0..1; + | ----- move occurs because `range` has type `std::ops::Range`, which does not implement the `Copy` trait LL | let r = range; | ----- value moved here LL | let x = range.start; | ^^^^^^^^^^^ value used here after move - | - = note: move occurs because `range` has type `std::ops::Range`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/nll/issue-52078.rs b/src/test/ui/nll/issue-52078.rs index 1fd00db536c..ebe442adbd9 100644 --- a/src/test/ui/nll/issue-52078.rs +++ b/src/test/ui/nll/issue-52078.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #![allow(unused_variables)] diff --git a/src/test/ui/nll/issue-52086.rs b/src/test/ui/nll/issue-52086.rs index 248f4ba0660..78765283ec2 100644 --- a/src/test/ui/nll/issue-52086.rs +++ b/src/test/ui/nll/issue-52086.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] use std::rc::Rc; @@ -18,7 +8,9 @@ struct Bar { field: Vec } fn main() { let x = Rc::new(Bar { field: vec![] }); drop(x.field); +//~^ ERROR cannot move out of an `Rc` let y = Arc::new(Bar { field: vec![] }); drop(y.field); +//~^ ERROR cannot move out of an `Arc` } diff --git a/src/test/ui/nll/issue-52086.stderr b/src/test/ui/nll/issue-52086.stderr index 1455c49ea16..ed4171ff142 100644 --- a/src/test/ui/nll/issue-52086.stderr +++ b/src/test/ui/nll/issue-52086.stderr @@ -1,11 +1,11 @@ error[E0507]: cannot move out of an `Rc` - --> $DIR/issue-52086.rs:20:10 + --> $DIR/issue-52086.rs:10:10 | LL | drop(x.field); | ^^^^^^^ cannot move out of an `Rc` error[E0507]: cannot move out of an `Arc` - --> $DIR/issue-52086.rs:23:10 + --> $DIR/issue-52086.rs:14:10 | LL | drop(y.field); | ^^^^^^^ cannot move out of an `Arc` diff --git a/src/test/ui/nll/issue-52113.rs b/src/test/ui/nll/issue-52113.rs index af577e8499b..795f4f426ff 100644 --- a/src/test/ui/nll/issue-52113.rs +++ b/src/test/ui/nll/issue-52113.rs @@ -1,19 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // #![allow(warnings)] #![feature(nll)] -trait Bazinga { } -impl Bazinga for F { } +trait Bazinga {} +impl Bazinga for F {} fn produce1<'a>(data: &'a u32) -> impl Bazinga + 'a { let x = move || { @@ -30,7 +21,6 @@ fn produce2<'a>(data: &'a mut Vec<&'a u32>, value: &'a u32) -> impl Bazinga + 'a x } - fn produce3<'a, 'b: 'a>(data: &'a mut Vec<&'a u32>, value: &'b u32) -> impl Bazinga + 'a { let x = move || { let value: &'a u32 = value; @@ -44,7 +34,7 @@ fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl B let value: &'a u32 = value; data.push(value); }; - x //~ ERROR unsatisfied lifetime constraints + x //~ ERROR lifetime may not live long enough } -fn main() { } +fn main() {} diff --git a/src/test/ui/nll/issue-52113.stderr b/src/test/ui/nll/issue-52113.stderr index 45a192de454..ceae16185bb 100644 --- a/src/test/ui/nll/issue-52113.stderr +++ b/src/test/ui/nll/issue-52113.stderr @@ -1,12 +1,12 @@ -error: unsatisfied lifetime constraints - --> $DIR/issue-52113.rs:47:5 +error: lifetime may not live long enough + --> $DIR/issue-52113.rs:37:5 | LL | fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl Bazinga + 'b { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here ... -LL | x //~ ERROR unsatisfied lifetime constraints +LL | x //~ ERROR lifetime may not live long enough | ^ returning this value requires that `'a` must outlive `'b` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-52534-1.rs b/src/test/ui/nll/issue-52534-1.rs index cd6c10335cc..7ab3593c89f 100644 --- a/src/test/ui/nll/issue-52534-1.rs +++ b/src/test/ui/nll/issue-52534-1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #![allow(warnings)] @@ -17,37 +7,45 @@ impl Test { fn bar(&self, x: &u32) -> &u32 { let x = 22; &x +//~^ ERROR cannot return reference to local variable } } fn foo(x: &u32) -> &u32 { let x = 22; &x +//~^ ERROR cannot return reference to local variable } fn baz(x: &u32) -> &&u32 { let x = 22; &&x +//~^ ERROR cannot return value referencing local variable +//~| ERROR cannot return reference to temporary value } fn foobazbar<'a>(x: u32, y: &'a u32) -> &'a u32 { let x = 22; &x +//~^ ERROR cannot return reference to local variable } fn foobar<'a>(x: &'a u32) -> &'a u32 { let x = 22; &x +//~^ ERROR cannot return reference to local variable } fn foobaz<'a, 'b>(x: &'a u32, y: &'b u32) -> &'a u32 { let x = 22; &x +//~^ ERROR cannot return reference to local variable } fn foobarbaz<'a, 'b>(x: &'a u32, y: &'b u32, z: &'a u32) -> &'a u32 { let x = 22; &x +//~^ ERROR cannot return reference to local variable } fn main() { } diff --git a/src/test/ui/nll/issue-52534-1.stderr b/src/test/ui/nll/issue-52534-1.stderr index 44a3ef3bb5d..7d82f5e710f 100644 --- a/src/test/ui/nll/issue-52534-1.stderr +++ b/src/test/ui/nll/issue-52534-1.stderr @@ -1,17 +1,17 @@ error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:19:9 + --> $DIR/issue-52534-1.rs:9:9 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:25:5 + --> $DIR/issue-52534-1.rs:16:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return value referencing local variable `x` - --> $DIR/issue-52534-1.rs:30:5 + --> $DIR/issue-52534-1.rs:22:5 | LL | &&x | ^-- @@ -20,7 +20,7 @@ LL | &&x | returns a value referencing data owned by the current function error[E0515]: cannot return reference to temporary value - --> $DIR/issue-52534-1.rs:30:5 + --> $DIR/issue-52534-1.rs:22:5 | LL | &&x | ^-- @@ -29,25 +29,25 @@ LL | &&x | returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:35:5 + --> $DIR/issue-52534-1.rs:29:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:40:5 + --> $DIR/issue-52534-1.rs:35:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:45:5 + --> $DIR/issue-52534-1.rs:41:5 | LL | &x | ^^ returns a reference to data owned by the current function error[E0515]: cannot return reference to local variable `x` - --> $DIR/issue-52534-1.rs:50:5 + --> $DIR/issue-52534-1.rs:47:5 | LL | &x | ^^ returns a reference to data owned by the current function diff --git a/src/test/ui/nll/issue-52534-2.rs b/src/test/ui/nll/issue-52534-2.rs index 4eac6feac0d..6e84869dd6d 100644 --- a/src/test/ui/nll/issue-52534-2.rs +++ b/src/test/ui/nll/issue-52534-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #![allow(warnings)] @@ -17,6 +7,7 @@ fn foo(x: &u32) -> &u32 { { let x = 32; y = &x +//~^ ERROR does not live long enough } println!("{}", y); diff --git a/src/test/ui/nll/issue-52534-2.stderr b/src/test/ui/nll/issue-52534-2.stderr index 51cd7c7bf3b..a4396ae386d 100644 --- a/src/test/ui/nll/issue-52534-2.stderr +++ b/src/test/ui/nll/issue-52534-2.stderr @@ -1,8 +1,9 @@ error[E0597]: `x` does not live long enough - --> $DIR/issue-52534-2.rs:19:9 + --> $DIR/issue-52534-2.rs:9:9 | LL | y = &x | ^^^^^^ borrowed value does not live long enough +LL | //~^ ERROR does not live long enough LL | } | - `x` dropped here while still borrowed LL | diff --git a/src/test/ui/nll/issue-52534.rs b/src/test/ui/nll/issue-52534.rs index 273c9b3c802..1394560df19 100644 --- a/src/test/ui/nll/issue-52534.rs +++ b/src/test/ui/nll/issue-52534.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #![allow(warnings)] @@ -20,11 +10,13 @@ fn baz(_: impl FnOnce(&u32, u32) -> &u32) { fn bar() { let x = 22; foo(|a| &x) +//~^ ERROR does not live long enough } fn foobar() { let y = 22; baz(|first, second| &y) +//~^ ERROR does not live long enough } fn main() { } diff --git a/src/test/ui/nll/issue-52534.stderr b/src/test/ui/nll/issue-52534.stderr index 00d72546ebc..e83374af3b0 100644 --- a/src/test/ui/nll/issue-52534.stderr +++ b/src/test/ui/nll/issue-52534.stderr @@ -1,28 +1,30 @@ error[E0597]: `x` does not live long enough - --> $DIR/issue-52534.rs:22:14 + --> $DIR/issue-52534.rs:12:14 | LL | foo(|a| &x) | - ^ `x` would have to be valid for `'0`... | | | has type `&'0 u32` +LL | //~^ ERROR does not live long enough LL | } | - ...but `x` will be dropped here, when the function `bar` returns | = note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments - = note: to learn more, visit + = note: to learn more, visit error[E0597]: `y` does not live long enough - --> $DIR/issue-52534.rs:27:26 + --> $DIR/issue-52534.rs:18:26 | LL | baz(|first, second| &y) | ----- ^ `y` would have to be valid for `'0`... | | | has type `&'0 u32` +LL | //~^ ERROR does not live long enough LL | } | - ...but `y` will be dropped here, when the function `foobar` returns | = note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments - = note: to learn more, visit + = note: to learn more, visit error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/issue-52663-span-decl-captured-variable.rs b/src/test/ui/nll/issue-52663-span-decl-captured-variable.rs index dc40b0c44fd..3e57d26745a 100644 --- a/src/test/ui/nll/issue-52663-span-decl-captured-variable.rs +++ b/src/test/ui/nll/issue-52663-span-decl-captured-variable.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] fn expect_fn(f: F) where F : Fn() { diff --git a/src/test/ui/nll/issue-52663-span-decl-captured-variable.stderr b/src/test/ui/nll/issue-52663-span-decl-captured-variable.stderr index 51f19565855..0162c6bcbd1 100644 --- a/src/test/ui/nll/issue-52663-span-decl-captured-variable.stderr +++ b/src/test/ui/nll/issue-52663-span-decl-captured-variable.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/issue-52663-span-decl-captured-variable.rs:20:26 + --> $DIR/issue-52663-span-decl-captured-variable.rs:10:26 | LL | let x = (vec![22], vec![44]); | - captured outer variable diff --git a/src/test/ui/nll/issue-52663-trait-object.rs b/src/test/ui/nll/issue-52663-trait-object.rs index 65d73eeae67..121c3ef4e61 100644 --- a/src/test/ui/nll/issue-52663-trait-object.rs +++ b/src/test/ui/nll/issue-52663-trait-object.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] #![feature(nll)] diff --git a/src/test/ui/nll/issue-52663-trait-object.stderr b/src/test/ui/nll/issue-52663-trait-object.stderr index 035422f2458..b9437d88ff6 100644 --- a/src/test/ui/nll/issue-52663-trait-object.stderr +++ b/src/test/ui/nll/issue-52663-trait-object.stderr @@ -1,5 +1,5 @@ error[E0597]: `tmp0` does not live long enough - --> $DIR/issue-52663-trait-object.rs:23:20 + --> $DIR/issue-52663-trait-object.rs:13:20 | LL | let tmp1 = &tmp0; | ^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-52669.rs b/src/test/ui/nll/issue-52669.rs index 17a59997e91..6027e988141 100644 --- a/src/test/ui/nll/issue-52669.rs +++ b/src/test/ui/nll/issue-52669.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] struct A { @@ -23,6 +13,7 @@ fn bar(mut a: A) -> B { a.b = B; foo(a); a.b.clone() +//~^ ERROR borrow of moved value } fn main() {} diff --git a/src/test/ui/nll/issue-52669.stderr b/src/test/ui/nll/issue-52669.stderr index ca1576fad7a..f51768c3859 100644 --- a/src/test/ui/nll/issue-52669.stderr +++ b/src/test/ui/nll/issue-52669.stderr @@ -1,12 +1,13 @@ error[E0382]: borrow of moved value: `a.b` - --> $DIR/issue-52669.rs:25:5 + --> $DIR/issue-52669.rs:15:5 | +LL | fn bar(mut a: A) -> B { + | ----- move occurs because `a` has type `A`, which does not implement the `Copy` trait +LL | a.b = B; LL | foo(a); | - value moved here LL | a.b.clone() | ^^^ value borrowed here after move - | - = note: move occurs because `a` has type `A`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/nll/issue-52742.rs b/src/test/ui/nll/issue-52742.rs index 84d06a1d20a..150e67fe094 100644 --- a/src/test/ui/nll/issue-52742.rs +++ b/src/test/ui/nll/issue-52742.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #![feature(in_band_lifetimes)] @@ -17,14 +7,14 @@ struct Foo<'a, 'b> { } struct Bar<'b> { - z: &'b u32 + z: &'b u32, } impl Foo<'_, '_> { fn take_bar(&mut self, b: Bar<'_>) { self.y = b.z - //~^ ERROR unsatisfied lifetime constraints + //~^ ERROR lifetime may not live long enough } } -fn main() { } +fn main() {} diff --git a/src/test/ui/nll/issue-52742.stderr b/src/test/ui/nll/issue-52742.stderr index ccd6ec5cb77..6b25296c4bd 100644 --- a/src/test/ui/nll/issue-52742.stderr +++ b/src/test/ui/nll/issue-52742.stderr @@ -1,5 +1,5 @@ -error: unsatisfied lifetime constraints - --> $DIR/issue-52742.rs:25:9 +error: lifetime may not live long enough + --> $DIR/issue-52742.rs:15:9 | LL | fn take_bar(&mut self, b: Bar<'_>) { | --------- -- let's call this `'1` diff --git a/src/test/ui/nll/issue-53040.rs b/src/test/ui/nll/issue-53040.rs index 2b6e67be6d9..8ce24c8ede9 100644 --- a/src/test/ui/nll/issue-53040.rs +++ b/src/test/ui/nll/issue-53040.rs @@ -1,16 +1,7 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] fn main() { let mut v: Vec<()> = Vec::new(); || &mut v; +//~^ ERROR captured variable cannot escape `FnMut` closure body } diff --git a/src/test/ui/nll/issue-53040.stderr b/src/test/ui/nll/issue-53040.stderr index fac9969f193..9e7e63af87d 100644 --- a/src/test/ui/nll/issue-53040.stderr +++ b/src/test/ui/nll/issue-53040.stderr @@ -1,5 +1,5 @@ error: captured variable cannot escape `FnMut` closure body - --> $DIR/issue-53040.rs:15:8 + --> $DIR/issue-53040.rs:5:8 | LL | || &mut v; | - ^^^^^^ returns a reference to a captured variable which escapes the closure body diff --git a/src/test/ui/nll/issue-53119.rs b/src/test/ui/nll/issue-53119.rs index bbef4cf3455..97e05c8810d 100644 --- a/src/test/ui/nll/issue-53119.rs +++ b/src/test/ui/nll/issue-53119.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(nll)] diff --git a/src/test/ui/nll/issue-53570.rs b/src/test/ui/nll/issue-53570.rs index 9617e40ec39..d0baffa2702 100644 --- a/src/test/ui/nll/issue-53570.rs +++ b/src/test/ui/nll/issue-53570.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #53570. Here, we need to propagate that `T: 'a` // but in some versions of NLL we were propagating a stronger // requirement that `T: 'static`. This arose because we actually had diff --git a/src/test/ui/nll/issue-53807.nll.stderr b/src/test/ui/nll/issue-53807.nll.stderr index 056046aa43a..2b15da3710e 100644 --- a/src/test/ui/nll/issue-53807.nll.stderr +++ b/src/test/ui/nll/issue-53807.nll.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value - --> $DIR/issue-53807.rs:14:21 + --> $DIR/issue-53807.rs:4:21 | LL | if let Some(thing) = maybe { | ^^^^^ value moved here, in previous iteration of loop diff --git a/src/test/ui/nll/issue-53807.rs b/src/test/ui/nll/issue-53807.rs index 791dee2fb31..f69d8c14935 100644 --- a/src/test/ui/nll/issue-53807.rs +++ b/src/test/ui/nll/issue-53807.rs @@ -1,17 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main(){ let maybe = Some(vec![true, true]); - loop { + loop { if let Some(thing) = maybe { +//~^ ERROR use of partially moved value +//~| ERROR use of moved value } } } diff --git a/src/test/ui/nll/issue-53807.stderr b/src/test/ui/nll/issue-53807.stderr index 7056899d0a4..fb6701452cb 100644 --- a/src/test/ui/nll/issue-53807.stderr +++ b/src/test/ui/nll/issue-53807.stderr @@ -1,5 +1,5 @@ error[E0382]: use of partially moved value: `maybe` - --> $DIR/issue-53807.rs:14:30 + --> $DIR/issue-53807.rs:4:30 | LL | if let Some(thing) = maybe { | ----- ^^^^^ value used here after move @@ -9,7 +9,7 @@ LL | if let Some(thing) = maybe { = note: move occurs because the value has type `std::vec::Vec`, which does not implement the `Copy` trait error[E0382]: use of moved value: `(maybe as std::prelude::v1::Some).0` - --> $DIR/issue-53807.rs:14:21 + --> $DIR/issue-53807.rs:4:21 | LL | if let Some(thing) = maybe { | ^^^^^ value moved here in previous iteration of loop diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr index c308562c0cc..8412cbdc54b 100644 --- a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr +++ b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.nll.stderr @@ -6,7 +6,7 @@ LL | D("other").next(&_thing1) | | | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... -LL | } +... LL | } | - `_thing1` dropped here while still borrowed LL | diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.rs b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.rs index 99eafe0e9d1..312e6dce8c7 100644 --- a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.rs +++ b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.rs @@ -5,6 +5,7 @@ fn main() { let _thing2 = D("thing2"); side_effects(); D("other").next(&_thing1) +//~^ ERROR does not live long enough } } diff --git a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr index eeba7d6bb44..8d23891e1ba 100644 --- a/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr +++ b/src/test/ui/nll/issue-54382-use-span-of-tail-of-block.stderr @@ -3,7 +3,7 @@ error[E0597]: `_thing1` does not live long enough | LL | D("other").next(&_thing1) | ^^^^^^^ borrowed value does not live long enough -LL | } +... LL | } | - `_thing1` dropped here while still borrowed LL | diff --git a/src/test/ui/nll/issue-54556-niconii.nll.stderr b/src/test/ui/nll/issue-54556-niconii.nll.stderr index 40cd04de5ec..58239fe6e88 100644 --- a/src/test/ui/nll/issue-54556-niconii.nll.stderr +++ b/src/test/ui/nll/issue-54556-niconii.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | -LL | if let Ok(_) = counter.lock() { } +LL | if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough | ^^^^^^^------- | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-54556-niconii.rs b/src/test/ui/nll/issue-54556-niconii.rs index 49b063f44f4..cae389e8ccb 100644 --- a/src/test/ui/nll/issue-54556-niconii.rs +++ b/src/test/ui/nll/issue-54556-niconii.rs @@ -19,7 +19,7 @@ impl Mutex { fn main() { let counter = Mutex; - if let Ok(_) = counter.lock() { } + if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough // With this code as written, the dynamic semantics here implies // that `Mutex::drop` for `counter` runs *before* diff --git a/src/test/ui/nll/issue-54556-niconii.stderr b/src/test/ui/nll/issue-54556-niconii.stderr index 2d0de26ab30..03a7b94d181 100644 --- a/src/test/ui/nll/issue-54556-niconii.stderr +++ b/src/test/ui/nll/issue-54556-niconii.stderr @@ -1,7 +1,7 @@ error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | -LL | if let Ok(_) = counter.lock() { } +LL | if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough | ^^^^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr b/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr index 0bf76485eef..b58454427af 100644 --- a/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr +++ b/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `stmt` does not live long enough --> $DIR/issue-54556-stephaneyfx.rs:27:21 | -LL | let rows = Rows(&stmt); +LL | let rows = Rows(&stmt); //~ ERROR does not live long enough | ^^^^^ borrowed value does not live long enough LL | rows.map(|row| row).next() | ------------------- a temporary with access to the borrow is created here ... diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.rs b/src/test/ui/nll/issue-54556-stephaneyfx.rs index 10a4e21497c..b758228e49c 100644 --- a/src/test/ui/nll/issue-54556-stephaneyfx.rs +++ b/src/test/ui/nll/issue-54556-stephaneyfx.rs @@ -24,7 +24,7 @@ impl<'stmt> Iterator for Rows<'stmt> { fn get_names() -> Option { let stmt = Statement; - let rows = Rows(&stmt); + let rows = Rows(&stmt); //~ ERROR does not live long enough rows.map(|row| row).next() // let x = rows.map(|row| row).next(); // x diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.stderr b/src/test/ui/nll/issue-54556-stephaneyfx.stderr index 4e581a516b2..bf3285a73c7 100644 --- a/src/test/ui/nll/issue-54556-stephaneyfx.stderr +++ b/src/test/ui/nll/issue-54556-stephaneyfx.stderr @@ -1,7 +1,7 @@ error[E0597]: `stmt` does not live long enough --> $DIR/issue-54556-stephaneyfx.rs:27:22 | -LL | let rows = Rows(&stmt); +LL | let rows = Rows(&stmt); //~ ERROR does not live long enough | ^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr index 513dca7950a..1bc43017bc6 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:11 | -LL | D(&_thing1).end() +LL | D(&_thing1).end() //~ ERROR does not live long enough | --^^^^^^^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.rs b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.rs index 63b04333de4..2935caaf25c 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.rs +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.rs @@ -2,7 +2,7 @@ fn main() { { let mut _thing1 = D(Box::new("thing1")); // D("other").next(&_thing1).end() - D(&_thing1).end() + D(&_thing1).end() //~ ERROR does not live long enough } ; diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr index a74970f7118..ca636e76132 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr @@ -1,7 +1,7 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:12 | -LL | D(&_thing1).end() +LL | D(&_thing1).end() //~ ERROR does not live long enough | ^^^^^^^ borrowed value does not live long enough LL | } | - `_thing1` dropped here while still borrowed diff --git a/src/test/ui/nll/issue-54556-used-vs-unused-tails.nll.stderr b/src/test/ui/nll/issue-54556-used-vs-unused-tails.nll.stderr index 9911fc97291..52d0870b78f 100644 --- a/src/test/ui/nll/issue-54556-used-vs-unused-tails.nll.stderr +++ b/src/test/ui/nll/issue-54556-used-vs-unused-tails.nll.stderr @@ -11,7 +11,7 @@ LL | { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:12:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:13:55 | LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // suggest `;` | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` @@ -23,7 +23,7 @@ LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:14:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:16:55 | LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // suggest `;` | --^^^^- -- ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` @@ -35,7 +35,7 @@ LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:16:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:19:55 | LL | let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` @@ -47,7 +47,7 @@ LL | let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:18:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:22:55 | LL | let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // suggest `;` | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` @@ -59,7 +59,7 @@ LL | let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:20:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:25:55 | LL | let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` @@ -71,7 +71,7 @@ LL | let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:24:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:30:55 | LL | _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` | --^^^^- - - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `D` @@ -83,7 +83,7 @@ LL | _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `l = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:30:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:37:55 | LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // suggest `;` | --^^^^- - @@ -96,7 +96,7 @@ LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // = note: The temporary is part of an expression at the end of a block. Consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped. error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:32:55 + --> $DIR/issue-54556-used-vs-unused-tails.rs:40:55 | LL | fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } // `let x = ...; x` | --^^^^- - diff --git a/src/test/ui/nll/issue-54556-used-vs-unused-tails.rs b/src/test/ui/nll/issue-54556-used-vs-unused-tails.rs index 64e4f75724a..0d96767a05d 100644 --- a/src/test/ui/nll/issue-54556-used-vs-unused-tails.rs +++ b/src/test/ui/nll/issue-54556-used-vs-unused-tails.rs @@ -8,29 +8,37 @@ fn main() { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` +//~^ ERROR does not live long enough { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // suggest `;` +//~^ ERROR does not live long enough { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // suggest `;` +//~^ ERROR does not live long enough let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` +//~^ ERROR does not live long enough let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // suggest `;` +//~^ ERROR does not live long enough let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` +//~^ ERROR does not live long enough let _x = { let mut _t1 = D(Box::new("t1")); let x = D(&_t1).end(); x } ; // no error let mut _y; _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` +//~^ ERROR does not live long enough _y = { let mut _t1 = D(Box::new("t1")); let x = D(&_t1).end(); x } ; // no error } fn f_param_ref(_t1: D>) { D(&_t1).unit() } // no error fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // suggest `;` +//~^ ERROR does not live long enough fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } // `let x = ...; x` - +//~^ ERROR does not live long enough #[derive(Debug)] struct D(T); diff --git a/src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr b/src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr index c75707b2aee..e9e4e51136d 100644 --- a/src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr +++ b/src/test/ui/nll/issue-54556-used-vs-unused-tails.stderr @@ -8,7 +8,7 @@ LL | { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:12:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:13:56 | LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // suggest `;` | ^^^ - - borrowed value needs to live until here @@ -17,7 +17,7 @@ LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } } ; // | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:14:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:16:56 | LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // suggest `;` | ^^^ -- borrowed value needs to live until here @@ -26,7 +26,7 @@ LL | { { let mut _t1 = D(Box::new("t1")); D(&_t1).end() }; } // | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:16:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:19:56 | LL | let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // suggest `;` | ^^^ - - borrowed value needs to live until here @@ -35,7 +35,7 @@ LL | let _ = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:18:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:22:56 | LL | let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // suggest `;` | ^^^ - - borrowed value needs to live until here @@ -44,7 +44,7 @@ LL | let _u = { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } ; // | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:20:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:25:56 | LL | let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` | ^^^ - - borrowed value needs to live until here @@ -53,7 +53,7 @@ LL | let _x = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:24:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:30:56 | LL | _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `let x = ...; x` | ^^^ - - borrowed value needs to live until here @@ -62,7 +62,7 @@ LL | _y = { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } ; // `l | borrowed value does not live long enough error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:30:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:37:56 | LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // suggest `;` | ^^^ - `_t1` dropped here while still borrowed @@ -72,7 +72,7 @@ LL | fn f_local_ref() { let mut _t1 = D(Box::new("t1")); D(&_t1).unit() } // = note: values in a scope are dropped in the opposite order they are created error[E0597]: `_t1` does not live long enough - --> $DIR/issue-54556-used-vs-unused-tails.rs:32:56 + --> $DIR/issue-54556-used-vs-unused-tails.rs:40:56 | LL | fn f() -> String { let mut _t1 = D(Box::new("t1")); D(&_t1).end() } // `let x = ...; x` | ^^^ - `_t1` dropped here while still borrowed diff --git a/src/test/ui/nll/issue-55288.rs b/src/test/ui/nll/issue-55288.rs index c0f10ee607c..9b3eb7f05de 100644 --- a/src/test/ui/nll/issue-55288.rs +++ b/src/test/ui/nll/issue-55288.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] // run-pass diff --git a/src/test/ui/nll/issue-55344.rs b/src/test/ui/nll/issue-55344.rs index 131c979a24b..b900acfa159 100644 --- a/src/test/ui/nll/issue-55344.rs +++ b/src/test/ui/nll/issue-55344.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(nll)] diff --git a/src/test/ui/nll/issue-55394.rs b/src/test/ui/nll/issue-55394.rs index 452fc88d1ec..deb1034525e 100644 --- a/src/test/ui/nll/issue-55394.rs +++ b/src/test/ui/nll/issue-55394.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] struct Bar; @@ -18,7 +8,7 @@ struct Foo<'s> { impl Foo<'_> { fn new(bar: &mut Bar) -> Self { - Foo { bar } + Foo { bar } //~ERROR lifetime may not live long enough } } diff --git a/src/test/ui/nll/issue-55394.stderr b/src/test/ui/nll/issue-55394.stderr index 284d7afa6fd..bcdd78248eb 100644 --- a/src/test/ui/nll/issue-55394.stderr +++ b/src/test/ui/nll/issue-55394.stderr @@ -1,11 +1,11 @@ -error: unsatisfied lifetime constraints - --> $DIR/issue-55394.rs:21:9 +error: lifetime may not live long enough + --> $DIR/issue-55394.rs:11:9 | LL | fn new(bar: &mut Bar) -> Self { | - ---- return type is Foo<'2> | | | let's call the lifetime of this reference `'1` -LL | Foo { bar } +LL | Foo { bar } //~ERROR lifetime may not live long enough | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-55401.rs b/src/test/ui/nll/issue-55401.rs new file mode 100644 index 00000000000..2fa23449108 --- /dev/null +++ b/src/test/ui/nll/issue-55401.rs @@ -0,0 +1,8 @@ +#![feature(nll)] + +fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 { + let (ref y, _z): (&'a u32, u32) = (&22, 44); + *y //~ ERROR +} + +fn main() {} diff --git a/src/test/ui/nll/issue-55401.stderr b/src/test/ui/nll/issue-55401.stderr new file mode 100644 index 00000000000..952b5441f86 --- /dev/null +++ b/src/test/ui/nll/issue-55401.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/issue-55401.rs:5:5 + | +LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 { + | -- lifetime `'a` defined here +LL | let (ref y, _z): (&'a u32, u32) = (&22, 44); +LL | *y //~ ERROR + | ^^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/nll/issue-55651.rs b/src/test/ui/nll/issue-55651.rs index b9777831bf6..976098e40ad 100644 --- a/src/test/ui/nll/issue-55651.rs +++ b/src/test/ui/nll/issue-55651.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(untagged_unions)] diff --git a/src/test/ui/nll/issue-55850.nll.stderr b/src/test/ui/nll/issue-55850.nll.stderr new file mode 100644 index 00000000000..e09711f74fd --- /dev/null +++ b/src/test/ui/nll/issue-55850.nll.stderr @@ -0,0 +1,18 @@ +error[E0597]: `s` does not live long enough + --> $DIR/issue-55850.rs:28:16 + | +LL | yield &s[..] //~ ERROR `s` does not live long enough [E0597] + | ^ borrowed value does not live long enough +LL | }) + | - `s` dropped here while still borrowed + +error[E0626]: borrow may still be in use when generator yields + --> $DIR/issue-55850.rs:28:16 + | +LL | yield &s[..] //~ ERROR `s` does not live long enough [E0597] + | -------^---- possible yield occurs here + +error: aborting due to 2 previous errors + +Some errors occurred: E0597, E0626. +For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/issue-55850.rs b/src/test/ui/nll/issue-55850.rs new file mode 100644 index 00000000000..8b5887224d1 --- /dev/null +++ b/src/test/ui/nll/issue-55850.rs @@ -0,0 +1,34 @@ +#![allow(unused_mut)] +#![feature(generators, generator_trait)] + +use std::marker::Unpin; +use std::ops::Generator; +use std::ops::GeneratorState::Yielded; +use std::pin::Pin; + +pub struct GenIter(G); + +impl Iterator for GenIter +where + G: Generator + Unpin, +{ + type Item = G::Yield; + + fn next(&mut self) -> Option { + match Pin::new(&mut self.0).resume() { + Yielded(y) => Some(y), + _ => None + } + } +} + +fn bug<'a>() -> impl Iterator { + GenIter(move || { + let mut s = String::new(); + yield &s[..] //~ ERROR `s` does not live long enough [E0597] + }) +} + +fn main() { + bug(); +} diff --git a/src/test/ui/nll/issue-55850.stderr b/src/test/ui/nll/issue-55850.stderr new file mode 100644 index 00000000000..2a24cba1a68 --- /dev/null +++ b/src/test/ui/nll/issue-55850.stderr @@ -0,0 +1,17 @@ +error[E0597]: `s` does not live long enough + --> $DIR/issue-55850.rs:28:16 + | +LL | yield &s[..] //~ ERROR `s` does not live long enough [E0597] + | ^ borrowed value does not live long enough +LL | }) + | - borrowed value only lives until here + | +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 25:8... + --> $DIR/issue-55850.rs:25:8 + | +LL | fn bug<'a>() -> impl Iterator { + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/issue-57100.rs b/src/test/ui/nll/issue-57100.rs new file mode 100644 index 00000000000..f669fe00956 --- /dev/null +++ b/src/test/ui/nll/issue-57100.rs @@ -0,0 +1,69 @@ +#![allow(unused)] +#![feature(nll)] + +// ignore-tidy-linelength + +// This tests the error messages for borrows of union fields when the unions are embedded in other +// structs or unions. + +#[derive(Clone, Copy, Default)] +struct Leaf { + l1_u8: u8, + l2_u8: u8, +} + +#[derive(Clone, Copy)] +union First { + f1_leaf: Leaf, + f2_leaf: Leaf, + f3_union: Second, +} + +#[derive(Clone, Copy)] +union Second { + s1_leaf: Leaf, + s2_leaf: Leaf, +} + +struct Root { + r1_u8: u8, + r2_union: First, +} + +// Borrow a different field of the nested union. +fn nested_union() { + unsafe { + let mut r = Root { + r1_u8: 3, + r2_union: First { f3_union: Second { s2_leaf: Leaf { l1_u8: 8, l2_u8: 4 } } } + }; + + let mref = &mut r.r2_union.f3_union.s1_leaf.l1_u8; + // ^^^^^^^ + *mref = 22; + let nref = &r.r2_union.f3_union.s2_leaf.l1_u8; + // ^^^^^^^ + //~^^ ERROR cannot borrow `r.r2_union.f3_union` (via `r.r2_union.f3_union.s2_leaf.l1_u8`) as immutable because it is also borrowed as mutable (via `r.r2_union.f3_union.s1_leaf.l1_u8`) [E0502] + println!("{} {}", mref, nref) + } +} + +// Borrow a different field of the first union. +fn first_union() { + unsafe { + let mut r = Root { + r1_u8: 3, + r2_union: First { f3_union: Second { s2_leaf: Leaf { l1_u8: 8, l2_u8: 4 } } } + }; + + let mref = &mut r.r2_union.f2_leaf.l1_u8; + // ^^^^^^^ + *mref = 22; + let nref = &r.r2_union.f1_leaf.l1_u8; + // ^^^^^^^ + //~^^ ERROR cannot borrow `r.r2_union` (via `r.r2_union.f1_leaf.l1_u8`) as immutable because it is also borrowed as mutable (via `r.r2_union.f2_leaf.l1_u8`) [E0502] + println!("{} {}", mref, nref) + } +} + +fn main() {} diff --git a/src/test/ui/nll/issue-57100.stderr b/src/test/ui/nll/issue-57100.stderr new file mode 100644 index 00000000000..5d5c86c3487 --- /dev/null +++ b/src/test/ui/nll/issue-57100.stderr @@ -0,0 +1,31 @@ +error[E0502]: cannot borrow `r.r2_union.f3_union` (via `r.r2_union.f3_union.s2_leaf.l1_u8`) as immutable because it is also borrowed as mutable (via `r.r2_union.f3_union.s1_leaf.l1_u8`) + --> $DIR/issue-57100.rs:44:20 + | +LL | let mref = &mut r.r2_union.f3_union.s1_leaf.l1_u8; + | -------------------------------------- mutable borrow occurs here (via `r.r2_union.f3_union.s1_leaf.l1_u8`) +... +LL | let nref = &r.r2_union.f3_union.s2_leaf.l1_u8; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immutable borrow of `r.r2_union.f3_union.s2_leaf.l1_u8` -- which overlaps with `r.r2_union.f3_union.s1_leaf.l1_u8` -- occurs here +... +LL | println!("{} {}", mref, nref) + | ---- mutable borrow later used here + | + = note: `r.r2_union.f3_union.s2_leaf.l1_u8` is a field of the union `Second`, so it overlaps the field `r.r2_union.f3_union.s1_leaf.l1_u8` + +error[E0502]: cannot borrow `r.r2_union` (via `r.r2_union.f1_leaf.l1_u8`) as immutable because it is also borrowed as mutable (via `r.r2_union.f2_leaf.l1_u8`) + --> $DIR/issue-57100.rs:62:20 + | +LL | let mref = &mut r.r2_union.f2_leaf.l1_u8; + | ----------------------------- mutable borrow occurs here (via `r.r2_union.f2_leaf.l1_u8`) +... +LL | let nref = &r.r2_union.f1_leaf.l1_u8; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ immutable borrow of `r.r2_union.f1_leaf.l1_u8` -- which overlaps with `r.r2_union.f2_leaf.l1_u8` -- occurs here +... +LL | println!("{} {}", mref, nref) + | ---- mutable borrow later used here + | + = note: `r.r2_union.f1_leaf.l1_u8` is a field of the union `First`, so it overlaps the field `r.r2_union.f2_leaf.l1_u8` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0502`. diff --git a/src/test/ui/nll/issue-57265-return-type-wf-check.rs b/src/test/ui/nll/issue-57265-return-type-wf-check.rs new file mode 100644 index 00000000000..24c61a4926f --- /dev/null +++ b/src/test/ui/nll/issue-57265-return-type-wf-check.rs @@ -0,0 +1,26 @@ +#![feature(nll)] + +use std::any::Any; + +#[derive(Debug, Clone)] +struct S(T); + +// S<&'a T> is in the return type, so we get an implied bound +// &'a T: 'static +fn foo<'a, T>(x: &'a T) -> (S<&'a T>, Box) { + let y = S(x); + + let z = Box::new(y.clone()) as Box; + (y, z) +} + +fn main() { + let x = 5; + + // Check that we require that the argument is of type `&'static String`, + // so that the return type is well-formed. + let (_, z) = foo(&"hello".to_string()); + //~^ ERROR temporary value dropped while borrowed + + println!("{:?}", z.downcast_ref::>()); +} diff --git a/src/test/ui/nll/issue-57265-return-type-wf-check.stderr b/src/test/ui/nll/issue-57265-return-type-wf-check.stderr new file mode 100644 index 00000000000..db01212597f --- /dev/null +++ b/src/test/ui/nll/issue-57265-return-type-wf-check.stderr @@ -0,0 +1,12 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/issue-57265-return-type-wf-check.rs:22:23 + | +LL | let (_, z) = foo(&"hello".to_string()); + | -----^^^^^^^^^^^^^^^^^^^-- temporary value is freed at the end of this statement + | | | + | | creates a temporary which is freed while still in use + | argument requires that borrow lasts for `'static` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/nll/issue-57280-1.rs b/src/test/ui/nll/issue-57280-1.rs new file mode 100644 index 00000000000..356c477f1ba --- /dev/null +++ b/src/test/ui/nll/issue-57280-1.rs @@ -0,0 +1,21 @@ +#![feature(nll)] + +// compile-pass + +trait Foo<'a> { + const C: &'a u32; +} + +impl<'a, T> Foo<'a> for T { + const C: &'a u32 = &22; +} + +fn foo() { + let a = 22; + match &a { + <() as Foo<'static>>::C => { } + &_ => { } + } +} + +fn main() {} diff --git a/src/test/ui/nll/issue-57280.rs b/src/test/ui/nll/issue-57280.rs new file mode 100644 index 00000000000..4fe6a96f5dc --- /dev/null +++ b/src/test/ui/nll/issue-57280.rs @@ -0,0 +1,22 @@ +#![feature(nll)] + +// compile-pass + +trait Foo { + const BLAH: &'static str; +} + +struct Placeholder; + +impl Foo for Placeholder { + const BLAH: &'static str = "hi"; +} + +fn foo(x: &str) { + match x { + ::BLAH => { } + _ => { } + } +} + +fn main() {} diff --git a/src/test/ui/nll/issue-57989.rs b/src/test/ui/nll/issue-57989.rs new file mode 100644 index 00000000000..4f21cca97cc --- /dev/null +++ b/src/test/ui/nll/issue-57989.rs @@ -0,0 +1,12 @@ +// Test for ICE from issue 57989 + +#![feature(nll)] + +fn f(x: &i32) { + let g = &x; + *x = 0; //~ ERROR cannot assign to `*x` which is behind a `&` reference + //~| ERROR cannot assign to `*x` because it is borrowed + g; +} + +fn main() {} diff --git a/src/test/ui/nll/issue-57989.stderr b/src/test/ui/nll/issue-57989.stderr new file mode 100644 index 00000000000..4561c99096f --- /dev/null +++ b/src/test/ui/nll/issue-57989.stderr @@ -0,0 +1,24 @@ +error[E0594]: cannot assign to `*x` which is behind a `&` reference + --> $DIR/issue-57989.rs:7:5 + | +LL | fn f(x: &i32) { + | ---- help: consider changing this to be a mutable reference: `&mut i32` +LL | let g = &x; +LL | *x = 0; //~ ERROR cannot assign to `*x` which is behind a `&` reference + | ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written + +error[E0506]: cannot assign to `*x` because it is borrowed + --> $DIR/issue-57989.rs:7:5 + | +LL | let g = &x; + | -- borrow of `*x` occurs here +LL | *x = 0; //~ ERROR cannot assign to `*x` which is behind a `&` reference + | ^^^^^^ assignment to borrowed `*x` occurs here +LL | //~| ERROR cannot assign to `*x` because it is borrowed +LL | g; + | - borrow later used here + +error: aborting due to 2 previous errors + +Some errors occurred: E0506, E0594. +For more information about an error, try `rustc --explain E0506`. diff --git a/src/test/ui/nll/loan_ends_mid_block_pair.rs b/src/test/ui/nll/loan_ends_mid_block_pair.rs index 97126e98cbf..bad214deac1 100644 --- a/src/test/ui/nll/loan_ends_mid_block_pair.rs +++ b/src/test/ui/nll/loan_ends_mid_block_pair.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // compile-flags:-Zborrowck=compare #![allow(warnings)] @@ -27,10 +16,8 @@ fn nll_fail() { //~| ERROR (Mir) [E0506] data.0 = 'f'; //~^ ERROR (Ast) [E0506] - //~| ERROR (Mir) [E0506] data.0 = 'g'; //~^ ERROR (Ast) [E0506] - //~| ERROR (Mir) [E0506] capitalize(c); } diff --git a/src/test/ui/nll/loan_ends_mid_block_pair.stderr b/src/test/ui/nll/loan_ends_mid_block_pair.stderr index 9afae71edbe..85703bda31c 100644 --- a/src/test/ui/nll/loan_ends_mid_block_pair.stderr +++ b/src/test/ui/nll/loan_ends_mid_block_pair.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `data.0` because it is borrowed (Ast) - --> $DIR/loan_ends_mid_block_pair.rs:25:5 + --> $DIR/loan_ends_mid_block_pair.rs:14:5 | LL | let c = &mut data.0; | ------ borrow of `data.0` occurs here @@ -8,7 +8,7 @@ LL | data.0 = 'e'; | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here error[E0506]: cannot assign to `data.0` because it is borrowed (Ast) - --> $DIR/loan_ends_mid_block_pair.rs:28:5 + --> $DIR/loan_ends_mid_block_pair.rs:17:5 | LL | let c = &mut data.0; | ------ borrow of `data.0` occurs here @@ -17,7 +17,7 @@ LL | data.0 = 'f'; | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here error[E0506]: cannot assign to `data.0` because it is borrowed (Ast) - --> $DIR/loan_ends_mid_block_pair.rs:31:5 + --> $DIR/loan_ends_mid_block_pair.rs:19:5 | LL | let c = &mut data.0; | ------ borrow of `data.0` occurs here @@ -26,7 +26,7 @@ LL | data.0 = 'g'; | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here error[E0506]: cannot assign to `data.0` because it is borrowed (Ast) - --> $DIR/loan_ends_mid_block_pair.rs:41:5 + --> $DIR/loan_ends_mid_block_pair.rs:28:5 | LL | let c = &mut data.0; | ------ borrow of `data.0` occurs here @@ -35,7 +35,7 @@ LL | data.0 = 'e'; | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here error[E0506]: cannot assign to `data.0` because it is borrowed (Ast) - --> $DIR/loan_ends_mid_block_pair.rs:43:5 + --> $DIR/loan_ends_mid_block_pair.rs:30:5 | LL | let c = &mut data.0; | ------ borrow of `data.0` occurs here @@ -44,7 +44,7 @@ LL | data.0 = 'f'; | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here error[E0506]: cannot assign to `data.0` because it is borrowed (Ast) - --> $DIR/loan_ends_mid_block_pair.rs:45:5 + --> $DIR/loan_ends_mid_block_pair.rs:32:5 | LL | let c = &mut data.0; | ------ borrow of `data.0` occurs here @@ -53,7 +53,7 @@ LL | data.0 = 'g'; | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here error[E0506]: cannot assign to `data.0` because it is borrowed (Mir) - --> $DIR/loan_ends_mid_block_pair.rs:25:5 + --> $DIR/loan_ends_mid_block_pair.rs:14:5 | LL | let c = &mut data.0; | ----------- borrow of `data.0` occurs here @@ -64,30 +64,6 @@ LL | data.0 = 'e'; LL | capitalize(c); | - borrow later used here -error[E0506]: cannot assign to `data.0` because it is borrowed (Mir) - --> $DIR/loan_ends_mid_block_pair.rs:28:5 - | -LL | let c = &mut data.0; - | ----------- borrow of `data.0` occurs here -... -LL | data.0 = 'f'; - | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here -... -LL | capitalize(c); - | - borrow later used here - -error[E0506]: cannot assign to `data.0` because it is borrowed (Mir) - --> $DIR/loan_ends_mid_block_pair.rs:31:5 - | -LL | let c = &mut data.0; - | ----------- borrow of `data.0` occurs here -... -LL | data.0 = 'g'; - | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here -... -LL | capitalize(c); - | - borrow later used here - -error: aborting due to 9 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0506`. diff --git a/src/test/ui/nll/loan_ends_mid_block_vec.rs b/src/test/ui/nll/loan_ends_mid_block_vec.rs index b5357d0ee82..682e7e3e96f 100644 --- a/src/test/ui/nll/loan_ends_mid_block_vec.rs +++ b/src/test/ui/nll/loan_ends_mid_block_vec.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // compile-flags:-Zborrowck=compare #![allow(warnings)] diff --git a/src/test/ui/nll/loan_ends_mid_block_vec.stderr b/src/test/ui/nll/loan_ends_mid_block_vec.stderr index 2869035c3f3..18d4e010946 100644 --- a/src/test/ui/nll/loan_ends_mid_block_vec.stderr +++ b/src/test/ui/nll/loan_ends_mid_block_vec.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast) - --> $DIR/loan_ends_mid_block_vec.rs:24:5 + --> $DIR/loan_ends_mid_block_vec.rs:13:5 | LL | let slice = &mut data; | ---- first mutable borrow occurs here @@ -11,7 +11,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast) - --> $DIR/loan_ends_mid_block_vec.rs:27:5 + --> $DIR/loan_ends_mid_block_vec.rs:16:5 | LL | let slice = &mut data; | ---- first mutable borrow occurs here @@ -23,7 +23,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast) - --> $DIR/loan_ends_mid_block_vec.rs:30:5 + --> $DIR/loan_ends_mid_block_vec.rs:19:5 | LL | let slice = &mut data; | ---- first mutable borrow occurs here @@ -35,7 +35,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast) - --> $DIR/loan_ends_mid_block_vec.rs:40:5 + --> $DIR/loan_ends_mid_block_vec.rs:29:5 | LL | let slice = &mut data; | ---- first mutable borrow occurs here @@ -47,7 +47,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast) - --> $DIR/loan_ends_mid_block_vec.rs:42:5 + --> $DIR/loan_ends_mid_block_vec.rs:31:5 | LL | let slice = &mut data; | ---- first mutable borrow occurs here @@ -59,7 +59,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast) - --> $DIR/loan_ends_mid_block_vec.rs:44:5 + --> $DIR/loan_ends_mid_block_vec.rs:33:5 | LL | let slice = &mut data; | ---- first mutable borrow occurs here @@ -71,7 +71,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `data` as mutable more than once at a time (Mir) - --> $DIR/loan_ends_mid_block_vec.rs:24:5 + --> $DIR/loan_ends_mid_block_vec.rs:13:5 | LL | let slice = &mut data; | --------- first mutable borrow occurs here @@ -83,7 +83,7 @@ LL | capitalize(slice); | ----- first borrow later used here error[E0499]: cannot borrow `data` as mutable more than once at a time (Mir) - --> $DIR/loan_ends_mid_block_vec.rs:27:5 + --> $DIR/loan_ends_mid_block_vec.rs:16:5 | LL | let slice = &mut data; | --------- first mutable borrow occurs here @@ -95,7 +95,7 @@ LL | capitalize(slice); | ----- first borrow later used here error[E0499]: cannot borrow `data` as mutable more than once at a time (Mir) - --> $DIR/loan_ends_mid_block_vec.rs:30:5 + --> $DIR/loan_ends_mid_block_vec.rs:19:5 | LL | let slice = &mut data; | --------- first mutable borrow occurs here diff --git a/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr b/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr index afb85c69990..4d647949038 100644 --- a/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr +++ b/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr @@ -1,15 +1,14 @@ warning[E0507]: cannot move out of borrowed content - --> $DIR/match-guards-always-borrow.rs:23:13 + --> $DIR/match-guards-always-borrow.rs:13:13 | LL | (|| { let bar = foo; bar.take() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future error: compilation successful - --> $DIR/match-guards-always-borrow.rs:57:1 + --> $DIR/match-guards-always-borrow.rs:47:1 | LL | / fn main() { //[ast]~ ERROR compilation successful LL | | should_reject_destructive_mutate_in_guard(); diff --git a/src/test/ui/nll/match-guards-always-borrow.ast.stderr b/src/test/ui/nll/match-guards-always-borrow.ast.stderr index d6186d7561a..92d76d577d5 100644 --- a/src/test/ui/nll/match-guards-always-borrow.ast.stderr +++ b/src/test/ui/nll/match-guards-always-borrow.ast.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/match-guards-always-borrow.rs:57:1 + --> $DIR/match-guards-always-borrow.rs:47:1 | LL | / fn main() { //[ast]~ ERROR compilation successful LL | | should_reject_destructive_mutate_in_guard(); diff --git a/src/test/ui/nll/match-guards-always-borrow.mir.stderr b/src/test/ui/nll/match-guards-always-borrow.mir.stderr index 54b1fcbd5bb..3e90c5a1542 100644 --- a/src/test/ui/nll/match-guards-always-borrow.mir.stderr +++ b/src/test/ui/nll/match-guards-always-borrow.mir.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/match-guards-always-borrow.rs:23:13 + --> $DIR/match-guards-always-borrow.rs:13:13 | LL | (|| { let bar = foo; bar.take() })(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content diff --git a/src/test/ui/nll/match-guards-always-borrow.rs b/src/test/ui/nll/match-guards-always-borrow.rs index 98553144627..ec4eed67976 100644 --- a/src/test/ui/nll/match-guards-always-borrow.rs +++ b/src/test/ui/nll/match-guards-always-borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //revisions: ast mir //[mir] compile-flags: -Z borrowck=mir diff --git a/src/test/ui/nll/match-on-borrowed.rs b/src/test/ui/nll/match-on-borrowed.rs index 6a8ce03e8fd..edce2b185df 100644 --- a/src/test/ui/nll/match-on-borrowed.rs +++ b/src/test/ui/nll/match-on-borrowed.rs @@ -46,9 +46,9 @@ fn enum_example(mut e: E) { E::V(ref mut x, _) => x, E::W => panic!(), }; - match e { // OK, no access of borrowed data + match e { // Don't know that E uses a tag for its discriminant _ if false => (), - E::V(_, r) => (), + E::V(_, r) => (), //~ ERROR E::W => (), } x; @@ -59,9 +59,9 @@ fn indirect_enum_example(mut f: &mut E) { E::V(ref mut x, _) => x, E::W => panic!(), }; - match f { // OK, no access of borrowed data + match f { // Don't know that E uses a tag for its discriminant _ if false => (), - E::V(_, r) => (), + E::V(_, r) => (), //~ ERROR E::W => (), } x; diff --git a/src/test/ui/nll/match-on-borrowed.stderr b/src/test/ui/nll/match-on-borrowed.stderr index cdff29d44b8..2d34dd7805d 100644 --- a/src/test/ui/nll/match-on-borrowed.stderr +++ b/src/test/ui/nll/match-on-borrowed.stderr @@ -1,3 +1,27 @@ +error[E0503]: cannot use `e` because it was mutably borrowed + --> $DIR/match-on-borrowed.rs:51:9 + | +LL | E::V(ref mut x, _) => x, + | --------- borrow of `e.0` occurs here +... +LL | E::V(_, r) => (), //~ ERROR + | ^^^^^^^^^^ use of borrowed `e.0` +... +LL | x; + | - borrow later used here + +error[E0503]: cannot use `*f` because it was mutably borrowed + --> $DIR/match-on-borrowed.rs:64:9 + | +LL | E::V(ref mut x, _) => x, + | --------- borrow of `f.0` occurs here +... +LL | E::V(_, r) => (), //~ ERROR + | ^^^^^^^^^^ use of borrowed `f.0` +... +LL | x; + | - borrow later used here + error[E0503]: cannot use `t` because it was mutably borrowed --> $DIR/match-on-borrowed.rs:82:9 | @@ -16,7 +40,7 @@ error[E0381]: use of possibly uninitialized variable: `n` LL | match n {} //~ ERROR | ^ use of possibly uninitialized `n` -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors Some errors occurred: E0381, E0503. For more information about an error, try `rustc --explain E0381`. diff --git a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs index 808114f3fa9..5b609820a23 100644 --- a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs +++ b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(nll)] diff --git a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr index fc5417ac80c..3ff778675bc 100644 --- a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr +++ b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/maybe-initialized-drop-implicit-fragment-drop.rs:30:5 + --> $DIR/maybe-initialized-drop-implicit-fragment-drop.rs:20:5 | LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here diff --git a/src/test/ui/nll/maybe-initialized-drop-uninitialized.rs b/src/test/ui/nll/maybe-initialized-drop-uninitialized.rs index ae815a5efe9..3415c3eeabc 100644 --- a/src/test/ui/nll/maybe-initialized-drop-uninitialized.rs +++ b/src/test/ui/nll/maybe-initialized-drop-uninitialized.rs @@ -1,14 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z emit-end-regions -Zborrowck=mir +// compile-flags: -Zborrowck=mir // compile-pass #![allow(warnings)] diff --git a/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs b/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs index 00d146e0f02..d6cea55c1e0 100644 --- a/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs +++ b/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs @@ -1,14 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//compile-flags: -Z emit-end-regions -Zborrowck=mir +//compile-flags: -Zborrowck=mir #![allow(warnings)] diff --git a/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr b/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr index 6ae026fb169..5585e69f090 100644 --- a/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr +++ b/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/maybe-initialized-drop-with-fragment.rs:31:5 + --> $DIR/maybe-initialized-drop-with-fragment.rs:21:5 | LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here diff --git a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs index cd46014a7f5..d2d1b98c41c 100644 --- a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs +++ b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs @@ -1,14 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//compile-flags: -Z emit-end-regions -Zborrowck=mir +//compile-flags: -Zborrowck=mir #![allow(warnings)] diff --git a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr index dd16e9a0e84..aa9544927f8 100644 --- a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr +++ b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/maybe-initialized-drop-with-uninitialized-fragments.rs:32:5 + --> $DIR/maybe-initialized-drop-with-uninitialized-fragments.rs:22:5 | LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here diff --git a/src/test/ui/nll/maybe-initialized-drop.rs b/src/test/ui/nll/maybe-initialized-drop.rs index 9a3aca34620..cd12e93d555 100644 --- a/src/test/ui/nll/maybe-initialized-drop.rs +++ b/src/test/ui/nll/maybe-initialized-drop.rs @@ -1,14 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//compile-flags: -Z emit-end-regions -Zborrowck=mir +//compile-flags: -Zborrowck=mir #![allow(warnings)] diff --git a/src/test/ui/nll/maybe-initialized-drop.stderr b/src/test/ui/nll/maybe-initialized-drop.stderr index e8f427826ba..331f846dfd0 100644 --- a/src/test/ui/nll/maybe-initialized-drop.stderr +++ b/src/test/ui/nll/maybe-initialized-drop.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/maybe-initialized-drop.rs:26:5 + --> $DIR/maybe-initialized-drop.rs:16:5 | LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here diff --git a/src/test/ui/nll/mir_check_cast_closure.rs b/src/test/ui/nll/mir_check_cast_closure.rs index 577fdd7b548..0619ff37d97 100644 --- a/src/test/ui/nll/mir_check_cast_closure.rs +++ b/src/test/ui/nll/mir_check_cast_closure.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z borrowck=mir #![allow(dead_code)] @@ -15,7 +5,7 @@ fn bar<'a, 'b>() -> fn(&'a u32, &'b u32) -> &'a u32 { let g: fn(_, _) -> _ = |_x, y| y; g - //~^ ERROR unsatisfied lifetime constraints + //~^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/nll/mir_check_cast_closure.stderr b/src/test/ui/nll/mir_check_cast_closure.stderr index 6433668031b..e14cb074c81 100644 --- a/src/test/ui/nll/mir_check_cast_closure.stderr +++ b/src/test/ui/nll/mir_check_cast_closure.stderr @@ -1,5 +1,5 @@ -error: unsatisfied lifetime constraints - --> $DIR/mir_check_cast_closure.rs:17:5 +error: lifetime may not live long enough + --> $DIR/mir_check_cast_closure.rs:7:5 | LL | fn bar<'a, 'b>() -> fn(&'a u32, &'b u32) -> &'a u32 { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/nll/mir_check_cast_reify.rs b/src/test/ui/nll/mir_check_cast_reify.rs index c878be9e2a2..be12e313b42 100644 --- a/src/test/ui/nll/mir_check_cast_reify.rs +++ b/src/test/ui/nll/mir_check_cast_reify.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Zborrowck=mir #![allow(dead_code)] @@ -45,7 +35,7 @@ fn bar<'a>(x: &'a u32) -> &'static u32 { // as part of checking the `ReifyFnPointer`. let f: fn(_) -> _ = foo; f(x) - //~^ ERROR unsatisfied lifetime constraints + //~^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/nll/mir_check_cast_reify.stderr b/src/test/ui/nll/mir_check_cast_reify.stderr index fdb71b17287..4e8eec330a5 100644 --- a/src/test/ui/nll/mir_check_cast_reify.stderr +++ b/src/test/ui/nll/mir_check_cast_reify.stderr @@ -1,5 +1,5 @@ -error: unsatisfied lifetime constraints - --> $DIR/mir_check_cast_reify.rs:47:5 +error: lifetime may not live long enough + --> $DIR/mir_check_cast_reify.rs:37:5 | LL | fn bar<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/mir_check_cast_unsafe_fn.rs b/src/test/ui/nll/mir_check_cast_unsafe_fn.rs index be91a946857..9df9c057489 100644 --- a/src/test/ui/nll/mir_check_cast_unsafe_fn.rs +++ b/src/test/ui/nll/mir_check_cast_unsafe_fn.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Zborrowck=mir #![allow(dead_code)] @@ -17,7 +7,7 @@ fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 { // in `g`. These are related via the `UnsafeFnPointer` cast. let g: unsafe fn(_) -> _ = f; unsafe { g(input) } - //~^ ERROR unsatisfied lifetime constraints + //~^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr b/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr index c14fb93a525..52959850a33 100644 --- a/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr +++ b/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr @@ -1,5 +1,5 @@ -error: unsatisfied lifetime constraints - --> $DIR/mir_check_cast_unsafe_fn.rs:19:14 +error: lifetime may not live long enough + --> $DIR/mir_check_cast_unsafe_fn.rs:9:14 | LL | fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/mir_check_cast_unsize.rs b/src/test/ui/nll/mir_check_cast_unsize.rs index b1889b8aab2..d15c4e4f467 100644 --- a/src/test/ui/nll/mir_check_cast_unsize.rs +++ b/src/test/ui/nll/mir_check_cast_unsize.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z borrowck=mir #![allow(dead_code)] @@ -16,7 +6,7 @@ use std::fmt::Debug; fn bar<'a>(x: &'a u32) -> &'static dyn Debug { x - //~^ ERROR unsatisfied lifetime constraints + //~^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/nll/mir_check_cast_unsize.stderr b/src/test/ui/nll/mir_check_cast_unsize.stderr index 526dfb60133..364d6c17ea7 100644 --- a/src/test/ui/nll/mir_check_cast_unsize.stderr +++ b/src/test/ui/nll/mir_check_cast_unsize.stderr @@ -1,5 +1,5 @@ -error: unsatisfied lifetime constraints - --> $DIR/mir_check_cast_unsize.rs:18:5 +error: lifetime may not live long enough + --> $DIR/mir_check_cast_unsize.rs:8:5 | LL | fn bar<'a>(x: &'a u32) -> &'static dyn Debug { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/move-errors.rs b/src/test/ui/nll/move-errors.rs index 6445f166b57..a3416373709 100644 --- a/src/test/ui/nll/move-errors.rs +++ b/src/test/ui/nll/move-errors.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] #![feature(nll)] diff --git a/src/test/ui/nll/move-errors.stderr b/src/test/ui/nll/move-errors.stderr index 8b8268b5b2c..86bb8e3a4b3 100644 --- a/src/test/ui/nll/move-errors.stderr +++ b/src/test/ui/nll/move-errors.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/move-errors.rs:19:13 + --> $DIR/move-errors.rs:9:13 | LL | let b = *a; | ^^ @@ -8,7 +8,7 @@ LL | let b = *a; | help: consider removing the `*`: `a` error[E0508]: cannot move out of type `[A; 1]`, a non-copy array - --> $DIR/move-errors.rs:25:13 + --> $DIR/move-errors.rs:15:13 | LL | let b = a[0]; | ^^^^ @@ -17,7 +17,7 @@ LL | let b = a[0]; | help: consider borrowing here: `&a[0]` error[E0507]: cannot move out of borrowed content - --> $DIR/move-errors.rs:32:13 + --> $DIR/move-errors.rs:22:13 | LL | let s = **r; | ^^^ @@ -26,7 +26,7 @@ LL | let s = **r; | help: consider removing the `*`: `*r` error[E0507]: cannot move out of an `Rc` - --> $DIR/move-errors.rs:40:13 + --> $DIR/move-errors.rs:30:13 | LL | let s = *r; | ^^ @@ -35,7 +35,7 @@ LL | let s = *r; | help: consider removing the `*`: `r` error[E0508]: cannot move out of type `[A; 1]`, a non-copy array - --> $DIR/move-errors.rs:45:13 + --> $DIR/move-errors.rs:35:13 | LL | let a = [A("".to_string())][0]; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -44,7 +44,7 @@ LL | let a = [A("".to_string())][0]; | help: consider borrowing here: `&[A("".to_string())][0]` error[E0507]: cannot move out of borrowed content - --> $DIR/move-errors.rs:51:16 + --> $DIR/move-errors.rs:41:16 | LL | let A(s) = *a; | - ^^ @@ -54,13 +54,13 @@ LL | let A(s) = *a; | data moved here | note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/move-errors.rs:51:11 + --> $DIR/move-errors.rs:41:11 | LL | let A(s) = *a; | ^ error[E0509]: cannot move out of type `D`, which implements the `Drop` trait - --> $DIR/move-errors.rs:57:19 + --> $DIR/move-errors.rs:47:19 | LL | let C(D(s)) = c; | - ^ cannot move out of here @@ -68,19 +68,19 @@ LL | let C(D(s)) = c; | data moved here | note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/move-errors.rs:57:13 + --> $DIR/move-errors.rs:47:13 | LL | let C(D(s)) = c; | ^ error[E0507]: cannot move out of borrowed content - --> $DIR/move-errors.rs:64:9 + --> $DIR/move-errors.rs:54:9 | LL | b = *a; | ^^ cannot move out of borrowed content error[E0508]: cannot move out of type `[B; 1]`, a non-copy array - --> $DIR/move-errors.rs:87:11 + --> $DIR/move-errors.rs:77:11 | LL | match x[0] { | ^^^^ @@ -94,7 +94,7 @@ LL | B::V(s) => (), | - ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/move-errors.rs:89:14 + --> $DIR/move-errors.rs:79:14 | LL | B::U(d) => (), | ^ @@ -102,7 +102,7 @@ LL | B::V(s) => (), | ^ error[E0509]: cannot move out of type `D`, which implements the `Drop` trait - --> $DIR/move-errors.rs:96:11 + --> $DIR/move-errors.rs:86:11 | LL | match x { | ^ cannot move out of here @@ -111,13 +111,13 @@ LL | B::U(D(s)) => (), | - data moved here | note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/move-errors.rs:99:16 + --> $DIR/move-errors.rs:89:16 | LL | B::U(D(s)) => (), | ^ error[E0509]: cannot move out of type `D`, which implements the `Drop` trait - --> $DIR/move-errors.rs:105:11 + --> $DIR/move-errors.rs:95:11 | LL | match x { | ^ cannot move out of here @@ -126,13 +126,13 @@ LL | (D(s), &t) => (), | - data moved here | note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/move-errors.rs:108:12 + --> $DIR/move-errors.rs:98:12 | LL | (D(s), &t) => (), | ^ error[E0507]: cannot move out of borrowed content - --> $DIR/move-errors.rs:105:11 + --> $DIR/move-errors.rs:95:11 | LL | match x { | ^ cannot move out of borrowed content @@ -141,13 +141,13 @@ LL | (D(s), &t) => (), | - data moved here | note: move occurs because `t` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/move-errors.rs:108:17 + --> $DIR/move-errors.rs:98:17 | LL | (D(s), &t) => (), | ^ error[E0509]: cannot move out of type `F`, which implements the `Drop` trait - --> $DIR/move-errors.rs:115:11 + --> $DIR/move-errors.rs:105:11 | LL | match x { | ^ cannot move out of here @@ -158,13 +158,13 @@ LL | F(s, mut t) => (), | data moved here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/move-errors.rs:117:11 + --> $DIR/move-errors.rs:107:11 | LL | F(s, mut t) => (), | ^ ^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/move-errors.rs:123:11 + --> $DIR/move-errors.rs:113:11 | LL | match *x { | ^^ @@ -176,7 +176,7 @@ LL | Ok(s) | Err(s) => (), | - data moved here | note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait - --> $DIR/move-errors.rs:125:12 + --> $DIR/move-errors.rs:115:12 | LL | Ok(s) | Err(s) => (), | ^ diff --git a/src/test/ui/nll/move-subpaths-moves-root.rs b/src/test/ui/nll/move-subpaths-moves-root.rs index 7a4e518f977..72a36ef22df 100644 --- a/src/test/ui/nll/move-subpaths-moves-root.rs +++ b/src/test/ui/nll/move-subpaths-moves-root.rs @@ -1,17 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] fn main() { let x = (vec![1, 2, 3], ); drop(x.0); - drop(x); + drop(x); //~ ERROR use of moved value } diff --git a/src/test/ui/nll/move-subpaths-moves-root.stderr b/src/test/ui/nll/move-subpaths-moves-root.stderr index 76a1279750f..0dd396f855d 100644 --- a/src/test/ui/nll/move-subpaths-moves-root.stderr +++ b/src/test/ui/nll/move-subpaths-moves-root.stderr @@ -1,9 +1,9 @@ error[E0382]: use of moved value: `x` - --> $DIR/move-subpaths-moves-root.rs:16:10 + --> $DIR/move-subpaths-moves-root.rs:6:10 | LL | drop(x.0); | --- value moved here -LL | drop(x); +LL | drop(x); //~ ERROR use of moved value | ^ value used here after move | = note: move occurs because `x.0` has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/normalization-bounds-error.rs b/src/test/ui/nll/normalization-bounds-error.rs index 65b5cc12478..d6610e15823 100644 --- a/src/test/ui/nll/normalization-bounds-error.rs +++ b/src/test/ui/nll/normalization-bounds-error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we error when a bound from the impl is not satisfied when // normalizing an associated type. diff --git a/src/test/ui/nll/normalization-bounds-error.stderr b/src/test/ui/nll/normalization-bounds-error.stderr index 3548219361f..cd88ceb16d0 100644 --- a/src/test/ui/nll/normalization-bounds-error.stderr +++ b/src/test/ui/nll/normalization-bounds-error.stderr @@ -1,16 +1,16 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'d` due to conflicting requirements - --> $DIR/normalization-bounds-error.rs:23:1 + --> $DIR/normalization-bounds-error.rs:13:1 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'd as defined on the function body at 23:14... - --> $DIR/normalization-bounds-error.rs:23:14 +note: first, the lifetime cannot outlive the lifetime 'd as defined on the function body at 13:14... + --> $DIR/normalization-bounds-error.rs:13:14 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^ -note: ...but the lifetime must also be valid for the lifetime 'a as defined on the function body at 23:18... - --> $DIR/normalization-bounds-error.rs:23:18 +note: ...but the lifetime must also be valid for the lifetime 'a as defined on the function body at 13:18... + --> $DIR/normalization-bounds-error.rs:13:18 | LL | fn visit_seq<'d, 'a: 'd>() -> <&'a () as Visitor<'d>>::Value {} | ^^ diff --git a/src/test/ui/nll/normalization-bounds.rs b/src/test/ui/nll/normalization-bounds.rs index 722a6c00e75..ebc19d7cc83 100644 --- a/src/test/ui/nll/normalization-bounds.rs +++ b/src/test/ui/nll/normalization-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that lifetime bounds get checked the right way around with NLL enabled. //run-pass diff --git a/src/test/ui/nll/projection-return.rs b/src/test/ui/nll/projection-return.rs index c1abcb434e6..b2c9a087e0e 100644 --- a/src/test/ui/nll/projection-return.rs +++ b/src/test/ui/nll/projection-return.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zborrowck=mir // compile-pass diff --git a/src/test/ui/nll/promotable-mutable-zst-doesnt-conflict.rs b/src/test/ui/nll/promotable-mutable-zst-doesnt-conflict.rs index be385569612..061d0d69d09 100644 --- a/src/test/ui/nll/promotable-mutable-zst-doesnt-conflict.rs +++ b/src/test/ui/nll/promotable-mutable-zst-doesnt-conflict.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that mutable promoted length zero arrays don't check for conflicting // access diff --git a/src/test/ui/nll/reference-carried-through-struct-field.ast.nll.stderr b/src/test/ui/nll/reference-carried-through-struct-field.ast.nll.stderr index caa3173d746..f28e5529015 100644 --- a/src/test/ui/nll/reference-carried-through-struct-field.ast.nll.stderr +++ b/src/test/ui/nll/reference-carried-through-struct-field.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/reference-carried-through-struct-field.rs:21:5 + --> $DIR/reference-carried-through-struct-field.rs:11:5 | LL | let wrapper = Wrap { w: &mut x }; | ------ borrow of `x` occurs here diff --git a/src/test/ui/nll/reference-carried-through-struct-field.ast.stderr b/src/test/ui/nll/reference-carried-through-struct-field.ast.stderr index c1022d66070..b19d0b5277c 100644 --- a/src/test/ui/nll/reference-carried-through-struct-field.ast.stderr +++ b/src/test/ui/nll/reference-carried-through-struct-field.ast.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/reference-carried-through-struct-field.rs:21:5 + --> $DIR/reference-carried-through-struct-field.rs:11:5 | LL | let wrapper = Wrap { w: &mut x }; | - borrow of `x` occurs here diff --git a/src/test/ui/nll/reference-carried-through-struct-field.mir.stderr b/src/test/ui/nll/reference-carried-through-struct-field.mir.stderr index caa3173d746..f28e5529015 100644 --- a/src/test/ui/nll/reference-carried-through-struct-field.mir.stderr +++ b/src/test/ui/nll/reference-carried-through-struct-field.mir.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/reference-carried-through-struct-field.rs:21:5 + --> $DIR/reference-carried-through-struct-field.rs:11:5 | LL | let wrapper = Wrap { w: &mut x }; | ------ borrow of `x` occurs here diff --git a/src/test/ui/nll/reference-carried-through-struct-field.rs b/src/test/ui/nll/reference-carried-through-struct-field.rs index 589a3daa38d..f7903cba6a2 100644 --- a/src/test/ui/nll/reference-carried-through-struct-field.rs +++ b/src/test/ui/nll/reference-carried-through-struct-field.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //revisions: ast mir //[mir] compile-flags: -Z borrowck=mir diff --git a/src/test/ui/nll/region-ends-after-if-condition.nll.stderr b/src/test/ui/nll/region-ends-after-if-condition.nll.stderr index c1bfa4bffc0..ab8d96d4e99 100644 --- a/src/test/ui/nll/region-ends-after-if-condition.nll.stderr +++ b/src/test/ui/nll/region-ends-after-if-condition.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Ast) - --> $DIR/region-ends-after-if-condition.rs:29:9 + --> $DIR/region-ends-after-if-condition.rs:19:9 | LL | let value = &my_struct.field; | --------------- immutable borrow occurs here @@ -11,7 +11,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Ast) - --> $DIR/region-ends-after-if-condition.rs:39:9 + --> $DIR/region-ends-after-if-condition.rs:29:9 | LL | let value = &my_struct.field; | --------------- immutable borrow occurs here @@ -23,7 +23,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Mir) - --> $DIR/region-ends-after-if-condition.rs:39:9 + --> $DIR/region-ends-after-if-condition.rs:29:9 | LL | let value = &my_struct.field; | ---------------- immutable borrow occurs here diff --git a/src/test/ui/nll/region-ends-after-if-condition.rs b/src/test/ui/nll/region-ends-after-if-condition.rs index e1c47a6bbff..1bf13a91b91 100644 --- a/src/test/ui/nll/region-ends-after-if-condition.rs +++ b/src/test/ui/nll/region-ends-after-if-condition.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for liveness constraints: the region (`R1`) that appears // in the type of `p` includes the points after `&v[0]` up to (but not // including) the call to `use_x`. The `else` branch is not included. diff --git a/src/test/ui/nll/region-ends-after-if-condition.stderr b/src/test/ui/nll/region-ends-after-if-condition.stderr index eaa5e815de8..aa876a0bcb3 100644 --- a/src/test/ui/nll/region-ends-after-if-condition.stderr +++ b/src/test/ui/nll/region-ends-after-if-condition.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Ast) - --> $DIR/region-ends-after-if-condition.rs:29:9 + --> $DIR/region-ends-after-if-condition.rs:19:9 | LL | let value = &my_struct.field; | --------------- immutable borrow occurs here @@ -11,7 +11,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Ast) - --> $DIR/region-ends-after-if-condition.rs:39:9 + --> $DIR/region-ends-after-if-condition.rs:29:9 | LL | let value = &my_struct.field; | --------------- immutable borrow occurs here @@ -23,7 +23,7 @@ LL | } | - immutable borrow ends here error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Mir) - --> $DIR/region-ends-after-if-condition.rs:39:9 + --> $DIR/region-ends-after-if-condition.rs:29:9 | LL | let value = &my_struct.field; | ---------------- immutable borrow occurs here diff --git a/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.rs b/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.rs index dd1c2a44730..fca69b83efe 100644 --- a/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.rs +++ b/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the NLL `relate_tys` code correctly deduces that a // function returning either argument CANNOT be upcast to one // that returns always its first argument. diff --git a/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr b/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr index a4d47eed6fb..7906dbd37ef 100644 --- a/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr +++ b/src/test/ui/nll/relate_tys/hr-fn-aaa-as-aba.stderr @@ -1,11 +1,11 @@ error: higher-ranked subtype error - --> $DIR/hr-fn-aaa-as-aba.rs:24:58 + --> $DIR/hr-fn-aaa-as-aba.rs:14:58 | LL | let a: for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 = make_it(); | ^^^^^^^^^ error: higher-ranked subtype error - --> $DIR/hr-fn-aaa-as-aba.rs:32:12 + --> $DIR/hr-fn-aaa-as-aba.rs:22:12 | LL | let _: for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 = make_it(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs b/src/test/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs index bc7b031f72c..23caa59b6b7 100644 --- a/src/test/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs +++ b/src/test/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test an interesting corner case that ought to be legal (though the // current code actually gets it wrong, see below): a fn that takes // two arguments that are references with the same lifetime is in fact diff --git a/src/test/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs b/src/test/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs index 4f73ca3a539..bac9e26588c 100644 --- a/src/test/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs +++ b/src/test/ui/nll/relate_tys/hr-fn-aba-as-aaa.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the NLL `relate_tys` code correctly deduces that a // function returning always its first argument can be upcast to one // that returns either first or second argument. diff --git a/src/test/ui/nll/relate_tys/issue-48071.rs b/src/test/ui/nll/relate_tys/issue-48071.rs index c2498cbe50f..9b8ac167466 100644 --- a/src/test/ui/nll/relate_tys/issue-48071.rs +++ b/src/test/ui/nll/relate_tys/issue-48071.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #48071. This test used to ICE because -- in // the leak-check -- it would pass since we knew that the return type // was `'static`, and hence `'static: 'a` was legal even for a diff --git a/src/test/ui/nll/relate_tys/universe-violation.rs b/src/test/ui/nll/relate_tys/universe-violation.rs index cc86c8d02d3..d29f8f8af20 100644 --- a/src/test/ui/nll/relate_tys/universe-violation.rs +++ b/src/test/ui/nll/relate_tys/universe-violation.rs @@ -12,6 +12,6 @@ fn make_it() -> fn(&'static u32) -> &'static u32 { fn main() { let a: fn(_) -> _ = make_it(); - let b: fn(&u32) -> &u32 = a; + let b: fn(&u32) -> &u32 = a; //~ ERROR higher-ranked subtype error drop(a); } diff --git a/src/test/ui/nll/relate_tys/universe-violation.stderr b/src/test/ui/nll/relate_tys/universe-violation.stderr index 6dc78789564..0a2e0ed7b2d 100644 --- a/src/test/ui/nll/relate_tys/universe-violation.stderr +++ b/src/test/ui/nll/relate_tys/universe-violation.stderr @@ -1,7 +1,7 @@ error: higher-ranked subtype error --> $DIR/universe-violation.rs:15:31 | -LL | let b: fn(&u32) -> &u32 = a; +LL | let b: fn(&u32) -> &u32 = a; //~ ERROR higher-ranked subtype error | ^ error: aborting due to previous error diff --git a/src/test/ui/nll/relate_tys/var-appears-twice.rs b/src/test/ui/nll/relate_tys/var-appears-twice.rs index 02b3006c531..2f227c87259 100644 --- a/src/test/ui/nll/relate_tys/var-appears-twice.rs +++ b/src/test/ui/nll/relate_tys/var-appears-twice.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the NLL `relate_tys` code correctly deduces that a // function returning always its first argument can be upcast to one // that returns either first or second argument. diff --git a/src/test/ui/nll/relate_tys/var-appears-twice.stderr b/src/test/ui/nll/relate_tys/var-appears-twice.stderr index 9a46f8d7e92..da693045576 100644 --- a/src/test/ui/nll/relate_tys/var-appears-twice.stderr +++ b/src/test/ui/nll/relate_tys/var-appears-twice.stderr @@ -1,5 +1,5 @@ error[E0597]: `b` does not live long enough - --> $DIR/var-appears-twice.rs:33:38 + --> $DIR/var-appears-twice.rs:23:38 | LL | let x: DoubleCell<_> = make_cell(&b); //~ ERROR | ------------- ^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/return-ref-mut-issue-46557.rs b/src/test/ui/nll/return-ref-mut-issue-46557.rs index a1feadfb0d1..b535ab1f5e1 100644 --- a/src/test/ui/nll/return-ref-mut-issue-46557.rs +++ b/src/test/ui/nll/return-ref-mut-issue-46557.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #46557 #![feature(nll)] diff --git a/src/test/ui/nll/return-ref-mut-issue-46557.stderr b/src/test/ui/nll/return-ref-mut-issue-46557.stderr index 4b74aa042f7..7603d8b5bb5 100644 --- a/src/test/ui/nll/return-ref-mut-issue-46557.stderr +++ b/src/test/ui/nll/return-ref-mut-issue-46557.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing temporary value - --> $DIR/return-ref-mut-issue-46557.rs:18:5 + --> $DIR/return-ref-mut-issue-46557.rs:8:5 | LL | let ref mut x = 1234543; | ------- temporary value created here diff --git a/src/test/ui/nll/return_from_loop.rs b/src/test/ui/nll/return_from_loop.rs index 13f1ca6431b..23a1e0b816c 100644 --- a/src/test/ui/nll/return_from_loop.rs +++ b/src/test/ui/nll/return_from_loop.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Basic test for liveness constraints: the region (`R1`) that appears // in the type of `p` includes the points after `&v[0]` up to (but not // including) the call to `use_x`. The `else` branch is not included. diff --git a/src/test/ui/nll/return_from_loop.stderr b/src/test/ui/nll/return_from_loop.stderr index d631bb58af6..09882d55cb7 100644 --- a/src/test/ui/nll/return_from_loop.stderr +++ b/src/test/ui/nll/return_from_loop.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `my_struct.field` as mutable more than once at a time (Ast) - --> $DIR/return_from_loop.rs:32:9 + --> $DIR/return_from_loop.rs:22:9 | LL | let value = &mut my_struct.field; | --------------- first mutable borrow occurs here @@ -11,7 +11,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `my_struct.field` as mutable more than once at a time (Ast) - --> $DIR/return_from_loop.rs:45:9 + --> $DIR/return_from_loop.rs:35:9 | LL | let value = &mut my_struct.field; | --------------- first mutable borrow occurs here @@ -23,7 +23,7 @@ LL | } | - first borrow ends here error[E0499]: cannot borrow `my_struct.field` as mutable more than once at a time (Mir) - --> $DIR/return_from_loop.rs:32:9 + --> $DIR/return_from_loop.rs:22:9 | LL | let value = &mut my_struct.field; | -------------------- first mutable borrow occurs here diff --git a/src/test/ui/nll/trait-associated-constant.rs b/src/test/ui/nll/trait-associated-constant.rs index b0f5fbf7160..9d3e1a690f0 100644 --- a/src/test/ui/nll/trait-associated-constant.rs +++ b/src/test/ui/nll/trait-associated-constant.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test cases where we put various lifetime constraints on trait // associated constants. diff --git a/src/test/ui/nll/trait-associated-constant.stderr b/src/test/ui/nll/trait-associated-constant.stderr index 07972ecced3..78ef513f3ee 100644 --- a/src/test/ui/nll/trait-associated-constant.stderr +++ b/src/test/ui/nll/trait-associated-constant.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched types - --> $DIR/trait-associated-constant.rs:31:5 + --> $DIR/trait-associated-constant.rs:21:5 | LL | const AC: Option<&'c str> = None; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `std::option::Option<&'b str>` found type `std::option::Option<&'c str>` -note: the lifetime 'c as defined on the impl at 30:18... - --> $DIR/trait-associated-constant.rs:30:18 +note: the lifetime 'c as defined on the impl at 20:18... + --> $DIR/trait-associated-constant.rs:20:18 | LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 { | ^^ -note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 30:14 - --> $DIR/trait-associated-constant.rs:30:14 +note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 20:14 + --> $DIR/trait-associated-constant.rs:20:14 | LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 { | ^^ error[E0308]: mismatched types - --> $DIR/trait-associated-constant.rs:38:5 + --> $DIR/trait-associated-constant.rs:28:5 | LL | const AC: Option<&'a str> = None; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `std::option::Option<&'b str>` found type `std::option::Option<&'a str>` -note: the lifetime 'a as defined on the impl at 37:6... - --> $DIR/trait-associated-constant.rs:37:6 +note: the lifetime 'a as defined on the impl at 27:6... + --> $DIR/trait-associated-constant.rs:27:6 | LL | impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 { | ^^ -note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 37:14 - --> $DIR/trait-associated-constant.rs:37:14 +note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 27:14 + --> $DIR/trait-associated-constant.rs:27:14 | LL | impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 { | ^^ diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.rs b/src/test/ui/nll/ty-outlives/impl-trait-captures.rs index 3d9b1944845..7405505d5d6 100644 --- a/src/test/ui/nll/ty-outlives/impl-trait-captures.rs +++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zborrowck=mir -Zverbose #![allow(warnings)] diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr index 7cf24a19677..d9481b6156c 100644 --- a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/impl-trait-captures.rs:21:5 + --> $DIR/impl-trait-captures.rs:11:5 | LL | x | ^ lifetime `ReEarlyBound(0, 'a)` required diff --git a/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs b/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs index 64eb7353638..0c7d8acb052 100644 --- a/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs +++ b/src/test/ui/nll/ty-outlives/impl-trait-outlives.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zborrowck=mir -Zverbose #![allow(warnings)] diff --git a/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr b/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr index 61d2d2d6d82..32a494c5d16 100644 --- a/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr +++ b/src/test/ui/nll/ty-outlives/impl-trait-outlives.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/impl-trait-outlives.rs:17:35 + --> $DIR/impl-trait-outlives.rs:7:35 | LL | fn no_region<'a, T>(x: Box) -> impl Debug + 'a | ^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | fn no_region<'a, T>(x: Box) -> impl Debug + 'a = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`... error[E0309]: the parameter type `T` may not live long enough - --> $DIR/impl-trait-outlives.rs:32:42 + --> $DIR/impl-trait-outlives.rs:22:42 | LL | fn wrong_region<'a, 'b, T>(x: Box) -> impl Debug + 'a | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/ty-outlives/projection-implied-bounds.rs b/src/test/ui/nll/ty-outlives/projection-implied-bounds.rs index 1509ac8abd9..1245ce8583e 100644 --- a/src/test/ui/nll/ty-outlives/projection-implied-bounds.rs +++ b/src/test/ui/nll/ty-outlives/projection-implied-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zborrowck=mir -Zverbose // Test that we can deduce when projections like `T::Item` outlive the diff --git a/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr b/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr index 17de9f79e32..9cdb78a1028 100644 --- a/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr +++ b/src/test/ui/nll/ty-outlives/projection-implied-bounds.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/projection-implied-bounds.rs:45:18 + --> $DIR/projection-implied-bounds.rs:35:18 | LL | twice(value, |value_ref, item| invoke2(value_ref, item)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs index d61bbf27809..20af0fbdc8e 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zborrowck=mir -Zverbose // Tests closures that propagate an outlives relationship to their diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 9b7fe466696..fc7a4570a18 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/projection-no-regions-closure.rs:35:23 + --> $DIR/projection-no-regions-closure.rs:25:23 | LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) = note: where ::Item: '_#2r note: No external requirements - --> $DIR/projection-no-regions-closure.rs:31:1 + --> $DIR/projection-no-regions-closure.rs:21:1 | LL | / fn no_region<'a, T>(x: Box) -> Box LL | | where @@ -31,7 +31,7 @@ LL | | } ] error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/projection-no-regions-closure.rs:35:23 + --> $DIR/projection-no-regions-closure.rs:25:23 | LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) = help: consider adding an explicit lifetime bound `::Item: ReEarlyBound(0, 'a)`... note: External requirements - --> $DIR/projection-no-regions-closure.rs:44:23 + --> $DIR/projection-no-regions-closure.rs:34:23 | LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,7 +54,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) = note: where ::Item: '_#2r note: No external requirements - --> $DIR/projection-no-regions-closure.rs:40:1 + --> $DIR/projection-no-regions-closure.rs:30:1 | LL | / fn correct_region<'a, T>(x: Box) -> Box LL | | where @@ -70,7 +70,7 @@ LL | | } ] note: External requirements - --> $DIR/projection-no-regions-closure.rs:52:23 + --> $DIR/projection-no-regions-closure.rs:42:23 | LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -86,7 +86,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) = note: where ::Item: '_#3r note: No external requirements - --> $DIR/projection-no-regions-closure.rs:48:1 + --> $DIR/projection-no-regions-closure.rs:38:1 | LL | / fn wrong_region<'a, 'b, T>(x: Box) -> Box LL | | where @@ -104,7 +104,7 @@ LL | | } ] error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/projection-no-regions-closure.rs:52:23 + --> $DIR/projection-no-regions-closure.rs:42:23 | LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -112,7 +112,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) = help: consider adding an explicit lifetime bound `::Item: ReEarlyBound(0, 'a)`... note: External requirements - --> $DIR/projection-no-regions-closure.rs:62:23 + --> $DIR/projection-no-regions-closure.rs:52:23 | LL | with_signature(x, |mut y| Box::new(y.next())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -128,7 +128,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) = note: where ::Item: '_#3r note: No external requirements - --> $DIR/projection-no-regions-closure.rs:57:1 + --> $DIR/projection-no-regions-closure.rs:47:1 | LL | / fn outlives_region<'a, 'b, T>(x: Box) -> Box LL | | where diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs index 286aa6ca6e0..64073bec8ae 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zborrowck=mir -Zverbose #![allow(warnings)] diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr index 5f365557ae2..190a2cdfc07 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-fn.stderr @@ -1,5 +1,5 @@ error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/projection-no-regions-fn.rs:23:5 + --> $DIR/projection-no-regions-fn.rs:13:5 | LL | Box::new(x.next()) | ^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | Box::new(x.next()) = help: consider adding an explicit lifetime bound `::Item: ReEarlyBound(0, 'a)`... error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/projection-no-regions-fn.rs:38:5 + --> $DIR/projection-no-regions-fn.rs:28:5 | LL | Box::new(x.next()) | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs index 6667457e13b..17d5f2e1aea 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test cases where we constrain `>::AssocType` to // outlive `'a` and there are no bounds in the trait definition of // `Anything`. This means that the constraint can only be satisfied in two diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr index dc7f58fc8f8..e8283d1ab5d 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/projection-one-region-closure.rs:55:29 + --> $DIR/projection-one-region-closure.rs:45:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where '_#1r: '_#2r note: No external requirements - --> $DIR/projection-one-region-closure.rs:51:1 + --> $DIR/projection-one-region-closure.rs:41:1 | LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -33,15 +33,15 @@ LL | | } ] error[E0309]: the parameter type `T` may not live long enough - --> $DIR/projection-one-region-closure.rs:55:29 + --> $DIR/projection-one-region-closure.rs:45:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:8 ~ projection_one_region_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:16), 'a))`... -error: unsatisfied lifetime constraints - --> $DIR/projection-one-region-closure.rs:55:39 +error: lifetime may not live long enough + --> $DIR/projection-one-region-closure.rs:45:39 | LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) | -- -- lifetime `'b` defined here @@ -52,7 +52,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` note: External requirements - --> $DIR/projection-one-region-closure.rs:66:29 + --> $DIR/projection-one-region-closure.rs:56:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where '_#2r: '_#3r note: No external requirements - --> $DIR/projection-one-region-closure.rs:61:1 + --> $DIR/projection-one-region-closure.rs:51:1 | LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -87,15 +87,15 @@ LL | | } ] error[E0309]: the parameter type `T` may not live long enough - --> $DIR/projection-one-region-closure.rs:66:29 + --> $DIR/projection-one-region-closure.rs:56:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`... -error: unsatisfied lifetime constraints - --> $DIR/projection-one-region-closure.rs:66:39 +error: lifetime may not live long enough + --> $DIR/projection-one-region-closure.rs:56:39 | LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) | -- -- lifetime `'b` defined here @@ -106,7 +106,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` note: External requirements - --> $DIR/projection-one-region-closure.rs:80:29 + --> $DIR/projection-one-region-closure.rs:70:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -122,7 +122,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where >::AssocType: '_#3r note: No external requirements - --> $DIR/projection-one-region-closure.rs:72:1 + --> $DIR/projection-one-region-closure.rs:62:1 | LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -140,7 +140,7 @@ LL | | } ] note: External requirements - --> $DIR/projection-one-region-closure.rs:90:29 + --> $DIR/projection-one-region-closure.rs:80:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -157,7 +157,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where '_#2r: '_#3r note: No external requirements - --> $DIR/projection-one-region-closure.rs:84:1 + --> $DIR/projection-one-region-closure.rs:74:1 | LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs index a94d8239fbe..8df0700c58c 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test cases where we constrain `>::AssocType` to // outlive `'a` and there is a unique bound in the trait definition of // `Anything` -- i.e., we know that `AssocType` outlives `'b`. In this diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 18d35d8b9bf..78a8c803dd9 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:47:29 + --> $DIR/projection-one-region-trait-bound-closure.rs:37:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where '_#1r: '_#2r note: No external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:43:1 + --> $DIR/projection-one-region-trait-bound-closure.rs:33:1 | LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -31,8 +31,8 @@ LL | | } T ] -error: unsatisfied lifetime constraints - --> $DIR/projection-one-region-trait-bound-closure.rs:47:39 +error: lifetime may not live long enough + --> $DIR/projection-one-region-trait-bound-closure.rs:37:39 | LL | fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) | -- -- lifetime `'b` defined here @@ -43,7 +43,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` note: External requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:57:29 + --> $DIR/projection-one-region-trait-bound-closure.rs:47:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where '_#2r: '_#3r note: No external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:52:1 + --> $DIR/projection-one-region-trait-bound-closure.rs:42:1 | LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -76,8 +76,8 @@ LL | | } T ] -error: unsatisfied lifetime constraints - --> $DIR/projection-one-region-trait-bound-closure.rs:57:39 +error: lifetime may not live long enough + --> $DIR/projection-one-region-trait-bound-closure.rs:47:39 | LL | fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) | -- -- lifetime `'b` defined here @@ -88,7 +88,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a` note: External requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:70:29 + --> $DIR/projection-one-region-trait-bound-closure.rs:60:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -104,7 +104,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where >::AssocType: '_#3r note: No external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:62:1 + --> $DIR/projection-one-region-trait-bound-closure.rs:52:1 | LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -122,7 +122,7 @@ LL | | } ] note: External requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:79:29 + --> $DIR/projection-one-region-trait-bound-closure.rs:69:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -138,7 +138,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where '_#2r: '_#3r note: No external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:74:1 + --> $DIR/projection-one-region-trait-bound-closure.rs:64:1 | LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -156,7 +156,7 @@ LL | | } ] note: External requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:91:29 + --> $DIR/projection-one-region-trait-bound-closure.rs:81:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -171,7 +171,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where '_#1r: '_#2r note: No external requirements - --> $DIR/projection-one-region-trait-bound-closure.rs:83:1 + --> $DIR/projection-one-region-trait-bound-closure.rs:73:1 | LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) LL | | where diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs index 1f2f40196f8..452a8ea4f85 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test cases where we constrain `>::AssocType` to // outlive `'static`. In this case, we don't get any errors, and in fact // we don't even propagate constraints from the closures to the callers. diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr index 3f8ed324f56..61f8132cf49 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-static-closure.stderr @@ -1,5 +1,5 @@ note: No external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:46:29 + --> $DIR/projection-one-region-trait-bound-static-closure.rs:36:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: late-bound region is '_#3r note: No external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:42:1 + --> $DIR/projection-one-region-trait-bound-static-closure.rs:32:1 | LL | / fn no_relationships_late<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -29,7 +29,7 @@ LL | | } ] note: No external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:55:29 + --> $DIR/projection-one-region-trait-bound-static-closure.rs:45:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -43,7 +43,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); ] note: No external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:50:1 + --> $DIR/projection-one-region-trait-bound-static-closure.rs:40:1 | LL | / fn no_relationships_early<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -61,7 +61,7 @@ LL | | } ] note: No external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:74:29 + --> $DIR/projection-one-region-trait-bound-static-closure.rs:64:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -75,7 +75,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); ] note: No external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:59:1 + --> $DIR/projection-one-region-trait-bound-static-closure.rs:49:1 | LL | / fn projection_outlives<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -93,7 +93,7 @@ LL | | } ] note: No external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:83:29 + --> $DIR/projection-one-region-trait-bound-static-closure.rs:73:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -107,7 +107,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); ] note: No external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:78:1 + --> $DIR/projection-one-region-trait-bound-static-closure.rs:68:1 | LL | / fn elements_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -125,7 +125,7 @@ LL | | } ] note: No external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:95:29 + --> $DIR/projection-one-region-trait-bound-static-closure.rs:85:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -138,7 +138,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); ] note: No external requirements - --> $DIR/projection-one-region-trait-bound-static-closure.rs:87:1 + --> $DIR/projection-one-region-trait-bound-static-closure.rs:77:1 | LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) LL | | where diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs index 95c344e6dff..20edfb33931 100644 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test cases where we constrain `>::AssocType` // to outlive `'a` and there are two bounds in the trait definition of // `Anything` -- i.e., we know that `AssocType` outlives `'a` and @@ -95,7 +85,7 @@ where T: Anything<'b, 'b>, { with_signature(cell, t, |cell, t| require(cell, t)); - //~^ ERROR unsatisfied lifetime constraints + //~^ ERROR lifetime may not live long enough } #[rustc_regions] diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index f872c87b0bb..d8725dc4284 100644 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 + --> $DIR/projection-two-region-trait-bound-closure.rs:38:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,7 +16,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where >::AssocType: '_#3r note: No external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:44:1 + --> $DIR/projection-two-region-trait-bound-closure.rs:34:1 | LL | / fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -34,7 +34,7 @@ LL | | } ] error[E0309]: the associated type `>::AssocType` may not live long enough - --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 + --> $DIR/projection-two-region-trait-bound-closure.rs:38:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -42,7 +42,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = help: consider adding an explicit lifetime bound `>::AssocType: ReFree(DefId(0/0:8 ~ projection_two_region_trait_bound_closure[317d]::no_relationships_late[0]), BrNamed(crate0:DefIndex(1:18), 'a))`... note: External requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:58:29 + --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where >::AssocType: '_#4r note: No external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:53:1 + --> $DIR/projection-two-region-trait-bound-closure.rs:43:1 | LL | / fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -78,7 +78,7 @@ LL | | } ] error[E0309]: the associated type `>::AssocType` may not live long enough - --> $DIR/projection-two-region-trait-bound-closure.rs:58:29 + --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -86,7 +86,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = help: consider adding an explicit lifetime bound `>::AssocType: ReEarlyBound(0, 'a)`... note: External requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:71:29 + --> $DIR/projection-two-region-trait-bound-closure.rs:61:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where >::AssocType: '_#4r note: No external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:63:1 + --> $DIR/projection-two-region-trait-bound-closure.rs:53:1 | LL | / fn projection_outlives<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -122,7 +122,7 @@ LL | | } ] note: External requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:80:29 + --> $DIR/projection-two-region-trait-bound-closure.rs:70:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -139,7 +139,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where >::AssocType: '_#4r note: No external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:75:1 + --> $DIR/projection-two-region-trait-bound-closure.rs:65:1 | LL | / fn elements_outlive1<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -158,7 +158,7 @@ LL | | } ] note: External requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:89:29 + --> $DIR/projection-two-region-trait-bound-closure.rs:79:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -175,7 +175,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where >::AssocType: '_#4r note: No external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:84:1 + --> $DIR/projection-two-region-trait-bound-closure.rs:74:1 | LL | / fn elements_outlive2<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -194,7 +194,7 @@ LL | | } ] note: External requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:97:29 + --> $DIR/projection-two-region-trait-bound-closure.rs:87:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -210,14 +210,14 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where >::AssocType: '_#2r note: No external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:93:1 + --> $DIR/projection-two-region-trait-bound-closure.rs:83:1 | LL | / fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where LL | | T: Anything<'b, 'b>, LL | | { LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | //~^ ERROR unsatisfied lifetime constraints +LL | | //~^ ERROR lifetime may not live long enough LL | | } | |_^ | @@ -226,8 +226,8 @@ LL | | } T ] -error: unsatisfied lifetime constraints - --> $DIR/projection-two-region-trait-bound-closure.rs:97:29 +error: lifetime may not live long enough + --> $DIR/projection-two-region-trait-bound-closure.rs:87:29 | LL | fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T) | -- -- lifetime `'b` defined here @@ -238,7 +238,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ closure body requires that `'b` must outlive `'a` note: External requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:107:29 + --> $DIR/projection-two-region-trait-bound-closure.rs:97:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -254,7 +254,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where >::AssocType: '_#3r note: No external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:102:1 + --> $DIR/projection-two-region-trait-bound-closure.rs:92:1 | LL | / fn two_regions_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T) LL | | where @@ -272,7 +272,7 @@ LL | | } ] note: External requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:119:29 + --> $DIR/projection-two-region-trait-bound-closure.rs:109:29 | LL | with_signature(cell, t, |cell, t| require(cell, t)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -287,7 +287,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); = note: where >::AssocType: '_#2r note: No external requirements - --> $DIR/projection-two-region-trait-bound-closure.rs:111:1 + --> $DIR/projection-two-region-trait-bound-closure.rs:101:1 | LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T) LL | | where diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr index acb978b5d5a..597b096dbe6 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr @@ -2,7 +2,7 @@ error[E0309]: the associated type `>::Output` may not live long --> $DIR/projection-where-clause-env-wrong-bound.rs:17:5 | LL | bar::() //~ ERROR may not live long enough - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `>::Output: 'a`... diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr index 2d171a98789..3c2ac474778 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr @@ -2,7 +2,7 @@ error[E0309]: the parameter type `T` may not live long enough --> $DIR/projection-where-clause-none.rs:16:5 | LL | bar::() //~ ERROR the parameter type `T` may not live long enough - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `T: 'a`... diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs index ec6914f2630..fd36e7573ff 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zborrowck=mir -Zverbose #![allow(warnings)] diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr index 106eaa6a3ab..24bd97f0469 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/ty-param-closure-approximate-lower-bound.rs:34:24 + --> $DIR/ty-param-closure-approximate-lower-bound.rs:24:24 | LL | twice(cell, value, |a, b| invoke(a, b)); | ^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | twice(cell, value, |a, b| invoke(a, b)); = note: where T: '_#1r note: No external requirements - --> $DIR/ty-param-closure-approximate-lower-bound.rs:32:1 + --> $DIR/ty-param-closure-approximate-lower-bound.rs:22:1 | LL | / fn generic(value: T) { LL | | let cell = Cell::new(&()); @@ -26,7 +26,7 @@ LL | | } ] note: External requirements - --> $DIR/ty-param-closure-approximate-lower-bound.rs:39:24 + --> $DIR/ty-param-closure-approximate-lower-bound.rs:29:24 | LL | twice(cell, value, |a, b| invoke(a, b)); | ^^^^^^^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ LL | twice(cell, value, |a, b| invoke(a, b)); = note: where T: '_#1r note: No external requirements - --> $DIR/ty-param-closure-approximate-lower-bound.rs:38:1 + --> $DIR/ty-param-closure-approximate-lower-bound.rs:28:1 | LL | / fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) { LL | | twice(cell, value, |a, b| invoke(a, b)); @@ -54,7 +54,7 @@ LL | | } ] error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-closure-approximate-lower-bound.rs:39:24 + --> $DIR/ty-param-closure-approximate-lower-bound.rs:29:24 | LL | twice(cell, value, |a, b| invoke(a, b)); | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs index cd47cc524d4..7fce771fc8b 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zborrowck=mir -Zverbose #![allow(warnings)] diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index 9e69ae05173..30c1dbc9027 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/ty-param-closure-outlives-from-return-type.rs:36:23 + --> $DIR/ty-param-closure-outlives-from-return-type.rs:26:23 | LL | with_signature(x, |y| y) | ^^^^^ @@ -14,7 +14,7 @@ LL | with_signature(x, |y| y) = note: where T: '_#2r note: No external requirements - --> $DIR/ty-param-closure-outlives-from-return-type.rs:25:1 + --> $DIR/ty-param-closure-outlives-from-return-type.rs:15:1 | LL | / fn no_region<'a, T>(x: Box) -> Box LL | | where @@ -31,7 +31,7 @@ LL | | } ] error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-closure-outlives-from-return-type.rs:36:23 + --> $DIR/ty-param-closure-outlives-from-return-type.rs:26:23 | LL | with_signature(x, |y| y) | ^^^^^ @@ -39,7 +39,7 @@ LL | with_signature(x, |y| y) = help: consider adding an explicit lifetime bound `T: ReEarlyBound(0, 'a)`... error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-closure-outlives-from-return-type.rs:51:5 + --> $DIR/ty-param-closure-outlives-from-return-type.rs:41:5 | LL | x | ^ diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs index aadf56e1fd0..c93172885bf 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can propagate `T: 'a` obligations to our caller. See // `correct_region` for an explanation of how this test is setup; it's // somewhat intricate. diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr index f0e86a580b2..a76a9463cc8 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr @@ -1,5 +1,5 @@ note: External requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:37:26 + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:27:26 | LL | with_signature(a, b, |x, y| { | __________________________^ @@ -21,7 +21,7 @@ LL | | }) = note: where T: '_#1r note: No external requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:36:1 + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:26:1 | LL | / fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { LL | | with_signature(a, b, |x, y| { @@ -37,7 +37,7 @@ LL | | } ] error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:37:26 + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:27:26 | LL | with_signature(a, b, |x, y| { | __________________________^ @@ -52,7 +52,7 @@ LL | | }) = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:6 ~ ty_param_closure_outlives_from_where_clause[317d]::no_region[0]), BrNamed(crate0:DefIndex(1:14), 'a))`... note: External requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:53:26 + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:43:26 | LL | with_signature(a, b, |x, y| { | __________________________^ @@ -74,7 +74,7 @@ LL | | }) = note: where T: '_#2r note: No external requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:49:1 + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:39:1 | LL | / fn correct_region<'a, T>(a: Cell<&'a ()>, b: T) LL | | where @@ -91,7 +91,7 @@ LL | | } ] note: External requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:74:26 + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:64:26 | LL | with_signature(a, b, |x, y| { | __________________________^ @@ -112,7 +112,7 @@ LL | | }) = note: where T: '_#2r note: No external requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:70:1 + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:60:1 | LL | / fn wrong_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) LL | | where @@ -129,7 +129,7 @@ LL | | } ] error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:74:26 + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:64:26 | LL | with_signature(a, b, |x, y| { | __________________________^ @@ -142,7 +142,7 @@ LL | | }) = help: consider adding an explicit lifetime bound `T: ReFree(DefId(0/0:8 ~ ty_param_closure_outlives_from_where_clause[317d]::wrong_region[0]), BrNamed(crate0:DefIndex(1:20), 'a))`... note: External requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:87:26 + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:77:26 | LL | with_signature(a, b, |x, y| { | __________________________^ @@ -162,7 +162,7 @@ LL | | }) = note: where T: '_#3r note: No external requirements - --> $DIR/ty-param-closure-outlives-from-where-clause.rs:82:1 + --> $DIR/ty-param-closure-outlives-from-where-clause.rs:72:1 | LL | / fn outlives_region<'a, 'b, T>(a: Cell<&'a ()>, b: T) LL | | where diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs index c0c483b3957..ec559437570 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs +++ b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we assume that universal types like `T` outlive the // function body. Same as ty-param-fn-body, but uses `feature(nll)`, // which affects error reporting. diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr index dec15f47a03..b3c02f7f429 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-fn-body-nll-feature.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-fn-body-nll-feature.rs:30:5 + --> $DIR/ty-param-fn-body-nll-feature.rs:20:5 | LL | outlives(cell, t) | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs b/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs index 10709327684..ec94258af4a 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs +++ b/src/test/ui/nll/ty-outlives/ty-param-fn-body.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zborrowck=mir // Test that we assume that universal types like `T` outlive the diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr b/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr index d6caae090a4..9a023a0e58e 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-fn-body.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-fn-body.rs:29:5 + --> $DIR/ty-param-fn-body.rs:19:5 | LL | outlives(cell, t) | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn.rs b/src/test/ui/nll/ty-outlives/ty-param-fn.rs index 1e49f7e5b19..a8d229fee51 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-fn.rs +++ b/src/test/ui/nll/ty-outlives/ty-param-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zborrowck=mir #![allow(warnings)] diff --git a/src/test/ui/nll/ty-outlives/ty-param-fn.stderr b/src/test/ui/nll/ty-outlives/ty-param-fn.stderr index 7f137dcf05c..8c8529620d5 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-fn.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-fn.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-fn.rs:21:5 + --> $DIR/ty-param-fn.rs:11:5 | LL | x | ^ @@ -7,7 +7,7 @@ LL | x = help: consider adding an explicit lifetime bound `T: 'a`... error[E0309]: the parameter type `T` may not live long enough - --> $DIR/ty-param-fn.rs:36:5 + --> $DIR/ty-param-fn.rs:26:5 | LL | x | ^ diff --git a/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs b/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs index 51927d353ec..f61f54f80a7 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs +++ b/src/test/ui/nll/ty-outlives/ty-param-implied-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zborrowck=mir -Zverbose // compile-pass diff --git a/src/test/ui/nll/ty-outlives/wf-unreachable.rs b/src/test/ui/nll/ty-outlives/wf-unreachable.rs new file mode 100644 index 00000000000..a2e3ab41614 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/wf-unreachable.rs @@ -0,0 +1,54 @@ +// Test that we check that user type annotations are well-formed, even in dead +// code. + +#![feature(nll)] + +fn uninit<'a>() { + return; + let x: &'static &'a (); //~ ERROR lifetime may not live long enough +} + +fn var_type<'a>() { + return; + let x: &'static &'a () = &&(); //~ ERROR lifetime may not live long enough +} + +fn uninit_infer<'a>() { + let x: &'static &'a _; //~ ERROR lifetime may not live long enough + x = && (); +} + +fn infer<'a>() { + return; + let x: &'static &'a _ = &&(); //~ ERROR lifetime may not live long enough +} + +fn uninit_no_var<'a>() { + return; + let _: &'static &'a (); //~ ERROR lifetime may not live long enough +} + +fn no_var<'a>() { + return; + let _: &'static &'a () = &&(); //~ ERROR lifetime may not live long enough +} + +fn infer_no_var<'a>() { + return; + let _: &'static &'a _ = &&(); //~ ERROR lifetime may not live long enough +} + +trait X<'a, 'b> {} + +struct C<'a, 'b, T: X<'a, 'b>>(T, &'a (), &'b ()); + +impl X<'_, '_> for i32 {} +impl<'a> X<'a, 'a> for () {} + +// This type annotation is not well-formed because we substitute `()` for `_`. +fn required_substs<'a>() { + return; + let _: C<'static, 'a, _> = C((), &(), &()); //~ ERROR lifetime may not live long enough +} + +fn main() {} diff --git a/src/test/ui/nll/ty-outlives/wf-unreachable.stderr b/src/test/ui/nll/ty-outlives/wf-unreachable.stderr new file mode 100644 index 00000000000..14642a1e615 --- /dev/null +++ b/src/test/ui/nll/ty-outlives/wf-unreachable.stderr @@ -0,0 +1,73 @@ +error: lifetime may not live long enough + --> $DIR/wf-unreachable.rs:8:12 + | +LL | fn uninit<'a>() { + | -- lifetime `'a` defined here +LL | return; +LL | let x: &'static &'a (); //~ ERROR lifetime may not live long enough + | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/wf-unreachable.rs:13:12 + | +LL | fn var_type<'a>() { + | -- lifetime `'a` defined here +LL | return; +LL | let x: &'static &'a () = &&(); //~ ERROR lifetime may not live long enough + | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/wf-unreachable.rs:17:12 + | +LL | fn uninit_infer<'a>() { + | -- lifetime `'a` defined here +LL | let x: &'static &'a _; //~ ERROR lifetime may not live long enough + | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/wf-unreachable.rs:23:12 + | +LL | fn infer<'a>() { + | -- lifetime `'a` defined here +LL | return; +LL | let x: &'static &'a _ = &&(); //~ ERROR lifetime may not live long enough + | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/wf-unreachable.rs:28:12 + | +LL | fn uninit_no_var<'a>() { + | -- lifetime `'a` defined here +LL | return; +LL | let _: &'static &'a (); //~ ERROR lifetime may not live long enough + | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/wf-unreachable.rs:33:12 + | +LL | fn no_var<'a>() { + | -- lifetime `'a` defined here +LL | return; +LL | let _: &'static &'a () = &&(); //~ ERROR lifetime may not live long enough + | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/wf-unreachable.rs:38:12 + | +LL | fn infer_no_var<'a>() { + | -- lifetime `'a` defined here +LL | return; +LL | let _: &'static &'a _ = &&(); //~ ERROR lifetime may not live long enough + | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/wf-unreachable.rs:51:12 + | +LL | fn required_substs<'a>() { + | -- lifetime `'a` defined here +LL | return; +LL | let _: C<'static, 'a, _> = C((), &(), &()); //~ ERROR lifetime may not live long enough + | ^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` + +error: aborting due to 8 previous errors + diff --git a/src/test/ui/nll/type-alias-free-regions.rs b/src/test/ui/nll/type-alias-free-regions.rs index 6e480dcaac0..ebe6b9d2073 100644 --- a/src/test/ui/nll/type-alias-free-regions.rs +++ b/src/test/ui/nll/type-alias-free-regions.rs @@ -3,30 +3,30 @@ #![feature(nll)] -type a<'a> = &'a isize; -type b<'a> = Box>; +type A<'a> = &'a isize; +type B<'a> = Box>; -struct c<'a> { - f: Box> +struct C<'a> { + f: Box> } trait FromBox<'a> { - fn from_box(b: Box) -> Self; + fn from_box(b: Box) -> Self; } -impl<'a> FromBox<'a> for c<'a> { - fn from_box(b: Box) -> Self { - c { f: b } //~ ERROR +impl<'a> FromBox<'a> for C<'a> { + fn from_box(b: Box) -> Self { + C { f: b } //~ ERROR } } trait FromTuple<'a> { - fn from_tuple( b: (b,)) -> Self; + fn from_tuple( b: (B,)) -> Self; } -impl<'a> FromTuple<'a> for c<'a> { - fn from_tuple(b: (b,)) -> Self { - c { f: Box::new(b.0) } //~ ERROR +impl<'a> FromTuple<'a> for C<'a> { + fn from_tuple(b: (B,)) -> Self { + C { f: Box::new(b.0) } //~ ERROR } } diff --git a/src/test/ui/nll/type-alias-free-regions.stderr b/src/test/ui/nll/type-alias-free-regions.stderr index 05f2c930944..bcd141bb406 100644 --- a/src/test/ui/nll/type-alias-free-regions.stderr +++ b/src/test/ui/nll/type-alias-free-regions.stderr @@ -1,21 +1,21 @@ -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/type-alias-free-regions.rs:19:9 | -LL | impl<'a> FromBox<'a> for c<'a> { +LL | impl<'a> FromBox<'a> for C<'a> { | -- lifetime `'a` defined here -LL | fn from_box(b: Box) -> Self { +LL | fn from_box(b: Box) -> Self { | - has type `std::boxed::Box>` -LL | c { f: b } //~ ERROR +LL | C { f: b } //~ ERROR | ^^^^^^^^^^ returning this value requires that `'1` must outlive `'a` -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/type-alias-free-regions.rs:29:9 | -LL | impl<'a> FromTuple<'a> for c<'a> { +LL | impl<'a> FromTuple<'a> for C<'a> { | -- lifetime `'a` defined here -LL | fn from_tuple(b: (b,)) -> Self { +LL | fn from_tuple(b: (B,)) -> Self { | - has type `(std::boxed::Box<&'1 isize>,)` -LL | c { f: Box::new(b.0) } //~ ERROR +LL | C { f: Box::new(b.0) } //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'a` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/unused-mut-issue-50343.rs b/src/test/ui/nll/unused-mut-issue-50343.rs index e9110b8114b..06dbc473557 100644 --- a/src/test/ui/nll/unused-mut-issue-50343.rs +++ b/src/test/ui/nll/unused-mut-issue-50343.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #![deny(unused_mut)] diff --git a/src/test/ui/nll/unused-mut-issue-50343.stderr b/src/test/ui/nll/unused-mut-issue-50343.stderr index bfc67e213ec..ef31dd7b29a 100644 --- a/src/test/ui/nll/unused-mut-issue-50343.stderr +++ b/src/test/ui/nll/unused-mut-issue-50343.stderr @@ -1,5 +1,5 @@ error: variable does not need to be mutable - --> $DIR/unused-mut-issue-50343.rs:15:33 + --> $DIR/unused-mut-issue-50343.rs:5:33 | LL | vec![(42, 22)].iter().map(|(mut x, _y)| ()).count(); | ----^ @@ -7,7 +7,7 @@ LL | vec![(42, 22)].iter().map(|(mut x, _y)| ()).count(); | help: remove this `mut` | note: lint level defined here - --> $DIR/unused-mut-issue-50343.rs:12:9 + --> $DIR/unused-mut-issue-50343.rs:2:9 | LL | #![deny(unused_mut)] | ^^^^^^^^^^ diff --git a/src/test/ui/nll/user-annotations/adt-brace-enums.rs b/src/test/ui/nll/user-annotations/adt-brace-enums.rs index 4465be414bc..842ebae2618 100644 --- a/src/test/ui/nll/user-annotations/adt-brace-enums.rs +++ b/src/test/ui/nll/user-annotations/adt-brace-enums.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unit test for the "user substitutions" that are annotated on each // node. diff --git a/src/test/ui/nll/user-annotations/adt-brace-enums.stderr b/src/test/ui/nll/user-annotations/adt-brace-enums.stderr index 7a4a62a9fb2..fd1a4b96fe3 100644 --- a/src/test/ui/nll/user-annotations/adt-brace-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-brace-enums.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-enums.rs:37:48 + --> $DIR/adt-brace-enums.rs:27:48 | LL | SomeEnum::SomeVariant::<&'static u32> { t: &c }; //~ ERROR | ^^ @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-enums.rs:42:43 + --> $DIR/adt-brace-enums.rs:32:43 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-enums.rs:52:47 + --> $DIR/adt-brace-enums.rs:42:47 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/adt-brace-structs.rs b/src/test/ui/nll/user-annotations/adt-brace-structs.rs index c479e050564..d7ebbe8eb5f 100644 --- a/src/test/ui/nll/user-annotations/adt-brace-structs.rs +++ b/src/test/ui/nll/user-annotations/adt-brace-structs.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unit test for the "user substitutions" that are annotated on each // node. diff --git a/src/test/ui/nll/user-annotations/adt-brace-structs.stderr b/src/test/ui/nll/user-annotations/adt-brace-structs.stderr index 8b057a3eb8c..e614e00ac00 100644 --- a/src/test/ui/nll/user-annotations/adt-brace-structs.stderr +++ b/src/test/ui/nll/user-annotations/adt-brace-structs.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-structs.rs:35:37 + --> $DIR/adt-brace-structs.rs:25:37 | LL | SomeStruct::<&'static u32> { t: &c }; //~ ERROR | ^^ @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-structs.rs:40:32 + --> $DIR/adt-brace-structs.rs:30:32 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-brace-structs.rs:50:36 + --> $DIR/adt-brace-structs.rs:40:36 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/adt-nullary-enums.rs b/src/test/ui/nll/user-annotations/adt-nullary-enums.rs index df62b67a459..7a8f55a800b 100644 --- a/src/test/ui/nll/user-annotations/adt-nullary-enums.rs +++ b/src/test/ui/nll/user-annotations/adt-nullary-enums.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unit test for the "user substitutions" that are annotated on each // node. diff --git a/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr b/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr index 1626dc333a8..c72e56c619f 100644 --- a/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/adt-nullary-enums.rs:44:41 + --> $DIR/adt-nullary-enums.rs:34:41 | LL | SomeEnum::SomeVariant(Cell::new(&c)), //~ ERROR | ----------^^- @@ -11,7 +11,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-nullary-enums.rs:52:41 + --> $DIR/adt-nullary-enums.rs:42:41 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -26,7 +26,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-nullary-enums.rs:65:45 + --> $DIR/adt-nullary-enums.rs:55:45 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/adt-tuple-enums.rs b/src/test/ui/nll/user-annotations/adt-tuple-enums.rs index ae75a54f649..085596ecc53 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-enums.rs +++ b/src/test/ui/nll/user-annotations/adt-tuple-enums.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unit test for the "user substitutions" that are annotated on each // node. diff --git a/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr b/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr index 6e47eb1a3ed..dc5b5a0dd7f 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-enums.rs:39:43 + --> $DIR/adt-tuple-enums.rs:29:43 | LL | SomeEnum::SomeVariant::<&'static u32>(&c); //~ ERROR | ^^ @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-enums.rs:44:38 + --> $DIR/adt-tuple-enums.rs:34:38 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-enums.rs:54:42 + --> $DIR/adt-tuple-enums.rs:44:42 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/adt-tuple-struct.rs b/src/test/ui/nll/user-annotations/adt-tuple-struct.rs index 401a71c1fe5..ebbe3cd2c89 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-struct.rs +++ b/src/test/ui/nll/user-annotations/adt-tuple-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unit test for the "user substitutions" that are annotated on each // node. diff --git a/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr b/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr index 136c727550c..38acfcb4b61 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr +++ b/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct.rs:35:32 + --> $DIR/adt-tuple-struct.rs:25:32 | LL | SomeStruct::<&'static u32>(&c); //~ ERROR | ^^ @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct.rs:40:27 + --> $DIR/adt-tuple-struct.rs:30:27 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/adt-tuple-struct.rs:50:31 + --> $DIR/adt-tuple-struct.rs:40:31 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/cast_static_lifetime.rs b/src/test/ui/nll/user-annotations/cast_static_lifetime.rs index aa2cf85dfd9..4756c771f6e 100644 --- a/src/test/ui/nll/user-annotations/cast_static_lifetime.rs +++ b/src/test/ui/nll/user-annotations/cast_static_lifetime.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] #![feature(nll)] fn main() { let x = 22_u32; - let y: &u32 = (&x) as &'static u32; + let y: &u32 = (&x) as &'static u32; //~ ERROR `x` does not live long enough } diff --git a/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr b/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr index c664746437d..7e795ce17a8 100644 --- a/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr +++ b/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough - --> $DIR/cast_static_lifetime.rs:16:19 + --> $DIR/cast_static_lifetime.rs:6:19 | -LL | let y: &u32 = (&x) as &'static u32; +LL | let y: &u32 = (&x) as &'static u32; //~ ERROR `x` does not live long enough | ^^^^---------------- | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/closure-substs.rs b/src/test/ui/nll/user-annotations/closure-substs.rs index 77c7315fa66..cafdd9257fd 100644 --- a/src/test/ui/nll/user-annotations/closure-substs.rs +++ b/src/test/ui/nll/user-annotations/closure-substs.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] // Test that we enforce user-provided type annotations on closures. @@ -15,21 +5,21 @@ fn foo<'a>() { // Here `x` is free in the closure sig: |x: &'a i32| -> &'static i32 { - return x; //~ ERROR unsatisfied lifetime constraints + return x; //~ ERROR lifetime may not live long enough }; } fn foo1() { // Here `x` is bound in the closure sig: |x: &i32| -> &'static i32 { - return x; //~ ERROR unsatisfied lifetime constraints + return x; //~ ERROR lifetime may not live long enough }; } fn bar<'a>() { // Here `x` is free in the closure sig: |x: &'a i32, b: fn(&'static i32)| { - b(x); //~ ERROR unsatisfied lifetime constraints + b(x); //~ ERROR lifetime may not live long enough }; } @@ -40,4 +30,4 @@ fn bar1() { }; } -fn main() { } +fn main() {} diff --git a/src/test/ui/nll/user-annotations/closure-substs.stderr b/src/test/ui/nll/user-annotations/closure-substs.stderr index c69d514d9e6..a46ab61418e 100644 --- a/src/test/ui/nll/user-annotations/closure-substs.stderr +++ b/src/test/ui/nll/user-annotations/closure-substs.stderr @@ -1,31 +1,31 @@ -error: unsatisfied lifetime constraints - --> $DIR/closure-substs.rs:18:16 +error: lifetime may not live long enough + --> $DIR/closure-substs.rs:8:16 | LL | fn foo<'a>() { | -- lifetime `'a` defined here ... -LL | return x; //~ ERROR unsatisfied lifetime constraints +LL | return x; //~ ERROR lifetime may not live long enough | ^ returning this value requires that `'a` must outlive `'static` -error: unsatisfied lifetime constraints - --> $DIR/closure-substs.rs:25:16 +error: lifetime may not live long enough + --> $DIR/closure-substs.rs:15:16 | LL | |x: &i32| -> &'static i32 { | - let's call the lifetime of this reference `'1` -LL | return x; //~ ERROR unsatisfied lifetime constraints +LL | return x; //~ ERROR lifetime may not live long enough | ^ returning this value requires that `'1` must outlive `'static` -error: unsatisfied lifetime constraints - --> $DIR/closure-substs.rs:32:9 +error: lifetime may not live long enough + --> $DIR/closure-substs.rs:22:9 | LL | fn bar<'a>() { | -- lifetime `'a` defined here ... -LL | b(x); //~ ERROR unsatisfied lifetime constraints +LL | b(x); //~ ERROR lifetime may not live long enough | ^^^^ argument requires that `'a` must outlive `'static` error[E0521]: borrowed data escapes outside of closure - --> $DIR/closure-substs.rs:39:9 + --> $DIR/closure-substs.rs:29:9 | LL | |x: &i32, b: fn(&'static i32)| { | - `x` is a reference that is only valid in the closure body diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr index 94fbe017724..541a7113ec7 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr @@ -1,4 +1,4 @@ -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/constant-in-expr-inherent-1.rs:10:5 | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.rs b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.rs new file mode 100644 index 00000000000..123be6b3e40 --- /dev/null +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.rs @@ -0,0 +1,29 @@ +// Test that we still check constants are well-formed, even when we there's no +// type annotation to check. + +#![feature(nll)] + +const FUN: fn(&'static ()) = |_| {}; +struct A; +impl A { + const ASSOCIATED_FUN: fn(&'static ()) = |_| {}; +} + +struct B<'a>(&'a ()); +impl B<'static> { + const ALSO_ASSOCIATED_FUN: fn(&'static ()) = |_| {}; +} + +trait Z: 'static { + const TRAIT_ASSOCIATED_FUN: fn(&'static Self) = |_| (); +} + +impl Z for () {} + +fn main() { + let x = (); + FUN(&x); //~ ERROR `x` does not live long enough + A::ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough + B::ALSO_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough + <_>::TRAIT_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough +} diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr new file mode 100644 index 00000000000..57cfaa2db04 --- /dev/null +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr @@ -0,0 +1,50 @@ +error[E0597]: `x` does not live long enough + --> $DIR/constant-in-expr-inherent-2.rs:25:9 + | +LL | FUN(&x); //~ ERROR `x` does not live long enough + | ----^^- + | | | + | | borrowed value does not live long enough + | argument requires that `x` is borrowed for `'static` +... +LL | } + | - `x` dropped here while still borrowed + +error[E0597]: `x` does not live long enough + --> $DIR/constant-in-expr-inherent-2.rs:26:23 + | +LL | A::ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough + | ------------------^^- + | | | + | | borrowed value does not live long enough + | argument requires that `x` is borrowed for `'static` +... +LL | } + | - `x` dropped here while still borrowed + +error[E0597]: `x` does not live long enough + --> $DIR/constant-in-expr-inherent-2.rs:27:28 + | +LL | B::ALSO_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough + | -----------------------^^- + | | | + | | borrowed value does not live long enough + | argument requires that `x` is borrowed for `'static` +LL | <_>::TRAIT_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough +LL | } + | - `x` dropped here while still borrowed + +error[E0597]: `x` does not live long enough + --> $DIR/constant-in-expr-inherent-2.rs:28:31 + | +LL | <_>::TRAIT_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough + | --------------------------^^- + | | | + | | borrowed value does not live long enough + | argument requires that `x` is borrowed for `'static` +LL | } + | - `x` dropped here while still borrowed + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr index 7aeb276eeb9..5b97c12b626 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr @@ -1,4 +1,4 @@ -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/constant-in-expr-normalize.rs:20:5 | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr index fee9abc1ed8..10e48b5bc34 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr @@ -1,4 +1,4 @@ -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/constant-in-expr-trait-item-1.rs:12:5 | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr index 047aad98319..5bfa32ec644 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr @@ -1,4 +1,4 @@ -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/constant-in-expr-trait-item-2.rs:12:5 | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr index b373cebacb0..a1e60db05d0 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr @@ -1,4 +1,4 @@ -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/constant-in-expr-trait-item-3.rs:12:5 | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { diff --git a/src/test/ui/nll/user-annotations/downcast-infer.rs b/src/test/ui/nll/user-annotations/downcast-infer.rs new file mode 100644 index 00000000000..23b76bb1964 --- /dev/null +++ b/src/test/ui/nll/user-annotations/downcast-infer.rs @@ -0,0 +1,11 @@ +// compile-pass + +// Check that we don't try to downcast `_` when type-checking the annotation. +fn main() { + let x = Some(Some(Some(1))); + + match x { + Some::>(Some(Some(v))) => (), + _ => (), + } +} diff --git a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.rs b/src/test/ui/nll/user-annotations/dump-adt-brace-struct.rs index 970fbf98af4..5dcd41078c7 100644 --- a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.rs +++ b/src/test/ui/nll/user-annotations/dump-adt-brace-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unit test for the "user substitutions" that are annotated on each // node. diff --git a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr b/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr index 88383190cbc..123c26195d0 100644 --- a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr +++ b/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr @@ -1,5 +1,5 @@ -error: user substs: Canonical { max_universe: U0, variables: [], value: UserSubsts { substs: [u32], user_self_ty: None } } - --> $DIR/dump-adt-brace-struct.rs:28:5 +error: user substs: UserSubsts { substs: [u32], user_self_ty: None } + --> $DIR/dump-adt-brace-struct.rs:18:5 | LL | SomeStruct:: { t: 22 }; //~ ERROR [u32] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/user-annotations/dump-fn-method.rs b/src/test/ui/nll/user-annotations/dump-fn-method.rs index ef5fb8eadc3..7551a9474dc 100644 --- a/src/test/ui/nll/user-annotations/dump-fn-method.rs +++ b/src/test/ui/nll/user-annotations/dump-fn-method.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unit test for the "user substitutions" that are annotated on each // node. diff --git a/src/test/ui/nll/user-annotations/dump-fn-method.stderr b/src/test/ui/nll/user-annotations/dump-fn-method.stderr index 359423d0cfb..a1a4e43e8a3 100644 --- a/src/test/ui/nll/user-annotations/dump-fn-method.stderr +++ b/src/test/ui/nll/user-annotations/dump-fn-method.stderr @@ -1,23 +1,23 @@ -error: user substs: Canonical { max_universe: U0, variables: [], value: UserSubsts { substs: [u32], user_self_ty: None } } - --> $DIR/dump-fn-method.rs:36:13 +error: user substs: UserSubsts { substs: [u32], user_self_ty: None } + --> $DIR/dump-fn-method.rs:26:13 | LL | let x = foo::; //~ ERROR [u32] | ^^^^^^^^^^ -error: user substs: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: UserSubsts { substs: [^0, u32, ^1], user_self_ty: None } } - --> $DIR/dump-fn-method.rs:42:13 +error: user substs: UserSubsts { substs: [^0, u32, ^1], user_self_ty: None } + --> $DIR/dump-fn-method.rs:32:13 | LL | let x = <_ as Bazoom>::method::<_>; //~ ERROR [^0, u32, ^1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: user substs: Canonical { max_universe: U0, variables: [], value: UserSubsts { substs: [u8, u16, u32], user_self_ty: None } } - --> $DIR/dump-fn-method.rs:46:13 +error: user substs: UserSubsts { substs: [u8, u16, u32], user_self_ty: None } + --> $DIR/dump-fn-method.rs:36:13 | LL | let x = >::method::; //~ ERROR [u8, u16, u32] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: user substs: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General) }, CanonicalVarInfo { kind: Ty(General) }], value: UserSubsts { substs: [^0, ^1, u32], user_self_ty: None } } - --> $DIR/dump-fn-method.rs:54:5 +error: user substs: UserSubsts { substs: [^0, ^1, u32], user_self_ty: None } + --> $DIR/dump-fn-method.rs:44:5 | LL | y.method::(44, 66); //~ ERROR [^0, ^1, u32] | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/nll/user-annotations/fns.rs b/src/test/ui/nll/user-annotations/fns.rs index 4f26d5422b0..1e5e9340bef 100644 --- a/src/test/ui/nll/user-annotations/fns.rs +++ b/src/test/ui/nll/user-annotations/fns.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unit test for the "user substitutions" that are annotated on each // node. diff --git a/src/test/ui/nll/user-annotations/fns.stderr b/src/test/ui/nll/user-annotations/fns.stderr index 80b79bfef8b..65af2f68bcf 100644 --- a/src/test/ui/nll/user-annotations/fns.stderr +++ b/src/test/ui/nll/user-annotations/fns.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/fns.rs:35:29 + --> $DIR/fns.rs:25:29 | LL | some_fn::<&'static u32>(&c); //~ ERROR | ------------------------^^- @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/fns.rs:40:24 + --> $DIR/fns.rs:30:24 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/fns.rs:50:28 + --> $DIR/fns.rs:40:28 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/issue-54124.rs b/src/test/ui/nll/user-annotations/issue-54124.rs index 8cdd390540a..e1de67aa938 100644 --- a/src/test/ui/nll/user-annotations/issue-54124.rs +++ b/src/test/ui/nll/user-annotations/issue-54124.rs @@ -1,7 +1,8 @@ #![feature(nll)] fn test<'a>() { - let _:fn(&()) = |_:&'a ()| {}; + let _:fn(&()) = |_:&'a ()| {}; //~ ERROR lifetime may not live long enough + //~^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/nll/user-annotations/issue-54124.stderr b/src/test/ui/nll/user-annotations/issue-54124.stderr index df5e4b0447c..b1c2411e46c 100644 --- a/src/test/ui/nll/user-annotations/issue-54124.stderr +++ b/src/test/ui/nll/user-annotations/issue-54124.stderr @@ -1,19 +1,19 @@ -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/issue-54124.rs:4:22 | LL | fn test<'a>() { | -- lifetime `'a` defined here -LL | let _:fn(&()) = |_:&'a ()| {}; +LL | let _:fn(&()) = |_:&'a ()| {}; //~ ERROR lifetime may not live long enough | ^ - let's call the lifetime of this reference `'1` | | | requires that `'1` must outlive `'a` -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/issue-54124.rs:4:22 | LL | fn test<'a>() { | -- lifetime `'a` defined here -LL | let _:fn(&()) = |_:&'a ()| {}; +LL | let _:fn(&()) = |_:&'a ()| {}; //~ ERROR lifetime may not live long enough | ^ requires that `'a` must outlive `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs new file mode 100644 index 00000000000..f4969bb4067 --- /dev/null +++ b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs @@ -0,0 +1,40 @@ +// Check that repeated type variables are correctly handled + +#![allow(unused)] +#![feature(nll, type_ascription)] + +type PairUncoupled<'a, 'b, T> = (&'a T, &'b T); +type PairCoupledTypes = (T, T); +type PairCoupledRegions<'a, T> = (&'a T, &'a T); + +fn uncoupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { + let ((y, _z),) = ((s, _x),): (PairUncoupled<_>,); + y // OK +} + +fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { + let ((y, _z),) = ((s, _x),): (PairCoupledTypes<_>,); + y //~ ERROR lifetime may not live long enough +} + +fn coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { + let ((y, _z),) = ((s, _x),): (PairCoupledRegions<_>,); + y //~ ERROR lifetime may not live long enough +} + +fn cast_uncoupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { + let ((y, _z),) = ((s, _x),) as (PairUncoupled<_>,); + y // OK +} + +fn cast_coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { + let ((y, _z),) = ((s, _x),) as (PairCoupledTypes<_>,); + y //~ ERROR lifetime may not live long enough +} + +fn cast_coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { + let ((y, _z),) = ((s, _x),) as (PairCoupledRegions<_>,); + y //~ ERROR lifetime may not live long enough +} + +fn main() {} diff --git a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr new file mode 100644 index 00000000000..76be637220a --- /dev/null +++ b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr @@ -0,0 +1,38 @@ +error: lifetime may not live long enough + --> $DIR/issue-57731-ascibed-coupled-types.rs:17:5 + | +LL | fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { + | -- lifetime `'a` defined here +LL | let ((y, _z),) = ((s, _x),): (PairCoupledTypes<_>,); +LL | y //~ ERROR lifetime may not live long enough + | ^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/issue-57731-ascibed-coupled-types.rs:22:5 + | +LL | fn coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { + | -- lifetime `'a` defined here +LL | let ((y, _z),) = ((s, _x),): (PairCoupledRegions<_>,); +LL | y //~ ERROR lifetime may not live long enough + | ^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/issue-57731-ascibed-coupled-types.rs:32:5 + | +LL | fn cast_coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { + | -- lifetime `'a` defined here +LL | let ((y, _z),) = ((s, _x),) as (PairCoupledTypes<_>,); +LL | y //~ ERROR lifetime may not live long enough + | ^ returning this value requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/issue-57731-ascibed-coupled-types.rs:37:5 + | +LL | fn cast_coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { + | -- lifetime `'a` defined here +LL | let ((y, _z),) = ((s, _x),) as (PairCoupledRegions<_>,); +LL | y //~ ERROR lifetime may not live long enough + | ^ returning this value requires that `'a` must outlive `'static` + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/nll/user-annotations/method-call.rs b/src/test/ui/nll/user-annotations/method-call.rs index 9a03679bef0..59d1513c4c3 100644 --- a/src/test/ui/nll/user-annotations/method-call.rs +++ b/src/test/ui/nll/user-annotations/method-call.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unit test for the "user substitutions" that are annotated on each // node. diff --git a/src/test/ui/nll/user-annotations/method-call.stderr b/src/test/ui/nll/user-annotations/method-call.stderr index 32803839d31..2e23e6e2a65 100644 --- a/src/test/ui/nll/user-annotations/method-call.stderr +++ b/src/test/ui/nll/user-annotations/method-call.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/method-call.rs:48:34 + --> $DIR/method-call.rs:38:34 | LL | a.method::<&'static u32>(b, &c); //~ ERROR | -----------------------------^^- @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/method-call.rs:55:29 + --> $DIR/method-call.rs:45:29 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/method-call.rs:69:33 + --> $DIR/method-call.rs:59:33 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/method-ufcs-1.rs b/src/test/ui/nll/user-annotations/method-ufcs-1.rs index 5ac2ba5fa48..7968a9f6c4f 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-1.rs +++ b/src/test/ui/nll/user-annotations/method-ufcs-1.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unit test for the "user substitutions" that are annotated on each // node. diff --git a/src/test/ui/nll/user-annotations/method-ufcs-1.stderr b/src/test/ui/nll/user-annotations/method-ufcs-1.stderr index 10a2f10bb7f..30cf01f54bd 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-1.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-1.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/method-ufcs-1.rs:42:7 + --> $DIR/method-ufcs-1.rs:32:7 | LL | x(&a, b, c); //~ ERROR | --^^------- @@ -10,7 +10,7 @@ LL | } | - `a` dropped here while still borrowed error[E0597]: `a` does not live long enough - --> $DIR/method-ufcs-1.rs:49:36 + --> $DIR/method-ufcs-1.rs:39:36 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `a` dropped here while still borrowed error[E0597]: `a` does not live long enough - --> $DIR/method-ufcs-1.rs:63:41 + --> $DIR/method-ufcs-1.rs:53:41 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/method-ufcs-2.rs b/src/test/ui/nll/user-annotations/method-ufcs-2.rs index 082cc561ae7..a1d0e7b4c92 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-2.rs +++ b/src/test/ui/nll/user-annotations/method-ufcs-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unit test for the "user substitutions" that are annotated on each // node. diff --git a/src/test/ui/nll/user-annotations/method-ufcs-2.stderr b/src/test/ui/nll/user-annotations/method-ufcs-2.stderr index 972f6af24eb..140bb750469 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-2.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-2.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/method-ufcs-2.rs:42:7 + --> $DIR/method-ufcs-2.rs:32:7 | LL | x(&a, b, c); //~ ERROR | --^^------- @@ -10,7 +10,7 @@ LL | } | - `a` dropped here while still borrowed error[E0597]: `b` does not live long enough - --> $DIR/method-ufcs-2.rs:49:39 + --> $DIR/method-ufcs-2.rs:39:39 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `b` dropped here while still borrowed error[E0597]: `b` does not live long enough - --> $DIR/method-ufcs-2.rs:63:44 + --> $DIR/method-ufcs-2.rs:53:44 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/method-ufcs-3.rs b/src/test/ui/nll/user-annotations/method-ufcs-3.rs index f4fdb3ee572..ea480c03c35 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-3.rs +++ b/src/test/ui/nll/user-annotations/method-ufcs-3.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Unit test for the "user substitutions" that are annotated on each // node. diff --git a/src/test/ui/nll/user-annotations/method-ufcs-3.stderr b/src/test/ui/nll/user-annotations/method-ufcs-3.stderr index 7313787fa17..12b9685bdb8 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-3.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-3.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/method-ufcs-3.rs:48:53 + --> $DIR/method-ufcs-3.rs:38:53 | LL | <_ as Bazoom<_>>::method::<&'static u32>(&a, b, &c); //~ ERROR | ------------------------------------------------^^- @@ -10,7 +10,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/method-ufcs-3.rs:55:48 + --> $DIR/method-ufcs-3.rs:45:48 | LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here @@ -24,7 +24,7 @@ LL | } | - `c` dropped here while still borrowed error[E0597]: `c` does not live long enough - --> $DIR/method-ufcs-3.rs:69:52 + --> $DIR/method-ufcs-3.rs:59:52 | LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here diff --git a/src/test/ui/nll/user-annotations/normalization.rs b/src/test/ui/nll/user-annotations/normalization.rs index 51d9adccd73..e0af2e67e18 100644 --- a/src/test/ui/nll/user-annotations/normalization.rs +++ b/src/test/ui/nll/user-annotations/normalization.rs @@ -2,7 +2,6 @@ // after normalization. #![feature(nll)] -#![ignore(unused)] trait Foo { type Out; } impl Foo for () { type Out = &'static u32; } diff --git a/src/test/ui/nll/user-annotations/normalization.stderr b/src/test/ui/nll/user-annotations/normalization.stderr index b059d5aa89a..71bf8507a73 100644 --- a/src/test/ui/nll/user-annotations/normalization.stderr +++ b/src/test/ui/nll/user-annotations/normalization.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/normalization.rs:12:31 + --> $DIR/normalization.rs:11:31 | LL | let b: <() as Foo>::Out = &a; //~ ERROR | ---------------- ^^ borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/patterns.stderr b/src/test/ui/nll/user-annotations/patterns.stderr index b0c554e6ca1..476578e074d 100644 --- a/src/test/ui/nll/user-annotations/patterns.stderr +++ b/src/test/ui/nll/user-annotations/patterns.stderr @@ -148,7 +148,7 @@ LL | value1: &x, //~ ERROR LL | } | - `x` dropped here while still borrowed -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/patterns.rs:113:5 | LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 { @@ -157,7 +157,7 @@ LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 { LL | y //~ ERROR | ^ returning this value requires that `'a` must outlive `'static` -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/patterns.rs:125:5 | LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 { @@ -166,7 +166,7 @@ LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 { LL | y //~ ERROR | ^ returning this value requires that `'a` must outlive `'static` -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/patterns.rs:130:5 | LL | fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 { @@ -175,7 +175,7 @@ LL | let Single { value: y }: Single<&'a u32> = Single { value: &22 }; LL | y //~ ERROR | ^ returning this value requires that `'a` must outlive `'static` -error: unsatisfied lifetime constraints +error: lifetime may not live long enough --> $DIR/patterns.rs:134:18 | LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 { diff --git a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs index 2785f71ebcf..362fe51c3ea 100644 --- a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs +++ b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![allow(warnings)] #![feature(nll)] #![feature(type_ascription)] diff --git a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr index 50df5f615fa..a88ff6df3d7 100644 --- a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr +++ b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/type_ascription_static_lifetime.rs:18:19 + --> $DIR/type_ascription_static_lifetime.rs:7:19 | LL | let y: &u32 = &x: &'static u32; //~ ERROR E0597 | ^^-------------- diff --git a/src/test/ui/nll/user-annotations/wf-self-type.rs b/src/test/ui/nll/user-annotations/wf-self-type.rs index c3cb3068bce..d8caf4693b5 100644 --- a/src/test/ui/nll/user-annotations/wf-self-type.rs +++ b/src/test/ui/nll/user-annotations/wf-self-type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] struct Foo<'a, 'b: 'a>(&'a &'b ()); @@ -19,7 +9,7 @@ impl<'a, 'b> Foo<'a, 'b> { } pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { - Foo::xmute(u) //~ ERROR unsatisfied lifetime constraints + Foo::xmute(u) //~ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/nll/user-annotations/wf-self-type.stderr b/src/test/ui/nll/user-annotations/wf-self-type.stderr index 78d86fbf17e..00500c8d654 100644 --- a/src/test/ui/nll/user-annotations/wf-self-type.stderr +++ b/src/test/ui/nll/user-annotations/wf-self-type.stderr @@ -1,11 +1,11 @@ -error: unsatisfied lifetime constraints - --> $DIR/wf-self-type.rs:22:5 +error: lifetime may not live long enough + --> $DIR/wf-self-type.rs:12:5 | LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here -LL | Foo::xmute(u) //~ ERROR unsatisfied lifetime constraints +LL | Foo::xmute(u) //~ ERROR lifetime may not live long enough | ^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a` error: aborting due to previous error diff --git a/src/test/ui/nll/where_clauses_in_functions.rs b/src/test/ui/nll/where_clauses_in_functions.rs index 0cadc802d06..0d35c09b8ef 100644 --- a/src/test/ui/nll/where_clauses_in_functions.rs +++ b/src/test/ui/nll/where_clauses_in_functions.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Zborrowck=mir #![allow(dead_code)] @@ -21,7 +11,7 @@ where fn bar<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { foo(x, y) - //~^ ERROR unsatisfied lifetime constraints + //~^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/nll/where_clauses_in_functions.stderr b/src/test/ui/nll/where_clauses_in_functions.stderr index 19cb16d495b..f3b65ec31ac 100644 --- a/src/test/ui/nll/where_clauses_in_functions.stderr +++ b/src/test/ui/nll/where_clauses_in_functions.stderr @@ -1,5 +1,5 @@ -error: unsatisfied lifetime constraints - --> $DIR/where_clauses_in_functions.rs:23:5 +error: lifetime may not live long enough + --> $DIR/where_clauses_in_functions.rs:13:5 | LL | fn bar<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/nll/where_clauses_in_structs.rs b/src/test/ui/nll/where_clauses_in_structs.rs index 4b5a49dfae7..8bc6b2e4a4f 100644 --- a/src/test/ui/nll/where_clauses_in_structs.rs +++ b/src/test/ui/nll/where_clauses_in_structs.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z borrowck=mir #![allow(dead_code)] @@ -21,7 +11,7 @@ struct Foo<'a: 'b, 'b> { fn bar<'a, 'b>(x: Cell<&'a u32>, y: Cell<&'b u32>) { Foo { x, y }; - //~^ ERROR unsatisfied lifetime constraints + //~^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/nll/where_clauses_in_structs.stderr b/src/test/ui/nll/where_clauses_in_structs.stderr index 636498eae92..e0feb40273f 100644 --- a/src/test/ui/nll/where_clauses_in_structs.stderr +++ b/src/test/ui/nll/where_clauses_in_structs.stderr @@ -1,5 +1,5 @@ -error: unsatisfied lifetime constraints - --> $DIR/where_clauses_in_structs.rs:23:11 +error: lifetime may not live long enough + --> $DIR/where_clauses_in_structs.rs:13:11 | LL | fn bar<'a, 'b>(x: Cell<&'a u32>, y: Cell<&'b u32>) { | -- -- lifetime `'b` defined here diff --git a/src/test/ui/no-args-non-move-async-closure.rs b/src/test/ui/no-args-non-move-async-closure.rs index 9cb754167cf..4f5b2ea3783 100644 --- a/src/test/ui/no-args-non-move-async-closure.rs +++ b/src/test/ui/no-args-non-move-async-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 #![feature(arbitrary_self_types, async_await, await_macro, futures_api, pin)] diff --git a/src/test/ui/no-args-non-move-async-closure.stderr b/src/test/ui/no-args-non-move-async-closure.stderr index 752816502eb..e1d16f669a9 100644 --- a/src/test/ui/no-args-non-move-async-closure.stderr +++ b/src/test/ui/no-args-non-move-async-closure.stderr @@ -1,5 +1,5 @@ error[E0708]: `async` non-`move` closures with arguments are not currently supported - --> $DIR/no-args-non-move-async-closure.rs:16:13 + --> $DIR/no-args-non-move-async-closure.rs:6:13 | LL | let _ = async |x: u8| {}; | ^^^^^^^^^^^^^ diff --git a/src/test/ui/no-capture-arc.nll.stderr b/src/test/ui/no-capture-arc.nll.stderr index 31dba18338a..476b6f75abb 100644 --- a/src/test/ui/no-capture-arc.nll.stderr +++ b/src/test/ui/no-capture-arc.nll.stderr @@ -1,6 +1,9 @@ error[E0382]: borrow of moved value: `arc_v` - --> $DIR/no-capture-arc.rs:24:18 + --> $DIR/no-capture-arc.rs:14:18 | +LL | let arc_v = Arc::new(v); + | ----- move occurs because `arc_v` has type `std::sync::Arc>`, which does not implement the `Copy` trait +LL | LL | thread::spawn(move|| { | ------ value moved into closure here LL | assert_eq!((*arc_v)[3], 4); @@ -8,8 +11,6 @@ LL | assert_eq!((*arc_v)[3], 4); ... LL | assert_eq!((*arc_v)[2], 3); | ^^^^^ value borrowed here after move - | - = note: move occurs because `arc_v` has type `std::sync::Arc>`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/no-capture-arc.rs b/src/test/ui/no-capture-arc.rs index 5e1d22bf63b..06f5fb3da3c 100644 --- a/src/test/ui/no-capture-arc.rs +++ b/src/test/ui/no-capture-arc.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: use of moved value use std::sync::Arc; diff --git a/src/test/ui/no-capture-arc.stderr b/src/test/ui/no-capture-arc.stderr index d6801d7e6e1..0dfa5cdbe9e 100644 --- a/src/test/ui/no-capture-arc.stderr +++ b/src/test/ui/no-capture-arc.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `arc_v` - --> $DIR/no-capture-arc.rs:24:18 + --> $DIR/no-capture-arc.rs:14:18 | LL | thread::spawn(move|| { | ------ value moved (into closure) here @@ -10,7 +10,7 @@ LL | assert_eq!((*arc_v)[2], 3); = note: move occurs because `arc_v` has type `std::sync::Arc>`, which does not implement the `Copy` trait error[E0382]: use of moved value: `arc_v` - --> $DIR/no-capture-arc.rs:26:23 + --> $DIR/no-capture-arc.rs:16:23 | LL | thread::spawn(move|| { | ------ value moved (into closure) here diff --git a/src/test/ui/no-implicit-prelude-nested.rs b/src/test/ui/no-implicit-prelude-nested.rs index c64839ad0de..fae52c0edc1 100644 --- a/src/test/ui/no-implicit-prelude-nested.rs +++ b/src/test/ui/no-implicit-prelude-nested.rs @@ -1,16 +1,6 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that things from the prelude aren't in scope. Use many of them // so that renaming some things won't magically make this test fail -// for the wrong reason (e.g. if `Add` changes to `Addition`, and +// for the wrong reason (e.g., if `Add` changes to `Addition`, and // `no_implicit_prelude` stops working, then the `impl Add` will still // fail with the same error message). diff --git a/src/test/ui/no-implicit-prelude-nested.stderr b/src/test/ui/no-implicit-prelude-nested.stderr index dd0666a6fd4..7ef4bfbaf99 100644 --- a/src/test/ui/no-implicit-prelude-nested.stderr +++ b/src/test/ui/no-implicit-prelude-nested.stderr @@ -1,5 +1,5 @@ error[E0405]: cannot find trait `Add` in this scope - --> $DIR/no-implicit-prelude-nested.rs:21:14 + --> $DIR/no-implicit-prelude-nested.rs:11:14 | LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope | ^^^ not found in this scope @@ -9,7 +9,7 @@ LL | use std::ops::Add; | error[E0405]: cannot find trait `Clone` in this scope - --> $DIR/no-implicit-prelude-nested.rs:22:14 + --> $DIR/no-implicit-prelude-nested.rs:12:14 | LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope | ^^^^^ not found in this scope @@ -21,7 +21,7 @@ LL | use std::prelude::v1::Clone; | error[E0405]: cannot find trait `Iterator` in this scope - --> $DIR/no-implicit-prelude-nested.rs:23:14 + --> $DIR/no-implicit-prelude-nested.rs:13:14 | LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope | ^^^^^^^^ not found in this scope @@ -33,7 +33,7 @@ LL | use std::prelude::v1::Iterator; | error[E0405]: cannot find trait `ToString` in this scope - --> $DIR/no-implicit-prelude-nested.rs:24:14 + --> $DIR/no-implicit-prelude-nested.rs:14:14 | LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope | ^^^^^^^^ not found in this scope @@ -45,13 +45,13 @@ LL | use std::string::ToString; | error[E0405]: cannot find trait `Writer` in this scope - --> $DIR/no-implicit-prelude-nested.rs:25:14 + --> $DIR/no-implicit-prelude-nested.rs:15:14 | LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope | ^^^^^^ not found in this scope error[E0425]: cannot find function `drop` in this scope - --> $DIR/no-implicit-prelude-nested.rs:28:13 + --> $DIR/no-implicit-prelude-nested.rs:18:13 | LL | drop(2) //~ ERROR cannot find function `drop` in this scope | ^^^^ not found in this scope @@ -63,7 +63,7 @@ LL | use std::prelude::v1::drop; | error[E0405]: cannot find trait `Add` in this scope - --> $DIR/no-implicit-prelude-nested.rs:33:10 + --> $DIR/no-implicit-prelude-nested.rs:23:10 | LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope | ^^^ not found in this scope @@ -73,7 +73,7 @@ LL | use std::ops::Add; | error[E0405]: cannot find trait `Clone` in this scope - --> $DIR/no-implicit-prelude-nested.rs:34:10 + --> $DIR/no-implicit-prelude-nested.rs:24:10 | LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope | ^^^^^ not found in this scope @@ -85,7 +85,7 @@ LL | use std::prelude::v1::Clone; | error[E0405]: cannot find trait `Iterator` in this scope - --> $DIR/no-implicit-prelude-nested.rs:35:10 + --> $DIR/no-implicit-prelude-nested.rs:25:10 | LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope | ^^^^^^^^ not found in this scope @@ -97,7 +97,7 @@ LL | use std::prelude::v1::Iterator; | error[E0405]: cannot find trait `ToString` in this scope - --> $DIR/no-implicit-prelude-nested.rs:36:10 + --> $DIR/no-implicit-prelude-nested.rs:26:10 | LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope | ^^^^^^^^ not found in this scope @@ -109,13 +109,13 @@ LL | use std::string::ToString; | error[E0405]: cannot find trait `Writer` in this scope - --> $DIR/no-implicit-prelude-nested.rs:37:10 + --> $DIR/no-implicit-prelude-nested.rs:27:10 | LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope | ^^^^^^ not found in this scope error[E0425]: cannot find function `drop` in this scope - --> $DIR/no-implicit-prelude-nested.rs:40:9 + --> $DIR/no-implicit-prelude-nested.rs:30:9 | LL | drop(2) //~ ERROR cannot find function `drop` in this scope | ^^^^ not found in this scope @@ -127,7 +127,7 @@ LL | use std::prelude::v1::drop; | error[E0405]: cannot find trait `Add` in this scope - --> $DIR/no-implicit-prelude-nested.rs:48:14 + --> $DIR/no-implicit-prelude-nested.rs:38:14 | LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope | ^^^ not found in this scope @@ -137,7 +137,7 @@ LL | use std::ops::Add; | error[E0405]: cannot find trait `Clone` in this scope - --> $DIR/no-implicit-prelude-nested.rs:49:14 + --> $DIR/no-implicit-prelude-nested.rs:39:14 | LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope | ^^^^^ not found in this scope @@ -149,7 +149,7 @@ LL | use std::prelude::v1::Clone; | error[E0405]: cannot find trait `Iterator` in this scope - --> $DIR/no-implicit-prelude-nested.rs:50:14 + --> $DIR/no-implicit-prelude-nested.rs:40:14 | LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope | ^^^^^^^^ not found in this scope @@ -161,7 +161,7 @@ LL | use std::prelude::v1::Iterator; | error[E0405]: cannot find trait `ToString` in this scope - --> $DIR/no-implicit-prelude-nested.rs:51:14 + --> $DIR/no-implicit-prelude-nested.rs:41:14 | LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope | ^^^^^^^^ not found in this scope @@ -173,13 +173,13 @@ LL | use std::string::ToString; | error[E0405]: cannot find trait `Writer` in this scope - --> $DIR/no-implicit-prelude-nested.rs:52:14 + --> $DIR/no-implicit-prelude-nested.rs:42:14 | LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope | ^^^^^^ not found in this scope error[E0425]: cannot find function `drop` in this scope - --> $DIR/no-implicit-prelude-nested.rs:55:13 + --> $DIR/no-implicit-prelude-nested.rs:45:13 | LL | drop(2) //~ ERROR cannot find function `drop` in this scope | ^^^^ not found in this scope diff --git a/src/test/ui/no-implicit-prelude.rs b/src/test/ui/no-implicit-prelude.rs index 0e39d9ebdc1..e2074bbb8c8 100644 --- a/src/test/ui/no-implicit-prelude.rs +++ b/src/test/ui/no-implicit-prelude.rs @@ -1,18 +1,8 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_implicit_prelude] // Test that things from the prelude aren't in scope. Use many of them // so that renaming some things won't magically make this test fail -// for the wrong reason (e.g. if `Add` changes to `Addition`, and +// for the wrong reason (e.g., if `Add` changes to `Addition`, and // `no_implicit_prelude` stops working, then the `impl Add` will still // fail with the same error message). diff --git a/src/test/ui/no-implicit-prelude.stderr b/src/test/ui/no-implicit-prelude.stderr index ae1098585b7..fa82ac6cbe7 100644 --- a/src/test/ui/no-implicit-prelude.stderr +++ b/src/test/ui/no-implicit-prelude.stderr @@ -1,5 +1,5 @@ error[E0405]: cannot find trait `Add` in this scope - --> $DIR/no-implicit-prelude.rs:20:6 + --> $DIR/no-implicit-prelude.rs:10:6 | LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope | ^^^ not found in this scope @@ -9,7 +9,7 @@ LL | use std::ops::Add; | error[E0405]: cannot find trait `Clone` in this scope - --> $DIR/no-implicit-prelude.rs:21:6 + --> $DIR/no-implicit-prelude.rs:11:6 | LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope | ^^^^^ not found in this scope @@ -21,7 +21,7 @@ LL | use std::prelude::v1::Clone; | error[E0405]: cannot find trait `Iterator` in this scope - --> $DIR/no-implicit-prelude.rs:22:6 + --> $DIR/no-implicit-prelude.rs:12:6 | LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope | ^^^^^^^^ not found in this scope @@ -33,7 +33,7 @@ LL | use std::prelude::v1::Iterator; | error[E0405]: cannot find trait `ToString` in this scope - --> $DIR/no-implicit-prelude.rs:23:6 + --> $DIR/no-implicit-prelude.rs:13:6 | LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope | ^^^^^^^^ not found in this scope @@ -45,13 +45,13 @@ LL | use std::string::ToString; | error[E0405]: cannot find trait `Writer` in this scope - --> $DIR/no-implicit-prelude.rs:24:6 + --> $DIR/no-implicit-prelude.rs:14:6 | LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope | ^^^^^^ not found in this scope error[E0425]: cannot find function `drop` in this scope - --> $DIR/no-implicit-prelude.rs:27:5 + --> $DIR/no-implicit-prelude.rs:17:5 | LL | drop(2) //~ ERROR cannot find function `drop` in this scope | ^^^^ not found in this scope diff --git a/src/test/ui/no-link-unknown-crate.rs b/src/test/ui/no-link-unknown-crate.rs new file mode 100644 index 00000000000..c7da2e41832 --- /dev/null +++ b/src/test/ui/no-link-unknown-crate.rs @@ -0,0 +1,4 @@ +#[no_link] +extern crate doesnt_exist; //~ ERROR can't find crate + +fn main() {} diff --git a/src/test/ui/no-link-unknown-crate.stderr b/src/test/ui/no-link-unknown-crate.stderr new file mode 100644 index 00000000000..db76b74fdad --- /dev/null +++ b/src/test/ui/no-link-unknown-crate.stderr @@ -0,0 +1,9 @@ +error[E0463]: can't find crate for `doesnt_exist` + --> $DIR/no-link-unknown-crate.rs:2:1 + | +LL | extern crate doesnt_exist; //~ ERROR can't find crate + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0463`. diff --git a/src/test/ui/no-link.rs b/src/test/ui/no-link.rs index 36efb67cf80..f97c1074df4 100644 --- a/src/test/ui/no-link.rs +++ b/src/test/ui/no-link.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:empty-struct.rs #[no_link] diff --git a/src/test/ui/no-link.stderr b/src/test/ui/no-link.stderr index 3f159ddfbd1..928ad423202 100644 --- a/src/test/ui/no-link.stderr +++ b/src/test/ui/no-link.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `XEmpty1` in module `empty_struct` - --> $DIR/no-link.rs:17:19 + --> $DIR/no-link.rs:7:19 | LL | empty_struct::XEmpty1; //~ ERROR cannot find value `XEmpty1` in module `empty_struct` | ^^^^^^^ not found in `empty_struct` diff --git a/src/test/ui/no-patterns-in-args-2.rs b/src/test/ui/no-patterns-in-args-2.rs index 4d2412c34a5..ccf57478b48 100644 --- a/src/test/ui/no-patterns-in-args-2.rs +++ b/src/test/ui/no-patterns-in-args-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(patterns_in_fns_without_body)] trait Tr { diff --git a/src/test/ui/no-patterns-in-args-2.stderr b/src/test/ui/no-patterns-in-args-2.stderr index 11476169c7d..161e7bb4b00 100644 --- a/src/test/ui/no-patterns-in-args-2.stderr +++ b/src/test/ui/no-patterns-in-args-2.stderr @@ -1,17 +1,17 @@ error[E0642]: patterns aren't allowed in methods without bodies - --> $DIR/no-patterns-in-args-2.rs:16:11 + --> $DIR/no-patterns-in-args-2.rs:6:11 | LL | fn f2(&arg: u8); //~ ERROR patterns aren't allowed in methods without bodies | ^^^^ error: patterns aren't allowed in methods without bodies - --> $DIR/no-patterns-in-args-2.rs:14:11 + --> $DIR/no-patterns-in-args-2.rs:4:11 | LL | fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in methods without bodies | ^^^^^^^ | note: lint level defined here - --> $DIR/no-patterns-in-args-2.rs:11:9 + --> $DIR/no-patterns-in-args-2.rs:1:9 | LL | #![deny(patterns_in_fns_without_body)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/no-patterns-in-args-macro.rs b/src/test/ui/no-patterns-in-args-macro.rs index f85ce8f57ea..59cb9945398 100644 --- a/src/test/ui/no-patterns-in-args-macro.rs +++ b/src/test/ui/no-patterns-in-args-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! m { ($pat: pat) => { trait Tr { diff --git a/src/test/ui/no-patterns-in-args-macro.stderr b/src/test/ui/no-patterns-in-args-macro.stderr index 57af3178439..28a48bf6a89 100644 --- a/src/test/ui/no-patterns-in-args-macro.stderr +++ b/src/test/ui/no-patterns-in-args-macro.stderr @@ -1,17 +1,17 @@ error[E0642]: patterns aren't allowed in methods without bodies - --> $DIR/no-patterns-in-args-macro.rs:30:8 + --> $DIR/no-patterns-in-args-macro.rs:20:8 | LL | m!((bad, pat)); | ^^^^^^^^^^ error[E0561]: patterns aren't allowed in function pointer types - --> $DIR/no-patterns-in-args-macro.rs:30:8 + --> $DIR/no-patterns-in-args-macro.rs:20:8 | LL | m!((bad, pat)); | ^^^^^^^^^^ error[E0130]: patterns aren't allowed in foreign function declarations - --> $DIR/no-patterns-in-args-macro.rs:30:8 + --> $DIR/no-patterns-in-args-macro.rs:20:8 | LL | m!((bad, pat)); | ^^^^^^^^^^ pattern not allowed in foreign function diff --git a/src/test/ui/no-patterns-in-args.rs b/src/test/ui/no-patterns-in-args.rs index 757bd2cb52b..a774955c1e8 100644 --- a/src/test/ui/no-patterns-in-args.rs +++ b/src/test/ui/no-patterns-in-args.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations fn f2(&arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations diff --git a/src/test/ui/no-patterns-in-args.stderr b/src/test/ui/no-patterns-in-args.stderr index 8ac1cced28f..3fd476c4d72 100644 --- a/src/test/ui/no-patterns-in-args.stderr +++ b/src/test/ui/no-patterns-in-args.stderr @@ -1,29 +1,29 @@ error[E0130]: patterns aren't allowed in foreign function declarations - --> $DIR/no-patterns-in-args.rs:12:11 + --> $DIR/no-patterns-in-args.rs:2:11 | LL | fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations | ^^^^^^^ pattern not allowed in foreign function error[E0130]: patterns aren't allowed in foreign function declarations - --> $DIR/no-patterns-in-args.rs:13:11 + --> $DIR/no-patterns-in-args.rs:3:11 | LL | fn f2(&arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations | ^^^^ pattern not allowed in foreign function error[E0130]: patterns aren't allowed in foreign function declarations - --> $DIR/no-patterns-in-args.rs:14:11 + --> $DIR/no-patterns-in-args.rs:4:11 | LL | fn f3(arg @ _: u8); //~ ERROR patterns aren't allowed in foreign function declarations | ^^^^^^^ pattern not allowed in foreign function error[E0561]: patterns aren't allowed in function pointer types - --> $DIR/no-patterns-in-args.rs:20:14 + --> $DIR/no-patterns-in-args.rs:10:14 | LL | type A1 = fn(mut arg: u8); //~ ERROR patterns aren't allowed in function pointer types | ^^^^^^^ error[E0561]: patterns aren't allowed in function pointer types - --> $DIR/no-patterns-in-args.rs:21:14 + --> $DIR/no-patterns-in-args.rs:11:14 | LL | type A2 = fn(&arg: u8); //~ ERROR patterns aren't allowed in function pointer types | ^^^^ diff --git a/src/test/ui/no-reuse-move-arc.nll.stderr b/src/test/ui/no-reuse-move-arc.nll.stderr index bffcae6e2f5..0b14f65a770 100644 --- a/src/test/ui/no-reuse-move-arc.nll.stderr +++ b/src/test/ui/no-reuse-move-arc.nll.stderr @@ -1,6 +1,9 @@ error[E0382]: borrow of moved value: `arc_v` - --> $DIR/no-reuse-move-arc.rs:22:18 + --> $DIR/no-reuse-move-arc.rs:12:18 | +LL | let arc_v = Arc::new(v); + | ----- move occurs because `arc_v` has type `std::sync::Arc>`, which does not implement the `Copy` trait +LL | LL | thread::spawn(move|| { | ------ value moved into closure here LL | assert_eq!((*arc_v)[3], 4); @@ -8,8 +11,6 @@ LL | assert_eq!((*arc_v)[3], 4); ... LL | assert_eq!((*arc_v)[2], 3); //~ ERROR use of moved value: `arc_v` | ^^^^^ value borrowed here after move - | - = note: move occurs because `arc_v` has type `std::sync::Arc>`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/no-reuse-move-arc.rs b/src/test/ui/no-reuse-move-arc.rs index 76c8a444320..b60a7f24999 100644 --- a/src/test/ui/no-reuse-move-arc.rs +++ b/src/test/ui/no-reuse-move-arc.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::sync::Arc; use std::thread; diff --git a/src/test/ui/no-reuse-move-arc.stderr b/src/test/ui/no-reuse-move-arc.stderr index 91cba6e76ef..d8ab314e762 100644 --- a/src/test/ui/no-reuse-move-arc.stderr +++ b/src/test/ui/no-reuse-move-arc.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `arc_v` - --> $DIR/no-reuse-move-arc.rs:22:18 + --> $DIR/no-reuse-move-arc.rs:12:18 | LL | thread::spawn(move|| { | ------ value moved (into closure) here @@ -10,7 +10,7 @@ LL | assert_eq!((*arc_v)[2], 3); //~ ERROR use of moved value: `arc_v` = note: move occurs because `arc_v` has type `std::sync::Arc>`, which does not implement the `Copy` trait error[E0382]: use of moved value: `arc_v` - --> $DIR/no-reuse-move-arc.rs:24:23 + --> $DIR/no-reuse-move-arc.rs:14:23 | LL | thread::spawn(move|| { | ------ value moved (into closure) here diff --git a/src/test/ui/no-send-res-ports.rs b/src/test/ui/no-send-res-ports.rs index 6825963c486..e10f447365e 100644 --- a/src/test/ui/no-send-res-ports.rs +++ b/src/test/ui/no-send-res-ports.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::thread; use std::rc::Rc; @@ -16,16 +6,16 @@ struct Port(Rc); fn main() { #[derive(Debug)] - struct foo { + struct Foo { _x: Port<()>, } - impl Drop for foo { + impl Drop for Foo { fn drop(&mut self) {} } - fn foo(x: Port<()>) -> foo { - foo { + fn foo(x: Port<()>) -> Foo { + Foo { _x: x } } diff --git a/src/test/ui/no-send-res-ports.stderr b/src/test/ui/no-send-res-ports.stderr index 936b95413ce..515b948cc7e 100644 --- a/src/test/ui/no-send-res-ports.stderr +++ b/src/test/ui/no-send-res-ports.stderr @@ -1,13 +1,13 @@ error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely - --> $DIR/no-send-res-ports.rs:35:5 + --> $DIR/no-send-res-ports.rs:25:5 | LL | thread::spawn(move|| { | ^^^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely | - = help: within `[closure@$DIR/no-send-res-ports.rs:35:19: 39:6 x:main::foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>` + = help: within `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6 x:main::Foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>` = note: required because it appears within the type `Port<()>` - = note: required because it appears within the type `main::foo` - = note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:35:19: 39:6 x:main::foo]` + = note: required because it appears within the type `main::Foo` + = note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6 x:main::Foo]` = note: required by `std::thread::spawn` error: aborting due to previous error diff --git a/src/test/ui/no-std-inject.rs b/src/test/ui/no-std-inject.rs index 49064853d21..09879c791f8 100644 --- a/src/test/ui/no-std-inject.rs +++ b/src/test/ui/no-std-inject.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![no_std] #![allow(unused_extern_crates)] diff --git a/src/test/ui/no-std-inject.stderr b/src/test/ui/no-std-inject.stderr index fbc54124a08..0ccd567e7a9 100644 --- a/src/test/ui/no-std-inject.stderr +++ b/src/test/ui/no-std-inject.stderr @@ -1,5 +1,5 @@ error[E0259]: the name `core` is defined multiple times - --> $DIR/no-std-inject.rs:14:1 + --> $DIR/no-std-inject.rs:4:1 | LL | extern crate core; //~ ERROR: the name `core` is defined multiple times | ^^^^^^^^^^^^^^^^^^ `core` reimported here diff --git a/src/test/ui/no-type-for-node-ice.rs b/src/test/ui/no-type-for-node-ice.rs index f049f69e4bb..d0cfdbf504d 100644 --- a/src/test/ui/no-type-for-node-ice.rs +++ b/src/test/ui/no-type-for-node-ice.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Related issues: #20401, #20506, #20614, #20752, #20829, #20846, #20885, #20886 fn main() { diff --git a/src/test/ui/no-type-for-node-ice.stderr b/src/test/ui/no-type-for-node-ice.stderr index c9de7d28af0..cd1a7ee6fe5 100644 --- a/src/test/ui/no-type-for-node-ice.stderr +++ b/src/test/ui/no-type-for-node-ice.stderr @@ -1,5 +1,5 @@ error[E0609]: no field `homura` on type `&'static str` - --> $DIR/no-type-for-node-ice.rs:14:8 + --> $DIR/no-type-for-node-ice.rs:4:8 | LL | "".homura[""]; //~ no field `homura` on type `&'static str` | ^^^^^^ diff --git a/src/test/ui/no-warn-on-field-replace-issue-34101.rs b/src/test/ui/no-warn-on-field-replace-issue-34101.rs index 891512c9653..af6ccf35d53 100644 --- a/src/test/ui/no-warn-on-field-replace-issue-34101.rs +++ b/src/test/ui/no-warn-on-field-replace-issue-34101.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 34101: Circa 2016-06-05, `fn inline` below issued an // erroneous warning from the elaborate_drops pass about moving out of // a field in `Foo`, which has a destructor (and thus cannot have diff --git a/src/test/ui/no_crate_type.rs b/src/test/ui/no_crate_type.rs index b2cc5cae697..392c6fd0dfa 100644 --- a/src/test/ui/no_crate_type.rs +++ b/src/test/ui/no_crate_type.rs @@ -1,15 +1,5 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // regression test for issue 11256 -#![crate_type] //~ ERROR `crate_type` requires a value +#![crate_type] //~ ERROR attribute must be of the form fn main() { return diff --git a/src/test/ui/no_crate_type.stderr b/src/test/ui/no_crate_type.stderr index 87f83f2d8df..6b76ab68658 100644 --- a/src/test/ui/no_crate_type.stderr +++ b/src/test/ui/no_crate_type.stderr @@ -1,10 +1,8 @@ -error: `crate_type` requires a value - --> $DIR/no_crate_type.rs:12:1 +error: attribute must be of the form `#[crate_type = "bin|lib|..."]` + --> $DIR/no_crate_type.rs:2:1 | -LL | #![crate_type] //~ ERROR `crate_type` requires a value +LL | #![crate_type] //~ ERROR attribute must be of the form | ^^^^^^^^^^^^^^ - | - = note: for example: `#![crate_type="lib"]` error: aborting due to previous error diff --git a/src/test/ui/no_owned_box_lang_item.rs b/src/test/ui/no_owned_box_lang_item.rs index 34d1075f9b7..b76699c19ac 100644 --- a/src/test/ui/no_owned_box_lang_item.rs +++ b/src/test/ui/no_owned_box_lang_item.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we don't ICE when we are missing the owned_box lang item. // error-pattern: requires `owned_box` lang_item diff --git a/src/test/ui/no_send-enum.rs b/src/test/ui/no_send-enum.rs index 83f19ed19ef..4b4d06f1e32 100644 --- a/src/test/ui/no_send-enum.rs +++ b/src/test/ui/no_send-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] use std::marker::Send; diff --git a/src/test/ui/no_send-enum.stderr b/src/test/ui/no_send-enum.stderr index 4d53c5f3013..71e3aee9194 100644 --- a/src/test/ui/no_send-enum.stderr +++ b/src/test/ui/no_send-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: `NoSend` cannot be sent between threads safely - --> $DIR/no_send-enum.rs:26:5 + --> $DIR/no_send-enum.rs:16:5 | LL | bar(x); | ^^^ `NoSend` cannot be sent between threads safely @@ -7,7 +7,7 @@ LL | bar(x); = help: within `Foo`, the trait `std::marker::Send` is not implemented for `NoSend` = note: required because it appears within the type `Foo` note: required by `bar` - --> $DIR/no_send-enum.rs:22:1 + --> $DIR/no_send-enum.rs:12:1 | LL | fn bar(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/no_send-rc.rs b/src/test/ui/no_send-rc.rs index d3616d14422..6ed0286ef18 100644 --- a/src/test/ui/no_send-rc.rs +++ b/src/test/ui/no_send-rc.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::rc::Rc; fn bar(_: T) {} diff --git a/src/test/ui/no_send-rc.stderr b/src/test/ui/no_send-rc.stderr index a0dce6c817c..2028cf77374 100644 --- a/src/test/ui/no_send-rc.stderr +++ b/src/test/ui/no_send-rc.stderr @@ -1,12 +1,12 @@ error[E0277]: `std::rc::Rc<{integer}>` cannot be sent between threads safely - --> $DIR/no_send-rc.rs:17:5 + --> $DIR/no_send-rc.rs:7:5 | LL | bar(x); | ^^^ `std::rc::Rc<{integer}>` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `std::rc::Rc<{integer}>` note: required by `bar` - --> $DIR/no_send-rc.rs:13:1 + --> $DIR/no_send-rc.rs:3:1 | LL | fn bar(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/no_send-struct.rs b/src/test/ui/no_send-struct.rs index d38d993e7e8..67816bfee5d 100644 --- a/src/test/ui/no_send-struct.rs +++ b/src/test/ui/no_send-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] use std::marker::Send; diff --git a/src/test/ui/no_send-struct.stderr b/src/test/ui/no_send-struct.stderr index dc7b5ec67f2..ca4ae054fd0 100644 --- a/src/test/ui/no_send-struct.stderr +++ b/src/test/ui/no_send-struct.stderr @@ -1,12 +1,12 @@ error[E0277]: `Foo` cannot be sent between threads safely - --> $DIR/no_send-struct.rs:25:5 + --> $DIR/no_send-struct.rs:15:5 | LL | bar(x); | ^^^ `Foo` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `Foo` note: required by `bar` - --> $DIR/no_send-struct.rs:21:1 + --> $DIR/no_send-struct.rs:11:1 | LL | fn bar(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/no_share-enum.rs b/src/test/ui/no_share-enum.rs index 77a7012b3b0..f5edb63cf86 100644 --- a/src/test/ui/no_share-enum.rs +++ b/src/test/ui/no_share-enum.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] use std::marker::Sync; diff --git a/src/test/ui/no_share-enum.stderr b/src/test/ui/no_share-enum.stderr index 57b889158d0..64d791d0262 100644 --- a/src/test/ui/no_share-enum.stderr +++ b/src/test/ui/no_share-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: `NoSync` cannot be shared between threads safely - --> $DIR/no_share-enum.rs:24:5 + --> $DIR/no_share-enum.rs:14:5 | LL | bar(x); | ^^^ `NoSync` cannot be shared between threads safely @@ -7,7 +7,7 @@ LL | bar(x); = help: within `Foo`, the trait `std::marker::Sync` is not implemented for `NoSync` = note: required because it appears within the type `Foo` note: required by `bar` - --> $DIR/no_share-enum.rs:20:1 + --> $DIR/no_share-enum.rs:10:1 | LL | fn bar(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/no_share-struct.rs b/src/test/ui/no_share-struct.rs index 34e43e9f2aa..35867d0f216 100644 --- a/src/test/ui/no_share-struct.rs +++ b/src/test/ui/no_share-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] use std::marker::Sync; diff --git a/src/test/ui/no_share-struct.stderr b/src/test/ui/no_share-struct.stderr index 66291db5e53..fc4bcfb5b3e 100644 --- a/src/test/ui/no_share-struct.stderr +++ b/src/test/ui/no_share-struct.stderr @@ -1,12 +1,12 @@ error[E0277]: `Foo` cannot be shared between threads safely - --> $DIR/no_share-struct.rs:22:5 + --> $DIR/no_share-struct.rs:12:5 | LL | bar(x); | ^^^ `Foo` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `Foo` note: required by `bar` - --> $DIR/no_share-struct.rs:18:1 + --> $DIR/no_share-struct.rs:8:1 | LL | fn bar(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/noexporttypeexe.rs b/src/test/ui/noexporttypeexe.rs index c950ef5b680..651c92830ed 100644 --- a/src/test/ui/noexporttypeexe.rs +++ b/src/test/ui/noexporttypeexe.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:noexporttypelib.rs extern crate noexporttypelib; diff --git a/src/test/ui/noexporttypeexe.stderr b/src/test/ui/noexporttypeexe.stderr index 1671b3eae49..329787fe744 100644 --- a/src/test/ui/noexporttypeexe.stderr +++ b/src/test/ui/noexporttypeexe.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/noexporttypeexe.rs:20:18 + --> $DIR/noexporttypeexe.rs:10:18 | LL | let x: isize = noexporttypelib::foo(); | ^^^^^^^^^^^^^^^^^^^^^^ expected isize, found enum `std::option::Option` diff --git a/src/test/ui/non-constant-expr-for-arr-len.rs b/src/test/ui/non-constant-expr-for-arr-len.rs index f8f46f30f8d..1b101d3233f 100644 --- a/src/test/ui/non-constant-expr-for-arr-len.rs +++ b/src/test/ui/non-constant-expr-for-arr-len.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that non constant exprs fail for array repeat syntax fn main() { diff --git a/src/test/ui/non-constant-expr-for-arr-len.stderr b/src/test/ui/non-constant-expr-for-arr-len.stderr index 9504c84b10e..b947cb7e19c 100644 --- a/src/test/ui/non-constant-expr-for-arr-len.stderr +++ b/src/test/ui/non-constant-expr-for-arr-len.stderr @@ -1,5 +1,5 @@ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/non-constant-expr-for-arr-len.rs:15:22 + --> $DIR/non-constant-expr-for-arr-len.rs:5:22 | LL | let _x = [0; n]; | ^ non-constant value diff --git a/src/test/ui/non-constant-in-const-path.rs b/src/test/ui/non-constant-in-const-path.rs index 1aae25105a8..343bb98aeb6 100644 --- a/src/test/ui/non-constant-in-const-path.rs +++ b/src/test/ui/non-constant-in-const-path.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = 0; match 1 { diff --git a/src/test/ui/non-constant-in-const-path.stderr b/src/test/ui/non-constant-in-const-path.stderr index 91ef9fd81e8..5936f76b2e0 100644 --- a/src/test/ui/non-constant-in-const-path.stderr +++ b/src/test/ui/non-constant-in-const-path.stderr @@ -1,5 +1,5 @@ error[E0080]: runtime values cannot be referenced in patterns - --> $DIR/non-constant-in-const-path.rs:14:15 + --> $DIR/non-constant-in-const-path.rs:4:15 | LL | 0 ..= x => {} | ^ diff --git a/src/test/ui/non-copyable-void.rs b/src/test/ui/non-copyable-void.rs index 63e5f963754..ddaaee436ae 100644 --- a/src/test/ui/non-copyable-void.rs +++ b/src/test/ui/non-copyable-void.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-wasm32-bare no libc to test ffi with -#![feature(libc)] +#![feature(rustc_private)] extern crate libc; diff --git a/src/test/ui/non-copyable-void.stderr b/src/test/ui/non-copyable-void.stderr index b5c83ec2289..4041e1935dc 100644 --- a/src/test/ui/non-copyable-void.stderr +++ b/src/test/ui/non-copyable-void.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `clone` found for type `libc::c_void` in the current scope - --> $DIR/non-copyable-void.rs:21:23 + --> $DIR/non-copyable-void.rs:11:23 | LL | let _z = (*y).clone(); | ^^^^^ diff --git a/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.rs b/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.rs new file mode 100644 index 00000000000..588fecbf10d --- /dev/null +++ b/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.rs @@ -0,0 +1,13 @@ +#![allow(illegal_floating_point_literal_pattern)] +#![deny(unreachable_patterns)] + +fn main() { + match 0.0 { + 0.0..=1.0 => {} + _ => {} // ok + } + + match 0.0 { //~ ERROR non-exhaustive patterns + 0.0..=1.0 => {} + } +} diff --git a/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr b/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr new file mode 100644 index 00000000000..2e285afb380 --- /dev/null +++ b/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr @@ -0,0 +1,9 @@ +error[E0004]: non-exhaustive patterns: `_` not covered + --> $DIR/non-exhaustive-float-range-match.rs:10:11 + | +LL | match 0.0 { //~ ERROR non-exhaustive patterns + | ^^^ pattern `_` not covered + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0004`. diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.rs b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.rs index 1d524217a12..9423a2891a6 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.rs +++ b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.rs @@ -1,17 +1,7 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] -enum t { a(u), b } -enum u { c, d } +enum T { A(U), B } +enum U { C, D } fn match_nested_vecs<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'static str { match (l1, l2) { //~ ERROR non-exhaustive patterns: `(Some(&[]), Err(_))` not covered @@ -23,9 +13,9 @@ fn match_nested_vecs<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'s } fn main() { - let x = t::a(u::c); - match x { //~ ERROR non-exhaustive patterns: `a(c)` not covered - t::a(u::d) => { panic!("hello"); } - t::b => { panic!("goodbye"); } + let x = T::A(U::C); + match x { //~ ERROR non-exhaustive patterns: `A(C)` not covered + T::A(U::D) => { panic!("hello"); } + T::B => { panic!("goodbye"); } } } diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr index 6fb9788139f..b2551c8dcf2 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr @@ -1,14 +1,14 @@ error[E0004]: non-exhaustive patterns: `(Some(&[]), Err(_))` not covered - --> $DIR/non-exhaustive-match-nested.rs:17:11 + --> $DIR/non-exhaustive-match-nested.rs:7:11 | LL | match (l1, l2) { //~ ERROR non-exhaustive patterns: `(Some(&[]), Err(_))` not covered | ^^^^^^^^ pattern `(Some(&[]), Err(_))` not covered -error[E0004]: non-exhaustive patterns: `a(c)` not covered - --> $DIR/non-exhaustive-match-nested.rs:27:11 +error[E0004]: non-exhaustive patterns: `A(C)` not covered + --> $DIR/non-exhaustive-match-nested.rs:17:11 | -LL | match x { //~ ERROR non-exhaustive patterns: `a(c)` not covered - | ^ pattern `a(c)` not covered +LL | match x { //~ ERROR non-exhaustive patterns: `A(C)` not covered + | ^ pattern `A(C)` not covered error: aborting due to 2 previous errors diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match.rs b/src/test/ui/non-exhaustive/non-exhaustive-match.rs index 13b62429f46..e888bcf5168 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-match.rs +++ b/src/test/ui/non-exhaustive/non-exhaustive-match.rs @@ -1,42 +1,33 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] #![allow(illegal_floating_point_literal_pattern)] -enum t { a, b, } +enum T { A, B } fn main() { - let x = t::a; - match x { t::b => { } } //~ ERROR non-exhaustive patterns: `a` not covered + let x = T::A; + match x { T::B => { } } //~ ERROR non-exhaustive patterns: `A` not covered match true { //~ ERROR non-exhaustive patterns: `false` not covered true => {} } match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered None => {} } - match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, _)` not covered + match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)` + // and `(_, _, 5i32..=2147483647i32)` not covered (_, _, 4) => {} } - match (t::a, t::a) { //~ ERROR non-exhaustive patterns: `(a, a)` not covered - (t::a, t::b) => {} - (t::b, t::a) => {} + match (T::A, T::A) { //~ ERROR non-exhaustive patterns: `(A, A)` not covered + (T::A, T::B) => {} + (T::B, T::A) => {} } - match t::a { //~ ERROR non-exhaustive patterns: `b` not covered - t::a => {} + match T::A { //~ ERROR non-exhaustive patterns: `B` not covered + T::A => {} } // This is exhaustive, though the algorithm got it wrong at one point - match (t::a, t::b) { - (t::a, _) => {} - (_, t::a) => {} - (t::b, t::b) => {} + match (T::A, T::B) { + (T::A, _) => {} + (_, T::A) => {} + (T::B, T::B) => {} } let vec = vec![Some(42), None, Some(21)]; let vec: &[Option] = &vec; diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match.stderr b/src/test/ui/non-exhaustive/non-exhaustive-match.stderr index f48a0bc15eb..8d2a73b2c6d 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-match.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-match.stderr @@ -1,47 +1,47 @@ -error[E0004]: non-exhaustive patterns: `a` not covered - --> $DIR/non-exhaustive-match.rs:18:11 +error[E0004]: non-exhaustive patterns: `A` not covered + --> $DIR/non-exhaustive-match.rs:8:11 | -LL | match x { t::b => { } } //~ ERROR non-exhaustive patterns: `a` not covered - | ^ pattern `a` not covered +LL | match x { T::B => { } } //~ ERROR non-exhaustive patterns: `A` not covered + | ^ pattern `A` not covered error[E0004]: non-exhaustive patterns: `false` not covered - --> $DIR/non-exhaustive-match.rs:19:11 + --> $DIR/non-exhaustive-match.rs:9:11 | LL | match true { //~ ERROR non-exhaustive patterns: `false` not covered | ^^^^ pattern `false` not covered error[E0004]: non-exhaustive patterns: `Some(_)` not covered - --> $DIR/non-exhaustive-match.rs:22:11 + --> $DIR/non-exhaustive-match.rs:12:11 | LL | match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered | ^^^^^^^^ pattern `Some(_)` not covered -error[E0004]: non-exhaustive patterns: `(_, _, _)` not covered - --> $DIR/non-exhaustive-match.rs:25:11 +error[E0004]: non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)` and `(_, _, 5i32..=2147483647i32)` not covered + --> $DIR/non-exhaustive-match.rs:15:11 | -LL | match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, _)` not covered - | ^^^^^^^^^ pattern `(_, _, _)` not covered +LL | match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)` + | ^^^^^^^^^ patterns `(_, _, -2147483648i32..=3i32)` and `(_, _, 5i32..=2147483647i32)` not covered -error[E0004]: non-exhaustive patterns: `(a, a)` not covered - --> $DIR/non-exhaustive-match.rs:28:11 +error[E0004]: non-exhaustive patterns: `(A, A)` not covered + --> $DIR/non-exhaustive-match.rs:19:11 | -LL | match (t::a, t::a) { //~ ERROR non-exhaustive patterns: `(a, a)` not covered - | ^^^^^^^^^^^^ pattern `(a, a)` not covered +LL | match (T::A, T::A) { //~ ERROR non-exhaustive patterns: `(A, A)` not covered + | ^^^^^^^^^^^^ pattern `(A, A)` not covered -error[E0004]: non-exhaustive patterns: `b` not covered - --> $DIR/non-exhaustive-match.rs:32:11 +error[E0004]: non-exhaustive patterns: `B` not covered + --> $DIR/non-exhaustive-match.rs:23:11 | -LL | match t::a { //~ ERROR non-exhaustive patterns: `b` not covered - | ^^^^ pattern `b` not covered +LL | match T::A { //~ ERROR non-exhaustive patterns: `B` not covered + | ^^^^ pattern `B` not covered error[E0004]: non-exhaustive patterns: `[]` not covered - --> $DIR/non-exhaustive-match.rs:43:11 + --> $DIR/non-exhaustive-match.rs:34:11 | LL | match *vec { //~ ERROR non-exhaustive patterns: `[]` not covered | ^^^^ pattern `[]` not covered error[E0004]: non-exhaustive patterns: `[_, _, _, _]` not covered - --> $DIR/non-exhaustive-match.rs:56:11 + --> $DIR/non-exhaustive-match.rs:47:11 | LL | match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered | ^^^^ pattern `[_, _, _, _]` not covered diff --git a/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.rs b/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.rs index dd14a10a2bc..9fcd4bdad72 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.rs +++ b/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] struct Foo { diff --git a/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr b/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr index e364e822ea8..d3a06e7b4b6 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr @@ -1,41 +1,41 @@ error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:19:11 + --> $DIR/non-exhaustive-pattern-witness.rs:9:11 | LL | match (Foo { first: true, second: None }) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered error[E0004]: non-exhaustive patterns: `Red` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:35:11 + --> $DIR/non-exhaustive-pattern-witness.rs:25:11 | LL | match Color::Red { | ^^^^^^^^^^ pattern `Red` not covered error[E0004]: non-exhaustive patterns: `East`, `South` and `West` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:47:11 + --> $DIR/non-exhaustive-pattern-witness.rs:37:11 | LL | match Direction::North { | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered - --> $DIR/non-exhaustive-pattern-witness.rs:58:11 + --> $DIR/non-exhaustive-pattern-witness.rs:48:11 | LL | match ExcessiveEnum::First { | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:66:11 + --> $DIR/non-exhaustive-pattern-witness.rs:56:11 | LL | match Color::Red { | ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` not covered error[E0004]: non-exhaustive patterns: `[Second(true), Second(false)]` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:82:11 + --> $DIR/non-exhaustive-pattern-witness.rs:72:11 | LL | match *x { | ^^ pattern `[Second(true), Second(false)]` not covered error[E0004]: non-exhaustive patterns: `((), false)` not covered - --> $DIR/non-exhaustive-pattern-witness.rs:95:11 + --> $DIR/non-exhaustive-pattern-witness.rs:85:11 | LL | match ((), false) { | ^^^^^^^^^^^ pattern `((), false)` not covered diff --git a/src/test/ui/non-interger-atomic.rs b/src/test/ui/non-interger-atomic.rs index 2a6e148ca79..00d07b7fe48 100644 --- a/src/test/ui/non-interger-atomic.rs +++ b/src/test/ui/non-interger-atomic.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(core_intrinsics)] #![allow(warnings)] #![crate_type = "rlib"] diff --git a/src/test/ui/non-interger-atomic.stderr b/src/test/ui/non-interger-atomic.stderr index 8cb114dd42c..9a49ee88d00 100644 --- a/src/test/ui/non-interger-atomic.stderr +++ b/src/test/ui/non-interger-atomic.stderr @@ -1,95 +1,95 @@ error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `bool` - --> $DIR/non-interger-atomic.rs:23:5 + --> $DIR/non-interger-atomic.rs:13:5 | LL | intrinsics::atomic_load(p); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `bool` - --> $DIR/non-interger-atomic.rs:28:5 + --> $DIR/non-interger-atomic.rs:18:5 | LL | intrinsics::atomic_store(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `bool` - --> $DIR/non-interger-atomic.rs:33:5 + --> $DIR/non-interger-atomic.rs:23:5 | LL | intrinsics::atomic_xchg(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `bool` - --> $DIR/non-interger-atomic.rs:38:5 + --> $DIR/non-interger-atomic.rs:28:5 | LL | intrinsics::atomic_cxchg(p, v, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `Foo` - --> $DIR/non-interger-atomic.rs:43:5 + --> $DIR/non-interger-atomic.rs:33:5 | LL | intrinsics::atomic_load(p); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `Foo` - --> $DIR/non-interger-atomic.rs:48:5 + --> $DIR/non-interger-atomic.rs:38:5 | LL | intrinsics::atomic_store(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `Foo` - --> $DIR/non-interger-atomic.rs:53:5 + --> $DIR/non-interger-atomic.rs:43:5 | LL | intrinsics::atomic_xchg(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `Foo` - --> $DIR/non-interger-atomic.rs:58:5 + --> $DIR/non-interger-atomic.rs:48:5 | LL | intrinsics::atomic_cxchg(p, v, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()` - --> $DIR/non-interger-atomic.rs:63:5 + --> $DIR/non-interger-atomic.rs:53:5 | LL | intrinsics::atomic_load(p); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()` - --> $DIR/non-interger-atomic.rs:68:5 + --> $DIR/non-interger-atomic.rs:58:5 | LL | intrinsics::atomic_store(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()` - --> $DIR/non-interger-atomic.rs:73:5 + --> $DIR/non-interger-atomic.rs:63:5 | LL | intrinsics::atomic_xchg(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()` - --> $DIR/non-interger-atomic.rs:78:5 + --> $DIR/non-interger-atomic.rs:68:5 | LL | intrinsics::atomic_cxchg(p, v, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]` - --> $DIR/non-interger-atomic.rs:83:5 + --> $DIR/non-interger-atomic.rs:73:5 | LL | intrinsics::atomic_load(p); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]` - --> $DIR/non-interger-atomic.rs:88:5 + --> $DIR/non-interger-atomic.rs:78:5 | LL | intrinsics::atomic_store(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]` - --> $DIR/non-interger-atomic.rs:93:5 + --> $DIR/non-interger-atomic.rs:83:5 | LL | intrinsics::atomic_xchg(p, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]` - --> $DIR/non-interger-atomic.rs:98:5 + --> $DIR/non-interger-atomic.rs:88:5 | LL | intrinsics::atomic_cxchg(p, v, v); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/noncopyable-class.rs b/src/test/ui/noncopyable-class.rs index f5712b0c957..11b6eb736e9 100644 --- a/src/test/ui/noncopyable-class.rs +++ b/src/test/ui/noncopyable-class.rs @@ -1,39 +1,29 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a class with a non-copyable field can't be // copied #[derive(Debug)] -struct bar { +struct Bar { x: isize, } -impl Drop for bar { +impl Drop for Bar { fn drop(&mut self) {} } -fn bar(x:isize) -> bar { - bar { +fn bar(x:isize) -> Bar { + Bar { x: x } } #[derive(Debug)] -struct foo { +struct Foo { i: isize, - j: bar, + j: Bar, } -fn foo(i:isize) -> foo { - foo { +fn foo(i:isize) -> Foo { + Foo { i: i, j: bar(5) } diff --git a/src/test/ui/noncopyable-class.stderr b/src/test/ui/noncopyable-class.stderr index 49ad30e56af..1876de87362 100644 --- a/src/test/ui/noncopyable-class.stderr +++ b/src/test/ui/noncopyable-class.stderr @@ -1,7 +1,7 @@ -error[E0599]: no method named `clone` found for type `foo` in the current scope - --> $DIR/noncopyable-class.rs:44:16 +error[E0599]: no method named `clone` found for type `Foo` in the current scope + --> $DIR/noncopyable-class.rs:34:16 | -LL | struct foo { +LL | struct Foo { | ---------- method `clone` not found for this ... LL | let _y = x.clone(); //~ ERROR no method named `clone` found diff --git a/src/test/ui/nonscalar-cast.rs b/src/test/ui/nonscalar-cast.rs index 0abbc05eef0..7e6f1fd038f 100644 --- a/src/test/ui/nonscalar-cast.rs +++ b/src/test/ui/nonscalar-cast.rs @@ -1,18 +1,8 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Debug)] -struct foo { +struct Foo { x: isize } fn main() { - println!("{}", foo{ x: 1 } as isize); //~ non-primitive cast: `foo` as `isize` [E0605] + println!("{}", Foo { x: 1 } as isize); //~ non-primitive cast: `Foo` as `isize` [E0605] } diff --git a/src/test/ui/nonscalar-cast.stderr b/src/test/ui/nonscalar-cast.stderr index d66ccd08f55..eb482b337e6 100644 --- a/src/test/ui/nonscalar-cast.stderr +++ b/src/test/ui/nonscalar-cast.stderr @@ -1,8 +1,8 @@ -error[E0605]: non-primitive cast: `foo` as `isize` - --> $DIR/nonscalar-cast.rs:17:20 +error[E0605]: non-primitive cast: `Foo` as `isize` + --> $DIR/nonscalar-cast.rs:7:20 | -LL | println!("{}", foo{ x: 1 } as isize); //~ non-primitive cast: `foo` as `isize` [E0605] - | ^^^^^^^^^^^^^^^^^^^^ +LL | println!("{}", Foo { x: 1 } as isize); //~ non-primitive cast: `Foo` as `isize` [E0605] + | ^^^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/not-clone-closure.rs b/src/test/ui/not-clone-closure.rs index 967cb3610ca..134d52c495c 100644 --- a/src/test/ui/not-clone-closure.rs +++ b/src/test/ui/not-clone-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that closures do not implement `Clone` if their environment is not `Clone`. struct S(i32); diff --git a/src/test/ui/not-clone-closure.stderr b/src/test/ui/not-clone-closure.stderr index eda9b1c495e..b583db1e4ba 100644 --- a/src/test/ui/not-clone-closure.stderr +++ b/src/test/ui/not-clone-closure.stderr @@ -1,10 +1,10 @@ -error[E0277]: the trait bound `S: std::clone::Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:17:17: 19:6 a:S]` - --> $DIR/not-clone-closure.rs:21:23 +error[E0277]: the trait bound `S: std::clone::Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]` + --> $DIR/not-clone-closure.rs:11:23 | LL | let hello = hello.clone(); //~ ERROR the trait bound `S: std::clone::Clone` is not satisfied - | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:17:17: 19:6 a:S]`, the trait `std::clone::Clone` is not implemented for `S` + | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]`, the trait `std::clone::Clone` is not implemented for `S` | - = note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:17:17: 19:6 a:S]` + = note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]` error: aborting due to previous error diff --git a/src/test/ui/not-copy-closure.nll.stderr b/src/test/ui/not-copy-closure.nll.stderr index b278df5e4b4..1a65bcf4473 100644 --- a/src/test/ui/not-copy-closure.nll.stderr +++ b/src/test/ui/not-copy-closure.nll.stderr @@ -1,10 +1,16 @@ error[E0382]: use of moved value: `hello` - --> $DIR/not-copy-closure.rs:20:13 + --> $DIR/not-copy-closure.rs:10:13 | LL | let b = hello; | ----- value moved here LL | let c = hello; //~ ERROR use of moved value: `hello` [E0382] | ^^^^^ value used here after move + | +note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `a` out of its environment + --> $DIR/not-copy-closure.rs:6:9 + | +LL | a += 1; + | ^ error: aborting due to previous error diff --git a/src/test/ui/not-copy-closure.rs b/src/test/ui/not-copy-closure.rs index 10567c5c961..f6530f9a410 100644 --- a/src/test/ui/not-copy-closure.rs +++ b/src/test/ui/not-copy-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that closures do not implement `Copy` if their environment is not `Copy`. fn main() { diff --git a/src/test/ui/not-copy-closure.stderr b/src/test/ui/not-copy-closure.stderr index 7193a3ed027..bdae06d3a66 100644 --- a/src/test/ui/not-copy-closure.stderr +++ b/src/test/ui/not-copy-closure.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `hello` - --> $DIR/not-copy-closure.rs:20:9 + --> $DIR/not-copy-closure.rs:10:9 | LL | let b = hello; | - value moved here @@ -7,7 +7,7 @@ LL | let c = hello; //~ ERROR use of moved value: `hello` [E0382] | ^ value used here after move | note: closure cannot be invoked more than once because it moves the variable `a` out of its environment - --> $DIR/not-copy-closure.rs:16:9 + --> $DIR/not-copy-closure.rs:6:9 | LL | a += 1; | ^ diff --git a/src/test/ui/not-enough-arguments.rs b/src/test/ui/not-enough-arguments.rs index c952906e5e8..309283ed7f4 100644 --- a/src/test/ui/not-enough-arguments.rs +++ b/src/test/ui/not-enough-arguments.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that the only error msg we report is the // mismatch between the # of params, and not other // unrelated errors. diff --git a/src/test/ui/not-enough-arguments.stderr b/src/test/ui/not-enough-arguments.stderr index 6a869cc5d55..c1ee43ea904 100644 --- a/src/test/ui/not-enough-arguments.stderr +++ b/src/test/ui/not-enough-arguments.stderr @@ -1,5 +1,5 @@ error[E0061]: this function takes 4 parameters but 3 parameters were supplied - --> $DIR/not-enough-arguments.rs:20:3 + --> $DIR/not-enough-arguments.rs:10:3 | LL | fn foo(a: isize, b: isize, c: isize, d:isize) { | --------------------------------------------- defined here diff --git a/src/test/ui/not-panic/not-panic-safe-2.rs b/src/test/ui/not-panic/not-panic-safe-2.rs index 5490acf4bd6..cd074281d00 100644 --- a/src/test/ui/not-panic/not-panic-safe-2.rs +++ b/src/test/ui/not-panic/not-panic-safe-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] use std::panic::UnwindSafe; diff --git a/src/test/ui/not-panic/not-panic-safe-2.stderr b/src/test/ui/not-panic/not-panic-safe-2.stderr index 19408623ea3..4db127a4639 100644 --- a/src/test/ui/not-panic/not-panic-safe-2.stderr +++ b/src/test/ui/not-panic/not-panic-safe-2.stderr @@ -1,5 +1,5 @@ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-2.rs:20:5 + --> $DIR/not-panic-safe-2.rs:10:5 | LL | assert::>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary @@ -8,13 +8,13 @@ LL | assert::>>(); = note: required because it appears within the type `std::cell::RefCell` = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `std::rc::Rc>` note: required by `assert` - --> $DIR/not-panic-safe-2.rs:17:1 + --> $DIR/not-panic-safe-2.rs:7:1 | LL | fn assert() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-2.rs:20:5 + --> $DIR/not-panic-safe-2.rs:10:5 | LL | assert::>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary @@ -24,7 +24,7 @@ LL | assert::>>(); = note: required because it appears within the type `std::cell::RefCell` = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `std::rc::Rc>` note: required by `assert` - --> $DIR/not-panic-safe-2.rs:17:1 + --> $DIR/not-panic-safe-2.rs:7:1 | LL | fn assert() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/not-panic/not-panic-safe-3.rs b/src/test/ui/not-panic/not-panic-safe-3.rs index 0fac395a115..b0ba3781f34 100644 --- a/src/test/ui/not-panic/not-panic-safe-3.rs +++ b/src/test/ui/not-panic/not-panic-safe-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] use std::panic::UnwindSafe; diff --git a/src/test/ui/not-panic/not-panic-safe-3.stderr b/src/test/ui/not-panic/not-panic-safe-3.stderr index a353c82c687..1f87f20f2e2 100644 --- a/src/test/ui/not-panic/not-panic-safe-3.stderr +++ b/src/test/ui/not-panic/not-panic-safe-3.stderr @@ -1,5 +1,5 @@ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-3.rs:20:5 + --> $DIR/not-panic-safe-3.rs:10:5 | LL | assert::>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary @@ -8,13 +8,13 @@ LL | assert::>>(); = note: required because it appears within the type `std::cell::RefCell` = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `std::sync::Arc>` note: required by `assert` - --> $DIR/not-panic-safe-3.rs:17:1 + --> $DIR/not-panic-safe-3.rs:7:1 | LL | fn assert() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-3.rs:20:5 + --> $DIR/not-panic-safe-3.rs:10:5 | LL | assert::>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary @@ -24,7 +24,7 @@ LL | assert::>>(); = note: required because it appears within the type `std::cell::RefCell` = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `std::sync::Arc>` note: required by `assert` - --> $DIR/not-panic-safe-3.rs:17:1 + --> $DIR/not-panic-safe-3.rs:7:1 | LL | fn assert() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/not-panic/not-panic-safe-4.rs b/src/test/ui/not-panic/not-panic-safe-4.rs index bf0392018b5..ed2760576d8 100644 --- a/src/test/ui/not-panic/not-panic-safe-4.rs +++ b/src/test/ui/not-panic/not-panic-safe-4.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] use std::panic::UnwindSafe; diff --git a/src/test/ui/not-panic/not-panic-safe-4.stderr b/src/test/ui/not-panic/not-panic-safe-4.stderr index 27d3defe123..24f64900296 100644 --- a/src/test/ui/not-panic/not-panic-safe-4.stderr +++ b/src/test/ui/not-panic/not-panic-safe-4.stderr @@ -1,5 +1,5 @@ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-4.rs:19:5 + --> $DIR/not-panic-safe-4.rs:9:5 | LL | assert::<&RefCell>(); | ^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary @@ -8,13 +8,13 @@ LL | assert::<&RefCell>(); = note: required because it appears within the type `std::cell::RefCell` = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `&std::cell::RefCell` note: required by `assert` - --> $DIR/not-panic-safe-4.rs:16:1 + --> $DIR/not-panic-safe-4.rs:6:1 | LL | fn assert() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-4.rs:19:5 + --> $DIR/not-panic-safe-4.rs:9:5 | LL | assert::<&RefCell>(); | ^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary @@ -24,7 +24,7 @@ LL | assert::<&RefCell>(); = note: required because it appears within the type `std::cell::RefCell` = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `&std::cell::RefCell` note: required by `assert` - --> $DIR/not-panic-safe-4.rs:16:1 + --> $DIR/not-panic-safe-4.rs:6:1 | LL | fn assert() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/not-panic/not-panic-safe-5.rs b/src/test/ui/not-panic/not-panic-safe-5.rs index 627a0fe78cf..e0d37517dd4 100644 --- a/src/test/ui/not-panic/not-panic-safe-5.rs +++ b/src/test/ui/not-panic/not-panic-safe-5.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] use std::panic::UnwindSafe; diff --git a/src/test/ui/not-panic/not-panic-safe-5.stderr b/src/test/ui/not-panic/not-panic-safe-5.stderr index ba3b3fadb6a..46400a4b03c 100644 --- a/src/test/ui/not-panic/not-panic-safe-5.stderr +++ b/src/test/ui/not-panic/not-panic-safe-5.stderr @@ -1,5 +1,5 @@ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-5.rs:19:5 + --> $DIR/not-panic-safe-5.rs:9:5 | LL | assert::<*const UnsafeCell>(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary @@ -7,7 +7,7 @@ LL | assert::<*const UnsafeCell>(); //~ ERROR E0277 = help: the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell` = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `*const std::cell::UnsafeCell` note: required by `assert` - --> $DIR/not-panic-safe-5.rs:16:1 + --> $DIR/not-panic-safe-5.rs:6:1 | LL | fn assert() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/not-panic/not-panic-safe-6.rs b/src/test/ui/not-panic/not-panic-safe-6.rs index 950f0a0b53a..a42e337ad93 100644 --- a/src/test/ui/not-panic/not-panic-safe-6.rs +++ b/src/test/ui/not-panic/not-panic-safe-6.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] use std::panic::UnwindSafe; diff --git a/src/test/ui/not-panic/not-panic-safe-6.stderr b/src/test/ui/not-panic/not-panic-safe-6.stderr index da6c2a58294..a4c75ec7c61 100644 --- a/src/test/ui/not-panic/not-panic-safe-6.stderr +++ b/src/test/ui/not-panic/not-panic-safe-6.stderr @@ -1,5 +1,5 @@ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-6.rs:19:5 + --> $DIR/not-panic-safe-6.rs:9:5 | LL | assert::<*mut RefCell>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary @@ -8,13 +8,13 @@ LL | assert::<*mut RefCell>(); = note: required because it appears within the type `std::cell::RefCell` = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `*mut std::cell::RefCell` note: required by `assert` - --> $DIR/not-panic-safe-6.rs:16:1 + --> $DIR/not-panic-safe-6.rs:6:1 | LL | fn assert() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/not-panic-safe-6.rs:19:5 + --> $DIR/not-panic-safe-6.rs:9:5 | LL | assert::<*mut RefCell>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary @@ -24,7 +24,7 @@ LL | assert::<*mut RefCell>(); = note: required because it appears within the type `std::cell::RefCell` = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `*mut std::cell::RefCell` note: required by `assert` - --> $DIR/not-panic-safe-6.rs:16:1 + --> $DIR/not-panic-safe-6.rs:6:1 | LL | fn assert() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/not-panic/not-panic-safe.rs b/src/test/ui/not-panic/not-panic-safe.rs index 0ebf3d3fed7..93a8506ab18 100644 --- a/src/test/ui/not-panic/not-panic-safe.rs +++ b/src/test/ui/not-panic/not-panic-safe.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![feature(recover)] diff --git a/src/test/ui/not-panic/not-panic-safe.stderr b/src/test/ui/not-panic/not-panic-safe.stderr index f349b5d2e26..2d12e697d5a 100644 --- a/src/test/ui/not-panic/not-panic-safe.stderr +++ b/src/test/ui/not-panic/not-panic-safe.stderr @@ -1,12 +1,12 @@ error[E0277]: the type `&mut i32` may not be safely transferred across an unwind boundary - --> $DIR/not-panic-safe.rs:19:5 + --> $DIR/not-panic-safe.rs:9:5 | LL | assert::<&mut i32>(); | ^^^^^^^^^^^^^^^^^^ `&mut i32` may not be safely transferred across an unwind boundary | = help: the trait `std::panic::UnwindSafe` is not implemented for `&mut i32` note: required by `assert` - --> $DIR/not-panic-safe.rs:16:1 + --> $DIR/not-panic-safe.rs:6:1 | LL | fn assert() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/not-sync.rs b/src/test/ui/not-sync.rs index a383244f415..70ba1fc5809 100644 --- a/src/test/ui/not-sync.rs +++ b/src/test/ui/not-sync.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cell::{Cell, RefCell}; use std::rc::{Rc, Weak}; use std::sync::mpsc::{Receiver, Sender}; diff --git a/src/test/ui/not-sync.stderr b/src/test/ui/not-sync.stderr index 026fd5dd713..d102528bc6e 100644 --- a/src/test/ui/not-sync.stderr +++ b/src/test/ui/not-sync.stderr @@ -1,77 +1,77 @@ error[E0277]: `std::cell::Cell` cannot be shared between threads safely - --> $DIR/not-sync.rs:18:5 + --> $DIR/not-sync.rs:8:5 | LL | test::>(); | ^^^^^^^^^^^^^^^^^ `std::cell::Cell` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::cell::Cell` note: required by `test` - --> $DIR/not-sync.rs:15:1 + --> $DIR/not-sync.rs:5:1 | LL | fn test() {} | ^^^^^^^^^^^^^^^^^^ error[E0277]: `std::cell::RefCell` cannot be shared between threads safely - --> $DIR/not-sync.rs:20:5 + --> $DIR/not-sync.rs:10:5 | LL | test::>(); | ^^^^^^^^^^^^^^^^^^^^ `std::cell::RefCell` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::cell::RefCell` note: required by `test` - --> $DIR/not-sync.rs:15:1 + --> $DIR/not-sync.rs:5:1 | LL | fn test() {} | ^^^^^^^^^^^^^^^^^^ error[E0277]: `std::rc::Rc` cannot be shared between threads safely - --> $DIR/not-sync.rs:23:5 + --> $DIR/not-sync.rs:13:5 | LL | test::>(); | ^^^^^^^^^^^^^^^ `std::rc::Rc` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::rc::Rc` note: required by `test` - --> $DIR/not-sync.rs:15:1 + --> $DIR/not-sync.rs:5:1 | LL | fn test() {} | ^^^^^^^^^^^^^^^^^^ error[E0277]: `std::rc::Weak` cannot be shared between threads safely - --> $DIR/not-sync.rs:25:5 + --> $DIR/not-sync.rs:15:5 | LL | test::>(); | ^^^^^^^^^^^^^^^^^ `std::rc::Weak` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::rc::Weak` note: required by `test` - --> $DIR/not-sync.rs:15:1 + --> $DIR/not-sync.rs:5:1 | LL | fn test() {} | ^^^^^^^^^^^^^^^^^^ error[E0277]: `std::sync::mpsc::Receiver` cannot be shared between threads safely - --> $DIR/not-sync.rs:28:5 + --> $DIR/not-sync.rs:18:5 | LL | test::>(); | ^^^^^^^^^^^^^^^^^^^^^ `std::sync::mpsc::Receiver` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Receiver` note: required by `test` - --> $DIR/not-sync.rs:15:1 + --> $DIR/not-sync.rs:5:1 | LL | fn test() {} | ^^^^^^^^^^^^^^^^^^ error[E0277]: `std::sync::mpsc::Sender` cannot be shared between threads safely - --> $DIR/not-sync.rs:30:5 + --> $DIR/not-sync.rs:20:5 | LL | test::>(); | ^^^^^^^^^^^^^^^^^^^ `std::sync::mpsc::Sender` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Sender` note: required by `test` - --> $DIR/not-sync.rs:15:1 + --> $DIR/not-sync.rs:5:1 | LL | fn test() {} | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/numeric/numeric-cast-2.rs b/src/test/ui/numeric/numeric-cast-2.rs index 2092b6bce37..ad2de5d2bd5 100644 --- a/src/test/ui/numeric/numeric-cast-2.rs +++ b/src/test/ui/numeric/numeric-cast-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() -> i32 { 4 } diff --git a/src/test/ui/numeric/numeric-cast-2.stderr b/src/test/ui/numeric/numeric-cast-2.stderr index 3d485583717..79088f0e2ca 100644 --- a/src/test/ui/numeric/numeric-cast-2.stderr +++ b/src/test/ui/numeric/numeric-cast-2.stderr @@ -1,17 +1,17 @@ error[E0308]: mismatched types - --> $DIR/numeric-cast-2.rs:15:18 + --> $DIR/numeric-cast-2.rs:5:18 | LL | let x: u16 = foo(); | ^^^^^ expected u16, found i32 error[E0308]: mismatched types - --> $DIR/numeric-cast-2.rs:17:18 + --> $DIR/numeric-cast-2.rs:7:18 | LL | let y: i64 = x + x; | ^^^^^ expected i64, found u16 error[E0308]: mismatched types - --> $DIR/numeric-cast-2.rs:19:18 + --> $DIR/numeric-cast-2.rs:9:18 | LL | let z: i32 = x + x; | ^^^^^ expected i32, found u16 diff --git a/src/test/ui/numeric/numeric-cast.rs b/src/test/ui/numeric/numeric-cast.rs index 69bfdfa94b1..39378c288fe 100644 --- a/src/test/ui/numeric/numeric-cast.rs +++ b/src/test/ui/numeric/numeric-cast.rs @@ -1,14 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn foo(_x: N) {} fn main() { diff --git a/src/test/ui/numeric/numeric-cast.stderr b/src/test/ui/numeric/numeric-cast.stderr index 4aac65ff4cb..2c4f6e20f1f 100644 --- a/src/test/ui/numeric/numeric-cast.stderr +++ b/src/test/ui/numeric/numeric-cast.stderr @@ -1,143 +1,143 @@ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:29:18 + --> $DIR/numeric-cast.rs:18:18 | LL | foo::(x_u64); | ^^^^^ expected usize, found u64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:31:18 + --> $DIR/numeric-cast.rs:20:18 | LL | foo::(x_u32); | ^^^^^ expected usize, found u32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:33:18 + --> $DIR/numeric-cast.rs:22:18 | LL | foo::(x_u16); | ^^^^^ expected usize, found u16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:35:18 + --> $DIR/numeric-cast.rs:24:18 | LL | foo::(x_u8); | ^^^^ expected usize, found u8 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:37:18 + --> $DIR/numeric-cast.rs:26:18 | LL | foo::(x_isize); | ^^^^^^^ expected usize, found isize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:39:18 + --> $DIR/numeric-cast.rs:28:18 | LL | foo::(x_i64); | ^^^^^ expected usize, found i64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:41:18 + --> $DIR/numeric-cast.rs:30:18 | LL | foo::(x_i32); | ^^^^^ expected usize, found i32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:43:18 + --> $DIR/numeric-cast.rs:32:18 | LL | foo::(x_i16); | ^^^^^ expected usize, found i16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:45:18 + --> $DIR/numeric-cast.rs:34:18 | LL | foo::(x_i8); | ^^^^ expected usize, found i8 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:47:18 + --> $DIR/numeric-cast.rs:36:18 | LL | foo::(x_f64); | ^^^^^ expected usize, found f64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:49:18 + --> $DIR/numeric-cast.rs:38:18 | LL | foo::(x_f32); | ^^^^^ expected usize, found f32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:52:18 + --> $DIR/numeric-cast.rs:41:18 | LL | foo::(x_usize); | ^^^^^^^ expected isize, found usize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:54:18 + --> $DIR/numeric-cast.rs:43:18 | LL | foo::(x_u64); | ^^^^^ expected isize, found u64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:56:18 + --> $DIR/numeric-cast.rs:45:18 | LL | foo::(x_u32); | ^^^^^ expected isize, found u32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:58:18 + --> $DIR/numeric-cast.rs:47:18 | LL | foo::(x_u16); | ^^^^^ expected isize, found u16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:60:18 + --> $DIR/numeric-cast.rs:49:18 | LL | foo::(x_u8); | ^^^^ expected isize, found u8 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:63:18 + --> $DIR/numeric-cast.rs:52:18 | LL | foo::(x_i64); | ^^^^^ expected isize, found i64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:65:18 + --> $DIR/numeric-cast.rs:54:18 | LL | foo::(x_i32); | ^^^^^ expected isize, found i32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:67:18 + --> $DIR/numeric-cast.rs:56:18 | LL | foo::(x_i16); | ^^^^^ expected isize, found i16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:69:18 + --> $DIR/numeric-cast.rs:58:18 | LL | foo::(x_i8); | ^^^^ expected isize, found i8 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:71:18 + --> $DIR/numeric-cast.rs:60:18 | LL | foo::(x_f64); | ^^^^^ expected isize, found f64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:73:18 + --> $DIR/numeric-cast.rs:62:18 | LL | foo::(x_f32); | ^^^^^ expected isize, found f32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:76:16 + --> $DIR/numeric-cast.rs:65:16 | LL | foo::(x_usize); | ^^^^^^^ expected u64, found usize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:79:16 + --> $DIR/numeric-cast.rs:68:16 | LL | foo::(x_u32); | ^^^^^ expected u64, found u32 @@ -147,7 +147,7 @@ LL | foo::(x_u32.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:81:16 + --> $DIR/numeric-cast.rs:70:16 | LL | foo::(x_u16); | ^^^^^ expected u64, found u16 @@ -157,7 +157,7 @@ LL | foo::(x_u16.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:83:16 + --> $DIR/numeric-cast.rs:72:16 | LL | foo::(x_u8); | ^^^^ expected u64, found u8 @@ -167,85 +167,85 @@ LL | foo::(x_u8.into()); | ^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:85:16 + --> $DIR/numeric-cast.rs:74:16 | LL | foo::(x_isize); | ^^^^^^^ expected u64, found isize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:87:16 + --> $DIR/numeric-cast.rs:76:16 | LL | foo::(x_i64); | ^^^^^ expected u64, found i64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:89:16 + --> $DIR/numeric-cast.rs:78:16 | LL | foo::(x_i32); | ^^^^^ expected u64, found i32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:91:16 + --> $DIR/numeric-cast.rs:80:16 | LL | foo::(x_i16); | ^^^^^ expected u64, found i16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:93:16 + --> $DIR/numeric-cast.rs:82:16 | LL | foo::(x_i8); | ^^^^ expected u64, found i8 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:95:16 + --> $DIR/numeric-cast.rs:84:16 | LL | foo::(x_f64); | ^^^^^ expected u64, found f64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:97:16 + --> $DIR/numeric-cast.rs:86:16 | LL | foo::(x_f32); | ^^^^^ expected u64, found f32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:100:16 + --> $DIR/numeric-cast.rs:89:16 | LL | foo::(x_usize); | ^^^^^^^ expected i64, found usize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:102:16 + --> $DIR/numeric-cast.rs:91:16 | LL | foo::(x_u64); | ^^^^^ expected i64, found u64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:104:16 + --> $DIR/numeric-cast.rs:93:16 | LL | foo::(x_u32); | ^^^^^ expected i64, found u32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:106:16 + --> $DIR/numeric-cast.rs:95:16 | LL | foo::(x_u16); | ^^^^^ expected i64, found u16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:108:16 + --> $DIR/numeric-cast.rs:97:16 | LL | foo::(x_u8); | ^^^^ expected i64, found u8 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:110:16 + --> $DIR/numeric-cast.rs:99:16 | LL | foo::(x_isize); | ^^^^^^^ expected i64, found isize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:113:16 + --> $DIR/numeric-cast.rs:102:16 | LL | foo::(x_i32); | ^^^^^ expected i64, found i32 @@ -255,7 +255,7 @@ LL | foo::(x_i32.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:115:16 + --> $DIR/numeric-cast.rs:104:16 | LL | foo::(x_i16); | ^^^^^ expected i64, found i16 @@ -265,7 +265,7 @@ LL | foo::(x_i16.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:117:16 + --> $DIR/numeric-cast.rs:106:16 | LL | foo::(x_i8); | ^^^^ expected i64, found i8 @@ -275,31 +275,31 @@ LL | foo::(x_i8.into()); | ^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:119:16 + --> $DIR/numeric-cast.rs:108:16 | LL | foo::(x_f64); | ^^^^^ expected i64, found f64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:121:16 + --> $DIR/numeric-cast.rs:110:16 | LL | foo::(x_f32); | ^^^^^ expected i64, found f32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:124:16 + --> $DIR/numeric-cast.rs:113:16 | LL | foo::(x_usize); | ^^^^^^^ expected u32, found usize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:126:16 + --> $DIR/numeric-cast.rs:115:16 | LL | foo::(x_u64); | ^^^^^ expected u32, found u64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:129:16 + --> $DIR/numeric-cast.rs:118:16 | LL | foo::(x_u16); | ^^^^^ expected u32, found u16 @@ -309,7 +309,7 @@ LL | foo::(x_u16.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:131:16 + --> $DIR/numeric-cast.rs:120:16 | LL | foo::(x_u8); | ^^^^ expected u32, found u8 @@ -319,91 +319,91 @@ LL | foo::(x_u8.into()); | ^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:133:16 + --> $DIR/numeric-cast.rs:122:16 | LL | foo::(x_isize); | ^^^^^^^ expected u32, found isize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:135:16 + --> $DIR/numeric-cast.rs:124:16 | LL | foo::(x_i64); | ^^^^^ expected u32, found i64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:137:16 + --> $DIR/numeric-cast.rs:126:16 | LL | foo::(x_i32); | ^^^^^ expected u32, found i32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:139:16 + --> $DIR/numeric-cast.rs:128:16 | LL | foo::(x_i16); | ^^^^^ expected u32, found i16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:141:16 + --> $DIR/numeric-cast.rs:130:16 | LL | foo::(x_i8); | ^^^^ expected u32, found i8 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:143:16 + --> $DIR/numeric-cast.rs:132:16 | LL | foo::(x_f64); | ^^^^^ expected u32, found f64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:145:16 + --> $DIR/numeric-cast.rs:134:16 | LL | foo::(x_f32); | ^^^^^ expected u32, found f32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:148:16 + --> $DIR/numeric-cast.rs:137:16 | LL | foo::(x_usize); | ^^^^^^^ expected i32, found usize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:150:16 + --> $DIR/numeric-cast.rs:139:16 | LL | foo::(x_u64); | ^^^^^ expected i32, found u64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:152:16 + --> $DIR/numeric-cast.rs:141:16 | LL | foo::(x_u32); | ^^^^^ expected i32, found u32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:154:16 + --> $DIR/numeric-cast.rs:143:16 | LL | foo::(x_u16); | ^^^^^ expected i32, found u16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:156:16 + --> $DIR/numeric-cast.rs:145:16 | LL | foo::(x_u8); | ^^^^ expected i32, found u8 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:158:16 + --> $DIR/numeric-cast.rs:147:16 | LL | foo::(x_isize); | ^^^^^^^ expected i32, found isize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:160:16 + --> $DIR/numeric-cast.rs:149:16 | LL | foo::(x_i64); | ^^^^^ expected i32, found i64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:163:16 + --> $DIR/numeric-cast.rs:152:16 | LL | foo::(x_i16); | ^^^^^ expected i32, found i16 @@ -413,7 +413,7 @@ LL | foo::(x_i16.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:165:16 + --> $DIR/numeric-cast.rs:154:16 | LL | foo::(x_i8); | ^^^^ expected i32, found i8 @@ -423,37 +423,37 @@ LL | foo::(x_i8.into()); | ^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:167:16 + --> $DIR/numeric-cast.rs:156:16 | LL | foo::(x_f64); | ^^^^^ expected i32, found f64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:169:16 + --> $DIR/numeric-cast.rs:158:16 | LL | foo::(x_f32); | ^^^^^ expected i32, found f32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:172:16 + --> $DIR/numeric-cast.rs:161:16 | LL | foo::(x_usize); | ^^^^^^^ expected u16, found usize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:174:16 + --> $DIR/numeric-cast.rs:163:16 | LL | foo::(x_u64); | ^^^^^ expected u16, found u64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:176:16 + --> $DIR/numeric-cast.rs:165:16 | LL | foo::(x_u32); | ^^^^^ expected u16, found u32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:179:16 + --> $DIR/numeric-cast.rs:168:16 | LL | foo::(x_u8); | ^^^^ expected u16, found u8 @@ -463,97 +463,97 @@ LL | foo::(x_u8.into()); | ^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:181:16 + --> $DIR/numeric-cast.rs:170:16 | LL | foo::(x_isize); | ^^^^^^^ expected u16, found isize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:183:16 + --> $DIR/numeric-cast.rs:172:16 | LL | foo::(x_i64); | ^^^^^ expected u16, found i64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:185:16 + --> $DIR/numeric-cast.rs:174:16 | LL | foo::(x_i32); | ^^^^^ expected u16, found i32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:187:16 + --> $DIR/numeric-cast.rs:176:16 | LL | foo::(x_i16); | ^^^^^ expected u16, found i16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:189:16 + --> $DIR/numeric-cast.rs:178:16 | LL | foo::(x_i8); | ^^^^ expected u16, found i8 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:191:16 + --> $DIR/numeric-cast.rs:180:16 | LL | foo::(x_f64); | ^^^^^ expected u16, found f64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:193:16 + --> $DIR/numeric-cast.rs:182:16 | LL | foo::(x_f32); | ^^^^^ expected u16, found f32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:196:16 + --> $DIR/numeric-cast.rs:185:16 | LL | foo::(x_usize); | ^^^^^^^ expected i16, found usize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:198:16 + --> $DIR/numeric-cast.rs:187:16 | LL | foo::(x_u64); | ^^^^^ expected i16, found u64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:200:16 + --> $DIR/numeric-cast.rs:189:16 | LL | foo::(x_u32); | ^^^^^ expected i16, found u32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:202:16 + --> $DIR/numeric-cast.rs:191:16 | LL | foo::(x_u16); | ^^^^^ expected i16, found u16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:204:16 + --> $DIR/numeric-cast.rs:193:16 | LL | foo::(x_u8); | ^^^^ expected i16, found u8 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:206:16 + --> $DIR/numeric-cast.rs:195:16 | LL | foo::(x_isize); | ^^^^^^^ expected i16, found isize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:208:16 + --> $DIR/numeric-cast.rs:197:16 | LL | foo::(x_i64); | ^^^^^ expected i16, found i64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:210:16 + --> $DIR/numeric-cast.rs:199:16 | LL | foo::(x_i32); | ^^^^^ expected i16, found i32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:213:16 + --> $DIR/numeric-cast.rs:202:16 | LL | foo::(x_i8); | ^^^^ expected i16, found i8 @@ -563,163 +563,163 @@ LL | foo::(x_i8.into()); | ^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:215:16 + --> $DIR/numeric-cast.rs:204:16 | LL | foo::(x_f64); | ^^^^^ expected i16, found f64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:217:16 + --> $DIR/numeric-cast.rs:206:16 | LL | foo::(x_f32); | ^^^^^ expected i16, found f32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:220:15 + --> $DIR/numeric-cast.rs:209:15 | LL | foo::(x_usize); | ^^^^^^^ expected u8, found usize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:222:15 + --> $DIR/numeric-cast.rs:211:15 | LL | foo::(x_u64); | ^^^^^ expected u8, found u64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:224:15 + --> $DIR/numeric-cast.rs:213:15 | LL | foo::(x_u32); | ^^^^^ expected u8, found u32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:226:15 + --> $DIR/numeric-cast.rs:215:15 | LL | foo::(x_u16); | ^^^^^ expected u8, found u16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:229:15 + --> $DIR/numeric-cast.rs:218:15 | LL | foo::(x_isize); | ^^^^^^^ expected u8, found isize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:231:15 + --> $DIR/numeric-cast.rs:220:15 | LL | foo::(x_i64); | ^^^^^ expected u8, found i64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:233:15 + --> $DIR/numeric-cast.rs:222:15 | LL | foo::(x_i32); | ^^^^^ expected u8, found i32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:235:15 + --> $DIR/numeric-cast.rs:224:15 | LL | foo::(x_i16); | ^^^^^ expected u8, found i16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:237:15 + --> $DIR/numeric-cast.rs:226:15 | LL | foo::(x_i8); | ^^^^ expected u8, found i8 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:239:15 + --> $DIR/numeric-cast.rs:228:15 | LL | foo::(x_f64); | ^^^^^ expected u8, found f64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:241:15 + --> $DIR/numeric-cast.rs:230:15 | LL | foo::(x_f32); | ^^^^^ expected u8, found f32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:244:15 + --> $DIR/numeric-cast.rs:233:15 | LL | foo::(x_usize); | ^^^^^^^ expected i8, found usize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:246:15 + --> $DIR/numeric-cast.rs:235:15 | LL | foo::(x_u64); | ^^^^^ expected i8, found u64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:248:15 + --> $DIR/numeric-cast.rs:237:15 | LL | foo::(x_u32); | ^^^^^ expected i8, found u32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:250:15 + --> $DIR/numeric-cast.rs:239:15 | LL | foo::(x_u16); | ^^^^^ expected i8, found u16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:252:15 + --> $DIR/numeric-cast.rs:241:15 | LL | foo::(x_u8); | ^^^^ expected i8, found u8 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:254:15 + --> $DIR/numeric-cast.rs:243:15 | LL | foo::(x_isize); | ^^^^^^^ expected i8, found isize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:256:15 + --> $DIR/numeric-cast.rs:245:15 | LL | foo::(x_i64); | ^^^^^ expected i8, found i64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:258:15 + --> $DIR/numeric-cast.rs:247:15 | LL | foo::(x_i32); | ^^^^^ expected i8, found i32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:260:15 + --> $DIR/numeric-cast.rs:249:15 | LL | foo::(x_i16); | ^^^^^ expected i8, found i16 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:263:15 + --> $DIR/numeric-cast.rs:252:15 | LL | foo::(x_f64); | ^^^^^ expected i8, found f64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:265:15 + --> $DIR/numeric-cast.rs:254:15 | LL | foo::(x_f32); | ^^^^^ expected i8, found f32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:268:16 + --> $DIR/numeric-cast.rs:257:16 | LL | foo::(x_usize); | ^^^^^^^ expected f64, found usize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:270:16 + --> $DIR/numeric-cast.rs:259:16 | LL | foo::(x_u64); | ^^^^^ expected f64, found u64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:272:16 + --> $DIR/numeric-cast.rs:261:16 | LL | foo::(x_u32); | ^^^^^ expected f64, found u32 @@ -729,7 +729,7 @@ LL | foo::(x_u32.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:274:16 + --> $DIR/numeric-cast.rs:263:16 | LL | foo::(x_u16); | ^^^^^ expected f64, found u16 @@ -739,7 +739,7 @@ LL | foo::(x_u16.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:276:16 + --> $DIR/numeric-cast.rs:265:16 | LL | foo::(x_u8); | ^^^^ expected f64, found u8 @@ -749,19 +749,19 @@ LL | foo::(x_u8.into()); | ^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:278:16 + --> $DIR/numeric-cast.rs:267:16 | LL | foo::(x_isize); | ^^^^^^^ expected f64, found isize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:280:16 + --> $DIR/numeric-cast.rs:269:16 | LL | foo::(x_i64); | ^^^^^ expected f64, found i64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:282:16 + --> $DIR/numeric-cast.rs:271:16 | LL | foo::(x_i32); | ^^^^^ expected f64, found i32 @@ -771,7 +771,7 @@ LL | foo::(x_i32.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:284:16 + --> $DIR/numeric-cast.rs:273:16 | LL | foo::(x_i16); | ^^^^^ expected f64, found i16 @@ -781,7 +781,7 @@ LL | foo::(x_i16.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:286:16 + --> $DIR/numeric-cast.rs:275:16 | LL | foo::(x_i8); | ^^^^ expected f64, found i8 @@ -791,7 +791,7 @@ LL | foo::(x_i8.into()); | ^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:289:16 + --> $DIR/numeric-cast.rs:278:16 | LL | foo::(x_f32); | ^^^^^ expected f64, found f32 @@ -801,25 +801,25 @@ LL | foo::(x_f32.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:292:16 + --> $DIR/numeric-cast.rs:281:16 | LL | foo::(x_usize); | ^^^^^^^ expected f32, found usize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:294:16 + --> $DIR/numeric-cast.rs:283:16 | LL | foo::(x_u64); | ^^^^^ expected f32, found u64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:296:16 + --> $DIR/numeric-cast.rs:285:16 | LL | foo::(x_u32); | ^^^^^ expected f32, found u32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:298:16 + --> $DIR/numeric-cast.rs:287:16 | LL | foo::(x_u16); | ^^^^^ expected f32, found u16 @@ -829,7 +829,7 @@ LL | foo::(x_u16.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:300:16 + --> $DIR/numeric-cast.rs:289:16 | LL | foo::(x_u8); | ^^^^ expected f32, found u8 @@ -839,25 +839,25 @@ LL | foo::(x_u8.into()); | ^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:302:16 + --> $DIR/numeric-cast.rs:291:16 | LL | foo::(x_isize); | ^^^^^^^ expected f32, found isize error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:304:16 + --> $DIR/numeric-cast.rs:293:16 | LL | foo::(x_i64); | ^^^^^ expected f32, found i64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:306:16 + --> $DIR/numeric-cast.rs:295:16 | LL | foo::(x_i32); | ^^^^^ expected f32, found i32 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:308:16 + --> $DIR/numeric-cast.rs:297:16 | LL | foo::(x_i16); | ^^^^^ expected f32, found i16 @@ -867,7 +867,7 @@ LL | foo::(x_i16.into()); | ^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:310:16 + --> $DIR/numeric-cast.rs:299:16 | LL | foo::(x_i8); | ^^^^ expected f32, found i8 @@ -877,13 +877,13 @@ LL | foo::(x_i8.into()); | ^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:312:16 + --> $DIR/numeric-cast.rs:301:16 | LL | foo::(x_f64); | ^^^^^ expected f32, found f64 error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:316:16 + --> $DIR/numeric-cast.rs:305:16 | LL | foo::(x_u8 as u16); | ^^^^^^^^^^^ expected u32, found u16 @@ -893,7 +893,7 @@ LL | foo::((x_u8 as u16).into()); | ^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:318:16 + --> $DIR/numeric-cast.rs:307:16 | LL | foo::(-x_i8); | ^^^^^ expected i32, found i8 diff --git a/src/test/ui/numeric/numeric-fields.rs b/src/test/ui/numeric/numeric-fields.rs index 89d09560369..28234bbdff9 100644 --- a/src/test/ui/numeric/numeric-fields.rs +++ b/src/test/ui/numeric/numeric-fields.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S(u8, u16); fn main() { diff --git a/src/test/ui/numeric/numeric-fields.stderr b/src/test/ui/numeric/numeric-fields.stderr index 68a87da8ded..1a2ad4a0c09 100644 --- a/src/test/ui/numeric/numeric-fields.stderr +++ b/src/test/ui/numeric/numeric-fields.stderr @@ -1,5 +1,5 @@ error[E0560]: struct `S` has no field named `0b1` - --> $DIR/numeric-fields.rs:14:15 + --> $DIR/numeric-fields.rs:4:15 | LL | let s = S{0b1: 10, 0: 11}; | ^^^ `S` does not have this field @@ -7,7 +7,7 @@ LL | let s = S{0b1: 10, 0: 11}; = note: available fields are: `0`, `1` error[E0026]: struct `S` does not have a field named `0x1` - --> $DIR/numeric-fields.rs:17:17 + --> $DIR/numeric-fields.rs:7:17 | LL | S{0: a, 0x1: b, ..} => {} | ^^^^^^ struct `S` does not have this field diff --git a/src/test/ui/object-does-not-impl-trait.rs b/src/test/ui/object-does-not-impl-trait.rs index 30f8d5e2f45..2d72b4588f7 100644 --- a/src/test/ui/object-does-not-impl-trait.rs +++ b/src/test/ui/object-does-not-impl-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that an object type `Box` is not considered to implement the // trait `Foo`. Issue #5087. diff --git a/src/test/ui/object-does-not-impl-trait.stderr b/src/test/ui/object-does-not-impl-trait.stderr index a1ebdf3e666..0e28875ced6 100644 --- a/src/test/ui/object-does-not-impl-trait.stderr +++ b/src/test/ui/object-does-not-impl-trait.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `std::boxed::Box: Foo` is not satisfied - --> $DIR/object-does-not-impl-trait.rs:16:31 + --> $DIR/object-does-not-impl-trait.rs:6:31 | LL | fn take_object(f: Box) { take_foo(f); } | ^^^^^^^^ the trait `Foo` is not implemented for `std::boxed::Box` | note: required by `take_foo` - --> $DIR/object-does-not-impl-trait.rs:15:1 + --> $DIR/object-does-not-impl-trait.rs:5:1 | LL | fn take_foo(f: F) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs index 3df83d91999..d14351aef9a 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that if a struct declares multiple region bounds for a given // type parameter, an explicit lifetime bound is required on object // lifetimes within. diff --git a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr index cb603f2c472..f079803c901 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr @@ -1,17 +1,17 @@ error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound - --> $DIR/object-lifetime-default-ambiguous.rs:33:27 + --> $DIR/object-lifetime-default-ambiguous.rs:23:27 | LL | fn a<'a,'b>(t: Ref2<'a,'b,Test>) { | ^^^^ error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound - --> $DIR/object-lifetime-default-ambiguous.rs:37:14 + --> $DIR/object-lifetime-default-ambiguous.rs:27:14 | LL | fn b(t: Ref2) { | ^^^^ error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound - --> $DIR/object-lifetime-default-ambiguous.rs:53:15 + --> $DIR/object-lifetime-default-ambiguous.rs:43:15 | LL | fn f(t: &Ref2) { | ^^^^ diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.rs b/src/test/ui/object-lifetime/object-lifetime-default-elision.rs index e37b6a2bb9c..cf15a4e8676 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-elision.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test various cases where the old rules under lifetime elision // yield slightly different results than the new rules. diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr index b8c22583ff8..ed734c20f38 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr @@ -1,21 +1,21 @@ error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements - --> $DIR/object-lifetime-default-elision.rs:81:5 + --> $DIR/object-lifetime-default-elision.rs:71:5 | LL | ss | ^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 64:10... - --> $DIR/object-lifetime-default-elision.rs:64:10 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 54:10... + --> $DIR/object-lifetime-default-elision.rs:54:10 | LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/object-lifetime-default-elision.rs:81:5 + --> $DIR/object-lifetime-default-elision.rs:71:5 | LL | ss | ^^ -note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 64:13... - --> $DIR/object-lifetime-default-elision.rs:64:13 +note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 54:13... + --> $DIR/object-lifetime-default-elision.rs:54:13 | LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { | ^^ @@ -24,23 +24,23 @@ LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { found &dyn SomeTrait error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/object-lifetime-default-elision.rs:81:5 + --> $DIR/object-lifetime-default-elision.rs:71:5 | LL | ss | ^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 64:10... - --> $DIR/object-lifetime-default-elision.rs:64:10 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 54:10... + --> $DIR/object-lifetime-default-elision.rs:54:10 | LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { | ^^ note: ...so that the declared lifetime parameter bounds are satisfied - --> $DIR/object-lifetime-default-elision.rs:81:5 + --> $DIR/object-lifetime-default-elision.rs:71:5 | LL | ss | ^^ -note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 64:13... - --> $DIR/object-lifetime-default-elision.rs:64:13 +note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 54:13... + --> $DIR/object-lifetime-default-elision.rs:54:13 | LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait { | ^^ diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs index b253612bc32..b6d72f1fce3 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test various cases where the defaults should lead to errors being // reported. @@ -38,7 +28,7 @@ fn store(ss: &mut SomeStruct, b: Box) { fn store1<'b>(ss: &mut SomeStruct, b: Box) { // Here we override the lifetimes explicitly, and so naturally we get an error. - ss.r = b; //~ ERROR 41:12: 41:13: explicit lifetime required in the type of `ss` [E0621] + ss.r = b; //~ ERROR explicit lifetime required in the type of `ss` [E0621] } fn main() { diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr index 9972930c13e..a7cb32ec7b8 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `ss` - --> $DIR/object-lifetime-default-from-box-error.rs:28:5 + --> $DIR/object-lifetime-default-from-box-error.rs:18:5 | LL | fn load(ss: &mut SomeStruct) -> Box { | --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>` @@ -8,12 +8,12 @@ LL | ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621] | ^^^^ lifetime `'static` required error[E0621]: explicit lifetime required in the type of `ss` - --> $DIR/object-lifetime-default-from-box-error.rs:41:12 + --> $DIR/object-lifetime-default-from-box-error.rs:31:12 | LL | fn store1<'b>(ss: &mut SomeStruct, b: Box) { | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>` ... -LL | ss.r = b; //~ ERROR 41:12: 41:13: explicit lifetime required in the type of `ss` [E0621] +LL | ss.r = b; //~ ERROR explicit lifetime required in the type of `ss` [E0621] | ^ lifetime `'b` required error: aborting due to 2 previous errors diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs index 98301ef1a0a..91b384e0071 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the lifetime from the enclosing `&` is "inherited" // through the `Box` struct. diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr index a59d8090baf..165f6311ffd 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr @@ -1,13 +1,13 @@ error[E0308]: mismatched types - --> $DIR/object-lifetime-default-from-rptr-box-error.rs:25:12 + --> $DIR/object-lifetime-default-from-rptr-box-error.rs:15:12 | LL | ss.t = t; //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `&'a std::boxed::Box<(dyn Test + 'static)>` found type `&'a std::boxed::Box<(dyn Test + 'a)>` -note: the lifetime 'a as defined on the function body at 24:6... - --> $DIR/object-lifetime-default-from-rptr-box-error.rs:24:6 +note: the lifetime 'a as defined on the function body at 14:6... + --> $DIR/object-lifetime-default-from-rptr-box-error.rs:14:6 | LL | fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { | ^^ diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs index 836e4fa1142..6a84621f59e 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the lifetime from the enclosing `&` is "inherited" // through the `MyBox` struct. diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr index beda4df5295..2f042c05f25 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr @@ -1,13 +1,13 @@ error[E0308]: mismatched types - --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:31:12 + --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:21:12 | LL | ss.t = t; //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `&'a MyBox<(dyn Test + 'static)>` found type `&'a MyBox<(dyn Test + 'a)>` -note: the lifetime 'a as defined on the function body at 30:6... - --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:30:6 +note: the lifetime 'a as defined on the function body at 20:6... + --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:20:6 | LL | fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { | ^^ diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs b/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs index 54657e76e97..c94df82a177 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a "pass-through" object-lifetime-default that produces errors. #![allow(dead_code)] diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr index ec003693617..1a21096741c 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/object-lifetime-default-mybox.rs:37:5 + --> $DIR/object-lifetime-default-mybox.rs:27:5 | LL | fn load1<'a,'b>(a: &'a MyBox, | -------------------- this parameter and the return type are declared with different lifetimes... @@ -11,15 +11,15 @@ LL | a //~ ERROR lifetime mismatch | ^ ...but data from `a` is returned here error[E0308]: mismatched types - --> $DIR/object-lifetime-default-mybox.rs:41:11 + --> $DIR/object-lifetime-default-mybox.rs:31:11 | LL | load0(ss) //~ ERROR mismatched types | ^^ lifetime mismatch | = note: expected type `&MyBox<(dyn SomeTrait + 'static)>` found type `&MyBox<(dyn SomeTrait + 'a)>` -note: the lifetime 'a as defined on the function body at 40:10... - --> $DIR/object-lifetime-default-mybox.rs:40:10 +note: the lifetime 'a as defined on the function body at 30:10... + --> $DIR/object-lifetime-default-mybox.rs:30:10 | LL | fn load2<'a>(ss: &MyBox) -> MyBox { | ^^ diff --git a/src/test/ui/object-lifetime/object-lifetime-default.rs b/src/test/ui/object-lifetime/object-lifetime-default.rs index 746a656edb4..379b92e6dc7 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default.rs +++ b/src/test/ui/object-lifetime/object-lifetime-default.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-compare-mode-nll #![feature(rustc_attrs)] diff --git a/src/test/ui/object-lifetime/object-lifetime-default.stderr b/src/test/ui/object-lifetime/object-lifetime-default.stderr index 7e334a0e8e6..443d4ff6537 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default.stderr @@ -1,41 +1,41 @@ error: 'a,Ambiguous - --> $DIR/object-lifetime-default.rs:34:1 + --> $DIR/object-lifetime-default.rs:24:1 | LL | struct G<'a,'b,T:'a,U:'a+'b>(&'a T, &'b U); //~ ERROR 'a,Ambiguous | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: 'a,'b - --> $DIR/object-lifetime-default.rs:31:1 + --> $DIR/object-lifetime-default.rs:21:1 | LL | struct F<'a,'b,T:'a,U:'b>(&'a T, &'b U); //~ ERROR 'a,'b | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: 'b - --> $DIR/object-lifetime-default.rs:28:1 + --> $DIR/object-lifetime-default.rs:18:1 | LL | struct E<'a,'b:'a,T:'b>(&'a T, &'b T); //~ ERROR 'b | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Ambiguous - --> $DIR/object-lifetime-default.rs:25:1 + --> $DIR/object-lifetime-default.rs:15:1 | LL | struct D<'a,'b,T:'a+'b>(&'a T, &'b T); //~ ERROR Ambiguous | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: 'a - --> $DIR/object-lifetime-default.rs:22:1 + --> $DIR/object-lifetime-default.rs:12:1 | LL | struct C<'a,T:'a>(&'a T); //~ ERROR 'a | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: BaseDefault - --> $DIR/object-lifetime-default.rs:19:1 + --> $DIR/object-lifetime-default.rs:9:1 | LL | struct B<'a,T>(&'a (), T); //~ ERROR BaseDefault | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: BaseDefault - --> $DIR/object-lifetime-default.rs:16:1 + --> $DIR/object-lifetime-default.rs:6:1 | LL | struct A(T); //~ ERROR BaseDefault | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/object-pointer-types.rs b/src/test/ui/object-pointer-types.rs index 98c14cee942..a8a482fb5a6 100644 --- a/src/test/ui/object-pointer-types.rs +++ b/src/test/ui/object-pointer-types.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Foo { fn borrowed(&self); fn borrowed_mut(&mut self); diff --git a/src/test/ui/object-pointer-types.stderr b/src/test/ui/object-pointer-types.stderr index 5d8679b8aa5..c5738edb6cf 100644 --- a/src/test/ui/object-pointer-types.stderr +++ b/src/test/ui/object-pointer-types.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `owned` found for type `&dyn Foo` in the current scope - --> $DIR/object-pointer-types.rs:22:7 + --> $DIR/object-pointer-types.rs:11:7 | LL | x.owned(); //~ ERROR no method named `owned` found | ^^^^^ @@ -9,7 +9,7 @@ LL | x.owned(); //~ ERROR no method named `owned` found candidate #1: `Foo` error[E0599]: no method named `owned` found for type `&mut dyn Foo` in the current scope - --> $DIR/object-pointer-types.rs:28:7 + --> $DIR/object-pointer-types.rs:17:7 | LL | x.owned(); //~ ERROR no method named `owned` found | ^^^^^ @@ -19,7 +19,7 @@ LL | x.owned(); //~ ERROR no method named `owned` found candidate #1: `Foo` error[E0599]: no method named `managed` found for type `std::boxed::Box<(dyn Foo + 'static)>` in the current scope - --> $DIR/object-pointer-types.rs:34:7 + --> $DIR/object-pointer-types.rs:23:7 | LL | x.managed(); //~ ERROR no method named `managed` found | ^^^^^^^ diff --git a/src/test/ui/object-safety/object-safety-associated-consts.rs b/src/test/ui/object-safety/object-safety-associated-consts.rs index 4bce2c5982a..79b7e541af8 100644 --- a/src/test/ui/object-safety/object-safety-associated-consts.rs +++ b/src/test/ui/object-safety/object-safety-associated-consts.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we correctly prevent users from making trait objects // from traits with associated consts. diff --git a/src/test/ui/object-safety/object-safety-associated-consts.stderr b/src/test/ui/object-safety/object-safety-associated-consts.stderr index 39ec5a64e93..96962c10720 100644 --- a/src/test/ui/object-safety/object-safety-associated-consts.stderr +++ b/src/test/ui/object-safety/object-safety-associated-consts.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-associated-consts.rs:19:1 + --> $DIR/object-safety-associated-consts.rs:9:1 | LL | fn make_bar(t: &T) -> &Bar { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr b/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr index cf0ee588263..0dd50b28026 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr +++ b/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr @@ -1,5 +1,5 @@ error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined - --> $DIR/object-safety-by-value-self-use.rs:25:5 + --> $DIR/object-safety-by-value-self-use.rs:15:5 | LL | t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static) | ^ diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.rs b/src/test/ui/object-safety/object-safety-by-value-self-use.rs index e575bbb6cea..dc8ea64ec9c 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self-use.rs +++ b/src/test/ui/object-safety/object-safety-by-value-self-use.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that while a trait with by-value self is object-safe, we // can't actually invoke it from an object (yet...?). diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.stderr b/src/test/ui/object-safety/object-safety-by-value-self-use.stderr index 015284657af..0711981a521 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self-use.stderr +++ b/src/test/ui/object-safety/object-safety-by-value-self-use.stderr @@ -1,5 +1,5 @@ error[E0161]: cannot move a value of type (dyn Bar + 'static): the size of (dyn Bar + 'static) cannot be statically determined - --> $DIR/object-safety-by-value-self-use.rs:25:5 + --> $DIR/object-safety-by-value-self-use.rs:15:5 | LL | t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static) | ^ diff --git a/src/test/ui/object-safety/object-safety-by-value-self.rs b/src/test/ui/object-safety/object-safety-by-value-self.rs index 6ec2ecba8cf..dee31f6e370 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self.rs +++ b/src/test/ui/object-safety/object-safety-by-value-self.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that a trait with by-value self is considered object-safe. // compile-pass diff --git a/src/test/ui/object-safety/object-safety-generics.rs b/src/test/ui/object-safety/object-safety-generics.rs index 969ceeec276..5f4aabf5469 100644 --- a/src/test/ui/object-safety/object-safety-generics.rs +++ b/src/test/ui/object-safety/object-safety-generics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we correctly prevent users from making trait objects // from traits with generic methods, unless `where Self : Sized` is // present. diff --git a/src/test/ui/object-safety/object-safety-generics.stderr b/src/test/ui/object-safety/object-safety-generics.stderr index e5dfa666630..7ae44794ceb 100644 --- a/src/test/ui/object-safety/object-safety-generics.stderr +++ b/src/test/ui/object-safety/object-safety-generics.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-generics.rs:24:1 + --> $DIR/object-safety-generics.rs:14:1 | LL | fn make_bar(t: &T) -> &Bar { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object @@ -7,7 +7,7 @@ LL | fn make_bar(t: &T) -> &Bar { = note: method `bar` has generic type parameters error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-generics.rs:29:1 + --> $DIR/object-safety-generics.rs:19:1 | LL | fn make_bar_explicit(t: &T) -> &Bar { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object diff --git a/src/test/ui/object-safety/object-safety-issue-22040.rs b/src/test/ui/object-safety/object-safety-issue-22040.rs index 06d2441d3c0..eb28fcf0d5a 100644 --- a/src/test/ui/object-safety/object-safety-issue-22040.rs +++ b/src/test/ui/object-safety/object-safety-issue-22040.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #22040. use std::fmt::Debug; diff --git a/src/test/ui/object-safety/object-safety-issue-22040.stderr b/src/test/ui/object-safety/object-safety-issue-22040.stderr index b718e92fc47..85721f1a5f8 100644 --- a/src/test/ui/object-safety/object-safety-issue-22040.stderr +++ b/src/test/ui/object-safety/object-safety-issue-22040.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Expr` cannot be made into an object - --> $DIR/object-safety-issue-22040.rs:22:23 + --> $DIR/object-safety-issue-22040.rs:12:23 | LL | elements: Vec>, | ^^^^^^^^ the trait `Expr` cannot be made into an object diff --git a/src/test/ui/object-safety/object-safety-mentions-Self.rs b/src/test/ui/object-safety/object-safety-mentions-Self.rs index 0f59a928fef..8e1bd83cec0 100644 --- a/src/test/ui/object-safety/object-safety-mentions-Self.rs +++ b/src/test/ui/object-safety/object-safety-mentions-Self.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we correctly prevent users from making trait objects // form traits that make use of `Self` in an argument or return // position, unless `where Self : Sized` is present.. diff --git a/src/test/ui/object-safety/object-safety-mentions-Self.stderr b/src/test/ui/object-safety/object-safety-mentions-Self.stderr index b181be95a54..ed3aed983cf 100644 --- a/src/test/ui/object-safety/object-safety-mentions-Self.stderr +++ b/src/test/ui/object-safety/object-safety-mentions-Self.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-mentions-Self.rs:27:1 + --> $DIR/object-safety-mentions-Self.rs:17:1 | LL | fn make_bar(t: &T) -> &Bar { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object @@ -7,7 +7,7 @@ LL | fn make_bar(t: &T) -> &Bar { = note: method `bar` references the `Self` type in its arguments or return type error[E0038]: the trait `Baz` cannot be made into an object - --> $DIR/object-safety-mentions-Self.rs:32:1 + --> $DIR/object-safety-mentions-Self.rs:22:1 | LL | fn make_baz(t: &T) -> &Baz { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Baz` cannot be made into an object diff --git a/src/test/ui/object-safety/object-safety-no-static.rs b/src/test/ui/object-safety/object-safety-no-static.rs index dd1d5af3f4a..4faf9386f9a 100644 --- a/src/test/ui/object-safety/object-safety-no-static.rs +++ b/src/test/ui/object-safety/object-safety-no-static.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we correctly prevent users from making trait objects // from traits with static methods. diff --git a/src/test/ui/object-safety/object-safety-no-static.stderr b/src/test/ui/object-safety/object-safety-no-static.stderr index f17d2907148..3b8ccb594c1 100644 --- a/src/test/ui/object-safety/object-safety-no-static.stderr +++ b/src/test/ui/object-safety/object-safety-no-static.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/object-safety-no-static.rs:18:1 + --> $DIR/object-safety-no-static.rs:8:1 | LL | fn foo_implicit(b: Box) -> Box { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object diff --git a/src/test/ui/object-safety/object-safety-phantom-fn.rs b/src/test/ui/object-safety/object-safety-phantom-fn.rs index 34b66b15e57..f8875e4995b 100644 --- a/src/test/ui/object-safety/object-safety-phantom-fn.rs +++ b/src/test/ui/object-safety/object-safety-phantom-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that `Self` appearing in a phantom fn does not make a trait not object safe. // compile-pass diff --git a/src/test/ui/object-safety/object-safety-sized-2.rs b/src/test/ui/object-safety/object-safety-sized-2.rs index 3e1942d5a01..baeb3734677 100644 --- a/src/test/ui/object-safety/object-safety-sized-2.rs +++ b/src/test/ui/object-safety/object-safety-sized-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we correctly prevent users from making trait objects // from traits where `Self : Sized`. diff --git a/src/test/ui/object-safety/object-safety-sized-2.stderr b/src/test/ui/object-safety/object-safety-sized-2.stderr index 1e179b662b9..2b8bfa341d7 100644 --- a/src/test/ui/object-safety/object-safety-sized-2.stderr +++ b/src/test/ui/object-safety/object-safety-sized-2.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-sized-2.rs:20:1 + --> $DIR/object-safety-sized-2.rs:10:1 | LL | fn make_bar(t: &T) -> &Bar { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object diff --git a/src/test/ui/object-safety/object-safety-sized.rs b/src/test/ui/object-safety/object-safety-sized.rs index 7c58609c7e9..77dc7390aff 100644 --- a/src/test/ui/object-safety/object-safety-sized.rs +++ b/src/test/ui/object-safety/object-safety-sized.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we correctly prevent users from making trait objects // from traits where `Self : Sized`. diff --git a/src/test/ui/object-safety/object-safety-sized.stderr b/src/test/ui/object-safety/object-safety-sized.stderr index a6dd16666c6..ba98e2f1ef6 100644 --- a/src/test/ui/object-safety/object-safety-sized.stderr +++ b/src/test/ui/object-safety/object-safety-sized.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Bar` cannot be made into an object - --> $DIR/object-safety-sized.rs:18:1 + --> $DIR/object-safety-sized.rs:8:1 | LL | fn make_bar(t: &T) -> &Bar { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object diff --git a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs index 53b4fc2de9e..9d0da4e327c 100644 --- a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs +++ b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we correctly prevent users from making trait objects // form traits that make use of `Self` in an argument or return position. diff --git a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr index f562bc6c54f..5db34a23fff 100644 --- a/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr +++ b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Baz` cannot be made into an object - --> $DIR/object-safety-supertrait-mentions-Self.rs:25:31 + --> $DIR/object-safety-supertrait-mentions-Self.rs:15:31 | LL | fn make_baz(t: &T) -> &Baz { | ^^^ the trait `Baz` cannot be made into an object diff --git a/src/test/ui/obsolete-in-place/bad.bad.stderr b/src/test/ui/obsolete-in-place/bad.bad.stderr index f870c09d6e5..245ecb4ed1c 100644 --- a/src/test/ui/obsolete-in-place/bad.bad.stderr +++ b/src/test/ui/obsolete-in-place/bad.bad.stderr @@ -1,5 +1,5 @@ error: emplacement syntax is obsolete (for now, anyway) - --> $DIR/bad.rs:19:5 + --> $DIR/bad.rs:9:5 | LL | x <- y; //[bad]~ ERROR emplacement syntax is obsolete | ^^^^^^ @@ -7,7 +7,7 @@ LL | x <- y; //[bad]~ ERROR emplacement syntax is obsolete = note: for more information, see error: emplacement syntax is obsolete (for now, anyway) - --> $DIR/bad.rs:20:5 + --> $DIR/bad.rs:10:5 | LL | in(foo) { bar }; //[bad]~ ERROR emplacement syntax is obsolete | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/obsolete-in-place/bad.rs b/src/test/ui/obsolete-in-place/bad.rs index 21993e43331..f35d297e552 100644 --- a/src/test/ui/obsolete-in-place/bad.rs +++ b/src/test/ui/obsolete-in-place/bad.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that `<-` and `in` syntax gets a hard error. // revisions: good bad diff --git a/src/test/ui/obsolete-syntax-impl-for-dotdot.rs b/src/test/ui/obsolete-syntax-impl-for-dotdot.rs index 914621a117d..e928f09aa6d 100644 --- a/src/test/ui/obsolete-syntax-impl-for-dotdot.rs +++ b/src/test/ui/obsolete-syntax-impl-for-dotdot.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait1 {} trait Trait2 {} diff --git a/src/test/ui/obsolete-syntax-impl-for-dotdot.stderr b/src/test/ui/obsolete-syntax-impl-for-dotdot.stderr index 4a312d745f6..793ed26ca68 100644 --- a/src/test/ui/obsolete-syntax-impl-for-dotdot.stderr +++ b/src/test/ui/obsolete-syntax-impl-for-dotdot.stderr @@ -1,5 +1,5 @@ error: `impl Trait for .. {}` is an obsolete syntax - --> $DIR/obsolete-syntax-impl-for-dotdot.rs:17:1 + --> $DIR/obsolete-syntax-impl-for-dotdot.rs:7:1 | LL | impl Trait2 for .. {} //~ ERROR `impl Trait for .. {}` is an obsolete syntax | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/occurs-check-2.rs b/src/test/ui/occurs-check-2.rs index 5d162fe944e..213fd2619ce 100644 --- a/src/test/ui/occurs-check-2.rs +++ b/src/test/ui/occurs-check-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn main() { diff --git a/src/test/ui/occurs-check-2.stderr b/src/test/ui/occurs-check-2.stderr index 547491c395b..74e29a5aea7 100644 --- a/src/test/ui/occurs-check-2.stderr +++ b/src/test/ui/occurs-check-2.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/occurs-check-2.rs:17:9 + --> $DIR/occurs-check-2.rs:7:9 | LL | f = box g; | ^^^^^ diff --git a/src/test/ui/occurs-check-3.rs b/src/test/ui/occurs-check-3.rs index ba7688e8524..9c04204010b 100644 --- a/src/test/ui/occurs-check-3.rs +++ b/src/test/ui/occurs-check-3.rs @@ -1,14 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:mismatched types // From Issue #778 -enum clam { a(T), } -fn main() { let c; c = clam::a(c); match c { clam::a::(_) => { } } } + +enum Clam { A(T) } +fn main() { let c; c = Clam::A(c); match c { Clam::A::(_) => { } } } +//~^ ERROR mismatched types diff --git a/src/test/ui/occurs-check-3.stderr b/src/test/ui/occurs-check-3.stderr index 1483d41d723..04c404d543a 100644 --- a/src/test/ui/occurs-check-3.stderr +++ b/src/test/ui/occurs-check-3.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types - --> $DIR/occurs-check-3.rs:14:24 + --> $DIR/occurs-check-3.rs:4:24 | -LL | fn main() { let c; c = clam::a(c); match c { clam::a::(_) => { } } } +LL | fn main() { let c; c = Clam::A(c); match c { Clam::A::(_) => { } } } | ^^^^^^^^^^ cyclic type of infinite size error: aborting due to previous error diff --git a/src/test/ui/occurs-check.rs b/src/test/ui/occurs-check.rs index 2c784365ea9..5f2c2362d24 100644 --- a/src/test/ui/occurs-check.rs +++ b/src/test/ui/occurs-check.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn main() { diff --git a/src/test/ui/occurs-check.stderr b/src/test/ui/occurs-check.stderr index c6994d0c537..61ce61b1cbe 100644 --- a/src/test/ui/occurs-check.stderr +++ b/src/test/ui/occurs-check.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/occurs-check.rs:15:9 + --> $DIR/occurs-check.rs:5:9 | LL | f = box f; | ^^^^^ diff --git a/src/test/ui/old-suffixes-are-really-forbidden.rs b/src/test/ui/old-suffixes-are-really-forbidden.rs index 9a71dc98014..eea95b7d626 100644 --- a/src/test/ui/old-suffixes-are-really-forbidden.rs +++ b/src/test/ui/old-suffixes-are-really-forbidden.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let a = 1_is; //~ ERROR invalid suffix let b = 2_us; //~ ERROR invalid suffix diff --git a/src/test/ui/old-suffixes-are-really-forbidden.stderr b/src/test/ui/old-suffixes-are-really-forbidden.stderr index d580a18f46b..c54b72a3585 100644 --- a/src/test/ui/old-suffixes-are-really-forbidden.stderr +++ b/src/test/ui/old-suffixes-are-really-forbidden.stderr @@ -1,16 +1,16 @@ error: invalid suffix `is` for numeric literal - --> $DIR/old-suffixes-are-really-forbidden.rs:12:13 + --> $DIR/old-suffixes-are-really-forbidden.rs:2:13 | LL | let a = 1_is; //~ ERROR invalid suffix - | ^^^^ + | ^^^^ invalid suffix `is` | = help: the suffix must be one of the integral types (`u32`, `isize`, etc) error: invalid suffix `us` for numeric literal - --> $DIR/old-suffixes-are-really-forbidden.rs:13:13 + --> $DIR/old-suffixes-are-really-forbidden.rs:3:13 | LL | let b = 2_us; //~ ERROR invalid suffix - | ^^^^ + | ^^^^ invalid suffix `us` | = help: the suffix must be one of the integral types (`u32`, `isize`, etc) diff --git a/src/test/ui/on-unimplemented/auxiliary/no_debug.rs b/src/test/ui/on-unimplemented/auxiliary/no_debug.rs index 0f833c62637..f240d0e1f1f 100644 --- a/src/test/ui/on-unimplemented/auxiliary/no_debug.rs +++ b/src/test/ui/on-unimplemented/auxiliary/no_debug.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // ignore-tidy-linelength #![crate_type = "lib"] diff --git a/src/test/ui/on-unimplemented/bad-annotation.rs b/src/test/ui/on-unimplemented/bad-annotation.rs index 286c71bb299..6843c4bfa99 100644 --- a/src/test/ui/on-unimplemented/bad-annotation.rs +++ b/src/test/ui/on-unimplemented/bad-annotation.rs @@ -1,12 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // ignore-tidy-linelength #![feature(on_unimplemented)] @@ -23,7 +14,8 @@ trait MyFromIterator { fn my_from_iter>(iterator: T) -> Self; } -#[rustc_on_unimplemented] //~ ERROR `#[rustc_on_unimplemented]` requires a value +#[rustc_on_unimplemented] +//~^ ERROR attribute must be of the form trait BadAnnotation1 {} diff --git a/src/test/ui/on-unimplemented/bad-annotation.stderr b/src/test/ui/on-unimplemented/bad-annotation.stderr index 212eb125f85..31b626e0ff4 100644 --- a/src/test/ui/on-unimplemented/bad-annotation.stderr +++ b/src/test/ui/on-unimplemented/bad-annotation.stderr @@ -1,25 +1,23 @@ -error[E0232]: `#[rustc_on_unimplemented]` requires a value - --> $DIR/bad-annotation.rs:26:1 +error: attribute must be of the form `#[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")]` or `#[rustc_on_unimplemented = "message"]` + --> $DIR/bad-annotation.rs:17:1 | -LL | #[rustc_on_unimplemented] //~ ERROR `#[rustc_on_unimplemented]` requires a value - | ^^^^^^^^^^^^^^^^^^^^^^^^^ value required here - | - = note: eg `#[rustc_on_unimplemented(message="foo")]` +LL | #[rustc_on_unimplemented] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0230]: there is no parameter `C` on trait `BadAnnotation2` - --> $DIR/bad-annotation.rs:30:1 + --> $DIR/bad-annotation.rs:22:1 | LL | #[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0231]: only named substitution parameters are allowed - --> $DIR/bad-annotation.rs:35:1 + --> $DIR/bad-annotation.rs:27:1 | LL | #[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{}>`"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:40:26 + --> $DIR/bad-annotation.rs:32:26 | LL | #[rustc_on_unimplemented(lorem="")] | ^^^^^^^^ expected value here @@ -27,7 +25,7 @@ LL | #[rustc_on_unimplemented(lorem="")] = note: eg `#[rustc_on_unimplemented(message="foo")]` error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:44:26 + --> $DIR/bad-annotation.rs:36:26 | LL | #[rustc_on_unimplemented(lorem(ipsum(dolor)))] | ^^^^^^^^^^^^^^^^^^^ expected value here @@ -35,7 +33,7 @@ LL | #[rustc_on_unimplemented(lorem(ipsum(dolor)))] = note: eg `#[rustc_on_unimplemented(message="foo")]` error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:48:39 + --> $DIR/bad-annotation.rs:40:39 | LL | #[rustc_on_unimplemented(message="x", message="y")] | ^^^^^^^^^^^ expected value here @@ -43,7 +41,7 @@ LL | #[rustc_on_unimplemented(message="x", message="y")] = note: eg `#[rustc_on_unimplemented(message="foo")]` error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:52:39 + --> $DIR/bad-annotation.rs:44:39 | LL | #[rustc_on_unimplemented(message="x", on(desugared, message="y"))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected value here @@ -51,13 +49,13 @@ LL | #[rustc_on_unimplemented(message="x", on(desugared, message="y"))] = note: eg `#[rustc_on_unimplemented(message="foo")]` error[E0232]: empty `on`-clause in `#[rustc_on_unimplemented]` - --> $DIR/bad-annotation.rs:56:26 + --> $DIR/bad-annotation.rs:48:26 | LL | #[rustc_on_unimplemented(on(), message="y")] | ^^^^ empty on-clause here error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:60:26 + --> $DIR/bad-annotation.rs:52:26 | LL | #[rustc_on_unimplemented(on="x", message="y")] | ^^^^^^ expected value here @@ -65,7 +63,7 @@ LL | #[rustc_on_unimplemented(on="x", message="y")] = note: eg `#[rustc_on_unimplemented(message="foo")]` error[E0232]: this attribute must have a valid value - --> $DIR/bad-annotation.rs:67:40 + --> $DIR/bad-annotation.rs:59:40 | LL | #[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected value here diff --git a/src/test/ui/on-unimplemented/expected-comma-found-token.rs b/src/test/ui/on-unimplemented/expected-comma-found-token.rs index f7a632dfaa1..d8717f360e9 100644 --- a/src/test/ui/on-unimplemented/expected-comma-found-token.rs +++ b/src/test/ui/on-unimplemented/expected-comma-found-token.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that two closures cannot simultaneously have mutable // access to the variable, whether that mutable access be used // for direct assignment or for taking mutable ref. Issue #6801. @@ -16,9 +6,8 @@ #[rustc_on_unimplemented( message="the message" - label="the label" + label="the label" //~ ERROR expected one of `)` or `,`, found `label` )] trait T {} -//~^^^ ERROR expected one of `)` or `,`, found `label` fn main() { } diff --git a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr index 9a564bb872e..1e0808e1d84 100644 --- a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr +++ b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr @@ -1,9 +1,9 @@ error: expected one of `)` or `,`, found `label` - --> $DIR/expected-comma-found-token.rs:19:5 + --> $DIR/expected-comma-found-token.rs:9:5 | LL | message="the message" | - expected one of `)` or `,` here -LL | label="the label" +LL | label="the label" //~ ERROR expected one of `)` or `,`, found `label` | ^^^^^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/on-unimplemented/multiple-impls.rs b/src/test/ui/on-unimplemented/multiple-impls.rs index 4467ac4356b..0aee98b2090 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.rs +++ b/src/test/ui/on-unimplemented/multiple-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test if the on_unimplemented message override works #![feature(on_unimplemented)] diff --git a/src/test/ui/on-unimplemented/multiple-impls.stderr b/src/test/ui/on-unimplemented/multiple-impls.stderr index 23635a3c415..5d5db21f726 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.stderr +++ b/src/test/ui/on-unimplemented/multiple-impls.stderr @@ -1,18 +1,18 @@ error[E0277]: the trait bound `[i32]: Index` is not satisfied - --> $DIR/multiple-impls.rs:43:5 + --> $DIR/multiple-impls.rs:33:5 | LL | Index::index(&[] as &[i32], 2u32); | ^^^^^^^^^^^^ trait message | = help: the trait `Index` is not implemented for `[i32]` note: required by `Index::index` - --> $DIR/multiple-impls.rs:22:5 + --> $DIR/multiple-impls.rs:12:5 | LL | fn index(&self, index: Idx) -> &Self::Output; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `[i32]: Index` is not satisfied - --> $DIR/multiple-impls.rs:43:5 + --> $DIR/multiple-impls.rs:33:5 | LL | Index::index(&[] as &[i32], 2u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trait message @@ -20,20 +20,20 @@ LL | Index::index(&[] as &[i32], 2u32); = help: the trait `Index` is not implemented for `[i32]` error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:46:5 + --> $DIR/multiple-impls.rs:36:5 | LL | Index::index(&[] as &[i32], Foo(2u32)); | ^^^^^^^^^^^^ on impl for Foo | = help: the trait `Index>` is not implemented for `[i32]` note: required by `Index::index` - --> $DIR/multiple-impls.rs:22:5 + --> $DIR/multiple-impls.rs:12:5 | LL | fn index(&self, index: Idx) -> &Self::Output; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:46:5 + --> $DIR/multiple-impls.rs:36:5 | LL | Index::index(&[] as &[i32], Foo(2u32)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Foo @@ -41,20 +41,20 @@ LL | Index::index(&[] as &[i32], Foo(2u32)); = help: the trait `Index>` is not implemented for `[i32]` error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:49:5 + --> $DIR/multiple-impls.rs:39:5 | LL | Index::index(&[] as &[i32], Bar(2u32)); | ^^^^^^^^^^^^ on impl for Bar | = help: the trait `Index>` is not implemented for `[i32]` note: required by `Index::index` - --> $DIR/multiple-impls.rs:22:5 + --> $DIR/multiple-impls.rs:12:5 | LL | fn index(&self, index: Idx) -> &Self::Output; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `[i32]: Index>` is not satisfied - --> $DIR/multiple-impls.rs:49:5 + --> $DIR/multiple-impls.rs:39:5 | LL | Index::index(&[] as &[i32], Bar(2u32)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ on impl for Bar diff --git a/src/test/ui/on-unimplemented/no-debug.rs b/src/test/ui/on-unimplemented/no-debug.rs index fff6122c6b3..858df17ffda 100644 --- a/src/test/ui/on-unimplemented/no-debug.rs +++ b/src/test/ui/on-unimplemented/no-debug.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:no_debug.rs extern crate no_debug; diff --git a/src/test/ui/on-unimplemented/no-debug.stderr b/src/test/ui/on-unimplemented/no-debug.stderr index 275cd91a435..cbb41263a83 100644 --- a/src/test/ui/on-unimplemented/no-debug.stderr +++ b/src/test/ui/on-unimplemented/no-debug.stderr @@ -1,5 +1,5 @@ error[E0277]: `Foo` doesn't implement `std::fmt::Debug` - --> $DIR/no-debug.rs:20:27 + --> $DIR/no-debug.rs:10:27 | LL | println!("{:?} {:?}", Foo, Bar); | ^^^ `Foo` cannot be formatted using `{:?}` @@ -9,7 +9,7 @@ LL | println!("{:?} {:?}", Foo, Bar); = note: required by `std::fmt::Debug::fmt` error[E0277]: `no_debug::Bar` doesn't implement `std::fmt::Debug` - --> $DIR/no-debug.rs:20:32 + --> $DIR/no-debug.rs:10:32 | LL | println!("{:?} {:?}", Foo, Bar); | ^^^ `no_debug::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` @@ -18,7 +18,7 @@ LL | println!("{:?} {:?}", Foo, Bar); = note: required by `std::fmt::Debug::fmt` error[E0277]: `Foo` doesn't implement `std::fmt::Display` - --> $DIR/no-debug.rs:21:23 + --> $DIR/no-debug.rs:11:23 | LL | println!("{} {}", Foo, Bar); | ^^^ `Foo` cannot be formatted with the default formatter @@ -28,7 +28,7 @@ LL | println!("{} {}", Foo, Bar); = note: required by `std::fmt::Display::fmt` error[E0277]: `no_debug::Bar` doesn't implement `std::fmt::Display` - --> $DIR/no-debug.rs:21:28 + --> $DIR/no-debug.rs:11:28 | LL | println!("{} {}", Foo, Bar); | ^^^ `no_debug::Bar` cannot be formatted with the default formatter diff --git a/src/test/ui/on-unimplemented/on-impl.rs b/src/test/ui/on-unimplemented/on-impl.rs index d104d1ed033..9e4c2f6edd7 100644 --- a/src/test/ui/on-unimplemented/on-impl.rs +++ b/src/test/ui/on-unimplemented/on-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test if the on_unimplemented message override works #![feature(on_unimplemented)] diff --git a/src/test/ui/on-unimplemented/on-impl.stderr b/src/test/ui/on-unimplemented/on-impl.stderr index 2b286ad0be7..79cf22f609c 100644 --- a/src/test/ui/on-unimplemented/on-impl.stderr +++ b/src/test/ui/on-unimplemented/on-impl.stderr @@ -1,18 +1,18 @@ error[E0277]: the trait bound `[i32]: Index` is not satisfied - --> $DIR/on-impl.rs:32:5 + --> $DIR/on-impl.rs:22:5 | LL | Index::::index(&[1, 2, 3] as &[i32], 2u32); | ^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice | = help: the trait `Index` is not implemented for `[i32]` note: required by `Index::index` - --> $DIR/on-impl.rs:19:5 + --> $DIR/on-impl.rs:9:5 | LL | fn index(&self, index: Idx) -> &Self::Output; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `[i32]: Index` is not satisfied - --> $DIR/on-impl.rs:32:5 + --> $DIR/on-impl.rs:22:5 | LL | Index::::index(&[1, 2, 3] as &[i32], 2u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ a usize is required to index into a slice diff --git a/src/test/ui/on-unimplemented/on-trait.rs b/src/test/ui/on-unimplemented/on-trait.rs index a5eea55eeb9..22afda16f43 100644 --- a/src/test/ui/on-unimplemented/on-trait.rs +++ b/src/test/ui/on-unimplemented/on-trait.rs @@ -1,12 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // ignore-tidy-linelength #![feature(on_unimplemented)] diff --git a/src/test/ui/on-unimplemented/on-trait.stderr b/src/test/ui/on-unimplemented/on-trait.stderr index 8bd910403b4..939c2725cc4 100644 --- a/src/test/ui/on-unimplemented/on-trait.stderr +++ b/src/test/ui/on-unimplemented/on-trait.stderr @@ -1,25 +1,25 @@ error[E0277]: the trait bound `std::option::Option>: MyFromIterator<&u8>` is not satisfied - --> $DIR/on-trait.rs:37:30 + --> $DIR/on-trait.rs:28:30 | LL | let y: Option> = collect(x.iter()); // this should give approximately the same error for x.iter().collect() | ^^^^^^^ a collection of type `std::option::Option>` cannot be built from an iterator over elements of type `&u8` | = help: the trait `MyFromIterator<&u8>` is not implemented for `std::option::Option>` note: required by `collect` - --> $DIR/on-trait.rs:31:1 + --> $DIR/on-trait.rs:22:1 | LL | fn collect, B: MyFromIterator>(it: I) -> B { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::string::String: Bar::Foo` is not satisfied - --> $DIR/on-trait.rs:40:21 + --> $DIR/on-trait.rs:31:21 | LL | let x: String = foobar(); //~ ERROR | ^^^^^^ test error `std::string::String` with `u8` `_` `u32` in `Bar::Foo` | = help: the trait `Bar::Foo` is not implemented for `std::string::String` note: required by `foobar` - --> $DIR/on-trait.rs:21:1 + --> $DIR/on-trait.rs:12:1 | LL | fn foobar>() -> T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/on-unimplemented/slice-index.rs b/src/test/ui/on-unimplemented/slice-index.rs index 79bb277d2c1..b5e18e2397e 100644 --- a/src/test/ui/on-unimplemented/slice-index.rs +++ b/src/test/ui/on-unimplemented/slice-index.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test new Index error message for slices // ignore-tidy-linelength diff --git a/src/test/ui/on-unimplemented/slice-index.stderr b/src/test/ui/on-unimplemented/slice-index.stderr index 6a4756eb1c9..7b45d848c97 100644 --- a/src/test/ui/on-unimplemented/slice-index.stderr +++ b/src/test/ui/on-unimplemented/slice-index.stderr @@ -1,5 +1,5 @@ -error[E0277]: the trait bound `i32: std::slice::SliceIndex<[i32]>` is not satisfied - --> $DIR/slice-index.rs:21:5 +error[E0277]: the type `[i32]` cannot be indexed by `i32` + --> $DIR/slice-index.rs:11:5 | LL | x[1i32]; //~ ERROR E0277 | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` @@ -7,8 +7,8 @@ LL | x[1i32]; //~ ERROR E0277 = help: the trait `std::slice::SliceIndex<[i32]>` is not implemented for `i32` = note: required because of the requirements on the impl of `std::ops::Index` for `[i32]` -error[E0277]: the trait bound `std::ops::RangeTo: std::slice::SliceIndex<[i32]>` is not satisfied - --> $DIR/slice-index.rs:22:5 +error[E0277]: the type `[i32]` cannot be indexed by `std::ops::RangeTo` + --> $DIR/slice-index.rs:12:5 | LL | x[..1i32]; //~ ERROR E0277 | ^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` diff --git a/src/test/ui/once-cant-call-twice-on-heap.nll.stderr b/src/test/ui/once-cant-call-twice-on-heap.nll.stderr new file mode 100644 index 00000000000..ea53abc1b0f --- /dev/null +++ b/src/test/ui/once-cant-call-twice-on-heap.nll.stderr @@ -0,0 +1,15 @@ +error[E0382]: use of moved value: `blk` + --> $DIR/once-cant-call-twice-on-heap.rs:9:5 + | +LL | fn foo(blk: F) { + | - --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument +LL | blk(); + | --- value moved here +LL | blk(); //~ ERROR use of moved value + | ^^^ value used here after move + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0382`. diff --git a/src/test/ui/once-cant-call-twice-on-heap.rs b/src/test/ui/once-cant-call-twice-on-heap.rs index 6441f308f29..9aefe1e5a21 100644 --- a/src/test/ui/once-cant-call-twice-on-heap.rs +++ b/src/test/ui/once-cant-call-twice-on-heap.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Testing guarantees provided by once functions. // This program would segfault if it were legal. diff --git a/src/test/ui/once-cant-call-twice-on-heap.stderr b/src/test/ui/once-cant-call-twice-on-heap.stderr index 81a501f5680..4559425e5be 100644 --- a/src/test/ui/once-cant-call-twice-on-heap.stderr +++ b/src/test/ui/once-cant-call-twice-on-heap.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `blk` - --> $DIR/once-cant-call-twice-on-heap.rs:19:5 + --> $DIR/once-cant-call-twice-on-heap.rs:9:5 | LL | blk(); | --- value moved here diff --git a/src/test/ui/opt-in-copy.rs b/src/test/ui/opt-in-copy.rs index bc18b52a0c1..0b48418e464 100644 --- a/src/test/ui/opt-in-copy.rs +++ b/src/test/ui/opt-in-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct CantCopyThis; struct IWantToCopyThis { diff --git a/src/test/ui/opt-in-copy.stderr b/src/test/ui/opt-in-copy.stderr index c6440804be6..0a275f1aa41 100644 --- a/src/test/ui/opt-in-copy.stderr +++ b/src/test/ui/opt-in-copy.stderr @@ -1,5 +1,5 @@ error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/opt-in-copy.rs:17:6 + --> $DIR/opt-in-copy.rs:7:6 | LL | but_i_cant: CantCopyThis, | ------------------------ this field does not implement `Copy` @@ -8,7 +8,7 @@ LL | impl Copy for IWantToCopyThis {} | ^^^^ error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/opt-in-copy.rs:29:6 + --> $DIR/opt-in-copy.rs:19:6 | LL | ButICant(CantCopyThisEither), | ------------------ this field does not implement `Copy` diff --git a/src/test/ui/or-patter-mismatch.rs b/src/test/ui/or-patter-mismatch.rs deleted file mode 100644 index 59508d6ac95..00000000000 --- a/src/test/ui/or-patter-mismatch.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern: mismatched types - -enum blah { a(isize, isize, usize), b(isize, isize), } - -fn main() { match blah::a(1, 1, 2) { blah::a(_, x, y) | blah::b(x, y) => { } } } diff --git a/src/test/ui/or-patter-mismatch.stderr b/src/test/ui/or-patter-mismatch.stderr deleted file mode 100644 index 8bf4d2e5332..00000000000 --- a/src/test/ui/or-patter-mismatch.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/or-patter-mismatch.rs:15:68 - | -LL | fn main() { match blah::a(1, 1, 2) { blah::a(_, x, y) | blah::b(x, y) => { } } } - | ^ expected usize, found isize - | - = note: expected type `usize` - found type `isize` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/or-pattern-mismatch.rs b/src/test/ui/or-pattern-mismatch.rs new file mode 100644 index 00000000000..973954bca5a --- /dev/null +++ b/src/test/ui/or-pattern-mismatch.rs @@ -0,0 +1,4 @@ +enum Blah { A(isize, isize, usize), B(isize, isize) } + +fn main() { match Blah::A(1, 1, 2) { Blah::A(_, x, y) | Blah::B(x, y) => { } } } +//~^ ERROR mismatched types diff --git a/src/test/ui/or-pattern-mismatch.stderr b/src/test/ui/or-pattern-mismatch.stderr new file mode 100644 index 00000000000..731b2090a7b --- /dev/null +++ b/src/test/ui/or-pattern-mismatch.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/or-pattern-mismatch.rs:3:68 + | +LL | fn main() { match Blah::A(1, 1, 2) { Blah::A(_, x, y) | Blah::B(x, y) => { } } } + | ^ expected usize, found isize + | + = note: expected type `usize` + found type `isize` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/order-dependent-cast-inference.rs b/src/test/ui/order-dependent-cast-inference.rs index afcd402343b..e666209b912 100644 --- a/src/test/ui/order-dependent-cast-inference.rs +++ b/src/test/ui/order-dependent-cast-inference.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { // Tests case where inference fails due to the order in which casts are checked. // Ideally this would compile, see #48270. diff --git a/src/test/ui/order-dependent-cast-inference.stderr b/src/test/ui/order-dependent-cast-inference.stderr index 556acc87cff..081038c573a 100644 --- a/src/test/ui/order-dependent-cast-inference.stderr +++ b/src/test/ui/order-dependent-cast-inference.stderr @@ -1,5 +1,5 @@ error[E0641]: cannot cast to a pointer of an unknown kind - --> $DIR/order-dependent-cast-inference.rs:15:17 + --> $DIR/order-dependent-cast-inference.rs:5:17 | LL | let mut y = 0 as *const _; | ^^^^^-------- diff --git a/src/test/ui/orphan-check-diagnostics.rs b/src/test/ui/orphan-check-diagnostics.rs index 8201565c331..9a29620ae65 100644 --- a/src/test/ui/orphan-check-diagnostics.rs +++ b/src/test/ui/orphan-check-diagnostics.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:orphan_check_diagnostics.rs // see #22388 diff --git a/src/test/ui/orphan-check-diagnostics.stderr b/src/test/ui/orphan-check-diagnostics.stderr index dc134dd8d6f..4bd6aa2c154 100644 --- a/src/test/ui/orphan-check-diagnostics.stderr +++ b/src/test/ui/orphan-check-diagnostics.stderr @@ -1,5 +1,5 @@ -error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct`) - --> $DIR/orphan-check-diagnostics.rs:20:1 +error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) + --> $DIR/orphan-check-diagnostics.rs:10:1 | LL | impl RemoteTrait for T where T: LocalTrait {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type diff --git a/src/test/ui/osx-frameworks.rs b/src/test/ui/osx-frameworks.rs index 026ef3c95f6..227e07de9a8 100644 --- a/src/test/ui/osx-frameworks.rs +++ b/src/test/ui/osx-frameworks.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-macos this is supposed to succeed on osx #[link(name = "foo", kind = "framework")] diff --git a/src/test/ui/osx-frameworks.stderr b/src/test/ui/osx-frameworks.stderr index cdc2357c36c..f3532913423 100644 --- a/src/test/ui/osx-frameworks.stderr +++ b/src/test/ui/osx-frameworks.stderr @@ -1,5 +1,5 @@ error[E0455]: native frameworks are only available on macOS targets - --> $DIR/osx-frameworks.rs:13:1 + --> $DIR/osx-frameworks.rs:3:1 | LL | #[link(name = "foo", kind = "framework")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/out-of-order-shadowing.rs b/src/test/ui/out-of-order-shadowing.rs index 977b475b113..b4cb6a23830 100644 --- a/src/test/ui/out-of-order-shadowing.rs +++ b/src/test/ui/out-of-order-shadowing.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:define_macro.rs macro_rules! bar { () => {} } diff --git a/src/test/ui/out-of-order-shadowing.stderr b/src/test/ui/out-of-order-shadowing.stderr index 4696e205728..17bda18f8f6 100644 --- a/src/test/ui/out-of-order-shadowing.stderr +++ b/src/test/ui/out-of-order-shadowing.stderr @@ -1,16 +1,16 @@ error[E0659]: `bar` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/out-of-order-shadowing.rs:15:1 + --> $DIR/out-of-order-shadowing.rs:5:1 | LL | bar!(); //~ ERROR `bar` is ambiguous | ^^^ ambiguous name | note: `bar` could refer to the macro defined here - --> $DIR/out-of-order-shadowing.rs:14:1 + --> $DIR/out-of-order-shadowing.rs:4:1 | LL | define_macro!(bar); | ^^^^^^^^^^^^^^^^^^^ note: `bar` could also refer to the macro defined here - --> $DIR/out-of-order-shadowing.rs:13:1 + --> $DIR/out-of-order-shadowing.rs:3:1 | LL | macro_rules! bar { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/output-type-mismatch.rs b/src/test/ui/output-type-mismatch.rs index 158e99ac200..35097aa9ec6 100644 --- a/src/test/ui/output-type-mismatch.rs +++ b/src/test/ui/output-type-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: mismatched types fn f() { } diff --git a/src/test/ui/output-type-mismatch.stderr b/src/test/ui/output-type-mismatch.stderr index e869dfa78a0..449d3120571 100644 --- a/src/test/ui/output-type-mismatch.stderr +++ b/src/test/ui/output-type-mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/output-type-mismatch.rs:15:31 + --> $DIR/output-type-mismatch.rs:5:31 | LL | fn main() { let i: isize; i = f(); } | ^^^ expected isize, found () diff --git a/src/test/ui/overlap-marker-trait.rs b/src/test/ui/overlap-marker-trait.rs index a649ae25f34..bf39d9c903f 100644 --- a/src/test/ui/overlap-marker-trait.rs +++ b/src/test/ui/overlap-marker-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for RFC 1268: we allow overlapping impls of marker traits, // that is, traits without items. In this case, a type `T` is // `MyMarker` if it is either `Debug` or `Display`. This test just diff --git a/src/test/ui/overlap-marker-trait.stderr b/src/test/ui/overlap-marker-trait.stderr index d739dfc59d2..21ba2367901 100644 --- a/src/test/ui/overlap-marker-trait.stderr +++ b/src/test/ui/overlap-marker-trait.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied - --> $DIR/overlap-marker-trait.rs:40:5 + --> $DIR/overlap-marker-trait.rs:30:5 | LL | is_marker::(); //~ ERROR | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` | note: required by `is_marker` - --> $DIR/overlap-marker-trait.rs:28:1 + --> $DIR/overlap-marker-trait.rs:18:1 | LL | fn is_marker() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/overloaded-calls-nontuple.rs b/src/test/ui/overloaded-calls-nontuple.rs index 7113224664b..62a7130ddeb 100644 --- a/src/test/ui/overloaded-calls-nontuple.rs +++ b/src/test/ui/overloaded-calls-nontuple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(fn_traits, unboxed_closures)] use std::ops::FnMut; diff --git a/src/test/ui/overloaded-calls-nontuple.stderr b/src/test/ui/overloaded-calls-nontuple.stderr index 78b86889553..31b5697adda 100644 --- a/src/test/ui/overloaded-calls-nontuple.stderr +++ b/src/test/ui/overloaded-calls-nontuple.stderr @@ -1,5 +1,5 @@ error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit - --> $DIR/overloaded-calls-nontuple.rs:36:10 + --> $DIR/overloaded-calls-nontuple.rs:26:10 | LL | drop(s(3)) //~ ERROR cannot use call notation | ^^^^ diff --git a/src/test/ui/packed-struct/packed-struct-generic-transmute.rs b/src/test/ui/packed-struct/packed-struct-generic-transmute.rs index c96184d5988..c6264b6d2b3 100644 --- a/src/test/ui/packed-struct/packed-struct-generic-transmute.rs +++ b/src/test/ui/packed-struct/packed-struct-generic-transmute.rs @@ -1,19 +1,9 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This assumes the packed and non-packed structs are different sizes. // the error points to the start of the file, not the line with the // transmute -// error-pattern: transmute called with types of different sizes +// error-pattern: cannot transmute between types of different sizes, or dependently-sized types use std::mem; diff --git a/src/test/ui/packed-struct/packed-struct-generic-transmute.stderr b/src/test/ui/packed-struct/packed-struct-generic-transmute.stderr index 397b1ddba71..744c832dbb4 100644 --- a/src/test/ui/packed-struct/packed-struct-generic-transmute.stderr +++ b/src/test/ui/packed-struct/packed-struct-generic-transmute.stderr @@ -1,11 +1,11 @@ -error[E0512]: transmute called with types of different sizes - --> $DIR/packed-struct-generic-transmute.rs:34:38 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/packed-struct-generic-transmute.rs:24:38 | LL | let oof: Oof<[u8; 5], i32> = mem::transmute(foo); | ^^^^^^^^^^^^^^ | - = note: source type: Foo<[u8; 5], i32> (72 bits) - = note: target type: Oof<[u8; 5], i32> (96 bits) + = note: source type: `Foo<[u8; 5], i32>` (72 bits) + = note: target type: `Oof<[u8; 5], i32>` (96 bits) error: aborting due to previous error diff --git a/src/test/ui/packed-struct/packed-struct-transmute.rs b/src/test/ui/packed-struct/packed-struct-transmute.rs index 695ffbdb2af..a7d284025d7 100644 --- a/src/test/ui/packed-struct/packed-struct-transmute.rs +++ b/src/test/ui/packed-struct/packed-struct-transmute.rs @@ -1,20 +1,10 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This assumes the packed and non-packed structs are different sizes. // the error points to the start of the file, not the line with the // transmute // normalize-stderr-test "\d+ bits" -> "N bits" -// error-pattern: transmute called with types of different sizes +// error-pattern: cannot transmute between types of different sizes, or dependently-sized types use std::mem; diff --git a/src/test/ui/packed-struct/packed-struct-transmute.stderr b/src/test/ui/packed-struct/packed-struct-transmute.stderr index 5da7d8f7b7e..80a8919f77b 100644 --- a/src/test/ui/packed-struct/packed-struct-transmute.stderr +++ b/src/test/ui/packed-struct/packed-struct-transmute.stderr @@ -1,11 +1,11 @@ -error[E0512]: transmute called with types of different sizes - --> $DIR/packed-struct-transmute.rs:36:24 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/packed-struct-transmute.rs:26:24 | LL | let oof: Oof = mem::transmute(foo); | ^^^^^^^^^^^^^^ | - = note: source type: Foo (N bits) - = note: target type: Oof (N bits) + = note: source type: `Foo` (N bits) + = note: target type: `Oof` (N bits) error: aborting due to previous error diff --git a/src/test/ui/panic-handler/auxiliary/some-panic-impl.rs b/src/test/ui/panic-handler/auxiliary/some-panic-impl.rs index 090123198d1..0348b3a2d76 100644 --- a/src/test/ui/panic-handler/auxiliary/some-panic-impl.rs +++ b/src/test/ui/panic-handler/auxiliary/some-panic-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-1.rs b/src/test/ui/panic-handler/panic-handler-bad-signature-1.rs index b82a2274390..775961d3fd7 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-1.rs +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-1.rs @@ -1,18 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort #![no_std] #![no_main] -#![feature(lang_items)] use core::panic::PanicInfo; diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr index 5771f4277b4..e3664489549 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr @@ -1,11 +1,11 @@ error: return type should be `!` - --> $DIR/panic-handler-bad-signature-1.rs:22:6 + --> $DIR/panic-handler-bad-signature-1.rs:11:6 | LL | ) -> () //~ ERROR return type should be `!` | ^^ error: argument should be `&PanicInfo` - --> $DIR/panic-handler-bad-signature-1.rs:21:11 + --> $DIR/panic-handler-bad-signature-1.rs:10:11 | LL | info: PanicInfo, //~ ERROR argument should be `&PanicInfo` | ^^^^^^^^^ diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-2.rs b/src/test/ui/panic-handler/panic-handler-bad-signature-2.rs index ccc9dfd7aaa..72793400058 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-2.rs +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-2.rs @@ -1,18 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort #![no_std] #![no_main] -#![feature(lang_items)] use core::panic::PanicInfo; diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr index 4823f8a2781..737ff313d0b 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr @@ -1,5 +1,5 @@ error: argument should be `&PanicInfo` - --> $DIR/panic-handler-bad-signature-2.rs:21:11 + --> $DIR/panic-handler-bad-signature-2.rs:10:11 | LL | info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo` | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-3.rs b/src/test/ui/panic-handler/panic-handler-bad-signature-3.rs index 03be5307986..ab9c9d7f417 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-3.rs +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-3.rs @@ -1,18 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort #![no_std] #![no_main] -#![feature(lang_items)] use core::panic::PanicInfo; diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr index 5d0395e17f5..c0b39769a49 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr @@ -1,5 +1,5 @@ error: function should have one argument - --> $DIR/panic-handler-bad-signature-3.rs:20:1 + --> $DIR/panic-handler-bad-signature-3.rs:9:1 | LL | fn panic() -> ! { //~ ERROR function should have one argument | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-4.rs b/src/test/ui/panic-handler/panic-handler-bad-signature-4.rs index ba013b87e37..8240ab08326 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-4.rs +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-4.rs @@ -1,18 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort #![no_std] #![no_main] -#![feature(lang_items)] use core::panic::PanicInfo; diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr index a61b9b3743c..bd25c8b02f8 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr @@ -1,5 +1,5 @@ error: should have no type parameters - --> $DIR/panic-handler-bad-signature-4.rs:20:1 + --> $DIR/panic-handler-bad-signature-4.rs:9:1 | LL | / fn panic(pi: &PanicInfo) -> ! { LL | | //~^ ERROR should have no type parameters diff --git a/src/test/ui/panic-handler/panic-handler-duplicate.rs b/src/test/ui/panic-handler/panic-handler-duplicate.rs index c4fb4903e00..caa130ef460 100644 --- a/src/test/ui/panic-handler/panic-handler-duplicate.rs +++ b/src/test/ui/panic-handler/panic-handler-duplicate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort #![feature(lang_items)] diff --git a/src/test/ui/panic-handler/panic-handler-duplicate.stderr b/src/test/ui/panic-handler/panic-handler-duplicate.stderr index e243d9079d8..80deff23a87 100644 --- a/src/test/ui/panic-handler/panic-handler-duplicate.stderr +++ b/src/test/ui/panic-handler/panic-handler-duplicate.stderr @@ -1,5 +1,5 @@ error[E0152]: duplicate lang item found: `panic_impl`. - --> $DIR/panic-handler-duplicate.rs:25:1 + --> $DIR/panic-handler-duplicate.rs:15:1 | LL | / fn panic2(info: &PanicInfo) -> ! { //~ ERROR duplicate lang item found: `panic_impl`. LL | | loop {} @@ -7,7 +7,7 @@ LL | | } | |_^ | note: first defined here. - --> $DIR/panic-handler-duplicate.rs:20:1 + --> $DIR/panic-handler-duplicate.rs:10:1 | LL | / fn panic(info: &PanicInfo) -> ! { LL | | loop {} diff --git a/src/test/ui/panic-handler/panic-handler-requires-panic-info.rs b/src/test/ui/panic-handler/panic-handler-requires-panic-info.rs index 133d6c0557a..f13c12fc52e 100644 --- a/src/test/ui/panic-handler/panic-handler-requires-panic-info.rs +++ b/src/test/ui/panic-handler/panic-handler-requires-panic-info.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort // error-pattern: language item required, but not found: `panic_info` diff --git a/src/test/ui/panic-handler/panic-handler-std.rs b/src/test/ui/panic-handler/panic-handler-std.rs index ff5995237cf..fffb5977871 100644 --- a/src/test/ui/panic-handler/panic-handler-std.rs +++ b/src/test/ui/panic-handler/panic-handler-std.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: duplicate lang item found: `panic_impl`. diff --git a/src/test/ui/panic-handler/panic-handler-std.stderr b/src/test/ui/panic-handler/panic-handler-std.stderr index 4ec1c6df355..32240311116 100644 --- a/src/test/ui/panic-handler/panic-handler-std.stderr +++ b/src/test/ui/panic-handler/panic-handler-std.stderr @@ -1,5 +1,5 @@ error[E0152]: duplicate lang item found: `panic_impl`. - --> $DIR/panic-handler-std.rs:17:1 + --> $DIR/panic-handler-std.rs:7:1 | LL | / fn panic(info: PanicInfo) -> ! { LL | | loop {} @@ -9,7 +9,7 @@ LL | | } = note: first defined in crate `std`. error: argument should be `&PanicInfo` - --> $DIR/panic-handler-std.rs:17:16 + --> $DIR/panic-handler-std.rs:7:16 | LL | fn panic(info: PanicInfo) -> ! { | ^^^^^^^^^ diff --git a/src/test/ui/panic-handler/panic-handler-wrong-location.rs b/src/test/ui/panic-handler/panic-handler-wrong-location.rs index 8d0b655515d..dca59101805 100644 --- a/src/test/ui/panic-handler/panic-handler-wrong-location.rs +++ b/src/test/ui/panic-handler/panic-handler-wrong-location.rs @@ -1,19 +1,8 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort #![no_std] #![no_main] -#![feature(lang_items)] -#[panic_handler] +#[panic_handler] //~ ERROR `panic_impl` language item must be applied to a function #[no_mangle] static X: u32 = 42; diff --git a/src/test/ui/panic-handler/panic-handler-wrong-location.stderr b/src/test/ui/panic-handler/panic-handler-wrong-location.stderr index a164b04a4f8..cab45d8bfad 100644 --- a/src/test/ui/panic-handler/panic-handler-wrong-location.stderr +++ b/src/test/ui/panic-handler/panic-handler-wrong-location.stderr @@ -1,7 +1,7 @@ error[E0718]: `panic_impl` language item must be applied to a function - --> $DIR/panic-handler-wrong-location.rs:17:1 + --> $DIR/panic-handler-wrong-location.rs:6:1 | -LL | #[panic_handler] +LL | #[panic_handler] //~ ERROR `panic_impl` language item must be applied to a function | ^^^^^^^^^^^^^^^^ attribute should be applied to a function, not a static item error: `#[panic_handler]` function required, but not found diff --git a/src/test/ui/panic-runtime/abort-link-to-unwind-dylib.rs b/src/test/ui/panic-runtime/abort-link-to-unwind-dylib.rs index f392ccd7676..7e1174a2734 100644 --- a/src/test/ui/panic-runtime/abort-link-to-unwind-dylib.rs +++ b/src/test/ui/panic-runtime/abort-link-to-unwind-dylib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort -C prefer-dynamic // ignore-musl - no dylibs here // ignore-cloudabi diff --git a/src/test/ui/panic-runtime/auxiliary/depends.rs b/src/test/ui/panic-runtime/auxiliary/depends.rs deleted file mode 100644 index b90dec9281b..00000000000 --- a/src/test/ui/panic-runtime/auxiliary/depends.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![feature(panic_runtime)] -#![crate_type = "rlib"] -#![panic_runtime] -#![no_std] - -extern crate needs_panic_runtime; diff --git a/src/test/ui/panic-runtime/auxiliary/needs-panic-runtime.rs b/src/test/ui/panic-runtime/auxiliary/needs-panic-runtime.rs deleted file mode 100644 index d6c21fecf6b..00000000000 --- a/src/test/ui/panic-runtime/auxiliary/needs-panic-runtime.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![feature(needs_panic_runtime)] -#![crate_type = "rlib"] -#![needs_panic_runtime] -#![no_std] diff --git a/src/test/ui/panic-runtime/auxiliary/panic-runtime-abort.rs b/src/test/ui/panic-runtime/auxiliary/panic-runtime-abort.rs index 3b74156b6b0..433301fb434 100644 --- a/src/test/ui/panic-runtime/auxiliary/panic-runtime-abort.rs +++ b/src/test/ui/panic-runtime/auxiliary/panic-runtime-abort.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort // no-prefer-dynamic diff --git a/src/test/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs b/src/test/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs index d9848a554ab..abe34a39caf 100644 --- a/src/test/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs +++ b/src/test/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/ui/panic-runtime/auxiliary/panic-runtime-unwind.rs b/src/test/ui/panic-runtime/auxiliary/panic-runtime-unwind.rs index 4bb36839d98..97452a342ab 100644 --- a/src/test/ui/panic-runtime/auxiliary/panic-runtime-unwind.rs +++ b/src/test/ui/panic-runtime/auxiliary/panic-runtime-unwind.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=unwind // no-prefer-dynamic diff --git a/src/test/ui/panic-runtime/auxiliary/panic-runtime-unwind2.rs b/src/test/ui/panic-runtime/auxiliary/panic-runtime-unwind2.rs index 4bb36839d98..97452a342ab 100644 --- a/src/test/ui/panic-runtime/auxiliary/panic-runtime-unwind2.rs +++ b/src/test/ui/panic-runtime/auxiliary/panic-runtime-unwind2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=unwind // no-prefer-dynamic diff --git a/src/test/ui/panic-runtime/auxiliary/wants-panic-runtime-abort.rs b/src/test/ui/panic-runtime/auxiliary/wants-panic-runtime-abort.rs index e1902e44a60..3c0d2d6588e 100644 --- a/src/test/ui/panic-runtime/auxiliary/wants-panic-runtime-abort.rs +++ b/src/test/ui/panic-runtime/auxiliary/wants-panic-runtime-abort.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=abort // no-prefer-dynamic diff --git a/src/test/ui/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs b/src/test/ui/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs index 2183338b249..d5f0102196f 100644 --- a/src/test/ui/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs +++ b/src/test/ui/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic #![crate_type = "rlib"] diff --git a/src/test/ui/panic-runtime/bad-panic-flag1.rs b/src/test/ui/panic-runtime/bad-panic-flag1.rs index f067b6b8349..1ac6a3423ff 100644 --- a/src/test/ui/panic-runtime/bad-panic-flag1.rs +++ b/src/test/ui/panic-runtime/bad-panic-flag1.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic=foo -// error-pattern:either `panic` or `abort` was expected +// error-pattern:either `unwind` or `abort` was expected fn main() {} diff --git a/src/test/ui/panic-runtime/bad-panic-flag1.stderr b/src/test/ui/panic-runtime/bad-panic-flag1.stderr index 3a65419c98f..013373c6f93 100644 --- a/src/test/ui/panic-runtime/bad-panic-flag1.stderr +++ b/src/test/ui/panic-runtime/bad-panic-flag1.stderr @@ -1,2 +1,2 @@ -error: incorrect value `foo` for codegen option `panic` - either `panic` or `abort` was expected +error: incorrect value `foo` for codegen option `panic` - either `unwind` or `abort` was expected diff --git a/src/test/ui/panic-runtime/bad-panic-flag2.rs b/src/test/ui/panic-runtime/bad-panic-flag2.rs index 0ecf65f080f..c79701c83f3 100644 --- a/src/test/ui/panic-runtime/bad-panic-flag2.rs +++ b/src/test/ui/panic-runtime/bad-panic-flag2.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-C panic -// error-pattern:requires either `panic` or `abort` +// error-pattern:requires either `unwind` or `abort` fn main() {} diff --git a/src/test/ui/panic-runtime/bad-panic-flag2.stderr b/src/test/ui/panic-runtime/bad-panic-flag2.stderr index 8d919e55c90..6ab94ea704d 100644 --- a/src/test/ui/panic-runtime/bad-panic-flag2.stderr +++ b/src/test/ui/panic-runtime/bad-panic-flag2.stderr @@ -1,2 +1,2 @@ -error: codegen option `panic` requires either `panic` or `abort` (C panic=) +error: codegen option `panic` requires either `unwind` or `abort` (C panic=) diff --git a/src/test/ui/panic-runtime/libtest-unwinds.rs b/src/test/ui/panic-runtime/libtest-unwinds.rs index 71751034c39..47dd8c3efe5 100644 --- a/src/test/ui/panic-runtime/libtest-unwinds.rs +++ b/src/test/ui/panic-runtime/libtest-unwinds.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:is not compiled with this crate's panic strategy `abort` // compile-flags:-C panic=abort // ignore-wasm32-bare compiled with panic=abort by default diff --git a/src/test/ui/panic-runtime/needs-gate.rs b/src/test/ui/panic-runtime/needs-gate.rs index 1b3b978c408..9e143adfeb2 100644 --- a/src/test/ui/panic-runtime/needs-gate.rs +++ b/src/test/ui/panic-runtime/needs-gate.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-needs_panic_runtime // gate-test-panic_runtime diff --git a/src/test/ui/panic-runtime/needs-gate.stderr b/src/test/ui/panic-runtime/needs-gate.stderr index aa2b97556dc..75ddda79b2d 100644 --- a/src/test/ui/panic-runtime/needs-gate.stderr +++ b/src/test/ui/panic-runtime/needs-gate.stderr @@ -1,5 +1,5 @@ error[E0658]: the `#[panic_runtime]` attribute is an experimental feature (see issue #32837) - --> $DIR/needs-gate.rs:14:1 + --> $DIR/needs-gate.rs:4:1 | LL | #![panic_runtime] //~ ERROR: is an experimental feature | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #![panic_runtime] //~ ERROR: is an experimental feature = help: add #![feature(panic_runtime)] to the crate attributes to enable error[E0658]: the `#[needs_panic_runtime]` attribute is an experimental feature (see issue #32837) - --> $DIR/needs-gate.rs:15:1 + --> $DIR/needs-gate.rs:5:1 | LL | #![needs_panic_runtime] //~ ERROR: is an experimental feature | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs b/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs deleted file mode 100644 index 7cfdacbd983..00000000000 --- a/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:needs-panic-runtime.rs -// aux-build:depends.rs -// error-pattern:cannot depend on a crate that needs a panic runtime - -extern crate depends; diff --git a/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.stderr b/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.stderr deleted file mode 100644 index 0e68c9b806d..00000000000 --- a/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error: the crate `depends` cannot depend on a crate that needs a panic runtime, but it depends on `needs_panic_runtime` - -error[E0601]: `main` function not found in crate `runtime_depend_on_needs_runtime` - | - = note: consider adding a `main` function to `$DIR/runtime-depend-on-needs-runtime.rs` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/panic-runtime/transitive-link-a-bunch.rs b/src/test/ui/panic-runtime/transitive-link-a-bunch.rs index e40706b7935..b6da7871415 100644 --- a/src/test/ui/panic-runtime/transitive-link-a-bunch.rs +++ b/src/test/ui/panic-runtime/transitive-link-a-bunch.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:panic-runtime-unwind.rs // aux-build:panic-runtime-abort.rs // aux-build:wants-panic-runtime-unwind.rs diff --git a/src/test/ui/panic-runtime/want-unwind-got-abort.rs b/src/test/ui/panic-runtime/want-unwind-got-abort.rs index 38de5d4407b..30fc0771ecd 100644 --- a/src/test/ui/panic-runtime/want-unwind-got-abort.rs +++ b/src/test/ui/panic-runtime/want-unwind-got-abort.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:is incompatible with this crate's strategy of `unwind` // aux-build:panic-runtime-abort.rs // aux-build:panic-runtime-lang-items.rs diff --git a/src/test/ui/panic-runtime/want-unwind-got-abort2.rs b/src/test/ui/panic-runtime/want-unwind-got-abort2.rs index bb47dc84904..5250a1d5d48 100644 --- a/src/test/ui/panic-runtime/want-unwind-got-abort2.rs +++ b/src/test/ui/panic-runtime/want-unwind-got-abort2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:is incompatible with this crate's strategy of `unwind` // aux-build:panic-runtime-abort.rs // aux-build:wants-panic-runtime-abort.rs diff --git a/src/test/ui/panic_implementation-closures.rs b/src/test/ui/panic_implementation-closures.rs index 5902a1ae1b0..92c333b4092 100644 --- a/src/test/ui/panic_implementation-closures.rs +++ b/src/test/ui/panic_implementation-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![crate_type = "rlib"] diff --git a/src/test/ui/paren-span.rs b/src/test/ui/paren-span.rs index 8ed5050f3de..24fadb24de2 100644 --- a/src/test/ui/paren-span.rs +++ b/src/test/ui/paren-span.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Be smart about span of parenthesized expression in macro. macro_rules! paren { diff --git a/src/test/ui/paren-span.stderr b/src/test/ui/paren-span.stderr index df6881a1af3..23e6ade0469 100644 --- a/src/test/ui/paren-span.stderr +++ b/src/test/ui/paren-span.stderr @@ -1,5 +1,5 @@ error[E0616]: field `x` of struct `m::S` is private - --> $DIR/paren-span.rs:29:12 + --> $DIR/paren-span.rs:19:12 | LL | paren!(s.x); //~ ERROR field `x` of struct `m::S` is private | ^^^ diff --git a/src/test/ui/parenthesized-deref-suggestion.rs b/src/test/ui/parenthesized-deref-suggestion.rs new file mode 100644 index 00000000000..0b4ccdd5a56 --- /dev/null +++ b/src/test/ui/parenthesized-deref-suggestion.rs @@ -0,0 +1,11 @@ +struct Session { + opts: u8, +} + +fn main() { + let sess: &Session = &Session { opts: 0 }; + (sess as *const Session).opts; //~ ERROR no field `opts` on type `*const Session` + + let x = [0u32]; + (x as [u32; 1]).0; //~ ERROR no field `0` on type `[u32; 1]` +} diff --git a/src/test/ui/parenthesized-deref-suggestion.stderr b/src/test/ui/parenthesized-deref-suggestion.stderr new file mode 100644 index 00000000000..fd9b0e8216b --- /dev/null +++ b/src/test/ui/parenthesized-deref-suggestion.stderr @@ -0,0 +1,21 @@ +error[E0609]: no field `opts` on type `*const Session` + --> $DIR/parenthesized-deref-suggestion.rs:7:30 + | +LL | (sess as *const Session).opts; //~ ERROR no field `opts` on type `*const Session` + | ^^^^ +help: `(sess as *const Session)` is a raw pointer; try dereferencing it + | +LL | (*(sess as *const Session)).opts; //~ ERROR no field `opts` on type `*const Session` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0609]: no field `0` on type `[u32; 1]` + --> $DIR/parenthesized-deref-suggestion.rs:10:21 + | +LL | (x as [u32; 1]).0; //~ ERROR no field `0` on type `[u32; 1]` + | ----------------^ + | | + | help: instead of using tuple indexing, use array indexing: `(x as [u32; 1])[0]` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0609`. diff --git a/src/test/ui/parse-error-correct.rs b/src/test/ui/parse-error-correct.rs index bc7c333723d..f167b3595d9 100644 --- a/src/test/ui/parse-error-correct.rs +++ b/src/test/ui/parse-error-correct.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z continue-parse-after-error // Test that the parser is error correcting missing idents. Despite a parsing diff --git a/src/test/ui/parse-error-correct.stderr b/src/test/ui/parse-error-correct.stderr index 9c87806da9e..529a93cf304 100644 --- a/src/test/ui/parse-error-correct.stderr +++ b/src/test/ui/parse-error-correct.stderr @@ -1,17 +1,17 @@ error: unexpected token: `;` - --> $DIR/parse-error-correct.rs:18:15 + --> $DIR/parse-error-correct.rs:8:15 | LL | let x = y.; //~ ERROR unexpected token | ^ error: unexpected token: `(` - --> $DIR/parse-error-correct.rs:19:15 + --> $DIR/parse-error-correct.rs:9:15 | LL | let x = y.(); //~ ERROR unexpected token | ^ error[E0618]: expected function, found `{integer}` - --> $DIR/parse-error-correct.rs:19:13 + --> $DIR/parse-error-correct.rs:9:13 | LL | let y = 42; | - `{integer}` defined here @@ -22,7 +22,7 @@ LL | let x = y.(); //~ ERROR unexpected token | call expression requires function error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields - --> $DIR/parse-error-correct.rs:21:15 + --> $DIR/parse-error-correct.rs:11:15 | LL | let x = y.foo; //~ ERROR `{integer}` is a primitive type and therefore doesn't have fields [E061 | ^^^ diff --git a/src/test/ui/parser-recovery-1.rs b/src/test/ui/parser-recovery-1.rs index f51bcb9e70c..21d36048e67 100644 --- a/src/test/ui/parser-recovery-1.rs +++ b/src/test/ui/parser-recovery-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z continue-parse-after-error // Test that we can recover from missing braces in the parser. diff --git a/src/test/ui/parser-recovery-1.stderr b/src/test/ui/parser-recovery-1.stderr index 5ba96e1a5dd..28505a8a056 100644 --- a/src/test/ui/parser-recovery-1.stderr +++ b/src/test/ui/parser-recovery-1.stderr @@ -1,5 +1,5 @@ error: this file contains an un-closed delimiter - --> $DIR/parser-recovery-1.rs:25:55 + --> $DIR/parser-recovery-1.rs:15:55 | LL | trait Foo { | - un-closed delimiter @@ -13,19 +13,19 @@ LL | } //~ ERROR this file contains an un-closed delimiter | ^ error: unexpected token: `;` - --> $DIR/parser-recovery-1.rs:22:15 + --> $DIR/parser-recovery-1.rs:12:15 | LL | let x = y.; | ^ error[E0425]: cannot find function `foo` in this scope - --> $DIR/parser-recovery-1.rs:17:17 + --> $DIR/parser-recovery-1.rs:7:17 | LL | let x = foo(); | ^^^ not found in this scope error[E0425]: cannot find value `y` in this scope - --> $DIR/parser-recovery-1.rs:22:13 + --> $DIR/parser-recovery-1.rs:12:13 | LL | let x = y.; | ^ not found in this scope diff --git a/src/test/ui/parser-recovery-2.rs b/src/test/ui/parser-recovery-2.rs index 03b1a9b876f..be686ccbc22 100644 --- a/src/test/ui/parser-recovery-2.rs +++ b/src/test/ui/parser-recovery-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z continue-parse-after-error // Test that we can recover from mismatched braces in the parser. diff --git a/src/test/ui/parser-recovery-2.stderr b/src/test/ui/parser-recovery-2.stderr index 2965e4eb581..92d8cbc100a 100644 --- a/src/test/ui/parser-recovery-2.stderr +++ b/src/test/ui/parser-recovery-2.stderr @@ -1,5 +1,5 @@ error: incorrect close delimiter: `)` - --> $DIR/parser-recovery-2.rs:18:5 + --> $DIR/parser-recovery-2.rs:8:5 | LL | fn bar() { | - un-closed delimiter @@ -8,19 +8,19 @@ LL | ) //~ ERROR incorrect close delimiter: `)` | ^ incorrect close delimiter error: unexpected token: `;` - --> $DIR/parser-recovery-2.rs:22:15 + --> $DIR/parser-recovery-2.rs:12:15 | LL | let x = y.; //~ ERROR unexpected token | ^ error[E0425]: cannot find function `foo` in this scope - --> $DIR/parser-recovery-2.rs:17:17 + --> $DIR/parser-recovery-2.rs:7:17 | LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope | ^^^ not found in this scope error[E0425]: cannot find value `y` in this scope - --> $DIR/parser-recovery-2.rs:22:13 + --> $DIR/parser-recovery-2.rs:12:13 | LL | let x = y.; //~ ERROR unexpected token | ^ not found in this scope diff --git a/src/test/ui/parser/ascii-only-character-escape.rs b/src/test/ui/parser/ascii-only-character-escape.rs index a8c40225c30..f1b028ea8de 100644 --- a/src/test/ui/parser/ascii-only-character-escape.rs +++ b/src/test/ui/parser/ascii-only-character-escape.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error fn main() { let x = "\x80"; //~ ERROR may only be used diff --git a/src/test/ui/parser/ascii-only-character-escape.stderr b/src/test/ui/parser/ascii-only-character-escape.stderr index e09db780880..d3330a405c0 100644 --- a/src/test/ui/parser/ascii-only-character-escape.stderr +++ b/src/test/ui/parser/ascii-only-character-escape.stderr @@ -1,17 +1,17 @@ error: this form of character escape may only be used with characters in the range [/x00-/x7f] - --> $DIR/ascii-only-character-escape.rs:14:16 + --> $DIR/ascii-only-character-escape.rs:4:16 | LL | let x = "/x80"; //~ ERROR may only be used | ^^ error: this form of character escape may only be used with characters in the range [/x00-/x7f] - --> $DIR/ascii-only-character-escape.rs:15:16 + --> $DIR/ascii-only-character-escape.rs:5:16 | LL | let y = "/xff"; //~ ERROR may only be used | ^^ error: this form of character escape may only be used with characters in the range [/x00-/x7f] - --> $DIR/ascii-only-character-escape.rs:16:16 + --> $DIR/ascii-only-character-escape.rs:6:16 | LL | let z = "/xe2"; //~ ERROR may only be used | ^^ diff --git a/src/test/ui/parser/assoc-oddities-1.rs b/src/test/ui/parser/assoc-oddities-1.rs index 63408b76b15..5914805e5c1 100644 --- a/src/test/ui/parser/assoc-oddities-1.rs +++ b/src/test/ui/parser/assoc-oddities-1.rs @@ -1,21 +1,11 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z parse-only -fn that_odd_parse() { +fn main() { // following lines below parse and must not fail x = if c { a } else { b }(); x = if true { 1 } else { 0 } as *mut _; // however this does not parse and probably should fail to retain compat? - // NB: `..` here is arbitrary, failure happens/should happen ∀ops that aren’t `=` + // N.B., `..` here is arbitrary, failure happens/should happen ∀ops that aren’t `=` // see assoc-oddities-2 and assoc-oddities-3 ..if c { a } else { b }[n]; //~ ERROR expected one of } diff --git a/src/test/ui/parser/assoc-oddities-1.stderr b/src/test/ui/parser/assoc-oddities-1.stderr index 2d39546dca8..076bca0fc3a 100644 --- a/src/test/ui/parser/assoc-oddities-1.stderr +++ b/src/test/ui/parser/assoc-oddities-1.stderr @@ -1,5 +1,5 @@ error: expected one of `.`, `;`, `?`, or `}`, found `[` - --> $DIR/assoc-oddities-1.rs:20:28 + --> $DIR/assoc-oddities-1.rs:10:28 | LL | ..if c { a } else { b }[n]; //~ ERROR expected one of | ^ expected one of `.`, `;`, `?`, or `}` here diff --git a/src/test/ui/parser/assoc-oddities-2.rs b/src/test/ui/parser/assoc-oddities-2.rs index 5679328edc9..3d35aad7455 100644 --- a/src/test/ui/parser/assoc-oddities-2.rs +++ b/src/test/ui/parser/assoc-oddities-2.rs @@ -1,16 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z parse-only -fn that_odd_parse() { +fn main() { // see assoc-oddities-1 for explanation x..if c { a } else { b }[n]; //~ ERROR expected one of } diff --git a/src/test/ui/parser/assoc-oddities-2.stderr b/src/test/ui/parser/assoc-oddities-2.stderr index 878ef682747..56810291252 100644 --- a/src/test/ui/parser/assoc-oddities-2.stderr +++ b/src/test/ui/parser/assoc-oddities-2.stderr @@ -1,5 +1,5 @@ error: expected one of `.`, `;`, `?`, or `}`, found `[` - --> $DIR/assoc-oddities-2.rs:15:29 + --> $DIR/assoc-oddities-2.rs:5:29 | LL | x..if c { a } else { b }[n]; //~ ERROR expected one of | ^ expected one of `.`, `;`, `?`, or `}` here diff --git a/src/test/ui/parser/associated-types-project-from-hrtb-explicit.rs b/src/test/ui/parser/associated-types-project-from-hrtb-explicit.rs index 70055a10181..ed9c996d4cc 100644 --- a/src/test/ui/parser/associated-types-project-from-hrtb-explicit.rs +++ b/src/test/ui/parser/associated-types-project-from-hrtb-explicit.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error // Test you can't use a higher-ranked trait bound inside of a qualified // path (just won't parse). diff --git a/src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr b/src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr index 59b378c2088..ceea4625e3e 100644 --- a/src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr +++ b/src/test/ui/parser/associated-types-project-from-hrtb-explicit.stderr @@ -1,11 +1,15 @@ error: expected identifier, found keyword `for` - --> $DIR/associated-types-project-from-hrtb-explicit.rs:22:21 + --> $DIR/associated-types-project-from-hrtb-explicit.rs:12:21 | LL | fn foo2(x: Foo<&'x isize>>::A) | ^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | fn foo2(x: Foo<&'x isize>>::A) + | ^^^^^ error: expected one of `::` or `>`, found `Foo` - --> $DIR/associated-types-project-from-hrtb-explicit.rs:22:29 + --> $DIR/associated-types-project-from-hrtb-explicit.rs:12:29 | LL | fn foo2(x: Foo<&'x isize>>::A) | ^^^ expected one of `::` or `>` here diff --git a/src/test/ui/parser/attr-bad-meta-2.rs b/src/test/ui/parser/attr-bad-meta-2.rs index 121a0d8eba2..cefd3369742 100644 --- a/src/test/ui/parser/attr-bad-meta-2.rs +++ b/src/test/ui/parser/attr-bad-meta-2.rs @@ -1,14 +1,2 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - #[path =] //~ ERROR unexpected token: `]` mod m {} diff --git a/src/test/ui/parser/attr-bad-meta-2.stderr b/src/test/ui/parser/attr-bad-meta-2.stderr index b869331ca5a..ddc7a4b034b 100644 --- a/src/test/ui/parser/attr-bad-meta-2.stderr +++ b/src/test/ui/parser/attr-bad-meta-2.stderr @@ -1,5 +1,5 @@ error: unexpected token: `]` - --> $DIR/attr-bad-meta-2.rs:13:9 + --> $DIR/attr-bad-meta-2.rs:1:9 | LL | #[path =] //~ ERROR unexpected token: `]` | ^ unexpected token after this diff --git a/src/test/ui/parser/attr-bad-meta-3.rs b/src/test/ui/parser/attr-bad-meta-3.rs index e0558443a36..b51e9f2212d 100644 --- a/src/test/ui/parser/attr-bad-meta-3.rs +++ b/src/test/ui/parser/attr-bad-meta-3.rs @@ -1,14 +1,2 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - #[path() token] //~ ERROR expected `]`, found `token` mod m {} diff --git a/src/test/ui/parser/attr-bad-meta-3.stderr b/src/test/ui/parser/attr-bad-meta-3.stderr index bef2f423ab9..863a2d2069f 100644 --- a/src/test/ui/parser/attr-bad-meta-3.stderr +++ b/src/test/ui/parser/attr-bad-meta-3.stderr @@ -1,5 +1,5 @@ error: expected `]`, found `token` - --> $DIR/attr-bad-meta-3.rs:13:10 + --> $DIR/attr-bad-meta-3.rs:1:10 | LL | #[path() token] //~ ERROR expected `]`, found `token` | ^^^^^ expected `]` diff --git a/src/test/ui/parser/attr-bad-meta.rs b/src/test/ui/parser/attr-bad-meta.rs index cf9c3f9a35f..7fe54272491 100644 --- a/src/test/ui/parser/attr-bad-meta.rs +++ b/src/test/ui/parser/attr-bad-meta.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - #![feature(unrestricted_attribute_tokens)] #[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*` diff --git a/src/test/ui/parser/attr-bad-meta.stderr b/src/test/ui/parser/attr-bad-meta.stderr index d19fe25bad8..7351702ec9d 100644 --- a/src/test/ui/parser/attr-bad-meta.stderr +++ b/src/test/ui/parser/attr-bad-meta.stderr @@ -1,5 +1,5 @@ error: expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*` - --> $DIR/attr-bad-meta.rs:15:7 + --> $DIR/attr-bad-meta.rs:3:7 | LL | #[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*` | ^ expected one of `(`, `::`, `=`, `[`, `]`, or `{` here diff --git a/src/test/ui/parser/attr-before-eof.rs b/src/test/ui/parser/attr-before-eof.rs index c75b0ac122a..6af1783e630 100644 --- a/src/test/ui/parser/attr-before-eof.rs +++ b/src/test/ui/parser/attr-before-eof.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only +fn main() {} #[derive(Debug)] //~ERROR expected item after attributes diff --git a/src/test/ui/parser/attr-before-eof.stderr b/src/test/ui/parser/attr-before-eof.stderr index e96b9c4cc3d..a81dc52417a 100644 --- a/src/test/ui/parser/attr-before-eof.stderr +++ b/src/test/ui/parser/attr-before-eof.stderr @@ -1,5 +1,5 @@ error: expected item after attributes - --> $DIR/attr-before-eof.rs:13:16 + --> $DIR/attr-before-eof.rs:3:16 | LL | #[derive(Debug)] //~ERROR expected item after attributes | ^ diff --git a/src/test/ui/parser/attr-dangling-in-fn.rs b/src/test/ui/parser/attr-dangling-in-fn.rs index 7b731b6d6de..c7c45bafb0d 100644 --- a/src/test/ui/parser/attr-dangling-in-fn.rs +++ b/src/test/ui/parser/attr-dangling-in-fn.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // error-pattern:expected statement fn f() { diff --git a/src/test/ui/parser/attr-dangling-in-fn.stderr b/src/test/ui/parser/attr-dangling-in-fn.stderr index 0f530a2d402..71488d2e5c3 100644 --- a/src/test/ui/parser/attr-dangling-in-fn.stderr +++ b/src/test/ui/parser/attr-dangling-in-fn.stderr @@ -1,5 +1,5 @@ error: expected statement after outer attribute - --> $DIR/attr-dangling-in-fn.rs:17:1 + --> $DIR/attr-dangling-in-fn.rs:5:1 | LL | } | ^ diff --git a/src/test/ui/parser/attr-dangling-in-mod.rs b/src/test/ui/parser/attr-dangling-in-mod.rs index 79609935f9e..261ed3913af 100644 --- a/src/test/ui/parser/attr-dangling-in-mod.rs +++ b/src/test/ui/parser/attr-dangling-in-mod.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // error-pattern:expected item fn main() { diff --git a/src/test/ui/parser/attr-dangling-in-mod.stderr b/src/test/ui/parser/attr-dangling-in-mod.stderr index 1105e06f93c..d896b61ce49 100644 --- a/src/test/ui/parser/attr-dangling-in-mod.stderr +++ b/src/test/ui/parser/attr-dangling-in-mod.stderr @@ -1,5 +1,5 @@ error: expected item after attributes - --> $DIR/attr-dangling-in-mod.rs:18:14 + --> $DIR/attr-dangling-in-mod.rs:6:14 | LL | #[foo = "bar"] | ^ diff --git a/src/test/ui/parser/attr.rs b/src/test/ui/parser/attr.rs index 1f0a95826fc..91a4abbd038 100644 --- a/src/test/ui/parser/attr.rs +++ b/src/test/ui/parser/attr.rs @@ -1,18 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - #![feature(lang_items)] fn main() {} -#![lang(foo)] //~ ERROR an inner attribute is not permitted in this context +#![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context + //~| ERROR definition of an unknown language item: `foo` fn foo() {} diff --git a/src/test/ui/parser/attr.stderr b/src/test/ui/parser/attr.stderr index a977847679a..8151bd7cdd7 100644 --- a/src/test/ui/parser/attr.stderr +++ b/src/test/ui/parser/attr.stderr @@ -1,10 +1,17 @@ error: an inner attribute is not permitted in this context - --> $DIR/attr.rs:17:3 + --> $DIR/attr.rs:5:3 | -LL | #![lang(foo)] //~ ERROR an inner attribute is not permitted in this context +LL | #![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context | ^ | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. -error: aborting due to previous error +error[E0522]: definition of an unknown language item: `foo` + --> $DIR/attr.rs:5:1 + | +LL | #![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context + | ^^^^^^^^^^^^^^^^ definition of unknown language item `foo` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0522`. diff --git a/src/test/ui/parser/attrs-after-extern-mod.rs b/src/test/ui/parser/attrs-after-extern-mod.rs index 442eb14116e..4bdd16471cd 100644 --- a/src/test/ui/parser/attrs-after-extern-mod.rs +++ b/src/test/ui/parser/attrs-after-extern-mod.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Constants (static variables) can be used to match in patterns, but mutable // statics cannot. This ensures that there's some form of error if this is // attempted. diff --git a/src/test/ui/parser/attrs-after-extern-mod.stderr b/src/test/ui/parser/attrs-after-extern-mod.stderr index 70a7afc9060..067c4192ce6 100644 --- a/src/test/ui/parser/attrs-after-extern-mod.stderr +++ b/src/test/ui/parser/attrs-after-extern-mod.stderr @@ -1,5 +1,5 @@ error: expected item after attributes - --> $DIR/attrs-after-extern-mod.rs:22:19 + --> $DIR/attrs-after-extern-mod.rs:10:19 | LL | #[cfg(stage37)] //~ ERROR expected item after attributes | ^ diff --git a/src/test/ui/parser/bad-char-literals.rs b/src/test/ui/parser/bad-char-literals.rs index 821015ece77..1c9b5973be7 100644 --- a/src/test/ui/parser/bad-char-literals.rs +++ b/src/test/ui/parser/bad-char-literals.rs @@ -1,14 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error // ignore-tidy-cr // ignore-tidy-tab diff --git a/src/test/ui/parser/bad-char-literals.stderr b/src/test/ui/parser/bad-char-literals.stderr index 40f96655170..0335a4b83ea 100644 --- a/src/test/ui/parser/bad-char-literals.stderr +++ b/src/test/ui/parser/bad-char-literals.stderr @@ -1,11 +1,11 @@ error: character constant must be escaped: ' - --> $DIR/bad-char-literals.rs:17:6 + --> $DIR/bad-char-literals.rs:7:6 | LL | '''; | ^ error: character constant must be escaped: /n - --> $DIR/bad-char-literals.rs:21:6 + --> $DIR/bad-char-literals.rs:11:6 | LL | ' | ______^ @@ -13,13 +13,13 @@ LL | | '; | |_ error: character constant must be escaped: /r - --> $DIR/bad-char-literals.rs:26:6 + --> $DIR/bad-char-literals.rs:16:6 | LL | ' '; //~ ERROR: character constant must be escaped: /r | ^ error: character constant must be escaped: /t - --> $DIR/bad-char-literals.rs:29:6 + --> $DIR/bad-char-literals.rs:19:6 | LL | ' '; | ^^^^ diff --git a/src/test/ui/parser/bad-lit-suffixes.rs b/src/test/ui/parser/bad-lit-suffixes.rs index 0811a647024..391e7f0acf9 100644 --- a/src/test/ui/parser/bad-lit-suffixes.rs +++ b/src/test/ui/parser/bad-lit-suffixes.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error extern diff --git a/src/test/ui/parser/bad-lit-suffixes.stderr b/src/test/ui/parser/bad-lit-suffixes.stderr index bc15c329526..608c5fda248 100644 --- a/src/test/ui/parser/bad-lit-suffixes.stderr +++ b/src/test/ui/parser/bad-lit-suffixes.stderr @@ -1,53 +1,53 @@ error: ABI spec with a suffix is invalid - --> $DIR/bad-lit-suffixes.rs:15:5 + --> $DIR/bad-lit-suffixes.rs:5:5 | LL | "C"suffix //~ ERROR ABI spec with a suffix is invalid - | ^^^^^^^^^ + | ^^^^^^^^^ ABI spec with a suffix is invalid error: ABI spec with a suffix is invalid - --> $DIR/bad-lit-suffixes.rs:19:5 + --> $DIR/bad-lit-suffixes.rs:9:5 | LL | "C"suffix //~ ERROR ABI spec with a suffix is invalid - | ^^^^^^^^^ + | ^^^^^^^^^ ABI spec with a suffix is invalid error: string literal with a suffix is invalid - --> $DIR/bad-lit-suffixes.rs:23:5 + --> $DIR/bad-lit-suffixes.rs:13:5 | LL | ""suffix; //~ ERROR string literal with a suffix is invalid - | ^^^^^^^^ + | ^^^^^^^^ string literal with a suffix is invalid error: byte string literal with a suffix is invalid - --> $DIR/bad-lit-suffixes.rs:24:5 + --> $DIR/bad-lit-suffixes.rs:14:5 | LL | b""suffix; //~ ERROR byte string literal with a suffix is invalid - | ^^^^^^^^^ + | ^^^^^^^^^ byte string literal with a suffix is invalid error: string literal with a suffix is invalid - --> $DIR/bad-lit-suffixes.rs:25:5 + --> $DIR/bad-lit-suffixes.rs:15:5 | LL | r#""#suffix; //~ ERROR string literal with a suffix is invalid - | ^^^^^^^^^^^ + | ^^^^^^^^^^^ string literal with a suffix is invalid error: byte string literal with a suffix is invalid - --> $DIR/bad-lit-suffixes.rs:26:5 + --> $DIR/bad-lit-suffixes.rs:16:5 | LL | br#""#suffix; //~ ERROR byte string literal with a suffix is invalid - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ byte string literal with a suffix is invalid error: char literal with a suffix is invalid - --> $DIR/bad-lit-suffixes.rs:27:5 + --> $DIR/bad-lit-suffixes.rs:17:5 | LL | 'a'suffix; //~ ERROR char literal with a suffix is invalid - | ^^^^^^^^^ + | ^^^^^^^^^ char literal with a suffix is invalid error: byte literal with a suffix is invalid - --> $DIR/bad-lit-suffixes.rs:28:5 + --> $DIR/bad-lit-suffixes.rs:18:5 | LL | b'a'suffix; //~ ERROR byte literal with a suffix is invalid - | ^^^^^^^^^^ + | ^^^^^^^^^^ byte literal with a suffix is invalid error: invalid width `1024` for integer literal - --> $DIR/bad-lit-suffixes.rs:30:5 + --> $DIR/bad-lit-suffixes.rs:20:5 | LL | 1234u1024; //~ ERROR invalid width `1024` for integer literal | ^^^^^^^^^ @@ -55,7 +55,7 @@ LL | 1234u1024; //~ ERROR invalid width `1024` for integer literal = help: valid widths are 8, 16, 32, 64 and 128 error: invalid width `1024` for integer literal - --> $DIR/bad-lit-suffixes.rs:31:5 + --> $DIR/bad-lit-suffixes.rs:21:5 | LL | 1234i1024; //~ ERROR invalid width `1024` for integer literal | ^^^^^^^^^ @@ -63,7 +63,7 @@ LL | 1234i1024; //~ ERROR invalid width `1024` for integer literal = help: valid widths are 8, 16, 32, 64 and 128 error: invalid width `1024` for float literal - --> $DIR/bad-lit-suffixes.rs:32:5 + --> $DIR/bad-lit-suffixes.rs:22:5 | LL | 1234f1024; //~ ERROR invalid width `1024` for float literal | ^^^^^^^^^ @@ -71,7 +71,7 @@ LL | 1234f1024; //~ ERROR invalid width `1024` for float literal = help: valid widths are 32 and 64 error: invalid width `1024` for float literal - --> $DIR/bad-lit-suffixes.rs:33:5 + --> $DIR/bad-lit-suffixes.rs:23:5 | LL | 1234.5f1024; //~ ERROR invalid width `1024` for float literal | ^^^^^^^^^^^ @@ -79,34 +79,34 @@ LL | 1234.5f1024; //~ ERROR invalid width `1024` for float literal = help: valid widths are 32 and 64 error: invalid suffix `suffix` for numeric literal - --> $DIR/bad-lit-suffixes.rs:35:5 + --> $DIR/bad-lit-suffixes.rs:25:5 | LL | 1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal - | ^^^^^^^^^^ + | ^^^^^^^^^^ invalid suffix `suffix` | = help: the suffix must be one of the integral types (`u32`, `isize`, etc) error: invalid suffix `suffix` for numeric literal - --> $DIR/bad-lit-suffixes.rs:36:5 + --> $DIR/bad-lit-suffixes.rs:26:5 | LL | 0b101suffix; //~ ERROR invalid suffix `suffix` for numeric literal - | ^^^^^^^^^^^ + | ^^^^^^^^^^^ invalid suffix `suffix` | = help: the suffix must be one of the integral types (`u32`, `isize`, etc) error: invalid suffix `suffix` for float literal - --> $DIR/bad-lit-suffixes.rs:37:5 + --> $DIR/bad-lit-suffixes.rs:27:5 | LL | 1.0suffix; //~ ERROR invalid suffix `suffix` for float literal - | ^^^^^^^^^ + | ^^^^^^^^^ invalid suffix `suffix` | = help: valid suffixes are `f32` and `f64` error: invalid suffix `suffix` for float literal - --> $DIR/bad-lit-suffixes.rs:38:5 + --> $DIR/bad-lit-suffixes.rs:28:5 | LL | 1.0e10suffix; //~ ERROR invalid suffix `suffix` for float literal - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ invalid suffix `suffix` | = help: valid suffixes are `f32` and `f64` diff --git a/src/test/ui/parser/bad-match.rs b/src/test/ui/parser/bad-match.rs index b42c04f3ce2..79bc7eec311 100644 --- a/src/test/ui/parser/bad-match.rs +++ b/src/test/ui/parser/bad-match.rs @@ -1,21 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -// error-pattern: expected - fn main() { - let isize x = 5; + let isize x = 5; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `x` match x; } - -fn main() { -} diff --git a/src/test/ui/parser/bad-match.stderr b/src/test/ui/parser/bad-match.stderr index 7927a3d6138..dd3a2d2a27a 100644 --- a/src/test/ui/parser/bad-match.stderr +++ b/src/test/ui/parser/bad-match.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `x` - --> $DIR/bad-match.rs:16:13 + --> $DIR/bad-match.rs:2:13 | -LL | let isize x = 5; +LL | let isize x = 5; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `x` | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/bad-name.rs b/src/test/ui/parser/bad-name.rs index 201e6ced2f9..9b42716924d 100644 --- a/src/test/ui/parser/bad-name.rs +++ b/src/test/ui/parser/bad-name.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // error-pattern: expected fn main() { diff --git a/src/test/ui/parser/bad-name.stderr b/src/test/ui/parser/bad-name.stderr index c4ab3e18c9b..15e61cf06ca 100644 --- a/src/test/ui/parser/bad-name.stderr +++ b/src/test/ui/parser/bad-name.stderr @@ -1,5 +1,5 @@ error: expected one of `:`, `;`, `=`, or `@`, found `.` - --> $DIR/bad-name.rs:16:8 + --> $DIR/bad-name.rs:4:8 | LL | let x.y::.z foo; | ^ expected one of `:`, `;`, `=`, or `@` here diff --git a/src/test/ui/parser/bad-pointer-type.rs b/src/test/ui/parser/bad-pointer-type.rs index cdb4d16fed2..59e5e0c5d31 100644 --- a/src/test/ui/parser/bad-pointer-type.rs +++ b/src/test/ui/parser/bad-pointer-type.rs @@ -1,15 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn foo(_: *()) { - //~^ expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate) + //~^ ERROR expected mut or const in raw pointer type } + +fn main() {} diff --git a/src/test/ui/parser/bad-pointer-type.stderr b/src/test/ui/parser/bad-pointer-type.stderr index d41bbb3475b..e18c220affe 100644 --- a/src/test/ui/parser/bad-pointer-type.stderr +++ b/src/test/ui/parser/bad-pointer-type.stderr @@ -1,8 +1,10 @@ -error: expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate) - --> $DIR/bad-pointer-type.rs:13:11 +error: expected mut or const in raw pointer type + --> $DIR/bad-pointer-type.rs:1:11 | LL | fn foo(_: *()) { - | ^ + | ^ expected mut or const in raw pointer type + | + = help: use `*mut T` or `*const T` as appropriate error: aborting due to previous error diff --git a/src/test/ui/parser/bad-value-ident-false.rs b/src/test/ui/parser/bad-value-ident-false.rs index 96325a2abb4..4645ab4a775 100644 --- a/src/test/ui/parser/bad-value-ident-false.rs +++ b/src/test/ui/parser/bad-value-ident-false.rs @@ -1,14 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn false() { } //~ ERROR expected identifier, found keyword `false` fn main() { } diff --git a/src/test/ui/parser/bad-value-ident-false.stderr b/src/test/ui/parser/bad-value-ident-false.stderr index ac5fe784a9a..69a496f3a0c 100644 --- a/src/test/ui/parser/bad-value-ident-false.stderr +++ b/src/test/ui/parser/bad-value-ident-false.stderr @@ -1,8 +1,12 @@ error: expected identifier, found keyword `false` - --> $DIR/bad-value-ident-false.rs:13:4 + --> $DIR/bad-value-ident-false.rs:1:4 | LL | fn false() { } //~ ERROR expected identifier, found keyword `false` | ^^^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | fn r#false() { } //~ ERROR expected identifier, found keyword `false` + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/bad-value-ident-true.rs b/src/test/ui/parser/bad-value-ident-true.rs index 7ff16b80373..0f64266d322 100644 --- a/src/test/ui/parser/bad-value-ident-true.rs +++ b/src/test/ui/parser/bad-value-ident-true.rs @@ -1,14 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn true() { } //~ ERROR expected identifier, found keyword `true` fn main() { } diff --git a/src/test/ui/parser/bad-value-ident-true.stderr b/src/test/ui/parser/bad-value-ident-true.stderr index 34d02374d57..2606b7450ae 100644 --- a/src/test/ui/parser/bad-value-ident-true.stderr +++ b/src/test/ui/parser/bad-value-ident-true.stderr @@ -1,8 +1,12 @@ error: expected identifier, found keyword `true` - --> $DIR/bad-value-ident-true.rs:13:4 + --> $DIR/bad-value-ident-true.rs:1:4 | LL | fn true() { } //~ ERROR expected identifier, found keyword `true` | ^^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | fn r#true() { } //~ ERROR expected identifier, found keyword `true` + | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/better-expected.rs b/src/test/ui/parser/better-expected.rs index b60201c251d..16b61caa4df 100644 --- a/src/test/ui/parser/better-expected.rs +++ b/src/test/ui/parser/better-expected.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let x: [isize 3]; //~ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `3` } diff --git a/src/test/ui/parser/better-expected.stderr b/src/test/ui/parser/better-expected.stderr index 028858c34e9..3495353c6f9 100644 --- a/src/test/ui/parser/better-expected.stderr +++ b/src/test/ui/parser/better-expected.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `3` - --> $DIR/better-expected.rs:14:19 + --> $DIR/better-expected.rs:2:19 | LL | let x: [isize 3]; //~ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `3` | - ^ expected one of 7 possible tokens here diff --git a/src/test/ui/parser/bind-struct-early-modifiers.rs b/src/test/ui/parser/bind-struct-early-modifiers.rs index e9e76af11a5..c1de0df54e2 100644 --- a/src/test/ui/parser/bind-struct-early-modifiers.rs +++ b/src/test/ui/parser/bind-struct-early-modifiers.rs @@ -1,19 +1,8 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { struct Foo { x: isize } match (Foo { x: 10 }) { Foo { ref x: ref x } => {}, //~ ERROR expected `,` + //~| ERROR pattern does not mention field `x` _ => {} } } diff --git a/src/test/ui/parser/bind-struct-early-modifiers.stderr b/src/test/ui/parser/bind-struct-early-modifiers.stderr index 14ff1b73767..618e577e4e2 100644 --- a/src/test/ui/parser/bind-struct-early-modifiers.stderr +++ b/src/test/ui/parser/bind-struct-early-modifiers.stderr @@ -1,8 +1,15 @@ error: expected `,` - --> $DIR/bind-struct-early-modifiers.rs:16:19 + --> $DIR/bind-struct-early-modifiers.rs:4:19 | LL | Foo { ref x: ref x } => {}, //~ ERROR expected `,` | ^ -error: aborting due to previous error +error[E0027]: pattern does not mention field `x` + --> $DIR/bind-struct-early-modifiers.rs:4:9 + | +LL | Foo { ref x: ref x } => {}, //~ ERROR expected `,` + | ^^^^^^^^^^^^^^^^^^^^ missing field `x` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0027`. diff --git a/src/test/ui/parser/bound-single-question-mark.rs b/src/test/ui/parser/bound-single-question-mark.rs index 9dde5268c08..64d702d14bb 100644 --- a/src/test/ui/parser/bound-single-question-mark.rs +++ b/src/test/ui/parser/bound-single-question-mark.rs @@ -1,13 +1 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn f() {} //~ ERROR expected identifier, found `>` diff --git a/src/test/ui/parser/bound-single-question-mark.stderr b/src/test/ui/parser/bound-single-question-mark.stderr index e3522cef8d4..e30b32f41b4 100644 --- a/src/test/ui/parser/bound-single-question-mark.stderr +++ b/src/test/ui/parser/bound-single-question-mark.stderr @@ -1,5 +1,5 @@ error: expected identifier, found `>` - --> $DIR/bound-single-question-mark.rs:13:10 + --> $DIR/bound-single-question-mark.rs:1:10 | LL | fn f() {} //~ ERROR expected identifier, found `>` | ^ expected identifier diff --git a/src/test/ui/parser/bounds-lifetime-1.rs b/src/test/ui/parser/bounds-lifetime-1.rs index 824d243d5f8..e458f644c9f 100644 --- a/src/test/ui/parser/bounds-lifetime-1.rs +++ b/src/test/ui/parser/bounds-lifetime-1.rs @@ -1,15 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - type A = for<'a 'b> fn(); //~ ERROR expected one of `,`, `:`, or `>`, found `'b` fn main() {} diff --git a/src/test/ui/parser/bounds-lifetime-1.stderr b/src/test/ui/parser/bounds-lifetime-1.stderr index 910092fba40..33bba35f692 100644 --- a/src/test/ui/parser/bounds-lifetime-1.stderr +++ b/src/test/ui/parser/bounds-lifetime-1.stderr @@ -1,5 +1,5 @@ error: expected one of `,`, `:`, or `>`, found `'b` - --> $DIR/bounds-lifetime-1.rs:13:17 + --> $DIR/bounds-lifetime-1.rs:1:17 | LL | type A = for<'a 'b> fn(); //~ ERROR expected one of `,`, `:`, or `>`, found `'b` | ^^ expected one of `,`, `:`, or `>` here diff --git a/src/test/ui/parser/bounds-lifetime-2.rs b/src/test/ui/parser/bounds-lifetime-2.rs index 3c67dda70f5..f184107bbd1 100644 --- a/src/test/ui/parser/bounds-lifetime-2.rs +++ b/src/test/ui/parser/bounds-lifetime-2.rs @@ -1,15 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - type A = for<'a + 'b> fn(); //~ ERROR expected one of `,`, `:`, or `>`, found `+` fn main() {} diff --git a/src/test/ui/parser/bounds-lifetime-2.stderr b/src/test/ui/parser/bounds-lifetime-2.stderr index b84f5e6990a..a8a22aaafce 100644 --- a/src/test/ui/parser/bounds-lifetime-2.stderr +++ b/src/test/ui/parser/bounds-lifetime-2.stderr @@ -1,5 +1,5 @@ error: expected one of `,`, `:`, or `>`, found `+` - --> $DIR/bounds-lifetime-2.rs:13:17 + --> $DIR/bounds-lifetime-2.rs:1:17 | LL | type A = for<'a + 'b> fn(); //~ ERROR expected one of `,`, `:`, or `>`, found `+` | ^ expected one of `,`, `:`, or `>` here diff --git a/src/test/ui/parser/bounds-lifetime-where-1.rs b/src/test/ui/parser/bounds-lifetime-where-1.rs index aae9d729987..f1a002a9f7b 100644 --- a/src/test/ui/parser/bounds-lifetime-where-1.rs +++ b/src/test/ui/parser/bounds-lifetime-where-1.rs @@ -1,15 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - type A where 'a; //~ ERROR expected `:`, found `;` fn main() {} diff --git a/src/test/ui/parser/bounds-lifetime-where-1.stderr b/src/test/ui/parser/bounds-lifetime-where-1.stderr index 5bcb8962e0f..0300fe98910 100644 --- a/src/test/ui/parser/bounds-lifetime-where-1.stderr +++ b/src/test/ui/parser/bounds-lifetime-where-1.stderr @@ -1,5 +1,5 @@ error: expected `:`, found `;` - --> $DIR/bounds-lifetime-where-1.rs:13:16 + --> $DIR/bounds-lifetime-where-1.rs:1:16 | LL | type A where 'a; //~ ERROR expected `:`, found `;` | ^ expected `:` diff --git a/src/test/ui/parser/bounds-lifetime-where.rs b/src/test/ui/parser/bounds-lifetime-where.rs index 0a30818bc96..acb04e7859b 100644 --- a/src/test/ui/parser/bounds-lifetime-where.rs +++ b/src/test/ui/parser/bounds-lifetime-where.rs @@ -1,15 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - type A where 'a: 'b + 'c = u8; // OK type A where 'a: 'b, = u8; // OK type A where 'a: = u8; // OK diff --git a/src/test/ui/parser/bounds-lifetime-where.stderr b/src/test/ui/parser/bounds-lifetime-where.stderr index ef4ba9499c3..6a8d7e9d4a1 100644 --- a/src/test/ui/parser/bounds-lifetime-where.stderr +++ b/src/test/ui/parser/bounds-lifetime-where.stderr @@ -1,5 +1,5 @@ error: expected one of `=`, lifetime, or type, found `,` - --> $DIR/bounds-lifetime-where.rs:20:14 + --> $DIR/bounds-lifetime-where.rs:8:14 | LL | type A where , = u8; //~ ERROR expected one of `=`, lifetime, or type, found `,` | ^ expected one of `=`, lifetime, or type here diff --git a/src/test/ui/parser/bounds-lifetime.rs b/src/test/ui/parser/bounds-lifetime.rs index 88db205310c..89a969bb2e2 100644 --- a/src/test/ui/parser/bounds-lifetime.rs +++ b/src/test/ui/parser/bounds-lifetime.rs @@ -1,15 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - type A = for<'a:> fn(); // OK type A = for<'a:,> fn(); // OK type A = for<'a> fn(); // OK diff --git a/src/test/ui/parser/bounds-lifetime.stderr b/src/test/ui/parser/bounds-lifetime.stderr index 2850af5193a..f39e5beb6ac 100644 --- a/src/test/ui/parser/bounds-lifetime.stderr +++ b/src/test/ui/parser/bounds-lifetime.stderr @@ -1,5 +1,5 @@ error: expected one of `>`, identifier, or lifetime, found `,` - --> $DIR/bounds-lifetime.rs:21:14 + --> $DIR/bounds-lifetime.rs:9:14 | LL | type A = for<,> fn(); //~ ERROR expected one of `>`, identifier, or lifetime, found `,` | ^ expected one of `>`, identifier, or lifetime here diff --git a/src/test/ui/parser/bounds-obj-parens.rs b/src/test/ui/parser/bounds-obj-parens.rs index 7b47bbd951e..cc86879bf46 100644 --- a/src/test/ui/parser/bounds-obj-parens.rs +++ b/src/test/ui/parser/bounds-obj-parens.rs @@ -1,14 +1,5 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass -// compile-flags: -Z parse-only -type A = Box<(Fn(D::Error) -> E) + 'static + Send + Sync>; // OK (but see #39318) +type A = Box<(Fn(u8) -> u8) + 'static + Send + Sync>; // OK (but see #39318) + +fn main() {} diff --git a/src/test/ui/parser/bounds-type-where.rs b/src/test/ui/parser/bounds-type-where.rs index 9dc5d827744..2520ecb294c 100644 --- a/src/test/ui/parser/bounds-type-where.rs +++ b/src/test/ui/parser/bounds-type-where.rs @@ -1,15 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - type A where for<'a> for<'b> Trait1 + ?Trait2: 'a + Trait = u8; // OK type A where T: Trait, = u8; // OK type A where T: = u8; // OK diff --git a/src/test/ui/parser/bounds-type-where.stderr b/src/test/ui/parser/bounds-type-where.stderr index b6a184f54fc..459d5c3b6ea 100644 --- a/src/test/ui/parser/bounds-type-where.stderr +++ b/src/test/ui/parser/bounds-type-where.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `(`, `+`, `::`, `:`, `<`, `==`, or `=`, found `,` - --> $DIR/bounds-type-where.rs:20:15 + --> $DIR/bounds-type-where.rs:8:15 | LL | type A where T, = u8; | ^ expected one of 8 possible tokens here diff --git a/src/test/ui/parser/bounds-type.rs b/src/test/ui/parser/bounds-type.rs index 0ebe7fde0a6..360e7939c95 100644 --- a/src/test/ui/parser/bounds-type.rs +++ b/src/test/ui/parser/bounds-type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z parse-only -Z continue-parse-after-error struct S< diff --git a/src/test/ui/parser/bounds-type.stderr b/src/test/ui/parser/bounds-type.stderr index c4c3d2ae065..046e0ce8c7a 100644 --- a/src/test/ui/parser/bounds-type.stderr +++ b/src/test/ui/parser/bounds-type.stderr @@ -1,5 +1,5 @@ error: `?` may only modify trait bounds, not lifetime bounds - --> $DIR/bounds-type.rs:20:8 + --> $DIR/bounds-type.rs:10:8 | LL | T: ?'a, //~ ERROR `?` may only modify trait bounds, not lifetime bounds | ^ diff --git a/src/test/ui/parser/brace-after-qualified-path-in-match.rs b/src/test/ui/parser/brace-after-qualified-path-in-match.rs index ff434d87e1f..f4152086162 100644 --- a/src/test/ui/parser/brace-after-qualified-path-in-match.rs +++ b/src/test/ui/parser/brace-after-qualified-path-in-match.rs @@ -1,17 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -fn foo() { - match x { +fn main() { + match 10 { ::Type{key: value} => (), //~^ ERROR unexpected `{` after qualified path _ => (), diff --git a/src/test/ui/parser/brace-after-qualified-path-in-match.stderr b/src/test/ui/parser/brace-after-qualified-path-in-match.stderr index c66b3ed75e8..4c49e3122c7 100644 --- a/src/test/ui/parser/brace-after-qualified-path-in-match.stderr +++ b/src/test/ui/parser/brace-after-qualified-path-in-match.stderr @@ -1,5 +1,5 @@ error: unexpected `{` after qualified path - --> $DIR/brace-after-qualified-path-in-match.rs:15:27 + --> $DIR/brace-after-qualified-path-in-match.rs:3:27 | LL | ::Type{key: value} => (), | ^ unexpected `{` after qualified path diff --git a/src/test/ui/parser/byte-literals.rs b/src/test/ui/parser/byte-literals.rs index 3ecd7780afd..bd358af2984 100644 --- a/src/test/ui/parser/byte-literals.rs +++ b/src/test/ui/parser/byte-literals.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error // ignore-tidy-tab diff --git a/src/test/ui/parser/byte-literals.stderr b/src/test/ui/parser/byte-literals.stderr index 7b4f22134c4..ab14eeede66 100644 --- a/src/test/ui/parser/byte-literals.stderr +++ b/src/test/ui/parser/byte-literals.stderr @@ -1,41 +1,41 @@ error: unknown byte escape: f - --> $DIR/byte-literals.rs:16:21 + --> $DIR/byte-literals.rs:6:21 | LL | static FOO: u8 = b'/f'; //~ ERROR unknown byte escape | ^ error: unknown byte escape: f - --> $DIR/byte-literals.rs:19:8 + --> $DIR/byte-literals.rs:9:8 | LL | b'/f'; //~ ERROR unknown byte escape | ^ error: invalid character in numeric character escape: Z - --> $DIR/byte-literals.rs:20:10 + --> $DIR/byte-literals.rs:10:10 | LL | b'/x0Z'; //~ ERROR invalid character in numeric character escape: Z | ^ error: byte constant must be escaped: /t - --> $DIR/byte-literals.rs:21:7 + --> $DIR/byte-literals.rs:11:7 | LL | b' '; //~ ERROR byte constant must be escaped | ^^^^ error: byte constant must be escaped: ' - --> $DIR/byte-literals.rs:22:7 + --> $DIR/byte-literals.rs:12:7 | LL | b'''; //~ ERROR byte constant must be escaped | ^ error: byte constant must be ASCII. Use a /xHH escape for a non-ASCII byte - --> $DIR/byte-literals.rs:23:7 + --> $DIR/byte-literals.rs:13:7 | LL | b'é'; //~ ERROR byte constant must be ASCII | ^ error: unterminated byte constant: b'a - --> $DIR/byte-literals.rs:24:5 + --> $DIR/byte-literals.rs:14:5 | LL | b'a //~ ERROR unterminated byte constant | ^^^ diff --git a/src/test/ui/parser/byte-string-literals.rs b/src/test/ui/parser/byte-string-literals.rs index 4eba9e91ca5..d028f28655b 100644 --- a/src/test/ui/parser/byte-string-literals.rs +++ b/src/test/ui/parser/byte-string-literals.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error // ignore-tidy-tab diff --git a/src/test/ui/parser/byte-string-literals.stderr b/src/test/ui/parser/byte-string-literals.stderr index 856d1956c05..669f5585cb2 100644 --- a/src/test/ui/parser/byte-string-literals.stderr +++ b/src/test/ui/parser/byte-string-literals.stderr @@ -1,29 +1,29 @@ error: unknown byte escape: f - --> $DIR/byte-string-literals.rs:16:32 + --> $DIR/byte-string-literals.rs:6:32 | LL | static FOO: &'static [u8] = b"/f"; //~ ERROR unknown byte escape | ^ error: unknown byte escape: f - --> $DIR/byte-string-literals.rs:19:8 + --> $DIR/byte-string-literals.rs:9:8 | LL | b"/f"; //~ ERROR unknown byte escape | ^ error: invalid character in numeric character escape: Z - --> $DIR/byte-string-literals.rs:20:10 + --> $DIR/byte-string-literals.rs:10:10 | LL | b"/x0Z"; //~ ERROR invalid character in numeric character escape: Z | ^ error: byte constant must be ASCII. Use a /xHH escape for a non-ASCII byte - --> $DIR/byte-string-literals.rs:21:7 + --> $DIR/byte-string-literals.rs:11:7 | LL | b"é"; //~ ERROR byte constant must be ASCII | ^ error: unterminated double quote byte string - --> $DIR/byte-string-literals.rs:22:7 + --> $DIR/byte-string-literals.rs:12:7 | LL | b"a //~ ERROR unterminated double quote byte string | _______^ diff --git a/src/test/ui/parser/circular_modules_hello.rs b/src/test/ui/parser/circular_modules_hello.rs index 94770aa875b..6968ca97b82 100644 --- a/src/test/ui/parser/circular_modules_hello.rs +++ b/src/test/ui/parser/circular_modules_hello.rs @@ -1,15 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // ignore-test: this is an auxiliary file for circular-modules-main.rs #[path = "circular_modules_main.rs"] diff --git a/src/test/ui/parser/circular_modules_main.rs b/src/test/ui/parser/circular_modules_main.rs index 861d4cd12ab..b85003bf091 100644 --- a/src/test/ui/parser/circular_modules_main.rs +++ b/src/test/ui/parser/circular_modules_main.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - #[path = "circular_modules_hello.rs"] mod circular_modules_hello; //~ ERROR: circular modules diff --git a/src/test/ui/parser/circular_modules_main.stderr b/src/test/ui/parser/circular_modules_main.stderr index 48cb3976c6d..7751a8c0f38 100644 --- a/src/test/ui/parser/circular_modules_main.stderr +++ b/src/test/ui/parser/circular_modules_main.stderr @@ -1,5 +1,5 @@ error: circular modules: $DIR/circular_modules_hello.rs -> $DIR/circular_modules_main.rs -> $DIR/circular_modules_hello.rs - --> $DIR/circular_modules_main.rs:14:5 + --> $DIR/circular_modules_main.rs:2:5 | LL | mod circular_modules_hello; //~ ERROR: circular modules | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/parser/class-implements-bad-trait.rs b/src/test/ui/parser/class-implements-bad-trait.rs index ea263d938d4..f2f85d0265a 100644 --- a/src/test/ui/parser/class-implements-bad-trait.rs +++ b/src/test/ui/parser/class-implements-bad-trait.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // error-pattern:nonexistent class cat : nonexistent { let meows: usize; diff --git a/src/test/ui/parser/class-implements-bad-trait.stderr b/src/test/ui/parser/class-implements-bad-trait.stderr index d28750d188a..45583466adc 100644 --- a/src/test/ui/parser/class-implements-bad-trait.stderr +++ b/src/test/ui/parser/class-implements-bad-trait.stderr @@ -1,5 +1,5 @@ error: expected one of `!` or `::`, found `cat` - --> $DIR/class-implements-bad-trait.rs:14:7 + --> $DIR/class-implements-bad-trait.rs:2:7 | LL | class cat : nonexistent { | ^^^ expected one of `!` or `::` here diff --git a/src/test/ui/parser/closure-return-syntax.rs b/src/test/ui/parser/closure-return-syntax.rs index 29b6a70b6d7..54eb791d2bc 100644 --- a/src/test/ui/parser/closure-return-syntax.rs +++ b/src/test/ui/parser/closure-return-syntax.rs @@ -1,18 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we cannot parse a closure with an explicit return type // unless it uses braces. -// compile-flags: -Z parse-only - fn main() { let x = || -> i32 22; //~^ ERROR expected one of `!`, `(`, `+`, `::`, `<`, or `{`, found `22` diff --git a/src/test/ui/parser/closure-return-syntax.stderr b/src/test/ui/parser/closure-return-syntax.stderr index 1e505e5ac9b..dd7ebffd506 100644 --- a/src/test/ui/parser/closure-return-syntax.stderr +++ b/src/test/ui/parser/closure-return-syntax.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `(`, `+`, `::`, `<`, or `{`, found `22` - --> $DIR/closure-return-syntax.rs:17:23 + --> $DIR/closure-return-syntax.rs:5:23 | LL | let x = || -> i32 22; | ^^ expected one of `!`, `(`, `+`, `::`, `<`, or `{` here diff --git a/src/test/ui/parser/column-offset-1-based.rs b/src/test/ui/parser/column-offset-1-based.rs index 8caf2e0c0a4..e158e5247db 100644 --- a/src/test/ui/parser/column-offset-1-based.rs +++ b/src/test/ui/parser/column-offset-1-based.rs @@ -1,13 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -# //~ ERROR 13:1: 13:2: expected `[`, found `` +# //~ ERROR expected `[`, found `` diff --git a/src/test/ui/parser/column-offset-1-based.stderr b/src/test/ui/parser/column-offset-1-based.stderr index 452e65603c9..b12b47b67ce 100644 --- a/src/test/ui/parser/column-offset-1-based.stderr +++ b/src/test/ui/parser/column-offset-1-based.stderr @@ -1,7 +1,7 @@ error: expected `[`, found `` - --> $DIR/column-offset-1-based.rs:13:1 + --> $DIR/column-offset-1-based.rs:1:1 | -LL | # //~ ERROR 13:1: 13:2: expected `[`, found `` +LL | # //~ ERROR expected `[`, found `` | ^ expected `[` error: aborting due to previous error diff --git a/src/test/ui/parser/default.rs b/src/test/ui/parser/default.rs index 6c3bc45d34a..17cd06864bf 100644 --- a/src/test/ui/parser/default.rs +++ b/src/test/ui/parser/default.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Test successful and unsuccessful parsing of the `default` contextual keyword +#![feature(specialization)] + trait Foo { fn foo() -> T; } @@ -23,12 +13,12 @@ impl Foo for u8 { } impl Foo for u16 { - pub default fn foo() -> T { + pub default fn foo() -> T { //~ ERROR unnecessary visibility qualifier T::default() } } -impl Foo for u32 { +impl Foo for u32 { //~ ERROR not all trait items implemented, missing: `foo` default pub fn foo() -> T { T::default() } //~ ERROR expected one of } diff --git a/src/test/ui/parser/default.stderr b/src/test/ui/parser/default.stderr index 0a5c6e80df5..27193672903 100644 --- a/src/test/ui/parser/default.stderr +++ b/src/test/ui/parser/default.stderr @@ -1,8 +1,25 @@ error: expected one of `async`, `const`, `existential`, `extern`, `fn`, `type`, or `unsafe`, found `pub` - --> $DIR/default.rs:32:13 + --> $DIR/default.rs:22:13 | LL | default pub fn foo() -> T { T::default() } //~ ERROR expected one of | ^^^ expected one of 7 possible tokens here -error: aborting due to previous error +error[E0449]: unnecessary visibility qualifier + --> $DIR/default.rs:16:5 + | +LL | pub default fn foo() -> T { //~ ERROR unnecessary visibility qualifier + | ^^^ `pub` not permitted here because it's implied + +error[E0046]: not all trait items implemented, missing: `foo` + --> $DIR/default.rs:21:1 + | +LL | fn foo() -> T; + | -------------------------- `foo` from trait +... +LL | impl Foo for u32 { //~ ERROR not all trait items implemented, missing: `foo` + | ^^^^^^^^^^^^^^^^ missing `foo` in implementation + +error: aborting due to 3 previous errors +Some errors occurred: E0046, E0449. +For more information about an error, try `rustc --explain E0046`. diff --git a/src/test/ui/parser/do-catch-suggests-try.rs b/src/test/ui/parser/do-catch-suggests-try.rs index 449135e69c3..61fae721ffb 100644 --- a/src/test/ui/parser/do-catch-suggests-try.rs +++ b/src/test/ui/parser/do-catch-suggests-try.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let _: Option<()> = do catch {}; //~^ ERROR found removed `do catch` syntax diff --git a/src/test/ui/parser/do-catch-suggests-try.stderr b/src/test/ui/parser/do-catch-suggests-try.stderr index c1ea802b8be..6d13b0f1cc8 100644 --- a/src/test/ui/parser/do-catch-suggests-try.stderr +++ b/src/test/ui/parser/do-catch-suggests-try.stderr @@ -1,5 +1,5 @@ error: found removed `do catch` syntax - --> $DIR/do-catch-suggests-try.rs:14:25 + --> $DIR/do-catch-suggests-try.rs:2:25 | LL | let _: Option<()> = do catch {}; | ^^ diff --git a/src/test/ui/parser/doc-after-struct-field.rs b/src/test/ui/parser/doc-after-struct-field.rs index 11feeae8d81..7870555aebb 100644 --- a/src/test/ui/parser/doc-after-struct-field.rs +++ b/src/test/ui/parser/doc-after-struct-field.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error struct X { a: u8 /** document a */, diff --git a/src/test/ui/parser/doc-after-struct-field.stderr b/src/test/ui/parser/doc-after-struct-field.stderr index 17250004292..b84f353b8f1 100644 --- a/src/test/ui/parser/doc-after-struct-field.stderr +++ b/src/test/ui/parser/doc-after-struct-field.stderr @@ -1,5 +1,5 @@ error[E0585]: found a documentation comment that doesn't document anything - --> $DIR/doc-after-struct-field.rs:14:11 + --> $DIR/doc-after-struct-field.rs:4:11 | LL | a: u8 /** document a */, | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | a: u8 /** document a */, = help: doc comments must come before what they document, maybe a comment was intended with `//`? error[E0585]: found a documentation comment that doesn't document anything - --> $DIR/doc-after-struct-field.rs:20:11 + --> $DIR/doc-after-struct-field.rs:10:11 | LL | a: u8 /// document a | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/parser/doc-before-attr.rs b/src/test/ui/parser/doc-before-attr.rs index 4548cebd0a8..c4125a09fd2 100644 --- a/src/test/ui/parser/doc-before-attr.rs +++ b/src/test/ui/parser/doc-before-attr.rs @@ -1,14 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only +fn main() {} /// hi #[derive(Debug)] //~ERROR expected item after attributes diff --git a/src/test/ui/parser/doc-before-attr.stderr b/src/test/ui/parser/doc-before-attr.stderr index f52bf60b263..0cd6aa81ec5 100644 --- a/src/test/ui/parser/doc-before-attr.stderr +++ b/src/test/ui/parser/doc-before-attr.stderr @@ -1,5 +1,5 @@ error: expected item after attributes - --> $DIR/doc-before-attr.rs:14:16 + --> $DIR/doc-before-attr.rs:4:16 | LL | #[derive(Debug)] //~ERROR expected item after attributes | ^ diff --git a/src/test/ui/parser/doc-before-eof.rs b/src/test/ui/parser/doc-before-eof.rs index 728972eca62..b31836e95e8 100644 --- a/src/test/ui/parser/doc-before-eof.rs +++ b/src/test/ui/parser/doc-before-eof.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only +fn main() {} /// hi //~ERROR expected item after doc comment diff --git a/src/test/ui/parser/doc-before-eof.stderr b/src/test/ui/parser/doc-before-eof.stderr index 9fd3db73577..5809d64e806 100644 --- a/src/test/ui/parser/doc-before-eof.stderr +++ b/src/test/ui/parser/doc-before-eof.stderr @@ -1,8 +1,8 @@ error: expected item after doc comment - --> $DIR/doc-before-eof.rs:13:1 + --> $DIR/doc-before-eof.rs:3:1 | LL | /// hi //~ERROR expected item after doc comment - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment doesn't document anything error: aborting due to previous error diff --git a/src/test/ui/parser/doc-before-extern-rbrace.rs b/src/test/ui/parser/doc-before-extern-rbrace.rs index 70da47ba9b4..695d4da1dca 100644 --- a/src/test/ui/parser/doc-before-extern-rbrace.rs +++ b/src/test/ui/parser/doc-before-extern-rbrace.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - extern { /// hi //~^ ERROR expected item after doc comment diff --git a/src/test/ui/parser/doc-before-extern-rbrace.stderr b/src/test/ui/parser/doc-before-extern-rbrace.stderr index 3936412cf98..8cc9c916a7a 100644 --- a/src/test/ui/parser/doc-before-extern-rbrace.stderr +++ b/src/test/ui/parser/doc-before-extern-rbrace.stderr @@ -1,8 +1,8 @@ error: expected item after doc comment - --> $DIR/doc-before-extern-rbrace.rs:14:5 + --> $DIR/doc-before-extern-rbrace.rs:2:5 | LL | /// hi - | ^^^^^^ + | ^^^^^^ this doc comment doesn't document anything error: aborting due to previous error diff --git a/src/test/ui/parser/doc-before-fn-rbrace.rs b/src/test/ui/parser/doc-before-fn-rbrace.rs index ad9a73626ac..d33520baebe 100644 --- a/src/test/ui/parser/doc-before-fn-rbrace.rs +++ b/src/test/ui/parser/doc-before-fn-rbrace.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error fn main() { /// document diff --git a/src/test/ui/parser/doc-before-fn-rbrace.stderr b/src/test/ui/parser/doc-before-fn-rbrace.stderr index e74817e1fd2..a1ca88cf314 100644 --- a/src/test/ui/parser/doc-before-fn-rbrace.stderr +++ b/src/test/ui/parser/doc-before-fn-rbrace.stderr @@ -1,5 +1,5 @@ error[E0585]: found a documentation comment that doesn't document anything - --> $DIR/doc-before-fn-rbrace.rs:14:5 + --> $DIR/doc-before-fn-rbrace.rs:4:5 | LL | /// document | ^^^^^^^^^^^^ diff --git a/src/test/ui/parser/doc-before-identifier.rs b/src/test/ui/parser/doc-before-identifier.rs index a321d0e29b2..d9777be63d2 100644 --- a/src/test/ui/parser/doc-before-identifier.rs +++ b/src/test/ui/parser/doc-before-identifier.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error fn /// document foo() {} diff --git a/src/test/ui/parser/doc-before-identifier.stderr b/src/test/ui/parser/doc-before-identifier.stderr index 73b169ce8e5..4bc5e6f65d8 100644 --- a/src/test/ui/parser/doc-before-identifier.stderr +++ b/src/test/ui/parser/doc-before-identifier.stderr @@ -1,5 +1,5 @@ error: expected identifier, found doc comment `/// document` - --> $DIR/doc-before-identifier.rs:13:4 + --> $DIR/doc-before-identifier.rs:3:4 | LL | fn /// document | ^^^^^^^^^^^^ expected identifier, found doc comment diff --git a/src/test/ui/parser/doc-before-mod-rbrace.rs b/src/test/ui/parser/doc-before-mod-rbrace.rs index d18ebdc5b1e..4e0b65ef496 100644 --- a/src/test/ui/parser/doc-before-mod-rbrace.rs +++ b/src/test/ui/parser/doc-before-mod-rbrace.rs @@ -1,16 +1,8 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error mod Foo { /// document //~^ ERROR expected item after doc comment } + +fn main() {} diff --git a/src/test/ui/parser/doc-before-mod-rbrace.stderr b/src/test/ui/parser/doc-before-mod-rbrace.stderr index 807530302af..4eaf351f676 100644 --- a/src/test/ui/parser/doc-before-mod-rbrace.stderr +++ b/src/test/ui/parser/doc-before-mod-rbrace.stderr @@ -1,8 +1,8 @@ error: expected item after doc comment - --> $DIR/doc-before-mod-rbrace.rs:14:5 + --> $DIR/doc-before-mod-rbrace.rs:4:5 | LL | /// document - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^ this doc comment doesn't document anything error: aborting due to previous error diff --git a/src/test/ui/parser/doc-before-rbrace.rs b/src/test/ui/parser/doc-before-rbrace.rs index 48ea2b5aea1..8ff946344ae 100644 --- a/src/test/ui/parser/doc-before-rbrace.rs +++ b/src/test/ui/parser/doc-before-rbrace.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { println!("Hi"); /// hi //~^ ERROR found a documentation comment that doesn't document anything diff --git a/src/test/ui/parser/doc-before-rbrace.stderr b/src/test/ui/parser/doc-before-rbrace.stderr index 15e9c3dfd62..55719cf6411 100644 --- a/src/test/ui/parser/doc-before-rbrace.stderr +++ b/src/test/ui/parser/doc-before-rbrace.stderr @@ -1,5 +1,5 @@ error[E0585]: found a documentation comment that doesn't document anything - --> $DIR/doc-before-rbrace.rs:14:21 + --> $DIR/doc-before-rbrace.rs:2:21 | LL | println!("Hi"); /// hi | ^^^^^^ diff --git a/src/test/ui/parser/doc-before-semi.rs b/src/test/ui/parser/doc-before-semi.rs index 71104b8caae..405a7e1e2a3 100644 --- a/src/test/ui/parser/doc-before-semi.rs +++ b/src/test/ui/parser/doc-before-semi.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { /// hi //~^ ERROR found a documentation comment that doesn't document anything diff --git a/src/test/ui/parser/doc-before-semi.stderr b/src/test/ui/parser/doc-before-semi.stderr index a174d6f7053..e6bade18d0a 100644 --- a/src/test/ui/parser/doc-before-semi.stderr +++ b/src/test/ui/parser/doc-before-semi.stderr @@ -1,5 +1,5 @@ error[E0585]: found a documentation comment that doesn't document anything - --> $DIR/doc-before-semi.rs:14:5 + --> $DIR/doc-before-semi.rs:2:5 | LL | /// hi | ^^^^^^ diff --git a/src/test/ui/parser/doc-before-struct-rbrace-1.rs b/src/test/ui/parser/doc-before-struct-rbrace-1.rs index b0cae467863..e7055f6a5fc 100644 --- a/src/test/ui/parser/doc-before-struct-rbrace-1.rs +++ b/src/test/ui/parser/doc-before-struct-rbrace-1.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error struct X { a: u8, diff --git a/src/test/ui/parser/doc-before-struct-rbrace-1.stderr b/src/test/ui/parser/doc-before-struct-rbrace-1.stderr index 9909bb250d1..f2824f85ca9 100644 --- a/src/test/ui/parser/doc-before-struct-rbrace-1.stderr +++ b/src/test/ui/parser/doc-before-struct-rbrace-1.stderr @@ -1,5 +1,5 @@ error[E0585]: found a documentation comment that doesn't document anything - --> $DIR/doc-before-struct-rbrace-1.rs:15:5 + --> $DIR/doc-before-struct-rbrace-1.rs:5:5 | LL | /// document | ^^^^^^^^^^^^ diff --git a/src/test/ui/parser/doc-before-struct-rbrace-2.rs b/src/test/ui/parser/doc-before-struct-rbrace-2.rs index cd5fd2d7a7f..d5c2a314cbb 100644 --- a/src/test/ui/parser/doc-before-struct-rbrace-2.rs +++ b/src/test/ui/parser/doc-before-struct-rbrace-2.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error struct X { a: u8 /// document diff --git a/src/test/ui/parser/doc-before-struct-rbrace-2.stderr b/src/test/ui/parser/doc-before-struct-rbrace-2.stderr index b69720dd867..ba3e884263c 100644 --- a/src/test/ui/parser/doc-before-struct-rbrace-2.stderr +++ b/src/test/ui/parser/doc-before-struct-rbrace-2.stderr @@ -1,5 +1,5 @@ error[E0585]: found a documentation comment that doesn't document anything - --> $DIR/doc-before-struct-rbrace-2.rs:14:11 + --> $DIR/doc-before-struct-rbrace-2.rs:4:11 | LL | a: u8 /// document | ^^^^^^^^^^^^ diff --git a/src/test/ui/parser/duplicate-visibility.rs b/src/test/ui/parser/duplicate-visibility.rs index cc3286fe705..bb17e97e950 100644 --- a/src/test/ui/parser/duplicate-visibility.rs +++ b/src/test/ui/parser/duplicate-visibility.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // error-pattern:expected one of `(`, `fn`, `static`, or `type` extern { pub pub fn foo(); diff --git a/src/test/ui/parser/duplicate-visibility.stderr b/src/test/ui/parser/duplicate-visibility.stderr index a0a5b66215e..880b536cd18 100644 --- a/src/test/ui/parser/duplicate-visibility.stderr +++ b/src/test/ui/parser/duplicate-visibility.stderr @@ -1,5 +1,5 @@ error: expected one of `(`, `fn`, `static`, or `type`, found `pub` - --> $DIR/duplicate-visibility.rs:15:9 + --> $DIR/duplicate-visibility.rs:3:9 | LL | pub pub fn foo(); | ^^^ expected one of `(`, `fn`, `static`, or `type` here diff --git a/src/test/ui/parser/empty-impl-semicolon.rs b/src/test/ui/parser/empty-impl-semicolon.rs index 9939f1e36ea..207ebef642b 100644 --- a/src/test/ui/parser/empty-impl-semicolon.rs +++ b/src/test/ui/parser/empty-impl-semicolon.rs @@ -1,13 +1 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - impl Foo; //~ ERROR expected one of `!`, `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `;` diff --git a/src/test/ui/parser/empty-impl-semicolon.stderr b/src/test/ui/parser/empty-impl-semicolon.stderr index fef4b882355..965a8a45aed 100644 --- a/src/test/ui/parser/empty-impl-semicolon.stderr +++ b/src/test/ui/parser/empty-impl-semicolon.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `;` - --> $DIR/empty-impl-semicolon.rs:13:9 + --> $DIR/empty-impl-semicolon.rs:1:9 | LL | impl Foo; //~ ERROR expected one of `!`, `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `;` | ^ expected one of 8 possible tokens here diff --git a/src/test/ui/parser/extern-crate-unexpected-token.rs b/src/test/ui/parser/extern-crate-unexpected-token.rs index 619b88a6ab8..58b2fa1afdf 100644 --- a/src/test/ui/parser/extern-crate-unexpected-token.rs +++ b/src/test/ui/parser/extern-crate-unexpected-token.rs @@ -1,13 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - extern crte foo; //~ ERROR expected one of `crate`, `fn`, or `{`, found `crte` diff --git a/src/test/ui/parser/extern-crate-unexpected-token.stderr b/src/test/ui/parser/extern-crate-unexpected-token.stderr index c359a3704bf..ed888eb1a8e 100644 --- a/src/test/ui/parser/extern-crate-unexpected-token.stderr +++ b/src/test/ui/parser/extern-crate-unexpected-token.stderr @@ -1,5 +1,5 @@ error: expected one of `crate`, `fn`, or `{`, found `crte` - --> $DIR/extern-crate-unexpected-token.rs:13:8 + --> $DIR/extern-crate-unexpected-token.rs:1:8 | LL | extern crte foo; //~ ERROR expected one of `crate`, `fn`, or `{`, found `crte` | ^^^^ expected one of `crate`, `fn`, or `{` here diff --git a/src/test/ui/parser/extern-expected-fn-or-brace.rs b/src/test/ui/parser/extern-expected-fn-or-brace.rs index 21cca129658..dd46b87fa42 100644 --- a/src/test/ui/parser/extern-expected-fn-or-brace.rs +++ b/src/test/ui/parser/extern-expected-fn-or-brace.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Verifies that the expected token errors for `extern crate` are // raised diff --git a/src/test/ui/parser/extern-expected-fn-or-brace.stderr b/src/test/ui/parser/extern-expected-fn-or-brace.stderr index 54ab5b87d49..94b2d1d7b7e 100644 --- a/src/test/ui/parser/extern-expected-fn-or-brace.stderr +++ b/src/test/ui/parser/extern-expected-fn-or-brace.stderr @@ -1,5 +1,5 @@ error: expected one of `fn` or `{`, found `mod` - --> $DIR/extern-expected-fn-or-brace.rs:16:12 + --> $DIR/extern-expected-fn-or-brace.rs:4:12 | LL | extern "C" mod foo; //~ERROR expected one of `fn` or `{`, found `mod` | ^^^ expected one of `fn` or `{` here diff --git a/src/test/ui/parser/extern-foreign-crate.rs b/src/test/ui/parser/extern-foreign-crate.rs index 9adbd871409..a5da77dc763 100644 --- a/src/test/ui/parser/extern-foreign-crate.rs +++ b/src/test/ui/parser/extern-foreign-crate.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Verifies that the expected token errors for `extern crate` are // raised diff --git a/src/test/ui/parser/extern-foreign-crate.stderr b/src/test/ui/parser/extern-foreign-crate.stderr index 93eb9fd8de3..d2fe8b77ce6 100644 --- a/src/test/ui/parser/extern-foreign-crate.stderr +++ b/src/test/ui/parser/extern-foreign-crate.stderr @@ -1,5 +1,5 @@ error: expected one of `;` or `as`, found `{` - --> $DIR/extern-foreign-crate.rs:16:18 + --> $DIR/extern-foreign-crate.rs:4:18 | LL | extern crate foo {} //~ERROR expected one of `;` or `as`, found `{` | ^ expected one of `;` or `as` here diff --git a/src/test/ui/parser/extern-no-fn.rs b/src/test/ui/parser/extern-no-fn.rs index aa0dbd4d4fc..c37ddd69ce5 100644 --- a/src/test/ui/parser/extern-no-fn.rs +++ b/src/test/ui/parser/extern-no-fn.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - extern { //~ ERROR missing `fn`, `type`, or `static` for extern-item declaration f(); } diff --git a/src/test/ui/parser/extern-no-fn.stderr b/src/test/ui/parser/extern-no-fn.stderr index 29a7691f82b..e764cd08401 100644 --- a/src/test/ui/parser/extern-no-fn.stderr +++ b/src/test/ui/parser/extern-no-fn.stderr @@ -1,5 +1,5 @@ error: missing `fn`, `type`, or `static` for extern-item declaration - --> $DIR/extern-no-fn.rs:13:9 + --> $DIR/extern-no-fn.rs:1:9 | LL | extern { //~ ERROR missing `fn`, `type`, or `static` for extern-item declaration | _________^ diff --git a/src/test/ui/parser/if-in-in.rs b/src/test/ui/parser/if-in-in.rs index 735d571938a..212378c2866 100644 --- a/src/test/ui/parser/if-in-in.rs +++ b/src/test/ui/parser/if-in-in.rs @@ -1,7 +1,5 @@ -// compile-flags: -Z parse-only - fn main() { - for i in in 1..2 { + for i in in 1..2 { //~ ERROR expected iterable, found keyword `in` println!("{}", i); } } diff --git a/src/test/ui/parser/if-in-in.stderr b/src/test/ui/parser/if-in-in.stderr index 65da252fc12..2938bba77d7 100644 --- a/src/test/ui/parser/if-in-in.stderr +++ b/src/test/ui/parser/if-in-in.stderr @@ -1,7 +1,7 @@ error: expected iterable, found keyword `in` - --> $DIR/if-in-in.rs:4:14 + --> $DIR/if-in-in.rs:2:14 | -LL | for i in in 1..2 { +LL | for i in in 1..2 { //~ ERROR expected iterable, found keyword `in` | ---^^ | | | help: remove the duplicated `in` diff --git a/src/test/ui/parser/impl-parsing.rs b/src/test/ui/parser/impl-parsing.rs index 064e3c3ac48..c2a80e8fa15 100644 --- a/src/test/ui/parser/impl-parsing.rs +++ b/src/test/ui/parser/impl-parsing.rs @@ -1,14 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error impl ! {} // OK impl ! where u8: Copy {} // OK diff --git a/src/test/ui/parser/impl-parsing.stderr b/src/test/ui/parser/impl-parsing.stderr index 3cfcf7b7683..353f5e21ee6 100644 --- a/src/test/ui/parser/impl-parsing.stderr +++ b/src/test/ui/parser/impl-parsing.stderr @@ -1,29 +1,29 @@ error: missing `for` in a trait impl - --> $DIR/impl-parsing.rs:16:11 + --> $DIR/impl-parsing.rs:6:11 | LL | impl Trait Type {} //~ ERROR missing `for` in a trait impl - | ^ + | ^ help: add `for` here error: missing `for` in a trait impl - --> $DIR/impl-parsing.rs:17:11 + --> $DIR/impl-parsing.rs:7:11 | LL | impl Trait .. {} //~ ERROR missing `for` in a trait impl - | ^ + | ^ help: add `for` here error: expected a trait, found type - --> $DIR/impl-parsing.rs:18:6 + --> $DIR/impl-parsing.rs:8:6 | LL | impl ?Sized for Type {} //~ ERROR expected a trait, found type | ^^^^^^ error: expected a trait, found type - --> $DIR/impl-parsing.rs:19:6 + --> $DIR/impl-parsing.rs:9:6 | LL | impl ?Sized for .. {} //~ ERROR expected a trait, found type | ^^^^^^ error: expected `impl`, found `FAIL` - --> $DIR/impl-parsing.rs:21:16 + --> $DIR/impl-parsing.rs:11:16 | LL | default unsafe FAIL //~ ERROR expected `impl`, found `FAIL` | ^^^^ expected `impl` here diff --git a/src/test/ui/parser/impl-qpath.rs b/src/test/ui/parser/impl-qpath.rs index 5dced73c90d..78c41f481af 100644 --- a/src/test/ui/parser/impl-qpath.rs +++ b/src/test/ui/parser/impl-qpath.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // compile-flags: -Z parse-only diff --git a/src/test/ui/parser/import-from-path.rs b/src/test/ui/parser/import-from-path.rs index fbd59d200a0..3fce08259fc 100644 --- a/src/test/ui/parser/import-from-path.rs +++ b/src/test/ui/parser/import-from-path.rs @@ -1,14 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // error-pattern:expected use foo::{bar}::baz diff --git a/src/test/ui/parser/import-from-path.stderr b/src/test/ui/parser/import-from-path.stderr index 1628c120945..5842037fb80 100644 --- a/src/test/ui/parser/import-from-path.stderr +++ b/src/test/ui/parser/import-from-path.stderr @@ -1,5 +1,5 @@ error: expected `;`, found `::` - --> $DIR/import-from-path.rs:14:15 + --> $DIR/import-from-path.rs:2:15 | LL | use foo::{bar}::baz | ^^ expected `;` diff --git a/src/test/ui/parser/import-from-rename.rs b/src/test/ui/parser/import-from-rename.rs index c4d8ba2086d..27425a3c99a 100644 --- a/src/test/ui/parser/import-from-rename.rs +++ b/src/test/ui/parser/import-from-rename.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // error-pattern:expected use foo::{bar} as baz; diff --git a/src/test/ui/parser/import-from-rename.stderr b/src/test/ui/parser/import-from-rename.stderr index f00bfcb45b1..a966e993737 100644 --- a/src/test/ui/parser/import-from-rename.stderr +++ b/src/test/ui/parser/import-from-rename.stderr @@ -1,5 +1,5 @@ error: expected `;`, found keyword `as` - --> $DIR/import-from-rename.rs:15:16 + --> $DIR/import-from-rename.rs:3:16 | LL | use foo::{bar} as baz; | ^^ expected `;` diff --git a/src/test/ui/parser/import-glob-path.rs b/src/test/ui/parser/import-glob-path.rs index 2faf833d4f1..de4c07aa7bb 100644 --- a/src/test/ui/parser/import-glob-path.rs +++ b/src/test/ui/parser/import-glob-path.rs @@ -1,14 +1,2 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // error-pattern:expected use foo::*::bar diff --git a/src/test/ui/parser/import-glob-path.stderr b/src/test/ui/parser/import-glob-path.stderr index af7d0ee0c02..ebca2db8305 100644 --- a/src/test/ui/parser/import-glob-path.stderr +++ b/src/test/ui/parser/import-glob-path.stderr @@ -1,5 +1,5 @@ error: expected `;`, found `::` - --> $DIR/import-glob-path.rs:14:11 + --> $DIR/import-glob-path.rs:2:11 | LL | use foo::*::bar | ^^ expected `;` diff --git a/src/test/ui/parser/import-glob-rename.rs b/src/test/ui/parser/import-glob-rename.rs index 7e17e1f1d6c..b9b753dcd70 100644 --- a/src/test/ui/parser/import-glob-rename.rs +++ b/src/test/ui/parser/import-glob-rename.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // error-pattern:expected use foo::* as baz; diff --git a/src/test/ui/parser/import-glob-rename.stderr b/src/test/ui/parser/import-glob-rename.stderr index 0b124a32df3..28538732782 100644 --- a/src/test/ui/parser/import-glob-rename.stderr +++ b/src/test/ui/parser/import-glob-rename.stderr @@ -1,5 +1,5 @@ error: expected `;`, found keyword `as` - --> $DIR/import-glob-rename.rs:15:12 + --> $DIR/import-glob-rename.rs:3:12 | LL | use foo::* as baz; | ^^ expected `;` diff --git a/src/test/ui/parser/inner-attr-after-doc-comment.rs b/src/test/ui/parser/inner-attr-after-doc-comment.rs index ed8342d9f5a..36f4191f06b 100644 --- a/src/test/ui/parser/inner-attr-after-doc-comment.rs +++ b/src/test/ui/parser/inner-attr-after-doc-comment.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - #![feature(lang_items)] /** * My module diff --git a/src/test/ui/parser/inner-attr-after-doc-comment.stderr b/src/test/ui/parser/inner-attr-after-doc-comment.stderr index af050e662a2..0dde49a2913 100644 --- a/src/test/ui/parser/inner-attr-after-doc-comment.stderr +++ b/src/test/ui/parser/inner-attr-after-doc-comment.stderr @@ -1,5 +1,5 @@ error: an inner attribute is not permitted following an outer doc comment - --> $DIR/inner-attr-after-doc-comment.rs:18:3 + --> $DIR/inner-attr-after-doc-comment.rs:6:3 | LL | #![recursion_limit="100"] | ^ diff --git a/src/test/ui/parser/inner-attr.rs b/src/test/ui/parser/inner-attr.rs index 8cebda66445..1b405e20e03 100644 --- a/src/test/ui/parser/inner-attr.rs +++ b/src/test/ui/parser/inner-attr.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - #[feature(lang_items)] #![recursion_limit="100"] //~ ERROR an inner attribute is not permitted following an outer attribute diff --git a/src/test/ui/parser/inner-attr.stderr b/src/test/ui/parser/inner-attr.stderr index 89fb5cfad5e..001eab226dc 100644 --- a/src/test/ui/parser/inner-attr.stderr +++ b/src/test/ui/parser/inner-attr.stderr @@ -1,5 +1,5 @@ error: an inner attribute is not permitted following an outer attribute - --> $DIR/inner-attr.rs:15:3 + --> $DIR/inner-attr.rs:3:3 | LL | #![recursion_limit="100"] //~ ERROR an inner attribute is not permitted following an outer attribute | ^ diff --git a/src/test/ui/parser/int-literal-too-large-span.rs b/src/test/ui/parser/int-literal-too-large-span.rs index 1af8df7d2f6..206242c3c7f 100644 --- a/src/test/ui/parser/int-literal-too-large-span.rs +++ b/src/test/ui/parser/int-literal-too-large-span.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // issue #17123 fn main() { diff --git a/src/test/ui/parser/int-literal-too-large-span.stderr b/src/test/ui/parser/int-literal-too-large-span.stderr index 391cb52fd40..d7774c333c2 100644 --- a/src/test/ui/parser/int-literal-too-large-span.stderr +++ b/src/test/ui/parser/int-literal-too-large-span.stderr @@ -1,5 +1,5 @@ error: int literal is too large - --> $DIR/int-literal-too-large-span.rs:16:5 + --> $DIR/int-literal-too-large-span.rs:4:5 | LL | 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/parser/inverted-parameters.rs b/src/test/ui/parser/inverted-parameters.rs index c08a309e11e..42430278c72 100644 --- a/src/test/ui/parser/inverted-parameters.rs +++ b/src/test/ui/parser/inverted-parameters.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct S; impl S { diff --git a/src/test/ui/parser/inverted-parameters.stderr b/src/test/ui/parser/inverted-parameters.stderr index 63cd36f00c0..bdb8faa6c65 100644 --- a/src/test/ui/parser/inverted-parameters.stderr +++ b/src/test/ui/parser/inverted-parameters.stderr @@ -1,5 +1,5 @@ error: expected one of `:` or `@`, found `bar` - --> $DIR/inverted-parameters.rs:16:24 + --> $DIR/inverted-parameters.rs:4:24 | LL | fn foo(&self, &str bar) {} | -----^^^ @@ -8,7 +8,7 @@ LL | fn foo(&self, &str bar) {} | help: declare the type after the parameter binding: `: ` error: expected one of `:` or `@`, found `quux` - --> $DIR/inverted-parameters.rs:22:10 + --> $DIR/inverted-parameters.rs:10:10 | LL | fn baz(S quux, xyzzy: i32) {} | --^^^^ @@ -17,25 +17,25 @@ LL | fn baz(S quux, xyzzy: i32) {} | help: declare the type after the parameter binding: `: ` error: expected one of `:` or `@`, found `a` - --> $DIR/inverted-parameters.rs:27:12 + --> $DIR/inverted-parameters.rs:15:12 | LL | fn one(i32 a b) {} | ^ expected one of `:` or `@` here error: expected `:`, found `(` - --> $DIR/inverted-parameters.rs:30:23 + --> $DIR/inverted-parameters.rs:18:23 | LL | fn pattern((i32, i32) (a, b)) {} | ^ expected `:` error: expected one of `:` or `@`, found `)` - --> $DIR/inverted-parameters.rs:33:12 + --> $DIR/inverted-parameters.rs:21:12 | LL | fn fizz(i32) {} | ^ expected one of `:` or `@` here error: expected one of `:` or `@`, found `S` - --> $DIR/inverted-parameters.rs:36:23 + --> $DIR/inverted-parameters.rs:24:23 | LL | fn missing_colon(quux S) {} | -----^ diff --git a/src/test/ui/parser/issue-10392-2.rs b/src/test/ui/parser/issue-10392-2.rs index 2817912666e..3b5e3199a8a 100644 --- a/src/test/ui/parser/issue-10392-2.rs +++ b/src/test/ui/parser/issue-10392-2.rs @@ -1,15 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct A { foo: isize } fn a() -> A { panic!() } diff --git a/src/test/ui/parser/issue-10392-2.stderr b/src/test/ui/parser/issue-10392-2.stderr index 41548ed4a2f..47e1f7adf25 100644 --- a/src/test/ui/parser/issue-10392-2.stderr +++ b/src/test/ui/parser/issue-10392-2.stderr @@ -1,5 +1,5 @@ error: expected `}`, found `,` - --> $DIR/issue-10392-2.rs:18:15 + --> $DIR/issue-10392-2.rs:6:15 | LL | let A { .., } = a(); //~ ERROR: expected `}` | --^ diff --git a/src/test/ui/parser/issue-10392.rs b/src/test/ui/parser/issue-10392.rs index 9c67575bcc1..dd84af39300 100644 --- a/src/test/ui/parser/issue-10392.rs +++ b/src/test/ui/parser/issue-10392.rs @@ -1,19 +1,8 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct A { foo: isize } fn a() -> A { panic!() } fn main() { - let A { , } = a(); //~ ERROR: expected ident + let A { , } = a(); //~ ERROR expected ident + //~| ERROR pattern does not mention field `foo` } diff --git a/src/test/ui/parser/issue-10392.stderr b/src/test/ui/parser/issue-10392.stderr index 0401fe05cf8..9c9858aa26c 100644 --- a/src/test/ui/parser/issue-10392.stderr +++ b/src/test/ui/parser/issue-10392.stderr @@ -1,8 +1,15 @@ error: expected identifier, found `,` - --> $DIR/issue-10392.rs:18:13 + --> $DIR/issue-10392.rs:6:13 | -LL | let A { , } = a(); //~ ERROR: expected ident +LL | let A { , } = a(); //~ ERROR expected ident | ^ expected identifier -error: aborting due to previous error +error[E0027]: pattern does not mention field `foo` + --> $DIR/issue-10392.rs:6:9 + | +LL | let A { , } = a(); //~ ERROR expected ident + | ^^^^^^^ missing field `foo` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0027`. diff --git a/src/test/ui/parser/issue-10636-1.rs b/src/test/ui/parser/issue-10636-1.rs index 375b951ee15..e495c0411d8 100644 --- a/src/test/ui/parser/issue-10636-1.rs +++ b/src/test/ui/parser/issue-10636-1.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct Obj { //~^ NOTE: un-closed delimiter member: usize diff --git a/src/test/ui/parser/issue-10636-1.stderr b/src/test/ui/parser/issue-10636-1.stderr index 49b6d08aff5..894139f24dd 100644 --- a/src/test/ui/parser/issue-10636-1.stderr +++ b/src/test/ui/parser/issue-10636-1.stderr @@ -1,5 +1,5 @@ error: incorrect close delimiter: `)` - --> $DIR/issue-10636-1.rs:16:1 + --> $DIR/issue-10636-1.rs:4:1 | LL | struct Obj { | - un-closed delimiter diff --git a/src/test/ui/parser/issue-10636-2.rs b/src/test/ui/parser/issue-10636-2.rs index c96834fe4cf..a02fd41b349 100644 --- a/src/test/ui/parser/issue-10636-2.rs +++ b/src/test/ui/parser/issue-10636-2.rs @@ -1,18 +1,6 @@ -// Copyright 2013-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // FIXME(31528) we emit a bunch of silly errors here due to continuing past the // first one. This would be easy-ish to address by better recovery in tokenisation. -// compile-flags: -Z parse-only - pub fn trace_option(option: Option) { option.map(|some| 42; //~^ ERROR: expected one of diff --git a/src/test/ui/parser/issue-10636-2.stderr b/src/test/ui/parser/issue-10636-2.stderr index 8f721a3b5dd..9b3115cb3f4 100644 --- a/src/test/ui/parser/issue-10636-2.stderr +++ b/src/test/ui/parser/issue-10636-2.stderr @@ -1,5 +1,5 @@ error: incorrect close delimiter: `}` - --> $DIR/issue-10636-2.rs:20:1 + --> $DIR/issue-10636-2.rs:8:1 | LL | pub fn trace_option(option: Option) { | - close delimiter possibly meant for this @@ -10,13 +10,13 @@ LL | } //~ ERROR: incorrect close delimiter | ^ incorrect close delimiter error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` - --> $DIR/issue-10636-2.rs:17:25 + --> $DIR/issue-10636-2.rs:5:25 | LL | option.map(|some| 42; | ^ expected one of `)`, `,`, `.`, `?`, or an operator here error: expected expression, found `)` - --> $DIR/issue-10636-2.rs:20:1 + --> $DIR/issue-10636-2.rs:8:1 | LL | } //~ ERROR: incorrect close delimiter | ^ expected expression diff --git a/src/test/ui/parser/issue-14303-enum.rs b/src/test/ui/parser/issue-14303-enum.rs index 6bcf588b516..a6106159805 100644 --- a/src/test/ui/parser/issue-14303-enum.rs +++ b/src/test/ui/parser/issue-14303-enum.rs @@ -1,16 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - enum X<'a, T, 'b> { //~^ ERROR lifetime parameters must be declared prior to type parameters - A(&'a T) + A(&'a &'b T) } + +fn main() {} diff --git a/src/test/ui/parser/issue-14303-enum.stderr b/src/test/ui/parser/issue-14303-enum.stderr index 7d546cb2180..a31429e7228 100644 --- a/src/test/ui/parser/issue-14303-enum.stderr +++ b/src/test/ui/parser/issue-14303-enum.stderr @@ -1,8 +1,12 @@ error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-enum.rs:13:15 + --> $DIR/issue-14303-enum.rs:1:15 | LL | enum X<'a, T, 'b> { | ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | enum X<'a, 'b, T> { + | ^^^ -- error: aborting due to previous error diff --git a/src/test/ui/parser/issue-14303-fn-def.rs b/src/test/ui/parser/issue-14303-fn-def.rs index ae8e38c0377..221bd311e74 100644 --- a/src/test/ui/parser/issue-14303-fn-def.rs +++ b/src/test/ui/parser/issue-14303-fn-def.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn foo<'a, T, 'b>(x: &'a T) {} //~^ ERROR lifetime parameters must be declared prior to type parameters + +fn main() {} diff --git a/src/test/ui/parser/issue-14303-fn-def.stderr b/src/test/ui/parser/issue-14303-fn-def.stderr index c7b57f36376..4582aeef428 100644 --- a/src/test/ui/parser/issue-14303-fn-def.stderr +++ b/src/test/ui/parser/issue-14303-fn-def.stderr @@ -1,8 +1,12 @@ error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-fn-def.rs:13:15 + --> $DIR/issue-14303-fn-def.rs:1:15 | LL | fn foo<'a, T, 'b>(x: &'a T) {} | ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | fn foo<'a, 'b, T>(x: &'a T) {} + | ^^^ -- error: aborting due to previous error diff --git a/src/test/ui/parser/issue-14303-fncall.rs b/src/test/ui/parser/issue-14303-fncall.rs index 80a9b3d7c0d..17b9b766b21 100644 --- a/src/test/ui/parser/issue-14303-fncall.rs +++ b/src/test/ui/parser/issue-14303-fncall.rs @@ -1,18 +1,17 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// can't run rustfix because it doesn't handle multipart suggestions correctly +// compile-flags: -Zborrowck=mir +// we need the above to avoid ast borrowck failure in recovered code -// compile-flags: -Z parse-only +struct S<'a, T> { + a: &'a T, + b: &'a T, +} -fn main() { - (0..4) - .map(|x| x * 2) - .collect::>() - //~^ ERROR lifetime parameters must be declared prior to type parameters +fn foo<'a, 'b>(start: &'a usize, end: &'a usize) { + let _x = (*start..*end) + .map(|x| S { a: start, b: end }) + .collect::>>(); + //~^ ERROR lifetime parameters must be declared prior to type parameters } + +fn main() {} diff --git a/src/test/ui/parser/issue-14303-fncall.stderr b/src/test/ui/parser/issue-14303-fncall.stderr index cca23c70279..2a736491594 100644 --- a/src/test/ui/parser/issue-14303-fncall.stderr +++ b/src/test/ui/parser/issue-14303-fncall.stderr @@ -1,8 +1,12 @@ error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-fncall.rs:16:31 + --> $DIR/issue-14303-fncall.rs:13:29 | -LL | .collect::>() - | ^^ +LL | .collect::>>(); + | ^^ must be declared prior to type parameters +help: move the lifetime parameter prior to the first type parameter + | +LL | .collect::>>(); + | ^^^ -- error: aborting due to previous error diff --git a/src/test/ui/parser/issue-14303-impl.rs b/src/test/ui/parser/issue-14303-impl.rs index f06d5f29e9e..4dc2c666018 100644 --- a/src/test/ui/parser/issue-14303-impl.rs +++ b/src/test/ui/parser/issue-14303-impl.rs @@ -1,16 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +struct X(T); -// compile-flags: -Z parse-only - -struct X { x: isize } - -impl<'a, T, 'b> X {} +impl<'a, T, 'b> X {} //~^ ERROR lifetime parameters must be declared prior to type parameters + +fn main() {} diff --git a/src/test/ui/parser/issue-14303-impl.stderr b/src/test/ui/parser/issue-14303-impl.stderr index 0b7016eb7f7..a1953396153 100644 --- a/src/test/ui/parser/issue-14303-impl.stderr +++ b/src/test/ui/parser/issue-14303-impl.stderr @@ -1,8 +1,12 @@ error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-impl.rs:15:13 + --> $DIR/issue-14303-impl.rs:3:13 | -LL | impl<'a, T, 'b> X {} +LL | impl<'a, T, 'b> X {} | ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | impl<'a, 'b, T> X {} + | ^^^ -- error: aborting due to previous error diff --git a/src/test/ui/parser/issue-14303-path.rs b/src/test/ui/parser/issue-14303-path.rs index f0d1feffec8..a08c89f3437 100644 --- a/src/test/ui/parser/issue-14303-path.rs +++ b/src/test/ui/parser/issue-14303-path.rs @@ -1,14 +1,13 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +mod foo { + pub struct X<'a, 'b, 'c, T> { + a: &'a str, + b: &'b str, + c: &'c str, + t: T, + } +} -// compile-flags: -Z parse-only - -fn bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {} +fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {} //~^ ERROR lifetime parameters must be declared prior to type parameters + +fn main() {} diff --git a/src/test/ui/parser/issue-14303-path.stderr b/src/test/ui/parser/issue-14303-path.stderr index f0a45998d17..fb4fb32e11e 100644 --- a/src/test/ui/parser/issue-14303-path.stderr +++ b/src/test/ui/parser/issue-14303-path.stderr @@ -1,8 +1,14 @@ error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-path.rs:13:37 + --> $DIR/issue-14303-path.rs:10:40 | -LL | fn bar<'a, T>(x: mymodule::X<'a, T, 'b, 'c>) {} - | ^^ +LL | fn bar<'a, 'b, 'c, T>(x: foo::X<'a, T, 'b, 'c>) {} + | ^^ ^^ must be declared prior to type parameters + | | + | must be declared prior to type parameters +help: move the lifetime parameters prior to the first type parameter + | +LL | fn bar<'a, 'b, 'c, T>(x: foo::X<'a, 'b, 'c, T>) {} + | ^^^ ^^^ -- error: aborting due to previous error diff --git a/src/test/ui/parser/issue-14303-struct.rs b/src/test/ui/parser/issue-14303-struct.rs index 5673e4f2a4c..0bd10b4d085 100644 --- a/src/test/ui/parser/issue-14303-struct.rs +++ b/src/test/ui/parser/issue-14303-struct.rs @@ -1,16 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct X<'a, T, 'b> { //~^ ERROR lifetime parameters must be declared prior to type parameters - x: &'a T + x: &'a &'b T } + +fn main() {} diff --git a/src/test/ui/parser/issue-14303-struct.stderr b/src/test/ui/parser/issue-14303-struct.stderr index 4a4b6789194..668b8d1de68 100644 --- a/src/test/ui/parser/issue-14303-struct.stderr +++ b/src/test/ui/parser/issue-14303-struct.stderr @@ -1,8 +1,12 @@ error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-struct.rs:13:17 + --> $DIR/issue-14303-struct.rs:1:17 | LL | struct X<'a, T, 'b> { | ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | struct X<'a, 'b, T> { + | ^^^ -- error: aborting due to previous error diff --git a/src/test/ui/parser/issue-14303-trait.rs b/src/test/ui/parser/issue-14303-trait.rs index 8af5af9e933..f253de92d92 100644 --- a/src/test/ui/parser/issue-14303-trait.rs +++ b/src/test/ui/parser/issue-14303-trait.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - trait Foo<'a, T, 'b> {} //~^ ERROR lifetime parameters must be declared prior to type parameters + +fn main() {} diff --git a/src/test/ui/parser/issue-14303-trait.stderr b/src/test/ui/parser/issue-14303-trait.stderr index ab5cc5655bb..11ce0c44351 100644 --- a/src/test/ui/parser/issue-14303-trait.stderr +++ b/src/test/ui/parser/issue-14303-trait.stderr @@ -1,8 +1,12 @@ error: lifetime parameters must be declared prior to type parameters - --> $DIR/issue-14303-trait.rs:13:18 + --> $DIR/issue-14303-trait.rs:1:18 | LL | trait Foo<'a, T, 'b> {} | ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | trait Foo<'a, 'b, T> {} + | ^^^ -- error: aborting due to previous error diff --git a/src/test/ui/parser/issue-15914.rs b/src/test/ui/parser/issue-15914.rs index 0b8f0ac221a..4a5606af6d0 100644 --- a/src/test/ui/parser/issue-15914.rs +++ b/src/test/ui/parser/issue-15914.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let ref (); //~ ERROR expected identifier, found `(` diff --git a/src/test/ui/parser/issue-15914.stderr b/src/test/ui/parser/issue-15914.stderr index fbf0ea13c73..3a886c4c481 100644 --- a/src/test/ui/parser/issue-15914.stderr +++ b/src/test/ui/parser/issue-15914.stderr @@ -1,5 +1,5 @@ error: expected identifier, found `(` - --> $DIR/issue-15914.rs:15:9 + --> $DIR/issue-15914.rs:3:9 | LL | (); //~ ERROR expected identifier, found `(` | ^ expected identifier diff --git a/src/test/ui/parser/issue-15980.rs b/src/test/ui/parser/issue-15980.rs index 2f11805481d..ba874fb4476 100644 --- a/src/test/ui/parser/issue-15980.rs +++ b/src/test/ui/parser/issue-15980.rs @@ -1,19 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - use std::io; fn main(){ - let x: io::IoResult<()> = Ok(()); + let x: io::Result<()> = Ok(()); match x { Err(ref e) if e.kind == io::EndOfFile { //~^ NOTE while parsing this struct diff --git a/src/test/ui/parser/issue-15980.stderr b/src/test/ui/parser/issue-15980.stderr index 1395803e121..c91595208c8 100644 --- a/src/test/ui/parser/issue-15980.stderr +++ b/src/test/ui/parser/issue-15980.stderr @@ -1,14 +1,18 @@ error: expected identifier, found keyword `return` - --> $DIR/issue-15980.rs:20:13 + --> $DIR/issue-15980.rs:8:13 | LL | Err(ref e) if e.kind == io::EndOfFile { | ------------- while parsing this struct LL | //~^ NOTE while parsing this struct LL | return | ^^^^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | r#return + | error: expected one of `.`, `=>`, `?`, or an operator, found `_` - --> $DIR/issue-15980.rs:25:9 + --> $DIR/issue-15980.rs:13:9 | LL | } | - expected one of `.`, `=>`, `?`, or an operator here diff --git a/src/test/ui/parser/issue-1655.rs b/src/test/ui/parser/issue-1655.rs index a044dff261d..3d0bf3c1c7b 100644 --- a/src/test/ui/parser/issue-1655.rs +++ b/src/test/ui/parser/issue-1655.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // error-pattern:expected `[`, found `vec` mod blade_runner { #vec[doc( diff --git a/src/test/ui/parser/issue-1655.stderr b/src/test/ui/parser/issue-1655.stderr index 890400acccf..3f656b63cdb 100644 --- a/src/test/ui/parser/issue-1655.stderr +++ b/src/test/ui/parser/issue-1655.stderr @@ -1,5 +1,5 @@ error: expected `[`, found `vec` - --> $DIR/issue-1655.rs:15:6 + --> $DIR/issue-1655.rs:3:6 | LL | #vec[doc( | ^^^ expected `[` diff --git a/src/test/ui/parser/issue-17383.rs b/src/test/ui/parser/issue-17383.rs index 48f629fd828..04cd43d0b10 100644 --- a/src/test/ui/parser/issue-17383.rs +++ b/src/test/ui/parser/issue-17383.rs @@ -1,20 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - enum X { - A = - b'a' //~ ERROR discriminator values can only be used with a field-less enum - , - B(isize) + A = 3, + //~^ ERROR discriminator values can only be used with a field-less enum + B(usize) } fn main() {} diff --git a/src/test/ui/parser/issue-17383.stderr b/src/test/ui/parser/issue-17383.stderr index 321989e5fab..57caa3372a6 100644 --- a/src/test/ui/parser/issue-17383.stderr +++ b/src/test/ui/parser/issue-17383.stderr @@ -1,8 +1,8 @@ error: discriminator values can only be used with a field-less enum - --> $DIR/issue-17383.rs:15:9 + --> $DIR/issue-17383.rs:2:9 | -LL | b'a' //~ ERROR discriminator values can only be used with a field-less enum - | ^^^^ +LL | A = 3, + | ^ only valid in field-less enums error: aborting due to previous error diff --git a/src/test/ui/parser/issue-17718-const-mut.rs b/src/test/ui/parser/issue-17718-const-mut.rs index b450cb25e6b..795a8c7631d 100644 --- a/src/test/ui/parser/issue-17718-const-mut.rs +++ b/src/test/ui/parser/issue-17718-const-mut.rs @@ -1,18 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - const mut //~ ERROR: const globals cannot be mutable -//~^ HELP did you mean to declare a static? +//~^^ HELP you might want to declare a static instead FOO: usize = 3; fn main() { diff --git a/src/test/ui/parser/issue-17718-const-mut.stderr b/src/test/ui/parser/issue-17718-const-mut.stderr index b294a8572fb..19f9fe19ef5 100644 --- a/src/test/ui/parser/issue-17718-const-mut.stderr +++ b/src/test/ui/parser/issue-17718-const-mut.stderr @@ -1,10 +1,10 @@ error: const globals cannot be mutable - --> $DIR/issue-17718-const-mut.rs:14:1 + --> $DIR/issue-17718-const-mut.rs:2:1 | +LL | const + | ----- help: you might want to declare a static instead: `static` LL | mut //~ ERROR: const globals cannot be mutable - | ^^^ - | - = help: did you mean to declare a static? + | ^^^ cannot be mutable error: aborting due to previous error diff --git a/src/test/ui/parser/issue-17904-2.rs b/src/test/ui/parser/issue-17904-2.rs index 749cb7fcc0b..d3f32255c31 100644 --- a/src/test/ui/parser/issue-17904-2.rs +++ b/src/test/ui/parser/issue-17904-2.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error struct Bar { x: T } where T: Copy //~ ERROR expected item, found keyword `where` diff --git a/src/test/ui/parser/issue-17904-2.stderr b/src/test/ui/parser/issue-17904-2.stderr index ff9e1215f10..8322dc00cad 100644 --- a/src/test/ui/parser/issue-17904-2.stderr +++ b/src/test/ui/parser/issue-17904-2.stderr @@ -1,5 +1,5 @@ error: expected item, found keyword `where` - --> $DIR/issue-17904-2.rs:13:24 + --> $DIR/issue-17904-2.rs:3:24 | LL | struct Bar { x: T } where T: Copy //~ ERROR expected item, found keyword `where` | ^^^^^ expected item diff --git a/src/test/ui/parser/issue-17904.rs b/src/test/ui/parser/issue-17904.rs index a54d89f48c3..6112623041a 100644 --- a/src/test/ui/parser/issue-17904.rs +++ b/src/test/ui/parser/issue-17904.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error struct Baz where U: Eq(U); //This is parsed as the new Fn* style parenthesis syntax. struct Baz where U: Eq(U) -> R; // Notice this parses as well. diff --git a/src/test/ui/parser/issue-17904.stderr b/src/test/ui/parser/issue-17904.stderr index c783d97478c..f2f0b411e9a 100644 --- a/src/test/ui/parser/issue-17904.stderr +++ b/src/test/ui/parser/issue-17904.stderr @@ -1,5 +1,5 @@ error: expected one of `:`, `==`, or `=`, found `;` - --> $DIR/issue-17904.rs:16:33 + --> $DIR/issue-17904.rs:6:33 | LL | struct Foo where T: Copy, (T); //~ ERROR expected one of `:`, `==`, or `=`, found `;` | ^ expected one of `:`, `==`, or `=` here diff --git a/src/test/ui/parser/issue-1802-1.rs b/src/test/ui/parser/issue-1802-1.rs index fc3d071729f..3c34b0d8feb 100644 --- a/src/test/ui/parser/issue-1802-1.rs +++ b/src/test/ui/parser/issue-1802-1.rs @@ -1,16 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +fn log(a: i32, b: i32) {} -// compile-flags: -Z parse-only - -// error-pattern:no valid digits found for number fn main() { + let error = 42; log(error, 0b); + //~^ ERROR no valid digits found for number } diff --git a/src/test/ui/parser/issue-1802-1.stderr b/src/test/ui/parser/issue-1802-1.stderr index b4ce85e784c..b7d003df56b 100644 --- a/src/test/ui/parser/issue-1802-1.stderr +++ b/src/test/ui/parser/issue-1802-1.stderr @@ -1,5 +1,5 @@ error: no valid digits found for number - --> $DIR/issue-1802-1.rs:15:16 + --> $DIR/issue-1802-1.rs:5:16 | LL | log(error, 0b); | ^^ diff --git a/src/test/ui/parser/issue-1802-2.rs b/src/test/ui/parser/issue-1802-2.rs index 05c5a4bcb02..3c34b0d8feb 100644 --- a/src/test/ui/parser/issue-1802-2.rs +++ b/src/test/ui/parser/issue-1802-2.rs @@ -1,16 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +fn log(a: i32, b: i32) {} -// compile-flags: -Z parse-only - -// error-pattern:no valid digits found for number fn main() { - log(error, 0b_usize); + let error = 42; + log(error, 0b); + //~^ ERROR no valid digits found for number } diff --git a/src/test/ui/parser/issue-1802-2.stderr b/src/test/ui/parser/issue-1802-2.stderr index d8e68529a6d..8491dd07cb7 100644 --- a/src/test/ui/parser/issue-1802-2.stderr +++ b/src/test/ui/parser/issue-1802-2.stderr @@ -1,8 +1,8 @@ error: no valid digits found for number - --> $DIR/issue-1802-2.rs:15:16 + --> $DIR/issue-1802-2.rs:5:16 | -LL | log(error, 0b_usize); - | ^^^ +LL | log(error, 0b); + | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/issue-19096.rs b/src/test/ui/parser/issue-19096.rs index 6ba0fb5f15b..edc69e6f49f 100644 --- a/src/test/ui/parser/issue-19096.rs +++ b/src/test/ui/parser/issue-19096.rs @@ -1,16 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let t = (42, 42); t.0::; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::` + //~| ERROR mismatched types } diff --git a/src/test/ui/parser/issue-19096.stderr b/src/test/ui/parser/issue-19096.stderr index 0e99f4e125c..f92604d0067 100644 --- a/src/test/ui/parser/issue-19096.stderr +++ b/src/test/ui/parser/issue-19096.stderr @@ -1,8 +1,21 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `::` - --> $DIR/issue-19096.rs:15:8 + --> $DIR/issue-19096.rs:3:8 | LL | t.0::; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::` | ^^ expected one of `.`, `;`, `?`, `}`, or an operator here -error: aborting due to previous error +error[E0308]: mismatched types + --> $DIR/issue-19096.rs:3:5 + | +LL | fn main() { + | - expected `()` because of default return type +LL | let t = (42, 42); +LL | t.0::; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::` + | ^^^ expected (), found integer + | + = note: expected type `()` + found type `{integer}` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/issue-19398.rs b/src/test/ui/parser/issue-19398.rs index a91d513b83d..822f4a6fde2 100644 --- a/src/test/ui/parser/issue-19398.rs +++ b/src/test/ui/parser/issue-19398.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - trait T { extern "Rust" unsafe fn foo(); //~ ERROR expected `fn`, found `unsafe` } diff --git a/src/test/ui/parser/issue-19398.stderr b/src/test/ui/parser/issue-19398.stderr index 08957f2d383..627b74ff8f7 100644 --- a/src/test/ui/parser/issue-19398.stderr +++ b/src/test/ui/parser/issue-19398.stderr @@ -1,5 +1,5 @@ error: expected `fn`, found `unsafe` - --> $DIR/issue-19398.rs:14:19 + --> $DIR/issue-19398.rs:2:19 | LL | extern "Rust" unsafe fn foo(); //~ ERROR expected `fn`, found `unsafe` | ^^^^^^ expected `fn` here diff --git a/src/test/ui/parser/issue-20711-2.rs b/src/test/ui/parser/issue-20711-2.rs index d0836d4af97..49b8de03c37 100644 --- a/src/test/ui/parser/issue-20711-2.rs +++ b/src/test/ui/parser/issue-20711-2.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only // ignore-tidy-linelength struct Foo; diff --git a/src/test/ui/parser/issue-20711-2.stderr b/src/test/ui/parser/issue-20711-2.stderr index ce6d6cbdc06..e06eb7a9846 100644 --- a/src/test/ui/parser/issue-20711-2.stderr +++ b/src/test/ui/parser/issue-20711-2.stderr @@ -1,5 +1,5 @@ error: expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}` - --> $DIR/issue-20711-2.rs:20:1 + --> $DIR/issue-20711-2.rs:9:1 | LL | #[stable(feature = "rust1", since = "1.0.0")] | - expected one of 10 possible tokens here diff --git a/src/test/ui/parser/issue-20711.rs b/src/test/ui/parser/issue-20711.rs index d9442247988..8d8401da61a 100644 --- a/src/test/ui/parser/issue-20711.rs +++ b/src/test/ui/parser/issue-20711.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only // ignore-tidy-linelength struct Foo; diff --git a/src/test/ui/parser/issue-20711.stderr b/src/test/ui/parser/issue-20711.stderr index b5b56361577..6cf39608fcc 100644 --- a/src/test/ui/parser/issue-20711.stderr +++ b/src/test/ui/parser/issue-20711.stderr @@ -1,5 +1,5 @@ error: expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, or `unsafe`, found `}` - --> $DIR/issue-20711.rs:18:1 + --> $DIR/issue-20711.rs:7:1 | LL | #[stable(feature = "rust1", since = "1.0.0")] | - expected one of 10 possible tokens here diff --git a/src/test/ui/parser/issue-21153.rs b/src/test/ui/parser/issue-21153.rs index b6d95ffb911..46cd45f28b4 100644 --- a/src/test/ui/parser/issue-21153.rs +++ b/src/test/ui/parser/issue-21153.rs @@ -1,15 +1,5 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - trait MyTrait: Iterator { //~ ERROR missing `fn`, `type`, or `const` Item = T; } + +fn main() {} diff --git a/src/test/ui/parser/issue-21153.stderr b/src/test/ui/parser/issue-21153.stderr index 47e05f1b360..1e0244c2e1d 100644 --- a/src/test/ui/parser/issue-21153.stderr +++ b/src/test/ui/parser/issue-21153.stderr @@ -1,5 +1,5 @@ error: missing `fn`, `type`, or `const` for trait-item declaration - --> $DIR/issue-21153.rs:13:29 + --> $DIR/issue-21153.rs:1:29 | LL | trait MyTrait: Iterator { //~ ERROR missing `fn`, `type`, or `const` | _____________________________^ diff --git a/src/test/ui/parser/issue-22647.rs b/src/test/ui/parser/issue-22647.rs index 0f77ddd70cf..25cd7ffce5a 100644 --- a/src/test/ui/parser/issue-22647.rs +++ b/src/test/ui/parser/issue-22647.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let caller = |f: F| //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<` where F: Fn() -> i32 diff --git a/src/test/ui/parser/issue-22647.stderr b/src/test/ui/parser/issue-22647.stderr index fbf078e425b..8935ea9c6c1 100644 --- a/src/test/ui/parser/issue-22647.stderr +++ b/src/test/ui/parser/issue-22647.stderr @@ -1,5 +1,5 @@ error: expected one of `:`, `;`, `=`, or `@`, found `<` - --> $DIR/issue-22647.rs:14:15 + --> $DIR/issue-22647.rs:2:15 | LL | let caller = |f: F| //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<` | ^ expected one of `:`, `;`, `=`, or `@` here diff --git a/src/test/ui/parser/issue-22712.rs b/src/test/ui/parser/issue-22712.rs index 026af652c5e..b03d578e3d6 100644 --- a/src/test/ui/parser/issue-22712.rs +++ b/src/test/ui/parser/issue-22712.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct Foo { buffer: B } diff --git a/src/test/ui/parser/issue-22712.stderr b/src/test/ui/parser/issue-22712.stderr index 8651005ea68..3a4fa9a5e7b 100644 --- a/src/test/ui/parser/issue-22712.stderr +++ b/src/test/ui/parser/issue-22712.stderr @@ -1,5 +1,5 @@ error: expected one of `:`, `;`, `=`, or `@`, found `<` - --> $DIR/issue-22712.rs:18:12 + --> $DIR/issue-22712.rs:6:12 | LL | let Foo> //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<` | ^ expected one of `:`, `;`, `=`, or `@` here diff --git a/src/test/ui/parser/issue-2354-1.rs b/src/test/ui/parser/issue-2354-1.rs index f24c5440735..7e4e24fae19 100644 --- a/src/test/ui/parser/issue-2354-1.rs +++ b/src/test/ui/parser/issue-2354-1.rs @@ -1,13 +1 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - static foo: isize = 2; } //~ ERROR unexpected close delimiter: diff --git a/src/test/ui/parser/issue-2354-1.stderr b/src/test/ui/parser/issue-2354-1.stderr index bcec78a3d9b..da25aac486e 100644 --- a/src/test/ui/parser/issue-2354-1.stderr +++ b/src/test/ui/parser/issue-2354-1.stderr @@ -1,5 +1,5 @@ error: unexpected close delimiter: `}` - --> $DIR/issue-2354-1.rs:13:24 + --> $DIR/issue-2354-1.rs:1:24 | LL | static foo: isize = 2; } //~ ERROR unexpected close delimiter: | ^ unexpected close delimiter diff --git a/src/test/ui/parser/issue-2354.rs b/src/test/ui/parser/issue-2354.rs index 35fddcb0de4..565f84822f7 100644 --- a/src/test/ui/parser/issue-2354.rs +++ b/src/test/ui/parser/issue-2354.rs @@ -1,17 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn foo() { //~ NOTE un-closed delimiter - match Some(x) { + match Some(10) { //~^ NOTE this delimiter might not be properly closed... Some(y) => { panic!(); } None => { panic!(); } @@ -23,4 +11,5 @@ fn bar() { while (i < 1000) {} } -fn main() {} //~ ERROR this file contains an un-closed delimiter +fn main() {} //~ NOTE here is a function named 'main' + //~ ERROR this file contains an un-closed delimiter diff --git a/src/test/ui/parser/issue-2354.stderr b/src/test/ui/parser/issue-2354.stderr index 9cf569b685b..0f4cd5724ce 100644 --- a/src/test/ui/parser/issue-2354.stderr +++ b/src/test/ui/parser/issue-2354.stderr @@ -1,16 +1,26 @@ error: this file contains an un-closed delimiter - --> $DIR/issue-2354.rs:26:66 + --> $DIR/issue-2354.rs:15:66 | LL | fn foo() { //~ NOTE un-closed delimiter | - un-closed delimiter -LL | match Some(x) { - | - this delimiter might not be properly closed... +LL | match Some(10) { + | - this delimiter might not be properly closed... ... LL | } | - ...as it matches this but it has different indentation ... -LL | fn main() {} //~ ERROR this file contains an un-closed delimiter +LL | //~ ERROR this file contains an un-closed delimiter | ^ -error: aborting due to previous error +error[E0601]: `main` function not found in crate `issue_2354` + | + = note: the main function must be defined at the crate level but you have one or more functions named 'main' that are not defined at the crate level. Either move the definition or attach the `#[main]` attribute to override this behavior. +note: here is a function named 'main' + --> $DIR/issue-2354.rs:14:1 + | +LL | fn main() {} //~ NOTE here is a function named 'main' + | ^^^^^^^^^^^^ + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/parser/issue-23620-invalid-escapes.rs b/src/test/ui/parser/issue-23620-invalid-escapes.rs index dfeaae49002..b4b8f1fc0b0 100644 --- a/src/test/ui/parser/issue-23620-invalid-escapes.rs +++ b/src/test/ui/parser/issue-23620-invalid-escapes.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error fn main() { let _ = b"\u{a66e}"; @@ -45,4 +35,7 @@ fn main() { //~^ ERROR invalid character in numeric character escape: //~^^ ERROR form of character escape may only be used with characters in the range [\x00-\x7f] //~^^^ ERROR incorrect unicode escape sequence + + let _ = "\u8f"; + //~^ ERROR incorrect unicode escape sequence } diff --git a/src/test/ui/parser/issue-23620-invalid-escapes.stderr b/src/test/ui/parser/issue-23620-invalid-escapes.stderr index a46bcb07200..f6e476ab0cd 100644 --- a/src/test/ui/parser/issue-23620-invalid-escapes.stderr +++ b/src/test/ui/parser/issue-23620-invalid-escapes.stderr @@ -1,122 +1,130 @@ error: unicode escape sequences cannot be used as a byte or in a byte string - --> $DIR/issue-23620-invalid-escapes.rs:14:15 + --> $DIR/issue-23620-invalid-escapes.rs:4:15 | LL | let _ = b"/u{a66e}"; | ^^^^^^^^ error: unicode escape sequences cannot be used as a byte or in a byte string - --> $DIR/issue-23620-invalid-escapes.rs:17:15 + --> $DIR/issue-23620-invalid-escapes.rs:7:15 | LL | let _ = b'/u{a66e}'; | ^^^^^^^^ error: incorrect unicode escape sequence - --> $DIR/issue-23620-invalid-escapes.rs:20:15 + --> $DIR/issue-23620-invalid-escapes.rs:10:15 | LL | let _ = b'/u'; | ^^ | -help: format of unicode escape sequences is `/u{…}` - --> $DIR/issue-23620-invalid-escapes.rs:20:15 +help: format of unicode escape sequences is `/u{...}` + --> $DIR/issue-23620-invalid-escapes.rs:10:15 | LL | let _ = b'/u'; | ^^ error: unicode escape sequences cannot be used as a byte or in a byte string - --> $DIR/issue-23620-invalid-escapes.rs:20:15 + --> $DIR/issue-23620-invalid-escapes.rs:10:15 | LL | let _ = b'/u'; | ^^ error: numeric character escape is too short - --> $DIR/issue-23620-invalid-escapes.rs:24:17 + --> $DIR/issue-23620-invalid-escapes.rs:14:17 | LL | let _ = b'/x5'; | ^ error: invalid character in numeric character escape: x - --> $DIR/issue-23620-invalid-escapes.rs:27:17 + --> $DIR/issue-23620-invalid-escapes.rs:17:17 | LL | let _ = b'/xxy'; | ^ error: invalid character in numeric character escape: y - --> $DIR/issue-23620-invalid-escapes.rs:27:18 + --> $DIR/issue-23620-invalid-escapes.rs:17:18 | LL | let _ = b'/xxy'; | ^ error: numeric character escape is too short - --> $DIR/issue-23620-invalid-escapes.rs:31:16 + --> $DIR/issue-23620-invalid-escapes.rs:21:16 | LL | let _ = '/x5'; | ^ error: invalid character in numeric character escape: x - --> $DIR/issue-23620-invalid-escapes.rs:34:16 + --> $DIR/issue-23620-invalid-escapes.rs:24:16 | LL | let _ = '/xxy'; | ^ error: invalid character in numeric character escape: y - --> $DIR/issue-23620-invalid-escapes.rs:34:17 + --> $DIR/issue-23620-invalid-escapes.rs:24:17 | LL | let _ = '/xxy'; | ^ error: unicode escape sequences cannot be used as a byte or in a byte string - --> $DIR/issue-23620-invalid-escapes.rs:38:15 + --> $DIR/issue-23620-invalid-escapes.rs:28:15 | LL | let _ = b"/u{a4a4} /xf /u"; | ^^^^^^^^ error: invalid character in numeric character escape: - --> $DIR/issue-23620-invalid-escapes.rs:38:27 + --> $DIR/issue-23620-invalid-escapes.rs:28:27 | LL | let _ = b"/u{a4a4} /xf /u"; | ^ error: incorrect unicode escape sequence - --> $DIR/issue-23620-invalid-escapes.rs:38:28 + --> $DIR/issue-23620-invalid-escapes.rs:28:28 | LL | let _ = b"/u{a4a4} /xf /u"; | ^^ | -help: format of unicode escape sequences is `/u{…}` - --> $DIR/issue-23620-invalid-escapes.rs:38:28 +help: format of unicode escape sequences is `/u{...}` + --> $DIR/issue-23620-invalid-escapes.rs:28:28 | LL | let _ = b"/u{a4a4} /xf /u"; | ^^ error: unicode escape sequences cannot be used as a byte or in a byte string - --> $DIR/issue-23620-invalid-escapes.rs:38:28 + --> $DIR/issue-23620-invalid-escapes.rs:28:28 | LL | let _ = b"/u{a4a4} /xf /u"; | ^^ error: invalid character in numeric character escape: - --> $DIR/issue-23620-invalid-escapes.rs:44:17 + --> $DIR/issue-23620-invalid-escapes.rs:34:17 | LL | let _ = "/xf /u"; | ^ error: this form of character escape may only be used with characters in the range [/x00-/x7f] - --> $DIR/issue-23620-invalid-escapes.rs:44:16 + --> $DIR/issue-23620-invalid-escapes.rs:34:16 | LL | let _ = "/xf /u"; | ^^ error: incorrect unicode escape sequence - --> $DIR/issue-23620-invalid-escapes.rs:44:18 + --> $DIR/issue-23620-invalid-escapes.rs:34:18 | LL | let _ = "/xf /u"; | ^^ | -help: format of unicode escape sequences is `/u{…}` - --> $DIR/issue-23620-invalid-escapes.rs:44:18 +help: format of unicode escape sequences is `/u{...}` + --> $DIR/issue-23620-invalid-escapes.rs:34:18 | LL | let _ = "/xf /u"; | ^^ -error: aborting due to 17 previous errors +error: incorrect unicode escape sequence + --> $DIR/issue-23620-invalid-escapes.rs:39:14 + | +LL | let _ = "/u8f"; + | ^^-- + | | + | help: format of unicode escape sequences uses braces: `/u{8f}` + +error: aborting due to 18 previous errors diff --git a/src/test/ui/parser/issue-24197.rs b/src/test/ui/parser/issue-24197.rs index 8e098655a52..005ff9fa2e0 100644 --- a/src/test/ui/parser/issue-24197.rs +++ b/src/test/ui/parser/issue-24197.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let buf[0] = 0; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `[` } diff --git a/src/test/ui/parser/issue-24197.stderr b/src/test/ui/parser/issue-24197.stderr index 567c4f1f21b..4e073d8c58a 100644 --- a/src/test/ui/parser/issue-24197.stderr +++ b/src/test/ui/parser/issue-24197.stderr @@ -1,5 +1,5 @@ error: expected one of `:`, `;`, `=`, or `@`, found `[` - --> $DIR/issue-24197.rs:14:12 + --> $DIR/issue-24197.rs:2:12 | LL | let buf[0] = 0; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `[` | ^ expected one of `:`, `;`, `=`, or `@` here diff --git a/src/test/ui/parser/issue-24375.rs b/src/test/ui/parser/issue-24375.rs index aca50fdaf10..1d128d33e4f 100644 --- a/src/test/ui/parser/issue-24375.rs +++ b/src/test/ui/parser/issue-24375.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - static tmp : [&'static str; 2] = ["hello", "he"]; fn main() { diff --git a/src/test/ui/parser/issue-24375.stderr b/src/test/ui/parser/issue-24375.stderr index 0a9be6f4d2a..f773a7df4fe 100644 --- a/src/test/ui/parser/issue-24375.stderr +++ b/src/test/ui/parser/issue-24375.stderr @@ -1,5 +1,5 @@ error: expected one of `=>`, `@`, `if`, or `|`, found `[` - --> $DIR/issue-24375.rs:18:12 + --> $DIR/issue-24375.rs:6:12 | LL | tmp[0] => {} //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `[` | ^ expected one of `=>`, `@`, `if`, or `|` here diff --git a/src/test/ui/parser/issue-24780.rs b/src/test/ui/parser/issue-24780.rs index 6fd4ee38a4d..799cdd80222 100644 --- a/src/test/ui/parser/issue-24780.rs +++ b/src/test/ui/parser/issue-24780.rs @@ -1,18 +1,6 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Verify that '>' is not both expected and found at the same time, as it used // to happen in #24780. For example, following should be an error: // expected one of ..., `>`, ... found `>` -// -// compile-flags: -Z parse-only fn foo() -> Vec> { //~^ ERROR expected one of `!`, `+`, `::`, `where`, or `{`, found `>` diff --git a/src/test/ui/parser/issue-24780.stderr b/src/test/ui/parser/issue-24780.stderr index 01f110e3d24..469c034795e 100644 --- a/src/test/ui/parser/issue-24780.stderr +++ b/src/test/ui/parser/issue-24780.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `+`, `::`, `where`, or `{`, found `>` - --> $DIR/issue-24780.rs:17:23 + --> $DIR/issue-24780.rs:5:23 | LL | fn foo() -> Vec> { | ^ expected one of `!`, `+`, `::`, `where`, or `{` here diff --git a/src/test/ui/parser/issue-27255.rs b/src/test/ui/parser/issue-27255.rs index a751c4af494..d619688e101 100644 --- a/src/test/ui/parser/issue-27255.rs +++ b/src/test/ui/parser/issue-27255.rs @@ -1,15 +1,10 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +trait A {} -// compile-flags: -Z parse-only +impl A .. {} +//~^ ERROR missing `for` in a trait impl +//~| ERROR `impl Trait for .. {}` is an obsolete syntax -impl A .. {} //~ ERROR +impl A usize {} +//~^ ERROR missing `for` in a trait impl fn main() {} diff --git a/src/test/ui/parser/issue-27255.stderr b/src/test/ui/parser/issue-27255.stderr index 9caa6087420..391a23556c4 100644 --- a/src/test/ui/parser/issue-27255.stderr +++ b/src/test/ui/parser/issue-27255.stderr @@ -1,8 +1,22 @@ error: missing `for` in a trait impl - --> $DIR/issue-27255.rs:13:7 + --> $DIR/issue-27255.rs:3:7 | -LL | impl A .. {} //~ ERROR - | ^ +LL | impl A .. {} + | ^ help: add `for` here -error: aborting due to previous error +error: missing `for` in a trait impl + --> $DIR/issue-27255.rs:7:7 + | +LL | impl A usize {} + | ^^^^^^ help: add `for` here + +error: `impl Trait for .. {}` is an obsolete syntax + --> $DIR/issue-27255.rs:3:1 + | +LL | impl A .. {} + | ^^^^^^^^^^^^ + | + = help: use `auto trait Trait {}` instead + +error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/issue-30318.rs b/src/test/ui/parser/issue-30318.rs index 9ea0bb78283..38e30de716d 100644 --- a/src/test/ui/parser/issue-30318.rs +++ b/src/test/ui/parser/issue-30318.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn foo() { } //! Misplaced comment... diff --git a/src/test/ui/parser/issue-30318.stderr b/src/test/ui/parser/issue-30318.stderr index 778a58463f7..489451bb5dc 100644 --- a/src/test/ui/parser/issue-30318.stderr +++ b/src/test/ui/parser/issue-30318.stderr @@ -1,5 +1,5 @@ error: expected outer doc comment - --> $DIR/issue-30318.rs:15:1 + --> $DIR/issue-30318.rs:3:1 | LL | //! Misplaced comment... | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/parser/issue-3036.rs b/src/test/ui/parser/issue-3036.rs index 229b12136fc..00b241b9054 100644 --- a/src/test/ui/parser/issue-3036.rs +++ b/src/test/ui/parser/issue-3036.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Testing that semicolon tokens are printed correctly in errors fn main() diff --git a/src/test/ui/parser/issue-3036.stderr b/src/test/ui/parser/issue-3036.stderr index e0e398381b7..eadf5546d85 100644 --- a/src/test/ui/parser/issue-3036.stderr +++ b/src/test/ui/parser/issue-3036.stderr @@ -1,5 +1,5 @@ error: expected one of `.`, `;`, `?`, or an operator, found `}` - --> $DIR/issue-3036.rs:18:1 + --> $DIR/issue-3036.rs:6:1 | LL | let x = 3 | - expected one of `.`, `;`, `?`, or an operator here diff --git a/src/test/ui/parser/issue-32214.rs b/src/test/ui/parser/issue-32214.rs index 9e200094093..7e55bc038e7 100644 --- a/src/test/ui/parser/issue-32214.rs +++ b/src/test/ui/parser/issue-32214.rs @@ -1,16 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// compile-flags: -Z continue-parse-after-error -// compile-flags: -Z parse-only -Z continue-parse-after-error +trait Trait { type Item; } -pub fn test >() {} +pub fn test >() {} //~^ ERROR type parameters must be declared prior to associated type bindings fn main() { } diff --git a/src/test/ui/parser/issue-32214.stderr b/src/test/ui/parser/issue-32214.stderr index cce6cf6ede2..660e517c85a 100644 --- a/src/test/ui/parser/issue-32214.stderr +++ b/src/test/ui/parser/issue-32214.stderr @@ -1,8 +1,12 @@ error: type parameters must be declared prior to associated type bindings - --> $DIR/issue-32214.rs:13:37 + --> $DIR/issue-32214.rs:5:34 | -LL | pub fn test >() {} - | ^ +LL | pub fn test >() {} + | ^ must be declared prior to associated type bindings +help: move the type parameter prior to the first associated type binding + | +LL | pub fn test >() {} + | ^^ -- error: aborting due to previous error diff --git a/src/test/ui/parser/issue-32446.rs b/src/test/ui/parser/issue-32446.rs index 90b9a4aae8b..53e519a72a5 100644 --- a/src/test/ui/parser/issue-32446.rs +++ b/src/test/ui/parser/issue-32446.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() {} // This used to end up in an infite loop trying to bump past EOF. diff --git a/src/test/ui/parser/issue-32446.stderr b/src/test/ui/parser/issue-32446.stderr index 608a9a6e6e0..07eafdde907 100644 --- a/src/test/ui/parser/issue-32446.stderr +++ b/src/test/ui/parser/issue-32446.stderr @@ -1,5 +1,5 @@ error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `...` - --> $DIR/issue-32446.rs:16:11 + --> $DIR/issue-32446.rs:4:11 | LL | trait T { ... } //~ ERROR | ^^^ expected one of 7 possible tokens here diff --git a/src/test/ui/parser/issue-32501.rs b/src/test/ui/parser/issue-32501.rs index 21db2f50517..9c01a5c6d20 100644 --- a/src/test/ui/parser/issue-32501.rs +++ b/src/test/ui/parser/issue-32501.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let a = 0; let _b = 0; diff --git a/src/test/ui/parser/issue-32501.stderr b/src/test/ui/parser/issue-32501.stderr index 6836509ebba..d74c539abfe 100644 --- a/src/test/ui/parser/issue-32501.stderr +++ b/src/test/ui/parser/issue-32501.stderr @@ -1,5 +1,5 @@ error: expected identifier, found reserved identifier `_` - --> $DIR/issue-32501.rs:19:13 + --> $DIR/issue-32501.rs:7:13 | LL | let mut _ = 0; //~ ERROR expected identifier, found reserved identifier `_` | ^ expected identifier, found reserved identifier diff --git a/src/test/ui/parser/issue-32505.rs b/src/test/ui/parser/issue-32505.rs index 246941ff259..49e7a2f536f 100644 --- a/src/test/ui/parser/issue-32505.rs +++ b/src/test/ui/parser/issue-32505.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error pub fn test() { foo(|_|) //~ ERROR expected expression, found `)` diff --git a/src/test/ui/parser/issue-32505.stderr b/src/test/ui/parser/issue-32505.stderr index e89c907a3b7..1ea4c36a525 100644 --- a/src/test/ui/parser/issue-32505.stderr +++ b/src/test/ui/parser/issue-32505.stderr @@ -1,5 +1,5 @@ error: expected expression, found `)` - --> $DIR/issue-32505.rs:14:12 + --> $DIR/issue-32505.rs:4:12 | LL | foo(|_|) //~ ERROR expected expression, found `)` | ^ expected expression diff --git a/src/test/ui/parser/issue-33262.rs b/src/test/ui/parser/issue-33262.rs index d6bbfdc59f5..3a612f95c03 100644 --- a/src/test/ui/parser/issue-33262.rs +++ b/src/test/ui/parser/issue-33262.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Issue #33262 pub fn main() { diff --git a/src/test/ui/parser/issue-33262.stderr b/src/test/ui/parser/issue-33262.stderr index 184dacdaca4..c2491df903b 100644 --- a/src/test/ui/parser/issue-33262.stderr +++ b/src/test/ui/parser/issue-33262.stderr @@ -1,5 +1,5 @@ error: expected type, found `{` - --> $DIR/issue-33262.rs:16:22 + --> $DIR/issue-33262.rs:4:22 | LL | for i in 0..a as { } | ^ diff --git a/src/test/ui/parser/issue-33413.rs b/src/test/ui/parser/issue-33413.rs index 7c3b84a5185..2ec86958174 100644 --- a/src/test/ui/parser/issue-33413.rs +++ b/src/test/ui/parser/issue-33413.rs @@ -1,16 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only +struct S; impl S { fn f(*, a: u8) -> u8 {} //~^ ERROR expected argument name, found `*` } + +fn main() {} diff --git a/src/test/ui/parser/issue-33413.stderr b/src/test/ui/parser/issue-33413.stderr index e0d69e596f2..f6f096b1b9a 100644 --- a/src/test/ui/parser/issue-33413.stderr +++ b/src/test/ui/parser/issue-33413.stderr @@ -1,5 +1,5 @@ error: expected argument name, found `*` - --> $DIR/issue-33413.rs:14:10 + --> $DIR/issue-33413.rs:4:10 | LL | fn f(*, a: u8) -> u8 {} | ^ expected argument name diff --git a/src/test/ui/parser/issue-33455.rs b/src/test/ui/parser/issue-33455.rs index 6a9d03cdd91..6dff63f5cf4 100644 --- a/src/test/ui/parser/issue-33455.rs +++ b/src/test/ui/parser/issue-33455.rs @@ -1,13 +1 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - use foo.bar; //~ ERROR expected one of `::`, `;`, or `as`, found `.` diff --git a/src/test/ui/parser/issue-33455.stderr b/src/test/ui/parser/issue-33455.stderr index cc9bb2d7c93..38d00a0ea0b 100644 --- a/src/test/ui/parser/issue-33455.stderr +++ b/src/test/ui/parser/issue-33455.stderr @@ -1,5 +1,5 @@ error: expected one of `::`, `;`, or `as`, found `.` - --> $DIR/issue-33455.rs:13:8 + --> $DIR/issue-33455.rs:1:8 | LL | use foo.bar; //~ ERROR expected one of `::`, `;`, or `as`, found `.` | ^ expected one of `::`, `;`, or `as` here diff --git a/src/test/ui/parser/issue-41155.rs b/src/test/ui/parser/issue-41155.rs index 3d234dc378a..3c24d2b447d 100644 --- a/src/test/ui/parser/issue-41155.rs +++ b/src/test/ui/parser/issue-41155.rs @@ -1,14 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only +struct S; impl S { pub diff --git a/src/test/ui/parser/issue-41155.stderr b/src/test/ui/parser/issue-41155.stderr index 34b78fca3bd..ac75829f2e3 100644 --- a/src/test/ui/parser/issue-41155.stderr +++ b/src/test/ui/parser/issue-41155.stderr @@ -1,5 +1,5 @@ error: expected one of `(`, `async`, `const`, `default`, `existential`, `extern`, `fn`, `type`, or `unsafe`, found `}` - --> $DIR/issue-41155.rs:15:1 + --> $DIR/issue-41155.rs:5:1 | LL | pub | - expected one of 9 possible tokens here diff --git a/src/test/ui/parser/issue-43692.rs b/src/test/ui/parser/issue-43692.rs index eb5d050e102..baf8bafb8b7 100644 --- a/src/test/ui/parser/issue-43692.rs +++ b/src/test/ui/parser/issue-43692.rs @@ -1,15 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { '\u{_10FFFF}'; //~ ERROR invalid start of unicode escape } diff --git a/src/test/ui/parser/issue-43692.stderr b/src/test/ui/parser/issue-43692.stderr index c5ea50be487..780f63a6638 100644 --- a/src/test/ui/parser/issue-43692.stderr +++ b/src/test/ui/parser/issue-43692.stderr @@ -1,5 +1,5 @@ error: invalid start of unicode escape - --> $DIR/issue-43692.rs:14:9 + --> $DIR/issue-43692.rs:2:9 | LL | '/u{_10FFFF}'; //~ ERROR invalid start of unicode escape | ^ diff --git a/src/test/ui/parser/issue-5544-a.rs b/src/test/ui/parser/issue-5544-a.rs index cf1500e34d8..303b902c499 100644 --- a/src/test/ui/parser/issue-5544-a.rs +++ b/src/test/ui/parser/issue-5544-a.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let __isize = 340282366920938463463374607431768211456; // 2^128 //~^ ERROR int literal is too large diff --git a/src/test/ui/parser/issue-5544-a.stderr b/src/test/ui/parser/issue-5544-a.stderr index 7fd3bc9d6ea..bc48853b380 100644 --- a/src/test/ui/parser/issue-5544-a.stderr +++ b/src/test/ui/parser/issue-5544-a.stderr @@ -1,5 +1,5 @@ error: int literal is too large - --> $DIR/issue-5544-a.rs:14:19 + --> $DIR/issue-5544-a.rs:2:19 | LL | let __isize = 340282366920938463463374607431768211456; // 2^128 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/parser/issue-5544-b.rs b/src/test/ui/parser/issue-5544-b.rs index 8c0b6741cb8..fa40f15dedb 100644 --- a/src/test/ui/parser/issue-5544-b.rs +++ b/src/test/ui/parser/issue-5544-b.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let __isize = 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ff; //~^ ERROR int literal is too large diff --git a/src/test/ui/parser/issue-5544-b.stderr b/src/test/ui/parser/issue-5544-b.stderr index 338b39b85b1..3f15c0c0d75 100644 --- a/src/test/ui/parser/issue-5544-b.stderr +++ b/src/test/ui/parser/issue-5544-b.stderr @@ -1,5 +1,5 @@ error: int literal is too large - --> $DIR/issue-5544-b.rs:14:19 + --> $DIR/issue-5544-b.rs:2:19 | LL | let __isize = 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff_ff; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/parser/issue-5806.rs b/src/test/ui/parser/issue-5806.rs index 3622d59a514..b694642a9c5 100644 --- a/src/test/ui/parser/issue-5806.rs +++ b/src/test/ui/parser/issue-5806.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only // normalize-stderr-test: "parser:.*\(" -> "parser: $$ACCESS_DENIED_MSG (" // normalize-stderr-test: "os error \d+" -> "os error $$ACCESS_DENIED_CODE" diff --git a/src/test/ui/parser/issue-5806.stderr b/src/test/ui/parser/issue-5806.stderr index 63beed2873f..f9f00f70f0b 100644 --- a/src/test/ui/parser/issue-5806.stderr +++ b/src/test/ui/parser/issue-5806.stderr @@ -1,5 +1,5 @@ error: couldn't read $DIR/../parser: $ACCESS_DENIED_MSG (os error $ACCESS_DENIED_CODE) - --> $DIR/issue-5806.rs:16:5 + --> $DIR/issue-5806.rs:5:5 | LL | mod foo; //~ ERROR couldn't read | ^^^ diff --git a/src/test/ui/parser/issue-6610.rs b/src/test/ui/parser/issue-6610.rs index f5113efad1c..2dfa08fe82d 100644 --- a/src/test/ui/parser/issue-6610.rs +++ b/src/test/ui/parser/issue-6610.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - trait Foo { fn a() } //~ ERROR expected `;` or `{`, found `}` fn main() {} diff --git a/src/test/ui/parser/issue-6610.stderr b/src/test/ui/parser/issue-6610.stderr index d6013b32c96..b4760161a62 100644 --- a/src/test/ui/parser/issue-6610.stderr +++ b/src/test/ui/parser/issue-6610.stderr @@ -1,5 +1,5 @@ error: expected `;` or `{`, found `}` - --> $DIR/issue-6610.rs:13:20 + --> $DIR/issue-6610.rs:1:20 | LL | trait Foo { fn a() } //~ ERROR expected `;` or `{`, found `}` | ^ expected `;` or `{` diff --git a/src/test/ui/parser/issue-8537.rs b/src/test/ui/parser/issue-8537.rs index e152a369290..9d0cbce6c8a 100644 --- a/src/test/ui/parser/issue-8537.rs +++ b/src/test/ui/parser/issue-8537.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - pub extern "invalid-ab_isize" //~ ERROR invalid ABI fn foo() {} diff --git a/src/test/ui/parser/issue-8537.stderr b/src/test/ui/parser/issue-8537.stderr index 0013f972220..4442cd0ff01 100644 --- a/src/test/ui/parser/issue-8537.stderr +++ b/src/test/ui/parser/issue-8537.stderr @@ -1,5 +1,5 @@ error[E0703]: invalid ABI: found `invalid-ab_isize` - --> $DIR/issue-8537.rs:14:3 + --> $DIR/issue-8537.rs:2:3 | LL | "invalid-ab_isize" //~ ERROR invalid ABI | ^^^^^^^^^^^^^^^^^^ invalid ABI diff --git a/src/test/ui/parser/keyword-abstract.rs b/src/test/ui/parser/keyword-abstract.rs index 2db5a5c583a..890802ac134 100644 --- a/src/test/ui/parser/keyword-abstract.rs +++ b/src/test/ui/parser/keyword-abstract.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let abstract = (); //~ ERROR expected pattern, found reserved keyword `abstract` } diff --git a/src/test/ui/parser/keyword-abstract.stderr b/src/test/ui/parser/keyword-abstract.stderr index 1d3ed0d9b3e..4185ae034b5 100644 --- a/src/test/ui/parser/keyword-abstract.stderr +++ b/src/test/ui/parser/keyword-abstract.stderr @@ -1,5 +1,5 @@ error: expected pattern, found reserved keyword `abstract` - --> $DIR/keyword-abstract.rs:14:9 + --> $DIR/keyword-abstract.rs:2:9 | LL | let abstract = (); //~ ERROR expected pattern, found reserved keyword `abstract` | ^^^^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-as-as-identifier.rs b/src/test/ui/parser/keyword-as-as-identifier.rs index c6070c456e8..23ff259db30 100644 --- a/src/test/ui/parser/keyword-as-as-identifier.rs +++ b/src/test/ui/parser/keyword-as-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py as' fn main() { diff --git a/src/test/ui/parser/keyword-as-as-identifier.stderr b/src/test/ui/parser/keyword-as-as-identifier.stderr index a6295c2fca1..6eaf5e2ed93 100644 --- a/src/test/ui/parser/keyword-as-as-identifier.stderr +++ b/src/test/ui/parser/keyword-as-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `as` - --> $DIR/keyword-as-as-identifier.rs:16:9 + --> $DIR/keyword-as-as-identifier.rs:4:9 | LL | let as = "foo"; //~ error: expected pattern, found keyword `as` | ^^ expected pattern diff --git a/src/test/ui/parser/keyword-box-as-identifier.rs b/src/test/ui/parser/keyword-box-as-identifier.rs index b5abe14dbe8..33961bb3084 100644 --- a/src/test/ui/parser/keyword-box-as-identifier.rs +++ b/src/test/ui/parser/keyword-box-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let box = "foo"; //~ error: expected pattern, found `=` } diff --git a/src/test/ui/parser/keyword-box-as-identifier.stderr b/src/test/ui/parser/keyword-box-as-identifier.stderr index 4e9984c2871..07a134442b8 100644 --- a/src/test/ui/parser/keyword-box-as-identifier.stderr +++ b/src/test/ui/parser/keyword-box-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found `=` - --> $DIR/keyword-box-as-identifier.rs:14:13 + --> $DIR/keyword-box-as-identifier.rs:2:13 | LL | let box = "foo"; //~ error: expected pattern, found `=` | ^ expected pattern diff --git a/src/test/ui/parser/keyword-break-as-identifier.rs b/src/test/ui/parser/keyword-break-as-identifier.rs index 65c775fa1b6..5ee111d38c9 100644 --- a/src/test/ui/parser/keyword-break-as-identifier.rs +++ b/src/test/ui/parser/keyword-break-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py break' fn main() { diff --git a/src/test/ui/parser/keyword-break-as-identifier.stderr b/src/test/ui/parser/keyword-break-as-identifier.stderr index 9e2d2c9caac..69af9737445 100644 --- a/src/test/ui/parser/keyword-break-as-identifier.stderr +++ b/src/test/ui/parser/keyword-break-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `break` - --> $DIR/keyword-break-as-identifier.rs:16:9 + --> $DIR/keyword-break-as-identifier.rs:4:9 | LL | let break = "foo"; //~ error: expected pattern, found keyword `break` | ^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-const-as-identifier.rs b/src/test/ui/parser/keyword-const-as-identifier.rs index 6ecf14957e3..48fc142cf64 100644 --- a/src/test/ui/parser/keyword-const-as-identifier.rs +++ b/src/test/ui/parser/keyword-const-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py const' fn main() { diff --git a/src/test/ui/parser/keyword-const-as-identifier.stderr b/src/test/ui/parser/keyword-const-as-identifier.stderr index d662fefda70..c727f1754c7 100644 --- a/src/test/ui/parser/keyword-const-as-identifier.stderr +++ b/src/test/ui/parser/keyword-const-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `const` - --> $DIR/keyword-const-as-identifier.rs:16:9 + --> $DIR/keyword-const-as-identifier.rs:4:9 | LL | let const = "foo"; //~ error: expected pattern, found keyword `const` | ^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-continue-as-identifier.rs b/src/test/ui/parser/keyword-continue-as-identifier.rs index 87377ac8364..06315a48349 100644 --- a/src/test/ui/parser/keyword-continue-as-identifier.rs +++ b/src/test/ui/parser/keyword-continue-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py continue' fn main() { diff --git a/src/test/ui/parser/keyword-continue-as-identifier.stderr b/src/test/ui/parser/keyword-continue-as-identifier.stderr index 52409c1f6bb..7fd2761884f 100644 --- a/src/test/ui/parser/keyword-continue-as-identifier.stderr +++ b/src/test/ui/parser/keyword-continue-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `continue` - --> $DIR/keyword-continue-as-identifier.rs:16:9 + --> $DIR/keyword-continue-as-identifier.rs:4:9 | LL | let continue = "foo"; //~ error: expected pattern, found keyword `continue` | ^^^^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-else-as-identifier.rs b/src/test/ui/parser/keyword-else-as-identifier.rs index 6878f7fea03..0c69105cf94 100644 --- a/src/test/ui/parser/keyword-else-as-identifier.rs +++ b/src/test/ui/parser/keyword-else-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py else' fn main() { diff --git a/src/test/ui/parser/keyword-else-as-identifier.stderr b/src/test/ui/parser/keyword-else-as-identifier.stderr index ab075a52141..6d180bb56da 100644 --- a/src/test/ui/parser/keyword-else-as-identifier.stderr +++ b/src/test/ui/parser/keyword-else-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `else` - --> $DIR/keyword-else-as-identifier.rs:16:9 + --> $DIR/keyword-else-as-identifier.rs:4:9 | LL | let else = "foo"; //~ error: expected pattern, found keyword `else` | ^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-enum-as-identifier.rs b/src/test/ui/parser/keyword-enum-as-identifier.rs index 042a02d79e0..d1675800a27 100644 --- a/src/test/ui/parser/keyword-enum-as-identifier.rs +++ b/src/test/ui/parser/keyword-enum-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py enum' fn main() { diff --git a/src/test/ui/parser/keyword-enum-as-identifier.stderr b/src/test/ui/parser/keyword-enum-as-identifier.stderr index f8370134741..dc7e37824dc 100644 --- a/src/test/ui/parser/keyword-enum-as-identifier.stderr +++ b/src/test/ui/parser/keyword-enum-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `enum` - --> $DIR/keyword-enum-as-identifier.rs:16:9 + --> $DIR/keyword-enum-as-identifier.rs:4:9 | LL | let enum = "foo"; //~ error: expected pattern, found keyword `enum` | ^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-final.rs b/src/test/ui/parser/keyword-final.rs index be29a739443..e1cecd0e8e0 100644 --- a/src/test/ui/parser/keyword-final.rs +++ b/src/test/ui/parser/keyword-final.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let final = (); //~ ERROR expected pattern, found reserved keyword `final` } diff --git a/src/test/ui/parser/keyword-final.stderr b/src/test/ui/parser/keyword-final.stderr index 8ace453f362..897624279e5 100644 --- a/src/test/ui/parser/keyword-final.stderr +++ b/src/test/ui/parser/keyword-final.stderr @@ -1,5 +1,5 @@ error: expected pattern, found reserved keyword `final` - --> $DIR/keyword-final.rs:14:9 + --> $DIR/keyword-final.rs:2:9 | LL | let final = (); //~ ERROR expected pattern, found reserved keyword `final` | ^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-fn-as-identifier.rs b/src/test/ui/parser/keyword-fn-as-identifier.rs index 0d454f67d1c..bca2d5996a5 100644 --- a/src/test/ui/parser/keyword-fn-as-identifier.rs +++ b/src/test/ui/parser/keyword-fn-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py fn' fn main() { diff --git a/src/test/ui/parser/keyword-fn-as-identifier.stderr b/src/test/ui/parser/keyword-fn-as-identifier.stderr index bf63775fc9b..945fc77c310 100644 --- a/src/test/ui/parser/keyword-fn-as-identifier.stderr +++ b/src/test/ui/parser/keyword-fn-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `fn` - --> $DIR/keyword-fn-as-identifier.rs:16:9 + --> $DIR/keyword-fn-as-identifier.rs:4:9 | LL | let fn = "foo"; //~ error: expected pattern, found keyword `fn` | ^^ expected pattern diff --git a/src/test/ui/parser/keyword-for-as-identifier.rs b/src/test/ui/parser/keyword-for-as-identifier.rs index d341669f727..ce49fd90d91 100644 --- a/src/test/ui/parser/keyword-for-as-identifier.rs +++ b/src/test/ui/parser/keyword-for-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py for' fn main() { diff --git a/src/test/ui/parser/keyword-for-as-identifier.stderr b/src/test/ui/parser/keyword-for-as-identifier.stderr index ed28f77a252..32263e9f6e2 100644 --- a/src/test/ui/parser/keyword-for-as-identifier.stderr +++ b/src/test/ui/parser/keyword-for-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `for` - --> $DIR/keyword-for-as-identifier.rs:16:9 + --> $DIR/keyword-for-as-identifier.rs:4:9 | LL | let for = "foo"; //~ error: expected pattern, found keyword `for` | ^^^ expected pattern diff --git a/src/test/ui/parser/keyword-if-as-identifier.rs b/src/test/ui/parser/keyword-if-as-identifier.rs index 417e40425e0..a1302970689 100644 --- a/src/test/ui/parser/keyword-if-as-identifier.rs +++ b/src/test/ui/parser/keyword-if-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py if' fn main() { diff --git a/src/test/ui/parser/keyword-if-as-identifier.stderr b/src/test/ui/parser/keyword-if-as-identifier.stderr index bfb7ab78bcf..11ba41015cb 100644 --- a/src/test/ui/parser/keyword-if-as-identifier.stderr +++ b/src/test/ui/parser/keyword-if-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `if` - --> $DIR/keyword-if-as-identifier.rs:16:9 + --> $DIR/keyword-if-as-identifier.rs:4:9 | LL | let if = "foo"; //~ error: expected pattern, found keyword `if` | ^^ expected pattern diff --git a/src/test/ui/parser/keyword-impl-as-identifier.rs b/src/test/ui/parser/keyword-impl-as-identifier.rs index fe97c191f68..95a34483ad2 100644 --- a/src/test/ui/parser/keyword-impl-as-identifier.rs +++ b/src/test/ui/parser/keyword-impl-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py impl' fn main() { diff --git a/src/test/ui/parser/keyword-impl-as-identifier.stderr b/src/test/ui/parser/keyword-impl-as-identifier.stderr index 43f7072981e..960a42df429 100644 --- a/src/test/ui/parser/keyword-impl-as-identifier.stderr +++ b/src/test/ui/parser/keyword-impl-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `impl` - --> $DIR/keyword-impl-as-identifier.rs:16:9 + --> $DIR/keyword-impl-as-identifier.rs:4:9 | LL | let impl = "foo"; //~ error: expected pattern, found keyword `impl` | ^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-in-as-identifier.rs b/src/test/ui/parser/keyword-in-as-identifier.rs index c0f9396b981..e4499dea255 100644 --- a/src/test/ui/parser/keyword-in-as-identifier.rs +++ b/src/test/ui/parser/keyword-in-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py in' fn main() { diff --git a/src/test/ui/parser/keyword-in-as-identifier.stderr b/src/test/ui/parser/keyword-in-as-identifier.stderr index 29bb5f4b724..2300a257a02 100644 --- a/src/test/ui/parser/keyword-in-as-identifier.stderr +++ b/src/test/ui/parser/keyword-in-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `in` - --> $DIR/keyword-in-as-identifier.rs:16:9 + --> $DIR/keyword-in-as-identifier.rs:4:9 | LL | let in = "foo"; //~ error: expected pattern, found keyword `in` | ^^ expected pattern diff --git a/src/test/ui/parser/keyword-let-as-identifier.rs b/src/test/ui/parser/keyword-let-as-identifier.rs index 5d6dca78d78..07c0ddf8ce5 100644 --- a/src/test/ui/parser/keyword-let-as-identifier.rs +++ b/src/test/ui/parser/keyword-let-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py let' fn main() { diff --git a/src/test/ui/parser/keyword-let-as-identifier.stderr b/src/test/ui/parser/keyword-let-as-identifier.stderr index 7a28aee4657..ed2c8a4eb9c 100644 --- a/src/test/ui/parser/keyword-let-as-identifier.stderr +++ b/src/test/ui/parser/keyword-let-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `let` - --> $DIR/keyword-let-as-identifier.rs:16:9 + --> $DIR/keyword-let-as-identifier.rs:4:9 | LL | let let = "foo"; //~ error: expected pattern, found keyword `let` | ^^^ expected pattern diff --git a/src/test/ui/parser/keyword-loop-as-identifier.rs b/src/test/ui/parser/keyword-loop-as-identifier.rs index 7c3d11d67f6..8643ffe4345 100644 --- a/src/test/ui/parser/keyword-loop-as-identifier.rs +++ b/src/test/ui/parser/keyword-loop-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py loop' fn main() { diff --git a/src/test/ui/parser/keyword-loop-as-identifier.stderr b/src/test/ui/parser/keyword-loop-as-identifier.stderr index 1dafe466d79..f91cab02953 100644 --- a/src/test/ui/parser/keyword-loop-as-identifier.stderr +++ b/src/test/ui/parser/keyword-loop-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `loop` - --> $DIR/keyword-loop-as-identifier.rs:16:9 + --> $DIR/keyword-loop-as-identifier.rs:4:9 | LL | let loop = "foo"; //~ error: expected pattern, found keyword `loop` | ^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-match-as-identifier.rs b/src/test/ui/parser/keyword-match-as-identifier.rs index 7c727f44da7..8ef6b6810a5 100644 --- a/src/test/ui/parser/keyword-match-as-identifier.rs +++ b/src/test/ui/parser/keyword-match-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py match' fn main() { diff --git a/src/test/ui/parser/keyword-match-as-identifier.stderr b/src/test/ui/parser/keyword-match-as-identifier.stderr index b3b542f1a1d..4c8e76695bc 100644 --- a/src/test/ui/parser/keyword-match-as-identifier.stderr +++ b/src/test/ui/parser/keyword-match-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `match` - --> $DIR/keyword-match-as-identifier.rs:16:9 + --> $DIR/keyword-match-as-identifier.rs:4:9 | LL | let match = "foo"; //~ error: expected pattern, found keyword `match` | ^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-mod-as-identifier.rs b/src/test/ui/parser/keyword-mod-as-identifier.rs index 85b4cc2e02c..96bcdccf0a0 100644 --- a/src/test/ui/parser/keyword-mod-as-identifier.rs +++ b/src/test/ui/parser/keyword-mod-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py mod' fn main() { diff --git a/src/test/ui/parser/keyword-mod-as-identifier.stderr b/src/test/ui/parser/keyword-mod-as-identifier.stderr index 113f7084b31..8aeebcebec9 100644 --- a/src/test/ui/parser/keyword-mod-as-identifier.stderr +++ b/src/test/ui/parser/keyword-mod-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `mod` - --> $DIR/keyword-mod-as-identifier.rs:16:9 + --> $DIR/keyword-mod-as-identifier.rs:4:9 | LL | let mod = "foo"; //~ error: expected pattern, found keyword `mod` | ^^^ expected pattern diff --git a/src/test/ui/parser/keyword-move-as-identifier.rs b/src/test/ui/parser/keyword-move-as-identifier.rs index b785ac0058c..2193af530bd 100644 --- a/src/test/ui/parser/keyword-move-as-identifier.rs +++ b/src/test/ui/parser/keyword-move-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py move' fn main() { diff --git a/src/test/ui/parser/keyword-move-as-identifier.stderr b/src/test/ui/parser/keyword-move-as-identifier.stderr index 21b66fbc1e1..37e06708e25 100644 --- a/src/test/ui/parser/keyword-move-as-identifier.stderr +++ b/src/test/ui/parser/keyword-move-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `move` - --> $DIR/keyword-move-as-identifier.rs:16:9 + --> $DIR/keyword-move-as-identifier.rs:4:9 | LL | let move = "foo"; //~ error: expected pattern, found keyword `move` | ^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-mut-as-identifier.rs b/src/test/ui/parser/keyword-mut-as-identifier.rs index 0aeca9b34ab..9b919d2b383 100644 --- a/src/test/ui/parser/keyword-mut-as-identifier.rs +++ b/src/test/ui/parser/keyword-mut-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let mut = "foo"; //~ error: expected identifier, found `=` } diff --git a/src/test/ui/parser/keyword-mut-as-identifier.stderr b/src/test/ui/parser/keyword-mut-as-identifier.stderr index bb153cf0e6c..b0266060903 100644 --- a/src/test/ui/parser/keyword-mut-as-identifier.stderr +++ b/src/test/ui/parser/keyword-mut-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected identifier, found `=` - --> $DIR/keyword-mut-as-identifier.rs:14:13 + --> $DIR/keyword-mut-as-identifier.rs:2:13 | LL | let mut = "foo"; //~ error: expected identifier, found `=` | ^ expected identifier diff --git a/src/test/ui/parser/keyword-override.rs b/src/test/ui/parser/keyword-override.rs index 60333762b33..948a20095f1 100644 --- a/src/test/ui/parser/keyword-override.rs +++ b/src/test/ui/parser/keyword-override.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let override = (); //~ ERROR expected pattern, found reserved keyword `override` } diff --git a/src/test/ui/parser/keyword-override.stderr b/src/test/ui/parser/keyword-override.stderr index ce1d4f27716..69a6415908c 100644 --- a/src/test/ui/parser/keyword-override.stderr +++ b/src/test/ui/parser/keyword-override.stderr @@ -1,5 +1,5 @@ error: expected pattern, found reserved keyword `override` - --> $DIR/keyword-override.rs:14:9 + --> $DIR/keyword-override.rs:2:9 | LL | let override = (); //~ ERROR expected pattern, found reserved keyword `override` | ^^^^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-pub-as-identifier.rs b/src/test/ui/parser/keyword-pub-as-identifier.rs index 92337286970..2ed8cc6b268 100644 --- a/src/test/ui/parser/keyword-pub-as-identifier.rs +++ b/src/test/ui/parser/keyword-pub-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py pub' fn main() { diff --git a/src/test/ui/parser/keyword-pub-as-identifier.stderr b/src/test/ui/parser/keyword-pub-as-identifier.stderr index b52982d144d..8b595673ec4 100644 --- a/src/test/ui/parser/keyword-pub-as-identifier.stderr +++ b/src/test/ui/parser/keyword-pub-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `pub` - --> $DIR/keyword-pub-as-identifier.rs:16:9 + --> $DIR/keyword-pub-as-identifier.rs:4:9 | LL | let pub = "foo"; //~ error: expected pattern, found keyword `pub` | ^^^ expected pattern diff --git a/src/test/ui/parser/keyword-ref-as-identifier.rs b/src/test/ui/parser/keyword-ref-as-identifier.rs index a689c4eeea4..f5e04b5db73 100644 --- a/src/test/ui/parser/keyword-ref-as-identifier.rs +++ b/src/test/ui/parser/keyword-ref-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let ref = "foo"; //~ error: expected identifier, found `=` } diff --git a/src/test/ui/parser/keyword-ref-as-identifier.stderr b/src/test/ui/parser/keyword-ref-as-identifier.stderr index 34063c88d33..656df196f09 100644 --- a/src/test/ui/parser/keyword-ref-as-identifier.stderr +++ b/src/test/ui/parser/keyword-ref-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected identifier, found `=` - --> $DIR/keyword-ref-as-identifier.rs:14:13 + --> $DIR/keyword-ref-as-identifier.rs:2:13 | LL | let ref = "foo"; //~ error: expected identifier, found `=` | ^ expected identifier diff --git a/src/test/ui/parser/keyword-return-as-identifier.rs b/src/test/ui/parser/keyword-return-as-identifier.rs index bcf7f137543..920931b00f9 100644 --- a/src/test/ui/parser/keyword-return-as-identifier.rs +++ b/src/test/ui/parser/keyword-return-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py return' fn main() { diff --git a/src/test/ui/parser/keyword-return-as-identifier.stderr b/src/test/ui/parser/keyword-return-as-identifier.stderr index 8d8b2aabbdc..903137542d6 100644 --- a/src/test/ui/parser/keyword-return-as-identifier.stderr +++ b/src/test/ui/parser/keyword-return-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `return` - --> $DIR/keyword-return-as-identifier.rs:16:9 + --> $DIR/keyword-return-as-identifier.rs:4:9 | LL | let return = "foo"; //~ error: expected pattern, found keyword `return` | ^^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-static-as-identifier.rs b/src/test/ui/parser/keyword-static-as-identifier.rs index 793262266a3..3ccbfccfc93 100644 --- a/src/test/ui/parser/keyword-static-as-identifier.rs +++ b/src/test/ui/parser/keyword-static-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py static' fn main() { diff --git a/src/test/ui/parser/keyword-static-as-identifier.stderr b/src/test/ui/parser/keyword-static-as-identifier.stderr index 4c1a0d1a0b0..4830e6f1bef 100644 --- a/src/test/ui/parser/keyword-static-as-identifier.stderr +++ b/src/test/ui/parser/keyword-static-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `static` - --> $DIR/keyword-static-as-identifier.rs:16:9 + --> $DIR/keyword-static-as-identifier.rs:4:9 | LL | let static = "foo"; //~ error: expected pattern, found keyword `static` | ^^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-struct-as-identifier.rs b/src/test/ui/parser/keyword-struct-as-identifier.rs index 591bd25db65..69d8f190655 100644 --- a/src/test/ui/parser/keyword-struct-as-identifier.rs +++ b/src/test/ui/parser/keyword-struct-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py struct' fn main() { diff --git a/src/test/ui/parser/keyword-struct-as-identifier.stderr b/src/test/ui/parser/keyword-struct-as-identifier.stderr index 76179ce7ea7..50ac690e425 100644 --- a/src/test/ui/parser/keyword-struct-as-identifier.stderr +++ b/src/test/ui/parser/keyword-struct-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `struct` - --> $DIR/keyword-struct-as-identifier.rs:16:9 + --> $DIR/keyword-struct-as-identifier.rs:4:9 | LL | let struct = "foo"; //~ error: expected pattern, found keyword `struct` | ^^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-trait-as-identifier.rs b/src/test/ui/parser/keyword-trait-as-identifier.rs index bdb5d264b03..f62858442d2 100644 --- a/src/test/ui/parser/keyword-trait-as-identifier.rs +++ b/src/test/ui/parser/keyword-trait-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py trait' fn main() { diff --git a/src/test/ui/parser/keyword-trait-as-identifier.stderr b/src/test/ui/parser/keyword-trait-as-identifier.stderr index 084b785f867..3736f366cbd 100644 --- a/src/test/ui/parser/keyword-trait-as-identifier.stderr +++ b/src/test/ui/parser/keyword-trait-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `trait` - --> $DIR/keyword-trait-as-identifier.rs:16:9 + --> $DIR/keyword-trait-as-identifier.rs:4:9 | LL | let trait = "foo"; //~ error: expected pattern, found keyword `trait` | ^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-try-as-identifier-edition2018.rs b/src/test/ui/parser/keyword-try-as-identifier-edition2018.rs index 1e4f85c122d..13a938b2e09 100644 --- a/src/test/ui/parser/keyword-try-as-identifier-edition2018.rs +++ b/src/test/ui/parser/keyword-try-as-identifier-edition2018.rs @@ -1,14 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only --edition 2018 +// compile-flags: --edition 2018 fn main() { let try = "foo"; //~ error: expected pattern, found reserved keyword `try` diff --git a/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr b/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr index 9306f95d855..73e8d64b56c 100644 --- a/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr +++ b/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr @@ -1,5 +1,5 @@ error: expected pattern, found reserved keyword `try` - --> $DIR/keyword-try-as-identifier-edition2018.rs:14:9 + --> $DIR/keyword-try-as-identifier-edition2018.rs:4:9 | LL | let try = "foo"; //~ error: expected pattern, found reserved keyword `try` | ^^^ expected pattern diff --git a/src/test/ui/parser/keyword-type-as-identifier.rs b/src/test/ui/parser/keyword-type-as-identifier.rs index 2ba99d098de..992547e6f59 100644 --- a/src/test/ui/parser/keyword-type-as-identifier.rs +++ b/src/test/ui/parser/keyword-type-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py type' fn main() { diff --git a/src/test/ui/parser/keyword-type-as-identifier.stderr b/src/test/ui/parser/keyword-type-as-identifier.stderr index 03e0bd7dfa9..f7db20034a1 100644 --- a/src/test/ui/parser/keyword-type-as-identifier.stderr +++ b/src/test/ui/parser/keyword-type-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `type` - --> $DIR/keyword-type-as-identifier.rs:16:9 + --> $DIR/keyword-type-as-identifier.rs:4:9 | LL | let type = "foo"; //~ error: expected pattern, found keyword `type` | ^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-typeof.rs b/src/test/ui/parser/keyword-typeof.rs index 40e26bd375a..4ef102646ef 100644 --- a/src/test/ui/parser/keyword-typeof.rs +++ b/src/test/ui/parser/keyword-typeof.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let typeof = (); //~ ERROR expected pattern, found reserved keyword `typeof` } diff --git a/src/test/ui/parser/keyword-typeof.stderr b/src/test/ui/parser/keyword-typeof.stderr index 1c0cd0cca0d..07c9f883b60 100644 --- a/src/test/ui/parser/keyword-typeof.stderr +++ b/src/test/ui/parser/keyword-typeof.stderr @@ -1,5 +1,5 @@ error: expected pattern, found reserved keyword `typeof` - --> $DIR/keyword-typeof.rs:14:9 + --> $DIR/keyword-typeof.rs:2:9 | LL | let typeof = (); //~ ERROR expected pattern, found reserved keyword `typeof` | ^^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-unsafe-as-identifier.rs b/src/test/ui/parser/keyword-unsafe-as-identifier.rs index a72723e566d..adb20ebe48c 100644 --- a/src/test/ui/parser/keyword-unsafe-as-identifier.rs +++ b/src/test/ui/parser/keyword-unsafe-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py unsafe' fn main() { diff --git a/src/test/ui/parser/keyword-unsafe-as-identifier.stderr b/src/test/ui/parser/keyword-unsafe-as-identifier.stderr index 360bd21fa5f..ddd5e4d7b11 100644 --- a/src/test/ui/parser/keyword-unsafe-as-identifier.stderr +++ b/src/test/ui/parser/keyword-unsafe-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `unsafe` - --> $DIR/keyword-unsafe-as-identifier.rs:16:9 + --> $DIR/keyword-unsafe-as-identifier.rs:4:9 | LL | let unsafe = "foo"; //~ error: expected pattern, found keyword `unsafe` | ^^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-use-as-identifier.rs b/src/test/ui/parser/keyword-use-as-identifier.rs index de74907ff20..198444bafc5 100644 --- a/src/test/ui/parser/keyword-use-as-identifier.rs +++ b/src/test/ui/parser/keyword-use-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py use' fn main() { diff --git a/src/test/ui/parser/keyword-use-as-identifier.stderr b/src/test/ui/parser/keyword-use-as-identifier.stderr index bff29788107..7e798a3f0b9 100644 --- a/src/test/ui/parser/keyword-use-as-identifier.stderr +++ b/src/test/ui/parser/keyword-use-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `use` - --> $DIR/keyword-use-as-identifier.rs:16:9 + --> $DIR/keyword-use-as-identifier.rs:4:9 | LL | let use = "foo"; //~ error: expected pattern, found keyword `use` | ^^^ expected pattern diff --git a/src/test/ui/parser/keyword-where-as-identifier.rs b/src/test/ui/parser/keyword-where-as-identifier.rs index 4b7c8920b13..5624a8fc460 100644 --- a/src/test/ui/parser/keyword-where-as-identifier.rs +++ b/src/test/ui/parser/keyword-where-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py where' fn main() { diff --git a/src/test/ui/parser/keyword-where-as-identifier.stderr b/src/test/ui/parser/keyword-where-as-identifier.stderr index 38fe936befe..5285520cc20 100644 --- a/src/test/ui/parser/keyword-where-as-identifier.stderr +++ b/src/test/ui/parser/keyword-where-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `where` - --> $DIR/keyword-where-as-identifier.rs:16:9 + --> $DIR/keyword-where-as-identifier.rs:4:9 | LL | let where = "foo"; //~ error: expected pattern, found keyword `where` | ^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword-while-as-identifier.rs b/src/test/ui/parser/keyword-while-as-identifier.rs index 01793caa38a..c0a539d3507 100644 --- a/src/test/ui/parser/keyword-while-as-identifier.rs +++ b/src/test/ui/parser/keyword-while-as-identifier.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This file was auto-generated using 'src/etc/generate-keyword-tests.py while' fn main() { diff --git a/src/test/ui/parser/keyword-while-as-identifier.stderr b/src/test/ui/parser/keyword-while-as-identifier.stderr index c9dab8c5170..b84a652dc5c 100644 --- a/src/test/ui/parser/keyword-while-as-identifier.stderr +++ b/src/test/ui/parser/keyword-while-as-identifier.stderr @@ -1,5 +1,5 @@ error: expected pattern, found keyword `while` - --> $DIR/keyword-while-as-identifier.rs:16:9 + --> $DIR/keyword-while-as-identifier.rs:4:9 | LL | let while = "foo"; //~ error: expected pattern, found keyword `while` | ^^^^^ expected pattern diff --git a/src/test/ui/parser/keyword.rs b/src/test/ui/parser/keyword.rs index d4ce5518e46..1eb7886c5a5 100644 --- a/src/test/ui/parser/keyword.rs +++ b/src/test/ui/parser/keyword.rs @@ -1,15 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - pub mod break { //~^ ERROR expected identifier, found keyword `break` } + +fn main() {} diff --git a/src/test/ui/parser/keyword.stderr b/src/test/ui/parser/keyword.stderr index a3fc1677732..262467b6907 100644 --- a/src/test/ui/parser/keyword.stderr +++ b/src/test/ui/parser/keyword.stderr @@ -1,8 +1,12 @@ error: expected identifier, found keyword `break` - --> $DIR/keyword.rs:13:9 + --> $DIR/keyword.rs:1:9 | LL | pub mod break { | ^^^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | pub mod r#break { + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/keywords-followed-by-double-colon.rs b/src/test/ui/parser/keywords-followed-by-double-colon.rs index 7a5b48c5f00..5c7049f7c9b 100644 --- a/src/test/ui/parser/keywords-followed-by-double-colon.rs +++ b/src/test/ui/parser/keywords-followed-by-double-colon.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { struct::foo(); //~^ ERROR expected identifier diff --git a/src/test/ui/parser/keywords-followed-by-double-colon.stderr b/src/test/ui/parser/keywords-followed-by-double-colon.stderr index 049658571e8..4c4d5e5dd00 100644 --- a/src/test/ui/parser/keywords-followed-by-double-colon.stderr +++ b/src/test/ui/parser/keywords-followed-by-double-colon.stderr @@ -1,11 +1,11 @@ error: expected identifier, found `::` - --> $DIR/keywords-followed-by-double-colon.rs:14:11 + --> $DIR/keywords-followed-by-double-colon.rs:2:11 | LL | struct::foo(); | ^^ expected identifier error: expected expression, found keyword `mut` - --> $DIR/keywords-followed-by-double-colon.rs:18:5 + --> $DIR/keywords-followed-by-double-colon.rs:6:5 | LL | mut::baz(); | ^^^ expected expression diff --git a/src/test/ui/parser/lex-bad-binary-literal.rs b/src/test/ui/parser/lex-bad-binary-literal.rs index caacb12d008..da36537f0f3 100644 --- a/src/test/ui/parser/lex-bad-binary-literal.rs +++ b/src/test/ui/parser/lex-bad-binary-literal.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error fn main() { 0b121; //~ ERROR invalid digit for a base 2 literal diff --git a/src/test/ui/parser/lex-bad-binary-literal.stderr b/src/test/ui/parser/lex-bad-binary-literal.stderr index 2c23d8c3d61..9750906aaf2 100644 --- a/src/test/ui/parser/lex-bad-binary-literal.stderr +++ b/src/test/ui/parser/lex-bad-binary-literal.stderr @@ -1,53 +1,53 @@ error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:14:8 + --> $DIR/lex-bad-binary-literal.rs:4:8 | LL | 0b121; //~ ERROR invalid digit for a base 2 literal | ^ error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:15:12 + --> $DIR/lex-bad-binary-literal.rs:5:12 | LL | 0b10_10301; //~ ERROR invalid digit for a base 2 literal | ^ error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:16:7 + --> $DIR/lex-bad-binary-literal.rs:6:7 | LL | 0b30; //~ ERROR invalid digit for a base 2 literal | ^ error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:17:7 + --> $DIR/lex-bad-binary-literal.rs:7:7 | LL | 0b41; //~ ERROR invalid digit for a base 2 literal | ^ error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:18:7 + --> $DIR/lex-bad-binary-literal.rs:8:7 | LL | 0b5; //~ ERROR invalid digit for a base 2 literal | ^ error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:19:7 + --> $DIR/lex-bad-binary-literal.rs:9:7 | LL | 0b6; //~ ERROR invalid digit for a base 2 literal | ^ error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:20:7 + --> $DIR/lex-bad-binary-literal.rs:10:7 | LL | 0b7; //~ ERROR invalid digit for a base 2 literal | ^ error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:21:7 + --> $DIR/lex-bad-binary-literal.rs:11:7 | LL | 0b8; //~ ERROR invalid digit for a base 2 literal | ^ error: invalid digit for a base 2 literal - --> $DIR/lex-bad-binary-literal.rs:22:7 + --> $DIR/lex-bad-binary-literal.rs:12:7 | LL | 0b9; //~ ERROR invalid digit for a base 2 literal | ^ diff --git a/src/test/ui/parser/lex-bad-char-literals-1.rs b/src/test/ui/parser/lex-bad-char-literals-1.rs index 006e3e68d8f..54d75ed682d 100644 --- a/src/test/ui/parser/lex-bad-char-literals-1.rs +++ b/src/test/ui/parser/lex-bad-char-literals-1.rs @@ -1,19 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error static c3: char = '\x1' //~ ERROR: numeric character escape is too short ; -static s: &'static str = +static s3: &'static str = "\x1" //~ ERROR: numeric character escape is too short ; @@ -25,3 +15,4 @@ static s: &'static str = "\●" //~ ERROR: unknown character escape ; +fn main() {} diff --git a/src/test/ui/parser/lex-bad-char-literals-1.stderr b/src/test/ui/parser/lex-bad-char-literals-1.stderr index 081eb2e9fed..c22bf7d0010 100644 --- a/src/test/ui/parser/lex-bad-char-literals-1.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-1.stderr @@ -1,23 +1,23 @@ error: numeric character escape is too short - --> $DIR/lex-bad-char-literals-1.rs:13:8 + --> $DIR/lex-bad-char-literals-1.rs:3:8 | LL | '/x1' //~ ERROR: numeric character escape is too short | ^ error: numeric character escape is too short - --> $DIR/lex-bad-char-literals-1.rs:17:8 + --> $DIR/lex-bad-char-literals-1.rs:7:8 | LL | "/x1" //~ ERROR: numeric character escape is too short | ^ error: unknown character escape: /u{25cf} - --> $DIR/lex-bad-char-literals-1.rs:21:7 + --> $DIR/lex-bad-char-literals-1.rs:11:7 | LL | '/●' //~ ERROR: unknown character escape | ^ error: unknown character escape: /u{25cf} - --> $DIR/lex-bad-char-literals-1.rs:25:7 + --> $DIR/lex-bad-char-literals-1.rs:15:7 | LL | "/●" //~ ERROR: unknown character escape | ^ diff --git a/src/test/ui/parser/lex-bad-char-literals-2.rs b/src/test/ui/parser/lex-bad-char-literals-2.rs index 8bd6808c5ff..1e180f87fc1 100644 --- a/src/test/ui/parser/lex-bad-char-literals-2.rs +++ b/src/test/ui/parser/lex-bad-char-literals-2.rs @@ -1,17 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // This test needs to the last one appearing in this file as it kills the parser static c: char = - 'nope' //~ ERROR: character literal may only contain one codepoint: 'nope' + 'nope' //~ ERROR: character literal may only contain one codepoint ; - diff --git a/src/test/ui/parser/lex-bad-char-literals-2.stderr b/src/test/ui/parser/lex-bad-char-literals-2.stderr index ed129f5d427..7eadb8ebfe0 100644 --- a/src/test/ui/parser/lex-bad-char-literals-2.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-2.stderr @@ -1,8 +1,13 @@ -error: character literal may only contain one codepoint: 'nope' - --> $DIR/lex-bad-char-literals-2.rs:15:5 +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-2.rs:3:5 | -LL | 'nope' //~ ERROR: character literal may only contain one codepoint: 'nope' +LL | 'nope' //~ ERROR: character literal may only contain one codepoint | ^^^^^^ -error: aborting due to previous error +error[E0601]: `main` function not found in crate `lex_bad_char_literals_2` + | + = note: consider adding a `main` function to `$DIR/lex-bad-char-literals-2.rs` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/parser/lex-bad-char-literals-3.rs b/src/test/ui/parser/lex-bad-char-literals-3.rs index 464e75ec582..5194ff4d935 100644 --- a/src/test/ui/parser/lex-bad-char-literals-3.rs +++ b/src/test/ui/parser/lex-bad-char-literals-3.rs @@ -1,16 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +static c: char = '●●'; +//~^ ERROR: character literal may only contain one codepoint -// compile-flags: -Z parse-only - -// This test needs to the last one appearing in this file as it kills the parser -static c: char = - '●●' //~ ERROR: character literal may only contain one codepoint -; +fn main() { + let ch: &str = '●●'; + //~^ ERROR: character literal may only contain one codepoint +} diff --git a/src/test/ui/parser/lex-bad-char-literals-3.stderr b/src/test/ui/parser/lex-bad-char-literals-3.stderr index f257b5b8268..6462a3c0e57 100644 --- a/src/test/ui/parser/lex-bad-char-literals-3.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-3.stderr @@ -1,12 +1,22 @@ error: character literal may only contain one codepoint - --> $DIR/lex-bad-char-literals-3.rs:15:5 + --> $DIR/lex-bad-char-literals-3.rs:1:18 | -LL | '●●' //~ ERROR: character literal may only contain one codepoint - | ^^^^ +LL | static c: char = '●●'; + | ^^^^ help: if you meant to write a `str` literal, use double quotes | -LL | "●●" //~ ERROR: character literal may only contain one codepoint - | ^^^^ +LL | static c: char = "●●"; + | ^^^^ -error: aborting due to previous error +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-3.rs:5:20 + | +LL | let ch: &str = '●●'; + | ^^^^ +help: if you meant to write a `str` literal, use double quotes + | +LL | let ch: &str = "●●"; + | ^^^^ + +error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/lex-bad-char-literals-4.rs b/src/test/ui/parser/lex-bad-char-literals-4.rs index b230e623603..e13f11f36df 100644 --- a/src/test/ui/parser/lex-bad-char-literals-4.rs +++ b/src/test/ui/parser/lex-bad-char-literals-4.rs @@ -1,16 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only // // This test needs to the last one appearing in this file as it kills the parser static c: char = - '● //~ ERROR: character literal may only contain one codepoint: '● + '● //~ ERROR: character literal may only contain one codepoint ; diff --git a/src/test/ui/parser/lex-bad-char-literals-4.stderr b/src/test/ui/parser/lex-bad-char-literals-4.stderr index 495becd07d1..881e3d5276b 100644 --- a/src/test/ui/parser/lex-bad-char-literals-4.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-4.stderr @@ -1,7 +1,7 @@ error: character literal may only contain one codepoint: '● - --> $DIR/lex-bad-char-literals-4.rs:15:5 + --> $DIR/lex-bad-char-literals-4.rs:4:5 | -LL | '● //~ ERROR: character literal may only contain one codepoint: '● +LL | '● //~ ERROR: character literal may only contain one codepoint | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/lex-bad-char-literals-5.rs b/src/test/ui/parser/lex-bad-char-literals-5.rs index aa166881d89..0c4339edc4f 100644 --- a/src/test/ui/parser/lex-bad-char-literals-5.rs +++ b/src/test/ui/parser/lex-bad-char-literals-5.rs @@ -1,16 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +static c: char = '\x10\x10'; +//~^ ERROR: character literal may only contain one codepoint -// compile-flags: -Z parse-only -// -// This test needs to the last one appearing in this file as it kills the parser -static c: char = - '\x10\x10' //~ ERROR: character literal may only contain one codepoint -; +fn main() { + let ch: &str = '\x10\x10'; + //~^ ERROR: character literal may only contain one codepoint +} diff --git a/src/test/ui/parser/lex-bad-char-literals-5.stderr b/src/test/ui/parser/lex-bad-char-literals-5.stderr index 145361eb58a..ef029733101 100644 --- a/src/test/ui/parser/lex-bad-char-literals-5.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-5.stderr @@ -1,12 +1,22 @@ error: character literal may only contain one codepoint - --> $DIR/lex-bad-char-literals-5.rs:15:5 + --> $DIR/lex-bad-char-literals-5.rs:1:18 | -LL | '/x10/x10' //~ ERROR: character literal may only contain one codepoint - | ^^^^^^^^^^ +LL | static c: char = '/x10/x10'; + | ^^^^^^^^^^ help: if you meant to write a `str` literal, use double quotes | -LL | "/x10/x10" //~ ERROR: character literal may only contain one codepoint - | ^^^^^^^^^^ +LL | static c: char = "/x10/x10"; + | ^^^^^^^^^^ -error: aborting due to previous error +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-5.rs:5:20 + | +LL | let ch: &str = '/x10/x10'; + | ^^^^^^^^^^ +help: if you meant to write a `str` literal, use double quotes + | +LL | let ch: &str = "/x10/x10"; + | ^^^^^^^^^^ + +error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/lex-bad-char-literals-6.rs b/src/test/ui/parser/lex-bad-char-literals-6.rs new file mode 100644 index 00000000000..4379b4fa6d7 --- /dev/null +++ b/src/test/ui/parser/lex-bad-char-literals-6.rs @@ -0,0 +1,17 @@ +fn main() { + let x: &str = 'ab'; + //~^ ERROR: character literal may only contain one codepoint + let y: char = 'cd'; + //~^ ERROR: character literal may only contain one codepoint + let z = 'ef'; + //~^ ERROR: character literal may only contain one codepoint + + if x == y {} + //~^ ERROR: can't compare `&str` with `char` + if y == z {} // no error here + if x == z {} + //~^ ERROR: can't compare `&str` with `char` + + let a: usize = ""; + //~^ ERROR: mismatched types +} diff --git a/src/test/ui/parser/lex-bad-char-literals-6.stderr b/src/test/ui/parser/lex-bad-char-literals-6.stderr new file mode 100644 index 00000000000..df997260348 --- /dev/null +++ b/src/test/ui/parser/lex-bad-char-literals-6.stderr @@ -0,0 +1,47 @@ +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-6.rs:2:19 + | +LL | let x: &str = 'ab'; + | ^^^^ + +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-6.rs:4:19 + | +LL | let y: char = 'cd'; + | ^^^^ + +error: character literal may only contain one codepoint + --> $DIR/lex-bad-char-literals-6.rs:6:13 + | +LL | let z = 'ef'; + | ^^^^ + +error[E0277]: can't compare `&str` with `char` + --> $DIR/lex-bad-char-literals-6.rs:9:10 + | +LL | if x == y {} + | ^^ no implementation for `&str == char` + | + = help: the trait `std::cmp::PartialEq` is not implemented for `&str` + +error[E0308]: mismatched types + --> $DIR/lex-bad-char-literals-6.rs:15:20 + | +LL | let a: usize = ""; + | ^^ expected usize, found reference + | + = note: expected type `usize` + found type `&'static str` + +error[E0277]: can't compare `&str` with `char` + --> $DIR/lex-bad-char-literals-6.rs:12:10 + | +LL | if x == z {} + | ^^ no implementation for `&str == char` + | + = help: the trait `std::cmp::PartialEq` is not implemented for `&str` + +error: aborting due to 6 previous errors + +Some errors occurred: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/parser/lex-bad-numeric-literals.rs b/src/test/ui/parser/lex-bad-numeric-literals.rs index d495a8edd09..9496ad305fc 100644 --- a/src/test/ui/parser/lex-bad-numeric-literals.rs +++ b/src/test/ui/parser/lex-bad-numeric-literals.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error fn main() { 0o1.0; //~ ERROR: octal float literal is not supported diff --git a/src/test/ui/parser/lex-bad-numeric-literals.stderr b/src/test/ui/parser/lex-bad-numeric-literals.stderr index 3d87b5b7037..1fa23b8b73c 100644 --- a/src/test/ui/parser/lex-bad-numeric-literals.stderr +++ b/src/test/ui/parser/lex-bad-numeric-literals.stderr @@ -1,140 +1,140 @@ error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:14:5 + --> $DIR/lex-bad-numeric-literals.rs:4:5 | LL | 0o1.0; //~ ERROR: octal float literal is not supported | ^^^^^ error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:16:5 + --> $DIR/lex-bad-numeric-literals.rs:6:5 | LL | 0o3.0f32; //~ ERROR: octal float literal is not supported | ^^^^^ error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:17:5 + --> $DIR/lex-bad-numeric-literals.rs:7:5 | LL | 0o4e4; //~ ERROR: octal float literal is not supported | ^^^^^ error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:18:5 + --> $DIR/lex-bad-numeric-literals.rs:8:5 | LL | 0o5.0e5; //~ ERROR: octal float literal is not supported | ^^^^^^^ error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:19:5 + --> $DIR/lex-bad-numeric-literals.rs:9:5 | LL | 0o6e6f32; //~ ERROR: octal float literal is not supported | ^^^^^ error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:20:5 + --> $DIR/lex-bad-numeric-literals.rs:10:5 | LL | 0o7.0e7f64; //~ ERROR: octal float literal is not supported | ^^^^^^^ error: hexadecimal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:21:5 + --> $DIR/lex-bad-numeric-literals.rs:11:5 | LL | 0x8.0e+9; //~ ERROR: hexadecimal float literal is not supported | ^^^^^^^^ error: hexadecimal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:22:5 + --> $DIR/lex-bad-numeric-literals.rs:12:5 | LL | 0x9.0e-9; //~ ERROR: hexadecimal float literal is not supported | ^^^^^^^^ error: no valid digits found for number - --> $DIR/lex-bad-numeric-literals.rs:23:5 + --> $DIR/lex-bad-numeric-literals.rs:13:5 | LL | 0o; //~ ERROR: no valid digits | ^^ error: expected at least one digit in exponent - --> $DIR/lex-bad-numeric-literals.rs:24:8 + --> $DIR/lex-bad-numeric-literals.rs:14:8 | LL | 1e+; //~ ERROR: expected at least one digit in exponent | ^ error: hexadecimal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:25:5 + --> $DIR/lex-bad-numeric-literals.rs:15:5 | LL | 0x539.0; //~ ERROR: hexadecimal float literal is not supported | ^^^^^^^ error: no valid digits found for number - --> $DIR/lex-bad-numeric-literals.rs:28:5 + --> $DIR/lex-bad-numeric-literals.rs:18:5 | LL | 0x; //~ ERROR: no valid digits | ^^ error: no valid digits found for number - --> $DIR/lex-bad-numeric-literals.rs:29:5 + --> $DIR/lex-bad-numeric-literals.rs:19:5 | LL | 0xu32; //~ ERROR: no valid digits | ^^ error: no valid digits found for number - --> $DIR/lex-bad-numeric-literals.rs:30:5 + --> $DIR/lex-bad-numeric-literals.rs:20:5 | LL | 0ou32; //~ ERROR: no valid digits | ^^ error: no valid digits found for number - --> $DIR/lex-bad-numeric-literals.rs:31:5 + --> $DIR/lex-bad-numeric-literals.rs:21:5 | LL | 0bu32; //~ ERROR: no valid digits | ^^ error: no valid digits found for number - --> $DIR/lex-bad-numeric-literals.rs:32:5 + --> $DIR/lex-bad-numeric-literals.rs:22:5 | LL | 0b; //~ ERROR: no valid digits | ^^ error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:34:5 + --> $DIR/lex-bad-numeric-literals.rs:24:5 | LL | 0o123.456; //~ ERROR: octal float literal is not supported | ^^^^^^^^^ error: binary float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:36:5 + --> $DIR/lex-bad-numeric-literals.rs:26:5 | LL | 0b111.101; //~ ERROR: binary float literal is not supported | ^^^^^^^^^ error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:15:5 + --> $DIR/lex-bad-numeric-literals.rs:5:5 | LL | 0o2f32; //~ ERROR: octal float literal is not supported - | ^^^^^^ + | ^^^^^^ not supported error: int literal is too large - --> $DIR/lex-bad-numeric-literals.rs:26:5 + --> $DIR/lex-bad-numeric-literals.rs:16:5 | LL | 9900000000000000000000000000999999999999999999999999999999; //~ ERROR: int literal is too large | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: int literal is too large - --> $DIR/lex-bad-numeric-literals.rs:27:5 + --> $DIR/lex-bad-numeric-literals.rs:17:5 | LL | 9900000000000000000000000000999999999999999999999999999999; //~ ERROR: int literal is too large | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: octal float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:33:5 + --> $DIR/lex-bad-numeric-literals.rs:23:5 | LL | 0o123f64; //~ ERROR: octal float literal is not supported - | ^^^^^^^^ + | ^^^^^^^^ not supported error: binary float literal is not supported - --> $DIR/lex-bad-numeric-literals.rs:35:5 + --> $DIR/lex-bad-numeric-literals.rs:25:5 | LL | 0b101f64; //~ ERROR: binary float literal is not supported - | ^^^^^^^^ + | ^^^^^^^^ not supported error: aborting due to 23 previous errors diff --git a/src/test/ui/parser/lex-bad-octal-literal.rs b/src/test/ui/parser/lex-bad-octal-literal.rs index c8406af52ae..f4cc2c5c420 100644 --- a/src/test/ui/parser/lex-bad-octal-literal.rs +++ b/src/test/ui/parser/lex-bad-octal-literal.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error fn main() { 0o18; //~ ERROR invalid digit for a base 8 literal diff --git a/src/test/ui/parser/lex-bad-octal-literal.stderr b/src/test/ui/parser/lex-bad-octal-literal.stderr index 342309fdd1c..542247d69df 100644 --- a/src/test/ui/parser/lex-bad-octal-literal.stderr +++ b/src/test/ui/parser/lex-bad-octal-literal.stderr @@ -1,11 +1,11 @@ error: invalid digit for a base 8 literal - --> $DIR/lex-bad-octal-literal.rs:14:8 + --> $DIR/lex-bad-octal-literal.rs:4:8 | LL | 0o18; //~ ERROR invalid digit for a base 8 literal | ^ error: invalid digit for a base 8 literal - --> $DIR/lex-bad-octal-literal.rs:15:12 + --> $DIR/lex-bad-octal-literal.rs:5:12 | LL | 0o1234_9_5670; //~ ERROR invalid digit for a base 8 literal | ^ diff --git a/src/test/ui/parser/lex-bad-token.rs b/src/test/ui/parser/lex-bad-token.rs index 774b10a9f97..feb670c3d3d 100644 --- a/src/test/ui/parser/lex-bad-token.rs +++ b/src/test/ui/parser/lex-bad-token.rs @@ -1,13 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - ● //~ ERROR: unknown start of token diff --git a/src/test/ui/parser/lex-bad-token.stderr b/src/test/ui/parser/lex-bad-token.stderr index 6e2cd9995ca..284ffde9efb 100644 --- a/src/test/ui/parser/lex-bad-token.stderr +++ b/src/test/ui/parser/lex-bad-token.stderr @@ -1,5 +1,5 @@ error: unknown start of token: /u{25cf} - --> $DIR/lex-bad-token.rs:13:1 + --> $DIR/lex-bad-token.rs:1:1 | LL | ● //~ ERROR: unknown start of token | ^ diff --git a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.rs b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.rs index ac085d47511..b588b007ae9 100644 --- a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.rs +++ b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error // ignore-tidy-cr diff --git a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr index 799836759e6..e9f3537ab74 100644 --- a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr +++ b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr @@ -1,47 +1,47 @@ error: bare CR not allowed in doc-comment - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:15:32 + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:5:32 | LL | /// doc comment with bare CR: ' ' | ^ error: bare CR not allowed in block doc-comment - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:19:38 + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:9:38 | LL | /** block doc comment with bare CR: ' ' */ | ^ error: bare CR not allowed in doc-comment - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:24:36 + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:14:36 | LL | //! doc comment with bare CR: ' ' | ^ error: bare CR not allowed in block doc-comment - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:27:42 + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:17:42 | LL | /*! block doc comment with bare CR: ' ' */ | ^ error: bare CR not allowed in string, use /r instead - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:31:18 + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:21:18 | LL | let _s = "foo bar"; //~ ERROR: bare CR not allowed in string | ^ error: bare CR not allowed in raw string, use /r instead - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:34:14 + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:24:14 | LL | let _s = r"bar foo"; //~ ERROR: bare CR not allowed in raw string | ^^^^^ error: unknown character escape: /r - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:37:19 + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:27:19 | LL | let _s = "foo/ bar"; //~ ERROR: unknown character escape: /r | ^ | help: this is an isolated carriage return; consider checking your editor and version control settings - --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:37:19 + --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:27:19 | LL | let _s = "foo/ bar"; //~ ERROR: unknown character escape: /r | ^ diff --git a/src/test/ui/parser/lex-stray-backslash.rs b/src/test/ui/parser/lex-stray-backslash.rs index b6042bbdc1a..90d359231a6 100644 --- a/src/test/ui/parser/lex-stray-backslash.rs +++ b/src/test/ui/parser/lex-stray-backslash.rs @@ -1,13 +1 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - \ //~ ERROR: unknown start of token: \ diff --git a/src/test/ui/parser/lex-stray-backslash.stderr b/src/test/ui/parser/lex-stray-backslash.stderr index d4ccb6f1459..40e0cc1d786 100644 --- a/src/test/ui/parser/lex-stray-backslash.stderr +++ b/src/test/ui/parser/lex-stray-backslash.stderr @@ -1,5 +1,5 @@ error: unknown start of token: / - --> $DIR/lex-stray-backslash.rs:13:1 + --> $DIR/lex-stray-backslash.rs:1:1 | LL | / //~ ERROR: unknown start of token: / | ^ diff --git a/src/test/ui/parser/lifetime-in-pattern.rs b/src/test/ui/parser/lifetime-in-pattern.rs index ccabcdf2d75..afee685cd05 100644 --- a/src/test/ui/parser/lifetime-in-pattern.rs +++ b/src/test/ui/parser/lifetime-in-pattern.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn test(&'a str) { //~^ ERROR unexpected lifetime `'a` in pattern } diff --git a/src/test/ui/parser/lifetime-in-pattern.stderr b/src/test/ui/parser/lifetime-in-pattern.stderr index 86cc3c5b0cb..e525c7b6d68 100644 --- a/src/test/ui/parser/lifetime-in-pattern.stderr +++ b/src/test/ui/parser/lifetime-in-pattern.stderr @@ -1,5 +1,5 @@ error: unexpected lifetime `'a` in pattern - --> $DIR/lifetime-in-pattern.rs:13:10 + --> $DIR/lifetime-in-pattern.rs:1:10 | LL | fn test(&'a str) { | ^^ unexpected lifetime diff --git a/src/test/ui/parser/lifetime-semicolon.rs b/src/test/ui/parser/lifetime-semicolon.rs index e1975952fca..1f147216ea6 100644 --- a/src/test/ui/parser/lifetime-semicolon.rs +++ b/src/test/ui/parser/lifetime-semicolon.rs @@ -1,18 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct Foo<'a, 'b> { a: &'a &'b i32 } fn foo<'a, 'b>(x: &mut Foo<'a; 'b>) {} //~^ ERROR expected one of `,` or `>`, found `;` + +fn main() {} diff --git a/src/test/ui/parser/lifetime-semicolon.stderr b/src/test/ui/parser/lifetime-semicolon.stderr index 2ce6d5d6cf3..71ed8200e9a 100644 --- a/src/test/ui/parser/lifetime-semicolon.stderr +++ b/src/test/ui/parser/lifetime-semicolon.stderr @@ -1,5 +1,5 @@ error: expected one of `,` or `>`, found `;` - --> $DIR/lifetime-semicolon.rs:17:30 + --> $DIR/lifetime-semicolon.rs:5:30 | LL | fn foo<'a, 'b>(x: &mut Foo<'a; 'b>) {} | ^ expected one of `,` or `>` here diff --git a/src/test/ui/parser/macro-bad-delimiter-ident.rs b/src/test/ui/parser/macro-bad-delimiter-ident.rs index 2940adee043..987c955d1dc 100644 --- a/src/test/ui/parser/macro-bad-delimiter-ident.rs +++ b/src/test/ui/parser/macro-bad-delimiter-ident.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { foo! bar < //~ ERROR expected `(` or `{`, found `<` } diff --git a/src/test/ui/parser/macro-bad-delimiter-ident.stderr b/src/test/ui/parser/macro-bad-delimiter-ident.stderr index e1ae9892f74..59762e02165 100644 --- a/src/test/ui/parser/macro-bad-delimiter-ident.stderr +++ b/src/test/ui/parser/macro-bad-delimiter-ident.stderr @@ -1,5 +1,5 @@ error: expected `(` or `{`, found `<` - --> $DIR/macro-bad-delimiter-ident.rs:14:14 + --> $DIR/macro-bad-delimiter-ident.rs:2:14 | LL | foo! bar < //~ ERROR expected `(` or `{`, found `<` | ^ expected `(` or `{` diff --git a/src/test/ui/parser/macro-keyword.rs b/src/test/ui/parser/macro-keyword.rs index c7dcaf4137e..58489fb2c51 100644 --- a/src/test/ui/parser/macro-keyword.rs +++ b/src/test/ui/parser/macro-keyword.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn macro() { //~ ERROR expected identifier, found reserved keyword `macro` } diff --git a/src/test/ui/parser/macro-keyword.stderr b/src/test/ui/parser/macro-keyword.stderr index a5582623535..4a10dd50b23 100644 --- a/src/test/ui/parser/macro-keyword.stderr +++ b/src/test/ui/parser/macro-keyword.stderr @@ -1,8 +1,12 @@ error: expected identifier, found reserved keyword `macro` - --> $DIR/macro-keyword.rs:13:4 + --> $DIR/macro-keyword.rs:1:4 | LL | fn macro() { //~ ERROR expected identifier, found reserved keyword `macro` | ^^^^^ expected identifier, found reserved keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | fn r#macro() { //~ ERROR expected identifier, found reserved keyword `macro` + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/macro-mismatched-delim-brace-paren.rs b/src/test/ui/parser/macro-mismatched-delim-brace-paren.rs index 84cf900129f..3f3e997dece 100644 --- a/src/test/ui/parser/macro-mismatched-delim-brace-paren.rs +++ b/src/test/ui/parser/macro-mismatched-delim-brace-paren.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only +macro_rules! foo { ($($tt:tt)*) => () } fn main() { foo! { diff --git a/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr b/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr index 69bd40fbb24..21c3d1771aa 100644 --- a/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr +++ b/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr @@ -1,5 +1,5 @@ error: incorrect close delimiter: `)` - --> $DIR/macro-mismatched-delim-brace-paren.rs:16:5 + --> $DIR/macro-mismatched-delim-brace-paren.rs:6:5 | LL | foo! { | - un-closed delimiter diff --git a/src/test/ui/parser/macro-mismatched-delim-paren-brace.rs b/src/test/ui/parser/macro-mismatched-delim-paren-brace.rs index cbc0ed0ccdb..1185f882a13 100644 --- a/src/test/ui/parser/macro-mismatched-delim-paren-brace.rs +++ b/src/test/ui/parser/macro-mismatched-delim-paren-brace.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { foo! ( bar, "baz", 1, 2.0 diff --git a/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr b/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr index 6fe7926f4e1..805ba8b6baa 100644 --- a/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr +++ b/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr @@ -1,5 +1,5 @@ error: incorrect close delimiter: `}` - --> $DIR/macro-mismatched-delim-paren-brace.rs:16:5 + --> $DIR/macro-mismatched-delim-paren-brace.rs:4:5 | LL | foo! ( | - un-closed delimiter @@ -8,7 +8,7 @@ LL | } //~ ERROR incorrect close delimiter | ^ incorrect close delimiter error: unexpected close delimiter: `}` - --> $DIR/macro-mismatched-delim-paren-brace.rs:17:1 + --> $DIR/macro-mismatched-delim-paren-brace.rs:5:1 | LL | } //~ ERROR unexpected close delimiter: `}` | ^ unexpected close delimiter diff --git a/src/test/ui/parser/macro/issue-33569.rs b/src/test/ui/parser/macro/issue-33569.rs index a0b959ecea5..83f8a562a03 100644 --- a/src/test/ui/parser/macro/issue-33569.rs +++ b/src/test/ui/parser/macro/issue-33569.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! foo { { $+ } => { //~ ERROR expected identifier, found `+` //~^ ERROR missing fragment specifier diff --git a/src/test/ui/parser/macro/issue-33569.stderr b/src/test/ui/parser/macro/issue-33569.stderr index 4dab8fc73f3..213d72363f5 100644 --- a/src/test/ui/parser/macro/issue-33569.stderr +++ b/src/test/ui/parser/macro/issue-33569.stderr @@ -1,17 +1,17 @@ error: expected identifier, found `+` - --> $DIR/issue-33569.rs:12:8 + --> $DIR/issue-33569.rs:2:8 | LL | { $+ } => { //~ ERROR expected identifier, found `+` | ^ error: expected `*` or `+` - --> $DIR/issue-33569.rs:14:13 + --> $DIR/issue-33569.rs:4:13 | LL | $(x)(y) //~ ERROR expected `*` or `+` | ^^^ error: missing fragment specifier - --> $DIR/issue-33569.rs:12:8 + --> $DIR/issue-33569.rs:2:8 | LL | { $+ } => { //~ ERROR expected identifier, found `+` | ^ diff --git a/src/test/ui/parser/macro/issue-37113.rs b/src/test/ui/parser/macro/issue-37113.rs index 14c6f3944bb..0044aa5610f 100644 --- a/src/test/ui/parser/macro/issue-37113.rs +++ b/src/test/ui/parser/macro/issue-37113.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! test_macro { ( $( $t:ty ),* $(),*) => { enum SomeEnum { diff --git a/src/test/ui/parser/macro/issue-37113.stderr b/src/test/ui/parser/macro/issue-37113.stderr index 1e8f017e1db..36589667c4b 100644 --- a/src/test/ui/parser/macro/issue-37113.stderr +++ b/src/test/ui/parser/macro/issue-37113.stderr @@ -1,5 +1,5 @@ error: expected identifier, found `String` - --> $DIR/issue-37113.rs:14:16 + --> $DIR/issue-37113.rs:4:16 | LL | $( $t, )* //~ ERROR expected identifier, found `String` | ^^ expected identifier diff --git a/src/test/ui/parser/macro/issue-37234.rs b/src/test/ui/parser/macro/issue-37234.rs index 93a1468bf7b..4debc747905 100644 --- a/src/test/ui/parser/macro/issue-37234.rs +++ b/src/test/ui/parser/macro/issue-37234.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! failed { () => {{ let x = 5 ""; //~ ERROR found `""` diff --git a/src/test/ui/parser/macro/issue-37234.stderr b/src/test/ui/parser/macro/issue-37234.stderr index 28dd71316aa..dcc24fca5cc 100644 --- a/src/test/ui/parser/macro/issue-37234.stderr +++ b/src/test/ui/parser/macro/issue-37234.stderr @@ -1,5 +1,5 @@ error: expected one of `.`, `;`, `?`, or an operator, found `""` - --> $DIR/issue-37234.rs:13:19 + --> $DIR/issue-37234.rs:3:19 | LL | let x = 5 ""; //~ ERROR found `""` | ^^ expected one of `.`, `;`, `?`, or an operator here diff --git a/src/test/ui/parser/macro/macro-doc-comments-1.rs b/src/test/ui/parser/macro/macro-doc-comments-1.rs index 03bcef4fa5e..8d8103bb1e0 100644 --- a/src/test/ui/parser/macro/macro-doc-comments-1.rs +++ b/src/test/ui/parser/macro/macro-doc-comments-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! outer { (#[$outer:meta]) => () } diff --git a/src/test/ui/parser/macro/macro-doc-comments-1.stderr b/src/test/ui/parser/macro/macro-doc-comments-1.stderr index 1e765dcde4f..96bdb9808ee 100644 --- a/src/test/ui/parser/macro/macro-doc-comments-1.stderr +++ b/src/test/ui/parser/macro/macro-doc-comments-1.stderr @@ -1,11 +1,11 @@ error: no rules expected the token `!` - --> $DIR/macro-doc-comments-1.rs:16:5 + --> $DIR/macro-doc-comments-1.rs:6:5 | LL | macro_rules! outer { | ------------------ when calling this macro ... LL | //! Inner - | ^^^^^^^^^ no rules expected the token `!` + | ^^^^^^^^^ no rules expected this token in macro call error: aborting due to previous error diff --git a/src/test/ui/parser/macro/macro-doc-comments-2.rs b/src/test/ui/parser/macro/macro-doc-comments-2.rs index a1b112c29b6..8f33720ae80 100644 --- a/src/test/ui/parser/macro/macro-doc-comments-2.rs +++ b/src/test/ui/parser/macro/macro-doc-comments-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! inner { (#![$inner:meta]) => () } diff --git a/src/test/ui/parser/macro/macro-doc-comments-2.stderr b/src/test/ui/parser/macro/macro-doc-comments-2.stderr index 0ab8a3cafb5..6abe95192be 100644 --- a/src/test/ui/parser/macro/macro-doc-comments-2.stderr +++ b/src/test/ui/parser/macro/macro-doc-comments-2.stderr @@ -1,11 +1,11 @@ error: no rules expected the token `[` - --> $DIR/macro-doc-comments-2.rs:16:5 + --> $DIR/macro-doc-comments-2.rs:6:5 | LL | macro_rules! inner { | ------------------ when calling this macro ... LL | /// Outer - | ^ no rules expected the token `[` + | ^ no rules expected this token in macro call error: aborting due to previous error diff --git a/src/test/ui/parser/macro/macro-incomplete-parse.rs b/src/test/ui/parser/macro/macro-incomplete-parse.rs index 9b8fdaf9a25..9294bebc514 100644 --- a/src/test/ui/parser/macro/macro-incomplete-parse.rs +++ b/src/test/ui/parser/macro/macro-incomplete-parse.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z continue-parse-after-error macro_rules! ignored_item { diff --git a/src/test/ui/parser/macro/macro-incomplete-parse.stderr b/src/test/ui/parser/macro/macro-incomplete-parse.stderr index 806aca511d0..3fcc8e08520 100644 --- a/src/test/ui/parser/macro/macro-incomplete-parse.stderr +++ b/src/test/ui/parser/macro/macro-incomplete-parse.stderr @@ -1,5 +1,5 @@ error: macro expansion ignores token `,` and any following - --> $DIR/macro-incomplete-parse.rs:17:9 + --> $DIR/macro-incomplete-parse.rs:7:9 | LL | , //~ ERROR macro expansion ignores token `,` | ^ @@ -10,7 +10,7 @@ LL | ignored_item!(); = note: the usage of `ignored_item!` is likely invalid in item context error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` - --> $DIR/macro-incomplete-parse.rs:22:14 + --> $DIR/macro-incomplete-parse.rs:12:14 | LL | () => ( 1, //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `,` | ^ expected one of `.`, `;`, `?`, `}`, or an operator here @@ -19,7 +19,7 @@ LL | ignored_expr!(); | ---------------- in this macro invocation error: macro expansion ignores token `,` and any following - --> $DIR/macro-incomplete-parse.rs:28:14 + --> $DIR/macro-incomplete-parse.rs:18:14 | LL | () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,` | ^ diff --git a/src/test/ui/parser/macro/macro-repeat.rs b/src/test/ui/parser/macro/macro-repeat.rs index 3abadd885ac..580a1daacbf 100644 --- a/src/test/ui/parser/macro/macro-repeat.rs +++ b/src/test/ui/parser/macro/macro-repeat.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! mac { ( $($v:tt)* ) => ( $v //~ ERROR still repeating at this depth diff --git a/src/test/ui/parser/macro/macro-repeat.stderr b/src/test/ui/parser/macro/macro-repeat.stderr index 7c7a2fb12c3..310d60c8dbd 100644 --- a/src/test/ui/parser/macro/macro-repeat.stderr +++ b/src/test/ui/parser/macro/macro-repeat.stderr @@ -1,5 +1,5 @@ error: variable 'v' is still repeating at this depth - --> $DIR/macro-repeat.rs:13:9 + --> $DIR/macro-repeat.rs:3:9 | LL | $v //~ ERROR still repeating at this depth | ^^ diff --git a/src/test/ui/parser/macro/pub-item-macro.rs b/src/test/ui/parser/macro/pub-item-macro.rs index 8809e9a257d..bae90227c62 100644 --- a/src/test/ui/parser/macro/pub-item-macro.rs +++ b/src/test/ui/parser/macro/pub-item-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #14660 macro_rules! priv_x { () => { @@ -24,5 +14,5 @@ mod foo { } fn main() { - let y: u32 = foo::x; + let y: u32 = foo::x; //~ ERROR static `x` is private } diff --git a/src/test/ui/parser/macro/pub-item-macro.stderr b/src/test/ui/parser/macro/pub-item-macro.stderr index f55ba469ab4..a624d574c45 100644 --- a/src/test/ui/parser/macro/pub-item-macro.stderr +++ b/src/test/ui/parser/macro/pub-item-macro.stderr @@ -1,5 +1,5 @@ error: can't qualify macro invocation with `pub` - --> $DIR/pub-item-macro.rs:18:5 + --> $DIR/pub-item-macro.rs:8:5 | LL | pub priv_x!(); //~ ERROR can't qualify macro invocation with `pub` | ^^^ @@ -9,5 +9,12 @@ LL | pub_x!(); | = help: try adjusting the macro to put `pub` inside the invocation -error: aborting due to previous error +error[E0603]: static `x` is private + --> $DIR/pub-item-macro.rs:17:23 + | +LL | let y: u32 = foo::x; //~ ERROR static `x` is private + | ^ + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0603`. diff --git a/src/test/ui/parser/macro/trait-non-item-macros.rs b/src/test/ui/parser/macro/trait-non-item-macros.rs index 9f94d5d41fd..958c90b7c0a 100644 --- a/src/test/ui/parser/macro/trait-non-item-macros.rs +++ b/src/test/ui/parser/macro/trait-non-item-macros.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! bah { ($a:expr) => ($a) //~^ ERROR expected one of `async`, `const`, `extern`, `fn`, `type`, or `unsafe`, found `2` diff --git a/src/test/ui/parser/macro/trait-non-item-macros.stderr b/src/test/ui/parser/macro/trait-non-item-macros.stderr index 2f4fdbfbc2b..76670e0bde0 100644 --- a/src/test/ui/parser/macro/trait-non-item-macros.stderr +++ b/src/test/ui/parser/macro/trait-non-item-macros.stderr @@ -1,5 +1,5 @@ error: expected one of `async`, `const`, `extern`, `fn`, `type`, or `unsafe`, found `2` - --> $DIR/trait-non-item-macros.rs:12:19 + --> $DIR/trait-non-item-macros.rs:2:19 | LL | ($a:expr) => ($a) | ^^ unexpected token diff --git a/src/test/ui/parser/macro/trait-object-macro-matcher.rs b/src/test/ui/parser/macro/trait-object-macro-matcher.rs index 3a5bce509f1..80d867d3b56 100644 --- a/src/test/ui/parser/macro/trait-object-macro-matcher.rs +++ b/src/test/ui/parser/macro/trait-object-macro-matcher.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A single lifetime is not parsed as a type. // `ty` matcher in particular doesn't accept a single lifetime diff --git a/src/test/ui/parser/macro/trait-object-macro-matcher.stderr b/src/test/ui/parser/macro/trait-object-macro-matcher.stderr index ab536dc5854..185a9e71809 100644 --- a/src/test/ui/parser/macro/trait-object-macro-matcher.stderr +++ b/src/test/ui/parser/macro/trait-object-macro-matcher.stderr @@ -1,5 +1,5 @@ error: expected type, found `'static` - --> $DIR/trait-object-macro-matcher.rs:19:8 + --> $DIR/trait-object-macro-matcher.rs:9:8 | LL | m!('static); //~ ERROR expected type, found `'static` | ^^^^^^^ diff --git a/src/test/ui/parser/macros-no-semicolon-items.rs b/src/test/ui/parser/macros-no-semicolon-items.rs index faf6b4a308a..a727cafcab0 100644 --- a/src/test/ui/parser/macros-no-semicolon-items.rs +++ b/src/test/ui/parser/macros-no-semicolon-items.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - macro_rules! foo() //~ ERROR semicolon fn main() { diff --git a/src/test/ui/parser/macros-no-semicolon-items.stderr b/src/test/ui/parser/macros-no-semicolon-items.stderr index 1d935f693f1..84dd302b4a8 100644 --- a/src/test/ui/parser/macros-no-semicolon-items.stderr +++ b/src/test/ui/parser/macros-no-semicolon-items.stderr @@ -1,5 +1,5 @@ error: macros that expand to items must either be surrounded with braces or followed by a semicolon - --> $DIR/macros-no-semicolon-items.rs:13:17 + --> $DIR/macros-no-semicolon-items.rs:1:17 | LL | macro_rules! foo() //~ ERROR semicolon | ^^ diff --git a/src/test/ui/parser/macros-no-semicolon.rs b/src/test/ui/parser/macros-no-semicolon.rs index 1c55d70f607..fd79fa8df7a 100644 --- a/src/test/ui/parser/macros-no-semicolon.rs +++ b/src/test/ui/parser/macros-no-semicolon.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { assert_eq!(1, 2) assert_eq!(3, 4) //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `assert_eq` diff --git a/src/test/ui/parser/macros-no-semicolon.stderr b/src/test/ui/parser/macros-no-semicolon.stderr index 9ea9e739a0a..4f9e7fb5de8 100644 --- a/src/test/ui/parser/macros-no-semicolon.stderr +++ b/src/test/ui/parser/macros-no-semicolon.stderr @@ -1,5 +1,5 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `assert_eq` - --> $DIR/macros-no-semicolon.rs:15:5 + --> $DIR/macros-no-semicolon.rs:3:5 | LL | assert_eq!(1, 2) | - expected one of `.`, `;`, `?`, `}`, or an operator here diff --git a/src/test/ui/parser/match-arrows-block-then-binop.rs b/src/test/ui/parser/match-arrows-block-then-binop.rs index e8cfb77f059..1a40d674929 100644 --- a/src/test/ui/parser/match-arrows-block-then-binop.rs +++ b/src/test/ui/parser/match-arrows-block-then-binop.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { match 0 { diff --git a/src/test/ui/parser/match-arrows-block-then-binop.stderr b/src/test/ui/parser/match-arrows-block-then-binop.stderr index 9293fd14c49..2782af49e66 100644 --- a/src/test/ui/parser/match-arrows-block-then-binop.stderr +++ b/src/test/ui/parser/match-arrows-block-then-binop.stderr @@ -1,5 +1,5 @@ error: expected pattern, found `+` - --> $DIR/match-arrows-block-then-binop.rs:17:9 + --> $DIR/match-arrows-block-then-binop.rs:5:9 | LL | } + 5 //~ ERROR expected pattern, found `+` | ^ expected pattern diff --git a/src/test/ui/parser/match-refactor-to-expr.rs b/src/test/ui/parser/match-refactor-to-expr.rs index 014dba3d4d0..09ebb2e1d83 100644 --- a/src/test/ui/parser/match-refactor-to-expr.rs +++ b/src/test/ui/parser/match-refactor-to-expr.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let foo = match //~ NOTE while parsing this match expression diff --git a/src/test/ui/parser/match-refactor-to-expr.stderr b/src/test/ui/parser/match-refactor-to-expr.stderr index 2ffbddd570f..692b116123a 100644 --- a/src/test/ui/parser/match-refactor-to-expr.stderr +++ b/src/test/ui/parser/match-refactor-to-expr.stderr @@ -1,5 +1,5 @@ error: expected one of `.`, `?`, `{`, or an operator, found `;` - --> $DIR/match-refactor-to-expr.rs:18:9 + --> $DIR/match-refactor-to-expr.rs:6:9 | LL | match //~ NOTE while parsing this match expression | ----- diff --git a/src/test/ui/parser/match-vec-invalid.rs b/src/test/ui/parser/match-vec-invalid.rs index 72501ba0e4f..e5e85ba8ca6 100644 --- a/src/test/ui/parser/match-vec-invalid.rs +++ b/src/test/ui/parser/match-vec-invalid.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let a = Vec::new(); match a { diff --git a/src/test/ui/parser/match-vec-invalid.stderr b/src/test/ui/parser/match-vec-invalid.stderr index 9050223c644..5a5fc9c4509 100644 --- a/src/test/ui/parser/match-vec-invalid.stderr +++ b/src/test/ui/parser/match-vec-invalid.stderr @@ -1,5 +1,5 @@ error: expected one of `,` or `@`, found `..` - --> $DIR/match-vec-invalid.rs:16:25 + --> $DIR/match-vec-invalid.rs:4:25 | LL | [1, tail.., tail..] => {}, //~ ERROR: expected one of `,` or `@`, found `..` | ^^ expected one of `,` or `@` here diff --git a/src/test/ui/parser/mod_file_not_exist.rs b/src/test/ui/parser/mod_file_not_exist.rs index 59b2ebe9f86..e662c707a38 100644 --- a/src/test/ui/parser/mod_file_not_exist.rs +++ b/src/test/ui/parser/mod_file_not_exist.rs @@ -1,15 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-windows -// compile-flags: -Z parse-only mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file` //~^ HELP name the file either not_a_real_file.rs or not_a_real_file/mod.rs inside the directory diff --git a/src/test/ui/parser/mod_file_not_exist.stderr b/src/test/ui/parser/mod_file_not_exist.stderr index a745fc2847b..f7f0e2d2d11 100644 --- a/src/test/ui/parser/mod_file_not_exist.stderr +++ b/src/test/ui/parser/mod_file_not_exist.stderr @@ -1,5 +1,5 @@ error[E0583]: file not found for module `not_a_real_file` - --> $DIR/mod_file_not_exist.rs:14:5 + --> $DIR/mod_file_not_exist.rs:3:5 | LL | mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file` | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/parser/mod_file_not_exist_windows.rs b/src/test/ui/parser/mod_file_not_exist_windows.rs index 6ee6792a8a2..0cd9e9c799f 100644 --- a/src/test/ui/parser/mod_file_not_exist_windows.rs +++ b/src/test/ui/parser/mod_file_not_exist_windows.rs @@ -1,15 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // only-windows -// compile-flags: -Z parse-only mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file` //~^ HELP name the file either not_a_real_file.rs or not_a_real_file\mod.rs inside the directory diff --git a/src/test/ui/parser/mod_file_not_exist_windows.stderr b/src/test/ui/parser/mod_file_not_exist_windows.stderr index 695038f8e4d..67abd6304d5 100644 --- a/src/test/ui/parser/mod_file_not_exist_windows.stderr +++ b/src/test/ui/parser/mod_file_not_exist_windows.stderr @@ -1,5 +1,5 @@ error[E0583]: file not found for module `not_a_real_file` - --> $DIR/mod_file_not_exist_windows.rs:14:5 + --> $DIR/mod_file_not_exist_windows.rs:3:5 | LL | mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file` | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/parser/mod_file_with_path_attr.rs b/src/test/ui/parser/mod_file_with_path_attr.rs index 03aa8edc229..9450d89e5f5 100644 --- a/src/test/ui/parser/mod_file_with_path_attr.rs +++ b/src/test/ui/parser/mod_file_with_path_attr.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only // normalize-stderr-test: "not_a_real_file.rs:.*\(" -> "not_a_real_file.rs: $$FILE_NOT_FOUND_MSG (" #[path = "not_a_real_file.rs"] diff --git a/src/test/ui/parser/mod_file_with_path_attr.stderr b/src/test/ui/parser/mod_file_with_path_attr.stderr index f4247b60f68..a3a3486dd9e 100644 --- a/src/test/ui/parser/mod_file_with_path_attr.stderr +++ b/src/test/ui/parser/mod_file_with_path_attr.stderr @@ -1,5 +1,5 @@ error: couldn't read $DIR/not_a_real_file.rs: $FILE_NOT_FOUND_MSG (os error 2) - --> $DIR/mod_file_with_path_attr.rs:15:5 + --> $DIR/mod_file_with_path_attr.rs:4:5 | LL | mod m; //~ ERROR not_a_real_file.rs | ^ diff --git a/src/test/ui/parser/multiline-comment-line-tracking.rs b/src/test/ui/parser/multiline-comment-line-tracking.rs index 44ed0a3706c..d4735e8a738 100644 --- a/src/test/ui/parser/multiline-comment-line-tracking.rs +++ b/src/test/ui/parser/multiline-comment-line-tracking.rs @@ -1,20 +1,9 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -// error-pattern:19:3 +// Parse error on line X, but is reported on line Y instead. /* 1 * 2 * 3 */ fn main() { - %; // parse error on line 19, but is reported on line 6 instead. + %; //~ ERROR expected expression, found `%` } diff --git a/src/test/ui/parser/multiline-comment-line-tracking.stderr b/src/test/ui/parser/multiline-comment-line-tracking.stderr index 2dba2b1cb7e..c9404d8b9e4 100644 --- a/src/test/ui/parser/multiline-comment-line-tracking.stderr +++ b/src/test/ui/parser/multiline-comment-line-tracking.stderr @@ -1,7 +1,7 @@ error: expected expression, found `%` - --> $DIR/multiline-comment-line-tracking.rs:19:3 + --> $DIR/multiline-comment-line-tracking.rs:8:3 | -LL | %; // parse error on line 19, but is reported on line 6 instead. +LL | %; //~ ERROR expected expression, found `%` | ^ expected expression error: aborting due to previous error diff --git a/src/test/ui/parser/multitrait.rs b/src/test/ui/parser/multitrait.rs index b7c9b165884..f9b4b37acc0 100644 --- a/src/test/ui/parser/multitrait.rs +++ b/src/test/ui/parser/multitrait.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct S { y: isize } diff --git a/src/test/ui/parser/multitrait.stderr b/src/test/ui/parser/multitrait.stderr index 2ccf49d0315..61dbc823848 100644 --- a/src/test/ui/parser/multitrait.stderr +++ b/src/test/ui/parser/multitrait.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `,` - --> $DIR/multitrait.rs:17:9 + --> $DIR/multitrait.rs:5:9 | LL | impl Cmp, ToString for S { | ^ expected one of 8 possible tokens here diff --git a/src/test/ui/parser/mut-patterns.rs b/src/test/ui/parser/mut-patterns.rs index 71d826c67f8..a5eb4825239 100644 --- a/src/test/ui/parser/mut-patterns.rs +++ b/src/test/ui/parser/mut-patterns.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Can't put mut in non-ident pattern pub fn main() { diff --git a/src/test/ui/parser/mut-patterns.stderr b/src/test/ui/parser/mut-patterns.stderr index afe24595de4..5bbb4ce569f 100644 --- a/src/test/ui/parser/mut-patterns.stderr +++ b/src/test/ui/parser/mut-patterns.stderr @@ -1,5 +1,5 @@ error: expected one of `:`, `;`, `=`, or `@`, found `{` - --> $DIR/mut-patterns.rs:17:17 + --> $DIR/mut-patterns.rs:5:17 | LL | let mut Foo { x: x } = Foo { x: 3 }; //~ ERROR: expected one of `:`, `;`, `=`, or `@`, found `{` | ^ expected one of `:`, `;`, `=`, or `@` here diff --git a/src/test/ui/parser/new-unicode-escapes-1.rs b/src/test/ui/parser/new-unicode-escapes-1.rs index 78a68e846d1..0e1421214d9 100644 --- a/src/test/ui/parser/new-unicode-escapes-1.rs +++ b/src/test/ui/parser/new-unicode-escapes-1.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - pub fn main() { let s = "\u{2603"; //~ ERROR unterminated unicode escape (needed a `}`) } diff --git a/src/test/ui/parser/new-unicode-escapes-1.stderr b/src/test/ui/parser/new-unicode-escapes-1.stderr index 4467b394c93..828e72e56ea 100644 --- a/src/test/ui/parser/new-unicode-escapes-1.stderr +++ b/src/test/ui/parser/new-unicode-escapes-1.stderr @@ -1,5 +1,5 @@ error: unterminated unicode escape (needed a `}`) - --> $DIR/new-unicode-escapes-1.rs:14:21 + --> $DIR/new-unicode-escapes-1.rs:2:21 | LL | let s = "/u{2603"; //~ ERROR unterminated unicode escape (needed a `}`) | ^ diff --git a/src/test/ui/parser/new-unicode-escapes-2.rs b/src/test/ui/parser/new-unicode-escapes-2.rs index cdadaef1b59..b30b3dbf903 100644 --- a/src/test/ui/parser/new-unicode-escapes-2.rs +++ b/src/test/ui/parser/new-unicode-escapes-2.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - pub fn main() { let s = "\u{260311111111}"; //~ ERROR overlong unicode escape (must have at most 6 hex digits) } diff --git a/src/test/ui/parser/new-unicode-escapes-2.stderr b/src/test/ui/parser/new-unicode-escapes-2.stderr index 54123be4214..97ba3fb2cb6 100644 --- a/src/test/ui/parser/new-unicode-escapes-2.stderr +++ b/src/test/ui/parser/new-unicode-escapes-2.stderr @@ -1,5 +1,5 @@ error: overlong unicode escape (must have at most 6 hex digits) - --> $DIR/new-unicode-escapes-2.rs:14:17 + --> $DIR/new-unicode-escapes-2.rs:2:17 | LL | let s = "/u{260311111111}"; //~ ERROR overlong unicode escape (must have at most 6 hex digits) | ^^^^^^^^^^^^ diff --git a/src/test/ui/parser/new-unicode-escapes-3.rs b/src/test/ui/parser/new-unicode-escapes-3.rs index 8189bf67712..295ab08c002 100644 --- a/src/test/ui/parser/new-unicode-escapes-3.rs +++ b/src/test/ui/parser/new-unicode-escapes-3.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - pub fn main() { let s1 = "\u{d805}"; //~ ERROR invalid unicode character escape let s2 = "\u{ffffff}"; //~ ERROR invalid unicode character escape diff --git a/src/test/ui/parser/new-unicode-escapes-3.stderr b/src/test/ui/parser/new-unicode-escapes-3.stderr index 65196f91b08..038002ae05e 100644 --- a/src/test/ui/parser/new-unicode-escapes-3.stderr +++ b/src/test/ui/parser/new-unicode-escapes-3.stderr @@ -1,5 +1,5 @@ error: invalid unicode character escape - --> $DIR/new-unicode-escapes-3.rs:14:14 + --> $DIR/new-unicode-escapes-3.rs:2:14 | LL | let s1 = "/u{d805}"; //~ ERROR invalid unicode character escape | ^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | let s1 = "/u{d805}"; //~ ERROR invalid unicode character escape = help: unicode escape must not be a surrogate error: invalid unicode character escape - --> $DIR/new-unicode-escapes-3.rs:15:14 + --> $DIR/new-unicode-escapes-3.rs:3:14 | LL | let s2 = "/u{ffffff}"; //~ ERROR invalid unicode character escape | ^^^^^^^^^^^^ diff --git a/src/test/ui/parser/new-unicode-escapes-4.rs b/src/test/ui/parser/new-unicode-escapes-4.rs index 8770fb319df..b871000ac12 100644 --- a/src/test/ui/parser/new-unicode-escapes-4.rs +++ b/src/test/ui/parser/new-unicode-escapes-4.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error pub fn main() { let s = "\u{lol}"; diff --git a/src/test/ui/parser/new-unicode-escapes-4.stderr b/src/test/ui/parser/new-unicode-escapes-4.stderr index 309a77e7df0..c8dbe027184 100644 --- a/src/test/ui/parser/new-unicode-escapes-4.stderr +++ b/src/test/ui/parser/new-unicode-escapes-4.stderr @@ -1,5 +1,5 @@ error: invalid character in unicode escape: l - --> $DIR/new-unicode-escapes-4.rs:14:17 + --> $DIR/new-unicode-escapes-4.rs:4:17 | LL | let s = "/u{lol}"; | ^ diff --git a/src/test/ui/parser/no-binary-float-literal.rs b/src/test/ui/parser/no-binary-float-literal.rs index 528a2b1ad33..a42d2cbc442 100644 --- a/src/test/ui/parser/no-binary-float-literal.rs +++ b/src/test/ui/parser/no-binary-float-literal.rs @@ -1,19 +1,8 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -// error-pattern:binary float literal is not supported - fn main() { 0b101010f64; + //~^ ERROR binary float literal is not supported 0b101.010; + //~^ ERROR binary float literal is not supported 0b101p4f64; + //~^ ERROR invalid suffix `p4f64` for numeric literal } diff --git a/src/test/ui/parser/no-binary-float-literal.stderr b/src/test/ui/parser/no-binary-float-literal.stderr index db3c3791daf..21f415bcfb0 100644 --- a/src/test/ui/parser/no-binary-float-literal.stderr +++ b/src/test/ui/parser/no-binary-float-literal.stderr @@ -1,8 +1,22 @@ error: binary float literal is not supported - --> $DIR/no-binary-float-literal.rs:17:5 + --> $DIR/no-binary-float-literal.rs:4:5 | LL | 0b101.010; | ^^^^^^^^^ -error: aborting due to previous error +error: binary float literal is not supported + --> $DIR/no-binary-float-literal.rs:2:5 + | +LL | 0b101010f64; + | ^^^^^^^^^^^ not supported + +error: invalid suffix `p4f64` for numeric literal + --> $DIR/no-binary-float-literal.rs:6:5 + | +LL | 0b101p4f64; + | ^^^^^^^^^^ invalid suffix `p4f64` + | + = help: the suffix must be one of the integral types (`u32`, `isize`, etc) + +error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/no-hex-float-literal.rs b/src/test/ui/parser/no-hex-float-literal.rs index df40fdde866..bf11dee0833 100644 --- a/src/test/ui/parser/no-hex-float-literal.rs +++ b/src/test/ui/parser/no-hex-float-literal.rs @@ -1,19 +1,9 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -// error-pattern:hexadecimal float literal is not supported - fn main() { 0xABC.Df; + //~^ ERROR `{integer}` is a primitive type and therefore doesn't have fields 0x567.89; + //~^ ERROR hexadecimal float literal is not supported 0xDEAD.BEEFp-2f; + //~^ ERROR invalid suffix `f` for float literal + //~| ERROR `{integer}` is a primitive type and therefore doesn't have fields } diff --git a/src/test/ui/parser/no-hex-float-literal.stderr b/src/test/ui/parser/no-hex-float-literal.stderr index dba019baff8..258ab06d5ee 100644 --- a/src/test/ui/parser/no-hex-float-literal.stderr +++ b/src/test/ui/parser/no-hex-float-literal.stderr @@ -1,8 +1,29 @@ error: hexadecimal float literal is not supported - --> $DIR/no-hex-float-literal.rs:17:5 + --> $DIR/no-hex-float-literal.rs:4:5 | LL | 0x567.89; | ^^^^^^^^ -error: aborting due to previous error +error: invalid suffix `f` for float literal + --> $DIR/no-hex-float-literal.rs:6:18 + | +LL | 0xDEAD.BEEFp-2f; + | ^^ invalid suffix `f` + | + = help: valid suffixes are `f32` and `f64` + +error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields + --> $DIR/no-hex-float-literal.rs:2:11 + | +LL | 0xABC.Df; + | ^^ + +error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields + --> $DIR/no-hex-float-literal.rs:6:12 + | +LL | 0xDEAD.BEEFp-2f; + | ^^^^^ + +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0610`. diff --git a/src/test/ui/parser/no-unsafe-self.rs b/src/test/ui/parser/no-unsafe-self.rs index 22baf88b43f..57201f2d91a 100644 --- a/src/test/ui/parser/no-unsafe-self.rs +++ b/src/test/ui/parser/no-unsafe-self.rs @@ -1,14 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error trait A { fn foo(*mut self); //~ ERROR cannot pass `self` by raw pointer diff --git a/src/test/ui/parser/no-unsafe-self.stderr b/src/test/ui/parser/no-unsafe-self.stderr index 7fe66bffd86..84779b09dc7 100644 --- a/src/test/ui/parser/no-unsafe-self.stderr +++ b/src/test/ui/parser/no-unsafe-self.stderr @@ -1,38 +1,38 @@ error: cannot pass `self` by raw pointer - --> $DIR/no-unsafe-self.rs:14:17 + --> $DIR/no-unsafe-self.rs:4:17 | LL | fn foo(*mut self); //~ ERROR cannot pass `self` by raw pointer - | ^^^^ + | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer - --> $DIR/no-unsafe-self.rs:15:19 + --> $DIR/no-unsafe-self.rs:5:19 | LL | fn baz(*const self); //~ ERROR cannot pass `self` by raw pointer - | ^^^^ + | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer - --> $DIR/no-unsafe-self.rs:16:13 + --> $DIR/no-unsafe-self.rs:6:13 | LL | fn bar(*self); //~ ERROR cannot pass `self` by raw pointer - | ^^^^ + | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer - --> $DIR/no-unsafe-self.rs:21:17 + --> $DIR/no-unsafe-self.rs:11:17 | LL | fn foo(*mut self) { } //~ ERROR cannot pass `self` by raw pointer - | ^^^^ + | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer - --> $DIR/no-unsafe-self.rs:22:19 + --> $DIR/no-unsafe-self.rs:12:19 | LL | fn baz(*const self) { } //~ ERROR cannot pass `self` by raw pointer - | ^^^^ + | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer - --> $DIR/no-unsafe-self.rs:23:13 + --> $DIR/no-unsafe-self.rs:13:13 | LL | fn bar(*self) { } //~ ERROR cannot pass `self` by raw pointer - | ^^^^ + | ^^^^ cannot pass `self` by raw pointer error: aborting due to 6 previous errors diff --git a/src/test/ui/parser/not-a-pred.rs b/src/test/ui/parser/not-a-pred.rs index d880c06f8a1..e6a02d5fc56 100644 --- a/src/test/ui/parser/not-a-pred.rs +++ b/src/test/ui/parser/not-a-pred.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // error-pattern: lt fn f(a: isize, b: isize) : lt(a, b) { } diff --git a/src/test/ui/parser/not-a-pred.stderr b/src/test/ui/parser/not-a-pred.stderr index 15558043737..46d6038e802 100644 --- a/src/test/ui/parser/not-a-pred.stderr +++ b/src/test/ui/parser/not-a-pred.stderr @@ -1,5 +1,5 @@ error: expected one of `->`, `where`, or `{`, found `:` - --> $DIR/not-a-pred.rs:15:26 + --> $DIR/not-a-pred.rs:3:26 | LL | fn f(a: isize, b: isize) : lt(a, b) { } | ^ expected one of `->`, `where`, or `{` here diff --git a/src/test/ui/parser/omitted-arg-in-item-fn.rs b/src/test/ui/parser/omitted-arg-in-item-fn.rs index 388b7c8772e..5ee9daf4640 100644 --- a/src/test/ui/parser/omitted-arg-in-item-fn.rs +++ b/src/test/ui/parser/omitted-arg-in-item-fn.rs @@ -1,14 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn foo(x) { //~ ERROR expected one of `:` or `@`, found `)` } + +fn main() {} diff --git a/src/test/ui/parser/omitted-arg-in-item-fn.stderr b/src/test/ui/parser/omitted-arg-in-item-fn.stderr index 4e051b6206f..b21a1bd0831 100644 --- a/src/test/ui/parser/omitted-arg-in-item-fn.stderr +++ b/src/test/ui/parser/omitted-arg-in-item-fn.stderr @@ -1,5 +1,5 @@ error: expected one of `:` or `@`, found `)` - --> $DIR/omitted-arg-in-item-fn.rs:13:9 + --> $DIR/omitted-arg-in-item-fn.rs:1:9 | LL | fn foo(x) { //~ ERROR expected one of `:` or `@`, found `)` | ^ expected one of `:` or `@` here diff --git a/src/test/ui/parser/paamayim-nekudotayim.rs b/src/test/ui/parser/paamayim-nekudotayim.rs index 3466fc6e71a..cb151d652e1 100644 --- a/src/test/ui/parser/paamayim-nekudotayim.rs +++ b/src/test/ui/parser/paamayim-nekudotayim.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // http://phpsadness.com/sad/1 fn main() { diff --git a/src/test/ui/parser/paamayim-nekudotayim.stderr b/src/test/ui/parser/paamayim-nekudotayim.stderr index 68912f52dc1..6423aa2dc2f 100644 --- a/src/test/ui/parser/paamayim-nekudotayim.stderr +++ b/src/test/ui/parser/paamayim-nekudotayim.stderr @@ -1,5 +1,5 @@ error: expected identifier, found `;` - --> $DIR/paamayim-nekudotayim.rs:16:7 + --> $DIR/paamayim-nekudotayim.rs:4:7 | LL | ::; //~ ERROR expected identifier, found `;` | ^ expected identifier diff --git a/src/test/ui/parser/paren-after-qualified-path-in-match.rs b/src/test/ui/parser/paren-after-qualified-path-in-match.rs index d3aa4b72b78..68b1c2baf10 100644 --- a/src/test/ui/parser/paren-after-qualified-path-in-match.rs +++ b/src/test/ui/parser/paren-after-qualified-path-in-match.rs @@ -1,17 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -fn foo() { - match x { +fn main() { + match 10 { ::Type(2) => (), //~^ ERROR unexpected `(` after qualified path _ => (), diff --git a/src/test/ui/parser/paren-after-qualified-path-in-match.stderr b/src/test/ui/parser/paren-after-qualified-path-in-match.stderr index df3a5011fd8..79460e01f25 100644 --- a/src/test/ui/parser/paren-after-qualified-path-in-match.stderr +++ b/src/test/ui/parser/paren-after-qualified-path-in-match.stderr @@ -1,5 +1,5 @@ error: unexpected `(` after qualified path - --> $DIR/paren-after-qualified-path-in-match.rs:15:27 + --> $DIR/paren-after-qualified-path-in-match.rs:3:27 | LL | ::Type(2) => (), | ^ unexpected `(` after qualified path diff --git a/src/test/ui/parser/pat-lt-bracket-1.rs b/src/test/ui/parser/pat-lt-bracket-1.rs index fc1957571b1..2e2001434f2 100644 --- a/src/test/ui/parser/pat-lt-bracket-1.rs +++ b/src/test/ui/parser/pat-lt-bracket-1.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { match 42 { x < 7 => (), diff --git a/src/test/ui/parser/pat-lt-bracket-1.stderr b/src/test/ui/parser/pat-lt-bracket-1.stderr index 5ab5ce2649a..1bf27161513 100644 --- a/src/test/ui/parser/pat-lt-bracket-1.stderr +++ b/src/test/ui/parser/pat-lt-bracket-1.stderr @@ -1,5 +1,5 @@ error: expected one of `=>`, `@`, `if`, or `|`, found `<` - --> $DIR/pat-lt-bracket-1.rs:15:7 + --> $DIR/pat-lt-bracket-1.rs:3:7 | LL | x < 7 => (), | ^ expected one of `=>`, `@`, `if`, or `|` here diff --git a/src/test/ui/parser/pat-lt-bracket-2.rs b/src/test/ui/parser/pat-lt-bracket-2.rs index a88e8384711..6eb01c1c933 100644 --- a/src/test/ui/parser/pat-lt-bracket-2.rs +++ b/src/test/ui/parser/pat-lt-bracket-2.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn a(B<) {} //~^ error: expected one of `:` or `@`, found `<` + +fn main() {} diff --git a/src/test/ui/parser/pat-lt-bracket-2.stderr b/src/test/ui/parser/pat-lt-bracket-2.stderr index d0d815045e0..cce1a17e9e8 100644 --- a/src/test/ui/parser/pat-lt-bracket-2.stderr +++ b/src/test/ui/parser/pat-lt-bracket-2.stderr @@ -1,5 +1,5 @@ error: expected one of `:` or `@`, found `<` - --> $DIR/pat-lt-bracket-2.rs:13:7 + --> $DIR/pat-lt-bracket-2.rs:1:7 | LL | fn a(B<) {} | ^ expected one of `:` or `@` here diff --git a/src/test/ui/parser/pat-lt-bracket-3.rs b/src/test/ui/parser/pat-lt-bracket-3.rs index 1a3f7aa8182..a8bdfd3fa18 100644 --- a/src/test/ui/parser/pat-lt-bracket-3.rs +++ b/src/test/ui/parser/pat-lt-bracket-3.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct Foo(T, T); impl Foo { @@ -22,3 +10,5 @@ impl Foo { } } } + +fn main() {} diff --git a/src/test/ui/parser/pat-lt-bracket-3.stderr b/src/test/ui/parser/pat-lt-bracket-3.stderr index 1be61b1a12b..536d14e1b65 100644 --- a/src/test/ui/parser/pat-lt-bracket-3.stderr +++ b/src/test/ui/parser/pat-lt-bracket-3.stderr @@ -1,5 +1,5 @@ error: expected one of `=>`, `@`, `if`, or `|`, found `<` - --> $DIR/pat-lt-bracket-3.rs:18:16 + --> $DIR/pat-lt-bracket-3.rs:6:16 | LL | Foo(x, y) => { | ^ expected one of `=>`, `@`, `if`, or `|` here diff --git a/src/test/ui/parser/pat-lt-bracket-4.rs b/src/test/ui/parser/pat-lt-bracket-4.rs index a163b38b492..de314f6c641 100644 --- a/src/test/ui/parser/pat-lt-bracket-4.rs +++ b/src/test/ui/parser/pat-lt-bracket-4.rs @@ -1,22 +1,10 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - enum BtNode { Node(u32,Box,Box), Leaf(u32), } fn main() { - let y = match x { + let y = match 10 { Foo::A(value) => value, //~ error: expected one of `=>`, `@`, `if`, or `|`, found `<` Foo::B => 7, }; diff --git a/src/test/ui/parser/pat-lt-bracket-4.stderr b/src/test/ui/parser/pat-lt-bracket-4.stderr index 4a0dec1b5c6..18e0e9e8f0c 100644 --- a/src/test/ui/parser/pat-lt-bracket-4.stderr +++ b/src/test/ui/parser/pat-lt-bracket-4.stderr @@ -1,5 +1,5 @@ error: expected one of `=>`, `@`, `if`, or `|`, found `<` - --> $DIR/pat-lt-bracket-4.rs:20:12 + --> $DIR/pat-lt-bracket-4.rs:8:12 | LL | Foo::A(value) => value, //~ error: expected one of `=>`, `@`, `if`, or `|`, found `<` | ^ expected one of `=>`, `@`, `if`, or `|` here diff --git a/src/test/ui/parser/pat-lt-bracket-5.rs b/src/test/ui/parser/pat-lt-bracket-5.rs index 160b985dc6e..c4b9dd469f5 100644 --- a/src/test/ui/parser/pat-lt-bracket-5.rs +++ b/src/test/ui/parser/pat-lt-bracket-5.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let v[0] = v[1]; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `[` } diff --git a/src/test/ui/parser/pat-lt-bracket-5.stderr b/src/test/ui/parser/pat-lt-bracket-5.stderr index 6174ed63007..7e76a04ce6f 100644 --- a/src/test/ui/parser/pat-lt-bracket-5.stderr +++ b/src/test/ui/parser/pat-lt-bracket-5.stderr @@ -1,5 +1,5 @@ error: expected one of `:`, `;`, `=`, or `@`, found `[` - --> $DIR/pat-lt-bracket-5.rs:14:10 + --> $DIR/pat-lt-bracket-5.rs:2:10 | LL | let v[0] = v[1]; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `[` | ^ expected one of `:`, `;`, `=`, or `@` here diff --git a/src/test/ui/parser/pat-lt-bracket-6.rs b/src/test/ui/parser/pat-lt-bracket-6.rs index eaea9f4acd7..9bad0cb25c1 100644 --- a/src/test/ui/parser/pat-lt-bracket-6.rs +++ b/src/test/ui/parser/pat-lt-bracket-6.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let Test(&desc[..]) = x; //~ ERROR: expected one of `)`, `,`, or `@`, found `[` } diff --git a/src/test/ui/parser/pat-lt-bracket-6.stderr b/src/test/ui/parser/pat-lt-bracket-6.stderr index 9666f18fac5..bf5b6190761 100644 --- a/src/test/ui/parser/pat-lt-bracket-6.stderr +++ b/src/test/ui/parser/pat-lt-bracket-6.stderr @@ -1,5 +1,5 @@ error: expected one of `)`, `,`, or `@`, found `[` - --> $DIR/pat-lt-bracket-6.rs:14:19 + --> $DIR/pat-lt-bracket-6.rs:2:19 | LL | let Test(&desc[..]) = x; //~ ERROR: expected one of `)`, `,`, or `@`, found `[` | ^ expected one of `)`, `,`, or `@` here diff --git a/src/test/ui/parser/pat-lt-bracket-7.rs b/src/test/ui/parser/pat-lt-bracket-7.rs index ac1c1f7ee1f..36c0d773373 100644 --- a/src/test/ui/parser/pat-lt-bracket-7.rs +++ b/src/test/ui/parser/pat-lt-bracket-7.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { for thing(x[]) in foo {} //~ ERROR: expected one of `)`, `,`, or `@`, found `[` } diff --git a/src/test/ui/parser/pat-lt-bracket-7.stderr b/src/test/ui/parser/pat-lt-bracket-7.stderr index 09a398fb2b0..44394c30021 100644 --- a/src/test/ui/parser/pat-lt-bracket-7.stderr +++ b/src/test/ui/parser/pat-lt-bracket-7.stderr @@ -1,5 +1,5 @@ error: expected one of `)`, `,`, or `@`, found `[` - --> $DIR/pat-lt-bracket-7.rs:14:16 + --> $DIR/pat-lt-bracket-7.rs:2:16 | LL | for thing(x[]) in foo {} //~ ERROR: expected one of `)`, `,`, or `@`, found `[` | ^ expected one of `)`, `,`, or `@` here diff --git a/src/test/ui/parser/pat-ranges-1.rs b/src/test/ui/parser/pat-ranges-1.rs index 7aa02871018..ce953b2eb22 100644 --- a/src/test/ui/parser/pat-ranges-1.rs +++ b/src/test/ui/parser/pat-ranges-1.rs @@ -1,17 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Parsing of range patterns -// compile-flags: -Z parse-only - fn main() { let macropus!() ..= 11 = 12; //~ error: expected one of `:`, `;`, or `=`, found `..=` } diff --git a/src/test/ui/parser/pat-ranges-1.stderr b/src/test/ui/parser/pat-ranges-1.stderr index 61d1bf258fe..378caf63000 100644 --- a/src/test/ui/parser/pat-ranges-1.stderr +++ b/src/test/ui/parser/pat-ranges-1.stderr @@ -1,5 +1,5 @@ error: expected one of `:`, `;`, or `=`, found `..=` - --> $DIR/pat-ranges-1.rs:16:21 + --> $DIR/pat-ranges-1.rs:4:21 | LL | let macropus!() ..= 11 = 12; //~ error: expected one of `:`, `;`, or `=`, found `..=` | ^^^ expected one of `:`, `;`, or `=` here diff --git a/src/test/ui/parser/pat-ranges-2.rs b/src/test/ui/parser/pat-ranges-2.rs index 123aa0d5088..9f736ed328c 100644 --- a/src/test/ui/parser/pat-ranges-2.rs +++ b/src/test/ui/parser/pat-ranges-2.rs @@ -1,17 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Parsing of range patterns -// compile-flags: -Z parse-only - fn main() { let 10 ..= makropulos!() = 12; //~ error: expected one of `::`, `:`, `;`, or `=`, found `!` } diff --git a/src/test/ui/parser/pat-ranges-2.stderr b/src/test/ui/parser/pat-ranges-2.stderr index 29f641f2be4..ef8b4f94ef4 100644 --- a/src/test/ui/parser/pat-ranges-2.stderr +++ b/src/test/ui/parser/pat-ranges-2.stderr @@ -1,5 +1,5 @@ error: expected one of `::`, `:`, `;`, or `=`, found `!` - --> $DIR/pat-ranges-2.rs:16:26 + --> $DIR/pat-ranges-2.rs:4:26 | LL | let 10 ..= makropulos!() = 12; //~ error: expected one of `::`, `:`, `;`, or `=`, found `!` | ^ expected one of `::`, `:`, `;`, or `=` here diff --git a/src/test/ui/parser/pat-ranges-3.rs b/src/test/ui/parser/pat-ranges-3.rs index 6384b606219..65da55e3bda 100644 --- a/src/test/ui/parser/pat-ranges-3.rs +++ b/src/test/ui/parser/pat-ranges-3.rs @@ -1,17 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Parsing of range patterns -// compile-flags: -Z parse-only - fn main() { let 10 ..= 10 + 3 = 12; //~ expected one of `:`, `;`, or `=`, found `+` } diff --git a/src/test/ui/parser/pat-ranges-3.stderr b/src/test/ui/parser/pat-ranges-3.stderr index c78c43cddbf..f923228710b 100644 --- a/src/test/ui/parser/pat-ranges-3.stderr +++ b/src/test/ui/parser/pat-ranges-3.stderr @@ -1,5 +1,5 @@ error: expected one of `:`, `;`, or `=`, found `+` - --> $DIR/pat-ranges-3.rs:16:19 + --> $DIR/pat-ranges-3.rs:4:19 | LL | let 10 ..= 10 + 3 = 12; //~ expected one of `:`, `;`, or `=`, found `+` | ^ expected one of `:`, `;`, or `=` here diff --git a/src/test/ui/parser/pat-ranges-4.rs b/src/test/ui/parser/pat-ranges-4.rs index 023e5b40797..7f4a5f3239e 100644 --- a/src/test/ui/parser/pat-ranges-4.rs +++ b/src/test/ui/parser/pat-ranges-4.rs @@ -1,17 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Parsing of range patterns -// compile-flags: -Z parse-only - fn main() { let 10 - 3 ..= 10 = 8; //~^ error: expected one of `...`, `..=`, `..`, `:`, `;`, or `=`, found `-` diff --git a/src/test/ui/parser/pat-ranges-4.stderr b/src/test/ui/parser/pat-ranges-4.stderr index 40b7fc8f753..0a1d7a1f6b8 100644 --- a/src/test/ui/parser/pat-ranges-4.stderr +++ b/src/test/ui/parser/pat-ranges-4.stderr @@ -1,5 +1,5 @@ error: expected one of `...`, `..=`, `..`, `:`, `;`, or `=`, found `-` - --> $DIR/pat-ranges-4.rs:16:12 + --> $DIR/pat-ranges-4.rs:4:12 | LL | let 10 - 3 ..= 10 = 8; | ^ expected one of `...`, `..=`, `..`, `:`, `;`, or `=` here diff --git a/src/test/ui/parser/pat-ref-enum.rs b/src/test/ui/parser/pat-ref-enum.rs index cf802572659..412dd141de0 100644 --- a/src/test/ui/parser/pat-ref-enum.rs +++ b/src/test/ui/parser/pat-ref-enum.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn matcher(x: Option) { match x { ref Some(i) => {} //~ ERROR expected identifier, found enum pattern diff --git a/src/test/ui/parser/pat-ref-enum.stderr b/src/test/ui/parser/pat-ref-enum.stderr index 5e39b6d8fa9..8729e8c5854 100644 --- a/src/test/ui/parser/pat-ref-enum.stderr +++ b/src/test/ui/parser/pat-ref-enum.stderr @@ -1,5 +1,5 @@ error: expected identifier, found enum pattern - --> $DIR/pat-ref-enum.rs:15:11 + --> $DIR/pat-ref-enum.rs:3:11 | LL | ref Some(i) => {} //~ ERROR expected identifier, found enum pattern | ^^^^ diff --git a/src/test/ui/parser/pat-tuple-1.rs b/src/test/ui/parser/pat-tuple-1.rs index 945d0740654..213fbe371d4 100644 --- a/src/test/ui/parser/pat-tuple-1.rs +++ b/src/test/ui/parser/pat-tuple-1.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { match 0 { (, ..) => {} //~ ERROR expected pattern, found `,` diff --git a/src/test/ui/parser/pat-tuple-1.stderr b/src/test/ui/parser/pat-tuple-1.stderr index eb970e6e220..33c69deda42 100644 --- a/src/test/ui/parser/pat-tuple-1.stderr +++ b/src/test/ui/parser/pat-tuple-1.stderr @@ -1,5 +1,5 @@ error: expected pattern, found `,` - --> $DIR/pat-tuple-1.rs:15:10 + --> $DIR/pat-tuple-1.rs:3:10 | LL | (, ..) => {} //~ ERROR expected pattern, found `,` | ^ expected pattern diff --git a/src/test/ui/parser/pat-tuple-2.rs b/src/test/ui/parser/pat-tuple-2.rs index 07b391d3279..fd25499381a 100644 --- a/src/test/ui/parser/pat-tuple-2.rs +++ b/src/test/ui/parser/pat-tuple-2.rs @@ -1,17 +1,6 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { - match 0 { - (pat, ..,) => {} //~ ERROR trailing comma is not permitted after `..` + match (0, 1, 2) { + (pat, ..,) => {} + //~^ ERROR trailing comma is not permitted after `..` } } diff --git a/src/test/ui/parser/pat-tuple-2.stderr b/src/test/ui/parser/pat-tuple-2.stderr index cedc98ace64..c3a5c39a8e3 100644 --- a/src/test/ui/parser/pat-tuple-2.stderr +++ b/src/test/ui/parser/pat-tuple-2.stderr @@ -1,8 +1,8 @@ error: trailing comma is not permitted after `..` - --> $DIR/pat-tuple-2.rs:15:17 + --> $DIR/pat-tuple-2.rs:3:17 | -LL | (pat, ..,) => {} //~ ERROR trailing comma is not permitted after `..` - | ^ +LL | (pat, ..,) => {} + | ^ trailing comma is not permitted after `..` error: aborting due to previous error diff --git a/src/test/ui/parser/pat-tuple-3.rs b/src/test/ui/parser/pat-tuple-3.rs index 029dc7a2956..e1e975d3c3e 100644 --- a/src/test/ui/parser/pat-tuple-3.rs +++ b/src/test/ui/parser/pat-tuple-3.rs @@ -1,17 +1,6 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { - match 0 { - (.., pat, ..) => {} //~ ERROR `..` can only be used once per tuple or tuple struct pattern + match (0, 1, 2) { + (.., pat, ..) => {} + //~^ ERROR `..` can only be used once per tuple or tuple struct pattern } } diff --git a/src/test/ui/parser/pat-tuple-3.stderr b/src/test/ui/parser/pat-tuple-3.stderr index 28662f74142..0ad7d27b94e 100644 --- a/src/test/ui/parser/pat-tuple-3.stderr +++ b/src/test/ui/parser/pat-tuple-3.stderr @@ -1,8 +1,8 @@ error: `..` can only be used once per tuple or tuple struct pattern - --> $DIR/pat-tuple-3.rs:15:19 + --> $DIR/pat-tuple-3.rs:3:19 | -LL | (.., pat, ..) => {} //~ ERROR `..` can only be used once per tuple or tuple struct pattern - | ^^ +LL | (.., pat, ..) => {} + | ^^ can only be used once per pattern error: aborting due to previous error diff --git a/src/test/ui/parser/pat-tuple-4.rs b/src/test/ui/parser/pat-tuple-4.rs index f4c3afa07f1..76f60d94bc8 100644 --- a/src/test/ui/parser/pat-tuple-4.rs +++ b/src/test/ui/parser/pat-tuple-4.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { match 0 { (.. pat) => {} //~ ERROR expected one of `)` or `,`, found `pat` diff --git a/src/test/ui/parser/pat-tuple-4.stderr b/src/test/ui/parser/pat-tuple-4.stderr index 586baddc363..fe4b4deaa60 100644 --- a/src/test/ui/parser/pat-tuple-4.stderr +++ b/src/test/ui/parser/pat-tuple-4.stderr @@ -1,5 +1,5 @@ error: expected one of `)` or `,`, found `pat` - --> $DIR/pat-tuple-4.rs:15:13 + --> $DIR/pat-tuple-4.rs:3:13 | LL | (.. pat) => {} //~ ERROR expected one of `)` or `,`, found `pat` | ^^^ expected one of `)` or `,` here diff --git a/src/test/ui/parser/pat-tuple-5.rs b/src/test/ui/parser/pat-tuple-5.rs index d528b97b5de..03176abaf49 100644 --- a/src/test/ui/parser/pat-tuple-5.rs +++ b/src/test/ui/parser/pat-tuple-5.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { match 0 { (pat ..) => {} //~ ERROR unexpected token: `)` diff --git a/src/test/ui/parser/pat-tuple-5.stderr b/src/test/ui/parser/pat-tuple-5.stderr index 1e192cfe598..2ca10f69760 100644 --- a/src/test/ui/parser/pat-tuple-5.stderr +++ b/src/test/ui/parser/pat-tuple-5.stderr @@ -1,5 +1,5 @@ error: unexpected token: `)` - --> $DIR/pat-tuple-5.rs:15:14 + --> $DIR/pat-tuple-5.rs:3:14 | LL | (pat ..) => {} //~ ERROR unexpected token: `)` | ^^ diff --git a/src/test/ui/parser/pub-method-macro.rs b/src/test/ui/parser/pub-method-macro.rs index 817a9465ef3..f04af1a0d65 100644 --- a/src/test/ui/parser/pub-method-macro.rs +++ b/src/test/ui/parser/pub-method-macro.rs @@ -1,17 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #18317 -// compile-flags: -Z parse-only - mod bleh { macro_rules! defn { ($n:ident) => ( diff --git a/src/test/ui/parser/pub-method-macro.stderr b/src/test/ui/parser/pub-method-macro.stderr index 91151ce7279..2b4920a792f 100644 --- a/src/test/ui/parser/pub-method-macro.stderr +++ b/src/test/ui/parser/pub-method-macro.stderr @@ -1,5 +1,5 @@ error: can't qualify macro invocation with `pub` - --> $DIR/pub-method-macro.rs:29:9 + --> $DIR/pub-method-macro.rs:17:9 | LL | pub defn!(f); //~ ERROR can't qualify macro invocation with `pub` | ^^^ diff --git a/src/test/ui/parser/range-3.rs b/src/test/ui/parser/range-3.rs index 95aa71b0cdf..931839fb282 100644 --- a/src/test/ui/parser/range-3.rs +++ b/src/test/ui/parser/range-3.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Test range syntax - syntax errors. pub fn main() { diff --git a/src/test/ui/parser/range-3.stderr b/src/test/ui/parser/range-3.stderr index b8185862b3a..92c33487ee4 100644 --- a/src/test/ui/parser/range-3.stderr +++ b/src/test/ui/parser/range-3.stderr @@ -1,5 +1,5 @@ error: expected one of `.`, `;`, `?`, or an operator, found `..` - --> $DIR/range-3.rs:16:17 + --> $DIR/range-3.rs:4:17 | LL | let r = 1..2..3; | ^^ expected one of `.`, `;`, `?`, or an operator here diff --git a/src/test/ui/parser/range-4.rs b/src/test/ui/parser/range-4.rs index 4500df116a2..20af9567205 100644 --- a/src/test/ui/parser/range-4.rs +++ b/src/test/ui/parser/range-4.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Test range syntax - syntax errors. pub fn main() { diff --git a/src/test/ui/parser/range-4.stderr b/src/test/ui/parser/range-4.stderr index b5013f2e003..90ec46165e7 100644 --- a/src/test/ui/parser/range-4.stderr +++ b/src/test/ui/parser/range-4.stderr @@ -1,5 +1,5 @@ error: expected one of `.`, `;`, `?`, or an operator, found `..` - --> $DIR/range-4.rs:16:16 + --> $DIR/range-4.rs:4:16 | LL | let r = ..1..2; | ^^ expected one of `.`, `;`, `?`, or an operator here diff --git a/src/test/ui/parser/range_inclusive.rs b/src/test/ui/parser/range_inclusive.rs index 0d344cf6444..bc61c5b49ea 100644 --- a/src/test/ui/parser/range_inclusive.rs +++ b/src/test/ui/parser/range_inclusive.rs @@ -1,17 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure that inclusive ranges with no end point don't parse. -// compile-flags: -Z parse-only - pub fn main() { for _ in 1..= {} //~ERROR inclusive range with no end //~^HELP bounded at the end diff --git a/src/test/ui/parser/range_inclusive.stderr b/src/test/ui/parser/range_inclusive.stderr index 90b7c089103..f50b2fa49fb 100644 --- a/src/test/ui/parser/range_inclusive.stderr +++ b/src/test/ui/parser/range_inclusive.stderr @@ -1,5 +1,5 @@ error[E0586]: inclusive range with no end - --> $DIR/range_inclusive.rs:16:19 + --> $DIR/range_inclusive.rs:4:19 | LL | for _ in 1..= {} //~ERROR inclusive range with no end | ^ diff --git a/src/test/ui/parser/range_inclusive_dotdotdot.rs b/src/test/ui/parser/range_inclusive_dotdotdot.rs index 34b96a59c2d..a780304c2d5 100644 --- a/src/test/ui/parser/range_inclusive_dotdotdot.rs +++ b/src/test/ui/parser/range_inclusive_dotdotdot.rs @@ -1,14 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error // Make sure that inclusive ranges with `...` syntax don't parse. diff --git a/src/test/ui/parser/range_inclusive_dotdotdot.stderr b/src/test/ui/parser/range_inclusive_dotdotdot.stderr index 7e1df24fc06..9fad20848a6 100644 --- a/src/test/ui/parser/range_inclusive_dotdotdot.stderr +++ b/src/test/ui/parser/range_inclusive_dotdotdot.stderr @@ -1,5 +1,5 @@ error: unexpected token: `...` - --> $DIR/range_inclusive_dotdotdot.rs:18:12 + --> $DIR/range_inclusive_dotdotdot.rs:8:12 | LL | return ...1; //~ERROR unexpected token: `...` | ^^^ @@ -13,7 +13,7 @@ LL | return ..=1; //~ERROR unexpected token: `...` | ^^^ error: unexpected token: `...` - --> $DIR/range_inclusive_dotdotdot.rs:24:13 + --> $DIR/range_inclusive_dotdotdot.rs:14:13 | LL | let x = ...0; //~ERROR unexpected token: `...` | ^^^ @@ -27,7 +27,7 @@ LL | let x = ..=0; //~ERROR unexpected token: `...` | ^^^ error: unexpected token: `...` - --> $DIR/range_inclusive_dotdotdot.rs:28:14 + --> $DIR/range_inclusive_dotdotdot.rs:18:14 | LL | let x = 5...5; //~ERROR unexpected token: `...` | ^^^ @@ -41,7 +41,7 @@ LL | let x = 5..=5; //~ERROR unexpected token: `...` | ^^^ error: unexpected token: `...` - --> $DIR/range_inclusive_dotdotdot.rs:32:15 + --> $DIR/range_inclusive_dotdotdot.rs:22:15 | LL | for _ in 0...1 {} //~ERROR unexpected token: `...` | ^^^ diff --git a/src/test/ui/parser/raw-byte-string-eof.rs b/src/test/ui/parser/raw-byte-string-eof.rs index 4b8bb31d19a..b74907b72b0 100644 --- a/src/test/ui/parser/raw-byte-string-eof.rs +++ b/src/test/ui/parser/raw-byte-string-eof.rs @@ -1,16 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - - pub fn main() { br##"a"#; //~ unterminated raw string } diff --git a/src/test/ui/parser/raw-byte-string-eof.stderr b/src/test/ui/parser/raw-byte-string-eof.stderr index 4c8a3bfa644..071cd6241da 100644 --- a/src/test/ui/parser/raw-byte-string-eof.stderr +++ b/src/test/ui/parser/raw-byte-string-eof.stderr @@ -1,5 +1,5 @@ error: unterminated raw string - --> $DIR/raw-byte-string-eof.rs:15:6 + --> $DIR/raw-byte-string-eof.rs:2:6 | LL | br##"a"#; //~ unterminated raw string | ^ unterminated raw string diff --git a/src/test/ui/parser/raw-byte-string-literals.rs b/src/test/ui/parser/raw-byte-string-literals.rs index 2e33f98add6..2800e4090cf 100644 --- a/src/test/ui/parser/raw-byte-string-literals.rs +++ b/src/test/ui/parser/raw-byte-string-literals.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error pub fn main() { diff --git a/src/test/ui/parser/raw-byte-string-literals.stderr b/src/test/ui/parser/raw-byte-string-literals.stderr index b5a379fc378..1131e0015bb 100644 --- a/src/test/ui/parser/raw-byte-string-literals.stderr +++ b/src/test/ui/parser/raw-byte-string-literals.stderr @@ -1,11 +1,11 @@ error: raw byte string must be ASCII: /u{e9} - --> $DIR/raw-byte-string-literals.rs:15:8 + --> $DIR/raw-byte-string-literals.rs:5:8 | LL | br"é"; //~ ERROR raw byte string must be ASCII | ^ error: found invalid character; only `#` is allowed in raw string delimitation: ~ - --> $DIR/raw-byte-string-literals.rs:16:6 + --> $DIR/raw-byte-string-literals.rs:6:6 | LL | br##~"a"~##; //~ ERROR only `#` is allowed in raw string delimitation | ^^^ diff --git a/src/test/ui/parser/raw-str-delim.rs b/src/test/ui/parser/raw-str-delim.rs index 8c0027287de..2f13893cecd 100644 --- a/src/test/ui/parser/raw-str-delim.rs +++ b/src/test/ui/parser/raw-str-delim.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - static s: &'static str = r#~"#"~# //~ ERROR found invalid character; only `#` is allowed in raw string delimitation ; diff --git a/src/test/ui/parser/raw-str-delim.stderr b/src/test/ui/parser/raw-str-delim.stderr index 307550081d5..47fd331969d 100644 --- a/src/test/ui/parser/raw-str-delim.stderr +++ b/src/test/ui/parser/raw-str-delim.stderr @@ -1,5 +1,5 @@ error: found invalid character; only `#` is allowed in raw string delimitation: ~ - --> $DIR/raw-str-delim.rs:14:5 + --> $DIR/raw-str-delim.rs:2:5 | LL | r#~"#"~# //~ ERROR found invalid character; only `#` is allowed in raw string delimitation | ^^ diff --git a/src/test/ui/parser/raw-str-unbalanced.rs b/src/test/ui/parser/raw-str-unbalanced.rs index 5c09f68970b..5a1d1be11b6 100644 --- a/src/test/ui/parser/raw-str-unbalanced.rs +++ b/src/test/ui/parser/raw-str-unbalanced.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - static s: &'static str = r#" "## //~ ERROR expected one of `.`, `;`, `?`, or an operator, found `#` diff --git a/src/test/ui/parser/raw-str-unbalanced.stderr b/src/test/ui/parser/raw-str-unbalanced.stderr index 666faaabc10..6dedcfb6a0a 100644 --- a/src/test/ui/parser/raw-str-unbalanced.stderr +++ b/src/test/ui/parser/raw-str-unbalanced.stderr @@ -1,5 +1,5 @@ error: expected one of `.`, `;`, `?`, or an operator, found `#` - --> $DIR/raw-str-unbalanced.rs:15:9 + --> $DIR/raw-str-unbalanced.rs:3:9 | LL | "## //~ ERROR expected one of `.`, `;`, `?`, or an operator, found `#` | ^ expected one of `.`, `;`, `?`, or an operator here diff --git a/src/test/ui/parser/raw-str-unterminated.rs b/src/test/ui/parser/raw-str-unterminated.rs index c37239ac42c..fd317295561 100644 --- a/src/test/ui/parser/raw-str-unterminated.rs +++ b/src/test/ui/parser/raw-str-unterminated.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - static s: &'static str = r#" string literal goes on and on diff --git a/src/test/ui/parser/raw-str-unterminated.stderr b/src/test/ui/parser/raw-str-unterminated.stderr index a7d1ad227d2..67792eb91e5 100644 --- a/src/test/ui/parser/raw-str-unterminated.stderr +++ b/src/test/ui/parser/raw-str-unterminated.stderr @@ -1,5 +1,5 @@ error: unterminated raw string - --> $DIR/raw-str-unterminated.rs:14:5 + --> $DIR/raw-str-unterminated.rs:2:5 | LL | r#" string literal goes on | ^ unterminated raw string diff --git a/src/test/ui/parser/raw/raw-literal-keywords.rs b/src/test/ui/parser/raw/raw-literal-keywords.rs index f1bfbc95eb3..f51e565c2d3 100644 --- a/src/test/ui/parser/raw/raw-literal-keywords.rs +++ b/src/test/ui/parser/raw/raw-literal-keywords.rs @@ -1,23 +1,16 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn test_if() { r#if true { } //~ ERROR found `true` + //~| ERROR cannot find value `if` in this scope } fn test_struct() { r#struct Test; //~ ERROR found `Test` + //~| ERROR cannot find value `struct` in this scope } fn test_union() { r#union Test; //~ ERROR found `Test` + //~| ERROR cannot find value `union` in this scope } + +fn main() {} diff --git a/src/test/ui/parser/raw/raw-literal-keywords.stderr b/src/test/ui/parser/raw/raw-literal-keywords.stderr index 8a6b91b4b4b..8465b6a6e84 100644 --- a/src/test/ui/parser/raw/raw-literal-keywords.stderr +++ b/src/test/ui/parser/raw/raw-literal-keywords.stderr @@ -1,20 +1,39 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `true` - --> $DIR/raw-literal-keywords.rs:14:10 + --> $DIR/raw-literal-keywords.rs:2:10 | LL | r#if true { } //~ ERROR found `true` | ^^^^ expected one of 8 possible tokens here error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test` - --> $DIR/raw-literal-keywords.rs:18:14 + --> $DIR/raw-literal-keywords.rs:7:14 | LL | r#struct Test; //~ ERROR found `Test` | ^^^^ expected one of 8 possible tokens here error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test` - --> $DIR/raw-literal-keywords.rs:22:13 + --> $DIR/raw-literal-keywords.rs:12:13 | LL | r#union Test; //~ ERROR found `Test` | ^^^^ expected one of 8 possible tokens here -error: aborting due to 3 previous errors +error[E0425]: cannot find value `if` in this scope + --> $DIR/raw-literal-keywords.rs:2:5 + | +LL | r#if true { } //~ ERROR found `true` + | ^^^^ not found in this scope + +error[E0425]: cannot find value `struct` in this scope + --> $DIR/raw-literal-keywords.rs:7:5 + | +LL | r#struct Test; //~ ERROR found `Test` + | ^^^^^^^^ not found in this scope + +error[E0425]: cannot find value `union` in this scope + --> $DIR/raw-literal-keywords.rs:12:5 + | +LL | r#union Test; //~ ERROR found `Test` + | ^^^^^^^ not found in this scope + +error: aborting due to 6 previous errors +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/parser/raw/raw-literal-self.rs b/src/test/ui/parser/raw/raw-literal-self.rs index 17496d767b6..d7b9553d032 100644 --- a/src/test/ui/parser/raw/raw-literal-self.rs +++ b/src/test/ui/parser/raw/raw-literal-self.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn self_test(r#self: u32) { //~^ ERROR `r#self` is not currently supported. } diff --git a/src/test/ui/parser/raw/raw-literal-self.stderr b/src/test/ui/parser/raw/raw-literal-self.stderr index f4b75937247..e64332785cc 100644 --- a/src/test/ui/parser/raw/raw-literal-self.stderr +++ b/src/test/ui/parser/raw/raw-literal-self.stderr @@ -1,5 +1,5 @@ error: `r#self` is not currently supported. - --> $DIR/raw-literal-self.rs:13:14 + --> $DIR/raw-literal-self.rs:1:14 | LL | fn self_test(r#self: u32) { | ^^^^^^ diff --git a/src/test/ui/parser/raw/raw-literal-underscore.rs b/src/test/ui/parser/raw/raw-literal-underscore.rs index ec33e486195..bbedd395202 100644 --- a/src/test/ui/parser/raw/raw-literal-underscore.rs +++ b/src/test/ui/parser/raw/raw-literal-underscore.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn underscore_test(r#_: u32) { //~^ ERROR `r#_` is not currently supported. } diff --git a/src/test/ui/parser/raw/raw-literal-underscore.stderr b/src/test/ui/parser/raw/raw-literal-underscore.stderr index 8072eee4f06..9427b33afd8 100644 --- a/src/test/ui/parser/raw/raw-literal-underscore.stderr +++ b/src/test/ui/parser/raw/raw-literal-underscore.stderr @@ -1,5 +1,5 @@ error: `r#_` is not currently supported. - --> $DIR/raw-literal-underscore.rs:13:20 + --> $DIR/raw-literal-underscore.rs:1:20 | LL | fn underscore_test(r#_: u32) { | ^^^ diff --git a/src/test/ui/parser/raw/raw_string.rs b/src/test/ui/parser/raw/raw_string.rs index de80abfbe49..84f07c4a941 100644 --- a/src/test/ui/parser/raw/raw_string.rs +++ b/src/test/ui/parser/raw/raw_string.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let x = r##"lol"#; //~^ ERROR unterminated raw string diff --git a/src/test/ui/parser/raw/raw_string.stderr b/src/test/ui/parser/raw/raw_string.stderr index 9e46d1955a0..5572511881d 100644 --- a/src/test/ui/parser/raw/raw_string.stderr +++ b/src/test/ui/parser/raw/raw_string.stderr @@ -1,5 +1,5 @@ error: unterminated raw string - --> $DIR/raw_string.rs:14:13 + --> $DIR/raw_string.rs:2:13 | LL | let x = r##"lol"#; | ^ unterminated raw string diff --git a/src/test/ui/parser/recover-enum.rs b/src/test/ui/parser/recover-enum.rs index 7de3ed10c90..204ad857165 100644 --- a/src/test/ui/parser/recover-enum.rs +++ b/src/test/ui/parser/recover-enum.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error fn main() { enum Test { diff --git a/src/test/ui/parser/recover-enum.stderr b/src/test/ui/parser/recover-enum.stderr index 1d157c19005..81e292939b0 100644 --- a/src/test/ui/parser/recover-enum.stderr +++ b/src/test/ui/parser/recover-enum.stderr @@ -1,5 +1,5 @@ error: expected one of `(`, `,`, `=`, `{`, or `}`, found `Bad` - --> $DIR/recover-enum.rs:16:9 + --> $DIR/recover-enum.rs:6:9 | LL | Very | - expected one of `(`, `,`, `=`, `{`, or `}` here diff --git a/src/test/ui/parser/recover-enum2.rs b/src/test/ui/parser/recover-enum2.rs index 6fd32f842f1..65a18773787 100644 --- a/src/test/ui/parser/recover-enum2.rs +++ b/src/test/ui/parser/recover-enum2.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error fn main() { enum Test { diff --git a/src/test/ui/parser/recover-enum2.stderr b/src/test/ui/parser/recover-enum2.stderr index 802f0004564..2473420a779 100644 --- a/src/test/ui/parser/recover-enum2.stderr +++ b/src/test/ui/parser/recover-enum2.stderr @@ -1,23 +1,23 @@ error: expected type, found `{` - --> $DIR/recover-enum2.rs:18:18 + --> $DIR/recover-enum2.rs:8:18 | LL | abc: {}, //~ ERROR: expected type, found `{` | ^ error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `{` - --> $DIR/recover-enum2.rs:37:22 + --> $DIR/recover-enum2.rs:27:22 | LL | Nope(i32 {}) //~ ERROR: found `{` | ^ expected one of 7 possible tokens here error: expected one of `!`, `&&`, `&`, `(`, `)`, `*`, `+`, `,`, `::`, `<`, `?`, `[`, `_`, `crate`, `dyn`, `extern`, `fn`, `for`, `impl`, `pub`, `unsafe`, `}`, or lifetime, found `{` - --> $DIR/recover-enum2.rs:37:22 + --> $DIR/recover-enum2.rs:27:22 | LL | Nope(i32 {}) //~ ERROR: found `{` | ^ expected one of 23 possible tokens here error: expected expression, found reserved identifier `_` - --> $DIR/recover-enum2.rs:42:22 + --> $DIR/recover-enum2.rs:32:22 | LL | let bad_syntax = _; //~ ERROR: expected expression, found reserved identifier `_` | ^ expected expression diff --git a/src/test/ui/parser/recover-struct.rs b/src/test/ui/parser/recover-struct.rs index 535dd529c0b..500591b2ad1 100644 --- a/src/test/ui/parser/recover-struct.rs +++ b/src/test/ui/parser/recover-struct.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error fn main() { struct Test { diff --git a/src/test/ui/parser/recover-struct.stderr b/src/test/ui/parser/recover-struct.stderr index 715c9e5f709..edb3cb95cab 100644 --- a/src/test/ui/parser/recover-struct.stderr +++ b/src/test/ui/parser/recover-struct.stderr @@ -1,5 +1,5 @@ error: expected `:`, found `Bad` - --> $DIR/recover-struct.rs:16:9 + --> $DIR/recover-struct.rs:6:9 | LL | Very | - expected `:` diff --git a/src/test/ui/parser/regions-out-of-scope-slice.rs b/src/test/ui/parser/regions-out-of-scope-slice.rs index 0ff0f9bbf87..21369d0be61 100644 --- a/src/test/ui/parser/regions-out-of-scope-slice.rs +++ b/src/test/ui/parser/regions-out-of-scope-slice.rs @@ -1,20 +1,6 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// blk region isn't supported in the front-end - -// compile-flags: -Z parse-only +// This basically tests the parser's recovery on `'blk` in the wrong place. fn foo(cond: bool) { - // Here we will infer a type that uses the - // region of the if stmt then block, but in the scope: let mut x; if cond { diff --git a/src/test/ui/parser/regions-out-of-scope-slice.stderr b/src/test/ui/parser/regions-out-of-scope-slice.stderr index 2eabc59882a..cd56dfa6aeb 100644 --- a/src/test/ui/parser/regions-out-of-scope-slice.stderr +++ b/src/test/ui/parser/regions-out-of-scope-slice.stderr @@ -1,5 +1,5 @@ error: expected `:`, found `[` - --> $DIR/regions-out-of-scope-slice.rs:21:19 + --> $DIR/regions-out-of-scope-slice.rs:7:19 | LL | x = &'blk [1,2,3]; //~ ERROR expected `:`, found `[` | ^ expected `:` diff --git a/src/test/ui/parser/removed-syntax-closure-lifetime.rs b/src/test/ui/parser/removed-syntax-closure-lifetime.rs index b305b1894a8..ceac9408006 100644 --- a/src/test/ui/parser/removed-syntax-closure-lifetime.rs +++ b/src/test/ui/parser/removed-syntax-closure-lifetime.rs @@ -1,14 +1,2 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - type closure = Box; //~^ ERROR expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `/` diff --git a/src/test/ui/parser/removed-syntax-closure-lifetime.stderr b/src/test/ui/parser/removed-syntax-closure-lifetime.stderr index 97219d5bba9..f52988cdb20 100644 --- a/src/test/ui/parser/removed-syntax-closure-lifetime.stderr +++ b/src/test/ui/parser/removed-syntax-closure-lifetime.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `/` - --> $DIR/removed-syntax-closure-lifetime.rs:13:22 + --> $DIR/removed-syntax-closure-lifetime.rs:1:22 | LL | type closure = Box; | ^ expected one of 7 possible tokens here diff --git a/src/test/ui/parser/removed-syntax-enum-newtype.rs b/src/test/ui/parser/removed-syntax-enum-newtype.rs index 6a7f706624d..518f90b2b83 100644 --- a/src/test/ui/parser/removed-syntax-enum-newtype.rs +++ b/src/test/ui/parser/removed-syntax-enum-newtype.rs @@ -1,13 +1 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - enum e = isize; //~ ERROR expected one of `<`, `where`, or `{`, found `=` diff --git a/src/test/ui/parser/removed-syntax-enum-newtype.stderr b/src/test/ui/parser/removed-syntax-enum-newtype.stderr index 97ba0ff8d58..4c710dec5ba 100644 --- a/src/test/ui/parser/removed-syntax-enum-newtype.stderr +++ b/src/test/ui/parser/removed-syntax-enum-newtype.stderr @@ -1,5 +1,5 @@ error: expected one of `<`, `where`, or `{`, found `=` - --> $DIR/removed-syntax-enum-newtype.rs:13:8 + --> $DIR/removed-syntax-enum-newtype.rs:1:8 | LL | enum e = isize; //~ ERROR expected one of `<`, `where`, or `{`, found `=` | ^ expected one of `<`, `where`, or `{` here diff --git a/src/test/ui/parser/removed-syntax-extern-const.rs b/src/test/ui/parser/removed-syntax-extern-const.rs index 27688867de3..71c22e62f8e 100644 --- a/src/test/ui/parser/removed-syntax-extern-const.rs +++ b/src/test/ui/parser/removed-syntax-extern-const.rs @@ -1,16 +1,6 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - extern { const i: isize; //~^ ERROR extern items cannot be `const` } + +fn main() {} diff --git a/src/test/ui/parser/removed-syntax-extern-const.stderr b/src/test/ui/parser/removed-syntax-extern-const.stderr index b40684ccc7c..2bccbd91452 100644 --- a/src/test/ui/parser/removed-syntax-extern-const.stderr +++ b/src/test/ui/parser/removed-syntax-extern-const.stderr @@ -1,5 +1,5 @@ error: extern items cannot be `const` - --> $DIR/removed-syntax-extern-const.rs:14:5 + --> $DIR/removed-syntax-extern-const.rs:2:5 | LL | const i: isize; | ^^^^^ help: try using a static value: `static` diff --git a/src/test/ui/parser/removed-syntax-field-let.rs b/src/test/ui/parser/removed-syntax-field-let.rs index 6deb3bb2e95..3412788668a 100644 --- a/src/test/ui/parser/removed-syntax-field-let.rs +++ b/src/test/ui/parser/removed-syntax-field-let.rs @@ -1,17 +1,9 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// compile-flags: -Z continue-parse-after-error -// compile-flags: -Z parse-only -Z continue-parse-after-error - -struct s { +struct S { let foo: (), //~^ ERROR expected identifier, found keyword `let` //~^^ ERROR expected `:`, found `foo` } + +fn main() {} diff --git a/src/test/ui/parser/removed-syntax-field-let.stderr b/src/test/ui/parser/removed-syntax-field-let.stderr index 8782a37b35a..0d489beae12 100644 --- a/src/test/ui/parser/removed-syntax-field-let.stderr +++ b/src/test/ui/parser/removed-syntax-field-let.stderr @@ -1,11 +1,15 @@ error: expected identifier, found keyword `let` - --> $DIR/removed-syntax-field-let.rs:14:5 + --> $DIR/removed-syntax-field-let.rs:4:5 | LL | let foo: (), | ^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | r#let foo: (), + | ^^^^^ error: expected `:`, found `foo` - --> $DIR/removed-syntax-field-let.rs:14:9 + --> $DIR/removed-syntax-field-let.rs:4:9 | LL | let foo: (), | ^^^ expected `:` diff --git a/src/test/ui/parser/removed-syntax-field-semicolon.rs b/src/test/ui/parser/removed-syntax-field-semicolon.rs index 409b9507769..ac28e21ae03 100644 --- a/src/test/ui/parser/removed-syntax-field-semicolon.rs +++ b/src/test/ui/parser/removed-syntax-field-semicolon.rs @@ -1,16 +1,6 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -struct s { +struct S { bar: (); //~^ ERROR expected `,`, or `}`, found `;` } + +fn main() {} diff --git a/src/test/ui/parser/removed-syntax-field-semicolon.stderr b/src/test/ui/parser/removed-syntax-field-semicolon.stderr index 3800697221e..fbefeb26a50 100644 --- a/src/test/ui/parser/removed-syntax-field-semicolon.stderr +++ b/src/test/ui/parser/removed-syntax-field-semicolon.stderr @@ -1,5 +1,5 @@ error: expected `,`, or `}`, found `;` - --> $DIR/removed-syntax-field-semicolon.rs:14:12 + --> $DIR/removed-syntax-field-semicolon.rs:2:12 | LL | bar: (); | ^ diff --git a/src/test/ui/parser/removed-syntax-fixed-vec.rs b/src/test/ui/parser/removed-syntax-fixed-vec.rs index 0f34db08852..560efecb91c 100644 --- a/src/test/ui/parser/removed-syntax-fixed-vec.rs +++ b/src/test/ui/parser/removed-syntax-fixed-vec.rs @@ -1,13 +1 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - type v = [isize * 3]; //~ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `*` diff --git a/src/test/ui/parser/removed-syntax-fixed-vec.stderr b/src/test/ui/parser/removed-syntax-fixed-vec.stderr index 737faf79a01..318591e5cc0 100644 --- a/src/test/ui/parser/removed-syntax-fixed-vec.stderr +++ b/src/test/ui/parser/removed-syntax-fixed-vec.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `*` - --> $DIR/removed-syntax-fixed-vec.rs:13:17 + --> $DIR/removed-syntax-fixed-vec.rs:1:17 | LL | type v = [isize * 3]; //~ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `*` | ^ expected one of 7 possible tokens here diff --git a/src/test/ui/parser/removed-syntax-fn-sigil.rs b/src/test/ui/parser/removed-syntax-fn-sigil.rs index f47ad01d7e1..725843429c0 100644 --- a/src/test/ui/parser/removed-syntax-fn-sigil.rs +++ b/src/test/ui/parser/removed-syntax-fn-sigil.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -fn f() { +fn main() { let x: fn~() = || (); //~ ERROR expected `(`, found `~` } diff --git a/src/test/ui/parser/removed-syntax-fn-sigil.stderr b/src/test/ui/parser/removed-syntax-fn-sigil.stderr index 587be63041d..9303a67a8cc 100644 --- a/src/test/ui/parser/removed-syntax-fn-sigil.stderr +++ b/src/test/ui/parser/removed-syntax-fn-sigil.stderr @@ -1,5 +1,5 @@ error: expected `(`, found `~` - --> $DIR/removed-syntax-fn-sigil.rs:14:14 + --> $DIR/removed-syntax-fn-sigil.rs:2:14 | LL | let x: fn~() = || (); //~ ERROR expected `(`, found `~` | - ^ expected `(` diff --git a/src/test/ui/parser/removed-syntax-mode.rs b/src/test/ui/parser/removed-syntax-mode.rs index c2f87d8afce..23851b5f70b 100644 --- a/src/test/ui/parser/removed-syntax-mode.rs +++ b/src/test/ui/parser/removed-syntax-mode.rs @@ -1,14 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn f(+x: isize) {} //~^ ERROR expected argument name, found `+` + +fn main() {} diff --git a/src/test/ui/parser/removed-syntax-mode.stderr b/src/test/ui/parser/removed-syntax-mode.stderr index 7ad88471d5a..5e7139d6bfd 100644 --- a/src/test/ui/parser/removed-syntax-mode.stderr +++ b/src/test/ui/parser/removed-syntax-mode.stderr @@ -1,5 +1,5 @@ error: expected argument name, found `+` - --> $DIR/removed-syntax-mode.rs:13:6 + --> $DIR/removed-syntax-mode.rs:1:6 | LL | fn f(+x: isize) {} | ^ expected argument name diff --git a/src/test/ui/parser/removed-syntax-mut-vec-expr.rs b/src/test/ui/parser/removed-syntax-mut-vec-expr.rs index 7e5bd27b497..2ee95db5a25 100644 --- a/src/test/ui/parser/removed-syntax-mut-vec-expr.rs +++ b/src/test/ui/parser/removed-syntax-mut-vec-expr.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -fn f() { +fn main() { let v = [mut 1, 2, 3, 4]; //~ ERROR expected expression, found keyword `mut` } diff --git a/src/test/ui/parser/removed-syntax-mut-vec-expr.stderr b/src/test/ui/parser/removed-syntax-mut-vec-expr.stderr index 253ecf41edd..8164645b01b 100644 --- a/src/test/ui/parser/removed-syntax-mut-vec-expr.stderr +++ b/src/test/ui/parser/removed-syntax-mut-vec-expr.stderr @@ -1,5 +1,5 @@ error: expected expression, found keyword `mut` - --> $DIR/removed-syntax-mut-vec-expr.rs:14:14 + --> $DIR/removed-syntax-mut-vec-expr.rs:2:14 | LL | let v = [mut 1, 2, 3, 4]; //~ ERROR expected expression, found keyword `mut` | ^^^ expected expression diff --git a/src/test/ui/parser/removed-syntax-mut-vec-ty.rs b/src/test/ui/parser/removed-syntax-mut-vec-ty.rs index 0cdf1981a23..923a7ea37a4 100644 --- a/src/test/ui/parser/removed-syntax-mut-vec-ty.rs +++ b/src/test/ui/parser/removed-syntax-mut-vec-ty.rs @@ -1,13 +1 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - type v = [mut isize]; //~ ERROR expected type, found keyword `mut` diff --git a/src/test/ui/parser/removed-syntax-mut-vec-ty.stderr b/src/test/ui/parser/removed-syntax-mut-vec-ty.stderr index d6b47accb97..f0eafa3d00a 100644 --- a/src/test/ui/parser/removed-syntax-mut-vec-ty.stderr +++ b/src/test/ui/parser/removed-syntax-mut-vec-ty.stderr @@ -1,5 +1,5 @@ error: expected type, found keyword `mut` - --> $DIR/removed-syntax-mut-vec-ty.rs:13:11 + --> $DIR/removed-syntax-mut-vec-ty.rs:1:11 | LL | type v = [mut isize]; //~ ERROR expected type, found keyword `mut` | ^^^ diff --git a/src/test/ui/parser/removed-syntax-ptr-lifetime.rs b/src/test/ui/parser/removed-syntax-ptr-lifetime.rs index b91ab8730b3..5b551addbc8 100644 --- a/src/test/ui/parser/removed-syntax-ptr-lifetime.rs +++ b/src/test/ui/parser/removed-syntax-ptr-lifetime.rs @@ -1,13 +1 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - type bptr = &lifetime/isize; //~ ERROR expected one of `!`, `(`, `::`, `;`, or `<`, found `/` diff --git a/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr b/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr index 2538e5473ee..689ed35668e 100644 --- a/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr +++ b/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr @@ -1,5 +1,5 @@ error: expected one of `!`, `(`, `::`, `;`, or `<`, found `/` - --> $DIR/removed-syntax-ptr-lifetime.rs:13:22 + --> $DIR/removed-syntax-ptr-lifetime.rs:1:22 | LL | type bptr = &lifetime/isize; //~ ERROR expected one of `!`, `(`, `::`, `;`, or `<`, found `/` | ^ expected one of `!`, `(`, `::`, `;`, or `<` here diff --git a/src/test/ui/parser/removed-syntax-record.rs b/src/test/ui/parser/removed-syntax-record.rs index fd6f99bdbf9..d1d91c8f7dc 100644 --- a/src/test/ui/parser/removed-syntax-record.rs +++ b/src/test/ui/parser/removed-syntax-record.rs @@ -1,13 +1 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - type t = { f: () }; //~ ERROR expected type, found `{` diff --git a/src/test/ui/parser/removed-syntax-record.stderr b/src/test/ui/parser/removed-syntax-record.stderr index 99d4ef44f9a..f9b98596ae3 100644 --- a/src/test/ui/parser/removed-syntax-record.stderr +++ b/src/test/ui/parser/removed-syntax-record.stderr @@ -1,5 +1,5 @@ error: expected type, found `{` - --> $DIR/removed-syntax-record.rs:13:10 + --> $DIR/removed-syntax-record.rs:1:10 | LL | type t = { f: () }; //~ ERROR expected type, found `{` | ^ diff --git a/src/test/ui/parser/removed-syntax-static-fn.rs b/src/test/ui/parser/removed-syntax-static-fn.rs index 4c0cd3358dd..df3964196b8 100644 --- a/src/test/ui/parser/removed-syntax-static-fn.rs +++ b/src/test/ui/parser/removed-syntax-static-fn.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only // ignore-tidy-linelength struct S; @@ -17,3 +6,5 @@ impl S { static fn f() {} } //~^^ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, + +fn main() {} diff --git a/src/test/ui/parser/removed-syntax-static-fn.stderr b/src/test/ui/parser/removed-syntax-static-fn.stderr index dd3b0e00101..84e0432c48c 100644 --- a/src/test/ui/parser/removed-syntax-static-fn.stderr +++ b/src/test/ui/parser/removed-syntax-static-fn.stderr @@ -1,5 +1,5 @@ error: expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `static` - --> $DIR/removed-syntax-static-fn.rs:17:5 + --> $DIR/removed-syntax-static-fn.rs:6:5 | LL | impl S { | - expected one of 11 possible tokens here diff --git a/src/test/ui/parser/removed-syntax-uniq-mut-expr.rs b/src/test/ui/parser/removed-syntax-uniq-mut-expr.rs index b16c77ab6b5..08ef4b43269 100644 --- a/src/test/ui/parser/removed-syntax-uniq-mut-expr.rs +++ b/src/test/ui/parser/removed-syntax-uniq-mut-expr.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -fn f() { +fn main() { let a_box = box mut 42; //~ ERROR expected expression, found keyword `mut` } diff --git a/src/test/ui/parser/removed-syntax-uniq-mut-expr.stderr b/src/test/ui/parser/removed-syntax-uniq-mut-expr.stderr index 54e6a517343..90d0764def0 100644 --- a/src/test/ui/parser/removed-syntax-uniq-mut-expr.stderr +++ b/src/test/ui/parser/removed-syntax-uniq-mut-expr.stderr @@ -1,5 +1,5 @@ error: expected expression, found keyword `mut` - --> $DIR/removed-syntax-uniq-mut-expr.rs:14:21 + --> $DIR/removed-syntax-uniq-mut-expr.rs:2:21 | LL | let a_box = box mut 42; //~ ERROR expected expression, found keyword `mut` | ^^^ expected expression diff --git a/src/test/ui/parser/removed-syntax-uniq-mut-ty.rs b/src/test/ui/parser/removed-syntax-uniq-mut-ty.rs index 8a47376179d..12de76d9d6d 100644 --- a/src/test/ui/parser/removed-syntax-uniq-mut-ty.rs +++ b/src/test/ui/parser/removed-syntax-uniq-mut-ty.rs @@ -1,13 +1 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - type mut_box = Box; //~ ERROR expected one of `>`, lifetime, or type, found `mut` diff --git a/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr b/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr index e9660f3e1c2..0177b19d74e 100644 --- a/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr +++ b/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr @@ -1,5 +1,5 @@ error: expected one of `>`, lifetime, or type, found `mut` - --> $DIR/removed-syntax-uniq-mut-ty.rs:13:20 + --> $DIR/removed-syntax-uniq-mut-ty.rs:1:20 | LL | type mut_box = Box; //~ ERROR expected one of `>`, lifetime, or type, found `mut` | ^^^ expected one of `>`, lifetime, or type here diff --git a/src/test/ui/parser/removed-syntax-with-1.rs b/src/test/ui/parser/removed-syntax-with-1.rs index 156b172a944..2c1e152dcee 100644 --- a/src/test/ui/parser/removed-syntax-with-1.rs +++ b/src/test/ui/parser/removed-syntax-with-1.rs @@ -1,22 +1,10 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -fn removed_with() { +fn main() { struct S { foo: (), bar: (), } let a = S { foo: (), bar: () }; - let b = S { foo: () with a }; + let b = S { foo: () with a, bar: () }; //~^ ERROR expected one of `,`, `.`, `?`, `}`, or an operator, found `with` } diff --git a/src/test/ui/parser/removed-syntax-with-1.stderr b/src/test/ui/parser/removed-syntax-with-1.stderr index 37baf742ed8..a157873916a 100644 --- a/src/test/ui/parser/removed-syntax-with-1.stderr +++ b/src/test/ui/parser/removed-syntax-with-1.stderr @@ -1,8 +1,10 @@ error: expected one of `,`, `.`, `?`, `}`, or an operator, found `with` - --> $DIR/removed-syntax-with-1.rs:20:25 + --> $DIR/removed-syntax-with-1.rs:8:25 | -LL | let b = S { foo: () with a }; - | ^^^^ expected one of `,`, `.`, `?`, `}`, or an operator here +LL | let b = S { foo: () with a, bar: () }; + | - ^^^^ expected one of `,`, `.`, `?`, `}`, or an operator here + | | + | while parsing this struct error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-with-2.rs b/src/test/ui/parser/removed-syntax-with-2.rs index c4354c07604..f666da49696 100644 --- a/src/test/ui/parser/removed-syntax-with-2.rs +++ b/src/test/ui/parser/removed-syntax-with-2.rs @@ -1,16 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -fn removed_with() { +fn main() { struct S { foo: (), bar: (), @@ -19,4 +7,5 @@ fn removed_with() { let a = S { foo: (), bar: () }; let b = S { foo: (), with a }; //~^ ERROR expected one of `,` or `}`, found `a` + //~| ERROR missing field `bar` in initializer of `main::S` } diff --git a/src/test/ui/parser/removed-syntax-with-2.stderr b/src/test/ui/parser/removed-syntax-with-2.stderr index 6999196c1b7..7717b49d3a2 100644 --- a/src/test/ui/parser/removed-syntax-with-2.stderr +++ b/src/test/ui/parser/removed-syntax-with-2.stderr @@ -1,8 +1,17 @@ error: expected one of `,` or `}`, found `a` - --> $DIR/removed-syntax-with-2.rs:20:31 + --> $DIR/removed-syntax-with-2.rs:8:31 | LL | let b = S { foo: (), with a }; - | ^ expected one of `,` or `}` here + | - ^ expected one of `,` or `}` here + | | + | while parsing this struct -error: aborting due to previous error +error[E0063]: missing field `bar` in initializer of `main::S` + --> $DIR/removed-syntax-with-2.rs:8:13 + | +LL | let b = S { foo: (), with a }; + | ^ missing `bar` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0063`. diff --git a/src/test/ui/parser/require-parens-for-chained-comparison.rs b/src/test/ui/parser/require-parens-for-chained-comparison.rs index 1ee6996ce9c..525be5d20e2 100644 --- a/src/test/ui/parser/require-parens-for-chained-comparison.rs +++ b/src/test/ui/parser/require-parens-for-chained-comparison.rs @@ -1,16 +1,5 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn f() {} +struct X; fn main() { false == false == false; @@ -18,9 +7,12 @@ fn main() { false == 0 < 2; //~^ ERROR: chained comparison operators require parentheses + //~| ERROR: mismatched types + //~| ERROR: mismatched types f(); //~^ ERROR: chained comparison operators require parentheses + //~| ERROR: binary operation `<` cannot be applied to type `fn() {f::<_>}` //~| HELP: use `::<...>` instead of `<...>` //~| HELP: or use `(...)` } diff --git a/src/test/ui/parser/require-parens-for-chained-comparison.stderr b/src/test/ui/parser/require-parens-for-chained-comparison.stderr index 8facdab4285..4597b143215 100644 --- a/src/test/ui/parser/require-parens-for-chained-comparison.stderr +++ b/src/test/ui/parser/require-parens-for-chained-comparison.stderr @@ -1,17 +1,17 @@ error: chained comparison operators require parentheses - --> $DIR/require-parens-for-chained-comparison.rs:16:11 + --> $DIR/require-parens-for-chained-comparison.rs:5:11 | LL | false == false == false; | ^^^^^^^^^^^^^^^^^ error: chained comparison operators require parentheses - --> $DIR/require-parens-for-chained-comparison.rs:19:11 + --> $DIR/require-parens-for-chained-comparison.rs:8:11 | LL | false == 0 < 2; | ^^^^^^^^ error: chained comparison operators require parentheses - --> $DIR/require-parens-for-chained-comparison.rs:22:6 + --> $DIR/require-parens-for-chained-comparison.rs:13:6 | LL | f(); | ^^^^ @@ -19,5 +19,33 @@ LL | f(); = help: use `::<...>` instead of `<...>` if you meant to specify type arguments = help: or use `(...)` if you meant to specify fn arguments -error: aborting due to 3 previous errors +error[E0308]: mismatched types + --> $DIR/require-parens-for-chained-comparison.rs:8:14 + | +LL | false == 0 < 2; + | ^ expected bool, found integer + | + = note: expected type `bool` + found type `{integer}` + +error[E0308]: mismatched types + --> $DIR/require-parens-for-chained-comparison.rs:8:18 + | +LL | false == 0 < 2; + | ^ expected bool, found integer + | + = note: expected type `bool` + found type `{integer}` + +error[E0369]: binary operation `<` cannot be applied to type `fn() {f::<_>}` + --> $DIR/require-parens-for-chained-comparison.rs:13:5 + | +LL | f(); + | ^^^ + | + = note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() {f::<_>}` + +error: aborting due to 6 previous errors +Some errors occurred: E0308, E0369. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/struct-field-numeric-shorthand.rs b/src/test/ui/parser/struct-field-numeric-shorthand.rs index 49ba0d8bde6..58c40b3d96a 100644 --- a/src/test/ui/parser/struct-field-numeric-shorthand.rs +++ b/src/test/ui/parser/struct-field-numeric-shorthand.rs @@ -1,17 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct Rgb(u8, u8, u8); fn main() { - let _ = Rgb { 0, 1, 2 }; //~ ERROR expected identifier, found `0` + let _ = Rgb { 0, 1, 2 }; + //~^ ERROR expected identifier, found `0` + //~| ERROR expected identifier, found `1` + //~| ERROR expected identifier, found `2` + //~| ERROR missing fields `0`, `1`, `2` in initializer of `Rgb` } diff --git a/src/test/ui/parser/struct-field-numeric-shorthand.stderr b/src/test/ui/parser/struct-field-numeric-shorthand.stderr index e909a9ece60..cfb1f820147 100644 --- a/src/test/ui/parser/struct-field-numeric-shorthand.stderr +++ b/src/test/ui/parser/struct-field-numeric-shorthand.stderr @@ -1,10 +1,33 @@ error: expected identifier, found `0` - --> $DIR/struct-field-numeric-shorthand.rs:16:19 + --> $DIR/struct-field-numeric-shorthand.rs:4:19 | -LL | let _ = Rgb { 0, 1, 2 }; //~ ERROR expected identifier, found `0` +LL | let _ = Rgb { 0, 1, 2 }; | --- ^ expected identifier | | | while parsing this struct -error: aborting due to previous error +error: expected identifier, found `1` + --> $DIR/struct-field-numeric-shorthand.rs:4:22 + | +LL | let _ = Rgb { 0, 1, 2 }; + | --- ^ expected identifier + | | + | while parsing this struct + +error: expected identifier, found `2` + --> $DIR/struct-field-numeric-shorthand.rs:4:25 + | +LL | let _ = Rgb { 0, 1, 2 }; + | --- ^ expected identifier + | | + | while parsing this struct + +error[E0063]: missing fields `0`, `1`, `2` in initializer of `Rgb` + --> $DIR/struct-field-numeric-shorthand.rs:4:13 + | +LL | let _ = Rgb { 0, 1, 2 }; + | ^^^ missing `0`, `1`, `2` + +error: aborting due to 4 previous errors +For more information about this error, try `rustc --explain E0063`. diff --git a/src/test/ui/parser/struct-literal-in-for.rs b/src/test/ui/parser/struct-literal-in-for.rs index 93098455560..526b5e75c45 100644 --- a/src/test/ui/parser/struct-literal-in-for.rs +++ b/src/test/ui/parser/struct-literal-in-for.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct Foo { x: isize, } @@ -21,7 +9,7 @@ impl Foo { } fn main() { - for x in Foo { + for x in Foo { //~ ERROR expected value, found struct `Foo` x: 3 //~ ERROR expected type, found `3` }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` println!("yo"); diff --git a/src/test/ui/parser/struct-literal-in-for.stderr b/src/test/ui/parser/struct-literal-in-for.stderr index 4a074eef889..38a5e22e3f7 100644 --- a/src/test/ui/parser/struct-literal-in-for.stderr +++ b/src/test/ui/parser/struct-literal-in-for.stderr @@ -1,14 +1,21 @@ error: expected type, found `3` - --> $DIR/struct-literal-in-for.rs:25:12 + --> $DIR/struct-literal-in-for.rs:13:12 | LL | x: 3 //~ ERROR expected type, found `3` | ^ expecting a type here because of type ascription error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` - --> $DIR/struct-literal-in-for.rs:26:12 + --> $DIR/struct-literal-in-for.rs:14:12 | LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` | ^ expected one of `.`, `;`, `?`, `}`, or an operator here -error: aborting due to 2 previous errors +error[E0423]: expected value, found struct `Foo` + --> $DIR/struct-literal-in-for.rs:12:14 + | +LL | for x in Foo { //~ ERROR expected value, found struct `Foo` + | ^^^ did you mean `(Foo { /* fields */ })`? + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0423`. diff --git a/src/test/ui/parser/struct-literal-in-if.rs b/src/test/ui/parser/struct-literal-in-if.rs index db6a360a567..362a71c577f 100644 --- a/src/test/ui/parser/struct-literal-in-if.rs +++ b/src/test/ui/parser/struct-literal-in-if.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct Foo { x: isize, } @@ -21,7 +9,7 @@ impl Foo { } fn main() { - if Foo { + if Foo { //~ ERROR expected value, found struct `Foo` x: 3 //~ ERROR expected type, found `3` }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` println!("yo"); diff --git a/src/test/ui/parser/struct-literal-in-if.stderr b/src/test/ui/parser/struct-literal-in-if.stderr index 02659ffb5aa..49b9a52aff9 100644 --- a/src/test/ui/parser/struct-literal-in-if.stderr +++ b/src/test/ui/parser/struct-literal-in-if.stderr @@ -1,14 +1,21 @@ error: expected type, found `3` - --> $DIR/struct-literal-in-if.rs:25:12 + --> $DIR/struct-literal-in-if.rs:13:12 | LL | x: 3 //~ ERROR expected type, found `3` | ^ expecting a type here because of type ascription error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` - --> $DIR/struct-literal-in-if.rs:26:12 + --> $DIR/struct-literal-in-if.rs:14:12 | LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` | ^ expected one of `.`, `;`, `?`, `}`, or an operator here -error: aborting due to 2 previous errors +error[E0423]: expected value, found struct `Foo` + --> $DIR/struct-literal-in-if.rs:12:8 + | +LL | if Foo { //~ ERROR expected value, found struct `Foo` + | ^^^ did you mean `(Foo { /* fields */ })`? + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0423`. diff --git a/src/test/ui/parser/struct-literal-in-match-discriminant.rs b/src/test/ui/parser/struct-literal-in-match-discriminant.rs index 7038cc798c4..35a11090351 100644 --- a/src/test/ui/parser/struct-literal-in-match-discriminant.rs +++ b/src/test/ui/parser/struct-literal-in-match-discriminant.rs @@ -1,25 +1,13 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct Foo { x: isize, } fn main() { - match Foo { + match Foo { //~ ERROR expected value, found struct `Foo` x: 3 //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `:` } { - Foo { - x: x + Foo { //~ ERROR mismatched types + x: x //~ ERROR cannot find value `x` in this scope } => {} //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `=>` } } diff --git a/src/test/ui/parser/struct-literal-in-match-discriminant.stderr b/src/test/ui/parser/struct-literal-in-match-discriminant.stderr index 9b8eecd389e..64ddde0e9e9 100644 --- a/src/test/ui/parser/struct-literal-in-match-discriminant.stderr +++ b/src/test/ui/parser/struct-literal-in-match-discriminant.stderr @@ -1,14 +1,42 @@ error: expected one of `=>`, `@`, `if`, or `|`, found `:` - --> $DIR/struct-literal-in-match-discriminant.rs:19:10 + --> $DIR/struct-literal-in-match-discriminant.rs:7:10 | LL | x: 3 //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `:` | ^ expected one of `=>`, `@`, `if`, or `|` here error: expected one of `.`, `;`, `?`, `}`, or an operator, found `=>` - --> $DIR/struct-literal-in-match-discriminant.rs:23:11 + --> $DIR/struct-literal-in-match-discriminant.rs:11:11 | LL | } => {} //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `=>` | ^^ expected one of `.`, `;`, `?`, `}`, or an operator here -error: aborting due to 2 previous errors +error[E0423]: expected value, found struct `Foo` + --> $DIR/struct-literal-in-match-discriminant.rs:6:11 + | +LL | match Foo { //~ ERROR expected value, found struct `Foo` + | ^^^ did you mean `(Foo { /* fields */ })`? + +error[E0425]: cannot find value `x` in this scope + --> $DIR/struct-literal-in-match-discriminant.rs:10:16 + | +LL | x: x //~ ERROR cannot find value `x` in this scope + | ^ not found in this scope + +error[E0308]: mismatched types + --> $DIR/struct-literal-in-match-discriminant.rs:9:9 + | +LL | fn main() { + | - expected `()` because of default return type +... +LL | / Foo { //~ ERROR mismatched types +LL | | x: x //~ ERROR cannot find value `x` in this scope +LL | | } => {} //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `=>` + | |_________^ expected (), found struct `Foo` + | + = note: expected type `()` + found type `Foo` + +error: aborting due to 5 previous errors +Some errors occurred: E0308, E0423, E0425. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/struct-literal-in-while.rs b/src/test/ui/parser/struct-literal-in-while.rs index 75e4eb3de07..561cdcea089 100644 --- a/src/test/ui/parser/struct-literal-in-while.rs +++ b/src/test/ui/parser/struct-literal-in-while.rs @@ -1,15 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct Foo { x: isize, } @@ -21,9 +9,10 @@ impl Foo { } fn main() { - while Foo { + while Foo { //~ ERROR expected value, found struct `Foo` x: 3 //~ ERROR expected type, found `3` }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` + //~| ERROR no method named `hi` found for type `()` in the current scope println!("yo"); } } diff --git a/src/test/ui/parser/struct-literal-in-while.stderr b/src/test/ui/parser/struct-literal-in-while.stderr index 6ecc14cd081..9a6ab81e7c0 100644 --- a/src/test/ui/parser/struct-literal-in-while.stderr +++ b/src/test/ui/parser/struct-literal-in-while.stderr @@ -1,14 +1,28 @@ error: expected type, found `3` - --> $DIR/struct-literal-in-while.rs:25:12 + --> $DIR/struct-literal-in-while.rs:13:12 | LL | x: 3 //~ ERROR expected type, found `3` | ^ expecting a type here because of type ascription error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` - --> $DIR/struct-literal-in-while.rs:26:12 + --> $DIR/struct-literal-in-while.rs:14:12 | LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` | ^ expected one of `.`, `;`, `?`, `}`, or an operator here -error: aborting due to 2 previous errors +error[E0423]: expected value, found struct `Foo` + --> $DIR/struct-literal-in-while.rs:12:11 + | +LL | while Foo { //~ ERROR expected value, found struct `Foo` + | ^^^ did you mean `(Foo { /* fields */ })`? + +error[E0599]: no method named `hi` found for type `()` in the current scope + --> $DIR/struct-literal-in-while.rs:14:7 + | +LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` + | ^^ + +error: aborting due to 4 previous errors +Some errors occurred: E0423, E0599. +For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/parser/struct-literal-restrictions-in-lamda.rs b/src/test/ui/parser/struct-literal-restrictions-in-lamda.rs index 6b7a26556f4..e5049082ab0 100644 --- a/src/test/ui/parser/struct-literal-restrictions-in-lamda.rs +++ b/src/test/ui/parser/struct-literal-restrictions-in-lamda.rs @@ -1,15 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct Foo { x: isize, } @@ -21,9 +9,10 @@ impl Foo { } fn main() { - while || Foo { + while || Foo { //~ ERROR expected value, found struct `Foo` x: 3 //~ ERROR expected type, found `3` }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` + //~| ERROR no method named `hi` found for type `()` in the current scope println!("yo"); } } diff --git a/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr b/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr index 1341a2b241d..2303df93810 100644 --- a/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr +++ b/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr @@ -1,14 +1,28 @@ error: expected type, found `3` - --> $DIR/struct-literal-restrictions-in-lamda.rs:25:12 + --> $DIR/struct-literal-restrictions-in-lamda.rs:13:12 | LL | x: 3 //~ ERROR expected type, found `3` | ^ expecting a type here because of type ascription error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` - --> $DIR/struct-literal-restrictions-in-lamda.rs:26:12 + --> $DIR/struct-literal-restrictions-in-lamda.rs:14:12 | LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` | ^ expected one of `.`, `;`, `?`, `}`, or an operator here -error: aborting due to 2 previous errors +error[E0423]: expected value, found struct `Foo` + --> $DIR/struct-literal-restrictions-in-lamda.rs:12:14 + | +LL | while || Foo { //~ ERROR expected value, found struct `Foo` + | ^^^ did you mean `(Foo { /* fields */ })`? + +error[E0599]: no method named `hi` found for type `()` in the current scope + --> $DIR/struct-literal-restrictions-in-lamda.rs:14:7 + | +LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` + | ^^ + +error: aborting due to 4 previous errors +Some errors occurred: E0423, E0599. +For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/parser/tag-variant-disr-non-nullary.rs b/src/test/ui/parser/tag-variant-disr-non-nullary.rs index 2d86589285c..83a3b727982 100644 --- a/src/test/ui/parser/tag-variant-disr-non-nullary.rs +++ b/src/test/ui/parser/tag-variant-disr-non-nullary.rs @@ -1,22 +1,11 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -//error-pattern: discriminator values can only be used with a field-less enum - -enum color { - red = 0xff0000, - green = 0x00ff00, - blue = 0x0000ff, - black = 0x000000, - white = 0xffffff, - other (str), +enum Color { + Red = 0xff0000, + //~^ ERROR discriminator values can only be used with a field-less enum + Green = 0x00ff00, + Blue = 0x0000ff, + Black = 0x000000, + White = 0xffffff, + Other(usize), } + +fn main() {} diff --git a/src/test/ui/parser/tag-variant-disr-non-nullary.stderr b/src/test/ui/parser/tag-variant-disr-non-nullary.stderr index 990ddca05d9..cc6312b4545 100644 --- a/src/test/ui/parser/tag-variant-disr-non-nullary.stderr +++ b/src/test/ui/parser/tag-variant-disr-non-nullary.stderr @@ -1,8 +1,17 @@ error: discriminator values can only be used with a field-less enum - --> $DIR/tag-variant-disr-non-nullary.rs:20:13 + --> $DIR/tag-variant-disr-non-nullary.rs:2:11 | -LL | white = 0xffffff, - | ^^^^^^^^ +LL | Red = 0xff0000, + | ^^^^^^^^ only valid in field-less enums +LL | //~^ ERROR discriminator values can only be used with a field-less enum +LL | Green = 0x00ff00, + | ^^^^^^^^ only valid in field-less enums +LL | Blue = 0x0000ff, + | ^^^^^^^^ only valid in field-less enums +LL | Black = 0x000000, + | ^^^^^^^^ only valid in field-less enums +LL | White = 0xffffff, + | ^^^^^^^^ only valid in field-less enums error: aborting due to previous error diff --git a/src/test/ui/parser/trailing-carriage-return-in-string.rs b/src/test/ui/parser/trailing-carriage-return-in-string.rs index dd763dc64c0..8abf2624e4f 100644 --- a/src/test/ui/parser/trailing-carriage-return-in-string.rs +++ b/src/test/ui/parser/trailing-carriage-return-in-string.rs @@ -1,17 +1,6 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only +// Issue #11669 // ignore-tidy-cr -// Issue #11669 fn main() { // \r\n diff --git a/src/test/ui/parser/trailing-carriage-return-in-string.stderr b/src/test/ui/parser/trailing-carriage-return-in-string.stderr index 4e6d38dd7af..972e4296da3 100644 --- a/src/test/ui/parser/trailing-carriage-return-in-string.stderr +++ b/src/test/ui/parser/trailing-carriage-return-in-string.stderr @@ -1,11 +1,11 @@ error: unknown character escape: /r - --> $DIR/trailing-carriage-return-in-string.rs:21:25 + --> $DIR/trailing-carriage-return-in-string.rs:10:25 | LL | let bad = "This is / a test"; | ^ | help: this is an isolated carriage return; consider checking your editor and version control settings - --> $DIR/trailing-carriage-return-in-string.rs:21:25 + --> $DIR/trailing-carriage-return-in-string.rs:10:25 | LL | let bad = "This is / a test"; | ^ diff --git a/src/test/ui/parser/trailing-plus-in-bounds.rs b/src/test/ui/parser/trailing-plus-in-bounds.rs index b0dda815f83..153f942b978 100644 --- a/src/test/ui/parser/trailing-plus-in-bounds.rs +++ b/src/test/ui/parser/trailing-plus-in-bounds.rs @@ -1,15 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error + +#![feature(box_syntax)] use std::fmt::Debug; diff --git a/src/test/ui/parser/trait-bounds-not-on-impl.rs b/src/test/ui/parser/trait-bounds-not-on-impl.rs index 7cd2774fe39..d77ff80ca25 100644 --- a/src/test/ui/parser/trait-bounds-not-on-impl.rs +++ b/src/test/ui/parser/trait-bounds-not-on-impl.rs @@ -1,14 +1,4 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error trait Foo { } diff --git a/src/test/ui/parser/trait-bounds-not-on-impl.stderr b/src/test/ui/parser/trait-bounds-not-on-impl.stderr index 68bb090e45f..3c0346c96b2 100644 --- a/src/test/ui/parser/trait-bounds-not-on-impl.stderr +++ b/src/test/ui/parser/trait-bounds-not-on-impl.stderr @@ -1,5 +1,5 @@ error: expected a trait, found type - --> $DIR/trait-bounds-not-on-impl.rs:18:6 + --> $DIR/trait-bounds-not-on-impl.rs:8:6 | LL | impl Foo + Owned for Bar { //~ ERROR expected a trait, found type | ^^^^^^^^^^^ diff --git a/src/test/ui/parser/trait-object-bad-parens.rs b/src/test/ui/parser/trait-object-bad-parens.rs index 25e9c3071d6..0f1f49a521b 100644 --- a/src/test/ui/parser/trait-object-bad-parens.rs +++ b/src/test/ui/parser/trait-object-bad-parens.rs @@ -1,22 +1,16 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// compile-flags: -Z continue-parse-after-error -// compile-flags: -Z parse-only -Z continue-parse-after-error +#![feature(optin_builtin_traits)] + +auto trait Auto {} fn main() { - let _: Box<((Copy)) + Copy>; - //~^ ERROR expected a path on the left-hand side of `+`, not `((Copy))` - let _: Box<(Copy + Copy) + Copy>; - //~^ ERROR expected a path on the left-hand side of `+`, not `(Copy + Copy)` - let _: Box<(Copy +) + Copy>; - //~^ ERROR expected a path on the left-hand side of `+`, not `(Copy)` - let _: Box<(dyn Copy) + Copy>; - //~^ ERROR expected a path on the left-hand side of `+`, not `(dyn Copy)` + let _: Box<((Auto)) + Auto>; + //~^ ERROR expected a path on the left-hand side of `+`, not `((Auto))` + let _: Box<(Auto + Auto) + Auto>; + //~^ ERROR expected a path on the left-hand side of `+`, not `(Auto + Auto)` + let _: Box<(Auto +) + Auto>; + //~^ ERROR expected a path on the left-hand side of `+`, not `(Auto)` + let _: Box<(dyn Auto) + Auto>; + //~^ ERROR expected a path on the left-hand side of `+`, not `(dyn Auto)` } diff --git a/src/test/ui/parser/trait-object-bad-parens.stderr b/src/test/ui/parser/trait-object-bad-parens.stderr index a1c483c3eca..74e484eebee 100644 --- a/src/test/ui/parser/trait-object-bad-parens.stderr +++ b/src/test/ui/parser/trait-object-bad-parens.stderr @@ -1,25 +1,25 @@ -error[E0178]: expected a path on the left-hand side of `+`, not `((Copy))` - --> $DIR/trait-object-bad-parens.rs:14:16 +error[E0178]: expected a path on the left-hand side of `+`, not `((Auto))` + --> $DIR/trait-object-bad-parens.rs:8:16 | -LL | let _: Box<((Copy)) + Copy>; +LL | let _: Box<((Auto)) + Auto>; | ^^^^^^^^^^^^^^^ expected a path -error[E0178]: expected a path on the left-hand side of `+`, not `(Copy + Copy)` - --> $DIR/trait-object-bad-parens.rs:16:16 +error[E0178]: expected a path on the left-hand side of `+`, not `(Auto + Auto)` + --> $DIR/trait-object-bad-parens.rs:10:16 | -LL | let _: Box<(Copy + Copy) + Copy>; +LL | let _: Box<(Auto + Auto) + Auto>; | ^^^^^^^^^^^^^^^^^^^^ expected a path -error[E0178]: expected a path on the left-hand side of `+`, not `(Copy)` - --> $DIR/trait-object-bad-parens.rs:18:16 +error[E0178]: expected a path on the left-hand side of `+`, not `(Auto)` + --> $DIR/trait-object-bad-parens.rs:12:16 | -LL | let _: Box<(Copy +) + Copy>; +LL | let _: Box<(Auto +) + Auto>; | ^^^^^^^^^^^^^^^ expected a path -error[E0178]: expected a path on the left-hand side of `+`, not `(dyn Copy)` - --> $DIR/trait-object-bad-parens.rs:20:16 +error[E0178]: expected a path on the left-hand side of `+`, not `(dyn Auto)` + --> $DIR/trait-object-bad-parens.rs:14:16 | -LL | let _: Box<(dyn Copy) + Copy>; +LL | let _: Box<(dyn Auto) + Auto>; | ^^^^^^^^^^^^^^^^^ expected a path error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/trait-object-lifetime-parens.rs b/src/test/ui/parser/trait-object-lifetime-parens.rs index 6be62d966eb..b188e14778b 100644 --- a/src/test/ui/parser/trait-object-lifetime-parens.rs +++ b/src/test/ui/parser/trait-object-lifetime-parens.rs @@ -1,18 +1,12 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// compile-flags: -Z continue-parse-after-error -// compile-flags: -Z parse-only -Z continue-parse-after-error +trait Trait {} -fn f() {} //~ ERROR parenthesized lifetime bounds are not supported +fn f<'a, T: Trait + ('a)>() {} //~ ERROR parenthesized lifetime bounds are not supported -fn main() { - let _: Box; //~ ERROR parenthesized lifetime bounds are not supported - let _: Box<('a) + Copy>; //~ ERROR expected type, found `'a` +fn check<'a>() { + let _: Box; //~ ERROR parenthesized lifetime bounds are not supported + let _: Box<('a) + Trait>; //~ ERROR expected type, found `'a` } + +fn main() {} diff --git a/src/test/ui/parser/trait-object-lifetime-parens.stderr b/src/test/ui/parser/trait-object-lifetime-parens.stderr index 7c7921bd38d..a9b542ddcc4 100644 --- a/src/test/ui/parser/trait-object-lifetime-parens.stderr +++ b/src/test/ui/parser/trait-object-lifetime-parens.stderr @@ -1,19 +1,19 @@ error: parenthesized lifetime bounds are not supported - --> $DIR/trait-object-lifetime-parens.rs:13:19 + --> $DIR/trait-object-lifetime-parens.rs:5:24 | -LL | fn f() {} //~ ERROR parenthesized lifetime bounds are not supported - | ^ +LL | fn f<'a, T: Trait + ('a)>() {} //~ ERROR parenthesized lifetime bounds are not supported + | ^ error: parenthesized lifetime bounds are not supported - --> $DIR/trait-object-lifetime-parens.rs:16:26 + --> $DIR/trait-object-lifetime-parens.rs:8:27 | -LL | let _: Box; //~ ERROR parenthesized lifetime bounds are not supported - | ^ +LL | let _: Box; //~ ERROR parenthesized lifetime bounds are not supported + | ^ error: expected type, found `'a` - --> $DIR/trait-object-lifetime-parens.rs:17:17 + --> $DIR/trait-object-lifetime-parens.rs:9:17 | -LL | let _: Box<('a) + Copy>; //~ ERROR expected type, found `'a` +LL | let _: Box<('a) + Trait>; //~ ERROR expected type, found `'a` | - ^^ | | | while parsing the type for `_` diff --git a/src/test/ui/parser/trait-object-polytrait-priority.rs b/src/test/ui/parser/trait-object-polytrait-priority.rs index 646ef487665..40d2ad52c35 100644 --- a/src/test/ui/parser/trait-object-polytrait-priority.rs +++ b/src/test/ui/parser/trait-object-polytrait-priority.rs @@ -1,15 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - trait Trait<'a> {} fn main() { diff --git a/src/test/ui/parser/trait-object-polytrait-priority.stderr b/src/test/ui/parser/trait-object-polytrait-priority.stderr index 4ceff81885a..5e2a35ea60c 100644 --- a/src/test/ui/parser/trait-object-polytrait-priority.stderr +++ b/src/test/ui/parser/trait-object-polytrait-priority.stderr @@ -1,5 +1,5 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&for<'a> Trait<'a>` - --> $DIR/trait-object-polytrait-priority.rs:16:12 + --> $DIR/trait-object-polytrait-priority.rs:4:12 | LL | let _: &for<'a> Trait<'a> + 'static; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&(for<'a> Trait<'a> + 'static)` diff --git a/src/test/ui/parser/trait-object-trait-parens.rs b/src/test/ui/parser/trait-object-trait-parens.rs index 1feb0c84532..2bbc5800015 100644 --- a/src/test/ui/parser/trait-object-trait-parens.rs +++ b/src/test/ui/parser/trait-object-trait-parens.rs @@ -1,20 +1,12 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-pass -// compile-flags: -Z parse-only +trait Trait<'a> {} fn f Trait<'a>)>() {} fn main() { let _: Box<(Copy) + (?Sized) + (for<'a> Trait<'a>)>; + //~^ ERROR `?Trait` is not permitted in trait object types let _: Box<(?Sized) + (for<'a> Trait<'a>) + (Copy)>; let _: Box<(for<'a> Trait<'a>) + (Copy) + (?Sized)>; + //~^ ERROR `?Trait` is not permitted in trait object types + //~| ERROR use of undeclared lifetime name `'a` } diff --git a/src/test/ui/parser/trait-object-trait-parens.stderr b/src/test/ui/parser/trait-object-trait-parens.stderr new file mode 100644 index 00000000000..36494b76539 --- /dev/null +++ b/src/test/ui/parser/trait-object-trait-parens.stderr @@ -0,0 +1,21 @@ +error: `?Trait` is not permitted in trait object types + --> $DIR/trait-object-trait-parens.rs:6:25 + | +LL | let _: Box<(Copy) + (?Sized) + (for<'a> Trait<'a>)>; + | ^^^^^^^^ + +error: `?Trait` is not permitted in trait object types + --> $DIR/trait-object-trait-parens.rs:9:47 + | +LL | let _: Box<(for<'a> Trait<'a>) + (Copy) + (?Sized)>; + | ^^^^^^^^ + +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/trait-object-trait-parens.rs:9:31 + | +LL | let _: Box<(for<'a> Trait<'a>) + (Copy) + (?Sized)>; + | ^^ undeclared lifetime + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0261`. diff --git a/src/test/ui/parser/trait-plusequal-splitting.rs b/src/test/ui/parser/trait-plusequal-splitting.rs index 32174d6254a..c655a15d268 100644 --- a/src/test/ui/parser/trait-plusequal-splitting.rs +++ b/src/test/ui/parser/trait-plusequal-splitting.rs @@ -1,17 +1,6 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Fixes issue where `+` in generics weren't parsed if they were part of a `+=`. // compile-pass -// compile-flags: -Z parse-only struct Whitespace { t: T } struct TokenSplit { t: T } diff --git a/src/test/ui/parser/trait-pub-assoc-const.rs b/src/test/ui/parser/trait-pub-assoc-const.rs index 0a412092017..3ee2dc1ae18 100644 --- a/src/test/ui/parser/trait-pub-assoc-const.rs +++ b/src/test/ui/parser/trait-pub-assoc-const.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - trait Foo { pub const Foo: u32; //~^ ERROR expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found diff --git a/src/test/ui/parser/trait-pub-assoc-const.stderr b/src/test/ui/parser/trait-pub-assoc-const.stderr index 9e82d348453..8fc9ae4cf28 100644 --- a/src/test/ui/parser/trait-pub-assoc-const.stderr +++ b/src/test/ui/parser/trait-pub-assoc-const.stderr @@ -1,5 +1,5 @@ error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `pub` - --> $DIR/trait-pub-assoc-const.rs:14:5 + --> $DIR/trait-pub-assoc-const.rs:2:5 | LL | trait Foo { | - expected one of 7 possible tokens here diff --git a/src/test/ui/parser/trait-pub-assoc-ty.rs b/src/test/ui/parser/trait-pub-assoc-ty.rs index 940743d3ffa..042addfd1a4 100644 --- a/src/test/ui/parser/trait-pub-assoc-ty.rs +++ b/src/test/ui/parser/trait-pub-assoc-ty.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - trait Foo { pub type Foo; //~^ ERROR expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found diff --git a/src/test/ui/parser/trait-pub-assoc-ty.stderr b/src/test/ui/parser/trait-pub-assoc-ty.stderr index 47ae68353ac..b8eab4e87bf 100644 --- a/src/test/ui/parser/trait-pub-assoc-ty.stderr +++ b/src/test/ui/parser/trait-pub-assoc-ty.stderr @@ -1,5 +1,5 @@ error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `pub` - --> $DIR/trait-pub-assoc-ty.rs:14:5 + --> $DIR/trait-pub-assoc-ty.rs:2:5 | LL | trait Foo { | - expected one of 7 possible tokens here diff --git a/src/test/ui/parser/trait-pub-method.rs b/src/test/ui/parser/trait-pub-method.rs index f9c064a105c..9675182c156 100644 --- a/src/test/ui/parser/trait-pub-method.rs +++ b/src/test/ui/parser/trait-pub-method.rs @@ -1,15 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - trait Foo { pub fn foo(); //~^ ERROR expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found diff --git a/src/test/ui/parser/trait-pub-method.stderr b/src/test/ui/parser/trait-pub-method.stderr index 49bcb64aa7d..d4db961c3fa 100644 --- a/src/test/ui/parser/trait-pub-method.stderr +++ b/src/test/ui/parser/trait-pub-method.stderr @@ -1,5 +1,5 @@ error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `pub` - --> $DIR/trait-pub-method.rs:14:5 + --> $DIR/trait-pub-method.rs:2:5 | LL | trait Foo { | - expected one of 7 possible tokens here diff --git a/src/test/ui/parser/type-parameters-in-field-exprs.rs b/src/test/ui/parser/type-parameters-in-field-exprs.rs index cb018ff1bfa..1b8ed9f12b8 100644 --- a/src/test/ui/parser/type-parameters-in-field-exprs.rs +++ b/src/test/ui/parser/type-parameters-in-field-exprs.rs @@ -1,14 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error struct Foo { x: isize, diff --git a/src/test/ui/parser/type-parameters-in-field-exprs.stderr b/src/test/ui/parser/type-parameters-in-field-exprs.stderr index f8b63b49be3..2183c74da0a 100644 --- a/src/test/ui/parser/type-parameters-in-field-exprs.stderr +++ b/src/test/ui/parser/type-parameters-in-field-exprs.stderr @@ -1,20 +1,20 @@ error: field expressions may not have generic arguments - --> $DIR/type-parameters-in-field-exprs.rs:23:8 + --> $DIR/type-parameters-in-field-exprs.rs:13:10 | LL | f.x::; - | ^^^^^^^^^ + | ^^^^^^^ error: field expressions may not have generic arguments - --> $DIR/type-parameters-in-field-exprs.rs:25:8 + --> $DIR/type-parameters-in-field-exprs.rs:15:10 | LL | f.x::<>; - | ^^^^ + | ^^ error: field expressions may not have generic arguments - --> $DIR/type-parameters-in-field-exprs.rs:27:8 + --> $DIR/type-parameters-in-field-exprs.rs:17:10 | LL | f.x::(); - | ^^^^ + | ^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/unbalanced-doublequote.rs b/src/test/ui/parser/unbalanced-doublequote.rs index 8d10f64504a..f2131620537 100644 --- a/src/test/ui/parser/unbalanced-doublequote.rs +++ b/src/test/ui/parser/unbalanced-doublequote.rs @@ -1,16 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - - // error-pattern: unterminated double quote string diff --git a/src/test/ui/parser/unbalanced-doublequote.stderr b/src/test/ui/parser/unbalanced-doublequote.stderr index e12eceeb24b..4d98515c224 100644 --- a/src/test/ui/parser/unbalanced-doublequote.stderr +++ b/src/test/ui/parser/unbalanced-doublequote.stderr @@ -1,5 +1,5 @@ error: unterminated double quote string - --> $DIR/unbalanced-doublequote.rs:18:5 + --> $DIR/unbalanced-doublequote.rs:5:5 | LL | / " LL | | } diff --git a/src/test/ui/parser/unclosed-braces.rs b/src/test/ui/parser/unclosed-braces.rs index 82f2ffd4dc0..9c9ab766130 100644 --- a/src/test/ui/parser/unclosed-braces.rs +++ b/src/test/ui/parser/unclosed-braces.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - struct S { x: [usize; 3], } diff --git a/src/test/ui/parser/unclosed-braces.stderr b/src/test/ui/parser/unclosed-braces.stderr index 3fdfdc0a809..3ab366446d8 100644 --- a/src/test/ui/parser/unclosed-braces.stderr +++ b/src/test/ui/parser/unclosed-braces.stderr @@ -1,5 +1,5 @@ error: this file contains an un-closed delimiter - --> $DIR/unclosed-braces.rs:34:53 + --> $DIR/unclosed-braces.rs:22:53 | LL | fn main() { | - un-closed delimiter diff --git a/src/test/ui/parser/underscore-suffix-for-float.rs b/src/test/ui/parser/underscore-suffix-for-float.rs index bb1cf5949b9..c9b7eced0b2 100644 --- a/src/test/ui/parser/underscore-suffix-for-float.rs +++ b/src/test/ui/parser/underscore-suffix-for-float.rs @@ -1,15 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let a = 42._; //~ ERROR expected identifier, found reserved identifier `_` + //~| ERROR `{integer}` is a primitive type and therefore doesn't have fields } diff --git a/src/test/ui/parser/underscore-suffix-for-float.stderr b/src/test/ui/parser/underscore-suffix-for-float.stderr index 18e6dac2608..58adcbbba76 100644 --- a/src/test/ui/parser/underscore-suffix-for-float.stderr +++ b/src/test/ui/parser/underscore-suffix-for-float.stderr @@ -1,8 +1,15 @@ error: expected identifier, found reserved identifier `_` - --> $DIR/underscore-suffix-for-float.rs:14:16 + --> $DIR/underscore-suffix-for-float.rs:2:16 | LL | let a = 42._; //~ ERROR expected identifier, found reserved identifier `_` | ^ expected identifier, found reserved identifier -error: aborting due to previous error +error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields + --> $DIR/underscore-suffix-for-float.rs:2:16 + | +LL | let a = 42._; //~ ERROR expected identifier, found reserved identifier `_` + | ^ + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0610`. diff --git a/src/test/ui/parser/underscore-suffix-for-string.rs b/src/test/ui/parser/underscore-suffix-for-string.rs index 3ef29a3692e..bcd0b24c750 100644 --- a/src/test/ui/parser/underscore-suffix-for-string.rs +++ b/src/test/ui/parser/underscore-suffix-for-string.rs @@ -1,15 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass -// compile-flags: -Z parse-only fn main() { let _ = "Foo"_; diff --git a/src/test/ui/parser/underscore-suffix-for-string.stderr b/src/test/ui/parser/underscore-suffix-for-string.stderr index bbce7097354..80d0d1bc83b 100644 --- a/src/test/ui/parser/underscore-suffix-for-string.stderr +++ b/src/test/ui/parser/underscore-suffix-for-string.stderr @@ -1,5 +1,5 @@ warning: underscore literal suffix is not allowed - --> $DIR/underscore-suffix-for-string.rs:15:18 + --> $DIR/underscore-suffix-for-string.rs:4:18 | LL | let _ = "Foo"_; | ^ diff --git a/src/test/ui/parser/underscore_static.rs b/src/test/ui/parser/underscore_static.rs new file mode 100644 index 00000000000..21d6a1bc1b3 --- /dev/null +++ b/src/test/ui/parser/underscore_static.rs @@ -0,0 +1,3 @@ +static _: () = (); //~ ERROR expected identifier, found reserved identifier `_` + +fn main() {} diff --git a/src/test/ui/parser/underscore_static.stderr b/src/test/ui/parser/underscore_static.stderr new file mode 100644 index 00000000000..3bf3ce88a63 --- /dev/null +++ b/src/test/ui/parser/underscore_static.stderr @@ -0,0 +1,8 @@ +error: expected identifier, found reserved identifier `_` + --> $DIR/underscore_static.rs:1:8 + | +LL | static _: () = (); //~ ERROR expected identifier, found reserved identifier `_` + | ^ expected identifier, found reserved identifier + +error: aborting due to previous error + diff --git a/src/test/ui/parser/unicode-chars.rs b/src/test/ui/parser/unicode-chars.rs index f590a7f2aa2..89ae85ec990 100644 --- a/src/test/ui/parser/unicode-chars.rs +++ b/src/test/ui/parser/unicode-chars.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn main() { let y = 0; //~^ ERROR unknown start of token: \u{37e} diff --git a/src/test/ui/parser/unicode-chars.stderr b/src/test/ui/parser/unicode-chars.stderr index 5c30a5040f0..3a360d8f468 100644 --- a/src/test/ui/parser/unicode-chars.stderr +++ b/src/test/ui/parser/unicode-chars.stderr @@ -1,5 +1,5 @@ error: unknown start of token: /u{37e} - --> $DIR/unicode-chars.rs:14:14 + --> $DIR/unicode-chars.rs:2:14 | LL | let y = 0; | ^ diff --git a/src/test/ui/parser/unmatched-delimiter-at-end-of-file.rs b/src/test/ui/parser/unmatched-delimiter-at-end-of-file.rs new file mode 100644 index 00000000000..3eef75bafd3 --- /dev/null +++ b/src/test/ui/parser/unmatched-delimiter-at-end-of-file.rs @@ -0,0 +1,11 @@ +struct S { + x: usize, + y: usize, +} + +fn main() { + S { x: 4, + y: 5 }; +} + +fn foo() { //~ ERROR this file contains an un-closed delimiter diff --git a/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr b/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr new file mode 100644 index 00000000000..442837e5808 --- /dev/null +++ b/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr @@ -0,0 +1,8 @@ +error: this file contains an un-closed delimiter + --> $DIR/unmatched-delimiter-at-end-of-file.rs:11:64 + | +LL | fn foo() { //~ ERROR this file contains an un-closed delimiter + | - un-closed delimiter ^ + +error: aborting due to previous error + diff --git a/src/test/ui/parser/unsized.rs b/src/test/ui/parser/unsized.rs index 533b947b79a..e7fd7a1961e 100644 --- a/src/test/ui/parser/unsized.rs +++ b/src/test/ui/parser/unsized.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Test syntax checks for `type` keyword. struct S1 for type; diff --git a/src/test/ui/parser/unsized.stderr b/src/test/ui/parser/unsized.stderr index cc35c2035ea..3d4ed526b6a 100644 --- a/src/test/ui/parser/unsized.stderr +++ b/src/test/ui/parser/unsized.stderr @@ -1,5 +1,5 @@ error: expected `where`, `{`, `(`, or `;` after struct name, found keyword `for` - --> $DIR/unsized.rs:15:11 + --> $DIR/unsized.rs:3:11 | LL | struct S1 for type; | ^^^ expected `where`, `{`, `(`, or `;` after struct name diff --git a/src/test/ui/parser/unsized2.rs b/src/test/ui/parser/unsized2.rs index f3af8740be9..21370b329a3 100644 --- a/src/test/ui/parser/unsized2.rs +++ b/src/test/ui/parser/unsized2.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Test syntax checks for `type` keyword. fn f() {} diff --git a/src/test/ui/parser/unsized2.stderr b/src/test/ui/parser/unsized2.stderr index 323b8fd9ea8..fd12d86144c 100644 --- a/src/test/ui/parser/unsized2.stderr +++ b/src/test/ui/parser/unsized2.stderr @@ -1,5 +1,5 @@ error: expected expression, found keyword `type` - --> $DIR/unsized2.rs:18:7 + --> $DIR/unsized2.rs:6:7 | LL | f(); //~ ERROR expected expression, found keyword `type` | ^^^^ expected expression diff --git a/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.rs b/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.rs index 9e16e29ba50..d322e9ffe68 100644 --- a/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.rs +++ b/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error use std::any:: as foo; //~ ERROR expected identifier, found keyword `as` //~^ ERROR: expected one of `::`, `;`, or `as`, found `foo` diff --git a/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr b/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr index e7452f403b2..51e1a02cbd7 100644 --- a/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr +++ b/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr @@ -1,11 +1,15 @@ error: expected identifier, found keyword `as` - --> $DIR/use-as-where-use-ends-with-mod-sep.rs:13:16 + --> $DIR/use-as-where-use-ends-with-mod-sep.rs:3:16 | LL | use std::any:: as foo; //~ ERROR expected identifier, found keyword `as` | ^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | use std::any:: r#as foo; //~ ERROR expected identifier, found keyword `as` + | ^^^^ error: expected one of `::`, `;`, or `as`, found `foo` - --> $DIR/use-as-where-use-ends-with-mod-sep.rs:13:19 + --> $DIR/use-as-where-use-ends-with-mod-sep.rs:3:19 | LL | use std::any:: as foo; //~ ERROR expected identifier, found keyword `as` | ^^^ expected one of `::`, `;`, or `as` here diff --git a/src/test/ui/parser/use-ends-with-mod-sep.rs b/src/test/ui/parser/use-ends-with-mod-sep.rs index e6a10d43e29..ad8da4d1860 100644 --- a/src/test/ui/parser/use-ends-with-mod-sep.rs +++ b/src/test/ui/parser/use-ends-with-mod-sep.rs @@ -1,13 +1 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - use std::any::; //~ ERROR expected identifier, found `;` diff --git a/src/test/ui/parser/use-ends-with-mod-sep.stderr b/src/test/ui/parser/use-ends-with-mod-sep.stderr index c463f746a58..4a2b95ada6d 100644 --- a/src/test/ui/parser/use-ends-with-mod-sep.stderr +++ b/src/test/ui/parser/use-ends-with-mod-sep.stderr @@ -1,5 +1,5 @@ error: expected identifier, found `;` - --> $DIR/use-ends-with-mod-sep.rs:13:15 + --> $DIR/use-ends-with-mod-sep.rs:1:15 | LL | use std::any::; //~ ERROR expected identifier, found `;` | ^ expected identifier diff --git a/src/test/ui/parser/variadic-ffi-3.rs b/src/test/ui/parser/variadic-ffi-3.rs index d202fa33cc1..13bce27bb83 100644 --- a/src/test/ui/parser/variadic-ffi-3.rs +++ b/src/test/ui/parser/variadic-ffi-3.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn foo(x: isize, ...) { //~^ ERROR: only foreign functions are allowed to be variadic } diff --git a/src/test/ui/parser/variadic-ffi-3.stderr b/src/test/ui/parser/variadic-ffi-3.stderr index 93f19253f00..150de9e63d3 100644 --- a/src/test/ui/parser/variadic-ffi-3.stderr +++ b/src/test/ui/parser/variadic-ffi-3.stderr @@ -1,5 +1,5 @@ error: only foreign functions are allowed to be variadic - --> $DIR/variadic-ffi-3.rs:13:18 + --> $DIR/variadic-ffi-3.rs:1:18 | LL | fn foo(x: isize, ...) { | ^^^ diff --git a/src/test/ui/parser/variadic-ffi-4.rs b/src/test/ui/parser/variadic-ffi-4.rs index ef9d4558f68..812ed256a5d 100644 --- a/src/test/ui/parser/variadic-ffi-4.rs +++ b/src/test/ui/parser/variadic-ffi-4.rs @@ -1,15 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - extern "C" fn foo(x: isize, ...) { //~^ ERROR: only foreign functions are allowed to be variadic } diff --git a/src/test/ui/parser/variadic-ffi-4.stderr b/src/test/ui/parser/variadic-ffi-4.stderr index 228c0d6ef14..2d036b0cf37 100644 --- a/src/test/ui/parser/variadic-ffi-4.stderr +++ b/src/test/ui/parser/variadic-ffi-4.stderr @@ -1,5 +1,5 @@ error: only foreign functions are allowed to be variadic - --> $DIR/variadic-ffi-4.rs:13:29 + --> $DIR/variadic-ffi-4.rs:1:29 | LL | extern "C" fn foo(x: isize, ...) { | ^^^ diff --git a/src/test/ui/parser/virtual-structs.rs b/src/test/ui/parser/virtual-structs.rs index b7426140d8a..ce57a3454bb 100644 --- a/src/test/ui/parser/virtual-structs.rs +++ b/src/test/ui/parser/virtual-structs.rs @@ -1,15 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Test diagnostics for the removed struct inheritance feature. virtual struct SuperStruct { diff --git a/src/test/ui/parser/virtual-structs.stderr b/src/test/ui/parser/virtual-structs.stderr index 659c7701c00..a5211d83f84 100644 --- a/src/test/ui/parser/virtual-structs.stderr +++ b/src/test/ui/parser/virtual-structs.stderr @@ -1,5 +1,5 @@ error: expected item, found reserved keyword `virtual` - --> $DIR/virtual-structs.rs:15:1 + --> $DIR/virtual-structs.rs:3:1 | LL | virtual struct SuperStruct { | ^^^^^^^ expected item diff --git a/src/test/ui/parser/where-clauses-no-bounds-or-predicates.rs b/src/test/ui/parser/where-clauses-no-bounds-or-predicates.rs index cf67b518fff..45dacf22cfa 100644 --- a/src/test/ui/parser/where-clauses-no-bounds-or-predicates.rs +++ b/src/test/ui/parser/where-clauses-no-bounds-or-predicates.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only -Z continue-parse-after-error +// compile-flags: -Z continue-parse-after-error // Empty predicate list is OK fn equal1(_: &T, _: &T) -> bool where { diff --git a/src/test/ui/parser/where-clauses-no-bounds-or-predicates.stderr b/src/test/ui/parser/where-clauses-no-bounds-or-predicates.stderr index 1dda2d3e7fd..7e82522872e 100644 --- a/src/test/ui/parser/where-clauses-no-bounds-or-predicates.stderr +++ b/src/test/ui/parser/where-clauses-no-bounds-or-predicates.stderr @@ -1,5 +1,5 @@ error: expected `:`, found `{` - --> $DIR/where-clauses-no-bounds-or-predicates.rs:23:23 + --> $DIR/where-clauses-no-bounds-or-predicates.rs:13:23 | LL | fn foo<'a>() where 'a {} | ^ expected `:` diff --git a/src/test/ui/parser/where_with_bound.rs b/src/test/ui/parser/where_with_bound.rs index 2948619ccd0..3ca45f1889c 100644 --- a/src/test/ui/parser/where_with_bound.rs +++ b/src/test/ui/parser/where_with_bound.rs @@ -1,16 +1,5 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - fn foo() where ::Item: ToString, T: Iterator { } //~^ ERROR generic parameters on `where` clauses are reserved for future use +//~| ERROR cannot find type `Item` in the crate root fn main() {} diff --git a/src/test/ui/parser/where_with_bound.stderr b/src/test/ui/parser/where_with_bound.stderr index 7cf16fbcef4..ff98b3f5fed 100644 --- a/src/test/ui/parser/where_with_bound.stderr +++ b/src/test/ui/parser/where_with_bound.stderr @@ -1,8 +1,15 @@ error: generic parameters on `where` clauses are reserved for future use - --> $DIR/where_with_bound.rs:13:19 + --> $DIR/where_with_bound.rs:1:19 | LL | fn foo() where ::Item: ToString, T: Iterator { } - | ^^^ + | ^^^ currently unsupported -error: aborting due to previous error +error[E0412]: cannot find type `Item` in the crate root + --> $DIR/where_with_bound.rs:1:24 + | +LL | fn foo() where ::Item: ToString, T: Iterator { } + | ^^^^ not found in the crate root + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/parser/wrong-escape-of-curly-braces.rs b/src/test/ui/parser/wrong-escape-of-curly-braces.rs index e501f5ef1fd..7a5c27afca5 100644 --- a/src/test/ui/parser/wrong-escape-of-curly-braces.rs +++ b/src/test/ui/parser/wrong-escape-of-curly-braces.rs @@ -1,16 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - -fn f() { +fn main() { let ok = "{{everything fine}}"; let bad = "\{it is wrong\}"; //~^ ERROR unknown character escape: { diff --git a/src/test/ui/parser/wrong-escape-of-curly-braces.stderr b/src/test/ui/parser/wrong-escape-of-curly-braces.stderr index cbb5c4ff3ec..90debfc337d 100644 --- a/src/test/ui/parser/wrong-escape-of-curly-braces.stderr +++ b/src/test/ui/parser/wrong-escape-of-curly-braces.stderr @@ -1,23 +1,23 @@ error: unknown character escape: { - --> $DIR/wrong-escape-of-curly-braces.rs:15:17 + --> $DIR/wrong-escape-of-curly-braces.rs:3:17 | LL | let bad = "/{it is wrong/}"; | ^ | help: if used in a formatting string, curly braces are escaped with `{{` and `}}` - --> $DIR/wrong-escape-of-curly-braces.rs:15:17 + --> $DIR/wrong-escape-of-curly-braces.rs:3:17 | LL | let bad = "/{it is wrong/}"; | ^ error: unknown character escape: } - --> $DIR/wrong-escape-of-curly-braces.rs:15:30 + --> $DIR/wrong-escape-of-curly-braces.rs:3:30 | LL | let bad = "/{it is wrong/}"; | ^ | help: if used in a formatting string, curly braces are escaped with `{{` and `}}` - --> $DIR/wrong-escape-of-curly-braces.rs:15:30 + --> $DIR/wrong-escape-of-curly-braces.rs:3:30 | LL | let bad = "/{it is wrong/}"; | ^ diff --git a/src/test/ui/partialeq_help.rs b/src/test/ui/partialeq_help.rs index ee6d632d1a3..c3ba805405b 100644 --- a/src/test/ui/partialeq_help.rs +++ b/src/test/ui/partialeq_help.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(a: &T, b: T) { a == b; //~ ERROR E0277 } diff --git a/src/test/ui/partialeq_help.stderr b/src/test/ui/partialeq_help.stderr index 43f13d45684..04eb9770c46 100644 --- a/src/test/ui/partialeq_help.stderr +++ b/src/test/ui/partialeq_help.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `&T` with `T` - --> $DIR/partialeq_help.rs:12:7 + --> $DIR/partialeq_help.rs:2:7 | LL | a == b; //~ ERROR E0277 | ^^ no implementation for `&T == T` diff --git a/src/test/ui/path-lookahead.rs b/src/test/ui/path-lookahead.rs index 367a2560155..fd7509a623e 100644 --- a/src/test/ui/path-lookahead.rs +++ b/src/test/ui/path-lookahead.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![warn(unused)] diff --git a/src/test/ui/path-lookahead.stderr b/src/test/ui/path-lookahead.stderr index 89df5e894aa..73c6884679d 100644 --- a/src/test/ui/path-lookahead.stderr +++ b/src/test/ui/path-lookahead.stderr @@ -1,31 +1,31 @@ warning: unnecessary parentheses around `return` value - --> $DIR/path-lookahead.rs:18:10 + --> $DIR/path-lookahead.rs:8:10 | LL | return (::to_string(&arg)); //~WARN unnecessary parentheses around `return` value | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses | note: lint level defined here - --> $DIR/path-lookahead.rs:13:9 + --> $DIR/path-lookahead.rs:3:9 | LL | #![warn(unused)] | ^^^^^^ = note: #[warn(unused_parens)] implied by #[warn(unused)] warning: function is never used: `with_parens` - --> $DIR/path-lookahead.rs:17:1 + --> $DIR/path-lookahead.rs:7:1 | LL | fn with_parens(arg: T) -> String { //~WARN function is never used: `with_parens` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/path-lookahead.rs:13:9 + --> $DIR/path-lookahead.rs:3:9 | LL | #![warn(unused)] | ^^^^^^ = note: #[warn(dead_code)] implied by #[warn(unused)] warning: function is never used: `no_parens` - --> $DIR/path-lookahead.rs:21:1 + --> $DIR/path-lookahead.rs:11:1 | LL | fn no_parens(arg: T) -> String { //~WARN function is never used: `no_parens` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/pattern/const-pat-ice.rs b/src/test/ui/pattern/const-pat-ice.rs new file mode 100644 index 00000000000..865c54be1ad --- /dev/null +++ b/src/test/ui/pattern/const-pat-ice.rs @@ -0,0 +1,14 @@ +// failure-status: 101 +// rustc-env:RUST_BACKTRACE=0 + +// This is a repro test for an ICE in our pattern handling of constants. + +const FOO: &&&u32 = &&&42; + +fn main() { + match unimplemented!() { + &&&42 => {}, + FOO => {}, + _ => {}, + } +} diff --git a/src/test/ui/pattern/deny-irrefutable-let-patterns.rs b/src/test/ui/pattern/deny-irrefutable-let-patterns.rs new file mode 100644 index 00000000000..14040c8ada6 --- /dev/null +++ b/src/test/ui/pattern/deny-irrefutable-let-patterns.rs @@ -0,0 +1,9 @@ +#![deny(irrefutable_let_patterns)] + +fn main() { + if let _ = 5 {} //~ ERROR irrefutable if-let pattern + + while let _ = 5 { //~ ERROR irrefutable while-let pattern + break; + } +} diff --git a/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr b/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr new file mode 100644 index 00000000000..ad8cc2ef897 --- /dev/null +++ b/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr @@ -0,0 +1,22 @@ +error: irrefutable if-let pattern + --> $DIR/deny-irrefutable-let-patterns.rs:4:5 + | +LL | if let _ = 5 {} //~ ERROR irrefutable if-let pattern + | ^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/deny-irrefutable-let-patterns.rs:1:9 + | +LL | #![deny(irrefutable_let_patterns)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: irrefutable while-let pattern + --> $DIR/deny-irrefutable-let-patterns.rs:6:5 + | +LL | / while let _ = 5 { //~ ERROR irrefutable while-let pattern +LL | | break; +LL | | } + | |_____^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/pattern/enum-variant-generic-args.rs b/src/test/ui/pattern/enum-variant-generic-args.rs new file mode 100644 index 00000000000..85599530ea6 --- /dev/null +++ b/src/test/ui/pattern/enum-variant-generic-args.rs @@ -0,0 +1,43 @@ +// run-pass + +#![feature(type_alias_enum_variants)] + +#![allow(irrefutable_let_patterns)] + +#[allow(dead_code)] +enum Enum { TSVariant(T), SVariant { v: T } } +type Alias = Enum; +type AliasFixed = Enum<()>; + +macro_rules! is_variant { + (TSVariant, $expr:expr) => (is_variant!(@check TSVariant, (_), $expr)); + (SVariant, $expr:expr) => (is_variant!(@check SVariant, { v: _ }, $expr)); + (@check $variant:ident, $matcher:tt, $expr:expr) => ( + assert!(if let Enum::$variant::<()> $matcher = $expr { true } else { false }, + "expr does not have correct type"); + ); +} + +fn main() { + // Tuple struct variant + + is_variant!(TSVariant, Enum::TSVariant(())); + is_variant!(TSVariant, Enum::TSVariant::<()>(())); + is_variant!(TSVariant, Enum::<()>::TSVariant(())); + + is_variant!(TSVariant, Alias::TSVariant(())); + is_variant!(TSVariant, Alias::<()>::TSVariant(())); + + is_variant!(TSVariant, AliasFixed::TSVariant(())); + + // Struct variant + + is_variant!(SVariant, Enum::SVariant { v: () }); + is_variant!(SVariant, Enum::SVariant::<()> { v: () }); + is_variant!(SVariant, Enum::<()>::SVariant { v: () }); + + is_variant!(SVariant, Alias::SVariant { v: () }); + is_variant!(SVariant, Alias::<()>::SVariant { v: () }); + + is_variant!(SVariant, AliasFixed::SVariant { v: () }); +} diff --git a/src/test/ui/pattern/irrefutable-exhaustive-integer-binding.rs b/src/test/ui/pattern/irrefutable-exhaustive-integer-binding.rs new file mode 100644 index 00000000000..ff065882d96 --- /dev/null +++ b/src/test/ui/pattern/irrefutable-exhaustive-integer-binding.rs @@ -0,0 +1,8 @@ +// run-pass + +fn main() { + let -2147483648..=2147483647 = 1; + let 0..=255 = 0u8; + let -128..=127 = 0i8; + let '\u{0000}'..='\u{10FFFF}' = 'v'; +} diff --git a/src/test/ui/pattern/irrefutable-let-patterns.rs b/src/test/ui/pattern/irrefutable-let-patterns.rs new file mode 100644 index 00000000000..d400ef0bbd6 --- /dev/null +++ b/src/test/ui/pattern/irrefutable-let-patterns.rs @@ -0,0 +1,11 @@ +// run-pass + +#![allow(irrefutable_let_patterns)] + +fn main() { + if let _ = 5 {} + + while let _ = 5 { + break; + } +} diff --git a/src/test/ui/pattern/pat-shadow-in-nested-binding.rs b/src/test/ui/pattern/pat-shadow-in-nested-binding.rs index 3dbe08f1908..7badbb6b95c 100644 --- a/src/test/ui/pattern/pat-shadow-in-nested-binding.rs +++ b/src/test/ui/pattern/pat-shadow-in-nested-binding.rs @@ -1,13 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +#[allow(non_camel_case_types)] struct foo(usize); fn main() { diff --git a/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr b/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr index 994c78d575e..7dbe23a8f28 100644 --- a/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr +++ b/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr @@ -1,5 +1,5 @@ error[E0530]: let bindings cannot shadow tuple structs - --> $DIR/pat-shadow-in-nested-binding.rs:14:10 + --> $DIR/pat-shadow-in-nested-binding.rs:5:10 | LL | struct foo(usize); | ------------------ the tuple struct `foo` is defined here diff --git a/src/test/ui/pattern/pat-tuple-bad-type.rs b/src/test/ui/pattern/pat-tuple-bad-type.rs index 251e7b47dcc..01e793e8685 100644 --- a/src/test/ui/pattern/pat-tuple-bad-type.rs +++ b/src/test/ui/pattern/pat-tuple-bad-type.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x; diff --git a/src/test/ui/pattern/pat-tuple-bad-type.stderr b/src/test/ui/pattern/pat-tuple-bad-type.stderr index d4f80550b3e..28aa52856c5 100644 --- a/src/test/ui/pattern/pat-tuple-bad-type.stderr +++ b/src/test/ui/pattern/pat-tuple-bad-type.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/pat-tuple-bad-type.rs:15:9 + --> $DIR/pat-tuple-bad-type.rs:5:9 | LL | let x; | - consider giving `x` a type @@ -10,7 +10,7 @@ LL | (..) => {} //~ ERROR type annotations needed = note: type must be known at this point error[E0308]: mismatched types - --> $DIR/pat-tuple-bad-type.rs:20:9 + --> $DIR/pat-tuple-bad-type.rs:10:9 | LL | (..) => {} //~ ERROR mismatched types | ^^^^ expected u8, found () diff --git a/src/test/ui/pattern/pat-tuple-overfield.rs b/src/test/ui/pattern/pat-tuple-overfield.rs index 851fa5c5be6..46a5e15ffa5 100644 --- a/src/test/ui/pattern/pat-tuple-overfield.rs +++ b/src/test/ui/pattern/pat-tuple-overfield.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S(u8, u8, u8); fn main() { diff --git a/src/test/ui/pattern/pat-tuple-overfield.stderr b/src/test/ui/pattern/pat-tuple-overfield.stderr index 2802b42f313..4bd374affb3 100644 --- a/src/test/ui/pattern/pat-tuple-overfield.stderr +++ b/src/test/ui/pattern/pat-tuple-overfield.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/pat-tuple-overfield.rs:15:9 + --> $DIR/pat-tuple-overfield.rs:5:9 | LL | (1, 2, 3, 4) => {} //~ ERROR mismatched types | ^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 4 elements @@ -8,7 +8,7 @@ LL | (1, 2, 3, 4) => {} //~ ERROR mismatched types found type `(_, _, _, _)` error[E0308]: mismatched types - --> $DIR/pat-tuple-overfield.rs:16:9 + --> $DIR/pat-tuple-overfield.rs:6:9 | LL | (1, 2, .., 3, 4) => {} //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 4 elements @@ -17,13 +17,13 @@ LL | (1, 2, .., 3, 4) => {} //~ ERROR mismatched types found type `(_, _, _, _)` error[E0023]: this pattern has 4 fields, but the corresponding tuple struct has 3 fields - --> $DIR/pat-tuple-overfield.rs:20:9 + --> $DIR/pat-tuple-overfield.rs:10:9 | LL | S(1, 2, 3, 4) => {} | ^^^^^^^^^^^^^ expected 3 fields, found 4 error[E0023]: this pattern has 4 fields, but the corresponding tuple struct has 3 fields - --> $DIR/pat-tuple-overfield.rs:22:9 + --> $DIR/pat-tuple-overfield.rs:12:9 | LL | S(1, 2, .., 3, 4) => {} | ^^^^^^^^^^^^^^^^^ expected 3 fields, found 4 diff --git a/src/test/ui/pattern/patkind-litrange-no-expr.rs b/src/test/ui/pattern/patkind-litrange-no-expr.rs index 8fef98f815f..def6c62459e 100644 --- a/src/test/ui/pattern/patkind-litrange-no-expr.rs +++ b/src/test/ui/pattern/patkind-litrange-no-expr.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! enum_number { ($name:ident { $($variant:ident = $value:expr, )* }) => { enum $name { diff --git a/src/test/ui/pattern/patkind-litrange-no-expr.stderr b/src/test/ui/pattern/patkind-litrange-no-expr.stderr index f22870fb029..4caafa7d3e8 100644 --- a/src/test/ui/pattern/patkind-litrange-no-expr.stderr +++ b/src/test/ui/pattern/patkind-litrange-no-expr.stderr @@ -1,11 +1,11 @@ error: arbitrary expressions aren't allowed in patterns - --> $DIR/patkind-litrange-no-expr.rs:30:13 + --> $DIR/patkind-litrange-no-expr.rs:20:13 | LL | Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns | ^^^^^ error[E0029]: only char and numeric types are allowed in range patterns - --> $DIR/patkind-litrange-no-expr.rs:30:13 + --> $DIR/patkind-litrange-no-expr.rs:20:13 | LL | Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns | ^^^^^ ranges require char or numeric types diff --git a/src/test/ui/pattern/pattern-binding-disambiguation.rs b/src/test/ui/pattern/pattern-binding-disambiguation.rs index c740f6bb47c..2e80ea345dc 100644 --- a/src/test/ui/pattern/pattern-binding-disambiguation.rs +++ b/src/test/ui/pattern/pattern-binding-disambiguation.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct UnitStruct; struct TupleStruct(); struct BracedStruct{} diff --git a/src/test/ui/pattern/pattern-binding-disambiguation.stderr b/src/test/ui/pattern/pattern-binding-disambiguation.stderr index 5d14610b8a1..958934c301f 100644 --- a/src/test/ui/pattern/pattern-binding-disambiguation.stderr +++ b/src/test/ui/pattern/pattern-binding-disambiguation.stderr @@ -1,5 +1,5 @@ error[E0530]: match bindings cannot shadow tuple structs - --> $DIR/pattern-binding-disambiguation.rs:34:9 + --> $DIR/pattern-binding-disambiguation.rs:24:9 | LL | struct TupleStruct(); | --------------------- the tuple struct `TupleStruct` is defined here @@ -8,7 +8,7 @@ LL | TupleStruct => {} //~ ERROR match bindings cannot shadow tuple stru | ^^^^^^^^^^^ cannot be named the same as a tuple struct error[E0530]: match bindings cannot shadow tuple variants - --> $DIR/pattern-binding-disambiguation.rs:43:9 + --> $DIR/pattern-binding-disambiguation.rs:33:9 | LL | use E::*; | ---- the tuple variant `TupleVariant` is imported here @@ -17,7 +17,7 @@ LL | TupleVariant => {} //~ ERROR match bindings cannot shadow tuple var | ^^^^^^^^^^^^ cannot be named the same as a tuple variant error[E0530]: match bindings cannot shadow struct variants - --> $DIR/pattern-binding-disambiguation.rs:46:9 + --> $DIR/pattern-binding-disambiguation.rs:36:9 | LL | use E::*; | ---- the struct variant `BracedVariant` is imported here @@ -26,7 +26,7 @@ LL | BracedVariant => {} //~ ERROR match bindings cannot shadow struct v | ^^^^^^^^^^^^^ cannot be named the same as a struct variant error[E0530]: match bindings cannot shadow statics - --> $DIR/pattern-binding-disambiguation.rs:52:9 + --> $DIR/pattern-binding-disambiguation.rs:42:9 | LL | static STATIC: () = (); | ----------------------- the static `STATIC` is defined here @@ -35,7 +35,7 @@ LL | STATIC => {} //~ ERROR match bindings cannot shadow statics | ^^^^^^ cannot be named the same as a static error[E0530]: let bindings cannot shadow tuple structs - --> $DIR/pattern-binding-disambiguation.rs:59:9 + --> $DIR/pattern-binding-disambiguation.rs:49:9 | LL | struct TupleStruct(); | --------------------- the tuple struct `TupleStruct` is defined here @@ -44,7 +44,7 @@ LL | let TupleStruct = doesnt_matter; //~ ERROR let bindings cannot shadow t | ^^^^^^^^^^^ cannot be named the same as a tuple struct error[E0530]: let bindings cannot shadow tuple variants - --> $DIR/pattern-binding-disambiguation.rs:62:9 + --> $DIR/pattern-binding-disambiguation.rs:52:9 | LL | use E::*; | ---- the tuple variant `TupleVariant` is imported here @@ -53,7 +53,7 @@ LL | let TupleVariant = doesnt_matter; //~ ERROR let bindings cannot shadow | ^^^^^^^^^^^^ cannot be named the same as a tuple variant error[E0530]: let bindings cannot shadow struct variants - --> $DIR/pattern-binding-disambiguation.rs:63:9 + --> $DIR/pattern-binding-disambiguation.rs:53:9 | LL | use E::*; | ---- the struct variant `BracedVariant` is imported here @@ -62,7 +62,7 @@ LL | let BracedVariant = doesnt_matter; //~ ERROR let bindings cannot shadow | ^^^^^^^^^^^^^ cannot be named the same as a struct variant error[E0530]: let bindings cannot shadow statics - --> $DIR/pattern-binding-disambiguation.rs:65:9 + --> $DIR/pattern-binding-disambiguation.rs:55:9 | LL | static STATIC: () = (); | ----------------------- the static `STATIC` is defined here diff --git a/src/test/ui/pattern/pattern-bindings-after-at.rs b/src/test/ui/pattern/pattern-bindings-after-at.rs index da2a97b0ca8..4a24a496857 100644 --- a/src/test/ui/pattern/pattern-bindings-after-at.rs +++ b/src/test/ui/pattern/pattern-bindings-after-at.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Option { None, Some(T), diff --git a/src/test/ui/pattern/pattern-bindings-after-at.stderr b/src/test/ui/pattern/pattern-bindings-after-at.stderr index 8c715001baa..7a3883c5854 100644 --- a/src/test/ui/pattern/pattern-bindings-after-at.stderr +++ b/src/test/ui/pattern/pattern-bindings-after-at.stderr @@ -1,5 +1,5 @@ error[E0303]: pattern bindings are not allowed after an `@` - --> $DIR/pattern-bindings-after-at.rs:18:31 + --> $DIR/pattern-bindings-after-at.rs:8:31 | LL | ref mut z @ &mut Some(ref a) => { | ^^^^^ not allowed after `@` diff --git a/src/test/ui/pattern/pattern-error-continue.rs b/src/test/ui/pattern/pattern-error-continue.rs index c544ca4e304..7e79868f874 100644 --- a/src/test/ui/pattern/pattern-error-continue.rs +++ b/src/test/ui/pattern/pattern-error-continue.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that certain pattern-match type errors are non-fatal enum A { diff --git a/src/test/ui/pattern/pattern-error-continue.stderr b/src/test/ui/pattern/pattern-error-continue.stderr index f2c35ef872d..654814afcfe 100644 --- a/src/test/ui/pattern/pattern-error-continue.stderr +++ b/src/test/ui/pattern/pattern-error-continue.stderr @@ -1,26 +1,28 @@ error[E0433]: failed to resolve: use of undeclared type or module `E` - --> $DIR/pattern-error-continue.rs:45:9 + --> $DIR/pattern-error-continue.rs:35:9 | LL | E::V => {} //~ ERROR failed to resolve: use of undeclared type or module `E` | ^ use of undeclared type or module `E` error[E0532]: expected tuple struct/variant, found unit variant `A::D` - --> $DIR/pattern-error-continue.rs:28:9 + --> $DIR/pattern-error-continue.rs:18:9 | LL | A::D(_) => (), //~ ERROR expected tuple struct/variant, found unit variant `A::D` | ^^^- | | - | did you mean `B`? + | help: a tuple variant with a similar name exists: `B` error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields - --> $DIR/pattern-error-continue.rs:27:9 + --> $DIR/pattern-error-continue.rs:17:9 | LL | A::B(_, _, _) => (), //~ ERROR this pattern has 3 fields, but | ^^^^^^^^^^^^^ expected 2 fields, found 3 error[E0308]: mismatched types - --> $DIR/pattern-error-continue.rs:32:9 + --> $DIR/pattern-error-continue.rs:22:9 | +LL | match 'c' { + | --- this match expression has type `char` LL | S { .. } => (), | ^^^^^^^^ expected char, found struct `S` | @@ -28,7 +30,7 @@ LL | S { .. } => (), found type `S` error[E0308]: mismatched types - --> $DIR/pattern-error-continue.rs:40:7 + --> $DIR/pattern-error-continue.rs:30:7 | LL | f(true); | ^^^^ expected char, found bool diff --git a/src/test/ui/pattern/pattern-ident-path-generics.rs b/src/test/ui/pattern/pattern-ident-path-generics.rs index 0b7886842b4..48c02623f28 100644 --- a/src/test/ui/pattern/pattern-ident-path-generics.rs +++ b/src/test/ui/pattern/pattern-ident-path-generics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { match Some("foo") { None:: => {} //~ ERROR mismatched types diff --git a/src/test/ui/pattern/pattern-ident-path-generics.stderr b/src/test/ui/pattern/pattern-ident-path-generics.stderr index cd205956571..278b3d19d8b 100644 --- a/src/test/ui/pattern/pattern-ident-path-generics.stderr +++ b/src/test/ui/pattern/pattern-ident-path-generics.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/pattern-ident-path-generics.rs:13:9 + --> $DIR/pattern-ident-path-generics.rs:3:9 | LL | None:: => {} //~ ERROR mismatched types | ^^^^^^^^^^^^^ expected &str, found isize diff --git a/src/test/ui/pattern/pattern-tyvar-2.rs b/src/test/ui/pattern/pattern-tyvar-2.rs index cd4a98835c8..9fba9cb876a 100644 --- a/src/test/ui/pattern/pattern-tyvar-2.rs +++ b/src/test/ui/pattern/pattern-tyvar-2.rs @@ -1,17 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +enum Bar { T1((), Option>), T2, } -enum bar { t1((), Option>), t2, } - -// n.b. my change changes this error message, but I think it's right -- tjc -fn foo(t: bar) -> isize { match t { bar::t1(_, Some(x)) => { return x * 3; } _ => { panic!(); } } } +fn foo(t: Bar) -> isize { match t { Bar::T1(_, Some(x)) => { return x * 3; } _ => { panic!(); } } } //~^ ERROR binary operation `*` cannot be applied to fn main() { } diff --git a/src/test/ui/pattern/pattern-tyvar-2.stderr b/src/test/ui/pattern/pattern-tyvar-2.stderr index fd7ab84cc56..5218dd916a5 100644 --- a/src/test/ui/pattern/pattern-tyvar-2.stderr +++ b/src/test/ui/pattern/pattern-tyvar-2.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `*` cannot be applied to type `std::vec::Vec` - --> $DIR/pattern-tyvar-2.rs:14:69 + --> $DIR/pattern-tyvar-2.rs:3:69 | -LL | fn foo(t: bar) -> isize { match t { bar::t1(_, Some(x)) => { return x * 3; } _ => { panic!(); } } } +LL | fn foo(t: Bar) -> isize { match t { Bar::T1(_, Some(x)) => { return x * 3; } _ => { panic!(); } } } | ^^^^^ | = note: an implementation of `std::ops::Mul` might be missing for `std::vec::Vec` diff --git a/src/test/ui/pattern/pattern-tyvar.rs b/src/test/ui/pattern/pattern-tyvar.rs index be8d3e027e7..e2cbf05193d 100644 --- a/src/test/ui/pattern/pattern-tyvar.rs +++ b/src/test/ui/pattern/pattern-tyvar.rs @@ -1,20 +1,8 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +enum Bar { T1((), Option>), T2 } -// error-pattern: mismatched types - -enum bar { t1((), Option >), t2, } - -fn foo(t: bar) { +fn foo(t: Bar) { match t { - bar::t1(_, Some::(x)) => { + Bar::T1(_, Some::(x)) => { //~ ERROR mismatched types println!("{}", x); } _ => { panic!(); } diff --git a/src/test/ui/pattern/pattern-tyvar.stderr b/src/test/ui/pattern/pattern-tyvar.stderr index 55e09e02a1d..69cd552aabd 100644 --- a/src/test/ui/pattern/pattern-tyvar.stderr +++ b/src/test/ui/pattern/pattern-tyvar.stderr @@ -1,7 +1,9 @@ error[E0308]: mismatched types - --> $DIR/pattern-tyvar.rs:17:18 + --> $DIR/pattern-tyvar.rs:5:18 | -LL | bar::t1(_, Some::(x)) => { +LL | match t { + | - this match expression has type `std::option::Option>` +LL | Bar::T1(_, Some::(x)) => { //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^ expected struct `std::vec::Vec`, found isize | = note: expected type `std::option::Option>` diff --git a/src/test/ui/pattern/slice-pattern-const-2.rs b/src/test/ui/pattern/slice-pattern-const-2.rs new file mode 100644 index 00000000000..6cfef115d08 --- /dev/null +++ b/src/test/ui/pattern/slice-pattern-const-2.rs @@ -0,0 +1,31 @@ +#![deny(unreachable_patterns)] + +fn main() { + let s = &[0x00; 4][..]; //Slice of any value + const MAGIC_TEST: &[u32] = &[4, 5, 6, 7]; //Const slice to pattern match with + match s { + MAGIC_TEST => (), + [0x00, 0x00, 0x00, 0x00] => (), + [4, 5, 6, 7] => (), //~ ERROR unreachable pattern + _ => (), + } + match s { + [0x00, 0x00, 0x00, 0x00] => (), + MAGIC_TEST => (), + [4, 5, 6, 7] => (), //~ ERROR unreachable pattern + _ => (), + } + match s { + [0x00, 0x00, 0x00, 0x00] => (), + [4, 5, 6, 7] => (), + MAGIC_TEST => (), // FIXME(oli-obk): this should warn, but currently does not + _ => (), + } + const FOO: [u32; 1] = [4]; + match [99] { + [0x00] => (), + [4] => (), + FOO => (), //~ ERROR unreachable pattern + _ => (), + } +} diff --git a/src/test/ui/pattern/slice-pattern-const-2.stderr b/src/test/ui/pattern/slice-pattern-const-2.stderr new file mode 100644 index 00000000000..95651ccc401 --- /dev/null +++ b/src/test/ui/pattern/slice-pattern-const-2.stderr @@ -0,0 +1,26 @@ +error: unreachable pattern + --> $DIR/slice-pattern-const-2.rs:9:9 + | +LL | [4, 5, 6, 7] => (), //~ ERROR unreachable pattern + | ^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/slice-pattern-const-2.rs:1:9 + | +LL | #![deny(unreachable_patterns)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unreachable pattern + --> $DIR/slice-pattern-const-2.rs:15:9 + | +LL | [4, 5, 6, 7] => (), //~ ERROR unreachable pattern + | ^^^^^^^^^^^^ + +error: unreachable pattern + --> $DIR/slice-pattern-const-2.rs:28:9 + | +LL | FOO => (), //~ ERROR unreachable pattern + | ^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/pattern/slice-pattern-const-3.rs b/src/test/ui/pattern/slice-pattern-const-3.rs new file mode 100644 index 00000000000..8805c43ba02 --- /dev/null +++ b/src/test/ui/pattern/slice-pattern-const-3.rs @@ -0,0 +1,31 @@ +#![deny(unreachable_patterns)] + +fn main() { + let s = &["0x00"; 4][..]; //Slice of any value + const MAGIC_TEST: &[&str] = &["4", "5", "6", "7"]; //Const slice to pattern match with + match s { + MAGIC_TEST => (), + ["0x00", "0x00", "0x00", "0x00"] => (), + ["4", "5", "6", "7"] => (), // FIXME(oli-obk): this should warn, but currently does not + _ => (), + } + match s { + ["0x00", "0x00", "0x00", "0x00"] => (), + MAGIC_TEST => (), + ["4", "5", "6", "7"] => (), // FIXME(oli-obk): this should warn, but currently does not + _ => (), + } + match s { + ["0x00", "0x00", "0x00", "0x00"] => (), + ["4", "5", "6", "7"] => (), + MAGIC_TEST => (), // FIXME(oli-obk): this should warn, but currently does not + _ => (), + } + const FOO: [&str; 1] = ["boo"]; + match ["baa"] { + ["0x00"] => (), + ["boo"] => (), + FOO => (), //~ ERROR unreachable pattern + _ => (), + } +} diff --git a/src/test/ui/pattern/slice-pattern-const-3.stderr b/src/test/ui/pattern/slice-pattern-const-3.stderr new file mode 100644 index 00000000000..531bbbc84d0 --- /dev/null +++ b/src/test/ui/pattern/slice-pattern-const-3.stderr @@ -0,0 +1,14 @@ +error: unreachable pattern + --> $DIR/slice-pattern-const-3.rs:28:9 + | +LL | FOO => (), //~ ERROR unreachable pattern + | ^^^ + | +note: lint level defined here + --> $DIR/slice-pattern-const-3.rs:1:9 + | +LL | #![deny(unreachable_patterns)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/pattern/slice-pattern-const.rs b/src/test/ui/pattern/slice-pattern-const.rs new file mode 100644 index 00000000000..f0a04513f91 --- /dev/null +++ b/src/test/ui/pattern/slice-pattern-const.rs @@ -0,0 +1,47 @@ +#![deny(unreachable_patterns)] + +fn main() { + let s = &[0x00; 4][..]; //Slice of any value + const MAGIC_TEST: &[u8] = b"TEST"; //Const slice to pattern match with + match s { + MAGIC_TEST => (), + [0x00, 0x00, 0x00, 0x00] => (), + [84, 69, 83, 84] => (), //~ ERROR unreachable pattern + _ => (), + } + match s { + [0x00, 0x00, 0x00, 0x00] => (), + MAGIC_TEST => (), + [84, 69, 83, 84] => (), //~ ERROR unreachable pattern + _ => (), + } + match s { + [0x00, 0x00, 0x00, 0x00] => (), + [84, 69, 83, 84] => (), + MAGIC_TEST => (), //~ ERROR unreachable pattern + _ => (), + } + const FOO: [u8; 1] = [4]; + match [99] { + [0x00] => (), + [4] => (), + FOO => (), //~ ERROR unreachable pattern + _ => (), + } + const BAR: &[u8; 1] = &[4]; + match &[99] { + [0x00] => (), + [4] => (), + BAR => (), //~ ERROR unreachable pattern + b"a" => (), + _ => (), + } + + const BOO: &[u8; 0] = &[]; + match &[] { + [] => (), + BOO => (), //~ ERROR unreachable pattern + b"" => (), //~ ERROR unreachable pattern + _ => (), //~ ERROR unreachable pattern + } +} diff --git a/src/test/ui/pattern/slice-pattern-const.stderr b/src/test/ui/pattern/slice-pattern-const.stderr new file mode 100644 index 00000000000..412e0158c01 --- /dev/null +++ b/src/test/ui/pattern/slice-pattern-const.stderr @@ -0,0 +1,56 @@ +error: unreachable pattern + --> $DIR/slice-pattern-const.rs:9:9 + | +LL | [84, 69, 83, 84] => (), //~ ERROR unreachable pattern + | ^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/slice-pattern-const.rs:1:9 + | +LL | #![deny(unreachable_patterns)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unreachable pattern + --> $DIR/slice-pattern-const.rs:15:9 + | +LL | [84, 69, 83, 84] => (), //~ ERROR unreachable pattern + | ^^^^^^^^^^^^^^^^ + +error: unreachable pattern + --> $DIR/slice-pattern-const.rs:21:9 + | +LL | MAGIC_TEST => (), //~ ERROR unreachable pattern + | ^^^^^^^^^^ + +error: unreachable pattern + --> $DIR/slice-pattern-const.rs:28:9 + | +LL | FOO => (), //~ ERROR unreachable pattern + | ^^^ + +error: unreachable pattern + --> $DIR/slice-pattern-const.rs:35:9 + | +LL | BAR => (), //~ ERROR unreachable pattern + | ^^^ + +error: unreachable pattern + --> $DIR/slice-pattern-const.rs:43:9 + | +LL | BOO => (), //~ ERROR unreachable pattern + | ^^^ + +error: unreachable pattern + --> $DIR/slice-pattern-const.rs:44:9 + | +LL | b"" => (), //~ ERROR unreachable pattern + | ^^^ + +error: unreachable pattern + --> $DIR/slice-pattern-const.rs:45:9 + | +LL | _ => (), //~ ERROR unreachable pattern + | ^ + +error: aborting due to 8 previous errors + diff --git a/src/test/ui/phantom-oibit.rs b/src/test/ui/phantom-oibit.rs index 51e7d5da98f..04291a70606 100644 --- a/src/test/ui/phantom-oibit.rs +++ b/src/test/ui/phantom-oibit.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensure that OIBIT checks `T` when it encounters a `PhantomData` field, instead of checking // the `PhantomData` type itself (which almost always implements an auto trait) diff --git a/src/test/ui/phantom-oibit.stderr b/src/test/ui/phantom-oibit.stderr index 5156ba94cef..ec8b3181bc5 100644 --- a/src/test/ui/phantom-oibit.stderr +++ b/src/test/ui/phantom-oibit.stderr @@ -1,5 +1,5 @@ error[E0277]: `T` cannot be shared between threads safely - --> $DIR/phantom-oibit.rs:31:5 + --> $DIR/phantom-oibit.rs:21:5 | LL | is_zen(x) | ^^^^^^ `T` cannot be shared between threads safely @@ -10,13 +10,13 @@ LL | is_zen(x) = note: required because it appears within the type `std::marker::PhantomData<&T>` = note: required because it appears within the type `Guard<'_, T>` note: required by `is_zen` - --> $DIR/phantom-oibit.rs:28:1 + --> $DIR/phantom-oibit.rs:18:1 | LL | fn is_zen(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `T` cannot be shared between threads safely - --> $DIR/phantom-oibit.rs:36:5 + --> $DIR/phantom-oibit.rs:26:5 | LL | is_zen(x) | ^^^^^^ `T` cannot be shared between threads safely @@ -28,7 +28,7 @@ LL | is_zen(x) = note: required because it appears within the type `Guard<'_, T>` = note: required because it appears within the type `Nested>` note: required by `is_zen` - --> $DIR/phantom-oibit.rs:28:1 + --> $DIR/phantom-oibit.rs:18:1 | LL | fn is_zen(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/placement-syntax.rs b/src/test/ui/placement-syntax.rs index 39252597a23..ac6fed1558f 100644 --- a/src/test/ui/placement-syntax.rs +++ b/src/test/ui/placement-syntax.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = -5; if x<-1 { diff --git a/src/test/ui/placement-syntax.stderr b/src/test/ui/placement-syntax.stderr index 933ba96519c..350aaa9bddd 100644 --- a/src/test/ui/placement-syntax.stderr +++ b/src/test/ui/placement-syntax.stderr @@ -1,5 +1,5 @@ error: emplacement syntax is obsolete (for now, anyway) - --> $DIR/placement-syntax.rs:13:8 + --> $DIR/placement-syntax.rs:3:8 | LL | if x<-1 { | ^^^^ diff --git a/src/test/ui/platform-intrinsic-params.rs b/src/test/ui/platform-intrinsic-params.rs deleted file mode 100644 index e8a9031dba8..00000000000 --- a/src/test/ui/platform-intrinsic-params.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(platform_intrinsics)] -extern "platform-intrinsic" { - fn x86_mm_movemask_ps() -> i32; //~ERROR found 0, expected 1 -} - -fn main() { } diff --git a/src/test/ui/platform-intrinsic-params.stderr b/src/test/ui/platform-intrinsic-params.stderr deleted file mode 100644 index e41de9fe02d..00000000000 --- a/src/test/ui/platform-intrinsic-params.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0444]: platform-specific intrinsic has invalid number of arguments: found 0, expected 1 - --> $DIR/platform-intrinsic-params.rs:13:5 - | -LL | fn x86_mm_movemask_ps() -> i32; //~ERROR found 0, expected 1 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0444`. diff --git a/src/test/ui/point-to-type-err-cause-on-impl-trait-return-2.rs b/src/test/ui/point-to-type-err-cause-on-impl-trait-return-2.rs new file mode 100644 index 00000000000..50f1fe873cb --- /dev/null +++ b/src/test/ui/point-to-type-err-cause-on-impl-trait-return-2.rs @@ -0,0 +1,17 @@ +fn unrelated() -> Result<(), std::string::ParseError> { // #57664 + let x = 0; + + match x { + 1 => { + let property_value_as_string = "a".parse()?; + } + 2 => { + let value: &bool = unsafe { &42 }; + //~^ ERROR mismatched types + } + }; + + Ok(()) +} + +fn main() {} diff --git a/src/test/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr b/src/test/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr new file mode 100644 index 00000000000..edaa60e5b8d --- /dev/null +++ b/src/test/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr @@ -0,0 +1,12 @@ +error[E0308]: mismatched types + --> $DIR/point-to-type-err-cause-on-impl-trait-return-2.rs:9:41 + | +LL | let value: &bool = unsafe { &42 }; + | ^^^ expected bool, found integer + | + = note: expected type `&bool` + found type `&{integer}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs new file mode 100644 index 00000000000..95b40368143 --- /dev/null +++ b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs @@ -0,0 +1,36 @@ +fn foo() -> impl std::fmt::Display { + if false { + return 0i32; + } + 1u32 + //~^ ERROR mismatched types +} + +fn bar() -> impl std::fmt::Display { + if false { + return 0i32; + } else { + return 1u32; + //~^ ERROR mismatched types + } +} + +fn baz() -> impl std::fmt::Display { + if false { + //~^ ERROR mismatched types + return 0i32; + } else { + 1u32 + } +} + +fn qux() -> impl std::fmt::Display { + if false { + 0i32 + } else { + 1u32 + //~^ ERROR if and else have incompatible types + } +} + +fn main() {} diff --git a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr new file mode 100644 index 00000000000..5ebe00e624f --- /dev/null +++ b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr @@ -0,0 +1,66 @@ +error[E0308]: mismatched types + --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:5:5 + | +LL | fn foo() -> impl std::fmt::Display { + | ---------------------- expected because this return type... +LL | if false { +LL | return 0i32; + | ---- ...is found to be `i32` here +LL | } +LL | 1u32 + | ^^^^ expected i32, found u32 + | + = note: expected type `i32` + found type `u32` + +error[E0308]: mismatched types + --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:13:16 + | +LL | fn bar() -> impl std::fmt::Display { + | ---------------------- expected because this return type... +LL | if false { +LL | return 0i32; + | ---- ...is found to be `i32` here +LL | } else { +LL | return 1u32; + | ^^^^ expected i32, found u32 + | + = note: expected type `i32` + found type `u32` + +error[E0308]: mismatched types + --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:19:5 + | +LL | fn baz() -> impl std::fmt::Display { + | ---------------------- expected because this return type... +LL | / if false { +LL | | //~^ ERROR mismatched types +LL | | return 0i32; + | | ---- ...is found to be `i32` here +LL | | } else { +LL | | 1u32 +LL | | } + | |_____^ expected i32, found u32 + | + = note: expected type `i32` + found type `u32` + +error[E0308]: if and else have incompatible types + --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:31:9 + | +LL | / if false { +LL | | 0i32 + | | ---- expected because of this +LL | | } else { +LL | | 1u32 + | | ^^^^ expected i32, found u32 +LL | | //~^ ERROR if and else have incompatible types +LL | | } + | |_____- if and else have incompatible types + | + = note: expected type `i32` + found type `u32` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/pptypedef.rs b/src/test/ui/pptypedef.rs index 7ece52e7537..80ebf0242ec 100644 --- a/src/test/ui/pptypedef.rs +++ b/src/test/ui/pptypedef.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn let_in(x: T, f: F) where F: FnOnce(T) {} fn main() { diff --git a/src/test/ui/pptypedef.stderr b/src/test/ui/pptypedef.stderr index bde48d86ba5..32ee1a6aae9 100644 --- a/src/test/ui/pptypedef.stderr +++ b/src/test/ui/pptypedef.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/pptypedef.rs:14:37 + --> $DIR/pptypedef.rs:4:37 | LL | let_in(3u32, |i| { assert!(i == 3i32); }); | ^^^^ expected u32, found i32 error[E0308]: mismatched types - --> $DIR/pptypedef.rs:18:37 + --> $DIR/pptypedef.rs:8:37 | LL | let_in(3i32, |i| { assert!(i == 3u32); }); | ^^^^ expected i32, found u32 diff --git a/src/test/ui/precise_pointer_size_matching.rs b/src/test/ui/precise_pointer_size_matching.rs new file mode 100644 index 00000000000..759b63b188b --- /dev/null +++ b/src/test/ui/precise_pointer_size_matching.rs @@ -0,0 +1,33 @@ +// normalize-stderr-32bit: "-2147483648isize" -> "$$ISIZE_MIN" +// normalize-stderr-64bit: "-9223372036854775808isize" -> "$$ISIZE_MIN" +// normalize-stderr-32bit: "2147483647isize" -> "$$ISIZE_MAX" +// normalize-stderr-64bit: "9223372036854775807isize" -> "$$ISIZE_MAX" +// normalize-stderr-32bit: "4294967295usize" -> "$$USIZE_MAX" +// normalize-stderr-64bit: "18446744073709551615usize" -> "$$USIZE_MAX" + +#![feature(precise_pointer_size_matching)] +#![feature(exclusive_range_pattern)] + +#![deny(unreachable_patterns)] + +use std::{usize, isize}; + +fn main() { + match 0isize { + isize::MIN ..= isize::MAX => {} // ok + } + + match 0usize { + 0 ..= usize::MAX => {} // ok + } + + match 0isize { //~ ERROR non-exhaustive patterns + 1 ..= 8 => {} + -5 ..= 20 => {} + } + + match 0usize { //~ ERROR non-exhaustive patterns + 1 ..= 8 => {} + 5 ..= 20 => {} + } +} diff --git a/src/test/ui/precise_pointer_size_matching.stderr b/src/test/ui/precise_pointer_size_matching.stderr new file mode 100644 index 00000000000..4acbec6c7ff --- /dev/null +++ b/src/test/ui/precise_pointer_size_matching.stderr @@ -0,0 +1,15 @@ +error[E0004]: non-exhaustive patterns: `$ISIZE_MIN..=-6isize` and `21isize..=$ISIZE_MAX` not covered + --> $DIR/precise_pointer_size_matching.rs:24:11 + | +LL | match 0isize { //~ ERROR non-exhaustive patterns + | ^^^^^^ patterns `$ISIZE_MIN..=-6isize` and `21isize..=$ISIZE_MAX` not covered + +error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=$USIZE_MAX` not covered + --> $DIR/precise_pointer_size_matching.rs:29:11 + | +LL | match 0usize { //~ ERROR non-exhaustive patterns + | ^^^^^^ patterns `0usize` and `21usize..=$USIZE_MAX` not covered + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0004`. diff --git a/src/test/ui/prim-with-args.rs b/src/test/ui/prim-with-args.rs index cc0b74dc82a..b5df0fb76ca 100644 --- a/src/test/ui/prim-with-args.rs +++ b/src/test/ui/prim-with-args.rs @@ -1,37 +1,27 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { -let x: isize; //~ ERROR type parameters are not allowed on this type -let x: i8; //~ ERROR type parameters are not allowed on this type -let x: i16; //~ ERROR type parameters are not allowed on this type -let x: i32; //~ ERROR type parameters are not allowed on this type -let x: i64; //~ ERROR type parameters are not allowed on this type -let x: usize; //~ ERROR type parameters are not allowed on this type -let x: u8; //~ ERROR type parameters are not allowed on this type -let x: u16; //~ ERROR type parameters are not allowed on this type -let x: u32; //~ ERROR type parameters are not allowed on this type -let x: u64; //~ ERROR type parameters are not allowed on this type -let x: char; //~ ERROR type parameters are not allowed on this type +let x: isize; //~ ERROR type arguments are not allowed on this entity +let x: i8; //~ ERROR type arguments are not allowed on this entity +let x: i16; //~ ERROR type arguments are not allowed on this entity +let x: i32; //~ ERROR type arguments are not allowed on this entity +let x: i64; //~ ERROR type arguments are not allowed on this entity +let x: usize; //~ ERROR type arguments are not allowed on this entity +let x: u8; //~ ERROR type arguments are not allowed on this entity +let x: u16; //~ ERROR type arguments are not allowed on this entity +let x: u32; //~ ERROR type arguments are not allowed on this entity +let x: u64; //~ ERROR type arguments are not allowed on this entity +let x: char; //~ ERROR type arguments are not allowed on this entity -let x: isize<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: i8<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: i16<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: i32<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: i64<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: usize<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: u8<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: u16<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: u32<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: u64<'static>; //~ ERROR lifetime parameters are not allowed on this type -let x: char<'static>; //~ ERROR lifetime parameters are not allowed on this type +let x: isize<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: i8<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: i16<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: i32<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: i64<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: usize<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: u8<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: u16<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: u32<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: u64<'static>; //~ ERROR lifetime arguments are not allowed on this entity +let x: char<'static>; //~ ERROR lifetime arguments are not allowed on this entity } diff --git a/src/test/ui/prim-with-args.stderr b/src/test/ui/prim-with-args.stderr index bfe7256f8a2..91259e87efc 100644 --- a/src/test/ui/prim-with-args.stderr +++ b/src/test/ui/prim-with-args.stderr @@ -1,134 +1,134 @@ -error[E0109]: type parameters are not allowed on this type - --> $DIR/prim-with-args.rs:13:14 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:3:14 | -LL | let x: isize; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: isize; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/prim-with-args.rs:14:11 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:4:11 | -LL | let x: i8; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: i8; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/prim-with-args.rs:15:12 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:5:12 | -LL | let x: i16; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: i16; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/prim-with-args.rs:16:12 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:6:12 | -LL | let x: i32; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: i32; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/prim-with-args.rs:17:12 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:7:12 | -LL | let x: i64; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: i64; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/prim-with-args.rs:18:14 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:8:14 | -LL | let x: usize; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: usize; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/prim-with-args.rs:19:11 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:9:11 | -LL | let x: u8; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: u8; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/prim-with-args.rs:20:12 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:10:12 | -LL | let x: u16; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: u16; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/prim-with-args.rs:21:12 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:11:12 | -LL | let x: u32; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: u32; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/prim-with-args.rs:22:12 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:12:12 | -LL | let x: u64; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: u64; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/prim-with-args.rs:23:13 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:13:13 | -LL | let x: char; //~ ERROR type parameters are not allowed on this type - | ^^^^^ type parameter not allowed +LL | let x: char; //~ ERROR type arguments are not allowed on this entity + | ^^^^^ type argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/prim-with-args.rs:25:14 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:15:14 | -LL | let x: isize<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: isize<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/prim-with-args.rs:26:11 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:16:11 | -LL | let x: i8<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: i8<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/prim-with-args.rs:27:12 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:17:12 | -LL | let x: i16<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: i16<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/prim-with-args.rs:28:12 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:18:12 | -LL | let x: i32<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: i32<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/prim-with-args.rs:29:12 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:19:12 | -LL | let x: i64<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: i64<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/prim-with-args.rs:30:14 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:20:14 | -LL | let x: usize<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: usize<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/prim-with-args.rs:31:11 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:21:11 | -LL | let x: u8<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: u8<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/prim-with-args.rs:32:12 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:22:12 | -LL | let x: u16<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: u16<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/prim-with-args.rs:33:12 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:23:12 | -LL | let x: u32<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: u32<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/prim-with-args.rs:34:12 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:24:12 | -LL | let x: u64<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: u64<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/prim-with-args.rs:35:13 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/prim-with-args.rs:25:13 | -LL | let x: char<'static>; //~ ERROR lifetime parameters are not allowed on this type - | ^^^^^^^ lifetime parameter not allowed +LL | let x: char<'static>; //~ ERROR lifetime arguments are not allowed on this entity + | ^^^^^^^ lifetime argument not allowed error: aborting due to 22 previous errors diff --git a/src/test/ui/print-fuel/print-fuel.rs b/src/test/ui/print-fuel/print-fuel.rs index 31123410481..1bd39242669 100644 --- a/src/test/ui/print-fuel/print-fuel.rs +++ b/src/test/ui/print-fuel/print-fuel.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name="foo"] #![allow(dead_code)] diff --git a/src/test/ui/print_type_sizes/anonymous.rs b/src/test/ui/print_type_sizes/anonymous.rs index aff06a20112..4d2a0e27fd1 100644 --- a/src/test/ui/print_type_sizes/anonymous.rs +++ b/src/test/ui/print_type_sizes/anonymous.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z print-type-sizes // compile-pass diff --git a/src/test/ui/print_type_sizes/generics.rs b/src/test/ui/print_type_sizes/generics.rs index fa5921cfb13..360c9958686 100644 --- a/src/test/ui/print_type_sizes/generics.rs +++ b/src/test/ui/print_type_sizes/generics.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z print-type-sizes // compile-pass @@ -30,7 +20,7 @@ // Copy. // // (I suspect this reflect some naivety within the rust compiler -// itself; it should be checking for drop glue, i.e. a destructor +// itself; it should be checking for drop glue, i.e., a destructor // somewhere in the monomorphized types. It should not matter whether // the type is Copy.) #[derive(Copy, Clone)] diff --git a/src/test/ui/print_type_sizes/multiple_types.rs b/src/test/ui/print_type_sizes/multiple_types.rs index 3d6cb0d5f3c..1b1d8174201 100644 --- a/src/test/ui/print_type_sizes/multiple_types.rs +++ b/src/test/ui/print_type_sizes/multiple_types.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z print-type-sizes // compile-pass diff --git a/src/test/ui/print_type_sizes/niche-filling.rs b/src/test/ui/print_type_sizes/niche-filling.rs index 17e7a21cd02..bed1e32a601 100644 --- a/src/test/ui/print_type_sizes/niche-filling.rs +++ b/src/test/ui/print_type_sizes/niche-filling.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z print-type-sizes // compile-pass diff --git a/src/test/ui/print_type_sizes/niche-filling.stdout b/src/test/ui/print_type_sizes/niche-filling.stdout index 79f9ef5a231..0789c6d7f34 100644 --- a/src/test/ui/print_type_sizes/niche-filling.stdout +++ b/src/test/ui/print_type_sizes/niche-filling.stdout @@ -36,8 +36,6 @@ print-type-size type: `MyOption`: 4 bytes, alignment: 4 by print-type-size variant `None`: 0 bytes print-type-size variant `Some`: 4 bytes print-type-size field `.0`: 4 bytes -print-type-size type: `core::nonzero::NonZero`: 4 bytes, alignment: 4 bytes -print-type-size field `.0`: 4 bytes print-type-size type: `std::num::NonZeroU32`: 4 bytes, alignment: 4 bytes print-type-size field `.0`: 4 bytes print-type-size type: `Enum4<(), (), (), MyOption>`: 2 bytes, alignment: 1 bytes diff --git a/src/test/ui/print_type_sizes/no_duplicates.rs b/src/test/ui/print_type_sizes/no_duplicates.rs index 17ba4df7f20..7307c0fd8b4 100644 --- a/src/test/ui/print_type_sizes/no_duplicates.rs +++ b/src/test/ui/print_type_sizes/no_duplicates.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z print-type-sizes // compile-pass diff --git a/src/test/ui/print_type_sizes/packed.rs b/src/test/ui/print_type_sizes/packed.rs index bc11146aa85..ec3efd6923a 100644 --- a/src/test/ui/print_type_sizes/packed.rs +++ b/src/test/ui/print_type_sizes/packed.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z print-type-sizes // compile-pass @@ -21,7 +11,6 @@ #![allow(dead_code)] #![feature(start)] -#![feature(repr_packed)] #[derive(Default)] #[repr(packed)] diff --git a/src/test/ui/print_type_sizes/padding.rs b/src/test/ui/print_type_sizes/padding.rs index 335303afef9..c6d927cb1e5 100644 --- a/src/test/ui/print_type_sizes/padding.rs +++ b/src/test/ui/print_type_sizes/padding.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z print-type-sizes // compile-pass diff --git a/src/test/ui/print_type_sizes/repr-align.rs b/src/test/ui/print_type_sizes/repr-align.rs index 2e4c3ade92d..fd452f411c5 100644 --- a/src/test/ui/print_type_sizes/repr-align.rs +++ b/src/test/ui/print_type_sizes/repr-align.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z print-type-sizes // compile-pass diff --git a/src/test/ui/print_type_sizes/repr_int_c.rs b/src/test/ui/print_type_sizes/repr_int_c.rs index 04bb2ab26f3..6816bb71a00 100644 --- a/src/test/ui/print_type_sizes/repr_int_c.rs +++ b/src/test/ui/print_type_sizes/repr_int_c.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z print-type-sizes // compile-pass diff --git a/src/test/ui/print_type_sizes/uninhabited.rs b/src/test/ui/print_type_sizes/uninhabited.rs index 9ae86136a90..14245d0dc9a 100644 --- a/src/test/ui/print_type_sizes/uninhabited.rs +++ b/src/test/ui/print_type_sizes/uninhabited.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z print-type-sizes // compile-pass diff --git a/src/test/ui/print_type_sizes/variants.rs b/src/test/ui/print_type_sizes/variants.rs index 52e951bd684..aa2d25a3926 100644 --- a/src/test/ui/print_type_sizes/variants.rs +++ b/src/test/ui/print_type_sizes/variants.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z print-type-sizes // compile-pass diff --git a/src/test/ui/priv-in-bad-locations.rs b/src/test/ui/priv-in-bad-locations.rs index 8901d8c08e5..b9f5d4c3586 100644 --- a/src/test/ui/priv-in-bad-locations.rs +++ b/src/test/ui/priv-in-bad-locations.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub extern { //~ ERROR unnecessary visibility qualifier pub fn bar(); } diff --git a/src/test/ui/priv-in-bad-locations.stderr b/src/test/ui/priv-in-bad-locations.stderr index e395a2243df..09706a6d255 100644 --- a/src/test/ui/priv-in-bad-locations.stderr +++ b/src/test/ui/priv-in-bad-locations.stderr @@ -1,5 +1,5 @@ error[E0449]: unnecessary visibility qualifier - --> $DIR/priv-in-bad-locations.rs:11:1 + --> $DIR/priv-in-bad-locations.rs:1:1 | LL | pub extern { //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied @@ -7,7 +7,7 @@ LL | pub extern { //~ ERROR unnecessary visibility qualifier = note: place qualifiers on individual foreign items instead error[E0449]: unnecessary visibility qualifier - --> $DIR/priv-in-bad-locations.rs:21:1 + --> $DIR/priv-in-bad-locations.rs:11:1 | LL | pub impl B {} //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied @@ -15,13 +15,13 @@ LL | pub impl B {} //~ ERROR unnecessary visibility qualifier = note: place qualifiers on individual impl items instead error[E0449]: unnecessary visibility qualifier - --> $DIR/priv-in-bad-locations.rs:23:1 + --> $DIR/priv-in-bad-locations.rs:13:1 | LL | pub impl A for B { //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/priv-in-bad-locations.rs:24:5 + --> $DIR/priv-in-bad-locations.rs:14:5 | LL | pub fn foo(&self) {} //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied diff --git a/src/test/ui/privacy/associated-item-privacy-inherent.rs b/src/test/ui/privacy/associated-item-privacy-inherent.rs index 63cb6e82c25..c3ae920238f 100644 --- a/src/test/ui/privacy/associated-item-privacy-inherent.rs +++ b/src/test/ui/privacy/associated-item-privacy-inherent.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro, associated_type_defaults)] #![allow(unused, private_in_public)] diff --git a/src/test/ui/privacy/associated-item-privacy-inherent.stderr b/src/test/ui/privacy/associated-item-privacy-inherent.stderr index 391e5bbb4c0..6471a7914e1 100644 --- a/src/test/ui/privacy/associated-item-privacy-inherent.stderr +++ b/src/test/ui/privacy/associated-item-privacy-inherent.stderr @@ -1,5 +1,5 @@ error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private - --> $DIR/associated-item-privacy-inherent.rs:23:21 + --> $DIR/associated-item-privacy-inherent.rs:13:21 | LL | let value = Pub::method; | ^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | priv_nominal::mac!(); | --------------------- in this macro invocation error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private - --> $DIR/associated-item-privacy-inherent.rs:25:9 + --> $DIR/associated-item-privacy-inherent.rs:15:9 | LL | value; | ^^^^^ @@ -17,7 +17,7 @@ LL | priv_nominal::mac!(); | --------------------- in this macro invocation error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private - --> $DIR/associated-item-privacy-inherent.rs:27:13 + --> $DIR/associated-item-privacy-inherent.rs:17:13 | LL | Pub.method(); | ^^^^^^ @@ -26,7 +26,7 @@ LL | priv_nominal::mac!(); | --------------------- in this macro invocation error: associated constant `CONST` is private - --> $DIR/associated-item-privacy-inherent.rs:29:9 + --> $DIR/associated-item-privacy-inherent.rs:19:9 | LL | Pub::CONST; | ^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | priv_nominal::mac!(); | --------------------- in this macro invocation error: type `priv_signature::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:47:21 + --> $DIR/associated-item-privacy-inherent.rs:37:21 | LL | let value = Pub::method; | ^^^^^^^^^^^ @@ -44,7 +44,7 @@ LL | priv_signature::mac!(); | ----------------------- in this macro invocation error: type `priv_signature::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:49:9 + --> $DIR/associated-item-privacy-inherent.rs:39:9 | LL | value; | ^^^^^ @@ -53,7 +53,7 @@ LL | priv_signature::mac!(); | ----------------------- in this macro invocation error: type `priv_signature::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:51:13 + --> $DIR/associated-item-privacy-inherent.rs:41:13 | LL | Pub.method(loop {}); | ^^^^^^ @@ -62,7 +62,7 @@ LL | priv_signature::mac!(); | ----------------------- in this macro invocation error: type `priv_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:67:21 + --> $DIR/associated-item-privacy-inherent.rs:57:21 | LL | let value = Pub::method::; | ^^^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ LL | priv_substs::mac!(); | -------------------- in this macro invocation error: type `priv_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:69:9 + --> $DIR/associated-item-privacy-inherent.rs:59:9 | LL | value; | ^^^^^ @@ -80,7 +80,7 @@ LL | priv_substs::mac!(); | -------------------- in this macro invocation error: type `priv_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:71:9 + --> $DIR/associated-item-privacy-inherent.rs:61:9 | LL | Pub.method::(); | ^^^^^^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ LL | priv_substs::mac!(); | -------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:90:21 + --> $DIR/associated-item-privacy-inherent.rs:80:21 | LL | let value = ::method; | ^^^^^^^^^^^^^ @@ -98,7 +98,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:92:9 + --> $DIR/associated-item-privacy-inherent.rs:82:9 | LL | value; | ^^^^^ @@ -107,7 +107,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:94:21 + --> $DIR/associated-item-privacy-inherent.rs:84:21 | LL | let value = Pub::method; | ^^^^^^^^^^^ @@ -116,7 +116,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:96:9 + --> $DIR/associated-item-privacy-inherent.rs:86:9 | LL | value; | ^^^^^ @@ -125,7 +125,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:98:21 + --> $DIR/associated-item-privacy-inherent.rs:88:21 | LL | let value = ::static_method; | ^^^^^^^^^^^^^^^^^^^^ @@ -134,7 +134,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:100:9 + --> $DIR/associated-item-privacy-inherent.rs:90:9 | LL | value; | ^^^^^ @@ -143,7 +143,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:102:21 + --> $DIR/associated-item-privacy-inherent.rs:92:21 | LL | let value = Pub::static_method; | ^^^^^^^^^^^^^^^^^^ @@ -152,7 +152,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:104:9 + --> $DIR/associated-item-privacy-inherent.rs:94:9 | LL | value; | ^^^^^ @@ -161,7 +161,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:106:19 + --> $DIR/associated-item-privacy-inherent.rs:96:19 | LL | Pub(Priv).method(); | ^^^^^^ @@ -170,7 +170,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:109:10 + --> $DIR/associated-item-privacy-inherent.rs:99:10 | LL | ::CONST; | ^^^ @@ -179,7 +179,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-inherent.rs:111:9 + --> $DIR/associated-item-privacy-inherent.rs:101:9 | LL | Pub::CONST; | ^^^^^^^^^^ diff --git a/src/test/ui/privacy/associated-item-privacy-trait.rs b/src/test/ui/privacy/associated-item-privacy-trait.rs index bdc0c680a92..b3d42f09596 100644 --- a/src/test/ui/privacy/associated-item-privacy-trait.rs +++ b/src/test/ui/privacy/associated-item-privacy-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![feature(decl_macro, associated_type_defaults)] diff --git a/src/test/ui/privacy/associated-item-privacy-trait.stderr b/src/test/ui/privacy/associated-item-privacy-trait.stderr index 5aac27346f3..5cf1be82937 100644 --- a/src/test/ui/privacy/associated-item-privacy-trait.stderr +++ b/src/test/ui/privacy/associated-item-privacy-trait.stderr @@ -1,5 +1,5 @@ error: type `for<'r> fn(&'r priv_trait::Pub) {::method}` is private - --> $DIR/associated-item-privacy-trait.rs:27:21 + --> $DIR/associated-item-privacy-trait.rs:17:21 | LL | let value = ::method; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | priv_trait::mac!(); | ------------------- in this macro invocation error: type `for<'r> fn(&'r priv_trait::Pub) {::method}` is private - --> $DIR/associated-item-privacy-trait.rs:29:9 + --> $DIR/associated-item-privacy-trait.rs:19:9 | LL | value; | ^^^^^ @@ -17,7 +17,7 @@ LL | priv_trait::mac!(); | ------------------- in this macro invocation error: type `for<'r> fn(&'r Self) {::method}` is private - --> $DIR/associated-item-privacy-trait.rs:31:13 + --> $DIR/associated-item-privacy-trait.rs:21:13 | LL | Pub.method(); | ^^^^^^ @@ -26,7 +26,7 @@ LL | priv_trait::mac!(); | ------------------- in this macro invocation error: associated constant `PrivTr::CONST` is private - --> $DIR/associated-item-privacy-trait.rs:33:9 + --> $DIR/associated-item-privacy-trait.rs:23:9 | LL | ::CONST; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | priv_trait::mac!(); | ------------------- in this macro invocation error: trait `priv_trait::PrivTr` is private - --> $DIR/associated-item-privacy-trait.rs:35:13 + --> $DIR/associated-item-privacy-trait.rs:25:13 | LL | let _: ::AssocTy; | ^ @@ -44,7 +44,7 @@ LL | priv_trait::mac!(); | ------------------- in this macro invocation error: trait `priv_trait::PrivTr` is private - --> $DIR/associated-item-privacy-trait.rs:35:16 + --> $DIR/associated-item-privacy-trait.rs:25:16 | LL | let _: ::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -53,7 +53,7 @@ LL | priv_trait::mac!(); | ------------------- in this macro invocation error: trait `priv_trait::PrivTr` is private - --> $DIR/associated-item-privacy-trait.rs:38:34 + --> $DIR/associated-item-privacy-trait.rs:28:34 | LL | pub type InSignatureTy = ::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -62,7 +62,7 @@ LL | priv_trait::mac!(); | ------------------- in this macro invocation error: trait `priv_trait::PrivTr` is private - --> $DIR/associated-item-privacy-trait.rs:40:34 + --> $DIR/associated-item-privacy-trait.rs:30:34 | LL | pub trait InSignatureTr: PrivTr {} | ^^^^^^ @@ -71,7 +71,7 @@ LL | priv_trait::mac!(); | ------------------- in this macro invocation error: trait `priv_trait::PrivTr` is private - --> $DIR/associated-item-privacy-trait.rs:42:14 + --> $DIR/associated-item-privacy-trait.rs:32:14 | LL | impl PrivTr for u8 {} | ^^^^^^ @@ -80,7 +80,7 @@ LL | priv_trait::mac!(); | ------------------- in this macro invocation error: type `priv_signature::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:59:21 + --> $DIR/associated-item-privacy-trait.rs:49:21 | LL | let value = ::method; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ LL | priv_signature::mac!(); | ----------------------- in this macro invocation error: type `priv_signature::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:61:9 + --> $DIR/associated-item-privacy-trait.rs:51:9 | LL | value; | ^^^^^ @@ -98,7 +98,7 @@ LL | priv_signature::mac!(); | ----------------------- in this macro invocation error: type `priv_signature::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:63:13 + --> $DIR/associated-item-privacy-trait.rs:53:13 | LL | Pub.method(loop {}); | ^^^^^^ @@ -107,7 +107,7 @@ LL | priv_signature::mac!(); | ----------------------- in this macro invocation error: type `priv_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:80:21 + --> $DIR/associated-item-privacy-trait.rs:70:21 | LL | let value = ::method::; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -116,7 +116,7 @@ LL | priv_substs::mac!(); | -------------------- in this macro invocation error: type `priv_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:82:9 + --> $DIR/associated-item-privacy-trait.rs:72:9 | LL | value; | ^^^^^ @@ -125,7 +125,7 @@ LL | priv_substs::mac!(); | -------------------- in this macro invocation error: type `priv_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:84:9 + --> $DIR/associated-item-privacy-trait.rs:74:9 | LL | Pub.method::(); | ^^^^^^^^^^^^^^^^^^^^ @@ -134,7 +134,7 @@ LL | priv_substs::mac!(); | -------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:104:21 + --> $DIR/associated-item-privacy-trait.rs:94:21 | LL | let value = ::method; | ^^^^^^^^^^^^^^^^^^^^^^ @@ -143,7 +143,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:106:9 + --> $DIR/associated-item-privacy-trait.rs:96:9 | LL | value; | ^^^^^ @@ -152,7 +152,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:108:21 + --> $DIR/associated-item-privacy-trait.rs:98:21 | LL | let value = >::method; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -161,7 +161,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:110:9 + --> $DIR/associated-item-privacy-trait.rs:100:9 | LL | value; | ^^^^^ @@ -170,7 +170,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:112:9 + --> $DIR/associated-item-privacy-trait.rs:102:9 | LL | Pub.method(); | ^^^^^^^^^^^^ @@ -179,7 +179,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:115:21 + --> $DIR/associated-item-privacy-trait.rs:105:21 | LL | let value = >::method; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -188,7 +188,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:117:9 + --> $DIR/associated-item-privacy-trait.rs:107:9 | LL | value; | ^^^^^ @@ -197,7 +197,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:119:9 + --> $DIR/associated-item-privacy-trait.rs:109:9 | LL | Priv.method(); | ^^^^^^^^^^^^^ @@ -206,7 +206,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:122:9 + --> $DIR/associated-item-privacy-trait.rs:112:9 | LL | ::CONST; | ^^^^^^^^^^^^^^^^^^^^^ @@ -215,7 +215,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:124:9 + --> $DIR/associated-item-privacy-trait.rs:114:9 | LL | >::CONST; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -224,7 +224,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:126:9 + --> $DIR/associated-item-privacy-trait.rs:116:9 | LL | >::CONST; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -233,7 +233,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:129:13 + --> $DIR/associated-item-privacy-trait.rs:119:13 | LL | let _: ::AssocTy; | ^ @@ -242,7 +242,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:129:16 + --> $DIR/associated-item-privacy-trait.rs:119:16 | LL | let _: ::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -251,7 +251,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:132:13 + --> $DIR/associated-item-privacy-trait.rs:122:13 | LL | let _: >::AssocTy; | ^ @@ -260,7 +260,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:132:16 + --> $DIR/associated-item-privacy-trait.rs:122:16 | LL | let _: >::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -269,7 +269,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:135:13 + --> $DIR/associated-item-privacy-trait.rs:125:13 | LL | let _: >::AssocTy; | ^ @@ -278,7 +278,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:135:16 + --> $DIR/associated-item-privacy-trait.rs:125:16 | LL | let _: >::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -287,7 +287,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:139:35 + --> $DIR/associated-item-privacy-trait.rs:129:35 | LL | pub type InSignatureTy1 = ::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -296,7 +296,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:141:35 + --> $DIR/associated-item-privacy-trait.rs:131:35 | LL | pub type InSignatureTy2 = >::AssocTy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -305,7 +305,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-trait.rs:143:14 + --> $DIR/associated-item-privacy-trait.rs:133:14 | LL | impl PubTr for u8 {} | ^^^^^ diff --git a/src/test/ui/privacy/associated-item-privacy-type-binding.rs b/src/test/ui/privacy/associated-item-privacy-type-binding.rs index 6019369aa2e..591e9df81eb 100644 --- a/src/test/ui/privacy/associated-item-privacy-type-binding.rs +++ b/src/test/ui/privacy/associated-item-privacy-type-binding.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro, associated_type_defaults)] #![allow(unused, private_in_public)] @@ -19,19 +9,19 @@ mod priv_trait { pub macro mac1() { let _: Box>; - //~^ ERROR type `(dyn priv_trait::PubTr + ')` is private - //~| ERROR type `(dyn priv_trait::PubTr + ')` is private + //~^ ERROR trait `priv_trait::PrivTr` is private + //~| ERROR trait `priv_trait::PrivTr` is private type InSignatureTy2 = Box>; - //~^ ERROR type `(dyn priv_trait::PubTr + 'static)` is private + //~^ ERROR trait `priv_trait::PrivTr` is private trait InSignatureTr2: PubTr {} //~^ ERROR trait `priv_trait::PrivTr` is private } pub macro mac2() { let _: Box>; - //~^ ERROR type `(dyn priv_trait::PrivTr + ')` is private - //~| ERROR type `(dyn priv_trait::PrivTr + ')` is private + //~^ ERROR trait `priv_trait::PrivTr` is private + //~| ERROR trait `priv_trait::PrivTr` is private type InSignatureTy1 = Box>; - //~^ ERROR type `(dyn priv_trait::PrivTr + 'static)` is private + //~^ ERROR trait `priv_trait::PrivTr` is private trait InSignatureTr1: PrivTr {} //~^ ERROR trait `priv_trait::PrivTr` is private } diff --git a/src/test/ui/privacy/associated-item-privacy-type-binding.stderr b/src/test/ui/privacy/associated-item-privacy-type-binding.stderr index e762dc62853..7f6886d7f9a 100644 --- a/src/test/ui/privacy/associated-item-privacy-type-binding.stderr +++ b/src/test/ui/privacy/associated-item-privacy-type-binding.stderr @@ -1,5 +1,5 @@ -error: type `(dyn priv_trait::PubTr + ')` is private - --> $DIR/associated-item-privacy-type-binding.rs:21:13 +error: trait `priv_trait::PrivTr` is private + --> $DIR/associated-item-privacy-type-binding.rs:11:13 | LL | let _: Box>; | ^ @@ -7,8 +7,8 @@ LL | let _: Box>; LL | priv_trait::mac1!(); | -------------------- in this macro invocation -error: type `(dyn priv_trait::PubTr + ')` is private - --> $DIR/associated-item-privacy-type-binding.rs:21:16 +error: trait `priv_trait::PrivTr` is private + --> $DIR/associated-item-privacy-type-binding.rs:11:16 | LL | let _: Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -16,8 +16,8 @@ LL | let _: Box>; LL | priv_trait::mac1!(); | -------------------- in this macro invocation -error: type `(dyn priv_trait::PubTr + 'static)` is private - --> $DIR/associated-item-privacy-type-binding.rs:24:31 +error: trait `priv_trait::PrivTr` is private + --> $DIR/associated-item-privacy-type-binding.rs:14:31 | LL | type InSignatureTy2 = Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | priv_trait::mac1!(); | -------------------- in this macro invocation error: trait `priv_trait::PrivTr` is private - --> $DIR/associated-item-privacy-type-binding.rs:26:31 + --> $DIR/associated-item-privacy-type-binding.rs:16:31 | LL | trait InSignatureTr2: PubTr {} | ^^^^^^^^^^^^^^^^^^^ @@ -34,8 +34,8 @@ LL | trait InSignatureTr2: PubTr {} LL | priv_trait::mac1!(); | -------------------- in this macro invocation -error: type `(dyn priv_trait::PrivTr + ')` is private - --> $DIR/associated-item-privacy-type-binding.rs:30:13 +error: trait `priv_trait::PrivTr` is private + --> $DIR/associated-item-privacy-type-binding.rs:20:13 | LL | let _: Box>; | ^ @@ -43,8 +43,8 @@ LL | let _: Box>; LL | priv_trait::mac2!(); | -------------------- in this macro invocation -error: type `(dyn priv_trait::PrivTr + ')` is private - --> $DIR/associated-item-privacy-type-binding.rs:30:16 +error: trait `priv_trait::PrivTr` is private + --> $DIR/associated-item-privacy-type-binding.rs:20:16 | LL | let _: Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -52,8 +52,8 @@ LL | let _: Box>; LL | priv_trait::mac2!(); | -------------------- in this macro invocation -error: type `(dyn priv_trait::PrivTr + 'static)` is private - --> $DIR/associated-item-privacy-type-binding.rs:33:31 +error: trait `priv_trait::PrivTr` is private + --> $DIR/associated-item-privacy-type-binding.rs:23:31 | LL | type InSignatureTy1 = Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -62,7 +62,7 @@ LL | priv_trait::mac2!(); | -------------------- in this macro invocation error: trait `priv_trait::PrivTr` is private - --> $DIR/associated-item-privacy-type-binding.rs:35:31 + --> $DIR/associated-item-privacy-type-binding.rs:25:31 | LL | trait InSignatureTr1: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ LL | priv_trait::mac2!(); | -------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-type-binding.rs:54:13 + --> $DIR/associated-item-privacy-type-binding.rs:44:13 | LL | let _: Box>; | ^ @@ -80,7 +80,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-type-binding.rs:54:16 + --> $DIR/associated-item-privacy-type-binding.rs:44:16 | LL | let _: Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-type-binding.rs:57:13 + --> $DIR/associated-item-privacy-type-binding.rs:47:13 | LL | let _: Box>; | ^ @@ -98,7 +98,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-type-binding.rs:57:16 + --> $DIR/associated-item-privacy-type-binding.rs:47:16 | LL | let _: Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -107,7 +107,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-type-binding.rs:60:35 + --> $DIR/associated-item-privacy-type-binding.rs:50:35 | LL | pub type InSignatureTy1 = Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -116,7 +116,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-type-binding.rs:62:35 + --> $DIR/associated-item-privacy-type-binding.rs:52:35 | LL | pub type InSignatureTy2 = Box>; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -125,7 +125,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-type-binding.rs:64:31 + --> $DIR/associated-item-privacy-type-binding.rs:54:31 | LL | trait InSignatureTr1: PubTrWithParam {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -134,7 +134,7 @@ LL | priv_parent_substs::mac!(); | --------------------------- in this macro invocation error: type `priv_parent_substs::Priv` is private - --> $DIR/associated-item-privacy-type-binding.rs:66:31 + --> $DIR/associated-item-privacy-type-binding.rs:56:31 | LL | trait InSignatureTr2: PubTr {} | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/privacy/auxiliary/cci_class.rs b/src/test/ui/privacy/auxiliary/cci_class.rs index 08a13fd8bcc..de2945d7460 100644 --- a/src/test/ui/privacy/auxiliary/cci_class.rs +++ b/src/test/ui/privacy/auxiliary/cci_class.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod kitties { pub struct cat { meows : usize, diff --git a/src/test/ui/privacy/auxiliary/cci_class_5.rs b/src/test/ui/privacy/auxiliary/cci_class_5.rs index 7fe608f1634..3aeaa83d30a 100644 --- a/src/test/ui/privacy/auxiliary/cci_class_5.rs +++ b/src/test/ui/privacy/auxiliary/cci_class_5.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod kitties { pub struct cat { meows : usize, diff --git a/src/test/ui/privacy/auxiliary/issue-57264-1.rs b/src/test/ui/privacy/auxiliary/issue-57264-1.rs new file mode 100644 index 00000000000..9302fa0d9e8 --- /dev/null +++ b/src/test/ui/privacy/auxiliary/issue-57264-1.rs @@ -0,0 +1,9 @@ +mod inner { + pub struct PubUnnameable; +} + +pub struct Pub(T); + +impl Pub { + pub fn pub_method() {} +} diff --git a/src/test/ui/privacy/auxiliary/issue-57264-2.rs b/src/test/ui/privacy/auxiliary/issue-57264-2.rs new file mode 100644 index 00000000000..416206b4f8e --- /dev/null +++ b/src/test/ui/privacy/auxiliary/issue-57264-2.rs @@ -0,0 +1,10 @@ +mod inner { + pub struct PubUnnameable; + + impl PubUnnameable { + pub fn pub_method(self) {} + } +} + +pub trait PubTraitWithSingleImplementor {} +impl PubTraitWithSingleImplementor for Option {} diff --git a/src/test/ui/privacy/auxiliary/privacy_tuple_struct.rs b/src/test/ui/privacy/auxiliary/privacy_tuple_struct.rs index 141b6bdd604..223cda4b236 100644 --- a/src/test/ui/privacy/auxiliary/privacy_tuple_struct.rs +++ b/src/test/ui/privacy/auxiliary/privacy_tuple_struct.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct A(()); pub struct B(isize); pub struct C(pub isize, isize); diff --git a/src/test/ui/privacy/auxiliary/private-inferred-type.rs b/src/test/ui/privacy/auxiliary/private-inferred-type.rs index fc43765f63c..7ac913f5b5b 100644 --- a/src/test/ui/privacy/auxiliary/private-inferred-type.rs +++ b/src/test/ui/privacy/auxiliary/private-inferred-type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] fn priv_fn() {} diff --git a/src/test/ui/privacy/issue-57264-1.rs b/src/test/ui/privacy/issue-57264-1.rs new file mode 100644 index 00000000000..dcffdc3d4ef --- /dev/null +++ b/src/test/ui/privacy/issue-57264-1.rs @@ -0,0 +1,8 @@ +// compile-pass +// aux-build:issue-57264-1.rs + +extern crate issue_57264_1; + +fn main() { + issue_57264_1::Pub::pub_method(); +} diff --git a/src/test/ui/privacy/issue-57264-2.rs b/src/test/ui/privacy/issue-57264-2.rs new file mode 100644 index 00000000000..79d0d2c7cd7 --- /dev/null +++ b/src/test/ui/privacy/issue-57264-2.rs @@ -0,0 +1,10 @@ +// compile-pass +// aux-build:issue-57264-2.rs + +extern crate issue_57264_2; + +fn infer(arg: T) -> T { arg } + +fn main() { + infer(None).unwrap().pub_method(); +} diff --git a/src/test/ui/privacy/legacy-ctor-visibility.rs b/src/test/ui/privacy/legacy-ctor-visibility.rs index 95144916fd7..7db4be729e8 100644 --- a/src/test/ui/privacy/legacy-ctor-visibility.rs +++ b/src/test/ui/privacy/legacy-ctor-visibility.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![allow(unused)] diff --git a/src/test/ui/privacy/legacy-ctor-visibility.stderr b/src/test/ui/privacy/legacy-ctor-visibility.stderr index 7652d65a3a4..f0590951c08 100644 --- a/src/test/ui/privacy/legacy-ctor-visibility.stderr +++ b/src/test/ui/privacy/legacy-ctor-visibility.stderr @@ -1,5 +1,5 @@ error: private struct constructors are not usable through re-exports in outer modules - --> $DIR/legacy-ctor-visibility.rs:23:13 + --> $DIR/legacy-ctor-visibility.rs:13:13 | LL | S(10); | ^ diff --git a/src/test/ui/privacy/privacy-in-paths.rs b/src/test/ui/privacy/privacy-in-paths.rs index 0a8689ea6d6..9cee2b89dd5 100644 --- a/src/test/ui/privacy/privacy-in-paths.rs +++ b/src/test/ui/privacy/privacy-in-paths.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub use self::bar::S; mod bar { diff --git a/src/test/ui/privacy/privacy-in-paths.stderr b/src/test/ui/privacy/privacy-in-paths.stderr index 7b72c634ebf..563aaec89aa 100644 --- a/src/test/ui/privacy/privacy-in-paths.stderr +++ b/src/test/ui/privacy/privacy-in-paths.stderr @@ -1,17 +1,17 @@ error[E0603]: module `bar` is private - --> $DIR/privacy-in-paths.rs:34:16 + --> $DIR/privacy-in-paths.rs:24:16 | LL | ::foo::bar::baz::f(); //~ERROR module `bar` is private | ^^^ error[E0603]: module `bar` is private - --> $DIR/privacy-in-paths.rs:35:16 + --> $DIR/privacy-in-paths.rs:25:16 | LL | ::foo::bar::S::f(); //~ERROR module `bar` is private | ^^^ error[E0603]: trait `T` is private - --> $DIR/privacy-in-paths.rs:36:23 + --> $DIR/privacy-in-paths.rs:26:23 | LL | <() as ::foo::T>::Assoc::f(); //~ERROR trait `T` is private | ^ diff --git a/src/test/ui/privacy/privacy-ns1.rs b/src/test/ui/privacy/privacy-ns1.rs index e7e522f99d4..91cf8e81619 100644 --- a/src/test/ui/privacy/privacy-ns1.rs +++ b/src/test/ui/privacy/privacy-ns1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check we do the correct privacy checks when we import a name and there is an // item with that name in both the value and type namespaces. diff --git a/src/test/ui/privacy/privacy-ns1.stderr b/src/test/ui/privacy/privacy-ns1.stderr index 503cfbfaa2d..6ba2dbe41a2 100644 --- a/src/test/ui/privacy/privacy-ns1.stderr +++ b/src/test/ui/privacy/privacy-ns1.stderr @@ -1,8 +1,12 @@ error[E0423]: expected function, found trait `Bar` - --> $DIR/privacy-ns1.rs:30:5 + --> $DIR/privacy-ns1.rs:20:5 | LL | Bar(); //~ ERROR expected function, found trait `Bar` - | ^^^ did you mean `Baz`? + | ^^^ +help: a unit struct with a similar name exists + | +LL | Baz(); //~ ERROR expected function, found trait `Bar` + | ^^^ help: possible better candidates are found in other modules, you can import them into scope | LL | use foo1::Bar; @@ -13,10 +17,14 @@ LL | use foo3::Bar; | error[E0573]: expected type, found function `Bar` - --> $DIR/privacy-ns1.rs:45:17 + --> $DIR/privacy-ns1.rs:35:17 | LL | let _x: Box; //~ ERROR expected type, found function `Bar` - | ^^^ did you mean `Baz`? + | ^^^ +help: a struct with a similar name exists + | +LL | let _x: Box; //~ ERROR expected type, found function `Bar` + | ^^^ help: possible better candidates are found in other modules, you can import them into scope | LL | use foo1::Bar; @@ -27,10 +35,14 @@ LL | use foo3::Bar; | error[E0425]: cannot find function `Bar` in this scope - --> $DIR/privacy-ns1.rs:60:5 + --> $DIR/privacy-ns1.rs:50:5 | LL | Bar(); //~ ERROR cannot find function `Bar` in this scope - | ^^^ did you mean `Baz`? + | ^^^ +help: a unit struct with a similar name exists + | +LL | Baz(); //~ ERROR cannot find function `Bar` in this scope + | ^^^ help: possible candidates are found in other modules, you can import them into scope | LL | use foo1::Bar; @@ -41,10 +53,14 @@ LL | use foo3::Bar; | error[E0412]: cannot find type `Bar` in this scope - --> $DIR/privacy-ns1.rs:61:17 + --> $DIR/privacy-ns1.rs:51:17 | LL | let _x: Box; //~ ERROR cannot find type `Bar` in this scope - | ^^^ did you mean `Baz`? + | ^^^ +help: a struct with a similar name exists + | +LL | let _x: Box; //~ ERROR cannot find type `Bar` in this scope + | ^^^ help: possible candidates are found in other modules, you can import them into scope | LL | use foo1::Bar; diff --git a/src/test/ui/privacy/privacy-ns2.rs b/src/test/ui/privacy/privacy-ns2.rs index ec9396b5e7b..c4e400f5adb 100644 --- a/src/test/ui/privacy/privacy-ns2.rs +++ b/src/test/ui/privacy/privacy-ns2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check we do the correct privacy checks when we import a name and there is an // item with that name in both the value and type namespaces. diff --git a/src/test/ui/privacy/privacy-ns2.stderr b/src/test/ui/privacy/privacy-ns2.stderr index 9243bc2459f..0012072ed11 100644 --- a/src/test/ui/privacy/privacy-ns2.stderr +++ b/src/test/ui/privacy/privacy-ns2.stderr @@ -1,5 +1,5 @@ error[E0423]: expected function, found trait `Bar` - --> $DIR/privacy-ns2.rs:30:5 + --> $DIR/privacy-ns2.rs:20:5 | LL | Bar(); //~ ERROR expected function, found trait `Bar` | ^^^ not a function @@ -13,10 +13,14 @@ LL | use foo3::Bar; | error[E0423]: expected function, found trait `Bar` - --> $DIR/privacy-ns2.rs:36:5 + --> $DIR/privacy-ns2.rs:26:5 | LL | Bar(); //~ ERROR expected function, found trait `Bar` - | ^^^ did you mean `Baz`? + | ^^^ +help: a unit struct with a similar name exists + | +LL | Baz(); //~ ERROR expected function, found trait `Bar` + | ^^^ help: possible better candidates are found in other modules, you can import them into scope | LL | use foo1::Bar; @@ -27,7 +31,7 @@ LL | use foo3::Bar; | error[E0573]: expected type, found function `Bar` - --> $DIR/privacy-ns2.rs:51:18 + --> $DIR/privacy-ns2.rs:41:18 | LL | let _x : Box; //~ ERROR expected type, found function `Bar` | ^^^ not a type @@ -41,10 +45,14 @@ LL | use foo3::Bar; | error[E0573]: expected type, found function `Bar` - --> $DIR/privacy-ns2.rs:57:17 + --> $DIR/privacy-ns2.rs:47:17 | LL | let _x: Box; //~ ERROR expected type, found function `Bar` - | ^^^ did you mean `Baz`? + | ^^^ +help: a struct with a similar name exists + | +LL | let _x: Box; //~ ERROR expected type, found function `Bar` + | ^^^ help: possible better candidates are found in other modules, you can import them into scope | LL | use foo1::Bar; @@ -55,19 +63,19 @@ LL | use foo3::Bar; | error[E0603]: trait `Bar` is private - --> $DIR/privacy-ns2.rs:70:15 + --> $DIR/privacy-ns2.rs:60:15 | LL | use foo3::Bar; //~ ERROR `Bar` is private | ^^^ error[E0603]: trait `Bar` is private - --> $DIR/privacy-ns2.rs:74:15 + --> $DIR/privacy-ns2.rs:64:15 | LL | use foo3::Bar; //~ ERROR `Bar` is private | ^^^ error[E0603]: trait `Bar` is private - --> $DIR/privacy-ns2.rs:81:16 + --> $DIR/privacy-ns2.rs:71:16 | LL | use foo3::{Bar,Baz}; //~ ERROR `Bar` is private | ^^^ diff --git a/src/test/ui/privacy/privacy-sanity.rs b/src/test/ui/privacy/privacy-sanity.rs index f245b7cef29..f83b24c49a1 100644 --- a/src/test/ui/privacy/privacy-sanity.rs +++ b/src/test/ui/privacy/privacy-sanity.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] pub trait Tr { diff --git a/src/test/ui/privacy/privacy-sanity.stderr b/src/test/ui/privacy/privacy-sanity.stderr index fbfa15f8cb0..b1e3127645e 100644 --- a/src/test/ui/privacy/privacy-sanity.stderr +++ b/src/test/ui/privacy/privacy-sanity.stderr @@ -1,29 +1,29 @@ error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:23:1 + --> $DIR/privacy-sanity.rs:13:1 | LL | pub impl Tr for S { //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:24:5 + --> $DIR/privacy-sanity.rs:14:5 | LL | pub fn f() {} //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:25:5 + --> $DIR/privacy-sanity.rs:15:5 | LL | pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:26:5 + --> $DIR/privacy-sanity.rs:16:5 | LL | pub type T = u8; //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:28:1 + --> $DIR/privacy-sanity.rs:18:1 | LL | pub impl S { //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied @@ -31,7 +31,7 @@ LL | pub impl S { //~ ERROR unnecessary visibility qualifier = note: place qualifiers on individual impl items instead error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:33:1 + --> $DIR/privacy-sanity.rs:23:1 | LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied @@ -39,31 +39,31 @@ LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier = note: place qualifiers on individual foreign items instead error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:49:5 + --> $DIR/privacy-sanity.rs:39:5 | LL | pub impl Tr for S { //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:50:9 + --> $DIR/privacy-sanity.rs:40:9 | LL | pub fn f() {} //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:51:9 + --> $DIR/privacy-sanity.rs:41:9 | LL | pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:52:9 + --> $DIR/privacy-sanity.rs:42:9 | LL | pub type T = u8; //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:54:5 + --> $DIR/privacy-sanity.rs:44:5 | LL | pub impl S { //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied @@ -71,7 +71,7 @@ LL | pub impl S { //~ ERROR unnecessary visibility qualifier = note: place qualifiers on individual impl items instead error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:59:5 + --> $DIR/privacy-sanity.rs:49:5 | LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied @@ -79,31 +79,31 @@ LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier = note: place qualifiers on individual foreign items instead error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:78:5 + --> $DIR/privacy-sanity.rs:68:5 | LL | pub impl Tr for S { //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:79:9 + --> $DIR/privacy-sanity.rs:69:9 | LL | pub fn f() {} //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:80:9 + --> $DIR/privacy-sanity.rs:70:9 | LL | pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:81:9 + --> $DIR/privacy-sanity.rs:71:9 | LL | pub type T = u8; //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:83:5 + --> $DIR/privacy-sanity.rs:73:5 | LL | pub impl S { //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied @@ -111,7 +111,7 @@ LL | pub impl S { //~ ERROR unnecessary visibility qualifier = note: place qualifiers on individual impl items instead error[E0449]: unnecessary visibility qualifier - --> $DIR/privacy-sanity.rs:88:5 + --> $DIR/privacy-sanity.rs:78:5 | LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied diff --git a/src/test/ui/privacy/privacy-ufcs.rs b/src/test/ui/privacy/privacy-ufcs.rs index 28c1a003e39..fec7f41340a 100644 --- a/src/test/ui/privacy/privacy-ufcs.rs +++ b/src/test/ui/privacy/privacy-ufcs.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test to ensure private traits are inaccessible with UFCS angle-bracket syntax. mod foo { diff --git a/src/test/ui/privacy/privacy-ufcs.stderr b/src/test/ui/privacy/privacy-ufcs.stderr index 5989c79bc85..c70afe5061d 100644 --- a/src/test/ui/privacy/privacy-ufcs.stderr +++ b/src/test/ui/privacy/privacy-ufcs.stderr @@ -1,5 +1,5 @@ error[E0603]: trait `Bar` is private - --> $DIR/privacy-ufcs.rs:22:20 + --> $DIR/privacy-ufcs.rs:12:20 | LL | ::baz(); //~ERROR trait `Bar` is private | ^^^ diff --git a/src/test/ui/privacy/privacy1.rs b/src/test/ui/privacy/privacy1.rs index 9aff4bbc41c..d376237c355 100644 --- a/src/test/ui/privacy/privacy1.rs +++ b/src/test/ui/privacy/privacy1.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(lang_items, start, no_core)] #![no_core] // makes debugging this test *a lot* easier (during resolve) @@ -17,6 +7,20 @@ pub trait Sized {} #[lang="copy"] pub trait Copy {} +#[lang="deref"] +pub trait Deref { + type Target; +} + +#[lang="receiver"] +pub trait Receiver: Deref {} + +impl<'a, T> Deref for &'a T { + type Target = T; +} + +impl<'a, T> Receiver for &'a T {} + mod bar { // shouldn't bring in too much pub use self::glob::*; diff --git a/src/test/ui/privacy/privacy1.stderr b/src/test/ui/privacy/privacy1.stderr index d6197575447..7feebabe781 100644 --- a/src/test/ui/privacy/privacy1.stderr +++ b/src/test/ui/privacy/privacy1.stderr @@ -1,101 +1,101 @@ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:128:18 + --> $DIR/privacy1.rs:132:18 | LL | use bar::baz::{foo, bar}; | ^^^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:136:18 + --> $DIR/privacy1.rs:140:18 | LL | use bar::baz; | ^^^ error[E0603]: module `i` is private - --> $DIR/privacy1.rs:160:20 + --> $DIR/privacy1.rs:164:20 | LL | use self::foo::i::A; //~ ERROR: module `i` is private | ^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:100:16 + --> $DIR/privacy1.rs:104:16 | LL | ::bar::baz::A::foo(); //~ ERROR: module `baz` is private | ^^^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:101:16 + --> $DIR/privacy1.rs:105:16 | LL | ::bar::baz::A::bar(); //~ ERROR: module `baz` is private | ^^^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:103:16 + --> $DIR/privacy1.rs:107:16 | LL | ::bar::baz::A.foo2(); //~ ERROR: module `baz` is private | ^^^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:104:16 + --> $DIR/privacy1.rs:108:16 | LL | ::bar::baz::A.bar2(); //~ ERROR: module `baz` is private | ^^^ error[E0603]: trait `B` is private - --> $DIR/privacy1.rs:108:16 + --> $DIR/privacy1.rs:112:16 | LL | ::bar::B::foo(); //~ ERROR: trait `B` is private | ^ error[E0603]: function `epriv` is private - --> $DIR/privacy1.rs:114:20 + --> $DIR/privacy1.rs:118:20 | LL | ::bar::epriv(); //~ ERROR: function `epriv` is private | ^^^^^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:123:16 + --> $DIR/privacy1.rs:127:16 | LL | ::bar::baz::foo(); //~ ERROR: module `baz` is private | ^^^ error[E0603]: module `baz` is private - --> $DIR/privacy1.rs:124:16 + --> $DIR/privacy1.rs:128:16 | LL | ::bar::baz::bar(); //~ ERROR: module `baz` is private | ^^^ error[E0603]: trait `B` is private - --> $DIR/privacy1.rs:152:17 + --> $DIR/privacy1.rs:156:17 | LL | impl ::bar::B for f32 { fn foo() -> f32 { 1.0 } } | ^ error[E0624]: method `bar` is private - --> $DIR/privacy1.rs:73:9 + --> $DIR/privacy1.rs:77:9 | LL | self::baz::A::bar(); //~ ERROR: method `bar` is private | ^^^^^^^^^^^^^^^^^ error[E0624]: method `bar` is private - --> $DIR/privacy1.rs:91:5 + --> $DIR/privacy1.rs:95:5 | LL | bar::A::bar(); //~ ERROR: method `bar` is private | ^^^^^^^^^^^ error[E0624]: method `bar` is private - --> $DIR/privacy1.rs:98:9 + --> $DIR/privacy1.rs:102:9 | LL | ::bar::A::bar(); //~ ERROR: method `bar` is private | ^^^^^^^^^^^^^ error[E0624]: method `bar` is private - --> $DIR/privacy1.rs:101:9 + --> $DIR/privacy1.rs:105:9 | LL | ::bar::baz::A::bar(); //~ ERROR: module `baz` is private | ^^^^^^^^^^^^^^^^^^ error[E0624]: method `bar2` is private - --> $DIR/privacy1.rs:104:23 + --> $DIR/privacy1.rs:108:23 | LL | ::bar::baz::A.bar2(); //~ ERROR: module `baz` is private | ^^^^ diff --git a/src/test/ui/privacy/privacy2.rs b/src/test/ui/privacy/privacy2.rs index 113dd287940..c8fa436bd14 100644 --- a/src/test/ui/privacy/privacy2.rs +++ b/src/test/ui/privacy/privacy2.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(start, no_core)] #![no_core] // makes debugging this test *a lot* easier (during resolve) diff --git a/src/test/ui/privacy/privacy2.stderr b/src/test/ui/privacy/privacy2.stderr index fa4da7f5181..2e6bb99f436 100644 --- a/src/test/ui/privacy/privacy2.stderr +++ b/src/test/ui/privacy/privacy2.stderr @@ -1,11 +1,11 @@ error[E0432]: unresolved import `bar::foo` - --> $DIR/privacy2.rs:27:9 + --> $DIR/privacy2.rs:17:9 | LL | use bar::foo; | ^^^^^^^^ no `foo` in `bar` error[E0603]: function `foo` is private - --> $DIR/privacy2.rs:33:20 + --> $DIR/privacy2.rs:23:20 | LL | use bar::glob::foo; | ^^^ diff --git a/src/test/ui/privacy/privacy3.rs b/src/test/ui/privacy/privacy3.rs index b841717bd11..5a7cd76a98f 100644 --- a/src/test/ui/privacy/privacy3.rs +++ b/src/test/ui/privacy/privacy3.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(start, no_core)] #![no_core] // makes debugging this test *a lot* easier (during resolve) diff --git a/src/test/ui/privacy/privacy3.stderr b/src/test/ui/privacy/privacy3.stderr index 11c71616d90..22c1e48b07d 100644 --- a/src/test/ui/privacy/privacy3.stderr +++ b/src/test/ui/privacy/privacy3.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `bar::gpriv` - --> $DIR/privacy3.rs:28:9 + --> $DIR/privacy3.rs:18:9 | LL | use bar::gpriv; | ^^^^^^^^^^ no `gpriv` in `bar` diff --git a/src/test/ui/privacy/privacy4.rs b/src/test/ui/privacy/privacy4.rs index d9f76744284..fa257b80039 100644 --- a/src/test/ui/privacy/privacy4.rs +++ b/src/test/ui/privacy/privacy4.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(lang_items, start, no_core)] #![no_core] // makes debugging this test *a lot* easier (during resolve) diff --git a/src/test/ui/privacy/privacy4.stderr b/src/test/ui/privacy/privacy4.stderr index 8a4b7401de0..9e3e48272f9 100644 --- a/src/test/ui/privacy/privacy4.stderr +++ b/src/test/ui/privacy/privacy4.stderr @@ -1,5 +1,5 @@ error[E0603]: module `glob` is private - --> $DIR/privacy4.rs:31:14 + --> $DIR/privacy4.rs:21:14 | LL | use bar::glob::gpriv; //~ ERROR: module `glob` is private | ^^^^ diff --git a/src/test/ui/privacy/privacy5.rs b/src/test/ui/privacy/privacy5.rs index 599c1f87160..741ba0be2c2 100644 --- a/src/test/ui/privacy/privacy5.rs +++ b/src/test/ui/privacy/privacy5.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:privacy_tuple_struct.rs extern crate privacy_tuple_struct as other; diff --git a/src/test/ui/privacy/privacy5.stderr b/src/test/ui/privacy/privacy5.stderr index 23682575cf1..cdd9b2cefbb 100644 --- a/src/test/ui/privacy/privacy5.stderr +++ b/src/test/ui/privacy/privacy5.stderr @@ -1,287 +1,287 @@ error[E0603]: tuple struct `A` is private - --> $DIR/privacy5.rs:61:16 + --> $DIR/privacy5.rs:51:16 | LL | let a = a::A(()); //~ ERROR tuple struct `A` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:62:16 + --> $DIR/privacy5.rs:52:16 | LL | let b = a::B(2); //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:63:16 + --> $DIR/privacy5.rs:53:16 | LL | let c = a::C(2, 3); //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `A` is private - --> $DIR/privacy5.rs:66:12 + --> $DIR/privacy5.rs:56:12 | LL | let a::A(()) = a; //~ ERROR tuple struct `A` is private | ^ error[E0603]: tuple struct `A` is private - --> $DIR/privacy5.rs:67:12 + --> $DIR/privacy5.rs:57:12 | LL | let a::A(_) = a; //~ ERROR tuple struct `A` is private | ^ error[E0603]: tuple struct `A` is private - --> $DIR/privacy5.rs:68:18 + --> $DIR/privacy5.rs:58:18 | LL | match a { a::A(()) => {} } //~ ERROR tuple struct `A` is private | ^ error[E0603]: tuple struct `A` is private - --> $DIR/privacy5.rs:69:18 + --> $DIR/privacy5.rs:59:18 | LL | match a { a::A(_) => {} } //~ ERROR tuple struct `A` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:71:12 + --> $DIR/privacy5.rs:61:12 | LL | let a::B(_) = b; //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:72:12 + --> $DIR/privacy5.rs:62:12 | LL | let a::B(_b) = b; //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:73:18 + --> $DIR/privacy5.rs:63:18 | LL | match b { a::B(_) => {} } //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:74:18 + --> $DIR/privacy5.rs:64:18 | LL | match b { a::B(_b) => {} } //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:75:18 + --> $DIR/privacy5.rs:65:18 | LL | match b { a::B(1) => {} a::B(_) => {} } //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:75:32 + --> $DIR/privacy5.rs:65:32 | LL | match b { a::B(1) => {} a::B(_) => {} } //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:78:12 + --> $DIR/privacy5.rs:68:12 | LL | let a::C(_, _) = c; //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:79:12 + --> $DIR/privacy5.rs:69:12 | LL | let a::C(_a, _) = c; //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:80:12 + --> $DIR/privacy5.rs:70:12 | LL | let a::C(_, _b) = c; //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:81:12 + --> $DIR/privacy5.rs:71:12 | LL | let a::C(_a, _b) = c; //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:82:18 + --> $DIR/privacy5.rs:72:18 | LL | match c { a::C(_, _) => {} } //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:83:18 + --> $DIR/privacy5.rs:73:18 | LL | match c { a::C(_a, _) => {} } //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:84:18 + --> $DIR/privacy5.rs:74:18 | LL | match c { a::C(_, _b) => {} } //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:85:18 + --> $DIR/privacy5.rs:75:18 | LL | match c { a::C(_a, _b) => {} } //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `A` is private - --> $DIR/privacy5.rs:93:17 + --> $DIR/privacy5.rs:83:17 | LL | let a2 = a::A; //~ ERROR tuple struct `A` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:94:17 + --> $DIR/privacy5.rs:84:17 | LL | let b2 = a::B; //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:95:17 + --> $DIR/privacy5.rs:85:17 | LL | let c2 = a::C; //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `A` is private - --> $DIR/privacy5.rs:100:20 + --> $DIR/privacy5.rs:90:20 | LL | let a = other::A(()); //~ ERROR tuple struct `A` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:101:20 + --> $DIR/privacy5.rs:91:20 | LL | let b = other::B(2); //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:102:20 + --> $DIR/privacy5.rs:92:20 | LL | let c = other::C(2, 3); //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `A` is private - --> $DIR/privacy5.rs:105:16 + --> $DIR/privacy5.rs:95:16 | LL | let other::A(()) = a; //~ ERROR tuple struct `A` is private | ^ error[E0603]: tuple struct `A` is private - --> $DIR/privacy5.rs:106:16 + --> $DIR/privacy5.rs:96:16 | LL | let other::A(_) = a; //~ ERROR tuple struct `A` is private | ^ error[E0603]: tuple struct `A` is private - --> $DIR/privacy5.rs:107:22 + --> $DIR/privacy5.rs:97:22 | LL | match a { other::A(()) => {} } //~ ERROR tuple struct `A` is private | ^ error[E0603]: tuple struct `A` is private - --> $DIR/privacy5.rs:108:22 + --> $DIR/privacy5.rs:98:22 | LL | match a { other::A(_) => {} } //~ ERROR tuple struct `A` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:110:16 + --> $DIR/privacy5.rs:100:16 | LL | let other::B(_) = b; //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:111:16 + --> $DIR/privacy5.rs:101:16 | LL | let other::B(_b) = b; //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:112:22 + --> $DIR/privacy5.rs:102:22 | LL | match b { other::B(_) => {} } //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:113:22 + --> $DIR/privacy5.rs:103:22 | LL | match b { other::B(_b) => {} } //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:114:22 + --> $DIR/privacy5.rs:104:22 | LL | match b { other::B(1) => {} other::B(_) => {} } //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:114:40 + --> $DIR/privacy5.rs:104:40 | LL | match b { other::B(1) => {} other::B(_) => {} } //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:117:16 + --> $DIR/privacy5.rs:107:16 | LL | let other::C(_, _) = c; //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:118:16 + --> $DIR/privacy5.rs:108:16 | LL | let other::C(_a, _) = c; //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:119:16 + --> $DIR/privacy5.rs:109:16 | LL | let other::C(_, _b) = c; //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:120:16 + --> $DIR/privacy5.rs:110:16 | LL | let other::C(_a, _b) = c; //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:121:22 + --> $DIR/privacy5.rs:111:22 | LL | match c { other::C(_, _) => {} } //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:122:22 + --> $DIR/privacy5.rs:112:22 | LL | match c { other::C(_a, _) => {} } //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:123:22 + --> $DIR/privacy5.rs:113:22 | LL | match c { other::C(_, _b) => {} } //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:124:22 + --> $DIR/privacy5.rs:114:22 | LL | match c { other::C(_a, _b) => {} } //~ ERROR tuple struct `C` is private | ^ error[E0603]: tuple struct `A` is private - --> $DIR/privacy5.rs:132:21 + --> $DIR/privacy5.rs:122:21 | LL | let a2 = other::A; //~ ERROR tuple struct `A` is private | ^ error[E0603]: tuple struct `B` is private - --> $DIR/privacy5.rs:133:21 + --> $DIR/privacy5.rs:123:21 | LL | let b2 = other::B; //~ ERROR tuple struct `B` is private | ^ error[E0603]: tuple struct `C` is private - --> $DIR/privacy5.rs:134:21 + --> $DIR/privacy5.rs:124:21 | LL | let c2 = other::C; //~ ERROR tuple struct `C` is private | ^ diff --git a/src/test/ui/privacy/private-impl-method.rs b/src/test/ui/privacy/private-impl-method.rs index e04380f12ac..b5587920f1c 100644 --- a/src/test/ui/privacy/private-impl-method.rs +++ b/src/test/ui/privacy/private-impl-method.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { pub struct Foo { pub x: isize diff --git a/src/test/ui/privacy/private-impl-method.stderr b/src/test/ui/privacy/private-impl-method.stderr index 0e36c7003ee..8e254b15c78 100644 --- a/src/test/ui/privacy/private-impl-method.stderr +++ b/src/test/ui/privacy/private-impl-method.stderr @@ -1,5 +1,5 @@ error[E0624]: method `foo` is private - --> $DIR/private-impl-method.rs:30:7 + --> $DIR/private-impl-method.rs:20:7 | LL | s.foo(); //~ ERROR method `foo` is private | ^^^ diff --git a/src/test/ui/privacy/private-in-public-assoc-ty.rs b/src/test/ui/privacy/private-in-public-assoc-ty.rs index 59dee256642..81d23959fd4 100644 --- a/src/test/ui/privacy/private-in-public-assoc-ty.rs +++ b/src/test/ui/privacy/private-in-public-assoc-ty.rs @@ -1,17 +1,7 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Private types and traits are not allowed in interfaces of associated types. // This test also ensures that the checks are performed even inside private modules. -#![feature(associated_type_defaults)] +#![feature(associated_type_defaults, existential_type)] mod m { struct Priv; @@ -33,10 +23,17 @@ mod m { type Alias4 = Priv; //~^ ERROR private type `m::Priv` in public interface + + type Exist; + fn infer_exist() -> Self::Exist; } impl PubTr for u8 { type Alias1 = Priv; //~^ ERROR private type `m::Priv` in public interface + + existential type Exist: PrivTr; + //~^ ERROR private trait `m::PrivTr` in public interface + fn infer_exist() -> Self::Exist { Priv } } } diff --git a/src/test/ui/privacy/private-in-public-assoc-ty.stderr b/src/test/ui/privacy/private-in-public-assoc-ty.stderr index a95547bc507..0e5dab1a08c 100644 --- a/src/test/ui/privacy/private-in-public-assoc-ty.stderr +++ b/src/test/ui/privacy/private-in-public-assoc-ty.stderr @@ -1,12 +1,12 @@ warning: private trait `m::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-assoc-ty.rs:25:5 + --> $DIR/private-in-public-assoc-ty.rs:15:5 | LL | / pub trait PubTr { LL | | //~^ WARN private trait `m::PrivTr` in public interface LL | | //~| WARN this was previously accepted LL | | //~| WARN private type `m::Priv` in public interface ... | -LL | | //~^ ERROR private type `m::Priv` in public interface +LL | | fn infer_exist() -> Self::Exist; LL | | } | |_____^ | @@ -15,14 +15,14 @@ LL | | } = note: for more information, see issue #34537 warning: private type `m::Priv` in public interface (error E0446) - --> $DIR/private-in-public-assoc-ty.rs:25:5 + --> $DIR/private-in-public-assoc-ty.rs:15:5 | LL | / pub trait PubTr { LL | | //~^ WARN private trait `m::PrivTr` in public interface LL | | //~| WARN this was previously accepted LL | | //~| WARN private type `m::Priv` in public interface ... | -LL | | //~^ ERROR private type `m::Priv` in public interface +LL | | fn infer_exist() -> Self::Exist; LL | | } | |_____^ | @@ -30,7 +30,7 @@ LL | | } = note: for more information, see issue #34537 error[E0446]: private type `m::Priv` in public interface - --> $DIR/private-in-public-assoc-ty.rs:34:9 + --> $DIR/private-in-public-assoc-ty.rs:24:9 | LL | struct Priv; | - `m::Priv` declared as private @@ -39,7 +39,7 @@ LL | type Alias4 = Priv; | ^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `m::Priv` in public interface - --> $DIR/private-in-public-assoc-ty.rs:38:9 + --> $DIR/private-in-public-assoc-ty.rs:31:9 | LL | struct Priv; | - `m::Priv` declared as private @@ -47,6 +47,16 @@ LL | struct Priv; LL | type Alias1 = Priv; | ^^^^^^^^^^^^^^^^^^^ can't leak private type -error: aborting due to 2 previous errors +error[E0445]: private trait `m::PrivTr` in public interface + --> $DIR/private-in-public-assoc-ty.rs:34:9 + | +LL | trait PrivTr {} + | - `m::PrivTr` declared as private +... +LL | existential type Exist: PrivTr; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0446`. +Some errors occurred: E0445, E0446. +For more information about an error, try `rustc --explain E0445`. diff --git a/src/test/ui/privacy/private-in-public-existential.rs b/src/test/ui/privacy/private-in-public-existential.rs new file mode 100644 index 00000000000..61c6130e470 --- /dev/null +++ b/src/test/ui/privacy/private-in-public-existential.rs @@ -0,0 +1,25 @@ +// compile-pass + +#![feature(existential_type)] +#![deny(private_in_public)] + +pub existential type Pub: Default; + +#[derive(Default)] +struct Priv; + +fn check() -> Pub { + Priv +} + +pub trait Trait { + type Pub: Default; + fn method() -> Self::Pub; +} + +impl Trait for u8 { + existential type Pub: Default; + fn method() -> Self::Pub { Priv } +} + +fn main() {} diff --git a/src/test/ui/privacy/private-in-public-expr-pat.rs b/src/test/ui/privacy/private-in-public-expr-pat.rs new file mode 100644 index 00000000000..a3e53bdf45d --- /dev/null +++ b/src/test/ui/privacy/private-in-public-expr-pat.rs @@ -0,0 +1,13 @@ +// Patterns and expressions are not interface parts and don't produce private-in-public errors. + +// compile-pass + +struct Priv1(usize); +struct Priv2; + +pub struct Pub(Priv2); + +pub fn public_expr(_: [u8; Priv1(0).0]) {} // OK +pub fn public_pat(Pub(Priv2): Pub) {} // OK + +fn main() {} diff --git a/src/test/ui/privacy/private-in-public-ill-formed.rs b/src/test/ui/privacy/private-in-public-ill-formed.rs index 480406054ad..0ef5d89002e 100644 --- a/src/test/ui/privacy/private-in-public-ill-formed.rs +++ b/src/test/ui/privacy/private-in-public-ill-formed.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod aliases_pub { struct Priv; mod m { diff --git a/src/test/ui/privacy/private-in-public-ill-formed.stderr b/src/test/ui/privacy/private-in-public-ill-formed.stderr index 649f5fc2fca..ab6531cc748 100644 --- a/src/test/ui/privacy/private-in-public-ill-formed.stderr +++ b/src/test/ui/privacy/private-in-public-ill-formed.stderr @@ -1,5 +1,5 @@ error[E0118]: no base type found for inherent implementation - --> $DIR/private-in-public-ill-formed.rs:24:10 + --> $DIR/private-in-public-ill-formed.rs:14:10 | LL | impl ::AssocAlias { //~ ERROR no base type found for inherent implementation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a base type @@ -7,7 +7,7 @@ LL | impl ::AssocAlias { //~ ERROR no base type found for in = note: either implement a trait on it or create a newtype to wrap it instead error[E0118]: no base type found for inherent implementation - --> $DIR/private-in-public-ill-formed.rs:40:10 + --> $DIR/private-in-public-ill-formed.rs:30:10 | LL | impl ::AssocAlias { //~ ERROR no base type found for inherent implementation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a base type diff --git a/src/test/ui/privacy/private-in-public-lint.rs b/src/test/ui/privacy/private-in-public-lint.rs index fd92300cd15..8b6e4360160 100644 --- a/src/test/ui/privacy/private-in-public-lint.rs +++ b/src/test/ui/privacy/private-in-public-lint.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod m1 { pub struct Pub; struct Priv; diff --git a/src/test/ui/privacy/private-in-public-lint.stderr b/src/test/ui/privacy/private-in-public-lint.stderr index 202cb342d8c..730ac24d5e5 100644 --- a/src/test/ui/privacy/private-in-public-lint.stderr +++ b/src/test/ui/privacy/private-in-public-lint.stderr @@ -1,5 +1,5 @@ error[E0446]: private type `m1::Priv` in public interface - --> $DIR/private-in-public-lint.rs:16:9 + --> $DIR/private-in-public-lint.rs:6:9 | LL | struct Priv; | - `m1::Priv` declared as private @@ -8,7 +8,7 @@ LL | pub fn f() -> Priv {Priv} //~ ERROR private type `m1::Priv` in publ | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `m2::Priv` in public interface - --> $DIR/private-in-public-lint.rs:25:9 + --> $DIR/private-in-public-lint.rs:15:9 | LL | struct Priv; | - `m2::Priv` declared as private diff --git a/src/test/ui/privacy/private-in-public-non-principal-2.rs b/src/test/ui/privacy/private-in-public-non-principal-2.rs new file mode 100644 index 00000000000..02fd92aa7a4 --- /dev/null +++ b/src/test/ui/privacy/private-in-public-non-principal-2.rs @@ -0,0 +1,13 @@ +#![feature(optin_builtin_traits)] + +#[allow(private_in_public)] +mod m { + pub trait PubPrincipal {} + auto trait PrivNonPrincipal {} + pub fn leak_dyn_nonprincipal() -> Box { loop {} } +} + +fn main() { + m::leak_dyn_nonprincipal(); + //~^ ERROR trait `m::PrivNonPrincipal` is private +} diff --git a/src/test/ui/privacy/private-in-public-non-principal-2.stderr b/src/test/ui/privacy/private-in-public-non-principal-2.stderr new file mode 100644 index 00000000000..2db49257226 --- /dev/null +++ b/src/test/ui/privacy/private-in-public-non-principal-2.stderr @@ -0,0 +1,8 @@ +error: trait `m::PrivNonPrincipal` is private + --> $DIR/private-in-public-non-principal-2.rs:11:5 + | +LL | m::leak_dyn_nonprincipal(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/privacy/private-in-public-non-principal.rs b/src/test/ui/privacy/private-in-public-non-principal.rs new file mode 100644 index 00000000000..5de5a685208 --- /dev/null +++ b/src/test/ui/privacy/private-in-public-non-principal.rs @@ -0,0 +1,20 @@ +#![feature(optin_builtin_traits)] + +pub trait PubPrincipal {} +auto trait PrivNonPrincipal {} + +pub fn leak_dyn_nonprincipal() -> Box { loop {} } +//~^ WARN private trait `PrivNonPrincipal` in public interface +//~| WARN this was previously accepted + +#[deny(missing_docs)] +fn container() { + impl dyn PubPrincipal { + pub fn check_doc_lint() {} //~ ERROR missing documentation for a method + } + impl dyn PubPrincipal + PrivNonPrincipal { + pub fn check_doc_lint() {} // OK, no missing doc lint + } +} + +fn main() {} diff --git a/src/test/ui/privacy/private-in-public-non-principal.stderr b/src/test/ui/privacy/private-in-public-non-principal.stderr new file mode 100644 index 00000000000..99674055897 --- /dev/null +++ b/src/test/ui/privacy/private-in-public-non-principal.stderr @@ -0,0 +1,24 @@ +warning: private trait `PrivNonPrincipal` in public interface (error E0445) + --> $DIR/private-in-public-non-principal.rs:6:1 + | +LL | pub fn leak_dyn_nonprincipal() -> Box { loop {} } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: #[warn(private_in_public)] on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #34537 + +error: missing documentation for a method + --> $DIR/private-in-public-non-principal.rs:13:9 + | +LL | pub fn check_doc_lint() {} //~ ERROR missing documentation for a method + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/private-in-public-non-principal.rs:10:8 + | +LL | #[deny(missing_docs)] + | ^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/privacy/private-in-public-warn.rs b/src/test/ui/privacy/private-in-public-warn.rs index 6eeb14638e7..29f365b69be 100644 --- a/src/test/ui/privacy/private-in-public-warn.rs +++ b/src/test/ui/privacy/private-in-public-warn.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Private types and traits are not allowed in public interfaces. // This test also ensures that the checks are performed even inside private modules. @@ -223,6 +213,15 @@ mod aliases_pub { impl PrivUseAliasTr for ::AssocAlias { type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface } + impl PrivUseAliasTr for Option<::AssocAlias> { + type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface + } + impl PrivUseAliasTr for (::AssocAlias, Priv) { + type Check = Priv; // OK + } + impl PrivUseAliasTr for Option<(::AssocAlias, Priv)> { + type Check = Priv; // OK + } } mod aliases_priv { diff --git a/src/test/ui/privacy/private-in-public-warn.stderr b/src/test/ui/privacy/private-in-public-warn.stderr index 04e743a5b0e..8f9e7cd74f9 100644 --- a/src/test/ui/privacy/private-in-public-warn.stderr +++ b/src/test/ui/privacy/private-in-public-warn.stderr @@ -1,11 +1,11 @@ error: private type `types::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:25:5 + --> $DIR/private-in-public-warn.rs:15:5 | LL | pub type Alias = Priv; //~ ERROR private type `types::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/private-in-public-warn.rs:15:9 + --> $DIR/private-in-public-warn.rs:5:9 | LL | #![deny(private_in_public)] | ^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | #![deny(private_in_public)] = note: for more information, see issue #34537 error: private type `types::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:28:12 + --> $DIR/private-in-public-warn.rs:18:12 | LL | V1(Priv), //~ ERROR private type `types::Priv` in public interface | ^^^^ @@ -22,7 +22,7 @@ LL | V1(Priv), //~ ERROR private type `types::Priv` in public interface = note: for more information, see issue #34537 error: private type `types::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:30:14 + --> $DIR/private-in-public-warn.rs:20:14 | LL | V2 { field: Priv }, //~ ERROR private type `types::Priv` in public interface | ^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | V2 { field: Priv }, //~ ERROR private type `types::Priv` in public = note: for more information, see issue #34537 error: private type `types::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:34:9 + --> $DIR/private-in-public-warn.rs:24:9 | LL | const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^ @@ -40,7 +40,7 @@ LL | const C: Priv = Priv; //~ ERROR private type `types::Priv` in publi = note: for more information, see issue #34537 error[E0446]: private type `types::Priv` in public interface - --> $DIR/private-in-public-warn.rs:36:9 + --> $DIR/private-in-public-warn.rs:26:9 | LL | struct Priv; | - `types::Priv` declared as private @@ -49,7 +49,7 @@ LL | type Alias = Priv; //~ ERROR private type `types::Priv` in public i | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private type `types::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:37:9 + --> $DIR/private-in-public-warn.rs:27:9 | LL | fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^ @@ -58,7 +58,7 @@ LL | fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public = note: for more information, see issue #34537 error: private type `types::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:39:9 + --> $DIR/private-in-public-warn.rs:29:9 | LL | fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -67,7 +67,7 @@ LL | fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` i = note: for more information, see issue #34537 error: private type `types::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:43:9 + --> $DIR/private-in-public-warn.rs:33:9 | LL | pub static ES: Priv; //~ ERROR private type `types::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^ @@ -76,7 +76,7 @@ LL | pub static ES: Priv; //~ ERROR private type `types::Priv` in public = note: for more information, see issue #34537 error: private type `types::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:45:9 + --> $DIR/private-in-public-warn.rs:35:9 | LL | pub fn ef1(arg: Priv); //~ ERROR private type `types::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL | pub fn ef1(arg: Priv); //~ ERROR private type `types::Priv` in publ = note: for more information, see issue #34537 error: private type `types::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:47:9 + --> $DIR/private-in-public-warn.rs:37:9 | LL | pub fn ef2() -> Priv; //~ ERROR private type `types::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^ @@ -94,7 +94,7 @@ LL | pub fn ef2() -> Priv; //~ ERROR private type `types::Priv` in publi = note: for more information, see issue #34537 error[E0446]: private type `types::Priv` in public interface - --> $DIR/private-in-public-warn.rs:51:9 + --> $DIR/private-in-public-warn.rs:41:9 | LL | struct Priv; | - `types::Priv` declared as private @@ -103,7 +103,7 @@ LL | type Alias = Priv; //~ ERROR private type `types::Priv` in public i | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:60:5 + --> $DIR/private-in-public-warn.rs:50:5 | LL | pub type Alias = T; //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -112,7 +112,7 @@ LL | pub type Alias = T; //~ ERROR private trait `traits::PrivTr` = note: for more information, see issue #34537 error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:62:5 + --> $DIR/private-in-public-warn.rs:52:5 | LL | pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL | pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in pu = note: for more information, see issue #34537 error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:64:5 + --> $DIR/private-in-public-warn.rs:54:5 | LL | pub trait Tr2 {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -130,7 +130,7 @@ LL | pub trait Tr2 {} //~ ERROR private trait `traits::PrivTr` in = note: for more information, see issue #34537 error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:66:5 + --> $DIR/private-in-public-warn.rs:56:5 | LL | / pub trait Tr3 { LL | | //~^ ERROR private trait `traits::PrivTr` in public interface @@ -145,7 +145,7 @@ LL | | } = note: for more information, see issue #34537 error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:70:9 + --> $DIR/private-in-public-warn.rs:60:9 | LL | fn f(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -154,7 +154,7 @@ LL | fn f(arg: T) {} //~ ERROR private trait `traits::PrivTr` = note: for more information, see issue #34537 error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:73:5 + --> $DIR/private-in-public-warn.rs:63:5 | LL | impl Pub {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -163,7 +163,7 @@ LL | impl Pub {} //~ ERROR private trait `traits::PrivTr` in p = note: for more information, see issue #34537 error: private trait `traits::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:75:5 + --> $DIR/private-in-public-warn.rs:65:5 | LL | impl PubTr for Pub {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -172,7 +172,7 @@ LL | impl PubTr for Pub {} //~ ERROR private trait `traits::Pr = note: for more information, see issue #34537 error: private trait `traits_where::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:84:5 + --> $DIR/private-in-public-warn.rs:74:5 | LL | pub type Alias where T: PrivTr = T; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL | pub type Alias where T: PrivTr = T; = note: for more information, see issue #34537 error: private trait `traits_where::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:87:5 + --> $DIR/private-in-public-warn.rs:77:5 | LL | pub trait Tr2 where T: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -190,7 +190,7 @@ LL | pub trait Tr2 where T: PrivTr {} = note: for more information, see issue #34537 error: private trait `traits_where::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:91:9 + --> $DIR/private-in-public-warn.rs:81:9 | LL | fn f(arg: T) where T: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -199,7 +199,7 @@ LL | fn f(arg: T) where T: PrivTr {} = note: for more information, see issue #34537 error: private trait `traits_where::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:95:5 + --> $DIR/private-in-public-warn.rs:85:5 | LL | impl Pub where T: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -208,7 +208,7 @@ LL | impl Pub where T: PrivTr {} = note: for more information, see issue #34537 error: private trait `traits_where::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:98:5 + --> $DIR/private-in-public-warn.rs:88:5 | LL | impl PubTr for Pub where T: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -217,7 +217,7 @@ LL | impl PubTr for Pub where T: PrivTr {} = note: for more information, see issue #34537 error: private trait `generics::PrivTr` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:109:5 + --> $DIR/private-in-public-warn.rs:99:5 | LL | pub trait Tr1: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -226,7 +226,7 @@ LL | pub trait Tr1: PrivTr {} = note: for more information, see issue #34537 error: private type `generics::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:112:5 + --> $DIR/private-in-public-warn.rs:102:5 | LL | pub trait Tr2: PubTr {} //~ ERROR private type `generics::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -235,7 +235,7 @@ LL | pub trait Tr2: PubTr {} //~ ERROR private type `generics::Priv` i = note: for more information, see issue #34537 error: private type `generics::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:114:5 + --> $DIR/private-in-public-warn.rs:104:5 | LL | pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR private type `generics::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -244,7 +244,7 @@ LL | pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR private type `generics::Pr = note: for more information, see issue #34537 error: private type `generics::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:116:5 + --> $DIR/private-in-public-warn.rs:106:5 | LL | pub trait Tr4: PubTr> {} //~ ERROR private type `generics::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -253,7 +253,7 @@ LL | pub trait Tr4: PubTr> {} //~ ERROR private type `generics::Pr = note: for more information, see issue #34537 error[E0446]: private type `impls::Priv` in public interface - --> $DIR/private-in-public-warn.rs:143:9 + --> $DIR/private-in-public-warn.rs:133:9 | LL | struct Priv; | - `impls::Priv` declared as private @@ -262,7 +262,7 @@ LL | type Alias = Priv; //~ ERROR private type `impls::Priv` in public i | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private type `aliases_pub::Priv` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:214:9 + --> $DIR/private-in-public-warn.rs:204:9 | LL | pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^ @@ -271,7 +271,16 @@ LL | pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` i = note: for more information, see issue #34537 error[E0446]: private type `aliases_pub::Priv` in public interface - --> $DIR/private-in-public-warn.rs:218:9 + --> $DIR/private-in-public-warn.rs:208:9 + | +LL | struct Priv; + | - `aliases_pub::Priv` declared as private +... +LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface + | ^^^^^^^^^^^^^^^^^^ can't leak private type + +error[E0446]: private type `aliases_pub::Priv` in public interface + --> $DIR/private-in-public-warn.rs:211:9 | LL | struct Priv; | - `aliases_pub::Priv` declared as private @@ -280,7 +289,7 @@ LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in pu | ^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface - --> $DIR/private-in-public-warn.rs:221:9 + --> $DIR/private-in-public-warn.rs:214:9 | LL | struct Priv; | - `aliases_pub::Priv` declared as private @@ -289,7 +298,7 @@ LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in pu | ^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface - --> $DIR/private-in-public-warn.rs:224:9 + --> $DIR/private-in-public-warn.rs:217:9 | LL | struct Priv; | - `aliases_pub::Priv` declared as private @@ -298,7 +307,7 @@ LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in pu | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private trait `aliases_priv::PrivTr1` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:248:5 + --> $DIR/private-in-public-warn.rs:247:5 | LL | pub trait Tr1: PrivUseAliasTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -306,8 +315,8 @@ LL | pub trait Tr1: PrivUseAliasTr {} = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 -error: private type `aliases_priv::Priv2` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:251:5 +error: private trait `aliases_priv::PrivTr1` in public interface (error E0445) + --> $DIR/private-in-public-warn.rs:250:5 | LL | pub trait Tr2: PrivUseAliasTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -315,8 +324,8 @@ LL | pub trait Tr2: PrivUseAliasTr {} = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 -error: private trait `aliases_priv::PrivTr1` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:251:5 +error: private type `aliases_priv::Priv2` in public interface (error E0446) + --> $DIR/private-in-public-warn.rs:250:5 | LL | pub trait Tr2: PrivUseAliasTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -324,6 +333,6 @@ LL | pub trait Tr2: PrivUseAliasTr {} = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #34537 -error: aborting due to 35 previous errors +error: aborting due to 36 previous errors For more information about this error, try `rustc --explain E0446`. diff --git a/src/test/ui/privacy/private-in-public.rs b/src/test/ui/privacy/private-in-public.rs index b865e391d29..08c00f44f22 100644 --- a/src/test/ui/privacy/private-in-public.rs +++ b/src/test/ui/privacy/private-in-public.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Private types and traits are not allowed in public interfaces. // This test also ensures that the checks are performed even inside private modules. @@ -112,7 +102,7 @@ mod aliases_pub { // This should be OK, but associated type aliases are not substituted yet pub fn f3(arg: ::Assoc) {} - //~^ ERROR private type `::Assoc` in public interface + //~^ ERROR private trait `aliases_pub::PrivTr` in public interface //~| ERROR private type `aliases_pub::Priv` in public interface impl PrivUseAlias { @@ -141,7 +131,7 @@ mod aliases_priv { pub fn f1(arg: PrivUseAlias) {} //~ ERROR private type `aliases_priv::Priv1` in public interface pub fn f2(arg: PrivAlias) {} //~ ERROR private type `aliases_priv::Priv2` in public interface pub fn f3(arg: ::Assoc) {} - //~^ ERROR private type `::Assoc` in public + //~^ ERROR private trait `aliases_priv::PrivTr` in public interface //~| ERROR private type `aliases_priv::Priv` in public interface } diff --git a/src/test/ui/privacy/private-in-public.stderr b/src/test/ui/privacy/private-in-public.stderr index 586327fbf26..bf88a83e633 100644 --- a/src/test/ui/privacy/private-in-public.stderr +++ b/src/test/ui/privacy/private-in-public.stderr @@ -1,5 +1,5 @@ error[E0446]: private type `types::Priv` in public interface - --> $DIR/private-in-public.rs:23:5 + --> $DIR/private-in-public.rs:13:5 | LL | struct Priv; | - `types::Priv` declared as private @@ -8,7 +8,7 @@ LL | pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in publi | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface - --> $DIR/private-in-public.rs:24:5 + --> $DIR/private-in-public.rs:14:5 | LL | struct Priv; | - `types::Priv` declared as private @@ -17,7 +17,7 @@ LL | pub static S: Priv = Priv; //~ ERROR private type `types::Priv` in publ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface - --> $DIR/private-in-public.rs:25:5 + --> $DIR/private-in-public.rs:15:5 | LL | struct Priv; | - `types::Priv` declared as private @@ -26,7 +26,7 @@ LL | pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface - --> $DIR/private-in-public.rs:26:5 + --> $DIR/private-in-public.rs:16:5 | LL | struct Priv; | - `types::Priv` declared as private @@ -35,7 +35,7 @@ LL | pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` i | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface - --> $DIR/private-in-public.rs:27:19 + --> $DIR/private-in-public.rs:17:19 | LL | struct Priv; | - `types::Priv` declared as private @@ -44,7 +44,7 @@ LL | pub struct S1(pub Priv); //~ ERROR private type `types::Priv` in public | ^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface - --> $DIR/private-in-public.rs:28:21 + --> $DIR/private-in-public.rs:18:21 | LL | struct Priv; | - `types::Priv` declared as private @@ -53,7 +53,7 @@ LL | pub struct S2 { pub field: Priv } //~ ERROR private type `types::Priv` | ^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface - --> $DIR/private-in-public.rs:30:9 + --> $DIR/private-in-public.rs:20:9 | LL | struct Priv; | - `types::Priv` declared as private @@ -62,7 +62,7 @@ LL | pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in p | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface - --> $DIR/private-in-public.rs:31:9 + --> $DIR/private-in-public.rs:21:9 | LL | struct Priv; | - `types::Priv` declared as private @@ -71,7 +71,7 @@ LL | pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in pub | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface - --> $DIR/private-in-public.rs:32:9 + --> $DIR/private-in-public.rs:22:9 | LL | struct Priv; | - `types::Priv` declared as private @@ -80,58 +80,85 @@ LL | pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Pri | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0445]: private trait `traits::PrivTr` in public interface - --> $DIR/private-in-public.rs:41:5 + --> $DIR/private-in-public.rs:31:5 | +LL | trait PrivTr {} + | - `traits::PrivTr` declared as private +... LL | pub enum E { V(T) } //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface - --> $DIR/private-in-public.rs:42:5 + --> $DIR/private-in-public.rs:32:5 | +LL | trait PrivTr {} + | - `traits::PrivTr` declared as private +... LL | pub fn f(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface - --> $DIR/private-in-public.rs:43:5 + --> $DIR/private-in-public.rs:33:5 | +LL | trait PrivTr {} + | - `traits::PrivTr` declared as private +... LL | pub struct S1(T); //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface - --> $DIR/private-in-public.rs:44:5 + --> $DIR/private-in-public.rs:34:5 | +LL | trait PrivTr {} + | - `traits::PrivTr` declared as private +... LL | / impl Pub { //~ ERROR private trait `traits::PrivTr` in public interface LL | | pub fn f(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface LL | | } | |_____^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface - --> $DIR/private-in-public.rs:45:9 + --> $DIR/private-in-public.rs:35:9 | +LL | trait PrivTr {} + | - `traits::PrivTr` declared as private +... LL | pub fn f(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface - --> $DIR/private-in-public.rs:54:5 + --> $DIR/private-in-public.rs:44:5 | +LL | trait PrivTr {} + | - `traits_where::PrivTr` declared as private +... LL | pub enum E where T: PrivTr { V(T) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface - --> $DIR/private-in-public.rs:56:5 + --> $DIR/private-in-public.rs:46:5 | +LL | trait PrivTr {} + | - `traits_where::PrivTr` declared as private +... LL | pub fn f(arg: T) where T: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface - --> $DIR/private-in-public.rs:58:5 + --> $DIR/private-in-public.rs:48:5 | +LL | trait PrivTr {} + | - `traits_where::PrivTr` declared as private +... LL | pub struct S1(T) where T: PrivTr; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface - --> $DIR/private-in-public.rs:60:5 + --> $DIR/private-in-public.rs:50:5 | +LL | trait PrivTr {} + | - `traits_where::PrivTr` declared as private +... LL | / impl Pub where T: PrivTr { LL | | //~^ ERROR private trait `traits_where::PrivTr` in public interface LL | | pub fn f(arg: U) where U: PrivTr {} @@ -140,13 +167,16 @@ LL | | } | |_____^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface - --> $DIR/private-in-public.rs:62:9 + --> $DIR/private-in-public.rs:52:9 | +LL | trait PrivTr {} + | - `traits_where::PrivTr` declared as private +... LL | pub fn f(arg: U) where U: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0446]: private type `generics::Priv` in public interface - --> $DIR/private-in-public.rs:73:5 + --> $DIR/private-in-public.rs:63:5 | LL | struct Priv(T); | - `generics::Priv` declared as private @@ -155,7 +185,7 @@ LL | pub fn f1(arg: [Priv; 1]) {} //~ ERROR private type `generics::Priv` in | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `generics::Priv` in public interface - --> $DIR/private-in-public.rs:74:5 + --> $DIR/private-in-public.rs:64:5 | LL | struct Priv(T); | - `generics::Priv` declared as private @@ -164,7 +194,7 @@ LL | pub fn f2(arg: Pub) {} //~ ERROR private type `generics::Priv` in | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `generics::Priv` in public interface - --> $DIR/private-in-public.rs:75:5 + --> $DIR/private-in-public.rs:65:5 | LL | struct Priv(T); | - `generics::Priv` declared as private @@ -173,7 +203,7 @@ LL | pub fn f3(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `impls::Priv` in public interface - --> $DIR/private-in-public.rs:90:9 + --> $DIR/private-in-public.rs:80:9 | LL | struct Priv; | - `impls::Priv` declared as private @@ -181,17 +211,17 @@ LL | struct Priv; LL | pub fn f(arg: Priv) {} //~ ERROR private type `impls::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type -error[E0446]: private type `::Assoc` in public interface - --> $DIR/private-in-public.rs:114:5 +error[E0445]: private trait `aliases_pub::PrivTr` in public interface + --> $DIR/private-in-public.rs:104:5 | LL | trait PrivTr { - | - `::Assoc` declared as private + | - `aliases_pub::PrivTr` declared as private ... LL | pub fn f3(arg: ::Assoc) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0446]: private type `aliases_pub::Priv` in public interface - --> $DIR/private-in-public.rs:114:5 + --> $DIR/private-in-public.rs:104:5 | LL | struct Priv; | - `aliases_pub::Priv` declared as private @@ -200,7 +230,7 @@ LL | pub fn f3(arg: ::Assoc) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface - --> $DIR/private-in-public.rs:119:9 + --> $DIR/private-in-public.rs:109:9 | LL | struct Priv; | - `aliases_pub::Priv` declared as private @@ -209,7 +239,7 @@ LL | pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` i | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_priv::Priv1` in public interface - --> $DIR/private-in-public.rs:141:5 + --> $DIR/private-in-public.rs:131:5 | LL | struct Priv1; | - `aliases_priv::Priv1` declared as private @@ -218,7 +248,7 @@ LL | pub fn f1(arg: PrivUseAlias) {} //~ ERROR private type `aliases_priv::P | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_priv::Priv2` in public interface - --> $DIR/private-in-public.rs:142:5 + --> $DIR/private-in-public.rs:132:5 | LL | struct Priv2; | - `aliases_priv::Priv2` declared as private @@ -226,17 +256,17 @@ LL | struct Priv2; LL | pub fn f2(arg: PrivAlias) {} //~ ERROR private type `aliases_priv::Priv2` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type -error[E0446]: private type `::Assoc` in public interface - --> $DIR/private-in-public.rs:143:5 +error[E0445]: private trait `aliases_priv::PrivTr` in public interface + --> $DIR/private-in-public.rs:133:5 | LL | trait PrivTr { - | - `::Assoc` declared as private + | - `aliases_priv::PrivTr` declared as private ... LL | pub fn f3(arg: ::Assoc) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0446]: private type `aliases_priv::Priv` in public interface - --> $DIR/private-in-public.rs:143:5 + --> $DIR/private-in-public.rs:133:5 | LL | struct Priv; | - `aliases_priv::Priv` declared as private @@ -245,7 +275,7 @@ LL | pub fn f3(arg: ::Assoc) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_params::Priv` in public interface - --> $DIR/private-in-public.rs:153:5 + --> $DIR/private-in-public.rs:143:5 | LL | struct Priv; | - `aliases_params::Priv` declared as private @@ -254,7 +284,7 @@ LL | pub fn f2(arg: PrivAliasGeneric) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_params::Priv` in public interface - --> $DIR/private-in-public.rs:155:5 + --> $DIR/private-in-public.rs:145:5 | LL | struct Priv; | - `aliases_params::Priv` declared as private diff --git a/src/test/ui/privacy/private-inferred-type-1.rs b/src/test/ui/privacy/private-inferred-type-1.rs index ba8b3d1810a..69eeb2a26e6 100644 --- a/src/test/ui/privacy/private-inferred-type-1.rs +++ b/src/test/ui/privacy/private-inferred-type-1.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Arr0 { fn arr0_secret(&self); } diff --git a/src/test/ui/privacy/private-inferred-type-1.stderr b/src/test/ui/privacy/private-inferred-type-1.stderr index 4036152c27f..06df7e84783 100644 --- a/src/test/ui/privacy/private-inferred-type-1.stderr +++ b/src/test/ui/privacy/private-inferred-type-1.stderr @@ -1,11 +1,11 @@ error: type `m::Priv` is private - --> $DIR/private-inferred-type-1.rs:26:5 + --> $DIR/private-inferred-type-1.rs:16:5 | LL | [].arr0_secret(); //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type-1.rs:27:5 + --> $DIR/private-inferred-type-1.rs:17:5 | LL | None.ty_param_secret(); //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/privacy/private-inferred-type-2.rs b/src/test/ui/privacy/private-inferred-type-2.rs index e981f125750..28b47606d15 100644 --- a/src/test/ui/privacy/private-inferred-type-2.rs +++ b/src/test/ui/privacy/private-inferred-type-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:private-inferred-type.rs extern crate private_inferred_type as ext; diff --git a/src/test/ui/privacy/private-inferred-type-2.stderr b/src/test/ui/privacy/private-inferred-type-2.stderr index 0559473e361..7a3f52fa05d 100644 --- a/src/test/ui/privacy/private-inferred-type-2.stderr +++ b/src/test/ui/privacy/private-inferred-type-2.stderr @@ -1,17 +1,17 @@ error: type `m::Priv` is private - --> $DIR/private-inferred-type-2.rs:26:5 + --> $DIR/private-inferred-type-2.rs:16:5 | LL | m::Pub::get_priv; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type-2.rs:27:5 + --> $DIR/private-inferred-type-2.rs:17:5 | LL | m::Pub::static_method; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^^^^^^ error: type `ext::Priv` is private - --> $DIR/private-inferred-type-2.rs:28:5 + --> $DIR/private-inferred-type-2.rs:18:5 | LL | ext::Pub::static_method; //~ ERROR type `ext::Priv` is private | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/privacy/private-inferred-type-3.rs b/src/test/ui/privacy/private-inferred-type-3.rs index 5151f624b8d..d885407a1cd 100644 --- a/src/test/ui/privacy/private-inferred-type-3.rs +++ b/src/test/ui/privacy/private-inferred-type-3.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:private-inferred-type.rs // error-pattern:type `fn() {ext::priv_fn}` is private diff --git a/src/test/ui/privacy/private-inferred-type-3.stderr b/src/test/ui/privacy/private-inferred-type-3.stderr index 590ff76b375..f8b757ea098 100644 --- a/src/test/ui/privacy/private-inferred-type-3.stderr +++ b/src/test/ui/privacy/private-inferred-type-3.stderr @@ -1,5 +1,5 @@ error: type `fn() {ext::priv_fn}` is private - --> $DIR/private-inferred-type-3.rs:26:5 + --> $DIR/private-inferred-type-3.rs:16:5 | LL | ext::m!(); | ^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | ext::m!(); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: static `PRIV_STATIC` is private - --> $DIR/private-inferred-type-3.rs:26:5 + --> $DIR/private-inferred-type-3.rs:16:5 | LL | ext::m!(); | ^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | ext::m!(); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: type `ext::PrivEnum` is private - --> $DIR/private-inferred-type-3.rs:26:5 + --> $DIR/private-inferred-type-3.rs:16:5 | LL | ext::m!(); | ^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | ext::m!(); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: type `fn() {::method}` is private - --> $DIR/private-inferred-type-3.rs:26:5 + --> $DIR/private-inferred-type-3.rs:16:5 | LL | ext::m!(); | ^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | ext::m!(); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct}` is private - --> $DIR/private-inferred-type-3.rs:26:5 + --> $DIR/private-inferred-type-3.rs:16:5 | LL | ext::m!(); | ^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | ext::m!(); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: type `fn(u8) -> ext::PubTupleStruct {ext::PubTupleStruct}` is private - --> $DIR/private-inferred-type-3.rs:26:5 + --> $DIR/private-inferred-type-3.rs:16:5 | LL | ext::m!(); | ^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | ext::m!(); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: type `for<'r> fn(&'r ext::Pub) {>::priv_method}` is private - --> $DIR/private-inferred-type-3.rs:26:5 + --> $DIR/private-inferred-type-3.rs:16:5 | LL | ext::m!(); | ^^^^^^^^^^ diff --git a/src/test/ui/privacy/private-inferred-type.rs b/src/test/ui/privacy/private-inferred-type.rs index 58e17b24394..69b60a56c67 100644 --- a/src/test/ui/privacy/private-inferred-type.rs +++ b/src/test/ui/privacy/private-inferred-type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_consts)] #![feature(decl_macro)] #![allow(private_in_public)] @@ -129,7 +119,7 @@ fn main() { m::leak_anon2(); //~ ERROR type `m::Priv` is private m::leak_anon3(); //~ ERROR type `m::Priv` is private - m::leak_dyn1(); //~ ERROR type `(dyn m::Trait + 'static)` is private + m::leak_dyn1(); //~ ERROR trait `m::Trait` is private m::leak_dyn2(); //~ ERROR type `m::Priv` is private m::leak_dyn3(); //~ ERROR type `m::Priv` is private diff --git a/src/test/ui/privacy/private-inferred-type.stderr b/src/test/ui/privacy/private-inferred-type.stderr index 1ab281cfc25..80a475f7dce 100644 --- a/src/test/ui/privacy/private-inferred-type.stderr +++ b/src/test/ui/privacy/private-inferred-type.stderr @@ -1,95 +1,95 @@ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:107:9 + --> $DIR/private-inferred-type.rs:97:9 | LL | let _: m::Alias; //~ ERROR type `m::Priv` is private | ^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:107:12 + --> $DIR/private-inferred-type.rs:97:12 | LL | let _: m::Alias; //~ ERROR type `m::Priv` is private | ^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:109:13 + --> $DIR/private-inferred-type.rs:99:13 | LL | let _: ::AssocTy; //~ ERROR type `m::Priv` is private | ^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:110:5 + --> $DIR/private-inferred-type.rs:100:5 | LL | m::Alias {}; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:111:5 + --> $DIR/private-inferred-type.rs:101:5 | LL | m::Pub { 0: m::Alias {} }; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:113:5 + --> $DIR/private-inferred-type.rs:103:5 | LL | m::Pub::static_method; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:114:5 + --> $DIR/private-inferred-type.rs:104:5 | LL | m::Pub::INHERENT_ASSOC_CONST; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:115:5 + --> $DIR/private-inferred-type.rs:105:5 | LL | m::Pub(0u8).method_with_substs::(); //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:116:17 + --> $DIR/private-inferred-type.rs:106:17 | LL | m::Pub(0u8).method_with_priv_params(loop{}); //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:117:5 + --> $DIR/private-inferred-type.rs:107:5 | LL | ::TRAIT_ASSOC_CONST; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:118:6 + --> $DIR/private-inferred-type.rs:108:6 | LL | >::INHERENT_ASSOC_CONST; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:119:5 + --> $DIR/private-inferred-type.rs:109:5 | LL | >::INHERENT_ASSOC_CONST_GENERIC_SELF; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:120:5 + --> $DIR/private-inferred-type.rs:110:5 | LL | >::static_method_generic_self; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:122:5 + --> $DIR/private-inferred-type.rs:112:5 | LL | u8::pub_method; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^ error: type `adjust::S2` is private - --> $DIR/private-inferred-type.rs:124:5 + --> $DIR/private-inferred-type.rs:114:5 | LL | adjust::S1.method_s3(); //~ ERROR type `adjust::S2` is private | ^^^^^^^^^^ error: type `fn() {m::priv_fn}` is private - --> $DIR/private-inferred-type.rs:49:9 + --> $DIR/private-inferred-type.rs:39:9 | LL | priv_fn; //~ ERROR type `fn() {m::priv_fn}` is private | ^^^^^^^ @@ -98,7 +98,7 @@ LL | m::m!(); | -------- in this macro invocation error: type `m::PrivEnum` is private - --> $DIR/private-inferred-type.rs:51:9 + --> $DIR/private-inferred-type.rs:41:9 | LL | PrivEnum::Variant; //~ ERROR type `m::PrivEnum` is private | ^^^^^^^^^^^^^^^^^ @@ -107,7 +107,7 @@ LL | m::m!(); | -------- in this macro invocation error: type `fn() {::method}` is private - --> $DIR/private-inferred-type.rs:53:9 + --> $DIR/private-inferred-type.rs:43:9 | LL | ::method; //~ ERROR type `fn() {::method}` is private | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -116,7 +116,7 @@ LL | m::m!(); | -------- in this macro invocation error: type `fn(u8) -> m::PrivTupleStruct {m::PrivTupleStruct}` is private - --> $DIR/private-inferred-type.rs:55:9 + --> $DIR/private-inferred-type.rs:45:9 | LL | PrivTupleStruct; | ^^^^^^^^^^^^^^^ @@ -125,7 +125,7 @@ LL | m::m!(); | -------- in this macro invocation error: type `fn(u8) -> m::PubTupleStruct {m::PubTupleStruct}` is private - --> $DIR/private-inferred-type.rs:57:9 + --> $DIR/private-inferred-type.rs:47:9 | LL | PubTupleStruct; | ^^^^^^^^^^^^^^ @@ -134,7 +134,7 @@ LL | m::m!(); | -------- in this macro invocation error: type `for<'r> fn(&'r m::Pub) {>::priv_method}` is private - --> $DIR/private-inferred-type.rs:59:18 + --> $DIR/private-inferred-type.rs:49:18 | LL | Pub(0u8).priv_method(); | ^^^^^^^^^^^ @@ -143,67 +143,67 @@ LL | m::m!(); | -------- in this macro invocation error: trait `m::Trait` is private - --> $DIR/private-inferred-type.rs:128:5 + --> $DIR/private-inferred-type.rs:118:5 | LL | m::leak_anon1(); //~ ERROR trait `m::Trait` is private | ^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:129:5 + --> $DIR/private-inferred-type.rs:119:5 | LL | m::leak_anon2(); //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:130:5 + --> $DIR/private-inferred-type.rs:120:5 | LL | m::leak_anon3(); //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^ -error: type `(dyn m::Trait + 'static)` is private - --> $DIR/private-inferred-type.rs:132:5 +error: trait `m::Trait` is private + --> $DIR/private-inferred-type.rs:122:5 | -LL | m::leak_dyn1(); //~ ERROR type `(dyn m::Trait + 'static)` is private +LL | m::leak_dyn1(); //~ ERROR trait `m::Trait` is private | ^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:133:5 + --> $DIR/private-inferred-type.rs:123:5 | LL | m::leak_dyn2(); //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:134:5 + --> $DIR/private-inferred-type.rs:124:5 | LL | m::leak_dyn3(); //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:137:13 + --> $DIR/private-inferred-type.rs:127:13 | LL | let a = m::Alias {}; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:138:17 + --> $DIR/private-inferred-type.rs:128:17 | LL | let mut b = a; //~ ERROR type `m::Priv` is private | ^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:139:9 + --> $DIR/private-inferred-type.rs:129:9 | LL | b = a; //~ ERROR type `m::Priv` is private | ^ error: type `m::Priv` is private - --> $DIR/private-inferred-type.rs:140:11 + --> $DIR/private-inferred-type.rs:130:11 | LL | match a { //~ ERROR type `m::Priv` is private | ^ error[E0446]: private type `m::Priv` in public interface - --> $DIR/private-inferred-type.rs:71:36 + --> $DIR/private-inferred-type.rs:61:36 | LL | struct Priv; | - `m::Priv` declared as private @@ -212,7 +212,7 @@ LL | impl TraitWithAssocTy for u8 { type AssocTy = Priv; } | ^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `adjust::S2` in public interface - --> $DIR/private-inferred-type.rs:93:9 + --> $DIR/private-inferred-type.rs:83:9 | LL | struct S2; | - `adjust::S2` declared as private diff --git a/src/test/ui/privacy/private-item-simple.rs b/src/test/ui/privacy/private-item-simple.rs index 2b9e32b8f58..1f718ed9201 100644 --- a/src/test/ui/privacy/private-item-simple.rs +++ b/src/test/ui/privacy/private-item-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { fn f() {} } diff --git a/src/test/ui/privacy/private-item-simple.stderr b/src/test/ui/privacy/private-item-simple.stderr index 468bfeaf32e..2ac694f35d4 100644 --- a/src/test/ui/privacy/private-item-simple.stderr +++ b/src/test/ui/privacy/private-item-simple.stderr @@ -1,5 +1,5 @@ error[E0603]: function `f` is private - --> $DIR/private-item-simple.rs:16:8 + --> $DIR/private-item-simple.rs:6:8 | LL | a::f(); //~ ERROR function `f` is private | ^ diff --git a/src/test/ui/privacy/private-method-cross-crate.rs b/src/test/ui/privacy/private-method-cross-crate.rs index 68059baa385..4da44e0682b 100644 --- a/src/test/ui/privacy/private-method-cross-crate.rs +++ b/src/test/ui/privacy/private-method-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:cci_class_5.rs extern crate cci_class_5; use cci_class_5::kitties::cat; diff --git a/src/test/ui/privacy/private-method-cross-crate.stderr b/src/test/ui/privacy/private-method-cross-crate.stderr index 27d398c0166..bd28f2e5a8b 100644 --- a/src/test/ui/privacy/private-method-cross-crate.stderr +++ b/src/test/ui/privacy/private-method-cross-crate.stderr @@ -1,5 +1,5 @@ error[E0624]: method `nap` is private - --> $DIR/private-method-cross-crate.rs:17:8 + --> $DIR/private-method-cross-crate.rs:7:8 | LL | nyan.nap(); //~ ERROR method `nap` is private | ^^^ diff --git a/src/test/ui/privacy/private-method-inherited.rs b/src/test/ui/privacy/private-method-inherited.rs index c6419991b11..bc27027e886 100644 --- a/src/test/ui/privacy/private-method-inherited.rs +++ b/src/test/ui/privacy/private-method-inherited.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that inherited visibility applies to methods. mod a { diff --git a/src/test/ui/privacy/private-method-inherited.stderr b/src/test/ui/privacy/private-method-inherited.stderr index 3f10750e46f..30c1e99cedd 100644 --- a/src/test/ui/privacy/private-method-inherited.stderr +++ b/src/test/ui/privacy/private-method-inherited.stderr @@ -1,5 +1,5 @@ error[E0624]: method `f` is private - --> $DIR/private-method-inherited.rs:23:7 + --> $DIR/private-method-inherited.rs:13:7 | LL | x.f(); //~ ERROR method `f` is private | ^ diff --git a/src/test/ui/privacy/private-method.rs b/src/test/ui/privacy/private-method.rs index 16510c2c8c9..a9bea520e75 100644 --- a/src/test/ui/privacy/private-method.rs +++ b/src/test/ui/privacy/private-method.rs @@ -1,28 +1,16 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern:method `nap` is private - mod kitties { - pub struct cat { + pub struct Cat { meows : usize, how_hungry : isize, } - impl cat { + impl Cat { fn nap(&self) {} } - pub fn cat(in_x : usize, in_y : isize) -> cat { - cat { + pub fn cat(in_x : usize, in_y : isize) -> Cat { + Cat { meows: in_x, how_hungry: in_y } @@ -30,6 +18,6 @@ mod kitties { } fn main() { - let nyan : kitties::cat = kitties::cat(52, 99); - nyan.nap(); + let nyan : kitties::Cat = kitties::cat(52, 99); + nyan.nap(); //~ ERROR method `nap` is private } diff --git a/src/test/ui/privacy/private-method.stderr b/src/test/ui/privacy/private-method.stderr index fce03d35e39..64820e5ea8c 100644 --- a/src/test/ui/privacy/private-method.stderr +++ b/src/test/ui/privacy/private-method.stderr @@ -1,7 +1,7 @@ error[E0624]: method `nap` is private - --> $DIR/private-method.rs:34:8 + --> $DIR/private-method.rs:22:8 | -LL | nyan.nap(); +LL | nyan.nap(); //~ ERROR method `nap` is private | ^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-struct-field-cross-crate.rs b/src/test/ui/privacy/private-struct-field-cross-crate.rs index 067c17668c6..2efcb7f1d88 100644 --- a/src/test/ui/privacy/private-struct-field-cross-crate.rs +++ b/src/test/ui/privacy/private-struct-field-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:cci_class.rs extern crate cci_class; use cci_class::kitties::cat; diff --git a/src/test/ui/privacy/private-struct-field-cross-crate.stderr b/src/test/ui/privacy/private-struct-field-cross-crate.stderr index b9401baf0d0..857f2436aa8 100644 --- a/src/test/ui/privacy/private-struct-field-cross-crate.stderr +++ b/src/test/ui/privacy/private-struct-field-cross-crate.stderr @@ -1,5 +1,5 @@ error[E0616]: field `meows` of struct `cci_class::kitties::cat` is private - --> $DIR/private-struct-field-cross-crate.rs:17:14 + --> $DIR/private-struct-field-cross-crate.rs:7:14 | LL | assert_eq!(nyan.meows, 52); | ^^^^^^^^^^ diff --git a/src/test/ui/privacy/private-struct-field-ctor.rs b/src/test/ui/privacy/private-struct-field-ctor.rs index 0a0f2d490a8..2c506f34797 100644 --- a/src/test/ui/privacy/private-struct-field-ctor.rs +++ b/src/test/ui/privacy/private-struct-field-ctor.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { pub struct Foo { x: isize diff --git a/src/test/ui/privacy/private-struct-field-ctor.stderr b/src/test/ui/privacy/private-struct-field-ctor.stderr index 711d265c559..943abeed114 100644 --- a/src/test/ui/privacy/private-struct-field-ctor.stderr +++ b/src/test/ui/privacy/private-struct-field-ctor.stderr @@ -1,5 +1,5 @@ error[E0451]: field `x` of struct `a::Foo` is private - --> $DIR/private-struct-field-ctor.rs:18:22 + --> $DIR/private-struct-field-ctor.rs:8:22 | LL | let s = a::Foo { x: 1 }; //~ ERROR field `x` of struct `a::Foo` is private | ^^^^ field `x` is private diff --git a/src/test/ui/privacy/private-struct-field-pattern.rs b/src/test/ui/privacy/private-struct-field-pattern.rs index e9dd6cd1d74..b3da6092abc 100644 --- a/src/test/ui/privacy/private-struct-field-pattern.rs +++ b/src/test/ui/privacy/private-struct-field-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use a::Foo; mod a { diff --git a/src/test/ui/privacy/private-struct-field-pattern.stderr b/src/test/ui/privacy/private-struct-field-pattern.stderr index bc09a2a6daf..05e6d3d7243 100644 --- a/src/test/ui/privacy/private-struct-field-pattern.stderr +++ b/src/test/ui/privacy/private-struct-field-pattern.stderr @@ -1,5 +1,5 @@ error[E0451]: field `x` of struct `a::Foo` is private - --> $DIR/private-struct-field-pattern.rs:25:15 + --> $DIR/private-struct-field-pattern.rs:15:15 | LL | Foo { x: _ } => {} //~ ERROR field `x` of struct `a::Foo` is private | ^^^^ field `x` is private diff --git a/src/test/ui/privacy/private-struct-field.rs b/src/test/ui/privacy/private-struct-field.rs index 1423117dc81..216ae20e153 100644 --- a/src/test/ui/privacy/private-struct-field.rs +++ b/src/test/ui/privacy/private-struct-field.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod cat { pub struct Cat { meows: usize diff --git a/src/test/ui/privacy/private-struct-field.stderr b/src/test/ui/privacy/private-struct-field.stderr index db16e1ba1fc..7cb6d6ab4d7 100644 --- a/src/test/ui/privacy/private-struct-field.stderr +++ b/src/test/ui/privacy/private-struct-field.stderr @@ -1,5 +1,5 @@ error[E0616]: field `meows` of struct `cat::Cat` is private - --> $DIR/private-struct-field.rs:23:16 + --> $DIR/private-struct-field.rs:13:16 | LL | assert_eq!(nyan.meows, 52); //~ ERROR field `meows` of struct `cat::Cat` is private | ^^^^^^^^^^ diff --git a/src/test/ui/privacy/private-type-in-interface.rs b/src/test/ui/privacy/private-type-in-interface.rs index 1842790a140..359b6da1d79 100644 --- a/src/test/ui/privacy/private-type-in-interface.rs +++ b/src/test/ui/privacy/private-type-in-interface.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:private-inferred-type.rs #![allow(warnings)] diff --git a/src/test/ui/privacy/private-type-in-interface.stderr b/src/test/ui/privacy/private-type-in-interface.stderr index 38c21a77211..b436f20fce9 100644 --- a/src/test/ui/privacy/private-type-in-interface.stderr +++ b/src/test/ui/privacy/private-type-in-interface.stderr @@ -1,53 +1,53 @@ error: type `m::Priv` is private - --> $DIR/private-type-in-interface.rs:25:9 + --> $DIR/private-type-in-interface.rs:15:9 | LL | fn f(_: m::Alias) {} //~ ERROR type `m::Priv` is private | ^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-type-in-interface.rs:25:6 + --> $DIR/private-type-in-interface.rs:15:6 | LL | fn f(_: m::Alias) {} //~ ERROR type `m::Priv` is private | ^ error: type `ext::Priv` is private - --> $DIR/private-type-in-interface.rs:27:13 + --> $DIR/private-type-in-interface.rs:17:13 | LL | fn f_ext(_: ext::Alias) {} //~ ERROR type `ext::Priv` is private | ^^^^^^^^^^ error: type `ext::Priv` is private - --> $DIR/private-type-in-interface.rs:27:10 + --> $DIR/private-type-in-interface.rs:17:10 | LL | fn f_ext(_: ext::Alias) {} //~ ERROR type `ext::Priv` is private | ^ error: type `m::Priv` is private - --> $DIR/private-type-in-interface.rs:31:6 + --> $DIR/private-type-in-interface.rs:21:6 | LL | impl m::Alias {} //~ ERROR type `m::Priv` is private | ^^^^^^^^ error: type `ext::Priv` is private - --> $DIR/private-type-in-interface.rs:32:14 + --> $DIR/private-type-in-interface.rs:22:14 | LL | impl Tr1 for ext::Alias {} //~ ERROR type `ext::Priv` is private | ^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-type-in-interface.rs:33:10 + --> $DIR/private-type-in-interface.rs:23:10 | LL | type A = ::X; //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private - --> $DIR/private-type-in-interface.rs:37:11 + --> $DIR/private-type-in-interface.rs:27:11 | LL | fn g() -> impl Tr2 { 0 } //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^^^^ error: type `ext::Priv` is private - --> $DIR/private-type-in-interface.rs:38:15 + --> $DIR/private-type-in-interface.rs:28:15 | LL | fn g_ext() -> impl Tr2 { 0 } //~ ERROR type `ext::Priv` is private | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/privacy/private-variant-reexport.rs b/src/test/ui/privacy/private-variant-reexport.rs index 5d770f88155..0722b815c14 100644 --- a/src/test/ui/privacy/private-variant-reexport.rs +++ b/src/test/ui/privacy/private-variant-reexport.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod m1 { pub use ::E::V; //~ ERROR variant `V` is private and cannot be re-exported } diff --git a/src/test/ui/privacy/private-variant-reexport.stderr b/src/test/ui/privacy/private-variant-reexport.stderr index 11e13ab9ba8..99f4a41272c 100644 --- a/src/test/ui/privacy/private-variant-reexport.stderr +++ b/src/test/ui/privacy/private-variant-reexport.stderr @@ -1,5 +1,5 @@ error: variant `V` is private and cannot be re-exported - --> $DIR/private-variant-reexport.rs:12:13 + --> $DIR/private-variant-reexport.rs:2:13 | LL | pub use ::E::V; //~ ERROR variant `V` is private and cannot be re-exported | ^^^^^^ @@ -8,19 +8,19 @@ LL | enum E { V } | ------ help: consider making the enum public: `pub enum E` error: variant `V` is private and cannot be re-exported - --> $DIR/private-variant-reexport.rs:16:19 + --> $DIR/private-variant-reexport.rs:6:19 | LL | pub use ::E::{V}; //~ ERROR variant `V` is private and cannot be re-exported | ^ error: variant `V` is private and cannot be re-exported - --> $DIR/private-variant-reexport.rs:20:22 + --> $DIR/private-variant-reexport.rs:10:22 | LL | pub use ::E::V::{self}; //~ ERROR variant `V` is private and cannot be re-exported | ^^^^ error: enum is private and its variants cannot be re-exported - --> $DIR/private-variant-reexport.rs:24:13 + --> $DIR/private-variant-reexport.rs:14:13 | LL | pub use ::E::*; //~ ERROR enum is private and its variants cannot be re-exported | ^^^^^^ diff --git a/src/test/ui/privacy/restricted/auxiliary/pub_restricted.rs b/src/test/ui/privacy/restricted/auxiliary/pub_restricted.rs index c4ab96c8456..482d5cdc45d 100644 --- a/src/test/ui/privacy/restricted/auxiliary/pub_restricted.rs +++ b/src/test/ui/privacy/restricted/auxiliary/pub_restricted.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(crate_visibility_modifier)] pub(crate) struct Crate; diff --git a/src/test/ui/privacy/restricted/lookup-ignores-private.rs b/src/test/ui/privacy/restricted/lookup-ignores-private.rs index 1eda959e3f6..419d521748c 100644 --- a/src/test/ui/privacy/restricted/lookup-ignores-private.rs +++ b/src/test/ui/privacy/restricted/lookup-ignores-private.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(warnings)] diff --git a/src/test/ui/privacy/restricted/private-in-public.rs b/src/test/ui/privacy/restricted/private-in-public.rs index 4d3f5377797..7cae28970d4 100644 --- a/src/test/ui/privacy/restricted/private-in-public.rs +++ b/src/test/ui/privacy/restricted/private-in-public.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(crate_visibility_modifier)] mod foo { diff --git a/src/test/ui/privacy/restricted/private-in-public.stderr b/src/test/ui/privacy/restricted/private-in-public.stderr index e0d3abdc213..2fb7059e0d4 100644 --- a/src/test/ui/privacy/restricted/private-in-public.stderr +++ b/src/test/ui/privacy/restricted/private-in-public.stderr @@ -1,5 +1,5 @@ error[E0446]: private type `foo::Priv` in public interface - --> $DIR/private-in-public.rs:18:9 + --> $DIR/private-in-public.rs:8:9 | LL | struct Priv; | - `foo::Priv` declared as private @@ -8,7 +8,7 @@ LL | pub(crate) fn g(_: Priv) {} //~ ERROR E0446 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `foo::Priv` in public interface - --> $DIR/private-in-public.rs:19:9 + --> $DIR/private-in-public.rs:9:9 | LL | struct Priv; | - `foo::Priv` declared as private diff --git a/src/test/ui/privacy/restricted/relative-2018.rs b/src/test/ui/privacy/restricted/relative-2018.rs new file mode 100644 index 00000000000..69b7c1e4d4f --- /dev/null +++ b/src/test/ui/privacy/restricted/relative-2018.rs @@ -0,0 +1,13 @@ +// edition:2018 + +mod m { + pub(in crate) struct S1; // OK + pub(in super) struct S2; // OK + pub(in self) struct S3; // OK + pub(in ::core) struct S4; + //~^ ERROR visibilities can only be restricted to ancestor modules + pub(in a::b) struct S5; + //~^ ERROR relative paths are not supported in visibilities on 2018 edition +} + +fn main() {} diff --git a/src/test/ui/privacy/restricted/relative-2018.stderr b/src/test/ui/privacy/restricted/relative-2018.stderr new file mode 100644 index 00000000000..61effc463e9 --- /dev/null +++ b/src/test/ui/privacy/restricted/relative-2018.stderr @@ -0,0 +1,16 @@ +error: visibilities can only be restricted to ancestor modules + --> $DIR/relative-2018.rs:7:12 + | +LL | pub(in ::core) struct S4; + | ^^^^^^ + +error: relative paths are not supported in visibilities on 2018 edition + --> $DIR/relative-2018.rs:9:12 + | +LL | pub(in a::b) struct S5; + | ^--- + | | + | help: try: `crate::a::b` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/privacy/restricted/struct-literal-field.rs b/src/test/ui/privacy/restricted/struct-literal-field.rs index 21d90dfea4b..9c6104755a4 100644 --- a/src/test/ui/privacy/restricted/struct-literal-field.rs +++ b/src/test/ui/privacy/restricted/struct-literal-field.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(warnings)] mod foo { diff --git a/src/test/ui/privacy/restricted/struct-literal-field.stderr b/src/test/ui/privacy/restricted/struct-literal-field.stderr index 6d668c8767a..0109cae91a0 100644 --- a/src/test/ui/privacy/restricted/struct-literal-field.stderr +++ b/src/test/ui/privacy/restricted/struct-literal-field.stderr @@ -1,5 +1,5 @@ error[E0451]: field `x` of struct `foo::bar::S` is private - --> $DIR/struct-literal-field.rs:28:9 + --> $DIR/struct-literal-field.rs:18:9 | LL | S { x: 0 }; //~ ERROR private | ^^^^ field `x` is private diff --git a/src/test/ui/privacy/restricted/test.rs b/src/test/ui/privacy/restricted/test.rs index 2b2d9b76bdd..f208696c86f 100644 --- a/src/test/ui/privacy/restricted/test.rs +++ b/src/test/ui/privacy/restricted/test.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:pub_restricted.rs #![allow(warnings)] diff --git a/src/test/ui/privacy/restricted/test.stderr b/src/test/ui/privacy/restricted/test.stderr index 01e224910a5..7539b0e1af4 100644 --- a/src/test/ui/privacy/restricted/test.stderr +++ b/src/test/ui/privacy/restricted/test.stderr @@ -1,77 +1,77 @@ error[E0433]: failed to resolve: maybe a missing `extern crate bad;`? - --> $DIR/test.rs:60:12 + --> $DIR/test.rs:50:12 | LL | pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: maybe a missing `extern crate bad;`? | ^^^ maybe a missing `extern crate bad;`? error: visibilities can only be restricted to ancestor modules - --> $DIR/test.rs:61:12 + --> $DIR/test.rs:51:12 | LL | pub(in foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules | ^^^ error[E0364]: `f` is private, and cannot be re-exported - --> $DIR/test.rs:31:24 + --> $DIR/test.rs:21:24 | LL | pub(super) use foo::bar::f as g; //~ ERROR cannot be re-exported | ^^^^^^^^^^^^^^^^ | note: consider marking `f` as `pub` in the imported module - --> $DIR/test.rs:31:24 + --> $DIR/test.rs:21:24 | LL | pub(super) use foo::bar::f as g; //~ ERROR cannot be re-exported | ^^^^^^^^^^^^^^^^ error[E0603]: struct `Crate` is private - --> $DIR/test.rs:48:25 + --> $DIR/test.rs:38:25 | LL | use pub_restricted::Crate; //~ ERROR private | ^^^^^ error[E0603]: function `f` is private - --> $DIR/test.rs:40:19 + --> $DIR/test.rs:30:19 | LL | use foo::bar::f; //~ ERROR private | ^ error[E0616]: field `x` of struct `foo::bar::S` is private - --> $DIR/test.rs:41:5 + --> $DIR/test.rs:31:5 | LL | S::default().x; //~ ERROR private | ^^^^^^^^^^^^^^ error[E0624]: method `f` is private - --> $DIR/test.rs:42:18 + --> $DIR/test.rs:32:18 | LL | S::default().f(); //~ ERROR private | ^ error[E0624]: method `g` is private - --> $DIR/test.rs:43:5 + --> $DIR/test.rs:33:5 | LL | S::g(); //~ ERROR private | ^^^^ error[E0616]: field `y` of struct `pub_restricted::Universe` is private - --> $DIR/test.rs:52:13 + --> $DIR/test.rs:42:13 | LL | let _ = u.y; //~ ERROR private | ^^^ error[E0616]: field `z` of struct `pub_restricted::Universe` is private - --> $DIR/test.rs:53:13 + --> $DIR/test.rs:43:13 | LL | let _ = u.z; //~ ERROR private | ^^^ error[E0624]: method `g` is private - --> $DIR/test.rs:55:7 + --> $DIR/test.rs:45:7 | LL | u.g(); //~ ERROR private | ^ error[E0624]: method `h` is private - --> $DIR/test.rs:56:7 + --> $DIR/test.rs:46:7 | LL | u.h(); //~ ERROR private | ^ diff --git a/src/test/ui/privacy/union-field-privacy-1.rs b/src/test/ui/privacy/union-field-privacy-1.rs index eeebb1b737a..1ff4d513fac 100644 --- a/src/test/ui/privacy/union-field-privacy-1.rs +++ b/src/test/ui/privacy/union-field-privacy-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod m { pub union U { pub a: u8, diff --git a/src/test/ui/privacy/union-field-privacy-1.stderr b/src/test/ui/privacy/union-field-privacy-1.stderr index c93760a1b89..d31360dbe65 100644 --- a/src/test/ui/privacy/union-field-privacy-1.stderr +++ b/src/test/ui/privacy/union-field-privacy-1.stderr @@ -1,11 +1,11 @@ error[E0451]: field `c` of union `m::U` is private - --> $DIR/union-field-privacy-1.rs:22:20 + --> $DIR/union-field-privacy-1.rs:12:20 | LL | let u = m::U { c: 0 }; //~ ERROR field `c` of union `m::U` is private | ^^^^ field `c` is private error[E0451]: field `c` of union `m::U` is private - --> $DIR/union-field-privacy-1.rs:26:16 + --> $DIR/union-field-privacy-1.rs:16:16 | LL | let m::U { c } = u; //~ ERROR field `c` of union `m::U` is private | ^ field `c` is private diff --git a/src/test/ui/privacy/union-field-privacy-2.rs b/src/test/ui/privacy/union-field-privacy-2.rs index d6bb765202d..48279630c63 100644 --- a/src/test/ui/privacy/union-field-privacy-2.rs +++ b/src/test/ui/privacy/union-field-privacy-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod m { pub union U { pub a: u8, diff --git a/src/test/ui/privacy/union-field-privacy-2.stderr b/src/test/ui/privacy/union-field-privacy-2.stderr index cc12483a653..bd2c834c966 100644 --- a/src/test/ui/privacy/union-field-privacy-2.stderr +++ b/src/test/ui/privacy/union-field-privacy-2.stderr @@ -1,5 +1,5 @@ error[E0616]: field `c` of struct `m::U` is private - --> $DIR/union-field-privacy-2.rs:24:13 + --> $DIR/union-field-privacy-2.rs:14:13 | LL | let c = u.c; //~ ERROR field `c` of struct `m::U` is private | ^^^ diff --git a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs-test.rs b/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.rs similarity index 100% rename from src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs-test.rs rename to src/test/ui/proc-macro/ambiguous-builtin-attrs-test.rs diff --git a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs-test.stderr b/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr similarity index 100% rename from src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs-test.stderr rename to src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr diff --git a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.rs b/src/test/ui/proc-macro/ambiguous-builtin-attrs.rs similarity index 100% rename from src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.rs rename to src/test/ui/proc-macro/ambiguous-builtin-attrs.rs diff --git a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.stderr b/src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr similarity index 87% rename from src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.stderr rename to src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr index 34b21ea2683..79dc922b9db 100644 --- a/src/test/ui-fulldeps/proc-macro/ambiguous-builtin-attrs.stderr +++ b/src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr @@ -16,7 +16,7 @@ note: `repr` could also refer to the attribute macro imported here | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ - = help: use `self::repr` to refer to this attribute macro unambiguously + = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:11:19 @@ -30,7 +30,7 @@ note: `repr` could also refer to the attribute macro imported here | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ - = help: use `self::repr` to refer to this attribute macro unambiguously + = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:20:34 @@ -44,7 +44,7 @@ note: `repr` could also refer to the attribute macro imported here | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ - = help: use `self::repr` to refer to this attribute macro unambiguously + = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:22:11 @@ -58,7 +58,7 @@ note: `repr` could also refer to the attribute macro imported here | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ - = help: use `self::repr` to refer to this attribute macro unambiguously + = help: use `crate::repr` to refer to this attribute macro unambiguously error[E0659]: `feature` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:3:4 @@ -72,7 +72,7 @@ note: `feature` could also refer to the attribute macro imported here | LL | use builtin_attrs::*; | ^^^^^^^^^^^^^^^^ - = help: use `self::feature` to refer to this attribute macro unambiguously + = help: use `crate::feature` to refer to this attribute macro unambiguously error: aborting due to 6 previous errors diff --git a/src/test/ui/proc-macro/attr-invalid-exprs.rs b/src/test/ui/proc-macro/attr-invalid-exprs.rs new file mode 100644 index 00000000000..c609cae9024 --- /dev/null +++ b/src/test/ui/proc-macro/attr-invalid-exprs.rs @@ -0,0 +1,27 @@ +// aux-build:attr-stmt-expr.rs + +//! Attributes producing expressions in invalid locations + +#![feature(stmt_expr_attributes, proc_macro_hygiene)] + +extern crate attr_stmt_expr; +use attr_stmt_expr::{duplicate, no_output}; + +fn main() { + let _ = #[no_output] "Hello, world!"; + //~^ ERROR expected expression, found `` + + let _ = #[duplicate] "Hello, world!"; + //~^ ERROR macro expansion ignores token `,` and any following + + let _ = { + #[no_output] + "Hello, world!" + }; + + let _ = { + #[duplicate] + //~^ ERROR macro expansion ignores token `,` and any following + "Hello, world!" + }; +} diff --git a/src/test/ui/proc-macro/attr-invalid-exprs.stderr b/src/test/ui/proc-macro/attr-invalid-exprs.stderr new file mode 100644 index 00000000000..5d2fb59ff1f --- /dev/null +++ b/src/test/ui/proc-macro/attr-invalid-exprs.stderr @@ -0,0 +1,28 @@ +error: expected expression, found `` + --> $DIR/attr-invalid-exprs.rs:11:13 + | +LL | let _ = #[no_output] "Hello, world!"; + | ^^^^^^^^^^^^ + +error: macro expansion ignores token `,` and any following + --> $DIR/attr-invalid-exprs.rs:14:13 + | +LL | let _ = #[duplicate] "Hello, world!"; + | ^^^^^^^^^^^^- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here + | + = note: the usage of `duplicate!` is likely invalid in expression context + +error: macro expansion ignores token `,` and any following + --> $DIR/attr-invalid-exprs.rs:23:9 + | +LL | #[duplicate] + | ^^^^^^^^^^^^- help: you might be missing a semicolon here: `;` + | | + | caused by the macro expansion here + | + = note: the usage of `duplicate!` is likely invalid in expression context + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/proc-macro/attr-stmt-expr.rs b/src/test/ui/proc-macro/attr-stmt-expr.rs new file mode 100644 index 00000000000..5fdaf93de44 --- /dev/null +++ b/src/test/ui/proc-macro/attr-stmt-expr.rs @@ -0,0 +1,27 @@ +// aux-build:attr-stmt-expr.rs + +#![feature(proc_macro_hygiene)] + +extern crate attr_stmt_expr; +use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr}; + +fn print_str(string: &'static str) { + // macros are handled a bit differently + #[expect_print_expr] + //~^ ERROR attributes on expressions are experimental + //~| HELP add #![feature(stmt_expr_attributes)] to the crate attributes to enable + println!("{}", string) +} + +fn main() { + #[expect_let] + let string = "Hello, world!"; + + #[expect_print_stmt] + println!("{}", string); + + #[expect_expr] + //~^ ERROR attributes on expressions are experimental + //~| HELP add #![feature(stmt_expr_attributes)] to the crate attributes to enable + print_str("string") +} diff --git a/src/test/ui/proc-macro/attr-stmt-expr.stderr b/src/test/ui/proc-macro/attr-stmt-expr.stderr new file mode 100644 index 00000000000..34ee012ab31 --- /dev/null +++ b/src/test/ui/proc-macro/attr-stmt-expr.stderr @@ -0,0 +1,19 @@ +error[E0658]: attributes on expressions are experimental. (see issue #15701) + --> $DIR/attr-stmt-expr.rs:10:5 + | +LL | #[expect_print_expr] + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable + +error[E0658]: attributes on expressions are experimental. (see issue #15701) + --> $DIR/attr-stmt-expr.rs:23:5 + | +LL | #[expect_expr] + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui-fulldeps/attribute-order-restricted.rs b/src/test/ui/proc-macro/attribute-order-restricted.rs similarity index 100% rename from src/test/ui-fulldeps/attribute-order-restricted.rs rename to src/test/ui/proc-macro/attribute-order-restricted.rs diff --git a/src/test/ui-fulldeps/attribute-order-restricted.stderr b/src/test/ui/proc-macro/attribute-order-restricted.stderr similarity index 100% rename from src/test/ui-fulldeps/attribute-order-restricted.stderr rename to src/test/ui/proc-macro/attribute-order-restricted.stderr diff --git a/src/test/ui/proc-macro/attribute-spans-preserved.rs b/src/test/ui/proc-macro/attribute-spans-preserved.rs new file mode 100644 index 00000000000..c01fce90593 --- /dev/null +++ b/src/test/ui/proc-macro/attribute-spans-preserved.rs @@ -0,0 +1,10 @@ +// aux-build:attribute-spans-preserved.rs + +extern crate attribute_spans_preserved as foo; + +use foo::foo; + +#[ foo ( let y: u32 = "z"; ) ] //~ ERROR: mismatched types +#[ bar { let x: u32 = "y"; } ] //~ ERROR: mismatched types +fn main() { +} diff --git a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stderr b/src/test/ui/proc-macro/attribute-spans-preserved.stderr similarity index 86% rename from src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stderr rename to src/test/ui/proc-macro/attribute-spans-preserved.stderr index 329e5bea61c..8371088c4c2 100644 --- a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stderr +++ b/src/test/ui/proc-macro/attribute-spans-preserved.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/attribute-spans-preserved.rs:17:23 + --> $DIR/attribute-spans-preserved.rs:7:23 | LL | #[ foo ( let y: u32 = "z"; ) ] //~ ERROR: mismatched types | ^^^ expected u32, found reference @@ -8,7 +8,7 @@ LL | #[ foo ( let y: u32 = "z"; ) ] //~ ERROR: mismatched types found type `&'static str` error[E0308]: mismatched types - --> $DIR/attribute-spans-preserved.rs:18:23 + --> $DIR/attribute-spans-preserved.rs:8:23 | LL | #[ bar { let x: u32 = "y"; } ] //~ ERROR: mismatched types | ^^^ expected u32, found reference diff --git a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stdout b/src/test/ui/proc-macro/attribute-spans-preserved.stdout similarity index 100% rename from src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stdout rename to src/test/ui/proc-macro/attribute-spans-preserved.stdout diff --git a/src/test/ui/proc-macro/attribute-with-error.rs b/src/test/ui/proc-macro/attribute-with-error.rs new file mode 100644 index 00000000000..2cced40830a --- /dev/null +++ b/src/test/ui/proc-macro/attribute-with-error.rs @@ -0,0 +1,43 @@ +// aux-build:attribute-with-error.rs + +#![feature(custom_inner_attributes)] + +extern crate attribute_with_error; + +use attribute_with_error::foo; + +#[foo] +fn test1() { + let a: i32 = "foo"; + //~^ ERROR: mismatched types + let b: i32 = "f'oo"; + //~^ ERROR: mismatched types +} + +fn test2() { + #![foo] + + // FIXME: should have a type error here and assert it works but it doesn't +} + +trait A { + // FIXME: should have a #[foo] attribute here and assert that it works + fn foo(&self) { + let a: i32 = "foo"; + //~^ ERROR: mismatched types + } +} + +struct B; + +impl A for B { + #[foo] + fn foo(&self) { + let a: i32 = "foo"; + //~^ ERROR: mismatched types + } +} + +#[foo] +fn main() { +} diff --git a/src/test/ui/proc-macro/attribute-with-error.stderr b/src/test/ui/proc-macro/attribute-with-error.stderr new file mode 100644 index 00000000000..c5970ab6baa --- /dev/null +++ b/src/test/ui/proc-macro/attribute-with-error.stderr @@ -0,0 +1,39 @@ +error[E0308]: mismatched types + --> $DIR/attribute-with-error.rs:11:18 + | +LL | let a: i32 = "foo"; + | ^^^^^ expected i32, found reference + | + = note: expected type `i32` + found type `&'static str` + +error[E0308]: mismatched types + --> $DIR/attribute-with-error.rs:13:18 + | +LL | let b: i32 = "f'oo"; + | ^^^^^^ expected i32, found reference + | + = note: expected type `i32` + found type `&'static str` + +error[E0308]: mismatched types + --> $DIR/attribute-with-error.rs:26:22 + | +LL | let a: i32 = "foo"; + | ^^^^^ expected i32, found reference + | + = note: expected type `i32` + found type `&'static str` + +error[E0308]: mismatched types + --> $DIR/attribute-with-error.rs:36:22 + | +LL | let a: i32 = "foo"; + | ^^^^^ expected i32, found reference + | + = note: expected type `i32` + found type `&'static str` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/proc-macro/attribute.rs b/src/test/ui/proc-macro/attribute.rs new file mode 100644 index 00000000000..a0b982d75f5 --- /dev/null +++ b/src/test/ui/proc-macro/attribute.rs @@ -0,0 +1,56 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +#[proc_macro_derive] +//~^ ERROR: attribute must be of the form +pub fn foo1(input: proc_macro::TokenStream) -> proc_macro::TokenStream { + input +} + +#[proc_macro_derive = "foo"] +//~^ ERROR: attribute must be of the form +pub fn foo2(input: proc_macro::TokenStream) -> proc_macro::TokenStream { + input +} + +#[proc_macro_derive( + a = "b" +)] +//~^^ ERROR: must only be one word +pub fn foo3(input: proc_macro::TokenStream) -> proc_macro::TokenStream { + input +} + +#[proc_macro_derive(b, c, d)] +//~^ ERROR: attribute must have either one or two arguments +pub fn foo4(input: proc_macro::TokenStream) -> proc_macro::TokenStream { + input +} + +#[proc_macro_derive(d(e))] +//~^ ERROR: must only be one word +pub fn foo5(input: proc_macro::TokenStream) -> proc_macro::TokenStream { + input +} + +#[proc_macro_derive(f, attributes(g = "h"))] +//~^ ERROR: must only be one word +pub fn foo6(input: proc_macro::TokenStream) -> proc_macro::TokenStream { + input +} + +#[proc_macro_derive(i, attributes(j(k)))] +//~^ ERROR: must only be one word +pub fn foo7(input: proc_macro::TokenStream) -> proc_macro::TokenStream { + input +} + +#[proc_macro_derive(l, attributes(m), n)] +//~^ ERROR: attribute must have either one or two arguments +pub fn foo8(input: proc_macro::TokenStream) -> proc_macro::TokenStream { + input +} diff --git a/src/test/ui/proc-macro/attribute.stderr b/src/test/ui/proc-macro/attribute.stderr new file mode 100644 index 00000000000..231eb1f1068 --- /dev/null +++ b/src/test/ui/proc-macro/attribute.stderr @@ -0,0 +1,50 @@ +error: must only be one word + --> $DIR/attribute.rs:21:5 + | +LL | a = "b" + | ^^^^^^^ + +error: attribute must have either one or two arguments + --> $DIR/attribute.rs:28:1 + | +LL | #[proc_macro_derive(b, c, d)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: must only be one word + --> $DIR/attribute.rs:34:21 + | +LL | #[proc_macro_derive(d(e))] + | ^^^^ + +error: must only be one word + --> $DIR/attribute.rs:40:35 + | +LL | #[proc_macro_derive(f, attributes(g = "h"))] + | ^^^^^^^ + +error: must only be one word + --> $DIR/attribute.rs:46:35 + | +LL | #[proc_macro_derive(i, attributes(j(k)))] + | ^^^^ + +error: attribute must have either one or two arguments + --> $DIR/attribute.rs:52:1 + | +LL | #[proc_macro_derive(l, attributes(m), n)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]` + --> $DIR/attribute.rs:8:1 + | +LL | #[proc_macro_derive] + | ^^^^^^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]` + --> $DIR/attribute.rs:14:1 + | +LL | #[proc_macro_derive = "foo"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 8 previous errors + diff --git a/src/test/ui/proc-macro/attributes-included.rs b/src/test/ui/proc-macro/attributes-included.rs new file mode 100644 index 00000000000..0ab17a1f3b3 --- /dev/null +++ b/src/test/ui/proc-macro/attributes-included.rs @@ -0,0 +1,22 @@ +// aux-build:attributes-included.rs +// compile-pass + +#![warn(unused)] + +extern crate attributes_included; + +use attributes_included::*; + +#[bar] +#[inline] +/// doc +#[foo] +#[inline] +/// doc +fn foo() { + let a: i32 = "foo"; //~ WARN: unused variable +} + +fn main() { + foo() +} diff --git a/src/test/ui/proc-macro/attributes-included.stderr b/src/test/ui/proc-macro/attributes-included.stderr new file mode 100644 index 00000000000..87b6fb9539f --- /dev/null +++ b/src/test/ui/proc-macro/attributes-included.stderr @@ -0,0 +1,13 @@ +warning: unused variable: `a` + --> $DIR/attributes-included.rs:17:9 + | +LL | let a: i32 = "foo"; //~ WARN: unused variable + | ^ help: consider prefixing with an underscore: `_a` + | +note: lint level defined here + --> $DIR/attributes-included.rs:4:9 + | +LL | #![warn(unused)] + | ^^^^^^ + = note: #[warn(unused_variables)] implied by #[warn(unused)] + diff --git a/src/test/ui/proc-macro/auxiliary/attr-stmt-expr.rs b/src/test/ui/proc-macro/auxiliary/attr-stmt-expr.rs new file mode 100644 index 00000000000..0a82cbedd77 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/attr-stmt-expr.rs @@ -0,0 +1,49 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn expect_let(attr: TokenStream, item: TokenStream) -> TokenStream { + assert!(attr.to_string().is_empty()); + assert_eq!(item.to_string(), "let string = \"Hello, world!\";"); + item +} + +#[proc_macro_attribute] +pub fn expect_print_stmt(attr: TokenStream, item: TokenStream) -> TokenStream { + assert!(attr.to_string().is_empty()); + assert_eq!(item.to_string(), "println!(\"{}\" , string);"); + item +} + +#[proc_macro_attribute] +pub fn expect_expr(attr: TokenStream, item: TokenStream) -> TokenStream { + assert!(attr.to_string().is_empty()); + assert_eq!(item.to_string(), "print_str(\"string\")"); + item +} + +#[proc_macro_attribute] +pub fn expect_print_expr(attr: TokenStream, item: TokenStream) -> TokenStream { + assert!(attr.to_string().is_empty()); + assert_eq!(item.to_string(), "println!(\"{}\" , string)"); + item +} + +#[proc_macro_attribute] +pub fn duplicate(attr: TokenStream, item: TokenStream) -> TokenStream { + assert!(attr.to_string().is_empty()); + format!("{}, {}", item, item).parse().unwrap() +} + +#[proc_macro_attribute] +pub fn no_output(attr: TokenStream, item: TokenStream) -> TokenStream { + assert!(attr.to_string().is_empty()); + assert!(!item.to_string().is_empty()); + "".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs b/src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs new file mode 100644 index 00000000000..b1f54be6bac --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/attr_proc_macro.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn attr_proc_macro(_: TokenStream, input: TokenStream) -> TokenStream { + input +} diff --git a/src/test/ui/proc-macro/auxiliary/attribute-spans-preserved.rs b/src/test/ui/proc-macro/auxiliary/attribute-spans-preserved.rs new file mode 100644 index 00000000000..4d3279584c4 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/attribute-spans-preserved.rs @@ -0,0 +1,35 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro_attribute] +pub fn foo(attr: TokenStream, f: TokenStream) -> TokenStream { + let mut tokens = f.into_iter(); + assert_eq!(tokens.next().unwrap().to_string(), "#"); + let next_attr = match tokens.next().unwrap() { + TokenTree::Group(g) => g, + _ => panic!(), + }; + + let fn_tok = tokens.next().unwrap(); + let ident_tok = tokens.next().unwrap(); + let args_tok = tokens.next().unwrap(); + let body = tokens.next().unwrap(); + + let new_body = attr.into_iter() + .chain(next_attr.stream().into_iter().skip(1)); + + let tokens = vec![ + fn_tok, + ident_tok, + args_tok, + Group::new(Delimiter::Brace, new_body.collect()).into(), + ].into_iter().collect::(); + println!("{}", tokens); + return tokens +} diff --git a/src/test/ui/proc-macro/auxiliary/attribute-with-error.rs b/src/test/ui/proc-macro/auxiliary/attribute-with-error.rs new file mode 100644 index 00000000000..c073be00310 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/attribute-with-error.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn foo(_attr: TokenStream, input: TokenStream) -> TokenStream { + input.into_iter().collect() +} diff --git a/src/test/ui/proc-macro/auxiliary/attributes-included.rs b/src/test/ui/proc-macro/auxiliary/attributes-included.rs new file mode 100644 index 00000000000..a5eb40b28dc --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/attributes-included.rs @@ -0,0 +1,150 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::{TokenStream, TokenTree, Delimiter, Literal, Spacing, Group}; + +#[proc_macro_attribute] +pub fn foo(attr: TokenStream, input: TokenStream) -> TokenStream { + assert!(attr.is_empty()); + let input = input.into_iter().collect::>(); + { + let mut cursor = &input[..]; + assert_inline(&mut cursor); + assert_doc(&mut cursor); + assert_inline(&mut cursor); + assert_doc(&mut cursor); + assert_foo(&mut cursor); + assert!(cursor.is_empty()); + } + fold_stream(input.into_iter().collect()) +} + +#[proc_macro_attribute] +pub fn bar(attr: TokenStream, input: TokenStream) -> TokenStream { + assert!(attr.is_empty()); + let input = input.into_iter().collect::>(); + { + let mut cursor = &input[..]; + assert_inline(&mut cursor); + assert_doc(&mut cursor); + assert_invoc(&mut cursor); + assert_inline(&mut cursor); + assert_doc(&mut cursor); + assert_foo(&mut cursor); + assert!(cursor.is_empty()); + } + input.into_iter().collect() +} + +fn assert_inline(slice: &mut &[TokenTree]) { + match &slice[0] { + TokenTree::Punct(tt) => assert_eq!(tt.as_char(), '#'), + _ => panic!("expected '#' char"), + } + match &slice[1] { + TokenTree::Group(tt) => assert_eq!(tt.delimiter(), Delimiter::Bracket), + _ => panic!("expected brackets"), + } + *slice = &slice[2..]; +} + +fn assert_doc(slice: &mut &[TokenTree]) { + match &slice[0] { + TokenTree::Punct(tt) => { + assert_eq!(tt.as_char(), '#'); + assert_eq!(tt.spacing(), Spacing::Alone); + } + _ => panic!("expected #"), + } + let inner = match &slice[1] { + TokenTree::Group(tt) => { + assert_eq!(tt.delimiter(), Delimiter::Bracket); + tt.stream() + } + _ => panic!("expected brackets"), + }; + let tokens = inner.into_iter().collect::>(); + let tokens = &tokens[..]; + + if tokens.len() != 3 { + panic!("expected three tokens in doc") + } + + match &tokens[0] { + TokenTree::Ident(tt) => assert_eq!("doc", &*tt.to_string()), + _ => panic!("expected `doc`"), + } + match &tokens[1] { + TokenTree::Punct(tt) => { + assert_eq!(tt.as_char(), '='); + assert_eq!(tt.spacing(), Spacing::Alone); + } + _ => panic!("expected equals"), + } + match tokens[2] { + TokenTree::Literal(_) => {} + _ => panic!("expected literal"), + } + + *slice = &slice[2..]; +} + +fn assert_invoc(slice: &mut &[TokenTree]) { + match &slice[0] { + TokenTree::Punct(tt) => assert_eq!(tt.as_char(), '#'), + _ => panic!("expected '#' char"), + } + match &slice[1] { + TokenTree::Group(tt) => assert_eq!(tt.delimiter(), Delimiter::Bracket), + _ => panic!("expected brackets"), + } + *slice = &slice[2..]; +} + +fn assert_foo(slice: &mut &[TokenTree]) { + match &slice[0] { + TokenTree::Ident(tt) => assert_eq!(&*tt.to_string(), "fn"), + _ => panic!("expected fn"), + } + match &slice[1] { + TokenTree::Ident(tt) => assert_eq!(&*tt.to_string(), "foo"), + _ => panic!("expected foo"), + } + match &slice[2] { + TokenTree::Group(tt) => { + assert_eq!(tt.delimiter(), Delimiter::Parenthesis); + assert!(tt.stream().is_empty()); + } + _ => panic!("expected parens"), + } + match &slice[3] { + TokenTree::Group(tt) => assert_eq!(tt.delimiter(), Delimiter::Brace), + _ => panic!("expected braces"), + } + *slice = &slice[4..]; +} + +fn fold_stream(input: TokenStream) -> TokenStream { + input.into_iter().map(fold_tree).collect() +} + +fn fold_tree(input: TokenTree) -> TokenTree { + match input { + TokenTree::Group(b) => { + TokenTree::Group(Group::new(b.delimiter(), fold_stream(b.stream()))) + } + TokenTree::Punct(b) => TokenTree::Punct(b), + TokenTree::Ident(a) => TokenTree::Ident(a), + TokenTree::Literal(a) => { + if a.to_string() != "\"foo\"" { + TokenTree::Literal(a) + } else { + TokenTree::Literal(Literal::i32_unsuffixed(3)) + } + } + } +} diff --git a/src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs b/src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs new file mode 100644 index 00000000000..16f3b764029 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/bang_proc_macro.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro] +pub fn bang_proc_macro(input: TokenStream) -> TokenStream { + input +} diff --git a/src/test/ui/proc-macro/auxiliary/bang_proc_macro2.rs b/src/test/ui/proc-macro/auxiliary/bang_proc_macro2.rs new file mode 100644 index 00000000000..fcaaba6023d --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/bang_proc_macro2.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro] +pub fn bang_proc_macro2(_: TokenStream) -> TokenStream { + "let x = foobar2;".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/builtin-attrs.rs b/src/test/ui/proc-macro/auxiliary/builtin-attrs.rs new file mode 100644 index 00000000000..6edafae3985 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/builtin-attrs.rs @@ -0,0 +1,27 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::*; + +#[proc_macro_attribute] +pub fn feature(_: TokenStream, input: TokenStream) -> TokenStream { + input +} + +#[proc_macro_attribute] +pub fn repr(_: TokenStream, input: TokenStream) -> TokenStream { + input +} + +#[proc_macro_attribute] +pub fn test(_: TokenStream, input: TokenStream) -> TokenStream { + "struct Test;".parse().unwrap() +} + +#[proc_macro_attribute] +pub fn bench(_: TokenStream, input: TokenStream) -> TokenStream { + "struct Bench;".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/derive-a-b.rs b/src/test/ui/proc-macro/auxiliary/derive-a-b.rs new file mode 100644 index 00000000000..64d4e0f7b7a --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/derive-a-b.rs @@ -0,0 +1,17 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro_derive(A)] +pub fn derive_a(_: TokenStream) -> TokenStream { + "".parse().unwrap() +} + +#[proc_macro_derive(B)] +pub fn derive_b(_: TokenStream) -> TokenStream { + "".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/derive-a.rs b/src/test/ui/proc-macro/auxiliary/derive-a.rs new file mode 100644 index 00000000000..c9d94aba9f7 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/derive-a.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(A)] +pub fn derive_a(input: TokenStream) -> TokenStream { + "".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/derive-b.rs b/src/test/ui/proc-macro/auxiliary/derive-b.rs new file mode 100644 index 00000000000..e7ab6c0729f --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/derive-b.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(B, attributes(B))] +pub fn derive_b(input: TokenStream) -> TokenStream { + "".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/derive-bad.rs b/src/test/ui/proc-macro/auxiliary/derive-bad.rs new file mode 100644 index 00000000000..468410972fb --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/derive-bad.rs @@ -0,0 +1,14 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(A)] +pub fn derive_a(_input: TokenStream) -> TokenStream { + "struct A { inner }".parse().unwrap() +} + diff --git a/src/test/ui/proc-macro/auxiliary/derive-clona.rs b/src/test/ui/proc-macro/auxiliary/derive-clona.rs new file mode 100644 index 00000000000..4a35c9d0dbb --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/derive-clona.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Clona)] +pub fn derive_clonea(input: TokenStream) -> TokenStream { + "".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/derive-foo.rs b/src/test/ui/proc-macro/auxiliary/derive-foo.rs new file mode 100644 index 00000000000..3ea027d4f53 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/derive-foo.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(FooWithLongName)] +pub fn derive_foo(input: TokenStream) -> TokenStream { + "".parse().unwrap() +} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowed-2.rs b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed-2.rs similarity index 100% rename from src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowed-2.rs rename to src/test/ui/proc-macro/auxiliary/derive-helper-shadowed-2.rs diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowed.rs b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs similarity index 93% rename from src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowed.rs rename to src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs index 4e701710f42..5b5243dd60e 100644 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/derive-helper-shadowed.rs +++ b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowed.rs @@ -1,3 +1,4 @@ +// force-host // no-prefer-dynamic #![crate_type = "proc-macro"] diff --git a/src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs new file mode 100644 index 00000000000..6e0bdcba9c5 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs @@ -0,0 +1,17 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::*; + +#[proc_macro_attribute] +pub fn my_attr(_: TokenStream, input: TokenStream) -> TokenStream { + input +} + +#[proc_macro_derive(MyTrait, attributes(my_attr))] +pub fn derive(input: TokenStream) -> TokenStream { + TokenStream::new() +} diff --git a/src/test/ui/proc-macro/auxiliary/derive-panic.rs b/src/test/ui/proc-macro/auxiliary/derive-panic.rs new file mode 100644 index 00000000000..e2afa7affa3 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/derive-panic.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(A)] +pub fn derive_a(_input: TokenStream) -> TokenStream { + panic!("nope!"); +} diff --git a/src/test/ui/proc-macro/auxiliary/derive-unstable-2.rs b/src/test/ui/proc-macro/auxiliary/derive-unstable-2.rs new file mode 100644 index 00000000000..eac21b04983 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/derive-unstable-2.rs @@ -0,0 +1,17 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Unstable)] +pub fn derive(_input: TokenStream) -> TokenStream { + + " + #[rustc_foo] + fn foo() {} + ".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/derive-unstable.rs b/src/test/ui/proc-macro/auxiliary/derive-unstable.rs new file mode 100644 index 00000000000..f702df66db1 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/derive-unstable.rs @@ -0,0 +1,14 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Unstable)] +pub fn derive(_input: TokenStream) -> TokenStream { + + "unsafe fn foo() -> u32 { ::std::intrinsics::init() }".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/dollar-crate-external.rs b/src/test/ui/proc-macro/auxiliary/dollar-crate-external.rs new file mode 100644 index 00000000000..8f15a2b975b --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/dollar-crate-external.rs @@ -0,0 +1,16 @@ +pub type S = u8; + +#[macro_export] +macro_rules! external { + () => { + dollar_crate::m! { + struct M($crate::S); + } + + #[dollar_crate::a] + struct A($crate::S); + + #[derive(dollar_crate::d)] + struct D($crate::S); + }; +} diff --git a/src/test/ui/proc-macro/auxiliary/dollar-crate.rs b/src/test/ui/proc-macro/auxiliary/dollar-crate.rs new file mode 100644 index 00000000000..c5347d2e81a --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/dollar-crate.rs @@ -0,0 +1,35 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro] +pub fn m_empty(input: TokenStream) -> TokenStream { + println!("PROC MACRO INPUT (PRETTY-PRINTED): {}", input); + println!("PROC MACRO INPUT: {:#?}", input); + TokenStream::new() +} + +#[proc_macro] +pub fn m(input: TokenStream) -> TokenStream { + println!("PROC MACRO INPUT (PRETTY-PRINTED): {}", input); + println!("PROC MACRO INPUT: {:#?}", input); + input.into_iter().collect() +} + +#[proc_macro_attribute] +pub fn a(_args: TokenStream, input: TokenStream) -> TokenStream { + println!("ATTRIBUTE INPUT (PRETTY-PRINTED): {}", input); + println!("ATTRIBUTE INPUT: {:#?}", input); + input.into_iter().collect() +} + +#[proc_macro_derive(d)] +pub fn d(input: TokenStream) -> TokenStream { + println!("DERIVE INPUT (PRETTY-PRINTED): {}", input); + println!("DERIVE INPUT: {:#?}", input); + input.into_iter().collect() +} diff --git a/src/test/ui/proc-macro/auxiliary/edition-imports-2015.rs b/src/test/ui/proc-macro/auxiliary/edition-imports-2015.rs new file mode 100644 index 00000000000..27c59b805e2 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/edition-imports-2015.rs @@ -0,0 +1,20 @@ +// edition:2015 +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Derive2015)] +pub fn derive_2015(_: TokenStream) -> TokenStream { + " + use import::Path; + + fn check_absolute() { + let x = ::absolute::Path; + } + ".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/generate-mod.rs b/src/test/ui/proc-macro/auxiliary/generate-mod.rs new file mode 100644 index 00000000000..8b41e8b3b3e --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/generate-mod.rs @@ -0,0 +1,57 @@ +// run-pass +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::*; + +#[proc_macro] +pub fn check(_: TokenStream) -> TokenStream { + " + type Alias = FromOutside; // OK + struct Outer; + mod inner { + type Alias = FromOutside; // `FromOutside` shouldn't be available from here + type Inner = Outer; // `Outer` shouldn't be available from here + } + ".parse().unwrap() +} + +#[proc_macro_attribute] +pub fn check_attr(_: TokenStream, _: TokenStream) -> TokenStream { + " + type AliasAttr = FromOutside; // OK + struct OuterAttr; + mod inner_attr { + type Alias = FromOutside; // `FromOutside` shouldn't be available from here + type Inner = OuterAttr; // `OuterAttr` shouldn't be available from here + } + ".parse().unwrap() +} + +#[proc_macro_derive(CheckDerive)] +pub fn check_derive(_: TokenStream) -> TokenStream { + " + type AliasDerive = FromOutside; // OK + struct OuterDerive; + mod inner_derive { + type Alias = FromOutside; // `FromOutside` shouldn't be available from here + type Inner = OuterDerive; // `OuterDerive` shouldn't be available from here + } + ".parse().unwrap() +} + +#[proc_macro_derive(CheckDeriveLint)] +pub fn check_derive_lint(_: TokenStream) -> TokenStream { + " + type AliasDeriveLint = FromOutside; // OK + struct OuterDeriveLint; + #[allow(proc_macro_derive_resolution_fallback)] + mod inner_derive_lint { + type Alias = FromOutside; // `FromOutside` shouldn't be available from here + type Inner = OuterDeriveLint; // `OuterDeriveLint` shouldn't be available from here + } + ".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/invalid-punct-ident.rs b/src/test/ui/proc-macro/auxiliary/invalid-punct-ident.rs new file mode 100644 index 00000000000..518dfd0d688 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/invalid-punct-ident.rs @@ -0,0 +1,28 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(proc_macro_raw_ident)] + +extern crate proc_macro; +use proc_macro::*; + +#[proc_macro] +pub fn invalid_punct(_: TokenStream) -> TokenStream { + TokenTree::from(Punct::new('`', Spacing::Alone)).into() +} + +#[proc_macro] +pub fn invalid_ident(_: TokenStream) -> TokenStream { + TokenTree::from(Ident::new("*", Span::call_site())).into() +} + +#[proc_macro] +pub fn invalid_raw_ident(_: TokenStream) -> TokenStream { + TokenTree::from(Ident::new_raw("self", Span::call_site())).into() +} + +#[proc_macro] +pub fn lexer_failure(_: TokenStream) -> TokenStream { + "a b ) c".parse().expect("parsing failed without panic") +} diff --git a/src/test/ui/proc-macro/auxiliary/issue-41211.rs b/src/test/ui/proc-macro/auxiliary/issue-41211.rs new file mode 100644 index 00000000000..db946e7f331 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/issue-41211.rs @@ -0,0 +1,12 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn emit_unchanged(_args: TokenStream, input: TokenStream) -> TokenStream { + input +} diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/issue-53481.rs b/src/test/ui/proc-macro/auxiliary/issue-53481.rs similarity index 93% rename from src/test/ui-fulldeps/proc-macro/auxiliary/issue-53481.rs rename to src/test/ui/proc-macro/auxiliary/issue-53481.rs index 9554cdde490..d9f290dec7e 100644 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/issue-53481.rs +++ b/src/test/ui/proc-macro/auxiliary/issue-53481.rs @@ -1,3 +1,4 @@ +// force-host // no-prefer-dynamic #![crate_type = "proc-macro"] diff --git a/src/test/ui/proc-macro/auxiliary/issue_38586.rs b/src/test/ui/proc-macro/auxiliary/issue_38586.rs new file mode 100644 index 00000000000..f3a19081c47 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/issue_38586.rs @@ -0,0 +1,11 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +#[proc_macro_derive(A)] +pub fn derive_a(_: proc_macro::TokenStream) -> proc_macro::TokenStream { + "fn f() { println!(\"{}\", foo); }".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/issue_50493.rs b/src/test/ui/proc-macro/auxiliary/issue_50493.rs new file mode 100644 index 00000000000..f72024948a9 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/issue_50493.rs @@ -0,0 +1,21 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro_derive(Derive)] +pub fn derive(_: TokenStream) -> TokenStream { + let code = " + fn one(r: Restricted) { + r.field; + } + fn two(r: Restricted) { + r.field; + } + "; + + code.parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/lifetimes.rs b/src/test/ui/proc-macro/auxiliary/lifetimes.rs new file mode 100644 index 00000000000..212164dd2c9 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/lifetimes.rs @@ -0,0 +1,20 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro] +pub fn single_quote_alone(_: TokenStream) -> TokenStream { + // `&'a u8`, but the `'` token is not joint + let trees: Vec = vec![ + Punct::new('&', Spacing::Alone).into(), + Punct::new('\'', Spacing::Alone).into(), + Ident::new("a", Span::call_site()).into(), + Ident::new("u8", Span::call_site()).into(), + ]; + trees.into_iter().collect() +} diff --git a/src/test/ui/proc-macro/auxiliary/macro-brackets.rs b/src/test/ui/proc-macro/auxiliary/macro-brackets.rs new file mode 100644 index 00000000000..f2c62ab1b5e --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/macro-brackets.rs @@ -0,0 +1,12 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::*; + +#[proc_macro_attribute] +pub fn doit(_: TokenStream, input: TokenStream) -> TokenStream { + input.into_iter().collect() +} diff --git a/src/test/ui/proc-macro/auxiliary/more-gates.rs b/src/test/ui/proc-macro/auxiliary/more-gates.rs new file mode 100644 index 00000000000..6b609eaee12 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/more-gates.rs @@ -0,0 +1,35 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro_attribute] +pub fn attr2mac1(_: TokenStream, _: TokenStream) -> TokenStream { + "macro_rules! foo1 { (a) => (a) }".parse().unwrap() +} + +#[proc_macro_attribute] +pub fn attr2mac2(_: TokenStream, _: TokenStream) -> TokenStream { + "macro foo2(a) { a }".parse().unwrap() +} + +#[proc_macro] +pub fn mac2mac1(_: TokenStream) -> TokenStream { + "macro_rules! foo3 { (a) => (a) }".parse().unwrap() +} + +#[proc_macro] +pub fn mac2mac2(_: TokenStream) -> TokenStream { + "macro foo4(a) { a }".parse().unwrap() +} + +#[proc_macro] +pub fn tricky(_: TokenStream) -> TokenStream { + "fn foo() { + macro_rules! foo { (a) => (a) } + }".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/multispan.rs b/src/test/ui/proc-macro/auxiliary/multispan.rs new file mode 100644 index 00000000000..c05d15643db --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/multispan.rs @@ -0,0 +1,37 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(proc_macro_diagnostic, proc_macro_span, proc_macro_def_site)] + +extern crate proc_macro; + +use proc_macro::{TokenStream, TokenTree, Span, Diagnostic}; + +fn parse(input: TokenStream) -> Result<(), Diagnostic> { + let mut hi_spans = vec![]; + for tree in input { + if let TokenTree::Ident(ref ident) = tree { + if ident.to_string() == "hi" { + hi_spans.push(ident.span()); + } + } + } + + if !hi_spans.is_empty() { + return Err(Span::def_site() + .error("hello to you, too!") + .span_note(hi_spans, "found these 'hi's")); + } + + Ok(()) +} + +#[proc_macro] +pub fn hello(input: TokenStream) -> TokenStream { + if let Err(diag) = parse(input) { + diag.emit(); + } + + TokenStream::new() +} diff --git a/src/test/ui/proc-macro/auxiliary/nested-item-spans.rs b/src/test/ui/proc-macro/auxiliary/nested-item-spans.rs new file mode 100644 index 00000000000..8f720b4574d --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/nested-item-spans.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro_attribute] +pub fn foo(_: TokenStream, item: TokenStream) -> TokenStream { + item.into_iter().collect() +} diff --git a/src/test/ui/proc-macro/auxiliary/parent-source-spans.rs b/src/test/ui/proc-macro/auxiliary/parent-source-spans.rs new file mode 100644 index 00000000000..594f1088332 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/parent-source-spans.rs @@ -0,0 +1,43 @@ +// force-host +// no-prefer-dynamic + +#![feature(proc_macro_diagnostic, proc_macro_span)] +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::{TokenStream, TokenTree, Span}; + +fn lit_span(tt: TokenTree) -> (Span, String) { + match tt { + TokenTree::Literal(..) | + TokenTree::Group(..) => (tt.span(), tt.to_string().trim().into()), + _ => panic!("expected a literal in token tree, got: {:?}", tt) + } +} + +#[proc_macro] +pub fn parent_source_spans(input: TokenStream) -> TokenStream { + let mut tokens = input.into_iter(); + let (sp1, str1) = lit_span(tokens.next().expect("first string")); + let _ = tokens.next(); + let (sp2, str2) = lit_span(tokens.next().expect("second string")); + + sp1.error(format!("first final: {}", str1)).emit(); + sp2.error(format!("second final: {}", str2)).emit(); + + if let (Some(p1), Some(p2)) = (sp1.parent(), sp2.parent()) { + p1.error(format!("first parent: {}", str1)).emit(); + p2.error(format!("second parent: {}", str2)).emit(); + + if let (Some(gp1), Some(gp2)) = (p1.parent(), p2.parent()) { + gp1.error(format!("first grandparent: {}", str1)).emit(); + gp2.error(format!("second grandparent: {}", str2)).emit(); + } + } + + sp1.source().error(format!("first source: {}", str1)).emit(); + sp2.source().error(format!("second source: {}", str2)).emit(); + + "ok".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs b/src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs new file mode 100644 index 00000000000..c7c7167eca0 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/proc-macro-gates.rs @@ -0,0 +1,18 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro] +pub fn m(a: TokenStream) -> TokenStream { + a +} + +#[proc_macro_attribute] +pub fn a(_a: TokenStream, b: TokenStream) -> TokenStream { + b +} diff --git a/src/test/ui/proc-macro/auxiliary/span-preservation.rs b/src/test/ui/proc-macro/auxiliary/span-preservation.rs new file mode 100644 index 00000000000..33c7968104b --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/span-preservation.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn foo(_: TokenStream, input: TokenStream) -> TokenStream { + input.into_iter().collect() +} diff --git a/src/test/ui/proc-macro/auxiliary/subspan.rs b/src/test/ui/proc-macro/auxiliary/subspan.rs new file mode 100644 index 00000000000..f92adc04023 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/subspan.rs @@ -0,0 +1,38 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(proc_macro_diagnostic, proc_macro_span)] + +extern crate proc_macro; + +use proc_macro::{TokenStream, TokenTree, Span, Diagnostic}; + +fn parse(input: TokenStream) -> Result<(), Diagnostic> { + if let Some(TokenTree::Literal(lit)) = input.into_iter().next() { + let mut spans = vec![]; + let string = lit.to_string(); + for hi in string.matches("hi") { + let index = hi.as_ptr() as usize - string.as_ptr() as usize; + let subspan = lit.subspan(index..(index + hi.len())).unwrap(); + spans.push(subspan); + } + + if !spans.is_empty() { + Err(Span::call_site().error("found 'hi's").span_note(spans, "here")) + } else { + Ok(()) + } + } else { + Err(Span::call_site().error("invalid input: expected string literal")) + } +} + +#[proc_macro] +pub fn subspan(input: TokenStream) -> TokenStream { + if let Err(diag) = parse(input) { + diag.emit(); + } + + TokenStream::new() +} diff --git a/src/test/ui/proc-macro/auxiliary/test-macros.rs b/src/test/ui/proc-macro/auxiliary/test-macros.rs new file mode 100644 index 00000000000..15fe3804f9b --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/test-macros.rs @@ -0,0 +1,26 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_attribute] +pub fn nop_attr(_attr: TokenStream, input: TokenStream) -> TokenStream { + assert!(_attr.to_string().is_empty()); + input +} + +#[proc_macro_attribute] +pub fn no_output(_attr: TokenStream, _input: TokenStream) -> TokenStream { + assert!(_attr.to_string().is_empty()); + assert!(!_input.to_string().is_empty()); + "".parse().unwrap() +} + +#[proc_macro] +pub fn emit_input(input: TokenStream) -> TokenStream { + input +} diff --git a/src/test/ui/proc-macro/auxiliary/three-equals.rs b/src/test/ui/proc-macro/auxiliary/three-equals.rs new file mode 100644 index 00000000000..e740e86e5d0 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/three-equals.rs @@ -0,0 +1,49 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![feature(proc_macro_diagnostic, proc_macro_span, proc_macro_def_site)] + +extern crate proc_macro; + +use proc_macro::{TokenStream, TokenTree, Span, Diagnostic}; + +fn parse(input: TokenStream) -> Result<(), Diagnostic> { + let mut count = 0; + let mut last_span = Span::def_site(); + for tree in input { + let span = tree.span(); + if count >= 3 { + return Err(span.error(format!("expected EOF, found `{}`.", tree)) + .span_note(last_span, "last good input was here") + .help("input must be: `===`")) + } + + if let TokenTree::Punct(ref tt) = tree { + if tt.as_char() == '=' { + count += 1; + last_span = span; + continue + } + } + return Err(span.error(format!("expected `=`, found `{}`.", tree))); + } + + if count < 3 { + return Err(Span::def_site() + .error(format!("found {} equal signs, need exactly 3", count)) + .help("input must be: `===`")) + } + + Ok(()) +} + +#[proc_macro] +pub fn three_equals(input: TokenStream) -> TokenStream { + if let Err(diag) = parse(input) { + diag.emit(); + return TokenStream::new(); + } + + "3".parse().unwrap() +} diff --git a/src/test/ui/proc-macro/define-two.rs b/src/test/ui/proc-macro/define-two.rs new file mode 100644 index 00000000000..b2184eae33e --- /dev/null +++ b/src/test/ui/proc-macro/define-two.rs @@ -0,0 +1,18 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(A)] +pub fn foo(input: TokenStream) -> TokenStream { + input +} + +#[proc_macro_derive(A)] //~ ERROR the name `A` is defined multiple times +pub fn bar(input: TokenStream) -> TokenStream { + input +} diff --git a/src/test/ui/proc-macro/define-two.stderr b/src/test/ui/proc-macro/define-two.stderr new file mode 100644 index 00000000000..c74215f415e --- /dev/null +++ b/src/test/ui/proc-macro/define-two.stderr @@ -0,0 +1,14 @@ +error[E0428]: the name `A` is defined multiple times + --> $DIR/define-two.rs:15:21 + | +LL | #[proc_macro_derive(A)] + | - previous definition of the macro `A` here +... +LL | #[proc_macro_derive(A)] //~ ERROR the name `A` is defined multiple times + | ^ `A` redefined here + | + = note: `A` must be defined only once in the macro namespace of this module + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0428`. diff --git a/src/test/ui/proc-macro/derive-bad.rs b/src/test/ui/proc-macro/derive-bad.rs new file mode 100644 index 00000000000..62c0741b669 --- /dev/null +++ b/src/test/ui/proc-macro/derive-bad.rs @@ -0,0 +1,13 @@ +// aux-build:derive-bad.rs + +#[macro_use] +extern crate derive_bad; + +#[derive( + A +)] +//~^^ ERROR proc-macro derive produced unparseable tokens +//~| ERROR expected `:`, found `}` +struct A; + +fn main() {} diff --git a/src/test/ui/proc-macro/derive-bad.stderr b/src/test/ui/proc-macro/derive-bad.stderr new file mode 100644 index 00000000000..93908150b6c --- /dev/null +++ b/src/test/ui/proc-macro/derive-bad.stderr @@ -0,0 +1,14 @@ +error: expected `:`, found `}` + --> $DIR/derive-bad.rs:7:5 + | +LL | A + | ^ expected `:` + +error: proc-macro derive produced unparseable tokens + --> $DIR/derive-bad.rs:7:5 + | +LL | A + | ^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui-fulldeps/proc-macro/derive-helper-shadowed.rs b/src/test/ui/proc-macro/derive-helper-shadowed.rs similarity index 100% rename from src/test/ui-fulldeps/proc-macro/derive-helper-shadowed.rs rename to src/test/ui/proc-macro/derive-helper-shadowed.rs diff --git a/src/test/ui/proc-macro/derive-helper-shadowing.rs b/src/test/ui/proc-macro/derive-helper-shadowing.rs new file mode 100644 index 00000000000..f6fe9f9fd8b --- /dev/null +++ b/src/test/ui/proc-macro/derive-helper-shadowing.rs @@ -0,0 +1,30 @@ +// aux-build:derive-helper-shadowing.rs + +extern crate derive_helper_shadowing; +use derive_helper_shadowing::*; + +#[my_attr] //~ ERROR `my_attr` is ambiguous +#[derive(MyTrait)] +struct S { + // FIXME No ambiguity, attributes in non-macro positions are not resolved properly + #[my_attr] + field: [u8; { + // FIXME No ambiguity, derive helpers are not put into scope for non-attributes + use my_attr; + + // FIXME No ambiguity, derive helpers are not put into scope for inner items + #[my_attr] + struct U; + + mod inner { + #[my_attr] //~ ERROR attribute `my_attr` is currently unknown + struct V; + } + + 0 + }] +} + +fn main() { + let s = S { field: [] }; +} diff --git a/src/test/ui/proc-macro/derive-helper-shadowing.stderr b/src/test/ui/proc-macro/derive-helper-shadowing.stderr new file mode 100644 index 00000000000..8180c84d3f6 --- /dev/null +++ b/src/test/ui/proc-macro/derive-helper-shadowing.stderr @@ -0,0 +1,30 @@ +error[E0658]: The attribute `my_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/derive-helper-shadowing.rs:20:15 + | +LL | #[my_attr] //~ ERROR attribute `my_attr` is currently unknown + | ^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error[E0659]: `my_attr` is ambiguous (derive helper attribute vs any other name) + --> $DIR/derive-helper-shadowing.rs:6:3 + | +LL | #[my_attr] //~ ERROR `my_attr` is ambiguous + | ^^^^^^^ ambiguous name + | +note: `my_attr` could refer to the derive helper attribute defined here + --> $DIR/derive-helper-shadowing.rs:7:10 + | +LL | #[derive(MyTrait)] + | ^^^^^^^ +note: `my_attr` could also refer to the attribute macro imported here + --> $DIR/derive-helper-shadowing.rs:4:5 + | +LL | use derive_helper_shadowing::*; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: use `crate::my_attr` to refer to this attribute macro unambiguously + +error: aborting due to 2 previous errors + +Some errors occurred: E0658, E0659. +For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/derive-still-gated.rs b/src/test/ui/proc-macro/derive-still-gated.rs new file mode 100644 index 00000000000..526eff39891 --- /dev/null +++ b/src/test/ui/proc-macro/derive-still-gated.rs @@ -0,0 +1,11 @@ +// aux-build:derive-a.rs + +#![allow(warnings)] + +#[macro_use] +extern crate derive_a; + +#[derive_A] //~ ERROR attribute `derive_A` is currently unknown +struct A; + +fn main() {} diff --git a/src/test/ui/proc-macro/derive-still-gated.stderr b/src/test/ui/proc-macro/derive-still-gated.stderr new file mode 100644 index 00000000000..ece1b621291 --- /dev/null +++ b/src/test/ui/proc-macro/derive-still-gated.stderr @@ -0,0 +1,11 @@ +error[E0658]: The attribute `derive_A` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/derive-still-gated.rs:8:3 + | +LL | #[derive_A] //~ ERROR attribute `derive_A` is currently unknown + | ^^^^^^^^ help: a built-in attribute with a similar name exists: `derive` + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/dollar-crate-issue-57089.rs b/src/test/ui/proc-macro/dollar-crate-issue-57089.rs new file mode 100644 index 00000000000..2d54c07ff95 --- /dev/null +++ b/src/test/ui/proc-macro/dollar-crate-issue-57089.rs @@ -0,0 +1,26 @@ +// compile-pass +// edition:2018 +// aux-build:dollar-crate.rs + +// Anonymize unstable non-dummy spans while still showing dummy spans `0..0`. +// normalize-stdout-test "bytes\([^0]\w*\.\.(\w+)\)" -> "bytes(LO..$1)" +// normalize-stdout-test "bytes\((\w+)\.\.[^0]\w*\)" -> "bytes($1..HI)" + +extern crate dollar_crate; + +type S = u8; + +macro_rules! m { + () => { + dollar_crate::m_empty! { + struct M($crate::S); + } + + #[dollar_crate::a] + struct A($crate::S); + }; +} + +m!(); + +fn main() {} diff --git a/src/test/ui/proc-macro/dollar-crate-issue-57089.stdout b/src/test/ui/proc-macro/dollar-crate-issue-57089.stdout new file mode 100644 index 00000000000..09340988c89 --- /dev/null +++ b/src/test/ui/proc-macro/dollar-crate-issue-57089.stdout @@ -0,0 +1,80 @@ +PROC MACRO INPUT (PRETTY-PRINTED): struct M ( $crate :: S ) ; +PROC MACRO INPUT: TokenStream [ + Ident { + ident: "struct", + span: #2 bytes(LO..HI) + }, + Ident { + ident: "M", + span: #2 bytes(LO..HI) + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "$crate", + span: #2 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Joint, + span: #2 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Alone, + span: #2 bytes(LO..HI) + }, + Ident { + ident: "S", + span: #2 bytes(LO..HI) + } + ], + span: #2 bytes(LO..HI) + }, + Punct { + ch: ';', + spacing: Alone, + span: #2 bytes(LO..HI) + } +] +ATTRIBUTE INPUT (PRETTY-PRINTED): struct A(crate::S); +ATTRIBUTE INPUT: TokenStream [ + Ident { + ident: "struct", + span: #2 bytes(LO..HI) + }, + Ident { + ident: "A", + span: #2 bytes(LO..HI) + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "$crate", + span: #2 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Joint, + span: #2 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Alone, + span: #2 bytes(LO..HI) + }, + Ident { + ident: "S", + span: #2 bytes(LO..HI) + } + ], + span: #2 bytes(LO..HI) + }, + Punct { + ch: ';', + spacing: Alone, + span: #2 bytes(LO..HI) + } +] diff --git a/src/test/ui/proc-macro/dollar-crate.rs b/src/test/ui/proc-macro/dollar-crate.rs new file mode 100644 index 00000000000..1460e9a3b2d --- /dev/null +++ b/src/test/ui/proc-macro/dollar-crate.rs @@ -0,0 +1,40 @@ +// edition:2018 +// aux-build:dollar-crate.rs +// aux-build:dollar-crate-external.rs + +// Anonymize unstable non-dummy spans while still showing dummy spans `0..0`. +// normalize-stdout-test "bytes\([^0]\w*\.\.(\w+)\)" -> "bytes(LO..$1)" +// normalize-stdout-test "bytes\((\w+)\.\.[^0]\w*\)" -> "bytes($1..HI)" + +extern crate dollar_crate; +extern crate dollar_crate_external; + +type S = u8; + +mod local { + use crate::dollar_crate; + + macro_rules! local { + () => { + dollar_crate::m! { + struct M($crate::S); + } + + #[dollar_crate::a] + struct A($crate::S); + + #[derive(dollar_crate::d)] + struct D($crate::S); //~ ERROR the name `D` is defined multiple times + }; + } + + local!(); +} + +mod external { + use crate::dollar_crate_external; + + dollar_crate_external::external!(); //~ ERROR the name `D` is defined multiple times +} + +fn main() {} diff --git a/src/test/ui/proc-macro/dollar-crate.stderr b/src/test/ui/proc-macro/dollar-crate.stderr new file mode 100644 index 00000000000..08de3c7d1a6 --- /dev/null +++ b/src/test/ui/proc-macro/dollar-crate.stderr @@ -0,0 +1,29 @@ +error[E0428]: the name `D` is defined multiple times + --> $DIR/dollar-crate.rs:27:13 + | +LL | struct D($crate::S); //~ ERROR the name `D` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^ + | | + | `D` redefined here + | previous definition of the type `D` here +... +LL | local!(); + | --------- in this macro invocation + | + = note: `D` must be defined only once in the type namespace of this module + +error[E0428]: the name `D` is defined multiple times + --> $DIR/dollar-crate.rs:37:5 + | +LL | dollar_crate_external::external!(); //~ ERROR the name `D` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | `D` redefined here + | previous definition of the type `D` here + | + = note: `D` must be defined only once in the type namespace of this module + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0428`. diff --git a/src/test/ui/proc-macro/dollar-crate.stdout b/src/test/ui/proc-macro/dollar-crate.stdout new file mode 100644 index 00000000000..c47b3603f41 --- /dev/null +++ b/src/test/ui/proc-macro/dollar-crate.stdout @@ -0,0 +1,240 @@ +PROC MACRO INPUT (PRETTY-PRINTED): struct M ( $crate :: S ) ; +PROC MACRO INPUT: TokenStream [ + Ident { + ident: "struct", + span: #2 bytes(LO..HI) + }, + Ident { + ident: "M", + span: #2 bytes(LO..HI) + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "$crate", + span: #2 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Joint, + span: #2 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Alone, + span: #2 bytes(LO..HI) + }, + Ident { + ident: "S", + span: #2 bytes(LO..HI) + } + ], + span: #2 bytes(LO..HI) + }, + Punct { + ch: ';', + spacing: Alone, + span: #2 bytes(LO..HI) + } +] +ATTRIBUTE INPUT (PRETTY-PRINTED): struct A(crate::S); +ATTRIBUTE INPUT: TokenStream [ + Ident { + ident: "struct", + span: #2 bytes(LO..HI) + }, + Ident { + ident: "A", + span: #2 bytes(LO..HI) + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "$crate", + span: #2 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Joint, + span: #2 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Alone, + span: #2 bytes(LO..HI) + }, + Ident { + ident: "S", + span: #2 bytes(LO..HI) + } + ], + span: #2 bytes(LO..HI) + }, + Punct { + ch: ';', + spacing: Alone, + span: #2 bytes(LO..HI) + } +] +DERIVE INPUT (PRETTY-PRINTED): struct D(crate::S); +DERIVE INPUT: TokenStream [ + Ident { + ident: "struct", + span: #2 bytes(LO..HI) + }, + Ident { + ident: "D", + span: #2 bytes(LO..HI) + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "$crate", + span: #2 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Joint, + span: #2 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Alone, + span: #2 bytes(LO..HI) + }, + Ident { + ident: "S", + span: #2 bytes(LO..HI) + } + ], + span: #2 bytes(LO..HI) + }, + Punct { + ch: ';', + spacing: Alone, + span: #2 bytes(LO..HI) + } +] +PROC MACRO INPUT (PRETTY-PRINTED): struct M ( $crate :: S ) ; +PROC MACRO INPUT: TokenStream [ + Ident { + ident: "struct", + span: #10 bytes(LO..HI) + }, + Ident { + ident: "M", + span: #10 bytes(LO..HI) + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "$crate", + span: #10 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Joint, + span: #10 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Alone, + span: #10 bytes(LO..HI) + }, + Ident { + ident: "S", + span: #10 bytes(LO..HI) + } + ], + span: #10 bytes(LO..HI) + }, + Punct { + ch: ';', + spacing: Alone, + span: #10 bytes(LO..HI) + } +] +ATTRIBUTE INPUT (PRETTY-PRINTED): struct A(::dollar_crate_external::S); +ATTRIBUTE INPUT: TokenStream [ + Ident { + ident: "struct", + span: #10 bytes(LO..HI) + }, + Ident { + ident: "A", + span: #10 bytes(LO..HI) + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "$crate", + span: #10 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Joint, + span: #10 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Alone, + span: #10 bytes(LO..HI) + }, + Ident { + ident: "S", + span: #10 bytes(LO..HI) + } + ], + span: #10 bytes(LO..HI) + }, + Punct { + ch: ';', + spacing: Alone, + span: #10 bytes(LO..HI) + } +] +DERIVE INPUT (PRETTY-PRINTED): struct D(::dollar_crate_external::S); +DERIVE INPUT: TokenStream [ + Ident { + ident: "struct", + span: #10 bytes(LO..HI) + }, + Ident { + ident: "D", + span: #10 bytes(LO..HI) + }, + Group { + delimiter: Parenthesis, + stream: TokenStream [ + Ident { + ident: "$crate", + span: #10 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Joint, + span: #10 bytes(LO..HI) + }, + Punct { + ch: ':', + spacing: Alone, + span: #10 bytes(LO..HI) + }, + Ident { + ident: "S", + span: #10 bytes(LO..HI) + } + ], + span: #10 bytes(LO..HI) + }, + Punct { + ch: ';', + spacing: Alone, + span: #10 bytes(LO..HI) + } +] diff --git a/src/test/ui/proc-macro/edition-imports-2018.rs b/src/test/ui/proc-macro/edition-imports-2018.rs new file mode 100644 index 00000000000..f8d6bc5e078 --- /dev/null +++ b/src/test/ui/proc-macro/edition-imports-2018.rs @@ -0,0 +1,24 @@ +// compile-pass +// edition:2018 +// aux-build:edition-imports-2015.rs + +#[macro_use] +extern crate edition_imports_2015; + +mod import { + pub struct Path; +} +mod absolute { + pub struct Path; +} + +mod check { + #[derive(Derive2015)] // OK + struct S; + + fn check() { + Path; + } +} + +fn main() {} diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.rs b/src/test/ui/proc-macro/expand-to-unstable-2.rs new file mode 100644 index 00000000000..4b4ba52ecd7 --- /dev/null +++ b/src/test/ui/proc-macro/expand-to-unstable-2.rs @@ -0,0 +1,14 @@ +// aux-build:derive-unstable-2.rs + +#![allow(warnings)] + +#[macro_use] +extern crate derive_unstable_2; + +#[derive(Unstable)] +//~^ ERROR: reserved for internal compiler +struct A; + +fn main() { + foo(); +} diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.stderr b/src/test/ui/proc-macro/expand-to-unstable-2.stderr new file mode 100644 index 00000000000..b322f8e9d56 --- /dev/null +++ b/src/test/ui/proc-macro/expand-to-unstable-2.stderr @@ -0,0 +1,11 @@ +error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642) + --> $DIR/expand-to-unstable-2.rs:8:10 + | +LL | #[derive(Unstable)] + | ^^^^^^^^ + | + = help: add #![feature(rustc_attrs)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/expand-to-unstable.rs b/src/test/ui/proc-macro/expand-to-unstable.rs new file mode 100644 index 00000000000..0825c1a8ecb --- /dev/null +++ b/src/test/ui/proc-macro/expand-to-unstable.rs @@ -0,0 +1,14 @@ +// aux-build:derive-unstable.rs + +#![allow(warnings)] + +#[macro_use] +extern crate derive_unstable; + +#[derive(Unstable)] +//~^ ERROR: use of unstable library feature +struct A; + +fn main() { + unsafe { foo(); } +} diff --git a/src/test/ui/proc-macro/expand-to-unstable.stderr b/src/test/ui/proc-macro/expand-to-unstable.stderr new file mode 100644 index 00000000000..29a1287955a --- /dev/null +++ b/src/test/ui/proc-macro/expand-to-unstable.stderr @@ -0,0 +1,11 @@ +error[E0658]: use of unstable library feature 'core_intrinsics': intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library + --> $DIR/expand-to-unstable.rs:8:10 + | +LL | #[derive(Unstable)] + | ^^^^^^^^ + | + = help: add #![feature(core_intrinsics)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/export-macro.rs b/src/test/ui/proc-macro/export-macro.rs new file mode 100644 index 00000000000..ad69fe5eed2 --- /dev/null +++ b/src/test/ui/proc-macro/export-macro.rs @@ -0,0 +1,11 @@ +// error-pattern: cannot export macro_rules! macros from a `proc-macro` crate + +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +#[macro_export] +macro_rules! foo { + ($e:expr) => ($e) +} diff --git a/src/test/ui/proc-macro/export-macro.stderr b/src/test/ui/proc-macro/export-macro.stderr new file mode 100644 index 00000000000..bc64caa07f9 --- /dev/null +++ b/src/test/ui/proc-macro/export-macro.stderr @@ -0,0 +1,10 @@ +error: cannot export macro_rules! macros from a `proc-macro` crate type currently + --> $DIR/export-macro.rs:9:1 + | +LL | / macro_rules! foo { +LL | | ($e:expr) => ($e) +LL | | } + | |_^ + +error: aborting due to previous error + diff --git a/src/test/ui/proc-macro/exports.rs b/src/test/ui/proc-macro/exports.rs new file mode 100644 index 00000000000..a40c15908bc --- /dev/null +++ b/src/test/ui/proc-macro/exports.rs @@ -0,0 +1,15 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![allow(warnings)] + +pub fn a() {} //~ ERROR: cannot export any items +pub struct B; //~ ERROR: cannot export any items +pub enum C {} //~ ERROR: cannot export any items +pub mod d {} //~ ERROR: cannot export any items + +mod e {} +struct F; +enum G {} +fn h() {} diff --git a/src/test/ui/proc-macro/exports.stderr b/src/test/ui/proc-macro/exports.stderr new file mode 100644 index 00000000000..6cf5c63d2da --- /dev/null +++ b/src/test/ui/proc-macro/exports.stderr @@ -0,0 +1,26 @@ +error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently + --> $DIR/exports.rs:7:1 + | +LL | pub fn a() {} //~ ERROR: cannot export any items + | ^^^^^^^^^^^^^ + +error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently + --> $DIR/exports.rs:8:1 + | +LL | pub struct B; //~ ERROR: cannot export any items + | ^^^^^^^^^^^^^ + +error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently + --> $DIR/exports.rs:9:1 + | +LL | pub enum C {} //~ ERROR: cannot export any items + | ^^^^^^^^^^^^^ + +error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently + --> $DIR/exports.rs:10:1 + | +LL | pub mod d {} //~ ERROR: cannot export any items + | ^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui-fulldeps/proc-macro/extern-prelude-extern-crate-proc-macro.rs b/src/test/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs similarity index 100% rename from src/test/ui-fulldeps/proc-macro/extern-prelude-extern-crate-proc-macro.rs rename to src/test/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs diff --git a/src/test/ui/proc-macro/generate-mod.rs b/src/test/ui/proc-macro/generate-mod.rs new file mode 100644 index 00000000000..e5f967416c9 --- /dev/null +++ b/src/test/ui/proc-macro/generate-mod.rs @@ -0,0 +1,33 @@ +// Modules generated by transparent proc macros still acts as barriers for names (issue #50504). + +// aux-build:generate-mod.rs + +extern crate generate_mod; + +struct FromOutside; + +generate_mod::check!(); //~ ERROR cannot find type `FromOutside` in this scope + //~| ERROR cannot find type `Outer` in this scope + +#[generate_mod::check_attr] //~ ERROR cannot find type `FromOutside` in this scope + //~| ERROR cannot find type `OuterAttr` in this scope +struct S; + +#[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope + //~| WARN cannot find type `OuterDerive` in this scope + //~| WARN this was previously accepted + //~| WARN this was previously accepted +struct Z; + +fn inner_block() { + #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope + //~| WARN cannot find type `OuterDerive` in this scope + //~| WARN this was previously accepted + //~| WARN this was previously accepted + struct InnerZ; +} + +#[derive(generate_mod::CheckDeriveLint)] // OK, lint is suppressed +struct W; + +fn main() {} diff --git a/src/test/ui-fulldeps/proc-macro/generate-mod.stderr b/src/test/ui/proc-macro/generate-mod.stderr similarity index 92% rename from src/test/ui-fulldeps/proc-macro/generate-mod.stderr rename to src/test/ui/proc-macro/generate-mod.stderr index a981b1bc8b8..1177fc6e575 100644 --- a/src/test/ui-fulldeps/proc-macro/generate-mod.stderr +++ b/src/test/ui/proc-macro/generate-mod.stderr @@ -1,29 +1,29 @@ error[E0412]: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:19:1 + --> $DIR/generate-mod.rs:9:1 | LL | generate_mod::check!(); //~ ERROR cannot find type `FromOutside` in this scope | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `Outer` in this scope - --> $DIR/generate-mod.rs:19:1 + --> $DIR/generate-mod.rs:9:1 | LL | generate_mod::check!(); //~ ERROR cannot find type `FromOutside` in this scope | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:22:1 + --> $DIR/generate-mod.rs:12:1 | LL | #[generate_mod::check_attr] //~ ERROR cannot find type `FromOutside` in this scope | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `OuterAttr` in this scope - --> $DIR/generate-mod.rs:22:1 + --> $DIR/generate-mod.rs:12:1 | LL | #[generate_mod::check_attr] //~ ERROR cannot find type `FromOutside` in this scope | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope warning: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:26:10 + --> $DIR/generate-mod.rs:16:10 | LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -33,7 +33,7 @@ LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside = note: for more information, see issue #50504 warning: cannot find type `OuterDerive` in this scope - --> $DIR/generate-mod.rs:26:10 + --> $DIR/generate-mod.rs:16:10 | LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -42,7 +42,7 @@ LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside = note: for more information, see issue #50504 warning: cannot find type `FromOutside` in this scope - --> $DIR/generate-mod.rs:33:14 + --> $DIR/generate-mod.rs:23:14 | LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import @@ -51,7 +51,7 @@ LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOut = note: for more information, see issue #50504 warning: cannot find type `OuterDerive` in this scope - --> $DIR/generate-mod.rs:33:14 + --> $DIR/generate-mod.rs:23:14 | LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import diff --git a/src/test/ui/proc-macro/illegal-proc-macro-derive-use.rs b/src/test/ui/proc-macro/illegal-proc-macro-derive-use.rs new file mode 100644 index 00000000000..4efd9e952fc --- /dev/null +++ b/src/test/ui/proc-macro/illegal-proc-macro-derive-use.rs @@ -0,0 +1,15 @@ +extern crate proc_macro; + +#[proc_macro_derive(Foo)] +//~^ ERROR: only usable with crates of the `proc-macro` crate type +pub fn foo(a: proc_macro::TokenStream) -> proc_macro::TokenStream { + a +} + +// Issue #37590 +#[proc_macro_derive(Foo)] +//~^ ERROR: the `#[proc_macro_derive]` attribute may only be used on bare functions +pub struct Foo { +} + +fn main() {} diff --git a/src/test/ui/proc-macro/illegal-proc-macro-derive-use.stderr b/src/test/ui/proc-macro/illegal-proc-macro-derive-use.stderr new file mode 100644 index 00000000000..c0930ab7102 --- /dev/null +++ b/src/test/ui/proc-macro/illegal-proc-macro-derive-use.stderr @@ -0,0 +1,14 @@ +error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type + --> $DIR/illegal-proc-macro-derive-use.rs:3:1 + | +LL | #[proc_macro_derive(Foo)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: the `#[proc_macro_derive]` attribute may only be used on bare functions + --> $DIR/illegal-proc-macro-derive-use.rs:10:1 + | +LL | #[proc_macro_derive(Foo)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/proc-macro/import.rs b/src/test/ui/proc-macro/import.rs new file mode 100644 index 00000000000..8fbccdf1aed --- /dev/null +++ b/src/test/ui/proc-macro/import.rs @@ -0,0 +1,11 @@ +// aux-build:derive-a.rs + +#![allow(warnings)] + +#[macro_use] +extern crate derive_a; + +use derive_a::derive_a; +//~^ ERROR: unresolved import `derive_a::derive_a` + +fn main() {} diff --git a/src/test/ui/proc-macro/import.stderr b/src/test/ui/proc-macro/import.stderr new file mode 100644 index 00000000000..813a8ac2604 --- /dev/null +++ b/src/test/ui/proc-macro/import.stderr @@ -0,0 +1,9 @@ +error[E0432]: unresolved import `derive_a::derive_a` + --> $DIR/import.rs:8:5 + | +LL | use derive_a::derive_a; + | ^^^^^^^^^^^^^^^^^^ no `derive_a` in the root + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/proc-macro/invalid-attributes.rs b/src/test/ui/proc-macro/invalid-attributes.rs new file mode 100644 index 00000000000..c5ec4925e43 --- /dev/null +++ b/src/test/ui/proc-macro/invalid-attributes.rs @@ -0,0 +1,26 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro = "test"] //~ ERROR attribute must be of the form +pub fn a(a: TokenStream) -> TokenStream { a } + +#[proc_macro()] //~ ERROR attribute must be of the form +pub fn c(a: TokenStream) -> TokenStream { a } + +#[proc_macro(x)] //~ ERROR attribute must be of the form +pub fn d(a: TokenStream) -> TokenStream { a } + +#[proc_macro_attribute = "test"] //~ ERROR attribute must be of the form +pub fn e(_: TokenStream, a: TokenStream) -> TokenStream { a } + +#[proc_macro_attribute()] //~ ERROR attribute must be of the form +pub fn g(_: TokenStream, a: TokenStream) -> TokenStream { a } + +#[proc_macro_attribute(x)] //~ ERROR attribute must be of the form +pub fn h(_: TokenStream, a: TokenStream) -> TokenStream { a } diff --git a/src/test/ui/proc-macro/invalid-attributes.stderr b/src/test/ui/proc-macro/invalid-attributes.stderr new file mode 100644 index 00000000000..06a7ef2b206 --- /dev/null +++ b/src/test/ui/proc-macro/invalid-attributes.stderr @@ -0,0 +1,38 @@ +error: attribute must be of the form `#[proc_macro]` + --> $DIR/invalid-attributes.rs:10:1 + | +LL | #[proc_macro = "test"] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[proc_macro]` + --> $DIR/invalid-attributes.rs:13:1 + | +LL | #[proc_macro()] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[proc_macro]` + --> $DIR/invalid-attributes.rs:16:1 + | +LL | #[proc_macro(x)] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[proc_macro_attribute]` + --> $DIR/invalid-attributes.rs:19:1 + | +LL | #[proc_macro_attribute = "test"] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[proc_macro_attribute]` + --> $DIR/invalid-attributes.rs:22:1 + | +LL | #[proc_macro_attribute()] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[proc_macro_attribute]` + --> $DIR/invalid-attributes.rs:25:1 + | +LL | #[proc_macro_attribute(x)] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/proc-macro/invalid-punct-ident-1.rs b/src/test/ui/proc-macro/invalid-punct-ident-1.rs new file mode 100644 index 00000000000..2360b1fe8c0 --- /dev/null +++ b/src/test/ui/proc-macro/invalid-punct-ident-1.rs @@ -0,0 +1,6 @@ +// aux-build:invalid-punct-ident.rs + +#[macro_use] +extern crate invalid_punct_ident; + +invalid_punct!(); //~ ERROR proc macro panicked diff --git a/src/test/ui-fulldeps/invalid-punct-ident-1.stderr b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr similarity index 83% rename from src/test/ui-fulldeps/invalid-punct-ident-1.stderr rename to src/test/ui/proc-macro/invalid-punct-ident-1.stderr index 3b3619e2637..87594130378 100644 --- a/src/test/ui-fulldeps/invalid-punct-ident-1.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr @@ -1,5 +1,5 @@ error: proc macro panicked - --> $DIR/invalid-punct-ident-1.rs:16:1 + --> $DIR/invalid-punct-ident-1.rs:6:1 | LL | invalid_punct!(); //~ ERROR proc macro panicked | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/proc-macro/invalid-punct-ident-2.rs b/src/test/ui/proc-macro/invalid-punct-ident-2.rs new file mode 100644 index 00000000000..9593d47bb13 --- /dev/null +++ b/src/test/ui/proc-macro/invalid-punct-ident-2.rs @@ -0,0 +1,6 @@ +// aux-build:invalid-punct-ident.rs + +#[macro_use] +extern crate invalid_punct_ident; + +invalid_ident!(); //~ ERROR proc macro panicked diff --git a/src/test/ui-fulldeps/invalid-punct-ident-2.stderr b/src/test/ui/proc-macro/invalid-punct-ident-2.stderr similarity index 83% rename from src/test/ui-fulldeps/invalid-punct-ident-2.stderr rename to src/test/ui/proc-macro/invalid-punct-ident-2.stderr index 869c0908bb5..384d30650f1 100644 --- a/src/test/ui-fulldeps/invalid-punct-ident-2.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-2.stderr @@ -1,5 +1,5 @@ error: proc macro panicked - --> $DIR/invalid-punct-ident-2.rs:16:1 + --> $DIR/invalid-punct-ident-2.rs:6:1 | LL | invalid_ident!(); //~ ERROR proc macro panicked | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/proc-macro/invalid-punct-ident-3.rs b/src/test/ui/proc-macro/invalid-punct-ident-3.rs new file mode 100644 index 00000000000..75e3e06f881 --- /dev/null +++ b/src/test/ui/proc-macro/invalid-punct-ident-3.rs @@ -0,0 +1,6 @@ +// aux-build:invalid-punct-ident.rs + +#[macro_use] +extern crate invalid_punct_ident; + +invalid_raw_ident!(); //~ ERROR proc macro panicked diff --git a/src/test/ui-fulldeps/invalid-punct-ident-3.stderr b/src/test/ui/proc-macro/invalid-punct-ident-3.stderr similarity index 84% rename from src/test/ui-fulldeps/invalid-punct-ident-3.stderr rename to src/test/ui/proc-macro/invalid-punct-ident-3.stderr index 716f6ffa098..fd34459e897 100644 --- a/src/test/ui-fulldeps/invalid-punct-ident-3.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-3.stderr @@ -1,5 +1,5 @@ error: proc macro panicked - --> $DIR/invalid-punct-ident-3.rs:16:1 + --> $DIR/invalid-punct-ident-3.rs:6:1 | LL | invalid_raw_ident!(); //~ ERROR proc macro panicked | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/proc-macro/invalid-punct-ident-4.rs b/src/test/ui/proc-macro/invalid-punct-ident-4.rs new file mode 100644 index 00000000000..59187821695 --- /dev/null +++ b/src/test/ui/proc-macro/invalid-punct-ident-4.rs @@ -0,0 +1,7 @@ +// aux-build:invalid-punct-ident.rs + +#[macro_use] +extern crate invalid_punct_ident; + +lexer_failure!(); //~ ERROR proc macro panicked + //~| ERROR unexpected close delimiter: `)` diff --git a/src/test/ui-fulldeps/invalid-punct-ident-4.stderr b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr similarity index 78% rename from src/test/ui-fulldeps/invalid-punct-ident-4.stderr rename to src/test/ui/proc-macro/invalid-punct-ident-4.stderr index 669a1eb5839..39eb64e555c 100644 --- a/src/test/ui-fulldeps/invalid-punct-ident-4.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr @@ -1,11 +1,11 @@ error: unexpected close delimiter: `)` - --> $DIR/invalid-punct-ident-4.rs:16:1 + --> $DIR/invalid-punct-ident-4.rs:6:1 | LL | lexer_failure!(); //~ ERROR proc macro panicked | ^^^^^^^^^^^^^^^^^ unexpected close delimiter error: proc macro panicked - --> $DIR/invalid-punct-ident-4.rs:16:1 + --> $DIR/invalid-punct-ident-4.rs:6:1 | LL | lexer_failure!(); //~ ERROR proc macro panicked | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/proc-macro/issue-37788.rs b/src/test/ui/proc-macro/issue-37788.rs new file mode 100644 index 00000000000..75fcd24d85f --- /dev/null +++ b/src/test/ui/proc-macro/issue-37788.rs @@ -0,0 +1,9 @@ +// aux-build:derive-a-b.rs + +#[macro_use] +extern crate derive_a_b; + +fn main() { + // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE. + std::cell::Cell::new(0) //~ ERROR mismatched types +} diff --git a/src/test/ui/proc-macro/issue-37788.stderr b/src/test/ui/proc-macro/issue-37788.stderr new file mode 100644 index 00000000000..40f28460b16 --- /dev/null +++ b/src/test/ui/proc-macro/issue-37788.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/issue-37788.rs:8:5 + | +LL | fn main() { + | - expected `()` because of default return type +LL | // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE. +LL | std::cell::Cell::new(0) //~ ERROR mismatched types + | ^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;` + | | + | expected (), found struct `std::cell::Cell` + | + = note: expected type `()` + found type `std::cell::Cell<{integer}>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/proc-macro/issue-38586.rs b/src/test/ui/proc-macro/issue-38586.rs new file mode 100644 index 00000000000..4f291ba990a --- /dev/null +++ b/src/test/ui/proc-macro/issue-38586.rs @@ -0,0 +1,9 @@ +// aux-build:issue_38586.rs + +#[macro_use] +extern crate issue_38586; + +#[derive(A)] //~ ERROR `foo` +struct A; + +fn main() {} diff --git a/src/test/ui/proc-macro/issue-38586.stderr b/src/test/ui/proc-macro/issue-38586.stderr new file mode 100644 index 00000000000..9657914f49b --- /dev/null +++ b/src/test/ui/proc-macro/issue-38586.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `foo` in this scope + --> $DIR/issue-38586.rs:6:10 + | +LL | #[derive(A)] //~ ERROR `foo` + | ^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/proc-macro/issue-41211.rs b/src/test/ui/proc-macro/issue-41211.rs new file mode 100644 index 00000000000..0b082f4818f --- /dev/null +++ b/src/test/ui/proc-macro/issue-41211.rs @@ -0,0 +1,14 @@ +// aux-build:issue-41211.rs + +// FIXME: https://github.com/rust-lang/rust/issues/41430 +// This is a temporary regression test for the ICE reported in #41211 + +#![feature(custom_inner_attributes)] + +#![emit_unchanged] +//~^ ERROR attribute `emit_unchanged` is currently unknown to the compiler +//~| ERROR inconsistent resolution for a macro: first custom attribute, then attribute macro +extern crate issue_41211; +use issue_41211::emit_unchanged; + +fn main() {} diff --git a/src/test/ui/proc-macro/issue-41211.stderr b/src/test/ui/proc-macro/issue-41211.stderr new file mode 100644 index 00000000000..f75481e4829 --- /dev/null +++ b/src/test/ui/proc-macro/issue-41211.stderr @@ -0,0 +1,17 @@ +error[E0658]: The attribute `emit_unchanged` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/issue-41211.rs:8:4 + | +LL | #![emit_unchanged] + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: inconsistent resolution for a macro: first custom attribute, then attribute macro + --> $DIR/issue-41211.rs:8:4 + | +LL | #![emit_unchanged] + | ^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/issue-50493.rs b/src/test/ui/proc-macro/issue-50493.rs new file mode 100644 index 00000000000..f504dbdfce2 --- /dev/null +++ b/src/test/ui/proc-macro/issue-50493.rs @@ -0,0 +1,14 @@ +// aux-build:issue_50493.rs + +#[macro_use] +extern crate issue_50493; + +#[derive(Derive)] //~ ERROR field `field` of struct `Restricted` is private +struct Restricted { + pub(in restricted) field: usize, //~ visibilities can only be restricted to ancestor modules +} + +mod restricted {} + +fn main() {} + diff --git a/src/test/ui/proc-macro/issue-50493.stderr b/src/test/ui/proc-macro/issue-50493.stderr new file mode 100644 index 00000000000..559e8f0f222 --- /dev/null +++ b/src/test/ui/proc-macro/issue-50493.stderr @@ -0,0 +1,15 @@ +error: visibilities can only be restricted to ancestor modules + --> $DIR/issue-50493.rs:8:12 + | +LL | pub(in restricted) field: usize, //~ visibilities can only be restricted to ancestor modules + | ^^^^^^^^^^ + +error[E0616]: field `field` of struct `Restricted` is private + --> $DIR/issue-50493.rs:6:10 + | +LL | #[derive(Derive)] //~ ERROR field `field` of struct `Restricted` is private + | ^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0616`. diff --git a/src/test/ui-fulldeps/proc-macro/issue-53481.rs b/src/test/ui/proc-macro/issue-53481.rs similarity index 100% rename from src/test/ui-fulldeps/proc-macro/issue-53481.rs rename to src/test/ui/proc-macro/issue-53481.rs diff --git a/src/test/ui/proc-macro/item-error.rs b/src/test/ui/proc-macro/item-error.rs new file mode 100644 index 00000000000..64c203e5480 --- /dev/null +++ b/src/test/ui/proc-macro/item-error.rs @@ -0,0 +1,15 @@ +// aux-build:derive-b.rs + +#![allow(warnings)] + +#[macro_use] +extern crate derive_b; + +#[derive(B)] +struct A { + a: &u64 +//~^ ERROR: missing lifetime specifier +} + +fn main() { +} diff --git a/src/test/ui/proc-macro/item-error.stderr b/src/test/ui/proc-macro/item-error.stderr new file mode 100644 index 00000000000..e801c26c43b --- /dev/null +++ b/src/test/ui/proc-macro/item-error.stderr @@ -0,0 +1,9 @@ +error[E0106]: missing lifetime specifier + --> $DIR/item-error.rs:10:8 + | +LL | a: &u64 + | ^ expected lifetime parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/proc-macro/lifetimes.rs b/src/test/ui/proc-macro/lifetimes.rs new file mode 100644 index 00000000000..d0dd1b4603b --- /dev/null +++ b/src/test/ui/proc-macro/lifetimes.rs @@ -0,0 +1,11 @@ +// aux-build:lifetimes.rs + +#![feature(proc_macro_hygiene)] + +extern crate lifetimes; + +use lifetimes::*; + +type A = single_quote_alone!(); //~ ERROR expected type, found `'` + +fn main() {} diff --git a/src/test/ui-fulldeps/lifetimes.stderr b/src/test/ui/proc-macro/lifetimes.stderr similarity index 86% rename from src/test/ui-fulldeps/lifetimes.stderr rename to src/test/ui/proc-macro/lifetimes.stderr index 6baf2b16998..c873ab68654 100644 --- a/src/test/ui-fulldeps/lifetimes.stderr +++ b/src/test/ui/proc-macro/lifetimes.stderr @@ -1,5 +1,5 @@ error: expected type, found `'` - --> $DIR/lifetimes.rs:19:10 + --> $DIR/lifetimes.rs:9:10 | LL | type A = single_quote_alone!(); //~ ERROR expected type, found `'` | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/proc-macro/lints_in_proc_macros.rs b/src/test/ui/proc-macro/lints_in_proc_macros.rs new file mode 100644 index 00000000000..8d2957ef5da --- /dev/null +++ b/src/test/ui/proc-macro/lints_in_proc_macros.rs @@ -0,0 +1,17 @@ +// aux-build:bang_proc_macro2.rs + +#![feature(proc_macro_hygiene)] +#![allow(unused_macros)] + +extern crate bang_proc_macro2; + +use bang_proc_macro2::bang_proc_macro2; + +fn main() { + let foobar = 42; + bang_proc_macro2!(); + //~^ ERROR cannot find value `foobar2` in this scope + //~| HELP a local variable with a similar name exists + //~| SUGGESTION foobar + println!("{}", x); +} diff --git a/src/test/ui/proc-macro/lints_in_proc_macros.stderr b/src/test/ui/proc-macro/lints_in_proc_macros.stderr new file mode 100644 index 00000000000..2d97cd700be --- /dev/null +++ b/src/test/ui/proc-macro/lints_in_proc_macros.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `foobar2` in this scope + --> $DIR/lints_in_proc_macros.rs:12:5 + | +LL | bang_proc_macro2!(); + | ^^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `foobar` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/proc-macro/load-panic.rs b/src/test/ui/proc-macro/load-panic.rs new file mode 100644 index 00000000000..fa279c559fb --- /dev/null +++ b/src/test/ui/proc-macro/load-panic.rs @@ -0,0 +1,11 @@ +// aux-build:derive-panic.rs +// compile-flags:--error-format human + +#[macro_use] +extern crate derive_panic; + +#[derive(A)] +//~^ ERROR: proc-macro derive panicked +struct Foo; + +fn main() {} diff --git a/src/test/ui-fulldeps/proc-macro/load-panic.stderr b/src/test/ui/proc-macro/load-panic.stderr similarity index 82% rename from src/test/ui-fulldeps/proc-macro/load-panic.stderr rename to src/test/ui/proc-macro/load-panic.stderr index 30ad53f9041..b448c804bff 100644 --- a/src/test/ui-fulldeps/proc-macro/load-panic.stderr +++ b/src/test/ui/proc-macro/load-panic.stderr @@ -1,5 +1,5 @@ error: proc-macro derive panicked - --> $DIR/load-panic.rs:17:10 + --> $DIR/load-panic.rs:7:10 | LL | #[derive(A)] | ^ diff --git a/src/test/ui/proc-macro/macro-brackets.rs b/src/test/ui/proc-macro/macro-brackets.rs new file mode 100644 index 00000000000..c46abf03654 --- /dev/null +++ b/src/test/ui/proc-macro/macro-brackets.rs @@ -0,0 +1,14 @@ +// aux-build:macro-brackets.rs + +extern crate macro_brackets as bar; +use bar::doit; + +macro_rules! id { + ($($t:tt)*) => ($($t)*) +} + +#[doit] +id![static X: u32 = 'a';]; //~ ERROR: mismatched types + + +fn main() {} diff --git a/src/test/ui-fulldeps/proc-macro/macro-brackets.stderr b/src/test/ui/proc-macro/macro-brackets.stderr similarity index 88% rename from src/test/ui-fulldeps/proc-macro/macro-brackets.stderr rename to src/test/ui/proc-macro/macro-brackets.stderr index 7c263d38df9..a3cc7d485cd 100644 --- a/src/test/ui-fulldeps/proc-macro/macro-brackets.stderr +++ b/src/test/ui/proc-macro/macro-brackets.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/macro-brackets.rs:21:21 + --> $DIR/macro-brackets.rs:11:21 | LL | id![static X: u32 = 'a';]; //~ ERROR: mismatched types | ^^^ expected u32, found char diff --git a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.rs b/src/test/ui/proc-macro/macro-namespace-reserved-2.rs similarity index 75% rename from src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.rs rename to src/test/ui/proc-macro/macro-namespace-reserved-2.rs index fa05ad2fc60..583640aa817 100644 --- a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.rs +++ b/src/test/ui/proc-macro/macro-namespace-reserved-2.rs @@ -1,13 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +// force-host // no-prefer-dynamic #![crate_type = "proc-macro"] diff --git a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.stderr b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr similarity index 81% rename from src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.stderr rename to src/test/ui/proc-macro/macro-namespace-reserved-2.stderr index 9def03e9450..c1821199e30 100644 --- a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.stderr +++ b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr @@ -1,53 +1,53 @@ error: can't use a procedural macro from the same crate that defines it - --> $DIR/macro-namespace-reserved-2.rs:34:5 + --> $DIR/macro-namespace-reserved-2.rs:25:5 | LL | my_macro!(); //~ ERROR can't use a procedural macro from the same crate that defines it | ^^^^^^^^ error: can't use a procedural macro from the same crate that defines it - --> $DIR/macro-namespace-reserved-2.rs:37:5 + --> $DIR/macro-namespace-reserved-2.rs:28:5 | LL | my_macro_attr!(); //~ ERROR can't use a procedural macro from the same crate that defines it | ^^^^^^^^^^^^^ error: can't use a procedural macro from the same crate that defines it - --> $DIR/macro-namespace-reserved-2.rs:40:5 + --> $DIR/macro-namespace-reserved-2.rs:31:5 | LL | MyTrait!(); //~ ERROR can't use a procedural macro from the same crate that defines it | ^^^^^^^ error: can't use a procedural macro from the same crate that defines it - --> $DIR/macro-namespace-reserved-2.rs:43:3 + --> $DIR/macro-namespace-reserved-2.rs:34:3 | LL | #[my_macro] //~ ERROR can't use a procedural macro from the same crate that defines it | ^^^^^^^^ error: can't use a procedural macro from the same crate that defines it - --> $DIR/macro-namespace-reserved-2.rs:45:3 + --> $DIR/macro-namespace-reserved-2.rs:36:3 | LL | #[my_macro_attr] //~ ERROR can't use a procedural macro from the same crate that defines it | ^^^^^^^^^^^^^ error: can't use a procedural macro from the same crate that defines it - --> $DIR/macro-namespace-reserved-2.rs:47:3 + --> $DIR/macro-namespace-reserved-2.rs:38:3 | LL | #[MyTrait] //~ ERROR can't use a procedural macro from the same crate that defines it | ^^^^^^^ error: can't use a procedural macro from the same crate that defines it - --> $DIR/macro-namespace-reserved-2.rs:50:10 + --> $DIR/macro-namespace-reserved-2.rs:41:10 | LL | #[derive(my_macro)] //~ ERROR can't use a procedural macro from the same crate that defines it | ^^^^^^^^ error: can't use a procedural macro from the same crate that defines it - --> $DIR/macro-namespace-reserved-2.rs:52:10 + --> $DIR/macro-namespace-reserved-2.rs:43:10 | LL | #[derive(my_macro_attr)] //~ ERROR can't use a procedural macro from the same crate that defines it | ^^^^^^^^^^^^^ error: can't use a procedural macro from the same crate that defines it - --> $DIR/macro-namespace-reserved-2.rs:54:10 + --> $DIR/macro-namespace-reserved-2.rs:45:10 | LL | #[derive(MyTrait)] //~ ERROR can't use a procedural macro from the same crate that defines it | ^^^^^^^ diff --git a/src/test/ui/proc-macro/macro-namespace-reserved.rs b/src/test/ui/proc-macro/macro-namespace-reserved.rs new file mode 100644 index 00000000000..60d379e41ad --- /dev/null +++ b/src/test/ui/proc-macro/macro-namespace-reserved.rs @@ -0,0 +1,38 @@ +// force-host +// no-prefer-dynamic + +#![feature(decl_macro)] +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::*; + +#[proc_macro] +pub fn my_macro(input: TokenStream) -> TokenStream { + input +} + +#[proc_macro_attribute] +pub fn my_macro_attr(input: TokenStream, _: TokenStream) -> TokenStream { + input +} + +#[proc_macro_derive(MyTrait)] +pub fn my_macro_derive(input: TokenStream) -> TokenStream { + input +} + +macro my_macro() {} //~ ERROR the name `my_macro` is defined multiple times +macro my_macro_attr() {} //~ ERROR the name `my_macro_attr` is defined multiple times +macro MyTrait() {} //~ ERROR the name `MyTrait` is defined multiple times + +#[proc_macro_derive(SameName)] +pub fn foo(input: TokenStream) -> TokenStream { + input +} + +#[proc_macro] +pub fn SameName(input: TokenStream) -> TokenStream { +//~^ ERROR the name `SameName` is defined multiple times + input +} diff --git a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.stderr b/src/test/ui/proc-macro/macro-namespace-reserved.stderr similarity index 93% rename from src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.stderr rename to src/test/ui/proc-macro/macro-namespace-reserved.stderr index 44b51edcc0b..2192e6d2b17 100644 --- a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.stderr +++ b/src/test/ui/proc-macro/macro-namespace-reserved.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `my_macro` is defined multiple times - --> $DIR/macro-namespace-reserved.rs:34:1 + --> $DIR/macro-namespace-reserved.rs:25:1 | LL | pub fn my_macro(input: TokenStream) -> TokenStream { | -------------------------------------------------- previous definition of the macro `my_macro` here @@ -10,7 +10,7 @@ LL | macro my_macro() {} //~ ERROR the name `my_macro` is defined multiple times = note: `my_macro` must be defined only once in the macro namespace of this module error[E0428]: the name `my_macro_attr` is defined multiple times - --> $DIR/macro-namespace-reserved.rs:35:1 + --> $DIR/macro-namespace-reserved.rs:26:1 | LL | pub fn my_macro_attr(input: TokenStream, _: TokenStream) -> TokenStream { | ----------------------------------------------------------------------- previous definition of the macro `my_macro_attr` here @@ -21,7 +21,7 @@ LL | macro my_macro_attr() {} //~ ERROR the name `my_macro_attr` is defined mult = note: `my_macro_attr` must be defined only once in the macro namespace of this module error[E0428]: the name `MyTrait` is defined multiple times - --> $DIR/macro-namespace-reserved.rs:36:1 + --> $DIR/macro-namespace-reserved.rs:27:1 | LL | #[proc_macro_derive(MyTrait)] | ------- previous definition of the macro `MyTrait` here @@ -32,7 +32,7 @@ LL | macro MyTrait() {} //~ ERROR the name `MyTrait` is defined multiple times = note: `MyTrait` must be defined only once in the macro namespace of this module error[E0428]: the name `SameName` is defined multiple times - --> $DIR/macro-namespace-reserved.rs:44:1 + --> $DIR/macro-namespace-reserved.rs:35:1 | LL | #[proc_macro_derive(SameName)] | -------- previous definition of the macro `SameName` here diff --git a/src/test/ui/proc-macro/macro-use-attr.rs b/src/test/ui/proc-macro/macro-use-attr.rs new file mode 100644 index 00000000000..13db0725a38 --- /dev/null +++ b/src/test/ui/proc-macro/macro-use-attr.rs @@ -0,0 +1,11 @@ +// compile-pass +// aux-build:attr_proc_macro.rs + +#[macro_use] extern crate attr_proc_macro; + +#[attr_proc_macro] +struct Foo; + +fn main() { + let _ = Foo; +} diff --git a/src/test/ui/proc-macro/macro-use-bang.rs b/src/test/ui/proc-macro/macro-use-bang.rs new file mode 100644 index 00000000000..4bf3bcd6f3a --- /dev/null +++ b/src/test/ui/proc-macro/macro-use-bang.rs @@ -0,0 +1,11 @@ +// compile-pass +// aux-build:bang_proc_macro.rs + +#![feature(proc_macro_hygiene)] + +#[macro_use] +extern crate bang_proc_macro; + +fn main() { + bang_proc_macro!(println!("Hello, world!")); +} diff --git a/src/test/ui/proc-macro/macros-in-extern.rs b/src/test/ui/proc-macro/macros-in-extern.rs new file mode 100644 index 00000000000..5c5603b6c06 --- /dev/null +++ b/src/test/ui/proc-macro/macros-in-extern.rs @@ -0,0 +1,25 @@ +// aux-build:test-macros.rs +// ignore-wasm32 + +extern crate test_macros; + +use test_macros::{nop_attr, no_output, emit_input}; + +fn main() { + assert_eq!(unsafe { rust_get_test_int() }, 0isize); + assert_eq!(unsafe { rust_dbg_extern_identity_u32(0xDEADBEEF) }, 0xDEADBEEF); +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + #[no_output] + //~^ ERROR macro invocations in `extern {}` blocks are experimental + fn some_definitely_unknown_symbol_which_should_be_removed(); + + #[nop_attr] + //~^ ERROR macro invocations in `extern {}` blocks are experimental + fn rust_get_test_int() -> isize; + + emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;); + //~^ ERROR macro invocations in `extern {}` blocks are experimental +} diff --git a/src/test/ui/proc-macro/macros-in-extern.stderr b/src/test/ui/proc-macro/macros-in-extern.stderr new file mode 100644 index 00000000000..8a48656d087 --- /dev/null +++ b/src/test/ui/proc-macro/macros-in-extern.stderr @@ -0,0 +1,27 @@ +error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) + --> $DIR/macros-in-extern.rs:15:5 + | +LL | #[no_output] + | ^^^^^^^^^^^^ + | + = help: add #![feature(macros_in_extern)] to the crate attributes to enable + +error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) + --> $DIR/macros-in-extern.rs:19:5 + | +LL | #[nop_attr] + | ^^^^^^^^^^^ + | + = help: add #![feature(macros_in_extern)] to the crate attributes to enable + +error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) + --> $DIR/macros-in-extern.rs:23:5 + | +LL | emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(macros_in_extern)] to the crate attributes to enable + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/more-gates.rs b/src/test/ui/proc-macro/more-gates.rs new file mode 100644 index 00000000000..b870b438a65 --- /dev/null +++ b/src/test/ui/proc-macro/more-gates.rs @@ -0,0 +1,22 @@ +// aux-build:more-gates.rs + +#![feature(decl_macro)] + +extern crate more_gates as foo; + +use foo::*; + +#[attr2mac1] +//~^ ERROR: cannot expand to macro definitions +pub fn a() {} +#[attr2mac2] +//~^ ERROR: cannot expand to macro definitions +pub fn a() {} + +mac2mac1!(); //~ ERROR: cannot expand to macro definitions +mac2mac2!(); //~ ERROR: cannot expand to macro definitions + +tricky!(); +//~^ ERROR: cannot expand to macro definitions + +fn main() {} diff --git a/src/test/ui/proc-macro/more-gates.stderr b/src/test/ui/proc-macro/more-gates.stderr new file mode 100644 index 00000000000..21e75027e48 --- /dev/null +++ b/src/test/ui/proc-macro/more-gates.stderr @@ -0,0 +1,43 @@ +error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) + --> $DIR/more-gates.rs:9:1 + | +LL | #[attr2mac1] + | ^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) + --> $DIR/more-gates.rs:12:1 + | +LL | #[attr2mac2] + | ^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) + --> $DIR/more-gates.rs:16:1 + | +LL | mac2mac1!(); //~ ERROR: cannot expand to macro definitions + | ^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) + --> $DIR/more-gates.rs:17:1 + | +LL | mac2mac2!(); //~ ERROR: cannot expand to macro definitions + | ^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) + --> $DIR/more-gates.rs:19:1 + | +LL | tricky!(); + | ^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/multispan.rs b/src/test/ui/proc-macro/multispan.rs new file mode 100644 index 00000000000..d06947761e3 --- /dev/null +++ b/src/test/ui/proc-macro/multispan.rs @@ -0,0 +1,27 @@ +// aux-build:multispan.rs + +#![feature(proc_macro_hygiene)] + +extern crate multispan; + +use multispan::hello; + +fn main() { + // This one emits no error. + hello!(); + + // Exactly one 'hi'. + hello!(hi); //~ ERROR hello to you, too! + + // Now two, back to back. + hello!(hi hi); //~ ERROR hello to you, too! + + // Now three, back to back. + hello!(hi hi hi); //~ ERROR hello to you, too! + + // Now several, with spacing. + hello!(hi hey hi yo hi beep beep hi hi); //~ ERROR hello to you, too! + hello!(hi there, hi how are you? hi... hi.); //~ ERROR hello to you, too! + hello!(whoah. hi di hi di ho); //~ ERROR hello to you, too! + hello!(hi good hi and good bye); //~ ERROR hello to you, too! +} diff --git a/src/test/ui-fulldeps/proc-macro/multispan.stderr b/src/test/ui/proc-macro/multispan.stderr similarity index 83% rename from src/test/ui-fulldeps/proc-macro/multispan.stderr rename to src/test/ui/proc-macro/multispan.stderr index 267313ef5ae..7519f778e9e 100644 --- a/src/test/ui-fulldeps/proc-macro/multispan.stderr +++ b/src/test/ui/proc-macro/multispan.stderr @@ -1,83 +1,83 @@ error: hello to you, too! - --> $DIR/multispan.rs:25:5 + --> $DIR/multispan.rs:14:5 | LL | hello!(hi); //~ ERROR hello to you, too! | ^^^^^^^^^^^ | note: found these 'hi's - --> $DIR/multispan.rs:25:12 + --> $DIR/multispan.rs:14:12 | LL | hello!(hi); //~ ERROR hello to you, too! | ^^ error: hello to you, too! - --> $DIR/multispan.rs:28:5 + --> $DIR/multispan.rs:17:5 | LL | hello!(hi hi); //~ ERROR hello to you, too! | ^^^^^^^^^^^^^^ | note: found these 'hi's - --> $DIR/multispan.rs:28:12 + --> $DIR/multispan.rs:17:12 | LL | hello!(hi hi); //~ ERROR hello to you, too! | ^^ ^^ error: hello to you, too! - --> $DIR/multispan.rs:31:5 + --> $DIR/multispan.rs:20:5 | LL | hello!(hi hi hi); //~ ERROR hello to you, too! | ^^^^^^^^^^^^^^^^^ | note: found these 'hi's - --> $DIR/multispan.rs:31:12 + --> $DIR/multispan.rs:20:12 | LL | hello!(hi hi hi); //~ ERROR hello to you, too! | ^^ ^^ ^^ error: hello to you, too! - --> $DIR/multispan.rs:34:5 + --> $DIR/multispan.rs:23:5 | LL | hello!(hi hey hi yo hi beep beep hi hi); //~ ERROR hello to you, too! | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's - --> $DIR/multispan.rs:34:12 + --> $DIR/multispan.rs:23:12 | LL | hello!(hi hey hi yo hi beep beep hi hi); //~ ERROR hello to you, too! | ^^ ^^ ^^ ^^ ^^ error: hello to you, too! - --> $DIR/multispan.rs:35:5 + --> $DIR/multispan.rs:24:5 | LL | hello!(hi there, hi how are you? hi... hi.); //~ ERROR hello to you, too! | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's - --> $DIR/multispan.rs:35:12 + --> $DIR/multispan.rs:24:12 | LL | hello!(hi there, hi how are you? hi... hi.); //~ ERROR hello to you, too! | ^^ ^^ ^^ ^^ error: hello to you, too! - --> $DIR/multispan.rs:36:5 + --> $DIR/multispan.rs:25:5 | LL | hello!(whoah. hi di hi di ho); //~ ERROR hello to you, too! | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's - --> $DIR/multispan.rs:36:19 + --> $DIR/multispan.rs:25:19 | LL | hello!(whoah. hi di hi di ho); //~ ERROR hello to you, too! | ^^ ^^ error: hello to you, too! - --> $DIR/multispan.rs:37:5 + --> $DIR/multispan.rs:26:5 | LL | hello!(hi good hi and good bye); //~ ERROR hello to you, too! | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's - --> $DIR/multispan.rs:37:12 + --> $DIR/multispan.rs:26:12 | LL | hello!(hi good hi and good bye); //~ ERROR hello to you, too! | ^^ ^^ diff --git a/src/test/ui/proc-macro/nested-item-spans.rs b/src/test/ui/proc-macro/nested-item-spans.rs new file mode 100644 index 00000000000..e365b74b3be --- /dev/null +++ b/src/test/ui/proc-macro/nested-item-spans.rs @@ -0,0 +1,24 @@ +// aux-build:nested-item-spans.rs + +extern crate nested_item_spans; + +use nested_item_spans::foo; + +#[foo] +fn another() { + fn bar() { + let x: u32 = "x"; //~ ERROR: mismatched types + } + + bar(); +} + +fn main() { + #[foo] + fn bar() { + let x: u32 = "x"; //~ ERROR: mismatched types + } + + bar(); + another(); +} diff --git a/src/test/ui-fulldeps/proc-macro/nested-item-spans.stderr b/src/test/ui/proc-macro/nested-item-spans.stderr similarity index 88% rename from src/test/ui-fulldeps/proc-macro/nested-item-spans.stderr rename to src/test/ui/proc-macro/nested-item-spans.stderr index 75140747e8c..cba4b73486c 100644 --- a/src/test/ui-fulldeps/proc-macro/nested-item-spans.stderr +++ b/src/test/ui/proc-macro/nested-item-spans.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/nested-item-spans.rs:20:22 + --> $DIR/nested-item-spans.rs:10:22 | LL | let x: u32 = "x"; //~ ERROR: mismatched types | ^^^ expected u32, found reference @@ -8,7 +8,7 @@ LL | let x: u32 = "x"; //~ ERROR: mismatched types found type `&'static str` error[E0308]: mismatched types - --> $DIR/nested-item-spans.rs:29:22 + --> $DIR/nested-item-spans.rs:19:22 | LL | let x: u32 = "x"; //~ ERROR: mismatched types | ^^^ expected u32, found reference diff --git a/src/test/ui/proc-macro/no-macro-use-attr.rs b/src/test/ui/proc-macro/no-macro-use-attr.rs new file mode 100644 index 00000000000..62a501ded10 --- /dev/null +++ b/src/test/ui/proc-macro/no-macro-use-attr.rs @@ -0,0 +1,10 @@ +// aux-build:derive-a.rs + +#![feature(rustc_attrs)] +#![warn(unused_extern_crates)] + +extern crate derive_a; +//~^ WARN unused extern crate + +#[rustc_error] +fn main() {} //~ ERROR compilation successful diff --git a/src/test/ui/proc-macro/no-macro-use-attr.stderr b/src/test/ui/proc-macro/no-macro-use-attr.stderr new file mode 100644 index 00000000000..fe5107e17cb --- /dev/null +++ b/src/test/ui/proc-macro/no-macro-use-attr.stderr @@ -0,0 +1,20 @@ +warning: unused extern crate + --> $DIR/no-macro-use-attr.rs:6:1 + | +LL | extern crate derive_a; + | ^^^^^^^^^^^^^^^^^^^^^^ help: remove it + | +note: lint level defined here + --> $DIR/no-macro-use-attr.rs:4:9 + | +LL | #![warn(unused_extern_crates)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: compilation successful + --> $DIR/no-macro-use-attr.rs:10:1 + | +LL | fn main() {} //~ ERROR compilation successful + | ^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/proc-macro/non-root.rs b/src/test/ui/proc-macro/non-root.rs new file mode 100644 index 00000000000..a7c4ac00a44 --- /dev/null +++ b/src/test/ui/proc-macro/non-root.rs @@ -0,0 +1,15 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::*; + +fn foo(arg: TokenStream) -> TokenStream { + #[proc_macro] + pub fn foo(arg: TokenStream) -> TokenStream { arg } + //~^ ERROR functions tagged with `#[proc_macro]` must currently reside in the root of the crate + + arg +} diff --git a/src/test/ui-fulldeps/proc-macro/non-root.stderr b/src/test/ui/proc-macro/non-root.stderr similarity index 90% rename from src/test/ui-fulldeps/proc-macro/non-root.stderr rename to src/test/ui/proc-macro/non-root.stderr index 23222a2b851..8f84ddeeddb 100644 --- a/src/test/ui-fulldeps/proc-macro/non-root.stderr +++ b/src/test/ui/proc-macro/non-root.stderr @@ -1,5 +1,5 @@ error: functions tagged with `#[proc_macro]` must currently reside in the root of the crate - --> $DIR/non-root.rs:20:5 + --> $DIR/non-root.rs:11:5 | LL | pub fn foo(arg: TokenStream) -> TokenStream { arg } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/proc-macro/parent-source-spans.rs b/src/test/ui/proc-macro/parent-source-spans.rs new file mode 100644 index 00000000000..799f1de586e --- /dev/null +++ b/src/test/ui/proc-macro/parent-source-spans.rs @@ -0,0 +1,54 @@ +// aux-build:parent-source-spans.rs + + +#![feature(decl_macro, proc_macro_hygiene)] + +extern crate parent_source_spans; + +use parent_source_spans::parent_source_spans; + +macro one($a:expr, $b:expr) { + two!($a, $b); + //~^ ERROR first parent: "hello" + //~| ERROR second parent: "world" +} + +macro two($a:expr, $b:expr) { + three!($a, $b); + //~^ ERROR first final: "hello" + //~| ERROR second final: "world" + //~| ERROR first final: "yay" + //~| ERROR second final: "rust" +} + +// forwarding tokens directly doesn't create a new source chain +macro three($($tokens:tt)*) { + four!($($tokens)*); +} + +macro four($($tokens:tt)*) { + parent_source_spans!($($tokens)*); + //~^ ERROR cannot find value `ok` in this scope + //~| ERROR cannot find value `ok` in this scope + //~| ERROR cannot find value `ok` in this scope +} + +fn main() { + one!("hello", "world"); + //~^ ERROR first grandparent: "hello" + //~| ERROR second grandparent: "world" + //~| ERROR first source: "hello" + //~| ERROR second source: "world" + + two!("yay", "rust"); + //~^ ERROR first parent: "yay" + //~| ERROR second parent: "rust" + //~| ERROR first source: "yay" + //~| ERROR second source: "rust" + + three!("hip", "hop"); + //~^ ERROR first final: "hip" + //~| ERROR second final: "hop" + //~| ERROR first source: "hip" + //~| ERROR second source: "hop" +} diff --git a/src/test/ui/proc-macro/parent-source-spans.stderr b/src/test/ui/proc-macro/parent-source-spans.stderr new file mode 100644 index 00000000000..423122539c8 --- /dev/null +++ b/src/test/ui/proc-macro/parent-source-spans.stderr @@ -0,0 +1,156 @@ +error: first final: "hello" + --> $DIR/parent-source-spans.rs:17:12 + | +LL | three!($a, $b); + | ^^ +... +LL | one!("hello", "world"); + | ----------------------- in this macro invocation + +error: second final: "world" + --> $DIR/parent-source-spans.rs:17:16 + | +LL | three!($a, $b); + | ^^ +... +LL | one!("hello", "world"); + | ----------------------- in this macro invocation + +error: first parent: "hello" + --> $DIR/parent-source-spans.rs:11:5 + | +LL | two!($a, $b); + | ^^^^^^^^^^^^^ +... +LL | one!("hello", "world"); + | ----------------------- in this macro invocation + +error: second parent: "world" + --> $DIR/parent-source-spans.rs:11:5 + | +LL | two!($a, $b); + | ^^^^^^^^^^^^^ +... +LL | one!("hello", "world"); + | ----------------------- in this macro invocation + +error: first grandparent: "hello" + --> $DIR/parent-source-spans.rs:37:5 + | +LL | one!("hello", "world"); + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: second grandparent: "world" + --> $DIR/parent-source-spans.rs:37:5 + | +LL | one!("hello", "world"); + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: first source: "hello" + --> $DIR/parent-source-spans.rs:37:5 + | +LL | one!("hello", "world"); + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: second source: "world" + --> $DIR/parent-source-spans.rs:37:5 + | +LL | one!("hello", "world"); + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error: first final: "yay" + --> $DIR/parent-source-spans.rs:17:12 + | +LL | three!($a, $b); + | ^^ +... +LL | two!("yay", "rust"); + | -------------------- in this macro invocation + +error: second final: "rust" + --> $DIR/parent-source-spans.rs:17:16 + | +LL | three!($a, $b); + | ^^ +... +LL | two!("yay", "rust"); + | -------------------- in this macro invocation + +error: first parent: "yay" + --> $DIR/parent-source-spans.rs:43:5 + | +LL | two!("yay", "rust"); + | ^^^^^^^^^^^^^^^^^^^^ + +error: second parent: "rust" + --> $DIR/parent-source-spans.rs:43:5 + | +LL | two!("yay", "rust"); + | ^^^^^^^^^^^^^^^^^^^^ + +error: first source: "yay" + --> $DIR/parent-source-spans.rs:43:5 + | +LL | two!("yay", "rust"); + | ^^^^^^^^^^^^^^^^^^^^ + +error: second source: "rust" + --> $DIR/parent-source-spans.rs:43:5 + | +LL | two!("yay", "rust"); + | ^^^^^^^^^^^^^^^^^^^^ + +error: first final: "hip" + --> $DIR/parent-source-spans.rs:49:12 + | +LL | three!("hip", "hop"); + | ^^^^^ + +error: second final: "hop" + --> $DIR/parent-source-spans.rs:49:19 + | +LL | three!("hip", "hop"); + | ^^^^^ + +error: first source: "hip" + --> $DIR/parent-source-spans.rs:49:12 + | +LL | three!("hip", "hop"); + | ^^^^^ + +error: second source: "hop" + --> $DIR/parent-source-spans.rs:49:19 + | +LL | three!("hip", "hop"); + | ^^^^^ + +error[E0425]: cannot find value `ok` in this scope + --> $DIR/parent-source-spans.rs:30:5 + | +LL | parent_source_spans!($($tokens)*); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok` +... +LL | one!("hello", "world"); + | ----------------------- in this macro invocation + +error[E0425]: cannot find value `ok` in this scope + --> $DIR/parent-source-spans.rs:30:5 + | +LL | parent_source_spans!($($tokens)*); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok` +... +LL | two!("yay", "rust"); + | -------------------- in this macro invocation + +error[E0425]: cannot find value `ok` in this scope + --> $DIR/parent-source-spans.rs:30:5 + | +LL | parent_source_spans!($($tokens)*); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok` +... +LL | three!("hip", "hop"); + | --------------------- in this macro invocation + +error: aborting due to 21 previous errors + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/proc-macro/proc-macro-attributes.rs b/src/test/ui/proc-macro/proc-macro-attributes.rs new file mode 100644 index 00000000000..1cc824e943c --- /dev/null +++ b/src/test/ui/proc-macro/proc-macro-attributes.rs @@ -0,0 +1,15 @@ +// aux-build:derive-b.rs + +#[macro_use] +extern crate derive_b; + +#[B] //~ ERROR `B` is ambiguous +#[C] //~ ERROR attribute `C` is currently unknown to the compiler +#[B(D)] //~ ERROR `B` is ambiguous +#[B(E = "foo")] //~ ERROR `B` is ambiguous +#[B(arbitrary tokens)] //~ ERROR `B` is ambiguous + //~^ ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `tokens` +#[derive(B)] +struct B; + +fn main() {} diff --git a/src/test/ui/proc-macro/proc-macro-attributes.stderr b/src/test/ui/proc-macro/proc-macro-attributes.stderr new file mode 100644 index 00000000000..7ac44c9354d --- /dev/null +++ b/src/test/ui/proc-macro/proc-macro-attributes.stderr @@ -0,0 +1,86 @@ +error[E0658]: The attribute `C` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/proc-macro-attributes.rs:7:3 + | +LL | #[C] //~ ERROR attribute `C` is currently unknown to the compiler + | ^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) + --> $DIR/proc-macro-attributes.rs:6:3 + | +LL | #[B] //~ ERROR `B` is ambiguous + | ^ ambiguous name + | +note: `B` could refer to the derive helper attribute defined here + --> $DIR/proc-macro-attributes.rs:12:10 + | +LL | #[derive(B)] + | ^ +note: `B` could also refer to the derive macro imported here + --> $DIR/proc-macro-attributes.rs:3:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ + +error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) + --> $DIR/proc-macro-attributes.rs:8:3 + | +LL | #[B(D)] //~ ERROR `B` is ambiguous + | ^ ambiguous name + | +note: `B` could refer to the derive helper attribute defined here + --> $DIR/proc-macro-attributes.rs:12:10 + | +LL | #[derive(B)] + | ^ +note: `B` could also refer to the derive macro imported here + --> $DIR/proc-macro-attributes.rs:3:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ + +error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) + --> $DIR/proc-macro-attributes.rs:9:3 + | +LL | #[B(E = "foo")] //~ ERROR `B` is ambiguous + | ^ ambiguous name + | +note: `B` could refer to the derive helper attribute defined here + --> $DIR/proc-macro-attributes.rs:12:10 + | +LL | #[derive(B)] + | ^ +note: `B` could also refer to the derive macro imported here + --> $DIR/proc-macro-attributes.rs:3:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ + +error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) + --> $DIR/proc-macro-attributes.rs:10:3 + | +LL | #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous + | ^ ambiguous name + | +note: `B` could refer to the derive helper attribute defined here + --> $DIR/proc-macro-attributes.rs:12:10 + | +LL | #[derive(B)] + | ^ +note: `B` could also refer to the derive macro imported here + --> $DIR/proc-macro-attributes.rs:3:1 + | +LL | #[macro_use] + | ^^^^^^^^^^^^ + +error: expected one of `(`, `)`, `,`, `::`, or `=`, found `tokens` + --> $DIR/proc-macro-attributes.rs:10:15 + | +LL | #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous + | ^^^^^^ expected one of `(`, `)`, `,`, `::`, or `=` here + +error: aborting due to 6 previous errors + +Some errors occurred: E0658, E0659. +For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/proc-macro-gates.rs b/src/test/ui/proc-macro/proc-macro-gates.rs new file mode 100644 index 00000000000..b708f630314 --- /dev/null +++ b/src/test/ui/proc-macro/proc-macro-gates.rs @@ -0,0 +1,61 @@ +// aux-build:proc-macro-gates.rs +// gate-test-proc_macro_hygiene + +#![feature(stmt_expr_attributes)] + +extern crate proc_macro_gates as foo; + +use foo::*; + +fn _test_inner() { + #![a] //~ ERROR: non-builtin inner attributes are unstable +} + +#[a] //~ ERROR: custom attributes cannot be applied to modules +mod _test2 {} + +mod _test2_inner { + #![a] //~ ERROR: custom attributes cannot be applied to modules + //~| ERROR: non-builtin inner attributes are unstable +} + +#[a = y] //~ ERROR: must only be followed by a delimiter token +fn _test3() {} + +fn attrs() { + // Statement, item + #[a] // OK + struct S; + + // Statement, macro + #[a] //~ ERROR: custom attributes cannot be applied to statements + println!(); + + // Statement, semi + #[a] //~ ERROR: custom attributes cannot be applied to statements + S; + + // Statement, local + #[a] //~ ERROR: custom attributes cannot be applied to statements + let _x = 2; + + // Expr + let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expressions + + // Opt expr + let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to expressions + + // Expr macro + let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applied to expressions +} + +fn main() { + let _x: m!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to types + if let m!(Some(_x)) = Some(3) {} //~ ERROR: procedural macros cannot be expanded to patterns + + m!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements + m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements + + let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expressions + let _x = [m!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions +} diff --git a/src/test/ui/proc-macro/proc-macro-gates.stderr b/src/test/ui/proc-macro/proc-macro-gates.stderr new file mode 100644 index 00000000000..c0bc06d358d --- /dev/null +++ b/src/test/ui/proc-macro/proc-macro-gates.stderr @@ -0,0 +1,137 @@ +error[E0658]: non-builtin inner attributes are unstable (see issue #54726) + --> $DIR/proc-macro-gates.rs:11:5 + | +LL | #![a] //~ ERROR: non-builtin inner attributes are unstable + | ^^^^^ + | + = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable + +error[E0658]: non-builtin inner attributes are unstable (see issue #54726) + --> $DIR/proc-macro-gates.rs:18:5 + | +LL | #![a] //~ ERROR: custom attributes cannot be applied to modules + | ^^^^^ + | + = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to modules (see issue #54727) + --> $DIR/proc-macro-gates.rs:14:1 + | +LL | #[a] //~ ERROR: custom attributes cannot be applied to modules + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to modules (see issue #54727) + --> $DIR/proc-macro-gates.rs:18:5 + | +LL | #![a] //~ ERROR: custom attributes cannot be applied to modules + | ^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error: custom attribute invocations must be of the form #[foo] or #[foo(..)], the macro name must only be followed by a delimiter token + --> $DIR/proc-macro-gates.rs:22:1 + | +LL | #[a = y] //~ ERROR: must only be followed by a delimiter token + | ^^^^^^^^ + +error[E0658]: custom attributes cannot be applied to statements (see issue #54727) + --> $DIR/proc-macro-gates.rs:31:5 + | +LL | #[a] //~ ERROR: custom attributes cannot be applied to statements + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to statements (see issue #54727) + --> $DIR/proc-macro-gates.rs:35:5 + | +LL | #[a] //~ ERROR: custom attributes cannot be applied to statements + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to statements (see issue #54727) + --> $DIR/proc-macro-gates.rs:39:5 + | +LL | #[a] //~ ERROR: custom attributes cannot be applied to statements + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to expressions (see issue #54727) + --> $DIR/proc-macro-gates.rs:43:14 + | +LL | let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expressions + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to expressions (see issue #54727) + --> $DIR/proc-macro-gates.rs:46:15 + | +LL | let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to expressions + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: custom attributes cannot be applied to expressions (see issue #54727) + --> $DIR/proc-macro-gates.rs:49:14 + | +LL | let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applied to expressions + | ^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot be expanded to types (see issue #54727) + --> $DIR/proc-macro-gates.rs:53:13 + | +LL | let _x: m!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to types + | ^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot be expanded to patterns (see issue #54727) + --> $DIR/proc-macro-gates.rs:54:12 + | +LL | if let m!(Some(_x)) = Some(3) {} //~ ERROR: procedural macros cannot be expanded to patterns + | ^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot be expanded to statements (see issue #54727) + --> $DIR/proc-macro-gates.rs:56:5 + | +LL | m!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements + | ^^^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot be expanded to statements (see issue #54727) + --> $DIR/proc-macro-gates.rs:57:5 + | +LL | m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements + | ^^^^^^^^^^^^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot be expanded to expressions (see issue #54727) + --> $DIR/proc-macro-gates.rs:59:14 + | +LL | let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expressions + | ^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error[E0658]: procedural macros cannot be expanded to expressions (see issue #54727) + --> $DIR/proc-macro-gates.rs:60:15 + | +LL | let _x = [m!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions + | ^^^^^ + | + = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable + +error: aborting due to 17 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/proc-macro-gates2.rs b/src/test/ui/proc-macro/proc-macro-gates2.rs new file mode 100644 index 00000000000..46b543a397c --- /dev/null +++ b/src/test/ui/proc-macro/proc-macro-gates2.rs @@ -0,0 +1,25 @@ +// aux-build:proc-macro-gates.rs + +#![feature(stmt_expr_attributes)] + +extern crate proc_macro_gates as foo; + +use foo::*; + +// NB. these errors aren't the best errors right now, but they're definitely +// intended to be errors. Somehow using a custom attribute in these positions +// should either require a feature gate or not be allowed on stable. + +fn _test6<#[a] T>() {} +//~^ ERROR: unknown to the compiler + +fn _test7() { + match 1 { + #[a] //~ ERROR: unknown to the compiler + 0 => {} + _ => {} + } +} + +fn main() { +} diff --git a/src/test/ui/proc-macro/proc-macro-gates2.stderr b/src/test/ui/proc-macro/proc-macro-gates2.stderr new file mode 100644 index 00000000000..262482aea34 --- /dev/null +++ b/src/test/ui/proc-macro/proc-macro-gates2.stderr @@ -0,0 +1,19 @@ +error[E0658]: The attribute `a` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/proc-macro-gates2.rs:13:11 + | +LL | fn _test6<#[a] T>() {} + | ^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error[E0658]: The attribute `a` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/proc-macro-gates2.rs:18:9 + | +LL | #[a] //~ ERROR: unknown to the compiler + | ^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/pub-at-crate-root.rs b/src/test/ui/proc-macro/pub-at-crate-root.rs new file mode 100644 index 00000000000..7544245ff67 --- /dev/null +++ b/src/test/ui/proc-macro/pub-at-crate-root.rs @@ -0,0 +1,22 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +pub mod a { //~ `proc-macro` crate types cannot export any items + use proc_macro::TokenStream; + + #[proc_macro_derive(B)] + pub fn bar(a: TokenStream) -> TokenStream { + //~^ ERROR: must currently reside in the root of the crate + a + } +} + +#[proc_macro_derive(B)] +fn bar(a: proc_macro::TokenStream) -> proc_macro::TokenStream { +//~^ ERROR: functions tagged with `#[proc_macro_derive]` must be `pub` + a +} diff --git a/src/test/ui/proc-macro/pub-at-crate-root.stderr b/src/test/ui/proc-macro/pub-at-crate-root.stderr new file mode 100644 index 00000000000..47be1c44d2d --- /dev/null +++ b/src/test/ui/proc-macro/pub-at-crate-root.stderr @@ -0,0 +1,32 @@ +error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently + --> $DIR/pub-at-crate-root.rs:8:1 + | +LL | / pub mod a { //~ `proc-macro` crate types cannot export any items +LL | | use proc_macro::TokenStream; +LL | | +LL | | #[proc_macro_derive(B)] +... | +LL | | } +LL | | } + | |_^ + +error: functions tagged with `#[proc_macro_derive]` must currently reside in the root of the crate + --> $DIR/pub-at-crate-root.rs:12:5 + | +LL | / pub fn bar(a: TokenStream) -> TokenStream { +LL | | //~^ ERROR: must currently reside in the root of the crate +LL | | a +LL | | } + | |_____^ + +error: functions tagged with `#[proc_macro_derive]` must be `pub` + --> $DIR/pub-at-crate-root.rs:19:1 + | +LL | / fn bar(a: proc_macro::TokenStream) -> proc_macro::TokenStream { +LL | | //~^ ERROR: functions tagged with `#[proc_macro_derive]` must be `pub` +LL | | a +LL | | } + | |_^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui-fulldeps/proc-macro/reserved-macro-names.rs b/src/test/ui/proc-macro/reserved-macro-names.rs similarity index 94% rename from src/test/ui-fulldeps/proc-macro/reserved-macro-names.rs rename to src/test/ui/proc-macro/reserved-macro-names.rs index ff5984aa67c..7c66af172fd 100644 --- a/src/test/ui-fulldeps/proc-macro/reserved-macro-names.rs +++ b/src/test/ui/proc-macro/reserved-macro-names.rs @@ -1,3 +1,6 @@ +// force-host +// no-prefer-dynamic + #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/proc-macro/reserved-macro-names.stderr b/src/test/ui/proc-macro/reserved-macro-names.stderr similarity index 80% rename from src/test/ui-fulldeps/proc-macro/reserved-macro-names.stderr rename to src/test/ui/proc-macro/reserved-macro-names.stderr index be6e80c3878..5ebe62a4969 100644 --- a/src/test/ui-fulldeps/proc-macro/reserved-macro-names.stderr +++ b/src/test/ui/proc-macro/reserved-macro-names.stderr @@ -1,17 +1,17 @@ error: name `cfg` is reserved in macro namespace - --> $DIR/reserved-macro-names.rs:7:8 + --> $DIR/reserved-macro-names.rs:10:8 | LL | pub fn cfg(_: TokenStream, input: TokenStream) -> TokenStream { | ^^^ error: name `cfg_attr` is reserved in macro namespace - --> $DIR/reserved-macro-names.rs:13:8 + --> $DIR/reserved-macro-names.rs:16:8 | LL | pub fn cfg_attr(_: TokenStream, input: TokenStream) -> TokenStream { | ^^^^^^^^ error: name `derive` is reserved in macro namespace - --> $DIR/reserved-macro-names.rs:19:8 + --> $DIR/reserved-macro-names.rs:22:8 | LL | pub fn derive(_: TokenStream, input: TokenStream) -> TokenStream { | ^^^^^^ diff --git a/src/test/ui/proc-macro/resolve-error.rs b/src/test/ui/proc-macro/resolve-error.rs new file mode 100644 index 00000000000..bb242f30249 --- /dev/null +++ b/src/test/ui/proc-macro/resolve-error.rs @@ -0,0 +1,60 @@ +// aux-build:derive-foo.rs +// aux-build:derive-clona.rs +// aux-build:attr_proc_macro.rs +// aux-build:bang_proc_macro.rs + +#![feature(custom_attribute)] + +#[macro_use] +extern crate derive_foo; +#[macro_use] +extern crate derive_clona; +extern crate attr_proc_macro; +extern crate bang_proc_macro; + +use attr_proc_macro::attr_proc_macro; +use bang_proc_macro::bang_proc_macro; + +macro_rules! FooWithLongNam { + () => {} +} + +macro_rules! attr_proc_mac { + () => {} +} + +#[derive(FooWithLongNan)] +//~^ ERROR cannot find +struct Foo; + +#[attr_proc_macra] // OK, interpreted as a custom attribute +struct Bar; + +#[FooWithLongNan] // OK, interpreted as a custom attribute +struct Asdf; + +#[derive(Dlone)] +//~^ ERROR cannot find +struct A; + +#[derive(Dlona)] +//~^ ERROR cannot find +struct B; + +#[derive(attr_proc_macra)] +//~^ ERROR cannot find +struct C; + +fn main() { + FooWithLongNama!(); + //~^ ERROR cannot find + + attr_proc_macra!(); + //~^ ERROR cannot find + + Dlona!(); + //~^ ERROR cannot find + + bang_proc_macrp!(); + //~^ ERROR cannot find +} diff --git a/src/test/ui-fulldeps/resolve-error.stderr b/src/test/ui/proc-macro/resolve-error.stderr similarity index 83% rename from src/test/ui-fulldeps/resolve-error.stderr rename to src/test/ui/proc-macro/resolve-error.stderr index 59ca668d485..1e7fd25d0da 100644 --- a/src/test/ui-fulldeps/resolve-error.stderr +++ b/src/test/ui/proc-macro/resolve-error.stderr @@ -1,47 +1,47 @@ error: cannot find derive macro `FooWithLongNan` in this scope - --> $DIR/resolve-error.rs:36:10 + --> $DIR/resolve-error.rs:26:10 | LL | #[derive(FooWithLongNan)] | ^^^^^^^^^^^^^^ help: try: `FooWithLongName` error: cannot find derive macro `Dlone` in this scope - --> $DIR/resolve-error.rs:46:10 + --> $DIR/resolve-error.rs:36:10 | LL | #[derive(Dlone)] | ^^^^^ help: try: `Clone` error: cannot find derive macro `Dlona` in this scope - --> $DIR/resolve-error.rs:50:10 + --> $DIR/resolve-error.rs:40:10 | LL | #[derive(Dlona)] | ^^^^^ help: try: `Clona` error: cannot find derive macro `attr_proc_macra` in this scope - --> $DIR/resolve-error.rs:54:10 + --> $DIR/resolve-error.rs:44:10 | LL | #[derive(attr_proc_macra)] | ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro` error: cannot find macro `FooWithLongNama!` in this scope - --> $DIR/resolve-error.rs:59:5 + --> $DIR/resolve-error.rs:49:5 | LL | FooWithLongNama!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam` error: cannot find macro `attr_proc_macra!` in this scope - --> $DIR/resolve-error.rs:62:5 + --> $DIR/resolve-error.rs:52:5 | LL | attr_proc_macra!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac` error: cannot find macro `Dlona!` in this scope - --> $DIR/resolve-error.rs:65:5 + --> $DIR/resolve-error.rs:55:5 | LL | Dlona!(); | ^^^^^ error: cannot find macro `bang_proc_macrp!` in this scope - --> $DIR/resolve-error.rs:68:5 + --> $DIR/resolve-error.rs:58:5 | LL | bang_proc_macrp!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro` diff --git a/src/test/ui/proc-macro/shadow-builtin.rs b/src/test/ui/proc-macro/shadow-builtin.rs new file mode 100644 index 00000000000..afcc0ebc346 --- /dev/null +++ b/src/test/ui/proc-macro/shadow-builtin.rs @@ -0,0 +1,14 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(PartialEq)] +//~^ ERROR: cannot override a built-in #[derive] mode +pub fn foo(input: TokenStream) -> TokenStream { + input +} diff --git a/src/test/ui/proc-macro/shadow-builtin.stderr b/src/test/ui/proc-macro/shadow-builtin.stderr new file mode 100644 index 00000000000..668579509dc --- /dev/null +++ b/src/test/ui/proc-macro/shadow-builtin.stderr @@ -0,0 +1,8 @@ +error: cannot override a built-in #[derive] mode + --> $DIR/shadow-builtin.rs:10:21 + | +LL | #[proc_macro_derive(PartialEq)] + | ^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/proc-macro/shadow.rs b/src/test/ui/proc-macro/shadow.rs new file mode 100644 index 00000000000..9c49bae28a3 --- /dev/null +++ b/src/test/ui/proc-macro/shadow.rs @@ -0,0 +1,8 @@ +// aux-build:derive-a.rs + +#[macro_use] +extern crate derive_a; +#[macro_use] +extern crate derive_a; //~ ERROR the name `derive_a` is defined multiple times + +fn main() {} diff --git a/src/test/ui/proc-macro/shadow.stderr b/src/test/ui/proc-macro/shadow.stderr new file mode 100644 index 00000000000..103c78126a8 --- /dev/null +++ b/src/test/ui/proc-macro/shadow.stderr @@ -0,0 +1,18 @@ +error[E0259]: the name `derive_a` is defined multiple times + --> $DIR/shadow.rs:6:1 + | +LL | extern crate derive_a; + | ---------------------- previous import of the extern crate `derive_a` here +LL | #[macro_use] +LL | extern crate derive_a; //~ ERROR the name `derive_a` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^^ `derive_a` reimported here + | + = note: `derive_a` must be defined only once in the type namespace of this module +help: you can use `as` to change the binding name of the import + | +LL | extern crate derive_a as other_derive_a; //~ ERROR the name `derive_a` is defined multiple times + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0259`. diff --git a/src/test/ui/proc-macro/signature.rs b/src/test/ui/proc-macro/signature.rs new file mode 100644 index 00000000000..dbc1577172f --- /dev/null +++ b/src/test/ui/proc-macro/signature.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![allow(warnings)] + +extern crate proc_macro; + +#[proc_macro_derive(A)] +pub unsafe extern fn foo(a: i32, b: u32) -> u32 { + //~^ ERROR: mismatched types + loop {} +} diff --git a/src/test/ui-fulldeps/proc-macro/signature.stderr b/src/test/ui/proc-macro/signature.stderr similarity index 94% rename from src/test/ui-fulldeps/proc-macro/signature.stderr rename to src/test/ui/proc-macro/signature.stderr index fdd10c3c5b9..99cb3316533 100644 --- a/src/test/ui-fulldeps/proc-macro/signature.stderr +++ b/src/test/ui/proc-macro/signature.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/signature.rs:17:1 + --> $DIR/signature.rs:10:1 | LL | / pub unsafe extern fn foo(a: i32, b: u32) -> u32 { LL | | //~^ ERROR: mismatched types diff --git a/src/test/ui/proc-macro/span-preservation.rs b/src/test/ui/proc-macro/span-preservation.rs new file mode 100644 index 00000000000..64f675ecc1c --- /dev/null +++ b/src/test/ui/proc-macro/span-preservation.rs @@ -0,0 +1,52 @@ +//~ ERROR mismatched types +// aux-build:span-preservation.rs + +// For each of these, we should get the appropriate type mismatch error message, +// and the function should be echoed. + +extern crate span_preservation as foo; + +use foo::foo; + +#[foo] +fn a() { + let x: usize = "hello";;;;; //~ ERROR mismatched types +} + +#[foo] +fn b(x: Option) -> usize { + match x { + Some(x) => { return x }, //~ ERROR mismatched types + None => 10 + } +} + +#[foo] +fn c() { + struct Foo { + a: usize + } + + struct Bar { + a: usize, + b: usize + } + + let x = Foo { a: 10isize }; //~ ERROR mismatched types + let y = Foo { a: 10, b: 10isize }; //~ ERROR has no field named `b` +} + +// FIXME: This doesn't work at the moment. See the one below. The pretty-printer +// injects a "C" between `extern` and `fn` which causes a "probably_eq" +// `TokenStream` mismatch. The lack of `"C"` should be preserved in the AST. +#[foo] +extern fn bar() { + 0 +} + +#[foo] +extern "C" fn baz() { + 0 //~ ERROR mismatched types +} + +fn main() {} diff --git a/src/test/ui/proc-macro/span-preservation.stderr b/src/test/ui/proc-macro/span-preservation.stderr new file mode 100644 index 00000000000..db524907b65 --- /dev/null +++ b/src/test/ui/proc-macro/span-preservation.stderr @@ -0,0 +1,52 @@ +error[E0308]: mismatched types + | + = note: expected type `()` + found type `{integer}` + +error[E0308]: mismatched types + --> $DIR/span-preservation.rs:13:20 + | +LL | let x: usize = "hello";;;;; //~ ERROR mismatched types + | ^^^^^^^ expected usize, found reference + | + = note: expected type `usize` + found type `&'static str` + +error[E0308]: mismatched types + --> $DIR/span-preservation.rs:19:29 + | +LL | fn b(x: Option) -> usize { + | ----- expected `usize` because of return type +LL | match x { +LL | Some(x) => { return x }, //~ ERROR mismatched types + | ^ expected usize, found isize + +error[E0308]: mismatched types + --> $DIR/span-preservation.rs:35:22 + | +LL | let x = Foo { a: 10isize }; //~ ERROR mismatched types + | ^^^^^^^ expected usize, found isize + +error[E0560]: struct `c::Foo` has no field named `b` + --> $DIR/span-preservation.rs:36:26 + | +LL | let y = Foo { a: 10, b: 10isize }; //~ ERROR has no field named `b` + | ^ `c::Foo` does not have this field + | + = note: available fields are: `a` + +error[E0308]: mismatched types + --> $DIR/span-preservation.rs:49:5 + | +LL | extern "C" fn baz() { + | - possibly return type missing here? +LL | 0 //~ ERROR mismatched types + | ^ expected (), found integer + | + = note: expected type `()` + found type `{integer}` + +error: aborting due to 6 previous errors + +Some errors occurred: E0308, E0560. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/proc-macro/subspan.rs b/src/test/ui/proc-macro/subspan.rs new file mode 100644 index 00000000000..a4187f9e7c2 --- /dev/null +++ b/src/test/ui/proc-macro/subspan.rs @@ -0,0 +1,26 @@ +// aux-build:subspan.rs + +extern crate subspan; + +use subspan::subspan; + +// This one emits no error. +subspan!(""); + +// Exactly one 'hi'. +subspan!("hi"); //~ ERROR found 'hi's + +// Now two, back to back. +subspan!("hihi"); //~ ERROR found 'hi's + +// Now three, back to back. +subspan!("hihihi"); //~ ERROR found 'hi's + +// Now several, with spacing. +subspan!("why I hide? hi!"); //~ ERROR found 'hi's +subspan!("hey, hi, hidy, hidy, hi hi"); //~ ERROR found 'hi's +subspan!("this is a hi, and this is another hi"); //~ ERROR found 'hi's +subspan!("how are you this evening"); //~ ERROR found 'hi's +subspan!("this is highly eradic"); //~ ERROR found 'hi's + +fn main() { } diff --git a/src/test/ui/proc-macro/subspan.stderr b/src/test/ui/proc-macro/subspan.stderr new file mode 100644 index 00000000000..94f1be6021f --- /dev/null +++ b/src/test/ui/proc-macro/subspan.stderr @@ -0,0 +1,98 @@ +error: found 'hi's + --> $DIR/subspan.rs:11:1 + | +LL | subspan!("hi"); //~ ERROR found 'hi's + | ^^^^^^^^^^^^^^^ + | +note: here + --> $DIR/subspan.rs:11:11 + | +LL | subspan!("hi"); //~ ERROR found 'hi's + | ^^ + +error: found 'hi's + --> $DIR/subspan.rs:14:1 + | +LL | subspan!("hihi"); //~ ERROR found 'hi's + | ^^^^^^^^^^^^^^^^^ + | +note: here + --> $DIR/subspan.rs:14:11 + | +LL | subspan!("hihi"); //~ ERROR found 'hi's + | ^^^^ + +error: found 'hi's + --> $DIR/subspan.rs:17:1 + | +LL | subspan!("hihihi"); //~ ERROR found 'hi's + | ^^^^^^^^^^^^^^^^^^^ + | +note: here + --> $DIR/subspan.rs:17:11 + | +LL | subspan!("hihihi"); //~ ERROR found 'hi's + | ^^^^^^ + +error: found 'hi's + --> $DIR/subspan.rs:20:1 + | +LL | subspan!("why I hide? hi!"); //~ ERROR found 'hi's + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: here + --> $DIR/subspan.rs:20:17 + | +LL | subspan!("why I hide? hi!"); //~ ERROR found 'hi's + | ^^ ^^ + +error: found 'hi's + --> $DIR/subspan.rs:21:1 + | +LL | subspan!("hey, hi, hidy, hidy, hi hi"); //~ ERROR found 'hi's + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: here + --> $DIR/subspan.rs:21:16 + | +LL | subspan!("hey, hi, hidy, hidy, hi hi"); //~ ERROR found 'hi's + | ^^ ^^ ^^ ^^ ^^ + +error: found 'hi's + --> $DIR/subspan.rs:22:1 + | +LL | subspan!("this is a hi, and this is another hi"); //~ ERROR found 'hi's + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: here + --> $DIR/subspan.rs:22:12 + | +LL | subspan!("this is a hi, and this is another hi"); //~ ERROR found 'hi's + | ^^ ^^ ^^ ^^ + +error: found 'hi's + --> $DIR/subspan.rs:23:1 + | +LL | subspan!("how are you this evening"); //~ ERROR found 'hi's + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: here + --> $DIR/subspan.rs:23:24 + | +LL | subspan!("how are you this evening"); //~ ERROR found 'hi's + | ^^ + +error: found 'hi's + --> $DIR/subspan.rs:24:1 + | +LL | subspan!("this is highly eradic"); //~ ERROR found 'hi's + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: here + --> $DIR/subspan.rs:24:12 + | +LL | subspan!("this is highly eradic"); //~ ERROR found 'hi's + | ^^ ^^ + +error: aborting due to 8 previous errors + diff --git a/src/test/ui/proc-macro/three-equals.rs b/src/test/ui/proc-macro/three-equals.rs new file mode 100644 index 00000000000..50a144f7960 --- /dev/null +++ b/src/test/ui/proc-macro/three-equals.rs @@ -0,0 +1,28 @@ +// aux-build:three-equals.rs + + +#![feature(proc_macro_hygiene)] + +extern crate three_equals; + +use three_equals::three_equals; + +fn main() { + // This one is okay. + three_equals!(===); + + // Need exactly three equals. + three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3 + + // Need exactly three equals. + three_equals!(=====); //~ ERROR expected EOF + + // Only equals accepted. + three_equals!(abc); //~ ERROR expected `=` + + // Only equals accepted. + three_equals!(!!); //~ ERROR expected `=` + + // Only three characters expected. + three_equals!(===a); //~ ERROR expected EOF +} diff --git a/src/test/ui-fulldeps/proc-macro/three-equals.stderr b/src/test/ui/proc-macro/three-equals.stderr similarity index 81% rename from src/test/ui-fulldeps/proc-macro/three-equals.stderr rename to src/test/ui/proc-macro/three-equals.stderr index 1a0337f93f9..e38343348dd 100644 --- a/src/test/ui-fulldeps/proc-macro/three-equals.stderr +++ b/src/test/ui/proc-macro/three-equals.stderr @@ -1,5 +1,5 @@ error: found 2 equal signs, need exactly 3 - --> $DIR/three-equals.rs:25:5 + --> $DIR/three-equals.rs:15:5 | LL | three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3 | ^^^^^^^^^^^^^^^^^^ @@ -7,38 +7,38 @@ LL | three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3 = help: input must be: `===` error: expected EOF, found `=`. - --> $DIR/three-equals.rs:28:21 + --> $DIR/three-equals.rs:18:21 | LL | three_equals!(=====); //~ ERROR expected EOF | ^^ | note: last good input was here - --> $DIR/three-equals.rs:28:21 + --> $DIR/three-equals.rs:18:21 | LL | three_equals!(=====); //~ ERROR expected EOF | ^^ = help: input must be: `===` error: expected `=`, found `abc`. - --> $DIR/three-equals.rs:31:19 + --> $DIR/three-equals.rs:21:19 | LL | three_equals!(abc); //~ ERROR expected `=` | ^^^ error: expected `=`, found `!`. - --> $DIR/three-equals.rs:34:19 + --> $DIR/three-equals.rs:24:19 | LL | three_equals!(!!); //~ ERROR expected `=` | ^ error: expected EOF, found `a`. - --> $DIR/three-equals.rs:37:22 + --> $DIR/three-equals.rs:27:22 | LL | three_equals!(===a); //~ ERROR expected EOF | ^ | note: last good input was here - --> $DIR/three-equals.rs:37:21 + --> $DIR/three-equals.rs:27:21 | LL | three_equals!(===a); //~ ERROR expected EOF | ^ diff --git a/src/test/ui/proc-macro/two-crate-types-1.rs b/src/test/ui/proc-macro/two-crate-types-1.rs new file mode 100644 index 00000000000..80bfd357f07 --- /dev/null +++ b/src/test/ui/proc-macro/two-crate-types-1.rs @@ -0,0 +1,7 @@ +// error-pattern: cannot mix `proc-macro` crate type with others + +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![crate_type = "rlib"] diff --git a/src/test/ui/proc-macro/two-crate-types-1.stderr b/src/test/ui/proc-macro/two-crate-types-1.stderr new file mode 100644 index 00000000000..deaba1cf272 --- /dev/null +++ b/src/test/ui/proc-macro/two-crate-types-1.stderr @@ -0,0 +1,4 @@ +error: cannot mix `proc-macro` crate type with others + +error: aborting due to previous error + diff --git a/src/test/ui/proc-macro/two-crate-types-2.rs b/src/test/ui/proc-macro/two-crate-types-2.rs new file mode 100644 index 00000000000..39cbf7d3b72 --- /dev/null +++ b/src/test/ui/proc-macro/two-crate-types-2.rs @@ -0,0 +1,3 @@ +// error-pattern: cannot mix `proc-macro` crate type with others +// compile-flags: --crate-type rlib --crate-type proc-macro +// force-host diff --git a/src/test/ui/proc-macro/two-crate-types-2.stderr b/src/test/ui/proc-macro/two-crate-types-2.stderr new file mode 100644 index 00000000000..deaba1cf272 --- /dev/null +++ b/src/test/ui/proc-macro/two-crate-types-2.stderr @@ -0,0 +1,4 @@ +error: cannot mix `proc-macro` crate type with others + +error: aborting due to previous error + diff --git a/src/test/ui/ptr-coercion.rs b/src/test/ui/ptr-coercion.rs index 1390c9507c1..d1ef88b50e3 100644 --- a/src/test/ui/ptr-coercion.rs +++ b/src/test/ui/ptr-coercion.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test coercions between pointers which don't do anything fancy like unsizing. // These are testing that we don't lose mutability when converting to raw pointers. diff --git a/src/test/ui/ptr-coercion.stderr b/src/test/ui/ptr-coercion.stderr index c5ed80db1a8..2499e90db7d 100644 --- a/src/test/ui/ptr-coercion.stderr +++ b/src/test/ui/ptr-coercion.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/ptr-coercion.rs:17:25 + --> $DIR/ptr-coercion.rs:7:25 | LL | let x: *mut isize = x; //~ ERROR mismatched types | ^ types differ in mutability @@ -8,7 +8,7 @@ LL | let x: *mut isize = x; //~ ERROR mismatched types found type `*const isize` error[E0308]: mismatched types - --> $DIR/ptr-coercion.rs:23:25 + --> $DIR/ptr-coercion.rs:13:25 | LL | let x: *mut isize = &42; //~ ERROR mismatched types | ^^^ types differ in mutability @@ -17,7 +17,7 @@ LL | let x: *mut isize = &42; //~ ERROR mismatched types found type `&isize` error[E0308]: mismatched types - --> $DIR/ptr-coercion.rs:29:25 + --> $DIR/ptr-coercion.rs:19:25 | LL | let x: *mut isize = x; //~ ERROR mismatched types | ^ types differ in mutability diff --git a/src/test/ui/pub/issue-33174-restricted-type-in-public-interface.rs b/src/test/ui/pub/issue-33174-restricted-type-in-public-interface.rs index ec3f48f0347..45dfb639922 100644 --- a/src/test/ui/pub/issue-33174-restricted-type-in-public-interface.rs +++ b/src/test/ui/pub/issue-33174-restricted-type-in-public-interface.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(non_camel_case_types)] // genus is always capitalized pub(crate) struct Snail; diff --git a/src/test/ui/pub/issue-33174-restricted-type-in-public-interface.stderr b/src/test/ui/pub/issue-33174-restricted-type-in-public-interface.stderr index b35a12f999c..ae9a33e9443 100644 --- a/src/test/ui/pub/issue-33174-restricted-type-in-public-interface.stderr +++ b/src/test/ui/pub/issue-33174-restricted-type-in-public-interface.stderr @@ -1,5 +1,5 @@ error[E0446]: crate-visible type `Snail` in public interface - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:28:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:18:1 | LL | pub(crate) struct Snail; | ---------- `Snail` declared as crate-visible @@ -8,7 +8,7 @@ LL | pub type Helix_pomatia = Shell; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak crate-visible type error[E0446]: restricted type `sea::Turtle` in public interface - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:31:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:21:1 | LL | pub(super) struct Turtle; | ---------- `sea::Turtle` declared as restricted @@ -17,7 +17,7 @@ LL | pub type Dermochelys_coriacea = Shell; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak restricted type error[E0446]: private type `Tortoise` in public interface - --> $DIR/issue-33174-restricted-type-in-public-interface.rs:34:1 + --> $DIR/issue-33174-restricted-type-in-public-interface.rs:24:1 | LL | struct Tortoise; | - `Tortoise` declared as private diff --git a/src/test/ui/pub/pub-ident-fn-2.rs b/src/test/ui/pub/pub-ident-fn-2.rs index 44884bfcdfd..e1fc20c6577 100644 --- a/src/test/ui/pub/pub-ident-fn-2.rs +++ b/src/test/ui/pub/pub-ident-fn-2.rs @@ -1,15 +1,5 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub foo(s: usize) { bar() } -//~^ ERROR missing `fn` for method definition +//~^ ERROR missing `fn` for function definition fn main() { foo(2); diff --git a/src/test/ui/pub/pub-ident-fn-2.stderr b/src/test/ui/pub/pub-ident-fn-2.stderr index bbbb3df8769..69b273df031 100644 --- a/src/test/ui/pub/pub-ident-fn-2.stderr +++ b/src/test/ui/pub/pub-ident-fn-2.stderr @@ -1,9 +1,9 @@ -error: missing `fn` for method definition - --> $DIR/pub-ident-fn-2.rs:11:4 +error: missing `fn` for function definition + --> $DIR/pub-ident-fn-2.rs:1:4 | LL | pub foo(s: usize) { bar() } | ^ -help: add `fn` here to parse `foo` as a public method +help: add `fn` here to parse `foo` as a public function | LL | pub fn foo(s: usize) { bar() } | ^^ diff --git a/src/test/ui/pub/pub-ident-fn-or-struct-2.rs b/src/test/ui/pub/pub-ident-fn-or-struct-2.rs index 1ccadc8a40b..8f67cdd2933 100644 --- a/src/test/ui/pub/pub-ident-fn-or-struct-2.rs +++ b/src/test/ui/pub/pub-ident-fn-or-struct-2.rs @@ -1,14 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub S(); -//~^ ERROR missing `fn` or `struct` for method or struct definition +//~^ ERROR missing `fn` or `struct` for function or struct definition fn main() {} diff --git a/src/test/ui/pub/pub-ident-fn-or-struct-2.stderr b/src/test/ui/pub/pub-ident-fn-or-struct-2.stderr index e492a8c4756..047e66b18d8 100644 --- a/src/test/ui/pub/pub-ident-fn-or-struct-2.stderr +++ b/src/test/ui/pub/pub-ident-fn-or-struct-2.stderr @@ -1,5 +1,5 @@ -error: missing `fn` or `struct` for method or struct definition - --> $DIR/pub-ident-fn-or-struct-2.rs:11:4 +error: missing `fn` or `struct` for function or struct definition + --> $DIR/pub-ident-fn-or-struct-2.rs:1:4 | LL | pub S(); | ---^- help: if you meant to call a macro, try: `S!` diff --git a/src/test/ui/pub/pub-ident-fn-or-struct.rs b/src/test/ui/pub/pub-ident-fn-or-struct.rs index 0664918945b..832831d2920 100644 --- a/src/test/ui/pub/pub-ident-fn-or-struct.rs +++ b/src/test/ui/pub/pub-ident-fn-or-struct.rs @@ -1,14 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub S (foo) bar -//~^ ERROR missing `fn` or `struct` for method or struct definition +//~^ ERROR missing `fn` or `struct` for function or struct definition fn main() {} diff --git a/src/test/ui/pub/pub-ident-fn-or-struct.stderr b/src/test/ui/pub/pub-ident-fn-or-struct.stderr index c1bff34cec3..c4a196eb2c2 100644 --- a/src/test/ui/pub/pub-ident-fn-or-struct.stderr +++ b/src/test/ui/pub/pub-ident-fn-or-struct.stderr @@ -1,5 +1,5 @@ -error: missing `fn` or `struct` for method or struct definition - --> $DIR/pub-ident-fn-or-struct.rs:11:4 +error: missing `fn` or `struct` for function or struct definition + --> $DIR/pub-ident-fn-or-struct.rs:1:4 | LL | pub S (foo) bar | ---^- help: if you meant to call a macro, try: `S!` diff --git a/src/test/ui/pub/pub-ident-fn-with-lifetime-2.rs b/src/test/ui/pub/pub-ident-fn-with-lifetime-2.rs new file mode 100644 index 00000000000..1ee8c84f13b --- /dev/null +++ b/src/test/ui/pub/pub-ident-fn-with-lifetime-2.rs @@ -0,0 +1,6 @@ +pub bar<'a>(&self, _s: &'a usize) -> bool { true } +//~^ ERROR missing `fn` for method definition + +fn main() { + bar(2); +} diff --git a/src/test/ui/pub/pub-ident-fn-with-lifetime-2.stderr b/src/test/ui/pub/pub-ident-fn-with-lifetime-2.stderr new file mode 100644 index 00000000000..c403774df8e --- /dev/null +++ b/src/test/ui/pub/pub-ident-fn-with-lifetime-2.stderr @@ -0,0 +1,12 @@ +error: missing `fn` for method definition + --> $DIR/pub-ident-fn-with-lifetime-2.rs:1:4 + | +LL | pub bar<'a>(&self, _s: &'a usize) -> bool { true } + | ^^^ +help: add `fn` here to parse `bar` as a public method + | +LL | pub fn bar<'a>(&self, _s: &'a usize) -> bool { true } + | ^^ + +error: aborting due to previous error + diff --git a/src/test/ui/pub/pub-ident-fn-with-lifetime.rs b/src/test/ui/pub/pub-ident-fn-with-lifetime.rs new file mode 100644 index 00000000000..84f7bdc1fb1 --- /dev/null +++ b/src/test/ui/pub/pub-ident-fn-with-lifetime.rs @@ -0,0 +1,6 @@ +pub foo<'a>(_s: &'a usize) -> bool { true } +//~^ ERROR missing `fn` for function definition + +fn main() { + foo(2); +} diff --git a/src/test/ui/pub/pub-ident-fn-with-lifetime.stderr b/src/test/ui/pub/pub-ident-fn-with-lifetime.stderr new file mode 100644 index 00000000000..85823809640 --- /dev/null +++ b/src/test/ui/pub/pub-ident-fn-with-lifetime.stderr @@ -0,0 +1,12 @@ +error: missing `fn` for function definition + --> $DIR/pub-ident-fn-with-lifetime.rs:1:4 + | +LL | pub foo<'a>(_s: &'a usize) -> bool { true } + | ^^^ +help: add `fn` here to parse `foo` as a public function + | +LL | pub fn foo<'a>(_s: &'a usize) -> bool { true } + | ^^ + +error: aborting due to previous error + diff --git a/src/test/ui/pub/pub-ident-fn.fixed b/src/test/ui/pub/pub-ident-fn.fixed index f2d0c6c3e1d..65ed8c7b4dd 100644 --- a/src/test/ui/pub/pub-ident-fn.fixed +++ b/src/test/ui/pub/pub-ident-fn.fixed @@ -1,17 +1,7 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix pub fn foo(_s: usize) -> bool { true } -//~^ ERROR missing `fn` for method definition +//~^ ERROR missing `fn` for function definition fn main() { foo(2); diff --git a/src/test/ui/pub/pub-ident-fn.rs b/src/test/ui/pub/pub-ident-fn.rs index 82c32f57eea..2fe4d34fb22 100644 --- a/src/test/ui/pub/pub-ident-fn.rs +++ b/src/test/ui/pub/pub-ident-fn.rs @@ -1,17 +1,7 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix pub foo(_s: usize) -> bool { true } -//~^ ERROR missing `fn` for method definition +//~^ ERROR missing `fn` for function definition fn main() { foo(2); diff --git a/src/test/ui/pub/pub-ident-fn.stderr b/src/test/ui/pub/pub-ident-fn.stderr index f7c96b8b9f4..b5ab88b8ccf 100644 --- a/src/test/ui/pub/pub-ident-fn.stderr +++ b/src/test/ui/pub/pub-ident-fn.stderr @@ -1,9 +1,9 @@ -error: missing `fn` for method definition - --> $DIR/pub-ident-fn.rs:13:4 +error: missing `fn` for function definition + --> $DIR/pub-ident-fn.rs:3:4 | LL | pub foo(_s: usize) -> bool { true } | ^^^ -help: add `fn` here to parse `foo` as a public method +help: add `fn` here to parse `foo` as a public function | LL | pub fn foo(_s: usize) -> bool { true } | ^^ diff --git a/src/test/ui/pub/pub-ident-struct-with-lifetime.rs b/src/test/ui/pub/pub-ident-struct-with-lifetime.rs new file mode 100644 index 00000000000..2feb0266070 --- /dev/null +++ b/src/test/ui/pub/pub-ident-struct-with-lifetime.rs @@ -0,0 +1,4 @@ +pub S<'a> { +//~^ ERROR missing `struct` for struct definition +} +fn main() {} diff --git a/src/test/ui/pub/pub-ident-struct-with-lifetime.stderr b/src/test/ui/pub/pub-ident-struct-with-lifetime.stderr new file mode 100644 index 00000000000..2bbcf5dfff0 --- /dev/null +++ b/src/test/ui/pub/pub-ident-struct-with-lifetime.stderr @@ -0,0 +1,12 @@ +error: missing `struct` for struct definition + --> $DIR/pub-ident-struct-with-lifetime.rs:1:4 + | +LL | pub S<'a> { + | ^ +help: add `struct` here to parse `S` as a public struct + | +LL | pub struct S<'a> { + | ^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/pub/pub-ident-struct.rs b/src/test/ui/pub/pub-ident-struct.rs index d08d498f87a..f2e6dfc77b6 100644 --- a/src/test/ui/pub/pub-ident-struct.rs +++ b/src/test/ui/pub/pub-ident-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub S { //~^ ERROR missing `struct` for struct definition } diff --git a/src/test/ui/pub/pub-ident-struct.stderr b/src/test/ui/pub/pub-ident-struct.stderr index cd53cea7212..a9f2f89edd9 100644 --- a/src/test/ui/pub/pub-ident-struct.stderr +++ b/src/test/ui/pub/pub-ident-struct.stderr @@ -1,5 +1,5 @@ error: missing `struct` for struct definition - --> $DIR/pub-ident-struct.rs:11:4 + --> $DIR/pub-ident-struct.rs:1:4 | LL | pub S { | ^ diff --git a/src/test/ui/pub/pub-ident-with-lifetime-incomplete.rs b/src/test/ui/pub/pub-ident-with-lifetime-incomplete.rs new file mode 100644 index 00000000000..c86a9f2fdd6 --- /dev/null +++ b/src/test/ui/pub/pub-ident-with-lifetime-incomplete.rs @@ -0,0 +1,5 @@ +fn main() { +} + +pub foo<'a> +//~^ ERROR missing `fn` or `struct` for function or struct definition diff --git a/src/test/ui/pub/pub-ident-with-lifetime-incomplete.stderr b/src/test/ui/pub/pub-ident-with-lifetime-incomplete.stderr new file mode 100644 index 00000000000..0e0b127054d --- /dev/null +++ b/src/test/ui/pub/pub-ident-with-lifetime-incomplete.stderr @@ -0,0 +1,8 @@ +error: missing `fn` or `struct` for function or struct definition + --> $DIR/pub-ident-with-lifetime-incomplete.rs:4:4 + | +LL | pub foo<'a> + | ^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/pub/pub-reexport-priv-extern-crate.rs b/src/test/ui/pub/pub-reexport-priv-extern-crate.rs index 2e71e007e9e..e95d6924026 100644 --- a/src/test/ui/pub/pub-reexport-priv-extern-crate.rs +++ b/src/test/ui/pub/pub-reexport-priv-extern-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] extern crate core; diff --git a/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr b/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr index d298542bd5d..e895d51a848 100644 --- a/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr +++ b/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr @@ -1,5 +1,5 @@ error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub` - --> $DIR/pub-reexport-priv-extern-crate.rs:14:9 + --> $DIR/pub-reexport-priv-extern-crate.rs:4:9 | LL | pub use core as reexported_core; //~ ERROR `core` is private, and cannot be re-exported | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | pub use core as reexported_core; //~ ERROR `core` is private, and cannot be = note: for more information, see issue #34537 error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub` - --> $DIR/pub-reexport-priv-extern-crate.rs:22:9 + --> $DIR/pub-reexport-priv-extern-crate.rs:12:9 | LL | use foo1::core; //~ ERROR `core` is private, and cannot be re-exported | ^^^^^^^^^^ @@ -18,7 +18,7 @@ LL | use foo1::core; //~ ERROR `core` is private, and cannot be re-exported = note: for more information, see issue #34537 error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub` - --> $DIR/pub-reexport-priv-extern-crate.rs:30:13 + --> $DIR/pub-reexport-priv-extern-crate.rs:20:13 | LL | pub use foo2::bar::core; //~ ERROR `core` is private, and cannot be re-exported | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/pub/pub-restricted-error-fn.rs b/src/test/ui/pub/pub-restricted-error-fn.rs index 58f3d379ed9..56ee02f517c 100644 --- a/src/test/ui/pub/pub-restricted-error-fn.rs +++ b/src/test/ui/pub/pub-restricted-error-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(pub_restricted)] pub(crate) () fn foo() {} //~ unmatched visibility diff --git a/src/test/ui/pub/pub-restricted-error-fn.stderr b/src/test/ui/pub/pub-restricted-error-fn.stderr index aa8b0eaf79f..86fe1b2186f 100644 --- a/src/test/ui/pub/pub-restricted-error-fn.stderr +++ b/src/test/ui/pub/pub-restricted-error-fn.stderr @@ -1,5 +1,5 @@ error: unmatched visibility `pub` - --> $DIR/pub-restricted-error-fn.rs:13:10 + --> $DIR/pub-restricted-error-fn.rs:3:10 | LL | pub(crate) () fn foo() {} //~ unmatched visibility | ^ diff --git a/src/test/ui/pub/pub-restricted-error.rs b/src/test/ui/pub/pub-restricted-error.rs index 4822d01a591..30a112d2271 100644 --- a/src/test/ui/pub/pub-restricted-error.rs +++ b/src/test/ui/pub/pub-restricted-error.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(pub_restricted)] struct Bar(pub(())); diff --git a/src/test/ui/pub/pub-restricted-error.stderr b/src/test/ui/pub/pub-restricted-error.stderr index e40cd58f87a..ca720279946 100644 --- a/src/test/ui/pub/pub-restricted-error.stderr +++ b/src/test/ui/pub/pub-restricted-error.stderr @@ -1,5 +1,5 @@ error: expected identifier, found `(` - --> $DIR/pub-restricted-error.rs:16:16 + --> $DIR/pub-restricted-error.rs:6:16 | LL | pub(crate) () foo: usize, //~ ERROR expected identifier | ^ expected identifier diff --git a/src/test/ui/pub/pub-restricted-non-path.rs b/src/test/ui/pub/pub-restricted-non-path.rs index 11428b778ed..bdad18dbe65 100644 --- a/src/test/ui/pub/pub-restricted-non-path.rs +++ b/src/test/ui/pub/pub-restricted-non-path.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(pub_restricted)] pub (.) fn afn() {} //~ ERROR expected identifier diff --git a/src/test/ui/pub/pub-restricted-non-path.stderr b/src/test/ui/pub/pub-restricted-non-path.stderr index fc3ca7e93df..526e964f8ee 100644 --- a/src/test/ui/pub/pub-restricted-non-path.stderr +++ b/src/test/ui/pub/pub-restricted-non-path.stderr @@ -1,5 +1,5 @@ error: expected identifier, found `.` - --> $DIR/pub-restricted-non-path.rs:13:6 + --> $DIR/pub-restricted-non-path.rs:3:6 | LL | pub (.) fn afn() {} //~ ERROR expected identifier | ^ expected identifier diff --git a/src/test/ui/pub/pub-restricted.rs b/src/test/ui/pub/pub-restricted.rs index 07184d935b4..8793cb9d335 100644 --- a/src/test/ui/pub/pub-restricted.rs +++ b/src/test/ui/pub/pub-restricted.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(pub_restricted)] mod a {} diff --git a/src/test/ui/pub/pub-restricted.stderr b/src/test/ui/pub/pub-restricted.stderr index de755dd6a46..40cf398023b 100644 --- a/src/test/ui/pub/pub-restricted.stderr +++ b/src/test/ui/pub/pub-restricted.stderr @@ -1,5 +1,5 @@ error[E0704]: incorrect visibility restriction - --> $DIR/pub-restricted.rs:15:6 + --> $DIR/pub-restricted.rs:5:6 | LL | pub (a) fn afn() {} //~ incorrect visibility restriction | ^ help: make this visible only to module `a` with `in`: `in a` @@ -10,7 +10,7 @@ LL | pub (a) fn afn() {} //~ incorrect visibility restriction `pub(in path::to::module)`: visible only on the specified path error[E0704]: incorrect visibility restriction - --> $DIR/pub-restricted.rs:16:6 + --> $DIR/pub-restricted.rs:6:6 | LL | pub (b) fn bfn() {} //~ incorrect visibility restriction | ^ help: make this visible only to module `b` with `in`: `in b` @@ -21,7 +21,7 @@ LL | pub (b) fn bfn() {} //~ incorrect visibility restriction `pub(in path::to::module)`: visible only on the specified path error[E0704]: incorrect visibility restriction - --> $DIR/pub-restricted.rs:32:14 + --> $DIR/pub-restricted.rs:22:14 | LL | pub (a) invalid: usize, //~ incorrect visibility restriction | ^ help: make this visible only to module `a` with `in`: `in a` @@ -32,7 +32,7 @@ LL | pub (a) invalid: usize, //~ incorrect visibility restriction `pub(in path::to::module)`: visible only on the specified path error[E0704]: incorrect visibility restriction - --> $DIR/pub-restricted.rs:41:6 + --> $DIR/pub-restricted.rs:31:6 | LL | pub (xyz) fn xyz() {} //~ incorrect visibility restriction | ^^^ help: make this visible only to module `xyz` with `in`: `in xyz` @@ -43,7 +43,7 @@ LL | pub (xyz) fn xyz() {} //~ incorrect visibility restriction `pub(in path::to::module)`: visible only on the specified path error: visibilities can only be restricted to ancestor modules - --> $DIR/pub-restricted.rs:33:17 + --> $DIR/pub-restricted.rs:23:17 | LL | pub (in x) non_parent_invalid: usize, //~ ERROR visibilities can only be restricted | ^ diff --git a/src/test/ui/qualified/qualified-path-params-2.rs b/src/test/ui/qualified/qualified-path-params-2.rs index b0dd1f2518c..8412983fda5 100644 --- a/src/test/ui/qualified/qualified-path-params-2.rs +++ b/src/test/ui/qualified/qualified-path-params-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that qualified paths with type parameters // fail during type checking and not during parsing @@ -26,7 +16,7 @@ impl S { } type A = ::A::f; -//~^ ERROR type parameters are not allowed on this type +//~^ ERROR type arguments are not allowed on this entity //~| ERROR ambiguous associated type fn main() {} diff --git a/src/test/ui/qualified/qualified-path-params-2.stderr b/src/test/ui/qualified/qualified-path-params-2.stderr index 70aac779103..4e073841b97 100644 --- a/src/test/ui/qualified/qualified-path-params-2.stderr +++ b/src/test/ui/qualified/qualified-path-params-2.stderr @@ -1,11 +1,11 @@ -error[E0109]: type parameters are not allowed on this type - --> $DIR/qualified-path-params-2.rs:28:26 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/qualified-path-params-2.rs:18:26 | LL | type A = ::A::f; - | ^^ type parameter not allowed + | ^^ type argument not allowed error[E0223]: ambiguous associated type - --> $DIR/qualified-path-params-2.rs:28:10 + --> $DIR/qualified-path-params-2.rs:18:10 | LL | type A = ::A::f; | ^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<::A as Trait>::f` diff --git a/src/test/ui/qualified/qualified-path-params.rs b/src/test/ui/qualified/qualified-path-params.rs index 018a3b2ae32..ea2ae0e86bf 100644 --- a/src/test/ui/qualified/qualified-path-params.rs +++ b/src/test/ui/qualified/qualified-path-params.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that qualified paths with type parameters // fail during type checking and not during parsing diff --git a/src/test/ui/qualified/qualified-path-params.stderr b/src/test/ui/qualified/qualified-path-params.stderr index e76c373eec5..18fca2e3046 100644 --- a/src/test/ui/qualified/qualified-path-params.stderr +++ b/src/test/ui/qualified/qualified-path-params.stderr @@ -1,11 +1,11 @@ error[E0533]: expected unit struct/variant or constant, found method `<::A>::f` - --> $DIR/qualified-path-params.rs:30:9 + --> $DIR/qualified-path-params.rs:20:9 | LL | ::A::f:: => {} | ^^^^^^^^^^^^^^^^^^^^^ error[E0029]: only char and numeric types are allowed in range patterns - --> $DIR/qualified-path-params.rs:32:15 + --> $DIR/qualified-path-params.rs:22:15 | LL | 0 ..= ::A::f:: => {} //~ ERROR only char and numeric types are allowed in range | ^^^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types diff --git a/src/test/ui/question-mark-type-infer.rs b/src/test/ui/question-mark-type-infer.rs index e15c9af41e0..2e7a342b95e 100644 --- a/src/test/ui/question-mark-type-infer.rs +++ b/src/test/ui/question-mark-type-infer.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(question_mark, question_mark_carrier)] // Test that type inference fails where there are multiple possible return types diff --git a/src/test/ui/question-mark-type-infer.stderr b/src/test/ui/question-mark-type-infer.stderr index 53848ed0727..c998bdc086f 100644 --- a/src/test/ui/question-mark-type-infer.stderr +++ b/src/test/ui/question-mark-type-infer.stderr @@ -1,5 +1,5 @@ error[E0284]: type annotations required: cannot resolve `<_ as std::ops::Try>::Ok == _` - --> $DIR/question-mark-type-infer.rs:22:5 + --> $DIR/question-mark-type-infer.rs:12:5 | LL | l.iter().map(f).collect()? //~ ERROR type annotations required: cannot resolve | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/quote-with-interpolated.rs b/src/test/ui/quote-with-interpolated.rs deleted file mode 100644 index 1fafb1c7a1b..00000000000 --- a/src/test/ui/quote-with-interpolated.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(quote)] -fn main() { - macro_rules! foo { - ($bar:expr) => { - quote_expr!(cx, $bar) //~ ERROR quote! with interpolated token - } - } - foo!(bar); -} diff --git a/src/test/ui/quote-with-interpolated.stderr b/src/test/ui/quote-with-interpolated.stderr deleted file mode 100644 index 10b3fc0a9ae..00000000000 --- a/src/test/ui/quote-with-interpolated.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: quote! with interpolated token - --> $DIR/quote-with-interpolated.rs:15:29 - | -LL | quote_expr!(cx, $bar) //~ ERROR quote! with interpolated token - | ^^^^ -... -LL | foo!(bar); - | ---------- in this macro invocation - -error: aborting due to previous error - diff --git a/src/test/ui/range/range-1.rs b/src/test/ui/range/range-1.rs index 59c78052e15..f13787b1d6e 100644 --- a/src/test/ui/range/range-1.rs +++ b/src/test/ui/range/range-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test range syntax - type errors. pub fn main() { diff --git a/src/test/ui/range/range-1.stderr b/src/test/ui/range/range-1.stderr index 2e83bab4e8d..00c0c805155 100644 --- a/src/test/ui/range/range-1.stderr +++ b/src/test/ui/range/range-1.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/range-1.rs:15:19 + --> $DIR/range-1.rs:5:19 | LL | let _ = 0u32..10i32; | ^^^^^ expected u32, found i32 error[E0277]: the trait bound `bool: std::iter::Step` is not satisfied - --> $DIR/range-1.rs:19:14 + --> $DIR/range-1.rs:9:14 | LL | for i in false..true {} | ^^^^^^^^^^^ the trait `std::iter::Step` is not implemented for `bool` @@ -13,13 +13,13 @@ LL | for i in false..true {} = note: required because of the requirements on the impl of `std::iter::Iterator` for `std::ops::Range` error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time - --> $DIR/range-1.rs:24:17 + --> $DIR/range-1.rs:14:17 | LL | let range = *arr..; | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[{integer}]` - = note: to learn more, visit + = note: to learn more, visit = note: required by `std::ops::RangeFrom` error: aborting due to 3 previous errors diff --git a/src/test/ui/range/range-inclusive-pattern-precedence.rs b/src/test/ui/range/range-inclusive-pattern-precedence.rs index ce0c9947a05..fbafe1fe6ee 100644 --- a/src/test/ui/range/range-inclusive-pattern-precedence.rs +++ b/src/test/ui/range/range-inclusive-pattern-precedence.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // In expression, `&a..=b` is treated as `(&a)..=(b)` and `box a..=b` is // `(box a)..=(b)`. In a pattern, however, `&a..=b` means `&(a..=b)`. This may // lead to confusion. diff --git a/src/test/ui/range/range-inclusive-pattern-precedence.stderr b/src/test/ui/range/range-inclusive-pattern-precedence.stderr index 6fa67a5d4fa..fb0cf380154 100644 --- a/src/test/ui/range/range-inclusive-pattern-precedence.stderr +++ b/src/test/ui/range/range-inclusive-pattern-precedence.stderr @@ -1,29 +1,29 @@ error: the range pattern here has ambiguous interpretation - --> $DIR/range-inclusive-pattern-precedence.rs:27:10 + --> $DIR/range-inclusive-pattern-precedence.rs:17:10 | LL | &10..=15 => {} | ^^^^^^^ help: add parentheses to clarify the precedence: `(10 ..=15)` error: the range pattern here has ambiguous interpretation - --> $DIR/range-inclusive-pattern-precedence.rs:38:13 + --> $DIR/range-inclusive-pattern-precedence.rs:28:13 | LL | box 10..=15 => {} | ^^^^^^^ help: add parentheses to clarify the precedence: `(10 ..=15)` warning: `...` range patterns are deprecated - --> $DIR/range-inclusive-pattern-precedence.rs:24:9 + --> $DIR/range-inclusive-pattern-precedence.rs:14:9 | LL | &0...9 => {} | ^^^^^^ help: use `..=` for an inclusive range: `&(0..=9)` | note: lint level defined here - --> $DIR/range-inclusive-pattern-precedence.rs:19:9 + --> $DIR/range-inclusive-pattern-precedence.rs:9:9 | LL | #![warn(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `...` range patterns are deprecated - --> $DIR/range-inclusive-pattern-precedence.rs:35:14 + --> $DIR/range-inclusive-pattern-precedence.rs:25:14 | LL | box 0...9 => {} | ^^^ help: use `..=` for an inclusive range diff --git a/src/test/ui/range/range_traits-1.rs b/src/test/ui/range/range_traits-1.rs index 78d3702b449..e28e47435c2 100644 --- a/src/test/ui/range/range_traits-1.rs +++ b/src/test/ui/range/range_traits-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::*; #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] diff --git a/src/test/ui/range/range_traits-1.stderr b/src/test/ui/range/range_traits-1.stderr index ee72dfe13d4..d085cab89a1 100644 --- a/src/test/ui/range/range_traits-1.stderr +++ b/src/test/ui/range/range_traits-1.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `std::ops::Range` with `std::ops::Range` - --> $DIR/range_traits-1.rs:15:5 + --> $DIR/range_traits-1.rs:5:5 | LL | a: Range, | ^^^^^^^^^^^^^^^ no implementation for `std::ops::Range < std::ops::Range` and `std::ops::Range > std::ops::Range` @@ -8,7 +8,7 @@ LL | a: Range, = note: required by `std::cmp::PartialOrd::partial_cmp` error[E0277]: can't compare `std::ops::RangeTo` with `std::ops::RangeTo` - --> $DIR/range_traits-1.rs:18:5 + --> $DIR/range_traits-1.rs:8:5 | LL | b: RangeTo, | ^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeTo < std::ops::RangeTo` and `std::ops::RangeTo > std::ops::RangeTo` @@ -17,7 +17,7 @@ LL | b: RangeTo, = note: required by `std::cmp::PartialOrd::partial_cmp` error[E0277]: can't compare `std::ops::RangeFrom` with `std::ops::RangeFrom` - --> $DIR/range_traits-1.rs:21:5 + --> $DIR/range_traits-1.rs:11:5 | LL | c: RangeFrom, | ^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeFrom < std::ops::RangeFrom` and `std::ops::RangeFrom > std::ops::RangeFrom` @@ -26,7 +26,7 @@ LL | c: RangeFrom, = note: required by `std::cmp::PartialOrd::partial_cmp` error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull` - --> $DIR/range_traits-1.rs:24:5 + --> $DIR/range_traits-1.rs:14:5 | LL | d: RangeFull, | ^^^^^^^^^^^^ no implementation for `std::ops::RangeFull < std::ops::RangeFull` and `std::ops::RangeFull > std::ops::RangeFull` @@ -35,7 +35,7 @@ LL | d: RangeFull, = note: required by `std::cmp::PartialOrd::partial_cmp` error[E0277]: can't compare `std::ops::RangeInclusive` with `std::ops::RangeInclusive` - --> $DIR/range_traits-1.rs:27:5 + --> $DIR/range_traits-1.rs:17:5 | LL | e: RangeInclusive, | ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeInclusive < std::ops::RangeInclusive` and `std::ops::RangeInclusive > std::ops::RangeInclusive` @@ -44,7 +44,7 @@ LL | e: RangeInclusive, = note: required by `std::cmp::PartialOrd::partial_cmp` error[E0277]: can't compare `std::ops::RangeToInclusive` with `std::ops::RangeToInclusive` - --> $DIR/range_traits-1.rs:30:5 + --> $DIR/range_traits-1.rs:20:5 | LL | f: RangeToInclusive, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeToInclusive < std::ops::RangeToInclusive` and `std::ops::RangeToInclusive > std::ops::RangeToInclusive` @@ -53,7 +53,7 @@ LL | f: RangeToInclusive, = note: required by `std::cmp::PartialOrd::partial_cmp` error[E0277]: the trait bound `std::ops::Range: std::cmp::Ord` is not satisfied - --> $DIR/range_traits-1.rs:15:5 + --> $DIR/range_traits-1.rs:5:5 | LL | a: Range, | ^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::Range` @@ -61,7 +61,7 @@ LL | a: Range, = note: required by `std::cmp::Ord::cmp` error[E0277]: the trait bound `std::ops::RangeTo: std::cmp::Ord` is not satisfied - --> $DIR/range_traits-1.rs:18:5 + --> $DIR/range_traits-1.rs:8:5 | LL | b: RangeTo, | ^^^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeTo` @@ -69,7 +69,7 @@ LL | b: RangeTo, = note: required by `std::cmp::Ord::cmp` error[E0277]: the trait bound `std::ops::RangeFrom: std::cmp::Ord` is not satisfied - --> $DIR/range_traits-1.rs:21:5 + --> $DIR/range_traits-1.rs:11:5 | LL | c: RangeFrom, | ^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeFrom` @@ -77,7 +77,7 @@ LL | c: RangeFrom, = note: required by `std::cmp::Ord::cmp` error[E0277]: the trait bound `std::ops::RangeFull: std::cmp::Ord` is not satisfied - --> $DIR/range_traits-1.rs:24:5 + --> $DIR/range_traits-1.rs:14:5 | LL | d: RangeFull, | ^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeFull` @@ -85,7 +85,7 @@ LL | d: RangeFull, = note: required by `std::cmp::Ord::cmp` error[E0277]: the trait bound `std::ops::RangeInclusive: std::cmp::Ord` is not satisfied - --> $DIR/range_traits-1.rs:27:5 + --> $DIR/range_traits-1.rs:17:5 | LL | e: RangeInclusive, | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeInclusive` @@ -93,7 +93,7 @@ LL | e: RangeInclusive, = note: required by `std::cmp::Ord::cmp` error[E0277]: the trait bound `std::ops::RangeToInclusive: std::cmp::Ord` is not satisfied - --> $DIR/range_traits-1.rs:30:5 + --> $DIR/range_traits-1.rs:20:5 | LL | f: RangeToInclusive, | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeToInclusive` diff --git a/src/test/ui/range/range_traits-2.rs b/src/test/ui/range/range_traits-2.rs index 64fcd25f538..c34ef781d8c 100644 --- a/src/test/ui/range/range_traits-2.rs +++ b/src/test/ui/range/range_traits-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::*; #[derive(Copy, Clone)] //~ ERROR Copy diff --git a/src/test/ui/range/range_traits-2.stderr b/src/test/ui/range/range_traits-2.stderr index 0151ede2164..f7f887006ed 100644 --- a/src/test/ui/range/range_traits-2.stderr +++ b/src/test/ui/range/range_traits-2.stderr @@ -1,5 +1,5 @@ error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/range_traits-2.rs:13:10 + --> $DIR/range_traits-2.rs:3:10 | LL | #[derive(Copy, Clone)] //~ ERROR Copy | ^^^^ diff --git a/src/test/ui/range/range_traits-3.rs b/src/test/ui/range/range_traits-3.rs index d26b7956ae8..b0448afce04 100644 --- a/src/test/ui/range/range_traits-3.rs +++ b/src/test/ui/range/range_traits-3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::*; #[derive(Copy, Clone)] //~ ERROR Copy diff --git a/src/test/ui/range/range_traits-3.stderr b/src/test/ui/range/range_traits-3.stderr index a625fda2bc2..910ba517276 100644 --- a/src/test/ui/range/range_traits-3.stderr +++ b/src/test/ui/range/range_traits-3.stderr @@ -1,5 +1,5 @@ error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/range_traits-3.rs:13:10 + --> $DIR/range_traits-3.rs:3:10 | LL | #[derive(Copy, Clone)] //~ ERROR Copy | ^^^^ diff --git a/src/test/ui/range/range_traits-4.rs b/src/test/ui/range/range_traits-4.rs index 24a1bcb37cf..ff845770483 100644 --- a/src/test/ui/range/range_traits-4.rs +++ b/src/test/ui/range/range_traits-4.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass use std::ops::*; diff --git a/src/test/ui/range/range_traits-5.rs b/src/test/ui/range/range_traits-5.rs index 033f06f9cd1..95505c94d1f 100644 --- a/src/test/ui/range/range_traits-5.rs +++ b/src/test/ui/range/range_traits-5.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass use std::ops::*; diff --git a/src/test/ui/range/range_traits-6.rs b/src/test/ui/range/range_traits-6.rs index f9510b5061c..041f04a3498 100644 --- a/src/test/ui/range/range_traits-6.rs +++ b/src/test/ui/range/range_traits-6.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::*; #[derive(Copy, Clone)] //~ ERROR Copy diff --git a/src/test/ui/range/range_traits-6.stderr b/src/test/ui/range/range_traits-6.stderr index 9470540cc5f..c1916e24bfe 100644 --- a/src/test/ui/range/range_traits-6.stderr +++ b/src/test/ui/range/range_traits-6.stderr @@ -1,5 +1,5 @@ error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/range_traits-6.rs:13:10 + --> $DIR/range_traits-6.rs:3:10 | LL | #[derive(Copy, Clone)] //~ ERROR Copy | ^^^^ diff --git a/src/test/ui/range/range_traits-7.rs b/src/test/ui/range/range_traits-7.rs index 23fb0a1fc5e..c328ecb223a 100644 --- a/src/test/ui/range/range_traits-7.rs +++ b/src/test/ui/range/range_traits-7.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass use std::ops::*; diff --git a/src/test/ui/reachable/expr_add.rs b/src/test/ui/reachable/expr_add.rs index 26760cfea44..b45e5daf42c 100644 --- a/src/test/ui/reachable/expr_add.rs +++ b/src/test/ui/reachable/expr_add.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(never_type)] #![allow(unused_variables)] #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_add.stderr b/src/test/ui/reachable/expr_add.stderr index f49a781ce33..548600f26ec 100644 --- a/src/test/ui/reachable/expr_add.stderr +++ b/src/test/ui/reachable/expr_add.stderr @@ -1,11 +1,11 @@ error: unreachable expression - --> $DIR/expr_add.rs:26:13 + --> $DIR/expr_add.rs:17:13 | LL | let x = Foo + return; //~ ERROR unreachable | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_add.rs:12:9 + --> $DIR/expr_add.rs:3:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_again.rs b/src/test/ui/reachable/expr_again.rs index cf6a1f7b3b4..243fed0c8ce 100644 --- a/src/test/ui/reachable/expr_again.rs +++ b/src/test/ui/reachable/expr_again.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] #![allow(unused_variables)] #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_again.stderr b/src/test/ui/reachable/expr_again.stderr index 65c0c588329..bdc3d143ea5 100644 --- a/src/test/ui/reachable/expr_again.stderr +++ b/src/test/ui/reachable/expr_again.stderr @@ -1,11 +1,11 @@ error: unreachable statement - --> $DIR/expr_again.rs:18:9 + --> $DIR/expr_again.rs:8:9 | LL | println!("hi"); | ^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_again.rs:13:9 + --> $DIR/expr_again.rs:3:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_andand.rs b/src/test/ui/reachable/expr_andand.rs index c5206eec672..173116ae357 100644 --- a/src/test/ui/reachable/expr_andand.rs +++ b/src/test/ui/reachable/expr_andand.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_variables)] diff --git a/src/test/ui/reachable/expr_array.rs b/src/test/ui/reachable/expr_array.rs index 323a5752e22..e6bdb970568 100644 --- a/src/test/ui/reachable/expr_array.rs +++ b/src/test/ui/reachable/expr_array.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/src/test/ui/reachable/expr_array.stderr b/src/test/ui/reachable/expr_array.stderr index 78ac76a6137..b6e79e551cd 100644 --- a/src/test/ui/reachable/expr_array.stderr +++ b/src/test/ui/reachable/expr_array.stderr @@ -1,17 +1,17 @@ error: unreachable expression - --> $DIR/expr_array.rs:19:34 + --> $DIR/expr_array.rs:9:34 | LL | let x: [usize; 2] = [return, 22]; //~ ERROR unreachable | ^^ | note: lint level defined here - --> $DIR/expr_array.rs:14:9 + --> $DIR/expr_array.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable expression - --> $DIR/expr_array.rs:24:25 + --> $DIR/expr_array.rs:14:25 | LL | let x: [usize; 2] = [22, return]; //~ ERROR unreachable | ^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_assign.rs b/src/test/ui/reachable/expr_assign.rs index 308f2483be5..e547f75e269 100644 --- a/src/test/ui/reachable/expr_assign.rs +++ b/src/test/ui/reachable/expr_assign.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(never_type)] #![allow(unused_variables)] #![allow(unused_assignments)] diff --git a/src/test/ui/reachable/expr_assign.stderr b/src/test/ui/reachable/expr_assign.stderr index 628bfbf6217..949009b7299 100644 --- a/src/test/ui/reachable/expr_assign.stderr +++ b/src/test/ui/reachable/expr_assign.stderr @@ -1,23 +1,23 @@ error: unreachable expression - --> $DIR/expr_assign.rs:19:5 + --> $DIR/expr_assign.rs:10:5 | LL | x = return; //~ ERROR unreachable | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_assign.rs:14:9 + --> $DIR/expr_assign.rs:5:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable expression - --> $DIR/expr_assign.rs:29:14 + --> $DIR/expr_assign.rs:20:14 | LL | *p = return; //~ ERROR unreachable | ^^^^^^ error: unreachable expression - --> $DIR/expr_assign.rs:35:15 + --> $DIR/expr_assign.rs:26:15 | LL | *{return; &mut i} = 22; //~ ERROR unreachable | ^^^^^^ diff --git a/src/test/ui/reachable/expr_block.rs b/src/test/ui/reachable/expr_block.rs index 1f74f61ce2a..136bccce881 100644 --- a/src/test/ui/reachable/expr_block.rs +++ b/src/test/ui/reachable/expr_block.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/src/test/ui/reachable/expr_block.stderr b/src/test/ui/reachable/expr_block.stderr index 5f5696aadb3..d71d12b744a 100644 --- a/src/test/ui/reachable/expr_block.stderr +++ b/src/test/ui/reachable/expr_block.stderr @@ -1,17 +1,17 @@ error: unreachable expression - --> $DIR/expr_block.rs:20:9 + --> $DIR/expr_block.rs:10:9 | LL | 22 //~ ERROR unreachable | ^^ | note: lint level defined here - --> $DIR/expr_block.rs:14:9 + --> $DIR/expr_block.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable statement - --> $DIR/expr_block.rs:35:9 + --> $DIR/expr_block.rs:25:9 | LL | println!("foo"); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_box.rs b/src/test/ui/reachable/expr_box.rs index ab62cbdf837..00328ea0131 100644 --- a/src/test/ui/reachable/expr_box.rs +++ b/src/test/ui/reachable/expr_box.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] #![allow(unused_variables)] #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_box.stderr b/src/test/ui/reachable/expr_box.stderr index 08b916030dd..289cef24bce 100644 --- a/src/test/ui/reachable/expr_box.stderr +++ b/src/test/ui/reachable/expr_box.stderr @@ -1,11 +1,11 @@ error: unreachable expression - --> $DIR/expr_box.rs:16:13 + --> $DIR/expr_box.rs:6:13 | LL | let x = box return; //~ ERROR unreachable | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_box.rs:13:9 + --> $DIR/expr_box.rs:3:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_call.rs b/src/test/ui/reachable/expr_call.rs index 9696bdadf87..1eaa96c3ce7 100644 --- a/src/test/ui/reachable/expr_call.rs +++ b/src/test/ui/reachable/expr_call.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(never_type)] #![allow(unused_variables)] #![allow(unused_assignments)] diff --git a/src/test/ui/reachable/expr_call.stderr b/src/test/ui/reachable/expr_call.stderr index 414d29ec2a7..aecaf24adc4 100644 --- a/src/test/ui/reachable/expr_call.stderr +++ b/src/test/ui/reachable/expr_call.stderr @@ -1,17 +1,17 @@ error: unreachable expression - --> $DIR/expr_call.rs:22:17 + --> $DIR/expr_call.rs:13:17 | LL | foo(return, 22); //~ ERROR unreachable | ^^ | note: lint level defined here - --> $DIR/expr_call.rs:14:9 + --> $DIR/expr_call.rs:5:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable expression - --> $DIR/expr_call.rs:27:5 + --> $DIR/expr_call.rs:18:5 | LL | bar(return); //~ ERROR unreachable | ^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_cast.rs b/src/test/ui/reachable/expr_cast.rs index fc0041daf7c..f53bcb97e69 100644 --- a/src/test/ui/reachable/expr_cast.rs +++ b/src/test/ui/reachable/expr_cast.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/src/test/ui/reachable/expr_cast.stderr b/src/test/ui/reachable/expr_cast.stderr index 458334e2af9..21f8a0f418e 100644 --- a/src/test/ui/reachable/expr_cast.stderr +++ b/src/test/ui/reachable/expr_cast.stderr @@ -1,11 +1,11 @@ error: unreachable expression - --> $DIR/expr_cast.rs:19:13 + --> $DIR/expr_cast.rs:9:13 | LL | let x = {return} as !; //~ ERROR unreachable | ^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_cast.rs:14:9 + --> $DIR/expr_cast.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_if.rs b/src/test/ui/reachable/expr_if.rs index 4b540ab5b7e..ed43bd8c689 100644 --- a/src/test/ui/reachable/expr_if.rs +++ b/src/test/ui/reachable/expr_if.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/src/test/ui/reachable/expr_if.stderr b/src/test/ui/reachable/expr_if.stderr index 6e8afd1c5be..d11471da1a6 100644 --- a/src/test/ui/reachable/expr_if.stderr +++ b/src/test/ui/reachable/expr_if.stderr @@ -1,11 +1,11 @@ error: unreachable statement - --> $DIR/expr_if.rs:37:5 + --> $DIR/expr_if.rs:27:5 | LL | println!("But I am."); | ^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_if.rs:14:9 + --> $DIR/expr_if.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_loop.rs b/src/test/ui/reachable/expr_loop.rs index 41394f20484..7eab6f7bb44 100644 --- a/src/test/ui/reachable/expr_loop.rs +++ b/src/test/ui/reachable/expr_loop.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/src/test/ui/reachable/expr_loop.stderr b/src/test/ui/reachable/expr_loop.stderr index 0208972a3df..4d3e06c93a3 100644 --- a/src/test/ui/reachable/expr_loop.stderr +++ b/src/test/ui/reachable/expr_loop.stderr @@ -1,18 +1,18 @@ error: unreachable statement - --> $DIR/expr_loop.rs:18:5 + --> $DIR/expr_loop.rs:8:5 | LL | println!("I am dead."); | ^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_loop.rs:14:9 + --> $DIR/expr_loop.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: unreachable statement - --> $DIR/expr_loop.rs:31:5 + --> $DIR/expr_loop.rs:21:5 | LL | println!("I am dead."); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -20,7 +20,7 @@ LL | println!("I am dead."); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: unreachable statement - --> $DIR/expr_loop.rs:42:5 + --> $DIR/expr_loop.rs:32:5 | LL | println!("I am dead."); | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_match.rs b/src/test/ui/reachable/expr_match.rs index 73f26129805..2fd26b54e15 100644 --- a/src/test/ui/reachable/expr_match.rs +++ b/src/test/ui/reachable/expr_match.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/src/test/ui/reachable/expr_match.stderr b/src/test/ui/reachable/expr_match.stderr index fe1a0c4ea11..1aef06aec5b 100644 --- a/src/test/ui/reachable/expr_match.stderr +++ b/src/test/ui/reachable/expr_match.stderr @@ -1,18 +1,18 @@ error: unreachable statement - --> $DIR/expr_match.rs:18:5 + --> $DIR/expr_match.rs:8:5 | LL | println!("I am dead"); | ^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_match.rs:14:9 + --> $DIR/expr_match.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: unreachable statement - --> $DIR/expr_match.rs:29:5 + --> $DIR/expr_match.rs:19:5 | LL | println!("I am dead"); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_method.rs b/src/test/ui/reachable/expr_method.rs index c91646cfa1e..d917df05b3c 100644 --- a/src/test/ui/reachable/expr_method.rs +++ b/src/test/ui/reachable/expr_method.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(never_type)] #![allow(unused_variables)] #![allow(unused_assignments)] diff --git a/src/test/ui/reachable/expr_method.stderr b/src/test/ui/reachable/expr_method.stderr index 6d67bfcd54a..f1770df2f9e 100644 --- a/src/test/ui/reachable/expr_method.stderr +++ b/src/test/ui/reachable/expr_method.stderr @@ -1,17 +1,17 @@ error: unreachable expression - --> $DIR/expr_method.rs:25:21 + --> $DIR/expr_method.rs:16:21 | LL | Foo.foo(return, 22); //~ ERROR unreachable | ^^ | note: lint level defined here - --> $DIR/expr_method.rs:14:9 + --> $DIR/expr_method.rs:5:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable expression - --> $DIR/expr_method.rs:30:5 + --> $DIR/expr_method.rs:21:5 | LL | Foo.bar(return); //~ ERROR unreachable | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_oror.rs b/src/test/ui/reachable/expr_oror.rs index 0adec9999dc..ecfa072aa81 100644 --- a/src/test/ui/reachable/expr_oror.rs +++ b/src/test/ui/reachable/expr_oror.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused_variables)] diff --git a/src/test/ui/reachable/expr_repeat.rs b/src/test/ui/reachable/expr_repeat.rs index fd9fca413a7..0fd13c6cb8e 100644 --- a/src/test/ui/reachable/expr_repeat.rs +++ b/src/test/ui/reachable/expr_repeat.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/src/test/ui/reachable/expr_repeat.stderr b/src/test/ui/reachable/expr_repeat.stderr index 36393de90b7..288c18d5d65 100644 --- a/src/test/ui/reachable/expr_repeat.stderr +++ b/src/test/ui/reachable/expr_repeat.stderr @@ -1,11 +1,11 @@ error: unreachable expression - --> $DIR/expr_repeat.rs:19:25 + --> $DIR/expr_repeat.rs:9:25 | LL | let x: [usize; 2] = [return; 2]; //~ ERROR unreachable | ^^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_repeat.rs:14:9 + --> $DIR/expr_repeat.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_return.rs b/src/test/ui/reachable/expr_return.rs index 9bbbe6f9099..0fc43f45075 100644 --- a/src/test/ui/reachable/expr_return.rs +++ b/src/test/ui/reachable/expr_return.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/src/test/ui/reachable/expr_return.stderr b/src/test/ui/reachable/expr_return.stderr index 2dcc50944c5..e5ce660d695 100644 --- a/src/test/ui/reachable/expr_return.stderr +++ b/src/test/ui/reachable/expr_return.stderr @@ -1,11 +1,11 @@ error: unreachable expression - --> $DIR/expr_return.rs:20:22 + --> $DIR/expr_return.rs:10:22 | LL | let x = {return {return {return;}}}; //~ ERROR unreachable | ^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_return.rs:14:9 + --> $DIR/expr_return.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_struct.rs b/src/test/ui/reachable/expr_struct.rs index 66414f6084b..31ab40582ee 100644 --- a/src/test/ui/reachable/expr_struct.rs +++ b/src/test/ui/reachable/expr_struct.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/src/test/ui/reachable/expr_struct.stderr b/src/test/ui/reachable/expr_struct.stderr index 3f0ecb20479..5fbf603602b 100644 --- a/src/test/ui/reachable/expr_struct.stderr +++ b/src/test/ui/reachable/expr_struct.stderr @@ -1,29 +1,29 @@ error: unreachable expression - --> $DIR/expr_struct.rs:24:13 + --> $DIR/expr_struct.rs:14:13 | LL | let x = Foo { a: 22, b: 33, ..return }; //~ ERROR unreachable | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_struct.rs:14:9 + --> $DIR/expr_struct.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable expression - --> $DIR/expr_struct.rs:29:33 + --> $DIR/expr_struct.rs:19:33 | LL | let x = Foo { a: return, b: 33, ..return }; //~ ERROR unreachable | ^^ error: unreachable expression - --> $DIR/expr_struct.rs:34:39 + --> $DIR/expr_struct.rs:24:39 | LL | let x = Foo { a: 22, b: return, ..return }; //~ ERROR unreachable | ^^^^^^ error: unreachable expression - --> $DIR/expr_struct.rs:39:13 + --> $DIR/expr_struct.rs:29:13 | LL | let x = Foo { a: 22, b: return }; //~ ERROR unreachable | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_tup.rs b/src/test/ui/reachable/expr_tup.rs index e2c10090248..90d4382e2cc 100644 --- a/src/test/ui/reachable/expr_tup.rs +++ b/src/test/ui/reachable/expr_tup.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/src/test/ui/reachable/expr_tup.stderr b/src/test/ui/reachable/expr_tup.stderr index d372373ced0..def678ec93e 100644 --- a/src/test/ui/reachable/expr_tup.stderr +++ b/src/test/ui/reachable/expr_tup.stderr @@ -1,17 +1,17 @@ error: unreachable expression - --> $DIR/expr_tup.rs:19:38 + --> $DIR/expr_tup.rs:9:38 | LL | let x: (usize, usize) = (return, 2); //~ ERROR unreachable | ^ | note: lint level defined here - --> $DIR/expr_tup.rs:14:9 + --> $DIR/expr_tup.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable expression - --> $DIR/expr_tup.rs:24:29 + --> $DIR/expr_tup.rs:14:29 | LL | let x: (usize, usize) = (2, return); //~ ERROR unreachable | ^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_type.rs b/src/test/ui/reachable/expr_type.rs index ce12412ba74..8d32397b542 100644 --- a/src/test/ui/reachable/expr_type.rs +++ b/src/test/ui/reachable/expr_type.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/src/test/ui/reachable/expr_type.stderr b/src/test/ui/reachable/expr_type.stderr index 9b165d6b3ee..b90cd790341 100644 --- a/src/test/ui/reachable/expr_type.stderr +++ b/src/test/ui/reachable/expr_type.stderr @@ -1,11 +1,11 @@ error: unreachable expression - --> $DIR/expr_type.rs:19:13 + --> $DIR/expr_type.rs:9:13 | LL | let x = {return}: !; //~ ERROR unreachable | ^^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_type.rs:14:9 + --> $DIR/expr_type.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_unary.rs b/src/test/ui/reachable/expr_unary.rs index 5b7ea57b166..e229d22ebc7 100644 --- a/src/test/ui/reachable/expr_unary.rs +++ b/src/test/ui/reachable/expr_unary.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(never_type)] #![allow(unused_variables)] #![allow(unused_assignments)] diff --git a/src/test/ui/reachable/expr_unary.stderr b/src/test/ui/reachable/expr_unary.stderr index b889c884fcb..44887f0ee52 100644 --- a/src/test/ui/reachable/expr_unary.stderr +++ b/src/test/ui/reachable/expr_unary.stderr @@ -1,17 +1,17 @@ error[E0600]: cannot apply unary operator `!` to type `!` - --> $DIR/expr_unary.rs:17:16 + --> $DIR/expr_unary.rs:8:16 | LL | let x: ! = ! { return; }; //~ ERROR unreachable | ^^^^^^^^^^^^^ cannot apply unary operator `!` error: unreachable expression - --> $DIR/expr_unary.rs:17:16 + --> $DIR/expr_unary.rs:8:16 | LL | let x: ! = ! { return; }; //~ ERROR unreachable | ^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_unary.rs:14:9 + --> $DIR/expr_unary.rs:5:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reachable/expr_while.rs b/src/test/ui/reachable/expr_while.rs index 27e8d5d9b97..36a3e3dd961 100644 --- a/src/test/ui/reachable/expr_while.rs +++ b/src/test/ui/reachable/expr_while.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_variables)] #![allow(unused_assignments)] #![allow(dead_code)] diff --git a/src/test/ui/reachable/expr_while.stderr b/src/test/ui/reachable/expr_while.stderr index 3a27fe5e027..d2f5588568a 100644 --- a/src/test/ui/reachable/expr_while.stderr +++ b/src/test/ui/reachable/expr_while.stderr @@ -1,18 +1,18 @@ error: unreachable statement - --> $DIR/expr_while.rs:18:9 + --> $DIR/expr_while.rs:8:9 | LL | println!("Hello, world!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/expr_while.rs:14:9 + --> $DIR/expr_while.rs:4:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: unreachable statement - --> $DIR/expr_while.rs:33:9 + --> $DIR/expr_while.rs:23:9 | LL | println!("I am dead."); | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -20,7 +20,7 @@ LL | println!("I am dead."); = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: unreachable statement - --> $DIR/expr_while.rs:36:5 + --> $DIR/expr_while.rs:26:5 | LL | println!("I am, too."); | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/reassign-ref-mut.rs b/src/test/ui/reassign-ref-mut.rs index c045720a840..d6d41e959d9 100644 --- a/src/test/ui/reassign-ref-mut.rs +++ b/src/test/ui/reassign-ref-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests how we behave when the user attempts to mutate an immutable // binding that was introduced by either `ref` or `ref mut` // patterns. diff --git a/src/test/ui/reassign-ref-mut.stderr b/src/test/ui/reassign-ref-mut.stderr index bf627dde720..e623578e025 100644 --- a/src/test/ui/reassign-ref-mut.stderr +++ b/src/test/ui/reassign-ref-mut.stderr @@ -1,5 +1,5 @@ error[E0384]: cannot assign twice to immutable variable `a` - --> $DIR/reassign-ref-mut.rs:22:5 + --> $DIR/reassign-ref-mut.rs:12:5 | LL | let &mut (ref a, ref mut b) = &mut one_two; | ----- first assignment to `a` @@ -7,7 +7,7 @@ LL | a = &three_four.0; | ^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `b` - --> $DIR/reassign-ref-mut.rs:24:5 + --> $DIR/reassign-ref-mut.rs:14:5 | LL | let &mut (ref a, ref mut b) = &mut one_two; | --------- first assignment to `b` diff --git a/src/test/ui/recursion/auxiliary/recursive_reexports.rs b/src/test/ui/recursion/auxiliary/recursive_reexports.rs index 1186e3d62f7..f98fa71009f 100644 --- a/src/test/ui/recursion/auxiliary/recursive_reexports.rs +++ b/src/test/ui/recursion/auxiliary/recursive_reexports.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod foo { pub use foo; } diff --git a/src/test/ui/recursion/recursion.rs b/src/test/ui/recursion/recursion.rs index 3221ae46296..ba3cc33dc30 100644 --- a/src/test/ui/recursion/recursion.rs +++ b/src/test/ui/recursion/recursion.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Nil {NilValue} struct Cons {head:isize, tail:T} trait Dot {fn dot(&self, other:Self) -> isize;} diff --git a/src/test/ui/recursion/recursion.stderr b/src/test/ui/recursion/recursion.stderr index 5953e5c4087..1bef37ad588 100644 --- a/src/test/ui/recursion/recursion.stderr +++ b/src/test/ui/recursion/recursion.stderr @@ -1,5 +1,5 @@ error: reached the recursion limit while instantiating `test::>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` - --> $DIR/recursion.rs:22:1 + --> $DIR/recursion.rs:12:1 | LL | / fn test (n:isize, i:isize, first:T, second:T) ->isize { //~ ERROR recursion limit LL | | match n { 0 => {first.dot(second)} diff --git a/src/test/ui/recursion/recursive-enum.rs b/src/test/ui/recursion/recursive-enum.rs index 555755cdb96..32e707607b8 100644 --- a/src/test/ui/recursion/recursive-enum.rs +++ b/src/test/ui/recursion/recursive-enum.rs @@ -1,14 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum list { cons(T, list), nil } -//~^ ERROR recursive type `list` has infinite size +enum List { Cons(T, List), Nil } +//~^ ERROR recursive type `List` has infinite size fn main() {} diff --git a/src/test/ui/recursion/recursive-enum.stderr b/src/test/ui/recursion/recursive-enum.stderr index c06058b2b59..e4674b57a6d 100644 --- a/src/test/ui/recursion/recursive-enum.stderr +++ b/src/test/ui/recursion/recursive-enum.stderr @@ -1,12 +1,12 @@ -error[E0072]: recursive type `list` has infinite size - --> $DIR/recursive-enum.rs:11:1 +error[E0072]: recursive type `List` has infinite size + --> $DIR/recursive-enum.rs:1:1 | -LL | enum list { cons(T, list), nil } +LL | enum List { Cons(T, List), Nil } | ^^^^^^^^^^^^ ------- recursive without indirection | | | recursive type has infinite size | - = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `list` representable + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `List` representable error: aborting due to previous error diff --git a/src/test/ui/recursion/recursive-reexports.rs b/src/test/ui/recursion/recursive-reexports.rs index b57b73325c0..3d9fda35c68 100644 --- a/src/test/ui/recursion/recursive-reexports.rs +++ b/src/test/ui/recursion/recursive-reexports.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:recursive_reexports.rs extern crate recursive_reexports; diff --git a/src/test/ui/recursion/recursive-reexports.stderr b/src/test/ui/recursion/recursive-reexports.stderr index e6b8647a981..681931ef830 100644 --- a/src/test/ui/recursion/recursive-reexports.stderr +++ b/src/test/ui/recursion/recursive-reexports.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `S` in module `recursive_reexports` - --> $DIR/recursive-reexports.rs:15:32 + --> $DIR/recursive-reexports.rs:5:32 | LL | fn f() -> recursive_reexports::S {} //~ ERROR cannot find type `S` in module `recursive_reexports` | ^ not found in `recursive_reexports` diff --git a/src/test/ui/recursion/recursive-requirements.rs b/src/test/ui/recursion/recursive-requirements.rs index dd6d2f6a225..9cfbee5f1e9 100644 --- a/src/test/ui/recursion/recursive-requirements.rs +++ b/src/test/ui/recursion/recursive-requirements.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker::PhantomData; struct AssertSync(PhantomData); diff --git a/src/test/ui/recursion/recursive-requirements.stderr b/src/test/ui/recursion/recursive-requirements.stderr index 8fe282505e9..b3041902aca 100644 --- a/src/test/ui/recursion/recursive-requirements.stderr +++ b/src/test/ui/recursion/recursive-requirements.stderr @@ -1,5 +1,5 @@ error[E0277]: `*const Bar` cannot be shared between threads safely - --> $DIR/recursive-requirements.rs:26:12 + --> $DIR/recursive-requirements.rs:16:12 | LL | let _: AssertSync = unimplemented!(); | ^^^^^^^^^^^^^^^ `*const Bar` cannot be shared between threads safely @@ -7,13 +7,13 @@ LL | let _: AssertSync = unimplemented!(); = help: within `Foo`, the trait `std::marker::Sync` is not implemented for `*const Bar` = note: required because it appears within the type `Foo` note: required by `AssertSync` - --> $DIR/recursive-requirements.rs:13:1 + --> $DIR/recursive-requirements.rs:3:1 | LL | struct AssertSync(PhantomData); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `*const Foo` cannot be shared between threads safely - --> $DIR/recursive-requirements.rs:26:12 + --> $DIR/recursive-requirements.rs:16:12 | LL | let _: AssertSync = unimplemented!(); | ^^^^^^^^^^^^^^^ `*const Foo` cannot be shared between threads safely @@ -23,7 +23,7 @@ LL | let _: AssertSync = unimplemented!(); = note: required because it appears within the type `std::marker::PhantomData` = note: required because it appears within the type `Foo` note: required by `AssertSync` - --> $DIR/recursive-requirements.rs:13:1 + --> $DIR/recursive-requirements.rs:3:1 | LL | struct AssertSync(PhantomData); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/recursion/recursive-static-definition.rs b/src/test/ui/recursion/recursive-static-definition.rs index 62c1859e09d..e816ce4e0c4 100644 --- a/src/test/ui/recursion/recursive-static-definition.rs +++ b/src/test/ui/recursion/recursive-static-definition.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub static FOO: u32 = FOO; //~^ ERROR cycle detected when const-evaluating `FOO` diff --git a/src/test/ui/recursion/recursive-static-definition.stderr b/src/test/ui/recursion/recursive-static-definition.stderr index c9a5e5eb447..b724c261a7c 100644 --- a/src/test/ui/recursion/recursive-static-definition.stderr +++ b/src/test/ui/recursion/recursive-static-definition.stderr @@ -1,17 +1,17 @@ error[E0391]: cycle detected when const-evaluating `FOO` - --> $DIR/recursive-static-definition.rs:11:23 + --> $DIR/recursive-static-definition.rs:1:23 | LL | pub static FOO: u32 = FOO; | ^^^ | note: ...which requires const-evaluating `FOO`... - --> $DIR/recursive-static-definition.rs:11:1 + --> $DIR/recursive-static-definition.rs:1:1 | LL | pub static FOO: u32 = FOO; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which again requires const-evaluating `FOO`, completing the cycle note: cycle used when const-evaluating + checking `FOO` - --> $DIR/recursive-static-definition.rs:11:1 + --> $DIR/recursive-static-definition.rs:1:1 | LL | pub static FOO: u32 = FOO; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.rs b/src/test/ui/recursion/recursive-types-are-not-uninhabited.rs index fa936697072..b3e4efb9940 100644 --- a/src/test/ui/recursion/recursive-types-are-not-uninhabited.rs +++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct R<'a> { r: &'a R<'a>, } diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr index c4d40412760..dad98cff452 100644 --- a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr +++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered - --> $DIR/recursive-types-are-not-uninhabited.rs:16:9 + --> $DIR/recursive-types-are-not-uninhabited.rs:6:9 | LL | let Ok(x) = res; | ^^^^^ pattern `Err(_)` not covered diff --git a/src/test/ui/ref-suggestion.nll.stderr b/src/test/ui/ref-suggestion.nll.stderr index 3fbd497c7ae..bef8dcca921 100644 --- a/src/test/ui/ref-suggestion.nll.stderr +++ b/src/test/ui/ref-suggestion.nll.stderr @@ -1,25 +1,25 @@ error[E0382]: use of moved value: `x` - --> $DIR/ref-suggestion.rs:14:5 + --> $DIR/ref-suggestion.rs:4:5 | +LL | let x = vec![1]; + | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | let y = x; | - value moved here LL | x; //~ ERROR use of moved value | ^ value used here after move - | - = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/ref-suggestion.rs:18:5 + --> $DIR/ref-suggestion.rs:8:5 | +LL | let x = vec![1]; + | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | let mut y = x; | - value moved here LL | x; //~ ERROR use of moved value | ^ value used here after move - | - = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/ref-suggestion.rs:26:5 + --> $DIR/ref-suggestion.rs:16:5 | LL | (Some(y), ()) => {}, | - value moved here diff --git a/src/test/ui/ref-suggestion.rs b/src/test/ui/ref-suggestion.rs index 0a0867195d9..346d118f0f9 100644 --- a/src/test/ui/ref-suggestion.rs +++ b/src/test/ui/ref-suggestion.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = vec![1]; let y = x; diff --git a/src/test/ui/ref-suggestion.stderr b/src/test/ui/ref-suggestion.stderr index 63ee203ed24..1f871bafeec 100644 --- a/src/test/ui/ref-suggestion.stderr +++ b/src/test/ui/ref-suggestion.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/ref-suggestion.rs:14:5 + --> $DIR/ref-suggestion.rs:4:5 | LL | let y = x; | - value moved here @@ -9,7 +9,7 @@ LL | x; //~ ERROR use of moved value = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` - --> $DIR/ref-suggestion.rs:18:5 + --> $DIR/ref-suggestion.rs:8:5 | LL | let mut y = x; | ----- value moved here @@ -19,7 +19,7 @@ LL | x; //~ ERROR use of moved value = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait error[E0382]: use of partially moved value: `x` - --> $DIR/ref-suggestion.rs:26:5 + --> $DIR/ref-suggestion.rs:16:5 | LL | (Some(y), ()) => {}, | - value moved here diff --git a/src/test/ui/refutable-pattern-errors.rs b/src/test/ui/refutable-pattern-errors.rs index 7b4009481ab..05db247288b 100644 --- a/src/test/ui/refutable-pattern-errors.rs +++ b/src/test/ui/refutable-pattern-errors.rs @@ -1,18 +1,7 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn func((1, (Some(1), 2..=3)): (isize, (Option, isize))) { } //~^ ERROR refutable pattern in function argument: `(_, _)` not covered fn main() { let (1, (Some(1), 2..=3)) = (1, (None, 2)); - //~^ ERROR refutable pattern in local binding: `(_, _)` not covered + //~^ ERROR refutable pattern in local binding: `(-2147483648i32..=0i32, _)` not covered } diff --git a/src/test/ui/refutable-pattern-errors.stderr b/src/test/ui/refutable-pattern-errors.stderr index c2d5fe001fc..b7001e34d54 100644 --- a/src/test/ui/refutable-pattern-errors.stderr +++ b/src/test/ui/refutable-pattern-errors.stderr @@ -1,14 +1,14 @@ error[E0005]: refutable pattern in function argument: `(_, _)` not covered - --> $DIR/refutable-pattern-errors.rs:12:9 + --> $DIR/refutable-pattern-errors.rs:1:9 | LL | fn func((1, (Some(1), 2..=3)): (isize, (Option, isize))) { } | ^^^^^^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered -error[E0005]: refutable pattern in local binding: `(_, _)` not covered - --> $DIR/refutable-pattern-errors.rs:16:9 +error[E0005]: refutable pattern in local binding: `(-2147483648i32..=0i32, _)` not covered + --> $DIR/refutable-pattern-errors.rs:5:9 | LL | let (1, (Some(1), 2..=3)) = (1, (None, 2)); - | ^^^^^^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered + | ^^^^^^^^^^^^^^^^^^^^^ pattern `(-2147483648i32..=0i32, _)` not covered error: aborting due to 2 previous errors diff --git a/src/test/ui/refutable-pattern-in-fn-arg.rs b/src/test/ui/refutable-pattern-in-fn-arg.rs index be42f0f0ed8..a2d9e1935de 100644 --- a/src/test/ui/refutable-pattern-in-fn-arg.rs +++ b/src/test/ui/refutable-pattern-in-fn-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let f = |3: isize| println!("hello"); //~^ ERROR refutable pattern in function argument: `_` not covered diff --git a/src/test/ui/refutable-pattern-in-fn-arg.stderr b/src/test/ui/refutable-pattern-in-fn-arg.stderr index e03532667f5..8666e6bb73e 100644 --- a/src/test/ui/refutable-pattern-in-fn-arg.stderr +++ b/src/test/ui/refutable-pattern-in-fn-arg.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in function argument: `_` not covered - --> $DIR/refutable-pattern-in-fn-arg.rs:12:14 + --> $DIR/refutable-pattern-in-fn-arg.rs:2:14 | LL | let f = |3: isize| println!("hello"); | ^ pattern `_` not covered diff --git a/src/test/ui/regions-fn-subtyping-return-static-fail.rs b/src/test/ui/regions-fn-subtyping-return-static-fail.rs index 6be65a5e359..242119cc201 100644 --- a/src/test/ui/regions-fn-subtyping-return-static-fail.rs +++ b/src/test/ui/regions-fn-subtyping-return-static-fail.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // In this fn, the type `F` is a function that takes a reference to a // struct and returns another reference with the same lifetime. // @@ -47,8 +37,7 @@ fn baz(x: &S) -> &S { fn supply_F() { want_F(foo); - // FIXME(#33684) -- this should be a subtype, but current alg. rejects it incorrectly - want_F(bar); //~ ERROR E0308 + want_F(bar); want_F(baz); } @@ -56,11 +45,7 @@ fn supply_F() { fn supply_G() { want_G(foo); want_G(bar); - want_G(baz); - //~^ ERROR mismatched types - //~| expected type `for<'cx> fn(&'cx S) -> &'static S` - //~| found type `for<'r> fn(&'r S) -> &'r S {baz}` - //~| expected concrete lifetime, found bound lifetime parameter 'cx + want_G(baz); //~ ERROR } pub fn main() { diff --git a/src/test/ui/regions-fn-subtyping-return-static-fail.stderr b/src/test/ui/regions-fn-subtyping-return-static-fail.stderr index ff4d00ae66b..a9234e43191 100644 --- a/src/test/ui/regions-fn-subtyping-return-static-fail.stderr +++ b/src/test/ui/regions-fn-subtyping-return-static-fail.stderr @@ -1,21 +1,12 @@ error[E0308]: mismatched types - --> $DIR/regions-fn-subtyping-return-static-fail.rs:51:12 + --> $DIR/regions-fn-subtyping-return-static-fail.rs:48:12 | -LL | want_F(bar); //~ ERROR E0308 - | ^^^ expected concrete lifetime, found bound lifetime parameter 'cx - | - = note: expected type `for<'cx> fn(&'cx S) -> &'cx S` - found type `for<'a> fn(&'a S) -> &S {bar::<'_>}` - -error[E0308]: mismatched types - --> $DIR/regions-fn-subtyping-return-static-fail.rs:59:12 - | -LL | want_G(baz); - | ^^^ expected concrete lifetime, found bound lifetime parameter 'cx +LL | want_G(baz); //~ ERROR + | ^^^ one type is more general than the other | = note: expected type `for<'cx> fn(&'cx S) -> &'static S` - found type `for<'r> fn(&'r S) -> &'r S {baz}` + found type `for<'r> fn(&'r S) -> &'r S` -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/regions/auxiliary/rbmtp_cross_crate_lib.rs b/src/test/ui/regions/auxiliary/rbmtp_cross_crate_lib.rs index f49ac4fc8e4..ce2a3a7db29 100644 --- a/src/test/ui/regions/auxiliary/rbmtp_cross_crate_lib.rs +++ b/src/test/ui/regions/auxiliary/rbmtp_cross_crate_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that method bounds declared on traits/impls in a cross-crate // scenario work. This is the library portion of the test. diff --git a/src/test/ui/regions/issue-56537-closure-uses-region-from-container.rs b/src/test/ui/regions/issue-56537-closure-uses-region-from-container.rs new file mode 100644 index 00000000000..24676fe5e5b --- /dev/null +++ b/src/test/ui/regions/issue-56537-closure-uses-region-from-container.rs @@ -0,0 +1,74 @@ +// This is a collection of examples where a function's formal +// parameter has an explicit lifetime and a closure within that +// function returns that formal parameter. The closure's return type, +// to be correctly inferred, needs to include the lifetime introduced +// by the function. +// +// This works today, which precludes changing things so that closures +// follow the same lifetime-elision rules used elsehwere. See +// rust-lang/rust#56537 + +// compile-pass +// We are already testing NLL explicitly via the revision system below. +// ignore-compare-mode-nll + +// revisions: ll nll migrate +//[ll] compile-flags:-Zborrowck=ast +//[nll] compile-flags:-Zborrowck=mir -Z two-phase-borrows +//[migrate] compile-flags:-Zborrowck=migrate -Z two-phase-borrows + +fn willy_no_annot<'w>(p: &'w str, q: &str) -> &'w str { + let free_dumb = |_x| { p }; // no type annotation at all + let hello = format!("Hello"); + free_dumb(&hello) +} + +fn willy_ret_type_annot<'w>(p: &'w str, q: &str) -> &'w str { + let free_dumb = |_x| -> &str { p }; // type annotation on the return type + let hello = format!("Hello"); + free_dumb(&hello) +} + +fn willy_ret_region_annot<'w>(p: &'w str, q: &str) -> &'w str { + let free_dumb = |_x| -> &'w str { p }; // type+region annotation on return type + let hello = format!("Hello"); + free_dumb(&hello) +} + +fn willy_arg_type_ret_type_annot<'w>(p: &'w str, q: &str) -> &'w str { + let free_dumb = |_x: &str| -> &str { p }; // type annotation on arg and return types + let hello = format!("Hello"); + free_dumb(&hello) +} + +fn willy_arg_type_ret_region_annot<'w>(p: &'w str, q: &str) -> &'w str { + let free_dumb = |_x: &str| -> &'w str { p }; // fully annotated + let hello = format!("Hello"); + free_dumb(&hello) +} + +fn main() { + let world = format!("World"); + let w1: &str = { + let hello = format!("He11o"); + willy_no_annot(&world, &hello) + }; + let w2: &str = { + let hello = format!("He22o"); + willy_ret_type_annot(&world, &hello) + }; + let w3: &str = { + let hello = format!("He33o"); + willy_ret_region_annot(&world, &hello) + }; + let w4: &str = { + let hello = format!("He44o"); + willy_arg_type_ret_type_annot(&world, &hello) + }; + let w5: &str = { + let hello = format!("He55o"); + willy_arg_type_ret_region_annot(&world, &hello) + }; + assert_eq!((w1, w2, w3, w4, w5), + ("World","World","World","World","World")); +} diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.nll.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.nll.stderr index d41d3607500..8fb1ebbf7d0 100644 --- a/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.nll.stderr +++ b/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-big.rs:81:26 + --> $DIR/region-borrow-params-issue-29793-big.rs:71:26 | LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -7,7 +7,7 @@ LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate erro | may outlive borrowed value `x` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-big.rs:81:9 + --> $DIR/region-borrow-params-issue-29793-big.rs:71:9 | LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | WrapB::new().set(move |t: bool| if t { x } else { y }) // (separate | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-big.rs:81:26 + --> $DIR/region-borrow-params-issue-29793-big.rs:71:26 | LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -25,7 +25,7 @@ LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate erro | may outlive borrowed value `y` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-big.rs:81:9 + --> $DIR/region-borrow-params-issue-29793-big.rs:71:9 | LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.stderr index 23dc39db129..27d8ce4ab50 100644 --- a/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.stderr +++ b/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/region-borrow-params-issue-29793-big.rs:81:43 + --> $DIR/region-borrow-params-issue-29793-big.rs:71:43 | LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`) | --------- ^ borrowed value does not live long enough @@ -12,7 +12,7 @@ LL | }); = note: values in a scope are dropped in the opposite order they are created error[E0597]: `y` does not live long enough - --> $DIR/region-borrow-params-issue-29793-big.rs:81:54 + --> $DIR/region-borrow-params-issue-29793-big.rs:71:54 | LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`) | --------- ^ borrowed value does not live long enough diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-big.mir.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-big.mir.stderr index d41d3607500..8fb1ebbf7d0 100644 --- a/src/test/ui/regions/region-borrow-params-issue-29793-big.mir.stderr +++ b/src/test/ui/regions/region-borrow-params-issue-29793-big.mir.stderr @@ -1,5 +1,5 @@ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-big.rs:81:26 + --> $DIR/region-borrow-params-issue-29793-big.rs:71:26 | LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -7,7 +7,7 @@ LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate erro | may outlive borrowed value `x` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-big.rs:81:9 + --> $DIR/region-borrow-params-issue-29793-big.rs:71:9 | LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | WrapB::new().set(move |t: bool| if t { x } else { y }) // (separate | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-big.rs:81:26 + --> $DIR/region-borrow-params-issue-29793-big.rs:71:26 | LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -25,7 +25,7 @@ LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate erro | may outlive borrowed value `y` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-big.rs:81:9 + --> $DIR/region-borrow-params-issue-29793-big.rs:71:9 | LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-big.rs b/src/test/ui/regions/region-borrow-params-issue-29793-big.rs index ecd48d0b819..f21140b43de 100644 --- a/src/test/ui/regions/region-borrow-params-issue-29793-big.rs +++ b/src/test/ui/regions/region-borrow-params-issue-29793-big.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #29793, big regression test: do not let borrows of // parameters to ever be returned (expanded with exploration of // variations). diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-small.nll.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-small.nll.stderr index f2d6e796872..18610b7cffb 100644 --- a/src/test/ui/regions/region-borrow-params-issue-29793-small.nll.stderr +++ b/src/test/ui/regions/region-borrow-params-issue-29793-small.nll.stderr @@ -1,5 +1,5 @@ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:19:17 + --> $DIR/region-borrow-params-issue-29793-small.rs:9:17 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -7,7 +7,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x | may outlive borrowed value `x` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:22:16 + --> $DIR/region-borrow-params-issue-29793-small.rs:12:16 | LL | return f; | ^ @@ -17,7 +17,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate errors f | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:19:17 + --> $DIR/region-borrow-params-issue-29793-small.rs:9:17 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -25,7 +25,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x | may outlive borrowed value `y` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:22:16 + --> $DIR/region-borrow-params-issue-29793-small.rs:12:16 | LL | return f; | ^ @@ -35,7 +35,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate errors f | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:34:17 + --> $DIR/region-borrow-params-issue-29793-small.rs:24:17 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -43,7 +43,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x | may outlive borrowed value `x` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:37:9 + --> $DIR/region-borrow-params-issue-29793-small.rs:27:9 | LL | f | ^ @@ -53,7 +53,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate errors f | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:34:17 + --> $DIR/region-borrow-params-issue-29793-small.rs:24:17 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -61,7 +61,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x | may outlive borrowed value `y` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:37:9 + --> $DIR/region-borrow-params-issue-29793-small.rs:27:9 | LL | f | ^ @@ -71,7 +71,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate errors f | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:65:17 + --> $DIR/region-borrow-params-issue-29793-small.rs:55:17 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -79,7 +79,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x | may outlive borrowed value `x` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:68:16 + --> $DIR/region-borrow-params-issue-29793-small.rs:58:16 | LL | return Box::new(f); | ^^^^^^^^^^^ @@ -89,7 +89,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate errors f | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:65:17 + --> $DIR/region-borrow-params-issue-29793-small.rs:55:17 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -97,7 +97,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x | may outlive borrowed value `y` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:68:16 + --> $DIR/region-borrow-params-issue-29793-small.rs:58:16 | LL | return Box::new(f); | ^^^^^^^^^^^ @@ -107,7 +107,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate errors f | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:76:17 + --> $DIR/region-borrow-params-issue-29793-small.rs:66:17 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -115,7 +115,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x | may outlive borrowed value `x` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:79:9 + --> $DIR/region-borrow-params-issue-29793-small.rs:69:9 | LL | Box::new(f) | ^^^^^^^^^^^ @@ -125,7 +125,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate errors f | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:76:17 + --> $DIR/region-borrow-params-issue-29793-small.rs:66:17 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -133,7 +133,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x | may outlive borrowed value `y` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:79:9 + --> $DIR/region-borrow-params-issue-29793-small.rs:69:9 | LL | Box::new(f) | ^^^^^^^^^^^ @@ -143,7 +143,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate errors f | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:100:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:90:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -151,7 +151,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo | may outlive borrowed value `x` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:103:20 + --> $DIR/region-borrow-params-issue-29793-small.rs:93:20 | LL | return Box::new(f); | ^^^^^^^^^^^ @@ -161,7 +161,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:100:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:90:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -169,7 +169,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo | may outlive borrowed value `y` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:103:20 + --> $DIR/region-borrow-params-issue-29793-small.rs:93:20 | LL | return Box::new(f); | ^^^^^^^^^^^ @@ -179,7 +179,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:114:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:104:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -187,7 +187,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo | may outlive borrowed value `x` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:117:13 + --> $DIR/region-borrow-params-issue-29793-small.rs:107:13 | LL | Box::new(f) | ^^^^^^^^^^^ @@ -197,7 +197,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:114:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:104:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -205,7 +205,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo | may outlive borrowed value `y` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:117:13 + --> $DIR/region-borrow-params-issue-29793-small.rs:107:13 | LL | Box::new(f) | ^^^^^^^^^^^ @@ -215,7 +215,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:142:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:132:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -223,7 +223,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo | may outlive borrowed value `x` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:145:20 + --> $DIR/region-borrow-params-issue-29793-small.rs:135:20 | LL | return Box::new(f); | ^^^^^^^^^^^ @@ -233,7 +233,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:142:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:132:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -241,7 +241,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo | may outlive borrowed value `y` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:145:20 + --> $DIR/region-borrow-params-issue-29793-small.rs:135:20 | LL | return Box::new(f); | ^^^^^^^^^^^ @@ -251,7 +251,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:157:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:147:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -259,7 +259,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo | may outlive borrowed value `x` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:160:13 + --> $DIR/region-borrow-params-issue-29793-small.rs:150:13 | LL | Box::new(f) | ^^^^^^^^^^^ @@ -269,7 +269,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:157:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:147:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -277,7 +277,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo | may outlive borrowed value `y` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:160:13 + --> $DIR/region-borrow-params-issue-29793-small.rs:150:13 | LL | Box::new(f) | ^^^^^^^^^^^ @@ -287,7 +287,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:185:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:175:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -295,7 +295,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo | may outlive borrowed value `x` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:188:20 + --> $DIR/region-borrow-params-issue-29793-small.rs:178:20 | LL | return Box::new(f); | ^^^^^^^^^^^ @@ -305,7 +305,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:185:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:175:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -313,7 +313,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo | may outlive borrowed value `y` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:188:20 + --> $DIR/region-borrow-params-issue-29793-small.rs:178:20 | LL | return Box::new(f); | ^^^^^^^^^^^ @@ -323,7 +323,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:199:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:189:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -331,7 +331,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo | may outlive borrowed value `x` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:202:13 + --> $DIR/region-borrow-params-issue-29793-small.rs:192:13 | LL | Box::new(f) | ^^^^^^^^^^^ @@ -341,7 +341,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:199:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:189:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -349,7 +349,7 @@ LL | let f = |t: bool| if t { x } else { y }; // (separate errors fo | may outlive borrowed value `y` | note: closure is returned here - --> $DIR/region-borrow-params-issue-29793-small.rs:202:13 + --> $DIR/region-borrow-params-issue-29793-small.rs:192:13 | LL | Box::new(f) | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-small.rs b/src/test/ui/regions/region-borrow-params-issue-29793-small.rs index 4fda8ec3f38..08ed79cbdbf 100644 --- a/src/test/ui/regions/region-borrow-params-issue-29793-small.rs +++ b/src/test/ui/regions/region-borrow-params-issue-29793-small.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #29793, small regression tests: do not let borrows of // parameters to ever be returned (expanded with exploration of // variations). diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-small.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-small.stderr index cfe38fe2004..d6ad68fe94e 100644 --- a/src/test/ui/regions/region-borrow-params-issue-29793-small.stderr +++ b/src/test/ui/regions/region-borrow-params-issue-29793-small.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/region-borrow-params-issue-29793-small.rs:19:34 + --> $DIR/region-borrow-params-issue-29793-small.rs:9:34 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | --------- ^ borrowed value does not live long enough @@ -12,7 +12,7 @@ LL | }; = note: values in a scope are dropped in the opposite order they are created error[E0597]: `y` does not live long enough - --> $DIR/region-borrow-params-issue-29793-small.rs:19:45 + --> $DIR/region-borrow-params-issue-29793-small.rs:9:45 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | --------- ^ borrowed value does not live long enough @@ -25,7 +25,7 @@ LL | }; = note: values in a scope are dropped in the opposite order they are created error[E0597]: `x` does not live long enough - --> $DIR/region-borrow-params-issue-29793-small.rs:34:34 + --> $DIR/region-borrow-params-issue-29793-small.rs:24:34 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | --------- ^ borrowed value does not live long enough @@ -38,7 +38,7 @@ LL | }; = note: values in a scope are dropped in the opposite order they are created error[E0597]: `y` does not live long enough - --> $DIR/region-borrow-params-issue-29793-small.rs:34:45 + --> $DIR/region-borrow-params-issue-29793-small.rs:24:45 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | --------- ^ borrowed value does not live long enough @@ -51,7 +51,7 @@ LL | }; = note: values in a scope are dropped in the opposite order they are created error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:65:17 + --> $DIR/region-borrow-params-issue-29793-small.rs:55:17 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -63,7 +63,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate errors f | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:65:17 + --> $DIR/region-borrow-params-issue-29793-small.rs:55:17 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -75,7 +75,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate errors f | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:76:17 + --> $DIR/region-borrow-params-issue-29793-small.rs:66:17 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -87,7 +87,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate errors f | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:76:17 + --> $DIR/region-borrow-params-issue-29793-small.rs:66:17 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -99,7 +99,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate errors f | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:100:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:90:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -111,7 +111,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:100:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:90:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -123,7 +123,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:114:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:104:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -135,7 +135,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:114:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:104:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -147,7 +147,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:142:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:132:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -159,7 +159,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:142:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:132:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -171,7 +171,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:157:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:147:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -183,7 +183,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:157:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:147:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -195,7 +195,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:185:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:175:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -207,7 +207,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:185:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:175:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here @@ -219,7 +219,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:199:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:189:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `x` is borrowed here @@ -231,7 +231,7 @@ LL | let f = move |t: bool| if t { x } else { y }; // (separate erro | ^^^^^^^^^^^^^^ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/region-borrow-params-issue-29793-small.rs:199:21 + --> $DIR/region-borrow-params-issue-29793-small.rs:189:21 | LL | let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`) | ^^^^^^^^^ - `y` is borrowed here diff --git a/src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.rs b/src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.rs index 00ca2c7da67..d6b36af9bd6 100644 --- a/src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.rs +++ b/src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test related to #22779. In this case, the impl is an inherent impl, // so it doesn't have to match any trait, so no error results. diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr index f94da326883..fa4c8a9dc6d 100644 --- a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr +++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/region-bound-on-closure-outlives-call.rs:11:1 + --> $DIR/region-bound-on-closure-outlives-call.rs:1:1 | LL | fn call_rec(mut f: F) -> usize where F: FnMut(usize) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -11,7 +11,7 @@ LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` = help: a `loop` may express intention better if this is on purpose error[E0505]: cannot move out of `f` because it is borrowed - --> $DIR/region-bound-on-closure-outlives-call.rs:13:25 + --> $DIR/region-bound-on-closure-outlives-call.rs:3:25 | LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` | ---------- ^ move out of `f` occurs here diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.rs b/src/test/ui/regions/region-bound-on-closure-outlives-call.rs index f931e281c83..1311d5121b5 100644 --- a/src/test/ui/regions/region-bound-on-closure-outlives-call.rs +++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn call_rec(mut f: F) -> usize where F: FnMut(usize) -> usize { //~^ WARN function cannot return without recursing (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr index 6465f1ccf33..3e60efd1472 100644 --- a/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr +++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr @@ -1,5 +1,5 @@ warning: function cannot return without recursing - --> $DIR/region-bound-on-closure-outlives-call.rs:11:1 + --> $DIR/region-bound-on-closure-outlives-call.rs:1:1 | LL | fn call_rec(mut f: F) -> usize where F: FnMut(usize) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing @@ -11,7 +11,7 @@ LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` = help: a `loop` may express intention better if this is on purpose error[E0505]: cannot move out of `f` because it is borrowed - --> $DIR/region-bound-on-closure-outlives-call.rs:13:25 + --> $DIR/region-bound-on-closure-outlives-call.rs:3:25 | LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` | --- ^ move out of `f` occurs here diff --git a/src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.rs b/src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.rs index ff1b74fa020..deef9ab15b0 100644 --- a/src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.rs +++ b/src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test related to #22779, but where the `'a:'b` relation // appears in the trait too. No error here. diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs index fd8d5ff9e7e..3a211b04636 100644 --- a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs +++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test related to when a region bound is required to be specified. trait IsStatic : 'static { } diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr index 7d1a836c674..16c31fbcac0 100644 --- a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr +++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr @@ -1,28 +1,28 @@ error[E0226]: only a single explicit lifetime bound is permitted - --> $DIR/region-bounds-on-objects-and-type-parameters.rs:31:22 + --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:22 | LL | z: Box+'b+'c>, | ^^ error[E0478]: lifetime bound not satisfied - --> $DIR/region-bounds-on-objects-and-type-parameters.rs:31:5 + --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:5 | LL | z: Box+'b+'c>, | ^^^^^^^^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 21:15 - --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:15 +note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 11:15 + --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:15 | LL | struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used | ^^ -note: but lifetime parameter must outlive the lifetime 'a as defined on the struct at 21:12 - --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:12 +note: but lifetime parameter must outlive the lifetime 'a as defined on the struct at 11:12 + --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:12 | LL | struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used | ^^ error[E0392]: parameter `'c` is never used - --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:18 + --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:18 | LL | struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used | ^^ unused type parameter diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.rs b/src/test/ui/regions/region-invariant-static-error-reporting.rs index 646ae8183a2..df92ed51e9a 100644 --- a/src/test/ui/regions/region-invariant-static-error-reporting.rs +++ b/src/test/ui/regions/region-invariant-static-error-reporting.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test checks that the error messages you get for this example // at least mention `'a` and `'static`. The precise messages can drift // over time, but this test used to exhibit some pretty bogus messages diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.stderr index a1f65561d3e..60e70ddcd97 100644 --- a/src/test/ui/regions/region-invariant-static-error-reporting.stderr +++ b/src/test/ui/regions/region-invariant-static-error-reporting.stderr @@ -1,18 +1,20 @@ error[E0308]: if and else have incompatible types - --> $DIR/region-invariant-static-error-reporting.rs:24:15 + --> $DIR/region-invariant-static-error-reporting.rs:17:9 | LL | let bad = if x.is_some() { - | _______________^ + | _______________- LL | | x.unwrap() + | | ---------- expected because of this LL | | } else { LL | | mk_static() + | | ^^^^^^^^^^^ lifetime mismatch LL | | }; - | |_____^ lifetime mismatch + | |_____- if and else have incompatible types | = note: expected type `Invariant<'a>` found type `Invariant<'static>` -note: the lifetime 'a as defined on the function body at 23:10... - --> $DIR/region-invariant-static-error-reporting.rs:23:10 +note: the lifetime 'a as defined on the function body at 13:10... + --> $DIR/region-invariant-static-error-reporting.rs:13:10 | LL | fn unify<'a>(x: Option>, f: fn(Invariant<'a>)) { | ^^ diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs index e3d96f52e81..ab4c6d9cf91 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn a<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) where 'b: 'a { // Note: this is legal because of the `'b:'a` declaration. *x = *y; @@ -21,7 +11,7 @@ fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { // Here we try to call `foo` but do not know that `'a` and `'b` are // related as required. - a(x, y); //~ ERROR 24:7: 24:8: lifetime mismatch [E0623] + a(x, y); //~ ERROR lifetime mismatch [E0623] } fn d() { diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr index 0ca7ee8d8a5..47e1d0efdc7 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:18:10 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:8:10 | LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... @@ -8,22 +8,22 @@ LL | *x = *y; //~ ERROR E0623 | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:24:7 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:14:7 | LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... ... -LL | a(x, y); //~ ERROR 24:7: 24:8: lifetime mismatch [E0623] +LL | a(x, y); //~ ERROR lifetime mismatch [E0623] | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types - --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:30:43 + --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:43 | LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types - | ^ expected concrete lifetime, found bound lifetime parameter + | ^ one type is more general than the other | = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` - found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}` + found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)` error: aborting due to 3 previous errors diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs index d8d12444ddd..066522548ad 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn a<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) where 'b: 'a + 'c { // Note: this is legal because of the `'b:'a` declaration. *x = *y; @@ -23,13 +13,13 @@ fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { // Here we try to call `foo` but do not know that `'a` and `'b` are // related as required. - a(x, y, z); //~ ERROR 26:7: 26:8: lifetime mismatch [E0623] + a(x, y, z); //~ ERROR lifetime mismatch [E0623] } fn d() { // 'a and 'b are early bound in the function `a` because they appear // inconstraints: - let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR mismatched types + let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR E0308 } fn e() { diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr index 26e24b2ed16..1e7b99053f7 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:19:10 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:9:10 | LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- these two types are declared with different lifetimes... @@ -8,7 +8,7 @@ LL | *x = *y; //~ ERROR E0623 | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:20:10 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:10:10 | LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- @@ -19,22 +19,22 @@ LL | *z = *y; //~ ERROR E0623 | ^^ ...but data from `y` flows into `z` here error[E0623]: lifetime mismatch - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:26:7 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:16:7 | LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- these two types are declared with different lifetimes... ... -LL | a(x, y, z); //~ ERROR 26:7: 26:8: lifetime mismatch [E0623] +LL | a(x, y, z); //~ ERROR lifetime mismatch [E0623] | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types - --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:32:56 + --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:56 | -LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR mismatched types - | ^ expected concrete lifetime, found bound lifetime parameter +LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR E0308 + | ^ one type is more general than the other | = note: expected type `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)` - found type `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize) {a::<'_, '_, '_>}` + found type `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize)` error: aborting due to 4 previous errors diff --git a/src/test/ui/regions/region-object-lifetime-1.rs b/src/test/ui/regions/region-object-lifetime-1.rs index 36c87b729d8..ab24eda2c2d 100644 --- a/src/test/ui/regions/region-object-lifetime-1.rs +++ b/src/test/ui/regions/region-object-lifetime-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Various tests related to testing how region inference works // with respect to the object receivers. diff --git a/src/test/ui/regions/region-object-lifetime-2.rs b/src/test/ui/regions/region-object-lifetime-2.rs index e011b8f5697..92c85020e9a 100644 --- a/src/test/ui/regions/region-object-lifetime-2.rs +++ b/src/test/ui/regions/region-object-lifetime-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Various tests related to testing how region inference works // with respect to the object receivers. diff --git a/src/test/ui/regions/region-object-lifetime-2.stderr b/src/test/ui/regions/region-object-lifetime-2.stderr index 314f43585fe..f1e87ebf474 100644 --- a/src/test/ui/regions/region-object-lifetime-2.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements - --> $DIR/region-object-lifetime-2.rs:20:7 + --> $DIR/region-object-lifetime-2.rs:10:7 | LL | x.borrowed() //~ ERROR cannot infer | ^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 19:42... - --> $DIR/region-object-lifetime-2.rs:19:42 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:42... + --> $DIR/region-object-lifetime-2.rs:9:42 | LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/region-object-lifetime-2.rs:20:5 + --> $DIR/region-object-lifetime-2.rs:10:5 | LL | x.borrowed() //~ ERROR cannot infer | ^ -note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 19:45... - --> $DIR/region-object-lifetime-2.rs:19:45 +note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 9:45... + --> $DIR/region-object-lifetime-2.rs:9:45 | LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/region-object-lifetime-2.rs:20:5 + --> $DIR/region-object-lifetime-2.rs:10:5 | LL | x.borrowed() //~ ERROR cannot infer | ^^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-object-lifetime-3.rs b/src/test/ui/regions/region-object-lifetime-3.rs index d7bfb735e00..cda48347061 100644 --- a/src/test/ui/regions/region-object-lifetime-3.rs +++ b/src/test/ui/regions/region-object-lifetime-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Various tests related to testing how region inference works // with respect to the object receivers. diff --git a/src/test/ui/regions/region-object-lifetime-4.rs b/src/test/ui/regions/region-object-lifetime-4.rs index 0a68e7f1076..d2ab617ebb7 100644 --- a/src/test/ui/regions/region-object-lifetime-4.rs +++ b/src/test/ui/regions/region-object-lifetime-4.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Various tests related to testing how region inference works // with respect to the object receivers. diff --git a/src/test/ui/regions/region-object-lifetime-4.stderr b/src/test/ui/regions/region-object-lifetime-4.stderr index ef62afbef3b..862a469ddb9 100644 --- a/src/test/ui/regions/region-object-lifetime-4.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements - --> $DIR/region-object-lifetime-4.rs:22:7 + --> $DIR/region-object-lifetime-4.rs:12:7 | LL | x.borrowed() //~ ERROR cannot infer | ^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 21:41... - --> $DIR/region-object-lifetime-4.rs:21:41 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 11:41... + --> $DIR/region-object-lifetime-4.rs:11:41 | LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/region-object-lifetime-4.rs:22:5 + --> $DIR/region-object-lifetime-4.rs:12:5 | LL | x.borrowed() //~ ERROR cannot infer | ^ -note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 21:44... - --> $DIR/region-object-lifetime-4.rs:21:44 +note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 11:44... + --> $DIR/region-object-lifetime-4.rs:11:44 | LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/region-object-lifetime-4.rs:22:5 + --> $DIR/region-object-lifetime-4.rs:12:5 | LL | x.borrowed() //~ ERROR cannot infer | ^^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-object-lifetime-5.nll.stderr b/src/test/ui/regions/region-object-lifetime-5.nll.stderr index 59871a510d3..c6d7135a2db 100644 --- a/src/test/ui/regions/region-object-lifetime-5.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-5.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local data `*x` - --> $DIR/region-object-lifetime-5.rs:21:5 + --> $DIR/region-object-lifetime-5.rs:11:5 | LL | x.borrowed() //~ ERROR `*x` does not live long enough | -^^^^^^^^^^^ diff --git a/src/test/ui/regions/region-object-lifetime-5.rs b/src/test/ui/regions/region-object-lifetime-5.rs index 26aad0e33b1..5009b2bbf32 100644 --- a/src/test/ui/regions/region-object-lifetime-5.rs +++ b/src/test/ui/regions/region-object-lifetime-5.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Various tests related to testing how region inference works // with respect to the object receivers. diff --git a/src/test/ui/regions/region-object-lifetime-5.stderr b/src/test/ui/regions/region-object-lifetime-5.stderr index 2dbdacfacdc..002bae18b1c 100644 --- a/src/test/ui/regions/region-object-lifetime-5.stderr +++ b/src/test/ui/regions/region-object-lifetime-5.stderr @@ -1,5 +1,5 @@ error[E0597]: `*x` does not live long enough - --> $DIR/region-object-lifetime-5.rs:21:5 + --> $DIR/region-object-lifetime-5.rs:11:5 | LL | x.borrowed() //~ ERROR `*x` does not live long enough | ^ borrowed value does not live long enough diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.rs b/src/test/ui/regions/region-object-lifetime-in-coercion.rs index 5bf397ab383..dfba04b0d25 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.rs +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that attempts to implicitly coerce a value into an // object respect the lifetime bound on the object type. diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr index ac8c4d3a16a..b8ea6d3476b 100644 --- a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr +++ b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `v` - --> $DIR/region-object-lifetime-in-coercion.rs:18:33 + --> $DIR/region-object-lifetime-in-coercion.rs:8:33 | LL | fn a(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` @@ -7,7 +7,7 @@ LL | let x: Box = Box::new(v); | ^^^^^^^^^^^ lifetime `'static` required error[E0621]: explicit lifetime required in the type of `v` - --> $DIR/region-object-lifetime-in-coercion.rs:24:5 + --> $DIR/region-object-lifetime-in-coercion.rs:14:5 | LL | fn b(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` @@ -15,7 +15,7 @@ LL | Box::new(v) | ^^^^^^^^^^^ lifetime `'static` required error[E0621]: explicit lifetime required in the type of `v` - --> $DIR/region-object-lifetime-in-coercion.rs:31:5 + --> $DIR/region-object-lifetime-in-coercion.rs:21:5 | LL | fn c(v: &[u8]) -> Box { | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]` @@ -24,21 +24,21 @@ LL | Box::new(v) | ^^^^^^^^^^^ lifetime `'static` required error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/region-object-lifetime-in-coercion.rs:36:14 + --> $DIR/region-object-lifetime-in-coercion.rs:26:14 | LL | Box::new(v) | ^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 35:6... - --> $DIR/region-object-lifetime-in-coercion.rs:35:6 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 25:6... + --> $DIR/region-object-lifetime-in-coercion.rs:25:6 | LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | ^^ = note: ...so that the expression is assignable: expected &[u8] found &'a [u8] -note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 35:9... - --> $DIR/region-object-lifetime-in-coercion.rs:35:9 +note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 25:9... + --> $DIR/region-object-lifetime-in-coercion.rs:25:9 | LL | fn d<'a,'b>(v: &'a [u8]) -> Box { | ^^ diff --git a/src/test/ui/regions/regions-addr-of-arg.nll.stderr b/src/test/ui/regions/regions-addr-of-arg.nll.stderr index bfe5bd8ae69..0f60bc669b2 100644 --- a/src/test/ui/regions/regions-addr-of-arg.nll.stderr +++ b/src/test/ui/regions/regions-addr-of-arg.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/regions-addr-of-arg.rs:15:30 + --> $DIR/regions-addr-of-arg.rs:5:30 | LL | let _p: &'static isize = &a; //~ ERROR `a` does not live long enough | -------------- ^^ borrowed value does not live long enough @@ -9,7 +9,7 @@ LL | } | - `a` dropped here while still borrowed error[E0515]: cannot return reference to function parameter `a` - --> $DIR/regions-addr-of-arg.rs:23:5 + --> $DIR/regions-addr-of-arg.rs:13:5 | LL | &a //~ ERROR `a` does not live long enough | ^^ returns a reference to data owned by the current function diff --git a/src/test/ui/regions/regions-addr-of-arg.rs b/src/test/ui/regions/regions-addr-of-arg.rs index c54b4aaace5..06f16be8217 100644 --- a/src/test/ui/regions/regions-addr-of-arg.rs +++ b/src/test/ui/regions/regions-addr-of-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that taking the address of an argument yields a lifetime // bounded by the current function call. diff --git a/src/test/ui/regions/regions-addr-of-arg.stderr b/src/test/ui/regions/regions-addr-of-arg.stderr index 9158a4ac7a7..61e28b8bbea 100644 --- a/src/test/ui/regions/regions-addr-of-arg.stderr +++ b/src/test/ui/regions/regions-addr-of-arg.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/regions-addr-of-arg.rs:15:31 + --> $DIR/regions-addr-of-arg.rs:5:31 | LL | let _p: &'static isize = &a; //~ ERROR `a` does not live long enough | ^ borrowed value does not live long enough @@ -9,15 +9,15 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: `a` does not live long enough - --> $DIR/regions-addr-of-arg.rs:23:6 + --> $DIR/regions-addr-of-arg.rs:13:6 | LL | &a //~ ERROR `a` does not live long enough | ^ borrowed value does not live long enough LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 22:8... - --> $DIR/regions-addr-of-arg.rs:22:8 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 12:8... + --> $DIR/regions-addr-of-arg.rs:12:8 | LL | fn zed<'a>(a: isize) -> &'a isize { | ^^ diff --git a/src/test/ui/regions/regions-addr-of-self.rs b/src/test/ui/regions/regions-addr-of-self.rs index 04ee0526403..647212407fc 100644 --- a/src/test/ui/regions/regions-addr-of-self.rs +++ b/src/test/ui/regions/regions-addr-of-self.rs @@ -1,18 +1,8 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct dog { +struct Dog { cats_chased: usize, } -impl dog { +impl Dog { pub fn chase_cat(&mut self) { let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer *p += 1; @@ -24,8 +14,8 @@ impl dog { } } -fn dog() -> dog { - dog { +fn dog() -> Dog { + Dog { cats_chased: 0 } } diff --git a/src/test/ui/regions/regions-addr-of-self.stderr b/src/test/ui/regions/regions-addr-of-self.stderr index 387aeeb8a5b..2ea8aecacda 100644 --- a/src/test/ui/regions/regions-addr-of-self.stderr +++ b/src/test/ui/regions/regions-addr-of-self.stderr @@ -1,11 +1,11 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements - --> $DIR/regions-addr-of-self.rs:17:37 + --> $DIR/regions-addr-of-self.rs:7:37 | LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer | ^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 16:5... - --> $DIR/regions-addr-of-self.rs:16:5 +note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 6:5... + --> $DIR/regions-addr-of-self.rs:6:5 | LL | / pub fn chase_cat(&mut self) { LL | | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer @@ -13,13 +13,13 @@ LL | | *p += 1; LL | | } | |_____^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-addr-of-self.rs:17:37 + --> $DIR/regions-addr-of-self.rs:7:37 | LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer | ^^^^^^^^^^^^^^^^^^^^^ = note: but, the lifetime must be valid for the static lifetime... note: ...so that reference does not outlive borrowed content - --> $DIR/regions-addr-of-self.rs:17:37 + --> $DIR/regions-addr-of-self.rs:7:37 | LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.rs b/src/test/ui/regions/regions-addr-of-upvar-self.rs index 28491f1155c..1f8fe9a4439 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.rs +++ b/src/test/ui/regions/regions-addr-of-upvar-self.rs @@ -1,20 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::usize; -struct dog { +struct Dog { food: usize, } -impl dog { +impl Dog { pub fn chase_cat(&mut self) { let _f = || { let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.stderr index 35e721288cd..97470aae54a 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.stderr +++ b/src/test/ui/regions/regions-addr-of-upvar-self.stderr @@ -1,22 +1,22 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements - --> $DIR/regions-addr-of-upvar-self.rs:20:41 + --> $DIR/regions-addr-of-upvar-self.rs:10:41 | LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer | ^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime as defined on the body at 19:18... - --> $DIR/regions-addr-of-upvar-self.rs:19:18 +note: first, the lifetime cannot outlive the lifetime as defined on the body at 9:18... + --> $DIR/regions-addr-of-upvar-self.rs:9:18 | LL | let _f = || { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-addr-of-upvar-self.rs:20:41 + --> $DIR/regions-addr-of-upvar-self.rs:10:41 | LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer | ^^^^^^^^^^^^^^ = note: but, the lifetime must be valid for the static lifetime... note: ...so that reference does not outlive borrowed content - --> $DIR/regions-addr-of-upvar-self.rs:20:41 + --> $DIR/regions-addr-of-upvar-self.rs:10:41 | LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr b/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr index fa963714849..f188da5038d 100644 --- a/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr +++ b/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable - --> $DIR/regions-adjusted-lvalue-op.rs:24:16 + --> $DIR/regions-adjusted-lvalue-op.rs:14:16 | LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because | - ----- ^^ immutable borrow occurs here @@ -8,7 +8,7 @@ LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because | mutable borrow occurs here error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable - --> $DIR/regions-adjusted-lvalue-op.rs:25:16 + --> $DIR/regions-adjusted-lvalue-op.rs:15:16 | LL | (*v).oh_no(&v); //~ ERROR cannot borrow `v` as immutable because | - ----- ^^ immutable borrow occurs here diff --git a/src/test/ui/regions/regions-adjusted-lvalue-op.rs b/src/test/ui/regions/regions-adjusted-lvalue-op.rs index bb02d6d8bba..5aa5a3ecb24 100644 --- a/src/test/ui/regions/regions-adjusted-lvalue-op.rs +++ b/src/test/ui/regions/regions-adjusted-lvalue-op.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that we link regions in mutable place ops correctly - issue #41774 struct Data(i32); diff --git a/src/test/ui/regions/regions-adjusted-lvalue-op.stderr b/src/test/ui/regions/regions-adjusted-lvalue-op.stderr index 95228d9ccbb..9988289b91e 100644 --- a/src/test/ui/regions/regions-adjusted-lvalue-op.stderr +++ b/src/test/ui/regions/regions-adjusted-lvalue-op.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable - --> $DIR/regions-adjusted-lvalue-op.rs:24:17 + --> $DIR/regions-adjusted-lvalue-op.rs:14:17 | LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because | - ^- mutable borrow ends here @@ -8,7 +8,7 @@ LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because | mutable borrow occurs here error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable - --> $DIR/regions-adjusted-lvalue-op.rs:25:17 + --> $DIR/regions-adjusted-lvalue-op.rs:15:17 | LL | (*v).oh_no(&v); //~ ERROR cannot borrow `v` as immutable because | - ^- mutable borrow ends here diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.ast.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.ast.stderr new file mode 100644 index 00000000000..76ead4e94ef --- /dev/null +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.ast.stderr @@ -0,0 +1,20 @@ +error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifetime than the data it references + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:45:13 + | +LL | let _x: &'a WithAssoc> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the pointer is valid for the lifetime 'a as defined on the function body at 37:15 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:37:15 + | +LL | fn with_assoc<'a,'b>() { + | ^^ +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 37:18 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:37:18 + | +LL | fn with_assoc<'a,'b>() { + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0491`. diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.mir.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.mir.stderr new file mode 100644 index 00000000000..ad94d375b5b --- /dev/null +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.mir.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:45:13 + | +LL | fn with_assoc<'a,'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let _x: &'a WithAssoc> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs index 741feb1f9ea..1d534921992 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs @@ -1,18 +1,11 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are imposing the requirement that every associated // type of a bound that appears in the where clause on a struct must // outlive the location in which the type appears, even when the // associted type is in a supertype. Issue #22246. +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + #![allow(dead_code)] /////////////////////////////////////////////////////////////////////////// @@ -50,7 +43,8 @@ fn with_assoc<'a,'b>() { // FIXME (#54943) NLL doesn't enforce WF condition in unreachable code if // `_x` is changed to `_` let _x: &'a WithAssoc> = loop { }; - //~^ ERROR reference has a longer lifetime + //[ast]~^ ERROR reference has a longer lifetime + //[mir]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.stderr index 7959d1b6c23..aa92c59cee0 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.stderr +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.stderr @@ -1,16 +1,16 @@ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:52:13 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:42:13 | LL | let _x: &'a WithAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the function body at 44:15 - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:44:15 +note: the pointer is valid for the lifetime 'a as defined on the function body at 34:15 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:34:15 | LL | fn with_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 44:18 - --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:44:18 +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 34:18 + --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:34:18 | LL | fn with_assoc<'a,'b>() { | ^^ diff --git a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.rs b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.rs index f921eccef1f..26cb40bb5c2 100644 --- a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.rs +++ b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the compiler checks that arbitrary region bounds declared // in the trait must be satisfied on the impl. Issue #20890. diff --git a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr index 2261e92166e..d01e9911039 100644 --- a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr +++ b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr @@ -1,11 +1,11 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:24:10 + --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:14:10 | LL | impl<'a> Foo<'static> for &'a i32 { | ^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 24:6... - --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:24:6 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 14:6... + --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:14:6 | LL | impl<'a> Foo<'static> for &'a i32 { | ^^ @@ -14,32 +14,32 @@ LL | impl<'a> Foo<'static> for &'a i32 { found Foo<'static> = note: but, the lifetime must be valid for the static lifetime... note: ...so that the type `&i32` will meet its required lifetime bounds - --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:24:10 + --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:14:10 | LL | impl<'a> Foo<'static> for &'a i32 { | ^^^^^^^^^^^^ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:29:13 + --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:13 | LL | impl<'a,'b> Foo<'b> for &'a i64 { | ^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 29:6... - --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:29:6 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 19:6... + --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:6 | LL | impl<'a,'b> Foo<'b> for &'a i64 { | ^^ = note: ...so that the types are compatible: expected Foo<'b> found Foo<'_> -note: but, the lifetime must be valid for the lifetime 'b as defined on the impl at 29:9... - --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:29:9 +note: but, the lifetime must be valid for the lifetime 'b as defined on the impl at 19:9... + --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:9 | LL | impl<'a,'b> Foo<'b> for &'a i64 { | ^^ note: ...so that the type `&i32` will meet its required lifetime bounds - --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:29:13 + --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:19:13 | LL | impl<'a,'b> Foo<'b> for &'a i64 { | ^^^^^^^ diff --git a/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.rs b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.rs index 1cf83b8ac58..599cd0bb756 100644 --- a/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.rs +++ b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the compiler checks that the 'static bound declared in // the trait must be satisfied on the impl. Issue #20890. diff --git a/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr index a7ae685c3a4..33a4ea01ce2 100644 --- a/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr +++ b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr @@ -1,11 +1,11 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:19:10 + --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:9:10 | LL | impl<'a> Foo for &'a i32 { | ^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 19:6... - --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:19:6 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 9:6... + --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:9:6 | LL | impl<'a> Foo for &'a i32 { | ^^ @@ -14,7 +14,7 @@ LL | impl<'a> Foo for &'a i32 { found Foo = note: but, the lifetime must be valid for the static lifetime... note: ...so that the type `&i32` will meet its required lifetime bounds - --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:19:10 + --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:9:10 | LL | impl<'a> Foo for &'a i32 { | ^^^ diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs index 19c50d57e1b..c583f43638a 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test which of the builtin types are considered sendable. The tests // in this file all test region bound and lifetime violations that are // detected during type check. diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr index 82fa271ca4e..dbda9f4067b 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr @@ -1,5 +1,5 @@ error[E0477]: the type `&'a isize` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:32:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:22:5 | LL | assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lifetime | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lif = note: type must satisfy the static lifetime error[E0477]: the type `&'a str` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:36:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 | LL | assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifetime | ^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifet = note: type must satisfy the static lifetime error[E0477]: the type `&'a [isize]` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:40:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5 | LL | assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required lifetime | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required l = note: type must satisfy the static lifetime error[E0477]: the type `std::boxed::Box<&'a isize>` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:54:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5 | LL | assert_send::>(); //~ ERROR does not fulfill the required lifetime | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | assert_send::>(); //~ ERROR does not fulfill the require = note: type must satisfy the static lifetime error[E0477]: the type `*const &'a isize` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:65:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5 | LL | assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the required lifetime | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the requi = note: type must satisfy the static lifetime error[E0477]: the type `*mut &'a isize` does not fulfill the required lifetime - --> $DIR/regions-bounded-by-trait-requiring-static.rs:69:5 + --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5 | LL | assert_send::<*mut &'a isize>(); //~ ERROR does not fulfill the required lifetime | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs index 24e4c5fbd91..a7987d0e1fe 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rbmtp_cross_crate_lib.rs // Check explicit region bounds on methods in the cross crate case. @@ -27,7 +17,7 @@ fn call_into_maybe_owned<'x,F:IntoMaybeOwned<'x>>(f: F) { fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { // Here the value provided for 'y is 'y, and hence 'y:'x does not hold. - a.bigger_region(b) //~ ERROR 30:7: 30:20: lifetime mismatch [E0623] + a.bigger_region(b) //~ ERROR lifetime mismatch [E0623] } fn main() { } diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr index 898629d8ab9..50339590ee5 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr @@ -1,10 +1,10 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:30:7 + --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:20:7 | LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { | ------- ------- these two types are declared with different lifetimes... LL | // Here the value provided for 'y is 'y, and hence 'y:'x does not hold. -LL | a.bigger_region(b) //~ ERROR 30:7: 30:20: lifetime mismatch [E0623] +LL | a.bigger_region(b) //~ ERROR lifetime mismatch [E0623] | ^^^^^^^^^^^^^ ...but data from `b` flows into `a` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs index 3e9d2aa6c3b..8adf496b230 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that explicit region bounds are allowed on the various // nominal types (but not on other types) and that they are type // checked. @@ -27,7 +17,7 @@ fn caller1<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { // Here the value provided for 'y is 'b, and hence 'b:'a does not hold. - f.method(b); //~ ERROR 30:7: 30:13: lifetime mismatch [E0623] + f.method(b); //~ ERROR lifetime mismatch [E0623] } fn caller3<'a,'b:'a,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr index f9f9c38b1b6..c9cbacded90 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr @@ -1,10 +1,10 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:30:7 + --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:20:7 | LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { | ------- ------- these two types are declared with different lifetimes... LL | // Here the value provided for 'y is 'b, and hence 'b:'a does not hold. -LL | f.method(b); //~ ERROR 30:7: 30:13: lifetime mismatch [E0623] +LL | f.method(b); //~ ERROR lifetime mismatch [E0623] | ^^^^^^ ...but data from `b` flows into `a` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.rs b/src/test/ui/regions/regions-bounded-method-type-parameters.rs index da4e8231a23..90af120f052 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.rs +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that explicit region bounds are allowed on the various // nominal types (but not on other types) and that they are type // checked. diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.stderr index 8649ca9281f..66b61b1349d 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.stderr @@ -1,5 +1,5 @@ error[E0477]: the type `&'a isize` does not fulfill the required lifetime - --> $DIR/regions-bounded-method-type-parameters.rs:22:9 + --> $DIR/regions-bounded-method-type-parameters.rs:12:9 | LL | Foo.some_method::<&'a isize>(); | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-bounds.rs b/src/test/ui/regions/regions-bounds.rs index 5ce80be98d9..d3e4e6e8712 100644 --- a/src/test/ui/regions/regions-bounds.rs +++ b/src/test/ui/regions/regions-bounds.rs @@ -1,25 +1,15 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that explicit region bounds are allowed on the various // nominal types (but not on other types) and that they are type // checked. -struct an_enum<'a>(&'a isize); -struct a_class<'a> { x:&'a isize } +struct TupleStruct<'a>(&'a isize); +struct Struct<'a> { x:&'a isize } -fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> { +fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { return e; //~ ERROR mismatched types } -fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> { +fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { return e; //~ ERROR mismatched types } diff --git a/src/test/ui/regions/regions-bounds.stderr b/src/test/ui/regions/regions-bounds.stderr index 7d5a47c0df3..95857e98775 100644 --- a/src/test/ui/regions/regions-bounds.stderr +++ b/src/test/ui/regions/regions-bounds.stderr @@ -1,39 +1,39 @@ error[E0308]: mismatched types - --> $DIR/regions-bounds.rs:19:12 + --> $DIR/regions-bounds.rs:9:12 | LL | return e; //~ ERROR mismatched types | ^ lifetime mismatch | - = note: expected type `an_enum<'b>` - found type `an_enum<'a>` -note: the lifetime 'a as defined on the function body at 18:10... - --> $DIR/regions-bounds.rs:18:10 + = note: expected type `TupleStruct<'b>` + found type `TupleStruct<'a>` +note: the lifetime 'a as defined on the function body at 8:10... + --> $DIR/regions-bounds.rs:8:10 | -LL | fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> { +LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { | ^^ -note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 18:13 - --> $DIR/regions-bounds.rs:18:13 +note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 8:13 + --> $DIR/regions-bounds.rs:8:13 | -LL | fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> { +LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { | ^^ error[E0308]: mismatched types - --> $DIR/regions-bounds.rs:23:12 + --> $DIR/regions-bounds.rs:13:12 | LL | return e; //~ ERROR mismatched types | ^ lifetime mismatch | - = note: expected type `a_class<'b>` - found type `a_class<'a>` -note: the lifetime 'a as defined on the function body at 22:10... - --> $DIR/regions-bounds.rs:22:10 + = note: expected type `Struct<'b>` + found type `Struct<'a>` +note: the lifetime 'a as defined on the function body at 12:10... + --> $DIR/regions-bounds.rs:12:10 | -LL | fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> { +LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { | ^^ -note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 22:13 - --> $DIR/regions-bounds.rs:22:13 +note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 12:13 + --> $DIR/regions-bounds.rs:12:13 | -LL | fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> { +LL | fn a_fn3<'a,'b>(e: Struct<'a>) -> Struct<'b> { | ^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.rs b/src/test/ui/regions/regions-close-associated-type-into-object.rs index 6b88abfca6c..853d9611387 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.rs +++ b/src/test/ui/regions/regions-close-associated-type-into-object.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] trait X {} diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.stderr b/src/test/ui/regions/regions-close-associated-type-into-object.stderr index 9d56de4c152..182081ede0c 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.stderr +++ b/src/test/ui/regions/regions-close-associated-type-into-object.stderr @@ -1,51 +1,51 @@ error[E0310]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:25:5 + --> $DIR/regions-close-associated-type-into-object.rs:15:5 | LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough | ^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `::Item: 'static`... note: ...so that the type `::Item` will meet its required lifetime bounds - --> $DIR/regions-close-associated-type-into-object.rs:25:5 + --> $DIR/regions-close-associated-type-into-object.rs:15:5 | LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough | ^^^^^^^^^^^^^^ error[E0310]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:32:5 + --> $DIR/regions-close-associated-type-into-object.rs:22:5 | LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough | ^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `::Item: 'static`... note: ...so that the type `std::boxed::Box<::Item>` will meet its required lifetime bounds - --> $DIR/regions-close-associated-type-into-object.rs:32:5 + --> $DIR/regions-close-associated-type-into-object.rs:22:5 | LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough | ^^^^^^^^^^^^^^ error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:38:5 + --> $DIR/regions-close-associated-type-into-object.rs:28:5 | LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough | ^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `::Item: 'a`... note: ...so that the type `::Item` will meet its required lifetime bounds - --> $DIR/regions-close-associated-type-into-object.rs:38:5 + --> $DIR/regions-close-associated-type-into-object.rs:28:5 | LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough | ^^^^^^^^^^^^^^ error[E0309]: the associated type `::Item` may not live long enough - --> $DIR/regions-close-associated-type-into-object.rs:45:5 + --> $DIR/regions-close-associated-type-into-object.rs:35:5 | LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough | ^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `::Item: 'a`... note: ...so that the type `std::boxed::Box<::Item>` will meet its required lifetime bounds - --> $DIR/regions-close-associated-type-into-object.rs:45:5 + --> $DIR/regions-close-associated-type-into-object.rs:35:5 | LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr index 9ad7ee8d447..0e68a0548e6 100644 --- a/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local data `*v` - --> $DIR/regions-close-object-into-object-1.rs:22:5 + --> $DIR/regions-close-object-into-object-1.rs:12:5 | LL | box B(&*v) as Box //~ ERROR `*v` does not live long enough | ^^^^^^---^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-close-object-into-object-1.rs b/src/test/ui/regions/regions-close-object-into-object-1.rs index 5d9818d624b..7a862f97a99 100644 --- a/src/test/ui/regions/regions-close-object-into-object-1.rs +++ b/src/test/ui/regions/regions-close-object-into-object-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] #![allow(warnings)] diff --git a/src/test/ui/regions/regions-close-object-into-object-1.stderr b/src/test/ui/regions/regions-close-object-into-object-1.stderr index bd05a63c398..817f664db45 100644 --- a/src/test/ui/regions/regions-close-object-into-object-1.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-1.stderr @@ -1,5 +1,5 @@ error[E0597]: `*v` does not live long enough - --> $DIR/regions-close-object-into-object-1.rs:22:12 + --> $DIR/regions-close-object-into-object-1.rs:12:12 | LL | box B(&*v) as Box //~ ERROR `*v` does not live long enough | ^^ borrowed value does not live long enough diff --git a/src/test/ui/regions/regions-close-object-into-object-2.rs b/src/test/ui/regions/regions-close-object-into-object-2.rs index 6cef9956655..cebb4ac68cb 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.rs +++ b/src/test/ui/regions/regions-close-object-into-object-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] trait A { } diff --git a/src/test/ui/regions/regions-close-object-into-object-2.stderr b/src/test/ui/regions/regions-close-object-into-object-2.stderr index b2e44cd2c77..de9a250ced6 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.stderr @@ -1,16 +1,16 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements - --> $DIR/regions-close-object-into-object-2.rs:20:11 + --> $DIR/regions-close-object-into-object-2.rs:10:11 | LL | box B(&*v) as Box //~ ERROR cannot infer | ^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 19:6... - --> $DIR/regions-close-object-into-object-2.rs:19:6 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:6... + --> $DIR/regions-close-object-into-object-2.rs:9:6 | LL | fn g<'a, T: 'static>(v: Box+'a>) -> Box { | ^^ note: ...so that the type `(dyn A + 'a)` is not borrowed for too long - --> $DIR/regions-close-object-into-object-2.rs:20:11 + --> $DIR/regions-close-object-into-object-2.rs:10:11 | LL | box B(&*v) as Box //~ ERROR cannot infer | ^^^ diff --git a/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr index 56ce993dc71..6225575ddf3 100644 --- a/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local data `*v` - --> $DIR/regions-close-object-into-object-3.rs:21:5 + --> $DIR/regions-close-object-into-object-3.rs:11:5 | LL | box B(&*v) as Box //~ ERROR `*v` does not live long enough | ^^^^^^---^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-close-object-into-object-3.rs b/src/test/ui/regions/regions-close-object-into-object-3.rs index 3004245b15a..cafbf093224 100644 --- a/src/test/ui/regions/regions-close-object-into-object-3.rs +++ b/src/test/ui/regions/regions-close-object-into-object-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] #![allow(warnings)] diff --git a/src/test/ui/regions/regions-close-object-into-object-3.stderr b/src/test/ui/regions/regions-close-object-into-object-3.stderr index 9e412e50da9..1736a5f215c 100644 --- a/src/test/ui/regions/regions-close-object-into-object-3.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-3.stderr @@ -1,5 +1,5 @@ error[E0597]: `*v` does not live long enough - --> $DIR/regions-close-object-into-object-3.rs:21:12 + --> $DIR/regions-close-object-into-object-3.rs:11:12 | LL | box B(&*v) as Box //~ ERROR `*v` does not live long enough | ^^ borrowed value does not live long enough diff --git a/src/test/ui/regions/regions-close-object-into-object-4.rs b/src/test/ui/regions/regions-close-object-into-object-4.rs index bc5b7b7cf78..91aab057bb9 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.rs +++ b/src/test/ui/regions/regions-close-object-into-object-4.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] trait A { } diff --git a/src/test/ui/regions/regions-close-object-into-object-4.stderr b/src/test/ui/regions/regions-close-object-into-object-4.stderr index 15e53f1b54d..87bf28d74d4 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.stderr @@ -1,16 +1,16 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements - --> $DIR/regions-close-object-into-object-4.rs:20:11 + --> $DIR/regions-close-object-into-object-4.rs:10:11 | LL | box B(&*v) as Box //~ ERROR cannot infer | ^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 19:6... - --> $DIR/regions-close-object-into-object-4.rs:19:6 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:6... + --> $DIR/regions-close-object-into-object-4.rs:9:6 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | ^^ note: ...so that the type `(dyn A + 'a)` is not borrowed for too long - --> $DIR/regions-close-object-into-object-4.rs:20:11 + --> $DIR/regions-close-object-into-object-4.rs:10:11 | LL | box B(&*v) as Box //~ ERROR cannot infer | ^^^ diff --git a/src/test/ui/regions/regions-close-object-into-object-5.rs b/src/test/ui/regions/regions-close-object-into-object-5.rs index 6cbe5234ce0..609c8ce2792 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.rs +++ b/src/test/ui/regions/regions-close-object-into-object-5.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] #![allow(warnings)] diff --git a/src/test/ui/regions/regions-close-object-into-object-5.stderr b/src/test/ui/regions/regions-close-object-into-object-5.stderr index 2c3cc603e04..390f8e7baa3 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-5.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:27:5 + --> $DIR/regions-close-object-into-object-5.rs:17:5 | LL | fn f<'a, T, U>(v: Box+'static>) -> Box { | - help: consider adding an explicit lifetime bound `T: 'static`... @@ -8,13 +8,13 @@ LL | box B(&*v) as Box | ^^^^^^^^^^ | note: ...so that the type `B<'_, T>` will meet its required lifetime bounds - --> $DIR/regions-close-object-into-object-5.rs:27:5 + --> $DIR/regions-close-object-into-object-5.rs:17:5 | LL | box B(&*v) as Box | ^^^^^^^^^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:27:5 + --> $DIR/regions-close-object-into-object-5.rs:17:5 | LL | fn f<'a, T, U>(v: Box+'static>) -> Box { | - help: consider adding an explicit lifetime bound `T: 'static`... @@ -23,13 +23,13 @@ LL | box B(&*v) as Box | ^^^^^^^^^^^^^^^^^^^^ | note: ...so that it can be closed over into an object - --> $DIR/regions-close-object-into-object-5.rs:27:5 + --> $DIR/regions-close-object-into-object-5.rs:17:5 | LL | box B(&*v) as Box | ^^^^^^^^^^^^^^^^^^^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:27:9 + --> $DIR/regions-close-object-into-object-5.rs:17:9 | LL | fn f<'a, T, U>(v: Box+'static>) -> Box { | - help: consider adding an explicit lifetime bound `T: 'static`... @@ -38,13 +38,13 @@ LL | box B(&*v) as Box | ^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-close-object-into-object-5.rs:27:9 + --> $DIR/regions-close-object-into-object-5.rs:17:9 | LL | box B(&*v) as Box | ^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:27:9 + --> $DIR/regions-close-object-into-object-5.rs:17:9 | LL | fn f<'a, T, U>(v: Box+'static>) -> Box { | - help: consider adding an explicit lifetime bound `T: 'static`... @@ -53,13 +53,13 @@ LL | box B(&*v) as Box | ^^^^^^ | note: ...so that the reference type `&dyn A` does not outlive the data it points at - --> $DIR/regions-close-object-into-object-5.rs:27:9 + --> $DIR/regions-close-object-into-object-5.rs:17:9 | LL | box B(&*v) as Box | ^^^^^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:27:9 + --> $DIR/regions-close-object-into-object-5.rs:17:9 | LL | fn f<'a, T, U>(v: Box+'static>) -> Box { | - help: consider adding an explicit lifetime bound `T: 'static`... @@ -68,13 +68,13 @@ LL | box B(&*v) as Box | ^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-close-object-into-object-5.rs:27:9 + --> $DIR/regions-close-object-into-object-5.rs:17:9 | LL | box B(&*v) as Box | ^^^^^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:27:11 + --> $DIR/regions-close-object-into-object-5.rs:17:11 | LL | fn f<'a, T, U>(v: Box+'static>) -> Box { | - help: consider adding an explicit lifetime bound `T: 'static`... @@ -83,7 +83,7 @@ LL | box B(&*v) as Box | ^^^ | note: ...so that the type `(dyn A + 'static)` is not borrowed for too long - --> $DIR/regions-close-object-into-object-5.rs:27:11 + --> $DIR/regions-close-object-into-object-5.rs:17:11 | LL | box B(&*v) as Box | ^^^ diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.rs b/src/test/ui/regions/regions-close-over-type-parameter-1.rs index b70ec59420d..9aee9663e8f 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] // Test for what happens when a type parameter `A` is closed over into diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.stderr index 9158cf26838..6d33f147308 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:20:5 + --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | LL | fn make_object1(v: A) -> Box { | -- help: consider adding an explicit lifetime bound `A: 'static`... @@ -7,13 +7,13 @@ LL | box v as Box | ^^^^^ | note: ...so that the type `A` will meet its required lifetime bounds - --> $DIR/regions-close-over-type-parameter-1.rs:20:5 + --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | LL | box v as Box | ^^^^^ error[E0310]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:20:5 + --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | LL | fn make_object1(v: A) -> Box { | -- help: consider adding an explicit lifetime bound `A: 'static`... @@ -21,13 +21,13 @@ LL | box v as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that it can be closed over into an object - --> $DIR/regions-close-over-type-parameter-1.rs:20:5 + --> $DIR/regions-close-over-type-parameter-1.rs:10:5 | LL | box v as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:30:5 + --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | LL | fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { | -- help: consider adding an explicit lifetime bound `A: 'b`... @@ -35,13 +35,13 @@ LL | box v as Box | ^^^^^ | note: ...so that the type `A` will meet its required lifetime bounds - --> $DIR/regions-close-over-type-parameter-1.rs:30:5 + --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | LL | box v as Box | ^^^^^ error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-close-over-type-parameter-1.rs:30:5 + --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | LL | fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box { | -- help: consider adding an explicit lifetime bound `A: 'b`... @@ -49,7 +49,7 @@ LL | box v as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that it can be closed over into an object - --> $DIR/regions-close-over-type-parameter-1.rs:30:5 + --> $DIR/regions-close-over-type-parameter-1.rs:20:5 | LL | box v as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs index ad6c5a31bbb..defbc5d9f23 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] // Various tests where we over type parameters with multiple lifetime diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr index f85041e8ced..4803ae84415 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr @@ -1,21 +1,21 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-close-over-type-parameter-multiple.rs:30:5 + --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | LL | box v as Box //~ ERROR cannot infer an appropriate lifetime | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 28:20... - --> $DIR/regions-close-over-type-parameter-multiple.rs:28:20 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 18:20... + --> $DIR/regions-close-over-type-parameter-multiple.rs:18:20 | LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | ^^ note: ...so that the declared lifetime parameter bounds are satisfied - --> $DIR/regions-close-over-type-parameter-multiple.rs:30:5 + --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | LL | box v as Box //~ ERROR cannot infer an appropriate lifetime | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: but, the lifetime must be valid for the lifetime 'c as defined on the function body at 28:26... - --> $DIR/regions-close-over-type-parameter-multiple.rs:28:26 +note: but, the lifetime must be valid for the lifetime 'c as defined on the function body at 18:26... + --> $DIR/regions-close-over-type-parameter-multiple.rs:18:26 | LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { | ^^ diff --git a/src/test/ui/regions/regions-close-param-into-object.rs b/src/test/ui/regions/regions-close-param-into-object.rs index c9063405bd7..86590748cb2 100644 --- a/src/test/ui/regions/regions-close-param-into-object.rs +++ b/src/test/ui/regions/regions-close-param-into-object.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait X { fn foo(&self) {} } fn p1(v: T) -> Box diff --git a/src/test/ui/regions/regions-close-param-into-object.stderr b/src/test/ui/regions/regions-close-param-into-object.stderr index 72ed7ac9448..58028fc7bd8 100644 --- a/src/test/ui/regions/regions-close-param-into-object.stderr +++ b/src/test/ui/regions/regions-close-param-into-object.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:16:5 + --> $DIR/regions-close-param-into-object.rs:6:5 | LL | fn p1(v: T) -> Box | - help: consider adding an explicit lifetime bound `T: 'static`... @@ -8,13 +8,13 @@ LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough | ^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-close-param-into-object.rs:16:5 + --> $DIR/regions-close-param-into-object.rs:6:5 | LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough | ^^^^^^^^^^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:22:5 + --> $DIR/regions-close-param-into-object.rs:12:5 | LL | fn p2(v: Box) -> Box | - help: consider adding an explicit lifetime bound `T: 'static`... @@ -23,13 +23,13 @@ LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough | ^^^^^^^^^^^ | note: ...so that the type `std::boxed::Box` will meet its required lifetime bounds - --> $DIR/regions-close-param-into-object.rs:22:5 + --> $DIR/regions-close-param-into-object.rs:12:5 | LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough | ^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:28:5 + --> $DIR/regions-close-param-into-object.rs:18:5 | LL | fn p3<'a,T>(v: T) -> Box | - help: consider adding an explicit lifetime bound `T: 'a`... @@ -38,13 +38,13 @@ LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough | ^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-close-param-into-object.rs:28:5 + --> $DIR/regions-close-param-into-object.rs:18:5 | LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough | ^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-close-param-into-object.rs:34:5 + --> $DIR/regions-close-param-into-object.rs:24:5 | LL | fn p4<'a,T>(v: Box) -> Box | - help: consider adding an explicit lifetime bound `T: 'a`... @@ -53,7 +53,7 @@ LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough | ^^^^^^^^^^^ | note: ...so that the type `std::boxed::Box` will meet its required lifetime bounds - --> $DIR/regions-close-param-into-object.rs:34:5 + --> $DIR/regions-close-param-into-object.rs:24:5 | LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-creating-enums.nll.stderr b/src/test/ui/regions/regions-creating-enums.nll.stderr index de3142939b7..fe4b97a33b5 100644 --- a/src/test/ui/regions/regions-creating-enums.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums.nll.stderr @@ -1,16 +1,16 @@ error[E0515]: cannot return reference to temporary value - --> $DIR/regions-creating-enums.rs:33:16 + --> $DIR/regions-creating-enums.rs:23:16 | -LL | return &ast::num((*f)(x)); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live long enough | ^----------------- | || | |temporary value created here | returns a reference to data owned by the current function error[E0515]: cannot return reference to temporary value - --> $DIR/regions-creating-enums.rs:38:16 + --> $DIR/regions-creating-enums.rs:28:16 | -LL | return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Add(m_x, m_y); //~ ERROR borrowed value does not live long enough | ^------------------ | || | |temporary value created here diff --git a/src/test/ui/regions/regions-creating-enums.rs b/src/test/ui/regions/regions-creating-enums.rs index ad2dc28afef..ea8d4373e09 100644 --- a/src/test/ui/regions/regions-creating-enums.rs +++ b/src/test/ui/regions/regions-creating-enums.rs @@ -1,41 +1,31 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum ast<'a> { - num(usize), - add(&'a ast<'a>, &'a ast<'a>) +enum Ast<'a> { + Num(usize), + Add(&'a Ast<'a>, &'a Ast<'a>) } fn build() { - let x = ast::num(3); - let y = ast::num(4); - let z = ast::add(&x, &y); + let x = Ast::Num(3); + let y = Ast::Num(4); + let z = Ast::Add(&x, &y); compute(&z); } -fn compute(x: &ast) -> usize { +fn compute(x: &Ast) -> usize { match *x { - ast::num(x) => { x } - ast::add(x, y) => { compute(x) + compute(y) } + Ast::Num(x) => { x } + Ast::Add(x, y) => { compute(x) + compute(y) } } } -fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usize) -> usize { +fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usize) -> usize { match *x { - ast::num(x) => { - return &ast::num((*f)(x)); //~ ERROR borrowed value does not live long enough + Ast::Num(x) => { + return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live long enough } - ast::add(x, y) => { + Ast::Add(x, y) => { let m_x = map_nums(x, f); let m_y = map_nums(y, f); - return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live long enough + return &Ast::Add(m_x, m_y); //~ ERROR borrowed value does not live long enough } } } diff --git a/src/test/ui/regions/regions-creating-enums.stderr b/src/test/ui/regions/regions-creating-enums.stderr index 7b0847739d7..36cd6d0c22e 100644 --- a/src/test/ui/regions/regions-creating-enums.stderr +++ b/src/test/ui/regions/regions-creating-enums.stderr @@ -1,30 +1,30 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/regions-creating-enums.rs:33:17 + --> $DIR/regions-creating-enums.rs:23:17 | -LL | return &ast::num((*f)(x)); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live long enough | ^^^^^^^^^^^^^^^^^- temporary value only lives until here | | | temporary value does not live long enough | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 30:13... - --> $DIR/regions-creating-enums.rs:30:13 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 20:13... + --> $DIR/regions-creating-enums.rs:20:13 | -LL | fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usize) -> usize { +LL | fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usize) -> usize { | ^^ = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/regions-creating-enums.rs:38:17 + --> $DIR/regions-creating-enums.rs:28:17 | -LL | return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Add(m_x, m_y); //~ ERROR borrowed value does not live long enough | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here | | | temporary value does not live long enough | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 30:13... - --> $DIR/regions-creating-enums.rs:30:13 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 20:13... + --> $DIR/regions-creating-enums.rs:20:13 | -LL | fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usize) -> usize { +LL | fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usize) -> usize { | ^^ = note: consider using a `let` binding to increase its lifetime diff --git a/src/test/ui/regions/regions-creating-enums3.rs b/src/test/ui/regions/regions-creating-enums3.rs index dcc579d26c1..3da0cb4cb81 100644 --- a/src/test/ui/regions/regions-creating-enums3.rs +++ b/src/test/ui/regions/regions-creating-enums3.rs @@ -1,20 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum ast<'a> { - num(usize), - add(&'a ast<'a>, &'a ast<'a>) +enum Ast<'a> { + Num(usize), + Add(&'a Ast<'a>, &'a Ast<'a>) } -fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> { - ast::add(x, y) //~ ERROR 17:5: 17:19: lifetime mismatch [E0623] +fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { + Ast::Add(x, y) //~ ERROR lifetime mismatch [E0623] } fn main() { diff --git a/src/test/ui/regions/regions-creating-enums3.stderr b/src/test/ui/regions/regions-creating-enums3.stderr index b2cca9a3c62..2a0efaa598c 100644 --- a/src/test/ui/regions/regions-creating-enums3.stderr +++ b/src/test/ui/regions/regions-creating-enums3.stderr @@ -1,11 +1,11 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-creating-enums3.rs:17:5 + --> $DIR/regions-creating-enums3.rs:7:5 | -LL | fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> { +LL | fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { | ----------- ------- | | | this parameter and the return type are declared with different lifetimes... -LL | ast::add(x, y) //~ ERROR 17:5: 17:19: lifetime mismatch [E0623] +LL | Ast::Add(x, y) //~ ERROR lifetime mismatch [E0623] | ^^^^^^^^^^^^^^ ...but data from `y` is returned here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-creating-enums4.rs b/src/test/ui/regions/regions-creating-enums4.rs index 5dc9b370f32..11d3d831151 100644 --- a/src/test/ui/regions/regions-creating-enums4.rs +++ b/src/test/ui/regions/regions-creating-enums4.rs @@ -1,20 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum ast<'a> { - num(usize), - add(&'a ast<'a>, &'a ast<'a>) +enum Ast<'a> { + Num(usize), + Add(&'a Ast<'a>, &'a Ast<'a>) } -fn mk_add_bad2<'a,'b>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'b> { - ast::add(x, y) //~ ERROR cannot infer +fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { + Ast::Add(x, y) //~ ERROR cannot infer } fn main() { diff --git a/src/test/ui/regions/regions-creating-enums4.stderr b/src/test/ui/regions/regions-creating-enums4.stderr index 729dc2f107a..569530768b8 100644 --- a/src/test/ui/regions/regions-creating-enums4.stderr +++ b/src/test/ui/regions/regions-creating-enums4.stderr @@ -1,25 +1,25 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/regions-creating-enums4.rs:17:5 + --> $DIR/regions-creating-enums4.rs:7:5 | -LL | ast::add(x, y) //~ ERROR cannot infer +LL | Ast::Add(x, y) //~ ERROR cannot infer | ^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 16:16... - --> $DIR/regions-creating-enums4.rs:16:16 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 6:16... + --> $DIR/regions-creating-enums4.rs:6:16 | -LL | fn mk_add_bad2<'a,'b>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'b> { +LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | ^^ = note: ...so that the expression is assignable: - expected &ast<'_> - found &ast<'a> -note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 16:19... - --> $DIR/regions-creating-enums4.rs:16:19 + expected &Ast<'_> + found &Ast<'a> +note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 6:19... + --> $DIR/regions-creating-enums4.rs:6:19 | -LL | fn mk_add_bad2<'a,'b>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'b> { +LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> { | ^^ = note: ...so that the expression is assignable: - expected ast<'b> - found ast<'_> + expected Ast<'b> + found Ast<'_> error: aborting due to previous error diff --git a/src/test/ui/regions/regions-early-bound-error-method.rs b/src/test/ui/regions/regions-early-bound-error-method.rs index eaf9a750570..32428143ef9 100644 --- a/src/test/ui/regions/regions-early-bound-error-method.rs +++ b/src/test/ui/regions/regions-early-bound-error-method.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that you can use a fn lifetime parameter as part of // the value for a type parameter in a bound. diff --git a/src/test/ui/regions/regions-early-bound-error-method.stderr b/src/test/ui/regions/regions-early-bound-error-method.stderr index 6c542ef5ddf..7b9f2c9503b 100644 --- a/src/test/ui/regions/regions-early-bound-error-method.stderr +++ b/src/test/ui/regions/regions-early-bound-error-method.stderr @@ -1,16 +1,16 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/regions-early-bound-error-method.rs:30:9 + --> $DIR/regions-early-bound-error-method.rs:20:9 | LL | g2.get() | ^^^^^^^^ | -note: ...the reference is valid for the lifetime 'a as defined on the impl at 28:6... - --> $DIR/regions-early-bound-error-method.rs:28:6 +note: ...the reference is valid for the lifetime 'a as defined on the impl at 18:6... + --> $DIR/regions-early-bound-error-method.rs:18:6 | LL | impl<'a> Box<'a> { | ^^ -note: ...but the borrowed content is only valid for the lifetime 'b as defined on the method body at 29:11 - --> $DIR/regions-early-bound-error-method.rs:29:11 +note: ...but the borrowed content is only valid for the lifetime 'b as defined on the method body at 19:11 + --> $DIR/regions-early-bound-error-method.rs:19:11 | LL | fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize { | ^^ diff --git a/src/test/ui/regions/regions-early-bound-error.rs b/src/test/ui/regions/regions-early-bound-error.rs index 90a33950047..78dad4f2649 100644 --- a/src/test/ui/regions/regions-early-bound-error.rs +++ b/src/test/ui/regions/regions-early-bound-error.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that you can use a fn lifetime parameter as part of // the value for a type parameter in a bound. diff --git a/src/test/ui/regions/regions-early-bound-error.stderr b/src/test/ui/regions/regions-early-bound-error.stderr index 579a7c91e43..a68355b78f5 100644 --- a/src/test/ui/regions/regions-early-bound-error.stderr +++ b/src/test/ui/regions/regions-early-bound-error.stderr @@ -1,16 +1,16 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/regions-early-bound-error.rs:29:5 + --> $DIR/regions-early-bound-error.rs:19:5 | LL | g1.get() | ^^^^^^^^ | -note: ...the reference is valid for the lifetime 'b as defined on the function body at 28:11... - --> $DIR/regions-early-bound-error.rs:28:11 +note: ...the reference is valid for the lifetime 'b as defined on the function body at 18:11... + --> $DIR/regions-early-bound-error.rs:18:11 | LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { | ^^ -note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 28:8 - --> $DIR/regions-early-bound-error.rs:28:8 +note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 18:8 + --> $DIR/regions-early-bound-error.rs:18:8 | LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize { | ^^ diff --git a/src/test/ui/regions/regions-enum-not-wf.rs b/src/test/ui/regions/regions-enum-not-wf.rs index a2d3cf6779f..781cdb7286a 100644 --- a/src/test/ui/regions/regions-enum-not-wf.rs +++ b/src/test/ui/regions/regions-enum-not-wf.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // Various examples of structs whose fields are not well-formed. @@ -42,9 +32,9 @@ enum RefIndirect<'a, T> { RefIndirectVariant1(isize, RefOk<'a,T>) } -enum RefDouble<'a, 'b, T> { //~ ERROR 45:1: 48:2: the parameter type `T` may not live long enough [E0309] +enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] RefDoubleVariant1(&'a RequireOutlives<'b, T>) - //~^ 46:23: 46:49: the parameter type `T` may not live long enough [E0309] + //~^ the parameter type `T` may not live long enough [E0309] } fn main() { } diff --git a/src/test/ui/regions/regions-enum-not-wf.stderr b/src/test/ui/regions/regions-enum-not-wf.stderr index 923ea17622a..d10f7ed28fc 100644 --- a/src/test/ui/regions/regions-enum-not-wf.stderr +++ b/src/test/ui/regions/regions-enum-not-wf.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-enum-not-wf.rs:28:18 + --> $DIR/regions-enum-not-wf.rs:18:18 | LL | enum Ref1<'a, T> { | - help: consider adding an explicit lifetime bound `T: 'a`... @@ -7,13 +7,13 @@ LL | Ref1Variant1(RequireOutlives<'a, T>) //~ ERROR the parameter type `T` m | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-enum-not-wf.rs:28:18 + --> $DIR/regions-enum-not-wf.rs:18:18 | LL | Ref1Variant1(RequireOutlives<'a, T>) //~ ERROR the parameter type `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-enum-not-wf.rs:33:25 + --> $DIR/regions-enum-not-wf.rs:23:25 | LL | enum Ref2<'a, T> { | - help: consider adding an explicit lifetime bound `T: 'a`... @@ -22,42 +22,42 @@ LL | Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter ty | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-enum-not-wf.rs:33:25 + --> $DIR/regions-enum-not-wf.rs:23:25 | LL | Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter type `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-enum-not-wf.rs:45:1 + --> $DIR/regions-enum-not-wf.rs:35:1 | -LL | enum RefDouble<'a, 'b, T> { //~ ERROR 45:1: 48:2: the parameter type `T` may not live long enough [E0309] +LL | enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] | ^ - help: consider adding an explicit lifetime bound `T: 'b`... | _| | | LL | | RefDoubleVariant1(&'a RequireOutlives<'b, T>) -LL | | //~^ 46:23: 46:49: the parameter type `T` may not live long enough [E0309] +LL | | //~^ the parameter type `T` may not live long enough [E0309] LL | | } | |_^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-enum-not-wf.rs:45:1 + --> $DIR/regions-enum-not-wf.rs:35:1 | -LL | / enum RefDouble<'a, 'b, T> { //~ ERROR 45:1: 48:2: the parameter type `T` may not live long enough [E0309] +LL | / enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] LL | | RefDoubleVariant1(&'a RequireOutlives<'b, T>) -LL | | //~^ 46:23: 46:49: the parameter type `T` may not live long enough [E0309] +LL | | //~^ the parameter type `T` may not live long enough [E0309] LL | | } | |_^ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-enum-not-wf.rs:46:23 + --> $DIR/regions-enum-not-wf.rs:36:23 | -LL | enum RefDouble<'a, 'b, T> { //~ ERROR 45:1: 48:2: the parameter type `T` may not live long enough [E0309] +LL | enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] | - help: consider adding an explicit lifetime bound `T: 'b`... LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-enum-not-wf.rs:46:23 + --> $DIR/regions-enum-not-wf.rs:36:23 | LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-escape-method.rs b/src/test/ui/regions/regions-escape-method.rs index e3771cfebba..5127d4d1ceb 100644 --- a/src/test/ui/regions/regions-escape-method.rs +++ b/src/test/ui/regions/regions-escape-method.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a method call where the parameter `B` would (illegally) be // inferred to a region bound in the method argument. If this program // were accepted, then the closure passed to `s.f` could escape its diff --git a/src/test/ui/regions/regions-escape-method.stderr b/src/test/ui/regions/regions-escape-method.stderr index fb0bf845f3b..8575a24281d 100644 --- a/src/test/ui/regions/regions-escape-method.stderr +++ b/src/test/ui/regions/regions-escape-method.stderr @@ -1,24 +1,24 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-escape-method.rs:25:13 + --> $DIR/regions-escape-method.rs:15:13 | LL | s.f(|p| p) //~ ERROR cannot infer | ^ | -note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 25:9... - --> $DIR/regions-escape-method.rs:25:9 +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 15:9... + --> $DIR/regions-escape-method.rs:15:9 | LL | s.f(|p| p) //~ ERROR cannot infer | ^^^^^ = note: ...so that the expression is assignable: expected &i32 found &i32 -note: but, the lifetime must be valid for the method call at 25:5... - --> $DIR/regions-escape-method.rs:25:5 +note: but, the lifetime must be valid for the method call at 15:5... + --> $DIR/regions-escape-method.rs:15:5 | LL | s.f(|p| p) //~ ERROR cannot infer | ^^^^^^^^^^ note: ...so that a type/lifetime parameter is in scope here - --> $DIR/regions-escape-method.rs:25:5 + --> $DIR/regions-escape-method.rs:15:5 | LL | s.f(|p| p) //~ ERROR cannot infer | ^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-escape-via-trait-or-not.rs b/src/test/ui/regions/regions-escape-via-trait-or-not.rs index a4363b00e1c..1e089616f59 100644 --- a/src/test/ui/regions/regions-escape-via-trait-or-not.rs +++ b/src/test/ui/regions/regions-escape-via-trait-or-not.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] trait Deref { diff --git a/src/test/ui/regions/regions-escape-via-trait-or-not.stderr b/src/test/ui/regions/regions-escape-via-trait-or-not.stderr index 60bd14ba4d7..8f4bfd889a8 100644 --- a/src/test/ui/regions/regions-escape-via-trait-or-not.stderr +++ b/src/test/ui/regions/regions-escape-via-trait-or-not.stderr @@ -1,24 +1,24 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-escape-via-trait-or-not.rs:28:14 + --> $DIR/regions-escape-via-trait-or-not.rs:18:14 | LL | with(|o| o) //~ ERROR cannot infer | ^ | -note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 28:10... - --> $DIR/regions-escape-via-trait-or-not.rs:28:10 +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 18:10... + --> $DIR/regions-escape-via-trait-or-not.rs:18:10 | LL | with(|o| o) //~ ERROR cannot infer | ^^^^^ = note: ...so that the expression is assignable: expected &isize found &isize -note: but, the lifetime must be valid for the expression at 28:5... - --> $DIR/regions-escape-via-trait-or-not.rs:28:5 +note: but, the lifetime must be valid for the expression at 18:5... + --> $DIR/regions-escape-via-trait-or-not.rs:18:5 | LL | with(|o| o) //~ ERROR cannot infer | ^^^^ -note: ...so type `fn([closure@$DIR/regions-escape-via-trait-or-not.rs:28:10: 28:15]) -> isize {with::<&isize, [closure@$DIR/regions-escape-via-trait-or-not.rs:28:10: 28:15]>}` of expression is valid during the expression - --> $DIR/regions-escape-via-trait-or-not.rs:28:5 +note: ...so type `fn([closure@$DIR/regions-escape-via-trait-or-not.rs:18:10: 18:15]) -> isize {with::<&isize, [closure@$DIR/regions-escape-via-trait-or-not.rs:18:10: 18:15]>}` of expression is valid during the expression + --> $DIR/regions-escape-via-trait-or-not.rs:18:5 | LL | with(|o| o) //~ ERROR cannot infer | ^^^^ diff --git a/src/test/ui/regions/regions-fn-subtyping-return-static.rs b/src/test/ui/regions/regions-fn-subtyping-return-static.rs index 90985111867..9010770f1dc 100644 --- a/src/test/ui/regions/regions-fn-subtyping-return-static.rs +++ b/src/test/ui/regions/regions-fn-subtyping-return-static.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // In this fn, the type `F` is a function that takes a reference to a // struct and returns another reference with the same lifetime. // @@ -15,9 +5,12 @@ // *ANY* lifetime and returns a reference with the 'static lifetime. // This can safely be considered to be an instance of `F` because all // lifetimes are sublifetimes of 'static. +// +// compile-pass #![allow(dead_code)] #![allow(unused_variables)] +#![allow(non_snake_case)] struct S; @@ -47,8 +40,7 @@ fn baz(x: &S) -> &S { fn supply_F() { want_F(foo); - // FIXME(#33684) -- this should be a subtype, but current alg. rejects it incorrectly - want_F(bar); //~ ERROR E0308 + want_F(bar); want_F(baz); } diff --git a/src/test/ui/regions/regions-fn-subtyping-return-static.stderr b/src/test/ui/regions/regions-fn-subtyping-return-static.stderr deleted file mode 100644 index bd10dc8a808..00000000000 --- a/src/test/ui/regions/regions-fn-subtyping-return-static.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/regions-fn-subtyping-return-static.rs:51:12 - | -LL | want_F(bar); //~ ERROR E0308 - | ^^^ expected concrete lifetime, found bound lifetime parameter 'cx - | - = note: expected type `for<'cx> fn(&'cx S) -> &'cx S` - found type `for<'a> fn(&'a S) -> &S {bar::<'_>}` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/regions/regions-free-region-ordering-callee-4.rs b/src/test/ui/regions/regions-free-region-ordering-callee-4.rs index bd31d1a5a90..de58dd0b10f 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee-4.rs +++ b/src/test/ui/regions/regions-free-region-ordering-callee-4.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that callees correctly infer an ordering between free regions // that appear in their parameter list. See also // regions-free-region-ordering-caller.rs diff --git a/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr b/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr index 70970a9cf3b..e3f42d59228 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr @@ -1,5 +1,5 @@ error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the data it references - --> $DIR/regions-free-region-ordering-callee-4.rs:15:1 + --> $DIR/regions-free-region-ordering-callee-4.rs:5:1 | LL | / fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { LL | | //~^ ERROR reference has a longer lifetime than the data it references @@ -8,13 +8,13 @@ LL | | let z: Option<&'a &'b usize> = None; LL | | } | |_^ | -note: the pointer is valid for the lifetime 'a as defined on the function body at 15:14 - --> $DIR/regions-free-region-ordering-callee-4.rs:15:14 +note: the pointer is valid for the lifetime 'a as defined on the function body at 5:14 + --> $DIR/regions-free-region-ordering-callee-4.rs:5:14 | LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 15:18 - --> $DIR/regions-free-region-ordering-callee-4.rs:15:18 +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 5:18 + --> $DIR/regions-free-region-ordering-callee-4.rs:5:18 | LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { | ^^ diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.rs b/src/test/ui/regions/regions-free-region-ordering-callee.rs index 073a4f79b05..ee9a977a74f 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.rs +++ b/src/test/ui/regions/regions-free-region-ordering-callee.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that callees correctly infer an ordering between free regions // that appear in their parameter list. See also // regions-free-region-ordering-caller.rs @@ -20,13 +10,13 @@ fn ordering1<'a, 'b>(x: &'a &'b usize) -> &'a usize { fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { // However, it is not safe to assume that 'b <= 'a - &*y //~ ERROR 23:5: 23:8: lifetime mismatch [E0623] + &*y //~ ERROR lifetime mismatch [E0623] } fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize { // Do not infer an ordering from the return value. let z: &'b usize = &*x; - //~^ ERROR 28:24: 28:27: lifetime mismatch [E0623] + //~^ ERROR lifetime mismatch [E0623] panic!(); } diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.stderr index 13d94f91c6d..b5c66386341 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee.stderr @@ -1,16 +1,16 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-callee.rs:23:5 + --> $DIR/regions-free-region-ordering-callee.rs:13:5 | LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { | ------------- --------- | | | this parameter and the return type are declared with different lifetimes... LL | // However, it is not safe to assume that 'b <= 'a -LL | &*y //~ ERROR 23:5: 23:8: lifetime mismatch [E0623] +LL | &*y //~ ERROR lifetime mismatch [E0623] | ^^^ ...but data from `x` is returned here error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-callee.rs:28:24 + --> $DIR/regions-free-region-ordering-callee.rs:18:24 | LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize { | --------- ------------- diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.ast.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.ast.stderr new file mode 100644 index 00000000000..73266ab50fa --- /dev/null +++ b/src/test/ui/regions/regions-free-region-ordering-caller.ast.stderr @@ -0,0 +1,32 @@ +error[E0623]: lifetime mismatch + --> $DIR/regions-free-region-ordering-caller.rs:11:12 + | +LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { + | --------- --------- + | | + | these two types are declared with different lifetimes... +LL | let z: Option<&'b &'a usize> = None;//[ast]~ ERROR E0623 + | ^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here + +error[E0623]: lifetime mismatch + --> $DIR/regions-free-region-ordering-caller.rs:17:12 + | +LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { + | --------- --------- + | | + | these two types are declared with different lifetimes... +LL | let y: Paramd<'a> = Paramd { x: a }; +LL | let z: Option<&'b Paramd<'a>> = None;//[ast]~ ERROR E0623 + | ^^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here + +error[E0623]: lifetime mismatch + --> $DIR/regions-free-region-ordering-caller.rs:22:12 + | +LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { + | --------- --------- these two types are declared with different lifetimes... +LL | let z: Option<&'a &'b usize> = None;//[ast]~ ERROR E0623 + | ^^^^^^^^^^^^^^^^^^^^^ ...but data from `b` flows into `a` here + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.mir.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.mir.stderr new file mode 100644 index 00000000000..abec468c9ea --- /dev/null +++ b/src/test/ui/regions/regions-free-region-ordering-caller.mir.stderr @@ -0,0 +1,33 @@ +error: lifetime may not live long enough + --> $DIR/regions-free-region-ordering-caller.rs:11:12 + | +LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | let z: Option<&'b &'a usize> = None;//[ast]~ ERROR E0623 + | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/regions-free-region-ordering-caller.rs:17:12 + | +LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | let y: Paramd<'a> = Paramd { x: a }; +LL | let z: Option<&'b Paramd<'a>> = None;//[ast]~ ERROR E0623 + | ^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/regions-free-region-ordering-caller.rs:22:12 + | +LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | let z: Option<&'a &'b usize> = None;//[ast]~ ERROR E0623 + | ^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.rs b/src/test/ui/regions/regions-free-region-ordering-caller.rs index 66b16744cc7..621e6e78b46 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller.rs +++ b/src/test/ui/regions/regions-free-region-ordering-caller.rs @@ -1,30 +1,26 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test various ways to construct a pointer with a longer lifetime // than the thing it points at and ensure that they result in // errors. See also regions-free-region-ordering-callee.rs +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + struct Paramd<'a> { x: &'a usize } fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { - let z: Option<&'b &'a usize> = None;//~ ERROR E0623 + let z: Option<&'b &'a usize> = None;//[ast]~ ERROR E0623 + //[mir]~^ ERROR lifetime may not live long enough } fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { let y: Paramd<'a> = Paramd { x: a }; - let z: Option<&'b Paramd<'a>> = None;//~ ERROR E0623 + let z: Option<&'b Paramd<'a>> = None;//[ast]~ ERROR E0623 + //[mir]~^ ERROR lifetime may not live long enough } fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { - let z: Option<&'a &'b usize> = None;//~ ERROR E0623 + let z: Option<&'a &'b usize> = None;//[ast]~ ERROR E0623 + //[mir]~^ ERROR lifetime may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.stderr index a3645995b5e..67ee950ae8f 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-caller.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-caller.rs:18:12 + --> $DIR/regions-free-region-ordering-caller.rs:8:12 | LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { | --------- --------- @@ -9,7 +9,7 @@ LL | let z: Option<&'b &'a usize> = None;//~ ERROR E0623 | ^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-caller.rs:23:12 + --> $DIR/regions-free-region-ordering-caller.rs:13:12 | LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { | --------- --------- @@ -20,7 +20,7 @@ LL | let z: Option<&'b Paramd<'a>> = None;//~ ERROR E0623 | ^^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-caller.rs:27:12 + --> $DIR/regions-free-region-ordering-caller.rs:17:12 | LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { | --------- --------- these two types are declared with different lifetimes... diff --git a/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr index 39f193c55f7..539343a6829 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/regions-free-region-ordering-caller1.rs:19:27 + --> $DIR/regions-free-region-ordering-caller1.rs:9:27 | LL | fn call1<'a>(x: &'a usize) { | -- lifetime `'a` defined here @@ -12,6 +12,21 @@ LL | let z: &'a & usize = &(&y); LL | } | - temporary value is freed at the end of this statement -error: aborting due to previous error +error[E0597]: `y` does not live long enough + --> $DIR/regions-free-region-ordering-caller1.rs:9:27 + | +LL | fn call1<'a>(x: &'a usize) { + | -- lifetime `'a` defined here +... +LL | let z: &'a & usize = &(&y); + | ----------- ^^^^ borrowed value does not live long enough + | | + | type annotation requires that `y` is borrowed for `'a` +... +LL | } + | - `y` dropped here while still borrowed + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0716`. +Some errors occurred: E0597, E0716. +For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/regions/regions-free-region-ordering-caller1.rs b/src/test/ui/regions/regions-free-region-ordering-caller1.rs index b29518ccdab..d9251c085e1 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller1.rs +++ b/src/test/ui/regions/regions-free-region-ordering-caller1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test various ways to construct a pointer with a longer lifetime // than the thing it points at and ensure that they result in // errors. See also regions-free-region-ordering-callee.rs diff --git a/src/test/ui/regions/regions-free-region-ordering-caller1.stderr b/src/test/ui/regions/regions-free-region-ordering-caller1.stderr index c0dff6ec384..08aaa35e08c 100644 --- a/src/test/ui/regions/regions-free-region-ordering-caller1.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-caller1.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/regions-free-region-ordering-caller1.rs:19:27 + --> $DIR/regions-free-region-ordering-caller1.rs:9:27 | LL | let z: &'a & usize = &(&y); | ^^^^ temporary value does not live long enough @@ -7,14 +7,14 @@ LL | let z: &'a & usize = &(&y); LL | } | - temporary value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:10... - --> $DIR/regions-free-region-ordering-caller1.rs:15:10 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 5:10... + --> $DIR/regions-free-region-ordering-caller1.rs:5:10 | LL | fn call1<'a>(x: &'a usize) { | ^^ error[E0597]: `y` does not live long enough - --> $DIR/regions-free-region-ordering-caller1.rs:19:29 + --> $DIR/regions-free-region-ordering-caller1.rs:9:29 | LL | let z: &'a & usize = &(&y); | ^ borrowed value does not live long enough @@ -22,8 +22,8 @@ LL | let z: &'a & usize = &(&y); LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:10... - --> $DIR/regions-free-region-ordering-caller1.rs:15:10 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 5:10... + --> $DIR/regions-free-region-ordering-caller1.rs:5:10 | LL | fn call1<'a>(x: &'a usize) { | ^^ diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.rs b/src/test/ui/regions/regions-free-region-ordering-incorrect.rs index 9cb61c24922..65e3f52609e 100644 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.rs +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.rs @@ -1,32 +1,22 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that free regions ordering only goes one way. That is, // we have `&'a Node<'b, T>`, which implies that `'a <= 'b`, -// but not `'b <= 'a`. Hence returning `&self.val` (which has lifetime +// but not `'b <= 'a`. Hence, returning `&self.val` (which has lifetime // `'a`) where `'b` is expected yields an error. // // This test began its life as a test for issue #4325. -struct Node<'b, T:'b> { - val: T, - next: Option<&'b Node<'b, T>> +struct Node<'b, T: 'b> { + val: T, + next: Option<&'b Node<'b, T>> } impl<'b, T> Node<'b, T> { - fn get<'a>(&'a self) -> &'b T { - match self.next { - Some(ref next) => next.get(), - None => &self.val //~ ERROR cannot infer + fn get<'a>(&'a self) -> &'b T { + match self.next { + Some(ref next) => next.get(), + None => &self.val //~ ERROR cannot infer + } } - } } fn main() {} diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr index 3dce04e2452..12e08072676 100644 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr @@ -1,32 +1,32 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements - --> $DIR/regions-free-region-ordering-incorrect.rs:27:15 + --> $DIR/regions-free-region-ordering-incorrect.rs:17:21 | -LL | None => &self.val //~ ERROR cannot infer - | ^^^^^^^^^ +LL | None => &self.val //~ ERROR cannot infer + | ^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the method body at 24:10... - --> $DIR/regions-free-region-ordering-incorrect.rs:24:10 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the method body at 14:12... + --> $DIR/regions-free-region-ordering-incorrect.rs:14:12 | -LL | fn get<'a>(&'a self) -> &'b T { - | ^^ +LL | fn get<'a>(&'a self) -> &'b T { + | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-free-region-ordering-incorrect.rs:27:15 + --> $DIR/regions-free-region-ordering-incorrect.rs:17:21 | -LL | None => &self.val //~ ERROR cannot infer - | ^^^^^^^^^ -note: but, the lifetime must be valid for the lifetime 'b as defined on the impl at 23:6... - --> $DIR/regions-free-region-ordering-incorrect.rs:23:6 +LL | None => &self.val //~ ERROR cannot infer + | ^^^^^^^^^ +note: but, the lifetime must be valid for the lifetime 'b as defined on the impl at 13:6... + --> $DIR/regions-free-region-ordering-incorrect.rs:13:6 | LL | impl<'b, T> Node<'b, T> { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-free-region-ordering-incorrect.rs:25:5 + --> $DIR/regions-free-region-ordering-incorrect.rs:15:9 | -LL | / match self.next { -LL | | Some(ref next) => next.get(), -LL | | None => &self.val //~ ERROR cannot infer -LL | | } - | |_____^ +LL | / match self.next { +LL | | Some(ref next) => next.get(), +LL | | None => &self.val //~ ERROR cannot infer +LL | | } + | |_________^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-glb-free-free.rs b/src/test/ui/regions/regions-glb-free-free.rs index 843c5f512f8..0370a5192d3 100644 --- a/src/test/ui/regions/regions-glb-free-free.rs +++ b/src/test/ui/regions/regions-glb-free-free.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod argparse { pub struct Flag<'a> { name: &'a str, @@ -22,7 +12,7 @@ mod argparse { impl<'a> Flag<'a> { pub fn set_desc(self, s: &str) -> Flag<'a> { - Flag { //~ ERROR 25:13: 30:14: explicit lifetime required in the type of `s` [E0621] + Flag { //~ ERROR explicit lifetime required in the type of `s` [E0621] name: self.name, desc: s, max_count: self.max_count, diff --git a/src/test/ui/regions/regions-glb-free-free.stderr b/src/test/ui/regions/regions-glb-free-free.stderr index 48c95a88654..23492b3c718 100644 --- a/src/test/ui/regions/regions-glb-free-free.stderr +++ b/src/test/ui/regions/regions-glb-free-free.stderr @@ -1,9 +1,9 @@ error[E0621]: explicit lifetime required in the type of `s` - --> $DIR/regions-glb-free-free.rs:25:13 + --> $DIR/regions-glb-free-free.rs:15:13 | LL | pub fn set_desc(self, s: &str) -> Flag<'a> { | ---- help: add explicit lifetime `'a` to the type of `s`: `&'a str` -LL | / Flag { //~ ERROR 25:13: 30:14: explicit lifetime required in the type of `s` [E0621] +LL | / Flag { //~ ERROR explicit lifetime required in the type of `s` [E0621] LL | | name: self.name, LL | | desc: s, LL | | max_count: self.max_count, diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs index 65594ab8f2e..38fc9c462da 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Illustrates the "projection gap": in this test, even though we know // that `T::Foo: 'x`, that does not tell us that `T: 'x`, because // there might be other ways for the caller of `func` to show that diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr index 41ae515bb9a..7fbc1622c3a 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-implied-bounds-projection-gap-1.rs:26:10 + --> $DIR/regions-implied-bounds-projection-gap-1.rs:16:10 | LL | fn func<'x, T:Trait1<'x>>(t: &'x T::Foo) | -- help: consider adding an explicit lifetime bound `T: 'x`... @@ -8,7 +8,7 @@ LL | wf::<&'x T>(); | ^^^^^ | note: ...so that the reference type `&'x T` does not outlive the data it points at - --> $DIR/regions-implied-bounds-projection-gap-1.rs:26:10 + --> $DIR/regions-implied-bounds-projection-gap-1.rs:16:10 | LL | wf::<&'x T>(); | ^^^^^ diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-2.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-2.rs index 09e1634381f..d407bee416f 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-2.rs +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Along with the other tests in this series, illustrates the // "projection gap": in this test, we know that `T: 'x`, and that is // enough to conclude that `T::Foo: 'x`. diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-3.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-3.rs index be1987fe87c..c19fa98e914 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-3.rs +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Along with the other tests in this series, illustrates the // "projection gap": in this test, we know that `T::Foo: 'x`, and that // is (naturally) enough to conclude that `T::Foo: 'x`. diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-4.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-4.rs index d0560d4cd90..7a19d17152c 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-4.rs +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-4.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Along with the other tests in this series, illustrates the // "projection gap": in this test, we know that `T: 'x`, and that // is (naturally) enough to conclude that `T: 'x`. diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs index fd186d16559..7e04b6782eb 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The "projection gap" is particularly "fun" around higher-ranked // projections. This is because the current code is hard-coded to say // that a projection that contains escaping regions, like ` Trait1<>::Foo> + 'x)`, reference has a longer lifetime than the data it references - --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:31:1 + --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:1 | LL | / fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) LL | | //~^ ERROR reference has a longer lifetime than the data it references @@ -7,13 +7,13 @@ LL | | { LL | | } | |_^ | -note: the pointer is valid for the lifetime 'x as defined on the function body at 31:11 - --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:31:11 +note: the pointer is valid for the lifetime 'x as defined on the function body at 21:11 + --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:11 | LL | fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) | ^^ -note: but the referenced data is only valid for the lifetime 'y as defined on the function body at 31:15 - --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:31:15 +note: but the referenced data is only valid for the lifetime 'y as defined on the function body at 21:15 + --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:15 | LL | fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) | ^^ diff --git a/src/test/ui/regions/regions-in-enums-anon.rs b/src/test/ui/regions/regions-in-enums-anon.rs index 305bf88c4d5..da65cb791ec 100644 --- a/src/test/ui/regions/regions-in-enums-anon.rs +++ b/src/test/ui/regions/regions-in-enums-anon.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that anonymous lifetimes are not permitted in enum declarations enum Foo { diff --git a/src/test/ui/regions/regions-in-enums-anon.stderr b/src/test/ui/regions/regions-in-enums-anon.stderr index f5630f84aed..9cfdb67939f 100644 --- a/src/test/ui/regions/regions-in-enums-anon.stderr +++ b/src/test/ui/regions/regions-in-enums-anon.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/regions-in-enums-anon.rs:14:9 + --> $DIR/regions-in-enums-anon.rs:4:9 | LL | Bar(&isize) //~ ERROR missing lifetime specifier | ^ expected lifetime parameter diff --git a/src/test/ui/regions/regions-in-enums.rs b/src/test/ui/regions/regions-in-enums.rs index 613a90dda67..8cf553a0f35 100644 --- a/src/test/ui/regions/regions-in-enums.rs +++ b/src/test/ui/regions/regions-in-enums.rs @@ -1,29 +1,19 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that lifetimes must be declared for use on enums. // See also regions-undeclared.rs -enum yes0<'lt> { +enum Yes0<'lt> { X3(&'lt usize) } -enum yes1<'a> { +enum Yes1<'a> { X4(&'a usize) } -enum no0 { +enum No0 { X5(&'foo usize) //~ ERROR use of undeclared lifetime name `'foo` } -enum no1 { +enum No1 { X6(&'a usize) //~ ERROR use of undeclared lifetime name `'a` } diff --git a/src/test/ui/regions/regions-in-enums.stderr b/src/test/ui/regions/regions-in-enums.stderr index cdc0b6ca122..d0137d1afef 100644 --- a/src/test/ui/regions/regions-in-enums.stderr +++ b/src/test/ui/regions/regions-in-enums.stderr @@ -1,11 +1,11 @@ error[E0261]: use of undeclared lifetime name `'foo` - --> $DIR/regions-in-enums.rs:23:9 + --> $DIR/regions-in-enums.rs:13:9 | LL | X5(&'foo usize) //~ ERROR use of undeclared lifetime name `'foo` | ^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-in-enums.rs:27:9 + --> $DIR/regions-in-enums.rs:17:9 | LL | X6(&'a usize) //~ ERROR use of undeclared lifetime name `'a` | ^^ undeclared lifetime diff --git a/src/test/ui/regions/regions-in-structs-anon.rs b/src/test/ui/regions/regions-in-structs-anon.rs index b85928b1b9f..7cb2ce0dbf3 100644 --- a/src/test/ui/regions/regions-in-structs-anon.rs +++ b/src/test/ui/regions/regions-in-structs-anon.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that anonymous lifetimes are not permitted in struct declarations struct Foo { diff --git a/src/test/ui/regions/regions-in-structs-anon.stderr b/src/test/ui/regions/regions-in-structs-anon.stderr index ecfac87c6c0..9defd82aed5 100644 --- a/src/test/ui/regions/regions-in-structs-anon.stderr +++ b/src/test/ui/regions/regions-in-structs-anon.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/regions-in-structs-anon.rs:14:8 + --> $DIR/regions-in-structs-anon.rs:4:8 | LL | x: &isize //~ ERROR missing lifetime specifier | ^ expected lifetime parameter diff --git a/src/test/ui/regions/regions-in-structs.rs b/src/test/ui/regions/regions-in-structs.rs index c231d3a913e..71f718ba259 100644 --- a/src/test/ui/regions/regions-in-structs.rs +++ b/src/test/ui/regions/regions-in-structs.rs @@ -1,18 +1,8 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct yes1<'a> { +struct Yes1<'a> { x: &'a usize, } -struct yes2<'a> { +struct Yes2<'a> { x: &'a usize, } diff --git a/src/test/ui/regions/regions-in-structs.stderr b/src/test/ui/regions/regions-in-structs.stderr index 679a219fbb1..dea7f105418 100644 --- a/src/test/ui/regions/regions-in-structs.stderr +++ b/src/test/ui/regions/regions-in-structs.stderr @@ -1,11 +1,11 @@ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-in-structs.rs:20:9 + --> $DIR/regions-in-structs.rs:10:9 | LL | a: &'a isize, //~ ERROR use of undeclared lifetime name `'a` | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-in-structs.rs:21:9 + --> $DIR/regions-in-structs.rs:11:9 | LL | b: &'a isize, //~ ERROR use of undeclared lifetime name `'a` | ^^ undeclared lifetime diff --git a/src/test/ui/regions/regions-infer-at-fn-not-param.rs b/src/test/ui/regions/regions-infer-at-fn-not-param.rs index ec73bf90b6e..0fd734d57b5 100644 --- a/src/test/ui/regions/regions-infer-at-fn-not-param.rs +++ b/src/test/ui/regions/regions-infer-at-fn-not-param.rs @@ -1,29 +1,19 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct parameterized1<'a> { +struct Parameterized1<'a> { g: Box } -struct not_parameterized1 { +struct NotParameterized1 { g: Box } -struct not_parameterized2 { +struct NotParameterized2 { g: Box } -fn take1<'a>(p: parameterized1) -> parameterized1<'a> { p } +fn take1<'a>(p: Parameterized1) -> Parameterized1<'a> { p } //~^ ERROR explicit lifetime required in the type of `p` -fn take3(p: not_parameterized1) -> not_parameterized1 { p } -fn take4(p: not_parameterized2) -> not_parameterized2 { p } +fn take3(p: NotParameterized1) -> NotParameterized1 { p } +fn take4(p: NotParameterized2) -> NotParameterized2 { p } fn main() {} diff --git a/src/test/ui/regions/regions-infer-at-fn-not-param.stderr b/src/test/ui/regions/regions-infer-at-fn-not-param.stderr index f129ffae23a..8cfc44f6abd 100644 --- a/src/test/ui/regions/regions-infer-at-fn-not-param.stderr +++ b/src/test/ui/regions/regions-infer-at-fn-not-param.stderr @@ -1,10 +1,10 @@ error[E0621]: explicit lifetime required in the type of `p` - --> $DIR/regions-infer-at-fn-not-param.rs:23:57 + --> $DIR/regions-infer-at-fn-not-param.rs:13:57 | -LL | fn take1<'a>(p: parameterized1) -> parameterized1<'a> { p } +LL | fn take1<'a>(p: Parameterized1) -> Parameterized1<'a> { p } | -------------- ^ lifetime `'a` required | | - | help: add explicit lifetime `'a` to the type of `p`: `parameterized1<'a>` + | help: add explicit lifetime `'a` to the type of `p`: `Parameterized1<'a>` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr index a444f90bbe1..62f0ceba94f 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr +++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local data `*p` - --> $DIR/regions-infer-borrow-scope-too-big.rs:24:12 + --> $DIR/regions-infer-borrow-scope-too-big.rs:13:12 | LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough | --- `*p` is borrowed here diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs b/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs index 2628e6a1ce2..3bf1c67da99 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs +++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs @@ -1,24 +1,13 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -struct point { +struct Point { x: isize, y: isize, } -fn x_coord<'r>(p: &'r point) -> &'r isize { +fn x_coord<'r>(p: &'r Point) -> &'r isize { return &p.x; } -fn foo<'a>(p: Box) -> &'a isize { +fn foo<'a>(p: Box) -> &'a isize { let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough assert_eq!(*xc, 3); return xc; diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr index 4c4a9b91958..562ec649a48 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr +++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr @@ -1,5 +1,5 @@ error[E0597]: `*p` does not live long enough - --> $DIR/regions-infer-borrow-scope-too-big.rs:22:23 + --> $DIR/regions-infer-borrow-scope-too-big.rs:11:23 | LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough | ^^ borrowed value does not live long enough @@ -7,10 +7,10 @@ LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:8... - --> $DIR/regions-infer-borrow-scope-too-big.rs:21:8 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 10:8... + --> $DIR/regions-infer-borrow-scope-too-big.rs:10:8 | -LL | fn foo<'a>(p: Box) -> &'a isize { +LL | fn foo<'a>(p: Box) -> &'a isize { | ^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.rs b/src/test/ui/regions/regions-infer-bound-from-trait-self.rs index 23b8ebfe54b..d15bfffe9d9 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait-self.rs +++ b/src/test/ui/regions/regions-infer-bound-from-trait-self.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can derive lifetime bounds on `Self` from trait // inheritance. diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr b/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr index 7b30f9a58f5..bcdadd7a73d 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr @@ -1,12 +1,12 @@ error[E0309]: the parameter type `Self` may not live long enough - --> $DIR/regions-infer-bound-from-trait-self.rs:56:9 + --> $DIR/regions-infer-bound-from-trait-self.rs:46:9 | LL | check_bound(x, self) | ^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `Self: 'a`... note: ...so that the type `Self` will meet its required lifetime bounds - --> $DIR/regions-infer-bound-from-trait-self.rs:56:9 + --> $DIR/regions-infer-bound-from-trait-self.rs:46:9 | LL | check_bound(x, self) | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.rs b/src/test/ui/regions/regions-infer-bound-from-trait.rs index f7a91054766..610452182f8 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait.rs +++ b/src/test/ui/regions/regions-infer-bound-from-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can derive lifetime bounds on type parameters // from trait inheritance. diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.stderr index 4c89f4bd8a8..100ac763358 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-infer-bound-from-trait.rs:43:5 + --> $DIR/regions-infer-bound-from-trait.rs:33:5 | LL | fn bar1<'a,A>(x: Inv<'a>, a: A) { | - help: consider adding an explicit lifetime bound `A: 'a`... @@ -7,13 +7,13 @@ LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough | ^^^^^^^^^^^ | note: ...so that the type `A` will meet its required lifetime bounds - --> $DIR/regions-infer-bound-from-trait.rs:43:5 + --> $DIR/regions-infer-bound-from-trait.rs:33:5 | LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough | ^^^^^^^^^^^ error[E0309]: the parameter type `A` may not live long enough - --> $DIR/regions-infer-bound-from-trait.rs:47:5 + --> $DIR/regions-infer-bound-from-trait.rs:37:5 | LL | fn bar2<'a,'b,A:Is<'b>>(x: Inv<'a>, y: Inv<'b>, a: A) { | -- help: consider adding an explicit lifetime bound `A: 'a`... @@ -21,7 +21,7 @@ LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough | ^^^^^^^^^^^ | note: ...so that the type `A` will meet its required lifetime bounds - --> $DIR/regions-infer-bound-from-trait.rs:47:5 + --> $DIR/regions-infer-bound-from-trait.rs:37:5 | LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-infer-call-3.rs b/src/test/ui/regions/regions-infer-call-3.rs index 95783a420b6..a76fccbdc52 100644 --- a/src/test/ui/regions/regions-infer-call-3.rs +++ b/src/test/ui/regions/regions-infer-call-3.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn select<'r>(x: &'r isize, y: &'r isize) -> &'r isize { x } fn with(f: F) -> T where F: FnOnce(&isize) -> T { diff --git a/src/test/ui/regions/regions-infer-call-3.stderr b/src/test/ui/regions/regions-infer-call-3.stderr index d42e5bfc7dd..1d6dbdb2c7b 100644 --- a/src/test/ui/regions/regions-infer-call-3.stderr +++ b/src/test/ui/regions/regions-infer-call-3.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'r in function call due to conflicting requirements - --> $DIR/regions-infer-call-3.rs:18:24 + --> $DIR/regions-infer-call-3.rs:8:24 | LL | let z = with(|y| { select(x, y) }); | ^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 18:18... - --> $DIR/regions-infer-call-3.rs:18:18 +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 8:18... + --> $DIR/regions-infer-call-3.rs:8:18 | LL | let z = with(|y| { select(x, y) }); | ^^^^^^^^^^^^^^^^^^^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-infer-call-3.rs:18:34 + --> $DIR/regions-infer-call-3.rs:8:34 | LL | let z = with(|y| { select(x, y) }); | ^ -note: but, the lifetime must be valid for the call at 18:13... - --> $DIR/regions-infer-call-3.rs:18:13 +note: but, the lifetime must be valid for the call at 8:13... + --> $DIR/regions-infer-call-3.rs:8:13 | LL | let z = with(|y| { select(x, y) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...so type `&isize` of expression is valid during the expression - --> $DIR/regions-infer-call-3.rs:18:13 + --> $DIR/regions-infer-call-3.rs:8:13 | LL | let z = with(|y| { select(x, y) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs index 6e1c765724b..84161388a6e 100644 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a type which is contravariant with respect to its region // parameter yields an error when used in a covariant way. // diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr index 10cc253397f..9dafc168086 100644 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-infer-contravariance-due-to-decl.rs:35:35 + --> $DIR/regions-infer-contravariance-due-to-decl.rs:25:35 | LL | fn use_<'short,'long>(c: Contravariant<'short>, | --------------------- these two types are declared with different lifetimes... diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs index 1ab8ba4439b..b5079206578 100644 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a type which is covariant with respect to its region // parameter yields an error when used in a contravariant way. // diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr index fd853629f37..a4742703666 100644 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-infer-covariance-due-to-decl.rs:32:32 + --> $DIR/regions-infer-covariance-due-to-decl.rs:22:32 | LL | fn use_<'short,'long>(c: Covariant<'long>, | ---------------- diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs index 8c191fbd5bb..e0fa904e8fe 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs @@ -1,24 +1,14 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; -struct invariant<'a> { +struct Invariant<'a> { marker: marker::PhantomData<*mut &'a()> } -fn to_same_lifetime<'r>(b_isize: invariant<'r>) { - let bj: invariant<'r> = b_isize; +fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { + let bj: Invariant<'r> = b_isize; } -fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> { +fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { b_isize //~ ERROR mismatched types } diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr index edd37b1622a..8d8c218958a 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr @@ -1,15 +1,15 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-invariance-due-to-decl.rs:22:5 + --> $DIR/regions-infer-invariance-due-to-decl.rs:12:5 | LL | b_isize //~ ERROR mismatched types | ^^^^^^^ lifetime mismatch | - = note: expected type `invariant<'static>` - found type `invariant<'r>` -note: the lifetime 'r as defined on the function body at 21:23... - --> $DIR/regions-infer-invariance-due-to-decl.rs:21:23 + = note: expected type `Invariant<'static>` + found type `Invariant<'r>` +note: the lifetime 'r as defined on the function body at 11:23... + --> $DIR/regions-infer-invariance-due-to-decl.rs:11:23 | -LL | fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> { +LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | ^^ = note: ...does not necessarily outlive the static lifetime diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs index f280e4d978e..168bf0284a1 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs @@ -1,23 +1,12 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -struct invariant<'a> { +struct Invariant<'a> { f: Box, } -fn to_same_lifetime<'r>(b_isize: invariant<'r>) { - let bj: invariant<'r> = b_isize; +fn to_same_lifetime<'r>(b_isize: Invariant<'r>) { + let bj: Invariant<'r> = b_isize; } -fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> { +fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { b_isize //~ ERROR mismatched types } diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr index 3a807b755af..7058757f908 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr @@ -1,15 +1,15 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:21:5 + --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:10:5 | LL | b_isize //~ ERROR mismatched types | ^^^^^^^ lifetime mismatch | - = note: expected type `invariant<'static>` - found type `invariant<'r>` -note: the lifetime 'r as defined on the function body at 20:23... - --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:20:23 + = note: expected type `Invariant<'static>` + found type `Invariant<'r>` +note: the lifetime 'r as defined on the function body at 9:23... + --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:9:23 | -LL | fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> { +LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | ^^ = note: ...does not necessarily outlive the static lifetime diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs index 87b5efbfadd..90c86cebce3 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - struct Invariant<'a> { f: Box *mut &'a isize + 'static>, } diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr index fb47433ba17..51b2330b658 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr @@ -1,13 +1,13 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:21:5 + --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:10:5 | LL | b_isize //~ ERROR mismatched types | ^^^^^^^ lifetime mismatch | = note: expected type `Invariant<'static>` found type `Invariant<'r>` -note: the lifetime 'r as defined on the function body at 20:23... - --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:20:23 +note: the lifetime 'r as defined on the function body at 9:23... + --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:9:23 | LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | ^^ diff --git a/src/test/ui/regions/regions-infer-not-param.rs b/src/test/ui/regions/regions-infer-not-param.rs index 131b7170951..214402952a3 100644 --- a/src/test/ui/regions/regions-infer-not-param.rs +++ b/src/test/ui/regions/regions-infer-not-param.rs @@ -1,36 +1,26 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct direct<'a> { +struct Direct<'a> { f: &'a isize } -struct indirect1 { +struct Indirect1 { // Here the lifetime parameter of direct is bound by the fn() - g: Box + g: Box } -struct indirect2<'a> { +struct Indirect2<'a> { // But here it is set to 'a - g: Box) + 'static> + g: Box) + 'static> } -fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types +fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types -fn take_indirect1(p: indirect1) -> indirect1 { p } +fn take_indirect1(p: Indirect1) -> Indirect1 { p } -fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types -//~| expected type `indirect2<'b>` -//~| found type `indirect2<'a>` +fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +//~| expected type `Indirect2<'b>` +//~| found type `Indirect2<'a>` //~| ERROR mismatched types -//~| expected type `indirect2<'b>` -//~| found type `indirect2<'a>` +//~| expected type `Indirect2<'b>` +//~| found type `Indirect2<'a>` fn main() {} diff --git a/src/test/ui/regions/regions-infer-not-param.stderr b/src/test/ui/regions/regions-infer-not-param.stderr index 2a029518953..d0d41c271c6 100644 --- a/src/test/ui/regions/regions-infer-not-param.stderr +++ b/src/test/ui/regions/regions-infer-not-param.stderr @@ -1,58 +1,58 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-not-param.rs:25:54 + --> $DIR/regions-infer-not-param.rs:15:54 | -LL | fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types | ^ lifetime mismatch | - = note: expected type `direct<'b>` - found type `direct<'a>` -note: the lifetime 'a as defined on the function body at 25:16... - --> $DIR/regions-infer-not-param.rs:25:16 + = note: expected type `Direct<'b>` + found type `Direct<'a>` +note: the lifetime 'a as defined on the function body at 15:16... + --> $DIR/regions-infer-not-param.rs:15:16 | -LL | fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types | ^^ -note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 25:19 - --> $DIR/regions-infer-not-param.rs:25:19 +note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 15:19 + --> $DIR/regions-infer-not-param.rs:15:19 | -LL | fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types | ^^ error[E0308]: mismatched types - --> $DIR/regions-infer-not-param.rs:29:63 + --> $DIR/regions-infer-not-param.rs:19:63 | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types | ^ lifetime mismatch | - = note: expected type `indirect2<'b>` - found type `indirect2<'a>` -note: the lifetime 'a as defined on the function body at 29:19... - --> $DIR/regions-infer-not-param.rs:29:19 + = note: expected type `Indirect2<'b>` + found type `Indirect2<'a>` +note: the lifetime 'a as defined on the function body at 19:19... + --> $DIR/regions-infer-not-param.rs:19:19 | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types | ^^ -note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 29:22 - --> $DIR/regions-infer-not-param.rs:29:22 +note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 19:22 + --> $DIR/regions-infer-not-param.rs:19:22 | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types | ^^ error[E0308]: mismatched types - --> $DIR/regions-infer-not-param.rs:29:63 + --> $DIR/regions-infer-not-param.rs:19:63 | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types | ^ lifetime mismatch | - = note: expected type `indirect2<'b>` - found type `indirect2<'a>` -note: the lifetime 'b as defined on the function body at 29:22... - --> $DIR/regions-infer-not-param.rs:29:22 + = note: expected type `Indirect2<'b>` + found type `Indirect2<'a>` +note: the lifetime 'b as defined on the function body at 19:22... + --> $DIR/regions-infer-not-param.rs:19:22 | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types | ^^ -note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 29:19 - --> $DIR/regions-infer-not-param.rs:29:19 +note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 19:19 + --> $DIR/regions-infer-not-param.rs:19:19 | -LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types | ^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.rs b/src/test/ui/regions/regions-infer-paramd-indirect.rs index c559992c865..0fb1824aa5d 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.rs +++ b/src/test/ui/regions/regions-infer-paramd-indirect.rs @@ -1,35 +1,24 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // Check that we correctly infer that b and c must be region // parameterized because they reference a which requires a region. -type a<'a> = &'a isize; -type b<'a> = Box>; +type A<'a> = &'a isize; +type B<'a> = Box>; -struct c<'a> { - f: Box> +struct C<'a> { + f: Box> } -trait set_f<'a> { - fn set_f_ok(&mut self, b: Box>); - fn set_f_bad(&mut self, b: Box); +trait SetF<'a> { + fn set_f_ok(&mut self, b: Box>); + fn set_f_bad(&mut self, b: Box); } -impl<'a> set_f<'a> for c<'a> { - fn set_f_ok(&mut self, b: Box>) { +impl<'a> SetF<'a> for C<'a> { + fn set_f_ok(&mut self, b: Box>) { self.f = b; } - fn set_f_bad(&mut self, b: Box) { + fn set_f_bad(&mut self, b: Box) { self.f = b; //~^ ERROR mismatched types //~| expected type `std::boxed::Box>` diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.stderr index 602f30957f1..47de228e31d 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.stderr +++ b/src/test/ui/regions/regions-infer-paramd-indirect.stderr @@ -1,15 +1,15 @@ error[E0308]: mismatched types - --> $DIR/regions-infer-paramd-indirect.rs:33:18 + --> $DIR/regions-infer-paramd-indirect.rs:22:18 | LL | self.f = b; | ^ lifetime mismatch | = note: expected type `std::boxed::Box>` found type `std::boxed::Box>` -note: the anonymous lifetime #2 defined on the method body at 32:5... - --> $DIR/regions-infer-paramd-indirect.rs:32:5 +note: the anonymous lifetime #2 defined on the method body at 21:5... + --> $DIR/regions-infer-paramd-indirect.rs:21:5 | -LL | / fn set_f_bad(&mut self, b: Box) { +LL | / fn set_f_bad(&mut self, b: Box) { LL | | self.f = b; LL | | //~^ ERROR mismatched types LL | | //~| expected type `std::boxed::Box>` @@ -17,10 +17,10 @@ LL | | //~| found type `std::boxed::Box>` LL | | //~| lifetime mismatch LL | | } | |_____^ -note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 27:6 - --> $DIR/regions-infer-paramd-indirect.rs:27:6 +note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 16:6 + --> $DIR/regions-infer-paramd-indirect.rs:16:6 | -LL | impl<'a> set_f<'a> for c<'a> { +LL | impl<'a> SetF<'a> for C<'a> { | ^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr b/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr index 67b9e0975a7..b44f8c1e7a8 100644 --- a/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr +++ b/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/regions-infer-proc-static-upvar.rs:20:13 + --> $DIR/regions-infer-proc-static-upvar.rs:10:13 | LL | let y = &x; //~ ERROR `x` does not live long enough | ^^ borrowed value does not live long enough diff --git a/src/test/ui/regions/regions-infer-proc-static-upvar.rs b/src/test/ui/regions/regions-infer-proc-static-upvar.rs index ee5d5cad0a3..5a64aa73450 100644 --- a/src/test/ui/regions/regions-infer-proc-static-upvar.rs +++ b/src/test/ui/regions/regions-infer-proc-static-upvar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that, when a variable of type `&T` is captured inside a proc, // we correctly infer/require that its lifetime is 'static. diff --git a/src/test/ui/regions/regions-infer-proc-static-upvar.stderr b/src/test/ui/regions/regions-infer-proc-static-upvar.stderr index 93fe45ed300..f929a06bad7 100644 --- a/src/test/ui/regions/regions-infer-proc-static-upvar.stderr +++ b/src/test/ui/regions/regions-infer-proc-static-upvar.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/regions-infer-proc-static-upvar.rs:20:14 + --> $DIR/regions-infer-proc-static-upvar.rs:10:14 | LL | let y = &x; //~ ERROR `x` does not live long enough | ^ borrowed value does not live long enough diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs b/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs index 5955619ea92..7d7f62e1979 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn a<'a, 'b:'a>(x: &mut &'a isize, y: &mut &'b isize) { // Note: this is legal because of the `'b:'a` declaration. *x = *y; @@ -21,13 +11,13 @@ fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { // Here we try to call `foo` but do not know that `'a` and `'b` are // related as required. - a(x, y); //~ ERROR 24:7: 24:8: lifetime mismatch [E0623] + a(x, y); //~ ERROR lifetime mismatch [E0623] } fn d() { // 'a and 'b are early bound in the function `a` because they appear // inconstraints: - let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types + let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR E0308 } fn e() { diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr index 1b600ef905f..a43ee7ec3ac 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-lifetime-bounds-on-fns.rs:18:10 + --> $DIR/regions-lifetime-bounds-on-fns.rs:8:10 | LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... @@ -8,22 +8,22 @@ LL | *x = *y; //~ ERROR E0623 | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch - --> $DIR/regions-lifetime-bounds-on-fns.rs:24:7 + --> $DIR/regions-lifetime-bounds-on-fns.rs:14:7 | LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... ... -LL | a(x, y); //~ ERROR 24:7: 24:8: lifetime mismatch [E0623] +LL | a(x, y); //~ ERROR lifetime mismatch [E0623] | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types - --> $DIR/regions-lifetime-bounds-on-fns.rs:30:43 + --> $DIR/regions-lifetime-bounds-on-fns.rs:20:43 | -LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types - | ^ expected concrete lifetime, found bound lifetime parameter +LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR E0308 + | ^ one type is more general than the other | = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` - found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}` + found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize)` error: aborting due to 3 previous errors diff --git a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr index c3a9a57d9ee..48daff1dbd8 100644 --- a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr +++ b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing temporary value - --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:26:3 + --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:16:3 | LL | let testValue = &id(Test); | -------- temporary value created here @@ -8,7 +8,7 @@ LL | testValue | ^^^^^^^^^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing temporary value - --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:32:3 + --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:22:3 | LL | let testValue = &id(MyEnum::Variant1); | -------------------- temporary value created here diff --git a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.rs b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.rs index 46c486c63a3..2d21a511083 100644 --- a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.rs +++ b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This tests verifies that unary structs and enum variants // are treated as rvalues and their lifetime is not bounded to // the static scope. diff --git a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.stderr b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.stderr index 390173ed749..c0bfc475f19 100644 --- a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.stderr +++ b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:24:20 + --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:14:20 | LL | let testValue = &id(Test); | ^^^^^^^^ temporary value does not live long enough @@ -7,14 +7,14 @@ LL | let testValue = &id(Test); LL | } | - temporary value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:19... - --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:23:19 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:19... + --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:13:19 | LL | fn structLifetime<'a>() -> &'a Test { | ^^ error[E0597]: borrowed value does not live long enough - --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:30:20 + --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:20:20 | LL | let testValue = &id(MyEnum::Variant1); | ^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough @@ -22,8 +22,8 @@ LL | let testValue = &id(MyEnum::Variant1); LL | } | - temporary value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 29:20... - --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:29:20 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 19:20... + --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:19:20 | LL | fn variantLifetime<'a>() -> &'a MyEnum { | ^^ diff --git a/src/test/ui/regions/regions-name-duplicated.rs b/src/test/ui/regions/regions-name-duplicated.rs index b4b9cfd75cb..f2adf015315 100644 --- a/src/test/ui/regions/regions-name-duplicated.rs +++ b/src/test/ui/regions/regions-name-duplicated.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'a, 'a> { //~ ERROR lifetime name `'a` declared twice x: &'a isize } diff --git a/src/test/ui/regions/regions-name-duplicated.stderr b/src/test/ui/regions/regions-name-duplicated.stderr index ad945d54ad1..1b552006a93 100644 --- a/src/test/ui/regions/regions-name-duplicated.stderr +++ b/src/test/ui/regions/regions-name-duplicated.stderr @@ -1,5 +1,5 @@ error[E0263]: lifetime name `'a` declared twice in the same scope - --> $DIR/regions-name-duplicated.rs:11:16 + --> $DIR/regions-name-duplicated.rs:1:16 | LL | struct Foo<'a, 'a> { //~ ERROR lifetime name `'a` declared twice | -- ^^ declared twice diff --git a/src/test/ui/regions/regions-name-static.rs b/src/test/ui/regions/regions-name-static.rs index 69d63f3820c..730fd99aa68 100644 --- a/src/test/ui/regions/regions-name-static.rs +++ b/src/test/ui/regions/regions-name-static.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'static> { //~ ERROR invalid lifetime parameter name: `'static` x: &'static isize } diff --git a/src/test/ui/regions/regions-name-static.stderr b/src/test/ui/regions/regions-name-static.stderr index 48077d61c45..bf7b021f9fe 100644 --- a/src/test/ui/regions/regions-name-static.stderr +++ b/src/test/ui/regions/regions-name-static.stderr @@ -1,5 +1,5 @@ error[E0262]: invalid lifetime parameter name: `'static` - --> $DIR/regions-name-static.rs:11:12 + --> $DIR/regions-name-static.rs:1:12 | LL | struct Foo<'static> { //~ ERROR invalid lifetime parameter name: `'static` | ^^^^^^^ 'static is a reserved lifetime name diff --git a/src/test/ui/regions/regions-name-undeclared.rs b/src/test/ui/regions/regions-name-undeclared.rs index a61d3094933..230a97a04b6 100644 --- a/src/test/ui/regions/regions-name-undeclared.rs +++ b/src/test/ui/regions/regions-name-undeclared.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that lifetime resolver enforces the lifetime name scoping // rules correctly in various scenarios. diff --git a/src/test/ui/regions/regions-name-undeclared.stderr b/src/test/ui/regions/regions-name-undeclared.stderr index 62fc5f5c7f7..7b041d5dad5 100644 --- a/src/test/ui/regions/regions-name-undeclared.stderr +++ b/src/test/ui/regions/regions-name-undeclared.stderr @@ -1,65 +1,65 @@ error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/regions-name-undeclared.rs:25:24 + --> $DIR/regions-name-undeclared.rs:15:24 | LL | fn m4(&self, arg: &'b isize) { } //~ ERROR undeclared lifetime | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/regions-name-undeclared.rs:26:12 + --> $DIR/regions-name-undeclared.rs:16:12 | LL | fn m5(&'b self) { } //~ ERROR undeclared lifetime | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/regions-name-undeclared.rs:27:27 + --> $DIR/regions-name-undeclared.rs:17:27 | LL | fn m6(&self, arg: Foo<'b>) { } //~ ERROR undeclared lifetime | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-name-undeclared.rs:35:22 + --> $DIR/regions-name-undeclared.rs:25:22 | LL | type X = Option<&'a isize>; //~ ERROR undeclared lifetime | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-name-undeclared.rs:37:13 + --> $DIR/regions-name-undeclared.rs:27:13 | LL | E1(&'a isize) //~ ERROR undeclared lifetime | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-name-undeclared.rs:40:13 + --> $DIR/regions-name-undeclared.rs:30:13 | LL | f: &'a isize //~ ERROR undeclared lifetime | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-name-undeclared.rs:42:14 + --> $DIR/regions-name-undeclared.rs:32:14 | LL | fn f(a: &'a isize) { } //~ ERROR undeclared lifetime | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-name-undeclared.rs:50:17 + --> $DIR/regions-name-undeclared.rs:40:17 | LL | fn fn_types(a: &'a isize, //~ ERROR undeclared lifetime | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/regions-name-undeclared.rs:52:36 + --> $DIR/regions-name-undeclared.rs:42:36 | LL | &'b isize, //~ ERROR undeclared lifetime | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/regions-name-undeclared.rs:55:36 + --> $DIR/regions-name-undeclared.rs:45:36 | LL | &'b isize)>, //~ ERROR undeclared lifetime | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-name-undeclared.rs:56:17 + --> $DIR/regions-name-undeclared.rs:46:17 | LL | c: &'a isize) //~ ERROR undeclared lifetime | ^^ undeclared lifetime diff --git a/src/test/ui/regions/regions-nested-fns-2.nll.stderr b/src/test/ui/regions/regions-nested-fns-2.nll.stderr index c45325f8c1e..ebcc31d3a20 100644 --- a/src/test/ui/regions/regions-nested-fns-2.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns-2.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `y` does not live long enough - --> $DIR/regions-nested-fns-2.rs:18:25 + --> $DIR/regions-nested-fns-2.rs:8:25 | LL | |z| { | --- value captured here diff --git a/src/test/ui/regions/regions-nested-fns-2.rs b/src/test/ui/regions/regions-nested-fns-2.rs index e66b62b6fb1..1b51880f415 100644 --- a/src/test/ui/regions/regions-nested-fns-2.rs +++ b/src/test/ui/regions/regions-nested-fns-2.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn ignore(_f: F) where F: for<'z> FnOnce(&'z isize) -> &'z isize {} fn nested() { diff --git a/src/test/ui/regions/regions-nested-fns-2.stderr b/src/test/ui/regions/regions-nested-fns-2.stderr index c0aa6f9d542..924eac6fdd4 100644 --- a/src/test/ui/regions/regions-nested-fns-2.stderr +++ b/src/test/ui/regions/regions-nested-fns-2.stderr @@ -1,5 +1,5 @@ error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function - --> $DIR/regions-nested-fns-2.rs:16:9 + --> $DIR/regions-nested-fns-2.rs:6:9 | LL | |z| { | ^^^ may outlive borrowed value `y` diff --git a/src/test/ui/regions/regions-nested-fns.rs b/src/test/ui/regions/regions-nested-fns.rs index 010b7d17688..161d812f016 100644 --- a/src/test/ui/regions/regions-nested-fns.rs +++ b/src/test/ui/regions/regions-nested-fns.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn ignore(t: T) {} fn nested<'x>(x: &'x isize) { diff --git a/src/test/ui/regions/regions-nested-fns.stderr b/src/test/ui/regions/regions-nested-fns.stderr index 93004b4c3bf..d6d4c44de61 100644 --- a/src/test/ui/regions/regions-nested-fns.stderr +++ b/src/test/ui/regions/regions-nested-fns.stderr @@ -1,11 +1,11 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-nested-fns.rs:15:18 + --> $DIR/regions-nested-fns.rs:5:18 | LL | let mut ay = &y; //~ ERROR E0495 | ^^ | -note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 17:54... - --> $DIR/regions-nested-fns.rs:17:54 +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 7:54... + --> $DIR/regions-nested-fns.rs:7:54 | LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { | ______________________________________________________^ @@ -15,12 +15,12 @@ LL | | ay = z; LL | | })); | |_____^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-nested-fns.rs:20:14 + --> $DIR/regions-nested-fns.rs:10:14 | LL | ay = z; | ^ -note: but, the lifetime must be valid for the anonymous lifetime #2 defined on the body at 23:68... - --> $DIR/regions-nested-fns.rs:23:68 +note: but, the lifetime must be valid for the anonymous lifetime #2 defined on the body at 13:68... + --> $DIR/regions-nested-fns.rs:13:68 | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ____________________________________________________________________^ @@ -34,13 +34,13 @@ LL | | })); found &isize error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/regions-nested-fns.rs:24:27 + --> $DIR/regions-nested-fns.rs:14:27 | LL | if false { return x; } //~ ERROR E0312 | ^ | -note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 23:68... - --> $DIR/regions-nested-fns.rs:23:68 +note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 13:68... + --> $DIR/regions-nested-fns.rs:13:68 | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ____________________________________________________________________^ @@ -49,8 +49,8 @@ LL | | if false { return ay; } LL | | return z; LL | | })); | |_____^ -note: ...but the borrowed content is only valid for the lifetime 'x as defined on the function body at 13:11 - --> $DIR/regions-nested-fns.rs:13:11 +note: ...but the borrowed content is only valid for the lifetime 'x as defined on the function body at 3:11 + --> $DIR/regions-nested-fns.rs:3:11 | LL | fn nested<'x>(x: &'x isize) { | ^^ diff --git a/src/test/ui/regions/regions-normalize-in-where-clause-list.rs b/src/test/ui/regions/regions-normalize-in-where-clause-list.rs index 68642598ed2..e94e8b25d65 100644 --- a/src/test/ui/regions/regions-normalize-in-where-clause-list.rs +++ b/src/test/ui/regions/regions-normalize-in-where-clause-list.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to normalize in the list of where-clauses, // even if `'a: 'b` is required. diff --git a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr index ec153f111d6..a4197eed225 100644 --- a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr +++ b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr @@ -1,5 +1,5 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/regions-normalize-in-where-clause-list.rs:32:1 + --> $DIR/regions-normalize-in-where-clause-list.rs:22:1 | LL | / fn bar<'a, 'b>() //~ ERROR cannot infer LL | | where <() as Project<'a, 'b>>::Item : Eq @@ -7,13 +7,13 @@ LL | | { LL | | } | |_^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 32:8... - --> $DIR/regions-normalize-in-where-clause-list.rs:32:8 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 22:8... + --> $DIR/regions-normalize-in-where-clause-list.rs:22:8 | LL | fn bar<'a, 'b>() //~ ERROR cannot infer | ^^ -note: ...but the lifetime must also be valid for the lifetime 'b as defined on the function body at 32:12... - --> $DIR/regions-normalize-in-where-clause-list.rs:32:12 +note: ...but the lifetime must also be valid for the lifetime 'b as defined on the function body at 22:12... + --> $DIR/regions-normalize-in-where-clause-list.rs:22:12 | LL | fn bar<'a, 'b>() //~ ERROR cannot infer | ^^ diff --git a/src/test/ui/regions/regions-outlives-nominal-type-enum-region-rev.rs b/src/test/ui/regions/regions-outlives-nominal-type-enum-region-rev.rs index 7a2be8c0d95..045d2891490 100644 --- a/src/test/ui/regions/regions-outlives-nominal-type-enum-region-rev.rs +++ b/src/test/ui/regions/regions-outlives-nominal-type-enum-region-rev.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its // arguments (like `'a`) outlive `'b`. // diff --git a/src/test/ui/regions/regions-outlives-nominal-type-enum-region.rs b/src/test/ui/regions/regions-outlives-nominal-type-enum-region.rs index 07127263bf8..e087d65a5c7 100644 --- a/src/test/ui/regions/regions-outlives-nominal-type-enum-region.rs +++ b/src/test/ui/regions/regions-outlives-nominal-type-enum-region.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its // arguments (like `'a`) outlive `'b`. // diff --git a/src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.rs b/src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.rs index 4941b568fc6..20b391c263c 100644 --- a/src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.rs +++ b/src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its // arguments (like `'a`) outlive `'b`. // diff --git a/src/test/ui/regions/regions-outlives-nominal-type-enum-type.rs b/src/test/ui/regions/regions-outlives-nominal-type-enum-type.rs index 38eb0c97a47..7f84441903f 100644 --- a/src/test/ui/regions/regions-outlives-nominal-type-enum-type.rs +++ b/src/test/ui/regions/regions-outlives-nominal-type-enum-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its // arguments (like `'a`) outlive `'b`. // diff --git a/src/test/ui/regions/regions-outlives-nominal-type-struct-region-rev.rs b/src/test/ui/regions/regions-outlives-nominal-type-struct-region-rev.rs index 50febdd4579..07daa35a809 100644 --- a/src/test/ui/regions/regions-outlives-nominal-type-struct-region-rev.rs +++ b/src/test/ui/regions/regions-outlives-nominal-type-struct-region-rev.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its // arguments (like `'a`) outlive `'b`. // diff --git a/src/test/ui/regions/regions-outlives-nominal-type-struct-region.rs b/src/test/ui/regions/regions-outlives-nominal-type-struct-region.rs index ea07fb4104b..59da5fb0dc7 100644 --- a/src/test/ui/regions/regions-outlives-nominal-type-struct-region.rs +++ b/src/test/ui/regions/regions-outlives-nominal-type-struct-region.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its // arguments (like `'a`) outlive `'b`. // diff --git a/src/test/ui/regions/regions-outlives-nominal-type-struct-type-rev.rs b/src/test/ui/regions/regions-outlives-nominal-type-struct-type-rev.rs index 735037ac2f6..096069c0ca4 100644 --- a/src/test/ui/regions/regions-outlives-nominal-type-struct-type-rev.rs +++ b/src/test/ui/regions/regions-outlives-nominal-type-struct-type-rev.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its // arguments (like `'a`) outlive `'b`. // diff --git a/src/test/ui/regions/regions-outlives-nominal-type-struct-type.rs b/src/test/ui/regions/regions-outlives-nominal-type-struct-type.rs index dfd3583ce6c..3c8c4a1ef52 100644 --- a/src/test/ui/regions/regions-outlives-nominal-type-struct-type.rs +++ b/src/test/ui/regions/regions-outlives-nominal-type-struct-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its // arguments (like `'a`) outlive `'b`. // diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.ast.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.ast.stderr new file mode 100644 index 00000000000..d8330184008 --- /dev/null +++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.ast.stderr @@ -0,0 +1,37 @@ +error[E0491]: in type `&'a WithHrAssoc>`, reference has a longer lifetime than the data it references + --> $DIR/regions-outlives-projection-container-hrtb.rs:35:12 + | +LL | let _: &'a WithHrAssoc> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the pointer is valid for the lifetime 'a as defined on the function body at 32:15 + --> $DIR/regions-outlives-projection-container-hrtb.rs:32:15 + | +LL | fn with_assoc<'a,'b>() { + | ^^ +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 32:18 + --> $DIR/regions-outlives-projection-container-hrtb.rs:32:18 + | +LL | fn with_assoc<'a,'b>() { + | ^^ + +error[E0491]: in type `&'a WithHrAssocSub>`, reference has a longer lifetime than the data it references + --> $DIR/regions-outlives-projection-container-hrtb.rs:57:12 + | +LL | let _: &'a WithHrAssocSub> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the pointer is valid for the lifetime 'a as defined on the function body at 53:19 + --> $DIR/regions-outlives-projection-container-hrtb.rs:53:19 + | +LL | fn with_assoc_sub<'a,'b>() { + | ^^ +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 53:22 + --> $DIR/regions-outlives-projection-container-hrtb.rs:53:22 + | +LL | fn with_assoc_sub<'a,'b>() { + | ^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0491`. diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.mir.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.mir.stderr new file mode 100644 index 00000000000..5028663ba6d --- /dev/null +++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.mir.stderr @@ -0,0 +1,24 @@ +error: lifetime may not live long enough + --> $DIR/regions-outlives-projection-container-hrtb.rs:35:12 + | +LL | fn with_assoc<'a,'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let _: &'a WithHrAssoc> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/regions-outlives-projection-container-hrtb.rs:57:12 + | +LL | fn with_assoc_sub<'a,'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let _: &'a WithHrAssocSub> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs b/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs index 270e20f2e6d..2871d962c42 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs +++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs @@ -1,16 +1,9 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that structs with higher-ranked where clauses don't generate // "outlives" requirements. Issue #22246. +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + #![allow(dead_code)] @@ -40,7 +33,8 @@ fn with_assoc<'a,'b>() { // We get an error because 'b:'a does not hold: let _: &'a WithHrAssoc> = loop { }; - //~^ ERROR reference has a longer lifetime + //[ast]~^ ERROR reference has a longer lifetime + //[mir]~^^ ERROR lifetime may not live long enough } /////////////////////////////////////////////////////////////////////////// @@ -61,7 +55,8 @@ fn with_assoc_sub<'a,'b>() { // below to be well-formed, it is not related to the HR relation. let _: &'a WithHrAssocSub> = loop { }; - //~^ ERROR reference has a longer lifetime + //[ast]~^ ERROR reference has a longer lifetime + //[mir]~^^ ERROR lifetime may not live long enough } diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.stderr index 32c9359b684..856e28f141f 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-hrtb.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.stderr @@ -1,33 +1,33 @@ error[E0491]: in type `&'a WithHrAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container-hrtb.rs:42:12 + --> $DIR/regions-outlives-projection-container-hrtb.rs:32:12 | LL | let _: &'a WithHrAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the function body at 39:15 - --> $DIR/regions-outlives-projection-container-hrtb.rs:39:15 +note: the pointer is valid for the lifetime 'a as defined on the function body at 29:15 + --> $DIR/regions-outlives-projection-container-hrtb.rs:29:15 | LL | fn with_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 39:18 - --> $DIR/regions-outlives-projection-container-hrtb.rs:39:18 +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 29:18 + --> $DIR/regions-outlives-projection-container-hrtb.rs:29:18 | LL | fn with_assoc<'a,'b>() { | ^^ error[E0491]: in type `&'a WithHrAssocSub>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container-hrtb.rs:63:12 + --> $DIR/regions-outlives-projection-container-hrtb.rs:53:12 | LL | let _: &'a WithHrAssocSub> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the function body at 59:19 - --> $DIR/regions-outlives-projection-container-hrtb.rs:59:19 +note: the pointer is valid for the lifetime 'a as defined on the function body at 49:19 + --> $DIR/regions-outlives-projection-container-hrtb.rs:49:19 | LL | fn with_assoc_sub<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 59:22 - --> $DIR/regions-outlives-projection-container-hrtb.rs:59:22 +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 49:22 + --> $DIR/regions-outlives-projection-container-hrtb.rs:49:22 | LL | fn with_assoc_sub<'a,'b>() { | ^^ diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.ast.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.ast.stderr new file mode 100644 index 00000000000..9e31065ca4e --- /dev/null +++ b/src/test/ui/regions/regions-outlives-projection-container-wc.ast.stderr @@ -0,0 +1,20 @@ +error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifetime than the data it references + --> $DIR/regions-outlives-projection-container-wc.rs:37:12 + | +LL | let _: &'a WithAssoc> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: the pointer is valid for the lifetime 'a as defined on the function body at 31:15 + --> $DIR/regions-outlives-projection-container-wc.rs:31:15 + | +LL | fn with_assoc<'a,'b>() { + | ^^ +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 31:18 + --> $DIR/regions-outlives-projection-container-wc.rs:31:18 + | +LL | fn with_assoc<'a,'b>() { + | ^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0491`. diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.mir.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.mir.stderr new file mode 100644 index 00000000000..880fe17b740 --- /dev/null +++ b/src/test/ui/regions/regions-outlives-projection-container-wc.mir.stderr @@ -0,0 +1,13 @@ +error: lifetime may not live long enough + --> $DIR/regions-outlives-projection-container-wc.rs:37:12 + | +LL | fn with_assoc<'a,'b>() { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | let _: &'a WithAssoc> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'a` + +error: aborting due to previous error + diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.rs b/src/test/ui/regions/regions-outlives-projection-container-wc.rs index 22ec58d1367..37622211327 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-wc.rs +++ b/src/test/ui/regions/regions-outlives-projection-container-wc.rs @@ -1,18 +1,11 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are imposing the requirement that every associated // type of a bound that appears in the where clause on a struct must // outlive the location in which the type appears, even when the // constraint is in a where clause not a bound. Issue #22246. +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + #![allow(dead_code)] /////////////////////////////////////////////////////////////////////////// @@ -41,10 +34,9 @@ fn with_assoc<'a,'b>() { // outlive 'a. In this case, that means TheType<'b>::TheAssocType, // which is &'b (), must outlive 'a. - // FIXME (#54943) NLL doesn't enforce WF condition in unreachable code if - // `_x` is changed to `_` - let _x: &'a WithAssoc> = loop { }; - //~^ ERROR reference has a longer lifetime + let _: &'a WithAssoc> = loop { }; + //[ast]~^ ERROR reference has a longer lifetime + //[mir]~^^ ERROR lifetime may not live long enough } fn main() { diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.stderr index e5bc52d7b66..0d73d3d6432 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-wc.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container-wc.stderr @@ -1,16 +1,16 @@ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container-wc.rs:46:13 + --> $DIR/regions-outlives-projection-container-wc.rs:34:12 | -LL | let _x: &'a WithAssoc> = loop { }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let _: &'a WithAssoc> = loop { }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the function body at 38:15 - --> $DIR/regions-outlives-projection-container-wc.rs:38:15 +note: the pointer is valid for the lifetime 'a as defined on the function body at 28:15 + --> $DIR/regions-outlives-projection-container-wc.rs:28:15 | LL | fn with_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 38:18 - --> $DIR/regions-outlives-projection-container-wc.rs:38:18 +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 28:18 + --> $DIR/regions-outlives-projection-container-wc.rs:28:18 | LL | fn with_assoc<'a,'b>() { | ^^ diff --git a/src/test/ui/regions/regions-outlives-projection-container.rs b/src/test/ui/regions/regions-outlives-projection-container.rs index 08fd7080e52..78305c06939 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.rs +++ b/src/test/ui/regions/regions-outlives-projection-container.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are imposing the requirement that every associated // type of a bound that appears in the where clause on a struct must // outlive the location in which the type appears. Issue #22246. diff --git a/src/test/ui/regions/regions-outlives-projection-container.stderr b/src/test/ui/regions/regions-outlives-projection-container.stderr index 2c37d943616..884314f421a 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container.stderr @@ -1,67 +1,67 @@ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container.rs:50:13 + --> $DIR/regions-outlives-projection-container.rs:40:13 | LL | let _x: &'a WithAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the function body at 42:15 - --> $DIR/regions-outlives-projection-container.rs:42:15 +note: the pointer is valid for the lifetime 'a as defined on the function body at 32:15 + --> $DIR/regions-outlives-projection-container.rs:32:15 | LL | fn with_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 42:18 - --> $DIR/regions-outlives-projection-container.rs:42:18 +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 32:18 + --> $DIR/regions-outlives-projection-container.rs:32:18 | LL | fn with_assoc<'a,'b>() { | ^^ error[E0491]: in type `&'a WithoutAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container.rs:68:13 + --> $DIR/regions-outlives-projection-container.rs:58:13 | LL | let _x: &'a WithoutAssoc> = loop { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the function body at 64:18 - --> $DIR/regions-outlives-projection-container.rs:64:18 +note: the pointer is valid for the lifetime 'a as defined on the function body at 54:18 + --> $DIR/regions-outlives-projection-container.rs:54:18 | LL | fn without_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 64:21 - --> $DIR/regions-outlives-projection-container.rs:64:21 +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 54:21 + --> $DIR/regions-outlives-projection-container.rs:54:21 | LL | fn without_assoc<'a,'b>() { | ^^ error[E0491]: in type `&'a WithAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container.rs:77:12 + --> $DIR/regions-outlives-projection-container.rs:67:12 | LL | call::<&'a WithAssoc>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the function body at 72:20 - --> $DIR/regions-outlives-projection-container.rs:72:20 +note: the pointer is valid for the lifetime 'a as defined on the function body at 62:20 + --> $DIR/regions-outlives-projection-container.rs:62:20 | LL | fn call_with_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 72:23 - --> $DIR/regions-outlives-projection-container.rs:72:23 +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 62:23 + --> $DIR/regions-outlives-projection-container.rs:62:23 | LL | fn call_with_assoc<'a,'b>() { | ^^ error[E0491]: in type `&'a WithoutAssoc>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-projection-container.rs:84:12 + --> $DIR/regions-outlives-projection-container.rs:74:12 | LL | call::<&'a WithoutAssoc>>(); //~ ERROR reference has a longer lifetime | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the function body at 81:23 - --> $DIR/regions-outlives-projection-container.rs:81:23 +note: the pointer is valid for the lifetime 'a as defined on the function body at 71:23 + --> $DIR/regions-outlives-projection-container.rs:71:23 | LL | fn call_without_assoc<'a,'b>() { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 81:26 - --> $DIR/regions-outlives-projection-container.rs:81:26 +note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 71:26 + --> $DIR/regions-outlives-projection-container.rs:71:26 | LL | fn call_without_assoc<'a,'b>() { | ^^ diff --git a/src/test/ui/regions/regions-outlives-projection-hrtype.rs b/src/test/ui/regions/regions-outlives-projection-hrtype.rs index d6d4e2b0529..a6e976ebf8c 100644 --- a/src/test/ui/regions/regions-outlives-projection-hrtype.rs +++ b/src/test/ui/regions/regions-outlives-projection-hrtype.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for the outlives relation when applied to a projection on a // type with bound regions. In this case, we are checking that // ` fn(&'r T) as TheTrait>::TheType: 'a` If we're not diff --git a/src/test/ui/regions/regions-outlives-projection-trait-def.rs b/src/test/ui/regions/regions-outlives-projection-trait-def.rs index b05788dc413..bad476d2779 100644 --- a/src/test/ui/regions/regions-outlives-projection-trait-def.rs +++ b/src/test/ui/regions/regions-outlives-projection-trait-def.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that `>::Type: 'b`, where `trait Foo<'a> { Type: // 'a; }`, does not require that `F: 'b`. diff --git a/src/test/ui/regions/regions-outlives-scalar.rs b/src/test/ui/regions/regions-outlives-scalar.rs index a203ebd919d..ca012c4e1ed 100644 --- a/src/test/ui/regions/regions-outlives-scalar.rs +++ b/src/test/ui/regions/regions-outlives-scalar.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that scalar values outlive all regions. // Rule OutlivesScalar from RFC 1214. diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr index 927865a3d28..8809cf4b09e 100644 --- a/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr +++ b/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `line` does not live long enough - --> $DIR/regions-pattern-typing-issue-19552.rs:15:14 + --> $DIR/regions-pattern-typing-issue-19552.rs:5:14 | LL | match [&*line] { //~ ERROR `line` does not live long enough | ^^^^ borrowed value does not live long enough diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19552.rs b/src/test/ui/regions/regions-pattern-typing-issue-19552.rs index 3401dd1becd..a64ab1c85e3 100644 --- a/src/test/ui/regions/regions-pattern-typing-issue-19552.rs +++ b/src/test/ui/regions/regions-pattern-typing-issue-19552.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn assert_static(_t: T) {} fn main() { diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr index cefedefa243..ad80925cad7 100644 --- a/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr +++ b/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr @@ -1,5 +1,5 @@ error[E0597]: `line` does not live long enough - --> $DIR/regions-pattern-typing-issue-19552.rs:15:14 + --> $DIR/regions-pattern-typing-issue-19552.rs:5:14 | LL | match [&*line] { //~ ERROR `line` does not live long enough | ^^^^ borrowed value does not live long enough diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.nll.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.nll.stderr index 2acac5d5cf8..935620075f7 100644 --- a/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.nll.stderr +++ b/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.nll.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `a1` because it is borrowed - --> $DIR/regions-pattern-typing-issue-19997.rs:20:13 + --> $DIR/regions-pattern-typing-issue-19997.rs:10:13 | LL | match (&a1,) { | --- borrow of `a1` occurs here diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.stderr index c26a0369740..e23c6ada2b5 100644 --- a/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.stderr +++ b/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `a1` because it is borrowed - --> $DIR/regions-pattern-typing-issue-19997.rs:20:13 + --> $DIR/regions-pattern-typing-issue-19997.rs:10:13 | LL | match (&a1,) { | -- borrow of `a1` occurs here diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19997.mir.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19997.mir.stderr index 2acac5d5cf8..935620075f7 100644 --- a/src/test/ui/regions/regions-pattern-typing-issue-19997.mir.stderr +++ b/src/test/ui/regions/regions-pattern-typing-issue-19997.mir.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `a1` because it is borrowed - --> $DIR/regions-pattern-typing-issue-19997.rs:20:13 + --> $DIR/regions-pattern-typing-issue-19997.rs:10:13 | LL | match (&a1,) { | --- borrow of `a1` occurs here diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19997.rs b/src/test/ui/regions/regions-pattern-typing-issue-19997.rs index 1f23dcbb725..35f38af0cfe 100644 --- a/src/test/ui/regions/regions-pattern-typing-issue-19997.rs +++ b/src/test/ui/regions/regions-pattern-typing-issue-19997.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/regions/regions-proc-bound-capture.rs b/src/test/ui/regions/regions-proc-bound-capture.rs index dd7b2bf9635..f2010dbe62d 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.rs +++ b/src/test/ui/regions/regions-proc-bound-capture.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn borrowed_proc<'a>(x: &'a isize) -> Box(isize) + 'a> { // This is legal, because the region bound on `proc` // states that it captures `x`. diff --git a/src/test/ui/regions/regions-proc-bound-capture.stderr b/src/test/ui/regions/regions-proc-bound-capture.stderr index b38543bdc43..31be3ab4d3d 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.stderr +++ b/src/test/ui/regions/regions-proc-bound-capture.stderr @@ -1,5 +1,5 @@ error[E0621]: explicit lifetime required in the type of `x` - --> $DIR/regions-proc-bound-capture.rs:19:5 + --> $DIR/regions-proc-bound-capture.rs:9:5 | LL | fn static_proc(x: &isize) -> Box(isize) + 'static> { | ------ help: add explicit lifetime `'static` to the type of `x`: `&'static isize` diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs index f6f1a189e5e..35aca8be25b 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #8624. Test for reborrowing with 3 levels, not just two. fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize { - &mut ***p //~ ERROR 14:5: 14:14: lifetime mismatch [E0623] + &mut ***p //~ ERROR lifetime mismatch [E0623] } fn main() { diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr index cddb60a4337..5670e5305eb 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr @@ -1,11 +1,11 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:14:5 + --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:4:5 | LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize { | ----------------------------- ------------- | | | this parameter and the return type are declared with different lifetimes... -LL | &mut ***p //~ ERROR 14:5: 14:14: lifetime mismatch [E0623] +LL | &mut ***p //~ ERROR lifetime mismatch [E0623] | ^^^^^^^^^ ...but data from `p` is returned here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs index 7270b477d2d..77041ab4f05 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs @@ -1,19 +1,9 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #8624. Tests that reborrowing the contents of an `&'b mut` // pointer which is backed by another `&'a mut` can only be done // for `'a` (which must be a sublifetime of `'b`). fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { - &mut **p //~ ERROR 16:5: 16:13: lifetime mismatch [E0623] + &mut **p //~ ERROR lifetime mismatch [E0623] } fn main() { diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr index 9f8d0168ede..90004e27d95 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr @@ -1,11 +1,11 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:16:5 + --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:6:5 | LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { | --------------------- ------------- | | | this parameter and the return type are declared with different lifetimes... -LL | &mut **p //~ ERROR 16:5: 16:13: lifetime mismatch [E0623] +LL | &mut **p //~ ERROR lifetime mismatch [E0623] | ^^^^^^^^ ...but data from `p` is returned here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr index b6f89540bd4..bead12356f1 100644 --- a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr +++ b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing function parameter - --> $DIR/regions-ref-in-fn-arg.rs:15:5 + --> $DIR/regions-ref-in-fn-arg.rs:5:5 | LL | fn arg_item(box ref x: Box) -> &'static isize { | --------- function parameter borrowed here @@ -7,7 +7,7 @@ LL | x //~^ ERROR borrowed value does not live long enough | ^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing function parameter - --> $DIR/regions-ref-in-fn-arg.rs:21:22 + --> $DIR/regions-ref-in-fn-arg.rs:11:22 | LL | with(|box ref x| x) //~ ERROR borrowed value does not live long enough | --------- ^ returns a value referencing data owned by the current function diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.rs b/src/test/ui/regions/regions-ref-in-fn-arg.rs index bc8060e3915..cf9e7b27ed0 100644 --- a/src/test/ui/regions/regions-ref-in-fn-arg.rs +++ b/src/test/ui/regions/regions-ref-in-fn-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.stderr index 0250f6e26fe..748508ecbcd 100644 --- a/src/test/ui/regions/regions-ref-in-fn-arg.stderr +++ b/src/test/ui/regions/regions-ref-in-fn-arg.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/regions-ref-in-fn-arg.rs:14:17 + --> $DIR/regions-ref-in-fn-arg.rs:4:17 | LL | fn arg_item(box ref x: Box) -> &'static isize { | ^^^^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough - --> $DIR/regions-ref-in-fn-arg.rs:21:15 + --> $DIR/regions-ref-in-fn-arg.rs:11:15 | LL | with(|box ref x| x) //~ ERROR borrowed value does not live long enough | ^^^^^ - borrowed value only lives until here diff --git a/src/test/ui/regions/regions-ret-borrowed-1.rs b/src/test/ui/regions/regions-ret-borrowed-1.rs index b8cebe66518..1be5edee599 100644 --- a/src/test/ui/regions/regions-ret-borrowed-1.rs +++ b/src/test/ui/regions/regions-ret-borrowed-1.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Similar to regions-ret-borrowed.rs, but using a named lifetime. At // some point regions-ret-borrowed reported an error but this file did // not, due to special hardcoding around the anonymous region. diff --git a/src/test/ui/regions/regions-ret-borrowed-1.stderr b/src/test/ui/regions/regions-ret-borrowed-1.stderr index ac886bcbc7c..72e47cea094 100644 --- a/src/test/ui/regions/regions-ret-borrowed-1.stderr +++ b/src/test/ui/regions/regions-ret-borrowed-1.stderr @@ -1,24 +1,24 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-ret-borrowed-1.rs:20:14 + --> $DIR/regions-ret-borrowed-1.rs:10:14 | LL | with(|o| o) | ^ | -note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 20:10... - --> $DIR/regions-ret-borrowed-1.rs:20:10 +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 10:10... + --> $DIR/regions-ret-borrowed-1.rs:10:10 | LL | with(|o| o) | ^^^^^ = note: ...so that the expression is assignable: expected &isize found &isize -note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 19:14... - --> $DIR/regions-ret-borrowed-1.rs:19:14 +note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 9:14... + --> $DIR/regions-ret-borrowed-1.rs:9:14 | LL | fn return_it<'a>() -> &'a isize { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-ret-borrowed-1.rs:20:5 + --> $DIR/regions-ret-borrowed-1.rs:10:5 | LL | with(|o| o) | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-ret-borrowed.rs b/src/test/ui/regions/regions-ret-borrowed.rs index 40909ddd4ad..5fca92d68b6 100644 --- a/src/test/ui/regions/regions-ret-borrowed.rs +++ b/src/test/ui/regions/regions-ret-borrowed.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Ensure that you cannot use generic types to return a region outside // of its bound. Here, in the `return_it()` fn, we call with() but // with R bound to &isize from the return_it. Meanwhile, with() diff --git a/src/test/ui/regions/regions-ret-borrowed.stderr b/src/test/ui/regions/regions-ret-borrowed.stderr index 36c4ce7e174..ce0c429ccb2 100644 --- a/src/test/ui/regions/regions-ret-borrowed.stderr +++ b/src/test/ui/regions/regions-ret-borrowed.stderr @@ -1,24 +1,24 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/regions-ret-borrowed.rs:23:14 + --> $DIR/regions-ret-borrowed.rs:13:14 | LL | with(|o| o) | ^ | -note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 23:10... - --> $DIR/regions-ret-borrowed.rs:23:10 +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 13:10... + --> $DIR/regions-ret-borrowed.rs:13:10 | LL | with(|o| o) | ^^^^^ = note: ...so that the expression is assignable: expected &isize found &isize -note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 22:14... - --> $DIR/regions-ret-borrowed.rs:22:14 +note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 12:14... + --> $DIR/regions-ret-borrowed.rs:12:14 | LL | fn return_it<'a>() -> &'a isize { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-ret-borrowed.rs:23:5 + --> $DIR/regions-ret-borrowed.rs:13:5 | LL | with(|o| o) | ^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-ret.nll.stderr b/src/test/ui/regions/regions-ret.nll.stderr index 35c1113fb62..b8b4ce56bb2 100644 --- a/src/test/ui/regions/regions-ret.nll.stderr +++ b/src/test/ui/regions/regions-ret.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to temporary value - --> $DIR/regions-ret.rs:14:12 + --> $DIR/regions-ret.rs:4:12 | LL | return &id(3); //~ ERROR borrowed value does not live long enough | ^----- diff --git a/src/test/ui/regions/regions-ret.rs b/src/test/ui/regions/regions-ret.rs index c7cd3ced98d..a094d1af5b7 100644 --- a/src/test/ui/regions/regions-ret.rs +++ b/src/test/ui/regions/regions-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn id(x: T) -> T { x } fn f(_x: &isize) -> &isize { diff --git a/src/test/ui/regions/regions-ret.stderr b/src/test/ui/regions/regions-ret.stderr index 84515a9b44c..001f62ab60c 100644 --- a/src/test/ui/regions/regions-ret.stderr +++ b/src/test/ui/regions/regions-ret.stderr @@ -1,13 +1,13 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/regions-ret.rs:14:13 + --> $DIR/regions-ret.rs:4:13 | LL | return &id(3); //~ ERROR borrowed value does not live long enough | ^^^^^- temporary value only lives until here | | | temporary value does not live long enough | -note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 13:1... - --> $DIR/regions-ret.rs:13:1 +note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 3:1... + --> $DIR/regions-ret.rs:3:1 | LL | / fn f(_x: &isize) -> &isize { LL | | return &id(3); //~ ERROR borrowed value does not live long enough diff --git a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.rs b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.rs index 99e5cc03153..afe87f47ead 100644 --- a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.rs +++ b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that closures cannot subvert aliasing restrictions fn main() { diff --git a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr index c841c9605bd..e4b14811d90 100644 --- a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr +++ b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr @@ -1,26 +1,26 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements - --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:17:24 + --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24 | LL | let mut f = || &mut x; //~ ERROR cannot infer | ^^^^^^ | -note: first, the lifetime cannot outlive the lifetime as defined on the body at 17:21... - --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:17:21 +note: first, the lifetime cannot outlive the lifetime as defined on the body at 7:21... + --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:21 | LL | let mut f = || &mut x; //~ ERROR cannot infer | ^^^^^^^^^ note: ...so that closure can access `x` - --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:17:24 + --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24 | LL | let mut f = || &mut x; //~ ERROR cannot infer | ^^^^^^ -note: but, the lifetime must be valid for the call at 19:17... - --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:19:17 +note: but, the lifetime must be valid for the call at 9:17... + --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:9:17 | LL | let y = f(); | ^^^ note: ...so type `&mut i32` of expression is valid during the expression - --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:19:17 + --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:9:17 | LL | let y = f(); | ^^^ diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr index 041d627f584..1bdcf83521d 100644 --- a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr +++ b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to temporary value - --> $DIR/regions-return-stack-allocated-vec.rs:14:5 + --> $DIR/regions-return-stack-allocated-vec.rs:4:5 | LL | &[x] //~ ERROR borrowed value does not live long enough | ^--- diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.rs b/src/test/ui/regions/regions-return-stack-allocated-vec.rs index b5d4e07d04b..8d071dbc606 100644 --- a/src/test/ui/regions/regions-return-stack-allocated-vec.rs +++ b/src/test/ui/regions/regions-return-stack-allocated-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we cannot return a stack allocated slice fn function(x: isize) -> &'static [isize] { diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.stderr b/src/test/ui/regions/regions-return-stack-allocated-vec.stderr index 77c1d177acb..78eec7cc456 100644 --- a/src/test/ui/regions/regions-return-stack-allocated-vec.stderr +++ b/src/test/ui/regions/regions-return-stack-allocated-vec.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/regions-return-stack-allocated-vec.rs:14:6 + --> $DIR/regions-return-stack-allocated-vec.rs:4:6 | LL | &[x] //~ ERROR borrowed value does not live long enough | ^^^ temporary value does not live long enough diff --git a/src/test/ui/regions/regions-static-bound.ll.stderr b/src/test/ui/regions/regions-static-bound.ll.stderr index cf291279210..4695a82ebb4 100644 --- a/src/test/ui/regions/regions-static-bound.ll.stderr +++ b/src/test/ui/regions/regions-static-bound.ll.stderr @@ -1,18 +1,18 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/regions-static-bound.rs:19:5 + --> $DIR/regions-static-bound.rs:9:5 | LL | t //[ll]~ ERROR E0312 | ^ | = note: ...the reference is valid for the static lifetime... -note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 18:24 - --> $DIR/regions-static-bound.rs:18:24 +note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 8:24 + --> $DIR/regions-static-bound.rs:8:24 | LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { | ^^ error[E0621]: explicit lifetime required in the type of `u` - --> $DIR/regions-static-bound.rs:24:5 + --> $DIR/regions-static-bound.rs:14:5 | LL | fn error(u: &(), v: &()) { | --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()` @@ -20,7 +20,7 @@ LL | static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of | ^^^^^^^^^ lifetime `'static` required error[E0621]: explicit lifetime required in the type of `v` - --> $DIR/regions-static-bound.rs:26:5 + --> $DIR/regions-static-bound.rs:16:5 | LL | fn error(u: &(), v: &()) { | --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()` diff --git a/src/test/ui/regions/regions-static-bound.nll.stderr b/src/test/ui/regions/regions-static-bound.nll.stderr index 462fbe8ee19..d6cec03e0ff 100644 --- a/src/test/ui/regions/regions-static-bound.nll.stderr +++ b/src/test/ui/regions/regions-static-bound.nll.stderr @@ -1,5 +1,5 @@ -error: unsatisfied lifetime constraints - --> $DIR/regions-static-bound.rs:19:5 +error: lifetime may not live long enough + --> $DIR/regions-static-bound.rs:9:5 | LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { | -- lifetime `'a` defined here @@ -7,7 +7,7 @@ LL | t //[ll]~ ERROR E0312 | ^ returning this value requires that `'a` must outlive `'static` error[E0621]: explicit lifetime required in the type of `u` - --> $DIR/regions-static-bound.rs:24:5 + --> $DIR/regions-static-bound.rs:14:5 | LL | fn error(u: &(), v: &()) { | --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()` @@ -15,7 +15,7 @@ LL | static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of | ^^^^^^^^^^^^^ lifetime `'static` required error[E0621]: explicit lifetime required in the type of `v` - --> $DIR/regions-static-bound.rs:26:5 + --> $DIR/regions-static-bound.rs:16:5 | LL | fn error(u: &(), v: &()) { | --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()` diff --git a/src/test/ui/regions/regions-static-bound.rs b/src/test/ui/regions/regions-static-bound.rs index c5dc6000e83..c1a15e50a4d 100644 --- a/src/test/ui/regions/regions-static-bound.rs +++ b/src/test/ui/regions/regions-static-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ll nll //[nll] compile-flags:-Zborrowck=mir @@ -17,7 +7,7 @@ fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static () where 'a: 'b, 'b: 'static { t } fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { t //[ll]~ ERROR E0312 - //[nll]~^ ERROR unsatisfied lifetime constraints + //[nll]~^ ERROR lifetime may not live long enough } fn error(u: &(), v: &()) { diff --git a/src/test/ui/regions/regions-steal-closure.nll.stderr b/src/test/ui/regions/regions-steal-closure.nll.stderr index 538903c5918..c30f9c52363 100644 --- a/src/test/ui/regions/regions-steal-closure.nll.stderr +++ b/src/test/ui/regions/regions-steal-closure.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `i` does not live long enough - --> $DIR/regions-steal-closure.rs:24:28 + --> $DIR/regions-steal-closure.rs:14:28 | LL | let mut cl_box = { | ---------- borrow later stored here diff --git a/src/test/ui/regions/regions-steal-closure.rs b/src/test/ui/regions/regions-steal-closure.rs index 7ca63b9896f..e6b34510bb5 100644 --- a/src/test/ui/regions/regions-steal-closure.rs +++ b/src/test/ui/regions/regions-steal-closure.rs @@ -1,21 +1,11 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(fn_traits)] -struct closure_box<'a> { +struct ClosureBox<'a> { cl: Box, } -fn box_it<'r>(x: Box) -> closure_box<'r> { - closure_box {cl: x} +fn box_it<'r>(x: Box) -> ClosureBox<'r> { + ClosureBox {cl: x} } fn main() { diff --git a/src/test/ui/regions/regions-steal-closure.stderr b/src/test/ui/regions/regions-steal-closure.stderr index 44843d19e92..dc5c1671535 100644 --- a/src/test/ui/regions/regions-steal-closure.stderr +++ b/src/test/ui/regions/regions-steal-closure.stderr @@ -1,5 +1,5 @@ error[E0597]: `i` does not live long enough - --> $DIR/regions-steal-closure.rs:24:28 + --> $DIR/regions-steal-closure.rs:14:28 | LL | box_it(Box::new(|| i += 1)) //~ ERROR `i` does not live long enough | -- ^ borrowed value does not live long enough diff --git a/src/test/ui/regions/regions-struct-not-wf.rs b/src/test/ui/regions/regions-struct-not-wf.rs deleted file mode 100644 index bdd708197bc..00000000000 --- a/src/test/ui/regions/regions-struct-not-wf.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Various examples of structs whose fields are not well-formed. - -#![allow(dead_code)] - -trait Trait<'a, T> { - type Out; -} -trait Trait1<'a, 'b, T> { - type Out; -} - -impl<'a, T> Trait<'a, T> for usize { - type Out = &'a T; -} - -struct RefOk<'a, T:'a> { - field: &'a T -} - -impl<'a, T> Trait<'a, T> for u32 { - type Out = RefOk<'a, T>; -} - -impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { - type Out = &'a &'b T; -} - -fn main() { } diff --git a/src/test/ui/regions/regions-struct-not-wf.stderr b/src/test/ui/regions/regions-struct-not-wf.stderr deleted file mode 100644 index d8c8b6c3ccc..00000000000 --- a/src/test/ui/regions/regions-struct-not-wf.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-struct-not-wf.rs:23:5 - | -LL | impl<'a, T> Trait<'a, T> for usize { - | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a T; - | ^^^^^^^^^^^^^^^^^ - | -note: ...so that the reference type `&'a T` does not outlive the data it points at - --> $DIR/regions-struct-not-wf.rs:23:5 - | -LL | type Out = &'a T; - | ^^^^^^^^^^^^^^^^^ - -error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-struct-not-wf.rs:31:5 - | -LL | impl<'a, T> Trait<'a, T> for u32 { - | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = RefOk<'a, T>; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-struct-not-wf.rs:31:5 - | -LL | type Out = RefOk<'a, T>; - | ^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references - --> $DIR/regions-struct-not-wf.rs:35:5 - | -LL | type Out = &'a &'b T; - | ^^^^^^^^^^^^^^^^^^^^^ - | -note: the pointer is valid for the lifetime 'a as defined on the impl at 34:6 - --> $DIR/regions-struct-not-wf.rs:34:6 - | -LL | impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { - | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 34:10 - --> $DIR/regions-struct-not-wf.rs:34:10 - | -LL | impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { - | ^^ - -error: aborting due to 3 previous errors - -Some errors occurred: E0309, E0491. -For more information about an error, try `rustc --explain E0309`. diff --git a/src/test/ui/regions/regions-trait-1.rs b/src/test/ui/regions/regions-trait-1.rs index 9cd08656b62..72738871936 100644 --- a/src/test/ui/regions/regions-trait-1.rs +++ b/src/test/ui/regions/regions-trait-1.rs @@ -1,40 +1,30 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] -struct ctxt { v: usize } +struct Ctxt { v: usize } -trait get_ctxt { +trait GetCtxt { // Here the `&` is bound in the method definition: - fn get_ctxt(&self) -> &ctxt; + fn get_ctxt(&self) -> &Ctxt; } -struct has_ctxt<'a> { c: &'a ctxt } +struct HasCtxt<'a> { c: &'a Ctxt } -impl<'a> get_ctxt for has_ctxt<'a> { +impl<'a> GetCtxt for HasCtxt<'a> { // Here an error occurs because we used `&self` but // the definition used `&`: - fn get_ctxt(&self) -> &'a ctxt { //~ ERROR method not compatible with trait + fn get_ctxt(&self) -> &'a Ctxt { //~ ERROR method not compatible with trait self.c } } -fn get_v(gc: Box) -> usize { +fn get_v(gc: Box) -> usize { gc.get_ctxt().v } fn main() { - let ctxt = ctxt { v: 22 }; - let hc = has_ctxt { c: &ctxt }; - assert_eq!(get_v(box hc as Box), 22); + let ctxt = Ctxt { v: 22 }; + let hc = HasCtxt { c: &ctxt }; + assert_eq!(get_v(box hc as Box), 22); } diff --git a/src/test/ui/regions/regions-trait-1.stderr b/src/test/ui/regions/regions-trait-1.stderr index dbc47a55950..e1aa2a2c299 100644 --- a/src/test/ui/regions/regions-trait-1.stderr +++ b/src/test/ui/regions/regions-trait-1.stderr @@ -1,20 +1,20 @@ error[E0308]: method not compatible with trait - --> $DIR/regions-trait-1.rs:26:5 + --> $DIR/regions-trait-1.rs:16:5 | -LL | fn get_ctxt(&self) -> &'a ctxt { //~ ERROR method not compatible with trait +LL | fn get_ctxt(&self) -> &'a Ctxt { //~ ERROR method not compatible with trait | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | - = note: expected type `fn(&has_ctxt<'a>) -> &ctxt` - found type `fn(&has_ctxt<'a>) -> &'a ctxt` -note: the lifetime 'a as defined on the impl at 22:6... - --> $DIR/regions-trait-1.rs:22:6 + = note: expected type `fn(&HasCtxt<'a>) -> &Ctxt` + found type `fn(&HasCtxt<'a>) -> &'a Ctxt` +note: the lifetime 'a as defined on the impl at 12:6... + --> $DIR/regions-trait-1.rs:12:6 | -LL | impl<'a> get_ctxt for has_ctxt<'a> { +LL | impl<'a> GetCtxt for HasCtxt<'a> { | ^^ -note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 26:5 - --> $DIR/regions-trait-1.rs:26:5 +note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 16:5 + --> $DIR/regions-trait-1.rs:16:5 | -LL | / fn get_ctxt(&self) -> &'a ctxt { //~ ERROR method not compatible with trait +LL | / fn get_ctxt(&self) -> &'a Ctxt { //~ ERROR method not compatible with trait LL | | self.c LL | | } | |_____^ diff --git a/src/test/ui/regions/regions-trait-object-subtyping.rs b/src/test/ui/regions/regions-trait-object-subtyping.rs index 948fb7e1ef6..eb262354456 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.rs +++ b/src/test/ui/regions/regions-trait-object-subtyping.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Dummy { fn dummy(&self); } fn foo1<'a:'b,'b>(x: &'a mut (Dummy+'a)) -> &'b mut (Dummy+'b) { diff --git a/src/test/ui/regions/regions-trait-object-subtyping.stderr b/src/test/ui/regions/regions-trait-object-subtyping.stderr index a281b36946b..dc5ce34d7d8 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.stderr @@ -1,38 +1,38 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/regions-trait-object-subtyping.rs:25:5 + --> $DIR/regions-trait-object-subtyping.rs:15:5 | LL | x //~ ERROR lifetime bound not satisfied | ^ | -note: lifetime parameter instantiated with the lifetime 'a as defined on the function body at 23:9 - --> $DIR/regions-trait-object-subtyping.rs:23:9 +note: lifetime parameter instantiated with the lifetime 'a as defined on the function body at 13:9 + --> $DIR/regions-trait-object-subtyping.rs:13:9 | LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { | ^^ -note: but lifetime parameter must outlive the lifetime 'b as defined on the function body at 23:12 - --> $DIR/regions-trait-object-subtyping.rs:23:12 +note: but lifetime parameter must outlive the lifetime 'b as defined on the function body at 13:12 + --> $DIR/regions-trait-object-subtyping.rs:13:12 | LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { | ^^ error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements - --> $DIR/regions-trait-object-subtyping.rs:25:5 + --> $DIR/regions-trait-object-subtyping.rs:15:5 | LL | x //~ ERROR lifetime bound not satisfied | ^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 23:9... - --> $DIR/regions-trait-object-subtyping.rs:23:9 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 13:9... + --> $DIR/regions-trait-object-subtyping.rs:13:9 | LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/regions-trait-object-subtyping.rs:25:5 + --> $DIR/regions-trait-object-subtyping.rs:15:5 | LL | x //~ ERROR lifetime bound not satisfied | ^ -note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 23:12... - --> $DIR/regions-trait-object-subtyping.rs:23:12 +note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 13:12... + --> $DIR/regions-trait-object-subtyping.rs:13:12 | LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { | ^^ @@ -41,20 +41,20 @@ LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { found &mut (dyn Dummy + 'b) error[E0308]: mismatched types - --> $DIR/regions-trait-object-subtyping.rs:32:5 + --> $DIR/regions-trait-object-subtyping.rs:22:5 | LL | x //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `Wrapper<&'b mut (dyn Dummy + 'b)>` found type `Wrapper<&'a mut (dyn Dummy + 'a)>` -note: the lifetime 'b as defined on the function body at 30:15... - --> $DIR/regions-trait-object-subtyping.rs:30:15 +note: the lifetime 'b as defined on the function body at 20:15... + --> $DIR/regions-trait-object-subtyping.rs:20:15 | LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> { | ^^ -note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 30:9 - --> $DIR/regions-trait-object-subtyping.rs:30:9 +note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 20:9 + --> $DIR/regions-trait-object-subtyping.rs:20:9 | LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> { | ^^ diff --git a/src/test/ui/regions/regions-trait-variance.nll.stderr b/src/test/ui/regions/regions-trait-variance.nll.stderr index 92d5a10af3a..ca05c93a7ec 100644 --- a/src/test/ui/regions/regions-trait-variance.nll.stderr +++ b/src/test/ui/regions/regions-trait-variance.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing local data `*b` - --> $DIR/regions-trait-variance.rs:48:5 + --> $DIR/regions-trait-variance.rs:38:5 | LL | let bb: &B = &*b; //~ ERROR `*b` does not live long enough | --- `*b` is borrowed here diff --git a/src/test/ui/regions/regions-trait-variance.rs b/src/test/ui/regions/regions-trait-variance.rs index 9ba4ef4e358..d5462b21fa7 100644 --- a/src/test/ui/regions/regions-trait-variance.rs +++ b/src/test/ui/regions/regions-trait-variance.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] // Issue #12470. diff --git a/src/test/ui/regions/regions-trait-variance.stderr b/src/test/ui/regions/regions-trait-variance.stderr index cd48d6bf8af..ddc8ce9796d 100644 --- a/src/test/ui/regions/regions-trait-variance.stderr +++ b/src/test/ui/regions/regions-trait-variance.stderr @@ -1,5 +1,5 @@ error[E0597]: `*b` does not live long enough - --> $DIR/regions-trait-variance.rs:47:19 + --> $DIR/regions-trait-variance.rs:37:19 | LL | let bb: &B = &*b; //~ ERROR `*b` does not live long enough | ^^ borrowed value does not live long enough @@ -7,8 +7,8 @@ LL | make_a(bb) LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the lifetime 'a as defined on the function body at 43:16... - --> $DIR/regions-trait-variance.rs:43:16 +note: borrowed value must be valid for the lifetime 'a as defined on the function body at 33:16... + --> $DIR/regions-trait-variance.rs:33:16 | LL | fn make_make_a<'a>() -> A<'a> { | ^^ diff --git a/src/test/ui/regions/regions-undeclared.rs b/src/test/ui/regions/regions-undeclared.rs index 31908751580..1edd998aa0e 100644 --- a/src/test/ui/regions/regions-undeclared.rs +++ b/src/test/ui/regions/regions-undeclared.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static c_x: &'blk isize = &22; //~ ERROR use of undeclared lifetime name `'blk` enum EnumDecl { diff --git a/src/test/ui/regions/regions-undeclared.stderr b/src/test/ui/regions/regions-undeclared.stderr index 9870f328abe..7e35dc1c474 100644 --- a/src/test/ui/regions/regions-undeclared.stderr +++ b/src/test/ui/regions/regions-undeclared.stderr @@ -1,29 +1,29 @@ error[E0261]: use of undeclared lifetime name `'blk` - --> $DIR/regions-undeclared.rs:11:14 + --> $DIR/regions-undeclared.rs:1:14 | LL | static c_x: &'blk isize = &22; //~ ERROR use of undeclared lifetime name `'blk` | ^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-undeclared.rs:14:10 + --> $DIR/regions-undeclared.rs:4:10 | LL | Foo(&'a isize), //~ ERROR use of undeclared lifetime name `'a` | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-undeclared.rs:15:10 + --> $DIR/regions-undeclared.rs:5:10 | LL | Bar(&'a isize), //~ ERROR use of undeclared lifetime name `'a` | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-undeclared.rs:18:15 + --> $DIR/regions-undeclared.rs:8:15 | LL | fn fnDecl(x: &'a isize, //~ ERROR use of undeclared lifetime name `'a` | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/regions-undeclared.rs:19:15 + --> $DIR/regions-undeclared.rs:9:15 | LL | y: &'a isize) //~ ERROR use of undeclared lifetime name `'a` | ^^ undeclared lifetime diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr index c790f7ec1e5..e38574e774d 100644 --- a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr +++ b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/regions-var-type-out-of-scope.rs:19:14 + --> $DIR/regions-var-type-out-of-scope.rs:9:14 | LL | x = &id(3); //~ ERROR borrowed value does not live long enough | ^^^^^- temporary value is freed at the end of this statement diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.rs b/src/test/ui/regions/regions-var-type-out-of-scope.rs index 031091c4523..e9721630974 100644 --- a/src/test/ui/regions/regions-var-type-out-of-scope.rs +++ b/src/test/ui/regions/regions-var-type-out-of-scope.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn id(x: T) -> T { x } fn foo(cond: bool) { diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.stderr index 92a6451c3bd..f474b9a2343 100644 --- a/src/test/ui/regions/regions-var-type-out-of-scope.stderr +++ b/src/test/ui/regions/regions-var-type-out-of-scope.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/regions-var-type-out-of-scope.rs:19:14 + --> $DIR/regions-var-type-out-of-scope.rs:9:14 | LL | x = &id(3); //~ ERROR borrowed value does not live long enough | ^^^^^- temporary value dropped here while still borrowed diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs index 1dfebd54ec3..8ddd041d457 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a type which is covariant with respect to its region // parameter yields an error when used in a contravariant way. // diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr index 45105e8714c..20615e6a3d7 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:35:30 + --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:25:30 | LL | fn use_<'short,'long>(c: S<'long, 'short>, | ---------------- diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs b/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs index caf6a86fc0b..cbdf62ecb61 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a type which is covariant with respect to its region // parameter yields an error when used in a contravariant way. // diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr index c883691c348..da8d2188191 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-variance-contravariant-use-covariant.rs:33:35 + --> $DIR/regions-variance-contravariant-use-covariant.rs:23:35 | LL | fn use_<'short,'long>(c: Contravariant<'short>, | --------------------- these two types are declared with different lifetimes... diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs b/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs index 60dc3d94a2e..9aa0c819271 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a type which is covariant with respect to its region // parameter yields an error when used in a contravariant way. // diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr b/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr index a448d26f81b..74a6aee2627 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-variance-covariant-use-contravariant.rs:33:32 + --> $DIR/regions-variance-covariant-use-contravariant.rs:23:32 | LL | fn use_<'short,'long>(c: Covariant<'long>, | ---------------- diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs b/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs index 96478fa5909..663b23b37d4 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that an invariant region parameter used in a contravariant way // yields an error. // diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr index 1b0cd8e646a..2332acdf832 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/regions-variance-invariant-use-contravariant.rs:30:32 + --> $DIR/regions-variance-invariant-use-contravariant.rs:20:32 | LL | fn use_<'short,'long>(c: Invariant<'long>, | ---------------- diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.rs b/src/test/ui/regions/regions-variance-invariant-use-covariant.rs index bd944a8b52c..07482e6fd19 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.rs +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a type which is invariant with respect to its region // parameter used in a covariant way yields an error. // diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr index 34111120a08..f1d1a14f52b 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr @@ -1,13 +1,13 @@ error[E0308]: mismatched types - --> $DIR/regions-variance-invariant-use-covariant.rs:27:33 + --> $DIR/regions-variance-invariant-use-covariant.rs:17:33 | LL | let _: Invariant<'static> = c; //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `Invariant<'static>` found type `Invariant<'b>` -note: the lifetime 'b as defined on the function body at 21:9... - --> $DIR/regions-variance-invariant-use-covariant.rs:21:9 +note: the lifetime 'b as defined on the function body at 11:9... + --> $DIR/regions-variance-invariant-use-covariant.rs:11:9 | LL | fn use_<'b>(c: Invariant<'b>) { | ^^ diff --git a/src/test/ui/regions/regions-wf-trait-object.rs b/src/test/ui/regions/regions-wf-trait-object.rs index 39b8482cfa3..61bab359f9a 100644 --- a/src/test/ui/regions/regions-wf-trait-object.rs +++ b/src/test/ui/regions/regions-wf-trait-object.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that the explicit lifetime bound (`'b`, in this example) must // outlive all the superbound from the trait (`'a`, in this example). diff --git a/src/test/ui/regions/regions-wf-trait-object.stderr b/src/test/ui/regions/regions-wf-trait-object.stderr index caaa902abbe..c2689577376 100644 --- a/src/test/ui/regions/regions-wf-trait-object.stderr +++ b/src/test/ui/regions/regions-wf-trait-object.stderr @@ -1,16 +1,16 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/regions-wf-trait-object.rs:17:5 + --> $DIR/regions-wf-trait-object.rs:7:5 | LL | x: Box+'b> //~ ERROR E0478 | ^^^^^^^^^^^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 16:15 - --> $DIR/regions-wf-trait-object.rs:16:15 +note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 6:15 + --> $DIR/regions-wf-trait-object.rs:6:15 | LL | struct Foo<'a,'b> { | ^^ -note: but lifetime parameter must outlive the lifetime 'a as defined on the struct at 16:12 - --> $DIR/regions-wf-trait-object.rs:16:12 +note: but lifetime parameter must outlive the lifetime 'a as defined on the struct at 6:12 + --> $DIR/regions-wf-trait-object.rs:6:12 | LL | struct Foo<'a,'b> { | ^^ diff --git a/src/test/ui/reject-specialized-drops-8142.rs b/src/test/ui/reject-specialized-drops-8142.rs index 1ea956bbd54..f047e16bc0b 100644 --- a/src/test/ui/reject-specialized-drops-8142.rs +++ b/src/test/ui/reject-specialized-drops-8142.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue 8142: Test that Drop impls cannot be specialized beyond the // predicates attached to the struct/enum definition itself. @@ -41,16 +31,16 @@ impl Drop for N<'static> { fn drop(&mut self) { } } // RE //~| expected type `N<'n>` //~| found type `N<'static>` -impl Drop for O { fn drop(&mut self) { } } // ACCEPT +impl Drop for O { fn drop(&mut self) { } } // ACCEPT impl Drop for P { fn drop(&mut self) { } } // REJECT //~^ ERROR Implementations of Drop cannot be specialized -impl Drop for Q { fn drop(&mut self) { } } // REJECT -//~^ ERROR The requirement `Adds_bnd: Bound` is added only by the Drop impl. +impl Drop for Q { fn drop(&mut self) { } } // REJECT +//~^ ERROR The requirement `AddsBnd: Bound` is added only by the Drop impl. -impl<'rbnd,Adds_rbnd:'rbnd> Drop for R { fn drop(&mut self) { } } // REJECT -//~^ ERROR The requirement `Adds_rbnd : 'rbnd` is added only by the Drop impl. +impl<'rbnd,AddsRBnd:'rbnd> Drop for R { fn drop(&mut self) { } } // REJECT +//~^ ERROR The requirement `AddsRBnd : 'rbnd` is added only by the Drop impl. impl Drop for S { fn drop(&mut self) { } } // ACCEPT diff --git a/src/test/ui/reject-specialized-drops-8142.stderr b/src/test/ui/reject-specialized-drops-8142.stderr index c0f1525a761..1782d3b3105 100644 --- a/src/test/ui/reject-specialized-drops-8142.stderr +++ b/src/test/ui/reject-specialized-drops-8142.stderr @@ -1,5 +1,5 @@ error[E0367]: The requirement `'adds_bnd : 'al` is added only by the Drop impl. - --> $DIR/reject-specialized-drops-8142.rs:29:1 + --> $DIR/reject-specialized-drops-8142.rs:19:1 | LL | / impl<'al,'adds_bnd:'al> Drop for K<'al,'adds_bnd> { // REJECT LL | | //~^ ERROR The requirement `'adds_bnd : 'al` is added only by the Drop impl. @@ -7,13 +7,13 @@ LL | | fn drop(&mut self) { } } | |____________________________^ | note: The same requirement must be part of the struct/enum definition - --> $DIR/reject-specialized-drops-8142.rs:15:1 + --> $DIR/reject-specialized-drops-8142.rs:5:1 | LL | struct K<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0367]: The requirement `'adds_bnd : 'al` is added only by the Drop impl. - --> $DIR/reject-specialized-drops-8142.rs:33:1 + --> $DIR/reject-specialized-drops-8142.rs:23:1 | LL | / impl<'al,'adds_bnd> Drop for L<'al,'adds_bnd> where 'adds_bnd:'al { // REJECT LL | | //~^ ERROR The requirement `'adds_bnd : 'al` is added only by the Drop impl. @@ -21,87 +21,87 @@ LL | | fn drop(&mut self) { } } | |____________________________^ | note: The same requirement must be part of the struct/enum definition - --> $DIR/reject-specialized-drops-8142.rs:16:1 + --> $DIR/reject-specialized-drops-8142.rs:6:1 | LL | struct L<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/reject-specialized-drops-8142.rs:39:1 + --> $DIR/reject-specialized-drops-8142.rs:29:1 | LL | impl Drop for N<'static> { fn drop(&mut self) { } } // REJECT | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `N<'n>` found type `N<'static>` -note: the lifetime 'n as defined on the struct at 18:10... - --> $DIR/reject-specialized-drops-8142.rs:18:10 +note: the lifetime 'n as defined on the struct at 8:10... + --> $DIR/reject-specialized-drops-8142.rs:8:10 | LL | struct N<'n> { x: &'n i8 } | ^^ = note: ...does not necessarily outlive the static lifetime error[E0366]: Implementations of Drop cannot be specialized - --> $DIR/reject-specialized-drops-8142.rs:46:1 + --> $DIR/reject-specialized-drops-8142.rs:36:1 | LL | impl Drop for P { fn drop(&mut self) { } } // REJECT | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: Use same sequence of generic type and region parameters that is on the struct/enum definition - --> $DIR/reject-specialized-drops-8142.rs:20:1 + --> $DIR/reject-specialized-drops-8142.rs:10:1 | LL | struct P { x: *const Tp } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0367]: The requirement `Adds_bnd: Bound` is added only by the Drop impl. - --> $DIR/reject-specialized-drops-8142.rs:49:1 +error[E0367]: The requirement `AddsBnd: Bound` is added only by the Drop impl. + --> $DIR/reject-specialized-drops-8142.rs:39:1 | -LL | impl Drop for Q { fn drop(&mut self) { } } // REJECT - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl Drop for Q { fn drop(&mut self) { } } // REJECT + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: The same requirement must be part of the struct/enum definition - --> $DIR/reject-specialized-drops-8142.rs:21:1 + --> $DIR/reject-specialized-drops-8142.rs:11:1 | LL | struct Q { x: *const Tq } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0367]: The requirement `Adds_rbnd : 'rbnd` is added only by the Drop impl. - --> $DIR/reject-specialized-drops-8142.rs:52:1 +error[E0367]: The requirement `AddsRBnd : 'rbnd` is added only by the Drop impl. + --> $DIR/reject-specialized-drops-8142.rs:42:1 | -LL | impl<'rbnd,Adds_rbnd:'rbnd> Drop for R { fn drop(&mut self) { } } // REJECT - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | impl<'rbnd,AddsRBnd:'rbnd> Drop for R { fn drop(&mut self) { } } // REJECT + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: The same requirement must be part of the struct/enum definition - --> $DIR/reject-specialized-drops-8142.rs:22:1 + --> $DIR/reject-specialized-drops-8142.rs:12:1 | LL | struct R { x: *const Tr } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0366]: Implementations of Drop cannot be specialized - --> $DIR/reject-specialized-drops-8142.rs:61:1 + --> $DIR/reject-specialized-drops-8142.rs:51:1 | LL | impl Drop for V { fn drop(&mut self) { } } // REJECT | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: Use same sequence of generic type and region parameters that is on the struct/enum definition - --> $DIR/reject-specialized-drops-8142.rs:26:1 + --> $DIR/reject-specialized-drops-8142.rs:16:1 | LL | struct V { x: *const Tva, y: *const Tvb } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'lw` due to conflicting requirements - --> $DIR/reject-specialized-drops-8142.rs:64:1 + --> $DIR/reject-specialized-drops-8142.rs:54:1 | LL | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'l1 as defined on the struct at 27:10... - --> $DIR/reject-specialized-drops-8142.rs:27:10 +note: first, the lifetime cannot outlive the lifetime 'l1 as defined on the struct at 17:10... + --> $DIR/reject-specialized-drops-8142.rs:17:10 | LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 } | ^^^ -note: ...but the lifetime must also be valid for the lifetime 'l2 as defined on the struct at 27:15... - --> $DIR/reject-specialized-drops-8142.rs:27:15 +note: ...but the lifetime must also be valid for the lifetime 'l2 as defined on the struct at 17:15... + --> $DIR/reject-specialized-drops-8142.rs:17:15 | LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 } | ^^^ diff --git a/src/test/ui/removing-extern-crate.fixed b/src/test/ui/removing-extern-crate.fixed index 90427b061b6..71728e8a731 100644 --- a/src/test/ui/removing-extern-crate.fixed +++ b/src/test/ui/removing-extern-crate.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // aux-build:removing-extern-crate.rs // run-rustfix diff --git a/src/test/ui/removing-extern-crate.rs b/src/test/ui/removing-extern-crate.rs index 9762db38a1c..b9cc1810e7c 100644 --- a/src/test/ui/removing-extern-crate.rs +++ b/src/test/ui/removing-extern-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // aux-build:removing-extern-crate.rs // run-rustfix diff --git a/src/test/ui/removing-extern-crate.stderr b/src/test/ui/removing-extern-crate.stderr index 758ec67d178..fbdcb158257 100644 --- a/src/test/ui/removing-extern-crate.stderr +++ b/src/test/ui/removing-extern-crate.stderr @@ -1,30 +1,30 @@ warning: unused extern crate - --> $DIR/removing-extern-crate.rs:19:1 + --> $DIR/removing-extern-crate.rs:9:1 | LL | extern crate removing_extern_crate as foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | note: lint level defined here - --> $DIR/removing-extern-crate.rs:16:9 + --> $DIR/removing-extern-crate.rs:6:9 | LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: #[warn(unused_extern_crates)] implied by #[warn(rust_2018_idioms)] warning: unused extern crate - --> $DIR/removing-extern-crate.rs:20:1 + --> $DIR/removing-extern-crate.rs:10:1 | LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ help: remove it warning: unused extern crate - --> $DIR/removing-extern-crate.rs:23:5 + --> $DIR/removing-extern-crate.rs:13:5 | LL | extern crate removing_extern_crate as foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it warning: unused extern crate - --> $DIR/removing-extern-crate.rs:24:5 + --> $DIR/removing-extern-crate.rs:14:5 | LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ help: remove it diff --git a/src/test/ui/repeat-to-run-dtor-twice.rs b/src/test/ui/repeat-to-run-dtor-twice.rs index 88441594a7e..80eff2acdd2 100644 --- a/src/test/ui/repeat-to-run-dtor-twice.rs +++ b/src/test/ui/repeat-to-run-dtor-twice.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that one can't run a destructor twice with the repeated vector // literal syntax. diff --git a/src/test/ui/repeat-to-run-dtor-twice.stderr b/src/test/ui/repeat-to-run-dtor-twice.stderr index 408c28af10e..5434f6cef54 100644 --- a/src/test/ui/repeat-to-run-dtor-twice.stderr +++ b/src/test/ui/repeat-to-run-dtor-twice.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Foo: std::marker::Copy` is not satisfied - --> $DIR/repeat-to-run-dtor-twice.rs:27:13 + --> $DIR/repeat-to-run-dtor-twice.rs:17:13 | LL | let _ = [ a; 5 ]; | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `Foo` diff --git a/src/test/ui/repeat_count.rs b/src/test/ui/repeat_count.rs index a716f3e29d4..c42dc8c9971 100644 --- a/src/test/ui/repeat_count.rs +++ b/src/test/ui/repeat_count.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #3645 fn main() { @@ -26,7 +16,7 @@ fn main() { //~^ ERROR mismatched types //~| expected type `usize` //~| found type `{float}` - //~| expected usize, found floating-point variable + //~| expected usize, found floating-point number let e = [0; "foo"]; //~^ ERROR mismatched types //~| expected type `usize` diff --git a/src/test/ui/repeat_count.stderr b/src/test/ui/repeat_count.stderr index 4852023ec8b..df3227bfcde 100644 --- a/src/test/ui/repeat_count.stderr +++ b/src/test/ui/repeat_count.stderr @@ -1,11 +1,11 @@ error[E0435]: attempt to use a non-constant value in a constant - --> $DIR/repeat_count.rs:15:17 + --> $DIR/repeat_count.rs:5:17 | LL | let a = [0; n]; | ^ non-constant value error[E0308]: mismatched types - --> $DIR/repeat_count.rs:17:17 + --> $DIR/repeat_count.rs:7:17 | LL | let b = [0; ()]; | ^^ expected usize, found () @@ -14,22 +14,22 @@ LL | let b = [0; ()]; found type `()` error[E0308]: mismatched types - --> $DIR/repeat_count.rs:22:17 + --> $DIR/repeat_count.rs:12:17 | LL | let c = [0; true]; | ^^^^ expected usize, found bool error[E0308]: mismatched types - --> $DIR/repeat_count.rs:25:17 + --> $DIR/repeat_count.rs:15:17 | LL | let d = [0; 0.5]; - | ^^^ expected usize, found floating-point variable + | ^^^ expected usize, found floating-point number | = note: expected type `usize` found type `{float}` error[E0308]: mismatched types - --> $DIR/repeat_count.rs:30:17 + --> $DIR/repeat_count.rs:20:17 | LL | let e = [0; "foo"]; | ^^^^^ expected usize, found reference @@ -38,19 +38,19 @@ LL | let e = [0; "foo"]; found type `&'static str` error[E0308]: mismatched types - --> $DIR/repeat_count.rs:35:17 + --> $DIR/repeat_count.rs:25:17 | LL | let f = [0; -4_isize]; | ^^^^^^^^ expected usize, found isize error[E0308]: mismatched types - --> $DIR/repeat_count.rs:38:23 + --> $DIR/repeat_count.rs:28:23 | LL | let f = [0_usize; -1_isize]; | ^^^^^^^^ expected usize, found isize error[E0308]: mismatched types - --> $DIR/repeat_count.rs:44:17 + --> $DIR/repeat_count.rs:34:17 | LL | let g = [0; G { g: () }]; | ^^^^^^^^^^^ expected usize, found struct `main::G` diff --git a/src/test/ui/repr.rs b/src/test/ui/repr.rs index 312f60202c6..9d844745f42 100644 --- a/src/test/ui/repr.rs +++ b/src/test/ui/repr.rs @@ -1,25 +1,13 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-pass - #[repr] -//^ WARN `repr` attribute must have a hint +//~^ ERROR attribute must be of the form struct _A {} #[repr = "B"] -//^ WARN `repr` attribute isn't configurable with a literal +//~^ ERROR attribute must be of the form struct _B {} #[repr = "C"] -//^ WARN `repr` attribute isn't configurable with a literal +//~^ ERROR attribute must be of the form struct _C {} #[repr(C)] diff --git a/src/test/ui/repr.stderr b/src/test/ui/repr.stderr index 7a99d8c0448..7ebfe083ddd 100644 --- a/src/test/ui/repr.stderr +++ b/src/test/ui/repr.stderr @@ -1,25 +1,20 @@ -warning: `repr` attribute must have a hint - --> $DIR/repr.rs:13:1 +error: attribute must be of the form `#[repr(C, packed, ...)]` + --> $DIR/repr.rs:1:1 | LL | #[repr] - | ^^^^^^^ needs a hint - | - = note: #[warn(bad_repr)] on by default - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit + | ^^^^^^^ -warning: `repr` attribute isn't configurable with a literal - --> $DIR/repr.rs:17:1 +error: attribute must be of the form `#[repr(C, packed, ...)]` + --> $DIR/repr.rs:5:1 | LL | #[repr = "B"] - | ^^^^^^^^^^^^^ needs a hint - | - = help: valid hints include `#[repr(C)]`, `#[repr(packed)]`, `#[repr(rust)]` and `#[repr(transparent)]` - = note: for more information, visit + | ^^^^^^^^^^^^^ -warning: `repr` attribute isn't configurable with a literal - --> $DIR/repr.rs:21:1 +error: attribute must be of the form `#[repr(C, packed, ...)]` + --> $DIR/repr.rs:9:1 | LL | #[repr = "C"] - | ^^^^^^^^^^^^^ help: give `repr` a hint: `#[repr(C)]` + | ^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors diff --git a/src/test/ui/repr/repr-align-assign.fixed b/src/test/ui/repr/repr-align-assign.fixed index 62147e7625e..2e1d9a2d326 100644 --- a/src/test/ui/repr/repr-align-assign.fixed +++ b/src/test/ui/repr/repr-align-assign.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![allow(dead_code)] diff --git a/src/test/ui/repr/repr-align-assign.rs b/src/test/ui/repr/repr-align-assign.rs index 3bc3b5c64ce..b8f7c15ded6 100644 --- a/src/test/ui/repr/repr-align-assign.rs +++ b/src/test/ui/repr/repr-align-assign.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![allow(dead_code)] diff --git a/src/test/ui/repr/repr-align-assign.stderr b/src/test/ui/repr/repr-align-assign.stderr index c325b6968fe..884a99357cd 100644 --- a/src/test/ui/repr/repr-align-assign.stderr +++ b/src/test/ui/repr/repr-align-assign.stderr @@ -1,11 +1,11 @@ error[E0693]: incorrect `repr(align)` attribute format - --> $DIR/repr-align-assign.rs:15:8 + --> $DIR/repr-align-assign.rs:5:8 | LL | #[repr(align=8)] //~ ERROR incorrect `repr(align)` attribute format | ^^^^^^^ help: use parentheses instead: `align(8)` error[E0693]: incorrect `repr(align)` attribute format - --> $DIR/repr-align-assign.rs:18:8 + --> $DIR/repr-align-assign.rs:8:8 | LL | #[repr(align="8")] //~ ERROR incorrect `repr(align)` attribute format | ^^^^^^^^^ help: use parentheses instead: `align(8)` diff --git a/src/test/ui/repr/repr-align.rs b/src/test/ui/repr/repr-align.rs index 9b0408de2a4..78ed6c7e1c4 100644 --- a/src/test/ui/repr/repr-align.rs +++ b/src/test/ui/repr/repr-align.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![allow(dead_code)] #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer diff --git a/src/test/ui/repr/repr-align.stderr b/src/test/ui/repr/repr-align.stderr index 2195789bd69..e8dbf74232b 100644 --- a/src/test/ui/repr/repr-align.stderr +++ b/src/test/ui/repr/repr-align.stderr @@ -1,17 +1,17 @@ error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer - --> $DIR/repr-align.rs:12:8 + --> $DIR/repr-align.rs:3:8 | LL | #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer | ^^^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: not a power of two - --> $DIR/repr-align.rs:15:8 + --> $DIR/repr-align.rs:6:8 | LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two | ^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: larger than 2^29 - --> $DIR/repr-align.rs:18:8 + --> $DIR/repr-align.rs:9:8 | LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29 | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/repr/repr-packed-contains-align.rs b/src/test/ui/repr/repr-packed-contains-align.rs index 27890333a51..a3610345173 100644 --- a/src/test/ui/repr/repr-packed-contains-align.rs +++ b/src/test/ui/repr/repr-packed-contains-align.rs @@ -1,12 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(untagged_unions)] #![allow(dead_code)] diff --git a/src/test/ui/repr/repr-packed-contains-align.stderr b/src/test/ui/repr/repr-packed-contains-align.stderr index 4558cf2e104..59f8b359d1f 100644 --- a/src/test/ui/repr/repr-packed-contains-align.stderr +++ b/src/test/ui/repr/repr-packed-contains-align.stderr @@ -1,29 +1,29 @@ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type - --> $DIR/repr-packed-contains-align.rs:28:1 + --> $DIR/repr-packed-contains-align.rs:19:1 | LL | struct SC(SA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | ^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type - --> $DIR/repr-packed-contains-align.rs:31:1 + --> $DIR/repr-packed-contains-align.rs:22:1 | LL | struct SD(SB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | ^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type - --> $DIR/repr-packed-contains-align.rs:34:1 + --> $DIR/repr-packed-contains-align.rs:25:1 | LL | struct SE(UA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | ^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type - --> $DIR/repr-packed-contains-align.rs:37:1 + --> $DIR/repr-packed-contains-align.rs:28:1 | LL | struct SF(UB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type | ^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type - --> $DIR/repr-packed-contains-align.rs:40:1 + --> $DIR/repr-packed-contains-align.rs:31:1 | LL | / union UC { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type LL | | a: UA @@ -31,7 +31,7 @@ LL | | } | |_^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type - --> $DIR/repr-packed-contains-align.rs:45:1 + --> $DIR/repr-packed-contains-align.rs:36:1 | LL | / union UD { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type LL | | n: UB @@ -39,7 +39,7 @@ LL | | } | |_^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type - --> $DIR/repr-packed-contains-align.rs:50:1 + --> $DIR/repr-packed-contains-align.rs:41:1 | LL | / union UE { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type LL | | a: SA @@ -47,7 +47,7 @@ LL | | } | |_^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type - --> $DIR/repr-packed-contains-align.rs:55:1 + --> $DIR/repr-packed-contains-align.rs:46:1 | LL | / union UF { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type LL | | n: SB diff --git a/src/test/ui/repr/repr-transparent-other-items.rs b/src/test/ui/repr/repr-transparent-other-items.rs index be6f3cf9eb2..392e7c9de4d 100644 --- a/src/test/ui/repr/repr-transparent-other-items.rs +++ b/src/test/ui/repr/repr-transparent-other-items.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // See also repr-transparent.rs #[repr(transparent)] //~ ERROR unsupported representation for zero-variant enum diff --git a/src/test/ui/repr/repr-transparent-other-items.stderr b/src/test/ui/repr/repr-transparent-other-items.stderr index 5a197899148..5b7f9650d0c 100644 --- a/src/test/ui/repr/repr-transparent-other-items.stderr +++ b/src/test/ui/repr/repr-transparent-other-items.stderr @@ -1,5 +1,5 @@ error[E0517]: attribute should be applied to struct - --> $DIR/repr-transparent-other-items.rs:13:8 + --> $DIR/repr-transparent-other-items.rs:3:8 | LL | #[repr(transparent)] //~ ERROR unsupported representation for zero-variant enum | ^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | enum Void {} //~| ERROR should be applied to struct | ------------ not a struct error[E0517]: attribute should be applied to struct - --> $DIR/repr-transparent-other-items.rs:16:8 + --> $DIR/repr-transparent-other-items.rs:6:8 | LL | #[repr(transparent)] //~ ERROR should be applied to struct | ^^^^^^^^^^^ @@ -18,7 +18,7 @@ LL | | } | |_- not a struct error[E0517]: attribute should be applied to struct - --> $DIR/repr-transparent-other-items.rs:22:8 + --> $DIR/repr-transparent-other-items.rs:12:8 | LL | #[repr(transparent)] //~ ERROR should be applied to struct | ^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | | } | |_- not a struct error[E0517]: attribute should be applied to struct - --> $DIR/repr-transparent-other-items.rs:28:8 + --> $DIR/repr-transparent-other-items.rs:18:8 | LL | #[repr(transparent)] //~ ERROR should be applied to struct | ^^^^^^^^^^^ @@ -40,7 +40,7 @@ LL | | } | |_- not a struct error[E0517]: attribute should be applied to struct - --> $DIR/repr-transparent-other-items.rs:34:8 + --> $DIR/repr-transparent-other-items.rs:24:8 | LL | #[repr(transparent)] //~ ERROR should be applied to struct | ^^^^^^^^^^^ @@ -48,7 +48,7 @@ LL | fn cant_repr_this() {} | ---------------------- not a struct error[E0517]: attribute should be applied to struct - --> $DIR/repr-transparent-other-items.rs:37:8 + --> $DIR/repr-transparent-other-items.rs:27:8 | LL | #[repr(transparent)] //~ ERROR should be applied to struct | ^^^^^^^^^^^ @@ -56,7 +56,7 @@ LL | static CANT_REPR_THIS: u32 = 0; | ------------------------------- not a struct error[E0084]: unsupported representation for zero-variant enum - --> $DIR/repr-transparent-other-items.rs:13:1 + --> $DIR/repr-transparent-other-items.rs:3:1 | LL | #[repr(transparent)] //~ ERROR unsupported representation for zero-variant enum | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/repr/repr-transparent-other-reprs.rs b/src/test/ui/repr/repr-transparent-other-reprs.rs index aed8a69f66e..e3671e7c493 100644 --- a/src/test/ui/repr/repr-transparent-other-reprs.rs +++ b/src/test/ui/repr/repr-transparent-other-reprs.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_align)] // See also repr-transparent.rs diff --git a/src/test/ui/repr/repr-transparent-other-reprs.stderr b/src/test/ui/repr/repr-transparent-other-reprs.stderr index c8f5dea3c12..1aafa436249 100644 --- a/src/test/ui/repr/repr-transparent-other-reprs.stderr +++ b/src/test/ui/repr/repr-transparent-other-reprs.stderr @@ -1,23 +1,23 @@ error[E0692]: transparent struct cannot have other repr hints - --> $DIR/repr-transparent-other-reprs.rs:15:8 + --> $DIR/repr-transparent-other-reprs.rs:5:8 | LL | #[repr(transparent, C)] //~ ERROR cannot have other repr | ^^^^^^^^^^^ ^ error[E0692]: transparent struct cannot have other repr hints - --> $DIR/repr-transparent-other-reprs.rs:20:8 + --> $DIR/repr-transparent-other-reprs.rs:10:8 | LL | #[repr(transparent, packed)] //~ ERROR cannot have other repr | ^^^^^^^^^^^ ^^^^^^ error[E0692]: transparent struct cannot have other repr hints - --> $DIR/repr-transparent-other-reprs.rs:23:8 + --> $DIR/repr-transparent-other-reprs.rs:13:8 | LL | #[repr(transparent, align(2))] //~ ERROR cannot have other repr | ^^^^^^^^^^^ ^^^^^^^^ error[E0692]: transparent struct cannot have other repr hints - --> $DIR/repr-transparent-other-reprs.rs:26:8 + --> $DIR/repr-transparent-other-reprs.rs:16:8 | LL | #[repr(transparent)] //~ ERROR cannot have other repr | ^^^^^^^^^^^ diff --git a/src/test/ui/repr/repr-transparent.rs b/src/test/ui/repr/repr-transparent.rs index f5b99af156e..66d39ff9bb5 100644 --- a/src/test/ui/repr/repr-transparent.rs +++ b/src/test/ui/repr/repr-transparent.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file tests repr(transparent)-related errors reported during typeck. Other errors // that are reported earlier and therefore preempt these are tested in: // - repr-transparent-other-reprs.rs diff --git a/src/test/ui/repr/repr-transparent.stderr b/src/test/ui/repr/repr-transparent.stderr index f7bfdbdc625..02bf2154fe5 100644 --- a/src/test/ui/repr/repr-transparent.stderr +++ b/src/test/ui/repr/repr-transparent.stderr @@ -1,5 +1,5 @@ error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 - --> $DIR/repr-transparent.rs:21:1 + --> $DIR/repr-transparent.rs:11:1 | LL | struct NoFields; //~ ERROR needs exactly one non-zero-sized field | ^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | struct NoFields; //~ ERROR needs exactly one non-zero-sized field = note: non-zero-sized field error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 - --> $DIR/repr-transparent.rs:24:1 + --> $DIR/repr-transparent.rs:14:1 | LL | struct ContainsOnlyZst(()); //~ ERROR needs exactly one non-zero-sized field | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | struct ContainsOnlyZst(()); //~ ERROR needs exactly one non-zero-sized fiel = note: non-zero-sized field error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 - --> $DIR/repr-transparent.rs:27:1 + --> $DIR/repr-transparent.rs:17:1 | LL | struct ContainsOnlyZstArray([bool; 0]); //~ ERROR needs exactly one non-zero-sized field | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | struct ContainsOnlyZstArray([bool; 0]); //~ ERROR needs exactly one non-zer = note: non-zero-sized field error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 - --> $DIR/repr-transparent.rs:30:1 + --> $DIR/repr-transparent.rs:20:1 | LL | struct ContainsMultipleZst(PhantomData<*const i32>, NoFields); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,37 +31,37 @@ LL | struct ContainsMultipleZst(PhantomData<*const i32>, NoFields); = note: non-zero-sized field error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 2 - --> $DIR/repr-transparent.rs:34:1 + --> $DIR/repr-transparent.rs:24:1 | LL | struct MultipleNonZst(u8, u8); //~ ERROR needs exactly one non-zero-sized field | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: non-zero-sized field - --> $DIR/repr-transparent.rs:34:23 + --> $DIR/repr-transparent.rs:24:23 | LL | struct MultipleNonZst(u8, u8); //~ ERROR needs exactly one non-zero-sized field | ^^ ^^ error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 2 - --> $DIR/repr-transparent.rs:40:1 + --> $DIR/repr-transparent.rs:30:1 | LL | pub struct StructWithProjection(f32, ::It); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: non-zero-sized field - --> $DIR/repr-transparent.rs:40:33 + --> $DIR/repr-transparent.rs:30:33 | LL | pub struct StructWithProjection(f32, ::It); | ^^^ ^^^^^^^^^^^^^^^^^^^ error[E0691]: zero-sized field in transparent struct has alignment larger than 1 - --> $DIR/repr-transparent.rs:44:32 + --> $DIR/repr-transparent.rs:34:32 | LL | struct NontrivialAlignZst(u32, [u16; 0]); //~ ERROR alignment larger than 1 | ^^^^^^^^ error[E0691]: zero-sized field in transparent struct has alignment larger than 1 - --> $DIR/repr-transparent.rs:50:24 + --> $DIR/repr-transparent.rs:40:24 | LL | struct GenericAlign(ZstAlign32, u32); //~ ERROR alignment larger than 1 | ^^^^^^^^^^^^^ diff --git a/src/test/ui/required-lang-item.rs b/src/test/ui/required-lang-item.rs index ce40702b3dc..ee3773675e0 100644 --- a/src/test/ui/required-lang-item.rs +++ b/src/test/ui/required-lang-item.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(lang_items, no_core)] #![no_core] diff --git a/src/test/ui/reserved/reserved-attr-on-macro.rs b/src/test/ui/reserved/reserved-attr-on-macro.rs index db8f82a70e1..96c63ba4db8 100644 --- a/src/test/ui/reserved/reserved-attr-on-macro.rs +++ b/src/test/ui/reserved/reserved-attr-on-macro.rs @@ -1,18 +1,9 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[rustc_attribute_should_be_reserved] //~ ERROR attributes with the prefix `rustc_` are reserved +#[rustc_attribute_should_be_reserved] +//~^ ERROR unless otherwise specified, attributes with the prefix `rustc_` are reserved macro_rules! foo { () => (()); } fn main() { - foo!(); + foo!(); //~ ERROR cannot determine resolution for the macro `foo` } diff --git a/src/test/ui/reserved/reserved-attr-on-macro.stderr b/src/test/ui/reserved/reserved-attr-on-macro.stderr index efcd1ec67d7..46d3478b628 100644 --- a/src/test/ui/reserved/reserved-attr-on-macro.stderr +++ b/src/test/ui/reserved/reserved-attr-on-macro.stderr @@ -1,11 +1,19 @@ error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642) - --> $DIR/reserved-attr-on-macro.rs:11:3 + --> $DIR/reserved-attr-on-macro.rs:1:3 | -LL | #[rustc_attribute_should_be_reserved] //~ ERROR attributes with the prefix `rustc_` are reserved +LL | #[rustc_attribute_should_be_reserved] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(rustc_attrs)] to the crate attributes to enable -error: aborting due to previous error +error: cannot determine resolution for the macro `foo` + --> $DIR/reserved-attr-on-macro.rs:8:5 + | +LL | foo!(); //~ ERROR cannot determine resolution for the macro `foo` + | ^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/reserved/reserved-become.rs b/src/test/ui/reserved/reserved-become.rs index bcda61e363d..2279a05e6b2 100644 --- a/src/test/ui/reserved/reserved-become.rs +++ b/src/test/ui/reserved/reserved-become.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let become = 0; //~^ ERROR expected pattern, found reserved keyword `become` diff --git a/src/test/ui/reserved/reserved-become.stderr b/src/test/ui/reserved/reserved-become.stderr index fa9a9601208..f9fe78e18b3 100644 --- a/src/test/ui/reserved/reserved-become.stderr +++ b/src/test/ui/reserved/reserved-become.stderr @@ -1,5 +1,5 @@ error: expected pattern, found reserved keyword `become` - --> $DIR/reserved-become.rs:12:9 + --> $DIR/reserved-become.rs:2:9 | LL | let become = 0; | ^^^^^^ expected pattern diff --git a/src/test/ui/resolve/auxiliary/issue-21221-3.rs b/src/test/ui/resolve/auxiliary/issue-21221-3.rs index fae0fe16a26..176c23180d9 100644 --- a/src/test/ui/resolve/auxiliary/issue-21221-3.rs +++ b/src/test/ui/resolve/auxiliary/issue-21221-3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // testing whether the lookup mechanism picks up types // defined in the outside crate diff --git a/src/test/ui/resolve/auxiliary/issue-21221-4.rs b/src/test/ui/resolve/auxiliary/issue-21221-4.rs index fffe060ee24..5e0d6cbdfef 100644 --- a/src/test/ui/resolve/auxiliary/issue-21221-4.rs +++ b/src/test/ui/resolve/auxiliary/issue-21221-4.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // testing whether the lookup mechanism picks up types // defined in the outside crate diff --git a/src/test/ui/resolve/auxiliary/issue_19452_aux.rs b/src/test/ui/resolve/auxiliary/issue_19452_aux.rs index 205566e4b1f..9c7bcec51df 100644 --- a/src/test/ui/resolve/auxiliary/issue_19452_aux.rs +++ b/src/test/ui/resolve/auxiliary/issue_19452_aux.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum Homura { Madoka { age: u32 } } diff --git a/src/test/ui/resolve/auxiliary/issue_3907.rs b/src/test/ui/resolve/auxiliary/issue_3907.rs index 6472c08c222..5dc502930ae 100644 --- a/src/test/ui/resolve/auxiliary/issue_3907.rs +++ b/src/test/ui/resolve/auxiliary/issue_3907.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo { fn bar(); } diff --git a/src/test/ui/resolve/auxiliary/namespaced_enums.rs b/src/test/ui/resolve/auxiliary/namespaced_enums.rs index 3bf39b788db..d3548c76cf2 100644 --- a/src/test/ui/resolve/auxiliary/namespaced_enums.rs +++ b/src/test/ui/resolve/auxiliary/namespaced_enums.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum Foo { A, B(isize), diff --git a/src/test/ui/resolve/auxiliary/privacy-struct-ctor.rs b/src/test/ui/resolve/auxiliary/privacy-struct-ctor.rs index 704b20c6e71..6d0bc728524 100644 --- a/src/test/ui/resolve/auxiliary/privacy-struct-ctor.rs +++ b/src/test/ui/resolve/auxiliary/privacy-struct-ctor.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod m { pub struct S(u8); diff --git a/src/test/ui/resolve/enums-are-namespaced-xc.rs b/src/test/ui/resolve/enums-are-namespaced-xc.rs index 4059aa5527e..4c660c27e3b 100644 --- a/src/test/ui/resolve/enums-are-namespaced-xc.rs +++ b/src/test/ui/resolve/enums-are-namespaced-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:namespaced_enums.rs extern crate namespaced_enums; diff --git a/src/test/ui/resolve/enums-are-namespaced-xc.stderr b/src/test/ui/resolve/enums-are-namespaced-xc.stderr index 4b1750a54dc..a0771ed9dca 100644 --- a/src/test/ui/resolve/enums-are-namespaced-xc.stderr +++ b/src/test/ui/resolve/enums-are-namespaced-xc.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `A` in module `namespaced_enums` - --> $DIR/enums-are-namespaced-xc.rs:15:31 + --> $DIR/enums-are-namespaced-xc.rs:5:31 | LL | let _ = namespaced_enums::A; | ^ not found in `namespaced_enums` @@ -9,7 +9,7 @@ LL | use namespaced_enums::Foo::A; | error[E0425]: cannot find function `B` in module `namespaced_enums` - --> $DIR/enums-are-namespaced-xc.rs:17:31 + --> $DIR/enums-are-namespaced-xc.rs:7:31 | LL | let _ = namespaced_enums::B(10); | ^ not found in `namespaced_enums` @@ -19,7 +19,7 @@ LL | use namespaced_enums::Foo::B; | error[E0422]: cannot find struct, variant or union type `C` in module `namespaced_enums` - --> $DIR/enums-are-namespaced-xc.rs:19:31 + --> $DIR/enums-are-namespaced-xc.rs:9:31 | LL | let _ = namespaced_enums::C { a: 10 }; | ^ not found in `namespaced_enums` diff --git a/src/test/ui/resolve/issue-14254.rs b/src/test/ui/resolve/issue-14254.rs index eab500de255..78add29ca0c 100644 --- a/src/test/ui/resolve/issue-14254.rs +++ b/src/test/ui/resolve/issue-14254.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn bar(&self); fn baz(&self) { } diff --git a/src/test/ui/resolve/issue-14254.stderr b/src/test/ui/resolve/issue-14254.stderr index 055cbb2d579..783b3addfc2 100644 --- a/src/test/ui/resolve/issue-14254.stderr +++ b/src/test/ui/resolve/issue-14254.stderr @@ -1,143 +1,143 @@ error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:29:9 + --> $DIR/issue-14254.rs:19:9 | LL | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `a` in this scope - --> $DIR/issue-14254.rs:31:9 + --> $DIR/issue-14254.rs:21:9 | LL | a; | ^ not found in this scope error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:38:9 + --> $DIR/issue-14254.rs:28:9 | LL | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `x` in this scope - --> $DIR/issue-14254.rs:40:9 + --> $DIR/issue-14254.rs:30:9 | LL | x; | ^ help: try: `self.x` error[E0425]: cannot find value `y` in this scope - --> $DIR/issue-14254.rs:42:9 + --> $DIR/issue-14254.rs:32:9 | LL | y; | ^ help: try: `self.y` error[E0425]: cannot find value `a` in this scope - --> $DIR/issue-14254.rs:44:9 + --> $DIR/issue-14254.rs:34:9 | LL | a; | ^ not found in this scope error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:46:9 + --> $DIR/issue-14254.rs:36:9 | LL | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find value `b` in this scope - --> $DIR/issue-14254.rs:48:9 + --> $DIR/issue-14254.rs:38:9 | LL | b; | ^ not found in this scope error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:55:9 + --> $DIR/issue-14254.rs:45:9 | LL | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `x` in this scope - --> $DIR/issue-14254.rs:57:9 + --> $DIR/issue-14254.rs:47:9 | LL | x; | ^ help: try: `self.x` error[E0425]: cannot find value `y` in this scope - --> $DIR/issue-14254.rs:59:9 + --> $DIR/issue-14254.rs:49:9 | LL | y; | ^ help: try: `self.y` error[E0425]: cannot find value `a` in this scope - --> $DIR/issue-14254.rs:61:9 + --> $DIR/issue-14254.rs:51:9 | LL | a; | ^ not found in this scope error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:63:9 + --> $DIR/issue-14254.rs:53:9 | LL | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find value `b` in this scope - --> $DIR/issue-14254.rs:65:9 + --> $DIR/issue-14254.rs:55:9 | LL | b; | ^ not found in this scope error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:72:9 + --> $DIR/issue-14254.rs:62:9 | LL | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:74:9 + --> $DIR/issue-14254.rs:64:9 | LL | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:81:9 + --> $DIR/issue-14254.rs:71:9 | LL | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:83:9 + --> $DIR/issue-14254.rs:73:9 | LL | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:90:9 + --> $DIR/issue-14254.rs:80:9 | LL | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:92:9 + --> $DIR/issue-14254.rs:82:9 | LL | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:99:9 + --> $DIR/issue-14254.rs:89:9 | LL | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:101:9 + --> $DIR/issue-14254.rs:91:9 | LL | bah; | ^^^ help: try: `Self::bah` error[E0425]: cannot find function `baz` in this scope - --> $DIR/issue-14254.rs:108:9 + --> $DIR/issue-14254.rs:98:9 | LL | baz(); | ^^^ help: try: `self.baz` error[E0425]: cannot find value `bah` in this scope - --> $DIR/issue-14254.rs:110:9 + --> $DIR/issue-14254.rs:100:9 | LL | bah; | ^^^ help: try: `Self::bah` diff --git a/src/test/ui/resolve/issue-16058.rs b/src/test/ui/resolve/issue-16058.rs index 6d9df46eed4..d41023e82c0 100644 --- a/src/test/ui/resolve/issue-16058.rs +++ b/src/test/ui/resolve/issue-16058.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub struct GslResult { pub val: f64, pub err: f64 diff --git a/src/test/ui/resolve/issue-16058.stderr b/src/test/ui/resolve/issue-16058.stderr index 0ea6da3b27d..9766f8f1412 100644 --- a/src/test/ui/resolve/issue-16058.stderr +++ b/src/test/ui/resolve/issue-16058.stderr @@ -1,5 +1,5 @@ error[E0574]: expected struct, variant or union type, found enum `Result` - --> $DIR/issue-16058.rs:19:9 + --> $DIR/issue-16058.rs:8:9 | LL | Result { | ^^^^^^ not a struct, variant or union type diff --git a/src/test/ui/resolve/issue-17518.rs b/src/test/ui/resolve/issue-17518.rs index 1efbd1a004f..edaebc8122c 100644 --- a/src/test/ui/resolve/issue-17518.rs +++ b/src/test/ui/resolve/issue-17518.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum SomeEnum { E } diff --git a/src/test/ui/resolve/issue-17518.stderr b/src/test/ui/resolve/issue-17518.stderr index 177b38aae7b..5d080d98944 100644 --- a/src/test/ui/resolve/issue-17518.stderr +++ b/src/test/ui/resolve/issue-17518.stderr @@ -1,5 +1,5 @@ error[E0422]: cannot find struct, variant or union type `E` in this scope - --> $DIR/issue-17518.rs:16:5 + --> $DIR/issue-17518.rs:6:5 | LL | E { name: "foobar" }; //~ ERROR cannot find struct, variant or union type `E` | ^ not found in this scope diff --git a/src/test/ui/resolve/issue-18252.rs b/src/test/ui/resolve/issue-18252.rs index 02c6643a920..894762115ab 100644 --- a/src/test/ui/resolve/issue-18252.rs +++ b/src/test/ui/resolve/issue-18252.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Foo { Variant { x: usize } } diff --git a/src/test/ui/resolve/issue-18252.stderr b/src/test/ui/resolve/issue-18252.stderr index 8de552ea089..293f290f82f 100644 --- a/src/test/ui/resolve/issue-18252.stderr +++ b/src/test/ui/resolve/issue-18252.stderr @@ -1,5 +1,5 @@ error[E0423]: expected function, found struct variant `Foo::Variant` - --> $DIR/issue-18252.rs:16:13 + --> $DIR/issue-18252.rs:6:13 | LL | let f = Foo::Variant(42); | ^^^^^^^^^^^^ did you mean `Foo::Variant { /* fields */ }`? diff --git a/src/test/ui/resolve/issue-19452.rs b/src/test/ui/resolve/issue-19452.rs index 080fb064c9f..5c58cabb3cd 100644 --- a/src/test/ui/resolve/issue-19452.rs +++ b/src/test/ui/resolve/issue-19452.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue_19452_aux.rs extern crate issue_19452_aux; diff --git a/src/test/ui/resolve/issue-19452.stderr b/src/test/ui/resolve/issue-19452.stderr index 0dbd4c85a37..ef96fffee92 100644 --- a/src/test/ui/resolve/issue-19452.stderr +++ b/src/test/ui/resolve/issue-19452.stderr @@ -1,11 +1,11 @@ error[E0423]: expected value, found struct variant `Homura::Madoka` - --> $DIR/issue-19452.rs:19:18 + --> $DIR/issue-19452.rs:9:18 | LL | let homura = Homura::Madoka; | ^^^^^^^^^^^^^^ did you mean `Homura::Madoka { /* fields */ }`? error[E0423]: expected value, found struct variant `issue_19452_aux::Homura::Madoka` - --> $DIR/issue-19452.rs:22:18 + --> $DIR/issue-19452.rs:12:18 | LL | let homura = issue_19452_aux::Homura::Madoka; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `issue_19452_aux::Homura::Madoka { /* fields */ }`? diff --git a/src/test/ui/resolve/issue-21221-1.rs b/src/test/ui/resolve/issue-21221-1.rs index d3c18d4c80a..b180624d2f4 100644 --- a/src/test/ui/resolve/issue-21221-1.rs +++ b/src/test/ui/resolve/issue-21221-1.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod mul1 { pub trait Mul {} } diff --git a/src/test/ui/resolve/issue-21221-1.stderr b/src/test/ui/resolve/issue-21221-1.stderr index 3edfa33d80a..925923f92be 100644 --- a/src/test/ui/resolve/issue-21221-1.stderr +++ b/src/test/ui/resolve/issue-21221-1.stderr @@ -1,5 +1,5 @@ error[E0405]: cannot find trait `Mul` in this scope - --> $DIR/issue-21221-1.rs:53:6 + --> $DIR/issue-21221-1.rs:43:6 | LL | impl Mul for Foo { | ^^^ not found in this scope @@ -13,7 +13,7 @@ LL | use std::ops::Mul; | error[E0412]: cannot find type `Mul` in this scope - --> $DIR/issue-21221-1.rs:68:16 + --> $DIR/issue-21221-1.rs:58:16 | LL | fn getMul() -> Mul { | ^^^ not found in this scope @@ -30,13 +30,13 @@ LL | use mul4::Mul; and 2 other candidates error[E0405]: cannot find trait `ThisTraitReallyDoesntExistInAnyModuleReally` in this scope - --> $DIR/issue-21221-1.rs:73:6 + --> $DIR/issue-21221-1.rs:63:6 | LL | impl ThisTraitReallyDoesntExistInAnyModuleReally for Foo { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0405]: cannot find trait `Div` in this scope - --> $DIR/issue-21221-1.rs:78:6 + --> $DIR/issue-21221-1.rs:68:6 | LL | impl Div for Foo { | ^^^ not found in this scope diff --git a/src/test/ui/resolve/issue-21221-2.rs b/src/test/ui/resolve/issue-21221-2.rs index 361e8caf744..dc13e46cb48 100644 --- a/src/test/ui/resolve/issue-21221-2.rs +++ b/src/test/ui/resolve/issue-21221-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub mod foo { pub mod bar { // note: trait T is not public, but being in the current diff --git a/src/test/ui/resolve/issue-21221-2.stderr b/src/test/ui/resolve/issue-21221-2.stderr index e11fe9ac4cf..23d4015ca54 100644 --- a/src/test/ui/resolve/issue-21221-2.stderr +++ b/src/test/ui/resolve/issue-21221-2.stderr @@ -1,5 +1,5 @@ error[E0405]: cannot find trait `T` in this scope - --> $DIR/issue-21221-2.rs:28:6 + --> $DIR/issue-21221-2.rs:18:6 | LL | impl T for Foo { } | ^ not found in this scope diff --git a/src/test/ui/resolve/issue-21221-3.rs b/src/test/ui/resolve/issue-21221-3.rs index a93330b2865..f0c0a9fd61a 100644 --- a/src/test/ui/resolve/issue-21221-3.rs +++ b/src/test/ui/resolve/issue-21221-3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // testing whether the lookup mechanism picks up types // defined in the outside crate diff --git a/src/test/ui/resolve/issue-21221-3.stderr b/src/test/ui/resolve/issue-21221-3.stderr index f406cd6e35f..09cfed96bed 100644 --- a/src/test/ui/resolve/issue-21221-3.stderr +++ b/src/test/ui/resolve/issue-21221-3.stderr @@ -1,5 +1,5 @@ error[E0405]: cannot find trait `OuterTrait` in this scope - --> $DIR/issue-21221-3.rs:25:6 + --> $DIR/issue-21221-3.rs:15:6 | LL | impl OuterTrait for Foo {} | ^^^^^^^^^^ not found in this scope diff --git a/src/test/ui/resolve/issue-21221-4.rs b/src/test/ui/resolve/issue-21221-4.rs index ec6ad2a4829..88d5bd06ca5 100644 --- a/src/test/ui/resolve/issue-21221-4.rs +++ b/src/test/ui/resolve/issue-21221-4.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // testing whether the lookup mechanism picks up types // defined in the outside crate diff --git a/src/test/ui/resolve/issue-21221-4.stderr b/src/test/ui/resolve/issue-21221-4.stderr index c0a7f1734f4..68989a30e67 100644 --- a/src/test/ui/resolve/issue-21221-4.stderr +++ b/src/test/ui/resolve/issue-21221-4.stderr @@ -1,5 +1,5 @@ error[E0405]: cannot find trait `T` in this scope - --> $DIR/issue-21221-4.rs:20:6 + --> $DIR/issue-21221-4.rs:10:6 | LL | impl T for Foo {} | ^ not found in this scope diff --git a/src/test/ui/resolve/issue-22692.rs b/src/test/ui/resolve/issue-22692.rs index 06648c59953..1d8f442221d 100644 --- a/src/test/ui/resolve/issue-22692.rs +++ b/src/test/ui/resolve/issue-22692.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { - let _ = String.new(); + let _ = String.new(); //~ ERROR expected value, found struct `String` } diff --git a/src/test/ui/resolve/issue-22692.stderr b/src/test/ui/resolve/issue-22692.stderr index ecdd4ff855f..1c8d959d60d 100644 --- a/src/test/ui/resolve/issue-22692.stderr +++ b/src/test/ui/resolve/issue-22692.stderr @@ -1,7 +1,7 @@ error[E0423]: expected value, found struct `String` - --> $DIR/issue-22692.rs:12:13 + --> $DIR/issue-22692.rs:2:13 | -LL | let _ = String.new(); +LL | let _ = String.new(); //~ ERROR expected value, found struct `String` | ^^^^^^---- | | | help: use `::` to access an associated function: `String::new` diff --git a/src/test/ui/resolve/issue-23305.rs b/src/test/ui/resolve/issue-23305.rs index 5ae4ce1f7ee..af335acd41b 100644 --- a/src/test/ui/resolve/issue-23305.rs +++ b/src/test/ui/resolve/issue-23305.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait ToNbt { fn new(val: T) -> Self; } diff --git a/src/test/ui/resolve/issue-23305.stderr b/src/test/ui/resolve/issue-23305.stderr index d25a072fe0a..1da56ad05d2 100644 --- a/src/test/ui/resolve/issue-23305.stderr +++ b/src/test/ui/resolve/issue-23305.stderr @@ -1,10 +1,15 @@ -error[E0391]: cycle detected when processing `` - --> $DIR/issue-23305.rs:15:12 +error[E0391]: cycle detected when processing `` + --> $DIR/issue-23305.rs:5:12 | LL | impl ToNbt {} | ^^^^ | - = note: ...which again requires processing ``, completing the cycle + = note: ...which again requires processing ``, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/issue-23305.rs:1:1 + | +LL | pub trait ToNbt { + | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/resolve/issue-2356.rs b/src/test/ui/resolve/issue-2356.rs index 9505e490197..f7b2dd13dcb 100644 --- a/src/test/ui/resolve/issue-2356.rs +++ b/src/test/ui/resolve/issue-2356.rs @@ -1,18 +1,8 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Groom { fn shave(other: usize); } -pub struct cat { +pub struct Cat { whiskers: isize, } @@ -29,14 +19,14 @@ impl MaybeDog { } } -impl Clone for cat { +impl Clone for Cat { fn clone(&self) -> Self { clone(); //~^ ERROR cannot find function `clone` loop {} } } -impl Default for cat { +impl Default for Cat { fn default() -> Self { default(); //~^ ERROR cannot find function `default` @@ -44,7 +34,7 @@ impl Default for cat { } } -impl Groom for cat { +impl Groom for Cat { fn shave(other: usize) { whiskers -= other; //~^ ERROR cannot find value `whiskers` @@ -55,7 +45,7 @@ impl Groom for cat { } } -impl cat { +impl Cat { fn static_method() {} fn purr_louder() { @@ -70,7 +60,7 @@ impl cat { } } -impl cat { +impl Cat { fn meow() { if self.whiskers > 3 { //~^ ERROR expected value, found module `self` diff --git a/src/test/ui/resolve/issue-2356.stderr b/src/test/ui/resolve/issue-2356.stderr index 8b261f76b89..fb4acaa141e 100644 --- a/src/test/ui/resolve/issue-2356.stderr +++ b/src/test/ui/resolve/issue-2356.stderr @@ -1,23 +1,23 @@ error[E0425]: cannot find function `shave` in this scope - --> $DIR/issue-2356.rs:27:5 + --> $DIR/issue-2356.rs:17:5 | LL | shave(); | ^^^^^ not found in this scope error[E0425]: cannot find function `clone` in this scope - --> $DIR/issue-2356.rs:34:5 + --> $DIR/issue-2356.rs:24:5 | LL | clone(); | ^^^^^ help: try: `self.clone` error[E0425]: cannot find function `default` in this scope - --> $DIR/issue-2356.rs:41:5 + --> $DIR/issue-2356.rs:31:5 | LL | default(); | ^^^^^^^ help: try: `Self::default` error[E0425]: cannot find value `whiskers` in this scope - --> $DIR/issue-2356.rs:49:5 + --> $DIR/issue-2356.rs:39:5 | LL | whiskers -= other; | ^^^^^^^^ @@ -26,67 +26,67 @@ LL | whiskers -= other; | help: try: `self.whiskers` error[E0425]: cannot find function `shave` in this scope - --> $DIR/issue-2356.rs:51:5 + --> $DIR/issue-2356.rs:41:5 | LL | shave(4); | ^^^^^ help: try: `Self::shave` error[E0425]: cannot find function `purr` in this scope - --> $DIR/issue-2356.rs:53:5 + --> $DIR/issue-2356.rs:43:5 | LL | purr(); | ^^^^ not found in this scope error[E0425]: cannot find function `static_method` in this scope - --> $DIR/issue-2356.rs:62:9 + --> $DIR/issue-2356.rs:52:9 | LL | static_method(); | ^^^^^^^^^^^^^ not found in this scope error[E0425]: cannot find function `purr` in this scope - --> $DIR/issue-2356.rs:64:9 + --> $DIR/issue-2356.rs:54:9 | LL | purr(); | ^^^^ not found in this scope error[E0425]: cannot find function `purr` in this scope - --> $DIR/issue-2356.rs:66:9 + --> $DIR/issue-2356.rs:56:9 | LL | purr(); | ^^^^ not found in this scope error[E0425]: cannot find function `purr` in this scope - --> $DIR/issue-2356.rs:68:9 + --> $DIR/issue-2356.rs:58:9 | LL | purr(); | ^^^^ not found in this scope error[E0424]: expected value, found module `self` - --> $DIR/issue-2356.rs:75:8 + --> $DIR/issue-2356.rs:65:8 | LL | if self.whiskers > 3 { | ^^^^ `self` value is a keyword only available in methods with `self` parameter error[E0425]: cannot find function `grow_older` in this scope - --> $DIR/issue-2356.rs:82:5 + --> $DIR/issue-2356.rs:72:5 | LL | grow_older(); | ^^^^^^^^^^ not found in this scope error[E0425]: cannot find function `shave` in this scope - --> $DIR/issue-2356.rs:84:5 + --> $DIR/issue-2356.rs:74:5 | LL | shave(); | ^^^^^ not found in this scope error[E0425]: cannot find value `whiskers` in this scope - --> $DIR/issue-2356.rs:89:5 + --> $DIR/issue-2356.rs:79:5 | LL | whiskers = 0; | ^^^^^^^^ help: try: `self.whiskers` error[E0425]: cannot find value `whiskers` in this scope - --> $DIR/issue-2356.rs:94:5 + --> $DIR/issue-2356.rs:84:5 | LL | whiskers = 4; | ^^^^^^^^ @@ -95,13 +95,13 @@ LL | whiskers = 4; | help: try: `self.whiskers` error[E0425]: cannot find function `purr_louder` in this scope - --> $DIR/issue-2356.rs:96:5 + --> $DIR/issue-2356.rs:86:5 | LL | purr_louder(); | ^^^^^^^^^^^ not found in this scope error[E0424]: expected value, found module `self` - --> $DIR/issue-2356.rs:102:5 + --> $DIR/issue-2356.rs:92:5 | LL | self += 1; | ^^^^ `self` value is a keyword only available in methods with `self` parameter diff --git a/src/test/ui/resolve/issue-24968.rs b/src/test/ui/resolve/issue-24968.rs index 0bd08f89764..916b48205dc 100644 --- a/src/test/ui/resolve/issue-24968.rs +++ b/src/test/ui/resolve/issue-24968.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(_: Self) { //~^ ERROR cannot find type `Self` } diff --git a/src/test/ui/resolve/issue-24968.stderr b/src/test/ui/resolve/issue-24968.stderr index 9a1d5ea170e..c891952c42b 100644 --- a/src/test/ui/resolve/issue-24968.stderr +++ b/src/test/ui/resolve/issue-24968.stderr @@ -1,8 +1,8 @@ error[E0411]: cannot find type `Self` in this scope - --> $DIR/issue-24968.rs:11:11 + --> $DIR/issue-24968.rs:1:11 | LL | fn foo(_: Self) { - | ^^^^ `Self` is only available in traits and impls + | ^^^^ `Self` is only available in impls, traits, and type definitions error: aborting due to previous error diff --git a/src/test/ui/resolve/issue-33876.rs b/src/test/ui/resolve/issue-33876.rs index a97cc5e4101..dd31fc231cf 100644 --- a/src/test/ui/resolve/issue-33876.rs +++ b/src/test/ui/resolve/issue-33876.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::any::Any; struct Foo; diff --git a/src/test/ui/resolve/issue-33876.stderr b/src/test/ui/resolve/issue-33876.stderr index 631a9f6f724..fb61abc9505 100644 --- a/src/test/ui/resolve/issue-33876.stderr +++ b/src/test/ui/resolve/issue-33876.stderr @@ -1,5 +1,5 @@ error[E0423]: expected value, found trait `Bar` - --> $DIR/issue-33876.rs:20:22 + --> $DIR/issue-33876.rs:10:22 | LL | let any: &Any = &Bar; //~ ERROR expected value, found trait `Bar` | ^^^ not a value diff --git a/src/test/ui/resolve/issue-3907-2.rs b/src/test/ui/resolve/issue-3907-2.rs index 130647966f2..89e10ca4f2c 100644 --- a/src/test/ui/resolve/issue-3907-2.rs +++ b/src/test/ui/resolve/issue-3907-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue_3907.rs extern crate issue_3907; diff --git a/src/test/ui/resolve/issue-3907-2.stderr b/src/test/ui/resolve/issue-3907-2.stderr index 567fd31b09c..4fce898dfa9 100644 --- a/src/test/ui/resolve/issue-3907-2.stderr +++ b/src/test/ui/resolve/issue-3907-2.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `issue_3907::Foo` cannot be made into an object - --> $DIR/issue-3907-2.rs:20:1 + --> $DIR/issue-3907-2.rs:10:1 | LL | fn bar(_x: Foo) {} | ^^^^^^^^^^^^^^^ the trait `issue_3907::Foo` cannot be made into an object diff --git a/src/test/ui/resolve/issue-3907.rs b/src/test/ui/resolve/issue-3907.rs index 0e54e68df0d..a76c3134c0c 100644 --- a/src/test/ui/resolve/issue-3907.rs +++ b/src/test/ui/resolve/issue-3907.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:issue_3907.rs extern crate issue_3907; diff --git a/src/test/ui/resolve/issue-3907.stderr b/src/test/ui/resolve/issue-3907.stderr index 3e330f9de65..55bd555676a 100644 --- a/src/test/ui/resolve/issue-3907.stderr +++ b/src/test/ui/resolve/issue-3907.stderr @@ -1,5 +1,5 @@ error[E0404]: expected trait, found type alias `Foo` - --> $DIR/issue-3907.rs:20:6 + --> $DIR/issue-3907.rs:10:6 | LL | impl Foo for S { //~ ERROR expected trait, found type alias `Foo` | ^^^ type aliases cannot be used as traits diff --git a/src/test/ui/resolve/issue-39226.rs b/src/test/ui/resolve/issue-39226.rs index 9d7291c4059..0f784f02b41 100644 --- a/src/test/ui/resolve/issue-39226.rs +++ b/src/test/ui/resolve/issue-39226.rs @@ -1,12 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. struct Handle {} struct Something { diff --git a/src/test/ui/resolve/issue-39226.stderr b/src/test/ui/resolve/issue-39226.stderr index 089fb9fa660..c97fb4db6be 100644 --- a/src/test/ui/resolve/issue-39226.stderr +++ b/src/test/ui/resolve/issue-39226.stderr @@ -1,11 +1,11 @@ error[E0423]: expected value, found struct `Handle` - --> $DIR/issue-39226.rs:20:17 + --> $DIR/issue-39226.rs:11:17 | LL | handle: Handle | ^^^^^^ | | - | did you mean `handle`? | did you mean `Handle { /* fields */ }`? + | help: a local variable with a similar name exists: `handle` error: aborting due to previous error diff --git a/src/test/ui/resolve/issue-5035-2.rs b/src/test/ui/resolve/issue-5035-2.rs index 5e465ca18f4..f88a2375a43 100644 --- a/src/test/ui/resolve/issue-5035-2.rs +++ b/src/test/ui/resolve/issue-5035-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait I {} type K = I+'static; diff --git a/src/test/ui/resolve/issue-5035-2.stderr b/src/test/ui/resolve/issue-5035-2.stderr index 9e7fca0508e..89eb3d97ce0 100644 --- a/src/test/ui/resolve/issue-5035-2.stderr +++ b/src/test/ui/resolve/issue-5035-2.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `(dyn I + 'static)` cannot be known at compilation time - --> $DIR/issue-5035-2.rs:14:8 + --> $DIR/issue-5035-2.rs:4:8 | LL | fn foo(_x: K) {} | ^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn I + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/resolve/issue-5035.rs b/src/test/ui/resolve/issue-5035.rs index e9b50dddd30..c00567a75b7 100644 --- a/src/test/ui/resolve/issue-5035.rs +++ b/src/test/ui/resolve/issue-5035.rs @@ -1,19 +1,9 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait I {} type K = I; impl K for isize {} //~ ERROR expected trait, found type alias `K` use ImportError; //~ ERROR unresolved import `ImportError` [E0432] //~^ no `ImportError` in the root -impl ImportError for () {} // check that this is not an additional error (c.f. #35142) +impl ImportError for () {} // check that this is not an additional error (cf. issue #35142) fn main() {} diff --git a/src/test/ui/resolve/issue-5035.stderr b/src/test/ui/resolve/issue-5035.stderr index 0acc5c8a93e..57ad5f22f4c 100644 --- a/src/test/ui/resolve/issue-5035.stderr +++ b/src/test/ui/resolve/issue-5035.stderr @@ -1,17 +1,17 @@ error[E0432]: unresolved import `ImportError` - --> $DIR/issue-5035.rs:15:5 + --> $DIR/issue-5035.rs:5:5 | LL | use ImportError; //~ ERROR unresolved import `ImportError` [E0432] | ^^^^^^^^^^^ no `ImportError` in the root error[E0404]: expected trait, found type alias `K` - --> $DIR/issue-5035.rs:13:6 + --> $DIR/issue-5035.rs:3:6 | LL | impl K for isize {} //~ ERROR expected trait, found type alias `K` | ^ | | - | did you mean `I`? | type aliases cannot be used as traits + | help: a trait with a similar name exists: `I` | = note: did you mean to use a trait alias? diff --git a/src/test/ui/resolve/issue-54379.rs b/src/test/ui/resolve/issue-54379.rs index 24aa758ea6c..a48f66bf0fd 100644 --- a/src/test/ui/resolve/issue-54379.rs +++ b/src/test/ui/resolve/issue-54379.rs @@ -1,12 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. struct MyStruct { pub s1: Option, } @@ -15,7 +6,9 @@ fn main() { let thing = MyStruct { s1: None }; match thing { - MyStruct { .., Some(_) } => {}, + MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` + //~^ ERROR expected `,` + //~| ERROR expected `}`, found `,` _ => {} } } diff --git a/src/test/ui/resolve/issue-54379.stderr b/src/test/ui/resolve/issue-54379.stderr index d1d693a3817..9dbab6917c7 100644 --- a/src/test/ui/resolve/issue-54379.stderr +++ b/src/test/ui/resolve/issue-54379.stderr @@ -1,22 +1,22 @@ error: expected `}`, found `,` - --> $DIR/issue-54379.rs:18:22 + --> $DIR/issue-54379.rs:9:22 | -LL | MyStruct { .., Some(_) } => {}, +LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` | --^ | | | | | expected `}` | `..` must be at the end and cannot have a trailing comma error: expected `,` - --> $DIR/issue-54379.rs:18:24 + --> $DIR/issue-54379.rs:9:24 | -LL | MyStruct { .., Some(_) } => {}, +LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` | ^^^^ error[E0027]: pattern does not mention field `s1` - --> $DIR/issue-54379.rs:18:9 + --> $DIR/issue-54379.rs:9:9 | -LL | MyStruct { .., Some(_) } => {}, +LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` | ^^^^^^^^^^^^^^^^^^^^^^^^ missing field `s1` error: aborting due to 3 previous errors diff --git a/src/test/ui/resolve/issue-57523.rs b/src/test/ui/resolve/issue-57523.rs new file mode 100644 index 00000000000..c2a2f282542 --- /dev/null +++ b/src/test/ui/resolve/issue-57523.rs @@ -0,0 +1,21 @@ +// compile-pass + +struct S(u8); + +impl S { + fn method1() -> Self { + Self(0) + } +} + +macro_rules! define_method { () => { + impl S { + fn method2() -> Self { + Self(0) // OK + } + } +}} + +define_method!(); + +fn main() {} diff --git a/src/test/ui/resolve/issue-6702.rs b/src/test/ui/resolve/issue-6702.rs index 8c5897d1d59..6469c7ec29f 100644 --- a/src/test/ui/resolve/issue-6702.rs +++ b/src/test/ui/resolve/issue-6702.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Monster { damage: isize } diff --git a/src/test/ui/resolve/issue-6702.stderr b/src/test/ui/resolve/issue-6702.stderr index 6f2312afe4f..906ac2808aa 100644 --- a/src/test/ui/resolve/issue-6702.stderr +++ b/src/test/ui/resolve/issue-6702.stderr @@ -1,5 +1,5 @@ error[E0423]: expected function, found struct `Monster` - --> $DIR/issue-6702.rs:17:14 + --> $DIR/issue-6702.rs:7:14 | LL | let _m = Monster(); //~ ERROR expected function, found struct `Monster` | ^^^^^^^ did you mean `Monster { /* fields */ }`? diff --git a/src/test/ui/resolve/levenshtein.rs b/src/test/ui/resolve/levenshtein.rs index af27629385d..a6f47162568 100644 --- a/src/test/ui/resolve/levenshtein.rs +++ b/src/test/ui/resolve/levenshtein.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const MAX_ITEM: usize = 10; fn foo_bar() {} diff --git a/src/test/ui/resolve/levenshtein.stderr b/src/test/ui/resolve/levenshtein.stderr index bb3caf342bf..cddfe4e7ff5 100644 --- a/src/test/ui/resolve/levenshtein.stderr +++ b/src/test/ui/resolve/levenshtein.stderr @@ -1,50 +1,50 @@ error[E0412]: cannot find type `esize` in this scope - --> $DIR/levenshtein.rs:15:11 + --> $DIR/levenshtein.rs:5:11 | LL | fn foo(c: esize) {} // Misspelled primitive type name. - | ^^^^^ did you mean `isize`? + | ^^^^^ help: a primitive type with a similar name exists: `isize` error[E0412]: cannot find type `Baz` in this scope - --> $DIR/levenshtein.rs:20:10 + --> $DIR/levenshtein.rs:10:10 | LL | type A = Baz; // Misspelled type name. - | ^^^ did you mean `Bar`? + | ^^^ help: an enum with a similar name exists: `Bar` error[E0412]: cannot find type `Opiton` in this scope - --> $DIR/levenshtein.rs:22:10 + --> $DIR/levenshtein.rs:12:10 | LL | type B = Opiton; // Misspelled type name from the prelude. - | ^^^^^^ did you mean `Option`? + | ^^^^^^ help: an enum with a similar name exists: `Option` error[E0412]: cannot find type `Baz` in this scope - --> $DIR/levenshtein.rs:26:14 + --> $DIR/levenshtein.rs:16:14 | LL | type A = Baz; // No suggestion here, Bar is not visible | ^^^ not found in this scope error[E0425]: cannot find value `MAXITEM` in this scope - --> $DIR/levenshtein.rs:34:20 + --> $DIR/levenshtein.rs:24:20 | LL | let v = [0u32; MAXITEM]; // Misspelled constant name. - | ^^^^^^^ did you mean `MAX_ITEM`? + | ^^^^^^^ help: a constant with a similar name exists: `MAX_ITEM` error[E0425]: cannot find function `foobar` in this scope - --> $DIR/levenshtein.rs:36:5 + --> $DIR/levenshtein.rs:26:5 | LL | foobar(); // Misspelled function name. - | ^^^^^^ did you mean `foo_bar`? + | ^^^^^^ help: a function with a similar name exists: `foo_bar` error[E0412]: cannot find type `first` in module `m` - --> $DIR/levenshtein.rs:38:15 + --> $DIR/levenshtein.rs:28:15 | LL | let b: m::first = m::second; // Misspelled item in module. - | ^^^^^ did you mean `First`? + | ^^^^^ help: a struct with a similar name exists: `First` error[E0425]: cannot find value `second` in module `m` - --> $DIR/levenshtein.rs:38:26 + --> $DIR/levenshtein.rs:28:26 | LL | let b: m::first = m::second; // Misspelled item in module. - | ^^^^^^ did you mean `Second`? + | ^^^^^^ help: a unit struct with a similar name exists: `Second` error: aborting due to 8 previous errors diff --git a/src/test/ui/resolve/name-clash-nullary.rs b/src/test/ui/resolve/name-clash-nullary.rs index adf52c6d8e6..b5f5e121492 100644 --- a/src/test/ui/resolve/name-clash-nullary.rs +++ b/src/test/ui/resolve/name-clash-nullary.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let None: isize = 42; //~ ERROR mismatched types } diff --git a/src/test/ui/resolve/name-clash-nullary.stderr b/src/test/ui/resolve/name-clash-nullary.stderr index 862ad270502..5bb9371da6d 100644 --- a/src/test/ui/resolve/name-clash-nullary.stderr +++ b/src/test/ui/resolve/name-clash-nullary.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/name-clash-nullary.rs:12:7 + --> $DIR/name-clash-nullary.rs:2:7 | LL | let None: isize = 42; //~ ERROR mismatched types | ^^^^ expected isize, found enum `std::option::Option` diff --git a/src/test/ui/resolve/privacy-enum-ctor.rs b/src/test/ui/resolve/privacy-enum-ctor.rs index 08480a0e1fa..f0d2cf8c04e 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.rs +++ b/src/test/ui/resolve/privacy-enum-ctor.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod m { pub enum E { Fn(u8), diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index 01e6488de53..01f0941282e 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -1,5 +1,5 @@ error[E0423]: expected value, found enum `n::Z` - --> $DIR/privacy-enum-ctor.rs:33:9 + --> $DIR/privacy-enum-ctor.rs:23:9 | LL | n::Z; | ^^^^ @@ -10,10 +10,10 @@ LL | n::Z; - `m::Z::Unit` error[E0423]: expected value, found enum `Z` - --> $DIR/privacy-enum-ctor.rs:35:9 + --> $DIR/privacy-enum-ctor.rs:25:9 | LL | Z; - | ^ did you mean `f`? + | ^ help: a function with a similar name exists: `f` | = note: did you mean to use one of the following variants? - `m::Z::Fn` @@ -21,23 +21,25 @@ LL | Z; - `m::Z::Unit` error[E0423]: expected value, found struct variant `Z::Struct` - --> $DIR/privacy-enum-ctor.rs:39:20 + --> $DIR/privacy-enum-ctor.rs:29:20 | LL | let _: Z = Z::Struct; | ^^^^^^^^^ did you mean `Z::Struct { /* fields */ }`? error[E0423]: expected value, found enum `m::E` - --> $DIR/privacy-enum-ctor.rs:51:16 + --> $DIR/privacy-enum-ctor.rs:41:16 | LL | let _: E = m::E; - | ^^^- - | | - | did you mean `f`? + | ^^^^ | = note: did you mean to use one of the following variants? - `E::Fn` - `E::Struct` - `E::Unit` +help: a function with a similar name exists + | +LL | let _: E = m::f; + | ^ help: possible better candidates are found in other modules, you can import them into scope | LL | use std::f32::consts::E; @@ -46,13 +48,13 @@ LL | use std::f64::consts::E; | error[E0423]: expected value, found struct variant `m::E::Struct` - --> $DIR/privacy-enum-ctor.rs:55:16 + --> $DIR/privacy-enum-ctor.rs:45:16 | LL | let _: E = m::E::Struct; | ^^^^^^^^^^^^ did you mean `m::E::Struct { /* fields */ }`? error[E0423]: expected value, found enum `E` - --> $DIR/privacy-enum-ctor.rs:59:16 + --> $DIR/privacy-enum-ctor.rs:49:16 | LL | let _: E = E; | ^ @@ -69,23 +71,27 @@ LL | use std::f64::consts::E; | error[E0423]: expected value, found struct variant `E::Struct` - --> $DIR/privacy-enum-ctor.rs:63:16 + --> $DIR/privacy-enum-ctor.rs:53:16 | LL | let _: E = E::Struct; | ^^^^^^^^^ did you mean `E::Struct { /* fields */ }`? error[E0412]: cannot find type `Z` in this scope - --> $DIR/privacy-enum-ctor.rs:67:12 + --> $DIR/privacy-enum-ctor.rs:57:12 | LL | let _: Z = m::n::Z; - | ^ did you mean `E`? + | ^ +help: an enum with a similar name exists + | +LL | let _: E = m::n::Z; + | ^ help: possible candidate is found in another module, you can import it into scope | LL | use m::n::Z; | error[E0423]: expected value, found enum `m::n::Z` - --> $DIR/privacy-enum-ctor.rs:67:16 + --> $DIR/privacy-enum-ctor.rs:57:16 | LL | let _: Z = m::n::Z; | ^^^^^^^ @@ -96,67 +102,79 @@ LL | let _: Z = m::n::Z; - `m::Z::Unit` error[E0412]: cannot find type `Z` in this scope - --> $DIR/privacy-enum-ctor.rs:71:12 + --> $DIR/privacy-enum-ctor.rs:61:12 | LL | let _: Z = m::n::Z::Fn; - | ^ did you mean `E`? + | ^ +help: an enum with a similar name exists + | +LL | let _: E = m::n::Z::Fn; + | ^ help: possible candidate is found in another module, you can import it into scope | LL | use m::n::Z; | error[E0412]: cannot find type `Z` in this scope - --> $DIR/privacy-enum-ctor.rs:74:12 + --> $DIR/privacy-enum-ctor.rs:64:12 | LL | let _: Z = m::n::Z::Struct; - | ^ did you mean `E`? + | ^ +help: an enum with a similar name exists + | +LL | let _: E = m::n::Z::Struct; + | ^ help: possible candidate is found in another module, you can import it into scope | LL | use m::n::Z; | error[E0423]: expected value, found struct variant `m::n::Z::Struct` - --> $DIR/privacy-enum-ctor.rs:74:16 + --> $DIR/privacy-enum-ctor.rs:64:16 | LL | let _: Z = m::n::Z::Struct; | ^^^^^^^^^^^^^^^ did you mean `m::n::Z::Struct { /* fields */ }`? error[E0412]: cannot find type `Z` in this scope - --> $DIR/privacy-enum-ctor.rs:78:12 + --> $DIR/privacy-enum-ctor.rs:68:12 | LL | let _: Z = m::n::Z::Unit {}; - | ^ did you mean `E`? + | ^ +help: an enum with a similar name exists + | +LL | let _: E = m::n::Z::Unit {}; + | ^ help: possible candidate is found in another module, you can import it into scope | LL | use m::n::Z; | error[E0603]: enum `Z` is private - --> $DIR/privacy-enum-ctor.rs:67:22 + --> $DIR/privacy-enum-ctor.rs:57:22 | LL | let _: Z = m::n::Z; | ^ error[E0603]: enum `Z` is private - --> $DIR/privacy-enum-ctor.rs:71:22 + --> $DIR/privacy-enum-ctor.rs:61:22 | LL | let _: Z = m::n::Z::Fn; | ^ error[E0603]: enum `Z` is private - --> $DIR/privacy-enum-ctor.rs:74:22 + --> $DIR/privacy-enum-ctor.rs:64:22 | LL | let _: Z = m::n::Z::Struct; | ^ error[E0603]: enum `Z` is private - --> $DIR/privacy-enum-ctor.rs:78:22 + --> $DIR/privacy-enum-ctor.rs:68:22 | LL | let _: Z = m::n::Z::Unit {}; | ^ error[E0308]: mismatched types - --> $DIR/privacy-enum-ctor.rs:37:20 + --> $DIR/privacy-enum-ctor.rs:27:20 | LL | let _: Z = Z::Fn; | ^^^^^ expected enum `m::n::Z`, found fn item @@ -165,7 +183,7 @@ LL | let _: Z = Z::Fn; found type `fn(u8) -> m::n::Z {m::n::Z::Fn}` error[E0618]: expected function, found enum variant `Z::Unit` - --> $DIR/privacy-enum-ctor.rs:41:17 + --> $DIR/privacy-enum-ctor.rs:31:17 | LL | Unit, | ---- `Z::Unit` defined here @@ -180,7 +198,7 @@ LL | let _ = Z::Unit; | ^^^^^^^ error[E0308]: mismatched types - --> $DIR/privacy-enum-ctor.rs:53:16 + --> $DIR/privacy-enum-ctor.rs:43:16 | LL | let _: E = m::E::Fn; | ^^^^^^^^ expected enum `m::E`, found fn item @@ -189,7 +207,7 @@ LL | let _: E = m::E::Fn; found type `fn(u8) -> m::E {m::E::Fn}` error[E0618]: expected function, found enum variant `m::E::Unit` - --> $DIR/privacy-enum-ctor.rs:57:16 + --> $DIR/privacy-enum-ctor.rs:47:16 | LL | Unit, | ---- `m::E::Unit` defined here @@ -204,7 +222,7 @@ LL | let _: E = m::E::Unit; | ^^^^^^^^^^ error[E0308]: mismatched types - --> $DIR/privacy-enum-ctor.rs:61:16 + --> $DIR/privacy-enum-ctor.rs:51:16 | LL | let _: E = E::Fn; | ^^^^^ expected enum `m::E`, found fn item @@ -213,7 +231,7 @@ LL | let _: E = E::Fn; found type `fn(u8) -> m::E {m::E::Fn}` error[E0618]: expected function, found enum variant `E::Unit` - --> $DIR/privacy-enum-ctor.rs:65:16 + --> $DIR/privacy-enum-ctor.rs:55:16 | LL | Unit, | ---- `E::Unit` defined here diff --git a/src/test/ui/resolve/privacy-struct-ctor.rs b/src/test/ui/resolve/privacy-struct-ctor.rs index 9029eeb22cd..0b389acf75d 100644 --- a/src/test/ui/resolve/privacy-struct-ctor.rs +++ b/src/test/ui/resolve/privacy-struct-ctor.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:privacy-struct-ctor.rs extern crate privacy_struct_ctor as xcrate; diff --git a/src/test/ui/resolve/privacy-struct-ctor.stderr b/src/test/ui/resolve/privacy-struct-ctor.stderr index c4713bd77a8..44ecf6b97bf 100644 --- a/src/test/ui/resolve/privacy-struct-ctor.stderr +++ b/src/test/ui/resolve/privacy-struct-ctor.stderr @@ -1,18 +1,19 @@ error[E0423]: expected value, found struct `Z` - --> $DIR/privacy-struct-ctor.rs:30:9 + --> $DIR/privacy-struct-ctor.rs:20:9 | LL | Z; + | ^ constructor is not visible here due to private fields +help: a tuple struct with a similar name exists + | +LL | S; | ^ - | | - | did you mean `S`? - | constructor is not visible here due to private fields help: possible better candidate is found in another module, you can import it into scope | LL | use m::n::Z; | error[E0423]: expected value, found struct `S` - --> $DIR/privacy-struct-ctor.rs:43:5 + --> $DIR/privacy-struct-ctor.rs:33:5 | LL | S; | ^ constructor is not visible here due to private fields @@ -22,13 +23,13 @@ LL | use m::S; | error[E0423]: expected value, found struct `S2` - --> $DIR/privacy-struct-ctor.rs:48:5 + --> $DIR/privacy-struct-ctor.rs:38:5 | LL | S2; | ^^ did you mean `S2 { /* fields */ }`? error[E0423]: expected value, found struct `xcrate::S` - --> $DIR/privacy-struct-ctor.rs:53:5 + --> $DIR/privacy-struct-ctor.rs:43:5 | LL | xcrate::S; | ^^^^^^^^^ constructor is not visible here due to private fields @@ -38,37 +39,37 @@ LL | use m::S; | error[E0603]: tuple struct `Z` is private - --> $DIR/privacy-struct-ctor.rs:28:12 + --> $DIR/privacy-struct-ctor.rs:18:12 | LL | n::Z; | ^ error[E0603]: tuple struct `S` is private - --> $DIR/privacy-struct-ctor.rs:39:8 + --> $DIR/privacy-struct-ctor.rs:29:8 | LL | m::S; | ^ error[E0603]: tuple struct `S` is private - --> $DIR/privacy-struct-ctor.rs:41:19 + --> $DIR/privacy-struct-ctor.rs:31:19 | LL | let _: S = m::S(2); | ^ error[E0603]: tuple struct `Z` is private - --> $DIR/privacy-struct-ctor.rs:45:11 + --> $DIR/privacy-struct-ctor.rs:35:11 | LL | m::n::Z; | ^ error[E0603]: tuple struct `S` is private - --> $DIR/privacy-struct-ctor.rs:51:16 + --> $DIR/privacy-struct-ctor.rs:41:16 | LL | xcrate::m::S; | ^ error[E0603]: tuple struct `Z` is private - --> $DIR/privacy-struct-ctor.rs:55:19 + --> $DIR/privacy-struct-ctor.rs:45:19 | LL | xcrate::m::n::Z; | ^ diff --git a/src/test/ui/resolve/resolve-assoc-suggestions.rs b/src/test/ui/resolve/resolve-assoc-suggestions.rs index f3bc8107360..8cdbe64af0d 100644 --- a/src/test/ui/resolve/resolve-assoc-suggestions.rs +++ b/src/test/ui/resolve/resolve-assoc-suggestions.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure associated items are recommended only in appropriate contexts. struct S { diff --git a/src/test/ui/resolve/resolve-assoc-suggestions.stderr b/src/test/ui/resolve/resolve-assoc-suggestions.stderr index 916fa9793dc..f2e1d72e7a3 100644 --- a/src/test/ui/resolve/resolve-assoc-suggestions.stderr +++ b/src/test/ui/resolve/resolve-assoc-suggestions.stderr @@ -1,53 +1,53 @@ error[E0412]: cannot find type `field` in this scope - --> $DIR/resolve-assoc-suggestions.rs:26:16 + --> $DIR/resolve-assoc-suggestions.rs:16:16 | LL | let _: field; | ^^^^^ not found in this scope error[E0531]: cannot find tuple struct/variant `field` in this scope - --> $DIR/resolve-assoc-suggestions.rs:28:13 + --> $DIR/resolve-assoc-suggestions.rs:18:13 | LL | let field(..); | ^^^^^ not found in this scope error[E0425]: cannot find value `field` in this scope - --> $DIR/resolve-assoc-suggestions.rs:30:9 + --> $DIR/resolve-assoc-suggestions.rs:20:9 | LL | field; | ^^^^^ help: try: `self.field` error[E0412]: cannot find type `Type` in this scope - --> $DIR/resolve-assoc-suggestions.rs:33:16 + --> $DIR/resolve-assoc-suggestions.rs:23:16 | LL | let _: Type; | ^^^^ help: try: `Self::Type` error[E0531]: cannot find tuple struct/variant `Type` in this scope - --> $DIR/resolve-assoc-suggestions.rs:35:13 + --> $DIR/resolve-assoc-suggestions.rs:25:13 | LL | let Type(..); | ^^^^ not found in this scope error[E0425]: cannot find value `Type` in this scope - --> $DIR/resolve-assoc-suggestions.rs:37:9 + --> $DIR/resolve-assoc-suggestions.rs:27:9 | LL | Type; | ^^^^ not found in this scope error[E0412]: cannot find type `method` in this scope - --> $DIR/resolve-assoc-suggestions.rs:40:16 + --> $DIR/resolve-assoc-suggestions.rs:30:16 | LL | let _: method; | ^^^^^^ not found in this scope error[E0531]: cannot find tuple struct/variant `method` in this scope - --> $DIR/resolve-assoc-suggestions.rs:42:13 + --> $DIR/resolve-assoc-suggestions.rs:32:13 | LL | let method(..); | ^^^^^^ not found in this scope error[E0425]: cannot find value `method` in this scope - --> $DIR/resolve-assoc-suggestions.rs:44:9 + --> $DIR/resolve-assoc-suggestions.rs:34:9 | LL | method; | ^^^^^^ help: try: `self.method` diff --git a/src/test/ui/resolve/resolve-bad-import-prefix.rs b/src/test/ui/resolve/resolve-bad-import-prefix.rs index 5da5a8c3fef..325c69b43c1 100644 --- a/src/test/ui/resolve/resolve-bad-import-prefix.rs +++ b/src/test/ui/resolve/resolve-bad-import-prefix.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod m {} enum E {} struct S; diff --git a/src/test/ui/resolve/resolve-bad-import-prefix.stderr b/src/test/ui/resolve/resolve-bad-import-prefix.stderr index c4d9b1d0075..f39e1edb613 100644 --- a/src/test/ui/resolve/resolve-bad-import-prefix.stderr +++ b/src/test/ui/resolve/resolve-bad-import-prefix.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `Nonexistent` - --> $DIR/resolve-bad-import-prefix.rs:22:5 + --> $DIR/resolve-bad-import-prefix.rs:12:5 | LL | use Nonexistent::{}; //~ ERROR unresolved import `Nonexistent` | ^^^^^^^^^^^^^^^ no `Nonexistent` in the root diff --git a/src/test/ui/resolve/resolve-bad-visibility.rs b/src/test/ui/resolve/resolve-bad-visibility.rs index 420a45a2147..d86c300c93f 100644 --- a/src/test/ui/resolve/resolve-bad-visibility.rs +++ b/src/test/ui/resolve/resolve-bad-visibility.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum E {} trait Tr {} diff --git a/src/test/ui/resolve/resolve-bad-visibility.stderr b/src/test/ui/resolve/resolve-bad-visibility.stderr index aa4817163e3..519e7a946e1 100644 --- a/src/test/ui/resolve/resolve-bad-visibility.stderr +++ b/src/test/ui/resolve/resolve-bad-visibility.stderr @@ -1,29 +1,29 @@ error: visibilities can only be restricted to ancestor modules - --> $DIR/resolve-bad-visibility.rs:16:8 + --> $DIR/resolve-bad-visibility.rs:6:8 | LL | pub(in std::vec) struct F; //~ ERROR visibilities can only be restricted to ancestor modules | ^^^^^^^^ error[E0577]: expected module, found enum `E` - --> $DIR/resolve-bad-visibility.rs:14:8 + --> $DIR/resolve-bad-visibility.rs:4:8 | LL | pub(in E) struct S; //~ ERROR expected module, found enum `E` | ^ not a module error[E0577]: expected module, found trait `Tr` - --> $DIR/resolve-bad-visibility.rs:15:8 + --> $DIR/resolve-bad-visibility.rs:5:8 | LL | pub(in Tr) struct Z; //~ ERROR expected module, found trait `Tr` | ^^ not a module error[E0578]: cannot find module `nonexistent` in the crate root - --> $DIR/resolve-bad-visibility.rs:17:8 + --> $DIR/resolve-bad-visibility.rs:7:8 | LL | pub(in nonexistent) struct G; //~ ERROR cannot find module `nonexistent` in the crate root | ^^^^^^^^^^^ not found in the crate root error[E0578]: cannot find module `too_soon` in the crate root - --> $DIR/resolve-bad-visibility.rs:18:8 + --> $DIR/resolve-bad-visibility.rs:8:8 | LL | pub(in too_soon) struct H; //~ ERROR cannot find module `too_soon` in the crate root | ^^^^^^^^ not found in the crate root diff --git a/src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.rs b/src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.rs index 6a04a2c3704..e4bb0d32942 100644 --- a/src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.rs +++ b/src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[allow(unused_extern_crates)] extern crate std; //~^ ERROR the name `std` is defined multiple times diff --git a/src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr b/src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr index 83577b245b7..9e43cd4839f 100644 --- a/src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr +++ b/src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr @@ -1,5 +1,5 @@ error[E0259]: the name `std` is defined multiple times - --> $DIR/resolve-conflict-extern-crate-vs-extern-crate.rs:12:1 + --> $DIR/resolve-conflict-extern-crate-vs-extern-crate.rs:2:1 | LL | extern crate std; | ^^^^^^^^^^^^^^^^^ `std` reimported here diff --git a/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.rs b/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.rs index 91cf1d35954..10772e7a43a 100644 --- a/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.rs +++ b/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::slice as std; //~ ERROR the name `std` is defined multiple times fn main() { diff --git a/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr b/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr index adb66b994db..24889a0a820 100644 --- a/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr +++ b/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr @@ -1,5 +1,5 @@ error[E0254]: the name `std` is defined multiple times - --> $DIR/resolve-conflict-import-vs-extern-crate.rs:11:5 + --> $DIR/resolve-conflict-import-vs-extern-crate.rs:1:5 | LL | use std::slice as std; //~ ERROR the name `std` is defined multiple times | ^^^^^^^^^^^^^^^^^ `std` reimported here diff --git a/src/test/ui/resolve/resolve-conflict-import-vs-import.rs b/src/test/ui/resolve/resolve-conflict-import-vs-import.rs index 8db9023310e..322f000040e 100644 --- a/src/test/ui/resolve/resolve-conflict-import-vs-import.rs +++ b/src/test/ui/resolve/resolve-conflict-import-vs-import.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem::transmute; use std::mem::transmute; //~^ ERROR the name `transmute` is defined multiple times diff --git a/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr b/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr index 15f826305bf..2852d122e5e 100644 --- a/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr +++ b/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `transmute` is defined multiple times - --> $DIR/resolve-conflict-import-vs-import.rs:12:5 + --> $DIR/resolve-conflict-import-vs-import.rs:2:5 | LL | use std::mem::transmute; | ------------------- previous import of the value `transmute` here diff --git a/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.rs b/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.rs index b50a60d39c8..12260624935 100644 --- a/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.rs +++ b/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn std() {} mod std {} //~ ERROR the name `std` is defined multiple times diff --git a/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr b/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr index 0b082c1105f..5e190bf3185 100644 --- a/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr +++ b/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr @@ -1,5 +1,5 @@ error[E0260]: the name `std` is defined multiple times - --> $DIR/resolve-conflict-item-vs-extern-crate.rs:12:1 + --> $DIR/resolve-conflict-item-vs-extern-crate.rs:2:1 | LL | mod std {} //~ ERROR the name `std` is defined multiple times | ^^^^^^^ `std` redefined here diff --git a/src/test/ui/resolve/resolve-conflict-item-vs-import.rs b/src/test/ui/resolve/resolve-conflict-item-vs-import.rs index 4e74ab95d61..4308c7a2750 100644 --- a/src/test/ui/resolve/resolve-conflict-item-vs-import.rs +++ b/src/test/ui/resolve/resolve-conflict-item-vs-import.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem::transmute; fn transmute() {} diff --git a/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr b/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr index 5305ddbd2ef..83beb20fe90 100644 --- a/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr +++ b/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr @@ -1,5 +1,5 @@ error[E0255]: the name `transmute` is defined multiple times - --> $DIR/resolve-conflict-item-vs-import.rs:13:1 + --> $DIR/resolve-conflict-item-vs-import.rs:3:1 | LL | use std::mem::transmute; | ------------------- previous import of the value `transmute` here diff --git a/src/test/ui/resolve/resolve-conflict-type-vs-import.rs b/src/test/ui/resolve/resolve-conflict-type-vs-import.rs index bbb6ee622b1..3abce839691 100644 --- a/src/test/ui/resolve/resolve-conflict-type-vs-import.rs +++ b/src/test/ui/resolve/resolve-conflict-type-vs-import.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::slice::Iter; struct Iter; diff --git a/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr b/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr index e5cafa3ac98..104ed9bdc29 100644 --- a/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr +++ b/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr @@ -1,5 +1,5 @@ error[E0255]: the name `Iter` is defined multiple times - --> $DIR/resolve-conflict-type-vs-import.rs:13:1 + --> $DIR/resolve-conflict-type-vs-import.rs:3:1 | LL | use std::slice::Iter; | ---------------- previous import of the type `Iter` here diff --git a/src/test/ui/resolve/resolve-hint-macro.rs b/src/test/ui/resolve/resolve-hint-macro.rs index cc9f73b871c..6155ae7bcdf 100644 --- a/src/test/ui/resolve/resolve-hint-macro.rs +++ b/src/test/ui/resolve/resolve-hint-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { assert(true); //~^ ERROR expected function, found macro `assert` diff --git a/src/test/ui/resolve/resolve-hint-macro.stderr b/src/test/ui/resolve/resolve-hint-macro.stderr index 9de6fd85de2..ebe3c36f21e 100644 --- a/src/test/ui/resolve/resolve-hint-macro.stderr +++ b/src/test/ui/resolve/resolve-hint-macro.stderr @@ -1,8 +1,8 @@ error[E0423]: expected function, found macro `assert` - --> $DIR/resolve-hint-macro.rs:12:5 + --> $DIR/resolve-hint-macro.rs:2:5 | LL | assert(true); - | ^^^^^^ did you mean `assert!(...)`? + | ^^^^^^ help: use `!` to invoke the macro: `assert!` error: aborting due to previous error diff --git a/src/test/ui/resolve/resolve-inconsistent-binding-mode.rs b/src/test/ui/resolve/resolve-inconsistent-binding-mode.rs index 63d33a9e5fa..e9c4e47f887 100644 --- a/src/test/ui/resolve/resolve-inconsistent-binding-mode.rs +++ b/src/test/ui/resolve/resolve-inconsistent-binding-mode.rs @@ -1,49 +1,39 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum opts { - a(isize), b(isize), c(isize) +enum Opts { + A(isize), B(isize), C(isize) } -fn matcher1(x: opts) { +fn matcher1(x: Opts) { match x { - opts::a(ref i) | opts::b(i) => {} + Opts::A(ref i) | Opts::B(i) => {} //~^ ERROR variable `i` is bound in inconsistent ways within the same match arm //~^^ ERROR mismatched types - opts::c(_) => {} + Opts::C(_) => {} } } -fn matcher2(x: opts) { +fn matcher2(x: Opts) { match x { - opts::a(ref i) | opts::b(i) => {} + Opts::A(ref i) | Opts::B(i) => {} //~^ ERROR variable `i` is bound in inconsistent ways within the same match arm //~^^ ERROR mismatched types - opts::c(_) => {} + Opts::C(_) => {} } } -fn matcher4(x: opts) { +fn matcher4(x: Opts) { match x { - opts::a(ref mut i) | opts::b(ref i) => {} + Opts::A(ref mut i) | Opts::B(ref i) => {} //~^ ERROR variable `i` is bound in inconsistent ways within the same match arm //~^^ ERROR mismatched types - opts::c(_) => {} + Opts::C(_) => {} } } -fn matcher5(x: opts) { +fn matcher5(x: Opts) { match x { - opts::a(ref i) | opts::b(ref i) => {} - opts::c(_) => {} + Opts::A(ref i) | Opts::B(ref i) => {} + Opts::C(_) => {} } } diff --git a/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr b/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr index e36eea26fcf..a14d3d67b10 100644 --- a/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr +++ b/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr @@ -1,47 +1,47 @@ error[E0409]: variable `i` is bound in inconsistent ways within the same match arm - --> $DIR/resolve-inconsistent-binding-mode.rs:17:32 + --> $DIR/resolve-inconsistent-binding-mode.rs:7:32 | -LL | opts::a(ref i) | opts::b(i) => {} +LL | Opts::A(ref i) | Opts::B(i) => {} | - ^ bound in different ways | | | first binding error[E0409]: variable `i` is bound in inconsistent ways within the same match arm - --> $DIR/resolve-inconsistent-binding-mode.rs:26:32 + --> $DIR/resolve-inconsistent-binding-mode.rs:16:32 | -LL | opts::a(ref i) | opts::b(i) => {} +LL | Opts::A(ref i) | Opts::B(i) => {} | - ^ bound in different ways | | | first binding error[E0409]: variable `i` is bound in inconsistent ways within the same match arm - --> $DIR/resolve-inconsistent-binding-mode.rs:35:40 + --> $DIR/resolve-inconsistent-binding-mode.rs:25:40 | -LL | opts::a(ref mut i) | opts::b(ref i) => {} +LL | Opts::A(ref mut i) | Opts::B(ref i) => {} | - first binding ^ bound in different ways error[E0308]: mismatched types - --> $DIR/resolve-inconsistent-binding-mode.rs:17:32 + --> $DIR/resolve-inconsistent-binding-mode.rs:7:32 | -LL | opts::a(ref i) | opts::b(i) => {} +LL | Opts::A(ref i) | Opts::B(i) => {} | ^ expected &isize, found isize | = note: expected type `&isize` found type `isize` error[E0308]: mismatched types - --> $DIR/resolve-inconsistent-binding-mode.rs:26:32 + --> $DIR/resolve-inconsistent-binding-mode.rs:16:32 | -LL | opts::a(ref i) | opts::b(i) => {} +LL | Opts::A(ref i) | Opts::B(i) => {} | ^ expected &isize, found isize | = note: expected type `&isize` found type `isize` error[E0308]: mismatched types - --> $DIR/resolve-inconsistent-binding-mode.rs:35:36 + --> $DIR/resolve-inconsistent-binding-mode.rs:25:36 | -LL | opts::a(ref mut i) | opts::b(ref i) => {} +LL | Opts::A(ref mut i) | Opts::B(ref i) => {} | ^^^^^ types differ in mutability | = note: expected type `&mut isize` diff --git a/src/test/ui/resolve/resolve-inconsistent-names.rs b/src/test/ui/resolve/resolve-inconsistent-names.rs index 79d78b4ca59..59baa57d91b 100644 --- a/src/test/ui/resolve/resolve-inconsistent-names.rs +++ b/src/test/ui/resolve/resolve-inconsistent-names.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let y = 1; match y { diff --git a/src/test/ui/resolve/resolve-inconsistent-names.stderr b/src/test/ui/resolve/resolve-inconsistent-names.stderr index 17caac210d4..20346d5aefe 100644 --- a/src/test/ui/resolve/resolve-inconsistent-names.stderr +++ b/src/test/ui/resolve/resolve-inconsistent-names.stderr @@ -1,5 +1,5 @@ error[E0408]: variable `a` is not bound in all patterns - --> $DIR/resolve-inconsistent-names.rs:14:12 + --> $DIR/resolve-inconsistent-names.rs:4:12 | LL | a | b => {} //~ ERROR variable `a` is not bound in all patterns | - ^ pattern doesn't bind `a` @@ -7,7 +7,7 @@ LL | a | b => {} //~ ERROR variable `a` is not bound in all patterns | variable not in all patterns error[E0408]: variable `b` is not bound in all patterns - --> $DIR/resolve-inconsistent-names.rs:14:8 + --> $DIR/resolve-inconsistent-names.rs:4:8 | LL | a | b => {} //~ ERROR variable `a` is not bound in all patterns | ^ - variable not in all patterns diff --git a/src/test/ui/resolve/resolve-label.rs b/src/test/ui/resolve/resolve-label.rs index 6695e972f33..965ee450104 100644 --- a/src/test/ui/resolve/resolve-label.rs +++ b/src/test/ui/resolve/resolve-label.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f() { 'l: loop { fn g() { diff --git a/src/test/ui/resolve/resolve-label.stderr b/src/test/ui/resolve/resolve-label.stderr index a7b89752f5e..fecfd922347 100644 --- a/src/test/ui/resolve/resolve-label.stderr +++ b/src/test/ui/resolve/resolve-label.stderr @@ -1,5 +1,5 @@ error[E0426]: use of undeclared label `'l` - --> $DIR/resolve-label.rs:15:23 + --> $DIR/resolve-label.rs:5:23 | LL | break 'l; //~ ERROR use of undeclared label | ^^ undeclared label `'l` diff --git a/src/test/ui/resolve/resolve-primitive-fallback.rs b/src/test/ui/resolve/resolve-primitive-fallback.rs index c1584b0bdcd..e5a3d689d23 100644 --- a/src/test/ui/resolve/resolve-primitive-fallback.rs +++ b/src/test/ui/resolve/resolve-primitive-fallback.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { // Make sure primitive type fallback doesn't work in value namespace std::mem::size_of(u16); diff --git a/src/test/ui/resolve/resolve-primitive-fallback.stderr b/src/test/ui/resolve/resolve-primitive-fallback.stderr index 2d852369afc..963bab43551 100644 --- a/src/test/ui/resolve/resolve-primitive-fallback.stderr +++ b/src/test/ui/resolve/resolve-primitive-fallback.stderr @@ -1,17 +1,17 @@ error[E0423]: expected value, found builtin type `u16` - --> $DIR/resolve-primitive-fallback.rs:13:23 + --> $DIR/resolve-primitive-fallback.rs:3:23 | LL | std::mem::size_of(u16); | ^^^ not a value error[E0412]: cannot find type `u8` in the crate root - --> $DIR/resolve-primitive-fallback.rs:18:14 + --> $DIR/resolve-primitive-fallback.rs:8:14 | LL | let _: ::u8; | ^^ not found in the crate root error[E0061]: this function takes 0 parameters but 1 parameter was supplied - --> $DIR/resolve-primitive-fallback.rs:13:5 + --> $DIR/resolve-primitive-fallback.rs:3:5 | LL | std::mem::size_of(u16); | ^^^^^^^^^^^^^^^^^^^^^^ expected 0 parameters diff --git a/src/test/ui/resolve/resolve-self-in-impl-2.rs b/src/test/ui/resolve/resolve-self-in-impl-2.rs index adc208a0202..f586760c8b0 100644 --- a/src/test/ui/resolve/resolve-self-in-impl-2.rs +++ b/src/test/ui/resolve/resolve-self-in-impl-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S(T); trait Tr {} diff --git a/src/test/ui/resolve/resolve-self-in-impl-2.stderr b/src/test/ui/resolve/resolve-self-in-impl-2.stderr index 183b9b66327..1f5887e1352 100644 --- a/src/test/ui/resolve/resolve-self-in-impl-2.stderr +++ b/src/test/ui/resolve/resolve-self-in-impl-2.stderr @@ -1,11 +1,11 @@ error[E0411]: expected trait, found self type `Self` - --> $DIR/resolve-self-in-impl-2.rs:14:6 + --> $DIR/resolve-self-in-impl-2.rs:4:6 | LL | impl Self for S {} //~ ERROR expected trait, found self type `Self` - | ^^^^ `Self` is only available in traits and impls + | ^^^^ `Self` is only available in impls, traits, and type definitions error[E0405]: cannot find trait `N` in `Self` - --> $DIR/resolve-self-in-impl-2.rs:15:12 + --> $DIR/resolve-self-in-impl-2.rs:5:12 | LL | impl Self::N for S {} //~ ERROR cannot find trait `N` in `Self` | ^ not found in `Self` diff --git a/src/test/ui/resolve/resolve-self-in-impl.rs b/src/test/ui/resolve/resolve-self-in-impl.rs index 2a894c57b8d..024fdc51ea3 100644 --- a/src/test/ui/resolve/resolve-self-in-impl.rs +++ b/src/test/ui/resolve/resolve-self-in-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_type_defaults)] struct S(T); diff --git a/src/test/ui/resolve/resolve-self-in-impl.stderr b/src/test/ui/resolve/resolve-self-in-impl.stderr index 3fa384808db..1940c0cd2a4 100644 --- a/src/test/ui/resolve/resolve-self-in-impl.stderr +++ b/src/test/ui/resolve/resolve-self-in-impl.stderr @@ -1,42 +1,97 @@ -error[E0391]: cycle detected when processing `` - --> $DIR/resolve-self-in-impl.rs:24:13 +error[E0391]: cycle detected when processing `` + --> $DIR/resolve-self-in-impl.rs:14:13 | LL | impl Tr for Self {} //~ ERROR cycle detected | ^^^^ | - = note: ...which again requires processing ``, completing the cycle + = note: ...which again requires processing ``, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/resolve-self-in-impl.rs:1:1 + | +LL | / #![feature(associated_type_defaults)] +LL | | +LL | | struct S(T); +LL | | trait Tr { +... | +LL | | +LL | | fn main() {} + | |____________^ -error[E0391]: cycle detected when processing `` - --> $DIR/resolve-self-in-impl.rs:25:15 +error[E0391]: cycle detected when processing `` + --> $DIR/resolve-self-in-impl.rs:15:15 | LL | impl Tr for S {} //~ ERROR cycle detected | ^^^^ | - = note: ...which again requires processing ``, completing the cycle + = note: ...which again requires processing ``, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/resolve-self-in-impl.rs:1:1 + | +LL | / #![feature(associated_type_defaults)] +LL | | +LL | | struct S(T); +LL | | trait Tr { +... | +LL | | +LL | | fn main() {} + | |____________^ -error[E0391]: cycle detected when processing `` - --> $DIR/resolve-self-in-impl.rs:26:6 +error[E0391]: cycle detected when processing `` + --> $DIR/resolve-self-in-impl.rs:16:6 | LL | impl Self {} //~ ERROR cycle detected | ^^^^ | - = note: ...which again requires processing ``, completing the cycle + = note: ...which again requires processing ``, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/resolve-self-in-impl.rs:1:1 + | +LL | / #![feature(associated_type_defaults)] +LL | | +LL | | struct S(T); +LL | | trait Tr { +... | +LL | | +LL | | fn main() {} + | |____________^ -error[E0391]: cycle detected when processing `` - --> $DIR/resolve-self-in-impl.rs:27:8 +error[E0391]: cycle detected when processing `` + --> $DIR/resolve-self-in-impl.rs:17:8 | LL | impl S {} //~ ERROR cycle detected | ^^^^ | - = note: ...which again requires processing ``, completing the cycle + = note: ...which again requires processing ``, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/resolve-self-in-impl.rs:1:1 + | +LL | / #![feature(associated_type_defaults)] +LL | | +LL | | struct S(T); +LL | | trait Tr { +... | +LL | | +LL | | fn main() {} + | |____________^ -error[E0391]: cycle detected when processing `` - --> $DIR/resolve-self-in-impl.rs:28:1 +error[E0391]: cycle detected when processing `` + --> $DIR/resolve-self-in-impl.rs:18:1 | LL | impl Tr for S {} //~ ERROR cycle detected | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...which again requires processing ``, completing the cycle + = note: ...which again requires processing ``, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/resolve-self-in-impl.rs:1:1 + | +LL | / #![feature(associated_type_defaults)] +LL | | +LL | | struct S(T); +LL | | trait Tr { +... | +LL | | +LL | | fn main() {} + | |____________^ error: aborting due to 5 previous errors diff --git a/src/test/ui/resolve/resolve-speculative-adjustment.rs b/src/test/ui/resolve/resolve-speculative-adjustment.rs index fb5ed150bf4..81f7578291b 100644 --- a/src/test/ui/resolve/resolve-speculative-adjustment.rs +++ b/src/test/ui/resolve/resolve-speculative-adjustment.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure speculative path resolution works properly when resolution // adjustment happens and no extra errors is reported. diff --git a/src/test/ui/resolve/resolve-speculative-adjustment.stderr b/src/test/ui/resolve/resolve-speculative-adjustment.stderr index 217bfb42566..c4a6ced1ca4 100644 --- a/src/test/ui/resolve/resolve-speculative-adjustment.stderr +++ b/src/test/ui/resolve/resolve-speculative-adjustment.stderr @@ -1,23 +1,23 @@ error[E0425]: cannot find value `field` in this scope - --> $DIR/resolve-speculative-adjustment.rs:27:13 + --> $DIR/resolve-speculative-adjustment.rs:17:13 | LL | field; | ^^^^^ not found in this scope error[E0425]: cannot find function `method` in this scope - --> $DIR/resolve-speculative-adjustment.rs:29:13 + --> $DIR/resolve-speculative-adjustment.rs:19:13 | LL | method(); | ^^^^^^ not found in this scope error[E0425]: cannot find value `field` in this scope - --> $DIR/resolve-speculative-adjustment.rs:33:9 + --> $DIR/resolve-speculative-adjustment.rs:23:9 | LL | field; | ^^^^^ help: try: `self.field` error[E0425]: cannot find function `method` in this scope - --> $DIR/resolve-speculative-adjustment.rs:35:9 + --> $DIR/resolve-speculative-adjustment.rs:25:9 | LL | method(); | ^^^^^^ help: try: `self.method` diff --git a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.rs b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.rs index a1572b85666..112427a3fce 100644 --- a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.rs +++ b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #14603: Check for references to type parameters from the // outer scope (in this case, the trait) used on items in an inner // scope (in this case, the enum). diff --git a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr index 73ee7102e6e..8eca720d88e 100644 --- a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr +++ b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use type parameters from outer function - --> $DIR/resolve-type-param-in-item-in-trait.rs:18:22 + --> $DIR/resolve-type-param-in-item-in-trait.rs:8:22 | LL | trait TraitA { | - type variable from outer function @@ -10,7 +10,7 @@ LL | Variance(A) | ^ use of type variable from outer function error[E0401]: can't use type parameters from outer function - --> $DIR/resolve-type-param-in-item-in-trait.rs:26:23 + --> $DIR/resolve-type-param-in-item-in-trait.rs:16:23 | LL | trait TraitB { | - type variable from outer function @@ -20,7 +20,7 @@ LL | struct Foo(A); | ^ use of type variable from outer function error[E0401]: can't use type parameters from outer function - --> $DIR/resolve-type-param-in-item-in-trait.rs:33:28 + --> $DIR/resolve-type-param-in-item-in-trait.rs:23:28 | LL | trait TraitC { | - type variable from outer function @@ -30,7 +30,7 @@ LL | struct Foo { a: A } | ^ use of type variable from outer function error[E0401]: can't use type parameters from outer function - --> $DIR/resolve-type-param-in-item-in-trait.rs:40:22 + --> $DIR/resolve-type-param-in-item-in-trait.rs:30:22 | LL | trait TraitD { | - type variable from outer function diff --git a/src/test/ui/resolve/resolve-unknown-trait.rs b/src/test/ui/resolve/resolve-unknown-trait.rs index 05bf4b928b7..290893bbbec 100644 --- a/src/test/ui/resolve/resolve-unknown-trait.rs +++ b/src/test/ui/resolve/resolve-unknown-trait.rs @@ -1,14 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait NewTrait : SomeNonExistentTrait {} //~^ ERROR cannot find trait `SomeNonExistentTrait` in this scope diff --git a/src/test/ui/resolve/resolve-unknown-trait.stderr b/src/test/ui/resolve/resolve-unknown-trait.stderr index 74b190f8684..e19cfe617d4 100644 --- a/src/test/ui/resolve/resolve-unknown-trait.stderr +++ b/src/test/ui/resolve/resolve-unknown-trait.stderr @@ -1,17 +1,17 @@ error[E0405]: cannot find trait `SomeNonExistentTrait` in this scope - --> $DIR/resolve-unknown-trait.rs:12:18 + --> $DIR/resolve-unknown-trait.rs:1:18 | LL | trait NewTrait : SomeNonExistentTrait {} | ^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0405]: cannot find trait `SomeNonExistentTrait` in this scope - --> $DIR/resolve-unknown-trait.rs:15:6 + --> $DIR/resolve-unknown-trait.rs:4:6 | LL | impl SomeNonExistentTrait for isize {} | ^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0405]: cannot find trait `SomeNonExistentTrait` in this scope - --> $DIR/resolve-unknown-trait.rs:18:8 + --> $DIR/resolve-unknown-trait.rs:7:8 | LL | fn f() {} | ^^^^^^^^^^^^^^^^^^^^ not found in this scope diff --git a/src/test/ui/resolve/resolve-variant-assoc-item.rs b/src/test/ui/resolve/resolve-variant-assoc-item.rs index 01f493e954b..f0f55c0c667 100644 --- a/src/test/ui/resolve/resolve-variant-assoc-item.rs +++ b/src/test/ui/resolve/resolve-variant-assoc-item.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum E { V } use E::V; diff --git a/src/test/ui/resolve/resolve-variant-assoc-item.stderr b/src/test/ui/resolve/resolve-variant-assoc-item.stderr index ef2d0a71b5b..b93005849f4 100644 --- a/src/test/ui/resolve/resolve-variant-assoc-item.stderr +++ b/src/test/ui/resolve/resolve-variant-assoc-item.stderr @@ -1,11 +1,11 @@ error[E0433]: failed to resolve: not a module `V` - --> $DIR/resolve-variant-assoc-item.rs:15:8 + --> $DIR/resolve-variant-assoc-item.rs:5:8 | LL | E::V::associated_item; //~ ERROR failed to resolve: not a module `V` | ^ not a module `V` error[E0433]: failed to resolve: not a module `V` - --> $DIR/resolve-variant-assoc-item.rs:16:5 + --> $DIR/resolve-variant-assoc-item.rs:6:5 | LL | V::associated_item; //~ ERROR failed to resolve: not a module `V` | ^ not a module `V` diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs index d24fced5d31..204a272402d 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Beginners write `mod.item` when they should write `mod::item`. // This tests that we suggest the latter when we encounter the former. diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr index 9216c0b3219..b7b158ce7ef 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr @@ -1,76 +1,86 @@ error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:27:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:17:5 | LL | a.I | ^-- | | - | did you mean `a::I`? + | help: use the path separator to refer to an item: `a::I` error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:32:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:22:5 | LL | a.g() - | ^---- + | ^-- | | - | did you mean `a::g(...)`? + | help: use the path separator to refer to an item: `a::g` error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:37:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:27:5 | LL | a.b.J | ^-- | | - | did you mean `a::b`? + | help: use the path separator to refer to an item: `a::b` error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:42:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:32:5 | LL | a::b.J - | ^^^--- - | | | - | | did you mean `I`? - | did you mean `a::b::J`? + | ^^^^ +help: a constant with a similar name exists + | +LL | a::I.J + | ^ +help: use the path separator to refer to an item + | +LL | a::b::J + | error[E0423]: expected value, found module `a` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:47:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:37:5 | LL | a.b.f(); | ^-- | | - | did you mean `a::b`? + | help: use the path separator to refer to an item: `a::b` error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:50:12 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:40:12 | LL | v.push(a::b); | ^^^- | | - | did you mean `I`? + | help: a constant with a similar name exists: `I` error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:55:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:45:5 | LL | a::b.f() - | ^^^----- - | | | - | | did you mean `I`? - | did you mean `a::b::f(...)`? + | ^^^^ +help: a constant with a similar name exists + | +LL | a::I.f() + | ^ +help: use the path separator to refer to an item + | +LL | a::b::f() + | ^^^^^^^ error[E0423]: expected value, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:60:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:50:5 | LL | a::b | ^^^- | | - | did you mean `I`? + | help: a constant with a similar name exists: `I` error[E0423]: expected function, found module `a::b` - --> $DIR/suggest-path-instead-of-mod-dot-item.rs:65:5 + --> $DIR/suggest-path-instead-of-mod-dot-item.rs:55:5 | LL | a::b() | ^^^- | | - | did you mean `I`? + | help: a constant with a similar name exists: `I` error: aborting due to 9 previous errors diff --git a/src/test/ui/resolve/token-error-correct-2.rs b/src/test/ui/resolve/token-error-correct-2.rs index 55803e4034b..807a39c8c7f 100644 --- a/src/test/ui/resolve/token-error-correct-2.rs +++ b/src/test/ui/resolve/token-error-correct-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we do some basic error correction in the tokeniser (and don't ICE). fn main() { diff --git a/src/test/ui/resolve/token-error-correct-2.stderr b/src/test/ui/resolve/token-error-correct-2.stderr index 6965c864569..481ed882889 100644 --- a/src/test/ui/resolve/token-error-correct-2.stderr +++ b/src/test/ui/resolve/token-error-correct-2.stderr @@ -1,5 +1,5 @@ error: incorrect close delimiter: `)` - --> $DIR/token-error-correct-2.rs:16:5 + --> $DIR/token-error-correct-2.rs:6:5 | LL | if foo { | - un-closed delimiter @@ -8,7 +8,7 @@ LL | ) //~ ERROR: incorrect close delimiter: `)` | ^ incorrect close delimiter error[E0425]: cannot find value `foo` in this scope - --> $DIR/token-error-correct-2.rs:14:8 + --> $DIR/token-error-correct-2.rs:4:8 | LL | if foo { | ^^^ not found in this scope diff --git a/src/test/ui/resolve/token-error-correct-3.rs b/src/test/ui/resolve/token-error-correct-3.rs index fd4bbde2866..86cf71117a6 100644 --- a/src/test/ui/resolve/token-error-correct-3.rs +++ b/src/test/ui/resolve/token-error-correct-3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no std::fs support // Test that we do some basic error correction in the tokeniser (and don't spew diff --git a/src/test/ui/resolve/token-error-correct-3.stderr b/src/test/ui/resolve/token-error-correct-3.stderr index b87a59d2196..2164d27a051 100644 --- a/src/test/ui/resolve/token-error-correct-3.stderr +++ b/src/test/ui/resolve/token-error-correct-3.stderr @@ -1,5 +1,5 @@ error: incorrect close delimiter: `}` - --> $DIR/token-error-correct-3.rs:30:9 + --> $DIR/token-error-correct-3.rs:20:9 | LL | if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory` | - close delimiter possibly meant for this @@ -10,13 +10,13 @@ LL | } else { //~ ERROR: incorrect close delimiter: `}` | ^ incorrect close delimiter error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` - --> $DIR/token-error-correct-3.rs:24:35 + --> $DIR/token-error-correct-3.rs:14:35 | LL | callback(path.as_ref(); //~ ERROR expected one of | ^ expected one of `)`, `,`, `.`, `?`, or an operator here error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` - --> $DIR/token-error-correct-3.rs:30:9 + --> $DIR/token-error-correct-3.rs:20:9 | LL | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types | - expected one of `.`, `;`, `?`, `}`, or an operator here @@ -25,13 +25,13 @@ LL | } else { //~ ERROR: incorrect close delimiter: `}` | ^ unexpected token error[E0425]: cannot find function `is_directory` in this scope - --> $DIR/token-error-correct-3.rs:23:13 + --> $DIR/token-error-correct-3.rs:13:13 | LL | if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory` | ^^^^^^^^^^^^ not found in this scope error[E0308]: mismatched types - --> $DIR/token-error-correct-3.rs:25:13 + --> $DIR/token-error-correct-3.rs:15:13 | LL | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;` diff --git a/src/test/ui/resolve/token-error-correct.rs b/src/test/ui/resolve/token-error-correct.rs index 099ead93beb..b97e22f7d91 100644 --- a/src/test/ui/resolve/token-error-correct.rs +++ b/src/test/ui/resolve/token-error-correct.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we do some basic error correction in the tokeniser. fn main() { diff --git a/src/test/ui/resolve/token-error-correct.stderr b/src/test/ui/resolve/token-error-correct.stderr index b6909840732..0a4590461b5 100644 --- a/src/test/ui/resolve/token-error-correct.stderr +++ b/src/test/ui/resolve/token-error-correct.stderr @@ -1,5 +1,5 @@ error: incorrect close delimiter: `}` - --> $DIR/token-error-correct.rs:16:1 + --> $DIR/token-error-correct.rs:6:1 | LL | fn main() { | - close delimiter possibly meant for this @@ -10,7 +10,7 @@ LL | } | ^ incorrect close delimiter error: expected expression, found `;` - --> $DIR/token-error-correct.rs:14:13 + --> $DIR/token-error-correct.rs:4:13 | LL | foo(bar(; | ^ expected expression diff --git a/src/test/ui/resolve/tuple-struct-alias.rs b/src/test/ui/resolve/tuple-struct-alias.rs index 1f3588dd3ca..65977e1110c 100644 --- a/src/test/ui/resolve/tuple-struct-alias.rs +++ b/src/test/ui/resolve/tuple-struct-alias.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S(u8, u16); type A = S; diff --git a/src/test/ui/resolve/tuple-struct-alias.stderr b/src/test/ui/resolve/tuple-struct-alias.stderr index ad2ae4acb8b..f299aa40a31 100644 --- a/src/test/ui/resolve/tuple-struct-alias.stderr +++ b/src/test/ui/resolve/tuple-struct-alias.stderr @@ -1,16 +1,16 @@ error[E0423]: expected function, found type alias `A` - --> $DIR/tuple-struct-alias.rs:15:13 + --> $DIR/tuple-struct-alias.rs:5:13 | LL | let s = A(0, 1); //~ ERROR expected function - | ^ did you mean `S`? + | ^ help: a tuple struct with a similar name exists: `S` | = note: can't use a type alias as a constructor error[E0532]: expected tuple struct/variant, found type alias `A` - --> $DIR/tuple-struct-alias.rs:17:9 + --> $DIR/tuple-struct-alias.rs:7:9 | LL | A(..) => {} //~ ERROR expected tuple struct/variant - | ^ did you mean `S`? + | ^ help: a tuple struct with a similar name exists: `S` | = note: can't use a type alias as a constructor diff --git a/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.rs b/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.rs index 9d5e2e89666..87f9ce097c5 100644 --- a/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.rs +++ b/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f isize>(x: F) {} //~^ ERROR cannot find trait `Nonexist` diff --git a/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr b/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr index d293a77392e..70cabcbeb60 100644 --- a/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr +++ b/src/test/ui/resolve/unboxed-closure-sugar-nonexistent-trait.stderr @@ -1,11 +1,11 @@ error[E0405]: cannot find trait `Nonexist` in this scope - --> $DIR/unboxed-closure-sugar-nonexistent-trait.rs:11:8 + --> $DIR/unboxed-closure-sugar-nonexistent-trait.rs:1:8 | LL | fn f isize>(x: F) {} | ^^^^^^^^ not found in this scope error[E0404]: expected trait, found type alias `Typedef` - --> $DIR/unboxed-closure-sugar-nonexistent-trait.rs:16:8 + --> $DIR/unboxed-closure-sugar-nonexistent-trait.rs:6:8 | LL | fn g isize>(x: F) {} | ^^^^^^^^^^^^^^^^^^^^^^^ type aliases cannot be used as traits diff --git a/src/test/ui/resolve/unresolved_static_type_field.rs b/src/test/ui/resolve/unresolved_static_type_field.rs index 9ba39ce08c7..494ad083f1a 100644 --- a/src/test/ui/resolve/unresolved_static_type_field.rs +++ b/src/test/ui/resolve/unresolved_static_type_field.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f(_: bool) {} struct Foo { diff --git a/src/test/ui/resolve/unresolved_static_type_field.stderr b/src/test/ui/resolve/unresolved_static_type_field.stderr index a49ea3d3bd5..a5173243787 100644 --- a/src/test/ui/resolve/unresolved_static_type_field.stderr +++ b/src/test/ui/resolve/unresolved_static_type_field.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `cx` in this scope - --> $DIR/unresolved_static_type_field.rs:19:11 + --> $DIR/unresolved_static_type_field.rs:9:11 | LL | f(cx); | ^^ diff --git a/src/test/ui/resolve/use_suggestion_placement.rs b/src/test/ui/resolve/use_suggestion_placement.rs index 835c42e4553..9b8b9d88c79 100644 --- a/src/test/ui/resolve/use_suggestion_placement.rs +++ b/src/test/ui/resolve/use_suggestion_placement.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no std::path support macro_rules! y { diff --git a/src/test/ui/resolve/use_suggestion_placement.stderr b/src/test/ui/resolve/use_suggestion_placement.stderr index caae70900dc..dcbb8dfe665 100644 --- a/src/test/ui/resolve/use_suggestion_placement.stderr +++ b/src/test/ui/resolve/use_suggestion_placement.stderr @@ -1,5 +1,5 @@ error[E0412]: cannot find type `Path` in this scope - --> $DIR/use_suggestion_placement.rs:27:16 + --> $DIR/use_suggestion_placement.rs:17:16 | LL | type Bar = Path; //~ ERROR cannot find | ^^^^ not found in this scope @@ -9,7 +9,7 @@ LL | use std::path::Path; | error[E0425]: cannot find value `A` in this scope - --> $DIR/use_suggestion_placement.rs:32:13 + --> $DIR/use_suggestion_placement.rs:22:13 | LL | let _ = A; //~ ERROR cannot find | ^ not found in this scope @@ -19,7 +19,7 @@ LL | use m::A; | error[E0412]: cannot find type `HashMap` in this scope - --> $DIR/use_suggestion_placement.rs:37:23 + --> $DIR/use_suggestion_placement.rs:27:23 | LL | type Dict = HashMap; //~ ERROR cannot find | ^^^^^^^ not found in this scope diff --git a/src/test/ui/resolve_self_super_hint.rs b/src/test/ui/resolve_self_super_hint.rs index 2ce2d765832..193a6ecf9d5 100644 --- a/src/test/ui/resolve_self_super_hint.rs +++ b/src/test/ui/resolve_self_super_hint.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(alloc)] #![allow(unused_extern_crates)] diff --git a/src/test/ui/resolve_self_super_hint.stderr b/src/test/ui/resolve_self_super_hint.stderr index 613107712b2..ddae0e5f6aa 100644 --- a/src/test/ui/resolve_self_super_hint.stderr +++ b/src/test/ui/resolve_self_super_hint.stderr @@ -1,23 +1,23 @@ error[E0432]: unresolved import `alloc` - --> $DIR/resolve_self_super_hint.rs:16:9 + --> $DIR/resolve_self_super_hint.rs:6:9 | LL | use alloc::HashMap; | ^^^^^ did you mean `self::alloc`? error[E0432]: unresolved import `alloc` - --> $DIR/resolve_self_super_hint.rs:20:13 + --> $DIR/resolve_self_super_hint.rs:10:13 | LL | use alloc::HashMap; | ^^^^^ did you mean `super::alloc`? error[E0432]: unresolved import `alloc` - --> $DIR/resolve_self_super_hint.rs:24:17 + --> $DIR/resolve_self_super_hint.rs:14:17 | LL | use alloc::HashMap; | ^^^^^ did you mean `a::alloc`? error[E0432]: unresolved import `alloc` - --> $DIR/resolve_self_super_hint.rs:28:21 + --> $DIR/resolve_self_super_hint.rs:18:21 | LL | use alloc::HashMap; | ^^^^^ did you mean `a::alloc`? diff --git a/src/test/ui/ret-non-nil.rs b/src/test/ui/ret-non-nil.rs index 6be98fbd827..86c02bf38e6 100644 --- a/src/test/ui/ret-non-nil.rs +++ b/src/test/ui/ret-non-nil.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: `return;` in a function whose return type is not `()` fn f() { return; } diff --git a/src/test/ui/ret-non-nil.stderr b/src/test/ui/ret-non-nil.stderr index 01f126bd11e..2029c6d9d81 100644 --- a/src/test/ui/ret-non-nil.stderr +++ b/src/test/ui/ret-non-nil.stderr @@ -1,8 +1,10 @@ error[E0069]: `return;` in a function whose return type is not `()` - --> $DIR/ret-non-nil.rs:15:19 + --> $DIR/ret-non-nil.rs:5:19 | LL | fn g() -> isize { return; } - | ^^^^^^ return type is not () + | ----- ^^^^^^ return type is not `()` + | | + | expected `isize` because of this return type error: aborting due to previous error diff --git a/src/test/ui/retslot-cast.rs b/src/test/ui/retslot-cast.rs index a4681633326..ae500cb15df 100644 --- a/src/test/ui/retslot-cast.rs +++ b/src/test/ui/retslot-cast.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - #![allow(warnings)] pub fn fail(x: Option<&(Iterator+Send)>) diff --git a/src/test/ui/retslot-cast.stderr b/src/test/ui/retslot-cast.stderr index 34f6e11f614..855aa501082 100644 --- a/src/test/ui/retslot-cast.stderr +++ b/src/test/ui/retslot-cast.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/retslot-cast.rs:24:5 + --> $DIR/retslot-cast.rs:13:5 | LL | inner(x) //~ ERROR mismatched types | ^^^^^^^^ expected trait `std::iter::Iterator`, found trait `std::iter::Iterator + std::marker::Send` diff --git a/src/test/ui/return/return-from-diverging.rs b/src/test/ui/return/return-from-diverging.rs index cec59faa918..faeccaace69 100644 --- a/src/test/ui/return/return-from-diverging.rs +++ b/src/test/ui/return/return-from-diverging.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that return another type in place of ! raises a type mismatch. fn fail() -> ! { diff --git a/src/test/ui/return/return-from-diverging.stderr b/src/test/ui/return/return-from-diverging.stderr index d965d734327..2862ae641df 100644 --- a/src/test/ui/return/return-from-diverging.stderr +++ b/src/test/ui/return/return-from-diverging.stderr @@ -1,6 +1,8 @@ error[E0308]: mismatched types - --> $DIR/return-from-diverging.rs:14:12 + --> $DIR/return-from-diverging.rs:4:12 | +LL | fn fail() -> ! { + | - expected `!` because of return type LL | return "wow"; //~ ERROR mismatched types | ^^^^^ expected !, found reference | diff --git a/src/test/ui/return/return-match-array-const.rs b/src/test/ui/return/return-match-array-const.rs index 45fc571d79d..bbcd9600b22 100644 --- a/src/test/ui/return/return-match-array-const.rs +++ b/src/test/ui/return/return-match-array-const.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { [(); return match 0 { n => n }]; //~ ERROR: return statement outside of function body diff --git a/src/test/ui/return/return-match-array-const.stderr b/src/test/ui/return/return-match-array-const.stderr index 044dc8f5145..763b3d987d7 100644 --- a/src/test/ui/return/return-match-array-const.stderr +++ b/src/test/ui/return/return-match-array-const.stderr @@ -1,17 +1,17 @@ error[E0572]: return statement outside of function body - --> $DIR/return-match-array-const.rs:12:10 + --> $DIR/return-match-array-const.rs:2:10 | LL | [(); return match 0 { n => n }]; //~ ERROR: return statement outside of function body | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0572]: return statement outside of function body - --> $DIR/return-match-array-const.rs:14:10 + --> $DIR/return-match-array-const.rs:4:10 | LL | [(); return match 0 { 0 => 0 }]; //~ ERROR: return statement outside of function body | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0572]: return statement outside of function body - --> $DIR/return-match-array-const.rs:16:10 + --> $DIR/return-match-array-const.rs:6:10 | LL | [(); return match () { 'a' => 0, _ => 0 }]; //~ ERROR: return statement outside of function body | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/return/return-type.rs b/src/test/ui/return/return-type.rs index e63787949a4..9f951ee0dd1 100644 --- a/src/test/ui/return/return-type.rs +++ b/src/test/ui/return/return-type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S { t: T, } diff --git a/src/test/ui/return/return-type.stderr b/src/test/ui/return/return-type.stderr index 7d7653eee28..6eeec41b94c 100644 --- a/src/test/ui/return/return-type.stderr +++ b/src/test/ui/return/return-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/return-type.rs:20:5 + --> $DIR/return-type.rs:10:5 | LL | foo(4 as usize) | ^^^^^^^^^^^^^^^ expected (), found struct `S` diff --git a/src/test/ui/return/return-unit-from-diverging.rs b/src/test/ui/return/return-unit-from-diverging.rs index ae2a325b24a..31a13784b47 100644 --- a/src/test/ui/return/return-unit-from-diverging.rs +++ b/src/test/ui/return/return-unit-from-diverging.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we get the usual error that we'd get for any other return type and not something about // diverging functions not being able to return. diff --git a/src/test/ui/return/return-unit-from-diverging.stderr b/src/test/ui/return/return-unit-from-diverging.stderr index 38d4ca37366..19eccac3433 100644 --- a/src/test/ui/return/return-unit-from-diverging.stderr +++ b/src/test/ui/return/return-unit-from-diverging.stderr @@ -1,8 +1,10 @@ error[E0069]: `return;` in a function whose return type is not `()` - --> $DIR/return-unit-from-diverging.rs:15:5 + --> $DIR/return-unit-from-diverging.rs:5:5 | +LL | fn fail() -> ! { + | - expected `!` because of this return type LL | return; //~ ERROR in a function whose return type is not - | ^^^^^^ return type is not () + | ^^^^^^ return type is not `()` error: aborting due to previous error diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-impl-trait.rs b/src/test/ui/rfc-1937-termination-trait/termination-trait-impl-trait.rs index 92d21864c74..8f65144b140 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-impl-trait.rs +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-impl-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that an `impl Trait` that is not `impl Termination` will not work. fn main() -> impl Copy { } //~^ ERROR `main` has invalid return type `impl std::marker::Copy` diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-impl-trait.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-impl-trait.stderr index 7485f3066bb..8a718183a83 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-impl-trait.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-impl-trait.stderr @@ -1,5 +1,5 @@ error[E0277]: `main` has invalid return type `impl std::marker::Copy` - --> $DIR/termination-trait-impl-trait.rs:12:14 + --> $DIR/termination-trait-impl-trait.rs:2:14 | LL | fn main() -> impl Copy { } | ^^^^^^^^^ `main` can only return types that implement `std::process::Termination` diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.rs b/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.rs index a0b2784214a..96808a3ed91 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.rs +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test #![feature(test)] diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr index bfdcf01c325..23a56bf8fec 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr @@ -1,5 +1,5 @@ error: functions using `#[should_panic]` must return `()` - --> $DIR/termination-trait-in-test-should-panic.rs:21:1 + --> $DIR/termination-trait-in-test-should-panic.rs:11:1 | LL | / fn not_a_num() -> Result<(), ParseIntError> { LL | | //~^ ERROR functions using `#[should_panic]` must return `()` diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test.rs b/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test.rs index 0561b12221d..39825c4f9a9 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test.rs +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test // run-pass diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.rs b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.rs index 49f5621de1b..09bd1c8492f 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.rs +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() -> i32 { //~^ ERROR `main` has invalid return type `i32` //~| NOTE `main` can only return types that implement `std::process::Termination` diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.stderr index 6f780d1cf1d..e88e3d884ec 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.stderr @@ -1,5 +1,5 @@ error[E0277]: `main` has invalid return type `i32` - --> $DIR/termination-trait-main-i32.rs:11:14 + --> $DIR/termination-trait-main-i32.rs:1:14 | LL | fn main() -> i32 { | ^^^ `main` can only return types that implement `std::process::Termination` diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.rs b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.rs index 425f51ca2fb..687d5f144f7 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.rs +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() -> char { //~ ERROR ' ' } diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.stderr index e5387259384..c1be04ca881 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.stderr @@ -1,5 +1,5 @@ error[E0277]: `main` has invalid return type `char` - --> $DIR/termination-trait-main-wrong-type.rs:11:14 + --> $DIR/termination-trait-main-wrong-type.rs:1:14 | LL | fn main() -> char { //~ ERROR | ^^^^ `main` can only return types that implement `std::process::Termination` diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.rs b/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.rs index b5f5472b492..4c6168abb46 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.rs +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct ReturnType {} fn main() -> ReturnType { //~ ERROR `main` has invalid return type `ReturnType` diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr index e1b173725d4..2f05f9b0f7a 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr @@ -1,5 +1,5 @@ error[E0277]: `main` has invalid return type `ReturnType` - --> $DIR/termination-trait-not-satisfied.rs:13:14 + --> $DIR/termination-trait-not-satisfied.rs:3:14 | LL | fn main() -> ReturnType { //~ ERROR `main` has invalid return type `ReturnType` | ^^^^^^^^^^ `main` can only return types that implement `std::process::Termination` diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.rs b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.rs index 6153d840c8a..c648f542857 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.rs +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test use std::num::ParseIntError; diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr index 0e95c053ce4..a99f852d99b 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr @@ -1,5 +1,5 @@ error[E0277]: `main` has invalid return type `std::result::Result` - --> $DIR/termination-trait-test-wrong-type.rs:16:1 + --> $DIR/termination-trait-test-wrong-type.rs:6:1 | LL | / fn can_parse_zero_as_f32() -> Result { //~ ERROR LL | | "0".parse() diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr index 84cd097e33c..9e242712b9e 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-issue-49631.rs:30:9 + --> $DIR/borrowck-issue-49631.rs:20:9 | LL | while let Some(Ok(string)) = foo.get() { | --- immutable borrow occurs here diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs index 8dc1627dc8b..54ab9f0ad33 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub struct Foo { } diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr index 2da5ac8d240..e946d41e234 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable - --> $DIR/borrowck-issue-49631.rs:30:9 + --> $DIR/borrowck-issue-49631.rs:20:9 | LL | while let Some(Ok(string)) = foo.get() { | --- - immutable borrow ends here diff --git a/src/test/ui/rfc-2005-default-binding-mode/const.rs b/src/test/ui/rfc-2005-default-binding-mode/const.rs index f80e47507ff..93df880408d 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/const.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/const.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // FIXME(tschottdorf): this test should pass. #[derive(PartialEq, Eq)] diff --git a/src/test/ui/rfc-2005-default-binding-mode/const.stderr b/src/test/ui/rfc-2005-default-binding-mode/const.stderr index 4849c39a5d0..7ce8a325632 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/const.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/const.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/const.rs:24:9 + --> $DIR/const.rs:14:9 | LL | FOO => {}, //~ ERROR mismatched types | ^^^ expected &Foo, found struct `Foo` diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr index a9b2bca434c..5920be4132a 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr @@ -1,17 +1,17 @@ error[E0594]: cannot assign to `*x` which is behind a `&` reference - --> $DIR/enum.rs:19:5 + --> $DIR/enum.rs:9:5 | LL | *x += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*x` which is behind a `&` reference - --> $DIR/enum.rs:23:9 + --> $DIR/enum.rs:13:9 | LL | *x += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*x` which is behind a `&` reference - --> $DIR/enum.rs:29:9 + --> $DIR/enum.rs:19:9 | LL | *x += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.rs b/src/test/ui/rfc-2005-default-binding-mode/enum.rs index a108653f85d..7609345404f 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Wrapper { Wrap(i32), } diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr index ad05de9f357..d29b0111d8b 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr @@ -1,17 +1,17 @@ error[E0594]: cannot assign to immutable borrowed content `*x` - --> $DIR/enum.rs:19:5 + --> $DIR/enum.rs:9:5 | LL | *x += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*x` - --> $DIR/enum.rs:23:9 + --> $DIR/enum.rs:13:9 | LL | *x += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*x` - --> $DIR/enum.rs:29:9 + --> $DIR/enum.rs:19:9 | LL | *x += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr index 4c6149a8b7b..2206c2f340e 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr @@ -1,17 +1,17 @@ error[E0594]: cannot assign to `*n` which is behind a `&` reference - --> $DIR/explicit-mut.rs:17:13 + --> $DIR/explicit-mut.rs:7:13 | LL | *n += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*n` which is behind a `&` reference - --> $DIR/explicit-mut.rs:25:13 + --> $DIR/explicit-mut.rs:15:13 | LL | *n += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*n` which is behind a `&` reference - --> $DIR/explicit-mut.rs:33:13 + --> $DIR/explicit-mut.rs:23:13 | LL | *n += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs index 8001d980174..73efddef6cd 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Verify the binding mode shifts - only when no `&` are auto-dereferenced is the // final default binding mode mutable. diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr index 8da67a6b5ee..e03f67760d7 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr @@ -1,17 +1,17 @@ error[E0594]: cannot assign to immutable borrowed content `*n` - --> $DIR/explicit-mut.rs:17:13 + --> $DIR/explicit-mut.rs:7:13 | LL | *n += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*n` - --> $DIR/explicit-mut.rs:25:13 + --> $DIR/explicit-mut.rs:15:13 | LL | *n += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*n` - --> $DIR/explicit-mut.rs:33:13 + --> $DIR/explicit-mut.rs:23:13 | LL | *n += 1; //~ ERROR cannot assign to immutable | ^^^^^^^ cannot borrow as mutable diff --git a/src/test/ui/rfc-2005-default-binding-mode/for.rs b/src/test/ui/rfc-2005-default-binding-mode/for.rs index a354d2216a9..2fa7852635c 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/for.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/for.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo {} pub fn main() { diff --git a/src/test/ui/rfc-2005-default-binding-mode/for.stderr b/src/test/ui/rfc-2005-default-binding-mode/for.stderr index dbd4bd5dbec..37aaa9cfd70 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/for.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/for.stderr @@ -1,5 +1,5 @@ error[E0009]: cannot bind by-move and by-ref in the same pattern - --> $DIR/for.rs:16:13 + --> $DIR/for.rs:6:13 | LL | for (n, mut m) in &tups { | - ^^^^^ by-move pattern here diff --git a/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs b/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs index 4f4c2a149a7..aa013d4bf35 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // FIXME(tschottdorf): This should compile. See #44912. pub fn main() { diff --git a/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr b/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr index 04fa3708ffb..ff8dce32b2a 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr @@ -1,5 +1,5 @@ error[E0409]: variable `x` is bound in inconsistent ways within the same match arm - --> $DIR/issue-44912-or.rs:16:35 + --> $DIR/issue-44912-or.rs:6:35 | LL | Some((x, 3)) | &Some((ref x, 5)) => x, | - first binding ^ bound in different ways diff --git a/src/test/ui/rfc-2005-default-binding-mode/lit.rs b/src/test/ui/rfc-2005-default-binding-mode/lit.rs index 209f5845346..ce79cfbdc1a 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/lit.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/lit.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // FIXME(tschottdorf): we want these to compile, but they don't. fn with_str() { diff --git a/src/test/ui/rfc-2005-default-binding-mode/lit.stderr b/src/test/ui/rfc-2005-default-binding-mode/lit.stderr index d5c230bc8de..b78b4432bbe 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/lit.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/lit.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/lit.rs:17:13 + --> $DIR/lit.rs:7:13 | LL | "abc" => true, //~ ERROR mismatched types | ^^^^^ expected &str, found str @@ -8,7 +8,7 @@ LL | "abc" => true, //~ ERROR mismatched types found type `&'static str` error[E0308]: mismatched types - --> $DIR/lit.rs:26:9 + --> $DIR/lit.rs:16:9 | LL | b"abc" => true, //~ ERROR mismatched types | ^^^^^^ expected &[u8], found array of 3 elements diff --git a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.rs b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.rs index 0b2318d7621..46fdfd678cc 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Without caching type lookups in FnCtxt.resolve_ty_and_def_ufcs // the error below would be reported twice (once when checking // for a non-ref pattern, once when processing the pattern). diff --git a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr index e3a613f9261..9d35e167075 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr @@ -1,8 +1,10 @@ error[E0599]: no associated item named `XXX` found for type `u32` in the current scope - --> $DIR/no-double-error.rs:18:9 + --> $DIR/no-double-error.rs:8:14 | LL | u32::XXX => { } //~ ERROR no associated item named - | ^^^^^^^^ associated item not found in `u32` + | -----^^^ + | | + | associated item not found in `u32` error: aborting due to previous error diff --git a/src/test/ui/rfc-2005-default-binding-mode/slice.rs b/src/test/ui/rfc-2005-default-binding-mode/slice.rs index fbe4dfe2161..fd85bf7f160 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(slice_patterns)] pub fn main() { diff --git a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr index 18dc6b2869a..1dfad0d3189 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `&[]` not covered - --> $DIR/slice.rs:16:11 + --> $DIR/slice.rs:6:11 | LL | match sl { //~ ERROR non-exhaustive patterns | ^^ pattern `&[]` not covered diff --git a/src/test/ui/rfc-2008-non-exhaustive/auxiliary/enums.rs b/src/test/ui/rfc-2008-non-exhaustive/auxiliary/enums.rs index 12d1bf9ea91..e3820599c72 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/auxiliary/enums.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/auxiliary/enums.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![feature(non_exhaustive)] diff --git a/src/test/ui/rfc-2008-non-exhaustive/auxiliary/structs.rs b/src/test/ui/rfc-2008-non-exhaustive/auxiliary/structs.rs index 4d083cc5315..ddfb9ad0037 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/auxiliary/structs.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/auxiliary/structs.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(non_exhaustive)] #[non_exhaustive] diff --git a/src/test/ui/rfc-2008-non-exhaustive/auxiliary/variants.rs b/src/test/ui/rfc-2008-non-exhaustive/auxiliary/variants.rs index d04c1073ad9..f590d0a3268 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/auxiliary/variants.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/auxiliary/variants.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "rlib"] #![feature(non_exhaustive)] diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum.rs b/src/test/ui/rfc-2008-non-exhaustive/enum.rs index 0c19210e4a0..d9b1a989510 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/enum.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:enums.rs extern crate enums; diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr index 5276746734d..acce9779067 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `_` not covered - --> $DIR/enum.rs:19:11 + --> $DIR/enum.rs:9:11 | LL | match enum_unit { | ^^^^^^^^^ pattern `_` not covered diff --git a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.rs b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.rs index df4fe1e77e9..3375210fc59 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(non_exhaustive)] #[non_exhaustive(anything)] -//~^ ERROR attribute should be empty [E0702] +//~^ ERROR attribute must be of the form struct Foo; #[non_exhaustive] diff --git a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr index d75ad9ec264..1d055fe8d4c 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr @@ -1,14 +1,11 @@ -error[E0702]: attribute should be empty - --> $DIR/invalid-attribute.rs:13:1 +error: attribute must be of the form `#[non_exhaustive]` + --> $DIR/invalid-attribute.rs:3:1 | LL | #[non_exhaustive(anything)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | //~^ ERROR attribute should be empty [E0702] -LL | struct Foo; - | ----------- not empty error[E0701]: attribute can only be applied to a struct or enum - --> $DIR/invalid-attribute.rs:17:1 + --> $DIR/invalid-attribute.rs:7:1 | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ @@ -17,7 +14,7 @@ LL | trait Bar { } | ------------- not a struct or enum error[E0701]: attribute can only be applied to a struct or enum - --> $DIR/invalid-attribute.rs:21:1 + --> $DIR/invalid-attribute.rs:11:1 | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ @@ -30,5 +27,4 @@ LL | | } error: aborting due to 3 previous errors -Some errors occurred: E0701, E0702. -For more information about an error, try `rustc --explain E0701`. +For more information about this error, try `rustc --explain E0701`. diff --git a/src/test/ui/rfc-2008-non-exhaustive/structs.rs b/src/test/ui/rfc-2008-non-exhaustive/structs.rs index 74c9c7c61ac..303d71d12df 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/structs.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/structs.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:structs.rs extern crate structs; diff --git a/src/test/ui/rfc-2008-non-exhaustive/structs.stderr b/src/test/ui/rfc-2008-non-exhaustive/structs.stderr index 141e4b73b58..4532b5c34cc 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/structs.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/structs.stderr @@ -1,29 +1,29 @@ error[E0423]: expected function, found struct `TupleStruct` - --> $DIR/structs.rs:30:14 + --> $DIR/structs.rs:20:14 | LL | let ts = TupleStruct(640, 480); | ^^^^^^^^^^^ constructor is not visible here due to private fields error[E0423]: expected value, found struct `UnitStruct` - --> $DIR/structs.rs:39:14 + --> $DIR/structs.rs:29:14 | LL | let us = UnitStruct; | ^^^^^^^^^^ constructor is not visible here due to private fields error[E0603]: tuple struct `TupleStruct` is private - --> $DIR/structs.rs:33:32 + --> $DIR/structs.rs:23:32 | LL | let ts_explicit = structs::TupleStruct(640, 480); | ^^^^^^^^^^^ error[E0603]: unit struct `UnitStruct` is private - --> $DIR/structs.rs:42:32 + --> $DIR/structs.rs:32:32 | LL | let us_explicit = structs::UnitStruct; | ^^^^^^^^^^ error[E0639]: cannot create non-exhaustive struct using struct expression - --> $DIR/structs.rs:17:14 + --> $DIR/structs.rs:7:14 | LL | let fr = FunctionalRecord { | ______________^ @@ -35,25 +35,25 @@ LL | | }; | |_____^ error[E0639]: cannot create non-exhaustive struct using struct expression - --> $DIR/structs.rs:24:14 + --> $DIR/structs.rs:14:14 | LL | let ns = NormalStruct { first_field: 640, second_field: 480 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0638]: `..` required with struct marked as non-exhaustive - --> $DIR/structs.rs:27:9 + --> $DIR/structs.rs:17:9 | LL | let NormalStruct { first_field, second_field } = ns; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0638]: `..` required with struct marked as non-exhaustive - --> $DIR/structs.rs:36:9 + --> $DIR/structs.rs:26:9 | LL | let TupleStruct { 0: first_field, 1: second_field } = ts; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0638]: `..` required with struct marked as non-exhaustive - --> $DIR/structs.rs:45:9 + --> $DIR/structs.rs:35:9 | LL | let UnitStruct { } = us; | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2008-non-exhaustive/variants.rs b/src/test/ui/rfc-2008-non-exhaustive/variants.rs index d1b65ac1f3e..373bbc3547f 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/variants.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/variants.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:variants.rs extern crate variants; diff --git a/src/test/ui/rfc-2008-non-exhaustive/variants_create.rs b/src/test/ui/rfc-2008-non-exhaustive/variants_create.rs index f4e4b1bb84b..9ed244144df 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/variants_create.rs +++ b/src/test/ui/rfc-2008-non-exhaustive/variants_create.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(non_exhaustive)] /* diff --git a/src/test/ui/rfc-2008-non-exhaustive/variants_create.stderr b/src/test/ui/rfc-2008-non-exhaustive/variants_create.stderr index 1e4e0943a69..5b099d58ec4 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/variants_create.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/variants_create.stderr @@ -1,17 +1,17 @@ error: #[non_exhaustive] is not yet supported on variants - --> $DIR/variants_create.rs:19:23 + --> $DIR/variants_create.rs:9:23 | LL | #[non_exhaustive] Unit, | ^^^^ error: #[non_exhaustive] is not yet supported on variants - --> $DIR/variants_create.rs:21:23 + --> $DIR/variants_create.rs:11:23 | LL | #[non_exhaustive] Tuple(u32), | ^^^^^^^^^^ error: #[non_exhaustive] is not yet supported on variants - --> $DIR/variants_create.rs:23:23 + --> $DIR/variants_create.rs:13:23 | LL | #[non_exhaustive] Struct { field: u32 } | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2093-infer-outlives/cross-crate.rs b/src/test/ui/rfc-2093-infer-outlives/cross-crate.rs index cc659cd14b1..ce50452dd52 100644 --- a/src/test/ui/rfc-2093-infer-outlives/cross-crate.rs +++ b/src/test/ui/rfc-2093-infer-outlives/cross-crate.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_outlives] -struct Foo<'a, T> { //~ ERROR 14:1: 16:2: rustc_outlives +struct Foo<'a, T> { //~ ERROR rustc_outlives bar: std::slice::IterMut<'a, T> } diff --git a/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr b/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr index dd00c14ea16..850e7caec54 100644 --- a/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr @@ -1,7 +1,7 @@ error: rustc_outlives - --> $DIR/cross-crate.rs:14:1 + --> $DIR/cross-crate.rs:4:1 | -LL | / struct Foo<'a, T> { //~ ERROR 14:1: 16:2: rustc_outlives +LL | / struct Foo<'a, T> { //~ ERROR rustc_outlives LL | | bar: std::slice::IterMut<'a, T> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.rs b/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.rs index 47dc5dfdc96..812e8c8bb3e 100644 --- a/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.rs +++ b/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength /* @@ -17,7 +7,7 @@ */ struct Foo { - bar: Bar //~ ERROR 20:5: 20:16: the parameter type `U` may not live long enough [E0310] + bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] } struct Bar { x: T, diff --git a/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr b/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr index 5d8cf0aa324..e4f4b58fb33 100644 --- a/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr @@ -1,15 +1,15 @@ error[E0310]: the parameter type `U` may not live long enough - --> $DIR/dont-infer-static.rs:20:5 + --> $DIR/dont-infer-static.rs:10:5 | LL | struct Foo { | - help: consider adding an explicit lifetime bound `U: 'static`... -LL | bar: Bar //~ ERROR 20:5: 20:16: the parameter type `U` may not live long enough [E0310] +LL | bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] | ^^^^^^^^^^^ | note: ...so that the type `U` will meet its required lifetime bounds - --> $DIR/dont-infer-static.rs:20:5 + --> $DIR/dont-infer-static.rs:10:5 | -LL | bar: Bar //~ ERROR 20:5: 20:16: the parameter type `U` may not live long enough [E0310] +LL | bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/rfc-2093-infer-outlives/enum.rs b/src/test/ui/rfc-2093-infer-outlives/enum.rs index b2c18b274ce..622794ea9ac 100644 --- a/src/test/ui/rfc-2093-infer-outlives/enum.rs +++ b/src/test/ui/rfc-2093-infer-outlives/enum.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![feature(rustc_attrs)] diff --git a/src/test/ui/rfc-2093-infer-outlives/enum.stderr b/src/test/ui/rfc-2093-infer-outlives/enum.stderr index e621c435eea..c8e730090fc 100644 --- a/src/test/ui/rfc-2093-infer-outlives/enum.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/enum.stderr @@ -1,5 +1,5 @@ error: rustc_outlives - --> $DIR/enum.rs:19:1 + --> $DIR/enum.rs:9:1 | LL | / enum Foo<'a, T> { //~ ERROR rustc_outlives LL | | One(Bar<'a, T>) @@ -9,7 +9,7 @@ LL | | } = note: T : 'a error: rustc_outlives - --> $DIR/enum.rs:25:1 + --> $DIR/enum.rs:15:1 | LL | / struct Bar<'b, U> { //~ ERROR rustc_outlives LL | | field2: &'b U @@ -19,7 +19,7 @@ LL | | } = note: U : 'b error: rustc_outlives - --> $DIR/enum.rs:31:1 + --> $DIR/enum.rs:21:1 | LL | / enum Ying<'c, K> { //~ ERROR rustc_outlives LL | | One(&'c Yang) diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.rs index 92642595209..e33d57d642b 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.rs +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(dyn_trait)] #![feature(rustc_attrs)] @@ -15,7 +5,7 @@ trait Trait<'x, T> where T: 'x { } #[rustc_outlives] -struct Foo<'a, A> //~ ERROR 18:1: 21:2: rustc_outlives +struct Foo<'a, A> //~ ERROR rustc_outlives { foo: Box> } diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr index 5d167493308..a5bee93a150 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr @@ -1,7 +1,7 @@ error: rustc_outlives - --> $DIR/explicit-dyn.rs:18:1 + --> $DIR/explicit-dyn.rs:8:1 | -LL | / struct Foo<'a, A> //~ ERROR 18:1: 21:2: rustc_outlives +LL | / struct Foo<'a, A> //~ ERROR rustc_outlives LL | | { LL | | foo: Box> LL | | } diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-enum.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.rs index 0ac75fc2556..b7a66a326b8 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-enum.rs +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_outlives] -enum Foo<'a, U> { //~ ERROR 14:1: 16:2: rustc_outlives +enum Foo<'a, U> { //~ ERROR rustc_outlives One(Bar<'a, U>) } diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr index 33ef4b7e6a1..2149e0533c6 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr @@ -1,7 +1,7 @@ error: rustc_outlives - --> $DIR/explicit-enum.rs:14:1 + --> $DIR/explicit-enum.rs:4:1 | -LL | / enum Foo<'a, U> { //~ ERROR 14:1: 16:2: rustc_outlives +LL | / enum Foo<'a, U> { //~ ERROR rustc_outlives LL | | One(Bar<'a, U>) LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-projection.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.rs index 02c171627e6..00b89528865 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-projection.rs +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] trait Trait<'x, T> where T: 'x { diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr index 5480130c2d3..46793b1690a 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr @@ -1,5 +1,5 @@ error: rustc_outlives - --> $DIR/explicit-projection.rs:18:1 + --> $DIR/explicit-projection.rs:8:1 | LL | / struct Foo<'a, A, B> where A: Trait<'a, B> //~ ERROR rustc_outlives LL | | { diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-struct.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.rs index 4dc01a52210..3c69f9f612e 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-struct.rs +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_outlives] -struct Foo<'b, U> { //~ ERROR 14:1: 16:2: rustc_outlives +struct Foo<'b, U> { //~ ERROR rustc_outlives bar: Bar<'b, U> } diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr index 7655dec5cb8..b694b7a9543 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr @@ -1,7 +1,7 @@ error: rustc_outlives - --> $DIR/explicit-struct.rs:14:1 + --> $DIR/explicit-struct.rs:4:1 | -LL | / struct Foo<'b, U> { //~ ERROR 14:1: 16:2: rustc_outlives +LL | / struct Foo<'b, U> { //~ ERROR rustc_outlives LL | | bar: Bar<'b, U> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-union.rs b/src/test/ui/rfc-2093-infer-outlives/explicit-union.rs index ae4b9b15f68..87a789b06a0 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-union.rs +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-union.rs @@ -1,19 +1,9 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #![feature(untagged_unions)] #![allow(unions_with_drop_fields)] #[rustc_outlives] -union Foo<'b, U> { //~ ERROR 16:1: 18:2: rustc_outlives +union Foo<'b, U> { //~ ERROR rustc_outlives bar: Bar<'b, U> } diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr index c01c7532c86..d70fad9d830 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr @@ -1,7 +1,7 @@ error: rustc_outlives - --> $DIR/explicit-union.rs:16:1 + --> $DIR/explicit-union.rs:6:1 | -LL | / union Foo<'b, U> { //~ ERROR 16:1: 18:2: rustc_outlives +LL | / union Foo<'b, U> { //~ ERROR rustc_outlives LL | | bar: Bar<'b, U> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/infer-static.rs b/src/test/ui/rfc-2093-infer-outlives/infer-static.rs index c4407b8b89f..916d4849edb 100644 --- a/src/test/ui/rfc-2093-infer-outlives/infer-static.rs +++ b/src/test/ui/rfc-2093-infer-outlives/infer-static.rs @@ -1,18 +1,8 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #![feature(infer_static_outlives_requirements)] #[rustc_outlives] -struct Foo { //~ ERROR 15:1: 17:2: rustc_outlives +struct Foo { //~ ERROR rustc_outlives bar: Bar } struct Bar { diff --git a/src/test/ui/rfc-2093-infer-outlives/infer-static.stderr b/src/test/ui/rfc-2093-infer-outlives/infer-static.stderr index 0cb4f3faa33..b3a827f38c5 100644 --- a/src/test/ui/rfc-2093-infer-outlives/infer-static.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/infer-static.stderr @@ -1,7 +1,7 @@ error: rustc_outlives - --> $DIR/infer-static.rs:15:1 + --> $DIR/infer-static.rs:5:1 | -LL | / struct Foo { //~ ERROR 15:1: 17:2: rustc_outlives +LL | / struct Foo { //~ ERROR rustc_outlives LL | | bar: Bar LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-enum.rs b/src/test/ui/rfc-2093-infer-outlives/nested-enum.rs index 5cb365b7a7b..0cd706e7ab6 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-enum.rs +++ b/src/test/ui/rfc-2093-infer-outlives/nested-enum.rs @@ -1,17 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_outlives] -enum Foo<'a, T> { //~ ERROR 14:1: 17:2: rustc_outlives +enum Foo<'a, T> { //~ ERROR rustc_outlives One(Bar<'a, T>) } diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr index f0a6905d14b..76d18bbee9d 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr @@ -1,7 +1,7 @@ error: rustc_outlives - --> $DIR/nested-enum.rs:14:1 + --> $DIR/nested-enum.rs:4:1 | -LL | / enum Foo<'a, T> { //~ ERROR 14:1: 17:2: rustc_outlives +LL | / enum Foo<'a, T> { //~ ERROR rustc_outlives LL | | LL | | One(Bar<'a, T>) LL | | } diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-regions.rs b/src/test/ui/rfc-2093-infer-outlives/nested-regions.rs index e56d7d7a053..a01c5068171 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-regions.rs +++ b/src/test/ui/rfc-2093-infer-outlives/nested-regions.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_outlives] -struct Foo<'a, 'b, T> { //~ ERROR 14:1: 16:2: rustc_outlives +struct Foo<'a, 'b, T> { //~ ERROR rustc_outlives x: &'a &'b T } diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr index 978fe352bc7..2900a29ed7c 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr @@ -1,7 +1,7 @@ error: rustc_outlives - --> $DIR/nested-regions.rs:14:1 + --> $DIR/nested-regions.rs:4:1 | -LL | / struct Foo<'a, 'b, T> { //~ ERROR 14:1: 16:2: rustc_outlives +LL | / struct Foo<'a, 'b, T> { //~ ERROR rustc_outlives LL | | x: &'a &'b T LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-structs.rs b/src/test/ui/rfc-2093-infer-outlives/nested-structs.rs index 84d1b881880..ac6817d22bd 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-structs.rs +++ b/src/test/ui/rfc-2093-infer-outlives/nested-structs.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_outlives] -struct Foo<'a, T> { //~ ERROR 14:1: 16:2: rustc_outlives +struct Foo<'a, T> { //~ ERROR rustc_outlives field1: Bar<'a, T> } diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr index db02232b913..e8b822df950 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr @@ -1,7 +1,7 @@ error: rustc_outlives - --> $DIR/nested-structs.rs:14:1 + --> $DIR/nested-structs.rs:4:1 | -LL | / struct Foo<'a, T> { //~ ERROR 14:1: 16:2: rustc_outlives +LL | / struct Foo<'a, T> { //~ ERROR rustc_outlives LL | | field1: Bar<'a, T> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-union.rs b/src/test/ui/rfc-2093-infer-outlives/nested-union.rs index 974675f51c7..0ff667fbeba 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-union.rs +++ b/src/test/ui/rfc-2093-infer-outlives/nested-union.rs @@ -1,19 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #![feature(untagged_unions)] #![allow(unions_with_drop_fields)] #[rustc_outlives] -union Foo<'a, T> { //~ ERROR 16:1: 18:2: rustc_outlives +union Foo<'a, T> { //~ ERROR rustc_outlives field1: Bar<'a, T> } diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr index 2704a1d2def..56a2f873c76 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr @@ -1,7 +1,7 @@ error: rustc_outlives - --> $DIR/nested-union.rs:16:1 + --> $DIR/nested-union.rs:6:1 | -LL | / union Foo<'a, T> { //~ ERROR 16:1: 18:2: rustc_outlives +LL | / union Foo<'a, T> { //~ ERROR rustc_outlives LL | | field1: Bar<'a, T> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/projection.rs b/src/test/ui/rfc-2093-infer-outlives/projection.rs index 7693d0e9401..0b9637e9528 100644 --- a/src/test/ui/rfc-2093-infer-outlives/projection.rs +++ b/src/test/ui/rfc-2093-infer-outlives/projection.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_outlives] diff --git a/src/test/ui/rfc-2093-infer-outlives/projection.stderr b/src/test/ui/rfc-2093-infer-outlives/projection.stderr index fb4835ae2d8..73d2420af00 100644 --- a/src/test/ui/rfc-2093-infer-outlives/projection.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/projection.stderr @@ -1,5 +1,5 @@ error: rustc_outlives - --> $DIR/projection.rs:14:1 + --> $DIR/projection.rs:4:1 | LL | / struct Foo<'a, T: Iterator> { //~ ERROR rustc_outlives LL | | bar: &'a T::Item diff --git a/src/test/ui/rfc-2093-infer-outlives/reference.rs b/src/test/ui/rfc-2093-infer-outlives/reference.rs index 760d9889bbe..a48a3315aa9 100644 --- a/src/test/ui/rfc-2093-infer-outlives/reference.rs +++ b/src/test/ui/rfc-2093-infer-outlives/reference.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_outlives] diff --git a/src/test/ui/rfc-2093-infer-outlives/reference.stderr b/src/test/ui/rfc-2093-infer-outlives/reference.stderr index fdd312f9b89..41a8de2d84b 100644 --- a/src/test/ui/rfc-2093-infer-outlives/reference.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/reference.stderr @@ -1,5 +1,5 @@ error: rustc_outlives - --> $DIR/reference.rs:14:1 + --> $DIR/reference.rs:4:1 | LL | / struct Foo<'a, T> { //~ ERROR rustc_outlives LL | | bar: &'a T, diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.rs b/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.rs index a2d3cf6779f..781cdb7286a 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.rs +++ b/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength // Various examples of structs whose fields are not well-formed. @@ -42,9 +32,9 @@ enum RefIndirect<'a, T> { RefIndirectVariant1(isize, RefOk<'a,T>) } -enum RefDouble<'a, 'b, T> { //~ ERROR 45:1: 48:2: the parameter type `T` may not live long enough [E0309] +enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] RefDoubleVariant1(&'a RequireOutlives<'b, T>) - //~^ 46:23: 46:49: the parameter type `T` may not live long enough [E0309] + //~^ the parameter type `T` may not live long enough [E0309] } fn main() { } diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.stderr index 923ea17622a..d10f7ed28fc 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-enum-not-wf.rs:28:18 + --> $DIR/regions-enum-not-wf.rs:18:18 | LL | enum Ref1<'a, T> { | - help: consider adding an explicit lifetime bound `T: 'a`... @@ -7,13 +7,13 @@ LL | Ref1Variant1(RequireOutlives<'a, T>) //~ ERROR the parameter type `T` m | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-enum-not-wf.rs:28:18 + --> $DIR/regions-enum-not-wf.rs:18:18 | LL | Ref1Variant1(RequireOutlives<'a, T>) //~ ERROR the parameter type `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-enum-not-wf.rs:33:25 + --> $DIR/regions-enum-not-wf.rs:23:25 | LL | enum Ref2<'a, T> { | - help: consider adding an explicit lifetime bound `T: 'a`... @@ -22,42 +22,42 @@ LL | Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter ty | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-enum-not-wf.rs:33:25 + --> $DIR/regions-enum-not-wf.rs:23:25 | LL | Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter type `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-enum-not-wf.rs:45:1 + --> $DIR/regions-enum-not-wf.rs:35:1 | -LL | enum RefDouble<'a, 'b, T> { //~ ERROR 45:1: 48:2: the parameter type `T` may not live long enough [E0309] +LL | enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] | ^ - help: consider adding an explicit lifetime bound `T: 'b`... | _| | | LL | | RefDoubleVariant1(&'a RequireOutlives<'b, T>) -LL | | //~^ 46:23: 46:49: the parameter type `T` may not live long enough [E0309] +LL | | //~^ the parameter type `T` may not live long enough [E0309] LL | | } | |_^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-enum-not-wf.rs:45:1 + --> $DIR/regions-enum-not-wf.rs:35:1 | -LL | / enum RefDouble<'a, 'b, T> { //~ ERROR 45:1: 48:2: the parameter type `T` may not live long enough [E0309] +LL | / enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] LL | | RefDoubleVariant1(&'a RequireOutlives<'b, T>) -LL | | //~^ 46:23: 46:49: the parameter type `T` may not live long enough [E0309] +LL | | //~^ the parameter type `T` may not live long enough [E0309] LL | | } | |_^ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-enum-not-wf.rs:46:23 + --> $DIR/regions-enum-not-wf.rs:36:23 | -LL | enum RefDouble<'a, 'b, T> { //~ ERROR 45:1: 48:2: the parameter type `T` may not live long enough [E0309] +LL | enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] | - help: consider adding an explicit lifetime bound `T: 'b`... LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-enum-not-wf.rs:46:23 + --> $DIR/regions-enum-not-wf.rs:36:23 | LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.rs b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.rs index 77b5b401c42..36b024d2ecb 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.rs +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its // arguments (like `'a`) outlive `'b`. // diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr index bd4682f0acf..4b7732251b0 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr @@ -1,16 +1,16 @@ error[E0491]: in type `&'a rev_variant_struct_region::Foo<'b>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-nominal-type-region-rev.rs:27:9 + --> $DIR/regions-outlives-nominal-type-region-rev.rs:17:9 | LL | type Out = &'a Foo<'b>; //~ ERROR reference has a longer lifetime | ^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the impl at 26:10 - --> $DIR/regions-outlives-nominal-type-region-rev.rs:26:10 +note: the pointer is valid for the lifetime 'a as defined on the impl at 16:10 + --> $DIR/regions-outlives-nominal-type-region-rev.rs:16:10 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 26:14 - --> $DIR/regions-outlives-nominal-type-region-rev.rs:26:14 +note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 16:14 + --> $DIR/regions-outlives-nominal-type-region-rev.rs:16:14 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.rs b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.rs index b6ac7aa3a9c..47a38f7c405 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.rs +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its // arguments (like `'a`) outlive `'b`. // diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr index 3fdfb673b37..9cabc973d1a 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr @@ -1,16 +1,16 @@ error[E0491]: in type `&'a variant_struct_region::Foo<'b>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-nominal-type-region.rs:27:9 + --> $DIR/regions-outlives-nominal-type-region.rs:17:9 | LL | type Out = &'a Foo<'b>; //~ ERROR reference has a longer lifetime | ^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the impl at 26:10 - --> $DIR/regions-outlives-nominal-type-region.rs:26:10 +note: the pointer is valid for the lifetime 'a as defined on the impl at 16:10 + --> $DIR/regions-outlives-nominal-type-region.rs:16:10 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 26:14 - --> $DIR/regions-outlives-nominal-type-region.rs:26:14 +note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 16:14 + --> $DIR/regions-outlives-nominal-type-region.rs:16:14 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.rs b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.rs index 3f7d086a6ae..083ba89484e 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.rs +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its // arguments (like `'a`) outlive `'b`. // diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr index 166e95cdedd..6142228664a 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr @@ -1,16 +1,16 @@ error[E0491]: in type `&'a variant_struct_type::Foo<&'b i32>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-nominal-type-type-rev.rs:27:9 + --> $DIR/regions-outlives-nominal-type-type-rev.rs:17:9 | LL | type Out = &'a Foo<&'b i32>; //~ ERROR reference has a longer lifetime | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the impl at 26:10 - --> $DIR/regions-outlives-nominal-type-type-rev.rs:26:10 +note: the pointer is valid for the lifetime 'a as defined on the impl at 16:10 + --> $DIR/regions-outlives-nominal-type-type-rev.rs:16:10 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 26:14 - --> $DIR/regions-outlives-nominal-type-type-rev.rs:26:14 +note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 16:14 + --> $DIR/regions-outlives-nominal-type-type-rev.rs:16:14 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.rs b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.rs index dff9b8a862f..f3e4e39ac23 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.rs +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a nominal type (like `Foo<'a>`) outlives `'b` if its // arguments (like `'a`) outlive `'b`. // diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr index 54952ec1676..0831f3acef2 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr @@ -1,16 +1,16 @@ error[E0491]: in type `&'a variant_struct_type::Foo<&'b i32>`, reference has a longer lifetime than the data it references - --> $DIR/regions-outlives-nominal-type-type.rs:27:9 + --> $DIR/regions-outlives-nominal-type-type.rs:17:9 | LL | type Out = &'a Foo<&'b i32>; //~ ERROR reference has a longer lifetime | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the impl at 26:10 - --> $DIR/regions-outlives-nominal-type-type.rs:26:10 +note: the pointer is valid for the lifetime 'a as defined on the impl at 16:10 + --> $DIR/regions-outlives-nominal-type-type.rs:16:10 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 26:14 - --> $DIR/regions-outlives-nominal-type-type.rs:26:14 +note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 16:14 + --> $DIR/regions-outlives-nominal-type-type.rs:16:14 | LL | impl<'a, 'b> Trait<'a, 'b> for usize { | ^^ diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.rs b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.rs index bdd708197bc..552c6cf0010 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.rs +++ b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Various examples of structs whose fields are not well-formed. #![allow(dead_code)] @@ -20,7 +10,7 @@ trait Trait1<'a, 'b, T> { } impl<'a, T> Trait<'a, T> for usize { - type Out = &'a T; + type Out = &'a T; //~ ERROR `T` may not live long enough } struct RefOk<'a, T:'a> { @@ -28,11 +18,11 @@ struct RefOk<'a, T:'a> { } impl<'a, T> Trait<'a, T> for u32 { - type Out = RefOk<'a, T>; + type Out = RefOk<'a, T>; //~ ERROR `T` may not live long enough } impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { - type Out = &'a &'b T; + type Out = &'a &'b T; //~ ERROR reference has a longer lifetime than the data } fn main() { } diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr index d8c8b6c3ccc..2485c7c3659 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr @@ -1,44 +1,44 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-struct-not-wf.rs:23:5 + --> $DIR/regions-struct-not-wf.rs:13:5 | LL | impl<'a, T> Trait<'a, T> for usize { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a T; +LL | type Out = &'a T; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a T` does not outlive the data it points at - --> $DIR/regions-struct-not-wf.rs:23:5 + --> $DIR/regions-struct-not-wf.rs:13:5 | -LL | type Out = &'a T; +LL | type Out = &'a T; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/regions-struct-not-wf.rs:31:5 + --> $DIR/regions-struct-not-wf.rs:21:5 | LL | impl<'a, T> Trait<'a, T> for u32 { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = RefOk<'a, T>; +LL | type Out = RefOk<'a, T>; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds - --> $DIR/regions-struct-not-wf.rs:31:5 + --> $DIR/regions-struct-not-wf.rs:21:5 | -LL | type Out = RefOk<'a, T>; +LL | type Out = RefOk<'a, T>; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references - --> $DIR/regions-struct-not-wf.rs:35:5 + --> $DIR/regions-struct-not-wf.rs:25:5 | -LL | type Out = &'a &'b T; +LL | type Out = &'a &'b T; //~ ERROR reference has a longer lifetime than the data | ^^^^^^^^^^^^^^^^^^^^^ | -note: the pointer is valid for the lifetime 'a as defined on the impl at 34:6 - --> $DIR/regions-struct-not-wf.rs:34:6 +note: the pointer is valid for the lifetime 'a as defined on the impl at 24:6 + --> $DIR/regions-struct-not-wf.rs:24:6 | LL | impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { | ^^ -note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 34:10 - --> $DIR/regions-struct-not-wf.rs:34:10 +note: but the referenced data is only valid for the lifetime 'b as defined on the impl at 24:10 + --> $DIR/regions-struct-not-wf.rs:24:10 | LL | impl<'a, 'b, T> Trait1<'a, 'b, T> for u32 { | ^^ diff --git a/src/test/ui/rfc-2093-infer-outlives/self-dyn.rs b/src/test/ui/rfc-2093-infer-outlives/self-dyn.rs index 37c468f2f83..aa1be144ff8 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-dyn.rs +++ b/src/test/ui/rfc-2093-infer-outlives/self-dyn.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(dyn_trait)] #![feature(rustc_attrs)] @@ -16,7 +6,7 @@ trait Trait<'x, 's, T> where T: 'x, } #[rustc_outlives] -struct Foo<'a, 'b, A> //~ ERROR 19:1: 22:2: rustc_outlives +struct Foo<'a, 'b, A> //~ ERROR rustc_outlives { foo: Box> } diff --git a/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr b/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr index 8c69307ddfb..62b546adfc1 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr @@ -1,7 +1,7 @@ error: rustc_outlives - --> $DIR/self-dyn.rs:19:1 + --> $DIR/self-dyn.rs:9:1 | -LL | / struct Foo<'a, 'b, A> //~ ERROR 19:1: 22:2: rustc_outlives +LL | / struct Foo<'a, 'b, A> //~ ERROR rustc_outlives LL | | { LL | | foo: Box> LL | | } diff --git a/src/test/ui/rfc-2093-infer-outlives/self-structs.rs b/src/test/ui/rfc-2093-infer-outlives/self-structs.rs index 82d13d9179a..d2550a99e81 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-structs.rs +++ b/src/test/ui/rfc-2093-infer-outlives/self-structs.rs @@ -1,17 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_outlives] -struct Foo<'a, 'b, T> { //~ ERROR 14:1: 16:2: rustc_outlives +struct Foo<'a, 'b, T> { //~ ERROR rustc_outlives field1: Bar<'a, 'b, T> } diff --git a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr index 541e282f238..15ff6009e5c 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr @@ -1,7 +1,7 @@ error: rustc_outlives - --> $DIR/self-structs.rs:14:1 + --> $DIR/self-structs.rs:4:1 | -LL | / struct Foo<'a, 'b, T> { //~ ERROR 14:1: 16:2: rustc_outlives +LL | / struct Foo<'a, 'b, T> { //~ ERROR rustc_outlives LL | | field1: Bar<'a, 'b, T> LL | | } | |_^ diff --git a/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.rs b/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.rs index a44ca9d2d25..8f73d0120a0 100644 --- a/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.rs +++ b/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(crate_in_paths)] struct S; diff --git a/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr b/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr index 2751d8cb285..23485f7a559 100644 --- a/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr +++ b/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr @@ -1,11 +1,11 @@ error[E0433]: failed to resolve: `crate` in paths can only be used in start position - --> $DIR/crate-path-non-absolute.rs:17:22 + --> $DIR/crate-path-non-absolute.rs:7:22 | LL | let s = ::m::crate::S; //~ ERROR failed to resolve | ^^^^^ `crate` in paths can only be used in start position error[E0433]: failed to resolve: global paths cannot start with `crate` - --> $DIR/crate-path-non-absolute.rs:18:20 + --> $DIR/crate-path-non-absolute.rs:8:20 | LL | let s1 = ::crate::S; //~ ERROR failed to resolve | ^^^^^ global paths cannot start with `crate` diff --git a/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.rs b/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.rs index 3ebb3a25d8d..ab87ecbde30 100644 --- a/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.rs +++ b/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(crate_in_paths)] fn main() { diff --git a/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.stderr b/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.stderr index ec44fb4db00..e07b5d80fb8 100644 --- a/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.stderr +++ b/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.stderr @@ -1,5 +1,5 @@ error[E0532]: expected unit struct/variant or constant, found module `crate` - --> $DIR/keyword-crate-as-identifier.rs:14:9 + --> $DIR/keyword-crate-as-identifier.rs:4:9 | LL | let crate = 0; | ^^^^^ not a unit struct/variant or constant diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs b/src/test/ui/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs index c3da4a51872..c4d44476445 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs +++ b/src/test/ui/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Debug)] pub struct S; diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/meta.rs b/src/test/ui/rfc-2126-extern-absolute-paths/meta.rs index 499a322593c..b3b9aeb8028 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/meta.rs +++ b/src/test/ui/rfc-2126-extern-absolute-paths/meta.rs @@ -1,17 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // Tests that `meta` is whitelisted, even if the crate doesn't exist -// yet (i.e. it causes a different error than `not-whitelisted.rs`). +// yet (i.e., it causes a different error than `not-whitelisted.rs`). use meta; //~ ERROR can't find crate for `meta` fn main() {} diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr index b8a9b54d26b..e9de20edb50 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr @@ -1,5 +1,5 @@ error[E0463]: can't find crate for `meta` - --> $DIR/meta.rs:15:5 + --> $DIR/meta.rs:5:5 | LL | use meta; //~ ERROR can't find crate for `meta` | ^^^^ can't find crate diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.rs b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.rs index a259266420a..9c0e0bef480 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.rs +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 use xcrate::S; //~ ERROR unresolved import `xcrate` diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr index 39b2db7a19f..23aeb92f487 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `xcrate` - --> $DIR/non-existent-1.rs:13:5 + --> $DIR/non-existent-1.rs:3:5 | LL | use xcrate::S; //~ ERROR unresolved import `xcrate` | ^^^^^^ use of undeclared type or module `xcrate` diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs index a07c3f17d6f..4f53108b3a9 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 fn main() { diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr index 30e5b0ad1df..7395d01d8ac 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: could not find `xcrate` in `{{root}}` - --> $DIR/non-existent-2.rs:14:15 + --> $DIR/non-existent-2.rs:4:15 | LL | let s = ::xcrate::S; | ^^^^^^ could not find `xcrate` in `{{root}}` diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.rs b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.rs index 0cbeb8cf50f..486159c0e4a 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.rs +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 use ycrate; //~ ERROR unresolved import `ycrate` diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr index 31486e14bd2..b4982d5083c 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `ycrate` - --> $DIR/non-existent-3.rs:13:5 + --> $DIR/non-existent-3.rs:3:5 | LL | use ycrate; //~ ERROR unresolved import `ycrate` | ^^^^^^ no `ycrate` external crate diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs index bfe7e4da845..dd21de75aaf 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs +++ b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs @@ -1,17 +1,5 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 -#![feature(uniform_paths)] - // Tests that arbitrary crates (other than `core`, `std` and `meta`) // aren't allowed without `--extern`, even if they're in the sysroot. use alloc; //~ ERROR unresolved import `alloc` diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr index 06c11b894dd..3bea7816b30 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr @@ -1,11 +1,11 @@ error: cannot import a built-in macro - --> $DIR/not-whitelisted.rs:18:5 + --> $DIR/not-whitelisted.rs:6:5 | LL | use test; //~ ERROR cannot import a built-in macro | ^^^^ error[E0432]: unresolved import `alloc` - --> $DIR/not-whitelisted.rs:17:5 + --> $DIR/not-whitelisted.rs:5:5 | LL | use alloc; //~ ERROR unresolved import `alloc` | ^^^^^ no `alloc` external crate diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.rs b/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.rs index b5b1485f662..c16f46451bb 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.rs +++ b/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:xcrate.rs // compile-flags:--extern xcrate // edition:2018 diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr index b49291b9c0c..d32835a49f8 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr @@ -1,17 +1,17 @@ error: crate root imports need to be explicitly named: `use crate as name;` - --> $DIR/single-segment.rs:15:5 + --> $DIR/single-segment.rs:5:5 | LL | use crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` | ^^^^^ error: cannot glob-import all possible crates - --> $DIR/single-segment.rs:16:5 + --> $DIR/single-segment.rs:6:5 | LL | use *; //~ ERROR cannot glob-import all possible crates | ^ error[E0423]: expected value, found module `xcrate` - --> $DIR/single-segment.rs:19:13 + --> $DIR/single-segment.rs:9:13 | LL | let s = ::xcrate; //~ ERROR expected value, found module `xcrate` | ^^^^^^^^ not a value diff --git a/src/test/ui/rfc-2126-extern-in-paths/auxiliary/xcrate.rs b/src/test/ui/rfc-2126-extern-in-paths/auxiliary/xcrate.rs deleted file mode 100644 index c3da4a51872..00000000000 --- a/src/test/ui/rfc-2126-extern-in-paths/auxiliary/xcrate.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[derive(Debug)] -pub struct S; - -#[derive(Debug)] -pub struct Z; diff --git a/src/test/ui/rfc-2126-extern-in-paths/non-existent-1.rs b/src/test/ui/rfc-2126-extern-in-paths/non-existent-1.rs deleted file mode 100644 index c17e74c547c..00000000000 --- a/src/test/ui/rfc-2126-extern-in-paths/non-existent-1.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(extern_in_paths)] - -use extern::xcrate::S; //~ ERROR unresolved import `extern::xcrate` - -fn main() {} diff --git a/src/test/ui/rfc-2126-extern-in-paths/non-existent-1.stderr b/src/test/ui/rfc-2126-extern-in-paths/non-existent-1.stderr deleted file mode 100644 index 47ea4b8dfcb..00000000000 --- a/src/test/ui/rfc-2126-extern-in-paths/non-existent-1.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0432]: unresolved import `extern::xcrate` - --> $DIR/non-existent-1.rs:13:13 - | -LL | use extern::xcrate::S; //~ ERROR unresolved import `extern::xcrate` - | ^^^^^^ could not find `xcrate` in `extern` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/rfc-2126-extern-in-paths/non-existent-2.rs b/src/test/ui/rfc-2126-extern-in-paths/non-existent-2.rs deleted file mode 100644 index 8d7c3993c62..00000000000 --- a/src/test/ui/rfc-2126-extern-in-paths/non-existent-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(extern_in_paths)] - -fn main() { - let s = extern::xcrate::S; - //~^ ERROR failed to resolve: could not find `xcrate` in `extern` -} diff --git a/src/test/ui/rfc-2126-extern-in-paths/non-existent-2.stderr b/src/test/ui/rfc-2126-extern-in-paths/non-existent-2.stderr deleted file mode 100644 index 89630adb5a8..00000000000 --- a/src/test/ui/rfc-2126-extern-in-paths/non-existent-2.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0433]: failed to resolve: could not find `xcrate` in `extern` - --> $DIR/non-existent-2.rs:14:21 - | -LL | let s = extern::xcrate::S; - | ^^^^^^ could not find `xcrate` in `extern` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/rfc-2126-extern-in-paths/non-existent-3.rs b/src/test/ui/rfc-2126-extern-in-paths/non-existent-3.rs deleted file mode 100644 index 350cca70487..00000000000 --- a/src/test/ui/rfc-2126-extern-in-paths/non-existent-3.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(extern_in_paths)] - -use extern::ycrate; //~ ERROR unresolved import `extern::ycrate` - -fn main() {} diff --git a/src/test/ui/rfc-2126-extern-in-paths/non-existent-3.stderr b/src/test/ui/rfc-2126-extern-in-paths/non-existent-3.stderr deleted file mode 100644 index 0a49d172169..00000000000 --- a/src/test/ui/rfc-2126-extern-in-paths/non-existent-3.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0432]: unresolved import `extern::ycrate` - --> $DIR/non-existent-3.rs:13:5 - | -LL | use extern::ycrate; //~ ERROR unresolved import `extern::ycrate` - | ^^^^^^^^^^^^^^ no `ycrate` external crate - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/rfc-2126-extern-in-paths/single-segment.rs b/src/test/ui/rfc-2126-extern-in-paths/single-segment.rs deleted file mode 100644 index ea448863703..00000000000 --- a/src/test/ui/rfc-2126-extern-in-paths/single-segment.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:xcrate.rs -// compile-flags:--extern xcrate - -#![feature(extern_in_paths)] - -use extern; //~ ERROR unresolved import `extern` - //~^ NOTE no `extern` in the root -use extern::*; //~ ERROR cannot glob-import all possible crates - -fn main() { - let s = extern::xcrate; //~ ERROR expected value, found module `extern::xcrate` - //~^ NOTE not a value -} diff --git a/src/test/ui/rfc-2126-extern-in-paths/single-segment.stderr b/src/test/ui/rfc-2126-extern-in-paths/single-segment.stderr deleted file mode 100644 index 033bedb3b93..00000000000 --- a/src/test/ui/rfc-2126-extern-in-paths/single-segment.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error: cannot glob-import all possible crates - --> $DIR/single-segment.rs:18:5 - | -LL | use extern::*; //~ ERROR cannot glob-import all possible crates - | ^^^^^^^^^ - -error[E0432]: unresolved import `extern` - --> $DIR/single-segment.rs:16:5 - | -LL | use extern; //~ ERROR unresolved import `extern` - | ^^^^^^ no `extern` in the root - -error[E0423]: expected value, found module `extern::xcrate` - --> $DIR/single-segment.rs:21:13 - | -LL | let s = extern::xcrate; //~ ERROR expected value, found module `extern::xcrate` - | ^^^^^^^^^^^^^^ not a value - -error: aborting due to 3 previous errors - -Some errors occurred: E0423, E0432. -For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/rfc-2166-underscore-imports/auxiliary/duplicate.rs b/src/test/ui/rfc-2166-underscore-imports/auxiliary/duplicate.rs new file mode 100644 index 00000000000..92d741b6a26 --- /dev/null +++ b/src/test/ui/rfc-2166-underscore-imports/auxiliary/duplicate.rs @@ -0,0 +1,14 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro_attribute] +pub fn duplicate(_: TokenStream, input: TokenStream) -> TokenStream { + let clone = input.clone(); + input.into_iter().chain(clone.into_iter()).collect() +} diff --git a/src/test/ui/rfc-2166-underscore-imports/auxiliary/underscore-imports.rs b/src/test/ui/rfc-2166-underscore-imports/auxiliary/underscore-imports.rs new file mode 100644 index 00000000000..c335336bee8 --- /dev/null +++ b/src/test/ui/rfc-2166-underscore-imports/auxiliary/underscore-imports.rs @@ -0,0 +1,20 @@ +#[macro_export] +macro_rules! do_nothing { + () => () +} + +mod m1 { + pub trait InScope1 { + fn in_scope1(&self) {} + } + impl InScope1 for () {} +} +mod m2 { + pub trait InScope2 { + fn in_scope2(&self) {} + } + impl InScope2 for () {} +} + +pub use m1::InScope1 as _; +pub use m2::InScope2 as _; diff --git a/src/test/ui/rfc-2166-underscore-imports/basic.rs b/src/test/ui/rfc-2166-underscore-imports/basic.rs index 104bd9e166c..968da9c8d56 100644 --- a/src/test/ui/rfc-2166-underscore-imports/basic.rs +++ b/src/test/ui/rfc-2166-underscore-imports/basic.rs @@ -1,18 +1,13 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass +// aux-build:underscore-imports.rs -#![feature(underscore_imports)] #![warn(unused_imports, unused_extern_crates)] +#[macro_use] +extern crate underscore_imports as _; + +do_nothing!(); // OK + struct S; mod m { diff --git a/src/test/ui/rfc-2166-underscore-imports/basic.stderr b/src/test/ui/rfc-2166-underscore-imports/basic.stderr index 2be0317019d..30803591926 100644 --- a/src/test/ui/rfc-2166-underscore-imports/basic.stderr +++ b/src/test/ui/rfc-2166-underscore-imports/basic.stderr @@ -1,17 +1,17 @@ warning: unused import: `m::Tr1 as _` - --> $DIR/basic.rs:31:9 + --> $DIR/basic.rs:26:9 | LL | use m::Tr1 as _; //~ WARN unused import | ^^^^^^^^^^^ | note: lint level defined here - --> $DIR/basic.rs:14:9 + --> $DIR/basic.rs:4:9 | LL | #![warn(unused_imports, unused_extern_crates)] | ^^^^^^^^^^^^^^ warning: unused import: `S as _` - --> $DIR/basic.rs:32:9 + --> $DIR/basic.rs:27:9 | LL | use S as _; //~ WARN unused import | ^^^^^^ diff --git a/src/test/ui/rfc-2166-underscore-imports/duplicate.rs b/src/test/ui/rfc-2166-underscore-imports/duplicate.rs new file mode 100644 index 00000000000..95f7cae0b87 --- /dev/null +++ b/src/test/ui/rfc-2166-underscore-imports/duplicate.rs @@ -0,0 +1,15 @@ +// compile-pass +// aux-build:duplicate.rs + +extern crate duplicate; + +#[duplicate::duplicate] +use main as _; // OK + +macro_rules! duplicate { + ($item: item) => { $item $item } +} + +duplicate!(use std as _;); // OK + +fn main() {} diff --git a/src/test/ui/rfc-2166-underscore-imports/intercrate.rs b/src/test/ui/rfc-2166-underscore-imports/intercrate.rs new file mode 100644 index 00000000000..8b5bb8b3260 --- /dev/null +++ b/src/test/ui/rfc-2166-underscore-imports/intercrate.rs @@ -0,0 +1,11 @@ +// compile-pass +// aux-build:underscore-imports.rs + +extern crate underscore_imports; + +use underscore_imports::*; + +fn main() { + ().in_scope1(); + ().in_scope2(); +} diff --git a/src/test/ui/rfc-2166-underscore-imports/unused-2018.rs b/src/test/ui/rfc-2166-underscore-imports/unused-2018.rs new file mode 100644 index 00000000000..d06a26a5f11 --- /dev/null +++ b/src/test/ui/rfc-2166-underscore-imports/unused-2018.rs @@ -0,0 +1,17 @@ +// edition:2018 + +#![deny(unused_imports)] + +mod multi_segment { + use core::any; //~ ERROR unused import: `core::any` +} + +mod single_segment { + use core; //~ ERROR unused import: `core` +} + +mod single_segment_underscore { + use core as _; // OK +} + +fn main() {} diff --git a/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr b/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr new file mode 100644 index 00000000000..4163c287607 --- /dev/null +++ b/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr @@ -0,0 +1,20 @@ +error: unused import: `core::any` + --> $DIR/unused-2018.rs:6:9 + | +LL | use core::any; //~ ERROR unused import: `core::any` + | ^^^^^^^^^ + | +note: lint level defined here + --> $DIR/unused-2018.rs:3:9 + | +LL | #![deny(unused_imports)] + | ^^^^^^^^^^^^^^ + +error: unused import: `core` + --> $DIR/unused-2018.rs:10:9 + | +LL | use core; //~ ERROR unused import: `core` + | ^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/rfc-2306/convert-id-const-with-gate.rs b/src/test/ui/rfc-2306/convert-id-const-with-gate.rs index 2e71aee57c2..a82feb961f7 100644 --- a/src/test/ui/rfc-2306/convert-id-const-with-gate.rs +++ b/src/test/ui/rfc-2306/convert-id-const-with-gate.rs @@ -1,19 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test should pass since 'identity' is const fn. // compile-pass -#![feature(convert_id)] - fn main() { const _FOO: u8 = ::std::convert::identity(42u8); } diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs index f7216c57e42..3d24f49ad75 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs @@ -5,8 +5,6 @@ // Tests ensuring that `dbg!(expr)` has the expected run-time behavior. // as well as some compile time properties we expect. -#![feature(dbg_macro)] - #[derive(Copy, Clone, Debug)] struct Unit; @@ -57,31 +55,31 @@ fn test() { fn validate_stderr(stderr: Vec) { assert_eq!(stderr, &[ - ":23] Unit = Unit", + ":21] Unit = Unit", - ":24] a = Unit", + ":22] a = Unit", - ":30] Point{x: 42, y: 24,} = Point {", + ":28] Point{x: 42, y: 24,} = Point {", " x: 42,", " y: 24", "}", - ":31] b = Point {", + ":29] b = Point {", " x: 42,", " y: 24", "}", - ":40] &a = NoCopy(", + ":38] &a = NoCopy(", " 1337", ")", - ":40] dbg!(& a) = NoCopy(", + ":38] dbg!(& a) = NoCopy(", " 1337", ")", - ":45] f(&42) = 42", + ":43] f(&42) = 42", "before", - ":50] { foo += 1; eprintln!(\"before\"); 7331 } = 7331", + ":48] { foo += 1; eprintln!(\"before\"); 7331 } = 7331", ]); } diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.rs deleted file mode 100644 index b237c6f147b..00000000000 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.rs +++ /dev/null @@ -1,5 +0,0 @@ -// Feature gate test for `dbg!(..)`. - -fn main() { - dbg!(1); -} diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.stderr deleted file mode 100644 index 64df1e196d2..00000000000 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-feature-gate.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: macro dbg! is unstable (see issue #54306) - --> $DIR/dbg-macro-feature-gate.rs:4:5 - | -LL | dbg!(1); - | ^^^^^^^^ - | - = help: add #![feature(dbg_macro)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr index bf99fef3bbd..5a730ad2be4 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr @@ -1,12 +1,13 @@ error[E0382]: use of moved value: `a` - --> $DIR/dbg-macro-move-semantics.rs:11:18 + --> $DIR/dbg-macro-move-semantics.rs:9:18 | +LL | let a = NoCopy(0); + | - move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); +LL | let _ = dbg!(a); //~ ERROR use of moved value | ^ value used here after move | - = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs index bcf508d9af5..e6ddb3d91bf 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.rs @@ -1,12 +1,11 @@ // Test ensuring that `dbg!(expr)` will take ownership of the argument. -#![feature(dbg_macro)] - #[derive(Debug)] struct NoCopy(usize); fn main() { let a = NoCopy(0); let _ = dbg!(a); - let _ = dbg!(a); + let _ = dbg!(a); //~ ERROR use of moved value + //~^ ERROR use of moved value } diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr index 10643174385..5f3a6b414e0 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr @@ -1,20 +1,20 @@ error[E0382]: use of moved value: `a` - --> $DIR/dbg-macro-move-semantics.rs:11:18 + --> $DIR/dbg-macro-move-semantics.rs:9:18 | LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); +LL | let _ = dbg!(a); //~ ERROR use of moved value | ^ value used here after move | = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error[E0382]: use of moved value: `a` - --> $DIR/dbg-macro-move-semantics.rs:11:13 + --> $DIR/dbg-macro-move-semantics.rs:9:13 | LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); +LL | let _ = dbg!(a); //~ ERROR use of moved value | ^^^^^^^ value used here after move | = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs index 8e6f3b226fc..bdde484c252 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.rs @@ -1,9 +1,7 @@ // Test ensuring that `dbg!(expr)` requires the passed type to implement `Debug`. -#![feature(dbg_macro)] - struct NotDebug; fn main() { - let _: NotDebug = dbg!(NotDebug); + let _: NotDebug = dbg!(NotDebug); //~ ERROR `NotDebug` doesn't implement `std::fmt::Debug` } diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr index a3b6a1761b9..bd41f7b3405 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr @@ -1,7 +1,7 @@ error[E0277]: `NotDebug` doesn't implement `std::fmt::Debug` - --> $DIR/dbg-macro-requires-debug.rs:8:23 + --> $DIR/dbg-macro-requires-debug.rs:6:23 | -LL | let _: NotDebug = dbg!(NotDebug); +LL | let _: NotDebug = dbg!(NotDebug); //~ ERROR `NotDebug` doesn't implement `std::fmt::Debug` | ^^^^^^^^^^^^^^ `NotDebug` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `NotDebug` diff --git a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.rs b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.rs index 31a34a9e6fb..d79798d57e8 100644 --- a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.rs +++ b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.rs @@ -1,18 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2015 // Enabling `ireffutable_let_patterns` isn't necessary for what this tests, but it makes coming up // with examples easier. -#![feature(irrefutable_let_patterns)] #[allow(irrefutable_let_patterns)] fn main() { diff --git a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.stderr b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.stderr index 411cb99fbca..2cd59fe56cf 100644 --- a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.stderr +++ b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2015.stderr @@ -1,5 +1,5 @@ error: ambiguous use of `&&` - --> $DIR/syntax-ambiguity-2015.rs:21:47 + --> $DIR/syntax-ambiguity-2015.rs:10:47 | LL | if let Range { start: _, end: _ } = true..true && false { } | ^^^^^^^^^^^^^ help: consider adding parentheses: `(true && false)` @@ -8,7 +8,7 @@ LL | if let Range { start: _, end: _ } = true..true && false { } = note: see rust-lang/rust#53668 for more information error: ambiguous use of `||` - --> $DIR/syntax-ambiguity-2015.rs:24:47 + --> $DIR/syntax-ambiguity-2015.rs:13:47 | LL | if let Range { start: _, end: _ } = true..true || false { } | ^^^^^^^^^^^^^ help: consider adding parentheses: `(true || false)` @@ -17,7 +17,7 @@ LL | if let Range { start: _, end: _ } = true..true || false { } = note: see rust-lang/rust#53668 for more information error: ambiguous use of `&&` - --> $DIR/syntax-ambiguity-2015.rs:27:50 + --> $DIR/syntax-ambiguity-2015.rs:16:50 | LL | while let Range { start: _, end: _ } = true..true && false { } | ^^^^^^^^^^^^^ help: consider adding parentheses: `(true && false)` @@ -26,7 +26,7 @@ LL | while let Range { start: _, end: _ } = true..true && false { } = note: see rust-lang/rust#53668 for more information error: ambiguous use of `||` - --> $DIR/syntax-ambiguity-2015.rs:30:50 + --> $DIR/syntax-ambiguity-2015.rs:19:50 | LL | while let Range { start: _, end: _ } = true..true || false { } | ^^^^^^^^^^^^^ help: consider adding parentheses: `(true || false)` @@ -35,7 +35,7 @@ LL | while let Range { start: _, end: _ } = true..true || false { } = note: see rust-lang/rust#53668 for more information error: ambiguous use of `&&` - --> $DIR/syntax-ambiguity-2015.rs:33:19 + --> $DIR/syntax-ambiguity-2015.rs:22:19 | LL | if let true = false && false { } | ^^^^^^^^^^^^^^ help: consider adding parentheses: `(false && false)` @@ -44,7 +44,7 @@ LL | if let true = false && false { } = note: see rust-lang/rust#53668 for more information error: ambiguous use of `&&` - --> $DIR/syntax-ambiguity-2015.rs:36:22 + --> $DIR/syntax-ambiguity-2015.rs:25:22 | LL | while let true = (1 == 2) && false { } | ^^^^^^^^^^^^^^^^^ help: consider adding parentheses: `((1 == 2) && false)` diff --git a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs index 99495717c3a..687bf659416 100644 --- a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs +++ b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.rs @@ -1,18 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // Enabling `ireffutable_let_patterns` isn't necessary for what this tests, but it makes coming up // with examples easier. -#![feature(irrefutable_let_patterns)] #[allow(irrefutable_let_patterns)] fn main() { diff --git a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.stderr b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.stderr index bd49abeb7b2..cbba2d74733 100644 --- a/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.stderr +++ b/src/test/ui/rfc-2497-if-let-chains/syntax-ambiguity-2018.stderr @@ -1,5 +1,5 @@ error: ambiguous use of `&&` - --> $DIR/syntax-ambiguity-2018.rs:21:47 + --> $DIR/syntax-ambiguity-2018.rs:10:47 | LL | if let Range { start: _, end: _ } = true..true && false { } | ^^^^^^^^^^^^^ help: consider adding parentheses: `(true && false)` @@ -8,7 +8,7 @@ LL | if let Range { start: _, end: _ } = true..true && false { } = note: see rust-lang/rust#53668 for more information error: ambiguous use of `||` - --> $DIR/syntax-ambiguity-2018.rs:24:47 + --> $DIR/syntax-ambiguity-2018.rs:13:47 | LL | if let Range { start: _, end: _ } = true..true || false { } | ^^^^^^^^^^^^^ help: consider adding parentheses: `(true || false)` @@ -17,7 +17,7 @@ LL | if let Range { start: _, end: _ } = true..true || false { } = note: see rust-lang/rust#53668 for more information error: ambiguous use of `&&` - --> $DIR/syntax-ambiguity-2018.rs:27:50 + --> $DIR/syntax-ambiguity-2018.rs:16:50 | LL | while let Range { start: _, end: _ } = true..true && false { } | ^^^^^^^^^^^^^ help: consider adding parentheses: `(true && false)` @@ -26,7 +26,7 @@ LL | while let Range { start: _, end: _ } = true..true && false { } = note: see rust-lang/rust#53668 for more information error: ambiguous use of `||` - --> $DIR/syntax-ambiguity-2018.rs:30:50 + --> $DIR/syntax-ambiguity-2018.rs:19:50 | LL | while let Range { start: _, end: _ } = true..true || false { } | ^^^^^^^^^^^^^ help: consider adding parentheses: `(true || false)` @@ -35,7 +35,7 @@ LL | while let Range { start: _, end: _ } = true..true || false { } = note: see rust-lang/rust#53668 for more information error: ambiguous use of `&&` - --> $DIR/syntax-ambiguity-2018.rs:33:19 + --> $DIR/syntax-ambiguity-2018.rs:22:19 | LL | if let true = false && false { } | ^^^^^^^^^^^^^^ help: consider adding parentheses: `(false && false)` @@ -44,7 +44,7 @@ LL | if let true = false && false { } = note: see rust-lang/rust#53668 for more information error: ambiguous use of `&&` - --> $DIR/syntax-ambiguity-2018.rs:36:22 + --> $DIR/syntax-ambiguity-2018.rs:25:22 | LL | while let true = (1 == 2) && false { } | ^^^^^^^^^^^^^^^^^ help: consider adding parentheses: `((1 == 2) && false)` diff --git a/src/test/ui/rfc1445/feature-gate.no_gate.stderr b/src/test/ui/rfc1445/feature-gate.no_gate.stderr index 1141b79c7c6..8c6a08d84a4 100644 --- a/src/test/ui/rfc1445/feature-gate.no_gate.stderr +++ b/src/test/ui/rfc1445/feature-gate.no_gate.stderr @@ -1,5 +1,5 @@ error[E0658]: the semantics of constant patterns is not yet settled (see issue #31434) - --> $DIR/feature-gate.rs:23:1 + --> $DIR/feature-gate.rs:13:1 | LL | #[structural_match] //[no_gate]~ ERROR semantics of constant patterns is not yet settled | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc1445/feature-gate.rs b/src/test/ui/rfc1445/feature-gate.rs index f729220eabb..550610c5444 100644 --- a/src/test/ui/rfc1445/feature-gate.rs +++ b/src/test/ui/rfc1445/feature-gate.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that structural match is only permitted with a feature gate, // and that if a feature gate is supplied, it permits the type to be // used in a match. diff --git a/src/test/ui/rfc1445/feature-gate.with_gate.stderr b/src/test/ui/rfc1445/feature-gate.with_gate.stderr index 87835162c93..da681662c2f 100644 --- a/src/test/ui/rfc1445/feature-gate.with_gate.stderr +++ b/src/test/ui/rfc1445/feature-gate.with_gate.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/feature-gate.rs:31:1 + --> $DIR/feature-gate.rs:21:1 | LL | / fn main() { //[with_gate]~ ERROR compilation successful LL | | let y = Foo { x: 1 }; diff --git a/src/test/ui/rfc1445/match-forbidden-without-eq.rs b/src/test/ui/rfc1445/match-forbidden-without-eq.rs index ca9af78dd99..78d799e2b01 100644 --- a/src/test/ui/rfc1445/match-forbidden-without-eq.rs +++ b/src/test/ui/rfc1445/match-forbidden-without-eq.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::f32; #[derive(PartialEq)] diff --git a/src/test/ui/rfc1445/match-forbidden-without-eq.stderr b/src/test/ui/rfc1445/match-forbidden-without-eq.stderr index a2cb536b212..ebea2f364ec 100644 --- a/src/test/ui/rfc1445/match-forbidden-without-eq.stderr +++ b/src/test/ui/rfc1445/match-forbidden-without-eq.stderr @@ -1,11 +1,11 @@ error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/match-forbidden-without-eq.rs:23:9 + --> $DIR/match-forbidden-without-eq.rs:13:9 | LL | FOO => { } | ^^^ warning: floating-point types cannot be used in patterns - --> $DIR/match-forbidden-without-eq.rs:30:9 + --> $DIR/match-forbidden-without-eq.rs:20:9 | LL | f32::INFINITY => { } | ^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.rs b/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.rs index e02f9153e7e..6b7d94603b5 100644 --- a/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.rs +++ b/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Eq)] struct Foo { x: u32 diff --git a/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.stderr b/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.stderr index 60f3191cd27..4157cf65283 100644 --- a/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.stderr +++ b/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.stderr @@ -1,5 +1,5 @@ error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]` - --> $DIR/match-requires-both-partialeq-and-eq.rs:27:9 + --> $DIR/match-requires-both-partialeq-and-eq.rs:17:9 | LL | FOO => { } | ^^^ diff --git a/src/test/ui/rfc1598-generic-associated-types/collections.rs b/src/test/ui/rfc1598-generic-associated-types/collections.rs index a6dbb03d379..5414bb4a6d2 100644 --- a/src/test/ui/rfc1598-generic-associated-types/collections.rs +++ b/src/test/ui/rfc1598-generic-associated-types/collections.rs @@ -1,18 +1,8 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generic_associated_types)] //~^ WARNING the feature `generic_associated_types` is incomplete #![feature(associated_type_defaults)] -// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a // follow-up PR. // A Collection trait and collection families. Based on @@ -25,14 +15,14 @@ trait Collection { // Test associated type defaults with parameters type Sibling: Collection = <>::Family as CollectionFamily>::Member; - //~^ ERROR type parameters are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on this entity [E0109] fn empty() -> Self; fn add(&mut self, value: T); fn iterate<'iter>(&'iter self) -> Self::Iter<'iter>; - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] } trait CollectionFamily { @@ -58,13 +48,13 @@ impl Collection for Vec { } fn iterate<'iter>(&'iter self) -> Self::Iter<'iter> { - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] self.iter() } } fn floatify(ints: &C) -> <>::Family as CollectionFamily>::Member -//~^ ERROR type parameters are not allowed on this type [E0109] +//~^ ERROR type arguments are not allowed on this entity [E0109] where C: Collection, { @@ -76,7 +66,7 @@ where } fn floatify_sibling(ints: &C) -> >::Sibling -//~^ ERROR type parameters are not allowed on this type [E0109] +//~^ ERROR type arguments are not allowed on this entity [E0109] where C: Collection, { diff --git a/src/test/ui/rfc1598-generic-associated-types/collections.stderr b/src/test/ui/rfc1598-generic-associated-types/collections.stderr index 0e7d6ace1bb..eeed04bd892 100644 --- a/src/test/ui/rfc1598-generic-associated-types/collections.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/collections.stderr @@ -1,38 +1,38 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/collections.rs:11:12 + --> $DIR/collections.rs:1:12 | LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0109]: type parameters are not allowed on this type - --> $DIR/collections.rs:66:90 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/collections.rs:56:90 | LL | fn floatify(ints: &C) -> <>::Family as CollectionFamily>::Member - | ^^^ type parameter not allowed + | ^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/collections.rs:78:69 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/collections.rs:68:69 | LL | fn floatify_sibling(ints: &C) -> >::Sibling - | ^^^ type parameter not allowed + | ^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/collections.rs:27:71 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/collections.rs:17:71 | LL | <>::Family as CollectionFamily>::Member; - | ^ type parameter not allowed + | ^ type argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/collections.rs:34:50 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/collections.rs:24:50 | LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter>; - | ^^^^^ lifetime parameter not allowed + | ^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/collections.rs:60:50 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/collections.rs:50:50 | LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter> { - | ^^^^^ lifetime parameter not allowed + | ^^^^^ lifetime argument not allowed error: aborting due to 5 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs index 88a660b3a5a..d9c482e23e4 100644 --- a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs +++ b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs @@ -1,19 +1,9 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generic_associated_types)] //~^ WARNING the feature `generic_associated_types` is incomplete use std::ops::Deref; -// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a // follow-up PR. trait Foo { @@ -25,15 +15,15 @@ trait Baz { // This weird type tests that we can use universal function call syntax to access the Item on type Baa<'a>: Deref as Foo>::Bar<'a, 'static>>; - //~^ ERROR lifetime parameters are not allowed on this type [E0110] - //~| ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] + //~| ERROR lifetime arguments are not allowed on this entity [E0110] } impl Baz for T where T: Foo { type Quux<'a> = T; type Baa<'a> = &'a ::Bar<'a, 'static>; - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] } fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr index 5c85698fa55..fd6116d2da2 100644 --- a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr @@ -1,26 +1,26 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/construct_with_other_type.rs:11:12 + --> $DIR/construct_with_other_type.rs:1:12 | LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/construct_with_other_type.rs:27:46 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/construct_with_other_type.rs:17:46 | LL | type Baa<'a>: Deref as Foo>::Bar<'a, 'static>>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/construct_with_other_type.rs:27:63 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/construct_with_other_type.rs:17:63 | LL | type Baa<'a>: Deref as Foo>::Bar<'a, 'static>>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/construct_with_other_type.rs:35:40 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/construct_with_other_type.rs:25:40 | LL | type Baa<'a> = &'a ::Bar<'a, 'static>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs b/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs index d8a2a1b73f7..158ebc7d388 100644 --- a/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs +++ b/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generic_associated_types)] //~^ WARNING the feature `generic_associated_types` is incomplete diff --git a/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr b/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr index 2670c3aa142..2a01b2a3f0f 100644 --- a/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr @@ -1,11 +1,11 @@ error: expected one of `>`, identifier, or lifetime, found `,` - --> $DIR/empty_generics.rs:15:14 + --> $DIR/empty_generics.rs:5:14 | LL | type Bar<,>; | ^ expected one of `>`, identifier, or lifetime here warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/empty_generics.rs:11:12 + --> $DIR/empty_generics.rs:1:12 | LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.rs b/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.rs index 7f48408b369..33593884de3 100644 --- a/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.rs +++ b/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![feature(generic_associated_types)] diff --git a/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.stderr b/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.stderr index 67682dcb8fb..6953a28a23b 100644 --- a/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.stderr @@ -1,5 +1,5 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/gat-incomplete-warning.rs:13:12 + --> $DIR/gat-incomplete-warning.rs:3:12 | LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs index 9b59b24b105..b0d1fa1a74f 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs +++ b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs @@ -1,14 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(generic_associated_types)] +#![feature(generic_associated_types)] //~ WARN `generic_associated_types` is incomplete // Checking the interaction with this other feature #![feature(associated_type_defaults)] diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr index 97d5482735f..5aa34bca130 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr @@ -1,6 +1,6 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/generic-associated-types-where.rs:11:12 + --> $DIR/generic-associated-types-where.rs:1:12 | -LL | #![feature(generic_associated_types)] +LL | #![feature(generic_associated_types)] //~ WARN `generic_associated_types` is incomplete | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs index 267272ded8c..2e6d7470b49 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs +++ b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs @@ -1,32 +1,22 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generic_associated_types)] //~^ WARNING the feature `generic_associated_types` is incomplete use std::ops::Deref; -// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a // follow-up PR. trait Iterable { type Item<'a>; type Iter<'a>: Iterator> - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] + Deref>; //~^ ERROR undeclared lifetime - //~| ERROR lifetime parameters are not allowed on this type [E0110] + //~| ERROR lifetime arguments are not allowed on this entity [E0110] fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; //~^ ERROR undeclared lifetime - //~| ERROR lifetime parameters are not allowed on this type [E0110] + //~| ERROR lifetime arguments are not allowed on this entity [E0110] } fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr index 79b29902ccd..3cebab63895 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr @@ -1,38 +1,38 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:11:12 + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:1:12 | LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:23:37 + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:13:37 | LL | + Deref>; | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'undeclared` - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:27:41 + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:17:41 | LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; | ^^^^^^^^^^^ undeclared lifetime -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:21:47 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:11:47 | LL | type Iter<'a>: Iterator> - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:23:37 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:13:37 | LL | + Deref>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/generic_associated_type_undeclared_lifetimes.rs:27:41 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/generic_associated_type_undeclared_lifetimes.rs:17:41 | LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>; - | ^^^^^^^^^^^ lifetime parameter not allowed + | ^^^^^^^^^^^ lifetime argument not allowed error: aborting due to 5 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/iterable.rs b/src/test/ui/rfc1598-generic-associated-types/iterable.rs index b52b6e02421..69258506651 100644 --- a/src/test/ui/rfc1598-generic-associated-types/iterable.rs +++ b/src/test/ui/rfc1598-generic-associated-types/iterable.rs @@ -1,28 +1,18 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generic_associated_types)] //~^ WARNING the feature `generic_associated_types` is incomplete use std::ops::Deref; -// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a // follow-up PR. trait Iterable { type Item<'a>; type Iter<'a>: Iterator>; - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] fn iter<'a>(&'a self) -> Self::Iter<'a>; - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] } // Impl for struct type @@ -31,7 +21,7 @@ impl Iterable for Vec { type Iter<'a> = std::slice::Iter<'a, T>; fn iter<'a>(&'a self) -> Self::Iter<'a> { - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] self.iter() } } @@ -42,18 +32,18 @@ impl Iterable for [T] { type Iter<'a> = std::slice::Iter<'a, T>; fn iter<'a>(&'a self) -> Self::Iter<'a> { - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] self.iter() } } fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> { - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] it.iter() } fn get_first<'a, I: Iterable>(it: &'a I) -> Option> { - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] it.iter().next() } diff --git a/src/test/ui/rfc1598-generic-associated-types/iterable.stderr b/src/test/ui/rfc1598-generic-associated-types/iterable.stderr index de3563c14eb..cc3ade6f39d 100644 --- a/src/test/ui/rfc1598-generic-associated-types/iterable.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/iterable.stderr @@ -1,44 +1,44 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/iterable.rs:11:12 + --> $DIR/iterable.rs:1:12 | LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/iterable.rs:21:47 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/iterable.rs:11:47 | LL | type Iter<'a>: Iterator>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/iterable.rs:50:53 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/iterable.rs:40:53 | LL | fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> { - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/iterable.rs:55:60 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/iterable.rs:45:60 | LL | fn get_first<'a, I: Iterable>(it: &'a I) -> Option> { - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/iterable.rs:24:41 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/iterable.rs:14:41 | LL | fn iter<'a>(&'a self) -> Self::Iter<'a>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/iterable.rs:33:41 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/iterable.rs:23:41 | LL | fn iter<'a>(&'a self) -> Self::Iter<'a> { - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/iterable.rs:44:41 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/iterable.rs:34:41 | LL | fn iter<'a>(&'a self) -> Self::Iter<'a> { - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed error: aborting due to 6 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs index 82e82e6dbcc..851e331a0e9 100644 --- a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs +++ b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs @@ -1,18 +1,8 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generic_associated_types)] //~^ WARNING the feature `generic_associated_types` is incomplete #![feature(associated_type_defaults)] -// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a +// FIXME(#44265): "lifetime arguments are not allowed on this entity" errors will be addressed in a // follow-up PR. // FIXME(#44265): Update expected errors once E110 is resolved, now does not get past `trait Foo`. @@ -25,13 +15,13 @@ trait Foo { type E<'a, T>; // Test parameters in default values type FOk = Self::E<'static, T>; - //~^ ERROR type parameters are not allowed on this type [E0109] - //~| ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~| ERROR lifetime arguments are not allowed on this entity [E0110] type FErr1 = Self::E<'static, 'static>; // Error - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] type FErr2 = Self::E<'static, T, u32>; // Error - //~^ ERROR type parameters are not allowed on this type [E0109] - //~| ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR type arguments are not allowed on this entity [E0109] + //~| ERROR lifetime arguments are not allowed on this entity [E0110] } struct Fooy; diff --git a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr index e47daf2ae1b..265b0fab770 100644 --- a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr @@ -1,38 +1,38 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/parameter_number_and_kind.rs:11:12 + --> $DIR/parameter_number_and_kind.rs:1:12 | LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/parameter_number_and_kind.rs:27:27 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/parameter_number_and_kind.rs:17:27 | LL | type FOk = Self::E<'static, T>; - | ^^^^^^^ lifetime parameter not allowed + | ^^^^^^^ lifetime argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/parameter_number_and_kind.rs:27:36 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/parameter_number_and_kind.rs:17:36 | LL | type FOk = Self::E<'static, T>; - | ^ type parameter not allowed + | ^ type argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/parameter_number_and_kind.rs:30:26 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/parameter_number_and_kind.rs:20:26 | LL | type FErr1 = Self::E<'static, 'static>; // Error - | ^^^^^^^ lifetime parameter not allowed + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/parameter_number_and_kind.rs:32:29 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/parameter_number_and_kind.rs:22:29 | LL | type FErr2 = Self::E<'static, T, u32>; // Error - | ^^^^^^^ lifetime parameter not allowed + | ^^^^^^^ lifetime argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/parameter_number_and_kind.rs:32:38 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/parameter_number_and_kind.rs:22:38 | LL | type FErr2 = Self::E<'static, T, u32>; // Error - | ^ type parameter not allowed + | ^ type argument not allowed error: aborting due to 5 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs b/src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs index 90aaddecfe7..589e5fcc00e 100644 --- a/src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs +++ b/src/test/ui/rfc1598-generic-associated-types/parse/in-trait-impl.rs @@ -1,15 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only // compile-pass +// compile-flags: -Z parse-only #![feature(generic_associated_types)] diff --git a/src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs b/src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs index 8179bf263ed..7fa71e4dd1a 100644 --- a/src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs +++ b/src/test/ui/rfc1598-generic-associated-types/parse/in-trait.rs @@ -1,15 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only // compile-pass +// compile-flags: -Z parse-only #![feature(generic_associated_types)] diff --git a/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs b/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs index 0300ad06194..2d188aed427 100644 --- a/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs +++ b/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generic_associated_types)] //~^ WARNING the feature `generic_associated_types` is incomplete -// FIXME(#44265): "type parameter not allowed" errors will be addressed in a follow-up PR. +// FIXME(#44265): "type argument not allowed" errors will be addressed in a follow-up PR. use std::rc::Rc; use std::sync::Arc; @@ -20,7 +10,7 @@ use std::ops::Deref; trait PointerFamily { type Pointer: Deref; fn new(value: T) -> Self::Pointer; - //~^ ERROR type parameters are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on this entity [E0109] } struct ArcFamily; @@ -28,7 +18,7 @@ struct ArcFamily; impl PointerFamily for ArcFamily { type Pointer = Arc; fn new(value: T) -> Self::Pointer { - //~^ ERROR type parameters are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on this entity [E0109] Arc::new(value) } } @@ -38,14 +28,14 @@ struct RcFamily; impl PointerFamily for RcFamily { type Pointer = Rc; fn new(value: T) -> Self::Pointer { - //~^ ERROR type parameters are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on this entity [E0109] Rc::new(value) } } struct Foo { bar: P::Pointer, - //~^ ERROR type parameters are not allowed on this type [E0109] + //~^ ERROR type arguments are not allowed on this entity [E0109] } fn main() {} diff --git a/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr b/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr index 3be0481dc67..2b9eed2a688 100644 --- a/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr @@ -1,32 +1,32 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/pointer_family.rs:11:12 + --> $DIR/pointer_family.rs:1:12 | LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0109]: type parameters are not allowed on this type - --> $DIR/pointer_family.rs:47:21 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/pointer_family.rs:37:21 | LL | bar: P::Pointer, - | ^^^^^^ type parameter not allowed + | ^^^^^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/pointer_family.rs:22:42 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/pointer_family.rs:12:42 | LL | fn new(value: T) -> Self::Pointer; - | ^ type parameter not allowed + | ^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/pointer_family.rs:30:42 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/pointer_family.rs:20:42 | LL | fn new(value: T) -> Self::Pointer { - | ^ type parameter not allowed + | ^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/pointer_family.rs:40:42 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/pointer_family.rs:30:42 | LL | fn new(value: T) -> Self::Pointer { - | ^ type parameter not allowed + | ^ type argument not allowed error: aborting due to 4 previous errors diff --git a/src/test/ui/rfc1598-generic-associated-types/shadowing.rs b/src/test/ui/rfc1598-generic-associated-types/shadowing.rs index ddc6a29a8f0..82a7c2510e5 100644 --- a/src/test/ui/rfc1598-generic-associated-types/shadowing.rs +++ b/src/test/ui/rfc1598-generic-associated-types/shadowing.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generic_associated_types)] //FIXME(#44265): The lifetime shadowing and type parameter shadowing diff --git a/src/test/ui/rfc1598-generic-associated-types/shadowing.stderr b/src/test/ui/rfc1598-generic-associated-types/shadowing.stderr index f2d626f921c..cba6bbd8512 100644 --- a/src/test/ui/rfc1598-generic-associated-types/shadowing.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/shadowing.stderr @@ -1,5 +1,5 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/shadowing.rs:11:12 + --> $DIR/shadowing.rs:1:12 | LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs index aa90886fdfd..e0184164b3a 100644 --- a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs +++ b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs @@ -1,17 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(generic_associated_types)] //~^ WARNING the feature `generic_associated_types` is incomplete -// FIXME(#44265): "lifetime parameter not allowed on this type" errors will be addressed in a +// FIXME(#44265): "lifetime argument not allowed on this type" errors will be addressed in a // follow-up PR use std::fmt::Display; @@ -20,13 +10,13 @@ trait StreamingIterator { type Item<'a>; // Applying the lifetime parameter `'a` to `Self::Item` inside the trait. fn next<'a>(&'a self) -> Option>; - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] } struct Foo { // Applying a concrete lifetime to the constructor outside the trait. bar: ::Item<'static>, - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] } // Users can bound parameters by the type constructed by that trait's associated type constructor @@ -34,11 +24,11 @@ struct Foo { //FIXME(sunjay): This next line should parse and be valid //fn foo StreamingIterator=&'a [i32]>>(iter: T) { /* ... */ } fn foo(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ } -//~^ ERROR lifetime parameters are not allowed on this type [E0110] +//~^ ERROR lifetime arguments are not allowed on this entity [E0110] // Full example of enumerate iterator -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] +#[must_use = "iterators are lazy and do nothing unless consumed"] struct StreamEnumerate { iter: I, count: usize, @@ -46,9 +36,9 @@ struct StreamEnumerate { impl StreamingIterator for StreamEnumerate { type Item<'a> = (usize, I::Item<'a>); - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] fn next<'a>(&'a self) -> Option> { - //~^ ERROR lifetime parameters are not allowed on this type [E0110] + //~^ ERROR lifetime arguments are not allowed on this entity [E0110] match self.iter.next() { None => None, Some(val) => { diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr index 4aca8d47687..5afbba5d2d7 100644 --- a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr @@ -1,38 +1,38 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash - --> $DIR/streaming_iterator.rs:11:12 + --> $DIR/streaming_iterator.rs:1:12 | LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/streaming_iterator.rs:28:41 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/streaming_iterator.rs:18:41 | LL | bar: ::Item<'static>, - | ^^^^^^^ lifetime parameter not allowed + | ^^^^^^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/streaming_iterator.rs:36:64 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/streaming_iterator.rs:26:64 | LL | fn foo(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ } - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/streaming_iterator.rs:22:48 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/streaming_iterator.rs:12:48 | LL | fn next<'a>(&'a self) -> Option>; - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/streaming_iterator.rs:48:37 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/streaming_iterator.rs:38:37 | LL | type Item<'a> = (usize, I::Item<'a>); - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed -error[E0110]: lifetime parameters are not allowed on this type - --> $DIR/streaming_iterator.rs:50:48 +error[E0110]: lifetime arguments are not allowed on this entity + --> $DIR/streaming_iterator.rs:40:48 | LL | fn next<'a>(&'a self) -> Option> { - | ^^ lifetime parameter not allowed + | ^^ lifetime argument not allowed error: aborting due to 5 previous errors diff --git a/src/test/ui/rfc1623.rs b/src/test/ui/rfc1623.rs index 579fa378a1c..5920446dbc2 100644 --- a/src/test/ui/rfc1623.rs +++ b/src/test/ui/rfc1623.rs @@ -1,12 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![allow(dead_code)] fn non_elidable<'a, 'b>(a: &'a u8, b: &'b u8) -> &'a u8 { diff --git a/src/test/ui/rfc1623.stderr b/src/test/ui/rfc1623.stderr index 3815558fb25..171c00ba7b8 100644 --- a/src/test/ui/rfc1623.stderr +++ b/src/test/ui/rfc1623.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/rfc1623.rs:17:42 + --> $DIR/rfc1623.rs:8:42 | LL | static NON_ELIDABLE_FN: &fn(&u8, &u8) -> &u8 = | ^ expected lifetime parameter @@ -7,7 +7,7 @@ LL | static NON_ELIDABLE_FN: &fn(&u8, &u8) -> &u8 = = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 error[E0106]: missing lifetime specifier - --> $DIR/rfc1623.rs:19:39 + --> $DIR/rfc1623.rs:10:39 | LL | &(non_elidable as fn(&u8, &u8) -> &u8); | ^ expected lifetime parameter diff --git a/src/test/ui/rfc1717/missing-link-attr.rs b/src/test/ui/rfc1717/missing-link-attr.rs index 810efdedfd6..b46d85160d1 100644 --- a/src/test/ui/rfc1717/missing-link-attr.rs +++ b/src/test/ui/rfc1717/missing-link-attr.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -l foo:bar // error-pattern: renaming of the library `foo` was specified diff --git a/src/test/ui/rfc1717/multiple-renames.rs b/src/test/ui/rfc1717/multiple-renames.rs index e75c1a14b24..106f196b455 100644 --- a/src/test/ui/rfc1717/multiple-renames.rs +++ b/src/test/ui/rfc1717/multiple-renames.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -l foo:bar -l foo:baz // error-pattern: multiple renamings were specified for library diff --git a/src/test/ui/rfc1717/rename-to-empty.rs b/src/test/ui/rfc1717/rename-to-empty.rs index ab8c238bc27..9356c412992 100644 --- a/src/test/ui/rfc1717/rename-to-empty.rs +++ b/src/test/ui/rfc1717/rename-to-empty.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -l foo: // error-pattern: an empty renaming target was specified for library diff --git a/src/test/ui/rmeta-lib-pass.rs b/src/test/ui/rmeta-lib-pass.rs index 2df6a659724..6149b1685f5 100644 --- a/src/test/ui/rmeta-lib-pass.rs +++ b/src/test/ui/rmeta-lib-pass.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --emit=metadata // aux-build:rmeta_rlib.rs // no-prefer-dynamic diff --git a/src/test/ui/rmeta-pass.rs b/src/test/ui/rmeta-pass.rs index 6ee914c5e5b..bcd40144f72 100644 --- a/src/test/ui/rmeta-pass.rs +++ b/src/test/ui/rmeta-pass.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --emit=metadata // aux-build:rmeta_meta.rs // no-prefer-dynamic diff --git a/src/test/ui/rmeta-priv-warn.rs b/src/test/ui/rmeta-priv-warn.rs index bcf869c9432..823ce80623b 100644 --- a/src/test/ui/rmeta-priv-warn.rs +++ b/src/test/ui/rmeta-priv-warn.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --emit=metadata // no-prefer-dynamic // compile-pass diff --git a/src/test/ui/rmeta.rs b/src/test/ui/rmeta.rs index 962fe9f66aa..63ed236505e 100644 --- a/src/test/ui/rmeta.rs +++ b/src/test/ui/rmeta.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // no-prefer-dynamic // compile-flags: --emit=metadata diff --git a/src/test/ui/rmeta.stderr b/src/test/ui/rmeta.stderr index fa154f81b29..d36b3a746e6 100644 --- a/src/test/ui/rmeta.stderr +++ b/src/test/ui/rmeta.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `Foo` in this scope - --> $DIR/rmeta.rs:17:13 + --> $DIR/rmeta.rs:7:13 | LL | let _ = Foo; //~ ERROR cannot find value `Foo` in this scope | ^^^ not found in this scope diff --git a/src/test/ui/rmeta_lib.rs b/src/test/ui/rmeta_lib.rs index a61ff05e8c8..345b712e37e 100644 --- a/src/test/ui/rmeta_lib.rs +++ b/src/test/ui/rmeta_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:rmeta_meta.rs // no-prefer-dynamic // error-pattern: crate `rmeta_meta` required to be available in rlib format, but was not found diff --git a/src/test/ui/rmeta_meta_main.rs b/src/test/ui/rmeta_meta_main.rs index ffeb5bc3b85..df550775ee4 100644 --- a/src/test/ui/rmeta_meta_main.rs +++ b/src/test/ui/rmeta_meta_main.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --emit=metadata // aux-build:rmeta_meta.rs // no-prefer-dynamic diff --git a/src/test/ui/rmeta_meta_main.stderr b/src/test/ui/rmeta_meta_main.stderr index f246a8b5f63..bed9076d84c 100644 --- a/src/test/ui/rmeta_meta_main.stderr +++ b/src/test/ui/rmeta_meta_main.stderr @@ -1,8 +1,8 @@ error[E0560]: struct `rmeta_meta::Foo` has no field named `field2` - --> $DIR/rmeta_meta_main.rs:23:19 + --> $DIR/rmeta_meta_main.rs:13:19 | LL | let _ = Foo { field2: 42 }; //~ ERROR struct `rmeta_meta::Foo` has no field named `field2` - | ^^^^^^ field does not exist - did you mean `field`? + | ^^^^^^ help: a field with a similar name exists: `field` error: aborting due to previous error diff --git a/src/test/ui/run-pass/traits/trait-alias.rs b/src/test/ui/run-pass/traits/trait-alias.rs new file mode 100644 index 00000000000..9be5664869e --- /dev/null +++ b/src/test/ui/run-pass/traits/trait-alias.rs @@ -0,0 +1,7 @@ +// run-pass +#![feature(trait_alias)] + +pub trait Foo {} +pub trait FooAlias = Foo; + +fn main() {} diff --git a/src/test/ui/run-pass/traits/traits-static-outlives-a-where-clause.rs b/src/test/ui/run-pass/traits/traits-static-outlives-a-where-clause.rs index 1051bec6307..f0c2c1082b0 100644 --- a/src/test/ui/run-pass/traits/traits-static-outlives-a-where-clause.rs +++ b/src/test/ui/run-pass/traits/traits-static-outlives-a-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass trait Foo<'a> { diff --git a/src/test/ui/rust-2018/async-ident-allowed.rs b/src/test/ui/rust-2018/async-ident-allowed.rs index 9a046bc6952..9d961214afc 100644 --- a/src/test/ui/rust-2018/async-ident-allowed.rs +++ b/src/test/ui/rust-2018/async-ident-allowed.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2015 #![deny(rust_2018_compatibility)] diff --git a/src/test/ui/rust-2018/async-ident-allowed.stderr b/src/test/ui/rust-2018/async-ident-allowed.stderr index 68d7930e043..61e1facd30e 100644 --- a/src/test/ui/rust-2018/async-ident-allowed.stderr +++ b/src/test/ui/rust-2018/async-ident-allowed.stderr @@ -1,11 +1,11 @@ error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident-allowed.rs:19:9 + --> $DIR/async-ident-allowed.rs:9:9 | LL | let async = 3; //~ ERROR: is a keyword | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | note: lint level defined here - --> $DIR/async-ident-allowed.rs:13:9 + --> $DIR/async-ident-allowed.rs:3:9 | LL | #![deny(rust_2018_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rust-2018/async-ident.fixed b/src/test/ui/rust-2018/async-ident.fixed index 125e7c3773a..3d6f6ff8c49 100644 --- a/src/test/ui/rust-2018/async-ident.fixed +++ b/src/test/ui/rust-2018/async-ident.fixed @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code, unused_variables, non_camel_case_types, non_upper_case_globals)] #![deny(keyword_idents)] diff --git a/src/test/ui/rust-2018/async-ident.rs b/src/test/ui/rust-2018/async-ident.rs index 01b974bcbfb..6e8d33d237d 100644 --- a/src/test/ui/rust-2018/async-ident.rs +++ b/src/test/ui/rust-2018/async-ident.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code, unused_variables, non_camel_case_types, non_upper_case_globals)] #![deny(keyword_idents)] diff --git a/src/test/ui/rust-2018/async-ident.stderr b/src/test/ui/rust-2018/async-ident.stderr index 46e6af84ab8..b33c043c9ea 100644 --- a/src/test/ui/rust-2018/async-ident.stderr +++ b/src/test/ui/rust-2018/async-ident.stderr @@ -1,11 +1,11 @@ error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:17:4 + --> $DIR/async-ident.rs:7:4 | LL | fn async() {} //~ ERROR async | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | note: lint level defined here - --> $DIR/async-ident.rs:12:9 + --> $DIR/async-ident.rs:2:9 | LL | #![deny(keyword_idents)] | ^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | #![deny(keyword_idents)] = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:22:7 + --> $DIR/async-ident.rs:12:7 | LL | ($async:expr, async) => {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -22,7 +22,7 @@ LL | ($async:expr, async) => {}; = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:22:19 + --> $DIR/async-ident.rs:12:19 | LL | ($async:expr, async) => {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -31,7 +31,7 @@ LL | ($async:expr, async) => {}; = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:29:6 + --> $DIR/async-ident.rs:19:6 | LL | foo!(async); | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -40,7 +40,7 @@ LL | foo!(async); = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:38:11 + --> $DIR/async-ident.rs:28:11 | LL | trait async {} | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -49,7 +49,7 @@ LL | trait async {} = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:42:10 + --> $DIR/async-ident.rs:32:10 | LL | impl async for MyStruct {} | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -58,7 +58,7 @@ LL | impl async for MyStruct {} = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:48:12 + --> $DIR/async-ident.rs:38:12 | LL | static async: u32 = 0; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -67,7 +67,7 @@ LL | static async: u32 = 0; = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:54:11 + --> $DIR/async-ident.rs:44:11 | LL | const async: u32 = 0; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -76,7 +76,7 @@ LL | const async: u32 = 0; = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:60:15 + --> $DIR/async-ident.rs:50:15 | LL | impl Foo { fn async() {} } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -85,7 +85,7 @@ LL | impl Foo { fn async() {} } = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:65:12 + --> $DIR/async-ident.rs:55:12 | LL | struct async {} | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -94,7 +94,7 @@ LL | struct async {} = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:68:9 + --> $DIR/async-ident.rs:58:9 | LL | let async: async = async {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -103,7 +103,7 @@ LL | let async: async = async {}; = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:68:16 + --> $DIR/async-ident.rs:58:16 | LL | let async: async = async {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -112,7 +112,7 @@ LL | let async: async = async {}; = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:68:24 + --> $DIR/async-ident.rs:58:24 | LL | let async: async = async {}; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -121,7 +121,7 @@ LL | let async: async = async {}; = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:79:19 + --> $DIR/async-ident.rs:69:19 | LL | () => (pub fn async() {}) | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` @@ -130,7 +130,7 @@ LL | () => (pub fn async() {}) = note: for more information, see issue #49716 error: `async` is a keyword in the 2018 edition - --> $DIR/async-ident.rs:86:6 + --> $DIR/async-ident.rs:76:6 | LL | (async) => (1) | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` diff --git a/src/test/ui/rust-2018/auxiliary/baz.rs b/src/test/ui/rust-2018/auxiliary/baz.rs index 4ee9c051c65..b317c8a4536 100644 --- a/src/test/ui/rust-2018/auxiliary/baz.rs +++ b/src/test/ui/rust-2018/auxiliary/baz.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This file is used as part of the local-path-suggestions.rs test. pub mod foobar { diff --git a/src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs b/src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs index cc17a9bd661..dd22df89eae 100644 --- a/src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs +++ b/src/test/ui/rust-2018/auxiliary/edition-lint-paths.rs @@ -1,11 +1,12 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn foo() {} + +#[macro_export] +macro_rules! macro_2015 { + () => { + use edition_lint_paths as other_name; + use edition_lint_paths::foo as other_foo; + fn check_macro_2015() { + ::edition_lint_paths::foo(); + } + } +} diff --git a/src/test/ui/rust-2018/auxiliary/macro-use-warned-against.rs b/src/test/ui/rust-2018/auxiliary/macro-use-warned-against.rs index 9487fd808cd..b497c74e699 100644 --- a/src/test/ui/rust-2018/auxiliary/macro-use-warned-against.rs +++ b/src/test/ui/rust-2018/auxiliary/macro-use-warned-against.rs @@ -1,12 +1,2 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! foo { () => () } diff --git a/src/test/ui/rust-2018/auxiliary/macro-use-warned-against2.rs b/src/test/ui/rust-2018/auxiliary/macro-use-warned-against2.rs index 6391db85dc5..d11c69f812a 100644 --- a/src/test/ui/rust-2018/auxiliary/macro-use-warned-against2.rs +++ b/src/test/ui/rust-2018/auxiliary/macro-use-warned-against2.rs @@ -1,10 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +// intentionally empty diff --git a/src/test/ui/rust-2018/auxiliary/remove-extern-crate.rs b/src/test/ui/rust-2018/auxiliary/remove-extern-crate.rs index 9daaca1fb8f..890af683ae7 100644 --- a/src/test/ui/rust-2018/auxiliary/remove-extern-crate.rs +++ b/src/test/ui/rust-2018/auxiliary/remove-extern-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! foo { () => () diff --git a/src/test/ui/rust-2018/auxiliary/suggestions-not-always-applicable.rs b/src/test/ui/rust-2018/auxiliary/suggestions-not-always-applicable.rs new file mode 100644 index 00000000000..7472443dcee --- /dev/null +++ b/src/test/ui/rust-2018/auxiliary/suggestions-not-always-applicable.rs @@ -0,0 +1,13 @@ +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] + +extern crate proc_macro; + +use proc_macro::*; + +#[proc_macro_attribute] +pub fn foo(_attr: TokenStream, _f: TokenStream) -> TokenStream { + "pub fn foo() -> ::Foo { ::Foo }".parse().unwrap() +} diff --git a/src/test/ui/rust-2018/auxiliary/trait-import-suggestions.rs b/src/test/ui/rust-2018/auxiliary/trait-import-suggestions.rs index 611fa83854b..d356f329462 100644 --- a/src/test/ui/rust-2018/auxiliary/trait-import-suggestions.rs +++ b/src/test/ui/rust-2018/auxiliary/trait-import-suggestions.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Baz { fn baz(&self) { } } diff --git a/src/test/ui/rust-2018/dyn-trait-compatibility.rs b/src/test/ui/rust-2018/dyn-trait-compatibility.rs index 9548df5959b..377c85fef49 100644 --- a/src/test/ui/rust-2018/dyn-trait-compatibility.rs +++ b/src/test/ui/rust-2018/dyn-trait-compatibility.rs @@ -1,7 +1,7 @@ // edition:2018 type A0 = dyn; -type A1 = dyn::dyn; //~ERROR expected identifier, found reserved keyword +type A1 = dyn::dyn; //~ERROR expected identifier, found keyword `dyn` type A2 = dyn; //~ERROR expected identifier, found `<` type A3 = dyn<::dyn>; diff --git a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr index ea0483394b5..6be00520465 100644 --- a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr +++ b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr @@ -1,8 +1,12 @@ -error: expected identifier, found reserved keyword `dyn` +error: expected identifier, found keyword `dyn` --> $DIR/dyn-trait-compatibility.rs:4:16 | -LL | type A1 = dyn::dyn; //~ERROR expected identifier, found reserved keyword - | ^^^ expected identifier, found reserved keyword +LL | type A1 = dyn::dyn; //~ERROR expected identifier, found keyword `dyn` + | ^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | type A1 = dyn::r#dyn; //~ERROR expected identifier, found keyword `dyn` + | ^^^^^ error: expected identifier, found `<` --> $DIR/dyn-trait-compatibility.rs:5:14 diff --git a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.fixed b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.fixed index 211d2b726de..76fbfa66031 100644 --- a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.fixed +++ b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![feature(rust_2018_preview, crate_visibility_modifier)] diff --git a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.rs b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.rs index 90b5a7f8162..ace90a180d6 100644 --- a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.rs +++ b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![feature(rust_2018_preview, crate_visibility_modifier)] diff --git a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.stderr b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.stderr index 5d8e84bb82a..412ebe1a9c4 100644 --- a/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.stderr +++ b/src/test/ui/rust-2018/edition-lint-fully-qualified-paths.stderr @@ -1,11 +1,11 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-fully-qualified-paths.rs:30:25 + --> $DIR/edition-lint-fully-qualified-paths.rs:20:25 | LL | let _: ::Bar = (); | ^^^^^^^^^^ help: use `crate`: `crate::foo::Foo` | note: lint level defined here - --> $DIR/edition-lint-fully-qualified-paths.rs:14:9 + --> $DIR/edition-lint-fully-qualified-paths.rs:4:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | #![deny(absolute_paths_not_starting_with_crate)] = note: for more information, see issue #53130 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-fully-qualified-paths.rs:34:13 + --> $DIR/edition-lint-fully-qualified-paths.rs:24:13 | LL | let _: <::foo::Baz as foo::Foo>::Bar = (); | ^^^^^^^^^^ help: use `crate`: `crate::foo::Baz` diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.rs b/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.rs index 441e1446e5a..ca6abdf5e70 100644 --- a/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.rs +++ b/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] #![deny(explicit_outlives_requirements)] diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr b/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr index 8b05a809461..3c65dde0162 100644 --- a/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr +++ b/src/test/ui/rust-2018/edition-lint-infer-outlives-multispan.stderr @@ -1,11 +1,11 @@ error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives-multispan.rs:21:43 + --> $DIR/edition-lint-infer-outlives-multispan.rs:11:43 | LL | struct TeeOutlivesAyIsDebugBee<'a, 'b, T: 'a + Debug + 'b> { | ^^^^^ ^^^^^ | note: lint level defined here - --> $DIR/edition-lint-infer-outlives-multispan.rs:12:9 + --> $DIR/edition-lint-infer-outlives-multispan.rs:2:9 | LL | #![deny(explicit_outlives_requirements)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | struct TeeOutlivesAyIsDebugBee<'a, 'b, T: Debug> { | -- -- error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives-multispan.rs:26:57 + --> $DIR/edition-lint-infer-outlives-multispan.rs:16:57 | LL | struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: 'a + Debug + 'b { | ^^^^^ ^^^^^ @@ -25,7 +25,7 @@ LL | struct TeeWhereOutlivesAyIsDebugBee<'a, 'b, T> where T: Debug { | -- -- error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives-multispan.rs:31:49 + --> $DIR/edition-lint-infer-outlives-multispan.rs:21:49 | LL | struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: 'a + Debug + 'b> { | ^^^^^ ^^^^^ @@ -35,7 +35,7 @@ LL | struct TeeYooOutlivesAyIsDebugBee<'a, 'b, T, U: Debug> { | -- -- error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives-multispan.rs:37:44 + --> $DIR/edition-lint-infer-outlives-multispan.rs:27:44 | LL | struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T: 'a, U: 'b + Debug> { | ^^^^ ^^^^^ @@ -45,7 +45,7 @@ LL | struct TeeOutlivesAyYooBeeIsDebug<'a, 'b, T, U: Debug> { | -- -- error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives-multispan.rs:43:44 + --> $DIR/edition-lint-infer-outlives-multispan.rs:33:44 | LL | struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T: 'a, U: Debug + 'b> { | ^^^^ ^^^^^ @@ -55,7 +55,7 @@ LL | struct TeeOutlivesAyYooIsDebugBee<'a, 'b, T, U: Debug> { | -- -- error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives-multispan.rs:49:42 + --> $DIR/edition-lint-infer-outlives-multispan.rs:39:42 | LL | struct TeeOutlivesAyYooWhereBee<'a, 'b, T: 'a, U> where U: 'b { | ^^^^ ^^^^^^^^^^^^ @@ -65,7 +65,7 @@ LL | struct TeeOutlivesAyYooWhereBee<'a, 'b, T, U> { | -- -- error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives-multispan.rs:55:63 + --> $DIR/edition-lint-infer-outlives-multispan.rs:45:63 | LL | struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: 'a + Debug + 'b { | ^^^^^ ^^^^^ @@ -75,7 +75,7 @@ LL | struct TeeYooWhereOutlivesAyIsDebugBee<'a, 'b, T, U> where U: Debug { | -- -- error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives-multispan.rs:61:49 + --> $DIR/edition-lint-infer-outlives-multispan.rs:51:49 | LL | struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T: 'a, U> where U: 'b + Debug { | ^^^^ ^^^^^ @@ -85,7 +85,7 @@ LL | struct TeeOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { | -- -- error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives-multispan.rs:67:49 + --> $DIR/edition-lint-infer-outlives-multispan.rs:57:49 | LL | struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T: 'a, U> where U: Debug + 'b { | ^^^^ ^^^^^ @@ -95,7 +95,7 @@ LL | struct TeeOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where U: Debug { | -- -- error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives-multispan.rs:73:65 + --> $DIR/edition-lint-infer-outlives-multispan.rs:63:65 | LL | struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where T: 'a, U: 'b + Debug { | ^^^^^^^ ^^^^^ @@ -105,7 +105,7 @@ LL | struct TeeWhereOutlivesAyYooWhereBeeIsDebug<'a, 'b, T, U> where U: Debug { | -- -- error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives-multispan.rs:79:65 + --> $DIR/edition-lint-infer-outlives-multispan.rs:69:65 | LL | struct TeeWhereOutlivesAyYooWhereIsDebugBee<'a, 'b, T, U> where T: 'a, U: Debug + 'b { | ^^^^^^^ ^^^^^ diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives.fixed b/src/test/ui/rust-2018/edition-lint-infer-outlives.fixed index f13f8ef2bb4..eb48933dca5 100644 --- a/src/test/ui/rust-2018/edition-lint-infer-outlives.fixed +++ b/src/test/ui/rust-2018/edition-lint-infer-outlives.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![allow(unused)] diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives.rs b/src/test/ui/rust-2018/edition-lint-infer-outlives.rs index f47b3fcb9be..fd31341365c 100644 --- a/src/test/ui/rust-2018/edition-lint-infer-outlives.rs +++ b/src/test/ui/rust-2018/edition-lint-infer-outlives.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![allow(unused)] diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives.stderr b/src/test/ui/rust-2018/edition-lint-infer-outlives.stderr index 910de1dd06c..8b957984af5 100644 --- a/src/test/ui/rust-2018/edition-lint-infer-outlives.stderr +++ b/src/test/ui/rust-2018/edition-lint-infer-outlives.stderr @@ -1,185 +1,185 @@ error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:35:27 + --> $DIR/edition-lint-infer-outlives.rs:25:27 | LL | struct TeeOutlivesAy<'a, T: 'a> { | ^^^^ help: remove this bound | note: lint level defined here - --> $DIR/edition-lint-infer-outlives.rs:14:9 + --> $DIR/edition-lint-infer-outlives.rs:4:9 | LL | #![deny(explicit_outlives_requirements)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:40:36 + --> $DIR/edition-lint-infer-outlives.rs:30:36 | LL | struct TeeOutlivesAyIsDebug<'a, T: 'a + Debug> { | ^^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:45:41 + --> $DIR/edition-lint-infer-outlives.rs:35:41 | LL | struct TeeIsDebugOutlivesAy<'a, T: Debug + 'a> { | ^^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:50:34 + --> $DIR/edition-lint-infer-outlives.rs:40:34 | LL | struct TeeOutlivesAyBee<'a, 'b, T: 'a + 'b> { | ^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:55:43 + --> $DIR/edition-lint-infer-outlives.rs:45:43 | LL | struct TeeOutlivesAyBeeIsDebug<'a, 'b, T: 'a + 'b + Debug> { | ^^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:60:48 + --> $DIR/edition-lint-infer-outlives.rs:50:48 | LL | struct TeeIsDebugOutlivesAyBee<'a, 'b, T: Debug + 'a + 'b> { | ^^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:65:33 + --> $DIR/edition-lint-infer-outlives.rs:55:33 | LL | struct TeeWhereOutlivesAy<'a, T> where T: 'a { | ^^^^^^^^^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:70:50 + --> $DIR/edition-lint-infer-outlives.rs:60:50 | LL | struct TeeWhereOutlivesAyIsDebug<'a, T> where T: 'a + Debug { | ^^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:75:55 + --> $DIR/edition-lint-infer-outlives.rs:65:55 | LL | struct TeeWhereIsDebugOutlivesAy<'a, T> where T: Debug + 'a { | ^^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:80:40 + --> $DIR/edition-lint-infer-outlives.rs:70:40 | LL | struct TeeWhereOutlivesAyBee<'a, 'b, T> where T: 'a + 'b { | ^^^^^^^^^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:85:57 + --> $DIR/edition-lint-infer-outlives.rs:75:57 | LL | struct TeeWhereOutlivesAyBeeIsDebug<'a, 'b, T> where T: 'a + 'b + Debug { | ^^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:90:62 + --> $DIR/edition-lint-infer-outlives.rs:80:62 | LL | struct TeeWhereIsDebugOutlivesAyBee<'a, 'b, T> where T: Debug + 'a + 'b { | ^^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:95:33 + --> $DIR/edition-lint-infer-outlives.rs:85:33 | LL | struct TeeYooOutlivesAy<'a, T, U: 'a> { | ^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:101:42 + --> $DIR/edition-lint-infer-outlives.rs:91:42 | LL | struct TeeYooOutlivesAyIsDebug<'a, T, U: 'a + Debug> { | ^^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:107:47 + --> $DIR/edition-lint-infer-outlives.rs:97:47 | LL | struct TeeYooIsDebugOutlivesAy<'a, T, U: Debug + 'a> { | ^^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:113:37 + --> $DIR/edition-lint-infer-outlives.rs:103:37 | LL | struct TeeOutlivesAyYooIsDebug<'a, T: 'a, U: Debug> { | ^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:119:40 + --> $DIR/edition-lint-infer-outlives.rs:109:40 | LL | struct TeeYooOutlivesAyBee<'a, 'b, T, U: 'a + 'b> { | ^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:125:49 + --> $DIR/edition-lint-infer-outlives.rs:115:49 | LL | struct TeeYooOutlivesAyBeeIsDebug<'a, 'b, T, U: 'a + 'b + Debug> { | ^^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:131:54 + --> $DIR/edition-lint-infer-outlives.rs:121:54 | LL | struct TeeYooIsDebugOutlivesAyBee<'a, 'b, T, U: Debug + 'a + 'b> { | ^^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:137:44 + --> $DIR/edition-lint-infer-outlives.rs:127:44 | LL | struct TeeOutlivesAyBeeYooIsDebug<'a, 'b, T: 'a + 'b, U: Debug> { | ^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:143:39 + --> $DIR/edition-lint-infer-outlives.rs:133:39 | LL | struct TeeYooWhereOutlivesAy<'a, T, U> where U: 'a { | ^^^^^^^^^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:149:56 + --> $DIR/edition-lint-infer-outlives.rs:139:56 | LL | struct TeeYooWhereOutlivesAyIsDebug<'a, T, U> where U: 'a + Debug { | ^^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:155:61 + --> $DIR/edition-lint-infer-outlives.rs:145:61 | LL | struct TeeYooWhereIsDebugOutlivesAy<'a, T, U> where U: Debug + 'a { | ^^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:161:42 + --> $DIR/edition-lint-infer-outlives.rs:151:42 | LL | struct TeeOutlivesAyYooWhereIsDebug<'a, T: 'a, U> where U: Debug { | ^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:167:46 + --> $DIR/edition-lint-infer-outlives.rs:157:46 | LL | struct TeeYooWhereOutlivesAyBee<'a, 'b, T, U> where U: 'a + 'b { | ^^^^^^^^^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:173:63 + --> $DIR/edition-lint-infer-outlives.rs:163:63 | LL | struct TeeYooWhereOutlivesAyBeeIsDebug<'a, 'b, T, U> where U: 'a + 'b + Debug { | ^^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:179:68 + --> $DIR/edition-lint-infer-outlives.rs:169:68 | LL | struct TeeYooWhereIsDebugOutlivesAyBee<'a, 'b, T, U> where U: Debug + 'a + 'b { | ^^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:185:49 + --> $DIR/edition-lint-infer-outlives.rs:175:49 | LL | struct TeeOutlivesAyBeeYooWhereIsDebug<'a, 'b, T: 'a + 'b, U> where U: Debug { | ^^^^^^^^^ help: remove these bounds error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:191:58 + --> $DIR/edition-lint-infer-outlives.rs:181:58 | LL | struct TeeWhereOutlivesAyYooWhereIsDebug<'a, T, U> where T: 'a, U: Debug { | ^^^^^^^ help: remove this bound error: outlives requirements can be inferred - --> $DIR/edition-lint-infer-outlives.rs:197:65 + --> $DIR/edition-lint-infer-outlives.rs:187:65 | LL | struct TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: Debug { | ^^^^^^^^^^^^ help: remove these bounds diff --git a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.fixed b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.fixed index 94803a117dc..77478e8c608 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.fixed +++ b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![feature(rust_2018_preview, crate_visibility_modifier)] diff --git a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.rs b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.rs index 7f68eeff438..69bd4e3a187 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.rs +++ b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![feature(rust_2018_preview, crate_visibility_modifier)] diff --git a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.stderr b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.stderr index 5503a0a8f41..742203e9985 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-empty-paths.stderr +++ b/src/test/ui/rust-2018/edition-lint-nested-empty-paths.stderr @@ -1,11 +1,11 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-nested-empty-paths.rs:27:5 + --> $DIR/edition-lint-nested-empty-paths.rs:17:5 | LL | use foo::{bar::{baz::{}}}; | ^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{baz::{}}}` | note: lint level defined here - --> $DIR/edition-lint-nested-empty-paths.rs:14:9 + --> $DIR/edition-lint-nested-empty-paths.rs:4:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | #![deny(absolute_paths_not_starting_with_crate)] = note: for more information, see issue #53130 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-nested-empty-paths.rs:31:5 + --> $DIR/edition-lint-nested-empty-paths.rs:21:5 | LL | use foo::{bar::{XX, baz::{}}}; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{XX, baz::{}}}` @@ -22,7 +22,7 @@ LL | use foo::{bar::{XX, baz::{}}}; = note: for more information, see issue #53130 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-nested-empty-paths.rs:35:5 + --> $DIR/edition-lint-nested-empty-paths.rs:25:5 | LL | use foo::{bar::{baz::{}, baz1::{}}}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{bar::{baz::{}, baz1::{}}}` diff --git a/src/test/ui/rust-2018/edition-lint-nested-paths.fixed b/src/test/ui/rust-2018/edition-lint-nested-paths.fixed index ee54229bfb2..da7524a63e2 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-paths.fixed +++ b/src/test/ui/rust-2018/edition-lint-nested-paths.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![feature(rust_2018_preview, crate_visibility_modifier)] diff --git a/src/test/ui/rust-2018/edition-lint-nested-paths.rs b/src/test/ui/rust-2018/edition-lint-nested-paths.rs index 9a42f5f28c8..e13b7d00864 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-paths.rs +++ b/src/test/ui/rust-2018/edition-lint-nested-paths.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![feature(rust_2018_preview, crate_visibility_modifier)] diff --git a/src/test/ui/rust-2018/edition-lint-nested-paths.stderr b/src/test/ui/rust-2018/edition-lint-nested-paths.stderr index 0f8c77aef16..6cd8e9acd10 100644 --- a/src/test/ui/rust-2018/edition-lint-nested-paths.stderr +++ b/src/test/ui/rust-2018/edition-lint-nested-paths.stderr @@ -1,11 +1,11 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-nested-paths.rs:16:5 + --> $DIR/edition-lint-nested-paths.rs:6:5 | LL | use foo::{a, b}; | ^^^^^^^^^^^ help: use `crate`: `crate::foo::{a, b}` | note: lint level defined here - --> $DIR/edition-lint-nested-paths.rs:14:9 + --> $DIR/edition-lint-nested-paths.rs:4:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | #![deny(absolute_paths_not_starting_with_crate)] = note: for more information, see issue #53130 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-nested-paths.rs:31:13 + --> $DIR/edition-lint-nested-paths.rs:21:13 | LL | use foo::{self as x, c}; | ^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::{self as x, c}` diff --git a/src/test/ui/rust-2018/edition-lint-paths-2018.rs b/src/test/ui/rust-2018/edition-lint-paths-2018.rs new file mode 100644 index 00000000000..09b31beb775 --- /dev/null +++ b/src/test/ui/rust-2018/edition-lint-paths-2018.rs @@ -0,0 +1,10 @@ +// compile-pass +// edition:2018 +// compile-flags:--extern edition_lint_paths +// aux-build:edition-lint-paths.rs + +#![deny(absolute_paths_not_starting_with_crate)] + +edition_lint_paths::macro_2015!(); // OK + +fn main() {} diff --git a/src/test/ui/rust-2018/edition-lint-paths.fixed b/src/test/ui/rust-2018/edition-lint-paths.fixed index 8a2b9c1f272..de16291fea6 100644 --- a/src/test/ui/rust-2018/edition-lint-paths.fixed +++ b/src/test/ui/rust-2018/edition-lint-paths.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:edition-lint-paths.rs // run-rustfix diff --git a/src/test/ui/rust-2018/edition-lint-paths.rs b/src/test/ui/rust-2018/edition-lint-paths.rs index b6e5d5a8afb..c5b4be5a3ac 100644 --- a/src/test/ui/rust-2018/edition-lint-paths.rs +++ b/src/test/ui/rust-2018/edition-lint-paths.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:edition-lint-paths.rs // run-rustfix diff --git a/src/test/ui/rust-2018/edition-lint-paths.stderr b/src/test/ui/rust-2018/edition-lint-paths.stderr index 9429c946baa..4f1904a1f8a 100644 --- a/src/test/ui/rust-2018/edition-lint-paths.stderr +++ b/src/test/ui/rust-2018/edition-lint-paths.stderr @@ -1,11 +1,11 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-paths.rs:22:9 + --> $DIR/edition-lint-paths.rs:12:9 | LL | use ::bar::Bar; | ^^^^^^^^^^ help: use `crate`: `crate::bar::Bar` | note: lint level defined here - --> $DIR/edition-lint-paths.rs:15:9 + --> $DIR/edition-lint-paths.rs:5:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | #![deny(absolute_paths_not_starting_with_crate)] = note: for more information, see issue #53130 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-paths.rs:28:9 + --> $DIR/edition-lint-paths.rs:18:9 | LL | use bar; | ^^^ help: use `crate`: `crate::bar` @@ -22,7 +22,7 @@ LL | use bar; = note: for more information, see issue #53130 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-paths.rs:33:9 + --> $DIR/edition-lint-paths.rs:23:9 | LL | use {Bar as SomethingElse, main}; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::{Bar as SomethingElse, main}` @@ -31,7 +31,7 @@ LL | use {Bar as SomethingElse, main}; = note: for more information, see issue #53130 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-paths.rs:45:5 + --> $DIR/edition-lint-paths.rs:35:5 | LL | use bar::Bar; | ^^^^^^^^ help: use `crate`: `crate::bar::Bar` @@ -40,7 +40,7 @@ LL | use bar::Bar; = note: for more information, see issue #53130 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-paths.rs:57:9 + --> $DIR/edition-lint-paths.rs:47:9 | LL | use *; | ^ help: use `crate`: `crate::*` @@ -49,7 +49,7 @@ LL | use *; = note: for more information, see issue #53130 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-paths.rs:62:6 + --> $DIR/edition-lint-paths.rs:52:6 | LL | impl ::foo::SomeTrait for u32 { } | ^^^^^^^^^^^^^^^^ help: use `crate`: `crate::foo::SomeTrait` @@ -58,7 +58,7 @@ LL | impl ::foo::SomeTrait for u32 { } = note: for more information, see issue #53130 error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/edition-lint-paths.rs:67:13 + --> $DIR/edition-lint-paths.rs:57:13 | LL | let x = ::bar::Bar; | ^^^^^^^^^^ help: use `crate`: `crate::bar::Bar` diff --git a/src/test/ui/rust-2018/edition-lint-uninferable-outlives.rs b/src/test/ui/rust-2018/edition-lint-uninferable-outlives.rs index 00059294a97..323c6e105f5 100644 --- a/src/test/ui/rust-2018/edition-lint-uninferable-outlives.rs +++ b/src/test/ui/rust-2018/edition-lint-uninferable-outlives.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(unused)] diff --git a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed index 36a837509c5..a9f4a1edbb6 100644 --- a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed +++ b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:edition-lint-paths.rs // run-rustfix // compile-flags:--extern edition_lint_paths diff --git a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.rs b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.rs index 9daa4145630..02e3e83df12 100644 --- a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.rs +++ b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:edition-lint-paths.rs // run-rustfix // compile-flags:--extern edition_lint_paths diff --git a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr index b3afa2bd1d5..f3f91939486 100644 --- a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr +++ b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr @@ -1,18 +1,18 @@ error: unused extern crate - --> $DIR/extern-crate-idiomatic-in-2018.rs:22:1 + --> $DIR/extern-crate-idiomatic-in-2018.rs:12:1 | LL | extern crate edition_lint_paths; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | note: lint level defined here - --> $DIR/extern-crate-idiomatic-in-2018.rs:19:9 + --> $DIR/extern-crate-idiomatic-in-2018.rs:9:9 | LL | #![deny(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: #[deny(unused_extern_crates)] implied by #[deny(rust_2018_idioms)] error: `extern crate` is not idiomatic in the new edition - --> $DIR/extern-crate-idiomatic-in-2018.rs:25:1 + --> $DIR/extern-crate-idiomatic-in-2018.rs:15:1 | LL | extern crate edition_lint_paths as bar; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` diff --git a/src/test/ui/rust-2018/extern-crate-idiomatic.fixed b/src/test/ui/rust-2018/extern-crate-idiomatic.fixed index 0be1f2cc72b..38dddf38d30 100644 --- a/src/test/ui/rust-2018/extern-crate-idiomatic.fixed +++ b/src/test/ui/rust-2018/extern-crate-idiomatic.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:edition-lint-paths.rs // compile-flags:--extern edition_lint_paths diff --git a/src/test/ui/rust-2018/extern-crate-idiomatic.rs b/src/test/ui/rust-2018/extern-crate-idiomatic.rs index 0be1f2cc72b..38dddf38d30 100644 --- a/src/test/ui/rust-2018/extern-crate-idiomatic.rs +++ b/src/test/ui/rust-2018/extern-crate-idiomatic.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:edition-lint-paths.rs // compile-flags:--extern edition_lint_paths diff --git a/src/test/ui/rust-2018/extern-crate-referenced-by-self-path.fixed b/src/test/ui/rust-2018/extern-crate-referenced-by-self-path.fixed index 6f38978ae8a..e249c8a026d 100644 --- a/src/test/ui/rust-2018/extern-crate-referenced-by-self-path.fixed +++ b/src/test/ui/rust-2018/extern-crate-referenced-by-self-path.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:edition-lint-paths.rs // run-rustfix diff --git a/src/test/ui/rust-2018/extern-crate-referenced-by-self-path.rs b/src/test/ui/rust-2018/extern-crate-referenced-by-self-path.rs index 6f38978ae8a..e249c8a026d 100644 --- a/src/test/ui/rust-2018/extern-crate-referenced-by-self-path.rs +++ b/src/test/ui/rust-2018/extern-crate-referenced-by-self-path.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // aux-build:edition-lint-paths.rs // run-rustfix diff --git a/src/test/ui/rust-2018/extern-crate-rename.fixed b/src/test/ui/rust-2018/extern-crate-rename.fixed index e54fe1966e0..aa8b935289e 100644 --- a/src/test/ui/rust-2018/extern-crate-rename.fixed +++ b/src/test/ui/rust-2018/extern-crate-rename.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:edition-lint-paths.rs // run-rustfix diff --git a/src/test/ui/rust-2018/extern-crate-rename.rs b/src/test/ui/rust-2018/extern-crate-rename.rs index 549f8efb7a4..98c7d341bff 100644 --- a/src/test/ui/rust-2018/extern-crate-rename.rs +++ b/src/test/ui/rust-2018/extern-crate-rename.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:edition-lint-paths.rs // run-rustfix diff --git a/src/test/ui/rust-2018/extern-crate-rename.stderr b/src/test/ui/rust-2018/extern-crate-rename.stderr index 0004880e760..4e33b1e959a 100644 --- a/src/test/ui/rust-2018/extern-crate-rename.stderr +++ b/src/test/ui/rust-2018/extern-crate-rename.stderr @@ -1,11 +1,11 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/extern-crate-rename.rs:22:5 + --> $DIR/extern-crate-rename.rs:12:5 | LL | use my_crate::foo; | ^^^^^^^^^^^^^ help: use `crate`: `crate::my_crate::foo` | note: lint level defined here - --> $DIR/extern-crate-rename.rs:18:9 + --> $DIR/extern-crate-rename.rs:8:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rust-2018/extern-crate-submod.fixed b/src/test/ui/rust-2018/extern-crate-submod.fixed index 5d36c12103a..0564e58f3c7 100644 --- a/src/test/ui/rust-2018/extern-crate-submod.fixed +++ b/src/test/ui/rust-2018/extern-crate-submod.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:edition-lint-paths.rs // run-rustfix diff --git a/src/test/ui/rust-2018/extern-crate-submod.rs b/src/test/ui/rust-2018/extern-crate-submod.rs index 5951e12d545..206f3903b47 100644 --- a/src/test/ui/rust-2018/extern-crate-submod.rs +++ b/src/test/ui/rust-2018/extern-crate-submod.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:edition-lint-paths.rs // run-rustfix diff --git a/src/test/ui/rust-2018/extern-crate-submod.stderr b/src/test/ui/rust-2018/extern-crate-submod.stderr index 4a4652c907e..e0b61dd265c 100644 --- a/src/test/ui/rust-2018/extern-crate-submod.stderr +++ b/src/test/ui/rust-2018/extern-crate-submod.stderr @@ -1,11 +1,11 @@ error: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/extern-crate-submod.rs:29:5 + --> $DIR/extern-crate-submod.rs:19:5 | LL | use m::edition_lint_paths::foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::m::edition_lint_paths::foo` | note: lint level defined here - --> $DIR/extern-crate-submod.rs:19:9 + --> $DIR/extern-crate-submod.rs:9:9 | LL | #![deny(absolute_paths_not_starting_with_crate)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rust-2018/future-proofing-locals.rs b/src/test/ui/rust-2018/future-proofing-locals.rs index d2e6dbbb954..1e53c2d1dac 100644 --- a/src/test/ui/rust-2018/future-proofing-locals.rs +++ b/src/test/ui/rust-2018/future-proofing-locals.rs @@ -1,6 +1,6 @@ // edition:2018 -#![feature(uniform_paths, underscore_imports)] +#![allow(non_camel_case_types)] mod T { pub struct U; @@ -16,7 +16,7 @@ fn type_param() { } fn self_import() { - use T; // FIXME Should be an error, but future-proofing fails due to `T` being "self-shadowed" + use T; //~ ERROR imports cannot refer to type parameters } fn let_binding() { diff --git a/src/test/ui/rust-2018/future-proofing-locals.stderr b/src/test/ui/rust-2018/future-proofing-locals.stderr index 68354b332a9..413e199cd64 100644 --- a/src/test/ui/rust-2018/future-proofing-locals.stderr +++ b/src/test/ui/rust-2018/future-proofing-locals.stderr @@ -16,6 +16,12 @@ error: imports cannot refer to type parameters LL | use T::*; //~ ERROR imports cannot refer to type parameters | ^ +error: imports cannot refer to type parameters + --> $DIR/future-proofing-locals.rs:19:9 + | +LL | use T; //~ ERROR imports cannot refer to type parameters + | ^ + error: imports cannot refer to local variables --> $DIR/future-proofing-locals.rs:25:9 | @@ -46,5 +52,5 @@ error: imports cannot refer to local variables LL | use {T as _, x}; //~ ERROR imports cannot refer to type parameters | ^ -error: aborting due to 8 previous errors +error: aborting due to 9 previous errors diff --git a/src/test/ui/rust-2018/issue-51008-1.rs b/src/test/ui/rust-2018/issue-51008-1.rs index 4a76d683d6e..8ae5e827846 100644 --- a/src/test/ui/rust-2018/issue-51008-1.rs +++ b/src/test/ui/rust-2018/issue-51008-1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #51008 -- the anonymous lifetime in `&i32` was // being incorrectly considered part of the "elided lifetimes" from // the impl. diff --git a/src/test/ui/rust-2018/issue-51008.rs b/src/test/ui/rust-2018/issue-51008.rs index eb2673857e2..b62609e329d 100644 --- a/src/test/ui/rust-2018/issue-51008.rs +++ b/src/test/ui/rust-2018/issue-51008.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #51008 -- the anonymous lifetime in `&i32` was // being incorrectly considered part of the "elided lifetimes" from // the impl. diff --git a/src/test/ui/rust-2018/issue-52202-use-suggestions.rs b/src/test/ui/rust-2018/issue-52202-use-suggestions.rs index deb80411bbf..1c0426808c7 100644 --- a/src/test/ui/rust-2018/issue-52202-use-suggestions.rs +++ b/src/test/ui/rust-2018/issue-52202-use-suggestions.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // The local `use` suggestion should start with `crate::` (but the diff --git a/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr b/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr index 95158dbd853..030fa56dcff 100644 --- a/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr +++ b/src/test/ui/rust-2018/issue-52202-use-suggestions.stderr @@ -1,5 +1,5 @@ error[E0422]: cannot find struct, variant or union type `Drain` in this scope - --> $DIR/issue-52202-use-suggestions.rs:21:14 + --> $DIR/issue-52202-use-suggestions.rs:11:14 | LL | let _d = Drain {}; | ^^^^^ not found in this scope diff --git a/src/test/ui/rust-2018/issue-54006.rs b/src/test/ui/rust-2018/issue-54006.rs index ee58d240fcb..a7a4770fc02 100644 --- a/src/test/ui/rust-2018/issue-54006.rs +++ b/src/test/ui/rust-2018/issue-54006.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 #![no_std] diff --git a/src/test/ui/rust-2018/issue-54006.stderr b/src/test/ui/rust-2018/issue-54006.stderr index 5f92574c23f..6c6d7720be2 100644 --- a/src/test/ui/rust-2018/issue-54006.stderr +++ b/src/test/ui/rust-2018/issue-54006.stderr @@ -1,11 +1,11 @@ error[E0432]: unresolved import `alloc` - --> $DIR/issue-54006.rs:16:5 + --> $DIR/issue-54006.rs:6:5 | LL | use alloc::vec; | ^^^^^ did you mean `core::alloc`? error: cannot determine resolution for the macro `vec` - --> $DIR/issue-54006.rs:20:18 + --> $DIR/issue-54006.rs:10:18 | LL | let mut xs = vec![]; | ^^^ diff --git a/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed b/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed index 20ebe6bb543..d592438009a 100644 --- a/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed +++ b/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:edition-lint-paths.rs // run-rustfix // compile-flags:--extern edition_lint_paths --cfg blandiloquence diff --git a/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.rs b/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.rs index 11febe5e87d..a948baee53c 100644 --- a/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.rs +++ b/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:edition-lint-paths.rs // run-rustfix // compile-flags:--extern edition_lint_paths --cfg blandiloquence diff --git a/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr b/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr index cb945ba1c78..7f3f6ccf39e 100644 --- a/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr +++ b/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr @@ -1,5 +1,5 @@ error: unused extern crate - --> $DIR/issue-54400-unused-extern-crate-attr-span.rs:22:1 + --> $DIR/issue-54400-unused-extern-crate-attr-span.rs:12:1 | LL | / #[cfg(blandiloquence)] //~ HELP remove it LL | | extern crate edition_lint_paths; @@ -8,7 +8,7 @@ LL | | extern crate edition_lint_paths; | help: remove it | note: lint level defined here - --> $DIR/issue-54400-unused-extern-crate-attr-span.rs:16:9 + --> $DIR/issue-54400-unused-extern-crate-attr-span.rs:6:9 | LL | #![deny(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rust-2018/local-path-suggestions-2015.rs b/src/test/ui/rust-2018/local-path-suggestions-2015.rs index c691d294822..32e9c0c3366 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2015.rs +++ b/src/test/ui/rust-2018/local-path-suggestions-2015.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:baz.rs // compile-flags:--extern baz // edition:2015 @@ -31,6 +21,6 @@ mod baz { use foo::Bar; -use foobar::Baz; +use foobar::Baz; //~ ERROR unresolved import `foobar` fn main() { } diff --git a/src/test/ui/rust-2018/local-path-suggestions-2015.stderr b/src/test/ui/rust-2018/local-path-suggestions-2015.stderr index 741b2ca0826..be642c3bcdc 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2015.stderr +++ b/src/test/ui/rust-2018/local-path-suggestions-2015.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `foobar` - --> $DIR/local-path-suggestions-2015.rs:34:5 + --> $DIR/local-path-suggestions-2015.rs:24:5 | -LL | use foobar::Baz; +LL | use foobar::Baz; //~ ERROR unresolved import `foobar` | ^^^^^^ did you mean `aux_baz::foobar`? error: aborting due to previous error diff --git a/src/test/ui/rust-2018/local-path-suggestions-2018.rs b/src/test/ui/rust-2018/local-path-suggestions-2018.rs index 0d4aefff931..5eafbb2c2fc 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2018.rs +++ b/src/test/ui/rust-2018/local-path-suggestions-2018.rs @@ -1,19 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:baz.rs // compile-flags:--extern baz // edition:2018 -#![feature(uniform_paths)] - mod foo { pub type Bar = u32; } diff --git a/src/test/ui/rust-2018/local-path-suggestions-2018.stderr b/src/test/ui/rust-2018/local-path-suggestions-2018.stderr index a445a4c612b..71c8289264f 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2018.stderr +++ b/src/test/ui/rust-2018/local-path-suggestions-2018.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `foo` - --> $DIR/local-path-suggestions-2018.rs:22:9 + --> $DIR/local-path-suggestions-2018.rs:10:9 | LL | use foo::Bar; //~ ERROR unresolved import `foo` | ^^^ did you mean `crate::foo`? @@ -7,7 +7,7 @@ LL | use foo::Bar; //~ ERROR unresolved import `foo` = note: `use` statements changed in Rust 2018; read more at error[E0432]: unresolved import `foobar` - --> $DIR/local-path-suggestions-2018.rs:31:5 + --> $DIR/local-path-suggestions-2018.rs:19:5 | LL | use foobar::Baz; //~ ERROR unresolved import `foobar` | ^^^^^^ did you mean `baz::foobar`? diff --git a/src/test/ui/rust-2018/macro-use-warned-against.rs b/src/test/ui/rust-2018/macro-use-warned-against.rs index ce4c6960281..368b8daf243 100644 --- a/src/test/ui/rust-2018/macro-use-warned-against.rs +++ b/src/test/ui/rust-2018/macro-use-warned-against.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:macro-use-warned-against.rs // aux-build:macro-use-warned-against2.rs // compile-pass diff --git a/src/test/ui/rust-2018/macro-use-warned-against.stderr b/src/test/ui/rust-2018/macro-use-warned-against.stderr index da69daf6ba8..55213a77a2c 100644 --- a/src/test/ui/rust-2018/macro-use-warned-against.stderr +++ b/src/test/ui/rust-2018/macro-use-warned-against.stderr @@ -1,23 +1,23 @@ warning: deprecated `#[macro_use]` directive used to import macros should be replaced at use sites with a `use` statement to import the macro instead - --> $DIR/macro-use-warned-against.rs:17:1 + --> $DIR/macro-use-warned-against.rs:7:1 | LL | #[macro_use] //~ WARN should be replaced at use sites with a `use` statement | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/macro-use-warned-against.rs:15:9 + --> $DIR/macro-use-warned-against.rs:5:9 | LL | #![warn(macro_use_extern_crate, unused)] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused `#[macro_use]` import - --> $DIR/macro-use-warned-against.rs:19:1 + --> $DIR/macro-use-warned-against.rs:9:1 | LL | #[macro_use] //~ WARN unused `#[macro_use]` | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/macro-use-warned-against.rs:15:33 + --> $DIR/macro-use-warned-against.rs:5:33 | LL | #![warn(macro_use_extern_crate, unused)] | ^^^^^^ diff --git a/src/test/ui/rust-2018/proc-macro-crate-in-paths.rs b/src/test/ui/rust-2018/proc-macro-crate-in-paths.rs new file mode 100644 index 00000000000..3311ded5531 --- /dev/null +++ b/src/test/ui/rust-2018/proc-macro-crate-in-paths.rs @@ -0,0 +1,16 @@ +// compile-pass +// force-host +// no-prefer-dynamic + +#![crate_type = "proc-macro"] +#![deny(rust_2018_compatibility)] +#![feature(rust_2018_preview)] + +extern crate proc_macro; + +use proc_macro::TokenStream; + +#[proc_macro_derive(Template, attributes(template))] +pub fn derive_template(input: TokenStream) -> TokenStream { + input +} diff --git a/src/test/ui/rust-2018/remove-extern-crate.fixed b/src/test/ui/rust-2018/remove-extern-crate.fixed index 34c7266b637..a977e00c013 100644 --- a/src/test/ui/rust-2018/remove-extern-crate.fixed +++ b/src/test/ui/rust-2018/remove-extern-crate.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix // edition:2018 // compile-pass diff --git a/src/test/ui/rust-2018/remove-extern-crate.rs b/src/test/ui/rust-2018/remove-extern-crate.rs index 570bbb02f72..cafe82d846e 100644 --- a/src/test/ui/rust-2018/remove-extern-crate.rs +++ b/src/test/ui/rust-2018/remove-extern-crate.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix // edition:2018 // compile-pass diff --git a/src/test/ui/rust-2018/remove-extern-crate.stderr b/src/test/ui/rust-2018/remove-extern-crate.stderr index 847ba5f3544..4e08b7aa6a0 100644 --- a/src/test/ui/rust-2018/remove-extern-crate.stderr +++ b/src/test/ui/rust-2018/remove-extern-crate.stderr @@ -1,24 +1,24 @@ warning: unused extern crate - --> $DIR/remove-extern-crate.rs:20:1 + --> $DIR/remove-extern-crate.rs:10:1 | LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ help: remove it | note: lint level defined here - --> $DIR/remove-extern-crate.rs:18:9 + --> $DIR/remove-extern-crate.rs:8:9 | LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: #[warn(unused_extern_crates)] implied by #[warn(rust_2018_idioms)] warning: `extern crate` is not idiomatic in the new edition - --> $DIR/remove-extern-crate.rs:21:1 + --> $DIR/remove-extern-crate.rs:11:1 | LL | extern crate core as another_name; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` warning: `extern crate` is not idiomatic in the new edition - --> $DIR/remove-extern-crate.rs:39:5 + --> $DIR/remove-extern-crate.rs:29:5 | LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ help: convert it to a `use` diff --git a/src/test/ui/rust-2018/suggestions-not-always-applicable.fixed b/src/test/ui/rust-2018/suggestions-not-always-applicable.fixed new file mode 100644 index 00000000000..f0ca24714ed --- /dev/null +++ b/src/test/ui/rust-2018/suggestions-not-always-applicable.fixed @@ -0,0 +1,27 @@ +// aux-build:suggestions-not-always-applicable.rs +// edition:2015 +// run-rustfix +// rustfix-only-machine-applicable +// compile-pass + +#![feature(rust_2018_preview)] +#![warn(rust_2018_compatibility)] + +extern crate suggestions_not_always_applicable as foo; + +pub struct Foo; + +mod test { + use crate::foo::foo; + + #[foo] //~ WARN: absolute paths must start with + //~| WARN: previously accepted + //~| WARN: absolute paths + //~| WARN: previously accepted + fn main() { + } +} + +fn main() { + test::foo(); +} diff --git a/src/test/ui/rust-2018/suggestions-not-always-applicable.rs b/src/test/ui/rust-2018/suggestions-not-always-applicable.rs new file mode 100644 index 00000000000..f0ca24714ed --- /dev/null +++ b/src/test/ui/rust-2018/suggestions-not-always-applicable.rs @@ -0,0 +1,27 @@ +// aux-build:suggestions-not-always-applicable.rs +// edition:2015 +// run-rustfix +// rustfix-only-machine-applicable +// compile-pass + +#![feature(rust_2018_preview)] +#![warn(rust_2018_compatibility)] + +extern crate suggestions_not_always_applicable as foo; + +pub struct Foo; + +mod test { + use crate::foo::foo; + + #[foo] //~ WARN: absolute paths must start with + //~| WARN: previously accepted + //~| WARN: absolute paths + //~| WARN: previously accepted + fn main() { + } +} + +fn main() { + test::foo(); +} diff --git a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.stderr b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr similarity index 87% rename from src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.stderr rename to src/test/ui/rust-2018/suggestions-not-always-applicable.stderr index 415733a346f..53ea9e64572 100644 --- a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.stderr +++ b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr @@ -1,11 +1,11 @@ warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/suggestions-not-always-applicable.rs:27:5 + --> $DIR/suggestions-not-always-applicable.rs:17:5 | LL | #[foo] //~ WARN: absolute paths must start with | ^^^^^^ | note: lint level defined here - --> $DIR/suggestions-not-always-applicable.rs:18:9 + --> $DIR/suggestions-not-always-applicable.rs:8:9 | LL | #![warn(rust_2018_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL | #![warn(rust_2018_compatibility)] = note: for more information, see issue #53130 warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition - --> $DIR/suggestions-not-always-applicable.rs:27:5 + --> $DIR/suggestions-not-always-applicable.rs:17:5 | LL | #[foo] //~ WARN: absolute paths must start with | ^^^^^^ diff --git a/src/test/ui/rust-2018/trait-import-suggestions.rs b/src/test/ui/rust-2018/trait-import-suggestions.rs index d603d8212ed..9c67c3f4b4b 100644 --- a/src/test/ui/rust-2018/trait-import-suggestions.rs +++ b/src/test/ui/rust-2018/trait-import-suggestions.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // aux-build:trait-import-suggestions.rs // compile-flags:--extern trait-import-suggestions @@ -29,13 +19,13 @@ mod foo { fn in_foo() { let x: u32 = 22; - x.foobar(); + x.foobar(); //~ ERROR no method named `foobar` } } fn main() { let x: u32 = 22; - x.bar(); - x.baz(); - let y = u32::from_str("33"); + x.bar(); //~ ERROR no method named `bar` + x.baz(); //~ ERROR no method named `baz` + let y = u32::from_str("33"); //~ ERROR no function or associated item named `from_str` } diff --git a/src/test/ui/rust-2018/trait-import-suggestions.stderr b/src/test/ui/rust-2018/trait-import-suggestions.stderr index 59fe7b958e3..e4c17680c90 100644 --- a/src/test/ui/rust-2018/trait-import-suggestions.stderr +++ b/src/test/ui/rust-2018/trait-import-suggestions.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `foobar` found for type `u32` in the current scope - --> $DIR/trait-import-suggestions.rs:32:11 + --> $DIR/trait-import-suggestions.rs:22:11 | -LL | x.foobar(); +LL | x.foobar(); //~ ERROR no method named `foobar` | ^^^^^^ | = help: items from traits can only be used if the trait is in scope @@ -9,9 +9,9 @@ LL | x.foobar(); `use crate::foo::foobar::Foobar;` error[E0599]: no method named `bar` found for type `u32` in the current scope - --> $DIR/trait-import-suggestions.rs:38:7 + --> $DIR/trait-import-suggestions.rs:28:7 | -LL | x.bar(); +LL | x.bar(); //~ ERROR no method named `bar` | ^^^ | = help: items from traits can only be used if the trait is in scope @@ -21,16 +21,18 @@ LL | use crate::foo::Bar; | error[E0599]: no method named `baz` found for type `u32` in the current scope - --> $DIR/trait-import-suggestions.rs:39:7 + --> $DIR/trait-import-suggestions.rs:29:7 | -LL | x.baz(); +LL | x.baz(); //~ ERROR no method named `baz` | ^^^ error[E0599]: no function or associated item named `from_str` found for type `u32` in the current scope - --> $DIR/trait-import-suggestions.rs:40:13 + --> $DIR/trait-import-suggestions.rs:30:18 | -LL | let y = u32::from_str("33"); - | ^^^^^^^^^^^^^ function or associated item not found in `u32` +LL | let y = u32::from_str("33"); //~ ERROR no function or associated item named `from_str` + | -----^^^^^^^^ + | | + | function or associated item not found in `u32` | = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope, perhaps add a `use` for it: diff --git a/src/test/ui/rust-2018/try-ident.fixed b/src/test/ui/rust-2018/try-ident.fixed index 96a0cd0f8e9..5af13934e84 100644 --- a/src/test/ui/rust-2018/try-ident.fixed +++ b/src/test/ui/rust-2018/try-ident.fixed @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix // compile-pass diff --git a/src/test/ui/rust-2018/try-ident.rs b/src/test/ui/rust-2018/try-ident.rs index ade2e03ff22..faac13ab779 100644 --- a/src/test/ui/rust-2018/try-ident.rs +++ b/src/test/ui/rust-2018/try-ident.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix // compile-pass diff --git a/src/test/ui/rust-2018/try-ident.stderr b/src/test/ui/rust-2018/try-ident.stderr index 72bd81530df..94946035899 100644 --- a/src/test/ui/rust-2018/try-ident.stderr +++ b/src/test/ui/rust-2018/try-ident.stderr @@ -1,11 +1,11 @@ warning: `try` is a keyword in the 2018 edition - --> $DIR/try-ident.rs:17:5 + --> $DIR/try-ident.rs:7:5 | LL | try(); | ^^^ help: you can use a raw identifier to stay compatible: `r#try` | note: lint level defined here - --> $DIR/try-ident.rs:14:9 + --> $DIR/try-ident.rs:4:9 | LL | #![warn(rust_2018_compatibility)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL | #![warn(rust_2018_compatibility)] = note: for more information, see issue #49716 warning: `try` is a keyword in the 2018 edition - --> $DIR/try-ident.rs:20:4 + --> $DIR/try-ident.rs:10:4 | LL | fn try() { | ^^^ help: you can use a raw identifier to stay compatible: `r#try` diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros-nested.rs b/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros-nested.rs deleted file mode 100644 index 4819711115c..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros-nested.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// edition:2018 - -// This test is similar to `ambiguity-macros.rs`, but nested in a module. - -mod foo { - pub use std::io; - //~^ ERROR `std` is ambiguous - - macro_rules! m { - () => { - mod std { - pub struct io; - } - } - } - m!(); -} - -fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros-nested.stderr b/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros-nested.stderr deleted file mode 100644 index 204e0a7e141..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros-nested.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0659]: `std` is ambiguous (name vs any other name during import resolution) - --> $DIR/ambiguity-macros-nested.rs:16:13 - | -LL | pub use std::io; - | ^^^ ambiguous name - | - = note: `std` could refer to a built-in extern crate - = help: use `::std` to refer to this extern crate unambiguously -note: `std` could also refer to the module defined here - --> $DIR/ambiguity-macros-nested.rs:21:13 - | -LL | / mod std { -LL | | pub struct io; -LL | | } - | |_____________^ -... -LL | m!(); - | ----- in this macro invocation - = help: use `self::std` to refer to this module unambiguously - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros.rs b/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros.rs deleted file mode 100644 index 148320de556..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// edition:2018 - -// This test is similar to `ambiguity.rs`, but with macros defining local items. - -use std::io; -//~^ ERROR `std` is ambiguous - -macro_rules! m { - () => { - mod std { - pub struct io; - } - } -} -m!(); - -fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros.stderr b/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros.stderr deleted file mode 100644 index ac8d3b9d0cb..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-macros.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0659]: `std` is ambiguous (name vs any other name during import resolution) - --> $DIR/ambiguity-macros.rs:15:5 - | -LL | use std::io; - | ^^^ ambiguous name - | - = note: `std` could refer to a built-in extern crate - = help: use `::std` to refer to this extern crate unambiguously -note: `std` could also refer to the module defined here - --> $DIR/ambiguity-macros.rs:20:9 - | -LL | / mod std { -LL | | pub struct io; -LL | | } - | |_________^ -... -LL | m!(); - | ----- in this macro invocation - = help: use `self::std` to refer to this module unambiguously - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-nested.rs b/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-nested.rs deleted file mode 100644 index 2791d4580da..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-nested.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// edition:2018 - -// This test is similar to `ambiguity.rs`, but nested in a module. - -mod foo { - pub use std::io; - //~^ ERROR `std` is ambiguous - - mod std { - pub struct io; - } -} - -fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-nested.stderr b/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-nested.stderr deleted file mode 100644 index 7bcfc563d39..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity-nested.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0659]: `std` is ambiguous (name vs any other name during import resolution) - --> $DIR/ambiguity-nested.rs:16:13 - | -LL | pub use std::io; - | ^^^ ambiguous name - | - = note: `std` could refer to a built-in extern crate - = help: use `::std` to refer to this extern crate unambiguously -note: `std` could also refer to the module defined here - --> $DIR/ambiguity-nested.rs:19:5 - | -LL | / mod std { -LL | | pub struct io; -LL | | } - | |_____^ - = help: use `self::std` to refer to this module unambiguously - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity.rs b/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity.rs deleted file mode 100644 index 2bfbb6b2871..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// edition:2018 - -use std::io; -//~^ ERROR `std` is ambiguous - -mod std { - pub struct io; -} - -fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity.stderr b/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity.stderr deleted file mode 100644 index beeb74654e5..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/ambiguity.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0659]: `std` is ambiguous (name vs any other name during import resolution) - --> $DIR/ambiguity.rs:13:5 - | -LL | use std::io; - | ^^^ ambiguous name - | - = note: `std` could refer to a built-in extern crate - = help: use `::std` to refer to this extern crate unambiguously -note: `std` could also refer to the module defined here - --> $DIR/ambiguity.rs:16:1 - | -LL | / mod std { -LL | | pub struct io; -LL | | } - | |_^ - = help: use `self::std` to refer to this module unambiguously - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/block-scoped-shadow.rs b/src/test/ui/rust-2018/uniform-paths-forward-compat/block-scoped-shadow.rs deleted file mode 100644 index 2853b4b3a5b..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/block-scoped-shadow.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// edition:2018 - -struct std; - -fn main() { - fn std() {} - enum std {} - use std as foo; - //~^ ERROR `std` is ambiguous - //~| ERROR `std` is ambiguous -} diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/block-scoped-shadow.stderr b/src/test/ui/rust-2018/uniform-paths-forward-compat/block-scoped-shadow.stderr deleted file mode 100644 index 5d539e2d59f..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/block-scoped-shadow.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error[E0659]: `std` is ambiguous (name vs any other name during import resolution) - --> $DIR/block-scoped-shadow.rs:18:9 - | -LL | use std as foo; - | ^^^ ambiguous name - | -note: `std` could refer to the enum defined here - --> $DIR/block-scoped-shadow.rs:17:5 - | -LL | enum std {} - | ^^^^^^^^^^^ -note: `std` could also refer to the struct defined here - --> $DIR/block-scoped-shadow.rs:13:1 - | -LL | struct std; - | ^^^^^^^^^^^ - = help: use `self::std` to refer to this struct unambiguously - -error[E0659]: `std` is ambiguous (name vs any other name during import resolution) - --> $DIR/block-scoped-shadow.rs:18:9 - | -LL | use std as foo; - | ^^^ ambiguous name - | -note: `std` could refer to the function defined here - --> $DIR/block-scoped-shadow.rs:16:5 - | -LL | fn std() {} - | ^^^^^^^^^^^ -note: `std` could also refer to the unit struct defined here - --> $DIR/block-scoped-shadow.rs:13:1 - | -LL | struct std; - | ^^^^^^^^^^^ - = help: use `self::std` to refer to this unit struct unambiguously - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/issue-54253.rs b/src/test/ui/rust-2018/uniform-paths-forward-compat/issue-54253.rs deleted file mode 100644 index ef2a1e3c70c..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/issue-54253.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// edition:2018 - -// Dummy import that previously introduced uniform path canaries. -use std; - -// fn version() -> &'static str {""} - -mod foo { - // Error wasn't reported, despite `version` being commented out above. - use crate::version; //~ ERROR unresolved import `crate::version` - - fn bar() { - version(); - } -} - -fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/issue-54253.stderr b/src/test/ui/rust-2018/uniform-paths-forward-compat/issue-54253.stderr deleted file mode 100644 index 6dcc451c60a..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/issue-54253.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0432]: unresolved import `crate::version` - --> $DIR/issue-54253.rs:20:9 - | -LL | use crate::version; //~ ERROR unresolved import `crate::version` - | ^^^^^^^^^^^^^^ no `version` in the root - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/rust-2018/uniform-paths-forward-compat/redundant.rs b/src/test/ui/rust-2018/uniform-paths-forward-compat/redundant.rs deleted file mode 100644 index 05048cfd451..00000000000 --- a/src/test/ui/rust-2018/uniform-paths-forward-compat/redundant.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// edition:2018 - -use std; -use std::io; - -mod foo { - pub use std as my_std; -} - -mod bar { - pub use std::{self}; -} - -fn main() { - io::stdout(); - self::std::io::stdout(); - foo::my_std::io::stdout(); - bar::std::io::stdout(); -} diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs index 4819711115c..678b4774dba 100644 --- a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs +++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs @@ -1,17 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // This test is similar to `ambiguity-macros.rs`, but nested in a module. +#![allow(non_camel_case_types)] + mod foo { pub use std::io; //~^ ERROR `std` is ambiguous diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr index 204e0a7e141..04144909095 100644 --- a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr +++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr @@ -1,5 +1,5 @@ error[E0659]: `std` is ambiguous (name vs any other name during import resolution) - --> $DIR/ambiguity-macros-nested.rs:16:13 + --> $DIR/ambiguity-macros-nested.rs:8:13 | LL | pub use std::io; | ^^^ ambiguous name @@ -7,7 +7,7 @@ LL | pub use std::io; = note: `std` could refer to a built-in extern crate = help: use `::std` to refer to this extern crate unambiguously note: `std` could also refer to the module defined here - --> $DIR/ambiguity-macros-nested.rs:21:13 + --> $DIR/ambiguity-macros-nested.rs:13:13 | LL | / mod std { LL | | pub struct io; diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.rs b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.rs index 148320de556..56ea726d73e 100644 --- a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.rs +++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.rs @@ -1,17 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // This test is similar to `ambiguity.rs`, but with macros defining local items. +#![allow(non_camel_case_types)] + use std::io; //~^ ERROR `std` is ambiguous diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr index ac8d3b9d0cb..71726371b74 100644 --- a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr +++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr @@ -1,5 +1,5 @@ error[E0659]: `std` is ambiguous (name vs any other name during import resolution) - --> $DIR/ambiguity-macros.rs:15:5 + --> $DIR/ambiguity-macros.rs:7:5 | LL | use std::io; | ^^^ ambiguous name @@ -7,7 +7,7 @@ LL | use std::io; = note: `std` could refer to a built-in extern crate = help: use `::std` to refer to this extern crate unambiguously note: `std` could also refer to the module defined here - --> $DIR/ambiguity-macros.rs:20:9 + --> $DIR/ambiguity-macros.rs:12:9 | LL | / mod std { LL | | pub struct io; @@ -16,7 +16,7 @@ LL | | } ... LL | m!(); | ----- in this macro invocation - = help: use `self::std` to refer to this module unambiguously + = help: use `crate::std` to refer to this module unambiguously error: aborting due to previous error diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.rs b/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.rs index 2791d4580da..50c8fc8229c 100644 --- a/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.rs +++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.rs @@ -1,17 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // This test is similar to `ambiguity.rs`, but nested in a module. +#![allow(non_camel_case_types)] + mod foo { pub use std::io; //~^ ERROR `std` is ambiguous diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.stderr b/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.stderr index 7bcfc563d39..1d22a39c3a1 100644 --- a/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.stderr +++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.stderr @@ -1,5 +1,5 @@ error[E0659]: `std` is ambiguous (name vs any other name during import resolution) - --> $DIR/ambiguity-nested.rs:16:13 + --> $DIR/ambiguity-nested.rs:8:13 | LL | pub use std::io; | ^^^ ambiguous name @@ -7,7 +7,7 @@ LL | pub use std::io; = note: `std` could refer to a built-in extern crate = help: use `::std` to refer to this extern crate unambiguously note: `std` could also refer to the module defined here - --> $DIR/ambiguity-nested.rs:19:5 + --> $DIR/ambiguity-nested.rs:11:5 | LL | / mod std { LL | | pub struct io; diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity.rs b/src/test/ui/rust-2018/uniform-paths/ambiguity.rs index 2bfbb6b2871..60f77a1c663 100644 --- a/src/test/ui/rust-2018/uniform-paths/ambiguity.rs +++ b/src/test/ui/rust-2018/uniform-paths/ambiguity.rs @@ -1,15 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 +#![allow(non_camel_case_types)] + use std::io; //~^ ERROR `std` is ambiguous diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity.stderr b/src/test/ui/rust-2018/uniform-paths/ambiguity.stderr index beeb74654e5..45751c9f648 100644 --- a/src/test/ui/rust-2018/uniform-paths/ambiguity.stderr +++ b/src/test/ui/rust-2018/uniform-paths/ambiguity.stderr @@ -1,5 +1,5 @@ error[E0659]: `std` is ambiguous (name vs any other name during import resolution) - --> $DIR/ambiguity.rs:13:5 + --> $DIR/ambiguity.rs:5:5 | LL | use std::io; | ^^^ ambiguous name @@ -7,13 +7,13 @@ LL | use std::io; = note: `std` could refer to a built-in extern crate = help: use `::std` to refer to this extern crate unambiguously note: `std` could also refer to the module defined here - --> $DIR/ambiguity.rs:16:1 + --> $DIR/ambiguity.rs:8:1 | LL | / mod std { LL | | pub struct io; LL | | } | |_^ - = help: use `self::std` to refer to this module unambiguously + = help: use `crate::std` to refer to this module unambiguously error: aborting due to previous error diff --git a/src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs b/src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs new file mode 100644 index 00000000000..db723075f93 --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596-2.rs @@ -0,0 +1 @@ +pub extern crate core; diff --git a/src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs b/src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs new file mode 100644 index 00000000000..bc010a3dd2b --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/auxiliary/issue-56596.rs @@ -0,0 +1 @@ +// Nothing here diff --git a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs index 19be7dc9640..3f5897901a0 100644 --- a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs +++ b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.rs @@ -1,7 +1,5 @@ // edition:2018 -#![feature(uniform_paths)] - mod my { pub mod sub { pub fn bar() {} diff --git a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr index aa46947f93f..4a01ba5088f 100644 --- a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr +++ b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr @@ -1,22 +1,22 @@ error[E0659]: `sub` is ambiguous (name vs any other name during import resolution) - --> $DIR/block-scoped-shadow-nested.rs:18:13 + --> $DIR/block-scoped-shadow-nested.rs:16:13 | LL | use sub::bar; //~ ERROR `sub` is ambiguous | ^^^ ambiguous name | note: `sub` could refer to the module imported here - --> $DIR/block-scoped-shadow-nested.rs:16:9 + --> $DIR/block-scoped-shadow-nested.rs:14:9 | LL | use my::sub; | ^^^^^^^ note: `sub` could also refer to the module defined here - --> $DIR/block-scoped-shadow-nested.rs:11:1 + --> $DIR/block-scoped-shadow-nested.rs:9:1 | LL | / mod sub { LL | | pub fn bar() {} LL | | } | |_^ - = help: use `self::sub` to refer to this module unambiguously + = help: use `crate::sub` to refer to this module unambiguously error: aborting due to previous error diff --git a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.rs b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.rs index ec0479ce8f1..828ee4fe474 100644 --- a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.rs +++ b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.rs @@ -1,15 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 +#![allow(non_camel_case_types)] + enum Foo {} struct std; diff --git a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr index 010b9efad39..2767d9ee77e 100644 --- a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr +++ b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr @@ -1,56 +1,56 @@ error[E0659]: `Foo` is ambiguous (name vs any other name during import resolution) - --> $DIR/block-scoped-shadow.rs:19:9 + --> $DIR/block-scoped-shadow.rs:11:9 | LL | use Foo::*; | ^^^ ambiguous name | note: `Foo` could refer to the enum defined here - --> $DIR/block-scoped-shadow.rs:18:5 + --> $DIR/block-scoped-shadow.rs:10:5 | LL | enum Foo { A, B } | ^^^^^^^^^^^^^^^^^ note: `Foo` could also refer to the enum defined here - --> $DIR/block-scoped-shadow.rs:13:1 + --> $DIR/block-scoped-shadow.rs:5:1 | LL | enum Foo {} | ^^^^^^^^^^^ - = help: use `self::Foo` to refer to this enum unambiguously + = help: use `crate::Foo` to refer to this enum unambiguously error[E0659]: `std` is ambiguous (name vs any other name during import resolution) - --> $DIR/block-scoped-shadow.rs:26:9 + --> $DIR/block-scoped-shadow.rs:18:9 | LL | use std as foo; | ^^^ ambiguous name | note: `std` could refer to the enum defined here - --> $DIR/block-scoped-shadow.rs:25:5 + --> $DIR/block-scoped-shadow.rs:17:5 | LL | enum std {} | ^^^^^^^^^^^ note: `std` could also refer to the struct defined here - --> $DIR/block-scoped-shadow.rs:15:1 + --> $DIR/block-scoped-shadow.rs:7:1 | LL | struct std; | ^^^^^^^^^^^ - = help: use `self::std` to refer to this struct unambiguously + = help: use `crate::std` to refer to this struct unambiguously error[E0659]: `std` is ambiguous (name vs any other name during import resolution) - --> $DIR/block-scoped-shadow.rs:26:9 + --> $DIR/block-scoped-shadow.rs:18:9 | LL | use std as foo; | ^^^ ambiguous name | note: `std` could refer to the function defined here - --> $DIR/block-scoped-shadow.rs:24:5 + --> $DIR/block-scoped-shadow.rs:16:5 | LL | fn std() {} | ^^^^^^^^^^^ note: `std` could also refer to the unit struct defined here - --> $DIR/block-scoped-shadow.rs:15:1 + --> $DIR/block-scoped-shadow.rs:7:1 | LL | struct std; | ^^^^^^^^^^^ - = help: use `self::std` to refer to this unit struct unambiguously + = help: use `crate::std` to refer to this unit struct unambiguously error: aborting due to 3 previous errors diff --git a/src/test/ui/rust-2018/uniform-paths/fn-local-enum.rs b/src/test/ui/rust-2018/uniform-paths/fn-local-enum.rs index a7bc625bbf0..0c2da1884b7 100644 --- a/src/test/ui/rust-2018/uniform-paths/fn-local-enum.rs +++ b/src/test/ui/rust-2018/uniform-paths/fn-local-enum.rs @@ -1,8 +1,6 @@ // compile-pass // edition:2018 -#![feature(uniform_paths)] - fn main() { enum E { A, B, C } diff --git a/src/test/ui/rust-2018/uniform-paths/issue-54253.rs b/src/test/ui/rust-2018/uniform-paths/issue-54253.rs index ef2a1e3c70c..7db469945e0 100644 --- a/src/test/ui/rust-2018/uniform-paths/issue-54253.rs +++ b/src/test/ui/rust-2018/uniform-paths/issue-54253.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // edition:2018 // Dummy import that previously introduced uniform path canaries. diff --git a/src/test/ui/rust-2018/uniform-paths/issue-54253.stderr b/src/test/ui/rust-2018/uniform-paths/issue-54253.stderr index 6dcc451c60a..3d7176265a2 100644 --- a/src/test/ui/rust-2018/uniform-paths/issue-54253.stderr +++ b/src/test/ui/rust-2018/uniform-paths/issue-54253.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `crate::version` - --> $DIR/issue-54253.rs:20:9 + --> $DIR/issue-54253.rs:10:9 | LL | use crate::version; //~ ERROR unresolved import `crate::version` | ^^^^^^^^^^^^^^ no `version` in the root diff --git a/src/test/ui/rust-2018/uniform-paths/issue-54390.rs b/src/test/ui/rust-2018/uniform-paths/issue-54390.rs deleted file mode 100644 index 536cc25e35a..00000000000 --- a/src/test/ui/rust-2018/uniform-paths/issue-54390.rs +++ /dev/null @@ -1,11 +0,0 @@ -// edition:2018 - -#![deny(unused)] - -use std::fmt; - -// No "unresolved import" + "unused import" combination here. -use fmt::Write; //~ ERROR imports can only refer to extern crate names - //~| ERROR unused import: `fmt::Write` - -fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths/issue-54390.stderr b/src/test/ui/rust-2018/uniform-paths/issue-54390.stderr deleted file mode 100644 index 8f86698c9c1..00000000000 --- a/src/test/ui/rust-2018/uniform-paths/issue-54390.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130) - --> $DIR/issue-54390.rs:8:5 - | -LL | use std::fmt; - | -------- not an extern crate passed with `--extern` -... -LL | use fmt::Write; //~ ERROR imports can only refer to extern crate names - | ^^^ - | - = help: add #![feature(uniform_paths)] to the crate attributes to enable -note: this import refers to the module imported here - --> $DIR/issue-54390.rs:5:5 - | -LL | use std::fmt; - | ^^^^^^^^ - -error: unused import: `fmt::Write` - --> $DIR/issue-54390.rs:8:5 - | -LL | use fmt::Write; //~ ERROR imports can only refer to extern crate names - | ^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/issue-54390.rs:3:9 - | -LL | #![deny(unused)] - | ^^^^^^ - = note: #[deny(unused_imports)] implied by #[deny(unused)] - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/rust-2018/uniform-paths/issue-56596-2.rs b/src/test/ui/rust-2018/uniform-paths/issue-56596-2.rs new file mode 100644 index 00000000000..9ec3a641131 --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/issue-56596-2.rs @@ -0,0 +1,11 @@ +// compile-pass +// edition:2018 +// compile-flags: --extern issue_56596_2 +// aux-build:issue-56596-2.rs + +mod m { + use core::any; + pub use issue_56596_2::*; +} + +fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths/issue-56596.rs b/src/test/ui/rust-2018/uniform-paths/issue-56596.rs new file mode 100644 index 00000000000..5c40d78d81c --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/issue-56596.rs @@ -0,0 +1,14 @@ +// edition:2018 +// compile-flags: --extern issue_56596 +// aux-build:issue-56596.rs + +#![feature(uniform_paths)] + +mod m { + pub mod issue_56596 {} +} + +use m::*; +use issue_56596; //~ ERROR `issue_56596` is ambiguous + +fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr b/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr new file mode 100644 index 00000000000..293d0ec6a72 --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr @@ -0,0 +1,18 @@ +error[E0659]: `issue_56596` is ambiguous (name vs any other name during import resolution) + --> $DIR/issue-56596.rs:12:5 + | +LL | use issue_56596; //~ ERROR `issue_56596` is ambiguous + | ^^^^^^^^^^^ ambiguous name + | + = note: `issue_56596` could refer to an extern crate passed with `--extern` + = help: use `::issue_56596` to refer to this extern crate unambiguously +note: `issue_56596` could also refer to the module imported here + --> $DIR/issue-56596.rs:11:5 + | +LL | use m::*; + | ^^^^ + = help: use `crate::issue_56596` to refer to this module unambiguously + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/rust-2018/uniform-paths/macro-rules.rs b/src/test/ui/rust-2018/uniform-paths/macro-rules.rs index e8098a46790..6c3f1892cb3 100644 --- a/src/test/ui/rust-2018/uniform-paths/macro-rules.rs +++ b/src/test/ui/rust-2018/uniform-paths/macro-rules.rs @@ -1,22 +1,23 @@ // edition:2018 -// For the time being `macro_rules` items are treated as *very* private... - -#![feature(underscore_imports, decl_macro, uniform_paths)] +#![feature(decl_macro)] mod m1 { + // Non-exported legacy macros are treated as `pub(crate)`. macro_rules! legacy_macro { () => () } - // ... so they can't be imported by themselves, ... - use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported + use legacy_macro as _; // OK + pub(crate) use legacy_macro as _; // OK + pub use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported } mod m2 { macro_rules! legacy_macro { () => () } + #[allow(non_camel_case_types)] type legacy_macro = u8; - // ... but don't prevent names from other namespaces from being imported, ... + // Legacy macro imports don't prevent names from other namespaces from being imported. use legacy_macro as _; // OK } @@ -26,19 +27,17 @@ mod m3 { fn f() { macro_rules! legacy_macro { () => () } - // ... but still create ambiguities with other names in the same namespace. + // Legacy macro imports create ambiguities with other names in the same namespace. use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous - //~| ERROR `legacy_macro` is private, and cannot be re-exported } } mod exported { - // Exported macros are treated as private as well, - // some better rules need to be figured out later. + // Exported legacy macros are treated as `pub`. #[macro_export] macro_rules! legacy_macro { () => () } - use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported + pub use legacy_macro as _; // OK } fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr b/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr index d7bb233dfe9..684f5fceac1 100644 --- a/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr +++ b/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr @@ -1,58 +1,34 @@ error[E0364]: `legacy_macro` is private, and cannot be re-exported - --> $DIR/macro-rules.rs:11:9 + --> $DIR/macro-rules.rs:11:13 | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported - | ^^^^^^^^^^^^^^^^^ - | -note: consider marking `legacy_macro` as `pub` in the imported module - --> $DIR/macro-rules.rs:11:9 - | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported - | ^^^^^^^^^^^^^^^^^ - -error[E0364]: `legacy_macro` is private, and cannot be re-exported - --> $DIR/macro-rules.rs:30:13 - | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous +LL | pub use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported | ^^^^^^^^^^^^^^^^^ | note: consider marking `legacy_macro` as `pub` in the imported module - --> $DIR/macro-rules.rs:30:13 + --> $DIR/macro-rules.rs:11:13 | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous +LL | pub use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported | ^^^^^^^^^^^^^^^^^ -error[E0364]: `legacy_macro` is private, and cannot be re-exported - --> $DIR/macro-rules.rs:41:9 - | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported - | ^^^^^^^^^^^^^^^^^ - | -note: consider marking `legacy_macro` as `pub` in the imported module - --> $DIR/macro-rules.rs:41:9 - | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported - | ^^^^^^^^^^^^^^^^^ - error[E0659]: `legacy_macro` is ambiguous (name vs any other name during import resolution) - --> $DIR/macro-rules.rs:30:13 + --> $DIR/macro-rules.rs:31:13 | LL | use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous | ^^^^^^^^^^^^ ambiguous name | note: `legacy_macro` could refer to the macro defined here - --> $DIR/macro-rules.rs:27:9 + --> $DIR/macro-rules.rs:28:9 | LL | macro_rules! legacy_macro { () => () } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: `legacy_macro` could also refer to the macro defined here - --> $DIR/macro-rules.rs:24:5 + --> $DIR/macro-rules.rs:25:5 | LL | macro legacy_macro() {} | ^^^^^^^^^^^^^^^^^^^^^^^ = help: use `self::legacy_macro` to refer to this macro unambiguously -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors Some errors occurred: E0364, E0659. For more information about an error, try `rustc --explain E0364`. diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.rs b/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.rs new file mode 100644 index 00000000000..541fc1be4e8 --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.rs @@ -0,0 +1,19 @@ +// edition:2018 + +// Built-in attribute +use inline as imported_inline; +mod builtin { + pub use inline as imported_inline; +} + +// Tool module +use rustfmt as imported_rustfmt; +mod tool_mod { + pub use rustfmt as imported_rustfmt; +} + +#[imported_inline] //~ ERROR cannot use a built-in attribute through an import +#[builtin::imported_inline] //~ ERROR cannot use a built-in attribute through an import +#[imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import +#[tool_mod::imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import +fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr b/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr new file mode 100644 index 00000000000..40b8fcf7158 --- /dev/null +++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr @@ -0,0 +1,44 @@ +error: cannot use a built-in attribute through an import + --> $DIR/prelude-fail-2.rs:15:3 + | +LL | #[imported_inline] //~ ERROR cannot use a built-in attribute through an import + | ^^^^^^^^^^^^^^^ + | +note: the built-in attribute imported here + --> $DIR/prelude-fail-2.rs:4:5 + | +LL | use inline as imported_inline; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use a built-in attribute through an import + --> $DIR/prelude-fail-2.rs:16:3 + | +LL | #[builtin::imported_inline] //~ ERROR cannot use a built-in attribute through an import + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use a tool module through an import + --> $DIR/prelude-fail-2.rs:17:3 + | +LL | #[imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import + | ^^^^^^^^^^^^^^^^ + | +note: the tool module imported here + --> $DIR/prelude-fail-2.rs:10:5 + | +LL | use rustfmt as imported_rustfmt; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: cannot use a tool module through an import + --> $DIR/prelude-fail-2.rs:18:13 + | +LL | #[tool_mod::imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import + | ^^^^^^^^^^^^^^^^ + | +note: the tool module imported here + --> $DIR/prelude-fail-2.rs:12:13 + | +LL | pub use rustfmt as imported_rustfmt; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail.rs b/src/test/ui/rust-2018/uniform-paths/prelude-fail.rs index c5bd50f2f56..d717884c901 100644 --- a/src/test/ui/rust-2018/uniform-paths/prelude-fail.rs +++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail.rs @@ -1,7 +1,5 @@ // edition:2018 -#![feature(uniform_paths)] - // Built-in macro use env as env_imported; //~ ERROR cannot import a built-in macro diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr b/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr index 794d986b82e..fdfea416b12 100644 --- a/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr +++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr @@ -1,11 +1,11 @@ error: cannot import a built-in macro - --> $DIR/prelude-fail.rs:6:5 + --> $DIR/prelude-fail.rs:4:5 | LL | use env as env_imported; //~ ERROR cannot import a built-in macro | ^^^^^^^^^^^^^^^^^^^ error[E0432]: unresolved import `rustfmt` - --> $DIR/prelude-fail.rs:9:5 + --> $DIR/prelude-fail.rs:7:5 | LL | use rustfmt::skip as imported_rustfmt_skip; //~ ERROR unresolved import `rustfmt` | ^^^^^^^ not a module `rustfmt` diff --git a/src/test/ui/rust-2018/uniform-paths/prelude.rs b/src/test/ui/rust-2018/uniform-paths/prelude.rs index 5aab5fc3a40..9a326b4c728 100644 --- a/src/test/ui/rust-2018/uniform-paths/prelude.rs +++ b/src/test/ui/rust-2018/uniform-paths/prelude.rs @@ -1,17 +1,9 @@ // compile-pass // edition:2018 -#![feature(uniform_paths)] - // Macro imported with `#[macro_use] extern crate` use vec as imported_vec; -// Built-in attribute -use inline as imported_inline; - -// Tool module -use rustfmt as imported_rustfmt; - // Standard library prelude use Vec as ImportedVec; @@ -20,8 +12,6 @@ use u8 as imported_u8; type A = imported_u8; -#[imported_inline] -#[imported_rustfmt::skip] fn main() { imported_vec![0]; ImportedVec::::new(); diff --git a/src/test/ui/rust-2018/uniform-paths/redundant.rs b/src/test/ui/rust-2018/uniform-paths/redundant.rs index 05048cfd451..2d306eb920c 100644 --- a/src/test/ui/rust-2018/uniform-paths/redundant.rs +++ b/src/test/ui/rust-2018/uniform-paths/redundant.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // edition:2018 diff --git a/src/test/ui/rust-unstable-column-gated.rs b/src/test/ui/rust-unstable-column-gated.rs index abc92c86eec..ed5e6f2489c 100644 --- a/src/test/ui/rust-unstable-column-gated.rs +++ b/src/test/ui/rust-unstable-column-gated.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { println!("{}", __rust_unstable_column!()); //~^ERROR the __rust_unstable_column macro is unstable diff --git a/src/test/ui/rust-unstable-column-gated.stderr b/src/test/ui/rust-unstable-column-gated.stderr index 785fcd7af42..b9f1df2bcc9 100644 --- a/src/test/ui/rust-unstable-column-gated.stderr +++ b/src/test/ui/rust-unstable-column-gated.stderr @@ -1,5 +1,5 @@ error: the __rust_unstable_column macro is unstable - --> $DIR/rust-unstable-column-gated.rs:12:20 + --> $DIR/rust-unstable-column-gated.rs:2:20 | LL | println!("{}", __rust_unstable_column!()); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rustc-args-required-const.rs b/src/test/ui/rustc-args-required-const.rs index 15465ac52aa..87f979f1b27 100644 --- a/src/test/ui/rustc-args-required-const.rs +++ b/src/test/ui/rustc-args-required-const.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs, const_fn)] #[rustc_args_required_const(0)] diff --git a/src/test/ui/rustc-args-required-const.stderr b/src/test/ui/rustc-args-required-const.stderr index efd4c58f152..7a1caf3c40f 100644 --- a/src/test/ui/rustc-args-required-const.stderr +++ b/src/test/ui/rustc-args-required-const.stderr @@ -1,11 +1,11 @@ error: argument 1 is required to be a constant - --> $DIR/rustc-args-required-const.rs:34:5 + --> $DIR/rustc-args-required-const.rs:24:5 | LL | foo(a); //~ ERROR: argument 1 is required to be a constant | ^^^^^^ error: argument 2 is required to be a constant - --> $DIR/rustc-args-required-const.rs:36:5 + --> $DIR/rustc-args-required-const.rs:26:5 | LL | bar(a, a); //~ ERROR: argument 2 is required to be a constant | ^^^^^^^^^ diff --git a/src/test/ui/rustc-args-required-const2.rs b/src/test/ui/rustc-args-required-const2.rs index c4ca5a0ca5c..5feeca6f530 100644 --- a/src/test/ui/rustc-args-required-const2.rs +++ b/src/test/ui/rustc-args-required-const2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs, const_fn)] #[rustc_args_required_const(0)] diff --git a/src/test/ui/rustc-args-required-const2.stderr b/src/test/ui/rustc-args-required-const2.stderr index 766f8adb0b4..005f68fa2e6 100644 --- a/src/test/ui/rustc-args-required-const2.stderr +++ b/src/test/ui/rustc-args-required-const2.stderr @@ -1,5 +1,5 @@ error: this function can only be invoked directly, not through a function pointer - --> $DIR/rustc-args-required-const2.rs:18:13 + --> $DIR/rustc-args-required-const2.rs:8:13 | LL | let a = foo; //~ ERROR: this function can only be invoked directly | ^^^ diff --git a/src/test/ui/rustc-error.rs b/src/test/ui/rustc-error.rs index 82f32cbcd14..0504198032c 100644 --- a/src/test/ui/rustc-error.rs +++ b/src/test/ui/rustc-error.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_error] diff --git a/src/test/ui/rustc-error.stderr b/src/test/ui/rustc-error.stderr index 7456d2af51f..c6b9cf77e58 100644 --- a/src/test/ui/rustc-error.stderr +++ b/src/test/ui/rustc-error.stderr @@ -1,5 +1,5 @@ error: compilation successful - --> $DIR/rustc-error.rs:14:1 + --> $DIR/rustc-error.rs:4:1 | LL | / fn main() { LL | | //~^ ERROR compilation successful diff --git a/src/test/ui/safe-extern-statics-mut.rs b/src/test/ui/safe-extern-statics-mut.rs index 35ea6dd52c4..dbf0f523a9a 100644 --- a/src/test/ui/safe-extern-statics-mut.rs +++ b/src/test/ui/safe-extern-statics-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:extern-statics.rs extern crate extern_statics; diff --git a/src/test/ui/safe-extern-statics-mut.stderr b/src/test/ui/safe-extern-statics-mut.stderr index f48dce65afa..4eecce6d3d3 100644 --- a/src/test/ui/safe-extern-statics-mut.stderr +++ b/src/test/ui/safe-extern-statics-mut.stderr @@ -1,5 +1,5 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:21:13 + --> $DIR/safe-extern-statics-mut.rs:11:13 | LL | let b = B; //~ ERROR use of mutable static is unsafe | ^ use of mutable static @@ -7,7 +7,7 @@ LL | let b = B; //~ ERROR use of mutable static is unsafe = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:22:14 + --> $DIR/safe-extern-statics-mut.rs:12:14 | LL | let rb = &B; //~ ERROR use of mutable static is unsafe | ^^ use of mutable static @@ -15,7 +15,7 @@ LL | let rb = &B; //~ ERROR use of mutable static is unsafe = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:23:14 + --> $DIR/safe-extern-statics-mut.rs:13:14 | LL | let xb = XB; //~ ERROR use of mutable static is unsafe | ^^ use of mutable static @@ -23,7 +23,7 @@ LL | let xb = XB; //~ ERROR use of mutable static is unsafe = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/safe-extern-statics-mut.rs:24:15 + --> $DIR/safe-extern-statics-mut.rs:14:15 | LL | let xrb = &XB; //~ ERROR use of mutable static is unsafe | ^^^ use of mutable static diff --git a/src/test/ui/safe-extern-statics.rs b/src/test/ui/safe-extern-statics.rs index 83aa4b3316d..eda30944468 100644 --- a/src/test/ui/safe-extern-statics.rs +++ b/src/test/ui/safe-extern-statics.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:extern-statics.rs #![allow(unused)] diff --git a/src/test/ui/safe-extern-statics.stderr b/src/test/ui/safe-extern-statics.stderr index 657d57967bb..11ade798ba4 100644 --- a/src/test/ui/safe-extern-statics.stderr +++ b/src/test/ui/safe-extern-statics.stderr @@ -1,5 +1,5 @@ error: use of extern static is unsafe and requires unsafe function or block (error E0133) - --> $DIR/safe-extern-statics.rs:23:13 + --> $DIR/safe-extern-statics.rs:13:13 | LL | let a = A; //~ ERROR use of extern static is unsafe | ^ @@ -10,7 +10,7 @@ LL | let a = A; //~ ERROR use of extern static is unsafe = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior error: use of extern static is unsafe and requires unsafe function or block (error E0133) - --> $DIR/safe-extern-statics.rs:25:14 + --> $DIR/safe-extern-statics.rs:15:14 | LL | let ra = &A; //~ ERROR use of extern static is unsafe | ^^ @@ -20,7 +20,7 @@ LL | let ra = &A; //~ ERROR use of extern static is unsafe = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior error: use of extern static is unsafe and requires unsafe function or block (error E0133) - --> $DIR/safe-extern-statics.rs:27:14 + --> $DIR/safe-extern-statics.rs:17:14 | LL | let xa = XA; //~ ERROR use of extern static is unsafe | ^^ @@ -30,7 +30,7 @@ LL | let xa = XA; //~ ERROR use of extern static is unsafe = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior error: use of extern static is unsafe and requires unsafe function or block (error E0133) - --> $DIR/safe-extern-statics.rs:29:15 + --> $DIR/safe-extern-statics.rs:19:15 | LL | let xra = &XA; //~ ERROR use of extern static is unsafe | ^^^ diff --git a/src/test/ui/self/self-impl.rs b/src/test/ui/self/self-impl.rs index 1494d9ca574..ed250ce522f 100644 --- a/src/test/ui/self/self-impl.rs +++ b/src/test/ui/self/self-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that unsupported uses of `Self` in impls don't crash struct Bar; diff --git a/src/test/ui/self/self-impl.stderr b/src/test/ui/self/self-impl.stderr index b951b119436..fb47f27e022 100644 --- a/src/test/ui/self/self-impl.stderr +++ b/src/test/ui/self/self-impl.stderr @@ -1,11 +1,11 @@ error[E0223]: ambiguous associated type - --> $DIR/self-impl.rs:33:16 + --> $DIR/self-impl.rs:23:16 | LL | let _: ::Baz = true; | ^^^^^^^^^^^ help: use fully-qualified syntax: `::Baz` error[E0223]: ambiguous associated type - --> $DIR/self-impl.rs:35:16 + --> $DIR/self-impl.rs:25:16 | LL | let _: Self::Baz = true; | ^^^^^^^^^ help: use fully-qualified syntax: `::Baz` diff --git a/src/test/ui/self/self-infer.rs b/src/test/ui/self/self-infer.rs index fd011318a48..0956f2a5691 100644 --- a/src/test/ui/self/self-infer.rs +++ b/src/test/ui/self/self-infer.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S; impl S { diff --git a/src/test/ui/self/self-infer.stderr b/src/test/ui/self/self-infer.stderr index 642e0de5290..4b8fd703779 100644 --- a/src/test/ui/self/self-infer.stderr +++ b/src/test/ui/self/self-infer.stderr @@ -1,11 +1,11 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/self-infer.rs:14:16 + --> $DIR/self-infer.rs:4:16 | LL | fn f(self: _) {} //~ERROR the type placeholder `_` is not allowed within types on item sig | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/self-infer.rs:15:17 + --> $DIR/self-infer.rs:5:17 | LL | fn g(self: &_) {} //~ERROR the type placeholder `_` is not allowed within types on item sig | ^ not allowed in type signatures diff --git a/src/test/ui/self/self-vs-path-ambiguity.rs b/src/test/ui/self/self-vs-path-ambiguity.rs index b2dba3bd61b..5a06d56c83f 100644 --- a/src/test/ui/self/self-vs-path-ambiguity.rs +++ b/src/test/ui/self/self-vs-path-ambiguity.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that `self::foo` is parsed as a general pattern and not a self argument. struct S; diff --git a/src/test/ui/self/self-vs-path-ambiguity.stderr b/src/test/ui/self/self-vs-path-ambiguity.stderr index 76517433170..954d240e71b 100644 --- a/src/test/ui/self/self-vs-path-ambiguity.stderr +++ b/src/test/ui/self/self-vs-path-ambiguity.stderr @@ -1,5 +1,5 @@ error: unexpected lifetime `'a` in pattern - --> $DIR/self-vs-path-ambiguity.rs:19:11 + --> $DIR/self-vs-path-ambiguity.rs:9:11 | LL | fn i(&'a self::S: &S) {} //~ ERROR unexpected lifetime `'a` in pattern | ^^ unexpected lifetime diff --git a/src/test/ui/self/self_type_keyword-2.rs b/src/test/ui/self/self_type_keyword-2.rs index bbaf060ca87..dde5762fd78 100644 --- a/src/test/ui/self/self_type_keyword-2.rs +++ b/src/test/ui/self/self_type_keyword-2.rs @@ -1,26 +1,13 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use self::Self as Foo; //~ ERROR unresolved import `self::Self` pub fn main() { let Self = 5; //~^ ERROR cannot find unit struct/variant or constant `Self` in this scope - //~^^ ERROR `Self` struct constructors are unstable (see issue #51994) match 15 { Self => (), //~^ ERROR cannot find unit struct/variant or constant `Self` in this scope - //~^^ ERROR `Self` struct constructors are unstable (see issue #51994) Foo { x: Self } => (), //~^ ERROR cannot find unit struct/variant or constant `Self` in this scope - //~^^ ERROR `Self` struct constructors are unstable (see issue #51994) } } diff --git a/src/test/ui/self/self_type_keyword-2.stderr b/src/test/ui/self/self_type_keyword-2.stderr index 82529974d0e..55c8796e158 100644 --- a/src/test/ui/self/self_type_keyword-2.stderr +++ b/src/test/ui/self/self_type_keyword-2.stderr @@ -1,52 +1,28 @@ error[E0432]: unresolved import `self::Self` - --> $DIR/self_type_keyword-2.rs:11:5 + --> $DIR/self_type_keyword-2.rs:1:5 | LL | use self::Self as Foo; //~ ERROR unresolved import `self::Self` | ^^^^^^^^^^^^^^^^^ no `Self` in the root error[E0531]: cannot find unit struct/variant or constant `Self` in this scope - --> $DIR/self_type_keyword-2.rs:14:9 + --> $DIR/self_type_keyword-2.rs:4:9 | LL | let Self = 5; | ^^^^ not found in this scope error[E0531]: cannot find unit struct/variant or constant `Self` in this scope - --> $DIR/self_type_keyword-2.rs:19:9 + --> $DIR/self_type_keyword-2.rs:8:9 | LL | Self => (), | ^^^^ not found in this scope error[E0531]: cannot find unit struct/variant or constant `Self` in this scope - --> $DIR/self_type_keyword-2.rs:22:18 + --> $DIR/self_type_keyword-2.rs:10:18 | LL | Foo { x: Self } => (), | ^^^^ not found in this scope -error[E0658]: `Self` struct constructors are unstable (see issue #51994) - --> $DIR/self_type_keyword-2.rs:14:9 - | -LL | let Self = 5; - | ^^^^ - | - = help: add #![feature(self_struct_ctor)] to the crate attributes to enable - -error[E0658]: `Self` struct constructors are unstable (see issue #51994) - --> $DIR/self_type_keyword-2.rs:19:9 - | -LL | Self => (), - | ^^^^ - | - = help: add #![feature(self_struct_ctor)] to the crate attributes to enable - -error[E0658]: `Self` struct constructors are unstable (see issue #51994) - --> $DIR/self_type_keyword-2.rs:22:18 - | -LL | Foo { x: Self } => (), - | ^^^^ - | - = help: add #![feature(self_struct_ctor)] to the crate attributes to enable - -error: aborting due to 7 previous errors +error: aborting due to 4 previous errors -Some errors occurred: E0432, E0531, E0658. +Some errors occurred: E0432, E0531. For more information about an error, try `rustc --explain E0432`. diff --git a/src/test/ui/self/self_type_keyword.rs b/src/test/ui/self/self_type_keyword.rs index 20d2e2ca9cf..4a1681e4e2b 100644 --- a/src/test/ui/self/self_type_keyword.rs +++ b/src/test/ui/self/self_type_keyword.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -Z continue-parse-after-error mod foo { @@ -17,6 +7,7 @@ mod foo { struct Bar<'Self>; //~^ ERROR lifetimes cannot use keyword names +//~| ERROR parameter `'Self` is never used struct Foo; diff --git a/src/test/ui/self/self_type_keyword.stderr b/src/test/ui/self/self_type_keyword.stderr index 4a7b9a6ce2c..f75377a220b 100644 --- a/src/test/ui/self/self_type_keyword.stderr +++ b/src/test/ui/self/self_type_keyword.stderr @@ -1,62 +1,71 @@ error: expected identifier, found keyword `Self` - --> $DIR/self_type_keyword.rs:14:10 + --> $DIR/self_type_keyword.rs:4:10 | LL | struct Self; | ^^^^ expected identifier, found keyword error: expected identifier, found keyword `Self` - --> $DIR/self_type_keyword.rs:25:13 + --> $DIR/self_type_keyword.rs:16:13 | LL | ref Self => (), | ^^^^ expected identifier, found keyword error: expected identifier, found keyword `Self` - --> $DIR/self_type_keyword.rs:27:13 + --> $DIR/self_type_keyword.rs:18:13 | LL | mut Self => (), | ^^^^ expected identifier, found keyword error: expected identifier, found keyword `Self` - --> $DIR/self_type_keyword.rs:29:17 + --> $DIR/self_type_keyword.rs:20:17 | LL | ref mut Self => (), | ^^^^ expected identifier, found keyword error: expected identifier, found keyword `Self` - --> $DIR/self_type_keyword.rs:33:15 + --> $DIR/self_type_keyword.rs:24:15 | LL | Foo { Self } => (), | ^^^^ expected identifier, found keyword error: expected identifier, found keyword `Self` - --> $DIR/self_type_keyword.rs:39:26 + --> $DIR/self_type_keyword.rs:30:26 | LL | extern crate core as Self; | ^^^^ expected identifier, found keyword error: expected identifier, found keyword `Self` - --> $DIR/self_type_keyword.rs:44:32 + --> $DIR/self_type_keyword.rs:35:32 | LL | use std::option::Option as Self; | ^^^^ expected identifier, found keyword error: expected identifier, found keyword `Self` - --> $DIR/self_type_keyword.rs:49:11 + --> $DIR/self_type_keyword.rs:40:11 | LL | trait Self {} | ^^^^ expected identifier, found keyword error: lifetimes cannot use keyword names - --> $DIR/self_type_keyword.rs:18:12 + --> $DIR/self_type_keyword.rs:8:12 | LL | struct Bar<'Self>; | ^^^^^ error: cannot find macro `Self!` in this scope - --> $DIR/self_type_keyword.rs:31:9 + --> $DIR/self_type_keyword.rs:22:9 | LL | Self!() => (), | ^^^^ -error: aborting due to 10 previous errors +error[E0392]: parameter `'Self` is never used + --> $DIR/self_type_keyword.rs:8:12 + | +LL | struct Bar<'Self>; + | ^^^^^ unused type parameter + | + = help: consider removing `'Self` or using a marker such as `std::marker::PhantomData` + +error: aborting due to 11 previous errors +For more information about this error, try `rustc --explain E0392`. diff --git a/src/test/ui/self/suggest-self.rs b/src/test/ui/self/suggest-self.rs index f648d781caf..9d81b6fd7ca 100644 --- a/src/test/ui/self/suggest-self.rs +++ b/src/test/ui/self/suggest-self.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: i32, } diff --git a/src/test/ui/self/suggest-self.stderr b/src/test/ui/self/suggest-self.stderr index 9035dc0fe7d..631e43c8694 100644 --- a/src/test/ui/self/suggest-self.stderr +++ b/src/test/ui/self/suggest-self.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `this` in this scope - --> $DIR/suggest-self.rs:31:9 + --> $DIR/suggest-self.rs:21:9 | LL | this.x | ^^^^ @@ -8,7 +8,7 @@ LL | this.x | help: did you mean: `self` error[E0425]: cannot find value `this` in this scope - --> $DIR/suggest-self.rs:36:9 + --> $DIR/suggest-self.rs:26:9 | LL | this.foo() | ^^^^ @@ -17,7 +17,7 @@ LL | this.foo() | help: did you mean: `self` error[E0425]: cannot find value `my` in this scope - --> $DIR/suggest-self.rs:41:9 + --> $DIR/suggest-self.rs:31:9 | LL | my.bar() | ^^ diff --git a/src/test/ui/seq-args.rs b/src/test/ui/seq-args.rs index 44b049d6561..9bb9f12f64c 100644 --- a/src/test/ui/seq-args.rs +++ b/src/test/ui/seq-args.rs @@ -1,20 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { -trait seq { } +trait Seq { } -impl seq for Vec { //~ ERROR wrong number of type arguments +impl Seq for Vec { //~ ERROR wrong number of type arguments /* ... */ } -impl seq for u32 { //~ ERROR wrong number of type arguments +impl Seq for u32 { //~ ERROR wrong number of type arguments /* Treat the integer as a sequence of bits */ } diff --git a/src/test/ui/seq-args.stderr b/src/test/ui/seq-args.stderr index 6ef9f5de4eb..81ba1abcd6d 100644 --- a/src/test/ui/seq-args.stderr +++ b/src/test/ui/seq-args.stderr @@ -1,13 +1,13 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/seq-args.rs:14:13 + --> $DIR/seq-args.rs:4:13 | -LL | impl seq for Vec { //~ ERROR wrong number of type arguments +LL | impl Seq for Vec { //~ ERROR wrong number of type arguments | ^ unexpected type argument error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/seq-args.rs:17:10 + --> $DIR/seq-args.rs:7:10 | -LL | impl seq for u32 { //~ ERROR wrong number of type arguments +LL | impl Seq for u32 { //~ ERROR wrong number of type arguments | ^^^^ unexpected type argument error: aborting due to 2 previous errors diff --git a/src/test/ui/shadowed/shadowed-lifetime.rs b/src/test/ui/shadowed/shadowed-lifetime.rs index 63e4038398d..9487b4f4e32 100644 --- a/src/test/ui/shadowed/shadowed-lifetime.rs +++ b/src/test/ui/shadowed/shadowed-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that shadowed lifetimes generate an error. struct Foo<'a>(&'a isize); diff --git a/src/test/ui/shadowed/shadowed-lifetime.stderr b/src/test/ui/shadowed/shadowed-lifetime.stderr index 8d7c00bb61e..5ea3d926430 100644 --- a/src/test/ui/shadowed/shadowed-lifetime.stderr +++ b/src/test/ui/shadowed/shadowed-lifetime.stderr @@ -1,5 +1,5 @@ error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope - --> $DIR/shadowed-lifetime.rs:16:25 + --> $DIR/shadowed-lifetime.rs:6:25 | LL | impl<'a> Foo<'a> { | -- first declared here @@ -7,7 +7,7 @@ LL | fn shadow_in_method<'a>(&'a self) -> &'a isize { | ^^ lifetime 'a already in scope error[E0496]: lifetime name `'b` shadows a lifetime name that is already in scope - --> $DIR/shadowed-lifetime.rs:22:20 + --> $DIR/shadowed-lifetime.rs:12:20 | LL | fn shadow_in_type<'b>(&'b self) -> &'b isize { | -- first declared here diff --git a/src/test/ui/shadowed/shadowed-trait-methods.rs b/src/test/ui/shadowed/shadowed-trait-methods.rs index 3146017a0b4..f9c25d97913 100644 --- a/src/test/ui/shadowed/shadowed-trait-methods.rs +++ b/src/test/ui/shadowed/shadowed-trait-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that methods from shadowed traits cannot be used mod foo { diff --git a/src/test/ui/shadowed/shadowed-trait-methods.stderr b/src/test/ui/shadowed/shadowed-trait-methods.stderr index 910f125a148..38b604af290 100644 --- a/src/test/ui/shadowed/shadowed-trait-methods.stderr +++ b/src/test/ui/shadowed/shadowed-trait-methods.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `f` found for type `()` in the current scope - --> $DIR/shadowed-trait-methods.rs:23:8 + --> $DIR/shadowed-trait-methods.rs:13:8 | LL | ().f() //~ ERROR no method | ^ diff --git a/src/test/ui/shadowed/shadowed-type-parameter.rs b/src/test/ui/shadowed/shadowed-type-parameter.rs index 1f72db1e894..ba9f3abcf7a 100644 --- a/src/test/ui/shadowed/shadowed-type-parameter.rs +++ b/src/test/ui/shadowed/shadowed-type-parameter.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that shadowed lifetimes generate an error. #![feature(box_syntax)] diff --git a/src/test/ui/shadowed/shadowed-type-parameter.stderr b/src/test/ui/shadowed/shadowed-type-parameter.stderr index c40343e31b4..6b4d1fae3de 100644 --- a/src/test/ui/shadowed/shadowed-type-parameter.stderr +++ b/src/test/ui/shadowed/shadowed-type-parameter.stderr @@ -1,5 +1,5 @@ error[E0194]: type parameter `T` shadows another type parameter of the same name - --> $DIR/shadowed-type-parameter.rs:30:27 + --> $DIR/shadowed-type-parameter.rs:20:27 | LL | trait Bar { | - first `T` declared here @@ -8,7 +8,7 @@ LL | fn shadow_in_required(&self); | ^ shadows another type parameter error[E0194]: type parameter `T` shadows another type parameter of the same name - --> $DIR/shadowed-type-parameter.rs:33:27 + --> $DIR/shadowed-type-parameter.rs:23:27 | LL | trait Bar { | - first `T` declared here @@ -17,7 +17,7 @@ LL | fn shadow_in_provided(&self) {} | ^ shadows another type parameter error[E0194]: type parameter `T` shadows another type parameter of the same name - --> $DIR/shadowed-type-parameter.rs:18:25 + --> $DIR/shadowed-type-parameter.rs:8:25 | LL | impl Foo { | - first `T` declared here diff --git a/src/test/ui/shadowed/shadowed-use-visibility.rs b/src/test/ui/shadowed/shadowed-use-visibility.rs index e7e57a73de0..8185e82ee83 100644 --- a/src/test/ui/shadowed/shadowed-use-visibility.rs +++ b/src/test/ui/shadowed/shadowed-use-visibility.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { pub fn f() {} diff --git a/src/test/ui/shadowed/shadowed-use-visibility.stderr b/src/test/ui/shadowed/shadowed-use-visibility.stderr index 4faaf6cce24..60e474a845f 100644 --- a/src/test/ui/shadowed/shadowed-use-visibility.stderr +++ b/src/test/ui/shadowed/shadowed-use-visibility.stderr @@ -1,11 +1,11 @@ error[E0603]: module `bar` is private - --> $DIR/shadowed-use-visibility.rs:19:14 + --> $DIR/shadowed-use-visibility.rs:9:14 | LL | use foo::bar::f as g; //~ ERROR module `bar` is private | ^^^ error[E0603]: module `f` is private - --> $DIR/shadowed-use-visibility.rs:25:10 + --> $DIR/shadowed-use-visibility.rs:15:10 | LL | use bar::f::f; //~ ERROR module `f` is private | ^ diff --git a/src/test/ui/shadowed/shadowing-in-the-same-pattern.rs b/src/test/ui/shadowed/shadowing-in-the-same-pattern.rs index e847d332416..f5872f9fbcf 100644 --- a/src/test/ui/shadowed/shadowing-in-the-same-pattern.rs +++ b/src/test/ui/shadowed/shadowing-in-the-same-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test for issue #14581. fn f((a, a): (isize, isize)) {} //~ ERROR identifier `a` is bound more than once diff --git a/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr b/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr index 46722891476..5d0fc912d95 100644 --- a/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr +++ b/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr @@ -1,11 +1,11 @@ error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/shadowing-in-the-same-pattern.rs:13:10 + --> $DIR/shadowing-in-the-same-pattern.rs:3:10 | LL | fn f((a, a): (isize, isize)) {} //~ ERROR identifier `a` is bound more than once | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern - --> $DIR/shadowing-in-the-same-pattern.rs:16:13 + --> $DIR/shadowing-in-the-same-pattern.rs:6:13 | LL | let (a, a) = (1, 1); //~ ERROR identifier `a` is bound more than once | ^ used in a pattern more than once diff --git a/src/test/ui/shift-various-bad-types.rs b/src/test/ui/shift-various-bad-types.rs index 2d06161111e..f3857461c9d 100644 --- a/src/test/ui/shift-various-bad-types.rs +++ b/src/test/ui/shift-various-bad-types.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can do shifts by any integral type. struct Panolpy { diff --git a/src/test/ui/shift-various-bad-types.stderr b/src/test/ui/shift-various-bad-types.stderr index 7798b619cd9..1bcff65ad75 100644 --- a/src/test/ui/shift-various-bad-types.stderr +++ b/src/test/ui/shift-various-bad-types.stderr @@ -1,5 +1,5 @@ error[E0277]: no implementation for `{integer} >> char` - --> $DIR/shift-various-bad-types.rs:19:8 + --> $DIR/shift-various-bad-types.rs:9:8 | LL | 22 >> p.char; | ^^ no implementation for `{integer} >> char` @@ -7,7 +7,7 @@ LL | 22 >> p.char; = help: the trait `std::ops::Shr` is not implemented for `{integer}` error[E0277]: no implementation for `{integer} >> &str` - --> $DIR/shift-various-bad-types.rs:22:8 + --> $DIR/shift-various-bad-types.rs:12:8 | LL | 22 >> p.str; | ^^ no implementation for `{integer} >> &str` @@ -15,7 +15,7 @@ LL | 22 >> p.str; = help: the trait `std::ops::Shr<&str>` is not implemented for `{integer}` error[E0277]: no implementation for `{integer} >> &Panolpy` - --> $DIR/shift-various-bad-types.rs:25:8 + --> $DIR/shift-various-bad-types.rs:15:8 | LL | 22 >> p; | ^^ no implementation for `{integer} >> &Panolpy` @@ -23,7 +23,7 @@ LL | 22 >> p; = help: the trait `std::ops::Shr<&Panolpy>` is not implemented for `{integer}` error[E0308]: mismatched types - --> $DIR/shift-various-bad-types.rs:35:18 + --> $DIR/shift-various-bad-types.rs:25:18 | LL | let _: i32 = 22_i64 >> 1_i32; | ^^^^^^^^^^^^^^^ expected i32, found i64 diff --git a/src/test/ui/short-error-format.rs b/src/test/ui/short-error-format.rs index 3e6802c51c3..acba4674a4d 100644 --- a/src/test/ui/short-error-format.rs +++ b/src/test/ui/short-error-format.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --error-format=short fn foo(_: u32) {} diff --git a/src/test/ui/short-error-format.stderr b/src/test/ui/short-error-format.stderr index f7461b837bd..8a22d673b98 100644 --- a/src/test/ui/short-error-format.stderr +++ b/src/test/ui/short-error-format.stderr @@ -1,3 +1,3 @@ -$DIR/short-error-format.rs:16:9: error[E0308]: mismatched types -$DIR/short-error-format.rs:18:7: error[E0599]: no method named `salut` found for type `u32` in the current scope +$DIR/short-error-format.rs:6:9: error[E0308]: mismatched types +$DIR/short-error-format.rs:8:7: error[E0599]: no method named `salut` found for type `u32` in the current scope error: aborting due to 2 previous errors diff --git a/src/test/ui/should-fail-no_gate_irrefutable_if_let_pattern.rs b/src/test/ui/should-fail-no_gate_irrefutable_if_let_pattern.rs deleted file mode 100644 index 8c9a24f4e72..00000000000 --- a/src/test/ui/should-fail-no_gate_irrefutable_if_let_pattern.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// should-fail-irrefutable_let_patterns -fn main() { - if let _ = 5 {} - //~^ ERROR irrefutable if-let pattern [E0162] -} diff --git a/src/test/ui/should-fail-no_gate_irrefutable_if_let_pattern.stderr b/src/test/ui/should-fail-no_gate_irrefutable_if_let_pattern.stderr deleted file mode 100644 index d8570ad4e83..00000000000 --- a/src/test/ui/should-fail-no_gate_irrefutable_if_let_pattern.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0162]: irrefutable if-let pattern - --> $DIR/should-fail-no_gate_irrefutable_if_let_pattern.rs:13:12 - | -LL | if let _ = 5 {} - | ^ irrefutable pattern - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0162`. diff --git a/src/test/ui/should-fail-with_gate_irrefutable_pattern_deny.rs b/src/test/ui/should-fail-with_gate_irrefutable_pattern_deny.rs deleted file mode 100644 index 6f95f10c0d9..00000000000 --- a/src/test/ui/should-fail-with_gate_irrefutable_pattern_deny.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(irrefutable_let_patterns)] - -// should-fail-irrefutable_let_patterns_with_gate -fn main() { - if let _ = 5 {} - //~^ ERROR irrefutable if-let pattern [irrefutable_let_patterns] -} diff --git a/src/test/ui/should-fail-with_gate_irrefutable_pattern_deny.stderr b/src/test/ui/should-fail-with_gate_irrefutable_pattern_deny.stderr deleted file mode 100644 index 9dc0d1968e6..00000000000 --- a/src/test/ui/should-fail-with_gate_irrefutable_pattern_deny.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: irrefutable if-let pattern - --> $DIR/should-fail-with_gate_irrefutable_pattern_deny.rs:15:5 - | -LL | if let _ = 5 {} - | ^^^^^^^^^^^^^^^ - | - = note: #[deny(irrefutable_let_patterns)] on by default - -error: aborting due to previous error - diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-declaration-type.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-declaration-type.rs deleted file mode 100644 index ef1f4d6f230..00000000000 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-declaration-type.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(repr_simd, platform_intrinsics)] - -#[repr(simd)] -struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); -#[repr(simd)] -struct u16x8(u16, u16, u16, u16, u16, u16, u16, u16); - -#[repr(simd)] -struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8, - i8, i8, i8, i8, i8, i8, i8, i8); -#[repr(simd)] -struct i32x4(i32, i32, i32, i32); -#[repr(simd)] -struct f32x4(f32, f32, f32, f32); -#[repr(simd)] -struct i64x2(i64, i64); - -// correct signatures work well -mod right { - use {i16x8, u16x8}; - extern "platform-intrinsic" { - fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i16x8; - fn x86_mm_adds_epu16(x: u16x8, y: u16x8) -> u16x8; - } -} -// but incorrect ones don't. - -mod signedness { - use {i16x8, u16x8}; - // signedness matters - extern "platform-intrinsic" { - fn x86_mm_adds_epi16(x: u16x8, y: u16x8) -> u16x8; - //~^ ERROR intrinsic argument 1 has wrong type - //~^^ ERROR intrinsic argument 2 has wrong type - //~^^^ ERROR intrinsic return value has wrong type - fn x86_mm_adds_epu16(x: i16x8, y: i16x8) -> i16x8; - //~^ ERROR intrinsic argument 1 has wrong type - //~^^ ERROR intrinsic argument 2 has wrong type - //~^^^ ERROR intrinsic return value has wrong type - } -} -// as do lengths -extern "platform-intrinsic" { - fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2; - //~^ ERROR intrinsic argument 1 has wrong type - //~^^ ERROR intrinsic argument 2 has wrong type - //~^^^ ERROR intrinsic return value has wrong type -} -// and so does int vs. float: -extern "platform-intrinsic" { - fn x86_mm_max_ps(x: i32x4, y: i32x4) -> i32x4; - //~^ ERROR intrinsic argument 1 has wrong type - //~^^ ERROR intrinsic argument 2 has wrong type - //~^^^ ERROR intrinsic return value has wrong type -} - - -fn main() {} diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-declaration-type.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-declaration-type.stderr deleted file mode 100644 index 4a8fd2d1bef..00000000000 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-declaration-type.stderr +++ /dev/null @@ -1,75 +0,0 @@ -error[E0442]: intrinsic argument 1 has wrong type: found `u16`, expected `i16` - --> $DIR/simd-intrinsic-declaration-type.rs:42:9 - | -LL | fn x86_mm_adds_epi16(x: u16x8, y: u16x8) -> u16x8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic argument 2 has wrong type: found `u16`, expected `i16` - --> $DIR/simd-intrinsic-declaration-type.rs:42:9 - | -LL | fn x86_mm_adds_epi16(x: u16x8, y: u16x8) -> u16x8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic return value has wrong type: found `u16`, expected `i16` - --> $DIR/simd-intrinsic-declaration-type.rs:42:9 - | -LL | fn x86_mm_adds_epi16(x: u16x8, y: u16x8) -> u16x8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic argument 1 has wrong type: found `i16`, expected `u16` - --> $DIR/simd-intrinsic-declaration-type.rs:46:9 - | -LL | fn x86_mm_adds_epu16(x: i16x8, y: i16x8) -> i16x8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic argument 2 has wrong type: found `i16`, expected `u16` - --> $DIR/simd-intrinsic-declaration-type.rs:46:9 - | -LL | fn x86_mm_adds_epu16(x: i16x8, y: i16x8) -> i16x8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic return value has wrong type: found `i16`, expected `u16` - --> $DIR/simd-intrinsic-declaration-type.rs:46:9 - | -LL | fn x86_mm_adds_epu16(x: i16x8, y: i16x8) -> i16x8; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic argument 1 has wrong type: found vector with length 16, expected length 8 - --> $DIR/simd-intrinsic-declaration-type.rs:54:5 - | -LL | fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic argument 2 has wrong type: found vector with length 4, expected length 8 - --> $DIR/simd-intrinsic-declaration-type.rs:54:5 - | -LL | fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic return value has wrong type: found vector with length 2, expected length 8 - --> $DIR/simd-intrinsic-declaration-type.rs:54:5 - | -LL | fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic argument 1 has wrong type: found `i32`, expected `f32` - --> $DIR/simd-intrinsic-declaration-type.rs:61:5 - | -LL | fn x86_mm_max_ps(x: i32x4, y: i32x4) -> i32x4; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic argument 2 has wrong type: found `i32`, expected `f32` - --> $DIR/simd-intrinsic-declaration-type.rs:61:5 - | -LL | fn x86_mm_max_ps(x: i32x4, y: i32x4) -> i32x4; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0442]: intrinsic return value has wrong type: found `i32`, expected `f32` - --> $DIR/simd-intrinsic-declaration-type.rs:61:5 - | -LL | fn x86_mm_max_ps(x: i32x4, y: i32x4) -> i32x4; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 12 previous errors - -For more information about this error, try `rustc --explain E0442`. diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.rs index ee08ca05e80..7686b389a71 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd, platform_intrinsics)] #![allow(non_camel_case_types)] #[repr(simd)] diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr index f81fa75c56b..27493950af0 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr @@ -1,83 +1,83 @@ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:72:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:62:9 | LL | simd_add(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_sub` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:74:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:64:9 | LL | simd_sub(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_mul` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:76:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:66:9 | LL | simd_mul(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_div` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:78:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:68:9 | LL | simd_div(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shl` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:80:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:70:9 | LL | simd_shl(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shr` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:82:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:72:9 | LL | simd_shr(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_and` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:84:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:74:9 | LL | simd_and(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_or` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:86:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:76:9 | LL | simd_or(0, 0); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_xor` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:88:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:78:9 | LL | simd_xor(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shl` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:92:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:82:9 | LL | simd_shl(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shr` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:94:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:84:9 | LL | simd_shr(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_and` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:96:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:86:9 | LL | simd_and(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_or` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:98:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:88:9 | LL | simd_or(z, z); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_xor` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/simd-intrinsic-generic-arithmetic.rs:100:9 + --> $DIR/simd-intrinsic-generic-arithmetic.rs:90:9 | LL | simd_xor(z, z); | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.rs new file mode 100644 index 00000000000..931ee9db1fe --- /dev/null +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.rs @@ -0,0 +1,90 @@ +// Test that the simd_bitmask intrinsic produces ok-ish error +// messages when misused. + +#![feature(repr_simd, platform_intrinsics)] +#![allow(non_camel_case_types)] + +#[repr(simd)] +#[derive(Copy, Clone)] +pub struct u32x2(pub u32, pub u32); + +#[repr(simd)] +#[derive(Copy, Clone)] +pub struct u32x4(pub u32, pub u32, pub u32, pub u32); + +#[repr(simd)] +#[derive(Copy, Clone)] +struct u8x8( + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, +); + +#[repr(simd)] +#[derive(Copy, Clone)] +struct u8x16( + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, +); + +#[repr(simd)] +#[derive(Copy, Clone)] +struct u8x32( + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, +); + +#[repr(simd)] +#[derive(Copy, Clone)] +struct u8x64( + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, + pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, +); + +extern "platform-intrinsic" { + fn simd_bitmask(x: T) -> U; +} + +fn main() { + let m2 = u32x2(0, 0); + let m4 = u32x4(0, 0, 0, 0); + let m8 = u8x8(0, 0, 0, 0, 0, 0, 0, 0); + let m16 = u8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + let m32 = u8x32(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + let m64 = u8x64(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + unsafe { + let _: u8 = simd_bitmask(m2); + let _: u8 = simd_bitmask(m4); + let _: u8 = simd_bitmask(m8); + let _: u16 = simd_bitmask(m16); + let _: u32 = simd_bitmask(m32); + let _: u64 = simd_bitmask(m64); + + let _: u16 = simd_bitmask(m2); + //~^ ERROR bitmask `u16`, expected `u8` + + let _: u16 = simd_bitmask(m8); + //~^ ERROR bitmask `u16`, expected `u8` + + let _: u32 = simd_bitmask(m16); + //~^ ERROR bitmask `u32`, expected `u16` + + let _: u64 = simd_bitmask(m32); + //~^ ERROR bitmask `u64`, expected `u32` + + let _: u128 = simd_bitmask(m64); + //~^ ERROR bitmask `u128`, expected `u64` + + } +} diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.stderr new file mode 100644 index 00000000000..d016838d098 --- /dev/null +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-bitmask.stderr @@ -0,0 +1,33 @@ +error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u16`, expected `u8` + --> $DIR/simd-intrinsic-generic-bitmask.rs:74:22 + | +LL | let _: u16 = simd_bitmask(m2); + | ^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u16`, expected `u8` + --> $DIR/simd-intrinsic-generic-bitmask.rs:77:22 + | +LL | let _: u16 = simd_bitmask(m8); + | ^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u32`, expected `u16` + --> $DIR/simd-intrinsic-generic-bitmask.rs:80:22 + | +LL | let _: u32 = simd_bitmask(m16); + | ^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u64`, expected `u32` + --> $DIR/simd-intrinsic-generic-bitmask.rs:83:22 + | +LL | let _: u64 = simd_bitmask(m32); + | ^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: bitmask `u128`, expected `u64` + --> $DIR/simd-intrinsic-generic-bitmask.rs:86:23 + | +LL | let _: u128 = simd_bitmask(m64); + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0511`. diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.rs index 4999b790b13..c4016e75b14 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd, platform_intrinsics)] #[repr(simd)] diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr index 6ad5ac7dbfd..6e33e3b30f5 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr @@ -1,23 +1,23 @@ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-cast.rs:42:9 + --> $DIR/simd-intrinsic-generic-cast.rs:32:9 | LL | simd_cast::(0); | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-cast.rs:44:9 + --> $DIR/simd-intrinsic-generic-cast.rs:34:9 | LL | simd_cast::(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-cast.rs:46:9 + --> $DIR/simd-intrinsic-generic-cast.rs:36:9 | LL | simd_cast::(x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i32x8` with length 8 - --> $DIR/simd-intrinsic-generic-cast.rs:48:9 + --> $DIR/simd-intrinsic-generic-cast.rs:38:9 | LL | simd_cast::<_, i32x8>(x); | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.rs index 617b03a8711..3ac47d17dad 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd, platform_intrinsics)] #[repr(simd)] diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.stderr index 06eb94a4f97..d8da2e5ee57 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.stderr @@ -1,107 +1,107 @@ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:36:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:26:9 | LL | simd_eq::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:38:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:28:9 | LL | simd_ne::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:40:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:30:9 | LL | simd_lt::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:42:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:32:9 | LL | simd_le::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:44:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:34:9 | LL | simd_gt::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:46:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:36:9 | LL | simd_ge::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:49:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:39:9 | LL | simd_eq::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:51:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:41:9 | LL | simd_ne::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:53:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:43:9 | LL | simd_lt::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:55:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:45:9 | LL | simd_le::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:57:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:47:9 | LL | simd_gt::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-comparison.rs:59:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:49:9 | LL | simd_ge::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/simd-intrinsic-generic-comparison.rs:62:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:52:9 | LL | simd_eq::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/simd-intrinsic-generic-comparison.rs:64:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:54:9 | LL | simd_ne::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/simd-intrinsic-generic-comparison.rs:66:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:56:9 | LL | simd_lt::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/simd-intrinsic-generic-comparison.rs:68:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:58:9 | LL | simd_le::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/simd-intrinsic-generic-comparison.rs:70:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:60:9 | LL | simd_gt::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/simd-intrinsic-generic-comparison.rs:72:9 + --> $DIR/simd-intrinsic-generic-comparison.rs:62:9 | LL | simd_ge::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs index 78f7d42e25a..28fcb6c57ec 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd, platform_intrinsics, rustc_attrs)] #[repr(simd)] diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr index 5a2def2c8c7..2f8ffb6035e 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr @@ -1,89 +1,89 @@ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:63:9 + --> $DIR/simd-intrinsic-generic-elements.rs:53:9 | LL | simd_insert(0, 0, 0); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `i32` (element of input `i32x4`), found `f64` - --> $DIR/simd-intrinsic-generic-elements.rs:65:9 + --> $DIR/simd-intrinsic-generic-elements.rs:55:9 | LL | simd_insert(x, 0, 1.0); | ^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_extract` intrinsic: expected return type `i32` (element of input `i32x4`), found `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:67:9 + --> $DIR/simd-intrinsic-generic-elements.rs:57:9 | LL | simd_extract::<_, f32>(x, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:70:9 + --> $DIR/simd-intrinsic-generic-elements.rs:60:9 | LL | simd_shuffle2::(0, 0, [0; 2]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle3` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:72:9 + --> $DIR/simd-intrinsic-generic-elements.rs:62:9 | LL | simd_shuffle3::(0, 0, [0; 3]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:74:9 + --> $DIR/simd-intrinsic-generic-elements.rs:64:9 | LL | simd_shuffle4::(0, 0, [0; 4]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/simd-intrinsic-generic-elements.rs:76:9 + --> $DIR/simd-intrinsic-generic-elements.rs:66:9 | LL | simd_shuffle8::(0, 0, [0; 8]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:79:9 + --> $DIR/simd-intrinsic-generic-elements.rs:69:9 | LL | simd_shuffle2::<_, f32x2>(x, x, [0; 2]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle3` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x3` with element type `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:81:9 + --> $DIR/simd-intrinsic-generic-elements.rs:71:9 | LL | simd_shuffle3::<_, f32x3>(x, x, [0; 3]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:83:9 + --> $DIR/simd-intrinsic-generic-elements.rs:73:9 | LL | simd_shuffle4::<_, f32x4>(x, x, [0; 4]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` - --> $DIR/simd-intrinsic-generic-elements.rs:85:9 + --> $DIR/simd-intrinsic-generic-elements.rs:75:9 | LL | simd_shuffle8::<_, f32x8>(x, x, [0; 8]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return type of length 2, found `i32x8` with length 8 - --> $DIR/simd-intrinsic-generic-elements.rs:88:9 + --> $DIR/simd-intrinsic-generic-elements.rs:78:9 | LL | simd_shuffle2::<_, i32x8>(x, x, [0; 2]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle3` intrinsic: expected return type of length 3, found `i32x4` with length 4 - --> $DIR/simd-intrinsic-generic-elements.rs:90:9 + --> $DIR/simd-intrinsic-generic-elements.rs:80:9 | LL | simd_shuffle3::<_, i32x4>(x, x, [0; 3]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return type of length 4, found `i32x3` with length 3 - --> $DIR/simd-intrinsic-generic-elements.rs:92:9 + --> $DIR/simd-intrinsic-generic-elements.rs:82:9 | LL | simd_shuffle4::<_, i32x3>(x, x, [0; 4]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return type of length 8, found `i32x2` with length 2 - --> $DIR/simd-intrinsic-generic-elements.rs:94:9 + --> $DIR/simd-intrinsic-generic-elements.rs:84:9 | LL | simd_shuffle8::<_, i32x2>(x, x, [0; 8]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.rs index 725960a866b..8e67c27ef22 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-emscripten // Test that the simd_reduce_{op} intrinsics produce ok-ish error diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.stderr index 47b1e9dac78..b56de9613dd 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.stderr @@ -1,71 +1,71 @@ error[E0511]: invalid monomorphization of `simd_reduce_add_ordered` intrinsic: accumulator of simd_reduce_add_ordered is not 0.0 - --> $DIR/simd-intrinsic-generic-reduction.rs:46:9 + --> $DIR/simd-intrinsic-generic-reduction.rs:36:9 | LL | simd_reduce_add_ordered(z, 2_f32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_mul_ordered` intrinsic: accumulator of simd_reduce_mul_ordered is not 1.0 - --> $DIR/simd-intrinsic-generic-reduction.rs:48:9 + --> $DIR/simd-intrinsic-generic-reduction.rs:38:9 | LL | simd_reduce_mul_ordered(z, 3_f32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_and` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/simd-intrinsic-generic-reduction.rs:51:22 + --> $DIR/simd-intrinsic-generic-reduction.rs:41:22 | LL | let _: f32 = simd_reduce_and(x); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_or` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/simd-intrinsic-generic-reduction.rs:53:22 + --> $DIR/simd-intrinsic-generic-reduction.rs:43:22 | LL | let _: f32 = simd_reduce_or(x); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_xor` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/simd-intrinsic-generic-reduction.rs:55:22 + --> $DIR/simd-intrinsic-generic-reduction.rs:45:22 | LL | let _: f32 = simd_reduce_xor(x); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_and` intrinsic: unsupported simd_reduce_and from `f32x4` with element `f32` to `f32` - --> $DIR/simd-intrinsic-generic-reduction.rs:58:22 + --> $DIR/simd-intrinsic-generic-reduction.rs:48:22 | LL | let _: f32 = simd_reduce_and(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_or` intrinsic: unsupported simd_reduce_or from `f32x4` with element `f32` to `f32` - --> $DIR/simd-intrinsic-generic-reduction.rs:60:22 + --> $DIR/simd-intrinsic-generic-reduction.rs:50:22 | LL | let _: f32 = simd_reduce_or(z); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_xor` intrinsic: unsupported simd_reduce_xor from `f32x4` with element `f32` to `f32` - --> $DIR/simd-intrinsic-generic-reduction.rs:62:22 + --> $DIR/simd-intrinsic-generic-reduction.rs:52:22 | LL | let _: f32 = simd_reduce_xor(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_all` intrinsic: unsupported simd_reduce_all from `f32x4` with element `f32` to `bool` - --> $DIR/simd-intrinsic-generic-reduction.rs:65:23 + --> $DIR/simd-intrinsic-generic-reduction.rs:55:23 | LL | let _: bool = simd_reduce_all(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_any` intrinsic: unsupported simd_reduce_any from `f32x4` with element `f32` to `bool` - --> $DIR/simd-intrinsic-generic-reduction.rs:67:23 + --> $DIR/simd-intrinsic-generic-reduction.rs:57:23 | LL | let _: bool = simd_reduce_any(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_add_ordered` intrinsic: accumulator of simd_reduce_add_ordered is not a constant - --> $DIR/simd-intrinsic-generic-reduction.rs:77:5 + --> $DIR/simd-intrinsic-generic-reduction.rs:67:5 | LL | simd_reduce_add_ordered(z, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_mul_ordered` intrinsic: accumulator of simd_reduce_mul_ordered is not a constant - --> $DIR/simd-intrinsic-generic-reduction.rs:79:5 + --> $DIR/simd-intrinsic-generic-reduction.rs:69:5 | LL | simd_reduce_mul_ordered(z, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs index d74d6815d5f..72f51a895b6 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the simd_select intrinsic produces ok-ish error // messages when misused. @@ -33,6 +23,7 @@ struct b8x8(pub i8, pub i8, pub i8, pub i8, extern "platform-intrinsic" { fn simd_select(x: T, a: U, b: U) -> U; + fn simd_select_bitmask(x: T, a: U, b: U) -> U; } fn main() { @@ -52,5 +43,20 @@ fn main() { simd_select(z, z, z); //~^ ERROR mask element type is `f32`, expected `i_` + + simd_select(m4, 0u32, 1u32); + //~^ ERROR found non-SIMD `u32` + + simd_select_bitmask(0u8, x, x); + //~^ ERROR mask length `8` != other vector length `4` + // + simd_select_bitmask(0u8, 1u32, 2u32); + //~^ ERROR found non-SIMD `u32` + + simd_select_bitmask(0.0f32, x, x); + //~^ ERROR `f32` is not an integral type + + simd_select_bitmask("x", x, x); + //~^ ERROR `&str` is not an integral type } } diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr index 61e42027039..a46352c7308 100644 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr +++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr @@ -1,21 +1,51 @@ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mismatched lengths: mask length `8` != other vector length `4` - --> $DIR/simd-intrinsic-generic-select.rs:47:9 + --> $DIR/simd-intrinsic-generic-select.rs:38:9 | LL | simd_select(m8, x, x); | ^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `u32`, expected `i_` - --> $DIR/simd-intrinsic-generic-select.rs:50:9 + --> $DIR/simd-intrinsic-generic-select.rs:41:9 | LL | simd_select(x, x, x); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `f32`, expected `i_` - --> $DIR/simd-intrinsic-generic-select.rs:53:9 + --> $DIR/simd-intrinsic-generic-select.rs:44:9 | LL | simd_select(z, z, z); | ^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error[E0511]: invalid monomorphization of `simd_select` intrinsic: expected SIMD argument type, found non-SIMD `u32` + --> $DIR/simd-intrinsic-generic-select.rs:47:9 + | +LL | simd_select(m4, 0u32, 1u32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: mismatched lengths: mask length `8` != other vector length `4` + --> $DIR/simd-intrinsic-generic-select.rs:50:9 + | +LL | simd_select_bitmask(0u8, x, x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: expected SIMD argument type, found non-SIMD `u32` + --> $DIR/simd-intrinsic-generic-select.rs:53:9 + | +LL | simd_select_bitmask(0u8, 1u32, 2u32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: `f32` is not an integral type + --> $DIR/simd-intrinsic-generic-select.rs:56:9 + | +LL | simd_select_bitmask(0.0f32, x, x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: `&str` is not an integral type + --> $DIR/simd-intrinsic-generic-select.rs:59:9 + | +LL | simd_select_bitmask("x", x, x); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 8 previous errors For more information about this error, try `rustc --explain E0511`. diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.rs deleted file mode 100644 index 0d0bf240f72..00000000000 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(repr_simd, platform_intrinsics)] - -#[repr(simd)] -struct A(i16, i16, i16, i16, i16, i16, i16, i16); -#[repr(simd)] -struct B(i16, i16, i16, i16, i16, i16, i16, i16); - -// each intrinsic definition has to use the same nominal type for any -// vector structure throughout that declaration (i.e. every instance -// of i16x8 in each `fn ...;` needs to be either A or B) - -extern "platform-intrinsic" { - fn x86_mm_adds_epi16(x: A, y: A) -> B; - //~^ ERROR intrinsic return value has wrong type: found `B`, expected `A` - fn x86_mm_subs_epi16(x: A, y: B) -> A; - //~^ ERROR intrinsic argument 2 has wrong type: found `B`, expected `A` - - // ok: - fn x86_mm_max_epi16(x: B, y: B) -> B; - fn x86_mm_min_epi16(x: A, y: A) -> A; -} - -fn main() {} diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.stderr deleted file mode 100644 index 0692aa7275b..00000000000 --- a/src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0443]: intrinsic return value has wrong type: found `B`, expected `A` which was used for this vector type previously in this signature - --> $DIR/simd-intrinsic-single-nominal-type.rs:23:5 - | -LL | fn x86_mm_adds_epi16(x: A, y: A) -> B; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0443]: intrinsic argument 2 has wrong type: found `B`, expected `A` which was used for this vector type previously in this signature - --> $DIR/simd-intrinsic-single-nominal-type.rs:25:5 - | -LL | fn x86_mm_subs_epi16(x: A, y: B) -> A; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0443`. diff --git a/src/test/ui/simd-type-generic-monomorphisation.rs b/src/test/ui/simd-type-generic-monomorphisation.rs index 336855eb5e1..68eb78759eb 100644 --- a/src/test/ui/simd-type-generic-monomorphisation.rs +++ b/src/test/ui/simd-type-generic-monomorphisation.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd, platform_intrinsics)] // error-pattern:monomorphising SIMD type `Simd2` with a non-machine element type `X` diff --git a/src/test/ui/simd-type.rs b/src/test/ui/simd-type.rs index cde63aa0cd1..d1e2efa6a33 100644 --- a/src/test/ui/simd-type.rs +++ b/src/test/ui/simd-type.rs @@ -1,14 +1,5 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(repr_simd)] +#![allow(non_camel_case_types)] #[repr(simd)] struct empty; //~ ERROR SIMD vector cannot be empty diff --git a/src/test/ui/simd-type.stderr b/src/test/ui/simd-type.stderr index 5899f4aacc0..5e309cea6ef 100644 --- a/src/test/ui/simd-type.stderr +++ b/src/test/ui/simd-type.stderr @@ -1,17 +1,17 @@ error[E0075]: SIMD vector cannot be empty - --> $DIR/simd-type.rs:14:1 + --> $DIR/simd-type.rs:5:1 | LL | struct empty; //~ ERROR SIMD vector cannot be empty | ^^^^^^^^^^^^^ error[E0076]: SIMD vector should be homogeneous - --> $DIR/simd-type.rs:17:1 + --> $DIR/simd-type.rs:8:1 | LL | struct i64f64(i64, f64); //~ ERROR SIMD vector should be homogeneous | ^^^^^^^^^^^^^^^^^^^^^^^^ SIMD elements must have the same type error[E0077]: SIMD vector element type should be machine type - --> $DIR/simd-type.rs:20:1 + --> $DIR/simd-type.rs:11:1 | LL | struct int4(isize, isize, isize, isize); //~ ERROR SIMD vector element type should be machine type | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/similar-tokens.rs b/src/test/ui/similar-tokens.rs index 350a2262391..b42f3a313e1 100644 --- a/src/test/ui/similar-tokens.rs +++ b/src/test/ui/similar-tokens.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod x { pub struct A; pub struct B; diff --git a/src/test/ui/similar-tokens.stderr b/src/test/ui/similar-tokens.stderr index 90acc56cbc9..898c3a0aa95 100644 --- a/src/test/ui/similar-tokens.stderr +++ b/src/test/ui/similar-tokens.stderr @@ -1,5 +1,5 @@ error: expected one of `,`, `::`, `as`, or `}`, found `.` - --> $DIR/similar-tokens.rs:17:10 + --> $DIR/similar-tokens.rs:7:10 | LL | use x::{A. B}; //~ ERROR expected one of `,`, `::`, `as`, or `}`, found `.` | ^ expected one of `,`, `::`, `as`, or `}` here diff --git a/src/test/ui/single-primitive-inherent-impl.rs b/src/test/ui/single-primitive-inherent-impl.rs index 0a0f9ce4bd1..baa23396c16 100644 --- a/src/test/ui/single-primitive-inherent-impl.rs +++ b/src/test/ui/single-primitive-inherent-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![crate_type = "lib"] diff --git a/src/test/ui/single-primitive-inherent-impl.stderr b/src/test/ui/single-primitive-inherent-impl.stderr index b781ee866c0..21bbbe69346 100644 --- a/src/test/ui/single-primitive-inherent-impl.stderr +++ b/src/test/ui/single-primitive-inherent-impl.stderr @@ -1,5 +1,5 @@ error[E0390]: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive - --> $DIR/single-primitive-inherent-impl.rs:21:1 + --> $DIR/single-primitive-inherent-impl.rs:11:1 | LL | / impl str { LL | | //~^ error: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive @@ -7,7 +7,7 @@ LL | | } | |_^ | help: consider using a trait to implement these methods - --> $DIR/single-primitive-inherent-impl.rs:21:1 + --> $DIR/single-primitive-inherent-impl.rs:11:1 | LL | / impl str { LL | | //~^ error: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive diff --git a/src/test/ui/single-use-lifetime/fn-types.rs b/src/test/ui/single-use-lifetime/fn-types.rs index 53fb4cf21f5..018535f645d 100644 --- a/src/test/ui/single-use-lifetime/fn-types.rs +++ b/src/test/ui/single-use-lifetime/fn-types.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(single_use_lifetimes)] #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/single-use-lifetime/fn-types.stderr b/src/test/ui/single-use-lifetime/fn-types.stderr index 6fd2b320472..7e23d75c4e5 100644 --- a/src/test/ui/single-use-lifetime/fn-types.stderr +++ b/src/test/ui/single-use-lifetime/fn-types.stderr @@ -1,5 +1,5 @@ error: lifetime parameter `'a` only used once - --> $DIR/fn-types.rs:19:10 + --> $DIR/fn-types.rs:9:10 | LL | a: for<'a> fn(&'a u32), //~ ERROR `'a` only used once | ^^ -- ...is used only here @@ -7,13 +7,13 @@ LL | a: for<'a> fn(&'a u32), //~ ERROR `'a` only used once | this lifetime... | note: lint level defined here - --> $DIR/fn-types.rs:11:9 + --> $DIR/fn-types.rs:1:9 | LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types - --> $DIR/fn-types.rs:22:22 + --> $DIR/fn-types.rs:12:22 | LL | d: for<'a> fn() -> &'a u32, // OK, used only in return type. | ^^^^^^^ diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.fixed b/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.fixed index fd9b10e1a32..6bc07afccbf 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.fixed +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.fixed @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![feature(in_band_lifetimes)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.rs b/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.rs index 0d5f65e6d1b..22c6a5a9d38 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.rs +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix #![feature(in_band_lifetimes)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.stderr b/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.stderr index a9f8411d411..ef118a22ccb 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument-in-band.stderr @@ -1,5 +1,5 @@ error: lifetime parameter `'a` only used once - --> $DIR/one-use-in-fn-argument-in-band.rs:21:10 + --> $DIR/one-use-in-fn-argument-in-band.rs:11:10 | LL | fn a(x: &'a u32, y: &'b u32) { | ^^- @@ -8,13 +8,13 @@ LL | fn a(x: &'a u32, y: &'b u32) { | help: elide the single-use lifetime | note: lint level defined here - --> $DIR/one-use-in-fn-argument-in-band.rs:14:9 + --> $DIR/one-use-in-fn-argument-in-band.rs:4:9 | LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ error: lifetime parameter `'b` only used once - --> $DIR/one-use-in-fn-argument-in-band.rs:21:22 + --> $DIR/one-use-in-fn-argument-in-band.rs:11:22 | LL | fn a(x: &'a u32, y: &'b u32) { | ^^- diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.rs b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.rs index a1b8866c8c4..900e8434d4f 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.rs +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(single_use_lifetimes)] #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr index 0a23ecaf458..0199074ad64 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr @@ -1,5 +1,5 @@ error: lifetime parameter `'a` only used once - --> $DIR/one-use-in-fn-argument.rs:18:6 + --> $DIR/one-use-in-fn-argument.rs:8:6 | LL | fn a<'a>(x: &'a u32) { //~ ERROR `'a` only used once | ^^ -- ...is used only here @@ -7,7 +7,7 @@ LL | fn a<'a>(x: &'a u32) { //~ ERROR `'a` only used once | this lifetime... | note: lint level defined here - --> $DIR/one-use-in-fn-argument.rs:11:9 + --> $DIR/one-use-in-fn-argument.rs:1:9 | LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-return.rs b/src/test/ui/single-use-lifetime/one-use-in-fn-return.rs index 23275e47b5e..876a0a564da 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-return.rs +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-return.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![deny(single_use_lifetimes)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs index b392f7a5174..64f1c9118a1 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(single_use_lifetimes)] #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr index 40dfa677d0a..094894bf2d1 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr @@ -1,5 +1,5 @@ error: lifetime parameter `'f` only used once - --> $DIR/one-use-in-inherent-impl-header.rs:22:6 + --> $DIR/one-use-in-inherent-impl-header.rs:12:6 | LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once | ^^ -- ...is used only here @@ -7,7 +7,7 @@ LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once | this lifetime... | note: lint level defined here - --> $DIR/one-use-in-inherent-impl-header.rs:11:9 + --> $DIR/one-use-in-inherent-impl-header.rs:1:9 | LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.rs b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.rs index 63c3bbdfe4a..e7bdbb2207a 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.rs +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(single_use_lifetimes)] #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr index d0651a437b0..5bd4efb6bb1 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr @@ -1,5 +1,5 @@ error: lifetime parameter `'a` only used once - --> $DIR/one-use-in-inherent-method-argument.rs:22:19 + --> $DIR/one-use-in-inherent-method-argument.rs:12:19 | LL | fn inherent_a<'a>(&self, data: &'a u32) { //~ ERROR `'a` only used once | ^^ -- ...is used only here @@ -7,7 +7,7 @@ LL | fn inherent_a<'a>(&self, data: &'a u32) { //~ ERROR `'a` only used once | this lifetime... | note: lint level defined here - --> $DIR/one-use-in-inherent-method-argument.rs:11:9 + --> $DIR/one-use-in-inherent-method-argument.rs:1:9 | LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | fn inherent_a(&self, data: &u32) { //~ ERROR `'a` only used once | -- -- error: lifetime parameter `'f` only used once - --> $DIR/one-use-in-inherent-method-argument.rs:21:6 + --> $DIR/one-use-in-inherent-method-argument.rs:11:6 | LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once | ^^ -- ...is used only here diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.rs b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.rs index 92e4ff3436b..c5938f4a10b 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.rs +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(single_use_lifetimes)] #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr index 8aa19d4e3ee..f0e4ac411c2 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr @@ -1,5 +1,5 @@ error: lifetime parameter `'f` only used once - --> $DIR/one-use-in-inherent-method-return.rs:22:6 + --> $DIR/one-use-in-inherent-method-return.rs:12:6 | LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once | ^^ -- ...is used only here @@ -7,7 +7,7 @@ LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once | this lifetime... | note: lint level defined here - --> $DIR/one-use-in-inherent-method-return.rs:11:9 + --> $DIR/one-use-in-inherent-method-return.rs:1:9 | LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/single-use-lifetime/one-use-in-struct.rs b/src/test/ui/single-use-lifetime/one-use-in-struct.rs index 1e1426c145b..e0328c9d94a 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-struct.rs +++ b/src/test/ui/single-use-lifetime/one-use-in-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we do not warn for named lifetimes in structs, // even when they are only used once (since to not use a named // lifetime is illegal!) diff --git a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.rs b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.rs index c36e9ef2b22..6a66c17538a 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.rs +++ b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we DO warn for a lifetime on an impl used only in `&self` // in a trait method. diff --git a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr index e054d0ad934..7d3fc82abf4 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr @@ -1,5 +1,5 @@ error: lifetime parameter `'g` only used once - --> $DIR/one-use-in-trait-method-argument.rs:25:13 + --> $DIR/one-use-in-trait-method-argument.rs:15:13 | LL | fn next<'g>(&'g mut self) -> Option { //~ ERROR `'g` only used once | ^^ -- ...is used only here @@ -7,7 +7,7 @@ LL | fn next<'g>(&'g mut self) -> Option { //~ ERROR `'g` only u | this lifetime... | note: lint level defined here - --> $DIR/one-use-in-trait-method-argument.rs:14:9 + --> $DIR/one-use-in-trait-method-argument.rs:4:9 | LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/single-use-lifetime/two-uses-in-fn-argument-and-return.rs b/src/test/ui/single-use-lifetime/two-uses-in-fn-argument-and-return.rs index a6183e3d5c8..4cdf1530a92 100644 --- a/src/test/ui/single-use-lifetime/two-uses-in-fn-argument-and-return.rs +++ b/src/test/ui/single-use-lifetime/two-uses-in-fn-argument-and-return.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we DO NOT warn when lifetime name is used in // both the argument and return. // diff --git a/src/test/ui/single-use-lifetime/two-uses-in-fn-arguments.rs b/src/test/ui/single-use-lifetime/two-uses-in-fn-arguments.rs index 81adf89fd43..375366e41c6 100644 --- a/src/test/ui/single-use-lifetime/two-uses-in-fn-arguments.rs +++ b/src/test/ui/single-use-lifetime/two-uses-in-fn-arguments.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we DO NOT warn when lifetime name is used multiple // arguments, or more than once in a single argument. // diff --git a/src/test/ui/single-use-lifetime/two-uses-in-inherent-impl-header.rs b/src/test/ui/single-use-lifetime/two-uses-in-inherent-impl-header.rs index ca5c519e05a..63d03a2cf0a 100644 --- a/src/test/ui/single-use-lifetime/two-uses-in-inherent-impl-header.rs +++ b/src/test/ui/single-use-lifetime/two-uses-in-inherent-impl-header.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we DO NOT warn for a lifetime used twice in an impl. // // compile-pass diff --git a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.rs b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.rs index 9345fe59d94..06ab6cdbfae 100644 --- a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.rs +++ b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we DO NOT warn for a lifetime used twice in an impl method and // header. diff --git a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr index b4b370d6e97..7a1af1323d8 100644 --- a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr +++ b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr @@ -1,5 +1,5 @@ error: lifetime parameter `'f` only used once - --> $DIR/two-uses-in-inherent-method-argument-and-return.rs:22:6 + --> $DIR/two-uses-in-inherent-method-argument-and-return.rs:12:6 | LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once | ^^ -- ...is used only here @@ -7,7 +7,7 @@ LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once | this lifetime... | note: lint level defined here - --> $DIR/two-uses-in-inherent-method-argument-and-return.rs:14:9 + --> $DIR/two-uses-in-inherent-method-argument-and-return.rs:4:9 | LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/single-use-lifetime/two-uses-in-trait-impl.rs b/src/test/ui/single-use-lifetime/two-uses-in-trait-impl.rs index c298c958ef0..d4a0d71713c 100644 --- a/src/test/ui/single-use-lifetime/two-uses-in-trait-impl.rs +++ b/src/test/ui/single-use-lifetime/two-uses-in-trait-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we DO NOT warn for a lifetime on an impl used in both // header and in an associated type. // diff --git a/src/test/ui/sized-cycle-note.rs b/src/test/ui/sized-cycle-note.rs index 712b4ac22f0..ca8be5692ba 100644 --- a/src/test/ui/sized-cycle-note.rs +++ b/src/test/ui/sized-cycle-note.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test the error message resulting from a cycle in solving `Foo: // Sized`. The specifics of the message will of course but the main // thing we want to preserve is that: diff --git a/src/test/ui/sized-cycle-note.stderr b/src/test/ui/sized-cycle-note.stderr index 96657152038..95bdc349426 100644 --- a/src/test/ui/sized-cycle-note.stderr +++ b/src/test/ui/sized-cycle-note.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `Baz` has infinite size - --> $DIR/sized-cycle-note.rs:19:1 + --> $DIR/sized-cycle-note.rs:9:1 | LL | struct Baz { q: Option } | ^^^^^^^^^^ -------------- recursive without indirection @@ -9,7 +9,7 @@ LL | struct Baz { q: Option } = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Baz` representable error[E0072]: recursive type `Foo` has infinite size - --> $DIR/sized-cycle-note.rs:21:1 + --> $DIR/sized-cycle-note.rs:11:1 | LL | struct Foo { q: Option } | ^^^^^^^^^^ -------------- recursive without indirection diff --git a/src/test/ui/slice-2.rs b/src/test/ui/slice-2.rs index 44b9d94c566..5423e295a87 100644 --- a/src/test/ui/slice-2.rs +++ b/src/test/ui/slice-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that slicing syntax gives errors if we have not implemented the trait. struct Foo; diff --git a/src/test/ui/slice-2.stderr b/src/test/ui/slice-2.stderr index e0f34daf513..ef0eeb7a8da 100644 --- a/src/test/ui/slice-2.stderr +++ b/src/test/ui/slice-2.stderr @@ -1,23 +1,23 @@ error[E0608]: cannot index into a value of type `Foo` - --> $DIR/slice-2.rs:17:6 + --> $DIR/slice-2.rs:7:6 | LL | &x[..]; //~ ERROR cannot index into a value of type `Foo` | ^^^^^ error[E0608]: cannot index into a value of type `Foo` - --> $DIR/slice-2.rs:18:6 + --> $DIR/slice-2.rs:8:6 | LL | &x[Foo..]; //~ ERROR cannot index into a value of type `Foo` | ^^^^^^^^ error[E0608]: cannot index into a value of type `Foo` - --> $DIR/slice-2.rs:19:6 + --> $DIR/slice-2.rs:9:6 | LL | &x[..Foo]; //~ ERROR cannot index into a value of type `Foo` | ^^^^^^^^ error[E0608]: cannot index into a value of type `Foo` - --> $DIR/slice-2.rs:20:6 + --> $DIR/slice-2.rs:10:6 | LL | &x[Foo..Foo]; //~ ERROR cannot index into a value of type `Foo` | ^^^^^^^^^^^ diff --git a/src/test/ui/slice-mut-2.nll.stderr b/src/test/ui/slice-mut-2.nll.stderr index 98d9297e112..eeef23e694b 100644 --- a/src/test/ui/slice-mut-2.nll.stderr +++ b/src/test/ui/slice-mut-2.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/slice-mut-2.rs:17:18 + --> $DIR/slice-mut-2.rs:7:18 | LL | let x: &[isize] = &[1, 2, 3, 4, 5]; | ---------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4, 5]` diff --git a/src/test/ui/slice-mut-2.rs b/src/test/ui/slice-mut-2.rs index e20e968a012..9586103f5f1 100644 --- a/src/test/ui/slice-mut-2.rs +++ b/src/test/ui/slice-mut-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test mutability and slicing syntax. fn main() { diff --git a/src/test/ui/slice-mut-2.stderr b/src/test/ui/slice-mut-2.stderr index 4483c6f1a8a..07a8bd7699e 100644 --- a/src/test/ui/slice-mut-2.stderr +++ b/src/test/ui/slice-mut-2.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable - --> $DIR/slice-mut-2.rs:17:18 + --> $DIR/slice-mut-2.rs:7:18 | LL | let _ = &mut x[2..4]; //~ERROR cannot borrow immutable borrowed content `*x` as mutable | ^ cannot borrow as mutable diff --git a/src/test/ui/slice-mut.rs b/src/test/ui/slice-mut.rs index bee3704a353..dc5ef58eb33 100644 --- a/src/test/ui/slice-mut.rs +++ b/src/test/ui/slice-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test mutability and slicing syntax. fn main() { diff --git a/src/test/ui/slice-mut.stderr b/src/test/ui/slice-mut.stderr index 59b70959d86..e99d83d0fed 100644 --- a/src/test/ui/slice-mut.stderr +++ b/src/test/ui/slice-mut.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/slice-mut.rs:17:22 + --> $DIR/slice-mut.rs:7:22 | LL | let y: &mut[_] = &x[2..4]; | ^^^^^^^^ types differ in mutability diff --git a/src/test/ui/slightly-nice-generic-literal-messages.rs b/src/test/ui/slightly-nice-generic-literal-messages.rs index 2eba7c2e534..cd0ee174af5 100644 --- a/src/test/ui/slightly-nice-generic-literal-messages.rs +++ b/src/test/ui/slightly-nice-generic-literal-messages.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker; struct Foo(T, marker::PhantomData); @@ -18,7 +8,7 @@ fn main() { //~^ ERROR mismatched types //~| expected type `Foo<{float}, _>` //~| found type `{integer}` - //~| expected struct `Foo`, found integral variable + //~| expected struct `Foo`, found integer } } diff --git a/src/test/ui/slightly-nice-generic-literal-messages.stderr b/src/test/ui/slightly-nice-generic-literal-messages.stderr index 463eb98b4ee..76ebc007df3 100644 --- a/src/test/ui/slightly-nice-generic-literal-messages.stderr +++ b/src/test/ui/slightly-nice-generic-literal-messages.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types - --> $DIR/slightly-nice-generic-literal-messages.rs:17:9 + --> $DIR/slightly-nice-generic-literal-messages.rs:7:9 | LL | 1 => {} - | ^ expected struct `Foo`, found integral variable + | ^ expected struct `Foo`, found integer | = note: expected type `Foo<{float}, _>` found type `{integer}` diff --git a/src/test/ui/span/E0046.rs b/src/test/ui/span/E0046.rs index 53813a4f586..96110989268 100644 --- a/src/test/ui/span/E0046.rs +++ b/src/test/ui/span/E0046.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn foo(); } diff --git a/src/test/ui/span/E0046.stderr b/src/test/ui/span/E0046.stderr index 035e2e08720..1323524f208 100644 --- a/src/test/ui/span/E0046.stderr +++ b/src/test/ui/span/E0046.stderr @@ -1,5 +1,5 @@ error[E0046]: not all trait items implemented, missing: `foo` - --> $DIR/E0046.rs:17:1 + --> $DIR/E0046.rs:7:1 | LL | fn foo(); | --------- `foo` from trait diff --git a/src/test/ui/span/E0057.rs b/src/test/ui/span/E0057.rs index 1fb5498b099..83f941f65b9 100644 --- a/src/test/ui/span/E0057.rs +++ b/src/test/ui/span/E0057.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let f = |x| x * 3; let a = f(); //~ ERROR E0057 diff --git a/src/test/ui/span/E0057.stderr b/src/test/ui/span/E0057.stderr index fb3e710b8cf..5906a05c32c 100644 --- a/src/test/ui/span/E0057.stderr +++ b/src/test/ui/span/E0057.stderr @@ -1,11 +1,11 @@ error[E0057]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/E0057.rs:13:13 + --> $DIR/E0057.rs:3:13 | LL | let a = f(); //~ ERROR E0057 | ^^^ expected 1 parameter error[E0057]: this function takes 1 parameter but 2 parameters were supplied - --> $DIR/E0057.rs:15:13 + --> $DIR/E0057.rs:5:13 | LL | let c = f(2, 3); //~ ERROR E0057 | ^^^^^^^ expected 1 parameter diff --git a/src/test/ui/span/E0072.rs b/src/test/ui/span/E0072.rs index 554dfc619d7..bc284cdcb47 100644 --- a/src/test/ui/span/E0072.rs +++ b/src/test/ui/span/E0072.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct ListNode { //~ ERROR has infinite size head: u8, tail: Option, diff --git a/src/test/ui/span/E0072.stderr b/src/test/ui/span/E0072.stderr index f8bf41fefa8..4cb9eb30802 100644 --- a/src/test/ui/span/E0072.stderr +++ b/src/test/ui/span/E0072.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `ListNode` has infinite size - --> $DIR/E0072.rs:11:1 + --> $DIR/E0072.rs:1:1 | LL | struct ListNode { //~ ERROR has infinite size | ^^^^^^^^^^^^^^^ recursive type has infinite size diff --git a/src/test/ui/span/E0204.rs b/src/test/ui/span/E0204.rs index 0ad6b67330d..174de8cdd63 100644 --- a/src/test/ui/span/E0204.rs +++ b/src/test/ui/span/E0204.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { foo: Vec, } diff --git a/src/test/ui/span/E0204.stderr b/src/test/ui/span/E0204.stderr index 2949a22747b..acb7cd2a557 100644 --- a/src/test/ui/span/E0204.stderr +++ b/src/test/ui/span/E0204.stderr @@ -1,5 +1,5 @@ error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/E0204.rs:15:6 + --> $DIR/E0204.rs:5:6 | LL | foo: Vec, | ------------- this field does not implement `Copy` @@ -8,7 +8,7 @@ LL | impl Copy for Foo { } //~ ERROR may not be implemented for this type | ^^^^ error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/E0204.rs:17:10 + --> $DIR/E0204.rs:7:10 | LL | #[derive(Copy)] //~ ERROR may not be implemented for this type | ^^^^ @@ -17,7 +17,7 @@ LL | ty: &'a mut bool, | ---------------- this field does not implement `Copy` error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/E0204.rs:27:6 + --> $DIR/E0204.rs:17:6 | LL | Bar { x: Vec }, | ----------- this field does not implement `Copy` @@ -26,7 +26,7 @@ LL | impl Copy for EFoo { } //~ ERROR may not be implemented for this type | ^^^^ error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/E0204.rs:29:10 + --> $DIR/E0204.rs:19:10 | LL | #[derive(Copy)] //~ ERROR may not be implemented for this type | ^^^^ diff --git a/src/test/ui/span/E0493.rs b/src/test/ui/span/E0493.rs index de81068e268..ad4100205f2 100644 --- a/src/test/ui/span/E0493.rs +++ b/src/test/ui/span/E0493.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { a: u32 } diff --git a/src/test/ui/span/E0493.stderr b/src/test/ui/span/E0493.stderr index 85d83de9d80..d05e89e257f 100644 --- a/src/test/ui/span/E0493.stderr +++ b/src/test/ui/span/E0493.stderr @@ -1,5 +1,5 @@ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/E0493.rs:27:17 + --> $DIR/E0493.rs:17:17 | LL | const F : Foo = (Foo { a : 0 }, Foo { a : 1 }).1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors diff --git a/src/test/ui/span/E0535.rs b/src/test/ui/span/E0535.rs index f9219436c78..e26334e9bbd 100644 --- a/src/test/ui/span/E0535.rs +++ b/src/test/ui/span/E0535.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[inline(unknown)] //~ ERROR E0535 pub fn something() {} diff --git a/src/test/ui/span/E0535.stderr b/src/test/ui/span/E0535.stderr index 2191aebbeb2..8502776eb16 100644 --- a/src/test/ui/span/E0535.stderr +++ b/src/test/ui/span/E0535.stderr @@ -1,5 +1,5 @@ error[E0535]: invalid argument - --> $DIR/E0535.rs:11:10 + --> $DIR/E0535.rs:1:10 | LL | #[inline(unknown)] //~ ERROR E0535 | ^^^^^^^ diff --git a/src/test/ui/span/E0536.rs b/src/test/ui/span/E0536.rs index 127bdc258d9..72de7b6f453 100644 --- a/src/test/ui/span/E0536.rs +++ b/src/test/ui/span/E0536.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[cfg(not())] //~ ERROR E0536 pub fn something() {} diff --git a/src/test/ui/span/E0536.stderr b/src/test/ui/span/E0536.stderr index 2b998356c20..18e2104f7ad 100644 --- a/src/test/ui/span/E0536.stderr +++ b/src/test/ui/span/E0536.stderr @@ -1,5 +1,5 @@ error[E0536]: expected 1 cfg-pattern - --> $DIR/E0536.rs:11:7 + --> $DIR/E0536.rs:1:7 | LL | #[cfg(not())] //~ ERROR E0536 | ^^^^^ diff --git a/src/test/ui/span/E0537.rs b/src/test/ui/span/E0537.rs index 497936fbcd2..4088a9ae53a 100644 --- a/src/test/ui/span/E0537.rs +++ b/src/test/ui/span/E0537.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[cfg(unknown())] //~ ERROR E0537 pub fn something() {} diff --git a/src/test/ui/span/E0537.stderr b/src/test/ui/span/E0537.stderr index 7257c73acb5..53e8637ea30 100644 --- a/src/test/ui/span/E0537.stderr +++ b/src/test/ui/span/E0537.stderr @@ -1,5 +1,5 @@ error[E0537]: invalid predicate `unknown` - --> $DIR/E0537.rs:11:7 + --> $DIR/E0537.rs:1:7 | LL | #[cfg(unknown())] //~ ERROR E0537 | ^^^^^^^^^ diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr index 389a1116c16..0aa44fa3a3a 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:63:24 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:53:24 | LL | fn deref_mut_field1(x: Own) { | - help: consider changing this to be mutable: `mut x` @@ -7,7 +7,7 @@ LL | let __isize = &mut x.y; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:75:10 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:65:10 | LL | fn deref_extend_mut_field1(x: &Own) -> &mut isize { | ----------- help: consider changing this to be a mutable reference: `&mut Own` @@ -15,7 +15,7 @@ LL | &mut x.y //~ ERROR cannot borrow | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:88:19 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:78:19 | LL | let _x = &mut x.x; | - first mutable borrow occurs here @@ -25,7 +25,7 @@ LL | use_mut(_x); | -- first borrow later used here error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:98:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:88:5 | LL | fn assign_field1<'a>(x: Own) { | - help: consider changing this to be mutable: `mut x` @@ -33,7 +33,7 @@ LL | x.y = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:102:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:92:5 | LL | fn assign_field2<'a>(x: &'a Own) { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` @@ -41,7 +41,7 @@ LL | x.y = 3; //~ ERROR cannot borrow | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:111:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:101:5 | LL | let _p: &mut Point = &mut **x; | -- first mutable borrow occurs here @@ -51,7 +51,7 @@ LL | use_mut(_p); | -- first borrow later used here error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:119:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:109:5 | LL | fn deref_mut_method1(x: Own) { | - help: consider changing this to be mutable: `mut x` @@ -59,7 +59,7 @@ LL | x.set(0, 0); //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:131:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:121:5 | LL | fn deref_extend_mut_method1(x: &Own) -> &mut isize { | ----------- help: consider changing this to be a mutable reference: `&mut Own` @@ -67,7 +67,7 @@ LL | x.y_mut() //~ ERROR cannot borrow | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:139:6 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:129:6 | LL | fn assign_method1<'a>(x: Own) { | - help: consider changing this to be mutable: `mut x` @@ -75,7 +75,7 @@ LL | *x.y_mut() = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:143:6 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:133:6 | LL | fn assign_method2<'a>(x: &'a Own) { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs index 48eb2e239f7..76a1d12ea94 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs +++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test how overloaded deref interacts with borrows when DerefMut // is implemented. diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr index 864357fee9f..e0524be6b0c 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable argument `x` as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:63:24 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:53:24 | LL | fn deref_mut_field1(x: Own) { | - help: make this binding mutable: `mut x` @@ -7,7 +7,7 @@ LL | let __isize = &mut x.y; //~ ERROR cannot borrow | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:75:10 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:65:10 | LL | fn deref_extend_mut_field1(x: &Own) -> &mut isize { | ----------- use `&mut Own` here to make mutable @@ -15,7 +15,7 @@ LL | &mut x.y //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:88:19 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:78:19 | LL | let _x = &mut x.x; | - first mutable borrow occurs here @@ -26,7 +26,7 @@ LL | } | - first borrow ends here error[E0596]: cannot borrow immutable argument `x` as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:98:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:88:5 | LL | fn assign_field1<'a>(x: Own) { | - help: make this binding mutable: `mut x` @@ -34,7 +34,7 @@ LL | x.y = 3; //~ ERROR cannot borrow | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:102:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:92:5 | LL | fn assign_field2<'a>(x: &'a Own) { | -------------- use `&'a mut Own` here to make mutable @@ -42,7 +42,7 @@ LL | x.y = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:111:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:101:5 | LL | let _p: &mut Point = &mut **x; | -- first mutable borrow occurs here @@ -53,7 +53,7 @@ LL | } | - first borrow ends here error[E0596]: cannot borrow immutable argument `x` as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:119:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:109:5 | LL | fn deref_mut_method1(x: Own) { | - help: make this binding mutable: `mut x` @@ -61,7 +61,7 @@ LL | x.set(0, 0); //~ ERROR cannot borrow | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:131:5 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:121:5 | LL | fn deref_extend_mut_method1(x: &Own) -> &mut isize { | ----------- use `&mut Own` here to make mutable @@ -69,7 +69,7 @@ LL | x.y_mut() //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable argument `x` as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:139:6 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:129:6 | LL | fn assign_method1<'a>(x: Own) { | - help: make this binding mutable: `mut x` @@ -77,7 +77,7 @@ LL | *x.y_mut() = 3; //~ ERROR cannot borrow | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable - --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:143:6 + --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:133:6 | LL | fn assign_method2<'a>(x: &'a Own) { | -------------- use `&'a mut Own` here to make mutable diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr index 44a5062cb4d..ef80e4bc3d6 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:39:25 + --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:29:25 | LL | fn deref_mut1(x: Own) { | - help: consider changing this to be mutable: `mut x` @@ -7,7 +7,7 @@ LL | let __isize = &mut *x; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:51:11 + --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:41:11 | LL | fn deref_extend_mut1<'a>(x: &'a Own) -> &'a mut isize { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` @@ -15,7 +15,7 @@ LL | &mut **x //~ ERROR cannot borrow | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:59:6 + --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:49:6 | LL | fn assign1<'a>(x: Own) { | - help: consider changing this to be mutable: `mut x` @@ -23,7 +23,7 @@ LL | *x = 3; //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:63:6 + --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:53:6 | LL | fn assign2<'a>(x: &'a Own) { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.rs b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.rs index 34b926aab1f..8d43d5da430 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.rs +++ b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test how overloaded deref interacts with borrows when DerefMut // is implemented. diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr index 62be8e0f73e..46d11065a86 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable argument `x` as mutable - --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:39:25 + --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:29:25 | LL | fn deref_mut1(x: Own) { | - help: make this binding mutable: `mut x` @@ -7,7 +7,7 @@ LL | let __isize = &mut *x; //~ ERROR cannot borrow | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable - --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:51:11 + --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:41:11 | LL | fn deref_extend_mut1<'a>(x: &'a Own) -> &'a mut isize { | -------------- use `&'a mut Own` here to make mutable @@ -15,7 +15,7 @@ LL | &mut **x //~ ERROR cannot borrow | ^^ cannot borrow as mutable error[E0596]: cannot borrow immutable argument `x` as mutable - --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:59:6 + --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:49:6 | LL | fn assign1<'a>(x: Own) { | - help: make this binding mutable: `mut x` @@ -23,7 +23,7 @@ LL | *x = 3; //~ ERROR cannot borrow | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable - --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:63:6 + --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:53:6 | LL | fn assign2<'a>(x: &'a Own) { | -------------- use `&'a mut Own` here to make mutable diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr index 978ca66a089..e752a467edc 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `f` as mutable more than once at a time - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:22:16 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:12:16 | LL | f(Box::new(|| { | - ^^ second mutable borrow occurs here @@ -11,7 +11,7 @@ LL | f((Box::new(|| {}))) | - second borrow occurs due to use of `f` in closure error[E0596]: cannot borrow `*f` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:35:5 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:25:5 | LL | fn test2(f: &F) where F: FnMut() { | -- help: consider changing this to be a mutable reference: `&mut F` @@ -19,7 +19,7 @@ LL | (*f)(); | ^^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*f.f` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:44:5 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:34:5 | LL | fn test4(f: &Test) { | ----- help: consider changing this to be a mutable reference: `&mut Test<'_>` @@ -27,7 +27,7 @@ LL | f.f.call_mut(()) | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:56:13 | LL | let mut f = move |g: Box, b: isize| { | ----- captured outer variable @@ -36,7 +36,7 @@ LL | foo(f); | ^ cannot move out of captured variable in an `FnMut` closure error[E0505]: cannot move out of `f` because it is borrowed - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:65:16 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16 | LL | f(Box::new(|a| { | - ^^^ move out of `f` occurs here diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs index e8227971691..cfebd6f7003 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(fn_traits)] // Ensure that invoking a closure counts as a unique immutable borrow diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr index 2e7e1e07441..d81d402fce7 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `f` as mutable more than once at a time - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:22:16 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:12:16 | LL | f(Box::new(|| { | - ^^ second mutable borrow occurs here @@ -12,7 +12,7 @@ LL | })); | - first borrow ends here error[E0596]: cannot borrow immutable borrowed content `*f` as mutable - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:35:5 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:25:5 | LL | fn test2(f: &F) where F: FnMut() { | -- use `&mut F` here to make mutable @@ -20,7 +20,7 @@ LL | (*f)(); | ^^^^ cannot borrow as mutable error[E0596]: cannot borrow `Box` content `*f.f` of immutable binding as mutable - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:44:5 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:34:5 | LL | fn test4(f: &Test) { | ----- use `&mut Test` here to make mutable @@ -28,7 +28,7 @@ LL | f.f.call_mut(()) | ^^^ cannot borrow as mutable error[E0504]: cannot move `f` into closure because it is borrowed - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:56:13 | LL | f(Box::new(|a| { | - borrow of `f` occurs here @@ -36,7 +36,7 @@ LL | foo(f); | ^ move into closure occurs here error[E0507]: cannot move out of captured outer variable in an `FnMut` closure - --> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13 + --> $DIR/borrowck-call-is-borrow-issue-12224.rs:56:13 | LL | let mut f = move |g: Box, b: isize| { | ----- captured outer variable diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr index e9c0505af68..16c482b575a 100644 --- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr +++ b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-call-method-from-mut-aliasable.rs:27:5 + --> $DIR/borrowck-call-method-from-mut-aliasable.rs:17:5 | LL | fn b(x: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut Foo` diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.rs b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.rs index bc0b667e895..caf2d2a55fc 100644 --- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.rs +++ b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: isize, } diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr index a18d3c55394..4875e27ef45 100644 --- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr +++ b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable - --> $DIR/borrowck-call-method-from-mut-aliasable.rs:27:5 + --> $DIR/borrowck-call-method-from-mut-aliasable.rs:17:5 | LL | fn b(x: &Foo) { | ---- use `&mut Foo` here to make mutable diff --git a/src/test/ui/span/borrowck-fn-in-const-b.nll.stderr b/src/test/ui/span/borrowck-fn-in-const-b.nll.stderr index 5e47d3271d4..9133d482c29 100644 --- a/src/test/ui/span/borrowck-fn-in-const-b.nll.stderr +++ b/src/test/ui/span/borrowck-fn-in-const-b.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-fn-in-const-b.rs:17:9 + --> $DIR/borrowck-fn-in-const-b.rs:7:9 | LL | fn broken(x: &Vec) { | ------------ help: consider changing this to be a mutable reference: `&mut std::vec::Vec` diff --git a/src/test/ui/span/borrowck-fn-in-const-b.rs b/src/test/ui/span/borrowck-fn-in-const-b.rs index 7e29b2ee0fd..822083efee0 100644 --- a/src/test/ui/span/borrowck-fn-in-const-b.rs +++ b/src/test/ui/span/borrowck-fn-in-const-b.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we check fns appearing in constant declarations. // Issue #22382. diff --git a/src/test/ui/span/borrowck-fn-in-const-b.stderr b/src/test/ui/span/borrowck-fn-in-const-b.stderr index 4b6c62e6ec8..4a30bdf3b08 100644 --- a/src/test/ui/span/borrowck-fn-in-const-b.stderr +++ b/src/test/ui/span/borrowck-fn-in-const-b.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable - --> $DIR/borrowck-fn-in-const-b.rs:17:9 + --> $DIR/borrowck-fn-in-const-b.rs:7:9 | LL | fn broken(x: &Vec) { | ------------ use `&mut Vec` here to make mutable diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr b/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr index 873871107ee..f5f11932648 100644 --- a/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr +++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-let-suggestion-suffixes.rs:28:14 + --> $DIR/borrowck-let-suggestion-suffixes.rs:19:14 | LL | v3.push(&id('x')); // statement 6 | ^^^^^^^ - temporary value is freed at the end of this statement @@ -12,7 +12,7 @@ LL | (v1, v2, v3, /* v4 is above. */ v5).use_ref(); = note: consider using a `let` binding to create a longer lived value error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-let-suggestion-suffixes.rs:38:18 + --> $DIR/borrowck-let-suggestion-suffixes.rs:29:18 | LL | v4.push(&id('y')); | ^^^^^^^ - temporary value is freed at the end of this statement @@ -25,7 +25,7 @@ LL | v4.use_ref(); = note: consider using a `let` binding to create a longer lived value error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-let-suggestion-suffixes.rs:49:14 + --> $DIR/borrowck-let-suggestion-suffixes.rs:40:14 | LL | v5.push(&id('z')); | ^^^^^^^ - temporary value is freed at the end of this statement diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs index b19a0b4c2c2..4b14907cec0 100644 --- a/src/test/ui/span/borrowck-let-suggestion-suffixes.rs +++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.rs @@ -1,12 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(rustc_attrs)] fn id(x: T) -> T { x } diff --git a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr index dfcd082c0c2..8bf542e37ff 100644 --- a/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr +++ b/src/test/ui/span/borrowck-let-suggestion-suffixes.stderr @@ -1,5 +1,5 @@ error[E0597]: `young[..]` does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:21:14 + --> $DIR/borrowck-let-suggestion-suffixes.rs:12:14 | LL | v2.push(&young[0]); // statement 4 | ^^^^^^^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:28:14 + --> $DIR/borrowck-let-suggestion-suffixes.rs:19:14 | LL | v3.push(&id('x')); // statement 6 | ^^^^^^^ - temporary value dropped here while still borrowed @@ -23,7 +23,7 @@ LL | } = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:38:18 + --> $DIR/borrowck-let-suggestion-suffixes.rs:29:18 | LL | v4.push(&id('y')); | ^^^^^^^ - temporary value dropped here while still borrowed @@ -36,7 +36,7 @@ LL | } // (statement 7) = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-let-suggestion-suffixes.rs:49:14 + --> $DIR/borrowck-let-suggestion-suffixes.rs:40:14 | LL | v5.push(&id('z')); | ^^^^^^^ - temporary value dropped here while still borrowed diff --git a/src/test/ui/span/borrowck-object-mutability.nll.stderr b/src/test/ui/span/borrowck-object-mutability.nll.stderr index 3f0eb97c7af..1a5802e9811 100644 --- a/src/test/ui/span/borrowck-object-mutability.nll.stderr +++ b/src/test/ui/span/borrowck-object-mutability.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference - --> $DIR/borrowck-object-mutability.rs:19:5 + --> $DIR/borrowck-object-mutability.rs:8:5 | LL | fn borrowed_receiver(x: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut dyn Foo` @@ -8,7 +8,7 @@ LL | x.borrowed_mut(); //~ ERROR cannot borrow | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable - --> $DIR/borrowck-object-mutability.rs:29:5 + --> $DIR/borrowck-object-mutability.rs:18:5 | LL | fn owned_receiver(x: Box) { | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/span/borrowck-object-mutability.rs b/src/test/ui/span/borrowck-object-mutability.rs index 1bdc32b0975..e672c464535 100644 --- a/src/test/ui/span/borrowck-object-mutability.rs +++ b/src/test/ui/span/borrowck-object-mutability.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Foo { fn borrowed(&self); fn borrowed_mut(&mut self); diff --git a/src/test/ui/span/borrowck-object-mutability.stderr b/src/test/ui/span/borrowck-object-mutability.stderr index 67ee911b381..e846331dc0b 100644 --- a/src/test/ui/span/borrowck-object-mutability.stderr +++ b/src/test/ui/span/borrowck-object-mutability.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable - --> $DIR/borrowck-object-mutability.rs:19:5 + --> $DIR/borrowck-object-mutability.rs:8:5 | LL | fn borrowed_receiver(x: &Foo) { | ---- use `&mut Foo` here to make mutable @@ -8,7 +8,7 @@ LL | x.borrowed_mut(); //~ ERROR cannot borrow | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable `Box` content `*x` as mutable - --> $DIR/borrowck-object-mutability.rs:29:5 + --> $DIR/borrowck-object-mutability.rs:18:5 | LL | fn owned_receiver(x: Box) { | - help: make this binding mutable: `mut x` diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr b/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr index 3dc64dabf90..4f529ce9511 100644 --- a/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr +++ b/src/test/ui/span/borrowck-ref-into-rvalue.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/borrowck-ref-into-rvalue.rs:13:11 + --> $DIR/borrowck-ref-into-rvalue.rs:3:11 | LL | match Some("Hello".to_string()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.rs b/src/test/ui/span/borrowck-ref-into-rvalue.rs index 7f07a09358a..aeaebf073a7 100644 --- a/src/test/ui/span/borrowck-ref-into-rvalue.rs +++ b/src/test/ui/span/borrowck-ref-into-rvalue.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let msg; match Some("Hello".to_string()) { diff --git a/src/test/ui/span/borrowck-ref-into-rvalue.stderr b/src/test/ui/span/borrowck-ref-into-rvalue.stderr index 5de3fc4ab0a..b8e79be8b61 100644 --- a/src/test/ui/span/borrowck-ref-into-rvalue.stderr +++ b/src/test/ui/span/borrowck-ref-into-rvalue.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/borrowck-ref-into-rvalue.rs:14:14 + --> $DIR/borrowck-ref-into-rvalue.rs:4:14 | LL | Some(ref m) => { | ^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/coerce-suggestions.rs b/src/test/ui/span/coerce-suggestions.rs index 48653ba0562..c461f825d99 100644 --- a/src/test/ui/span/coerce-suggestions.rs +++ b/src/test/ui/span/coerce-suggestions.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn test(_x: &mut String) {} diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr index 5153d809788..cda500c3f5d 100644 --- a/src/test/ui/span/coerce-suggestions.stderr +++ b/src/test/ui/span/coerce-suggestions.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:17:20 + --> $DIR/coerce-suggestions.rs:7:20 | LL | let x: usize = String::new(); | ^^^^^^^^^^^^^ expected usize, found struct `std::string::String` @@ -8,7 +8,7 @@ LL | let x: usize = String::new(); found type `std::string::String` error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:19:19 + --> $DIR/coerce-suggestions.rs:9:19 | LL | let x: &str = String::new(); | ^^^^^^^^^^^^^ @@ -20,7 +20,7 @@ LL | let x: &str = String::new(); found type `std::string::String` error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:22:10 + --> $DIR/coerce-suggestions.rs:12:10 | LL | test(&y); | ^^ types differ in mutability @@ -29,7 +29,7 @@ LL | test(&y); found type `&std::string::String` error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:24:11 + --> $DIR/coerce-suggestions.rs:14:11 | LL | test2(&y); | ^^ types differ in mutability @@ -38,7 +38,7 @@ LL | test2(&y); found type `&std::string::String` error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:27:9 + --> $DIR/coerce-suggestions.rs:17:9 | LL | f = box f; | ^^^^^ @@ -47,7 +47,7 @@ LL | f = box f; | help: try using a conversion method: `box f.to_string()` error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:31:9 + --> $DIR/coerce-suggestions.rs:21:9 | LL | s = format!("foo"); | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/span/destructor-restrictions.nll.stderr b/src/test/ui/span/destructor-restrictions.nll.stderr index 99a839f76d3..981c5a23816 100644 --- a/src/test/ui/span/destructor-restrictions.nll.stderr +++ b/src/test/ui/span/destructor-restrictions.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `*a` does not live long enough - --> $DIR/destructor-restrictions.rs:18:10 + --> $DIR/destructor-restrictions.rs:8:10 | LL | *a.borrow() + 1 | ^--------- diff --git a/src/test/ui/span/destructor-restrictions.rs b/src/test/ui/span/destructor-restrictions.rs index d20194422f7..7fb348a14bf 100644 --- a/src/test/ui/span/destructor-restrictions.rs +++ b/src/test/ui/span/destructor-restrictions.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests the new destructor semantics. use std::cell::RefCell; diff --git a/src/test/ui/span/destructor-restrictions.stderr b/src/test/ui/span/destructor-restrictions.stderr index 0ca77a91f2d..8fec8774678 100644 --- a/src/test/ui/span/destructor-restrictions.stderr +++ b/src/test/ui/span/destructor-restrictions.stderr @@ -1,5 +1,5 @@ error[E0597]: `*a` does not live long enough - --> $DIR/destructor-restrictions.rs:18:10 + --> $DIR/destructor-restrictions.rs:8:10 | LL | *a.borrow() + 1 | ^ borrowed value does not live long enough diff --git a/src/test/ui/span/dropck-object-cycle.nll.stderr b/src/test/ui/span/dropck-object-cycle.nll.stderr index 52d4007f3f8..cfaf470212f 100644 --- a/src/test/ui/span/dropck-object-cycle.nll.stderr +++ b/src/test/ui/span/dropck-object-cycle.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `*m` does not live long enough - --> $DIR/dropck-object-cycle.rs:37:31 + --> $DIR/dropck-object-cycle.rs:27:31 | LL | assert_eq!(object_invoke1(&*m), (4,5)); | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/dropck-object-cycle.rs b/src/test/ui/span/dropck-object-cycle.rs index b2871342e88..7b7f37d53f1 100644 --- a/src/test/ui/span/dropck-object-cycle.rs +++ b/src/test/ui/span/dropck-object-cycle.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test used to be part of a run-pass test, but revised outlives // rule means that it no longer compiles. diff --git a/src/test/ui/span/dropck-object-cycle.stderr b/src/test/ui/span/dropck-object-cycle.stderr index 7b3855917c9..3fc52853d02 100644 --- a/src/test/ui/span/dropck-object-cycle.stderr +++ b/src/test/ui/span/dropck-object-cycle.stderr @@ -1,5 +1,5 @@ error[E0597]: `*m` does not live long enough - --> $DIR/dropck-object-cycle.rs:37:32 + --> $DIR/dropck-object-cycle.rs:27:32 | LL | assert_eq!(object_invoke1(&*m), (4,5)); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/dropck_arr_cycle_checked.nll.stderr b/src/test/ui/span/dropck_arr_cycle_checked.nll.stderr index 32abfd81f53..e9caae64beb 100644 --- a/src/test/ui/span/dropck_arr_cycle_checked.nll.stderr +++ b/src/test/ui/span/dropck_arr_cycle_checked.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `b2` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:103:24 + --> $DIR/dropck_arr_cycle_checked.rs:93:24 | LL | b1.a[0].v.set(Some(&b2)); | ^^^ borrowed value does not live long enough @@ -13,7 +13,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are defined error[E0597]: `b3` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:105:24 + --> $DIR/dropck_arr_cycle_checked.rs:95:24 | LL | b1.a[1].v.set(Some(&b3)); | ^^^ borrowed value does not live long enough @@ -27,7 +27,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are defined error[E0597]: `b1` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:111:24 + --> $DIR/dropck_arr_cycle_checked.rs:101:24 | LL | b3.a[0].v.set(Some(&b1)); | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/dropck_arr_cycle_checked.rs b/src/test/ui/span/dropck_arr_cycle_checked.rs index 6bf2ae978a0..35145014a5a 100644 --- a/src/test/ui/span/dropck_arr_cycle_checked.rs +++ b/src/test/ui/span/dropck_arr_cycle_checked.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Reject mixing cyclic structure and Drop when using fixed length // arrays. // diff --git a/src/test/ui/span/dropck_arr_cycle_checked.stderr b/src/test/ui/span/dropck_arr_cycle_checked.stderr index 44803b28154..aae71799e30 100644 --- a/src/test/ui/span/dropck_arr_cycle_checked.stderr +++ b/src/test/ui/span/dropck_arr_cycle_checked.stderr @@ -1,5 +1,5 @@ error[E0597]: `b2` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:103:25 + --> $DIR/dropck_arr_cycle_checked.rs:93:25 | LL | b1.a[0].v.set(Some(&b2)); | ^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `b3` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:105:25 + --> $DIR/dropck_arr_cycle_checked.rs:95:25 | LL | b1.a[1].v.set(Some(&b3)); | ^^ borrowed value does not live long enough @@ -21,7 +21,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `b2` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:107:25 + --> $DIR/dropck_arr_cycle_checked.rs:97:25 | LL | b2.a[0].v.set(Some(&b2)); | ^^ borrowed value does not live long enough @@ -32,7 +32,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `b3` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:109:25 + --> $DIR/dropck_arr_cycle_checked.rs:99:25 | LL | b2.a[1].v.set(Some(&b3)); | ^^ borrowed value does not live long enough @@ -43,7 +43,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `b1` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:111:25 + --> $DIR/dropck_arr_cycle_checked.rs:101:25 | LL | b3.a[0].v.set(Some(&b1)); | ^^ borrowed value does not live long enough @@ -54,7 +54,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `b2` does not live long enough - --> $DIR/dropck_arr_cycle_checked.rs:113:25 + --> $DIR/dropck_arr_cycle_checked.rs:103:25 | LL | b3.a[1].v.set(Some(&b2)); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr b/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr index 0c5c49c80de..5774ac13cb7 100644 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr +++ b/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `d2` does not live long enough - --> $DIR/dropck_direct_cycle_with_drop.rs:46:19 + --> $DIR/dropck_direct_cycle_with_drop.rs:36:19 | LL | d1.p.set(Some(&d2)); | ^^^ borrowed value does not live long enough @@ -13,7 +13,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are defined error[E0597]: `d1` does not live long enough - --> $DIR/dropck_direct_cycle_with_drop.rs:48:19 + --> $DIR/dropck_direct_cycle_with_drop.rs:38:19 | LL | d2.p.set(Some(&d1)); | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.rs b/src/test/ui/span/dropck_direct_cycle_with_drop.rs index 0c6ebd5c8d8..14d6e665474 100644 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.rs +++ b/src/test/ui/span/dropck_direct_cycle_with_drop.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A simple example of an unsound mixing of cyclic structure and Drop. // // Each `D` has a name and an optional reference to another `D` diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.stderr b/src/test/ui/span/dropck_direct_cycle_with_drop.stderr index d20421c327f..bc4b517c51d 100644 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.stderr +++ b/src/test/ui/span/dropck_direct_cycle_with_drop.stderr @@ -1,5 +1,5 @@ error[E0597]: `d2` does not live long enough - --> $DIR/dropck_direct_cycle_with_drop.rs:46:20 + --> $DIR/dropck_direct_cycle_with_drop.rs:36:20 | LL | d1.p.set(Some(&d2)); | ^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `d1` does not live long enough - --> $DIR/dropck_direct_cycle_with_drop.rs:48:20 + --> $DIR/dropck_direct_cycle_with_drop.rs:38:20 | LL | d2.p.set(Some(&d1)); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/dropck_misc_variants.nll.stderr b/src/test/ui/span/dropck_misc_variants.nll.stderr index fb68262b0ae..76e90574cef 100644 --- a/src/test/ui/span/dropck_misc_variants.nll.stderr +++ b/src/test/ui/span/dropck_misc_variants.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `bomb` does not live long enough - --> $DIR/dropck_misc_variants.rs:33:36 + --> $DIR/dropck_misc_variants.rs:23:36 | LL | _w = Wrap::<&[&str]>(NoisyDrop(&bomb)); | ^^^^^ borrowed value does not live long enough @@ -12,7 +12,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are defined error[E0597]: `v` does not live long enough - --> $DIR/dropck_misc_variants.rs:41:27 + --> $DIR/dropck_misc_variants.rs:31:27 | LL | let u = NoisyDrop(&v); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/dropck_misc_variants.rs b/src/test/ui/span/dropck_misc_variants.rs index a98cce32e9d..5818a94bcb1 100644 --- a/src/test/ui/span/dropck_misc_variants.rs +++ b/src/test/ui/span/dropck_misc_variants.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that dropck does the right thing with misc. Ty variants use std::fmt; diff --git a/src/test/ui/span/dropck_misc_variants.stderr b/src/test/ui/span/dropck_misc_variants.stderr index af56448d406..b2de455cdc8 100644 --- a/src/test/ui/span/dropck_misc_variants.stderr +++ b/src/test/ui/span/dropck_misc_variants.stderr @@ -1,5 +1,5 @@ error[E0597]: `bomb` does not live long enough - --> $DIR/dropck_misc_variants.rs:33:37 + --> $DIR/dropck_misc_variants.rs:23:37 | LL | _w = Wrap::<&[&str]>(NoisyDrop(&bomb)); | ^^^^ borrowed value does not live long enough @@ -9,7 +9,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `v` does not live long enough - --> $DIR/dropck_misc_variants.rs:41:28 + --> $DIR/dropck_misc_variants.rs:31:28 | LL | let u = NoisyDrop(&v); | ^ borrowed value does not live long enough diff --git a/src/test/ui/span/dropck_vec_cycle_checked.nll.stderr b/src/test/ui/span/dropck_vec_cycle_checked.nll.stderr index ad62936b870..05692515af8 100644 --- a/src/test/ui/span/dropck_vec_cycle_checked.nll.stderr +++ b/src/test/ui/span/dropck_vec_cycle_checked.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `c2` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:113:24 + --> $DIR/dropck_vec_cycle_checked.rs:98:24 | LL | c1.v[0].v.set(Some(&c2)); | ^^^ borrowed value does not live long enough @@ -13,7 +13,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are defined error[E0597]: `c3` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:115:24 + --> $DIR/dropck_vec_cycle_checked.rs:100:24 | LL | c1.v[1].v.set(Some(&c3)); | ^^^ borrowed value does not live long enough @@ -27,7 +27,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are defined error[E0597]: `c1` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:121:24 + --> $DIR/dropck_vec_cycle_checked.rs:106:24 | LL | c3.v[0].v.set(Some(&c1)); | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/dropck_vec_cycle_checked.rs b/src/test/ui/span/dropck_vec_cycle_checked.rs index ece58d21ba9..c80e0386e6a 100644 --- a/src/test/ui/span/dropck_vec_cycle_checked.rs +++ b/src/test/ui/span/dropck_vec_cycle_checked.rs @@ -1,22 +1,7 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z nll-subminimal-causes -// (Work around rust-lang/rust#49998 by opting into nll-subminimal-causes.) - // Reject mixing cyclic structure and Drop when using Vec. // // (Compare against compile-fail/dropck_arr_cycle_checked.rs) - - use std::cell::Cell; use id::Id; diff --git a/src/test/ui/span/dropck_vec_cycle_checked.stderr b/src/test/ui/span/dropck_vec_cycle_checked.stderr index a6bc8da6f7c..35e4314d0c6 100644 --- a/src/test/ui/span/dropck_vec_cycle_checked.stderr +++ b/src/test/ui/span/dropck_vec_cycle_checked.stderr @@ -1,5 +1,5 @@ error[E0597]: `c2` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:113:25 + --> $DIR/dropck_vec_cycle_checked.rs:98:25 | LL | c1.v[0].v.set(Some(&c2)); | ^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c3` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:115:25 + --> $DIR/dropck_vec_cycle_checked.rs:100:25 | LL | c1.v[1].v.set(Some(&c3)); | ^^ borrowed value does not live long enough @@ -21,7 +21,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c2` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:117:25 + --> $DIR/dropck_vec_cycle_checked.rs:102:25 | LL | c2.v[0].v.set(Some(&c2)); | ^^ borrowed value does not live long enough @@ -32,7 +32,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c3` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:119:25 + --> $DIR/dropck_vec_cycle_checked.rs:104:25 | LL | c2.v[1].v.set(Some(&c3)); | ^^ borrowed value does not live long enough @@ -43,7 +43,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c1` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:121:25 + --> $DIR/dropck_vec_cycle_checked.rs:106:25 | LL | c3.v[0].v.set(Some(&c1)); | ^^ borrowed value does not live long enough @@ -54,7 +54,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c2` does not live long enough - --> $DIR/dropck_vec_cycle_checked.rs:123:25 + --> $DIR/dropck_vec_cycle_checked.rs:108:25 | LL | c3.v[1].v.set(Some(&c2)); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/gated-features-attr-spans.rs b/src/test/ui/span/gated-features-attr-spans.rs index eff1f98eb71..69511ab8e1f 100644 --- a/src/test/ui/span/gated-features-attr-spans.rs +++ b/src/test/ui/span/gated-features-attr-spans.rs @@ -1,17 +1,7 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[repr(simd)] //~ ERROR are experimental -struct Weapon { - name: String, - damage: u32 +struct Coord { + x: u32, + y: u32, } fn main() {} diff --git a/src/test/ui/span/gated-features-attr-spans.stderr b/src/test/ui/span/gated-features-attr-spans.stderr index a99530529fc..9c4c12ba076 100644 --- a/src/test/ui/span/gated-features-attr-spans.stderr +++ b/src/test/ui/span/gated-features-attr-spans.stderr @@ -1,5 +1,5 @@ error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) - --> $DIR/gated-features-attr-spans.rs:11:1 + --> $DIR/gated-features-attr-spans.rs:1:1 | LL | #[repr(simd)] //~ ERROR are experimental | ^^^^^^^^^^^^^ diff --git a/src/test/ui/span/impl-wrong-item-for-trait.rs b/src/test/ui/span/impl-wrong-item-for-trait.rs index f86ee2b1377..672fe8dccf7 100644 --- a/src/test/ui/span/impl-wrong-item-for-trait.rs +++ b/src/test/ui/span/impl-wrong-item-for-trait.rs @@ -1,14 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use std::fmt::Debug; trait Foo { diff --git a/src/test/ui/span/impl-wrong-item-for-trait.stderr b/src/test/ui/span/impl-wrong-item-for-trait.stderr index 4f1ac3b9459..8e08d3690e6 100644 --- a/src/test/ui/span/impl-wrong-item-for-trait.stderr +++ b/src/test/ui/span/impl-wrong-item-for-trait.stderr @@ -1,11 +1,11 @@ error[E0437]: type `bar` is not a member of trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:41:5 + --> $DIR/impl-wrong-item-for-trait.rs:30:5 | LL | type bar = u64; | ^^^^^^^^^^^^^^^ not a member of trait `Foo` error[E0323]: item `bar` is an associated const, which doesn't match its trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:23:5 + --> $DIR/impl-wrong-item-for-trait.rs:12:5 | LL | fn bar(&self); | -------------- item in trait @@ -14,7 +14,7 @@ LL | const bar: u64 = 1; | ^^^^^^^^^^^^^^^^^^^ does not match trait error[E0046]: not all trait items implemented, missing: `bar` - --> $DIR/impl-wrong-item-for-trait.rs:21:1 + --> $DIR/impl-wrong-item-for-trait.rs:10:1 | LL | fn bar(&self); | -------------- `bar` from trait @@ -23,7 +23,7 @@ LL | impl Foo for FooConstForMethod { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation error[E0324]: item `MY_CONST` is an associated method, which doesn't match its trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:33:5 + --> $DIR/impl-wrong-item-for-trait.rs:22:5 | LL | const MY_CONST: u32; | -------------------- item in trait @@ -32,7 +32,7 @@ LL | fn MY_CONST() {} | ^^^^^^^^^^^^^^^^ does not match trait error[E0046]: not all trait items implemented, missing: `MY_CONST` - --> $DIR/impl-wrong-item-for-trait.rs:30:1 + --> $DIR/impl-wrong-item-for-trait.rs:19:1 | LL | const MY_CONST: u32; | -------------------- `MY_CONST` from trait @@ -41,7 +41,7 @@ LL | impl Foo for FooMethodForConst { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `MY_CONST` in implementation error[E0325]: item `bar` is an associated type, which doesn't match its trait `Foo` - --> $DIR/impl-wrong-item-for-trait.rs:41:5 + --> $DIR/impl-wrong-item-for-trait.rs:30:5 | LL | fn bar(&self); | -------------- item in trait @@ -50,7 +50,7 @@ LL | type bar = u64; | ^^^^^^^^^^^^^^^ does not match trait error[E0046]: not all trait items implemented, missing: `bar` - --> $DIR/impl-wrong-item-for-trait.rs:39:1 + --> $DIR/impl-wrong-item-for-trait.rs:28:1 | LL | fn bar(&self); | -------------- `bar` from trait @@ -59,7 +59,7 @@ LL | impl Foo for FooTypeForMethod { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation error[E0046]: not all trait items implemented, missing: `fmt` - --> $DIR/impl-wrong-item-for-trait.rs:47:1 + --> $DIR/impl-wrong-item-for-trait.rs:36:1 | LL | impl Debug for FooTypeForMethod { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation diff --git a/src/test/ui/span/import-ty-params.rs b/src/test/ui/span/import-ty-params.rs index 793ea68beba..850bbd857ff 100644 --- a/src/test/ui/span/import-ty-params.rs +++ b/src/test/ui/span/import-ty-params.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { pub mod b { pub mod c { diff --git a/src/test/ui/span/import-ty-params.stderr b/src/test/ui/span/import-ty-params.stderr index 7e2c2d382fd..cff71bf2e62 100644 --- a/src/test/ui/span/import-ty-params.stderr +++ b/src/test/ui/span/import-ty-params.stderr @@ -1,11 +1,11 @@ error: unexpected generic arguments in path - --> $DIR/import-ty-params.rs:24:15 + --> $DIR/import-ty-params.rs:14:15 | LL | import! { a::b::c::S } //~ ERROR unexpected generic arguments in path | ^^^^^^^^^^^^^^ error: unexpected generic arguments in path - --> $DIR/import-ty-params.rs:27:15 + --> $DIR/import-ty-params.rs:17:15 | LL | import! { a::b::c::S<> } //~ ERROR unexpected generic arguments in path | ^^^^^^^^^^^^ diff --git a/src/test/ui/span/issue-11925.nll.stderr b/src/test/ui/span/issue-11925.nll.stderr index 7f14956e90b..f5e329f6c39 100644 --- a/src/test/ui/span/issue-11925.nll.stderr +++ b/src/test/ui/span/issue-11925.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return reference to local data `x` - --> $DIR/issue-11925.rs:18:35 + --> $DIR/issue-11925.rs:8:35 | LL | let f = to_fn_once(move|| &x); //~ ERROR does not live long enough | ^^ returns a reference to data owned by the current function diff --git a/src/test/ui/span/issue-11925.rs b/src/test/ui/span/issue-11925.rs index fd5625f6892..276aaa1c293 100644 --- a/src/test/ui/span/issue-11925.rs +++ b/src/test/ui/span/issue-11925.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax, unboxed_closures)] fn to_fn_once>(f: F) -> F { f } diff --git a/src/test/ui/span/issue-11925.stderr b/src/test/ui/span/issue-11925.stderr index bd66a5bc392..46e2a41b3c3 100644 --- a/src/test/ui/span/issue-11925.stderr +++ b/src/test/ui/span/issue-11925.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/issue-11925.rs:18:36 + --> $DIR/issue-11925.rs:8:36 | LL | let f = to_fn_once(move|| &x); //~ ERROR does not live long enough | ^ diff --git a/src/test/ui/span/issue-15480.nll.stderr b/src/test/ui/span/issue-15480.nll.stderr index a93bf025d4b..23ee2256dd8 100644 --- a/src/test/ui/span/issue-15480.nll.stderr +++ b/src/test/ui/span/issue-15480.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/issue-15480.rs:15:10 + --> $DIR/issue-15480.rs:5:10 | LL | &id(3) | ^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/span/issue-15480.rs b/src/test/ui/span/issue-15480.rs index 2fbc63eb805..c1024234094 100644 --- a/src/test/ui/span/issue-15480.rs +++ b/src/test/ui/span/issue-15480.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn id(x: T) -> T { x } fn main() { diff --git a/src/test/ui/span/issue-15480.stderr b/src/test/ui/span/issue-15480.stderr index 1d239c712fe..c5e3899faca 100644 --- a/src/test/ui/span/issue-15480.stderr +++ b/src/test/ui/span/issue-15480.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/issue-15480.rs:15:10 + --> $DIR/issue-15480.rs:5:10 | LL | &id(3) | ^^^^^ temporary value does not live long enough diff --git a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.nll.stderr b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.nll.stderr index 9e82884b954..46969458145 100644 --- a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.nll.stderr +++ b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `y` does not live long enough - --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:20:5 + --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:10:5 | LL | y.borrow().clone() | ^--------- @@ -15,7 +15,7 @@ LL | } = note: The temporary is part of an expression at the end of a block. Consider forcing this temporary to be dropped sooner, before the block's local variables are dropped. For example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block. error[E0597]: `y` does not live long enough - --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:27:9 + --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:17:9 | LL | y.borrow().clone() | ^--------- diff --git a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs index 8f556d28819..a92ea4ddc96 100644 --- a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs +++ b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This is just checking that we still reject code where temp values // are borrowing values for longer than they will be around. // diff --git a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr index 6932134f4cd..f18f0da3199 100644 --- a/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr +++ b/src/test/ui/span/issue-23338-locals-die-before-temps-of-body.stderr @@ -1,5 +1,5 @@ error[E0597]: `y` does not live long enough - --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:20:5 + --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:10:5 | LL | y.borrow().clone() | ^ borrowed value does not live long enough @@ -9,7 +9,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `y` does not live long enough - --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:27:9 + --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:17:9 | LL | y.borrow().clone() | ^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-23729.rs b/src/test/ui/span/issue-23729.rs index e872fabfc26..ca33f9c7730 100644 --- a/src/test/ui/span/issue-23729.rs +++ b/src/test/ui/span/issue-23729.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #23729 fn main() { diff --git a/src/test/ui/span/issue-23729.stderr b/src/test/ui/span/issue-23729.stderr index 83a7671b8f9..865fae917c5 100644 --- a/src/test/ui/span/issue-23729.stderr +++ b/src/test/ui/span/issue-23729.stderr @@ -1,5 +1,5 @@ error[E0046]: not all trait items implemented, missing: `Item` - --> $DIR/issue-23729.rs:20:9 + --> $DIR/issue-23729.rs:10:9 | LL | impl Iterator for Recurrence { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Item` in implementation diff --git a/src/test/ui/span/issue-23827.rs b/src/test/ui/span/issue-23827.rs index 890f2623ebc..22b9dde8cbe 100644 --- a/src/test/ui/span/issue-23827.rs +++ b/src/test/ui/span/issue-23827.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #23827 #![feature(core, fn_traits, unboxed_closures)] diff --git a/src/test/ui/span/issue-23827.stderr b/src/test/ui/span/issue-23827.stderr index c8b55290aa0..a8e3e9b6b9a 100644 --- a/src/test/ui/span/issue-23827.stderr +++ b/src/test/ui/span/issue-23827.stderr @@ -1,5 +1,5 @@ error[E0046]: not all trait items implemented, missing: `Output` - --> $DIR/issue-23827.rs:36:1 + --> $DIR/issue-23827.rs:26:1 | LL | impl FnOnce<(C,)> for Prototype { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Output` in implementation diff --git a/src/test/ui/span/issue-24356.rs b/src/test/ui/span/issue-24356.rs index 0580370033a..7696bd54226 100644 --- a/src/test/ui/span/issue-24356.rs +++ b/src/test/ui/span/issue-24356.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #24356 // ignore-tidy-linelength diff --git a/src/test/ui/span/issue-24356.stderr b/src/test/ui/span/issue-24356.stderr index 7c599138ef3..102cc4201e2 100644 --- a/src/test/ui/span/issue-24356.stderr +++ b/src/test/ui/span/issue-24356.stderr @@ -1,5 +1,5 @@ error[E0046]: not all trait items implemented, missing: `Target` - --> $DIR/issue-24356.rs:30:9 + --> $DIR/issue-24356.rs:20:9 | LL | impl Deref for Thing { | ^^^^^^^^^^^^^^^^^^^^ missing `Target` in implementation diff --git a/src/test/ui/span/issue-24690.rs b/src/test/ui/span/issue-24690.rs index b19461b03a0..82899fc8965 100644 --- a/src/test/ui/span/issue-24690.rs +++ b/src/test/ui/span/issue-24690.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! A test to ensure that helpful `note` messages aren't emitted more often //! than necessary. diff --git a/src/test/ui/span/issue-24690.stderr b/src/test/ui/span/issue-24690.stderr index 723b7e2c0aa..964e323b83e 100644 --- a/src/test/ui/span/issue-24690.stderr +++ b/src/test/ui/span/issue-24690.stderr @@ -1,27 +1,27 @@ warning: unused variable: `theOtherTwo` - --> $DIR/issue-24690.rs:23:9 + --> $DIR/issue-24690.rs:13:9 | LL | let theOtherTwo = 2; //~ WARN should have a snake case name - | ^^^^^^^^^^^ help: consider using `_theOtherTwo` instead + | ^^^^^^^^^^^ help: consider prefixing with an underscore: `_theOtherTwo` | note: lint level defined here - --> $DIR/issue-24690.rs:18:9 + --> $DIR/issue-24690.rs:8:9 | LL | #![warn(unused)] | ^^^^^^ = note: #[warn(unused_variables)] implied by #[warn(unused)] -warning: variable `theTwo` should have a snake case name such as `the_two` - --> $DIR/issue-24690.rs:22:9 +warning: variable `theTwo` should have a snake case name + --> $DIR/issue-24690.rs:12:9 | LL | let theTwo = 2; //~ WARN should have a snake case name - | ^^^^^^ + | ^^^^^^ help: convert the identifier to snake case: `the_two` | = note: #[warn(non_snake_case)] on by default -warning: variable `theOtherTwo` should have a snake case name such as `the_other_two` - --> $DIR/issue-24690.rs:23:9 +warning: variable `theOtherTwo` should have a snake case name + --> $DIR/issue-24690.rs:13:9 | LL | let theOtherTwo = 2; //~ WARN should have a snake case name - | ^^^^^^^^^^^ + | ^^^^^^^^^^^ help: convert the identifier to snake case: `the_other_two` diff --git a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.nll.stderr b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.nll.stderr index fb995990f16..809e60a8c8a 100644 --- a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.nll.stderr +++ b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:38:18 + --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:28:18 | LL | _d = D_Child(&d1); | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs index 7b3c09659e1..9c772052fb4 100644 --- a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs +++ b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that child trait who only has items via its *parent* trait // does cause dropck to inject extra region constraints. diff --git a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr index 13a79035003..ad90fcd54d4 100644 --- a/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr +++ b/src/test/ui/span/issue-24805-dropck-child-has-items-via-parent.stderr @@ -1,5 +1,5 @@ error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:38:19 + --> $DIR/issue-24805-dropck-child-has-items-via-parent.rs:28:19 | LL | _d = D_Child(&d1); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-24805-dropck-trait-has-items.nll.stderr b/src/test/ui/span/issue-24805-dropck-trait-has-items.nll.stderr index 5eaff66e72e..2e217066915 100644 --- a/src/test/ui/span/issue-24805-dropck-trait-has-items.nll.stderr +++ b/src/test/ui/span/issue-24805-dropck-trait-has-items.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-trait-has-items.rs:47:26 + --> $DIR/issue-24805-dropck-trait-has-items.rs:37:26 | LL | _d = D_HasSelfMethod(&d1); | ^^^ borrowed value does not live long enough @@ -12,7 +12,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are defined error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-trait-has-items.rs:53:33 + --> $DIR/issue-24805-dropck-trait-has-items.rs:43:33 | LL | _d = D_HasMethodWithSelfArg(&d1); | ^^^ borrowed value does not live long enough @@ -25,7 +25,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are defined error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-trait-has-items.rs:59:20 + --> $DIR/issue-24805-dropck-trait-has-items.rs:49:20 | LL | _d = D_HasType(&d1); | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-24805-dropck-trait-has-items.rs b/src/test/ui/span/issue-24805-dropck-trait-has-items.rs index 75523386931..b5c410cd3c9 100644 --- a/src/test/ui/span/issue-24805-dropck-trait-has-items.rs +++ b/src/test/ui/span/issue-24805-dropck-trait-has-items.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that traits with various kinds of associated items cause // dropck to inject extra region constraints. @@ -25,7 +15,7 @@ impl<'a,T> HasSelfMethod for &'a T { } impl<'a,T> HasMethodWithSelfArg for &'a T { } impl<'a,T> HasType for &'a T { type Something = (); } -// e.g. `impl_drop!(Send, D_Send)` expands to: +// e.g., `impl_drop!(Send, D_Send)` expands to: // ```rust // struct D_Send(T); // impl Drop for D_Send { fn drop(&mut self) { } } diff --git a/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr b/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr index a2e25492c19..3de40149287 100644 --- a/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr +++ b/src/test/ui/span/issue-24805-dropck-trait-has-items.stderr @@ -1,5 +1,5 @@ error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-trait-has-items.rs:47:27 + --> $DIR/issue-24805-dropck-trait-has-items.rs:37:27 | LL | _d = D_HasSelfMethod(&d1); | ^^ borrowed value does not live long enough @@ -9,7 +9,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-trait-has-items.rs:53:34 + --> $DIR/issue-24805-dropck-trait-has-items.rs:43:34 | LL | _d = D_HasMethodWithSelfArg(&d1); | ^^ borrowed value does not live long enough @@ -19,7 +19,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `d1` does not live long enough - --> $DIR/issue-24805-dropck-trait-has-items.rs:59:21 + --> $DIR/issue-24805-dropck-trait-has-items.rs:49:21 | LL | _d = D_HasType(&d1); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-24895-copy-clone-dropck.nll.stderr b/src/test/ui/span/issue-24895-copy-clone-dropck.nll.stderr index 26c74b653a1..18a3dc9e6de 100644 --- a/src/test/ui/span/issue-24895-copy-clone-dropck.nll.stderr +++ b/src/test/ui/span/issue-24895-copy-clone-dropck.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `d1` does not live long enough - --> $DIR/issue-24895-copy-clone-dropck.rs:37:14 + --> $DIR/issue-24895-copy-clone-dropck.rs:27:14 | LL | d2 = D(S(&d1, "inner"), "d2"); | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-24895-copy-clone-dropck.rs b/src/test/ui/span/issue-24895-copy-clone-dropck.rs index 326e6b43e25..904cd8f678f 100644 --- a/src/test/ui/span/issue-24895-copy-clone-dropck.rs +++ b/src/test/ui/span/issue-24895-copy-clone-dropck.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that one cannot subvert Drop Check rule via a user-defined // Clone implementation. diff --git a/src/test/ui/span/issue-24895-copy-clone-dropck.stderr b/src/test/ui/span/issue-24895-copy-clone-dropck.stderr index 1f6c96d4a0c..91859194318 100644 --- a/src/test/ui/span/issue-24895-copy-clone-dropck.stderr +++ b/src/test/ui/span/issue-24895-copy-clone-dropck.stderr @@ -1,5 +1,5 @@ error[E0597]: `d1` does not live long enough - --> $DIR/issue-24895-copy-clone-dropck.rs:37:15 + --> $DIR/issue-24895-copy-clone-dropck.rs:27:15 | LL | d2 = D(S(&d1, "inner"), "d2"); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-25199.nll.stderr b/src/test/ui/span/issue-25199.nll.stderr index 9801f92ce64..d70a4afc1bf 100644 --- a/src/test/ui/span/issue-25199.nll.stderr +++ b/src/test/ui/span/issue-25199.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `container` does not live long enough - --> $DIR/issue-25199.rs:80:27 + --> $DIR/issue-25199.rs:70:27 | LL | let test = Test{test: &container}; | ^^^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-25199.rs b/src/test/ui/span/issue-25199.rs index 7b1f4005e63..4ef57457ca3 100644 --- a/src/test/ui/span/issue-25199.rs +++ b/src/test/ui/span/issue-25199.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for Issue 25199: Check that one cannot hide a // destructor's access to borrowed data behind a boxed trait object. // diff --git a/src/test/ui/span/issue-25199.stderr b/src/test/ui/span/issue-25199.stderr index bee83b532ba..135d8150c34 100644 --- a/src/test/ui/span/issue-25199.stderr +++ b/src/test/ui/span/issue-25199.stderr @@ -1,5 +1,5 @@ error[E0597]: `container` does not live long enough - --> $DIR/issue-25199.rs:80:28 + --> $DIR/issue-25199.rs:70:28 | LL | let test = Test{test: &container}; | ^^^^^^^^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `container` does not live long enough - --> $DIR/issue-25199.rs:83:5 + --> $DIR/issue-25199.rs:73:5 | LL | container.store(test); | ^^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-26656.nll.stderr b/src/test/ui/span/issue-26656.nll.stderr index 79d9dab1776..1e939c484fb 100644 --- a/src/test/ui/span/issue-26656.nll.stderr +++ b/src/test/ui/span/issue-26656.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `ticking` does not live long enough - --> $DIR/issue-26656.rs:50:35 + --> $DIR/issue-26656.rs:40:35 | LL | zook.button = B::BigRedButton(&ticking); | ^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-26656.rs b/src/test/ui/span/issue-26656.rs index 05f0ea5474f..c5a70c87ed8 100644 --- a/src/test/ui/span/issue-26656.rs +++ b/src/test/ui/span/issue-26656.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #26656: Verify that trait objects cannot bypass dropck. // Using this instead of Fn etc. to take HRTB out of the equation. diff --git a/src/test/ui/span/issue-26656.stderr b/src/test/ui/span/issue-26656.stderr index 98f0c90ed78..ba2befb90a9 100644 --- a/src/test/ui/span/issue-26656.stderr +++ b/src/test/ui/span/issue-26656.stderr @@ -1,5 +1,5 @@ error[E0597]: `ticking` does not live long enough - --> $DIR/issue-26656.rs:50:36 + --> $DIR/issue-26656.rs:40:36 | LL | zook.button = B::BigRedButton(&ticking); | ^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-27522.rs b/src/test/ui/span/issue-27522.rs index 1e3eba4bf36..5c9893f64a6 100644 --- a/src/test/ui/span/issue-27522.rs +++ b/src/test/ui/span/issue-27522.rs @@ -1,19 +1,9 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Point at correct span for self type struct SomeType {} trait Foo { - fn handler(self: &SomeType); //~ ERROR invalid `self` type + fn handler(self: &SomeType); //~ ERROR invalid method receiver type } fn main() {} diff --git a/src/test/ui/span/issue-27522.stderr b/src/test/ui/span/issue-27522.stderr index 9b61ecae651..1fcb839d170 100644 --- a/src/test/ui/span/issue-27522.stderr +++ b/src/test/ui/span/issue-27522.stderr @@ -1,7 +1,7 @@ -error[E0307]: invalid `self` type: &SomeType - --> $DIR/issue-27522.rs:16:22 +error[E0307]: invalid method receiver type: &SomeType + --> $DIR/issue-27522.rs:6:22 | -LL | fn handler(self: &SomeType); //~ ERROR invalid `self` type +LL | fn handler(self: &SomeType); //~ ERROR invalid method receiver type | ^^^^^^^^^ | = note: type must be `Self` or a type that dereferences to it diff --git a/src/test/ui/span/issue-29106.nll.stderr b/src/test/ui/span/issue-29106.nll.stderr index 77bb311c61a..3b403de12d5 100644 --- a/src/test/ui/span/issue-29106.nll.stderr +++ b/src/test/ui/span/issue-29106.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/issue-29106.rs:26:26 + --> $DIR/issue-29106.rs:16:26 | LL | y = Arc::new(Foo(&x)); | ^^ borrowed value does not live long enough @@ -12,7 +12,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are defined error[E0597]: `x` does not live long enough - --> $DIR/issue-29106.rs:33:25 + --> $DIR/issue-29106.rs:23:25 | LL | y = Rc::new(Foo(&x)); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-29106.rs b/src/test/ui/span/issue-29106.rs index 03a9a629c91..1be8d4cba69 100644 --- a/src/test/ui/span/issue-29106.rs +++ b/src/test/ui/span/issue-29106.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::rc::Rc; use std::sync::Arc; diff --git a/src/test/ui/span/issue-29106.stderr b/src/test/ui/span/issue-29106.stderr index 23e53c9852d..bb2f8462246 100644 --- a/src/test/ui/span/issue-29106.stderr +++ b/src/test/ui/span/issue-29106.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/issue-29106.rs:26:27 + --> $DIR/issue-29106.rs:16:27 | LL | y = Arc::new(Foo(&x)); | ^ borrowed value does not live long enough @@ -9,7 +9,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `x` does not live long enough - --> $DIR/issue-29106.rs:33:26 + --> $DIR/issue-29106.rs:23:26 | LL | y = Rc::new(Foo(&x)); | ^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-29595.rs b/src/test/ui/span/issue-29595.rs index ed7f2d1a92e..87d7c4cfdf9 100644 --- a/src/test/ui/span/issue-29595.rs +++ b/src/test/ui/span/issue-29595.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Tr { const C: Self; } diff --git a/src/test/ui/span/issue-29595.stderr b/src/test/ui/span/issue-29595.stderr index 15d56abca50..dbb1743ec0e 100644 --- a/src/test/ui/span/issue-29595.stderr +++ b/src/test/ui/span/issue-29595.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `u8: Tr` is not satisfied - --> $DIR/issue-29595.rs:17:17 + --> $DIR/issue-29595.rs:6:17 | LL | let a: u8 = Tr::C; //~ ERROR the trait bound `u8: Tr` is not satisfied | ^^^^^ the trait `Tr` is not implemented for `u8` | note: required by `Tr::C` - --> $DIR/issue-29595.rs:13:5 + --> $DIR/issue-29595.rs:2:5 | LL | const C: Self; | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/span/issue-33884.rs b/src/test/ui/span/issue-33884.rs index f7836a6790f..cef123d697b 100644 --- a/src/test/ui/span/issue-33884.rs +++ b/src/test/ui/span/issue-33884.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no std::net support use std::net::TcpListener; diff --git a/src/test/ui/span/issue-33884.stderr b/src/test/ui/span/issue-33884.stderr index c47d28b4562..e59440b363f 100644 --- a/src/test/ui/span/issue-33884.stderr +++ b/src/test/ui/span/issue-33884.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/issue-33884.rs:18:22 + --> $DIR/issue-33884.rs:8:22 | LL | stream.write_fmt(format!("message received")) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::fmt::Arguments`, found struct `std::string::String` diff --git a/src/test/ui/span/issue-34264.rs b/src/test/ui/span/issue-34264.rs index 8baa381fb2d..5b8fc71384e 100644 --- a/src/test/ui/span/issue-34264.rs +++ b/src/test/ui/span/issue-34264.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(Option, String) {} //~ ERROR expected one of //~^ ERROR expected one of fn bar(x, y: usize) {} //~ ERROR expected one of diff --git a/src/test/ui/span/issue-34264.stderr b/src/test/ui/span/issue-34264.stderr index bfa81a398a4..9b3b68f6ff4 100644 --- a/src/test/ui/span/issue-34264.stderr +++ b/src/test/ui/span/issue-34264.stderr @@ -1,23 +1,23 @@ error: expected one of `:` or `@`, found `<` - --> $DIR/issue-34264.rs:11:14 + --> $DIR/issue-34264.rs:1:14 | LL | fn foo(Option, String) {} //~ ERROR expected one of | ^ expected one of `:` or `@` here error: expected one of `:` or `@`, found `)` - --> $DIR/issue-34264.rs:11:27 + --> $DIR/issue-34264.rs:1:27 | LL | fn foo(Option, String) {} //~ ERROR expected one of | ^ expected one of `:` or `@` here error: expected one of `:` or `@`, found `,` - --> $DIR/issue-34264.rs:13:9 + --> $DIR/issue-34264.rs:3:9 | LL | fn bar(x, y: usize) {} //~ ERROR expected one of | ^ expected one of `:` or `@` here error[E0061]: this function takes 2 parameters but 3 parameters were supplied - --> $DIR/issue-34264.rs:17:5 + --> $DIR/issue-34264.rs:7:5 | LL | fn foo(Option, String) {} //~ ERROR expected one of | --------------------------- defined here @@ -26,7 +26,7 @@ LL | foo(Some(42), 2, ""); //~ ERROR this function takes | ^^^^^^^^^^^^^^^^^^^^ expected 2 parameters error[E0308]: mismatched types - --> $DIR/issue-34264.rs:18:13 + --> $DIR/issue-34264.rs:8:13 | LL | bar("", ""); //~ ERROR mismatched types | ^^ expected usize, found reference @@ -35,7 +35,7 @@ LL | bar("", ""); //~ ERROR mismatched types found type `&'static str` error[E0061]: this function takes 2 parameters but 3 parameters were supplied - --> $DIR/issue-34264.rs:20:5 + --> $DIR/issue-34264.rs:10:5 | LL | fn bar(x, y: usize) {} //~ ERROR expected one of | ------------------- defined here diff --git a/src/test/ui/span/issue-35987.rs b/src/test/ui/span/issue-35987.rs index 19e05f33825..3a6e6ffe249 100644 --- a/src/test/ui/span/issue-35987.rs +++ b/src/test/ui/span/issue-35987.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo(T); use std::ops::Add; diff --git a/src/test/ui/span/issue-35987.stderr b/src/test/ui/span/issue-35987.stderr index 1dd45bb1e5e..f73bf27110b 100644 --- a/src/test/ui/span/issue-35987.stderr +++ b/src/test/ui/span/issue-35987.stderr @@ -1,5 +1,5 @@ error[E0404]: expected trait, found type parameter `Add` - --> $DIR/issue-35987.rs:15:21 + --> $DIR/issue-35987.rs:5:21 | LL | impl Add for Foo { | ^^^ not a trait diff --git a/src/test/ui/span/issue-36530.rs b/src/test/ui/span/issue-36530.rs index fbe1535caae..e11be9e17f2 100644 --- a/src/test/ui/span/issue-36530.rs +++ b/src/test/ui/span/issue-36530.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // gate-test-custom_inner_attributes #[foo] //~ ERROR is currently unknown to the compiler @@ -15,3 +5,5 @@ mod foo { #![foo] //~ ERROR is currently unknown to the compiler //~| ERROR non-builtin inner attributes are unstable } + +fn main() {} diff --git a/src/test/ui/span/issue-36530.stderr b/src/test/ui/span/issue-36530.stderr index 98361c879ff..b2b494a2c9c 100644 --- a/src/test/ui/span/issue-36530.stderr +++ b/src/test/ui/span/issue-36530.stderr @@ -1,5 +1,5 @@ error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/issue-36530.rs:13:3 + --> $DIR/issue-36530.rs:3:3 | LL | #[foo] //~ ERROR is currently unknown to the compiler | ^^^ @@ -7,7 +7,7 @@ LL | #[foo] //~ ERROR is currently unknown to the compiler = help: add #![feature(custom_attribute)] to the crate attributes to enable error[E0658]: non-builtin inner attributes are unstable (see issue #54726) - --> $DIR/issue-36530.rs:15:5 + --> $DIR/issue-36530.rs:5:5 | LL | #![foo] //~ ERROR is currently unknown to the compiler | ^^^^^^^ @@ -15,7 +15,7 @@ LL | #![foo] //~ ERROR is currently unknown to the compiler = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/issue-36530.rs:15:8 + --> $DIR/issue-36530.rs:5:8 | LL | #![foo] //~ ERROR is currently unknown to the compiler | ^^^ diff --git a/src/test/ui/span/issue-36537.nll.stderr b/src/test/ui/span/issue-36537.nll.stderr index 0d13c9844b3..edb804e850e 100644 --- a/src/test/ui/span/issue-36537.nll.stderr +++ b/src/test/ui/span/issue-36537.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/issue-36537.rs:15:9 + --> $DIR/issue-36537.rs:5:9 | LL | p = &a; | ^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-36537.rs b/src/test/ui/span/issue-36537.rs index 6f1647c9ebb..a5546ccbb60 100644 --- a/src/test/ui/span/issue-36537.rs +++ b/src/test/ui/span/issue-36537.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let p; { diff --git a/src/test/ui/span/issue-36537.stderr b/src/test/ui/span/issue-36537.stderr index c090ae6318d..d3bcbb25add 100644 --- a/src/test/ui/span/issue-36537.stderr +++ b/src/test/ui/span/issue-36537.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/issue-36537.rs:15:14 + --> $DIR/issue-36537.rs:5:14 | LL | p = &a; | ^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue-37767.rs b/src/test/ui/span/issue-37767.rs index 2b0250d332d..9e34c2c1fac 100644 --- a/src/test/ui/span/issue-37767.rs +++ b/src/test/ui/span/issue-37767.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait A { fn foo(&mut self) {} } diff --git a/src/test/ui/span/issue-37767.stderr b/src/test/ui/span/issue-37767.stderr index 5477146a551..f91f2a50e85 100644 --- a/src/test/ui/span/issue-37767.stderr +++ b/src/test/ui/span/issue-37767.stderr @@ -1,55 +1,55 @@ error[E0034]: multiple applicable items in scope - --> $DIR/issue-37767.rs:20:7 + --> $DIR/issue-37767.rs:10:7 | LL | a.foo() //~ ERROR multiple applicable items | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `A` - --> $DIR/issue-37767.rs:12:5 + --> $DIR/issue-37767.rs:2:5 | LL | fn foo(&mut self) {} | ^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `A::foo(&a)` instead note: candidate #2 is defined in the trait `B` - --> $DIR/issue-37767.rs:16:5 + --> $DIR/issue-37767.rs:6:5 | LL | fn foo(&mut self) {} | ^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `B::foo(&a)` instead error[E0034]: multiple applicable items in scope - --> $DIR/issue-37767.rs:32:7 + --> $DIR/issue-37767.rs:22:7 | LL | a.foo() //~ ERROR multiple applicable items | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `C` - --> $DIR/issue-37767.rs:24:5 + --> $DIR/issue-37767.rs:14:5 | LL | fn foo(&self) {} | ^^^^^^^^^^^^^ = help: to disambiguate the method call, write `C::foo(&a)` instead note: candidate #2 is defined in the trait `D` - --> $DIR/issue-37767.rs:28:5 + --> $DIR/issue-37767.rs:18:5 | LL | fn foo(&self) {} | ^^^^^^^^^^^^^ = help: to disambiguate the method call, write `D::foo(&a)` instead error[E0034]: multiple applicable items in scope - --> $DIR/issue-37767.rs:44:7 + --> $DIR/issue-37767.rs:34:7 | LL | a.foo() //~ ERROR multiple applicable items | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `E` - --> $DIR/issue-37767.rs:36:5 + --> $DIR/issue-37767.rs:26:5 | LL | fn foo(self) {} | ^^^^^^^^^^^^ = help: to disambiguate the method call, write `E::foo(a)` instead note: candidate #2 is defined in the trait `F` - --> $DIR/issue-37767.rs:40:5 + --> $DIR/issue-37767.rs:30:5 | LL | fn foo(self) {} | ^^^^^^^^^^^^ diff --git a/src/test/ui/span/issue-39018.rs b/src/test/ui/span/issue-39018.rs index 7b3288fd29c..6dbc8d39976 100644 --- a/src/test/ui/span/issue-39018.rs +++ b/src/test/ui/span/issue-39018.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let x = "Hello " + "World!"; //~^ ERROR cannot be applied to type diff --git a/src/test/ui/span/issue-39018.stderr b/src/test/ui/span/issue-39018.stderr index bd4e7cf574f..00f1b11df19 100644 --- a/src/test/ui/span/issue-39018.stderr +++ b/src/test/ui/span/issue-39018.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `+` cannot be applied to type `&str` - --> $DIR/issue-39018.rs:12:13 + --> $DIR/issue-39018.rs:2:13 | LL | let x = "Hello " + "World!"; | ^^^^^^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings @@ -9,7 +9,7 @@ LL | let x = "Hello ".to_owned() + "World!"; | ^^^^^^^^^^^^^^^^^^^ error[E0369]: binary operation `+` cannot be applied to type `World` - --> $DIR/issue-39018.rs:18:13 + --> $DIR/issue-39018.rs:8:13 | LL | let y = World::Hello + World::Goodbye; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | let y = World::Hello + World::Goodbye; = note: an implementation of `std::ops::Add` might be missing for `World` error[E0369]: binary operation `+` cannot be applied to type `&str` - --> $DIR/issue-39018.rs:21:13 + --> $DIR/issue-39018.rs:11:13 | LL | let x = "Hello " + "World!".to_owned(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `+` can't be used to concatenate a `&str` with a `String` diff --git a/src/test/ui/span/issue-39698.rs b/src/test/ui/span/issue-39698.rs index 33071c468b8..1079bae2c06 100644 --- a/src/test/ui/span/issue-39698.rs +++ b/src/test/ui/span/issue-39698.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum T { T1(i32, i32), T2(i32, i32), diff --git a/src/test/ui/span/issue-39698.stderr b/src/test/ui/span/issue-39698.stderr index e8dab8dc465..7fa5d24c41b 100644 --- a/src/test/ui/span/issue-39698.stderr +++ b/src/test/ui/span/issue-39698.stderr @@ -1,5 +1,5 @@ error[E0408]: variable `a` is not bound in all patterns - --> $DIR/issue-39698.rs:20:23 + --> $DIR/issue-39698.rs:10:23 | LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | - ^^^^^^^^^^^ ^^^^^^^^ - variable not in all patterns @@ -9,7 +9,7 @@ LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?} | variable not in all patterns error[E0408]: variable `d` is not bound in all patterns - --> $DIR/issue-39698.rs:20:37 + --> $DIR/issue-39698.rs:10:37 | LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | - - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `d` @@ -19,7 +19,7 @@ LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?} | variable not in all patterns error[E0408]: variable `b` is not bound in all patterns - --> $DIR/issue-39698.rs:20:9 + --> $DIR/issue-39698.rs:10:9 | LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^^^^^^^^^^^ - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `b` @@ -29,7 +29,7 @@ LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?} | pattern doesn't bind `b` error[E0408]: variable `c` is not bound in all patterns - --> $DIR/issue-39698.rs:20:9 + --> $DIR/issue-39698.rs:10:9 | LL | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^^^^^^^^^^^ ^^^^^^^^^^^ - ^^^^^^^^ pattern doesn't bind `c` diff --git a/src/test/ui/span/issue-40157.nll.stderr b/src/test/ui/span/issue-40157.nll.stderr index 09e634ba725..0b365c3f7b6 100644 --- a/src/test/ui/span/issue-40157.nll.stderr +++ b/src/test/ui/span/issue-40157.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `foo` does not live long enough - --> $DIR/issue-40157.rs:12:53 + --> $DIR/issue-40157.rs:2:53 | LL | {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });} | ------------------------^^^--------- diff --git a/src/test/ui/span/issue-40157.rs b/src/test/ui/span/issue-40157.rs index 9e33ecde91c..03ad21ae773 100644 --- a/src/test/ui/span/issue-40157.rs +++ b/src/test/ui/span/issue-40157.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main () { {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });} //~^ ERROR does not live long enough diff --git a/src/test/ui/span/issue-40157.stderr b/src/test/ui/span/issue-40157.stderr index 8c6d3339e98..55fc8d8ee5f 100644 --- a/src/test/ui/span/issue-40157.stderr +++ b/src/test/ui/span/issue-40157.stderr @@ -1,5 +1,5 @@ error[E0597]: `foo` does not live long enough - --> $DIR/issue-40157.rs:12:53 + --> $DIR/issue-40157.rs:2:53 | LL | {println!("{:?}", match { let foo = vec![1, 2]; foo.get(1) } { x => x });} | -----------------------------------------------^^^---------------------- diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.rs b/src/test/ui/span/issue-42234-unknown-receiver-type.rs index 975c81955e0..58138e21bc0 100644 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.rs +++ b/src/test/ui/span/issue-42234-unknown-receiver-type.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // When the type of a method call's receiver is unknown, the span should point // to the receiver (and not the entire call, as was previously the case before // the fix of which this tests). @@ -15,11 +5,11 @@ fn shines_a_beacon_through_the_darkness() { let x: Option<_> = None; x.unwrap().method_that_could_exist_on_some_type(); - //~^ ERROR 17:5: 17:15: type annotations needed + //~^ ERROR type annotations needed } fn courier_to_des_moines_and_points_west(data: &[u32]) -> String { - data.iter() //~ ERROR 22:5: 23:20: type annotations needed + data.iter() //~ ERROR type annotations needed .sum::<_>() .to_string() } diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.stderr b/src/test/ui/span/issue-42234-unknown-receiver-type.stderr index d2d5a4a4b12..1899a4e55d5 100644 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.stderr +++ b/src/test/ui/span/issue-42234-unknown-receiver-type.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-42234-unknown-receiver-type.rs:17:5 + --> $DIR/issue-42234-unknown-receiver-type.rs:7:5 | LL | let x: Option<_> = None; | - consider giving `x` a type @@ -9,9 +9,9 @@ LL | x.unwrap().method_that_could_exist_on_some_type(); = note: type must be known at this point error[E0282]: type annotations needed - --> $DIR/issue-42234-unknown-receiver-type.rs:22:5 + --> $DIR/issue-42234-unknown-receiver-type.rs:12:5 | -LL | / data.iter() //~ ERROR 22:5: 23:20: type annotations needed +LL | / data.iter() //~ ERROR type annotations needed LL | | .sum::<_>() | |___________________^ cannot infer type | diff --git a/src/test/ui/span/issue-43927-non-ADT-derive.rs b/src/test/ui/span/issue-43927-non-ADT-derive.rs index 782cce26a95..add1758dddf 100644 --- a/src/test/ui/span/issue-43927-non-ADT-derive.rs +++ b/src/test/ui/span/issue-43927-non-ADT-derive.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![derive(Debug, PartialEq, Eq)] // should be an outer attribute! diff --git a/src/test/ui/span/issue-43927-non-ADT-derive.stderr b/src/test/ui/span/issue-43927-non-ADT-derive.stderr index e3575c03ff2..e09a8a0e8fb 100644 --- a/src/test/ui/span/issue-43927-non-ADT-derive.stderr +++ b/src/test/ui/span/issue-43927-non-ADT-derive.stderr @@ -1,5 +1,5 @@ error: `derive` may only be applied to structs, enums and unions - --> $DIR/issue-43927-non-ADT-derive.rs:13:1 + --> $DIR/issue-43927-non-ADT-derive.rs:3:1 | LL | #![derive(Debug, PartialEq, Eq)] // should be an outer attribute! | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try an outer attribute: `#[derive(Debug, PartialEq, Eq)]` diff --git a/src/test/ui/span/issue-7575.rs b/src/test/ui/span/issue-7575.rs index b1dbd5b86e7..c33398cd39c 100644 --- a/src/test/ui/span/issue-7575.rs +++ b/src/test/ui/span/issue-7575.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test the mechanism for warning about possible missing `self` declarations. // ignore-tidy-linelength diff --git a/src/test/ui/span/issue-7575.stderr b/src/test/ui/span/issue-7575.stderr index e31134f843b..b2c9e505f07 100644 --- a/src/test/ui/span/issue-7575.stderr +++ b/src/test/ui/span/issue-7575.stderr @@ -1,24 +1,24 @@ error[E0599]: no method named `f9` found for type `usize` in the current scope - --> $DIR/issue-7575.rs:74:18 + --> $DIR/issue-7575.rs:64:18 | LL | u.f8(42) + u.f9(342) + m.fff(42) | ^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: candidate #1 is defined in the trait `CtxtFn` - --> $DIR/issue-7575.rs:16:5 + --> $DIR/issue-7575.rs:6:5 | LL | fn f9(_: usize) -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `CtxtFn::f9(u, 342)` instead note: candidate #2 is defined in the trait `OtherTrait` - --> $DIR/issue-7575.rs:20:5 + --> $DIR/issue-7575.rs:10:5 | LL | fn f9(_: usize) -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to disambiguate the method call, write `OtherTrait::f9(u, 342)` instead note: candidate #3 is defined in the trait `UnusedTrait` - --> $DIR/issue-7575.rs:29:5 + --> $DIR/issue-7575.rs:19:5 | LL | fn f9(_: usize) -> usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -30,7 +30,7 @@ LL | fn f9(_: usize) -> usize; candidate #3: `UnusedTrait` error[E0599]: no method named `fff` found for type `Myisize` in the current scope - --> $DIR/issue-7575.rs:74:30 + --> $DIR/issue-7575.rs:64:30 | LL | struct Myisize(isize); | ---------------------- method `fff` not found for this @@ -43,20 +43,20 @@ LL | u.f8(42) + u.f9(342) + m.fff(42) | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in an impl for the type `Myisize` - --> $DIR/issue-7575.rs:51:5 + --> $DIR/issue-7575.rs:41:5 | LL | fn fff(i: isize) -> isize { | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0599]: no method named `is_str` found for type `T` in the current scope - --> $DIR/issue-7575.rs:82:7 + --> $DIR/issue-7575.rs:72:7 | LL | t.is_str() | ^^^^^^ this is an associated function, not a method | = note: found the following associated functions; to be used as methods, functions must have a `self` parameter note: the candidate is defined in the trait `ManyImplTrait` - --> $DIR/issue-7575.rs:57:5 + --> $DIR/issue-7575.rs:47:5 | LL | fn is_str() -> bool { | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/span/issue28498-reject-ex1.nll.stderr b/src/test/ui/span/issue28498-reject-ex1.nll.stderr index bc3a31b843f..86e2d8c56b0 100644 --- a/src/test/ui/span/issue28498-reject-ex1.nll.stderr +++ b/src/test/ui/span/issue28498-reject-ex1.nll.stderr @@ -1,5 +1,5 @@ error[E0713]: borrow may still be in use when destructor runs - --> $DIR/issue28498-reject-ex1.rs:44:29 + --> $DIR/issue28498-reject-ex1.rs:34:29 | LL | foo.data[0].1.set(Some(&foo.data[1])); | ^^^^^^^^ diff --git a/src/test/ui/span/issue28498-reject-ex1.rs b/src/test/ui/span/issue28498-reject-ex1.rs index cee7c57c201..05104d1cdc0 100644 --- a/src/test/ui/span/issue28498-reject-ex1.rs +++ b/src/test/ui/span/issue28498-reject-ex1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Example taken from RFC 1238 text // https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md diff --git a/src/test/ui/span/issue28498-reject-ex1.stderr b/src/test/ui/span/issue28498-reject-ex1.stderr index fb6eeb4de5d..8daef82f8bb 100644 --- a/src/test/ui/span/issue28498-reject-ex1.stderr +++ b/src/test/ui/span/issue28498-reject-ex1.stderr @@ -1,5 +1,5 @@ error[E0597]: `foo.data` does not live long enough - --> $DIR/issue28498-reject-ex1.rs:44:29 + --> $DIR/issue28498-reject-ex1.rs:34:29 | LL | foo.data[0].1.set(Some(&foo.data[1])); | ^^^^^^^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `foo.data` does not live long enough - --> $DIR/issue28498-reject-ex1.rs:46:29 + --> $DIR/issue28498-reject-ex1.rs:36:29 | LL | foo.data[1].1.set(Some(&foo.data[0])); | ^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue28498-reject-lifetime-param.nll.stderr b/src/test/ui/span/issue28498-reject-lifetime-param.nll.stderr index 21508303afc..3273b51ba0f 100644 --- a/src/test/ui/span/issue28498-reject-lifetime-param.nll.stderr +++ b/src/test/ui/span/issue28498-reject-lifetime-param.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `first_dropped` does not live long enough - --> $DIR/issue28498-reject-lifetime-param.rs:44:19 + --> $DIR/issue28498-reject-lifetime-param.rs:34:19 | LL | foo1 = Foo(1, &first_dropped); | ^^^^^^^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue28498-reject-lifetime-param.rs b/src/test/ui/span/issue28498-reject-lifetime-param.rs index 92028c7a818..062636af3f1 100644 --- a/src/test/ui/span/issue28498-reject-lifetime-param.rs +++ b/src/test/ui/span/issue28498-reject-lifetime-param.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Demonstrate that having a lifetime param causes dropck to reject code // that might indirectly access previously dropped value. // diff --git a/src/test/ui/span/issue28498-reject-lifetime-param.stderr b/src/test/ui/span/issue28498-reject-lifetime-param.stderr index 841ea5b25c8..0e51729f8d6 100644 --- a/src/test/ui/span/issue28498-reject-lifetime-param.stderr +++ b/src/test/ui/span/issue28498-reject-lifetime-param.stderr @@ -1,5 +1,5 @@ error[E0597]: `last_dropped` does not live long enough - --> $DIR/issue28498-reject-lifetime-param.rs:42:20 + --> $DIR/issue28498-reject-lifetime-param.rs:32:20 | LL | foo0 = Foo(0, &last_dropped); | ^^^^^^^^^^^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `first_dropped` does not live long enough - --> $DIR/issue28498-reject-lifetime-param.rs:44:20 + --> $DIR/issue28498-reject-lifetime-param.rs:34:20 | LL | foo1 = Foo(1, &first_dropped); | ^^^^^^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue28498-reject-passed-to-fn.nll.stderr b/src/test/ui/span/issue28498-reject-passed-to-fn.nll.stderr index 752f96988db..ae08e3e5e6c 100644 --- a/src/test/ui/span/issue28498-reject-passed-to-fn.nll.stderr +++ b/src/test/ui/span/issue28498-reject-passed-to-fn.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `first_dropped` does not live long enough - --> $DIR/issue28498-reject-passed-to-fn.rs:46:19 + --> $DIR/issue28498-reject-passed-to-fn.rs:36:19 | LL | foo1 = Foo(1, &first_dropped, Box::new(callback)); | ^^^^^^^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue28498-reject-passed-to-fn.rs b/src/test/ui/span/issue28498-reject-passed-to-fn.rs index 27378b1e0be..27a757e850b 100644 --- a/src/test/ui/span/issue28498-reject-passed-to-fn.rs +++ b/src/test/ui/span/issue28498-reject-passed-to-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Demonstrate that a type param in negative position causes dropck to reject code // that might indirectly access previously dropped value. // diff --git a/src/test/ui/span/issue28498-reject-passed-to-fn.stderr b/src/test/ui/span/issue28498-reject-passed-to-fn.stderr index 2a5e34290ec..80533c79f10 100644 --- a/src/test/ui/span/issue28498-reject-passed-to-fn.stderr +++ b/src/test/ui/span/issue28498-reject-passed-to-fn.stderr @@ -1,5 +1,5 @@ error[E0597]: `last_dropped` does not live long enough - --> $DIR/issue28498-reject-passed-to-fn.rs:44:20 + --> $DIR/issue28498-reject-passed-to-fn.rs:34:20 | LL | foo0 = Foo(0, &last_dropped, Box::new(callback)); | ^^^^^^^^^^^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `first_dropped` does not live long enough - --> $DIR/issue28498-reject-passed-to-fn.rs:46:20 + --> $DIR/issue28498-reject-passed-to-fn.rs:36:20 | LL | foo1 = Foo(1, &first_dropped, Box::new(callback)); | ^^^^^^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue28498-reject-trait-bound.nll.stderr b/src/test/ui/span/issue28498-reject-trait-bound.nll.stderr index 7bf55c8e997..600fd539fe4 100644 --- a/src/test/ui/span/issue28498-reject-trait-bound.nll.stderr +++ b/src/test/ui/span/issue28498-reject-trait-bound.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `first_dropped` does not live long enough - --> $DIR/issue28498-reject-trait-bound.rs:46:19 + --> $DIR/issue28498-reject-trait-bound.rs:36:19 | LL | foo1 = Foo(1, &first_dropped); | ^^^^^^^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/issue28498-reject-trait-bound.rs b/src/test/ui/span/issue28498-reject-trait-bound.rs index 3904d68ba19..3ea67d1662d 100644 --- a/src/test/ui/span/issue28498-reject-trait-bound.rs +++ b/src/test/ui/span/issue28498-reject-trait-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Demonstrate that having a trait bound causes dropck to reject code // that might indirectly access previously dropped value. // diff --git a/src/test/ui/span/issue28498-reject-trait-bound.stderr b/src/test/ui/span/issue28498-reject-trait-bound.stderr index 6e46f67a1d5..3ce4dd9fdd6 100644 --- a/src/test/ui/span/issue28498-reject-trait-bound.stderr +++ b/src/test/ui/span/issue28498-reject-trait-bound.stderr @@ -1,5 +1,5 @@ error[E0597]: `last_dropped` does not live long enough - --> $DIR/issue28498-reject-trait-bound.rs:44:20 + --> $DIR/issue28498-reject-trait-bound.rs:34:20 | LL | foo0 = Foo(0, &last_dropped); | ^^^^^^^^^^^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `first_dropped` does not live long enough - --> $DIR/issue28498-reject-trait-bound.rs:46:20 + --> $DIR/issue28498-reject-trait-bound.rs:36:20 | LL | foo1 = Foo(1, &first_dropped); | ^^^^^^^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/lint-unused-unsafe.rs b/src/test/ui/span/lint-unused-unsafe.rs index 5c8e73e6747..338fbb994c5 100644 --- a/src/test/ui/span/lint-unused-unsafe.rs +++ b/src/test/ui/span/lint-unused-unsafe.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Exercise the unused_unsafe attribute in some positive and negative cases #![allow(dead_code)] diff --git a/src/test/ui/span/lint-unused-unsafe.stderr b/src/test/ui/span/lint-unused-unsafe.stderr index f85ca4ef00f..7f16cfae859 100644 --- a/src/test/ui/span/lint-unused-unsafe.stderr +++ b/src/test/ui/span/lint-unused-unsafe.stderr @@ -1,23 +1,23 @@ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:26:13 + --> $DIR/lint-unused-unsafe.rs:16:13 | LL | fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here - --> $DIR/lint-unused-unsafe.rs:14:9 + --> $DIR/lint-unused-unsafe.rs:4:9 | LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:27:13 + --> $DIR/lint-unused-unsafe.rs:17:13 | LL | fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:28:20 + --> $DIR/lint-unused-unsafe.rs:18:20 | LL | unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block | ---------------- ^^^^^^ unnecessary `unsafe` block @@ -25,13 +25,13 @@ LL | unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` bl | because it's nested under this `unsafe` fn error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:29:13 + --> $DIR/lint-unused-unsafe.rs:19:13 | LL | fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:30:20 + --> $DIR/lint-unused-unsafe.rs:20:20 | LL | unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` block | ---------------- ^^^^^^ unnecessary `unsafe` block @@ -39,7 +39,7 @@ LL | unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` bl | because it's nested under this `unsafe` fn error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:33:9 + --> $DIR/lint-unused-unsafe.rs:23:9 | LL | unsafe { // don't put the warning here | ------ because it's nested under this `unsafe` block @@ -47,7 +47,7 @@ LL | unsafe { //~ ERROR: unnecessary `unsafe` bl | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:39:5 + --> $DIR/lint-unused-unsafe.rs:29:5 | LL | unsafe fn bad7() { | ---------------- because it's nested under this `unsafe` fn @@ -55,7 +55,7 @@ LL | unsafe { //~ ERROR: unnecessary `unsafe` bl | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block - --> $DIR/lint-unused-unsafe.rs:40:9 + --> $DIR/lint-unused-unsafe.rs:30:9 | LL | unsafe fn bad7() { | ---------------- because it's nested under this `unsafe` fn diff --git a/src/test/ui/span/macro-span-replacement.rs b/src/test/ui/span/macro-span-replacement.rs index 7374f157468..c5998c1b403 100644 --- a/src/test/ui/span/macro-span-replacement.rs +++ b/src/test/ui/span/macro-span-replacement.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![warn(unused)] diff --git a/src/test/ui/span/macro-span-replacement.stderr b/src/test/ui/span/macro-span-replacement.stderr index b12ca86d3c9..f6c303164bf 100644 --- a/src/test/ui/span/macro-span-replacement.stderr +++ b/src/test/ui/span/macro-span-replacement.stderr @@ -1,5 +1,5 @@ warning: struct is never constructed: `S` - --> $DIR/macro-span-replacement.rs:17:14 + --> $DIR/macro-span-replacement.rs:7:14 | LL | $b $a; //~ WARN struct is never constructed | ^ @@ -8,7 +8,7 @@ LL | m!(S struct); | ------------- in this macro invocation | note: lint level defined here - --> $DIR/macro-span-replacement.rs:13:9 + --> $DIR/macro-span-replacement.rs:3:9 | LL | #![warn(unused)] | ^^^^^^ diff --git a/src/test/ui/span/macro-ty-params.rs b/src/test/ui/span/macro-ty-params.rs index 5d93b1266a4..b077d590915 100644 --- a/src/test/ui/span/macro-ty-params.rs +++ b/src/test/ui/span/macro-ty-params.rs @@ -1,22 +1,14 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! m { ($p1: path) => { #[derive($p1)] struct U; } } +macro_rules! foo { () => () } + fn main() { foo::!(); //~ ERROR generic arguments in macro path foo::<>!(); //~ ERROR generic arguments in macro path - m!(MyTrait<>); //~ ERROR generic arguments in macro path + m!(Default<>); //~ ERROR generic arguments in macro path //~^ ERROR unexpected generic arguments in path } diff --git a/src/test/ui/span/macro-ty-params.stderr b/src/test/ui/span/macro-ty-params.stderr index 8a40556a6cd..965ca7000be 100644 --- a/src/test/ui/span/macro-ty-params.stderr +++ b/src/test/ui/span/macro-ty-params.stderr @@ -1,26 +1,26 @@ -error: unexpected generic arguments in path - --> $DIR/macro-ty-params.rs:20:8 +error: generic arguments in macro path + --> $DIR/macro-ty-params.rs:10:10 | -LL | m!(MyTrait<>); //~ ERROR generic arguments in macro path - | ^^^^^^^^^ +LL | foo::!(); //~ ERROR generic arguments in macro path + | ^^^ error: generic arguments in macro path - --> $DIR/macro-ty-params.rs:20:15 + --> $DIR/macro-ty-params.rs:11:10 | -LL | m!(MyTrait<>); //~ ERROR generic arguments in macro path - | ^^ +LL | foo::<>!(); //~ ERROR generic arguments in macro path + | ^^ -error: generic arguments in macro path - --> $DIR/macro-ty-params.rs:18:8 +error: unexpected generic arguments in path + --> $DIR/macro-ty-params.rs:12:8 | -LL | foo::!(); //~ ERROR generic arguments in macro path - | ^^^^^ +LL | m!(Default<>); //~ ERROR generic arguments in macro path + | ^^^^^^^^^ error: generic arguments in macro path - --> $DIR/macro-ty-params.rs:19:8 + --> $DIR/macro-ty-params.rs:12:15 | -LL | foo::<>!(); //~ ERROR generic arguments in macro path - | ^^^^ +LL | m!(Default<>); //~ ERROR generic arguments in macro path + | ^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/span/method-and-field-eager-resolution.rs b/src/test/ui/span/method-and-field-eager-resolution.rs index 29011abb460..a38f07d58e4 100644 --- a/src/test/ui/span/method-and-field-eager-resolution.rs +++ b/src/test/ui/span/method-and-field-eager-resolution.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that spans get only base in eager type resolution (structurally_resolve_type). fn main() { diff --git a/src/test/ui/span/method-and-field-eager-resolution.stderr b/src/test/ui/span/method-and-field-eager-resolution.stderr index 8a8c1e467b9..0ecbe4c136e 100644 --- a/src/test/ui/span/method-and-field-eager-resolution.stderr +++ b/src/test/ui/span/method-and-field-eager-resolution.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/method-and-field-eager-resolution.rs:15:5 + --> $DIR/method-and-field-eager-resolution.rs:5:5 | LL | let mut x = Default::default(); | ----- consider giving `x` a type @@ -9,7 +9,7 @@ LL | x.0; = note: type must be known at this point error[E0282]: type annotations needed - --> $DIR/method-and-field-eager-resolution.rs:22:5 + --> $DIR/method-and-field-eager-resolution.rs:12:5 | LL | let mut x = Default::default(); | ----- consider giving `x` a type diff --git a/src/test/ui/span/missing-unit-argument.rs b/src/test/ui/span/missing-unit-argument.rs index a586d33eaa7..b8fb332120a 100644 --- a/src/test/ui/span/missing-unit-argument.rs +++ b/src/test/ui/span/missing-unit-argument.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(():(), ():()) {} fn bar(():()) {} diff --git a/src/test/ui/span/missing-unit-argument.stderr b/src/test/ui/span/missing-unit-argument.stderr index be514fdd81c..bf19eb69461 100644 --- a/src/test/ui/span/missing-unit-argument.stderr +++ b/src/test/ui/span/missing-unit-argument.stderr @@ -1,5 +1,5 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/missing-unit-argument.rs:21:33 + --> $DIR/missing-unit-argument.rs:11:33 | LL | let _: Result<(), String> = Ok(); //~ ERROR this function takes | ^^^^ @@ -9,7 +9,7 @@ LL | let _: Result<(), String> = Ok(()); //~ ERROR this function takes | ^^ error[E0061]: this function takes 2 parameters but 0 parameters were supplied - --> $DIR/missing-unit-argument.rs:22:5 + --> $DIR/missing-unit-argument.rs:12:5 | LL | fn foo(():(), ():()) {} | -------------------- defined here @@ -18,7 +18,7 @@ LL | foo(); //~ ERROR this function takes | ^^^^^ expected 2 parameters error[E0061]: this function takes 2 parameters but 1 parameter was supplied - --> $DIR/missing-unit-argument.rs:23:5 + --> $DIR/missing-unit-argument.rs:13:5 | LL | fn foo(():(), ():()) {} | -------------------- defined here @@ -27,7 +27,7 @@ LL | foo(()); //~ ERROR this function takes | ^^^^^^^ expected 2 parameters error[E0061]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/missing-unit-argument.rs:24:5 + --> $DIR/missing-unit-argument.rs:14:5 | LL | fn bar(():()) {} | ------------- defined here @@ -40,7 +40,7 @@ LL | bar(()); //~ ERROR this function takes | ^^ error[E0061]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/missing-unit-argument.rs:25:7 + --> $DIR/missing-unit-argument.rs:15:7 | LL | fn baz(self, (): ()) { } | -------------------- defined here @@ -53,7 +53,7 @@ LL | S.baz(()); //~ ERROR this function takes | ^^ error[E0061]: this function takes 1 parameter but 0 parameters were supplied - --> $DIR/missing-unit-argument.rs:26:7 + --> $DIR/missing-unit-argument.rs:16:7 | LL | fn generic(self, _: T) { } | ------------------------- defined here diff --git a/src/test/ui/span/move-closure.rs b/src/test/ui/span/move-closure.rs index 87ce1529297..bdd7951b303 100644 --- a/src/test/ui/span/move-closure.rs +++ b/src/test/ui/span/move-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #24986 // Make sure that the span of a closure marked `move` begins at the `move` keyword. diff --git a/src/test/ui/span/move-closure.stderr b/src/test/ui/span/move-closure.stderr index 1c629ee9841..f09e052f653 100644 --- a/src/test/ui/span/move-closure.stderr +++ b/src/test/ui/span/move-closure.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/move-closure.rs:15:17 + --> $DIR/move-closure.rs:5:17 | LL | let x: () = move || (); //~ ERROR mismatched types | ^^^^^^^^^^ expected (), found closure | = note: expected type `()` - found type `[closure@$DIR/move-closure.rs:15:17: 15:27]` + found type `[closure@$DIR/move-closure.rs:5:17: 5:27]` error: aborting due to previous error diff --git a/src/test/ui/span/multiline-span-E0072.rs b/src/test/ui/span/multiline-span-E0072.rs index 2344d72f45c..728b47d6539 100644 --- a/src/test/ui/span/multiline-span-E0072.rs +++ b/src/test/ui/span/multiline-span-E0072.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // It should just use the entire body instead of pointing at the next two lines struct //~ ERROR has infinite size ListNode diff --git a/src/test/ui/span/multiline-span-E0072.stderr b/src/test/ui/span/multiline-span-E0072.stderr index d087a3aaabf..ee392f5994c 100644 --- a/src/test/ui/span/multiline-span-E0072.stderr +++ b/src/test/ui/span/multiline-span-E0072.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `ListNode` has infinite size - --> $DIR/multiline-span-E0072.rs:12:1 + --> $DIR/multiline-span-E0072.rs:2:1 | LL | / struct //~ ERROR has infinite size LL | | ListNode diff --git a/src/test/ui/span/multiline-span-simple.rs b/src/test/ui/span/multiline-span-simple.rs index dd09534480e..204a7f6b1b2 100644 --- a/src/test/ui/span/multiline-span-simple.rs +++ b/src/test/ui/span/multiline-span-simple.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(a: u32, b: u32) { a + b; } diff --git a/src/test/ui/span/multiline-span-simple.stderr b/src/test/ui/span/multiline-span-simple.stderr index 463d5baae64..18b6cd06afb 100644 --- a/src/test/ui/span/multiline-span-simple.stderr +++ b/src/test/ui/span/multiline-span-simple.stderr @@ -1,5 +1,5 @@ error[E0277]: cannot add `()` to `u32` - --> $DIR/multiline-span-simple.rs:23:18 + --> $DIR/multiline-span-simple.rs:13:18 | LL | foo(1 as u32 + //~ ERROR cannot add `()` to `u32` | ^ no implementation for `u32 + ()` diff --git a/src/test/ui/span/multispan-import-lint.rs b/src/test/ui/span/multispan-import-lint.rs index a94fa1c8953..753c3599975 100644 --- a/src/test/ui/span/multispan-import-lint.rs +++ b/src/test/ui/span/multispan-import-lint.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![warn(unused)] diff --git a/src/test/ui/span/multispan-import-lint.stderr b/src/test/ui/span/multispan-import-lint.stderr index da22b217b82..a730d081b7c 100644 --- a/src/test/ui/span/multispan-import-lint.stderr +++ b/src/test/ui/span/multispan-import-lint.stderr @@ -1,11 +1,11 @@ warning: unused imports: `Eq`, `Ord`, `PartialEq`, `PartialOrd` - --> $DIR/multispan-import-lint.rs:15:16 + --> $DIR/multispan-import-lint.rs:5:16 | LL | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd}; | ^^ ^^^ ^^^^^^^^^ ^^^^^^^^^^ | note: lint level defined here - --> $DIR/multispan-import-lint.rs:13:9 + --> $DIR/multispan-import-lint.rs:3:9 | LL | #![warn(unused)] | ^^^^^^ diff --git a/src/test/ui/span/mut-arg-hint.nll.stderr b/src/test/ui/span/mut-arg-hint.nll.stderr index f42cf6500e2..e0fa3c3a1e6 100644 --- a/src/test/ui/span/mut-arg-hint.nll.stderr +++ b/src/test/ui/span/mut-arg-hint.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference - --> $DIR/mut-arg-hint.rs:13:9 + --> $DIR/mut-arg-hint.rs:3:9 | LL | fn foo(mut a: &String) { | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` @@ -7,7 +7,7 @@ LL | a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed conte | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference - --> $DIR/mut-arg-hint.rs:18:5 + --> $DIR/mut-arg-hint.rs:8:5 | LL | pub fn foo<'a>(mut a: &'a String) { | ---------- help: consider changing this to be a mutable reference: `&'a mut String` @@ -15,7 +15,7 @@ LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference - --> $DIR/mut-arg-hint.rs:25:9 + --> $DIR/mut-arg-hint.rs:15:9 | LL | pub fn foo(mut a: &String) { | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` diff --git a/src/test/ui/span/mut-arg-hint.rs b/src/test/ui/span/mut-arg-hint.rs index b22cadf3ef2..3d46613aa7a 100644 --- a/src/test/ui/span/mut-arg-hint.rs +++ b/src/test/ui/span/mut-arg-hint.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait B { fn foo(mut a: &String) { a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed content diff --git a/src/test/ui/span/mut-arg-hint.stderr b/src/test/ui/span/mut-arg-hint.stderr index 730592b3100..ea6fc8bee63 100644 --- a/src/test/ui/span/mut-arg-hint.stderr +++ b/src/test/ui/span/mut-arg-hint.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable borrowed content `*a` as mutable - --> $DIR/mut-arg-hint.rs:13:9 + --> $DIR/mut-arg-hint.rs:3:9 | LL | fn foo(mut a: &String) { | ------- use `&mut String` here to make mutable @@ -7,7 +7,7 @@ LL | a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed conte | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content `*a` as mutable - --> $DIR/mut-arg-hint.rs:18:5 + --> $DIR/mut-arg-hint.rs:8:5 | LL | pub fn foo<'a>(mut a: &'a String) { | ---------- use `&'a mut String` here to make mutable @@ -15,7 +15,7 @@ LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content `*a` as mutable - --> $DIR/mut-arg-hint.rs:25:9 + --> $DIR/mut-arg-hint.rs:15:9 | LL | pub fn foo(mut a: &String) { | ------- use `&mut String` here to make mutable diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr b/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr index e5139dca351..d3ba848fe6b 100644 --- a/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr +++ b/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `b` does not live long enough - --> $DIR/mut-ptr-cant-outlive-ref.rs:18:15 + --> $DIR/mut-ptr-cant-outlive-ref.rs:8:15 | LL | p = &*b; | ^ borrowed value does not live long enough diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.rs b/src/test/ui/span/mut-ptr-cant-outlive-ref.rs index 6cd2cf1e673..b8c752d73ed 100644 --- a/src/test/ui/span/mut-ptr-cant-outlive-ref.rs +++ b/src/test/ui/span/mut-ptr-cant-outlive-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::cell::RefCell; fn main() { diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr b/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr index 34fcc9ef962..f6cf568a8d2 100644 --- a/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr +++ b/src/test/ui/span/mut-ptr-cant-outlive-ref.stderr @@ -1,5 +1,5 @@ error[E0597]: `b` does not live long enough - --> $DIR/mut-ptr-cant-outlive-ref.rs:18:15 + --> $DIR/mut-ptr-cant-outlive-ref.rs:8:15 | LL | p = &*b; | ^ borrowed value does not live long enough diff --git a/src/test/ui/span/non-existing-module-import.rs b/src/test/ui/span/non-existing-module-import.rs index ad6409f014a..d2ce7ec4f8e 100644 --- a/src/test/ui/span/non-existing-module-import.rs +++ b/src/test/ui/span/non-existing-module-import.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::bar::{foo1, foo2}; //~ ERROR unresolved import fn main() {} diff --git a/src/test/ui/span/non-existing-module-import.stderr b/src/test/ui/span/non-existing-module-import.stderr index 1f001530f36..5ac5df1b4c7 100644 --- a/src/test/ui/span/non-existing-module-import.stderr +++ b/src/test/ui/span/non-existing-module-import.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `std::bar` - --> $DIR/non-existing-module-import.rs:11:10 + --> $DIR/non-existing-module-import.rs:1:10 | LL | use std::bar::{foo1, foo2}; //~ ERROR unresolved import | ^^^ could not find `bar` in `std` diff --git a/src/test/ui/span/pub-struct-field.rs b/src/test/ui/span/pub-struct-field.rs index 11af361e8a8..e149b9dbf5a 100644 --- a/src/test/ui/span/pub-struct-field.rs +++ b/src/test/ui/span/pub-struct-field.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #26083 and #35435 // Test that span for public struct fields start at `pub` diff --git a/src/test/ui/span/pub-struct-field.stderr b/src/test/ui/span/pub-struct-field.stderr index 4d2a48aef00..66afbf253c9 100644 --- a/src/test/ui/span/pub-struct-field.stderr +++ b/src/test/ui/span/pub-struct-field.stderr @@ -1,5 +1,5 @@ error[E0124]: field `bar` is already declared - --> $DIR/pub-struct-field.rs:16:5 + --> $DIR/pub-struct-field.rs:6:5 | LL | bar: u8, | ------- `bar` first declared here @@ -7,7 +7,7 @@ LL | pub bar: u8, //~ ERROR is already declared | ^^^^^^^^^^^ field already declared error[E0124]: field `bar` is already declared - --> $DIR/pub-struct-field.rs:17:5 + --> $DIR/pub-struct-field.rs:7:5 | LL | bar: u8, | ------- `bar` first declared here diff --git a/src/test/ui/span/range-2.nll.stderr b/src/test/ui/span/range-2.nll.stderr index fe2fa2887ed..8ca8156b083 100644 --- a/src/test/ui/span/range-2.nll.stderr +++ b/src/test/ui/span/range-2.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/range-2.rs:17:9 + --> $DIR/range-2.rs:7:9 | LL | let r = { | - borrow later stored here @@ -10,7 +10,7 @@ LL | }; | - `a` dropped here while still borrowed error[E0597]: `b` does not live long enough - --> $DIR/range-2.rs:17:13 + --> $DIR/range-2.rs:7:13 | LL | let r = { | - borrow later stored here diff --git a/src/test/ui/span/range-2.rs b/src/test/ui/span/range-2.rs index 6d2cd85fb66..c4bb16f44bd 100644 --- a/src/test/ui/span/range-2.rs +++ b/src/test/ui/span/range-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test range syntax - borrow errors. #![feature(rustc_attrs)] pub fn main() { #![rustc_error] // rust-lang/rust#49855 diff --git a/src/test/ui/span/range-2.stderr b/src/test/ui/span/range-2.stderr index e2ee86ae1f5..7d0edd6971c 100644 --- a/src/test/ui/span/range-2.stderr +++ b/src/test/ui/span/range-2.stderr @@ -1,5 +1,5 @@ error[E0597]: `a` does not live long enough - --> $DIR/range-2.rs:17:10 + --> $DIR/range-2.rs:7:10 | LL | &a..&b | ^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } | - borrowed value needs to live until here error[E0597]: `b` does not live long enough - --> $DIR/range-2.rs:17:14 + --> $DIR/range-2.rs:7:14 | LL | &a..&b | ^ borrowed value does not live long enough diff --git a/src/test/ui/span/recursive-type-field.rs b/src/test/ui/span/recursive-type-field.rs index 764b5392578..58ea81b8395 100644 --- a/src/test/ui/span/recursive-type-field.rs +++ b/src/test/ui/span/recursive-type-field.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::rc::Rc; struct Foo<'a> { //~ ERROR recursive type diff --git a/src/test/ui/span/recursive-type-field.stderr b/src/test/ui/span/recursive-type-field.stderr index 74ccb74ac2b..3a8f0e60038 100644 --- a/src/test/ui/span/recursive-type-field.stderr +++ b/src/test/ui/span/recursive-type-field.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `Foo` has infinite size - --> $DIR/recursive-type-field.rs:13:1 + --> $DIR/recursive-type-field.rs:3:1 | LL | struct Foo<'a> { //~ ERROR recursive type | ^^^^^^^^^^^^^^ recursive type has infinite size @@ -9,7 +9,7 @@ LL | bar: Bar<'a>, = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable error[E0072]: recursive type `Bar` has infinite size - --> $DIR/recursive-type-field.rs:18:1 + --> $DIR/recursive-type-field.rs:8:1 | LL | struct Bar<'a> { //~ ERROR recursive type | ^^^^^^^^^^^^^^ recursive type has infinite size diff --git a/src/test/ui/span/regionck-unboxed-closure-lifetimes.nll.stderr b/src/test/ui/span/regionck-unboxed-closure-lifetimes.nll.stderr index 4881259ff23..8e9cd595154 100644 --- a/src/test/ui/span/regionck-unboxed-closure-lifetimes.nll.stderr +++ b/src/test/ui/span/regionck-unboxed-closure-lifetimes.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/regionck-unboxed-closure-lifetimes.rs:17:21 + --> $DIR/regionck-unboxed-closure-lifetimes.rs:8:21 | LL | let c_ref = &c; | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs b/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs index 7595f03fd31..60ccaa872e7 100644 --- a/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs +++ b/src/test/ui/span/regionck-unboxed-closure-lifetimes.rs @@ -1,12 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. #![feature(rustc_attrs)] use std::ops::FnMut; diff --git a/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr b/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr index 8a1bb4a45e1..b3f09669f5f 100644 --- a/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr +++ b/src/test/ui/span/regionck-unboxed-closure-lifetimes.stderr @@ -1,5 +1,5 @@ error[E0597]: `c` does not live long enough - --> $DIR/regionck-unboxed-closure-lifetimes.rs:17:22 + --> $DIR/regionck-unboxed-closure-lifetimes.rs:8:22 | LL | let c_ref = &c; | ^ borrowed value does not live long enough diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr index fd789e79e91..2be2d0ff7b5 100644 --- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr +++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:22:27 + --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:12:27 | LL | let ss: &isize = &id(1); | ^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs index cf94969742e..9ca352a07fc 100644 --- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs +++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn id(x: T) -> T { x } diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr index 2b63d5bd6c7..8a853e7ce59 100644 --- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr +++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:22:27 + --> $DIR/regions-close-over-borrowed-ref-in-obj.rs:12:27 | LL | let ss: &isize = &id(1); | ^^^^^ temporary value does not live long enough diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.nll.stderr b/src/test/ui/span/regions-close-over-type-parameter-2.nll.stderr index 11fa447b548..2e584d9a884 100644 --- a/src/test/ui/span/regions-close-over-type-parameter-2.nll.stderr +++ b/src/test/ui/span/regions-close-over-type-parameter-2.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `tmp0` does not live long enough - --> $DIR/regions-close-over-type-parameter-2.rs:33:20 + --> $DIR/regions-close-over-type-parameter-2.rs:23:20 | LL | let tmp1 = &tmp0; | ^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.rs b/src/test/ui/span/regions-close-over-type-parameter-2.rs index e7eff6f2559..11187b74c42 100644 --- a/src/test/ui/span/regions-close-over-type-parameter-2.rs +++ b/src/test/ui/span/regions-close-over-type-parameter-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] // Test for what happens when a type parameter `A` is closed over into diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.stderr b/src/test/ui/span/regions-close-over-type-parameter-2.stderr index 79c6a0be179..5ee155c1d18 100644 --- a/src/test/ui/span/regions-close-over-type-parameter-2.stderr +++ b/src/test/ui/span/regions-close-over-type-parameter-2.stderr @@ -1,5 +1,5 @@ error[E0597]: `tmp0` does not live long enough - --> $DIR/regions-close-over-type-parameter-2.rs:33:21 + --> $DIR/regions-close-over-type-parameter-2.rs:23:21 | LL | let tmp1 = &tmp0; | ^^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/regions-escape-loop-via-variable.nll.stderr b/src/test/ui/span/regions-escape-loop-via-variable.nll.stderr index a6d86f67974..841e3c48414 100644 --- a/src/test/ui/span/regions-escape-loop-via-variable.nll.stderr +++ b/src/test/ui/span/regions-escape-loop-via-variable.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/regions-escape-loop-via-variable.rs:21:13 + --> $DIR/regions-escape-loop-via-variable.rs:11:13 | LL | let x = 1 + *p; | -- borrow used here, in later iteration of loop diff --git a/src/test/ui/span/regions-escape-loop-via-variable.rs b/src/test/ui/span/regions-escape-loop-via-variable.rs index 96c1ccd5326..ad468896b13 100644 --- a/src/test/ui/span/regions-escape-loop-via-variable.rs +++ b/src/test/ui/span/regions-escape-loop-via-variable.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = 3; diff --git a/src/test/ui/span/regions-escape-loop-via-variable.stderr b/src/test/ui/span/regions-escape-loop-via-variable.stderr index 0ff0d76a5e4..e3870db0c66 100644 --- a/src/test/ui/span/regions-escape-loop-via-variable.stderr +++ b/src/test/ui/span/regions-escape-loop-via-variable.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/regions-escape-loop-via-variable.rs:21:14 + --> $DIR/regions-escape-loop-via-variable.rs:11:14 | LL | p = &x; | ^ borrowed value does not live long enough diff --git a/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr b/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr index 2f23a444dcc..ea64828fedd 100644 --- a/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr +++ b/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/regions-escape-loop-via-vec.rs:15:11 + --> $DIR/regions-escape-loop-via-vec.rs:5:11 | LL | let mut _y = vec![&mut x]; | ------ borrow of `x` occurs here @@ -10,7 +10,7 @@ LL | _y.push(&mut z); | -- borrow used here, in later iteration of loop error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/regions-escape-loop-via-vec.rs:16:21 + --> $DIR/regions-escape-loop-via-vec.rs:6:21 | LL | let mut _y = vec![&mut x]; | ------ borrow of `x` occurs here @@ -21,7 +21,7 @@ LL | _y.push(&mut z); | -- borrow used here, in later iteration of loop error[E0597]: `z` does not live long enough - --> $DIR/regions-escape-loop-via-vec.rs:17:17 + --> $DIR/regions-escape-loop-via-vec.rs:7:17 | LL | _y.push(&mut z); | -- ^^^^^^ borrowed value does not live long enough @@ -32,7 +32,7 @@ LL | } | - `z` dropped here while still borrowed error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/regions-escape-loop-via-vec.rs:19:9 + --> $DIR/regions-escape-loop-via-vec.rs:9:9 | LL | let mut _y = vec![&mut x]; | ------ borrow of `x` occurs here diff --git a/src/test/ui/span/regions-escape-loop-via-vec.rs b/src/test/ui/span/regions-escape-loop-via-vec.rs index 8e85ca5bcea..52f3dc37c90 100644 --- a/src/test/ui/span/regions-escape-loop-via-vec.rs +++ b/src/test/ui/span/regions-escape-loop-via-vec.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The type of `y` ends up getting inferred to the type of the block. fn broken() { let mut x = 3; diff --git a/src/test/ui/span/regions-escape-loop-via-vec.stderr b/src/test/ui/span/regions-escape-loop-via-vec.stderr index 1d4911bd5af..09a7123d8f0 100644 --- a/src/test/ui/span/regions-escape-loop-via-vec.stderr +++ b/src/test/ui/span/regions-escape-loop-via-vec.stderr @@ -1,5 +1,5 @@ error[E0597]: `z` does not live long enough - --> $DIR/regions-escape-loop-via-vec.rs:17:22 + --> $DIR/regions-escape-loop-via-vec.rs:7:22 | LL | _y.push(&mut z); | ^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } | - borrowed value needs to live until here error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/regions-escape-loop-via-vec.rs:15:11 + --> $DIR/regions-escape-loop-via-vec.rs:5:11 | LL | let mut _y = vec![&mut x]; | - borrow of `x` occurs here @@ -18,7 +18,7 @@ LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed | ^ use of borrowed `x` error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/regions-escape-loop-via-vec.rs:16:13 + --> $DIR/regions-escape-loop-via-vec.rs:6:13 | LL | let mut _y = vec![&mut x]; | - borrow of `x` occurs here @@ -27,7 +27,7 @@ LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borr | ^^^^^ use of borrowed `x` error[E0506]: cannot assign to `x` because it is borrowed - --> $DIR/regions-escape-loop-via-vec.rs:19:9 + --> $DIR/regions-escape-loop-via-vec.rs:9:9 | LL | let mut _y = vec![&mut x]; | - borrow of `x` occurs here diff --git a/src/test/ui/span/regions-infer-borrow-scope-within-loop.nll.stderr b/src/test/ui/span/regions-infer-borrow-scope-within-loop.nll.stderr index 5fa25ae8506..fd67c65c4e9 100644 --- a/src/test/ui/span/regions-infer-borrow-scope-within-loop.nll.stderr +++ b/src/test/ui/span/regions-infer-borrow-scope-within-loop.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `*x` does not live long enough - --> $DIR/regions-infer-borrow-scope-within-loop.rs:24:20 + --> $DIR/regions-infer-borrow-scope-within-loop.rs:13:20 | LL | y = borrow(&*x); | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs b/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs index b6adc2206e9..3b20285b1bf 100644 --- a/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs +++ b/src/test/ui/span/regions-infer-borrow-scope-within-loop.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn borrow(x: &T) -> &T {x} fn foo(mut cond: C, mut make_box: M) where diff --git a/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr b/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr index 87dc0682199..94abbcef035 100644 --- a/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr +++ b/src/test/ui/span/regions-infer-borrow-scope-within-loop.stderr @@ -1,5 +1,5 @@ error[E0597]: `*x` does not live long enough - --> $DIR/regions-infer-borrow-scope-within-loop.rs:24:21 + --> $DIR/regions-infer-borrow-scope-within-loop.rs:13:21 | LL | y = borrow(&*x); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/send-is-not-static-ensures-scoping.nll.stderr b/src/test/ui/span/send-is-not-static-ensures-scoping.nll.stderr index 80e2266896f..65d10c1305b 100644 --- a/src/test/ui/span/send-is-not-static-ensures-scoping.nll.stderr +++ b/src/test/ui/span/send-is-not-static-ensures-scoping.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-ensures-scoping.rs:26:17 + --> $DIR/send-is-not-static-ensures-scoping.rs:16:17 | LL | let bad = { | --- borrow later stored here @@ -11,7 +11,7 @@ LL | }; | - `x` dropped here while still borrowed error[E0597]: `y` does not live long enough - --> $DIR/send-is-not-static-ensures-scoping.rs:30:22 + --> $DIR/send-is-not-static-ensures-scoping.rs:20:22 | LL | let bad = { | --- borrow later stored here diff --git a/src/test/ui/span/send-is-not-static-ensures-scoping.rs b/src/test/ui/span/send-is-not-static-ensures-scoping.rs index 20f8d473ac3..ac07420ee36 100644 --- a/src/test/ui/span/send-is-not-static-ensures-scoping.rs +++ b/src/test/ui/span/send-is-not-static-ensures-scoping.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Guard<'a> { f: Box, } diff --git a/src/test/ui/span/send-is-not-static-ensures-scoping.stderr b/src/test/ui/span/send-is-not-static-ensures-scoping.stderr index 0447b578d44..47026284fb1 100644 --- a/src/test/ui/span/send-is-not-static-ensures-scoping.stderr +++ b/src/test/ui/span/send-is-not-static-ensures-scoping.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-ensures-scoping.rs:26:18 + --> $DIR/send-is-not-static-ensures-scoping.rs:16:18 | LL | let y = &x; | ^ borrowed value does not live long enough @@ -11,7 +11,7 @@ LL | } | - borrowed value needs to live until here error[E0597]: `y` does not live long enough - --> $DIR/send-is-not-static-ensures-scoping.rs:30:22 + --> $DIR/send-is-not-static-ensures-scoping.rs:20:22 | LL | scoped(|| { | -- capture occurs here diff --git a/src/test/ui/span/send-is-not-static-std-sync-2.nll.stderr b/src/test/ui/span/send-is-not-static-std-sync-2.nll.stderr index 5b79b71dda0..bcd07e11647 100644 --- a/src/test/ui/span/send-is-not-static-std-sync-2.nll.stderr +++ b/src/test/ui/span/send-is-not-static-std-sync-2.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-std-sync-2.rs:21:20 + --> $DIR/send-is-not-static-std-sync-2.rs:11:20 | LL | let lock = { | ---- borrow later stored here @@ -10,7 +10,7 @@ LL | }; | - `x` dropped here while still borrowed error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-std-sync-2.rs:31:21 + --> $DIR/send-is-not-static-std-sync-2.rs:21:21 | LL | let lock = { | ---- borrow later stored here @@ -21,7 +21,7 @@ LL | }; | - `x` dropped here while still borrowed error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-std-sync-2.rs:41:25 + --> $DIR/send-is-not-static-std-sync-2.rs:31:25 | LL | let (_tx, rx) = { | --- borrow later used here diff --git a/src/test/ui/span/send-is-not-static-std-sync-2.rs b/src/test/ui/span/send-is-not-static-std-sync-2.rs index a10f700fb54..38746d4cbbc 100644 --- a/src/test/ui/span/send-is-not-static-std-sync-2.rs +++ b/src/test/ui/span/send-is-not-static-std-sync-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // basic tests to see that certain "obvious" errors are caught by // these types no longer requiring `'static` (RFC 458) diff --git a/src/test/ui/span/send-is-not-static-std-sync-2.stderr b/src/test/ui/span/send-is-not-static-std-sync-2.stderr index 53f4d685d0c..4172731745e 100644 --- a/src/test/ui/span/send-is-not-static-std-sync-2.stderr +++ b/src/test/ui/span/send-is-not-static-std-sync-2.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-std-sync-2.rs:21:21 + --> $DIR/send-is-not-static-std-sync-2.rs:11:21 | LL | Mutex::new(&x) | ^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } | - borrowed value needs to live until here error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-std-sync-2.rs:31:22 + --> $DIR/send-is-not-static-std-sync-2.rs:21:22 | LL | RwLock::new(&x) | ^ borrowed value does not live long enough @@ -21,7 +21,7 @@ LL | } | - borrowed value needs to live until here error[E0597]: `x` does not live long enough - --> $DIR/send-is-not-static-std-sync-2.rs:41:26 + --> $DIR/send-is-not-static-std-sync-2.rs:31:26 | LL | let _ = tx.send(&x); | ^ borrowed value does not live long enough diff --git a/src/test/ui/span/send-is-not-static-std-sync.nll.stderr b/src/test/ui/span/send-is-not-static-std-sync.nll.stderr index c17f502b779..54960c16405 100644 --- a/src/test/ui/span/send-is-not-static-std-sync.nll.stderr +++ b/src/test/ui/span/send-is-not-static-std-sync.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/send-is-not-static-std-sync.rs:23:10 + --> $DIR/send-is-not-static-std-sync.rs:13:10 | LL | *lock.lock().unwrap() = &*y; | --- borrow of `*y` occurs here @@ -10,7 +10,7 @@ LL | *lock.lock().unwrap() = &z; | ---- borrow later used here error[E0597]: `z` does not live long enough - --> $DIR/send-is-not-static-std-sync.rs:26:33 + --> $DIR/send-is-not-static-std-sync.rs:16:33 | LL | *lock.lock().unwrap() = &z; | ^^ borrowed value does not live long enough @@ -21,7 +21,7 @@ LL | lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` | ---- borrow later used here error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/send-is-not-static-std-sync.rs:37:10 + --> $DIR/send-is-not-static-std-sync.rs:27:10 | LL | *lock.write().unwrap() = &*y; | --- borrow of `*y` occurs here @@ -32,7 +32,7 @@ LL | *lock.write().unwrap() = &z; | ---- borrow later used here error[E0597]: `z` does not live long enough - --> $DIR/send-is-not-static-std-sync.rs:40:34 + --> $DIR/send-is-not-static-std-sync.rs:30:34 | LL | *lock.write().unwrap() = &z; | ^^ borrowed value does not live long enough @@ -43,7 +43,7 @@ LL | lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z | ---- borrow later used here error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/send-is-not-static-std-sync.rs:53:10 + --> $DIR/send-is-not-static-std-sync.rs:43:10 | LL | tx.send(&*y); | --- borrow of `*y` occurs here @@ -54,7 +54,7 @@ LL | tx.send(&z).unwrap(); | -- borrow later used here error[E0597]: `z` does not live long enough - --> $DIR/send-is-not-static-std-sync.rs:56:17 + --> $DIR/send-is-not-static-std-sync.rs:46:17 | LL | tx.send(&z).unwrap(); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/send-is-not-static-std-sync.rs b/src/test/ui/span/send-is-not-static-std-sync.rs index 08718ffc864..f8ab5243c22 100644 --- a/src/test/ui/span/send-is-not-static-std-sync.rs +++ b/src/test/ui/span/send-is-not-static-std-sync.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // basic tests to see that certain "obvious" errors are caught by // these types no longer requiring `'static` (RFC 458) diff --git a/src/test/ui/span/send-is-not-static-std-sync.stderr b/src/test/ui/span/send-is-not-static-std-sync.stderr index efcd1312da8..74c2bad24de 100644 --- a/src/test/ui/span/send-is-not-static-std-sync.stderr +++ b/src/test/ui/span/send-is-not-static-std-sync.stderr @@ -1,5 +1,5 @@ error[E0597]: `z` does not live long enough - --> $DIR/send-is-not-static-std-sync.rs:26:34 + --> $DIR/send-is-not-static-std-sync.rs:16:34 | LL | *lock.lock().unwrap() = &z; | ^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } | - borrowed value needs to live until here error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/send-is-not-static-std-sync.rs:23:10 + --> $DIR/send-is-not-static-std-sync.rs:13:10 | LL | *lock.lock().unwrap() = &*y; | -- borrow of `*y` occurs here @@ -18,7 +18,7 @@ LL | drop(y); //~ ERROR cannot move out | ^ move out of `y` occurs here error[E0597]: `z` does not live long enough - --> $DIR/send-is-not-static-std-sync.rs:40:35 + --> $DIR/send-is-not-static-std-sync.rs:30:35 | LL | *lock.write().unwrap() = &z; | ^ borrowed value does not live long enough @@ -29,7 +29,7 @@ LL | } | - borrowed value needs to live until here error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/send-is-not-static-std-sync.rs:37:10 + --> $DIR/send-is-not-static-std-sync.rs:27:10 | LL | *lock.write().unwrap() = &*y; | -- borrow of `*y` occurs here @@ -37,7 +37,7 @@ LL | drop(y); //~ ERROR cannot move out | ^ move out of `y` occurs here error[E0597]: `z` does not live long enough - --> $DIR/send-is-not-static-std-sync.rs:56:18 + --> $DIR/send-is-not-static-std-sync.rs:46:18 | LL | tx.send(&z).unwrap(); | ^ borrowed value does not live long enough @@ -48,7 +48,7 @@ LL | } | - borrowed value needs to live until here error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/send-is-not-static-std-sync.rs:53:10 + --> $DIR/send-is-not-static-std-sync.rs:43:10 | LL | tx.send(&*y); | -- borrow of `*y` occurs here diff --git a/src/test/ui/span/slice-borrow.nll.stderr b/src/test/ui/span/slice-borrow.nll.stderr index 71e53e876a6..84d0c847b7b 100644 --- a/src/test/ui/span/slice-borrow.nll.stderr +++ b/src/test/ui/span/slice-borrow.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/slice-borrow.rs:16:28 + --> $DIR/slice-borrow.rs:6:28 | LL | let x: &[isize] = &vec![1, 2, 3, 4, 5]; | ^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/span/slice-borrow.rs b/src/test/ui/span/slice-borrow.rs index 27765fe56fd..23e53039e94 100644 --- a/src/test/ui/span/slice-borrow.rs +++ b/src/test/ui/span/slice-borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test slicing expressions doesn't defeat the borrow checker. fn main() { diff --git a/src/test/ui/span/slice-borrow.stderr b/src/test/ui/span/slice-borrow.stderr index cdcb65bf9f1..a03cac58e2e 100644 --- a/src/test/ui/span/slice-borrow.stderr +++ b/src/test/ui/span/slice-borrow.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/slice-borrow.rs:16:28 + --> $DIR/slice-borrow.rs:6:28 | LL | let x: &[isize] = &vec![1, 2, 3, 4, 5]; | ^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/span/suggestion-non-ascii.rs b/src/test/ui/span/suggestion-non-ascii.rs index 2d82bba33c5..74032cf0266 100644 --- a/src/test/ui/span/suggestion-non-ascii.rs +++ b/src/test/ui/span/suggestion-non-ascii.rs @@ -1,14 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn main() { let tup = (1,); println!("☃{}", tup[0]); //~ ERROR cannot index into a value of type diff --git a/src/test/ui/span/suggestion-non-ascii.stderr b/src/test/ui/span/suggestion-non-ascii.stderr index f74d4a5caef..40b11695d75 100644 --- a/src/test/ui/span/suggestion-non-ascii.stderr +++ b/src/test/ui/span/suggestion-non-ascii.stderr @@ -1,5 +1,5 @@ error[E0608]: cannot index into a value of type `({integer},)` - --> $DIR/suggestion-non-ascii.rs:14:21 + --> $DIR/suggestion-non-ascii.rs:3:21 | LL | println!("☃{}", tup[0]); //~ ERROR cannot index into a value of type | ^^^^^^ help: to access tuple elements, use: `tup.0` diff --git a/src/test/ui/span/type-binding.rs b/src/test/ui/span/type-binding.rs index d8a2e332a03..32016e1278f 100644 --- a/src/test/ui/span/type-binding.rs +++ b/src/test/ui/span/type-binding.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #28158 // Test the type binding span doesn't include >> diff --git a/src/test/ui/span/type-binding.stderr b/src/test/ui/span/type-binding.stderr index d8bfdff142b..421af67d19c 100644 --- a/src/test/ui/span/type-binding.stderr +++ b/src/test/ui/span/type-binding.stderr @@ -1,5 +1,5 @@ error[E0220]: associated type `Trget` not found for `std::ops::Deref` - --> $DIR/type-binding.rs:16:20 + --> $DIR/type-binding.rs:6:20 | LL | fn homura>(_: T) {} | ^^^^^^^^^^^ associated type `Trget` not found diff --git a/src/test/ui/span/typo-suggestion.rs b/src/test/ui/span/typo-suggestion.rs index 7aeaa44bec2..e9d7bc65ef5 100644 --- a/src/test/ui/span/typo-suggestion.rs +++ b/src/test/ui/span/typo-suggestion.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let foo = 1; diff --git a/src/test/ui/span/typo-suggestion.stderr b/src/test/ui/span/typo-suggestion.stderr index 0ac3a94e712..7b12c4430ed 100644 --- a/src/test/ui/span/typo-suggestion.stderr +++ b/src/test/ui/span/typo-suggestion.stderr @@ -1,14 +1,14 @@ error[E0425]: cannot find value `bar` in this scope - --> $DIR/typo-suggestion.rs:15:26 + --> $DIR/typo-suggestion.rs:5:26 | LL | println!("Hello {}", bar); //~ ERROR cannot find value | ^^^ not found in this scope error[E0425]: cannot find value `fob` in this scope - --> $DIR/typo-suggestion.rs:18:26 + --> $DIR/typo-suggestion.rs:8:26 | LL | println!("Hello {}", fob); //~ ERROR cannot find value - | ^^^ did you mean `foo`? + | ^^^ help: a local variable with a similar name exists: `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/span/unused-warning-point-at-signature.rs b/src/test/ui/span/unused-warning-point-at-signature.rs index c074f03db46..3af272a012e 100644 --- a/src/test/ui/span/unused-warning-point-at-signature.rs +++ b/src/test/ui/span/unused-warning-point-at-signature.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass #![warn(unused)] diff --git a/src/test/ui/span/unused-warning-point-at-signature.stderr b/src/test/ui/span/unused-warning-point-at-signature.stderr index 8344853d6de..e07548121b5 100644 --- a/src/test/ui/span/unused-warning-point-at-signature.stderr +++ b/src/test/ui/span/unused-warning-point-at-signature.stderr @@ -1,30 +1,30 @@ warning: enum is never used: `Enum` - --> $DIR/unused-warning-point-at-signature.rs:15:1 + --> $DIR/unused-warning-point-at-signature.rs:5:1 | LL | enum Enum { //~ WARN enum is never used | ^^^^^^^^^ | note: lint level defined here - --> $DIR/unused-warning-point-at-signature.rs:13:9 + --> $DIR/unused-warning-point-at-signature.rs:3:9 | LL | #![warn(unused)] | ^^^^^^ = note: #[warn(dead_code)] implied by #[warn(unused)] warning: struct is never constructed: `Struct` - --> $DIR/unused-warning-point-at-signature.rs:22:1 + --> $DIR/unused-warning-point-at-signature.rs:12:1 | LL | struct Struct { //~ WARN struct is never constructed | ^^^^^^^^^^^^^ warning: function is never used: `func` - --> $DIR/unused-warning-point-at-signature.rs:29:1 + --> $DIR/unused-warning-point-at-signature.rs:19:1 | LL | fn func() -> usize { //~ WARN function is never used | ^^^^^^^^^^^^^^^^^^ warning: function is never used: `func_complete_span` - --> $DIR/unused-warning-point-at-signature.rs:33:1 + --> $DIR/unused-warning-point-at-signature.rs:23:1 | LL | / fn //~ WARN function is never used LL | | func_complete_span() diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr b/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr index 7ad7a1b0bcd..c5e2ca2e28f 100644 --- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr +++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `c2` does not live long enough - --> $DIR/vec-must-not-hide-type-from-dropck.rs:127:24 + --> $DIR/vec-must-not-hide-type-from-dropck.rs:117:24 | LL | c1.v[0].v.set(Some(&c2)); | ^^^ borrowed value does not live long enough @@ -13,7 +13,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are defined error[E0597]: `c1` does not live long enough - --> $DIR/vec-must-not-hide-type-from-dropck.rs:129:24 + --> $DIR/vec-must-not-hide-type-from-dropck.rs:119:24 | LL | c2.v[0].v.set(Some(&c1)); | ^^^ borrowed value does not live long enough diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs b/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs index 3cf07b8b098..9bfbfab06a0 100644 --- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs +++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checking that `Vec` cannot hide lifetimes within `T` when `T` // implements `Drop` and might access methods of values that have // since been deallocated. diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr b/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr index b461f74c759..1eee88ad21a 100644 --- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr +++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr @@ -1,5 +1,5 @@ error[E0597]: `c2` does not live long enough - --> $DIR/vec-must-not-hide-type-from-dropck.rs:127:25 + --> $DIR/vec-must-not-hide-type-from-dropck.rs:117:25 | LL | c1.v[0].v.set(Some(&c2)); | ^^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `c1` does not live long enough - --> $DIR/vec-must-not-hide-type-from-dropck.rs:129:25 + --> $DIR/vec-must-not-hide-type-from-dropck.rs:119:25 | LL | c2.v[0].v.set(Some(&c1)); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/vec_refs_data_with_early_death.nll.stderr b/src/test/ui/span/vec_refs_data_with_early_death.nll.stderr index 562544c7916..684e7845313 100644 --- a/src/test/ui/span/vec_refs_data_with_early_death.nll.stderr +++ b/src/test/ui/span/vec_refs_data_with_early_death.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/vec_refs_data_with_early_death.rs:27:12 + --> $DIR/vec_refs_data_with_early_death.rs:17:12 | LL | v.push(&x); | ^^ borrowed value does not live long enough @@ -13,7 +13,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are defined error[E0597]: `y` does not live long enough - --> $DIR/vec_refs_data_with_early_death.rs:29:12 + --> $DIR/vec_refs_data_with_early_death.rs:19:12 | LL | v.push(&y); | ^^ borrowed value does not live long enough diff --git a/src/test/ui/span/vec_refs_data_with_early_death.rs b/src/test/ui/span/vec_refs_data_with_early_death.rs index 9febeaaee46..c23c5211549 100644 --- a/src/test/ui/span/vec_refs_data_with_early_death.rs +++ b/src/test/ui/span/vec_refs_data_with_early_death.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test is a simple example of code that violates the dropck // rules: it pushes `&x` and `&y` into a bag (with dtor), but the // referenced data will be dropped before the bag is. diff --git a/src/test/ui/span/vec_refs_data_with_early_death.stderr b/src/test/ui/span/vec_refs_data_with_early_death.stderr index 0dd7288ce64..65fd6b50643 100644 --- a/src/test/ui/span/vec_refs_data_with_early_death.stderr +++ b/src/test/ui/span/vec_refs_data_with_early_death.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/vec_refs_data_with_early_death.rs:27:13 + --> $DIR/vec_refs_data_with_early_death.rs:17:13 | LL | v.push(&x); | ^ borrowed value does not live long enough @@ -10,7 +10,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0597]: `y` does not live long enough - --> $DIR/vec_refs_data_with_early_death.rs:29:13 + --> $DIR/vec_refs_data_with_early_death.rs:19:13 | LL | v.push(&y); | ^ borrowed value does not live long enough diff --git a/src/test/ui/span/visibility-ty-params.rs b/src/test/ui/span/visibility-ty-params.rs index 5df28971e99..d77febe0aa2 100644 --- a/src/test/ui/span/visibility-ty-params.rs +++ b/src/test/ui/span/visibility-ty-params.rs @@ -1,19 +1,10 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! m { ($p: path) => (pub(in $p) struct Z;) } struct S(T); m!{ S } //~ ERROR unexpected generic arguments in path + //~| ERROR expected module, found struct `S` mod m { m!{ m<> } //~ ERROR unexpected generic arguments in path diff --git a/src/test/ui/span/visibility-ty-params.stderr b/src/test/ui/span/visibility-ty-params.stderr index 7719bd48c85..d7914528f46 100644 --- a/src/test/ui/span/visibility-ty-params.stderr +++ b/src/test/ui/span/visibility-ty-params.stderr @@ -1,14 +1,23 @@ error: unexpected generic arguments in path - --> $DIR/visibility-ty-params.rs:16:5 + --> $DIR/visibility-ty-params.rs:6:5 | LL | m!{ S } //~ ERROR unexpected generic arguments in path | ^^^^^ error: unexpected generic arguments in path - --> $DIR/visibility-ty-params.rs:19:9 + --> $DIR/visibility-ty-params.rs:10:9 | LL | m!{ m<> } //~ ERROR unexpected generic arguments in path | ^^^ -error: aborting due to 2 previous errors +error[E0577]: expected module, found struct `S` + --> $DIR/visibility-ty-params.rs:6:5 + | +LL | m!{ S } //~ ERROR unexpected generic arguments in path + | -^^^^ + | | + | help: a module with a similar name exists: `m` + +error: aborting due to 3 previous errors +For more information about this error, try `rustc --explain E0577`. diff --git a/src/test/ui/span/wf-method-late-bound-regions.nll.stderr b/src/test/ui/span/wf-method-late-bound-regions.nll.stderr index 85eb348257b..6b0b008208f 100644 --- a/src/test/ui/span/wf-method-late-bound-regions.nll.stderr +++ b/src/test/ui/span/wf-method-late-bound-regions.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `pointer` does not live long enough - --> $DIR/wf-method-late-bound-regions.rs:30:18 + --> $DIR/wf-method-late-bound-regions.rs:20:18 | LL | let dangling = { | -------- borrow later stored here diff --git a/src/test/ui/span/wf-method-late-bound-regions.rs b/src/test/ui/span/wf-method-late-bound-regions.rs index d58c29d4a32..ca9f73d0acc 100644 --- a/src/test/ui/span/wf-method-late-bound-regions.rs +++ b/src/test/ui/span/wf-method-late-bound-regions.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A method's receiver must be well-formed, even if it has late-bound regions. // Because of this, a method's substs being well-formed does not imply that // the method's implied bounds are met. diff --git a/src/test/ui/span/wf-method-late-bound-regions.stderr b/src/test/ui/span/wf-method-late-bound-regions.stderr index f455707366a..a30e0f4d7e0 100644 --- a/src/test/ui/span/wf-method-late-bound-regions.stderr +++ b/src/test/ui/span/wf-method-late-bound-regions.stderr @@ -1,5 +1,5 @@ error[E0597]: `pointer` does not live long enough - --> $DIR/wf-method-late-bound-regions.rs:30:19 + --> $DIR/wf-method-late-bound-regions.rs:20:19 | LL | f2.xmute(&pointer) | ^^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.rs b/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.rs index 5bab4c5438e..89158b65a6e 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.rs +++ b/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that specialization must be ungated to use the `default` keyword trait Foo { diff --git a/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr b/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr index d92466967e1..3b3076cc672 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr @@ -1,5 +1,5 @@ error[E0658]: specialization is unstable (see issue #31844) - --> $DIR/specialization-feature-gate-default.rs:17:1 + --> $DIR/specialization-feature-gate-default.rs:7:1 | LL | / default impl Foo for T { //~ ERROR specialization is unstable LL | | fn foo(&self) {} diff --git a/src/test/ui/specialization/defaultimpl/specialization-no-default.rs b/src/test/ui/specialization/defaultimpl/specialization-no-default.rs index 2874108157d..7ea79a9a7bf 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-no-default.rs +++ b/src/test/ui/specialization/defaultimpl/specialization-no-default.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] // Check a number of scenarios in which one impl tries to override another, diff --git a/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr b/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr index 98f5e6d619e..7ca9df9f5d9 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr @@ -1,5 +1,5 @@ error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:32:5 + --> $DIR/specialization-no-default.rs:22:5 | LL | / impl Foo for T { LL | | fn foo(&self) {} @@ -13,7 +13,7 @@ LL | fn foo(&self) {} //~ ERROR E0520 = note: to specialize, `foo` in the parent `impl` must be marked `default` error[E0520]: `bar` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:35:5 + --> $DIR/specialization-no-default.rs:25:5 | LL | / impl Foo for T { LL | | fn foo(&self) {} @@ -27,7 +27,7 @@ LL | fn bar(&self) {} //~ ERROR E0520 = note: to specialize, `bar` in the parent `impl` must be marked `default` error[E0520]: `T` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:51:5 + --> $DIR/specialization-no-default.rs:41:5 | LL | / impl Bar for T { LL | | type T = u8; @@ -40,7 +40,7 @@ LL | type T = (); //~ ERROR E0520 = note: to specialize, `T` in the parent `impl` must be marked `default` error[E0520]: `baz` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:71:5 + --> $DIR/specialization-no-default.rs:61:5 | LL | / impl Baz for T { LL | | fn baz(&self) {} @@ -53,7 +53,7 @@ LL | fn baz(&self) {} //~ ERROR E0520 = note: to specialize, `baz` in the parent `impl` must be marked `default` error[E0520]: `redundant` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:92:5 + --> $DIR/specialization-no-default.rs:82:5 | LL | / impl Redundant for T { LL | | fn redundant(&self) {} diff --git a/src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.rs b/src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.rs index eacec2e40f0..2a121e61aaa 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.rs +++ b/src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that default impls do not have to supply all items but regular impls do. #![feature(specialization)] diff --git a/src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.stderr b/src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.stderr index c3c2a9840ad..b862a937066 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.stderr @@ -1,5 +1,5 @@ error[E0046]: not all trait items implemented, missing: `foo_two` - --> $DIR/specialization-trait-item-not-implemented.rs:28:1 + --> $DIR/specialization-trait-item-not-implemented.rs:18:1 | LL | fn foo_two(&self) -> &'static str; | ---------------------------------- `foo_two` from trait diff --git a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.rs b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.rs index 04ddf9ebb17..34a14168573 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.rs +++ b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that: // - default impls do not have to supply all items and // - a default impl does not count as an impl (in this case, an incomplete default impl). diff --git a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr index bc597e9f30c..c14fc04f631 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `foo_one` found for type `MyStruct` in the current scope - --> $DIR/specialization-trait-not-implemented.rs:32:29 + --> $DIR/specialization-trait-not-implemented.rs:22:29 | LL | struct MyStruct; | ---------------- method `foo_one` not found for this diff --git a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.rs b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.rs index 445a59a373e..232338d9d4d 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.rs +++ b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that a default impl still has to have a WF trait ref. #![feature(specialization)] diff --git a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr index a623e9708cd..45951561e72 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `U: std::cmp::Eq` is not satisfied - --> $DIR/specialization-wfcheck.rs:17:17 + --> $DIR/specialization-wfcheck.rs:7:17 | LL | default impl Foo<'static, U> for () {} | ^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `U` diff --git a/src/test/ui/specialization/defaultimpl/validation.rs b/src/test/ui/specialization/defaultimpl/validation.rs index 068eb7a4485..cf5d6628054 100644 --- a/src/test/ui/specialization/defaultimpl/validation.rs +++ b/src/test/ui/specialization/defaultimpl/validation.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] #![feature(specialization)] diff --git a/src/test/ui/specialization/defaultimpl/validation.stderr b/src/test/ui/specialization/defaultimpl/validation.stderr index c25c428eb4e..2778cac7ae5 100644 --- a/src/test/ui/specialization/defaultimpl/validation.stderr +++ b/src/test/ui/specialization/defaultimpl/validation.stderr @@ -1,5 +1,5 @@ error: inherent impls cannot be default - --> $DIR/validation.rs:17:1 + --> $DIR/validation.rs:7:1 | LL | default impl S {} //~ ERROR inherent impls cannot be default | ^^^^^^^^^^^^^^^^^ @@ -7,19 +7,19 @@ LL | default impl S {} //~ ERROR inherent impls cannot be default = note: only trait implementations may be annotated with default error: impls of auto traits cannot be default - --> $DIR/validation.rs:19:1 + --> $DIR/validation.rs:9:1 | LL | default unsafe impl Send for S {} //~ ERROR impls of auto traits cannot be default | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: impls of auto traits cannot be default - --> $DIR/validation.rs:20:1 + --> $DIR/validation.rs:10:1 | LL | default impl !Send for Z {} //~ ERROR impls of auto traits cannot be default | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) - --> $DIR/validation.rs:23:1 + --> $DIR/validation.rs:13:1 | LL | default impl !Tr for S {} //~ ERROR negative impls are only allowed for auto traits | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/specialization/issue-52050.rs b/src/test/ui/specialization/issue-52050.rs index 00d8d126e05..1e1bfe9cf07 100644 --- a/src/test/ui/specialization/issue-52050.rs +++ b/src/test/ui/specialization/issue-52050.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] // Regression test for #52050: when inserting the blanket impl `I` diff --git a/src/test/ui/specialization/issue-52050.stderr b/src/test/ui/specialization/issue-52050.stderr index eee571f8f46..9187d04cfce 100644 --- a/src/test/ui/specialization/issue-52050.stderr +++ b/src/test/ui/specialization/issue-52050.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `IntoPyDictPointer` for type `()`: - --> $DIR/issue-52050.rs:38:1 + --> $DIR/issue-52050.rs:28:1 | LL | / impl IntoPyDictPointer for I LL | | where diff --git a/src/test/ui/specialization/specialization-default-projection.rs b/src/test/ui/specialization/specialization-default-projection.rs index 96cbd7a4852..e9343f23601 100644 --- a/src/test/ui/specialization/specialization-default-projection.rs +++ b/src/test/ui/specialization/specialization-default-projection.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] // Make sure we can't project defaulted associated types diff --git a/src/test/ui/specialization/specialization-default-projection.stderr b/src/test/ui/specialization/specialization-default-projection.stderr index 38b51394711..b781c35ea39 100644 --- a/src/test/ui/specialization/specialization-default-projection.stderr +++ b/src/test/ui/specialization/specialization-default-projection.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/specialization-default-projection.rs:31:5 + --> $DIR/specialization-default-projection.rs:21:5 | LL | fn generic() -> ::Assoc { | ----------------- expected `::Assoc` because of return type @@ -11,7 +11,7 @@ LL | () //~ ERROR mismatched types found type `()` error[E0308]: mismatched types - --> $DIR/specialization-default-projection.rs:38:5 + --> $DIR/specialization-default-projection.rs:28:5 | LL | fn monomorphic() -> () { | -- expected `()` because of return type diff --git a/src/test/ui/specialization/specialization-default-types.rs b/src/test/ui/specialization/specialization-default-types.rs index 18acecb4229..acb86d889d4 100644 --- a/src/test/ui/specialization/specialization-default-types.rs +++ b/src/test/ui/specialization/specialization-default-types.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // It should not be possible to use the concrete value of a defaulted // associated type in the impl defining it -- otherwise, what happens // if it's overridden? diff --git a/src/test/ui/specialization/specialization-default-types.stderr b/src/test/ui/specialization/specialization-default-types.stderr index a9abc1f6ab5..3b4ae2d8217 100644 --- a/src/test/ui/specialization/specialization-default-types.stderr +++ b/src/test/ui/specialization/specialization-default-types.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/specialization-default-types.rs:25:9 + --> $DIR/specialization-default-types.rs:15:9 | LL | default fn generate(self) -> Self::Output { | ------------ expected `::Output` because of return type @@ -10,7 +10,7 @@ LL | Box::new(self) //~ ERROR mismatched types found type `std::boxed::Box` error[E0308]: mismatched types - --> $DIR/specialization-default-types.rs:35:5 + --> $DIR/specialization-default-types.rs:25:5 | LL | fn trouble(t: T) -> Box { | ------ expected `std::boxed::Box` because of return type diff --git a/src/test/ui/specialization/specialization-feature-gate-default.rs b/src/test/ui/specialization/specialization-feature-gate-default.rs index 3a01ecdf9db..8bad3ac0a1f 100644 --- a/src/test/ui/specialization/specialization-feature-gate-default.rs +++ b/src/test/ui/specialization/specialization-feature-gate-default.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that specialization must be ungated to use the `default` keyword // gate-test-specialization diff --git a/src/test/ui/specialization/specialization-feature-gate-default.stderr b/src/test/ui/specialization/specialization-feature-gate-default.stderr index 30548bb2450..13d656bd060 100644 --- a/src/test/ui/specialization/specialization-feature-gate-default.stderr +++ b/src/test/ui/specialization/specialization-feature-gate-default.stderr @@ -1,5 +1,5 @@ error[E0658]: specialization is unstable (see issue #31844) - --> $DIR/specialization-feature-gate-default.rs:20:5 + --> $DIR/specialization-feature-gate-default.rs:10:5 | LL | default fn foo(&self) {} //~ ERROR specialization is unstable | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/specialization/specialization-feature-gate-overlap.rs b/src/test/ui/specialization/specialization-feature-gate-overlap.rs index 5eb48eab15e..b83c84ab82c 100644 --- a/src/test/ui/specialization/specialization-feature-gate-overlap.rs +++ b/src/test/ui/specialization/specialization-feature-gate-overlap.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that writing an overlapping impl is not allow unless specialization is ungated. // gate-test-specialization diff --git a/src/test/ui/specialization/specialization-feature-gate-overlap.stderr b/src/test/ui/specialization/specialization-feature-gate-overlap.stderr index bb2d071c93d..d6714375d16 100644 --- a/src/test/ui/specialization/specialization-feature-gate-overlap.stderr +++ b/src/test/ui/specialization/specialization-feature-gate-overlap.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Foo` for type `u8`: - --> $DIR/specialization-feature-gate-overlap.rs:23:1 + --> $DIR/specialization-feature-gate-overlap.rs:13:1 | LL | impl Foo for T { | ----------------- first implementation here diff --git a/src/test/ui/specialization/specialization-no-default.rs b/src/test/ui/specialization/specialization-no-default.rs index 96156168543..29afbbd9bf2 100644 --- a/src/test/ui/specialization/specialization-no-default.rs +++ b/src/test/ui/specialization/specialization-no-default.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] // Check a number of scenarios in which one impl tries to override another, diff --git a/src/test/ui/specialization/specialization-no-default.stderr b/src/test/ui/specialization/specialization-no-default.stderr index 880c2e5d6f4..c57f98ac74d 100644 --- a/src/test/ui/specialization/specialization-no-default.stderr +++ b/src/test/ui/specialization/specialization-no-default.stderr @@ -1,5 +1,5 @@ error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:32:5 + --> $DIR/specialization-no-default.rs:22:5 | LL | / impl Foo for T { LL | | fn foo(&self) {} @@ -13,7 +13,7 @@ LL | fn foo(&self) {} //~ ERROR E0520 = note: to specialize, `foo` in the parent `impl` must be marked `default` error[E0520]: `bar` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:35:5 + --> $DIR/specialization-no-default.rs:25:5 | LL | / impl Foo for T { LL | | fn foo(&self) {} @@ -27,7 +27,7 @@ LL | fn bar(&self) {} //~ ERROR E0520 = note: to specialize, `bar` in the parent `impl` must be marked `default` error[E0520]: `T` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:51:5 + --> $DIR/specialization-no-default.rs:41:5 | LL | / impl Bar for T { LL | | type T = u8; @@ -40,7 +40,7 @@ LL | type T = (); //~ ERROR E0520 = note: to specialize, `T` in the parent `impl` must be marked `default` error[E0520]: `baz` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:71:5 + --> $DIR/specialization-no-default.rs:61:5 | LL | / impl Baz for T { LL | | fn baz(&self) {} @@ -53,7 +53,7 @@ LL | fn baz(&self) {} //~ ERROR E0520 = note: to specialize, `baz` in the parent `impl` must be marked `default` error[E0520]: `redundant` specializes an item from a parent `impl`, but that item is not marked `default` - --> $DIR/specialization-no-default.rs:92:5 + --> $DIR/specialization-no-default.rs:82:5 | LL | / impl Redundant for T { LL | | fn redundant(&self) {} diff --git a/src/test/ui/specialization/specialization-overlap-negative.rs b/src/test/ui/specialization/specialization-overlap-negative.rs index 62a6d8d9b50..af80d6686e3 100644 --- a/src/test/ui/specialization/specialization-overlap-negative.rs +++ b/src/test/ui/specialization/specialization-overlap-negative.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] #![feature(specialization)] diff --git a/src/test/ui/specialization/specialization-overlap-negative.stderr b/src/test/ui/specialization/specialization-overlap-negative.stderr index 2b85ba54e90..b9ab1bd637c 100644 --- a/src/test/ui/specialization/specialization-overlap-negative.stderr +++ b/src/test/ui/specialization/specialization-overlap-negative.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<_>`: - --> $DIR/specialization-overlap-negative.rs:19:1 + --> $DIR/specialization-overlap-negative.rs:9:1 | LL | unsafe impl Send for TestType {} | ------------------------------------------ first implementation here diff --git a/src/test/ui/specialization/specialization-overlap.rs b/src/test/ui/specialization/specialization-overlap.rs index ff12a82db5b..c8ef8d61c1e 100644 --- a/src/test/ui/specialization/specialization-overlap.rs +++ b/src/test/ui/specialization/specialization-overlap.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(specialization)] trait Foo { fn foo() {} } diff --git a/src/test/ui/specialization/specialization-overlap.stderr b/src/test/ui/specialization/specialization-overlap.stderr index 6830b7de473..eef8cb44b88 100644 --- a/src/test/ui/specialization/specialization-overlap.stderr +++ b/src/test/ui/specialization/specialization-overlap.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Foo` for type `std::vec::Vec<_>`: - --> $DIR/specialization-overlap.rs:15:1 + --> $DIR/specialization-overlap.rs:5:1 | LL | impl Foo for T {} | ------------------------ first implementation here @@ -7,7 +7,7 @@ LL | impl Foo for Vec {} //~ ERROR E0119 | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::vec::Vec<_>` error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`: - --> $DIR/specialization-overlap.rs:19:1 + --> $DIR/specialization-overlap.rs:9:1 | LL | impl Bar for (T, u8) {} | ----------------------- first implementation here @@ -15,7 +15,7 @@ LL | impl Bar for (u8, T) {} //~ ERROR E0119 | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)` error[E0119]: conflicting implementations of trait `Baz` for type `u8`: - --> $DIR/specialization-overlap.rs:23:1 + --> $DIR/specialization-overlap.rs:13:1 | LL | impl Baz for u8 {} | --------------------- first implementation here @@ -23,7 +23,7 @@ LL | impl Baz for T {} //~ ERROR E0119 | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8` error[E0119]: conflicting implementations of trait `Qux`: - --> $DIR/specialization-overlap.rs:27:1 + --> $DIR/specialization-overlap.rs:17:1 | LL | impl Qux for T {} | ------------------------ first implementation here diff --git a/src/test/ui/specialization/specialization-polarity.rs b/src/test/ui/specialization/specialization-polarity.rs index b28a63c8293..d5744806745 100644 --- a/src/test/ui/specialization/specialization-polarity.rs +++ b/src/test/ui/specialization/specialization-polarity.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Make sure specialization cannot change impl polarity #![feature(optin_builtin_traits)] diff --git a/src/test/ui/specialization/specialization-polarity.stderr b/src/test/ui/specialization/specialization-polarity.stderr index a4627305885..d1f48b78864 100644 --- a/src/test/ui/specialization/specialization-polarity.stderr +++ b/src/test/ui/specialization/specialization-polarity.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Foo` for type `u8`: - --> $DIR/specialization-polarity.rs:19:1 + --> $DIR/specialization-polarity.rs:9:1 | LL | impl Foo for T {} | ----------------- first implementation here @@ -7,7 +7,7 @@ LL | impl !Foo for u8 {} //~ ERROR E0119 | ^^^^^^^^^^^^^^^^ conflicting implementation for `u8` error[E0119]: conflicting implementations of trait `Bar` for type `u8`: - --> $DIR/specialization-polarity.rs:24:1 + --> $DIR/specialization-polarity.rs:14:1 | LL | impl !Bar for T {} | ------------------ first implementation here diff --git a/src/test/ui/stability-attribute/auxiliary/stability_attribute_issue.rs b/src/test/ui/stability-attribute/auxiliary/stability_attribute_issue.rs index 1ee623c34fb..4e5333289c4 100644 --- a/src/test/ui/stability-attribute/auxiliary/stability_attribute_issue.rs +++ b/src/test/ui/stability-attribute/auxiliary/stability_attribute_issue.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(staged_api)] #![stable(feature = "stable_test_feature", since = "1.2.0")] diff --git a/src/test/ui/stability-attribute/stability-attribute-issue-43027.rs b/src/test/ui/stability-attribute/stability-attribute-issue-43027.rs index dac50db3fd9..596a6eb6ed3 100644 --- a/src/test/ui/stability-attribute/stability-attribute-issue-43027.rs +++ b/src/test/ui/stability-attribute/stability-attribute-issue-43027.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(staged_api)] #![stable(feature = "test", since = "0")] diff --git a/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr b/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr index bdfdd9ccc87..e123f420233 100644 --- a/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr @@ -1,5 +1,5 @@ error: This node does not have a stability attribute - --> $DIR/stability-attribute-issue-43027.rs:15:23 + --> $DIR/stability-attribute-issue-43027.rs:5:23 | LL | pub struct Reverse(pub T); //~ ERROR This node does not have a stability attribute | ^^^^^ diff --git a/src/test/ui/stability-attribute/stability-attribute-issue.rs b/src/test/ui/stability-attribute/stability-attribute-issue.rs index 754c6f792f9..fc4a7dab1af 100644 --- a/src/test/ui/stability-attribute/stability-attribute-issue.rs +++ b/src/test/ui/stability-attribute/stability-attribute-issue.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:stability_attribute_issue.rs // ignore-tidy-linelength diff --git a/src/test/ui/stability-attribute/stability-attribute-issue.stderr b/src/test/ui/stability-attribute/stability-attribute-issue.stderr index 15e91926a73..94fdc0db3d9 100644 --- a/src/test/ui/stability-attribute/stability-attribute-issue.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-issue.stderr @@ -1,5 +1,5 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' (see issue #1) - --> $DIR/stability-attribute-issue.rs:20:5 + --> $DIR/stability-attribute-issue.rs:10:5 | LL | unstable(); | ^^^^^^^^ @@ -7,7 +7,7 @@ LL | unstable(); = help: add #![feature(unstable_test_feature)] to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature': message (see issue #2) - --> $DIR/stability-attribute-issue.rs:22:5 + --> $DIR/stability-attribute-issue.rs:12:5 | LL | unstable_msg(); | ^^^^^^^^^^^^ diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs index 512fb24a0c2..1f0a7a8f8a5 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs @@ -1,16 +1,6 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags:-Zforce-unstable-if-unmarked -#[unstable] //~ ERROR: stability attributes may not be used -#[stable] //~ ERROR: stability attributes may not be used -#[rustc_deprecated] //~ ERROR: stability attributes may not be used +#[unstable()] //~ ERROR: stability attributes may not be used +#[stable()] //~ ERROR: stability attributes may not be used +#[rustc_deprecated()] //~ ERROR: stability attributes may not be used fn main() { } diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr index 479f2ff5095..cd8ea921d30 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr @@ -1,20 +1,20 @@ error: stability attributes may not be used outside of the standard library - --> $DIR/stability-attribute-non-staged-force-unstable.rs:13:1 + --> $DIR/stability-attribute-non-staged-force-unstable.rs:3:1 | -LL | #[unstable] //~ ERROR: stability attributes may not be used - | ^^^^^^^^^^^ +LL | #[unstable()] //~ ERROR: stability attributes may not be used + | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/stability-attribute-non-staged-force-unstable.rs:14:1 + --> $DIR/stability-attribute-non-staged-force-unstable.rs:4:1 | -LL | #[stable] //~ ERROR: stability attributes may not be used - | ^^^^^^^^^ +LL | #[stable()] //~ ERROR: stability attributes may not be used + | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/stability-attribute-non-staged-force-unstable.rs:15:1 + --> $DIR/stability-attribute-non-staged-force-unstable.rs:5:1 | -LL | #[rustc_deprecated] //~ ERROR: stability attributes may not be used - | ^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] //~ ERROR: stability attributes may not be used + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.rs b/src/test/ui/stability-attribute/stability-attribute-non-staged.rs index 35256f21f92..fc2c2b587fe 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged.rs +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.rs @@ -1,14 +1,4 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[unstable] //~ ERROR: stability attributes may not be used -#[stable] //~ ERROR: stability attributes may not be used -#[rustc_deprecated] //~ ERROR: stability attributes may not be used +#[unstable()] //~ ERROR: stability attributes may not be used +#[stable()] //~ ERROR: stability attributes may not be used +#[rustc_deprecated()] //~ ERROR: stability attributes may not be used fn main() { } diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr index f2a9879bd10..67f6ef857f1 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr @@ -1,20 +1,20 @@ error: stability attributes may not be used outside of the standard library - --> $DIR/stability-attribute-non-staged.rs:11:1 + --> $DIR/stability-attribute-non-staged.rs:1:1 | -LL | #[unstable] //~ ERROR: stability attributes may not be used - | ^^^^^^^^^^^ +LL | #[unstable()] //~ ERROR: stability attributes may not be used + | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/stability-attribute-non-staged.rs:12:1 + --> $DIR/stability-attribute-non-staged.rs:2:1 | -LL | #[stable] //~ ERROR: stability attributes may not be used - | ^^^^^^^^^ +LL | #[stable()] //~ ERROR: stability attributes may not be used + | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library - --> $DIR/stability-attribute-non-staged.rs:13:1 + --> $DIR/stability-attribute-non-staged.rs:3:1 | -LL | #[rustc_deprecated] //~ ERROR: stability attributes may not be used - | ^^^^^^^^^^^^^^^^^^^ +LL | #[rustc_deprecated()] //~ ERROR: stability attributes may not be used + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-2.rs b/src/test/ui/stability-attribute/stability-attribute-sanity-2.rs index 9c54315bfd0..5a67ca0b0c8 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-2.rs +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // More checks that stability attributes are used correctly #![feature(staged_api)] diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr index a9d70e25302..6f5c844a657 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr @@ -1,17 +1,17 @@ error[E0538]: multiple 'feature' items - --> $DIR/stability-attribute-sanity-2.rs:17:25 + --> $DIR/stability-attribute-sanity-2.rs:7:25 | LL | #[stable(feature = "a", feature = "b", since = "1.0.0")] //~ ERROR multiple 'feature' items | ^^^^^^^^^^^^^ error[E0541]: unknown meta item 'sinse' - --> $DIR/stability-attribute-sanity-2.rs:20:25 + --> $DIR/stability-attribute-sanity-2.rs:10:25 | LL | #[stable(feature = "a", sinse = "1.0.0")] //~ ERROR unknown meta item 'sinse' | ^^^^^^^^^^^^^^^ expected one of `since`, `note` error[E0545]: incorrect 'issue' - --> $DIR/stability-attribute-sanity-2.rs:23:1 + --> $DIR/stability-attribute-sanity-2.rs:13:1 | LL | #[unstable(feature = "a", issue = "no")] //~ ERROR incorrect 'issue' | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-3.rs b/src/test/ui/stability-attribute/stability-attribute-sanity-3.rs index d4821e009f2..0c132e88575 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-3.rs +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-3.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // More checks that stability attributes are used correctly #![feature(staged_api)] diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr index b5b5847e8e1..d42dcc0c778 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr @@ -1,5 +1,5 @@ error: This node does not have a stability attribute - --> $DIR/stability-attribute-sanity-3.rs:18:1 + --> $DIR/stability-attribute-sanity-3.rs:8:1 | LL | / macro_rules! mac { //~ ERROR This node does not have a stability attribute LL | | () => () diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs b/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs new file mode 100644 index 00000000000..3fd54bc02e4 --- /dev/null +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-4.rs @@ -0,0 +1,29 @@ +// Various checks that stability attributes are used correctly, per RFC 507 + +#![feature(staged_api)] + +#![stable(feature = "rust1", since = "1.0.0")] + +mod bogus_attribute_types_2 { + #[unstable] //~ ERROR attribute must be of the form + fn f1() { } + + #[unstable = "b"] //~ ERROR attribute must be of the form + fn f2() { } + + #[stable] //~ ERROR attribute must be of the form + fn f3() { } + + #[stable = "a"] //~ ERROR attribute must be of the form + fn f4() { } + + #[stable(feature = "a", since = "b")] + #[rustc_deprecated] //~ ERROR attribute must be of the form + fn f5() { } + + #[stable(feature = "a", since = "b")] + #[rustc_deprecated = "a"] //~ ERROR attribute must be of the form + fn f6() { } +} + +fn main() { } diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr new file mode 100644 index 00000000000..4b4efe9d8ca --- /dev/null +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr @@ -0,0 +1,38 @@ +error: attribute must be of the form `#[unstable(feature = "name", reason = "...", issue = "N")]` + --> $DIR/stability-attribute-sanity-4.rs:8:5 + | +LL | #[unstable] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^ + +error: attribute must be of the form `#[unstable(feature = "name", reason = "...", issue = "N")]` + --> $DIR/stability-attribute-sanity-4.rs:11:5 + | +LL | #[unstable = "b"] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[stable(feature = "name", since = "version")]` + --> $DIR/stability-attribute-sanity-4.rs:14:5 + | +LL | #[stable] //~ ERROR attribute must be of the form + | ^^^^^^^^^ + +error: attribute must be of the form `#[stable(feature = "name", since = "version")]` + --> $DIR/stability-attribute-sanity-4.rs:17:5 + | +LL | #[stable = "a"] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[rustc_deprecated(since = "version", reason = "...")]` + --> $DIR/stability-attribute-sanity-4.rs:21:5 + | +LL | #[rustc_deprecated] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^^^^ + +error: attribute must be of the form `#[rustc_deprecated(since = "version", reason = "...")]` + --> $DIR/stability-attribute-sanity-4.rs:25:5 + | +LL | #[rustc_deprecated = "a"] //~ ERROR attribute must be of the form + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.rs b/src/test/ui/stability-attribute/stability-attribute-sanity.rs index 794ae1ca087..aebdb3bdbf5 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity.rs +++ b/src/test/ui/stability-attribute/stability-attribute-sanity.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Various checks that stability attributes are used correctly, per RFC 507 #![feature(const_fn, staged_api, rustc_const_unstable)] @@ -31,28 +21,6 @@ mod bogus_attribute_types_1 { fn f6() { } } -mod bogus_attribute_types_2 { - #[unstable] //~ ERROR incorrect stability attribute type [E0548] - fn f1() { } - - #[unstable = "b"] //~ ERROR incorrect stability attribute type [E0548] - fn f2() { } - - #[stable] //~ ERROR incorrect stability attribute type [E0548] - fn f3() { } - - #[stable = "a"] //~ ERROR incorrect stability attribute type [E0548] - fn f4() { } - - #[stable(feature = "a", since = "b")] - #[rustc_deprecated] //~ ERROR incorrect stability attribute type [E0548] - fn f5() { } - - #[stable(feature = "a", since = "b")] - #[rustc_deprecated = "a"] //~ ERROR incorrect stability attribute type [E0548] - fn f6() { } -} - mod missing_feature_names { #[unstable(issue = "0")] //~ ERROR missing 'feature' [E0546] fn f1() { } diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr index f9d301f643d..74c1bbfed6f 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr @@ -1,142 +1,106 @@ error[E0541]: unknown meta item 'reason' - --> $DIR/stability-attribute-sanity.rs:18:42 + --> $DIR/stability-attribute-sanity.rs:8:42 | LL | #[stable(feature = "a", since = "b", reason)] //~ ERROR unknown meta item 'reason' [E0541] | ^^^^^^ expected one of `since`, `note` error[E0539]: incorrect meta item - --> $DIR/stability-attribute-sanity.rs:21:29 + --> $DIR/stability-attribute-sanity.rs:11:29 | LL | #[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539] | ^^^^^ error[E0539]: incorrect meta item - --> $DIR/stability-attribute-sanity.rs:24:14 + --> $DIR/stability-attribute-sanity.rs:14:14 | LL | #[stable(feature, since = "a")] //~ ERROR incorrect meta item [E0539] | ^^^^^^^ error[E0539]: incorrect meta item - --> $DIR/stability-attribute-sanity.rs:27:29 + --> $DIR/stability-attribute-sanity.rs:17:29 | LL | #[stable(feature = "a", since(b))] //~ ERROR incorrect meta item [E0539] | ^^^^^^^^ error[E0539]: incorrect meta item - --> $DIR/stability-attribute-sanity.rs:30:14 + --> $DIR/stability-attribute-sanity.rs:20:14 | LL | #[stable(feature(b), since = "a")] //~ ERROR incorrect meta item [E0539] | ^^^^^^^^^^ -error[E0548]: incorrect stability attribute type - --> $DIR/stability-attribute-sanity.rs:35:5 - | -LL | #[unstable] //~ ERROR incorrect stability attribute type [E0548] - | ^^^^^^^^^^^ - -error[E0548]: incorrect stability attribute type - --> $DIR/stability-attribute-sanity.rs:38:5 - | -LL | #[unstable = "b"] //~ ERROR incorrect stability attribute type [E0548] - | ^^^^^^^^^^^^^^^^^ - -error[E0548]: incorrect stability attribute type - --> $DIR/stability-attribute-sanity.rs:41:5 - | -LL | #[stable] //~ ERROR incorrect stability attribute type [E0548] - | ^^^^^^^^^ - -error[E0548]: incorrect stability attribute type - --> $DIR/stability-attribute-sanity.rs:44:5 - | -LL | #[stable = "a"] //~ ERROR incorrect stability attribute type [E0548] - | ^^^^^^^^^^^^^^^ - -error[E0548]: incorrect stability attribute type - --> $DIR/stability-attribute-sanity.rs:48:5 - | -LL | #[rustc_deprecated] //~ ERROR incorrect stability attribute type [E0548] - | ^^^^^^^^^^^^^^^^^^^ - -error[E0548]: incorrect stability attribute type - --> $DIR/stability-attribute-sanity.rs:52:5 - | -LL | #[rustc_deprecated = "a"] //~ ERROR incorrect stability attribute type [E0548] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0546]: missing 'feature' - --> $DIR/stability-attribute-sanity.rs:57:5 + --> $DIR/stability-attribute-sanity.rs:25:5 | LL | #[unstable(issue = "0")] //~ ERROR missing 'feature' [E0546] | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0547]: missing 'issue' - --> $DIR/stability-attribute-sanity.rs:60:5 + --> $DIR/stability-attribute-sanity.rs:28:5 | LL | #[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0546]: missing 'feature' - --> $DIR/stability-attribute-sanity.rs:63:5 + --> $DIR/stability-attribute-sanity.rs:31:5 | LL | #[stable(since = "a")] //~ ERROR missing 'feature' [E0546] | ^^^^^^^^^^^^^^^^^^^^^^ error[E0542]: missing 'since' - --> $DIR/stability-attribute-sanity.rs:68:5 + --> $DIR/stability-attribute-sanity.rs:36:5 | LL | #[stable(feature = "a")] //~ ERROR missing 'since' [E0542] | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0542]: missing 'since' - --> $DIR/stability-attribute-sanity.rs:72:5 + --> $DIR/stability-attribute-sanity.rs:40:5 | LL | #[rustc_deprecated(reason = "a")] //~ ERROR missing 'since' [E0542] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels - --> $DIR/stability-attribute-sanity.rs:77:1 + --> $DIR/stability-attribute-sanity.rs:45:1 | LL | #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels - --> $DIR/stability-attribute-sanity.rs:81:1 + --> $DIR/stability-attribute-sanity.rs:49:1 | LL | #[unstable(feature = "b", issue = "0")] //~ ERROR multiple stability levels [E0544] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels - --> $DIR/stability-attribute-sanity.rs:85:1 + --> $DIR/stability-attribute-sanity.rs:53:1 | LL | #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0540]: multiple rustc_deprecated attributes - --> $DIR/stability-attribute-sanity.rs:93:1 + --> $DIR/stability-attribute-sanity.rs:61:1 | LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0553]: multiple rustc_const_unstable attributes - --> $DIR/stability-attribute-sanity.rs:93:1 + --> $DIR/stability-attribute-sanity.rs:61:1 | LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Invalid stability or deprecation version found - --> $DIR/stability-attribute-sanity.rs:93:1 + --> $DIR/stability-attribute-sanity.rs:61:1 | LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0549]: rustc_deprecated attribute must be paired with either stable or unstable attribute - --> $DIR/stability-attribute-sanity.rs:98:1 + --> $DIR/stability-attribute-sanity.rs:66:1 | LL | fn deprecated_without_unstable_or_stable() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 23 previous errors +error: aborting due to 17 previous errors -Some errors occurred: E0539, E0540, E0541, E0542, E0544, E0546, E0547, E0548, E0549... +Some errors occurred: E0539, E0540, E0541, E0542, E0544, E0546, E0547, E0549, E0553. For more information about an error, try `rustc --explain E0539`. diff --git a/src/test/ui/stable-features.rs b/src/test/ui/stable-features.rs index 32991dd6499..ed7f0899d1c 100644 --- a/src/test/ui/stable-features.rs +++ b/src/test/ui/stable-features.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Testing that the stable_features lint catches use of stable // language and lib features. diff --git a/src/test/ui/stable-features.stderr b/src/test/ui/stable-features.stderr index 53d642c07e6..537c3f082ef 100644 --- a/src/test/ui/stable-features.stderr +++ b/src/test/ui/stable-features.stderr @@ -1,17 +1,17 @@ error: the feature `test_accepted_feature` has been stable since 1.0.0 and no longer requires an attribute to enable - --> $DIR/stable-features.rs:16:12 + --> $DIR/stable-features.rs:6:12 | LL | #![feature(test_accepted_feature)] | ^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/stable-features.rs:14:9 + --> $DIR/stable-features.rs:4:9 | LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ error: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable - --> $DIR/stable-features.rs:19:12 + --> $DIR/stable-features.rs:9:12 | LL | #![feature(rust1)] | ^^^^^ diff --git a/src/test/ui/static/auxiliary/static-priv-by-default.rs b/src/test/ui/static/auxiliary/static-priv-by-default.rs index 14299a9b639..41f368f46d6 100644 --- a/src/test/ui/static/auxiliary/static-priv-by-default.rs +++ b/src/test/ui/static/auxiliary/static-priv-by-default.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:static_priv_by_default.rs extern crate static_priv_by_default; diff --git a/src/test/ui/static/auxiliary/static_priv_by_default.rs b/src/test/ui/static/auxiliary/static_priv_by_default.rs index 73597e51f08..39f912066ec 100644 --- a/src/test/ui/static/auxiliary/static_priv_by_default.rs +++ b/src/test/ui/static/auxiliary/static_priv_by_default.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] static private: isize = 0; diff --git a/src/test/ui/static/static-closures.rs b/src/test/ui/static/static-closures.rs index 8593eb5333e..1bd518d6ffe 100644 --- a/src/test/ui/static/static-closures.rs +++ b/src/test/ui/static/static-closures.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { static || {}; //~^ ERROR closures cannot be static diff --git a/src/test/ui/static/static-closures.stderr b/src/test/ui/static/static-closures.stderr index 761d8374bcc..99235e26e15 100644 --- a/src/test/ui/static/static-closures.stderr +++ b/src/test/ui/static/static-closures.stderr @@ -1,5 +1,5 @@ error[E0697]: closures cannot be static - --> $DIR/static-closures.rs:12:5 + --> $DIR/static-closures.rs:2:5 | LL | static || {}; | ^^^^^^^^^ diff --git a/src/test/ui/static/static-drop-scope.nll.stderr b/src/test/ui/static/static-drop-scope.nll.stderr index 745f390a4f3..df6383b4fc2 100644 --- a/src/test/ui/static/static-drop-scope.nll.stderr +++ b/src/test/ui/static/static-drop-scope.nll.stderr @@ -1,11 +1,11 @@ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:19:60 + --> $DIR/static-drop-scope.rs:9:60 | LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); | ^^^^^^^^ statics cannot evaluate destructors error[E0716]: temporary value dropped while borrowed - --> $DIR/static-drop-scope.rs:19:60 + --> $DIR/static-drop-scope.rs:9:60 | LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); | ------^^^^^^^^- @@ -15,13 +15,13 @@ LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); | using this value as a static requires that borrow lasts for `'static` error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:23:59 + --> $DIR/static-drop-scope.rs:13:59 | LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); | ^^^^^^^^ constants cannot evaluate destructors error[E0716]: temporary value dropped while borrowed - --> $DIR/static-drop-scope.rs:23:59 + --> $DIR/static-drop-scope.rs:13:59 | LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); | ------^^^^^^^^- @@ -31,30 +31,42 @@ LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); | using this value as a constant requires that borrow lasts for `'static` error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:27:28 + --> $DIR/static-drop-scope.rs:17:28 | LL | static EARLY_DROP_S: i32 = (WithDtor, 0).1; | ^^^^^^^^^^^^^ statics cannot evaluate destructors error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:30:27 + --> $DIR/static-drop-scope.rs:20:27 | LL | const EARLY_DROP_C: i32 = (WithDtor, 0).1; | ^^^^^^^^^^^^^ constants cannot evaluate destructors error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:33:24 + --> $DIR/static-drop-scope.rs:23:24 | LL | const fn const_drop(_: T) {} | ^ constant functions cannot evaluate destructors error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:37:5 + --> $DIR/static-drop-scope.rs:27:5 | LL | (x, ()).1 | ^^^^^^^ constant functions cannot evaluate destructors -error: aborting due to 8 previous errors +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/static-drop-scope.rs:31:34 + | +LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1; + | ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors + +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/static-drop-scope.rs:36:43 + | +LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1; + | ^^^^^^^^^^^ constants cannot evaluate destructors + +error: aborting due to 10 previous errors Some errors occurred: E0493, E0716. For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/static/static-drop-scope.rs b/src/test/ui/static/static-drop-scope.rs index e22eb7e4484..e5a9f2a4056 100644 --- a/src/test/ui/static/static-drop-scope.rs +++ b/src/test/ui/static/static-drop-scope.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_fn)] struct WithDtor; @@ -38,4 +28,12 @@ const fn const_drop2(x: T) { //~^ ERROR destructors cannot be evaluated at compile-time } +const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1; +//~^ ERROR destructors cannot be evaluated at compile-time + +const HELPER: Option = Some(WithDtor); + +const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1; +//~^ ERROR destructors cannot be evaluated at compile-time + fn main () {} diff --git a/src/test/ui/static/static-drop-scope.stderr b/src/test/ui/static/static-drop-scope.stderr index ce158239370..3e3032eb4fb 100644 --- a/src/test/ui/static/static-drop-scope.stderr +++ b/src/test/ui/static/static-drop-scope.stderr @@ -1,11 +1,11 @@ error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:19:60 + --> $DIR/static-drop-scope.rs:9:60 | LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); | ^^^^^^^^ statics cannot evaluate destructors error[E0597]: borrowed value does not live long enough - --> $DIR/static-drop-scope.rs:19:60 + --> $DIR/static-drop-scope.rs:9:60 | LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); | ^^^^^^^^- temporary value only lives until here @@ -15,13 +15,13 @@ LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); = note: borrowed value must be valid for the static lifetime... error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:23:59 + --> $DIR/static-drop-scope.rs:13:59 | LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); | ^^^^^^^^ constants cannot evaluate destructors error[E0597]: borrowed value does not live long enough - --> $DIR/static-drop-scope.rs:23:59 + --> $DIR/static-drop-scope.rs:13:59 | LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); | ^^^^^^^^- temporary value only lives until here @@ -31,30 +31,42 @@ LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); = note: borrowed value must be valid for the static lifetime... error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:27:28 + --> $DIR/static-drop-scope.rs:17:28 | LL | static EARLY_DROP_S: i32 = (WithDtor, 0).1; | ^^^^^^^^^^^^^ statics cannot evaluate destructors error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:30:27 + --> $DIR/static-drop-scope.rs:20:27 | LL | const EARLY_DROP_C: i32 = (WithDtor, 0).1; | ^^^^^^^^^^^^^ constants cannot evaluate destructors error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:33:24 + --> $DIR/static-drop-scope.rs:23:24 | LL | const fn const_drop(_: T) {} | ^ constant functions cannot evaluate destructors error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/static-drop-scope.rs:37:5 + --> $DIR/static-drop-scope.rs:27:5 | LL | (x, ()).1 | ^^^^^^^ constant functions cannot evaluate destructors -error: aborting due to 8 previous errors +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/static-drop-scope.rs:31:34 + | +LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1; + | ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors + +error[E0493]: destructors cannot be evaluated at compile-time + --> $DIR/static-drop-scope.rs:36:43 + | +LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1; + | ^^^^^^^^^^^ constants cannot evaluate destructors + +error: aborting due to 10 previous errors Some errors occurred: E0493, E0597. For more information about an error, try `rustc --explain E0493`. diff --git a/src/test/ui/static/static-extern-type.rs b/src/test/ui/static/static-extern-type.rs index 72e2853b9f0..3666982b4e2 100644 --- a/src/test/ui/static/static-extern-type.rs +++ b/src/test/ui/static/static-extern-type.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(extern_types)] diff --git a/src/test/ui/static/static-items-cant-move.rs b/src/test/ui/static/static-items-cant-move.rs index c8fddeb1214..3e7aaa0b0ee 100644 --- a/src/test/ui/static/static-items-cant-move.rs +++ b/src/test/ui/static/static-items-cant-move.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Verifies that static items can't be moved struct B; diff --git a/src/test/ui/static/static-items-cant-move.stderr b/src/test/ui/static/static-items-cant-move.stderr index 254710b6b2e..1ac772a4601 100644 --- a/src/test/ui/static/static-items-cant-move.stderr +++ b/src/test/ui/static/static-items-cant-move.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of static item - --> $DIR/static-items-cant-move.rs:28:10 + --> $DIR/static-items-cant-move.rs:18:10 | LL | test(BAR); //~ ERROR cannot move out of static item | ^^^ cannot move out of static item diff --git a/src/test/ui/static/static-lifetime-bound.nll.stderr b/src/test/ui/static/static-lifetime-bound.nll.stderr index d195b4ce39a..9a8a344cbd8 100644 --- a/src/test/ui/static/static-lifetime-bound.nll.stderr +++ b/src/test/ui/static/static-lifetime-bound.nll.stderr @@ -1,5 +1,5 @@ warning: unnecessary lifetime parameter `'a` - --> $DIR/static-lifetime-bound.rs:11:6 + --> $DIR/static-lifetime-bound.rs:1:6 | LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a` | ^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a = help: you can use the `'static` lifetime directly, in place of `'a` error[E0597]: `x` does not live long enough - --> $DIR/static-lifetime-bound.rs:15:7 + --> $DIR/static-lifetime-bound.rs:5:7 | LL | f(&x); //~ERROR does not live long enough | --^^- diff --git a/src/test/ui/static/static-lifetime-bound.rs b/src/test/ui/static/static-lifetime-bound.rs index 38534ab0a36..b5da91ec3b6 100644 --- a/src/test/ui/static/static-lifetime-bound.rs +++ b/src/test/ui/static/static-lifetime-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a` fn main() { diff --git a/src/test/ui/static/static-lifetime-bound.stderr b/src/test/ui/static/static-lifetime-bound.stderr index 0ee2b665cf1..dc8e83610d4 100644 --- a/src/test/ui/static/static-lifetime-bound.stderr +++ b/src/test/ui/static/static-lifetime-bound.stderr @@ -1,5 +1,5 @@ warning: unnecessary lifetime parameter `'a` - --> $DIR/static-lifetime-bound.rs:11:6 + --> $DIR/static-lifetime-bound.rs:1:6 | LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a` | ^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a = help: you can use the `'static` lifetime directly, in place of `'a` error[E0597]: `x` does not live long enough - --> $DIR/static-lifetime-bound.rs:15:8 + --> $DIR/static-lifetime-bound.rs:5:8 | LL | f(&x); //~ERROR does not live long enough | ^ borrowed value does not live long enough diff --git a/src/test/ui/static/static-lifetime.rs b/src/test/ui/static/static-lifetime.rs index 62abf11654e..ce1eeb6105f 100644 --- a/src/test/ui/static/static-lifetime.rs +++ b/src/test/ui/static/static-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Arbitrary: Sized + 'static {} impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound diff --git a/src/test/ui/static/static-lifetime.stderr b/src/test/ui/static/static-lifetime.stderr index c38b8a96f9f..65c60ceb2e3 100644 --- a/src/test/ui/static/static-lifetime.stderr +++ b/src/test/ui/static/static-lifetime.stderr @@ -1,11 +1,11 @@ error[E0478]: lifetime bound not satisfied - --> $DIR/static-lifetime.rs:13:20 + --> $DIR/static-lifetime.rs:3:20 | LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound | ^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime 'a as defined on the impl at 13:6 - --> $DIR/static-lifetime.rs:13:6 +note: lifetime parameter instantiated with the lifetime 'a as defined on the impl at 3:6 + --> $DIR/static-lifetime.rs:3:6 | LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound | ^^ diff --git a/src/test/ui/static/static-method-privacy.rs b/src/test/ui/static/static-method-privacy.rs index 5e175aa0fee..b637037f60e 100644 --- a/src/test/ui/static/static-method-privacy.rs +++ b/src/test/ui/static/static-method-privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { pub struct S; impl S { diff --git a/src/test/ui/static/static-method-privacy.stderr b/src/test/ui/static/static-method-privacy.stderr index 783b72c8ed2..c72295f97ca 100644 --- a/src/test/ui/static/static-method-privacy.stderr +++ b/src/test/ui/static/static-method-privacy.stderr @@ -1,5 +1,5 @@ error[E0624]: method `new` is private - --> $DIR/static-method-privacy.rs:19:13 + --> $DIR/static-method-privacy.rs:9:13 | LL | let _ = a::S::new(); //~ ERROR method `new` is private | ^^^^^^^^^ diff --git a/src/test/ui/static/static-mut-bad-types.rs b/src/test/ui/static/static-mut-bad-types.rs index 088c8ef3ab8..8a98b1b7f76 100644 --- a/src/test/ui/static/static-mut-bad-types.rs +++ b/src/test/ui/static/static-mut-bad-types.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static mut a: isize = 3; fn main() { diff --git a/src/test/ui/static/static-mut-bad-types.stderr b/src/test/ui/static/static-mut-bad-types.stderr index f8bee22b181..e97165705ca 100644 --- a/src/test/ui/static/static-mut-bad-types.stderr +++ b/src/test/ui/static/static-mut-bad-types.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/static-mut-bad-types.rs:15:13 + --> $DIR/static-mut-bad-types.rs:5:13 | LL | a = true; //~ ERROR: mismatched types | ^^^^ expected isize, found bool diff --git a/src/test/ui/static/static-mut-foreign-requires-unsafe.rs b/src/test/ui/static/static-mut-foreign-requires-unsafe.rs index c6d744fa64d..535f6bc3226 100644 --- a/src/test/ui/static/static-mut-foreign-requires-unsafe.rs +++ b/src/test/ui/static/static-mut-foreign-requires-unsafe.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { static mut a: i32; } diff --git a/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr b/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr index 01cbe784b45..9964e1d98b1 100644 --- a/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr +++ b/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr @@ -1,5 +1,5 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:16:5 + --> $DIR/static-mut-foreign-requires-unsafe.rs:6:5 | LL | a += 3; //~ ERROR: requires unsafe | ^^^^^^ use of mutable static @@ -7,7 +7,7 @@ LL | a += 3; //~ ERROR: requires unsafe = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:17:5 + --> $DIR/static-mut-foreign-requires-unsafe.rs:7:5 | LL | a = 4; //~ ERROR: requires unsafe | ^^^^^ use of mutable static @@ -15,7 +15,7 @@ LL | a = 4; //~ ERROR: requires unsafe = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-foreign-requires-unsafe.rs:18:14 + --> $DIR/static-mut-foreign-requires-unsafe.rs:8:14 | LL | let _b = a; //~ ERROR: requires unsafe | ^ use of mutable static diff --git a/src/test/ui/static/static-mut-not-constant.rs b/src/test/ui/static/static-mut-not-constant.rs index 7e6ced12fe6..84d401c9fa6 100644 --- a/src/test/ui/static/static-mut-not-constant.rs +++ b/src/test/ui/static/static-mut-not-constant.rs @@ -1,16 +1,7 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] static mut a: Box = box 3; //~^ ERROR allocations are not allowed in statics +//~| ERROR static contains unimplemented expression type fn main() {} diff --git a/src/test/ui/static/static-mut-not-constant.stderr b/src/test/ui/static/static-mut-not-constant.stderr index ad44121e763..d2c6ba6a2f8 100644 --- a/src/test/ui/static/static-mut-not-constant.stderr +++ b/src/test/ui/static/static-mut-not-constant.stderr @@ -1,9 +1,16 @@ error[E0010]: allocations are not allowed in statics - --> $DIR/static-mut-not-constant.rs:13:28 + --> $DIR/static-mut-not-constant.rs:3:28 | LL | static mut a: Box = box 3; | ^^^^^ allocation not allowed in statics -error: aborting due to previous error +error[E0019]: static contains unimplemented expression type + --> $DIR/static-mut-not-constant.rs:3:32 + | +LL | static mut a: Box = box 3; + | ^ + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0010`. +Some errors occurred: E0010, E0019. +For more information about an error, try `rustc --explain E0010`. diff --git a/src/test/ui/static/static-mut-not-pat.rs b/src/test/ui/static/static-mut-not-pat.rs index 351a47fdf39..ce5ae164c0e 100644 --- a/src/test/ui/static/static-mut-not-pat.rs +++ b/src/test/ui/static/static-mut-not-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Constants (static variables) can be used to match in patterns, but mutable // statics cannot. This ensures that there's some form of error if this is // attempted. diff --git a/src/test/ui/static/static-mut-not-pat.stderr b/src/test/ui/static/static-mut-not-pat.stderr index 96dc06ee524..0714df0d11d 100644 --- a/src/test/ui/static/static-mut-not-pat.stderr +++ b/src/test/ui/static/static-mut-not-pat.stderr @@ -1,5 +1,5 @@ error[E0530]: match bindings cannot shadow statics - --> $DIR/static-mut-not-pat.rs:23:9 + --> $DIR/static-mut-not-pat.rs:13:9 | LL | static mut a: isize = 3; | ------------------------ the static `a` is defined here @@ -8,7 +8,7 @@ LL | a => {} //~ ERROR match bindings cannot shadow statics | ^ cannot be named the same as a static error[E0530]: match bindings cannot shadow statics - --> $DIR/static-mut-not-pat.rs:46:9 + --> $DIR/static-mut-not-pat.rs:36:9 | LL | static mut STATIC_MUT_FOO: Foo = Foo { bar: Some(Direction::West), baz: NEW_FALSE }; | ------------------------------------------------------------------------------------ the static `STATIC_MUT_FOO` is defined here diff --git a/src/test/ui/static/static-mut-requires-unsafe.rs b/src/test/ui/static/static-mut-requires-unsafe.rs index f6ad46a0527..413b97e431d 100644 --- a/src/test/ui/static/static-mut-requires-unsafe.rs +++ b/src/test/ui/static/static-mut-requires-unsafe.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - static mut a: isize = 3; fn main() { diff --git a/src/test/ui/static/static-mut-requires-unsafe.stderr b/src/test/ui/static/static-mut-requires-unsafe.stderr index 310da8f67f3..66ee6989b01 100644 --- a/src/test/ui/static/static-mut-requires-unsafe.stderr +++ b/src/test/ui/static/static-mut-requires-unsafe.stderr @@ -1,5 +1,5 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:14:5 + --> $DIR/static-mut-requires-unsafe.rs:4:5 | LL | a += 3; //~ ERROR: requires unsafe | ^^^^^^ use of mutable static @@ -7,7 +7,7 @@ LL | a += 3; //~ ERROR: requires unsafe = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:15:5 + --> $DIR/static-mut-requires-unsafe.rs:5:5 | LL | a = 4; //~ ERROR: requires unsafe | ^^^^^ use of mutable static @@ -15,7 +15,7 @@ LL | a = 4; //~ ERROR: requires unsafe = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior error[E0133]: use of mutable static is unsafe and requires unsafe function or block - --> $DIR/static-mut-requires-unsafe.rs:16:14 + --> $DIR/static-mut-requires-unsafe.rs:6:14 | LL | let _b = a; //~ ERROR: requires unsafe | ^ use of mutable static diff --git a/src/test/ui/static/static-priv-by-default2.rs b/src/test/ui/static/static-priv-by-default2.rs index 577e4f7542d..bbbdb253b1e 100644 --- a/src/test/ui/static/static-priv-by-default2.rs +++ b/src/test/ui/static/static-priv-by-default2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:static_priv_by_default.rs extern crate static_priv_by_default; diff --git a/src/test/ui/static/static-priv-by-default2.stderr b/src/test/ui/static/static-priv-by-default2.stderr index 2631e99a9b7..95bcf076335 100644 --- a/src/test/ui/static/static-priv-by-default2.stderr +++ b/src/test/ui/static/static-priv-by-default2.stderr @@ -1,11 +1,11 @@ error[E0603]: static `private` is private - --> $DIR/static-priv-by-default2.rs:25:30 + --> $DIR/static-priv-by-default2.rs:15:30 | LL | use child::childs_child::private; | ^^^^^^^ error[E0603]: static `private` is private - --> $DIR/static-priv-by-default2.rs:33:33 + --> $DIR/static-priv-by-default2.rs:23:33 | LL | use static_priv_by_default::private; | ^^^^^^^ diff --git a/src/test/ui/static/static-reference-to-fn-1.rs b/src/test/ui/static/static-reference-to-fn-1.rs index cf8ee1ecb41..c15634dbf62 100644 --- a/src/test/ui/static/static-reference-to-fn-1.rs +++ b/src/test/ui/static/static-reference-to-fn-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct A<'a> { func: &'a fn() -> Option } diff --git a/src/test/ui/static/static-reference-to-fn-1.stderr b/src/test/ui/static/static-reference-to-fn-1.stderr index 609319f3b78..84cd6db4c4a 100644 --- a/src/test/ui/static/static-reference-to-fn-1.stderr +++ b/src/test/ui/static/static-reference-to-fn-1.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/static-reference-to-fn-1.rs:27:15 + --> $DIR/static-reference-to-fn-1.rs:17:15 | LL | func: &foo, //~ ERROR mismatched types | ^^^^ expected fn pointer, found fn item diff --git a/src/test/ui/static/static-reference-to-fn-2.nll.stderr b/src/test/ui/static/static-reference-to-fn-2.nll.stderr index eec1a4d9f12..2e00c9491d7 100644 --- a/src/test/ui/static/static-reference-to-fn-2.nll.stderr +++ b/src/test/ui/static/static-reference-to-fn-2.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/static-reference-to-fn-2.rs:28:22 + --> $DIR/static-reference-to-fn-2.rs:18:22 | LL | fn state1(self_: &mut StateMachineIter) -> Option<&'static str> { | ----- has type `&mut StateMachineIter<'1>` @@ -10,7 +10,7 @@ LL | self_.statefn = &id(state2 as StateMachineFunc); | assignment requires that borrow lasts for `'1` error[E0716]: temporary value dropped while borrowed - --> $DIR/static-reference-to-fn-2.rs:34:22 + --> $DIR/static-reference-to-fn-2.rs:24:22 | LL | fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> { | ----- has type `&mut StateMachineIter<'1>` @@ -21,7 +21,7 @@ LL | self_.statefn = &id(state3 as StateMachineFunc); | assignment requires that borrow lasts for `'1` error[E0716]: temporary value dropped while borrowed - --> $DIR/static-reference-to-fn-2.rs:40:22 + --> $DIR/static-reference-to-fn-2.rs:30:22 | LL | fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> { | ----- has type `&mut StateMachineIter<'1>` @@ -32,7 +32,7 @@ LL | self_.statefn = &id(finished as StateMachineFunc); | assignment requires that borrow lasts for `'1` error[E0515]: cannot return value referencing temporary value - --> $DIR/static-reference-to-fn-2.rs:50:5 + --> $DIR/static-reference-to-fn-2.rs:40:5 | LL | / StateMachineIter { LL | | statefn: &id(state1 as StateMachineFunc) diff --git a/src/test/ui/static/static-reference-to-fn-2.rs b/src/test/ui/static/static-reference-to-fn-2.rs index 8d9f442b81d..8e66532cad9 100644 --- a/src/test/ui/static/static-reference-to-fn-2.rs +++ b/src/test/ui/static/static-reference-to-fn-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn id(x: T) -> T { x } struct StateMachineIter<'a> { diff --git a/src/test/ui/static/static-reference-to-fn-2.stderr b/src/test/ui/static/static-reference-to-fn-2.stderr index a01ab4cef81..d94913c7e22 100644 --- a/src/test/ui/static/static-reference-to-fn-2.stderr +++ b/src/test/ui/static/static-reference-to-fn-2.stderr @@ -1,13 +1,13 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/static-reference-to-fn-2.rs:28:22 + --> $DIR/static-reference-to-fn-2.rs:18:22 | LL | self_.statefn = &id(state2 as StateMachineFunc); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here | | | temporary value does not live long enough | -note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 27:1... - --> $DIR/static-reference-to-fn-2.rs:27:1 +note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 17:1... + --> $DIR/static-reference-to-fn-2.rs:17:1 | LL | / fn state1(self_: &mut StateMachineIter) -> Option<&'static str> { LL | | self_.statefn = &id(state2 as StateMachineFunc); @@ -18,15 +18,15 @@ LL | | } = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/static-reference-to-fn-2.rs:34:22 + --> $DIR/static-reference-to-fn-2.rs:24:22 | LL | self_.statefn = &id(state3 as StateMachineFunc); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here | | | temporary value does not live long enough | -note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 33:1... - --> $DIR/static-reference-to-fn-2.rs:33:1 +note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 23:1... + --> $DIR/static-reference-to-fn-2.rs:23:1 | LL | / fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> { LL | | self_.statefn = &id(state3 as StateMachineFunc); @@ -37,15 +37,15 @@ LL | | } = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/static-reference-to-fn-2.rs:40:22 + --> $DIR/static-reference-to-fn-2.rs:30:22 | LL | self_.statefn = &id(finished as StateMachineFunc); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here | | | temporary value does not live long enough | -note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 39:1... - --> $DIR/static-reference-to-fn-2.rs:39:1 +note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 29:1... + --> $DIR/static-reference-to-fn-2.rs:29:1 | LL | / fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> { LL | | self_.statefn = &id(finished as StateMachineFunc); @@ -56,7 +56,7 @@ LL | | } = note: consider using a `let` binding to increase its lifetime error[E0597]: borrowed value does not live long enough - --> $DIR/static-reference-to-fn-2.rs:51:19 + --> $DIR/static-reference-to-fn-2.rs:41:19 | LL | statefn: &id(state1 as StateMachineFunc) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough diff --git a/src/test/ui/static/static-region-bound.nll.stderr b/src/test/ui/static/static-region-bound.nll.stderr index c33c1a45547..0a5686051cd 100644 --- a/src/test/ui/static/static-region-bound.nll.stderr +++ b/src/test/ui/static/static-region-bound.nll.stderr @@ -1,5 +1,5 @@ error[E0716]: temporary value dropped while borrowed - --> $DIR/static-region-bound.rs:20:14 + --> $DIR/static-region-bound.rs:10:14 | LL | let x = &id(3); //~ ERROR borrowed value does not live long enough | ^^^^^ creates a temporary which is freed while still in use diff --git a/src/test/ui/static/static-region-bound.rs b/src/test/ui/static/static-region-bound.rs index 90ed401659c..ee411370d15 100644 --- a/src/test/ui/static/static-region-bound.rs +++ b/src/test/ui/static/static-region-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] fn id(x: T) -> T { x } diff --git a/src/test/ui/static/static-region-bound.stderr b/src/test/ui/static/static-region-bound.stderr index ee3398b96d9..611f47ddfde 100644 --- a/src/test/ui/static/static-region-bound.stderr +++ b/src/test/ui/static/static-region-bound.stderr @@ -1,5 +1,5 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/static-region-bound.rs:20:14 + --> $DIR/static-region-bound.rs:10:14 | LL | let x = &id(3); //~ ERROR borrowed value does not live long enough | ^^^^^ temporary value does not live long enough diff --git a/src/test/ui/static/static-vec-repeat-not-constant.rs b/src/test/ui/static/static-vec-repeat-not-constant.rs index a533a5bd54d..61c87b144d9 100644 --- a/src/test/ui/static/static-vec-repeat-not-constant.rs +++ b/src/test/ui/static/static-vec-repeat-not-constant.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo() -> isize { 23 } static a: [isize; 2] = [foo(); 2]; diff --git a/src/test/ui/static/static-vec-repeat-not-constant.stderr b/src/test/ui/static/static-vec-repeat-not-constant.stderr index 27d1b41ed0b..ef98aa546eb 100644 --- a/src/test/ui/static/static-vec-repeat-not-constant.stderr +++ b/src/test/ui/static/static-vec-repeat-not-constant.stderr @@ -1,5 +1,5 @@ error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/static-vec-repeat-not-constant.rs:13:25 + --> $DIR/static-vec-repeat-not-constant.rs:3:25 | LL | static a: [isize; 2] = [foo(); 2]; | ^^^^^ diff --git a/src/test/ui/staticness-mismatch.rs b/src/test/ui/staticness-mismatch.rs index 2dfc9b79ee2..8710d01123f 100644 --- a/src/test/ui/staticness-mismatch.rs +++ b/src/test/ui/staticness-mismatch.rs @@ -1,19 +1,9 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait foo { +trait Foo { fn dummy(&self) { } fn bar(); } -impl foo for isize { +impl Foo for isize { fn bar(&self) {} //~^ ERROR method `bar` has a `&self` declaration in the impl, but not in the trait } diff --git a/src/test/ui/staticness-mismatch.stderr b/src/test/ui/staticness-mismatch.stderr index 31c06ae8a88..b67ac5adbe1 100644 --- a/src/test/ui/staticness-mismatch.stderr +++ b/src/test/ui/staticness-mismatch.stderr @@ -1,5 +1,5 @@ error[E0185]: method `bar` has a `&self` declaration in the impl, but not in the trait - --> $DIR/staticness-mismatch.rs:17:5 + --> $DIR/staticness-mismatch.rs:7:5 | LL | fn bar(); | --------- trait method declared without `&self` diff --git a/src/test/ui/std-uncopyable-atomics.nll.stderr b/src/test/ui/std-uncopyable-atomics.nll.stderr index e6b612fed85..0a5e7c64b1a 100644 --- a/src/test/ui/std-uncopyable-atomics.nll.stderr +++ b/src/test/ui/std-uncopyable-atomics.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/std-uncopyable-atomics.rs:19:13 + --> $DIR/std-uncopyable-atomics.rs:9:13 | LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | ^^^ @@ -8,7 +8,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | help: consider removing the `*`: `&x` error[E0507]: cannot move out of borrowed content - --> $DIR/std-uncopyable-atomics.rs:21:13 + --> $DIR/std-uncopyable-atomics.rs:11:13 | LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | ^^^ @@ -17,7 +17,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | help: consider removing the `*`: `&x` error[E0507]: cannot move out of borrowed content - --> $DIR/std-uncopyable-atomics.rs:23:13 + --> $DIR/std-uncopyable-atomics.rs:13:13 | LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | ^^^ @@ -26,7 +26,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | help: consider removing the `*`: `&x` error[E0507]: cannot move out of borrowed content - --> $DIR/std-uncopyable-atomics.rs:25:13 + --> $DIR/std-uncopyable-atomics.rs:15:13 | LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | ^^^ diff --git a/src/test/ui/std-uncopyable-atomics.rs b/src/test/ui/std-uncopyable-atomics.rs index 35877db610e..2c79a9c440e 100644 --- a/src/test/ui/std-uncopyable-atomics.rs +++ b/src/test/ui/std-uncopyable-atomics.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #8380 diff --git a/src/test/ui/std-uncopyable-atomics.stderr b/src/test/ui/std-uncopyable-atomics.stderr index 4452bfa95d8..ecf9963c145 100644 --- a/src/test/ui/std-uncopyable-atomics.stderr +++ b/src/test/ui/std-uncopyable-atomics.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/std-uncopyable-atomics.rs:19:13 + --> $DIR/std-uncopyable-atomics.rs:9:13 | LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | ^^^ @@ -8,7 +8,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | help: consider using a reference instead: `&*&x` error[E0507]: cannot move out of borrowed content - --> $DIR/std-uncopyable-atomics.rs:21:13 + --> $DIR/std-uncopyable-atomics.rs:11:13 | LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | ^^^ @@ -17,7 +17,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | help: consider using a reference instead: `&*&x` error[E0507]: cannot move out of borrowed content - --> $DIR/std-uncopyable-atomics.rs:23:13 + --> $DIR/std-uncopyable-atomics.rs:13:13 | LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | ^^^ @@ -26,7 +26,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | help: consider using a reference instead: `&*&x` error[E0507]: cannot move out of borrowed content - --> $DIR/std-uncopyable-atomics.rs:25:13 + --> $DIR/std-uncopyable-atomics.rs:15:13 | LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | ^^^ diff --git a/src/test/ui/stmt_expr_attrs_no_feature.rs b/src/test/ui/stmt_expr_attrs_no_feature.rs index 896817bb858..0a71d8d1333 100644 --- a/src/test/ui/stmt_expr_attrs_no_feature.rs +++ b/src/test/ui/stmt_expr_attrs_no_feature.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(custom_attribute)] macro_rules! stmt_mac { diff --git a/src/test/ui/stmt_expr_attrs_no_feature.stderr b/src/test/ui/stmt_expr_attrs_no_feature.stderr index dc114cef2e5..c4d735915a1 100644 --- a/src/test/ui/stmt_expr_attrs_no_feature.stderr +++ b/src/test/ui/stmt_expr_attrs_no_feature.stderr @@ -1,5 +1,5 @@ error[E0658]: attributes on expressions are experimental. (see issue #15701) - --> $DIR/stmt_expr_attrs_no_feature.rs:23:5 + --> $DIR/stmt_expr_attrs_no_feature.rs:13:5 | LL | #[attr] //~ ERROR attributes on expressions are experimental | ^^^^^^^ @@ -7,7 +7,7 @@ LL | #[attr] //~ ERROR attributes on expressions are experimental = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental. (see issue #15701) - --> $DIR/stmt_expr_attrs_no_feature.rs:104:18 + --> $DIR/stmt_expr_attrs_no_feature.rs:94:18 | LL | fn y(a: [u8; #[attr] 5]); //~ ERROR 15701 | ^^^^^^^ @@ -15,7 +15,7 @@ LL | fn y(a: [u8; #[attr] 5]); //~ ERROR 15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental. (see issue #15701) - --> $DIR/stmt_expr_attrs_no_feature.rs:111:19 + --> $DIR/stmt_expr_attrs_no_feature.rs:101:19 | LL | const Y: u8 = #[attr] 5; //~ ERROR 15701 | ^^^^^^^ @@ -23,7 +23,7 @@ LL | const Y: u8 = #[attr] 5; //~ ERROR 15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental. (see issue #15701) - --> $DIR/stmt_expr_attrs_no_feature.rs:117:19 + --> $DIR/stmt_expr_attrs_no_feature.rs:107:19 | LL | const Y: [u8; #[attr] 5]; //~ ERROR 15701 | ^^^^^^^ @@ -31,7 +31,7 @@ LL | const Y: [u8; #[attr] 5]; //~ ERROR 15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental. (see issue #15701) - --> $DIR/stmt_expr_attrs_no_feature.rs:123:18 + --> $DIR/stmt_expr_attrs_no_feature.rs:113:18 | LL | field2: [u8; #[attr] 5] //~ ERROR 15701 | ^^^^^^^ @@ -39,7 +39,7 @@ LL | field2: [u8; #[attr] 5] //~ ERROR 15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental. (see issue #15701) - --> $DIR/stmt_expr_attrs_no_feature.rs:128:10 + --> $DIR/stmt_expr_attrs_no_feature.rs:118:10 | LL | [u8; #[attr] 5] //~ ERROR 15701 | ^^^^^^^ @@ -47,7 +47,7 @@ LL | [u8; #[attr] 5] //~ ERROR 15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental. (see issue #15701) - --> $DIR/stmt_expr_attrs_no_feature.rs:134:14 + --> $DIR/stmt_expr_attrs_no_feature.rs:124:14 | LL | [u8; #[attr] 5] //~ ERROR 15701 | ^^^^^^^ @@ -55,7 +55,7 @@ LL | [u8; #[attr] 5] //~ ERROR 15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental. (see issue #15701) - --> $DIR/stmt_expr_attrs_no_feature.rs:139:22 + --> $DIR/stmt_expr_attrs_no_feature.rs:129:22 | LL | field2: [u8; #[attr] 5] //~ ERROR 15701 | ^^^^^^^ @@ -63,7 +63,7 @@ LL | field2: [u8; #[attr] 5] //~ ERROR 15701 = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable error[E0658]: attributes on expressions are experimental. (see issue #15701) - --> $DIR/stmt_expr_attrs_no_feature.rs:147:14 + --> $DIR/stmt_expr_attrs_no_feature.rs:137:14 | LL | 6 => #[attr] (), //~ ERROR 15701 | ^^^^^^^ diff --git a/src/test/ui/str/str-array-assignment.rs b/src/test/ui/str/str-array-assignment.rs index 9d6cf5fe598..4a78ed53ae1 100644 --- a/src/test/ui/str/str-array-assignment.rs +++ b/src/test/ui/str/str-array-assignment.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let s = "abc"; let t = if true { s[..2] } else { s }; diff --git a/src/test/ui/str/str-array-assignment.stderr b/src/test/ui/str/str-array-assignment.stderr index 57eff3fb137..87809d212d7 100644 --- a/src/test/ui/str/str-array-assignment.stderr +++ b/src/test/ui/str/str-array-assignment.stderr @@ -1,14 +1,16 @@ error[E0308]: if and else have incompatible types - --> $DIR/str-array-assignment.rs:13:11 + --> $DIR/str-array-assignment.rs:3:37 | LL | let t = if true { s[..2] } else { s }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found &str + | ------ ^ expected str, found &str + | | + | expected because of this | = note: expected type `str` found type `&str` error[E0308]: mismatched types - --> $DIR/str-array-assignment.rs:15:27 + --> $DIR/str-array-assignment.rs:5:27 | LL | let u: &str = if true { s[..2] } else { s }; | ^^^^^^ @@ -20,7 +22,7 @@ LL | let u: &str = if true { s[..2] } else { s }; found type `str` error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/str-array-assignment.rs:17:7 + --> $DIR/str-array-assignment.rs:7:7 | LL | let v = s[..2]; | ^ ------ help: consider borrowing here: `&s[..2]` @@ -28,12 +30,12 @@ LL | let v = s[..2]; | doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature error[E0308]: mismatched types - --> $DIR/str-array-assignment.rs:19:17 + --> $DIR/str-array-assignment.rs:9:17 | LL | let w: &str = s[..2]; | ^^^^^^ diff --git a/src/test/ui/str/str-as-char.fixed b/src/test/ui/str/str-as-char.fixed index c0dad38e436..accead5c850 100644 --- a/src/test/ui/str/str-as-char.fixed +++ b/src/test/ui/str/str-as-char.fixed @@ -1,16 +1,6 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix fn main() { - println!("●●"); - //~^ ERROR character literal may only contain one codepoint + println!("{}", "●●"); //~ ERROR character literal may only contain one codepoint + //~^ ERROR format argument must be a string literal } diff --git a/src/test/ui/str/str-as-char.rs b/src/test/ui/str/str-as-char.rs index b5a5df0af7f..fb179ec7245 100644 --- a/src/test/ui/str/str-as-char.rs +++ b/src/test/ui/str/str-as-char.rs @@ -1,16 +1,6 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix fn main() { - println!('●●'); - //~^ ERROR character literal may only contain one codepoint + println!('●●'); //~ ERROR character literal may only contain one codepoint + //~^ ERROR format argument must be a string literal } diff --git a/src/test/ui/str/str-as-char.stderr b/src/test/ui/str/str-as-char.stderr index 60eb182adf1..4ca430a4cde 100644 --- a/src/test/ui/str/str-as-char.stderr +++ b/src/test/ui/str/str-as-char.stderr @@ -1,12 +1,22 @@ error: character literal may only contain one codepoint - --> $DIR/str-as-char.rs:14:14 + --> $DIR/str-as-char.rs:4:14 | -LL | println!('●●'); +LL | println!('●●'); //~ ERROR character literal may only contain one codepoint | ^^^^ help: if you meant to write a `str` literal, use double quotes | -LL | println!("●●"); +LL | println!("●●"); //~ ERROR character literal may only contain one codepoint | ^^^^ -error: aborting due to previous error +error: format argument must be a string literal + --> $DIR/str-as-char.rs:4:14 + | +LL | println!('●●'); //~ ERROR character literal may only contain one codepoint + | ^^^^ +help: you might be missing a string literal to format with + | +LL | println!("{}", '●●'); //~ ERROR character literal may only contain one codepoint + | ^^^^^ + +error: aborting due to 2 previous errors diff --git a/src/test/ui/str/str-concat-on-double-ref.rs b/src/test/ui/str/str-concat-on-double-ref.rs index 292dcbf8ef7..a671b6e191e 100644 --- a/src/test/ui/str/str-concat-on-double-ref.rs +++ b/src/test/ui/str/str-concat-on-double-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let a: &String = &"1".to_owned(); let b: &str = &"2"; diff --git a/src/test/ui/str/str-concat-on-double-ref.stderr b/src/test/ui/str/str-concat-on-double-ref.stderr index d42c859598f..a67db1936f0 100644 --- a/src/test/ui/str/str-concat-on-double-ref.stderr +++ b/src/test/ui/str/str-concat-on-double-ref.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `+` cannot be applied to type `&std::string::String` - --> $DIR/str-concat-on-double-ref.rs:14:13 + --> $DIR/str-concat-on-double-ref.rs:4:13 | LL | let c = a + b; | ^^^^^ diff --git a/src/test/ui/str/str-idx.rs b/src/test/ui/str/str-idx.rs index b5f1ffb977e..1b32ed5533d 100644 --- a/src/test/ui/str/str-idx.rs +++ b/src/test/ui/str/str-idx.rs @@ -1,14 +1,7 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { let s: &str = "hello"; - let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}` + let _: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}` + let _ = s.get(4); //~ ERROR the type `str` cannot be indexed by `{integer}` + let _ = s.get_unchecked(4); //~ ERROR the type `str` cannot be indexed by `{integer}` + let _: u8 = s['c']; //~ ERROR the type `str` cannot be indexed by `char` } diff --git a/src/test/ui/str/str-idx.stderr b/src/test/ui/str/str-idx.stderr index 496187c92f1..99df85d92fd 100644 --- a/src/test/ui/str/str-idx.stderr +++ b/src/test/ui/str/str-idx.stderr @@ -1,11 +1,43 @@ error[E0277]: the type `str` cannot be indexed by `{integer}` - --> $DIR/str-idx.rs:13:17 + --> $DIR/str-idx.rs:3:17 | -LL | let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}` - | ^^^^ `str` cannot be indexed by `{integer}` +LL | let _: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}` + | ^^^^ string indices are ranges of `usize` | - = help: the trait `std::ops::Index<{integer}>` is not implemented for `str` + = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` + = note: you can use `.chars().nth()` or `.bytes().nth()` + see chapter in The Book + = note: required because of the requirements on the impl of `std::ops::Index<{integer}>` for `str` -error: aborting due to previous error +error[E0277]: the type `str` cannot be indexed by `{integer}` + --> $DIR/str-idx.rs:4:15 + | +LL | let _ = s.get(4); //~ ERROR the type `str` cannot be indexed by `{integer}` + | ^^^ string indices are ranges of `usize` + | + = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` + = note: you can use `.chars().nth()` or `.bytes().nth()` + see chapter in The Book + +error[E0277]: the type `str` cannot be indexed by `{integer}` + --> $DIR/str-idx.rs:5:15 + | +LL | let _ = s.get_unchecked(4); //~ ERROR the type `str` cannot be indexed by `{integer}` + | ^^^^^^^^^^^^^ string indices are ranges of `usize` + | + = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` + = note: you can use `.chars().nth()` or `.bytes().nth()` + see chapter in The Book + +error[E0277]: the type `str` cannot be indexed by `char` + --> $DIR/str-idx.rs:6:17 + | +LL | let _: u8 = s['c']; //~ ERROR the type `str` cannot be indexed by `char` + | ^^^^^^ string indices are ranges of `usize` + | + = help: the trait `std::slice::SliceIndex` is not implemented for `char` + = note: required because of the requirements on the impl of `std::ops::Index` for `str` + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/str/str-lit-type-mismatch.rs b/src/test/ui/str/str-lit-type-mismatch.rs index 4a062f78a32..12637c7b994 100644 --- a/src/test/ui/str/str-lit-type-mismatch.rs +++ b/src/test/ui/str/str-lit-type-mismatch.rs @@ -1,14 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn main() { let x: &[u8] = "foo"; //~ ERROR mismatched types let y: &[u8; 4] = "baaa"; //~ ERROR mismatched types diff --git a/src/test/ui/str/str-lit-type-mismatch.stderr b/src/test/ui/str/str-lit-type-mismatch.stderr index de18851636d..c14e9090fef 100644 --- a/src/test/ui/str/str-lit-type-mismatch.stderr +++ b/src/test/ui/str/str-lit-type-mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/str-lit-type-mismatch.rs:13:20 + --> $DIR/str-lit-type-mismatch.rs:2:20 | LL | let x: &[u8] = "foo"; //~ ERROR mismatched types | ^^^^^ @@ -11,7 +11,7 @@ LL | let x: &[u8] = "foo"; //~ ERROR mismatched types found type `&'static str` error[E0308]: mismatched types - --> $DIR/str-lit-type-mismatch.rs:14:23 + --> $DIR/str-lit-type-mismatch.rs:3:23 | LL | let y: &[u8; 4] = "baaa"; //~ ERROR mismatched types | ^^^^^^ @@ -23,7 +23,7 @@ LL | let y: &[u8; 4] = "baaa"; //~ ERROR mismatched types found type `&'static str` error[E0308]: mismatched types - --> $DIR/str-lit-type-mismatch.rs:15:19 + --> $DIR/str-lit-type-mismatch.rs:4:19 | LL | let z: &str = b"foo"; //~ ERROR mismatched types | ^^^^^^ diff --git a/src/test/ui/str/str-mut-idx.rs b/src/test/ui/str/str-mut-idx.rs index 136bfaefa71..575a9eae859 100644 --- a/src/test/ui/str/str-mut-idx.rs +++ b/src/test/ui/str/str-mut-idx.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn bot() -> T { loop {} } fn mutate(s: &mut str) { @@ -15,7 +5,13 @@ fn mutate(s: &mut str) { //~^ ERROR the size for values of type //~| ERROR the size for values of type s[1usize] = bot(); - //~^ ERROR the type `str` cannot be mutably indexed by `usize` + //~^ ERROR the type `str` cannot be indexed by `usize` + s.get_mut(1); + //~^ ERROR the type `str` cannot be indexed by `{integer}` + s.get_unchecked_mut(1); + //~^ ERROR the type `str` cannot be indexed by `{integer}` + s['c']; + //~^ ERROR the type `str` cannot be indexed by `char` } pub fn main() {} diff --git a/src/test/ui/str/str-mut-idx.stderr b/src/test/ui/str/str-mut-idx.stderr index df21ea2b274..beb22724523 100644 --- a/src/test/ui/str/str-mut-idx.stderr +++ b/src/test/ui/str/str-mut-idx.stderr @@ -1,35 +1,65 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/str-mut-idx.rs:14:15 + --> $DIR/str-mut-idx.rs:4:15 | LL | s[1..2] = bot(); | ^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit note: required by `bot` - --> $DIR/str-mut-idx.rs:11:1 + --> $DIR/str-mut-idx.rs:1:1 | LL | fn bot() -> T { loop {} } | ^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/str-mut-idx.rs:14:5 + --> $DIR/str-mut-idx.rs:4:5 | LL | s[1..2] = bot(); | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: the left-hand-side of an assignment must have a statically known size -error[E0277]: the type `str` cannot be mutably indexed by `usize` - --> $DIR/str-mut-idx.rs:17:5 +error[E0277]: the type `str` cannot be indexed by `usize` + --> $DIR/str-mut-idx.rs:7:5 | LL | s[1usize] = bot(); - | ^^^^^^^^^ `str` cannot be mutably indexed by `usize` + | ^^^^^^^^^ string indices are ranges of `usize` | - = help: the trait `std::ops::IndexMut` is not implemented for `str` + = help: the trait `std::slice::SliceIndex` is not implemented for `usize` + = note: required because of the requirements on the impl of `std::ops::Index` for `str` -error: aborting due to 3 previous errors +error[E0277]: the type `str` cannot be indexed by `{integer}` + --> $DIR/str-mut-idx.rs:9:7 + | +LL | s.get_mut(1); + | ^^^^^^^ string indices are ranges of `usize` + | + = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` + = note: you can use `.chars().nth()` or `.bytes().nth()` + see chapter in The Book + +error[E0277]: the type `str` cannot be indexed by `{integer}` + --> $DIR/str-mut-idx.rs:11:7 + | +LL | s.get_unchecked_mut(1); + | ^^^^^^^^^^^^^^^^^ string indices are ranges of `usize` + | + = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` + = note: you can use `.chars().nth()` or `.bytes().nth()` + see chapter in The Book + +error[E0277]: the type `str` cannot be indexed by `char` + --> $DIR/str-mut-idx.rs:13:5 + | +LL | s['c']; + | ^^^^^^ string indices are ranges of `usize` + | + = help: the trait `std::slice::SliceIndex` is not implemented for `char` + = note: required because of the requirements on the impl of `std::ops::Index` for `str` + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/structs/auxiliary/struct_field_privacy.rs b/src/test/ui/structs/auxiliary/struct_field_privacy.rs index 5fea97da03e..9765af1a7f6 100644 --- a/src/test/ui/structs/auxiliary/struct_field_privacy.rs +++ b/src/test/ui/structs/auxiliary/struct_field_privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct A { a: isize, pub b: isize, diff --git a/src/test/ui/structs/auxiliary/struct_variant_privacy.rs b/src/test/ui/structs/auxiliary/struct_variant_privacy.rs index 40868fa3f70..425ec0e96d3 100644 --- a/src/test/ui/structs/auxiliary/struct_variant_privacy.rs +++ b/src/test/ui/structs/auxiliary/struct_variant_privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Bar { Baz { a: isize } } diff --git a/src/test/ui/structs/struct-base-wrong-type-2.rs b/src/test/ui/structs/struct-base-wrong-type-2.rs index 7e5510edb2c..562f75b8e85 100644 --- a/src/test/ui/structs/struct-base-wrong-type-2.rs +++ b/src/test/ui/structs/struct-base-wrong-type-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that `base` in `Fru { field: expr, ..base }` must have right type. // // See also struct-base-wrong-type.rs, which tests same condition @@ -25,5 +15,5 @@ fn main() { let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types //~| expected type `Foo` //~| found type `{integer}` - //~| expected struct `Foo`, found integral variable + //~| expected struct `Foo`, found integer } diff --git a/src/test/ui/structs/struct-base-wrong-type-2.stderr b/src/test/ui/structs/struct-base-wrong-type-2.stderr index aab5ed0a74a..b15ea51bb2d 100644 --- a/src/test/ui/structs/struct-base-wrong-type-2.stderr +++ b/src/test/ui/structs/struct-base-wrong-type-2.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/struct-base-wrong-type-2.rs:21:27 + --> $DIR/struct-base-wrong-type-2.rs:11:27 | LL | let f = Foo { a: 2, ..b }; //~ ERROR mismatched types | ^ expected struct `Foo`, found struct `Bar` @@ -8,10 +8,10 @@ LL | let f = Foo { a: 2, ..b }; //~ ERROR mismatched types found type `Bar` error[E0308]: mismatched types - --> $DIR/struct-base-wrong-type-2.rs:25:34 + --> $DIR/struct-base-wrong-type-2.rs:15:34 | LL | let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types - | ^ expected struct `Foo`, found integral variable + | ^ expected struct `Foo`, found integer | = note: expected type `Foo` found type `{integer}` diff --git a/src/test/ui/structs/struct-base-wrong-type.rs b/src/test/ui/structs/struct-base-wrong-type.rs index 3703b15d4db..6252673c296 100644 --- a/src/test/ui/structs/struct-base-wrong-type.rs +++ b/src/test/ui/structs/struct-base-wrong-type.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that `base` in `Fru { field: expr, ..base }` must have right type. // // See also struct-base-wrong-type-2.rs, which tests same condition @@ -24,7 +14,7 @@ static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types //~| expected type `Foo` //~| found type `{integer}` - //~| expected struct `Foo`, found integral variable + //~| expected struct `Foo`, found integer fn main() { let b = Bar { x: 5 }; diff --git a/src/test/ui/structs/struct-base-wrong-type.stderr b/src/test/ui/structs/struct-base-wrong-type.stderr index 2c87f52ee04..045eb610f7d 100644 --- a/src/test/ui/structs/struct-base-wrong-type.stderr +++ b/src/test/ui/structs/struct-base-wrong-type.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/struct-base-wrong-type.rs:20:33 + --> $DIR/struct-base-wrong-type.rs:10:33 | LL | static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types | ^^^ expected struct `Foo`, found struct `Bar` @@ -8,10 +8,10 @@ LL | static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types found type `Bar` error[E0308]: mismatched types - --> $DIR/struct-base-wrong-type.rs:24:35 + --> $DIR/struct-base-wrong-type.rs:14:35 | LL | static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types - | ^ expected struct `Foo`, found integral variable + | ^ expected struct `Foo`, found integer | = note: expected type `Foo` found type `{integer}` diff --git a/src/test/ui/structs/struct-duplicate-comma.rs b/src/test/ui/structs/struct-duplicate-comma.rs index d7ee2f220d4..ff0d58abc3a 100644 --- a/src/test/ui/structs/struct-duplicate-comma.rs +++ b/src/test/ui/structs/struct-duplicate-comma.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Issue #50974 struct Foo { @@ -24,4 +12,3 @@ fn main() { b: 42 }; } - diff --git a/src/test/ui/structs/struct-duplicate-comma.stderr b/src/test/ui/structs/struct-duplicate-comma.stderr index 06e3b95c248..2297fea6353 100644 --- a/src/test/ui/structs/struct-duplicate-comma.stderr +++ b/src/test/ui/structs/struct-duplicate-comma.stderr @@ -1,5 +1,5 @@ error: expected identifier, found `,` - --> $DIR/struct-duplicate-comma.rs:22:14 + --> $DIR/struct-duplicate-comma.rs:10:14 | LL | let bar = Foo { | --- while parsing this struct diff --git a/src/test/ui/structs/struct-field-cfg.rs b/src/test/ui/structs/struct-field-cfg.rs index 974d500d9cb..42cab8ab916 100644 --- a/src/test/ui/structs/struct-field-cfg.rs +++ b/src/test/ui/structs/struct-field-cfg.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { present: (), } diff --git a/src/test/ui/structs/struct-field-cfg.stderr b/src/test/ui/structs/struct-field-cfg.stderr index db4790659c3..c8c624d548b 100644 --- a/src/test/ui/structs/struct-field-cfg.stderr +++ b/src/test/ui/structs/struct-field-cfg.stderr @@ -1,11 +1,11 @@ error[E0063]: missing field `present` in initializer of `Foo` - --> $DIR/struct-field-cfg.rs:17:13 + --> $DIR/struct-field-cfg.rs:7:13 | LL | let _ = Foo { #[cfg(any())] present: () }; | ^^^ missing `present` error[E0560]: struct `Foo` has no field named `absent` - --> $DIR/struct-field-cfg.rs:20:46 + --> $DIR/struct-field-cfg.rs:10:46 | LL | let _ = Foo { present: (), #[cfg(all())] absent: () }; | ^^^^^^ `Foo` does not have this field @@ -13,13 +13,13 @@ LL | let _ = Foo { present: (), #[cfg(all())] absent: () }; = note: available fields are: `present` error[E0027]: pattern does not mention field `present` - --> $DIR/struct-field-cfg.rs:23:9 + --> $DIR/struct-field-cfg.rs:13:9 | LL | let Foo { #[cfg(any())] present: () } = foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `present` error[E0026]: struct `Foo` does not have a field named `absent` - --> $DIR/struct-field-cfg.rs:26:42 + --> $DIR/struct-field-cfg.rs:16:42 | LL | let Foo { present: (), #[cfg(all())] absent: () } = foo; | ^^^^^^^^^^ struct `Foo` does not have this field diff --git a/src/test/ui/structs/struct-field-init-syntax.rs b/src/test/ui/structs/struct-field-init-syntax.rs index f1e24495f84..161f7e93af8 100644 --- a/src/test/ui/structs/struct-field-init-syntax.rs +++ b/src/test/ui/structs/struct-field-init-syntax.rs @@ -1,17 +1,10 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // issue #41834 +#[derive(Default)] +struct Foo { + one: u8, +} + fn main() { let foo = Foo { one: 111, diff --git a/src/test/ui/structs/struct-field-init-syntax.stderr b/src/test/ui/structs/struct-field-init-syntax.stderr index 2c4ae0e472b..0b72c5cf734 100644 --- a/src/test/ui/structs/struct-field-init-syntax.stderr +++ b/src/test/ui/structs/struct-field-init-syntax.stderr @@ -1,5 +1,5 @@ error: cannot use a comma after the base struct - --> $DIR/struct-field-init-syntax.rs:18:9 + --> $DIR/struct-field-init-syntax.rs:11:9 | LL | ..Foo::default(), | ^^^^^^^^^^^^^^^^- help: remove this comma @@ -7,7 +7,7 @@ LL | ..Foo::default(), = note: the base struct must always be the last field error: cannot use a comma after the base struct - --> $DIR/struct-field-init-syntax.rs:23:9 + --> $DIR/struct-field-init-syntax.rs:16:9 | LL | ..Foo::default(), | ^^^^^^^^^^^^^^^^- help: remove this comma diff --git a/src/test/ui/structs/struct-field-privacy.rs b/src/test/ui/structs/struct-field-privacy.rs index f487ef62aa4..5c35c04a69f 100644 --- a/src/test/ui/structs/struct-field-privacy.rs +++ b/src/test/ui/structs/struct-field-privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:struct_field_privacy.rs extern crate struct_field_privacy as xc; diff --git a/src/test/ui/structs/struct-field-privacy.stderr b/src/test/ui/structs/struct-field-privacy.stderr index ad3ee12637a..5e30a4e403d 100644 --- a/src/test/ui/structs/struct-field-privacy.stderr +++ b/src/test/ui/structs/struct-field-privacy.stderr @@ -1,29 +1,29 @@ error[E0616]: field `a` of struct `inner::A` is private - --> $DIR/struct-field-privacy.rs:33:5 + --> $DIR/struct-field-privacy.rs:23:5 | LL | b.a; //~ ERROR: field `a` of struct `inner::A` is private | ^^^ error[E0616]: field `b` of struct `inner::B` is private - --> $DIR/struct-field-privacy.rs:36:5 + --> $DIR/struct-field-privacy.rs:26:5 | LL | c.b; //~ ERROR: field `b` of struct `inner::B` is private | ^^^ error[E0616]: field `a` of struct `xc::A` is private - --> $DIR/struct-field-privacy.rs:38:5 + --> $DIR/struct-field-privacy.rs:28:5 | LL | d.a; //~ ERROR: field `a` of struct `xc::A` is private | ^^^ error[E0616]: field `b` of struct `xc::B` is private - --> $DIR/struct-field-privacy.rs:42:5 + --> $DIR/struct-field-privacy.rs:32:5 | LL | e.b; //~ ERROR: field `b` of struct `xc::B` is private | ^^^ error[E0616]: field `1` of struct `inner::Z` is private - --> $DIR/struct-field-privacy.rs:45:5 + --> $DIR/struct-field-privacy.rs:35:5 | LL | z.1; //~ ERROR: field `1` of struct `inner::Z` is private | ^^^ diff --git a/src/test/ui/structs/struct-fields-decl-dupe.rs b/src/test/ui/structs/struct-fields-decl-dupe.rs index 1f6b070d837..6ddf3d976b7 100644 --- a/src/test/ui/structs/struct-fields-decl-dupe.rs +++ b/src/test/ui/structs/struct-fields-decl-dupe.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct BuildData { foo: isize, foo: isize, diff --git a/src/test/ui/structs/struct-fields-decl-dupe.stderr b/src/test/ui/structs/struct-fields-decl-dupe.stderr index b5068b4abda..d7ce9bb8922 100644 --- a/src/test/ui/structs/struct-fields-decl-dupe.stderr +++ b/src/test/ui/structs/struct-fields-decl-dupe.stderr @@ -1,5 +1,5 @@ error[E0124]: field `foo` is already declared - --> $DIR/struct-fields-decl-dupe.rs:13:5 + --> $DIR/struct-fields-decl-dupe.rs:3:5 | LL | foo: isize, | ---------- `foo` first declared here diff --git a/src/test/ui/structs/struct-fields-dupe.rs b/src/test/ui/structs/struct-fields-dupe.rs index 578091f5e9a..2fa25a33545 100644 --- a/src/test/ui/structs/struct-fields-dupe.rs +++ b/src/test/ui/structs/struct-fields-dupe.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct BuildData { foo: isize, } diff --git a/src/test/ui/structs/struct-fields-dupe.stderr b/src/test/ui/structs/struct-fields-dupe.stderr index fa2079317e0..7739ef80fc8 100644 --- a/src/test/ui/structs/struct-fields-dupe.stderr +++ b/src/test/ui/structs/struct-fields-dupe.stderr @@ -1,5 +1,5 @@ error[E0062]: field `foo` specified more than once - --> $DIR/struct-fields-dupe.rs:18:9 + --> $DIR/struct-fields-dupe.rs:8:9 | LL | foo: 0, | ------ first use of `foo` diff --git a/src/test/ui/structs/struct-fields-hints-no-dupe.rs b/src/test/ui/structs/struct-fields-hints-no-dupe.rs index e4366cf79b1..987cf726fec 100644 --- a/src/test/ui/structs/struct-fields-hints-no-dupe.rs +++ b/src/test/ui/structs/struct-fields-hints-no-dupe.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct A { foo : i32, car : i32, diff --git a/src/test/ui/structs/struct-fields-hints-no-dupe.stderr b/src/test/ui/structs/struct-fields-hints-no-dupe.stderr index d04d193c665..1a88f269347 100644 --- a/src/test/ui/structs/struct-fields-hints-no-dupe.stderr +++ b/src/test/ui/structs/struct-fields-hints-no-dupe.stderr @@ -1,8 +1,8 @@ error[E0560]: struct `A` has no field named `bar` - --> $DIR/struct-fields-hints-no-dupe.rs:20:9 + --> $DIR/struct-fields-hints-no-dupe.rs:10:9 | LL | bar : 42, - | ^^^ field does not exist - did you mean `barr`? + | ^^^ help: a field with a similar name exists: `barr` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-fields-hints.rs b/src/test/ui/structs/struct-fields-hints.rs index 85dc1aedb44..08df0930e4d 100644 --- a/src/test/ui/structs/struct-fields-hints.rs +++ b/src/test/ui/structs/struct-fields-hints.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct A { foo : i32, car : i32, diff --git a/src/test/ui/structs/struct-fields-hints.stderr b/src/test/ui/structs/struct-fields-hints.stderr index 6d0ec8bdf92..3b8a2b5c7ba 100644 --- a/src/test/ui/structs/struct-fields-hints.stderr +++ b/src/test/ui/structs/struct-fields-hints.stderr @@ -1,8 +1,8 @@ error[E0560]: struct `A` has no field named `bar` - --> $DIR/struct-fields-hints.rs:20:9 + --> $DIR/struct-fields-hints.rs:10:9 | LL | bar : 42, - | ^^^ field does not exist - did you mean `car`? + | ^^^ help: a field with a similar name exists: `car` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-fields-missing.rs b/src/test/ui/structs/struct-fields-missing.rs index d5ab13affaf..0c7919d0249 100644 --- a/src/test/ui/structs/struct-fields-missing.rs +++ b/src/test/ui/structs/struct-fields-missing.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - struct BuildData { foo: isize, bar: Box, diff --git a/src/test/ui/structs/struct-fields-missing.stderr b/src/test/ui/structs/struct-fields-missing.stderr index 606288ef277..edbac000dea 100644 --- a/src/test/ui/structs/struct-fields-missing.stderr +++ b/src/test/ui/structs/struct-fields-missing.stderr @@ -1,5 +1,5 @@ error[E0063]: missing field `bar` in initializer of `BuildData` - --> $DIR/struct-fields-missing.rs:18:15 + --> $DIR/struct-fields-missing.rs:7:15 | LL | let foo = BuildData { //~ ERROR missing field `bar` in initializer of `BuildData` | ^^^^^^^^^ missing `bar` diff --git a/src/test/ui/structs/struct-fields-shorthand-unresolved.rs b/src/test/ui/structs/struct-fields-shorthand-unresolved.rs index 984f337fb3d..caad149160c 100644 --- a/src/test/ui/structs/struct-fields-shorthand-unresolved.rs +++ b/src/test/ui/structs/struct-fields-shorthand-unresolved.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: i32, y: i32 diff --git a/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr b/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr index f66ac96e0b7..37ec6c0f015 100644 --- a/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr +++ b/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr @@ -1,8 +1,8 @@ error[E0425]: cannot find value `y` in this scope - --> $DIR/struct-fields-shorthand-unresolved.rs:20:9 + --> $DIR/struct-fields-shorthand-unresolved.rs:10:9 | LL | y //~ ERROR cannot find value `y` in this scope - | ^ did you mean `x`? + | ^ help: a local variable with a similar name exists: `x` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-fields-shorthand.rs b/src/test/ui/structs/struct-fields-shorthand.rs index e46ae73f1a1..45e3014f22e 100644 --- a/src/test/ui/structs/struct-fields-shorthand.rs +++ b/src/test/ui/structs/struct-fields-shorthand.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { x: i32, y: i32 diff --git a/src/test/ui/structs/struct-fields-shorthand.stderr b/src/test/ui/structs/struct-fields-shorthand.stderr index a65a9c86581..0d3d633f61c 100644 --- a/src/test/ui/structs/struct-fields-shorthand.stderr +++ b/src/test/ui/structs/struct-fields-shorthand.stderr @@ -1,5 +1,5 @@ error[E0560]: struct `Foo` has no field named `z` - --> $DIR/struct-fields-shorthand.rs:19:15 + --> $DIR/struct-fields-shorthand.rs:9:15 | LL | x, y, z //~ ERROR struct `Foo` has no field named `z` | ^ `Foo` does not have this field diff --git a/src/test/ui/structs/struct-fields-too-many.rs b/src/test/ui/structs/struct-fields-too-many.rs index 1e0b8efc96f..8be8dcbf13c 100644 --- a/src/test/ui/structs/struct-fields-too-many.rs +++ b/src/test/ui/structs/struct-fields-too-many.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct BuildData { foo: isize, } diff --git a/src/test/ui/structs/struct-fields-too-many.stderr b/src/test/ui/structs/struct-fields-too-many.stderr index 01b3fe16fbb..a1b7a7a3110 100644 --- a/src/test/ui/structs/struct-fields-too-many.stderr +++ b/src/test/ui/structs/struct-fields-too-many.stderr @@ -1,5 +1,5 @@ error[E0560]: struct `BuildData` has no field named `bar` - --> $DIR/struct-fields-too-many.rs:18:9 + --> $DIR/struct-fields-too-many.rs:8:9 | LL | bar: 0 | ^^^ `BuildData` does not have this field diff --git a/src/test/ui/structs/struct-fields-typo.rs b/src/test/ui/structs/struct-fields-typo.rs index 0e30c1e86e4..0e9b2ae5145 100644 --- a/src/test/ui/structs/struct-fields-typo.rs +++ b/src/test/ui/structs/struct-fields-typo.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct BuildData { foo: isize, bar: f32 @@ -18,7 +8,8 @@ fn main() { foo: 0, bar: 0.5, }; - let x = foo.baa;//~ no field `baa` on type `BuildData` - //~^ did you mean `bar`? + let x = foo.baa; //~ ERROR no field `baa` on type `BuildData` + //~| HELP a field with a similar name exists + //~| SUGGESTION bar println!("{}", x); } diff --git a/src/test/ui/structs/struct-fields-typo.stderr b/src/test/ui/structs/struct-fields-typo.stderr index 9f2f97a6c09..c2fab714f7c 100644 --- a/src/test/ui/structs/struct-fields-typo.stderr +++ b/src/test/ui/structs/struct-fields-typo.stderr @@ -1,8 +1,8 @@ error[E0609]: no field `baa` on type `BuildData` - --> $DIR/struct-fields-typo.rs:21:17 + --> $DIR/struct-fields-typo.rs:11:17 | -LL | let x = foo.baa;//~ no field `baa` on type `BuildData` - | ^^^ did you mean `bar`? +LL | let x = foo.baa; //~ ERROR no field `baa` on type `BuildData` + | ^^^ help: a field with a similar name exists: `bar` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-like-enum-nonexhaustive.rs b/src/test/ui/structs/struct-like-enum-nonexhaustive.rs index a14e43f4c94..b1fc0f5ad3e 100644 --- a/src/test/ui/structs/struct-like-enum-nonexhaustive.rs +++ b/src/test/ui/structs/struct-like-enum-nonexhaustive.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum A { B { x: Option }, C diff --git a/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr b/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr index 56dbf0c93ba..d651ea0b4e2 100644 --- a/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr +++ b/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `B { x: Some(_) }` not covered - --> $DIR/struct-like-enum-nonexhaustive.rs:18:11 + --> $DIR/struct-like-enum-nonexhaustive.rs:8:11 | LL | match x { //~ ERROR non-exhaustive patterns | ^ pattern `B { x: Some(_) }` not covered diff --git a/src/test/ui/structs/struct-missing-comma.rs b/src/test/ui/structs/struct-missing-comma.rs index 87ae8ab2605..4c3cac33691 100644 --- a/src/test/ui/structs/struct-missing-comma.rs +++ b/src/test/ui/structs/struct-missing-comma.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z parse-only - // Issue #50636 struct S { diff --git a/src/test/ui/structs/struct-missing-comma.stderr b/src/test/ui/structs/struct-missing-comma.stderr index 28283bfb713..00ef1a7ff92 100644 --- a/src/test/ui/structs/struct-missing-comma.stderr +++ b/src/test/ui/structs/struct-missing-comma.stderr @@ -1,5 +1,5 @@ error: expected `,`, or `}`, found `bar` - --> $DIR/struct-missing-comma.rs:16:13 + --> $DIR/struct-missing-comma.rs:4:13 | LL | foo: u32 //~ expected `,`, or `}`, found `bar` | ^ help: try adding a comma: `,` diff --git a/src/test/ui/structs/struct-pat-derived-error.rs b/src/test/ui/structs/struct-pat-derived-error.rs index d3130c4e831..f49a8ff8bdd 100644 --- a/src/test/ui/structs/struct-pat-derived-error.rs +++ b/src/test/ui/structs/struct-pat-derived-error.rs @@ -1,22 +1,12 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct a { +struct A { b: usize, c: usize } -impl a { +impl A { fn foo(&self) { - let a { x, y } = self.d; //~ ERROR no field `d` on type `&a` - //~^ ERROR struct `a` does not have fields named `x`, `y` + let A { x, y } = self.d; //~ ERROR no field `d` on type `&A` + //~^ ERROR struct `A` does not have fields named `x`, `y` //~| ERROR pattern does not mention fields `b`, `c` } } diff --git a/src/test/ui/structs/struct-pat-derived-error.stderr b/src/test/ui/structs/struct-pat-derived-error.stderr index 68b71efc106..dd1dc71f7fd 100644 --- a/src/test/ui/structs/struct-pat-derived-error.stderr +++ b/src/test/ui/structs/struct-pat-derived-error.stderr @@ -1,19 +1,19 @@ -error[E0609]: no field `d` on type `&a` - --> $DIR/struct-pat-derived-error.rs:18:31 +error[E0609]: no field `d` on type `&A` + --> $DIR/struct-pat-derived-error.rs:8:31 | -LL | let a { x, y } = self.d; //~ ERROR no field `d` on type `&a` +LL | let A { x, y } = self.d; //~ ERROR no field `d` on type `&A` | ^ -error[E0026]: struct `a` does not have fields named `x`, `y` - --> $DIR/struct-pat-derived-error.rs:18:17 +error[E0026]: struct `A` does not have fields named `x`, `y` + --> $DIR/struct-pat-derived-error.rs:8:17 | -LL | let a { x, y } = self.d; //~ ERROR no field `d` on type `&a` - | ^ ^ struct `a` does not have these fields +LL | let A { x, y } = self.d; //~ ERROR no field `d` on type `&A` + | ^ ^ struct `A` does not have these fields error[E0027]: pattern does not mention fields `b`, `c` - --> $DIR/struct-pat-derived-error.rs:18:13 + --> $DIR/struct-pat-derived-error.rs:8:13 | -LL | let a { x, y } = self.d; //~ ERROR no field `d` on type `&a` +LL | let A { x, y } = self.d; //~ ERROR no field `d` on type `&A` | ^^^^^^^^^^ missing fields `b`, `c` error: aborting due to 3 previous errors diff --git a/src/test/ui/structs/struct-path-alias-bounds.rs b/src/test/ui/structs/struct-path-alias-bounds.rs index 1b6e51e3703..ae6ca808269 100644 --- a/src/test/ui/structs/struct-path-alias-bounds.rs +++ b/src/test/ui/structs/struct-path-alias-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // issue #36286 struct S { a: T } diff --git a/src/test/ui/structs/struct-path-alias-bounds.stderr b/src/test/ui/structs/struct-path-alias-bounds.stderr index f8e2fe1410f..70eb2610ea5 100644 --- a/src/test/ui/structs/struct-path-alias-bounds.stderr +++ b/src/test/ui/structs/struct-path-alias-bounds.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `NoClone: std::clone::Clone` is not satisfied - --> $DIR/struct-path-alias-bounds.rs:19:13 + --> $DIR/struct-path-alias-bounds.rs:9:13 | LL | let s = A { a: NoClone }; | ^ the trait `std::clone::Clone` is not implemented for `NoClone` | note: required by `S` - --> $DIR/struct-path-alias-bounds.rs:13:1 + --> $DIR/struct-path-alias-bounds.rs:3:1 | LL | struct S { a: T } | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/structs/struct-path-associated-type.rs b/src/test/ui/structs/struct-path-associated-type.rs index 660ac44ce0b..7c770852d22 100644 --- a/src/test/ui/structs/struct-path-associated-type.rs +++ b/src/test/ui/structs/struct-path-associated-type.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S; trait Tr { @@ -23,7 +13,7 @@ fn f() { //~^ ERROR expected struct, variant or union type, found associated type let z = T::A:: {}; //~^ ERROR expected struct, variant or union type, found associated type - //~| ERROR type parameters are not allowed on this type + //~| ERROR type arguments are not allowed on this entity match S { T::A {} => {} //~^ ERROR expected struct, variant or union type, found associated type @@ -32,7 +22,7 @@ fn f() { fn g>() { let s = T::A {}; // OK - let z = T::A:: {}; //~ ERROR type parameters are not allowed on this type + let z = T::A:: {}; //~ ERROR type arguments are not allowed on this entity match S { T::A {} => {} // OK } @@ -41,7 +31,7 @@ fn g>() { fn main() { let s = S::A {}; //~ ERROR ambiguous associated type let z = S::A:: {}; //~ ERROR ambiguous associated type - //~^ ERROR type parameters are not allowed on this type + //~^ ERROR type arguments are not allowed on this entity match S { S::A {} => {} //~ ERROR ambiguous associated type } diff --git a/src/test/ui/structs/struct-path-associated-type.stderr b/src/test/ui/structs/struct-path-associated-type.stderr index 873e7bb7b83..80824d98478 100644 --- a/src/test/ui/structs/struct-path-associated-type.stderr +++ b/src/test/ui/structs/struct-path-associated-type.stderr @@ -1,53 +1,53 @@ error[E0071]: expected struct, variant or union type, found associated type - --> $DIR/struct-path-associated-type.rs:22:13 + --> $DIR/struct-path-associated-type.rs:12:13 | LL | let s = T::A {}; | ^^^^ not a struct -error[E0109]: type parameters are not allowed on this type - --> $DIR/struct-path-associated-type.rs:24:20 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/struct-path-associated-type.rs:14:20 | LL | let z = T::A:: {}; - | ^^ type parameter not allowed + | ^^ type argument not allowed error[E0071]: expected struct, variant or union type, found associated type - --> $DIR/struct-path-associated-type.rs:24:13 + --> $DIR/struct-path-associated-type.rs:14:13 | LL | let z = T::A:: {}; | ^^^^^^^^^^ not a struct error[E0071]: expected struct, variant or union type, found associated type - --> $DIR/struct-path-associated-type.rs:28:9 + --> $DIR/struct-path-associated-type.rs:18:9 | LL | T::A {} => {} | ^^^^ not a struct -error[E0109]: type parameters are not allowed on this type - --> $DIR/struct-path-associated-type.rs:35:20 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/struct-path-associated-type.rs:25:20 | -LL | let z = T::A:: {}; //~ ERROR type parameters are not allowed on this type - | ^^ type parameter not allowed +LL | let z = T::A:: {}; //~ ERROR type arguments are not allowed on this entity + | ^^ type argument not allowed error[E0223]: ambiguous associated type - --> $DIR/struct-path-associated-type.rs:42:13 + --> $DIR/struct-path-associated-type.rs:32:13 | LL | let s = S::A {}; //~ ERROR ambiguous associated type | ^^^^ help: use fully-qualified syntax: `::A` -error[E0109]: type parameters are not allowed on this type - --> $DIR/struct-path-associated-type.rs:43:20 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/struct-path-associated-type.rs:33:20 | LL | let z = S::A:: {}; //~ ERROR ambiguous associated type - | ^^ type parameter not allowed + | ^^ type argument not allowed error[E0223]: ambiguous associated type - --> $DIR/struct-path-associated-type.rs:43:13 + --> $DIR/struct-path-associated-type.rs:33:13 | LL | let z = S::A:: {}; //~ ERROR ambiguous associated type | ^^^^^^^^^^ help: use fully-qualified syntax: `::A` error[E0223]: ambiguous associated type - --> $DIR/struct-path-associated-type.rs:46:9 + --> $DIR/struct-path-associated-type.rs:36:9 | LL | S::A {} => {} //~ ERROR ambiguous associated type | ^^^^ help: use fully-qualified syntax: `::A` diff --git a/src/test/ui/structs/struct-path-self-type-mismatch.rs b/src/test/ui/structs/struct-path-self-type-mismatch.rs index e966ea65902..c0c557ecace 100644 --- a/src/test/ui/structs/struct-path-self-type-mismatch.rs +++ b/src/test/ui/structs/struct-path-self-type-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo { inner: A } trait Bar { fn bar(); } diff --git a/src/test/ui/structs/struct-path-self-type-mismatch.stderr b/src/test/ui/structs/struct-path-self-type-mismatch.stderr index cfba3be6130..0b1b1e83400 100644 --- a/src/test/ui/structs/struct-path-self-type-mismatch.stderr +++ b/src/test/ui/structs/struct-path-self-type-mismatch.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/struct-path-self-type-mismatch.rs:17:23 + --> $DIR/struct-path-self-type-mismatch.rs:7:23 | LL | Self { inner: 1.5f32 }; //~ ERROR mismatched types | ^^^^^^ expected i32, found f32 error[E0308]: mismatched types - --> $DIR/struct-path-self-type-mismatch.rs:25:20 + --> $DIR/struct-path-self-type-mismatch.rs:15:20 | LL | inner: u | ^ expected type parameter, found a different type parameter @@ -14,7 +14,7 @@ LL | inner: u found type `U` error[E0308]: mismatched types - --> $DIR/struct-path-self-type-mismatch.rs:23:9 + --> $DIR/struct-path-self-type-mismatch.rs:13:9 | LL | fn new(u: U) -> Foo { | ------ expected `Foo` because of return type diff --git a/src/test/ui/structs/struct-path-self.rs b/src/test/ui/structs/struct-path-self.rs index 067d6ac22dc..51ed9e5457e 100644 --- a/src/test/ui/structs/struct-path-self.rs +++ b/src/test/ui/structs/struct-path-self.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S; trait Tr { @@ -16,7 +6,7 @@ trait Tr { //~^ ERROR expected struct, variant or union type, found Self let z = Self:: {}; //~^ ERROR expected struct, variant or union type, found Self - //~| ERROR type parameters are not allowed on this type + //~| ERROR type arguments are not allowed on this entity match s { Self { .. } => {} //~^ ERROR expected struct, variant or union type, found Self @@ -27,7 +17,7 @@ trait Tr { impl Tr for S { fn f() { let s = Self {}; // OK - let z = Self:: {}; //~ ERROR type parameters are not allowed on this type + let z = Self:: {}; //~ ERROR type arguments are not allowed on this entity match s { Self { .. } => {} // OK } @@ -37,7 +27,7 @@ impl Tr for S { impl S { fn g() { let s = Self {}; // OK - let z = Self:: {}; //~ ERROR type parameters are not allowed on this type + let z = Self:: {}; //~ ERROR type arguments are not allowed on this entity match s { Self { .. } => {} // OK } diff --git a/src/test/ui/structs/struct-path-self.stderr b/src/test/ui/structs/struct-path-self.stderr index 1b5506072e8..cda6b7a533f 100644 --- a/src/test/ui/structs/struct-path-self.stderr +++ b/src/test/ui/structs/struct-path-self.stderr @@ -1,38 +1,38 @@ error[E0071]: expected struct, variant or union type, found Self - --> $DIR/struct-path-self.rs:15:17 + --> $DIR/struct-path-self.rs:5:17 | LL | let s = Self {}; | ^^^^ not a struct -error[E0109]: type parameters are not allowed on this type - --> $DIR/struct-path-self.rs:17:24 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/struct-path-self.rs:7:24 | LL | let z = Self:: {}; - | ^^ type parameter not allowed + | ^^ type argument not allowed error[E0071]: expected struct, variant or union type, found Self - --> $DIR/struct-path-self.rs:17:17 + --> $DIR/struct-path-self.rs:7:17 | LL | let z = Self:: {}; | ^^^^^^^^^^ not a struct error[E0071]: expected struct, variant or union type, found Self - --> $DIR/struct-path-self.rs:21:13 + --> $DIR/struct-path-self.rs:11:13 | LL | Self { .. } => {} | ^^^^ not a struct -error[E0109]: type parameters are not allowed on this type - --> $DIR/struct-path-self.rs:30:24 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/struct-path-self.rs:20:24 | -LL | let z = Self:: {}; //~ ERROR type parameters are not allowed on this type - | ^^ type parameter not allowed +LL | let z = Self:: {}; //~ ERROR type arguments are not allowed on this entity + | ^^ type argument not allowed -error[E0109]: type parameters are not allowed on this type - --> $DIR/struct-path-self.rs:40:24 +error[E0109]: type arguments are not allowed on this entity + --> $DIR/struct-path-self.rs:30:24 | -LL | let z = Self:: {}; //~ ERROR type parameters are not allowed on this type - | ^^ type parameter not allowed +LL | let z = Self:: {}; //~ ERROR type arguments are not allowed on this entity + | ^^ type argument not allowed error: aborting due to 6 previous errors diff --git a/src/test/ui/structs/struct-pattern-match-useless.rs b/src/test/ui/structs/struct-pattern-match-useless.rs index dda30141b4a..93f0a931761 100644 --- a/src/test/ui/structs/struct-pattern-match-useless.rs +++ b/src/test/ui/structs/struct-pattern-match-useless.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unreachable_patterns)] struct Foo { diff --git a/src/test/ui/structs/struct-pattern-match-useless.stderr b/src/test/ui/structs/struct-pattern-match-useless.stderr index 60f17d1d906..561964bcb24 100644 --- a/src/test/ui/structs/struct-pattern-match-useless.stderr +++ b/src/test/ui/structs/struct-pattern-match-useless.stderr @@ -1,11 +1,11 @@ error: unreachable pattern - --> $DIR/struct-pattern-match-useless.rs:22:9 + --> $DIR/struct-pattern-match-useless.rs:12:9 | LL | Foo { .. } => () //~ ERROR unreachable pattern | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/struct-pattern-match-useless.rs:11:9 + --> $DIR/struct-pattern-match-useless.rs:1:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/structs/struct-variant-privacy-xc.rs b/src/test/ui/structs/struct-variant-privacy-xc.rs index 8507acd26ce..10e9639096f 100644 --- a/src/test/ui/structs/struct-variant-privacy-xc.rs +++ b/src/test/ui/structs/struct-variant-privacy-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:struct_variant_privacy.rs extern crate struct_variant_privacy; diff --git a/src/test/ui/structs/struct-variant-privacy-xc.stderr b/src/test/ui/structs/struct-variant-privacy-xc.stderr index 7c214f9dcea..da61fc83c26 100644 --- a/src/test/ui/structs/struct-variant-privacy-xc.stderr +++ b/src/test/ui/structs/struct-variant-privacy-xc.stderr @@ -1,11 +1,11 @@ error[E0603]: enum `Bar` is private - --> $DIR/struct-variant-privacy-xc.rs:14:33 + --> $DIR/struct-variant-privacy-xc.rs:4:33 | LL | fn f(b: struct_variant_privacy::Bar) { //~ ERROR enum `Bar` is private | ^^^ error[E0603]: enum `Bar` is private - --> $DIR/struct-variant-privacy-xc.rs:16:33 + --> $DIR/struct-variant-privacy-xc.rs:6:33 | LL | struct_variant_privacy::Bar::Baz { a: _a } => {} //~ ERROR enum `Bar` is private | ^^^ diff --git a/src/test/ui/structs/struct-variant-privacy.rs b/src/test/ui/structs/struct-variant-privacy.rs index 7de4ca62555..8355879e7d9 100644 --- a/src/test/ui/structs/struct-variant-privacy.rs +++ b/src/test/ui/structs/struct-variant-privacy.rs @@ -1,12 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. mod foo { enum Bar { Baz { a: isize } diff --git a/src/test/ui/structs/struct-variant-privacy.stderr b/src/test/ui/structs/struct-variant-privacy.stderr index ffecd880069..0895b52998c 100644 --- a/src/test/ui/structs/struct-variant-privacy.stderr +++ b/src/test/ui/structs/struct-variant-privacy.stderr @@ -1,11 +1,11 @@ error[E0603]: enum `Bar` is private - --> $DIR/struct-variant-privacy.rs:16:14 + --> $DIR/struct-variant-privacy.rs:7:14 | LL | fn f(b: foo::Bar) { //~ ERROR enum `Bar` is private | ^^^ error[E0603]: enum `Bar` is private - --> $DIR/struct-variant-privacy.rs:18:14 + --> $DIR/struct-variant-privacy.rs:9:14 | LL | foo::Bar::Baz { a: _a } => {} //~ ERROR enum `Bar` is private | ^^^ diff --git a/src/test/ui/structs/structure-constructor-type-mismatch.rs b/src/test/ui/structs/structure-constructor-type-mismatch.rs index 87fc5ba93ae..8850f6ea89f 100644 --- a/src/test/ui/structs/structure-constructor-type-mismatch.rs +++ b/src/test/ui/structs/structure-constructor-type-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Point { x: T, y: T, @@ -26,32 +16,32 @@ fn main() { let pt = PointF { x: 1, //~^ ERROR mismatched types - //~| expected f32, found integral variable + //~| expected f32, found integer y: 2, //~^ ERROR mismatched types - //~| expected f32, found integral variable + //~| expected f32, found integer }; let pt2 = Point:: { x: 3, //~^ ERROR mismatched types - //~| expected f32, found integral variable + //~| expected f32, found integer y: 4, //~^ ERROR mismatched types - //~| expected f32, found integral variable + //~| expected f32, found integer }; let pair = PairF { x: 5, //~^ ERROR mismatched types - //~| expected f32, found integral variable + //~| expected f32, found integer y: 6, }; let pair2 = PairF:: { x: 7, //~^ ERROR mismatched types - //~| expected f32, found integral variable + //~| expected f32, found integer y: 8, }; diff --git a/src/test/ui/structs/structure-constructor-type-mismatch.stderr b/src/test/ui/structs/structure-constructor-type-mismatch.stderr index 97a64bf3b55..cc62316bec1 100644 --- a/src/test/ui/structs/structure-constructor-type-mismatch.stderr +++ b/src/test/ui/structs/structure-constructor-type-mismatch.stderr @@ -1,134 +1,140 @@ error[E0308]: mismatched types - --> $DIR/structure-constructor-type-mismatch.rs:27:12 + --> $DIR/structure-constructor-type-mismatch.rs:17:12 | LL | x: 1, | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `1.0` | = note: expected type `f32` found type `{integer}` error[E0308]: mismatched types - --> $DIR/structure-constructor-type-mismatch.rs:30:12 + --> $DIR/structure-constructor-type-mismatch.rs:20:12 | LL | y: 2, | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `2.0` | = note: expected type `f32` found type `{integer}` error[E0308]: mismatched types - --> $DIR/structure-constructor-type-mismatch.rs:36:12 + --> $DIR/structure-constructor-type-mismatch.rs:26:12 | LL | x: 3, | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `3.0` | = note: expected type `f32` found type `{integer}` error[E0308]: mismatched types - --> $DIR/structure-constructor-type-mismatch.rs:39:12 + --> $DIR/structure-constructor-type-mismatch.rs:29:12 | LL | y: 4, | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `4.0` | = note: expected type `f32` found type `{integer}` error[E0308]: mismatched types - --> $DIR/structure-constructor-type-mismatch.rs:45:12 + --> $DIR/structure-constructor-type-mismatch.rs:35:12 | LL | x: 5, | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `5.0` | = note: expected type `f32` found type `{integer}` error[E0308]: mismatched types - --> $DIR/structure-constructor-type-mismatch.rs:52:12 + --> $DIR/structure-constructor-type-mismatch.rs:42:12 | LL | x: 7, | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `7.0` | = note: expected type `f32` found type `{integer}` error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/structure-constructor-type-mismatch.rs:58:24 + --> $DIR/structure-constructor-type-mismatch.rs:48:24 | LL | let pt3 = PointF:: { //~ ERROR wrong number of type arguments | ^^^ unexpected type argument error[E0308]: mismatched types - --> $DIR/structure-constructor-type-mismatch.rs:59:12 + --> $DIR/structure-constructor-type-mismatch.rs:49:12 | LL | x: 9, //~ ERROR mismatched types | ^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `9.0` | = note: expected type `f32` found type `{integer}` error[E0308]: mismatched types - --> $DIR/structure-constructor-type-mismatch.rs:60:12 + --> $DIR/structure-constructor-type-mismatch.rs:50:12 | LL | y: 10, //~ ERROR mismatched types | ^^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `10.0` | = note: expected type `f32` found type `{integer}` error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/structure-constructor-type-mismatch.rs:64:18 + --> $DIR/structure-constructor-type-mismatch.rs:54:18 | LL | PointF:: { .. } => {} //~ ERROR wrong number of type arguments | ^^^ unexpected type argument error[E0308]: mismatched types - --> $DIR/structure-constructor-type-mismatch.rs:64:9 + --> $DIR/structure-constructor-type-mismatch.rs:54:9 | +LL | match (Point { x: 1, y: 2 }) { + | ---------------------- this match expression has type `Point<{integer}>` LL | PointF:: { .. } => {} //~ ERROR wrong number of type arguments - | ^^^^^^^^^^^^^^^^^^^^ expected integral variable, found f32 + | ^^^^^^^^^^^^^^^^^^^^ expected integer, found f32 | = note: expected type `Point<{integer}>` found type `Point` error[E0308]: mismatched types - --> $DIR/structure-constructor-type-mismatch.rs:69:9 + --> $DIR/structure-constructor-type-mismatch.rs:59:9 | +LL | match (Point { x: 1, y: 2 }) { + | ---------------------- this match expression has type `Point<{integer}>` LL | PointF { .. } => {} //~ ERROR mismatched types - | ^^^^^^^^^^^^^ expected integral variable, found f32 + | ^^^^^^^^^^^^^ expected integer, found f32 | = note: expected type `Point<{integer}>` found type `Point` error[E0308]: mismatched types - --> $DIR/structure-constructor-type-mismatch.rs:77:9 + --> $DIR/structure-constructor-type-mismatch.rs:67:9 | +LL | match (Pair { x: 1, y: 2 }) { + | --------------------- this match expression has type `Pair<{integer}, {integer}>` LL | PairF:: { .. } => {} //~ ERROR mismatched types - | ^^^^^^^^^^^^^^^^^^^ expected integral variable, found f32 + | ^^^^^^^^^^^^^^^^^^^ expected integer, found f32 | = note: expected type `Pair<{integer}, {integer}>` found type `Pair` diff --git a/src/test/ui/substs-ppaux.normal.stderr b/src/test/ui/substs-ppaux.normal.stderr index 9f87329fb34..567b4d9f440 100644 --- a/src/test/ui/substs-ppaux.normal.stderr +++ b/src/test/ui/substs-ppaux.normal.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/substs-ppaux.rs:25:17 + --> $DIR/substs-ppaux.rs:16:17 | LL | let x: () = >::bar::<'static, char>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found fn item @@ -8,7 +8,7 @@ LL | let x: () = >::bar::<'static, char>; found type `fn() {>::bar::<'static, char>}` error[E0308]: mismatched types - --> $DIR/substs-ppaux.rs:34:17 + --> $DIR/substs-ppaux.rs:25:17 | LL | let x: () = >::bar::<'static, char>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found fn item @@ -17,7 +17,7 @@ LL | let x: () = >::bar::<'static, char>; found type `fn() {>::bar::<'static, char>}` error[E0308]: mismatched types - --> $DIR/substs-ppaux.rs:42:17 + --> $DIR/substs-ppaux.rs:33:17 | LL | let x: () = >::baz; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found fn item @@ -26,7 +26,7 @@ LL | let x: () = >::baz; found type `fn() {>::baz}` error[E0308]: mismatched types - --> $DIR/substs-ppaux.rs:50:17 + --> $DIR/substs-ppaux.rs:41:17 | LL | let x: () = foo::<'static>; | ^^^^^^^^^^^^^^ expected (), found fn item @@ -35,16 +35,16 @@ LL | let x: () = foo::<'static>; found type `fn() {foo::<'static>}` error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/substs-ppaux.rs:58:5 + --> $DIR/substs-ppaux.rs:49:5 | LL | >::bar; | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for `str` note: required by `Foo::bar` - --> $DIR/substs-ppaux.rs:16:5 + --> $DIR/substs-ppaux.rs:7:5 | LL | fn bar<'a, T>() where T: 'a {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/substs-ppaux.rs b/src/test/ui/substs-ppaux.rs index d0e9a7f4a40..7ad7ccb5444 100644 --- a/src/test/ui/substs-ppaux.rs +++ b/src/test/ui/substs-ppaux.rs @@ -1,12 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // // revisions: verbose normal // diff --git a/src/test/ui/substs-ppaux.verbose.stderr b/src/test/ui/substs-ppaux.verbose.stderr index 2daa960be3a..9d8a555dffe 100644 --- a/src/test/ui/substs-ppaux.verbose.stderr +++ b/src/test/ui/substs-ppaux.verbose.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/substs-ppaux.rs:25:17 + --> $DIR/substs-ppaux.rs:16:17 | LL | let x: () = >::bar::<'static, char>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found fn item @@ -8,7 +8,7 @@ LL | let x: () = >::bar::<'static, char>; found type `fn() {>::bar::}` error[E0308]: mismatched types - --> $DIR/substs-ppaux.rs:34:17 + --> $DIR/substs-ppaux.rs:25:17 | LL | let x: () = >::bar::<'static, char>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found fn item @@ -17,7 +17,7 @@ LL | let x: () = >::bar::<'static, char>; found type `fn() {>::bar::}` error[E0308]: mismatched types - --> $DIR/substs-ppaux.rs:42:17 + --> $DIR/substs-ppaux.rs:33:17 | LL | let x: () = >::baz; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found fn item @@ -26,7 +26,7 @@ LL | let x: () = >::baz; found type `fn() {>::baz}` error[E0308]: mismatched types - --> $DIR/substs-ppaux.rs:50:17 + --> $DIR/substs-ppaux.rs:41:17 | LL | let x: () = foo::<'static>; | ^^^^^^^^^^^^^^ expected (), found fn item @@ -35,16 +35,16 @@ LL | let x: () = foo::<'static>; found type `fn() {foo::}` error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/substs-ppaux.rs:58:5 + --> $DIR/substs-ppaux.rs:49:5 | LL | >::bar; | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8>` for `str` note: required by `Foo::bar` - --> $DIR/substs-ppaux.rs:16:5 + --> $DIR/substs-ppaux.rs:7:5 | LL | fn bar<'a, T>() where T: 'a {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/suffixed-literal-meta.rs b/src/test/ui/suffixed-literal-meta.rs index 2e6c3994159..bd2d6623d91 100644 --- a/src/test/ui/suffixed-literal-meta.rs +++ b/src/test/ui/suffixed-literal-meta.rs @@ -1,23 +1,15 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#![feature(custom_attribute)] -#[path = 1usize] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1u8] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1u16] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1u32] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1u64] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1isize] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1i8] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1i16] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1i32] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1i64] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes -#[path = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1usize] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1u8] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1u16] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1u32] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1u64] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1isize] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1i8] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1i16] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1i32] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1i64] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes +#[my_attr = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes fn main() { } diff --git a/src/test/ui/suffixed-literal-meta.stderr b/src/test/ui/suffixed-literal-meta.stderr index 53ff60b0705..265aa78d53f 100644 --- a/src/test/ui/suffixed-literal-meta.stderr +++ b/src/test/ui/suffixed-literal-meta.stderr @@ -1,96 +1,96 @@ error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:11:10 + --> $DIR/suffixed-literal-meta.rs:3:13 | -LL | #[path = 1usize] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^^^ +LL | #[my_attr = 1usize] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:12:10 + --> $DIR/suffixed-literal-meta.rs:4:13 | -LL | #[path = 1u8] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^ +LL | #[my_attr = 1u8] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:13:10 + --> $DIR/suffixed-literal-meta.rs:5:13 | -LL | #[path = 1u16] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^ +LL | #[my_attr = 1u16] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:14:10 + --> $DIR/suffixed-literal-meta.rs:6:13 | -LL | #[path = 1u32] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^ +LL | #[my_attr = 1u32] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:15:10 + --> $DIR/suffixed-literal-meta.rs:7:13 | -LL | #[path = 1u64] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^ +LL | #[my_attr = 1u64] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:16:10 + --> $DIR/suffixed-literal-meta.rs:8:13 | -LL | #[path = 1isize] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^^^ +LL | #[my_attr = 1isize] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:17:10 + --> $DIR/suffixed-literal-meta.rs:9:13 | -LL | #[path = 1i8] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^ +LL | #[my_attr = 1i8] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:18:10 + --> $DIR/suffixed-literal-meta.rs:10:13 | -LL | #[path = 1i16] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^ +LL | #[my_attr = 1i16] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:19:10 + --> $DIR/suffixed-literal-meta.rs:11:13 | -LL | #[path = 1i32] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^ +LL | #[my_attr = 1i32] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:20:10 + --> $DIR/suffixed-literal-meta.rs:12:13 | -LL | #[path = 1i64] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^ +LL | #[my_attr = 1i64] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:21:10 + --> $DIR/suffixed-literal-meta.rs:13:13 | -LL | #[path = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^^^ +LL | #[my_attr = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). error: suffixed literals are not allowed in attributes - --> $DIR/suffixed-literal-meta.rs:22:10 + --> $DIR/suffixed-literal-meta.rs:14:13 | -LL | #[path = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes - | ^^^^^^ +LL | #[my_attr = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes + | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). diff --git a/src/test/ui/suggestions/as-ref.rs b/src/test/ui/suggestions/as-ref.rs new file mode 100644 index 00000000000..03f04c389f1 --- /dev/null +++ b/src/test/ui/suggestions/as-ref.rs @@ -0,0 +1,25 @@ +struct Foo; +fn takes_ref(_: &Foo) {} + +fn main() { + let ref opt = Some(Foo); + opt.map(|arg| takes_ref(arg)); + //~^ ERROR mismatched types [E0308] + opt.and_then(|arg| Some(takes_ref(arg))); + //~^ ERROR mismatched types [E0308] + let ref opt: Result<_, ()> = Ok(Foo); + opt.map(|arg| takes_ref(arg)); + //~^ ERROR mismatched types [E0308] + opt.and_then(|arg| Ok(takes_ref(arg))); + //~^ ERROR mismatched types [E0308] + let x: &Option = &Some(3); + let y: Option<&usize> = x; + //~^ ERROR mismatched types [E0308] + let x: &Result = &Ok(3); + let y: Result<&usize, &usize> = x; + //~^ ERROR mismatched types [E0308] + // note: do not suggest because of `E: usize` + let x: &Result = &Ok(3); + let y: Result<&usize, usize> = x; + //~^ ERROR mismatched types [E0308] +} diff --git a/src/test/ui/suggestions/as-ref.stderr b/src/test/ui/suggestions/as-ref.stderr new file mode 100644 index 00000000000..7273496a7ce --- /dev/null +++ b/src/test/ui/suggestions/as-ref.stderr @@ -0,0 +1,81 @@ +error[E0308]: mismatched types + --> $DIR/as-ref.rs:6:27 + | +LL | opt.map(|arg| takes_ref(arg)); + | - ^^^ expected &Foo, found struct `Foo` + | | + | help: consider using `as_ref` instead: `as_ref().` + | + = note: expected type `&Foo` + found type `Foo` + +error[E0308]: mismatched types + --> $DIR/as-ref.rs:8:37 + | +LL | opt.and_then(|arg| Some(takes_ref(arg))); + | - ^^^ expected &Foo, found struct `Foo` + | | + | help: consider using `as_ref` instead: `as_ref().` + | + = note: expected type `&Foo` + found type `Foo` + +error[E0308]: mismatched types + --> $DIR/as-ref.rs:11:27 + | +LL | opt.map(|arg| takes_ref(arg)); + | - ^^^ expected &Foo, found struct `Foo` + | | + | help: consider using `as_ref` instead: `as_ref().` + | + = note: expected type `&Foo` + found type `Foo` + +error[E0308]: mismatched types + --> $DIR/as-ref.rs:13:35 + | +LL | opt.and_then(|arg| Ok(takes_ref(arg))); + | - ^^^ expected &Foo, found struct `Foo` + | | + | help: consider using `as_ref` instead: `as_ref().` + | + = note: expected type `&Foo` + found type `Foo` + +error[E0308]: mismatched types + --> $DIR/as-ref.rs:16:27 + | +LL | let y: Option<&usize> = x; + | ^ + | | + | expected enum `std::option::Option`, found reference + | help: you can convert from `&Option` to `Option<&T>` using `.as_ref()`: `x.as_ref()` + | + = note: expected type `std::option::Option<&usize>` + found type `&std::option::Option` + +error[E0308]: mismatched types + --> $DIR/as-ref.rs:19:35 + | +LL | let y: Result<&usize, &usize> = x; + | ^ expected enum `std::result::Result`, found reference + | + = note: expected type `std::result::Result<&usize, &usize>` + found type `&std::result::Result` +help: you can convert from `&Result` to `Result<&T, &E>` using `.as_ref()` + | +LL | let y: Result<&usize, &usize> = x.as_ref(); + | ^^^^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/as-ref.rs:23:34 + | +LL | let y: Result<&usize, usize> = x; + | ^ expected enum `std::result::Result`, found reference + | + = note: expected type `std::result::Result<&usize, usize>` + found type `&std::result::Result` + +error: aborting due to 7 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/attribute-typos.rs b/src/test/ui/suggestions/attribute-typos.rs new file mode 100644 index 00000000000..13c6308b97e --- /dev/null +++ b/src/test/ui/suggestions/attribute-typos.rs @@ -0,0 +1,13 @@ +#[deprcated] //~ ERROR E0658 +fn foo() {} //~| HELP a built-in attribute with a similar name exists + //~| SUGGESTION deprecated + //~| HELP add #![feature(custom_attribute)] to the crate attributes to enable + +#[tests] //~ ERROR E0658 +fn bar() {} //~| HELP a built-in attribute with a similar name exists + //~| SUGGESTION test + //~| HELP add #![feature(custom_attribute)] to the crate attributes to enable + +#[rustc_err] //~ ERROR E0658 +fn main() {} //~| HELP add #![feature(rustc_attrs)] to the crate attributes to enable + // don't suggest rustc attributes diff --git a/src/test/ui/suggestions/attribute-typos.stderr b/src/test/ui/suggestions/attribute-typos.stderr new file mode 100644 index 00000000000..e40da787e96 --- /dev/null +++ b/src/test/ui/suggestions/attribute-typos.stderr @@ -0,0 +1,27 @@ +error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642) + --> $DIR/attribute-typos.rs:11:3 + | +LL | #[rustc_err] //~ ERROR E0658 + | ^^^^^^^^^ + | + = help: add #![feature(rustc_attrs)] to the crate attributes to enable + +error[E0658]: The attribute `tests` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/attribute-typos.rs:6:3 + | +LL | #[tests] //~ ERROR E0658 + | ^^^^^ help: a built-in attribute with a similar name exists: `test` + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error[E0658]: The attribute `deprcated` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/attribute-typos.rs:1:3 + | +LL | #[deprcated] //~ ERROR E0658 + | ^^^^^^^^^ help: a built-in attribute with a similar name exists: `deprecated` + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/suggestions/auxiliary/struct_field_privacy.rs b/src/test/ui/suggestions/auxiliary/struct_field_privacy.rs index 5fea97da03e..9765af1a7f6 100644 --- a/src/test/ui/suggestions/auxiliary/struct_field_privacy.rs +++ b/src/test/ui/suggestions/auxiliary/struct_field_privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct A { a: isize, pub b: isize, diff --git a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs index dc0186e3f26..4faede35305 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #[derive(Clone)] diff --git a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr index bb3688411f7..4b51294f86a 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:51:27 + --> $DIR/duplicate-suggestions.rs:41:27 | LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); | --------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -9,13 +9,13 @@ LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); | help: consider removing the `&`: `(X(_t), X(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:51:13 + --> $DIR/duplicate-suggestions.rs:41:13 | LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone()); | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:55:50 + --> $DIR/duplicate-suggestions.rs:45:50 | LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } | ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -25,13 +25,13 @@ LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:55:26 + --> $DIR/duplicate-suggestions.rs:45:26 | LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:59:53 + --> $DIR/duplicate-suggestions.rs:49:53 | LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } | ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -41,13 +41,13 @@ LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:59:29 + --> $DIR/duplicate-suggestions.rs:49:29 | LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { } | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:63:11 + --> $DIR/duplicate-suggestions.rs:53:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -61,7 +61,7 @@ LL | &(Either::Two(_t), Either::One(_u)) => (), | -- ...and here -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:65:23 + --> $DIR/duplicate-suggestions.rs:55:23 | LL | &(Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ @@ -78,7 +78,7 @@ LL | (Either::Two(_t), Either::One(_u)) => (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:73:11 + --> $DIR/duplicate-suggestions.rs:63:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -91,13 +91,13 @@ LL | &(Either::One(_t), Either::Two(_u)) | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:75:23 + --> $DIR/duplicate-suggestions.rs:65:23 | LL | &(Either::One(_t), Either::Two(_u)) | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:82:11 + --> $DIR/duplicate-suggestions.rs:72:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -110,13 +110,13 @@ LL | &(Either::One(_t), Either::Two(_u)) => (), | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:84:23 + --> $DIR/duplicate-suggestions.rs:74:23 | LL | &(Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:90:11 + --> $DIR/duplicate-suggestions.rs:80:11 | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -129,13 +129,13 @@ LL | &(Either::One(_t), Either::Two(_u)) => (), | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:92:23 + --> $DIR/duplicate-suggestions.rs:82:23 | LL | &(Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:103:31 + --> $DIR/duplicate-suggestions.rs:93:31 | LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -145,13 +145,13 @@ LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); | help: consider removing the `&mut`: `(X(_t), X(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:103:17 + --> $DIR/duplicate-suggestions.rs:93:17 | LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone()); | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:107:54 + --> $DIR/duplicate-suggestions.rs:97:54 | LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } | --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -161,13 +161,13 @@ LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.c | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:107:30 + --> $DIR/duplicate-suggestions.rs:97:30 | LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:111:57 + --> $DIR/duplicate-suggestions.rs:101:57 | LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } | --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -177,13 +177,13 @@ LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), e | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:111:33 + --> $DIR/duplicate-suggestions.rs:101:33 | LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { } | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:115:11 + --> $DIR/duplicate-suggestions.rs:105:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -197,7 +197,7 @@ LL | &mut (Either::Two(_t), Either::One(_u)) => (), | -- ...and here -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:117:27 + --> $DIR/duplicate-suggestions.rs:107:27 | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ @@ -214,7 +214,7 @@ LL | (Either::Two(_t), Either::One(_u)) => (), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:125:11 + --> $DIR/duplicate-suggestions.rs:115:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -227,13 +227,13 @@ LL | &mut (Either::One(_t), Either::Two(_u)) | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:127:27 + --> $DIR/duplicate-suggestions.rs:117:27 | LL | &mut (Either::One(_t), Either::Two(_u)) | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:134:11 + --> $DIR/duplicate-suggestions.rs:124:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -246,13 +246,13 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (), | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:136:27 + --> $DIR/duplicate-suggestions.rs:126:27 | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:142:11 + --> $DIR/duplicate-suggestions.rs:132:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -265,13 +265,13 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (), | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:144:27 + --> $DIR/duplicate-suggestions.rs:134:27 | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:150:11 + --> $DIR/duplicate-suggestions.rs:140:11 | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -284,13 +284,13 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (), | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:152:27 + --> $DIR/duplicate-suggestions.rs:142:27 | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:98:11 + --> $DIR/duplicate-suggestions.rs:88:11 | LL | fn f5(&(X(_t), X(_u)): &(X, X)) { } | ^^^^--^^^^^--^^ @@ -301,13 +301,13 @@ LL | fn f5(&(X(_t), X(_u)): &(X, X)) { } | help: consider removing the `&`: `(X(_t), X(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:98:15 + --> $DIR/duplicate-suggestions.rs:88:15 | LL | fn f5(&(X(_t), X(_u)): &(X, X)) { } | ^^ ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/duplicate-suggestions.rs:158:11 + --> $DIR/duplicate-suggestions.rs:148:11 | LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } | ^^^^^^^^--^^^^^--^^ @@ -318,7 +318,7 @@ LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } | help: consider removing the `&mut`: `(X(_t), X(_u))` | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/duplicate-suggestions.rs:158:19 + --> $DIR/duplicate-suggestions.rs:148:19 | LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { } | ^^ ^^ diff --git a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs index 8cc847e693f..90a9fe4e7d0 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #[derive(Clone)] diff --git a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr index 228ec5afce6..f1d515e932c 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:40:21 + --> $DIR/move-into-closure.rs:30:21 | LL | let x = X(Y); | - captured outer variable @@ -12,13 +12,13 @@ LL | let X(_t) = x; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:40:15 + --> $DIR/move-into-closure.rs:30:15 | LL | let X(_t) = x; | ^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:44:34 + --> $DIR/move-into-closure.rs:34:34 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -31,13 +31,13 @@ LL | if let Either::One(_t) = e { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:44:28 + --> $DIR/move-into-closure.rs:34:28 | LL | if let Either::One(_t) = e { } | ^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:48:37 + --> $DIR/move-into-closure.rs:38:37 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -50,13 +50,13 @@ LL | while let Either::One(_t) = e { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:48:31 + --> $DIR/move-into-closure.rs:38:31 | LL | while let Either::One(_t) = e { } | ^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:52:15 + --> $DIR/move-into-closure.rs:42:15 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -71,13 +71,13 @@ LL | Either::One(_t) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:56:25 + --> $DIR/move-into-closure.rs:46:25 | LL | Either::One(_t) | ^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:59:15 + --> $DIR/move-into-closure.rs:49:15 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -92,13 +92,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:63:25 + --> $DIR/move-into-closure.rs:53:25 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:68:25 + --> $DIR/move-into-closure.rs:58:25 | LL | let x = X(Y); | - captured outer variable @@ -111,13 +111,13 @@ LL | let X(mut _t) = x; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:68:15 + --> $DIR/move-into-closure.rs:58:15 | LL | let X(mut _t) = x; | ^^^^^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:72:38 + --> $DIR/move-into-closure.rs:62:38 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -130,13 +130,13 @@ LL | if let Either::One(mut _t) = em { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:72:28 + --> $DIR/move-into-closure.rs:62:28 | LL | if let Either::One(mut _t) = em { } | ^^^^^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:76:41 + --> $DIR/move-into-closure.rs:66:41 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -149,13 +149,13 @@ LL | while let Either::One(mut _t) = em { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:76:31 + --> $DIR/move-into-closure.rs:66:31 | LL | while let Either::One(mut _t) = em { } | ^^^^^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:80:15 + --> $DIR/move-into-closure.rs:70:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -170,13 +170,13 @@ LL | Either::One(mut _t) | ------ data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:84:25 + --> $DIR/move-into-closure.rs:74:25 | LL | Either::One(mut _t) | ^^^^^^ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/move-into-closure.rs:87:15 + --> $DIR/move-into-closure.rs:77:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -191,13 +191,13 @@ LL | Either::One(mut _t) => (), | ------ data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:91:25 + --> $DIR/move-into-closure.rs:81:25 | LL | Either::One(mut _t) => (), | ^^^^^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:107:21 + --> $DIR/move-into-closure.rs:97:21 | LL | let x = X(Y); | - captured outer variable @@ -210,13 +210,13 @@ LL | let X(_t) = x; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:107:15 + --> $DIR/move-into-closure.rs:97:15 | LL | let X(_t) = x; | ^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:111:34 + --> $DIR/move-into-closure.rs:101:34 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -229,13 +229,13 @@ LL | if let Either::One(_t) = e { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:111:28 + --> $DIR/move-into-closure.rs:101:28 | LL | if let Either::One(_t) = e { } | ^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:115:37 + --> $DIR/move-into-closure.rs:105:37 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -248,13 +248,13 @@ LL | while let Either::One(_t) = e { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:115:31 + --> $DIR/move-into-closure.rs:105:31 | LL | while let Either::One(_t) = e { } | ^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:119:15 + --> $DIR/move-into-closure.rs:109:15 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -269,13 +269,13 @@ LL | Either::One(_t) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:123:25 + --> $DIR/move-into-closure.rs:113:25 | LL | Either::One(_t) | ^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:126:15 + --> $DIR/move-into-closure.rs:116:15 | LL | let e = Either::One(X(Y)); | - captured outer variable @@ -290,13 +290,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:130:25 + --> $DIR/move-into-closure.rs:120:25 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:135:25 + --> $DIR/move-into-closure.rs:125:25 | LL | let x = X(Y); | - captured outer variable @@ -309,13 +309,13 @@ LL | let X(mut _t) = x; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:135:15 + --> $DIR/move-into-closure.rs:125:15 | LL | let X(mut _t) = x; | ^^^^^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:139:38 + --> $DIR/move-into-closure.rs:129:38 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -328,13 +328,13 @@ LL | if let Either::One(mut _t) = em { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:139:28 + --> $DIR/move-into-closure.rs:129:28 | LL | if let Either::One(mut _t) = em { } | ^^^^^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:143:41 + --> $DIR/move-into-closure.rs:133:41 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -347,13 +347,13 @@ LL | while let Either::One(mut _t) = em { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:143:31 + --> $DIR/move-into-closure.rs:133:31 | LL | while let Either::One(mut _t) = em { } | ^^^^^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:147:15 + --> $DIR/move-into-closure.rs:137:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -368,13 +368,13 @@ LL | Either::One(mut _t) | ------ data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:151:25 + --> $DIR/move-into-closure.rs:141:25 | LL | Either::One(mut _t) | ^^^^^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:154:15 + --> $DIR/move-into-closure.rs:144:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -389,13 +389,13 @@ LL | Either::One(mut _t) => (), | ------ data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:158:25 + --> $DIR/move-into-closure.rs:148:25 | LL | Either::One(mut _t) => (), | ^^^^^^ error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/move-into-closure.rs:162:15 + --> $DIR/move-into-closure.rs:152:15 | LL | let mut em = Either::One(X(Y)); | ------ captured outer variable @@ -410,7 +410,7 @@ LL | Either::One(mut _t) => (), | ------ data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/move-into-closure.rs:166:25 + --> $DIR/move-into-closure.rs:156:25 | LL | Either::One(mut _t) => (), | ^^^^^^ diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.rs b/src/test/ui/suggestions/dont-suggest-ref/simple.rs index 474e88c4d53..58aab85ac26 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/simple.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] #[derive(Clone)] diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr index d7a32dbfcc6..296fcef0c4a 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:50:17 + --> $DIR/simple.rs:40:17 | LL | let X(_t) = *s; | -- ^^ @@ -9,13 +9,13 @@ LL | let X(_t) = *s; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:50:11 + --> $DIR/simple.rs:40:11 | LL | let X(_t) = *s; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:54:30 + --> $DIR/simple.rs:44:30 | LL | if let Either::One(_t) = *r { } | -- ^^ @@ -25,13 +25,13 @@ LL | if let Either::One(_t) = *r { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:54:24 + --> $DIR/simple.rs:44:24 | LL | if let Either::One(_t) = *r { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:58:33 + --> $DIR/simple.rs:48:33 | LL | while let Either::One(_t) = *r { } | -- ^^ @@ -41,13 +41,13 @@ LL | while let Either::One(_t) = *r { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:58:27 + --> $DIR/simple.rs:48:27 | LL | while let Either::One(_t) = *r { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:62:11 + --> $DIR/simple.rs:52:11 | LL | match *r { | ^^ @@ -59,13 +59,13 @@ LL | Either::One(_t) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:66:21 + --> $DIR/simple.rs:56:21 | LL | Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:69:11 + --> $DIR/simple.rs:59:11 | LL | match *r { | ^^ @@ -77,13 +77,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:73:21 + --> $DIR/simple.rs:63:21 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:78:17 + --> $DIR/simple.rs:68:17 | LL | let X(_t) = *sm; | -- ^^^ @@ -93,13 +93,13 @@ LL | let X(_t) = *sm; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:78:11 + --> $DIR/simple.rs:68:11 | LL | let X(_t) = *sm; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:82:30 + --> $DIR/simple.rs:72:30 | LL | if let Either::One(_t) = *rm { } | -- ^^^ @@ -109,13 +109,13 @@ LL | if let Either::One(_t) = *rm { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:82:24 + --> $DIR/simple.rs:72:24 | LL | if let Either::One(_t) = *rm { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:86:33 + --> $DIR/simple.rs:76:33 | LL | while let Either::One(_t) = *rm { } | -- ^^^ @@ -125,13 +125,13 @@ LL | while let Either::One(_t) = *rm { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:86:27 + --> $DIR/simple.rs:76:27 | LL | while let Either::One(_t) = *rm { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:90:11 + --> $DIR/simple.rs:80:11 | LL | match *rm { | ^^^ @@ -143,13 +143,13 @@ LL | Either::One(_t) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:94:21 + --> $DIR/simple.rs:84:21 | LL | Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:97:11 + --> $DIR/simple.rs:87:11 | LL | match *rm { | ^^^ @@ -161,13 +161,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:101:21 + --> $DIR/simple.rs:91:21 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:105:11 + --> $DIR/simple.rs:95:11 | LL | match *rm { | ^^^ @@ -179,13 +179,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:109:21 + --> $DIR/simple.rs:99:21 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:114:17 + --> $DIR/simple.rs:104:17 | LL | let X(_t) = vs[0]; | -- ^^^^^ @@ -195,13 +195,13 @@ LL | let X(_t) = vs[0]; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:114:11 + --> $DIR/simple.rs:104:11 | LL | let X(_t) = vs[0]; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:118:30 + --> $DIR/simple.rs:108:30 | LL | if let Either::One(_t) = vr[0] { } | -- ^^^^^ @@ -211,13 +211,13 @@ LL | if let Either::One(_t) = vr[0] { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:118:24 + --> $DIR/simple.rs:108:24 | LL | if let Either::One(_t) = vr[0] { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:122:33 + --> $DIR/simple.rs:112:33 | LL | while let Either::One(_t) = vr[0] { } | -- ^^^^^ @@ -227,13 +227,13 @@ LL | while let Either::One(_t) = vr[0] { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:122:27 + --> $DIR/simple.rs:112:27 | LL | while let Either::One(_t) = vr[0] { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:126:11 + --> $DIR/simple.rs:116:11 | LL | match vr[0] { | ^^^^^ @@ -245,13 +245,13 @@ LL | Either::One(_t) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:130:21 + --> $DIR/simple.rs:120:21 | LL | Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:133:11 + --> $DIR/simple.rs:123:11 | LL | match vr[0] { | ^^^^^ @@ -263,13 +263,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:137:21 + --> $DIR/simple.rs:127:21 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:142:17 + --> $DIR/simple.rs:132:17 | LL | let X(_t) = vsm[0]; | -- ^^^^^^ @@ -279,13 +279,13 @@ LL | let X(_t) = vsm[0]; | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:142:11 + --> $DIR/simple.rs:132:11 | LL | let X(_t) = vsm[0]; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:146:30 + --> $DIR/simple.rs:136:30 | LL | if let Either::One(_t) = vrm[0] { } | -- ^^^^^^ @@ -295,13 +295,13 @@ LL | if let Either::One(_t) = vrm[0] { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:146:24 + --> $DIR/simple.rs:136:24 | LL | if let Either::One(_t) = vrm[0] { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:150:33 + --> $DIR/simple.rs:140:33 | LL | while let Either::One(_t) = vrm[0] { } | -- ^^^^^^ @@ -311,13 +311,13 @@ LL | while let Either::One(_t) = vrm[0] { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:150:27 + --> $DIR/simple.rs:140:27 | LL | while let Either::One(_t) = vrm[0] { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:154:11 + --> $DIR/simple.rs:144:11 | LL | match vrm[0] { | ^^^^^^ @@ -329,13 +329,13 @@ LL | Either::One(_t) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:158:21 + --> $DIR/simple.rs:148:21 | LL | Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:161:11 + --> $DIR/simple.rs:151:11 | LL | match vrm[0] { | ^^^^^^ @@ -347,13 +347,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:165:21 + --> $DIR/simple.rs:155:21 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:169:11 + --> $DIR/simple.rs:159:11 | LL | match vrm[0] { | ^^^^^^ @@ -365,13 +365,13 @@ LL | Either::One(_t) => (), | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:173:21 + --> $DIR/simple.rs:163:21 | LL | Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:180:18 + --> $DIR/simple.rs:170:18 | LL | let &X(_t) = s; | ------ ^ cannot move out of borrowed content @@ -380,13 +380,13 @@ LL | let &X(_t) = s; | help: consider removing the `&`: `X(_t)` | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:180:12 + --> $DIR/simple.rs:170:12 | LL | let &X(_t) = s; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:184:31 + --> $DIR/simple.rs:174:31 | LL | if let &Either::One(_t) = r { } | ---------------- ^ cannot move out of borrowed content @@ -395,13 +395,13 @@ LL | if let &Either::One(_t) = r { } | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:184:25 + --> $DIR/simple.rs:174:25 | LL | if let &Either::One(_t) = r { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:188:34 + --> $DIR/simple.rs:178:34 | LL | while let &Either::One(_t) = r { } | ---------------- ^ cannot move out of borrowed content @@ -410,13 +410,13 @@ LL | while let &Either::One(_t) = r { } | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:188:28 + --> $DIR/simple.rs:178:28 | LL | while let &Either::One(_t) = r { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:192:11 + --> $DIR/simple.rs:182:11 | LL | match r { | ^ cannot move out of borrowed content @@ -428,13 +428,13 @@ LL | &Either::One(_t) | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:194:22 + --> $DIR/simple.rs:184:22 | LL | &Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:200:11 + --> $DIR/simple.rs:190:11 | LL | match r { | ^ cannot move out of borrowed content @@ -446,13 +446,13 @@ LL | &Either::One(_t) => (), | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:202:22 + --> $DIR/simple.rs:192:22 | LL | &Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:207:11 + --> $DIR/simple.rs:197:11 | LL | match r { | ^ cannot move out of borrowed content @@ -464,13 +464,13 @@ LL | &Either::One(_t) => (), | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:209:22 + --> $DIR/simple.rs:199:22 | LL | &Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:219:22 + --> $DIR/simple.rs:209:22 | LL | let &mut X(_t) = sm; | ---------- ^^ cannot move out of borrowed content @@ -479,13 +479,13 @@ LL | let &mut X(_t) = sm; | help: consider removing the `&mut`: `X(_t)` | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:219:16 + --> $DIR/simple.rs:209:16 | LL | let &mut X(_t) = sm; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:223:35 + --> $DIR/simple.rs:213:35 | LL | if let &mut Either::One(_t) = rm { } | -------------------- ^^ cannot move out of borrowed content @@ -494,13 +494,13 @@ LL | if let &mut Either::One(_t) = rm { } | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:223:29 + --> $DIR/simple.rs:213:29 | LL | if let &mut Either::One(_t) = rm { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:227:38 + --> $DIR/simple.rs:217:38 | LL | while let &mut Either::One(_t) = rm { } | -------------------- ^^ cannot move out of borrowed content @@ -509,13 +509,13 @@ LL | while let &mut Either::One(_t) = rm { } | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:227:32 + --> $DIR/simple.rs:217:32 | LL | while let &mut Either::One(_t) = rm { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:231:11 + --> $DIR/simple.rs:221:11 | LL | match rm { | ^^ cannot move out of borrowed content @@ -527,7 +527,7 @@ LL | &mut Either::Two(_t) => (), | -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/simple.rs:233:26 + --> $DIR/simple.rs:223:26 | LL | &mut Either::One(_t) => (), | ^^ @@ -544,7 +544,7 @@ LL | Either::Two(_t) => (), | ^^^^^^^^^^^^^^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:240:11 + --> $DIR/simple.rs:230:11 | LL | match rm { | ^^ cannot move out of borrowed content @@ -556,13 +556,13 @@ LL | &mut Either::One(_t) => (), | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:242:26 + --> $DIR/simple.rs:232:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:247:11 + --> $DIR/simple.rs:237:11 | LL | match rm { | ^^ cannot move out of borrowed content @@ -574,13 +574,13 @@ LL | &mut Either::One(_t) => (), | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:249:26 + --> $DIR/simple.rs:239:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:254:11 + --> $DIR/simple.rs:244:11 | LL | match rm { | ^^ cannot move out of borrowed content @@ -592,13 +592,13 @@ LL | &mut Either::One(_t) => (), | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:256:26 + --> $DIR/simple.rs:246:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:270:21 + --> $DIR/simple.rs:260:21 | LL | let (&X(_t),) = (&x.clone(),); | -- ^^^^^^^^^^^^^ cannot move out of borrowed content @@ -606,13 +606,13 @@ LL | let (&X(_t),) = (&x.clone(),); | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:270:13 + --> $DIR/simple.rs:260:13 | LL | let (&X(_t),) = (&x.clone(),); | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:272:34 + --> $DIR/simple.rs:262:34 | LL | if let (&Either::One(_t),) = (&e.clone(),) { } | -- ^^^^^^^^^^^^^ cannot move out of borrowed content @@ -620,13 +620,13 @@ LL | if let (&Either::One(_t),) = (&e.clone(),) { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:272:26 + --> $DIR/simple.rs:262:26 | LL | if let (&Either::One(_t),) = (&e.clone(),) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:274:37 + --> $DIR/simple.rs:264:37 | LL | while let (&Either::One(_t),) = (&e.clone(),) { } | -- ^^^^^^^^^^^^^ cannot move out of borrowed content @@ -634,13 +634,13 @@ LL | while let (&Either::One(_t),) = (&e.clone(),) { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:274:29 + --> $DIR/simple.rs:264:29 | LL | while let (&Either::One(_t),) = (&e.clone(),) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:276:11 + --> $DIR/simple.rs:266:11 | LL | match (&e.clone(),) { | ^^^^^^^^^^^^^ cannot move out of borrowed content @@ -649,13 +649,13 @@ LL | (&Either::One(_t),) | -- data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:278:23 + --> $DIR/simple.rs:268:23 | LL | (&Either::One(_t),) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:284:25 + --> $DIR/simple.rs:274:25 | LL | let (&mut X(_t),) = (&mut xm.clone(),); | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -663,13 +663,13 @@ LL | let (&mut X(_t),) = (&mut xm.clone(),); | data moved here | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:284:17 + --> $DIR/simple.rs:274:17 | LL | let (&mut X(_t),) = (&mut xm.clone(),); | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:286:38 + --> $DIR/simple.rs:276:38 | LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { } | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -677,13 +677,13 @@ LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:286:30 + --> $DIR/simple.rs:276:30 | LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:288:41 + --> $DIR/simple.rs:278:41 | LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { } | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -691,13 +691,13 @@ LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { } | data moved here | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:288:33 + --> $DIR/simple.rs:278:33 | LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:290:11 + --> $DIR/simple.rs:280:11 | LL | match (&mut em.clone(),) { | ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content @@ -708,7 +708,7 @@ LL | (&mut Either::Two(_t),) => (), | -- ...and here | note: move occurs because these variables have types that don't implement the `Copy` trait - --> $DIR/simple.rs:292:27 + --> $DIR/simple.rs:282:27 | LL | (&mut Either::One(_t),) => (), | ^^ @@ -716,7 +716,7 @@ LL | (&mut Either::Two(_t),) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:300:18 + --> $DIR/simple.rs:290:18 | LL | let &X(_t) = &x; | ------ ^^ cannot move out of borrowed content @@ -725,13 +725,13 @@ LL | let &X(_t) = &x; | help: consider removing the `&`: `X(_t)` | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:300:12 + --> $DIR/simple.rs:290:12 | LL | let &X(_t) = &x; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:304:31 + --> $DIR/simple.rs:294:31 | LL | if let &Either::One(_t) = &e { } | ---------------- ^^ cannot move out of borrowed content @@ -740,13 +740,13 @@ LL | if let &Either::One(_t) = &e { } | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:304:25 + --> $DIR/simple.rs:294:25 | LL | if let &Either::One(_t) = &e { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:308:34 + --> $DIR/simple.rs:298:34 | LL | while let &Either::One(_t) = &e { } | ---------------- ^^ cannot move out of borrowed content @@ -755,13 +755,13 @@ LL | while let &Either::One(_t) = &e { } | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:308:28 + --> $DIR/simple.rs:298:28 | LL | while let &Either::One(_t) = &e { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:312:11 + --> $DIR/simple.rs:302:11 | LL | match &e { | ^^ cannot move out of borrowed content @@ -773,13 +773,13 @@ LL | &Either::One(_t) | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:314:22 + --> $DIR/simple.rs:304:22 | LL | &Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:320:11 + --> $DIR/simple.rs:310:11 | LL | match &e { | ^^ cannot move out of borrowed content @@ -791,13 +791,13 @@ LL | &Either::One(_t) => (), | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:322:22 + --> $DIR/simple.rs:312:22 | LL | &Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:327:11 + --> $DIR/simple.rs:317:11 | LL | match &e { | ^^ cannot move out of borrowed content @@ -809,13 +809,13 @@ LL | &Either::One(_t) => (), | help: consider removing the `&`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:329:22 + --> $DIR/simple.rs:319:22 | LL | &Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:335:22 + --> $DIR/simple.rs:325:22 | LL | let &mut X(_t) = &mut xm; | ---------- ^^^^^^^ cannot move out of borrowed content @@ -824,13 +824,13 @@ LL | let &mut X(_t) = &mut xm; | help: consider removing the `&mut`: `X(_t)` | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:335:16 + --> $DIR/simple.rs:325:16 | LL | let &mut X(_t) = &mut xm; | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:339:35 + --> $DIR/simple.rs:329:35 | LL | if let &mut Either::One(_t) = &mut em { } | -------------------- ^^^^^^^ cannot move out of borrowed content @@ -839,13 +839,13 @@ LL | if let &mut Either::One(_t) = &mut em { } | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:339:29 + --> $DIR/simple.rs:329:29 | LL | if let &mut Either::One(_t) = &mut em { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:343:38 + --> $DIR/simple.rs:333:38 | LL | while let &mut Either::One(_t) = &mut em { } | -------------------- ^^^^^^^ cannot move out of borrowed content @@ -854,13 +854,13 @@ LL | while let &mut Either::One(_t) = &mut em { } | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:343:32 + --> $DIR/simple.rs:333:32 | LL | while let &mut Either::One(_t) = &mut em { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:347:11 + --> $DIR/simple.rs:337:11 | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content @@ -872,13 +872,13 @@ LL | &mut Either::One(_t) | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:349:26 + --> $DIR/simple.rs:339:26 | LL | &mut Either::One(_t) | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:355:11 + --> $DIR/simple.rs:345:11 | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content @@ -890,13 +890,13 @@ LL | &mut Either::One(_t) => (), | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:357:26 + --> $DIR/simple.rs:347:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:362:11 + --> $DIR/simple.rs:352:11 | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content @@ -908,13 +908,13 @@ LL | &mut Either::One(_t) => (), | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:364:26 + --> $DIR/simple.rs:354:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:369:11 + --> $DIR/simple.rs:359:11 | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content @@ -926,13 +926,13 @@ LL | &mut Either::One(_t) => (), | help: consider removing the `&mut`: `Either::One(_t)` | note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait - --> $DIR/simple.rs:371:26 + --> $DIR/simple.rs:361:26 | LL | &mut Either::One(_t) => (), | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:214:11 + --> $DIR/simple.rs:204:11 | LL | fn f1(&X(_t): &X) { } | ^^^--^ @@ -942,13 +942,13 @@ LL | fn f1(&X(_t): &X) { } | help: consider removing the `&`: `X(_t)` | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:214:14 + --> $DIR/simple.rs:204:14 | LL | fn f1(&X(_t): &X) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:261:11 + --> $DIR/simple.rs:251:11 | LL | fn f2(&mut X(_t): &mut X) { } | ^^^^^^^--^ @@ -958,13 +958,13 @@ LL | fn f2(&mut X(_t): &mut X) { } | help: consider removing the `&mut`: `X(_t)` | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:261:18 + --> $DIR/simple.rs:251:18 | LL | fn f2(&mut X(_t): &mut X) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:281:11 + --> $DIR/simple.rs:271:11 | LL | fn f3((&X(_t),): (&X,)) { } | ^^^^--^^^ @@ -973,13 +973,13 @@ LL | fn f3((&X(_t),): (&X,)) { } | cannot move out of borrowed content | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:281:15 + --> $DIR/simple.rs:271:15 | LL | fn f3((&X(_t),): (&X,)) { } | ^^ error[E0507]: cannot move out of borrowed content - --> $DIR/simple.rs:295:11 + --> $DIR/simple.rs:285:11 | LL | fn f4((&mut X(_t),): (&mut X,)) { } | ^^^^^^^^--^^^ @@ -988,7 +988,7 @@ LL | fn f4((&mut X(_t),): (&mut X,)) { } | cannot move out of borrowed content | note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait - --> $DIR/simple.rs:295:19 + --> $DIR/simple.rs:285:19 | LL | fn f4((&mut X(_t),): (&mut X,)) { } | ^^ diff --git a/src/test/ui/suggestions/path-by-value.stderr b/src/test/ui/suggestions/path-by-value.stderr index 338cfc990dc..b073e10749c 100644 --- a/src/test/ui/suggestions/path-by-value.stderr +++ b/src/test/ui/suggestions/path-by-value.stderr @@ -5,7 +5,7 @@ LL | fn f(p: Path) { } | ^ borrow the `Path` instead | = help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `std::path::Path` = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/suggestions/path-display.rs b/src/test/ui/suggestions/path-display.rs new file mode 100644 index 00000000000..62fc9e79f7a --- /dev/null +++ b/src/test/ui/suggestions/path-display.rs @@ -0,0 +1,7 @@ +use std::path::Path; + +fn main() { + let path = Path::new("/tmp/foo/bar.txt"); + println!("{}", path); + //~^ ERROR E0277 +} diff --git a/src/test/ui/suggestions/path-display.stderr b/src/test/ui/suggestions/path-display.stderr new file mode 100644 index 00000000000..39d236af4f3 --- /dev/null +++ b/src/test/ui/suggestions/path-display.stderr @@ -0,0 +1,14 @@ +error[E0277]: `std::path::Path` doesn't implement `std::fmt::Display` + --> $DIR/path-display.rs:5:20 + | +LL | println!("{}", path); + | ^^^^ `std::path::Path` cannot be formatted with the default formatter; call `.display()` on it + | + = help: the trait `std::fmt::Display` is not implemented for `std::path::Path` + = note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data + = note: required because of the requirements on the impl of `std::fmt::Display` for `&std::path::Path` + = note: required by `std::fmt::Display::fmt` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/recover-from-semicolon-trailing-item.rs b/src/test/ui/suggestions/recover-from-semicolon-trailing-item.rs new file mode 100644 index 00000000000..82935af0a81 --- /dev/null +++ b/src/test/ui/suggestions/recover-from-semicolon-trailing-item.rs @@ -0,0 +1,16 @@ +// verify that after encountering a semicolon after an item the parser recovers +mod M {}; +//~^ ERROR expected item, found `;` +struct S {}; +//~^ ERROR expected item, found `;` +fn foo(a: usize) {}; +//~^ ERROR expected item, found `;` +fn main() { + struct X {}; // ok + let _: usize = S {}; + //~^ ERROR mismatched types + let _: usize = X {}; + //~^ ERROR mismatched types + foo(""); + //~^ ERROR mismatched types +} diff --git a/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr b/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr new file mode 100644 index 00000000000..9a47a1efb75 --- /dev/null +++ b/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr @@ -0,0 +1,50 @@ +error: expected item, found `;` + --> $DIR/recover-from-semicolon-trailing-item.rs:2:9 + | +LL | mod M {}; + | ^ help: remove this semicolon + +error: expected item, found `;` + --> $DIR/recover-from-semicolon-trailing-item.rs:4:12 + | +LL | struct S {}; + | ^ help: remove this semicolon + | + = help: braced struct declarations are not followed by a semicolon + +error: expected item, found `;` + --> $DIR/recover-from-semicolon-trailing-item.rs:6:20 + | +LL | fn foo(a: usize) {}; + | ^ help: remove this semicolon + +error[E0308]: mismatched types + --> $DIR/recover-from-semicolon-trailing-item.rs:10:20 + | +LL | let _: usize = S {}; + | ^^^^ expected usize, found struct `S` + | + = note: expected type `usize` + found type `S` + +error[E0308]: mismatched types + --> $DIR/recover-from-semicolon-trailing-item.rs:12:20 + | +LL | let _: usize = X {}; + | ^^^^ expected usize, found struct `main::X` + | + = note: expected type `usize` + found type `main::X` + +error[E0308]: mismatched types + --> $DIR/recover-from-semicolon-trailing-item.rs:14:9 + | +LL | foo(""); + | ^^ expected usize, found reference + | + = note: expected type `usize` + found type `&'static str` + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/recover-invalid-float.rs b/src/test/ui/suggestions/recover-invalid-float.rs new file mode 100644 index 00000000000..506ef8900b8 --- /dev/null +++ b/src/test/ui/suggestions/recover-invalid-float.rs @@ -0,0 +1,11 @@ +fn main() { + let _: usize = .3; + //~^ ERROR float literals must have an integer part + //~| ERROR mismatched types + let _: usize = .42f32; + //~^ ERROR float literals must have an integer part + //~| ERROR mismatched types + let _: usize = .5f64; + //~^ ERROR float literals must have an integer part + //~| ERROR mismatched types +} diff --git a/src/test/ui/suggestions/recover-invalid-float.stderr b/src/test/ui/suggestions/recover-invalid-float.stderr new file mode 100644 index 00000000000..c464676b444 --- /dev/null +++ b/src/test/ui/suggestions/recover-invalid-float.stderr @@ -0,0 +1,42 @@ +error: float literals must have an integer part + --> $DIR/recover-invalid-float.rs:2:20 + | +LL | let _: usize = .3; + | ^^ help: must have an integer part: `0.3` + +error: float literals must have an integer part + --> $DIR/recover-invalid-float.rs:5:20 + | +LL | let _: usize = .42f32; + | ^^^^^^ help: must have an integer part: `0.42f32` + +error: float literals must have an integer part + --> $DIR/recover-invalid-float.rs:8:20 + | +LL | let _: usize = .5f64; + | ^^^^^ help: must have an integer part: `0.5f64` + +error[E0308]: mismatched types + --> $DIR/recover-invalid-float.rs:2:20 + | +LL | let _: usize = .3; + | ^^ expected usize, found floating-point number + | + = note: expected type `usize` + found type `{float}` + +error[E0308]: mismatched types + --> $DIR/recover-invalid-float.rs:5:20 + | +LL | let _: usize = .42f32; + | ^^^^^^ expected usize, found f32 + +error[E0308]: mismatched types + --> $DIR/recover-invalid-float.rs:8:20 + | +LL | let _: usize = .5f64; + | ^^^^^ expected usize, found f64 + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.fixed b/src/test/ui/suggestions/suggest-impl-trait-lifetime.fixed new file mode 100644 index 00000000000..8592af1262e --- /dev/null +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime.fixed @@ -0,0 +1,18 @@ +// run-rustfix + +use std::fmt::Debug; + +fn foo(d: impl Debug + 'static) { +//~^ HELP consider adding an explicit lifetime bound `'static` to `impl Debug` + bar(d); +//~^ ERROR the parameter type `impl Debug` may not live long enough +//~| NOTE ...so that the type `impl Debug` will meet its required lifetime bounds +} + +fn bar(d: impl Debug + 'static) { + println!("{:?}", d) +} + +fn main() { + foo("hi"); +} diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.rs b/src/test/ui/suggestions/suggest-impl-trait-lifetime.rs new file mode 100644 index 00000000000..c67d78ea4c7 --- /dev/null +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime.rs @@ -0,0 +1,18 @@ +// run-rustfix + +use std::fmt::Debug; + +fn foo(d: impl Debug) { +//~^ HELP consider adding an explicit lifetime bound `'static` to `impl Debug` + bar(d); +//~^ ERROR the parameter type `impl Debug` may not live long enough +//~| NOTE ...so that the type `impl Debug` will meet its required lifetime bounds +} + +fn bar(d: impl Debug + 'static) { + println!("{:?}", d) +} + +fn main() { + foo("hi"); +} diff --git a/src/test/ui/suggestions/suggest-impl-trait-lifetime.stderr b/src/test/ui/suggestions/suggest-impl-trait-lifetime.stderr new file mode 100644 index 00000000000..cba231d0e86 --- /dev/null +++ b/src/test/ui/suggestions/suggest-impl-trait-lifetime.stderr @@ -0,0 +1,19 @@ +error[E0310]: the parameter type `impl Debug` may not live long enough + --> $DIR/suggest-impl-trait-lifetime.rs:7:5 + | +LL | bar(d); + | ^^^ + | +note: ...so that the type `impl Debug` will meet its required lifetime bounds + --> $DIR/suggest-impl-trait-lifetime.rs:7:5 + | +LL | bar(d); + | ^^^ +help: consider adding an explicit lifetime bound `'static` to `impl Debug`... + | +LL | fn foo(d: impl Debug + 'static) { + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/suggestions/suggest-labels.rs b/src/test/ui/suggestions/suggest-labels.rs index 9fb519c57ed..159f45855ce 100644 --- a/src/test/ui/suggestions/suggest-labels.rs +++ b/src/test/ui/suggestions/suggest-labels.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[allow(unreachable_code, unused_labels)] fn main() { 'foo: loop { diff --git a/src/test/ui/suggestions/suggest-labels.stderr b/src/test/ui/suggestions/suggest-labels.stderr index 671ff1a56db..88a0f969887 100644 --- a/src/test/ui/suggestions/suggest-labels.stderr +++ b/src/test/ui/suggestions/suggest-labels.stderr @@ -1,17 +1,17 @@ error[E0426]: use of undeclared label `'fo` - --> $DIR/suggest-labels.rs:14:15 + --> $DIR/suggest-labels.rs:4:15 | LL | break 'fo; //~ ERROR use of undeclared label | ^^^ did you mean `'foo`? error[E0426]: use of undeclared label `'bor` - --> $DIR/suggest-labels.rs:18:18 + --> $DIR/suggest-labels.rs:8:18 | LL | continue 'bor; //~ ERROR use of undeclared label | ^^^^ did you mean `'bar`? error[E0426]: use of undeclared label `'longlable` - --> $DIR/suggest-labels.rs:23:19 + --> $DIR/suggest-labels.rs:13:19 | LL | break 'longlable; //~ ERROR use of undeclared label | ^^^^^^^^^^ did you mean `'longlabel1`? diff --git a/src/test/ui/suggestions/suggest-methods.rs b/src/test/ui/suggestions/suggest-methods.rs index 49027deecc1..f40b9ed99b8 100644 --- a/src/test/ui/suggestions/suggest-methods.rs +++ b/src/test/ui/suggestions/suggest-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo; impl Foo { diff --git a/src/test/ui/suggestions/suggest-methods.stderr b/src/test/ui/suggestions/suggest-methods.stderr index cb352361f33..b7727cf03a4 100644 --- a/src/test/ui/suggestions/suggest-methods.stderr +++ b/src/test/ui/suggestions/suggest-methods.stderr @@ -1,32 +1,26 @@ error[E0599]: no method named `bat` found for type `Foo` in the current scope - --> $DIR/suggest-methods.rs:28:7 + --> $DIR/suggest-methods.rs:18:7 | LL | struct Foo; | ----------- method `bat` not found for this ... LL | f.bat(1.0); //~ ERROR no method named - | ^^^ - | - = help: did you mean `bar`? + | ^^^ help: did you mean: `bar` error[E0599]: no method named `is_emtpy` found for type `std::string::String` in the current scope - --> $DIR/suggest-methods.rs:31:15 + --> $DIR/suggest-methods.rs:21:15 | LL | let _ = s.is_emtpy(); //~ ERROR no method named - | ^^^^^^^^ - | - = help: did you mean `is_empty`? + | ^^^^^^^^ help: did you mean: `is_empty` error[E0599]: no method named `count_eos` found for type `u32` in the current scope - --> $DIR/suggest-methods.rs:35:19 + --> $DIR/suggest-methods.rs:25:19 | LL | let _ = 63u32.count_eos(); //~ ERROR no method named - | ^^^^^^^^^ - | - = help: did you mean `count_zeros`? + | ^^^^^^^^^ help: did you mean: `count_zeros` error[E0599]: no method named `count_o` found for type `u32` in the current scope - --> $DIR/suggest-methods.rs:38:19 + --> $DIR/suggest-methods.rs:28:19 | LL | let _ = 63u32.count_o(); //~ ERROR no method named | ^^^^^^^ diff --git a/src/test/ui/suggestions/suggest-move-lifetimes.rs b/src/test/ui/suggestions/suggest-move-lifetimes.rs new file mode 100644 index 00000000000..6b26f121436 --- /dev/null +++ b/src/test/ui/suggestions/suggest-move-lifetimes.rs @@ -0,0 +1,21 @@ +struct A { //~ ERROR lifetime parameters must be declared + t: &'a T, +} + +struct B { //~ ERROR lifetime parameters must be declared + t: &'a T, + u: U, +} + +struct C { //~ ERROR lifetime parameters must be declared + t: &'a T, + u: U, +} + +struct D { //~ ERROR lifetime parameters must be declared + t: &'a T, + u: &'b U, + v: &'c V, +} + +fn main() {} diff --git a/src/test/ui/suggestions/suggest-move-lifetimes.stderr b/src/test/ui/suggestions/suggest-move-lifetimes.stderr new file mode 100644 index 00000000000..b36e927b5c0 --- /dev/null +++ b/src/test/ui/suggestions/suggest-move-lifetimes.stderr @@ -0,0 +1,42 @@ +error: lifetime parameters must be declared prior to type parameters + --> $DIR/suggest-move-lifetimes.rs:1:13 + | +LL | struct A { //~ ERROR lifetime parameters must be declared + | ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | struct A<'a, T> { //~ ERROR lifetime parameters must be declared + | ^^^ -- + +error: lifetime parameters must be declared prior to type parameters + --> $DIR/suggest-move-lifetimes.rs:5:13 + | +LL | struct B { //~ ERROR lifetime parameters must be declared + | ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | struct B<'a, T, U> { //~ ERROR lifetime parameters must be declared + | ^^^ -- + +error: lifetime parameters must be declared prior to type parameters + --> $DIR/suggest-move-lifetimes.rs:10:16 + | +LL | struct C { //~ ERROR lifetime parameters must be declared + | ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | struct C<'a, T, U> { //~ ERROR lifetime parameters must be declared + | ^^^ -- + +error: lifetime parameters must be declared prior to type parameters + --> $DIR/suggest-move-lifetimes.rs:15:16 + | +LL | struct D { //~ ERROR lifetime parameters must be declared + | ^^ ^^ ^^ +help: move the lifetime parameter prior to the first type parameter + | +LL | struct D<'a, 'b, 'c, T, U, V> { //~ ERROR lifetime parameters must be declared + | ^^^ ^^^ ^^^ -- -- + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/suggestions/suggest-move-types.rs b/src/test/ui/suggestions/suggest-move-types.rs new file mode 100644 index 00000000000..fd10ba4350c --- /dev/null +++ b/src/test/ui/suggestions/suggest-move-types.rs @@ -0,0 +1,85 @@ +// ignore-tidy-linelength + +#![allow(warnings)] + +// This test verifies that the suggestion to move types before associated type bindings +// is correct. + +trait One { + type A; +} + +trait OneWithLifetime<'a, T> { + type A; +} + +trait Three { + type A; + type B; + type C; +} + +trait ThreeWithLifetime<'a, 'b, 'c, T, U, V> { + type A; + type B; + type C; +} + +struct A> { //~ ERROR type parameters must be declared + m: M, + t: T, +} + + +struct Al<'a, T, M: OneWithLifetime> { +//~^ ERROR generic arguments must declare lifetimes, types and associated type bindings in that order + m: M, + t: &'a T, +} + +struct B> { //~ ERROR type parameters must be declared + m: M, + t: T, + u: U, + v: V, +} + +struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { +//~^ ERROR generic arguments must declare lifetimes, types and associated type bindings in that order + m: M, + t: &'a T, + u: &'b U, + v: &'c V, +} + +struct C> { //~ ERROR type parameters must be declared + m: M, + t: T, + u: U, + v: V, +} + +struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { +//~^ ERROR generic arguments must declare lifetimes, types and associated type bindings in that order + m: M, + t: &'a T, + u: &'b U, + v: &'c V, +} + +struct D> { //~ ERROR type parameters must be declared + m: M, + t: T, + u: U, + v: V, +} + +struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { +//~^ ERROR generic arguments must declare lifetimes, types and associated type bindings in that order + m: M, + t: &'a T, + u: &'b U, + v: &'c V, +} + +fn main() {} diff --git a/src/test/ui/suggestions/suggest-move-types.stderr b/src/test/ui/suggestions/suggest-move-types.stderr new file mode 100644 index 00000000000..3643d9a9124 --- /dev/null +++ b/src/test/ui/suggestions/suggest-move-types.stderr @@ -0,0 +1,107 @@ +error: type parameters must be declared prior to associated type bindings + --> $DIR/suggest-move-types.rs:28:26 + | +LL | struct A> { //~ ERROR type parameters must be declared + | ^ must be declared prior to associated type bindings +help: move the type parameter prior to the first associated type binding + | +LL | struct A> { //~ ERROR type parameters must be declared + | ^^ -- + +error: generic arguments must declare lifetimes, types and associated type bindings in that order + --> $DIR/suggest-move-types.rs:34:46 + | +LL | struct Al<'a, T, M: OneWithLifetime> { + | ^ ^^ must be declared prior to type parameters + | | + | must be declared prior to associated type bindings +help: move the parameters + | +LL | struct Al<'a, T, M: OneWithLifetime<'a, T, A=()>> { + | ^^^ ^^ -- + +error: type parameters must be declared prior to associated type bindings + --> $DIR/suggest-move-types.rs:40:46 + | +LL | struct B> { //~ ERROR type parameters must be declared + | ^ ^ ^ must be declared prior to associated type bindings + | | | + | | must be declared prior to associated type bindings + | must be declared prior to associated type bindings +help: move the type parameters prior to the first associated type binding + | +LL | struct B> { //~ ERROR type parameters must be declared + | ^^ ^^ ^^ -- + +error: generic arguments must declare lifetimes, types and associated type bindings in that order + --> $DIR/suggest-move-types.rs:47:80 + | +LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { + | ^ ^ ^ ^^ ^^ ^^ must be declared prior to type parameters + | | | | | | + | | | | | must be declared prior to type parameters + | | | | must be declared prior to type parameters + | | | must be declared prior to associated type bindings + | | must be declared prior to associated type bindings + | must be declared prior to associated type bindings +help: move the parameters + | +LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A=(), B=(), C=()>> { + | ^^^ ^^^ ^^^ ^^ ^^ ^^ -- + +error: type parameters must be declared prior to associated type bindings + --> $DIR/suggest-move-types.rs:55:49 + | +LL | struct C> { //~ ERROR type parameters must be declared + | ^ ^ must be declared prior to associated type bindings + | | + | must be declared prior to associated type bindings +help: move the type parameters prior to the first associated type binding + | +LL | struct C> { //~ ERROR type parameters must be declared + | ^^ ^^ -- + +error: generic arguments must declare lifetimes, types and associated type bindings in that order + --> $DIR/suggest-move-types.rs:62:56 + | +LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { + | ^^ ^ ^^ ^ ^^ must be declared prior to type parameters + | | | | | + | | | | must be declared prior to associated type bindings + | | | must be declared prior to type parameters + | | must be declared prior to associated type bindings + | must be declared prior to type parameters +help: move the parameters + | +LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A=(), B=(), C=()>> { + | ^^^ ^^^ ^^^ -- ^^ ^^ -- + +error: type parameters must be declared prior to associated type bindings + --> $DIR/suggest-move-types.rs:70:43 + | +LL | struct D> { //~ ERROR type parameters must be declared + | ^ ^ must be declared prior to associated type bindings + | | + | must be declared prior to associated type bindings +help: move the type parameters prior to the first associated type binding + | +LL | struct D> { //~ ERROR type parameters must be declared + | ^^ ^^ -- -- + +error: generic arguments must declare lifetimes, types and associated type bindings in that order + --> $DIR/suggest-move-types.rs:77:56 + | +LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime> { + | ^^ ^ ^^ ^ ^^ must be declared prior to type parameters + | | | | | + | | | | must be declared prior to associated type bindings + | | | must be declared prior to type parameters + | | must be declared prior to associated type bindings + | must be declared prior to type parameters +help: move the parameters + | +LL | struct Dl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime<'a, 'b, 'c, T, U, V, A=(), B=(), C=()>> { + | ^^^ ^^^ ^^^ -- ^^ ^^ -- -- + +error: aborting due to 8 previous errors + diff --git a/src/test/ui/suggestions/suggest-private-fields.rs b/src/test/ui/suggestions/suggest-private-fields.rs index 77b38abad84..347c8aeed69 100644 --- a/src/test/ui/suggestions/suggest-private-fields.rs +++ b/src/test/ui/suggestions/suggest-private-fields.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:struct_field_privacy.rs extern crate struct_field_privacy as xc; diff --git a/src/test/ui/suggestions/suggest-private-fields.stderr b/src/test/ui/suggestions/suggest-private-fields.stderr index 51a96df951a..524558e0ec5 100644 --- a/src/test/ui/suggestions/suggest-private-fields.stderr +++ b/src/test/ui/suggestions/suggest-private-fields.stderr @@ -1,11 +1,11 @@ error[E0560]: struct `xc::B` has no field named `aa` - --> $DIR/suggest-private-fields.rs:25:9 + --> $DIR/suggest-private-fields.rs:15:9 | LL | aa: 20, - | ^^ field does not exist - did you mean `a`? + | ^^ help: a field with a similar name exists: `a` error[E0560]: struct `xc::B` has no field named `bb` - --> $DIR/suggest-private-fields.rs:27:9 + --> $DIR/suggest-private-fields.rs:17:9 | LL | bb: 20, | ^^ `xc::B` does not have this field @@ -13,16 +13,16 @@ LL | bb: 20, = note: available fields are: `a` error[E0560]: struct `A` has no field named `aa` - --> $DIR/suggest-private-fields.rs:32:9 + --> $DIR/suggest-private-fields.rs:22:9 | LL | aa: 20, - | ^^ field does not exist - did you mean `a`? + | ^^ help: a field with a similar name exists: `a` error[E0560]: struct `A` has no field named `bb` - --> $DIR/suggest-private-fields.rs:34:9 + --> $DIR/suggest-private-fields.rs:24:9 | LL | bb: 20, - | ^^ field does not exist - did you mean `b`? + | ^^ help: a field with a similar name exists: `b` error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/suggest-ref-mut.rs b/src/test/ui/suggestions/suggest-ref-mut.rs index 30b5371af1a..b4a6fa39f90 100644 --- a/src/test/ui/suggestions/suggest-ref-mut.rs +++ b/src/test/ui/suggestions/suggest-ref-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(nll)] struct X(usize); diff --git a/src/test/ui/suggestions/suggest-ref-mut.stderr b/src/test/ui/suggestions/suggest-ref-mut.stderr index 0b2b240ef53..9f00967d840 100644 --- a/src/test/ui/suggestions/suggest-ref-mut.stderr +++ b/src/test/ui/suggestions/suggest-ref-mut.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `self.0` which is behind a `&` reference - --> $DIR/suggest-ref-mut.rs:19:9 + --> $DIR/suggest-ref-mut.rs:9:9 | LL | fn zap(&self) { | ----- help: consider changing this to be a mutable reference: `&mut self` @@ -8,7 +8,7 @@ LL | self.0 = 32; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*foo` which is behind a `&` reference - --> $DIR/suggest-ref-mut.rs:28:5 + --> $DIR/suggest-ref-mut.rs:18:5 | LL | let ref foo = 16; | ------- help: consider changing this to be a mutable reference: `ref mut foo` @@ -17,7 +17,7 @@ LL | *foo = 32; | ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*bar` which is behind a `&` reference - --> $DIR/suggest-ref-mut.rs:33:9 + --> $DIR/suggest-ref-mut.rs:23:9 | LL | if let Some(ref bar) = Some(16) { | ------- help: consider changing this to be a mutable reference: `ref mut bar` @@ -26,7 +26,7 @@ LL | *bar = 32; | ^^^^^^^^^ `bar` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*quo` which is behind a `&` reference - --> $DIR/suggest-ref-mut.rs:37:22 + --> $DIR/suggest-ref-mut.rs:27:22 | LL | ref quo => { *quo = 32; }, | ------- ^^^^^^^^^ `quo` is a `&` reference, so the data it refers to cannot be written diff --git a/src/test/ui/suggestions/suggest-remove-refs-1.rs b/src/test/ui/suggestions/suggest-remove-refs-1.rs index d7c80a677a5..792cd6c5a0c 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-1.rs +++ b/src/test/ui/suggestions/suggest-remove-refs-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let v = vec![0, 1, 2, 3]; diff --git a/src/test/ui/suggestions/suggest-remove-refs-1.stderr b/src/test/ui/suggestions/suggest-remove-refs-1.stderr index 1fc661efd91..bfc313cabdc 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-1.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-1.stderr @@ -1,5 +1,5 @@ error[E0277]: `&std::iter::Enumerate>` is not an iterator - --> $DIR/suggest-remove-refs-1.rs:14:19 + --> $DIR/suggest-remove-refs-1.rs:4:19 | LL | for (i, n) in &v.iter().enumerate() { | -^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/suggestions/suggest-remove-refs-2.rs b/src/test/ui/suggestions/suggest-remove-refs-2.rs index 37af97323d5..52d940143b3 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-2.rs +++ b/src/test/ui/suggestions/suggest-remove-refs-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let v = vec![0, 1, 2, 3]; diff --git a/src/test/ui/suggestions/suggest-remove-refs-2.stderr b/src/test/ui/suggestions/suggest-remove-refs-2.stderr index 96c6c92d59b..fe1b0f1ea22 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-2.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-2.stderr @@ -1,5 +1,5 @@ error[E0277]: `&&&&&std::iter::Enumerate>` is not an iterator - --> $DIR/suggest-remove-refs-2.rs:14:19 + --> $DIR/suggest-remove-refs-2.rs:4:19 | LL | for (i, n) in & & & & &v.iter().enumerate() { | ---------^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/suggestions/suggest-remove-refs-3.rs b/src/test/ui/suggestions/suggest-remove-refs-3.rs index c9dff35f92c..981924d3251 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-3.rs +++ b/src/test/ui/suggestions/suggest-remove-refs-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let v = vec![0, 1, 2, 3]; diff --git a/src/test/ui/suggestions/suggest-remove-refs-3.stderr b/src/test/ui/suggestions/suggest-remove-refs-3.stderr index 4311c432b41..a6c16e1817a 100644 --- a/src/test/ui/suggestions/suggest-remove-refs-3.stderr +++ b/src/test/ui/suggestions/suggest-remove-refs-3.stderr @@ -1,5 +1,5 @@ error[E0277]: `&&&&&std::iter::Enumerate>` is not an iterator - --> $DIR/suggest-remove-refs-3.rs:14:19 + --> $DIR/suggest-remove-refs-3.rs:4:19 | LL | for (i, n) in & & & | ___________________^ diff --git a/src/test/ui/suggestions/suggest-variants.rs b/src/test/ui/suggestions/suggest-variants.rs new file mode 100644 index 00000000000..6d6e280d965 --- /dev/null +++ b/src/test/ui/suggestions/suggest-variants.rs @@ -0,0 +1,15 @@ +#[derive(Debug)] +enum Shape { + Square { size: i32 }, + Circle { radius: i32 }, +} + +struct S { + x: usize, +} + +fn main() { + println!("My shape is {:?}", Shape::Squareee { size: 5}); //~ ERROR no variant `Squareee` + println!("My shape is {:?}", Shape::Circl { size: 5}); //~ ERROR no variant `Circl` + println!("My shape is {:?}", Shape::Rombus{ size: 5}); //~ ERROR no variant `Rombus` +} diff --git a/src/test/ui/suggestions/suggest-variants.stderr b/src/test/ui/suggestions/suggest-variants.stderr new file mode 100644 index 00000000000..36abda2a89b --- /dev/null +++ b/src/test/ui/suggestions/suggest-variants.stderr @@ -0,0 +1,20 @@ +error: no variant `Squareee` on enum `Shape` + --> $DIR/suggest-variants.rs:12:34 + | +LL | println!("My shape is {:?}", Shape::Squareee { size: 5}); //~ ERROR no variant `Squareee` + | ^^^^^^^^^^^^^^^ help: did you mean: `Shape::Square` + +error: no variant `Circl` on enum `Shape` + --> $DIR/suggest-variants.rs:13:34 + | +LL | println!("My shape is {:?}", Shape::Circl { size: 5}); //~ ERROR no variant `Circl` + | ^^^^^^^^^^^^ help: did you mean: `Shape::Circle` + +error: no variant `Rombus` on enum `Shape` + --> $DIR/suggest-variants.rs:14:34 + | +LL | println!("My shape is {:?}", Shape::Rombus{ size: 5}); //~ ERROR no variant `Rombus` + | ^^^^^^^^^^^^^ unknown variant + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/suggestions/type-mismatch-struct-field-shorthand-2.rs b/src/test/ui/suggestions/type-mismatch-struct-field-shorthand-2.rs new file mode 100644 index 00000000000..2ce12220723 --- /dev/null +++ b/src/test/ui/suggestions/type-mismatch-struct-field-shorthand-2.rs @@ -0,0 +1,9 @@ +struct RGB { r: f64, g: f64, b: f64 } + +fn main() { + let (r, g, c): (f32, f32, f32) = (0., 0., 0.); + let _ = RGB { r, g, c }; + //~^ ERROR mismatched types + //~| ERROR mismatched types + //~| ERROR struct `RGB` has no field named `c` +} diff --git a/src/test/ui/suggestions/type-mismatch-struct-field-shorthand-2.stderr b/src/test/ui/suggestions/type-mismatch-struct-field-shorthand-2.stderr new file mode 100644 index 00000000000..d0f9e1f7f7c --- /dev/null +++ b/src/test/ui/suggestions/type-mismatch-struct-field-shorthand-2.stderr @@ -0,0 +1,30 @@ +error[E0308]: mismatched types + --> $DIR/type-mismatch-struct-field-shorthand-2.rs:5:19 + | +LL | let _ = RGB { r, g, c }; + | ^ expected f64, found f32 +help: you can cast an `f32` to `f64` in a lossless way + | +LL | let _ = RGB { r: r.into(), g, c }; + | ^^^^^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/type-mismatch-struct-field-shorthand-2.rs:5:22 + | +LL | let _ = RGB { r, g, c }; + | ^ expected f64, found f32 +help: you can cast an `f32` to `f64` in a lossless way + | +LL | let _ = RGB { r, g: g.into(), c }; + | ^^^^^^^^^^^ + +error[E0560]: struct `RGB` has no field named `c` + --> $DIR/type-mismatch-struct-field-shorthand-2.rs:5:25 + | +LL | let _ = RGB { r, g, c }; + | ^ help: a field with a similar name exists: `b` + +error: aborting due to 3 previous errors + +Some errors occurred: E0308, E0560. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/type-mismatch-struct-field-shorthand.fixed b/src/test/ui/suggestions/type-mismatch-struct-field-shorthand.fixed new file mode 100644 index 00000000000..91758c0b218 --- /dev/null +++ b/src/test/ui/suggestions/type-mismatch-struct-field-shorthand.fixed @@ -0,0 +1,12 @@ +// run-rustfix +#![allow(dead_code)] + +struct RGB { r: f64, g: f64, b: f64 } + +fn main() { + let (r, g, b): (f32, f32, f32) = (0., 0., 0.); + let _ = RGB { r: r.into(), g: g.into(), b: b.into() }; + //~^ ERROR mismatched types + //~| ERROR mismatched types + //~| ERROR mismatched types +} diff --git a/src/test/ui/suggestions/type-mismatch-struct-field-shorthand.rs b/src/test/ui/suggestions/type-mismatch-struct-field-shorthand.rs new file mode 100644 index 00000000000..9d3a17a72b2 --- /dev/null +++ b/src/test/ui/suggestions/type-mismatch-struct-field-shorthand.rs @@ -0,0 +1,12 @@ +// run-rustfix +#![allow(dead_code)] + +struct RGB { r: f64, g: f64, b: f64 } + +fn main() { + let (r, g, b): (f32, f32, f32) = (0., 0., 0.); + let _ = RGB { r, g, b }; + //~^ ERROR mismatched types + //~| ERROR mismatched types + //~| ERROR mismatched types +} diff --git a/src/test/ui/suggestions/type-mismatch-struct-field-shorthand.stderr b/src/test/ui/suggestions/type-mismatch-struct-field-shorthand.stderr new file mode 100644 index 00000000000..6bc16ba8b70 --- /dev/null +++ b/src/test/ui/suggestions/type-mismatch-struct-field-shorthand.stderr @@ -0,0 +1,33 @@ +error[E0308]: mismatched types + --> $DIR/type-mismatch-struct-field-shorthand.rs:8:19 + | +LL | let _ = RGB { r, g, b }; + | ^ expected f64, found f32 +help: you can cast an `f32` to `f64` in a lossless way + | +LL | let _ = RGB { r: r.into(), g, b }; + | ^^^^^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/type-mismatch-struct-field-shorthand.rs:8:22 + | +LL | let _ = RGB { r, g, b }; + | ^ expected f64, found f32 +help: you can cast an `f32` to `f64` in a lossless way + | +LL | let _ = RGB { r, g: g.into(), b }; + | ^^^^^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/type-mismatch-struct-field-shorthand.rs:8:25 + | +LL | let _ = RGB { r, g, b }; + | ^ expected f64, found f32 +help: you can cast an `f32` to `f64` in a lossless way + | +LL | let _ = RGB { r, g, b: b.into() }; + | ^^^^^^^^^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs new file mode 100644 index 00000000000..a3cc53e69e2 --- /dev/null +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.rs @@ -0,0 +1,13 @@ +pub trait T { + type A; + type B; + type C; +} +pub struct Foo { + i: Box>, + //~^ ERROR must be specified + //~| ERROR wrong number of type arguments +} + + +fn main() {} diff --git a/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr new file mode 100644 index 00000000000..16e9fa90aa1 --- /dev/null +++ b/src/test/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr @@ -0,0 +1,31 @@ +error[E0107]: wrong number of type arguments: expected 2, found 4 + --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:28 + | +LL | i: Box>, + | ^^^^^ ^^^^^ unexpected type argument + | | + | unexpected type argument + +error[E0191]: the value of the associated types `A` (from the trait `T`), `C` (from the trait `T`) must be specified + --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:12 + | +LL | type A; + | ------- `A` defined here +LL | type B; +LL | type C; + | ------- `C` defined here +... +LL | i: Box>, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | associated type `A` must be specified + | associated type `C` must be specified +help: if you meant to specify the associated types, write + | +LL | i: Box>, + | ^^^^^^^^^ ^^^^^^^^^ + +error: aborting due to 2 previous errors + +Some errors occurred: E0107, E0191. +For more information about an error, try `rustc --explain E0107`. diff --git a/src/test/ui/super-at-top-level.rs b/src/test/ui/super-at-top-level.rs index 96d099c7655..41360df7799 100644 --- a/src/test/ui/super-at-top-level.rs +++ b/src/test/ui/super-at-top-level.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use super::f; //~ ERROR there are too many initial `super`s fn main() { diff --git a/src/test/ui/super-at-top-level.stderr b/src/test/ui/super-at-top-level.stderr index 8402daad19e..ce7a3933976 100644 --- a/src/test/ui/super-at-top-level.stderr +++ b/src/test/ui/super-at-top-level.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: there are too many initial `super`s. - --> $DIR/super-at-top-level.rs:11:5 + --> $DIR/super-at-top-level.rs:1:5 | LL | use super::f; //~ ERROR there are too many initial `super`s | ^^^^^ there are too many initial `super`s. diff --git a/src/test/ui/suppressed-error.rs b/src/test/ui/suppressed-error.rs index 9a4a52ced20..cf3dce8e224 100644 --- a/src/test/ui/suppressed-error.rs +++ b/src/test/ui/suppressed-error.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let (x, y) = (); //~^ ERROR mismatched types diff --git a/src/test/ui/suppressed-error.stderr b/src/test/ui/suppressed-error.stderr index d17e7cb6891..85e1deb3cde 100644 --- a/src/test/ui/suppressed-error.stderr +++ b/src/test/ui/suppressed-error.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/suppressed-error.rs:12:9 + --> $DIR/suppressed-error.rs:2:9 | LL | let (x, y) = (); | ^^^^^^ expected (), found tuple diff --git a/src/test/ui/svh/auxiliary/svh-a-base.rs b/src/test/ui/svh/auxiliary/svh-a-base.rs index 31a97f695f0..36b41fc818f 100644 --- a/src/test/ui/svh/auxiliary/svh-a-base.rs +++ b/src/test/ui/svh/auxiliary/svh-a-base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The `svh-a-*.rs` files are all deviations from the base file //! svh-a-base.rs with some difference (usually in `fn foo`) that //! should not affect the strict version hash (SVH) computation diff --git a/src/test/ui/svh/auxiliary/svh-a-change-lit.rs b/src/test/ui/svh/auxiliary/svh-a-change-lit.rs index 5339fc8295c..c76f2c99236 100644 --- a/src/test/ui/svh/auxiliary/svh-a-change-lit.rs +++ b/src/test/ui/svh/auxiliary/svh-a-change-lit.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The `svh-a-*.rs` files are all deviations from the base file //! svh-a-base.rs with some difference (usually in `fn foo`) that //! should not affect the strict version hash (SVH) computation diff --git a/src/test/ui/svh/auxiliary/svh-a-change-significant-cfg.rs b/src/test/ui/svh/auxiliary/svh-a-change-significant-cfg.rs index 2a5d9446f87..37f59c97e0f 100644 --- a/src/test/ui/svh/auxiliary/svh-a-change-significant-cfg.rs +++ b/src/test/ui/svh/auxiliary/svh-a-change-significant-cfg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The `svh-a-*.rs` files are all deviations from the base file //! svh-a-base.rs with some difference (usually in `fn foo`) that //! should not affect the strict version hash (SVH) computation diff --git a/src/test/ui/svh/auxiliary/svh-a-change-trait-bound.rs b/src/test/ui/svh/auxiliary/svh-a-change-trait-bound.rs index 61f2f2803ab..be24b1e2221 100644 --- a/src/test/ui/svh/auxiliary/svh-a-change-trait-bound.rs +++ b/src/test/ui/svh/auxiliary/svh-a-change-trait-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The `svh-a-*.rs` files are all deviations from the base file //! svh-a-base.rs with some difference (usually in `fn foo`) that //! should not affect the strict version hash (SVH) computation diff --git a/src/test/ui/svh/auxiliary/svh-a-change-type-arg.rs b/src/test/ui/svh/auxiliary/svh-a-change-type-arg.rs index 270ce95be2b..3fe102245f7 100644 --- a/src/test/ui/svh/auxiliary/svh-a-change-type-arg.rs +++ b/src/test/ui/svh/auxiliary/svh-a-change-type-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The `svh-a-*.rs` files are all deviations from the base file //! svh-a-base.rs with some difference (usually in `fn foo`) that //! should not affect the strict version hash (SVH) computation diff --git a/src/test/ui/svh/auxiliary/svh-a-change-type-ret.rs b/src/test/ui/svh/auxiliary/svh-a-change-type-ret.rs index de4cc85a7dc..06e4fad0649 100644 --- a/src/test/ui/svh/auxiliary/svh-a-change-type-ret.rs +++ b/src/test/ui/svh/auxiliary/svh-a-change-type-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The `svh-a-*.rs` files are all deviations from the base file //! svh-a-base.rs with some difference (usually in `fn foo`) that //! should not affect the strict version hash (SVH) computation diff --git a/src/test/ui/svh/auxiliary/svh-a-change-type-static.rs b/src/test/ui/svh/auxiliary/svh-a-change-type-static.rs index 0d4c76abb10..440cb3213ed 100644 --- a/src/test/ui/svh/auxiliary/svh-a-change-type-static.rs +++ b/src/test/ui/svh/auxiliary/svh-a-change-type-static.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! The `svh-a-*.rs` files are all deviations from the base file //! svh-a-base.rs with some difference (usually in `fn foo`) that //! should not affect the strict version hash (SVH) computation diff --git a/src/test/ui/svh/auxiliary/svh-b.rs b/src/test/ui/svh/auxiliary/svh-b.rs index b8946fdc995..03869aeb371 100644 --- a/src/test/ui/svh/auxiliary/svh-b.rs +++ b/src/test/ui/svh/auxiliary/svh-b.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! This is a client of the `a` crate defined in "svn-a-base.rs". The //! rpass and cfail tests (such as "run-pass/svh-add-comment.rs") use //! it by swapping in a different object code library crate built from diff --git a/src/test/ui/svh/auxiliary/svh-uta-base.rs b/src/test/ui/svh/auxiliary/svh-uta-base.rs index 6bd3ddab06c..c138f1a5ba8 100644 --- a/src/test/ui/svh/auxiliary/svh-uta-base.rs +++ b/src/test/ui/svh/auxiliary/svh-uta-base.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! "compile-fail/svh-uta-trait.rs" is checking that we detect a //! change from `use foo::TraitB` to use `foo::TraitB` in the hash //! (SVH) computation (#14132), since that will affect method diff --git a/src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs b/src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs index e8634168177..76a472b5b26 100644 --- a/src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs +++ b/src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! "compile-fail/svh-uta-trait.rs" is checking that we detect a //! change from `use foo::TraitB` to use `foo::TraitB` in the hash //! (SVH) computation (#14132), since that will affect method diff --git a/src/test/ui/svh/auxiliary/svh-utb.rs b/src/test/ui/svh/auxiliary/svh-utb.rs index eb3da985242..2f27e99a961 100644 --- a/src/test/ui/svh/auxiliary/svh-utb.rs +++ b/src/test/ui/svh/auxiliary/svh-utb.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! "compile-fail/svh-uta-trait.rs" is checking that we detect a //! change from `use foo::TraitB` to use `foo::TraitB` in the hash //! (SVH) computation (#14132), since that will affect method diff --git a/src/test/ui/svh/svh-change-lit.rs b/src/test/ui/svh/svh-change-lit.rs index c529873e732..7d991cc9971 100644 --- a/src/test/ui/svh/svh-change-lit.rs +++ b/src/test/ui/svh/svh-change-lit.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-msvc FIXME #31306 // note that these aux-build directives must be in this order diff --git a/src/test/ui/svh/svh-change-lit.stderr b/src/test/ui/svh/svh-change-lit.stderr index bf018cdf829..ebb39224caa 100644 --- a/src/test/ui/svh/svh-change-lit.stderr +++ b/src/test/ui/svh/svh-change-lit.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/svh-change-lit.rs:20:1 + --> $DIR/svh-change-lit.rs:10:1 | LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-change-significant-cfg.rs b/src/test/ui/svh/svh-change-significant-cfg.rs index ad51cbc5ec8..8cf0d9ccaf1 100644 --- a/src/test/ui/svh/svh-change-significant-cfg.rs +++ b/src/test/ui/svh/svh-change-significant-cfg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-msvc FIXME #31306 // note that these aux-build directives must be in this order diff --git a/src/test/ui/svh/svh-change-significant-cfg.stderr b/src/test/ui/svh/svh-change-significant-cfg.stderr index e8926cda9e9..d7196fc21f8 100644 --- a/src/test/ui/svh/svh-change-significant-cfg.stderr +++ b/src/test/ui/svh/svh-change-significant-cfg.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/svh-change-significant-cfg.rs:20:1 + --> $DIR/svh-change-significant-cfg.rs:10:1 | LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-change-trait-bound.rs b/src/test/ui/svh/svh-change-trait-bound.rs index ae17ff3feb7..ddd10ac068d 100644 --- a/src/test/ui/svh/svh-change-trait-bound.rs +++ b/src/test/ui/svh/svh-change-trait-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-msvc FIXME #31306 // note that these aux-build directives must be in this order diff --git a/src/test/ui/svh/svh-change-trait-bound.stderr b/src/test/ui/svh/svh-change-trait-bound.stderr index d9824876a95..38678d7ec2c 100644 --- a/src/test/ui/svh/svh-change-trait-bound.stderr +++ b/src/test/ui/svh/svh-change-trait-bound.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/svh-change-trait-bound.rs:20:1 + --> $DIR/svh-change-trait-bound.rs:10:1 | LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-change-type-arg.rs b/src/test/ui/svh/svh-change-type-arg.rs index 5b796a3f5c0..f845ab5bc6a 100644 --- a/src/test/ui/svh/svh-change-type-arg.rs +++ b/src/test/ui/svh/svh-change-type-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-msvc FIXME #31306 // note that these aux-build directives must be in this order diff --git a/src/test/ui/svh/svh-change-type-arg.stderr b/src/test/ui/svh/svh-change-type-arg.stderr index 1f942cc1989..037d7867b0d 100644 --- a/src/test/ui/svh/svh-change-type-arg.stderr +++ b/src/test/ui/svh/svh-change-type-arg.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/svh-change-type-arg.rs:20:1 + --> $DIR/svh-change-type-arg.rs:10:1 | LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-change-type-ret.rs b/src/test/ui/svh/svh-change-type-ret.rs index 88bf146760f..fb3e996c5fd 100644 --- a/src/test/ui/svh/svh-change-type-ret.rs +++ b/src/test/ui/svh/svh-change-type-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-msvc FIXME #31306 // note that these aux-build directives must be in this order diff --git a/src/test/ui/svh/svh-change-type-ret.stderr b/src/test/ui/svh/svh-change-type-ret.stderr index 0d59f31ccb6..184ac9e0e7c 100644 --- a/src/test/ui/svh/svh-change-type-ret.stderr +++ b/src/test/ui/svh/svh-change-type-ret.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/svh-change-type-ret.rs:20:1 + --> $DIR/svh-change-type-ret.rs:10:1 | LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-change-type-static.rs b/src/test/ui/svh/svh-change-type-static.rs index c9a167c5a02..0dfcaa0003b 100644 --- a/src/test/ui/svh/svh-change-type-static.rs +++ b/src/test/ui/svh/svh-change-type-static.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-msvc FIXME #31306 // note that these aux-build directives must be in this order diff --git a/src/test/ui/svh/svh-change-type-static.stderr b/src/test/ui/svh/svh-change-type-static.stderr index cbfb74f59ed..d3aeb073cd7 100644 --- a/src/test/ui/svh/svh-change-type-static.stderr +++ b/src/test/ui/svh/svh-change-type-static.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on - --> $DIR/svh-change-type-static.rs:20:1 + --> $DIR/svh-change-type-static.rs:10:1 | LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/svh/svh-use-trait.rs b/src/test/ui/svh/svh-use-trait.rs index 3a87f6bfc77..93daca034c0 100644 --- a/src/test/ui/svh/svh-use-trait.rs +++ b/src/test/ui/svh/svh-use-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-msvc FIXME #31306 // note that these aux-build directives must be in this order diff --git a/src/test/ui/svh/svh-use-trait.stderr b/src/test/ui/svh/svh-use-trait.stderr index 612f52ba959..0af44502375 100644 --- a/src/test/ui/svh/svh-use-trait.stderr +++ b/src/test/ui/svh/svh-use-trait.stderr @@ -1,5 +1,5 @@ error[E0460]: found possibly newer version of crate `uta` which `utb` depends on - --> $DIR/svh-use-trait.rs:25:1 + --> $DIR/svh-use-trait.rs:15:1 | LL | extern crate utb; //~ ERROR: found possibly newer version of crate `uta` which `utb` depends | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/switched-expectations.rs b/src/test/ui/switched-expectations.rs index 2a43679bdb8..c5bc84de54c 100644 --- a/src/test/ui/switched-expectations.rs +++ b/src/test/ui/switched-expectations.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let var = 10i32; let ref string: String = var; //~ ERROR mismatched types [E0308] diff --git a/src/test/ui/switched-expectations.stderr b/src/test/ui/switched-expectations.stderr index 9db318735bd..bbb9b51650e 100644 --- a/src/test/ui/switched-expectations.stderr +++ b/src/test/ui/switched-expectations.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/switched-expectations.rs:13:30 + --> $DIR/switched-expectations.rs:3:30 | LL | let ref string: String = var; //~ ERROR mismatched types [E0308] | ^^^ expected struct `std::string::String`, found i32 diff --git a/src/test/ui/symbol-names/basic.rs b/src/test/ui/symbol-names/basic.rs index 0095774fcb8..2a051a5e144 100644 --- a/src/test/ui/symbol-names/basic.rs +++ b/src/test/ui/symbol-names/basic.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #[rustc_symbol_name] //~ ERROR _ZN5basic4main diff --git a/src/test/ui/symbol-names/basic.stderr b/src/test/ui/symbol-names/basic.stderr index 551c5bb4a75..ca789df9bd1 100644 --- a/src/test/ui/symbol-names/basic.stderr +++ b/src/test/ui/symbol-names/basic.stderr @@ -1,11 +1,11 @@ error: symbol-name(_ZN5basic4main17h08bcaf310214ed52E) - --> $DIR/basic.rs:13:1 + --> $DIR/basic.rs:3:1 | LL | #[rustc_symbol_name] //~ ERROR _ZN5basic4main | ^^^^^^^^^^^^^^^^^^^^ error: item-path(main) - --> $DIR/basic.rs:14:1 + --> $DIR/basic.rs:4:1 | LL | #[rustc_item_path] //~ ERROR item-path(main) | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/symbol-names/impl1.rs b/src/test/ui/symbol-names/impl1.rs index 93fa48b880f..97169c33b8c 100644 --- a/src/test/ui/symbol-names/impl1.rs +++ b/src/test/ui/symbol-names/impl1.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #![allow(dead_code)] diff --git a/src/test/ui/symbol-names/impl1.stderr b/src/test/ui/symbol-names/impl1.stderr index 73c8d7b9721..75d3e40e1b2 100644 --- a/src/test/ui/symbol-names/impl1.stderr +++ b/src/test/ui/symbol-names/impl1.stderr @@ -1,23 +1,23 @@ error: symbol-name(_ZN5impl13foo3Foo3bar17hc487d6ec13fe9124E) - --> $DIR/impl1.rs:18:9 + --> $DIR/impl1.rs:8:9 | LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13foo3Foo3bar | ^^^^^^^^^^^^^^^^^^^^ error: item-path(foo::Foo::bar) - --> $DIR/impl1.rs:19:9 + --> $DIR/impl1.rs:9:9 | LL | #[rustc_item_path] //~ ERROR item-path(foo::Foo::bar) | ^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h38577281258e1527E) - --> $DIR/impl1.rs:28:9 + --> $DIR/impl1.rs:18:9 | LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz | ^^^^^^^^^^^^^^^^^^^^ error: item-path(bar::::baz) - --> $DIR/impl1.rs:29:9 + --> $DIR/impl1.rs:19:9 | LL | #[rustc_item_path] //~ ERROR item-path(bar::::baz) | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/syntax-extension-minor.rs b/src/test/ui/syntax-extension-minor.rs index 96adfea43f3..0206a769937 100644 --- a/src/test/ui/syntax-extension-minor.rs +++ b/src/test/ui/syntax-extension-minor.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(concat_idents)] pub fn main() { diff --git a/src/test/ui/syntax-extension-minor.stderr b/src/test/ui/syntax-extension-minor.stderr index 7df1f303146..2d8056da527 100644 --- a/src/test/ui/syntax-extension-minor.stderr +++ b/src/test/ui/syntax-extension-minor.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `asdf_fdsa` in this scope - --> $DIR/syntax-extension-minor.rs:20:13 + --> $DIR/syntax-extension-minor.rs:10:13 | LL | assert!(concat_idents!(asd, f_f, dsa) == "<.<".to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope diff --git a/src/test/ui/syntax-trait-polarity-feature-gate.rs b/src/test/ui/syntax-trait-polarity-feature-gate.rs index 8d5e89cc66f..4a3b24383ab 100644 --- a/src/test/ui/syntax-trait-polarity-feature-gate.rs +++ b/src/test/ui/syntax-trait-polarity-feature-gate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::marker::Send; struct TestType; diff --git a/src/test/ui/syntax-trait-polarity-feature-gate.stderr b/src/test/ui/syntax-trait-polarity-feature-gate.stderr index eebd018b887..7b9c3da3712 100644 --- a/src/test/ui/syntax-trait-polarity-feature-gate.stderr +++ b/src/test/ui/syntax-trait-polarity-feature-gate.stderr @@ -1,5 +1,5 @@ error[E0658]: negative trait bounds are not yet fully implemented; use marker types for now (see issue #13231) - --> $DIR/syntax-trait-polarity-feature-gate.rs:17:1 + --> $DIR/syntax-trait-polarity-feature-gate.rs:7:1 | LL | impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/syntax-trait-polarity.rs b/src/test/ui/syntax-trait-polarity.rs index 1a5d058cb9a..1b7fc1587e6 100644 --- a/src/test/ui/syntax-trait-polarity.rs +++ b/src/test/ui/syntax-trait-polarity.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] use std::marker::Send; diff --git a/src/test/ui/syntax-trait-polarity.stderr b/src/test/ui/syntax-trait-polarity.stderr index 724ac60ed91..689e24bb834 100644 --- a/src/test/ui/syntax-trait-polarity.stderr +++ b/src/test/ui/syntax-trait-polarity.stderr @@ -1,35 +1,35 @@ error: inherent impls cannot be negative - --> $DIR/syntax-trait-polarity.rs:17:1 + --> $DIR/syntax-trait-polarity.rs:7:1 | LL | impl !TestType {} | ^^^^^^^^^^^^^^^^^ error[E0198]: negative impls cannot be unsafe - --> $DIR/syntax-trait-polarity.rs:22:1 + --> $DIR/syntax-trait-polarity.rs:12:1 | LL | unsafe impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: inherent impls cannot be negative - --> $DIR/syntax-trait-polarity.rs:29:1 + --> $DIR/syntax-trait-polarity.rs:19:1 | LL | impl !TestType2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0198]: negative impls cannot be unsafe - --> $DIR/syntax-trait-polarity.rs:32:1 + --> $DIR/syntax-trait-polarity.rs:22:1 | LL | unsafe impl !Send for TestType2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) - --> $DIR/syntax-trait-polarity.rs:24:1 + --> $DIR/syntax-trait-polarity.rs:14:1 | LL | impl !TestTrait for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) - --> $DIR/syntax-trait-polarity.rs:34:1 + --> $DIR/syntax-trait-polarity.rs:24:1 | LL | impl !TestTrait for TestType2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/synthetic-param.rs b/src/test/ui/synthetic-param.rs index 337cae1369e..e53e3ba06e0 100644 --- a/src/test/ui/synthetic-param.rs +++ b/src/test/ui/synthetic-param.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] fn func<#[rustc_synthetic] T>(_: T) {} diff --git a/src/test/ui/synthetic-param.stderr b/src/test/ui/synthetic-param.stderr index 2711f6f8bdc..7bdab439572 100644 --- a/src/test/ui/synthetic-param.stderr +++ b/src/test/ui/synthetic-param.stderr @@ -1,17 +1,17 @@ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. - --> $DIR/synthetic-param.rs:30:5 + --> $DIR/synthetic-param.rs:20:5 | LL | func::(42); //~ ERROR cannot provide explicit type parameters | ^^^^^^^^^^ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. - --> $DIR/synthetic-param.rs:33:5 + --> $DIR/synthetic-param.rs:23:5 | LL | Foo::func::(42); //~ ERROR cannot provide explicit type parameters | ^^^^^^^^^^^^^^^ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. - --> $DIR/synthetic-param.rs:36:5 + --> $DIR/synthetic-param.rs:26:5 | LL | Bar::::func::(42); //~ ERROR cannot provide explicit type parameters | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/tag-that-dare-not-speak-its-name.rs b/src/test/ui/tag-that-dare-not-speak-its-name.rs index 8f420f1ce4b..0a7f405746c 100644 --- a/src/test/ui/tag-that-dare-not-speak-its-name.rs +++ b/src/test/ui/tag-that-dare-not-speak-its-name.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #876 #![no_implicit_prelude] diff --git a/src/test/ui/tag-that-dare-not-speak-its-name.stderr b/src/test/ui/tag-that-dare-not-speak-its-name.stderr index b9580eafc33..a0d6b0007d7 100644 --- a/src/test/ui/tag-that-dare-not-speak-its-name.stderr +++ b/src/test/ui/tag-that-dare-not-speak-its-name.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/tag-that-dare-not-speak-its-name.rs:22:20 + --> $DIR/tag-that-dare-not-speak-its-name.rs:12:20 | LL | let x : char = last(y); | ^^^^^^^ expected char, found enum `std::option::Option` diff --git a/src/test/ui/tag-type-args.rs b/src/test/ui/tag-type-args.rs index 5785a13b006..4f546fcc2ad 100644 --- a/src/test/ui/tag-type-args.rs +++ b/src/test/ui/tag-type-args.rs @@ -1,17 +1,5 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +enum Quux { Bar } -// error-pattern:wrong number of type arguments - -enum quux { bar } - -fn foo(c: quux) { assert!((false)); } +fn foo(c: Quux) { assert!((false)); } //~ ERROR wrong number of type arguments fn main() { panic!(); } diff --git a/src/test/ui/tag-type-args.stderr b/src/test/ui/tag-type-args.stderr index dffdcb20ad2..40523ee907b 100644 --- a/src/test/ui/tag-type-args.stderr +++ b/src/test/ui/tag-type-args.stderr @@ -1,7 +1,7 @@ error[E0107]: wrong number of type arguments: expected 1, found 0 - --> $DIR/tag-type-args.rs:15:11 + --> $DIR/tag-type-args.rs:3:11 | -LL | fn foo(c: quux) { assert!((false)); } +LL | fn foo(c: Quux) { assert!((false)); } //~ ERROR wrong number of type arguments | ^^^^ expected 1 type argument error: aborting due to previous error diff --git a/src/test/ui/tag-variant-cast-non-nullary.rs b/src/test/ui/tag-variant-cast-non-nullary.rs index 220537633ea..bb34e82cdca 100644 --- a/src/test/ui/tag-variant-cast-non-nullary.rs +++ b/src/test/ui/tag-variant-cast-non-nullary.rs @@ -1,19 +1,9 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum non_nullary { - nullary, - other(isize), +enum NonNullary { + Nullary, + Other(isize), } fn main() { - let v = non_nullary::nullary; - let val = v as isize; //~ ERROR non-primitive cast: `non_nullary` as `isize` [E0605] + let v = NonNullary::Nullary; + let val = v as isize; //~ ERROR non-primitive cast: `NonNullary` as `isize` [E0605] } diff --git a/src/test/ui/tag-variant-cast-non-nullary.stderr b/src/test/ui/tag-variant-cast-non-nullary.stderr index 1e64c74d121..797a55f65fe 100644 --- a/src/test/ui/tag-variant-cast-non-nullary.stderr +++ b/src/test/ui/tag-variant-cast-non-nullary.stderr @@ -1,7 +1,7 @@ -error[E0605]: non-primitive cast: `non_nullary` as `isize` - --> $DIR/tag-variant-cast-non-nullary.rs:18:15 +error[E0605]: non-primitive cast: `NonNullary` as `isize` + --> $DIR/tag-variant-cast-non-nullary.rs:8:15 | -LL | let val = v as isize; //~ ERROR non-primitive cast: `non_nullary` as `isize` [E0605] +LL | let val = v as isize; //~ ERROR non-primitive cast: `NonNullary` as `isize` [E0605] | ^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/tag-variant-disr-dup.rs b/src/test/ui/tag-variant-disr-dup.rs index 5da5bb85409..d2a38e003ea 100644 --- a/src/test/ui/tag-variant-disr-dup.rs +++ b/src/test/ui/tag-variant-disr-dup.rs @@ -1,23 +1,11 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//error-pattern:discriminant value - -// black and white have the same discriminator value ... - -enum color { - red = 0xff0000, - green = 0x00ff00, - blue = 0x0000ff, - black = 0x000000, - white = 0x000000, +// Black and White have the same discriminator value ... + +enum Color { + Red = 0xff0000, + Green = 0x00ff00, + Blue = 0x0000ff, + Black = 0x000000, + White = 0x000000, //~ ERROR discriminant value `0` already exists } fn main() { } diff --git a/src/test/ui/tag-variant-disr-dup.stderr b/src/test/ui/tag-variant-disr-dup.stderr index de5a0fac54f..b3de25e87b3 100644 --- a/src/test/ui/tag-variant-disr-dup.stderr +++ b/src/test/ui/tag-variant-disr-dup.stderr @@ -1,9 +1,9 @@ error[E0081]: discriminant value `0` already exists - --> $DIR/tag-variant-disr-dup.rs:20:13 + --> $DIR/tag-variant-disr-dup.rs:8:13 | -LL | black = 0x000000, +LL | Black = 0x000000, | -------- first use of `0` -LL | white = 0x000000, +LL | White = 0x000000, //~ ERROR discriminant value `0` already exists | ^^^^^^^^ enum already has `0` error: aborting due to previous error diff --git a/src/test/ui/tail-typeck.rs b/src/test/ui/tail-typeck.rs index 5c1270aa0e4..37a7694c8fa 100644 --- a/src/test/ui/tail-typeck.rs +++ b/src/test/ui/tail-typeck.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: mismatched types fn f() -> isize { return g(); } diff --git a/src/test/ui/tail-typeck.stderr b/src/test/ui/tail-typeck.stderr index 302bd6aa2d8..1170f5c17c1 100644 --- a/src/test/ui/tail-typeck.stderr +++ b/src/test/ui/tail-typeck.stderr @@ -1,8 +1,10 @@ error[E0308]: mismatched types - --> $DIR/tail-typeck.rs:13:26 + --> $DIR/tail-typeck.rs:3:26 | LL | fn f() -> isize { return g(); } - | ^^^ expected isize, found usize + | ----- ^^^ expected isize, found usize + | | + | expected `isize` because of return type error: aborting due to previous error diff --git a/src/test/ui/target-feature-gate.rs b/src/test/ui/target-feature-gate.rs index 8a045884cae..84300301b76 100644 --- a/src/test/ui/target-feature-gate.rs +++ b/src/test/ui/target-feature-gate.rs @@ -1,19 +1,15 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-arm // ignore-aarch64 // ignore-wasm // ignore-emscripten // ignore-mips // ignore-mips64 +// ignore-powerpc +// ignore-powerpc64 +// ignore-powerpc64le +// ignore-sparc +// ignore-sparc64 +// ignore-s390x // gate-test-sse4a_target_feature // gate-test-powerpc_target_feature // gate-test-avx512_target_feature @@ -24,6 +20,9 @@ // gate-test-mips_target_feature // gate-test-mmx_target_feature // gate-test-wasm_target_feature +// gate-test-adx_target_feature +// gate-test-cmpxchg16b_target_feature +// gate-test-movbe_target_feature // min-llvm-version 6.0 #[target_feature(enable = "avx512bw")] diff --git a/src/test/ui/target-feature-gate.stderr b/src/test/ui/target-feature-gate.stderr index f18bebc0c29..24141d0064f 100644 --- a/src/test/ui/target-feature-gate.stderr +++ b/src/test/ui/target-feature-gate.stderr @@ -1,5 +1,5 @@ error[E0658]: the target feature `avx512bw` is currently unstable (see issue #44839) - --> $DIR/target-feature-gate.rs:29:18 + --> $DIR/target-feature-gate.rs:28:18 | LL | #[target_feature(enable = "avx512bw")] | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/target-feature-wrong.rs b/src/test/ui/target-feature-wrong.rs index fe611141379..ddae8870905 100644 --- a/src/test/ui/target-feature-wrong.rs +++ b/src/test/ui/target-feature-wrong.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-arm // ignore-aarch64 // ignore-wasm diff --git a/src/test/ui/target-feature-wrong.stderr b/src/test/ui/target-feature-wrong.stderr index 21c73b7ddbf..236f5c4afec 100644 --- a/src/test/ui/target-feature-wrong.stderr +++ b/src/test/ui/target-feature-wrong.stderr @@ -1,35 +1,35 @@ -error: #[target_feature] attribute must be of the form #[target_feature(..)] - --> $DIR/target-feature-wrong.rs:26:1 +error: attribute must be of the form `#[target_feature(enable = "name")]` + --> $DIR/target-feature-wrong.rs:16:1 | LL | #[target_feature = "+sse2"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the feature named `foo` is not valid for this target - --> $DIR/target-feature-wrong.rs:28:18 + --> $DIR/target-feature-wrong.rs:18:18 | LL | #[target_feature(enable = "foo")] | ^^^^^^^^^^^^^^ error: #[target_feature(..)] only accepts sub-keys of `enable` currently - --> $DIR/target-feature-wrong.rs:30:18 + --> $DIR/target-feature-wrong.rs:20:18 | LL | #[target_feature(bar)] | ^^^ error: #[target_feature(..)] only accepts sub-keys of `enable` currently - --> $DIR/target-feature-wrong.rs:32:18 + --> $DIR/target-feature-wrong.rs:22:18 | LL | #[target_feature(disable = "baz")] | ^^^^^^^^^^^^^^^ error: #[target_feature(..)] can only be applied to `unsafe` function - --> $DIR/target-feature-wrong.rs:36:1 + --> $DIR/target-feature-wrong.rs:26:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: attribute should be applied to a function - --> $DIR/target-feature-wrong.rs:40:1 + --> $DIR/target-feature-wrong.rs:30:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -38,7 +38,7 @@ LL | mod another {} | -------------- not a function error: cannot use #[inline(always)] with #[target_feature] - --> $DIR/target-feature-wrong.rs:44:1 + --> $DIR/target-feature-wrong.rs:34:1 | LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/terr-in-field.rs b/src/test/ui/terr-in-field.rs index 4a21e133981..388c13d28cc 100644 --- a/src/test/ui/terr-in-field.rs +++ b/src/test/ui/terr-in-field.rs @@ -1,29 +1,19 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct foo { +struct Foo { a: isize, b: isize, } -struct bar { +struct Bar { a: isize, b: usize, } -fn want_foo(f: foo) {} -fn have_bar(b: bar) { +fn want_foo(f: Foo) {} +fn have_bar(b: Bar) { want_foo(b); //~ ERROR mismatched types - //~| expected type `foo` - //~| found type `bar` - //~| expected struct `foo`, found struct `bar` + //~| expected type `Foo` + //~| found type `Bar` + //~| expected struct `Foo`, found struct `Bar` } fn main() {} diff --git a/src/test/ui/terr-in-field.stderr b/src/test/ui/terr-in-field.stderr index 5d06eef90be..5a9c0898aad 100644 --- a/src/test/ui/terr-in-field.stderr +++ b/src/test/ui/terr-in-field.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/terr-in-field.rs:23:14 + --> $DIR/terr-in-field.rs:13:14 | LL | want_foo(b); //~ ERROR mismatched types - | ^ expected struct `foo`, found struct `bar` + | ^ expected struct `Foo`, found struct `Bar` | - = note: expected type `foo` - found type `bar` + = note: expected type `Foo` + found type `Bar` error: aborting due to previous error diff --git a/src/test/ui/terr-sorts.rs b/src/test/ui/terr-sorts.rs index fd92a26d0fc..4bec5614e49 100644 --- a/src/test/ui/terr-sorts.rs +++ b/src/test/ui/terr-sorts.rs @@ -1,26 +1,15 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -struct foo { +struct Foo { a: isize, b: isize, } -type bar = Box; +type Bar = Box; -fn want_foo(f: foo) {} -fn have_bar(b: bar) { +fn want_foo(f: Foo) {} +fn have_bar(b: Bar) { want_foo(b); //~ ERROR mismatched types - //~| expected type `foo` - //~| found type `std::boxed::Box` + //~| expected type `Foo` + //~| found type `std::boxed::Box` } fn main() {} diff --git a/src/test/ui/terr-sorts.stderr b/src/test/ui/terr-sorts.stderr index a16216c842e..dfaf8186fc3 100644 --- a/src/test/ui/terr-sorts.stderr +++ b/src/test/ui/terr-sorts.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/terr-sorts.rs:21:14 + --> $DIR/terr-sorts.rs:10:14 | LL | want_foo(b); //~ ERROR mismatched types - | ^ expected struct `foo`, found struct `std::boxed::Box` + | ^ expected struct `Foo`, found struct `std::boxed::Box` | - = note: expected type `foo` - found type `std::boxed::Box` + = note: expected type `Foo` + found type `std::boxed::Box` error: aborting due to previous error diff --git a/src/test/ui/test-attr-non-associated-functions.rs b/src/test/ui/test-attr-non-associated-functions.rs index 348bc6b4e98..5ed85abaaa1 100644 --- a/src/test/ui/test-attr-non-associated-functions.rs +++ b/src/test/ui/test-attr-non-associated-functions.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // #[test] attribute is not allowed on associated functions or methods // reworded error message // compile-flags:--test diff --git a/src/test/ui/test-attr-non-associated-functions.stderr b/src/test/ui/test-attr-non-associated-functions.stderr index 491fcc01431..8a1cc6fa367 100644 --- a/src/test/ui/test-attr-non-associated-functions.stderr +++ b/src/test/ui/test-attr-non-associated-functions.stderr @@ -1,5 +1,5 @@ error: #[test] attribute is only allowed on non associated functions - --> $DIR/test-attr-non-associated-functions.rs:19:5 + --> $DIR/test-attr-non-associated-functions.rs:9:5 | LL | / fn new() -> A { //~ ERROR #[test] attribute is only allowed on non associated functions LL | | A {} diff --git a/src/test/ui/test-cfg.rs b/src/test/ui/test-cfg.rs index 71cae0b6df9..8750bae0028 100644 --- a/src/test/ui/test-cfg.rs +++ b/src/test/ui/test-cfg.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --cfg foo #[cfg(all(foo, bar))] // foo AND bar diff --git a/src/test/ui/test-cfg.stderr b/src/test/ui/test-cfg.stderr index 1db6d5eccbe..93ca9a27de2 100644 --- a/src/test/ui/test-cfg.stderr +++ b/src/test/ui/test-cfg.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find function `foo` in this scope - --> $DIR/test-cfg.rs:17:5 + --> $DIR/test-cfg.rs:7:5 | LL | foo(); //~ ERROR cannot find function `foo` in this scope | ^^^ not found in this scope diff --git a/src/test/ui/test-on-macro.rs b/src/test/ui/test-on-macro.rs index a153e634434..ad7424a1bbb 100644 --- a/src/test/ui/test-on-macro.rs +++ b/src/test/ui/test-on-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // compile-flags:--test diff --git a/src/test/ui/test-on-macro.stderr b/src/test/ui/test-on-macro.stderr index a45bb25255e..1af38829cc7 100644 --- a/src/test/ui/test-on-macro.stderr +++ b/src/test/ui/test-on-macro.stderr @@ -1,5 +1,5 @@ warning: #[test] attribute should not be used on macros. Use #[cfg(test)] instead. - --> $DIR/test-on-macro.rs:21:1 + --> $DIR/test-on-macro.rs:11:1 | LL | foo!(); | ^^^^^^^ diff --git a/src/test/ui/test-shadowing/auxiliary/test_macro.rs b/src/test/ui/test-shadowing/auxiliary/test_macro.rs index 2e9d2dcc410..60a98ab6a02 100644 --- a/src/test/ui/test-shadowing/auxiliary/test_macro.rs +++ b/src/test/ui/test-shadowing/auxiliary/test_macro.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[macro_export] macro_rules! test { () => {}; diff --git a/src/test/ui/test-shadowing/test-cant-be-shadowed.rs b/src/test/ui/test-shadowing/test-cant-be-shadowed.rs index 4e24b17bdd5..b1c2a000d4a 100644 --- a/src/test/ui/test-shadowing/test-cant-be-shadowed.rs +++ b/src/test/ui/test-shadowing/test-cant-be-shadowed.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // aux-build:test_macro.rs // compile-flags:--test diff --git a/src/test/ui/test-should-panic-attr.rs b/src/test/ui/test-should-panic-attr.rs index 8986732a269..f936dd57587 100644 --- a/src/test/ui/test-should-panic-attr.rs +++ b/src/test/ui/test-should-panic-attr.rs @@ -1,19 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass +// compile-pass // compile-flags: --test #[test] #[should_panic = "foo"] -//~^ WARN: attribute must be of the form: fn test1() { panic!(); } diff --git a/src/test/ui/test-should-panic-attr.stderr b/src/test/ui/test-should-panic-attr.stderr index 09bd5469808..4b032eba5f8 100644 --- a/src/test/ui/test-should-panic-attr.stderr +++ b/src/test/ui/test-should-panic-attr.stderr @@ -1,13 +1,5 @@ -warning: attribute must be of the form: `#[should_panic]` or `#[should_panic(expected = "error message")]` - --> $DIR/test-should-panic-attr.rs:15:1 - | -LL | #[should_panic = "foo"] - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: Errors in this attribute were erroneously allowed and will become a hard error in a future release. - warning: argument must be of the form: `expected = "error message"` - --> $DIR/test-should-panic-attr.rs:22:1 + --> $DIR/test-should-panic-attr.rs:11:1 | LL | #[should_panic(expected)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +7,7 @@ LL | #[should_panic(expected)] = note: Errors in this attribute were erroneously allowed and will become a hard error in a future release. warning: argument must be of the form: `expected = "error message"` - --> $DIR/test-should-panic-attr.rs:29:1 + --> $DIR/test-should-panic-attr.rs:18:1 | LL | #[should_panic(expect)] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +15,7 @@ LL | #[should_panic(expect)] = note: Errors in this attribute were erroneously allowed and will become a hard error in a future release. warning: argument must be of the form: `expected = "error message"` - --> $DIR/test-should-panic-attr.rs:36:1 + --> $DIR/test-should-panic-attr.rs:25:1 | LL | #[should_panic(expected(foo, bar))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -31,7 +23,7 @@ LL | #[should_panic(expected(foo, bar))] = note: Errors in this attribute were erroneously allowed and will become a hard error in a future release. warning: argument must be of the form: `expected = "error message"` - --> $DIR/test-should-panic-attr.rs:43:1 + --> $DIR/test-should-panic-attr.rs:32:1 | LL | #[should_panic(expected = "foo", bar)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/test-warns-dead-code.rs b/src/test/ui/test-warns-dead-code.rs index 0e25f1e965a..936461f162d 100644 --- a/src/test/ui/test-warns-dead-code.rs +++ b/src/test/ui/test-warns-dead-code.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --test #![deny(dead_code)] diff --git a/src/test/ui/test-warns-dead-code.stderr b/src/test/ui/test-warns-dead-code.stderr index 46ff31c65d6..fe74ad13340 100644 --- a/src/test/ui/test-warns-dead-code.stderr +++ b/src/test/ui/test-warns-dead-code.stderr @@ -1,11 +1,11 @@ error: function is never used: `dead` - --> $DIR/test-warns-dead-code.rs:15:1 + --> $DIR/test-warns-dead-code.rs:5:1 | LL | fn dead() {} //~ error: function is never used: `dead` | ^^^^^^^^^ | note: lint level defined here - --> $DIR/test-warns-dead-code.rs:13:9 + --> $DIR/test-warns-dead-code.rs:3:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ diff --git a/src/test/ui/thread-local-in-ctfe.nll.stderr b/src/test/ui/thread-local-in-ctfe.nll.stderr index 05f8f343380..c5cca9d25c1 100644 --- a/src/test/ui/thread-local-in-ctfe.nll.stderr +++ b/src/test/ui/thread-local-in-ctfe.nll.stderr @@ -1,53 +1,51 @@ error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:16:17 + --> $DIR/thread-local-in-ctfe.rs:6:17 | LL | static B: u32 = A; | ^ error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:19:18 + --> $DIR/thread-local-in-ctfe.rs:9:18 | LL | static C: &u32 = &A; | ^^ warning[E0712]: thread-local variable borrowed past end of function - --> $DIR/thread-local-in-ctfe.rs:19:18 + --> $DIR/thread-local-in-ctfe.rs:9:18 | LL | static C: &u32 = &A; | ^^- end of enclosing function is here | | | thread-local variables cannot be borrowed beyond the end of the function | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:22:16 + --> $DIR/thread-local-in-ctfe.rs:12:16 | LL | const D: u32 = A; | ^ error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:25:17 + --> $DIR/thread-local-in-ctfe.rs:15:17 | LL | const E: &u32 = &A; | ^^ warning[E0712]: thread-local variable borrowed past end of function - --> $DIR/thread-local-in-ctfe.rs:25:17 + --> $DIR/thread-local-in-ctfe.rs:15:17 | LL | const E: &u32 = &A; | ^^- end of enclosing function is here | | | thread-local variables cannot be borrowed beyond the end of the function | - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. + = warning: this error has been downgraded to a warning for backwards compatibility with previous releases + = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:29:5 + --> $DIR/thread-local-in-ctfe.rs:19:5 | LL | A | ^ diff --git a/src/test/ui/thread-local-in-ctfe.rs b/src/test/ui/thread-local-in-ctfe.rs index 62e26f28b06..313d39de36b 100644 --- a/src/test/ui/thread-local-in-ctfe.rs +++ b/src/test/ui/thread-local-in-ctfe.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(const_fn, thread_local)] #[thread_local] diff --git a/src/test/ui/thread-local-in-ctfe.stderr b/src/test/ui/thread-local-in-ctfe.stderr index 76079d9a9ee..abeb2a3e0de 100644 --- a/src/test/ui/thread-local-in-ctfe.stderr +++ b/src/test/ui/thread-local-in-ctfe.stderr @@ -1,29 +1,29 @@ error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:16:17 + --> $DIR/thread-local-in-ctfe.rs:6:17 | LL | static B: u32 = A; | ^ error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:19:18 + --> $DIR/thread-local-in-ctfe.rs:9:18 | LL | static C: &u32 = &A; | ^^ error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:22:16 + --> $DIR/thread-local-in-ctfe.rs:12:16 | LL | const D: u32 = A; | ^ error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:25:17 + --> $DIR/thread-local-in-ctfe.rs:15:17 | LL | const E: &u32 = &A; | ^^ error[E0625]: thread-local statics cannot be accessed at compile-time - --> $DIR/thread-local-in-ctfe.rs:29:5 + --> $DIR/thread-local-in-ctfe.rs:19:5 | LL | A | ^ diff --git a/src/test/ui/thread-local-mutation.nll.stderr b/src/test/ui/thread-local-mutation.nll.stderr new file mode 100644 index 00000000000..0a3664b0d9d --- /dev/null +++ b/src/test/ui/thread-local-mutation.nll.stderr @@ -0,0 +1,9 @@ +error[E0594]: cannot assign to immutable static item `S` + --> $DIR/thread-local-mutation.rs:11:5 + | +LL | S = "after"; //~ ERROR cannot assign to immutable + | ^^^^^^^^^^^ cannot assign + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/thread-local-mutation.rs b/src/test/ui/thread-local-mutation.rs new file mode 100644 index 00000000000..e738225ce2a --- /dev/null +++ b/src/test/ui/thread-local-mutation.rs @@ -0,0 +1,18 @@ +// Regression test for #54901: immutable thread locals could be mutated. See: +// https://github.com/rust-lang/rust/issues/29594#issuecomment-328177697 +// https://github.com/rust-lang/rust/issues/54901 + +#![feature(thread_local)] + +#[thread_local] +static S: &str = "before"; + +fn set_s() { + S = "after"; //~ ERROR cannot assign to immutable +} + +fn main() { + println!("{}", S); + set_s(); + println!("{}", S); +} diff --git a/src/test/ui/thread-local-mutation.stderr b/src/test/ui/thread-local-mutation.stderr new file mode 100644 index 00000000000..bf298523e1b --- /dev/null +++ b/src/test/ui/thread-local-mutation.stderr @@ -0,0 +1,9 @@ +error[E0594]: cannot assign to immutable thread-local static item + --> $DIR/thread-local-mutation.rs:11:5 + | +LL | S = "after"; //~ ERROR cannot assign to immutable + | ^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0594`. diff --git a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs index 8d3cfb5a167..33cffcefd89 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(custom_attribute)] type A = rustfmt; //~ ERROR expected type, found tool module `rustfmt` diff --git a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr index 60188aebce7..dd1de22f3da 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr @@ -1,35 +1,35 @@ error: cannot find derive macro `rustfmt` in this scope - --> $DIR/tool-attributes-misplaced-1.rs:16:10 + --> $DIR/tool-attributes-misplaced-1.rs:6:10 | LL | #[derive(rustfmt)] //~ ERROR cannot find derive macro `rustfmt` in this scope | ^^^^^^^ error: cannot find macro `rustfmt!` in this scope - --> $DIR/tool-attributes-misplaced-1.rs:25:5 + --> $DIR/tool-attributes-misplaced-1.rs:15:5 | LL | rustfmt!(); //~ ERROR cannot find macro `rustfmt!` in this scope | ^^^^^^^ error[E0573]: expected type, found tool module `rustfmt` - --> $DIR/tool-attributes-misplaced-1.rs:13:10 + --> $DIR/tool-attributes-misplaced-1.rs:3:10 | LL | type A = rustfmt; //~ ERROR expected type, found tool module `rustfmt` | ^^^^^^^ not a type error[E0573]: expected type, found tool attribute `rustfmt::skip` - --> $DIR/tool-attributes-misplaced-1.rs:14:10 + --> $DIR/tool-attributes-misplaced-1.rs:4:10 | LL | type B = rustfmt::skip; //~ ERROR expected type, found tool attribute `rustfmt::skip` | ^^^^^^^^^^^^^ not a type error[E0423]: expected value, found tool module `rustfmt` - --> $DIR/tool-attributes-misplaced-1.rs:24:5 + --> $DIR/tool-attributes-misplaced-1.rs:14:5 | LL | rustfmt; //~ ERROR expected value, found tool module `rustfmt` | ^^^^^^^ not a value error[E0423]: expected value, found tool attribute `rustfmt::skip` - --> $DIR/tool-attributes-misplaced-1.rs:27:5 + --> $DIR/tool-attributes-misplaced-1.rs:17:5 | LL | rustfmt::skip; //~ ERROR expected value, found tool attribute `rustfmt::skip` | ^^^^^^^^^^^^^ not a value diff --git a/src/test/ui/tool-attributes/tool-attributes-misplaced-2.rs b/src/test/ui/tool-attributes/tool-attributes-misplaced-2.rs index e61ea9d5b44..56b908d94cc 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-2.rs +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-2.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(rustfmt::skip)] //~ ERROR expected a macro, found tool attribute struct S; diff --git a/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr b/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr index ae47203a975..50a7b597328 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr @@ -1,11 +1,11 @@ error: expected a macro, found tool attribute - --> $DIR/tool-attributes-misplaced-2.rs:11:10 + --> $DIR/tool-attributes-misplaced-2.rs:1:10 | LL | #[derive(rustfmt::skip)] //~ ERROR expected a macro, found tool attribute | ^^^^^^^^^^^^^ error: expected a macro, found tool attribute - --> $DIR/tool-attributes-misplaced-2.rs:15:5 + --> $DIR/tool-attributes-misplaced-2.rs:5:5 | LL | rustfmt::skip!(); //~ ERROR expected a macro, found tool attribute | ^^^^^^^^^^^^^ diff --git a/src/test/ui/tool-attributes/tool-attributes-shadowing.rs b/src/test/ui/tool-attributes/tool-attributes-shadowing.rs index 11e28857afe..21bbaa3a710 100644 --- a/src/test/ui/tool-attributes/tool-attributes-shadowing.rs +++ b/src/test/ui/tool-attributes/tool-attributes-shadowing.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod rustfmt {} #[rustfmt::skip] //~ ERROR failed to resolve: could not find `skip` in `rustfmt` diff --git a/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr b/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr index 0839e363c36..62b5b8e2ac2 100644 --- a/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr +++ b/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: could not find `skip` in `rustfmt` - --> $DIR/tool-attributes-shadowing.rs:13:12 + --> $DIR/tool-attributes-shadowing.rs:3:12 | LL | #[rustfmt::skip] //~ ERROR failed to resolve: could not find `skip` in `rustfmt` | ^^^^ could not find `skip` in `rustfmt` diff --git a/src/test/ui/tool_lints-fail.rs b/src/test/ui/tool_lints-fail.rs index 4134fca1ce6..5cbd63be597 100644 --- a/src/test/ui/tool_lints-fail.rs +++ b/src/test/ui/tool_lints-fail.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Don't allow tool_lints, which aren't scoped diff --git a/src/test/ui/tool_lints-fail.stderr b/src/test/ui/tool_lints-fail.stderr index 735673b5785..6b027eecf26 100644 --- a/src/test/ui/tool_lints-fail.stderr +++ b/src/test/ui/tool_lints-fail.stderr @@ -1,11 +1,11 @@ error: unknown lint: `clippy` - --> $DIR/tool_lints-fail.rs:16:9 + --> $DIR/tool_lints-fail.rs:6:9 | LL | #![deny(clippy)] //~ ERROR: unknown lint: `clippy` | ^^^^^^ | note: lint level defined here - --> $DIR/tool_lints-fail.rs:14:9 + --> $DIR/tool_lints-fail.rs:4:9 | LL | #![deny(unknown_lints)] | ^^^^^^^^^^^^^ diff --git a/src/test/ui/tool_lints.rs b/src/test/ui/tool_lints.rs index 001f2f11e5c..fa8f041c646 100644 --- a/src/test/ui/tool_lints.rs +++ b/src/test/ui/tool_lints.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - #[warn(foo::bar)] //~^ ERROR an unknown tool name found in scoped lint: `foo::bar` fn main() {} diff --git a/src/test/ui/tool_lints.stderr b/src/test/ui/tool_lints.stderr index 16468df7370..2484b10116f 100644 --- a/src/test/ui/tool_lints.stderr +++ b/src/test/ui/tool_lints.stderr @@ -1,5 +1,5 @@ error[E0710]: an unknown tool name found in scoped lint: `foo::bar` - --> $DIR/tool_lints.rs:13:8 + --> $DIR/tool_lints.rs:1:8 | LL | #[warn(foo::bar)] | ^^^ diff --git a/src/test/ui/trace_macros-format.rs b/src/test/ui/trace_macros-format.rs index 95cb17c215b..afca45ca0f2 100644 --- a/src/test/ui/trace_macros-format.rs +++ b/src/test/ui/trace_macros-format.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(trace_macros)] fn main() { diff --git a/src/test/ui/trace_macros-format.stderr b/src/test/ui/trace_macros-format.stderr index 8dad041e9fe..a180c360b4a 100644 --- a/src/test/ui/trace_macros-format.stderr +++ b/src/test/ui/trace_macros-format.stderr @@ -1,35 +1,35 @@ error: trace_macros! accepts only `true` or `false` - --> $DIR/trace_macros-format.rs:14:5 + --> $DIR/trace_macros-format.rs:4:5 | LL | trace_macros!(); //~ ERROR trace_macros! accepts only `true` or `false` | ^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` - --> $DIR/trace_macros-format.rs:15:5 + --> $DIR/trace_macros-format.rs:5:5 | LL | trace_macros!(1); //~ ERROR trace_macros! accepts only `true` or `false` | ^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` - --> $DIR/trace_macros-format.rs:16:5 + --> $DIR/trace_macros-format.rs:6:5 | LL | trace_macros!(ident); //~ ERROR trace_macros! accepts only `true` or `false` | ^^^^^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` - --> $DIR/trace_macros-format.rs:17:5 + --> $DIR/trace_macros-format.rs:7:5 | LL | trace_macros!(for); //~ ERROR trace_macros! accepts only `true` or `false` | ^^^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` - --> $DIR/trace_macros-format.rs:18:5 + --> $DIR/trace_macros-format.rs:8:5 | LL | trace_macros!(true,); //~ ERROR trace_macros! accepts only `true` or `false` | ^^^^^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` - --> $DIR/trace_macros-format.rs:19:5 + --> $DIR/trace_macros-format.rs:9:5 | LL | trace_macros!(false 1); //~ ERROR trace_macros! accepts only `true` or `false` | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/trace_macros-gate.rs b/src/test/ui/trace_macros-gate.rs index d4a7c4ed0e0..c9af04741ac 100644 --- a/src/test/ui/trace_macros-gate.rs +++ b/src/test/ui/trace_macros-gate.rs @@ -1,26 +1,10 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the trace_macros feature gate is on. fn main() { trace_macros!(); //~ ERROR `trace_macros` is not stable - trace_macros!(1); //~ ERROR `trace_macros` is not stable - trace_macros!(ident); //~ ERROR `trace_macros` is not stable - trace_macros!(for); //~ ERROR `trace_macros` is not stable - trace_macros!(true,); //~ ERROR `trace_macros` is not stable - trace_macros!(false 1); //~ ERROR `trace_macros` is not stable - - // Errors are signalled early for the above, before expansion. - // See trace_macros-gate2 and trace_macros-gate3. for examples - // of the below being caught. + //~| ERROR trace_macros! accepts only `true` or `false` + trace_macros!(true); //~ ERROR `trace_macros` is not stable + trace_macros!(false); //~ ERROR `trace_macros` is not stable macro_rules! expando { ($x: ident) => { trace_macros!($x) } //~ ERROR `trace_macros` is not stable diff --git a/src/test/ui/trace_macros-gate.stderr b/src/test/ui/trace_macros-gate.stderr index ed92e1227ba..4831aa158db 100644 --- a/src/test/ui/trace_macros-gate.stderr +++ b/src/test/ui/trace_macros-gate.stderr @@ -1,53 +1,35 @@ error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) - --> $DIR/trace_macros-gate.rs:14:5 + --> $DIR/trace_macros-gate.rs:4:5 | LL | trace_macros!(); //~ ERROR `trace_macros` is not stable | ^^^^^^^^^^^^^^^^ | = help: add #![feature(trace_macros)] to the crate attributes to enable -error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) - --> $DIR/trace_macros-gate.rs:15:5 - | -LL | trace_macros!(1); //~ ERROR `trace_macros` is not stable - | ^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(trace_macros)] to the crate attributes to enable - -error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) - --> $DIR/trace_macros-gate.rs:16:5 - | -LL | trace_macros!(ident); //~ ERROR `trace_macros` is not stable - | ^^^^^^^^^^^^^^^^^^^^^ +error: trace_macros! accepts only `true` or `false` + --> $DIR/trace_macros-gate.rs:4:5 | - = help: add #![feature(trace_macros)] to the crate attributes to enable +LL | trace_macros!(); //~ ERROR `trace_macros` is not stable + | ^^^^^^^^^^^^^^^^ error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) - --> $DIR/trace_macros-gate.rs:17:5 + --> $DIR/trace_macros-gate.rs:6:5 | -LL | trace_macros!(for); //~ ERROR `trace_macros` is not stable - | ^^^^^^^^^^^^^^^^^^^ +LL | trace_macros!(true); //~ ERROR `trace_macros` is not stable + | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(trace_macros)] to the crate attributes to enable error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) - --> $DIR/trace_macros-gate.rs:18:5 + --> $DIR/trace_macros-gate.rs:7:5 | -LL | trace_macros!(true,); //~ ERROR `trace_macros` is not stable +LL | trace_macros!(false); //~ ERROR `trace_macros` is not stable | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(trace_macros)] to the crate attributes to enable error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) - --> $DIR/trace_macros-gate.rs:19:5 - | -LL | trace_macros!(false 1); //~ ERROR `trace_macros` is not stable - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(trace_macros)] to the crate attributes to enable - -error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) - --> $DIR/trace_macros-gate.rs:26:26 + --> $DIR/trace_macros-gate.rs:10:26 | LL | ($x: ident) => { trace_macros!($x) } //~ ERROR `trace_macros` is not stable | ^^^^^^^^^^^^^^^^^ @@ -57,6 +39,6 @@ LL | expando!(true); | = help: add #![feature(trace_macros)] to the crate attributes to enable -error: aborting due to 7 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/trait-method-number-parameters.rs b/src/test/ui/trait-method-number-parameters.rs new file mode 100644 index 00000000000..719005d6643 --- /dev/null +++ b/src/test/ui/trait-method-number-parameters.rs @@ -0,0 +1,13 @@ +trait Foo { + fn foo(&mut self, x: i32, y: i32) -> i32; +} + +impl Foo for i32 { + fn foo( + &mut self, //~ ERROR + x: i32, + ) { + } +} + +fn main() {} diff --git a/src/test/ui/trait-method-number-parameters.stderr b/src/test/ui/trait-method-number-parameters.stderr new file mode 100644 index 00000000000..32101239e66 --- /dev/null +++ b/src/test/ui/trait-method-number-parameters.stderr @@ -0,0 +1,13 @@ +error[E0050]: method `foo` has 2 parameters but the declaration in trait `Foo::foo` has 3 + --> $DIR/trait-method-number-parameters.rs:7:9 + | +LL | fn foo(&mut self, x: i32, y: i32) -> i32; + | ------------------------- trait requires 3 parameters +... +LL | / &mut self, //~ ERROR +LL | | x: i32, + | |______________^ expected 3 parameters, found 2 + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0050`. diff --git a/src/test/ui/traits/auxiliary/crate_a1.rs b/src/test/ui/traits/auxiliary/crate_a1.rs index 70f7cac94de..e2e18500541 100644 --- a/src/test/ui/traits/auxiliary/crate_a1.rs +++ b/src/test/ui/traits/auxiliary/crate_a1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo; pub trait Bar{} diff --git a/src/test/ui/traits/auxiliary/trait_alias.rs b/src/test/ui/traits/auxiliary/trait_alias.rs new file mode 100644 index 00000000000..9e56b87e088 --- /dev/null +++ b/src/test/ui/traits/auxiliary/trait_alias.rs @@ -0,0 +1,3 @@ +#![feature(trait_alias)] + +pub trait SendSync = Send + Sync; diff --git a/src/test/ui/traits/auxiliary/trait_bounds_on_structs_and_enums_xc.rs b/src/test/ui/traits/auxiliary/trait_bounds_on_structs_and_enums_xc.rs index 29cb0bc176a..7e9592eee2c 100644 --- a/src/test/ui/traits/auxiliary/trait_bounds_on_structs_and_enums_xc.rs +++ b/src/test/ui/traits/auxiliary/trait_bounds_on_structs_and_enums_xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Trait { fn dummy(&self) { } } diff --git a/src/test/ui/traits/auxiliary/trait_safety_lib.rs b/src/test/ui/traits/auxiliary/trait_safety_lib.rs index 585a756fd07..6fc432ed455 100644 --- a/src/test/ui/traits/auxiliary/trait_safety_lib.rs +++ b/src/test/ui/traits/auxiliary/trait_safety_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Simple smoke test that unsafe traits can be compiled etc. pub unsafe trait Foo { diff --git a/src/test/ui/traits/conservative_impl_trait.rs b/src/test/ui/traits/conservative_impl_trait.rs index 3f119affd8c..964e21779d5 100644 --- a/src/test/ui/traits/conservative_impl_trait.rs +++ b/src/test/ui/traits/conservative_impl_trait.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass // #39665 diff --git a/src/test/ui/traits/trait-alias-cross-crate.rs b/src/test/ui/traits/trait-alias-cross-crate.rs new file mode 100644 index 00000000000..259fc4fa5d1 --- /dev/null +++ b/src/test/ui/traits/trait-alias-cross-crate.rs @@ -0,0 +1,17 @@ +// aux-build:trait_alias.rs + +#![feature(trait_alias)] + +extern crate trait_alias; + +use std::rc::Rc; +use trait_alias::SendSync; + +fn use_alias() {} + +fn main() { + use_alias::(); + use_alias::>(); + //~^ ERROR `std::rc::Rc` cannot be sent between threads safely [E0277] + //~^^ ERROR `std::rc::Rc` cannot be shared between threads safely [E0277] +} diff --git a/src/test/ui/traits/trait-alias-cross-crate.stderr b/src/test/ui/traits/trait-alias-cross-crate.stderr new file mode 100644 index 00000000000..972d213ac8f --- /dev/null +++ b/src/test/ui/traits/trait-alias-cross-crate.stderr @@ -0,0 +1,29 @@ +error[E0277]: `std::rc::Rc` cannot be sent between threads safely + --> $DIR/trait-alias-cross-crate.rs:14:5 + | +LL | use_alias::>(); + | ^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc` cannot be sent between threads safely + | + = help: the trait `std::marker::Send` is not implemented for `std::rc::Rc` +note: required by `use_alias` + --> $DIR/trait-alias-cross-crate.rs:10:1 + | +LL | fn use_alias() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0277]: `std::rc::Rc` cannot be shared between threads safely + --> $DIR/trait-alias-cross-crate.rs:14:5 + | +LL | use_alias::>(); + | ^^^^^^^^^^^^^^^^^^^^ `std::rc::Rc` cannot be shared between threads safely + | + = help: the trait `std::marker::Sync` is not implemented for `std::rc::Rc` +note: required by `use_alias` + --> $DIR/trait-alias-cross-crate.rs:10:1 + | +LL | fn use_alias() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/traits/trait-alias-impl.rs b/src/test/ui/traits/trait-alias-impl.rs index bf3483000e3..6e35793a066 100644 --- a/src/test/ui/traits/trait-alias-impl.rs +++ b/src/test/ui/traits/trait-alias-impl.rs @@ -1,17 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(trait_alias)] trait DefaultAlias = Default; -impl DefaultAlias for () {} +impl DefaultAlias for () {} //~ ERROR expected trait, found trait alias fn main() {} diff --git a/src/test/ui/traits/trait-alias-impl.stderr b/src/test/ui/traits/trait-alias-impl.stderr index 9ad625176b1..6a6cedb014a 100644 --- a/src/test/ui/traits/trait-alias-impl.stderr +++ b/src/test/ui/traits/trait-alias-impl.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found trait alias `DefaultAlias` - --> $DIR/trait-alias-impl.rs:15:6 + --> $DIR/trait-alias-impl.rs:5:6 | -LL | impl DefaultAlias for () {} +LL | impl DefaultAlias for () {} //~ ERROR expected trait, found trait alias | ^^^^^^^^^^^^ not a trait error: aborting due to previous error diff --git a/src/test/ui/traits/trait-alias-object.rs b/src/test/ui/traits/trait-alias-object.rs index 3adcd8436d8..37963740117 100644 --- a/src/test/ui/traits/trait-alias-object.rs +++ b/src/test/ui/traits/trait-alias-object.rs @@ -1,19 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(trait_alias)] trait EqAlias = Eq; trait IteratorAlias = Iterator; fn main() { - let _: &dyn EqAlias = &123; - let _: &dyn IteratorAlias = &vec![123].into_iter(); + let _: &dyn EqAlias = &123; //~ ERROR `EqAlias` cannot be made into an object + let _: &dyn IteratorAlias = &vec![123].into_iter(); //~ ERROR must be specified } diff --git a/src/test/ui/traits/trait-alias-object.stderr b/src/test/ui/traits/trait-alias-object.stderr index 6b7b322a53d..604db6f7e18 100644 --- a/src/test/ui/traits/trait-alias-object.stderr +++ b/src/test/ui/traits/trait-alias-object.stderr @@ -1,16 +1,16 @@ error[E0038]: the trait `EqAlias` cannot be made into an object - --> $DIR/trait-alias-object.rs:17:13 + --> $DIR/trait-alias-object.rs:7:13 | -LL | let _: &dyn EqAlias = &123; +LL | let _: &dyn EqAlias = &123; //~ ERROR `EqAlias` cannot be made into an object | ^^^^^^^^^^^ the trait `EqAlias` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses error[E0191]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) must be specified - --> $DIR/trait-alias-object.rs:18:13 + --> $DIR/trait-alias-object.rs:8:13 | -LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); - | ^^^^^^^^^^^^^^^^^ missing associated type `Item` value +LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); //~ ERROR must be specified + | ^^^^^^^^^^^^^^^^^ associated type `Item` must be specified error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-alias-wf.rs b/src/test/ui/traits/trait-alias-wf.rs index 8c8ce1221ba..d10e2abb0e1 100644 --- a/src/test/ui/traits/trait-alias-wf.rs +++ b/src/test/ui/traits/trait-alias-wf.rs @@ -1,17 +1,7 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(trait_alias)] trait Foo {} trait A {} -trait B = A; // T cannot be unbounded +trait B = A; //~ ERROR `T: Foo` is not satisfied fn main() {} diff --git a/src/test/ui/traits/trait-alias-wf.stderr b/src/test/ui/traits/trait-alias-wf.stderr index e8c81c87796..1f64ce76dc6 100644 --- a/src/test/ui/traits/trait-alias-wf.stderr +++ b/src/test/ui/traits/trait-alias-wf.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `T: Foo` is not satisfied - --> $DIR/trait-alias-wf.rs:15:1 + --> $DIR/trait-alias-wf.rs:5:1 | -LL | trait B = A; // T cannot be unbounded +LL | trait B = A; //~ ERROR `T: Foo` is not satisfied | ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T` | = help: consider adding a `where T: Foo` bound note: required by `A` - --> $DIR/trait-alias-wf.rs:14:1 + --> $DIR/trait-alias-wf.rs:4:1 | LL | trait A {} | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/trait-as-struct-constructor.rs b/src/test/ui/traits/trait-as-struct-constructor.rs index 49d58580da5..13ebf9d8d66 100644 --- a/src/test/ui/traits/trait-as-struct-constructor.rs +++ b/src/test/ui/traits/trait-as-struct-constructor.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait TraitNotAStruct {} fn main() { diff --git a/src/test/ui/traits/trait-as-struct-constructor.stderr b/src/test/ui/traits/trait-as-struct-constructor.stderr index ecb4e5d44c9..e1d54fbf8aa 100644 --- a/src/test/ui/traits/trait-as-struct-constructor.stderr +++ b/src/test/ui/traits/trait-as-struct-constructor.stderr @@ -1,5 +1,5 @@ error[E0574]: expected struct, variant or union type, found trait `TraitNotAStruct` - --> $DIR/trait-as-struct-constructor.rs:14:5 + --> $DIR/trait-as-struct-constructor.rs:4:5 | LL | TraitNotAStruct{ value: 0 }; | ^^^^^^^^^^^^^^^ not a struct, variant or union type diff --git a/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs b/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs index 9c38d8a9e2a..fd3af6f3a9a 100644 --- a/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs +++ b/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn dummy(&self) { } } diff --git a/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr b/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr index ecabf9af27b..5aee1e7e982 100644 --- a/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr +++ b/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `(dyn Foo + std::marker::Send + 'static)` cannot be known at compilation time - --> $DIR/trait-bounds-not-on-bare-trait.rs:17:8 + --> $DIR/trait-bounds-not-on-bare-trait.rs:7:8 | LL | fn foo(_x: Foo + Send) { | ^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + std::marker::Send + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/traits/trait-bounds-not-on-struct.rs b/src/test/ui/traits/trait-bounds-not-on-struct.rs index 76bbca60658..c6e93e75525 100644 --- a/src/test/ui/traits/trait-bounds-not-on-struct.rs +++ b/src/test/ui/traits/trait-bounds-not-on-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(bare_trait_objects)] struct Foo; diff --git a/src/test/ui/traits/trait-bounds-not-on-struct.stderr b/src/test/ui/traits/trait-bounds-not-on-struct.stderr index 929a1bfaa15..1595fff618f 100644 --- a/src/test/ui/traits/trait-bounds-not-on-struct.stderr +++ b/src/test/ui/traits/trait-bounds-not-on-struct.stderr @@ -1,11 +1,11 @@ error[E0404]: expected trait, found struct `Foo` - --> $DIR/trait-bounds-not-on-struct.rs:15:16 + --> $DIR/trait-bounds-not-on-struct.rs:5:16 | LL | fn foo(_x: Box) { } //~ ERROR expected trait, found struct `Foo` | ^^^ not a trait error[E0404]: expected trait, found struct `Vec` - --> $DIR/trait-bounds-not-on-struct.rs:17:21 + --> $DIR/trait-bounds-not-on-struct.rs:7:21 | LL | type A = Box>; //~ ERROR expected trait, found struct `Vec` | ^^^^^^ not a trait diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.rs index 6a271a7b749..6a6fcf5301d 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.rs +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait {} struct Foo { diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.stderr index 6dd4d1fca86..6fdd2ceaaac 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.stderr +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.stderr @@ -1,23 +1,23 @@ error[E0277]: the trait bound `u32: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:23:1 + --> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:13:1 | LL | fn explode(x: Foo) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u32` | note: required by `Foo` - --> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:13:1 + --> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:3:1 | LL | struct Foo { | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `f32: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:26:1 + --> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:16:1 | LL | fn kaboom(y: Bar) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `f32` | note: required by `Bar` - --> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:17:1 + --> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:7:1 | LL | enum Bar { | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.rs index 77abe6f7f74..d379499521c 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.rs +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait {} struct Foo { diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.stderr index 6f917706873..15441b583ce 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.stderr +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `u16: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums-in-impls.rs:30:6 + --> $DIR/trait-bounds-on-structs-and-enums-in-impls.rs:20:6 | LL | impl PolyTrait> for Struct { | ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u16` | note: required by `Foo` - --> $DIR/trait-bounds-on-structs-and-enums-in-impls.rs:13:1 + --> $DIR/trait-bounds-on-structs-and-enums-in-impls.rs:3:1 | LL | struct Foo { | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.rs index 9e680d17fb9..21c0ce80f8a 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.rs +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait { fn dummy(&self) { } } diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.stderr index cdaa12428ae..cdcfff97bd0 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.stderr +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.stderr @@ -1,23 +1,23 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums-locals.rs:25:14 + --> $DIR/trait-bounds-on-structs-and-enums-locals.rs:15:14 | LL | let baz: Foo = loop { }; | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` | note: required by `Foo` - --> $DIR/trait-bounds-on-structs-and-enums-locals.rs:15:1 + --> $DIR/trait-bounds-on-structs-and-enums-locals.rs:5:1 | LL | struct Foo { | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `{integer}: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums-locals.rs:20:15 + --> $DIR/trait-bounds-on-structs-and-enums-locals.rs:10:15 | LL | let foo = Foo { | ^^^ the trait `Trait` is not implemented for `{integer}` | note: required by `Foo` - --> $DIR/trait-bounds-on-structs-and-enums-locals.rs:15:1 + --> $DIR/trait-bounds-on-structs-and-enums-locals.rs:5:1 | LL | struct Foo { | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-static.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums-static.rs index 2b59fdcae35..df3f8b8a599 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums-static.rs +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-static.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait { fn dummy(&self) { } } diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-static.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums-static.stderr index 5145ba1881d..b019c297920 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums-static.stderr +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-static.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `usize: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums-static.rs:19:11 + --> $DIR/trait-bounds-on-structs-and-enums-static.rs:9:11 | LL | static X: Foo = Foo { | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` | note: required by `Foo` - --> $DIR/trait-bounds-on-structs-and-enums-static.rs:15:1 + --> $DIR/trait-bounds-on-structs-and-enums-static.rs:5:1 | LL | struct Foo { | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.rs index 975de00d02a..901a2c4391f 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.rs +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:trait_bounds_on_structs_and_enums_xc.rs extern crate trait_bounds_on_structs_and_enums_xc; diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.stderr index b798ccfc7a4..2f2c903a45c 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.stderr +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `usize: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums-xc.rs:17:1 + --> $DIR/trait-bounds-on-structs-and-enums-xc.rs:7:1 | LL | fn explode(x: Foo) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `usize` @@ -7,7 +7,7 @@ LL | fn explode(x: Foo) {} = note: required by `trait_bounds_on_structs_and_enums_xc::Foo` error[E0277]: the trait bound `f32: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums-xc.rs:20:1 + --> $DIR/trait-bounds-on-structs-and-enums-xc.rs:10:1 | LL | fn kaboom(y: Bar) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `f32` diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.rs index 515684bcf42..2a4ba9677ef 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.rs +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:trait_bounds_on_structs_and_enums_xc.rs extern crate trait_bounds_on_structs_and_enums_xc; diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.stderr index 0b0bd4f6ab1..57db65df5f3 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.stderr +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `f64: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums-xc1.rs:22:14 + --> $DIR/trait-bounds-on-structs-and-enums-xc1.rs:12:14 | LL | let bar: Bar = return; | ^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `f64` @@ -7,7 +7,7 @@ LL | let bar: Bar = return; = note: required by `trait_bounds_on_structs_and_enums_xc::Bar` error[E0277]: the trait bound `{integer}: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums-xc1.rs:18:15 + --> $DIR/trait-bounds-on-structs-and-enums-xc1.rs:8:15 | LL | let foo = Foo { | ^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `{integer}` diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums.rs index 24e2418e8d4..024084fa724 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums.rs +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait {} struct Foo { diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr index 5686e62c8b9..5429029c1ec 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr @@ -1,86 +1,86 @@ error[E0277]: the trait bound `T: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums.rs:23:9 + --> $DIR/trait-bounds-on-structs-and-enums.rs:13:9 | LL | impl Foo { | ^^^^^^ the trait `Trait` is not implemented for `T` | = help: consider adding a `where T: Trait` bound note: required by `Foo` - --> $DIR/trait-bounds-on-structs-and-enums.rs:13:1 + --> $DIR/trait-bounds-on-structs-and-enums.rs:3:1 | LL | struct Foo { | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `isize: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums.rs:29:5 + --> $DIR/trait-bounds-on-structs-and-enums.rs:19:5 | LL | a: Foo, //~ ERROR E0277 | ^^^^^^^^^^^^^ the trait `Trait` is not implemented for `isize` | note: required by `Foo` - --> $DIR/trait-bounds-on-structs-and-enums.rs:13:1 + --> $DIR/trait-bounds-on-structs-and-enums.rs:3:1 | LL | struct Foo { | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `usize: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums.rs:33:10 + --> $DIR/trait-bounds-on-structs-and-enums.rs:23:10 | LL | Quux(Bar), //~ ERROR E0277 | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` | note: required by `Bar` - --> $DIR/trait-bounds-on-structs-and-enums.rs:17:1 + --> $DIR/trait-bounds-on-structs-and-enums.rs:7:1 | LL | enum Bar { | ^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `U: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums.rs:37:5 + --> $DIR/trait-bounds-on-structs-and-enums.rs:27:5 | LL | b: Foo, //~ ERROR E0277 | ^^^^^^^^^ the trait `Trait` is not implemented for `U` | = help: consider adding a `where U: Trait` bound note: required by `Foo` - --> $DIR/trait-bounds-on-structs-and-enums.rs:13:1 + --> $DIR/trait-bounds-on-structs-and-enums.rs:3:1 | LL | struct Foo { | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `V: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums.rs:41:21 + --> $DIR/trait-bounds-on-structs-and-enums.rs:31:21 | LL | EvenMoreBadness(Bar), //~ ERROR E0277 | ^^^^^^ the trait `Trait` is not implemented for `V` | = help: consider adding a `where V: Trait` bound note: required by `Bar` - --> $DIR/trait-bounds-on-structs-and-enums.rs:17:1 + --> $DIR/trait-bounds-on-structs-and-enums.rs:7:1 | LL | enum Bar { | ^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `i32: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums.rs:45:5 + --> $DIR/trait-bounds-on-structs-and-enums.rs:35:5 | LL | Foo, //~ ERROR E0277 | ^^^^^^^^ the trait `Trait` is not implemented for `i32` | note: required by `Foo` - --> $DIR/trait-bounds-on-structs-and-enums.rs:13:1 + --> $DIR/trait-bounds-on-structs-and-enums.rs:3:1 | LL | struct Foo { | ^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `u8: Trait` is not satisfied - --> $DIR/trait-bounds-on-structs-and-enums.rs:49:22 + --> $DIR/trait-bounds-on-structs-and-enums.rs:39:22 | LL | DictionaryLike { field: Bar }, //~ ERROR E0277 | ^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u8` | note: required by `Bar` - --> $DIR/trait-bounds-on-structs-and-enums.rs:17:1 + --> $DIR/trait-bounds-on-structs-and-enums.rs:7:1 | LL | enum Bar { | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/trait-bounds-sugar.rs b/src/test/ui/traits/trait-bounds-sugar.rs index 0a36fcbed69..0892153c0cf 100644 --- a/src/test/ui/traits/trait-bounds-sugar.rs +++ b/src/test/ui/traits/trait-bounds-sugar.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests for "default" bounds inferred for traits with no bounds list. trait Foo {} diff --git a/src/test/ui/traits/trait-bounds-sugar.stderr b/src/test/ui/traits/trait-bounds-sugar.stderr index bd899e06545..eb45a16afb1 100644 --- a/src/test/ui/traits/trait-bounds-sugar.stderr +++ b/src/test/ui/traits/trait-bounds-sugar.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/trait-bounds-sugar.rs:22:7 + --> $DIR/trait-bounds-sugar.rs:12:7 | LL | a(x); //~ ERROR mismatched types | ^ expected trait `Foo + std::marker::Send`, found trait `Foo + std::marker::Sync` diff --git a/src/test/ui/traits/trait-coercion-generic-bad.rs b/src/test/ui/traits/trait-coercion-generic-bad.rs index 3839e90ed9f..5aa21834148 100644 --- a/src/test/ui/traits/trait-coercion-generic-bad.rs +++ b/src/test/ui/traits/trait-coercion-generic-bad.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Struct { person: &'static str } diff --git a/src/test/ui/traits/trait-coercion-generic-bad.stderr b/src/test/ui/traits/trait-coercion-generic-bad.stderr index a186877e57b..7f3b46b8ae5 100644 --- a/src/test/ui/traits/trait-coercion-generic-bad.stderr +++ b/src/test/ui/traits/trait-coercion-generic-bad.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Struct: Trait` is not satisfied - --> $DIR/trait-coercion-generic-bad.rs:26:32 + --> $DIR/trait-coercion-generic-bad.rs:16:32 | LL | let s: Box> = Box::new(Struct { person: "Fred" }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `Struct` diff --git a/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr b/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr index a5b126f60ec..6092a9dc10d 100644 --- a/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr +++ b/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `person` does not live long enough - --> $DIR/trait-coercion-generic-regions.rs:27:24 + --> $DIR/trait-coercion-generic-regions.rs:17:24 | LL | let person: &str = &person; //~ ERROR `person` does not live long enough | ^^^^^^^ diff --git a/src/test/ui/traits/trait-coercion-generic-regions.rs b/src/test/ui/traits/trait-coercion-generic-regions.rs index 18d3ded77f8..148b7dd5c43 100644 --- a/src/test/ui/traits/trait-coercion-generic-regions.rs +++ b/src/test/ui/traits/trait-coercion-generic-regions.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Struct { person: &'static str } diff --git a/src/test/ui/traits/trait-coercion-generic-regions.stderr b/src/test/ui/traits/trait-coercion-generic-regions.stderr index 8eaf7e9c1ef..23c2a72743e 100644 --- a/src/test/ui/traits/trait-coercion-generic-regions.stderr +++ b/src/test/ui/traits/trait-coercion-generic-regions.stderr @@ -1,5 +1,5 @@ error[E0597]: `person` does not live long enough - --> $DIR/trait-coercion-generic-regions.rs:27:25 + --> $DIR/trait-coercion-generic-regions.rs:17:25 | LL | let person: &str = &person; //~ ERROR `person` does not live long enough | ^^^^^^ borrowed value does not live long enough diff --git a/src/test/ui/traits/trait-duplicate-methods.rs b/src/test/ui/traits/trait-duplicate-methods.rs index d35caa40a2d..1f9bdf56f10 100644 --- a/src/test/ui/traits/trait-duplicate-methods.rs +++ b/src/test/ui/traits/trait-duplicate-methods.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn orange(&self); fn orange(&self); //~ ERROR the name `orange` is defined multiple times diff --git a/src/test/ui/traits/trait-duplicate-methods.stderr b/src/test/ui/traits/trait-duplicate-methods.stderr index 1dfddd937ca..bb6d0b6d7f1 100644 --- a/src/test/ui/traits/trait-duplicate-methods.stderr +++ b/src/test/ui/traits/trait-duplicate-methods.stderr @@ -1,5 +1,5 @@ error[E0428]: the name `orange` is defined multiple times - --> $DIR/trait-duplicate-methods.rs:13:5 + --> $DIR/trait-duplicate-methods.rs:3:5 | LL | fn orange(&self); | ----------------- previous definition of the value `orange` here diff --git a/src/test/ui/traits/trait-impl-1.rs b/src/test/ui/traits/trait-impl-1.rs index e682d3c81e7..29f58a6a9cb 100644 --- a/src/test/ui/traits/trait-impl-1.rs +++ b/src/test/ui/traits/trait-impl-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test calling methods on an impl for a bare trait. This test checks that the // trait impl is only applied to a trait object, not concrete types which implement // the trait. diff --git a/src/test/ui/traits/trait-impl-1.stderr b/src/test/ui/traits/trait-impl-1.stderr index b8033900505..8ee642974b7 100644 --- a/src/test/ui/traits/trait-impl-1.stderr +++ b/src/test/ui/traits/trait-impl-1.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `foo` found for type `&i32` in the current scope - --> $DIR/trait-impl-1.rs:25:7 + --> $DIR/trait-impl-1.rs:15:7 | LL | x.foo(); //~ERROR: no method named `foo` found for type `&i32` in the current scope | ^^^ diff --git a/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.rs b/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.rs index cc143a6209d..0c885447bb0 100644 --- a/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.rs +++ b/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait A { } impl A for isize { diff --git a/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr b/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr index e23225bc124..5a50a110863 100644 --- a/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr +++ b/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr @@ -1,17 +1,17 @@ error[E0438]: const `BAR` is not a member of trait `A` - --> $DIR/trait-impl-can-not-have-untraitful-items.rs:15:5 + --> $DIR/trait-impl-can-not-have-untraitful-items.rs:4:5 | LL | const BAR: () = (); //~ ERROR const `BAR` is not a member of trait `A` | ^^^^^^^^^^^^^^^^^^^ not a member of trait `A` error[E0437]: type `Baz` is not a member of trait `A` - --> $DIR/trait-impl-can-not-have-untraitful-items.rs:16:5 + --> $DIR/trait-impl-can-not-have-untraitful-items.rs:5:5 | LL | type Baz = (); //~ ERROR type `Baz` is not a member of trait `A` | ^^^^^^^^^^^^^^ not a member of trait `A` error[E0407]: method `foo` is not a member of trait `A` - --> $DIR/trait-impl-can-not-have-untraitful-items.rs:17:5 + --> $DIR/trait-impl-can-not-have-untraitful-items.rs:6:5 | LL | fn foo(&self) { } //~ ERROR method `foo` is not a member of trait `A` | ^^^^^^^^^^^^^^^^^ not a member of trait `A` diff --git a/src/test/ui/traits/trait-impl-different-num-params.rs b/src/test/ui/traits/trait-impl-different-num-params.rs index 647dd4e05fa..53400622d7c 100644 --- a/src/test/ui/traits/trait-impl-different-num-params.rs +++ b/src/test/ui/traits/trait-impl-different-num-params.rs @@ -1,19 +1,9 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait foo { +trait Foo { fn bar(&self, x: usize) -> Self; } -impl foo for isize { +impl Foo for isize { fn bar(&self) -> isize { - //~^ ERROR method `bar` has 1 parameter but the declaration in trait `foo::bar` has 2 + //~^ ERROR method `bar` has 1 parameter but the declaration in trait `Foo::bar` has 2 *self } } diff --git a/src/test/ui/traits/trait-impl-different-num-params.stderr b/src/test/ui/traits/trait-impl-different-num-params.stderr index c3bbf99b06a..5ab93614f24 100644 --- a/src/test/ui/traits/trait-impl-different-num-params.stderr +++ b/src/test/ui/traits/trait-impl-different-num-params.stderr @@ -1,8 +1,8 @@ -error[E0050]: method `bar` has 1 parameter but the declaration in trait `foo::bar` has 2 - --> $DIR/trait-impl-different-num-params.rs:15:12 +error[E0050]: method `bar` has 1 parameter but the declaration in trait `Foo::bar` has 2 + --> $DIR/trait-impl-different-num-params.rs:5:12 | LL | fn bar(&self, x: usize) -> Self; - | ----- trait requires 2 parameters + | --------------- trait requires 2 parameters ... LL | fn bar(&self) -> isize { | ^^^^^ expected 2 parameters, found 1 diff --git a/src/test/ui/traits/trait-impl-for-module.rs b/src/test/ui/traits/trait-impl-for-module.rs index 1fe8f6294da..9004627c523 100644 --- a/src/test/ui/traits/trait-impl-for-module.rs +++ b/src/test/ui/traits/trait-impl-for-module.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { } diff --git a/src/test/ui/traits/trait-impl-for-module.stderr b/src/test/ui/traits/trait-impl-for-module.stderr index 62ae84da99e..99da4b7c87a 100644 --- a/src/test/ui/traits/trait-impl-for-module.stderr +++ b/src/test/ui/traits/trait-impl-for-module.stderr @@ -1,8 +1,8 @@ error[E0573]: expected type, found module `a` - --> $DIR/trait-impl-for-module.rs:17:12 + --> $DIR/trait-impl-for-module.rs:7:12 | LL | impl A for a { //~ ERROR expected type, found module - | ^ did you mean `A`? + | ^ help: a trait with a similar name exists: `A` error: aborting due to previous error diff --git a/src/test/ui/traits/trait-impl-method-mismatch.rs b/src/test/ui/traits/trait-impl-method-mismatch.rs index a05e007d6b7..886e92604a0 100644 --- a/src/test/ui/traits/trait-impl-method-mismatch.rs +++ b/src/test/ui/traits/trait-impl-method-mismatch.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - trait Mumbo { fn jumbo(&self, x: &usize) -> usize; } diff --git a/src/test/ui/traits/trait-impl-method-mismatch.stderr b/src/test/ui/traits/trait-impl-method-mismatch.stderr index 526a37f7651..3e86c97f5c1 100644 --- a/src/test/ui/traits/trait-impl-method-mismatch.stderr +++ b/src/test/ui/traits/trait-impl-method-mismatch.stderr @@ -1,5 +1,5 @@ error[E0053]: method `jumbo` has an incompatible type for trait - --> $DIR/trait-impl-method-mismatch.rs:18:5 + --> $DIR/trait-impl-method-mismatch.rs:7:5 | LL | fn jumbo(&self, x: &usize) -> usize; | ------------------------------------ type in trait diff --git a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs index 44c53e70f86..05b9db9724b 100644 --- a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs +++ b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that when we test the supertrait we ensure consistent use of // lifetime parameters. In this case, implementing T2<'a,'b> requires // an impl of T1<'a>, but we have an impl of T1<'b>. diff --git a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr index 6a97a4eccbb..95dc6364e13 100644 --- a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr +++ b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr @@ -1,16 +1,16 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements - --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:34:13 + --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:13 | LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { //~ ERROR cannot infer an appropriate lifetime | ^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 34:6... - --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:34:6 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 24:6... + --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:6 | LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { //~ ERROR cannot infer an appropriate lifetime | ^^ -note: ...but the lifetime must also be valid for the lifetime 'b as defined on the impl at 34:9... - --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:34:9 +note: ...but the lifetime must also be valid for the lifetime 'b as defined on the impl at 24:9... + --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:9 | LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { //~ ERROR cannot infer an appropriate lifetime | ^^ diff --git a/src/test/ui/traits/trait-item-privacy.rs b/src/test/ui/traits/trait-item-privacy.rs index 1db5ec09737..dfc8c8f4f6c 100644 --- a/src/test/ui/traits/trait-item-privacy.rs +++ b/src/test/ui/traits/trait-item-privacy.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_type_defaults)] struct S; diff --git a/src/test/ui/traits/trait-item-privacy.stderr b/src/test/ui/traits/trait-item-privacy.stderr index 4ede83d5d73..c65a9a3ed94 100644 --- a/src/test/ui/traits/trait-item-privacy.stderr +++ b/src/test/ui/traits/trait-item-privacy.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `a` found for type `S` in the current scope - --> $DIR/trait-item-privacy.rs:77:7 + --> $DIR/trait-item-privacy.rs:67:7 | LL | struct S; | --------- method `a` not found for this @@ -12,7 +12,7 @@ LL | S.a(); //~ ERROR no method named `a` found for type `S` in the current candidate #1: `method::A` error[E0599]: no method named `b` found for type `S` in the current scope - --> $DIR/trait-item-privacy.rs:78:7 + --> $DIR/trait-item-privacy.rs:68:7 | LL | struct S; | --------- method `b` not found for this @@ -27,32 +27,36 @@ LL | use method::B; | error[E0624]: method `a` is private - --> $DIR/trait-item-privacy.rs:82:7 + --> $DIR/trait-item-privacy.rs:72:7 | LL | c.a(); //~ ERROR method `a` is private | ^ error[E0599]: no function or associated item named `a` found for type `S` in the current scope - --> $DIR/trait-item-privacy.rs:88:5 + --> $DIR/trait-item-privacy.rs:78:8 | LL | struct S; | --------- function or associated item `a` not found for this ... LL | S::a(&S); - | ^^^^ function or associated item not found in `S` + | ---^ + | | + | function or associated item not found in `S` | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `a`, perhaps you need to implement it: candidate #1: `method::A` error[E0599]: no function or associated item named `b` found for type `S` in the current scope - --> $DIR/trait-item-privacy.rs:90:5 + --> $DIR/trait-item-privacy.rs:80:8 | LL | struct S; | --------- function or associated item `b` not found for this ... LL | S::b(&S); - | ^^^^ function or associated item not found in `S` + | ---^ + | | + | function or associated item not found in `S` | = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope, perhaps add a `use` for it: @@ -61,32 +65,36 @@ LL | use method::B; | error[E0624]: method `a` is private - --> $DIR/trait-item-privacy.rs:94:5 + --> $DIR/trait-item-privacy.rs:84:5 | LL | C::a(&S); //~ ERROR method `a` is private | ^^^^ error[E0599]: no associated item named `A` found for type `S` in the current scope - --> $DIR/trait-item-privacy.rs:107:5 + --> $DIR/trait-item-privacy.rs:97:8 | LL | struct S; | --------- associated item `A` not found for this ... LL | S::A; //~ ERROR no associated item named `A` found for type `S` in the current scope - | ^^^^ associated item not found in `S` + | ---^ + | | + | associated item not found in `S` | = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `A`, perhaps you need to implement it: candidate #1: `assoc_const::A` error[E0599]: no associated item named `B` found for type `S` in the current scope - --> $DIR/trait-item-privacy.rs:108:5 + --> $DIR/trait-item-privacy.rs:98:8 | LL | struct S; | --------- associated item `B` not found for this ... LL | S::B; //~ ERROR no associated item named `B` found for type `S` in the current scope - | ^^^^ associated item not found in `S` + | ---^ + | | + | associated item not found in `S` | = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope, perhaps add a `use` for it: @@ -95,13 +103,13 @@ LL | use assoc_const::B; | error[E0624]: associated constant `A` is private - --> $DIR/trait-item-privacy.rs:111:5 + --> $DIR/trait-item-privacy.rs:101:5 | LL | C::A; //~ ERROR associated constant `A` is private | ^^^^ error[E0038]: the trait `assoc_const::C` cannot be made into an object - --> $DIR/trait-item-privacy.rs:111:5 + --> $DIR/trait-item-privacy.rs:101:5 | LL | C::A; //~ ERROR associated constant `A` is private | ^^^^ the trait `assoc_const::C` cannot be made into an object @@ -111,31 +119,31 @@ LL | C::A; //~ ERROR associated constant `A` is private = note: the trait cannot contain associated consts like `A` error[E0223]: ambiguous associated type - --> $DIR/trait-item-privacy.rs:125:12 + --> $DIR/trait-item-privacy.rs:115:12 | LL | let _: S::A; //~ ERROR ambiguous associated type | ^^^^ help: use fully-qualified syntax: `::A` error[E0223]: ambiguous associated type - --> $DIR/trait-item-privacy.rs:126:12 + --> $DIR/trait-item-privacy.rs:116:12 | LL | let _: S::B; //~ ERROR ambiguous associated type | ^^^^ help: use fully-qualified syntax: `::B` error[E0223]: ambiguous associated type - --> $DIR/trait-item-privacy.rs:127:12 + --> $DIR/trait-item-privacy.rs:117:12 | LL | let _: S::C; //~ ERROR ambiguous associated type | ^^^^ help: use fully-qualified syntax: `::C` error: associated type `A` is private - --> $DIR/trait-item-privacy.rs:129:12 + --> $DIR/trait-item-privacy.rs:119:12 | LL | let _: T::A; //~ ERROR associated type `A` is private | ^^^^ error: associated type `A` is private - --> $DIR/trait-item-privacy.rs:138:9 + --> $DIR/trait-item-privacy.rs:128:9 | LL | A = u8, //~ ERROR associated type `A` is private | ^^^^^^ diff --git a/src/test/ui/traits/trait-matching-lifetimes.rs b/src/test/ui/traits/trait-matching-lifetimes.rs index 5ab80065572..1430dc65591 100644 --- a/src/test/ui/traits/trait-matching-lifetimes.rs +++ b/src/test/ui/traits/trait-matching-lifetimes.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that the trait matching code takes lifetime parameters into account. // (Issue #15517.) diff --git a/src/test/ui/traits/trait-matching-lifetimes.stderr b/src/test/ui/traits/trait-matching-lifetimes.stderr index 8f27947ff2a..80c577674d1 100644 --- a/src/test/ui/traits/trait-matching-lifetimes.stderr +++ b/src/test/ui/traits/trait-matching-lifetimes.stderr @@ -1,37 +1,37 @@ error[E0308]: method not compatible with trait - --> $DIR/trait-matching-lifetimes.rs:24:5 + --> $DIR/trait-matching-lifetimes.rs:14:5 | LL | fn foo(x: Foo<'b,'a>) { | ^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `fn(Foo<'a, 'b>)` found type `fn(Foo<'b, 'a>)` -note: the lifetime 'b as defined on the impl at 23:9... - --> $DIR/trait-matching-lifetimes.rs:23:9 +note: the lifetime 'b as defined on the impl at 13:9... + --> $DIR/trait-matching-lifetimes.rs:13:9 | LL | impl<'a,'b> Tr for Foo<'a,'b> { | ^^ -note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 23:6 - --> $DIR/trait-matching-lifetimes.rs:23:6 +note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 13:6 + --> $DIR/trait-matching-lifetimes.rs:13:6 | LL | impl<'a,'b> Tr for Foo<'a,'b> { | ^^ error[E0308]: method not compatible with trait - --> $DIR/trait-matching-lifetimes.rs:24:5 + --> $DIR/trait-matching-lifetimes.rs:14:5 | LL | fn foo(x: Foo<'b,'a>) { | ^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `fn(Foo<'a, 'b>)` found type `fn(Foo<'b, 'a>)` -note: the lifetime 'a as defined on the impl at 23:6... - --> $DIR/trait-matching-lifetimes.rs:23:6 +note: the lifetime 'a as defined on the impl at 13:6... + --> $DIR/trait-matching-lifetimes.rs:13:6 | LL | impl<'a,'b> Tr for Foo<'a,'b> { | ^^ -note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 23:9 - --> $DIR/trait-matching-lifetimes.rs:23:9 +note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 13:9 + --> $DIR/trait-matching-lifetimes.rs:13:9 | LL | impl<'a,'b> Tr for Foo<'a,'b> { | ^^ diff --git a/src/test/ui/traits/trait-method-private.rs b/src/test/ui/traits/trait-method-private.rs index 54cf6e6783e..4cd184854ec 100644 --- a/src/test/ui/traits/trait-method-private.rs +++ b/src/test/ui/traits/trait-method-private.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod inner { pub trait Bar { fn method(&self); diff --git a/src/test/ui/traits/trait-method-private.stderr b/src/test/ui/traits/trait-method-private.stderr index 3a625ae25a4..ed6aeeb9c89 100644 --- a/src/test/ui/traits/trait-method-private.stderr +++ b/src/test/ui/traits/trait-method-private.stderr @@ -1,5 +1,5 @@ error[E0624]: method `method` is private - --> $DIR/trait-method-private.rs:29:9 + --> $DIR/trait-method-private.rs:19:9 | LL | foo.method(); //~ ERROR is private | ^^^^^^ diff --git a/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs b/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs index d3e4627a4c9..6ba5d28a6c4 100644 --- a/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs +++ b/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks to make sure that `dyn Trait + Send` and `dyn Trait + Send + Send` are the same type. // Issue: #47010 diff --git a/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr b/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr index 9abd81cdcfa..2d2c3843548 100644 --- a/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr +++ b/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr @@ -1,5 +1,5 @@ error[E0592]: duplicate definitions with name `test` - --> $DIR/trait-object-auto-dedup-in-impl.rs:24:5 + --> $DIR/trait-object-auto-dedup-in-impl.rs:14:5 | LL | fn test(&self) { println!("one"); } //~ ERROR duplicate definitions with name `test` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `test` diff --git a/src/test/ui/traits/trait-object-macro-matcher.rs b/src/test/ui/traits/trait-object-macro-matcher.rs index 8497a699e97..0f55e2dc4f2 100644 --- a/src/test/ui/traits/trait-object-macro-matcher.rs +++ b/src/test/ui/traits/trait-object-macro-matcher.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // `ty` matcher accepts trait object types macro_rules! m { diff --git a/src/test/ui/traits/trait-object-macro-matcher.stderr b/src/test/ui/traits/trait-object-macro-matcher.stderr index 05511b554cc..678f4fb5955 100644 --- a/src/test/ui/traits/trait-object-macro-matcher.stderr +++ b/src/test/ui/traits/trait-object-macro-matcher.stderr @@ -1,11 +1,11 @@ error[E0224]: at least one non-builtin trait is required for an object type - --> $DIR/trait-object-macro-matcher.rs:20:8 + --> $DIR/trait-object-macro-matcher.rs:10:8 | LL | m!('static +); //~ ERROR at least one non-builtin trait is required for an object type | ^^^^^^^^^ error[E0038]: the trait `std::marker::Copy` cannot be made into an object - --> $DIR/trait-object-macro-matcher.rs:18:8 + --> $DIR/trait-object-macro-matcher.rs:8:8 | LL | m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object | ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object diff --git a/src/test/ui/traits/trait-object-safety.rs b/src/test/ui/traits/trait-object-safety.rs index baf239f5956..e333bf6bfe5 100644 --- a/src/test/ui/traits/trait-object-safety.rs +++ b/src/test/ui/traits/trait-object-safety.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that static methods are not object-safe. trait Tr { diff --git a/src/test/ui/traits/trait-object-safety.stderr b/src/test/ui/traits/trait-object-safety.stderr index be0440db4da..0a0c5ff086b 100644 --- a/src/test/ui/traits/trait-object-safety.stderr +++ b/src/test/ui/traits/trait-object-safety.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `Tr` cannot be made into an object - --> $DIR/trait-object-safety.rs:25:18 + --> $DIR/trait-object-safety.rs:15:18 | LL | let _: &Tr = &St; //~ ERROR E0038 | ^^^ the trait `Tr` cannot be made into an object @@ -8,7 +8,7 @@ LL | let _: &Tr = &St; //~ ERROR E0038 = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Tr>` for `&St` error[E0038]: the trait `Tr` cannot be made into an object - --> $DIR/trait-object-safety.rs:25:12 + --> $DIR/trait-object-safety.rs:15:12 | LL | let _: &Tr = &St; //~ ERROR E0038 | ^^^ the trait `Tr` cannot be made into an object diff --git a/src/test/ui/traits/trait-object-vs-lifetime-2.rs b/src/test/ui/traits/trait-object-vs-lifetime-2.rs index 9801cac4714..2579a0056f1 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime-2.rs +++ b/src/test/ui/traits/trait-object-vs-lifetime-2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A few contrived examples where lifetime should (or should not) be parsed as an object type. // Lifetimes parsed as types are still rejected later by semantic checks. diff --git a/src/test/ui/traits/trait-object-vs-lifetime-2.stderr b/src/test/ui/traits/trait-object-vs-lifetime-2.stderr index db38aca2383..70ad839b9af 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime-2.stderr +++ b/src/test/ui/traits/trait-object-vs-lifetime-2.stderr @@ -1,5 +1,5 @@ error[E0224]: at least one non-builtin trait is required for an object type - --> $DIR/trait-object-vs-lifetime-2.rs:19:5 + --> $DIR/trait-object-vs-lifetime-2.rs:9:5 | LL | 'static +: 'static + Copy, | ^^^^^^^^^ diff --git a/src/test/ui/traits/trait-object-vs-lifetime.rs b/src/test/ui/traits/trait-object-vs-lifetime.rs index 954e20e3345..a12429c868e 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime.rs +++ b/src/test/ui/traits/trait-object-vs-lifetime.rs @@ -1,18 +1,6 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A few contrived examples where lifetime should (or should not) be parsed as an object type. // Lifetimes parsed as types are still rejected later by semantic checks. -// compile-flags: -Z continue-parse-after-error - struct S<'a, T>(&'a u8, T); fn main() { diff --git a/src/test/ui/traits/trait-object-vs-lifetime.stderr b/src/test/ui/traits/trait-object-vs-lifetime.stderr index 33ddb4c0ec3..4cc96bae5cd 100644 --- a/src/test/ui/traits/trait-object-vs-lifetime.stderr +++ b/src/test/ui/traits/trait-object-vs-lifetime.stderr @@ -1,29 +1,33 @@ error: lifetime parameters must be declared prior to type parameters - --> $DIR/trait-object-vs-lifetime.rs:26:25 + --> $DIR/trait-object-vs-lifetime.rs:14:25 | LL | let _: S<'static +, 'static>; - | ^^^^^^^ + | ^^^^^^^ must be declared prior to type parameters +help: move the lifetime parameter prior to the first type parameter + | +LL | let _: S<'static, 'static +>; + | ^^^^^^^^ -- error[E0224]: at least one non-builtin trait is required for an object type - --> $DIR/trait-object-vs-lifetime.rs:21:23 + --> $DIR/trait-object-vs-lifetime.rs:9:23 | LL | let _: S<'static, 'static +>; | ^^^^^^^^^ error[E0107]: wrong number of lifetime arguments: expected 1, found 2 - --> $DIR/trait-object-vs-lifetime.rs:23:23 + --> $DIR/trait-object-vs-lifetime.rs:11:23 | LL | let _: S<'static, 'static>; | ^^^^^^^ unexpected lifetime argument error[E0107]: wrong number of type arguments: expected 1, found 0 - --> $DIR/trait-object-vs-lifetime.rs:23:12 + --> $DIR/trait-object-vs-lifetime.rs:11:12 | LL | let _: S<'static, 'static>; | ^^^^^^^^^^^^^^^^^^^ expected 1 type argument error[E0224]: at least one non-builtin trait is required for an object type - --> $DIR/trait-object-vs-lifetime.rs:26:14 + --> $DIR/trait-object-vs-lifetime.rs:14:14 | LL | let _: S<'static +, 'static>; | ^^^^^^^^^ diff --git a/src/test/ui/traits/trait-object-with-self-in-projection-output-bad.rs b/src/test/ui/traits/trait-object-with-self-in-projection-output-bad.rs new file mode 100644 index 00000000000..766bd147431 --- /dev/null +++ b/src/test/ui/traits/trait-object-with-self-in-projection-output-bad.rs @@ -0,0 +1,50 @@ +// Regression test for #56288. Checks that if a supertrait defines an associated type +// projection that references `Self`, then that associated type must still be explicitly +// specified in the `dyn Trait` variant, since we don't know what `Self` is anymore. + +trait Base { + type Output; +} + +trait Helper: Base::Target> { + type Target; +} + +impl Base for u32 +{ + type Output = i32; +} + +impl Helper for u32 +{ + type Target = i32; +} + +trait ConstI32 { + type Out; +} + +impl ConstI32 for T { + type Out = i32; +} + +// Test that you still need to manually give a projection type if the Output type +// is normalizable. +trait NormalizableHelper: + Base::Out> +{ + type Target; +} + +impl NormalizableHelper for u32 +{ + type Target = i32; +} + +fn main() { + let _x: Box> = Box::new(2u32); + //~^ ERROR the value of the associated type `Output` (from the trait `Base`) must be specified + + let _y: Box> = Box::new(2u32); + //~^ ERROR the value of the associated type `Output` (from the trait `Base`) must be specified +} diff --git a/src/test/ui/traits/trait-object-with-self-in-projection-output-bad.stderr b/src/test/ui/traits/trait-object-with-self-in-projection-output-bad.stderr new file mode 100644 index 00000000000..350f8ea8507 --- /dev/null +++ b/src/test/ui/traits/trait-object-with-self-in-projection-output-bad.stderr @@ -0,0 +1,21 @@ +error[E0191]: the value of the associated type `Output` (from the trait `Base`) must be specified + --> $DIR/trait-object-with-self-in-projection-output-bad.rs:45:17 + | +LL | type Output; + | ------------ `Output` defined here +... +LL | let _x: Box> = Box::new(2u32); + | ^^^^^^^^^^^^^^^^^^^^^^ associated type `Output` must be specified + +error[E0191]: the value of the associated type `Output` (from the trait `Base`) must be specified + --> $DIR/trait-object-with-self-in-projection-output-bad.rs:48:17 + | +LL | type Output; + | ------------ `Output` defined here +... +LL | let _y: Box> = Box::new(2u32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ associated type `Output` must be specified + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0191`. diff --git a/src/test/ui/traits/trait-object-with-self-in-projection-output-good.rs b/src/test/ui/traits/trait-object-with-self-in-projection-output-good.rs new file mode 100644 index 00000000000..793d556d08c --- /dev/null +++ b/src/test/ui/traits/trait-object-with-self-in-projection-output-good.rs @@ -0,0 +1,28 @@ +// compile-pass + +// Regression test related to #56288. Check that a supertrait projection (of +// `Output`) that references `Self` can be ok if it is referencing a projection (of +// `Self::Target`, in this case). Note that we still require the user to manually +// specify both `Target` and `Output` for now. + +trait Base { + type Output; +} + +trait Helper: Base::Target> { + type Target; +} + +impl Base for u32 +{ + type Output = i32; +} + +impl Helper for u32 +{ + type Target = i32; +} + +fn main() { + let _x: Box> = Box::new(2u32); +} diff --git a/src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs b/src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs new file mode 100644 index 00000000000..46c083f9305 --- /dev/null +++ b/src/test/ui/traits/trait-object-with-self-in-projection-output-repeated-supertrait.rs @@ -0,0 +1,48 @@ +// compile-pass + +// Regression test related to #56288. Check that a supertrait projection (of +// `Output`) that references `Self` is ok if there is another occurence of +// the same supertrait that specifies the projection explicitly, even if +// the projection's associated type is not explicitly specified in the object type. +// +// Note that in order for this to compile, we need the `Self`-referencing projection +// to normalize fairly directly to a concrete type, otherwise the trait resolver +// will hate us. +// +// There is a test in `trait-object-with-self-in-projection-output-bad.rs` that +// having a normalizing, but `Self`-containing projection does not *by itself* +// allow you to avoid writing the projected type (`Output`, in this example) +// explicitly. + +trait ConstI32 { + type Out; +} + +impl ConstI32 for T { + type Out = i32; +} + +trait Base { + type Output; +} + +trait NormalizingHelper: Base::Out> + Base { + type Target; +} + +impl Base for u32 +{ + type Output = i32; +} + +impl NormalizingHelper for u32 +{ + type Target = i32; +} + +fn main() { + // Make sure this works both with and without the associated type + // being specified. + let _x: Box> = Box::new(2u32); + let _y: Box> = Box::new(2u32); +} diff --git a/src/test/ui/traits/trait-or-new-type-instead.rs b/src/test/ui/traits/trait-or-new-type-instead.rs index b1e4d06affe..572b03efce7 100644 --- a/src/test/ui/traits/trait-or-new-type-instead.rs +++ b/src/test/ui/traits/trait-or-new-type-instead.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - impl Option { //~^ ERROR cannot define inherent `impl` for a type outside of the crate where the type is defined pub fn foo(&self) { } diff --git a/src/test/ui/traits/trait-or-new-type-instead.stderr b/src/test/ui/traits/trait-or-new-type-instead.stderr index 1b4d173c312..e8bd20019a8 100644 --- a/src/test/ui/traits/trait-or-new-type-instead.stderr +++ b/src/test/ui/traits/trait-or-new-type-instead.stderr @@ -1,5 +1,5 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined - --> $DIR/trait-or-new-type-instead.rs:11:1 + --> $DIR/trait-or-new-type-instead.rs:1:1 | LL | / impl Option { LL | | //~^ ERROR cannot define inherent `impl` for a type outside of the crate where the type is defined diff --git a/src/test/ui/traits/trait-privacy.rs b/src/test/ui/traits/trait-privacy.rs index 85001fc0ff6..6254157e25d 100644 --- a/src/test/ui/traits/trait-privacy.rs +++ b/src/test/ui/traits/trait-privacy.rs @@ -1,15 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass -#![feature(get_type_id)] #![allow(dead_code)] mod foo { pub use self::bar::T; @@ -28,7 +17,7 @@ fn g() { fn f() { let error = ::std::thread::spawn(|| {}).join().unwrap_err(); - error.get_type_id(); // Regression test for #21670 + error.type_id(); // Regression test for #21670 } diff --git a/src/test/ui/traits/trait-resolution-in-overloaded-op.rs b/src/test/ui/traits/trait-resolution-in-overloaded-op.rs index 1f57c4cf93a..96f81a21a3b 100644 --- a/src/test/ui/traits/trait-resolution-in-overloaded-op.rs +++ b/src/test/ui/traits/trait-resolution-in-overloaded-op.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // #12402 Operator overloading only considers the method name, not which trait is implemented trait MyMul { diff --git a/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr b/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr index ba20eae56c7..2c644480f0a 100644 --- a/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr +++ b/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `*` cannot be applied to type `&T` - --> $DIR/trait-resolution-in-overloaded-op.rs:18:5 + --> $DIR/trait-resolution-in-overloaded-op.rs:8:5 | LL | a * b //~ ERROR binary operation `*` cannot be applied to type `&T` | ^^^^^ diff --git a/src/test/ui/traits/trait-safety-fn-body.rs b/src/test/ui/traits/trait-safety-fn-body.rs index 1a2bcc471b4..df527747305 100644 --- a/src/test/ui/traits/trait-safety-fn-body.rs +++ b/src/test/ui/traits/trait-safety-fn-body.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that an unsafe impl does not imply that unsafe actions are // legal in the methods. diff --git a/src/test/ui/traits/trait-safety-fn-body.stderr b/src/test/ui/traits/trait-safety-fn-body.stderr index 0b7b6e61678..a27cd869da5 100644 --- a/src/test/ui/traits/trait-safety-fn-body.stderr +++ b/src/test/ui/traits/trait-safety-fn-body.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/trait-safety-fn-body.rs:21:9 + --> $DIR/trait-safety-fn-body.rs:11:9 | LL | *self += 1; | ^^^^^^^^^^ dereference of raw pointer diff --git a/src/test/ui/traits/trait-safety-inherent-impl.rs b/src/test/ui/traits/trait-safety-inherent-impl.rs index 059fdc100c9..50e15f0d25f 100644 --- a/src/test/ui/traits/trait-safety-inherent-impl.rs +++ b/src/test/ui/traits/trait-safety-inherent-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that inherent impls cannot be unsafe. struct SomeStruct; diff --git a/src/test/ui/traits/trait-safety-inherent-impl.stderr b/src/test/ui/traits/trait-safety-inherent-impl.stderr index 5154a591c4c..969b16633ce 100644 --- a/src/test/ui/traits/trait-safety-inherent-impl.stderr +++ b/src/test/ui/traits/trait-safety-inherent-impl.stderr @@ -1,5 +1,5 @@ error[E0197]: inherent impls cannot be unsafe - --> $DIR/trait-safety-inherent-impl.rs:15:1 + --> $DIR/trait-safety-inherent-impl.rs:5:1 | LL | / unsafe impl SomeStruct { //~ ERROR inherent impls cannot be unsafe LL | | fn foo(self) { } diff --git a/src/test/ui/traits/trait-safety-trait-impl-cc.rs b/src/test/ui/traits/trait-safety-trait-impl-cc.rs index f30c8f521bd..6f125e5f950 100644 --- a/src/test/ui/traits/trait-safety-trait-impl-cc.rs +++ b/src/test/ui/traits/trait-safety-trait-impl-cc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:trait_safety_lib.rs // Check that unsafe traits require unsafe impls and that inherent diff --git a/src/test/ui/traits/trait-safety-trait-impl-cc.stderr b/src/test/ui/traits/trait-safety-trait-impl-cc.stderr index 0611d2da02a..3be72fbfdd7 100644 --- a/src/test/ui/traits/trait-safety-trait-impl-cc.stderr +++ b/src/test/ui/traits/trait-safety-trait-impl-cc.stderr @@ -1,5 +1,5 @@ error[E0200]: the trait `lib::Foo` requires an `unsafe impl` declaration - --> $DIR/trait-safety-trait-impl-cc.rs:19:1 + --> $DIR/trait-safety-trait-impl-cc.rs:9:1 | LL | / impl lib::Foo for Bar { //~ ERROR requires an `unsafe impl` declaration LL | | fn foo(&self) -> isize { diff --git a/src/test/ui/traits/trait-safety-trait-impl.rs b/src/test/ui/traits/trait-safety-trait-impl.rs index e846b660c2a..45258b78d01 100644 --- a/src/test/ui/traits/trait-safety-trait-impl.rs +++ b/src/test/ui/traits/trait-safety-trait-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that unsafe traits require unsafe impls and that inherent // impls cannot be unsafe. diff --git a/src/test/ui/traits/trait-safety-trait-impl.stderr b/src/test/ui/traits/trait-safety-trait-impl.stderr index 137e9f7c043..22e9b4d4035 100644 --- a/src/test/ui/traits/trait-safety-trait-impl.stderr +++ b/src/test/ui/traits/trait-safety-trait-impl.stderr @@ -1,11 +1,11 @@ error[E0200]: the trait `UnsafeTrait` requires an `unsafe impl` declaration - --> $DIR/trait-safety-trait-impl.rs:24:1 + --> $DIR/trait-safety-trait-impl.rs:14:1 | LL | impl UnsafeTrait for u16 { } //~ ERROR requires an `unsafe impl` declaration | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0199]: implementing the trait `SafeTrait` is not unsafe - --> $DIR/trait-safety-trait-impl.rs:26:1 + --> $DIR/trait-safety-trait-impl.rs:16:1 | LL | unsafe impl SafeTrait for u32 { } //~ ERROR the trait `SafeTrait` is not unsafe | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/trait-static-method-generic-inference.rs b/src/test/ui/traits/trait-static-method-generic-inference.rs index 0e357d9d4d5..c08bd5cb135 100644 --- a/src/test/ui/traits/trait-static-method-generic-inference.rs +++ b/src/test/ui/traits/trait-static-method-generic-inference.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #3902. We are (at least currently) unable to infer `Self` // based on `T`, even though there is only a single impl, because of // the possibility of associated types and other things (basically: no diff --git a/src/test/ui/traits/trait-static-method-generic-inference.stderr b/src/test/ui/traits/trait-static-method-generic-inference.stderr index a903bd998f2..390d21c4a69 100644 --- a/src/test/ui/traits/trait-static-method-generic-inference.stderr +++ b/src/test/ui/traits/trait-static-method-generic-inference.stderr @@ -1,11 +1,11 @@ error[E0283]: type annotations required: cannot resolve `_: base::HasNew` - --> $DIR/trait-static-method-generic-inference.rs:34:25 + --> $DIR/trait-static-method-generic-inference.rs:24:25 | LL | let _f: base::Foo = base::HasNew::new(); | ^^^^^^^^^^^^^^^^^ | note: required by `base::HasNew::new` - --> $DIR/trait-static-method-generic-inference.rs:18:9 + --> $DIR/trait-static-method-generic-inference.rs:8:9 | LL | fn new() -> T; | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/trait-suggest-where-clause.rs b/src/test/ui/traits/trait-suggest-where-clause.rs index a43b75d2fe8..8405e5ff62e 100644 --- a/src/test/ui/traits/trait-suggest-where-clause.rs +++ b/src/test/ui/traits/trait-suggest-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem; struct Misc(T); diff --git a/src/test/ui/traits/trait-suggest-where-clause.stderr b/src/test/ui/traits/trait-suggest-where-clause.stderr index 3b335960867..f88dae37e48 100644 --- a/src/test/ui/traits/trait-suggest-where-clause.stderr +++ b/src/test/ui/traits/trait-suggest-where-clause.stderr @@ -1,28 +1,28 @@ error[E0277]: the size for values of type `U` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:17:5 + --> $DIR/trait-suggest-where-clause.rs:7:5 | LL | mem::size_of::(); | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `U` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where U: std::marker::Sized` bound = note: required by `std::mem::size_of` error[E0277]: the size for values of type `U` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:20:5 + --> $DIR/trait-suggest-where-clause.rs:10:5 | LL | mem::size_of::>(); | ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Misc`, the trait `std::marker::Sized` is not implemented for `U` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where U: std::marker::Sized` bound = note: required because it appears within the type `Misc` = note: required by `std::mem::size_of` error[E0277]: the trait bound `u64: std::convert::From` is not satisfied - --> $DIR/trait-suggest-where-clause.rs:25:5 + --> $DIR/trait-suggest-where-clause.rs:15:5 | LL | >::from; | ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From` is not implemented for `u64` @@ -31,7 +31,7 @@ LL | >::from; = note: required by `std::convert::From::from` error[E0277]: the trait bound `u64: std::convert::From<::Item>` is not satisfied - --> $DIR/trait-suggest-where-clause.rs:28:5 + --> $DIR/trait-suggest-where-clause.rs:18:5 | LL | ::Item>>::from; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<::Item>` is not implemented for `u64` @@ -40,7 +40,7 @@ LL | ::Item>>::from; = note: required by `std::convert::From::from` error[E0277]: the trait bound `Misc<_>: std::convert::From` is not satisfied - --> $DIR/trait-suggest-where-clause.rs:33:5 + --> $DIR/trait-suggest-where-clause.rs:23:5 | LL | as From>::from; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From` is not implemented for `Misc<_>` @@ -48,23 +48,23 @@ LL | as From>::from; = note: required by `std::convert::From::from` error[E0277]: the size for values of type `[T]` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:38:5 + --> $DIR/trait-suggest-where-clause.rs:28:5 | LL | mem::size_of::<[T]>(); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[T]` - = note: to learn more, visit + = note: to learn more, visit = note: required by `std::mem::size_of` error[E0277]: the size for values of type `[&U]` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:41:5 + --> $DIR/trait-suggest-where-clause.rs:31:5 | LL | mem::size_of::<[&U]>(); | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[&U]` - = note: to learn more, visit + = note: to learn more, visit = note: required by `std::mem::size_of` error: aborting due to 7 previous errors diff --git a/src/test/ui/traits/trait-test-2.rs b/src/test/ui/traits/trait-test-2.rs index 01d7e89847a..20d979df4bf 100644 --- a/src/test/ui/traits/trait-test-2.rs +++ b/src/test/ui/traits/trait-test-2.rs @@ -1,15 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] +#[allow(non_camel_case_types)] trait bar { fn dup(&self) -> Self; fn blah(&self); } impl bar for i32 { fn dup(&self) -> i32 { *self } fn blah(&self) {} } impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah(&self) {} } diff --git a/src/test/ui/traits/trait-test-2.stderr b/src/test/ui/traits/trait-test-2.stderr index db0cd38cb6a..c01317f3d5b 100644 --- a/src/test/ui/traits/trait-test-2.stderr +++ b/src/test/ui/traits/trait-test-2.stderr @@ -1,17 +1,17 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/trait-test-2.rs:18:14 + --> $DIR/trait-test-2.rs:9:14 | LL | 10.dup::(); //~ ERROR wrong number of type arguments: expected 0, found 1 | ^^^ unexpected type argument error[E0107]: wrong number of type arguments: expected 1, found 2 - --> $DIR/trait-test-2.rs:19:20 + --> $DIR/trait-test-2.rs:10:20 | LL | 10.blah::(); //~ ERROR wrong number of type arguments: expected 1, found 2 | ^^^ unexpected type argument error[E0038]: the trait `bar` cannot be made into an object - --> $DIR/trait-test-2.rs:20:16 + --> $DIR/trait-test-2.rs:11:16 | LL | (box 10 as Box).dup(); | ^^^^^^^^ the trait `bar` cannot be made into an object @@ -20,7 +20,7 @@ LL | (box 10 as Box).dup(); = note: method `blah` has generic type parameters error[E0038]: the trait `bar` cannot be made into an object - --> $DIR/trait-test-2.rs:20:6 + --> $DIR/trait-test-2.rs:11:6 | LL | (box 10 as Box).dup(); | ^^^^^^ the trait `bar` cannot be made into an object diff --git a/src/test/ui/traits/trait-test.rs b/src/test/ui/traits/trait-test.rs index d53e353d9d9..72fc66f740b 100644 --- a/src/test/ui/traits/trait-test.rs +++ b/src/test/ui/traits/trait-test.rs @@ -1,13 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - +#[allow(non_camel_case_types)] trait foo { fn foo(&self); } impl isize for usize { fn foo(&self) {} } //~ ERROR trait diff --git a/src/test/ui/traits/trait-test.stderr b/src/test/ui/traits/trait-test.stderr index 89dbb3dee87..2383175d513 100644 --- a/src/test/ui/traits/trait-test.stderr +++ b/src/test/ui/traits/trait-test.stderr @@ -1,5 +1,5 @@ error[E0404]: expected trait, found builtin type `isize` - --> $DIR/trait-test.rs:13:6 + --> $DIR/trait-test.rs:4:6 | LL | impl isize for usize { fn foo(&self) {} } //~ ERROR trait | ^^^^^ not a trait diff --git a/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.rs b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.rs index 971869ba85b..47d7075ac35 100644 --- a/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.rs +++ b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test case where an associated type is referenced from within the // supertrait definition, and the impl makes the wrong // associations. Issue #20220. diff --git a/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr index bf5e8a77f83..ce1aadca597 100644 --- a/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr +++ b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr @@ -1,5 +1,5 @@ error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == u32` - --> $DIR/traits-assoc-type-in-supertrait-bad.rs:21:6 + --> $DIR/traits-assoc-type-in-supertrait-bad.rs:11:6 | LL | impl Foo for IntoIter { //~ ERROR type mismatch | ^^^ expected i32, found u32 diff --git a/src/test/ui/traits/traits-inductive-overflow-simultaneous.rs b/src/test/ui/traits/traits-inductive-overflow-simultaneous.rs index 777746a189c..40ac9214674 100644 --- a/src/test/ui/traits/traits-inductive-overflow-simultaneous.rs +++ b/src/test/ui/traits/traits-inductive-overflow-simultaneous.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #33344, initial version. This example allowed // arbitrary trait bounds to be synthesized. diff --git a/src/test/ui/traits/traits-inductive-overflow-simultaneous.stderr b/src/test/ui/traits/traits-inductive-overflow-simultaneous.stderr index 7eabb00935c..cd8501e4df4 100644 --- a/src/test/ui/traits/traits-inductive-overflow-simultaneous.stderr +++ b/src/test/ui/traits/traits-inductive-overflow-simultaneous.stderr @@ -1,12 +1,12 @@ error[E0275]: overflow evaluating the requirement `{integer}: Tweedledum` - --> $DIR/traits-inductive-overflow-simultaneous.rs:28:5 + --> $DIR/traits-inductive-overflow-simultaneous.rs:18:5 | LL | is_ee(4); | ^^^^^ | = note: required because of the requirements on the impl of `Combo` for `{integer}` note: required by `is_ee` - --> $DIR/traits-inductive-overflow-simultaneous.rs:23:1 + --> $DIR/traits-inductive-overflow-simultaneous.rs:13:1 | LL | fn is_ee(t: T) { | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.rs b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.rs index 59d5dc6c58b..c65242b1bb1 100644 --- a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.rs +++ b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // OIBIT-based version of #29859, supertrait version. Test that using // a simple OIBIT `..` impl alone still doesn't allow arbitrary bounds // to be synthesized. diff --git a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr index 5438cc54dc6..7aa9809c074 100644 --- a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr +++ b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr @@ -1,18 +1,18 @@ error[E0568]: auto traits cannot have super traits - --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:17:1 + --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:7:1 | LL | auto trait Magic: Copy {} //~ ERROR E0568 | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NoClone: std::marker::Copy` is not satisfied - --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:25:18 + --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:15:18 | LL | let (a, b) = copy(NoClone); //~ ERROR | ^^^^ the trait `std::marker::Copy` is not implemented for `NoClone` | = note: required because of the requirements on the impl of `Magic` for `NoClone` note: required by `copy` - --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:19:1 + --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:9:1 | LL | fn copy(x: T) -> (T, T) { (x, x) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/traits-inductive-overflow-supertrait.rs b/src/test/ui/traits/traits-inductive-overflow-supertrait.rs index c717ae9639f..c7aa4d90f58 100644 --- a/src/test/ui/traits/traits-inductive-overflow-supertrait.rs +++ b/src/test/ui/traits/traits-inductive-overflow-supertrait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #29859, supertrait version. This example // allowed arbitrary trait bounds to be synthesized. diff --git a/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr b/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr index 6f0929d696f..d4b3b6b7d71 100644 --- a/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr +++ b/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr @@ -1,12 +1,12 @@ error[E0275]: overflow evaluating the requirement `NoClone: Magic` - --> $DIR/traits-inductive-overflow-supertrait.rs:23:18 + --> $DIR/traits-inductive-overflow-supertrait.rs:13:18 | LL | let (a, b) = copy(NoClone); //~ ERROR E0275 | ^^^^ | = note: required because of the requirements on the impl of `Magic` for `NoClone` note: required by `copy` - --> $DIR/traits-inductive-overflow-supertrait.rs:17:1 + --> $DIR/traits-inductive-overflow-supertrait.rs:7:1 | LL | fn copy(x: T) -> (T, T) { (x, x) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/traits-inductive-overflow-two-traits.rs b/src/test/ui/traits/traits-inductive-overflow-two-traits.rs index c622dca2b4d..63dd1419200 100644 --- a/src/test/ui/traits/traits-inductive-overflow-two-traits.rs +++ b/src/test/ui/traits/traits-inductive-overflow-two-traits.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for #29859, initial version. This example allowed // arbitrary trait bounds to be synthesized. diff --git a/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr b/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr index 900ed1b2e8b..cee9aa348c3 100644 --- a/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr +++ b/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr @@ -1,11 +1,11 @@ error[E0275]: overflow evaluating the requirement `*mut (): Magic` - --> $DIR/traits-inductive-overflow-two-traits.rs:29:5 + --> $DIR/traits-inductive-overflow-two-traits.rs:19:5 | LL | wizard::<*mut ()>(); //~ ERROR E0275 | ^^^^^^^^^^^^^^^^^ | note: required by `wizard` - --> $DIR/traits-inductive-overflow-two-traits.rs:26:1 + --> $DIR/traits-inductive-overflow-two-traits.rs:16:1 | LL | fn wizard() { check::<::X>(); } | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/traits-issue-23003-overflow.rs b/src/test/ui/traits/traits-issue-23003-overflow.rs index 2f694e3ca7c..06aa698ddef 100644 --- a/src/test/ui/traits/traits-issue-23003-overflow.rs +++ b/src/test/ui/traits/traits-issue-23003-overflow.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A variant of traits-issue-23003 in which an infinite series of // types are required. This test now just compiles fine, since the // relevant rules that triggered the overflow were removed. diff --git a/src/test/ui/traits/traits-multidispatch-bad.rs b/src/test/ui/traits/traits-multidispatch-bad.rs index 392eccf0f31..b625b961590 100644 --- a/src/test/ui/traits/traits-multidispatch-bad.rs +++ b/src/test/ui/traits/traits-multidispatch-bad.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we detect an illegal combination of types. trait Convert { diff --git a/src/test/ui/traits/traits-multidispatch-bad.stderr b/src/test/ui/traits/traits-multidispatch-bad.stderr index 6068edea585..d6c6697c3c0 100644 --- a/src/test/ui/traits/traits-multidispatch-bad.stderr +++ b/src/test/ui/traits/traits-multidispatch-bad.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/traits-multidispatch-bad.rs:29:17 + --> $DIR/traits-multidispatch-bad.rs:19:17 | LL | test(22i32, 44i32); //~ ERROR mismatched types | ^^^^^ expected u32, found i32 diff --git a/src/test/ui/traits/traits-multidispatch-convert-ambig-dest.rs b/src/test/ui/traits/traits-multidispatch-convert-ambig-dest.rs index 0d4855c544f..58cb69a05b7 100644 --- a/src/test/ui/traits/traits-multidispatch-convert-ambig-dest.rs +++ b/src/test/ui/traits/traits-multidispatch-convert-ambig-dest.rs @@ -1,13 +1,3 @@ -// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we get an error in a multidisptach scenario where the // set of impls is ambiguous. diff --git a/src/test/ui/traits/traits-multidispatch-convert-ambig-dest.stderr b/src/test/ui/traits/traits-multidispatch-convert-ambig-dest.stderr index 46c86cd767a..d7d27049f43 100644 --- a/src/test/ui/traits/traits-multidispatch-convert-ambig-dest.stderr +++ b/src/test/ui/traits/traits-multidispatch-convert-ambig-dest.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/traits-multidispatch-convert-ambig-dest.rs:36:5 + --> $DIR/traits-multidispatch-convert-ambig-dest.rs:26:5 | LL | test(22, std::default::Default::default()); | ^^^^ cannot infer type for `U` diff --git a/src/test/ui/traits/traits-negative-impls.rs b/src/test/ui/traits/traits-negative-impls.rs index a272686c535..fb9a3a99748 100644 --- a/src/test/ui/traits/traits-negative-impls.rs +++ b/src/test/ui/traits/traits-negative-impls.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // The dummy functions are used to avoid adding new cfail files. // What happens is that the compiler attempts to squash duplicates and some // errors are not reported. This way, we make sure that, for each function, different diff --git a/src/test/ui/traits/traits-negative-impls.stderr b/src/test/ui/traits/traits-negative-impls.stderr index 0d10f4863d3..1bdd73eb6f9 100644 --- a/src/test/ui/traits/traits-negative-impls.stderr +++ b/src/test/ui/traits/traits-negative-impls.stderr @@ -1,44 +1,44 @@ error[E0277]: `dummy::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:33:5 + --> $DIR/traits-negative-impls.rs:23:5 | LL | Outer(TestType); | ^^^^^ `dummy::TestType` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `dummy::TestType` note: required by `Outer` - --> $DIR/traits-negative-impls.rs:20:1 + --> $DIR/traits-negative-impls.rs:10:1 | LL | struct Outer(T); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `dummy::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:33:5 + --> $DIR/traits-negative-impls.rs:23:5 | LL | Outer(TestType); | ^^^^^^^^^^^^^^^ `dummy::TestType` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `dummy::TestType` note: required by `Outer` - --> $DIR/traits-negative-impls.rs:20:1 + --> $DIR/traits-negative-impls.rs:10:1 | LL | struct Outer(T); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `dummy1b::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:42:5 + --> $DIR/traits-negative-impls.rs:32:5 | LL | is_send(TestType); | ^^^^^^^ `dummy1b::TestType` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `dummy1b::TestType` note: required by `is_send` - --> $DIR/traits-negative-impls.rs:26:1 + --> $DIR/traits-negative-impls.rs:16:1 | LL | fn is_send(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `dummy1c::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:50:5 + --> $DIR/traits-negative-impls.rs:40:5 | LL | is_send((8, TestType)); | ^^^^^^^ `dummy1c::TestType` cannot be sent between threads safely @@ -46,13 +46,13 @@ LL | is_send((8, TestType)); = help: within `({integer}, dummy1c::TestType)`, the trait `std::marker::Send` is not implemented for `dummy1c::TestType` = note: required because it appears within the type `({integer}, dummy1c::TestType)` note: required by `is_send` - --> $DIR/traits-negative-impls.rs:26:1 + --> $DIR/traits-negative-impls.rs:16:1 | LL | fn is_send(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `dummy2::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:58:5 + --> $DIR/traits-negative-impls.rs:48:5 | LL | is_send(Box::new(TestType)); | ^^^^^^^ `dummy2::TestType` cannot be sent between threads safely @@ -61,13 +61,13 @@ LL | is_send(Box::new(TestType)); = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique` = note: required because it appears within the type `std::boxed::Box` note: required by `is_send` - --> $DIR/traits-negative-impls.rs:26:1 + --> $DIR/traits-negative-impls.rs:16:1 | LL | fn is_send(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `dummy3::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:66:5 + --> $DIR/traits-negative-impls.rs:56:5 | LL | is_send(Box::new(Outer2(TestType))); | ^^^^^^^ `dummy3::TestType` cannot be sent between threads safely @@ -77,13 +77,13 @@ LL | is_send(Box::new(Outer2(TestType))); = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique>` = note: required because it appears within the type `std::boxed::Box>` note: required by `is_send` - --> $DIR/traits-negative-impls.rs:26:1 + --> $DIR/traits-negative-impls.rs:16:1 | LL | fn is_send(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `main::TestType` cannot be sent between threads safely - --> $DIR/traits-negative-impls.rs:76:5 + --> $DIR/traits-negative-impls.rs:66:5 | LL | is_sync(Outer2(TestType)); | ^^^^^^^ `main::TestType` cannot be sent between threads safely @@ -91,7 +91,7 @@ LL | is_sync(Outer2(TestType)); = help: the trait `std::marker::Send` is not implemented for `main::TestType` = note: required because of the requirements on the impl of `std::marker::Sync` for `Outer2` note: required by `is_sync` - --> $DIR/traits-negative-impls.rs:27:1 + --> $DIR/traits-negative-impls.rs:17:1 | LL | fn is_sync(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/traits/traits-repeated-supertrait-ambig.rs b/src/test/ui/traits/traits-repeated-supertrait-ambig.rs index 559871af72e..5fa7e87aa4b 100644 --- a/src/test/ui/traits/traits-repeated-supertrait-ambig.rs +++ b/src/test/ui/traits/traits-repeated-supertrait-ambig.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a case of a trait which extends the same supertrait twice, but // with difference type parameters. Test then that when we don't give // enough information to pick between these, no selection is made. In diff --git a/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr b/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr index 87d3c8117d3..f906378eb3c 100644 --- a/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr +++ b/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfied - --> $DIR/traits-repeated-supertrait-ambig.rs:36:7 + --> $DIR/traits-repeated-supertrait-ambig.rs:26:7 | LL | c.same_as(22) //~ ERROR `dyn CompareToInts: CompareTo` is not satisfied | ^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` error[E0277]: the trait bound `C: CompareTo` is not satisfied - --> $DIR/traits-repeated-supertrait-ambig.rs:40:7 + --> $DIR/traits-repeated-supertrait-ambig.rs:30:7 | LL | c.same_as(22) //~ ERROR `C: CompareTo` is not satisfied | ^^^^^^^ the trait `CompareTo` is not implemented for `C` @@ -13,32 +13,32 @@ LL | c.same_as(22) //~ ERROR `C: CompareTo` is not satisfied = help: consider adding a `where C: CompareTo` bound error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfied - --> $DIR/traits-repeated-supertrait-ambig.rs:44:5 + --> $DIR/traits-repeated-supertrait-ambig.rs:34:5 | LL | CompareToInts::same_as(c, 22) //~ ERROR `dyn CompareToInts: CompareTo` is not satisfied | ^^^^^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` | note: required by `CompareTo::same_as` - --> $DIR/traits-repeated-supertrait-ambig.rs:19:5 + --> $DIR/traits-repeated-supertrait-ambig.rs:9:5 | LL | fn same_as(&self, t: T) -> bool; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `C: CompareTo` is not satisfied - --> $DIR/traits-repeated-supertrait-ambig.rs:48:5 + --> $DIR/traits-repeated-supertrait-ambig.rs:38:5 | LL | CompareTo::same_as(c, 22) //~ ERROR `C: CompareTo` is not satisfied | ^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `C` | = help: consider adding a `where C: CompareTo` bound note: required by `CompareTo::same_as` - --> $DIR/traits-repeated-supertrait-ambig.rs:19:5 + --> $DIR/traits-repeated-supertrait-ambig.rs:9:5 | LL | fn same_as(&self, t: T) -> bool; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `i64: CompareTo` is not satisfied - --> $DIR/traits-repeated-supertrait-ambig.rs:52:23 + --> $DIR/traits-repeated-supertrait-ambig.rs:42:23 | LL | assert_eq!(22_i64.same_as(22), true); //~ ERROR `i64: CompareTo` is not satisfied | ^^^^^^^ the trait `CompareTo` is not implemented for `i64` diff --git a/src/test/ui/transmute-equal-assoc-types.rs b/src/test/ui/transmute-equal-assoc-types.rs new file mode 100644 index 00000000000..6f357543e5c --- /dev/null +++ b/src/test/ui/transmute-equal-assoc-types.rs @@ -0,0 +1,9 @@ +trait Foo { + type Bar; +} + +unsafe fn noop(foo: F::Bar) -> F::Bar { + ::std::mem::transmute(foo) //~ ERROR cannot transmute between types of different sizes +} + +fn main() {} diff --git a/src/test/ui/transmute-equal-assoc-types.stderr b/src/test/ui/transmute-equal-assoc-types.stderr new file mode 100644 index 00000000000..46bbf1c1858 --- /dev/null +++ b/src/test/ui/transmute-equal-assoc-types.stderr @@ -0,0 +1,11 @@ +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-equal-assoc-types.rs:6:5 + | +LL | ::std::mem::transmute(foo) //~ ERROR cannot transmute between types of different sizes + | ^^^^^^^^^^^^^^^^^^^^^ + | + = note: `::Bar` does not have a fixed size + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0512`. diff --git a/src/test/ui/transmute/main.rs b/src/test/ui/transmute/main.rs index 285b079cf96..ea233a47a78 100644 --- a/src/test/ui/transmute/main.rs +++ b/src/test/ui/transmute/main.rs @@ -1,15 +1,5 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// normalize-stderr-32bit: "&str \(64 bits\)" -> "&str ($$STR bits)" -// normalize-stderr-64bit: "&str \(128 bits\)" -> "&str ($$STR bits)" +// normalize-stderr-32bit: "`&str` \(64 bits\)" -> "`&str` ($$STR bits)" +// normalize-stderr-64bit: "`&str` \(128 bits\)" -> "`&str` ($$STR bits)" @@ -23,20 +13,20 @@ pub trait TypeConstructor<'a> { unsafe fn transmute_lifetime<'a, 'b, C>(x: >::T) -> >::T where for<'z> C: TypeConstructor<'z> { - transmute(x) //~ ERROR transmute called with types of different sizes + transmute(x) //~ ERROR cannot transmute between types of different sizes } unsafe fn sizes() { - let x: u8 = transmute(10u16); //~ ERROR transmute called with types of different sizes + let x: u8 = transmute(10u16); //~ ERROR cannot transmute between types of different sizes } unsafe fn ptrs() { - let x: u8 = transmute("test"); //~ ERROR transmute called with types of different sizes + let x: u8 = transmute("test"); //~ ERROR cannot transmute between types of different sizes } union Foo { x: () } unsafe fn vary() { - let x: Foo = transmute(10); //~ ERROR transmute called with types of different sizes + let x: Foo = transmute(10); //~ ERROR cannot transmute between types of different sizes } fn main() {} diff --git a/src/test/ui/transmute/main.stderr b/src/test/ui/transmute/main.stderr index 7f6ee749c4f..f4e88fc860a 100644 --- a/src/test/ui/transmute/main.stderr +++ b/src/test/ui/transmute/main.stderr @@ -1,38 +1,38 @@ -error[E0512]: transmute called with types of different sizes - --> $DIR/main.rs:26:5 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/main.rs:16:5 | -LL | transmute(x) //~ ERROR transmute called with types of different sizes +LL | transmute(x) //~ ERROR cannot transmute between types of different sizes | ^^^^^^^^^ | - = note: source type: >::T (size can vary because of ::T) - = note: target type: >::T (size can vary because of ::T) + = note: source type: `>::T` (size can vary because of ::T) + = note: target type: `>::T` (size can vary because of ::T) -error[E0512]: transmute called with types of different sizes - --> $DIR/main.rs:30:17 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/main.rs:20:17 | -LL | let x: u8 = transmute(10u16); //~ ERROR transmute called with types of different sizes +LL | let x: u8 = transmute(10u16); //~ ERROR cannot transmute between types of different sizes | ^^^^^^^^^ | - = note: source type: u16 (16 bits) - = note: target type: u8 (8 bits) + = note: source type: `u16` (16 bits) + = note: target type: `u8` (8 bits) -error[E0512]: transmute called with types of different sizes - --> $DIR/main.rs:34:17 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/main.rs:24:17 | -LL | let x: u8 = transmute("test"); //~ ERROR transmute called with types of different sizes +LL | let x: u8 = transmute("test"); //~ ERROR cannot transmute between types of different sizes | ^^^^^^^^^ | - = note: source type: &str ($STR bits) - = note: target type: u8 (8 bits) + = note: source type: `&str` ($STR bits) + = note: target type: `u8` (8 bits) -error[E0512]: transmute called with types of different sizes - --> $DIR/main.rs:39:18 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/main.rs:29:18 | -LL | let x: Foo = transmute(10); //~ ERROR transmute called with types of different sizes +LL | let x: Foo = transmute(10); //~ ERROR cannot transmute between types of different sizes | ^^^^^^^^^ | - = note: source type: i32 (32 bits) - = note: target type: Foo (0 bits) + = note: source type: `i32` (32 bits) + = note: target type: `Foo` (0 bits) error: aborting due to 4 previous errors diff --git a/src/test/ui/transmute/transmute-different-sizes.rs b/src/test/ui/transmute/transmute-different-sizes.rs index 62e9ceb2b2f..690decf6392 100644 --- a/src/test/ui/transmute/transmute-different-sizes.rs +++ b/src/test/ui/transmute/transmute-different-sizes.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // normalize-stderr-test "\d+ bits" -> "N bits" // Tests that `transmute` cannot be called on types of different size. @@ -19,12 +9,12 @@ use std::mem::transmute; unsafe fn f() { let _: i8 = transmute(16i16); - //~^ ERROR transmute called with types of different sizes + //~^ ERROR cannot transmute between types of different sizes, or dependently-sized types } unsafe fn g(x: &T) { let _: i8 = transmute(x); - //~^ ERROR transmute called with types of different sizes + //~^ ERROR cannot transmute between types of different sizes, or dependently-sized types } trait Specializable { type Output; } @@ -35,7 +25,7 @@ impl Specializable for T { unsafe fn specializable(x: u16) -> ::Output { transmute(x) - //~^ ERROR transmute called with types of different sizes + //~^ ERROR cannot transmute between types of different sizes, or dependently-sized types } fn main() {} diff --git a/src/test/ui/transmute/transmute-different-sizes.stderr b/src/test/ui/transmute/transmute-different-sizes.stderr index a07b75e29d5..07a38df6973 100644 --- a/src/test/ui/transmute/transmute-different-sizes.stderr +++ b/src/test/ui/transmute/transmute-different-sizes.stderr @@ -1,29 +1,29 @@ -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-different-sizes.rs:21:17 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-different-sizes.rs:11:17 | LL | let _: i8 = transmute(16i16); | ^^^^^^^^^ | - = note: source type: i16 (N bits) - = note: target type: i8 (N bits) + = note: source type: `i16` (N bits) + = note: target type: `i8` (N bits) -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-different-sizes.rs:26:17 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-different-sizes.rs:16:17 | LL | let _: i8 = transmute(x); | ^^^^^^^^^ | - = note: source type: &T (N bits) - = note: target type: i8 (N bits) + = note: source type: `&T` (N bits) + = note: target type: `i8` (N bits) -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-different-sizes.rs:37:5 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-different-sizes.rs:27:5 | LL | transmute(x) | ^^^^^^^^^ | - = note: source type: u16 (N bits) - = note: target type: ::Output (this type's size can vary) + = note: source type: `u16` (N bits) + = note: target type: `::Output` (this type does not have a fixed size) error: aborting due to 3 previous errors diff --git a/src/test/ui/transmute/transmute-fat-pointers.rs b/src/test/ui/transmute/transmute-fat-pointers.rs index c1e6ee3ddcc..7c1beffd14e 100644 --- a/src/test/ui/transmute/transmute-fat-pointers.rs +++ b/src/test/ui/transmute/transmute-fat-pointers.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // normalize-stderr-test "\d+ bits" -> "N bits" // Tests that are conservative around thin/fat pointer mismatches. @@ -17,11 +7,11 @@ use std::mem::transmute; fn a(x: &[T]) -> &U { - unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes + unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes } fn b(x: &T) -> &U { - unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes + unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes } fn c(x: &T) -> &U { @@ -33,11 +23,11 @@ fn d(x: &[T]) -> &[U] { } fn e(x: &T) -> &U { - unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes + unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes } fn f(x: &T) -> &U { - unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes + unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes } fn main() { } diff --git a/src/test/ui/transmute/transmute-fat-pointers.stderr b/src/test/ui/transmute/transmute-fat-pointers.stderr index 8ea71e101c0..4b34950881a 100644 --- a/src/test/ui/transmute/transmute-fat-pointers.stderr +++ b/src/test/ui/transmute/transmute-fat-pointers.stderr @@ -1,38 +1,38 @@ -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-fat-pointers.rs:20:14 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-fat-pointers.rs:10:14 | -LL | unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes +LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes | ^^^^^^^^^ | - = note: source type: &[T] (N bits) - = note: target type: &U (pointer to U) + = note: source type: `&[T]` (N bits) + = note: target type: `&U` (pointer to `U`) -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-fat-pointers.rs:24:14 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-fat-pointers.rs:14:14 | -LL | unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes +LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes | ^^^^^^^^^ | - = note: source type: &T (pointer to T) - = note: target type: &U (pointer to U) + = note: source type: `&T` (pointer to `T`) + = note: target type: `&U` (pointer to `U`) -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-fat-pointers.rs:36:14 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-fat-pointers.rs:26:14 | -LL | unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes +LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes | ^^^^^^^^^ | - = note: source type: &T (pointer to T) - = note: target type: &U (N bits) + = note: source type: `&T` (pointer to `T`) + = note: target type: `&U` (N bits) -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-fat-pointers.rs:40:14 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-fat-pointers.rs:30:14 | -LL | unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes +LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes | ^^^^^^^^^ | - = note: source type: &T (N bits) - = note: target type: &U (pointer to U) + = note: source type: `&T` (N bits) + = note: target type: `&U` (pointer to `U`) error: aborting due to 4 previous errors diff --git a/src/test/ui/transmute/transmute-from-fn-item-types-error.rs b/src/test/ui/transmute/transmute-from-fn-item-types-error.rs index 0a0214a24ff..f858a199e48 100644 --- a/src/test/ui/transmute/transmute-from-fn-item-types-error.rs +++ b/src/test/ui/transmute/transmute-from-fn-item-types-error.rs @@ -1,18 +1,8 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::mem; unsafe fn foo() -> (i8, *const (), Option) { let i = mem::transmute(bar); - //~^ ERROR transmute called with types of different sizes + //~^ ERROR cannot transmute between types of different sizes, or dependently-sized types let p = mem::transmute(foo); @@ -29,7 +19,7 @@ unsafe fn foo() -> (i8, *const (), Option) { unsafe fn bar() { // Error as usual if the resulting type is not pointer-sized. mem::transmute::<_, u8>(main); - //~^ ERROR transmute called with types of different sizes + //~^ ERROR cannot transmute between types of different sizes, or dependently-sized types mem::transmute::<_, *mut ()>(foo); diff --git a/src/test/ui/transmute/transmute-from-fn-item-types-error.stderr b/src/test/ui/transmute/transmute-from-fn-item-types-error.stderr index 1591b06f3ac..d08078bcfba 100644 --- a/src/test/ui/transmute/transmute-from-fn-item-types-error.stderr +++ b/src/test/ui/transmute/transmute-from-fn-item-types-error.stderr @@ -1,14 +1,14 @@ -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-from-fn-item-types-error.rs:14:13 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-from-fn-item-types-error.rs:4:13 | LL | let i = mem::transmute(bar); | ^^^^^^^^^^^^^^ | - = note: source type: unsafe fn() {bar} (0 bits) - = note: target type: i8 (8 bits) + = note: source type: `unsafe fn() {bar}` (0 bits) + = note: target type: `i8` (8 bits) error[E0591]: can't transmute zero-sized type - --> $DIR/transmute-from-fn-item-types-error.rs:18:13 + --> $DIR/transmute-from-fn-item-types-error.rs:8:13 | LL | let p = mem::transmute(foo); | ^^^^^^^^^^^^^^ @@ -18,7 +18,7 @@ LL | let p = mem::transmute(foo); = help: cast with `as` to a pointer instead error[E0591]: can't transmute zero-sized type - --> $DIR/transmute-from-fn-item-types-error.rs:22:14 + --> $DIR/transmute-from-fn-item-types-error.rs:12:14 | LL | let of = mem::transmute(main); | ^^^^^^^^^^^^^^ @@ -27,17 +27,17 @@ LL | let of = mem::transmute(main); = note: target type: std::option::Option = help: cast with `as` to a pointer instead -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-from-fn-item-types-error.rs:31:5 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-from-fn-item-types-error.rs:21:5 | LL | mem::transmute::<_, u8>(main); | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: source type: fn() {main} (0 bits) - = note: target type: u8 (8 bits) + = note: source type: `fn() {main}` (0 bits) + = note: target type: `u8` (8 bits) error[E0591]: can't transmute zero-sized type - --> $DIR/transmute-from-fn-item-types-error.rs:35:5 + --> $DIR/transmute-from-fn-item-types-error.rs:25:5 | LL | mem::transmute::<_, *mut ()>(foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | mem::transmute::<_, *mut ()>(foo); = help: cast with `as` to a pointer instead error[E0591]: can't transmute zero-sized type - --> $DIR/transmute-from-fn-item-types-error.rs:39:5 + --> $DIR/transmute-from-fn-item-types-error.rs:29:5 | LL | mem::transmute::<_, fn()>(bar); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -57,7 +57,7 @@ LL | mem::transmute::<_, fn()>(bar); = help: cast with `as` to a pointer instead error[E0591]: can't transmute zero-sized type - --> $DIR/transmute-from-fn-item-types-error.rs:48:5 + --> $DIR/transmute-from-fn-item-types-error.rs:38:5 | LL | mem::transmute::<_, *mut ()>(Some(foo)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -67,7 +67,7 @@ LL | mem::transmute::<_, *mut ()>(Some(foo)); = help: cast with `as` to a pointer instead error[E0591]: can't transmute zero-sized type - --> $DIR/transmute-from-fn-item-types-error.rs:52:5 + --> $DIR/transmute-from-fn-item-types-error.rs:42:5 | LL | mem::transmute::<_, fn()>(Some(bar)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -77,7 +77,7 @@ LL | mem::transmute::<_, fn()>(Some(bar)); = help: cast with `as` to a pointer instead error[E0591]: can't transmute zero-sized type - --> $DIR/transmute-from-fn-item-types-error.rs:56:5 + --> $DIR/transmute-from-fn-item-types-error.rs:46:5 | LL | mem::transmute::<_, Option>(Some(baz)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/transmute/transmute-impl.rs b/src/test/ui/transmute/transmute-impl.rs index 3bf4ca5b9e0..df422bda166 100644 --- a/src/test/ui/transmute/transmute-impl.rs +++ b/src/test/ui/transmute/transmute-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // normalize-stderr-test "\d+ bits" -> "N bits" // Tests that are conservative around thin/fat pointer mismatches. @@ -28,7 +18,7 @@ impl Foo { fn n(x: &T) -> &isize { // Not OK here, because T : Sized is not in scope. - unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes + unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes } } diff --git a/src/test/ui/transmute/transmute-impl.stderr b/src/test/ui/transmute/transmute-impl.stderr index 21f272b0cc1..8acc0aaf3ab 100644 --- a/src/test/ui/transmute/transmute-impl.stderr +++ b/src/test/ui/transmute/transmute-impl.stderr @@ -1,11 +1,11 @@ -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-impl.rs:31:18 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-impl.rs:21:18 | -LL | unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes +LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes | ^^^^^^^^^ | - = note: source type: &T (pointer to T) - = note: target type: &isize (N bits) + = note: source type: `&T` (pointer to `T`) + = note: target type: `&isize` (N bits) error: aborting due to previous error diff --git a/src/test/ui/transmute/transmute-imut-to-mut.rs b/src/test/ui/transmute/transmute-imut-to-mut.rs index 62db4c5d366..94361a29087 100644 --- a/src/test/ui/transmute/transmute-imut-to-mut.rs +++ b/src/test/ui/transmute/transmute-imut-to-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that transmuting from &T to &mut T is Undefined Behavior. use std::mem::transmute; diff --git a/src/test/ui/transmute/transmute-imut-to-mut.stderr b/src/test/ui/transmute/transmute-imut-to-mut.stderr index 4434e35af7f..d2445f0c7f3 100644 --- a/src/test/ui/transmute/transmute-imut-to-mut.stderr +++ b/src/test/ui/transmute/transmute-imut-to-mut.stderr @@ -1,5 +1,5 @@ error: mutating transmuted &mut T from &T may cause undefined behavior, consider instead using an UnsafeCell - --> $DIR/transmute-imut-to-mut.rs:16:32 + --> $DIR/transmute-imut-to-mut.rs:6:32 | LL | let _a: &mut u8 = unsafe { transmute(&1u8) }; | ^^^^^^^^^ diff --git a/src/test/ui/transmute/transmute-type-parameters.rs b/src/test/ui/transmute/transmute-type-parameters.rs index fe340295f74..5f44b2d0f01 100644 --- a/src/test/ui/transmute/transmute-type-parameters.rs +++ b/src/test/ui/transmute/transmute-type-parameters.rs @@ -1,35 +1,20 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - - - - // Tests that `transmute` cannot be called on type parameters. use std::mem::transmute; unsafe fn f(x: T) { let _: i32 = transmute(x); -//~^ ERROR transmute called with types of different sizes +//~^ ERROR cannot transmute between types of different sizes, or dependently-sized types } unsafe fn g(x: (T, i32)) { let _: i32 = transmute(x); -//~^ ERROR transmute called with types of different sizes +//~^ ERROR cannot transmute between types of different sizes, or dependently-sized types } unsafe fn h(x: [T; 10]) { let _: i32 = transmute(x); -//~^ ERROR transmute called with types of different sizes +//~^ ERROR cannot transmute between types of different sizes, or dependently-sized types } struct Bad { @@ -38,7 +23,7 @@ struct Bad { unsafe fn i(x: Bad) { let _: i32 = transmute(x); -//~^ ERROR transmute called with types of different sizes +//~^ ERROR cannot transmute between types of different sizes, or dependently-sized types } enum Worse { @@ -48,12 +33,12 @@ enum Worse { unsafe fn j(x: Worse) { let _: i32 = transmute(x); -//~^ ERROR transmute called with types of different sizes +//~^ ERROR cannot transmute between types of different sizes, or dependently-sized types } unsafe fn k(x: Option) { let _: i32 = transmute(x); -//~^ ERROR transmute called with types of different sizes +//~^ ERROR cannot transmute between types of different sizes, or dependently-sized types } fn main() {} diff --git a/src/test/ui/transmute/transmute-type-parameters.stderr b/src/test/ui/transmute/transmute-type-parameters.stderr index ab0bd8fe2d8..a355a1bf318 100644 --- a/src/test/ui/transmute/transmute-type-parameters.stderr +++ b/src/test/ui/transmute/transmute-type-parameters.stderr @@ -1,56 +1,56 @@ -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-type-parameters.rs:21:18 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-type-parameters.rs:6:18 | LL | let _: i32 = transmute(x); | ^^^^^^^^^ | - = note: source type: T (this type's size can vary) - = note: target type: i32 (32 bits) + = note: source type: `T` (this type does not have a fixed size) + = note: target type: `i32` (32 bits) -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-type-parameters.rs:26:18 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-type-parameters.rs:11:18 | LL | let _: i32 = transmute(x); | ^^^^^^^^^ | - = note: source type: (T, i32) (size can vary because of T) - = note: target type: i32 (32 bits) + = note: source type: `(T, i32)` (size can vary because of T) + = note: target type: `i32` (32 bits) -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-type-parameters.rs:31:18 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-type-parameters.rs:16:18 | LL | let _: i32 = transmute(x); | ^^^^^^^^^ | - = note: source type: [T; 10] (size can vary because of T) - = note: target type: i32 (32 bits) + = note: source type: `[T; 10]` (size can vary because of T) + = note: target type: `i32` (32 bits) -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-type-parameters.rs:40:18 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-type-parameters.rs:25:18 | LL | let _: i32 = transmute(x); | ^^^^^^^^^ | - = note: source type: Bad (size can vary because of T) - = note: target type: i32 (32 bits) + = note: source type: `Bad` (size can vary because of T) + = note: target type: `i32` (32 bits) -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-type-parameters.rs:50:18 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-type-parameters.rs:35:18 | LL | let _: i32 = transmute(x); | ^^^^^^^^^ | - = note: source type: Worse (size can vary because of T) - = note: target type: i32 (32 bits) + = note: source type: `Worse` (size can vary because of T) + = note: target type: `i32` (32 bits) -error[E0512]: transmute called with types of different sizes - --> $DIR/transmute-type-parameters.rs:55:18 +error[E0512]: cannot transmute between types of different sizes, or dependently-sized types + --> $DIR/transmute-type-parameters.rs:40:18 | LL | let _: i32 = transmute(x); | ^^^^^^^^^ | - = note: source type: std::option::Option (size can vary because of T) - = note: target type: i32 (32 bits) + = note: source type: `std::option::Option` (size can vary because of T) + = note: target type: `i32` (32 bits) error: aborting due to 6 previous errors diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-associated-functions.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-associated-functions.rs index 49c9df95bc7..6450ddd1b67 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-associated-functions.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-associated-functions.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Inconsistent bounds with trait implementations diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr index 56897baeb4e..8b86dd9a4c9 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference - --> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:16:5 + --> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:6:5 | LL | fn reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- help: consider changing this to be a mutable reference: `&'a mut &'a mut i32` @@ -7,7 +7,7 @@ LL | *t //~ ERROR | ^^ `t` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference - --> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:20:6 + --> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:10:6 | LL | fn copy_reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- help: consider changing this to be a mutable reference: `&'a mut &'a mut i32` diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.rs index 2c4d9d81385..b1ff23fd097 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that reborrows are still illegal with Copy mutable references #![feature(trivial_bounds)] #![allow(unused)] diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr index bea2bb66857..a3995b7edef 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr @@ -1,5 +1,5 @@ error[E0389]: cannot borrow data mutably in a `&` reference - --> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:16:5 + --> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:6:5 | LL | fn reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- use `&'a mut &'a mut i32` here to make mutable @@ -7,7 +7,7 @@ LL | *t //~ ERROR | ^^ assignment into an immutable reference error[E0389]: cannot borrow data mutably in a `&` reference - --> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:20:6 + --> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:10:6 | LL | fn copy_reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- use `&'a mut &'a mut i32` here to make mutable diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs index 375885a02c7..bdbd64140f0 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check tautalogically false `Copy` bounds #![feature(trivial_bounds)] diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr index df4a6c83e50..12d61fc42a3 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr @@ -1,5 +1,5 @@ warning: Trait bound std::string::String: std::marker::Copy does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-copy.rs:16:51 + --> $DIR/trivial-bounds-inconsistent-copy.rs:6:51 | LL | fn copy_string(t: String) -> String where String: Copy { | ^^^^ @@ -7,19 +7,19 @@ LL | fn copy_string(t: String) -> String where String: Copy { = note: #[warn(trivial_bounds)] on by default warning: Trait bound std::string::String: std::marker::Copy does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-copy.rs:23:56 + --> $DIR/trivial-bounds-inconsistent-copy.rs:13:56 | LL | fn copy_out_string(t: &String) -> String where String: Copy { | ^^^^ warning: Trait bound std::string::String: std::marker::Copy does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-copy.rs:27:55 + --> $DIR/trivial-bounds-inconsistent-copy.rs:17:55 | LL | fn copy_string_with_param(x: String) where String: Copy { | ^^^^ warning: Trait bound for<'b> &'b mut i32: std::marker::Copy does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-copy.rs:33:76 + --> $DIR/trivial-bounds-inconsistent-copy.rs:23:76 | LL | fn copy_mut<'a>(t: &&'a mut i32) -> &'a mut i32 where for<'b> &'b mut i32: Copy { | ^^^^ diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.rs index 1a3bd3a8cd7..e0f2996307b 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(trivial_bounds)] #![allow(unused)] diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr index 0f720bee2b4..f769f23f115 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/trivial-bounds-inconsistent-projection-error.rs:30:5 + --> $DIR/trivial-bounds-inconsistent-projection-error.rs:20:5 | LL | fn global_bound_is_hidden() -> u8 | -- expected `u8` because of return type diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs index 8de6f06bf5f..fa2daeb11e9 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that global bounds result in the expected choice of associated type diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.stderr index e88b71c5c5a..561614dc528 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.stderr @@ -1,5 +1,5 @@ warning: Trait bound B: A does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-projection.rs:31:8 + --> $DIR/trivial-bounds-inconsistent-projection.rs:21:8 | LL | B: A | ^ @@ -7,37 +7,37 @@ LL | B: A = note: #[warn(trivial_bounds)] on by default warning: Trait bound B: A does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-projection.rs:38:8 + --> $DIR/trivial-bounds-inconsistent-projection.rs:28:8 | LL | B: A | ^^^^^^^^^^ warning: Trait bound B: A does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-projection.rs:45:8 + --> $DIR/trivial-bounds-inconsistent-projection.rs:35:8 | LL | B: A | ^^^^^^^^^ warning: Trait bound B: A does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-projection.rs:52:8 + --> $DIR/trivial-bounds-inconsistent-projection.rs:42:8 | LL | B: A + A | ^^^^^^^^^^ warning: Trait bound B: A does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-projection.rs:52:21 + --> $DIR/trivial-bounds-inconsistent-projection.rs:42:21 | LL | B: A + A | ^ warning: Trait bound B: A does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-projection.rs:59:8 + --> $DIR/trivial-bounds-inconsistent-projection.rs:49:8 | LL | B: A + A | ^^^^^^^^^ warning: Trait bound B: A does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-projection.rs:59:20 + --> $DIR/trivial-bounds-inconsistent-projection.rs:49:20 | LL | B: A + A | ^ diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs index 14ba11c44de..a5d5b937726 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check tautalogically false `Sized` bounds #![feature(trivial_bounds)] diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr index 493646aa46f..a9d2634c1ad 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr @@ -1,5 +1,5 @@ warning: Trait bound str: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-sized.rs:24:31 + --> $DIR/trivial-bounds-inconsistent-sized.rs:14:31 | LL | struct S(str, str) where str: Sized; | ^^^^^ @@ -7,13 +7,13 @@ LL | struct S(str, str) where str: Sized; = note: #[warn(trivial_bounds)] on by default warning: Trait bound for<'a> T<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-sized.rs:26:45 + --> $DIR/trivial-bounds-inconsistent-sized.rs:16:45 | LL | fn unsized_local() where for<'a> T: Sized { | ^^^^^ warning: Trait bound str: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-sized.rs:30:35 + --> $DIR/trivial-bounds-inconsistent-sized.rs:20:35 | LL | fn return_str() -> str where str: Sized { | ^^^^^ diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.rs index 5fcdbfc437a..cab2423d25d 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Test that inconsistent bounds are used in well-formedness checks #![feature(trivial_bounds)] diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.stderr index 052c45b73b9..a72e3f75cf6 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.stderr @@ -1,5 +1,5 @@ warning: Trait bound std::vec::Vec: std::fmt::Debug does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-well-formed.rs:17:30 + --> $DIR/trivial-bounds-inconsistent-well-formed.rs:7:30 | LL | pub fn foo() where Vec: Debug, str: Copy { | ^^^^^ @@ -7,7 +7,7 @@ LL | pub fn foo() where Vec: Debug, str: Copy { = note: #[warn(trivial_bounds)] on by default warning: Trait bound str: std::marker::Copy does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-well-formed.rs:17:42 + --> $DIR/trivial-bounds-inconsistent-well-formed.rs:7:42 | LL | pub fn foo() where Vec: Debug, str: Copy { | ^^^^ diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs index 2c8b873b8c9..fdbaec9a5c7 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that tautalogically false bounds are accepted, and are used diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr index 0cfab2fab86..744e146f830 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr @@ -1,5 +1,5 @@ warning: Trait bound i32: Foo does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:24:19 + --> $DIR/trivial-bounds-inconsistent.rs:14:19 | LL | enum E where i32: Foo { V } | ^^^ @@ -7,25 +7,25 @@ LL | enum E where i32: Foo { V } = note: #[warn(trivial_bounds)] on by default warning: Trait bound i32: Foo does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:26:21 + --> $DIR/trivial-bounds-inconsistent.rs:16:21 | LL | struct S where i32: Foo; | ^^^ warning: Trait bound i32: Foo does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:28:20 + --> $DIR/trivial-bounds-inconsistent.rs:18:20 | LL | trait T where i32: Foo {} | ^^^ warning: Trait bound i32: Foo does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:30:20 + --> $DIR/trivial-bounds-inconsistent.rs:20:20 | LL | union U where i32: Foo { f: i32 } | ^^^ warning: where clauses are not enforced in type aliases - --> $DIR/trivial-bounds-inconsistent.rs:32:14 + --> $DIR/trivial-bounds-inconsistent.rs:22:14 | LL | type Y where i32: Foo = (); | ^^^^^^^^ @@ -34,55 +34,55 @@ LL | type Y where i32: Foo = (); = help: the clause will not be checked when the type alias is used, and should be removed warning: Trait bound i32: Foo does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:32:19 + --> $DIR/trivial-bounds-inconsistent.rs:22:19 | LL | type Y where i32: Foo = (); | ^^^ warning: Trait bound i32: Foo does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:34:28 + --> $DIR/trivial-bounds-inconsistent.rs:24:28 | LL | impl Foo for () where i32: Foo { | ^^^ warning: Trait bound i32: Foo does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:42:19 + --> $DIR/trivial-bounds-inconsistent.rs:32:19 | LL | fn f() where i32: Foo { | ^^^ warning: Trait bound &'static str: Foo does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:49:28 + --> $DIR/trivial-bounds-inconsistent.rs:39:28 | LL | fn g() where &'static str: Foo { | ^^^ warning: Trait bound str: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:63:37 + --> $DIR/trivial-bounds-inconsistent.rs:53:37 | LL | struct TwoStrs(str, str) where str: Sized; | ^^^^^ warning: Trait bound for<'a> Dst<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:65:47 + --> $DIR/trivial-bounds-inconsistent.rs:55:47 | LL | fn unsized_local() where for<'a> Dst: Sized { | ^^^^^ warning: Trait bound str: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:69:35 + --> $DIR/trivial-bounds-inconsistent.rs:59:35 | LL | fn return_str() -> str where str: Sized { | ^^^^^ warning: Trait bound std::string::String: std::ops::Neg does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:73:46 + --> $DIR/trivial-bounds-inconsistent.rs:63:46 | LL | fn use_op(s: String) -> String where String: ::std::ops::Neg { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: Trait bound i32: std::iter::Iterator does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:77:25 + --> $DIR/trivial-bounds-inconsistent.rs:67:25 | LL | fn use_for() where i32: Iterator { | ^^^^^^^^ diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.rs b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.rs index 9850ec2bd1f..cecc0b2da0e 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that false Copy bounds don't leak #![feature(trivial_bounds)] diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr index 3c3fcbf9b80..b8e669d4a7c 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of borrowed content - --> $DIR/trivial-bounds-leak-copy.rs:19:5 + --> $DIR/trivial-bounds-leak-copy.rs:9:5 | LL | *t //~ ERROR | ^^ cannot move out of borrowed content diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak.rs b/src/test/ui/trivial-bounds/trivial-bounds-leak.rs index 98cb5b2b503..dc4f1c7f9fc 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that false bounds don't leak #![feature(trivial_bounds)] diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr index 984e492281f..aa055d3dc03 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr @@ -1,15 +1,15 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/trivial-bounds-leak.rs:22:25 + --> $DIR/trivial-bounds-leak.rs:12:25 | LL | fn cant_return_str() -> str { //~ ERROR | ^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: the return type of a function must have a statically known size error[E0599]: no method named `test` found for type `i32` in the current scope - --> $DIR/trivial-bounds-leak.rs:34:10 + --> $DIR/trivial-bounds-leak.rs:24:10 | LL | 3i32.test(); //~ ERROR | ^^^^ @@ -19,25 +19,25 @@ LL | 3i32.test(); //~ ERROR candidate #1: `Foo` error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/trivial-bounds-leak.rs:35:5 + --> $DIR/trivial-bounds-leak.rs:25:5 | LL | Foo::test(&4i32); //~ ERROR | ^^^^^^^^^ the trait `Foo` is not implemented for `i32` | note: required by `Foo::test` - --> $DIR/trivial-bounds-leak.rs:15:5 + --> $DIR/trivial-bounds-leak.rs:5:5 | LL | fn test(&self); | ^^^^^^^^^^^^^^^ error[E0277]: the trait bound `i32: Foo` is not satisfied - --> $DIR/trivial-bounds-leak.rs:36:5 + --> $DIR/trivial-bounds-leak.rs:26:5 | LL | generic_function(5i32); //~ ERROR | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | note: required by `generic_function` - --> $DIR/trivial-bounds-leak.rs:39:1 + --> $DIR/trivial-bounds-leak.rs:29:1 | LL | fn generic_function(t: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/trivial-bounds/trivial-bounds-lint.rs b/src/test/ui/trivial-bounds/trivial-bounds-lint.rs index e6988cb9f8b..078578372d0 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-lint.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-lint.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(trivial_bounds)] #![allow(unused)] #![deny(trivial_bounds)] diff --git a/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr b/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr index db8cbdc0932..6518e902878 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr @@ -1,47 +1,47 @@ error: Trait bound i32: std::marker::Copy does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-lint.rs:15:21 + --> $DIR/trivial-bounds-lint.rs:5:21 | LL | struct A where i32: Copy; //~ ERROR | ^^^^ | note: lint level defined here - --> $DIR/trivial-bounds-lint.rs:13:9 + --> $DIR/trivial-bounds-lint.rs:3:9 | LL | #![deny(trivial_bounds)] | ^^^^^^^^^^^^^^ error: Trait bound i32: X<()> does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-lint.rs:28:30 + --> $DIR/trivial-bounds-lint.rs:18:30 | LL | fn global_param() where i32: X<()> {} //~ ERROR | ^^^^^ error: Trait bound i32: Z does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-lint.rs:32:35 + --> $DIR/trivial-bounds-lint.rs:22:35 | LL | fn global_projection() where i32: Z {} //~ ERROR | ^^^^^^^^^^ error: Lifetime bound i32 : 'static does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-lint.rs:39:34 + --> $DIR/trivial-bounds-lint.rs:29:34 | LL | fn global_lifetimes() where i32: 'static, &'static str: 'static {} | ^^^^^^^ error: Lifetime bound &'static str : 'static does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-lint.rs:39:57 + --> $DIR/trivial-bounds-lint.rs:29:57 | LL | fn global_lifetimes() where i32: 'static, &'static str: 'static {} | ^^^^^^^ error: Lifetime bound 'static : 'static does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-lint.rs:45:37 + --> $DIR/trivial-bounds-lint.rs:35:37 | LL | fn global_outlives() where 'static: 'static {} //~ ERROR | ^^^^^^^ error: Trait bound i32: std::marker::Copy does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-lint.rs:48:46 + --> $DIR/trivial-bounds-lint.rs:38:46 | LL | fn mixed_bounds() where i32: X + Copy {} //~ ERROR | ^^^^ diff --git a/src/test/ui/trivial-bounds/trivial-bounds-object.rs b/src/test/ui/trivial-bounds/trivial-bounds-object.rs index 00986eefbda..f5feeea7cd4 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-object.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-object.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-pass // Check that the object bound dyn A + 'a: A is preferred over the // where clause bound dyn A + 'static: A. diff --git a/src/test/ui/trivial_casts.rs b/src/test/ui/trivial_casts.rs index 3f2bd2ffabf..c1f5441a36b 100644 --- a/src/test/ui/trivial_casts.rs +++ b/src/test/ui/trivial_casts.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test the trivial_casts and trivial_numeric_casts lints. For each error we also // check that the cast can be done using just coercion. diff --git a/src/test/ui/trivial_casts.stderr b/src/test/ui/trivial_casts.stderr index dc2a6a058bd..fb1db76b138 100644 --- a/src/test/ui/trivial_casts.stderr +++ b/src/test/ui/trivial_casts.stderr @@ -1,18 +1,18 @@ error: trivial numeric cast: `i32` as `i32` - --> $DIR/trivial_casts.rs:26:13 + --> $DIR/trivial_casts.rs:16:13 | LL | let _ = 42_i32 as i32; //~ ERROR trivial numeric cast: `i32` as `i32` | ^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/trivial_casts.rs:14:24 + --> $DIR/trivial_casts.rs:4:24 | LL | #![deny(trivial_casts, trivial_numeric_casts)] | ^^^^^^^^^^^^^^^^^^^^^ = help: cast can be replaced by coercion; this might require a temporary variable error: trivial numeric cast: `u8` as `u8` - --> $DIR/trivial_casts.rs:29:13 + --> $DIR/trivial_casts.rs:19:13 | LL | let _ = 42_u8 as u8; //~ ERROR trivial numeric cast: `u8` as `u8` | ^^^^^^^^^^^ @@ -20,20 +20,20 @@ LL | let _ = 42_u8 as u8; //~ ERROR trivial numeric cast: `u8` as `u8` = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&u32` as `*const u32` - --> $DIR/trivial_casts.rs:34:13 + --> $DIR/trivial_casts.rs:24:13 | LL | let _ = x as *const u32; //~ERROR trivial cast: `&u32` as `*const u32` | ^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/trivial_casts.rs:14:9 + --> $DIR/trivial_casts.rs:4:9 | LL | #![deny(trivial_casts, trivial_numeric_casts)] | ^^^^^^^^^^^^^ = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&mut u32` as `*mut u32` - --> $DIR/trivial_casts.rs:38:13 + --> $DIR/trivial_casts.rs:28:13 | LL | let _ = x as *mut u32; //~ERROR trivial cast: `&mut u32` as `*mut u32` | ^^^^^^^^^^^^^ @@ -41,7 +41,7 @@ LL | let _ = x as *mut u32; //~ERROR trivial cast: `&mut u32` as `*mut u32` = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&[u32; 3]` as `&[u32]` - --> $DIR/trivial_casts.rs:43:13 + --> $DIR/trivial_casts.rs:33:13 | LL | let _ = x as &[u32]; //~ERROR trivial cast: `&[u32; 3]` as `&[u32]` | ^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | let _ = x as &[u32]; //~ERROR trivial cast: `&[u32; 3]` as `&[u32]` = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&[u32; 3]` as `*const [u32]` - --> $DIR/trivial_casts.rs:44:13 + --> $DIR/trivial_casts.rs:34:13 | LL | let _ = x as *const [u32]; //~ERROR trivial cast: `&[u32; 3]` as `*const [u32]` | ^^^^^^^^^^^^^^^^^ @@ -57,7 +57,7 @@ LL | let _ = x as *const [u32]; //~ERROR trivial cast: `&[u32; 3]` as `*cons = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&mut [u32; 3]` as `&mut [u32]` - --> $DIR/trivial_casts.rs:49:13 + --> $DIR/trivial_casts.rs:39:13 | LL | let _ = x as &mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `&mut [u32]` | ^^^^^^^^^^^^^^^ @@ -65,7 +65,7 @@ LL | let _ = x as &mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `&mu = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&mut [u32; 3]` as `*mut [u32]` - --> $DIR/trivial_casts.rs:50:13 + --> $DIR/trivial_casts.rs:40:13 | LL | let _ = x as *mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `*mut [u32]` | ^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL | let _ = x as *mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `*mu = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `std::boxed::Box<[u32; 3]>` as `std::boxed::Box<[u32]>` - --> $DIR/trivial_casts.rs:55:13 + --> $DIR/trivial_casts.rs:45:13 | LL | let _ = x as Box<[u32]>; | ^^^^^^^^^^^^^^^ @@ -81,7 +81,7 @@ LL | let _ = x as Box<[u32]>; = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&Bar` as `&dyn Foo` - --> $DIR/trivial_casts.rs:62:13 + --> $DIR/trivial_casts.rs:52:13 | LL | let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo` | ^^^^^^^^^ @@ -89,7 +89,7 @@ LL | let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo` = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&Bar` as `*const dyn Foo` - --> $DIR/trivial_casts.rs:63:13 + --> $DIR/trivial_casts.rs:53:13 | LL | let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn Foo` | ^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL | let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn F = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&mut Bar` as `&mut dyn Foo` - --> $DIR/trivial_casts.rs:68:13 + --> $DIR/trivial_casts.rs:58:13 | LL | let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn Foo` | ^^^^^^^^^^^^^ @@ -105,7 +105,7 @@ LL | let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn F = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&mut Bar` as `*mut dyn Foo` - --> $DIR/trivial_casts.rs:69:13 + --> $DIR/trivial_casts.rs:59:13 | LL | let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo` | ^^^^^^^^^^^^^ @@ -113,7 +113,7 @@ LL | let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn F = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `std::boxed::Box` as `std::boxed::Box` - --> $DIR/trivial_casts.rs:74:13 + --> $DIR/trivial_casts.rs:64:13 | LL | let _ = x as Box; //~ERROR `std::boxed::Box` as `std::boxed::Box` | ^^^^^^^^^^^^^ @@ -121,15 +121,15 @@ LL | let _ = x as Box; //~ERROR `std::boxed::Box` as `std::boxed:: = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)` - --> $DIR/trivial_casts.rs:80:13 + --> $DIR/trivial_casts.rs:70:13 | LL | let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)` | ^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable -error: trivial cast: `&[closure@$DIR/trivial_casts.rs:82:13: 82:25]` as `&dyn std::ops::Fn(i32)` - --> $DIR/trivial_casts.rs:83:13 +error: trivial cast: `&[closure@$DIR/trivial_casts.rs:72:13: 72:25]` as `&dyn std::ops::Fn(i32)` + --> $DIR/trivial_casts.rs:73:13 | LL | let _ = &x as &Fn(i32); //~ERROR trivial cast | ^^^^^^^^^^^^^^ @@ -137,7 +137,7 @@ LL | let _ = &x as &Fn(i32); //~ERROR trivial cast = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&'a Bar` as `&'a Bar` - --> $DIR/trivial_casts.rs:89:13 + --> $DIR/trivial_casts.rs:79:13 | LL | let _ = a as &'a Bar; //~ERROR trivial cast | ^^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL | let _ = a as &'a Bar; //~ERROR trivial cast = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&'b Bar` as `&'a Bar` - --> $DIR/trivial_casts.rs:91:13 + --> $DIR/trivial_casts.rs:81:13 | LL | let _ = b as &'a Bar; //~ERROR trivial cast | ^^^^^^^^^^^^ @@ -153,7 +153,7 @@ LL | let _ = b as &'a Bar; //~ERROR trivial cast = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&'b Bar` as `&'b Bar` - --> $DIR/trivial_casts.rs:93:13 + --> $DIR/trivial_casts.rs:83:13 | LL | let _ = b as &'b Bar; //~ERROR trivial cast | ^^^^^^^^^^^^ diff --git a/src/test/ui/try-block/try-block-bad-lifetime.rs b/src/test/ui/try-block/try-block-bad-lifetime.rs index 576a0202018..872604f4eee 100644 --- a/src/test/ui/try-block/try-block-bad-lifetime.rs +++ b/src/test/ui/try-block/try-block-bad-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --edition 2018 #![feature(try_blocks)] diff --git a/src/test/ui/try-block/try-block-bad-lifetime.stderr b/src/test/ui/try-block/try-block-bad-lifetime.stderr index 061bc19cec9..b1b925d694f 100644 --- a/src/test/ui/try-block/try-block-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-bad-lifetime.stderr @@ -1,5 +1,5 @@ error[E0597]: `my_string` does not live long enough - --> $DIR/try-block-bad-lifetime.rs:25:33 + --> $DIR/try-block-bad-lifetime.rs:15:33 | LL | let result: Result<(), &str> = try { | ------ borrow later stored here @@ -11,7 +11,7 @@ LL | }; | - `my_string` dropped here while still borrowed error[E0506]: cannot assign to `i` because it is borrowed - --> $DIR/try-block-bad-lifetime.rs:39:13 + --> $DIR/try-block-bad-lifetime.rs:29:13 | LL | let k = &mut i; | ------ borrow of `i` occurs here @@ -23,18 +23,19 @@ LL | ::std::mem::drop(k); //~ ERROR use of moved value: `k` | - borrow later used here error[E0382]: use of moved value: `k` - --> $DIR/try-block-bad-lifetime.rs:41:26 + --> $DIR/try-block-bad-lifetime.rs:31:26 | +LL | let k = &mut i; + | - move occurs because `k` has type `&mut i32`, which does not implement the `Copy` trait +LL | let mut j: Result<(), &mut i32> = try { LL | Err(k) ?; | - value moved here ... LL | ::std::mem::drop(k); //~ ERROR use of moved value: `k` | ^ value used here after move - | - = note: move occurs because `k` has type `&mut i32`, which does not implement the `Copy` trait error[E0506]: cannot assign to `i` because it is borrowed - --> $DIR/try-block-bad-lifetime.rs:42:9 + --> $DIR/try-block-bad-lifetime.rs:32:9 | LL | let k = &mut i; | ------ borrow of `i` occurs here diff --git a/src/test/ui/try-block/try-block-bad-type.rs b/src/test/ui/try-block/try-block-bad-type.rs index a984b63af45..0e297dd8ff1 100644 --- a/src/test/ui/try-block/try-block-bad-type.rs +++ b/src/test/ui/try-block/try-block-bad-type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --edition 2018 #![feature(try_blocks)] diff --git a/src/test/ui/try-block/try-block-bad-type.stderr b/src/test/ui/try-block/try-block-bad-type.stderr index 159e43e13e4..df8e646280c 100644 --- a/src/test/ui/try-block/try-block-bad-type.stderr +++ b/src/test/ui/try-block/try-block-bad-type.stderr @@ -1,19 +1,19 @@ error[E0277]: the trait bound `i32: std::convert::From<&str>` is not satisfied - --> $DIR/try-block-bad-type.rs:17:9 + --> $DIR/try-block-bad-type.rs:7:9 | LL | Err("")?; //~ ERROR the trait bound `i32: std::convert::From<&str>` is not satisfied | ^^^^^^^^ the trait `std::convert::From<&str>` is not implemented for `i32` | = help: the following implementations were found: > + > > > - > - > + and 2 others = note: required by `std::convert::From::from` error[E0271]: type mismatch resolving ` as std::ops::Try>::Ok == &str` - --> $DIR/try-block-bad-type.rs:22:9 + --> $DIR/try-block-bad-type.rs:12:9 | LL | "" //~ ERROR type mismatch | ^^ expected i32, found &str @@ -22,7 +22,7 @@ LL | "" //~ ERROR type mismatch found type `&str` error[E0271]: type mismatch resolving ` as std::ops::Try>::Ok == ()` - --> $DIR/try-block-bad-type.rs:25:39 + --> $DIR/try-block-bad-type.rs:15:39 | LL | let res: Result = try { }; //~ ERROR type mismatch | ^ expected i32, found () @@ -31,7 +31,7 @@ LL | let res: Result = try { }; //~ ERROR type mismatch found type `()` error[E0277]: the trait bound `(): std::ops::Try` is not satisfied - --> $DIR/try-block-bad-type.rs:27:23 + --> $DIR/try-block-bad-type.rs:17:23 | LL | let res: () = try { }; //~ the trait bound `(): std::ops::Try` is not satisfied | ^^^ the trait `std::ops::Try` is not implemented for `()` @@ -39,7 +39,7 @@ LL | let res: () = try { }; //~ the trait bound `(): std::ops::Try` is not s = note: required by `std::ops::Try::from_ok` error[E0277]: the trait bound `i32: std::ops::Try` is not satisfied - --> $DIR/try-block-bad-type.rs:29:24 + --> $DIR/try-block-bad-type.rs:19:24 | LL | let res: i32 = try { 5 }; //~ ERROR the trait bound `i32: std::ops::Try` is not satisfied | ^^^^^ the trait `std::ops::Try` is not implemented for `i32` diff --git a/src/test/ui/try-block/try-block-in-edition2015.rs b/src/test/ui/try-block/try-block-in-edition2015.rs index 64485bb8318..00964297308 100644 --- a/src/test/ui/try-block/try-block-in-edition2015.rs +++ b/src/test/ui/try-block/try-block-in-edition2015.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --edition 2015 pub fn main() { diff --git a/src/test/ui/try-block/try-block-in-edition2015.stderr b/src/test/ui/try-block/try-block-in-edition2015.stderr index 7e6d515e111..a7b81060d3d 100644 --- a/src/test/ui/try-block/try-block-in-edition2015.stderr +++ b/src/test/ui/try-block/try-block-in-edition2015.stderr @@ -1,17 +1,21 @@ error: expected identifier, found keyword `let` - --> $DIR/try-block-in-edition2015.rs:16:9 + --> $DIR/try-block-in-edition2015.rs:6:9 | LL | let try_result: Option<_> = try { | --- while parsing this struct LL | //~^ ERROR expected struct, variant or union type, found macro `try` LL | let x = 5; //~ ERROR expected identifier, found keyword | ^^^ expected identifier, found keyword +help: you can escape reserved keywords to use them as identifiers + | +LL | r#let x = 5; //~ ERROR expected identifier, found keyword + | ^^^^^ error[E0574]: expected struct, variant or union type, found macro `try` - --> $DIR/try-block-in-edition2015.rs:14:33 + --> $DIR/try-block-in-edition2015.rs:4:33 | LL | let try_result: Option<_> = try { - | ^^^ did you mean `try!(...)`? + | ^^^ help: use `!` to invoke the macro: `try!` error: aborting due to 2 previous errors diff --git a/src/test/ui/try-block/try-block-in-match.rs b/src/test/ui/try-block/try-block-in-match.rs index d10149126ee..bce0d0340b6 100644 --- a/src/test/ui/try-block/try-block-in-match.rs +++ b/src/test/ui/try-block/try-block-in-match.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --edition 2018 #![feature(try_blocks)] diff --git a/src/test/ui/try-block/try-block-in-match.stderr b/src/test/ui/try-block/try-block-in-match.stderr index c9b43000877..089347073b5 100644 --- a/src/test/ui/try-block/try-block-in-match.stderr +++ b/src/test/ui/try-block/try-block-in-match.stderr @@ -1,5 +1,5 @@ error: expected expression, found reserved keyword `try` - --> $DIR/try-block-in-match.rs:16:11 + --> $DIR/try-block-in-match.rs:6:11 | LL | match try { false } { _ => {} } //~ ERROR expected expression, found reserved keyword `try` | ----- ^^^ expected expression diff --git a/src/test/ui/try-block/try-block-in-while.rs b/src/test/ui/try-block/try-block-in-while.rs index b531267a55b..98af796dd37 100644 --- a/src/test/ui/try-block/try-block-in-while.rs +++ b/src/test/ui/try-block/try-block-in-while.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --edition 2018 #![feature(try_blocks)] diff --git a/src/test/ui/try-block/try-block-in-while.stderr b/src/test/ui/try-block/try-block-in-while.stderr index 36577d784b8..b4f17778b29 100644 --- a/src/test/ui/try-block/try-block-in-while.stderr +++ b/src/test/ui/try-block/try-block-in-while.stderr @@ -1,5 +1,5 @@ error: expected expression, found reserved keyword `try` - --> $DIR/try-block-in-while.rs:16:11 + --> $DIR/try-block-in-while.rs:6:11 | LL | while try { false } {} //~ ERROR expected expression, found reserved keyword `try` | ^^^ expected expression diff --git a/src/test/ui/try-block/try-block-maybe-bad-lifetime.rs b/src/test/ui/try-block/try-block-maybe-bad-lifetime.rs index b5e0ebdbc22..113d089c757 100644 --- a/src/test/ui/try-block/try-block-maybe-bad-lifetime.rs +++ b/src/test/ui/try-block/try-block-maybe-bad-lifetime.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --edition 2018 #![feature(try_blocks)] diff --git a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr index 366a8da4b6e..dafbde6a515 100644 --- a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr @@ -1,5 +1,5 @@ error[E0506]: cannot assign to `i` because it is borrowed - --> $DIR/try-block-maybe-bad-lifetime.rs:27:9 + --> $DIR/try-block-maybe-bad-lifetime.rs:17:9 | LL | &i | -- borrow of `i` occurs here @@ -11,18 +11,19 @@ LL | do_something_with(x); | - borrow later used here error[E0382]: borrow of moved value: `x` - --> $DIR/try-block-maybe-bad-lifetime.rs:38:24 + --> $DIR/try-block-maybe-bad-lifetime.rs:28:24 | +LL | let x = String::new(); + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait +... LL | ::std::mem::drop(x); | - value moved here LL | }; LL | println!("{}", x); //~ ERROR borrow of moved value: `x` | ^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error[E0506]: cannot assign to `i` because it is borrowed - --> $DIR/try-block-maybe-bad-lifetime.rs:50:9 + --> $DIR/try-block-maybe-bad-lifetime.rs:40:9 | LL | j = &i; | -- borrow of `i` occurs here diff --git a/src/test/ui/try-block/try-block-opt-init.rs b/src/test/ui/try-block/try-block-opt-init.rs index ca81a9c3110..ef559226e67 100644 --- a/src/test/ui/try-block/try-block-opt-init.rs +++ b/src/test/ui/try-block/try-block-opt-init.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --edition 2018 #![feature(try_blocks)] diff --git a/src/test/ui/try-block/try-block-opt-init.stderr b/src/test/ui/try-block/try-block-opt-init.stderr index 3ebcb7dc37a..a0bc45d4fcd 100644 --- a/src/test/ui/try-block/try-block-opt-init.stderr +++ b/src/test/ui/try-block/try-block-opt-init.stderr @@ -1,5 +1,5 @@ error[E0381]: borrow of possibly uninitialized variable: `cfg_res` - --> $DIR/try-block-opt-init.rs:25:5 + --> $DIR/try-block-opt-init.rs:15:5 | LL | assert_eq!(cfg_res, 5); //~ ERROR borrow of possibly uninitialized variable: `cfg_res` | ^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `cfg_res` diff --git a/src/test/ui/try-block/try-block-type-error.rs b/src/test/ui/try-block/try-block-type-error.rs index 6a69cff4883..fe1993a37f6 100644 --- a/src/test/ui/try-block/try-block-type-error.rs +++ b/src/test/ui/try-block/try-block-type-error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: --edition 2018 #![feature(try_blocks)] diff --git a/src/test/ui/try-block/try-block-type-error.stderr b/src/test/ui/try-block/try-block-type-error.stderr index 3b67e92ec61..0cbd737debd 100644 --- a/src/test/ui/try-block/try-block-type-error.stderr +++ b/src/test/ui/try-block/try-block-type-error.stderr @@ -1,17 +1,17 @@ error[E0271]: type mismatch resolving ` as std::ops::Try>::Ok == {integer}` - --> $DIR/try-block-type-error.rs:20:9 + --> $DIR/try-block-type-error.rs:10:9 | LL | 42 | ^^ | | - | expected f32, found integral variable + | expected f32, found integer | help: use a float literal: `42.0` | = note: expected type `f32` found type `{integer}` error[E0271]: type mismatch resolving ` as std::ops::Try>::Ok == ()` - --> $DIR/try-block-type-error.rs:26:5 + --> $DIR/try-block-type-error.rs:16:5 | LL | }; | ^ expected i32, found () diff --git a/src/test/ui/try-on-option.rs b/src/test/ui/try-on-option.rs index 65ca23402d2..9c8e8b33ad6 100644 --- a/src/test/ui/try-on-option.rs +++ b/src/test/ui/try-on-option.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(try_trait)] fn main() {} diff --git a/src/test/ui/try-on-option.stderr b/src/test/ui/try-on-option.stderr index 265ee593bb7..438b3c2e343 100644 --- a/src/test/ui/try-on-option.stderr +++ b/src/test/ui/try-on-option.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `(): std::convert::From` is not satisfied - --> $DIR/try-on-option.rs:17:5 + --> $DIR/try-on-option.rs:7:5 | LL | x?; //~ the trait bound | ^^ the trait `std::convert::From` is not implemented for `()` @@ -7,7 +7,7 @@ LL | x?; //~ the trait bound = note: required by `std::convert::From::from` error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`) - --> $DIR/try-on-option.rs:23:5 + --> $DIR/try-on-option.rs:13:5 | LL | x?; //~ the `?` operator | ^^ cannot use the `?` operator in a function that returns `u32` diff --git a/src/test/ui/try-operator-on-main.rs b/src/test/ui/try-operator-on-main.rs index e52ef45c2ec..3b48194eb44 100644 --- a/src/test/ui/try-operator-on-main.rs +++ b/src/test/ui/try-operator-on-main.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-cloudabi no std::fs support #![feature(try_trait)] diff --git a/src/test/ui/try-operator-on-main.stderr b/src/test/ui/try-operator-on-main.stderr index 121ae14f999..9a2052f7283 100644 --- a/src/test/ui/try-operator-on-main.stderr +++ b/src/test/ui/try-operator-on-main.stderr @@ -1,5 +1,5 @@ error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`) - --> $DIR/try-operator-on-main.rs:19:5 + --> $DIR/try-operator-on-main.rs:9:5 | LL | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()` @@ -8,7 +8,7 @@ LL | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only = note: required by `std::ops::Try::from_error` error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` - --> $DIR/try-operator-on-main.rs:22:5 + --> $DIR/try-operator-on-main.rs:12:5 | LL | ()?; //~ ERROR the `?` operator can only | ^^^ the `?` operator cannot be applied to type `()` @@ -17,19 +17,19 @@ LL | ()?; //~ ERROR the `?` operator can only = note: required by `std::ops::Try::into_result` error[E0277]: the trait bound `(): std::ops::Try` is not satisfied - --> $DIR/try-operator-on-main.rs:25:5 + --> $DIR/try-operator-on-main.rs:15:5 | LL | try_trait_generic::<()>(); //~ ERROR the trait bound | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `()` | note: required by `try_trait_generic` - --> $DIR/try-operator-on-main.rs:30:1 + --> $DIR/try-operator-on-main.rs:20:1 | LL | fn try_trait_generic() -> T { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` - --> $DIR/try-operator-on-main.rs:32:5 + --> $DIR/try-operator-on-main.rs:22:5 | LL | ()?; //~ ERROR the `?` operator can only | ^^^ the `?` operator cannot be applied to type `()` diff --git a/src/test/ui/try-poll.rs b/src/test/ui/try-poll.rs index 0cb058c2b0b..3d7115c5223 100644 --- a/src/test/ui/try-poll.rs +++ b/src/test/ui/try-poll.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![allow(dead_code, unused)] diff --git a/src/test/ui/tuple/tuple-arity-mismatch.rs b/src/test/ui/tuple/tuple-arity-mismatch.rs index a71f4410294..1c8b881d246 100644 --- a/src/test/ui/tuple/tuple-arity-mismatch.rs +++ b/src/test/ui/tuple/tuple-arity-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #6155 fn first((value, _): (isize, f64)) -> isize { value } diff --git a/src/test/ui/tuple/tuple-arity-mismatch.stderr b/src/test/ui/tuple/tuple-arity-mismatch.stderr index 574a1f0a5c9..650f4c58c77 100644 --- a/src/test/ui/tuple/tuple-arity-mismatch.stderr +++ b/src/test/ui/tuple/tuple-arity-mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/tuple-arity-mismatch.rs:16:20 + --> $DIR/tuple-arity-mismatch.rs:6:20 | LL | let y = first ((1,2.0,3)); | ^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements @@ -8,7 +8,7 @@ LL | let y = first ((1,2.0,3)); found type `(isize, f64, {integer})` error[E0308]: mismatched types - --> $DIR/tuple-arity-mismatch.rs:22:20 + --> $DIR/tuple-arity-mismatch.rs:12:20 | LL | let y = first ((1,)); | ^^^^ expected a tuple with 2 elements, found one with 1 elements diff --git a/src/test/ui/tuple/tuple-float-index.fixed b/src/test/ui/tuple/tuple-float-index.fixed index 55bc2f77dad..cd1a85a9d24 100644 --- a/src/test/ui/tuple/tuple-float-index.fixed +++ b/src/test/ui/tuple/tuple-float-index.fixed @@ -1,15 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix -// compile-flags: -Z parse-only fn main () { ((1, (2, 3)).1).1; //~ ERROR unexpected token: `1.1` diff --git a/src/test/ui/tuple/tuple-float-index.rs b/src/test/ui/tuple/tuple-float-index.rs index d569ca4cb86..1faabac2bcd 100644 --- a/src/test/ui/tuple/tuple-float-index.rs +++ b/src/test/ui/tuple/tuple-float-index.rs @@ -1,15 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // run-rustfix -// compile-flags: -Z parse-only fn main () { (1, (2, 3)).1.1; //~ ERROR unexpected token: `1.1` diff --git a/src/test/ui/tuple/tuple-float-index.stderr b/src/test/ui/tuple/tuple-float-index.stderr index 15af0834f03..9a3e384b9d1 100644 --- a/src/test/ui/tuple/tuple-float-index.stderr +++ b/src/test/ui/tuple/tuple-float-index.stderr @@ -1,5 +1,5 @@ error: unexpected token: `1.1` - --> $DIR/tuple-float-index.rs:15:17 + --> $DIR/tuple-float-index.rs:4:17 | LL | (1, (2, 3)).1.1; //~ ERROR unexpected token: `1.1` | ------------^^^ diff --git a/src/test/ui/tuple/tuple-index-not-tuple.rs b/src/test/ui/tuple/tuple-index-not-tuple.rs index 471104d6872..c478e1c6769 100644 --- a/src/test/ui/tuple/tuple-index-not-tuple.rs +++ b/src/test/ui/tuple/tuple-index-not-tuple.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Point { x: isize, y: isize } struct Empty; diff --git a/src/test/ui/tuple/tuple-index-not-tuple.stderr b/src/test/ui/tuple/tuple-index-not-tuple.stderr index fa0d0b4172b..a1bcdfaedbc 100644 --- a/src/test/ui/tuple/tuple-index-not-tuple.stderr +++ b/src/test/ui/tuple/tuple-index-not-tuple.stderr @@ -1,11 +1,11 @@ error[E0609]: no field `0` on type `Point` - --> $DIR/tuple-index-not-tuple.rs:16:12 + --> $DIR/tuple-index-not-tuple.rs:6:12 | LL | origin.0; - | ^ did you mean `x`? + | ^ help: a field with a similar name exists: `x` error[E0609]: no field `0` on type `Empty` - --> $DIR/tuple-index-not-tuple.rs:18:11 + --> $DIR/tuple-index-not-tuple.rs:8:11 | LL | Empty.0; | ^ unknown field diff --git a/src/test/ui/tuple/tuple-index-out-of-bounds.rs b/src/test/ui/tuple/tuple-index-out-of-bounds.rs index 35b843676b4..c772c0daa18 100644 --- a/src/test/ui/tuple/tuple-index-out-of-bounds.rs +++ b/src/test/ui/tuple/tuple-index-out-of-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Point(i32, i32); fn main() { diff --git a/src/test/ui/tuple/tuple-index-out-of-bounds.stderr b/src/test/ui/tuple/tuple-index-out-of-bounds.stderr index 068e83ab091..7d7c5cd7892 100644 --- a/src/test/ui/tuple/tuple-index-out-of-bounds.stderr +++ b/src/test/ui/tuple/tuple-index-out-of-bounds.stderr @@ -1,11 +1,11 @@ error[E0609]: no field `2` on type `Point` - --> $DIR/tuple-index-out-of-bounds.rs:17:12 + --> $DIR/tuple-index-out-of-bounds.rs:7:12 | LL | origin.2; - | ^ did you mean `0`? + | ^ help: a field with a similar name exists: `0` error[E0609]: no field `2` on type `({integer}, {integer})` - --> $DIR/tuple-index-out-of-bounds.rs:22:11 + --> $DIR/tuple-index-out-of-bounds.rs:12:11 | LL | tuple.2; | ^ diff --git a/src/test/ui/tuple/tuple-struct-fields/test.rs b/src/test/ui/tuple/tuple-struct-fields/test.rs index c8b77bfabdb..00677090d78 100644 --- a/src/test/ui/tuple/tuple-struct-fields/test.rs +++ b/src/test/ui/tuple/tuple-struct-fields/test.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { type T = (); struct S1(pub(in foo) (), pub(T), pub(crate) (), pub(((), T))); diff --git a/src/test/ui/tuple/tuple-struct-fields/test.stderr b/src/test/ui/tuple/tuple-struct-fields/test.stderr index f83e9dd5458..295f0b146dd 100644 --- a/src/test/ui/tuple/tuple-struct-fields/test.stderr +++ b/src/test/ui/tuple/tuple-struct-fields/test.stderr @@ -1,11 +1,11 @@ error: expected one of `)` or `,`, found `(` - --> $DIR/test.rs:14:26 + --> $DIR/test.rs:4:26 | LL | struct S2(pub((foo)) ()); | ^ expected one of `)` or `,` here error[E0412]: cannot find type `foo` in this scope - --> $DIR/test.rs:14:20 + --> $DIR/test.rs:4:20 | LL | struct S2(pub((foo)) ()); | ^^^ not found in this scope diff --git a/src/test/ui/tuple/tuple-struct-fields/test2.rs b/src/test/ui/tuple/tuple-struct-fields/test2.rs index eead027cb13..fc0f78b12c9 100644 --- a/src/test/ui/tuple/tuple-struct-fields/test2.rs +++ b/src/test/ui/tuple/tuple-struct-fields/test2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! define_struct { ($t:ty) => { struct S1(pub $t); @@ -18,5 +8,7 @@ macro_rules! define_struct { } mod foo { - define_struct! { (foo) } + define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope } + +fn main() {} diff --git a/src/test/ui/tuple/tuple-struct-fields/test2.stderr b/src/test/ui/tuple/tuple-struct-fields/test2.stderr index 983e74772ac..80f0ddc0e4f 100644 --- a/src/test/ui/tuple/tuple-struct-fields/test2.stderr +++ b/src/test/ui/tuple/tuple-struct-fields/test2.stderr @@ -1,11 +1,18 @@ error: expected one of `)` or `,`, found `(` - --> $DIR/test2.rs:15:26 + --> $DIR/test2.rs:5:26 | LL | struct S3(pub $t ()); | ^ expected one of `)` or `,` here ... -LL | define_struct! { (foo) } +LL | define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope | ------------------------ in this macro invocation -error: aborting due to previous error +error[E0412]: cannot find type `foo` in this scope + --> $DIR/test2.rs:11:23 + | +LL | define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope + | ^^^ not found in this scope + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/tuple/tuple-struct-fields/test3.rs b/src/test/ui/tuple/tuple-struct-fields/test3.rs index d666c8abd3c..6b8534b4524 100644 --- a/src/test/ui/tuple/tuple-struct-fields/test3.rs +++ b/src/test/ui/tuple/tuple-struct-fields/test3.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! define_struct { ($t:ty) => { struct S1(pub($t)); @@ -18,5 +8,7 @@ macro_rules! define_struct { } mod foo { - define_struct! { foo } + define_struct! { foo } //~ ERROR cannot find type `foo` in this scope } + +fn main() {} diff --git a/src/test/ui/tuple/tuple-struct-fields/test3.stderr b/src/test/ui/tuple/tuple-struct-fields/test3.stderr index 6738595b997..fbc01744fe4 100644 --- a/src/test/ui/tuple/tuple-struct-fields/test3.stderr +++ b/src/test/ui/tuple/tuple-struct-fields/test3.stderr @@ -1,11 +1,18 @@ error: expected one of `)` or `,`, found `(` - --> $DIR/test3.rs:15:27 + --> $DIR/test3.rs:5:27 | LL | struct S3(pub($t) ()); | ^ expected one of `)` or `,` here ... -LL | define_struct! { foo } +LL | define_struct! { foo } //~ ERROR cannot find type `foo` in this scope | ---------------------- in this macro invocation -error: aborting due to previous error +error[E0412]: cannot find type `foo` in this scope + --> $DIR/test3.rs:11:22 + | +LL | define_struct! { foo } //~ ERROR cannot find type `foo` in this scope + | ^^^ not found in this scope + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/tuple/tuple-struct-nonexhaustive.rs b/src/test/ui/tuple/tuple-struct-nonexhaustive.rs index e4fda6dd534..76bcf3fbd4d 100644 --- a/src/test/ui/tuple/tuple-struct-nonexhaustive.rs +++ b/src/test/ui/tuple/tuple-struct-nonexhaustive.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo(isize, isize); fn main() { diff --git a/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr b/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr index ee274bedbb8..8d627fc2a8d 100644 --- a/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr +++ b/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr @@ -1,5 +1,5 @@ error[E0004]: non-exhaustive patterns: `Foo(_, _)` not covered - --> $DIR/tuple-struct-nonexhaustive.rs:15:11 + --> $DIR/tuple-struct-nonexhaustive.rs:5:11 | LL | match x { //~ ERROR non-exhaustive | ^ pattern `Foo(_, _)` not covered diff --git a/src/test/ui/tutorial-suffix-inference-test.rs b/src/test/ui/tutorial-suffix-inference-test.rs index dadf7eb91d8..2477c636530 100644 --- a/src/test/ui/tutorial-suffix-inference-test.rs +++ b/src/test/ui/tutorial-suffix-inference-test.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = 3; let y: i32 = 3; diff --git a/src/test/ui/tutorial-suffix-inference-test.stderr b/src/test/ui/tutorial-suffix-inference-test.stderr index d315f9b87f9..6ba1b098d19 100644 --- a/src/test/ui/tutorial-suffix-inference-test.stderr +++ b/src/test/ui/tutorial-suffix-inference-test.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/tutorial-suffix-inference-test.rs:19:18 + --> $DIR/tutorial-suffix-inference-test.rs:9:18 | LL | identity_u16(x); | ^ expected u16, found u8 @@ -9,13 +9,13 @@ LL | identity_u16(x.into()); | ^^^^^^^^ error[E0308]: mismatched types - --> $DIR/tutorial-suffix-inference-test.rs:22:18 + --> $DIR/tutorial-suffix-inference-test.rs:12:18 | LL | identity_u16(y); | ^ expected u16, found i32 error[E0308]: mismatched types - --> $DIR/tutorial-suffix-inference-test.rs:31:18 + --> $DIR/tutorial-suffix-inference-test.rs:21:18 | LL | identity_u16(a); | ^ expected u16, found isize diff --git a/src/test/ui/type-alias-enum-variants-panic.rs b/src/test/ui/type-alias-enum-variants-panic.rs new file mode 100644 index 00000000000..f97592f5d3b --- /dev/null +++ b/src/test/ui/type-alias-enum-variants-panic.rs @@ -0,0 +1,17 @@ +// ignore-tidy-linelength + +#![feature(type_alias_enum_variants)] + +#![allow(unreachable_code)] + +enum Enum { Variant {} } +type Alias = Enum; + +fn main() { + Alias::Variant; + //~^ ERROR expected unit struct/variant or constant, found struct variant `::Variant` [E0533] + let Alias::Variant = panic!(); + //~^ ERROR expected unit struct/variant or constant, found struct variant `::Variant` [E0533] + let Alias::Variant(..) = panic!(); + //~^ ERROR expected tuple struct/variant, found struct variant `::Variant` [E0164] +} diff --git a/src/test/ui/type-alias-enum-variants-panic.stderr b/src/test/ui/type-alias-enum-variants-panic.stderr new file mode 100644 index 00000000000..3480d116383 --- /dev/null +++ b/src/test/ui/type-alias-enum-variants-panic.stderr @@ -0,0 +1,22 @@ +error[E0533]: expected unit struct/variant or constant, found struct variant `::Variant` + --> $DIR/type-alias-enum-variants-panic.rs:11:5 + | +LL | Alias::Variant; + | ^^^^^^^^^^^^^^ + +error[E0533]: expected unit struct/variant or constant, found struct variant `::Variant` + --> $DIR/type-alias-enum-variants-panic.rs:13:9 + | +LL | let Alias::Variant = panic!(); + | ^^^^^^^^^^^^^^ + +error[E0164]: expected tuple struct/variant, found struct variant `::Variant` + --> $DIR/type-alias-enum-variants-panic.rs:15:9 + | +LL | let Alias::Variant(..) = panic!(); + | ^^^^^^^^^^^^^^^^^^ not a tuple variant or struct + +error: aborting due to 3 previous errors + +Some errors occurred: E0164, E0533. +For more information about an error, try `rustc --explain E0164`. diff --git a/src/test/ui/type-alias-enum-variants-priority-2.rs b/src/test/ui/type-alias-enum-variants-priority-2.rs new file mode 100644 index 00000000000..295f8acf62f --- /dev/null +++ b/src/test/ui/type-alias-enum-variants-priority-2.rs @@ -0,0 +1,13 @@ +#![feature(type_alias_enum_variants)] + +enum E { + V(u8) +} + +impl E { + fn V() {} +} + +fn main() { + ::V(); //~ ERROR this function takes 1 parameter but 0 parameters were supplied +} diff --git a/src/test/ui/type-alias-enum-variants-priority-2.stderr b/src/test/ui/type-alias-enum-variants-priority-2.stderr new file mode 100644 index 00000000000..c6ec96ebb7d --- /dev/null +++ b/src/test/ui/type-alias-enum-variants-priority-2.stderr @@ -0,0 +1,12 @@ +error[E0061]: this function takes 1 parameter but 0 parameters were supplied + --> $DIR/type-alias-enum-variants-priority-2.rs:12:5 + | +LL | V(u8) + | ----- defined here +... +LL | ::V(); //~ ERROR this function takes 1 parameter but 0 parameters were supplied + | ^^^^^^^^ expected 1 parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0061`. diff --git a/src/test/ui/type-alias-enum-variants-priority-3.rs b/src/test/ui/type-alias-enum-variants-priority-3.rs new file mode 100644 index 00000000000..33f96553b57 --- /dev/null +++ b/src/test/ui/type-alias-enum-variants-priority-3.rs @@ -0,0 +1,10 @@ +#![feature(type_alias_enum_variants)] + +enum E { + V +} + +fn check() -> ::V {} +//~^ ERROR expected type, found variant `V` + +fn main() {} diff --git a/src/test/ui/type-alias-enum-variants-priority-3.stderr b/src/test/ui/type-alias-enum-variants-priority-3.stderr new file mode 100644 index 00000000000..b3451542a25 --- /dev/null +++ b/src/test/ui/type-alias-enum-variants-priority-3.stderr @@ -0,0 +1,8 @@ +error: expected type, found variant `V` + --> $DIR/type-alias-enum-variants-priority-3.rs:7:15 + | +LL | fn check() -> ::V {} + | ^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/type-alias-enum-variants-priority.rs b/src/test/ui/type-alias-enum-variants-priority.rs new file mode 100644 index 00000000000..db1da2b12e2 --- /dev/null +++ b/src/test/ui/type-alias-enum-variants-priority.rs @@ -0,0 +1,20 @@ +#![feature(type_alias_enum_variants)] +#![deny(ambiguous_associated_items)] + +enum E { + V +} + +trait Tr { + type V; + fn f() -> Self::V; +} + +impl Tr for E { + type V = u8; + fn f() -> Self::V { 0 } + //~^ ERROR ambiguous associated item + //~| WARN this was previously accepted +} + +fn main() {} diff --git a/src/test/ui/type-alias-enum-variants-priority.stderr b/src/test/ui/type-alias-enum-variants-priority.stderr new file mode 100644 index 00000000000..dcf7dc77ed5 --- /dev/null +++ b/src/test/ui/type-alias-enum-variants-priority.stderr @@ -0,0 +1,26 @@ +error: ambiguous associated item + --> $DIR/type-alias-enum-variants-priority.rs:15:15 + | +LL | fn f() -> Self::V { 0 } + | ^^^^^^^ help: use fully-qualified syntax: `::V` + | +note: lint level defined here + --> $DIR/type-alias-enum-variants-priority.rs:2:9 + | +LL | #![deny(ambiguous_associated_items)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57644 +note: `V` could refer to variant defined here + --> $DIR/type-alias-enum-variants-priority.rs:5:5 + | +LL | V + | ^ +note: `V` could also refer to associated type defined here + --> $DIR/type-alias-enum-variants-priority.rs:9:5 + | +LL | type V; + | ^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/type-alias-enum-variants.rs b/src/test/ui/type-alias-enum-variants.rs new file mode 100644 index 00000000000..3ec200d57c5 --- /dev/null +++ b/src/test/ui/type-alias-enum-variants.rs @@ -0,0 +1,11 @@ +#![feature(type_alias_enum_variants)] + +type Alias = Option; + +fn main() { + let _ = Option::::None; // OK + let _ = Option::None::; // OK (Lint in future!) + let _ = Alias::::None; // OK + let _ = Alias::None::; // Error + //~^ type arguments are not allowed on this entity +} diff --git a/src/test/ui/type-alias-enum-variants.stderr b/src/test/ui/type-alias-enum-variants.stderr new file mode 100644 index 00000000000..cf81f5b27ac --- /dev/null +++ b/src/test/ui/type-alias-enum-variants.stderr @@ -0,0 +1,9 @@ +error[E0109]: type arguments are not allowed on this entity + --> $DIR/type-alias-enum-variants.rs:9:27 + | +LL | let _ = Alias::None::; // Error + | ^^ type argument not allowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0109`. diff --git a/src/test/ui/type/auxiliary/crate_a1.rs b/src/test/ui/type/auxiliary/crate_a1.rs index 70f7cac94de..e2e18500541 100644 --- a/src/test/ui/type/auxiliary/crate_a1.rs +++ b/src/test/ui/type/auxiliary/crate_a1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo; pub trait Bar{} diff --git a/src/test/ui/type/auxiliary/crate_a2.rs b/src/test/ui/type/auxiliary/crate_a2.rs index d801f25ba2e..d16a4ac10e0 100644 --- a/src/test/ui/type/auxiliary/crate_a2.rs +++ b/src/test/ui/type/auxiliary/crate_a2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub struct Foo; pub trait Bar{} diff --git a/src/test/ui/type/type-alias-bounds.rs b/src/test/ui/type/type-alias-bounds.rs index a17bb9e952d..e2be2b98902 100644 --- a/src/test/ui/type/type-alias-bounds.rs +++ b/src/test/ui/type/type-alias-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test ignored_generic_bounds lint warning about bounds in type aliases // compile-pass @@ -48,7 +38,7 @@ fn foo<'a>(y: &'a i32) { x.1.push(y); // &'a i32: 'static does not hold } -// Bounds are not checked either, i.e. the definition is not necessarily well-formed +// Bounds are not checked either, i.e., the definition is not necessarily well-formed struct Sendable(T); type MySendable = Sendable; // no error here! diff --git a/src/test/ui/type/type-alias-bounds.stderr b/src/test/ui/type/type-alias-bounds.stderr index 2a2b0b0f26e..b13e4001052 100644 --- a/src/test/ui/type/type-alias-bounds.stderr +++ b/src/test/ui/type/type-alias-bounds.stderr @@ -1,5 +1,5 @@ warning: bounds on generic parameters are not enforced in type aliases - --> $DIR/type-alias-bounds.rs:18:14 + --> $DIR/type-alias-bounds.rs:8:14 | LL | type SVec = Vec; | ^^^^ ^^^^ @@ -8,7 +8,7 @@ LL | type SVec = Vec; = help: the bound will not be checked when the type alias is used, and should be removed warning: where clauses are not enforced in type aliases - --> $DIR/type-alias-bounds.rs:20:21 + --> $DIR/type-alias-bounds.rs:10:21 | LL | type S2Vec where T: Send = Vec; | ^^^^^^^ @@ -16,7 +16,7 @@ LL | type S2Vec where T: Send = Vec; = help: the clause will not be checked when the type alias is used, and should be removed warning: bounds on generic parameters are not enforced in type aliases - --> $DIR/type-alias-bounds.rs:22:19 + --> $DIR/type-alias-bounds.rs:12:19 | LL | type VVec<'b, 'a: 'b+'b> = (&'b u32, Vec<&'a i32>); | ^^ ^^ @@ -24,7 +24,7 @@ LL | type VVec<'b, 'a: 'b+'b> = (&'b u32, Vec<&'a i32>); = help: the bound will not be checked when the type alias is used, and should be removed warning: bounds on generic parameters are not enforced in type aliases - --> $DIR/type-alias-bounds.rs:24:18 + --> $DIR/type-alias-bounds.rs:14:18 | LL | type WVec<'b, T: 'b+'b> = (&'b u32, Vec); | ^^ ^^ @@ -32,7 +32,7 @@ LL | type WVec<'b, T: 'b+'b> = (&'b u32, Vec); = help: the bound will not be checked when the type alias is used, and should be removed warning: where clauses are not enforced in type aliases - --> $DIR/type-alias-bounds.rs:26:25 + --> $DIR/type-alias-bounds.rs:16:25 | LL | type W2Vec<'b, T> where T: 'b, T: 'b = (&'b u32, Vec); | ^^^^^ ^^^^^ @@ -40,33 +40,33 @@ LL | type W2Vec<'b, T> where T: 'b, T: 'b = (&'b u32, Vec); = help: the clause will not be checked when the type alias is used, and should be removed warning: bounds on generic parameters are not enforced in type aliases - --> $DIR/type-alias-bounds.rs:57:12 + --> $DIR/type-alias-bounds.rs:47:12 | LL | type T1 = U::Assoc; //~ WARN not enforced in type aliases | ^^^^^ | = help: the bound will not be checked when the type alias is used, and should be removed help: use fully disambiguated paths (i.e., `::Assoc`) to refer to associated types in type aliases - --> $DIR/type-alias-bounds.rs:57:21 + --> $DIR/type-alias-bounds.rs:47:21 | LL | type T1 = U::Assoc; //~ WARN not enforced in type aliases | ^^^^^^^^ warning: where clauses are not enforced in type aliases - --> $DIR/type-alias-bounds.rs:58:18 + --> $DIR/type-alias-bounds.rs:48:18 | LL | type T2 where U: Bound = U::Assoc; //~ WARN not enforced in type aliases | ^^^^^^^^ | = help: the clause will not be checked when the type alias is used, and should be removed help: use fully disambiguated paths (i.e., `::Assoc`) to refer to associated types in type aliases - --> $DIR/type-alias-bounds.rs:58:29 + --> $DIR/type-alias-bounds.rs:48:29 | LL | type T2 where U: Bound = U::Assoc; //~ WARN not enforced in type aliases | ^^^^^^^^ warning: bounds on generic parameters are not enforced in type aliases - --> $DIR/type-alias-bounds.rs:66:12 + --> $DIR/type-alias-bounds.rs:56:12 | LL | type T5 = ::Assoc; //~ WARN not enforced in type aliases | ^^^^^ @@ -74,7 +74,7 @@ LL | type T5 = ::Assoc; //~ WARN not enforced in type ali = help: the bound will not be checked when the type alias is used, and should be removed warning: bounds on generic parameters are not enforced in type aliases - --> $DIR/type-alias-bounds.rs:67:12 + --> $DIR/type-alias-bounds.rs:57:12 | LL | type T6 = ::std::vec::Vec; //~ WARN not enforced in type aliases | ^^^^^ diff --git a/src/test/ui/type/type-annotation-needed.rs b/src/test/ui/type/type-annotation-needed.rs index 3ed6e5daf00..ff2342c4455 100644 --- a/src/test/ui/type/type-annotation-needed.rs +++ b/src/test/ui/type/type-annotation-needed.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo>(x: i32) {} //~^ NOTE required by diff --git a/src/test/ui/type/type-annotation-needed.stderr b/src/test/ui/type/type-annotation-needed.stderr index d48891596df..92ae9746b15 100644 --- a/src/test/ui/type/type-annotation-needed.stderr +++ b/src/test/ui/type/type-annotation-needed.stderr @@ -1,11 +1,11 @@ error[E0283]: type annotations required: cannot resolve `_: std::convert::Into` - --> $DIR/type-annotation-needed.rs:15:5 + --> $DIR/type-annotation-needed.rs:5:5 | LL | foo(42); | ^^^ | note: required by `foo` - --> $DIR/type-annotation-needed.rs:11:1 + --> $DIR/type-annotation-needed.rs:1:1 | LL | fn foo>(x: i32) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/type/type-arg-out-of-scope.rs b/src/test/ui/type/type-arg-out-of-scope.rs index 04cd961e97f..b96c9bf6a0e 100644 --- a/src/test/ui/type/type-arg-out-of-scope.rs +++ b/src/test/ui/type/type-arg-out-of-scope.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:can't use type parameters from outer function fn foo(x: T) { fn bar(f: Box T>) { } diff --git a/src/test/ui/type/type-arg-out-of-scope.stderr b/src/test/ui/type/type-arg-out-of-scope.stderr index 20bf303129f..62b6a86662d 100644 --- a/src/test/ui/type/type-arg-out-of-scope.stderr +++ b/src/test/ui/type/type-arg-out-of-scope.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use type parameters from outer function - --> $DIR/type-arg-out-of-scope.rs:13:25 + --> $DIR/type-arg-out-of-scope.rs:3:25 | LL | fn foo(x: T) { | - type variable from outer function @@ -9,7 +9,7 @@ LL | fn bar(f: Box T>) { } | help: try using a local type parameter instead: `bar` error[E0401]: can't use type parameters from outer function - --> $DIR/type-arg-out-of-scope.rs:13:31 + --> $DIR/type-arg-out-of-scope.rs:3:31 | LL | fn foo(x: T) { | - type variable from outer function diff --git a/src/test/ui/type/type-ascription-instead-of-initializer.rs b/src/test/ui/type/type-ascription-instead-of-initializer.rs index d80dad8fbd4..aef25250b15 100644 --- a/src/test/ui/type/type-ascription-instead-of-initializer.rs +++ b/src/test/ui/type/type-ascription-instead-of-initializer.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` //~^ ERROR this function takes 1 parameter diff --git a/src/test/ui/type/type-ascription-instead-of-initializer.stderr b/src/test/ui/type/type-ascription-instead-of-initializer.stderr index 3722d2a0e3f..8ce367d70f0 100644 --- a/src/test/ui/type/type-ascription-instead-of-initializer.stderr +++ b/src/test/ui/type/type-ascription-instead-of-initializer.stderr @@ -1,5 +1,5 @@ error: expected type, found `10` - --> $DIR/type-ascription-instead-of-initializer.rs:12:31 + --> $DIR/type-ascription-instead-of-initializer.rs:2:31 | LL | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` | -- ^^ @@ -8,7 +8,7 @@ LL | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` | while parsing the type for `x` error[E0061]: this function takes 1 parameter but 2 parameters were supplied - --> $DIR/type-ascription-instead-of-initializer.rs:12:12 + --> $DIR/type-ascription-instead-of-initializer.rs:2:12 | LL | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 parameter diff --git a/src/test/ui/type/type-ascription-instead-of-statement-end.rs b/src/test/ui/type/type-ascription-instead-of-statement-end.rs index 01d773dd5e1..1d5565ab583 100644 --- a/src/test/ui/type/type-ascription-instead-of-statement-end.rs +++ b/src/test/ui/type/type-ascription-instead-of-statement-end.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(type_ascription)] fn main() { diff --git a/src/test/ui/type/type-ascription-instead-of-statement-end.stderr b/src/test/ui/type/type-ascription-instead-of-statement-end.stderr index 314c9060d4f..db99d1ec07b 100644 --- a/src/test/ui/type/type-ascription-instead-of-statement-end.stderr +++ b/src/test/ui/type/type-ascription-instead-of-statement-end.stderr @@ -1,5 +1,5 @@ error: expected type, found `0` - --> $DIR/type-ascription-instead-of-statement-end.rs:15:5 + --> $DIR/type-ascription-instead-of-statement-end.rs:5:5 | LL | println!("test"): | - help: try using a semicolon: `;` @@ -7,7 +7,7 @@ LL | 0; //~ ERROR expected type, found `0` | ^ expecting a type here because of type ascription error: expected type, found `0` - --> $DIR/type-ascription-instead-of-statement-end.rs:19:23 + --> $DIR/type-ascription-instead-of-statement-end.rs:9:23 | LL | println!("test"): 0; //~ ERROR expected type, found `0` | ^ expecting a type here because of type ascription diff --git a/src/test/ui/type/type-ascription-precedence.rs b/src/test/ui/type/type-ascription-precedence.rs index bb7a8bc3ddf..d3aef929b9f 100644 --- a/src/test/ui/type/type-ascription-precedence.rs +++ b/src/test/ui/type/type-ascription-precedence.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Operator precedence of type ascription // Type ascription has very high precedence, the same as operator `as` diff --git a/src/test/ui/type/type-ascription-precedence.stderr b/src/test/ui/type/type-ascription-precedence.stderr index 252b5231220..e52e2bc5e9a 100644 --- a/src/test/ui/type/type-ascription-precedence.stderr +++ b/src/test/ui/type/type-ascription-precedence.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/type-ascription-precedence.rs:41:7 + --> $DIR/type-ascription-precedence.rs:31:7 | LL | &(S: &S); //~ ERROR mismatched types | ^ expected &S, found struct `S` @@ -8,7 +8,7 @@ LL | &(S: &S); //~ ERROR mismatched types found type `S` error[E0308]: mismatched types - --> $DIR/type-ascription-precedence.rs:45:7 + --> $DIR/type-ascription-precedence.rs:35:7 | LL | *(S: Z); //~ ERROR mismatched types | ^ expected struct `Z`, found struct `S` @@ -17,13 +17,13 @@ LL | *(S: Z); //~ ERROR mismatched types found type `S` error[E0614]: type `Z` cannot be dereferenced - --> $DIR/type-ascription-precedence.rs:45:5 + --> $DIR/type-ascription-precedence.rs:35:5 | LL | *(S: Z); //~ ERROR mismatched types | ^^^^^^^ error[E0308]: mismatched types - --> $DIR/type-ascription-precedence.rs:50:7 + --> $DIR/type-ascription-precedence.rs:40:7 | LL | -(S: Z); //~ ERROR mismatched types | ^ expected struct `Z`, found struct `S` @@ -32,7 +32,7 @@ LL | -(S: Z); //~ ERROR mismatched types found type `S` error[E0600]: cannot apply unary operator `-` to type `Z` - --> $DIR/type-ascription-precedence.rs:50:5 + --> $DIR/type-ascription-precedence.rs:40:5 | LL | -(S: Z); //~ ERROR mismatched types | ^^^^^^^ cannot apply unary operator `-` @@ -40,7 +40,7 @@ LL | -(S: Z); //~ ERROR mismatched types = note: an implementation of `std::ops::Neg` might be missing for `Z` error[E0308]: mismatched types - --> $DIR/type-ascription-precedence.rs:55:5 + --> $DIR/type-ascription-precedence.rs:45:5 | LL | (S + Z): Z; //~ ERROR mismatched types | ^^^^^^^ expected struct `Z`, found struct `S` @@ -49,7 +49,7 @@ LL | (S + Z): Z; //~ ERROR mismatched types found type `S` error[E0308]: mismatched types - --> $DIR/type-ascription-precedence.rs:59:5 + --> $DIR/type-ascription-precedence.rs:49:5 | LL | (S * Z): Z; //~ ERROR mismatched types | ^^^^^^^ expected struct `Z`, found struct `S` @@ -58,7 +58,7 @@ LL | (S * Z): Z; //~ ERROR mismatched types found type `S` error[E0308]: mismatched types - --> $DIR/type-ascription-precedence.rs:63:5 + --> $DIR/type-ascription-precedence.rs:53:5 | LL | (S .. S): S; //~ ERROR mismatched types | ^^^^^^^^ expected struct `S`, found struct `std::ops::Range` diff --git a/src/test/ui/type/type-ascription-soundness.rs b/src/test/ui/type/type-ascription-soundness.rs index 2d882e87ab8..d583fc2131a 100644 --- a/src/test/ui/type/type-ascription-soundness.rs +++ b/src/test/ui/type/type-ascription-soundness.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Type ascription doesn't lead to unsoundness #![feature(type_ascription)] diff --git a/src/test/ui/type/type-ascription-soundness.stderr b/src/test/ui/type/type-ascription-soundness.stderr index 3dcd6ff49b3..f681a042302 100644 --- a/src/test/ui/type/type-ascription-soundness.stderr +++ b/src/test/ui/type/type-ascription-soundness.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/type-ascription-soundness.rs:17:17 + --> $DIR/type-ascription-soundness.rs:7:17 | LL | let ref x = arr: &[u8]; //~ ERROR mismatched types | ^^^ expected slice, found array of 3 elements @@ -8,7 +8,7 @@ LL | let ref x = arr: &[u8]; //~ ERROR mismatched types found type `&[u8; 3]` error[E0308]: mismatched types - --> $DIR/type-ascription-soundness.rs:18:21 + --> $DIR/type-ascription-soundness.rs:8:21 | LL | let ref mut x = arr: &[u8]; //~ ERROR mismatched types | ^^^ expected slice, found array of 3 elements @@ -17,7 +17,7 @@ LL | let ref mut x = arr: &[u8]; //~ ERROR mismatched types found type `&[u8; 3]` error[E0308]: mismatched types - --> $DIR/type-ascription-soundness.rs:19:11 + --> $DIR/type-ascription-soundness.rs:9:11 | LL | match arr: &[u8] { //~ ERROR mismatched types | ^^^ expected slice, found array of 3 elements @@ -26,7 +26,7 @@ LL | match arr: &[u8] { //~ ERROR mismatched types found type `&[u8; 3]` error[E0308]: mismatched types - --> $DIR/type-ascription-soundness.rs:22:17 + --> $DIR/type-ascription-soundness.rs:12:17 | LL | let _len = (arr: &[u8]).len(); //~ ERROR mismatched types | ^^^ expected slice, found array of 3 elements diff --git a/src/test/ui/type/type-ascription-with-fn-call.rs b/src/test/ui/type/type-ascription-with-fn-call.rs index b2c25c37e8e..2bd2efa4d38 100644 --- a/src/test/ui/type/type-ascription-with-fn-call.rs +++ b/src/test/ui/type/type-ascription-with-fn-call.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(type_ascription)] fn main() { diff --git a/src/test/ui/type/type-ascription-with-fn-call.stderr b/src/test/ui/type/type-ascription-with-fn-call.stderr index 78df97139b6..a290e69e0cb 100644 --- a/src/test/ui/type/type-ascription-with-fn-call.stderr +++ b/src/test/ui/type/type-ascription-with-fn-call.stderr @@ -1,5 +1,5 @@ error[E0573]: expected type, found function `f` - --> $DIR/type-ascription-with-fn-call.rs:15:5 + --> $DIR/type-ascription-with-fn-call.rs:5:5 | LL | f() : | - help: did you mean to use `;` here instead? diff --git a/src/test/ui/type/type-check-defaults.rs b/src/test/ui/type/type-check-defaults.rs index 92a45db0689..5748c9bcff8 100644 --- a/src/test/ui/type/type-check-defaults.rs +++ b/src/test/ui/type/type-check-defaults.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::iter::FromIterator; use std::vec::IntoIter; use std::ops::Add; diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index f6d7086679a..a46d79ec318 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -1,87 +1,87 @@ error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` - --> $DIR/type-check-defaults.rs:16:19 + --> $DIR/type-check-defaults.rs:6:19 | LL | struct WellFormed>(Z); | ^ a collection of type `i32` cannot be built from `std::iter::Iterator` | = help: the trait `std::iter::FromIterator` is not implemented for `i32` note: required by `Foo` - --> $DIR/type-check-defaults.rs:15:1 + --> $DIR/type-check-defaults.rs:5:1 | LL | struct Foo>(T, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` - --> $DIR/type-check-defaults.rs:18:27 + --> $DIR/type-check-defaults.rs:8:27 | LL | struct WellFormedNoBounds>(Z); | ^ a collection of type `i32` cannot be built from `std::iter::Iterator` | = help: the trait `std::iter::FromIterator` is not implemented for `i32` note: required by `Foo` - --> $DIR/type-check-defaults.rs:15:1 + --> $DIR/type-check-defaults.rs:5:1 | LL | struct Foo>(T, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied - --> $DIR/type-check-defaults.rs:21:1 + --> $DIR/type-check-defaults.rs:11:1 | LL | struct Bounds(T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | note: required by `Bounds` - --> $DIR/type-check-defaults.rs:21:1 + --> $DIR/type-check-defaults.rs:11:1 | LL | struct Bounds(T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied - --> $DIR/type-check-defaults.rs:24:1 + --> $DIR/type-check-defaults.rs:14:1 | LL | struct WhereClause(T) where T: Copy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | note: required by `WhereClause` - --> $DIR/type-check-defaults.rs:24:1 + --> $DIR/type-check-defaults.rs:14:1 | LL | struct WhereClause(T) where T: Copy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied - --> $DIR/type-check-defaults.rs:27:1 + --> $DIR/type-check-defaults.rs:17:1 | LL | trait TraitBound {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | note: required by `TraitBound` - --> $DIR/type-check-defaults.rs:27:1 + --> $DIR/type-check-defaults.rs:17:1 | LL | trait TraitBound {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/type-check-defaults.rs:31:1 + --> $DIR/type-check-defaults.rs:21:1 | LL | trait Base: Super { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound note: required by `Super` - --> $DIR/type-check-defaults.rs:30:1 + --> $DIR/type-check-defaults.rs:20:1 | LL | trait Super { } | ^^^^^^^^^^^^^^^^^^^^ error[E0277]: cannot add `u8` to `i32` - --> $DIR/type-check-defaults.rs:34:1 + --> $DIR/type-check-defaults.rs:24:1 | LL | trait ProjectionPred> where T::Item : Add {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u8` | = help: the trait `std::ops::Add` is not implemented for `i32` note: required by `ProjectionPred` - --> $DIR/type-check-defaults.rs:34:1 + --> $DIR/type-check-defaults.rs:24:1 | LL | trait ProjectionPred> where T::Item : Add {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/type/type-check/assignment-in-if.rs b/src/test/ui/type/type-check/assignment-in-if.rs index d4d070ecaef..232b0a00b30 100644 --- a/src/test/ui/type/type-check/assignment-in-if.rs +++ b/src/test/ui/type/type-check/assignment-in-if.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the parser does not attempt to parse struct literals // within assignments in if expressions. diff --git a/src/test/ui/type/type-check/assignment-in-if.stderr b/src/test/ui/type/type-check/assignment-in-if.stderr index 7f3ce0d2a5f..403f7b4f7ae 100644 --- a/src/test/ui/type/type-check/assignment-in-if.stderr +++ b/src/test/ui/type/type-check/assignment-in-if.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:25:8 + --> $DIR/assignment-in-if.rs:15:8 | LL | if x = x { | ^^^^^ @@ -11,7 +11,7 @@ LL | if x = x { found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:30:8 + --> $DIR/assignment-in-if.rs:20:8 | LL | if (x = x) { | ^^^^^^^ @@ -23,7 +23,7 @@ LL | if (x = x) { found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:35:8 + --> $DIR/assignment-in-if.rs:25:8 | LL | if y = (Foo { foo: x }) { | ^^^^^^^^^^^^^^^^^^^^ @@ -35,7 +35,7 @@ LL | if y = (Foo { foo: x }) { found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:40:8 + --> $DIR/assignment-in-if.rs:30:8 | LL | if 3 = x { | ^^^^^ @@ -47,7 +47,7 @@ LL | if 3 = x { found type `()` error[E0308]: mismatched types - --> $DIR/assignment-in-if.rs:44:8 + --> $DIR/assignment-in-if.rs:34:8 | LL | if (if true { x = 4 } else { x = 5 }) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected bool, found () diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_array.rs b/src/test/ui/type/type-check/cannot_infer_local_or_array.rs index 3ec96144da5..af7552523d6 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_array.rs +++ b/src/test/ui/type/type-check/cannot_infer_local_or_array.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = []; //~ ERROR type annotations needed } diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr b/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr index bfdd614e50d..a2df3dcd8e7 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr +++ b/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/cannot_infer_local_or_array.rs:12:13 + --> $DIR/cannot_infer_local_or_array.rs:2:13 | LL | let x = []; //~ ERROR type annotations needed | - ^^ cannot infer type diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_vec.rs b/src/test/ui/type/type-check/cannot_infer_local_or_vec.rs index a4626799691..e72ddabf3da 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_vec.rs +++ b/src/test/ui/type/type-check/cannot_infer_local_or_vec.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = vec![]; //~^ ERROR type annotations needed diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr b/src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr index e58a5b67c19..8215947d49c 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr +++ b/src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/cannot_infer_local_or_vec.rs:12:13 + --> $DIR/cannot_infer_local_or_vec.rs:2:13 | LL | let x = vec![]; | - ^^^^^^ cannot infer type for `T` diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs b/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs index 930c51f52d9..d21456439f0 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs +++ b/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let (x, ) = (vec![], ); //~^ ERROR type annotations needed diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr b/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr index d7887216bc9..1065d49c26b 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr +++ b/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/cannot_infer_local_or_vec_in_tuples.rs:12:18 + --> $DIR/cannot_infer_local_or_vec_in_tuples.rs:2:18 | LL | let (x, ) = (vec![], ); | ----- ^^^^^^ cannot infer type for `T` diff --git a/src/test/ui/type/type-check/issue-22897.rs b/src/test/ui/type/type-check/issue-22897.rs index 62eaa616d31..8171a0ef154 100644 --- a/src/test/ui/type/type-check/issue-22897.rs +++ b/src/test/ui/type/type-check/issue-22897.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { } fn unconstrained_type() { diff --git a/src/test/ui/type/type-check/issue-22897.stderr b/src/test/ui/type/type-check/issue-22897.stderr index e2374809dd6..a4f1c4d5d4d 100644 --- a/src/test/ui/type/type-check/issue-22897.stderr +++ b/src/test/ui/type/type-check/issue-22897.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/issue-22897.rs:14:5 + --> $DIR/issue-22897.rs:4:5 | LL | []; //~ ERROR type annotations needed | ^^ cannot infer type for `[_; 0]` diff --git a/src/test/ui/type/type-check/issue-40294.rs b/src/test/ui/type/type-check/issue-40294.rs index d2817062b27..c73acdc467e 100644 --- a/src/test/ui/type/type-check/issue-40294.rs +++ b/src/test/ui/type/type-check/issue-40294.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo: Sized { fn foo(self); } diff --git a/src/test/ui/type/type-check/issue-40294.stderr b/src/test/ui/type/type-check/issue-40294.stderr index fbb7427ae3e..d63abdbeb5d 100644 --- a/src/test/ui/type/type-check/issue-40294.stderr +++ b/src/test/ui/type/type-check/issue-40294.stderr @@ -1,5 +1,5 @@ error[E0283]: type annotations required: cannot resolve `&'a T: Foo` - --> $DIR/issue-40294.rs:15:1 + --> $DIR/issue-40294.rs:5:1 | LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required LL | | where &'a T : Foo, @@ -11,7 +11,7 @@ LL | | } | |_^ | note: required by `Foo` - --> $DIR/issue-40294.rs:11:1 + --> $DIR/issue-40294.rs:1:1 | LL | trait Foo: Sized { | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/type/type-check/issue-41314.rs b/src/test/ui/type/type-check/issue-41314.rs index 7b4d2f05f5f..856d4ff6334 100644 --- a/src/test/ui/type/type-check/issue-41314.rs +++ b/src/test/ui/type/type-check/issue-41314.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum X { Y(u32) } diff --git a/src/test/ui/type/type-check/issue-41314.stderr b/src/test/ui/type/type-check/issue-41314.stderr index f7d4bb9a02f..a4ae2a97134 100644 --- a/src/test/ui/type/type-check/issue-41314.stderr +++ b/src/test/ui/type/type-check/issue-41314.stderr @@ -1,11 +1,11 @@ error[E0026]: variant `X::Y` does not have a field named `number` - --> $DIR/issue-41314.rs:17:16 + --> $DIR/issue-41314.rs:7:16 | LL | X::Y { number } => {} //~ ERROR does not have a field named `number` | ^^^^^^ variant `X::Y` does not have this field error[E0027]: pattern does not mention field `0` - --> $DIR/issue-41314.rs:17:9 + --> $DIR/issue-41314.rs:7:9 | LL | X::Y { number } => {} //~ ERROR does not have a field named `number` | ^^^^^^^^^^^^^^^ missing field `0` diff --git a/src/test/ui/type/type-check/missing_trait_impl.rs b/src/test/ui/type/type-check/missing_trait_impl.rs index b3e79ce2447..dcca96b509b 100644 --- a/src/test/ui/type/type-check/missing_trait_impl.rs +++ b/src/test/ui/type/type-check/missing_trait_impl.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { } diff --git a/src/test/ui/type/type-check/missing_trait_impl.stderr b/src/test/ui/type/type-check/missing_trait_impl.stderr index 4b01a626814..9f59e7162e0 100644 --- a/src/test/ui/type/type-check/missing_trait_impl.stderr +++ b/src/test/ui/type/type-check/missing_trait_impl.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `+` cannot be applied to type `T` - --> $DIR/missing_trait_impl.rs:15:13 + --> $DIR/missing_trait_impl.rs:5:13 | LL | let z = x + y; //~ ERROR binary operation `+` cannot be applied to type `T` | ^^^^^ @@ -7,7 +7,7 @@ LL | let z = x + y; //~ ERROR binary operation `+` cannot be applied to type = note: `T` might need a bound for `std::ops::Add` error[E0368]: binary assignment operation `+=` cannot be applied to type `T` - --> $DIR/missing_trait_impl.rs:19:5 + --> $DIR/missing_trait_impl.rs:9:5 | LL | x += x; //~ ERROR binary assignment operation `+=` cannot be applied to type `T` | -^^^^^ diff --git a/src/test/ui/type/type-check/unknown_type_for_closure.rs b/src/test/ui/type/type-check/unknown_type_for_closure.rs index 0c355976330..0dbf82453a2 100644 --- a/src/test/ui/type/type-check/unknown_type_for_closure.rs +++ b/src/test/ui/type/type-check/unknown_type_for_closure.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = |_| { }; //~ ERROR type annotations needed } diff --git a/src/test/ui/type/type-check/unknown_type_for_closure.stderr b/src/test/ui/type/type-check/unknown_type_for_closure.stderr index 25283f5e76b..45142b556ec 100644 --- a/src/test/ui/type/type-check/unknown_type_for_closure.stderr +++ b/src/test/ui/type/type-check/unknown_type_for_closure.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/unknown_type_for_closure.rs:12:14 + --> $DIR/unknown_type_for_closure.rs:2:14 | LL | let x = |_| { }; //~ ERROR type annotations needed | ^ consider giving this closure parameter a type diff --git a/src/test/ui/type/type-dependent-def-issue-49241.rs b/src/test/ui/type/type-dependent-def-issue-49241.rs index e4797014926..4c366a86363 100644 --- a/src/test/ui/type/type-dependent-def-issue-49241.rs +++ b/src/test/ui/type/type-dependent-def-issue-49241.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let v = vec![0]; const l: usize = v.count(); //~ ERROR can't capture dynamic environment in a fn item diff --git a/src/test/ui/type/type-dependent-def-issue-49241.stderr b/src/test/ui/type/type-dependent-def-issue-49241.stderr index 361c3c0c3d5..8783959f45f 100644 --- a/src/test/ui/type/type-dependent-def-issue-49241.stderr +++ b/src/test/ui/type/type-dependent-def-issue-49241.stderr @@ -1,5 +1,5 @@ error[E0434]: can't capture dynamic environment in a fn item - --> $DIR/type-dependent-def-issue-49241.rs:13:22 + --> $DIR/type-dependent-def-issue-49241.rs:3:22 | LL | const l: usize = v.count(); //~ ERROR can't capture dynamic environment in a fn item | ^ @@ -7,7 +7,7 @@ LL | const l: usize = v.count(); //~ ERROR can't capture dynamic environment = help: use the `|| { ... }` closure form instead error[E0080]: evaluation of constant value failed - --> $DIR/type-dependent-def-issue-49241.rs:14:18 + --> $DIR/type-dependent-def-issue-49241.rs:4:18 | LL | let s: [u32; l] = v.into_iter().collect(); | ^ referenced constant has errors diff --git a/src/test/ui/type/type-mismatch-multiple.rs b/src/test/ui/type/type-mismatch-multiple.rs index 9359c035956..1904ccf5d59 100644 --- a/src/test/ui/type/type-mismatch-multiple.rs +++ b/src/test/ui/type/type-mismatch-multiple.rs @@ -1,20 +1,10 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checking that the compiler reports multiple type errors at once fn main() { let a: bool = 1; let b: i32 = true; } //~^ ERROR mismatched types //~| expected type `bool` //~| found type `{integer}` -//~| expected bool, found integral variable +//~| expected bool, found integer //~| ERROR mismatched types //~| expected i32, found bool diff --git a/src/test/ui/type/type-mismatch-multiple.stderr b/src/test/ui/type/type-mismatch-multiple.stderr index b9721a5edfa..8f6b23ea091 100644 --- a/src/test/ui/type/type-mismatch-multiple.stderr +++ b/src/test/ui/type/type-mismatch-multiple.stderr @@ -1,14 +1,14 @@ error[E0308]: mismatched types - --> $DIR/type-mismatch-multiple.rs:13:27 + --> $DIR/type-mismatch-multiple.rs:3:27 | LL | fn main() { let a: bool = 1; let b: i32 = true; } - | ^ expected bool, found integral variable + | ^ expected bool, found integer | = note: expected type `bool` found type `{integer}` error[E0308]: mismatched types - --> $DIR/type-mismatch-multiple.rs:13:43 + --> $DIR/type-mismatch-multiple.rs:3:43 | LL | fn main() { let a: bool = 1; let b: i32 = true; } | ^^^^ expected i32, found bool diff --git a/src/test/ui/type/type-mismatch-same-crate-name.rs b/src/test/ui/type/type-mismatch-same-crate-name.rs index 7e93f626cfc..61e6bd21920 100644 --- a/src/test/ui/type/type-mismatch-same-crate-name.rs +++ b/src/test/ui/type/type-mismatch-same-crate-name.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:crate_a1.rs // aux-build:crate_a2.rs diff --git a/src/test/ui/type/type-mismatch-same-crate-name.stderr b/src/test/ui/type/type-mismatch-same-crate-name.stderr index c6860926056..ed07b602e3e 100644 --- a/src/test/ui/type/type-mismatch-same-crate-name.stderr +++ b/src/test/ui/type/type-mismatch-same-crate-name.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/type-mismatch-same-crate-name.rs:26:20 + --> $DIR/type-mismatch-same-crate-name.rs:16:20 | LL | a::try_foo(foo2); | ^^^^ expected struct `main::a::Foo`, found a different struct `main::a::Foo` @@ -7,13 +7,13 @@ LL | a::try_foo(foo2); = note: expected type `main::a::Foo` (struct `main::a::Foo`) found type `main::a::Foo` (struct `main::a::Foo`) note: Perhaps two different versions of crate `crate_a1` are being used? - --> $DIR/type-mismatch-same-crate-name.rs:26:20 + --> $DIR/type-mismatch-same-crate-name.rs:16:20 | LL | a::try_foo(foo2); | ^^^^ error[E0308]: mismatched types - --> $DIR/type-mismatch-same-crate-name.rs:32:20 + --> $DIR/type-mismatch-same-crate-name.rs:22:20 | LL | a::try_bar(bar2); | ^^^^ expected trait `main::a::Bar`, found a different trait `main::a::Bar` @@ -21,7 +21,7 @@ LL | a::try_bar(bar2); = note: expected type `std::boxed::Box<(dyn main::a::Bar + 'static)>` found type `std::boxed::Box` note: Perhaps two different versions of crate `crate_a1` are being used? - --> $DIR/type-mismatch-same-crate-name.rs:32:20 + --> $DIR/type-mismatch-same-crate-name.rs:22:20 | LL | a::try_bar(bar2); | ^^^^ diff --git a/src/test/ui/type/type-mismatch.rs b/src/test/ui/type/type-mismatch.rs index 2592b07eda7..11bfa3a72d9 100644 --- a/src/test/ui/type/type-mismatch.rs +++ b/src/test/ui/type/type-mismatch.rs @@ -1,12 +1,4 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#![allow(non_camel_case_types)] trait Qux {} struct A; diff --git a/src/test/ui/type/type-mismatch.stderr b/src/test/ui/type/type-mismatch.stderr index 4ba1a7f37c4..0b239e91eb8 100644 --- a/src/test/ui/type/type-mismatch.stderr +++ b/src/test/ui/type/type-mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:25:17 + --> $DIR/type-mismatch.rs:17:17 | LL | want::(f); //~ ERROR mismatched types | ^ expected struct `foo`, found usize @@ -8,7 +8,7 @@ LL | want::(f); //~ ERROR mismatched types found type `usize` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:26:17 + --> $DIR/type-mismatch.rs:18:17 | LL | want::(f); //~ ERROR mismatched types | ^ expected struct `bar`, found usize @@ -17,7 +17,7 @@ LL | want::(f); //~ ERROR mismatched types found type `usize` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:27:24 + --> $DIR/type-mismatch.rs:19:24 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `Foo`, found usize @@ -26,7 +26,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `usize` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:28:27 + --> $DIR/type-mismatch.rs:20:27 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `Foo`, found usize @@ -35,7 +35,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `usize` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:29:22 + --> $DIR/type-mismatch.rs:21:22 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `Foo`, found usize @@ -44,7 +44,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `usize` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:30:25 + --> $DIR/type-mismatch.rs:22:25 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `Foo`, found usize @@ -53,7 +53,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `usize` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:31:22 + --> $DIR/type-mismatch.rs:23:22 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `Foo`, found usize @@ -62,7 +62,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `usize` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:32:25 + --> $DIR/type-mismatch.rs:24:25 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `Foo`, found usize @@ -71,7 +71,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `usize` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:36:19 + --> $DIR/type-mismatch.rs:28:19 | LL | want::(f); //~ ERROR mismatched types | ^ expected usize, found struct `foo` @@ -80,7 +80,7 @@ LL | want::(f); //~ ERROR mismatched types found type `foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:37:17 + --> $DIR/type-mismatch.rs:29:17 | LL | want::(f); //~ ERROR mismatched types | ^ expected struct `bar`, found struct `foo` @@ -89,7 +89,7 @@ LL | want::(f); //~ ERROR mismatched types found type `foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:38:24 + --> $DIR/type-mismatch.rs:30:24 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `Foo`, found struct `foo` @@ -98,7 +98,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:39:27 + --> $DIR/type-mismatch.rs:31:27 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `Foo`, found struct `foo` @@ -107,7 +107,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:40:22 + --> $DIR/type-mismatch.rs:32:22 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `Foo`, found struct `foo` @@ -116,7 +116,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:41:25 + --> $DIR/type-mismatch.rs:33:25 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `Foo`, found struct `foo` @@ -125,7 +125,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:42:22 + --> $DIR/type-mismatch.rs:34:22 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `Foo`, found struct `foo` @@ -134,7 +134,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:43:25 + --> $DIR/type-mismatch.rs:35:25 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `Foo`, found struct `foo` @@ -143,7 +143,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:47:19 + --> $DIR/type-mismatch.rs:39:19 | LL | want::(f); //~ ERROR mismatched types | ^ expected usize, found struct `Foo` @@ -152,7 +152,7 @@ LL | want::(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:48:17 + --> $DIR/type-mismatch.rs:40:17 | LL | want::(f); //~ ERROR mismatched types | ^ expected struct `foo`, found struct `Foo` @@ -161,7 +161,7 @@ LL | want::(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:49:17 + --> $DIR/type-mismatch.rs:41:17 | LL | want::(f); //~ ERROR mismatched types | ^ expected struct `bar`, found struct `Foo` @@ -170,7 +170,7 @@ LL | want::(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:50:24 + --> $DIR/type-mismatch.rs:42:24 | LL | want::>(f); //~ ERROR mismatched types | ^ expected usize, found struct `foo` @@ -179,7 +179,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:51:27 + --> $DIR/type-mismatch.rs:43:27 | LL | want::>(f); //~ ERROR mismatched types | ^ expected usize, found struct `foo` @@ -188,7 +188,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:52:25 + --> $DIR/type-mismatch.rs:44:25 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `B`, found struct `A` @@ -197,7 +197,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo<_, A>` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:53:22 + --> $DIR/type-mismatch.rs:45:22 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `bar`, found struct `foo` @@ -206,7 +206,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:54:25 + --> $DIR/type-mismatch.rs:46:25 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `bar`, found struct `foo` @@ -215,7 +215,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:55:23 + --> $DIR/type-mismatch.rs:47:23 | LL | want::<&Foo>(f); //~ ERROR mismatched types | ^ @@ -227,7 +227,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:56:26 + --> $DIR/type-mismatch.rs:48:26 | LL | want::<&Foo>(f); //~ ERROR mismatched types | ^ expected reference, found struct `Foo` @@ -236,7 +236,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:60:19 + --> $DIR/type-mismatch.rs:52:19 | LL | want::(f); //~ ERROR mismatched types | ^ expected usize, found struct `Foo` @@ -245,7 +245,7 @@ LL | want::(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:61:17 + --> $DIR/type-mismatch.rs:53:17 | LL | want::(f); //~ ERROR mismatched types | ^ expected struct `foo`, found struct `Foo` @@ -254,7 +254,7 @@ LL | want::(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:62:17 + --> $DIR/type-mismatch.rs:54:17 | LL | want::(f); //~ ERROR mismatched types | ^ expected struct `bar`, found struct `Foo` @@ -263,7 +263,7 @@ LL | want::(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:63:24 + --> $DIR/type-mismatch.rs:55:24 | LL | want::>(f); //~ ERROR mismatched types | ^ expected usize, found struct `foo` @@ -272,7 +272,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:64:27 + --> $DIR/type-mismatch.rs:56:27 | LL | want::>(f); //~ ERROR mismatched types | ^ expected usize, found struct `foo` @@ -281,7 +281,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:65:22 + --> $DIR/type-mismatch.rs:57:22 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `A`, found struct `B` @@ -290,7 +290,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo<_, B>` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:66:22 + --> $DIR/type-mismatch.rs:58:22 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `bar`, found struct `foo` @@ -299,7 +299,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:67:25 + --> $DIR/type-mismatch.rs:59:25 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `bar`, found struct `foo` @@ -308,7 +308,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:68:23 + --> $DIR/type-mismatch.rs:60:23 | LL | want::<&Foo>(f); //~ ERROR mismatched types | ^ expected &Foo, found struct `Foo` @@ -317,7 +317,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:69:26 + --> $DIR/type-mismatch.rs:61:26 | LL | want::<&Foo>(f); //~ ERROR mismatched types | ^ @@ -329,7 +329,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:73:19 + --> $DIR/type-mismatch.rs:65:19 | LL | want::(f); //~ ERROR mismatched types | ^ expected usize, found struct `Foo` @@ -338,7 +338,7 @@ LL | want::(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:74:17 + --> $DIR/type-mismatch.rs:66:17 | LL | want::(f); //~ ERROR mismatched types | ^ expected struct `foo`, found struct `Foo` @@ -347,7 +347,7 @@ LL | want::(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:75:17 + --> $DIR/type-mismatch.rs:67:17 | LL | want::(f); //~ ERROR mismatched types | ^ expected struct `bar`, found struct `Foo` @@ -356,7 +356,7 @@ LL | want::(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:76:24 + --> $DIR/type-mismatch.rs:68:24 | LL | want::>(f); //~ ERROR mismatched types | ^ expected usize, found struct `foo` @@ -365,7 +365,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:77:27 + --> $DIR/type-mismatch.rs:69:27 | LL | want::>(f); //~ ERROR mismatched types | ^ expected usize, found struct `foo` @@ -374,7 +374,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:78:22 + --> $DIR/type-mismatch.rs:70:22 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `A`, found struct `B` @@ -383,7 +383,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo<_, B, A>` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:79:25 + --> $DIR/type-mismatch.rs:71:25 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `B`, found struct `A` @@ -392,7 +392,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo<_, _, A>` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:80:22 + --> $DIR/type-mismatch.rs:72:22 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `bar`, found struct `foo` @@ -401,7 +401,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:81:25 + --> $DIR/type-mismatch.rs:73:25 | LL | want::>(f); //~ ERROR mismatched types | ^ expected struct `bar`, found struct `foo` @@ -410,7 +410,7 @@ LL | want::>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:82:23 + --> $DIR/type-mismatch.rs:74:23 | LL | want::<&Foo>(f); //~ ERROR mismatched types | ^ expected &Foo, found struct `Foo` @@ -419,7 +419,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types found type `Foo` error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:83:26 + --> $DIR/type-mismatch.rs:75:26 | LL | want::<&Foo>(f); //~ ERROR mismatched types | ^ expected reference, found struct `Foo` diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs index 08988353886..3e1c876c76b 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a default that references `Self` which is then used in an // object type. Issue #18956. In this case, the value is supplied by // the user, but pretty-printing the type during the error message diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr index f02bf0533a3..7306929d712 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr @@ -1,17 +1,17 @@ error[E0620]: cast to unsized type: `i32` as `dyn MyAdd` - --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:24:13 + --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:13 | LL | let y = x as MyAdd; | ^^^^^^^^^^^^^^^ | help: consider using a box or reference as appropriate - --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:24:13 + --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:13 | LL | let y = x as MyAdd; | ^ error[E0038]: the trait `MyAdd` cannot be made into an object - --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:24:18 + --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:14:18 | LL | let y = x as MyAdd; | ^^^^^^^^^^ the trait `MyAdd` cannot be made into an object diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self.rs b/src/test/ui/type/type-parameter-defaults-referencing-Self.rs index 9982d485024..721bf960a55 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self.rs +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test a default that references `Self` which is then used in an object type. // Issue #18956. diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr index e163253bdf9..70093b61f25 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr @@ -1,5 +1,5 @@ error[E0393]: the type parameter `T` must be explicitly specified - --> $DIR/type-parameter-defaults-referencing-Self.rs:20:12 + --> $DIR/type-parameter-defaults-referencing-Self.rs:10:12 | LL | fn foo(x: &Foo) { } | ^^^ missing reference to `T` diff --git a/src/test/ui/type/type-parameter-names.rs b/src/test/ui/type/type-parameter-names.rs index 11a2fc2665c..b6b3795d09b 100644 --- a/src/test/ui/type/type-parameter-names.rs +++ b/src/test/ui/type/type-parameter-names.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we print out the names of type parameters correctly in // our error messages. diff --git a/src/test/ui/type/type-parameter-names.stderr b/src/test/ui/type/type-parameter-names.stderr index 8e3d39357ed..9acae5c376d 100644 --- a/src/test/ui/type/type-parameter-names.stderr +++ b/src/test/ui/type/type-parameter-names.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/type-parameter-names.rs:15:5 + --> $DIR/type-parameter-names.rs:5:5 | LL | fn foo(x: Foo) -> Bar { | --- expected `Bar` because of return type diff --git a/src/test/ui/type/type-params-in-different-spaces-1.rs b/src/test/ui/type/type-params-in-different-spaces-1.rs index 26eac6adde2..449a26e901d 100644 --- a/src/test/ui/type/type-params-in-different-spaces-1.rs +++ b/src/test/ui/type/type-params-in-different-spaces-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Add; trait BrokenAdd: Copy + Add { diff --git a/src/test/ui/type/type-params-in-different-spaces-1.stderr b/src/test/ui/type/type-params-in-different-spaces-1.stderr index 31f332f6095..e1b8ff70a63 100644 --- a/src/test/ui/type/type-params-in-different-spaces-1.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-1.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/type-params-in-different-spaces-1.rs:15:17 + --> $DIR/type-params-in-different-spaces-1.rs:5:17 | LL | *self + rhs //~ ERROR mismatched types | ^^^ expected Self, found type parameter diff --git a/src/test/ui/type/type-params-in-different-spaces-2.rs b/src/test/ui/type/type-params-in-different-spaces-2.rs index 7de061eaf07..1211e465b0a 100644 --- a/src/test/ui/type/type-params-in-different-spaces-2.rs +++ b/src/test/ui/type/type-params-in-different-spaces-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test static calls to make sure that we align the Self and input // type parameters on a trait correctly. diff --git a/src/test/ui/type/type-params-in-different-spaces-2.stderr b/src/test/ui/type/type-params-in-different-spaces-2.stderr index af18185dd24..3d50c2c8baf 100644 --- a/src/test/ui/type/type-params-in-different-spaces-2.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-2.stderr @@ -1,25 +1,25 @@ error[E0277]: the trait bound `Self: Tr` is not satisfied - --> $DIR/type-params-in-different-spaces-2.rs:20:9 + --> $DIR/type-params-in-different-spaces-2.rs:10:9 | LL | Tr::op(u) //~ ERROR E0277 | ^^^^^^ the trait `Tr` is not implemented for `Self` | = help: consider adding a `where Self: Tr` bound note: required by `Tr::op` - --> $DIR/type-params-in-different-spaces-2.rs:15:5 + --> $DIR/type-params-in-different-spaces-2.rs:5:5 | LL | fn op(_: T) -> Self; | ^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `Self: Tr` is not satisfied - --> $DIR/type-params-in-different-spaces-2.rs:26:9 + --> $DIR/type-params-in-different-spaces-2.rs:16:9 | LL | Tr::op(u) //~ ERROR E0277 | ^^^^^^ the trait `Tr` is not implemented for `Self` | = help: consider adding a `where Self: Tr` bound note: required by `Tr::op` - --> $DIR/type-params-in-different-spaces-2.rs:15:5 + --> $DIR/type-params-in-different-spaces-2.rs:5:5 | LL | fn op(_: T) -> Self; | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/type/type-params-in-different-spaces-3.rs b/src/test/ui/type/type-params-in-different-spaces-3.rs index 3ad1e9ab538..ac7b0c11fe9 100644 --- a/src/test/ui/type/type-params-in-different-spaces-3.rs +++ b/src/test/ui/type/type-params-in-different-spaces-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Tr : Sized { fn test(u: X) -> Self { u //~ ERROR mismatched types diff --git a/src/test/ui/type/type-params-in-different-spaces-3.stderr b/src/test/ui/type/type-params-in-different-spaces-3.stderr index e1b4cbb2ab3..69288ea491d 100644 --- a/src/test/ui/type/type-params-in-different-spaces-3.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-3.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/type-params-in-different-spaces-3.rs:13:9 + --> $DIR/type-params-in-different-spaces-3.rs:3:9 | LL | fn test(u: X) -> Self { | ---- expected `Self` because of return type diff --git a/src/test/ui/type/type-path-err-node-types.rs b/src/test/ui/type/type-path-err-node-types.rs index 7ef099d0410..a2cc5070db4 100644 --- a/src/test/ui/type/type-path-err-node-types.rs +++ b/src/test/ui/type/type-path-err-node-types.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Type arguments in unresolved entities (reporting errors before type checking) // should have their types recorded. diff --git a/src/test/ui/type/type-path-err-node-types.stderr b/src/test/ui/type/type-path-err-node-types.stderr index df7d442239b..e73b1fb029c 100644 --- a/src/test/ui/type/type-path-err-node-types.stderr +++ b/src/test/ui/type/type-path-err-node-types.stderr @@ -1,23 +1,23 @@ error[E0433]: failed to resolve: use of undeclared type or module `NonExistent` - --> $DIR/type-path-err-node-types.rs:25:5 + --> $DIR/type-path-err-node-types.rs:15:5 | LL | NonExistent::Assoc::; //~ ERROR undeclared type or module `NonExistent` | ^^^^^^^^^^^ use of undeclared type or module `NonExistent` error[E0412]: cannot find type `Nonexistent` in this scope - --> $DIR/type-path-err-node-types.rs:17:12 + --> $DIR/type-path-err-node-types.rs:7:12 | LL | let _: Nonexistent; //~ ERROR cannot find type `Nonexistent` in this scope | ^^^^^^^^^^^ not found in this scope error[E0576]: cannot find method or associated constant `nonexistent` in trait `Tr` - --> $DIR/type-path-err-node-types.rs:21:21 + --> $DIR/type-path-err-node-types.rs:11:21 | LL | >::nonexistent(); //~ ERROR cannot find method or associated constant `nonexistent` | ^^^^^^^^^^^ not found in `Tr` error[E0425]: cannot find value `nonexistent` in this scope - --> $DIR/type-path-err-node-types.rs:29:5 + --> $DIR/type-path-err-node-types.rs:19:5 | LL | nonexistent.nonexistent::(); //~ ERROR cannot find value `nonexistent` | ^^^^^^^^^^^ not found in this scope diff --git a/src/test/ui/type/type-recursive.rs b/src/test/ui/type/type-recursive.rs index 4bb739800df..8558f761ee8 100644 --- a/src/test/ui/type/type-recursive.rs +++ b/src/test/ui/type/type-recursive.rs @@ -1,16 +1,6 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -struct t1 { //~ ERROR E0072 +struct T1 { //~ ERROR E0072 foo: isize, - foolish: t1 + foolish: T1 } fn main() { } diff --git a/src/test/ui/type/type-recursive.stderr b/src/test/ui/type/type-recursive.stderr index c0c2cbc857a..b1ecc1f91cb 100644 --- a/src/test/ui/type/type-recursive.stderr +++ b/src/test/ui/type/type-recursive.stderr @@ -1,13 +1,13 @@ -error[E0072]: recursive type `t1` has infinite size - --> $DIR/type-recursive.rs:11:1 +error[E0072]: recursive type `T1` has infinite size + --> $DIR/type-recursive.rs:1:1 | -LL | struct t1 { //~ ERROR E0072 +LL | struct T1 { //~ ERROR E0072 | ^^^^^^^^^ recursive type has infinite size LL | foo: isize, -LL | foolish: t1 +LL | foolish: T1 | ----------- recursive without indirection | - = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `t1` representable + = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `T1` representable error: aborting due to previous error diff --git a/src/test/ui/type/type-shadow.rs b/src/test/ui/type/type-shadow.rs index 6d8c0fe22bd..48a68a3907a 100644 --- a/src/test/ui/type/type-shadow.rs +++ b/src/test/ui/type/type-shadow.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { type X = isize; type Y = X; diff --git a/src/test/ui/type/type-shadow.stderr b/src/test/ui/type/type-shadow.stderr index 29e6e4352e2..4c7aa00565a 100644 --- a/src/test/ui/type/type-shadow.stderr +++ b/src/test/ui/type/type-shadow.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/type-shadow.rs:16:20 + --> $DIR/type-shadow.rs:6:20 | LL | let y: Y = "hello"; //~ ERROR mismatched types | ^^^^^^^ expected isize, found reference diff --git a/src/test/ui/type_length_limit.rs b/src/test/ui/type_length_limit.rs index d283f392d76..bb54669d37d 100644 --- a/src/test/ui/type_length_limit.rs +++ b/src/test/ui/type_length_limit.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: reached the type-length limit while instantiating // Test that the type length limit can be changed. diff --git a/src/test/ui/typeck/auxiliary/tdticc_coherence_lib.rs b/src/test/ui/typeck/auxiliary/tdticc_coherence_lib.rs index f6f7a250174..d00025b7708 100644 --- a/src/test/ui/typeck/auxiliary/tdticc_coherence_lib.rs +++ b/src/test/ui/typeck/auxiliary/tdticc_coherence_lib.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits, core)] #![crate_type = "rlib"] diff --git a/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.rs b/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.rs new file mode 100644 index 00000000000..0a4e7da2bff --- /dev/null +++ b/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.rs @@ -0,0 +1,7 @@ +//extern crate has_assoc_type; + +//fn ice(x: Box>) { +fn ice(x: Box>) { + *x //~ ERROR mismatched types [E0308] +} +fn main() {} diff --git a/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr b/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr new file mode 100644 index 00000000000..bb63917fc08 --- /dev/null +++ b/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/issue-57673-ice-on-deref-of-boxed-trait.rs:5:5 + | +LL | fn ice(x: Box>) { + | - possibly return type missing here? +LL | *x //~ ERROR mismatched types [E0308] + | ^^ expected (), found trait std::iter::Iterator + | + = note: expected type `()` + found type `(dyn std::iter::Iterator + 'static)` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.rs b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.rs index fa63088d000..92d8ba88727 100644 --- a/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.rs +++ b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] auto trait Magic : Sized where Option : Magic {} //~ ERROR E0568 diff --git a/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr index 8fff0e2bb1c..41bf3fd1c44 100644 --- a/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr +++ b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr @@ -1,5 +1,5 @@ error[E0568]: auto traits cannot have super traits - --> $DIR/typeck-auto-trait-no-supertraits-2.rs:13:1 + --> $DIR/typeck-auto-trait-no-supertraits-2.rs:3:1 | LL | auto trait Magic : Sized where Option : Magic {} //~ ERROR E0568 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck-auto-trait-no-supertraits.rs b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.rs index c8cf96f52fc..e48017acfc7 100644 --- a/src/test/ui/typeck/typeck-auto-trait-no-supertraits.rs +++ b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test is for #29859, we need to ensure auto traits, // (also known previously as default traits), do not have // supertraits. Since the compiler synthesizes these diff --git a/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr index 26542286807..bf40eaad653 100644 --- a/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr +++ b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr @@ -1,5 +1,5 @@ error[E0568]: auto traits cannot have super traits - --> $DIR/typeck-auto-trait-no-supertraits.rs:37:1 + --> $DIR/typeck-auto-trait-no-supertraits.rs:27:1 | LL | auto trait Magic: Copy {} //~ ERROR E0568 | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs index 715ffe92299..77608664362 100644 --- a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs +++ b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo1, U>(x: T) {} //~^ ERROR wrong number of type arguments: expected 0, found 1 [E0107] diff --git a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr index 6fc32a4fccd..0242287a3e5 100644 --- a/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -1,35 +1,35 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/typeck-builtin-bound-type-parameters.rs:11:16 + --> $DIR/typeck-builtin-bound-type-parameters.rs:1:16 | LL | fn foo1, U>(x: T) {} | ^ unexpected type argument error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/typeck-builtin-bound-type-parameters.rs:14:19 + --> $DIR/typeck-builtin-bound-type-parameters.rs:4:19 | LL | trait Trait: Copy {} | ^^^^ unexpected type argument error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/typeck-builtin-bound-type-parameters.rs:17:26 + --> $DIR/typeck-builtin-bound-type-parameters.rs:7:26 | LL | struct MyStruct1>; | ^ unexpected type argument error[E0107]: wrong number of lifetime arguments: expected 0, found 1 - --> $DIR/typeck-builtin-bound-type-parameters.rs:20:30 + --> $DIR/typeck-builtin-bound-type-parameters.rs:10:30 | LL | struct MyStruct2<'a, T: Copy<'a>>; | ^^ unexpected lifetime argument error[E0107]: wrong number of lifetime arguments: expected 0, found 1 - --> $DIR/typeck-builtin-bound-type-parameters.rs:24:20 + --> $DIR/typeck-builtin-bound-type-parameters.rs:14:20 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} | ^^ unexpected lifetime argument error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/typeck-builtin-bound-type-parameters.rs:24:24 + --> $DIR/typeck-builtin-bound-type-parameters.rs:14:24 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} | ^ unexpected type argument diff --git a/src/test/ui/typeck/typeck-cast-pointer-to-float.rs b/src/test/ui/typeck/typeck-cast-pointer-to-float.rs index 3f8b8f49cb3..2af7a3cf245 100644 --- a/src/test/ui/typeck/typeck-cast-pointer-to-float.rs +++ b/src/test/ui/typeck/typeck-cast-pointer-to-float.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x : i16 = 22; ((&x) as *const i16) as f32; diff --git a/src/test/ui/typeck/typeck-cast-pointer-to-float.stderr b/src/test/ui/typeck/typeck-cast-pointer-to-float.stderr index 437675ccb06..81d968454be 100644 --- a/src/test/ui/typeck/typeck-cast-pointer-to-float.stderr +++ b/src/test/ui/typeck/typeck-cast-pointer-to-float.stderr @@ -1,5 +1,5 @@ error[E0606]: casting `*const i16` as `f32` is invalid - --> $DIR/typeck-cast-pointer-to-float.rs:13:5 + --> $DIR/typeck-cast-pointer-to-float.rs:3:5 | LL | ((&x) as *const i16) as f32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.rs b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.rs index f8342c333a3..d6483539386 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.rs +++ b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we do not consider associated types to be sendable without // some applicable trait bound (and we don't ICE). diff --git a/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr index ad47fcdb042..3f7e4a674e6 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr @@ -1,5 +1,5 @@ error[E0277]: `::AssocType` cannot be sent between threads safely - --> $DIR/typeck-default-trait-impl-assoc-type.rs:19:5 + --> $DIR/typeck-default-trait-impl-assoc-type.rs:9:5 | LL | is_send::(); //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^ `::AssocType` cannot be sent between threads safely @@ -7,7 +7,7 @@ LL | is_send::(); //~ ERROR E0277 = help: the trait `std::marker::Send` is not implemented for `::AssocType` = help: consider adding a `where ::AssocType: std::marker::Send` bound note: required by `is_send` - --> $DIR/typeck-default-trait-impl-assoc-type.rs:22:1 + --> $DIR/typeck-default-trait-impl-assoc-type.rs:12:1 | LL | fn is_send() { | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.rs b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.rs index 6e7c9afb674..6c170fb5bae 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.rs +++ b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] auto trait MyTrait {} diff --git a/src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.stderr b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.stderr index a52628e233c..db1d7d8c0b7 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied in `(MyS2, MyS)` - --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:26:5 + --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:16:5 | LL | is_mytrait::<(MyS2, MyS)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2` @@ -8,7 +8,7 @@ LL | is_mytrait::<(MyS2, MyS)>(); = note: required because it appears within the type `(MyS2, MyS)` note: required by `is_mytrait` - --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:21:1 + --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:11:1 | LL | fn is_mytrait() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.rs b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.rs index 4660ecf4fb4..d72f6761218 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.rs +++ b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] auto trait MyTrait {} diff --git a/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.stderr b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.stderr index 2e382dd05cb..0f905189643 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied - --> $DIR/typeck-default-trait-impl-constituent-types.rs:30:5 + --> $DIR/typeck-default-trait-impl-constituent-types.rs:20:5 | LL | is_mytrait::(); | ^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `MyS2` @@ -7,7 +7,7 @@ LL | is_mytrait::(); = help: the following implementations were found: note: required by `is_mytrait` - --> $DIR/typeck-default-trait-impl-constituent-types.rs:25:1 + --> $DIR/typeck-default-trait-impl-constituent-types.rs:15:1 | LL | fn is_mytrait() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs index b918b0dde47..212e165151d 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs +++ b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:tdticc_coherence_lib.rs // Test that we do not consider associated types to be sendable without diff --git a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr index 6efb7f39f3b..2bfb4110603 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr @@ -1,34 +1,34 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:23:1 + --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:13:1 | LL | impl DefaultedTrait for (A,) { } //~ ERROR E0117 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | - = note: the impl does not reference any types defined in this crate + = note: the impl does not reference only types defined in this crate = note: define and implement a trait or new type instead error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:26:1 + --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:16:1 | LL | impl !DefaultedTrait for (B,) { } //~ ERROR E0117 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | - = note: the impl does not reference any types defined in this crate + = note: the impl does not reference only types defined in this crate = note: define and implement a trait or new type instead error[E0321]: cross-crate traits with a default impl, like `lib::DefaultedTrait`, can only be implemented for a struct/enum type defined in the current crate - --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:30:1 + --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:20:1 | LL | impl DefaultedTrait for Box { } //~ ERROR E0321 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait for type in another crate error[E0117]: only traits defined in the current crate can be implemented for arbitrary types - --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:31:1 + --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:21:1 | LL | impl DefaultedTrait for lib::Something { } //~ ERROR E0117 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | - = note: the impl does not reference any types defined in this crate + = note: the impl does not reference only types defined in this crate = note: define and implement a trait or new type instead error: aborting due to 4 previous errors diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-send.rs b/src/test/ui/typeck/typeck-default-trait-impl-negation-send.rs index 65438e5df8e..617d0f3b565 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation-send.rs +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-send.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] struct MySendable { diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr index 8dc7df90355..8442f47e82c 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr @@ -1,12 +1,12 @@ error[E0277]: `MyNotSendable` cannot be sent between threads safely - --> $DIR/typeck-default-trait-impl-negation-send.rs:29:5 + --> $DIR/typeck-default-trait-impl-negation-send.rs:19:5 | LL | is_send::(); | ^^^^^^^^^^^^^^^^^^^^^^^^ `MyNotSendable` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `MyNotSendable` note: required by `is_send` - --> $DIR/typeck-default-trait-impl-negation-send.rs:25:1 + --> $DIR/typeck-default-trait-impl-negation-send.rs:15:1 | LL | fn is_send() {} | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.rs b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.rs index c829ba3dcc3..f31dac27cae 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.rs +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength #![feature(optin_builtin_traits)] diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr index b0fe2c599be..5330c04074b 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr @@ -1,18 +1,18 @@ error[E0277]: `MyNotSync` cannot be shared between threads safely - --> $DIR/typeck-default-trait-impl-negation-sync.rs:45:5 + --> $DIR/typeck-default-trait-impl-negation-sync.rs:35:5 | LL | is_sync::(); | ^^^^^^^^^^^^^^^^^^^^ `MyNotSync` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `MyNotSync` note: required by `is_sync` - --> $DIR/typeck-default-trait-impl-negation-sync.rs:41:1 + --> $DIR/typeck-default-trait-impl-negation-sync.rs:31:1 | LL | fn is_sync() {} | ^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `std::cell::UnsafeCell` cannot be shared between threads safely - --> $DIR/typeck-default-trait-impl-negation-sync.rs:48:5 + --> $DIR/typeck-default-trait-impl-negation-sync.rs:38:5 | LL | is_sync::(); | ^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell` cannot be shared between threads safely @@ -20,13 +20,13 @@ LL | is_sync::(); = help: within `MyTypeWUnsafe`, the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell` = note: required because it appears within the type `MyTypeWUnsafe` note: required by `is_sync` - --> $DIR/typeck-default-trait-impl-negation-sync.rs:41:1 + --> $DIR/typeck-default-trait-impl-negation-sync.rs:31:1 | LL | fn is_sync() {} | ^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `Managed` cannot be shared between threads safely - --> $DIR/typeck-default-trait-impl-negation-sync.rs:51:5 + --> $DIR/typeck-default-trait-impl-negation-sync.rs:41:5 | LL | is_sync::(); | ^^^^^^^^^^^^^^^^^^^^^^^^ `Managed` cannot be shared between threads safely @@ -34,7 +34,7 @@ LL | is_sync::(); = help: within `MyTypeManaged`, the trait `std::marker::Sync` is not implemented for `Managed` = note: required because it appears within the type `MyTypeManaged` note: required by `is_sync` - --> $DIR/typeck-default-trait-impl-negation-sync.rs:41:1 + --> $DIR/typeck-default-trait-impl-negation-sync.rs:31:1 | LL | fn is_sync() {} | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation.rs b/src/test/ui/typeck/typeck-default-trait-impl-negation.rs index b28cdd8aa24..0b6e13be6e1 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation.rs +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] auto trait MyTrait {} diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation.stderr index 4427955c4b2..751083d0358 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-negation.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-negation.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `ThisImplsUnsafeTrait: MyTrait` is not satisfied - --> $DIR/typeck-default-trait-impl-negation.rs:31:5 + --> $DIR/typeck-default-trait-impl-negation.rs:21:5 | LL | is_my_trait::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `ThisImplsUnsafeTrait` @@ -7,13 +7,13 @@ LL | is_my_trait::(); = help: the following implementations were found: note: required by `is_my_trait` - --> $DIR/typeck-default-trait-impl-negation.rs:26:1 + --> $DIR/typeck-default-trait-impl-negation.rs:16:1 | LL | fn is_my_trait() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `ThisImplsTrait: MyUnsafeTrait` is not satisfied - --> $DIR/typeck-default-trait-impl-negation.rs:34:5 + --> $DIR/typeck-default-trait-impl-negation.rs:24:5 | LL | is_my_unsafe_trait::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyUnsafeTrait` is not implemented for `ThisImplsTrait` @@ -21,7 +21,7 @@ LL | is_my_unsafe_trait::(); = help: the following implementations were found: note: required by `is_my_unsafe_trait` - --> $DIR/typeck-default-trait-impl-negation.rs:27:1 + --> $DIR/typeck-default-trait-impl-negation.rs:17:1 | LL | fn is_my_unsafe_trait() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck-default-trait-impl-precedence.rs b/src/test/ui/typeck/typeck-default-trait-impl-precedence.rs index d63d70bad22..9b228f70646 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-precedence.rs +++ b/src/test/ui/typeck/typeck-default-trait-impl-precedence.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that declaring that `&T` is `Defaulted` if `T:Signed` implies // that other `&T` is NOT `Defaulted` if `T:Signed` does not hold. In // other words, the auto impl only applies if there are no existing diff --git a/src/test/ui/typeck/typeck-default-trait-impl-precedence.stderr b/src/test/ui/typeck/typeck-default-trait-impl-precedence.stderr index 0ab5eaaa34f..d45cbb27a5f 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-precedence.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-precedence.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `u32: Signed` is not satisfied - --> $DIR/typeck-default-trait-impl-precedence.rs:28:5 + --> $DIR/typeck-default-trait-impl-precedence.rs:18:5 | LL | is_defaulted::<&'static u32>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Signed` is not implemented for `u32` | = note: required because of the requirements on the impl of `Defaulted` for `&'static u32` note: required by `is_defaulted` - --> $DIR/typeck-default-trait-impl-precedence.rs:21:1 + --> $DIR/typeck-default-trait-impl-precedence.rs:11:1 | LL | fn is_defaulted() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck-default-trait-impl-send-param.rs b/src/test/ui/typeck/typeck-default-trait-impl-send-param.rs index 0c548b3bd99..7948cd101ff 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-send-param.rs +++ b/src/test/ui/typeck/typeck-default-trait-impl-send-param.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we do not consider parameter types to be sendable without // an explicit trait bound. diff --git a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr index 82f31176f3e..736e1b8da7f 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr @@ -1,5 +1,5 @@ error[E0277]: `T` cannot be sent between threads safely - --> $DIR/typeck-default-trait-impl-send-param.rs:15:5 + --> $DIR/typeck-default-trait-impl-send-param.rs:5:5 | LL | is_send::() //~ ERROR E0277 | ^^^^^^^^^^^^ `T` cannot be sent between threads safely @@ -7,7 +7,7 @@ LL | is_send::() //~ ERROR E0277 = help: the trait `std::marker::Send` is not implemented for `T` = help: consider adding a `where T: std::marker::Send` bound note: required by `is_send` - --> $DIR/typeck-default-trait-impl-send-param.rs:18:1 + --> $DIR/typeck-default-trait-impl-send-param.rs:8:1 | LL | fn is_send() { | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck-negative-impls-builtin.rs b/src/test/ui/typeck/typeck-negative-impls-builtin.rs index d6d8fb6235d..7bdd1035a1b 100644 --- a/src/test/ui/typeck/typeck-negative-impls-builtin.rs +++ b/src/test/ui/typeck/typeck-negative-impls-builtin.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(optin_builtin_traits)] struct TestType; diff --git a/src/test/ui/typeck/typeck-negative-impls-builtin.stderr b/src/test/ui/typeck/typeck-negative-impls-builtin.stderr index 6ae323aedfe..4e3d054ff6f 100644 --- a/src/test/ui/typeck/typeck-negative-impls-builtin.stderr +++ b/src/test/ui/typeck/typeck-negative-impls-builtin.stderr @@ -1,5 +1,5 @@ error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) - --> $DIR/typeck-negative-impls-builtin.rs:19:1 + --> $DIR/typeck-negative-impls-builtin.rs:9:1 | LL | impl !TestTrait for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck-unsafe-always-share.rs b/src/test/ui/typeck/typeck-unsafe-always-share.rs index fcfc8574b21..7d1ff732983 100644 --- a/src/test/ui/typeck/typeck-unsafe-always-share.rs +++ b/src/test/ui/typeck/typeck-unsafe-always-share.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Verify that UnsafeCell is *always* !Sync regardless if `T` is sync. #![feature(optin_builtin_traits)] diff --git a/src/test/ui/typeck/typeck-unsafe-always-share.stderr b/src/test/ui/typeck/typeck-unsafe-always-share.stderr index 57c4bdf0ad2..ff351afdcae 100644 --- a/src/test/ui/typeck/typeck-unsafe-always-share.stderr +++ b/src/test/ui/typeck/typeck-unsafe-always-share.stderr @@ -1,31 +1,31 @@ error[E0277]: `std::cell::UnsafeCell>` cannot be shared between threads safely - --> $DIR/typeck-unsafe-always-share.rs:29:5 + --> $DIR/typeck-unsafe-always-share.rs:19:5 | LL | test(us); | ^^^^ `std::cell::UnsafeCell>` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell>` note: required by `test` - --> $DIR/typeck-unsafe-always-share.rs:25:1 + --> $DIR/typeck-unsafe-always-share.rs:15:1 | LL | fn test(s: T) {} | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `std::cell::UnsafeCell` cannot be shared between threads safely - --> $DIR/typeck-unsafe-always-share.rs:33:5 + --> $DIR/typeck-unsafe-always-share.rs:23:5 | LL | test(uns); | ^^^^ `std::cell::UnsafeCell` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell` note: required by `test` - --> $DIR/typeck-unsafe-always-share.rs:25:1 + --> $DIR/typeck-unsafe-always-share.rs:15:1 | LL | fn test(s: T) {} | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `std::cell::UnsafeCell` cannot be shared between threads safely - --> $DIR/typeck-unsafe-always-share.rs:37:5 + --> $DIR/typeck-unsafe-always-share.rs:27:5 | LL | test(ms); | ^^^^ `std::cell::UnsafeCell` cannot be shared between threads safely @@ -33,20 +33,20 @@ LL | test(ms); = help: within `MySync`, the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell` = note: required because it appears within the type `MySync` note: required by `test` - --> $DIR/typeck-unsafe-always-share.rs:25:1 + --> $DIR/typeck-unsafe-always-share.rs:15:1 | LL | fn test(s: T) {} | ^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `NoSync` cannot be shared between threads safely - --> $DIR/typeck-unsafe-always-share.rs:40:5 + --> $DIR/typeck-unsafe-always-share.rs:30:5 | LL | test(NoSync); | ^^^^ `NoSync` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `NoSync` note: required by `test` - --> $DIR/typeck-unsafe-always-share.rs:25:1 + --> $DIR/typeck-unsafe-always-share.rs:15:1 | LL | fn test(s: T) {} | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.rs b/src/test/ui/typeck/typeck_type_placeholder_item.rs index d4f3cdfd8b7..46a5b8580dc 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item.rs +++ b/src/test/ui/typeck/typeck_type_placeholder_item.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test checks that it is not possible to enable global type // inference by using the `_` type placeholder. diff --git a/src/test/ui/typeck/typeck_type_placeholder_item.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.stderr index 598f18bf8d8..9ae104c9463 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_item.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_item.stderr @@ -1,203 +1,203 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:14:14 + --> $DIR/typeck_type_placeholder_item.rs:4:14 | LL | fn test() -> _ { 5 } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:17:16 + --> $DIR/typeck_type_placeholder_item.rs:7:16 | LL | fn test2() -> (_, _) { (5, 5) } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:17:19 + --> $DIR/typeck_type_placeholder_item.rs:7:19 | LL | fn test2() -> (_, _) { (5, 5) } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:21:15 + --> $DIR/typeck_type_placeholder_item.rs:11:15 | LL | static TEST3: _ = "test"; | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:24:15 + --> $DIR/typeck_type_placeholder_item.rs:14:15 | LL | static TEST4: _ = 145; | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:27:16 + --> $DIR/typeck_type_placeholder_item.rs:17:16 | LL | static TEST5: (_, _) = (1, 2); | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:27:19 + --> $DIR/typeck_type_placeholder_item.rs:17:19 | LL | static TEST5: (_, _) = (1, 2); | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:31:13 + --> $DIR/typeck_type_placeholder_item.rs:21:13 | LL | fn test6(_: _) { } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:34:13 + --> $DIR/typeck_type_placeholder_item.rs:24:13 | LL | fn test7(x: _) { let _x: usize = x; } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:37:22 + --> $DIR/typeck_type_placeholder_item.rs:27:22 | LL | fn test8(_f: fn() -> _) { } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:59:8 + --> $DIR/typeck_type_placeholder_item.rs:49:8 | LL | a: _, | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:61:9 + --> $DIR/typeck_type_placeholder_item.rs:51:9 | LL | b: (_, _), | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:61:12 + --> $DIR/typeck_type_placeholder_item.rs:51:12 | LL | b: (_, _), | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:112:12 + --> $DIR/typeck_type_placeholder_item.rs:102:12 | LL | a: _, | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:114:13 + --> $DIR/typeck_type_placeholder_item.rs:104:13 | LL | b: (_, _), | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:114:16 + --> $DIR/typeck_type_placeholder_item.rs:104:16 | LL | b: (_, _), | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:67:21 + --> $DIR/typeck_type_placeholder_item.rs:57:21 | LL | fn fn_test() -> _ { 5 } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:70:23 + --> $DIR/typeck_type_placeholder_item.rs:60:23 | LL | fn fn_test2() -> (_, _) { (5, 5) } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:70:26 + --> $DIR/typeck_type_placeholder_item.rs:60:26 | LL | fn fn_test2() -> (_, _) { (5, 5) } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:74:22 + --> $DIR/typeck_type_placeholder_item.rs:64:22 | LL | static FN_TEST3: _ = "test"; | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:77:22 + --> $DIR/typeck_type_placeholder_item.rs:67:22 | LL | static FN_TEST4: _ = 145; | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:80:23 + --> $DIR/typeck_type_placeholder_item.rs:70:23 | LL | static FN_TEST5: (_, _) = (1, 2); | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:80:26 + --> $DIR/typeck_type_placeholder_item.rs:70:26 | LL | static FN_TEST5: (_, _) = (1, 2); | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:84:20 + --> $DIR/typeck_type_placeholder_item.rs:74:20 | LL | fn fn_test6(_: _) { } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:87:20 + --> $DIR/typeck_type_placeholder_item.rs:77:20 | LL | fn fn_test7(x: _) { let _x: usize = x; } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:90:29 + --> $DIR/typeck_type_placeholder_item.rs:80:29 | LL | fn fn_test8(_f: fn() -> _) { } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:43:24 + --> $DIR/typeck_type_placeholder_item.rs:33:24 | LL | fn test9(&self) -> _ { () } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:46:27 + --> $DIR/typeck_type_placeholder_item.rs:36:27 | LL | fn test10(&self, _x : _) { } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:51:24 + --> $DIR/typeck_type_placeholder_item.rs:41:24 | LL | fn clone(&self) -> _ { Test9 } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:54:37 + --> $DIR/typeck_type_placeholder_item.rs:44:37 | LL | fn clone_from(&mut self, other: _) { *self = Test9; } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:96:31 + --> $DIR/typeck_type_placeholder_item.rs:86:31 | LL | fn fn_test9(&self) -> _ { () } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:99:34 + --> $DIR/typeck_type_placeholder_item.rs:89:34 | LL | fn fn_test10(&self, _x : _) { } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:104:28 + --> $DIR/typeck_type_placeholder_item.rs:94:28 | LL | fn clone(&self) -> _ { FnTest9 } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/typeck_type_placeholder_item.rs:107:41 + --> $DIR/typeck_type_placeholder_item.rs:97:41 | LL | fn clone_from(&mut self, other: _) { *self = FnTest9; } | ^ not allowed in type signatures diff --git a/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.rs b/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.rs index cef7b6eebc9..57ab7dee0e8 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.rs +++ b/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test checks that the `_` type placeholder does not react // badly if put as a lifetime parameter. diff --git a/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.stderr b/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.stderr index 8da357452a7..8186d75f920 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.stderr @@ -1,5 +1,5 @@ error[E0107]: wrong number of type arguments: expected 1, found 2 - --> $DIR/typeck_type_placeholder_lifetime_1.rs:19:19 + --> $DIR/typeck_type_placeholder_lifetime_1.rs:9:19 | LL | let c: Foo<_, _> = Foo { r: &5 }; | ^ unexpected type argument diff --git a/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.rs b/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.rs index 4c25a2528f0..b68d2832b4f 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.rs +++ b/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test checks that the `_` type placeholder does not react // badly if put as a lifetime parameter. diff --git a/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.stderr b/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.stderr index c43f73a5f1a..9b0f9695ef7 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.stderr @@ -1,5 +1,5 @@ error[E0107]: wrong number of type arguments: expected 1, found 2 - --> $DIR/typeck_type_placeholder_lifetime_2.rs:19:19 + --> $DIR/typeck_type_placeholder_lifetime_2.rs:9:19 | LL | let c: Foo<_, usize> = Foo { r: &5 }; | ^^^^^ unexpected type argument diff --git a/src/test/ui/typeck/typeck_type_placeholder_mismatch.rs b/src/test/ui/typeck/typeck_type_placeholder_mismatch.rs index 91e3c38322e..ec978e45b82 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_mismatch.rs +++ b/src/test/ui/typeck/typeck_type_placeholder_mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test checks that genuine type errors with partial // type hints are understandable. diff --git a/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr b/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr index 6a762353819..89114874824 100644 --- a/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr +++ b/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/typeck_type_placeholder_mismatch.rs:23:21 + --> $DIR/typeck_type_placeholder_mismatch.rs:13:21 | LL | let x: Foo<_> = Bar::(PhantomData); | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar` @@ -8,7 +8,7 @@ LL | let x: Foo<_> = Bar::(PhantomData); found type `Bar` error[E0308]: mismatched types - --> $DIR/typeck_type_placeholder_mismatch.rs:32:21 + --> $DIR/typeck_type_placeholder_mismatch.rs:22:21 | LL | let x: Foo<_> = Bar::(PhantomData); | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar` diff --git a/src/test/ui/ufcs/ufcs-explicit-self-bad.rs b/src/test/ui/ufcs/ufcs-explicit-self-bad.rs index a0d1f2dc331..c6ff94a5e76 100644 --- a/src/test/ui/ufcs/ufcs-explicit-self-bad.rs +++ b/src/test/ui/ufcs/ufcs-explicit-self-bad.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] struct Foo { @@ -16,7 +6,7 @@ struct Foo { impl Foo { fn foo(self: isize, x: isize) -> isize { - //~^ ERROR invalid `self` type + //~^ ERROR invalid method receiver type self.f + x } } @@ -27,11 +17,11 @@ struct Bar { impl Bar { fn foo(self: Bar, x: isize) -> isize { - //~^ ERROR invalid `self` type + //~^ ERROR invalid method receiver type x } fn bar(self: &Bar, x: isize) -> isize { - //~^ ERROR invalid `self` type + //~^ ERROR invalid method receiver type x } } diff --git a/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr b/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr index fce74605cad..759a16cdafd 100644 --- a/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr +++ b/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr @@ -1,102 +1,102 @@ -error[E0307]: invalid `self` type: isize - --> $DIR/ufcs-explicit-self-bad.rs:18:18 +error[E0307]: invalid method receiver type: isize + --> $DIR/ufcs-explicit-self-bad.rs:8:18 | LL | fn foo(self: isize, x: isize) -> isize { | ^^^^^ | - = note: type must be `Foo` or a type that dereferences to it + = note: type must be `Self` or a type that dereferences to it = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box` -error[E0307]: invalid `self` type: Bar - --> $DIR/ufcs-explicit-self-bad.rs:29:18 +error[E0307]: invalid method receiver type: Bar + --> $DIR/ufcs-explicit-self-bad.rs:19:18 | LL | fn foo(self: Bar, x: isize) -> isize { | ^^^^^^^^^^ | - = note: type must be `Bar` or a type that dereferences to it + = note: type must be `Self` or a type that dereferences to it = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box` -error[E0307]: invalid `self` type: &Bar - --> $DIR/ufcs-explicit-self-bad.rs:33:18 +error[E0307]: invalid method receiver type: &Bar + --> $DIR/ufcs-explicit-self-bad.rs:23:18 | LL | fn bar(self: &Bar, x: isize) -> isize { | ^^^^^^^^^^^ | - = note: type must be `Bar` or a type that dereferences to it + = note: type must be `Self` or a type that dereferences to it = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box` error[E0308]: mismatched method receiver - --> $DIR/ufcs-explicit-self-bad.rs:47:21 + --> $DIR/ufcs-explicit-self-bad.rs:37:21 | LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver | ^^^^^^^ lifetime mismatch | = note: expected type `&'a Bar` found type `&Bar` -note: the anonymous lifetime #1 defined on the method body at 47:5... - --> $DIR/ufcs-explicit-self-bad.rs:47:5 +note: the anonymous lifetime #1 defined on the method body at 37:5... + --> $DIR/ufcs-explicit-self-bad.rs:37:5 | LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 45:6 - --> $DIR/ufcs-explicit-self-bad.rs:45:6 +note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 35:6 + --> $DIR/ufcs-explicit-self-bad.rs:35:6 | LL | impl<'a, T> SomeTrait for &'a Bar { | ^^ error[E0308]: mismatched method receiver - --> $DIR/ufcs-explicit-self-bad.rs:47:21 + --> $DIR/ufcs-explicit-self-bad.rs:37:21 | LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver | ^^^^^^^ lifetime mismatch | = note: expected type `&'a Bar` found type `&Bar` -note: the lifetime 'a as defined on the impl at 45:6... - --> $DIR/ufcs-explicit-self-bad.rs:45:6 +note: the lifetime 'a as defined on the impl at 35:6... + --> $DIR/ufcs-explicit-self-bad.rs:35:6 | LL | impl<'a, T> SomeTrait for &'a Bar { | ^^ -note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 47:5 - --> $DIR/ufcs-explicit-self-bad.rs:47:5 +note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 37:5 + --> $DIR/ufcs-explicit-self-bad.rs:37:5 | LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched method receiver - --> $DIR/ufcs-explicit-self-bad.rs:49:21 + --> $DIR/ufcs-explicit-self-bad.rs:39:21 | LL | fn dummy3(self: &&Bar) {} | ^^^^^^^^ lifetime mismatch | = note: expected type `&'a Bar` found type `&Bar` -note: the anonymous lifetime #2 defined on the method body at 49:5... - --> $DIR/ufcs-explicit-self-bad.rs:49:5 +note: the anonymous lifetime #2 defined on the method body at 39:5... + --> $DIR/ufcs-explicit-self-bad.rs:39:5 | LL | fn dummy3(self: &&Bar) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 45:6 - --> $DIR/ufcs-explicit-self-bad.rs:45:6 +note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 35:6 + --> $DIR/ufcs-explicit-self-bad.rs:35:6 | LL | impl<'a, T> SomeTrait for &'a Bar { | ^^ error[E0308]: mismatched method receiver - --> $DIR/ufcs-explicit-self-bad.rs:49:21 + --> $DIR/ufcs-explicit-self-bad.rs:39:21 | LL | fn dummy3(self: &&Bar) {} | ^^^^^^^^ lifetime mismatch | = note: expected type `&'a Bar` found type `&Bar` -note: the lifetime 'a as defined on the impl at 45:6... - --> $DIR/ufcs-explicit-self-bad.rs:45:6 +note: the lifetime 'a as defined on the impl at 35:6... + --> $DIR/ufcs-explicit-self-bad.rs:35:6 | LL | impl<'a, T> SomeTrait for &'a Bar { | ^^ -note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 49:5 - --> $DIR/ufcs-explicit-self-bad.rs:49:5 +note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 39:5 + --> $DIR/ufcs-explicit-self-bad.rs:39:5 | LL | fn dummy3(self: &&Bar) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/ufcs/ufcs-partially-resolved.rs b/src/test/ui/ufcs/ufcs-partially-resolved.rs index db10197ded1..4efded8b376 100644 --- a/src/test/ui/ufcs/ufcs-partially-resolved.rs +++ b/src/test/ui/ufcs/ufcs-partially-resolved.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(associated_type_defaults)] trait Tr { diff --git a/src/test/ui/ufcs/ufcs-partially-resolved.stderr b/src/test/ui/ufcs/ufcs-partially-resolved.stderr index cb571be661d..3cd1cac71fa 100644 --- a/src/test/ui/ufcs/ufcs-partially-resolved.stderr +++ b/src/test/ui/ufcs/ufcs-partially-resolved.stderr @@ -1,202 +1,206 @@ error[E0433]: failed to resolve: not a module `Y` - --> $DIR/ufcs-partially-resolved.rs:58:22 + --> $DIR/ufcs-partially-resolved.rs:48:22 | LL | let _: ::NN; //~ ERROR failed to resolve: not a module `Y` | ^ not a module `Y` error[E0433]: failed to resolve: not a module `Y` - --> $DIR/ufcs-partially-resolved.rs:60:15 + --> $DIR/ufcs-partially-resolved.rs:50:15 | LL | ::NN; //~ ERROR failed to resolve: not a module `Y` | ^ not a module `Y` error[E0576]: cannot find associated type `N` in trait `Tr` - --> $DIR/ufcs-partially-resolved.rs:29:24 + --> $DIR/ufcs-partially-resolved.rs:19:24 | LL | let _: ::N; //~ ERROR cannot find associated type `N` in trait `Tr` - | ^ did you mean `Y`? + | ^ help: an associated type with a similar name exists: `Y` error[E0576]: cannot find associated type `N` in enum `E` - --> $DIR/ufcs-partially-resolved.rs:30:23 + --> $DIR/ufcs-partially-resolved.rs:20:23 | LL | let _: ::N; //~ ERROR cannot find associated type `N` in enum `E` | ^ not found in `E` error[E0576]: cannot find associated type `N` in `A` - --> $DIR/ufcs-partially-resolved.rs:31:23 + --> $DIR/ufcs-partially-resolved.rs:21:23 | LL | let _: ::N; //~ ERROR cannot find associated type `N` in `A` | ^ not found in `A` error[E0576]: cannot find method or associated constant `N` in trait `Tr` - --> $DIR/ufcs-partially-resolved.rs:32:17 + --> $DIR/ufcs-partially-resolved.rs:22:17 | LL | ::N; //~ ERROR cannot find method or associated constant `N` in trait `Tr` - | ^ did you mean `Y`? + | ^ help: a method with a similar name exists: `Y` error[E0576]: cannot find method or associated constant `N` in enum `E` - --> $DIR/ufcs-partially-resolved.rs:33:16 + --> $DIR/ufcs-partially-resolved.rs:23:16 | LL | ::N; //~ ERROR cannot find method or associated constant `N` in enum `E` | ^ not found in `E` error[E0576]: cannot find method or associated constant `N` in `A` - --> $DIR/ufcs-partially-resolved.rs:34:16 + --> $DIR/ufcs-partially-resolved.rs:24:16 | LL | ::N; //~ ERROR cannot find method or associated constant `N` in `A` | ^ not found in `A` error[E0575]: expected associated type, found variant `E::Y` - --> $DIR/ufcs-partially-resolved.rs:36:12 + --> $DIR/ufcs-partially-resolved.rs:26:12 | LL | let _: ::Y; //~ ERROR expected associated type, found variant `E::Y` | ^^^^^^^^^^^^ not a associated type error[E0575]: expected method or associated constant, found unit variant `E::Y` - --> $DIR/ufcs-partially-resolved.rs:38:5 + --> $DIR/ufcs-partially-resolved.rs:28:5 | LL | ::Y; //~ ERROR expected method or associated constant, found unit variant `E::Y` | ^^^^^^^^^^^^ not a method or associated constant error[E0576]: cannot find associated type `N` in trait `Tr` - --> $DIR/ufcs-partially-resolved.rs:40:24 + --> $DIR/ufcs-partially-resolved.rs:30:24 | LL | let _: ::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` - | ^ did you mean `Y`? + | ^ help: an associated type with a similar name exists: `Y` error[E0576]: cannot find associated type `N` in enum `E` - --> $DIR/ufcs-partially-resolved.rs:41:23 + --> $DIR/ufcs-partially-resolved.rs:31:23 | LL | let _: ::N::NN; //~ ERROR cannot find associated type `N` in enum `E` | ^ not found in `E` error[E0576]: cannot find associated type `N` in `A` - --> $DIR/ufcs-partially-resolved.rs:42:23 + --> $DIR/ufcs-partially-resolved.rs:32:23 | LL | let _: ::N::NN; //~ ERROR cannot find associated type `N` in `A` | ^ not found in `A` error[E0576]: cannot find associated type `N` in trait `Tr` - --> $DIR/ufcs-partially-resolved.rs:43:17 + --> $DIR/ufcs-partially-resolved.rs:33:17 | LL | ::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` - | ^ did you mean `Y`? + | ^ help: an associated type with a similar name exists: `Y` error[E0576]: cannot find associated type `N` in enum `E` - --> $DIR/ufcs-partially-resolved.rs:44:16 + --> $DIR/ufcs-partially-resolved.rs:34:16 | LL | ::N::NN; //~ ERROR cannot find associated type `N` in enum `E` | ^ not found in `E` error[E0576]: cannot find associated type `N` in `A` - --> $DIR/ufcs-partially-resolved.rs:45:16 + --> $DIR/ufcs-partially-resolved.rs:35:16 | LL | ::N::NN; //~ ERROR cannot find associated type `N` in `A` | ^ not found in `A` error[E0575]: expected associated type, found variant `E::Y` - --> $DIR/ufcs-partially-resolved.rs:47:12 + --> $DIR/ufcs-partially-resolved.rs:37:12 | LL | let _: ::Y::NN; //~ ERROR expected associated type, found variant `E::Y` | ^^^^^^^^^^^^^^^^ not a associated type error[E0575]: expected associated type, found variant `E::Y` - --> $DIR/ufcs-partially-resolved.rs:49:5 + --> $DIR/ufcs-partially-resolved.rs:39:5 | LL | ::Y::NN; //~ ERROR expected associated type, found variant `E::Y` | ^^^^^^^^^^^^^^^^ not a associated type error[E0576]: cannot find associated type `NN` in `Tr::N` - --> $DIR/ufcs-partially-resolved.rs:51:27 + --> $DIR/ufcs-partially-resolved.rs:41:27 | LL | let _: ::NN; //~ ERROR cannot find associated type `NN` in `Tr::N` | ^^ not found in `Tr::N` error[E0576]: cannot find associated type `NN` in `E::N` - --> $DIR/ufcs-partially-resolved.rs:52:26 + --> $DIR/ufcs-partially-resolved.rs:42:26 | LL | let _: ::NN; //~ ERROR cannot find associated type `NN` in `E::N` | ^^ not found in `E::N` error[E0576]: cannot find associated type `NN` in `A::N` - --> $DIR/ufcs-partially-resolved.rs:53:26 + --> $DIR/ufcs-partially-resolved.rs:43:26 | LL | let _: ::NN; //~ ERROR cannot find associated type `NN` in `A::N` | ^^ not found in `A::N` error[E0576]: cannot find method or associated constant `NN` in `Tr::N` - --> $DIR/ufcs-partially-resolved.rs:54:20 + --> $DIR/ufcs-partially-resolved.rs:44:20 | LL | ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::N` | ^^ not found in `Tr::N` error[E0576]: cannot find method or associated constant `NN` in `E::N` - --> $DIR/ufcs-partially-resolved.rs:55:19 + --> $DIR/ufcs-partially-resolved.rs:45:19 | LL | ::NN; //~ ERROR cannot find method or associated constant `NN` in `E::N` | ^^ not found in `E::N` error[E0576]: cannot find method or associated constant `NN` in `A::N` - --> $DIR/ufcs-partially-resolved.rs:56:19 + --> $DIR/ufcs-partially-resolved.rs:46:19 | LL | ::NN; //~ ERROR cannot find method or associated constant `NN` in `A::N` | ^^ not found in `A::N` error[E0576]: cannot find associated type `NN` in `Tr::Y` - --> $DIR/ufcs-partially-resolved.rs:57:27 + --> $DIR/ufcs-partially-resolved.rs:47:27 | LL | let _: ::NN; //~ ERROR cannot find associated type `NN` in `Tr::Y` | ^^ not found in `Tr::Y` error[E0576]: cannot find method or associated constant `NN` in `Tr::Y` - --> $DIR/ufcs-partially-resolved.rs:59:20 + --> $DIR/ufcs-partially-resolved.rs:49:20 | LL | ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::Y` | ^^ not found in `Tr::Y` error[E0575]: expected associated type, found method `Dr::Z` - --> $DIR/ufcs-partially-resolved.rs:62:12 + --> $DIR/ufcs-partially-resolved.rs:52:12 | LL | let _: ::Z; //~ ERROR expected associated type, found method `Dr::Z` | ^^^^^^^^^^^^- | | - | did you mean `X`? + | help: an associated type with a similar name exists: `X` error[E0575]: expected method or associated constant, found associated type `Dr::X` - --> $DIR/ufcs-partially-resolved.rs:63:5 + --> $DIR/ufcs-partially-resolved.rs:53:5 | LL | ::X; //~ ERROR expected method or associated constant, found associated type `Dr::X` | ^^^^^^^^^^^^- | | - | did you mean `Z`? + | help: a method with a similar name exists: `Z` | = note: can't use a type alias as a constructor error[E0575]: expected associated type, found method `Dr::Z` - --> $DIR/ufcs-partially-resolved.rs:64:12 + --> $DIR/ufcs-partially-resolved.rs:54:12 | LL | let _: ::Z::N; //~ ERROR expected associated type, found method `Dr::Z` | ^^^^^^^^^^^^-^^^ | | - | did you mean `X`? + | help: an associated type with a similar name exists: `X` error[E0223]: ambiguous associated type - --> $DIR/ufcs-partially-resolved.rs:46:12 + --> $DIR/ufcs-partially-resolved.rs:36:12 | LL | let _: ::Y::NN; //~ ERROR ambiguous associated type | ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<::Y as Trait>::NN` error[E0599]: no associated item named `NN` found for type `::Y` in the current scope - --> $DIR/ufcs-partially-resolved.rs:48:5 + --> $DIR/ufcs-partially-resolved.rs:38:20 | LL | ::Y::NN; //~ ERROR no associated item named `NN` found for type `::Y` - | ^^^^^^^^^^^^^^^^^ associated item not found in `::Y` + | ---------------^^ + | | + | associated item not found in `::Y` error[E0599]: no associated item named `N` found for type `::X` in the current scope - --> $DIR/ufcs-partially-resolved.rs:65:5 + --> $DIR/ufcs-partially-resolved.rs:55:20 | LL | ::X::N; //~ ERROR no associated item named `N` found for type `::X` - | ^^^^^^^^^^^^^^^^ associated item not found in `::X` + | ---------------^ + | | + | associated item not found in `::X` error: aborting due to 32 previous errors diff --git a/src/test/ui/ufcs/ufcs-qpath-missing-params.rs b/src/test/ui/ufcs/ufcs-qpath-missing-params.rs index 294a0fa0340..8b66a8fa90a 100644 --- a/src/test/ui/ufcs/ufcs-qpath-missing-params.rs +++ b/src/test/ui/ufcs/ufcs-qpath-missing-params.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::borrow::Cow; pub trait IntoCow<'a, B: ?Sized> where B: ToOwned { diff --git a/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr b/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr index 7536205dc0f..1145f1e6409 100644 --- a/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr @@ -1,5 +1,5 @@ error[E0107]: wrong number of type arguments: expected 1, found 0 - --> $DIR/ufcs-qpath-missing-params.rs:24:5 + --> $DIR/ufcs-qpath-missing-params.rs:14:5 | LL | ::into_cow("foo".to_string()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 type argument diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs index caf510071bd..939b3c5223c 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Add; fn main() { diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr index f4222631872..e3027eedbf9 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -1,5 +1,5 @@ error[E0277]: cannot add `u32` to `i32` - --> $DIR/ufcs-qpath-self-mismatch.rs:14:5 + --> $DIR/ufcs-qpath-self-mismatch.rs:4:5 | LL | >::add(1, 2); | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32` @@ -7,13 +7,13 @@ LL | >::add(1, 2); = help: the trait `std::ops::Add` is not implemented for `i32` error[E0308]: mismatched types - --> $DIR/ufcs-qpath-self-mismatch.rs:16:28 + --> $DIR/ufcs-qpath-self-mismatch.rs:6:28 | LL | >::add(1u32, 2); | ^^^^ expected i32, found u32 error[E0308]: mismatched types - --> $DIR/ufcs-qpath-self-mismatch.rs:18:31 + --> $DIR/ufcs-qpath-self-mismatch.rs:8:31 | LL | >::add(1, 2u32); | ^^^^ expected i32, found u32 diff --git a/src/test/ui/ui-testing-optout.rs b/src/test/ui/ui-testing-optout.rs index 3072bd64a2c..041c0b0a85a 100644 --- a/src/test/ui/ui-testing-optout.rs +++ b/src/test/ui/ui-testing-optout.rs @@ -3,15 +3,8 @@ // Line number < 10 type A = B; //~ ERROR -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // Line number >=10, <100 type C = D; //~ ERROR diff --git a/src/test/ui/ui-testing-optout.stderr b/src/test/ui/ui-testing-optout.stderr index aab3399a6fc..5a662e0ea89 100644 --- a/src/test/ui/ui-testing-optout.stderr +++ b/src/test/ui/ui-testing-optout.stderr @@ -2,19 +2,19 @@ error[E0412]: cannot find type `B` in this scope --> $DIR/ui-testing-optout.rs:4:10 | 4 | type A = B; //~ ERROR - | ^ did you mean `A`? + | ^ help: a type alias with a similar name exists: `A` error[E0412]: cannot find type `D` in this scope - --> $DIR/ui-testing-optout.rs:17:10 + --> $DIR/ui-testing-optout.rs:10:10 | -17 | type C = D; //~ ERROR - | ^ did you mean `A`? +10 | type C = D; //~ ERROR + | ^ help: a type alias with a similar name exists: `A` error[E0412]: cannot find type `F` in this scope - --> $DIR/ui-testing-optout.rs:102:10 - | -102 | type E = F; //~ ERROR - | ^ did you mean `A`? + --> $DIR/ui-testing-optout.rs:95:10 + | +95 | type E = F; //~ ERROR + | ^ help: a type alias with a similar name exists: `A` error: aborting due to 3 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs index 3a3ea058b4e..1eb9de778e8 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that parenthetical notation is feature-gated except with the // `Fn` traits. diff --git a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr index aea57d9cb4e..038167ae9d7 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr @@ -1,5 +1,5 @@ error[E0658]: parenthetical notation is only stable when used with `Fn`-family traits (see issue #29625) - --> $DIR/unboxed-closure-feature-gate.rs:23:16 + --> $DIR/unboxed-closure-feature-gate.rs:13:16 | LL | let x: Box; | ^^^^^^^^^^ diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr index 4baa54e34c7..0e996902d62 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/unboxed-closure-illegal-move.rs:25:31 + --> $DIR/unboxed-closure-illegal-move.rs:15:31 | LL | let x = Box::new(0); | - captured outer variable @@ -7,7 +7,7 @@ LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move | ^ cannot move out of captured variable in an `Fn` closure error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/unboxed-closure-illegal-move.rs:29:35 + --> $DIR/unboxed-closure-illegal-move.rs:19:35 | LL | let x = Box::new(0); | - captured outer variable @@ -15,7 +15,7 @@ LL | let f = to_fn_mut(|| drop(x)); //~ ERROR cannot move | ^ cannot move out of captured variable in an `FnMut` closure error[E0507]: cannot move out of captured variable in an `Fn` closure - --> $DIR/unboxed-closure-illegal-move.rs:38:36 + --> $DIR/unboxed-closure-illegal-move.rs:28:36 | LL | let x = Box::new(0); | - captured outer variable @@ -23,7 +23,7 @@ LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move | ^ cannot move out of captured variable in an `Fn` closure error[E0507]: cannot move out of captured variable in an `FnMut` closure - --> $DIR/unboxed-closure-illegal-move.rs:42:40 + --> $DIR/unboxed-closure-illegal-move.rs:32:40 | LL | let x = Box::new(0); | - captured outer variable diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.rs b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.rs index 427be560760..ed8d7211461 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] // Tests that we can't move out of an unboxed closure environment diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr index 7ff4c1c03ba..ae83242d534 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr @@ -1,5 +1,5 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure - --> $DIR/unboxed-closure-illegal-move.rs:25:31 + --> $DIR/unboxed-closure-illegal-move.rs:15:31 | LL | let x = Box::new(0); | - captured outer variable @@ -7,7 +7,7 @@ LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move | ^ cannot move out of captured outer variable in an `Fn` closure error[E0507]: cannot move out of captured outer variable in an `FnMut` closure - --> $DIR/unboxed-closure-illegal-move.rs:29:35 + --> $DIR/unboxed-closure-illegal-move.rs:19:35 | LL | let x = Box::new(0); | - captured outer variable @@ -15,7 +15,7 @@ LL | let f = to_fn_mut(|| drop(x)); //~ ERROR cannot move | ^ cannot move out of captured outer variable in an `FnMut` closure error[E0507]: cannot move out of captured outer variable in an `Fn` closure - --> $DIR/unboxed-closure-illegal-move.rs:38:36 + --> $DIR/unboxed-closure-illegal-move.rs:28:36 | LL | let x = Box::new(0); | - captured outer variable @@ -23,7 +23,7 @@ LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move | ^ cannot move out of captured outer variable in an `Fn` closure error[E0507]: cannot move out of captured outer variable in an `FnMut` closure - --> $DIR/unboxed-closure-illegal-move.rs:42:40 + --> $DIR/unboxed-closure-illegal-move.rs:32:40 | LL | let x = Box::new(0); | - captured outer variable diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr index 084d7ff3bcd..51a0a6e5756 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/unboxed-closure-immutable-capture.rs:19:13 + --> $DIR/unboxed-closure-immutable-capture.rs:9:13 | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` @@ -7,7 +7,7 @@ LL | move || x = 1; //~ ERROR cannot assign | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/unboxed-closure-immutable-capture.rs:20:17 + --> $DIR/unboxed-closure-immutable-capture.rs:10:17 | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` @@ -16,7 +16,7 @@ LL | move || set(&mut x); //~ ERROR cannot borrow | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/unboxed-closure-immutable-capture.rs:21:13 + --> $DIR/unboxed-closure-immutable-capture.rs:11:13 | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` @@ -25,7 +25,7 @@ LL | move || x = 1; //~ ERROR cannot assign | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/unboxed-closure-immutable-capture.rs:22:17 + --> $DIR/unboxed-closure-immutable-capture.rs:12:17 | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` @@ -34,7 +34,7 @@ LL | move || set(&mut x); //~ ERROR cannot borrow | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/unboxed-closure-immutable-capture.rs:23:8 + --> $DIR/unboxed-closure-immutable-capture.rs:13:8 | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` @@ -43,7 +43,7 @@ LL | || x = 1; //~ ERROR cannot assign | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/unboxed-closure-immutable-capture.rs:25:12 + --> $DIR/unboxed-closure-immutable-capture.rs:15:12 | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` @@ -52,7 +52,7 @@ LL | || set(&mut x); //~ ERROR cannot assign | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/unboxed-closure-immutable-capture.rs:26:8 + --> $DIR/unboxed-closure-immutable-capture.rs:16:8 | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` @@ -61,7 +61,7 @@ LL | || x = 1; //~ ERROR cannot assign | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable - --> $DIR/unboxed-closure-immutable-capture.rs:28:12 + --> $DIR/unboxed-closure-immutable-capture.rs:18:12 | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.rs b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.rs index 2d998374229..5d59cecf99a 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that even unboxed closures that are capable of mutating their // environment cannot mutate captured variables that have not been // declared mutable (#18335) diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr index 0ba48545c60..1865e2486f1 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr @@ -1,5 +1,5 @@ error[E0595]: closure cannot assign to immutable local variable `x` - --> $DIR/unboxed-closure-immutable-capture.rs:23:5 + --> $DIR/unboxed-closure-immutable-capture.rs:13:5 | LL | let x = 0; | - help: make this binding mutable: `mut x` @@ -8,7 +8,7 @@ LL | || x = 1; //~ ERROR cannot assign | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable local variable `x` - --> $DIR/unboxed-closure-immutable-capture.rs:25:5 + --> $DIR/unboxed-closure-immutable-capture.rs:15:5 | LL | let x = 0; | - help: make this binding mutable: `mut x` @@ -17,7 +17,7 @@ LL | || set(&mut x); //~ ERROR cannot assign | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable local variable `x` - --> $DIR/unboxed-closure-immutable-capture.rs:26:5 + --> $DIR/unboxed-closure-immutable-capture.rs:16:5 | LL | let x = 0; | - help: make this binding mutable: `mut x` @@ -26,7 +26,7 @@ LL | || x = 1; //~ ERROR cannot assign | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable local variable `x` - --> $DIR/unboxed-closure-immutable-capture.rs:28:5 + --> $DIR/unboxed-closure-immutable-capture.rs:18:5 | LL | let x = 0; | - help: make this binding mutable: `mut x` @@ -35,7 +35,7 @@ LL | || set(&mut x); //~ ERROR cannot assign | ^^ cannot borrow mutably error[E0594]: cannot assign to captured outer variable in an `FnMut` closure - --> $DIR/unboxed-closure-immutable-capture.rs:19:13 + --> $DIR/unboxed-closure-immutable-capture.rs:9:13 | LL | let x = 0; | - help: consider making `x` mutable: `mut x` @@ -43,13 +43,13 @@ LL | move || x = 1; //~ ERROR cannot assign | ^^^^^ error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable - --> $DIR/unboxed-closure-immutable-capture.rs:20:22 + --> $DIR/unboxed-closure-immutable-capture.rs:10:22 | LL | move || set(&mut x); //~ ERROR cannot borrow | ^ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure - --> $DIR/unboxed-closure-immutable-capture.rs:21:13 + --> $DIR/unboxed-closure-immutable-capture.rs:11:13 | LL | let x = 0; | - help: consider making `x` mutable: `mut x` @@ -58,7 +58,7 @@ LL | move || x = 1; //~ ERROR cannot assign | ^^^^^ error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable - --> $DIR/unboxed-closure-immutable-capture.rs:22:22 + --> $DIR/unboxed-closure-immutable-capture.rs:12:22 | LL | move || set(&mut x); //~ ERROR cannot borrow | ^ diff --git a/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs index 506bce0dbec..9d0aa413207 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that unboxed closures cannot capture their own type. // // Also regression test for issue #21410. diff --git a/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr index 0c0c339286e..fc455208518 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr @@ -1,5 +1,5 @@ error[E0644]: closure/generator type that references itself - --> $DIR/unboxed-closure-no-cyclic-sig.rs:18:7 + --> $DIR/unboxed-closure-no-cyclic-sig.rs:8:7 | LL | g(|_| { }); //~ ERROR closure/generator type that references itself | ^^^^^^^^ cyclic type of infinite size diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr index 7ba06b6ffb2..1c55a6bb08e 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/unboxed-closure-region.rs:18:12 + --> $DIR/unboxed-closure-region.rs:8:12 | LL | let _f = { | -- borrow later stored here diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.rs b/src/test/ui/unboxed-closures/unboxed-closure-region.rs index da6dbc6e74f..f202492eda5 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-region.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-region.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that an unboxed closure that captures a free variable by // reference cannot escape the region of that variable. diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.stderr b/src/test/ui/unboxed-closures/unboxed-closure-region.stderr index f85f3afff70..a0f009c0689 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-region.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-region.stderr @@ -1,5 +1,5 @@ error[E0597]: `x` does not live long enough - --> $DIR/unboxed-closure-region.rs:18:12 + --> $DIR/unboxed-closure-region.rs:8:12 | LL | || x //~ ERROR `x` does not live long enough | -- ^ borrowed value does not live long enough diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs index 849f7e0573c..044859de6a4 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test interaction between unboxed closure sugar and default type // parameters (should be exactly as if angle brackets were used). diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr index fccf295b72c..508c2f780b9 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `dyn Foo<(isize,), isize, Output=()>: Eq>` is not satisfied - --> $DIR/unboxed-closure-sugar-default.rs:31:5 + --> $DIR/unboxed-closure-sugar-default.rs:21:5 | LL | eq::< Foo<(isize,),isize,Output=()>, Foo(isize) >(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq>` is not implemented for `dyn Foo<(isize,), isize, Output=()>` | note: required by `eq` - --> $DIR/unboxed-closure-sugar-default.rs:24:1 + --> $DIR/unboxed-closure-sugar-default.rs:14:1 | LL | fn eq() where A : Eq { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs index 0cf44a2ca61..95bd391f251 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the unboxed closure sugar can be used with an arbitrary // struct type and that it is equivalent to the same syntax using // angle brackets. This test covers only simple types and in diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr index 7d687a55df9..071ba2792b0 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `dyn Foo<(char,), Output=()>: Eq>` is not satisfied - --> $DIR/unboxed-closure-sugar-equiv.rs:53:5 + --> $DIR/unboxed-closure-sugar-equiv.rs:43:5 | LL | / eq::< Foo<(),Output=()>, LL | | Foo(char) >(); | |___________________________________________________________________^ the trait `Eq>` is not implemented for `dyn Foo<(char,), Output=()>` | note: required by `eq` - --> $DIR/unboxed-closure-sugar-equiv.rs:26:1 + --> $DIR/unboxed-closure-sugar-equiv.rs:16:1 | LL | fn eq>() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs index a6f59b78823..b61d8b8c8c7 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the unboxed closure sugar can be used with an arbitrary // struct type and that it is equivalent to the same syntax using // angle brackets. This test covers only simple types and in diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr index fa74e6e6607..e631c336788 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/unboxed-closure-sugar-lifetime-elision.rs:36:35 + --> $DIR/unboxed-closure-sugar-lifetime-elision.rs:26:35 | LL | let _: Foo(&isize, &usize) -> &usize; //~ ERROR missing lifetime specifier | ^ expected lifetime parameter diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs index ed27a4d0b2a..09927a94019 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // Test that the `Fn` traits require `()` form without a feature gate. fn bar1(x: &Fn<(), Output=()>) { diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr index bda88f4e4d7..90f04a52d37 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr @@ -1,5 +1,5 @@ error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625) - --> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:14:13 + --> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:3:13 | LL | fn bar1(x: &Fn<(), Output=()>) { | ^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | fn bar1(x: &Fn<(), Output=()>) { = help: add #![feature(unboxed_closures)] to the crate attributes to enable error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625) - --> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:18:28 + --> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:7:28 | LL | fn bar2(x: &T) where T: Fn<()> { | ^^^^^^ diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs index 331ad620c27..799d9f33e2e 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test interaction between unboxed closure sugar and region // parameters (should be exactly as if angle brackets were used // and regions omitted). diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr index 2245c5e6648..8eed7d58c46 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr @@ -1,5 +1,5 @@ error[E0107]: wrong number of lifetime arguments: expected 1, found 0 - --> $DIR/unboxed-closure-sugar-region.rs:40:43 + --> $DIR/unboxed-closure-sugar-region.rs:30:43 | LL | fn test2(x: &Foo<(isize,),Output=()>, y: &Foo(isize)) { | ^^^^^^^^^^ expected 1 lifetime argument diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.rs index 3f88f16d2c3..c96a6fa8b6c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - // Test that parentheses form doesn't work with struct types appearing in local variables. struct Bar { @@ -17,7 +6,8 @@ struct Bar { fn bar() { let x: Box = panic!(); - //~^ ERROR parenthesized parameters may only be used with a trait + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait + //~| ERROR wrong number of type arguments: expected 1, found 0 } fn main() { } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr index 1ca99680b53..fa52e66fb03 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr @@ -1,9 +1,16 @@ -error[E0214]: parenthesized parameters may only be used with a trait - --> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:19:19 +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:19 | LL | let x: Box = panic!(); - | ^^ only traits may use parentheses + | ^^ only `Fn` traits may use parentheses -error: aborting due to previous error +error[E0107]: wrong number of type arguments: expected 1, found 0 + --> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:16 + | +LL | let x: Box = panic!(); + | ^^^^^ expected 1 type argument + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0214`. +Some errors occurred: E0107, E0214. +For more information about an error, try `rustc --explain E0107`. diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.rs index 42fffe546c2..79ced1ecfb1 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that parentheses form parses in expression paths. struct Bar { @@ -22,7 +12,7 @@ fn bar() { let b = Bar::::new(); // OK let b = Bar::(isize, usize)::new(); // OK too (for the parser) - //~^ ERROR parenthesized parameters may only be used with a trait + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait } fn main() {} diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr index d6c08a70565..7d05ca55ffd 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr @@ -1,8 +1,11 @@ -error[E0214]: parenthesized parameters may only be used with a trait - --> $DIR/unboxed-closure-sugar-used-on-struct-3.rs:24:16 +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/unboxed-closure-sugar-used-on-struct-3.rs:14:18 | LL | let b = Bar::(isize, usize)::new(); // OK too (for the parser) - | ^^^^^^^^^^^^^^^^ only traits may use parentheses + | ^^^^^^^^^^^^^^ + | | + | only `Fn` traits may use parentheses + | help: use angle brackets instead: `` error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.rs index 5fcde4facbe..1af7f55674c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that parentheses form doesn't work with struct types appearing in argument types. struct Bar { @@ -15,8 +5,8 @@ struct Bar { } fn foo(b: Box) { - //~^ ERROR parenthesized parameters may only be used with a trait - //~| ERROR the type placeholder `_` is not allowed within types on item signatures + //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait + //~| ERROR wrong number of type arguments: expected 1, found 0 } fn main() { } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr index 954ec4d63a6..b34237937ee 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr @@ -1,16 +1,16 @@ -error[E0214]: parenthesized parameters may only be used with a trait - --> $DIR/unboxed-closure-sugar-used-on-struct.rs:17:18 +error[E0214]: parenthesized type parameters may only be used with a `Fn` trait + --> $DIR/unboxed-closure-sugar-used-on-struct.rs:7:18 | LL | fn foo(b: Box) { - | ^^ only traits may use parentheses + | ^^ only `Fn` traits may use parentheses -error[E0121]: the type placeholder `_` is not allowed within types on item signatures - --> $DIR/unboxed-closure-sugar-used-on-struct.rs:17:15 +error[E0107]: wrong number of type arguments: expected 1, found 0 + --> $DIR/unboxed-closure-sugar-used-on-struct.rs:7:15 | LL | fn foo(b: Box) { - | ^^^^^ not allowed in type signatures + | ^^^^^ expected 1 type argument error: aborting due to 2 previous errors -Some errors occurred: E0121, E0214. -For more information about an error, try `rustc --explain E0121`. +Some errors occurred: E0107, E0214. +For more information about an error, try `rustc --explain E0107`. diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs index bb7e02d0d8b..df0c495a11c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] trait One { fn foo(&self) -> A; } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr index e7476f0fa6d..84ed797450c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr @@ -1,5 +1,5 @@ error[E0220]: associated type `Output` not found for `One<()>` - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:15:15 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:15 | LL | fn foo(_: &One()) //~ ERROR associated type `Output` not found for `One<()>` | ^^ associated type `Output` not found diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs index 20fdd52b82a..5f5ad7902aa 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] trait Three { fn dummy(&self) -> (A,B,C); } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr index f15868af7c0..3a9fff3831c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr @@ -1,11 +1,11 @@ error[E0107]: wrong number of type arguments: expected 3, found 1 - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:15:12 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:12 | LL | fn foo(_: &Three()) | ^^^^^^^ expected 3 type arguments error[E0220]: associated type `Output` not found for `Three<(), [type error], [type error]>` - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:15:17 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:5:17 | LL | fn foo(_: &Three()) | ^^ associated type `Output` not found diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs index 027fa6b0fe3..2e87d91f8bd 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] trait Zero { fn dummy(&self); } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr index d54f7741944..3f80197897c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr @@ -1,11 +1,11 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:15:15 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:15 | LL | fn foo(_: Zero()) | ^^ unexpected type argument error[E0220]: associated type `Output` not found for `Zero` - --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:15:15 + --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:15 | LL | fn foo(_: Zero()) | ^^ associated type `Output` not found diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs index 5e4e180201d..3e5342ca7df 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] trait Trait {} diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr index a4784ee0ae8..a04062e7b9d 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr @@ -1,11 +1,11 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 - --> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:13 + --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:13 | LL | fn f isize>(x: F) {} | ^^^^^^^ unexpected type argument error[E0220]: associated type `Output` not found for `Trait` - --> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:24 + --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:24 | LL | fn f isize>(x: F) {} | ^^^^^ associated type `Output` not found diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr index cadda398c6f..a47d33d29e1 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/unboxed-closures-borrow-conflict.rs:19:14 + --> $DIR/unboxed-closures-borrow-conflict.rs:9:14 | LL | let f = || x += 1; | -- - borrow occurs due to use of `x` in closure diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs index aa50fb83773..835a1f59860 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that an unboxed closure that mutates a free variable will // cause borrow conflicts. diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr index 9bdd1022fd1..461eebc59c0 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr @@ -1,5 +1,5 @@ error[E0503]: cannot use `x` because it was mutably borrowed - --> $DIR/unboxed-closures-borrow-conflict.rs:19:9 + --> $DIR/unboxed-closures-borrow-conflict.rs:9:9 | LL | let f = || x += 1; | -- borrow of `x` occurs here diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr index f1cbb95b1ae..1749c20b582 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr @@ -1,5 +1,5 @@ error[E0597]: `factorial` does not live long enough - --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:25:17 + --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:15:17 | LL | let f = |x: u32| -> u32 { | --------------- value captured here @@ -13,7 +13,7 @@ LL | } | borrow might be used here, when `factorial` is dropped and runs the destructor for type `std::option::Option u32>>` error[E0506]: cannot assign to `factorial` because it is borrowed - --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:30:5 + --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:20:5 | LL | let f = |x: u32| -> u32 { | --------------- borrow of `factorial` occurs here @@ -27,7 +27,7 @@ LL | factorial = Some(Box::new(f)); | borrow later used here error[E0597]: `factorial` does not live long enough - --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:38:17 + --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:28:17 | LL | let mut factorial: Option u32 + 'static>> = None; | ------------------------------------- type annotation requires that `factorial` is borrowed for `'static` @@ -42,7 +42,7 @@ LL | } | - `factorial` dropped here while still borrowed error[E0506]: cannot assign to `factorial` because it is borrowed - --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:42:5 + --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:32:5 | LL | let mut factorial: Option u32 + 'static>> = None; | ------------------------------------- type annotation requires that `factorial` is borrowed for `'static` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs index ce60521034e..b72482a7121 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Various unsuccessful attempts to put the unboxed closure kind // inference into an awkward position that might require fixed point // iteration (basically where inferring the kind of a closure `c` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr index 8390e9f0f95..85d98c18d7f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr @@ -1,5 +1,5 @@ error[E0597]: `factorial` does not live long enough - --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:25:17 + --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:15:17 | LL | let f = |x: u32| -> u32 { | --------------- capture occurs here @@ -12,7 +12,7 @@ LL | } = note: values in a scope are dropped in the opposite order they are created error[E0373]: closure may outlive the current function, but it borrows `factorial`, which is owned by the current function - --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:36:13 + --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:26:13 | LL | let f = |x: u32| -> u32 { | ^^^^^^^^^^^^^^^ may outlive borrowed value `factorial` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs index 8f5bf827fcf..d03001f5237 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Various unsuccessful attempts to put the unboxed closure kind // inference into an awkward position that might require fixed point // iteration (basically where inferring the kind of a closure `c` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.stderr index fd6858cf7bf..bd58e241f0c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/unboxed-closures-failed-recursive-fn-2.rs:26:32 + --> $DIR/unboxed-closures-failed-recursive-fn-2.rs:16:32 | LL | let mut closure0 = None; | ------------ consider giving `closure0` a type diff --git a/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.rs b/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.rs index 2e865b2aac8..9f1c4c1a9e7 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks that the Fn trait hierarchy rules do not permit // Fn to be used where FnMut is implemented. diff --git a/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr index e5e66efcaa2..fcf11290c81 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr @@ -1,12 +1,12 @@ error[E0277]: expected a `std::ops::Fn<(isize,)>` closure, found `S` - --> $DIR/unboxed-closures-fnmut-as-fn.rs:38:13 + --> $DIR/unboxed-closures-fnmut-as-fn.rs:28:13 | LL | let x = call_it(&S, 22); | ^^^^^^^ expected an `Fn<(isize,)>` closure, found `S` | = help: the trait `std::ops::Fn<(isize,)>` is not implemented for `S` note: required by `call_it` - --> $DIR/unboxed-closures-fnmut-as-fn.rs:33:1 + --> $DIR/unboxed-closures-fnmut-as-fn.rs:23:1 | LL | fn call_itisize>(f: &F, x: isize) -> isize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs index bfb24c58722..a1364b93fa4 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(fn_traits)] // That a closure whose expected argument types include two distinct diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr index 7e59347155b..bf43dc62744 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr @@ -1,19 +1,19 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:27:15 + --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:15 | LL | x.set(y); //~ ERROR E0312 | ^ | -note: ...the reference is valid for the anonymous lifetime #3 defined on the body at 26:14... - --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:26:14 +note: ...the reference is valid for the anonymous lifetime #3 defined on the body at 16:14... + --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14 | LL | doit(0, &|x, y| { | ______________^ LL | | x.set(y); //~ ERROR E0312 LL | | }); | |_____^ -note: ...but the borrowed content is only valid for the anonymous lifetime #4 defined on the body at 26:14 - --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:26:14 +note: ...but the borrowed content is only valid for the anonymous lifetime #4 defined on the body at 16:14 + --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:16:14 | LL | doit(0, &|x, y| { | ______________^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.rs index 481346ad4b6..6e404c6160a 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] fn foo(f: F) diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr index 0062ea77c0b..384cd090cb3 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr @@ -1,5 +1,5 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` - --> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:24:13 + --> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:14:13 | LL | let c = || drop(y.0); //~ ERROR expected a closure that implements the `Fn` trait | ^^^^^^^^-^^^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr index 718c3a19938..89ac402b5e0 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `tick1` as mutable, as it is not declared as mutable - --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:27:9 + --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:17:9 | LL | let tick1 = || { | ----- help: consider changing this to be mutable: `mut tick1` @@ -8,7 +8,7 @@ LL | tick1(); | ^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `tick2` as mutable, as it is not declared as mutable - --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:30:5 + --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:20:5 | LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1` | ----- help: consider changing this to be mutable: `mut tick2` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs index 7c5ea031596..aaa692c109f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to infer a suitable kind for this closure // that is just called (`FnMut`). diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr index 4303b4c2f21..bc839d7b536 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr @@ -1,5 +1,5 @@ error[E0595]: closure cannot assign to immutable local variable `tick1` - --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:26:17 + --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:16:17 | LL | let tick1 = || { | ----- help: make this binding mutable: `mut tick1` @@ -8,7 +8,7 @@ LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local var | ^^ cannot borrow mutably error[E0596]: cannot borrow immutable local variable `tick2` as mutable - --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:30:5 + --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:20:5 | LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1` | ----- help: make this binding mutable: `mut tick2` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr index c57f97652b3..9c0a71e73f5 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable - --> $DIR/unboxed-closures-infer-fnmut-missing-mut.rs:17:5 + --> $DIR/unboxed-closures-infer-fnmut-missing-mut.rs:7:5 | LL | let tick = || counter += 1; | ---- help: consider changing this to be mutable: `mut tick` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.rs index 9e4ed307996..de3f9839d26 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to infer a suitable kind for this closure // that is just called (`FnMut`). diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr index 1930a929da1..d4d285275e9 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `tick` as mutable - --> $DIR/unboxed-closures-infer-fnmut-missing-mut.rs:17:5 + --> $DIR/unboxed-closures-infer-fnmut-missing-mut.rs:7:5 | LL | let tick = || counter += 1; | ---- help: make this binding mutable: `mut tick` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr index a26dc08e54a..fa3426a1f70 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable - --> $DIR/unboxed-closures-infer-fnmut-move-missing-mut.rs:17:5 + --> $DIR/unboxed-closures-infer-fnmut-move-missing-mut.rs:7:5 | LL | let tick = move || counter += 1; | ---- help: consider changing this to be mutable: `mut tick` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.rs index de17d25b4c3..b011c5a58bc 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to infer a suitable kind for this closure // that is just called (`FnMut`). diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr index 9515fe50241..2137f9904ce 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `tick` as mutable - --> $DIR/unboxed-closures-infer-fnmut-move-missing-mut.rs:17:5 + --> $DIR/unboxed-closures-infer-fnmut-move-missing-mut.rs:7:5 | LL | let tick = move || counter += 1; | ---- help: make this binding mutable: `mut tick` diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.rs index 0050fbdde26..a98a01ca598 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to infer a suitable kind for this closure // that is just called (`FnMut`). diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr index c713b3dd8fe..52650903ba3 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `tick` - --> $DIR/unboxed-closures-infer-fnonce-call-twice.rs:20:5 + --> $DIR/unboxed-closures-infer-fnonce-call-twice.rs:10:5 | LL | tick(); | ---- value moved here @@ -7,7 +7,7 @@ LL | tick(); //~ ERROR use of moved value: `tick` | ^^^^ value used here after move | note: closure cannot be invoked more than once because it moves the variable `counter` out of its environment - --> $DIR/unboxed-closures-infer-fnonce-call-twice.rs:18:29 + --> $DIR/unboxed-closures-infer-fnonce-call-twice.rs:8:29 | LL | let tick = || mem::drop(counter); | ^^^^^^^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.rs index f9709b8c596..f87be4a06f7 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we are able to infer a suitable kind for this closure // that is just called (`FnMut`). diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr index a9006318cd8..23d61c33ffe 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `tick` - --> $DIR/unboxed-closures-infer-fnonce-move-call-twice.rs:20:5 + --> $DIR/unboxed-closures-infer-fnonce-move-call-twice.rs:10:5 | LL | tick(); | ---- value moved here @@ -7,7 +7,7 @@ LL | tick(); //~ ERROR use of moved value: `tick` | ^^^^ value used here after move | note: closure cannot be invoked more than once because it moves the variable `counter` out of its environment - --> $DIR/unboxed-closures-infer-fnonce-move-call-twice.rs:18:34 + --> $DIR/unboxed-closures-infer-fnonce-move-call-twice.rs:8:34 | LL | let tick = move || mem::drop(counter); | ^^^^^^^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr index f765f207303..9b2f1cd4ae3 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `n`, as it is not declared as mutable - --> $DIR/unboxed-closures-mutate-upvar.rs:25:9 + --> $DIR/unboxed-closures-mutate-upvar.rs:15:9 | LL | let n = 0; | - help: consider changing this to be mutable: `mut n` @@ -8,7 +8,7 @@ LL | n += 1; | ^^^^^^ cannot assign error[E0594]: cannot assign to `n`, as it is not declared as mutable - --> $DIR/unboxed-closures-mutate-upvar.rs:42:9 + --> $DIR/unboxed-closures-mutate-upvar.rs:32:9 | LL | let n = 0; | - help: consider changing this to be mutable: `mut n` @@ -17,7 +17,7 @@ LL | n += 1; //~ ERROR cannot assign | ^^^^^^ cannot assign error[E0594]: cannot assign to `n`, as it is not declared as mutable - --> $DIR/unboxed-closures-mutate-upvar.rs:56:9 + --> $DIR/unboxed-closures-mutate-upvar.rs:46:9 | LL | let n = 0; | - help: consider changing this to be mutable: `mut n` @@ -26,13 +26,13 @@ LL | n += 1; //~ ERROR cannot assign | ^^^^^^ cannot assign error[E0594]: cannot assign to `n`, as it is a captured variable in a `Fn` closure - --> $DIR/unboxed-closures-mutate-upvar.rs:63:9 + --> $DIR/unboxed-closures-mutate-upvar.rs:53:9 | LL | n += 1; //~ ERROR cannot assign | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/unboxed-closures-mutate-upvar.rs:62:23 + --> $DIR/unboxed-closures-mutate-upvar.rs:52:23 | LL | let mut f = to_fn(move || { | _______________________^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.rs b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.rs index 35052ec0bd5..3bea9226f21 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we cannot mutate an outer variable that is not declared // as `mut` through a closure. Also test that we CAN mutate a moved copy, // unless this is a `Fn` closure. Issue #16749. diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr index c0a7f3f0709..99fc287b1ee 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr @@ -1,5 +1,5 @@ error[E0595]: closure cannot assign to immutable local variable `n` - --> $DIR/unboxed-closures-mutate-upvar.rs:24:27 + --> $DIR/unboxed-closures-mutate-upvar.rs:14:27 | LL | let n = 0; | - help: make this binding mutable: `mut n` @@ -7,7 +7,7 @@ LL | let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign | ^^ cannot borrow mutably error[E0594]: cannot assign to captured outer variable in an `FnMut` closure - --> $DIR/unboxed-closures-mutate-upvar.rs:42:9 + --> $DIR/unboxed-closures-mutate-upvar.rs:32:9 | LL | let n = 0; | - help: consider making `n` mutable: `mut n` @@ -16,14 +16,14 @@ LL | n += 1; //~ ERROR cannot assign | ^^^^^^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure - --> $DIR/unboxed-closures-mutate-upvar.rs:56:9 + --> $DIR/unboxed-closures-mutate-upvar.rs:46:9 | LL | n += 1; //~ ERROR cannot assign | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications help: consider changing this closure to take self by mutable reference - --> $DIR/unboxed-closures-mutate-upvar.rs:55:23 + --> $DIR/unboxed-closures-mutate-upvar.rs:45:23 | LL | let mut f = to_fn(move || { | _______________________^ @@ -32,14 +32,14 @@ LL | | }); | |_____^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure - --> $DIR/unboxed-closures-mutate-upvar.rs:63:9 + --> $DIR/unboxed-closures-mutate-upvar.rs:53:9 | LL | n += 1; //~ ERROR cannot assign | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications help: consider changing this closure to take self by mutable reference - --> $DIR/unboxed-closures-mutate-upvar.rs:62:23 + --> $DIR/unboxed-closures-mutate-upvar.rs:52:23 | LL | let mut f = to_fn(move || { | _______________________^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.nll.stderr index be18e7cee91..2f83a6485cd 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.nll.stderr @@ -1,11 +1,11 @@ error[E0594]: cannot assign to `counter`, as it is a captured variable in a `Fn` closure - --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:24:9 + --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:14:9 | LL | counter += 1; | ^^^^^^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:23:10 + --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:13:10 | LL | call(|| { | __________^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.stderr index 756bf06440c..293f59ff4b2 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.stderr @@ -1,11 +1,11 @@ error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure - --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:24:9 + --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:14:9 | LL | counter += 1; | ^^^^^^^^^^^^ | help: consider changing this closure to take self by mutable reference - --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:23:10 + --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:13:10 | LL | call(|| { | __________^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.mir.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.mir.stderr index be18e7cee91..2f83a6485cd 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.mir.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.mir.stderr @@ -1,11 +1,11 @@ error[E0594]: cannot assign to `counter`, as it is a captured variable in a `Fn` closure - --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:24:9 + --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:14:9 | LL | counter += 1; | ^^^^^^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` - --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:23:10 + --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:13:10 | LL | call(|| { | __________^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.rs b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.rs index f20719ec7fa..a5dcb57d33a 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.nll.stderr index 652a93e610f..830f6bc993d 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*self` as mutable more than once at a time - --> $DIR/unboxed-closures-recursive-fn-using-fn-mut.rs:32:21 + --> $DIR/unboxed-closures-recursive-fn-using-fn-mut.rs:22:21 | LL | (self.func)(self, arg) | ----------- ^^^^ second mutable borrow occurs here diff --git a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs index 433c0c839c5..0beead1ad92 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(core, fn_traits, unboxed_closures)] use std::marker::PhantomData; diff --git a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.stderr index eec48dd78b0..f881d1982a5 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `*self` as mutable more than once at a time - --> $DIR/unboxed-closures-recursive-fn-using-fn-mut.rs:32:21 + --> $DIR/unboxed-closures-recursive-fn-using-fn-mut.rs:22:21 | LL | (self.func)(self, arg) | ----------- ^^^^ - first borrow ends here diff --git a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.rs b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.rs index 1c133fbfcdb..0e727b11cd2 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(unboxed_closures)] fn to_fn_mut>(f: F) -> F { f } diff --git a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr index 53386f0e68e..1fccbb9c857 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr @@ -1,5 +1,5 @@ -error[E0599]: no method named `call` found for type `[closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:16:26: 16:31]` in the current scope - --> $DIR/unboxed-closures-static-call-wrong-trait.rs:17:10 +error[E0599]: no method named `call` found for type `[closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:6:26: 6:31]` in the current scope + --> $DIR/unboxed-closures-static-call-wrong-trait.rs:7:10 | LL | mut_.call((0, )); //~ ERROR no method named `call` found | ^^^^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.rs b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.rs index dba4c8cc2e9..9f76849e5fb 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::FnMut; pub fn main() { diff --git a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr index 7e11130573b..82e8c63ce27 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/unboxed-closures-type-mismatch.rs:15:15 + --> $DIR/unboxed-closures-type-mismatch.rs:5:15 | LL | let z = f(1_usize, 2); //~ ERROR mismatched types | ^^^^^^^ expected isize, found usize diff --git a/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.rs b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.rs index 5ba93bf483f..12626fe69cb 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that unsafe extern fn pointers do not implement any Fn traits. use std::ops::{Fn,FnMut,FnOnce}; diff --git a/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr index 7c76c10443a..29f276711c7 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr @@ -1,38 +1,38 @@ error[E0277]: expected a `std::ops::Fn<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-unsafe-extern-fn.rs:22:13 + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:12:13 | LL | let x = call_it(&square, 22); | ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> std::ops::Fn<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` note: required by `call_it` - --> $DIR/unboxed-closures-unsafe-extern-fn.rs:17:1 + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:7:1 | LL | fn call_itisize>(_: &F, _: isize) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: expected a `std::ops::FnMut<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-unsafe-extern-fn.rs:27:13 + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:17:13 | LL | let y = call_it_mut(&mut square, 22); | ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> std::ops::FnMut<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` note: required by `call_it_mut` - --> $DIR/unboxed-closures-unsafe-extern-fn.rs:18:1 + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:8:1 | LL | fn call_it_mutisize>(_: &mut F, _: isize) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: expected a `std::ops::FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-unsafe-extern-fn.rs:32:13 + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:22:13 | LL | let z = call_it_once(square, 22); | ^^^^^^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> unsafe fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> std::ops::FnOnce<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}` note: required by `call_it_once` - --> $DIR/unboxed-closures-unsafe-extern-fn.rs:19:1 + --> $DIR/unboxed-closures-unsafe-extern-fn.rs:9:1 | LL | fn call_it_onceisize>(_: F, _: isize) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.rs b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.rs index ff06f7c559b..7c3152c87c4 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that unsafe extern fn pointers do not implement any Fn traits. use std::ops::{Fn,FnMut,FnOnce}; diff --git a/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr index 18ade48de66..e3824578605 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr @@ -1,38 +1,38 @@ error[E0277]: expected a `std::ops::Fn<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-abi.rs:22:13 + --> $DIR/unboxed-closures-wrong-abi.rs:12:13 | LL | let x = call_it(&square, 22); | ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> std::ops::Fn<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` note: required by `call_it` - --> $DIR/unboxed-closures-wrong-abi.rs:17:1 + --> $DIR/unboxed-closures-wrong-abi.rs:7:1 | LL | fn call_itisize>(_: &F, _: isize) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: expected a `std::ops::FnMut<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-abi.rs:27:13 + --> $DIR/unboxed-closures-wrong-abi.rs:17:13 | LL | let y = call_it_mut(&mut square, 22); | ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> std::ops::FnMut<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` note: required by `call_it_mut` - --> $DIR/unboxed-closures-wrong-abi.rs:18:1 + --> $DIR/unboxed-closures-wrong-abi.rs:8:1 | LL | fn call_it_mutisize>(_: &mut F, _: isize) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: expected a `std::ops::FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-abi.rs:32:13 + --> $DIR/unboxed-closures-wrong-abi.rs:22:13 | LL | let z = call_it_once(square, 22); | ^^^^^^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `for<'r> extern "C" fn(&'r isize) -> isize {square}` | = help: the trait `for<'r> std::ops::FnOnce<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}` note: required by `call_it_once` - --> $DIR/unboxed-closures-wrong-abi.rs:19:1 + --> $DIR/unboxed-closures-wrong-abi.rs:9:1 | LL | fn call_it_onceisize>(_: F, _: isize) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.rs b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.rs index d77750d2a04..61d46869cbb 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Tests that unsafe extern fn pointers do not implement any Fn traits. use std::ops::{Fn,FnMut,FnOnce}; diff --git a/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr index f27b73017a2..da511f091bf 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr @@ -1,38 +1,38 @@ error[E0277]: expected a `std::ops::Fn<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:23:13 + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:13:13 | LL | let x = call_it(&square, 22); | ^^^^^^^ expected an `Fn<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` | = help: the trait `for<'r> std::ops::Fn<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` note: required by `call_it` - --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:18:1 + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:8:1 | LL | fn call_itisize>(_: &F, _: isize) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: expected a `std::ops::FnMut<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:28:13 + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:18:13 | LL | let y = call_it_mut(&mut square, 22); | ^^^^^^^^^^^ expected an `FnMut<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` | = help: the trait `for<'r> std::ops::FnMut<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` note: required by `call_it_mut` - --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:19:1 + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:9:1 | LL | fn call_it_mutisize>(_: &mut F, _: isize) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: expected a `std::ops::FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` - --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:33:13 + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:23:13 | LL | let z = call_it_once(square, 22); | ^^^^^^^^^^^^ expected an `FnOnce<(&isize,)>` closure, found `unsafe fn(isize) -> isize {square}` | = help: the trait `for<'r> std::ops::FnOnce<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}` note: required by `call_it_once` - --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:20:1 + --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:10:1 | LL | fn call_it_onceisize>(_: F, _: isize) -> isize { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unconstrained-none.rs b/src/test/ui/unconstrained-none.rs index 81247734979..e180b3163d4 100644 --- a/src/test/ui/unconstrained-none.rs +++ b/src/test/ui/unconstrained-none.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #5062 fn main() { diff --git a/src/test/ui/unconstrained-none.stderr b/src/test/ui/unconstrained-none.stderr index 34d524abed9..e0ddae4cc89 100644 --- a/src/test/ui/unconstrained-none.stderr +++ b/src/test/ui/unconstrained-none.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/unconstrained-none.rs:14:5 + --> $DIR/unconstrained-none.rs:4:5 | LL | None; //~ ERROR type annotations needed [E0282] | ^^^^ cannot infer type for `T` diff --git a/src/test/ui/unconstrained-ref.rs b/src/test/ui/unconstrained-ref.rs index 05c0d23b7e7..473ca954b23 100644 --- a/src/test/ui/unconstrained-ref.rs +++ b/src/test/ui/unconstrained-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S<'a, T:'a> { o: &'a Option } diff --git a/src/test/ui/unconstrained-ref.stderr b/src/test/ui/unconstrained-ref.stderr index 1fddf453119..7722963293f 100644 --- a/src/test/ui/unconstrained-ref.stderr +++ b/src/test/ui/unconstrained-ref.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/unconstrained-ref.rs:16:5 + --> $DIR/unconstrained-ref.rs:6:5 | LL | S { o: &None }; //~ ERROR type annotations needed [E0282] | ^ cannot infer type for `T` diff --git a/src/test/ui/underscore-ident-matcher.rs b/src/test/ui/underscore-ident-matcher.rs index eee99296c79..bddc8c80a7b 100644 --- a/src/test/ui/underscore-ident-matcher.rs +++ b/src/test/ui/underscore-ident-matcher.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - macro_rules! identity { ($i: ident) => ( $i diff --git a/src/test/ui/underscore-ident-matcher.stderr b/src/test/ui/underscore-ident-matcher.stderr index e148c48ed13..29fb9157b68 100644 --- a/src/test/ui/underscore-ident-matcher.stderr +++ b/src/test/ui/underscore-ident-matcher.stderr @@ -1,11 +1,11 @@ error: no rules expected the token `_` - --> $DIR/underscore-ident-matcher.rs:18:19 + --> $DIR/underscore-ident-matcher.rs:8:19 | LL | macro_rules! identity { | --------------------- when calling this macro ... LL | let identity!(_) = 10; //~ ERROR no rules expected the token `_` - | ^ no rules expected the token `_` + | ^ no rules expected this token in macro call error: aborting due to previous error diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.rs b/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.rs index 6c83205d050..37c87dbeaa9 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.rs +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that the `'_` in `dyn Trait + '_` acts like ordinary elision, // and not like an object lifetime default. // diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr index 1017217828a..904c6c23def 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr @@ -1,11 +1,11 @@ error[E0106]: missing lifetime specifier - --> $DIR/dyn-trait-underscore-in-struct.rs:19:24 + --> $DIR/dyn-trait-underscore-in-struct.rs:9:24 | LL | x: Box, //~ ERROR missing lifetime specifier | ^^ expected lifetime parameter error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound - --> $DIR/dyn-trait-underscore-in-struct.rs:19:12 + --> $DIR/dyn-trait-underscore-in-struct.rs:9:12 | LL | x: Box, //~ ERROR missing lifetime specifier | ^^^^^^^^^^^^^^ diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs b/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs index 247492fb7b7..d5aa18eb0f4 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that the `'_` in `dyn Trait + '_` acts like ordinary elision, // and not like an object lifetime default. // diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr index cb545ca008d..4eb959311ca 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr @@ -1,11 +1,11 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements - --> $DIR/dyn-trait-underscore.rs:18:20 + --> $DIR/dyn-trait-underscore.rs:8:20 | LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime | ^^^^ | -note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 16:1... - --> $DIR/dyn-trait-underscore.rs:16:1 +note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 6:1... + --> $DIR/dyn-trait-underscore.rs:6:1 | LL | / fn a(items: &[T]) -> Box> { LL | | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static` @@ -13,7 +13,7 @@ LL | | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime LL | | } | |_^ note: ...so that reference does not outlive borrowed content - --> $DIR/dyn-trait-underscore.rs:18:14 + --> $DIR/dyn-trait-underscore.rs:8:14 | LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime | ^^^^^ diff --git a/src/test/ui/underscore-lifetime/in-fn-return-illegal.rs b/src/test/ui/underscore-lifetime/in-fn-return-illegal.rs index 09f3abd9135..a46ece7d47e 100644 --- a/src/test/ui/underscore-lifetime/in-fn-return-illegal.rs +++ b/src/test/ui/underscore-lifetime/in-fn-return-illegal.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that the `'_` used in structs/enums gives an error. use std::fmt::Debug; diff --git a/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr b/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr index f3ba3e52924..ec9fe6ad9ae 100644 --- a/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr +++ b/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr @@ -1,5 +1,5 @@ error[E0106]: missing lifetime specifier - --> $DIR/in-fn-return-illegal.rs:15:30 + --> $DIR/in-fn-return-illegal.rs:5:30 | LL | fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } //~ ERROR missing lifetime specifier | ^^ expected lifetime parameter diff --git a/src/test/ui/underscore-lifetime/in-struct.rs b/src/test/ui/underscore-lifetime/in-struct.rs index 1c1a9ef62d5..bed89c7dc09 100644 --- a/src/test/ui/underscore-lifetime/in-struct.rs +++ b/src/test/ui/underscore-lifetime/in-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that the `'_` used in structs/enums gives an error. use std::fmt::Debug; diff --git a/src/test/ui/underscore-lifetime/in-struct.stderr b/src/test/ui/underscore-lifetime/in-struct.stderr index d288995d4bb..2b19c6865dc 100644 --- a/src/test/ui/underscore-lifetime/in-struct.stderr +++ b/src/test/ui/underscore-lifetime/in-struct.stderr @@ -1,11 +1,11 @@ error[E0106]: missing lifetime specifier - --> $DIR/in-struct.rs:16:9 + --> $DIR/in-struct.rs:6:9 | LL | x: &'_ u32, //~ ERROR missing lifetime specifier | ^^ expected lifetime parameter error[E0106]: missing lifetime specifier - --> $DIR/in-struct.rs:20:14 + --> $DIR/in-struct.rs:10:14 | LL | Variant(&'_ u32), //~ ERROR missing lifetime specifier | ^^ expected lifetime parameter diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs index 9048e65648a..614f7e49f87 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Foo<'a>(&'a u8); struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr index e56d008d266..e0c2c89c08c 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr @@ -1,23 +1,23 @@ error[E0637]: `'_` cannot be used here - --> $DIR/underscore-lifetime-binders.rs:14:8 + --> $DIR/underscore-lifetime-binders.rs:4:8 | LL | fn foo<'_> //~ ERROR cannot be used here | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here - --> $DIR/underscore-lifetime-binders.rs:20:21 + --> $DIR/underscore-lifetime-binders.rs:10:21 | LL | fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here | ^^ `'_` is a reserved lifetime name error[E0106]: missing lifetime specifier - --> $DIR/underscore-lifetime-binders.rs:12:17 + --> $DIR/underscore-lifetime-binders.rs:2:17 | LL | struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier | ^^ expected lifetime parameter error[E0106]: missing lifetime specifier - --> $DIR/underscore-lifetime-binders.rs:20:29 + --> $DIR/underscore-lifetime-binders.rs:10:29 | LL | fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here | ^^ help: consider giving it a 'static lifetime: `'static` @@ -25,7 +25,7 @@ LL | fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from error[E0106]: missing lifetime specifier - --> $DIR/underscore-lifetime-binders.rs:26:35 + --> $DIR/underscore-lifetime-binders.rs:16:35 | LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } //~ ERROR missing lifetime specifier | ^^ expected lifetime parameter diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.rs b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.rs index b36c8eb324e..f465a804283 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.rs +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch fn main() {} diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr index 0847ea362c9..b653b30bf6b 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/underscore-lifetime-elison-mismatch.rs:11:49 + --> $DIR/underscore-lifetime-elison-mismatch.rs:1:49 | LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch | ------ ------ ^ ...but data from `y` flows into `x` here diff --git a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.rs b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.rs index b514ff43860..567cc7a3f5f 100644 --- a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.rs +++ b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.rs @@ -4,5 +4,5 @@ // #54902 trait Foo<'a> {} -impl<'b: '_> Foo<'b> for i32 {} +impl<'b: '_> Foo<'b> for i32 {} //~ ERROR `'_` cannot be used here fn main() { } diff --git a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr index 4b38a26f957..e4ff653f3ad 100644 --- a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr +++ b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr @@ -1,7 +1,7 @@ error[E0637]: `'_` cannot be used here --> $DIR/underscore-outlives-bounds.rs:7:10 | -LL | impl<'b: '_> Foo<'b> for i32 {} +LL | impl<'b: '_> Foo<'b> for i32 {} //~ ERROR `'_` cannot be used here | ^^ `'_` is a reserved lifetime name error: aborting due to previous error diff --git a/src/test/ui/underscore_const_names.rs b/src/test/ui/underscore_const_names.rs index 8d31fd0b1e9..1db022e8862 100644 --- a/src/test/ui/underscore_const_names.rs +++ b/src/test/ui/underscore_const_names.rs @@ -1,16 +1,5 @@ -// Copyright 2012-2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass -#![feature(const_let)] #![feature(underscore_const_names)] trait Trt {} diff --git a/src/test/ui/underscore_const_names_feature_gate.rs b/src/test/ui/underscore_const_names_feature_gate.rs deleted file mode 100644 index b2174036ded..00000000000 --- a/src/test/ui/underscore_const_names_feature_gate.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012-2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -const _: () = (); //~ ERROR is unstable -static _: () = (); //~ ERROR is unstable - -fn main() {} diff --git a/src/test/ui/underscore_const_names_feature_gate.stderr b/src/test/ui/underscore_const_names_feature_gate.stderr deleted file mode 100644 index c97b3f8d4d3..00000000000 --- a/src/test/ui/underscore_const_names_feature_gate.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0658]: naming constants with `_` is unstable (see issue #54912) - --> $DIR/underscore_const_names_feature_gate.rs:11:1 - | -LL | const _: () = (); //~ ERROR is unstable - | ^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(underscore_const_names)] to the crate attributes to enable - -error[E0658]: naming constants with `_` is unstable (see issue #54912) - --> $DIR/underscore_const_names_feature_gate.rs:12:1 - | -LL | static _: () = (); //~ ERROR is unstable - | ^^^^^^^^^^^^^^^^^^ - | - = help: add #![feature(underscore_const_names)] to the crate attributes to enable - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/unevaluated_fixed_size_array_len.rs b/src/test/ui/unevaluated_fixed_size_array_len.rs index a6ed9f32106..6c545913dd9 100644 --- a/src/test/ui/unevaluated_fixed_size_array_len.rs +++ b/src/test/ui/unevaluated_fixed_size_array_len.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // https://github.com/rust-lang/rust/issues/49208 trait Foo { diff --git a/src/test/ui/unevaluated_fixed_size_array_len.stderr b/src/test/ui/unevaluated_fixed_size_array_len.stderr index 6e959da9939..200cf2a994d 100644 --- a/src/test/ui/unevaluated_fixed_size_array_len.stderr +++ b/src/test/ui/unevaluated_fixed_size_array_len.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `[(); 0]: Foo` is not satisfied - --> $DIR/unevaluated_fixed_size_array_len.rs:22:5 + --> $DIR/unevaluated_fixed_size_array_len.rs:12:5 | LL | <[(); 0] as Foo>::foo() //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[(); 0]` @@ -7,7 +7,7 @@ LL | <[(); 0] as Foo>::foo() //~ ERROR E0277 = help: the following implementations were found: <[(); 1] as Foo> note: required by `Foo::foo` - --> $DIR/unevaluated_fixed_size_array_len.rs:14:5 + --> $DIR/unevaluated_fixed_size_array_len.rs:4:5 | LL | fn foo(); | ^^^^^^^^^ diff --git a/src/test/ui/uninhabited/privately-uninhabited-dead-code.rs b/src/test/ui/uninhabited/privately-uninhabited-dead-code.rs new file mode 100644 index 00000000000..9fe8a5c832c --- /dev/null +++ b/src/test/ui/uninhabited/privately-uninhabited-dead-code.rs @@ -0,0 +1,20 @@ +// compile-pass + +#![deny(unused_variables)] + +mod foo { + enum Bar {} + + #[allow(dead_code)] + pub struct Foo { + value: Bar, // "privately" uninhabited + } + + pub fn give_foo() -> Foo { panic!() } +} + +fn main() { + let a = 42; + foo::give_foo(); + println!("Hello, {}", a); // ok: we can't tell that this code is dead +} diff --git a/src/test/ui/uninhabited/uninhabited-enum-cast.rs b/src/test/ui/uninhabited/uninhabited-enum-cast.rs index 2a5d25e6b98..7e178e054cc 100644 --- a/src/test/ui/uninhabited/uninhabited-enum-cast.rs +++ b/src/test/ui/uninhabited/uninhabited-enum-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum E {} fn f(e: E) { diff --git a/src/test/ui/uninhabited/uninhabited-enum-cast.stderr b/src/test/ui/uninhabited/uninhabited-enum-cast.stderr index 058f8fba77c..36dab0c43eb 100644 --- a/src/test/ui/uninhabited/uninhabited-enum-cast.stderr +++ b/src/test/ui/uninhabited/uninhabited-enum-cast.stderr @@ -1,5 +1,5 @@ error[E0605]: non-primitive cast: `E` as `isize` - --> $DIR/uninhabited-enum-cast.rs:14:20 + --> $DIR/uninhabited-enum-cast.rs:4:20 | LL | println!("{}", (e as isize).to_string()); //~ ERROR non-primitive cast | ^^^^^^^^^^^^ diff --git a/src/test/ui/uninhabited/uninhabited-irrefutable.rs b/src/test/ui/uninhabited/uninhabited-irrefutable.rs index 05a97b855e7..c32d3a4a0a2 100644 --- a/src/test/ui/uninhabited/uninhabited-irrefutable.rs +++ b/src/test/ui/uninhabited/uninhabited-irrefutable.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(never_type)] #![feature(exhaustive_patterns)] diff --git a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr index e14ca626222..63819bf949b 100644 --- a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr +++ b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr @@ -1,5 +1,5 @@ error[E0005]: refutable pattern in local binding: `A(_)` not covered - --> $DIR/uninhabited-irrefutable.rs:37:9 + --> $DIR/uninhabited-irrefutable.rs:27:9 | LL | let Foo::D(_y) = x; //~ ERROR refutable pattern in local binding: `A(_)` not covered | ^^^^^^^^^^ pattern `A(_)` not covered diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs index 1d3f8ff12d8..38a52d5860d 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - enum Void {} fn main() { diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index 83fd736a997..b88dcc9aea4 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -1,59 +1,59 @@ error[E0004]: non-exhaustive patterns: `Err(_)` not covered - --> $DIR/uninhabited-matches-feature-gated.rs:15:19 + --> $DIR/uninhabited-matches-feature-gated.rs:5:19 | LL | let _ = match x { //~ ERROR non-exhaustive | ^ pattern `Err(_)` not covered -error[E0004]: non-exhaustive patterns: type &Void is non-empty - --> $DIR/uninhabited-matches-feature-gated.rs:20:19 +error[E0004]: non-exhaustive patterns: type `&Void` is non-empty + --> $DIR/uninhabited-matches-feature-gated.rs:10:19 | LL | let _ = match x {}; //~ ERROR non-exhaustive | ^ | help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/uninhabited-matches-feature-gated.rs:20:19 + --> $DIR/uninhabited-matches-feature-gated.rs:10:19 | LL | let _ = match x {}; //~ ERROR non-exhaustive | ^ -error[E0004]: non-exhaustive patterns: type (Void,) is non-empty - --> $DIR/uninhabited-matches-feature-gated.rs:23:19 +error[E0004]: non-exhaustive patterns: type `(Void,)` is non-empty + --> $DIR/uninhabited-matches-feature-gated.rs:13:19 | LL | let _ = match x {}; //~ ERROR non-exhaustive | ^ | help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/uninhabited-matches-feature-gated.rs:23:19 + --> $DIR/uninhabited-matches-feature-gated.rs:13:19 | LL | let _ = match x {}; //~ ERROR non-exhaustive | ^ -error[E0004]: non-exhaustive patterns: type [Void; 1] is non-empty - --> $DIR/uninhabited-matches-feature-gated.rs:26:19 +error[E0004]: non-exhaustive patterns: type `[Void; 1]` is non-empty + --> $DIR/uninhabited-matches-feature-gated.rs:16:19 | LL | let _ = match x {}; //~ ERROR non-exhaustive | ^ | help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/uninhabited-matches-feature-gated.rs:26:19 + --> $DIR/uninhabited-matches-feature-gated.rs:16:19 | LL | let _ = match x {}; //~ ERROR non-exhaustive | ^ error[E0004]: non-exhaustive patterns: `&[_]` not covered - --> $DIR/uninhabited-matches-feature-gated.rs:29:19 + --> $DIR/uninhabited-matches-feature-gated.rs:19:19 | LL | let _ = match x { //~ ERROR non-exhaustive | ^ pattern `&[_]` not covered error[E0004]: non-exhaustive patterns: `Err(_)` not covered - --> $DIR/uninhabited-matches-feature-gated.rs:37:19 + --> $DIR/uninhabited-matches-feature-gated.rs:27:19 | LL | let _ = match x { //~ ERROR non-exhaustive | ^ pattern `Err(_)` not covered error[E0005]: refutable pattern in local binding: `Err(_)` not covered - --> $DIR/uninhabited-matches-feature-gated.rs:42:9 + --> $DIR/uninhabited-matches-feature-gated.rs:32:9 | LL | let Ok(x) = x; | ^^^^^ pattern `Err(_)` not covered diff --git a/src/test/ui/uninhabited/uninhabited-patterns.rs b/src/test/ui/uninhabited/uninhabited-patterns.rs index 2cf4b78bdff..609ed3d75ba 100644 --- a/src/test/ui/uninhabited/uninhabited-patterns.rs +++ b/src/test/ui/uninhabited/uninhabited-patterns.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_patterns)] #![feature(box_syntax)] #![feature(never_type)] diff --git a/src/test/ui/uninhabited/uninhabited-patterns.stderr b/src/test/ui/uninhabited/uninhabited-patterns.stderr index f11ff7c13b5..eaae024cbf9 100644 --- a/src/test/ui/uninhabited/uninhabited-patterns.stderr +++ b/src/test/ui/uninhabited/uninhabited-patterns.stderr @@ -1,35 +1,35 @@ error: unreachable pattern - --> $DIR/uninhabited-patterns.rs:37:9 + --> $DIR/uninhabited-patterns.rs:27:9 | LL | &[..] => (), //~ ERROR unreachable pattern | ^^^^^ | note: lint level defined here - --> $DIR/uninhabited-patterns.rs:16:9 + --> $DIR/uninhabited-patterns.rs:6:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern - --> $DIR/uninhabited-patterns.rs:42:9 + --> $DIR/uninhabited-patterns.rs:32:9 | LL | Ok(box _) => (), //~ ERROR unreachable pattern | ^^^^^^^^^ error: unreachable pattern - --> $DIR/uninhabited-patterns.rs:44:9 + --> $DIR/uninhabited-patterns.rs:34:9 | LL | Err(&[..]) => (), //~ ERROR unreachable pattern | ^^^^^^^^^^ error: unreachable pattern - --> $DIR/uninhabited-patterns.rs:51:9 + --> $DIR/uninhabited-patterns.rs:41:9 | LL | Err(Ok(_y)) => (), //~ ERROR unreachable pattern | ^^^^^^^^^^^ error: unreachable pattern - --> $DIR/uninhabited-patterns.rs:54:15 + --> $DIR/uninhabited-patterns.rs:44:15 | LL | while let Some(_y) = foo() { | ^^^^^^^^ diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr index 6b18aff9f6b..29d161fe150 100644 --- a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr +++ b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr @@ -1,62 +1,68 @@ -error[E0502]: cannot borrow `u.y` as immutable because it is also borrowed as mutable - --> $DIR/union-borrow-move-parent-sibling.rs:25:13 +error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0`) + --> $DIR/union-borrow-move-parent-sibling.rs:15:13 | LL | let a = &mut u.x.0; - | ---------- mutable borrow occurs here + | ---------- mutable borrow occurs here (via `u.x.0`) LL | let b = &u.y; //~ ERROR cannot borrow `u.y` - | ^^^^ immutable borrow occurs here + | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0` -- occurs here LL | use_borrow(a); | - mutable borrow later used here + | + = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x.0` error[E0382]: use of moved value: `u` - --> $DIR/union-borrow-move-parent-sibling.rs:32:13 + --> $DIR/union-borrow-move-parent-sibling.rs:22:13 | +LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; + | - move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = u.x.0; | ----- value moved here LL | let b = u.y; //~ ERROR use of moved value: `u.y` | ^^^ value used here after move - | - = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait -error[E0502]: cannot borrow `u.y` as immutable because it is also borrowed as mutable - --> $DIR/union-borrow-move-parent-sibling.rs:38:13 +error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0.0`) + --> $DIR/union-borrow-move-parent-sibling.rs:28:13 | LL | let a = &mut (u.x.0).0; - | -------------- mutable borrow occurs here + | -------------- mutable borrow occurs here (via `u.x.0.0`) LL | let b = &u.y; //~ ERROR cannot borrow `u.y` - | ^^^^ immutable borrow occurs here + | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0.0` -- occurs here LL | use_borrow(a); | - mutable borrow later used here + | + = note: `u.y` is a field of the union `U`, so it overlaps the field `u.x.0.0` error[E0382]: use of moved value: `u` - --> $DIR/union-borrow-move-parent-sibling.rs:45:13 + --> $DIR/union-borrow-move-parent-sibling.rs:35:13 | +LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; + | - move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = (u.x.0).0; | --------- value moved here LL | let b = u.y; //~ ERROR use of moved value: `u.y` | ^^^ value used here after move - | - = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait -error[E0502]: cannot borrow `u.x` as immutable because it is also borrowed as mutable - --> $DIR/union-borrow-move-parent-sibling.rs:51:13 +error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `*u.y`) + --> $DIR/union-borrow-move-parent-sibling.rs:41:13 | LL | let a = &mut *u.y; - | --------- mutable borrow occurs here + | --------- mutable borrow occurs here (via `*u.y`) LL | let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`) - | ^^^^ immutable borrow occurs here + | ^^^^ immutable borrow of `u.x` -- which overlaps with `*u.y` -- occurs here LL | use_borrow(a); | - mutable borrow later used here + | + = note: `u.x` is a field of the union `U`, so it overlaps the field `*u.y` error[E0382]: use of moved value: `u` - --> $DIR/union-borrow-move-parent-sibling.rs:58:13 + --> $DIR/union-borrow-move-parent-sibling.rs:48:13 | +LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; + | - move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = *u.y; | ---- value moved here LL | let b = u.x; //~ ERROR use of moved value: `u.x` | ^^^ value used here after move - | - = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait error: aborting due to 6 previous errors diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.rs b/src/test/ui/union/union-borrow-move-parent-sibling.rs index 99a073b838c..43abbd374fc 100644 --- a/src/test/ui/union/union-borrow-move-parent-sibling.rs +++ b/src/test/ui/union/union-borrow-move-parent-sibling.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(untagged_unions)] #![allow(unused)] diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.stderr index daf5a4f4fcc..9058707e505 100644 --- a/src/test/ui/union/union-borrow-move-parent-sibling.stderr +++ b/src/test/ui/union/union-borrow-move-parent-sibling.stderr @@ -1,5 +1,5 @@ error[E0502]: cannot borrow `u.y` as immutable because `u.x.0` is also borrowed as mutable - --> $DIR/union-borrow-move-parent-sibling.rs:25:14 + --> $DIR/union-borrow-move-parent-sibling.rs:15:14 | LL | let a = &mut u.x.0; | ----- mutable borrow occurs here @@ -10,7 +10,7 @@ LL | } | - mutable borrow ends here error[E0382]: use of moved value: `u.y` - --> $DIR/union-borrow-move-parent-sibling.rs:32:9 + --> $DIR/union-borrow-move-parent-sibling.rs:22:9 | LL | let a = u.x.0; | - value moved here @@ -20,7 +20,7 @@ LL | let b = u.y; //~ ERROR use of moved value: `u.y` = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait error[E0502]: cannot borrow `u.y` as immutable because `u.x.0.0` is also borrowed as mutable - --> $DIR/union-borrow-move-parent-sibling.rs:38:14 + --> $DIR/union-borrow-move-parent-sibling.rs:28:14 | LL | let a = &mut (u.x.0).0; | --------- mutable borrow occurs here @@ -31,7 +31,7 @@ LL | } | - mutable borrow ends here error[E0382]: use of moved value: `u.y` - --> $DIR/union-borrow-move-parent-sibling.rs:45:9 + --> $DIR/union-borrow-move-parent-sibling.rs:35:9 | LL | let a = (u.x.0).0; | - value moved here @@ -41,18 +41,18 @@ LL | let b = u.y; //~ ERROR use of moved value: `u.y` = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait error[E0502]: cannot borrow `u` (via `u.x`) as immutable because `u` is also borrowed as mutable (via `*u.y`) - --> $DIR/union-borrow-move-parent-sibling.rs:51:14 + --> $DIR/union-borrow-move-parent-sibling.rs:41:14 | LL | let a = &mut *u.y; | ---- mutable borrow occurs here (via `*u.y`) LL | let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`) - | ^^^ immutable borrow occurs here (via `u.x`) + | ^^^ immutable borrow of `u.x` -- which overlaps with `*u.y` -- occurs here LL | use_borrow(a); LL | } | - mutable borrow ends here error[E0382]: use of moved value: `u.x` - --> $DIR/union-borrow-move-parent-sibling.rs:58:9 + --> $DIR/union-borrow-move-parent-sibling.rs:48:9 | LL | let a = *u.y; | - value moved here diff --git a/src/test/ui/union/union-const-eval.rs b/src/test/ui/union/union-const-eval.rs index c640acec05e..05e849a3bb6 100644 --- a/src/test/ui/union/union-const-eval.rs +++ b/src/test/ui/union/union-const-eval.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(const_fn_union)] diff --git a/src/test/ui/union/union-const-pat.rs b/src/test/ui/union/union-const-pat.rs index 5f75e3cc4a2..e7cb248a201 100644 --- a/src/test/ui/union/union-const-pat.rs +++ b/src/test/ui/union/union-const-pat.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - union U { a: usize, b: usize, diff --git a/src/test/ui/union/union-const-pat.stderr b/src/test/ui/union/union-const-pat.stderr index 2d9c9a5e520..5106721f310 100644 --- a/src/test/ui/union/union-const-pat.stderr +++ b/src/test/ui/union/union-const-pat.stderr @@ -1,5 +1,5 @@ error: cannot use unions in constant patterns - --> $DIR/union-const-pat.rs:20:9 + --> $DIR/union-const-pat.rs:10:9 | LL | C => {} //~ ERROR cannot use unions in constant patterns | ^ diff --git a/src/test/ui/union/union-copy.rs b/src/test/ui/union/union-copy.rs index 9014b3f2956..8318f96940e 100644 --- a/src/test/ui/union/union-copy.rs +++ b/src/test/ui/union/union-copy.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(untagged_unions)] #[derive(Clone)] diff --git a/src/test/ui/union/union-copy.stderr b/src/test/ui/union/union-copy.stderr index 05da9e90af7..b3991b5ba6a 100644 --- a/src/test/ui/union/union-copy.stderr +++ b/src/test/ui/union/union-copy.stderr @@ -1,5 +1,5 @@ error[E0204]: the trait `Copy` may not be implemented for this type - --> $DIR/union-copy.rs:24:6 + --> $DIR/union-copy.rs:14:6 | LL | a: String | --------- this field does not implement `Copy` diff --git a/src/test/ui/union/union-derive-clone.rs b/src/test/ui/union/union-derive-clone.rs index 6e226d7d79f..64c3caef449 100644 --- a/src/test/ui/union/union-derive-clone.rs +++ b/src/test/ui/union/union-derive-clone.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(untagged_unions)] #[derive(Clone)] //~ ERROR the trait bound `U1: std::marker::Copy` is not satisfied diff --git a/src/test/ui/union/union-derive-clone.stderr b/src/test/ui/union/union-derive-clone.stderr index e9a92b4452a..9580a9710e1 100644 --- a/src/test/ui/union/union-derive-clone.stderr +++ b/src/test/ui/union/union-derive-clone.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `U1: std::marker::Copy` is not satisfied - --> $DIR/union-derive-clone.rs:13:10 + --> $DIR/union-derive-clone.rs:3:10 | LL | #[derive(Clone)] //~ ERROR the trait bound `U1: std::marker::Copy` is not satisfied | ^^^^^ the trait `std::marker::Copy` is not implemented for `U1` @@ -7,7 +7,7 @@ LL | #[derive(Clone)] //~ ERROR the trait bound `U1: std::marker::Copy` is not s = note: required by `std::clone::AssertParamIsCopy` error[E0599]: no method named `clone` found for type `U4` in the current scope - --> $DIR/union-derive-clone.rs:40:15 + --> $DIR/union-derive-clone.rs:30:15 | LL | union U4 { | ----------- method `clone` not found for this diff --git a/src/test/ui/union/union-derive-eq.rs b/src/test/ui/union/union-derive-eq.rs index 9dfec288c15..698c38fac72 100644 --- a/src/test/ui/union/union-derive-eq.rs +++ b/src/test/ui/union/union-derive-eq.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(untagged_unions)] #[derive(Eq)] // OK diff --git a/src/test/ui/union/union-derive-eq.stderr b/src/test/ui/union/union-derive-eq.stderr index 02fa0ca6f83..d93dcd64efc 100644 --- a/src/test/ui/union/union-derive-eq.stderr +++ b/src/test/ui/union/union-derive-eq.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied - --> $DIR/union-derive-eq.rs:25:5 + --> $DIR/union-derive-eq.rs:15:5 | LL | a: PartialEqNotEq, //~ ERROR the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied | ^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `PartialEqNotEq` diff --git a/src/test/ui/union/union-derive.rs b/src/test/ui/union/union-derive.rs index ffd290fb073..652a6b24cff 100644 --- a/src/test/ui/union/union-derive.rs +++ b/src/test/ui/union/union-derive.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Most traits cannot be derived for unions. #[derive( diff --git a/src/test/ui/union/union-derive.stderr b/src/test/ui/union/union-derive.stderr index e8e11e832d9..0ec873553f3 100644 --- a/src/test/ui/union/union-derive.stderr +++ b/src/test/ui/union/union-derive.stderr @@ -1,35 +1,35 @@ error: this trait cannot be derived for unions - --> $DIR/union-derive.rs:19:5 + --> $DIR/union-derive.rs:9:5 | LL | Debug, //~ ERROR this trait cannot be derived for unions | ^^^^^ error: this trait cannot be derived for unions - --> $DIR/union-derive.rs:18:5 + --> $DIR/union-derive.rs:8:5 | LL | Default, //~ ERROR this trait cannot be derived for unions | ^^^^^^^ error: this trait cannot be derived for unions - --> $DIR/union-derive.rs:17:5 + --> $DIR/union-derive.rs:7:5 | LL | Hash, //~ ERROR this trait cannot be derived for unions | ^^^^ error: this trait cannot be derived for unions - --> $DIR/union-derive.rs:16:5 + --> $DIR/union-derive.rs:6:5 | LL | Ord, //~ ERROR this trait cannot be derived for unions | ^^^ error: this trait cannot be derived for unions - --> $DIR/union-derive.rs:15:5 + --> $DIR/union-derive.rs:5:5 | LL | PartialOrd, //~ ERROR this trait cannot be derived for unions | ^^^^^^^^^^ error: this trait cannot be derived for unions - --> $DIR/union-derive.rs:14:5 + --> $DIR/union-derive.rs:4:5 | LL | PartialEq, //~ ERROR this trait cannot be derived for unions | ^^^^^^^^^ diff --git a/src/test/ui/union/union-empty.rs b/src/test/ui/union/union-empty.rs index 1f499c49a68..79b7e68ee6b 100644 --- a/src/test/ui/union/union-empty.rs +++ b/src/test/ui/union/union-empty.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - union U {} //~ ERROR unions cannot have zero fields fn main() {} diff --git a/src/test/ui/union/union-empty.stderr b/src/test/ui/union/union-empty.stderr index 5abe45814ac..71bba8fda2e 100644 --- a/src/test/ui/union/union-empty.stderr +++ b/src/test/ui/union/union-empty.stderr @@ -1,5 +1,5 @@ error: unions cannot have zero fields - --> $DIR/union-empty.rs:11:1 + --> $DIR/union-empty.rs:1:1 | LL | union U {} //~ ERROR unions cannot have zero fields | ^^^^^^^^^^ diff --git a/src/test/ui/union/union-fields-1.rs b/src/test/ui/union/union-fields-1.rs index dc551bb8998..6d76e18cc7e 100644 --- a/src/test/ui/union/union-fields-1.rs +++ b/src/test/ui/union/union-fields-1.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(dead_code)] union U1 { diff --git a/src/test/ui/union/union-fields-1.stderr b/src/test/ui/union/union-fields-1.stderr index e337ea9d7ee..3f165db4763 100644 --- a/src/test/ui/union/union-fields-1.stderr +++ b/src/test/ui/union/union-fields-1.stderr @@ -1,29 +1,29 @@ error: field is never used: `c` - --> $DIR/union-fields-1.rs:16:5 + --> $DIR/union-fields-1.rs:6:5 | LL | c: u8, //~ ERROR field is never used | ^^^^^ | note: lint level defined here - --> $DIR/union-fields-1.rs:11:9 + --> $DIR/union-fields-1.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ error: field is never used: `a` - --> $DIR/union-fields-1.rs:19:5 + --> $DIR/union-fields-1.rs:9:5 | LL | a: u8, //~ ERROR field is never used | ^^^^^ error: field is never used: `a` - --> $DIR/union-fields-1.rs:23:20 + --> $DIR/union-fields-1.rs:13:20 | LL | union NoDropLike { a: u8 } //~ ERROR field is never used | ^^^^^ error: field is never used: `c` - --> $DIR/union-fields-1.rs:28:5 + --> $DIR/union-fields-1.rs:18:5 | LL | c: u8, //~ ERROR field is never used | ^^^^^ diff --git a/src/test/ui/union/union-fields-2.rs b/src/test/ui/union/union-fields-2.rs index 7b9ff866a43..71b204fcdc5 100644 --- a/src/test/ui/union/union-fields-2.rs +++ b/src/test/ui/union/union-fields-2.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - union U { a: u8, b: u16, diff --git a/src/test/ui/union/union-fields-2.stderr b/src/test/ui/union/union-fields-2.stderr index cfb5bc7520b..959554f6d22 100644 --- a/src/test/ui/union/union-fields-2.stderr +++ b/src/test/ui/union/union-fields-2.stderr @@ -1,17 +1,17 @@ error: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:17:13 + --> $DIR/union-fields-2.rs:7:13 | LL | let u = U {}; //~ ERROR union expressions should have exactly one field | ^ error: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:19:13 + --> $DIR/union-fields-2.rs:9:13 | LL | let u = U { a: 0, b: 1 }; //~ ERROR union expressions should have exactly one field | ^ error[E0560]: union `U` has no field named `c` - --> $DIR/union-fields-2.rs:20:29 + --> $DIR/union-fields-2.rs:10:29 | LL | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field | ^ `U` does not have this field @@ -19,61 +19,61 @@ LL | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have = note: available fields are: `a`, `b` error: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:20:13 + --> $DIR/union-fields-2.rs:10:13 | LL | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field | ^ error: union expressions should have exactly one field - --> $DIR/union-fields-2.rs:22:13 + --> $DIR/union-fields-2.rs:12:13 | LL | let u = U { ..u }; //~ ERROR union expressions should have exactly one field | ^ error[E0436]: functional record update syntax requires a struct - --> $DIR/union-fields-2.rs:22:19 + --> $DIR/union-fields-2.rs:12:19 | LL | let u = U { ..u }; //~ ERROR union expressions should have exactly one field | ^ error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:25:9 + --> $DIR/union-fields-2.rs:15:9 | LL | let U {} = u; //~ ERROR union patterns should have exactly one field | ^^^^ error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:27:9 + --> $DIR/union-fields-2.rs:17:9 | LL | let U { a, b } = u; //~ ERROR union patterns should have exactly one field | ^^^^^^^^^^ error[E0026]: union `U` does not have a field named `c` - --> $DIR/union-fields-2.rs:28:19 + --> $DIR/union-fields-2.rs:18:19 | LL | let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field | ^ union `U` does not have this field error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:28:9 + --> $DIR/union-fields-2.rs:18:9 | LL | let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field | ^^^^^^^^^^^^^ error: union patterns should have exactly one field - --> $DIR/union-fields-2.rs:30:9 + --> $DIR/union-fields-2.rs:20:9 | LL | let U { .. } = u; //~ ERROR union patterns should have exactly one field | ^^^^^^^^ error: `..` cannot be used in union patterns - --> $DIR/union-fields-2.rs:30:9 + --> $DIR/union-fields-2.rs:20:9 | LL | let U { .. } = u; //~ ERROR union patterns should have exactly one field | ^^^^^^^^ error: `..` cannot be used in union patterns - --> $DIR/union-fields-2.rs:32:9 + --> $DIR/union-fields-2.rs:22:9 | LL | let U { a, .. } = u; //~ ERROR `..` cannot be used in union patterns | ^^^^^^^^^^^ diff --git a/src/test/ui/union/union-generic.rs b/src/test/ui/union/union-generic.rs index 8bd422b42d8..4b2ccbdb7b4 100644 --- a/src/test/ui/union/union-generic.rs +++ b/src/test/ui/union/union-generic.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::rc::Rc; union U { diff --git a/src/test/ui/union/union-generic.stderr b/src/test/ui/union/union-generic.stderr index dbfffa005fb..6a3216db643 100644 --- a/src/test/ui/union/union-generic.stderr +++ b/src/test/ui/union/union-generic.stderr @@ -1,23 +1,23 @@ error[E0277]: the trait bound `std::rc::Rc: std::marker::Copy` is not satisfied - --> $DIR/union-generic.rs:18:13 + --> $DIR/union-generic.rs:8:13 | LL | let u = U { a: Rc::new(0u32) }; | ^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc` | note: required by `U` - --> $DIR/union-generic.rs:13:1 + --> $DIR/union-generic.rs:3:1 | LL | union U { | ^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::rc::Rc: std::marker::Copy` is not satisfied - --> $DIR/union-generic.rs:20:13 + --> $DIR/union-generic.rs:10:13 | LL | let u = U::> { a: Default::default() }; | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc` | note: required by `U` - --> $DIR/union-generic.rs:13:1 + --> $DIR/union-generic.rs:3:1 | LL | union U { | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/union/union-lint-dead-code.rs b/src/test/ui/union/union-lint-dead-code.rs index a64187c5f23..cb6415c18a8 100644 --- a/src/test/ui/union/union-lint-dead-code.rs +++ b/src/test/ui/union/union-lint-dead-code.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(dead_code)] union Foo { diff --git a/src/test/ui/union/union-lint-dead-code.stderr b/src/test/ui/union/union-lint-dead-code.stderr index 2cd3aab8c29..6551523c54d 100644 --- a/src/test/ui/union/union-lint-dead-code.stderr +++ b/src/test/ui/union/union-lint-dead-code.stderr @@ -1,11 +1,11 @@ error: field is never used: `b` - --> $DIR/union-lint-dead-code.rs:15:5 + --> $DIR/union-lint-dead-code.rs:5:5 | LL | b: bool, //~ ERROR: field is never used | ^^^^^^^ | note: lint level defined here - --> $DIR/union-lint-dead-code.rs:11:9 + --> $DIR/union-lint-dead-code.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ diff --git a/src/test/ui/union/union-nonrepresentable.rs b/src/test/ui/union/union-nonrepresentable.rs index cb4683c2a0e..4dbd97ea957 100644 --- a/src/test/ui/union/union-nonrepresentable.rs +++ b/src/test/ui/union/union-nonrepresentable.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(untagged_unions)] union U { //~ ERROR recursive type `U` has infinite size diff --git a/src/test/ui/union/union-nonrepresentable.stderr b/src/test/ui/union/union-nonrepresentable.stderr index 17d78ea4c2b..1a7603a4637 100644 --- a/src/test/ui/union/union-nonrepresentable.stderr +++ b/src/test/ui/union/union-nonrepresentable.stderr @@ -1,5 +1,5 @@ error[E0072]: recursive type `U` has infinite size - --> $DIR/union-nonrepresentable.rs:13:1 + --> $DIR/union-nonrepresentable.rs:3:1 | LL | union U { //~ ERROR recursive type `U` has infinite size | ^^^^^^^ recursive type has infinite size diff --git a/src/test/ui/union/union-repr-c.rs b/src/test/ui/union/union-repr-c.rs index 36c42ce1104..658452d57f7 100644 --- a/src/test/ui/union/union-repr-c.rs +++ b/src/test/ui/union/union-repr-c.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] #![deny(improper_ctypes)] diff --git a/src/test/ui/union/union-repr-c.stderr b/src/test/ui/union/union-repr-c.stderr index ddf50049192..bac09c34b8b 100644 --- a/src/test/ui/union/union-repr-c.stderr +++ b/src/test/ui/union/union-repr-c.stderr @@ -1,17 +1,17 @@ error: `extern` block uses type `W` which is not FFI-safe: this union has unspecified layout - --> $DIR/union-repr-c.rs:25:22 + --> $DIR/union-repr-c.rs:15:22 | LL | static FOREIGN2: W; //~ ERROR union has unspecified layout | ^ | note: lint level defined here - --> $DIR/union-repr-c.rs:12:9 + --> $DIR/union-repr-c.rs:2:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ = help: consider adding a #[repr(C)] attribute to this union note: type defined here - --> $DIR/union-repr-c.rs:19:1 + --> $DIR/union-repr-c.rs:9:1 | LL | / union W { LL | | a: u8, diff --git a/src/test/ui/union/union-sized-field.rs b/src/test/ui/union/union-sized-field.rs index 66d6632ff5a..b84cb3eff56 100644 --- a/src/test/ui/union/union-sized-field.rs +++ b/src/test/ui/union/union-sized-field.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(untagged_unions)] union Foo { diff --git a/src/test/ui/union/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr index 85e9702a40e..89140030683 100644 --- a/src/test/ui/union/union-sized-field.stderr +++ b/src/test/ui/union/union-sized-field.stderr @@ -1,33 +1,33 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/union-sized-field.rs:14:5 + --> $DIR/union-sized-field.rs:4:5 | LL | value: T, | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: no field of a union may have a dynamically sized type error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/union-sized-field.rs:19:5 + --> $DIR/union-sized-field.rs:9:5 | LL | value: T, | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: only the last field of a struct may have a dynamically sized type error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/union-sized-field.rs:25:11 + --> $DIR/union-sized-field.rs:15:11 | LL | Value(T), | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type diff --git a/src/test/ui/union/union-suggest-field.rs b/src/test/ui/union/union-suggest-field.rs index 96fca78ef22..d84a22cee5a 100644 --- a/src/test/ui/union/union-suggest-field.rs +++ b/src/test/ui/union/union-suggest-field.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - union U { principal: u8, } @@ -19,8 +9,13 @@ impl U { fn main() { let u = U { principle: 0 }; //~^ ERROR union `U` has no field named `principle` + //~| HELP a field with a similar name exists + //~| SUGGESTION principal let w = u.principial; //~ ERROR no field `principial` on type `U` - //~^ did you mean `principal`? + //~| HELP a field with a similar name exists + //~| SUGGESTION principal let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U` + //~| HELP use parentheses to call the method + //~| SUGGESTION calculate() } diff --git a/src/test/ui/union/union-suggest-field.stderr b/src/test/ui/union/union-suggest-field.stderr index 631aacb0289..8ea07360d0f 100644 --- a/src/test/ui/union/union-suggest-field.stderr +++ b/src/test/ui/union/union-suggest-field.stderr @@ -1,22 +1,20 @@ error[E0560]: union `U` has no field named `principle` - --> $DIR/union-suggest-field.rs:20:17 + --> $DIR/union-suggest-field.rs:10:17 | LL | let u = U { principle: 0 }; - | ^^^^^^^^^ field does not exist - did you mean `principal`? + | ^^^^^^^^^ help: a field with a similar name exists: `principal` error[E0609]: no field `principial` on type `U` - --> $DIR/union-suggest-field.rs:22:15 + --> $DIR/union-suggest-field.rs:14:15 | LL | let w = u.principial; //~ ERROR no field `principial` on type `U` - | ^^^^^^^^^^ did you mean `principal`? + | ^^^^^^^^^^ help: a field with a similar name exists: `principal` error[E0615]: attempted to take value of method `calculate` on type `U` - --> $DIR/union-suggest-field.rs:25:15 + --> $DIR/union-suggest-field.rs:18:15 | LL | let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U` - | ^^^^^^^^^ - | - = help: maybe a `()` to call it is missing? + | ^^^^^^^^^ help: use parentheses to call the method: `calculate()` error: aborting due to 3 previous errors diff --git a/src/test/ui/union/union-unsafe.rs b/src/test/ui/union/union-unsafe.rs index d993816e6f4..6cfde35fe4c 100644 --- a/src/test/ui/union/union-unsafe.rs +++ b/src/test/ui/union/union-unsafe.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(untagged_unions)] union U1 { diff --git a/src/test/ui/union/union-unsafe.stderr b/src/test/ui/union/union-unsafe.stderr index a0b3d98f7a0..35051485f6a 100644 --- a/src/test/ui/union/union-unsafe.stderr +++ b/src/test/ui/union/union-unsafe.stderr @@ -1,5 +1,5 @@ error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block - --> $DIR/union-unsafe.rs:31:5 + --> $DIR/union-unsafe.rs:21:5 | LL | u3.a = T::default(); //~ ERROR assignment to non-`Copy` union field is unsafe | ^^^^ assignment to non-`Copy` union field @@ -7,7 +7,7 @@ LL | u3.a = T::default(); //~ ERROR assignment to non-`Copy` union field is = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-unsafe.rs:43:13 + --> $DIR/union-unsafe.rs:33:13 | LL | let a = u1.a; //~ ERROR access to union field is unsafe | ^^^^ access to union field @@ -15,7 +15,7 @@ LL | let a = u1.a; //~ ERROR access to union field is unsafe = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-unsafe.rs:45:14 + --> $DIR/union-unsafe.rs:35:14 | LL | let U1 { a } = u1; //~ ERROR access to union field is unsafe | ^ access to union field @@ -23,7 +23,7 @@ LL | let U1 { a } = u1; //~ ERROR access to union field is unsafe = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: access to union field is unsafe and requires unsafe function or block - --> $DIR/union-unsafe.rs:46:20 + --> $DIR/union-unsafe.rs:36:20 | LL | if let U1 { a: 12 } = u1 {} //~ ERROR access to union field is unsafe | ^^ access to union field @@ -31,7 +31,7 @@ LL | if let U1 { a: 12 } = u1 {} //~ ERROR access to union field is unsafe = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block - --> $DIR/union-unsafe.rs:50:5 + --> $DIR/union-unsafe.rs:40:5 | LL | u2.a = String::from("new"); //~ ERROR assignment to non-`Copy` union field is unsafe | ^^^^ assignment to non-`Copy` union field @@ -39,7 +39,7 @@ LL | u2.a = String::from("new"); //~ ERROR assignment to non-`Copy` union fi = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block - --> $DIR/union-unsafe.rs:54:5 + --> $DIR/union-unsafe.rs:44:5 | LL | u3.a = String::from("new"); //~ ERROR assignment to non-`Copy` union field is unsafe | ^^^^ assignment to non-`Copy` union field diff --git a/src/test/ui/union/union-unsized.rs b/src/test/ui/union/union-unsized.rs index d79c2ed710e..16f2a73d425 100644 --- a/src/test/ui/union/union-unsized.rs +++ b/src/test/ui/union/union-unsized.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(untagged_unions)] union U { diff --git a/src/test/ui/union/union-unsized.stderr b/src/test/ui/union/union-unsized.stderr index e2da6035881..e702f2c61be 100644 --- a/src/test/ui/union/union-unsized.stderr +++ b/src/test/ui/union/union-unsized.stderr @@ -1,21 +1,21 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/union-unsized.rs:14:5 + --> $DIR/union-unsized.rs:4:5 | LL | a: str, | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: no field of a union may have a dynamically sized type error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/union-unsized.rs:22:5 + --> $DIR/union-unsized.rs:12:5 | LL | b: str, | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: no field of a union may have a dynamically sized type error: aborting due to 2 previous errors diff --git a/src/test/ui/union/union-with-drop-fields-lint.rs b/src/test/ui/union/union-with-drop-fields-lint.rs index 87a72efbe08..8e502aa55f9 100644 --- a/src/test/ui/union/union-with-drop-fields-lint.rs +++ b/src/test/ui/union/union-with-drop-fields-lint.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(untagged_unions)] #![allow(dead_code)] #![deny(unions_with_drop_fields)] diff --git a/src/test/ui/union/union-with-drop-fields-lint.stderr b/src/test/ui/union/union-with-drop-fields-lint.stderr index 2d3d539cda5..d8f456f2aef 100644 --- a/src/test/ui/union/union-with-drop-fields-lint.stderr +++ b/src/test/ui/union/union-with-drop-fields-lint.stderr @@ -1,23 +1,23 @@ error: union contains a field with possibly non-trivial drop code, drop code of union fields is ignored when dropping the union - --> $DIR/union-with-drop-fields-lint.rs:20:5 + --> $DIR/union-with-drop-fields-lint.rs:10:5 | LL | a: String, //~ ERROR union contains a field with possibly non-trivial drop code | ^^^^^^^^^ | note: lint level defined here - --> $DIR/union-with-drop-fields-lint.rs:13:9 + --> $DIR/union-with-drop-fields-lint.rs:3:9 | LL | #![deny(unions_with_drop_fields)] | ^^^^^^^^^^^^^^^^^^^^^^^ error: union contains a field with possibly non-trivial drop code, drop code of union fields is ignored when dropping the union - --> $DIR/union-with-drop-fields-lint.rs:28:5 + --> $DIR/union-with-drop-fields-lint.rs:18:5 | LL | a: S, //~ ERROR union contains a field with possibly non-trivial drop code | ^^^^ error: union contains a field with possibly non-trivial drop code, drop code of union fields is ignored when dropping the union - --> $DIR/union-with-drop-fields-lint.rs:33:5 + --> $DIR/union-with-drop-fields-lint.rs:23:5 | LL | a: T, //~ ERROR union contains a field with possibly non-trivial drop code | ^^^^ diff --git a/src/test/ui/unique-object-noncopyable.rs b/src/test/ui/unique-object-noncopyable.rs index c44718c4fc9..1c467a2421a 100644 --- a/src/test/ui/unique-object-noncopyable.rs +++ b/src/test/ui/unique-object-noncopyable.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] trait Foo { diff --git a/src/test/ui/unique-object-noncopyable.stderr b/src/test/ui/unique-object-noncopyable.stderr index 777b9f19bad..78b46027c95 100644 --- a/src/test/ui/unique-object-noncopyable.stderr +++ b/src/test/ui/unique-object-noncopyable.stderr @@ -1,5 +1,5 @@ error[E0599]: no method named `clone` found for type `std::boxed::Box` in the current scope - --> $DIR/unique-object-noncopyable.rs:34:16 + --> $DIR/unique-object-noncopyable.rs:24:16 | LL | let _z = y.clone(); //~ ERROR no method named `clone` found | ^^^^^ diff --git a/src/test/ui/unique-pinned-nocopy.rs b/src/test/ui/unique-pinned-nocopy.rs index c09feec1d4a..4c30450c704 100644 --- a/src/test/ui/unique-pinned-nocopy.rs +++ b/src/test/ui/unique-pinned-nocopy.rs @@ -1,24 +1,14 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Debug)] -struct r { +struct R { b: bool, } -impl Drop for r { +impl Drop for R { fn drop(&mut self) {} } fn main() { - let i = Box::new(r { b: true }); + let i = Box::new(R { b: true }); let _j = i.clone(); //~ ERROR no method named `clone` found println!("{:?}", i); } diff --git a/src/test/ui/unique-pinned-nocopy.stderr b/src/test/ui/unique-pinned-nocopy.stderr index ddc676601fa..c7cabd172eb 100644 --- a/src/test/ui/unique-pinned-nocopy.stderr +++ b/src/test/ui/unique-pinned-nocopy.stderr @@ -1,11 +1,11 @@ -error[E0599]: no method named `clone` found for type `std::boxed::Box` in the current scope - --> $DIR/unique-pinned-nocopy.rs:22:16 +error[E0599]: no method named `clone` found for type `std::boxed::Box` in the current scope + --> $DIR/unique-pinned-nocopy.rs:12:16 | LL | let _j = i.clone(); //~ ERROR no method named `clone` found | ^^^^^ | = note: the method `clone` exists but the following trait bounds were not satisfied: - `std::boxed::Box : std::clone::Clone` + `std::boxed::Box : std::clone::Clone` = help: items from traits can only be used if the trait is implemented and in scope = note: the following trait defines an item `clone`, perhaps you need to implement it: candidate #1: `std::clone::Clone` diff --git a/src/test/ui/unknown-language-item.rs b/src/test/ui/unknown-language-item.rs index 3c210599712..20ffef71497 100644 --- a/src/test/ui/unknown-language-item.rs +++ b/src/test/ui/unknown-language-item.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] #![feature(lang_items)] diff --git a/src/test/ui/unknown-language-item.stderr b/src/test/ui/unknown-language-item.stderr index 95ce5db33ae..c5fe9b8ad0e 100644 --- a/src/test/ui/unknown-language-item.stderr +++ b/src/test/ui/unknown-language-item.stderr @@ -1,5 +1,5 @@ error[E0522]: definition of an unknown language item: `foo` - --> $DIR/unknown-language-item.rs:14:1 + --> $DIR/unknown-language-item.rs:4:1 | LL | #[lang = "foo"] | ^^^^^^^^^^^^^^^ definition of unknown language item `foo` diff --git a/src/test/ui/unknown-lint-tool-name.rs b/src/test/ui/unknown-lint-tool-name.rs index a1d6c27e518..c92a71e9397 100644 --- a/src/test/ui/unknown-lint-tool-name.rs +++ b/src/test/ui/unknown-lint-tool-name.rs @@ -1,15 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - #![deny(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar` #[allow(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar` diff --git a/src/test/ui/unknown-lint-tool-name.stderr b/src/test/ui/unknown-lint-tool-name.stderr index 29c3a642d87..e9d44e2e3bc 100644 --- a/src/test/ui/unknown-lint-tool-name.stderr +++ b/src/test/ui/unknown-lint-tool-name.stderr @@ -1,11 +1,11 @@ error[E0710]: an unknown tool name found in scoped lint: `foo::bar` - --> $DIR/unknown-lint-tool-name.rs:13:9 + --> $DIR/unknown-lint-tool-name.rs:1:9 | LL | #![deny(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar` | ^^^ error[E0710]: an unknown tool name found in scoped lint: `foo::bar` - --> $DIR/unknown-lint-tool-name.rs:15:9 + --> $DIR/unknown-lint-tool-name.rs:3:9 | LL | #[allow(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar` | ^^^ diff --git a/src/test/ui/unknown-tool-name.rs b/src/test/ui/unknown-tool-name.rs index 8d7a6225529..05f99ced687 100644 --- a/src/test/ui/unknown-tool-name.rs +++ b/src/test/ui/unknown-tool-name.rs @@ -1,12 +1,2 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[foo::bar] //~ ERROR failed to resolve: use of undeclared type or module `foo` fn main() {} diff --git a/src/test/ui/unknown-tool-name.stderr b/src/test/ui/unknown-tool-name.stderr index 55096614fcd..7bd2da28598 100644 --- a/src/test/ui/unknown-tool-name.stderr +++ b/src/test/ui/unknown-tool-name.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: use of undeclared type or module `foo` - --> $DIR/unknown-tool-name.rs:11:3 + --> $DIR/unknown-tool-name.rs:1:3 | LL | #[foo::bar] //~ ERROR failed to resolve: use of undeclared type or module `foo` | ^^^ use of undeclared type or module `foo` diff --git a/src/test/ui/unnecessary-extern-crate.rs b/src/test/ui/unnecessary-extern-crate.rs new file mode 100644 index 00000000000..e25b99bcb61 --- /dev/null +++ b/src/test/ui/unnecessary-extern-crate.rs @@ -0,0 +1,71 @@ +// edition:2018 + +#![deny(unused_extern_crates)] +#![feature(alloc, test, rustc_private, crate_visibility_modifier)] + +extern crate libc; +//~^ ERROR unused extern crate +//~| HELP remove +extern crate libc as x; +//~^ ERROR unused extern crate +//~| HELP remove + +extern crate proc_macro; + +#[macro_use] +extern crate test; + +pub extern crate test as y; + +pub extern crate alloc; + +pub(crate) extern crate alloc as a; + +crate extern crate alloc as b; + +mod foo { + pub(in crate::foo) extern crate alloc as c; + + pub(super) extern crate alloc as d; + + extern crate libc; + //~^ ERROR unused extern crate + //~| HELP remove + + extern crate libc as x; + //~^ ERROR unused extern crate + //~| HELP remove + + pub extern crate test; + + pub extern crate test as y; + + mod bar { + extern crate libc; + //~^ ERROR unused extern crate + //~| HELP remove + + extern crate libc as x; + //~^ ERROR unused extern crate + //~| HELP remove + + pub(in crate::foo::bar) extern crate alloc as e; + + fn dummy() { + e::string::String::new(); + } + } + + fn dummy() { + c::string::String::new(); + d::string::String::new(); + } +} + + +fn main() { + a::string::String::new(); + b::string::String::new(); + + proc_macro::TokenStream::new(); +} diff --git a/src/test/ui/unnecessary-extern-crate.stderr b/src/test/ui/unnecessary-extern-crate.stderr new file mode 100644 index 00000000000..1e6d7552343 --- /dev/null +++ b/src/test/ui/unnecessary-extern-crate.stderr @@ -0,0 +1,44 @@ +error: unused extern crate + --> $DIR/unnecessary-extern-crate.rs:6:1 + | +LL | extern crate libc; + | ^^^^^^^^^^^^^^^^^^ help: remove it + | +note: lint level defined here + --> $DIR/unnecessary-extern-crate.rs:3:9 + | +LL | #![deny(unused_extern_crates)] + | ^^^^^^^^^^^^^^^^^^^^ + +error: unused extern crate + --> $DIR/unnecessary-extern-crate.rs:9:1 + | +LL | extern crate libc as x; + | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + +error: unused extern crate + --> $DIR/unnecessary-extern-crate.rs:31:5 + | +LL | extern crate libc; + | ^^^^^^^^^^^^^^^^^^ help: remove it + +error: unused extern crate + --> $DIR/unnecessary-extern-crate.rs:35:5 + | +LL | extern crate libc as x; + | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + +error: unused extern crate + --> $DIR/unnecessary-extern-crate.rs:44:9 + | +LL | extern crate libc; + | ^^^^^^^^^^^^^^^^^^ help: remove it + +error: unused extern crate + --> $DIR/unnecessary-extern-crate.rs:48:9 + | +LL | extern crate libc as x; + | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/unop-move-semantics.nll.stderr b/src/test/ui/unop-move-semantics.nll.stderr index bfc7736b2f3..58953d55b1f 100644 --- a/src/test/ui/unop-move-semantics.nll.stderr +++ b/src/test/ui/unop-move-semantics.nll.stderr @@ -1,16 +1,18 @@ error[E0382]: borrow of moved value: `x` - --> $DIR/unop-move-semantics.rs:18:5 + --> $DIR/unop-move-semantics.rs:8:5 | +LL | fn move_then_borrow + Clone>(x: T) { + | - - move occurs because `x` has type `T`, which does not implement the `Copy` trait + | | + | consider adding a `Copy` constraint to this type argument LL | !x; | - value moved here LL | LL | x.clone(); //~ ERROR: use of moved value | ^ value borrowed here after move - | - = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/unop-move-semantics.rs:25:6 + --> $DIR/unop-move-semantics.rs:15:6 | LL | let m = &x; | -- borrow of `x` occurs here @@ -22,7 +24,7 @@ LL | use_mut(n); use_imm(m); | - borrow later used here error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/unop-move-semantics.rs:27:6 + --> $DIR/unop-move-semantics.rs:17:6 | LL | let n = &mut y; | ------ borrow of `y` occurs here @@ -33,13 +35,13 @@ LL | use_mut(n); use_imm(m); | - borrow later used here error[E0507]: cannot move out of borrowed content - --> $DIR/unop-move-semantics.rs:34:6 + --> $DIR/unop-move-semantics.rs:24:6 | LL | !*m; //~ ERROR: cannot move out of borrowed content | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/unop-move-semantics.rs:36:6 + --> $DIR/unop-move-semantics.rs:26:6 | LL | !*n; //~ ERROR: cannot move out of borrowed content | ^^ cannot move out of borrowed content diff --git a/src/test/ui/unop-move-semantics.rs b/src/test/ui/unop-move-semantics.rs index fcbbe546a31..24bd89d4c39 100644 --- a/src/test/ui/unop-move-semantics.rs +++ b/src/test/ui/unop-move-semantics.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that move restrictions are enforced on overloaded unary operations use std::ops::Not; diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr index 42d17e54aa2..65d2967c61e 100644 --- a/src/test/ui/unop-move-semantics.stderr +++ b/src/test/ui/unop-move-semantics.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/unop-move-semantics.rs:18:5 + --> $DIR/unop-move-semantics.rs:8:5 | LL | !x; | - value moved here @@ -10,7 +10,7 @@ LL | x.clone(); //~ ERROR: use of moved value = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait error[E0505]: cannot move out of `x` because it is borrowed - --> $DIR/unop-move-semantics.rs:25:6 + --> $DIR/unop-move-semantics.rs:15:6 | LL | let m = &x; | - borrow of `x` occurs here @@ -19,7 +19,7 @@ LL | !x; //~ ERROR: cannot move out of `x` because it is borrowed | ^ move out of `x` occurs here error[E0505]: cannot move out of `y` because it is borrowed - --> $DIR/unop-move-semantics.rs:27:6 + --> $DIR/unop-move-semantics.rs:17:6 | LL | let n = &mut y; | - borrow of `y` occurs here @@ -28,13 +28,13 @@ LL | !y; //~ ERROR: cannot move out of `y` because it is borrowed | ^ move out of `y` occurs here error[E0507]: cannot move out of borrowed content - --> $DIR/unop-move-semantics.rs:34:6 + --> $DIR/unop-move-semantics.rs:24:6 | LL | !*m; //~ ERROR: cannot move out of borrowed content | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content - --> $DIR/unop-move-semantics.rs:36:6 + --> $DIR/unop-move-semantics.rs:26:6 | LL | !*n; //~ ERROR: cannot move out of borrowed content | ^^ cannot move out of borrowed content diff --git a/src/test/ui/unop-neg-bool.rs b/src/test/ui/unop-neg-bool.rs index 316e17c54ad..6f1f1aba459 100644 --- a/src/test/ui/unop-neg-bool.rs +++ b/src/test/ui/unop-neg-bool.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { -true; //~ ERROR cannot apply unary operator `-` to type `bool` } diff --git a/src/test/ui/unop-neg-bool.stderr b/src/test/ui/unop-neg-bool.stderr index 8ffb71ec4ce..c13c1a15a7c 100644 --- a/src/test/ui/unop-neg-bool.stderr +++ b/src/test/ui/unop-neg-bool.stderr @@ -1,5 +1,5 @@ error[E0600]: cannot apply unary operator `-` to type `bool` - --> $DIR/unop-neg-bool.rs:12:5 + --> $DIR/unop-neg-bool.rs:2:5 | LL | -true; //~ ERROR cannot apply unary operator `-` to type `bool` | ^^^^^ cannot apply unary operator `-` diff --git a/src/test/ui/unreachable/auxiliary/unreachable_variant.rs b/src/test/ui/unreachable/auxiliary/unreachable_variant.rs index 8ca85f20ab2..4e94a4b5ed8 100644 --- a/src/test/ui/unreachable/auxiliary/unreachable_variant.rs +++ b/src/test/ui/unreachable/auxiliary/unreachable_variant.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod super_sekrit { pub enum sooper_sekrit { quux, baz diff --git a/src/test/ui/unreachable/unreachable-arm.rs b/src/test/ui/unreachable/unreachable-arm.rs index df827d2c784..9f1a5a39587 100644 --- a/src/test/ui/unreachable/unreachable-arm.rs +++ b/src/test/ui/unreachable/unreachable-arm.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_patterns)] #![feature(box_syntax)] #![allow(dead_code)] diff --git a/src/test/ui/unreachable/unreachable-arm.stderr b/src/test/ui/unreachable/unreachable-arm.stderr index 6bd3f281ea9..5b34482b59b 100644 --- a/src/test/ui/unreachable/unreachable-arm.stderr +++ b/src/test/ui/unreachable/unreachable-arm.stderr @@ -1,11 +1,11 @@ error: unreachable pattern - --> $DIR/unreachable-arm.rs:21:9 + --> $DIR/unreachable-arm.rs:11:9 | LL | Foo::A(_, 1) => { } //~ ERROR unreachable pattern | ^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/unreachable-arm.rs:14:9 + --> $DIR/unreachable-arm.rs:4:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unreachable/unreachable-code.rs b/src/test/ui/unreachable/unreachable-code.rs index dd08eed5df9..ad0dc8a8b9c 100644 --- a/src/test/ui/unreachable/unreachable-code.rs +++ b/src/test/ui/unreachable/unreachable-code.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unreachable_code)] #![allow(unused_variables)] diff --git a/src/test/ui/unreachable/unreachable-code.stderr b/src/test/ui/unreachable/unreachable-code.stderr index 0c5d94c6502..afb3629d5fd 100644 --- a/src/test/ui/unreachable/unreachable-code.stderr +++ b/src/test/ui/unreachable/unreachable-code.stderr @@ -1,11 +1,11 @@ error: unreachable statement - --> $DIR/unreachable-code.rs:17:3 + --> $DIR/unreachable-code.rs:7:3 | LL | let a = 3; //~ ERROR: unreachable statement | ^^^^^^^^^^ | note: lint level defined here - --> $DIR/unreachable-code.rs:11:9 + --> $DIR/unreachable-code.rs:1:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unreachable/unreachable-in-call.rs b/src/test/ui/unreachable/unreachable-in-call.rs index 72462468432..25f849d7a0a 100644 --- a/src/test/ui/unreachable/unreachable-in-call.rs +++ b/src/test/ui/unreachable/unreachable-in-call.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![deny(unreachable_code)] diff --git a/src/test/ui/unreachable/unreachable-in-call.stderr b/src/test/ui/unreachable/unreachable-in-call.stderr index 215829af443..b78070d3fb1 100644 --- a/src/test/ui/unreachable/unreachable-in-call.stderr +++ b/src/test/ui/unreachable/unreachable-in-call.stderr @@ -1,17 +1,17 @@ error: unreachable expression - --> $DIR/unreachable-in-call.rs:24:10 + --> $DIR/unreachable-in-call.rs:14:10 | LL | get_u8()); //~ ERROR unreachable expression | ^^^^^^^^ | note: lint level defined here - --> $DIR/unreachable-in-call.rs:12:9 + --> $DIR/unreachable-in-call.rs:2:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ error: unreachable expression - --> $DIR/unreachable-in-call.rs:27:5 + --> $DIR/unreachable-in-call.rs:17:5 | LL | / call( //~ ERROR unreachable expression LL | | get_u8(), diff --git a/src/test/ui/unreachable/unreachable-loop-patterns.rs b/src/test/ui/unreachable/unreachable-loop-patterns.rs index cfd829e416e..97948063753 100644 --- a/src/test/ui/unreachable/unreachable-loop-patterns.rs +++ b/src/test/ui/unreachable/unreachable-loop-patterns.rs @@ -1,21 +1,23 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// compile-fail #![feature(never_type)] #![feature(exhaustive_patterns)] + +#![allow(unreachable_code)] #![deny(unreachable_patterns)] -fn main() { - let x: &[!] = &[]; +enum Void {} + +impl Iterator for Void { + type Item = Void; - for _ in x {} + fn next(&mut self) -> Option { + None + } +} + +fn main() { + for _ in unimplemented!() as Void {} //~^ ERROR unreachable pattern } diff --git a/src/test/ui/unreachable/unreachable-loop-patterns.stderr b/src/test/ui/unreachable/unreachable-loop-patterns.stderr index 724a92b0947..d2f255c3e10 100644 --- a/src/test/ui/unreachable/unreachable-loop-patterns.stderr +++ b/src/test/ui/unreachable/unreachable-loop-patterns.stderr @@ -1,11 +1,11 @@ error: unreachable pattern - --> $DIR/unreachable-loop-patterns.rs:18:9 + --> $DIR/unreachable-loop-patterns.rs:20:9 | -LL | for _ in x {} +LL | for _ in unimplemented!() as Void {} | ^ | note: lint level defined here - --> $DIR/unreachable-loop-patterns.rs:13:9 + --> $DIR/unreachable-loop-patterns.rs:7:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unreachable/unreachable-try-pattern.rs b/src/test/ui/unreachable/unreachable-try-pattern.rs index 2c0690881a1..1c1e01ff0e9 100644 --- a/src/test/ui/unreachable/unreachable-try-pattern.rs +++ b/src/test/ui/unreachable/unreachable-try-pattern.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(never_type, exhaustive_patterns)] #![warn(unreachable_code)] diff --git a/src/test/ui/unreachable/unreachable-try-pattern.stderr b/src/test/ui/unreachable/unreachable-try-pattern.stderr index 1916174142f..758aa5a45bc 100644 --- a/src/test/ui/unreachable/unreachable-try-pattern.stderr +++ b/src/test/ui/unreachable/unreachable-try-pattern.stderr @@ -1,29 +1,29 @@ warning: unreachable expression - --> $DIR/unreachable-try-pattern.rs:29:36 + --> $DIR/unreachable-try-pattern.rs:19:36 | LL | let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?; | ^^^^^^^^ | note: lint level defined here - --> $DIR/unreachable-try-pattern.rs:13:9 + --> $DIR/unreachable-try-pattern.rs:3:9 | LL | #![warn(unreachable_code)] | ^^^^^^^^^^^^^^^^ warning: unreachable pattern - --> $DIR/unreachable-try-pattern.rs:29:24 + --> $DIR/unreachable-try-pattern.rs:19:24 | LL | let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?; | ^^^^^ | note: lint level defined here - --> $DIR/unreachable-try-pattern.rs:14:9 + --> $DIR/unreachable-try-pattern.rs:4:9 | LL | #![warn(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ warning: unreachable pattern - --> $DIR/unreachable-try-pattern.rs:40:40 + --> $DIR/unreachable-try-pattern.rs:30:40 | LL | let y = (match x { Ok(n) => Ok(n), Err(e) => Err(e) })?; | ^^^^^^ diff --git a/src/test/ui/unreachable/unreachable-variant.rs b/src/test/ui/unreachable/unreachable-variant.rs index 5983c83f8b4..008c2d476d7 100644 --- a/src/test/ui/unreachable/unreachable-variant.rs +++ b/src/test/ui/unreachable/unreachable-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:unreachable_variant.rs extern crate unreachable_variant as other; diff --git a/src/test/ui/unreachable/unreachable-variant.stderr b/src/test/ui/unreachable/unreachable-variant.stderr index a998f6b0b8f..60fdae5cbce 100644 --- a/src/test/ui/unreachable/unreachable-variant.stderr +++ b/src/test/ui/unreachable/unreachable-variant.stderr @@ -1,5 +1,5 @@ error[E0603]: module `super_sekrit` is private - --> $DIR/unreachable-variant.rs:16:21 + --> $DIR/unreachable-variant.rs:6:21 | LL | let _x = other::super_sekrit::sooper_sekrit::baz; //~ ERROR is private | ^^^^^^^^^^^^ diff --git a/src/test/ui/unresolved/unresolved-extern-mod-suggestion.rs b/src/test/ui/unresolved/unresolved-extern-mod-suggestion.rs index 714b73ec739..a1bf0f210b2 100644 --- a/src/test/ui/unresolved/unresolved-extern-mod-suggestion.rs +++ b/src/test/ui/unresolved/unresolved-extern-mod-suggestion.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate core; use core; //~^ ERROR the name `core` is defined multiple times diff --git a/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr b/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr index 86ea348ac47..012d3c3a751 100644 --- a/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr +++ b/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr @@ -1,5 +1,5 @@ error[E0254]: the name `core` is defined multiple times - --> $DIR/unresolved-extern-mod-suggestion.rs:12:5 + --> $DIR/unresolved-extern-mod-suggestion.rs:2:5 | LL | extern crate core; | ------------------ previous import of the extern crate `core` here diff --git a/src/test/ui/unresolved/unresolved-import-recovery.rs b/src/test/ui/unresolved/unresolved-import-recovery.rs index 8173f69191d..0b0653378cb 100644 --- a/src/test/ui/unresolved/unresolved-import-recovery.rs +++ b/src/test/ui/unresolved/unresolved-import-recovery.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that unresolved imports do not create additional errors and ICEs mod m { diff --git a/src/test/ui/unresolved/unresolved-import-recovery.stderr b/src/test/ui/unresolved/unresolved-import-recovery.stderr index d4304195eb1..0154d002efe 100644 --- a/src/test/ui/unresolved/unresolved-import-recovery.stderr +++ b/src/test/ui/unresolved/unresolved-import-recovery.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `unresolved` - --> $DIR/unresolved-import-recovery.rs:14:13 + --> $DIR/unresolved-import-recovery.rs:4:13 | LL | pub use unresolved; //~ ERROR unresolved import `unresolved` | ^^^^^^^^^^ no `unresolved` in the root diff --git a/src/test/ui/unresolved/unresolved-import.rs b/src/test/ui/unresolved/unresolved-import.rs index 4592289beeb..be2a2c75485 100644 --- a/src/test/ui/unresolved/unresolved-import.rs +++ b/src/test/ui/unresolved/unresolved-import.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-tidy-linelength use foo::bar; //~ ERROR unresolved import `foo` [E0432] @@ -27,11 +17,11 @@ mod bar { } mod food { - pub use self::zug::baz::{self as bag, foobar as beans}; + pub use self::zug::baz::{self as bag, Foobar as beans}; mod zug { pub mod baz { - pub struct foobar; + pub struct Foobar; } } } diff --git a/src/test/ui/unresolved/unresolved-import.stderr b/src/test/ui/unresolved/unresolved-import.stderr index 7e98a41af10..0dc4b72208a 100644 --- a/src/test/ui/unresolved/unresolved-import.stderr +++ b/src/test/ui/unresolved/unresolved-import.stderr @@ -1,35 +1,35 @@ error[E0432]: unresolved import `foo` - --> $DIR/unresolved-import.rs:13:5 + --> $DIR/unresolved-import.rs:3:5 | LL | use foo::bar; //~ ERROR unresolved import `foo` [E0432] | ^^^ maybe a missing `extern crate foo;`? error[E0432]: unresolved import `bar::Baz` - --> $DIR/unresolved-import.rs:16:5 + --> $DIR/unresolved-import.rs:6:5 | LL | use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432] | ^^^^^^^^^^^^^ no `Baz` in `bar`. Did you mean to use `Bar`? error[E0432]: unresolved import `food::baz` - --> $DIR/unresolved-import.rs:19:5 + --> $DIR/unresolved-import.rs:9:5 | LL | use food::baz; //~ ERROR unresolved import `food::baz` | ^^^^^^^^^ no `baz` in `food`. Did you mean to use `bag`? error[E0432]: unresolved import `food::beens` - --> $DIR/unresolved-import.rs:22:12 + --> $DIR/unresolved-import.rs:12:12 | LL | use food::{beens as Foo}; //~ ERROR unresolved import `food::beens` [E0432] | ^^^^^^^^^^^^ no `beens` in `food`. Did you mean to use `beans`? error[E0432]: unresolved import `MyEnum` - --> $DIR/unresolved-import.rs:44:9 + --> $DIR/unresolved-import.rs:34:9 | LL | use MyEnum::*; //~ ERROR unresolved import `MyEnum` [E0432] | ^^^^^^ did you mean `self::MyEnum`? error[E0432]: unresolved import `Enum` - --> $DIR/unresolved-import.rs:53:9 + --> $DIR/unresolved-import.rs:43:9 | LL | use Enum::*; //~ ERROR unresolved import `Enum` [E0432] | ^^^^ did you mean `self::Enum`? diff --git a/src/test/ui/unrestricted-attribute-tokens.rs b/src/test/ui/unrestricted-attribute-tokens.rs index 2971b504369..9d8ba03eca5 100644 --- a/src/test/ui/unrestricted-attribute-tokens.rs +++ b/src/test/ui/unrestricted-attribute-tokens.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-pass #![feature(custom_attribute, unrestricted_attribute_tokens)] diff --git a/src/test/ui/unsafe/ranged_ints.rs b/src/test/ui/unsafe/ranged_ints.rs new file mode 100644 index 00000000000..0fa2da917e9 --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints.rs @@ -0,0 +1,8 @@ +#![feature(rustc_attrs)] + +#[rustc_layout_scalar_valid_range_start(1)] +#[repr(transparent)] +pub(crate) struct NonZero(pub(crate) T); +fn main() { + let _x = NonZero(0); //~ ERROR initializing type with `rustc_layout_scalar_valid_range` attr +} diff --git a/src/test/ui/unsafe/ranged_ints.stderr b/src/test/ui/unsafe/ranged_ints.stderr new file mode 100644 index 00000000000..f59a930b5a9 --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints.stderr @@ -0,0 +1,11 @@ +error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block + --> $DIR/ranged_ints.rs:7:14 + | +LL | let _x = NonZero(0); //~ ERROR initializing type with `rustc_layout_scalar_valid_range` attr + | ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr + | + = note: initializing a layout restricted type's field with a value outside the valid range is undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/ranged_ints2.rs b/src/test/ui/unsafe/ranged_ints2.rs new file mode 100644 index 00000000000..68ba120b279 --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints2.rs @@ -0,0 +1,9 @@ +#![feature(rustc_attrs)] + +#[rustc_layout_scalar_valid_range_start(1)] +#[repr(transparent)] +pub(crate) struct NonZero(pub(crate) T); +fn main() { + let mut x = unsafe { NonZero(1) }; + let y = &mut x.0; //~ ERROR mutation of layout constrained field is unsafe +} diff --git a/src/test/ui/unsafe/ranged_ints2.stderr b/src/test/ui/unsafe/ranged_ints2.stderr new file mode 100644 index 00000000000..ae63f47ed74 --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints2.stderr @@ -0,0 +1,11 @@ +error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block + --> $DIR/ranged_ints2.rs:8:13 + | +LL | let y = &mut x.0; //~ ERROR mutation of layout constrained field is unsafe + | ^^^^^^^^ mutation of layout constrained field + | + = note: mutating layout constrained fields cannot statically be checked for valid values + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/ranged_ints2_const.rs b/src/test/ui/unsafe/ranged_ints2_const.rs new file mode 100644 index 00000000000..788f49f743c --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints2_const.rs @@ -0,0 +1,20 @@ +#![feature(rustc_attrs)] + +#[rustc_layout_scalar_valid_range_start(1)] +#[repr(transparent)] +pub(crate) struct NonZero(pub(crate) T); +fn main() { +} + +const fn foo() -> NonZero { + let mut x = unsafe { NonZero(1) }; + let y = &mut x.0; //~ ERROR references in const fn are unstable + //~^ ERROR mutation of layout constrained field is unsafe + unsafe { NonZero(1) } +} + +const fn bar() -> NonZero { + let mut x = unsafe { NonZero(1) }; + let y = unsafe { &mut x.0 }; //~ ERROR mutable references in const fn are unstable + unsafe { NonZero(1) } +} diff --git a/src/test/ui/unsafe/ranged_ints2_const.stderr b/src/test/ui/unsafe/ranged_ints2_const.stderr new file mode 100644 index 00000000000..39a55190b17 --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints2_const.stderr @@ -0,0 +1,23 @@ +error: mutable references in const fn are unstable + --> $DIR/ranged_ints2_const.rs:11:9 + | +LL | let y = &mut x.0; //~ ERROR references in const fn are unstable + | ^ + +error: mutable references in const fn are unstable + --> $DIR/ranged_ints2_const.rs:18:9 + | +LL | let y = unsafe { &mut x.0 }; //~ ERROR mutable references in const fn are unstable + | ^ + +error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block + --> $DIR/ranged_ints2_const.rs:11:13 + | +LL | let y = &mut x.0; //~ ERROR references in const fn are unstable + | ^^^^^^^^ mutation of layout constrained field + | + = note: mutating layout constrained fields cannot statically be checked for valid values + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/ranged_ints3.rs b/src/test/ui/unsafe/ranged_ints3.rs new file mode 100644 index 00000000000..47d67fac678 --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints3.rs @@ -0,0 +1,11 @@ +#![feature(rustc_attrs)] + +use std::cell::Cell; + +#[rustc_layout_scalar_valid_range_start(1)] +#[repr(transparent)] +pub(crate) struct NonZero(pub(crate) T); +fn main() { + let mut x = unsafe { NonZero(Cell::new(1)) }; + let y = &x.0; //~ ERROR borrow of layout constrained field with interior mutability +} diff --git a/src/test/ui/unsafe/ranged_ints3.stderr b/src/test/ui/unsafe/ranged_ints3.stderr new file mode 100644 index 00000000000..311a058fdb0 --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints3.stderr @@ -0,0 +1,11 @@ +error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block + --> $DIR/ranged_ints3.rs:10:13 + | +LL | let y = &x.0; //~ ERROR borrow of layout constrained field with interior mutability + | ^^^^ borrow of layout constrained field with interior mutability + | + = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/ranged_ints3_const.rs b/src/test/ui/unsafe/ranged_ints3_const.rs new file mode 100644 index 00000000000..7b03d8eda93 --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints3_const.rs @@ -0,0 +1,21 @@ +#![feature(rustc_attrs)] + +use std::cell::Cell; + +#[rustc_layout_scalar_valid_range_start(1)] +#[repr(transparent)] +pub(crate) struct NonZero(pub(crate) T); +fn main() {} + +const fn foo() -> NonZero> { + let mut x = unsafe { NonZero(Cell::new(1)) }; + let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability + //~^ ERROR borrow of layout constrained field with interior mutability + unsafe { NonZero(Cell::new(1)) } +} + +const fn bar() -> NonZero> { + let mut x = unsafe { NonZero(Cell::new(1)) }; + let y = unsafe { &x.0 }; //~ ERROR cannot borrow a constant which may contain interior mut + unsafe { NonZero(Cell::new(1)) } +} diff --git a/src/test/ui/unsafe/ranged_ints3_const.stderr b/src/test/ui/unsafe/ranged_ints3_const.stderr new file mode 100644 index 00000000000..d83d75787d9 --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints3_const.stderr @@ -0,0 +1,24 @@ +error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead + --> $DIR/ranged_ints3_const.rs:12:13 + | +LL | let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability + | ^^^^ + +error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead + --> $DIR/ranged_ints3_const.rs:19:22 + | +LL | let y = unsafe { &x.0 }; //~ ERROR cannot borrow a constant which may contain interior mut + | ^^^^ + +error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block + --> $DIR/ranged_ints3_const.rs:12:13 + | +LL | let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability + | ^^^^ borrow of layout constrained field with interior mutability + | + = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values + +error: aborting due to 3 previous errors + +Some errors occurred: E0133, E0492. +For more information about an error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/ranged_ints4.rs b/src/test/ui/unsafe/ranged_ints4.rs new file mode 100644 index 00000000000..d8632c48434 --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints4.rs @@ -0,0 +1,9 @@ +#![feature(rustc_attrs)] + +#[rustc_layout_scalar_valid_range_start(1)] +#[repr(transparent)] +pub(crate) struct NonZero(pub(crate) T); +fn main() { + let mut x = unsafe { NonZero(1) }; + x.0 = 0; //~ ERROR mutation of layout constrained field is unsafe +} diff --git a/src/test/ui/unsafe/ranged_ints4.stderr b/src/test/ui/unsafe/ranged_ints4.stderr new file mode 100644 index 00000000000..c6468b643b4 --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints4.stderr @@ -0,0 +1,11 @@ +error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block + --> $DIR/ranged_ints4.rs:8:5 + | +LL | x.0 = 0; //~ ERROR mutation of layout constrained field is unsafe + | ^^^^^^^ mutation of layout constrained field + | + = note: mutating layout constrained fields cannot statically be checked for valid values + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/ranged_ints4_const.rs b/src/test/ui/unsafe/ranged_ints4_const.rs new file mode 100644 index 00000000000..f09168c3d3f --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints4_const.rs @@ -0,0 +1,19 @@ +#![feature(rustc_attrs)] + +#[rustc_layout_scalar_valid_range_start(1)] +#[repr(transparent)] +pub(crate) struct NonZero(pub(crate) T); +fn main() {} + +const fn foo() -> NonZero { + let mut x = unsafe { NonZero(1) }; + x.0 = 0; + //~^ ERROR mutation of layout constrained field is unsafe + x +} + +const fn bar() -> NonZero { + let mut x = unsafe { NonZero(1) }; + unsafe { x.0 = 0 }; // this is UB + x +} diff --git a/src/test/ui/unsafe/ranged_ints4_const.stderr b/src/test/ui/unsafe/ranged_ints4_const.stderr new file mode 100644 index 00000000000..fe83b15ce5c --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints4_const.stderr @@ -0,0 +1,11 @@ +error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block + --> $DIR/ranged_ints4_const.rs:10:5 + | +LL | x.0 = 0; + | ^^^^^^^ mutation of layout constrained field + | + = note: mutating layout constrained fields cannot statically be checked for valid values + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/ranged_ints_const.rs b/src/test/ui/unsafe/ranged_ints_const.rs new file mode 100644 index 00000000000..8477772867e --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints_const.rs @@ -0,0 +1,11 @@ +#![feature(rustc_attrs)] + +#[rustc_layout_scalar_valid_range_start(1)] +#[repr(transparent)] +pub(crate) struct NonZero(pub(crate) T); +fn main() {} + +const fn foo() -> NonZero { NonZero(0) } +//~^ ERROR initializing type with `rustc_layout_scalar_valid_range` attr is unsafe + +const fn bar() -> NonZero { unsafe { NonZero(0) } } diff --git a/src/test/ui/unsafe/ranged_ints_const.stderr b/src/test/ui/unsafe/ranged_ints_const.stderr new file mode 100644 index 00000000000..584ad40a92b --- /dev/null +++ b/src/test/ui/unsafe/ranged_ints_const.stderr @@ -0,0 +1,11 @@ +error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block + --> $DIR/ranged_ints_const.rs:8:34 + | +LL | const fn foo() -> NonZero { NonZero(0) } + | ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr + | + = note: initializing a layout restricted type's field with a value outside the valid range is undefined behavior + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0133`. diff --git a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs index 484a8979d71..817939e0757 100644 --- a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs +++ b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // issue #12418 #![deny(unused_unsafe)] diff --git a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr index 849630ac34e..7751fe017b8 100644 --- a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr +++ b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr @@ -1,11 +1,11 @@ error: unnecessary `unsafe` block - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:16:5 + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:5 | LL | unsafe { println!("foo"); } //~ ERROR unnecessary `unsafe` | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here - --> $DIR/unsafe-around-compiler-generated-unsafe.rs:13:9 + --> $DIR/unsafe-around-compiler-generated-unsafe.rs:3:9 | LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ diff --git a/src/test/ui/unsafe/unsafe-block-without-braces.rs b/src/test/ui/unsafe/unsafe-block-without-braces.rs index b6fb3ec5c44..a291eb2eed7 100644 --- a/src/test/ui/unsafe/unsafe-block-without-braces.rs +++ b/src/test/ui/unsafe/unsafe-block-without-braces.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { unsafe //{ std::mem::transmute::(1.0); diff --git a/src/test/ui/unsafe/unsafe-block-without-braces.stderr b/src/test/ui/unsafe/unsafe-block-without-braces.stderr index e6d2403ac4c..34a90352e92 100644 --- a/src/test/ui/unsafe/unsafe-block-without-braces.stderr +++ b/src/test/ui/unsafe/unsafe-block-without-braces.stderr @@ -1,5 +1,5 @@ error: expected one of `extern`, `fn`, or `{`, found `std` - --> $DIR/unsafe-block-without-braces.rs:13:9 + --> $DIR/unsafe-block-without-braces.rs:3:9 | LL | unsafe //{ | - expected one of `extern`, `fn`, or `{` here diff --git a/src/test/ui/unsafe/unsafe-const-fn.rs b/src/test/ui/unsafe/unsafe-const-fn.rs index 88be25066ce..cadfdd064e3 100644 --- a/src/test/ui/unsafe/unsafe-const-fn.rs +++ b/src/test/ui/unsafe/unsafe-const-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // A quick test of 'unsafe const fn' functionality const unsafe fn dummy(v: u32) -> u32 { diff --git a/src/test/ui/unsafe/unsafe-const-fn.stderr b/src/test/ui/unsafe/unsafe-const-fn.stderr index d1a267d4f84..370e1e673cf 100644 --- a/src/test/ui/unsafe/unsafe-const-fn.stderr +++ b/src/test/ui/unsafe/unsafe-const-fn.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-const-fn.rs:17:18 + --> $DIR/unsafe-const-fn.rs:7:18 | LL | const VAL: u32 = dummy(0xFFFF); | ^^^^^^^^^^^^^ call to unsafe function diff --git a/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.rs b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.rs index baf2002a94f..64bdca52457 100644 --- a/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.rs +++ b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.rs @@ -1,13 +1,5 @@ - -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. fn f(p: *mut u8) { diff --git a/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr index e98600a8f2f..1e000062cc3 100644 --- a/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr +++ b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-assign-deref-ptr.rs:14:5 + --> $DIR/unsafe-fn-assign-deref-ptr.rs:6:5 | LL | *p = 0; //~ ERROR dereference of raw pointer is unsafe | ^^^^^^ dereference of raw pointer diff --git a/src/test/ui/unsafe/unsafe-fn-autoderef.rs b/src/test/ui/unsafe/unsafe-fn-autoderef.rs index 15b304c69ba..60460fc6e49 100644 --- a/src/test/ui/unsafe/unsafe-fn-autoderef.rs +++ b/src/test/ui/unsafe/unsafe-fn-autoderef.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Rec { f: isize } diff --git a/src/test/ui/unsafe/unsafe-fn-autoderef.stderr b/src/test/ui/unsafe/unsafe-fn-autoderef.stderr index 13fcbb347c9..ded64ba69e8 100644 --- a/src/test/ui/unsafe/unsafe-fn-autoderef.stderr +++ b/src/test/ui/unsafe/unsafe-fn-autoderef.stderr @@ -1,8 +1,10 @@ error[E0609]: no field `f` on type `*const Rec` - --> $DIR/unsafe-fn-autoderef.rs:29:14 + --> $DIR/unsafe-fn-autoderef.rs:19:14 | LL | return p.f; //~ ERROR no field `f` on type `*const Rec` - | ^ help: `p` is a native pointer; try dereferencing it: `(*p).f` + | --^ + | | + | help: `p` is a raw pointer; try dereferencing it: `(*p).f` error: aborting due to previous error diff --git a/src/test/ui/unsafe/unsafe-fn-called-from-safe.rs b/src/test/ui/unsafe/unsafe-fn-called-from-safe.rs index 46f28da43d0..5487a8ecc37 100644 --- a/src/test/ui/unsafe/unsafe-fn-called-from-safe.rs +++ b/src/test/ui/unsafe/unsafe-fn-called-from-safe.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - unsafe fn f() { return; } fn main() { diff --git a/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr b/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr index a781347040e..4ad7c6e5c75 100644 --- a/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr +++ b/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-called-from-safe.rs:15:5 + --> $DIR/unsafe-fn-called-from-safe.rs:4:5 | LL | f(); //~ ERROR call to unsafe function is unsafe | ^^^ call to unsafe function diff --git a/src/test/ui/unsafe/unsafe-fn-deref-ptr.rs b/src/test/ui/unsafe/unsafe-fn-deref-ptr.rs index 8e3ce8ff9b5..46445aa261d 100644 --- a/src/test/ui/unsafe/unsafe-fn-deref-ptr.rs +++ b/src/test/ui/unsafe/unsafe-fn-deref-ptr.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn f(p: *const u8) -> u8 { return *p; //~ ERROR dereference of raw pointer is unsafe } diff --git a/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr b/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr index 885f6e446fe..d48a7681cad 100644 --- a/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr +++ b/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-deref-ptr.rs:13:12 + --> $DIR/unsafe-fn-deref-ptr.rs:2:12 | LL | return *p; //~ ERROR dereference of raw pointer is unsafe | ^^ dereference of raw pointer diff --git a/src/test/ui/unsafe/unsafe-fn-used-as-value.rs b/src/test/ui/unsafe/unsafe-fn-used-as-value.rs index f09a0c7107a..59b81477930 100644 --- a/src/test/ui/unsafe/unsafe-fn-used-as-value.rs +++ b/src/test/ui/unsafe/unsafe-fn-used-as-value.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - unsafe fn f() { return; } fn main() { diff --git a/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr b/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr index 7f8af300be5..f68e849341b 100644 --- a/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr +++ b/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr @@ -1,5 +1,5 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block - --> $DIR/unsafe-fn-used-as-value.rs:16:5 + --> $DIR/unsafe-fn-used-as-value.rs:5:5 | LL | x(); //~ ERROR call to unsafe function is unsafe | ^^^ call to unsafe function diff --git a/src/test/ui/unsafe/unsafe-move-val-init.rs b/src/test/ui/unsafe/unsafe-move-val-init.rs index b4e425e7bbf..24249a7a813 100644 --- a/src/test/ui/unsafe/unsafe-move-val-init.rs +++ b/src/test/ui/unsafe/unsafe-move-val-init.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(core_intrinsics)] use std::intrinsics; diff --git a/src/test/ui/unsafe/unsafe-move-val-init.stderr b/src/test/ui/unsafe/unsafe-move-val-init.stderr index be92623b5d0..44c2aae7cf4 100644 --- a/src/test/ui/unsafe/unsafe-move-val-init.stderr +++ b/src/test/ui/unsafe/unsafe-move-val-init.stderr @@ -1,5 +1,5 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block - --> $DIR/unsafe-move-val-init.rs:18:5 + --> $DIR/unsafe-move-val-init.rs:8:5 | LL | intrinsics::move_val_init(1 as *mut u32, 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer diff --git a/src/test/ui/unsafe/unsafe-subtyping.rs b/src/test/ui/unsafe/unsafe-subtyping.rs index f4867636819..a4b748a50f2 100644 --- a/src/test/ui/unsafe/unsafe-subtyping.rs +++ b/src/test/ui/unsafe/unsafe-subtyping.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that safe fns are not a subtype of unsafe fns. fn foo(x: Option) -> Option { diff --git a/src/test/ui/unsafe/unsafe-subtyping.stderr b/src/test/ui/unsafe/unsafe-subtyping.stderr index 645f2a7939e..3db0bcba81b 100644 --- a/src/test/ui/unsafe/unsafe-subtyping.stderr +++ b/src/test/ui/unsafe/unsafe-subtyping.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/unsafe-subtyping.rs:14:5 + --> $DIR/unsafe-subtyping.rs:4:5 | LL | fn foo(x: Option) -> Option { | ---------------------- expected `std::option::Option` because of return type diff --git a/src/test/ui/unsafe/unsafe-trait-impl.rs b/src/test/ui/unsafe/unsafe-trait-impl.rs index fb4652affd0..7b76e006907 100644 --- a/src/test/ui/unsafe/unsafe-trait-impl.rs +++ b/src/test/ui/unsafe/unsafe-trait-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that safe fns are not a subtype of unsafe fns. trait Foo { diff --git a/src/test/ui/unsafe/unsafe-trait-impl.stderr b/src/test/ui/unsafe/unsafe-trait-impl.stderr index ae47d6c1627..4e93d235757 100644 --- a/src/test/ui/unsafe/unsafe-trait-impl.stderr +++ b/src/test/ui/unsafe/unsafe-trait-impl.stderr @@ -1,5 +1,5 @@ error[E0053]: method `len` has an incompatible type for trait - --> $DIR/unsafe-trait-impl.rs:18:5 + --> $DIR/unsafe-trait-impl.rs:8:5 | LL | unsafe fn len(&self) -> u32; | ---------------------------- type in trait diff --git a/src/test/ui/unsized-locals/auxiliary/ufuncs.rs b/src/test/ui/unsized-locals/auxiliary/ufuncs.rs new file mode 100644 index 00000000000..065563d45a4 --- /dev/null +++ b/src/test/ui/unsized-locals/auxiliary/ufuncs.rs @@ -0,0 +1,3 @@ +#![feature(unsized_locals)] + +pub fn udrop(_x: T) {} diff --git a/src/test/ui/unsized-locals/borrow-after-move.nll.stderr b/src/test/ui/unsized-locals/borrow-after-move.nll.stderr index a3cfcc89217..0e6a6f6369a 100644 --- a/src/test/ui/unsized-locals/borrow-after-move.nll.stderr +++ b/src/test/ui/unsized-locals/borrow-after-move.nll.stderr @@ -6,17 +6,19 @@ LL | let y = *x; LL | drop_unsized(y); LL | println!("{}", &x); | ^^ value borrowed here after move + | + = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `y` --> $DIR/borrow-after-move.rs:22:24 | +LL | let y = *x; + | - move occurs because `y` has type `str`, which does not implement the `Copy` trait LL | drop_unsized(y); | - value moved here ... LL | println!("{}", &y); | ^^ value borrowed here after move - | - = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` --> $DIR/borrow-after-move.rs:30:24 @@ -26,17 +28,19 @@ LL | let y = *x; LL | y.foo(); LL | println!("{}", &x); | ^^ value borrowed here after move + | + = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `y` --> $DIR/borrow-after-move.rs:32:24 | +LL | let y = *x; + | - move occurs because `y` has type `str`, which does not implement the `Copy` trait LL | y.foo(); | - value moved here ... LL | println!("{}", &y); | ^^ value borrowed here after move - | - = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait error[E0382]: borrow of moved value: `x` --> $DIR/borrow-after-move.rs:39:24 @@ -45,6 +49,8 @@ LL | x.foo(); | - value moved here LL | println!("{}", &x); | ^^ value borrowed here after move + | + = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait error: aborting due to 5 previous errors diff --git a/src/test/ui/unsized-locals/double-move.nll.stderr b/src/test/ui/unsized-locals/double-move.nll.stderr index 0555a8944bf..e40289af5ad 100644 --- a/src/test/ui/unsized-locals/double-move.nll.stderr +++ b/src/test/ui/unsized-locals/double-move.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: use of moved value: `y` --> $DIR/double-move.rs:20:22 | +LL | let y = *x; + | - move occurs because `y` has type `str`, which does not implement the `Copy` trait LL | drop_unsized(y); | - value moved here LL | drop_unsized(y); //~ERROR use of moved value | ^ value used here after move - | - = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait error[E0382]: use of moved value: `x` --> $DIR/double-move.rs:26:22 @@ -15,10 +15,14 @@ LL | let _y = *x; | -- value moved here LL | drop_unsized(x); //~ERROR use of moved value | ^ value used here after move + | + = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait error[E0382]: use of moved value: `*x` --> $DIR/double-move.rs:32:18 | +LL | let x = "hello".to_owned().into_boxed_str(); + | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | drop_unsized(x); | - value moved here LL | let _y = *x; //~ERROR use of moved value @@ -27,12 +31,12 @@ LL | let _y = *x; //~ERROR use of moved value error[E0382]: use of moved value: `y` --> $DIR/double-move.rs:39:9 | +LL | let y = *x; + | - move occurs because `y` has type `str`, which does not implement the `Copy` trait LL | y.foo(); | - value moved here LL | y.foo(); //~ERROR use of moved value | ^ value used here after move - | - = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait error[E0382]: use of moved value: `*x` --> $DIR/double-move.rs:45:9 @@ -41,6 +45,8 @@ LL | let _y = *x; | -- value moved here LL | x.foo(); //~ERROR use of moved value | ^ value used here after move + | + = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait error[E0382]: use of moved value: `*x` --> $DIR/double-move.rs:51:18 @@ -49,6 +55,8 @@ LL | x.foo(); | - value moved here LL | let _y = *x; //~ERROR use of moved value | ^^ value used here after move + | + = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait error: aborting due to 6 previous errors diff --git a/src/test/ui/unsized-locals/issue-50940-with-feature.rs b/src/test/ui/unsized-locals/issue-50940-with-feature.rs new file mode 100644 index 00000000000..3e5d39ab311 --- /dev/null +++ b/src/test/ui/unsized-locals/issue-50940-with-feature.rs @@ -0,0 +1,7 @@ +#![feature(unsized_locals)] + +fn main() { + struct A(X); + A as fn(str) -> A; + //~^ERROR the size for values of type `str` cannot be known at compilation time +} diff --git a/src/test/ui/unsized-locals/issue-50940-with-feature.stderr b/src/test/ui/unsized-locals/issue-50940-with-feature.stderr new file mode 100644 index 00000000000..7b6c2d11ea1 --- /dev/null +++ b/src/test/ui/unsized-locals/issue-50940-with-feature.stderr @@ -0,0 +1,14 @@ +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/issue-50940-with-feature.rs:5:5 + | +LL | A as fn(str) -> A; + | ^ doesn't have a size known at compile-time + | + = help: within `main::A`, the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit + = note: required because it appears within the type `main::A` + = note: the return type of a function must have a statically known size + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/unsized-locals/issue-50940.rs b/src/test/ui/unsized-locals/issue-50940.rs new file mode 100644 index 00000000000..7ba809b7e83 --- /dev/null +++ b/src/test/ui/unsized-locals/issue-50940.rs @@ -0,0 +1,5 @@ +fn main() { + struct A(X); + A as fn(str) -> A; + //~^ERROR the size for values of type `str` cannot be known at compilation time +} diff --git a/src/test/ui/unsized-locals/issue-50940.stderr b/src/test/ui/unsized-locals/issue-50940.stderr new file mode 100644 index 00000000000..be006c09d6f --- /dev/null +++ b/src/test/ui/unsized-locals/issue-50940.stderr @@ -0,0 +1,14 @@ +error[E0277]: the size for values of type `str` cannot be known at compilation time + --> $DIR/issue-50940.rs:3:5 + | +LL | A as fn(str) -> A; + | ^ doesn't have a size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `str` + = note: to learn more, visit + = note: all function arguments must have a statically known size + = help: unsized locals are gated as an unstable feature + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/unsized-locals/unsized-exprs.rs b/src/test/ui/unsized-locals/unsized-exprs.rs index 0cf93c78c4a..8ca88edcb6a 100644 --- a/src/test/ui/unsized-locals/unsized-exprs.rs +++ b/src/test/ui/unsized-locals/unsized-exprs.rs @@ -23,4 +23,6 @@ fn main() { //~^ERROR E0277 udrop::>(A { 0: *foo() }); //~^ERROR E0277 + udrop::>(A(*foo())); + //~^ERROR E0277 } diff --git a/src/test/ui/unsized-locals/unsized-exprs.stderr b/src/test/ui/unsized-locals/unsized-exprs.stderr index eb201694177..43c35cdd7b5 100644 --- a/src/test/ui/unsized-locals/unsized-exprs.stderr +++ b/src/test/ui/unsized-locals/unsized-exprs.stderr @@ -5,7 +5,7 @@ LL | udrop::<(i32, [u8])>((42, *foo())); | ^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `({integer}, [u8])`, the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `({integer}, [u8])` = note: tuples must have a statically known size to be initialized @@ -16,10 +16,21 @@ LL | udrop::>(A { 0: *foo() }); | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `A<[u8]>`, the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `A<[u8]>` = note: structs must have a statically known size to be initialized -error: aborting due to 2 previous errors +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/unsized-exprs.rs:26:22 + | +LL | udrop::>(A(*foo())); + | ^ doesn't have a size known at compile-time + | + = help: within `A<[u8]>`, the trait `std::marker::Sized` is not implemented for `[u8]` + = note: to learn more, visit + = note: required because it appears within the type `A<[u8]>` + = note: the return type of a function must have a statically known size + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/unsized-locals/unsized-exprs2.rs b/src/test/ui/unsized-locals/unsized-exprs2.rs index ae69893a835..3fb5a002e0e 100644 --- a/src/test/ui/unsized-locals/unsized-exprs2.rs +++ b/src/test/ui/unsized-locals/unsized-exprs2.rs @@ -21,6 +21,4 @@ impl std::ops::Add for A<[u8]> { fn main() { udrop::<[u8]>(foo()[..]); //~^ERROR cannot move out of indexed content - // FIXME: should be error - udrop::>(A(*foo())); } diff --git a/src/test/ui/unsized-locals/unsized-exprs3.rs b/src/test/ui/unsized-locals/unsized-exprs3.rs new file mode 100644 index 00000000000..2133b01e094 --- /dev/null +++ b/src/test/ui/unsized-locals/unsized-exprs3.rs @@ -0,0 +1,10 @@ +// aux-build:ufuncs.rs + +extern crate ufuncs; + +use ufuncs::udrop; + +fn main() { + udrop as fn([u8]); + //~^ERROR E0277 +} diff --git a/src/test/ui/unsized-locals/unsized-exprs3.stderr b/src/test/ui/unsized-locals/unsized-exprs3.stderr new file mode 100644 index 00000000000..f9a7452a5eb --- /dev/null +++ b/src/test/ui/unsized-locals/unsized-exprs3.stderr @@ -0,0 +1,14 @@ +error[E0277]: the size for values of type `[u8]` cannot be known at compilation time + --> $DIR/unsized-exprs3.rs:8:5 + | +LL | udrop as fn([u8]); + | ^^^^^ doesn't have a size known at compile-time + | + = help: the trait `std::marker::Sized` is not implemented for `[u8]` + = note: to learn more, visit + = note: all function arguments must have a statically known size + = help: unsized locals are gated as an unstable feature + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/unsized/unsized-bare-typaram.rs b/src/test/ui/unsized/unsized-bare-typaram.rs index 498bdded350..e611da91515 100644 --- a/src/test/ui/unsized/unsized-bare-typaram.rs +++ b/src/test/ui/unsized/unsized-bare-typaram.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn bar() { } fn foo() { bar::() } //~^ ERROR the size for values of type diff --git a/src/test/ui/unsized/unsized-bare-typaram.stderr b/src/test/ui/unsized/unsized-bare-typaram.stderr index 314e47baaad..cee1459c791 100644 --- a/src/test/ui/unsized/unsized-bare-typaram.stderr +++ b/src/test/ui/unsized/unsized-bare-typaram.stderr @@ -1,14 +1,14 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/unsized-bare-typaram.rs:12:23 + --> $DIR/unsized-bare-typaram.rs:2:23 | LL | fn foo() { bar::() } | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound note: required by `bar` - --> $DIR/unsized-bare-typaram.rs:11:1 + --> $DIR/unsized-bare-typaram.rs:1:1 | LL | fn bar() { } | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unsized/unsized-enum.rs b/src/test/ui/unsized/unsized-enum.rs index 4a6a5557c95..02ad1c878a4 100644 --- a/src/test/ui/unsized/unsized-enum.rs +++ b/src/test/ui/unsized/unsized-enum.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn is_sized() { } fn not_sized() { } diff --git a/src/test/ui/unsized/unsized-enum.stderr b/src/test/ui/unsized/unsized-enum.stderr index f518859c37c..20857a1d65e 100644 --- a/src/test/ui/unsized/unsized-enum.stderr +++ b/src/test/ui/unsized/unsized-enum.stderr @@ -1,14 +1,14 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/unsized-enum.rs:17:36 + --> $DIR/unsized-enum.rs:6:36 | LL | fn foo2() { not_sized::>() } | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound note: required by `Foo` - --> $DIR/unsized-enum.rs:15:1 + --> $DIR/unsized-enum.rs:4:1 | LL | enum Foo { FooSome(U), FooNone } | ^^^^^^^^^^^ diff --git a/src/test/ui/unsized/unsized-enum2.rs b/src/test/ui/unsized/unsized-enum2.rs index dadcc4206c3..0fe4a3acfbe 100644 --- a/src/test/ui/unsized/unsized-enum2.rs +++ b/src/test/ui/unsized/unsized-enum2.rs @@ -1,13 +1,3 @@ -// Copyright 206 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ops::Deref; // Due to aggressive error message deduplication, we require 20 *different* diff --git a/src/test/ui/unsized/unsized-enum2.stderr b/src/test/ui/unsized/unsized-enum2.stderr index ecaa0146469..9109366e4fc 100644 --- a/src/test/ui/unsized/unsized-enum2.stderr +++ b/src/test/ui/unsized/unsized-enum2.stderr @@ -1,208 +1,208 @@ error[E0277]: the size for values of type `W` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:33:8 + --> $DIR/unsized-enum2.rs:23:8 | LL | VA(W), | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `W` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where W: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:35:8 + --> $DIR/unsized-enum2.rs:25:8 | LL | VB{x: X}, | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `Y` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:37:15 + --> $DIR/unsized-enum2.rs:27:15 | LL | VC(isize, Y), | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Y` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where Y: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `Z` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:39:18 + --> $DIR/unsized-enum2.rs:29:18 | LL | VD{u: isize, x: Z}, | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Z` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where Z: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:43:8 + --> $DIR/unsized-enum2.rs:33:8 | LL | VE([u8]), | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:45:8 + --> $DIR/unsized-enum2.rs:35:8 | LL | VF{x: str}, | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `[f32]` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:47:15 + --> $DIR/unsized-enum2.rs:37:15 | LL | VG(isize, [f32]), | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[f32]` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `[u32]` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:49:18 + --> $DIR/unsized-enum2.rs:39:18 | LL | VH{u: isize, x: [u32]}, | ^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u32]` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:63:8 + --> $DIR/unsized-enum2.rs:53:8 | LL | VM(Foo), | ^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `(dyn Bar + 'static)` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:65:8 + --> $DIR/unsized-enum2.rs:55:8 | LL | VN{x: Bar}, | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn Bar + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `(dyn FooBar + 'static)` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:67:15 + --> $DIR/unsized-enum2.rs:57:15 | LL | VO(isize, FooBar), | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn FooBar + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `(dyn BarFoo + 'static)` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:69:18 + --> $DIR/unsized-enum2.rs:59:18 | LL | VP{u: isize, x: BarFoo}, | ^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn BarFoo + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `[i8]` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:73:8 + --> $DIR/unsized-enum2.rs:63:8 | LL | VQ(<&'static [i8] as Deref>::Target), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[i8]` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `[char]` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:75:8 + --> $DIR/unsized-enum2.rs:65:8 | LL | VR{x: <&'static [char] as Deref>::Target}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[char]` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `[f64]` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:77:15 + --> $DIR/unsized-enum2.rs:67:15 | LL | VS(isize, <&'static [f64] as Deref>::Target), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[f64]` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `[i32]` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:79:18 + --> $DIR/unsized-enum2.rs:69:18 | LL | VT{u: isize, x: <&'static [i32] as Deref>::Target}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[i32]` - = note: to learn more, visit + = note: to learn more, visit = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `(dyn PathHelper1 + 'static)` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:53:8 + --> $DIR/unsized-enum2.rs:43:8 | LL | VI(Path1), | ^^^^^ doesn't have a size known at compile-time | = help: within `Path1`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper1 + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `Path1` = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `(dyn PathHelper2 + 'static)` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:55:8 + --> $DIR/unsized-enum2.rs:45:8 | LL | VJ{x: Path2}, | ^^^^^^^^ doesn't have a size known at compile-time | = help: within `Path2`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper2 + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `Path2` = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `(dyn PathHelper3 + 'static)` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:57:15 + --> $DIR/unsized-enum2.rs:47:15 | LL | VK(isize, Path3), | ^^^^^ doesn't have a size known at compile-time | = help: within `Path3`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper3 + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `Path3` = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `(dyn PathHelper4 + 'static)` cannot be known at compilation time - --> $DIR/unsized-enum2.rs:59:18 + --> $DIR/unsized-enum2.rs:49:18 | LL | VL{u: isize, x: Path4}, | ^^^^^^^^ doesn't have a size known at compile-time | = help: within `Path4`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper4 + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: required because it appears within the type `Path4` = note: no field of an enum variant may have a dynamically sized type diff --git a/src/test/ui/unsized/unsized-inherent-impl-self-type.rs b/src/test/ui/unsized/unsized-inherent-impl-self-type.rs index a679bf77015..8bdf80c94da 100644 --- a/src/test/ui/unsized/unsized-inherent-impl-self-type.rs +++ b/src/test/ui/unsized/unsized-inherent-impl-self-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test sized-ness checking in substitution in impls. // impl - struct diff --git a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr index 8b6d9c610d1..98eecabc84c 100644 --- a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr @@ -1,14 +1,14 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized-inherent-impl-self-type.rs:17:17 + --> $DIR/unsized-inherent-impl-self-type.rs:7:17 | LL | impl S5 { | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound note: required by `S5` - --> $DIR/unsized-inherent-impl-self-type.rs:15:1 + --> $DIR/unsized-inherent-impl-self-type.rs:5:1 | LL | struct S5(Y); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unsized/unsized-struct.rs b/src/test/ui/unsized/unsized-struct.rs index f2c63455c51..bfa5aa0a506 100644 --- a/src/test/ui/unsized/unsized-struct.rs +++ b/src/test/ui/unsized/unsized-struct.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn is_sized() { } fn not_sized() { } diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr index 0e2d000d5f0..7add65c0786 100644 --- a/src/test/ui/unsized/unsized-struct.stderr +++ b/src/test/ui/unsized/unsized-struct.stderr @@ -1,30 +1,30 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/unsized-struct.rs:17:36 + --> $DIR/unsized-struct.rs:6:36 | LL | fn foo2() { not_sized::>() } | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound note: required by `Foo` - --> $DIR/unsized-struct.rs:15:1 + --> $DIR/unsized-struct.rs:4:1 | LL | struct Foo { data: T } | ^^^^^^^^^^^^^ error[E0277]: the size for values of type `T` cannot be known at compilation time - --> $DIR/unsized-struct.rs:24:24 + --> $DIR/unsized-struct.rs:13:24 | LL | fn bar2() { is_sized::>() } | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: within `Bar`, the trait `std::marker::Sized` is not implemented for `T` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where T: std::marker::Sized` bound = note: required because it appears within the type `Bar` note: required by `is_sized` - --> $DIR/unsized-struct.rs:12:1 + --> $DIR/unsized-struct.rs:1:1 | LL | fn is_sized() { } | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unsized/unsized-trait-impl-self-type.rs b/src/test/ui/unsized/unsized-trait-impl-self-type.rs index 5c0b8f12402..df571a83382 100644 --- a/src/test/ui/unsized/unsized-trait-impl-self-type.rs +++ b/src/test/ui/unsized/unsized-trait-impl-self-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test sized-ness checking in substitution in impls. // impl - struct diff --git a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr index b51787ef105..c39f3652b64 100644 --- a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr @@ -1,14 +1,14 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized-trait-impl-self-type.rs:20:17 + --> $DIR/unsized-trait-impl-self-type.rs:10:17 | LL | impl T3 for S5 { | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound note: required by `S5` - --> $DIR/unsized-trait-impl-self-type.rs:18:1 + --> $DIR/unsized-trait-impl-self-type.rs:8:1 | LL | struct S5(Y); | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unsized/unsized-trait-impl-trait-arg.rs b/src/test/ui/unsized/unsized-trait-impl-trait-arg.rs index 875a52e11c0..96e7e371f2a 100644 --- a/src/test/ui/unsized/unsized-trait-impl-trait-arg.rs +++ b/src/test/ui/unsized/unsized-trait-impl-trait-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test sized-ness checking in substitution in impls. // impl - unbounded diff --git a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr index 187fac9626d..ee0d5ccccfe 100644 --- a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr +++ b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized-trait-impl-trait-arg.rs:18:17 + --> $DIR/unsized-trait-impl-trait-arg.rs:8:17 | LL | impl T2 for S4 { | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound error: aborting due to previous error diff --git a/src/test/ui/unsized3.rs b/src/test/ui/unsized3.rs index 2e346e473ca..f5b5d025931 100644 --- a/src/test/ui/unsized3.rs +++ b/src/test/ui/unsized3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test sized-ness checking in substitution within fn bodies.. use std::marker; diff --git a/src/test/ui/unsized3.stderr b/src/test/ui/unsized3.stderr index 1d7b146b131..2c7b86c5d82 100644 --- a/src/test/ui/unsized3.stderr +++ b/src/test/ui/unsized3.stderr @@ -1,87 +1,87 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:17:5 + --> $DIR/unsized3.rs:7:5 | LL | f2::(x); | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound note: required by `f2` - --> $DIR/unsized3.rs:20:1 + --> $DIR/unsized3.rs:10:1 | LL | fn f2(x: &X) { | ^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:28:5 + --> $DIR/unsized3.rs:18:5 | LL | f4::(x); | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound note: required by `f4` - --> $DIR/unsized3.rs:31:1 + --> $DIR/unsized3.rs:21:1 | LL | fn f4(x: &X) { | ^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:43:5 + --> $DIR/unsized3.rs:33:5 | LL | f5(x1); | ^^ doesn't have a size known at compile-time | = help: within `S`, the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: required because it appears within the type `S` note: required by `f5` - --> $DIR/unsized3.rs:34:1 + --> $DIR/unsized3.rs:24:1 | LL | fn f5(x: &Y) {} | ^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:50:5 + --> $DIR/unsized3.rs:40:5 | LL | f5(&(*x1, 34)); | ^^ doesn't have a size known at compile-time | = help: within `S`, the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: required because it appears within the type `S` = note: only the last element of a tuple may have a dynamically sized type error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:55:9 + --> $DIR/unsized3.rs:45:9 | LL | f5(&(32, *x1)); | ^^^^^^^^^ doesn't have a size known at compile-time | = help: within `({integer}, S)`, the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: required because it appears within the type `S` = note: required because it appears within the type `({integer}, S)` = note: tuples must have a statically known size to be initialized error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized3.rs:55:5 + --> $DIR/unsized3.rs:45:5 | LL | f5(&(32, *x1)); | ^^ doesn't have a size known at compile-time | = help: within `({integer}, S)`, the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: required because it appears within the type `S` = note: required because it appears within the type `({integer}, S)` note: required by `f5` - --> $DIR/unsized3.rs:34:1 + --> $DIR/unsized3.rs:24:1 | LL | fn f5(x: &Y) {} | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unsized5.rs b/src/test/ui/unsized5.rs index a50786e306a..befd2244d97 100644 --- a/src/test/ui/unsized5.rs +++ b/src/test/ui/unsized5.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test `?Sized` types not allowed in fields (except the last one). struct S1 { diff --git a/src/test/ui/unsized5.stderr b/src/test/ui/unsized5.stderr index 73553f84981..6dce9a04606 100644 --- a/src/test/ui/unsized5.stderr +++ b/src/test/ui/unsized5.stderr @@ -1,64 +1,64 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized5.rs:14:5 + --> $DIR/unsized5.rs:4:5 | LL | f1: X, | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: only the last field of a struct may have a dynamically sized type error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized5.rs:20:5 + --> $DIR/unsized5.rs:10:5 | LL | g: X, | ^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: only the last field of a struct may have a dynamically sized type error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/unsized5.rs:25:5 + --> $DIR/unsized5.rs:15:5 | LL | f: str, | ^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` - = note: to learn more, visit + = note: to learn more, visit = note: only the last field of a struct may have a dynamically sized type error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized5.rs:30:5 + --> $DIR/unsized5.rs:20:5 | LL | f: [u8], | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit + = note: to learn more, visit = note: only the last field of a struct may have a dynamically sized type error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized5.rs:35:8 + --> $DIR/unsized5.rs:25:8 | LL | V1(X, isize), | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized5.rs:39:8 + --> $DIR/unsized5.rs:29:8 | LL | V2{f1: X, f: isize}, | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type diff --git a/src/test/ui/unsized6.rs b/src/test/ui/unsized6.rs index 1a57f2caf8d..79133554d54 100644 --- a/src/test/ui/unsized6.rs +++ b/src/test/ui/unsized6.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test `?Sized` local variables. trait T {} diff --git a/src/test/ui/unsized6.stderr b/src/test/ui/unsized6.stderr index 5a095332692..a6a26573e7c 100644 --- a/src/test/ui/unsized6.stderr +++ b/src/test/ui/unsized6.stderr @@ -1,152 +1,152 @@ error[E0277]: the size for values of type `Y` cannot be known at compilation time - --> $DIR/unsized6.rs:19:9 + --> $DIR/unsized6.rs:9:9 | LL | let y: Y; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Y` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where Y: std::marker::Sized` bound = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized6.rs:17:12 + --> $DIR/unsized6.rs:7:12 | LL | let _: (isize, (X, isize)); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: only the last element of a tuple may have a dynamically sized type error[E0277]: the size for values of type `Z` cannot be known at compilation time - --> $DIR/unsized6.rs:21:12 + --> $DIR/unsized6.rs:11:12 | LL | let y: (isize, (Z, usize)); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Z` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where Z: std::marker::Sized` bound = note: only the last element of a tuple may have a dynamically sized type error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized6.rs:25:9 + --> $DIR/unsized6.rs:15:9 | LL | let y: X; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `Y` cannot be known at compilation time - --> $DIR/unsized6.rs:27:12 + --> $DIR/unsized6.rs:17:12 | LL | let y: (isize, (Y, isize)); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `Y` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where Y: std::marker::Sized` bound = note: only the last element of a tuple may have a dynamically sized type error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized6.rs:32:9 + --> $DIR/unsized6.rs:22:9 | LL | let y: X = *x1; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized6.rs:34:9 + --> $DIR/unsized6.rs:24:9 | LL | let y = *x2; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized6.rs:36:10 + --> $DIR/unsized6.rs:26:10 | LL | let (y, z) = (*x3, 4); | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized6.rs:40:9 + --> $DIR/unsized6.rs:30:9 | LL | let y: X = *x1; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized6.rs:42:9 + --> $DIR/unsized6.rs:32:9 | LL | let y = *x2; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized6.rs:44:10 + --> $DIR/unsized6.rs:34:10 | LL | let (y, z) = (*x3, 4); | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized6.rs:48:18 + --> $DIR/unsized6.rs:38:18 | LL | fn g1(x: X) {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized6.rs:50:22 + --> $DIR/unsized6.rs:40:22 | LL | fn g2(x: X) {} | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound = note: all local variables must have a statically known size = help: unsized locals are gated as an unstable feature diff --git a/src/test/ui/unsized7.rs b/src/test/ui/unsized7.rs index 07b4ae4c394..422a784814e 100644 --- a/src/test/ui/unsized7.rs +++ b/src/test/ui/unsized7.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test sized-ness checking in substitution in impls. trait T {} diff --git a/src/test/ui/unsized7.stderr b/src/test/ui/unsized7.stderr index 67217659fbc..bb83b181184 100644 --- a/src/test/ui/unsized7.stderr +++ b/src/test/ui/unsized7.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `X` cannot be known at compilation time - --> $DIR/unsized7.rs:22:21 + --> $DIR/unsized7.rs:12:21 | LL | impl T1 for S3 { | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `X` - = note: to learn more, visit + = note: to learn more, visit = help: consider adding a `where X: std::marker::Sized` bound error: aborting due to previous error diff --git a/src/test/ui/unspecified-self-in-trait-ref.rs b/src/test/ui/unspecified-self-in-trait-ref.rs index cf8f3e91602..74a9af84cae 100644 --- a/src/test/ui/unspecified-self-in-trait-ref.rs +++ b/src/test/ui/unspecified-self-in-trait-ref.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub trait Foo { fn foo(&self); } diff --git a/src/test/ui/unspecified-self-in-trait-ref.stderr b/src/test/ui/unspecified-self-in-trait-ref.stderr index c036540068b..b295b39d33c 100644 --- a/src/test/ui/unspecified-self-in-trait-ref.stderr +++ b/src/test/ui/unspecified-self-in-trait-ref.stderr @@ -1,29 +1,37 @@ error[E0599]: no function or associated item named `lol` found for type `dyn Foo<_>` in the current scope - --> $DIR/unspecified-self-in-trait-ref.rs:20:13 + --> $DIR/unspecified-self-in-trait-ref.rs:10:18 | LL | let a = Foo::lol(); - | ^^^^^^^^ function or associated item not found in `dyn Foo<_>` + | -----^^^ + | | + | function or associated item not found in `dyn Foo<_>` error[E0599]: no function or associated item named `lol` found for type `dyn Foo<_>` in the current scope - --> $DIR/unspecified-self-in-trait-ref.rs:22:13 + --> $DIR/unspecified-self-in-trait-ref.rs:12:23 | LL | let b = Foo::<_>::lol(); - | ^^^^^^^^^^^^^ function or associated item not found in `dyn Foo<_>` + | ----------^^^ + | | + | function or associated item not found in `dyn Foo<_>` error[E0599]: no function or associated item named `lol` found for type `dyn Bar<_, _>` in the current scope - --> $DIR/unspecified-self-in-trait-ref.rs:24:13 + --> $DIR/unspecified-self-in-trait-ref.rs:14:18 | LL | let c = Bar::lol(); - | ^^^^^^^^ function or associated item not found in `dyn Bar<_, _>` + | -----^^^ + | | + | function or associated item not found in `dyn Bar<_, _>` error[E0599]: no function or associated item named `lol` found for type `dyn Bar` in the current scope - --> $DIR/unspecified-self-in-trait-ref.rs:26:13 + --> $DIR/unspecified-self-in-trait-ref.rs:16:30 | LL | let d = Bar::::lol(); - | ^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `dyn Bar` + | -----------------^^^ + | | + | function or associated item not found in `dyn Bar` error[E0393]: the type parameter `A` must be explicitly specified - --> $DIR/unspecified-self-in-trait-ref.rs:28:13 + --> $DIR/unspecified-self-in-trait-ref.rs:18:13 | LL | let e = Bar::::lol(); | ^^^^^^^^^^^^^^^^^ missing reference to `A` diff --git a/src/test/ui/unsupported-cast.rs b/src/test/ui/unsupported-cast.rs index 5137663a269..cb6a57a4d39 100644 --- a/src/test/ui/unsupported-cast.rs +++ b/src/test/ui/unsupported-cast.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:casting struct A; diff --git a/src/test/ui/unsupported-cast.stderr b/src/test/ui/unsupported-cast.stderr index 4babc01ad7f..63e7713d2f4 100644 --- a/src/test/ui/unsupported-cast.stderr +++ b/src/test/ui/unsupported-cast.stderr @@ -1,5 +1,5 @@ error[E0606]: casting `f64` as `*const A` is invalid - --> $DIR/unsupported-cast.rs:16:20 + --> $DIR/unsupported-cast.rs:6:20 | LL | println!("{:?}", 1.0 as *const A); // Can't cast float to foreign. | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/unused/unused-attr.rs b/src/test/ui/unused/unused-attr.rs index e20d03478ec..810732a9775 100644 --- a/src/test/ui/unused/unused-attr.rs +++ b/src/test/ui/unused/unused-attr.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused_attributes)] #![allow(dead_code, unused_imports, unused_extern_crates)] #![feature(custom_attribute)] diff --git a/src/test/ui/unused/unused-attr.stderr b/src/test/ui/unused/unused-attr.stderr index 7265dd3c63f..6d8a4dd84e6 100644 --- a/src/test/ui/unused/unused-attr.stderr +++ b/src/test/ui/unused/unused-attr.stderr @@ -1,95 +1,95 @@ error: unused attribute - --> $DIR/unused-attr.rs:17:1 + --> $DIR/unused-attr.rs:7:1 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ | note: lint level defined here - --> $DIR/unused-attr.rs:11:9 + --> $DIR/unused-attr.rs:1:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:20:1 + --> $DIR/unused-attr.rs:10:1 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:25:5 + --> $DIR/unused-attr.rs:15:5 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:23:1 + --> $DIR/unused-attr.rs:13:1 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:33:9 + --> $DIR/unused-attr.rs:23:9 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:31:5 + --> $DIR/unused-attr.rs:21:5 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:29:1 + --> $DIR/unused-attr.rs:19:1 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:41:9 + --> $DIR/unused-attr.rs:31:9 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:38:1 + --> $DIR/unused-attr.rs:28:1 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:48:5 + --> $DIR/unused-attr.rs:38:5 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:46:1 + --> $DIR/unused-attr.rs:36:1 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:54:5 + --> $DIR/unused-attr.rs:44:5 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:56:5 + --> $DIR/unused-attr.rs:46:5 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:52:1 + --> $DIR/unused-attr.rs:42:1 | LL | #[foo] //~ ERROR unused attribute | ^^^^^^ error: unused attribute - --> $DIR/unused-attr.rs:15:1 + --> $DIR/unused-attr.rs:5:1 | LL | #![foo] //~ ERROR unused attribute | ^^^^^^^ diff --git a/src/test/ui/unused/unused-macro-rules.rs b/src/test/ui/unused/unused-macro-rules.rs index 5e401c09bda..1a714b8f0a0 100644 --- a/src/test/ui/unused/unused-macro-rules.rs +++ b/src/test/ui/unused/unused-macro-rules.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused_macros)] // Most simple case diff --git a/src/test/ui/unused/unused-macro-rules.stderr b/src/test/ui/unused/unused-macro-rules.stderr index 8ced41022f8..c6ec064096b 100644 --- a/src/test/ui/unused/unused-macro-rules.stderr +++ b/src/test/ui/unused/unused-macro-rules.stderr @@ -1,5 +1,5 @@ error: unused macro definition - --> $DIR/unused-macro-rules.rs:14:1 + --> $DIR/unused-macro-rules.rs:4:1 | LL | / macro_rules! unused { //~ ERROR: unused macro definition LL | | () => {}; @@ -7,13 +7,13 @@ LL | | } | |_^ | note: lint level defined here - --> $DIR/unused-macro-rules.rs:11:9 + --> $DIR/unused-macro-rules.rs:1:9 | LL | #![deny(unused_macros)] | ^^^^^^^^^^^^^ error: unused macro definition - --> $DIR/unused-macro-rules.rs:21:9 + --> $DIR/unused-macro-rules.rs:11:9 | LL | / macro_rules! m { //~ ERROR: unused macro definition LL | | () => {}; @@ -24,7 +24,7 @@ LL | create_macro!(); | ---------------- in this macro invocation error: unused macro definition - --> $DIR/unused-macro-rules.rs:34:5 + --> $DIR/unused-macro-rules.rs:24:5 | LL | / macro_rules! unused { //~ ERROR: unused macro definition LL | | () => {}; @@ -32,7 +32,7 @@ LL | | } | |_____^ | note: lint level defined here - --> $DIR/unused-macro-rules.rs:33:12 + --> $DIR/unused-macro-rules.rs:23:12 | LL | #[deny(unused_macros)] | ^^^^^^^^^^^^^ diff --git a/src/test/ui/unused/unused-macro-with-bad-frag-spec.rs b/src/test/ui/unused/unused-macro-with-bad-frag-spec.rs index 28a69e6f9e2..ce187047bb7 100644 --- a/src/test/ui/unused/unused-macro-with-bad-frag-spec.rs +++ b/src/test/ui/unused/unused-macro-with-bad-frag-spec.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_macros)] // Issue #21370 diff --git a/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr b/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr index 20b1ae690ec..e4624a5fe05 100644 --- a/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr +++ b/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr @@ -1,5 +1,5 @@ error: invalid fragment specifier `t_ty` - --> $DIR/unused-macro-with-bad-frag-spec.rs:16:6 + --> $DIR/unused-macro-with-bad-frag-spec.rs:6:6 | LL | ($wrong:t_ty) => () //~ ERROR invalid fragment specifier `t_ty` | ^^^^^^^^^^^ diff --git a/src/test/ui/unused/unused-macro-with-follow-violation.rs b/src/test/ui/unused/unused-macro-with-follow-violation.rs index dda0d3fc955..1666dae69b9 100644 --- a/src/test/ui/unused/unused-macro-with-follow-violation.rs +++ b/src/test/ui/unused/unused-macro-with-follow-violation.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_macros)] macro_rules! test { diff --git a/src/test/ui/unused/unused-macro-with-follow-violation.stderr b/src/test/ui/unused/unused-macro-with-follow-violation.stderr index 78362fcb05a..dfeb3a407e5 100644 --- a/src/test/ui/unused/unused-macro-with-follow-violation.stderr +++ b/src/test/ui/unused/unused-macro-with-follow-violation.stderr @@ -1,5 +1,5 @@ error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments - --> $DIR/unused-macro-with-follow-violation.rs:14:14 + --> $DIR/unused-macro-with-follow-violation.rs:4:14 | LL | ($e:expr +) => () //~ ERROR not allowed for `expr` fragments | ^ not allowed after `expr` fragments diff --git a/src/test/ui/unused/unused-macro.rs b/src/test/ui/unused/unused-macro.rs index 9e32f01724d..302b0727d77 100644 --- a/src/test/ui/unused/unused-macro.rs +++ b/src/test/ui/unused/unused-macro.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(decl_macro)] #![deny(unused_macros)] diff --git a/src/test/ui/unused/unused-macro.stderr b/src/test/ui/unused/unused-macro.stderr index 3e1c1164d5b..a83b5be5fbf 100644 --- a/src/test/ui/unused/unused-macro.stderr +++ b/src/test/ui/unused/unused-macro.stderr @@ -1,5 +1,5 @@ error: unused macro definition - --> $DIR/unused-macro.rs:15:1 + --> $DIR/unused-macro.rs:5:1 | LL | / macro unused { //~ ERROR: unused macro definition LL | | () => {} @@ -7,13 +7,13 @@ LL | | } | |_^ | note: lint level defined here - --> $DIR/unused-macro.rs:12:9 + --> $DIR/unused-macro.rs:2:9 | LL | #![deny(unused_macros)] | ^^^^^^^^^^^^^ error: unused macro definition - --> $DIR/unused-macro.rs:25:5 + --> $DIR/unused-macro.rs:15:5 | LL | / macro unused { //~ ERROR: unused macro definition LL | | () => {} @@ -21,13 +21,13 @@ LL | | } | |_____^ | note: lint level defined here - --> $DIR/unused-macro.rs:24:12 + --> $DIR/unused-macro.rs:14:12 | LL | #[deny(unused_macros)] | ^^^^^^^^^^^^^ error: unused macro definition - --> $DIR/unused-macro.rs:31:5 + --> $DIR/unused-macro.rs:21:5 | LL | / pub(crate) macro unused { //~ ERROR: unused macro definition LL | | () => {} diff --git a/src/test/ui/unused/unused-mut-warning-captured-var.rs b/src/test/ui/unused/unused-mut-warning-captured-var.rs index d4dc58864ad..c945969cf63 100644 --- a/src/test/ui/unused/unused-mut-warning-captured-var.rs +++ b/src/test/ui/unused/unused-mut-warning-captured-var.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![forbid(unused_mut)] fn main() { diff --git a/src/test/ui/unused/unused-mut-warning-captured-var.stderr b/src/test/ui/unused/unused-mut-warning-captured-var.stderr index ae976d85bde..d5b731406d6 100644 --- a/src/test/ui/unused/unused-mut-warning-captured-var.stderr +++ b/src/test/ui/unused/unused-mut-warning-captured-var.stderr @@ -1,5 +1,5 @@ error: variable does not need to be mutable - --> $DIR/unused-mut-warning-captured-var.rs:14:9 + --> $DIR/unused-mut-warning-captured-var.rs:4:9 | LL | let mut x = 1; | ----^ @@ -7,7 +7,7 @@ LL | let mut x = 1; | help: remove this `mut` | note: lint level defined here - --> $DIR/unused-mut-warning-captured-var.rs:11:11 + --> $DIR/unused-mut-warning-captured-var.rs:1:11 | LL | #![forbid(unused_mut)] | ^^^^^^^^^^ diff --git a/src/test/ui/unused/unused-result.rs b/src/test/ui/unused/unused-result.rs index 69d226ef1d0..538d30943ed 100644 --- a/src/test/ui/unused/unused-result.rs +++ b/src/test/ui/unused/unused-result.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![deny(unused_results, unused_must_use)] //~^ NOTE: lint level defined here diff --git a/src/test/ui/unused/unused-result.stderr b/src/test/ui/unused/unused-result.stderr index 156ec889387..2eb53eac406 100644 --- a/src/test/ui/unused/unused-result.stderr +++ b/src/test/ui/unused/unused-result.stderr @@ -1,17 +1,17 @@ error: unused `MustUse` that must be used - --> $DIR/unused-result.rs:31:5 + --> $DIR/unused-result.rs:21:5 | LL | foo::(); //~ ERROR: unused `MustUse` that must be used | ^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/unused-result.rs:12:25 + --> $DIR/unused-result.rs:2:25 | LL | #![deny(unused_results, unused_must_use)] | ^^^^^^^^^^^^^^^ error: unused `MustUseMsg` that must be used - --> $DIR/unused-result.rs:32:5 + --> $DIR/unused-result.rs:22:5 | LL | foo::(); //~ ERROR: unused `MustUseMsg` that must be used | ^^^^^^^^^^^^^^^^^^^^ @@ -19,25 +19,25 @@ LL | foo::(); //~ ERROR: unused `MustUseMsg` that must be used = note: some message error: unused result - --> $DIR/unused-result.rs:44:5 + --> $DIR/unused-result.rs:34:5 | LL | foo::(); //~ ERROR: unused result | ^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/unused-result.rs:12:9 + --> $DIR/unused-result.rs:2:9 | LL | #![deny(unused_results, unused_must_use)] | ^^^^^^^^^^^^^^ error: unused `MustUse` that must be used - --> $DIR/unused-result.rs:45:5 + --> $DIR/unused-result.rs:35:5 | LL | foo::(); //~ ERROR: unused `MustUse` that must be used | ^^^^^^^^^^^^^^^^^ error: unused `MustUseMsg` that must be used - --> $DIR/unused-result.rs:46:5 + --> $DIR/unused-result.rs:36:5 | LL | foo::(); //~ ERROR: unused `MustUseMsg` that must be used | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/use-self-in-inner-fn.rs b/src/test/ui/use-self-in-inner-fn.rs index fea6958d7eb..cde96dc778b 100644 --- a/src/test/ui/use-self-in-inner-fn.rs +++ b/src/test/ui/use-self-in-inner-fn.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct A; impl A { diff --git a/src/test/ui/use-self-in-inner-fn.stderr b/src/test/ui/use-self-in-inner-fn.stderr index cef030aec46..a613804b803 100644 --- a/src/test/ui/use-self-in-inner-fn.stderr +++ b/src/test/ui/use-self-in-inner-fn.stderr @@ -1,5 +1,5 @@ error[E0401]: can't use type parameters from outer function - --> $DIR/use-self-in-inner-fn.rs:16:25 + --> $DIR/use-self-in-inner-fn.rs:6:25 | LL | impl A { | ---- `Self` type implicitly declared here, by this `impl` diff --git a/src/test/ui/use/auxiliary/use_from_trait_xc.rs b/src/test/ui/use/auxiliary/use_from_trait_xc.rs index 9a6d176d088..4abe11941b1 100644 --- a/src/test/ui/use/auxiliary/use_from_trait_xc.rs +++ b/src/test/ui/use/auxiliary/use_from_trait_xc.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - pub use self::sub::{Bar, Baz}; pub trait Trait { diff --git a/src/test/ui/use/use-after-move-based-on-type.nll.stderr b/src/test/ui/use/use-after-move-based-on-type.nll.stderr index a18c25cbb55..8160ada9d62 100644 --- a/src/test/ui/use/use-after-move-based-on-type.nll.stderr +++ b/src/test/ui/use/use-after-move-based-on-type.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: borrow of moved value: `x` - --> $DIR/use-after-move-based-on-type.rs:14:20 + --> $DIR/use-after-move-based-on-type.rs:4:20 | +LL | let x = "Hello!".to_string(); + | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = x; | - value moved here LL | println!("{}", x); //~ ERROR use of moved value | ^ value borrowed here after move - | - = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/use/use-after-move-based-on-type.rs b/src/test/ui/use/use-after-move-based-on-type.rs index e2167ca446f..fc8ea6f79eb 100644 --- a/src/test/ui/use/use-after-move-based-on-type.rs +++ b/src/test/ui/use/use-after-move-based-on-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let x = "Hello!".to_string(); let _y = x; diff --git a/src/test/ui/use/use-after-move-based-on-type.stderr b/src/test/ui/use/use-after-move-based-on-type.stderr index 510cc708bed..2282cdfad14 100644 --- a/src/test/ui/use/use-after-move-based-on-type.stderr +++ b/src/test/ui/use/use-after-move-based-on-type.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `x` - --> $DIR/use-after-move-based-on-type.rs:14:20 + --> $DIR/use-after-move-based-on-type.rs:4:20 | LL | let _y = x; | -- value moved here diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.nll.stderr b/src/test/ui/use/use-after-move-implicity-coerced-object.nll.stderr index 23753506368..e16bca38067 100644 --- a/src/test/ui/use/use-after-move-implicity-coerced-object.nll.stderr +++ b/src/test/ui/use/use-after-move-implicity-coerced-object.nll.stderr @@ -1,12 +1,13 @@ error[E0382]: borrow of moved value: `n` - --> $DIR/use-after-move-implicity-coerced-object.rs:38:13 + --> $DIR/use-after-move-implicity-coerced-object.rs:28:13 | +LL | let n: Box<_> = box Number { n: 42 }; + | - move occurs because `n` has type `std::boxed::Box`, which does not implement the `Copy` trait +LL | let mut l: Box<_> = box List { list: Vec::new() }; LL | l.push(n); | - value moved here LL | let x = n.to_string(); | ^ value borrowed here after move - | - = note: move occurs because `n` has type `std::boxed::Box`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.rs b/src/test/ui/use/use-after-move-implicity-coerced-object.rs index addc5721752..e4350691664 100644 --- a/src/test/ui/use/use-after-move-implicity-coerced-object.rs +++ b/src/test/ui/use/use-after-move-implicity-coerced-object.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] use std::fmt; diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr index ab7494702d7..babff9be252 100644 --- a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr +++ b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `n` - --> $DIR/use-after-move-implicity-coerced-object.rs:38:13 + --> $DIR/use-after-move-implicity-coerced-object.rs:28:13 | LL | l.push(n); | - value moved here diff --git a/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr b/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr index f13324955fa..4119741d805 100644 --- a/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr +++ b/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: use of moved value: `self` - --> $DIR/use-after-move-self-based-on-type.rs:22:16 + --> $DIR/use-after-move-self-based-on-type.rs:12:16 | +LL | pub fn foo(self) -> isize { + | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait LL | self.bar(); | ---- value moved here LL | return self.x; //~ ERROR use of moved value: `self.x` | ^^^^^^ value used here after move - | - = note: move occurs because `self` has type `S`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/use/use-after-move-self-based-on-type.rs b/src/test/ui/use/use-after-move-self-based-on-type.rs index 810fc68a0f4..4d84ae9b271 100644 --- a/src/test/ui/use/use-after-move-self-based-on-type.rs +++ b/src/test/ui/use/use-after-move-self-based-on-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S { x: isize, } diff --git a/src/test/ui/use/use-after-move-self-based-on-type.stderr b/src/test/ui/use/use-after-move-self-based-on-type.stderr index 60cd142799e..a3acc1aad0f 100644 --- a/src/test/ui/use/use-after-move-self-based-on-type.stderr +++ b/src/test/ui/use/use-after-move-self-based-on-type.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `self.x` - --> $DIR/use-after-move-self-based-on-type.rs:22:16 + --> $DIR/use-after-move-self-based-on-type.rs:12:16 | LL | self.bar(); | ---- value moved here diff --git a/src/test/ui/use/use-after-move-self.nll.stderr b/src/test/ui/use/use-after-move-self.nll.stderr index 241dc32bb05..e2ce3690cb9 100644 --- a/src/test/ui/use/use-after-move-self.nll.stderr +++ b/src/test/ui/use/use-after-move-self.nll.stderr @@ -1,6 +1,8 @@ error[E0382]: use of moved value: `self` - --> $DIR/use-after-move-self.rs:20:16 + --> $DIR/use-after-move-self.rs:10:16 | +LL | pub fn foo(self) -> isize { + | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait LL | self.bar(); | ---- value moved here LL | return *self.x; //~ ERROR use of moved value: `*self.x` diff --git a/src/test/ui/use/use-after-move-self.rs b/src/test/ui/use/use-after-move-self.rs index e9ffb26aba5..1337d61a6d8 100644 --- a/src/test/ui/use/use-after-move-self.rs +++ b/src/test/ui/use/use-after-move-self.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(box_syntax)] struct S { diff --git a/src/test/ui/use/use-after-move-self.stderr b/src/test/ui/use/use-after-move-self.stderr index 7273602aadc..3cb77acaf3d 100644 --- a/src/test/ui/use/use-after-move-self.stderr +++ b/src/test/ui/use/use-after-move-self.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `*self.x` - --> $DIR/use-after-move-self.rs:20:16 + --> $DIR/use-after-move-self.rs:10:16 | LL | self.bar(); | ---- value moved here diff --git a/src/test/ui/use/use-from-trait-xc.rs b/src/test/ui/use/use-from-trait-xc.rs index 3848b6814d9..e6f102f6269 100644 --- a/src/test/ui/use/use-from-trait-xc.rs +++ b/src/test/ui/use/use-from-trait-xc.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:use_from_trait_xc.rs extern crate use_from_trait_xc; diff --git a/src/test/ui/use/use-from-trait-xc.stderr b/src/test/ui/use/use-from-trait-xc.stderr index 6c643dff796..8ff75b503d5 100644 --- a/src/test/ui/use/use-from-trait-xc.stderr +++ b/src/test/ui/use/use-from-trait-xc.stderr @@ -1,53 +1,53 @@ error[E0253]: `foo` is not directly importable - --> $DIR/use-from-trait-xc.rs:15:5 + --> $DIR/use-from-trait-xc.rs:5:5 | LL | use use_from_trait_xc::Trait::foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be imported directly error[E0253]: `Assoc` is not directly importable - --> $DIR/use-from-trait-xc.rs:18:5 + --> $DIR/use-from-trait-xc.rs:8:5 | LL | use use_from_trait_xc::Trait::Assoc; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be imported directly error[E0253]: `CONST` is not directly importable - --> $DIR/use-from-trait-xc.rs:21:5 + --> $DIR/use-from-trait-xc.rs:11:5 | LL | use use_from_trait_xc::Trait::CONST; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be imported directly error[E0432]: unresolved import `use_from_trait_xc::Foo` - --> $DIR/use-from-trait-xc.rs:24:24 + --> $DIR/use-from-trait-xc.rs:14:24 | LL | use use_from_trait_xc::Foo::new; //~ ERROR struct `Foo` is private | ^^^ not a module `Foo` error[E0432]: unresolved import `use_from_trait_xc::Foo` - --> $DIR/use-from-trait-xc.rs:27:24 + --> $DIR/use-from-trait-xc.rs:17:24 | LL | use use_from_trait_xc::Foo::C; //~ ERROR struct `Foo` is private | ^^^ not a module `Foo` error[E0432]: unresolved import `use_from_trait_xc::Bar` - --> $DIR/use-from-trait-xc.rs:30:24 + --> $DIR/use-from-trait-xc.rs:20:24 | LL | use use_from_trait_xc::Bar::new as bnew; | ^^^ not a module `Bar` error[E0432]: unresolved import `use_from_trait_xc::Baz::new` - --> $DIR/use-from-trait-xc.rs:33:5 + --> $DIR/use-from-trait-xc.rs:23:5 | LL | use use_from_trait_xc::Baz::new as baznew; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `new` in `Baz` error[E0603]: struct `Foo` is private - --> $DIR/use-from-trait-xc.rs:24:24 + --> $DIR/use-from-trait-xc.rs:14:24 | LL | use use_from_trait_xc::Foo::new; //~ ERROR struct `Foo` is private | ^^^ error[E0603]: struct `Foo` is private - --> $DIR/use-from-trait-xc.rs:27:24 + --> $DIR/use-from-trait-xc.rs:17:24 | LL | use use_from_trait_xc::Foo::C; //~ ERROR struct `Foo` is private | ^^^ diff --git a/src/test/ui/use/use-from-trait.rs b/src/test/ui/use/use-from-trait.rs index afa76320582..fe578723bd3 100644 --- a/src/test/ui/use/use-from-trait.rs +++ b/src/test/ui/use/use-from-trait.rs @@ -1,14 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - use Trait::foo; //~^ ERROR `foo` is not directly importable use Trait::Assoc; diff --git a/src/test/ui/use/use-from-trait.stderr b/src/test/ui/use/use-from-trait.stderr index cb0fd94fa6e..9e138422a2f 100644 --- a/src/test/ui/use/use-from-trait.stderr +++ b/src/test/ui/use/use-from-trait.stderr @@ -1,29 +1,29 @@ error[E0253]: `foo` is not directly importable - --> $DIR/use-from-trait.rs:12:5 + --> $DIR/use-from-trait.rs:1:5 | LL | use Trait::foo; | ^^^^^^^^^^ cannot be imported directly error[E0253]: `Assoc` is not directly importable - --> $DIR/use-from-trait.rs:14:5 + --> $DIR/use-from-trait.rs:3:5 | LL | use Trait::Assoc; | ^^^^^^^^^^^^ cannot be imported directly error[E0253]: `C` is not directly importable - --> $DIR/use-from-trait.rs:16:5 + --> $DIR/use-from-trait.rs:5:5 | LL | use Trait::C; | ^^^^^^^^ cannot be imported directly error[E0432]: unresolved import `Foo` - --> $DIR/use-from-trait.rs:19:5 + --> $DIR/use-from-trait.rs:8:5 | LL | use Foo::new; | ^^^ not a module `Foo` error[E0432]: unresolved import `Foo` - --> $DIR/use-from-trait.rs:23:5 + --> $DIR/use-from-trait.rs:12:5 | LL | use Foo::C2; | ^^^ not a module `Foo` diff --git a/src/test/ui/use/use-keyword.rs b/src/test/ui/use/use-keyword.rs index aff54f18c19..c30c2e06c45 100644 --- a/src/test/ui/use/use-keyword.rs +++ b/src/test/ui/use/use-keyword.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that imports with nakes super and self don't fail during parsing // FIXME: this shouldn't fail during name resolution either diff --git a/src/test/ui/use/use-keyword.stderr b/src/test/ui/use/use-keyword.stderr index 11893bce5c4..1cb30fa487e 100644 --- a/src/test/ui/use/use-keyword.stderr +++ b/src/test/ui/use/use-keyword.stderr @@ -1,17 +1,17 @@ error[E0429]: `self` imports are only allowed within a { } list - --> $DIR/use-keyword.rs:16:13 + --> $DIR/use-keyword.rs:6:13 | LL | use self as A; | ^^^^^^^^^ error[E0432]: unresolved import `super` - --> $DIR/use-keyword.rs:18:13 + --> $DIR/use-keyword.rs:8:13 | LL | use super as B; | ^^^^^^^^^^ no `super` in the root error[E0432]: unresolved import `super` - --> $DIR/use-keyword.rs:21:21 + --> $DIR/use-keyword.rs:11:21 | LL | use super::{self as C}; | ^^^^^^^^^ no `super` in the root diff --git a/src/test/ui/use/use-meta-mismatch.rs b/src/test/ui/use/use-meta-mismatch.rs index 6b7b9c89149..459216a17e4 100644 --- a/src/test/ui/use/use-meta-mismatch.rs +++ b/src/test/ui/use/use-meta-mismatch.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern:can't find crate for `extra` extern crate fake_crate as extra; diff --git a/src/test/ui/use/use-meta-mismatch.stderr b/src/test/ui/use/use-meta-mismatch.stderr index 063de29510e..877ac464de7 100644 --- a/src/test/ui/use/use-meta-mismatch.stderr +++ b/src/test/ui/use/use-meta-mismatch.stderr @@ -1,5 +1,5 @@ error[E0463]: can't find crate for `extra` - --> $DIR/use-meta-mismatch.rs:13:1 + --> $DIR/use-meta-mismatch.rs:3:1 | LL | extern crate fake_crate as extra; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate diff --git a/src/test/ui/use/use-mod.rs b/src/test/ui/use/use-mod.rs index 37495cd1724..87064c6a42b 100644 --- a/src/test/ui/use/use-mod.rs +++ b/src/test/ui/use/use-mod.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use foo::bar::{ self, //~^ ERROR `self` import can only appear once in an import list diff --git a/src/test/ui/use/use-mod.stderr b/src/test/ui/use/use-mod.stderr index adef47ac8fb..9ab873b3598 100644 --- a/src/test/ui/use/use-mod.stderr +++ b/src/test/ui/use/use-mod.stderr @@ -1,5 +1,5 @@ error[E0430]: `self` import can only appear once in an import list - --> $DIR/use-mod.rs:12:5 + --> $DIR/use-mod.rs:2:5 | LL | self, | ^^^^ can only appear once in an import list @@ -8,13 +8,13 @@ LL | self | ---- another `self` import appears here error[E0431]: `self` import can only appear in an import list with a non-empty prefix - --> $DIR/use-mod.rs:19:6 + --> $DIR/use-mod.rs:9:6 | LL | use {self}; | ^^^^ can only appear in an import list with a non-empty prefix error[E0252]: the name `bar` is defined multiple times - --> $DIR/use-mod.rs:15:5 + --> $DIR/use-mod.rs:5:5 | LL | self, | ---- previous import of the module `bar` here diff --git a/src/test/ui/use/use-mod/use-mod-2.rs b/src/test/ui/use/use-mod/use-mod-2.rs index 5f8842a521a..9373a62ba36 100644 --- a/src/test/ui/use/use-mod/use-mod-2.rs +++ b/src/test/ui/use/use-mod/use-mod-2.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod foo { use self::{self}; //~^ ERROR unresolved import `self` [E0432] diff --git a/src/test/ui/use/use-mod/use-mod-2.stderr b/src/test/ui/use/use-mod/use-mod-2.stderr index f343dc2b31d..84376784977 100644 --- a/src/test/ui/use/use-mod/use-mod-2.stderr +++ b/src/test/ui/use/use-mod/use-mod-2.stderr @@ -1,11 +1,11 @@ error[E0432]: unresolved import `self` - --> $DIR/use-mod-2.rs:12:16 + --> $DIR/use-mod-2.rs:2:16 | LL | use self::{self}; | ^^^^ no `self` in the root error[E0432]: unresolved import `super` - --> $DIR/use-mod-2.rs:16:17 + --> $DIR/use-mod-2.rs:6:17 | LL | use super::{self}; | ^^^^ no `super` in the root diff --git a/src/test/ui/use/use-mod/use-mod-3.rs b/src/test/ui/use/use-mod/use-mod-3.rs index 2ef5fe7947e..0afa486b9f7 100644 --- a/src/test/ui/use/use-mod/use-mod-3.rs +++ b/src/test/ui/use/use-mod/use-mod-3.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use foo::bar::{ //~ ERROR module `bar` is private self }; diff --git a/src/test/ui/use/use-mod/use-mod-3.stderr b/src/test/ui/use/use-mod/use-mod-3.stderr index 9284091dfa8..c644ec752f9 100644 --- a/src/test/ui/use/use-mod/use-mod-3.stderr +++ b/src/test/ui/use/use-mod/use-mod-3.stderr @@ -1,11 +1,11 @@ error[E0603]: module `bar` is private - --> $DIR/use-mod-3.rs:11:10 + --> $DIR/use-mod-3.rs:1:10 | LL | use foo::bar::{ //~ ERROR module `bar` is private | ^^^ error[E0603]: module `bar` is private - --> $DIR/use-mod-3.rs:14:10 + --> $DIR/use-mod-3.rs:4:10 | LL | use foo::bar::{ //~ ERROR module `bar` is private | ^^^ diff --git a/src/test/ui/use/use-mod/use-mod-4.rs b/src/test/ui/use/use-mod/use-mod-4.rs index 275e5ff1da6..46ae8ddadc0 100644 --- a/src/test/ui/use/use-mod/use-mod-4.rs +++ b/src/test/ui/use/use-mod/use-mod-4.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use foo::self; //~ ERROR unresolved import `foo` //~^ ERROR `self` imports are only allowed within a { } list diff --git a/src/test/ui/use/use-mod/use-mod-4.stderr b/src/test/ui/use/use-mod/use-mod-4.stderr index 33366b2457b..fc0f8952c47 100644 --- a/src/test/ui/use/use-mod/use-mod-4.stderr +++ b/src/test/ui/use/use-mod/use-mod-4.stderr @@ -1,17 +1,17 @@ error[E0429]: `self` imports are only allowed within a { } list - --> $DIR/use-mod-4.rs:11:5 + --> $DIR/use-mod-4.rs:1:5 | LL | use foo::self; //~ ERROR unresolved import `foo` | ^^^^^^^^^ error[E0429]: `self` imports are only allowed within a { } list - --> $DIR/use-mod-4.rs:14:5 + --> $DIR/use-mod-4.rs:4:5 | LL | use std::mem::self; | ^^^^^^^^^^^^^^ error[E0432]: unresolved import `foo` - --> $DIR/use-mod-4.rs:11:5 + --> $DIR/use-mod-4.rs:1:5 | LL | use foo::self; //~ ERROR unresolved import `foo` | ^^^ maybe a missing `extern crate foo;`? diff --git a/src/test/ui/use/use-nested-groups-error.rs b/src/test/ui/use/use-nested-groups-error.rs index 0a68d34ade9..d8b189d1961 100644 --- a/src/test/ui/use/use-nested-groups-error.rs +++ b/src/test/ui/use/use-nested-groups-error.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - mod a { pub mod b1 { pub enum C2 {} diff --git a/src/test/ui/use/use-nested-groups-error.stderr b/src/test/ui/use/use-nested-groups-error.stderr index 5e0fd503bc2..9d6fd9df6cb 100644 --- a/src/test/ui/use/use-nested-groups-error.stderr +++ b/src/test/ui/use/use-nested-groups-error.stderr @@ -1,5 +1,5 @@ error[E0432]: unresolved import `a::b1::C1` - --> $DIR/use-nested-groups-error.rs:19:14 + --> $DIR/use-nested-groups-error.rs:9:14 | LL | use a::{b1::{C1, C2}, B2}; | ^^ no `C1` in `a::b1`. Did you mean to use `C2`? diff --git a/src/test/ui/use/use-nested-groups-unused-imports.rs b/src/test/ui/use/use-nested-groups-unused-imports.rs index ddbf54fdd48..5bdc7b2c03f 100644 --- a/src/test/ui/use/use-nested-groups-unused-imports.rs +++ b/src/test/ui/use/use-nested-groups-unused-imports.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(use_nested_groups)] #![allow(dead_code)] #![deny(unused_imports)] diff --git a/src/test/ui/use/use-nested-groups-unused-imports.stderr b/src/test/ui/use/use-nested-groups-unused-imports.stderr index e339664f374..f60c7f50237 100644 --- a/src/test/ui/use/use-nested-groups-unused-imports.stderr +++ b/src/test/ui/use/use-nested-groups-unused-imports.stderr @@ -1,23 +1,23 @@ error: unused imports: `*`, `Foo`, `baz::{}`, `foobar::*` - --> $DIR/use-nested-groups-unused-imports.rs:26:11 + --> $DIR/use-nested-groups-unused-imports.rs:16:11 | LL | use foo::{Foo, bar::{baz::{}, foobar::*}, *}; | ^^^ ^^^^^^^ ^^^^^^^^^ ^ | note: lint level defined here - --> $DIR/use-nested-groups-unused-imports.rs:13:9 + --> $DIR/use-nested-groups-unused-imports.rs:3:9 | LL | #![deny(unused_imports)] | ^^^^^^^^^^^^^^ error: unused import: `*` - --> $DIR/use-nested-groups-unused-imports.rs:28:24 + --> $DIR/use-nested-groups-unused-imports.rs:18:24 | LL | use foo::bar::baz::{*, *}; | ^ error: unused import: `use foo::{};` - --> $DIR/use-nested-groups-unused-imports.rs:30:1 + --> $DIR/use-nested-groups-unused-imports.rs:20:1 | LL | use foo::{}; | ^^^^^^^^^^^^ diff --git a/src/test/ui/use/use-paths-as-items.rs b/src/test/ui/use/use-paths-as-items.rs index db69bb33ae2..7b5eb56b18f 100644 --- a/src/test/ui/use/use-paths-as-items.rs +++ b/src/test/ui/use/use-paths-as-items.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Each path node in a `use` declaration must be treated as an item. If not, the following code // will trigger an ICE. // diff --git a/src/test/ui/use/use-paths-as-items.stderr b/src/test/ui/use/use-paths-as-items.stderr index 56db03fd163..5bcdf937d56 100644 --- a/src/test/ui/use/use-paths-as-items.stderr +++ b/src/test/ui/use/use-paths-as-items.stderr @@ -1,5 +1,5 @@ error[E0252]: the name `mem` is defined multiple times - --> $DIR/use-paths-as-items.rs:17:5 + --> $DIR/use-paths-as-items.rs:7:5 | LL | use std::{mem, ptr}; | --- previous import of the module `mem` here diff --git a/src/test/ui/use/use-self-type.rs b/src/test/ui/use/use-self-type.rs index 1b49d358261..3e5c7bf3cca 100644 --- a/src/test/ui/use/use-self-type.rs +++ b/src/test/ui/use/use-self-type.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct S; impl S { diff --git a/src/test/ui/use/use-self-type.stderr b/src/test/ui/use/use-self-type.stderr index e4cb0f9f3d8..50b4cdf357d 100644 --- a/src/test/ui/use/use-self-type.stderr +++ b/src/test/ui/use/use-self-type.stderr @@ -1,11 +1,11 @@ error[E0433]: failed to resolve: use of undeclared type or module `Self` - --> $DIR/use-self-type.rs:17:16 + --> $DIR/use-self-type.rs:7:16 | LL | pub(in Self::f) struct Z; //~ ERROR use of undeclared type or module `Self` | ^^^^ use of undeclared type or module `Self` error[E0432]: unresolved import `Self` - --> $DIR/use-self-type.rs:16:13 + --> $DIR/use-self-type.rs:6:13 | LL | use Self::f; //~ ERROR unresolved import | ^^^^ use of undeclared type or module `Self` diff --git a/src/test/ui/use/use-super-global-path.rs b/src/test/ui/use/use-super-global-path.rs index fc1a72f6f2b..3e0ebccc0a0 100644 --- a/src/test/ui/use/use-super-global-path.rs +++ b/src/test/ui/use/use-super-global-path.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused)] struct S; diff --git a/src/test/ui/use/use-super-global-path.stderr b/src/test/ui/use/use-super-global-path.stderr index fc4455c7d6e..ee7deb264df 100644 --- a/src/test/ui/use/use-super-global-path.stderr +++ b/src/test/ui/use/use-super-global-path.stderr @@ -1,17 +1,17 @@ error[E0433]: failed to resolve: global paths cannot start with `super` - --> $DIR/use-super-global-path.rs:17:11 + --> $DIR/use-super-global-path.rs:7:11 | LL | use ::super::{S, Z}; //~ ERROR global paths cannot start with `super` | ^^^^^ global paths cannot start with `super` error[E0433]: failed to resolve: global paths cannot start with `super` - --> $DIR/use-super-global-path.rs:20:15 + --> $DIR/use-super-global-path.rs:10:15 | LL | use ::super::main; //~ ERROR global paths cannot start with `super` | ^^^^^ global paths cannot start with `super` error[E0425]: cannot find function `main` in this scope - --> $DIR/use-super-global-path.rs:21:9 + --> $DIR/use-super-global-path.rs:11:9 | LL | main(); //~ ERROR cannot find function `main` in this scope | ^^^^ not found in this scope diff --git a/src/test/ui/used.rs b/src/test/ui/used.rs index b3ed8601988..f008724f428 100644 --- a/src/test/ui/used.rs +++ b/src/test/ui/used.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[used] static FOO: u32 = 0; // OK diff --git a/src/test/ui/used.stderr b/src/test/ui/used.stderr index 351fb940426..c998e27c531 100644 --- a/src/test/ui/used.stderr +++ b/src/test/ui/used.stderr @@ -1,23 +1,23 @@ error: attribute must be applied to a `static` variable - --> $DIR/used.rs:14:1 + --> $DIR/used.rs:4:1 | LL | #[used] //~ ERROR attribute must be applied to a `static` variable | ^^^^^^^ error: attribute must be applied to a `static` variable - --> $DIR/used.rs:17:1 + --> $DIR/used.rs:7:1 | LL | #[used] //~ ERROR attribute must be applied to a `static` variable | ^^^^^^^ error: attribute must be applied to a `static` variable - --> $DIR/used.rs:20:1 + --> $DIR/used.rs:10:1 | LL | #[used] //~ ERROR attribute must be applied to a `static` variable | ^^^^^^^ error: attribute must be applied to a `static` variable - --> $DIR/used.rs:23:1 + --> $DIR/used.rs:13:1 | LL | #[used] //~ ERROR attribute must be applied to a `static` variable | ^^^^^^^ diff --git a/src/test/ui/useless-pub.rs b/src/test/ui/useless-pub.rs index 064062df753..fde7cd5d89d 100644 --- a/src/test/ui/useless-pub.rs +++ b/src/test/ui/useless-pub.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct A { pub i: isize } pub trait E { diff --git a/src/test/ui/useless-pub.stderr b/src/test/ui/useless-pub.stderr index 7e36bf2667e..5bca980f21e 100644 --- a/src/test/ui/useless-pub.stderr +++ b/src/test/ui/useless-pub.stderr @@ -1,17 +1,17 @@ error[E0449]: unnecessary visibility qualifier - --> $DIR/useless-pub.rs:18:5 + --> $DIR/useless-pub.rs:8:5 | LL | pub fn foo(&self) {} //~ ERROR: unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/useless-pub.rs:22:10 + --> $DIR/useless-pub.rs:12:10 | LL | V1 { pub f: i32 }, //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier - --> $DIR/useless-pub.rs:23:8 + --> $DIR/useless-pub.rs:13:8 | LL | V2(pub i32), //~ ERROR unnecessary visibility qualifier | ^^^ `pub` not permitted here because it's implied diff --git a/src/test/ui/useless_comment.rs b/src/test/ui/useless_comment.rs index 645514971da..531eec007fc 100644 --- a/src/test/ui/useless_comment.rs +++ b/src/test/ui/useless_comment.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(unused_doc_comments)] fn foo() { diff --git a/src/test/ui/useless_comment.stderr b/src/test/ui/useless_comment.stderr index 78c6787c88e..cc818f6ce7c 100644 --- a/src/test/ui/useless_comment.stderr +++ b/src/test/ui/useless_comment.stderr @@ -1,29 +1,29 @@ error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:14:5 + --> $DIR/useless_comment.rs:4:5 | LL | /// a //~ ERROR doc comment not used by rustdoc | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/useless_comment.rs:11:9 + --> $DIR/useless_comment.rs:1:9 | LL | #![deny(unused_doc_comments)] | ^^^^^^^^^^^^^^^^^^^ error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:17:5 + --> $DIR/useless_comment.rs:7:5 | LL | /// b //~ doc comment not used by rustdoc | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:19:9 + --> $DIR/useless_comment.rs:9:9 | LL | /// c //~ ERROR doc comment not used by rustdoc | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:24:5 + --> $DIR/useless_comment.rs:14:5 | LL | /// foo //~ ERROR doc comment not used by rustdoc | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/user-defined-macro-rules.rs b/src/test/ui/user-defined-macro-rules.rs index fe76d58f1ef..31bfdd025d9 100644 --- a/src/test/ui/user-defined-macro-rules.rs +++ b/src/test/ui/user-defined-macro-rules.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(unused_macros)] macro_rules! macro_rules { () => {} } //~ ERROR user-defined macros may not be named `macro_rules` diff --git a/src/test/ui/user-defined-macro-rules.stderr b/src/test/ui/user-defined-macro-rules.stderr index 1f8b18166c9..a2d7b171a73 100644 --- a/src/test/ui/user-defined-macro-rules.stderr +++ b/src/test/ui/user-defined-macro-rules.stderr @@ -1,5 +1,5 @@ error: user-defined macros may not be named `macro_rules` - --> $DIR/user-defined-macro-rules.rs:13:1 + --> $DIR/user-defined-macro-rules.rs:3:1 | LL | macro_rules! macro_rules { () => {} } //~ ERROR user-defined macros may not be named `macro_rules` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/utf8_idents.rs b/src/test/ui/utf8_idents.rs index 8594c35f8dd..e601c6e4555 100644 --- a/src/test/ui/utf8_idents.rs +++ b/src/test/ui/utf8_idents.rs @@ -1,17 +1,9 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. // fn foo< 'β, //~ ERROR non-ascii idents are not fully supported γ //~ ERROR non-ascii idents are not fully supported + //~^ WARN type parameter `γ` should have a camel case name >() {} struct X { diff --git a/src/test/ui/utf8_idents.stderr b/src/test/ui/utf8_idents.stderr index 42ee13e0511..268dd99d060 100644 --- a/src/test/ui/utf8_idents.stderr +++ b/src/test/ui/utf8_idents.stderr @@ -1,35 +1,43 @@ -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/utf8_idents.rs:13:5 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/utf8_idents.rs:4:5 | LL | 'β, //~ ERROR non-ascii idents are not fully supported | ^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/utf8_idents.rs:14:5 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/utf8_idents.rs:5:5 | LL | γ //~ ERROR non-ascii idents are not fully supported | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/utf8_idents.rs:18:5 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/utf8_idents.rs:10:5 | LL | δ: usize //~ ERROR non-ascii idents are not fully supported | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -error[E0658]: non-ascii idents are not fully supported. (see issue #28979) - --> $DIR/utf8_idents.rs:22:9 +error[E0658]: non-ascii idents are not fully supported. (see issue #55467) + --> $DIR/utf8_idents.rs:14:9 | LL | let α = 0.00001f64; //~ ERROR non-ascii idents are not fully supported | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable +warning: type parameter `γ` should have a camel case name + --> $DIR/utf8_idents.rs:5:5 + | +LL | γ //~ ERROR non-ascii idents are not fully supported + | ^ help: convert the identifier to camel case: `Γ` + | + = note: #[warn(non_camel_case_types)] on by default + error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/variadic/variadic-ffi-2.rs b/src/test/ui/variadic/variadic-ffi-2.rs index a5011c3abe7..224ac16f458 100644 --- a/src/test/ui/variadic/variadic-ffi-2.rs +++ b/src/test/ui/variadic/variadic-ffi-2.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-arm stdcall isn't supported fn baz(f: extern "stdcall" fn(usize, ...)) { diff --git a/src/test/ui/variadic/variadic-ffi-2.stderr b/src/test/ui/variadic/variadic-ffi-2.stderr index 9af7b5bf753..cb2a9f874b7 100644 --- a/src/test/ui/variadic/variadic-ffi-2.stderr +++ b/src/test/ui/variadic/variadic-ffi-2.stderr @@ -1,5 +1,5 @@ error[E0045]: variadic function must have C or cdecl calling convention - --> $DIR/variadic-ffi-2.rs:13:11 + --> $DIR/variadic-ffi-2.rs:3:11 | LL | fn baz(f: extern "stdcall" fn(usize, ...)) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention diff --git a/src/test/ui/variadic/variadic-ffi-3.rs b/src/test/ui/variadic/variadic-ffi-3.rs index 9807952c636..12b3426d9da 100644 --- a/src/test/ui/variadic/variadic-ffi-3.rs +++ b/src/test/ui/variadic/variadic-ffi-3.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern { fn foo(f: isize, x: u8, ...); //~^ defined here diff --git a/src/test/ui/variadic/variadic-ffi-3.stderr b/src/test/ui/variadic/variadic-ffi-3.stderr index c7355405b2a..0fecbbf36b8 100644 --- a/src/test/ui/variadic/variadic-ffi-3.stderr +++ b/src/test/ui/variadic/variadic-ffi-3.stderr @@ -1,5 +1,5 @@ error[E0060]: this function takes at least 2 parameters but 0 parameters were supplied - --> $DIR/variadic-ffi-3.rs:21:9 + --> $DIR/variadic-ffi-3.rs:11:9 | LL | fn foo(f: isize, x: u8, ...); | ----------------------------- defined here @@ -8,7 +8,7 @@ LL | foo(); //~ ERROR: this function takes at least 2 parameters but 0 p | ^^^^^ expected at least 2 parameters error[E0060]: this function takes at least 2 parameters but 1 parameter was supplied - --> $DIR/variadic-ffi-3.rs:22:9 + --> $DIR/variadic-ffi-3.rs:12:9 | LL | fn foo(f: isize, x: u8, ...); | ----------------------------- defined here @@ -17,7 +17,7 @@ LL | foo(1); //~ ERROR: this function takes at least 2 parameters but 1 | ^^^^^^ expected at least 2 parameters error[E0308]: mismatched types - --> $DIR/variadic-ffi-3.rs:24:56 + --> $DIR/variadic-ffi-3.rs:14:56 | LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; | ^^^ expected non-variadic fn, found variadic function @@ -26,7 +26,7 @@ LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; found type `unsafe extern "C" fn(isize, u8, ...) {foo}` error[E0308]: mismatched types - --> $DIR/variadic-ffi-3.rs:29:54 + --> $DIR/variadic-ffi-3.rs:19:54 | LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; | ^^^ expected variadic fn, found non-variadic function @@ -35,37 +35,37 @@ LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; found type `extern "C" fn(isize, u8) {bar}` error[E0617]: can't pass `f32` to variadic function - --> $DIR/variadic-ffi-3.rs:34:19 + --> $DIR/variadic-ffi-3.rs:24:19 | LL | foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function | ^^^^ help: cast the value to `c_double`: `3f32 as c_double` error[E0617]: can't pass `bool` to variadic function - --> $DIR/variadic-ffi-3.rs:35:19 + --> $DIR/variadic-ffi-3.rs:25:19 | LL | foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function | ^^^^ help: cast the value to `c_int`: `true as c_int` error[E0617]: can't pass `i8` to variadic function - --> $DIR/variadic-ffi-3.rs:36:19 + --> $DIR/variadic-ffi-3.rs:26:19 | LL | foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function | ^^^ help: cast the value to `c_int`: `1i8 as c_int` error[E0617]: can't pass `u8` to variadic function - --> $DIR/variadic-ffi-3.rs:37:19 + --> $DIR/variadic-ffi-3.rs:27:19 | LL | foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function | ^^^ help: cast the value to `c_uint`: `1u8 as c_uint` error[E0617]: can't pass `i16` to variadic function - --> $DIR/variadic-ffi-3.rs:38:19 + --> $DIR/variadic-ffi-3.rs:28:19 | LL | foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function | ^^^^ help: cast the value to `c_int`: `1i16 as c_int` error[E0617]: can't pass `u16` to variadic function - --> $DIR/variadic-ffi-3.rs:39:19 + --> $DIR/variadic-ffi-3.rs:29:19 | LL | foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function | ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint` diff --git a/src/test/ui/variadic/variadic-ffi.rs b/src/test/ui/variadic/variadic-ffi.rs index d81e61cac56..61b2ad4bed5 100644 --- a/src/test/ui/variadic/variadic-ffi.rs +++ b/src/test/ui/variadic/variadic-ffi.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // ignore-arm stdcall isn't supported // ignore-aarch64 stdcall isn't supported diff --git a/src/test/ui/variadic/variadic-ffi.stderr b/src/test/ui/variadic/variadic-ffi.stderr index 0d0462b709d..617b1f46ea3 100644 --- a/src/test/ui/variadic/variadic-ffi.stderr +++ b/src/test/ui/variadic/variadic-ffi.stderr @@ -1,5 +1,5 @@ error[E0045]: variadic function must have C or cdecl calling convention - --> $DIR/variadic-ffi.rs:15:5 + --> $DIR/variadic-ffi.rs:5:5 | LL | fn printf(_: *const u8, ...); //~ ERROR: variadic function must have C or cdecl calling | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention diff --git a/src/test/ui/variance/variance-associated-types.rs b/src/test/ui/variance/variance-associated-types.rs index 7dbfc6ac125..1165fb53c73 100644 --- a/src/test/ui/variance/variance-associated-types.rs +++ b/src/test/ui/variance/variance-associated-types.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that the variance computation considers types/regions that // appear in projections to be invariant. diff --git a/src/test/ui/variance/variance-associated-types.stderr b/src/test/ui/variance/variance-associated-types.stderr index 03ea1e625f8..75ebc866898 100644 --- a/src/test/ui/variance/variance-associated-types.stderr +++ b/src/test/ui/variance/variance-associated-types.stderr @@ -1,5 +1,5 @@ error[E0208]: [-, +] - --> $DIR/variance-associated-types.rs:23:1 + --> $DIR/variance-associated-types.rs:13:1 | LL | / struct Foo<'a, T : Trait<'a>> { //~ ERROR [-, +] LL | | field: (T, &'a ()) @@ -7,7 +7,7 @@ LL | | } | |_^ error[E0208]: [o, o] - --> $DIR/variance-associated-types.rs:28:1 + --> $DIR/variance-associated-types.rs:18:1 | LL | / struct Bar<'a, T : Trait<'a>> { //~ ERROR [o, o] LL | | field: >::Type diff --git a/src/test/ui/variance/variance-btree-invariant-types.rs b/src/test/ui/variance/variance-btree-invariant-types.rs index 59fc0136612..2e5dc671db8 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.rs +++ b/src/test/ui/variance/variance-btree-invariant-types.rs @@ -1,15 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - - use std::collections::btree_map::{IterMut, OccupiedEntry, VacantEntry}; fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> { diff --git a/src/test/ui/variance/variance-btree-invariant-types.stderr b/src/test/ui/variance/variance-btree-invariant-types.stderr index 96f76fa5c2d..0d8b4dddc68 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.stderr +++ b/src/test/ui/variance/variance-btree-invariant-types.stderr @@ -1,178 +1,178 @@ error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:16:5 + --> $DIR/variance-btree-invariant-types.rs:4:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::IterMut<'_, &'new (), _>` found type `std::collections::btree_map::IterMut<'_, &'static (), _>` -note: the lifetime 'new as defined on the function body at 15:21... - --> $DIR/variance-btree-invariant-types.rs:15:21 +note: the lifetime 'new as defined on the function body at 3:21... + --> $DIR/variance-btree-invariant-types.rs:3:21 | LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> { | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:19:5 + --> $DIR/variance-btree-invariant-types.rs:7:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::IterMut<'_, _, &'new ()>` found type `std::collections::btree_map::IterMut<'_, _, &'static ()>` -note: the lifetime 'new as defined on the function body at 18:21... - --> $DIR/variance-btree-invariant-types.rs:18:21 +note: the lifetime 'new as defined on the function body at 6:21... + --> $DIR/variance-btree-invariant-types.rs:6:21 | LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> { | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:22:5 + --> $DIR/variance-btree-invariant-types.rs:10:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::IterMut<'_, &'static (), _>` found type `std::collections::btree_map::IterMut<'_, &'new (), _>` -note: the lifetime 'new as defined on the function body at 21:24... - --> $DIR/variance-btree-invariant-types.rs:21:24 +note: the lifetime 'new as defined on the function body at 9:24... + --> $DIR/variance-btree-invariant-types.rs:9:24 | LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> { | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:25:5 + --> $DIR/variance-btree-invariant-types.rs:13:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::IterMut<'_, _, &'static ()>` found type `std::collections::btree_map::IterMut<'_, _, &'new ()>` -note: the lifetime 'new as defined on the function body at 24:24... - --> $DIR/variance-btree-invariant-types.rs:24:24 +note: the lifetime 'new as defined on the function body at 12:24... + --> $DIR/variance-btree-invariant-types.rs:12:24 | LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> { | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:30:5 + --> $DIR/variance-btree-invariant-types.rs:18:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>` found type `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>` -note: the lifetime 'new as defined on the function body at 28:20... - --> $DIR/variance-btree-invariant-types.rs:28:20 +note: the lifetime 'new as defined on the function body at 16:20... + --> $DIR/variance-btree-invariant-types.rs:16:20 | LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:34:5 + --> $DIR/variance-btree-invariant-types.rs:22:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>` found type `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>` -note: the lifetime 'new as defined on the function body at 32:20... - --> $DIR/variance-btree-invariant-types.rs:32:20 +note: the lifetime 'new as defined on the function body at 20:20... + --> $DIR/variance-btree-invariant-types.rs:20:20 | LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:38:5 + --> $DIR/variance-btree-invariant-types.rs:26:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>` found type `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>` -note: the lifetime 'new as defined on the function body at 36:23... - --> $DIR/variance-btree-invariant-types.rs:36:23 +note: the lifetime 'new as defined on the function body at 24:23... + --> $DIR/variance-btree-invariant-types.rs:24:23 | LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:42:5 + --> $DIR/variance-btree-invariant-types.rs:30:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>` found type `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>` -note: the lifetime 'new as defined on the function body at 40:23... - --> $DIR/variance-btree-invariant-types.rs:40:23 +note: the lifetime 'new as defined on the function body at 28:23... + --> $DIR/variance-btree-invariant-types.rs:28:23 | LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:47:5 + --> $DIR/variance-btree-invariant-types.rs:35:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::VacantEntry<'_, &'new (), _>` found type `std::collections::btree_map::VacantEntry<'_, &'static (), _>` -note: the lifetime 'new as defined on the function body at 45:20... - --> $DIR/variance-btree-invariant-types.rs:45:20 +note: the lifetime 'new as defined on the function body at 33:20... + --> $DIR/variance-btree-invariant-types.rs:33:20 | LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:51:5 + --> $DIR/variance-btree-invariant-types.rs:39:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::VacantEntry<'_, _, &'new ()>` found type `std::collections::btree_map::VacantEntry<'_, _, &'static ()>` -note: the lifetime 'new as defined on the function body at 49:20... - --> $DIR/variance-btree-invariant-types.rs:49:20 +note: the lifetime 'new as defined on the function body at 37:20... + --> $DIR/variance-btree-invariant-types.rs:37:20 | LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:55:5 + --> $DIR/variance-btree-invariant-types.rs:43:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::VacantEntry<'_, &'static (), _>` found type `std::collections::btree_map::VacantEntry<'_, &'new (), _>` -note: the lifetime 'new as defined on the function body at 53:23... - --> $DIR/variance-btree-invariant-types.rs:53:23 +note: the lifetime 'new as defined on the function body at 41:23... + --> $DIR/variance-btree-invariant-types.rs:41:23 | LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) | ^^^^ = note: ...does not necessarily outlive the static lifetime error[E0308]: mismatched types - --> $DIR/variance-btree-invariant-types.rs:59:5 + --> $DIR/variance-btree-invariant-types.rs:47:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::VacantEntry<'_, _, &'static ()>` found type `std::collections::btree_map::VacantEntry<'_, _, &'new ()>` -note: the lifetime 'new as defined on the function body at 57:23... - --> $DIR/variance-btree-invariant-types.rs:57:23 +note: the lifetime 'new as defined on the function body at 45:23... + --> $DIR/variance-btree-invariant-types.rs:45:23 | LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>) | ^^^^ diff --git a/src/test/ui/variance/variance-cell-is-invariant.rs b/src/test/ui/variance/variance-cell-is-invariant.rs index 1ddbcf4ab84..ff9ad66fb0b 100644 --- a/src/test/ui/variance/variance-cell-is-invariant.rs +++ b/src/test/ui/variance/variance-cell-is-invariant.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that Cell is considered invariant with respect to its // type. diff --git a/src/test/ui/variance/variance-cell-is-invariant.stderr b/src/test/ui/variance/variance-cell-is-invariant.stderr index 86f5c1176d9..ba76c2efec4 100644 --- a/src/test/ui/variance/variance-cell-is-invariant.stderr +++ b/src/test/ui/variance/variance-cell-is-invariant.stderr @@ -1,5 +1,5 @@ error[E0623]: lifetime mismatch - --> $DIR/variance-cell-is-invariant.rs:24:25 + --> $DIR/variance-cell-is-invariant.rs:14:25 | LL | fn use_<'short,'long>(c: Foo<'short>, | ----------- these two types are declared with different lifetimes... diff --git a/src/test/ui/variance/variance-contravariant-arg-object.rs b/src/test/ui/variance/variance-contravariant-arg-object.rs index 1795ac95358..27e5675dcde 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.rs +++ b/src/test/ui/variance/variance-contravariant-arg-object.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Test that even when `T` is only used in contravariant position, it diff --git a/src/test/ui/variance/variance-contravariant-arg-object.stderr b/src/test/ui/variance/variance-contravariant-arg-object.stderr index aeed03733f3..79681c77673 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-object.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched types - --> $DIR/variance-contravariant-arg-object.rs:24:5 + --> $DIR/variance-contravariant-arg-object.rs:14:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `dyn Get<&'min i32>` found type `dyn Get<&'max i32>` -note: the lifetime 'min as defined on the function body at 20:21... - --> $DIR/variance-contravariant-arg-object.rs:20:21 +note: the lifetime 'min as defined on the function body at 10:21... + --> $DIR/variance-contravariant-arg-object.rs:10:21 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 20:27 - --> $DIR/variance-contravariant-arg-object.rs:20:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 10:27 + --> $DIR/variance-contravariant-arg-object.rs:10:27 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-contravariant-arg-object.rs:32:5 + --> $DIR/variance-contravariant-arg-object.rs:22:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `dyn Get<&'max i32>` found type `dyn Get<&'min i32>` -note: the lifetime 'min as defined on the function body at 27:21... - --> $DIR/variance-contravariant-arg-object.rs:27:21 +note: the lifetime 'min as defined on the function body at 17:21... + --> $DIR/variance-contravariant-arg-object.rs:17:21 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 27:27 - --> $DIR/variance-contravariant-arg-object.rs:27:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 17:27 + --> $DIR/variance-contravariant-arg-object.rs:17:27 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.rs b/src/test/ui/variance/variance-contravariant-arg-trait-match.rs index 9b6e3c9de3b..904d93124c9 100644 --- a/src/test/ui/variance/variance-contravariant-arg-trait-match.rs +++ b/src/test/ui/variance/variance-contravariant-arg-trait-match.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Test that even when `T` is only used in contravariant position, it diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr index 2895a9511ea..4c97a5892f1 100644 --- a/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched types - --> $DIR/variance-contravariant-arg-trait-match.rs:23:5 + --> $DIR/variance-contravariant-arg-trait-match.rs:13:5 | LL | impls_get::() //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'min i32>` found type `Get<&'max i32>` -note: the lifetime 'min as defined on the function body at 20:21... - --> $DIR/variance-contravariant-arg-trait-match.rs:20:21 +note: the lifetime 'min as defined on the function body at 10:21... + --> $DIR/variance-contravariant-arg-trait-match.rs:10:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 20:27 - --> $DIR/variance-contravariant-arg-trait-match.rs:20:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 10:27 + --> $DIR/variance-contravariant-arg-trait-match.rs:10:27 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-contravariant-arg-trait-match.rs:31:5 + --> $DIR/variance-contravariant-arg-trait-match.rs:21:5 | LL | impls_get::() //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'max i32>` found type `Get<&'min i32>` -note: the lifetime 'min as defined on the function body at 26:21... - --> $DIR/variance-contravariant-arg-trait-match.rs:26:21 +note: the lifetime 'min as defined on the function body at 16:21... + --> $DIR/variance-contravariant-arg-trait-match.rs:16:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 26:27 - --> $DIR/variance-contravariant-arg-trait-match.rs:26:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 16:27 + --> $DIR/variance-contravariant-arg-trait-match.rs:16:27 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.rs b/src/test/ui/variance/variance-contravariant-self-trait-match.rs index 6d9d1e61fed..e17375841b8 100644 --- a/src/test/ui/variance/variance-contravariant-self-trait-match.rs +++ b/src/test/ui/variance/variance-contravariant-self-trait-match.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Test that even when `Self` is only used in contravariant position, it diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.stderr index bc3f274a861..30a7b02de76 100644 --- a/src/test/ui/variance/variance-contravariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-contravariant-self-trait-match.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched types - --> $DIR/variance-contravariant-self-trait-match.rs:23:5 + --> $DIR/variance-contravariant-self-trait-match.rs:13:5 | LL | impls_get::<&'min G>(); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` found type `Get` -note: the lifetime 'min as defined on the function body at 20:21... - --> $DIR/variance-contravariant-self-trait-match.rs:20:21 +note: the lifetime 'min as defined on the function body at 10:21... + --> $DIR/variance-contravariant-self-trait-match.rs:10:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 20:27 - --> $DIR/variance-contravariant-self-trait-match.rs:20:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 10:27 + --> $DIR/variance-contravariant-self-trait-match.rs:10:27 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-contravariant-self-trait-match.rs:32:5 + --> $DIR/variance-contravariant-self-trait-match.rs:22:5 | LL | impls_get::<&'max G>(); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` found type `Get` -note: the lifetime 'min as defined on the function body at 26:21... - --> $DIR/variance-contravariant-self-trait-match.rs:26:21 +note: the lifetime 'min as defined on the function body at 16:21... + --> $DIR/variance-contravariant-self-trait-match.rs:16:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 26:27 - --> $DIR/variance-contravariant-self-trait-match.rs:26:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 16:27 + --> $DIR/variance-contravariant-self-trait-match.rs:16:27 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ diff --git a/src/test/ui/variance/variance-covariant-arg-object.rs b/src/test/ui/variance/variance-covariant-arg-object.rs index ad059a467f5..4b371841654 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.rs +++ b/src/test/ui/variance/variance-covariant-arg-object.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Test that even when `T` is only used in covariant position, it diff --git a/src/test/ui/variance/variance-covariant-arg-object.stderr b/src/test/ui/variance/variance-covariant-arg-object.stderr index 074ef658419..afdcccd2119 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.stderr +++ b/src/test/ui/variance/variance-covariant-arg-object.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched types - --> $DIR/variance-covariant-arg-object.rs:25:5 + --> $DIR/variance-covariant-arg-object.rs:15:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `dyn Get<&'min i32>` found type `dyn Get<&'max i32>` -note: the lifetime 'min as defined on the function body at 20:21... - --> $DIR/variance-covariant-arg-object.rs:20:21 +note: the lifetime 'min as defined on the function body at 10:21... + --> $DIR/variance-covariant-arg-object.rs:10:21 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 20:27 - --> $DIR/variance-covariant-arg-object.rs:20:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 10:27 + --> $DIR/variance-covariant-arg-object.rs:10:27 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-covariant-arg-object.rs:32:5 + --> $DIR/variance-covariant-arg-object.rs:22:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `dyn Get<&'max i32>` found type `dyn Get<&'min i32>` -note: the lifetime 'min as defined on the function body at 28:21... - --> $DIR/variance-covariant-arg-object.rs:28:21 +note: the lifetime 'min as defined on the function body at 18:21... + --> $DIR/variance-covariant-arg-object.rs:18:21 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 28:27 - --> $DIR/variance-covariant-arg-object.rs:28:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 18:27 + --> $DIR/variance-covariant-arg-object.rs:18:27 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.rs b/src/test/ui/variance/variance-covariant-arg-trait-match.rs index c42a845b3b5..2d4f0ea1582 100644 --- a/src/test/ui/variance/variance-covariant-arg-trait-match.rs +++ b/src/test/ui/variance/variance-covariant-arg-trait-match.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Test that even when `T` is only used in covariant position, it diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.stderr index 7692a6646f2..3c1f43943a0 100644 --- a/src/test/ui/variance/variance-covariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-covariant-arg-trait-match.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched types - --> $DIR/variance-covariant-arg-trait-match.rs:24:5 + --> $DIR/variance-covariant-arg-trait-match.rs:14:5 | LL | impls_get::() //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'min i32>` found type `Get<&'max i32>` -note: the lifetime 'min as defined on the function body at 20:21... - --> $DIR/variance-covariant-arg-trait-match.rs:20:21 +note: the lifetime 'min as defined on the function body at 10:21... + --> $DIR/variance-covariant-arg-trait-match.rs:10:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 20:27 - --> $DIR/variance-covariant-arg-trait-match.rs:20:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 10:27 + --> $DIR/variance-covariant-arg-trait-match.rs:10:27 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-covariant-arg-trait-match.rs:30:5 + --> $DIR/variance-covariant-arg-trait-match.rs:20:5 | LL | impls_get::() //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'max i32>` found type `Get<&'min i32>` -note: the lifetime 'min as defined on the function body at 27:21... - --> $DIR/variance-covariant-arg-trait-match.rs:27:21 +note: the lifetime 'min as defined on the function body at 17:21... + --> $DIR/variance-covariant-arg-trait-match.rs:17:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 27:27 - --> $DIR/variance-covariant-arg-trait-match.rs:27:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 17:27 + --> $DIR/variance-covariant-arg-trait-match.rs:17:27 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.rs b/src/test/ui/variance/variance-covariant-self-trait-match.rs index 25148dfc020..e86a5fc630b 100644 --- a/src/test/ui/variance/variance-covariant-self-trait-match.rs +++ b/src/test/ui/variance/variance-covariant-self-trait-match.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Test that even when `Self` is only used in covariant position, it diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.stderr index aa82b69bbbc..c3a15662f72 100644 --- a/src/test/ui/variance/variance-covariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-covariant-self-trait-match.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched types - --> $DIR/variance-covariant-self-trait-match.rs:24:5 + --> $DIR/variance-covariant-self-trait-match.rs:14:5 | LL | impls_get::<&'min G>(); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` found type `Get` -note: the lifetime 'min as defined on the function body at 20:21... - --> $DIR/variance-covariant-self-trait-match.rs:20:21 +note: the lifetime 'min as defined on the function body at 10:21... + --> $DIR/variance-covariant-self-trait-match.rs:10:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 20:27 - --> $DIR/variance-covariant-self-trait-match.rs:20:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 10:27 + --> $DIR/variance-covariant-self-trait-match.rs:10:27 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-covariant-self-trait-match.rs:30:5 + --> $DIR/variance-covariant-self-trait-match.rs:20:5 | LL | impls_get::<&'max G>(); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` found type `Get` -note: the lifetime 'min as defined on the function body at 27:21... - --> $DIR/variance-covariant-self-trait-match.rs:27:21 +note: the lifetime 'min as defined on the function body at 17:21... + --> $DIR/variance-covariant-self-trait-match.rs:17:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 27:27 - --> $DIR/variance-covariant-self-trait-match.rs:27:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 17:27 + --> $DIR/variance-covariant-self-trait-match.rs:17:27 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ diff --git a/src/test/ui/variance/variance-invariant-arg-object.rs b/src/test/ui/variance/variance-invariant-arg-object.rs index 9edb510b826..91f5982e533 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.rs +++ b/src/test/ui/variance/variance-invariant-arg-object.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] trait Get : 'static { diff --git a/src/test/ui/variance/variance-invariant-arg-object.stderr b/src/test/ui/variance/variance-invariant-arg-object.stderr index 3283ae67e51..b0dddd6ed49 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.stderr +++ b/src/test/ui/variance/variance-invariant-arg-object.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched types - --> $DIR/variance-invariant-arg-object.rs:21:5 + --> $DIR/variance-invariant-arg-object.rs:11:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `dyn Get<&'min i32>` found type `dyn Get<&'max i32>` -note: the lifetime 'min as defined on the function body at 17:21... - --> $DIR/variance-invariant-arg-object.rs:17:21 +note: the lifetime 'min as defined on the function body at 7:21... + --> $DIR/variance-invariant-arg-object.rs:7:21 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 17:27 - --> $DIR/variance-invariant-arg-object.rs:17:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 7:27 + --> $DIR/variance-invariant-arg-object.rs:7:27 | LL | fn get_min_from_max<'min, 'max>(v: Box>) | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-invariant-arg-object.rs:28:5 + --> $DIR/variance-invariant-arg-object.rs:18:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `dyn Get<&'max i32>` found type `dyn Get<&'min i32>` -note: the lifetime 'min as defined on the function body at 24:21... - --> $DIR/variance-invariant-arg-object.rs:24:21 +note: the lifetime 'min as defined on the function body at 14:21... + --> $DIR/variance-invariant-arg-object.rs:14:21 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 24:27 - --> $DIR/variance-invariant-arg-object.rs:24:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 14:27 + --> $DIR/variance-invariant-arg-object.rs:14:27 | LL | fn get_max_from_min<'min, 'max, G>(v: Box>) | ^^^^ diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.rs b/src/test/ui/variance/variance-invariant-arg-trait-match.rs index 45fed0b083d..97d0fdd98e4 100644 --- a/src/test/ui/variance/variance-invariant-arg-trait-match.rs +++ b/src/test/ui/variance/variance-invariant-arg-trait-match.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] trait Get { diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.stderr index fc0d5e486de..32aac2e3a2b 100644 --- a/src/test/ui/variance/variance-invariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-invariant-arg-trait-match.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched types - --> $DIR/variance-invariant-arg-trait-match.rs:20:5 + --> $DIR/variance-invariant-arg-trait-match.rs:10:5 | LL | impls_get::() //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'min i32>` found type `Get<&'max i32>` -note: the lifetime 'min as defined on the function body at 17:21... - --> $DIR/variance-invariant-arg-trait-match.rs:17:21 +note: the lifetime 'min as defined on the function body at 7:21... + --> $DIR/variance-invariant-arg-trait-match.rs:7:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 17:27 - --> $DIR/variance-invariant-arg-trait-match.rs:17:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 7:27 + --> $DIR/variance-invariant-arg-trait-match.rs:7:27 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-invariant-arg-trait-match.rs:26:5 + --> $DIR/variance-invariant-arg-trait-match.rs:16:5 | LL | impls_get::() //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'max i32>` found type `Get<&'min i32>` -note: the lifetime 'min as defined on the function body at 23:21... - --> $DIR/variance-invariant-arg-trait-match.rs:23:21 +note: the lifetime 'min as defined on the function body at 13:21... + --> $DIR/variance-invariant-arg-trait-match.rs:13:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 23:27 - --> $DIR/variance-invariant-arg-trait-match.rs:23:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 13:27 + --> $DIR/variance-invariant-arg-trait-match.rs:13:27 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.rs b/src/test/ui/variance/variance-invariant-self-trait-match.rs index fe61dee23bc..678eefa634b 100644 --- a/src/test/ui/variance/variance-invariant-self-trait-match.rs +++ b/src/test/ui/variance/variance-invariant-self-trait-match.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] trait Get { diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.stderr index b34f027e895..ba96fbdaa14 100644 --- a/src/test/ui/variance/variance-invariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-invariant-self-trait-match.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched types - --> $DIR/variance-invariant-self-trait-match.rs:20:5 + --> $DIR/variance-invariant-self-trait-match.rs:10:5 | LL | impls_get::<&'min G>(); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` found type `Get` -note: the lifetime 'min as defined on the function body at 17:21... - --> $DIR/variance-invariant-self-trait-match.rs:17:21 +note: the lifetime 'min as defined on the function body at 7:21... + --> $DIR/variance-invariant-self-trait-match.rs:7:21 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 17:27 - --> $DIR/variance-invariant-self-trait-match.rs:17:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 7:27 + --> $DIR/variance-invariant-self-trait-match.rs:7:27 | LL | fn get_min_from_max<'min, 'max, G>() | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-invariant-self-trait-match.rs:26:5 + --> $DIR/variance-invariant-self-trait-match.rs:16:5 | LL | impls_get::<&'max G>(); //~ ERROR mismatched types | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` found type `Get` -note: the lifetime 'min as defined on the function body at 23:21... - --> $DIR/variance-invariant-self-trait-match.rs:23:21 +note: the lifetime 'min as defined on the function body at 13:21... + --> $DIR/variance-invariant-self-trait-match.rs:13:21 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 23:27 - --> $DIR/variance-invariant-self-trait-match.rs:23:27 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 13:27 + --> $DIR/variance-invariant-self-trait-match.rs:13:27 | LL | fn get_max_from_min<'min, 'max, G>() | ^^^^ diff --git a/src/test/ui/variance/variance-issue-20533.nll.stderr b/src/test/ui/variance/variance-issue-20533.nll.stderr index f9e2ae89a9d..469adaf6f0e 100644 --- a/src/test/ui/variance/variance-issue-20533.nll.stderr +++ b/src/test/ui/variance/variance-issue-20533.nll.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `a` because it is borrowed - --> $DIR/variance-issue-20533.rs:38:14 + --> $DIR/variance-issue-20533.rs:28:14 | LL | let x = foo(&a); | -- borrow of `a` occurs here @@ -9,7 +9,7 @@ LL | drop(x); | - borrow later used here error[E0505]: cannot move out of `a` because it is borrowed - --> $DIR/variance-issue-20533.rs:44:14 + --> $DIR/variance-issue-20533.rs:34:14 | LL | let x = bar(&a); | -- borrow of `a` occurs here @@ -19,7 +19,7 @@ LL | drop(x); | - borrow later used here error[E0505]: cannot move out of `a` because it is borrowed - --> $DIR/variance-issue-20533.rs:50:14 + --> $DIR/variance-issue-20533.rs:40:14 | LL | let x = baz(&a); | -- borrow of `a` occurs here diff --git a/src/test/ui/variance/variance-issue-20533.rs b/src/test/ui/variance/variance-issue-20533.rs index 60690012485..a2459f8730c 100644 --- a/src/test/ui/variance/variance-issue-20533.rs +++ b/src/test/ui/variance/variance-issue-20533.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Regression test for issue #20533. At some point, only 1 out of the // 3 errors below were being reported. diff --git a/src/test/ui/variance/variance-issue-20533.stderr b/src/test/ui/variance/variance-issue-20533.stderr index 680dea2447f..27aca3401f9 100644 --- a/src/test/ui/variance/variance-issue-20533.stderr +++ b/src/test/ui/variance/variance-issue-20533.stderr @@ -1,5 +1,5 @@ error[E0505]: cannot move out of `a` because it is borrowed - --> $DIR/variance-issue-20533.rs:38:14 + --> $DIR/variance-issue-20533.rs:28:14 | LL | let x = foo(&a); | - borrow of `a` occurs here @@ -7,7 +7,7 @@ LL | drop(a); //~ ERROR cannot move out of `a` | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed - --> $DIR/variance-issue-20533.rs:44:14 + --> $DIR/variance-issue-20533.rs:34:14 | LL | let x = bar(&a); | - borrow of `a` occurs here @@ -15,7 +15,7 @@ LL | drop(a); //~ ERROR cannot move out of `a` | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed - --> $DIR/variance-issue-20533.rs:50:14 + --> $DIR/variance-issue-20533.rs:40:14 | LL | let x = baz(&a); | - borrow of `a` occurs here diff --git a/src/test/ui/variance/variance-object-types.rs b/src/test/ui/variance/variance-object-types.rs index 1f54771e367..12af7ae8c5b 100644 --- a/src/test/ui/variance/variance-object-types.rs +++ b/src/test/ui/variance/variance-object-types.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that Cell is considered invariant with respect to its // type. diff --git a/src/test/ui/variance/variance-object-types.stderr b/src/test/ui/variance/variance-object-types.stderr index 9a1c9965de3..3ba86c2620e 100644 --- a/src/test/ui/variance/variance-object-types.stderr +++ b/src/test/ui/variance/variance-object-types.stderr @@ -1,5 +1,5 @@ error[E0208]: [o] - --> $DIR/variance-object-types.rs:21:1 + --> $DIR/variance-object-types.rs:11:1 | LL | / struct Foo<'a> { //~ ERROR [o] LL | | x: Box &'a i32 + 'static> diff --git a/src/test/ui/variance/variance-regions-direct.rs b/src/test/ui/variance/variance-regions-direct.rs index cd047cc580f..3f34e7655f3 100644 --- a/src/test/ui/variance/variance-regions-direct.rs +++ b/src/test/ui/variance/variance-regions-direct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we correctly infer variance for region parameters in // various self-contained types. diff --git a/src/test/ui/variance/variance-regions-direct.stderr b/src/test/ui/variance/variance-regions-direct.stderr index 81cb929c63b..82dc8df3726 100644 --- a/src/test/ui/variance/variance-regions-direct.stderr +++ b/src/test/ui/variance/variance-regions-direct.stderr @@ -1,5 +1,5 @@ error[E0208]: [-, -, -] - --> $DIR/variance-regions-direct.rs:19:1 + --> $DIR/variance-regions-direct.rs:9:1 | LL | / struct Test2<'a, 'b, 'c> { //~ ERROR [-, -, -] LL | | x: &'a isize, @@ -9,7 +9,7 @@ LL | | } | |_^ error[E0208]: [+, +, +] - --> $DIR/variance-regions-direct.rs:28:1 + --> $DIR/variance-regions-direct.rs:18:1 | LL | / struct Test3<'a, 'b, 'c> { //~ ERROR [+, +, +] LL | | x: extern "Rust" fn(&'a isize), @@ -19,7 +19,7 @@ LL | | } | |_^ error[E0208]: [-, o] - --> $DIR/variance-regions-direct.rs:37:1 + --> $DIR/variance-regions-direct.rs:27:1 | LL | / struct Test4<'a, 'b:'a> { //~ ERROR [-, o] LL | | x: &'a mut &'b isize, @@ -27,7 +27,7 @@ LL | | } | |_^ error[E0208]: [+, o] - --> $DIR/variance-regions-direct.rs:45:1 + --> $DIR/variance-regions-direct.rs:35:1 | LL | / struct Test5<'a, 'b:'a> { //~ ERROR [+, o] LL | | x: extern "Rust" fn(&'a mut &'b isize), @@ -35,7 +35,7 @@ LL | | } | |_^ error[E0208]: [-, o] - --> $DIR/variance-regions-direct.rs:55:1 + --> $DIR/variance-regions-direct.rs:45:1 | LL | / struct Test6<'a, 'b:'a> { //~ ERROR [-, o] LL | | x: &'a mut extern "Rust" fn(&'b isize), @@ -43,7 +43,7 @@ LL | | } | |_^ error[E0208]: [*] - --> $DIR/variance-regions-direct.rs:62:1 + --> $DIR/variance-regions-direct.rs:52:1 | LL | / struct Test7<'a> { //~ ERROR [*] LL | | x: isize @@ -51,7 +51,7 @@ LL | | } | |_^ error[E0208]: [+, -, o] - --> $DIR/variance-regions-direct.rs:69:1 + --> $DIR/variance-regions-direct.rs:59:1 | LL | / enum Test8<'a, 'b, 'c:'b> { //~ ERROR [+, -, o] LL | | Test8A(extern "Rust" fn(&'a isize)), diff --git a/src/test/ui/variance/variance-regions-indirect.rs b/src/test/ui/variance/variance-regions-indirect.rs index 60d4d73fe88..f84f25ada14 100644 --- a/src/test/ui/variance/variance-regions-indirect.rs +++ b/src/test/ui/variance/variance-regions-indirect.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we correctly infer variance for region parameters in // case that involve multiple intricate types. // Try enums too. diff --git a/src/test/ui/variance/variance-regions-indirect.stderr b/src/test/ui/variance/variance-regions-indirect.stderr index edf39537ff6..401fa2f3baa 100644 --- a/src/test/ui/variance/variance-regions-indirect.stderr +++ b/src/test/ui/variance/variance-regions-indirect.stderr @@ -1,5 +1,5 @@ error[E0208]: [+, -, o, *] - --> $DIR/variance-regions-indirect.rs:18:1 + --> $DIR/variance-regions-indirect.rs:8:1 | LL | / enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR [+, -, o, *] LL | | Test8A(extern "Rust" fn(&'a isize)), @@ -9,7 +9,7 @@ LL | | } | |_^ error[E0208]: [*, o, -, +] - --> $DIR/variance-regions-indirect.rs:25:1 + --> $DIR/variance-regions-indirect.rs:15:1 | LL | / struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR [*, o, -, +] LL | | f: Base<'z, 'y, 'x, 'w> @@ -17,7 +17,7 @@ LL | | } | |_^ error[E0208]: [o, o, *] - --> $DIR/variance-regions-indirect.rs:30:1 + --> $DIR/variance-regions-indirect.rs:20:1 | LL | / struct Derived2<'a, 'b:'a, 'c> { //~ ERROR [o, o, *] LL | | f: Base<'a, 'a, 'b, 'c> @@ -25,7 +25,7 @@ LL | | } | |_^ error[E0208]: [o, -, *] - --> $DIR/variance-regions-indirect.rs:35:1 + --> $DIR/variance-regions-indirect.rs:25:1 | LL | / struct Derived3<'a:'b, 'b, 'c> { //~ ERROR [o, -, *] LL | | f: Base<'a, 'b, 'a, 'c> @@ -33,7 +33,7 @@ LL | | } | |_^ error[E0208]: [+, -, o] - --> $DIR/variance-regions-indirect.rs:40:1 + --> $DIR/variance-regions-indirect.rs:30:1 | LL | / struct Derived4<'a, 'b, 'c:'b> { //~ ERROR [+, -, o] LL | | f: Base<'a, 'b, 'c, 'a> diff --git a/src/test/ui/variance/variance-regions-unused-direct.rs b/src/test/ui/variance/variance-regions-unused-direct.rs index 037fff72c80..2afe012bdf2 100644 --- a/src/test/ui/variance/variance-regions-unused-direct.rs +++ b/src/test/ui/variance/variance-regions-unused-direct.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that disallow lifetime parameters that are unused. use std::marker; diff --git a/src/test/ui/variance/variance-regions-unused-direct.stderr b/src/test/ui/variance/variance-regions-unused-direct.stderr index e3d02c649dc..207cc9147f1 100644 --- a/src/test/ui/variance/variance-regions-unused-direct.stderr +++ b/src/test/ui/variance/variance-regions-unused-direct.stderr @@ -1,5 +1,5 @@ error[E0392]: parameter `'a` is never used - --> $DIR/variance-regions-unused-direct.rs:15:18 + --> $DIR/variance-regions-unused-direct.rs:5:18 | LL | struct Bivariant<'a>; //~ ERROR parameter `'a` is never used | ^^ unused type parameter @@ -7,7 +7,7 @@ LL | struct Bivariant<'a>; //~ ERROR parameter `'a` is never used = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` error[E0392]: parameter `'d` is never used - --> $DIR/variance-regions-unused-direct.rs:17:19 + --> $DIR/variance-regions-unused-direct.rs:7:19 | LL | struct Struct<'a, 'd> { //~ ERROR parameter `'d` is never used | ^^ unused type parameter diff --git a/src/test/ui/variance/variance-regions-unused-indirect.rs b/src/test/ui/variance/variance-regions-unused-indirect.rs index 2d234ed7b57..1514e39563e 100644 --- a/src/test/ui/variance/variance-regions-unused-indirect.rs +++ b/src/test/ui/variance/variance-regions-unused-indirect.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that disallow lifetime parameters that are unused. enum Foo<'a> { //~ ERROR parameter `'a` is never used diff --git a/src/test/ui/variance/variance-regions-unused-indirect.stderr b/src/test/ui/variance/variance-regions-unused-indirect.stderr index f3eee86d5ab..08d1189ea2c 100644 --- a/src/test/ui/variance/variance-regions-unused-indirect.stderr +++ b/src/test/ui/variance/variance-regions-unused-indirect.stderr @@ -1,5 +1,5 @@ error[E0392]: parameter `'a` is never used - --> $DIR/variance-regions-unused-indirect.rs:13:10 + --> $DIR/variance-regions-unused-indirect.rs:3:10 | LL | enum Foo<'a> { //~ ERROR parameter `'a` is never used | ^^ unused type parameter @@ -7,7 +7,7 @@ LL | enum Foo<'a> { //~ ERROR parameter `'a` is never used = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` error[E0392]: parameter `'a` is never used - --> $DIR/variance-regions-unused-indirect.rs:17:10 + --> $DIR/variance-regions-unused-indirect.rs:7:10 | LL | enum Bar<'a> { //~ ERROR parameter `'a` is never used | ^^ unused type parameter diff --git a/src/test/ui/variance/variance-trait-bounds.rs b/src/test/ui/variance/variance-trait-bounds.rs index ff446f175b7..ad5334602a2 100644 --- a/src/test/ui/variance/variance-trait-bounds.rs +++ b/src/test/ui/variance/variance-trait-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![feature(rustc_attrs)] diff --git a/src/test/ui/variance/variance-trait-bounds.stderr b/src/test/ui/variance/variance-trait-bounds.stderr index 1c82ed772e2..1fabadabbcb 100644 --- a/src/test/ui/variance/variance-trait-bounds.stderr +++ b/src/test/ui/variance/variance-trait-bounds.stderr @@ -1,5 +1,5 @@ error[E0208]: [+, +] - --> $DIR/variance-trait-bounds.rs:26:1 + --> $DIR/variance-trait-bounds.rs:16:1 | LL | / struct TestStruct> { //~ ERROR [+, +] LL | | t: T, u: U @@ -7,7 +7,7 @@ LL | | } | |_^ error[E0208]: [*, +] - --> $DIR/variance-trait-bounds.rs:31:1 + --> $DIR/variance-trait-bounds.rs:21:1 | LL | / enum TestEnum> { //~ ERROR [*, +] LL | | Foo(T) @@ -15,7 +15,7 @@ LL | | } | |_^ error[E0208]: [*, +] - --> $DIR/variance-trait-bounds.rs:36:1 + --> $DIR/variance-trait-bounds.rs:26:1 | LL | / struct TestContraStruct> { //~ ERROR [*, +] LL | | t: T @@ -23,7 +23,7 @@ LL | | } | |_^ error[E0208]: [*, +] - --> $DIR/variance-trait-bounds.rs:41:1 + --> $DIR/variance-trait-bounds.rs:31:1 | LL | / struct TestBox+Setter> { //~ ERROR [*, +] LL | | t: T diff --git a/src/test/ui/variance/variance-trait-matching.rs b/src/test/ui/variance/variance-trait-matching.rs index bc9eab2be82..b4efee7d604 100644 --- a/src/test/ui/variance/variance-trait-matching.rs +++ b/src/test/ui/variance/variance-trait-matching.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Get is covariant in T @@ -31,7 +21,7 @@ fn get<'a, G>(get: &G) -> i32 // This fails to type-check because, without variance, we can't // use `G : Get<&'a i32>` as evidence that `G : Get<&'b i32>`, // even if `'a : 'b`. - pick(get, &22) //~ ERROR 34:5: 34:9: explicit lifetime required in the type of `get` [E0621] + pick(get, &22) //~ ERROR explicit lifetime required in the type of `get` [E0621] } fn pick<'b, G>(get: &'b G, if_odd: &'b i32) -> i32 diff --git a/src/test/ui/variance/variance-trait-matching.stderr b/src/test/ui/variance/variance-trait-matching.stderr index 645d0ffd311..2d11515a19c 100644 --- a/src/test/ui/variance/variance-trait-matching.stderr +++ b/src/test/ui/variance/variance-trait-matching.stderr @@ -1,10 +1,10 @@ error[E0621]: explicit lifetime required in the type of `get` - --> $DIR/variance-trait-matching.rs:34:5 + --> $DIR/variance-trait-matching.rs:24:5 | LL | fn get<'a, G>(get: &G) -> i32 | -- help: add explicit lifetime `'a` to the type of `get`: `&'a G` ... -LL | pick(get, &22) //~ ERROR 34:5: 34:9: explicit lifetime required in the type of `get` [E0621] +LL | pick(get, &22) //~ ERROR explicit lifetime required in the type of `get` [E0621] | ^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/variance/variance-trait-object-bound.rs b/src/test/ui/variance/variance-trait-object-bound.rs index b120588ecab..ada93b7f6ef 100644 --- a/src/test/ui/variance/variance-trait-object-bound.rs +++ b/src/test/ui/variance/variance-trait-object-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Checks that regions which appear in a trait object type are // observed by the variance inference algorithm (and hence // `TOption` is contavariant w/r/t `'a` and not bivariant). diff --git a/src/test/ui/variance/variance-trait-object-bound.stderr b/src/test/ui/variance/variance-trait-object-bound.stderr index b44fa940ed3..c824f5a6db7 100644 --- a/src/test/ui/variance/variance-trait-object-bound.stderr +++ b/src/test/ui/variance/variance-trait-object-bound.stderr @@ -1,5 +1,5 @@ error[E0208]: [-] - --> $DIR/variance-trait-object-bound.rs:24:1 + --> $DIR/variance-trait-object-bound.rs:14:1 | LL | / struct TOption<'a> { //~ ERROR [-] LL | | v: Option>, diff --git a/src/test/ui/variance/variance-types-bounds.rs b/src/test/ui/variance/variance-types-bounds.rs index 5075dd2ceed..5cbda10fbde 100644 --- a/src/test/ui/variance/variance-types-bounds.rs +++ b/src/test/ui/variance/variance-types-bounds.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we correctly infer variance for type parameters in // various types and traits. diff --git a/src/test/ui/variance/variance-types-bounds.stderr b/src/test/ui/variance/variance-types-bounds.stderr index e4b0887912b..31271952f77 100644 --- a/src/test/ui/variance/variance-types-bounds.stderr +++ b/src/test/ui/variance/variance-types-bounds.stderr @@ -1,5 +1,5 @@ error[E0208]: [+, +] - --> $DIR/variance-types-bounds.rs:17:1 + --> $DIR/variance-types-bounds.rs:7:1 | LL | / struct TestImm { //~ ERROR [+, +] LL | | x: A, @@ -8,7 +8,7 @@ LL | | } | |_^ error[E0208]: [+, o] - --> $DIR/variance-types-bounds.rs:23:1 + --> $DIR/variance-types-bounds.rs:13:1 | LL | / struct TestMut { //~ ERROR [+, o] LL | | x: A, @@ -17,7 +17,7 @@ LL | | } | |_^ error[E0208]: [+, o] - --> $DIR/variance-types-bounds.rs:29:1 + --> $DIR/variance-types-bounds.rs:19:1 | LL | / struct TestIndirect { //~ ERROR [+, o] LL | | m: TestMut @@ -25,7 +25,7 @@ LL | | } | |_^ error[E0208]: [o, o] - --> $DIR/variance-types-bounds.rs:34:1 + --> $DIR/variance-types-bounds.rs:24:1 | LL | / struct TestIndirect2 { //~ ERROR [o, o] LL | | n: TestMut, @@ -34,7 +34,7 @@ LL | | } | |_^ error[E0208]: [o, o] - --> $DIR/variance-types-bounds.rs:48:1 + --> $DIR/variance-types-bounds.rs:38:1 | LL | / struct TestObject { //~ ERROR [o, o] LL | | n: Box+Send>, diff --git a/src/test/ui/variance/variance-types.rs b/src/test/ui/variance/variance-types.rs index 7667972c9d2..b9b6d9c9bb5 100644 --- a/src/test/ui/variance/variance-types.rs +++ b/src/test/ui/variance/variance-types.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] #![feature(rustc_attrs)] diff --git a/src/test/ui/variance/variance-types.stderr b/src/test/ui/variance/variance-types.stderr index 59975fa7a7e..4362f694202 100644 --- a/src/test/ui/variance/variance-types.stderr +++ b/src/test/ui/variance/variance-types.stderr @@ -1,5 +1,5 @@ error[E0208]: [-, o, o] - --> $DIR/variance-types.rs:20:1 + --> $DIR/variance-types.rs:10:1 | LL | / struct InvariantMut<'a,A:'a,B:'a> { //~ ERROR [-, o, o] LL | | t: &'a mut (A,B) @@ -7,7 +7,7 @@ LL | | } | |_^ error[E0208]: [o] - --> $DIR/variance-types.rs:25:1 + --> $DIR/variance-types.rs:15:1 | LL | / struct InvariantCell { //~ ERROR [o] LL | | t: Cell @@ -15,7 +15,7 @@ LL | | } | |_^ error[E0208]: [o] - --> $DIR/variance-types.rs:30:1 + --> $DIR/variance-types.rs:20:1 | LL | / struct InvariantIndirect { //~ ERROR [o] LL | | t: InvariantCell @@ -23,7 +23,7 @@ LL | | } | |_^ error[E0208]: [+] - --> $DIR/variance-types.rs:35:1 + --> $DIR/variance-types.rs:25:1 | LL | / struct Covariant { //~ ERROR [+] LL | | t: A, u: fn() -> A @@ -31,7 +31,7 @@ LL | | } | |_^ error[E0208]: [-] - --> $DIR/variance-types.rs:40:1 + --> $DIR/variance-types.rs:30:1 | LL | / struct Contravariant { //~ ERROR [-] LL | | t: fn(A) @@ -39,7 +39,7 @@ LL | | } | |_^ error[E0208]: [+, -, o] - --> $DIR/variance-types.rs:45:1 + --> $DIR/variance-types.rs:35:1 | LL | / enum Enum { //~ ERROR [+, -, o] LL | | Foo(Covariant), diff --git a/src/test/ui/variance/variance-unused-region-param.rs b/src/test/ui/variance/variance-unused-region-param.rs index 407282e5ce0..f0e4e03c9db 100644 --- a/src/test/ui/variance/variance-unused-region-param.rs +++ b/src/test/ui/variance/variance-unused-region-param.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we report an error for unused type parameters in types. struct SomeStruct<'a> { x: u32 } //~ ERROR parameter `'a` is never used diff --git a/src/test/ui/variance/variance-unused-region-param.stderr b/src/test/ui/variance/variance-unused-region-param.stderr index 354fcf373a6..9cd133bbc93 100644 --- a/src/test/ui/variance/variance-unused-region-param.stderr +++ b/src/test/ui/variance/variance-unused-region-param.stderr @@ -1,5 +1,5 @@ error[E0392]: parameter `'a` is never used - --> $DIR/variance-unused-region-param.rs:13:19 + --> $DIR/variance-unused-region-param.rs:3:19 | LL | struct SomeStruct<'a> { x: u32 } //~ ERROR parameter `'a` is never used | ^^ unused type parameter @@ -7,7 +7,7 @@ LL | struct SomeStruct<'a> { x: u32 } //~ ERROR parameter `'a` is never used = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` error[E0392]: parameter `'a` is never used - --> $DIR/variance-unused-region-param.rs:14:15 + --> $DIR/variance-unused-region-param.rs:4:15 | LL | enum SomeEnum<'a> { Nothing } //~ ERROR parameter `'a` is never used | ^^ unused type parameter diff --git a/src/test/ui/variance/variance-unused-type-param.rs b/src/test/ui/variance/variance-unused-type-param.rs index a5f6fd2fda1..1e0e403ebce 100644 --- a/src/test/ui/variance/variance-unused-type-param.rs +++ b/src/test/ui/variance/variance-unused-type-param.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![allow(dead_code)] // Test that we report an error for unused type parameters in types and traits, diff --git a/src/test/ui/variance/variance-unused-type-param.stderr b/src/test/ui/variance/variance-unused-type-param.stderr index b3ae91a6fa5..34c430f5498 100644 --- a/src/test/ui/variance/variance-unused-type-param.stderr +++ b/src/test/ui/variance/variance-unused-type-param.stderr @@ -1,5 +1,5 @@ error[E0392]: parameter `A` is never used - --> $DIR/variance-unused-type-param.rs:16:19 + --> $DIR/variance-unused-type-param.rs:6:19 | LL | struct SomeStruct { x: u32 } | ^ unused type parameter @@ -7,7 +7,7 @@ LL | struct SomeStruct { x: u32 } = help: consider removing `A` or using a marker such as `std::marker::PhantomData` error[E0392]: parameter `A` is never used - --> $DIR/variance-unused-type-param.rs:19:15 + --> $DIR/variance-unused-type-param.rs:9:15 | LL | enum SomeEnum { Nothing } | ^ unused type parameter @@ -15,7 +15,7 @@ LL | enum SomeEnum { Nothing } = help: consider removing `A` or using a marker such as `std::marker::PhantomData` error[E0392]: parameter `T` is never used - --> $DIR/variance-unused-type-param.rs:23:15 + --> $DIR/variance-unused-type-param.rs:13:15 | LL | enum ListCell { | ^ unused type parameter diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.rs b/src/test/ui/variance/variance-use-contravariant-struct-1.rs index 47ecec5a112..8a02ef4ec85 100644 --- a/src/test/ui/variance/variance-use-contravariant-struct-1.rs +++ b/src/test/ui/variance/variance-use-contravariant-struct-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test various uses of structs with distint variances to make sure // they permit lifetimes to be approximated as expected. diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.stderr index 48e0d380c66..89a49a00b34 100644 --- a/src/test/ui/variance/variance-use-contravariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-contravariant-struct-1.stderr @@ -1,18 +1,18 @@ error[E0308]: mismatched types - --> $DIR/variance-use-contravariant-struct-1.rs:22:5 + --> $DIR/variance-use-contravariant-struct-1.rs:12:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `SomeStruct<&'min ()>` found type `SomeStruct<&'max ()>` -note: the lifetime 'min as defined on the function body at 18:8... - --> $DIR/variance-use-contravariant-struct-1.rs:18:8 +note: the lifetime 'min as defined on the function body at 8:8... + --> $DIR/variance-use-contravariant-struct-1.rs:8:8 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 18:13 - --> $DIR/variance-use-contravariant-struct-1.rs:18:13 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 8:13 + --> $DIR/variance-use-contravariant-struct-1.rs:8:13 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) | ^^^^ diff --git a/src/test/ui/variance/variance-use-contravariant-struct-2.rs b/src/test/ui/variance/variance-use-contravariant-struct-2.rs index 88585373847..77bd2b79f8c 100644 --- a/src/test/ui/variance/variance-use-contravariant-struct-2.rs +++ b/src/test/ui/variance/variance-use-contravariant-struct-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test various uses of structs with distint variances to make sure // they permit lifetimes to be approximated as expected. diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.rs b/src/test/ui/variance/variance-use-covariant-struct-1.rs index 2631cfc05e8..e19a35bdfac 100644 --- a/src/test/ui/variance/variance-use-covariant-struct-1.rs +++ b/src/test/ui/variance/variance-use-covariant-struct-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a covariant struct does not permit the lifetime of a // reference to be enlarged. diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.stderr index 947abe24b55..a6f298c9bfb 100644 --- a/src/test/ui/variance/variance-use-covariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-covariant-struct-1.stderr @@ -1,18 +1,18 @@ error[E0308]: mismatched types - --> $DIR/variance-use-covariant-struct-1.rs:20:5 + --> $DIR/variance-use-covariant-struct-1.rs:10:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `SomeStruct<&'max ()>` found type `SomeStruct<&'min ()>` -note: the lifetime 'min as defined on the function body at 16:8... - --> $DIR/variance-use-covariant-struct-1.rs:16:8 +note: the lifetime 'min as defined on the function body at 6:8... + --> $DIR/variance-use-covariant-struct-1.rs:6:8 | LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>) | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 16:13 - --> $DIR/variance-use-covariant-struct-1.rs:16:13 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 6:13 + --> $DIR/variance-use-covariant-struct-1.rs:6:13 | LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>) | ^^^^ diff --git a/src/test/ui/variance/variance-use-covariant-struct-2.rs b/src/test/ui/variance/variance-use-covariant-struct-2.rs index 245e21511a6..cb8159d8a68 100644 --- a/src/test/ui/variance/variance-use-covariant-struct-2.rs +++ b/src/test/ui/variance/variance-use-covariant-struct-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a covariant struct permits the lifetime of a reference to // be shortened. diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.rs b/src/test/ui/variance/variance-use-invariant-struct-1.rs index 2e6c0c16dcd..4772a9fb878 100644 --- a/src/test/ui/variance/variance-use-invariant-struct-1.rs +++ b/src/test/ui/variance/variance-use-invariant-struct-1.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test various uses of structs with distint variances to make sure // they permit lifetimes to be approximated as expected. diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.stderr index 30da7e38c57..2bd39d5a831 100644 --- a/src/test/ui/variance/variance-use-invariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-invariant-struct-1.stderr @@ -1,37 +1,37 @@ error[E0308]: mismatched types - --> $DIR/variance-use-invariant-struct-1.rs:22:5 + --> $DIR/variance-use-invariant-struct-1.rs:12:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `SomeStruct<&'min ()>` found type `SomeStruct<&'max ()>` -note: the lifetime 'min as defined on the function body at 18:8... - --> $DIR/variance-use-invariant-struct-1.rs:18:8 +note: the lifetime 'min as defined on the function body at 8:8... + --> $DIR/variance-use-invariant-struct-1.rs:8:8 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 18:13 - --> $DIR/variance-use-invariant-struct-1.rs:18:13 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 8:13 + --> $DIR/variance-use-invariant-struct-1.rs:8:13 | LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) | ^^^^ error[E0308]: mismatched types - --> $DIR/variance-use-invariant-struct-1.rs:29:5 + --> $DIR/variance-use-invariant-struct-1.rs:19:5 | LL | v //~ ERROR mismatched types | ^ lifetime mismatch | = note: expected type `SomeStruct<&'max ()>` found type `SomeStruct<&'min ()>` -note: the lifetime 'min as defined on the function body at 25:8... - --> $DIR/variance-use-invariant-struct-1.rs:25:8 +note: the lifetime 'min as defined on the function body at 15:8... + --> $DIR/variance-use-invariant-struct-1.rs:15:8 | LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>) | ^^^^ -note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 25:13 - --> $DIR/variance-use-invariant-struct-1.rs:25:13 +note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 15:13 + --> $DIR/variance-use-invariant-struct-1.rs:15:13 | LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>) | ^^^^ diff --git a/src/test/ui/variants/auxiliary/variant-namespacing.rs b/src/test/ui/variants/auxiliary/variant-namespacing.rs index d7fd2968495..7ba601a8840 100644 --- a/src/test/ui/variants/auxiliary/variant-namespacing.rs +++ b/src/test/ui/variants/auxiliary/variant-namespacing.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub enum XE { XStruct { a: u8 }, XTuple(u8), diff --git a/src/test/ui/variants/variant-namespacing.rs b/src/test/ui/variants/variant-namespacing.rs index 58bfd91550e..ceb7d274514 100644 --- a/src/test/ui/variants/variant-namespacing.rs +++ b/src/test/ui/variants/variant-namespacing.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:variant-namespacing.rs enum E { diff --git a/src/test/ui/variants/variant-namespacing.stderr b/src/test/ui/variants/variant-namespacing.stderr index ce2fb7cb92c..3954da4ec29 100644 --- a/src/test/ui/variants/variant-namespacing.stderr +++ b/src/test/ui/variants/variant-namespacing.stderr @@ -1,5 +1,5 @@ error[E0255]: the name `XStruct` is defined multiple times - --> $DIR/variant-namespacing.rs:34:35 + --> $DIR/variant-namespacing.rs:24:35 | LL | type XStruct = u8; | ------------------ previous definition of the type `XStruct` here @@ -14,7 +14,7 @@ LL | pub use variant_namespacing::XE::{XStruct as OtherXStruct, XTuple, XUnit}; | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0255]: the name `XTuple` is defined multiple times - --> $DIR/variant-namespacing.rs:34:44 + --> $DIR/variant-namespacing.rs:24:44 | LL | type XTuple = u8; | ----------------- previous definition of the type `XTuple` here @@ -29,7 +29,7 @@ LL | pub use variant_namespacing::XE::{XStruct, XTuple as OtherXTuple, XUnit}; | ^^^^^^^^^^^^^^^^^^^^^ error[E0255]: the name `XUnit` is defined multiple times - --> $DIR/variant-namespacing.rs:34:52 + --> $DIR/variant-namespacing.rs:24:52 | LL | type XUnit = u8; | ---------------- previous definition of the type `XUnit` here @@ -44,7 +44,7 @@ LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit as OtherXUnit}; | ^^^^^^^^^^^^^^^^^^^ error[E0255]: the name `Struct` is defined multiple times - --> $DIR/variant-namespacing.rs:38:13 + --> $DIR/variant-namespacing.rs:28:13 | LL | type Struct = u8; | ----------------- previous definition of the type `Struct` here @@ -59,7 +59,7 @@ LL | pub use E::{Struct as OtherStruct, Tuple, Unit}; | ^^^^^^^^^^^^^^^^^^^^^ error[E0255]: the name `Tuple` is defined multiple times - --> $DIR/variant-namespacing.rs:38:21 + --> $DIR/variant-namespacing.rs:28:21 | LL | type Tuple = u8; | ---------------- previous definition of the type `Tuple` here @@ -74,7 +74,7 @@ LL | pub use E::{Struct, Tuple as OtherTuple, Unit}; | ^^^^^^^^^^^^^^^^^^^ error[E0255]: the name `Unit` is defined multiple times - --> $DIR/variant-namespacing.rs:38:28 + --> $DIR/variant-namespacing.rs:28:28 | LL | type Unit = u8; | --------------- previous definition of the type `Unit` here diff --git a/src/test/ui/variants/variant-size-differences.rs b/src/test/ui/variants/variant-size-differences.rs index f2cffeefe90..2198199511b 100644 --- a/src/test/ui/variants/variant-size-differences.rs +++ b/src/test/ui/variants/variant-size-differences.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![deny(variant_size_differences)] enum _En { diff --git a/src/test/ui/variants/variant-size-differences.stderr b/src/test/ui/variants/variant-size-differences.stderr index a41a5c17ea3..5cd168df538 100644 --- a/src/test/ui/variants/variant-size-differences.stderr +++ b/src/test/ui/variants/variant-size-differences.stderr @@ -1,11 +1,11 @@ error: enum variant is more than three times larger (1024 bytes) than the next largest - --> $DIR/variant-size-differences.rs:15:5 + --> $DIR/variant-size-differences.rs:5:5 | LL | VBig([u8; 1024]), //~ ERROR variant is more than three times larger | ^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/variant-size-differences.rs:11:9 + --> $DIR/variant-size-differences.rs:1:9 | LL | #![deny(variant_size_differences)] | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/variants/variant-used-as-type.rs b/src/test/ui/variants/variant-used-as-type.rs index c889b7d28f8..f27db102476 100644 --- a/src/test/ui/variants/variant-used-as-type.rs +++ b/src/test/ui/variants/variant-used-as-type.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test error message when enum variants are used as types diff --git a/src/test/ui/variants/variant-used-as-type.stderr b/src/test/ui/variants/variant-used-as-type.stderr index 972fe8a8a61..fdfc044d81f 100644 --- a/src/test/ui/variants/variant-used-as-type.stderr +++ b/src/test/ui/variants/variant-used-as-type.stderr @@ -1,30 +1,26 @@ error[E0573]: expected type, found variant `Ty::A` - --> $DIR/variant-used-as-type.rs:17:7 + --> $DIR/variant-used-as-type.rs:7:7 | LL | B(Ty::A), | ^^^^^ not a type -help: you can try using the variant's enum - | -LL | B(Ty), - | ^^ -help: you can try using the variant's enum +help: try using the variant's enum | LL | B(E), | ^ +LL | B(Ty), + | ^^ error[E0573]: expected type, found variant `E::A` - --> $DIR/variant-used-as-type.rs:27:6 + --> $DIR/variant-used-as-type.rs:17:6 | LL | impl E::A {} | ^^^^ not a type -help: you can try using the variant's enum - | -LL | impl Ty {} - | ^^ -help: you can try using the variant's enum +help: try using the variant's enum | LL | impl E {} | ^ +LL | impl Ty {} + | ^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/vec/vec-macro-with-comma-only.rs b/src/test/ui/vec/vec-macro-with-comma-only.rs index c79e67a3768..574a53c58fe 100644 --- a/src/test/ui/vec/vec-macro-with-comma-only.rs +++ b/src/test/ui/vec/vec-macro-with-comma-only.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - pub fn main() { vec![,]; //~ ERROR no rules expected the token `,` } diff --git a/src/test/ui/vec/vec-macro-with-comma-only.stderr b/src/test/ui/vec/vec-macro-with-comma-only.stderr index 856d85ef5cd..92e704c3fb4 100644 --- a/src/test/ui/vec/vec-macro-with-comma-only.stderr +++ b/src/test/ui/vec/vec-macro-with-comma-only.stderr @@ -1,8 +1,8 @@ error: no rules expected the token `,` - --> $DIR/vec-macro-with-comma-only.rs:12:10 + --> $DIR/vec-macro-with-comma-only.rs:2:10 | LL | vec![,]; //~ ERROR no rules expected the token `,` - | ^ no rules expected the token `,` + | ^ no rules expected this token in macro call error: aborting due to previous error diff --git a/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr b/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr index a5c6e5f1110..73cddd8d680 100644 --- a/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr +++ b/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `xs` as mutable more than once at a time - --> $DIR/vec-mut-iter-borrow.rs:15:9 + --> $DIR/vec-mut-iter-borrow.rs:5:9 | LL | for x in &mut xs { | ------- diff --git a/src/test/ui/vec/vec-mut-iter-borrow.rs b/src/test/ui/vec/vec-mut-iter-borrow.rs index 571634e3992..4aa737446b5 100644 --- a/src/test/ui/vec/vec-mut-iter-borrow.rs +++ b/src/test/ui/vec/vec-mut-iter-borrow.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn main() { let mut xs: Vec = vec![]; diff --git a/src/test/ui/vec/vec-mut-iter-borrow.stderr b/src/test/ui/vec/vec-mut-iter-borrow.stderr index 18fdf2c6867..9b4b5673791 100644 --- a/src/test/ui/vec/vec-mut-iter-borrow.stderr +++ b/src/test/ui/vec/vec-mut-iter-borrow.stderr @@ -1,5 +1,5 @@ error[E0499]: cannot borrow `xs` as mutable more than once at a time - --> $DIR/vec-mut-iter-borrow.rs:15:9 + --> $DIR/vec-mut-iter-borrow.rs:5:9 | LL | for x in &mut xs { | -- diff --git a/src/test/ui/vec/vec-res-add.rs b/src/test/ui/vec/vec-res-add.rs index 27f6fc51164..ea2aa6cda24 100644 --- a/src/test/ui/vec/vec-res-add.rs +++ b/src/test/ui/vec/vec-res-add.rs @@ -1,21 +1,11 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[derive(Debug)] -struct r { +struct R { i:isize } -fn r(i:isize) -> r { r { i: i } } +fn r(i:isize) -> R { R { i: i } } -impl Drop for r { +impl Drop for R { fn drop(&mut self) {} } diff --git a/src/test/ui/vec/vec-res-add.stderr b/src/test/ui/vec/vec-res-add.stderr index 62d3f046c96..39552697631 100644 --- a/src/test/ui/vec/vec-res-add.stderr +++ b/src/test/ui/vec/vec-res-add.stderr @@ -1,10 +1,10 @@ -error[E0369]: binary operation `+` cannot be applied to type `std::vec::Vec` - --> $DIR/vec-res-add.rs:26:13 +error[E0369]: binary operation `+` cannot be applied to type `std::vec::Vec` + --> $DIR/vec-res-add.rs:16:13 | LL | let k = i + j; | ^^^^^ | - = note: an implementation of `std::ops::Add` might be missing for `std::vec::Vec` + = note: an implementation of `std::ops::Add` might be missing for `std::vec::Vec` error: aborting due to previous error diff --git a/src/test/ui/vector-cast-weirdness.rs b/src/test/ui/vector-cast-weirdness.rs index 26c59c440d4..79b9243765b 100644 --- a/src/test/ui/vector-cast-weirdness.rs +++ b/src/test/ui/vector-cast-weirdness.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Issue #14893. Tests that casts from vectors don't behave strangely in the // presence of the `_` type shorthand notation. // Update: after a change to the way casts are done, we have more type information diff --git a/src/test/ui/vector-cast-weirdness.stderr b/src/test/ui/vector-cast-weirdness.stderr index a096fee16b9..330b87801eb 100644 --- a/src/test/ui/vector-cast-weirdness.stderr +++ b/src/test/ui/vector-cast-weirdness.stderr @@ -1,5 +1,5 @@ error[E0606]: casting `&mut [u8; 2]` as `*mut u8` is invalid - --> $DIR/vector-cast-weirdness.rs:31:23 + --> $DIR/vector-cast-weirdness.rs:21:23 | LL | let p1: *mut u8 = &mut x1.y as *mut _; //~ ERROR casting | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/vector-no-ann.rs b/src/test/ui/vector-no-ann.rs index 2143d2b64c6..200364a5d93 100644 --- a/src/test/ui/vector-no-ann.rs +++ b/src/test/ui/vector-no-ann.rs @@ -1,14 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn main() { let _foo = Vec::new(); //~^ ERROR type annotations needed [E0282] diff --git a/src/test/ui/vector-no-ann.stderr b/src/test/ui/vector-no-ann.stderr index 90acc2f86d7..01b569f97f9 100644 --- a/src/test/ui/vector-no-ann.stderr +++ b/src/test/ui/vector-no-ann.stderr @@ -1,5 +1,5 @@ error[E0282]: type annotations needed - --> $DIR/vector-no-ann.rs:13:16 + --> $DIR/vector-no-ann.rs:2:16 | LL | let _foo = Vec::new(); | ---- ^^^^^^^^ cannot infer type for `T` diff --git a/src/test/ui/vtable-res-trait-param.rs b/src/test/ui/vtable-res-trait-param.rs index 8b3e9369ece..3d7c2eb084c 100644 --- a/src/test/ui/vtable-res-trait-param.rs +++ b/src/test/ui/vtable-res-trait-param.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait TraitA { fn method_a(&self) -> isize; } diff --git a/src/test/ui/vtable-res-trait-param.stderr b/src/test/ui/vtable-res-trait-param.stderr index 0d0e8202623..6dac9fe335f 100644 --- a/src/test/ui/vtable-res-trait-param.stderr +++ b/src/test/ui/vtable-res-trait-param.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `{integer}: TraitA` is not satisfied - --> $DIR/vtable-res-trait-param.rs:27:7 + --> $DIR/vtable-res-trait-param.rs:17:7 | LL | b.gimme_an_a(y) //~ ERROR `{integer}: TraitA` is not satisfied | ^^^^^^^^^^ the trait `TraitA` is not implemented for `{integer}` diff --git a/src/test/ui/walk-struct-literal-with.nll.stderr b/src/test/ui/walk-struct-literal-with.nll.stderr index e2c4a19debe..2263747607b 100644 --- a/src/test/ui/walk-struct-literal-with.nll.stderr +++ b/src/test/ui/walk-struct-literal-with.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: borrow of moved value: `start` - --> $DIR/walk-struct-literal-with.rs:26:20 + --> $DIR/walk-struct-literal-with.rs:16:20 | +LL | let start = Mine{test:"Foo".to_string(), other_val:0}; + | ----- move occurs because `start` has type `Mine`, which does not implement the `Copy` trait LL | let end = Mine{other_val:1, ..start.make_string_bar()}; | ----- value moved here LL | println!("{}", start.test); //~ ERROR use of moved value: `start.test` | ^^^^^^^^^^ value borrowed here after move - | - = note: move occurs because `start` has type `Mine`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/walk-struct-literal-with.rs b/src/test/ui/walk-struct-literal-with.rs index 10503084b9d..31dfd58fa98 100644 --- a/src/test/ui/walk-struct-literal-with.rs +++ b/src/test/ui/walk-struct-literal-with.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - struct Mine{ test: String, other_val: isize diff --git a/src/test/ui/walk-struct-literal-with.stderr b/src/test/ui/walk-struct-literal-with.stderr index 751e41f5ce9..9362301b408 100644 --- a/src/test/ui/walk-struct-literal-with.stderr +++ b/src/test/ui/walk-struct-literal-with.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `start.test` - --> $DIR/walk-struct-literal-with.rs:26:20 + --> $DIR/walk-struct-literal-with.rs:16:20 | LL | let end = Mine{other_val:1, ..start.make_string_bar()}; | ----- value moved here diff --git a/src/test/ui/warn-path-statement.rs b/src/test/ui/warn-path-statement.rs index 892d82d0934..e8525f8b892 100644 --- a/src/test/ui/warn-path-statement.rs +++ b/src/test/ui/warn-path-statement.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // compile-flags: -D path-statements fn main() { diff --git a/src/test/ui/warn-path-statement.stderr b/src/test/ui/warn-path-statement.stderr index 44b194bc62d..55d33058c17 100644 --- a/src/test/ui/warn-path-statement.stderr +++ b/src/test/ui/warn-path-statement.stderr @@ -1,5 +1,5 @@ error: path statement with no effect - --> $DIR/warn-path-statement.rs:15:5 + --> $DIR/warn-path-statement.rs:5:5 | LL | x; //~ ERROR path statement with no effect | ^^ diff --git a/src/test/ui/wasm-custom-section-relocations.rs b/src/test/ui/wasm-custom-section-relocations.rs index 9f431e78061..c3cca3a35ac 100644 --- a/src/test/ui/wasm-custom-section-relocations.rs +++ b/src/test/ui/wasm-custom-section-relocations.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // only-wasm32 #[link_section = "test"] diff --git a/src/test/ui/wasm-custom-section-relocations.stderr b/src/test/ui/wasm-custom-section-relocations.stderr index cea6e5c4192..272dd8d524d 100644 --- a/src/test/ui/wasm-custom-section-relocations.stderr +++ b/src/test/ui/wasm-custom-section-relocations.stderr @@ -1,11 +1,11 @@ error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references - --> $DIR/wasm-custom-section-relocations.rs:14:1 + --> $DIR/wasm-custom-section-relocations.rs:4:1 | LL | pub static A: &[u8] = &[1]; //~ ERROR: no extra levels of indirection | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references - --> $DIR/wasm-custom-section-relocations.rs:23:1 + --> $DIR/wasm-custom-section-relocations.rs:13:1 | LL | pub static D: &usize = &C; //~ ERROR: no extra levels of indirection | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wasm-import-module.rs b/src/test/ui/wasm-import-module.rs index 62b2d587c7e..618bf1952aa 100644 --- a/src/test/ui/wasm-import-module.rs +++ b/src/test/ui/wasm-import-module.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form extern {} diff --git a/src/test/ui/wasm-import-module.stderr b/src/test/ui/wasm-import-module.stderr index 14b3055fea8..a3955bb676e 100644 --- a/src/test/ui/wasm-import-module.stderr +++ b/src/test/ui/wasm-import-module.stderr @@ -1,17 +1,17 @@ error: must be of the form #[link(wasm_import_module = "...")] - --> $DIR/wasm-import-module.rs:11:22 + --> $DIR/wasm-import-module.rs:1:22 | LL | #[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form | ^^^^^^^^^^^^^^^^^^ error: must be of the form #[link(wasm_import_module = "...")] - --> $DIR/wasm-import-module.rs:14:22 + --> $DIR/wasm-import-module.rs:4:22 | LL | #[link(name = "...", wasm_import_module(x))] //~ ERROR: must be of the form | ^^^^^^^^^^^^^^^^^^^^^ error: must be of the form #[link(wasm_import_module = "...")] - --> $DIR/wasm-import-module.rs:17:22 + --> $DIR/wasm-import-module.rs:7:22 | LL | #[link(name = "...", wasm_import_module())] //~ ERROR: must be of the form | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-array-elem-sized.rs b/src/test/ui/wf/wf-array-elem-sized.rs index 36e9226ae3f..41c2d3c43e9 100644 --- a/src/test/ui/wf/wf-array-elem-sized.rs +++ b/src/test/ui/wf/wf-array-elem-sized.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that array elemen types must be Sized. Issue #25692. diff --git a/src/test/ui/wf/wf-array-elem-sized.stderr b/src/test/ui/wf/wf-array-elem-sized.stderr index 362b2861424..69df9ea7857 100644 --- a/src/test/ui/wf/wf-array-elem-sized.stderr +++ b/src/test/ui/wf/wf-array-elem-sized.stderr @@ -1,11 +1,11 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/wf-array-elem-sized.rs:17:5 + --> $DIR/wf-array-elem-sized.rs:7:5 | LL | foo: [[u8]], //~ ERROR E0277 | ^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` - = note: to learn more, visit + = note: to learn more, visit = note: slice and array elements must have `Sized` type error: aborting due to previous error diff --git a/src/test/ui/wf/wf-const-type.rs b/src/test/ui/wf/wf-const-type.rs index bc14ce46ff1..df79aa26712 100644 --- a/src/test/ui/wf/wf-const-type.rs +++ b/src/test/ui/wf/wf-const-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check the types of constants are well-formed. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-const-type.stderr b/src/test/ui/wf/wf-const-type.stderr index 78e831ef880..4df429259ed 100644 --- a/src/test/ui/wf/wf-const-type.stderr +++ b/src/test/ui/wf/wf-const-type.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `NotCopy: std::marker::Copy` is not satisfied - --> $DIR/wf-const-type.rs:20:12 + --> $DIR/wf-const-type.rs:10:12 | LL | const FOO: IsCopy> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `NotCopy` | = note: required because of the requirements on the impl of `std::marker::Copy` for `std::option::Option` note: required by `IsCopy` - --> $DIR/wf-const-type.rs:17:1 + --> $DIR/wf-const-type.rs:7:1 | LL | struct IsCopy { t: T } | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-enum-bound.rs b/src/test/ui/wf/wf-enum-bound.rs index 6c08f5a4a54..c9eb9d89433 100644 --- a/src/test/ui/wf/wf-enum-bound.rs +++ b/src/test/ui/wf/wf-enum-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check enum bounds for WFedness. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-enum-bound.stderr b/src/test/ui/wf/wf-enum-bound.stderr index 3313eb20508..487592dcaca 100644 --- a/src/test/ui/wf/wf-enum-bound.stderr +++ b/src/test/ui/wf/wf-enum-bound.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-enum-bound.rs:19:1 + --> $DIR/wf-enum-bound.rs:9:1 | LL | / enum SomeEnum //~ ERROR E0277 LL | | where T: ExtraCopy @@ -10,7 +10,7 @@ LL | | } | = help: consider adding a `where U: std::marker::Copy` bound note: required by `ExtraCopy` - --> $DIR/wf-enum-bound.rs:17:1 + --> $DIR/wf-enum-bound.rs:7:1 | LL | trait ExtraCopy { } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-enum-fields-struct-variant.rs b/src/test/ui/wf/wf-enum-fields-struct-variant.rs index 572b609fe2e..c25622fa753 100644 --- a/src/test/ui/wf/wf-enum-fields-struct-variant.rs +++ b/src/test/ui/wf/wf-enum-fields-struct-variant.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check struct fields for WFedness. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr index 86a605f073c..f4b8ec0c668 100644 --- a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr +++ b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied - --> $DIR/wf-enum-fields-struct-variant.rs:23:9 + --> $DIR/wf-enum-fields-struct-variant.rs:13:9 | LL | f: IsCopy //~ ERROR E0277 | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | = help: consider adding a `where A: std::marker::Copy` bound note: required by `IsCopy` - --> $DIR/wf-enum-fields-struct-variant.rs:17:1 + --> $DIR/wf-enum-fields-struct-variant.rs:7:1 | LL | struct IsCopy { | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-enum-fields.rs b/src/test/ui/wf/wf-enum-fields.rs index 32e870e9e1b..a465ffe5ecb 100644 --- a/src/test/ui/wf/wf-enum-fields.rs +++ b/src/test/ui/wf/wf-enum-fields.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check struct fields for WFedness. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-enum-fields.stderr b/src/test/ui/wf/wf-enum-fields.stderr index 5aa263f389a..600dd3dc03d 100644 --- a/src/test/ui/wf/wf-enum-fields.stderr +++ b/src/test/ui/wf/wf-enum-fields.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied - --> $DIR/wf-enum-fields.rs:22:17 + --> $DIR/wf-enum-fields.rs:12:17 | LL | SomeVariant(IsCopy) //~ ERROR E0277 | ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | = help: consider adding a `where A: std::marker::Copy` bound note: required by `IsCopy` - --> $DIR/wf-enum-fields.rs:17:1 + --> $DIR/wf-enum-fields.rs:7:1 | LL | struct IsCopy { | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-fn-where-clause.rs b/src/test/ui/wf/wf-fn-where-clause.rs index 3d97bdb521f..5fd567bd32d 100644 --- a/src/test/ui/wf/wf-fn-where-clause.rs +++ b/src/test/ui/wf/wf-fn-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check where-clauses on fn items. diff --git a/src/test/ui/wf/wf-fn-where-clause.stderr b/src/test/ui/wf/wf-fn-where-clause.stderr index 21591419ec8..594ce7d2f49 100644 --- a/src/test/ui/wf/wf-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-fn-where-clause.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-fn-where-clause.rs:18:1 + --> $DIR/wf-fn-where-clause.rs:8:1 | LL | / fn foo() where T: ExtraCopy //~ ERROR E0277 LL | | { @@ -8,23 +8,23 @@ LL | | } | = help: consider adding a `where U: std::marker::Copy` bound note: required by `ExtraCopy` - --> $DIR/wf-fn-where-clause.rs:16:1 + --> $DIR/wf-fn-where-clause.rs:6:1 | LL | trait ExtraCopy { } | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the size for values of type `(dyn std::marker::Copy + 'static)` cannot be known at compilation time - --> $DIR/wf-fn-where-clause.rs:22:1 + --> $DIR/wf-fn-where-clause.rs:12:1 | LL | fn bar() where Vec:, {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `(dyn std::marker::Copy + 'static)` - = note: to learn more, visit + = note: to learn more, visit = note: required by `std::vec::Vec` error[E0038]: the trait `std::marker::Copy` cannot be made into an object - --> $DIR/wf-fn-where-clause.rs:22:1 + --> $DIR/wf-fn-where-clause.rs:12:1 | LL | fn bar() where Vec:, {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object diff --git a/src/test/ui/wf/wf-impl-associated-type-region.rs b/src/test/ui/wf/wf-impl-associated-type-region.rs index aa88b3d7377..1bf8d366344 100644 --- a/src/test/ui/wf/wf-impl-associated-type-region.rs +++ b/src/test/ui/wf/wf-impl-associated-type-region.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we require that associated types in an impl are well-formed. diff --git a/src/test/ui/wf/wf-impl-associated-type-region.stderr b/src/test/ui/wf/wf-impl-associated-type-region.stderr index f238b3c0d13..de7e8fa9a28 100644 --- a/src/test/ui/wf/wf-impl-associated-type-region.stderr +++ b/src/test/ui/wf/wf-impl-associated-type-region.stderr @@ -1,5 +1,5 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/wf-impl-associated-type-region.rs:20:5 + --> $DIR/wf-impl-associated-type-region.rs:10:5 | LL | impl<'a, T> Foo<'a> for T { | - help: consider adding an explicit lifetime bound `T: 'a`... @@ -7,7 +7,7 @@ LL | type Bar = &'a T; //~ ERROR E0309 | ^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a T` does not outlive the data it points at - --> $DIR/wf-impl-associated-type-region.rs:20:5 + --> $DIR/wf-impl-associated-type-region.rs:10:5 | LL | type Bar = &'a T; //~ ERROR E0309 | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-impl-associated-type-trait.rs b/src/test/ui/wf/wf-impl-associated-type-trait.rs index 0b5a76db262..84e628e2185 100644 --- a/src/test/ui/wf/wf-impl-associated-type-trait.rs +++ b/src/test/ui/wf/wf-impl-associated-type-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we require that associated types in an impl are well-formed. diff --git a/src/test/ui/wf/wf-impl-associated-type-trait.stderr b/src/test/ui/wf/wf-impl-associated-type-trait.stderr index 595c5b4d8fd..158b55a3f41 100644 --- a/src/test/ui/wf/wf-impl-associated-type-trait.stderr +++ b/src/test/ui/wf/wf-impl-associated-type-trait.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `T: MyHash` is not satisfied - --> $DIR/wf-impl-associated-type-trait.rs:27:5 + --> $DIR/wf-impl-associated-type-trait.rs:17:5 | LL | type Bar = MySet; | ^^^^^^^^^^^^^^^^^^^^ the trait `MyHash` is not implemented for `T` | = help: consider adding a `where T: MyHash` bound note: required by `MySet` - --> $DIR/wf-impl-associated-type-trait.rs:18:1 + --> $DIR/wf-impl-associated-type-trait.rs:8:1 | LL | pub struct MySet { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-in-fn-arg.rs b/src/test/ui/wf/wf-in-fn-arg.rs index e302cac0006..18df723360b 100644 --- a/src/test/ui/wf/wf-in-fn-arg.rs +++ b/src/test/ui/wf/wf-in-fn-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we enforce WF conditions also for argument types in fn items. #![feature(rustc_attrs)] diff --git a/src/test/ui/wf/wf-in-fn-arg.stderr b/src/test/ui/wf/wf-in-fn-arg.stderr index f82bc1674df..987984060e6 100644 --- a/src/test/ui/wf/wf-in-fn-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-arg.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/wf-in-fn-arg.rs:20:1 + --> $DIR/wf-in-fn-arg.rs:10:1 | LL | / fn bar(_: &MustBeCopy) //~ ERROR E0277 LL | | { @@ -8,7 +8,7 @@ LL | | } | = help: consider adding a `where T: std::marker::Copy` bound note: required by `MustBeCopy` - --> $DIR/wf-in-fn-arg.rs:16:1 + --> $DIR/wf-in-fn-arg.rs:6:1 | LL | struct MustBeCopy { | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-in-fn-ret.rs b/src/test/ui/wf/wf-in-fn-ret.rs index 719bc9282ad..4c9535184ff 100644 --- a/src/test/ui/wf/wf-in-fn-ret.rs +++ b/src/test/ui/wf/wf-in-fn-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we enforce WF conditions also for return types in fn items. #![feature(rustc_attrs)] diff --git a/src/test/ui/wf/wf-in-fn-ret.stderr b/src/test/ui/wf/wf-in-fn-ret.stderr index 357199c4e31..81aae855b84 100644 --- a/src/test/ui/wf/wf-in-fn-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-ret.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/wf-in-fn-ret.rs:20:1 + --> $DIR/wf-in-fn-ret.rs:10:1 | LL | / fn bar() -> MustBeCopy //~ ERROR E0277 LL | | { @@ -8,7 +8,7 @@ LL | | } | = help: consider adding a `where T: std::marker::Copy` bound note: required by `MustBeCopy` - --> $DIR/wf-in-fn-ret.rs:16:1 + --> $DIR/wf-in-fn-ret.rs:6:1 | LL | struct MustBeCopy { | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-in-fn-type-arg.rs b/src/test/ui/wf/wf-in-fn-type-arg.rs index 08ee0e954ac..2917a8aa98c 100644 --- a/src/test/ui/wf/wf-in-fn-type-arg.rs +++ b/src/test/ui/wf/wf-in-fn-type-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we enforce WF conditions also for types in fns. struct MustBeCopy { diff --git a/src/test/ui/wf/wf-in-fn-type-arg.stderr b/src/test/ui/wf/wf-in-fn-type-arg.stderr index 7e3d22b262c..e60529dba1e 100644 --- a/src/test/ui/wf/wf-in-fn-type-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-type-arg.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/wf-in-fn-type-arg.rs:19:5 + --> $DIR/wf-in-fn-type-arg.rs:9:5 | LL | x: fn(MustBeCopy) //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound note: required by `MustBeCopy` - --> $DIR/wf-in-fn-type-arg.rs:13:1 + --> $DIR/wf-in-fn-type-arg.rs:3:1 | LL | struct MustBeCopy { | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-in-fn-type-ret.rs b/src/test/ui/wf/wf-in-fn-type-ret.rs index 6942f786060..ab8e697e3b9 100644 --- a/src/test/ui/wf/wf-in-fn-type-ret.rs +++ b/src/test/ui/wf/wf-in-fn-type-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we enforce WF conditions also for types in fns. struct MustBeCopy { diff --git a/src/test/ui/wf/wf-in-fn-type-ret.stderr b/src/test/ui/wf/wf-in-fn-type-ret.stderr index 5d592532d28..9f18a00926d 100644 --- a/src/test/ui/wf/wf-in-fn-type-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-type-ret.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/wf-in-fn-type-ret.rs:19:5 + --> $DIR/wf-in-fn-type-ret.rs:9:5 | LL | x: fn() -> MustBeCopy //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound note: required by `MustBeCopy` - --> $DIR/wf-in-fn-type-ret.rs:13:1 + --> $DIR/wf-in-fn-type-ret.rs:3:1 | LL | struct MustBeCopy { | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-in-fn-type-static.rs b/src/test/ui/wf/wf-in-fn-type-static.rs index dfe6688c0b7..73071dd23ad 100644 --- a/src/test/ui/wf/wf-in-fn-type-static.rs +++ b/src/test/ui/wf/wf-in-fn-type-static.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we enforce WF conditions related to regions also for // types in fns. diff --git a/src/test/ui/wf/wf-in-fn-type-static.stderr b/src/test/ui/wf/wf-in-fn-type-static.stderr index 0013331f010..1fabfb04add 100644 --- a/src/test/ui/wf/wf-in-fn-type-static.stderr +++ b/src/test/ui/wf/wf-in-fn-type-static.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/wf-in-fn-type-static.rs:23:5 + --> $DIR/wf-in-fn-type-static.rs:13:5 | LL | struct Foo { | - help: consider adding an explicit lifetime bound `T: 'static`... @@ -8,13 +8,13 @@ LL | x: fn() -> &'static T //~ ERROR E0310 | ^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at - --> $DIR/wf-in-fn-type-static.rs:23:5 + --> $DIR/wf-in-fn-type-static.rs:13:5 | LL | x: fn() -> &'static T //~ ERROR E0310 | ^^^^^^^^^^^^^^^^^^^^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/wf-in-fn-type-static.rs:28:5 + --> $DIR/wf-in-fn-type-static.rs:18:5 | LL | struct Bar { | - help: consider adding an explicit lifetime bound `T: 'static`... @@ -23,7 +23,7 @@ LL | x: fn(&'static T) //~ ERROR E0310 | ^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at - --> $DIR/wf-in-fn-type-static.rs:28:5 + --> $DIR/wf-in-fn-type-static.rs:18:5 | LL | x: fn(&'static T) //~ ERROR E0310 | ^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-in-fn-where-clause.rs b/src/test/ui/wf/wf-in-fn-where-clause.rs index f6f14099e73..65a1771d41a 100644 --- a/src/test/ui/wf/wf-in-fn-where-clause.rs +++ b/src/test/ui/wf/wf-in-fn-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we enforce WF conditions also for where clauses in fn items. diff --git a/src/test/ui/wf/wf-in-fn-where-clause.stderr b/src/test/ui/wf/wf-in-fn-where-clause.stderr index 76693eace2f..8d6700e3571 100644 --- a/src/test/ui/wf/wf-in-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-in-fn-where-clause.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-in-fn-where-clause.rs:19:1 + --> $DIR/wf-in-fn-where-clause.rs:9:1 | LL | / fn bar() //~ ERROR E0277 LL | | where T: MustBeCopy @@ -9,7 +9,7 @@ LL | | } | = help: consider adding a `where U: std::marker::Copy` bound note: required by `MustBeCopy` - --> $DIR/wf-in-fn-where-clause.rs:16:1 + --> $DIR/wf-in-fn-where-clause.rs:6:1 | LL | trait MustBeCopy { | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-in-obj-type-static.rs b/src/test/ui/wf/wf-in-obj-type-static.rs index 7cbcf99af3c..858a75ab1ab 100644 --- a/src/test/ui/wf/wf-in-obj-type-static.rs +++ b/src/test/ui/wf/wf-in-obj-type-static.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we enforce WF conditions also for types in fns. diff --git a/src/test/ui/wf/wf-in-obj-type-static.stderr b/src/test/ui/wf/wf-in-obj-type-static.stderr index 5cbb4be7e92..9e0628e3ec6 100644 --- a/src/test/ui/wf/wf-in-obj-type-static.stderr +++ b/src/test/ui/wf/wf-in-obj-type-static.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/wf-in-obj-type-static.rs:24:5 + --> $DIR/wf-in-obj-type-static.rs:14:5 | LL | struct Foo { | - help: consider adding an explicit lifetime bound `T: 'static`... @@ -8,7 +8,7 @@ LL | x: Object<&'static T> //~ ERROR E0310 | ^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at - --> $DIR/wf-in-obj-type-static.rs:24:5 + --> $DIR/wf-in-obj-type-static.rs:14:5 | LL | x: Object<&'static T> //~ ERROR E0310 | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-in-obj-type-trait.rs b/src/test/ui/wf/wf-in-obj-type-trait.rs index add48219c1d..fad1da199ea 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.rs +++ b/src/test/ui/wf/wf-in-obj-type-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we enforce WF conditions also for types in fns. trait Object { } diff --git a/src/test/ui/wf/wf-in-obj-type-trait.stderr b/src/test/ui/wf/wf-in-obj-type-trait.stderr index 93af991cc93..a4a14817d3f 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.stderr +++ b/src/test/ui/wf/wf-in-obj-type-trait.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/wf-in-obj-type-trait.rs:21:5 + --> $DIR/wf-in-obj-type-trait.rs:11:5 | LL | x: Object> //~ ERROR E0277 | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound note: required by `MustBeCopy` - --> $DIR/wf-in-obj-type-trait.rs:15:1 + --> $DIR/wf-in-obj-type-trait.rs:5:1 | LL | struct MustBeCopy { | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-inherent-impl-method-where-clause.rs b/src/test/ui/wf/wf-inherent-impl-method-where-clause.rs index 8b65b2e1626..eb50fc01085 100644 --- a/src/test/ui/wf/wf-inherent-impl-method-where-clause.rs +++ b/src/test/ui/wf/wf-inherent-impl-method-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check where-clauses on inherent impl methods. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr index 25ec4195ab1..ba9d3d7877d 100644 --- a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-inherent-impl-method-where-clause.rs:22:5 + --> $DIR/wf-inherent-impl-method-where-clause.rs:12:5 | LL | / fn foo(self) where T: ExtraCopy //~ ERROR E0277 LL | | {} @@ -7,7 +7,7 @@ LL | | {} | = help: consider adding a `where U: std::marker::Copy` bound note: required by `ExtraCopy` - --> $DIR/wf-inherent-impl-method-where-clause.rs:17:1 + --> $DIR/wf-inherent-impl-method-where-clause.rs:7:1 | LL | trait ExtraCopy { } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-inherent-impl-where-clause.rs b/src/test/ui/wf/wf-inherent-impl-where-clause.rs index ee929282849..ac194fb136d 100644 --- a/src/test/ui/wf/wf-inherent-impl-where-clause.rs +++ b/src/test/ui/wf/wf-inherent-impl-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check where-clauses on inherent impls. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr index 3c5c557db42..2ed9cc56f94 100644 --- a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-inherent-impl-where-clause.rs:21:1 + --> $DIR/wf-inherent-impl-where-clause.rs:11:1 | LL | / impl Foo where T: ExtraCopy //~ ERROR E0277 LL | | { @@ -8,7 +8,7 @@ LL | | } | = help: consider adding a `where U: std::marker::Copy` bound note: required by `ExtraCopy` - --> $DIR/wf-inherent-impl-where-clause.rs:17:1 + --> $DIR/wf-inherent-impl-where-clause.rs:7:1 | LL | trait ExtraCopy { } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr index f938c219478..21ac2031d04 100644 --- a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr +++ b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr @@ -1,5 +1,5 @@ error[E0515]: cannot return value referencing temporary value - --> $DIR/wf-misc-methods-issue-28609.rs:32:5 + --> $DIR/wf-misc-methods-issue-28609.rs:22:5 | LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^^^^^^^^^^^--^ @@ -8,7 +8,7 @@ LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough | returns a value referencing data owned by the current function error[E0515]: cannot return value referencing local variable `four` - --> $DIR/wf-misc-methods-issue-28609.rs:46:5 + --> $DIR/wf-misc-methods-issue-28609.rs:36:5 | LL | s.bomb = Some(&four); //~ ERROR does not live long enough | ----- `four` is borrowed here @@ -16,7 +16,7 @@ LL | &s | ^^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing local variable `four` - --> $DIR/wf-misc-methods-issue-28609.rs:53:5 + --> $DIR/wf-misc-methods-issue-28609.rs:43:5 | LL | s.bomb = Some(&four); //~ ERROR does not live long enough | ----- `four` is borrowed here @@ -24,7 +24,7 @@ LL | &*s | ^^^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing temporary value - --> $DIR/wf-misc-methods-issue-28609.rs:63:5 + --> $DIR/wf-misc-methods-issue-28609.rs:53:5 | LL | s << &mut 3 //~ ERROR does not live long enough | ^^^^^^^^^^- @@ -33,7 +33,7 @@ LL | s << &mut 3 //~ ERROR does not live long enough | returns a value referencing data owned by the current function error[E0515]: cannot return value referencing temporary value - --> $DIR/wf-misc-methods-issue-28609.rs:68:5 + --> $DIR/wf-misc-methods-issue-28609.rs:58:5 | LL | s.shl(&mut 3) //~ ERROR does not live long enough | ^^^^^^^^^^^-^ @@ -42,7 +42,7 @@ LL | s.shl(&mut 3) //~ ERROR does not live long enough | returns a value referencing data owned by the current function error[E0515]: cannot return value referencing temporary value - --> $DIR/wf-misc-methods-issue-28609.rs:73:5 + --> $DIR/wf-misc-methods-issue-28609.rs:63:5 | LL | S2::shl(s, &mut 3) //~ ERROR does not live long enough | ^^^^^^^^^^^^^^^^-^ diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.rs b/src/test/ui/wf/wf-misc-methods-issue-28609.rs index 055c86a03a7..505d7d75d53 100644 --- a/src/test/ui/wf/wf-misc-methods-issue-28609.rs +++ b/src/test/ui/wf/wf-misc-methods-issue-28609.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that misc. method calls are well-formed use std::marker::PhantomData; diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.stderr index 352697e6f94..46dc4dc8870 100644 --- a/src/test/ui/wf/wf-misc-methods-issue-28609.stderr +++ b/src/test/ui/wf/wf-misc-methods-issue-28609.stderr @@ -1,13 +1,13 @@ error[E0597]: borrowed value does not live long enough - --> $DIR/wf-misc-methods-issue-28609.rs:32:31 + --> $DIR/wf-misc-methods-issue-28609.rs:22:31 | LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough | ^^ temporary value does not live long enough LL | } | - temporary value only lives until here | -note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 30:1... - --> $DIR/wf-misc-methods-issue-28609.rs:30:1 +note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 20:1... + --> $DIR/wf-misc-methods-issue-28609.rs:20:1 | LL | / fn return_dangling_pointer_inherent(s: S2) -> &u32 { LL | | let s = s; @@ -16,7 +16,7 @@ LL | | } | |_^ error[E0597]: `four` does not live long enough - --> $DIR/wf-misc-methods-issue-28609.rs:45:20 + --> $DIR/wf-misc-methods-issue-28609.rs:35:20 | LL | s.bomb = Some(&four); //~ ERROR does not live long enough | ^^^^ borrowed value does not live long enough @@ -24,8 +24,8 @@ LL | &s LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 42:1... - --> $DIR/wf-misc-methods-issue-28609.rs:42:1 +note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 32:1... + --> $DIR/wf-misc-methods-issue-28609.rs:32:1 | LL | / fn return_dangling_pointer_coerce(s: S2) -> &u32 { LL | | let four = 4; @@ -36,7 +36,7 @@ LL | | } | |_^ error[E0597]: `four` does not live long enough - --> $DIR/wf-misc-methods-issue-28609.rs:52:20 + --> $DIR/wf-misc-methods-issue-28609.rs:42:20 | LL | s.bomb = Some(&four); //~ ERROR does not live long enough | ^^^^ borrowed value does not live long enough @@ -44,8 +44,8 @@ LL | &*s LL | } | - borrowed value only lives until here | -note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 49:1... - --> $DIR/wf-misc-methods-issue-28609.rs:49:1 +note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 39:1... + --> $DIR/wf-misc-methods-issue-28609.rs:39:1 | LL | / fn return_dangling_pointer_unary_op(s: S2) -> &u32 { LL | | let four = 4; @@ -56,15 +56,15 @@ LL | | } | |_^ error[E0597]: borrowed value does not live long enough - --> $DIR/wf-misc-methods-issue-28609.rs:63:15 + --> $DIR/wf-misc-methods-issue-28609.rs:53:15 | LL | s << &mut 3 //~ ERROR does not live long enough | ^ temporary value does not live long enough LL | } | - temporary value only lives until here | -note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 61:1... - --> $DIR/wf-misc-methods-issue-28609.rs:61:1 +note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 51:1... + --> $DIR/wf-misc-methods-issue-28609.rs:51:1 | LL | / fn return_dangling_pointer_binary_op(s: S2) -> &u32 { LL | | let s = s; @@ -73,15 +73,15 @@ LL | | } | |_^ error[E0597]: borrowed value does not live long enough - --> $DIR/wf-misc-methods-issue-28609.rs:68:16 + --> $DIR/wf-misc-methods-issue-28609.rs:58:16 | LL | s.shl(&mut 3) //~ ERROR does not live long enough | ^ temporary value does not live long enough LL | } | - temporary value only lives until here | -note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 66:1... - --> $DIR/wf-misc-methods-issue-28609.rs:66:1 +note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 56:1... + --> $DIR/wf-misc-methods-issue-28609.rs:56:1 | LL | / fn return_dangling_pointer_method(s: S2) -> &u32 { LL | | let s = s; @@ -90,15 +90,15 @@ LL | | } | |_^ error[E0597]: borrowed value does not live long enough - --> $DIR/wf-misc-methods-issue-28609.rs:73:21 + --> $DIR/wf-misc-methods-issue-28609.rs:63:21 | LL | S2::shl(s, &mut 3) //~ ERROR does not live long enough | ^ temporary value does not live long enough LL | } | - temporary value only lives until here | -note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 71:1... - --> $DIR/wf-misc-methods-issue-28609.rs:71:1 +note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 61:1... + --> $DIR/wf-misc-methods-issue-28609.rs:61:1 | LL | / fn return_dangling_pointer_ufcs(s: S2) -> &u32 { LL | | let s = s; diff --git a/src/test/ui/wf/wf-object-safe.rs b/src/test/ui/wf/wf-object-safe.rs index 92c0a8c5be8..08f68f6c004 100644 --- a/src/test/ui/wf/wf-object-safe.rs +++ b/src/test/ui/wf/wf-object-safe.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that object-safe traits are not WF when used as object types. // Issue #21953. diff --git a/src/test/ui/wf/wf-object-safe.stderr b/src/test/ui/wf/wf-object-safe.stderr index 3d42c52136b..2a514d9d2c2 100644 --- a/src/test/ui/wf/wf-object-safe.stderr +++ b/src/test/ui/wf/wf-object-safe.stderr @@ -1,5 +1,5 @@ error[E0038]: the trait `A` cannot be made into an object - --> $DIR/wf-object-safe.rs:19:13 + --> $DIR/wf-object-safe.rs:9:13 | LL | let _x: &A; //~ ERROR E0038 | ^^ the trait `A` cannot be made into an object diff --git a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs index afdf59d1e5b..1c4cda261d1 100644 --- a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs +++ b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_attrs)] #![allow(dead_code)] @@ -16,7 +6,7 @@ trait Trait<'a, T> { } impl<'a, T> Trait<'a, T> for usize { - type Out = &'a fn(T); + type Out = &'a fn(T); //~ ERROR `T` may not live long enough } struct Foo<'a,T> { @@ -26,7 +16,7 @@ struct Foo<'a,T> { trait Baz { } impl<'a, T> Trait<'a, T> for u32 { - type Out = &'a Baz; + type Out = &'a Baz; //~ ERROR `T` may not live long enough } fn main() { } diff --git a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr index 26a2138c9f8..04f8c70bbf4 100644 --- a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr +++ b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr @@ -1,29 +1,29 @@ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:5 + --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:5 | LL | impl<'a, T> Trait<'a, T> for usize { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a fn(T); +LL | type Out = &'a fn(T); //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a fn(T)` does not outlive the data it points at - --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:5 + --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:5 | -LL | type Out = &'a fn(T); +LL | type Out = &'a fn(T); //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough - --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:29:5 + --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:5 | LL | impl<'a, T> Trait<'a, T> for u32 { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a Baz; +LL | type Out = &'a Baz; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a (dyn Baz + 'a)` does not outlive the data it points at - --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:29:5 + --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:5 | -LL | type Out = &'a Baz; +LL | type Out = &'a Baz; //~ ERROR `T` may not live long enough | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/wf/wf-static-method.rs b/src/test/ui/wf/wf-static-method.rs index e99957c7914..e5a1092175d 100644 --- a/src/test/ui/wf/wf-static-method.rs +++ b/src/test/ui/wf/wf-static-method.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // check that static methods don't get to assume their trait-ref // is well-formed. // FIXME(#27579): this is just a bug. However, our checking with diff --git a/src/test/ui/wf/wf-static-method.stderr b/src/test/ui/wf/wf-static-method.stderr index 0de2d8e6ca0..78ea903e699 100644 --- a/src/test/ui/wf/wf-static-method.stderr +++ b/src/test/ui/wf/wf-static-method.stderr @@ -1,104 +1,104 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/wf-static-method.rs:27:9 + --> $DIR/wf-static-method.rs:17:9 | LL | u //~ ERROR E0312 | ^ | -note: ...the reference is valid for the lifetime 'a as defined on the impl at 24:6... - --> $DIR/wf-static-method.rs:24:6 +note: ...the reference is valid for the lifetime 'a as defined on the impl at 14:6... + --> $DIR/wf-static-method.rs:14:6 | LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { | ^^ -note: ...but the borrowed content is only valid for the lifetime 'b as defined on the impl at 24:10 - --> $DIR/wf-static-method.rs:24:10 +note: ...but the borrowed content is only valid for the lifetime 'b as defined on the impl at 14:10 + --> $DIR/wf-static-method.rs:14:10 | LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { | ^^ error[E0478]: lifetime bound not satisfied - --> $DIR/wf-static-method.rs:36:18 + --> $DIR/wf-static-method.rs:26:18 | LL | let me = Self::make_me(); //~ ERROR lifetime bound not satisfied | ^^^^^^^^^^^^^ | -note: lifetime parameter instantiated with the lifetime 'b as defined on the impl at 33:10 - --> $DIR/wf-static-method.rs:33:10 +note: lifetime parameter instantiated with the lifetime 'b as defined on the impl at 23:10 + --> $DIR/wf-static-method.rs:23:10 | LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> { | ^^ -note: but lifetime parameter must outlive the lifetime 'a as defined on the impl at 33:6 - --> $DIR/wf-static-method.rs:33:6 +note: but lifetime parameter must outlive the lifetime 'a as defined on the impl at 23:6 + --> $DIR/wf-static-method.rs:23:6 | LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> { | ^^ error[E0312]: lifetime of reference outlives lifetime of borrowed content... - --> $DIR/wf-static-method.rs:43:9 + --> $DIR/wf-static-method.rs:33:9 | LL | u //~ ERROR E0312 | ^ | -note: ...the reference is valid for the lifetime 'a as defined on the impl at 41:6... - --> $DIR/wf-static-method.rs:41:6 +note: ...the reference is valid for the lifetime 'a as defined on the impl at 31:6... + --> $DIR/wf-static-method.rs:31:6 | LL | impl<'a, 'b> Evil<'a, 'b> { | ^^ -note: ...but the borrowed content is only valid for the lifetime 'b as defined on the impl at 41:10 - --> $DIR/wf-static-method.rs:41:10 +note: ...but the borrowed content is only valid for the lifetime 'b as defined on the impl at 31:10 + --> $DIR/wf-static-method.rs:31:10 | LL | impl<'a, 'b> Evil<'a, 'b> { | ^^ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements - --> $DIR/wf-static-method.rs:51:5 + --> $DIR/wf-static-method.rs:41:5 | LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime | ^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'b as defined on the function body at 50:13... - --> $DIR/wf-static-method.rs:50:13 +note: first, the lifetime cannot outlive the lifetime 'b as defined on the function body at 40:13... + --> $DIR/wf-static-method.rs:40:13 | LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/wf-static-method.rs:51:23 + --> $DIR/wf-static-method.rs:41:23 | LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime | ^ -note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 50:9... - --> $DIR/wf-static-method.rs:50:9 +note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 40:9... + --> $DIR/wf-static-method.rs:40:9 | LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/wf-static-method.rs:51:5 + --> $DIR/wf-static-method.rs:41:5 | LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime | ^^^^^^^^^^^^^^^^^^^^ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements - --> $DIR/wf-static-method.rs:55:5 + --> $DIR/wf-static-method.rs:45:5 | LL | ::static_evil(b) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: first, the lifetime cannot outlive the lifetime 'b as defined on the function body at 54:22... - --> $DIR/wf-static-method.rs:54:22 +note: first, the lifetime cannot outlive the lifetime 'b as defined on the function body at 44:22... + --> $DIR/wf-static-method.rs:44:22 | LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/wf-static-method.rs:55:33 + --> $DIR/wf-static-method.rs:45:33 | LL | ::static_evil(b) | ^ -note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 54:18... - --> $DIR/wf-static-method.rs:54:18 +note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 44:18... + --> $DIR/wf-static-method.rs:44:18 | LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 { | ^^ note: ...so that reference does not outlive borrowed content - --> $DIR/wf-static-method.rs:55:5 + --> $DIR/wf-static-method.rs:45:5 | LL | ::static_evil(b) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-static-type.rs b/src/test/ui/wf/wf-static-type.rs index 91943b44d97..1c35e1daf44 100644 --- a/src/test/ui/wf/wf-static-type.rs +++ b/src/test/ui/wf/wf-static-type.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check the types of statics are well-formed. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-static-type.stderr b/src/test/ui/wf/wf-static-type.stderr index c9656d86546..4234c7161b1 100644 --- a/src/test/ui/wf/wf-static-type.stderr +++ b/src/test/ui/wf/wf-static-type.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `NotCopy: std::marker::Copy` is not satisfied - --> $DIR/wf-static-type.rs:20:13 + --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `NotCopy` | = note: required because of the requirements on the impl of `std::marker::Copy` for `std::option::Option` note: required by `IsCopy` - --> $DIR/wf-static-type.rs:17:1 + --> $DIR/wf-static-type.rs:7:1 | LL | struct IsCopy { t: T } | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-struct-bound.rs b/src/test/ui/wf/wf-struct-bound.rs index c4a15bbe540..69be71cd130 100644 --- a/src/test/ui/wf/wf-struct-bound.rs +++ b/src/test/ui/wf/wf-struct-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check struct bounds for WFedness. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-struct-bound.stderr b/src/test/ui/wf/wf-struct-bound.stderr index 397d8609ceb..37defb87ee5 100644 --- a/src/test/ui/wf/wf-struct-bound.stderr +++ b/src/test/ui/wf/wf-struct-bound.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-struct-bound.rs:19:1 + --> $DIR/wf-struct-bound.rs:9:1 | LL | / struct SomeStruct //~ ERROR E0277 LL | | where T: ExtraCopy @@ -10,7 +10,7 @@ LL | | } | = help: consider adding a `where U: std::marker::Copy` bound note: required by `ExtraCopy` - --> $DIR/wf-struct-bound.rs:17:1 + --> $DIR/wf-struct-bound.rs:7:1 | LL | trait ExtraCopy { } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-struct-field.rs b/src/test/ui/wf/wf-struct-field.rs index 4d1e42829d8..63f8b438251 100644 --- a/src/test/ui/wf/wf-struct-field.rs +++ b/src/test/ui/wf/wf-struct-field.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check struct fields for WFedness. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-struct-field.stderr b/src/test/ui/wf/wf-struct-field.stderr index 48a03c71d7d..e31552b4089 100644 --- a/src/test/ui/wf/wf-struct-field.stderr +++ b/src/test/ui/wf/wf-struct-field.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied - --> $DIR/wf-struct-field.rs:22:5 + --> $DIR/wf-struct-field.rs:12:5 | LL | data: IsCopy //~ ERROR E0277 | ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | = help: consider adding a `where A: std::marker::Copy` bound note: required by `IsCopy` - --> $DIR/wf-struct-field.rs:17:1 + --> $DIR/wf-struct-field.rs:7:1 | LL | struct IsCopy { | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-trait-associated-type-bound.rs b/src/test/ui/wf/wf-trait-associated-type-bound.rs index eaeffa01740..29e305577ac 100644 --- a/src/test/ui/wf/wf-trait-associated-type-bound.rs +++ b/src/test/ui/wf/wf-trait-associated-type-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check associated type bounds for WFedness. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-trait-associated-type-bound.stderr b/src/test/ui/wf/wf-trait-associated-type-bound.stderr index f09ba381db1..f8ba74a2fdc 100644 --- a/src/test/ui/wf/wf-trait-associated-type-bound.stderr +++ b/src/test/ui/wf/wf-trait-associated-type-bound.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/wf-trait-associated-type-bound.rs:19:1 + --> $DIR/wf-trait-associated-type-bound.rs:9:1 | LL | / trait SomeTrait { //~ ERROR E0277 LL | | type Type1: ExtraCopy; @@ -8,7 +8,7 @@ LL | | } | = help: consider adding a `where T: std::marker::Copy` bound note: required by `ExtraCopy` - --> $DIR/wf-trait-associated-type-bound.rs:17:1 + --> $DIR/wf-trait-associated-type-bound.rs:7:1 | LL | trait ExtraCopy { } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-trait-associated-type-region.rs b/src/test/ui/wf/wf-trait-associated-type-region.rs index 61cdbe5e491..0dfc9f098a6 100644 --- a/src/test/ui/wf/wf-trait-associated-type-region.rs +++ b/src/test/ui/wf/wf-trait-associated-type-region.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check associated type default values for WFedness. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-trait-associated-type-region.stderr b/src/test/ui/wf/wf-trait-associated-type-region.stderr index 26d56f7e964..9bbfad90cdb 100644 --- a/src/test/ui/wf/wf-trait-associated-type-region.stderr +++ b/src/test/ui/wf/wf-trait-associated-type-region.stderr @@ -1,12 +1,12 @@ error[E0309]: the associated type `>::Type1` may not live long enough - --> $DIR/wf-trait-associated-type-region.rs:19:5 + --> $DIR/wf-trait-associated-type-region.rs:9:5 | LL | type Type2 = &'a Self::Type1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `>::Type1: 'a`... note: ...so that the reference type `&'a >::Type1` does not outlive the data it points at - --> $DIR/wf-trait-associated-type-region.rs:19:5 + --> $DIR/wf-trait-associated-type-region.rs:9:5 | LL | type Type2 = &'a Self::Type1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-trait-associated-type-trait.rs b/src/test/ui/wf/wf-trait-associated-type-trait.rs index e752c0a9077..ddc0b323a11 100644 --- a/src/test/ui/wf/wf-trait-associated-type-trait.rs +++ b/src/test/ui/wf/wf-trait-associated-type-trait.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check associated type default values for WFedness. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-trait-associated-type-trait.stderr b/src/test/ui/wf/wf-trait-associated-type-trait.stderr index 6bfca64c443..70fabcd4b30 100644 --- a/src/test/ui/wf/wf-trait-associated-type-trait.stderr +++ b/src/test/ui/wf/wf-trait-associated-type-trait.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `::Type1: std::marker::Copy` is not satisfied - --> $DIR/wf-trait-associated-type-trait.rs:21:5 + --> $DIR/wf-trait-associated-type-trait.rs:11:5 | LL | type Type2 = IsCopy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `::Type1` | = help: consider adding a `where ::Type1: std::marker::Copy` bound note: required by `IsCopy` - --> $DIR/wf-trait-associated-type-trait.rs:17:1 + --> $DIR/wf-trait-associated-type-trait.rs:7:1 | LL | struct IsCopy { x: T } | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-trait-bound.rs b/src/test/ui/wf/wf-trait-bound.rs index c02281ab4f9..d8746ba4d6e 100644 --- a/src/test/ui/wf/wf-trait-bound.rs +++ b/src/test/ui/wf/wf-trait-bound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check supertrait bounds for WFedness. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-trait-bound.stderr b/src/test/ui/wf/wf-trait-bound.stderr index 4c21959d9f7..585571a6a3c 100644 --- a/src/test/ui/wf/wf-trait-bound.stderr +++ b/src/test/ui/wf/wf-trait-bound.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied - --> $DIR/wf-trait-bound.rs:19:1 + --> $DIR/wf-trait-bound.rs:9:1 | LL | / trait SomeTrait //~ ERROR E0277 LL | | where T: ExtraCopy @@ -9,7 +9,7 @@ LL | | } | = help: consider adding a `where U: std::marker::Copy` bound note: required by `ExtraCopy` - --> $DIR/wf-trait-bound.rs:17:1 + --> $DIR/wf-trait-bound.rs:7:1 | LL | trait ExtraCopy { } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-trait-default-fn-arg.rs b/src/test/ui/wf/wf-trait-default-fn-arg.rs index 8577bc89638..64fc35aeb1e 100644 --- a/src/test/ui/wf/wf-trait-default-fn-arg.rs +++ b/src/test/ui/wf/wf-trait-default-fn-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we test WF conditions for fn arguments. Because the // current code is so goofy, this is only a warning for now. diff --git a/src/test/ui/wf/wf-trait-default-fn-arg.stderr b/src/test/ui/wf/wf-trait-default-fn-arg.stderr index 5754fd77b72..eeafc06db34 100644 --- a/src/test/ui/wf/wf-trait-default-fn-arg.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-arg.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied - --> $DIR/wf-trait-default-fn-arg.rs:21:5 + --> $DIR/wf-trait-default-fn-arg.rs:11:5 | LL | / fn bar(&self, x: &Bar) { LL | | //~^ ERROR E0277 @@ -10,7 +10,7 @@ LL | | } | = help: consider adding a `where Self: std::cmp::Eq` bound note: required by `Bar` - --> $DIR/wf-trait-default-fn-arg.rs:18:1 + --> $DIR/wf-trait-default-fn-arg.rs:8:1 | LL | struct Bar { value: Box } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-trait-default-fn-ret.rs b/src/test/ui/wf/wf-trait-default-fn-ret.rs index d94708d3e06..2103dae8d23 100644 --- a/src/test/ui/wf/wf-trait-default-fn-ret.rs +++ b/src/test/ui/wf/wf-trait-default-fn-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we test WF conditions for fn arguments. Because the // current code is so goofy, this is only a warning for now. diff --git a/src/test/ui/wf/wf-trait-default-fn-ret.stderr b/src/test/ui/wf/wf-trait-default-fn-ret.stderr index 28d690b1b05..7fabd6b4713 100644 --- a/src/test/ui/wf/wf-trait-default-fn-ret.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-ret.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied - --> $DIR/wf-trait-default-fn-ret.rs:21:5 + --> $DIR/wf-trait-default-fn-ret.rs:11:5 | LL | / fn bar(&self) -> Bar { LL | | //~^ ERROR E0277 @@ -11,7 +11,7 @@ LL | | } | = help: consider adding a `where Self: std::cmp::Eq` bound note: required by `Bar` - --> $DIR/wf-trait-default-fn-ret.rs:18:1 + --> $DIR/wf-trait-default-fn-ret.rs:8:1 | LL | struct Bar { value: Box } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-trait-default-fn-where-clause.rs b/src/test/ui/wf/wf-trait-default-fn-where-clause.rs index b1576719870..ded97214f93 100644 --- a/src/test/ui/wf/wf-trait-default-fn-where-clause.rs +++ b/src/test/ui/wf/wf-trait-default-fn-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we test WF conditions for fn arguments. Because the // current code is so goofy, this is only a warning for now. diff --git a/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr b/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr index c135f199a26..669dd08b21f 100644 --- a/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied - --> $DIR/wf-trait-default-fn-where-clause.rs:21:5 + --> $DIR/wf-trait-default-fn-where-clause.rs:11:5 | LL | / fn bar(&self) where A: Bar { LL | | //~^ ERROR E0277 @@ -10,7 +10,7 @@ LL | | } | = help: consider adding a `where Self: std::cmp::Eq` bound note: required by `Bar` - --> $DIR/wf-trait-default-fn-where-clause.rs:18:1 + --> $DIR/wf-trait-default-fn-where-clause.rs:8:1 | LL | trait Bar { } | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-trait-fn-arg.rs b/src/test/ui/wf/wf-trait-fn-arg.rs index d88e36faeec..0445699427e 100644 --- a/src/test/ui/wf/wf-trait-fn-arg.rs +++ b/src/test/ui/wf/wf-trait-fn-arg.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we test WF conditions for fn arguments in a trait definition. #![feature(rustc_attrs)] diff --git a/src/test/ui/wf/wf-trait-fn-arg.stderr b/src/test/ui/wf/wf-trait-fn-arg.stderr index 6d624fc62ff..2b26eac9c06 100644 --- a/src/test/ui/wf/wf-trait-fn-arg.stderr +++ b/src/test/ui/wf/wf-trait-fn-arg.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied - --> $DIR/wf-trait-fn-arg.rs:20:5 + --> $DIR/wf-trait-fn-arg.rs:10:5 | LL | fn bar(&self, x: &Bar); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Self` | = help: consider adding a `where Self: std::cmp::Eq` bound note: required by `Bar` - --> $DIR/wf-trait-fn-arg.rs:17:1 + --> $DIR/wf-trait-fn-arg.rs:7:1 | LL | struct Bar { value: Box } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-trait-fn-ret.rs b/src/test/ui/wf/wf-trait-fn-ret.rs index c368ff9a4a8..f49e4308770 100644 --- a/src/test/ui/wf/wf-trait-fn-ret.rs +++ b/src/test/ui/wf/wf-trait-fn-ret.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we test WF conditions for fn return types in a trait definition. #![feature(rustc_attrs)] diff --git a/src/test/ui/wf/wf-trait-fn-ret.stderr b/src/test/ui/wf/wf-trait-fn-ret.stderr index dca26a63079..70f07f02e93 100644 --- a/src/test/ui/wf/wf-trait-fn-ret.stderr +++ b/src/test/ui/wf/wf-trait-fn-ret.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied - --> $DIR/wf-trait-fn-ret.rs:20:5 + --> $DIR/wf-trait-fn-ret.rs:10:5 | LL | fn bar(&self) -> &Bar; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Self` | = help: consider adding a `where Self: std::cmp::Eq` bound note: required by `Bar` - --> $DIR/wf-trait-fn-ret.rs:17:1 + --> $DIR/wf-trait-fn-ret.rs:7:1 | LL | struct Bar { value: Box } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-trait-fn-where-clause.rs b/src/test/ui/wf/wf-trait-fn-where-clause.rs index 44e3d6bda5c..1d2427ff981 100644 --- a/src/test/ui/wf/wf-trait-fn-where-clause.rs +++ b/src/test/ui/wf/wf-trait-fn-where-clause.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Check that we test WF conditions for fn where clauses in a trait definition. diff --git a/src/test/ui/wf/wf-trait-fn-where-clause.stderr b/src/test/ui/wf/wf-trait-fn-where-clause.stderr index 887f60935b0..2d6223e6d93 100644 --- a/src/test/ui/wf/wf-trait-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-trait-fn-where-clause.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied - --> $DIR/wf-trait-fn-where-clause.rs:20:5 + --> $DIR/wf-trait-fn-where-clause.rs:10:5 | LL | fn bar(&self) where Self: Sized, Bar: Copy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Self` | = help: consider adding a `where Self: std::cmp::Eq` bound note: required by `Bar` - --> $DIR/wf-trait-fn-where-clause.rs:17:1 + --> $DIR/wf-trait-fn-where-clause.rs:7:1 | LL | struct Bar { value: Box } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/wf/wf-trait-superbound.rs b/src/test/ui/wf/wf-trait-superbound.rs index ea8b2fdf3a1..8905a882014 100644 --- a/src/test/ui/wf/wf-trait-superbound.rs +++ b/src/test/ui/wf/wf-trait-superbound.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we check supertrait bounds for WFedness. #![feature(associated_type_defaults)] diff --git a/src/test/ui/wf/wf-trait-superbound.stderr b/src/test/ui/wf/wf-trait-superbound.stderr index ac58dc7496e..0bcda407d9c 100644 --- a/src/test/ui/wf/wf-trait-superbound.stderr +++ b/src/test/ui/wf/wf-trait-superbound.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/wf-trait-superbound.rs:19:1 + --> $DIR/wf-trait-superbound.rs:9:1 | LL | / trait SomeTrait: ExtraCopy { //~ ERROR E0277 LL | | } @@ -7,7 +7,7 @@ LL | | } | = help: consider adding a `where T: std::marker::Copy` bound note: required by `ExtraCopy` - --> $DIR/wf-trait-superbound.rs:17:1 + --> $DIR/wf-trait-superbound.rs:7:1 | LL | trait ExtraCopy { } | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.rs b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.rs index 458ee669424..e55316bb92e 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.rs +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn require_copy(x: T) {} struct Foo { x: T } diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr index 0d6906a85d5..125b65b1872 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/where-clause-constraints-are-local-for-inherent-impl.rs:23:9 + --> $DIR/where-clause-constraints-are-local-for-inherent-impl.rs:13:9 | LL | require_copy(self.x); | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound note: required by `require_copy` - --> $DIR/where-clause-constraints-are-local-for-inherent-impl.rs:11:1 + --> $DIR/where-clause-constraints-are-local-for-inherent-impl.rs:1:1 | LL | fn require_copy(x: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.rs b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.rs index b3f99f2ae25..b628a2ae142 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.rs +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn require_copy(x: T) {} struct Bar { x: T } diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr index 976cca7b895..eb555b181f4 100644 --- a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr +++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr @@ -1,12 +1,12 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/where-clause-constraints-are-local-for-trait-impl.rs:28:9 + --> $DIR/where-clause-constraints-are-local-for-trait-impl.rs:18:9 | LL | require_copy(self.x); | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound note: required by `require_copy` - --> $DIR/where-clause-constraints-are-local-for-trait-impl.rs:11:1 + --> $DIR/where-clause-constraints-are-local-for-trait-impl.rs:1:1 | LL | fn require_copy(x: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/where-clauses/where-clause-method-substituion.rs b/src/test/ui/where-clauses/where-clause-method-substituion.rs index 05a58daf906..4607783c098 100644 --- a/src/test/ui/where-clauses/where-clause-method-substituion.rs +++ b/src/test/ui/where-clauses/where-clause-method-substituion.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Foo { fn dummy(&self, t: T) { } } diff --git a/src/test/ui/where-clauses/where-clause-method-substituion.stderr b/src/test/ui/where-clauses/where-clause-method-substituion.stderr index 5cd4c395869..cb381d2d9fe 100644 --- a/src/test/ui/where-clauses/where-clause-method-substituion.stderr +++ b/src/test/ui/where-clauses/where-clause-method-substituion.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `X: Foo` is not satisfied - --> $DIR/where-clause-method-substituion.rs:30:7 + --> $DIR/where-clause-method-substituion.rs:20:7 | LL | 1.method::(); | ^^^^^^ the trait `Foo` is not implemented for `X` diff --git a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.rs b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.rs index 1ac03330afd..d63f37a7221 100644 --- a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.rs +++ b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that a where clause attached to a method allows us to add // additional constraints to a parameter out of scope. diff --git a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr index eeb0b51b80a..60bcba09e97 100644 --- a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr +++ b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Bar: std::cmp::Eq` is not satisfied - --> $DIR/where-clauses-method-unsatisfied.rs:28:7 + --> $DIR/where-clauses-method-unsatisfied.rs:18:7 | LL | x.equals(&x); | ^^^^^^ the trait `std::cmp::Eq` is not implemented for `Bar` diff --git a/src/test/ui/where-clauses/where-clauses-unsatisfied.rs b/src/test/ui/where-clauses/where-clauses-unsatisfied.rs index ffc39008c4e..83620e5cf3a 100644 --- a/src/test/ui/where-clauses/where-clauses-unsatisfied.rs +++ b/src/test/ui/where-clauses/where-clauses-unsatisfied.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn equal(a: &T, b: &T) -> bool where T : Eq { a == b } struct Struct; diff --git a/src/test/ui/where-clauses/where-clauses-unsatisfied.stderr b/src/test/ui/where-clauses/where-clauses-unsatisfied.stderr index dd042599382..fb69e2d1411 100644 --- a/src/test/ui/where-clauses/where-clauses-unsatisfied.stderr +++ b/src/test/ui/where-clauses/where-clauses-unsatisfied.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `Struct: std::cmp::Eq` is not satisfied - --> $DIR/where-clauses-unsatisfied.rs:16:10 + --> $DIR/where-clauses-unsatisfied.rs:6:10 | LL | drop(equal(&Struct, &Struct)) | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Struct` | note: required by `equal` - --> $DIR/where-clauses-unsatisfied.rs:11:1 + --> $DIR/where-clauses-unsatisfied.rs:1:1 | LL | fn equal(a: &T, b: &T) -> bool where T : Eq { a == b } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/where-clauses/where-equality-constraints.rs b/src/test/ui/where-clauses/where-equality-constraints.rs index e449a736c75..f2349144b88 100644 --- a/src/test/ui/where-clauses/where-equality-constraints.rs +++ b/src/test/ui/where-clauses/where-equality-constraints.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - fn f() where u8 = u16 {} //~^ ERROR equality constraints are not yet supported in where clauses fn g() where for<'a> &'static (u8,) == u16, {} diff --git a/src/test/ui/where-clauses/where-equality-constraints.stderr b/src/test/ui/where-clauses/where-equality-constraints.stderr index f2bcfacc452..220447079c6 100644 --- a/src/test/ui/where-clauses/where-equality-constraints.stderr +++ b/src/test/ui/where-clauses/where-equality-constraints.stderr @@ -1,11 +1,11 @@ -error: equality constraints are not yet supported in where clauses (#20041) - --> $DIR/where-equality-constraints.rs:11:14 +error: equality constraints are not yet supported in where clauses (see #20041) + --> $DIR/where-equality-constraints.rs:1:14 | LL | fn f() where u8 = u16 {} | ^^^^^^^^ -error: equality constraints are not yet supported in where clauses (#20041) - --> $DIR/where-equality-constraints.rs:13:14 +error: equality constraints are not yet supported in where clauses (see #20041) + --> $DIR/where-equality-constraints.rs:3:14 | LL | fn g() where for<'a> &'static (u8,) == u16, {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/where-clauses/where-for-self-2.rs b/src/test/ui/where-clauses/where-for-self-2.rs index 6179bdb34a3..0ce38e69f6b 100644 --- a/src/test/ui/where-clauses/where-for-self-2.rs +++ b/src/test/ui/where-clauses/where-for-self-2.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can quantify lifetimes outside a constraint (i.e., including // the self type) in a where clause. Specifically, test that implementing for a // specific lifetime is not enough to satisfy the `for<'a> ...` constraint, which @@ -28,6 +18,5 @@ fn foo(x: &T) {} fn main() { - foo(&X); - //~^ error: `for<'a> &'a _: Bar` is not satisfied + foo(&X); //~ ERROR implementation of `Bar` is not general enough } diff --git a/src/test/ui/where-clauses/where-for-self-2.stderr b/src/test/ui/where-clauses/where-for-self-2.stderr index d234c718215..342cabfd6bf 100644 --- a/src/test/ui/where-clauses/where-for-self-2.stderr +++ b/src/test/ui/where-clauses/where-for-self-2.stderr @@ -1,19 +1,12 @@ -error[E0277]: the trait bound `for<'a> &'a _: Bar` is not satisfied - --> $DIR/where-for-self-2.rs:31:5 +error: implementation of `Bar` is not general enough + --> $DIR/where-for-self-2.rs:21:5 | -LL | foo(&X); - | ^^^ the trait `for<'a> Bar` is not implemented for `&'a _` +LL | foo(&X); //~ ERROR implementation of `Bar` is not general enough + | ^^^ | - = help: the following implementations were found: - <&'static u32 as Bar> -note: required by `foo` - --> $DIR/where-for-self-2.rs:26:1 - | -LL | / fn foo(x: &T) -LL | | where for<'a> &'a T: Bar -LL | | {} - | |__^ + = note: Due to a where-clause on `foo`, + = note: `Bar` would have to be implemented for the type `&'0 u32`, for any lifetime `'0` + = note: but `Bar` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1` error: aborting due to previous error -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/where-clauses/where-for-self.rs b/src/test/ui/where-clauses/where-for-self.rs index 8f447face4e..9380e72cd7c 100644 --- a/src/test/ui/where-clauses/where-for-self.rs +++ b/src/test/ui/where-clauses/where-for-self.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // Test that we can quantify lifetimes outside a constraint (i.e., including // the self type) in a where clause. Specifically, test that we cannot nest // quantification in constraints (to be clear, there is no reason this should not diff --git a/src/test/ui/where-clauses/where-for-self.stderr b/src/test/ui/where-clauses/where-for-self.stderr index 89c0bd023c3..d06afc1e423 100644 --- a/src/test/ui/where-clauses/where-for-self.stderr +++ b/src/test/ui/where-clauses/where-for-self.stderr @@ -1,5 +1,5 @@ error[E0316]: nested quantification of lifetimes - --> $DIR/where-for-self.rs:25:26 + --> $DIR/where-for-self.rs:15:26 | LL | where for<'a> &'a T: for<'b> Bar<'b> | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/where-clauses/where-lifetime-resolution.rs b/src/test/ui/where-clauses/where-lifetime-resolution.rs index 1204cc0df47..4c46a77ae29 100644 --- a/src/test/ui/where-clauses/where-lifetime-resolution.rs +++ b/src/test/ui/where-clauses/where-lifetime-resolution.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - trait Trait1<'a> {} trait Trait2<'a, 'b> {} diff --git a/src/test/ui/where-clauses/where-lifetime-resolution.stderr b/src/test/ui/where-clauses/where-lifetime-resolution.stderr index a6fc1b25962..ce6354b0ae7 100644 --- a/src/test/ui/where-clauses/where-lifetime-resolution.stderr +++ b/src/test/ui/where-clauses/where-lifetime-resolution.stderr @@ -1,17 +1,17 @@ error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/where-lifetime-resolution.rs:16:34 + --> $DIR/where-lifetime-resolution.rs:6:34 | LL | (for<'a> Trait1<'a>): Trait1<'a>, | ^^ undeclared lifetime error[E0316]: nested quantification of lifetimes - --> $DIR/where-lifetime-resolution.rs:18:13 + --> $DIR/where-lifetime-resolution.rs:8:13 | LL | for<'a> for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, | ^^^^^^^^^^^^^^^^^^^^^^ error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/where-lifetime-resolution.rs:18:48 + --> $DIR/where-lifetime-resolution.rs:8:48 | LL | for<'a> for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>, | ^^ undeclared lifetime diff --git a/src/test/ui/while-let.rs b/src/test/ui/while-let.rs index a70dcccd4e8..69f9de94977 100644 --- a/src/test/ui/while-let.rs +++ b/src/test/ui/while-let.rs @@ -1,12 +1,4 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +// run-pass fn macros() { macro_rules! foo{ @@ -20,16 +12,17 @@ fn macros() { }} } - foo!(a, 1, { //~ ERROR irrefutable while-let + foo!(a, 1, { //~ WARN irrefutable while-let println!("irrefutable pattern"); }); - bar!(a, 1, { //~ ERROR irrefutable while-let + bar!(a, 1, { //~ WARN irrefutable while-let println!("irrefutable pattern"); }); } pub fn main() { - while let a = 1 { //~ ERROR irrefutable while-let + while let a = 1 { //~ WARN irrefutable while-let println!("irrefutable pattern"); + break; } } diff --git a/src/test/ui/while-let.stderr b/src/test/ui/while-let.stderr index de4d8be212e..6d61143d33c 100644 --- a/src/test/ui/while-let.stderr +++ b/src/test/ui/while-let.stderr @@ -1,21 +1,33 @@ -error[E0165]: irrefutable while-let pattern - --> $DIR/while-let.rs:23:10 +warning: irrefutable while-let pattern + --> $DIR/while-let.rs:6:13 | -LL | foo!(a, 1, { //~ ERROR irrefutable while-let - | ^ irrefutable pattern - -error[E0165]: irrefutable while-let pattern - --> $DIR/while-let.rs:26:10 +LL | while let $p = $e $b + | ^^^^^ +... +LL | / foo!(a, 1, { //~ WARN irrefutable while-let +LL | | println!("irrefutable pattern"); +LL | | }); + | |_______- in this macro invocation | -LL | bar!(a, 1, { //~ ERROR irrefutable while-let - | ^ irrefutable pattern + = note: #[warn(irrefutable_let_patterns)] on by default -error[E0165]: irrefutable while-let pattern - --> $DIR/while-let.rs:32:15 +warning: irrefutable while-let pattern + --> $DIR/while-let.rs:6:13 | -LL | while let a = 1 { //~ ERROR irrefutable while-let - | ^ irrefutable pattern +LL | while let $p = $e $b + | ^^^^^ +... +LL | / bar!(a, 1, { //~ WARN irrefutable while-let +LL | | println!("irrefutable pattern"); +LL | | }); + | |_______- in this macro invocation -error: aborting due to 3 previous errors +warning: irrefutable while-let pattern + --> $DIR/while-let.rs:24:5 + | +LL | / while let a = 1 { //~ WARN irrefutable while-let +LL | | println!("irrefutable pattern"); +LL | | break; +LL | | } + | |_____^ -For more information about this error, try `rustc --explain E0165`. diff --git a/src/test/ui/while-type-error.rs b/src/test/ui/while-type-error.rs index ecab746373a..8098bfcd8d9 100644 --- a/src/test/ui/while-type-error.rs +++ b/src/test/ui/while-type-error.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: mismatched types fn main() { while main { } } diff --git a/src/test/ui/while-type-error.stderr b/src/test/ui/while-type-error.stderr index cfc3f3e257e..15169673fe9 100644 --- a/src/test/ui/while-type-error.stderr +++ b/src/test/ui/while-type-error.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/while-type-error.rs:13:19 + --> $DIR/while-type-error.rs:3:19 | LL | fn main() { while main { } } | ^^^^ expected bool, found fn item diff --git a/src/test/ui/windows-subsystem-invalid.rs b/src/test/ui/windows-subsystem-invalid.rs index 7772cfd6a2c..0336678b712 100644 --- a/src/test/ui/windows-subsystem-invalid.rs +++ b/src/test/ui/windows-subsystem-invalid.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: invalid windows subsystem `wrong`, only `windows` and `console` are allowed #![windows_subsystem = "wrong"] diff --git a/src/test/ui/write-to-static-mut-in-static.rs b/src/test/ui/write-to-static-mut-in-static.rs index 1ea74f73723..43c63fed8ce 100644 --- a/src/test/ui/write-to-static-mut-in-static.rs +++ b/src/test/ui/write-to-static-mut-in-static.rs @@ -1,21 +1,9 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(const_let)] - pub static mut A: u32 = 0; pub static mut B: () = unsafe { A = 1; }; -//~^ ERROR statements in statics are unstable +//~^ ERROR could not evaluate static initializer pub static mut C: u32 = unsafe { C = 1; 0 }; -//~^ ERROR statements in statics are unstable +//~^ ERROR cycle detected pub static D: u32 = D; diff --git a/src/test/ui/write-to-static-mut-in-static.stderr b/src/test/ui/write-to-static-mut-in-static.stderr index f07d240746f..eba1c609d2f 100644 --- a/src/test/ui/write-to-static-mut-in-static.stderr +++ b/src/test/ui/write-to-static-mut-in-static.stderr @@ -1,19 +1,28 @@ -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/write-to-static-mut-in-static.rs:14:33 +error[E0080]: could not evaluate static initializer + --> $DIR/write-to-static-mut-in-static.rs:2:33 | LL | pub static mut B: () = unsafe { A = 1; }; - | ^^^^^ - | - = help: add #![feature(const_let)] to the crate attributes to enable + | ^^^^^ tried to modify a static's initial value from another static's initializer -error[E0658]: statements in statics are unstable (see issue #48821) - --> $DIR/write-to-static-mut-in-static.rs:17:34 +error[E0391]: cycle detected when const-evaluating `C` + --> $DIR/write-to-static-mut-in-static.rs:5:34 | LL | pub static mut C: u32 = unsafe { C = 1; 0 }; | ^^^^^ | - = help: add #![feature(const_let)] to the crate attributes to enable +note: ...which requires const-evaluating `C`... + --> $DIR/write-to-static-mut-in-static.rs:5:1 + | +LL | pub static mut C: u32 = unsafe { C = 1; 0 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: ...which again requires const-evaluating `C`, completing the cycle +note: cycle used when const-evaluating + checking `C` + --> $DIR/write-to-static-mut-in-static.rs:5:1 + | +LL | pub static mut C: u32 = unsafe { C = 1; 0 }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors occurred: E0080, E0391. +For more information about an error, try `rustc --explain E0080`. diff --git a/src/test/ui/writing-to-immutable-vec.nll.stderr b/src/test/ui/writing-to-immutable-vec.nll.stderr index 96899276b97..6ec56f90ca4 100644 --- a/src/test/ui/writing-to-immutable-vec.nll.stderr +++ b/src/test/ui/writing-to-immutable-vec.nll.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable - --> $DIR/writing-to-immutable-vec.rs:14:5 + --> $DIR/writing-to-immutable-vec.rs:3:5 | LL | let v: Vec = vec![1, 2, 3]; | - help: consider changing this to be mutable: `mut v` diff --git a/src/test/ui/writing-to-immutable-vec.rs b/src/test/ui/writing-to-immutable-vec.rs index f289b85992e..ad2bf33fc20 100644 --- a/src/test/ui/writing-to-immutable-vec.rs +++ b/src/test/ui/writing-to-immutable-vec.rs @@ -1,14 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - fn main() { let v: Vec = vec![1, 2, 3]; v[1] = 4; //~ ERROR cannot borrow immutable local variable `v` as mutable diff --git a/src/test/ui/writing-to-immutable-vec.stderr b/src/test/ui/writing-to-immutable-vec.stderr index d1e09521dd8..3a99186b46f 100644 --- a/src/test/ui/writing-to-immutable-vec.stderr +++ b/src/test/ui/writing-to-immutable-vec.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow immutable local variable `v` as mutable - --> $DIR/writing-to-immutable-vec.rs:14:5 + --> $DIR/writing-to-immutable-vec.rs:3:5 | LL | let v: Vec = vec![1, 2, 3]; | - help: make this binding mutable: `mut v` diff --git a/src/test/ui/wrong-mul-method-signature.rs b/src/test/ui/wrong-mul-method-signature.rs index 069fd2dec99..54e2af55259 100644 --- a/src/test/ui/wrong-mul-method-signature.rs +++ b/src/test/ui/wrong-mul-method-signature.rs @@ -1,13 +1,3 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // This test is to make sure we don't just ICE if the trait // method for an operator is not implemented properly. // (In this case the mul method should take &f64 and not f64) diff --git a/src/test/ui/wrong-mul-method-signature.stderr b/src/test/ui/wrong-mul-method-signature.stderr index 7c4d22c7cca..8630ebcb580 100644 --- a/src/test/ui/wrong-mul-method-signature.stderr +++ b/src/test/ui/wrong-mul-method-signature.stderr @@ -1,5 +1,5 @@ error[E0053]: method `mul` has an incompatible type for trait - --> $DIR/wrong-mul-method-signature.rs:26:5 + --> $DIR/wrong-mul-method-signature.rs:16:5 | LL | fn mul(self, s: &f64) -> Vec1 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected f64, found &f64 @@ -8,7 +8,7 @@ LL | fn mul(self, s: &f64) -> Vec1 { found type `fn(Vec1, &f64) -> Vec1` error[E0053]: method `mul` has an incompatible type for trait - --> $DIR/wrong-mul-method-signature.rs:43:5 + --> $DIR/wrong-mul-method-signature.rs:33:5 | LL | fn mul(self, s: f64) -> Vec2 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Vec2`, found f64 @@ -17,7 +17,7 @@ LL | fn mul(self, s: f64) -> Vec2 { found type `fn(Vec2, f64) -> Vec2` error[E0053]: method `mul` has an incompatible type for trait - --> $DIR/wrong-mul-method-signature.rs:62:5 + --> $DIR/wrong-mul-method-signature.rs:52:5 | LL | fn mul(self, s: f64) -> f64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found f64 diff --git a/src/test/ui/wrong-ret-type.rs b/src/test/ui/wrong-ret-type.rs index 6db11fcffd2..cbff8dbae21 100644 --- a/src/test/ui/wrong-ret-type.rs +++ b/src/test/ui/wrong-ret-type.rs @@ -1,13 +1,3 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // error-pattern: mismatched types fn mk_int() -> usize { let i: isize = 3; return i; } fn main() { } diff --git a/src/test/ui/wrong-ret-type.stderr b/src/test/ui/wrong-ret-type.stderr index 4ff6f707603..cf59f42683d 100644 --- a/src/test/ui/wrong-ret-type.stderr +++ b/src/test/ui/wrong-ret-type.stderr @@ -1,8 +1,10 @@ error[E0308]: mismatched types - --> $DIR/wrong-ret-type.rs:12:49 + --> $DIR/wrong-ret-type.rs:2:49 | LL | fn mk_int() -> usize { let i: isize = 3; return i; } - | ^ expected usize, found isize + | ----- ^ expected usize, found isize + | | + | expected `usize` because of return type error: aborting due to previous error diff --git a/src/test/ui/xc-private-method.rs b/src/test/ui/xc-private-method.rs index edc0e31040d..157249194a3 100644 --- a/src/test/ui/xc-private-method.rs +++ b/src/test/ui/xc-private-method.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:xc_private_method_lib.rs extern crate xc_private_method_lib; diff --git a/src/test/ui/xc-private-method.stderr b/src/test/ui/xc-private-method.stderr index 35078e73d46..91bec2551c1 100644 --- a/src/test/ui/xc-private-method.stderr +++ b/src/test/ui/xc-private-method.stderr @@ -1,11 +1,11 @@ error[E0624]: method `static_meth_struct` is private - --> $DIR/xc-private-method.rs:16:13 + --> $DIR/xc-private-method.rs:6:13 | LL | let _ = xc_private_method_lib::Struct::static_meth_struct(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0624]: method `static_meth_enum` is private - --> $DIR/xc-private-method.rs:19:13 + --> $DIR/xc-private-method.rs:9:13 | LL | let _ = xc_private_method_lib::Enum::static_meth_enum(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/xc-private-method2.rs b/src/test/ui/xc-private-method2.rs index 26e055d7cbb..6d73570318a 100644 --- a/src/test/ui/xc-private-method2.rs +++ b/src/test/ui/xc-private-method2.rs @@ -1,13 +1,3 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:xc_private_method_lib.rs extern crate xc_private_method_lib; diff --git a/src/test/ui/xc-private-method2.stderr b/src/test/ui/xc-private-method2.stderr index d671aa35817..36ad850fb19 100644 --- a/src/test/ui/xc-private-method2.stderr +++ b/src/test/ui/xc-private-method2.stderr @@ -1,11 +1,11 @@ error[E0624]: method `meth_struct` is private - --> $DIR/xc-private-method2.rs:16:52 + --> $DIR/xc-private-method2.rs:6:52 | LL | let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct(); | ^^^^^^^^^^^ error[E0624]: method `meth_enum` is private - --> $DIR/xc-private-method2.rs:19:55 + --> $DIR/xc-private-method2.rs:9:55 | LL | let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum(); | ^^^^^^^^^ diff --git a/src/test/ui/xcrate/auxiliary/static_priv_by_default.rs b/src/test/ui/xcrate/auxiliary/static_priv_by_default.rs index 73597e51f08..39f912066ec 100644 --- a/src/test/ui/xcrate/auxiliary/static_priv_by_default.rs +++ b/src/test/ui/xcrate/auxiliary/static_priv_by_default.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] static private: isize = 0; diff --git a/src/test/ui/xcrate/auxiliary/xcrate_unit_struct.rs b/src/test/ui/xcrate/auxiliary/xcrate_unit_struct.rs index 7a69be2b06c..69ed498e7e1 100644 --- a/src/test/ui/xcrate/auxiliary/xcrate_unit_struct.rs +++ b/src/test/ui/xcrate/auxiliary/xcrate_unit_struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_type = "lib"] // used by the rpass test diff --git a/src/test/ui/xcrate/xcrate-private-by-default.rs b/src/test/ui/xcrate/xcrate-private-by-default.rs index 7dd4d970945..299cff54f34 100644 --- a/src/test/ui/xcrate/xcrate-private-by-default.rs +++ b/src/test/ui/xcrate/xcrate-private-by-default.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:static_priv_by_default.rs extern crate static_priv_by_default; diff --git a/src/test/ui/xcrate/xcrate-private-by-default.stderr b/src/test/ui/xcrate/xcrate-private-by-default.stderr index ea1f6aaa7d2..da52b4249e3 100644 --- a/src/test/ui/xcrate/xcrate-private-by-default.stderr +++ b/src/test/ui/xcrate/xcrate-private-by-default.stderr @@ -1,59 +1,59 @@ error[E0603]: static `j` is private - --> $DIR/xcrate-private-by-default.rs:33:29 + --> $DIR/xcrate-private-by-default.rs:23:29 | LL | static_priv_by_default::j; | ^ error[E0603]: function `k` is private - --> $DIR/xcrate-private-by-default.rs:35:29 + --> $DIR/xcrate-private-by-default.rs:25:29 | LL | static_priv_by_default::k; | ^ error[E0603]: unit struct `l` is private - --> $DIR/xcrate-private-by-default.rs:37:29 + --> $DIR/xcrate-private-by-default.rs:27:29 | LL | static_priv_by_default::l; | ^ error[E0603]: enum `m` is private - --> $DIR/xcrate-private-by-default.rs:39:35 + --> $DIR/xcrate-private-by-default.rs:29:35 | LL | foo::(); | ^ error[E0603]: type alias `n` is private - --> $DIR/xcrate-private-by-default.rs:41:35 + --> $DIR/xcrate-private-by-default.rs:31:35 | LL | foo::(); | ^ error[E0603]: module `foo` is private - --> $DIR/xcrate-private-by-default.rs:45:29 + --> $DIR/xcrate-private-by-default.rs:35:29 | LL | static_priv_by_default::foo::a; | ^^^ error[E0603]: module `foo` is private - --> $DIR/xcrate-private-by-default.rs:47:29 + --> $DIR/xcrate-private-by-default.rs:37:29 | LL | static_priv_by_default::foo::b; | ^^^ error[E0603]: module `foo` is private - --> $DIR/xcrate-private-by-default.rs:49:29 + --> $DIR/xcrate-private-by-default.rs:39:29 | LL | static_priv_by_default::foo::c; | ^^^ error[E0603]: module `foo` is private - --> $DIR/xcrate-private-by-default.rs:51:35 + --> $DIR/xcrate-private-by-default.rs:41:35 | LL | foo::(); | ^^^ error[E0603]: module `foo` is private - --> $DIR/xcrate-private-by-default.rs:53:35 + --> $DIR/xcrate-private-by-default.rs:43:35 | LL | foo::(); | ^^^ diff --git a/src/test/ui/xcrate/xcrate-unit-struct.rs b/src/test/ui/xcrate/xcrate-unit-struct.rs index 04af7133000..c99cf77ce7a 100644 --- a/src/test/ui/xcrate/xcrate-unit-struct.rs +++ b/src/test/ui/xcrate/xcrate-unit-struct.rs @@ -1,13 +1,3 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // aux-build:xcrate_unit_struct.rs // Make sure that when we have cross-crate unit structs we don't accidentally diff --git a/src/test/ui/xcrate/xcrate-unit-struct.stderr b/src/test/ui/xcrate/xcrate-unit-struct.stderr index 9ee4cb3ba17..e4a4b9c5806 100644 --- a/src/test/ui/xcrate/xcrate-unit-struct.stderr +++ b/src/test/ui/xcrate/xcrate-unit-struct.stderr @@ -1,5 +1,5 @@ error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithFields` - --> $DIR/xcrate-unit-struct.rs:19:13 + --> $DIR/xcrate-unit-struct.rs:9:13 | LL | let _ = xcrate_unit_struct::StructWithFields; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `xcrate_unit_struct::StructWithFields { /* fields */ }`? diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index bf95b31ae3c..4ca285b9b1d 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -1,20 +1,10 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - extern crate toml; #[macro_use] extern crate serde_derive; use std::collections::BTreeMap; use std::env; -use std::fs::File; +use std::fs; use std::io::{self, Read, Write}; use std::path::{PathBuf, Path}; use std::process::{Command, Stdio}; @@ -61,7 +51,9 @@ static TARGETS: &'static [&'static str] = &[ "armv5te-unknown-linux-musleabi", "armv7-apple-ios", "armv7-linux-androideabi", + "thumbv7neon-linux-androideabi", "armv7-unknown-linux-gnueabihf", + "thumbv7neon-unknown-linux-gnueabihf", "armv7-unknown-linux-musleabihf", "armebv7r-none-eabi", "armebv7r-none-eabihf", @@ -98,10 +90,12 @@ static TARGETS: &'static [&'static str] = &[ "thumbv7em-none-eabi", "thumbv7em-none-eabihf", "thumbv7m-none-eabi", + "thumbv8m.main-none-eabi", "wasm32-unknown-emscripten", "wasm32-unknown-unknown", "x86_64-apple-darwin", "x86_64-apple-ios", + "x86_64-fortanix-unknown-sgx", "x86_64-fuchsia", "x86_64-linux-android", "x86_64-pc-windows-gnu", @@ -139,7 +133,8 @@ struct Manifest { manifest_version: String, date: String, pkg: BTreeMap, - renames: BTreeMap + renames: BTreeMap, + profiles: BTreeMap>, } #[derive(Serialize)] @@ -200,6 +195,7 @@ struct Builder { rustfmt_release: String, llvm_tools_release: String, lldb_release: String, + miri_release: String, input: PathBuf, output: PathBuf, @@ -215,6 +211,7 @@ struct Builder { rustfmt_version: Option, llvm_tools_version: Option, lldb_version: Option, + miri_version: Option, rust_git_commit_hash: Option, cargo_git_commit_hash: Option, @@ -223,6 +220,7 @@ struct Builder { rustfmt_git_commit_hash: Option, llvm_tools_git_commit_hash: Option, lldb_git_commit_hash: Option, + miri_git_commit_hash: Option, should_sign: bool, } @@ -245,13 +243,14 @@ fn main() { let output = PathBuf::from(args.next().unwrap()); let date = args.next().unwrap(); let rust_release = args.next().unwrap(); + let s3_address = args.next().unwrap(); let cargo_release = args.next().unwrap(); let rls_release = args.next().unwrap(); let clippy_release = args.next().unwrap(); + let miri_release = args.next().unwrap(); let rustfmt_release = args.next().unwrap(); let llvm_tools_release = args.next().unwrap(); let lldb_release = args.next().unwrap(); - let s3_address = args.next().unwrap(); // Do not ask for a passphrase while manually testing let mut passphrase = String::new(); @@ -267,6 +266,7 @@ fn main() { rustfmt_release, llvm_tools_release, lldb_release, + miri_release, input, output, @@ -282,6 +282,7 @@ fn main() { rustfmt_version: None, llvm_tools_version: None, lldb_version: None, + miri_version: None, rust_git_commit_hash: None, cargo_git_commit_hash: None, @@ -290,6 +291,7 @@ fn main() { rustfmt_git_commit_hash: None, llvm_tools_git_commit_hash: None, lldb_git_commit_hash: None, + miri_git_commit_hash: None, should_sign, }.build(); @@ -305,6 +307,7 @@ impl Builder { self.llvm_tools_version = self.version("llvm-tools", "x86_64-unknown-linux-gnu"); // lldb is only built for macOS. self.lldb_version = self.version("lldb", "x86_64-apple-darwin"); + self.miri_version = self.version("miri", "x86_64-unknown-linux-gnu"); self.rust_git_commit_hash = self.git_commit_hash("rust", "x86_64-unknown-linux-gnu"); self.cargo_git_commit_hash = self.git_commit_hash("cargo", "x86_64-unknown-linux-gnu"); @@ -314,6 +317,7 @@ impl Builder { self.llvm_tools_git_commit_hash = self.git_commit_hash("llvm-tools", "x86_64-unknown-linux-gnu"); self.lldb_git_commit_hash = self.git_commit_hash("lldb", "x86_64-unknown-linux-gnu"); + self.miri_git_commit_hash = self.git_commit_hash("miri", "x86_64-unknown-linux-gnu"); self.digest_and_sign(); let manifest = self.build_manifest(); @@ -339,6 +343,7 @@ impl Builder { date: self.date.to_string(), pkg: BTreeMap::new(), renames: BTreeMap::new(), + profiles: BTreeMap::new(), }; self.package("rustc", &mut manifest.pkg, HOSTS); @@ -354,6 +359,20 @@ impl Builder { self.package("llvm-tools-preview", &mut manifest.pkg, TARGETS); self.package("lldb-preview", &mut manifest.pkg, TARGETS); + self.profile("minimal", + &mut manifest.profiles, + &["rustc", "cargo", "rust-std", "rust-mingw"]); + self.profile("default", + &mut manifest.profiles, + &["rustc", "cargo", "rust-std", "rust-mingw", + "rust-docs", "rustfmt-preview", "clippy-preview"]); + self.profile("complete", + &mut manifest.profiles, + &["rustc", "cargo", "rust-std", "rust-mingw", + "rust-docs", "rustfmt-preview", "clippy-preview", + "rls-preview", "rust-src", "llvm-tools-preview", + "lldb-preview", "rust-analysis"]); + manifest.renames.insert("rls".to_owned(), Rename { to: "rls-preview".to_owned() }); manifest.renames.insert("rustfmt".to_owned(), Rename { to: "rustfmt-preview".to_owned() }); manifest.renames.insert("clippy".to_owned(), Rename { to: "clippy-preview".to_owned() }); @@ -452,6 +471,13 @@ impl Builder { return manifest; } + fn profile(&mut self, + profile_name: &str, + dst: &mut BTreeMap>, + pkgs: &[&str]) { + dst.insert(profile_name.to_owned(), pkgs.iter().map(|s| (*s).to_owned()).collect()); + } + fn package(&mut self, pkgname: &str, dst: &mut BTreeMap, @@ -524,6 +550,8 @@ impl Builder { format!("llvm-tools-{}-{}.tar.gz", self.llvm_tools_release, target) } else if component == "lldb" || component == "lldb-preview" { format!("lldb-{}-{}.tar.gz", self.lldb_release, target) + } else if component == "miri" || component == "miri-preview" { + format!("miri-{}-{}.tar.gz", self.miri_release, target) } else { format!("{}-{}-{}.tar.gz", component, self.rust_release, target) } @@ -542,6 +570,8 @@ impl Builder { &self.llvm_tools_version } else if component == "lldb" || component == "lldb-preview" { &self.lldb_version + } else if component == "miri" || component == "miri-preview" { + &self.miri_version } else { &self.rust_version } @@ -560,6 +590,8 @@ impl Builder { &self.llvm_tools_git_commit_hash } else if component == "lldb" || component == "lldb-preview" { &self.lldb_git_commit_hash + } else if component == "miri" || component == "miri-preview" { + &self.miri_git_commit_hash } else { &self.rust_git_commit_hash } @@ -606,7 +638,7 @@ impl Builder { let filename = path.file_name().unwrap().to_str().unwrap(); let sha256 = self.output.join(format!("{}.sha256", filename)); - t!(t!(File::create(&sha256)).write_all(&sha.stdout)); + t!(fs::write(&sha256, &sha.stdout)); let stdout = String::from_utf8_lossy(&sha.stdout); stdout.split_whitespace().next().unwrap().to_string() @@ -621,8 +653,10 @@ impl Builder { let asc = self.output.join(format!("{}.asc", filename)); println!("signing: {:?}", path); let mut cmd = Command::new("gpg"); - cmd.arg("--no-tty") + cmd.arg("--pinentry-mode=loopback") + .arg("--no-tty") .arg("--yes") + .arg("--batch") .arg("--passphrase-fd").arg("0") .arg("--personal-digest-preferences").arg("SHA512") .arg("--armor") @@ -643,7 +677,7 @@ impl Builder { fn write(&self, contents: &str, channel_name: &str, suffix: &str) { let dst = self.output.join(format!("channel-rust-{}{}", channel_name, suffix)); - t!(t!(File::create(&dst)).write_all(contents.as_bytes())); + t!(fs::write(&dst, contents)); self.hash(&dst); self.sign(&dst); } diff --git a/src/tools/cargo b/src/tools/cargo index b3d0b2e545b..24581807605 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit b3d0b2e545b61d4cd08096911724b7d49d213f73 +Subproject commit 245818076052dd7178f5bb7585f5aec5b6c1e03e diff --git a/src/tools/cargotest/main.rs b/src/tools/cargotest/main.rs index 5b717c45254..120f238eb45 100644 --- a/src/tools/cargotest/main.rs +++ b/src/tools/cargotest/main.rs @@ -1,18 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::env; use std::process::Command; use std::path::{Path, PathBuf}; -use std::fs::File; -use std::io::Write; +use std::fs; struct Test { repo: &'static str, @@ -91,10 +80,7 @@ fn test_repo(cargo: &Path, out_dir: &Path, test: &Test) { println!("testing {}", test.repo); let dir = clone_repo(test, out_dir); if let Some(lockfile) = test.lock { - File::create(&dir.join("Cargo.lock")) - .expect("") - .write_all(lockfile.as_bytes()) - .expect(""); + fs::write(&dir.join("Cargo.lock"), lockfile).unwrap(); } if !run_cargo_test(cargo, &dir, test.packages) { panic!("tests failed for {}", test.repo); diff --git a/src/tools/clang b/src/tools/clang deleted file mode 160000 index d0fc1788123..00000000000 --- a/src/tools/clang +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d0fc1788123de9844c8088b977cd142021cea1f2 diff --git a/src/tools/clippy b/src/tools/clippy index f5d868c9edf..6ce78d1257a 160000 --- a/src/tools/clippy +++ b/src/tools/clippy @@ -1 +1 @@ -Subproject commit f5d868c9edfc6c2a9310d564a2f738bec67dfd6b +Subproject commit 6ce78d1257ac6fd77f245730fcfbadd536a173eb diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 0ee31439358..edf4aeab1c7 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -15,6 +15,7 @@ serde_json = "1.0" serde_derive = "1.0" rustfix = "0.4.1" lazy_static = "1.0" +walkdir = "2" [target.'cfg(unix)'.dependencies] libc = "0.2" diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index a8e25596621..f6f8ef1dff4 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -1,12 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. pub use self::Mode::*; use std::fmt; @@ -153,6 +144,10 @@ pub struct Config { /// (or, alternatively, to silently run them like regular run-pass tests). pub force_valgrind: bool, + /// The path to the Clang executable to run Clang-based tests with. If + /// `None` then these tests will be ignored. + pub run_clang_based_tests_with: Option, + /// The directory containing the tests to run pub src_base: PathBuf, diff --git a/src/tools/compiletest/src/errors.rs b/src/tools/compiletest/src/errors.rs index dd2e5557c16..fd3f002fb66 100644 --- a/src/tools/compiletest/src/errors.rs +++ b/src/tools/compiletest/src/errors.rs @@ -1,12 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. use self::WhichLine::*; use std::fmt; @@ -56,7 +47,7 @@ impl fmt::Display for ErrorKind { #[derive(Debug)] pub struct Error { pub line_num: usize, - /// What kind of message we expect (e.g. warning, error, suggestion). + /// What kind of message we expect (e.g., warning, error, suggestion). /// `None` if not specified or unknown message kind. pub kind: Option, pub msg: String, @@ -119,10 +110,7 @@ fn parse_expected( line: &str, tag: &str, ) -> Option<(WhichLine, Error)> { - let start = match line.find(tag) { - Some(i) => i, - None => return None, - }; + let start = line.find(tag)?; let (follow, adjusts) = if line[start + tag.len()..].chars().next().unwrap() == '|' { (true, 0) } else { diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index ed2114b6530..591d92f0cfa 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::env; use std::fs::File; use std::io::prelude::*; @@ -121,6 +111,11 @@ impl EarlyProps { if ignore_llvm(config, ln) { props.ignore = Ignore::Ignore; } + + if config.run_clang_based_tests_with.is_none() && + config.parse_needs_matching_clang(ln) { + props.ignore = Ignore::Ignore; + } } if (config.mode == common::DebugInfoGdb || config.mode == common::DebugInfoBoth) && @@ -205,7 +200,7 @@ impl EarlyProps { fn ignore_lldb(config: &Config, line: &str) -> bool { if let Some(ref actual_version) = config.lldb_version { if line.starts_with("min-lldb-version") { - let min_version = line.trim_right() + let min_version = line.trim_end() .rsplit(' ') .next() .expect("Malformed lldb version directive"); @@ -228,7 +223,7 @@ impl EarlyProps { } if let Some(ref actual_version) = config.llvm_version { if line.starts_with("min-llvm-version") { - let min_version = line.trim_right() + let min_version = line.trim_end() .rsplit(' ') .next() .expect("Malformed llvm version directive"); @@ -236,7 +231,7 @@ impl EarlyProps { // version &actual_version[..] < min_version } else if line.starts_with("min-system-llvm-version") { - let min_version = line.trim_right() + let min_version = line.trim_end() .rsplit(' ') .next() .expect("Malformed llvm version directive"); @@ -552,6 +547,8 @@ fn iter_header(testfile: &Path, cfg: Option<&str>, it: &mut dyn FnMut(&str)) { "#" }; + // FIXME: would be nice to allow some whitespace between comment and brace :) + // It took me like 2 days to debug why compile-flags weren’t taken into account for my test :) let comment_with_brace = comment.to_string() + "["; let rdr = BufReader::new(File::open(testfile).unwrap()); @@ -573,14 +570,14 @@ fn iter_header(testfile: &Path, cfg: Option<&str>, it: &mut dyn FnMut(&str)) { None => false, }; if matches { - it(ln[(close_brace + 1)..].trim_left()); + it(ln[(close_brace + 1)..].trim_start()); } } else { panic!("malformed condition directive: expected `{}foo]`, found `{}`", comment_with_brace, ln) } } else if ln.starts_with(comment) { - it(ln[comment.len() ..].trim_left()); + it(ln[comment.len() ..].trim_start()); } } return; @@ -707,21 +704,19 @@ impl Config { fn parse_custom_normalization(&self, mut line: &str, prefix: &str) -> Option<(String, String)> { if self.parse_cfg_name_directive(line, prefix) == ParsedNameDirective::Match { - let from = match parse_normalization_string(&mut line) { - Some(s) => s, - None => return None, - }; - let to = match parse_normalization_string(&mut line) { - Some(s) => s, - None => return None, - }; + let from = parse_normalization_string(&mut line)?; + let to = parse_normalization_string(&mut line)?; Some((from, to)) } else { None } } - /// Parses a name-value directive which contains config-specific information, e.g. `ignore-x86` + fn parse_needs_matching_clang(&self, line: &str) -> bool { + self.parse_name_directive(line, "needs-matching-clang") + } + + /// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86` /// or `normalize-stderr-32bit`. fn parse_cfg_name_directive(&self, line: &str, prefix: &str) -> ParsedNameDirective { if line.starts_with(prefix) && line.as_bytes().get(prefix.len()) == Some(&b'-') { @@ -873,15 +868,35 @@ fn expand_variables(mut value: String, config: &Config) -> String { /// ``` fn parse_normalization_string(line: &mut &str) -> Option { // FIXME support escapes in strings. - let begin = match line.find('"') { - Some(i) => i + 1, - None => return None, - }; - let end = match line[begin..].find('"') { - Some(i) => i + begin, - None => return None, - }; + let begin = line.find('"')? + 1; + let end = line[begin..].find('"')? + begin; let result = line[begin..end].to_owned(); *line = &line[end + 1..]; Some(result) } + +#[test] +fn test_parse_normalization_string() { + let mut s = "normalize-stderr-32bit: \"something (32 bits)\" -> \"something ($WORD bits)\"."; + let first = parse_normalization_string(&mut s); + assert_eq!(first, Some("something (32 bits)".to_owned())); + assert_eq!(s, " -> \"something ($WORD bits)\"."); + + // Nothing to normalize (No quotes) + let mut s = "normalize-stderr-32bit: something (32 bits) -> something ($WORD bits)."; + let first = parse_normalization_string(&mut s); + assert_eq!(first, None); + assert_eq!(s, r#"normalize-stderr-32bit: something (32 bits) -> something ($WORD bits)."#); + + // Nothing to normalize (Only a single quote) + let mut s = "normalize-stderr-32bit: \"something (32 bits) -> something ($WORD bits)."; + let first = parse_normalization_string(&mut s); + assert_eq!(first, None); + assert_eq!(s, "normalize-stderr-32bit: \"something (32 bits) -> something ($WORD bits)."); + + // Nothing to normalize (Three quotes) + let mut s = "normalize-stderr-32bit: \"something (32 bits)\" -> \"something ($WORD bits)."; + let first = parse_normalization_string(&mut s); + assert_eq!(first, Some("something (32 bits)".to_owned())); + assert_eq!(s, " -> \"something ($WORD bits)."); +} diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs index 58220ba992c..106aa67157a 100644 --- a/src/tools/compiletest/src/json.rs +++ b/src/tools/compiletest/src/json.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use errors::{Error, ErrorKind}; use runtest::ProcRes; use serde_json; diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index f63950b448a..15d53f1e375 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![crate_name = "compiletest"] #![feature(test)] #![deny(warnings)] @@ -28,6 +18,7 @@ extern crate serde_derive; extern crate serde_json; extern crate test; extern crate rustfix; +extern crate walkdir; use common::CompareMode; use common::{expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS}; @@ -38,11 +29,12 @@ use getopts::Options; use std::env; use std::ffi::OsString; use std::fs; -use std::io::{self, Read}; +use std::io::{self, ErrorKind}; use std::path::{Path, PathBuf}; use std::process::Command; use test::ColorConfig; use util::logv; +use walkdir::WalkDir; use self::header::{EarlyProps, Ignore}; @@ -116,6 +108,12 @@ pub fn parse_config(args: Vec) -> Config { "force-valgrind", "fail if Valgrind tests cannot be run under Valgrind", ) + .optopt( + "", + "run-clang-based-tests-with", + "path to Clang executable", + "PATH", + ) .optopt( "", "llvm-filecheck", @@ -306,6 +304,7 @@ pub fn parse_config(args: Vec) -> Config { docck_python: matches.opt_str("docck-python").unwrap(), valgrind_path: matches.opt_str("valgrind-path"), force_valgrind: matches.opt_present("force-valgrind"), + run_clang_based_tests_with: matches.opt_str("run-clang-based-tests-with"), llvm_filecheck: matches.opt_str("llvm-filecheck").map(|s| PathBuf::from(&s)), src_base, build_base: opt_path(matches, "build-base"), @@ -497,7 +496,7 @@ pub fn run_tests(config: &Config) { // Let tests know which target they're running as env::set_var("TARGET", &config.target); - let res = test::run_tests_console(&opts, tests.into_iter().collect()); + let res = test::run_tests_console(&opts, tests); match res { Ok(true) => {} Ok(false) => panic!("Some tests failed"), @@ -511,7 +510,11 @@ pub fn test_opts(config: &Config) -> test::TestOpts { test::TestOpts { filter: config.filter.clone(), filter_exact: config.filter_exact, - run_ignored: config.run_ignored, + run_ignored: if config.run_ignored { + test::RunIgnored::Yes + } else { + test::RunIgnored::No + }, format: if config.quiet { test::OutputFormat::Terse } else { @@ -552,22 +555,18 @@ fn collect_tests_from_dir( relative_dir_path: &Path, tests: &mut Vec, ) -> io::Result<()> { - // Ignore directories that contain a file - // `compiletest-ignore-dir`. - for file in fs::read_dir(dir)? { - let file = file?; - let name = file.file_name(); - if name == *"compiletest-ignore-dir" { - return Ok(()); - } - if name == *"Makefile" && config.mode == Mode::RunMake { - let paths = TestPaths { - file: dir.to_path_buf(), - relative_dir: relative_dir_path.parent().unwrap().to_path_buf(), - }; - tests.extend(make_test(config, &paths)); - return Ok(()); - } + // Ignore directories that contain a file named `compiletest-ignore-dir`. + if dir.join("compiletest-ignore-dir").exists() { + return Ok(()); + } + + if config.mode == Mode::RunMake && dir.join("Makefile").exists() { + let paths = TestPaths { + file: dir.to_path_buf(), + relative_dir: relative_dir_path.parent().unwrap().to_path_buf(), + }; + tests.extend(make_test(config, &paths)); + return Ok(()); } // If we find a test foo/bar.rs, we have to build the @@ -581,8 +580,7 @@ fn collect_tests_from_dir( // Add each `.rs` file as a test, and recurse further on any // subdirectories we find, except for `aux` directories. - let dirs = fs::read_dir(dir)?; - for file in dirs { + for file in fs::read_dir(dir)? { let file = file?; let file_path = file.path(); let file_name = file.file_name(); @@ -686,13 +684,11 @@ fn up_to_date( ) -> bool { let stamp_name = stamp(config, testpaths, revision); // Check hash. - let mut f = match fs::File::open(&stamp_name) { + let contents = match fs::read_to_string(&stamp_name) { Ok(f) => f, + Err(ref e) if e.kind() == ErrorKind::InvalidData => panic!("Can't read stamp contents"), Err(_) => return true, }; - let mut contents = String::new(); - f.read_to_string(&mut contents) - .expect("Can't read stamp contents"); let expected_hash = runtest::compute_stamp_hash(config); if contents != expected_hash { return true; @@ -702,16 +698,16 @@ fn up_to_date( let rust_src_dir = config .find_rust_src_root() .expect("Could not find Rust source root"); - let stamp = mtime(&stamp_name); - let mut inputs = vec![mtime(&testpaths.file), mtime(&config.rustc_path)]; - for aux in props.aux.iter() { - inputs.push(mtime(&testpaths - .file - .parent() - .unwrap() - .join("auxiliary") - .join(aux))); - } + let stamp = Stamp::from_path(&stamp_name); + let mut inputs = vec![Stamp::from_path(&testpaths.file), Stamp::from_path(&config.rustc_path)]; + inputs.extend( + props + .aux + .iter() + .map(|aux| { + Stamp::from_path(&testpaths.file.parent().unwrap().join("auxiliary").join(aux)) + }), + ); // Relevant pretty printer files let pretty_printer_files = [ "src/etc/debugger_pretty_printers_common.py", @@ -720,31 +716,48 @@ fn up_to_date( "src/etc/lldb_batchmode.py", "src/etc/lldb_rust_formatters.py", ]; - for pretty_printer_file in &pretty_printer_files { - inputs.push(mtime(&rust_src_dir.join(pretty_printer_file))); - } - let mut entries = config.run_lib_path.read_dir().unwrap().collect::>(); - while let Some(entry) = entries.pop() { - let entry = entry.unwrap(); - let path = entry.path(); - if entry.metadata().unwrap().is_file() { - inputs.push(mtime(&path)); - } else { - entries.extend(path.read_dir().unwrap()); - } - } + inputs.extend(pretty_printer_files.iter().map(|pretty_printer_file| { + Stamp::from_path(&rust_src_dir.join(pretty_printer_file)) + })); + inputs.extend(Stamp::from_dir(&config.run_lib_path)); if let Some(ref rustdoc_path) = config.rustdoc_path { - inputs.push(mtime(&rustdoc_path)); - inputs.push(mtime(&rust_src_dir.join("src/etc/htmldocck.py"))); + inputs.push(Stamp::from_path(&rustdoc_path)); + inputs.push(Stamp::from_path(&rust_src_dir.join("src/etc/htmldocck.py"))); } // UI test files. - for extension in UI_EXTENSIONS { + inputs.extend(UI_EXTENSIONS.iter().map(|extension| { let path = &expected_output_path(testpaths, revision, &config.compare_mode, extension); - inputs.push(mtime(path)); + Stamp::from_path(path) + })); + + // Compiletest itself. + inputs.extend(Stamp::from_dir(&rust_src_dir.join("src/tools/compiletest/"))); + + inputs.iter().any(|input| input > &stamp) +} + +#[derive(Debug, PartialEq, PartialOrd, Ord, Eq)] +struct Stamp { + time: FileTime, + file: PathBuf, +} + +impl Stamp { + fn from_path(p: &Path) -> Self { + Stamp { + time: mtime(&p), + file: p.into(), + } } - inputs.iter().any(|input| *input > stamp) + fn from_dir(path: &Path) -> impl Iterator { + WalkDir::new(path) + .into_iter() + .map(|entry| entry.unwrap()) + .filter(|entry| entry.file_type().is_file()) + .map(|entry| Stamp::from_path(entry.path())) + } } fn mtime(path: &Path) -> FileTime { diff --git a/src/tools/compiletest/src/raise_fd_limit.rs b/src/tools/compiletest/src/raise_fd_limit.rs index d1071231530..7f1d7e0d3cd 100644 --- a/src/tools/compiletest/src/raise_fd_limit.rs +++ b/src/tools/compiletest/src/raise_fd_limit.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// darwin_fd_limit exists to work around an issue where launchctl on macOS /// defaults the rlimit maxfiles to 256/unlimited. The default soft limit of 256 /// ends up being far too low for our multithreaded scheduler testing, depending diff --git a/src/tools/compiletest/src/read2.rs b/src/tools/compiletest/src/read2.rs index f056a041c13..5a4caddcdd3 100644 --- a/src/tools/compiletest/src/read2.rs +++ b/src/tools/compiletest/src/read2.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // FIXME: This is a complete copy of `cargo/src/cargo/util/read2.rs` // Consider unify the read2() in libstd, cargo and this to prevent further code duplication. diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 399f9f577ed..ff201b03a0b 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use common::CompareMode; use common::{expected_output_path, UI_EXTENSIONS, UI_FIXED, UI_STDERR, UI_STDOUT}; use common::{output_base_dir, output_base_name, output_testname_unique}; @@ -27,7 +17,7 @@ use util::{logv, PathBufExt}; use std::collections::hash_map::DefaultHasher; use std::collections::{HashMap, HashSet, VecDeque}; use std::env; -use std::ffi::OsString; +use std::ffi::{OsStr, OsString}; use std::fmt; use std::fs::{self, create_dir_all, File}; use std::hash::{Hash, Hasher}; @@ -168,7 +158,10 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec) { match &*config.target { - "arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" => { + "arm-linux-androideabi" + | "armv7-linux-androideabi" + | "thumbv7neon-linux-androideabi" + | "aarch64-linux-android" => { if !config.adb_device_status { panic!("android device not available"); } @@ -458,11 +451,7 @@ impl<'test> TestCx<'test> { None => 2, }; - let mut src = String::new(); - File::open(&self.testpaths.file) - .unwrap() - .read_to_string(&mut src) - .unwrap(); + let src = fs::read_to_string(&self.testpaths.file).unwrap(); let mut srcs = vec![src]; let mut round = 0; @@ -500,12 +489,7 @@ impl<'test> TestCx<'test> { let mut expected = match self.props.pp_exact { Some(ref file) => { let filepath = self.testpaths.file.parent().unwrap().join(file); - let mut s = String::new(); - File::open(&filepath) - .unwrap() - .read_to_string(&mut s) - .unwrap(); - s + fs::read_to_string(&filepath).unwrap() } None => srcs[srcs.len() - 2].clone(), }; @@ -568,9 +552,10 @@ impl<'test> TestCx<'test> { .args(&["--target", &self.config.target]) .arg("-L") .arg(&aux_dir) - .args(self.split_maybe_args(&self.config.target_rustcflags)) .args(&self.props.compile_flags) .envs(self.props.exec_env.clone()); + self.maybe_add_external_args(&mut rustc, + self.split_maybe_args(&self.config.target_rustcflags)); let src = match read_from { ReadFrom::Stdin(src) => Some(src), @@ -603,6 +588,15 @@ impl<'test> TestCx<'test> { } } + fn set_revision_flags(&self, cmd: &mut Command) { + if let Some(revision) = self.revision { + // Normalize revisions to be lowercase and replace `-`s with `_`s. + // Otherwise the `--cfg` flag is not valid. + let normalized_revision = revision.to_lowercase().replace("-", "_"); + cmd.args(&["--cfg", &normalized_revision]); + } + } + fn typecheck_source(&self, src: String) -> ProcRes { let mut rustc = Command::new(&self.config.rustc_path); @@ -628,12 +622,9 @@ impl<'test> TestCx<'test> { .arg(&self.config.build_base) .arg("-L") .arg(aux_dir); - - if let Some(revision) = self.revision { - rustc.args(&["--cfg", revision]); - } - - rustc.args(self.split_maybe_args(&self.config.target_rustcflags)); + self.set_revision_flags(&mut rustc); + self.maybe_add_external_args(&mut rustc, + self.split_maybe_args(&self.config.target_rustcflags)); rustc.args(&self.props.compile_flags); self.compose_and_run_compiler(rustc, Some(src)) @@ -769,13 +760,13 @@ impl<'test> TestCx<'test> { } drop(stdout); - let debugger_script = self.make_out_name("debugger.script"); - // FIXME (#9639): This needs to handle non-utf8 paths - let debugger_opts = vec![ - "-quiet".to_owned(), - "-batch".to_owned(), - "-nx".to_owned(), - format!("-command={}", debugger_script.to_str().unwrap()), + let mut debugger_script = OsString::from("-command="); + debugger_script.push(self.make_out_name("debugger.script")); + let debugger_opts: &[&OsStr] = &[ + "-quiet".as_ref(), + "-batch".as_ref(), + "-nx".as_ref(), + &debugger_script, ]; let gdb_path = self.config.gdb.as_ref().unwrap(); @@ -784,12 +775,12 @@ impl<'test> TestCx<'test> { stdout, stderr, } = Command::new(&gdb_path) - .args(&debugger_opts) + .args(debugger_opts) .output() .expect(&format!("failed to exec `{:?}`", gdb_path)); let cmdline = { let mut gdb = Command::new(&format!("{}-gdb", self.config.target)); - gdb.args(&debugger_opts); + gdb.args(debugger_opts); let cmdline = self.make_cmdline(&gdb, ""); logv(self.config, format!("executing {}", cmdline)); cmdline @@ -877,18 +868,18 @@ impl<'test> TestCx<'test> { debug!("script_str = {}", script_str); self.dump_output_file(&script_str, "debugger.script"); - let debugger_script = self.make_out_name("debugger.script"); + let mut debugger_script = OsString::from("-command="); + debugger_script.push(self.make_out_name("debugger.script")); - // FIXME (#9639): This needs to handle non-utf8 paths - let debugger_opts = vec![ - "-quiet".to_owned(), - "-batch".to_owned(), - "-nx".to_owned(), - format!("-command={}", debugger_script.to_str().unwrap()), + let debugger_opts: &[&OsStr] = &[ + "-quiet".as_ref(), + "-batch".as_ref(), + "-nx".as_ref(), + &debugger_script, ]; let mut gdb = Command::new(self.config.gdb.as_ref().unwrap()); - gdb.args(&debugger_opts) + gdb.args(debugger_opts) .env("PYTHONPATH", rust_pp_module_abs_path); debugger_run_result = self.compose_and_run( @@ -1088,7 +1079,7 @@ impl<'test> TestCx<'test> { match line { Ok(line) => { let line = if line.starts_with("//") { - line[2..].trim_left() + line[2..].trim_start() } else { line.as_str() }; @@ -1135,6 +1126,35 @@ impl<'test> TestCx<'test> { Some(new_options.join(" ")) } + fn maybe_add_external_args(&self, cmd: &mut Command, args: Vec) { + // Filter out the arguments that should not be added by runtest here. + // + // Notable use-cases are: do not add our optimisation flag if + // `compile-flags: -Copt-level=x` and similar for debug-info level as well. + const OPT_FLAGS: &[&str] = &["-O", "-Copt-level=", /*-C*/"opt-level="]; + const DEBUG_FLAGS: &[&str] = &["-g", "-Cdebuginfo=", /*-C*/"debuginfo="]; + + // FIXME: ideally we would "just" check the `cmd` itself, but it does not allow inspecting + // its arguments. They need to be collected separately. For now I cannot be bothered to + // implement this the "right" way. + let have_opt_flag = self.props.compile_flags.iter().any(|arg| { + OPT_FLAGS.iter().any(|f| arg.starts_with(f)) + }); + let have_debug_flag = self.props.compile_flags.iter().any(|arg| { + DEBUG_FLAGS.iter().any(|f| arg.starts_with(f)) + }); + + for arg in args { + if OPT_FLAGS.iter().any(|f| arg.starts_with(f)) && have_opt_flag { + continue; + } + if DEBUG_FLAGS.iter().any(|f| arg.starts_with(f)) && have_debug_flag { + continue; + } + cmd.arg(arg); + } + } + fn check_debugger_output(&self, debugger_run_result: &ProcRes, check_lines: &[String]) { let num_check_lines = check_lines.len(); @@ -1707,6 +1727,9 @@ impl<'test> TestCx<'test> { // FIXME Why is -L here? rustc.arg(input_file); //.arg("-L").arg(&self.config.build_base); + // Use a single thread for efficiency and a deterministic error message order + rustc.arg("-Zthreads=1"); + // Optionally prevent default --target if specified in test compile-flags. let custom_target = self .props @@ -1723,10 +1746,7 @@ impl<'test> TestCx<'test> { rustc.arg(&format!("--target={}", target)); } - - if let Some(revision) = self.revision { - rustc.args(&["--cfg", revision]); - } + self.set_revision_flags(&mut rustc); if !is_rustdoc { if let Some(ref incremental_dir) = self.props.incremental_dir { @@ -1826,13 +1846,15 @@ impl<'test> TestCx<'test> { } if self.props.force_host { - rustc.args(self.split_maybe_args(&self.config.host_rustcflags)); + self.maybe_add_external_args(&mut rustc, + self.split_maybe_args(&self.config.host_rustcflags)); } else { - rustc.args(self.split_maybe_args(&self.config.target_rustcflags)); - } - if !is_rustdoc { - if let Some(ref linker) = self.config.linker { - rustc.arg(format!("-Clinker={}", linker)); + self.maybe_add_external_args(&mut rustc, + self.split_maybe_args(&self.config.target_rustcflags)); + if !is_rustdoc { + if let Some(ref linker) = self.config.linker { + rustc.arg(format!("-Clinker={}", linker)); + } } } @@ -1949,10 +1971,7 @@ impl<'test> TestCx<'test> { fn dump_output_file(&self, out: &str, extension: &str) { let outfile = self.make_out_name(extension); - File::create(&outfile) - .unwrap() - .write_all(out.as_bytes()) - .unwrap(); + fs::write(&outfile, out).unwrap(); } /// Create a filename for output with the given extension. Example: @@ -2017,7 +2036,8 @@ impl<'test> TestCx<'test> { fn fatal(&self, err: &str) -> ! { self.error(err); - panic!(); + error!("fatal error, panic: {:?}", err); + panic!("fatal error"); } fn fatal_proc_rec(&self, err: &str, proc_res: &ProcRes) -> ! { @@ -2084,12 +2104,19 @@ impl<'test> TestCx<'test> { .arg("--input-file") .arg(irfile) .arg(&self.testpaths.file); + // It would be more appropriate to make most of the arguments configurable through + // a comment-attribute similar to `compile-flags`. For example, --check-prefixes is a very + // useful flag. + // + // For now, though… + if let Some(rev) = self.revision { + let prefixes = format!("CHECK,{}", rev); + filecheck.args(&["--check-prefixes", &prefixes]); + } self.compose_and_run(filecheck, "", None, None) } fn run_codegen_test(&self) { - assert!(self.revision.is_none(), "revisions not relevant here"); - if self.config.llvm_filecheck.is_none() { self.fatal("missing --llvm-filecheck"); } @@ -2149,18 +2176,14 @@ impl<'test> TestCx<'test> { path: &P, mut other_files: Option<&mut Vec>, ) -> Vec { - let mut file = - fs::File::open(path).expect("markdown_test_output_check_entry File::open failed"); - let mut content = String::new(); - file.read_to_string(&mut content) - .expect("markdown_test_output_check_entry read_to_string failed"); + let content = fs::read_to_string(&path).unwrap(); let mut ignore = false; content .lines() .enumerate() .filter_map(|(line_nb, line)| { - if (line.trim_left().starts_with("pub mod ") - || line.trim_left().starts_with("mod ")) + if (line.trim_start().starts_with("pub mod ") + || line.trim_start().starts_with("mod ")) && line.ends_with(';') { if let Some(ref mut other_files) = other_files { @@ -2169,7 +2192,7 @@ impl<'test> TestCx<'test> { None } else { let sline = line.split("///").last().unwrap_or(""); - let line = sline.trim_left(); + let line = sline.trim_start(); if line.starts_with("```") { if ignore { ignore = false; @@ -2592,7 +2615,7 @@ impl<'test> TestCx<'test> { .env("LLVM_CXXFLAGS", &self.config.llvm_cxxflags) // We for sure don't want these tests to run in parallel, so make - // sure they don't have access to these vars if we we run via `make` + // sure they don't have access to these vars if we run via `make` // at the top level .env_remove("MAKEFLAGS") .env_remove("MFLAGS") @@ -2610,6 +2633,10 @@ impl<'test> TestCx<'test> { cmd.env("RUSTC_LINKER", linker); } + if let Some(ref clang) = self.config.run_clang_based_tests_with { + cmd.env("CLANG", clang); + } + // We don't want RUSTFLAGS set from the outside to interfere with // compiler flags set in the test cases: cmd.env_remove("RUSTFLAGS"); @@ -2781,12 +2808,14 @@ impl<'test> TestCx<'test> { explicit, self.config.compare_mode, expected_errors, proc_res.status, self.props.error_patterns); if !explicit && self.config.compare_mode.is_none() { - if !expected_errors.is_empty() && !proc_res.status.success() { - // "//~ERROR comments" - self.check_expected_errors(expected_errors, &proc_res); - } else if !self.props.error_patterns.is_empty() && !proc_res.status.success() { - // "// error-pattern" comments - self.check_error_patterns(&proc_res.stderr, &proc_res); + if !proc_res.status.success() { + if !self.props.error_patterns.is_empty() { + // "// error-pattern" comments + self.check_error_patterns(&proc_res.stderr, &proc_res); + } else { + // "//~ERROR comments" + self.check_expected_errors(expected_errors, &proc_res); + } } } @@ -2824,11 +2853,7 @@ impl<'test> TestCx<'test> { } fn check_mir_dump(&self) { - let mut test_file_contents = String::new(); - fs::File::open(self.testpaths.file.clone()) - .unwrap() - .read_to_string(&mut test_file_contents) - .unwrap(); + let test_file_contents = fs::read_to_string(&self.testpaths.file).unwrap(); if let Some(idx) = test_file_contents.find("// END RUST SOURCE") { let (_, tests_text) = test_file_contents.split_at(idx + "// END_RUST SOURCE".len()); let tests_text_str = String::from(tests_text); @@ -2892,9 +2917,7 @@ impl<'test> TestCx<'test> { } self.check_mir_test_timestamp(test_name, &output_file); - let mut dumped_file = fs::File::open(output_file.clone()).unwrap(); - let mut dumped_string = String::new(); - dumped_file.read_to_string(&mut dumped_string).unwrap(); + let dumped_string = fs::read_to_string(&output_file).unwrap(); let mut dumped_lines = dumped_string .lines() .map(|l| nocomment_mir_line(l)) @@ -3106,19 +3129,13 @@ impl<'test> TestCx<'test> { } fn load_expected_output_from_path(&self, path: &Path) -> Result { - let mut result = String::new(); - match File::open(path).and_then(|mut f| f.read_to_string(&mut result)) { - Ok(_) => Ok(result), - Err(e) => Err(format!( - "failed to load expected output from `{}`: {}", - path.display(), - e - )), - } + fs::read_to_string(path).map_err(|err| { + format!("failed to load expected output from `{}`: {}", path.display(), err) + }) } fn delete_file(&self, file: &PathBuf) { - if let Err(e) = ::std::fs::remove_file(file) { + if let Err(e) = fs::remove_file(file) { self.fatal(&format!( "failed to delete `{}`: {}", file.display(), @@ -3180,16 +3197,13 @@ impl<'test> TestCx<'test> { for output_file in &files { if actual.is_empty() { self.delete_file(output_file); - } else { - match File::create(&output_file).and_then(|mut f| f.write_all(actual.as_bytes())) { - Ok(()) => {} - Err(e) => self.fatal(&format!( - "failed to write {} to `{}`: {}", - kind, - output_file.display(), - e - )), - } + } else if let Err(err) = fs::write(&output_file, &actual) { + self.fatal(&format!( + "failed to write {} to `{}`: {}", + kind, + output_file.display(), + err, + )); } } @@ -3241,9 +3255,8 @@ impl<'test> TestCx<'test> { } fn create_stamp(&self) { - let mut f = File::create(::stamp(&self.config, self.testpaths, self.revision)).unwrap(); - f.write_all(compute_stamp_hash(&self.config).as_bytes()) - .unwrap(); + let stamp = ::stamp(&self.config, self.testpaths, self.revision); + fs::write(&stamp, compute_stamp_hash(&self.config)).unwrap(); } } @@ -3314,7 +3327,7 @@ fn normalize_mir_line(line: &str) -> String { fn nocomment_mir_line(line: &str) -> &str { if let Some(idx) = line.find("//") { let (l, _) = line.split_at(idx); - l.trim_right() + l.trim_end() } else { line } diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs index 2a716970ca7..90dfadeee46 100644 --- a/src/tools/compiletest/src/util.rs +++ b/src/tools/compiletest/src/util.rs @@ -1,13 +1,3 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::ffi::OsStr; use std::env; use std::path::PathBuf; @@ -86,6 +76,8 @@ pub fn matches_os(triple: &str, name: &str) -> bool { } panic!("Cannot determine OS from triple"); } + +/// Determine the architecture from `triple` pub fn get_arch(triple: &str) -> &'static str { let triple: Vec<_> = triple.split('-').collect(); for &(triple_arch, arch) in ARCH_TABLE { @@ -151,3 +143,29 @@ impl PathBufExt for PathBuf { } } } + +#[test] +#[should_panic(expected = "Cannot determine Architecture from triple")] +fn test_get_arch_failure() { + get_arch("abc"); +} + +#[test] +fn test_get_arch() { + assert_eq!("x86_64", get_arch("x86_64-unknown-linux-gnu")); + assert_eq!("x86_64", get_arch("amd64")); +} + +#[test] +#[should_panic(expected = "Cannot determine OS from triple")] +fn test_matches_os_failure() { + matches_os("abc", "abc"); +} + +#[test] +fn test_matches_os() { + assert!(matches_os("x86_64-unknown-linux-gnu", "linux")); + assert!(matches_os("wasm32-unknown-unknown", "emscripten")); + assert!(matches_os("wasm32-unknown-unknown", "wasm32-bare")); + assert!(!matches_os("wasm32-unknown-unknown", "windows")); +} diff --git a/src/tools/error_index_generator/main.rs b/src/tools/error_index_generator/main.rs index a5556e1d570..72cfd7d5e58 100644 --- a/src/tools/error_index_generator/main.rs +++ b/src/tools/error_index_generator/main.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(rustc_private)] extern crate env_logger; @@ -18,8 +8,8 @@ extern crate serialize as rustc_serialize; use std::collections::BTreeMap; use std::env; use std::error::Error; -use std::fs::{read_dir, File}; -use std::io::{Read, Write}; +use std::fs::{self, read_dir, File}; +use std::io::Write; use std::path::Path; use std::path::PathBuf; use std::cell::RefCell; @@ -210,8 +200,7 @@ fn load_all_errors(metadata_dir: &Path) -> Result or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Script to check the validity of `href` links in our HTML documentation. //! //! In the past we've been quite error prone to writing in broken links as most @@ -24,12 +14,12 @@ //! A few whitelisted exceptions are allowed as there's known bugs in rustdoc, //! but this should catch the majority of "broken link" cases. +use std::collections::hash_map::Entry; +use std::collections::{HashMap, HashSet}; use std::env; -use std::fs::File; -use std::io::prelude::*; +use std::fs; use std::path::{Path, PathBuf, Component}; -use std::collections::{HashMap, HashSet}; -use std::collections::hash_map::Entry; +use std::rc::Rc; use Redirect::*; @@ -63,7 +53,7 @@ enum Redirect { } struct FileEntry { - source: String, + source: Rc, ids: HashSet, } @@ -88,7 +78,7 @@ impl FileEntry { fn parse_ids(&mut self, file: &Path, contents: &str, errors: &mut bool) { if self.ids.is_empty() { with_attrs_in_source(contents, " id", |fragment, i, _| { - let frag = fragment.trim_left_matches("#").to_owned(); + let frag = fragment.trim_start_matches("#").to_owned(); let encoded = small_url_encode(&frag); if !self.ids.insert(frag) { *errors = true; @@ -113,7 +103,7 @@ fn walk(cache: &mut Cache, root: &Path, dir: &Path, errors: &mut bool) { let entry = cache.get_mut(&pretty_path).unwrap(); // we don't need the source anymore, // so drop to reduce memory-usage - entry.source = String::new(); + entry.source = Rc::new(String::new()); } } } @@ -137,7 +127,6 @@ fn check(cache: &mut Cache, file.ends_with("symbol/struct.InternedString.html") || file.ends_with("ast/struct.ThinVec.html") || file.ends_with("util/struct.ThinVec.html") || - file.ends_with("util/struct.RcSlice.html") || file.ends_with("layout/struct.TyLayout.html") || file.ends_with("humantime/struct.Timestamp.html") || file.ends_with("log/index.html") || @@ -287,24 +276,24 @@ fn load_file(cache: &mut Cache, root: &Path, file: &Path, redirect: Redirect) - -> Result<(PathBuf, String), LoadError> { - let mut contents = String::new(); + -> Result<(PathBuf, Rc), LoadError> { let pretty_file = PathBuf::from(file.strip_prefix(root).unwrap_or(&file)); - let maybe_redirect = match cache.entry(pretty_file.clone()) { + let (maybe_redirect, contents) = match cache.entry(pretty_file.clone()) { Entry::Occupied(entry) => { - contents = entry.get().source.clone(); - None + (None, entry.get().source.clone()) } Entry::Vacant(entry) => { - let mut fp = File::open(file).map_err(|err| { - if let FromRedirect(true) = redirect { - LoadError::BrokenRedirect(file.to_path_buf(), err) - } else { - LoadError::IOError(err) + let contents = match fs::read_to_string(file) { + Ok(s) => Rc::new(s), + Err(err) => { + return Err(if let FromRedirect(true) = redirect { + LoadError::BrokenRedirect(file.to_path_buf(), err) + } else { + LoadError::IOError(err) + }) } - })?; - fp.read_to_string(&mut contents).map_err(|err| LoadError::IOError(err))?; + }; let maybe = maybe_redirect(&contents); if maybe.is_some() { @@ -317,7 +306,7 @@ fn load_file(cache: &mut Cache, ids: HashSet::new(), }); } - maybe + (maybe, contents) } }; match maybe_redirect.map(|url| file.parent().unwrap().join(url)) { @@ -332,10 +321,7 @@ fn maybe_redirect(source: &str) -> Option { const REDIRECT: &'static str = "

Redirecting to (contents: &str, attr: &str, }; let quote_delim = rest.as_bytes()[pos_quote] as char; - if rest[..pos_quote].trim_left_matches(" ") != "" { + if rest[..pos_quote].trim_start_matches(" ") != "" { continue; } let rest = &rest[pos_quote + 1..]; diff --git a/src/tools/lld b/src/tools/lld deleted file mode 160000 index 2a9b88b8b41..00000000000 --- a/src/tools/lld +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2a9b88b8b419d094fb2185c0ca31c28d31bdca00 diff --git a/src/tools/lldb b/src/tools/lldb deleted file mode 160000 index fdea743be55..00000000000 --- a/src/tools/lldb +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fdea743be550ed8d7b61b2c908944cdd1290a6ad diff --git a/src/tools/miri b/src/tools/miri index bbb1d80703f..a9505a8fb89 160000 --- a/src/tools/miri +++ b/src/tools/miri @@ -1 +1 @@ -Subproject commit bbb1d80703f272a5592ceeb3832a489776512251 +Subproject commit a9505a8fb89ece7fa514cf3c70f1ada3e39baeec diff --git a/src/tools/publish_toolstate.py b/src/tools/publish_toolstate.py index 4ade87f5d65..323f8118168 100755 --- a/src/tools/publish_toolstate.py +++ b/src/tools/publish_toolstate.py @@ -1,16 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - import sys import re import json @@ -130,6 +120,11 @@ def update_latest( sys.exit(0) print(message) + + if not github_token: + print('Dry run only, not committing anything') + sys.exit(0) + with open(save_message_to_path, 'w') as f: f.write(message) diff --git a/src/tools/remote-test-client/src/main.rs b/src/tools/remote-test-client/src/main.rs index 011bf551140..cb9dac27ce4 100644 --- a/src/tools/remote-test-client/src/main.rs +++ b/src/tools/remote-test-client/src/main.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// This is a small client program intended to pair with `remote-test-server` in /// this repository. This client connects to the server over TCP and is used to /// push artifacts and run tests on the server instead of locally. diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs index 9501adb9386..3f56d4da6a3 100644 --- a/src/tools/remote-test-server/src/main.rs +++ b/src/tools/remote-test-server/src/main.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - /// This is a small server which is intended to run inside of an emulator or /// on a remote test device. This server pairs with the `remote-test-client` /// program in this repository. The `remote-test-client` connects to this @@ -30,7 +20,7 @@ use std::os::unix::prelude::*; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; use std::str; -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Arc, Mutex}; use std::thread; @@ -41,7 +31,7 @@ macro_rules! t { }) } -static TEST: AtomicUsize = ATOMIC_USIZE_INIT; +static TEST: AtomicUsize = AtomicUsize::new(0); struct Config { pub remote: bool, diff --git a/src/tools/rls b/src/tools/rls index daa138ce7f2..c9d25b667af 160000 --- a/src/tools/rls +++ b/src/tools/rls @@ -1 +1 @@ -Subproject commit daa138ce7f222559e9a339600b44a715101a3f4d +Subproject commit c9d25b667af766e8fe6d3b6168a5f99a0e4d722a diff --git a/src/tools/rustbook/Cargo.toml b/src/tools/rustbook/Cargo.toml index 5e11646ee4c..5bf1553b227 100644 --- a/src/tools/rustbook/Cargo.toml +++ b/src/tools/rustbook/Cargo.toml @@ -3,11 +3,19 @@ authors = ["The Rust Project Developers"] name = "rustbook" version = "0.1.0" license = "MIT/Apache-2.0" +edition = "2018" [dependencies] clap = "2.25.0" -[dependencies.mdbook] +[dependencies.mdbook_2] +package = "mdbook" +version = "0.2.3" +default-features = false +features = ["search"] + +[dependencies.mdbook_1] +package = "mdbook" version = "0.1.7" default-features = false features = ["search"] diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs index 87a63a34cb6..5a6246347cc 100644 --- a/src/tools/rustbook/src/main.rs +++ b/src/tools/rustbook/src/main.rs @@ -1,30 +1,24 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. // -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -extern crate mdbook; -#[macro_use] -extern crate clap; +use clap::{crate_version}; use std::env; use std::path::{Path, PathBuf}; use clap::{App, ArgMatches, SubCommand, AppSettings}; -use mdbook::MDBook; -use mdbook::errors::Result; +use mdbook_1::{MDBook as MDBook1}; +use mdbook_1::errors::{Result as Result1}; + +use mdbook_2::{MDBook as MDBook2}; +use mdbook_2::errors::{Result as Result2}; fn main() { let d_message = "-d, --dest-dir=[dest-dir] 'The output directory for your book{n}(Defaults to ./book when omitted)'"; let dir_message = "[dir] 'A directory for your book{n}(Defaults to Current Directory when omitted)'"; + let vers_message = "-m, --mdbook-vers=[md-version] +'The version of mdbook to use for your book{n}(Defaults to 1 when omitted)'"; let matches = App::new("rustbook") .about("Build a book with mdBook") @@ -34,29 +28,66 @@ fn main() { .subcommand(SubCommand::with_name("build") .about("Build the book from the markdown files") .arg_from_usage(d_message) - .arg_from_usage(dir_message)) + .arg_from_usage(dir_message) + .arg_from_usage(vers_message)) .get_matches(); // Check which subcomamnd the user ran... - let res = match matches.subcommand() { - ("build", Some(sub_matches)) => build(sub_matches), + match matches.subcommand() { + ("build", Some(sub_matches)) => { + match sub_matches.value_of("mdbook-vers") { + None | Some("1") => { + if let Err(e) = build_1(sub_matches) { + eprintln!("Error: {}", e); + + for cause in e.iter().skip(1) { + eprintln!("\tCaused By: {}", cause); + } + + ::std::process::exit(101); + } + } + Some("2") => { + if let Err(e) = build_2(sub_matches) { + eprintln!("Error: {}", e); + + for cause in e.iter().skip(1) { + eprintln!("\tCaused By: {}", cause); + } + + ::std::process::exit(101); + } + } + _ => { + panic!("Invalid mdBook version! Select '1' or '2'"); + } + }; + }, (_, _) => unreachable!(), }; +} - if let Err(e) = res { - eprintln!("Error: {}", e); +// Build command implementation +pub fn build_1(args: &ArgMatches) -> Result1<()> { + let book_dir = get_book_dir(args); + let mut book = MDBook1::load(&book_dir)?; - for cause in e.iter().skip(1) { - eprintln!("\tCaused By: {}", cause); - } + // Set this to allow us to catch bugs in advance. + book.config.build.create_missing = false; - ::std::process::exit(101); + if let Some(dest_dir) = args.value_of("dest-dir") { + book.config.build.build_dir = PathBuf::from(dest_dir); } + + book.build()?; + + Ok(()) } + // Build command implementation -pub fn build(args: &ArgMatches) -> Result<()> { +pub fn build_2(args: &ArgMatches) -> Result2<()> { let book_dir = get_book_dir(args); - let mut book = MDBook::load(&book_dir)?; + let mut book = MDBook2::load(&book_dir)?; // Set this to allow us to catch bugs in advance. book.config.build.create_missing = false; diff --git a/src/tools/rustc-std-workspace-core/Cargo.toml b/src/tools/rustc-std-workspace-core/Cargo.toml new file mode 100644 index 00000000000..f000d634e19 --- /dev/null +++ b/src/tools/rustc-std-workspace-core/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "rustc-std-workspace-core" +version = "1.0.0" +authors = ["Alex Crichton "] +license = 'MIT/Apache-2.0' +description = """ +Hack for the compiler's own build system +""" + +[lib] +path = "lib.rs" + +[dependencies] +core = { path = "../../libcore" } diff --git a/src/tools/rustc-std-workspace-core/README.md b/src/tools/rustc-std-workspace-core/README.md new file mode 100644 index 00000000000..9c2b1fa91d3 --- /dev/null +++ b/src/tools/rustc-std-workspace-core/README.md @@ -0,0 +1,29 @@ +# The `rustc-std-workspace-core` crate + +This crate is a shim and empty crate which simply depends on `libcore` and +reexports all of its contents. The crate is the crux of empowering the standard +library to depend on crates from crates.io + +Crates on crates.io that the standard library depend on the +`rustc-std-workspace-core` crate from crates.io. On crates.io, however, this +crate is empty. We use `[patch]` to override it to this crate in this +repository. As a result, crates on crates.io will draw a dependency edge to +`libcore`, the version defined in this repository. That should draw all the +dependency edges to ensure Cargo builds crates successfully! + +Note that crates on crates.io need to depend on this crate with the name `core` +for everything to work correctly. To do that they can use: + +```toml +core = { version = "1.0.0", optional = true, package = 'rustc-std-workspace-core' } +``` + +Through the use of the `package` key the crate is renamed to `core`, meaning +it'll look like + +``` +--extern core=.../librustc_std_workspace_core-XXXXXXX.rlib +``` + +when Cargo invokes the compiler, satisfying the implicit `extern crate core` +directive injected by the compiler. diff --git a/src/tools/rustc-std-workspace-core/lib.rs b/src/tools/rustc-std-workspace-core/lib.rs new file mode 100644 index 00000000000..e2946fe2a97 --- /dev/null +++ b/src/tools/rustc-std-workspace-core/lib.rs @@ -0,0 +1,6 @@ +#![feature(no_core)] +#![no_core] + +extern crate core; + +pub use core::*; diff --git a/src/tools/rustc-workspace-hack/Cargo.toml b/src/tools/rustc-workspace-hack/Cargo.toml index f2b08f8e0bb..f5eeddda036 100644 --- a/src/tools/rustc-workspace-hack/Cargo.toml +++ b/src/tools/rustc-workspace-hack/Cargo.toml @@ -17,7 +17,7 @@ path = "lib.rs" # Currently Cargo/RLS depend on `failure` which depends on `synstructure` which # enables this feature. Clippy, however, does not depend on anything that # enables this feature. Enable it unconditionally. -syn = { version = "0.14", features = ['extra-traits'] } +syn = { version = "0.15", features = ['extra-traits'] } [target.'cfg(windows)'.dependencies.winapi] version = "0.3" @@ -27,21 +27,25 @@ features = [ "errhandlingapi", "jobapi", "jobapi2", + "knownfolders", "lmcons", "memoryapi", "minschannel", "minwinbase", "ntsecapi", "ntstatus", + "objbase", "profileapi", "processenv", "psapi", "schannel", "securitybaseapi", "shellapi", + "shlobj", "sspi", "synchapi", "sysinfoapi", + "threadpoollegacyapiset", "timezoneapi", "userenv", "winbase", @@ -50,9 +54,15 @@ features = [ ] [dependencies] -serde_json = { version = "1.0.31", features = ["raw_value"] } +curl-sys = { version = "0.4.13", features = ["http2", "libnghttp2-sys"], optional = true } +parking_lot = { version = "0.6", features = ['nightly'] } rand = { version = "0.5.5", features = ["i128_support"] } -curl-sys = { version = "0.4.13", optional = true } +serde = { version = "1.0.82", features = ['derive'] } +serde_json = { version = "1.0.31", features = ["raw_value"] } +smallvec = { version = "0.6", features = ['union'] } +scopeguard = { version = "0.3.3", features = ["use_std", "default"]} +byteorder = { version = "1.2.7", features = ["i128"]} + [target.'cfg(not(windows))'.dependencies] openssl = { version = "0.10.12", optional = true } diff --git a/src/tools/rustc-workspace-hack/lib.rs b/src/tools/rustc-workspace-hack/lib.rs index ab262975a09..44425d9c15f 100644 --- a/src/tools/rustc-workspace-hack/lib.rs +++ b/src/tools/rustc-workspace-hack/lib.rs @@ -1,11 +1 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // intentionally left blank diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js index c8ce4cf8bb5..c41da93a983 100644 --- a/src/tools/rustdoc-js/tester.js +++ b/src/tools/rustdoc-js/tester.js @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - const fs = require('fs'); const TEST_FOLDER = 'src/test/rustdoc-js/'; @@ -26,7 +16,10 @@ function getNextStep(content, pos, stop) { return pos; } -// Stupid function extractor based on indent. +// Stupid function extractor based on indent. Doesn't support block +// comments. If someone puts a ' or an " in a block comment this +// will blow up. Template strings are not tested and might also be +// broken. function extractFunction(content, functionName) { var indent = 0; var splitter = "function " + functionName + "("; @@ -51,7 +44,14 @@ function extractFunction(content, functionName) { continue; } while (pos < content.length) { - if (content[pos] === '"' || content[pos] === "'") { + // Eat single-line comments + if (content[pos] === '/' && pos > 0 && content[pos-1] === '/') { + do { + pos += 1; + } while (pos < content.length && content[pos] !== '\n'); + + // Eat quoted strings + } else if (content[pos] === '"' || content[pos] === "'" || content[pos] === "`") { var stop = content[pos]; var is_escaped = false; do { @@ -62,6 +62,8 @@ function extractFunction(content, functionName) { } } while (pos < content.length && (content[pos] !== stop || content[pos - 1] === '\\')); + + // Otherwise, check for indent } else if (content[pos] === '{') { indent += 1; } else if (content[pos] === '}') { @@ -162,9 +164,12 @@ function loadContent(content) { var Module = module.constructor; var m = new Module(); m._compile(content, "tmp.js"); - m.exports.ignore_order = content.indexOf("\n// ignore-order\n") !== -1; - m.exports.exact_check = content.indexOf("\n// exact-check\n") !== -1; - m.exports.should_fail = content.indexOf("\n// should-fail\n") !== -1; + m.exports.ignore_order = content.indexOf("\n// ignore-order\n") !== -1 || + content.startsWith("// ignore-order\n"); + m.exports.exact_check = content.indexOf("\n// exact-check\n") !== -1 || + content.startsWith("// exact-check\n"); + m.exports.should_fail = content.indexOf("\n// should-fail\n") !== -1 || + content.startsWith("// should-fail\n"); return m.exports; } @@ -259,6 +264,7 @@ function main(argv) { 'exports.QUERY = QUERY;exports.EXPECTED = EXPECTED;'); const expected = loadedFile.EXPECTED; const query = loadedFile.QUERY; + const filter_crate = loadedFile.FILTER_CRATE; const ignore_order = loadedFile.ignore_order; const exact_check = loadedFile.exact_check; const should_fail = loadedFile.should_fail; diff --git a/src/tools/rustdoc-themes/main.rs b/src/tools/rustdoc-themes/main.rs index c8fb65e9a2a..616b5444832 100644 --- a/src/tools/rustdoc-themes/main.rs +++ b/src/tools/rustdoc-themes/main.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::env::args; use std::fs::read_dir; use std::path::Path; diff --git a/src/tools/rustdoc/main.rs b/src/tools/rustdoc/main.rs index 7aca765cead..df9d2c6ba96 100644 --- a/src/tools/rustdoc/main.rs +++ b/src/tools/rustdoc/main.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(link_args)] #[allow(unused_attributes)] diff --git a/src/tools/rustfmt b/src/tools/rustfmt index 1cc61cfc2b2..be135599ef5 160000 --- a/src/tools/rustfmt +++ b/src/tools/rustfmt @@ -1 +1 @@ -Subproject commit 1cc61cfc2b29ae3f29a924b4c8feb1bcb09aa5fc +Subproject commit be135599ef5e54b5219f9adec68e1ee267ea0584 diff --git a/src/tools/tidy/src/bins.rs b/src/tools/tidy/src/bins.rs index f6e42c8dc17..610d1d8af3b 100644 --- a/src/tools/tidy/src/bins.rs +++ b/src/tools/tidy/src/bins.rs @@ -1,36 +1,23 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Tidy check to ensure that there are no binaries checked into the source tree //! by accident. //! //! In the past we've accidentally checked in test binaries and such which add a -//! huge amount of bloat to the git history, so it's good to just ensure we -//! don't do that again :) +//! huge amount of bloat to the Git history, so it's good to just ensure we +//! don't do that again. use std::path::Path; -// All files are executable on Windows, so just check on Unix +// All files are executable on Windows, so just check on Unix. #[cfg(windows)] pub fn check(_path: &Path, _bad: &mut bool) {} #[cfg(unix)] pub fn check(path: &Path, bad: &mut bool) { use std::fs; - use std::io::Read; use std::process::{Command, Stdio}; use std::os::unix::prelude::*; - if let Ok(mut file) = fs::File::open("/proc/version") { - let mut contents = String::new(); - file.read_to_string(&mut contents).unwrap(); + if let Ok(contents) = fs::read_to_string("/proc/version") { // Probably on Windows Linux Subsystem or Docker via VirtualBox, // all files will be marked as executable, so skip checking. if contents.contains("Microsoft") || contents.contains("boot2docker") { diff --git a/src/tools/tidy/src/cargo.rs b/src/tools/tidy/src/cargo.rs index 466d2fa0d2b..26ced7fc829 100644 --- a/src/tools/tidy/src/cargo.rs +++ b/src/tools/tidy/src/cargo.rs @@ -1,13 +1,3 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Tidy check to ensure that `[dependencies]` and `extern crate` are in sync. //! //! This tidy check ensures that all crates listed in the `[dependencies]` @@ -15,8 +5,7 @@ //! `extern crate` declarations. This should help us keep the DAG correctly //! structured through various refactorings to prune out unnecessary edges. -use std::io::prelude::*; -use std::fs::File; +use std::fs; use std::path::Path; pub fn check(path: &Path, bad: &mut bool) { @@ -24,7 +13,7 @@ pub fn check(path: &Path, bad: &mut bool) { return } for entry in t!(path.read_dir(), path).map(|e| t!(e)) { - // Look for `Cargo.toml` with a sibling `src/lib.rs` or `lib.rs` + // Look for `Cargo.toml` with a sibling `src/lib.rs` or `lib.rs`. if entry.file_name().to_str() == Some("Cargo.toml") { if path.join("src/lib.rs").is_file() { verify(&entry.path(), &path.join("src/lib.rs"), bad) @@ -38,26 +27,26 @@ pub fn check(path: &Path, bad: &mut bool) { } } -// Verify that the dependencies in Cargo.toml at `tomlfile` are sync'd with the -// `extern crate` annotations in the lib.rs at `libfile`. +/// Verifies that the dependencies in Cargo.toml at `tomlfile` are synced with +/// the `extern crate` annotations in the lib.rs at `libfile`. fn verify(tomlfile: &Path, libfile: &Path, bad: &mut bool) { - let mut toml = String::new(); - let mut librs = String::new(); - t!(t!(File::open(tomlfile)).read_to_string(&mut toml)); - t!(t!(File::open(libfile)).read_to_string(&mut librs)); + let toml = t!(fs::read_to_string(&tomlfile)); + let librs = t!(fs::read_to_string(&libfile)); if toml.contains("name = \"bootstrap\"") { return } - // "Poor man's TOML parser", just assume we use one syntax for now + // "Poor man's TOML parser" -- just assume we use one syntax for now. // // We just look for: // - // [dependencies] - // name = ... - // name2 = ... - // name3 = ... + // ```` + // [dependencies] + // name = ... + // name2 = ... + // name3 = ... + // ``` // // If we encounter a line starting with `[` then we assume it's the end of // the dependency section and bail out. @@ -76,14 +65,14 @@ fn verify(tomlfile: &Path, libfile: &Path, bad: &mut bool) { continue } - // Don't worry about depending on core/std but not saying `extern crate - // core/std`, that's intentional. + // Don't worry about depending on core/std while not writing `extern crate + // core/std` -- that's intentional. if krate == "core" || krate == "std" { continue } - // This is intentional, this dependency just makes the crate available - // for others later on. Cover cases + // This is intentional -- this dependency just makes the crate available + // for others later on. let whitelisted = krate.starts_with("panic"); if toml.contains("name = \"std\"") && whitelisted { continue diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 2dfb9fc68ac..17c36b80f3a 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -1,18 +1,7 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Check license of third-party deps by inspecting src/vendor +//! Checks the licenses of third-party dependencies by inspecting vendors. use std::collections::{BTreeSet, HashSet, HashMap}; -use std::fs::File; -use std::io::Read; +use std::fs; use std::path::Path; use std::process::Command; @@ -32,11 +21,12 @@ const LICENSES: &[&str] = &[ /// These are exceptions to Rust's permissive licensing policy, and /// should be considered bugs. Exceptions are only allowed in Rust /// tooling. It is _crucial_ that no exception crates be dependencies -/// of the Rust runtime (std / test). +/// of the Rust runtime (std/test). const EXCEPTIONS: &[&str] = &[ "mdbook", // MPL2, mdbook "openssl", // BSD+advertising clause, cargo, mdbook "pest", // MPL2, mdbook via handlebars + "arrayref", // BSD-2-Clause, mdbook via handlebars via pest "thread-id", // Apache-2.0, mdbook "toml-query", // MPL-2.0, mdbook "is-match", // MPL-2.0, mdbook @@ -50,8 +40,11 @@ const EXCEPTIONS: &[&str] = &[ "colored", // MPL-2.0, rustfmt "ordslice", // Apache-2.0, rls "cloudabi", // BSD-2-Clause, (rls -> crossbeam-channel 0.2 -> rand 0.5) - "ryu", // Apache-2.0, rls/cargo/... (b/c of serde) + "ryu", // Apache-2.0, rls/cargo/... (because of serde) "bytesize", // Apache-2.0, cargo + "im-rc", // MPL-2.0+, cargo + "adler32", // BSD-3-Clause AND Zlib, cargo dep that isn't used + "fortanix-sgx-abi", // MPL-2.0+, libstd but only for `sgx` target ]; /// Which crates to check against the whitelist? @@ -62,12 +55,14 @@ const WHITELIST_CRATES: &[CrateVersion] = &[ /// Whitelist of crates rustc is allowed to depend on. Avoid adding to the list if possible. const WHITELIST: &[Crate] = &[ + Crate("adler32"), Crate("aho-corasick"), Crate("arrayvec"), Crate("atty"), Crate("backtrace"), Crate("backtrace-sys"), Crate("bitflags"), + Crate("build_const"), Crate("byteorder"), Crate("cc"), Crate("cfg-if"), @@ -75,6 +70,9 @@ const WHITELIST: &[Crate] = &[ Crate("chalk-macros"), Crate("cloudabi"), Crate("cmake"), + Crate("compiler_builtins"), + Crate("crc"), + Crate("crc32fast"), Crate("crossbeam-deque"), Crate("crossbeam-epoch"), Crate("crossbeam-utils"), @@ -100,6 +98,8 @@ const WHITELIST: &[Crate] = &[ Crate("memmap"), Crate("memoffset"), Crate("miniz-sys"), + Crate("miniz_oxide"), + Crate("miniz_oxide_c_api"), Crate("nodrop"), Crate("num_cpus"), Crate("owning_ref"), @@ -107,9 +107,16 @@ const WHITELIST: &[Crate] = &[ Crate("parking_lot_core"), Crate("pkg-config"), Crate("polonius-engine"), + Crate("proc-macro2"), Crate("quick-error"), + Crate("quote"), Crate("rand"), + Crate("rand_chacha"), Crate("rand_core"), + Crate("rand_hc"), + Crate("rand_isaac"), + Crate("rand_pcg"), + Crate("rand_xorshift"), Crate("redox_syscall"), Crate("redox_termios"), Crate("regex"), @@ -119,10 +126,16 @@ const WHITELIST: &[Crate] = &[ Crate("rustc-hash"), Crate("rustc-rayon"), Crate("rustc-rayon-core"), + Crate("rustc_version"), Crate("scoped-tls"), Crate("scopeguard"), + Crate("semver"), + Crate("semver-parser"), + Crate("serde"), + Crate("serde_derive"), Crate("smallvec"), Crate("stable_deref_trait"), + Crate("syn"), Crate("tempfile"), Crate("termcolor"), Crate("terminon"), @@ -130,11 +143,12 @@ const WHITELIST: &[Crate] = &[ Crate("thread_local"), Crate("ucd-util"), Crate("unicode-width"), + Crate("unicode-xid"), Crate("unreachable"), Crate("utf8-ranges"), + Crate("vcpkg"), Crate("version_check"), Crate("void"), - Crate("vcpkg"), Crate("winapi"), Crate("winapi-build"), Crate("winapi-i686-pc-windows-gnu"), @@ -143,7 +157,7 @@ const WHITELIST: &[Crate] = &[ Crate("wincolor"), ]; -// Some types for Serde to deserialize the output of `cargo metadata` to... +// Some types for Serde to deserialize the output of `cargo metadata` to. #[derive(Deserialize)] struct Output { @@ -161,9 +175,9 @@ struct ResolveNode { dependencies: Vec, } -/// A unique identifier for a crate +/// A unique identifier for a crate. #[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Debug, Hash)] -struct Crate<'a>(&'a str); // (name,) +struct Crate<'a>(&'a str); // (name) #[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Debug, Hash)] struct CrateVersion<'a>(&'a str, &'a str); // (name, version) @@ -175,7 +189,7 @@ impl<'a> Crate<'a> { } impl<'a> CrateVersion<'a> { - /// Returns the struct and whether or not the dep is in-tree + /// Returns the struct and whether or not the dependency is in-tree. pub fn from_str(s: &'a str) -> (Self, bool) { let mut parts = s.split(' '); let name = parts.next().unwrap(); @@ -202,20 +216,20 @@ impl<'a> From> for Crate<'a> { /// /// Specifically, this checks that the license is correct. pub fn check(path: &Path, bad: &mut bool) { - // Check licences - let path = path.join("vendor"); + // Check licences. + let path = path.join("../vendor"); assert!(path.exists(), "vendor directory missing"); let mut saw_dir = false; for dir in t!(path.read_dir()) { saw_dir = true; let dir = t!(dir); - // skip our exceptions + // Skip our exceptions. let is_exception = EXCEPTIONS.iter().any(|exception| { dir.path() .to_str() .unwrap() - .contains(&format!("src/vendor/{}", exception)) + .contains(&format!("vendor/{}", exception)) }); if is_exception { continue; @@ -227,18 +241,18 @@ pub fn check(path: &Path, bad: &mut bool) { assert!(saw_dir, "no vendored source"); } -/// Checks the dependency of WHITELIST_CRATES at the given path. Changes `bad` to `true` if a check -/// failed. +/// Checks the dependency of `WHITELIST_CRATES` at the given path. Changes `bad` to `true` if a +/// check failed. /// -/// Specifically, this checks that the dependencies are on the WHITELIST. +/// Specifically, this checks that the dependencies are on the `WHITELIST`. pub fn check_whitelist(path: &Path, cargo: &Path, bad: &mut bool) { - // Get dependencies from cargo metadata + // Get dependencies from Cargo metadata. let resolve = get_deps(path, cargo); - // Get the whitelist into a convenient form + // Get the whitelist in a convenient form. let whitelist: HashSet<_> = WHITELIST.iter().cloned().collect(); - // Check dependencies + // Check dependencies. let mut visited = BTreeSet::new(); let mut unapproved = BTreeSet::new(); for &krate in WHITELIST_CRATES.iter() { @@ -261,8 +275,7 @@ fn check_license(path: &Path) -> bool { if !path.exists() { panic!("{} does not exist", path.display()); } - let mut contents = String::new(); - t!(t!(File::open(path)).read_to_string(&mut contents)); + let contents = t!(fs::read_to_string(&path)); let mut found_license = false; for line in contents.lines() { @@ -296,15 +309,15 @@ fn extract_license(line: &str) -> String { } } -/// Get the dependencies of the crate at the given path using `cargo metadata`. +/// Gets the dependencies of the crate at the given path using `cargo metadata`. fn get_deps(path: &Path, cargo: &Path) -> Resolve { - // Run `cargo metadata` to get the set of dependencies + // Run `cargo metadata` to get the set of dependencies. let output = Command::new(cargo) .arg("metadata") .arg("--format-version") .arg("1") .arg("--manifest-path") - .arg(path.join("Cargo.toml")) + .arg(path.join("../Cargo.toml")) .output() .expect("Unable to run `cargo metadata`") .stdout; @@ -323,25 +336,25 @@ fn check_crate_whitelist<'a, 'b>( krate: CrateVersion<'a>, must_be_on_whitelist: bool, ) -> BTreeSet> { - // Will contain bad deps + // This will contain bad deps. let mut unapproved = BTreeSet::new(); - // Check if we have already visited this crate + // Check if we have already visited this crate. if visited.contains(&krate) { return unapproved; } visited.insert(krate); - // If this path is in-tree, we don't require it to be on the whitelist + // If this path is in-tree, we don't require it to be on the whitelist. if must_be_on_whitelist { - // If this dependency is not on the WHITELIST, add to bad set + // If this dependency is not on `WHITELIST`, add to bad set. if !whitelist.contains(&krate.into()) { unapproved.insert(krate.into()); } } - // Do a DFS in the crate graph (it's a DAG, so we know we have no cycles!) + // Do a DFS in the crate graph (it's a DAG, so we know we have no cycles!). let to_check = resolve .nodes .iter() @@ -360,9 +373,10 @@ fn check_crate_whitelist<'a, 'b>( fn check_crate_duplicate(resolve: &Resolve, bad: &mut bool) { const FORBIDDEN_TO_HAVE_DUPLICATES: &[&str] = &[ - // These two crates take quite a long time to build, let's not let two - // versions of them accidentally sneak into our dependency graph to - // ensure we keep our CI times under control + // These two crates take quite a long time to build, so don't allow two versions of them + // to accidentally sneak into our dependency graph, in order to ensure we keep our CI times + // under control. + // "cargo", // FIXME(#53005) "rustc-ap-syntax", ]; diff --git a/src/tools/tidy/src/errors.rs b/src/tools/tidy/src/errors.rs index 9f55d6f9ad6..76ebc9b6010 100644 --- a/src/tools/tidy/src/errors.rs +++ b/src/tools/tidy/src/errors.rs @@ -1,13 +1,3 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Tidy check to verify the validity of long error diagnostic codes. //! //! This ensures that error codes are used at most once and also prints out some @@ -32,11 +22,13 @@ pub fn check(path: &Path, bad: &mut bool) { contents.truncate(0); t!(t!(File::open(file)).read_to_string(&mut contents)); - // In the register_long_diagnostics! macro, entries look like this: + // In the `register_long_diagnostics!` macro, entries look like this: // + // ``` // EXXXX: r##" // // "##, + // ``` // // and these long messages often have error codes themselves inside // them, but we don't want to report duplicates in these cases. This diff --git a/src/tools/tidy/src/extdeps.rs b/src/tools/tidy/src/extdeps.rs index 7f58b440a83..52e263df5e3 100644 --- a/src/tools/tidy/src/extdeps.rs +++ b/src/tools/tidy/src/extdeps.rs @@ -1,45 +1,32 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +//! Check for external package sources. Allow only vendorable packages. -// ! Check for external package sources. Allow only vendorable packages. - -use std::fs::File; -use std::io::Read; +use std::fs; use std::path::Path; -/// List of whitelisted sources for packages +/// List of whitelisted sources for packages. const WHITELISTED_SOURCES: &[&str] = &[ "\"registry+https://github.com/rust-lang/crates.io-index\"", ]; -/// check for external package sources +/// Checks for external package sources. pub fn check(path: &Path, bad: &mut bool) { - // Cargo.lock of rust: src/Cargo.lock - let path = path.join("Cargo.lock"); + // `Cargo.lock` of rust (tidy runs inside `src/`). + let path = path.join("../Cargo.lock"); - // open and read the whole file - let mut cargo_lock = String::new(); - t!(t!(File::open(path)).read_to_string(&mut cargo_lock)); + // Open and read the whole file. + let cargo_lock = t!(fs::read_to_string(&path)); - // process each line + // Process each line. for line in cargo_lock.lines() { - - // consider only source entries + // Consider only source entries. if ! line.starts_with("source = ") { continue; } - // extract source value + // Extract source value. let source = line.splitn(2, '=').nth(1).unwrap().trim(); - // ensure source is whitelisted + // Ensure source is whitelisted. if !WHITELISTED_SOURCES.contains(&&*source) { println!("invalid source: {}", source); *bad = true; diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 85b123e4af5..7126c0c2f6e 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -1,26 +1,16 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Tidy check to ensure that unstable features are all in order +//! Tidy check to ensure that unstable features are all in order. //! //! This check will ensure properties like: //! -//! * All stability attributes look reasonably well formed -//! * The set of library features is disjoint from the set of language features -//! * Library features have at most one stability level -//! * Library features have at most one `since` value -//! * All unstable lang features have tests to ensure they are actually unstable +//! * All stability attributes look reasonably well formed. +//! * The set of library features is disjoint from the set of language features. +//! * Library features have at most one stability level. +//! * Library features have at most one `since` value. +//! * All unstable lang features have tests to ensure they are actually unstable. use std::collections::HashMap; use std::fmt; -use std::fs::File; +use std::fs::{self, File}; use std::io::prelude::*; use std::path::Path; @@ -61,12 +51,9 @@ pub fn check(path: &Path, bad: &mut bool, quiet: bool) { let mut contents = String::new(); - super::walk_many(&[&path.join("test/ui-fulldeps"), - &path.join("test/ui"), - &path.join("test/compile-fail"), - &path.join("test/compile-fail-fulldeps"), - &path.join("test/parse-fail"), - &path.join("test/ui"),], + super::walk_many(&[&path.join("test/ui"), + &path.join("test/ui-fulldeps"), + &path.join("test/compile-fail")], &mut |path| super::filter_dirs(path), &mut |file| { let filename = file.file_name().unwrap().to_string_lossy(); @@ -183,12 +170,10 @@ fn test_filen_gate(filen_underscore: &str, features: &mut Features) -> bool { } pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features { - let mut contents = String::new(); - let path = base_src_path.join("libsyntax/feature_gate.rs"); - t!(t!(File::open(path)).read_to_string(&mut contents)); + let contents = t!(fs::read_to_string(base_src_path.join("libsyntax/feature_gate.rs"))); - // we allow rustc-internal features to omit a tracking issue. - // these features must be marked with `// rustc internal` in its own group. + // We allow rustc-internal features to omit a tracking issue. + // These features must be marked with a `// rustc internal` in its own group. let mut next_feature_is_rustc_internal = false; contents.lines().zip(1..) @@ -203,7 +188,7 @@ pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features { } let mut parts = line.split(','); - let level = match parts.next().map(|l| l.trim().trim_left_matches('(')) { + let level = match parts.next().map(|l| l.trim().trim_start_matches('(')) { Some("active") => Status::Unstable, Some("removed") => Status::Removed, Some("accepted") => Status::Stable, @@ -342,7 +327,7 @@ fn map_lib_features(base_src_path: &Path, } becoming_feature = None; if line.contains("rustc_const_unstable(") { - // const fn features are handled specially + // `const fn` features are handled specially. let feature_name = match find_attr_val(line, "feature") { Some(name) => name, None => err!("malformed stability attribute"), @@ -351,12 +336,10 @@ fn map_lib_features(base_src_path: &Path, level: Status::Unstable, since: "None".to_owned(), has_gate_test: false, - // Whether there is a common tracking issue - // for these feature gates remains an open question - // https://github.com/rust-lang/rust/issues/24111#issuecomment-340283184 - // But we take 24111 otherwise they will be shown as - // "internal to the compiler" which they are not. - tracking_issue: Some(24111), + // FIXME(#57563): #57563 is now used as a common tracking issue, + // although we would like to have specific tracking issues for each + // `rustc_const_unstable` in the future. + tracking_issue: Some(57563), }; mf(Ok((feature_name, feature)), file, i + 1); continue; diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index e235de9c5e1..022c53f909c 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -1,14 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Library used by tidy and other tools +//! Library used by tidy and other tools. //! //! This library contains the tidy lints and exposes it //! to be used by tools. @@ -56,16 +46,12 @@ pub mod libcoretest; fn filter_dirs(path: &Path) -> bool { let skip = [ - "src/dlmalloc", "src/llvm", + "src/llvm-project", "src/llvm-emscripten", "src/libbacktrace", - "src/libcompiler_builtins", "src/librustc_data_structures/owning_ref", - "src/compiler-rt", - "src/liblibc", "src/vendor", - "src/rt/hoedown", "src/tools/cargo", "src/tools/clang", "src/tools/rls", @@ -77,7 +63,9 @@ fn filter_dirs(path: &Path) -> bool { "src/tools/lldb", "src/target", "src/stdsimd", + "src/rust-sgx", "target", + "vendor", ]; skip.iter().any(|p| path.ends_with(p)) } diff --git a/src/tools/tidy/src/libcoretest.rs b/src/tools/tidy/src/libcoretest.rs index 363d01d964e..b15b9c3462f 100644 --- a/src/tools/tidy/src/libcoretest.rs +++ b/src/tools/tidy/src/libcoretest.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Tidy check to ensure `#[test]` is not used directly inside `libcore`. //! //! `#![no_core]` libraries cannot be tested directly due to duplicating lang diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs index 22fa954e5fa..81b7b2a7731 100644 --- a/src/tools/tidy/src/main.rs +++ b/src/tools/tidy/src/main.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Tidy checks source code in this repository +//! Tidy checks source code in this repository. //! //! This program runs all of the various tidy checks for style, cleanliness, //! etc. This is run by default on `make check` and as part of the auto diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs index 12e9a54da52..0f722945c49 100644 --- a/src/tools/tidy/src/pal.rs +++ b/src/tools/tidy/src/pal.rs @@ -1,14 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Tidy check to enforce rules about platform-specific code in std +//! Tidy check to enforce rules about platform-specific code in std. //! //! This is intended to maintain existing standards of code //! organization in hopes that the standard library will continue to @@ -25,16 +15,15 @@ //! Following are the basic rules, though there are currently //! exceptions: //! -//! - core may not have platform-specific code -//! - libcompiler_builtins may have platform-specific code -//! - libpanic_abort may have platform-specific code -//! - libpanic_unwind may have platform-specific code -//! - libunwind may have platform-specific code -//! - other crates in the std facade may not -//! - std may have platform-specific code in the following places -//! - sys/unix/ -//! - sys/windows/ -//! - os/ +//! - core may not have platform-specific code. +//! - libpanic_abort may have platform-specific code. +//! - libpanic_unwind may have platform-specific code. +//! - libunwind may have platform-specific code. +//! - other crates in the std facade may not. +//! - std may have platform-specific code in the following places: +//! - `sys/unix/` +//! - `sys/windows/` +//! - `os/` //! //! `std/sys_common` should _not_ contain platform-specific code. //! Finally, because std contains tests with platform-specific @@ -47,11 +36,9 @@ use std::io::Read; use std::path::Path; use std::iter::Iterator; -// Paths that may contain platform-specific code +// Paths that may contain platform-specific code. const EXCEPTION_PATHS: &[&str] = &[ // std crates - "src/libcompiler_builtins", - "src/liblibc", "src/libpanic_abort", "src/libpanic_unwind", "src/libunwind", @@ -61,19 +48,28 @@ const EXCEPTION_PATHS: &[&str] = &[ "src/rtstartup", // Not sure what to do about this. magic stuff for mingw // temporary exceptions - "src/libstd/lib.rs", // FIXME(#44217) + "src/libstd/lib.rs", "src/libstd/path.rs", "src/libstd/f32.rs", "src/libstd/f64.rs", + // Integration test for platform-specific run-time feature detection: + "src/libstd/tests/run-time-detect.rs" , "src/libstd/sys_common/mod.rs", "src/libstd/sys_common/net.rs", - "src/libterm", // Not sure how to make this crate portable, but test needs it - "src/libtest", // Probably should defer to unstable std::sys APIs + "src/libterm", // Not sure how to make this crate portable, but test crate needs it. + "src/libtest", // Probably should defer to unstable `std::sys` APIs. - // std testing crates, ok for now at least + // std testing crates, okay for now at least "src/libcore/tests", "src/liballoc/tests/lib.rs", + // The `VaList` implementation must have platform specific code. + // The Windows implementation of a `va_list` is always a character + // pointer regardless of the target architecture. As a result, + // we must use `#[cfg(windows)]` to conditionally compile the + // correct `VaList` structure for windows. + "src/libcore/ffi.rs", + // non-std crates "src/test", "src/tools", @@ -85,7 +81,7 @@ const EXCEPTION_PATHS: &[&str] = &[ pub fn check(path: &Path, bad: &mut bool) { let mut contents = String::new(); - // Sanity check that the complex parsing here works + // Sanity check that the complex parsing here works. let mut saw_target_arch = false; let mut saw_cfg_bang = false; super::walk(path, &mut super::filter_dirs, &mut |file| { @@ -110,7 +106,7 @@ fn check_cfgs(contents: &mut String, file: &Path, // For now it's ok to have platform-specific code after 'mod tests'. let mod_tests_idx = find_test_mod(contents); let contents = &contents[..mod_tests_idx]; - // Pull out all "cfg(...)" and "cfg!(...)" strings + // Pull out all `cfg(...)` and `cfg!(...)` strings. let cfgs = parse_cfgs(contents); let mut line_numbers: Option> = None; @@ -127,7 +123,7 @@ fn check_cfgs(contents: &mut String, file: &Path, }; for (idx, cfg) in cfgs { - // Sanity check that the parsing here works + // Sanity check that the parsing here works. if !*saw_target_arch && cfg.contains("target_arch") { *saw_target_arch = true } if !*saw_cfg_bang && cfg.contains("cfg!") { *saw_cfg_bang = true } @@ -159,7 +155,7 @@ fn check_cfgs(contents: &mut String, file: &Path, fn find_test_mod(contents: &str) -> usize { if let Some(mod_tests_idx) = contents.find("mod tests") { - // Also capture a previous line indicating "mod tests" in cfg-ed out + // Also capture a previous line indicating that "mod tests" is cfg'd out. let prev_newline_idx = contents[..mod_tests_idx].rfind('\n').unwrap_or(mod_tests_idx); let prev_newline_idx = contents[..prev_newline_idx].rfind('\n'); if let Some(nl) = prev_newline_idx { @@ -182,7 +178,7 @@ fn parse_cfgs<'a>(contents: &'a str) -> Vec<(usize, &'a str)> { let candidate_cfgs = contents.match_indices("cfg"); let candidate_cfg_idxs = candidate_cfgs.map(|(i, _)| i); // This is puling out the indexes of all "cfg" strings - // that appear to be tokens succeeded by a paren. + // that appear to be tokens followed by a parenthesis. let cfgs = candidate_cfg_idxs.filter(|i| { let pre_idx = i.saturating_sub(*i); let succeeds_non_ident = !contents.as_bytes().get(pre_idx) diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index 33cd8b5dcd9..df54afe160b 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -1,23 +1,13 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Tidy check to enforce various stylistic guidelines on the Rust codebase. //! //! Example checks are: //! -//! * No lines over 100 characters -//! * No tabs -//! * No trailing whitespace -//! * No CR characters -//! * No `TODO` or `XXX` directives -//! * No unexplained ` ```ignore ` or ` ```rust,ignore ` doc tests +//! * No lines over 100 characters. +//! * No tabs. +//! * No trailing whitespace. +//! * No CR characters. +//! * No `TODO` or `XXX` directives. +//! * No unexplained ` ```ignore ` or ` ```rust,ignore ` doc tests. //! //! A number of these checks can be opted-out of with various directives like //! `// ignore-tidy-linelength`. @@ -44,15 +34,17 @@ C++ code used llvm_unreachable, which triggers undefined behavior when executed when assertions are disabled. Use llvm::report_fatal_error for increased robustness."; -/// Parser states for line_is_url. +/// Parser states for `line_is_url`. #[derive(PartialEq)] #[allow(non_camel_case_types)] -enum LIUState { EXP_COMMENT_START, - EXP_LINK_LABEL_OR_URL, - EXP_URL, - EXP_END } +enum LIUState { + EXP_COMMENT_START, + EXP_LINK_LABEL_OR_URL, + EXP_URL, + EXP_END, +} -/// True if LINE appears to be a line comment containing an URL, +/// Returns whether `line` appears to be a line comment containing an URL, /// possibly with a Markdown link label in front, and nothing else. /// The Markdown link label, if present, may not contain whitespace. /// Lines of this form are allowed to be overlength, because Markdown @@ -87,7 +79,7 @@ fn line_is_url(line: &str) -> bool { state == EXP_END } -/// True if LINE is allowed to be longer than the normal limit. +/// Returns whether `line` is allowed to be longer than the normal limit. /// Currently there is only one exception, for long URLs, but more /// may be added in the future. fn long_line_is_ok(line: &str) -> bool { @@ -119,6 +111,7 @@ pub fn check(path: &Path, bad: &mut bool) { let skip_tab = contents.contains("ignore-tidy-tab"); let skip_length = contents.contains("ignore-tidy-linelength"); let skip_end_whitespace = contents.contains("ignore-tidy-end-whitespace"); + let skip_copyright = contents.contains("ignore-tidy-copyright"); let mut trailing_new_lines = 0; for (i, line) in contents.split('\n').enumerate() { let mut err = |msg: &str| { @@ -128,13 +121,13 @@ pub fn check(path: &Path, bad: &mut bool) { && !long_line_is_ok(line) { err(&format!("line longer than {} chars", COLS)); } - if line.contains('\t') && !skip_tab { + if !skip_tab && line.contains('\t') { err("tab character"); } if !skip_end_whitespace && (line.ends_with(' ') || line.ends_with('\t')) { err("trailing whitespace"); } - if line.contains('\r') && !skip_cr { + if !skip_cr && line.contains('\r') { err("CR character"); } if filename != "style.rs" { @@ -145,6 +138,13 @@ pub fn check(path: &Path, bad: &mut bool) { err("XXX is deprecated; use FIXME") } } + if !skip_copyright && (line.starts_with("// Copyright") || + line.starts_with("# Copyright") || + line.starts_with("Copyright")) + && (line.contains("Rust Developers") || + line.contains("Rust Project Developers")) { + err("copyright notices attributed to the Rust Project Developers are deprecated"); + } if line.ends_with("```ignore") || line.ends_with("```rust,ignore") { err(UNEXPLAINED_IGNORE_DOCTEST_INFO); } diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index c1574407807..b572b52ea8f 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -1,13 +1,3 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Tidy check to ensure that there are no stray `.stderr` files in UI test directories. use std::fs; @@ -20,14 +10,16 @@ pub fn check(path: &Path, bad: &mut bool) { &mut |file_path| { if let Some(ext) = file_path.extension() { if ext == "stderr" || ext == "stdout" { - // Test output filenames have the format: + // Test output filenames have one of the formats: + // ``` // $testname.stderr // $testname.$mode.stderr // $testname.$revision.stderr // $testname.$revision.$mode.stderr + // ``` // // For now, just make sure that there is a corresponding - // $testname.rs file. + // `$testname.rs` file. let testname = file_path .file_name() .unwrap() diff --git a/src/tools/tidy/src/unstable_book.rs b/src/tools/tidy/src/unstable_book.rs index 520879df620..bd3b1f033c7 100644 --- a/src/tools/tidy/src/unstable_book.rs +++ b/src/tools/tidy/src/unstable_book.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::collections::BTreeSet; use std::fs; use std::path; @@ -21,22 +11,24 @@ pub const LANG_FEATURES_DIR: &str = "language-features"; pub const LIB_FEATURES_DIR: &str = "library-features"; -/// Build the path to the Unstable Book source directory from the Rust 'src' directory +/// Builds the path to the Unstable Book source directory from the Rust 'src' directory. pub fn unstable_book_path(base_src_path: &path::Path) -> path::PathBuf { base_src_path.join(PATH_STR) } -/// Directory where the features are documented within the Unstable Book source directory +/// Builds the path to the directory where the features are documented within the Unstable Book +/// source directory. pub fn unstable_book_lang_features_path(base_src_path: &path::Path) -> path::PathBuf { unstable_book_path(base_src_path).join(LANG_FEATURES_DIR) } -/// Directory where the features are documented within the Unstable Book source directory +/// Builds the path to the directory where the features are documented within the Unstable Book +/// source directory. pub fn unstable_book_lib_features_path(base_src_path: &path::Path) -> path::PathBuf { unstable_book_path(base_src_path).join(LIB_FEATURES_DIR) } -/// Test to determine if DirEntry is a file +/// Tests whether `DirEntry` is a file. fn dir_entry_is_file(dir_entry: &fs::DirEntry) -> bool { dir_entry .file_type() @@ -44,7 +36,7 @@ fn dir_entry_is_file(dir_entry: &fs::DirEntry) -> bool { .is_file() } -/// Retrieve names of all unstable features +/// Retrieves names of all unstable features. pub fn collect_unstable_feature_names(features: &Features) -> BTreeSet { features .iter() @@ -66,24 +58,23 @@ pub fn collect_unstable_book_section_file_names(dir: &path::Path) -> BTreeSet BTreeSet { collect_unstable_book_section_file_names(&unstable_book_lang_features_path(base_src_path)) } -/// Retrieve file names of all language feature sections in the Unstable Book with: +/// Retrieves file names of all language feature sections in the Unstable Book with: /// -/// * hyphens replaced by underscores -/// * the markdown suffix ('.md') removed +/// * hyphens replaced by underscores, +/// * the markdown suffix ('.md') removed. fn collect_unstable_book_lib_features_section_file_names(base_src_path: &path::Path) -> BTreeSet { collect_unstable_book_section_file_names(&unstable_book_lib_features_path(base_src_path)) } pub fn check(path: &path::Path, bad: &mut bool) { - // Library features let lang_features = collect_lang_features(path, bad); @@ -110,7 +101,7 @@ pub fn check(path: &path::Path, bad: &mut bool) { let unstable_book_lang_features_section_file_names = collect_unstable_book_lang_features_section_file_names(path); - // Check for Unstable Book sections that don't have a corresponding unstable feature + // Check for Unstable Book sections that don't have a corresponding unstable feature. for feature_name in &unstable_book_lang_features_section_file_names - &unstable_lang_feature_names { tidy_error!(bad, @@ -119,8 +110,8 @@ pub fn check(path: &path::Path, bad: &mut bool) { feature_name) } - // List unstable features that don't have Unstable Book sections - // Remove the comment marker if you want the list printed + // List unstable features that don't have Unstable Book sections. + // Remove the comment marker if you want the list printed. /* println!("Lib features without unstable book sections:"); for feature_name in &unstable_lang_feature_names - diff --git a/src/tools/unstable-book-gen/src/main.rs b/src/tools/unstable-book-gen/src/main.rs index b97137d7d64..df12eaf0cb0 100644 --- a/src/tools/unstable-book-gen/src/main.rs +++ b/src/tools/unstable-book-gen/src/main.rs @@ -1,13 +1,3 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Auto-generate stub docs for the unstable book #![deny(warnings)] diff --git a/x.py b/x.py index e277ab98be1..7973730ef17 100755 --- a/x.py +++ b/x.py @@ -1,13 +1,4 @@ #!/usr/bin/env python -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 or the MIT license -# , at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. # This file is only a "symlink" to bootstrap.py, all logic should go there.

", HDRS.len())?; write!(w, "{:?}", block.index())?; write!(w, "